summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16156
-rw-r--r--ChangeLog.20027877
-rw-r--r--ChangeLog.20043653
-rw-r--r--README7
-rw-r--r--bitmaps/error.xbm (renamed from bitmaps/error.bmp)0
-rw-r--r--bitmaps/gray12.xbm (renamed from bitmaps/gray12.bmp)0
-rw-r--r--bitmaps/gray25.xbm (renamed from bitmaps/gray25.bmp)0
-rw-r--r--bitmaps/gray50.xbm (renamed from bitmaps/gray50.bmp)0
-rw-r--r--bitmaps/gray75.xbm (renamed from bitmaps/gray75.bmp)0
-rw-r--r--bitmaps/hourglass.xbm (renamed from bitmaps/hourglass.bmp)0
-rw-r--r--bitmaps/info.xbm (renamed from bitmaps/info.bmp)0
-rw-r--r--bitmaps/questhead.xbm (renamed from bitmaps/questhead.bmp)0
-rw-r--r--bitmaps/question.xbm (renamed from bitmaps/question.bmp)0
-rw-r--r--bitmaps/warning.xbm (renamed from bitmaps/warning.bmp)0
-rw-r--r--changes801
-rw-r--r--doc/3DBorder.356
-rw-r--r--doc/AddOption.319
-rw-r--r--doc/BindTable.36
-rw-r--r--doc/CanvPsY.314
-rw-r--r--doc/CanvTkwin.318
-rw-r--r--doc/CanvTxtInfo.330
-rw-r--r--doc/Clipboard.38
-rw-r--r--doc/ConfigWidg.3198
-rw-r--r--doc/ConfigWind.36
-rw-r--r--doc/CrtCmHdlr.38
-rw-r--r--doc/CrtConsoleChan.344
-rw-r--r--doc/CrtErrHdlr.326
-rw-r--r--doc/CrtGenHdlr.34
-rw-r--r--doc/CrtImgType.3130
-rw-r--r--doc/CrtItemType.3268
-rw-r--r--doc/CrtPhImgFmt.3135
-rw-r--r--doc/CrtSelHdlr.313
-rw-r--r--doc/CrtWindow.324
-rw-r--r--doc/DeleteImg.32
-rw-r--r--doc/EventHndlr.34
-rw-r--r--doc/FindPhoto.392
-rw-r--r--doc/FontId.330
-rw-r--r--doc/FreeXId.34
-rw-r--r--doc/GetAnchor.334
-rw-r--r--doc/GetBitmap.352
-rw-r--r--doc/GetCapStyl.318
-rw-r--r--doc/GetClrmap.324
-rw-r--r--doc/GetColor.320
-rw-r--r--doc/GetCursor.333
-rw-r--r--doc/GetDash.342
-rw-r--r--doc/GetFont.319
-rw-r--r--doc/GetHINSTANCE.34
-rw-r--r--doc/GetHWND.32
-rw-r--r--doc/GetImage.318
-rw-r--r--doc/GetJoinStl.318
-rw-r--r--doc/GetJustify.330
-rw-r--r--doc/GetOption.34
-rw-r--r--doc/GetPixels.318
-rw-r--r--doc/GetRelief.344
-rw-r--r--doc/GetRootCrd.34
-rw-r--r--doc/GetScroll.34
-rw-r--r--doc/GetSelect.316
-rw-r--r--doc/GetUid.33
-rw-r--r--doc/GetVRoot.39
-rw-r--r--doc/GetVisual.324
-rw-r--r--doc/Grab.34
-rw-r--r--doc/HandleEvent.35
-rw-r--r--doc/Inactive.336
-rw-r--r--doc/InternAtom.37
-rw-r--r--doc/MaintGeom.35
-rw-r--r--doc/ManageGeom.319
-rw-r--r--doc/MapWindow.34
-rw-r--r--doc/MeasureChar.326
-rw-r--r--doc/MoveToplev.32
-rw-r--r--doc/Name.316
-rw-r--r--doc/NameOfImg.32
-rw-r--r--doc/ParseArgv.3145
-rw-r--r--doc/QWinEvent.33
-rw-r--r--doc/RestrictEv.39
-rw-r--r--doc/SetAppName.311
-rw-r--r--doc/SetClassProcs.322
-rw-r--r--doc/SetOptions.3174
-rw-r--r--doc/SetVisual.32
-rw-r--r--doc/StrictMotif.35
-rw-r--r--doc/TextLayout.327
-rw-r--r--doc/TkInitStubs.310
-rw-r--r--doc/Tk_Init.35
-rw-r--r--doc/Tk_Main.33
-rw-r--r--doc/WindowId.316
-rw-r--r--doc/bind.n394
-rw-r--r--doc/bindtags.n7
-rw-r--r--doc/button.n37
-rw-r--r--doc/canvas.n372
-rw-r--r--doc/checkbutton.n105
-rw-r--r--doc/chooseColor.n1
-rw-r--r--doc/chooseDirectory.n26
-rw-r--r--doc/clipboard.n69
-rw-r--r--doc/colors.n1762
-rw-r--r--doc/console.n15
-rw-r--r--doc/cursors.n14
-rw-r--r--doc/destroy.n9
-rw-r--r--doc/dialog.n6
-rw-r--r--doc/entry.n76
-rw-r--r--doc/event.n102
-rw-r--r--doc/focus.n20
-rw-r--r--doc/focusNext.n7
-rw-r--r--doc/font.n234
-rw-r--r--doc/frame.n27
-rw-r--r--doc/getOpenFile.n87
-rw-r--r--doc/grab.n9
-rw-r--r--doc/grid.n253
-rw-r--r--doc/image.n2
-rw-r--r--doc/label.n26
-rw-r--r--doc/labelframe.n53
-rw-r--r--doc/listbox.n56
-rw-r--r--doc/loadTk.n11
-rw-r--r--doc/menu.n157
-rw-r--r--doc/menubutton.n12
-rw-r--r--doc/message.n29
-rw-r--r--doc/messageBox.n19
-rw-r--r--doc/option.n47
-rw-r--r--doc/optionMenu.n15
-rw-r--r--doc/options.n42
-rw-r--r--doc/pack-old.n2
-rw-r--r--doc/pack.n28
-rw-r--r--doc/palette.n15
-rw-r--r--doc/panedwindow.n63
-rw-r--r--doc/photo.n27
-rw-r--r--doc/place.n17
-rw-r--r--doc/radiobutton.n49
-rw-r--r--doc/raise.n10
-rw-r--r--doc/scale.n7
-rw-r--r--doc/scrollbar.n18
-rw-r--r--doc/selection.n48
-rw-r--r--doc/send.n15
-rw-r--r--doc/spinbox.n51
-rw-r--r--doc/text.n1012
-rw-r--r--doc/tk.n42
-rw-r--r--doc/tkvars.n2
-rw-r--r--doc/toplevel.n2
-rw-r--r--doc/ttk_Geometry.3223
-rw-r--r--doc/ttk_Theme.332
-rw-r--r--doc/ttk_button.n81
-rw-r--r--doc/ttk_checkbutton.n77
-rw-r--r--doc/ttk_combobox.n119
-rw-r--r--doc/ttk_entry.n470
-rw-r--r--doc/ttk_frame.n56
-rw-r--r--doc/ttk_image.n82
-rw-r--r--doc/ttk_intro.n177
-rw-r--r--doc/ttk_label.n78
-rw-r--r--doc/ttk_labelframe.n76
-rw-r--r--doc/ttk_menubutton.n54
-rw-r--r--doc/ttk_notebook.n213
-rw-r--r--doc/ttk_panedwindow.n112
-rw-r--r--doc/ttk_progressbar.n93
-rw-r--r--doc/ttk_radiobutton.n74
-rw-r--r--doc/ttk_scale.n101
-rw-r--r--doc/ttk_scrollbar.n163
-rw-r--r--doc/ttk_separator.n38
-rw-r--r--doc/ttk_sizegrip.n69
-rw-r--r--doc/ttk_spinbox.n86
-rw-r--r--doc/ttk_style.n131
-rw-r--r--doc/ttk_treeview.n484
-rw-r--r--doc/ttk_vsapi.n102
-rw-r--r--doc/ttk_widget.n262
-rw-r--r--doc/winfo.n40
-rw-r--r--doc/wish.189
-rw-r--r--doc/wm.n204
-rw-r--r--generic/README4
-rw-r--r--generic/default.h4
-rw-r--r--generic/prolog.ps283
-rw-r--r--generic/tk.decls949
-rw-r--r--generic/tk.h1053
-rw-r--r--generic/tk3d.c667
-rw-r--r--generic/tk3d.h74
-rw-r--r--generic/tkArgv.c467
-rw-r--r--generic/tkAtom.c133
-rw-r--r--generic/tkBind.c3504
-rw-r--r--generic/tkBitmap.c808
-rw-r--r--generic/tkButton.c851
-rw-r--r--generic/tkButton.h233
-rw-r--r--generic/tkCanvArc.c979
-rw-r--r--generic/tkCanvBmap.c518
-rw-r--r--generic/tkCanvImg.c526
-rw-r--r--generic/tkCanvLine.c1110
-rw-r--r--generic/tkCanvPoly.c934
-rw-r--r--generic/tkCanvPs.c1550
-rw-r--r--generic/tkCanvText.c747
-rw-r--r--generic/tkCanvUtil.c1304
-rw-r--r--generic/tkCanvWind.c622
-rw-r--r--generic/tkCanvas.c3552
-rw-r--r--generic/tkCanvas.h257
-rw-r--r--generic/tkClipboard.c564
-rw-r--r--generic/tkCmds.c2064
-rw-r--r--generic/tkColor.c471
-rw-r--r--generic/tkColor.h72
-rw-r--r--generic/tkConfig.c1943
-rw-r--r--generic/tkConsole.c390
-rw-r--r--generic/tkCursor.c495
-rw-r--r--generic/tkDecls.h2599
-rw-r--r--generic/tkEntry.c3371
-rw-r--r--generic/tkEntry.h189
-rw-r--r--generic/tkError.c225
-rw-r--r--generic/tkEvent.c2008
-rw-r--r--generic/tkFileFilter.c383
-rw-r--r--generic/tkFileFilter.h88
-rw-r--r--generic/tkFocus.c767
-rw-r--r--generic/tkFont.c2347
-rw-r--r--generic/tkFont.h154
-rw-r--r--generic/tkFrame.c1195
-rw-r--r--generic/tkGC.c148
-rw-r--r--generic/tkGeometry.c342
-rw-r--r--generic/tkGet.c503
-rw-r--r--generic/tkGrab.c961
-rw-r--r--generic/tkGrid.c2546
-rw-r--r--generic/tkImage.c947
-rw-r--r--generic/tkImgBmap.c595
-rw-r--r--generic/tkImgGIF.c1954
-rw-r--r--generic/tkImgPPM.c373
-rw-r--r--generic/tkImgPhoto.c3229
-rw-r--r--generic/tkImgUtil.c37
-rw-r--r--generic/tkInitScript.h56
-rw-r--r--generic/tkInt.decls2050
-rw-r--r--generic/tkInt.h1187
-rw-r--r--generic/tkIntDecls.h2004
-rw-r--r--generic/tkIntPlatDecls.h1218
-rw-r--r--generic/tkIntXlibDecls.h2545
-rw-r--r--generic/tkListbox.c2527
-rw-r--r--generic/tkMacWinMenu.c139
-rw-r--r--generic/tkMain.c328
-rw-r--r--generic/tkMenu.c2444
-rw-r--r--generic/tkMenu.h543
-rw-r--r--generic/tkMenuDraw.c450
-rw-r--r--generic/tkMenubutton.c481
-rw-r--r--generic/tkMenubutton.h191
-rw-r--r--generic/tkMessage.c387
-rw-r--r--generic/tkObj.c663
-rw-r--r--generic/tkOldConfig.c1082
-rw-r--r--generic/tkOldTest.c404
-rw-r--r--generic/tkOption.c931
-rw-r--r--generic/tkPack.c879
-rw-r--r--generic/tkPanedWindow.c1900
-rw-r--r--generic/tkPlace.c819
-rw-r--r--generic/tkPlatDecls.h257
-rw-r--r--generic/tkPointer.c306
-rw-r--r--generic/tkPort.h4
-rw-r--r--generic/tkRectOval.c808
-rw-r--r--generic/tkScale.c810
-rw-r--r--generic/tkScale.h178
-rw-r--r--generic/tkScrollbar.c278
-rw-r--r--generic/tkScrollbar.h155
-rw-r--r--generic/tkSelect.c1185
-rw-r--r--generic/tkSelect.h180
-rw-r--r--generic/tkSquare.c337
-rw-r--r--generic/tkStubImg.c74
-rw-r--r--generic/tkStubInit.c464
-rw-r--r--generic/tkStubLib.c108
-rw-r--r--generic/tkStyle.c817
-rw-r--r--generic/tkTest.c2292
-rw-r--r--generic/tkText.c6853
-rw-r--r--generic/tkText.h1429
-rw-r--r--generic/tkTextBTree.c3079
-rw-r--r--generic/tkTextDisp.c6867
-rw-r--r--generic/tkTextImage.c800
-rw-r--r--generic/tkTextIndex.c1723
-rw-r--r--generic/tkTextMark.c775
-rw-r--r--generic/tkTextTag.c1521
-rw-r--r--generic/tkTextWind.c1318
-rw-r--r--generic/tkTrig.c992
-rw-r--r--generic/tkUndo.c725
-rw-r--r--generic/tkUndo.h133
-rw-r--r--generic/tkUtil.c969
-rw-r--r--generic/tkVisual.c288
-rw-r--r--generic/tkWindow.c1873
-rw-r--r--generic/ttk/ttk.decls150
-rw-r--r--generic/ttk/ttkBlink.c166
-rw-r--r--generic/ttk/ttkButton.c853
-rw-r--r--generic/ttk/ttkCache.c350
-rw-r--r--generic/ttk/ttkClamTheme.c971
-rw-r--r--generic/ttk/ttkClassicTheme.c513
-rw-r--r--generic/ttk/ttkDecls.h272
-rw-r--r--generic/ttk/ttkDefaultTheme.c1130
-rw-r--r--generic/ttk/ttkElements.c1281
-rw-r--r--generic/ttk/ttkEntry.c2014
-rw-r--r--generic/ttk/ttkFrame.c654
-rw-r--r--generic/ttk/ttkGenStubs.tcl920
-rw-r--r--generic/ttk/ttkImage.c415
-rw-r--r--generic/ttk/ttkInit.c282
-rw-r--r--generic/ttk/ttkLabel.c670
-rw-r--r--generic/ttk/ttkLayout.c1252
-rw-r--r--generic/ttk/ttkManager.c552
-rw-r--r--generic/ttk/ttkManager.h92
-rw-r--r--generic/ttk/ttkNotebook.c1413
-rw-r--r--generic/ttk/ttkPanedwindow.c975
-rw-r--r--generic/ttk/ttkProgress.c545
-rw-r--r--generic/ttk/ttkScale.c515
-rw-r--r--generic/ttk/ttkScroll.c252
-rw-r--r--generic/ttk/ttkScrollbar.c345
-rw-r--r--generic/ttk/ttkSeparator.c136
-rw-r--r--generic/ttk/ttkSquare.c301
-rw-r--r--generic/ttk/ttkState.c273
-rw-r--r--generic/ttk/ttkStubInit.c61
-rw-r--r--generic/ttk/ttkStubLib.c74
-rw-r--r--generic/ttk/ttkTagSet.c306
-rw-r--r--generic/ttk/ttkTheme.c1737
-rw-r--r--generic/ttk/ttkTheme.h444
-rw-r--r--generic/ttk/ttkThemeInt.h42
-rw-r--r--generic/ttk/ttkTrace.c190
-rw-r--r--generic/ttk/ttkTrack.c183
-rw-r--r--generic/ttk/ttkTreeview.c3442
-rw-r--r--generic/ttk/ttkWidget.c789
-rw-r--r--generic/ttk/ttkWidget.h273
-rw-r--r--library/bgerror.tcl161
-rw-r--r--library/button.tcl129
-rw-r--r--library/choosedir.tcl75
-rw-r--r--library/clrpick.tcl128
-rw-r--r--library/comdlg.tcl13
-rw-r--r--library/console.tcl361
-rw-r--r--library/demos/README6
-rw-r--r--library/demos/anilabel.tcl160
-rw-r--r--library/demos/aniwave.tcl104
-rw-r--r--library/demos/arrow.tcl14
-rw-r--r--library/demos/bind.tcl23
-rw-r--r--library/demos/bitmap.tcl11
-rw-r--r--library/demos/browse2
-rw-r--r--library/demos/button.tcl12
-rw-r--r--library/demos/check.tcl58
-rw-r--r--library/demos/clrpick.tcl10
-rw-r--r--library/demos/colors.tcl10
-rw-r--r--library/demos/combo.tcl62
-rw-r--r--library/demos/cscroll.tcl10
-rw-r--r--library/demos/ctext.tcl12
-rw-r--r--library/demos/en.msg97
-rw-r--r--library/demos/entry1.tcl10
-rw-r--r--library/demos/entry2.tcl10
-rw-r--r--library/demos/entry3.tcl18
-rw-r--r--library/demos/filebox.tcl22
-rw-r--r--library/demos/floor.tcl38
-rw-r--r--library/demos/form.tcl10
-rw-r--r--library/demos/goldberg.tcl1833
-rw-r--r--library/demos/hello4
-rw-r--r--library/demos/hscale.tcl10
-rw-r--r--library/demos/icon.tcl25
-rw-r--r--library/demos/image1.tcl15
-rw-r--r--library/demos/image2.tcl22
-rw-r--r--library/demos/images/face.xbm (renamed from library/demos/images/face.bmp)0
-rw-r--r--library/demos/images/flagdown.xbm (renamed from library/demos/images/flagdown.bmp)0
-rw-r--r--library/demos/images/flagup.xbm (renamed from library/demos/images/flagup.bmp)0
-rw-r--r--library/demos/images/gray25.xbm (renamed from library/demos/images/gray25.bmp)0
-rw-r--r--library/demos/images/letters.xbm (renamed from library/demos/images/letters.bmp)0
-rw-r--r--library/demos/images/noletter.xbm (renamed from library/demos/images/noletter.bmp)0
-rw-r--r--library/demos/images/pattern.xbm (renamed from library/demos/images/pattern.bmp)0
-rw-r--r--library/demos/items.tcl29
-rw-r--r--library/demos/ixset66
-rw-r--r--library/demos/knightstour.tcl255
-rw-r--r--library/demos/label.tcl13
-rw-r--r--library/demos/labelframe.tcl12
-rw-r--r--library/demos/mclist.tcl96
-rw-r--r--library/demos/menu.tcl25
-rw-r--r--library/demos/menubu.tcl13
-rw-r--r--library/demos/msgbox.tcl14
-rw-r--r--library/demos/nl.msg125
-rw-r--r--library/demos/paned1.tcl10
-rw-r--r--library/demos/paned2.tcl12
-rw-r--r--library/demos/pendulum.tcl197
-rw-r--r--library/demos/plot.tcl10
-rw-r--r--library/demos/puzzle.tcl10
-rw-r--r--library/demos/radio.tcl33
-rw-r--r--library/demos/rmt53
-rw-r--r--library/demos/rolodex10
-rw-r--r--library/demos/ruler.tcl16
-rw-r--r--library/demos/sayings.tcl14
-rw-r--r--library/demos/search.tcl10
-rw-r--r--library/demos/spin.tcl10
-rw-r--r--library/demos/square7
-rw-r--r--library/demos/states.tcl10
-rw-r--r--library/demos/style.tcl33
-rw-r--r--library/demos/tcolor16
-rw-r--r--library/demos/text.tcl16
-rw-r--r--library/demos/textpeer.tcl62
-rw-r--r--library/demos/timer3
-rw-r--r--library/demos/toolbar.tcl104
-rw-r--r--library/demos/tree.tcl94
-rw-r--r--library/demos/ttkbut.tcl85
-rw-r--r--library/demos/ttkmenu.tcl54
-rw-r--r--library/demos/ttknote.tcl62
-rw-r--r--library/demos/ttkpane.tcl107
-rw-r--r--library/demos/ttkprogress.tcl47
-rw-r--r--library/demos/ttkscale.tcl39
-rw-r--r--library/demos/twind.tcl176
-rw-r--r--library/demos/unicodeout.tcl62
-rw-r--r--library/demos/vscale.tcl10
-rw-r--r--library/demos/widget780
-rw-r--r--library/dialog.tcl50
-rw-r--r--library/entry.tcl25
-rw-r--r--library/focus.tcl5
-rw-r--r--library/listbox.tcl13
-rw-r--r--library/menu.tcl137
-rw-r--r--library/msgbox.tcl78
-rw-r--r--library/msgs/cs.msg48
-rw-r--r--library/msgs/da.msg77
-rw-r--r--library/msgs/de.msg30
-rw-r--r--library/msgs/el.msg2
-rw-r--r--library/msgs/en.msg26
-rw-r--r--library/msgs/es.msg38
-rw-r--r--library/msgs/hu.msg21
-rw-r--r--library/msgs/pl.msg60
-rw-r--r--library/msgs/sv.msg74
-rw-r--r--library/obsolete.tcl159
-rw-r--r--library/optMenu.tcl2
-rw-r--r--library/palette.tcl21
-rw-r--r--library/panedwindow.tcl71
-rw-r--r--library/prolog.ps283
-rw-r--r--library/safetk.tcl103
-rw-r--r--library/scale.tcl3
-rw-r--r--library/scrlbar.tcl8
-rw-r--r--library/spinbox.tcl14
-rw-r--r--library/tclIndex3
-rw-r--r--library/tearoff.tcl15
-rw-r--r--library/text.tcl412
-rw-r--r--library/tk.tcl364
-rw-r--r--library/tkfbox.tcl579
-rw-r--r--library/ttk/altTheme.tcl101
-rw-r--r--library/ttk/aquaTheme.tcl59
-rw-r--r--library/ttk/button.tcl83
-rw-r--r--library/ttk/clamTheme.tcl137
-rw-r--r--library/ttk/classicTheme.tcl108
-rw-r--r--library/ttk/combobox.tcl453
-rw-r--r--library/ttk/cursors.tcl186
-rw-r--r--library/ttk/defaults.tcl125
-rw-r--r--library/ttk/entry.tcl585
-rw-r--r--library/ttk/fonts.tcl157
-rw-r--r--library/ttk/menubutton.tcl169
-rw-r--r--library/ttk/notebook.tcl197
-rw-r--r--library/ttk/panedwindow.tcl82
-rw-r--r--library/ttk/progress.tcl49
-rw-r--r--library/ttk/scale.tcl88
-rw-r--r--library/ttk/scrollbar.tcl123
-rw-r--r--library/ttk/sizegrip.tcl102
-rw-r--r--library/ttk/spinbox.tcl173
-rw-r--r--library/ttk/treeview.tcl363
-rw-r--r--library/ttk/ttk.tcl176
-rw-r--r--library/ttk/utils.tcl350
-rw-r--r--library/ttk/vistaTheme.tcl224
-rw-r--r--library/ttk/winTheme.tcl80
-rw-r--r--library/ttk/xpTheme.tcl65
-rw-r--r--library/unsupported.tcl2
-rw-r--r--library/xmfbox.tcl72
-rw-r--r--license.terms2
-rw-r--r--mac/MW_TkBuildLibHeader.h7
-rw-r--r--mac/MW_TkBuildLibHeader.pch34
-rwxr-xr-xmac/MW_TkHeader.h7
-rw-r--r--mac/MW_TkHeader.pch32
-rw-r--r--mac/MW_TkHeaderCommon.h38
-rwxr-xr-xmac/MW_TkOldImgHeader.h3
-rw-r--r--mac/MW_TkOldImgStaticHeader.h3
-rw-r--r--mac/MW_TkStaticHeader.h7
-rw-r--r--mac/MW_TkStaticHeader.pch34
-rwxr-xr-xmac/MW_TkTestHeader.h7
-rwxr-xr-xmac/MW_TkTestHeader.pch40
-rw-r--r--mac/README91
-rw-r--r--mac/bugs.doc52
-rwxr-xr-xmac/tclets.r172
-rw-r--r--mac/tclets.tcl223
-rw-r--r--mac/tkMac.h54
-rw-r--r--mac/tkMacAppInit.c418
-rwxr-xr-xmac/tkMacAppearanceStubs.c104
-rw-r--r--mac/tkMacApplication.r315
-rw-r--r--mac/tkMacBitmap.c277
-rw-r--r--mac/tkMacButton.c1709
-rw-r--r--mac/tkMacClipboard.c301
-rw-r--r--mac/tkMacColor.c502
-rw-r--r--mac/tkMacConfig.c43
-rw-r--r--mac/tkMacCursor.c399
-rw-r--r--mac/tkMacCursors.r128
-rw-r--r--mac/tkMacDefault.h527
-rw-r--r--mac/tkMacDialog.c1418
-rw-r--r--mac/tkMacDraw.c1221
-rw-r--r--mac/tkMacEmbed.c1205
-rw-r--r--mac/tkMacFont.c2150
-rw-r--r--mac/tkMacHLEvents.c439
-rw-r--r--mac/tkMacInit.c226
-rw-r--r--mac/tkMacInt.h231
-rw-r--r--mac/tkMacKeyboard.c646
-rw-r--r--mac/tkMacLibrary.r71
-rw-r--r--mac/tkMacMDEF.c114
-rw-r--r--mac/tkMacMDEF.r43
-rw-r--r--mac/tkMacMenu.c4605
-rw-r--r--mac/tkMacMenu.r45
-rw-r--r--mac/tkMacMenubutton.c493
-rw-r--r--mac/tkMacMenus.c353
-rw-r--r--mac/tkMacPort.h160
-rw-r--r--mac/tkMacProjects.sea.hqx3718
-rw-r--r--mac/tkMacRegion.c246
-rw-r--r--mac/tkMacResource.r435
-rw-r--r--mac/tkMacScale.c437
-rw-r--r--mac/tkMacScrlbr.c1067
-rw-r--r--mac/tkMacSend.c546
-rw-r--r--mac/tkMacSubwindows.c1256
-rw-r--r--mac/tkMacTclCode.r69
-rw-r--r--mac/tkMacTest.c80
-rw-r--r--mac/tkMacWindowMgr.c1789
-rw-r--r--mac/tkMacWm.c5785
-rw-r--r--mac/tkMacXCursors.r959
-rw-r--r--mac/tkMacXStubs.c875
-rw-r--r--mac/widget.r18
-rw-r--r--macosx/GNUmakefile (renamed from macosx/Makefile)82
-rw-r--r--macosx/README106
-rw-r--r--macosx/Tk-Info.plist.in6
-rw-r--r--macosx/Wish-Common.xcconfig48
-rw-r--r--macosx/Wish-Debug.xcconfig19
-rw-r--r--macosx/Wish-Info.plist.in6
-rw-r--r--macosx/Wish-Release.xcconfig19
-rw-r--r--macosx/Wish.pbproj/project.pbxproj43
-rw-r--r--macosx/Wish.xcode/default.pbxuser337
-rw-r--r--macosx/Wish.xcode/project.pbxproj5374
-rw-r--r--macosx/Wish.xcodeproj/default.pbxuser339
-rw-r--r--macosx/Wish.xcodeproj/project.pbxproj5734
-rw-r--r--macosx/configure.ac11
-rw-r--r--macosx/tkAboutDlg.r8
-rw-r--r--macosx/tkMacOSXBitmap.c6
-rw-r--r--macosx/tkMacOSXButton.c12
-rw-r--r--macosx/tkMacOSXCarbonEvents.c9
-rw-r--r--macosx/tkMacOSXColor.c2
-rw-r--r--macosx/tkMacOSXCursor.c156
-rw-r--r--macosx/tkMacOSXDefault.h24
-rw-r--r--macosx/tkMacOSXDialog.c915
-rw-r--r--macosx/tkMacOSXDraw.c2
-rw-r--r--macosx/tkMacOSXEmbed.c494
-rw-r--r--macosx/tkMacOSXFont.c3063
-rw-r--r--macosx/tkMacOSXHLEvents.c380
-rw-r--r--macosx/tkMacOSXInit.c190
-rw-r--r--macosx/tkMacOSXInt.h11
-rw-r--r--macosx/tkMacOSXKeyEvent.c2
-rw-r--r--macosx/tkMacOSXMenubutton.c2
-rw-r--r--macosx/tkMacOSXPort.h3
-rw-r--r--macosx/tkMacOSXPrivate.h4
-rw-r--r--macosx/tkMacOSXScrlbr.c51
-rw-r--r--macosx/tkMacOSXSend.c389
-rw-r--r--macosx/tkMacOSXSubwindows.c9
-rw-r--r--macosx/tkMacOSXWm.c1678
-rw-r--r--macosx/tkMacOSXXStubs.c273
-rw-r--r--macosx/ttkMacOSXTheme.c1137
-rw-r--r--tests/all.tcl10
-rw-r--r--tests/bell.test20
-rw-r--r--tests/bgerror.test20
-rw-r--r--tests/bind.test742
-rw-r--r--tests/bitmap.test22
-rw-r--r--tests/border.test36
-rw-r--r--tests/button.test112
-rw-r--r--tests/canvImg.test74
-rw-r--r--tests/canvPs.test148
-rw-r--r--tests/canvPsBmap.tcl20
-rw-r--r--tests/canvPsImg.tcl6
-rw-r--r--tests/canvRect.test51
-rw-r--r--tests/canvText.test58
-rw-r--r--tests/canvWind.test20
-rw-r--r--tests/canvas.test489
-rw-r--r--tests/choosedir.test35
-rw-r--r--tests/clipboard.test24
-rw-r--r--tests/clrpick.test101
-rw-r--r--tests/cmds.test20
-rw-r--r--tests/color.test9
-rw-r--r--tests/config.test9
-rw-r--r--tests/constraints.tcl90
-rw-r--r--tests/cursor.test319
-rw-r--r--tests/dialog.test11
-rw-r--r--tests/earth.gifbin0 -> 51712 bytes
-rw-r--r--tests/embed.test35
-rw-r--r--tests/entry.test125
-rw-r--r--tests/event.test292
-rw-r--r--tests/face.xbm173
-rw-r--r--tests/filebox.test335
-rw-r--r--tests/flagdown.xbm27
-rw-r--r--tests/flagup.xbm27
-rw-r--r--tests/focus.test135
-rw-r--r--tests/focusTcl.test20
-rw-r--r--tests/font.test292
-rw-r--r--tests/frame.test369
-rw-r--r--tests/geometry.test20
-rw-r--r--tests/get.test20
-rw-r--r--tests/grab.test7
-rw-r--r--tests/grid.test428
-rw-r--r--tests/id.test22
-rw-r--r--tests/image.test85
-rw-r--r--tests/imgBmap.test23
-rw-r--r--tests/imgPPM.test32
-rw-r--r--tests/imgPhoto.test38
-rw-r--r--tests/listbox.test99
-rw-r--r--tests/macEmbed.test267
-rw-r--r--tests/macFont.test284
-rw-r--r--tests/macMenu.test1547
-rw-r--r--tests/macWinMenu.test103
-rw-r--r--tests/macscrollbar.test93
-rw-r--r--tests/main.test99
-rw-r--r--tests/menu.test115
-rw-r--r--tests/menuDraw.test46
-rw-r--r--tests/menubut.test24
-rw-r--r--tests/message.test7
-rw-r--r--tests/msgbox.test43
-rw-r--r--tests/obj.test21
-rw-r--r--tests/oldpack.test230
-rw-r--r--tests/option.test27
-rw-r--r--tests/pack.test15
-rw-r--r--tests/panedwindow.test303
-rw-r--r--tests/place.test13
-rw-r--r--tests/pwrdLogo150.gifbin0 -> 2489 bytes
-rw-r--r--tests/raise.test22
-rw-r--r--tests/safe.test17
-rw-r--r--tests/scale.test9
-rw-r--r--tests/scrollbar.test253
-rw-r--r--tests/select.test197
-rw-r--r--tests/send.test8
-rw-r--r--tests/spinbox.test83
-rw-r--r--tests/teapot.ppm31
-rw-r--r--tests/text.test2184
-rw-r--r--tests/textBTree.test20
-rw-r--r--tests/textDisp.test1669
-rw-r--r--tests/textImage.test52
-rw-r--r--tests/textIndex.test265
-rw-r--r--tests/textMark.test105
-rw-r--r--tests/textTag.test306
-rw-r--r--tests/textWind.test280
-rw-r--r--tests/tk.test57
-rw-r--r--tests/ttk/all.tcl21
-rw-r--r--tests/ttk/checkbutton.test48
-rw-r--r--tests/ttk/combobox.test68
-rw-r--r--tests/ttk/entry.test283
-rw-r--r--tests/ttk/image.test50
-rw-r--r--tests/ttk/labelframe.test130
-rw-r--r--tests/ttk/layout.test25
-rw-r--r--tests/ttk/notebook.test493
-rw-r--r--tests/ttk/panedwindow.test291
-rw-r--r--tests/ttk/progressbar.test85
-rw-r--r--tests/ttk/radiobutton.test48
-rw-r--r--tests/ttk/scrollbar.test69
-rw-r--r--tests/ttk/spinbox.test280
-rw-r--r--tests/ttk/treetags.test221
-rw-r--r--tests/ttk/treeview.test639
-rw-r--r--tests/ttk/ttk.test651
-rw-r--r--tests/ttk/validate.test277
-rw-r--r--tests/ttk/vsapi.test47
-rw-r--r--tests/unixButton.test7
-rw-r--r--tests/unixEmbed.test22
-rw-r--r--tests/unixFont.test56
-rw-r--r--tests/unixMenu.test15
-rw-r--r--tests/unixSelect.test45
-rw-r--r--tests/unixWm.test500
-rw-r--r--tests/util.test20
-rw-r--r--tests/visual.test260
-rw-r--r--tests/visual_bb.test7
-rw-r--r--tests/winButton.test33
-rw-r--r--tests/winClipboard.test25
-rw-r--r--tests/winDialog.test216
-rw-r--r--tests/winFont.test70
-rw-r--r--tests/winMenu.test297
-rw-r--r--tests/winMsgbox.test297
-rw-r--r--tests/winSend.test63
-rw-r--r--tests/winWm.test209
-rw-r--r--tests/window.test140
-rw-r--r--tests/winfo.test29
-rw-r--r--tests/wm.test2529
-rw-r--r--tests/xmfbox.test35
-rw-r--r--unix/Makefile.in593
-rw-r--r--unix/README256
-rw-r--r--unix/aclocal.m42
-rwxr-xr-xunix/configure13382
-rw-r--r--unix/configure.in393
-rwxr-xr-x[-rw-r--r--]unix/install-sh24
-rwxr-xr-xunix/installManPage131
-rw-r--r--unix/tcl.m41149
-rw-r--r--unix/tk.spec59
-rw-r--r--unix/tkAppInit.c75
-rw-r--r--unix/tkConfig.h.in256
-rw-r--r--unix/tkConfig.sh.in8
-rw-r--r--unix/tkUnix.c209
-rw-r--r--unix/tkUnix3d.c276
-rw-r--r--unix/tkUnixButton.c693
-rw-r--r--unix/tkUnixColor.c244
-rw-r--r--unix/tkUnixConfig.c35
-rw-r--r--unix/tkUnixCursor.c485
-rw-r--r--unix/tkUnixDefault.h85
-rw-r--r--unix/tkUnixDialog.c159
-rw-r--r--unix/tkUnixDraw.c132
-rw-r--r--unix/tkUnixEmbed.c568
-rw-r--r--unix/tkUnixEvent.c422
-rw-r--r--unix/tkUnixFocus.c109
-rw-r--r--unix/tkUnixFont.c1572
-rw-r--r--unix/tkUnixInit.c91
-rw-r--r--unix/tkUnixInt.h20
-rw-r--r--unix/tkUnixKey.c331
-rw-r--r--unix/tkUnixMenu.c1042
-rw-r--r--unix/tkUnixMenubu.c326
-rw-r--r--unix/tkUnixPort.h13
-rw-r--r--unix/tkUnixRFont.c791
-rw-r--r--unix/tkUnixScale.c250
-rw-r--r--unix/tkUnixScrlbr.c126
-rw-r--r--unix/tkUnixSelect.c714
-rw-r--r--unix/tkUnixSend.c1305
-rw-r--r--unix/tkUnixWm.c3819
-rw-r--r--unix/tkUnixXId.c353
-rw-r--r--win/Makefile.in125
-rw-r--r--win/README2
-rwxr-xr-xwin/buildall.vc.bat91
-rwxr-xr-xwin/configure5347
-rw-r--r--win/configure.in92
-rw-r--r--win/makefile.bc10
-rw-r--r--win/makefile.vc531
-rw-r--r--win/nmakehlp.c266
-rw-r--r--win/rc/cursor00.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor02.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor04.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor06.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor0a.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor0c.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor0e.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor12.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor1e.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor20.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor2a.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor3a.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor46.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor48.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor4c.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor4e.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor60.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor62.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor66.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor6c.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor72.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor74.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor86.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor88.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor8a.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor8c.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor90.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor94.curbin326 -> 326 bytes
-rw-r--r--win/rc/cursor9a.curbin0 -> 326 bytes
-rw-r--r--win/rc/lamp.bmp (renamed from win/lamp.bmp)bin2102 -> 2102 bytes
-rw-r--r--win/rc/tk.rc8
-rw-r--r--win/rc/tk_base.rc2
-rw-r--r--win/rc/wish.rc12
-rw-r--r--win/rules.vc239
-rw-r--r--win/stubs.c383
-rw-r--r--win/tcl.m496
-rw-r--r--win/tkConfig.sh.in2
-rw-r--r--win/tkWin.h48
-rw-r--r--win/tkWin32Dll.c24
-rw-r--r--win/tkWin3d.c374
-rw-r--r--win/tkWinButton.c937
-rw-r--r--win/tkWinClipboard.c181
-rw-r--r--win/tkWinColor.c249
-rw-r--r--win/tkWinConfig.c32
-rw-r--r--win/tkWinCursor.c90
-rw-r--r--win/tkWinDefault.h49
-rw-r--r--win/tkWinDialog.c2812
-rw-r--r--win/tkWinDraw.c593
-rw-r--r--win/tkWinEmbed.c1031
-rw-r--r--win/tkWinFont.c1500
-rw-r--r--win/tkWinImage.c402
-rw-r--r--win/tkWinInit.c74
-rw-r--r--win/tkWinInt.h149
-rw-r--r--win/tkWinKey.c540
-rw-r--r--win/tkWinMenu.c2327
-rw-r--r--win/tkWinPixmap.c126
-rw-r--r--win/tkWinPointer.c218
-rw-r--r--win/tkWinPort.h46
-rw-r--r--win/tkWinRegion.c139
-rw-r--r--win/tkWinScrlbr.c399
-rw-r--r--win/tkWinSend.c1043
-rw-r--r--win/tkWinSendCom.c462
-rw-r--r--win/tkWinSendCom.h61
-rw-r--r--win/tkWinTest.c315
-rw-r--r--win/tkWinWindow.c335
-rw-r--r--win/tkWinWm.c5235
-rw-r--r--win/tkWinX.c1638
-rw-r--r--win/ttkWinMonitor.c158
-rw-r--r--win/ttkWinTheme.c733
-rw-r--r--win/ttkWinXPTheme.c1324
-rw-r--r--win/winMain.c330
-rw-r--r--win/wish.exe.manifest.in47
-rw-r--r--xlib/X11/X.h4
-rw-r--r--xlib/X11/Xlib.h15
-rw-r--r--xlib/X11/Xutil.h4
-rw-r--r--xlib/X11/keysym.h4
-rw-r--r--xlib/xbytes.h17
-rw-r--r--xlib/xcolors.c87
-rw-r--r--xlib/xdraw.c50
-rw-r--r--xlib/xgc.c494
-rw-r--r--xlib/ximage.c35
-rw-r--r--xlib/xutil.c54
786 files changed, 196204 insertions, 136883 deletions
diff --git a/ChangeLog b/ChangeLog
index 39f028a..5b78697 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,72 +10,121 @@
* unix/Makefile.in: [Bug 1945073]: Demo square.tcl
* win/Makefile.in: cannot run; need package tktest
-2011-11-17 Jan Nijtmans <nijtmans@users.sf.net>
-
- * doc/pack.n: Fix the escaping of leading dots in lines that start with
- a widget name, so that nroff doesn't mistake it as a non-existing macro
- and skips the entire line.
-
2011-11-17 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
* generic/tkCanvas.c: [Bug 3437816]: Missing TCL_ERROR return
in [canvas lower].
-2011-10-11 Jan Nijtmans <nijtmans@users.sf.net>
+2011-11-08 Reinhard Max <max@suse.de>
- * generic/tk.h: Add dummy user_data field to
- XVirtualEvent, for improved upwards compatibility
- with Tk 8.5.
+ * unix/Makefile.in: Add square to DEMOPROGS. It contains a shebang
+ and hence should get installed with executable bits.
-2011-09-26 Jan Nijtmans <nijtmans@users.sf.net>
+ * doc/label.n: Fix the escaping of leading dots in lines that
+ * doc/text.n: start with a widget name, so that nroff
+ * doc/ttk_notebook.n: doesn't mistake it as a non-existing macro
+ * doc/pack.n: and skips the entire line.
- * win/rules.vc: Support Visual Studio 11
+2011-11-04 Don Porter <dgp@users.sourceforge.net>
-2011-09-06 Jan Nijtmans <nijtmans@users.sf.net>
+ *** 8.5.11 TAGGED FOR RELEASE ***
- * unix/tcl.m4: Add --disable-rpath option to configure
- * unix/configure: script (backported from Tcl 8.5)
+ * generic/tk.h: Bump to 8.5.11 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
-2011-08-30 Jan Nijtmans <nijtmans@users.sf.net>
+ * unix/configure: autoconf-2.59
+ * win/configure:
- * unix/tcl.m4: Make SHLIB_LD_LIBS='${LIBS}' the default and
- * unix/configure: set to "" on per-platform necessary basis.
- Add Haiku support and better NetBSD/FreeBSD support.
- All of this backported from TEA resp. Tcl8.5, but kept all
- original platform code which was removed from TEA.
+ * changes: Updated for 8.5.11 release.
+
+2011-11-01 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkObj.c (GetPixelsFromObjEx): [Bug 3431491]: Use a bit of
+ type hackery to allow numbers to be interpreted as coordinates (most
+ notably on a canvas) without reinterpreting via a string.
+
+2011-10-26 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5.11.
+
+2011-10-01 Kevin B. Kenny <kennykb@acm.org>
+
+ * generic/tkInt.h: [Bug 3410609] Change the event mechanism
+ * unix/tkUnixEvent.c: for <KeyPress> events to use the keysym
+ * unix/tkUnixKey.c: returned by XLookupString in preference to
+ the one that appears in the raw X event at any level. This change
+ allows binding to ISO_Level3_Shift-ed characters, composed characters,
+ and similar beasts. KeyRelease events still work as they did before,
+ as does Tk with input methods disabled.
+
+2011-09-01 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/photo.n: Correctly documented what the [$ph data] command
+ produces without the -format option.
2011-08-16 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkCanvLine.c: [Bug 3388350] mingw64 compiler warnings
- * generic/tkConsole.c
- * generic/tkListbox.c
- * win/tkWin3d.c
- * win/tkWinButton.c
- * win/tkWinCursor.c
+ * win/tkWinDialog.c: [Bug 3388350] mingw64 compiler warnings
* win/tkWinDraw.c
- * win/tkWinImage.c
- * win/tkWinKey.c
+ * win/tkWinSend.c
+ * win/tkWinSendCom.c
+ * win/tkWinColor.c
+ * win/tkWinDialog.c
+ * win/tkWinEmbed.c
* win/tkWinMenu.c
+ * win/tkWinPixmap.c
+ * win/tkWinTest.c
+ * win/tkWinWindow.c
* win/tkWinWm.c
* win/tkWinX.c
- * win/tkWindow.c
- * win/tcl.m4: Sync with win/tcl.m4 from Tcl
- * win/configure: (regenerated)
- * unix/tcl.m4: Sync with win/tcl.m4 from Tcl
- * unix/configure: (regenerated)
+ * win/stubs.c
+ * generic/tkAtom.c
+ * generic/tkSelect.c
2011-08-13 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tkBitmap.c: [Bug 3388350] mingw64 compiler warnings
- * generic/tkImgGIF.c
- * win/tkWinColor.c
- * win/tkWinX.c
+ * generic/tkConsole.c
+ * unix/tkUnixMenubu.c
+ * win/tkWinButton.c
+ * win/tkWinEmbed.c
+ * win/tkWinFont.c
+ * win/tkWinImage.c
+ * win/tkWinKey.c
+ * win/tkWinTest.c
+ * win/tkWinWm.c
+
+2011-08-03 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: [Bug 3314770] regression - Windows file
+ dialogs not resizable
2011-07-28 Jan Nijtmans <nijtmans@users.sf.net>
* xlib/X11/Xutil.h: [Bug 3380684] XEmptyRegion prototype doesn't
match usage
+2011-06-29 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/ttk/ttkTrace.c: [Bug 3341056] Correct segfault due to flaw
+ * tests/ttk/ttk.test: in the 2011-06-17 commit.
+
+2011-06-23 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.10 release.
+
+2011-06-17 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.10 TAGGED FOR RELEASE ***
+
+ * generic/ttk/ttkTrace.c: Workaround Bug 3062331.
+ * tests/ttk/ttk.test:
+ * changes: Updated
+
2011-06-16 Jan Nijtmans <nijtmans@users.sf.net>
* win/tcl.m4: Sync with win/tcl.m4 from Tcl
@@ -83,9 +132,23 @@
2011-06-10 Don Porter <dgp@users.sourceforge.net>
+ * README: Correct some README bitrot.
+ * macosx/README:
+
* generic/tkCanvLine.c: [Bug 3175610] Incomplete refresh of line item.
Backport of 2011-03-03 trunk commit from Alexandre Ferrieux.
+2011-06-08 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.10 release.
+
+2011-06-07 Don Porter <dgp@users.sourceforge.net>
+
+ * win/tkWinDialog.c: Backport [Bug 2484771] fix.
+
+ * generic/tkEntry.c: Restore support for values "08" and "09"
+ in a [spinbox] configured to use -from and -to values. [Bug 2358545].
+
2011-06-06 Don Porter <dgp@users.sourceforge.net>
* generic/tkConsole.c: Restore proper NUL output to the [console].
@@ -103,86 +166,705 @@
* doc/listbox.n:
* doc/menu.n:
* doc/options.n:
+ * doc/ttk_combobox.n:
+ * doc/ttk_entry.n:
+ * doc/ttk_progressbar.n:
+ * doc/ttk_widget.n:
+
+2011-04-04 Peter Spjuth <peter.spjuth@gmail.com>
+
+ * tests/grid.test:
+ * generic/tkGrid.c: [Bug 723765]: When a slave was removed from grid,
+ the -in option was not remembered.
+
+2011-04-04 Peter Spjuth <peter.spjuth@gmail.com>
+
+ * doc/labelframe.n:
+ * doc/frame.n:
+ * generic/tkFrame.c: [Bug 2997657]: Removed -container from labelframe
+ documentation since it does not work as expected and does not make
+ sense as a container. Added note to frame about restrictions when used
+ as a container.
2011-03-28 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkTextBTree.c: [Bug 3129527]: Fix buffer overflow w/ GCC 4.5 and
- -D_FORTIFY_SOURCE=2. One more place where this problem could appear.
+ * generic/tkTextBTree.c: [Bug 3129527]: Fix buffer overflow
+ w/ GCC 4.5 and -D_FORTIFY_SOURCE=2. One more place where this problem
+ could appear.
2011-03-24 Jan Nijtmans <nijtmans@users.sf.net>
* win/tkWinMenu.c: [Bug #3239768] tk8.4.19 (and later) WIN32
menu font support.
+2011-03-16 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: Make SHLIB_LD_LIBS='${LIBS}' the default and
+ * unix/configure: set to "" on per-platform necessary basis.
+ Backported from TEA, but kept all original platform code which was
+ removed from TEA.
+
2011-03-12 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWin32Dll.c: SEH-emulation for AMD64
- * win/tkWinX.c: mingw-w64 does not accept _WIN32_IE < 0x0501
- Merged --cherrypick from core-8-5-branch (2010-12-13, f4ecadb40d)
- * win/tkWinPort.h: remove conflicting definition of timezone struct
+ * win/tkWin32Dll.c: Eliminate unneeded _TkFinalize wrapper.
2011-03-11 Jan Nijtmans <nijtmans@users.sf.net>
- * win/Makefile.in (VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE):
- * win/configure, win/configure.in, win/tcl.m4: SC_EMBED_MANIFEST macro.
- Merged --cherrypick from core-8-5-branch (2010-08-26, 3416226333358009f)
+ * generic/ttk/ttkDefaultTheme.c: Eliminate some unneeded write-only
+ * generic/ttk/ttkManager.c: variables (discovered by gcc-4.6)
+ * generic/ttk/ttkSquare.c:
+
+2011-03-09 Reinhard Max <max@suse.de>
+
+ * unix/configure.in: Use a symbol from libXft itself for the link
+ test rather than one from libfreetype, because the latter doesn't
+ work when the linker is called with --as-needed.
2011-01-25 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkSelect.c: [Bug 3129527]: Fix buffer overflow w/ GCC 4.5 and
- * generic/tkTextDisp.c -D_FORTIFY_SOURCE=2. Just the strcpy->memcpy part,
- * unix/tkUnixWm.c to prevent anything like [Bug #3164879]
- * win/tkWinWm.c
+ * generic/tkSelect.c: [Patch #3129527]: Fix buffer overflow
+ * win/tkWinWm.c: w/ GCC 4.5 and -D_FORTIFY_SOURCE=2. Just the
+ * unix/tkUnixWm.c: strcpy->memcpy part, to prevent anything
+ like [Bug #3164879]
+
+2011-01-22 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkEntry.c(ttk::combobox): Add missing
+ 'validate' command (reported by schelte).
+
+2011-01-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkGenStubs.tcl: Make sure to use CONST/VOID in stead of
+ * generic/ttk/ttkDecls.h: const/void when appropriate. This allows to
+ use const/void in the *.decls file always, genStubs will do the right
+ thing.
+
+2011-01-17 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tcl.m4: handle --enable-64bit=ia64 for gcc. BACKPORT.
+ * win/configure: (autoconf-2.59)
2011-01-13 Jan Nijtmans <nijtmans@users.sf.net>
- * library/msgbox.tcl: [Patch #3154705] Close button has no
- effect. Add <Escape> binding as well (backported from Tcl 8.5)
+ * library/msgbox.tcl: [Patch #3154705] Close button has no effect
+
+2011-01-06 Stuart Cassoff <stwo@users.sourceforge.net>
-2010-10-31 Jan Nijtmans <nijtmans@users.sf.net>
+ * generic/tkEvent.c: Cast some NULLs to (void *) in order to quash
+ * unix/tkUnixEvent.c: "missing sentinel in function call"
+ * unix/tkUnixKey.c: compiler warnings.
+ * unix/tkUnixRFont.c:
- * win/tcl.m4 Add -D_CRT_SECURE_NO_DEPRECATE and
- -D_CRT_NONSTDC_NO_DEPRECATE, reducing the number of
- deprecation warnings on later VC++ versions.
- * win/rules.vc Better VCVERSION determination
- * win/configure (regenerated with autoconf 2.13)
- All changes backported from Tcl8.5/8.6
+2010-12-17 Stuart Cassoff <stwo@users.sourceforge.net>
+
+ * unix/Makefile.in: [Bug 2446711]: Remove 'allpatch' target.
+
+2010-12-17 Stuart Cassoff <stwo@users.sourceforge.net>
+
+ * unix/Makefile.in: Use 'rpmbuild', not 'rpm' [Bug 2537626].
+
+2010-12-13 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: Cross-compile support for Win and UNIX (backported)
+ * unix/configure: (autoconf-2.59)
+ * win/tcl.m4:
+ * win/configure.in:
+ * win/configure: (autoconf-2.59)
+ * win/tkWin32Dll.c: SEH-emulation for AMD64
+ * win/tkWinX.c: mingw-w64 does not accept _WIN32_IE < 0x0501
+
+2010-12-12 Stuart Cassoff <stwo@users.sourceforge.net>
+
+ * unix/tcl.m4: Better building on OpenBSD.
+ * unix/configure: (autoconf-2.59)
+
+2010-11-24 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: [Bug #3071836]: Crash/Tcl_Panic on WinXP saving
+ * win/tkWinInit.c: file to C:\ re-wrote TkpDisplayWarning such
+ that it does not use an Tcl API calls any more, so it works even with
+ an ill-initialized Tcl.
+ * win/winMain.c: Teach WishPanic how to thread UTF-8 in it's
+ messagebox. Backports from Tcl 8.6. No change in functionality.
+
+2010-11-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/configure.in: Allow cross-compilation by default. (backported)
+ * win/tcl.m4: Use -pipe for gcc on win32 (backported)
+ * win/configure: (regenerated)
+
+2010-11-16 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinPort.h [Bug #3110161]: Extensions using TCHAR don't compile
+ on VS2005 SP1
+
+2010-11-04 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * library/msgs/de.msg: Updated German messages. Thanks to Ruediger
+ Haertel. [Patch 2442309] [Bug 3102739].
2010-10-23 Jan Nijtmans <nijtmans@users.sf.net>
- * win/rules.vc Update for VS10
+ * win/rules.vc Update for VS10
+
+2010-10-11 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c: Fix crash in 'tag add' / 'tag remove'
+ commands when no -tags specified [Bug 3085489].
+
+2010-10-06 Donal K. Fellows <dkf@users.sf.net>
+
+ * win/Makefile.in (genstubs): [Tcl Bug 3082049]: Typo.
+
+2010-09-08 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c (TreeviewSeeCommand): [Bug 2829363]:
+ Schedule redisplay if [$tv see] opens any items.
+
+2010-09-02 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/winTheme.tcl, library/ttk/xpTheme.tcl,
+ * library/ttk/vistaTheme.tcl: [Bug 3057573]: Specify disabled combobox
+ text foreground color.
+
+2010-09-01 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.9 TAGGED FOR RELEASE ***
+
+ * changes: Updated for 8.5.9 release.
+
+ * doc/menu.n: Formatting error.
+
+2010-09-01 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/entry.tcl: Revert keyboard navigation bindings
+ to use real events instead of virtual events.
+
+2010-08-31 Andreas Kupries <andreask@activestate.com>
+
+ * win/tcl.m4: Applied patch by Jeff fixing issues with the
+ manifest handling on Win64.
+ * win/configure: Regenerated.
+
+2010-08-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (DumpLine): [Bug 3053347]:
+ s/segPtr->size/currentSize/ throughout, but particularly in if
+ lineChanged block where segPtr may no longer be valid.
+
+ * unix/Makefile.in: add valgrind target
+ * unix/configure, unix/tcl.m4: [Bug 1230554]: SHLIB_LD_LIBS='${LIBS}'
+ for OSF1-V*. Add /usr/lib64 to set of auto-search dirs.
+ (SC_PATH_X): Correct syntax error when xincludes not found.
+
+ * win/Makefile.in (VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE):
+ * win/configure, win/configure.in, win/tcl.m4: SC_EMBED_MANIFEST
+ macro and --enable-embedded-manifest configure arg added to support
+ manifest embedding where we know the magic. Help prevents DLL hell
+ with MSVC8+.
+
+2010-08-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/ttk_spinbox.n (new), doc/ttk_*.3, doc/ttk_*.n:
+ * generic/ttk/ttkGenStubs.tcl:
+ * generic/ttk/ttk.decls, generic/ttk/ttkDecls.h:
+ * generic/ttk/ttkButton.c, generic/ttk/ttkCache.c:
+ * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
+ * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkElements.c:
+ * generic/ttk/ttkEntry.c, generic/ttk/ttkFrame.c:
+ * generic/ttk/ttkImage.c, generic/ttk/ttkInit.c:
+ * generic/ttk/ttkLabel.c, generic/ttk/ttkLayout.c:
+ * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c:
+ * generic/ttk/ttkProgress.c, generic/ttk/ttkScale.c:
+ * generic/ttk/ttkScroll.c, generic/ttk/ttkScrollbar.c:
+ * generic/ttk/ttkSeparator.c, generic/ttk/ttkSquare.c:
+ * generic/ttk/ttkState.c, generic/ttk/ttkStubInit.c:
+ * generic/ttk/ttkStubLib.c, generic/ttk/ttkTagSet.c:
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h:
+ * generic/ttk/ttkThemeInt.h, generic/ttk/ttkTrace.c:
+ * generic/ttk/ttkTrack.c, generic/ttk/ttkTreeview.c:
+ * generic/ttk/ttkWidget.c, generic/ttk/ttkWidget.h:
+ * library/ttk/spinbox.tcl (new):
+ * library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl:
+ * library/ttk/button.tcl, library/ttk/clamTheme.tcl:
+ * library/ttk/classicTheme.tcl, library/ttk/combobox.tcl:
+ * library/ttk/cursors.tcl, library/ttk/defaults.tcl:
+ * library/ttk/entry.tcl, library/ttk/notebook.tcl:
+ * library/ttk/panedwindow.tcl, library/ttk/scale.tcl:
+ * library/ttk/sizegrip.tcl, library/ttk/treeview.tcl:
+ * library/ttk/ttk.tcl, library/ttk/utils.tcl:
+ * library/ttk/vistaTheme.tcl, library/ttk/winTheme.tcl:
+ * library/ttk/xpTheme.tcl:
+ * macosx/ttkMacOSXTheme.c: used 8.6/carbon variant
+ * tests/ttk/combobox.test, tests/ttk/treetags.test:
+ * tests/ttk/treeview.test, tests/ttk/ttk.test:
+ * tests/ttk/vsapi.test:
+ * tests/ttk/checkbutton.test (new):
+ * tests/ttk/radiobutton.test (new):
+ * tests/ttk/spinbox.test (new):
+ * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c:
+ Major backport of 8.6 Ttk for 8.5.9. Most changes were only being
+ committed to head (8.6), although they could apply for 8.5 as well.
+ This re-sync makes future work easier to maintain and adds some
+ useful work for 8.5 users. [Bug 3053320]: Notable changes:
+ - Lots of code cleanup
+ - Some bug fixes never backported
+ - Addition of ttk::spinbox
+ - minor color changes
+ - Improved Vista/7 styling
+ - Move to tile version 0.8.6 (pseudo-package)
+ - ABI and API compatible (even $w identify)
+ - minor new features (extended $w identify)
+
+2010-08-03 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.9 release.
+
+2010-08-20 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/listbox.n (SEE ALSO): [Bug 3048809]: Corrected what other page
+ was referred to (ttk::treeview can work as a listbox).
+
+2010-08-12 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/text.tcl (TextCursorInSelection): [Patch 2585265]: Backport
+ of factoring-out of decision logic for whether to delete the selected
+ text.
+
+2010-08-11 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/Makefile.in (%.${OBJEXT}): better implicit rules support
+
+ * unix/configure: regen with ac-2.59
+ * unix/configure.in, unix/Makefile.in:
+ * unix/tcl.m4 (AIX): remove the need for ldAIX, replace with
+ -bexpall/-brtl. Remove TK_EXP_FILE (export file) and other baggage
+ that went with it. Remove pre-4 AIX build support.
+
+2010-08-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkCanvLine.c (LineDeleteCoords): [Bug 2900121]: Backport of
+ fix to sense of test.
+
+2010-08-10 Don Porter <dgp@users.sourceforge.net>
+
+ * library/msgs/pl.msg: Backport updates to pl.msg from HEAD
+
+2010-08-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * license.terms: Fix DFARs note for number-adjusted rights clause
+
+2010-08-04 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump to 8.5.9 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Updated for 8.5.9 release.
+
+2010-08-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/button.tcl (::tk::CheckEnter): [AS Bug#87409]: Use uplevel
+ set instead of set :: to work with other var resolvers (itcl).
+
+2010-08-03 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.9 release.
+
+2010-07-06 Andreas Kupries <andreask@activestate.com>
+
+ * doc/text.n: Fixed minor typo in the description of 'text delete', as
+ reported by <eee@users.sf.net> on the chat.
+
+2010-05-31 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkBind.c (Tk_CreateBinding): [Bug 3006842]: Silently ignore
+ empty binding scripts.
+ * generic/ttk/ttkTreeview.c: [$tv tag bind $tag <...> {}] now removes
+ binding.
+
+2010-05-31 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkMain.c: Fix CYGWIN warning: "fd_set and assiciated.macros
+ have been defined in sys/types. This may cause runtime problems with
+ W32"
+ * win/winMain.c: Add command line processing for CYGWIN, backported
+ from trunk.
+
+2010-05-20 Donal K. Fellows <dkf@users.sf.net>
+
+ * win/tkWinX.c (HandleIMEComposition): [Bug 2992129]: Ensure that all
+ places that generate key events zero them out first; Tk relies on that
+ being true for the generic parts of the fix for Bug 1924761.
+
+2010-05-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: [Bug 3002230]: tk_chooseDirectory returns garbage
+ on cancel.
+
+2010-05-17 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: [Bug 2987995]: Tk_getOpenFile returns garbage
+ under described circumstances. Backported some formatting from trunk.
+
+2010-05-03 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/button.tcl (CheckInvoke, CheckEnter): [Patch 1530276 redux]:
+ Apply a bit more care to ensure that things continue to work correctly
+ even when there is no -selectcolor defined.
+
+2010-04-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinPort.h: Fix [Patch 2986105]: conditionally defining
+ strcasecmp/strncasecmp
+ * win/tkWinDialog.c: Fix [Bug 2987995]: Tk_GetOpenFile returns garbage
+ under described circumstances, minor formatting.
+ * win/tkWinDialog.c: [Patch 2898255]: Filenames limit with
+ Tk_GetFileName().
+ Assure modern style dialogs where available
2010-03-12 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkButton.h [Bug 2956548] TkpButtonSetDefaults only
- * generic/tkButton.c initializes one button type
- * win/tkWinButton.c
- * win/tkWinTest.c Fix 2 minor gcc warnings
- * win/.cvsignore
- * doc/.cvsignore Ignore man.macros
+ * generic/tkButton.h: [Bug 2956548]: TkpButtonSetDefaults only
+ * generic/tkButton.c: initializes one button type
+ * win/tkWinButton.c:
+ * win/tkWinEmbed.c: Fix various gcc warnings, all
+ * win/tkWinMenu.c: backported from Tk 8.6
+ * win/tkWinPixmap.c:
+ * win/tkWinSend.c:
+ * win/tkWinTest.c:
+ * win/tkWinWm.c:
+ * win/tkWinX.c:
+ * win/tkWinInt.h: VC6++ does not have SPI_SETKEYBOARDCUES
+ * win/.cvsignore:
+
+2010-03-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkText.c (DumpLine): [Bug 2968379]: When peers are about,
+ there can be unnamed marks present during a dump. Ignore them as they
+ will just be for the peers' insert and current marks, which aren't
+ very important.
+
+2010-03-04 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/clipboard.n: Added note about STRING vs. UTF8_STRING types.
+
+2010-02-21 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkText.c (TextEditCmd): [Bug 1799782]: Refix this, so that
+ <<Modified>> events are issued when things change.
+
+2010-02-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/installManPage: [Tcl Bug 2954638]: Correct behaviour of manual
+ page installer. Also added armouring to check that assumptions about
+ the initial state are actually valid (e.g., look for existing input
+ file).
+
+2010-02-19 Stuart Cassoff <stwo@users.sourceforge.net>
+
+ * tcl.m4: Correct compiler/linker flags for threaded builds on
+ OpenBSD.
+ * configure: (regenerated).
2010-02-17 Joe English <jenglish@users.sourceforge.net>
- * generic/tkMenu.c: Defer TkMenuOptionTables cleanup
- to CallWhenDeleted() time, to ensure that the record
- doesn't get freed until after all widget instance commands
- have been deleted (Fixes [Bug#2952745]).
+ * generic/tkMenu.c: [Bug 2952745]: Defer TkMenuOptionTables cleanup to
+ CallWhenDeleted() time, to ensure that the record doesn't get freed
+ until after all widget instance commands have been deleted.
-2010-01-23 Pat Thoyts <patthoyts@users.sourceforge.net>
+2010-02-16 Jan Nijtmans <nijtmans@users.sf.net>
- * library/bgerror.tcl: [TIP #359]: Extended Window Manager Hints
- * library/clrpick.tcl: backported from 8.5 for use on X11.
- * library/dialog.tcl:
- * library/msgbox.tcl:
- * library/tkfbox.tcl:
+ * unix/tkUnixWm.c: Make TkSetTransientFor static
+
+2010-02-07 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkGenStubs.tcl: Backport various formatting (spacing)
+ * generic/ttk/ttk.decls: changes from HEAD, so diffing
+ * generic/ttk/ttkDecls.h: between 8.5.x and 8.6 shows the
+ * generic/tk*.decls: real structural differences again.
+ * generic/tk*Decls.h: (any signature change not backported!)
+
+2010-01-29 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkBind.c: Fix various gcc-4.4 warnings, all
+ * generic/tkListbox.c: backported from HEAD.
+ * generic/tkText.c:
+ * generic/ttk/ttkInit.c:
+
+2010-01-20 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/bgerror.tcl: [TIP 359]: Extended Window Manager Hints
+ * library/clrpick.tcl: following the freedesktop.org specification
+ * library/demos/widget: are now supported on X11 using a new
+ * library/dialog.tcl: wm attribute called '-type'
+ * library/msgbox.tcl: This feature is now used in the Tk library
+ * library/tkfbox.tcl: functions where appropriate.
+ * library/ttk/combobox.tcl:
* tests/unixWm.test:
+ * tests/wm.test:
* unix/tkUnixWm.c:
+2010-01-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkCanvas.c (TagSearchScanExpr): [Bug 2931374]: Stop overflow
+ of working buffer during construction of long tag expressions.
+
+2010-01-18 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkCanvas.c: [Patch 2932808]: Canvas items not
+ updating on widget state change.
+
+2010-01-09 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * doc/menu.n: [TIP 360]: Remove special handling of
+ * library/obsolete.tcl: the .help menu on X11.
+ * unix/tkUnixMenu.c:
+
+ * library/menu.tcl: [TIP 360]: Make Tk menu activation
+ * library/obsolete.tcl: follow mouse movements.
+
+2010-01-08 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * doc/photo.n: [Bug 2927569]: Multiple edits have peverted the
+ original meaning of the phrase 'image file data' to reference
+ a filename option that does not exist.
+
+2010-01-07 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkTextDisp.c (AsyncUpdateLineMetrics): [Bug 2677890]: Fix
+ odd text widget update problem that had scrollbars being unable to
+ cover the whole widget. Fix is to reify the range to update sooner.
+
+2010-01-06 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: Sync with Tcl version
+ * unix/configure: (regenerated)
+ * unix/Makefile.in:
+ * unix/.cvsignore:
+ * generic/default.h: Trivial CYGWIN fixes
+ * generic/tkWindow.c:
+ * doc/.cvsignore:
+
+2010-01-06 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixWm.c (TkWmMapWindow): [Bug 1163496]: Allow windows to be
+ * tests/wm.test (wm-transient-8.1): set to be transients for withdrawn
+ masters correctly.
+
+2010-01-05 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinDialog.c: [Patch 2898255]: Enable unlimited multiple
+ file selection from the open files dialog (pawlak,fellows,thoyts)
+
+2010-01-05 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkMenu.c (MenuWidgetObjCmd): [Bug 220950]: Do not delete
+ menu entries if the first index to delete is explicitly after the last
+ index of existing entries.
+
+2010-01-04 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/dialog.tcl: Backported fix for tk_dialog <Return> binding
+ * library/console.tcl: Backported fix for console keyboard menu
+ activation and <<Cut>> handling from HEAD.
+ * library/tk.tcl: Correctly handle quoted ampersands in AmpMenuArgs
+
+2010-01-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkMenu.h: [Patch 2848897] Support the system keyboard
+ * win/tkWinMenu.c: cues option on Windows. This system parameter
+ hides the underlines on menu items unless the keyboard is used to
+ open the menu. (kovalenko, thoyts)
+
+2010-01-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/tearoff.tcl: tearoff menus should be transient and use the
+ toolwindow style on Windows.
+ * tests/menu.test: menu tests using 'tkwait visibility' are unix only
+
+2010-01-02 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixEvent.c (TransferXEventsToTcl): [Bug 1924761]: Use the
+ new cache mechanism to force the extraction of the string of a key
+ event from XIM at the right time rather than after queueing when it
+ can be quashed by a race condition centered on the limited amount of
+ state in some XIM implementations.
+
+ * unix/tkUnixKey.c (TkpGetString): [Bug 1373712]: Cache the value that
+ * generic/tkInt.h (TkKeyEvent): will be substituted via %A so
+ * generic/tkEvent.c (CleanUpTkEvent): that we do not need to make it
+ * doc/HandleEvent.3 (ARGUMENTS): fresh each time, which causes
+ * doc/QWinEvent.3 (ARGUMENTS): trouble with some input
+ * macosx/tkMacOSXKeyEvent.c (InitKeyEvent): methods. Also includes the
+ * win/tkWinX.c (GenerateXEvent): factoring out of some code and
+ update of documentation to describe the slightly increased constraints
+ on how Tk_HandleEvent can be used.
+
+2010-01-01 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixEvent.c (TransferXEventsToTcl): [Bug 1924761]: Move the
+ * generic/tkEvent.c (Tk_HandleEvent): passing of key events to
+ XFilterEvent to the low level point where all other events are
+ handled, where it should have been all along. This makes more input
+ methods work, stops [event generate] from interfering with input
+ methods, and allows the simplification of tkEvent.c by removing half
+ of InvokeInputMethods and allowing the rest - which was not full input
+ method handling - to be rolled back into Tk_HandleEvent. Introduces a
+ small potential bug when a focus change and input method handling are
+ too close together in the Tk event queue, but that should be less
+ deadly to usability than the previous problems where input methods
+ could fail completely or reorder key presses...
+
+2009-12-30 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkMenu.c: [Patch 2879789]: Torn off menu items are only
+ * tests/menu.tcl: activated over a limited region of the window.
+ Fixed to make the whole width of a menu item activate the entry.
+
+2009-12-27 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinMenu.c: [Bug 2879927]: Highlight for cascade items in
+ torn-off menus is incorrect on Windows.
+
+2009-12-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/option.n: [Bug 2914943]: Correct the first example.
+ Also define what the format of option patterns is; that's a much less
+ commonly known fact than it used to be.
+
+2009-12-22 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/sizegrip.tcl: [Bug 2912356]: Patch to avoid bizarro
+ behavior under compiz.
+
+2009-12-22 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/tkfbox.tcl (ListInvoke): [Bug 2919205]: Correct ordering of
+ arguments to tk_messageBox.
+
+2009-12-20 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixSend.c (ServerSecure): [Patch 2917663]: Better support
+ for server-interpreted access control addreses.
+
+2009-12-16 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkNotebook.c: Don't call Tk_DeleteOptionTable()
+ [Bug 2915709], backport fix for [Bug 2496162].
+
+2009-12-14 Kevin B. Kenny <kennykb@acm.org>
+
+ * library/demos/unicodeout.tcl: Added code to check for right-to-left
+ support on Windows and adjust Hebrew and Arabic character strings
+ accordingly. Changed the Hebrew string to 'ktb ebryt' (ktav Ivrit,
+ "Hebrew writing") to be consistent with at least the Greek and Russian
+ strings. Thanks to Rodrigo Readi for calling the inconsistency to our
+ attention.
+
+2009-12-02 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkInt.decls: [Bugs 220600, 220690]: Comment that
+ TkWinChildProc is exported through the stubs table since 8.5.9
+
2009-12-11 Donal K. Fellows <dkf@users.sf.net>
- * library/tk.tcl (::tk::ScreenChanged): [Bug 2912473]: Stop problems
+ * library/tk.tcl (tk::ScreenChanged): [Bug 2912473]: Stop problems
caused by display names with a double colon in.
+2009-12-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/demos/ttkscale.tcl: Added demo of [ttk::scale] widget.
+
+2009-12-09 Andreas Kupries <andreask@activestate.com>
+
+ * library/safetk.tcl (::safe::loadTk): [Bug 2902573]: Fixed access to
+ the cleanupHook of the safe base. The code used the old internal
+ commands which have been removed since 2009-12-09. See Tcl's
+ ChangeLog.
+
+2009-12-09 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkColor.c (Tk_GetColorByValue): [Bug 2911570]: Ensure that
+ hash keys of color values are zeroed first, so that they hash properly
+ on 64-bit systems (where X structures are not tightly packed).
+
+2009-12-08 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * unix/tkUnixWm.c: [Bug 2864685]: Backported window manager hinting
+ update from HEAD
+
+2009-12-06 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (GetFontFamilyName): [Bug 2548661]: Merge fix
+ from HEAD (1.44).
+
+2009-12-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/xpTheme.tcl: Fix selection of treeview rows on
+ * library/ttk/vistaTheme.tcl: Windows XP and Vista.
+
+2009-12-02 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * doc/GetHINSTANCE.3: Correct mentioned header file
+ * win/tkWinInt.h: [Bugs 220600, 220690]: Make TkWinChildProc
+ * generic/tkInt.decls: available in private stub table.
+ * generic/tkIntPlatDecls.h: (regenerated)
+ * generic/tkStubInit.c: (regenerated)
+
+2009-11-25 Stuart Cassoff <stwo@users.sf.net>
+
+ * unix/tcl.m4: [Patch 2892871]: Remove unneeded
+ * AC_STRUCT_TIMEZONE.
+ * unix/configure: Regenerated with autoconf-2.59.
+
+2009-11-24 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixWm.c (WmIconphotoCmd): [Bug 2902814]: Use the correct
+ type for the array of data passed into X. It's wrong, but "right"
+ because of a mistake in the X11 specification.
+
+2009-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/winWm.test: [Bug 2899949]: Make sure the window is still
+ * win/tkWinWm.c: present when handling delayed activation
+
+2009-11-13 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/winDialog.test: [Bug 2307837]: Backported fix for running
+ * win/tkWinTest.c: dialog tests on non-English locales
+
+2009-11-12 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.8 TAGGED FOR RELEASE ***
+
+ * changes: Updated for 8.5.8 release.
+
+2009-11-03 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump to 8.5.8 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Updated for 8.5.8 release.
+
+2009-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinWm.c: [Bug 2891541]: Permit normal behaviour on
+ Windows for a grabbed toplevel when it is the main window.
+
2009-11-01 Joe Mistachkin <joe@mistachkin.com>
* win/tkWinButton.c: [Bug 1739613]: The default width being stored
@@ -190,24 +872,92 @@
allocates storage for the default width from the heap and frees it
using an exit handler.
+2009-10-29 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinFont.c: [Bug 1825353]: Backported patch for tiny
+ fixed font on Russian Windows systems.
+
2009-10-25 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixColor.c (TkpGetColor): [Bug 2809525]: Impose a maximum
X11 color name length so that it becomes impossible to blow things up
that way.
+ * library/text.tcl: [Bug 1854913]: Stop <Delete> actions from ever
+ deleting backwards, even when the insertion cursor is "at the end" of
+ the text widget.
+
+2009-10-24 Donal K. Fellows <dkf@users.sf.net>
+
+ * macosx/ttkMacOSXTheme.c (RangeToFactor, TrackElementDraw)
+ (PbarElementDraw): [Bug 2883712]: Corrected scaling of progress bars
+ and scales, and backported the fix for 64-bitness.
+
+ * library/button.tcl, unix/tkUnixButton.c (TkpDisplayButton):
+ [Patch 1530276]: Make -selectcolor handling work better for both
+ checkbuttons and radiobuttons when they don't have indicators.
+
2009-10-22 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkText.c (Tk_TextCmd, TextEditUndo, TextEditRedo)
- (TextEditCmd, updateDirtyFlag):
+ * generic/tkText.c (CreateWidget, TextEditUndo, TextEditRedo)
+ (TextEditCmd, UpdateDirtyFlag):
* generic/tkText.h: [Patch 1469210]: Corrected handling of marking as
dirty when inserting after an undo from a non-dirty state.
+ * library/xmfbox.tcl (MotifFDialog_FileTypes)
+ (MotifFDialog_ActivateSEnt):
+ * library/tkfbox.tcl (Done, ::tk::dialog::file::):
+ * macosx/tkMacOSXDialog.c (Tk_GetOpenFileObjCmd):
+ * win/tkWinDialog.c (GetFileNameW, GetFileNameA):
+ * doc/getOpenFile.n: [Patch 2168768]: Corrected handling of the
+ -typevariable option to be consistently global; it's the only way it
+ can work even close to the same on all platforms.
+
+2009-10-15 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Relax the runtime version requirements on Tcl
+ * generic/tkMain.c: so that Tk 8.5.8 can [load] into Tcl 8.6 (and
+ * generic/tkWindow.c: later 8.*) interps. [Feature Request 2794032]
+ * library/tk.tcl
+ * unix/Makefile.in:
+ * win/Makefile.in:
+ * win/makefile.vc:
+
+2009-10-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixRFont.c (InitFont,TkpGetFontFromAttributes,Tk_DrawChars):
+ [Bug 1961455]: Draw underlines and overstrikes when using Xft for font
+ rendering.
+
+2009-10-08 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/tkfbox.tcl (::tk::IconList_Create): [Patch 2870648]:
+ Corrected cursor used in file/directory dialogs.
+
+2009-10-07 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/vistaTheme.tcl: [Bug 2787164]: Fix size of dropdown
+ arrow on combobox and menubutton for Windows 7.
+
2009-10-07 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixScrlbr.c (TkpComputeScrollbarGeometry): [Patch 2088597]:
Stop scrollbars from getting too small at the end.
+2009-10-05 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.8 release.
+
+2009-10-05 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinButton.c: [Bug 2860827]: Backported patch avoiding 3D
+ effects with user-specified background.
+
+2009-09-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPhoto.c (ImgGetPhoto): Correct generation of grayscale
+ data from an image. Reported by Keith Vetter on comp.lang.tcl.
+
2009-09-14 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkMenuDraw.c (TkPostSubmenu): [Bug 873613]: Fix reposting of
@@ -216,70 +966,624 @@
(DrawMenuEntryArrow): [Bug 873608]: Draw Win menu arrow after being
torn off.
+2009-09-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixRFont.c (InitFont): Move pattern disposal in error case
+ to callers so they have more options when they come to recovering from
+ the failure.
+ (TkpGetFontFromAttributes): If the default attributes don't work, try
+ adding a setting to turn off use of XRender. That seems to work for
+ some people for unexplained reasons (possibly local misconfiguration).
+ * generic/tkFont.c (Tk_AllocFontFromObj): Stop this function from
+ keeling over in a heap when the low-level font allocation fails. An
+ error beats a crash! (Issue reported on comp.lang.tcl by Denis
+ Berezhnoy.)
+
+2009-08-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixSend.c (ServerSecure): [Bug 1909931]: Added some support
+ for server-interpreted access control addreses.
+
+2009-08-24 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/msgbox.tcl (::tk::MessageBox): Correct bindings so that they
+ work with ttk::buttons. Reported by Hans-Christoph Steiner.
+
2009-08-24 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXHLEvents.c (ScriptHandler): fix "do script" apple
+ * macosx/tkMacOSXHLEvents.c (ScriptHandler): Fix "do script" apple
event handler issues on recent Mac OS X releases by using AE coercion
- to 'utf8' for text data and to 'fsrf' for alias data. (reported by
+ to 'utf8' for text data and to 'fsrf' for alias data. (Reported by
Youness Alaoui on tcl-mac)
+2009-08-08 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/demos/pendulum.tcl: Make the display handle being resized
+ more gracefully.
+
+2009-08-04 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkTextDisp.c (TkTextCharLayoutProc): Make the line breaking
+ algorithm (in the word-wrap case) do the right thing with non-breaking
+ spaces by restricting what we break on to ASCII spaces, which is good
+ enough for most purposes.
+
+2009-08-01 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixWm.c (WmIconphotoCmd): [Bug 2830420]: Assemble the image
+ for the window manager in a way that doesn't assume we're on a little-
+ endian system.
+
2009-07-22 Donal K. Fellows <dkf@users.sf.net>
* generic/tkFocus.c (TkFocusDeadWindow): [Bug 2496114]: Ensure that
focus desynchronization doesn't cause a crash.
-2009-04-30 Don Porter <dgp@users.sourceforge.net>
+2009-07-20 Donal K. Fellows <dkf@users.sf.net>
+
+ * tests/clipboard.test (clipboard-6.2): [Bug 2824378]: Corrected
+ result of test in light of changes to binary selection retrieval.
+
+2009-07-18 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixSelect.c (SelCvtFromX32, SelCvtFromX8): Make the
+ incremental transfer of binary selections work get deserialized
+ correctly. Thanks to Emiliano Gavilan for detecting.
+
+2009-07-15 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixSelect.c (TkSelEventProc, SelRcvIncrProc, SelCvtFromX8):
+ [Bug 2821962]: Make byte sequence selection transfers possible.
+
+2009-07-14 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/canvas.n (WINDOW ITEMS): [Bug 2326602]: Corrected definition of
+ the -height and -width options for these items.
+
+ * unix/configure.in: [Bug 2496018]: Allow the disabling of the use of
+ XScreenSaver at configuration time, so as to permit better control of
+ dependencies in the embedded case.
+
+2009-07-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/grid.n: [Bug 2818455]: Corrected example.
+
+2009-06-27 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkInt.decls (Tk(Orient|Smooth)(Parse|Print)Proc):
+ Backport [Bug 2804935]: Expose these functions through the internal
+ stub table as they are useful to existing third-party code.
+
+2009-06-23 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkCanvUtil.c: [Bug 220935]: canvas dash update problem
+
+2009-06-02 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinWm.c: [Bug 2799589]: Backported fix for crash on
+ * tests/winWm.test: delayed window activation.
+
+2009-05-21 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinMenu.c: [Bug 2794778]: Backported fix for keyboard
+ traversal of the menus on Windows.
+
+2009-05-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkButton.c: [Bug 1923684]: Backported checkbutton fix
+ for confused state when -offvalue equals -tristatevalue
+
+2009-05-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * doc/ttk_image.n: Backported support for the Vista theme.
+ * doc/ttk_style.n: This requires the vsapi element engine,
+ * doc/ttk_vsapi.n: the hover state and the theme script
+ * doc/ttk_widget.n: definition.
+ * generic/ttk/ttkState.c:
+ * generic/ttk/ttkTheme.h:
+ * generic/ttk/ttkWidget.c:
+ * library/ttk/ttk.tcl:
+ * library/ttk/vistaTheme.tcl:
+ * library/ttk/xpTheme.tcl:
+ * tests/ttk/vsapi.test:
+ * win/ttkWinXPTheme.c:
+
+2009-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkFont.c: [Bug 2791352]: Backported fix and tests for
+ * tests/font.test: mis-parsing of certain font descriptions.
+
+2009-05-03 Donal K. Fellows <dkf@users.sf.net>
+
+ * win/tkWinWm.c (UpdateWrapper): [Bug 2785744]: Manipulate flag bit
+ correctly so that menubar updates can't smash other attributes.
+
+2009-04-30 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinWm.c: [Patch 2504402]: Backported change to create
+ wm icons as device independent bitmaps. (cjmcdonald)
+
+2009-04-30 Donal K. Fellows <dkf@users.sf.net>
* win/tkWinPixmap.c (Tk_GetPixmap): [Bug 2080533]: Added patch that
allows Tk to keep working even when the graphics card is stressed.
2009-04-28 Jeff Hobbs <jeffh@ActiveState.com>
- * unix/tcl.m4, unix/configure (SC_CONFIG_CFLAGS): harden the check
+ * unix/tcl.m4, unix/configure (SC_CONFIG_CFLAGS): Harden the check
to add _r to CC on AIX with threads.
+2009-04-27 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkInt.decls: [Bug 2768945]: Expose (as "private") a set of
+ functions needed for easily building canvas items that work like
+ existing standard ones.
+
+2009-04-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinDialog.c (ChooseDirectoryValidateProc): No need to set
+ cwd on selchange. Prevents delete of selected folder in dialog.
+
+2009-04-24 Stuart Cassoff <stwo@users.sf.net>
+
+ * unix/Makefile.in: [Bug 2764263]: Removed stray @ from
+ Makefile.in test target. [Bug 1945073]: Don't chmod+x square demo.
+ [Patch 2764272]: Adjustable demo install location.
+
+2009-04-24 Stuart Cassoff <stwo@users.sf.net>
+
+ * unix/Makefile.in: [Patch 2769530]: Don't chmod/exec installManPage.
+
+2009-04-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinDialog.c (Tk_ChooseDirectoryObjCmd): [Bug 2779910]: Enable
+ the new style choosedir that has a "New Folder" button, with
+ ::tk::winChooseDirFlags override for new behavior.
+
+2009-04-15 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.7 TAGGED FOR RELEASE ***
+
+ * changes: Updated for 8.5.7 release.
+
2009-04-14 Stuart Cassoff <stwo@users.sourceforge.net>
* unix/tcl.m4: Removed -Wno-implicit-int from CFLAGS_WARNING.
-2009-04-09 Don Porter <dgp@users.sourceforge.net>
+2009-04-10 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.7 release.
+
+ * generic/tk.h: Bump to 8.5.7 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+2009-04-10 Joe English <jenglish@users.sourceforge.net
+
+ * library/palette.tcl(tk_setPalette): Don't set
+ *selectColor: #b03060; this makes radio- and checkbuttons
+ look wrong post-TIP#109.
+
+2009-04-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/configure.in (Darwin): use Darwin SUSv3 extensions if
+ available.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * library/msgbox.tcl: don't set msgbox bitmap background on TkAqua.
+
+ * library/demos/filebox.tcl: only show "Motif Style Dialog" checkbutton
+ on X11 windowingsystem.
+
+ * library/demos/widget: GOOBE: use ttk::cursor
+
+ * library/ttk/cursors.tcl: backport ttk::cursor from HEAD
+
+ * library/demos/knightstour.tcl: fix knightstour demo not running from
+ interactive wish.
+
+ * library/console.tcl (::tk::ConsoleInit): remove redundant TkAqua
+ Quit menu item.
+
+ * generic/tkPointer.c (Tk_UpdatePointer): use all 5 buttons.
+
+ * generic/tkMenu.c (PostProcessEntry): delay call to
+ TkpConfigureMenuEntry() until all menu entry attributes are setup.
+
+ * library/menu.tcl (::tk::MbPost): fix error thrown in y position
+ computation with indicatoron.
+
+ * generic/tkMenubutton.c: s/DEF_BUTTON_JUSTIFY/DEF_MENUBUTTON_JUSTIFY/
+
+ * generic/tkTextBTree.c (TkBTreeDeleteIndexRange): add bounds check
+ to startEnd array access (fixes testsuite crash).
+
+ * tests/unixFont.test: only use xlsfonts with X11 windowingsystem.
- * generic/tk.h: Restore _TCL guards around tcl.h inclusion to restore
- compat with early 8.4.* releases. Thanks Stuart Cassoff. [Bug 1723812]
+2009-04-10 Donal K. Fellows <dkf@users.sf.net>
-2009-02-28 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * generic/tkCanvPs.c (TkPostscriptInfo): [Bug 1466509]: Eliminate old
+ and misleading comments mentioning prolog.ps.
+ * generic/prolog.ps, library/prolog.ps: Remove unused files.
+ * unix/Makefile.in, win/Makefile.in: Stop building distributions that
+ include the removed files or trying to install them.
+
+ * library/tk.tcl: [Bug 2116837]: Add event definitions to handle the
+ standard virtual events when Caps Lock is on.
+
+2009-04-03 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c: [Bug 1789819]: Don't Panic.
+
+2009-03-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/ttk/ttkTheme.c (BuildOptionMap, NewElementImpl):
+ [Bug 2178820]: Ensure that zero-size allocations don't happen; some
+ malloc implementations don't like it at all.
+
+ * win/wish.exe.manifest.in: [Bug 1871101]: Add magic to make Tk not be
+ blurred on Vista with large fonts.
+
+2009-03-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkFileFilter.c: Backported some fixes for uninitialized
+ * generic/tkFont.c: variables identified by das using clang
+ * generic/tkListbox.c: analysis.
+
+2009-02-27 Pat Thoyts <patthoyts@users.sourceforge.net>
* generic/tkWindow.c: [Bug 2645457] check for dead windows after
calling Tk_MakeWindowExist to avoid a crash when mapping dead windows.
+2009-02-23 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinCursor.c: [Patch 2542828] use stock Win32 help arrow
+ cursor when question_arrow requested (danckaert)
+
+ * win/rc/*.cur: [Patch 2513104] fix cursor hotspots (cjmcdonald)
+
+ * win/tkWinMenu.c: Applied patch for menu image display bug
+ [Bug 1329198, 456299] [Patch 2507419] (cjmcdonald)
+
+2009-02-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tcl.m4, win/configure: Check if cl groks _WIN64 already to
+ avoid CC manipulation that can screw up later configure checks.
+ Use 'd'ebug runtime in 64-bit builds.
+
+2009-02-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure.in, win/configure: align better with tcl
+ version. Ensures finding correct CPP for Win64.
+
2008-02-06 Daniel Steffen <das@users.sourceforge.net>
- * generic/tkImgPhoto.c: fix leaks discovered with the Mac OS X
- * generic/tkMenu.c: Instruments.app Leaks tool.
+ * generic/tkImgPhoto.c: fix numerous leaks discovered with the
+ * generic/tkMenu.c: Mac OS X Instruments.app Leaks tool.
+ * generic/tkText.c:
+ * generic/tkTextImage.c:
+ * generic/tkTextIndex.c:
+ * generic/tkUndo.c:
+ * generic/ttk/ttkFrame.c:
* macosx/tkMacOSXWm.c:
-2009-01-16 Andreas Kupries <andreask@activestate.com>
+2009-01-22 Kevin B. Kenny <kennykb@acm.org>
+
+ * unix/tcl.m4: Corrected a typo ($(SHLIB_VERSION) should be
+ ${SHLIB_VERSION}).
+ * unix/configure: Autoconf 2.59
+
+2009-01-19 Kevin B. Kenny <kennykb@acm.org>
+
+ * unix/Makefile.in: Added a CONFIG_INSTALL_DIR parameter so that
+ * unix/tcl.m4: distributors can control where tclConfig.sh goes.
+ Made the installation of 'ldAix' conditional
+ upon actually being on an AIX system. Allowed for downstream
+ packagers to customize SHLIB_VERSION on BSD-derived systems.
+ Thanks to Stuart Cassoff for [Patch 907924].
+ * unix/configure: Autoconf 2.59
+
+2009-01-14 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkImgPhoto.c: fix for aMSN compatibility [tcl-Bug 2507326]
+
+2009-01-11 George Peter Staplin <georgeps@users.sourceforge.net>
+
+ * generic/tkEvent.c: Backport a fix from 8.6 for a NULL pointer
+ dereference in CreateXIC.
- * win/tkWinWm.c (WmAttributesCmd): Fix a single use of
- SetWindowLongPtr which was not properly ifdef'd.
+2009-01-07 Pat Thoyts <patthoyts@users.sourceforge.net>
-2008-11-04 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinWm.c: Backported fix for [Bug 1847002] to prevent the
+ bypassing of grab restrictions via the taskbar on Windows.
- * generic/tkPort.h: remove the ../unix/ header dir as the build
- system already has it, and it confuses builds when used with
- private headers installed.
+2008-12-22 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.6 TAGGED FOR RELEASE ***
+
+ * tests/embed.test: Eliminate duplicate test names.
+
+ * changes: Updates for 8.5.6 release.
+
+2008-12-22 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkWidget.c: Don't crash when
+ application uses nondefault visual [Bug 2264732]
+ (Backport from trunk change 2008-11-11)
+ * Workaround for [Bug 2207435]
+ (Backport from trunk change 2008-10-31).
+
+2008-12-22 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkCanvPs.c (Tk_PostscriptFont,TkCanvPostscriptCmd): Backport
+ of font size and reflection fix. [Bug 2107938]
+
+2008-12-22 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * generic/tkCanvUtil.c: Backport of the Millipeter patch [1813597,
+ * generic/tkInt.h: 2218964]
+ * generic/tkObj.c:
+ * generic/tkText.c:
+
+2008-12-21 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump to 8.5.6 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Updates for 8.5.6 release.
+
+2008-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: [Bug 1939129,1991930] combobox dropdown
+ was drawn behind topmost toplevels.
+
+2008-11-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkImage.c Relax the constraint that every Tk_ImageType
+ * generic/tkImgPhoto.c can only be passed to this function once.
+ This allows tkImg to be loaded in multiple
+ interpreters in a thread-enabled build of Tk.
+ [Bug 2312027]
+
+2008-11-15 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tk.h: The tip 125 implementation permits the
+ * generic/tkFrame.c: wm manage command to manage any widget but
+ * macosx/tkMacOSXWm.c: only those with Frame instance data should
+ * unix/tkUnixWm.c: be permitted. We now check for the suitability
+ * win/tkWinWm.c: and raise an error for non-frame widgets.
+ * test/wm.test: Updated the tests and documentation.
+ * doc/wm.n: See also [Bug 2239034]
+
+2008-11-12 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/constraints.tcl: backported listbox test fix from head
+ * tests/listbox.test: the default on windows is 'underline'
+ * tests/winDialog.test: backported some fixes from head
+ * library/text.tcl: Backported fix for bug #1777362 to have events
+ * test/text.test: work with window paths that include hyphens.
+
+2008-10-23 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump version number to 8.5.6b1 to distinguish
+ * library/tk.tcl: CVS development snapshots from the 8.5.5 and
+ * unix/configure.in: 8.5.6 releases.
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf (2.59)
+ * win/configure:
+
+2008-10-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/scale.tcl: Backported keyboard bindings for ttk::scale
+
+2008-10-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ *** 8.5.5 TAGGED FOR RELEASE ***
+
+ * generic/tkCanvas.c (CanvasWidgetCmd): Corrected result generation.
+
+2008-10-10 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump to 8.5.5 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Updates for 8.5.5 release.
+
+ * unix/Makefile.in: Relax constraints in index script so that
+ * win/Makefile.in: each Tk 8.5.* release may be [package require]d
+ * win/makefile.vc: into any Tcl 8.5.* interp. [Bug 1890438].
+
+2008-10-09 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkListbox.c: Make literal return values consistent with
+ those generated by Tcl_PrintDouble().
+
+ * tests/canvText.test: Backport test updates in light of the
+ * tests/entry.test: 2008-10-05 commit.
+ * tests/listbox.test:
+ * tests/scrollbar.test:
+ * tests/spinbox.test:
+ * tests/textDisp.test:
+
+ * generic/tkEntry.c: Fix missing space constructing the scroll
+ command.
+
+2008-10-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * win/tkWinScrlbr.c: Convert 'sprintf(..."%g"...)' to the
+ * macosx/tkMacOSXScrlbr.c: locale-insensitive Tcl_PrintDouble.
+ * generic/tkScrollbar.c: [Bug 2112563] NOTE: Tcl_PrintDouble
+ * generic/tkListbox.c: is sensitive to the value of
+ * generic/tkEntry.c: ::tcl_precision.
+ * generic/tkCanvText.c: *** POTENTIAL INCOMPATIBILITY ***
+ * generic/tkArgv.c:
+
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+
+ * library/menu.tcl: additional fix for [Bug 1023955]
+
+2008-09-08 Todd M. Helfter <tmh@users.sourceforge.net>
+
+ * doc/menu.n: fix typo in docs [Bug 2098425]
+
+2008-08-28 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tkConfig.sh.in: Added @XFT_LIBS@ to the definition of TK_LIBS
+ to avoid link failures when a "big wish" program links against a
+ --disable-shared build of libtk. (Discovered building expectTk).
+
+ * generic/tk.h: Bump version number to 8.5.5b1 to distinguish
+ * library/tk.tcl: CVS development snapshots from the 8.5.4 and
+ * unix/configure.in: 8.5.5 releases.
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf (2.59)
+ * win/configure:
+
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+
+ * library/menu.tcl: fix typo from [Bug 1023955]
+
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+
+ * library/menu.tcl : Do not flip to the arrow cursor on menus.
+ This was a Motif convention. Current behavior is maintained if
+ tk_strictMotif is enabled. [Bug 1023955]
+
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+
+ The patch is associated with the bug tracker id: 1936220
+ library/tkfbox.tcl : fix the multiple selection error for
+ tk_getOpenFile -multiple 1 which fails on all unix platforms since
+ the adoption of ttk widgets.
+
+2008-08-19 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkScroll.c: Don't use sprintf "%g" to
+ format floating point numbers in -[xy]scrollcommand callbacks
+ or [xy]view methods. Minor incompatibility: 0 and 1 now
+ formatted as "0.0" resp "1.0".
+ * tests/ttk/entry.test, tests/ttk/treeview.test: Updated
+ to account for above change.
+
+2008-08-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of
+ fixed-width fonts with
+ size <= 10.
2008-08-14 Daniel Steffen <das@users.sourceforge.net>
+ *** 8.5.4 TAGGED FOR RELEASE ***
+
* unix/tcl.m4 (SC_PATH_X): check for libX11.dylib in addition to
libX11.so et al.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+2008-08-08 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump to 8.5.4 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Updates for 8.5.4 release.
+
+2008-08-05 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tk.h, generic/tkEvent.c: Fix for [Bug 2010422]
+ "no event type or button # or keysym while executing
+ "bind Listbox <MouseWheel> [...]".
+
+2008-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinWm.c: Backported fixes for handling unmapped parent
+ * test/wm.test: toplevels. [Bug 2009788, 2028703]
+
+2008-07-31 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Added missing EXTERN for the Tcl_PkgInitStubsCheck
+ declaration to fix inability to embed non-stub-enabled Tk on Windows.
+
+2008-07-26 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * doc/options.n: Direct to the font manual for -font [Bug 1686012]
+
+ * win/tkWinWindow.c: Check for 0x prefix in sprintf %p. Bug [2026405]
+
+2008-07-22 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/ttk/aquaTheme.tcl: Use system color names and TIP145 named
+ font instead of hardcoded color values and deprecated native font name.
+
+ * macosx/tkMacOSXHLEvents.c: sync with HEAD.
+
+2008-07-04 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkClamTheme.c,
+ generic/ttk/ttkClassicTheme.c, generic/ttk/ttkElements.c:
+ Backport [Bug 2009213].
+
+2008-06-29 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.3 TAGGED FOR RELEASE ***
+
+ * generic/tk.h: Bump to 8.5.3 for release.
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+ * README:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Updates for 8.5.3 release.
+
+2008-06-26 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkPanedWindow.c (PanedWindowProxyCommand)
+ (DisplayPanedWindow): Ensure that a zero width never gets fed to the
+ underlying window system. [Bug 1639824] (Backport fix from dkf).
-2008-08-06 Joe English <jenglish@users.sourceforge.net>
+2008-06-20 Joe English <jenglish@users.sourceforge.net>
- * generic/tk.h: Fix for [Bug 2010422]: account for X11 changing
- constant LASTEvent.
+ * library/ttk/treeview.tcl: Backport fix for [Bug 1951733]
+
+2008-06-19 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5.3 release.
2008-06-18 Daniel Steffen <das@users.sourceforge.net>
@@ -299,6 +1603,18 @@
* macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessWindowEvent): fix
return value.
+ * macosx/tkMacOSXInit.c: add helper to efficiently convert from
+ * macosx/tkMacOSXPrivate.h: CFString to Tcl_Obj.
+
+ * macosx/tkMacOSXFont.c (TkpGetFontFromAttributes, InitFont): fix
+ incorrect conversion to points of font sizes already in points; factor
+ out retrieval of font family name from font family ID.
+
+2008-06-13 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure, win/configure.in (TK_WIN_VERSION): fix handling
+ of interim a/b versioning for manifest usage.
+
2008-06-12 Daniel Steffen <das@users.sourceforge.net>
* generic/tkPointer.c (Tk_UpdatePointer): fix failure to restore a
@@ -306,61 +1622,257 @@
releasing a button grab. Fixes segfault due to dangling reference to
restrict window inside TkpSetCapture() implementation. [Bug 1991932]
- * macosx/tkMacOSXXStubs.c: sync with core-8-5-branch.
-
* unix/tcl.m4 (SunOS-5.11): fix 64bit amd64 support with gcc & Sun cc.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
-2008-04-17 Don Porter <dgp@users.sourceforge.net>
+ * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): use UsrActivity
+ instead of OverallAct (which may be ignored in some circumstances).
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add debug configs for 64bit,
+ * macosx/Wish.xcodeproj/default.pbxuser: with gcov, and with
+ corefoundation disabled; updates & cleanup for Xcode 3.1 and for
+ Leopard; sync with Tcl.xcodeproj.
+ * macosx/Wish.xcode/project.pbxproj: sync Wish.xcodeproj changes.
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/README: document new build configs.
+
+2008-06-10 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixKey.c: tkUnixKey.c: Use Xutf8LookupString if available
+ [Patch #1986818]. This should fix problems (like #1908443) where
+ Xlib's idea of the system encoding does not match Tcl's.
+
+2008-05-23 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkLabel.c: Avoid passing width or height <= 0 to
+ Tk_RedrawImage, as this leads to a panic on Windows [Bug 1967576]
- *** 8.4.19 TAGGED FOR RELEASE ***
+2008-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/tkCanvas.c: Fix logic that determines when canvas item
+ * library/tk.tcl: Support for ttk widgets in AmpWidget
+
+ * doc/button.n: Note negative widths for button [Patch #1883418]
+ * doc/ttk_*: 'identify' widget command is on all ttk widgets.
+
+2008-05-04 Joe English <jenglish@users.sourceforge.net>
+
+ * macosx/ttkMacOSAquaTheme.c: "default" and "focus" adornments
+ should not be disjoint [Bug 1942785]
+
+2008-04-17 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkCanvas.c: Fix logic that determines when canvas item
<Enter> event should fire. Thanks to Sebastian Wangnick. [Bug 1327482]
+2008-04-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinDialog.c: backport tk_chooseColor -title fix from head
+ * win/tkWinTest.c: Added parent to testgetwininfo
+ * tests/winDialog.test: Created some tk_chooseColor win tests.
+
+2008-04-11 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump version number to 8.5.3b1 to distinguish
+ * library/tk.tcl: CVS development snapshots from the 8.5.2 and
+ * unix/configure.in: 8.5.3 releases.
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf (2.59)
+ * win/configure:
+
2008-04-07 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkWindow.c (Initialize): fix double-free on Tk_ParseArgv
* tests/main.test (main-3.*): error. [Bug 1937135]
-2008-04-07 Don Porter <dgp@users.sourceforge.net>
+ * generic/tkArgv.c: fix -help mem explosion. [Bug 1936238] (kenny)
+
+2008-04-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/xpTheme.tcl: fix the colour of labelframe in xp
+
+2008-04-01 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkStubLib.c (Tk_InitStubs): Added missing error message.
+ * generic/tkWindow.c (Tk_PkgInitStubsCheck):
- * README: Bump version number to 8.4.19
+2008-03-28 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.2 TAGGED FOR RELEASE ***
+
+ * README: Bump to 8.5.2 for release.
* generic/tk.h:
+ * library/tk.tcl:
* unix/configure.in:
* unix/tk.spec:
* win/configure.in:
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
* win/configure:
- * changes: updates for 8.4.19 release.
+ * changes: Updates for 8.5.2 release.
+
+2008-03-27 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/safetk.tcl (::safe::tkInterpInit): make sure tk_library
+ and its subdirs (eg, ttk) are on the "safe" access path.
2008-03-27 Daniel Steffen <das@users.sourceforge.net>
* unix/tcl.m4 (SunOS-5.1x): fix 64bit support for Sun cc. [Bug 1921166]
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+2008-03-27 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/ttk/ttkStubLib.c: ensure tcl stubs are used in libtkstub
+ even in a static build of Tk.
+ * generic/ttk/ttkDecls.h: fix incorrect number of arguments in
+ Ttk_InitStubs macro definition.
+
+2008-03-26 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5.2 release.
+
+ * unix/tkUnixCursor.c: Stop crash in [. configure -cursor] on X11.
+ Thanks to emiliano gavilán. [Bug 1922466]
+
+2008-03-26 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkInt.h, generic/tkEvent.c, unix/tkUnixEvent.c,
+ unix/tkUnixKey.c: XIM reorganization and cleanup; see
+ [Patch 1919791] for details.
+
+2008-03-21 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tk.decls, generic/ttk/ttkStubLib.c, unix/Makefile.in:
+ Keep ttkStubLib.o in libtkstub instead of libtk. [Bug 1920030]
+
+2008-03-20 Donal K. Fellows <dkf@users.sf.net>
+
+ * tests/wm.test: Rewrote so that tests clean up after themselves
+ rather than leaving that to the following test. Makes it easier to
+ catch problems where they originate. Inspired by [Bug 1852338]
+
+2008-03-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/GetClrmap.3: Documented Tk_PreserveColormap. [Bug 220809]
+
+2008-03-17 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/Makefile.in, win/Makefile.in, win/makefile.vc: Put ttkStubLib.o
+ in libtkstub instead of libtk. [Bug 1863007]
+
+2008-03-16 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/demos/goldberg.tcl: Made work when run twice in the same
+ session. [Bug 1899664] Also made the control panel use Ttk widgets.
+
+2008-03-13 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/configure.in: Use backslash-quoting instead of double-quoting
+ * unix/tcl.m4: for lib paths in tkConfig.sh. [Bug 1913622]
+ * unix/configure: autoconf-2.59
+
+2008-03-13 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5.2 release.
+
+2008-03-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add support for Xcode 3.1
+ * macosx/Wish.xcodeproj/default.pbxuser: CODE_SIGN_IDENTITY and
+ * macosx/Wish-Common.xcconfig: 'xcodebuild install'.
+
+2008-03-12 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Try a fallback font if XftFontOpenPattern()
+ fails in GetFont (workaround for [Bug 1090382]).
+
+2008-03-11 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/demos/knightstour.tcl: Aqua GOOBE.
+ * library/demos/widget:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add support for Xcode 3.1 and
+ * macosx/Wish.xcodeproj/default.pbxuser: configs for building with
+ * macosx/Wish-Common.xcconfig: gcc-4.2 and llvm-gcc-4.2.
+
+ * generic/tkCanvUtil.c: Fix gcc-4.2 warnings.
+
+ * macosx/GNUmakefile: Fix quoting to allow paths to
+ * macosx/Wish-Common.xcconfig: ${builddir}, ${INSTALL_ROOT}
+ * unix/Makefile.in: and ${TCL_BIN_DIR} to contain
+ * unix/configure.in: spaces.
+ * unix/install-sh:
+ * unix/tcl.m4:
+
+ * unix/configure: autoconf-2.59
+
+ * unix/Makefile.in (install-strip): Strip non-global symbols from
+ dynamic library.
+
+2008-03-10 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5.2 release.
+
+2008-03-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/colors.n: Reworked to produce nicer HTML output.
+
+2008-03-06 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/ttk_notebook.n: Move "TAB IDENTIFIERS" section above "WIDGET
+ COMMAND" section. [Bug 1882011]
+
+2008-02-29 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/demos/widget: Added a Knight's tour canvas demo.
+ * library/demos/knightstour.tcl:
2008-02-27 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXDraw.c: workaround leak in Carbon SetPortPenPixPat()
API [Bug 1863346]; avoid repeated PixPat allocation/deallocation.
-2008-02-06 Don Porter <dgp@users.sourceforge.net>
+2008-02-23 Joe English <jenglish@users.sourceforge.net>
- *** 8.4.18 TAGGED FOR RELEASE ***
+ * library/ttk/combobox.tcl, doc/ttk_combobox.n,
+ * tests/ttk/combobox.test: Arrange to deliver <<ComboboxSelected>>
+ event after listbox is unposted, as intended [Bug 1890211]. Clarified
+ documentation.
- * README: Bump version number to 8.4.18
- * generic/tk.h:
+2008-02-23 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkPanedWindow.c: Don't enforce minimum sash thickness
+ of 5 pixels, just use 5 as a default. [FR 1898288]
+
+2008-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * unix/README: Documented missing configure flags.
+
+2008-02-06 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/ttk_scale.n (new file): Added basic documentation. [Bug 1881925]
+
+2008-02-04 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5.1 TAGGED FOR RELEASE ***
+
+ * generic/tk.h: Bump to 8.5.1 for release.
+ * library/tk.tcl:
* unix/configure.in:
* unix/tk.spec:
* win/configure.in:
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
* win/configure:
- * changes: updates for 8.4.18 release.
+2008-02-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/MeasureChar.3, doc/FontId.3: Minor improvements (formatting,
+ keywords).
2008-02-02 Daniel Steffen <das@users.sourceforge.net>
@@ -370,22 +1882,151 @@
* unix/configure.in (Darwin): correct Info.plist year substitution in
non-framework builds.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+2008-02-01 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5.1 release.
2008-02-01 Reinhard Max <max@suse.de>
* generic/tkImgGIF.c: Fixed a buffer overflow (CVE-2008-0553).
* tests/imgPhoto.test: Added a test for the above.
-2007-12-31 Don Porter <dgp@users.sourceforge.net>
+2008-01-31 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/msgbox.tcl (::tk::MessageBox): don't use ttk::label in
+ low depth/aqua fallback, as it doesn't support -bitmap.
+
+ * win/tkWinDialog.c (Tk_MessageBoxObjCmd): pass "" instead of NULL
+ when -title isn't set. [Bug 1881892]
+
+2008-01-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/panedwindow.n: Added proper description of -height and -width
+ options, which aren't "standard". Last of fallout from [Bug 1882495].
+
+2008-01-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/canvas.n, doc/listbox.n, doc/message.n: Fix erroneous listing of
+ "standard" options. [Bug 1882495]
+
+2008-01-29 Joe English <jenglish@users.sourceforge.net>
+
+ * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error
+ if no current focus item; reported on c.l.t.)
+
+2008-01-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/ttk_*.n: Adjusted handling of the standard options part of the
+ Ttk manual pages so that they are documented in the correct location.
+ [Bug 1876493]
- *** 8.4.17 TAGGED FOR RELEASE ***
+2008-01-28 Joe English <jenglish@users.sourceforge.net>
- * changes: updates for 8.4.17 release.
- * unix/configure.in: Add "hu" to LOCALES.
- * unix/configure: autoconf-2.13
+ * unix/tkUnixRFont.c: Re-fix strict-aliasing warnings reintroduced by
+ last patch.
-2007-12-18 Daniel Steffen <das@users.sourceforge.net>
+2008-01-27 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkNotebook.c: Make sure to schedule a redisplay when
+ adding and/or hiding tabs. [Bug 1878298]
+
+2008-01-27 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Merged common code from InitFont() and
+ TkpGetFontAttrsForChar(), factored into GetTkFontAttributes() and
+ GetTkFontMetrics(). Removed write-only struct UnixFtFont member
+ 'drawable'. Removed unneeded double-pointer indirections. Ensure that
+ TkFontAttributes.family member is a Tk_Uid, as specified. Use
+ FcTypeDouble for XFT_SIZE attribute. Finally: fix [Bug 1835848]
+
+2008-01-25 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5.1 release.
+
+2008-01-08 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkFrame.c: BUGFIX: fix crash in [ttk::labelframe] when
+ -style option specified. [Bug 1867122]
+
+2008-01-08 Joe English <jenglish@users.sourceforge.net>
+
+ * win/ttkWinTheme.c: Add tristate support to checkbuttons and
+ radiobuttons. [Bug 1865898]
+ Fix check and radio indicator size. [Bug 1679067]
+
+2008-01-06 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkWidget.c, generic/ttk/ttkWidget.h: Call
+ Tk_MakeWindowExist() in widget constructor. Removed now-unnecessary
+ initial ConfigureNotify processing.
+
+2008-01-06 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/treeview.tcl, library/ttk/utils.tcl: Fix MouseWheel
+ bindings for ttk::treeview widget. [Bugs 1442006, 1821939, 1862692]
+
+2008-01-02 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump version number to 8.5.1b1 to distinguish
+ * library/tk.tcl: CVS development snapshots from the 8.5.0 and
+ * unix/configure.in: 8.5.1 releases.
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf (2.59)
+ * win/configure:
+
+2007-12-30 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/canvas.n: Documented exact behaviour of items with respect to
+ when they are the current item. [Bug 1774593] Also documented the
+ clipping behaviour of window items.
+
+ * library/demos/nl.msg: Corrected following testing "in the field" by
+ Arjen Markus. [Bug 1860802]
+
+2007-12-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ *** 8.5.0 TAGGED FOR RELEASE ***
+
+ * doc/canvas.n: Documented -outlineoffset item option. [Bug 1836621]
+
+2007-12-14 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: More updates for 8.5.0 release.
+
+2007-12-14 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/ttk_treeview.n: Fix typo. [Bug 1850713]
+
+2007-12-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinInt.h: Add in missing function definitions
+ * win/tkWinButton.c: to support plain MSVC6 and use INT_PTR
+ * win/tkWinScrlBar.c: rather than LONG_PTR which isn'tr defined
+ * win/tkWinWm.c: in the msvc6 headers.
+
+2007-12-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/nmakehlp.c: Support compilation with MSVC9 for AMD64.
+ * win/makefile.vc:
+
+2007-12-13 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkMenubutton.c (ConfigureMenuButton): trace the
+ -textvariable even if an image exists as it may use -compound.
+
+2007-12-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (DeleteIndexRange, TextEditCmd, UpdateDirtyFlag):
+ * tests/text.test (text-25.10.1,25.11.[12]):
+ Don't require [update idle] to trigger Modified event [Bug 1809538]
+ Modified virtual event should only fire on state change [Bug 1799782]
+ Make sure we delete chars before triggering <<Modified>> [Bug 1737288]
+
+2007-12-12 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): Revert 2007-10-26
change to window class of transient toplevels that are not also
@@ -399,44 +2040,283 @@
master; bring master to front when selecting transient windows; restore
default window group of transients if master destroyed. [Bug 1845899]
- * macosx/tkMacOSXPrivate.h: fix Panther build.
+2007-12-12 Joe English <jenglish@users.sourceforge.net>
-2007-12-13 Jeff Hobbs <jeffh@ActiveState.com>
+ * doc/ttk_intro.n, doc/ttk_style.n, doc/ttk_widget.n:
+ Various minor updates.
- * generic/tkMenubutton.c (ConfigureMenuButton): trace the
- -textvariable even if an image exists as it may use -compound.
+2007-12-12 Don Porter <dgp@users.sourceforge.net>
-2007-12-12 Jeff Hobbs <jeffh@ActiveState.com>
+ * changes: Updated for 8.5.0 release.
- * generic/tkText.c (DeleteChars, TextEditCmd, updateDirtyFlag):
- * tests/text.test (text-25.10.1,25.11.[12]):
- Don't require [update idle] to trigger Modified event [Bug 1809538]
- Modified virtual event should only fire on state change [Bug 1799782]
- Make sure we delete chars before triggering <<Modified>> [Bug 1737288]
+2007-12-11 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.c(StyleElementOptionsCmd):
+ Use Ttk_GetElement() to find element instead of direct
+ hash table access.
+
+2007-12-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkText.c (TextReplaceCmd): Added code to rebuild the from
+ index after the deletion phase so that the linePtr field is valid for
+ the insertion phase. [Bug 1602537]
+
+2007-12-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/event.n: Clarify the fact that [event info] only returns the
+ names of virtual events that are bound to physical event sequences.
+ This follows on from comments on comp.lang.tcl.
+ http://groups.google.com/group/comp.lang.tcl/msg/935d2d226ae8a770
+
+2007-12-10 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/AddOption.3, doc/CrtImgType.3, doc/CrtPhImgFmt.3,
+ * doc/InternAtom.3, doc/TextLayout.3, doc/chooseColor.n,
+ * doc/chooseDirectory.n, doc/loadTk.n, doc/palette.n,
+ * doc/ttk_combobox.n: Various markup fixes (mostly: missing quotes on
+ .SH arguments, extraneous .PPs)
+
+ * doc/ttk_entry.n, doc/ttk_scrollbar.n, doc/ttk_treeview.n: Remove
+ extra .BEs that got added by mistake somewhere.
+
+2007-12-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tk.decls: use new genstubs 'export' command to
+ * generic/tkInt.decls: mark exported symbols not in stubs
+ table [FR 1716117]; cleanup formatting
+
+ * generic/tkIntDecls.h: regen with new genStubs.tcl.
+ * generic/tkIntPlatDecls.h: [Tcl Bug 1834288]
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkStubInit.c:
+
+2007-12-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * tests/safe.test: Ensure list of hidden commands is correct. [Bug
+ 1847925]
+
+2007-12-10 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWin.h: We must specify the lowest Windows version we intend to
+ support. In particular the SystemParametersInfo API doesn't like to
+ receive structures that are larger than it expects which affects the
+ font assignements. Set to Win98 support.
+
+ * win/tkWinFont.c: Handle failure to read the system parameters. This
+ causes ttk/fonts.tcl to set any missing named fonts.
+
+ * win/ttkWinMonitor.c: Only tkWin.h should include windows.h unless
+ * win/ttkWinTheme.c: we have an explicit override of the WINVER
+ * tin/ttkWinXPTheme.c: macro.
+
+ * win/rules.vc: Handle MSVC 9 (aka: Visual Studio 2008)
+
+ * tests/safe.test: Update for 'unload' as a safe command (tcl 8.5b3+)
+
+2007-12-09 Donal K. Fellows <dkf@users.sf.net>
+
+ * win/configure.in: Adjusted code so that running configure does not
+ generate an error message when the full current directory name
+ contains a space.
+
+ * win/tkWinWm.c: Added set of #defs to make this file build with my
+ version of the SDK (i.e. with the msys suite we distribute).
+
+2007-12-07 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/altTheme.tcl, library/ttk/classicTheme.tcl:
+ s/style/ttk::style/.
+
+2007-12-07 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/README: Mention the stub library created by `make` and warn
+ about the effect of embedded paths in the installed binaries. Thanks
+ to Larry Virden. [Tcl Bug 1794084]
+
+2007-12-05 Joe English <jenglish@users.sourceforge.net>
+
+ * macosx/ttkMacOSXTheme.c: Fix TCombobox layout so as not to truncate
+ long text when combobox is wider than requested. [Bug 1845164]
2007-12-05 Jeff Hobbs <jeffh@ActiveState.com>
+ * library/demos/widget: reduce start size to 70% of screenheight from
+ sh-200 for a more reasonable size.
+
+ * win/tkWinButton.c, win/tkWinDialog.c: use SetWindowLongPtr and
+ * win/tkWinScrlbr.c, win/tkWinWm.c: GetWindowLongPtr only.
+ * win/ttkWinMonitor.c:
+
* win/tkWinInt.h: remove CS_CLASSDC (not recommended for any apps now)
* win/tkWinX.c: and simplify WNDCLASS to one style.
* win/tkWinWm.c: Reduce wrapper update for exStyle to toolwindow
- change only and set WS_EX_LAYERED as sticky (once set on a window,
- do not remove it) to reduce alpha transition flicker.
+ change only and set WS_EX_LAYERED as sticky (once set on a window, do
+ not remove it) to reduce alpha transition flicker.
- * win/tkWinDraw.c: Applied [Patch 1723362] for transparent bitmaps.
+ * win/configure, win/tcl.m4 (LIBS_GUI): mingw needs -lole32 -loleaut32
+ but not msvc for Tk's [send]. [Bug 1844749]
+
+2007-12-04 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/ttk_style.n: Remove nonsense about "this manpage has not yet
+ been written"; everything supported is documented.
+
+2007-12-04 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/msgs/en.msg: Added missing messages. [Patch 1800744]
+
+ * library/msgs/da.msg: Added Danish messages. [Patch 1844143]. Many
+ thanks to Torsten Berg <treincke@users.sf.net>.
+
+2007-12-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure, win/tcl.m4 (LIBS_GUI): remove ole32.lib oleaut32.lib
+ (LIBS): add ws2_32.lib for static builds with Tcl.
+
+2007-12-01 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h,
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkLayout.c,
+ * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c,
+ * generic/ttk/ttkTreeview.c, macosx/ttkMacOSXTheme.c,
+ * win/ttkWinTheme.c, win/ttkWinXPTheme.c: Improved macrology for
+ statically-initialized layout template tables.
+
+2007-11-28 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tkUnixPort.h: When unix/configure determines whether the
+ intptr_t type is available, it has the <inttypes.h> header present.
+ It's only fair that we let Tk have it too.
2007-11-26 Kevin Kenny <kennykb@acm.org>
- Backport from HEAD of [Bug #1822391]:
+ * generic/tkImgPPM.c (StringReadPPM): Corrected a comparison whose
+ sense was reversed that resulted in reading beyond the end of the
+ input buffer on malformed PPM data. [Bug 1822391]
+ * library/tkfbox.tcl (VerifyFileName): Corrected a couple of typos in
+ handling of bad file names. [Bug 1822076] Thanks to Christoph Bauer
+ (fridolin@users.sf.net) for the patch.
+ * tests/filebox.test (filebox-7.1, filebox-7.2): Added test cases that
+ exercise. [Bug 1822076]
+ * tests/imgPPM.test (imgPPM-4.1): Added test case that exercises. [Bug
+ 1822391]
- * generic/tkImgPPM.c (StringReadPPM): Corrected a comparison
- whose sense was reversed that resulted in reading beyond the
- end of the input buffer on malformed PPM data. [Bug #1822391]
- * tests/imgPPM.test (imgPPM-4.1): Added test case that
- exercises [Bug #1822391].
+2007-11-25 Joe English <jenglish@users.sourceforge.net>
-2007-11-09 Daniel Steffen <das@users.sourceforge.net>
+ * generic/ttk/ttkManager.h, generic/ttk/ttkManager.c,
+ * generic/ttk/ttkFrame.c, generic/ttk/ttkNotebook.c,
+ * generic/ttk/ttkPanedwindow.c: Internal Ttk_Manager API updates;
+ Fixed [Bug 1343984]; Added [$nb hide] method; [$nb add] on
+ already-managed windows no longer throws an error, can be used to
+ re-add a hidden tab.
+
+ * doc/ttk_notebook.n, tests/ttk/notebook.test,
+ * tests/ttk/panedwindow.test: Updated docs and test suite.
+
+2007-11-23 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * unix/README: General improvements.
+
+2007-11-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/tkfbox.tcl: Better theming in the file list area.
+
+2007-11-19 Don Porter <dgp@users.sourceforge.net>
- Backport from HEAD of Aqua changes from 2007-10-12 to 2007-11-09:
+ *** 8.5b3 TAGGED FOR RELEASE ***
+
+ * README: Bump version number to 8.5b3.
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Update changes for 8.5b3 release.
+
+2007-11-19 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.c: Fix crash when 'style element create'
+ * tests/ttk/ttk.test: called w/ insufficient args; add tests.
+
+2007-11-18 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkElements.c, macosx/ttkMacOSXTheme.c: Add "fill"
+ element: like "background" but only erases parcel.
+
+ * generic/ttk/ttkFrame.c: Use fill element in Labelframe Label
+ sublayout. Also improved default labelmargins for -labelanchor w*, e*.
+
+ * generic/ttk/ttkLabel.c: no longer need Labelframe hack.
+
+ * library/ttk/aquaTheme.tcl: ImageTextElement no longer needed.
+ TextElement no longer needs '-background' option.
+
+ * generic/ttk/ttkFrame.c: Use sublayout for ttk::labelframe labels
+ instead of single element.
+
+ * generic/ttk/ttkLabel.c: Default -anchor for text and label elements
+ is now "w" instead of "center". [Bug 1614540]
+
+ * library/ttk/defaults.tcl, library/ttk/*Theme.tcl: Button styles now
+ need explicit "-anchor center".
+
+ * generic/ttk/ttkLayout.c (TTKInitPadding): BUGFIX:
+ Ttk_GetPaddingFromObj() and Ttk_GetBorderFromObj() returned garbage
+ when passed an empty list.
+
+ * macosx/ttkMacOSXTheme.c: Resynchronize with Tile codebase so that
+ patches can flow back and forth.
+
+ * library/ttk/aquaTheme.tcl: Extra TButton -padding no longer needed.
+
+2007-11-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/ttkWinXPTheme.c: Add support for size information flags for
+ scrollbar and combobox buttons. This handles Tile [Patches 1596647 and
+ 1596657] but a bit more generically.
+
+2007-11-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/(tkArgv.c, tkBind.c, tkCipboard.c, tkEntry.c, tkOption.c,
+ tkScale.c, tkScrollbar.c, tkTextImage.c, tkVisual.c, tkWindow.c): Tidy
+ up some variable types.
+
+ * generic/tkFont.c: Only check for -displayof if there are
+ * test/font.test: sufficient arguments. This permits checking
+ strings like -d.
+
+2007-11-17 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/scrollbar.tcl: Swap in core scrollbars for
+ [ttk::scrollbar]s on OSX.
+
+2007-11-16 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Correct an
+ oversight in the bug fix from 2007-11-11. [Bug 1824638]
+
+2007-11-15 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new chanio.test.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-11-14 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/msgs/sv.msg: Get the locale declared within the message
+ catalog correct! [Bug 1831803]
+
+2007-11-11 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix the case when
+ TK_WHOLE_WORDS and TK_AT_LEAST_ONE are both set and maxLength is small.
+ [Bug 1824638]
+
+2007-11-09 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXCarbonEvents.c
(InstallStandardApplicationEventHandler): on Mac OS X Leopard, replace
@@ -489,6 +2369,64 @@
* macosx/tkMacOSXPrivate.h: correct Leopard HIToolboxVersionNumber.
+ * macosx/ttkMacOSXTheme.c: add error checking; cleanup formatting.
+
+ * macosx/tkMacOSXFont.c (TkpGetFontAttrsForChar): panic on false return
+ from TkMacOSXSetupDrawingContext().
+
+ * macosx/tkMacOSXButton.c: sync formatting, whitespace, copyright
+ * macosx/tkMacOSXDialog.c: with core-8-4-branch.
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXWm.c:
+ * xlib/xgc.c
+ * library/bgerror.tcl:
+ * library/console.tcl:
+ * library/menu.tcl:
+
+2007-11-07 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.c (Ttk_ElementSize): Fixed longstanding,
+ subtle bug that caused element padding to sometimes be counted
+ twice in size computations.
+
+ * generic/ttk/ttkElements.c, generic/ttk/ttkClamTheme.c,
+ generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkTreeview.c,
+ generic/ttk/ttkImage.c, macosx/ttkMacOSXTheme.c,
+ win/ttkWinTheme.c, win/ttkWinXPTheme.c: Fix ElementSizeProcs affected
+ by previous change.
+
+2007-11-06 Andreas Kupries <andreask@activestate.com>
+
+ * doc/CrtConsoleChan.3: Fixed markup typo and extended see also
+ section per suggestions by Donal.
+
+2007-11-05 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: Set focus to listbox in <Map> binding
+ instead of in Post command (see [Bug 1349811] for info).
+
+2007-11-05 Andreas Kupries <andreask@activestate.com>
+
+ * doc/CrtConsoleChan.3: New file providing minimal documentation
+ of 'Tk_InitConsoleChannels()'. [Bug 432435]
+
+2007-11-05 Joe English <jenglish@users.sourceforge.net>
+
+ * macosx/ttkMacOSXTheme.c (TreeitemLayout): Remove focus ring
+ from treeview items on OSX (problem reported by Kevin Walzer).
+
+2007-11-04 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c: Use null "treearea" element for
+ treeview owner-draw area instead of "client", to avoid
+ nameclash with Notebook.client element (this was causing
+ sizing anomalies in XP theme, and introduced extraneous
+ padding).
+ * generic/ttk/ttkDefaultTheme.c: Treeitem.indicator element
+ needs left margin now.
+
+2007-11-04 Daniel Steffen <das@users.sourceforge.net>
+
* macosx/tkMacOSXMenus.c: add "Run Widget Demo" menu item to the
default Edit menu along with associated carbon event handler enabling
the item only if demo files are installed; cleanup handling of "About"
@@ -496,18 +2434,446 @@
* library/bgerror.tcl: fix background of detail text on Aqua.
- * library/console.tcl: sync aqua font size with HEAD.
+ * library/console.tcl: add accelerators and fix Aqua bindings
+ of the new font size menu items.
- * library/demos/widget: Aqua GOOBE.
+ * library/demos/mclist.tcl: Aqua GOOBE.
+ * library/demos/tree.tcl:
+ * library/demos/ttknote.tcl:
+ * library/demos/widget:
+
+ * doc/chooseDirectory.n: remove/correct obsolete Mac OS 9-era
+ * doc/getOpenFile.n: information.
+ * doc/menu.n:
* macosx/tkMacOSXEvent.c (TkMacOSXProcessCommandEvent): fix boolean arg
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo file.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/console.tcl: Add menu item and key binding to adjust font.
+
+2007-11-02 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/demos/mclist.tcl: Added a demo of how to do a multi-column
+ sortable listbox.
+
+ * library/msgbox.tcl: Made message dialog use Ttk widgets for better
+ L&F.
+
+ * library/tkfbox.tcl (::tk::dialog::file::CompleteEnt): Added <Tab>
+ completion. [FR 805091]
+ * library/tkfbox.tcl: Made file dialog use Ttk widgets for better L&F.
+
+ * library/demos/sayings.tcl: Better resizing. [Bug 1822410]
+
+2007-11-01 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/textpeer.tcl: Better resizing. [Bug 1822601]
+
+ * doc/colors.n: Added list of Windows system colors. [Bug 945409]
+
+2007-11-01 Daniel Steffen <das@users.sourceforge.net>
+
* macosx/tkMacOSXColor.c (GetThemeColor): improve translation of RGB
- pixel values into RGBColor.
+ pixel values into RGBColor.
+
+ * library/demos/widget: increase height of main window text widget to
+ use more of the available vertical space.
+
+ * doc/bind.n: document the Option modifier, clarify meaning
+ and availability of Command & Option.
+
+ * doc/console.n: clarify availability of [console] in TkAqua.
+
+2007-11-01 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * unix/installManPage, doc/*.n: Make documentation use the name that
+ scripts use as much as possible. [Bug 1640073]
+
+ * doc/text.n: Fixed mistake in [$t tag remove] docs. [Bug 1792191]
+
+ * doc/bind.n: Documented the Command modifier. [Bug 1232908]
+
+ * doc/console.n, doc/wish.1: Made it clearer when and why the console
+ command is present. [Bug 1386955]
+
+2007-10-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/entry3.tcl: Improved description/comments so that
+ people better understand what is being validated, following suggestion
+ from Don Porter.
+
+ * library/demos/image2.tcl (loadImage): Mark non-loadable images
+ as such instead of throwing a nasty dialog, following suggestion
+ from Don Porter.
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock): More optimization, derived
+ from [Patch 224066].
+
+2007-10-30 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl (Unpost): BUGFIX: Unpost can be called with
+ no preceding Post.
+
+2007-10-31 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/rules.vc: Use -fp:strict with msvc8 as -fp:precise fails on
+ * generic/tkObj.c: amd64 builds. Fix the two places in Tk that
+ * generic/tkTrig.c: generate errors with msvc8 when using this flag.
+
+2007-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/choosedir.tcl: only enable OK button when valid in
+ conjunction with -mustexist. [Bug 1550528]
+
+ * library/listbox.tcl (::tk::ListboxBeginSelect): ignore -takefocus
+ when considering focus on <1>, it is for tab focus.
+
+2007-10-30 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump version number to 8.5b2.1 to distinguish
+ * library/tk.tcl: CVS development snapshots from the 8.5b2
+ * unix/configure.in: release.
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf (2.59)
+ * win/configure:
+
+2007-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/text.n: fix spelling of -inactiveselectbackground [Bug 1626415]
+
+ * library/entry.tcl: don't error with Clear event. [Bug 1509288]
+
+ * library/ttk/fonts.tcl: use size -12 TkFixedFont (was -10) on X11
+
+2007-10-30 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/unicodeout.tcl: Fixed Arabic and Hebrew rendering on
+ Windows. [Bug 1803723]
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Rename enumeration for somewhat
+ simpler-to-read code. [Bug 1677613]
+
+2007-10-30 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkWidget.c: Split up RedisplayWidget() to factor out
+ double-buffering related code.
+
+ * macosx/ttkMacOSXAquaTheme.c: Use SetThemeBackGround/
+ kThemeBrushModelessDialogBackground{Active|Inactive} instead of
+ ApplyThemeBackground/kThemeBackgroundWindowHeader (advice from DAS).
+
+ * library/ttk/aquaTheme.tcl: Use darker shade for inactive and
+ disabled text, to match typical values of most
+ kThemeXXXTextColorInactive values.
+
+2007-10-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/selection.n: Clarify UTF8_STRING handling. [Bug 1778563]
+
+ * doc/text.n: Clarify search subccommand docs. [Bug 1622919]
+
+2007-10-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXFont.c (InitSystemFonts):
+ * library/ttk/fonts.tcl: use Monaco 11 (was 9) as Aqua TkFixedFont
+
+ * tests/listbox.test, tests/panedwindow.test, tests/scrollbar.test:
+ * library/bgerror.tcl, library/dialog.tcl, library/listbox.tcl:
+ * library/msgbox.tcl, library/optMenu.tcl, library/tclIndex:
+ * library/tkfbox.tcl, library/demos/floor.tcl, library/demos/rmt:
+ * library/demos/tcolor, library/demos/text.tcl:
+ * library/demos/twind.tcl, library/demos/widget: Buh-bye Motif look
+ * library/ttk/fonts.tcl: Update of Tk default look in 8.5
+ * macosx/tkMacOSXDefault.h: Trims border sizes, cleaner X11 look
+ * unix/tkUnixDefault.h: with minor modifications for Win32/Aqua.
+ * win/tkWinDefault.h: Uses Tk*Font definitions throughout for
+ * win/tkWinFont.c: classic widgets. [Bug 1820344]
+ * library/obsolete.tcl (::tk::classic::restore): This restores
+ changes made to defaults in 8.5 using the 'option' command,
+ segmented into logical groups.
+
+ * tests/winfo.test: winfo-4.5 raise .t to above . for Windows
+
+ * tests/unixWm.test: note TIP#142 results and remove unnecessary
+ catches.
+
+2007-10-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/*.1, doc/*.n, doc/*.3: Lots more GOOBE work.
+
+2007-10-28 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: Make popdown window [wm resizable 0 0] on
+ OSX, to prevent TkAqua from shrinking the scrollbar to make room for a
+ grow box that isn't there.
+ * macosx/ttkMacOSXTheme.c, library/ttk/aquaTheme.tcl: Reworked
+ combobox layout.
+
+2007-10-26 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5b2 TAGGED FOR RELEASE ***
+
+ * changes: Update changes for 8.5b2 release.
+
+ * doc/*.1: Revert doc changes that broke
+ * doc/*.3: `make html` so we can get the release
+ * doc/*.n: out the door.
+
+ * README: Bump version number to 8.5b2.
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+2007-10-26 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): fix window class
+ of transient toplevels that are not also overrideredirect. [Bug
+ 1816252]
- * library/demos/widget: increase height of main window text
- widget to use more of the available
- vertical space.
+ * macosx/tkMacOSXDialog.c: TIP#242 cleanup.
+ * library/demos/filebox.tcl: demo TIP#242 -typevariable.
+
+2007-10-25 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkNotebook.c: [Bug 1817596]
+
+2007-10-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/getOpenFile.n: TIP#242 implementation of -typevariable to
+ * library/tkfbox.tcl: return type of selected file in file dialogs.
+ * library/xmfbox.tcl: [Bug 1156388]
+ * macosx/tkMacOSXDialog.c:
+ * tests/filebox.test:
+ * tests/winDialog.test:
+ * win/tkWinDialog.c:
+
+2007-10-25 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkPlace.c: Prevent segfault in place geometry manager.
+ Thanks to Colin McDonald. [Bug 1818491]
+
+2007-10-24 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/*.c, win/{ttkWinMonitor,ttkWinTheme,ttkWinXPTheme}.c,
+ * macosx/ttkMacOSXTheme.c: Move widget layout registration
+ from TtkElements_Init() to widget *_Init() routines.
+ Renaming/consistency: s/...ElementGeometry()/...ElementSize()/
+
+2007-10-24 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/*.n, doc/*.3, doc/*.1: Lots of changes to take advantage of the
+ new macros.
+
+2007-10-24 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinDraw.c: Applied [Patch 1723362] for transparent bitmaps.
+
+ * generic/tkWindow.c: permit wm manage of any widget (esp: ttk::frame)
+
+2007-10-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/combobox.tcl (ttk::combobox::PopdownWindow): redo wm
+ transient on each drop to handle reparent-able frames. [Bug 1818441]
+
+2007-10-23 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: [namespace import ::ttk::scrollbar]
+ doesn't work, since ttk::scrollbar isn't [namespace export]ed.
+
+2007-10-23 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/cursor.test: Make tests robust against changes in Tcl's
+ rules for accepting integers in octal format.
+
+2007-10-23 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * doc/font.n: Added section on the TIP#145 fonts.
+
+2007-10-23 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinFont.c: Fixed leak in CreateNamedFont spotted by das.
+
+2007-10-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/demos/combo.tcl: Aqua GOOBE.
+ * library/demos/toolbar.tcl:
+ * library/demos/tree.tcl:
+ * library/demos/ttknote.tcl:
+ * library/demos/ttkprogress.tcl:
+ * library/demos/widget:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-10-22 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/widget: Added more demos, reorganized to make Tk and
+ Ttk demos seem to be more coherent whole. Made localization a bit
+ easier by reducing the amount of duplication.
+ * library/demos/{combo,toolbar,tree,ttknote,ttkprogress}.tcl: New
+ demos of new (mostly) Ttk widgets.
+ * library/demos/ttkbut.tcl: Improvements.
+
+2007-10-22 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: ttk::combobox overhaul; fixes [Bugs
+ 1814778, 1780286, 1609168, 1349586]
+ * library/ttk/aquaTheme.tcl: Factored out aqua-specific combobox
+ -postposition adjustments.
+ * generic/ttk/ttkTrack.c: Detect [grab]s and unpress pressed
+ element; combobox workaround no longer
+ needed.
+
+2007-10-22 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXFont.c: register named fonts for TIP #145 fonts
+ and all theme font IDs.
+
+ * generic/tkFont.c (Tk{Create,Delete}NamedFont): allow NULL interp.
+
+ * library/ttk/fonts.tcl: check for TIP #145 fonts on all
+ platforms; correct aqua font sizes.
+
+ * library/demos/ttkmenu.tcl: Aqua GOOBE.
+ * library/demos/ttkpane.tcl:
+ * library/demos/widget:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-10-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/ttkmenu.tcl: Added more demos of Ttk widgets. These
+ * library/demos/ttkpane.tcl: ones are of menubuttons, panedwindows and
+ a progress bar (indirectly).
+
+2007-10-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/fonts.tcl: Create all the TIP #145 font names on all
+ platforms (mac and unix get handled in script, windows in C)
+
+2007-10-17 David Gravereaux <davygrvy@pobox.com>
+
+ * bitmaps/*.xbm: Changed CVS storage mode from -kb to -kkv as these
+ are really text files, not binaries.
+ * win/makefile.vc: Added $(BITMAPDIR) to the search path for the
+ depend target.
+
+2007-10-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/demos/widget: Aqua GOOBE, cleanup icons.
+ * library/demos/ttkbut.tcl:
+ * library/demos/entry3.tcl:
+ * library/demos/msgbox.tcl:
+
+ * library/demos/button.tcl: restore setting of button
+ highlightbackground on Aqua.
+
+ * macosx/ttkMacOSXTheme.c: adjust button and separator geometry.
+
+ * macosx/tkMacOSXWm.c: fix warnings.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-10-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/ttkbut.tcl: Added demo of the basic Ttk widgets.
+
+2007-10-16 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: depend target now works and builds a generated
+ dependency list with $(TCLTOOLSDIR)/mkdepend.tcl
+
+2007-10-16 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/widget: Made the code for generating the contents of
+ the main widget more informative. Added 'new' flagging for wholly new
+ demos.
+
+ * doc/text.n: Made it clearer what things are text widget invokations
+ and what are not. Also some other clarity improvements.
+
+2007-10-15 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/widget: Use Ttk widgets for the widget demo core, for
+ vastly improved look-and-feel on at least one platform (Windows).
+ * library/demos/{button,check,style,twind}.tcl: Various tweaks for
+ GOOBE...
+ * library/demos/textpeer.tcl: New demo script to show off peering as a
+ specific feature.
+
+2007-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkFocus.c, generic/tkFrame.c, generic/tkInt.h:
+ * macosx/tkMacOSXButton.c, macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXWm.c, unix/tkUnixWm.c, win/tkWinWm.c:
+ * doc/wm.n, tests/wm.test: TIP #125 implementation [Bug 998125]
+ Adds [wm manage|forget] for dockable frames.
+ Finished X11 and Windows code, needs OS X completion.
+
+2007-10-15 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c: Store pointer to column table entry
+ instead of column index in columnNames hash table. This avoids the
+ need for the evil PTR2INT and INT2PTR macros, and simplifies things a
+ bit.
+
+2007-10-15 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkArgv.c: Fix gcc warnings about 'cast to/from
+ * generic/tkCanvUtil.c: pointer from/to integer of different
+ * generic/tkCanvas.c: size' on 64-bit platforms by casting
+ * generic/tkCursor.c: to intermediate types
+ * generic/tkInt.h: intptr_t/uintptr_t via new PTR2INT(),
+ * generic/tkListbox.c: INT2PTR(), PTR2UINT() and UINT2PTR()
+ * generic/tkObj.c: macros.
+ * generic/tkStyle.c:
+ * generic/tkTextIndex.c:
+ * generic/tkUtil.c:
+ * generic/ttk/ttkTheme.h:
+ * generic/ttk/ttkTreeview.c:
+ * unix/tkUnixMenu.c:
+ * unix/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * macosx/Wish-Common.xcconfig: add 'tktest-X11' target.
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/Wish.xcodeproj/default.pbxuser:
+ * macosx/Wish.xcodeproj/project.pbxproj:
+
+ * unix/configure.in (Darwin): add support for 64-bit X11.
+ * unix/configure: autoconf-2.59
+
+2007-10-14 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure, win/configure.in (TK_WIN_VERSION): Make sure the
+ patchlevel doesn't contain extra dotted pairs (eg. interim release)
+
+2007-10-12 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Mine all version information from headers.
+ * win/rules.vc: Sync tcl and tk and bring extension versions
+ * win/nmakehlp.c: closer together. Try and avoid using tclsh
+ to do substitutions as we may cross compile.
+
+ * library/console.tcl: Use TkFixedFont and ttk widgets
+
+2007-10-12 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXDraw.c: replace all (internal) use of QD region
* macosx/tkMacOSXSubwindows.c: API by HIShape API, with conversion to
@@ -537,6 +2903,7 @@
* macosx/tkMacOSXEntry.c: return boolean indicating whether
* macosx/tkMacOSXFont.c: drawing is allowed (and was setup) or
* macosx/tkMacOSXMenu.c: not (e.g. when clipRgn is empty).
+ * macosx/ttkMacOSXTheme.c:
* macosx/tkMacOSXSubwindows.c: signal that drawable is a pixmap via
* macosx/tkMacOSXInt.h: new explicit TK_IS_PIXMAP flag instead
@@ -555,29 +2922,14 @@
* macosx/tkMacOSXButton.c: delay picParams setup until needed.
-2007-10-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/entry.tcl: don't error with Clear event. [Bug 1509288]
-
-2007-10-26 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): fix window class of
- transient toplevels that are not also overrideredirect. [Bug 1816252]
-
- * macosx/tkMacOSXDialog.c: sync with HEAD.
-
- * unix/configure.in (Darwin): add support for 64-bit X11.
- * unix/configure: autoconf-2.13
-
-2007-10-25 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkPlace.c: Prevent segfault in place geometry manager.
- Thanks to Colin McDonald. [Bug 1818491]
+ * generic/tkTextDisp.c (CharUndisplayProc): fix textDisp.test crash.
-2007-10-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2007-10-11 David Gravereaux <davygrvy@pobox.com>
- * library/msgs/hu.msg: Added message catalog for Hungarian.
- [Patch 1800742] (rezso)
+ * win/winMain.c: Replaced incorrect comments in main() to descibe
+ why the console widget does not need to be created for this
+ application entry point (if used). Must have been a bad copy/paste
+ of WinMain() from 10 years back.
2007-10-11 Daniel Steffen <das@users.sourceforge.net>
@@ -585,56 +2937,212 @@
limitBounds to maxBounds, works around SectRect() mis-feature (return
zero rect if input rect has zero height/width). [Bug 1810818]
+2007-10-09 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkImage.c: Make Ttk_GetImage safe if called with NULL
+ * tests/ttk/image.test: interp. Added some tests that crash
+ on Windows without this fix.
+
2007-10-02 Don Porter <dgp@users.sourceforge.net>
- * README: Bump version number to 8.4.17
+ [core-stabilizer-branch]
+
+ * README: Bump version number to 8.5.0
* generic/tk.h:
- * unix/configure.in: Removed "es_ES" entry in LOCALES
+ * library/tk.tcl:
+ * unix/configure.in: Updated LOCALES.
* unix/tk.spec:
* win/configure.in:
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf (2.59)
* win/configure:
-2007-09-18 Daniel Steffen <das@users.sourceforge.net>
+2007-09-30 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/entry.tcl (WordBack, WordForward):
+ Fix private routines accidentally defined in global namespace
+ [Bug 1803836]
+
+2007-09-26 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/msgs/hu.msg: Added Hungarian message set, from Pader Reszo.
+ [Patch 1800742]
- *** 8.4.16 TAGGED FOR RELEASE ***
+2007-09-20 Donal K. Fellows <dkf@users.sf.net>
- * changes: updates for 8.4.16 release.
+ *** 8.5b1 TAGGED FOR RELEASE ***
+
+ * generic/tkTextDisp.c (LayoutDLine): Only call callbacks that are
+ * tests/textDisp.test (textDisp-32.3): not NULL. [Bug 1791052]
+
+2007-09-20 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: updates for 8.5b1 release.
+
+2007-09-19 Don Porter <dgp@users.sourceforge.net>
+
+ * README: Bump version number to 8.5b1.
+ * generic/tk.h: Merge from core-stabilizer-branch.
+ * library/tk.tcl: Stabilizing toward 8.5b1 release now done
+ * unix/configure.in: on the HEAD. core-stabilizer-branch is
+ * unix/tk.spec: now suspended.
+ * win/configure.in:
+
+2007-09-19 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkStubLib.: Replaced isdigit with internal implementation.
+
+2007-09-18 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkStubLib.c: Remove C library calls from Tk_InitStubs()
+ * win/makefile.vc: so that we don't need the C library linked
+ in to libtkStub.
+
+2007-09-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgGIF.c (FileReadGIF, StringReadGIF): Rewrite for greater
+ clarity (more comments, saner code arrangement, etc.)
+
+2007-09-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/all.tcl: Made ttk/all.tcl be the same as tk's all.tcl and
+ * tests/ttk/all.tcl: make use of file normalize (bugs noted by
+ mjanssen and GPS with msys)
+
+2007-09-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Add crt flags for tkStubLib now it uses C-library
+ functions.
+
+2007-09-17 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tcl.m4: use '${CC} -shared' instead of 'ld -Bshareable' to
+ build shared libraries on current NetBSDs. [Bug 1749251]
+ * unix/configure: regenerated (autoconf-2.59).
+
+2007-09-17 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Revised callers of Tcl_InitStubs() to account
+ * generic/tkMain.c: for restored compatible support for the call
+ * generic/tkWindow.c: Tcl_InitStubs(interp, TCL_VERSION, 1). Also
+ revised Tcl_PkgRequire() call for Tcl so that, for example, a Tk
+ library built against Tcl 8.5.1 headers will not refuse to [load] into
+ a Tcl 8.5.0 interpreter. [Tcl Bug 1578344]
+
+ * generic/tk.h: Revised Tk_InitStubs() to restore Tk 8.4
+ * generic/tkStubLib.c: source compatibility with callers of
+ * generic/tkWindow.c: Tk_InitStubs(interp, TK_VERSION, 1).
+
+2007-09-17 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: Try to improve combobox appearance on
+ OSX + Tk 8.5. [Bug 1780286]
2007-09-15 Daniel Steffen <das@users.sourceforge.net>
- * unix/tcl.m4 (SunOS-5.1x): replace direct use of '/usr/ccs/bin/ld'
- in SHLIB_LD by 'cc' compiler driver.
- * unix/configure: autoconf-2.13
+ * unix/tcl.m4: replace all direct references to compiler by ${CC} to
+ enable CC overriding at configure & make time; run
+ check for visibility "hidden" with all compilers;
+ quoting fixes from TEA tcl.m4.
+ (SunOS-5.1x): replace direct use of '/usr/ccs/bin/ld' in SHLIB_LD by
+ 'cc' compiler driver.
+ * unix/configure: autoconf-2.59
+
+2007-09-14 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish-Common.xcconfig: enable Tcl DTrace support.
+ * macosx/Wish.xcodeproj/project.pbxproj:
+
+2007-09-12 Andreas Kupries <andreask@activestate.com>
+
+ * win/Makefile.in (install-binaries): Fixed missing brace in the
+ * win/makefile.vc (install-binaries): generated package index file.
+ Note: unix/Makefile.in is good.
2007-09-11 Reinhard Max <max@suse.de>
* generic/tkImgGIF.c: Fixed a buffer overrun that got triggered by
- multi-frame interlaced GIFs that contain subsequent frames that
- are smaller than the first one.
+ multi-frame interlaced GIFs that contain subsequent frames that are
+ smaller than the first one.
* tests/imgPhoto.test: Added a test for the above.
-2007-09-11 Daniel Steffen <das@users.sourceforge.net>
+2007-09-11 Don Porter <dgp@users.sourceforge.net>
- * unix/configure.in: backport of TK_INCLUDE_SPEC addition.
- * unix/tkConfig.sh.in: [Bug 777203]
- * unix/configure: autoconf-2.13
+ * generic/tkConsole.c: Revised calls to Tcl_InitStubs() and
+ * generic/tkMain.c: [package require Tcl] so that Tk Says What It
+ * generic/tkWindow.c: Means using the new facilties of [package] in
+ * library/tk.tcl: Tcl 8.5 about what version(s) of Tcl it is
+ * unix/Makefile.in: willing to work with. [Bug 1578344]
+ * win/Makefile.in:
+ * win/makefile.vc:
-2007-09-11 Pat Thoyts <patthoyts@users.sourceforge.net>
+2007-09-10 Jeff Hobbs <jeffh@ActiveState.com>
- * win/makefile.vc: Fix for AMD64 symbols target builds.
- * win/rules.vc:
+ * unix/README: typo corrections [Bug 1788682]
+
+2007-09-10 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Revise all Tcl_InitStubs() calls to restore
+ * generic/tkMain.c: the traditional practice that a Tk shared
+ * generic/tkWindow.c: library may [load] into a Tcl 8.5 interp at
+ any patchlevel. This practice also matches the compile time checks of
+ TCL_MAJOR_VERSION and TCL_MINOR_VERSION in tk.h. [Bug 1723622]
+
+2007-09-06 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkWindow.c (Initialize): Moved common Tk initialization
+ * generic/tkInitScript.h (removed): script out of tkInitScript.h
+ * macosx/tkMacOSXInit.c: and multiple TkpInit() routines and
+ * unix/Makefile.in: into the common Initialize() routine in
+ * unix/tkUnixInit.c: generic code. Also removed constraint on
+ * win/tkWinInit.c: ability to define a custom [tkInit] before
+ calling Tk_Init(). Until now the custom [tkInit] had to be a proc. Now
+ it can be any command. Removal of tkInitScript.h also fixes [Bug
+ 1656283].
+
+2007-09-06 Daniel Steffen <das@users.sourceforge.net>
-2007-09-05 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * macosx/Wish.xcode/project.pbxproj: discontinue unmaintained support
+ * macosx/Wish.xcode/default.pbxuser: for Xcode 1.5; replace by Xcode2
+ project for use on Tiger (with Wish.xcodeproj to be used on Leopard).
- * win/rc/tk_base.rc: Backported the BASE_NO_TK_ICON patch to assist in
- creating tclkits and/or basekits with corrent resources.
+ * macosx/Wish.xcodeproj/project.pbxproj: updates for Xcode 2.5 and 3.0.
+ * macosx/Wish.xcodeproj/default.pbxuser:
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/Wish-Common.xcconfig:
-2007-09-04 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * macosx/README: document project changes.
- * tests/wm.test: -transparentcolor added to windows wm attributes tests
+2007-09-04 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkTest.c: Fix for [Bug 1788019] "tkTest.c compiler warning".
+
+2007-09-04 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: It's unreliable to count on the release
+ manager to remember to `make genstubs` before `make dist`. Let the
+ Makefile remember the dependency for us.
+
+ * unix/Makefile.in: Corrections to `make dist` dependencies to be
+ sure that macosx/configure gets generated whenever it does not exist.
+
+2007-09-03 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/ttk/ttkInit.c (Ttk_Init): register ttk in package database
+ to enable extension access to the ttkStubs table.
+
+ * generic/ttk/ttkDecls.h: correct capitalization of ttk package name.
+
+2007-08-28 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ Assorted documentation improvements.
+ * doc/button.n: Added examples.
+ * doc/checkbutton.n: Added example.
+ * doc/console.n: Standardized section ordering.
+ * doc/tk.n: Added "See also".
+ * doc/ttk_combobox.n: Added keywords.
2007-08-27 Daniel Steffen <das@users.sourceforge.net>
@@ -642,80 +3150,107 @@
interp result [Bug 1782105]; fix -initialcolor overwriting last color
selection; style cleanup.
+2007-08-21 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/rules.vc: Synchronize with tcl rules.vc
+ * tests/all.tcl: Fix the line-endings.
+
2007-08-07 Daniel Steffen <das@users.sourceforge.net>
- * unix/Makefile.in: add support for compile flags specific to
+ * unix/Makefile.in: Add support for compile flags specific to
object files linked directly into executables.
- * unix/configure.in (Darwin): only use -seg1addr flag when prebinding;
+ * unix/configure.in (Darwin): Only use -seg1addr flag when prebinding;
use -mdynamic-no-pic flag for object files linked directly into exes.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+2007-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinDialog.c: Fix [Bug 1692927] (buffer length problems)
+ * win/tkWinTest.c: Added 'testfindwindow' and 'testgetwindowinfo'
+ and extended 'testwinevent' for WM_COMMAND support to enable testing
+ native messagebox dialogs.
+ * tests/winMsgbox.test: New Windows native messagebox tests.
2007-07-25 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXDialog.c (NavServicesGetFile): reset interp result on
+ * macosx/tkMacOSXDialog.c (NavServicesGetFile): Reset interp result on
nav dialog cancel. [Bug 1743786]
+2007-07-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in: clarify what the headers installed are, and
+ add ttkTheme.h and ttkDecls.h to private headers (later public).
+
2007-07-09 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXWindowEvent.c (Tk_MacOSXIsAppInFront): use process mgr
+ * macosx/tkMacOSXWindowEvent.c (Tk_MacOSXIsAppInFront): Use process mgr
* macosx/tkMacOSXMouseEvent.c: to determine if
app is in front instead of relying on activate/deactivate events (which
may arrive after this info is needed, e.g. during window drag/click
activation); replace other process mgr use to get this info with calls
to Tk_MacOSXIsAppInFront().
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): correct
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): Correct
window click activation, titlebar click handling and background window
dragging/growing in the presence of grabs or window-/app-modal windows;
fix window click activation bringing all other app windows to front.
- * macosx/tkMacOSXDraw.c (TkPutImage): handle non-native XImage byte and
+ * macosx/tkMacOSXDraw.c (TkPutImage): Handle non-native XImage byte and
bit orders; reverse bits via xBitReverseTable instead of InvertByte().
-2007-07-04 Jeff Hobbs <jeffh@ActiveState.com>
+2007-07-06 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/aquaTheme.tcl: Set -anchor w for TMenubuttons.
+ [Bug 1614540]
- * macosx/tkMacOSXXStubs.c (DestroyImage): Fixed crash in release
- of image data for images coming from XGetImage, introduced
- 2007-06-23. (das)
+2007-07-04 Andreas Kupries <andreask@activestate.com>
+
+ * macosx/tkMacOSXXStubs.c (DestroyImage): Fixed seg.fault in release
+ of image data for images coming from XGetImage. Change committed by me
+ for Daniel Steffen. See 2007-06-23 for the change which introduced the
+ problem.
2007-07-02 Daniel Steffen <das@users.sourceforge.net>
- * xlib/xgc.c (XCreateGC): correct black and white pixel values used to
+ * xlib/xgc.c (XCreateGC): Correct black and white pixel values used to
initialize GC foregrund and background fields.
- * macosx/tkMacOSXColor.c: add debug messages for unknown pixel values.
+ * macosx/tkMacOSXColor.c: Add debug messages for unknown pixel values.
- * macosx/tkMacOSXDraw.c (TkMacOSXRestoreDrawingContext): don't restore
+ * macosx/tkMacOSXDraw.c (TkMacOSXRestoreDrawingContext): Don't restore
port state if it wasn't altered by TkMacOSXSetupDrawingContext().
2007-06-29 Daniel Steffen <das@users.sourceforge.net>
- * xlib/ximage.c: bitmaps created from the static .bmp
+ * xlib/ximage.c: Bitmaps created from the static .xbm
arrays always have LSBFirst bit order.
- * macosx/tkMacOSXScrlbr.c: correct int <-> dobule conversion issues
+ * unix/configure.in: Fix flag used to weak-link libXss.
+ * unix/configure: autoconf-2.59
+
+ * macosx/tkMacOSXScrlbr.c: Correct int <-> dobule conversion issues
that could lead to Carbon getting confused about scrollbar thumb size.
- * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage) use
+ * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage): Use
TkMacOSX{Setup,Restore}DrawingContext() to setup/restore clip & colors.
- (TkMacOSXSetupDrawingContext, TkMacOSXRestoreDrawingContext): add save
+ (TkMacOSXSetupDrawingContext, TkMacOSXRestoreDrawingContext): Add save
and restore of QD port clip region; factor out clip region code common
to CG and QD branches; check for port and context validity; handle
tkPictureIsOpen flag during QD port setup.
- (TkScrollWindow): remove unnecessary scroll region manipulation
+ (TkScrollWindow): Remove unnecessary scroll region manipulation
- * macosx/tkMacOSXDraw.c: remove second global QD temp region
+ * macosx/tkMacOSXDraw.c: Remove second global QD temp region
* macosx/tkMacOSXInt.h: (no longer necessary) and rename
* macosx/tkMacOSXRegion.c: remaining global QD temp region.
* macosx/tkMacOSXSubwindows.c:
* macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXDraw.c: make useCGDrawing variable MODULE_SCOPE
- * macosx/tkMacOSXFont.c: and sync formatting with HEAD.
+ * macosx/tkMacOSXDraw.c: Make useCGDrawing variable MODULE_SCOPE
+ * macosx/tkMacOSXFont.c: and respect it for ATSUI font drawing.
- * macosx/tkMacOSXButton.c: reduce reliance on current QD port
+ * macosx/tkMacOSXButton.c: Reduce reliance on current QD port
* macosx/tkMacOSXColor.c: setting and remove unnecessary
* macosx/tkMacOSXDebug.c: references to a drawable's QD port,
* macosx/tkMacOSXDebug.h: notably replace GetWindowFromPort(
@@ -731,7 +3266,7 @@
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXInt.h: factor out macros, declarations
+ * macosx/tkMacOSXInt.h: Factor out macros, declarations
* macosx/tkMacOSXPrivate.h (new): and prototypes that are purely
internal and private to the 'macosx' sources into a new internal header
file that does _not_ get installed into Tk.framework/PrivateHeaders.
@@ -762,35 +3297,77 @@
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXXStubs.c:
+ * macosx/ttkMacOSXTheme.c:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Improve support for renamed
+ * macosx/Wish.xcodeproj/default.pbxuser: tcl and tk source dirs; add
+ * macosx/Wish-Common.xcconfig: 10.5 SDK build config; remove
+ tclMathOp.c.
+
+ * macosx/README: Document Wish.xcodeproj changes.
2007-06-23 Daniel Steffen <das@users.sourceforge.net>
* generic/tkImgPhoto.c (ImgPhotoConfigureInstance, DisposeInstance):
- use XDestroyImage instead of XFree to destroy XImage; replace runtime
+ Use XDestroyImage instead of XFree to destroy XImage; replace runtime
endianness determination by compile-time check for WORDS_BIGENDIAN.
- * xlib/ximage.c (XCreateBitmapFromData): use XCreateImage and
+ * xlib/ximage.c (XCreateBitmapFromData): Use XCreateImage and
XDestroyImage instead of creating XImage structure manually.
- * macosx/tkMacOSXXStubs.c (XCreateImage, DestroyImage): correct XImage
+ * macosx/tkMacOSXXStubs.c (XCreateImage, DestroyImage): Correct XImage
bytes_per_line/bitmap_pad calculations and endianness setting; free
image data and XImage structure at destruction; formatting cleanup.
- * macosx/tkMacOSXDialog.c (NavServicesGetFile): disable app-modal
+ * macosx/tkMacOSXDialog.c (NavServicesGetFile): Disable app-modal
sheet variant of nav dialog on OS versions where it causes problems.
+2007-06-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/ttk.tcl: Should require Tk before pseudo-providing
+ tile 0.8.0.
+
+2007-06-09 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkPanedwindow.c, doc/ttk_panedwindow.n,
+ * tests/ttk/panedwindow.test: Added -width and -height options. Added
+ 'panes' method, return list of managed windows. 'sashpos' method is
+ now documented as part of the public interface, and details clarified.
+ Should be easier to set initial sash positions now. Alleviates [Bug
+ 1659067].
+
2007-06-09 Jeff Hobbs <jeffh@ActiveState.com>
* win/tkWinWm.c (WmIconphotoCmd): fix wm iconphoto RGBA issues.
[Bug 1467997] (janssen)
- * win/tkWinMenu.c (TkWinHandleMenuEvent): improve handling to
- allow for unicode char menu indices and not use CharUpper on Tcl
- utf strings. [Bug 1734223]
+ * win/tkWinMenu.c (TkWinHandleMenuEvent): Improve handling to allow
+ for unicode char menu indices and not use CharUpper on Tcl utf
+ strings. [Bug 1734223]
+
+2007-06-09 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkManager.h, generic/ttk/ttkManager.c,
+ * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c,
+ * generic/ttk/ttkFrame.c: Ttk_Manager API overhaul:
+ + Ttk_Manager no longer responsible for managing slave records
+ + Ttk_Manager structure now opaque
+ + Ttk_Slave structure now private
+ + Pass Ttk_Manager* to Tk_GeomMgr hooks instead of Ttk_Slave*
+
+ * generic/ttk/ttkFrame.c: Simplified -labelwidget management.
+
+ * doc/ttk_panedwindow.n, library/ttk/panedwindow.tcl: Changed
+ documentation of ttk::panedwindow 'identify' command to match
+ implementation.
+
+ * generic/ttk/ttkNotebook.c, tests/ttk/notebook.test:
+ BUGFIX: ttk::noteboook 'insert' command didn't correctly maintain
+ current tab.
2007-06-09 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXColor.c: fix issues with TK_{IF,ELSE,ENDIF} macros;
+ * macosx/tkMacOSXColor.c: Fix issues with TK_{IF,ELSE,ENDIF} macros;
* macosx/tkMacOSXDraw.c: implement Jaguar equivalent of unavailable
* macosx/tkMacOSXEntry.c: kHIToolboxVersion global; panic at startup
* macosx/tkMacOSXEvent.c: if MAC_OS_X_VERSION_MIN_REQUIRED constraint
@@ -799,28 +3376,36 @@
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage)
- (TkMacOSXSetupDrawingContext): factor out common code and standardize
+ (TkMacOSXSetupDrawingContext): Factor out common code and standardize
setup/restore of port, context and clipping; formatting cleanup.
- * macosx/tkMacOSXWindowEvent.c: add error checking.
- * macosx/tkMacOSXMenu.c: fix gcc3 warning.
- * macosx/tkMacOSXScrlbr.c: fix testsuite crash.
- * macosx/tkMacOSXSubwindows.c: formatting cleanup.
- * macosx/tkMacOSXRegion.c: fix typos.
+ * macosx/tkMacOSXWindowEvent.c: Add error checking.
+ * macosx/tkMacOSXMenu.c: Fix gcc3 warning.
+ * macosx/tkMacOSXScrlbr.c: Fix testsuite crash.
+ * macosx/tkMacOSXSubwindows.c: Formatting cleanup.
+ * macosx/tkMacOSXRegion.c: Fix typos.
* macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXXStubs.c (Tk_GetUserInactiveTime): Remove superfluous
+ CFRetain/CFRelease.
+
+ * macosx/Wish-Release.xcconfig: Disable tktest release build stripping.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add new Tclsh-Info.plist.in.
+
2007-06-06 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXInt.h: use native debug message API when available.
+ * macosx/tkMacOSXInt.h: Use native debug message API when available.
+ * macosx/Wish-Debug.xcconfig:
- * macosx/tkMacOSXMouseEvent.c (GenerateMouseWheelEvent): enable
+ * macosx/tkMacOSXMouseEvent.c (GenerateMouseWheelEvent): Enable
processing of mousewheel events in background windows.
- * macosx/tkMacOSXScrlbr.c: modernize checks for active/front window.
+ * macosx/tkMacOSXScrlbr.c: Modernize checks for active/front window.
* macosx/tkMacOSXScale.c:
* macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXColor.c: factor out verbose #ifdef checks of
+ * macosx/tkMacOSXColor.c: Factor out verbose #ifdef checks of
* macosx/tkMacOSXDraw.c: MAC_OS_X_VERSION_{MAX_ALLOWED,MIN_REQUIRED}
* macosx/tkMacOSXEntry.c: and runtime checks of kHIToolboxVersion into
* macosx/tkMacOSXEvent.c: new TK_{IF,ELSE,ENDIF}_MAC_OS_X macros.
@@ -828,27 +3413,35 @@
* macosx/tkMacOSXInt.h:
* macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXDraw.c: factor out clip clearing in QD ports;
- * macosx/tkMacOSXEntry.c: formatting cleanup.
+ * macosx/tkMacOSXDraw.c: Factor out clip clearing in QD ports;
+ * macosx/tkMacOSXEntry.c: Formatting cleanup.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add settings for Fix&Continue.
- * unix/configure.in (Darwin): link the Tk and Wish plists into their
+ * unix/configure.in (Darwin): Link the Tk and Wish plists into their
binaries in all cases; fix 64bit arch removal in fat 32&64bit builds.
- * unix/tcl.m4 (Darwin): fix CF checks in fat 32&64bit builds.
- * unix/configure: autoconf-2.13
+ * unix/tcl.m4 (Darwin): Fix CF checks in fat 32&64bit builds.
+ * unix/configure: autoconf-2.59
2007-06-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
* doc/photo.n: Clarified the fact that base64 support for the -data
option is not universal. [Bug 1731348] (matzek)
-2007-06-04 Daniel Steffen <das@users.sourceforge.net>
+2007-06-03 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in: Add datarootdir to silence autoconf-2.6x warning.
+
+ * macosx/Wish.xcodeproj/default.pbxuser: Add ttk tests.
- * macosx/tkMacOSXMenu.c: add error checking; whitespace cleanup.
+ * macosx/tkMacOSXMenu.c: Add error checking; whitespace cleanup.
- * macosx/tkMacOSXDraw.c: sync comment formatting with HEAD.
+ * macosx/tkMacOSXDraw.c: Comment formatting fixes for Xcode 3.0
* macosx/tkMacOSXEmbed.c:
* macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXInit.c:
* macosx/tkMacOSXKeyEvent.c:
* macosx/tkMacOSXKeyboard.c:
* macosx/tkMacOSXMenus.c:
@@ -860,76 +3453,66 @@
2007-06-02 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXMenu.c (TkpPostMenu): ensure cascade menus display in
+ * macosx/tkMacOSXMenu.c (TkpPostMenu): Ensure cascade menus display in
posted menus that are not part of the menubar or attached to a
menubutton (fixes bug reported on tcl-mac by Linus Nyberg).
2007-05-31 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): complete all
+ * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): Complete all
pending idle-time redraws before newly posted Expose events are
- processed; add bounds of redrawn windows to update region to ensure all
- child windows overdrawn by parents are redrawn.
+ processed; add bounds of redrawn windows to update region to ensure
+ all child windows overdrawn by parents are redrawn.
- * macosx/tkMacOSXWindowEvent.c: centralize clip and window invalidation
+ * macosx/tkMacOSXWindowEvent.c: Centralize clip and window invalidation
* macosx/tkMacOSXSubwindows.c: after location/size changes in the
* macosx/tkMacOSXWm.c: BoundsChanged carbon event handler;
correct/add window invalidation after window attribute changes.
- * macosx/tkMacOSXSubwindows.c (XResizeWindow, XMoveResizeWindow,
- XMoveWindow): factor out common code dealing with embedded and
+ * macosx/tkMacOSXSubwindows.c (XResizeWindow, XMoveResizeWindow)
+ (XMoveWindow): Factor out common code dealing with embedded and
non-toplevel windows; remove unnecessary clip and window invalidation.
- * macosx/tkMacOSXButton.c (TkpDisplayButton): move clip setup closer to
- native button drawing calls.
+ * macosx/tkMacOSXButton.c (TkpDisplayButton): Move clip setup closer
+ to native button drawing calls.
* macosx/tkMacOSXWm.c (TkMacOSXIsWindowZoomed, TkMacOSXZoomToplevel):
- correct handling of gridded windows in max size calculations.
+ Correct handling of gridded windows in max size calculations.
- * macosx/tkMacOSXEvent.c (TkMacOSXFlushWindows): use HIWindowFlush API
+ * macosx/tkMacOSXEvent.c (TkMacOSXFlushWindows): Use HIWindowFlush API
when available.
- * macosx/tkMacOSXColor.c: cleanup whitespace and formatting.
+ * macosx/tkMacOSXColor.c: Cleanup whitespace and formatting.
* macosx/tkMacOSXDraw.c:
* macosx/tkMacOSXSubwindows.c:
* macosx/tkMacOSXWm.c:
* generic/tkFont.c: #ifdef out debug msg printing to stderr.
+ * generic/tkTextDisp.c:
2007-05-30 Don Porter <dgp@users.sourceforge.net>
- * generic/tk.h: Correct placement of #include <tcl.h> [Bug 1723812].
-
- * README: Bump version number to 8.4.16
- * generic/tk.h:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
-
- * unix/configure: autoconf-2.13
- * win/configure:
+ * generic/tk.h: Correct placement of #include <tcl.h>. [Bug 1723812]
2007-05-30 Daniel Steffen <das@users.sourceforge.net>
- * library/bgerror.tcl: standardize dialog option & button size
+ * library/bgerror.tcl: Standardize dialog option & button size
* library/dialog.tcl: modifications done when running on on Aqua.
* library/msgbox.tcl:
- * library/demos/button.tcl: set button highlightbackground on Aqua.
-
- * generic/tkFileFilter.c (AddClause): fix warning.
+ * library/demos/button.tcl: Set button highlightbackground on Aqua.
- * macosx/tkMacOSXMenu.c (DrawMenuSeparator): use DrawingContext API.
+ * macosx/tkMacOSXMenu.c (DrawMenuSeparator): Use DrawingContext API.
- * macosx/tkMacOSXWindowEvent.c (ClearPort): clip to updateRgn.
+ * macosx/tkMacOSXWindowEvent.c (ClearPort): Clip to updateRgn.
- * macosx/tkMacOSXDebug.c: factor out debug region flashing.
+ * macosx/tkMacOSXDebug.c: Factor out debug region flashing.
* macosx/tkMacOSXDebug.h:
* macosx/tkMacOSXDraw.c:
* macosx/tkMacOSXSubwindows.c:
* macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXEvent.c: cleanup whitespace and formatting.
+ * macosx/tkMacOSXEvent.c: Cleanup whitespace and formatting.
* macosx/tkMacOSXFont.c:
* macosx/tkMacOSXRegion.c:
* macosx/tkMacOSXSubwindows.c:
@@ -938,77 +3521,306 @@
* macosx/tkMacOSXXStubs.c:
* xlib/xgc.c:
-2007-05-25 Don Porter <dgp@users.sourceforge.net>
+ * macosx/Wish.xcodeproj/project.pbxproj: Delete references to removed
+ * macosx/Wish.xcodeproj/default.pbxuser: ttk files.
+
+2007-05-28 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix short measures
+ with flags=TK_WHOLE_WORDS|TK_AT_LEAST_ONE [Bug 1716141]. Make some
+ casts unnecessary by changing variable types.
+
+2007-05-25 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl: Omit ttk::dialog and dependencies.
+ * library/ttk/dialog.tcl, library/ttk/icons.tcl,
+ * library/ttk/keynav.tcl: Removed.
+ * tests/ttk/misc.test: Removed.
+ * doc/ttk_dialog.tcl: Removed.
+
+2007-05-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/canvas.n: Fixed documentation of default -joinstyle option
+ values for line and polygon items. [Bug 1725782]
+
+2007-05-22 Don Porter <dgp@users.sourceforge.net>
+
+ [core-stabilizer-branch]
+
+ * unix/configure: autoconf-2.59 (FC6 fork)
+ * win/configure:
+
+ * README: Bump version number to 8.5b1
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+2007-05-18 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkEntry.c(EntrySetValue): Ensure that widget is in a
+ consistent state before setting the linked -textvariable. Previously,
+ it was possible for [$e index insert] to point past the end of the
+ string, leading to heap corruption. [Bug 1721532]
+ * tests/ttk/entry.test(entry-9.1): Add test case for the above.
+
+2007-05-18 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/configure: autoconf-2.59 (FC6 fork)
+ * win/configure:
+
+ * README: Bump version number to 8.5a7
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * tests/ttk/treetags.test: Another bit of test suite
+ SCIM-tolerance. [Bug 1609316]
+
+2007-05-17 Daniel Steffen <das@users.sourceforge.net>
- *** 8.4.15 TAGGED FOR RELEASE ***
+ * generic/tk.decls: Workaround 'make checkstubs' failures from
+ tkStubLib.c MODULE_SCOPE revert. [Bug 1716117]
- * unix/README: Updates and typo corrections. [Bug 1724841]
+ * macosx/Wish.xcodeproj/project.pbxproj: Add tkOldTest.c and remove
+ tkStubImg.c.
+
+2007-05-16 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkStubLib.c: Change Tk_InitStubs(), tkStubsPtr, and the
+ auxilliary stubs table pointers back to public visibility. See [Bug
+ 1716117] for details.
+
+ Removed TCL_STORAGE_CLASS monkey business, as it had no effect.
2007-05-16 Don Porter <dgp@users.sourceforge.net>
- * tests/bind.test: Make test suite more SCIM-tolerant [Bug 1609316]
+ * library/choosedir.tcl: Removed uses of obsolete {expand}
+ * library/comdlg.tcl: syntax; replaced with the now
+ * library/tk.tcl: approved {*}. [Bug 1710633]
+ * tests/canvImg.test:
+ * tests/imgPhoto.test:
+
+ * tests/bind.test: Make test suite more SCIM-tolerant. [Bug 1609316]
-2007-05-15 Don Porter <dgp@users.sourceforge.net>
+2007-05-16 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Test ttk widgets.
+
+2007-05-15 Joe English <jenglish@users.sourceforge.net>
- * changes: updates for 8.4.15 release.
+ * unix/tkUnixRFont.c: Fix crash introduced by previous fix exposed
+ under newer fontconfig libraries [Bug 1717830] again.
+
+2007-05-15 Don Porter <dgp@users.sourceforge.net>
* generic/tkGrid.c: Stop crash due to list intrep shimmer [Bug 1677608]
+2007-05-15 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Fix various memory leaks. [Bug 1717830], [Bug
+ 800149]
+
+2007-05-14 Don Porter <dgp@users.sourceforge.net>
+
+ [Tk Bug 1712081]
+
+ * unix/Makefile.in: Updates to account for new and deleted files
+ * win/Makefile.in: tkStubImg.c and tkOldTest.c.
+ * win/makefile.bc:
+ * win/makefile.vc:
+
+ * generic/tkOldTest.c (new): New file used to create testing
+ * generic/tkTest.c: commands for testing various Tk
+ * tests/constraints.tcl: legacy interfaces where a separate
+ * tests/image.test: compilation unit is needed in order to
+ #define suitable macros during compilation. Only the effect of
+ USE_OLD_IMAGE on Tk_CreateImageType() is currently tested, but more
+ similar testing commands can be added to this same file. New
+ constraint defined to detect presence of the image type provided by
+ the new testing code, and a few tests added to exercise it. Having
+ USE_OLD_IMAGE support tested by the default test suite should reduce
+ chance of a recurrence of this bug.
+
+ * doc/CrtImgType.3: Revised docs to better indicate the legacy
+ * doc/CrtPhImgFmt.3: nature of the interfaces supported by
+ USE_OLD_IMAGE.
+
+ * generic/tkDecls.h: make genstubs
+ * generic/tkStubInit.c:
+
+ * generic/tk.decls: Reworked USE_OLD_IMAGE support to use
+ * generic/tk.h: the same support mechanisms both with
+ * generic/tkStubImg.c (deleted):and without a stub-enabled build. In
+ each case, route the legacy calls to Tk_CreateImageType and
+ Tk_CreatePhotoImageFormat through the Tk_CreateOldImageType and
+ Tk_CreateOldPhotoImageFormat routines. Add those routines to the
+ public stub table so they're available to a stub-enabled extension.
+ Remove the definition of Tk_InitImageArgs() and use a macro to convert
+ any calls to it in source code into a comment.
+
+ * generic/tkImage.c: Removed the MODULE_SCOPE declarations that
+ * generic/tkImgPhoto.c: broke USE_OLD_IMAGE support.
+
+2007-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/winButton.test: Avoid font dependencies in results.
+
+ * generic/tkFont.c: propagate error from TkDeleteNamedFont. [Bug
+ 1716613]
+
2007-05-09 Daniel Steffen <das@users.sourceforge.net>
* generic/tkFileFilter.c (AddClause): OSType endianness fixes.
- * library/palette.tcl (tk::RecolorTree): handle color options with
+ * library/palette.tcl (tk::RecolorTree): Handle color options with
empty value, fixes error due to emtpy -selectforeground (reported on
tcl-mac by Russel E. Owen).
- * macosx/tkMacOSXWindowEvent.c: ensure window is brought to the front
+ * macosx/tkMacOSXWindowEvent.c: Ensure window is brought to the front
* macosx/tkMacOSXMouseEvent.c: at the start of a window drag (except
* macosx/tkMacOSXInt.h: when cmd key is down); formatting and
whitespace fixes.
- * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd): add -filetypes option
- processing.
+ * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd): Add -filetypes option
+ processing (fixes fileDialog-0.1, fileDialog-0.2 failures).
- * macosx/tkMacOSXEmbed.c (TkpMakeWindow, TkpUseWindow): fix sending of
+ * macosx/tkMacOSXEmbed.c (TkpMakeWindow, TkpUseWindow): Fix sending of
Visibility event for embedded windows (fixes frame-3.9 hang).
- * macosx/tkMacOSXScrlbr.c (ScrollbarBindProc): fix testsuite
+ * macosx/tkMacOSXScrlbr.c (ScrollbarBindProc): Fix testsuite
* macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): crashes by
adding sanity checks.
- * macosx/tkMacOSXButton.c: fix debug msg typo.
+ * macosx/Wish.xcodeproj/project.pbxproj: Add 'DebugUnthreaded' &
+ * macosx/Wish.xcodeproj/default.pbxuser: 'DebugLeaks' targets and env
+ var settings needed to run the 'leaks' tool.
+
+ * macosx/tkMacOSXButton.c: Fix debug msg typo.
+
+ * tests/constraints.tcl: Ensure 'nonUnixUserInteraction' constraint is
+ set for aqua.
+
+ * tests/choosedir.test: Add 'notAqua' constraints to X11-only tests;
+ * tests/clrpick.test: add 'nonUnixUserInteraction' to 'unix' tests
+ * tests/menuDraw.test: requiring interaction on aqua.
+ * tests/unixMenu.test:
+ * tests/unixWm.test:
+ * tests/winMenu.test:
+
+2007-05-07 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Properly cast sentinel arguments to variadic
+ function (fixes "warning: missing sentinel in function call", [Bug
+ 1712001])
+
+2007-05-04 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkFont.c: TIP #145 implementation -
+ * generic/tkFont.h: Enhanced font handling.
+ * win/tkWinDefault.h:
+ * win/tkWinFont.c:
+ * win/tkWinInt.h:
+ * win/tkWinWm.c:
+ * library/demos/widget:
+ * library/ttk/fonts.tcl:
+
+2007-05-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/ttk_treeview.n, doc/ttk_panedwindow.n, doc/ttk_dialog.n:
+ * doc/ttk_checkbutton.n, doc/tk.n, doc/menu.n, doc/font.n:
+ * doc/canvas.n: Spelling fixes. [Bug 1686210]
+
+2007-05-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkStubLib.c (Tk_InitStubs):
+ * generic/ttk/ttkLabel.c (LabelSetup):
+ * unix/tkUnixSelect.c (ConvertSelection):
+ * unix/tkUnixEvent.c (TkUnixDoOneXEvent):
+ * generic/tkConfig.c (Tk_RestoreSavedOptions):
+ * generic/tkCanvPs.c (TkCanvPostscriptCmd):
+ * generic/tkOption.c (GetDefaultOptions):
+ * unix/tkUnixRFont.c (TkpGetFontAttrsForChar, InitFont)
+ (TkpGetFontFamilies, TkpGetSubFonts):
+ * unix/tkUnixSend.c (TkpTestsendCmd, RegOpen): Squelch warnings from
+ GCC type aliasing. [Bug 1711985 and others]
2007-04-29 Daniel Steffen <das@users.sourceforge.net>
- * generic/tkCanvas.c: allow -selectforeground option to be None; add
+ * unix/configure.in: Fix for default case in tk debug build detection.
+ * unix/configure: autoconf-2.59
+
+2007-04-27 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c(TagOptionSpecs): Use TK_OPTION_STRING
+ instead of TK_OPTION_FONT to avoid resource leak in tag management.
+
+2007-04-26 Joe English <jenglish@users.sourceforge.net>
+
+ * macosx/ttkMacOSXTheme.c: Merged OFFSET_RECT processing into
+ BoxToRect(); factored out PatternOrigin; resynchronized with Tile
+ codebase.
+
+2007-04-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.5a6 TAGGED FOR RELEASE ***
+
+ * unix/Makefile.in (dist): Correct tests/ttk glob inclusion
+
+2007-04-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (dist): Add tests/ttk dir to src dist
+
+ * unix/tkUnixMenubu.c (TkpDisplayMenuButton): Init width/height to 0
+
+2007-04-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in (dist): Add macosx/*.xcconfig files to src dist;
+ copy license.terms to dist macosx dir; fix autoheader bits.
+
+2007-04-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (dist): Add ttk bits to src dist
+
+ * tests/font.test (font-46.[12]): Correct listification of result
+
+2007-04-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkCanvas.c: Allow -selectforeground option to be None; add
* generic/tkCanvText.c: fallback to fgColor when selFgColor is None
* generic/tkEntry.c: (new default on aqua to match native L&F).
* generic/tkListbox.c:
* generic/tkText.c:
- * generic/tkCanvas.c: add support for bypassing all of Tk's double
+ * generic/tkCanvas.c: Add support for bypassing all of Tk's double
* generic/tkEntry.c: buffered drawing into intermediate pixmaps
* generic/tkFrame.c: (via TK_NO_DOUBLE_BUFFERING #define), it is
* generic/tkListbox.c: unnecessary & wasteful on aqua where all
* generic/tkPanedWindow.c: drawing is already double-buffered by the
* generic/tkTextDisp.c: window server. (Use of this on other
- * macosx/tkMacOSXPort.h: platforms would only require implementation
+ * generic/ttk/ttkWidget.c: platforms would only require implementation
* unix/tkUnixScale.c: of TkpClipDrawableToRect()).
+ * macosx/tkMacOSXPort.h:
- * library/bgerror.tcl: on aqua, use moveable alert resp. modal dialog
+ * library/bgerror.tcl: On aqua, use moveable alert resp. modal dialog
* library/dialog.tcl: window class and corresponding system
background pattern; fix button padding.
- * library/tearoff.tcl: correct aqua menu bar height; vertically offset
+ * library/tearoff.tcl: Correct aqua menu bar height; vertically offset
* library/tk.tcl: aqua tearoff floating window to match menu.
- * library/demos/menu.tcl: on aqua, use custom MDEF and tearoffs;
+ * library/demos/goldberg.tcl: Fix overwriting of widget demo global.
+
+ * library/demos/menu.tcl: On aqua, use custom MDEF and tearoffs;
* library/demos/menubu.tcl: correct menubutton toplevel name.
- * library/demos/puzzle.tcl: fix button size & padding for aqua.
+ * library/demos/puzzle.tcl: Fix button size & padding for aqua.
+ * library/demos/radio.tcl:
- * macosx/tkMacOSXCarbonEvents.c: add window event target carbon event
+ * macosx/tkMacOSXCarbonEvents.c: Add window event target carbon event
* macosx/tkMacOSXEvent.c: handler for all kEventClassWindow and
* macosx/tkMacOSXEvent.h: kEventClassMouse events; move all
* macosx/tkMacOSXNotify.c: remaining events except for
@@ -1025,7 +3837,7 @@
the various ways in use to run the tcl event loop; add handling of
kEventClassAppearance events (for ScrollBarVariantChanged event).
- * macosx/tkMacOSXDialog.c: use new TkMacOSXTrackingLoop() around
+ * macosx/tkMacOSXDialog.c: Use new TkMacOSXTrackingLoop() around
* macosx/tkMacOSXEvent.c: blocking API that puts up modal dialogs
* macosx/tkMacOSXMenu.c: or when entering/exiting menu/control
* macosx/tkMacOSXMouseEvent.c: tracking, window dragging and other
@@ -1034,12 +3846,12 @@
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXDialog.c: use new TkMacOSXRunTclEventLoop()
+ * macosx/tkMacOSXDialog.c: Use new TkMacOSXRunTclEventLoop()
* macosx/tkMacOSXScale.c: instead of Tcl_DoOneEvent(),
* macosx/tkMacOSXScrlbr.c: Tcl_ServiceAll(), TclServiceIdle()
* macosx/tkMacOSXWindowEvent.c: and Tcl_GlobalEval("update idletasks").
- * macosx/tkMacOSXColor.c: make available as Tk system colors all
+ * macosx/tkMacOSXColor.c: Make available as Tk system colors all
* macosx/tkMacOSXPort.h: appearance manager brushes, text colors and
backgrounds with new and legacy names, as well as the fully transparent
color "systemTransparent"; add TkMacOSXSetColorIn{Port,Context}() to
@@ -1048,24 +3860,24 @@
(lossy for most system colors); modernize/remove Classic-era code;
replace crufty strcmp() elseifs by Tcl_GetIndexFromObjStruct().
- * macosx/tkMacOSXButton.c: use new TkMacOSXSetColorInPort()
+ * macosx/tkMacOSXButton.c: Use new TkMacOSXSetColorInPort()
* macosx/tkMacOSXDraw.c: instead of setting rgb color directly
* macosx/tkMacOSXMenubutton.c: to allow for non-rgb system colors.
- * macosx/tkMacOSXCursor.c: implement "none" cursor as on other
+ * macosx/tkMacOSXCursor.c: Implement "none" cursor as on other
platforms [Patch 1615427]; add all missing appearance manager cursors.
- * macosx/tkMacOSXDefault.h: set SELECT_FG_COLORs to None to match aqua
+ * macosx/tkMacOSXDefault.h: Set SELECT_FG_COLORs to None to match aqua
L&F; use standard system color names; use new 'menu' system font;
correct default scrollbar width.
- * macosx/tkMacOSXDraw.c: standardize initialization, use and
+ * macosx/tkMacOSXDraw.c: Standardize initialization, use and
* macosx/tkMacOSXInt.h: emptying of various static temp rgns
* macosx/tkMacOSXRegion.c: onto two global RgnHandles; in debug
* macosx/tkMacOSXSubwindows.c: builds, verify emptiness of these temp
* macosx/tkMacOSXWindowEvent.c: rgns before use.
- * macosx/tkMacOSXDraw.c: add TkMacOSX{Setup,Restore}DrawingContext() to
+ * macosx/tkMacOSXDraw.c: Add TkMacOSX{Setup,Restore}DrawingContext() to
* macosx/tkMacOSXInt.h: abstract common setup & teardown of drawing
environment (for both CG and QD); save/restore QD theme drawing state;
handle GC clip region; add TkpClipDrawableToRect() to allow clipped
@@ -1073,55 +3885,59 @@
"systemWindowHeaderBackground" to setup background in themed toplevels;
correct implementation of TkMacOSXMakeStippleMap().
- * macosx/tkMacOSXEntry.c: use new TkMacOSXSetupDrawingContext() and
- * macosx/tkMacOSXFont.c: TkMacOSXRestoreDrawingContext() instead of
- various setup/teardown procs like TkMacOSX{SetUp,Release}CGContext(),
- TkMacOSXQuarz{Start,End}Draw(), TkMacOSXSetUpGraphicsPort() etc.
+ * macosx/tkMacOSXEntry.c: Use new TkMacOSXSetupDrawingContext() and
+ * macosx/tkMacOSXFont.c: TkMacOSXRestoreDrawingContext() instead of
+ * macosx/ttkMacOSXTheme.c: various setup/teardown procs like
+ TkMacOSX{SetUp,Release}CGContext(), TkMacOSXQuarz{Start,End}Draw(),
+ TkMacOSXSetUpGraphicsPort() etc.
- * macosx/tkMacOSXEmbed.c: add CG context and drawable clip rgn fields
+ * macosx/tkMacOSXEmbed.c: Add CG context and drawable clip rgn fields
* macosx/tkMacOSXInt.h: to MacDrawable struct.
* macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXDialog.c: make -parent option of tk_getOpenFile et al.
+ * macosx/tkMacOSXDialog.c: Make -parent option of tk_getOpenFile et al.
use the sheet version of NavServices dialogs; ensure native parent win
exists before using StandardSheet API for tk_messageBox [Bug 1677611];
force sheets to behave like app-modal dialogs via WindowModality() API;
use more modern ColorPicker API.
- * macosx/tkAboutDlg.r: use themed movable modal dialog, fix (c) year.
+ * macosx/tkAboutDlg.r: Use themed movable modal dialog, fix (c) year.
- * macosx/tkMacOSXEntry.c: take xOff/yOff of MacDrawable into account
- when computing locations/bounds to ensure correct posititioning when
- not drawing into intermediate pixmap.
+ * macosx/tkMacOSXEntry.c: Take xOff/yOff of MacDrawable into account
+ * macosx/ttkMacOSXTheme.c: when computing locations/bounds to ensure
+ correct posititioning when not drawing into intermediate pixmap.
- * macosx/tkMacOSXFont.c: use appearance manager API to map system font
+ * macosx/tkMacOSXFont.c: Use appearance manager API to map system font
* macosx/tkMacOSXFont.h: names to TkFonts; add "menu" system font for
- menu item text drawing from MDEF; disable broken QD stippling.
-
- * macosx/tkMacOSXMenu.c: large-scale rewrite of custom
- * macosx/tkMacOSXMenu.r (removed): MDEF and related code that
- * unix/Makefile.in: restores many longtime-MIA
- features to working order (e.g. images, custom colors & fonts in menus
- etc); implement compound menu items; use Appearance Mgr and ThemeText
- APIs to mimic native MDEF as closely as possible when default "menu"
- system font is used; remove now obsolete SICN drawing code and
- resources.
-
- * macosx/tkMacOSXCarbonEvents.c: handle additional menu carbon events
+ menu item text drawing from MDEF; always draw with CG; remove QD
+ dependent stippling algorithm; move most header declarations into the
+ source file (as they were not used anywhere else).
+
+ * macosx/tkMacOSXMenu.c: Large-scale rewrite of custom
+ * macosx/tkMacOSXMenu.r (removed): MDEF and related code that
+ * macosx/Wish.xcode/project.pbxproj: restores many longtime-MIA
+ * macosx/Wish.xcodeproj/project.pbxproj: features to working order
+ * unix/Makefile.in: (e.g. images, custom colors &
+ fonts in menus etc); implement compound menu items; use Appearance Mgr
+ and ThemeText APIs to mimic native MDEF as closely as possible when
+ default "menu" system font is used; remove now obsolete SICN drawing
+ code and resources.
+
+ * macosx/tkMacOSXCarbonEvents.c: Handle additional menu carbon events
* macosx/tkMacOSXEvent.c: in order to support <<MenuSelect>> in
* macosx/tkMacOSXMenu.c: the menubar and in menus that are not
* macosx/tkMacOSXMenus.c: using the custom MDEF [Bug 1620826];
fix early and missing clearing of current Tk active menu entry; fix
extraneous sending of <<MenuSelect>> during active menu entry clearing.
- * macosx/tkMacOSXMouseEvent.c: add support for async window dragging by
+ * macosx/tkMacOSXMouseEvent.c: Add support for async window dragging by
the window server; set the corresponding window attribute by default.
- * macosx/tkMacOSXMouseEvent.c: rationalized handling order of
+ * macosx/tkMacOSXMouseEvent.c: Rationalized handling order of
non-mousedown events; add TkMacOSXModifierState() to retrieve the
current key modifiers in carbon format.
- * macosx/tkMacOSXScrlbr.c: use appearance manager API to retrieve
+ * macosx/tkMacOSXScrlbr.c: Use appearance manager API to retrieve
scrollbar component metrics; add awareness of multiple possibilites for
scrollbar arrow position in aqua and handle user changes to arrow
position pref; handle difference in metrics of small & large scrollbar
@@ -1134,13 +3950,13 @@
HiliteControl() by modern API; replace control mgr constants with
appearance mgr equivalents.
- * macosx/tkMacOSXSubwindows.c: use SetWindowBounds() API instead of
+ * macosx/tkMacOSXSubwindows.c: Use SetWindowBounds() API instead of
SizeWindow(); invalidate clip regions after X{Map,Unmap}Window as fix
for [Bug 940117] made them dependent on mapping state; remove unneeded
calls to TkMacOSXInvalClipRgns() and unnecessary setting of QD port;
use native-endian pixmap on intel; remove obsolete pixmap pix locking.
- * macosx/tkMacOSXWindowEvent.c: handle only the first of a batch of
+ * macosx/tkMacOSXWindowEvent.c: Handle only the first of a batch of
kEventAppAvailableWindowBoundsChanged events sent per transaction;
handle kEventWindowBoundsChanged event to support live window resizing
and centralized sending of location/size changed ConfigureNotify
@@ -1152,7 +3968,7 @@
fullscreen windows to ensure bounds match new screen size; enter/exit
fullscreen UIMode upon activation/deactivation of fullscreen window.
- * macosx/tkMacOSXWm.c: use live-resize and async-drag carbon window
+ * macosx/tkMacOSXWm.c: Use live-resize and async-drag carbon window
* macosx/tkMacOSXWm.h: attributes for toplevels by default; implement
new [wm attributes] -topmost, -transparent and -fullscreen; refactor
WmAttributesCmd() parallelling the tkUnixWm.c implementation, use thus
@@ -1180,51 +3996,50 @@
port; workaround GetWindowStructureWidths() Carbon bug (bogus results
for never-mapped floating windows).
- * macosx/tkMacOSXXStubs.c (TkMacOSXDisplayChanged): add maximal window
+ * macosx/tkMacOSXXStubs.c (TkMacOSXDisplayChanged): Add maximal window
bounds field to Screen record (in ext_data), computed as the union of
available window positioning bounds of all graphics devices (displays).
- * macosx/tkMacOSXBitmap.c: fix macRoman encoding leak.
+ * macosx/tkMacOSXBitmap.c: Fix macRoman encoding leak.
* macosx/tkMacOSXCursor.c:
- * macosx/tkMacOSXDebug.c (TkMacOSXCarbonEventToAscii): use static
+ * macosx/tkMacOSXDebug.c (TkMacOSXCarbonEventToAscii): Use static
* macosx/tkMacOSXDebug.h: buffer to simplify callers; const fixes.
- * macosx/tkMacOSXBitmap.c: use more efficient QDSwapPort() instead of
+ * macosx/tkMacOSXBitmap.c: Use more efficient QDSwapPort() instead of
* macosx/tkMacOSXButton.c: GetPort()/SetPort()/GetGWorld()/SetGWorld().
* macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXFont.c:
* macosx/tkMacOSXMenubutton.c:
* macosx/tkMacOSXScale.c:
* macosx/tkMacOSXScrlbr.c:
* macosx/tkMacOSXXStubs.c:
- * macosx/tkMacOSXColor.c: use kHIToolboxVersionNumber for runtime OS
+ * macosx/tkMacOSXColor.c: Use kHIToolboxVersionNumber for runtime OS
* macosx/tkMacOSXEntry.c: version check rather than Gestalt() etc.
* macosx/tkMacOSXInt.h:
* macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXDraw.c: remove obsolete and now incorrect
+ * macosx/tkMacOSXDraw.c: Remove obsolete and now incorrect
* macosx/tkMacOSXInt.h: tkMenuCascadeRgn clipping code.
* macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXHLEvents.c: replace Tcl_GlobalEval() resp. Tcl_Eval()
+ * macosx/tkMacOSXHLEvents.c: Replace Tcl_GlobalEval() resp. Tcl_Eval()
* macosx/tkMacOSXScrlbr.c: by Tcl_EvalEx().
* macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXInit.c (TkpInit): reorder initialization steps.
+ * macosx/tkMacOSXInit.c (TkpInit): Reorder initialization steps.
- * macosx/tkMacOSXKeyEvent.c: remove pre-10.2 support.
+ * macosx/tkMacOSXKeyEvent.c: Remove pre-10.2 support.
- * macosx/tkMacOSXMenus.c: remove now useless call to
+ * macosx/tkMacOSXMenus.c: Remove now useless call to
TkMacOSXHandleTearoffMenu(); use \x.. quoting for non-latin1 macroman
literar chars to allow file to be edited as utf-8.
- * macosx/tkMacOSXScale.c: replace TrackControl() by modern
+ * macosx/tkMacOSXScale.c: Replace TrackControl() by modern
* macosx/tkMacOSXScrlbr.c: HandleControlClick() API (using new
TkMacOSXModifierState()).
- * macosx/tkMacOSXInt.h: move all constant #defines needed to
+ * macosx/tkMacOSXInt.h: Move all constant #defines needed to
* macosx/tkMacOSXColor.c: support building on older OS X releases
* macosx/tkMacOSXEvent.h: to a central location in tkMacOSXInt.h.
* macosx/tkMacOSXFont.c:
@@ -1233,8 +4048,9 @@
* macosx/tkMacOSXMenus.c:
* macosx/tkMacOSXMouseEvent.c:
* macosx/tkMacOSXWm.c:
+ * macosx/ttkMacOSXTheme.c:
- * macosx/tkMacOSXInt.h: add ChkErr() macro to factor out
+ * macosx/tkMacOSXInt.h: Add ChkErr() macro to factor out
* macosx/tkMacOSXButton.c: Carbon OSStatus return value checking
* macosx/tkMacOSXCarbonEvents.c: and TkMacOSXDbgMsg() macro to factour
* macosx/tkMacOSXClipboard.c: out debug message output; use these
@@ -1259,91 +4075,273 @@
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXXStubs.c:
- * macosx/tkMacOSXSend.c: remove duplicate/unused declarations.
+ * macosx/tkMacOSXSend.c: Remove duplicate/unused declarations.
* macosx/tkMacOSXXStubs.c:
- * macosx/tkMacOSXDebug.c: const fixes.
+ * macosx/tkMacOSXDebug.c: Const fixes.
* macosx/tkMacOSXInit.c:
* macosx/tkMacOSXTest.c:
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXXStubs.c:
- * macosx/Wish-Info.plist.in: add tcl document extensions/mime types and
+ * macosx/Wish-Info.plist.in: Add tcl document extensions/mime types and
LSMinimumSystemVersion, LSRequiresCarbon & NSAppleScriptEnabled keys.
- * macosx/tkMacOSXAETE.r: fix whitespace.
+ * macosx/Wish-Common.xcconfig: Add Wish's Info.plist as __info_plist
+ section to tktest; enable more warnings.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add 'DebugMemCompile' build
+ configuration that calls configure with --enable-symbols=all; disable
+ configure check for __attribute__((__visibility__("hidden"))) in Debug
+ configuration to restore availability of ZeroLink.
+
+ * macosx/Wish-Common.xcconfig: Fix whitespace.
+ * macosx/Wish-Debug.xcconfig:
+ * macosx/Wish-Release.xcconfig:
+ * macosx/tkMacOSXAETE.r:
* macosx/tkMacOSXConfig.c:
* macosx/tkMacOSXCursors.r:
* macosx/tkMacOSXKeyboard.c:
* macosx/tkMacOSXSend.c:
+ * macosx/ttkMacOSXTheme.c:
* macosx/tkMacOSXXCursors.r:
* macosx/README:
- * macosx/Makefile: fix/add copyright and license refs.
+ * macosx/GNUmakefile: Fix/add copyright and license refs.
* macosx/Tk-Info.plist.in:
* macosx/Wish-Info.plist.in:
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcodeproj/project.pbxproj:
* macosx/tkMacOSX.h:
- * unix/Makefile.in (dist): copy license.terms to dist macosx dir.
- * unix/configure.in: install license.terms into Tk.framework; fix tk
+ * unix/configure.in: Install license.terms into Tk.framework; fix tk
debug build detection.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+ * doc/colors.n: Document new Mac OS X system colors.
+ * doc/cursors.n: Document new Mac OS X native cursors.
+ * doc/font.n: Document new Mac OS X 'menu' system font.
+ * doc/wm.n: Document new Mac OS X [wm attributes].
+ * doc/ttk_image.n: Fix 'make html' warning.
+ * doc/canvas.n: Fix nroff typo.
+
+2007-04-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXBitmap.c, macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXCarbonEvents.c, macosx/tkMacOSXClipboard.c:
+ * macosx/tkMacOSXCursor.c, macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXDraw.c, macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXFont.c, macosx/tkMacOSXInit.c, macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXKeyEvent.c, macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c, macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXScale.c, macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c: Revert of commits from 2007-04-13 which broke
+ the OS X build.
+
+2007-04-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkFont.c, generic/tkListbox.c, unix/tkUnixSelect.c:
+ * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: Make
+ the format of declarations much more standardized (removing K&R-isms
+ and other things like that).
+
+2007-04-13 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * macosx/tkMacOSXInt.h (LOG_MSG, LOG_ON_ERROR): Added macros to make
+ the OSX code much less #ifdef-full.
- * doc/colors.n: document new Mac OS X system colors.
- * doc/cursors.n: document new Mac OS X native cursors.
- * doc/font.n: document new Mac OS X 'menu' system font.
- * doc/wm.n: document new Mac OS X [wm attributes].
+2007-04-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/panedwindow.tcl (ttk::panedwindow::Press): handle Press
+ triggering outside sash element boundaries.
+
+2007-04-10 Joe English <jenglish@users.sourceforge.net>
+
+ * win/ttkWinMonitor.c, win/ttkWinXPTheme.c: Re-sync with Tile codebase
+ so patches can flow back and forth.
+
+ * win/ttkWinXPTheme.c: Skip OS version test, should work on Vista/Aero
+ now as well as XP. Fixes [Bug 1687299], thanks to George Petasis for
+ tracking this down.
+
+2007-03-21 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkLayout.c(Ttk_BuildLayoutTemplate): BUGFIX: Nested
+ TTK_GROUP nodes did not work unless they appeared at the end of the
+ layout (and only by accident then).
+
+2007-03-08 Joe English <jenglish@users.sourceforge.net>
+
+ * tests/grid.test(grid-21.7): Reset wm geometry . and pack propagate .
+ at end of test. 'pack propagate . 0' was causing cascading failures in
+ subsequent tests. [Bug 1676770]
2007-03-07 Daniel Steffen <das@users.sourceforge.net>
- * generic/tkMain.c (Tk_MainEx): replicate macosx-specific code from
+ * generic/tkMain.c (Tk_MainEx): Replicate macosx-specific code from
TkpInit() that ensures the console window appears when wish is started
from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24
change rendered the corresponding code in TkpInit() ineffective in wish
because Tk_MainEx() sets tcl_interactive before calling TkpInit().
- * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): add fix for
+ * generic/ttk/ttkGenStubs.tcl (new): Add ttk-specific genstubs.tcl from
+ * unix/Makefile.in (genstubs): tile and run it from 'genstubs'
+ target, restores ability to generate all of Tk's stub sources.
+
+ * generic/ttk/ttkTreeview.c: #ifdef out unused declaration.
+
+ * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): Add fix for
libraries loaded with a DYLD_IMAGE_SUFFIX.
+ * macosx/Wish.xcodeproj/project.pbxproj: Ensure gcc version used by
+ * macosx/Wish.xcodeproj/default.pbxuser: Xcode and configure/make are
+ * macosx/Wish-Common.xcconfig: consistent and independent of
+ gcc_select default and CC env var; fixes for Xcode 3.0.
+
* unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+2007-02-25 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkUtil.c: Fixed grid anchor center problem in labelframes.
+ * tests/grid.test: [Bug 1545765]
+
+2007-02-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/notebook.tcl (ttk::notebook::enableTraversal): OS X
+ needs Option instead of Alt binding
2007-02-19 Jeff Hobbs <jeffh@ActiveState.com>
* unix/tcl.m4: use SHLIB_SUFFIX=".so" on HP-UX ia64 arch.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+ * library/tkfbox.tcl (::tk::IconList_Goto): avoid goto issues in empty
+ dirs. [Bug 1662959]
+
+2007-02-09 Joe Mistachkin <joe@mistachkin.com>
+
+ * win/nmakehlp.c: Properly cleanup after nmakehlp, including the
+ * win/makefile.vc: vcX0.pch file. Sync up fixed nmakehlp usage from
+ Tcl.
- * library/tkfbox.tcl (::tk::IconList_Goto): avoid goto issues in
- empty dirs. [Bug 1662959]
+2007-02-06 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl: Add no-op [package ifneeded] script for tile
+ 0.8.0, so that existing applications that use "package require tile"
+ won't fail when run under Tk 8.5.
2007-02-04 Daniel Steffen <das@users.sourceforge.net>
+ * unix/tcl.m4: Use gcc4's __attribute__((__visibility__("hidden"))) if
+ available to define MODULE_SCOPE effective on all platforms.
* unix/configure.in: add caching to -pipe check.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+2007-02-03 Joe Mistachkin <joe@mistachkin.com>
+
+ * win/rules.vc: Fix platform specific file copy macros for downlevel
+ Windows.
+ * win/ttkWinMonitor.c: Windows portability support. Fix "noxp" build
+ * win/ttkWinXPTheme.c: option handling and use GetWindowLongPtr and
+ SetWindowLongPtr only when needed.
+
+2007-02-02 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/ttkWinXPTheme.c: Support IsAppThemed() call. This is what is
+ used when theming is turned off just for an individual application.
+
+2007-01-28 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Extract build settings that
+ * macosx/Wish.xcodeproj/default.pbxuser: were common to multiple
+ * macosx/Wish-Common.xcconfig (new file): configurations into external
+ * macosx/Wish-Debug.xcconfig (new file): xcconfig files; add extra
+ * macosx/Wish-Release.xcconfig (new file): configurations for building
+ with SDKs; convert legacy jam-based 'Tk' target to native target with
+ single script phase; correct syntax of build setting references to use
+ $() throughout; remove unused tcltest sources from 'tktest' target.
+
+ * macosx/README: Document new Wish.xcodeproj configurations; other
+ minor updates/corrections.
-2007-01-30 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tk.h: Update location of version numbers in macosx files.
- * win/Makefile.in (install-private-headers): added target
+ * macosx/Wish.xcode/project.pbxproj: Restore 'tktest' target to working
+ * macosx/Wish.xcode/default.pbxuser: order by replicating applicable
+ changes to Wish.xcodeproj since 2006-07-20.
2007-01-25 Daniel Steffen <das@users.sourceforge.net>
- * unix/tcl.m4: integrate CPPFLAGS into CFLAGS as late as possible
- * unix/configure.in: and move (rather than duplicate) -isysroot flags
- from CFLAGS to CPPFLAGS to avoid errors about multiple -isysroot flags
- from some older gcc builds.
+ * unix/tcl.m4: Integrate CPPFLAGS into CFLAGS as late as possible and
+ move (rather than duplicate) -isysroot flags from CFLAGS to CPPFLAGS to
+ avoid errors about multiple -isysroot flags from some older gcc builds.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
-2006-01-19 Daniel Steffen <das@users.sourceforge.net>
+2007-01-19 Joe Mistachkin <joe@mistachkin.com>
- * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861]
+ * win/makefile.vc: Properly build man2tcl.c for MSVC8.
+
+2007-01-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Remove libtommath defines.
+
+ * unix/tcl.m4: Ensure CPPFLAGS env var is used when set. [Bug 1586861]
(Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS when
present in CFLAGS to avoid discrepancies between what headers configure
sees during preprocessing tests and compiling tests.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+2007-01-11 Jeff Hobbs <jeffh@activestate.com>
+
+ * unix/tkUnixEvent.c, library/msgs/es.msg: s/CRLF/LF/g
+
+2007-01-11 Joe English <jenglish@users.sourceforge.net>
+
+ * win/tcl.m4 (CFLAGS_WARNING): Remove "-Wconversion". This was removed
+ from unix/tcl.m4 2004-07-16 but not from here.
+ * win/configure: Regenerated.
+
+2007-01-11 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkManager.h, generic/ttk/ttk*.c: Revert addition of
+ contravariant 'const' qualifiers, to keep in sync with Tile codebase
+ (which must remain compatible with Tk 8.4).
+
+2007-01-03 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * doc/ManageGeom.3,
+ * generic/tk.decls,
+ * generic/tk.h: Add const to 2nd parameter of Tk_ManageGeometry
+ * generic/tkDecls.h: regenerated
+ * generic/tkInt.h,
+ * generic/tk*.c,
+ * generic/ttk/ttk*.c: Added many "const" specifiers in implementation.
+
+2007-01-02 Donal K. Fellows <dkf@users.sf.net>
+
+ * xlib/*: Made the generic fake-X11 glue layer abide by the formatting
+ rules of the core.
+
+2006-12-31 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c: Fill-in TkpGetFontAttrsForChar (TIP #300).
+ * macosx/ttkMacOSXTheme.c: Define a constant to make it compile on Mac
+ OS X 10.3.
+
+2006-12-28 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Update wm attributes output so that tests pass after
+ addition of -transparentcolor for Win32.
+
+2006-12-26 Joe English <jenglish@users.sourceforge.net>
-2006-12-22 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * generic/ttk/ttkLabel.c: ImageElement clientData no longer needed.
+
+2006-12-22 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixEvent.c (TkUnixDoOneXEvent): Made correct on AMD64 and
other similar 64-bit systems where fd_mask is not 'unsigned int' in
@@ -1361,45 +4359,352 @@
* unix/tcl.m4 (Darwin): --enable-64bit: verify linking with 64bit -arch
flag succeeds before enabling 64bit build.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+
+2006-12-18 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c, library/ttk/treeview.tcl, doc/treeview.n:
+ Added column '-stretch' and '-minwidth' options. Improved column drag
+ and resize behavior. Added horizontal scrolling [Bug 1518650]. Row
+ height and child indent specifiable on Treeview style. Decreased
+ default row height, no default -padding. Use correct heading height
+ [Bug 1163349]. Apply tag settings to tree item as well as to data
+ columns [NOTE: 'tag configure' still buggy]. Fix off-by-one condition
+ when moving nodes forward [Bug 1618142]
+ * generic/ttk/ttkScroll.c (TtkScrollTo): Prevent overscroll [Bug
+ 1173434]
+ * library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl,
+ * library/ttk/clamTheme.tcl, library/ttk/classicTheme.tcl,
+ * library/ttk/defaults.tcl, library/ttk/winTheme.tcl,
+ * library/ttk/xpTheme.tcl: Per-theme treeview settings.
+ * macosx/ttkMacOSXTheme.c: Added disclosure triangle element.
+
+2006-12-17 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl, generic/ttk/ttkEntry.c,
+ * doc/ttk_combobox.n: Add combobox -height option; only show scrollbar
+ if the listbox needs to scroll. [Bug 1032869]
+
+2006-12-16 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * doc/cursors.n: Mention "none" in supported cursor list. Fix comment
+ that incorrectly claims that the Win32 "no" cursor hides the cursor.
+ * tests/cursor.test: Test "none" cursor.
+ * unix/tkUnixCursor.c (CreateCursorFromTableOrFile)
+ (TkGetCursorByName): Define a table of Tk cursors that is searched in
+ addition to the X cursor table. A Tk cursor is loaded from a data
+ string and works with the same options as the built in X cursors. This
+ code makes it possible to use "none" as a cursor name under Unix.
+ * win/rc/cursor9a.cur: Added none Win32 cursor.
+ * win/rc/tk_base.rc: Define a built-in Win32 cursor named "none".
+ [Patch 1615427]
+
+2006-12-14 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkButton.c, generic/ttk/ttkElements.c,
+ * generic/ttk/ttkEntry.c, generic/ttk/ttkFrame.c,
+ * generic/ttk/ttkImage.c, generic/ttk/ttkInit.c,
+ * generic/ttk/ttkLabel.c, generic/ttk/ttkNotebook.c,
+ * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c,
+ * generic/ttk/ttkScale.c, generic/ttk/ttkScrollbar.c,
+ * generic/ttk/ttkSeparator.c, generic/ttk/ttkTheme.h,
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.h:
+ Global reduction: use per-file *_Init() routines to reduce the number
+ of globally-visible initialization records.
+
+2006-12-13 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (install-doc): intentionally skip ttk_dialog.n
+ installation (not for public consumption)
+
+ * doc/scrollbar.n, doc/button.n, doc/checkbutton.n:
+ * doc/entry.n, doc/frame.n, doc/label.n, doc/labelframe.n:
+ * doc/menu.n, doc/menubutton.n, doc/panedwindow.n:
+ * doc/radiobutton.n, doc/scrollbar.n, doc/ttk_*: revamp ttk docs to
+ use consist nroff format (not 100% consistent with classic widget
+ docs). Add more man page cross-linking "SEE ALSO".
+
+ * generic/ttk/ttkInit.c:
+ * generic/ttk/ttkTreeview.c: make treeview exist by default
+ * generic/ttk/ttkPanedwindow.c: s/TtkPaned_Init/TtkPanedwindow_Init/
+
+ * win/Makefile.in, unix/Makefile.in (demo): add 'demo' target
+
+2006-12-13 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl: Try to straighten out theme loading and
+ selection logic.
+ * generic/ttk/ttkElements.c, library/ttk/defaults.tcl,
+ * generic/ttk/ttkClamTheme.c, library/ttk/clamTheme.tcl:
+ Provide package in C part instead of Tcl part.
+
+2006-12-12 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl, generic/ttkTheme.c: Remove nonfunctional code.
+
+2006-12-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinButton.c (InitBoxes): Call Tcl_Panic() if loading of bitmap
+ resources fails. This change generates an error if Tk is unable to
+ find button widget resources instead of silently failing and then
+ drawing widgets incorrectly.
+ * win/rc/tk_base.rc: If the user defines BASE_NO_TK_ICON then compile
+ the base resources file without a "tk" icon. This change makes it
+ easier to replace the default tk icon with a custom icon. [Patch
+ 1614362]
+
+2006-12-11 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * unix/tkUnixWm.c (TkWmMapWindow, WmClientCmd): Added support for
+ _NET_WM_PID property from the EWMH spec. This is only installed when
+ the client machine is set.
+ (WmProtocolCmd, UpdateWmProtocols, TkWmProtocolEventProc): Added
+ support for the _NET_WM_PING protocol from the EWMH spec. Note that
+ the support for this is not exposed to the script level as that would
+ prevent correct handling.
+
+2006-12-10 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h,
+ * generic/ttk/ttk.decls, generic/ttk/ttkTheme.c,
+ * generic/ttk/ttkLayout.c, generic/ttk/ttkDecls.h:
+ Rename typedef Ttk_Element => Ttk_ElementImpl.
+
+2006-12-09 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkButton.c, generic/ttk/ttkImage.c,
+ * generic/ttk/ttkLabel.c, generic/ttk/ttkWidget.h,
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkNotebook.c,
+ * generic/ttk/ttkTreeview.c, doc/ttk_image.n:
+ Merged duplicate functionality between image element factory, image
+ element, and -image option processing. Image element factory now takes
+ an imageSpec argument instead of a separate image name and -map option
+ * tests/ttk/image.test(image-1.1): Can catch this error earlier now.
+
+2006-12-06 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Further changes to avoid attempting to link
+ * unix/configure: against Xft libraries in a non-Xft build
+ [Bug 1609616] (dgp)
2006-12-04 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkListbox.c (ConfigureListboxItem): ListboxWorldChanged
- not needed - just call EventuallyRedrawRange. [Bug 1608046] (rezic)
+ * generic/tkListbox.c (ConfigureListboxItem): ListboxWorldChanged not
+ needed - just call EventuallyRedrawRange. [Bug 1608046] (rezic)
+
+2006-12-04 Donal K. Fellows <dkf@users.sf.net>
+
+ TIP #286 IMPLEMENTATION
+
+ * generic/tkMenu.c (MenuWidgetObjCmd, MenuDoXPosition):
+ * doc/menu.n, tests/menu.test: Added an [$menu xposition] subcommand
+ which is useful in menubars and when menus use multiple columns. Many
+ thanks to Schelte Bron for the implementation.
+
+2006-12-01 Kevin Kenny <kennykb@acm.org>
+
+ TIP #300 IMPLEMENTATION
+
+ * doc/font.n: Added a [font actual $font $char]
+ * generic/tkFont.c: variant that introspects the font that
+ * generic/tkFont.h: is chosen to render a given character
+ * macosx/tkMacOSXFont.c: in a given nominal font. Added
+ * tests/font.test: documentation and test cases for the
+ * unix/tkUnixFont.c: new command syntax.
+ * unix/tkUnixRFont.c:
+ * win/tkWinFont.c:
2006-12-01 Jeff Hobbs <jeffh@ActiveState.com>
* doc/wm.n, tests/winWm.test:
* win/tkWinWm.c: add -transparentcolor attribute for Windows.
+2006-12-01 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkLayout.c: Dead code removal.
+
2006-11-30 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXDialog.c (Tk_MessageBoxObjCmd): fix inability to use
buttons with standard Escape key binding as -default button (reported
on tcl-mac by Hans-Christoph Steiner).
+ * macosx/tkMacOSXWm.c (WmAttributesCmd): fix getting [wm attr -alpha].
+ [Bug 1581932]
+
+2006-11-28 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/fonts.tcl: Clean up temporary variables.
+
+2006-11-27 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Corrected Xft configuration so that Xft actually
+ does get turned on when available.
+ * unix/configure: autoconf
+
+2006-11-26 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkWidget.c, generic/ttk/ttkPaned.c: Fix [Bug 1603506]
+ * library/ttk/button.tcl, library/ttk/combobox.tcl,
+ * library/ttk/utils.tcl: Rename ttk::CopyBindings to ttk::copyBindings
+ * generic/ttk/ttkTreeview.c, doc/ttk_treeview.n:
+ -displaycolumns {} now means "no columns" instead of "all columns".
+ Use -displaycolumns #all for "all columns". [Bug 1547622]
+
2006-11-26 Daniel Steffen <das@users.sourceforge.net>
* unix/tcl.m4 (Linux): --enable-64bit support. [Patch 1597389]
- * unix/configure: autoconf-2.13 [Bug 1230558]
+ * unix/configure: autoconf-2.59 [Bug 1230558]
2006-11-24 Jeff Hobbs <jeffh@ActiveState.com>
- * macosx/tkMacOSXInit.c (TkpInit): only set tcl_interactive 1 if
- it isn't already defined. Allows embedders to set it to 0 to
- prevent the console appearing on OS X. [Bug 1487701]
+ * macosx/tkMacOSXInit.c (TkpInit): only set tcl_interactive 1 if it
+ isn't already defined. Allows embedders to set it to 0 to prevent the
+ console appearing on OS X. [Bug 1487701]
* unix/tkUnixMenu.c (DrawMenuUnderline): bound Tcl_UtfAtIndex usage
* tests/menu.test (menu-36.1): [Bug 1599877]
+2006-11-24 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/altTheme.tcl, library/ttk/clamTheme.tcl,
+ * library/ttk/defaults.tcl, library/ttk/winTheme.tcl,
+ * library/ttk/xpTheme.tcl: explicitly specify -anchor w on TMenubutton
+ * tests/ttk/entry.test: Fixed font dependency; test entry-3.2 should
+ work on all platforms now.
+ * library/classicTheme.tcl: Don't define or use TkClassicDefaultFont.
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkPanedwindow.c: Handle
+ missing layouts.
+
2006-11-23 Jeff Hobbs <jeffh@ActiveState.com>
- * win/tkWinMenu.c (TkWinHandleMenuEvent, DrawMenuUnderline):
- handle unichar underlining correctly and safely. [Bug 1599877]
+ * win/tkWinMenu.c (TkWinHandleMenuEvent, DrawMenuUnderline): Handle
+ unichar underlining correctly and safely. [Bug 1599877]
+
+2006-11-20 Joe English <jenglish@users.sourceforge.net>
+
+ * win/ttkWinXPTheme.c: Add support for alternate/indeterminate
+ checkbutton state. Fix various spacing parameters [Bug 1596020, patch
+ from Tim Baker]. Remove unused uxtheme hooks.
+
+2006-11-16 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/colors.n, doc/wm.n: Minor fixes, added See Also.
+
+ * doc/labelframe.n: Added an example.
+
+2006-11-15 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/label.n: Added an example and some See Also refs.
+
+ * doc/ConfigWidg.3, doc/bind.n, doc/grid.n, doc/panedwindow.n:
+ * doc/text.n, doc/ttk_Geometry.3, doc/ttk_button.n:
+ * doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
+ * doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n, doc/ttk_intro.n:
+ * doc/ttk_label.n, doc/ttk_labelframe.n, doc/ttk_menubutton.n:
+ * doc/ttk_notebook.n, doc/ttk_panedwindow.n, doc/ttk_progressbar.n:
+ * doc/ttk_radiobutton.n, doc/ttk_scrollbar.n, doc/ttk_separator.n:
+ * doc/ttk_sizegrip.n, doc/ttk_style.n, doc/ttk_widget.n, doc/wm.n:
+ Convert \fP to \fR so that man-page scrapers have an easier time.
+
+2006-11-14 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkDefaultTheme.c: Fix off-by-one bug in tree indicator
+ size computation [Bug 1596021, patch from Tim Baker]. Increased
+ default size from 7 to 9 pixels.
+
+2006-11-12 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttkScroll.c: *correct* fix for [Bug 1588251].
+
+2006-11-12 Joe English <jenglish@users.sourceforge.net>
+
+ * tests/ttk/ttk.test(ttk-6.9): Workaround for [Bug 1583038]
+
+2006-11-12 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttkScroll.c: Reworked cleanup procedure; "self-cancelling"
+ idle call is not robust, call Tcl_CancelIdleCall() in
+ TtkFreeScrollHandle instead. Fixes [Bug 1588251]
+
+2006-11-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: remove tclParseExpr.c and
+ bwidget.test.
+
+ * unix/tcl.m4 (Darwin): suppress linker arch warnings when building
+ universal for both 32 & 64 bit and no 64bit CoreFoundation is
+ available; sync with tcl tcl.m4 change.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+2006-11-08 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Silenced warnings about missing Xft configuration
+ unless --enable-xft is requested explicitly. Also added a few basic
+ checks that we can actually compile and link against Xft headers and
+ libraries. [Bug 1592667]
+ * unix/configure: Regen.
+
+2006-11-07 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Made --enable-xft the default.
+ * unix/configure: Regen.
+
+2006-11-06 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkClassicTheme.c, generic/ttk/ttkPanedwindow.c,
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkTreeview.c,
+ * win/ttkWinXPTheme.c, library/ttk/entry.tcl,
+ * library/ttk/notebook.tcl, library/ttk/panedwindow.tcl,
+ * library/ttk/utils.tcl, tests/ttk/entry.test, tests/ttk/bwidget.test:
+ Miscellaneous minor changes to re-sync Ttk codebase with Tile CVS: fix
+ comments damaged by overzealous search-and-destroy; removed obsolete
+ [style default] synonym for [ttk::style configure]; removed other dead
+ code.
+
+2006-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/safetk.tcl (::safe::tkTopLevel): Theme it.
+
+ * generic/ttk/ttkLayout.c: We do not want to require tkInt in all
+ * generic/ttk/ttkMananager.h: the ttk files so added the definition
+ * generic/ttk/ttkTheme.h: of MODULE_SCOPE to ttkTheme.h. Ensures
+ * generic/ttk/ttkWinMonitor.c: everyone gets to see the definition
+ from someplace.
+
+ * library/ttk/fonts.tcl: In a safe interp there is no osVersion field
+ in tcl_platform so work around it.
2006-11-02 Daniel Steffen <das@users.sourceforge.net>
+ * generic/ttk/ttkBlink.c, generic/ttk/ttkButton.c:
+ * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
+ * generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
+ * generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
+ * generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
+ * generic/ttk/ttkLayout.c, generic/ttk/ttkManager.h:
+ * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c:
+ * generic/ttk/ttkProgress.c, generic/ttk/ttkScale.c:
+ * generic/ttk/ttkScroll.c, generic/ttk/ttkScrollbar.c:
+ * generic/ttk/ttkSeparator.c, generic/ttk/ttkSquare.c:
+ * generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h:
+ * generic/ttk/ttkThemeInt.h, generic/ttk/ttkTrack.c:
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
+ * generic/ttk/ttkWidget.h, macosx/ttkMacOSXTheme.c:
+ * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: ensure
+ all global Ttk symbols have Ttk or ttk prefix; declare all externally
+ visible Ttk symbols not contained in stubs table as MODULE_SCOPE (or as
+ static when possible); so that 'make check{exports,stubs}' once again
+ complete without errors.
+
+ * macosx/tkMacOSXColor.c (TkMacOSXCompareColors): ifdef out when unused
+
+ * macosx/Wish.xcodeproj/project.pbxproj: check autoconf/autoheader exit
+ status and stop build if they fail.
+
* macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): fix handling of
Carbon Update events: the QuickDraw window update region was being
ignored and all child TkWindows were sent an Expose XEvent even when
@@ -1407,10 +4712,10 @@
2006-11-01 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXDebug.c: add TkMacOSX prefix to leftover macosx-private
- * macosx/tkMacOSXDebug.h: global symbols without Tk prefix; ifdef out
- * macosx/tkMacOSXEmbed.c: currently unused debug procs.
- * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXDebug.c: add TkMacOSX prefix to leftover
+ * macosx/tkMacOSXDebug.h: macosx-private global symbols without Tk
+ * macosx/tkMacOSXEmbed.c: prefix; ifdef out currently unused debug
+ * macosx/tkMacOSXEvent.c: procs.
* macosx/tkMacOSXInt.h:
* macosx/tkMacOSXCarbonEvents.c:
* macosx/tkMacOSXSubwindows.c:
@@ -1418,40 +4723,137 @@
2006-10-31 Pat Thoyts <patthoyts@users.sourceforge.net>
- * rules.vc: Fix bug #1582769 build with VC2003 and correct i386 arch.
+ * win/makefile.vc: Added ttk files to msvc build and add manifest
+ * win/rules.vc: files to binaries with MSVC8.
+
+2006-10-31 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new Ttk files.
+
+ * macosx/ttkMacOSXTheme.c: standardize header #includes.
+
+ * unix/Makefile (checkstubs, checkexports): check ttk.decls, allow
+ export of Ttk prefixed symbols.
+
+ * generic/ttk/tkDefaultTheme.c: fix warnings.
+
+2006-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/ttk_Geometry.3, doc/ttk_Theme.3, doc/ttk_button.n:
+ * doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
+ * doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n:
+ * doc/ttk_intro.n, doc/ttk_label.n, doc/ttk_labelframe.n:
+ * doc/ttk_menubutton.n, doc/ttk_notebook.n, doc/ttk_panedwindow.n:
+ * doc/ttk_progressbar.n, doc/ttk_radiobutton.n, doc/ttk_scrollbar.n:
+ * doc/ttk_separator.n, doc/ttk_sizegrip.n, doc/ttk_style.n:
+ * doc/ttk_treeview.n, doc/ttk_widget.n,:
+ * generic/ttk/ttk.decls, generic/ttk/ttkBlink.c:
+ * generic/ttk/ttkButton.c, generic/ttk/ttkCache.c:
+ * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
+ * generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
+ * generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
+ * generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
+ * generic/ttk/ttkLayout.c, generic/ttk/ttkManager.c:
+ * generic/ttk/ttkManager.h, generic/ttk/ttkNotebook.c:
+ * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c:
+ * generic/ttk/ttkScale.c, generic/ttk/ttkScroll.c:
+ * generic/ttk/ttkScrollbar.c, generic/ttk/ttkSeparator.c:
+ * generic/ttk/ttkSquare.c, generic/ttk/ttkState.c:
+ * generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
+ * generic/ttk/ttkTagSet.c, generic/ttk/ttkTheme.c:
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h:
+ * generic/ttk/ttkTrace.c, generic/ttk/ttkTrack.c:
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
+ * generic/ttk/ttkWidget.h:
+ * library/demos/ttk_demo.tcl, library/demos/ttk_iconlib.tcl:
+ * library/demos/ttk_repeater.tcl:
+ * library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl:
+ * library/ttk/button.tcl, library/ttk/clamTheme.tcl:
+ * library/ttk/classicTheme.tcl, library/ttk/combobox.tcl:
+ * library/ttk/cursors.tcl, library/ttk/defaults.tcl:
+ * library/ttk/dialog.tcl, library/ttk/entry.tcl:
+ * library/ttk/fonts.tcl, library/ttk/icons.tcl:
+ * library/ttk/keynav.tcl, library/ttk/menubutton.tcl:
+ * library/ttk/notebook.tcl, library/ttk/panedwindow.tcl:
+ * library/ttk/progress.tcl, library/ttk/scale.tcl:
+ * library/ttk/scrollbar.tcl, library/ttk/sizegrip.tcl:
+ * library/ttk/treeview.tcl, library/ttk/ttk.tcl:
+ * library/ttk/utils.tcl, library/ttk/winTheme.tcl:
+ * library/ttk/xpTheme.tcl:
+ * macosx/ttkMacOSXTheme.c:
+ * tests/ttk/all.tcl, tests/ttk/bwidget.test, tests/ttk/combobox.test:
+ * tests/ttk/entry.test, tests/ttk/image.test:
+ * tests/ttk/labelframe.test, tests/ttk/layout.test:
+ * tests/ttk/misc.test, tests/ttk/notebook.test:
+ * tests/ttk/panedwindow.test, tests/ttk/progressbar.test:
+ * tests/ttk/scrollbar.test, tests/ttk/treetags.test:
+ * tests/ttk/treeview.test, tests/ttk/ttk.test, tests/ttk/validate.test:
+ * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c:
+ First import of Ttk themed Tk widgets as branched from tile 0.7.8
+
+ * generic/tkInt.h, generic/tkWindow.c: add Ttk_Init call, copy tk
+ classic widgets to ::tk namespace.
+ * library/tk.tcl: add source of ttk/ttk.tcl, define $::ttk::library.
+ * unix/Makefile.in, win/Makefile.in: add Ttk build bits
+ * win/configure, win/configure.in: check for uxtheme.h (XP theme).
2006-10-23 Don Porter <dgp@users.sourceforge.net>
- * README: Bump version number to 8.4.15
+ * README: Bump version number to 8.5a6
* generic/tk.h:
+ * library/tk.tcl:
* unix/configure.in:
* unix/tk.spec:
* win/configure.in:
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
* win/configure:
-2006-10-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+2006-10-19 Pat Thoyts <patthoyts@users.sourceforge.net>
- *** 8.4.14 TAGGED FOR RELEASE ***
+ *** 8.5a5 TAGGED FOR RELEASE ***
- * win/nmakehlp.c: Ensure builds with VC6 without Platform SDK.
- * win/rules.vc: Pickup MACHINE from environment.
+ * generic/tkImgBmap.c: Fixed line endings.
+ * win/makefile.vc: Patched up build system to manage
+ * win/rules.vc: AMD64 with MSVC8
+ * win/nmakehlp.c: Ensure operation without Platform SDK.
-2006-10-17 Don Porter <dgp@users.sourceforge.net>
+2006-10-18 Don Porter <dgp@users.sourceforge.net>
- * generic/tkPanedWindow.c: Cleaned up some code flagged by a
- * generic/tkText.c: `make checkexports` test.
- * generic/tkText.h
- * generic/tkTextTag.c:
+ * changes: 8.5a5 release date set.
+
+2006-10-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/text.n: fix docs to not correct -tabs usage case.
+
+ * generic/tkTextDisp.c (SizeOfTab): fix -tabstyle wordprocessor tab
+ alignment to correct tab edge case. [Bug 1578858]
+
+2006-10-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkText.c: Applied suggested patch from [Bug 1536735]
+ * tests/text.test: Update test for above patch.
+ * tests/textWind.test: Corrected test to catch all messages
+ * tests/safe.test: Silence spurious win32 failure awaiting TIP150
+ * tests/winDialog.test: Updated test for file name length check.
+ * test/winWm.test: Corrected test expectation for menu wrapping.
+
+2006-10-16 Andreas Kupries <andreask@activestate.com>
+
+ * doc/WindowId.3: Pat's commit on 2006-10-08 broke the .SH NAME
+ information across several lines, breaking the cross-linking of
+ manpages during installation for this one. Put everything back on a
+ single line, unbreaking it.
2006-10-16 Daniel Steffen <das@users.sourceforge.net>
- * changes: updates for 8.4.14 release.
+ * changes: updates for 8.5a5 release.
- * macosx/tkMacOSXDraw.c: fix numerous issues in CG and QD drawing procs
- so that they now match X11 drawing much more closely [Bug 1558051];
- use Tiger ellipse drawing API when available; fix comments & whitespace.
+ * macosx/tkMacOSXDraw.c: fix numerous issues in CG and QD drawing
+ procs so that they now match X11 drawing much more closely [Bug
+ 1558051]; use Tiger ellipse drawing API when available; fix comments &
+ whitespace.
* macosx/tkMacOSXInit.c: set default linewidth limit for CG
antialiasing to 0 as thin horizontal/vertical lines look good now.
@@ -1461,39 +4863,37 @@
* generic/tkCanvPoly.c (ConfigurePolygon): linewidth in gc even for
* generic/tkRectOval.c (ConfigureRectOval): fills (as it controls AA).
- * macosx/Makefile: don't redo prebinding of non-prebound binaires.
+ * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires.
+
+ * library/demos/pendulum.tcl: fix incorrect setting of toplevel title.
2006-10-10 Don Porter <dgp@users.sourceforge.net>
- * changes: changes updated for 8.4.14 release.
+ * changes: Updates for 8.5a5 release
+
+2006-10-08 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkWindow.c: Implemented TIP #264 - Tk_Interp function.
+ * doc/WindowId.3: Documented Tk_Interp.
+ * generic/tk.decls: Added to the stubs interface and
+ * generic/tkDecls.h: regenerated.
+ * generic/tkStubsInit.c:
2006-10-05 Jeff Hobbs <jeffh@ActiveState.com>
* unix/tkUnixFont.c (Ucs2beToUtfProc, UtfToUcs2beProc):
(TkpFontPkgInit, encodingAliases): Correct alignment issues in
- encoding conversion. Call ucs-2be "unicode" on big-endian
- systems. [Bug 1122671]
-
-2006-09-27 Pat Thoyts <patthoyts@users.sourceforge.net>
+ encoding conversion. Call ucs-2be "unicode" on big-endian systems.
+ [Bug 1122671]
- * win/makefile.vc: Support MSVC8 and AMD64 target. Also try using
- * win/rules.vc: sed to generate the manifest (cross-compile cannot
- * win/nmakehlp.c: execute tclsh). If no sed, use the tclsh exe.
+2006-09-27 Andreas Kupries <andreask@activestate.com>
-2006-09-25 Andreas Kupries <andreask@activestate.com>
-
- * generic/tkConsole.c: Complete reversal of the changes of Sep 22.
- * generic/tkMain.c: For compat reason the Tcl core will not change
- * generic/tkWindow.c: the registered version to include the patchlevel,
- * library/tk.tcl: making the changes to Tk unnecessary.
- * unix/configure:
- * unix/Makefile.in:
- * unix/tcl.m4:
- * win/configure:
- * win/Makefile.in:
- * win/makefile.vc:
- * win/rules.vc:
- * win/tcl.m4:
+ * unix/Makefile.in (install-binaries): Added a second guard to the
+ * win/Makefile.in: package index file to prevent older versions of Tcl
+ * win/makefile.vc: from seeing version numbers which may contain a/b
+ information, and then balking on them. This could otherwise happen
+ when Tcl/Tk 8.4 and 8.5 are installed in the same directory, seeing
+ each other. [Bug 1566418]
2006-09-22 Andreas Kupries <andreask@activestate.com>
@@ -1510,16 +4910,16 @@
* win/rules.vc:
* win/tcl.m4:
-2006-09-22 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2006-09-20 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkImgBmap.c (ImgBmapPostscript): Use NULL instead of 0 as
- end-of-strings marker to Tcl_AppendResult; the difference matters on
- 64-bit machines. [Bug 1562528]
+ * win/tkWinMenu.c (TkpPostMenu): disable menu animation in menus with
+ images to avoid clipping bug. [Bug 1329198]
-2006-09-20 Jeff Hobbs <jeffh@ActiveState.com>
+2006-09-21 Donal K. Fellows <dkf@users.sf.net>
- * win/tkWinMenu.c (TkpPostMenu): disable menu animation in menus
- with images to avoid clipping bug. [Bug 1329198]
+ * generic/tkImgBmap.c (ImgBmapPostscript): Change 0 to NULL, since
+ they are not interchangable on all platforms in all circumstances.
+ [Tcl Bug 1562528]
2006-09-11 Daniel Steffen <das@users.sourceforge.net>
@@ -1540,22 +4940,23 @@
2006-09-10 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXColor.c (TkSetMacColor, TkpGetColor): use AppearanceMgr
+ * macosx/tkMacOSXColor.c (TkSetMacColor,TkpGetColor): use AppearanceMgr
* macosx/tkMacOSXDefault.h: to retrieve platform std colors for text
* macosx/tkMacOSXPort.h: selections, add "systemHighlightSecondary"
- color name for standard color of inactive selections.
+ color name for standard color of inactive selections, use this color as
+ default for text widget -inactiveselectbackground to implement platform
+ standard look for inactive text selections.
- * library/text.tcl (aqua): change focus bindings to implement platform
- standard look for inactive text selections using this new color.
+ * library/text.tcl (aqua): remove focus bindings to set selection color
- * generic/tkTextBTree.c (TkTextIsElided): on TkAqua, don't show text
- * generic/tkTextDisp.c (GetStyle): selection when text widget
- * generic/tkText.c (TextEventProc): is in disabled state.
+ * generic/tkTextBTree.c (TkTextIsElided): on TkAqua, don't show
+ * generic/tkTextDisp.c (GetStyle): inactive text selection when
+ text widget is disabled.
* generic/tkEntry.c (DisplayEntry): change default TkAqua selection
* macosx/tkMacOSXDefault.h: relief to "flat" (platform std).
- * generic/tkText.c (Tk_TextCmd): fix bug leading to default text
+ * generic/tkText.c (CreateWidget): fix bug leading to default text
selection relief string DEF_TEXT_SELECT_RELIEF being ignored.
* macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): allow mouse
@@ -1572,32 +4973,28 @@
* macosx/tkMacOSXMenu.c (DrawMenuEntryLabel): fix leak. [Bug 1554672]
- * macosx/Makefile: workaround bug in 'cp -pRH' on Darwin 6 and earlier,
- fixes 'make embedded' failure reported on tcl-mac; fix error from 'make
- deploy' with same build tree as previous 'make embedded'.
+ * macosx/GNUmakefile: workaround bug in 'cp -pRH' on Darwin 6 and
+ earlier, fixes 'make embedded' failure reported on tcl-mac; fix error
+ from 'make deploy' with same build tree as previous 'make embedded'.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new tclUnixCompat.c file.
* macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): fix typo.
* unix/tcl.m4: sync with tcl/unix/tcl.m4.
-
-2006-09-07 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkWindow.c: add #include "tclInt.h" now required due to use
- of tcl internal Tcl_CreateNamespace() in previous commit.
+ * unix/configure: autoconf-2.59
2006-09-06 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkEntry.c: move hard-coded ALWAYS_SHOW_SELECTION
- * generic/tkInt.h: control of entry/text selection display
- * generic/tkText.c: based on focus to the Tcl level,
- * generic/tkTextBTree.c: controlled by ::tk::AlwaysShowSelection
- * generic/tkTextDisp.c: (boolean, private). [Bug 1553691]
- * generic/tkWindow.c:
- * library/tk.tcl
+ * generic/tkEntry.c: move hard-coded ALWAYS_SHOW_SELECTION control
+ * generic/tkInt.h: of entry/text selection display based on focus
+ * generic/tkText.c: to the Tcl level, controlled by
+ * generic/tkWindow.c: ::tk::AlwaysShowSelection (boolean, private).
+ * library/tk.tcl: [Bug 1553691]
+ * macosx/tkMacOSXDefault.h:
+ * unix/tkUnixDefault.h:
* unix/tkUnixPort.h:
-
- * generic/tkText.c (DeleteChars): backport of 8.5 text delete
- speedup that removes tags from deleted area first. [Bug 1456342]
+ * win/tkWinDefault.h:
2006-08-30 Jeff Hobbs <jeffh@ActiveState.com>
@@ -1616,33 +5013,44 @@
event loop: limit the number of tcl events processed per invocation.
Fixes bug reported on tcl-mac by Kevan Hashemi.
+2006-08-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * tests/text.test (text-25.15): Added test suggested by Sam
+ <baudinm@yahoo.com> on comp.lang.tcl
+
+ * generic/tk.h, generic/tkInt.h: Stylistic improvements. No API change.
+
2006-08-18 Daniel Steffen <das@users.sourceforge.net>
* unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for
universal builds including x86_64, for 64-bit CoreFoundation on Leopard
- and for use of -mmacosx-version-min instead of MACOSX_DEPLOYMENT_TARGET.
+ and for use of -mmacosx-version-min instead of MACOSX_DEPLOYMENT_TARGET
* unix/configure.in (Darwin): remove 64-bit arch flags from CFLAGS for
- combined 32-bit and 64-bit universal builds, as neither TkAqua nor TkX11
- can be built for 64-bit at present.
- * unix/configure: autoconf-2.13
+ combined 32-bit and 64-bit universal builds, as neither TkAqua nor
+ TkX11 can be built for 64-bit at present.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+ * macosx/Wish.xcodeproj/project.pbxproj: switch native release targets
+ to use DWARF with dSYM, Xcode 3.0 changes.
* macosx/README: updates for x86_64 support in Tcl.
* macosx/tkMacOSXInit.c (TkpInit): when available, use public
- TransformProcessType() API instead of CPSEnableForegroundOperation() SPI
- to notify the window server that we are a GUI application.
+ TransformProcessType() API instead of CPSEnableForegroundOperation()
+ SPI to notify the window server that we are a GUI application.
- * macosx/tkMacOSXWm.c (WmAttrGetTitlePath): use HIWindow API on >=Tiger.
+ * macosx/tkMacOSXWm.c (WmAttrGetTitlePath): use HIWindow API on >=Tiger
* macosx/tkMacOSXMouseEvent.c (GenerateToolbarButtonEvent):
* macosx/tkMacOSXMenus.c (GenerateEditEvent):
- * macosx/tkMacOSXMenu.c (MenuSelectEvent): bzero XVirtualEvent structure
- before use to ensure all fields are initialized. [Bug 1542205]
+ * macosx/tkMacOSXMenu.c (MenuSelectEvent): bzero() the XVirtualEvent
+ structure before use to ensure all fields are initialized. [Bug
+ 1542205]
2006-08-16 Jeff Hobbs <jeffh@ActiveState.com>
- * macosx/tkMacOSXWm.c (WmAttributesCmd): correct OS X result for
- [wm attributes $top].
+ * macosx/tkMacOSXWm.c (WmAttributesCmd): correct OS X result for [wm
+ attributes $top].
2006-07-25 Daniel Steffen <das@users.sourceforge.net>
@@ -1654,14 +5062,16 @@
* macosx/tkMacOSXWm.c (TkWmMapWindow): fix incorrect values of wmInfo
parentWidth/Height for toplevels by recalculating them once the window
- is mapped (i.e once the window&structure sizes are known). [Bug 1358663]
+ is mapped (i.e once the window&structure sizes are known). [Bug
+ 1358663]
(ParseGeometry): sync with ParseGeometry in tkUnixWm.c/tkWinWm.c.
2006-07-21 Daniel Steffen <das@users.sourceforge.net>
* generic/tkBind.c (TkBindInit): for REDO_KEYSYM_LOOKUP, change
- keysym-to-string mapping hash to use first name in ks_names.h instead of
- last (if there are multiple possibilities), e.g. "F11" instead of "L1".
+ keysym-to-string mapping hash to use first name in ks_names.h instead
+ of last (if there are multiple possibilities), e.g. "F11" instead of
+ "L1".
* macosx/tkMacOSXKeyboard.c (TkpGetKeySym): correct keysyms for pure
modifier key presses [Bugs 700311, 1525905]; correct keysym for Enter
@@ -1670,15 +5080,24 @@
2006-07-20 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): add support
- for weakly importing symbols not available on OSX 10.2 or 10.3, enables
- binaires built on later OSX versions to run on earlier ones.
+ * unix/tkUnixSend.c (Tk_GetUserInactiveTime): for weakly
+ importing symbols not available on OSX 10.2 or 10.3, enables binaires
+ built on later OSX versions to run on earlier ones.
+ * macosx/Wish.xcodeproj/project.pbxproj: enable weak-linking; turn on
+ extra warnings.
* macosx/README: document how to enable weak-linking; cleanup.
- * unix/configure.in: enforce requirement of OSX 10.2 for TkAqua; move
- * unix/tcl.m4: Darwin specific checks & defines that are only
- relevant to the tcl build out of tcl.m4; restrict framework option to
- Darwin; cleanup quoting.
- * unix/configure: autoconf-2.13
-
+ * unix/configure.in: add check on Darwin-X11 for ld support of -weak-l
+ * unix/tcl.m4: flag and weak-link libXss if possible as it is not
+ available before OSX 10.4; enforce requirement of OSX 10.2 for TkAqua;
+ move Darwin specific checks & defines that are only relevant to the tcl
+ build out of tcl.m4; restrict framework option to Darwin; clean up
+ quoting and help messages.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * macosx/GNUmakefile: enable xft for TkX11 build.
+ * macosx/tkMacOSXFont.c (TkMacOSXQuarzStartDraw, TkMacOSXQuarzEndDraw):
+ verify validity of context returned from QDBeginCGContext() before use.
* macosx/tkMacOSXKeyEvent.c: ifdef out diagnostic messages to stderr.
* macosx/tkMacOSXEvent.h: standardize MAC_OS_X_VERSION_MAX_ALLOWED
@@ -1688,17 +5107,19 @@
* macosx/tkMacOSXMouseEvent.c:
* macosx/tkMacOSXWm.c:
+ * generic/tkImgGIF.c (ReadImage):
* macosx/tkMacOSXCursor.c (TkMacOSXCursor):
* macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol):
- * macosx/tkMacOSXInit.c (Map): fix signed-with-unsigned comparison and
- other warnings from gcc4 -Wextra.
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext):
+ * macosx/tkMacOSXInit.c (Map):
+ * xlib/xgc.c (XCreateGC): fix signed-with-unsigned comparison and other
+ warnings from gcc4 -Wextra.
2006-07-14 Andreas Kupries <andreask@activestate.com>
- * generic/tkWindow.c (Initialize): Modify change of 2006-05-25
- (jeffh). Release mutex a bit earlier, to prevent lock when OS X
- creates its console windows (recursively enters Tk_Init). Patch
- by JeffH.
+ * generic/tkWindow.c (Initialize): Modify change of 2006-05-25 (jeffh).
+ Release mutex a bit earlier, to prevent lock when OS X creates its
+ console windows (recursively enters Tk_Init). Patch by JeffH.
2006-07-06 Jeff Hobbs <jeffh@ActiveState.com>
@@ -1706,30 +5127,20 @@
2006-06-21 Jeff Hobbs <jeffh@ActiveState.com>
- * library/bgerror.tcl (::tk::dialog::error::bgerror): remove a
- couple of unnecessary hardcoded options
-
-2006-06-15 Don Porter <dgp@users.sourceforge.net>
-
- * changes: changes to start prep for an 8.4.14 release.
-
-2006-06-15 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/makefile.vc: Sync with tcl to enable building with
- * win/rules.vc: VC8 (VS2005 C compiler)
- * win/nmakehlp.c:
+ * library/bgerror.tcl (::tk::dialog::error::bgerror): remove a couple
+ of unnecessary hardcoded options
2006-06-14 Don Porter <dgp@users.sourceforge.net>
- * generic/tkScale.c: Revised variable writing logic to account
- for [scale]'s design that it deals with its value as a formatted
- string, and not as a double. [Bug 891141].
+ * generic/tkScale.c: Revised variable writing logic to account for
+ [scale]'s design that it deals with its value as a formatted string,
+ and not as a double. [Bug 891141]
2006-06-14 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXSubwindows.c (TkMacOSXInvalidateWindow): ensure invalid
- clip regions are recreated via TkMacOSXUpdateClipRgn() before they are
- used; correct call order of TkMacOSXInvalidateWindow() and
+ * macosx/tkMacOSXSubwindows.c (TkMacOSXInvalidateWindow): ensure
+ invalid clip regions are recreated via TkMacOSXUpdateClipRgn() before
+ they are used; correct call order of TkMacOSXInvalidateWindow() and
TkMacOSXInvalClipRgns() throughout. [Bug 1501922]
* macosx/tkMacOSXDraw.c (TkPutImage): implement drawing of very wide
@@ -1738,44 +5149,49 @@
2006-06-09 Don Porter <dgp@users.sourceforge.net>
- * generic/tkMain.c: Added Tcl_Preserve() call on the master
- interp as crash protection against any Tcl_DeleteInterp() call
- that might happen.
-
-2006-06-05 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkInt.h: Thread safety for the data structures of
- * generic/tkConsole.c: the wish [console]. [Bug 1188340].
+ * generic/tkMain.c: Added Tcl_Preserve() call on the master interp
+ as crash protection against any Tcl_DeleteInterp() call that might
+ happen.
-2006-06-01 Don Porter <dgp@users.sourceforge.net>
+2006-06-01 Don Porter <dgp@users.sourceforge.net>
- * generic/tkConsole.c: Added Tcl_RegisterChannel() calls to bump
- the refcount of channels passed to Tcl_SetStdChannel(). This prevents
- early free-ing of the channels that leads to crashes. [Bug 912571].
+ * generic/tkConsole.c: Added Tcl_RegisterChannel() calls to bump the
+ refcount of channels passed to Tcl_SetStdChannel(). This prevents early
+ free-ing of the channels that leads to crashes. [Bug 912571]
2006-05-29 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinEmbed.c (TkpGetOtherWindow): Do not panic if no window is
+ * unix/tkUnixEmbed.c (TkpGetOtherWindow): found; caller handles. [Bug
+ * unix/tkUnixWm.c (Tk_CoordsToWindow, UpdateGeometryInfo): 1212056]
+
* tests/entry.test (entry-22.1):
* tests/listbox.test (listbox-6.15):
* generic/tkListbox.c (ListboxInsertSubCmd, ListboxDeleteSubCmd):
- Ignore Tcl_SetVar2Ex failure of listVarName, similar to entry
- widget handling. [Bug 1424513]
+ Ignore Tcl_SetVar2Ex failure of listVarName, similar to entry widget
+ handling. [Bug 1424513]
2006-05-26 Jeff Hobbs <jeffh@ActiveState.com>
- * macosx/tkMacOSXButton.c (TkMacOSXDrawControl): correct redraw
- for direct transition from disabled to active state. [Bug 706446]
+ * macosx/tkMacOSXButton.c (TkMacOSXDrawControl): correct redraw for
+ direct transition from disabled to active state. [Bug 706446]
2006-05-25 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinMenu.c (TkWinMenuKeyObjCmd): get eventPtr after we know the
+ window is still alive. [AS bug 45987] [Bug 1236306]
+
* generic/tkMenu.c (DeleteMenuCloneEntries): Modify entry index
changes to work around VC6 optimization bug. [Bug 1224330]
* generic/tkMessage.c (MessageWidgetObjCmd): Correct msgPtr
preserve/release pairing. [Bug 1485750] (afredd)
- * generic/tkWindow.c (Initialize): Correct mutex (un)lock
- pairing. [Bug 1479587]
+ * generic/tkWindow.c (Initialize): Correct mutex (un)lock pairing.
+ [Bug 1479587] (loewis)
+
+ * generic/tkBind.c (Tk_BindEvent, TkCopyAndGlobalEval): use Tcl_EvalEx
+ instead of Tcl_GlobalEval.
2006-05-16 Daniel Steffen <das@users.sourceforge.net>
@@ -1793,30 +5209,31 @@
2006-05-12 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
- Fix opt added 2006-03 that caused slowdown for some common cases.
- [Bug 1409140]
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Fix
+ opt added 2006-03 that caused slowdown for some common cases. [Bug
+ 1409140]
2006-05-13 Daniel Steffen <das@users.sourceforge.net>
* generic/tkCanvWind.c (DisplayWinItem, WinItemRequestProc): ensure
canvas window items are unmapped when canvas is unmapped. [Bug 940117]
- * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): empty clip region
- of unmapped windows to prevent any drawing into them or into their
- children from becoming visible. [Bug 940117]
+ * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): empty clip
+ region of unmapped windows to prevent any drawing into them or into
+ their children from becoming visible. [Bug 940117]
* macosx/tkMacOSXInt.h: revert Jim's attempt of 2005-03-14 to
* macosx/tkMacOSXSubwindows.c: fix Bug 940117 as it disables Map/Unmap
- event propagation to children. [Bug 1480105]
+ event propagation to children. [Bug 1480105]
- * macosx/tkMacOSXDraw.c (TkPutImage): handle tkPictureIsOpen flag, fixes
- incorrect positioning of images with complex alpha on native buttons;
- actual alpha blending is still broken in this situation. [Bug 1155596]
+ * macosx/tkMacOSXDraw.c (TkPutImage): handle tkPictureIsOpen flag,
+ fixes incorrect positioning of images with complex alpha on native
+ buttons; actual alpha blending is still broken in this situation. [Bug
+ 1155596]
* macosx/tkMacOSXEvent.c (TkMacOSXProcessCommandEvent):
- * macosx/tkMacOSXMenus.c (TkMacOSXInitMenus): workaround carbon bug with
- key shortcut for 'Preferences' app menu item. [Bug 1481503]
+ * macosx/tkMacOSXMenus.c (TkMacOSXInitMenus): workaround carbon bug
+ with key shortcut for 'Preferences' app menu item. [Bug 1481503]
* macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): only check
for HICommand menu item shortcuts in the application menu.
@@ -1830,13 +5247,13 @@
2006-05-04 Don Porter <dgp@users.sourceforge.net>
- * README: Bump version number to 8.4.14
+ * README: Bump version number to 8.5a5
* generic/tk.h:
* unix/configure.in:
* unix/tk.spec:
* win/configure.in:
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
* win/configure:
2006-04-28 Daniel Steffen <das@users.sourceforge.net>
@@ -1855,64 +5272,56 @@
window-local pointer position.
* macosx/tkMacOSXInt.h: use improvements above to avoid calls to
- * macosx/tkMacOSXKeyEvent.c: GlobalToLocal() when the current port might
- * macosx/tkMacOSXMenu.c: not be set correctly. May fix [Bug 1243318]
- * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXKeyEvent.c: GlobalToLocal() when the current port
+ * macosx/tkMacOSXMenu.c: might not be set correctly. May fix [Bug
+ * macosx/tkMacOSXMenus.c: 1243318]
* macosx/tkMacOSXScale.c:
* macosx/tkMacOSXScrlbr.c:
* tkAboutDlg.r: update copyright.
- * macosx/tkMacOSXCarbonEvents.c: sync with HEAD
- * macosx/tkMacOSXDebug.c:
- * macosx/tkMacOSXDebug.h:
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXDebug.h: sync #includes with core-8-4-branch.
* macosx/tkMacOSXEvent.h:
* macosx/tkMacOSXFont.h:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXSend.c:
- * macosx/tkMacOSXTest.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
-2006-04-25 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2006-04-26 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5a4 TAGGED FOR RELEASE ***
+
+ * changes: Updates for next RC
+
+2006-04-25 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* unix/tkUnixFont.c (TkpGetFontFamilies): Fix crash caused when the
XServer returns invalid font names. [Bug 1475865]
-2006-04-22 Daniel Steffen <das@users.sourceforge.net>
+2006-04-23 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/scrollbar.test: fix to tkAqua test failures
+
+2006-04-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXEmbed.c: fix to [Bug 1088814] test failures in
+ embed.test
- * macosx/tkMacOSXEmbed.c:
* macosx/tkMacOSXWm.c:
* tests/constraints.tcl:
- * tests/wm.test: sync with 2006-04-18 commit to HEAD. (darley)
+ * tests/wm.test: fix to 'wm attributes' test for TkAqua
-2006-04-12 Don Porter <dgp@users.sourceforge.net>
+2006-04-11 Peter Spjuth <peter.spjuth@space.se>
- *** 8.4.13 TAGGED FOR RELEASE ***
+ * generic/tkWindow.c (Tk_NameToWindow): Allow NULL interp to
+ Tk_NameToWindow. This fixes TkGetWindowFromObj which promises to handle
+ NULL but didn't.
* generic/tkGrid.c: Fixed handling of out of bounds row or column.
* tests/grid.test: [Bug 1432666]
- * changes: Updates for next RC.
-
-2006-04-11 Jeff Hobbs <jeffh@ActiveState.com>
-
- * changes: update for bug fix.
+2006-04-11 Don Porter <dgp@users.sourceforge.net>
- * generic/tkBind.c (Tk_BindEvent, ChangeScreen): replace
- Tcl_GlobalEval with more efficient Tcl_EvalEx.
-
- * win/tkWinEmbed.c (TkpGetOtherWindow): do not panic if no window
- * win/tkWinWm.c (UpdateGeometryInfo): is found - handle it in
- * unix/tkUnixEmbed.c (TkpGetOtherWindow): the caller. [Bug 1212056]
- * unix/tkUnixWm.c (Tk_CoordsToWindow, UpdateGeometryInfo):
+ * unix/Makefile.in: Updated `make dist` target to be sure the
+ message catalogs for the widget demo get packaged into the source code
+ distribution. [Bug 1466509]
2006-04-11 Daniel Steffen <das@users.sourceforge.net>
@@ -1932,14 +5341,31 @@
* macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): prevent multiple init.
+ * macosx/tkMacOSXFont.c: remove #ifdef'd text measuring codepaths now
+ * macosx/tkMacOSXInit.c: known to be incorrect, cleanup obsolete text
+ * macosx/README: antialiasing control code, document ATSUI text
+ antialiasing changes.
+
* macosx/tkMacOSXInt.h: Implemented 'zoomed' window state
* macosx/tkMacOSXWindowEvent.c: handling for TkAqua, via titlebar
* macosx/tkMacOSXWm.c: widget clicks as well as [wm state].
* doc/wm.n: [Bug 1073456]
-2006-04-10 Don Porter <dgp@users.sourceforge.net>
+2006-04-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/tkfbox.tcl (::tk::IconList_Goto): Fix prefix searching so
+ that the start location is reasonable, and the prefix matching is using
+ the correct Tcl command for this. [Bug 1467938]
+
+2006-04-10 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
- * changes: Updates for next RC.
+ * macosx/tkMacOSXFont.c (MeasureStringWidth): Use implementation based
+ on ATSUGetGlyphBounds (TK_MAC_USE_GETGLYPHBOUNDS), so we can use
+ kATSUseFractionalOrigins. This in turn corrects [Bug 1461650].
+ (InitFont): Use "." and "W" instead of "i" and "w" to determine the
+ "-fixed" attribute. This prevents "Apple Chancery" from being
+ classified as fixed.
+ (InitFontFamilies): Only get the font families once.
2006-04-09 Daniel Steffen <das@users.sourceforge.net>
@@ -1959,81 +5385,138 @@
* macosx/tkMacOSXWm.c (TkMacOSXGrowToplevel): ensure QD port is set
correctly before using API relying on it.
-2006-04-06 Vince Darley <vincentdarley@users.sourceforge.net>
+2006-04-06 Vince Darley <vincentdarley@users.sourceforge.net>
- * macosx/tkMacOSXMouseEvent.c: now that [wm attributes -titlepath]
- works correctly, add OS support for dragging proxy icons and
- using the titlepath menu.
+ * macosx/tkMacOSXMouseEvent.c: Now that [wm attributes -titlepath]
+ works correctly, add OS support for dragging proxy icons and using the
+ titlepath menu.
2006-04-06 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): fix errors
- in setting/removing window proxy icons via [wm attributes -titlepath]
- and [wm iconbitmap], use HIWindow API on Tiger or later. [Bug 1455241]
+ * macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): fix errors in
+ setting/removing window proxy icons via [wm attributes -titlepath] and
+ [wm iconbitmap], use HIWindow API on Tiger or later. [Bug 1455241]
* unix/tcl.m4: remove TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING
define on Darwin. [Tcl Bug 1457515]
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
2006-04-05 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkWindow.c (Initialize): remove impotent use of
+ DeleteWindowsExitProc as a global exit handler.
+
+ * generic/tkMenu.c (TkSetWindowMenuBar): remove extra TkMenuInit call
+ that caused finalization panic. [Bug 1456851]
* win/tkWinMenu.c (FreeID, TkpNewMenu, MenuExitHandler)
- (MenuThreadExitHandler, TkpMenuInit, TkpMenuThreadInit): rework
- Windows menu init/finalization to better respect per-process and
- per-thread boundaries.
+ (MenuThreadExitHandler, TkpMenuInit, TkpMenuThreadInit): rework Windows
+ menu init/finalization to better respect per-process and per-thread
+ boundaries. [Bug 1456851]
+ (TkWinMenuKeyObjCmd): Do not error when unknown window is passed in.
+ [Bug 1236306]
+
+ * win/tkWinX.c (TkWinXInit): init default keyboard charset correctly.
+ [Bug 1374119] (pajas)
* win/tkWinWm.c (WmProc): pass WM_QUERYENDSESSION message to Tk as
WM_SAVE_YOURSELF wm protocol callback.
- * generic/tkTextDisp.c (TkTextPixelIndex): Don't segfault on full
- -elide text. [Bug 1442102]
+ * tests/textWind.test (textWind-10.6.1): prevent infinite update loop
+ in case of test failure.
+
+ * tests/wm.test (wm-attributes-1.2.4): correct expected result.
- * win/tkWinX.c (TkWinXInit): init default keyboard charset
- correctly. [Bug 1374119] (pajas)
+ * tests/grid.test: fix segfault on empty or "all" index list
+ * generic/tkGrid.c (GridRowColumnConfigureCommand): [Bug 1422430]
- * generic/tkText.c (DumpLine): stop dumping if we detect that the
- text widget state has changed while dumping. [Bug 1414171]
- (InsertChars, DeleteChars): fix undo with space-based path.
- * tests/text.test (text-25.14): [Bug 1452419]
+2006-04-05 Vince Darley <vincentdarley@users.sourceforge.net>
- * tests/grid.test: fix segfault on empty index list
- * generic/tkGrid.c (GridRowColumnConfigureCommand): [Bug 1422430]
+ * generic/tkText.c: fix to crash caused on some platforms by new tests
+ introduced to check for [Bug 1414171], which destroy the text widget in
+ the dump callback script.
2006-03-29 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkWindow.c (DeleteWindowsExitProc): added comments
- * generic/tkOption.c (TkOptionDeadWindow): handle
- OptionThreadExitProc being called before DeleteWindowsExitProc.
+ * generic/tkOption.c (TkOptionDeadWindow): handle OptionThreadExitProc
+ being called before DeleteWindowsExitProc.
+
+ * win/Makefile.in: convert _NATIVE paths to use / to avoid ".\"
+ path-as-escape issue.
2006-03-29 Don Porter <dgp@users.sourceforge.net>
+ * changes: Updates for next RC
+
* unix/tkUnixDefault.h: Changed "Black" to "#000000" and "White" to
"#ffffff" to work around the (broken?) X servers that do not accept
- those color names. [Bug 917433]
+ those color names. [Bug 917433]
2006-03-28 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkWindow.c (CreateTopLevelWindow): use thread exit
- handler for DeleteWindowsExitProc.
+ * unix/tcl.m4, win/tcl.m4: []-quote AC_DEFUN functions.
-2006-03-28 Pat Thoyts <patthoyts@users.sourceforge.net>
+2006-03-26 Vince Darley <vincentdarley@users.sourceforge.net>
- * win/makefile.vc: Avoid pipe problems on win98.
+ * generic/tkText.c:
+ * tests/text.test: Fix for elaborations of [Bug 1414171] for '$text
+ dump -command <script>' where script deletes large portions of the
+ text widget, or even destroys the widget.
-2006-03-28 Jeff Hobbs <jeffh@ActiveState.com>
+2006-03-28 Daniel Steffen <das@users.sourceforge.net>
- * win/configure, win/tcl.m4: define MACHINE for gcc builds as well.
- Needed by Tk for manifest generation.
+ * macosx/Wish.xcode/default.pbxuser: add '-singleproc 1' cli arg to
+ * macosx/Wish.xcodeproj/default.pbxuser: tktest to ease test debugging.
-2006-03-28 Daniel Steffen <das@users.sourceforge.net>
+ * macosx/Wish.xcode/project.pbxproj: removed $prefix/share from
+ * macosx/Wish.xcodeproj/project.pbxproj: TCL_PACKAGE_PATH as per change
+ to tcl/unix/configure.in of 2006-03-13.
+
+ * macosx/tkMacOSXDraw.c: sync whitespace & minor changes with
+ * macosx/tkMacOSXEvent.h: core-8-4-branch.
+ * macosx/tkMacOSXFont.h:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXNotify.c:
+
+2006-03-27 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for next RC
+
+2006-03-27 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
- * generic/tkFont.h: added prototype for TkFontGetFirstTextLayout()
- needed by tkMacOSXButton.c and tkMacOSXMenubutton.c.
+ * generic/tkTextDisp.c (MeasureChars): Fix calculations of start and
+ end of string. [Bugs 1325998, 1456157]
+
+2006-03-27 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgGIF.c (FileReadGIF): Stop crashes when the first GIF
+ frame does not define the overall size of the image. [Bug 1458234]
+
+2006-03-26 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c:
+ * generic/tkText.h:
+ * generic/tkTextBTree.c:
+ * tests/text.test: Fix for [Bug 1414171] for '$text dump -command
+ <script>' where 'script' actually modifies the widget during the
+ process.
+
+2006-03-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDraw.c (TkMacOSXSetUpCGContext):
+ * macosx/tkMacOSXFont.c (TkMacOSXQuarzStartDraw, TkMacOSXQuarzEndDraw):
+ performance improvements, sync similar code, formatting & whitespace.
+
+2006-03-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkTextDisp.c: Moved #ifdef MAC_OSX_TK code added by
+ * macosx/tkMacOSXColor.c: [Patch 638966] into platform specific files.
+ * macosx/tkMacOSXInt.h:
* macosx/tkMacOSX.h: Cleaned up & rationalized order of
- * macosx/tkMacOSXBitmap.c: #includes of tk and carbon headers;
- * macosx/tkMacOSXButton.c: sync whitespace, comments & minor
- * macosx/tkMacOSXCarbonEvents.c: changes with HEAD.
+ * macosx/tkMacOSXBitmap.c: #includes of tk and carbon headers.
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXCarbonEvents.c:
* macosx/tkMacOSXClipboard.c:
* macosx/tkMacOSXColor.c:
* macosx/tkMacOSXConfig.c:
@@ -2044,8 +5527,7 @@
* macosx/tkMacOSXEntry.c:
* macosx/tkMacOSXEvent.c:
* macosx/tkMacOSXEvent.h:
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXFont.h (new file):
+ * macosx/tkMacOSXFont.h:
* macosx/tkMacOSXHLEvents.c:
* macosx/tkMacOSXInit.c:
* macosx/tkMacOSXInt.h:
@@ -2055,55 +5537,99 @@
* macosx/tkMacOSXMenubutton.c:
* macosx/tkMacOSXMenus.c:
* macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXNotify.c:
* macosx/tkMacOSXRegion.c:
* macosx/tkMacOSXScale.c:
* macosx/tkMacOSXScrlbr.c:
* macosx/tkMacOSXSend.c:
* macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXTest.c:
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXWm.h:
* macosx/tkMacOSXXStubs.c:
-2006-03-27 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2006-03-23 Reinhard Max <max@tclers.tk>
- * generic/tkImgGIF.c (FileReadGIF): Stop crashes when the first GIF
- frame does not define the overall size of the image. [Bug 1458234]
+ * unix/tkUnixRFont.c (TkpMeasureCharsInContext): Copied over from
+ tkUnixFont.c to fix compiling with --enable-xft .
+
+ * unix/tk.spec: Cleaned up and completed. An RPM can now be built from
+ the tk source distribution with "rpmbuild -tb <tarball>".
+
+2006-03-23 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/textDisp.test: Updated expected error messages to match the
+ standardized formats established on 2005-11-17. [Bug 1370296]
2006-03-22 Don Porter <dgp@users.sourceforge.net>
- * changes: Updates for next RC.
+ * changes: Updates for next RC
2006-03-21 Daniel Steffen <das@users.sourceforge.net>
+ * generic/tkFont.c: implementation of ATSUI text rendering
+ * generic/tkInt.h: in TkAqua provided by Benjamin
+ * generic/tkTextDisp.c: Riefenstahl. [Patch 638966]
+ * library/demos/unicodeout.tcl:
+ * macosx/tkMacOSXFont.h (new file):
+ * macosx/tkMacOSXFont.c:
+ * tests/font.test:
+ * unix/tkUnixFont.c:
+ * win/tkWinFont.c:
+
+ * generic/tkFont.c: moved MODULE_SCOPE declarations of font
+ * generic/tkFont.h: helper procs into header files.
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXFont.h:
+ * macosx/tkMacOSXMenubutton.c:
+
+ * macosx/Wish.xcode/project.pbxproj: add new tkMacOSXFont.h file,
+ * macosx/Wish.xcodeproj/project.pbxproj: turn off dead code stripping
+ as it interferes with -sectcreate (rdar://4486223).
+
+ * macosx/Wish.xcode/default.pbxuser: add TCLLIBPATH=/Library/Tcl
+ * macosx/Wish.xcodeproj/default.pbxuser: env var setting to tktest.
+
* unix/configure.in: fix detection of symbols build when enabling
TkAqua debug code; filter nm output of libtclstub better to avoid
- error on intel macs [Bug 1415789].
- * unix/configure: autoconf-2.13
+ error on intel macs. [Bug 1415789]
+ * unix/configure: autoconf-2.59
+
+2006-03-20 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Added exit handler to clean up the interp where
+ the console window lives. Also added code to handle multiple calls to
+ Tk_CreateConsoleWindow so that the console channels connect to the last
+ console window opened, in compatibility with the previous
+ implementation.
-2006-03-20 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2006-03-18 Vince Darley <vincentdarley@users.sourceforge.net>
- * generic/tkUndo.c (TkUndoSetDepth): Fix a crash in the undo stack
- code. [Bug 1380427, Patch 1391939] Thanks to <lz_ufo@tin.it> for
- reporting and Ludwig Callewaert for the fix.
+ * generic/tkText.c: Fix for undo/modified status of text widgets when
+ empty strings are inserted and undone.
2006-03-17 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/clrpick.tcl: bug #1451587: avoid using abbreviated
- * library/palette.tcl: sub-commands in core scripts as this can
- * library/scale.tcl: cause problems with mega-widget libraries
- * library/scrlbar.tcl: like snit.
+ * library/clrpick.tcl: Avoid using abbreviated sub-commands in core
+ * library/palette.tcl: scripts as this can cause problems with
+ * library/scale.tcl: mega-widget libraries like snit.
+ * library/scrlbar.tcl: [Bug 1451587]
* library/tkfbox.tcl:
* library/xmfbox.tcl:
-2006-03-16 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2006-03-16 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Substantial rewrite of [console] support.
+ * generic/tkInt.h: Included Obj-ification of the [console] and
+ [consoleinterp] commands, and reworking of all the supporting data
+ structures for cleaner sharing and lifetime management especially in
+ multi-threaded configurations.
+
+2006-03-16 Donal K. Fellows <dkf@users.sf.net>
* library/msgs/pt.msg: Messages for Portuguese (strictly just for
Brazilian Portuguese, but they'll do until we get other Portuguese
- speakers localize) from Ricardo Jorge <ricardoj@users.sf.net> and
- Silas Justiano <silasj@users.sf.net>. Many thanks! [Bug 1405069]
+ speakers localize) from Ricardo Jorge <ricardoj@users.sf.net> and Silas
+ Justiano <silasj@users.sf.net>. Many thanks! [Bug 1405069]
* generic/tkImgPhoto.c (ImgPhotoCmd, Tk_PhotoPutBlock)
(Tk_PhotoPutZoomedBlock): Added hack to detect copying of a photo with
@@ -2111,7 +5637,7 @@
This should speed up many photo-to-photo copies, keeping the cost of
the alpha channel down.
-2006-03-15 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2006-03-15 Donal K. Fellows <dkf@users.sf.net>
* generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Try
to squelch performance issue with code that writes to large images by
@@ -2120,65 +5646,54 @@
2006-03-13 Don Porter <dgp@users.sourceforge.net>
- * tests/scrollbar.test: Corrected several broken calls to [testmetrics]
+ * tests/scrollbar.test: Corrected several broken calls to [testmetrics]
that were crashing the test suite.
- * tests/constraints.tcl: Added notAqua constraint to canvPs-3.1
- * tests/canvPs.test: to stop test suite crash on Mac OSX.
+ * tests/constraints.tcl: Added notAqua constraint to canvPs-3.1
+ * tests/canvPs.test: to stop test suite crash on Mac OSX.
[Bug 1088807]
- * generic/tkCmds.c: Purged remaining references to
- * macosx/tkMacOSXPort.h: errno, and errno.h. Standardized
- * macosx/tkMacOSXWm.c: the logic for using header files from
- * macosx/tkMacOSXWm.h: the compat directory. Thanks Joe
- * unix/tkUnixPort.h: English for the patch. [Patch 1445404]
+ * generic/tkCmds.c: Purged remaining references to errno,
+ * macosx/tkMacOSXPort.h: and errno.h. Standardized the logic
+ * macosx/tkMacOSXWm.c: for using header files from the compat
+ * macosx/tkMacOSXWm.h: directory. Thanks Joe English for the
+ * unix/tkUnixPort.h: patch. [Patch 1445404]
+
+2006-03-08 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: Update `make dist` to copy the image files needed
+ by the test suite into the source distro. This was overlooked in the
+ 2005-10-12 commit.
-2006-03-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * changes: Update in prep. for 8.5a4 release.
- * library/bgerror.tcl (::tk::dialog::error::bgerror): Truncated error
- details were getting lost, leading to unreadable error messages.
+2006-03-07 Joe English <jenglish@users.sourceforge.net>
-2006-03-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * unix/tcl.m4: Set SHLIB_LD_FLAGS='${LIBS}' on NetBSD, as per the other
+ *BSD variants. [Bug 1334613]
+ * unix/configure: Regenerated.
+
+2006-03-07 Donal K. Fellows <dkf@users.sf.net>
* doc/canvas.n: Added note that stipples are not well-supported on
non-X11 platforms. [Bug 220787] It's not a great solution, but it does
indicate the state of affairs that has existed for years anyway; not
much modern software uses stipples anyway.
-2006-03-07 Don Porter <dgp@users.sourceforge.net>
-
- * READNE: Bump version number to 8.4.13 and update
- * changes: changes to start prep for an 8.4.13 release.
- * generic/tk.h:
- * unix/configure{.in}:
- * unix/tk.spec:
- * win/configure{.in}:
-
2006-03-02 Jeff Hobbs <jeffh@ActiveState.com>
- * win/Makefile.in: convert _NATIVE paths to use / to avoid ".\"
- path-as-escape issue.
-
- * unix/tcl.m4, win/tcl.m4: []-quote ac_defun functions.
-
- * macosx/tkMacOSXDraw.c (TkPutImage): fix endian issue on OS X x86
- displaying images. Bitmap images still have a black/white
- reversal issue, appears to be a general OS X issue (as seen in
- frogger demo).
-
-2006-03-02 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * unix/tcl.m4: Fix for tk bug #1334613 to sort out shared library
- * unix/configure: issues on NetBSD. Regenerated configure script.
+ * macosx/tkMacOSXDraw.c (TkPutImage): Fix endian issue on OS X x86
+ displaying images. Bitmap images still have a black/white reversal
+ issue, appears to be a general OS X issue (as seen in frogger demo).
2006-02-27 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* generic/tkBitmap.c (Tk_GetBitmapFromData): Improve thread-safety.
[Bug 470322]
- * generic/tkImgBmap.c (ImgBmapConfigureInstance): Force creation of
- new Pixmaps before deletion of old ones to prevent stupid caching
- problems. [Bug 480862]
+ * generic/tkImgBmap.c (ImgBmapConfigureInstance): Force creation of new
+ Pixmaps before deletion of old ones to prevent stupid caching problems.
+ [Bug 480862]
2006-02-09 Daniel Steffen <das@users.sourceforge.net>
@@ -2191,28 +5706,21 @@
* generic/tk.h: move TkAqua specific REDO_KEYSYM_LOOKUP define
* macosx/tkMacOSXPort.h: out of tk.h into platform header.
-2006-01-25 Don Porter <dgp@users.sourceforge.net>
+2006-01-31 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/bgerror.tcl (::tk::dialog::error::bgerror): Finish the
+ internationalization of the error dialog. [Bug 1409264]
- * library/bgerror.tcl: Updates to use Tcl 8.4 features. [Patch 1237759]
- * library/button.tcl:
+2006-01-25 Don Porter <dgp@users.sourceforge.net>
+
+ * library/bgerror.tcl: Updates to use Tcl 8.4 features. [Patch 1237759]
* library/choosedir.tcl:
- * library/clrpick.tcl:
* library/comdlg.tcl:
* library/console.tcl:
* library/dialog.tcl:
- * library/entry.tcl:
* library/focus.tcl:
- * library/listbox.tcl:
- * library/menu.tcl:
* library/msgbox.tcl:
* library/palette.tcl:
- * library/panedwindow.tcl:
- * library/safetk.tcl:
- * library/scale.tcl:
- * library/scrlbar.tcl:
- * library/spinbox.tcl:
- * library/tearoff.tcl:
- * library/text.tcl:
* library/tk.tcl:
* library/tkfbox.tcl:
* library/xmfbox.tcl:
@@ -2224,16 +5732,33 @@
2006-01-20 Joe English <jenglish@users.sourceforge.net>
- * generic/tkEvent.c, unix/tkUnixEvent.c: XIM fixes
- [See #905830, patch tk84-xim-fixes.patch].
- + Revert 2005-12-05 patch disabling XIM when SCIM in use;
- + Make sure all X events get passed to XFilterEvent,
+ * generic/tkEvent.c, unix/tkUnixEvent.c: XIM fixes [See 905830, patch
+ tk84-xim-fixes.patch], and revert 2005-12-05 patch disabling XIM when
+ SCIM in use, and make sure all X events get passed to XFilterEvent,
including those without a corresponding Tk window.
-2006-01-10 Daniel Steffen <das@users.sourceforge.net>
+2006-01-13 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * generic/tkUndo.c (TkUndoSetDepth): Don't free TkUndoSubAtoms for
+ separator entries that are deleted: there is some unpredictable garbage
+ instead of subatoms.
+
+ Free both 'apply' and 'revert' action chains for non-separator entries.
- * macosx/tkMacOSXDraw.c: re-added inclusion of tclInt.h to allow access
- * macosx/tkMacOSXFont.c: to 8.4-internal Tcl_CreateNamespace().
+2006-01-12 Donal K. Fellows <dkf@users.sf.net>
+
+ TIP #260 IMPLEMENTATION
+
+ * generic/tkCanvText.c (TextItem, CreateText, DisplayCanvText):
+ * doc/canvas.n: Code, docs and tests to implement an -underline
+ * tests/canvText.test: option for canvases' text items.
+
+2006-01-11 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkGrid.c: Removed a lingering error message from TIP#147
+ implementation.
+
+2006-01-10 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXDebug.c: add TkMacOSXGetNamedDebugSymbol() function
* macosx/tkMacOSXDebug.h: that finds unexported symbols in loaded
@@ -2244,21 +5769,37 @@
* macosx/tkMacOSXCarbonEvents.c: fix debug event tracing on Tiger.
* macosx/tkMacOSXMenu.c: add debug menu printing during reconfigure.
* macosx/tkMacOSXInit.c: conditionalize 64bit-unsafe dyld code.
- * macosx/Makefile: add 'wish8.x' symlink to SYMROOT.
+ * macosx/GNUmakefile: add 'wish8.x' symlink to SYMROOT.
+
+ * macosx/Wish.xcode/project.pbxproj: fix copy to tktest resource
+ * macosx/Wish.xcodeproj/project.pbxproj: fork when zerolinked.
+
+ * macosx/Wish.xcode/default.pbxuser: add widget demo as argument to
+ * macosx/Wish.xcodeproj/default.pbxuser: executables (on by default).
* unix/configure: add caching, use AC_CACHE_CHECK instead of
* unix/configure.in: AC_CACHE_VAL where possible, consistent message
- * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes and
- gratuitous formatting differences, fix SC_CONFIG_MANPAGES with default
- argument, Darwin improvements to SC_LOAD_*CONFIG.
+ * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes
+ and gratuitous formatting differences, fix SC_CONFIG_MANPAGES with
+ default argument, Darwin improvements to SC_LOAD_*CONFIG.
+
+2005-12-28 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkUndo.c (TkUndoSetDepth): Apply [Patch 1391939] from Ludwig
+ Callewaert to fix [Bug 1380427].
+
+2005-12-14 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcodeproj/project.pbxproj: add new tclTomMath* files.
2005-12-13 Daniel Steffen <das@users.sourceforge.net>
* library/demos/cscroll.tcl: add MouseWheel bindings for aqua.
* macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent,
- GenerateMouseWheelEvent): add support for kEventMouseScroll events
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent)
+ (GenerateMouseWheelEvent): add support for kEventMouseScroll events
(smooth mouse wheel scrolling from mighty mouse or scrolling trackpad)
by handling kEventMouseWheelMoved on application target as well as on
dispatcher, in order to pick up synthesized MouseWheel events from
@@ -2270,108 +5811,107 @@
* unix/tcl.m4, unix/configure: Fix sh quoting error reported in
bash-3.1+ [Bug 1377619] (schafer)
-2005-12-08 Daniel Steffen <das@users.sourceforge.net>
+2005-12-09 Mo DeJong <mdejong@users.sourceforge.net>
- * macosx/tkMacOSXDraw.c: remove inclusion of tclInt.h and use of tcl
- * macosx/tkMacOSXFont.c: internals wherever possible in tk/macosx, the
- * macosx/tkMacOSXInit.c: only remaining tcl internals in TkAqua are
- * macosx/tkMacOSXNotify.c: TclServiceIdle() in tkMacOSXScrlbr.c and
- * macosx/tkMacOSXScrlbr.c: Tcl_Get/SetStartupScript() in tkMacOSXInit.c
- [RFE 1336531].
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXXStubs.c: sync comments/whitespace with HEAD.
+ * win/tkWinWm.c (WinSetIcon): Don't check result of SetClassLong() or
+ SetClassLongPtr() since it was generating an incorrect error and the
+ MSDN docs indicate that the result need not be checked.
-2005-12-05 Jeff Hobbs <jeffh@ActiveState.com>
+2005-12-09 Mo DeJong <mdejong@users.sourceforge.net>
- *** 8.4.12 TAGGED FOR RELEASE ***
+ * win/configure: Regen.
+ * win/tcl.m4 (SC_CONFIG_CFLAGS): Define MACHINE for gcc builds. The
+ lack of a definition of this variable in the manifest file was causing
+ a runtime error in wish built with gcc.
- * generic/tkOldConfig.c (Tk_ConfigureWidget): fix the handling of
- TK_CONFIG_OPTION_SPECIFIED to be flagged appropriately in original
- Tk_ConfigSpec. This is *not* thread safe, but will be retained
- for 8.4.x and left out of 8.5.x. [Bug 749908]
+2005-12-09 Daniel Steffen <das@users.sourceforge.net>
-2005-12-05 Reinhard Max <max@tclers.tk>
+ * generic/tkInt.decls: Move all platform test sources from tk lib into
+ * generic/tkTest.c: tktest directly, removes requirement to export
+ * macosx/tkMacOSXTest.c:TkplatformtestInit from internal stubs table.
+ * unix/Makefile.in:
+ * win/Makefile.in:
+ * win/makefile.vc:
+ * win/tkWinTest.c:
+
+ * generic/tkIntPlatDecls.h:
+ * generic/tkStubInit.c: regen.
- * unix/tkUnixEvent.c (OpenIM): Added a workaround to allow at
- least ASCII and the Compose key when typing into text and entry
- widgets on a system that uses SCIM. This has to be taken out again
- once the SCIM problems have been fixed.
+2005-12-08 Jeff Hobbs <jeffh@ActiveState.com>
-2005-12-04 Daniel Steffen <das@users.sourceforge.net>
+ * win/tcl.m4: Add build support for Windows-x64 builds.
+ * win/configure: --enable-64bit now accepts =amd64|ia64 for
+ * win/Makefile.in: Windows 64-bit build variants (default: amd64)
+ * win/makefile.vc: [Bug 1369597]
+ (TKOBJS): add tkWinTest.obj to regular Tk obj for TkplatformtestInit
- * mac/README: add note that mac classic port is no longer supported.
+ * win/configure.in: Add CE build support (some C code fixes needed)
+ * win/wish.exe.manifest.in (new): manifest must map in MACHINE and
+ * win/rc/wish.exe.manifest (removed): VERSION to be correct.
+ * unix/Makefile.in: fix dist target for manifest dir change
-2005-12-01 Don Porter <dgp@users.sourceforge.net>
+ * generic/tkTextTag.c (TkTextTagCmd): use correct arraySize for peered
+ text widgets in [$text tag names]. [Bugs 1375069, 1374935]
- * changes: Update changes for 8.4.12 release
+2005-12-08 Daniel Steffen <das@users.sourceforge.net>
- * mac/tkMacWm.c: Restored consistent error checking and
- * macosx/tkMacOSXWm.c: messages among different platform's
- * tests/wm.test: [wm grid] commands. [Bug 1323972].
- * win/tkWinWm.c:
+ * macosx/tkMacOSXDraw.c: Remove inclusion of tclInt.h and use of tcl
+ * macosx/tkMacOSXFont.c: internals wherever possible in tk/macosx, the
+ * macosx/tkMacOSXInit.c: only remaining tcl internals in TkAqua are
+ * macosx/tkMacOSXNotify.c:TclServiceIdle() in tkMacOSXScrlbr.c and
+ * macosx/tkMacOSXScrlbr.c:Tcl_Get/SetStartupScript() in tkMacOSXInit.c
+ [RFE 1336531]
+
+ * macosx/tkMacOSXInt.h: sync comments with core-8-4-branch.
+
+2005-12-07 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixEvent.c (OpenIM): remove extraneous const
-2005-12-01 Kevin Kenny <kennykb@acm.org>
+2005-12-06 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * win/makefile.vc: restored buildability.
+ * doc/ConfigWidg.3 (TK_CONFIG_OPTION_SPECIFIED): Mentioned that the
+ flag is deprecated because it is not thread-safe.
-2005-12-01 Jeff Hobbs <jeffh@ActiveState.com>
+2005-12-05 Reinhard Max <max@suse.de>
- * library/menu.tcl (::tk::PostOverPoint): correct menu post near
- bottom of screen on Windows. [Bug 1353416]
+ * unix/tkUnixEvent.c (OpenIM): Added a workaround to allow at least
+ ASCII and the Compose key when typing into text and entry widgets on a
+ system that uses SCIM. This has to be taken out again once the SCIM
+ problems have been fixed.
2005-12-01 Daniel Steffen <das@users.sourceforge.net>
* unix/tcl.m4 (Darwin): fixed error when MACOSX_DEPLOYMENT_TARGET unset
* unix/configure: regen.
- * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents): added newly
- registered kEventAppAvailableWindowBoundsChanged to debugging code.
-
2005-11-30 Jeff Hobbs <jeffh@ActiveState.com>
- * win/tkWinWm.c (WmAttributesCmd): set (no)topmost window aspect
- before rewrapping. [Bug 1086049]
-
- * generic/tkImgGIF.c: cast calls to block_out
+ * win/tkWinWm.c (WmAttributesCmd): set (no)topmost window aspect before
+ rewrapping. [Bug 1086049]
- * win/Makefile.in: place TCL_BIN_DIR first in PATH for targets to
- get Tcl built dll first.
-
- * tests/scrollbar.test (6.22): fix rounding-error sensitive test
+ * macosx/tkMacOSXXStubs.c (TkpOpenDisplay, TkMacOSXDisplayChanged):
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
+ * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
+ * macosx/tkMacOSXEvent.h: Trap kEventAppAvailableWindowBoundsChanged
+ * macosx/tkMacOSXInt.h: event to watch for change in display size and
+ adjust internal state appropriately.
- * tests/textWind.test: use "Courier -12" on all platforms.
- Reduces Windows XP test errors in that file from 9 to 2 (13.2 and
- 13.9 still off-by-one pixel).
+ * doc/checkbutton.n: fix -selectcolor docs. [Bug 1083838]
- * win/tkWinWm.c (UpdateWrapper): Don't install frame menu on dead
- window. Backport of 1233635
+ * generic/tkImgGIF.c: cast calls to blockOut
- * generic/tkEvent.c: fix handling of ClientMessage handlers.
- [Bug 1289565 983920]
+ * win/Makefile.in: place TCL_BIN_DIR first in PATH for targets to get
+ Tcl built dll first.
+ Add tkWinTest.obj to tk84.dll to handle some needed test functions
+ being defined in stubs (TkplatformtestInit).
- * macosx/tkMacOSXEvent.h: define
- kEventAppAvailableWindowBoundsChanged for OS X < 10.3.
+ * tests/scrollbar.test (6.22): fix rounding-error sensitive test
2005-11-29 Jeff Hobbs <jeffh@ActiveState.com>
- * library/console.tcl (::tk::ConsoleInit): improve work-around to
- avoid '% ' from tclMain.c [Bug 1252259]
-
- * macosx/tkMacOSXXStubs.c (TkpOpenDisplay, TkMacOSXDisplayChanged):
- * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
- * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
- * macosx/tkMacOSXInt.h: Trap kEventAppAvailableWindowBoundsChanged
- event to watch for change in display size and adjust internal
- state appropriately.
-
- * win/tcl.m4: Add build support for Windows-x64 builds.
- * win/configure: --enable-64bit now accepts =amd64|ia64 for
- * win/Makefile.in: Windows 64-bit build variants (default: amd64)
- * win/makefile.vc: [Bug 1369597]
- * win/configure.in:
- * win/wish.exe.manifest.in (new): manifest must map in MACHINE
- * win/rc/wish.exe.manifest (removed): and VERSION to be correct.
+ * library/console.tcl (::tk::ConsoleInit): improve work-around to avoid
+ '% ' from tclMain.c. [Bug 1252259]
2005-11-27 Daniel Steffen <das@users.sourceforge.net>
@@ -2381,18 +5921,19 @@
LDFLAGS during configure), don't use -prebind when deploying on 10.4,
define TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING (rdar://3171542).
(SC_ENABLE_LANGINFO, SC_TIME_HANDLER): add/fix caching, fix obsolete
- autoconf macros. Sync with tk/unix/tcl.m4, sync whitespace with HEAD.
+ autoconf macros. Sync with tcl/unix/tcl.m4.
* unix/configure.in: fix obsolete autoconf macros, sync gratuitous
formatting/ordering differences with tcl/unix/configure.in.
- * unix/Makefile.in: add CFLAGS to wish/tktest link to make
- executable linking the same as during configure (needed to avoid
- loosing any linker relevant flags in CFLAGS, in particular flags
- that can't be in LDFLAGS). Avoid concurrent linking of wish and
- compiling of tkTestInit.o during parallel make, fix dependencies
- and flags for building tkMacOSXInit.o
+ * unix/Makefile.in: add CFLAGS to wish/tktest link to make executable
+ linking the same as during configure (needed to avoid loosing any
+ linker relevant flags in CFLAGS, in particular flags that can't be in
+ LDFLAGS). Avoid concurrent linking of wish and compiling of
+ tkTestInit.o during parallel make, fix dependencies and flags for
+ building tkMacOSXInit.o
(checkstubs, checkexports): dependency and Darwin fixes
+ (dist): add new macosx files.
* macosx/tkMacOSXEvent.c (TkMacOSXProcessEvent):
* macosx/tkMacOSXEvent.h:
@@ -2400,7 +5941,7 @@
* macosx/tkMacOSXCarbonEvents.c: install standard application event
handler, add & call functions to start and stop carbon even timer that
runs the tcl event loop periodically during a nested carbon event loop
- in the toolbox (e.g. during menutracking) to ensure tcl timers etc
+ in the toolbox (e.g. during menutracking) to ensure tcl timers etc.
continue to fire, register app event handler for menu tracking and HI
command carbon events, move menu event handling to new handlers for
those carbon events, no longer register for/handle appleevent carbon
@@ -2418,8 +5959,8 @@
* macosx/tkMacOSXMenu.c (TkpNewMenu):
* macosx/tkMacOSXMenubutton.c (MenuButtonInitControl):
- * macosx/tkMacOSXMenus.c (TkMacOSXHandleMenuSelect): switch to modern
- utf8 aware menu manager API, remove obsolete code, add error handling.
+ * macosx/tkMacOSXMenus.c (TkMacOSXHandleMenuSelect): switch to modern
+ utf-8 aware menu manager API, remove obsolete code, add error handling.
* macosx/tkMacOSXMenu.c:
* macosx/tkMacOSXMenus.c:
@@ -2430,152 +5971,315 @@
* macosx/tkMacOSXWm.c (UpdateSizeHints): remove code that is never
executed.
- * generic/tk.h: add/correct location of version numbers in macosx
- files.
+ * xlib/xgc.c (XCreateGC): sync with core-8-4-branch change.
+
+ * generic/tk.h: add/correct location of version numbers in macosx files
* generic/tkInt.h: clarify fat compile comment.
- * macosx/Wish.pbproj/default.pbxuser (new file):
+ * macosx/Wish.pbproj/default.pbxuser (new):
* macosx/Wish.pbproj/jingham.pbxuser:
- * macosx/Wish.pbproj/project.pbxproj: sync with HEAD.
-
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcodeproj/default.pbxuser (new):
+ * macosx/Wish.xcodeproj/project.pbxproj (new): new/updated projects for
+ Xcode 2.2 on 10.4, Xcode 1.5 on 10.3 & ProjectBuilder on 10.2, with
+ native tktest targets and support for universal (fat) compiles.
+
+ * macosx/Tk-Info.plist (removed):
+ * macosx/Wish-Info.plist (removed):
* macosx/buildTkConfig.tcl (removed): remove obsolete build files.
- * macosx/README: clarification/cleanup, sync with HEAD, document
+ * macosx/README: clarification/cleanup, document new Xcode projects and
universal (fat) builds via CFLAGS (i.e. ppc and i386 at the same time).
- * macosx/Makefile: add support for reusing configure cache, build
- target fixes.
+ * unix/Makefile.in:
+ * unix/aclocal.m4:
+ * unix/configure.in:
+ * macosx/configure.ac (new): add support for inclusion of
+ unix/configure.in by macosx/configure.ac, allows generation of a
+ config headers enabled configure script in macosx (required by Xcode
+ projects).
+ * macosx/GNUmakefile: rename from Makefile to avoid overwriting by
+ configure run in tk/macosx, add support for reusing configure cache,
+ build target fixes.
+
+ * generic/tk3d.h:
+ * generic/tkButton.h:
+ * generic/tkCanvas.c:
+ * generic/tkCanvas.h:
+ * generic/tkColor.h:
+ * generic/tkEntry.h:
+ * generic/tkFileFilter.h:
+ * generic/tkFont.c:
+ * generic/tkFont.h:
+ * generic/tkImage.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkInt.h:
* generic/tkMenu.c:
+ * generic/tkMenu.h:
+ * generic/tkMenubutton.h:
+ * generic/tkScale.h:
+ * generic/tkScrollbar.h:
+ * generic/tkSelect.h:
+ * generic/tkStubInit.c:
+ * generic/tkStubLib.c:
+ * generic/tkText.h:
+ * generic/tkUndo.h:
* macosx/tkMacOSXButton.c:
* macosx/tkMacOSXDebug.c:
* macosx/tkMacOSXDebug.h:
* macosx/tkMacOSXDialog.c:
* macosx/tkMacOSXDraw.c:
* macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXInt.h:
* macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
* macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXXStubs.c:
+ * macosx/tkMacOSXSend.c:
* macosx/tkMacOSXSubwindows.c:
- * xlib/xgc.c: declare functions and globals used only in own file as
- static, #ifdef out a few Xlib and aqua functions that are never called
- (sync with HEAD).
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+ * unix/tkUnixButton.c:
+ * unix/tkUnixMenu.c:
+ * xlib/xgc.c: ensure externally visible symbols not contained in stubs
+ table are declared as MODULE_SCOPE (or as static if not used outside of
+ own source file), #ifdef out a few Xlib and aqua functions that are
+ never called. These changes allow 'make checkstubs' to complete without
+ error on Darwin with gcc 4.
+ * macosx/tkMacOSXTest.c:
* macosx/tkMacOSXPort.h:
- * generic/tkInt.decls: correct signature of TkMacOSXHandleMenuSelect,
- add XSync to aqua Xlib stubs.
+ * win/tkWinTest.c:
+ * generic/tkInt.decls: add functions needed by tktest to internal stubs
+ table, correct signature of TkMacOSXHandleMenuSelect, add XSync to aqua
+ Xlib stubs.
+ * unix/tkUnixSend.c:
+ * generic/tkText.c:
* generic/tkTest.c: #ifdef unix only declarations.
(TestmetricsCmd): unify win and mac implementation.
+ (TestsendCmd): move to tkUnixSend.c to avoid access to global var.
+ (TesttextCmd): move to tkText.c to avoid having to put all the internal
+ text functions it uses into the stubs table.
* generic/tkTextDisp.c:
- * generic/tkTextBTree.c:
* macosx/tkMacOSXInit.c:
* macosx/tkMacOSXKeyEvent.c:
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXXStubs.c: fix gcc 4 warnings.
* macosx/tkMacOSXNotify.c:
- * macosx/tkMacOSXTest.c: sync with HEAD.
+ * macosx/tkMacOSXScrlbr.c: sync with core-8-4-branch.
+ * generic/tkIntDecls.h:
* generic/tkIntPlatDecls.h:
* generic/tkIntXlibDecls.h:
* generic/tkStubInit.c:
- * unix/configure: regen.
+ * unix/configure:
+ * unix/tkConfig.h.in: regen.
+
+2005-11-22 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-2005-11-22 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * library/tkfbox.tcl: Remove all references to data(curItem), as it is
+ no longer used. [Bug 600313]
+ (::tk::IconList_CurSelection): Renamed for clarity.
- * generic/tkFont.c (ParseFontNameObj, ConfigAttributesObj): Allow
- these functions to work with a NULL interp by making them check when
+ * doc/GetFont.3: Revert previous fix; a NULL interp is now legal.
+ * generic/tkFont.c (ParseFontNameObj, GetAttributeInfoObj): Allow these
+ functions to work with a NULL interp by making them check when
generating error messages. [Bug 1151523]
- * unix/tkUnixSelect.c (SelCvtToX, SelCvtFromX): Backport of fixes for
- * generic/tkSelect.c (TkSelDefaultSelection): "spaces in atom names"
- * tests/select.test (select-9.5): problems. [Bug 1353414]
+ * library/tkfbox.tcl (::tk::dialog::file::): Correct the quoting of the
+ script used in variable traces so that widget names with spaces in will
+ work. [Bug 1335485]
- * library/tkfbox.tcl (::tk::dialog::file::): Correct the quoting of
- the script used in variable traces so that widget names with spaces in
- will work. [Bug 1335485]
+2005-11-16 Vince Darley <vincentdarley@users.sourceforge.net>
-2005-11-16 Don Porter <dgp@users.sourceforge.net>
+ * doc/text.n: clarify left to right interpretation of index modifiers,
+ including the fact that validation occurs after each step. [Bug
+ 1357575]
- * changes: Update changes for 8.4.12 release
+2005-11-15 Joe English <jenglish@users.sourceforge.net>
- * README: Bump version number to 8.4.12
- * generic/tk.h:
- * macosx/Wish.pbproj/project.pbxproj:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
+ * unix/tkUnixWm.c, tests/unixWm.test, doc/wm.n: Support for [wm
+ attributes] on X11. [TIP#231, Patch 1062022]
- * unix/configure: autoconf
- * win/configure:
+2005-11-14 Joe English <jenglish@users.sourceforge.net>
+
+ * library/bgerror.tcl: Truncate error messages at 45 characters
+ instead of 30. [Bug 1224235]
-2005-11-16 Vince Darley <vincentdarley@users.sourceforge.net>
+2005-11-14 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * doc/text.n: clarify left to right interpretation of index
- modifiers, including the fact that validation occurs after
- each step [Bug 1357575]
+ * generic/tkSelect.c (TkSelDefaultSelection): Test select-9.5
+ highlighted further brokenness in this function.
+
+2005-11-13 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * unix/tkUnixSelect.c (SelCvtToX): Arrange for the parsing code to use
+ Tcl's list parsing code, another simplification that enables testing
+ of the [Bug 1353414] fix.
+
+ * unix/tkUnixSelect.c (SelCvtFromX): Generate string forms of the
+ advanced selection types in a Tcl_DString. This makes fixing [Bug
+ 1353414] trivial, and simplifies the code at the same time.
+ * tests/select.test (select-9.5): Added test for [Bug 1353414]
+
+2005-11-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkBind.c (ChangeScreen): More DString fixes from
+ * generic/tkTextWind.c (EmbWinLayoutProc): [Bug 1353022]
+ * win/tkWinMenu.c (SetDefaults):
+
+ * win/tkWinDialog.c (ConvertExternalFilename): Factored out the
+ encoding conversion and de-backslash-ing code that is used in many
+ places in this file.
+ (GetFileNameW, GetFileNameA, ChooseDirectoryValidateProc): Make sure
+ that data is freed correctly and that certain (hopefully impossible)
+ failure modes won't cause crashes. [Bug 1353022]
+
+2005-11-06 Pat Thoyts <pat@zsplat.freeserve.co.uk>
+
+ * unix/tcl.m4: Fix SHLIB_LD_LIBS for building tclkit on OpenBSD.
+ * unix/configure: regenerated
-2005-11-06 Pat Thoyts <patthoyts@users.sourceforge.net>
+2005-10-31 Vince Darley <vincentdarley@users.sourceforge.net>
- * unix/tcl.m4: Add missing LIBS for OpenBSD shared libary
+ * generic/tkText.c
+ * tests/textDisp.test: fix and test for [Bug 1333951] in '.text count
+ -displaylines'.
-2005-10-18 Don Porter <dgp@users.sourceforge.net>
+2005-10-18 Don Porter <dgp@users.sourceforge.net>
- * generic/tkMain.c: Rewrote code that sets the ::argv value
- to be sure conversion from the system encoding is complete before
- any processing sensitive to list-special characters is done.
- [Bug 1328926].
+ * generic/tkMain.c: Rewrote code that sets the ::argv value to be sure
+ conversion from the system encoding is complete before any processing
+ sensitive to list-special characters is done. [Bug 1328926]
2005-10-17 Jeff Hobbs <jeffh@ActiveState.com>
- * macosx/tkMacOSXScrlbr.c (UpdateControlValues): check geomMgrPtr
- is valid before checking type
+ * macosx/tkMacOSXScrlbr.c (UpdateControlValues): check geomMgrPtr is
+ valid before checking type
-2005-10-10 Jeff Hobbs <jeffh@ActiveState.com>
+2005-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/menu.tcl (::tk::MenuUnpost): remove leftover ] from string
+ equal mods of 2005-07-25. (sowadsky)
+
+2005-10-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinSend.c: Avoid using tcl internal headers and fix to
+ * win/tkWinSendCom.h: correctly link on all types of build (was
+ * win/tkWinSendCom.c: broken in static,msvcrt builds).
+
+2005-10-12 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * generic/tkInt.h: add MODULE_SCOPE and WORDS_BIGENDIAN checks
- that will work with OS X universal binary compiles. (steffen)
+ * tests/canvPs.test, tests/canvPsBmap.tcl, tests/canvPsImg.tcl:
+ * tests/imgPhoto.test, tests/menu.test: Arrange for the test suite to
+ only ever refer to images in the same directory as the tests. This
+ makes it possible to package the test suite itself as a starkit. Thanks
+ to David Zolli for suggesting this.
+
+2005-10-10 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkConfig.c (Tk_DeleteOptionTable, Tk_CreateOptionTable):
properly alloc/delete one more option. [Bug 1319720] (melbardis)
-2005-10-10 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * macosx/tkMacOSXInt.h: Move MODULE_SCOPE defn to tkInt.h and add
+ * generic/tkInt.h: WORDS_BIGENDIAN checks that will work with OS X
+ universal binary compiles. (steffen)
+
+ * generic/tkMenu.c (TkSetWindowMenuBar): do not call TkMenuInit if the
+ winPtr indicates TK_ALREADY_DEAD. This prevents reinit that creates a
+ Tk exit handler after all exit handlers should be called. [Bug 749908,
+ 1322294]
+
+2005-10-10 Vince Darley <vincentdarley@users.sourceforge.net>
- * tests/winfo.test: Wait until child window is visible
- * tests/wm.test: Modified test to match actual error output.
+ TIP #256 IMPLEMENTATION
+
+ * doc/text.n
+ * generic/tkText.c
+ * generic/tkText.h
+ * generic/tkTextBTree.c
+ * generic/tkTextDisp.c
+ * generic/tkTextImage.c
+ * generic/tkTextIndex.c
+ * generic/tkTextMark.c
+ * generic/tkTextTag.c
+ * generic/tkTextWind.c
+ * macosx/tkMacOSXDefault.h
+ * tests/text.test
+ * tests/textDisp.test
+ * unix/tkUnixDefault.h
+ * win/tkWinDefault.h: Implementation of TIP#256, adding a new text
+ widget configuration option '-tabstyle', with new tests and
+ documentation.
+
+ Also a fix for [Bug 1281228] (documentation and full implementation of
+ -strictlimits), and [Bug 1288677] (corrected elide behaviour), again
+ with more tests.
2005-10-04 Jeff Hobbs <jeffh@ActiveState.com>
- * library/dialog.tcl (::tk_dialog): add tkwait visibility before
- grab. [Bug 1216775]
+ * library/dialog.tcl (::tk_dialog): add tkwait visibility before grab.
+ [Bug 1216775]
+
+ * win/tkWinDialog.c (ChooseDirectoryValidateProc): reset stored path to
+ "" if it doesn't exist and -mustexist is true. [Bug 1309218] Remove
+ old-style dir chooser (no longer used).
+
+ * macosx/tkMacOSXInt.h: add MODULE_SCOPE definition check for extension
+ writers that access private headers on OS X and don't define it in
+ configure.
+
+2005-09-28 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tkUnixPort.h: Disabled inclusion of the private Tcl header
+ * win/tkWinPort.h: file tclInt.h. Tk ought to have a tiny and
+ shrinking number of calls of private Tcl routines. Each Tk source file
+ doing this should follow the convention in the macosx port and have its
+ own #include "tclInt.h".
+
+ * generic/tkEvent.c: Disabled calls to private Tcl routine
+ TclInExit(). See comment in TkCreateExitHandler() for full rationale.
- * win/tkWinDialog.c (ChooseDirectoryValidateProc): reset stored
- path to "" if it doesn't exist and -mustexist is true. [Bug 1309218]
+2005-09-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-2005-09-15 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * generic/tkEvent.c (TkCreateThreadExitHandler, TkFinalizeThread)
+ (TkDeleteThreadExitHandler): New internal API (from Joe Mistachkin) to
+ allow Tk to finalize itself correctly in a multi-threaded
+ environment. [Bug 749908]
+
+2005-09-14 Donal K. Fellows <dkf@users.sf.net>
* generic/tkOldConfig.c (GetCachedSpecs): Split out the code to
- manipulate the cached writable specs so that it can be reused from
- all the public Tk_Configure* functions.
+ manipulate the cached writable specs so that it can be reused from all
+ the public Tk_Configure* functions.
(Tk_ConfigureInfo, Tk_ConfigureWidget, Tk_ConfigureValue): Use the
factored out code everywhere, so we always manipulate the cache
correctly. [Bug 1288128]
+2005-09-13 Don Porter <dgp@users.sourceforge.net>
+
+ * win/winMain.c (WishPanic): Replaced TCL_VARARGS* macros with direct
+ use of stdarg.h conventions.
+
2005-09-11 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): check if
process is in front on MouseDown, otherwise request process activation
from BringWindowForward() via new isFrontProcess param.
- * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
- register our event handler on the dispatcher target for all carbon
- events of interest to TkAqua; this replaces event processing
- directly from the event queue and thus allows to capture events
- that are syntesized by Carbon and sent directly to the dispatcher
- and not to the event queue.
+ * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents): register
+ our event handler on the dispatcher target for all carbon events of
+ interest to TkAqua; this replaces event processing directly from the
+ event queue and thus allows to capture events that are syntesized by
+ Carbon and sent directly to the dispatcher and not to the event queue.
* macosx/tkMacOSXEvent.c: remove TkMacOSXCountAndProcessMacEvents(),
rename ReceiveAndProcessEvent() to TkMacOSXReceiveAndProcessEvent().
@@ -2584,14 +6288,20 @@
processed in our dispatcher target event handler.
* macosx/tkMacOSXNotify.c (CarbonEventsCheckProc): dispatch events
- directly via TkMacOSXReceiveAndProcessEvent(), but dispatch no
- more than four carbon events at one time to avoid starving other
- event sources.
+ directly via TkMacOSXReceiveAndProcessEvent(), but dispatch no more
+ than four carbon events at one time to avoid starving other event
+ sources.
* macosx/tkMacOSXEvent.c: formatting cleanup, move XSync() to XStubs,
* macosx/tkMacOSXEvent.h: removed obsolete kEventClassWish handling.
* macosx/tkMacOSXXStubs.c
+ * macosx/tkMacOSXEvent.h: declare macosx internal procs as MODULE_SCOPE
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXWindowEvent.c:
+
* macosx/tkMacOSXButton.c: conditionalize all debug message printing to
* macosx/tkMacOSXCursor.c: stderr via TK_MAC_DEBUG define.
* macosx/tkMacOSXDebug.c:
@@ -2607,13 +6317,26 @@
* macosx/tkMacOSXWm.c:
* unix/configure.in: define TK_MAC_DEBUG on aqua when symbols enabled.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
- * library/listbox.tcl: corrected comments.
+ * library/listbox.tcl: synced aqua MouseWheel bindings with
+ * library/scrlbar.tcl: core-8-4-branch.
* library/text.tcl:
* xlib/xcolors.c: fixed warning
+2005-08-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in (html): reverted/amended changes of 2005-08-23 that
+ broke TkAqua 'make install'; added BUILD_HTML_FLAGS optional var like
+ in tcl/unix/Makefile.in.
+
+2005-08-24 Donal K. Fellows <dkf@users.sf.net>
+
+ * tests/text.test (text-8.18): Fix punctuation of error message to
+ match good practice (actual message already fixed). [Bug 1267484]
+
2005-08-23 Jeff Hobbs <jeffh@ActiveState.com>
* macosx/tkMacOSXDialog.c: make dialogs ignore -initialfile "" and
@@ -2621,38 +6344,68 @@
2005-08-23 Mo DeJong <mdejong@users.sourceforge.net>
- * win/tkWin32Dll.c (DllMain): Replace old asm SEH
- approach with Kenny's new SEH implementation.
- [Tcl bug 1235544]
+ * win/tkWin32Dll.c (DllMain): Replace old asm SEH approach with Kenny's
+ new SEH implementation. [Tcl Bug 1235544]
+
+2005-08-23 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in: Subst BUILD_TCLSH and TCL_EXE.
+ * unix/configure: Regen.
+ * unix/configure.in: Update minimum autoconf version to 2.59. Invoke
+ SC_PROG_TCLSH and SC_BUILD_TCLSH.
+ * unix/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH):
+ * win/Makefile.in: Subst BUILD_TCLSH and TCL_EXE.
+ * win/configure: Regen.
+ * win/configure.in: Update minimum autoconf version to 2.59. Invoke
+ SC_BUILD_TCLSH.
+ * win/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH): Split confused search
+ for tclsh on PATH and build and install locations into two macros.
+ SC_PROG_TCLSH searches just the PATH. SC_BUILD_TCLSH determines the
+ name of the tclsh executable in the Tcl build directory. [Tcl Bug
+ 1160114] [Tcl Patch 1244153]
2005-08-22 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXButton.c:
* macosx/tkMacOSXDialog.c: fix warnings.
-2005-08-16 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2005-08-20 Joe Mistachkin <joe@mistachkin.com>
- * generic/tkOldConfig.c (Tk_ConfigureWidget, Tk_ConfigureInfo):
- (Tk_ConfigureValue, DeleteSpecCacheTable): Keep per-interpreter (and
- hence per-thread) copies of all the Tk_ConfigSpec tables so that
- Tk_Uids do not leak across threads. [Bug 749908]
+ * win/tkWinX.c: Fixed bad cast. [Bug 1216006]
-2005-08-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2005-08-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * generic/tkCanvLine.c, generic/tkCanvPoly.c, generic/tkCanvText.c:
- * generic/tkCanvas.c, generic/tkConfig.c, generic/tkFocus.c:
- * generic/tkFrame.c, generic/tkGrid.c, generic/tkImgPhoto.c:
- * generic/tkPack.c, generic/tkPanedWindow.c: Don't pass size_t
- arguments to Tcl_GetStringFromObj, even with casting; it's not
- portable to 64-bit systems. [Bug 1252702]
+ * doc/GetFont.3: Reworded to reflect the truth. [Bug 1151523]
-2005-08-09 Daniel Steffen <das@users.sourceforge.net>
+2005-08-16 George Peter Staplin <GeorgePS@XMission.com>
+
+ * doc/CrtItemType.3 prototypes were lacking [] after objv. Thus the man
+ page was wrong about the actual prototypes. This was verified by
+ studying tkCanvBmap.c.
+
+2005-08-13 Chengye Mao <chengye.geo@yahoo.com>
+
+ * generic/tkOldConfig.c: Fixed [Bug 1258604]. This bug was introduced
+ into the modfied Tk_ConfigureWidget. It failed to properly handle the
+ specFlags' bit TK_CONFIG_OPTION_SPECIFIED.
+
+2005-08-12 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkOldConfig.c (Tk_ConfigureWidget): Stop storing per-thread
+ data in global data structures. Store it in per-interpreter data (i.e.
+ per-thread data) instead. [Bug 749908]
+
+2005-08-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFrame.c (CreateFrame) and others: Don't use size_t when
+ working with Tcl_GetStringFromObj because it is not 64-bit clean. [Bug
+ 1252702]
+
+2005-08-04 Vince Darley <vincentdarley@users.sourceforge.net>
- * macosx/tkMacOSXCarbonEvents.c (new): moved carbon events code into
- * macosx/tkMacOSXHLEvents.c: new file like on HEAD,
- * macosx/tkMacOSXInit.c (TkpInit): initialize carbon event handlers
- * macosx/tkMacOSXInt.h: in TkpInit(), add new source
- * unix/Makefile.in: file to Makefile.in.
+ * doc/text.n: Clarify behaviour of tab stops (as per [Bug 1247835])
+
+2005-08-09 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXCarbonEvents.c (AppEventHandlerProc): handle carbon
events sent directly to application event target via the general
@@ -2663,18 +6416,19 @@
* macosx/tkMacOSXEvent.h: made TkMacOSXProcessEvent() non-static, added
* macosx/tkMacOSXEvent.c: new interp field to TkMacOSXEvent struct for
- use by app event handler.
+ use by app event handler.
* macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): retrieve
current window, partCode, modifiers and local cursor position from
carbon mouse event if possible. Use new static GenerateButtonEvent()
taking a MouseEventData struct instead of TkGenerateButtonEvent() to
avoid recomputing already known values. Move process activation on
- MouseDown into BringWindowForward() to allow clicking on window titlebar
- widgets without activating process. Move code dealing with clicks in
- window titelbar into separate function HandleWindowTitlebarMouseDown()
- to avoid code duplication. Avoid repeated calls to TkMacOSXGetXWindow()
- by storing result in MouseEventData struct.
+ MouseDown into BringWindowForward() to allow clicking on window
+ titlebar widgets without activating process. Move code dealing with
+ clicks in window titelbar into separate function
+ HandleWindowTitlebarMouseDown() to avoid code duplication. Avoid
+ repeated calls to TkMacOSXGetXWindow() by storing result in
+ MouseEventData struct.
(TkMacOSXButtonKeyState, XQueryPointer): try to get button and modifier
state from currently processed carbon event (to avoid unnecessary IPC
with the window server), otherwise use modern carbon API to get this
@@ -2685,13 +6439,13 @@
buttons (tk supports up to 5) and of NumLock and Fn modifier keys
(NumLock is mapped to Mod3 and Fn to Mod4).
- * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent): handle
- kEventWindowExpanded event to deal with window uncollapsing from the
- dock by generating tk Map event, handle kEventAppHidden and
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
+ handle kEventWindowExpanded event to deal with window uncollapsing from
+ the dock by generating tk Map event, handle kEventAppHidden and
kEventAppShown events (moved here from tkMacOSXCarbonEvents.c).
- * macosx/tkMacOSXSubwindows.c (XUnmapWindow): only hide window when
- it is not iconified to avoid window flashing on collapse.
+ * macosx/tkMacOSXSubwindows.c (XUnmapWindow): only hide window when it
+ is not iconified to avoid window flashing on collapse.
* macosx/tkMacOSXWm.c: replaced Tk_DoWhenIdle() by Tcl_DoWhenIdle().
(TkMacOSXZoomToplevel): remove call to TrackBox(), now done in
@@ -2736,132 +6490,88 @@
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXWm.h:
- * macosx/tkMacOSXEmbed.c: replaced all uses of panic() with Tcl_Panic()
- * macosx/tkMacOSXFont.c: (sync with HEAD).
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXInt.h: declare macosx internal procs as MODULE_SCOPE.
+ * macosx/tkMacOSXCarbonEvents.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXWindowEvent.c
+
+ * library/bgerror.tcl: sync with core-8-4-branch changes of 2005-07-28.
+ * macosx/tkMacOSXDraw.c:
* macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c:
+ * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXInt.h: sync with HEAD changes of 2005-03-14.
+ * generic/tkFrame.c: sync with core-8-4-branch changes of 2005-07-27.
+ * generic/tkIntDecls.h:
+ * generic/tkStubInit.c:
+ * generic/tkFrame.c:
+ * win/tkWinDraw.c:
+ * unix/tkUnixDraw.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXWm.c:
* macosx/tkMacOSXSubwindows.c:
- * macosx/tclets.r (removed): sync with HEAD.
+ * macosx/tkMacOSXButton.c: sync with core-8-4-branch.
+ * macosx/tkMacOSXEntry.c:
* macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXPort.h:
-
-2005-07-30 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/Makefile.in (html): reverted/amended changes of 2005-07-24
- that broke TkAqua 'make install'; added BUILD_HTML_FLAGS
- optional var like in tcl/unix/Makefile.in.
-2005-07-28 Jeff Hobbs <jeffh@ActiveState.com>
+ * library/demos/menu.tcl: removed errant '}'.
- * macosx/tkMacOSXDraw.c (XDrawLines, XDrawSegments): correct
- drawing of CoordModePrevious style (each point based on last).
- Exposed by tktable -drawmode fast.
+2005-08-04 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * library/bgerror.tcl (::tk::dialog::error::bgerror): use
- zoomDocProc instead of dBoxProc for bgerror dialog
+ * doc/clipboard.n: Add example demonstrating custom types of clipboard
+ data.
- * macosx/tkMacOSXWm.c (TkpWmSetState): add IsWindowCollapsed check
- before calling CollapseWindow.
- (WmResizableCmd): adjust kWindow*Attributes according to resize
- parameters.
+2005-07-25 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): handle
- inToolbarButton action (generates <<ToolbarButton>> virtual event)
- and correct inCollapseBox to properly track the event (waiting for
- buttonrelease) and generate the Unmap event (Map event on
- redisplay still missing).
+ * library/*.tcl: Updated to use more 8.4 and 8.5 features as part of
+ resolving [Patch 1237759].
-2005-07-27 Jeff Hobbs <jeffh@ActiveState.com>
+2005-07-22 Mo DeJong <mdejong@users.sourceforge.net>
- * generic/tkFrame.c (DisplayFrame):
- * generic/tkInt.decls: add TkpDrawFrame to allow for
- * generic/tkIntDecls.h: platform-specific drawing into the frame/
- * generic/tkStubInit.c: toplevel area. Currently only differs on
- * generic/tkFrame.c: OS X (Aqua), which will draw a themed bg
- * win/tkWinDraw.c: if tk::mac::useThemedToplevel == 1.
- * unix/tkUnixDraw.c: Normal frames left alone until we can
- * mac/tkMacDraw.c: better factor out frame drawing to be
- * macosx/tkMacOSXDraw.c:widget-specific.
+ * win/tkWinX.c: Define _WIN32_WINNT with NT SP 3 data to fix compiler
+ error because SendInput was not defined. The new msys_mingw7 release is
+ now needed to compile the HEAD with mingw gcc. [Bug 1210712]
- * generic/tkInt.h: Swap TkUnsupported1Cmd for TkUnsupported1ObjCmd.
- * generic/tkWindow.c: Ditto. (neil madden)
- * macosx/tkMacOSXInt.h: Added TkMacOSXWindowClass decl
- * macosx/tkMacOSXWm.c (TkMacOSXWinStyle) New function.
- (TkUnsupported1ObjCmd): New function, replaces the un-objectified
- version of the command, recognizes more classes and attributes.
- (TkMacOSXWindowClass): private function to return OS X class of a
- Tk window.
- * macosx/tkMacOSXSubwindows.c (XMapWindow, XUnmapWindow):
- recognize special show/hide functions for sheets
-
-2005-07-24 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in: Subst TCLSH_PROG and
- BUILD_TCLSH into Makefile. Rework html
- target so that it depends on the tclsh
- installed on the system PATH.
- * unix/configure: Regen.
- * unix/configure.in: Invoke SC_PROG_TCLSH
- and SC_BUILD_TCLSH and subst into Makefile.
- * unix/tcl.m4: Update from Tcl.
- * win/Makefile.in: Subst TCLSH_PROG and
- BUILD_TCLSH into Makefile. Rework winhelp
- target so that it depends on the tclsh
- installed on the system PATH.
- * win/configure: Regen.
- * win/configure.in: Invoke SC_BUILD_TCLSH
- and subst into Makefile.
- * win/tcl.m4: Update from Tcl.
- [Tcl patch 1244153]
+2005-07-21 Jeff Hobbs <jeffh@ActiveState.com>
-2005-07-21 Jeff Hobbs <jeffh@ActiveState.com>
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): corrected if
+ expression error (use of = instead of ==).
- * unix/configure, unix/tcl.m4: sync'ed to Tcl's tcl.m4
+2005-07-18 Vince Darley <vincentdarley@users.sourceforge.net>
- * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): set
- oldWidth to avoid warning
+ * generic/tkTextMark.c: fix to segfault in "mark prev"
+ * tests/textIndex.test: [Bug 1240221]
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent):
- corrected if expression error (use of = instead of ==)
+ * tests/textWind.test: make test more robust to avoid infinite loop
-2005-07-06 Jeff Hobbs <jeffh@ActiveState.com>
+2005-07-06 Jeff Hobbs <jeffh@ActiveState.com>
* doc/getOpenFile.n: correct -multiple docs (takes boolean)
-2005-06-25 Daniel Steffen <das@users.sourceforge.net>
+2005-07-05 Don Porter <dgp@users.sourceforge.net>
- *** 8.4.11 TAGGED FOR RELEASE ***
-
- * library/demos/menu.tcl: removed errant '}'.
+ * unix/Makefile.in: Purged use of TCLTESTARGS. [RFE 1161550]
2005-06-23 Daniel Steffen <das@users.sourceforge.net>
- * generic/tkConsole.c: backport fix for bug 756840 & sync whitespace
- changes from HEAD.
-
* generic/tkConsole.c (TkConsolePrint): prevent potential NULL deref.
* macosx/tkMacOSXDefault.h: change ENTRY_BORDER defaults to from 5 to 2
to make default entry widgets in TkAqua look like in other aqua apps
(and have same border dimensions as other platforms). [Bug 1176610]
- * unix/Makefile.in (install-private-headers): rewrite tkPort.h when
- installing private headers to remove ../unix relative #include path to
- tkUnixPort.h (which is incorrect at the installed location).
-
-2005-06-21 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2005-06-21 Donal K. Fellows <dkf@users.sf.net>
* doc/GetBitmap.3: Fix silly error in SYNOPSIS. [Bug 1224983]
-2005-06-20 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2005-06-19 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkImgGIF.c (mInit,Mgetc,Fread): Stop anyone from reading
- off the end of a buffer.
+ * generic/tkImgGIF.c: Cleanse all static (i.e. non-thread-safe) data
+ at a miniscule performance hit.
2005-06-18 Daniel Steffen <das@users.sourceforge.net>
@@ -2871,100 +6581,118 @@
* unix/tcl.m4 (Darwin): add -headerpad_max_install_names to LDFLAGS to
ensure we can always relocate binaries with install_name_tool.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
-2005-06-18 Don Porter <dgp@users.sourceforge.net>
+2005-06-07 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * changes: Update changes for 8.4.11 release
+ Bump patchlevel to a4 to distinguish from a3 release.
- * README: Bump version number to 8.4.11
- * generic/tk.h:
- * macosx/Wish.pbproj/project.pbxproc:
- * unix/configure.in:
- * win/configure.in:
+2005-06-04 Jeff Hobbs <jeffh@ActiveState.com>
- * unix/configure.in: Updated LOCALES to cover all msgs catalogs.
+ *** 8.5a3 TAGGED FOR RELEASE ***
- * unix/configure: autoconf
- * win/configure:
-
-2005-06-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2005-06-02 Jim Ingham <jingham@apple.com>
- * generic/tkCanvas.c (SearchUids): Move all global data into
- protected storage to stop cross-thread issues. [Bug 1114977]
+ * generic/tkEvent.c (InvokeFocusHandlers): On Mac OS X the scrollwheel
+ events are sent to the window under the mouse, not to the focus window
-2005-06-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ Another patch from M. Kirkham.
- * generic/tkConsole.c (Tk_CreateConsoleWindow, TkConsolePrint):
- Transmit the ConsoleInfo through AssocData, so renaming [console]
- won't make things break. [Bug 1016385]
+ * macosx/tkMacOSXScrlbr.c (ThumbActionProc, ScrollBarBindProc): Record
+ the first mouse down point, and compute differences from that, rather
+ than getting the mouse down each time through the loop. The old method
+ would get fooled if you moved the mouse less than a text line height in
+ the text widget. [Bug 1083728]
2005-06-03 Daniel Steffen <das@users.sourceforge.net>
- *** 8.4.10 TAGGED FOR RELEASE ***
-
* macosx/Makefile: fixed 'embedded' target.
-2005-06-02 Jim Ingham <jingham@apple.com>
+2005-06-02 Reinhard Max <max@suse.de>
- Another patch from M. Kirkham.
+ * unix/tkUnix.c (Tk_GetUserInactiveTime): Improvements to get it
+ working on Solaris, and panic if we run out of memory.
+ * unix/configure.in: Rework the searching for Xss, to make it work on
+ Solaris and provide more useful output. Use AC_HELP_STRING where
+ appropriate.
+ * unix/tcl.m4: synced from Tcl.
+ * unix/configure: regenerated with autoconf 2.59.
- * macosx/tkMacOSXScrlbr.c (ThumbActionProc, ScrollBarBindProc):
- Record the first mouse down point, and compute differences from
- that, rather than getting the mouse down each time through the
- loop. The old method would get fooled if you moved the mouse less
- than a text line height in the text widget.
- [Bug 1083728]
+2005-06-01 Jeff Hobbs <jeffh@ActiveState.com>
-2005-06-02 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinInt.h: added private decls of Tk_GetEmbeddedMenuHWND,
+ Tk_GetMenuHWND, TkWinCleanupContainerList, and TkpWmGetState to that
+ are used across source files.
- * changes: update for 8.4.10 release (porter)
+ * win/tkWinX.c (Tk_ResetUserInactiveTime): cast to squelch compiler
+ warning.
-2005-05-31 Mo DeJong <mdejong@users.sourceforge.net>
+2005-05-31 Reinhard Max <max@suse.de>
- * macosx/tkMacOSXWm.c (TkWmStackorderToplevelWrapperMap, TkWmStackorderToplevel):
- * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap, TkWmStackorderToplevel):
- * win/tkWinWm.c (TkWmStackorderToplevelWrapperMap, TkWmStackorderToplevel):
- Fix panic in wm stackorder when a toplevel is created on another
- diplay. The code now ignores toplevels that have a display
- that does not match the display of the parent window.
- [Bug 1152809]
+ * doc/Inactive.3 (new file): C level API documentationn for
+ TIP#245 (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime).
+ * tests/tk.test: Added tests for the TIP#245 implementation.
-2005-05-30 Jeff Hobbs <jeffh@ActiveState.com>
+2005-05-30 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkPanedWindow.c, tests/panedwindow.test: batch of fixes
- to panedwindow from Daniel South. Improved auto-size to fit
- internal windows, fixed sash placement at edge of pane, fixed
- calculation of stretch amount for internal windows.
- [Bug 1124198 1161543 1054117 1010941 795869 690169 1192323]
+ * generic/tkPanedWindow.c, tests/panedwindow.test: batch of fixes to
+ panedwindow from Daniel South. Improved auto-size to fit internal
+ windows, fixed sash placement at edge of pane, fixed calculation of
+ stretch amount for internal windows. [Bug 1124198, 1161543, 1054117,
+ 1010941, 795869, 690169, 1192323]
- * generic/tkMenu.c (MenuCmd): create event handler earlier to
- ensure proper destruction of menu through DestroyNotify.
- [Bug 1159367]
+ * generic/tkMenu.c (MenuCmd): create event handler earlier to ensure
+ proper destruction of menu through DestroyNotify. [Bug 1159367]
- * library/console.tcl (::tk::ConsoleInit): print out first prompt
- and swallow the extra "% " that comes once from Tcl on Windows.
+ * library/console.tcl (::tk::ConsoleInit): print out first prompt and
+ swallow the extra "% " that comes once from Tcl on Windows.
2005-05-29 Daniel Steffen <das@users.sourceforge.net>
- * macosx/Wish.pbproj/project.pbxproj: added missing FRAMEWORK defines
+ * macosx/tkMacOSXFont.c: use Tcl_Panic instead of panic.
+
+ * unix/configure.in: added description of HAVE_XSS for autoheader.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Wish.xcode/project.pbxproj: added missing FRAMEWORK defines
introduced with configure/make based build.
* macosx/tkMacOSXInit.c:
* macosx/tkMacOSXNotify.c: fixed warnings.
- * unix/configure.in: skip X11 configure checks when building tk_aqua.
- * unix/configure: autoconf-2.13
+ * generic/tkDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkStubInit.c: ran missing 'make genstubs' for TIP245 changes
+ to tk.decls
-2005-05-27 Jeff Hobbs <jeffh@ActiveState.com>
+ * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): use symbolic
+ constant argument in call to UpdateSystemActivity();
- * README: Bumped patchlevel to 8.4.10
- * generic/tk.h:
* macosx/Wish.pbproj/project.pbxproj:
- * unix/configure, unix/configure.in, unix/tk.spec:
- * win/configure, win/configure.in:
+ * macosx/Wish.xcode/project.pbxproj:
+ * unix/configure.in: added/corrected linking to IOKit.framework for
+ TIP245.
+
+ * unix/configure.in: skip X11 configure checks when building tk_aqua.
+ * unix/configure: autoconf-2.59
+
+2005-05-28 Donal K. Fellows <dkf@users.sf.net>
+
+ TIP #245 IMPLEMENTATION from Reinhard Max <max@suse.de>
-2005-05-27 Todd Helfter <tmh@users.sourceforge.net>
+ * doc/tk.n: Documentation of [tk inactivity].
+ * win/tkWinX.c (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime):
+ * unix/tkUnix.c (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime):
+ * macosx/tkMacOSXXStubs.c: Implementations of the core API for
+ (Tk_GetUserInactiveTime): determining how long as user's left
+ (Tk_ResetUserInactiveTime): her machine alone.
+ * unix/configure.in: Test for XScreenSaver support.
+ * generic/tkCmds.c (Tk_TkObjCmd): Implementation of [tk inactivity].
+
+2005-05-27 Todd Helfter <tmh@users.sourceforge.net>
* library/menu.tcl: correct the sticky behavior of menus posted by
tk_popup so that they "stick" after the initial <ButtonRelease>
@@ -2972,25 +6700,26 @@
2005-05-26 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXInit.c (TkpInit): fixed resource file extraction
- from __tk_rsrc section to work with non-prebound .dylib and .bundle.
+ * macosx/tkMacOSXInit.c (TkpInit): fixed resource file extraction from
+ __tk_rsrc section to work with non-prebound .dylib and .bundle.
- * macosx/Makefile: corrected EMBEDDED_BUILD check, use separate tcl
- and tk version vars to properly support tk/x11 framework version
+ * macosx/Makefile: corrected EMBEDDED_BUILD check, use separate Tcl and
+ Tk version vars to properly support tk/x11 framework version
overriding, rewrite tkConfig.sh when overriding tk version, corrected
Wish.app symlink in tk build dir.
- * unix/configure.in: corrected framework finalization to softlink
- stub library to Versions/8.x subdir instead of Versions/Current.
- * unix/configure: autoconf-2.13
+ * unix/configure.in: corrected framework finalization to softlink stub
+ library to Versions/8.x subdir instead of Versions/Current.
+ * unix/configure: autoconf-2.59
+
+2005-05-25 Jeff Hobbs <jeffh@ActiveState.com>
-2005-05-25 Jeff Hobbs <jeffh@ActiveState.com>
+ * unix/Makefile.in (install-libraries): protect possible empty list in
+ for with list= trick for older shells.
- * unix/configure, unix/configure.in: ensure false Tcl.framework is
- only created with --enable-framework
+2005-05-23 Jeff Hobbs <jeffh@ActiveState.com>
- * unix/Makefile.in (install-libraries): protect possible empty
- list in for with list= trick for older shells.
+ * generic/tkFileFilter.c (FreeGlobPatterns): s/null/NULL/
2005-05-24 Daniel Steffen <das@users.sourceforge.net>
@@ -3003,10 +6732,10 @@
* unix/Makefile.in:
* unix/configure.in:
* unix/tcl.m4:
- * unix/tkUnixInit.c: moved all Darwin framework and TkAqua build
+ * unix/tkUnixInit.c: moved all Darwin framework and TkAqua build
support from macosx/Wish.pbproj and macosx/Makefile into the standard
- unix configure/make buildsystem, the project and macosx/Makefile are
- no longer required to build Tk.framework and/or TkAqua. TkAqua is now
+ unix configure/make buildsystem, the project and macosx/Makefile are no
+ longer required to build Tk.framework and/or TkAqua. TkAqua is now
enabled by the --enable-aqua configure option, and static and
non-framework builds of TkAqua are now available via the standard
configure switches. Tk/X11 can also be built as a framework. The
@@ -3014,34 +6743,46 @@
projects, embedded builds are still only available via this Makefile,
but for other builds it is not longer required (but its current
functionality is still available for backwards compatibility). The
- projects currently do not call through to the Makefile to build
- (unlike Tcl.pbproj) so project builds may differ from makefile builds.
- Due to issues with spaces in pathnames, 'Wish Shell.app' has been
- renamed to 'Wish.app', the macosx/Makefile installs backwards
- compatibility symlinks for the old name.
+ projects currently do not call through to the Makefile to build (unlike
+ Tcl.pbproj) so project builds may differ from makefile builds. Due to
+ issues with spaces in pathnames, 'Wish Shell.app' has been renamed to
+ 'Wish.app', the macosx/Makefile installs backwards compatibility
+ symlinks for the old name.
* macosx/tkMacOSXInit.c (TkpInit): added support for Tk resource file
in non-framework and static builds: the resource file is copied into a
- __tk_rsrc MachO segment of the library or executable at link time and
+ __tk_rsrc MachO section of the library or executable at link time and
extracted into a temporary location at initialization.
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in (new file): autoheader-2.59
* macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Tk-Info.plist:
+ * macosx/Wish-Info.plist:
* macosx/tkAboutDlg.r: updated copyright years to 2005.
-2005-05-15 Jim Ingham <jingham@apple.com>
+2005-05-22 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFileFilter.c (TkGetFileFilters): Add all filters, not just
+ the first one. [Bug 1206133]
+
+2005-05-15 Jim Ingham <jingham@apple.com>
Fixes from Michael Kirkham:
- * macosx/tkMacOSXMenu.c (TkpConfigureMenuEntry): Thinko in clearing
- the ENTRY_ACCEL_MASK before re-parsing it. [Tk Bug 1012852]
+ * macosx/tkMacOSXMenu.c (TkpConfigureMenuEntry): Thinko in clearing the
+ ENTRY_ACCEL_MASK before re-parsing it. [Bug 1012852]
- * macosx/tkMacOSXScrlbr.c (UpdateControlValues): Don't set the
- control value BEFORE setting the min and max or the control manager
- will reset it for you. [Tk Bug 1202181]
+ * macosx/tkMacOSXScrlbr.c (UpdateControlValues): Don't set the control
+ value BEFORE setting the min and max or the control manager will reset
+ it for you. [Bug 1202181]
* macosx/tkMacOSXXStubs.c (TkMacOSXXGetPixel, TkMacOSXXPutPixel):
- Restore the port to what it was before putting we were called.
- [Tk Bug 1202223]
+ Restore the port to what it was before putting we were called. [Bug
+ 1202223]
+
+2005-05-14 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXScrlbr.c (ThumbActionProc): Missing Tcl_Release.
2005-05-14 Daniel Steffen <das@users.sourceforge.net>
@@ -3050,13 +6791,20 @@
CFRunLoop allows replacement of the custom TkAqua notifier by a
standard tcl event source. Removes requirement of threaded tcl core
for TkAqua, allows to stub-link TkAqua against Tcl by removing use of
- the unstubbed TclInitNotifier & TclFinalizeNotifier. [Tcl Patch 1202052]
+ the unstubbed TclInitNotifier & TclFinalizeNotifier. [Tcl Patch
+ 1202052]
+ * macosx/Wish.xcode/project.pbxproj:
* macosx/Wish.pbproj/project.pbxproj: stub-link TkAqua: build with
USE_TCL_STUBS and link against libtclstub instead of Tcl.framework,
unexport libtclstub symbols from Tk to avoid duplicate symbol warnings
when linking with both Tcl and Tk, fixes for gcc4.0 warnings.
+ * macosx/Wish.xcode/project.pbxproj: sync with Wish.pbproj changes
+ since 2004-11-19.
+ NOTE: to use this project, need to uncomment the tclConfig.h settings
+ at the top of tcl/unix/configure.in, autoconf and rebuild tcl !
+
* macosx/tkMacOSXBitmap.c:
* macosx/tkMacOSXButton.c:
* macosx/tkMacOSXDialog.c:
@@ -3070,23 +6818,40 @@
* macosx/tkMacOSXXStubs.c: fixed gcc 4.0 warnings.
* unix/tcl.m4: sync with tcl
- * unix/configure: autoconf-2.13
+ * unix/configure: autoconf-2.59
-2005-05-10 Vince Darley <vincentdarley@users.sourceforge.net>
+2005-05-10 Vince Darley <vincentdarley@users.sourceforge.net>
* library/text.tcl: test and fix to TextPrevPara to avoid infinite loop
- * tests/textIndex.test: at start of widget [Bug 1191895]
+ * tests/textIndex.test: at start of widget. [Bug 1191895]
+
+ * generic/tkTextDisp.c: better synchronisation between explicit and
+ implicit pixel line-height calculations. [Bug 1186558]
+
+2005-05-10 Don Porter <dgp@users.sourceforge.net>
-2005-05-06 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkTextDisp.c (GetXView): Improved numerical precision of
+ calculation of [.t xview] return values.
+ * tests/textDisp.test: Match greater precisions of [.t xview] and
+ [.t yview] values in tests.
+
+2005-05-06 Jeff Hobbs <jeffh@ActiveState.com>
* unix/configure: regen
- * unix/configure.in: add AC_C_BIGENDIAN check
- * unix/tcl.m4: correct Solaris 10 (5.10) check and add support for
+ * unix/configure.in: Add AC_C_BIGENDIAN check and pkg-config xft checks
+ to extend xft search.
+ * unix/tcl.m4: Correct Solaris 10 (5.10) check and add support for
x86_64 Solaris cc builds.
+2005-04-28 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * macosx/tkMacOSXNotify.c (TkMacOSXWaitForEvent): Fix for typo in
+ waitTime computation. [Bug 1191097]
+ (AlertNotifier): Factor out the core of the notifier alerting code.
+
2005-04-25 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXNotify.c: syncd with tclUnixNotfy.c changes since
+ * macosx/tkMacOSXNotify.c: sync with tclUnixNotfy.c changes since
2004-06-22, added compile time check for threaded tcl core, removed
unthreaded code paths as they are never used anyway, fixed
TkMacOSXAlertNotifier() implementation.
@@ -3094,10093 +6859,404 @@
* unix/Makefile.in: added TCL_STUB_LIB_FILE, needed for unexporting of
symbols from libtclstub to avoid duplicate symbol warnings.
- * unix/tcl.m4 (Darwin): added configure checks for recently added linker
- flags -single_module and -search_paths_first to allow building with
- older tools (and on Mac OS X 10.1), use -single_module in SHLIB_LD and
- not just T{CL,K}_SHLIB_LD_EXTRAS, added unexporting from Tk of symbols
- from libtclstub to avoid duplicate symbol warnings, added PLAT_SRCS
- definition for Mac OS X.
+ * unix/tcl.m4 (Darwin): added configure checks for recently added
+ linker flags -single_module and -search_paths_first to allow building
+ with older tools (and on Mac OS X 10.1), use -single_module in SHLIB_LD
+ and not just T{CL,K}_SHLIB_LD_EXTRAS, added unexporting from Tk of
+ symbols from libtclstub to avoid duplicate symbol warnings, added
+ PLAT_SRCS definition for Mac OS X, defined MODULE_SCOPE to
+ __private_extern__.
(SC_MISSING_POSIX_HEADERS): added caching of dirent.h check.
- (SC_TCL_64BIT_FLAGS): fixed 'checking for off64_t' message output.
-
- * unix/configure: autoconf-2.13
-
-2005-04-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixFont.c (FontMapLoadPage): reorder char[] decls to
- avoid possible segv. Minimal fix for [Bug 1122671]
-
- * library/tkfbox.tcl (::tk::dialog::file::): fix typeMenuLab ref.
- Add undoc'd ::tk::dialog::file::showHiddenBtn var (default 0) that
- will add a "Show Hidden" checkbutton to tk_get*File and
- tk_chooseDirectory if set to true.
- * library/choosedir.tcl (::tk::dialog::file::chooseDir::): fix
- cancelBtn ref, add hiddenBtn ref for "Show Hidden" button.
-
-2005-04-09 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/README: updated requirements for OS & developer tool
- versions + other small fixes/cleanup.
-
- * macosx/tkMacOSXEntry.c (ComputeIncDecParameters): manually define
- constants present only in 10.3 headers so that we can build on 10.2.
-
- * macosx/Wish.pbproj/project.pbxproj: fixed absolute path to
- tkEntry.h that confused 10.2 PBX.
-
- * unix/tcl.m4 (Darwin): added -single_module linker flag to
- TCL_SHLIB_LD_EXTRAS and TK_SHLIB_LD_EXTRAS.
- * unix/configure: autoconf-2.13
-
-2005-03-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tcl.m4, win/configure: do not require cygpath in macros to
- allow msys alone as an alternative.
-
-2005-03-24 Jim Ingham <jingham@apple.com>
-
- These changes allow us to draw the Entry and Spinbox widget
- with a native look and feel on Mac OS X.
-
- * generic/tkEntry.h: New file, extracting the definitions of
- Entry and Spinbox.
- * generic/tkEntry.c (DisplayEntry): Call out to
- TkpDrawEntryBorderAndFocus and TkpDrawSpinboxButtons. Also
- provide default implementations for X11 & Win.
- * macosx/tkMacOSXEntry.c: New file, implements the entry & focus
- and spinbox button drawing.
- * tkMacOSXDefaults.h: Change the Mac OS X defaults so they fit
- the native widget shapes.
-
- * xlib/xgc.c (XCreateGC): Set the default linewidth to 1, not
- 0. Some extensions seem to expect this.
-
-2005-03-15 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * unix/tcl.m4: Updated for OpenBSD and regenerated the configure
- * unix/configure: script
-
-2005-03-11 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXButton.c (TkpDisplayButton): Set the port to
- the Button window's port BEFORE you set the clip, otherwise you
- are setting the clip on the wrong window!
- Also, a little cleanup - move x & y into the branches where they are
- used, and don't compute the TextAnchor if we are using the native
- button text, since we aren't going to use it.
- (TkMacOSXDrawControl): Call ShowControl & SetControlVisibility in a more
- logical order.
-
- * tkMacOSXInt.h: Add TkMacOSXGenerateFocusEvent.
- * tkMacOSXSubwindows.c (XDestroyWindow): We don't get Activate events
- for the remaining windows when a Floating window is destroyed. This
- can cause the focus to disappear. So catch this case when the window
- is being destroyed and move the focus here.
- * tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): Make this public
- (used to be GenerateFocusEvent) since we need it here and in
- tkMacOSXSubwindows.c. Then change the name everywhere it is used.
- [Bug 1124237]
-
-2005-03-10 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): In
- the inDrag section, set the GrafPort to the drag window's GrafPort
- before doing LocalToGlobal. [Bug 1160025]
-
-2005-03-08 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (WinSetIcon): fix GCLP_ICONSM -> GCLP_HICONSM.
-
- * win/makefile.vc: clarify necessary defined vars that can come
- from MSVC or the Platform SDK.
-
-2005-02-28 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinX.c (GenerateXEvent): correct %A translation on
- MouseWheel [Bug 1118340]
-
-2005-02-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixFont.c (FontMapLoadPage): swap decl of char arrays to
- avoid aligment issues in Tcl_UtfToExternal. [Bug 1122671]
-
- * unix/configure, unix/configure.in: add AC_C_BIGENDIAN check
- which defines WORDS_BIGENDIAN on BE machines.
-
-2005-02-24 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSX.h: fixed incorrect inclusion of internal header.
- * macosx/tkMacOSXNotify.c: corrected included headers.
-
-2005-02-22 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd, NavServicesGetFile):
- fixed encoding problems with -initialfile & -filetypes and
- corrected potential buffer overrun with -initialdir/-initialfile.
- [Bug 1146057]
-
-2005-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * tests/all.tcl: Add a [package require Tk] so that a missing
- display causes an early failure and keeps the error trace short.
- Issue observed in [FRQ 11122147], even though that's unrelated.
-
-2005-02-11 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/panedwindow.tcl (::tk::panedwindow::Cursor): check
- window existence on delayed call. [Bug 949792]
-
- * doc/text.n: note 'image' key in 'dump' command. [Bug 1115907]
-
- * win/tkWinWm.c (TkWinGetIcon): fix toplevel retrieval for
- determining icon ref (potential crash). [Bug 1105738]
-
- * generic/tkCanvBmap.c (ConfigureBitmap, ComputeBitmapBbox): Fixed
- possible crash with disabled bmap and bbox handling [Bug 1119460]
- (BitmapToPostscript): made aware of various bitmap types
- (DisplayBitmap): remove unused fg/bgColor refs
-
-2005-02-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in: remove SHLIB_LD_FLAGS (only for AIX, inlined
- * unix/tcl.m4: into SHLIB_LD). Combine AIX-* and AIX-5
- * unix/configure: branches in SC_CONFIG_CFLAGS.
- Correct gcc builds for AIX-4+ and HP-UX-11.
-
-2005-01-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/msgs/es_ES.msg: Added more localization for Spanish
- Spanish. [Bug 1111213]
-
-2005-01-28 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure, unix/tcl.m4: add solaris 64-bit gcc build
- support. [Bug 1021871]
-
-2005-01-25 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXInit.c (TkpInit): set tcl_interactive to 1 to show
- console at startup instead of directly calling [console show].
-
- * unix/tcl.m4 (Darwin): fixed bug with static build linking to
- dynamic library in /usr/lib etc instead of linking to static library
- earlier in search path. [Tcl Bug 956908]
- Removed obsolete references to Rhapsody.
- * unix/configure: autoconf-2.13
-
-2005-01-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/demos/menu.tcl: Reworked to make dialogs children of the
- demo widget so that they are properly visible. Issue reported by
- Keith Nash <k.j.nash@usa.net>
-
-2005-01-14 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixWm.c: Sync with CVS HEAD (r1.47):
- Fixes: #959973 "wm title bug" (support Unicode titles)
- Fixes: #742882 "Potential division by zero in gridded wm geometry"
- Use Tcl_GetTime instead of TclpGetTime [#874745]
- Use Tcl_Panic() instead of "panic" [#865264]
- Fixes: #632816 "cannot remove transient"
- Fixes: #568861 "Fix for wm minsize and maxsize commands"
- * tests/unixWm.test, tests/wm.test: Updated test suite for
- #632816 (unixWm-37.3, unixWm-37.4, wm-grid-1.11, wm-grid-1.12)
- and #742882 (unixWm-20.9, unixWm-20.11).
-
-2005-01-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkObj.c (TkParsePadAmount):
- * generic/tkPack.c: Moved function to tkObj.c and rewrote so that it
- takes advantage of Tcl_Objs properly and cannot leave objects in an
- inconsistent state. [Bug 1098779]
-
-2005-01-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkWindow.c (GetScreen): Make sure the result is reset on
- all error paths to stop strange errors. [Bug 697915]
-
-2005-01-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * doc/loadTk.n, doc/toplevel.n: Convert to other form of emacs
- mode control comment to prevent problems with old versions of
- man. [Bug 1085127]
-
-2005-01-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (TkWinWmCleanup): clean up layered window class.
- This caused crash in reinit of Tk (as seen in plugin).
-
-2004-12-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tcl.m4, win/configure: update MSVC CFLAGS_OPT to -O2, remove
- -Gs (included in -O2) and -GD (outdated). Use "link -lib" instead
- of "lib" binary and remove -YX for MSVC7 portability. Add
- -fomit-frame-pointer for gcc OPT compiles. [Bug 1092952, 1091967]
-
-2004-12-20 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * doc/panedwindow.n: Fix silly typo. [Bug 1087842]
-
-2004-12-09 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
- Added guards so that rescanning for the complex-alpha check is not
- done in the common case of creating a simple image a bit at a
- time, or any other time where the image was simple before and the
- input data has no alpha channel. [Bug 1081966]
-
-2004-12-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4.9 TAGGED FOR RELEASE ***
-
- * library/text.tcl (::tk::TextUpDownLine): revert 2004-11-23 as it
- prevented scrolling to bottom.
-
-2004-12-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
- Make overlay compositing where the target is empty no longer set
- the target to magical gray, and also make sure that the
- complex-alpha flag is toggled when necessary. [Patch 848161]
-
-2004-12-02 Jeff Hobbs <jeffh@ActiveState.com>
-
- * changes: updated for 8.4.9 release
-
-2004-12-01 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixButton.c (TkpDisplayButton): constrain coords to
- Tk_RedrawImage to display only portion that is valid.
- * generic/tkImgPhoto.c (ImgPhotoDisplay): add X error suppression
- around XGetImage to prevent app abort. [Bug 979239]
-
-2004-11-24 Jeff Hobbs <jeffh@ActiveState.com>
-
- * README: Bumped patchlevel to 8.4.9
- * generic/tk.h:
- * macosx/Wish.pbproj/project.pbxproj:
- * unix/configure, unix/configure.in, unix/tk.spec:
- * win/configure, win/configure.in:
-
-2004-11-23 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * library/text.tcl: make up/down cursor keys move by display
- lines, not logical lines [Bug 1011234] (REVERTED 2004-12-06)
-
-2004-11-19 Reinhard Max <max@suse.de>
-
- *** 8.4.8 TAGGED FOR RELEASE ***
-
- * unix/installManPage: Classic sed doesn't support | in REs.
-
- * doc/pack-old.n: Changed the internal name of the man page to
- pack-old to avoid a name clash in the installed man pages.
-
-2004-11-18 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Final updates for Tcl 8.4.8 release.
-
-2004-11-18 Reinhard Max <max@suse.de>
-
- * unix/tcl.m4 (SC_CONFIG_MANPAGES): Applied an improved version of
- * unix/configure.in: patch #996085, that introduces
- * unix/Makefile.in: --enable-man-suffix.
-
- * unix/installManPage: added
- * unix/mkLinks: removed
-
-2004-11-17 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkCanvWind.c (ConfigureWinItem): unmap windows
- immediately when state hidden is requested. [Bug 982248]
-
- * generic/tkCanvImg.c (ImageToPostscript): don't try ps generation
- of canvas image item without image specified. [Bug 1032300]
-
- * library/console.tcl (::tk::console::ExpandVariable): correct
- array keyname expansion. [Bug 1004508] (bold)
-
- * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd): set save_under X
- attr to prevent expose events when moving sash. [Bug 1036963]
-
-2004-11-16 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for Tk 8.4.8 release.
-
- * library/msgs/it.msg: Updated Italian message catalog.
- Thanks to Roberto Ugoccioni [Bug 1063675].
-
-2004-11-12 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXXStubs.c: implemented XGetGeometry().
-
-2004-11-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkCmds.c (Tk_TkObjCmd): use correct screen data when
- -displayof arg is passed to [tk scaling]. [Bug 800178]
-
-2004-11-12 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXFont.c (Tk_MeasureChars,Tk_DrawChars,etc): Make
- sure that the lastSubFontPtr remains valid even when the subfont
- array is reallocated. [Bug 618872]
-
-2004-11-11 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkMain.c:
- * macosx/tkMacOSXAppInit.c (removed):
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXInt.h: changes to make TkAqua dynamically loadable,
- enabling [package require Tk] from tclsh. Startup code from
- tkMacOSXAppInit.c moved into tkMacOSXInit.c, added code that
- notifies the window server that an unbundled executable is a full
- GUI application after loading Tk. [Patch 1035348]
-
- * doc/wm.n: documented [wm attributes] on Mac OS X. [Bug 606665]
- * macosx/tkMacOSXWm.c: implemented TIP 222 [wm attributes -alpha] on
- Mac OS X. [Patch 892194]
- WmIconbitmapCmd: adopted FSRef changes from [wm atttrs -titlepath].
-
- * macosx/tkMacOSXButton.c:
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXRegion.c:
- * macosx/tkMacOSXSubwindows.c: synced spacing/formatting with HEAD.
-
- * macosx/tkMacOSXMouseEvent.c: endianness fixes.
-
- * macosx/Wish.pbproj/project.pbxproj: corrected path to html help
- inside framework.
-
- * macosx/Makefile: prevent parallel make from building several
- targets at the same time.
- Ensure that xcodebuild will use Wish.pbproj project even if a .xcode
- project is also present.
-
-2004-11-10 Jim Ingham <jingham@apple.com>
-
- From Michael Kirkham (mikek@muonics.com):
-
- * macosx/tkMacOSXButton.c (TkpDisplayButton): Don't set
- the text if compound is NONE and we have and image.
- [Bug 1055023]
-
-2004-10-29 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/wm.test: Add Win32 test cases for attributes
- subcommand.
- * win/tkWinWm.c (WmAttributesCmd): Fixup broken
- option processing logic for attributes subcommand.
-
-2004-10-29 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/makefile.vc (DOTVERSION): Was installing 8.4 relabelled as 8.5
-
- * library/tk.tcl (::tk::PlaceWindow): Backported the fix from
- #533519 to handle window placement on multi-monitor Windows.
-
-2004-10-28 Mo DeJong <mdejong@users.sourceforge.net>
-
- * doc/wm.n: Add wm attributes . -alpha doc to account
- for recent alpha changes.
-
-2004-10-28 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWin32Dll.c (DllMain, _except_dllmain_detach_handler):
- Back port HAVE_NO_SEH handler code from CVS HEAD to fix
- gcc build breakage caused by 2004-10-26 back port.
-
-2004-10-28 Don Porter <dgp@users.sourceforge.net>
-
- * README: Bumped to patch level 8.4.8
- * generic/tk.h: to prepare for next patch
- * macosx/Wish.pbproj/project.pbxproj: release.
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
-
- * unix/configure: autoconf (2.13)
- * win/configure:
-
-2004-10-28 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * unix/tkUnixScale.c (DisplayHorizontalValue): Backport fix for
- #220927 by Michael Schlenker to keep the labels within the window.
-
-2004-10-28 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * doc/*.n: Backport of minor documentation fixes.
-
-2004-10-27 Don Porter <dgp@users.sourceforge.net>
-
- * library/xmfbox.tcl (MotifFDialog_BuildUI): Fix [Bug 987169] in
- the Motif file dialogs as well. Backport of DKF bug fix.
-
-2004-10-26 David Gravereaux <davygrvy@pobox.com>
-
- * generic/tkInt.h: Backport of shutdown safety mods from the HEAD
- * generic/tkMenu.c: dating from 2003-12-21
- * generic/tkUtil.c:
- * generic/tkWindow.c:
- * mac/tkMacButton.c:
- * unix/tkUnixEvent.c:
- * win/tkWin32Dll.c:
- * win/tkWinEmbed.c:
- * win/tkWinMenu.c:
- * win/tkWinX.c:
-
- * generic/tkInt.decls: Signature for tkWinXCleanup needed to be
- * generic/tkIntPlatDecls.h: changed so it matches the Tcl_ExitProc
- typedef to avoid a bad-style cast.
-
-
- * win/makefile.vc: Backport to the most recent
- * win/rules.vc: changes on the HEAD.
- * win/nmakehlp.c:
-
-2004-10-26 Don Porter <dgp@users.sourceforge.net>
-
- * tests/safe.test (safe-1.3): Made test less sensitve to the
- full set of existing aliases in an interp, so the it only tests
- whether the tested ones are present.
-
- * unix/Makefile.in: Copied LD_LIBRARY_PATH machinery from
- `make shell` target to other similar targets so that just built
- libraries are tested, rather than previous installations.
-
-2004-10-26 Reinhard Max <max@suse.de>
-
- * generic/tkEvent.c (Tk_HandleEvent): Call XSetICFocus whenever
- the window receives focus. This fixes bug #905830 but avoids
- #1000051.
-
-2004-10-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (UpdateWrapper): pass SWP_NOOWNERZORDER to
- SetWindowPos when maintaining win Z order, to prevent parent
- from flashing (adjusting Z order).
-
-2004-10-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- Backport of 8.5 wm iconphoto that added support for Tk photo
- * generic/tkInt.h (TkDisplay): images as titlebar icons. TIP #159
- * win/tkWinWm.c (WmIconphotoCmd): wm iconphoto ?-default? image1 ...
- * macosx/tkMacOSXWm.c (WmIconphotoCmd): Implemented for Win/Unix,
- * unix/tkUnixWm.c (WmIconphotoCmd): stubbed out for OS X.
- * tests/wm.test, tests/unixWm.test, tests/winWm.test: [Bug 815751]
-
-2004-09-24 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkCursor.c: Add missing initialization in debug routine.
-
-2004-09-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinInt.h (TkWinDisplayChanged): added decl
- * win/tkWinX.c (TkWinDisplayChanged, TkpOpenDisplay): Correctly
- * win/tkWinWm.c (InvalidateSubTreeDepth, WmProc): handle color
- and screen resolution changes. Tested for 16/24/32 bpp changes on
- XP. May need more fixes for 8bpp switch, use of special
- colormaps, or other special palette handling cases. [Bug 223689]
-
-2004-09-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkInt.decls: Add decl for TkWinGetPlatformTheme.
- It is only defined under Win32.
- * generic/tkIntPlatDecls.h: Regen.
- * generic/tkStubInit.c: Regen.
- * win/tkWinInt.h: Define TK_THEME_WIN_CLASSIC and
- TK_THEME_WIN_XP.
- * win/tkWinMenu.c (DrawMenuEntryAccelerator, DrawMenuEntryLabel):
- Draw a disabled 3D text highlight for the accelerator only
- with the Win95/98 look. Same goes for the menu entry text.
- * win/tkWinX.c (TkWinGetPlatformId, TkWinGetPlatformTheme):
- Automatically detect the Windows theme in use and return
- either TK_THEME_WIN_CLASSIC or TK_THEME_WIN_XP when the
- TkWinGetPlatformTheme function is invoked.
- [Patch 866194]
-
-2004-09-22 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * win/tkWinMenu.c: only provide a submenu handle when the
- MF_POPUP flag is given, fixing a recently-introduced crash
- when submenus are disabled. Also better error checking for
- this sort of situation in the future.
-
-2004-09-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinMenu.c (ReconfigureWindowsMenu): Fix drawing of a disabled
- (TkWinHandleMenuEvent, DrawMenuEntryArrow): cascade menu arrow. Tk was
- displaying a disabled cascade menu arrow in black instead of
- gray. This was caused by a bug in the Win32 code for user drawn
- menu items. The fix is to avoid telling Windows that the menu item
- is a cascade type and then draw the gray arrow bitmap on our own.
- [Patch 865842]
-
-2004-09-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinMenu.c (DrawWindowsSystemBitmap): Fix a strange Win32
- bug where the logical coordinates returned by a call to DPtoLP are
- wrong the first time a menu is posted. This bug manifested itself
- by drawing the bitmap in the wrong place in a menu. The fix was
- to pass the newly created DC instead of the DC from the window.
-
-2004-09-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinMenu.c (DrawMenuEntryAccelerator):
- (DrawMenuEntryLabel): When drawing the label text and accelerator
- text for a disabled menu entry be sure to draw a 3D highlight.
- The only exception to this is when a disabled menu entry is
- highlighted, in that case do not draw a 3D hightlight.
-
-2004-09-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinMenu.c (DrawMenuEntryAccelerator, DrawMenuEntryArrow):
- Move the unused menu arrow drawing code in
- DrawMenuEntryAccelerator into a new function named
- DrawMenuEntryArrow. This makes no functional change but it will
- make it easier to fix things in the future.
-
-2004-09-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinWm.c: Rework WS_EX_LAYERED and LWA_ALPHA
- defines so that compiling with mingw works again.
-
-2004-09-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (UpdateWrapper, WmAttributesCmd): handle attribute
- settings prior to window mapping and resort to more forceful
- wrapper update again for -toolwindow (to remove it from taskbar).
-
-2004-09-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (WmAttributesCmd): correct -alpha 0.0/1.0 setting
- and round the value.
- (UpdateWrapper): don't adjust Z order of TOPMOST window.
- (WmAttributesCmd): don't call UpdateWrapper for -disabled or
- -toolwindow attr changes.
-
-2004-09-18 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/README: typos
- * macosx/tkMacOSXDraw.c (TkMacOSXSetUpCGContext): performance
- improvements: removed slow & unnecessary calls.
-
-2004-09-17 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/winWm.test: Add 'wm attributes -alpha' to control toplevel
- * win/tkWinInt.h: alpha transparency on Win2K/XP+.
- * win/tkWinWm.c: TIP #222 [Patch 892194]
-
- * win/tkWinWm.c (UpdateWrapper): Ensure that we maintain Z order
- * tests/winWm.test: and focus of preexisting window
- when replacing the wrapper window.
- * win/tkWinWm.c (WmIconwindowCmd): Replace bogus call to
- XWithdrawWindow with proper code. (mdejong)
-
-2004-09-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkMenu.c (MenuWorldChanged): ensure that we recompute
- the menu geometry on WorldChanged to handle font size
- changes. [Bug 607649]
-
-2004-09-16 Peter Spjuth <peter.spjuth@space.se>
-
- * tests/place.test:
- * generic/tkPlace.c: Fixed a memory leak when a placed widget was
- forgotten. [Bug 1028888]
-
-2004-09-13 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (ReadIconFromFile): fix mem alloc to get the right
- size for both icons ('?:' order of precedence mistake).
-
-2004-09-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/tkfbox.tcl (::tk::dialog::file::): Make sure that the
- state is reset properly when starting to run the dialog. [Bug 845189]
-
- * library/demos/filebox.tcl: Stop the use of tk_strictMotif from
- poisoning the rest of the widget demo. [Bug 1013942]
-
-2004-09-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (ActivateWindow): SetFocus to grab window when
- clicking outside the grab window hierarchy. [Bug 220908]
- (UpdateWrapper): update to Kovalenko to account for whether the
- override window has a transient parent, and apply WS_POPUP in the
- correct case. The makes splash screens pop up as well as making
- dropdowns not grab focus away from the parent.
-
-2004-09-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c: backport of several items from 8.5 head:
- (ReadIconFromFile): when using SHGetFileInfo to retrieve icon, get
- regular icon as well for correct Alt-Tab icon. (hobbs)
- Fix for #742882 "Potential division by zero in gridded wm
- geometry" (jenglish)
- (UpdateWrapper): Let overrideredirect'ed window's wrapper be the
- child of desktop window, thus making it to behave more similarly
- to X11 Override Redirect. Esp. useful for combobox-like
- megawidgets. (kovalenko)
- (InstallColormaps): Check for TK_ALREADY_DEAD to avoid handling of
- dead windows. (kovalenko)
- Change 'panic' to 'Tcl_Panic' (davygrvy)
-
-2004-09-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/tkfbox.tcl (::tk::dialog::file::Create): use label
- instead of button for "File of type", as it properly handles
- -state disabled now.
-
-2004-08-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/text.tcl (::tk::TextTranspose): Ensure that Transpose is
- an atomic op to undo. Replace 'string compare' with 'ne'.
-
-2004-08-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinDialog.c (EatSpuriousMessageBugFix): Fix a problem with
- double clicks in file dialogs falling through to the window
- underneath in win32. [Patch #611615]
-
- * win/tkWinDialog.c (Tk_MessageBoxObjCmd): Inherit the icon from
- * win/tkWinInt.h: the -parent window for
- * win/tkWinWm.c (TkWinGetIcon): the MessageBox.
-
-2004-08-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkPanedWindow.c (optionSpecs): Add missing GEOMETRY flag
- to -handlepad option. [Bug 1010938]
-
-2004-08-10 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixWm.c: Fix for #1006686 "wm resizable command
- not working on Solaris/CDE" (patch from Colin McDonald).
-
-2004-08-09 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/canvText.test:
- * win/tkWinFont.c (Tk_MeasureChars): Fix for text
- wrapping problem that appeared using canvas text
- under Win32. A long wrapping string that had
- leading spaces was being incorrectly wrapped.
- This change makes the Win32 implementation behave
- the same as the Unix implementation. [Patch 1006286]
-
-2004-08-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkImgPhoto.c (ImgPhotoBlendComplexAlpha): Clean the code
- up a bit and add a few more comments.
- (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Clarified the code,
- corrected the compositing rule now that I have looked up what the
- right thing to do is, and factorized out the compositing rule code
- into a few simpler macros.
-
-2004-07-30 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/configure:
- * unix/tcl.m4 (SC_CONFIG_CFLAGS): Darwin: instead of setting PLAT_OBJS
- to explict object files in tcl.m4, refer to MAC_OSX_OBJS makefile var.
-
-2004-07-29 Don Porter <dgp@users.sourceforge.net>
-
- *** 8.4.7 TAGGED FOR RELEASE ***
-
- * changes:
- * generic/tkEvent.c (Tk_HandleEvent): revert the 2004-07-20 commit.
- That commit created a new Bug 1000051 - a broken Compose Key.
- This revert restores Bug 905830 until a cleaner fix can be provided.
-
-2004-07-27 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkImgGIF.c (FileReadGIF): fix crash reported by Reinhard Max:
- in case of premature end of image data, return error instead of
- passing nil buffer to Tk_PhotoPutBlock().
-
- * generic/tkRectOval.c (ComputeRectOvalBbox): Mac OS X specific
- fix to rounding in bounding box 'bloat' calculation to avoid drawing
- outside of bounding box when CG drawing enabled. Fix probably
- correct on other platforms as well?
-
- * macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): fixed LinkVar type
- for tkMacOSXCGAntiAliasLimit.
-
-2004-07-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- * changes: Updated for Tcl 8.4.7 release.
-
-2004-07-24 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXDefault.h: Change the default -tearoff value
- to 0. It doesn't work at present, so it is silly to make
- it the default.
-
- Mac OS X: Complete the implementation of the CG version of
- the X drawing emulation layer.
-
- This was mostly done by James Tittle (tigital<at>mac<dot>com),
- with a little help from me.
-
- * macosx/tkMacOSXint.h: Add declaration of TkMacOSXInitCGDrawing.
- * macosx/tkMacOSXInit.c: Call it.
- * macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): New function
- set up the variables controlling the use of cg drawing.
- (XFillRectangles): Make the CG branch work.
- (XDrawLines): Ditto
- (XDrawSegments): Ditto
- (XFillPolygon): Ditto
- (XDrawRectangle): Ditto
- (XDrawRectangles): Ditto
- (XDrawArc): Ditto
- (XDrawArcs): Ditto
- (XFillArc): Ditto
- (XFillArcs): Ditto
- (TkMacOSXSetupCGContext): Make this actually work.
- (TkMacOSXReleaseCGContext): Ditto.
-
- Mac OS X: Add support for reading the wm attributes -titlepath
- command, and convert to using FSRef's.
- This was done by Neil Madden (nem<at>cs<dot>nott<dot>ac<dot>uk).
-
- * macosx/tkMacOSXWm.c (WmAttrGetModifiedStatus): New function.
- (WmAttrGetTitlePath) New function.
- (WmAttributesCmd): Convert command parsing to use the options index.
- Use the two above functions to report results. Convert the titlepath
- code to use FSRef's.
-
-2004-07-23 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
-
- [Merge from HEAD]
-
- Mac OS X: Fix several problems with Icelandic (and Faroese) keyboards
- reported by J�r�me Gagnon-Voyer <gagnonje5000<at>mac<dot>com> on
- tcl-mac on 2004-03-22.
-
- * macosx/tkMacOSXKeyEvent.c (KLSInit): Add.
- (GetKeyboardLayout): Add calls to Keyboard Layout Services, if
- present. Rework classic handling. Use GetKCHREncoding(). Add
- parameter encodingPtr.
- (GetKCHREncoding): Add.
-
-2004-07-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/tkfbox.tcl (::tk::dialog::file::Update): use -directory
- [pwd] (instead of .) to get around some VFS edge case bugs.
- Use [bind $w], not [$w configure] to modify bindings.
-
-2004-07-20 Jim Ingham <jingham@apple.com>
-
- * generic/tkEvent.c (TkQueueEventForAllChildren): Don't queue
- events for unmapped windows.
-
-2004-07-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkEvent.c (Tk_HandleEvent): ensure IC focus is set after
- creation. [Bug #905830]
-
-2004-07-20 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/tcl.m4: fixed Darwin autoconf breakage caused by
- recent CFLAGS reordering.
- * unix/configure: regen
-
- * macosx/Makefile: added support to tk framework build to
- optionally install tk manpages in addition to html help,
- similarly to tcl/macosx/Makefile.
-
- * macosx/Wish.pbproj/project.pbxproj: fixes for building with
- non-default SYMROOT/OBJROOT/SRCROOT, added support for using a
- Tcl.framework in DYLIB_INSTALL_PATH != /Library/Frameworks,
- added optional support for building html help without tcl sources
- present by giving explicit location of tcltk-man2html script.
-
- * macosx/tkMacOSXMenu.c: fixed #include case sensitivity bug.
-
-2004-07-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in, unix/tcl.m4: move (C|LD)FLAGS after their
- * unix/configure.in, unix/configure: _DEFAULT to allow for env
- setting to override m4 switches.
- Consolidate header checks to limit redundancy in configure.
- (CFLAGS_WARNING): Remove -Wconversion, add -fno-strict-aliasing
- for gcc builds (need to suppress 3.x type puning warnings).
- (SC_ENABLE_THREADS): Set m4 to force threaded build when built
- against a threaded Tcl core.
- Reorder configure.in for better 64-bit build configuration,
- replacing EXTRA_CFLAGS with CFLAGS. [Bug #874058]
-
-2004-07-14 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXCursor.c (TkpSetCursor): The code to not
- reset the cursor more often than necessary was getting fooled
- when the current cursor was nulled out when the current cursor
- gets freed. So in the case where the input cursor was NULL, we
- have to just always set it. [Bug #894550]
-
-2004-07-14 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkUndo.c (TkUndoSetDepth): correct -maxundo
- segfault. [Bug #969358] (jiangwu)
-
- * generic/tk.h (TK_PATCH_LEVEL):
- * README, macosx/Wish.pbproj/project.pbxproj: bumped to
- * unix/configure, unix/configure.in, unix/tk.spec: patchlevel 8.4.7
- * win/configure, win/configure.in:
-
-2004-07-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/tkfbox.tcl (::tk::dialog::file::Create): Watch out for
- users destroying the dialog indirectly. [Bug 987169]
-
-2004-06-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkCmds.c (Tk_WinfoObjCmd): refetch interp result obj for
- 'winfo id' as it can change when making the window exist.
-
-2004-06-25 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkImgPhoto.c (ImgPhotoDisplay): Early exit from image
- redraw if the region to redraw is empty, so stopping XGetImage
- from bailing out. [Bug 979239]
-
-2004-06-08 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkCanvText.c (DisplayCanvText): Fix text
- rendering problem with canvas text items that
- have a selected region. The previous implementation
- would render the whole line and then redraw the
- selected text if it was a different color. This caused
- problems when the selected text foreground differs
- from the normal text foreground, the anti-aliasing
- alpha pixels for the two text strings would blend
- together resulting in strange looking text. The
- fix is to draw the normal text and the selected text
- separately. This problem has only been observed
- under Windows, with anti-aliased text. [Patch 968725]
-
-2004-05-14 Chengye Mao <chengye.geo@yahoo.com>
-
- * win/tkWinWm.c (UpdateWrapper): Modified to delete the old wrapper
- correctly [Bug #767176]
-
-2004-05-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/msgbox.tcl (MessageBox): Shrank the default font size
- for the message to 14-point; nobody liked 18-point!
-
-2004-05-12 Chengye Mao <chengye.geo@yahoo.com>
-
- * generic/tkBind.c (HandleEventGenerate): Modified to fix wish
- crash due to incorrectly generate <Destroy> event. This bug was
- reported in comp.lang.tcl but not logged.
-
-2004-05-10 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/makefile.vc: Apply fix from tcl bug #950049 for make docs.
-
-2004-05-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinFont.c (Tk_MeasureChars,Tk_DrawChars,etc): Make sure
- that the lastSubFontPtr remains valid even when the subfont array
- is reallocated. [Bug #618872] (dkf, hobbs)
-
-2004-05-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinMenu.c, unix/tkUnixMenu.c (DrawMenuEntryLabel): place
- images of compound menu entries in indicator space if not a radio
- of checkbutton. [Bug #756952] (eserte)
-
- * win/tkWinX.c: fix drawing of unicode chars in menu
- * win/tkWinInt.h (TkWinProcs): titles. [Bug #904371] (riefenstahl)
- * win/tkWinMenu.c (ReconfigureWindowsMenu):
-
- * generic/tkClipboard.c: Move TkClipCleanup from tkClipboard.c
- * mac/tkMacXStubs.c: to being implemented in a platform
- * macosx/tkMacOSXXStubs.c: specific manner. The cleanup order was
- * unix/tkUnixEvent.c: bad at least on Windows, where we
- * win/tkWinX.c: reset/cleared display info that was
- still needed for the clipboard to render.
- [Bug #939389, #822002, #732662]
-
- * library/panedwindow.tcl (MarkSash): call DragSash to stop sash
- jump when B1 is pressed and released without moving. [Bug #932155]
- Make the panedwindow -opaqueresize option work as per the docs.
- [Bug #778893]
-
- * tests/panedwindow.test: panedwindow-25.1
- * generic/tkPanedWindow.c (Unlink): clean up -before/-after refs
- to a slave when removing it. [Bug #928413] (griffin)
-
- * generic/tkImgPhoto.c (ImgPhotoConfigureMaster): force -data into
- ByteArray and -format into String to correctly handle them if they've
- been shimmered or created as some other object type. [Bug #1027849]
- (ImgPhotoCmd): correctly init matched to 0.
-
-2004-04-20 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixWm.c: Backported fix for bug #915350
- "Tk sets min, max size in WM_HINTS when it shouldn't"
- and #922336 "Tk apps have no maximize window button under
- KDE-3.2.1"
-
-2004-04-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/bgerror.tcl (bgerror): rework to only set -topmost bit
- on Windows if necessary. Also use existing ::tk functions for
- placing dialog and managing focus/grab.
-
-2004-03-31 Jim Ingham <jingham@apple.com>
-
- * tkMacOSXMenu.c (EventuallyInvokeMenu): Report errors from invoking
- menu commands as background errors. [Bug 220871]
-
-2004-03-26 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkImgPPM.c (ReadPPMStringHeader): Code to read PPM/PGM data
- (StringReadPPM, StringMatchPPM): from strings/bytearrays. [FRQ 540375]
- * generic/tkImgPPM.c (StringWritePPM): New function to support
- converting of images to PPM strings. Other direction not yet
- done. Rest of file converted to use new image API.
- * generic/tkImgPhoto.c (ImgPhotoCmd): Restored support for the
- stringWriteProc of old photo formats. [Bug 923555]
-
-2004-03-20 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXSubwindows.c (GenerateConfigureNotify): New
- function.
- (XMoveWindow): Generate configure notify events for child
- widgets on move.
- (XMoveResizeWindow): Ditto.
-
-2004-03-17 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXHLEvents.c (ApplicationCarbonEventsHandler): New
- function.
- (tkMacOSXInitAppleEvents): Init the Application Event handler as
- well.
- * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): Grab
- the Command-H & Command-Shift-H keys and use them for Hide and
- Hide Others before passing keystrokes on to the generic keyboard
- event processing. There isn't any other good way to get the
- Hide command to work, and the Apple HIG explicitly reserves them.
- * macosx/tkMacOSXMenus.c (TkMacOSXInitMenus): Stop putting a Quit
- menu item in the File menu. It doesn't belong there.
-
-2004-03-01 Don Porter <dgp@users.sourceforge.net>
-
- *** 8.4.6 TAGGED FOR RELEASE ***
-
- * unix/tcl.m4 (SC_CONFIG_CFLAGS): Allow 64-bit enabling on
- IRIX64-6.5* systems. [Bug 218561]
- * unix/configure: autoconf-2.13
-
-2004-02-23 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXXStubs.c:
- * xlib/ximage.c: fixed MacOSX XGetImage/XPutImage and related
- functions to deal properly with XImages copied from screen.
- * generic/tkCanvPs.c (TkImageGetColor): MacOSX fix.
- * generic/tkImgPhoto.c (ImgPhotoDisplay): enabled alpha blending
- for images with partial transparency on MacOSX.
- [Bug 809157]
-
-2004-02-18 Peter Spjuth <peter.spjuth@space.se>
-
- * tests/grid.test:
- * generic/tkGrid.c: Fixed a bug in grid geometry calculations for
- a shrinking grid. [Bug 899246]
-
-2004-02-17 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkBind.c (HandleEventGenerate): only modify root[xy]
- with [xy] when they haven't been otherwise set.
-
-2004-02-17 Don Porter <dgp@users.sourceforge.net>
-
- * tests/imgPhoto.test (imgPhoto-16.1): Corrected incorrect
- variable name [Bug 899010].
-
-2004-02-17 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXMouseEvent.c: fixed modifiers for MouseWheel events.
-
- * library/listbox.tcl:
- * library/text.tcl:
- * library/scrlbar.tcl: on Mac OS, add bindings for MouseWheel with
- modifiers, according to platform convention:
- Option increases scrolling speed 10 fold; Space scrolls horizontally.
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/tkAboutDlg.r: changed year in copyright strings to 2004.
-
-2004-02-16 Jim Ingham <jingham@apple.com>
-
- Fix for MouseWheel Events (from Daniel Steffen):
-
- * generic/tkEvent.c (Tk_HandleEvent): On Mac OS X, don't route
- MouseWheel events to the Focus window. They are sent to the
- window under the pointer on X (and the GenerateMouseWheelEvent
- already got this right.)
- * library/listbox.tcl: On Mac OS, don't use the magic 120
- divisor that is used on Windows. We may come up with a cleaner
- way to do this for the TOT, but this is simple and will do for the
- 8.4 branch.
- * library/text.tcl: Ditto.
- * doc/bind.n: Update the docs to reflect the changes.
-
-2004-02-15 Jim Ingham <jingham@apple.com>
-
- Backport Mac OS X specific fixes from TOT:
-
- * macosx/tkMacOSXKeyboard.c: General cleanup. Add support for
- [event generate]. [Bug #860454] - [Benjamin Riefenstahl]
- * macosx/tkMacOSXKeyboard.c: Add PowerBook keycode 0x34 as <Return>.
- [Benjamin Riefenstahl]
-
- * macosx/tkMacOSXScrlbr.c: Reworking Vince's fix to [Bug 842952].
- This version is clearer, and works helps keep the mouse better
- pinned to the scrollbar. I also removed the glitch where the
- scrollbar would jump get its middle over the mouse when you first
- moved it.
-
- * macosx/tkMacOSXClipboard.c (TkSuspendClipboard, TkSelGetSelection):
- add unicode clipboard support. [Patch #840107] (senn)
-
- * macosx/tkMacOSXDialog.c (NavServicesGetFile): Minor cleanups.
- * (OpenFileFilterProc): Handle FSRef's as well as FSSpec's in the input
- file. Also convert the FSSpec filename to an C-string before passing
- to MatchOneFile. [bug 517600]
- * (MatchOneFile): Require the input filename to be a C-string, not a
- pascal string.
-
- * macosx/tkMacOSXDialog.c (MatchOneType): If the Macintosh filetype
- is 0, then automatically pass the fileType check.
-
- * macosx/tkMacOSXButton.c (TkpDisplayButton): Use the tk text
- drawing for checkbuttons & radiobuttons as well as for labels.
- * macosx/tkMacOSXEvent.c (XSync): New function, need to implement
- this so drawing will get flushed in "update idletasks".
- * tkMacOSXPort.h: convert #define of XSync to function def'n.
-
- * generic/tkWindow.c:
- * macosx/tkMacOSXDialog.c: added native tk_messageBox command,
- (Tk_MessageBoxObjCmd) for MacOS X platform. [Vince Darley]
-
- * macosx/tkMacOSXMenu.c: corrected encoding conversion for
- torn-off menu entries (but many other display problems still
- exist with these) [Vince Darley]
-
- * macosx/tkMacOSXMouseEvent.c: improved handling of events in the
- presence of grabs, particularly activation events. [Vince Darley]
-
- * macosx/tkMacOSXColor.c (GetControlPartColor): Use
- the ThemeBrushes to get the control text color for
- buttons.
-
- * tkMacOSXAppInit.c: Formatting cleanups.
- * tkMacOSXButton.c: Ditto
- * tkMacOSXClipboard.c: Ditto
- * tkMacOSXDebug.c: Ditto
- * tkMacOSXDialog.c: Ditto
- * tkMacOSXDraw.c: Ditto
- * tkMacOSXEvent.c: Ditto
- * tkMacOSXFont.c: Ditto
- * tkMacOSXHLEvents.c: Ditto
- * tkMacOSXInit.c: Ditto
- * tkMacOSXInt.h
- * tkMacOSXKeyEvent.c: Ditto
- * tkMacOSXMenu.c: Ditto
- * tkMacOSXMenubutton.c: Ditto
- * tkMacOSXMouseEvent.c: Ditto
- * tkMacOSXNotify.c: Ditto
- * tkMacOSXScale.c: Ditto
- * tkMacOSXScrlbr.c: Ditto
- * tkMacOSXSubwindows.c: Ditto
- * tkMacOSXWindowEvent.c: Ditto
- * tkMacOSXWm.c: Ditto
-
-2004-02-13 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinFont.c (Tk_MeasureChars): backport fixes to bold/italic
- font handling. [Patch 852669] [Bug 478568]
- * tests/textDisp.test: added test for the font measurement
- problem.
-
-2004-02-13 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXDialog.c (Tk_GetOpenFileObjCmd): Use CFStringRef for
- title & message options, not pascal strings.
- (Tk_GetSaveFileObjCmd): Ditto
- (Tk_ChooseDirectoryObjCmd): Ditto
- (NavServicesGetFile): Now that we get CFStrings, we don't need
- to convert them here.
-
- * macosx/tkMacOSXMenu.c (TkMacOSXDispatchMenuEvent): Cleanup, we don't
- need to handle the Apple Menu picks any more, but the code didn't
- reflect that.
-
- * macosx/tkMacOSXWm.c (TkSetWMName): Use CFStrings for the Window Title
- name, not Pascal strings.
-
-2004-02-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * README: update to patchlevel 8.4.6
- * generic/tk.h:
- * macosx/Wish.pbproj/project.pbxproj:
- * unix/configure, unix/configure.in, unix/tk.spec:
- * win/configure, win/configure.in:
-
- * tests/window.test: simple code cleanup
-
- * win/tkWinDialog.c (ChooseDirectoryValidateProc): create a pidl
- for -initialdir if we have a UNC path because BFFM_SETSELECTION
- doesn't support UNC paths in strings.
-
-2004-02-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/msgs/eo.msg: Language support for Esperanto and Polish from
- * library/msgs/pl.msg: Artur Trzewik <mail@xdobry.de> with thanks.
-
-2004-02-09 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
- * tests/imgPhoto.test (imgPhoto-16.1): Better handling of the case
- when copying from one area of a photo to another triggers a
- resizing of the image. [Bug 877950]
-
-2004-02-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/menu.tcl (::tk::MbPost): make menubuttons that post
- above or below reverse direction when not enough space is available.
-
-2004-01-28 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/tkWinCursor.c: Backported fix for bug #776646 which makes
- * tests/cursor.test: hand2 and fleur native on windows.
-
-2003-01-27 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: removed erroneous reference
- to mkpsenc.tcl in bundle resources phase (mkpsenc.tcl is already
- part of the copy files phase to Resources/Scripts).
-
- * macosx/Makefile: added support for 'xcodebuild' on Mac OS X 10.3.
-
-2003-12-31 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: added missing private headers
- to installed Tk.framework, so that tkInt.h can be included
- sucessfully from Tk.framework/PrivateHeaders.
- * generic/tkPort.h: corrected include of tkMacOSXPort.h
-
-2003-12-17 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXScrlbr.c: Reworking Vince's fix to [Bug 842952].
- This version is clearer, and works helps keep the mouse better
- pinned to the scrollbar. I also removed the glitch where the
- scrollbar would jump get its middle over the mouse when you first
- moved it.
-
- Import from TOT.
-
-2003-12-11 David Gravereaux <davygrvy@pobox.com>
-
- * win/winMain.c: Backed-out yesterdays change. Reverted to 1.15 for
- two reasons. 1) problem is best addressed in Tcl's DllMain() and
- 2) needs a MinGW custom assembly implimentation as it doesn't
- understand SEH syntax.
-
-2003-12-10 David Gravereaux <davygrvy@pobox.com>
-
- * win/winMain.c (WishPanic) : placed ExitProcess() in a __try block
- (SEH) to catch any exceptions that might happen. As Tcl will call
- Tcl_Finalize from its DllMain due to the unload from ExitProcess()
- unloading Tcl, and if Tcl_Panic had gotten called in an __except
- block handling an exception, this avoid the possibility of not
- being able to exit from the stack being a mess. Falls to
- TerminateProcess() in the __except case.
-
- Removed the #ifdef _MSC_VER around DebugBreak as that function
- exists in kernel32.dll and is not compiler dependent. I'd prefer
- to use 'if (IsDebuggerPresent()) DebugBreak();' but
- IsDebuggerPresent() isn't available in all kernel32.dll modules
- for all versions of windows.
-
-2003-12-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * doc/CrtImgType.3: Fixed line-transposition error found by Eric
- Raymond. [Bug 857159]
-
-2003-12-03 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tk.h: Bumped patch level to 8.4.5.1 to distinguish
- * unix/configure.in: CVS snapshots from the 8.4.5 release.
- * unix/tk.spec:
- * win/configure.in:
-
- * unix/configure: autoconf (2.13)
- * win/configure:
-
-2003-12-02 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkMenu.c (MenuVarProc): prevent this from triggering
- while interp is being destroyed.
-
-2003-11-21 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
-
- *** 8.4.5 TAGGED FOR RELEASE ***
-
- * macosx/tkMacOSXKeyboard.c: Add PowerBook keycode 0x34 as
- <Return>. (Merge from trunk)
-
-2003-11-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * changes: updated for 8.4.5 release
-
-2003-11-17 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkMenubutton.h: fixed compound menubutton handling like
- * generic/tkMenubutton.c: *button corrections of 2003-04-25.
- * mac/tkMacMenubutton.c (TkpDisplayMenuButton):
- * unix/tkUnixMenubu.c (TkpDisplayMenuButton):
-
-2003-11-16 Don Porter <dgp@users.sourceforge.net>
-
- * win/makefile.vc: Restored consistency of pkgIndex.tcl file
- with that generated by Makefile.
-
-2003-11-15 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.vc: Fixes pkgIndex.tcl generation so a symbols build
- is loaded when Tcl is symbols.
-
-2003-11-11 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure:
- * unix/tcl.m4: improve AIX --enable-64bit handling
-
- * generic/tkButton.c (ConfigureButton): abort option processing if
- the button was deleted. [Bug #824479]
-
- * generic/tkMenuDraw.c (TkPostSubmenu): add {} around menu name in
- case it has spaces when calling Tcl_VarEval. This is a hack until
- this is rewritten for proper Tcl_Obj handling. [Bug #723856]
-
- * library/tkfbox.tcl (::tk::dialog::file::Update): optimize the
- dir/files list separation by using the -tails, -directory and
- -type option of 'glob'. Also passes the glob the -filetypes
- filters instead of calling string match over each file.
- [Patch #833819]
- (::tk::dialog::file::ActivateEnt): allow typing filename into
- entry when tk_getOpenFile -multiple 1 is specified. [Bug #788069]
-
- * generic/tkListbox.c (ListboxDeleteSubCmd, ListboxListVarProc):
- free itemconfig data when removing it from table. [Bug #836483]
-
- * macosx/tkMacOSXClipboard.c (TkSuspendClipboard, TkSelGetSelection):
- add unicode clipboard support. [Patch #840107] (senn)
-
-2003-11-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinDraw.c (XFillRectangles): correctly handle the
- XGCValues.function parameter when filling rectangles.
- [Bug #820278] [Patch #820282]
-
- * generic/tkImgPhoto.c (ImgPhotoBlendComplexAlpha): add alpha
- blending for images with partial transparency. Only operates for
- 15bpp+ display, and not on Mac at all. [Bug 809157]
-
- * win/configure:
- * win/configure.in: define TK_LIB_FLAG, TK_LIB_SPEC,
- TK_BUILD_LIB_SPEC, TK_STUB_LIB_SPEC, TK_STUB_LIB_PATH, and
- TK_BUILD_STUB_LIB_PATH for tkConfig.sh [Bug #826614]
-
- * unix/Makefile.in (SHLIB_LD_FLAGS): include in Makefile as it is
- used in MAKE_LIB sometimes (ie: AIX-64) [Bug #829686] (jimix)
-
-2003-11-01 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/msgs/nl.msg: Updated messages from Arjen Markus and
- Pascal Scheffers. Thanks! [Patch 820519]
-
-2003-10-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * library/tkfbox.tcl (IconList_Create,IconList_Add): Added option
- munging to allow some control of foreground colours on Unix in the
- same way that you can influence the background. [Bug 795717]
-
-2003-10-28 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixFont.c (GetFontAttributes): place extra check for NULL
- family against bad X servers.
-
- * win/tkWinImage.c (XGetImageZPixmap): add separate 16bpp
- XGetImage code to correctly handle 16bpp requests. This appears
- to never have worked correctly.
-
- * tests/focusTcl.test (setup1): expand frame size to allow for
- correct visibility of windows that use larger default fonts.
-
-2003-10-28 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/tk.tcl (::tk::PlaceWindow): Added check for empty string
- first when determining placement strategy. [Bug 819284]
-
-2003-10-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/dialog.tcl (tk_dialog): Constrain the dialog to be
- fairly sensibly sized and placed. [Bug 827535]
-
-2003-10-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkInt.h: move TkGetOptionSpec to stubs intDecls
- * generic/tkIntDecls.h:
- * generic/tkInt.decls:
- * generic/tkStubInit.c:
-
- * tests/listbox.test (13.3): correct result size
- (4.7): correct test for possible window drift [Bug #701931] (dgp)
-
- * unix/mkLinks:
- * doc/GetHWND.3: add Tk_AttachHWND docs [Bug #220803]
-
-2003-10-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- * mac/tkMacButton.c (TkpDisplayButton):
- * macosx/tkMacOSXButton.c (TkpDisplayButton):
- * unix/tkUnixButton.c (TkpDisplayButton): correct imageYOffset for
- buttons with just images.
-
-2003-10-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinButton.c (TkpDisplayButton): correct imageYOffset for
- buttons with just images.
-
-2003-10-06 Don Porter <dgp@users.sourceforge.net>
-
- * doc/ConfigWidg.3: Removed reference to Tk_Offset from the
- NAME section to resolve mkLinks conflict with SetOptions.3 [Bug 404197]
-
- * unix/configure.in: Reconfigured to use $TCL_PREFIX as the
- default value of --prefix, and also added warning when a TK_PREFIX
- value different from TCL_PREFIX is selected, since [package require Tk]
- fails in that configuration. [Bugs 428627,765642]
-
- * unix/tcl.m4 (SC_PATH_TCLCONFIG): Corrected search path so
- that alpha and beta releases of Tcl are not favored. [Bug 608698]
-
- * unix/configure.in: Added check that version of Tcl header found
- by configure matches that of the Tk we wish to build. As long as
- the Tk sources insist on lockstep releases, Tk's configuration should
- verify that's what we have. [Bug 749088]
-
- * unix/configure: autoconf (2.13)
- * unix/mkLinks: make mklinks
-
-2003-10-03 Don Porter <dgp@users.sourceforge.net>
-
- * README: Bumped to patch level 8.4.5
- * generic/tk.h: to prepare for next patch
- * macosx/Wish.pbproj/project.pbxproj: release.
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
-
- * unix/configure: autoconf (2.13)
- * win/configure:
-
-2003-10-03 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * library/scale.tcl: Clear bug with chording mouse buttons.
-
-2003-10-01 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Makefile: fixed redo prebinding bug when DESTDIR="".
- Added support for all applicable customizable makefile variables
- from tcl/macosx/Makefile.
-
- * macosx/README:
- * macosx/Wish.pbproj/project.pbxproj: ensure that the versioned
- wishX.X script works correctly when Tk.framework with multiple
- versions is present by referring to a copy of 'Wish Shell.app'
- located in Tk.framework/Versions/X.X/Resources.
-
-2003-09-29 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * unix/tcl.m4 (SC_ENABLE_FRAMEWORK): Added note to make it clearer
- that this is an OSX feature, not a general Unix feature. [Bug 619440]
-
-2003-09-26 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
-
- * macosx/tkMacOSXWm.c (TkWmStackorderToplevelWrapperMap): Add
- GetWindowFromPort() [Bug #812415]; make function static.
-
-2003-09-25 Daniel Steffen <das@users.sourceforge.net>
-
- * library/demos/widget: don't create iconwindow on aqua, but add
- about menu like on classic.
- * macosx/Makefile: pass MAKEOVERRIDES to pxbuild.
- * macosx/tkMacOSXButton.c: added -compound support for bevel buttons.
-
-2003-09-17 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkImage.c: Stopped [image create] from generating an
- * tests/image.test: image command name that would overwrite an
- existing command name. Thanks to Michael Schlenker. [Bug 808039].
-
-2003-08-19 Joe English <jenglish@users.sourceforge.net>
- * generic/tkPanedWindow.c(PanedWindowWorldChanged):
- Set window background from the -background resource.
- Fixes [BUG #791500 "PanedWindow refresh glitches on X"]
-
-2003-08-13 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * library/scale.tcl: Fix for bug #787065 for Button-2 press.
- * tests/scale.test: Added test for this bug.
-
-2003-08-12 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXMenu.c: fixed C99'ism that breaks gcc 2.95.
-
-2003-07-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4.4 TAGGED FOR RELEASE ***
-
- * changes: updated for 8.4.4 release
-
-2003-07-20 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/buildTkConfig.tcl: fix to TK_BUILD_* ref generation
- broken by changes to tcl buildsystem.
-
-2003-07-19 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * library/scale.tcl: Fix for bug 706765 to correctly handle the
- -sliderrelief option while moving the thumb.
-
-2003-07-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixFont.c (Tk_DrawChars): do not make XGetGeometry call
- that prevents overwidth lines as it requires a roundtrip call to
- the X server for every string drawn. Hard-code max width to 32768
- until a beter solution to get max width is made.
-
- * library/panedwindow.tcl: use widget-specific Priv slots for
- pwAfterId and panecursor items to correctly handle cursor changes
- with adjacant panedwindows.
-
- * generic/tkEvent.c (Tk_HandleEvent): correct XCreateIC call for
- TK_XIM_SPOT usage. [Bug 742660] (takahashi)
-
- * win/tkWinCursor.c (TkGetCursorByName): Fix bug 420510 to provide
- consistency between unix and windows -cursor option. (thoyts)
-
- * win/tkWinDialog.c: doubled the TK_MULTI_MAX_PATH value to ~10K.
- This is a short-term solution until the -multiple option is
- extended. [Bug 641261]
-
-2003-07-18 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/panedwindow.test (panedwindow-30.2):
- * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd): Ensure that we
- can share GCs between a panedwindow and its sash proxy, even if
- the panedwindow is in a toplevel with a different visual. [Bug 702230]
-
-2003-07-17 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Makefile: Changes for new tcl buildsystem.
-
- * macosx/Wish.pbproj/jingham.pbxuser:
- * macosx/Wish.pbproj/project.pbxproj:
- Changes for new tcl buildsystem.
- Changed build to include tk specific html help in Tk.framework
- instead of Tcl.framework.
- Set default SYMROOT in target options to simplify setting up PB
- (manually setting common build folder for tcl & tk no longer needed).
-
- * macosx/README: Updated info for changes to buildsystem,
- html help location and PB setup.
-
-2003-07-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/photo.n: [$photo put] has been able to take rectangles of
- pixel colours, specified as lists of lists, for years. Now this
- is a documented feature. [Bug 728952]
-
- * generic/tkPanedWindow.c (PanedWindowReqProc): Fix from Eric
- Boudaillier so panedwindows get their geometry right even when
- their children don't know their size initially. [Bug 738143]
- * doc/panedwindow.n: Removed sentences about the use of [update
- idletasks] with this command, as that is no longer necessary with
- the fix from Bug 738143. [Bug 747814]
-
- * generic/tkImgPhoto.c (ImgPhotoCmd): Rewrote subcommand processing
- to never jump to the end of the switch. I find that confusing as
- I can't see whether there's processing still to be done from a
- quick glance at the code, unlike with a direct return. [Bug 771988]
- (ImgPhotoCmd, ImgPhotoSetSize, ImgPhotoInstanceSetSize): Try harder
- to avoid zero-length mallocs()... [Bug 404421]
-
-2003-07-16 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkPack.c (ConfigureSlaves): silence compiler warning
- [Bug 771982]
-
-2003-07-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinImage.c (XGetImage): correct init of biSizeImage in
- bitmap header. [Bug 703697] (cap)
-
-2003-07-17 Peter Spjuth <peter.spjuth@space.se>
-
- * tests/frame.test:
- * generic/tkFrame.c (CreateFrame): Make sure all options can be set
- to their default value. [Bug #697652]
-
-2003-07-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkPanedWindow.c (ArrangePanes): Ensure that the last pane
- * tests/panedwindow.test: shrinks instead of being clipped when
- resized below the reqsize. [Bug 748277] (spjuth)
-
- * generic/tkWindow.c (Initialize): do not free uninit'ed dstring.
- [Bug 755906] (mistachkin)
-
-2003-07-15 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/tkUnixEvent.c (TkpCloseDisplay): Don't
- test for XCloseIM bug when the XFree86 version
- is newer than 4.0 since the layout of the
- XIM structure has changed. The check is not
- needed for newer XFree86 releases since
- the bug we are checking for was fixed in
- the 4.2.99.2 release. [Bug 755530]
-
-2003-07-15 Don Porter <dgp@users.sourceforge.net>
-
- * README: Bumped patchlevel to 8.4.4 in preparation
- * generic/tk.h: for the Tk 8.4.4 release.
- * macosx/Wish.pbproj/project.pbxproj:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
-
- * unix/configure: autoconf (2.13)
- * win/configure:
-
-2003-07-15 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkMenu.c
- * generic/tkMenu.h
- * generic/tkMenuDraw.c:
- * tests/menu.test: fixed complex bug in menu clone cleanup
- [Bug#465324] and removed 'knownBug' from a test.
- (This was applied to cvs head on 2003-05-03).
-
-2003-07-09 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/send.test: Strengthened constraints to stop accidental
- smashing of Xserver access; some systems (*ahem* mine *ahem*)
- require xhost-style security for all use... :^/
-
-2003-07-07 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkImage.c (TkDeleteAllImages,etc.): Stopped the deleting
- of hash entries from a table that has just been deleted by this
- function when some images are Tcl_Preserve()d... [Bug 749353]
-
-2003-05-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4.3 TAGGED FOR RELEASE ***
-
- * changes: updated for 8.4.3
-
- * unix/Makefile.in: do not run autoconf during 'make dist' as the
- configure is now a CVS-maintained file and should be up-to-date.
-
-2003-05-19 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: changed tkConfig.sh location
- in versioned framework subdirectories to be identical to location
- in framework toplevel; fixed stub library symbolic links to be
- tk version specific.
-
-2003-05-15 Jeff Hobbs <jeffh@ActiveState.com>
-
- * README: Bumped version to 8.4.3
- * generic/tk.h:
- * macosx/Wish.pbproj/project.pbxproj:
- * unix/configure:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure:
- * win/configure.in:
-
- * unix/tkUnixFont.c: use gb2312-raw as the alias for gb2312*
- charset fonts. gb2312.enc was made to be euc-cn for Tcl because
- that is what is most often meant, but X really wants the original
- (-raw) gb2312 encoding. [Bug 557030]
-
-2003-05-14 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/msgs/fr.msg: updated msg catalog. [Bug #737790] (zolli)
-
-2003-05-13 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXInit.c (TkpInit): use new versioned bundle
- resource API to get tk runtime library for TK_VERSION. [Bug 736774]
-
-2003-05-13 Daniel Steffen <das@users.sourceforge.net>
-
- backport of Mac OS X specific changes on trunk since 8.4.2:
-
- * macosx/tkMacOSXClipboard.c (TkSelGetSelection): Convert
- '\r' to '\n' on the way into Tcl. (ingham)
-
- * macosx/tkMacOSXMenu.c (EventuallyInvokeMenu): New function,
- used to invoke menu commands at idle time.
- (TkMacOSXDispatchMenuEvent): Don't immediately dispatch menu
- commands, wait till the idle loop to do so. This is more like
- what is done on Windows, and avoids the crash from destroying
- a menu in it's command. (ingham)
-
- * macosx/tkMacOSXHLEvents.c (ReallyKillMe): Don't force the shell
- to exit. According to the OS X HI guidelines, it should be
- possible to cancel an attempt to quit, and if we force the kill,
- here, it would not be possible to implement this. (ingham)
-
- * macosx/tkMacOSXApplication.r (removed):
- * macosx/tkMacOSXLibrary.r (removed):
- * macosx/tkMacOSXResource.r (removed):
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/tkAboutDlg.r: updated copyrights, cleaned up about box,
- removed obsolete unused resource files. (steffen)
-
-2003-05-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkCanvPoly.c (PolygonToPostscript):
- * tests/canvPs.test: correct crash when generating postscript for
- a single-line polygon (point) with no color. [Bug #734498] (wilm)
-
-2003-04-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXButton.c (TkpDisplayButton): correct typo for
- stippleGC [Bug #730124].
-
-2003-04-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkButton.h: Rewrote the handling
- * generic/tkButton.c (TkButtonWorldChanged): of compound *buttons
- * mac/tkMacButton.c (TkpDisplayButton): to correctly display
- * macosx/tkMacOSXButton.c (TkpDisplayButton): mixture of disabledfg,
- * unix/tkUnixButton.c (TkpDisplayButton): selectcolor, indicator,
- * win/tkWinButton.c (TkpDisplayButton): etc. *buttons will
- now only stipple the image, unless no disabledfg is given, in which
- case it will stipple the whole button.
-
- * library/bgerror.tcl: make bgerror dialog topmost on Windows to
- prevent it being covered by other windows.
-
- * unix/tkUnixButton.c (TkpDisplayButton): Use the normalTextGc when
- * win/tkWinButton.c (TkpDisplayButton): displaying disabled text
- that have images, as they get a gray50 stipple as well and the
- disabledGc is not set up correctly for font drawing. [Bug #477740]
-
-2003-04-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkCanvBmap.c: s/CreateBitmap/TkcCreateBitmap as Windows
- has a CreateBitmap function already.
-
- * generic/tkCursor.c: s/GetCursor/TkcGetCursor as Windows has a
- GetCursor func already, which causes compiler warnings.
-
-2003-04-02 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/configure: Regen.
- * win/configure.in: Set stub lib flag based
- on new LIBFLAGSUFFIX variable.
- * win/tcl.m4: Update from Tcl to get new
- LIBFLAGSUFFIX variable.
-
-2003-04-02 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/configure: Regen.
- * win/configure.in: Don't set TCL_DLL_FILE,
- TCL_LIB_FILE, TCL_STUB_LIB_FILE, TCL_STUB_LIB_FLAG,
- and TCL_BUILD_STUB_LIB_SPEC. These variables are
- already set in tclConfig.sh.
- [Bug 691908]
-
-2003-03-22 Kevin Kenny <kennykb@acm.org>
-
- * win/makefile.vc:
- * win/rules.vc: Corrected several problems that prevented
- OPTS=symbols from building properly. [Patch 707792] Thanks
- to Joe Mistachkin for the fixes.
-
-2003-03-18 Don Porter <dgp@users.sourceforge.net>
-
- * tests/unixWm.test (unixWm-41.2): Corrected typo in 2003-03-13
- commit. Thanks Larry Virden. [Bug 705567]
-
-2003-03-18 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Makefile:
- * macosx/README: added support for giving 'make' the location
- of Tcl.framework and tclsh to build and link against.
-
- * macosx/tkMacOSXXStubs.c: fixed crash in [winfo server].
-
-2003-03-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/msgbox.tcl (Tk::MessageBox): Stop buttons from being
- very wide when a messageBox has a lot of content. [Bug #701812]
-
-2003-03-13 Don Porter <dgp@users.sourceforge.net>
-
- * tests/unixWm.test: Constrained all tests older than revision 1.21
- to run only on Unix. Alternative approach did not match maintainer
- habits.
- * tests/spinbox.test (spinbox-17.4): Avoid long failure message.
-
-2003-03-13 Kevin Kenny <kennykb@users.sourceforge.net>
-
- * win/makefile.vc: Backed the version to 8.4 on the 8.4 branch.
- (I just loathe sticky tags).
-
-2002-03-11 Kevin Kenny <kennykb@users.sourceforge.net>
-
- * win/makefile.vc: Backported the code that makes the makefile
- build pkgIndex.tcl as part of the install step.
-
-2003-03-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4.2 TAGGED FOR RELEASE ***
-
-2003-02-28 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/bind.test (bind-16.44):
- * generic/tkBind.c (ExpandPercents): Only allow events to see
- those expansions that are actually valid for them, and force the
- substitution of the rest as "??". This stops some crashes on
- Windows and gets rid of bogus values everywhere. [Bug #612110]
-
-2003-02-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/README: correct 8.4.3 refs to 8.4.2.
-
- * unix/README: replace version refs with version-agnostic wording.
-
-2003-02-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinInt.h:
- * win/tkWinDraw.c:
- * win/tkWinFont.c (Tk_DrawChars): add support for simple XOR text
- drawing on Windows. [Patch #685388] (martin)
-
- * generic/tkMenu.c (TkMenuCleanup): make sure to reset static
- menusInitialized on finalize. [Bug #548729]
-
-2003-02-25 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXHLEvents.c: fixed conversion of apple event
- parameters to posix style path names.
- [Bug #621672] (steffen, Benjamin Riefenstahl)
-
- * macosx/tkMacOSXDialog.c:
- * macosx/tkMacOSXWm.c:
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/tkMacOSXUtil.c (removed):
- * macosx/tkMacOSXUtil.h (removed): removed all references to
- tkMacOSXUtil.{c,h}, made obsolete by the patch above. [Bug #621672]
-
-2003-02-24 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixFont.c (CreateClosestFont, CanUseFallback): use the
- first best font match in user font path. [Bug #647497] (dal zotto)
-
- * generic/tkListbox.c (ListboxSelectionSubCmd):
- * tests/listbox.test: Allow 'selection includes' to respond when
- disabled (but only 'includes'). [Bug #632514]
-
- * unix/tkUnixButton.c (TkpDisplayButton): Correct visual display
- of disabled check/radiobutton to be more distinctive on unix.
- * tests/unixButton.test: [Bug #669595] (hintermayer)
-
- * doc/panedwindow.n: clarified the need to use 'update idle' when
- adding unmapped windows. Needs further examination. [Bug #605105]
-
- * generic/tkEntry.c (SpinboxWidgetObjCmd, EntryWidgetObjCmd):
- * tests/entry.test: return 1 if selection is present even if
- * tests/spinbox.test: entry/spinbox is disabled, as selection get
- will still return the selection (although selection still ignore
- modify requests when entry/spinbox is disabled). [Bug #637828]
-
-2003-02-24 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
-
- * tkMacOSXDialog.c (NavServicesGetFile): Fix bug with
- kNavCtlSetSelection - control data should be a pointer
- not a handle.
-
-2003-02-21 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/clrpick.tcl (color::BuildDialog):
- * library/msgbox.tcl (MessageBox): Yet more places that did
- complex and fragile width calculations instead of using grid,
- though with these it is the -uniform option that saves the day.
-
- * library/tkfbox.tcl (file::Create): This procedure was really
- very crufty in how it went about creating the GUI. It is far
- easier and more robust to use the grid geometry manager than it is
- to tune the results of pack with tweaks to -width. [Bug #673722]
-
- * library/comdlg.tcl (FDGetFileTypes): Set an upper limit on how
- long a file type item description string can get due to appending
- of types. [Bug #617392]
-
- * tests/panedwindow.test (panedwindow-30.1):
- * generic/tkPanedWindow.c (DisplayPanedWindow, DisplayProxyWindow):
- Use the window's depth, not the screen's default depth. [Bug #671122]
-
-2003-02-20 Daniel Steffen <das@users.sourceforge.net>
-
- * library/console.tcl: (aqua & macintosh) added missing <Cmd-q>
- binding for corresponding Quit menu item shortcut.
-
- * macosx/README: updated instructions for embedded build,
- added various improvements by Russell Owen.
-
- * unix/tcl.m4: update from Tcl.
- * unix/configure: regen.
-
-2003-02-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinScrlbr.c (UpdateScrollbar): use SIF_DISABLENOSCROLL to
- "disable" scrollbar when on Windows when there is nothing to
- scroll. This is Windows style, and fixes [Bug #624116].
-
- * tests/panedwindow.test:
- * generic/tkPanedWindow.c (ValidSashIndex): corrected to note that
- 2 panes must exist before any one sash does. [tcllib Bug #689258]
-
-2003-02-20 Peter Spjuth <peter.spjuth@space.se>
-
- * tests/panedwindow.test:
- * generic/tkPanedWindow.c: Fixed calculation of the last slave's
- size when increasing the size of the panedwindow. [Bug #689099]
-
-2003-02-20 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkImgGIF.c (GetDataBlock): Removed pointless static
- variable ZeroDataBlock [Bug #664788]
-
- * unix/tkUnixFont.c (CanUseFallback): Added argument, passed
- through from callers to FindSubFontForChar(), so that pointers
- into the old subfont table to be updated when that table is
- reallocated, avoiding a (sometimes fatal) FMR.
- [Bugs #618872 and #689357]
-
-2003-02-19 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXKeyEvent.c: fix for uninitialized var warning.
-
-2003-02-19 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXMouseEvents.c (GeneratePollingEvents): In the case
- where there was a capture window, we were sending the events to
- the capture window. But the capture window (return value or
- TkMacOSXGetCapture) is always a toplevel. So this is wrong in
- the case that the Event's toplevel IS the capture window - in
- which case the event should go to the subwindow most closely
- containing the event.
-
-2003-02-19 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
- & Jim Ingham <jingham@apple.com>
-
- This patch changes the default Tk behavior so that events
- are by default routed to the standard event handlers after
- Tk has looked at them.
-
- * macosx/tkMacOSXEvent.h: Rename "handledByTk" into
- "stopProcessing".
-
- * macosx/tkMacOSXEvent.c: Update erroneous comments and
- remove unused includes.
- (TkMacOSXProcessAppleEvent): Don't declare events
- handled that we didn't even look at.
- (TkMacOSXProcessEvent): Add a comment on policy for
- "stopProcessing".
- (TkMacOSXProcessEvent): Remove "handling" of events that
- are not our business.
- (TkMacOSXProcessEvent): Rename "handledByTk" into
- "stopProcessing".
- (ReceiveAndProcessEvent): Ditto.
- (ReceiveAndProcessEvent): Tune error production of
- message.
-
- * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent):
- Rename "handledByTk" into "stopProcessing".
-
- * macosx/tkMacOSXWindowEvent.c: Ditto.
-
- * macosx/tkMacOSXMouseEvent.c: Remove setting of
- "handledByTk".
- (TkMacOSXProcessMouseEvent): Handle clicks in the "traffic
- lights" in the window title when the window (or app) is
- in the background.
-
-
- This patch changes the key event handling to use the MacOS
- translation mechanisms. It also improves dead key handling.
-
- * macosx/tkMacOSXKeyEvent.c (InitKeyData): Add.
- (InitKeyEvent): Add.
- (DecodeViaUnicodeResource): Rename
- KeycodeToUnicodeViaUnicodeResource.
- (DecodeViaKCHRResource): Rename KeycodeToUnicodeViaKCHRResource.
- (GetKeyboardLayout): Use a boolean flag instead of a special
- layout id.
-
- (KeycodeToUnicodeViaUnicodeResource): Change interface and
- implementation to return a Unicode string instead of directly
- filling an XEvent.
- (KeycodeToUnicodeViaKCHRResource): Ditto.
- (KeycodeToUnicodeViaUnicodeResource): Add handling for callers
- that don't want deadkey processing (i.e. XKeycodeToKeysym).
- (KeycodeToUnicodeViaKCHRResource): Ditto.
- (KeycodeToUnicodeViaUnicodeResource): Clear deadKeyState if a
- character was produced.
- (KeycodeToUnicodeViaKCHRResource): Use CFString and current
- keyboard encoding instead of Tcl Tcl_ExternalToUtf() and fixed
- TkMacOSXCarbonEncoding.
- (TkMacOSXKeycodeToUnicode): Add.
-
- (TkMacOSXProcessKeyboardEvent): Add some heuristics to improve
- keyup events.
- (deadKeyState): Split into deadKeyStateUp and deadKeyStateDown.
- (GenerateKeyEvent): Change interface and implementation to accept
- a Unicode string instead of individual characters.
- (GenerateKeyEvent): Don't generate string representations for
- special characters.
-
- * macosx/tkMacOSXEvent.h (TkMacOSXKeycodeToUnicode): Add
- prototype.
-
- * macosx/tkMacOSXKeyboard.c (KCHRPtr): Remove.
- (XKeycodeToKeysym): Use TkMacOSXKeycodeToUnicode instead of
- KeyTranslate.
- (XKeycodeToKeysym): Support latin-1 keysyms.
-
- This patch reverts the hack to put icons in menus that Vince put
- in yesterday (but preserves the bug fix in that submission.)
-
- * macosx/tkMacOSXMenu.c (SetMenuTitle): revert treating
- "<bullet> number" as a request to put icon number <number> in
- the menu.
-
-2003-02-18 Mo DeJong <mdejong@users.sourceforge.net>
-
- * doc/entry.n:
- * doc/text.n: Update double and triple click
- docs to match implementation changes made on
- 2002-02-14.
-
-2003-02-19 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Makefile: reworked embedded build to no longer require
- relinking but to use install_name_tool instead to change the
- install_names for embedded frameworks. [Bug #644510]
-
-2003-02-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/widget: New part for the widget demo showing
- * library/demos/unicodeout.tcl: Tk's UNICODE output. [Patch #627453]
-
-2003-02-18 Andreas Kupries <andreask@activestate.com>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl (HP xnet [Bug #651811]).
-
-2003-02-18 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
-2003-02-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkText.c (TextWidgetCmd): remove unused lastEnd var.
- [Bug #664790]
-
- * generic/tkCanvPs.c (TkPostscriptImage): remove unused depth var.
- [Bug #664787]
-
- * generic/tkEntry.c (EntrySetValue): removed unused code var.
- [Bug #664781]
-
- * library/tk.tcl (::tk::TabToWindow): auto-highlight spinboxes as
- well as entries when tabbing in. [Patch #683813] (bron)
-
- * library/xmfbox.tcl (::tk::MotifFDialog_ActivateSEnt): correct
- sub on embedded newlines. [Patch #688572] (bonfield)
-
- * doc/colors.n: corrected B values [Bug #682714].
-
- * win/tkWinInit.c (TkpDisplayWarning): truncate MessageBox string
- to 1024 chars to prevent possible oversized window errors. May be
- necessary in other MB uses (ie Tcl_AppInit). [Tcl Bug #608559]
-
-2003-02-18 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * macosx/tkMacOSXMenu.c: (SetMenuTitle) fix to utf encoding
- problem when setting menu titles, and provisional support
- for icons. [Tcl Bug #625080]
-
-2003-02-18 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkImgGIF.c (FileReadGIF): Ensure that the trashBuffer is
- always deallocated on function exit to stop a potential memory leak.
-
-2003-02-17 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkEvent.c (Tk_HandleEvent): Fixup button
- press state saving code, it was incorrectly converting
- normal motion events into button press and motion
- events in some cases.
- * generic/tkInt.h: Add mouseButtonWindow member
- to the TkDisplay structure.
- * tests/event.test: Add test case for faulty
- button motion logic.
-
-2003-02-14 Jeff Hobbs <jeffh@ActiveState.com>
-
- * README: Bumped to 8.4.2.
- * generic/tk.h:
- * macosx/Wish.pbproj/project.pbxproj:
- * unix/configure:
- * unix/configure.in:
- * unix/tcl.m4:
- * unix/tk.spec:
- * win/configure:
- * win/configure.in:
-
- * unix/tcl.m4: correct HP-UX ia64 --enable-64bit build flags
-
-2003-02-13 Kevin Kenny <kennykb@users.sourceforge.net>
- * doc/wish.n: Added language to describe the handling of
- the end-of-file character \u001a in script files. [Bug 685505]
-
-2003-02-10 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXCursor.c (TkMacOSXInstallCursor): Set all theme
- cursors using SetThemeCursor or SetAnimatedThemeCursors.
- (TkGetCursorByName): Use the theme cursors for arrow, ibeam, etc.
- Allow animatedCursor{NUM} form for an animated cursor with count.
- (TkpSetCursor): Don't reset the cursor if there is no change.
- * macosx/tkMacOSXMouseEvent.c (GeneratePollingEvents): Don't
- directly call TkMacOSXInstallCursor, it gets called by the call
- to Tk_UpdatePointer immediately above.
-
-2003-02-05 Fred Fish <fnf@intrinsity.com>
-
- * macosx/tkMacOSXWm.c (Tk_SetGrid): Fix precedence problem with
- * mac/tkMacWm.c (Tk_SetGrid): '==' and '|'.
-
-2003-02-08 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkCanvArc.c (CreateArc): Rework canvas create item
- * generic/tkCanvBmap.c (CreateBitmap): type coords handling to be
- * generic/tkCanvImg.c (CreateImage): consistent across types
- * generic/tkCanvPoly.c (CreatePolygon): and not pass empty coords
- * generic/tkCanvLine.c (CreateLine): to item creation procs.
- * generic/tkCanvText.c (CreateText):
- * generic/tkCanvWind.c (CreateWinItem):
- * generic/tkCanvas.c (CanvasWidgetCmd CANV_CREATE):
- * generic/tkRectOval.c (CreateRectOval):
- * tests/canvRect.test:
- * tests/canvText.test:
- * tests/canvas.test:
-
-2003-01-28 Joe English <jenglish@users.sourceforge.net>
-
- * generic/tkInt.h (TkDisplay,TkMainInfo):
- * generic/tkObj.c (windowObjType):
- * generic/tkWindow.c (Tk_DestroyWindow):
- * tests/wm.test (wm-deletion-epoch-1.1):
- Moved 'deletionEpoch' field from TkDisplay to TkMainInfo.
- Reworked windowObj type. Fixes Tk Bug #671330 "segfault when e.g.
- deiconifying destroyed window"
-
-2003-01-23 D. Richard Hipp <drh@hwaci.com>
-
- * library/entry.tcl: Fix the KeyPress binding on the entry widget
- so that it enters text from left to right (not right to left) even
- if the mouse button is being held down. [Bug #673687]
-
-2003-01-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkFrame.c (TkToplevelWindowForCommand): Added way of
- mapping from command names to tkwins-for-toplevels.
- * generic/tkImage.c (Tk_ImageObjCmd): Added check to make sure
- that you're not creating an image named the same as .'s command,
- which refixes 220891, even when the name of the command has been
- changed with 'rename'. The error message is better too.
- * tests/image.test (image-1.10,image-1.11): Updated to match new
- error message and added test for the rename case.
-
-2003-01-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkImage.c (DeleteImage): delete the image's entry in the
- image table correctly when there are no more instances. This
- reopens bug 220891. [Bug #669759]
-
-2003-01-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/loadTk.n: note that ::safe::loadTk has a prereq on
- ::safe::interpCreate or ::safe::interpInit. [Bug #669159]
-
- * doc/photo.n: $image put only accepts -format and -to, and note
- extended use of -to.
-
-2003-01-17 D. Richard Hipp <drh@hwaci.com>
- * generic/tkCanvUtil.c: The clipping algorithm introduced on 2003-01-08
- was unnecessarily aggressive in reducing the size of the clipping box.
- This did not cause a problem for normal display, but did create
- trouble for some extensions that attempt to render a canvas on a
- GDI printer under Windows. The patch here relaxes the constraints on
- the clipping box somewhat. [Bug #663981]
-
-2003-01-14 Joe English <jenglish@users.sourceforge.net>
- * generic/tkSelect.c (Tk_CreateSelHandler):
- Fix for #666346 "Selection handling crashes under KDE 3.0"
- * tests/unixSelect.test (unixSelect-1.20): Added test case.
-
-2003-01-13 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinDialog.c (Tk_ChooseDirectoryObjCmd,
- ChooseDirectoryValidateProc, Tk_MessageBoxObjCmd):
- Remove unused tsdPtr variable. Use TEXT macro
- instead of _T macro since _T does not work
- under Cygwin. Declare flags as UINT to avoid
- compiler warning when compiling with mingw.
-
-2003-01-12 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/Makefile.in: Add TCL_DEFS to AC_FLAGS
- so that compiler flags defined by Tcl get
- passed to the compiler. Add empty rule
- for cat.c so that Tk compiles under msys.
- * win/configure: Regen.
- * win/tcl.m4: Update from Tcl, this pulls
- in a subst of TCL_DEFS, it also defines
- USE_THREAD_ALLOC when threads are used
- and it updates the SC_ENABLE_SYMBOLS
- and SC_PROG_TCLSH macros to match the
- ones used in Tcl.
-
-2003-01-10 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixEvent.c (OpenIM): Remove unused variable
- (Fixes: #664780 "SGI warning: OpenIM")
-
-2003-01-08 D. Richard Hipp <drh@hwaci.com>
-
- * generic/tkCanvLine.c:
- * generic/tkCanvas.h:
- * generic/tkCanvUtil.c: Clip long lines so that they will display
- properly even on windowing systems where coordinates are expressed
- as 16-bit numbers. [Bug #663981]
-
-2003-01-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkFrame.c (CreateFrame): throw a Tcl error instead of a
- panic when we cannot get a main window and appname is NULL. This
- can indicate that a user tried to create a frame/toplevel while Tk
- was dying. [Bug #661792]
-
-2002-12-27 David Gravereaux <davygrvy@pobox.com>
-
- * generic/tkText.h: ANSI unfriendly typedef for TkTextBTree
- repaired for C++ compilers.
-
-2002-12-27 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixWm.c (WaitForEvent): process Map and Unmap events
- as well as Configure events during WaitFor{Configure|Map}Notify.
- Fixes [Bug 578569] (WaitForMapNotify could process Map and Unmap
- events out of order, making Tk think a window was unmapped when
- it really wasn't).
-
-2002-12-18 Todd M. Helfter <tmh@purdue.edu>
-
- * doc/label.n: Fixed documentation of the -compound option to
- the label widget. The option was simply missing from the
- man page [Bug 577540]
-
-2002-12-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/photo.n: Fixed documentation of the put subcommand to no
- longer talk about files and to mention that you can use colour
- names for working with solid colours. [Bug 640026]
-
-2002-12-13 Don Porter <dgp@users.sf.net>
-
- * generic/tkMain.c (Tk_Main): Call on Tcl*StartupScript*() routines
- to store the startup script, if any. [Bug 616245].
-
-2002-12-10 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.vc: tclThreadTest.obj not required to link
- tktest.exe [Bug 651396]
-
-2002-12-08 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkEntry.c (ConfigureEntry): keep a flag to indicate when
- a var is traced to prevent double-traces caused by configuring the
- widget in traces with validation on. (dejong)
-
-2002-12-07 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkInt.decls: add TkWinSetHINSTANCE decl
- * generic/tkIntPlatDecls.h: regen
- * generic/tkStubInit.c: regen
- * win/tkWinInit.c (TkpInit): While init and cleanup aren't correct
- * win/tkWinX.c (TkWinXInit): in DllMain, we had to specify the
- * win/tkWin32Dll.c (DllMain): true HINSTANCE or the resources of a
- dynamic Tk weren't being loaded correctly. Created a new function
- TkWinSetHINSTANCE for this purpose.
-
-2002-12-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinX.c (TkWinXInit): Move cleanup into an exit handler
- * win/tkWin32Dll.c (DllMain): to ensure that it will be called
- * win/tkWinWm.c (TkWinWmCleanup): without having to unload the dll.
- Also reset the static int initialized on cleanup to allow reinit.
-
-2002-12-01 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/event.test (_keypress, _text_ind_to_x_y): Force focus to
- widget in _keypress method to avoid problems with window managers
- that use focus follows mouse. [Bug 526209]
-
-2002-12-01 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/wm.test: Add wm-transient-6.3 to check that a transient
- remains withdrawn when it is first withdrawn and then turned into
- a transient.
- * unix/tkUnixWm.c:
- * win/tkWinWm.c: Replace WM_TRANSIENT_WITHDRAWN with WM_WITHDRAWN
- and set this flag whenever a window is explicitly withdrawn. This
- fixes the test case added above. [Bug 644356]
-
-2002-11-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/textDisp.test:
- * generic/tkTextDisp.c (TkTextSeeCmd): handle see for unmapped
- text displays. [Bug #641778]
-
-2002-11-19 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXScrlbr.c (TkpDisplayScrollbar): If the
- scrollbar width is set to 12 or less (but 12 is what you
- should use) use the small metric scrollbar.
-
- (UpdateControlValues): Fix thinko in setting off AUTO_ADJUST for
- the place geometry manager.
-
-2002-11-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in: add macosx/*.tcl (buildTkConfig.tcl in
- particular) to the dist target.
-
-2002-11-14 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkWindow.c (Tk_DestroyWindow, DeleteWindowsExitProc):
- Add TkHalfdeadWindow type and halfdeadWindowList to keep track of
- windows that were only partially deallocated before a call to
- exit. Finish cleaning up these windows in DeleteWindowsExitProc.
- Keep track of cleanup status in Tk_DestroyWindow so that a window
- with a Destroy binding which calls exit will get fully destroyed.
- * tests/window.test: Add Tk_DestroyWindow tests for an assortment
- of half dead window cases. [Bug 630533]
-
-2002-11-10 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: fixed erroneous
- removal of libtkstub before Wish was built.
-
-2002-11-07 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/unixWm.test: Add short delay to test unixWm-51.7
- to account for raise/lower changes in TIP 107. This allows
- the test case to pass under Window Maker on Linux.
-
-2002-11-07 Peter Spjuth <peter.spjuth@space.se>
-
- * tests/place.test:
- * generic/tkPlace.c: place info did not return all settings,
- and didn't make sure the result was a proper list.
- Put '-in' first in result to be more consistent with how
- grid/pack info behaves. [Bug #635025][Bug #532022]
-
-2002-11-07 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/Makefile.in: added macosx/README to dist target.
- * macosx/Wish.pbproj/project.pbxproj: fix to 'wish' script
- to allow it to work when not installed into '/'.
-
-2002-11-06 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
- * win/configure: Regen.
- * win/configure.in: Check that AR, RANLIB, and RC
- are found on the path when building with gcc.
-
-2002-11-04 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: added Wish linker flag
- -headerpad_max_install_names to allow use of 'install_name_tool'.
- fixed tkConfig.sh generation and redo_prebinding in the case where
- Tk is not installed alongside Tcl.
-
-2002-11-03 David Gravereaux <davygrvy@pobox.com>
-
- * win/winMain.c (Tcl_AppInit): Calls Registry_Init() and
- Dde_Init() when STATIC_BUILD and TCL_USE_STATIC_PACKAGES macros
- are set.
-
- * win/makefile.vc: linkexten option now sets the
- TCL_USE_STATIC_PACKAGES macro which also adds the registry and
- dde static lib files to the link of the shell. [Patch 479697]
-
- * win/rules.vc: Matches the one from Tcl.
-
- * win/buildall.vc.bat: More useful commentary.
-
-2002-11-01 Andreas Kupries <andreask@activestate.com>
-
- * win/makefile.vc (TCLREGLIBNAME): Updated to registry 1.1.
-
-2002-10-29 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/README: added info on new package searching in
- Frameworks directories.
-
-2002-10-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4.1 TAGGED FOR RELEASE ***
-
- * changes: updated for 8.4.1 release
-
-2002-10-21 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/README: revised according to Jim's suggestions
- * macosx/tkMacOSXAppInit.c: use standard PATH_MAX from <limits.h>
-
-2002-10-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/winMain.c (WinMain, main): remove obsolete SetMessageQueue call
-
- * win/configure: Regen.
- * win/tcl.m4 (SC_CONFIG_CFLAGS): Check for bug in Cygwin version
- of windres and work around that case by passing a POSIX path
- instead of a Windows native path. One can't always pass a POSIX
- path because the mingw native toolchain accepts only Windows
- native paths. (dejong)
-
- * win/tkWinPort.h: define OPEN_MAX only if not defined.
- [Patch #625472] (howell)
-
-2002-10-18 Daniel Steffen <das@users.sourceforge.net>
-
- * mac/tkMacAppInit.c: removed tcltest dependency.
- [Bug #592639] (porter)
-
-2002-10-17 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/imgPhoto.test:
- * generic/tkImgPhoto.c (ImgPhotoConfigureMaster): fix arg handling
- for missing -format or -data options. [Bug #624974]
-
- * tests/text.test: properly return the number of
- * unix/tkUnixFont.c (ControlUtfProc): bytes consumed. [Bug #624732]
-
-2002-10-17 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/README: info specific to building and running
- TclTk on Mac OS X, answers to tcl-mac list FAQs.
- * macosx/Makefile: permission fix after embedded install.
- * macosx/Wish.pbproj/project.pbxproj: after install, fix
- permissions of uninstalled products.
-
-2002-10-17 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: added TEXT document
- type to plist so that files can be dragged onto Wish Shell.
-
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXFont.c: added private proc
- TkMacOSXUseAntialiasedText() to enable/disable quickdraw
- text antialiasing where available, default is enabled.
- Added a linked boolean ::tk::mac::antialiasedtext with
- write trace to allow control of antialiasing from tcl.
-
-2002-10-16 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * macosx/tkMacOSXMenu.c: fix to accelerators shown in menus
- with non-alphanumeric keys.
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXKeyboard.c: applied first patch from [Patch
- #622582] to fix some of [Bug #616988]. Further work is needed
- in this area, but this will let foreign keyboards at least work
- reasonably with Tk.
-
-2002-10-15 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure:
- * unix/tcl.m4: add AIX-5 ppc build support. Remove unused
- SC_ENABLE_MEMDEBUG.
-
- * win/configure:
- * win/tcl.m4: Add --enable-shared=mem support.
-
-2002-10-10 Peter Spjuth <peter.spjuth@space.se>
-
- * tests/grid.test:
- * generic/tkGrid.c: The grid size was not updated properly
- when removing a widget from a grid. [Bug #621241] (forssen)
-
-2002-10-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/canvPs.test: tests for canvas embedded window ps generation
- * generic/tkCanvWind.c (CanvasPsWindow): removed dead code loop.
- * generic/tkCanvas.h: moved TkColormapData struct to tkCanvPs.c
- * generic/tkCanvPs.c (TkImageGetColor): corrected bogus use of
- TkColormapData on Windows (Windows now requires RGB pixel data
- from image).
- * win/tkWinImage.c (XGetImage, XGetImageZPixmap): added support
- for generating ps for embedded widgets on canvases on Windows,
- tested for 8, 16, 24 and 32-bit depths (XGetImageZPixmap not used).
-
- * library/tk.tcl: simplified the adding of extra <ISO_Left_Tab>
- and <hpBackTab> events to <<PrevWindow>>.
-
-2002-10-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/README: doc'ed --enable-symbols options.
- * unix/Makefile.in: comment docs
- * unix/configure: regen
- * unix/tcl.m4: replaced SC_ENABLE_MEMDEBUG with a more intelligent
- SC_ENABLE_SYMBOLS that takes yes|no|mem|all as options now.
-
-2002-10-09 Don Porter <dgp@users.sf.net>
-
- * generic/tk.h: Added reminder comment to edit
- macosx/Wish.pbproj/project.pbxproj when version number changes.
-
-2002-10-09 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Makefile: don't remove tclsh after building embedded.
-
- * macosx/Wish.pbproj/project.pbxproj: bumped version to 8.4.1;
- added missing library/mkpsenc.tcl to framework.
-
-2002-10-09 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkInt.decls(tkIntXlib): added XQueryTree declaration for
- mac & aqua, since it's now called from ParentXId via Tk_HandleEvent.
- * generic/tkIntXlibDecls.h:
- * generic/tkStubInit.c: regen.
- * mac/tkMacXStubs.c: added XQueryTree stub
-
- * mac/tkMacEmbed.c (TkpUseWindow): check that container window
- has -container option set (sync with other platforms).
-
- * mac/tkMacBitmap.c:
- * mac/tkMacFont.c:
- * mac/tkMacSend.c:
- * mac/tkMacTest.c:
- * mac/tkMacWm.c: CONSTification.
-
- * mac/tkMacProjects.sea.hqx: added tkStyle.c and tkUndo.c to
- tk library projects.
-
-2002-10-09 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkImgPhoto.c (ImgPhotoSetSize): Only error-out if we
- fail to allocate a non-empty buffer; getting a NULL when we
- allocate an empty buffer is no problem since nothing will look at
- the value anyway. [Bug 619544]
- Also tidied up file to take into account the fact that we're using
- 32 bits per pixel in the master to accommodate the alpha channel
- as well as RGB.
-
-2002-10-08 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/winButton.test: add option clear to top to prevent option
- leakage from other tests causing problems. [Bug #582382]
-
- * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd): leave the
- DestroyPanedWindow proc to free the pwPtr, add a Preserve
- reference to the pwPtr->tkwin.
- (DestroyPanedWindow): Release the pwPtr->tkwin.
-
- * generic/tkFocus.c (TkFocusFilterEvent): Ignore event if we are
- focusing into a dead window. [Bug #588831] (griffin)
-
-2002-10-02 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXScrlbr.c (TkpDisplayScrollbar): Put the Tk scrollbar
- pointer into the control reference data for the Mac scrollbar, so we
- can get it out again in the ScrollbarActionProc.
-
-2002-10-02 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkText.c (TextBlinkProc): don't blink the cursor unless
- it is visible. [Bug #616791] [Patch #614474] (bonfield)
-
- * tests/entry.test: added entry-20.7
- * generic/tkEntry.c (EntryTextVarProc): check if the entry is
- being deleted before handling an associated textvariable.
- [Bug #607390 #617446]
-
-2002-10-01 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/unixSelect.test (unixSelect-1.1[89]): Altered these tests
- to work around [Bug #616923]
- * unix/tkUnixSelect.c (SelRcvIncrProc,TkSelPropProc): It turns out
- a much simpler and more robust solution is possible if we leverage
- Tcl's encoding engine by using the same code path as for the
- normal string selection. It might be a bit slower, but it should
- be a lot more correct. [Bug #614650]
-
-2002-09-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/panedwindow.test: added panedwindow-28.[12]
- * generic/tkPanedWindow.c (PanedWindowCmdDeletedProc):
- (Tk_PanedWindowObjCmd): when destroying the panedwindow, destroy
- the proxy before the parent to avoid dependency conflicts.
- [Bug #616589]
-
-2002-09-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/unixSelect.test: Test for various things that can fail to
- work in 8.4.0...
- * unix/tkUnixSelect.c (TkSelPropProc,SelRcvIncrProc): Incremental
- transfers of UTF8_STRING selections should now work; Tk will now
- tag them with the right size and only transfer complete UTF8
- characters. Previously, things only worked when the transfer
- could only happen in one go, and even then not always. [Bug 614650]
-
- * doc/bind.n: Doc-fix to mention that %A substitutes UNICODE
- characters rather than ASCII ones. Tk's done this ever since 8.1
- in any case; after all, it is the right thing to do.
-
-2002-09-27 Don Porter <dgp@users.sf.net>
-
- * README: Bumped to version 8.4.1 to avoid confusion
- * generic/tk.h: of CVS snapshots with release 8.4.0.
- * unix/README:
- * unix/configure.in:
- * unix/tk.spec
- * win/configure.in:
-
- * unix/configure: autoconf
- * win/configure:
-
-2002-09-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure: regen.
- * unix/tcl.m4: improve AIX-4/5 64bit compilation support.
-
- * unix/Makefile.in: add macosx subdir to dist target.
- Do not generate .Z, only .gz and .zip in alldist target.
-
-2002-09-18 Mumit Khan <khan@nanotech.wisc.edu>
-
- Added basic Cygwin support.
-
- * win/tcl.m4 (SC_PATH_TCLCONFIG): Support one-tree build.
- (SC_PATH_TKCONFIG): Likewise.
- (SC_PROG_TCLSH): Likewise.
- (SC_CONFIG_CFLAGS): Assume real Cygwin port and remove -mno-cygwin
- flags. Add -mwin32 to extra_cflags and extra_ldflags.
- Remove ``-e _WinMain@16'' from LDFLAGS_WINDOW.
- * win/configure: Regenerate.
-
- * win/tkWinPort.h (tchar.h): Do not include on Cygwin.
- (_T): Define for Cygwin.
- * win/winMain.c (main): Conditionally define.
-
-2002-09-26 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Makefile: preserve environment value of INSTALL_ROOT.
- When embedding only use deployment build. Force relink before
- embedded build to ensure new linker flags are picked up.
-
- * macosx/buildTkConfig.tcl (new):
- * macosx/Wish.pbproj/project.pbxproj: synthesize tkConfig.sh
- based on tclConfig.sh in Tcl.framework and tkConfig.sh.in.
- Add symbolic links to debug lib, stub libs and tkConfig.sh
- in framework toplevel. Made tkIntXlibDecls.h a public header
- since Headers/X11/Xlib.h includes it. Install wish8.4 script
- that runs "Wish Shell.app" and corresponding wish link.
- Use tcl headers from built Tcl.framework instead of from tcl
- source directory.
-
- * macosx/tkMacOSXPort.h: added missing standard unix includes
- and defines, similarly to tkUnixPort.h.
- * macosx/tkMacOSXNotify.c: removed dependency on internal tcl
- header "tclPort.h"
-
- * unix/Makefile.in:
- * unix/install-sh: copied support for 'install-strip' target
- over from tcl/unix/{Makefile.in,install-sh}
-
-2002-09-22 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXScrlbr.c (UpdateControlValue): HiliteControl
- doesn't give the proper "nothing to scroll" look on Mac OS X.
- You have to set the min value greater than the max value to
- get this.
-
-2002-09-15 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
- * unix/tkUnixEvent.c (TkpCloseDisplay): Use PEEK_XCLOSEIM
- to examine the input context queue before invoking
- XCloseIM. Generate an assert if there is an input
- context that has not been freed.
- [Patch 570902]
-
-2002-09-13 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-
- * generic/tk.h: Moved RC_INVOKED down so that tcl.h is still
- included when running the resource compiler. <tcl.h> excludes
- the unnecessary parts on its own. This reenables the Windows
- build. It failed because the non-inclusion of tcl.h caused the
- resource compiler to miss some vital macro definitions
- (TCL_FINAL_RELEASE, STRINGIFY, ...).
-
-2002-09-12 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tk.h:
- * mac/tkMacApplication.r:
- * mac/tkMacLibrary.r:
- * mac/tkMacResource.r:
- * macosx/tkAboutDlg.r:
- * macosx/tkMacOSXApplication.r:
- * macosx/tkMacOSXLibrary.r:
- * macosx/tkMacOSXResource.r: unified use of the two equivalent
- resource compiler header inclusion defines RC_INVOKED and
- RESOURCE_INCLUDED, now use RC_INVOKED throughout.
-
- * macosx/tkMacOSXAppInit.c: improved detection of Wish startup
- by the finder (by checking if stdin is /dev/null), in which
- case we want to bring up the Tk console window.
-
- * macosx/tkMacOSXHLEvents.c: added 'rapp' apple event handler.
-
-2002-09-12 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: reference & install
- tk/generic/prolog.ps instead of tk/library/prolog.ps.
-
-2002-09-10 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: added backwards
- compatibility for OSX 10.1 ProjectBuilder 2.0.
-
-2002-09-10 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/Makefile.in: added DYLIB_INSTALL_DIR variable for Darwin
- and set it to default value ${LIB_RUNTIME_DIR}
- * unix/tcl.m4 (Darwin): use DYLIB_INSTALL_DIR instead of
- LIB_RUNTIME_DIR in the -install_name argument to ld.
- * unix/configure: regen.
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Makefile: added support for building Tcl as an embedded
- framework, i.e. using an dyld install_name containing
- @executable_path/../Frameworks via the new DYLIB_INSTALL_DIR
- unix/Makefile variable.
-
-2002-09-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4.0 TAGGED FOR RELEASE ***
-
-2002-09-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXNotify.c (Tk_MacOSXSetupTkNotifier): corrected
- Mac Jaguar event loop issue.
-
- * library/tk.tcl: use command instead of control on Aqua bindings.
- Force dialogs to appear below fixed native Mac menubar.
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXKeyboard.c: Keypress/release events for pure
- modifier keys were not being passed to Tk.
- Deadkey presses were inserting null characters into text windows.
- Now they do nothing. (Still not ideal, but better than before!)
- * macosx/tkMacOSXMenu.c: Allow more than 200 menus to exist -
- increased to 2000.
- * macosx/tkMacOSXMouseEvent.c: Bad interactions between floating
- windows and ordinary ones. Ensure that local<->global coordinate
- transformations are wrt to the correct window.
- * macosx/tkMacOSXWm.c: Better error msg for 'wm attributes'.
- Remove crash in 'wm transient'.
- Add 'noActivates' and 'noUpdates' flags to unsupported command.
- [Patch #606658] (darley)
-
- * library/xmfbox.tcl (::tk::MotifFDialog_ActivateSEnt): corrected
- msgcat code with XPG specifier. [Patch #606719] (miller)
-
-2002-09-06 Don Porter <dgp@users.sf.net>
-
- * tests/unixWm.test (unixWm-50.3): Constrained test that hangs
- on Windows.
-
-2002-09-05 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: added overlooked missing
- TK_PATCH_LEVEL version bump to 8.4.0.
-
-2002-09-04 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-
- * win/Makefile.in (install-libraries): Added code section to
- install the message catalogs. Copied same section from
- unix/Makefile.in and adapted it to the slightly different
- environment.
-
-2002-09-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/button.tcl: further restrict buttons to not resetting
- the "original" relief if it has changed in the interim. This
- prevents code that simulated overrelief buttons from not working
- in 8.4. [Bug #604270]
-
-2002-09-03 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.pbproj/project.pbxproj: Bumped version number to
- 8.4.0 and updated copyright info.
-
-2002-09-03 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c: fix to 'wm attributes' error-handling bug.
-
-2002-09-03 Don Porter <dgp@users.sf.net>
-
- * changes: Updated for 8.4.0 release
-
-2002-09-02 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/cursor.test: reverted 2002-08-31 change for OS X to use
- 'heart' cursor because 'arrow' on windows has a pre-skewed use
- count. [Bug #602667]
-
- * tests/button.test: added button-14.1
- * win/tkWinButton.c (TkpComputeButtonGeometry): correct Win button
- sizing to be equal for one-line buttons with -height of 0 or 1, as
- well as -height 0 buttons with empty text and no image, which
- should be the same as single-line text buttons. [Bug #565485]
-
- * library/button.tcl (::tk::ButtonLeave): correctly restore state
- of button to normal for unix bindings. [Bug #597920]
-
- * doc/tk.n: added tk windowingsystem docs.
-
- * tests/wm.test:
- * unix/tkUnixWm.c: remove possible 2-second delay in 'raise'.
- [Patch #601518] (english) TIP #107
-
- * unix/tcl.m4: add support for 64-bit builds on HP-11 with gcc.
- * unix/configure.in: make sure to substitute LD_LIBRARY_PATH_VAR.
- * unix/configure: regend
-
- * README: Bumped version number to 8.4.0
- * generic/tk.h:
- * unix/configure:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure:
- * win/configure.in:
-
- * generic/tkCmds.c:
- * generic/tkWindow.c: made 'tk' available in safe interpreters,
- but only the caret and windowingsystem subcommands may be called.
- * tests/safe.test (safe-1.2): noted that tk is now available in
- safe interps, but not the appname/scaling subcommands.
-
- * tests/tk.test (tk-1.2): noted new tk windowingsystem subcommand
-
-2002-08-31 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/tcl.m4: update from Tcl
-
- * unix/Makefile.in: import of TK_SHLIB_LD_EXTRAS for Tk library
- specific linker settings. Added use of new LD_LIBRARY_PATH_VAR.
-
- * unix/configure: regen
-
-2002-08-31 Daniel Steffen <das@users.sourceforge.net>
-
- *** macosx-8-4-branch merged into the mainline [tcl patch #602770] ***
-
- * generic/tk.decls:
- * generic/tkInt.decls: added new "aqua" specific entries to the
- stubs tables. Changed all "unix" entries to "x11" to allow us to
- distinguish and build both "aqua" on MacOSX and "x11" on MacOSX.
-
- * generic/tk.h: added a #ifnded RESOURCE_INCLUDED so that tk.h can
- be passed to the resource compiler.
-
- * generic/tkCmds.c (Tk_TkObjCmd): added [tk windowingsystem]
- subcommand: returns "x11" when running on X11, "win32" on Windows,
- "classic" on MacOS9 and "aqua" on MacOSX Aqua (i.e. Carbon)
-
- * generic/tkFont.c (TkFontGetFirstTextLayout): new private function
- returning the first chunk of a Tk_TextLayout, i.e. until the first
- font change on the first line (or the whole first line if there is
- no such font change).
-
- * generic/tkMain.c: made Tcl_ThreadDataKey static
-
- * library/demos/puzzle.tcl: fixed button metrics for aqua
-
- * tests/cursor.test: check for presence of arrow cursor instead of
- heart cursor
-
- * xlib/xcolors.c: changed xColors static initialization to more
- standard C
-
- * macosx/Wish.pbproj/jingham.pbxuser (new):
- * macosx/Wish.pbproj/project.pbxproj (new): project for Apple's
- ProjectBuilder IDE.
-
- * macosx/Makefile (new): simple makefile for building the project
- from the command line via the ProjectBuilder tool 'pbxbuild'.
-
- * macosx/tkMacOSXAppInit.c (new): macosx specific AppInit looking
- for a AppMain.tcl file in its bundled Resources/Scripts folder. If
- present, argv[1] is set to that file and the Scripts folder is
- added to the auto_path. This allows tk apps to embed scripts within
- their bundle directory structure.
-
- * macosx/tkMacOSXInit.c (new): macosx adapted version of
- tkUnixInit.c: we initialize & cache the Carbon native encoding
- (e.g. 'macRoman') and try to find the tk script library files
- inside Tk packaged as a framework.
-
- * macosx/tkMacOSXNotify.c (new): new macosx specific merged
- Carbon/select-based notifier.
-
- * macosx/tkMacOSXEvent.c (new):
- * macosx/tkMacOSXEvent.h (new):
- * macosx/tkMacOSXKeyEvent.c (new):
- * macosx/tkMacOSXMouseEvent.c (new):
- * macosx/tkMacOSXWindowEvent.c (new): new macosx specific event
- handling functionality.
-
- * macosx/tkMacOSX.h (new):
- * macosx/tkMacOSXBitmap.c (new):
- * macosx/tkMacOSXButton.c (new):
- * macosx/tkMacOSXClipboard.c (new):
- * macosx/tkMacOSXColor.c (new):
- * macosx/tkMacOSXConfig.c (new):
- * macosx/tkMacOSXCursor.c (new):
- * macosx/tkMacOSXDefault.h (new):
- * macosx/tkMacOSXDialog.c (new):
- * macosx/tkMacOSXDraw.c (new):
- * macosx/tkMacOSXEmbed.c (new):
- * macosx/tkMacOSXFont.c (new):
- * macosx/tkMacOSXHLEvents.c (new):
- * macosx/tkMacOSXInt.h (new):
- * macosx/tkMacOSXKeyboard.c (new):
- * macosx/tkMacOSXMenu.c (new):
- * macosx/tkMacOSXMenubutton.c (new):
- * macosx/tkMacOSXMenus.c (new):
- * macosx/tkMacOSXPort.h (new):
- * macosx/tkMacOSXRegion.c (new):
- * macosx/tkMacOSXScale.c (new):
- * macosx/tkMacOSXScrlbr.c (new):
- * macosx/tkMacOSXSubwindows.c (new):
- * macosx/tkMacOSXTest.c (new):
- * macosx/tkMacOSXUtil.c (new):
- * macosx/tkMacOSXUtil.h (new):
- * macosx/tkMacOSXWm.c (new):
- * macosx/tkMacOSXWm.h (new):
- * macosx/tkMacOSXXStubs.c (new): macosx ports of classic mac Tk
- implementation in tk/mac.
-
- * macosx/tkMacOSXSend.c (new): only send to local interp
- implemented currently.
-
- * macosx/tkMacOSXDebug.h (new):
- * macosx/tkMacOSXDebug.c (new): new macosx specific functions for
- debugging MacOS events, regions, etc.
-
- * macosx/tkAboutDlg.r (new):
- * macosx/tkMacOSXApplication.r (new):
- * macosx/tkMacOSXCursors.r (new):
- * macosx/tkMacOSXLibrary.r (new):
- * macosx/tkMacOSXMenu.r (new):
- * macosx/tkMacOSXResource.r (new):
- * macosx/tkMacOSXXCursors.r (new):
- * macosx/tclets.r (new): sources for Rez resource compiler.
-
- * macosx/Wish.icns (new): Wish application icon.
-
- * generic/tk.h:
- * generic/default.h:
- * generic/tkBind.c:
- * generic/tkCmds.c:
- * generic/tkGrab.c:
- * generic/tkPointer.c:
- * generic/tkPort.h:
- * generic/tkSelect.c:
- * generic/tkStubLib.c:
- * generic/tkTest.c:
- * generic/tkText.c:
- * generic/tkWindow.c:
- * unix/tkUnix3d.c:
- * xlib/xgc.c:
- * xlib/X11/X.h:
- * xlib/X11/Xlib.h:
- * xlib/X11/Xutil.h: added #includes and #ifdefs for macosx
-
- * library/bgerror.tcl:
- * library/button.tcl:
- * library/console.tcl:
- * library/dialog.tcl:
- * library/entry.tcl:
- * library/listbox.tcl:
- * library/menu.tcl:
- * library/msgbox.tcl:
- * library/scrlbar.tcl:
- * library/spinbox.tcl:
- * library/text.tcl:
- * library/tk.tcl:
- * library/demos/menu.tcl:
- * library/demos/menubu.tcl:
- * library/demos/widget: check [tk windowingsystem] instead of
- and/or in addition to $tcl_platform(platform).
-
- * generic/tkInt.h:
- * mac/tkMacBitmap.c:
- * mac/tkMacWm.c: added missing CONSTification
-
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkIntXlibDecls.h:
- * generic/tkPlatDecls.h:
- * generic/tkStubInit.c: regen
-
-2002-08-27 D. Richard Hipp <drh@hwaci.com>
-
- * doc/checkbutton.n: [Bug 582457] Fix the -offrelief option so
- * doc/radiobutton.n: that when -offrelief is flat and -relief is
- * mac/tkMacButton.c: sunken and -overrelief is raised, buttons
- * unix/tkUnixButton.c: work look toolbar buttons under Windows.
- * win/tkWinButton.c: See also: TIP #82.
-
-2002-08-26 Don Porter <dgp@users.sf.net>
-
- * win/Makefile.in: Removed dependence on the (parts of) the
- * win/winMain.c: tcltest executable on Windows. It was not
- used, and the dependency complicated the Makefile. [Bug 592638].
-
-2002-08-20 Don Porter <dgp@users.sf.net>
-
- * README: Bumped version number to 8.4b3 to distinguish
- * generic/tk.h: HEAD from the 8.4b2 release.
- * unix/configure.in:
- * win/configure.in:
- * unix/tk.spec:
-
- * unix/configure: autoconf
- * win/configure:
-
- * generic/tk.h: Added compile-time check that the tcl.h header file
- #included by Tk 8.4 is one from Tcl 8.4. This is needed to be sure
- that new #defines like CONST84 are available. [Bug 597432].
-
-2002-08-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in (install-binaries): simplified pkgIndex.tcl
- file created on installation.
- * win/Makefile.in (install-binaries): corrected and simplified
- creation of pkgIndex.tcl file on installation.
-
-2002-08-14 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * win/tkWinDialog.c:
- * win/makefile.vc: broken compilation and link from changes
- Hobbs-08-07 fixed.
- * win/tkWinTest.c: CONST problem resolved.
-
-2002-08-13 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/button.tcl: change the bindings to use Priv($w,relief)
- instead of just Priv(relief). This ensures that neighboring
- buttons don't confuse (over)relief settings.
-
-2002-08-13 Reinhard Max <max@suse.de>
-
- * unix/tkUnixSend.c (Tk_SetAppName): Fixed a compiler warning.
-
-2002-08-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/image2.tcl: Tweaked the behaviour of the directory
- box on resize, as resizing of the overall window tends to be
- common given the sample images.
-
-2002-08-08 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/tkUnixWm.c (WmTransientCmd): Apply fix for
- wm transient assertion error that was applied
- to tkWinWm.c for Tk Bug #592201.
-
-2002-08-08 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/wm.test: Add deleteWindows at start of
- new transient tests so they do not fail if the
- toplevels already exist.
- * unix/tkUnixWm.c: Revert patch for Tk Bug #592201
- which incorrectly removed numTransients member.
-
-2002-08-08 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixWm.c:
- * win/tkWinWm.c:
- * tests/wm.test: Fix for Tk Bug #592201 "wm transient fails with two
- masters"; fixes panic after a transient window is reassigned to
- new master and either master is subsequently destroyed.
-
-2002-08-08 Don Porter <dgp@users.sf.net>
-
- * tests/unixWm.test: Corrected packaging of unixWm-50.3 so that
- [setupbg] and [cleanupbg] always balance, no matter what tests
- are skipped.
-
-2002-08-08 Reinhard Max <max@suse.de>
-
- * unix/Makefile.in: Fixed typos in DISTNAME, and ZIPNAME.
-
-2002-08-08 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4b2 TAGGED FOR RELEASE ***
-
- * generic/tkButton.c (TkButtonWorldChanged): added GCFont handling
- to the disabledGc of buttons when compound != none. The drawing
- appears to be incorrect across platforms still. [Bug #477740]
-
- * generic/tkImgGIF.c (FileReadGIF): fixed -from handling for gifs
- [Bug #467524] (obermeier)
-
-2002-08-07 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkCanvUtil.c (TkSmoothParseProc): recognize the built-in
- bezier method by name. [Bug #578654]
- * doc/canvas.n: update to note that -smooth really doesn't take
- or return just booleans.
-
- * win/tkWinMenu.c (TkpSetWindowMenuBar): fixed logic bug in when
- to idle call ReconfigureWindowsMenu.
-
- * doc/GetBitmap.3: removed doc refs to deprecated
- Tk_GetBitmapFromData. [Bug #590379]
-
- * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd):
- * library/panedwindow.tcl: changed class from PanedWindow to
- Panedwindow to not conflict with existing bwidgets, but also to be
- more regular with other names used in the core.
-
- * tests/panedwindow.test: added -text foobar to some test buttons
- to enable correct testing of panedwindow across platforms.
- [Bug #582370]
-
- * win/tkWinDialog.c: enabled use of the updated native Windows
- directory browser (tk_chooseDirectory). This does require
- shell32.dll v4.71 or greater. [Patch #468139]
-
- * win/configure:
- * win/tcl.m4: added shell32 to libs for updated native Windows
- tk_chooseDirectory dialog.
-
-2002-08-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkPanedWindow.c (RESIZE_PENDING): Separated out flag for
- indicating that a resize needs to be issued.
- (PanedWindowReqProc): Do the old behaviour when the panedwindow is
- not mapped; easiest way of making the test suite pass while still
- preserving improved behaviour in the face of children whose size
- is not known immediately.
-
-2002-08-06 Don Porter <dgp@users.sf.net>
-
- * tests/defs.tcl: removed file. No longer needed now that Tk is
- using the tcltest package to do its testing.
-
-2002-08-05 Don Porter <dgp@users.sf.net>
-
- * win/tkWinFont.c: Additional changes to fix CONST warnings on
- * win/tkWinWM.c: Windows due to latest patch. Tks Vince Darley.
-
- * doc/3DBorder.3: Applied companion patch for Tcl Patch 585105,
- * doc/BindTable.3: updating Tk to use Tcl 8.4's fully CONST-ified
- * doc/ConfigWidg.3: interface, and fully CONSTifying Tk at the
- * doc/CrtImgType.3: same time.
- * doc/CrtWindow.3:
- * doc/DeleteImg.3: This patch includes purging Tk of its last
- * doc/FindPhoto.3: direct access to interp->result. [Bug 589853]
- * doc/GetAnchor.3:
- * doc/GetBitmap.3: The substantial changes include copying
- * doc/GetCapStyl.3: event sequence strings into Tcl_DStrings
- * doc/GetClrmap.3: in tkBind.c, and copying [text] indices into
- * doc/GetColor.3: Tcl_DStrings because parsing them involved
- * doc/GetCursor.3: overwriting them. If this causes performance
- * doc/GetFont.3: trouble, that can be resolved by further
- * doc/GetImage.3: converting them to Tcl_Obj's.
- * doc/GetJoinStl.3:
- * doc/GetJustify.3: The #defines USE_NON_CONST and USE_COMPAT_CONST
- * doc/GetOption.3: have the same effect for Tk as they do for Tcl.
- * doc/GetRelief.3: (They actually change tcl.h)
- * doc/GetScroll.3:
- * doc/GetVisual.3:
- * doc/InternAtom.3:
- * doc/NameOfImg.3:
- * doc/SetAppName.3:
- * doc/WindowId.3:
- * generic/tk.decls:
- * generic/tk.h:
- * generic/tk3d.c:
- * generic/tkAtom.c:
- * generic/tkBind.c:
- * generic/tkBitmap.c:
- * generic/tkButton.c:
- * generic/tkCanvArc.c:
- * generic/tkCanvBmap.c:
- * generic/tkCanvImg.c:
- * generic/tkCanvLine.c:
- * generic/tkCanvPoly.c:
- * generic/tkCanvPs.c:
- * generic/tkCanvText.c:
- * generic/tkCanvUtil.c:
- * generic/tkCanvWind.c:
- * generic/tkCanvas.c:
- * generic/tkCanvas.h:
- * generic/tkClipboard.c:
- * generic/tkCmds.c:
- * generic/tkColor.c:
- * generic/tkConfig.c:
- * generic/tkConsole.c:
- * generic/tkCursor.c:
- * generic/tkDecls.h:
- * generic/tkEntry.c:
- * generic/tkFont.c:
- * generic/tkFrame.c:
- * generic/tkGet.c:
- * generic/tkGrid.c:
- * generic/tkImage.c:
- * generic/tkImgBmap.c:
- * generic/tkImgPhoto.c:
- * generic/tkInt.decls:
- * generic/tkInt.h:
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkListbox.c:
- * generic/tkMenu.c:
- * generic/tkMenubutton.c:
- * generic/tkMessage.c:
- * generic/tkOldConfig.c:
- * generic/tkOption.c:
- * generic/tkRectOval.c:
- * generic/tkScale.c:
- * generic/tkScrollbar.c:
- * generic/tkSelect.c:
- * generic/tkStyle.c:
- * generic/tkTest.c:
- * generic/tkText.c:
- * generic/tkText.h:
- * generic/tkTextBTree.c:
- * generic/tkTextDisp.c:
- * generic/tkTextImage.c:
- * generic/tkTextIndex.c:
- * generic/tkTextMark.c:
- * generic/tkTextTag.c:
- * generic/tkTextWind.c:
- * generic/tkUtil.c:
- * generic/tkVisual.c:
- * generic/tkWindow.c:
- * mac/tkMacConfig.c:
- * mac/tkMacCursor.c:
- * mac/tkMacEmbed.c:
- * mac/tkMacSend.c:
- * unix/tkUnixConfig.c:
- * unix/tkUnixCursor.c:
- * unix/tkUnixEmbed.c:
- * unix/tkUnixFont.c:
- * unix/tkUnixSelect.c:
- * unix/tkUnixSend.c:
- * unix/tkUnixWm.c:
- * win/tkWinConfig.c:
- * win/tkWinCursor.c:
- * win/tkWinEmbed.c:
- * win/tkWinMenu.c:
- * win/tkWinSend.c:
-
-2002-08-02 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkPanedWindow.c (DestroyPanedWindow): Idle calls need to
- be deleted on destruction of the window, or things can *really* go
- pear-shaped.
-
-2002-07-31 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkPanedWindow.c (PanedWindowReqProc): Postpone pane
- arrangement until idle, as is done in other window managers, to
- fix problems with size calculations when the children don't
- already know their sizes anyway.
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
-2002-07-29 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/configure.in: Remove code that was setting
- CC_SEARCH_FLAGS and LD_SEARCH_FLAGS to try to
- account for cc vs ld linking. Tcl now handles this.
- * unix/tcl.m4: Update from Tcl.
-
-2002-07-27 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in: Add MAJOR_VERSION, MINOR_VERSION,
- PATCH_LEVEL, INSTALL_LIBRARY, STUB_LIB_FILE, and LIB_FILE
- to support changes in tcl.m4 related to library builds.
- Use MAKE_LIB macro to avoid dealing with RANLIB issues.
- Rename TK_CC_SEARCH_FLAGS to CC_SEARCH_FLAGS and
- rename TK_LD_SEARCH_FLAGS to LD_SEARCH_FLAGS.
- Use new INSTALL_LIB and INSTALL_STUB_LIB substs to
- deal with ranlib issues when install libraries.
- * unix/configure: Regen.
- * unix/configure.in: Remove AC_PROG_RANLIB since
- this is done by tcl.m4 now. Define CC_SEARCH_FLAGS
- instead of TK_CC_SEARCH_FLAGS and so on.
- Use MAKE_LIB and MAKE_STUB_LIB from tcl.m4.
- Remove AC_SUBST calls that are no done in tcl.m4.
- * unix/tcl.m4: Update from Tcl.
- * unix/tkConfig.sh.in: Subst CC_SEARCH_FLAGS and
- LD_SEARCH_FLAGS.
-
-2002-07-25 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkInt.h:
- * generic/tkWindow.c:
- * mac/tkMacWm.c:
- * unix/tkUnixWm.c:
- * win/tkWinWm.c:
- * tests/wm.test:
- * tests/winWm.test:
- * tests/unixWm.test: Objectifed wm. [Patch #564521]
- Note: At this point the Mac file is completely untested
- and may not even compile.
-
-2002-07-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/spinbox.test: added spinbox-22.[1-3]
- * generic/tkEntry.c (ConfigureEntry): made the textvariable value
- take precedence over changed -from/-to values, unless it must be
- constrained. [Bug #559078]
-
- * library/spinbox.tcl (MouseSelect): when not in the entry, just
- return instead of invoking - ButtonUp handles invoking already.
- [Bug #499168]
-
- * library/tk.tcl (RestoreFocusGrab): handle the case where the
- FocusGrab info is not set. [Bug #553283]
-
-2002-07-24 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/canvas.test: added canvas-14.[1-6]
- * generic/tkCanvas.c (CanvasWidgetCmd): corrected handling of
- 'scan' subcommand args. Also removed early return cases to goto
- done instead where the canvasPtr would be Tcl_Release'd. This may
- solve other problems with unreleased canvasPtr's. [Bug #581560]
-
- * win/tkWinButton.c (TkpDisplayButton): corrected display of focus
- ring around the actual text when the button is a compound button.
- [Bug #583691]
-
- * unix/README: Corrected notes about running user interactive Tk
- tests. [Bug #462320]
-
- * generic/tkText.c (TextEditUndo): set isDirtyIncrement to -1 when
- reverting to note proper "dirtiness". [Bug #580362] (callewaert)
-
- * generic/tkEntry.c (DisplayEntry): correct cursor position before
- calling Tk_SetCaretPos. (yamamoto)
-
-2002-07-23 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
-2002-07-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * library/choosedir.tcl (tk::dialog::file::chooseDir):
- * library/clrpick.tcl (tk::dialog::file::chooseDir):
- * library/msgbox.tcl (tk::MessageBox):
- * library/tkfbox.tcl (tk::dialog::file):
- * library/xmfbox.tcl (tk::MotifFDialog):
- Revert [Tk patch 568278]. The transient window workaround
- is no longer needed since the fix for [Tk bug 570764]
- solved the problem for withdrawn transients.
-
-2002-07-19 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure:
- * unix/configure.in:
- * win/configure:
- * win/configure.in: Add AC_PREREQ(2.13) in an attempt
- to make it more clear that the configure scripts
- must be generated with autoconf version 2.13.
- [Tcl Bug 583573]
-
-2002-07-19 D. Richard Hipp <drh@hwaci.com>
-
- * library/mkpsec.tcl: Fix a bug that was causing postscript generation
- to fail under Win2K.
-
-2002-07-18 Reinhard Max <max@suse.de>
-
- * unix/tkUnixSend.c: Using Tcl_GetTime instead of TclpGetTime.
-
-2002-07-17 Reinhard Max <max@suse.de>
-
- * library/unsupported.tcl: Extended ExposePrivateVariable, and
- ExposePrivateCommand to accept patterns as well.
-
-2002-07-17 Don Porter <dgp@users.sf.net>
-
- * generic/tkFont.c: Corrected reversed logic in assert -> panic
- conversion. [Bug 582799]
-
-2002-07-16 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkFont.c (TkFontPkgFree): Call panic instead
- of assert since assert is not used in the rest of Tk.
- [Tk bug 579651]
-
-2002-07-16 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in:
- * win/Makefile.in: Add a more descriptive warning
- in the event `make genstubs` needs to be rerun.
-
-2002-07-16 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * win/tkWinWm.c:
- * doc/wm.n: fix for part of [Bug 581627], and made iconbitmap
- code on Windows more flexible about reading in icons [Bug
- 220800].
-
-2002-07-15 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.bc (new): re-add of the borland makefile. Submitted
- by Helmut Giese <hgiese@ratiosoft.com>. This needs testing, still.
-
-2002-07-15 Don Porter <dgp@users.sf.net>
-
- * Fixes for [Bug 581627, 581795].
- * generic/tkTest.c: Test commands not supported on non-Unix
- platforms should not be defined there in the first place.
- * tests/constraints.tcl: Fixed "secureserver" constraint.
- * tests/unixWm.test: Some tests needed "unix" constraint.
- * win/tkWinWm.c: Typo in error message.
-
-2002-07-14 Don Porter <dgp@users.sf.net>
-
- * tests/event.test: Fixes to enable testing of only userInteraction
- * tests/visual_bb.test: tests.
-
- * README: Bumped HEAD to version 8.4b2 in order to
- * generic/tk.h: distinguish it from the 8.4b1 release.
- * unix/configure*: Also extended LOCALES to cover all message
- * unix/tk.spec: catalogs.
- * win/configure*:
-
- * tests/focustTcl.test: Conversion bug: Corrected backwards logic.
- * tests/imgPhoto.test: Conversion bug: overwrote unix/README.
-
- * tests/all.tcl: Completed conversion of Tk test suite
- * tests/constraints.tcl: to use tcltest.
- * tests/[b-v]*.test:
- * unix/Makefile.in:
-
-2002-07-12 Don Porter <dgp@users.sf.net>
-
- * tests/constraints.tcl: Converted more files to tcltest and
- * tests/[g-x]*.test: factored out common code.
-
-2002-07-11 Don Porter <dgp@users.sf.net>
-
- * tests/canvPsImg.tcl: Converted several files in the
- * tests/constraints.tcl (new file): Tk test suite for testing by
- * tests/[r-x]*.test: tcltest 2.1.
- * unix/Makefile.in:
-
-2002-07-11 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinDialog.c (Tk_ChooseDirectoryObjCmd): initialize
- utfTitle to NULL, add a few more notes about limitations of
- possible new Tk_ChooseDirectoryObjCmd function.
-
-2002-07-11 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/imgPhoto.test (imgPhoto-15.1): Added test of mem-alloc
- failure, but this is non-portable.
- * generic/tkImgPhoto.c (ImgPhotoSetSize): Allowed this function to
- fail when it can't allocate enough memory. Note that not all the
- places that call it can fail nicely without API changes; some
- still panic but at least some of the potential failures are now
- handled gracefully.
-
- * tests/visual_bb.test (lpr): Stopped this from relying on
- external files; direct piping is much more flexible for this
- application.
-
-2002-07-09 Don Porter <dgp@users.sf.net>
-
- * generic/tkTest.c: Removed unused dependence on TclThread_Init()
- * tests/defs.tcl: and [testthread]. [Bug 578165, Tcl Bug 531413]
-
-2002-07-08 David Gravereaux <davygrvy@pobox.com>
-
- * unix/Makefile.in: Added missing win/lamp.bmp to the dist
- target.
-
-2002-07-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4b1 TAGGED FOR RELEASE ***
-
-2002-07-04 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/bgerror.tcl (bgerror): Stopped the bgerror dialog from
- getting wider than the screen; in theory really long messages
- could make it become taller than the screen now, but that's much
- less likely to happen. Also trimmed a little bit of internal
- space so that the icon-message gap is the same as the icon-frame
- and message-frame gaps.
-
-2002-07-01 Don Porter <dgp@users.sf.net>
-
- * unix/configure:
- * unix/tcl.m4: Updated to latest tcl.m4 from Tcl.
-
-2002-06-28 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/msgbox.tcl (MessageBox): Force all non-button widgets to
- have the same background as the containing toplevel. [Bug #552515]
-
-2002-06-27 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-
- * win/Makefile.in (install-binaries): Fix of troubled Makefile
- quoting introduced by [Patch 521356] causing the installed to
- fail.
-
-2002-06-25 Don Porter <dgp@users.sf.net>
-
- * unix/tkUnixFont.c: (Tk_DrawChars) silence compiler warning.
-
-2002-06-26 David Gravereaux <davygrvy@pobox.com>
-
- * generic/tkStyle.c: <eol> of the committing cvs client didn't
- match the <eol> of the file itself. Windows users where getting
- \r\r\n. Problem fixed.
-
-2002-06-26 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
-
- * generic/tkFont.c (TkTextLayoutToPostscript): fixed potential
- buffer overflow which could be intentionally triggered from
- within safe interpreter -- malicious applet could modify
- tk::psglyphs array.
-
-2002-06-26 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
-
- * tests/font.test (font-32.1): updated this test
- to expect the new behavior of canvas postscript.
-
-2002-06-25 Don Porter <dgp@users.sf.net>
-
- * unix/Makefile.in: Expanded install-binaries target to create
- * win/Makefile.in: and install a pkgIndex.tcl file to enable
- Tk as a loadable package [Patch 521356]
-
-2002-06-25 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
-
- * library/mkpsenc.tcl: (added) utilities to generate
- Postscript prolog for current system encoding.
- * generic/tkCanvPs.c (TkCanvPostscriptCmd): now
- uses mkpsenc.tcl to generate Postscript prolog.
- * generic/tkFont.c (TkTextLayoutToPostscript): modified
- according to patch #546910. Now outputs system-encoded
- characters (for unibyte) or Adobe glyph names (for
- multibyte or outside-locale).
- * tests/canvText.test (canvText-17.1): updated this test
- to expect the new behavior of canvas postscript.
-
-2002-06-25 Reinhard Max <max@suse.de>
-
- * unix/tcl.m4: New macro SC_CONFIG_MANPAGES.
- * unix/configure.in: Added support for symlinks and compression
- * unix/Makefile.in: when installing the manpages. [Patch 518052]
- Default is still hardlinks and no compression.
-
- * unix/mkLinks: generated
- * unix/configure:
-
- * unix/README: Added documentation for the new features.
-
- * unix/configure: Replaced ${exec_prefix}/lib
- * unix/tcl.m4 (SC_PATH_TCLCONFIG): by ${libdir}.
-
-2002-06-24 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/winWm.test: Verify that both an unmapped
- and already mapped toplevel are raised and receive
- the focus when deiconified.
- * tests/wm.test: Add wm deiconify tests. Check that
- a toplevel that has never been mapped is not mapped
- by the deiconify command since it should be done
- at idle by MapFrame.
- * win/tkWinWm.c (Tk_WmCmd): Check the WM_NEVER_MAPPED
- flag while processing the wm deiconify command.
- The WM_UPDATE_PENDING flag should never be set when
- WM_NEVER_MAPPED is set, but double check so that
- the implementation is more explicit and matches
- the comment just above.
- Return without invoking TkWmRestackToplevel or
- TkSetFocusWin on a toplevel that has never been
- mapped. This fixes a bug where a toplevel is mapped
- with the wrong size and is then resized by the
- idle call to MapFrame. [Tk bug 233150]
-
-2002-06-23 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (UpdateGeometryInfo): remove the check for a null
- wrapper introduced in r1.41 on 2002-06-15 because it prevented
- geometry setting from taking effect if the window was not on the
- screen. Another check may go in it's place as IsIconic and
- IsZoomed should not be passed NULL.
-
-2002-06-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/wm.test: Remove invalid minsize test. Add update
- calls to wm transient tests so that idle handlers get
- run. This is needed to get the tests to pass under Win32.
- * unix/tkUnixWm.c (WmWaitMapProc): Move the special
- transient withdrawn check into the if body to
- make it easier to set a breakpoint on this test
- inside a debugger. No functional changes.
- * win/tkWinWm.c (WmWaitVisibilityOrMapProc): Ditto.
-
-2002-06-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/wm.n: TIP #95 Windows implementation and
- * mac/tkMacWm.c (Tk_WmCmd): docs with mac and unix stubs.
- * unix/tkUnixWm.c (Tk_WmCmd):
- * win/tkWinWm.c (Tk_WmCmd):
- * tests/unixWm.test:
- * tests/winWm.test: more wm attr tests will be needed.
-
- * generic/tkGrid.c (GridReqProc): check that gridPtr is not NULL
- (may be when embedded). [Bug #548791] (halliday)
-
- * generic/tkFont.c (TkFontPkgFree): changed panic on freeing fonts
- to an assert, and wrapped panic in #ifdef PURIFY. [Bug #568701]
-
- * library/menu.tcl: corrected menus from being posted offscreen
- on Windows. [Bug #464451] (darley)
-
- * library/console.tcl: corrected the defaultPrompt substitution
- [Bug #553207] and made Tab a default expansion key (like Escape).
-
- * win/tkWinEmbed.c (EmbedWindowDeleted): added a check for a null
- containerPtr. The core of this bug is likely elsewhere. [Bug #476176]
-
- * doc/text.n: TIP #93 implementation that
- * generic/tkText.c (TextWidgetCmd): enhances the text get and
- * generic/tkTextIndex.c (TkTextGetIndex): delete methods to accept
- * tests/text.test: multiple range pairs.
- This handles the delete case in an atomic, fixed-index fashion.
-
-2002-06-21 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/wm.test: Add tests to make sure a withdrawn
- transient does not get remapped by state changes
- in the master.
- * unix/tkUnixWm.c (Tk_WmCmd, WmWaitMapProc):
- * win/tkWinWm.c (Tk_WmCmd, WmWaitVisibilityOrMapProc):
- Add a WM_TRANSIENT_WITHDRAWN flag that gets set by the
- withdraw, deiconify, or state wm subcommands. Check
- this flag before mapping a transient when processing
- a MapNotify event. [Tk bug 570764]
-
-2002-06-21 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * unix/tk.spec (version), README, win/configure.in, unix/configure.in:
- * generic/tk.h (TK_RELEASE_*, TK_PATCH_LEVEL): Bumped to beta1.
-
-2002-06-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/text.n: TIP #104 implementation which generalizes the
- * generic/tkText.c: undo/redo stack to not be tied solely to the
- * generic/tkText.h: text widget. The APIs are still private.
- * generic/tkUndo.c: This also adds a stack limiting ability and
- * generic/tkUndo.h: a -maxundo option to the text widget (in
- * library/text.tcl: addition to the options from TIP #26) should
- * mac/tkMacDefault.h: users want to limit the undo/redo stack
- * tests/text.test: (should not be necessary in most cases).
- * unix/Makefile.in: [Patch #554763] (callewart)
- * unix/tkUnixDefault.h:
- * win/Makefile.in:
- * win/makefile.vc:
- * win/tkWinDefault.h:
-
-2002-06-21 Don Porter <dgp@users.sf.net>
-
- * unix/Makefile.in: Removed unnecessary dependence of tktest
- * unix/tkAppInit.c: executable on the tcltest executable on
- Unix. If there are similar dependencies on other platforms, they
- can probably be removed as well. [Bug 572134].
-
-2002-06-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/listbox.n:
- * generic/tkListbox.c (DisplayListbox):
- * mac/tkMacDefault.h: TIP #94 implementation adding -activestyle
- * tests/listbox.test: option to the listbox. This adds the ability
- * unix/tkUnixDefault.h: to have listboxes look native on Windows, and
- * win/tkWinDefault.h: "nicer" elsewhere using the 'dotbox' style.
-
-2002-06-20 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkGrid.c: Corrected the test for grid propagate change.
- [Bug #571433]
-
-2002-06-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/panedwindow.test:
- * generic/tkPanedWindow.c: ensure that sash index is lower bounds
- checked. [Bug #548727]
-
-2002-06-19 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkClipboard.c (TkClipCleanup): Add code
- to set dispPtr->clipWindow to NULL, this was
- accidently removed by last commit. Fixes
- a crash while running the tests under win32.
-
-2002-06-19 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkBind.c (TkBindDeadWindow):
- Handle case where Tk_DestroyWindow is invoked
- on clipboard and send windows.
- * generic/tkClipboard.c (TkClipCleanup):
- Invoke Tk_DestroyWindow to cleanup the
- dispPtr->clipWindow. Call Tcl_Preserve
- and Tcl_Release on the window to avoid an
- invalid memory ref on shutdown.
- * generic/tkEvent.c (Tk_HandleEvent):
- Panic if XCreateIC is invoked twice for
- the same window. This should never happen,
- the check were just added to make sure it
- does not since this could lead to crashes
- in XCloseIM.
- * generic/tkFocus.c (TkFocusDeadWindow):
- Handle case where Tk_DestroyWindow is invoked
- on clipboard and send windows.
- * generic/tkOption.c (TkOptionDeadWindow): Ditto.
- * generic/tkWindow.c (TkCloseDisplay): Move
- deletion of dispPtr->winTable after TkpCloseDisplay
- call since Tk_DestroyWindow uses it and could
- be called by TkpCloseDisplay for clipboard/send windows.
- Also invoke ckfree for the dispPtr instead of
- doing it in TkpCloseDisplay.
- (Tk_DestroyWindow): Check for a null winPtr->mainPtr
- before doing certain cleanup tasks so the we can
- invoke Tk_DestroyWindow on clipboard and send windows.
- We need to do this so that XDestroyIC will get invoked
- for the input contexts of each window.
- * mac/tkMacXStubs.c (TkpCloseDisplay): Don't free
- the displayPtr since this is now done in TkCloseDisplay.
- * unix/tkUnixEvent.c (TkpCloseDisplay, OpenIM): Remove
- conditional compilation around calls to XCloseIM
- since I am confident that the crashes related to
- input contexts has been fixed. Don't free
- the displayPtr since this is now done in TkCloseDisplay.
- * unix/tkUnixSend.c (TkSendCleanup): Invoke the
- Tk_DestroyWindow method to cleanup the special
- send window. This will call XDestroyIC and thereby
- avoid a crash in XCloseIM. The send window needs
- to be Tcl_Preserve and Tcl_Release to avoid an
- invalid memory ref on shutdown.
- * win/tkWinX.c (TkpCloseDisplay): Don't free
- the displayPtr since this is now done in TkCloseDisplay.
- [Tk patch 570902]
-
-2002-06-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkStyle.c: TIP#48 style engine.
- See http://purl.org/tcl/tip/48.html for details.
-
- * generic/tkConfig.c (GetOptionFromObj): Split to allow for access
- to option tables via name as well as via object.
- (TkGetOptionSpec): Semi-public interface to GetOption functionality.
- (DoObjConfig, Tk_RestoreSavedOptions, FreeResources)
- (GetObjectForOption): Basic style support for configure.
-
- * generic/tkWindow.c (TkCreateMainWindow, Tk_DestroyWindow): Added
- calls to set up and tear down the style subsystem.
-
- * generic/tk.decls, generic/tk.h: Many declarations forming TIP#48
- public interface.
-
- * generic/tkInt.decls (TkStylePkgInit,TkStylePkgFree):
- * generic/tkInt.h (TkGetOptionSpec): Supporting declarations.
-
- * unix/Makefile.in, win/Makefile.in, win/makefile.vc: Added
- tkStyle.c to list of generic source files.
-
-2002-06-18 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/defs.tcl (makeFile): Defined the return value of this
- procedure to be the filename of the created file, as in the real
- tcltest package...
-
-2002-06-17 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkImage.c (Tk_ImageObjCmd, DeleteImage): Call
- Tcl_Preserve and Tcl_Release for the masterPtr->winPtr
- window to avoid accessing memory that had already
- been deallocated in DeleteImage.
-
-2002-06-17 David Gravereaux <davygrvy@pobox.com>
-
- Trims to support the removal of RESOURCE_INCLUDED from rc
- scripts from Tcl's accepted FR #565088.
-
- * generic/tk.h: Changed RESOURCE_INCLUDED to be RC_INVOKED
- as the RC tool defines this already by default.
-
- * win/rc/tk.rc:
- * win/rc/wish.rc: removed the #define RESOURCE_INCLUDED lines.
-
-2002-06-17 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in (dist): correct installation of
- wish.exe.manifest to DISTDIR target directory.
-
- * generic/tkCmds.c (Tk_TkObjCmd):
- * generic/tkInt.h (struct TkCaret):
- * mac/tkMacXStubs.c (Tk_SetCaretPos):
- * unix/tkUnixKey.c (TkpGetString, Tk_SetCaretPos):
- * win/tkWinX.c (Tk_SetCaretPos):
- * tests/tk.test: Added 'tk caret' implementation of TIP#96
- * doc/SetCaret.3 (new): which adds a TkCaret structure element to
- * doc/tk.n: TkDisplay for maintaining state.
-
- * unix/tkUnixSend.c (TkSendCleanup): special cleanup of
- inputContext to avoid bug in XCloseIM. (dejong)
-
-2002-06-17 Don Porter <dgp@users.sf.net>
-
- * library/msgs/en_gb.msg: Added catalog for UK English.
- Currently includes only Color -> Colour translation.
-
-2002-06-17 D. Richard Hipp <drh@hwaci.com>
-
- * doc/checkbutton.n:
- * doc/radiobutton.n:
- * generic/tkButton.c:
- * generic/tkButton.h:
- * mac/tkMacButton.c:
- * tests/button.test:
- * unix/tkUnixButton.c:
- * win/tkWinButton.c: Implementation of TIP#82 - Added the
- -offrelief option to checkbutton and radiobutton.
-
-2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkWindow.c (Tk_DestroyWindow): Set the pathName
- component of a window to NULL after its memory has been
- deallocated to avoid a possible illegal memory access
- as a result of a call to Tk_PathName() on a Tk_Window
- structure of a window that has already been destroyed.
- [Tk bug 521946]
-
-2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkOption.c (Tk_GetOption): Allocate
- memory with ckalloc not malloc. This keeps
- Tk from erroring out when built with
- TCL_MEM_DEBUG.
-
-2002-06-14 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkBind.c (HandleEventGenerate):
- * generic/tkInt.h: changed warpInProgress boolean from int to a
- bit in the flags variable (TK_DISPLAY_IN_WARP)
-
- * generic/tkCmds.c (Tk_TkObjCmd):
- * unix/tkUnixKey.c (TkpGetString):
- * generic/tkEvent.c (Tk_HandleEvent):
- * generic/tkInt.h: changed useInputMethods boolean from int to a
- bit in the flags variable (TK_DISPLAY_USE_IM)
-
- * generic/tkInt.h:
- * generic/tkCmds.c (Tk_WmObjCmd):
- * unix/tkUnixWm.c (Tk_WmCmd):
- * win/tkWinWm.c (Tk_WmCmd): changed wmTracing from being an int to
- just a bit in the flags variable (TK_DISPLAY_WM_TRACING)
-
- * generic/tkEvent.c (Tk_HandleEvent):
- * unix/tkUnixEvent.c (OpenIM):
- * unix/tkUnixKey.c (TkpGetString):
- * generic/tkInt.h: added TK_DISPLAY_XIM_SPOT flag bit for TkDisplay
- and used this to allow a runtime check to see if over-the-spot XIM
- is possible. If not it will try and fallback to the old-style
- input context, which handles things like dead keys input.
-
- * generic/tk.decls: added TIP #84 implementation that adds a
- * generic/tkDecls.h: Tk_CollapseMotionEvents API which controls
- * generic/tkEvent.c: Tk's collapsing of incoming motion events
- * generic/tkInt.h: on its windows. The default remains to do
- * generic/tkStubInit.c: collapsing. Added a flags parameter to the
- * generic/tkWindow.c: internal display structure to support this
- * doc/QWinEvent.3: and be used in the future for other bits.
- [Tk patch 564642]
-
- * unix/mkLinks: updated from current docs
-
-2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkEvent.c (TkXErrorHandler): Declare static
- function to avoid compiler error with VC++.
- * generic/tkBind.c (ExpandPercents): Cast argument to
- Tk_GetAtomName in order to avoid compiler warning.
-
-2002-06-14 Joe English <jenglish@users.sf.net>
-
- * doc/bind.n:
- * generic/tk.h:
- * generic/tkBind.c:
- * generic/tkCanvWind.c:
- * generic/tkCmds.c:
- * generic/tkEvent.c:
- * generic/tkFocus.c:
- * generic/tkGrab.c:
- * generic/tkGrid.c:
- * generic/tkImage.c:
- * generic/tkPack.c:
- * generic/tkPlace.c:
- * generic/tkPointer.c:
- * generic/tkTextWind.c:
- * generic/tkWindow.c:
- * mac/tkMacSubwindows.c:
- * mac/tkMacWindowMgr.c
- * mac/tkMacWm.c:
- * unix/Makefile.in:
- * unix/tkUnixEmbed.c:
- * unix/tkUnixWm.c:
- * win/tkWinScrlbr.c:
- * win/tkWinWindow.c:
- * win/tkWinWm.c: Implementation of TIP #47 by Neil McKay
- "Modifying Tk to Allow Writing X Window managers".
- Add CirculateRequest, Create, MapRequest, ResizeRequest,
- and ConfigureRequest event types;
- Split TK_TOPLEVEL flag into TK_TOPLEVEL, TK_HAS_WRAPPER,
- TK_WIN_MANAGED, and TK_TOP_HIERARCHY. [Tk patch 572978]
-
-2002-06-14 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-
- * unix/tkAppInit.c: Removed now unneeded and erroneous reference
- to 'matherr'. See Tcl ChangeLog entry 2002-05-31 Don Porter.
-
-2002-06-14 David Gravereaux <davygrvy@pobox.com>
-
- * win/rules.vc: The test for compiler optimizations was in error.
- Thanks goes to Roy Terry <royterry@earthlink.net> for his
- assistance with this.
-
-2002-06-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- Implement TIP 98 [Tk patch 566765]
-
- * doc/FindPhoto.3, generic/tk.h, generic/tk.decls:
- * generic/tkImgPhoto.c: Changed *_Old to *_NoComposite and
- USE_OLD_PHOTO_PUT_BLOCK to USE_COMPOSITELESS_PHOTO_PUT_BLOCK
- following a suggestion from Don Porter.
-
- * tests/imgPhoto.test: Added tests of -compositingrule
-
- * doc/photo.n: Added documentation for "-compositingrule".
- * generic/tkImgPhoto.c (ImgPhotoCmd, ParseSubcommandOptions): New
- "-compositingrule" option for [$photo copy] subcommand, using
- OPT_COMPOSITE flag and compositingRule field in SubcommandOptions
- structure.
-
- * doc/FindPhoto.3: Documented the extra argument for the
- compositing rule and the action to take if anyone wants to
- maintain total backward-compatability.
-
- * generic/tk.h (TK_PHOTO_COMPOSITE_*): Defined values for use as
- compositing rules.
- (USE_OLD_PHOTO_PUT_BLOCK): Added a way for users to select the old
- interface to Tk_PhotoPutBlock to provide an easier upgrade path.
-
- * generic/tk.decls: Alter Tk_PhotoPut*Block to Tk_PhotoPut*Block_Old
- and introduce new slots for the old name of function with an extra
- argument at the end for the compositing rule.
-
- * generic/tkImgPhoto.c (ImgPhotoCmd): Updated "transparency set"
- subcommand to use TkSubtractRegion().
-
- * win/tkWinRegion.c (TkSubtractRegion):
- * mac/tkMacRegion.c (TkSubtractRegion):
- * generic/tkInt.decls (TkSubtractRegion):
- * unix/tkUnixPort.h (TkSubtractRegion): Added function to perform
- the set-difference operation on regions; it seems all platforms
- can support it, and it makes removing rectangular bits from
- regions much easier.
-
- * generic/tkImgPPM.c (FileReadPPM): Reading a PPM/PGM always uses
- the SET compositing rule because it is faster and the format does
- not have any transparency information.
-
- * generic/tkImgGIF.c (FileReadGIF): Reading a GIF always uses the
- SET compositing rule because GIF files model transparency as a
- single special colour.
-
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
- Added a compositing rule to allow better control over what happens
- to transparent pixels when inserting data into a photo image.
-
-2002-06-13 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/winfo.test: Add basic tests for winfo ismapped.
-
-2002-06-13 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/unixWm.test:
- * tests/wm.test: Move wm minsize and wm maxsize
- usage tests into the cross platform wm tests.
-
-2002-06-13 Don Porter <dgp@users.sf.net>
-
- * tests/cursor.test: corrected error after cursor-2.2.
- * tests/defs.tcl: Added enhancements to Tk's fake version of
- tcltest required by recent cursor.test changes.
-
-2002-06-13 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/cursor.test (cursor-2.[34]): Tests added to ensure that
- cursor specs really are well-behaved lists. Also some general
- clean-up...
- * win/tkWinCursor.c (TkGetCursorByName): Undone Jeff's back-off
- and fixed things so that they should work now. Cursor specs are
- lists first and foremost.
-
-2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
-
- * changes: Clearly label wm transient changes as
- a POTENTIAL INCOMPATIBILITY.
- * doc/wm.n: Remove "some window managers will" text
- and explicitly state what behavior a transient
- window will display. Also mention that it is an
- error to make a window a transient of itself.
-
-2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
-
- * library/choosedir.tcl (tk::dialog::file::chooseDir):
- * library/clrpick.tcl (tk::dialog::file::chooseDir):
- * library/msgbox.tcl (tk::MessageBox):
- * library/tkfbox.tcl (tk::dialog::file):
- * library/xmfbox.tcl (tk::MotifFDialog): Remove the
- transient property on dialogs after they have been
- dismissed to insulate them from further state changes
- in the master. This keeps a withdrawn dialog from
- being mapped when the master is deiconified. [Tk patch 568278]
-
-2002-06-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinCursor.c (TkGetCursorByName): reverted fix from
- 2002-06-06 because it broke the ability to use built-in cursors
- like left_ptr.
-
-2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
-
- * library/choosedir.tcl (tk::dialog::file::chooseDir):
- * library/clrpick.tcl (tk::dialog::color):
- * library/dialog.tcl (tk_dialog):
- * library/msgbox.tcl (tk::MessageBox):
- * library/tkfbox.tcl (tk::dialog::file):
- * library/xmfbox.tcl (tk::MotifFDialog_Create):
- Only make the dialog window a transient if
- the master is visible. This check already
- appeared in some of the dialogs. This patch
- just copies the check into those that were
- lacking. [Tk patch 568253]
-
-2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
-
- * changes: Add note about new transient behavior.
- * tests/unixWm.test: Check that the WM_TRANSIENT_FOR
- property for a transient window is being cleared
- when the master is destroyed.
- * tests/wm.test: Source defs.tcl instead of using
- tcltest to match the rest of Tk's test files.
- Add new tests that ensure that a transient's state
- mirrors the state of the master.
- * unix/tkUnixWm.c (WmInfo, TkWmNewWindow, TkWmMapWindow,
- TkWmDeadWindow, Tk_WmCmd, WmWaitMapProc): Add numTransients
- member to WmInfo structure. Keep state of master and
- transient in sync using a callback that tracks MapNotify
- and UnmapNotify events. When the master is mapped, map
- the transient. When the master is unmapped or iconified,
- withdraw the transient.
- * win/tkWinWm.c (TkWmMapWindow, TkpWmSetState,
- TkWmDeadWindow, Tk_WmCmd, WmWaitVisibilityOrMapProc):
- Keep state of master and transient in sync using a
- callback that tracks MapNotify and UnmapNotify events.
- Move masterPtr check from TkpWmSetState into TkWmMapWindow
- to deal with WM_NEVER_MAPPED transients. Cleanup
- numTransients and the callback in TkWmDeadWindow.
- Cleanup numTransients and the callback only after
- deleting a master in wm transient command to avoid
- deleting the callback when an error is raised.
- Add support for MapNotify and UnmapNotify events
- to the master callback. [Tk patch 561708]
-
-2002-06-11 Joe English <jenglish@users.sf.net>
-
- * library/menu.tcl: fix for bug report #530212 "Bad Window Path
- Name in tkMenuFind"
-
-2002-06-10 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.vc: Fixed a win98 issue where the /exclude option
- for xcopy is unsupported.
- Reported by Roy Terry <royterry@earthlink.net>.
-
-2002-06-10 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
-
- * library/tk.tcl: added utility functions to get "-underline" and
- "-text" for labels and buttons from translatable string containing
- "magic ampersand" [patch #566605]
- * library/clrpick.tcl:
- * library/msgbox.tcl:
- * library/tkfbox.tcl:
- * library/xmfbox.tcl: some places where msgcat is used to get
- translated label are modified to handle labels with magic ampersand.
- * library/msgs/ru.msg: russian translations added
- * library/msgs/cs.msg:
- * library/msgs/de.msg:
- * library/msgs/el.msg:
- * library/msgs/es.msg:
- * library/msgs/fr.msg:
- * library/msgs/it.msg:
- * library/msgs/nl.msg: all translation files now have labels with
- 'magic ampersand' where appropriate. In el.msg some ampersands are
- missing, as I don't know which underline positions seems natural
- to "el" users.
-
-2002-06-09 Mo DeJong <mdejong@users.sourceforge.net>
-
- * library/bgerror.tcl (tk::dialog::error::bgerror):
- Don't set the bgerror dialog as a transient of
- itself since this operation is ill defined.
-
-2002-06-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * win/tkWinCursor.c (TkGetCursorByName): Fixed so that the reading
- of cursors from a file with a cursor spec was built using [list]
- works when the file has a space in instead of requiring fiddling
- with backslashes.
-
-2002-06-06 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
-
- * library/msgbox.tcl (MessageBox): Add -default normal
- when creating non-default buttons for message box.
- They already get -default normal when they're
- unfocused, and dialog window size used to change suddenly
- in such cases.
-
-2002-06-05 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
-
- * unix/tkUnixFont.c (Tk_DrawChars): Don't assume that
- one char is always one byte, and that required
- subfont for the last character in any string is
- the same as for the previous character
- [Bug #559435] [Patch #559437]
-
-2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
-
- * changes: Document [wm transient .t .t] error.
- * tests/wm.test: Check that setting a window
- as a transient of itself raises an error. Check
- that passing a non-toplevel window to the wm
- transient command uses the enclosing toplevel.
- * unix/tkUnixWm.c (Tk_WmCmd): Raise an error
- if the user tries to make a toplevel a
- transient of itself.
- * win/tkWinWm.c (Tk_WmCmd): Raise an error
- if the user tries to make a toplevel a
- transient of itself. Test for other error
- before checking for the transient self error.
-
-2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/tkUnixWm.c (WmInfo, TkWmCleanup, TkWmNewWindow,
- TkWmMapWindow, TkWmDeadWindow, Tk_WmCmd): Replace
- WmInfo's master and masterWindowName members with
- a masterPtr member. This implementation is much
- simpler and mirrors the Win32 implementation. This
- change makes it easy to check the flags of the
- master window. No user visible changes.
-
-2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
-
- * generic/tkInt.decls: Add unix decl for TkpWmSetState.
- * generic/tkIntPlatDecls.h: Regen.
- * generic/tkStubInit.c: Regen.
- * tests/wm.test: Test state changes between iconic,
- normal, and withdrawn both before and after initial
- mapping.
- * unix/tkUnixWm.c (Tk_WmCmd, TkpWmSetState): Move
- state change code into TkpWmSetState to more closely
- match the Win32 implementation. No user visible changes.
-
-2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/embed.test: Added cross platform embed tests.
- Check that window passed to -use has the -container
- option set.
- * tests/wm.test: Remove useless catch call. Deiconify
- . just in case, stackorder tests will not pass unless
- it is in the normal state. Add -container flag to
- embedded stackorder test.
- * unix/tkUnixEmbed.c (TkpUseWindow):
- * win/tkWinEmbed.c (TkpUseWindow): Lookup Tk window
- based on the id passed in as the value for -use.
- Generate an error if the Tk window did not have
- the -container option set.
-
-2002-05-26 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkButton.c (ConfigureButton): When creating
- a radiobutton with -value "" it was not drawn properly
- if the -variable was created by the radiobutton.
- [Bug #548765]
-
-2002-05-26 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkCanvText.c (ComputeTextBbox): Negative
- coordinates were rounded badly causing a 1 pixel
- displacement. [Bug #556526]
-
-2002-05-24 Mo DeJong <mdejong@users.sourceforge.net>
-
- * mac/tkMacWm.c (Tk_WmCmd):
- * tests/unixWm.test: Move wm transient checks over
- to wm.test so they will be run on all systems.
- * tests/wm.test: Add tests to check for error when
- an iconwindow is passed to the wm transient command.
- * unix/tkUnixWm.c (Tk_WmCmd):
- * win/tkWinWm.c (Tk_WmCmd): Raise an error if one
- of the windows passed to the wm transient command
- is an iconwindow for another toplevel.
-
-2002-05-23 Mo DeJong <mdejong@users.sourceforge.net>
-
- * mac/tkMacWm.c (TkWmStackorderToplevelWrapperMap):
- * tests/wm.test: Add embedded Window test case for
- the stackorder command.
- * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap):
- * win/tkWinWm.c (TkWmStackorderToplevelWrapperMap):
- Ignore embedded windows during wm stackorder command.
-
-2002-05-21 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/configure.in: Invoke SC_ENABLE_SHARED before
- calling SC_CONFIG_CFLAGS so that the SHARED_BUILD
- variable can be checked inside SC_CONFIG_CFLAGS.
- * unix/tcl.m4: Update from Tcl.
-
-2002-05-20 Don Porter <dgp@users.sourceforge.net>
-
- * library/tk.tcl: A little namespace cleanup on Daniel Steffen's
- latest revisions to avoid defining new global commands.
-
-2002-05-20 Daniel Steffen <das@users.sourceforge.net>
-
- * mac/tkMacInit.c:
- * mac/tkMacTclCode.r: include msgcat package in resources
- as bgerror depends on it. Restores ability of mac static
- build to run standalone (except for encoding file issues).
-
- * mac/tkMacInit.c:
- * library/console.tcl:
- * library/tk.tcl: fix tk.tcl not sourcing library files
- that define bindings at startup on mac. (independent of
- tk library files being in resources or on auto_path)
-
-2002-05-08 Don Porter <dgp@users.sourceforge.net>
-
- * library/bgerror.tcl:
- * library/tclIndex: Cleaned up namespace usage of the bgerror
- dialog. Completes soft dependence on msgcat. [FR 539309]
-
-2002-05-07 David Gravereaux <davygrvy@pobox.com>
- * win/makefile.vc: Problem with TCLDIR macro not accepting
- forward slash path seperators resolved. Added the same logic
- to INSTALLDIR, too. [Bug #553208]
-
-2002-04-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure:
- * unix/tcl.m4: change HP-11 SHLIB_LD_LIBS from "" to ${LIBS} so
- that the .sl knows its dependent libs.
-
-2002-04-24 Daniel Steffen <das@users.sourceforge.net>
-
- * mac/tkMacTclCode.r:
- * mac/tkMacResource.r: added check of
- TCLTK_NO_LIBRARY_TEXT_RESOURCES #define to allow disabling the
- inclusion of the tk library code in the resource fork of Tk
- executables and shared libraries.
- Moved tk library code inclusion to separate file like in tcl.
- Added 'panedwindow' resource.
-
-2002-04-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/button.tcl (ButtonLeave): corrected the 3
- implementations of ButtonLeave to check for Priv(relief) existing
- before trying to use it. [Patch #541849]
-
- * generic/tkTextDisp.c (DisplayLineBackground):
- * unix/tkUnix3d.c (Tk_3DHorizontalBevel):
- * unix/tkUnixFont.c (Tk_DrawChars): applied fixes to not overrun
- the X window 16-bit size limit. [Patch #541999] (bonfield)
-
-2002-04-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkTextDisp.c (GetXView, GetYView): Comparison with
- previous values of scrollbar range are now done in a way that is
- sensitive to the bizarreness of floating-point on architectures
- where IEEE-FP is not used on the processor. Also increased the
- size of the temporary buffer to take account of the fact that
- TCL_DOUBLE_SPACE is meant to only imply enough space to take a
- printed double and trailing '\0', and no more. [Bug #223739]
- (FP_EQUAL_SCALE): New macro to help compare floating-point numbers
- for equality in a sane way, used in GetXView and GetYView.
-
-2002-04-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkWindow.c (TkCloseDisplay): Added to centralize where a
- display was closed. This handles freeing memory associated with a
- display and closing it.
- (DeleteWindowsExitProc): actually close displays. This would also
- ideally be done in Tk_DestroyWindow when the last window on the
- display has been closed, but that still has unresolved order of
- cleanup problems.
- (Tk_DestroyWindow): added TkFocusFree call.
-
- * generic/tkStubInit.c:
- * generic/tkIntPlatDecls.h:
- * generic/tkIntDecls.h:
- * generic/tkInt.decls: added TkFocusFree, TkClipCleanup and
- TkGCCleanup generic private procs, and TkWmCleanup, TkSendCleanup
- and TkFreeXId unix private procs.
-
- * generic/tkInt.h:
- * unix/tkUnixXId.c (TkFreeXId): frees XID resources.
- Made idCleanupScheduled a Tcl_TimerToken (was int) in TkDisplay
- structure to allow us to delete the timer scheduled for it.
-
- * unix/tkUnixWm.c (TkWmStackorderToplevel): ensure children
- structure is freed.
- (ConfigureEvent, ComputeReparentGeometry): Add extra wm tracing info
- (TkWmRestackToplevel): initialize changes to 0 to prevent UMR.
- Use WaitForConfigureNotify on all windows. This part still
- requires fixing as it is the root of the 2 second raise delay on
- some window managers (those that use extra wrapper windows of
- their own).
-
- * unix/tkUnixSend.c (TkSendCleanup): free send-related resources
-
- * unix/tkUnixEvent.c (TkpCloseDisplay): call TkSendCleanup and
- TkWmCleanup.
-
- * unix/tkUnixSelect.c (SelRcvIncrProc): added missing Tcl_Release
- of interp
-
- * generic/tkGet.c (FreeUidThreadExitProc): free thread-specific
- resources on thread exit
-
- * generic/tkFocus.c (TkFocusFree): frees TkMainInfo data
- * generic/tkClipboard.c (TkClipCleanup): frees TkDisplay data
- * generic/tkGC.c (TkGCCleanup): frees TkDisplay data
-
- * unix/tkUnixFont.c (FontPkgCleanup): cleanup thread specific font
- resources on thread exit.
-
- * mac/tkMacXStubs.c (TkpOpenDisplay): memset the initial display
- structures to 0.
-
- * generic/tkOption.c (OptionThreadExitProc): freed tsd option
- stacks on thread exit.
- (Tk_GetOption): free mem used to get Tk_Uid
-
- * generic/tkMenu.c (ConfigureMenu): freed saved options in all
- error cases.
-
- * win/tkWinInt.h: declaration for TkWinGetUnicodeEncoding
- * win/tkWinDialog.c (GetFileNameW): use TkWinGetUnicodeEncoding
- * win/tkWinInit.c (TkpDisplayWarning): use TkWinGetUnicodeEncoding
- * win/tkWinFont.c: use TkWinGetUnicodeEncoding instead of static
- unicodeEncoding.
-
- * win/tkWinX.c (Tk_SetCaretPos): remove WM_IME_STARTCOMPOSITION
- and place the IME position within Tk_SetCaretPos. Cache results in
- Tk_SetCaretPos to reduce unnecessary repositioning. Also call
- DestroyCaret if we receive WM_KILLFOCUS.
- (TkpOpenDisplay): ZeroMemory the initial display structures.
- (TkWinGetUnicodeEncoding): Added so that Windows only needs to
- cache this value one, and then free it in TkWinXCleanup.
- (HandleIMEComposition): add support for Win98 and ATOK13
- IME. (yamamoto)
-
- * generic/tkConsole.c (ConsoleCmd): correct return that should
- have just set result code.
-
- * generic/tkImgPhoto.c: Added PhotoFormatThreadExitProc to clean
- up on thread exit. (Tk_PhotoPutBlock) slight code updates
-
- * generic/tkPanedWindow.c (DestroyPanedWindow, ConfigureSlaves):
- fix mem leaks in not freeing slave info
-
- * win/configure:
- * win/tcl.m4: Enabled COFF as well as CV style debug info with
- --enable-symbols to allow Dr. Watson users to see function info.
- More info on debugging levels can be obtained at:
- http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
-
-2002-04-10 Mo DeJong <mdejong@users.sourceforge.net>
-
- * doc/wm.n:
- * mac/tkMacWm.c:
- * tests/wm.test:
- * unix/tkUnixWm.c:
- * win/tkWinWm.c: Update wm stackorder usage message
- to make it clear that either 1 or 3 arguments are
- required. [Bug 540013]
-
-2002-04-08 Daniel Steffen <das@users.sourceforge.net>
-
- * mac/tkMacProjects.sea.hqx: added tkPanedWindow.c to projects
- * mac/tkMacAppInit.c: fixes to MSL stdin/stdout hookup to the
- TkConsole when using shared MSL libraries; fix for crashing
- bug on exit: writing to stdin/sterr when console has already
- been destroyed. (both fixes need support in MSL, see
- 'CW Pro6 changes' in tcl/mac/tcltkMacBuildSupport.sea.hqx)
- * mac/tkMacDialog.c: fixes to Navigation Services Dialog filter.
- * mac/tkMacDraw.c: add panic for overwide TkImages that would
- crash Tk on mac otherwise.
-
-2002-04-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- * mac/tkMacXStubs.c: added Tk_SetCaretPos stub (does nothing).
- * win/tkWinX.c: added Tk_SetCaretPos code to position IME windows
- correctly when WM_IME_STARTCOMPOSITION is received.
- * unix/tkUnixKey.c: added Tk_SetCaretPos and code for setting
- XIM caret in TkpGetString.
-
- * generic/tkStubInit.c:
- * generic/tkDecls.h:
- * generic/tk.decls: added Tk_SetCaretPos declaration. This command
- allows users to indicate the cursor position and is used by XIM
- (Unix) or IME (Windows) to place the caret box correctly. It is
- also part of correct Accessibility style on Windows to make the
- magnifier jump to the focus point.
-
- * win/tkWinButton.c (TkpDisplayButton):
- * generic/tkTextMark.c (TkTextInsertDisplayProc):
- * generic/tkCanvText.c (DisplayCanvText):
- * generic/tkEntry.c (DisplayEntry): added Tk_SetCaretPos calls
-
- * generic/tkInt.h: added TK_XIM_SPOT #define (default 1).
- Added XFontSet attribute to TkDisplay when TK_XIM_SPOT is true.
- * generic/tkEvent.c (Tk_HandleEvent): made sure inputContexts are
- not getting created on DestroyNotify events (for dead windows).
- Added over-the-spot support if TK_XIM_SPOT is defined (default).
- The is the nicer XIM behavior, but uses a bit more memory.
-
- * unix/tkUnixEvent.c:
- * generic/tkWindow.c: moved OpenIM over to tkUnixEvent.c.
- Removed setting inputContext to null in Tk_MakeWindowExist as it
- was redundant.
-
- * unix/tkUnixWm.c (CreateWrapper): Removed redundat setting of
- inputContext to null.
-
- * win/Makefile.in: changed gdb and shell targets to properly build
- all binaries before running (otherwise an error often occured).
-
-2002-03-28 David Gravereaux <davygrvy@pobox.com>
-
- * win/.cvsignore (new):
- * win/lamp.bmp (new):
- * win/makefile.vc:
- * win/nmakehlp.c (new):
- * win/rules.vc: Brought the makefile up-to-date with Tcl's one.
- This now has support for Win9x issues and the winhelp target now
- exists. Color scheme can be changed. I'm just imparting a first
- suggestion using orange :) I'll have to think about the install
- portion of the helpfile as I'll need to do some tricks to insert
- tk's contents file into Tcl's using some special winhlp32.exe
- switches. [Bug 533862 527941]
-
- * win/makefile.vc: Tk helpfile is now installing itself into Tcl's
- contents file as part of the install target and rebuilding the
- contents table as desired. [Bug 527941]
-
- * doc/console.n: Changed topic from "Tcl Built-In Commands" to
- "Tk Built-In Commands"
-
- * win/buildall.vc.bat: Update to match Tcl.
-
-2002-03-26 Andreas Kupries <andreask_kupries@users.sourceforge.net>
-
- * unix/tkUnixFont.c: Added inclusion of <arpa/inet.h>. This fixes
- a GCC/HPUX problem with missing a "htons". See also
- "tclUnixPort.h" for equivalent code.
-
-2002-03-21 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.vc: Changed optimize flag to -0ti instead of -02.
- [Bug 528441]
-
-2002-03-20 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkButton.c (ButtonTextVarProc,ButtonVarProc):
- * generic/tkCmds.c (WaitVariableProc):
- * generic/tkEntry.c (EntryTextVarProc):
- * generic/tkListbox.c (ListboxListVarProc):
- * generic/tkMenu.c (MenuVarProc):
- * generic/tkMenubutton.c (MenuButtonTextVarProc):
- * generic/tkMessage.c (MessageTextVarProc):
- * generic/tkScale.c (ScaleVarProc): Updates to handle change in
- type of part2 argument of Tcl_VarTraceProc typedef. [TIP 27]
- [Patch 532644].
-
-2002-03-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkOldConfig.c (Tk_ConfigureValue): prevent leaving
- interp->result as NULL.
-
-2002-03-07 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/text.tcl (TextPasteSelection): Renaming of TextPaste to
- prevent confusion with tk_textPaste. Stopped code from inserting
- selections twice, which seems to have happened with TIP#26, and
- reorganized code to reduce amount of stuff protected by catch
- which is tricky to maintain.
- (tk_textPaste): Reduce amount of code protected by catch.
-
-2002-03-06 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinX.c: Define _WIN32_IE as 0x0300
- before including commctrl.h so that we can
- access the InitCommonControlsEx API when
- building Tk with mingw.
-
-2002-03-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * README, generic/tk.h, unix/configure.in, unix/tk.spec:
- * win/configure.in: Bumped patchlevel; this might need to change
- in the future, but it will help us distinguish between the CVS
- version and the most recent released version.
-
-2002-03-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.4a4 TAGGED FOR RELEASE ***
-
- * unix/README: updated --* options docs.
-
- * unix/tk.spec: fixed URL refs to use www.tcl.tk or SF.
-
-2002-03-04 Jeff Hobbs <jeffh@ActiveState.com>
-
- * README:
- * mac/README:
- * unix/README:
- * win/README: updated to use www.tcl.tk URL.
-
-2002-03-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/entry.tcl: added catch around Triple-1 binding use of
- sel.last
-
-2002-02-28 Don Porter <dgp@users.sourceforge.net>
-
- * library/console.tcl (ConsoleBind): Corrected console <<Paste>>
- binding on Unix platforms.
-
-2002-02-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
- * generic/tkWindow.c (Tk_MainWindow, Tk_GetNumMainWindows):
- protect against being called before Tcl stubs are init'ed.
- [Bug #220916] (porter)
-
-2002-02-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkText.c (ConfigureText): reenable the blinking cursor
- on state change where necessary. [Bug #503772]
-
- * tests/listbox.test:
- * generic/tkListbox.c: corrected error handling when setting to an
- invalid listvar value. [Bug #503613]
-
- * library/scale.tcl: mirror B2 bindings to B3 on Windows to better
- accomodate two button mice. [Patch #493145]
-
- * library/panedwindow.tcl: improved proxy sash handling. (boudaillier)
-
-2002-02-25 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/filebox.test: Reorganised and fixed so that tests are
- executed fewer times (!) and the automatic extension adding
- behaviour of tk_getSaveFile is tested.
-
-2002-02-23 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
-2002-02-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkPanedWindow.c (PanedWindowWidgetObjCmd): fixed returns
- that should have been breaks instead. Corrected .pw configure
- handling for insufficient args. [Patch #521436] (boudaillier)
-
- * mac/tkMacDefault.h:
- * unix/tkUnixDefault.h:
- * win/tkWinDefault.h: changed panedwindow default relief to flat,
- a more natural outer relief.
-
- * library/panedwindow.tcl (ReleaseSash): changed to not pass x and
- y args at all (they aren't used).
- Added proc comments. Made configuring sash cursor more efficient.
- Added Cursor timer that restores the default cursor when pointer
- is no longer over the sash. This is necessary because Leave
- events won't be seen when moving into a paned child.
-
-2002-02-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/widget: New section "Paned Windows"
- * library/demos/paned2.tcl, library/demos/paned1.tcl: New files.
-
- * library/panedwindow.tcl (ReleaseSash): Added missing arguments.
- * library/tk.tcl: Bindings for paned window were not being loaded
- by default.
-
- * unix/tkUnixMenu.c (GetMenuLabelGeometry,DrawMenuEntryLabel):
- Stop meaningless GCC warnings.
-
-2002-02-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/panedwindow.n (new):
- * generic/tkPanedWindow.c (new):
- * generic/tkInt.h:
- * generic/tkWindow.c:
- * library/panedwindow.tcl (new):
- * mac/tkMacDefault.h:
- * tests/panedwindow.test (new):
- * unix/Makefile.in:
- * unix/tkUnixDefault.h:
- * win/Makefile.in:
- * win/makefile.vc:
- * win/tkWinDefault.h: added implementation of TIP #41, panedwindow
- widget. [Patch #512503] (melski)
-
- * generic/tkOption.c (ReadOptionFile): fixed Tcl_Seek casting to
- remove warnings (we expect no option files with be > 2GB).
-
- * unix/configure: regenerated
- * unix/tcl.m4: updated to sync with Tcl's tcl.m4
- Added --enable-64bit support for AIX-4 using IBM's xlc (-q64 flag).
-
-2002-02-19 Don Porter <dgp@users.sourceforge.net>
-
- * changes: First draft of updated changes for 8.4a4 release.
-
-2002-02-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkImgPhoto.c (MatchFileFormat): Tcl_Seek takes
- Tcl_WideInt offset (three places.)
- * generic/tkImgPPM.c (FileReadPPM): Tcl_Seek takes Tcl_WideInt offset.
- * generic/tkFrame.c (ConfigureFrame): Stop GCC warning.
-
- * generic/tkImgGIF.c: Made file meet the formatting rules from the
- Tcl Engineering Manual better; mostly differences in whitespace.
-
-2002-02-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure: regen'd
- * unix/tcl.m4:
- * unix/configure.in: added macros and calls to SC_TCL_EARLY_FLAGS
- and SC_TCL_64BIT_FLAGS, part of TIP #72.
-
-2002-02-14 Mo DeJong <mdejong@users.sourceforge.net>
-
- * library/entry.tcl:
- * library/text.tcl: Adjust <Double-1> and <Triple-1> bindings
- so that no anchor point is set and the insertion cursor is
- set to the last character in the selection. [Bug 220943]
- * tests/event.test: Add test cases for double click and
- drag as well as triple click and drag in the text and
- entry widgets.
-
-2002-02-14 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/event.test (_text_ind_to_x_y, _get_selection): Fix
- incorrect use of results from bbox invocation so that
- y center point for a give index is calculated correctly.
- Add new method to return the selection and use it in
- test cases. Always lappend to the result list to avoid
- case where initial result includes a space.
-
-2002-02-07 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkMain.c:
- * mac/tkMacInit.c:
- * mac/tkMacKeyboard.c:
- * win/tkWinDialog.c:
- * win/tkWinTest.c: modified some callers of Tcl routines that
- were restored to return (char *) pointing into Tcl_DStrings.
+ * unix/configure: autoconf-2.59
-2002-02-03 eric melski <ericm@interwoven.com>
+2005-04-22 George Peter Staplin <GeorgePS@XMission.com>
- * generic/tkImage.c (Tk_ImageObjCmd): Clean up bogus for loop in
- [image inuse] subcommand [Bug #485803].
+ * doc/FontId.3: I fixed a typo. "linespace" was used instead of
+ "ascent". I also added a .PP before the paragraph to make the
+ formatting look better for the ascent paragraph.
-2002-02-01 Jeff Hobbs <jeffh@ActiveState.com>
+2003-04-18 Joe English <jenglish@users.sourceforge.net>
- * generic/tkCmds.c (Tk_TkObjCmd): don't use 'bool' as an arg as it
- conflicts with the C99 spec. [Bug #511956] (ingham)
+ * unix/tkUnixRFont.c(Tk_MeasureChars): Use Tcl_UtfToUnichar() for lax
+ UTF-8 parsing instead of strict parsing with FcUtf8ToUcs4()
+ [fix/workaround for Bug 1185640]
-2002-02-01 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.vc: unset macro located in the tktest target
- caused a failure to build. [Bug 511652]
-
-2002-01-30 Don Porter <dgp@users.sourceforge.net>
-
- * win/stubs.c (XSetCommand): Overlooked CONSTification.
-
-2002-02-01 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/photo.n: Documented transparency subcommand.
- * tests/imgPhoto.test (imgPhoto-4.40...imgPhoto-4.68): Tests for
- the transparency subcommand.
- * generic/tkImgPhoto.c (ImgPhotoCmd): Added transparency
- subcommand (see TIP #14.)
-
-2002-01-31 Todd Helfter <tmh@users.sourceforge.net>
- * generic/tkMenu.c (ConfigureMenuCloneEntries)
- * tests/menu.test (menu3.68)
- Correct and test for logic error when cloning menus. [Bug #508988]
-
-2002-01-30 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tk.decls: The POTENTIAL INCOMPATIBILITY in the changing
- interface of Tk_ParseArgv can now be removed by the -DUSE_NON_CONST
- compiler flag.
- * generic/tkDecls.h: make genstubs
-
-2002-01-29 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-
- * win/tkWinInit.c (TkpGetAppName): TIP 27 fixup. The code now does
- not write into the CONST path returned by "argv0" and
- Tcl_SplitPath anymore.
-
-2002-01-28 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/configure.in: Don't set TCL_LIB_SPEC and
- TCL_STUB_LIB_SPEC variables since this breaks
- the AIX build. This was used in the past to
- support linking with Tcl from the build dir
- or the install dir, but it is no longer needed.
-
-2002-01-28 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in: Remove commented out vars.
- * unix/configure: Regen.
- * unix/configure.in: Don't subst vars that are already
- taken care of in SC_LOAD_TCLCONFIG.
- * unix/tcl.m4: Update from Tcl.
- * win/configure: Regen.
- * win/tcl.m4: Update from Tcl.
-
-2001-01-27 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkFileFilter.c:
- * mac/tkMacInit.c:
- * mac/tkMacKeyboard.c:
- * mac/tkMacMenus.c: TIP 27 CONSTification induced changes
-
-2002-01-25 Don Porter <dgp@users.sourceforge.net>
-
- * All changes below are Patch 505159
-
- * doc/AddOption.3:
- * doc/CanvTkWin.3:
- * doc/GetPixels.3:
- * doc/Name.3:
- * doc/ParseArgv.3:
- * generic/tk.decls (Tk_AddOption,Tk_CanvasGetCoord,Tk_GetPixels,
- Tk_GetScreenMM,Tk_NameToWindow,Tk_ParseArgv):
- * generic/tkArgv.c (Tk_ParseArgv):
- * generic/tkCanvLine.c (ParseArrowShape):
- * generic/tkCanvUtil.c (Tk_CanvasGetCoord,Tk_CanvasTagsParseProc,
- Tk_CanvasTagsPrintProc,Tk_GetDash):
- * generic/tkCanvas.c (ConfigureCanvas):
- * generic/tkGet.c (Tk_GetPixels,Tk_GetScreenMM):
- * generic/tkImgPhoto.c (ImgPhotoCmd):
- * generic/tkMain.c (Tk_MainEx):
- * generic/tkOldConfig.c (FormatConfigInfo):
- * generic/tkOption.c (Tk_AddOption):
- * generic/tkText.c (TextWidgetCmd,TkTextGetTabs,DumpSegment):
- * generic/tkText.h (TkTextCreateTag):
- * generic/tkTextTag.c (TkTextCreateTag):
- * generic/tkWindow.c (Tk_NameToWindow,Initialize):
- * mac/tkMacCursor.c (FindCursorByName,TkGetCursorByName):
- * mac/tkMacWm.c (Tk_WmCmd):
- * unix/tkUnixCursor.c (TkGetCursorByName):
- * unix/tkUnixSend.c (ValidateName):
- * unix/tkUnixWm.c (Tk_WmCmd):
- * win/tkWinCursor.c (TkGetCursorByName):
- * win/tkWinWm.c (Tk_WmCmd): Updated callers of Tcl_SplitList and
- Tcl_Merge.
- * generic/tkDecls.h: make genstubs
- ***POTENTIAL INCOMPATIBILITY***
- Includes a source incompatibility in the argv argument of Tcl_ParseArgv.
-
- * generic/tkBind.c (DeleteVirtualEvent):
- * generic/tkCanvas.c (ScrollFractions, CanvasWidgetCmd,
- CanvasUpdateScrollbars):
- * generic/tkTestTag.c (TkTextTagCmd): Updated callers of
- Tcl_GetStringResult. Rewrote PrintScrollFractions to
- ScrollFractions to stop scribbling directly on interp->result.
-
- * generic/tkInt.decls (TkGetDefaultScreenName, TkpDisplayWarning,
- TkpOpenDisplay):
- * generic/tkCanvPs.c (Tk_PostscriptColor, Tk_PostscriptFont):
- * generic/tkEntry.c (EntrySetValue, EntryValidateChange, ExpandPercents,
- EntryValueChanged, Tk_EntryObjCmd, DestroyEntry, ConfigureEntry,
- EntryComputeGeometry, InsertChars, DeleteChars, EntryFetchSelection,
- EntryTextVarProc, Tk_SpinBoxObjCmd, SpinboxWidgetObjCmd):
- * generic/tkMain.c (Prompt):
- * generic/tkMenu.c (MenuVarProc):
- * generic/tkMenubutton.c (ConfigureMenuButton, MenuButtonTextVarProc):
- * generic/tkMessage.c (ConfigureMessage, MessageTextVarProc):
- * generic/tkWindow.c (GetScreen, Initialize):
- * mac/tkMacInit.c (TkpInit, TkpDisplayWarning):
- * mac/tkMacXStubs.c (TkGetDefaultScreenName, TkpOpenDisplay):
- * unix/tkUnix.c (TkGetDefaultScreenName):
- * unix/tkUnixEvent.c (TkpOpenDisplay):
- * unix/tkUnixInit.c (TkpGetAppName, TkpDisplayWarning):
- * unix/tkUnixSend.c (SendEventProc):
- * win/tkWinInit.c (TkpGetAppName, TkpDisplayWarning):
- * win/tkWinX.c (TkGetDefaultScreenName,TkpOpenDisplay): Updated
- callers of Tcl_GetVar, Tcl_GetVar2
- * generic/tkIntDecls.h: make genstubs
-
- * generic/tkCanvPs.c (TkCanvPostscriptCmd):
- * generic/tkImgBmap.c (TkGetBitmapData):
- * generic/tkOption.c (ReadOptionFile):
- * mac/tkMacInit.c (TkpInit, TkpGetAppName):
- * win/tkWinInit.c (TkpGetAppName): Updated callers of
- Tcl_SplitPath, Tcl_JoinPath, and Tcl_TranslateFileName.
-
-2002-01-18 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/wm.test: Rewrite stackorder tests that
- deal with toplevels that have the overrideredirect
- flag set. [Tk bug 492259]
-
-2002-01-18 Don Porter <dgp@users.sourceforge.net>
-
- * win/tkWinDialog.c: Overlooked Tcl_GetIndexFromObj callers.
-
-2001-01-18 Daniel Steffen <das@users.sourceforge.net>
-
- * mac/tkMacDialog.c:
- * mac/tkMacSend.c: TIP 27 CONSTification broke the mac
- build in a few places.
-
-2002-01-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkListbox.c (ChangeListboxOffset): improved tracking
- when scrolling on x axis with entry/text. [Bug #225025] (voskuil)
-
-2002-01-16 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tk3d.c (Tk_GetReliefFromObj):
- * generic/tkBind.c (Tk_EventObjCmd,HandleEventGenerate):
- * generic/tkButton.c (ButtonWidgetObjCmd):
- * generic/tkCanvas.c (CanvasWidgetCmd,FindItems):
- * generic/tkClipboard.c (Tk_ClipboardObjCmd):
- * generic/tkCmds.c (Tk_BellObjCmd, Tk_TkObjCmd, Tk_TkwaitObjCmd,
- Tk_UpdateObjCmd, Tk_WinfoObjCmd, Tk_WmObjCmd):
- * generic/tkConfig.c (DoObjConfig):
- * generic/tkEntry.c (EntryWidgetObjCmd, SpinboxWidgetObjCmd):
- * generic/tkFocus.c (Tk_FocusObjCmd):
- * generic/tkFont.c (Tk_FocusObjCmd, ConfigAttributesObj):
- * generic/tkFrame.c (Tk_FrameObjCmd):
- * generic/tkGet.c (Tk_GetAnchorFromObj, Tk_GetJustifyFromObj):
- * generic/tkGrab.c (Tk_GrabObjCmd):
- * generic/tkGrid.c (Tk_GridObjCmd,GridRowColumnConfigureCommand,
- GridSlavesCommand, ConfigureSlaves):
- * generic/tkImage.c (Tk_ImageObjCmd):
- * generic/tkImgBmap.c (ImgBmapCmd):
- * generic/tkImgGIF.c (FileReadGIF):
- * generic/tkImgPhoto.c (ImgPhotoCmd):
- * generic/tkListbox.c (ListboxWidgetObjCmd, ListboxSelectionSubCmd,
- GetListboxIndex):
- * generic/tkMenu.c (MenuWidgetObjCmd, MenuAddOrInsert, MenuCmd,
- ConfigureMenu, CloneMenu):
- * generic/tkMenubutton.c (MenuButtonWidgetObjCmd):
- * generic/tkMessage.c (MessageWidgetObjCmd):
- * generic/tkOption.c (Tk_OptionObjCmd):
- * generic/tkPack.c (Tk_PackObjCmd, ConfigureSlaves):
- * generic/tkPlace.c (Tk_PlaceObjCmd):
- * generic/tkScale.c (ScaleWidgetObjCmd):
- * generic/tkSelect.c (Tk_SelectionObjCmd):
- * generic/tkSquare.c (SquareWidgetObjCmd):
- * generic/tkTest.c (TestobjconfigObjCmd, TrivialConfigObjCmd,
- TestfontObjCmd): Updates to handle change in type of tablePtr
- argument of Tcl_GetIndexFromObj(Struct) from (char **) to
- (CONST char **). [TIP 27] [Patch 504705]
-
- * generic/tkCanvText.c (GetSelText):
- * generic/tkEntry.c (Entry{FetchSelection,Setvalue},ExpandPercents):
- * generic/tkSelect.c (HandleTclCommand):
- * generic/tkText.c (TextSearchCmd):
- * generic/tkTextIndex.c (TkTextMakeByteIndex, TkTextIndexBackChars):
- * mac/tkMacFont.c (Tk_MeasureChars, BreakLine):
- * unix/tkUnixMenu.c (DrawMenuUnderline):
- * win/tkWinMenu.c (GetEntryText, DrawMenuUnderline): Updated
- callers of Tcl_Utf* and Tcl_Regexp* APIs to reflect TIP 27 API
- changes (see Tcl Patch 471509). [Patch 471513]
-
-2002-01-16 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
- * win/configure: Regen.
- * win/tcl.m4: Update from Tcl.
-
-2002-01-04 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkMain.c (Tk_MainEx): Updated callers of CONSTified
- Tcl interfaces Tcl_EvalFile and TclGetStartupScriptFileName.
-
- * generic/tkConsole.c (ConsoleOutputProc, TkConsolePrint):
- * generic/tkInt.h (TkConsolePrint):
- * mac/tkMacAppInit.c (TkConsolePrint): Updated Tk's console to
- CONSTified channel driver interface. [Tcl Patch 503565, Tk Patch
- 503983]
-
-2002-01-11 Mo DeJong <mdejong@users.sourceforge.net>
-
- Use ${libdir} instead of ${exec_prefix}/lib. [Tcl bug 489370]
-
- * unix/configure: Regen.
- * unix/configure.in: Define and use libdir.
- * win/configure: Regen.
- * win/configure.in: Define libdir.
-
-2002-01-11 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in: Burn Tcl and Tk build
- directories into tktest executable to avoid crashes
- caused by ld loading a previously installed version
- of the tcl or tk shared libraries. Remove setting
- of LD_LIBRARY_PATH, LIBPATH, and SHLIB_PATH
- before running tktest since it should no
- longer be required.
-
-2002-01-11 Mo DeJong <mdejong@users.sourceforge.net>
-
- Enable use of Tcl stubs when building Tk as
- a shared library. This should fix the build
- under AIX. [Bugs 220858, 220955, 220921]
-
- * unix/Makefile.in: Add TCL_STUB_LIB_SPEC and
- TCL_STUB_LIB_FLAG variables.
- * unix/configure: Regen.
- * unix/configure.in: Pass TCL_STUB_LIB_SPEC into
- Makefile and use it when linking the tk shared library.
- Define USE_TCL_STUBS when building shared. Subst
- TCL_STUB_LIB_SPEC and TCL_STUB_LIB_FLAG.
+2003-04-18 Vince Darley <vincentdarley@users.sourceforge.net>
-2002-01-08 D. Richard Hipp <drh@hwaci.com>
+ * library/text.tcl
+ * doc/text.n: corrected 'Home' and 'End' and Control-a/e handling to
+ work with display lines. This was an ommission of the previous tip155
+ patch. Clarified the documentation on this point.
- * win/tkWinMenu.c: Fix the following bug: If you select an entry
- on a cascade menu then the next time the parent menu is posted, the
- cascade entry was active. Also, if you traverse to a disabled entry
- using keystrokes and press ENTER on the disabled entry, then that
- entry appears active the next time the menu is posted. The same
- patch fixes both problems.
+2005-04-14 Jeff Hobbs <jeffh@ActiveState.com>
-2002-01-04 Don Porter <dgp@users.sourceforge.net>
+ * unix/tkUnixFont.c (FontMapLoadPage): reorder char[] decls to avoid
+ possible segv. Minimal fix for [Bug 1122671]
- * generic/tkBind.c (TkBindFree):
- * generic/tkGrid.c (ResolveConstraints,CheckSlotData,DestroyGrid):
- * generic/tkSelect.c (Tk_DeleteSelHandler,TkSelDeadWindow): Replaced
- Tcl_Free calls with ckfree so that memory debugging is fully supported.
-
-2001-12-28 Jeff Hobbs <jeffh@ActiveState.com>
-
- * test/winButton.test:
- * win/tkWinButton.c: added updated patch #463234 which returns the
- default sizing behavior (not so native), but enables native L&F
- with negative sizing (-11 for example).
-
- * library/text.tcl (tk::TextButton1): made text receive focus even
- in disabled state for Windows to show selection and allow
- mouse-wheel scrolling.
-
- * win/tkWinInit.c (TkpDisplayWarning): added Tcl_DStringFree's
-
- * win/tkWinInt.h:
- * win/tkWinX.c: added TkWinProcs that represent a function table
- to switch between unicode and ansi procs on Windows. This is
- analogous to the TclWinProcs. Using Tcl_WinUtfToTChar, we can
- easily take advantage of using unicode functions where available
- without having to switch on the platform id each time.
-
- * win/tkWinWm.c (InitWindowClass): corrected init routines to
- allow unicode in window titles on Windows (for Win2K/XP).
- (TkWmStackorderToplevel): Corrected casts to enable debug compile
-
- * win/configure: regen'ed
- * win/tcl.m4: added shell32.lib to link libs, as these are
- necessary for new directory chooser (when enabled).
-
- * win/tkWinDialog.c (Tk_MessageBoxObjCmd): use MessageBoxW for
- proper display of unicode errors.
- Added patch which uses new OLE based directory chooser. This
- still has some issues, so is disabled by default. [Patch #468139]
- (ColorDlgHookProc) Corrected ability to use unicode chars in
- tk_chooseColor -title.
-
-2001-12-27 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinInit.c (TkpDisplayWarning): Use MessageBoxW in case the
- error displayed has unicode chars. [Bug #485986]
-
-2001-12-27 Daniel Steffen <das@users.sourceforge.net>
-
- * mac/tkMacInit.c:
- * mac/tkMacResource.r: synced up tkInit features to unix/win:
- use existing tkInit proc if defined. Added spinbox.tcl resource.
- Used TclGetEnv() instead of Tcl_GetVar2(interp, env)
- * mac/tkMacApplication.r:
- * mac/tkMacLibrary.r: minor version resources cleanup
-
-2001-12-27 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkButton.c (ButtonTextVarProc): guard against being
- called while the *button/label is being deleted. [Bug #490051]
-
- * library/entry.tcl:
- * library/spinbox.tcl:
- * library/text.tcl: added extra checks against bug #220269 and
- made spinbox reuse more of the entry procedure code.
-
-2001-12-20 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
-2001-12-19 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
-2001-12-18 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure: Regen.
- * unix/configure.in: Move EXP file changes over from
- Tcl configure script to fix AIX build with gcc. [Bug 220955]
-
-2001-12-18 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in:
- * win/Makefile.in: Use $(MAKE) instead of make
- in the tcltest rule.
-
-2001-12-18 Don Porter <dgp@users.sourceforge.net>
-
- * tests/event.test (event-click-drag-1.2): Corrected test that
- failed on Solaris/CDE due to text scrolling. [Bug 413735]
-
-2001-12-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/spinbox.tcl (ButtonDown): added catch to ignore
- possible error in after cancel when Priv(afterId) isn't defined.
-
- * doc/spinbox.n: corrected spin(up|down) -> button(up|down)
-
-2001-12-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/getOpenFile.n: Documented change.
- * library/tkfbox.tcl (SetFilter): Added code to guess the correct
- default extension from whatever value was selected in the
- filetypes option menu. Adapted from code by Chris Nelson
- submitted in Patch #492220.
-
-2001-12-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap): added static
-
-2001-12-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkText.c:
- * generic/tkText.h: changed TkTextEditType enums to be prefaced
- with TK_EDIT_ to prevent name collision.
-
-2001-12-05 Daniel Steffen <das@users.sourceforge.net>
-
- * mac/tkMacWm.c: mac implementation of wm stackorder
- (patch 481148, TIP 74)
-
-2001-12-03 Mo DeJong <mdejong@users.sourceforge.net>
-
- Add TK patch 481148 to implement TIP 74, the
- wm stackorder command.
-
- * doc/winfo.n: Update documentation for the winfo
- children command to indicate that top-level windows
- are not returned in stacking order.
- * doc/wm.n: Add documentation for wm stackorder.
- * generic/tkInt.decls (TkWmStackorderToplevel):
- Add decl for new function.
- * generic/tkIntDecls.h: Regen.
- * generic/tkStubInit.c: Regen.
- * tests/unixWm.test: Add stackorder command to test
- for wm command usage message.
- * tests/wm.test: Add new set of tests for generic
- window manager methods.
- * unix/tkUnixWm.c (Tk_WmCmd,
- TkWmStackorderToplevelWrapperMap,
- TkWmStackorderToplevel): Add unix implementation of
- new wm stackorder command.
- * win/tkWinWm.c (Tk_WmCmd,
- TkWmStackorderToplevelEnumProc,
- TkWmStackorderToplevelWrapperMap,
- TkWmStackorderToplevel): Add windows implementation
- of new wm stackorder command.
-
-2001-12-03 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.vc: install target changes by request from
- Ryan Casey <scfiead@hotmail.com>.
-
-2001-11-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/widget: Further overhauling; shrank fonts, made
- better use of fonts, added an icon, fixed the About box. Prompted
- by Bug #487442 from Vincent Wartelle.
-
-2001-11-29 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/palette.tcl (tk_setPalette): Added heuristic to guess
- from the background whether to use black or white for the
- foreground when not told specifically. Suggested by Chris Nelson,
- this makes the command fit the documentation better!
-
-2001-11-27 David Gravereaux <davygrvy@pobox.com>
-
- * win/makefile.vc: Fixed CAT32 target. cat.c is located in the Tcl
- source, not the Tk source.
-
-2001-11-27 D. Richard Hipp <drh@hwaci.com>
-
- * library/menu.tcl: Do not allow keyboard traversal of torn-off
- menus to visit the (invisible) tearoff bar.
-
-2001-11-26 D. Richard Hipp <drh@hwaci.com>
-
- * win/tkWinMenu.c: disabled menu items show the activebackground
- color in their background. This change makes menu behavior
- consistent with what native windows does.
-
-2001-11-24 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in: Add comments to better describe
- TCL_EXE and when it should be available. Add
- rule that prints message about running `make genstubs`
- when tkStubInit.c is out of date.
- * win/Makefile.in: Add TCL_TOOL_DIR and TCL_EXE
- variables to better match the Tcl Makefile. Add
- genstubs rule so tkSTubInit.c can be regenerated.
-
-2001-11-24 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/configure: Regen.
- * win/configure.in: Don't AC_SUBST CFLAGS_DEBUG, CFLAGS_OPTIMIZE,
- or CFLAGS_WARNING since it is now done in SC_CONFIG_CFLAGS.
- * win/tcl.m4 (SC_CONFIG_CFLAGS): AC_SUBST DL_LIBS, CFLAGS_DEBUG,
- CFLAGS_OPTIMIZE, and CFLAGS_WARNING.
-
-2001-11-23 Daniel Steffen <das@users.sourceforge.net>
-
- Up-port to 8.4 of mac code changes for 8.3.3 & various new
- changes for 8.4, some already backported to 8.3.4 (patch #435660)
-
- * library/tk.tcl: added <Key-F1> binding for <<Undo>> on the mac (TIP26)
-
- * library/button.tcl: fixed undefined $Priv(repeated) error for button
- without -repeatdelay support
-
- * generic/tkConsole.c:
- * library/console.tcl:
- * mac/tkMacInit.c:
- * mac/tkMacResource.r: corrected how mac deals with tcl library
- files present both in resources and in $tk_library directory.
-
- * generic/tkConsole.c: crashing bug fix when printing to console
- at program exit after the console has already been closed.
- Now setting gStdoutInterp=NULL in ConsoleClose().
-
- * mac/tkMacInit.c: correct use of Tcl_JoinPath in tk_library
- initialization
-
- * mac/tkMacMenu.c: special MDEF_PROC_OFFSET only needed for
- exactly one specific version of the MWERKS 68k compiler .
-
- * mac/tkMacShLib.exp: removed file
-
- * unix/Makefile.in: removed reference to .exp files
-
- * mac/MWTkBuildLibHeader.h:
- * mac/MW_TkBuildLibHeader.pch:
- * mac/MW_TkHeaderCommon.h:
- * mac/MW_TkOldImgStaticHeader.h:
- * mac/MW_TkStaticHeader.h:
- * mac/MW_TkStaticHeader.pch: new precompiled header files
-
- * mac/MW_TkHeader.pch:
- * mac/MW_TkOldImgHeader.h:
- * mac/MW_TkTestHeader.pch: revised precompiled header handling: now
- include a common header file 'MW_TkHeaderCommon.h' from all .pch files,
- the .pch files themselves now only setup #defines (e.g. BUILD_tk,
- STATIC_BUILD, TCL_DEBUG, TCL_THREADS) like in makefiles on other
- platforms.
-
- * mac/tkMac.h:
- * mac/tkMacPort.h:
- * mac/tkMacInt.h: use of BUILD_tk and TCL_STORAGE_CLASS like on other
- platforms, standardize #include'd files to what's done on other
- platforms, removed use of #pragma export, changed extern to EXTERN
- where appropriate to enable DLL export via the TCL_STORAGE_CLASS
- mechanism.
-
- * mac/tkMacAppearanceStubs.c: removed use of #pragma export
-
- * mac/widget.r: new resource file for 'Widget Demos'
-
- * mac/tkMacProjects.sea.hqx: updated mac build project files:
- build support for CodeWarrior Pro6, UnivIntf 3.4 & shared runtime
- libraries (see Tcl ChangeLog for details).
- changed weak linking so that CFM68k binaries now work on all OS
- versions from the free 7.5.5 onwards, with or without AppearanceMgr
- and/or NavigationMgr installed.
- added target to automatically build 'Widget Demos'
- included XML versions of the projects for CW Pro5 or Pro7 users.
- use compat/strtod.c instead of MSL's strtod()
-
- * generic/tkInt.decls:
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkStubInit.c:
+2005-04-12 Jeff Hobbs <jeffh@ActiveState.com>
- * mac/tkMacInt.h: MAC_TCL tk stub support was badly broken due to
- multiply defined (mac specific) names in tk.decls and tkInt.decls,
- removed the duplicates from the internal unsupported interfaces
- "interface tkInt" and "interface tkIntPlat"; moved declaration of
- TkpIsWindowFloating from tkMacInt.h to tkInt.decls: interface tkIntPlat.
- - these changes to the stub tables might require you to recompile your
- Tk extensions if they turn out to reference one of the removed routines
- in the wrong table (should be unlikely).
-
- * generic/tkMain.c: MAC_TCL: workaround for broken/non-standard isatty
- on MW Pro6, #include <unistd.h> instead of defining isatty
-
- * generic/tkPointer.c: MAC_TCL: #include tkMacInt.h
-
- * generic/tkStubLib.c: MAC_TCL: removed obsolete special casing of mac
- headers, standardize #include'd files to what's done on other platforms
-
- * mac/tclets.r:
- * mac/tkMacWindowMgr.c:
- * mac/tkMacScrlbr.c:
- * mac/tkMacMenu.c:
- * mac/tkMacMenus.c:
- * mac/tkMacFont.c:
- * mac/tkMacDialog.c:
- * mac/tkMacButton.c: renamed obsolete apple API names to modern
- equivalents; UH3.4 support: added #include <ControlDefinitions.h>;
- fixed munged non-ASCII chars in sources due to bungled latin1<->mac
- roman encoding in CVS repository.
-
- * mac/tkMacDialog.c: added support for -filetypes option (fix for bug
- tcl #221636); added update event handling for background windows while
- in a NavigationMgr dialog; fixed nasty bug when calling CustomGetFile
- (missing addr operator) (fix for bug tk #220911 & tcl #219367); renamed
- routines conflicting with standard MoreFiles headers (see Tcl ChangeLog
- for details)
-
- * mac/tkMacApplication.r:
- * mac/tkMacLibrary.r:
- * mac/tkMacResource.r: fixed obsolete copyrights/dates in version
- strings, updated version strings to standard usage, added support for
- '(Support Libraries)' subfolder for shared runtime libraries in
- unmerged binaries, commented out demo setting of "Tcl Environment
- Variables"; reorganized resources among these files to avoid
- multiple copies in applications and shared libraries, the script
- libraries/Xcursors etc are now no longer duplicated in Wish but are
- only included in the resources of Tk.shlb.
-
- * mac/tkMacMenu.c:
- * mac/tkMacMDEF.r: changes to support MW Pro 6 68k (vers 0x2400 only)
- compiler producing different offset to start of MDEF; fix to static 68k
- presence testing when calling the custom MDEF
-
- * mac/tkMacWm.c.c:
- * mac/tkMacWindowMgr.c: added/fixed AppearanceMgr checks; override
- AppearanceMgr version detection on static 68k to ensure static 68k Wish
- runs on PPCs with recent AppearanceMgr
-
- * mac/tkMacButton.c: fixed misplaced/missing variable initialization.
-
-2001-11-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkText.c (TextGetText): reworked to use DString for
- improved speed. (callewaert, darley)
- (DestroyText): plugged mem leak when not clearing stack (callewaert)
- (TextGetText): more efficient string size calculation (darley)
-
-2001-11-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/entry3.tcl: New demo showing off validation and
- password entry.
-
- * library/demos/widget: Some reorganization to make the code
- simpler, plus a new entry demo.
-
-2001-11-17 Jeff Hobbs <jeffh@ActiveState.com>
+ * library/tkfbox.tcl (::tk::dialog::file::): fix typeMenuLab ref. Add
+ undoc'd ::tk::dialog::file::showHiddenBtn var (default 0) that will add
+ a "Show Hidden" checkbutton to tk_get*File and tk_chooseDirectory if
+ set to true.
+ * library/choosedir.tcl (::tk::dialog::file::chooseDir::): fix
+ cancelBtn ref, add hiddenBtn ref for "Show Hidden" button.
- * win/tkWinButton.c (TkpComputeButtonGeometry): corrected the
- default size of Windows buttons to conform to the Windows style.
- This changes the default size of buttons on Windows.
- [Patch #463234] (nelson)
- **** POTENTIAL VISUAL INCOMPATABILITY ****
+2005-04-09 Daniel Steffen <das@users.sourceforge.net>
-2001-11-16 Jeff Hobbs <jeffh@ActiveState.com>
+ * macosx/README: updated requirements for OS & developer tool versions
+ + other small fixes/cleanup.
- * library/menu.tcl: corrected menu traversal code on Unix to
- better handle entering cascades. [Patch #481219] (oleinick)
+ * macosx/tkMacOSXEntry.c (ComputeIncDecParameters): manually define
+ constants present only in 10.3 headers so that we can build on 10.2.
-2001-11-16 David Gravereaux <davygrvy@pobox.com>
+ * macosx/Wish.pbproj/project.pbxproj: fixed absolute path to tkEntry.h
+ that confused 10.2 PBX.
- * win/makefile.vc: Install target repaired.
+ * unix/tcl.m4 (Darwin): added -single_module linker flag to
+ TCL_SHLIB_LD_EXTRAS and TK_SHLIB_LD_EXTRAS.
+ * unix/configure: autoconf-2.59
-2001-11-15 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+2005-04-07 Mo DeJong <mdejong@users.sourceforge.net>
- * library/demos/image2.tcl: Many improvements to this
- image-viewing demo; now uses labelframes and tk_chooseDirectory
+ * macosx/tkMacOSXWm.c (TkWmStackorderToplevelWrapperMap,
+ (TkWmStackorderToplevel):
+ * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap,
+ (TkWmStackorderToplevel):
+ * win/tkWinWm.c (TkWmStackorderToplevelWrapperMap,
+ (TkWmStackorderToplevel):
+ Fix panic in wm stackorder when a toplevel is created on another
+ display. The code now ignores toplevels that have a display that does
+ not match the display of the parent window. [Bug 1152809]
- * library/palette.tcl (::tk::RecolorTree): Made this work better
- with CDE, which does some extremely annoying things with the
- option database that interact badly with Tk's way of handling
- options.
-
- * doc/text.n: Overhauled the documentation of undo to make it
- easier to understand.
- * library/tk.tcl (::tk::EventMotifBindings): Added Emacs-like undo
- binding, but not behaviour (we separate undo and redo.)
- * library/demos/text.tcl: Show off our undo capability!
+2005-04-06 Donal K. Fellows <dkf@users.sf.net>
-2001-11-12 David Gravereaux <davygrvy@pobox.com>
+ * doc/wm.n, doc/winfo.n, doc/tk.n, doc/send.n, doc/selection.n:
+ * doc/radiobutton.n, doc/photo.n, doc/options.n, doc/menu.n:
+ * doc/listbox.n, doc/getOpenFile.n, doc/font.n, doc/event.n:
+ * doc/entry.n, doc/clipboard.n, doc/checkbutton.n, doc/canvas.n:
+ * doc/button.n, doc/bind.n, doc/TextLayout.3, doc/MeasureChar.3:
+ * doc/GetRelief.3, doc/GetPixels.3, doc/GetJustify.3, doc/GetFont.3:
+ * doc/GetCursor.3, doc/GetColor.3, doc/GetBitmap.3, doc/GetAnchor.3:
+ * doc/FontId.3, doc/CrtWindow.3, doc/CrtImgType.3, doc/ConfigWidg.3:
+ * doc/3DBorder.3: Purge old .VS/.VE macro instances.
- * win/mkd.bat:
- * win/rmd.bat: Removed -kb CVS attribute and added changes
- from Llyod Lim for better stability. [Patch #456761]
+2005-04-04 Don Porter <dgp@users.sourceforge.net>
- * win/rules.vc(new):
- * win/buildall.vc.bat(new):
- * win/makefile.vc: large rewrite following Tcl's makefile.vc as
- a guide and Patch #456761. Appears BugFree(tm).
+ * library/comdlg.tcl: Added Macintosh file type validation to
+ [::tk::FDGetFileTypes]. [Bug 1083878] (Thanks, Vince Darley)
-2001-11-12 Jeff Hobbs <jeffh@ActiveState.com>
+2005-04-04 Vince Darley <vincentdarley@users.sourceforge.net>
- * doc/text.n:
* generic/tkText.c:
- * generic/tkText.h:
- * generic/tkTextTag.c:
- * library/text.tcl:
- * library/tk.tcl:
- * mac/tkMacDefault.h:
- * tests/text.test:
- * unix/tkUnixDefault.h:
- * win/tkWinDefault.h: added TIP #26 implementation of simple
- built-in undo/redo of text editing in the text widget.
- [Patch #458879] (callewaert)
-
-2001-11-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/menu.tcl: Show off -compound support in menus.
-
- * library/demos/radio.tcl: Added some code to both show off the
- extra capabilities of the buttons and also show what can be done
- with compound images on the sly.
-
-2001-11-10 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in:
- * win/Makefile.in: Add "make gdb" target. This target
- can run wish inside either gdb or insight.
-
-2001-11-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/clrpick.tcl: changed a few parameters so that the full
- 0..255 range could be accessed via the mouse. [Bug #478498]
-
- * unix/configure:
- * unix/tcl.m4: added -lc to AIX libs, fixed path to ldAix
-
- * win/configure:
- * win/tcl.m4:
- * win/makefile.vc: add comctl32.lib to build libs.
- * win/tkWinX.c (TkWinXInit): added InitCommonControlsEx call.
- * win/rc/tk.rc:
- * win/rc/wish.rc:
- * win/rc/wish.exe.manifest: added resources that specify using v6
- of the MS Common Controls library when available (WinXP+). This
- enables use of the themeable widgets (like scrollbars) to be used
- in Tk. [Patch #478933]
-
-2001-11-09 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure:
- * unix/tcl.m4: Update from Tcl.
-
-2001-11-08 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in:
- Avoid adding libc to the LIBS and WISH_LIBS
- variables since it is not needed when linking with CC.
- If required when linking with LD it should be done
- on a case by case basis in tcl.m4.
-
-2001-11-05 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/dialog2.tcl: Typo-fix.
- * library/demos/browse, library/demos/ixset, library/demos/rolodex:
- Installation does version number fixup, so we shouldn't. Thanks
- to wohnivec@iol.cz for pointing these (thankfully minor) problems
- out.
-
-2001-10-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/widget: Integrated labelframe item into the labels
- section and added a spinbox demo to the (retitled) entry section.
-
- * library/demos/labelframe.tcl: Adjusted so as to show off the
- labelframe widget to better effect and have a better description.
-
- * library/demos/spin.tcl: New demo to show off spinbox capabilities.
-
- * library/demos/rolodex: Changes up-ported from core-8-3-1-branch
- to make the script use more 8.*-isms, but not menus due to the way
- the context help system works.
-
- * library/demos/ixset: Changed to use the labelframe widget and
- the grid geometry manager.
-
-2001-10-29 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/browse: Changes up-ported from core-8-3-1-branch
- to make the script much more robust, particularly when neither the
- current version of wish or the script are on the path.
-
- * library/demos/hello: Added emacs trailing tag-line.
-
- * library/demos/tcolor: Changes up-ported from core-8-3-1-branch
- to make the script compliant with current good practise, as well
- as extensive use of the new labelframe widget.
-
- * library/demos/timer: Changes up-ported from core-8-3-1-branch to
- make the script look and work better.
-
- * library/demos/rmt: Changes up-ported from core-8-3-1-branch to
- use more 8.* features and make the demo script more generally
- useful to people.
-
-2001-10-23 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkCursor.c (Tk_GetCursorFromData): Fixed uninit nextPtr
- field. [adapted from Patch 473875]
- (GetCursor): Removed double-assignment to nextPtr field.
-
-2001-10-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/console.tcl: removed transpose ability until the console
- can get a proper rewrite of tag handling.
-
-2001-10-18 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/defs.tcl: removed threaded build warning under X.
-
- * library/console.tcl (ConsoleOutput): fixed undefined widget
- argument.
-
-2001-10-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/xmfbox.tcl: fixed filtering in motif file dialog.
- [Patch #469670] (nelson)
-
- * generic/tkWindow.c (OpenIM): Added simple XIM patch to enable
- basic XIM input on Unix. [Patch #412727] (fabian)
-
-2001-10-15 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure:
- * unix/configure.in:
- * win/configure:
- * win/configure.in:
- * win/tkConfig.sh.in: reworked to be a little cleaner in
- comparison to each other, and to AC_SUBST even empty vars for
- win/tkConfig.sh
-
-2001-10-12 Todd M. Helfter <tmh@purdue.edu>
-
- * ChangeLog:
- * doc/menu.n:
- * generic/tkMenu.c:
- * generic/tkMenu.h:
- * generic/tkMenubutton.c:
- * generic/tkMenubutton.h:
- * mac/tkMacDefault.h:
- * mac/tkMacMenu.c:
- * mac/tkMacMenubutton.c:
- * tests/menu.test:
- * unix/tkUnixDefault.h:
- * unix/tkUnixMenu.c:
- * win/makefile.vc:
- * win/tkWinDefault.h:
- * win/tkWinMenu.c:
- * win/tkWinWm.c: Implementation of TIP #63, the addition of
- a -compound option to menu entries allowing text and an image to
- be displayed at the same time.
-
-2001-10-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/console.tcl: added more smarts extracted from tkcon to
- the default console.
-
-2001-10-01 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinTest.c: better error reporting from testclipboard
-
- * win/tkWinDialog.c: minor cast changes to support Win64
-
- * win/tkWinWindow.c: made use of standard Tk_GetHWND instead of
- older, private TkWinGetHWND.
-
- * win/configure: regen'ed
- * win/tcl.m4:
- * win/makefile.vc: updated for Win64 SDK RC1 compilation support
-
-2001-09-30 Peter Spjuth <peter.spjuth@space.se>
-
- * doc/grid.n:
- * generic/tkGrid.c:
- * tests/grid.test: Added -uniform option to grid's row/column-
- configure. [TIP 37] [Patch 459343]
-
-2001-09-26 Peter Spjuth <peter.spjuth@space.se>
-
- * win/tkWinFont.c (Tk_DrawChars): Added support for clipping text.
-
- * doc/frame.n:
- * doc/labelframe.n:
- * doc/toplevel.n:
- * generic/tkFrame.c:
- * generic/tkInt.h:
- * generic/tkWindow.c:
- * library/demos/radio.tcl:
- * library/demos/labelframe.tcl:
- * library/demos/widget:
- * mac/tkMacDefault.h:
- * tests/frame.test:
- * unix/tkUnixDefault.h:
- * win/tkWinDefault.h: Added labelframe widget. Added -padx/y
- options to frame and toplevel.
-
- * tests/grid.test:
- * tests/pack.test:
- * tests/place.test: Used labelframe to test geometry manager changes.
- [TIP 18] [Patch 429164]
-
-2001-09-26 Peter Spjuth <peter.spjuth@space.se>
-
- * doc/GeomReq.3:
- * doc/WindowId.3:
- * generic/tk.decls:
- * generic/tk.h:
- * generic/tkDecls.h:
- * generic/tkGeometry.c:
- * generic/tkGrid.c (ArrangeGrid):
- * generic/tkInt.h:
- * generic/tkPack.c (ArrangePacking):
- * generic/tkPlace.c (RecomputePlacement):
- * generic/tkStubInit.c:
- * generic/tkUtil.c (TkComputeAnchor):
- * generic/tkWindow.c (TkAllocWindow):
- * unix/mkLinks: Geometry manager changes to support TIP#18.
- Allows a widget to set different internal border widths on
- different sides, and to set a minimum requested size.
- POTENTIAL INCOMPATIBILITY. [Patch 429164]
-
-2001-09-25 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkBind.c:
- * generic/tkInt.decls (TkpScanWindowId):
- * unix/tkUnixPort.h (Tkp{Print,Scan}WindowId):
- * unix/tkUnixXId.c (TkpScanWindowId):
- * win/tkWinWindow.c (TkpScanWindowId): Corrected definition of
- TkpScanWindowId to handle situation where types Window and int
- do not have the same number of bits. CONST-ified too.
-
- * generic/tkIntPlatDecls.h:
- * generic/tkStubInit.c: make genstubs
-
-2001-09-24 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkMain.c (StdinProc): Update to handle change in
- return type of Tcl_DStringAppend() from (char *) to (CONST char *).
- [TIP 27]
-
-2001-09-23 Peter Spjuth <peter.spjuth@space.se>
- * generic/tkPack.c (ConfigureSlaves):
- * tests/pack.test:
- * tests/grid.test: Pack accepted asymmetric values for -ipadx/y.
- Only -padx/y supports asymmetry. [Bug #462348]
-
-2001-09-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWindow.c (TkpPrintWindowId, TkpScanWindowId): fixed to
- work on Win64 with 64bit XIDs.
-
- * generic/tkWindow.c (Tk_CreateAnonymousWindow):
- * generic/tkEntry.c (GetSpinboxElement): fixed unreachable returns.
-
- * win/tkWinX.c (TkGetServerInfo): added recognition of Win64.
-
- * xlib/X11/X.h: made XID __int64 type for Win64.
-
- * unix/tkUnixPort.h:
- * mac/tkMacPort.h: add (int*) cast to TkpScanWindowId.
- These may need to be changed to Window* (ulong).
-
- * generic/tkCmds.c (Tk_WinfoObjCmd):
- * generic/tkBind.c (NameToWindow):
- correct Window id's to be of type Window
-
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkInt.decls (TkpScanWindowId): changed decl to use
- Window* instead of int*.
-
- * xlib/xcolors.c:
- * generic/tkPack.c,tkWindow.c:
- * win/tkWinFont.c,tkWinMenu.c:
- * unix/tkUnixScale.c: minor cast fixes to prevent 64bit warnings.
-
- * tests/scrollbar.test (scrollbar-6.27): marked knownBug because
- it is skewed by bad dimensions returned by Windows.
-
- * tests/textDisp.test (textDisp-4.12): corrected test to work
- properly on Windows.
-
- * tests/id.test,macFont.test,macMenu.test,macscrollbar.test:
- * tests/send.test,winClipboard.test,winDialog.test,winFont.test:
- improved use of test constraints
-
- * win/tkWinWm.c (WinSetIcon): fixed SetClassLong for 64bit support.
-
-2001-09-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure: regen'ed
- * unix/tcl.m4: added --enable-64bit support for HP-11 with the
- 64-bit kernel.
-
-2001-09-17 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkGrid.c (ConfigureSlaves):
- * generic/tkPack.c (PackAfter): Corrected type definition of
- argument passed to Tcl_GetStringFromObj() from size_t to int.
- Incorrect type broke [pack] and [grid] on systems where
- sizeof(size_t) != sizeof(int). [Bugs 462375, 462342, 462338]
-
-2001-09-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/choosedir.tcl (DblClick):
- * library/tkfbox.tcl (OkCmd, ListInvoke): Rewrote so as to avoid
- the highly confusing string "text" and to be consistent about what
- is and what is not a list. [Bug 459895, reported by fandom]
-
-2001-09-14 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+ * tests/text.test: fix to elide searching problems [Bug 1174269] and
+ disappearing cursor with insertofftime 0. [Bug 1169429]
- * generic/tkImgGIF.c:
- * generic/tkImgPPM.c:
- * generic/tkImgPhoto.c:
- * generic/tkMenu.c: Applied patch [461578], provided by Vincent
- Darley. This fixes several memory leaks in the image code. They
- happen if there are errors during the initialization of the
- channel the image is supposed to be read from.
-
-2001-09-12 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure:
- * unix/tcl.m4: Update from Tcl.
-
-2001-09-12 D. Richard Hipp <drh@hwaci.com>
-
- * library/tkfbox.tcl: fixed error that appeared when you would
- click on the canvas while viewing an empty directory.
-
-2001-09-10 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/configure:
- * unix/tcl.m4: Update from Tcl.
-
-2001-09-09 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/Makefile.in: Fix Windows Makefile so that
- tcltest will automatically be compiled if the
- user tries to build tktest.
-
-2001-09-09 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/Makefile.in: Use TKTEST variable directly
- instead of depending on the tktest alias.
-
-2001-09-08 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/mkd.bat:
- * win/rmd.bat:
- Apply binary property (cvs admin -kb) to files and convert
- to CRLF linefeed format to fix the VC++ build. [Tcl Bug #219409]
-
-2001-08-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/menu.test:
- * tests/send.test:
- * tests/select.test: corrected to use testConfig constraints in
- the TK_ALT_DISPLAY case
-
- * tests/unixSend.test: removed test file completely identical to
- send.test. Removed platform specific named file in case somebody
- gets send working on Win/Mac in the future.
-
- * tests/config.test: added config-14.1 to test namespace import
- evaluation of widgets.
- * generic/tkButton.c (ButtonCreate):
- * generic/tkFrame.c (CreateFrame):
- * generic/tkMenubutton.c (Tk_MenubuttonObjCmd):
- * generic/tkPlace.c (Tk_PlaceObjCmd):
- * generic/tkScale.c (Tk_ScaleObjCmd):
- * generic/tkMessage.c (Tk_MessageObjCmd):
- * generic/tkEntry.c (Tk_EntryObjCmd, Tk_SpinboxObjCmd):
- * generic/tkSquare.c (SquareObjCmd): redid the handling of
- optionTables in widgets to allow them to be imported into other
- namespaces. [Bug #456632]
-
-2001-08-28 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinDialog.c (ChooseDirectoryHookProc): work-around for MS
- bug that caused crashing in tk_chooseDirectory on Win95.
- [Bug #224936] (baker)
-
- * unix/tkUnixWm.c (TkWmRestackToplevel): reworked how
- ConfigureNotify requests were handled in relation to the parent to
- avoid the problem with potential 'raise' delays on some wms.
- [Bug #220260] (baker) wms that were affected should notice the
- difference in tests unixWm-51.* not failing that failed before.
-
-2001-08-26 Don Porter <dgp@users.sourceforge.net>
-
- * library/text.tcl (<Shift-Up> binding): Corrected TIP 44 typo
- that broke binding. Thanks to "Michal" for the fix.
- [Bug 455468]
-
-2001-08-23 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure:
- * unix/tcl.m4: added QNX-6 build support. [Bug #219410] (loverso)
-
- * doc/CrtPhImgFmt.3: removed bogus note about including tkPhoto.h
-
-2001-08-22 Peter Spjuth <peter.spjuth@space.se>
-
- * generics/tkGrid.c (ConfigureSlaves):
- * tests/grid.test: Fixed a bug where adjacent 'x' and '^' where
- not handled properly. [Bug #452040]
-
-2001-08-22 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkPack.c (TkParsePadAmount): added lint init for sepChar.
-
- * tests/dialog.test (HitReturn): fixed failing dialog-2.1 test
- because it wasn't always getting focus properly.
-
-2001-08-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/unixFont.test (unixFont-2.[234]): fixed to be more
- sensitive on systems that have more installed fonts.
-
- * library/dialog.tcl (tk_dialog): changed dialog to show bar on
- Windows as well and added some y padding between the buttons and
- the bar. [Patch #442835] (harrismh)
+2005-04-03 Peter Spjuth <peter.spjuth@space.se>
-2001-08-20 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkInt.h:
- * generic/tkWindow.c:
- * generic/tkGrid.c:
- * generic/tkPack.c:
* tests/grid.test:
- * tests/oldpack.test:
- * tests/pack.test: Objectified grid and pack commands.
-
-2001-08-20 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkObj.c (TkGetWindowFromObj): Rewrote window code to
- reuse a previously worked-out set of window information exactly
- when the reference window is the same and no window deletions have
- occurred since the object was allocated (display has same epoch
- counter.) Required changing the internal rep of the window quite
- a bit as now need to save three words-worth of information in the
- internal rep (this window, reference window, display epoch.)
- * generic/tkObj.c (SetWindowFromAny, DupWindowInternalRep,
- FreeWindowInternalRep): Code to support new internal rep for
- window objects.
- * generic/tkInt.h: Added epoch counter to TkDisplay structure
- * generic/tkWindow.c (GetScreen, Tk_DestroyWindow): Epoch counter
- is incremented every time a window is deleted.
-
-2001-08-18 Peter Spjuth <peter.spjuth@space.se>
-
- * doc/grid.n:
- * tests/grid.test:
- * generic/tkGrid.c: Grid configure rejected initial "x" and "^".
- [Bug #418664]
-
-2001-08-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkObj.c (TkGetWindowFromObj): Was failing to reuse
- cached window objects, forcing a call to Tcl_GetStringFromObj and
- Tk_NameToWindow every time. This fault has been in there for
- nearly three years...
-
-2001-08-15 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Labelled the TIP 44 changes as "POTENTIAL INCOMPATIBILITY".
- Although technically internal changes are not incompatible, they'll
- be perceived as such by those who get bitten, and this will help
- them find the cause of their trouble.
-
-2001-08-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tk{Util,Font,Cursor,Color,Bitmap,3d}.c: Modified
- objtype declarations so that they can be picked up in tkObj.c and
- the names are now prefixed with "tk" too.
- * generic/tkObj.c (TkRegisterObjTypes):
- * generic/tkWindow.c (Initialize):
- * generic/tkInt.h: Added code to register Tk's object types with
- the Tcl runtime. [Tcl Bug 450545]
-
-2001-08-12 Mo DeJong <mdejong@redhat.com>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
-
-2001-08-10 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/image2.tcl (loadDir): Converted non-portable
- [glob [file join $dirName *]] to [glob -directory $dirName *]
- which is both fully portable and more reliable when directory
- names contain glob-significant characters. [Bug 223313]
-
-2001-08-08 Don Porter <dgp@users.sourceforge.net>
-
- * tests/dialog.test: New file testing [tk_dialog].
-
- * library/dialog.tcl:
- * library/tkfbox.tcl: Corrections to problems introduced by
- the TIP 44 changes. [Bug 449261]
-
- * README:
- * generic/tk.h:
- * unix/configure:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure:
- * win/configure.in: Bumped up patchlevel to 8.4a4 to distinguish
- CVS snapshots from the 8.4a3 release. This does not necessarily
- mean there will be an 8.4a4 release. [Bug 448938].
-
-2001-08-07 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in (dist): added {unix,win}/tcl.m4 and
- library/msgs/*.msg to dist target. [Bug: #448802]
-
-2001-08-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- 8.4a3 RELEASE
-
- * changes:
- * README: updated for 8.4a3 release
-
- * unix/configure: regenerated
- * unix/tcl.m4: added GNU (HURD) configuration target. (brinkmann)
- [Patch: #442974]
-
-2001-08-06 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkConsole.c:
- * generic/tkWindow.c:
- * library/bgerror.tcl:
- * library/dialog.tcl:
- * library/msgbox.tcl:
- * library/unsupported.tcl:
- * mac/tclets.tcl:
- * mac/tkMacHLEvents.c:
- * mac/tkMacWm.c: TIP 44 changes specific to the Mac and
- Windows platforms that were overlooked before: tkOpenDocument,
- tkConsoleExit, tkConsoleOutput, unsupported1 out of namespace :: .
- Thanks to Vince Darley for prompting another look.
-
-2001-08-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/winMain.c (WishPanic): fixed CONST changes to go with
- CONST-ification in Tcl.
-
- * win/configure: regenerated
- * win/tcl.m4: fixed DLLSUFFIX definition to always be ${DBGX}.dll.
- This is necessary for TEA compliant builds that build shared
- against a static-built Tk.
- * win/Makefile.in ($(WISH)): added $(TK_STUB_LIB_FILE) to build
- target, otherwise it wouldn't get generated in a static build.
-
-2001-08-01 Don Porter <dgp@users.sourceforge.net>
-
- * doc/console.n:
- * doc/menu.n:
- * doc/text.n:
- * doc/tkvars.n:
- * generic/tkBind.c:
- * generic/tkMenu.c:
- * library/bgerror.tcl:
- * library/button.tcl:
- * library/choosedir.tcl:
- * library/clrpick.tcl:
- * library/comdlg.tcl:
- * library/console.tcl:
- * library/dialog.tcl:
- * library/entry.tcl:
- * library/focus.tcl:
- * library/listbox.tcl:
- * library/menu.tcl:
- * library/msgbox.tcl:
- * library/optMenu.tcl:
- * library/palette.tcl:
- * library/scale.tcl:
- * library/scrlbar.tcl:
- * library/spinbox.tcl:
- * library/tclIndex:
- * library/tearoff.tcl:
- * library/text.tcl:
- * library/tk.tcl:
- * library/tkfbox.tcl:
- * library/unsupported.tcl:
- * library/xmfbox.tcl:
- * mac/tkMacMenu.c:
- * tests/clrpick.test:
- * tests/filebox.test:
- * tests/macMenu.test:
- * tests/menu.test:
- * tests/menuDraw.test:
- * tests/msgbox.test:
- * tests/text.test:
- * tests/unixMenu.test:
- * tests/winMenu.test:
- * tests/xmfbox.test:
- * unix/mkLinks:
- * unix/tkUnixDialog.c: Merged changes from feature branch
- dgp-privates-into-namespace, implementing TIP 44. All
- Tk commands and variables matching tk[A-Z]* are now in the
- ::tk namespace. See "BRANCH: dgp-privates-into-namespace"
- entries below for details. [FR 220936]
-
-2001-07-24 Mo DeJong <mdejong@redhat.com>
-
- * generic/default.h: Include tkWinDefault.h
- when built with Cygwin or Mingw.
-
-2001-07-18 Don Porter <dgp@users.sourceforge.net>
-
- BRANCH dgp-privates-into-namespace:
- * doc/console.n: Updated names of private console commands.
-
-2001-07-16 Don Porter <dgp@users.sourceforge.net>
-
- BRANCH dgp-privates-into-namespace:
- * library/console.tcl:
- * library/unsupported.tcl: Renamed tk::histNum to tk::HistNum
- as directed by the Tcl Style Guide.
-
-2001-07-10 Mo DeJong <mdejong@redhat.com>
-
- * unix/Makefile.in: Add AR and STLIB_LD variables.
- * unix/configure:
- * unix/configure.in: Use STLIB_LD when defining MAKE_LIB
- and MAKE_STUB_LIB. Subst STLIB_LD, RANLIB, and AR.
- * unix/tcl.m4: Update from Tcl.
- * win/configure: Regen.
- * win/tcl.m4: Update from Tcl.
-
-2001-07-06 Mo DeJong <mdejong@redhat.com>
-
- * win/configure: Regen.
- * win/tcl.m4: Update from Tcl.
-
-2001-07-05 Mo DeJong <mdejong@redhat.com>
-
- * win/Makefile.in: Subst DEPARG directly instead
- of relying on a variable. This will make Cygwin
- build faster since an extra exec will be avoided.
- * win/configure: Regen.
- * win/configure.in: Subst DEPARG.
- * win/tcl.m4: Update from Tcl.
-
-2001-07-04 Jeff Hobbs <jeffh@ActiveState.com>
-
- * README:
- * mac/README:
- * unix/README:
- * win/README: updated READMEs with purls
-
-2001-07-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/canvas.test:
- * generic/tkCanvPoly.c (PolygonToArea): Added patch that respects
- the polygon difference of including points in the polygon even
- when fill is empty. [Bug #226357]
-
-2001-07-03 Mo DeJong <mdejong@redhat.com>
-
- * win/Makefile.in: Remove PATHTYPE variable.
- * win/configure: Regen.
- * win/configure.in: Don't subst PATHTYPE.
- * win/tcl.m4: Update from Tcl.
-
-2001-07-03 Mo DeJong <mdejong@redhat.com>
-
- * win/Makefile.in: Don't use VPSEP, instead just use :
- in the VPATH.
- * win/configure: Regen.
- * win/configure.in: Don't subst VPSEP.
-
-2001-07-03 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/xmfbox.tcl (tkMotifFDialog_ActivateSEnt): Added missing
- backslash [Bug #438247]
-
-2001-07-02 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkWindow.c (Tk_DestroyWindow): changed to use
- Tcl_EventuallyFree instead of ckfree so that widgets that have
- references to a tkwin can use them.
-
- * generic/tkCanvArc.c:
- * generic/tkCanvBmap.c:
- * generic/tkCanvLine.c:
- * generic/tkCanvPoly.c:
- * generic/tkCanvText.c:
- * generic/tkCanvWind.c:
- * generic/tkRectOval.c: corrected argument handling in
- Create<Item> functions that could lead to ABRs or FMRs and
- corrected names of argc/argv to objc/objv.
-
- * generic/tkImgGIF.c (Mgetc): corrected screwy use of ternary
- operator and possible FMR.
-
- * generic/tkEntry.c: corrected missing Tcl_Release that caused
- font not freed complaints when trying valid cleanup calls.
- * generic/tkListbox.c: made use of Tcl_Preserve/Tcl_Release to
- prevent FMR errors in Display functions.
-
- * unix/tkUnixScale.c (TkpDisplayScale): corrected FMR when scale
- was deleted while calling its command.
-
- * library/console.tcl:
- * library/entry.tcl:
- * library/spinbox.tcl:
- * library/text.tcl:
- * library/tk.tcl: added private ::tk::GetSelection command to
- handle requesting selection. This is to support requesting
- UTF8_STRING before generic STRING on Unix. Changed Text, Spinbox,
- Entry and Console to use this command.
-
- * tests/select.test:
- * generic/tkSelect.c (Tk_CreateSelHandler, Tk_DeleteSelHandler):
- on Unix, a UTF8_STRING handler will be created when the user
- requests a STRING handler (in addition to the STRING handler).
- This provides implicit support for the new UTF8_STRING selection
- target.
- * unix/tkUnixSelect.c (TkSelEventProc, ConvertSelection): Added
- support for UTF8_STRING target. [RFE #418653, Patch #433283]
-
- * generic/tkInt.h: added utf8Atom to TkDisplay structure.
-
- * tests/listbox.test: changed 'darkblue' to 'white' in a test
- because it isn't a portable color name.
-
- * generic/tkEntry.c (DestroyEntry): used Tcl_EventuallyFree
- instead of ckfree for entryPtr to prevent FMRs. [Bug #413904]
-
-2001-06-26 Mo DeJong <mdejong@redhat.com>
-
- * unix/Makefile.in:
- * win/Makefile.in: Add `make shell` target. This target
- will set the proper env vars before invoking wish
- from the build directory.
-
-2001-06-26 Mo DeJong <mdejong@redhat.com>
-
- * win/configure:
- * win/configure.in: Revert cross compiling change
- accidently added during last checkin.
-
-2001-06-26 Mo DeJong <mdejong@redhat.com>
-
- * unix/configure: Regen.
- * unix/configure.in: Fix last checkin by removing
- export since that only works in bash.
- * win/configure: Regen.
- * win/configure.in: Ditto.
-
-2001-06-26 Mo DeJong <mdejong@redhat.com>
-
- * unix/configure: Regen.
- * unix/configure.in: Set CFLAGS to "" if the user
- did not set CFLAGS in the env. This keeps AC_PROG_CC
- from adding "-g -O2" to the CFLAGS by default.
- * win/configure: Regen.
- * win/configure.in: Ditto.
-
-2001-06-22 Mo DeJong <mdejong@redhat.com>
-
- * win/configure: Regen.
- * win/configure.in: Use RC_DEFINE flag from tcl.m4.
- * win/tcl.m4: Update from Tcl.
-
-2001-06-22 Mo DeJong <mdejong@redhat.com>
-
- * win/configure: Regen.
- * win/tcl.m4: Update from Tcl.
-
-2001-06-22 Mo DeJong <mdejong@redhat.com>
-
- * win/configure: Regen.
- * win/tcl.m4 (SC_CONFIG_CFLAGS): Link to the
- imm32 library when building with mingw gcc.
- * win/tkWinX.c: Include the imm.h header
- to fix compiling with mingw gcc.
-
-2001-06-22 Mo DeJong <mdejong@redhat.com>
-
- * win/configure: Regen.
- * win/configure.in: Add resource compiler fix from
- 8.3.3 to fix compiling with mingw.
-
-2001-06-22 Mo DeJong <mdejong@redhat.com>
-
- * win/configure: Regen.
- * win/tcl.m4: Fix silly typo in last checkin.
-
-2001-06-22 Mo DeJong <mdejong@redhat.com>
-
- * unix/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@.
- Set LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@. Add LDFLAGS_DEBUG
- and LDFLAGS_OPTIMIZE to match the way CFLAGS_DEFAULT works. Use
- new LDFLAGS variable in the Makefile instead of @LDFLAGS@.
- * unix/configure: Regen.
- * unix/configure.in: Don't set CFLAGS to CFLAGS_DEFAULT, instead
- subst CFLAGS_DEFAULT into the Makefile. Add AC_SUBST for CFLAGS_DEBUG,
- CFLAGS_OPTIMIZE, LDFLAGS_DEFAULT, LDFLAGS_DEBUG, and LDFLAGS_OPTIMIZE.
- Remove unused LD_FLAGS subst.
- * unix/tcl.m4: Update from Tcl.
- * win/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@.
- Set LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@.
- * win/configure: Regen.
- * win/configure.in: Don't set CFLAGS or LDFLAGS, instead subst
- CFLAGS_DEFAULT and LDFLAGS_DEFAULT into the Makefile.
- * win/tcl.m4: Update from Tcl.
-
-2001-06-22 Mo DeJong <mdejong@redhat.com>
-
- * win/configure:
- * win/tcl.m4: Update From Tcl.
-
-2001-06-21 eric melski <ericm@interwoven.com>
-
- * doc/colors.n: Corrected bogus documentation with respect to
- several shades of blue, all of which were listed as RGB 0 0 0.
- [Bug #432104].
-
-2001-06-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * library/demos/floor.tcl, library/demos/filebox.tcl,
- * library/demos/clrpick.tcl, library/demos/vscale.tcl,
- * library/demos/twind.tcl, library/demos/ruler.tcl,
- * library/demos/plot.tcl, library/demos/items.tcl,
- * library/demos/hscale.tcl, library/demos/ctext.tcl,
- * library/demos/cscroll.tcl, library/demos/arrow.tcl,
- * library/xmfbox.tcl, library/msgbox.tcl,
- * library/clrpick.tcl, library/bgerror.tcl: Braced expressions.
-
-2001-06-06 Mo DeJong <mdejong@redhat.com>
-
- * win/configure: Regen.
- * win/configure.in: Handle the --prefix option correctly
- it should default to /usr/local like the unix version.
-
-2001-06-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/selection.n:
- * doc/clipboard.n: added SEE ALSOs to cross-reference selection
- and clipboard, with extra note for clipboard command in selection
- docs. [Patch #422256]
-
- * unix/tkUnixFont.c: Corrected support for iso10646 (X11 Unicode)
- fonts on Unix. This adds a ucs-2be (UCS-2 Big Endian) encoding in
- Tk on Unix that is used for those fonts (X11 requires
- big-endianness). (welch) [Patch #406411; Bug #220890 #220899]
- This differs from the 8.3.3 patch by not adding ucs-2be in the
- preferred encodingList (seems works fine without).
- Added alias for jisx0201* fonts to jis0201 encoding. [Bug #414033]
-
-2001-05-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinKey.c (TkpSetKeycodeAndState): removed old debug info
-
-2001-05-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinX.c: moved the initialization of tkPlatformId from
- TkWinXInit to TkWinGetPlatformId because static builds could call
- it before it was initialized. [Bug #427278]
-
-2001-05-28 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkFrame.c:
- * generic/tkWindow.c:
- * tests/frame.test: Upgraded frame to use the newer TK_OPTION
- style when processing configuration options. Some cleanup of
- bad comments and bad code. [part of patch #420861]
-
-2001-05-23 Mo DeJong <mdejong@redhat.com>
-
- * unix/configure:
- * unix/tcl.m4:
- * win/configure:
- * win/tcl.m4: Sync from Tcl sources.
-
-2001-05-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tcl.m4: sync'ed up wih Tcl tcl.m4. [Bug #419812]
-
- * doc/TkInitStubs.3:
- * generic/tk.h:
- * generic/tkStubLib.c: CONST'ified Tk_InitStubs to match CONST
- changes to Tcl_PkgRequireEx.
-
-2001-05-21 Todd M. Helfter <tmh@purdue.edu>
-
- * doc/menubutton.n:
- * generic/tkMenubutton.c:
- * generic/tkMenubutton.h:
- * mac/tkMacMenubutton.c:
- * tests/menubut.test:
- * unix/tkUnixMenubu.c: Implementation of TIP #11, the addition of
- a -compound option to the menubutton allowing text and an image to
- be displayed at the same time. This behavior is identical to the
- behavior of the button widget.
-
-2001-05-16 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/console.n: Added - was erroneously placed in Tcl before...
-
-2001-04-25 Mo DeJong <mdejong@redhat.com>
-
- * unix/configure: Regen.
- * unix/tcl.m4: Update from Tcl.
- * win/configure: Regen.
- * win/tcl.m4: Update from Tcl.
-
-2001-04-25 Mo DeJong <mdejong@redhat.com>
-
- * unix/configure: Regen.
- * unix/configure.in: Use $@ in MAKE_LIB and MAKE_STUB_LIB
- commands instead of using a delayed subst variable. Replace
- instances of STUB_LIB_FILE with TK_STUB_LIB_FILE.
-
-2001-04-25 Mo DeJong <mdejong@redhat.com>
-
- * unix/Makefile.in: Use TCL_STUB_LIB_FILE instead of STUB_LIB_FILE.
- * unix/configure: Regen.
- * unix/configure.in: Don't subst STUB_LIB_FILE, use TCL_STUB_LIB_FILE
- instead.
-
-2001-04-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * generic/tkImage.c (Tk_ImageObjCmd,DeleteImage): Better detection
- of deletion when world is falling apart. [Bug #220819]
-
-2001-04-04 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinMenu.c (TkWinHandleMenuEvent): corrected reseting of
- service mode to only occur when it was set. [Bug #220948]
-
-2001-04-03 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/winClipboard.test: improved results for understanding when
- tests fail.
-
- * tests/winDialog.test: string totitle'd some results that
- expected [pwd] to return a capital drive letter.
-
- * tests/cursor.test: changed tests to use 'heart' cursor because
- 'arrow' on windows has a pre-skewed use count.
-
- * win/tkWinDialog.c (GetFileNameA): initialize multi to 0.
-
-2001-04-02 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/configure:
- * win/tcl.m4 (SHLIB_LD): added -incremental:no. [Bug #219381]
-
- * generic/tkMenu.c (TkInvokeMenu): checked for menu deletion
- before calling associated menu entry command. [Bug #220821]
-
- * doc/image.n: added warning about names chosen for images.
-
- * generic/tkImgPhoto.c (ImgPhotoCmd): corrected the src and dest
- values for $imageName put when -format and -to are used.
- [Bug #232741]
-
- * tests/listbox.test: added test listbox-27.1, delete during
- scrollbar update
- * generic/tkListbox.c (DestroyListbox, ListboxEventProc):
- corrected listbox to make proper use of Tcl_EventuallyFree and
- protect against unusual listbox deletion.
-
- * tests/entry.test: added tests entry-20.*, delete during widget
- activity
- * generic/tkEntry.c (DestroyEntry, EntryEventProc): fixed the
- entry widget to survive deletion while processing scrollbar
- updates and validation.
-
- * tests/canvas.test: test of canvas delete during event
- * generic/tkCanvas.c (DestroyCanvas, CanvasEventProc): fixed the
- canvas to survive deletion during event processing. [Bug #228024]
-
-2001-04-01 Jeff Hobbs <jeffh@ActiveState.com>
-
- * README:
- * mac/README: updated patchlevel to 8.4a3 and corrected links and
- notes.
-
- * generic/tk.h:
- * unix/configure.in (TK_PATCH_LEVEL):
- * unix/configure:
- * unix/tk.spec:
- * win/configure.in (TK_PATCH_LEVEL):
- * win/configure: updated patchlevel to 8.4a3
-
-2001-03-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * tests/safe.test: added note about correcting failures in
- safe.test.
- * library/tk.tcl: moved package require msgcat inside if case to
- not be used in safe interps.
-
- * win/makefile.vc:
- * win/configure:
- * win/tcl.m4: added imm32.lib to LIBS_GUI for Tk IME support.
- * win/tkWinInt.h:
- * win/tkWinKey.c:
- * win/tkWinX.c: added support for changing IME on the fly in
- Windows (2000). (lam) [Patch #402993]
-
- * tests/bind.test (bind-22.18):
- * generic/tkBind.c (NameToWindow): handled the error case where a
- valid-looking but invalid identifier could be passed in certain
- event generate options causing a crash. [Bug #411307]
-
- * win/tkWinWm.c (UpdateWrapper): ensured that the passed in winPtr
- had an existent window to operate on. [Bug #409172]
-
- * win/Makefile.in (install-*): improved install-* targets to use
- their base build dependency.
-
- * generic/tkImage.c (Tk_ImageObjCmd, EventuallyDeleteImage):
- added casts to allow compiling on Windows with debbuging.
-
-2001-03-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/msgs/de.msg: fixed translations. [Patch #403525]
-
- * doc/canvas.n: Noted ability to specify coords as a list in the
- docs. (techentin) [Patch #403660]
-
- * tests/canvas.test: added test case to check obj conversion
- * generic/tkObj.c (UpdateStringOfMM, SetMMFromAny): better
- obj-aware screen distances. (pgbaum, hobbs) [Patch #403327]
-
- * library/bgerror.tcl (bgerror): allow focus into details window
- for Windows C&P to work. [Bug #220929]
-
- * library/tk.tcl: put a catch around adding <hpBackTab> to the
- <<PrevWindow>> virtual event as it doesn't seem to work on all HP
- systems. [Bug #411669]
-
- * library/tkfbox.tcl: fixed selecting directories and single files
- with spaces using tk_getOpenFile -multiple 1. [Bug #411640]
-
- * win/tkWinDialog.c (GetFileNameA): added support for -multiple to
- ascii-based tk_getOpenFile (Win9*). (haneef) [Patch #403047]
- (GetFileNameW): increased number of files that could be returned
- by tk_getOpenFile -multiple. [Patch #412042]
-
-2001-03-29 Mo DeJong <mdejong@redhat.com>
-
- * library/entry.tcl (tkEntryMouseSelect):
- * library/text.tcl (tkTextSelectTo): When
- the mouse is dragged with the button down,
- move the insertion cursor to the current
- mouse position.
- * tests/event.test: Add a series of tests
- for event generation. Add tests for selection,
- check the position of the insertion cursor.
-
-2001-03-28 Jeff Hobbs <jeffh@gimlet.activestate.com>
-
- * unix/configure:
- * unix/tcl.m4: corrected IRIX-5.x config to not use -n32.
- (english) [Patch 403626]
-
-2001-03-28 Don Porter <dgp@users.sourceforge.net>
-
- * tests/focus.test (focus-6.1):
- * tests/macEmbed.test (unixEmbed-5.1):
- * tests/macMenu.test (macMenu-21.3):
- * tests/menu.test (menu-27.1):
- * tests/unixEmbed.test (unixEmbed-8.2):
- * tests/unixWm.test (unixWm-50.4): Replaced all [load {} tk]
- in Tk test suite with [load {} Tk]. [Bug 220940, Patch 411952]
-
-2001-03-12 Don Porter <dgp@users.sourceforge.net>
-
- BRANCH dgp-privates-into-namespace:
- * doc/menu.n:
- * unix/mkLinks: Added documentation for [tk_menuSetFocus].
-
-2001-03-12 Don Porter <dgp@users.sourceforge.net>
-
- BRANCH dgp-privates-into-namespace:
- * doc/text.n:
- * doc/tkvars.n:
- * unix/mkLinks: Added documentation for commands and variables
- matching tk_text*.
-
-2001-03-08 Don Porter <dgp@users.sourceforge.net>
-
- BRANCH dgp-privates-into-namespace:
- * generic/tkTextDisp.c:
- * library/unsupported.tcl:
- * tests/textDisp.test: Restored the global variables tk_textRedraw
- and tk_textRelayout. Since they match tk_*, they should remain
- publicly available until at least Tk 9.
-
-2001-03-01 Don Porter <dgp@users.sourceforge.net>
-
- BRANCH dgp-privates-into-namespace:
- * library/unsupported.tcl: New file for Tk's unsupported
- interfaces. Contains [tk::unsupported::ExposePrivateCommand]
- and [tk::unsupported::ExposePrivateVariable] that restore the
- availability of an old public name of one of Tk's private
- commands and variables, respectively, for those applications
- and extensions that depend on the old names against advice.
-
-2001-02-28 Don Porter <dgp@users.sourceforge.net>
-
- BRANCH dgp-privates-into-namespace: Feature branch to move all
- of Tk's private commands and variable into the ::tk namespace
- and its children.
-
- * doc/tkvars.n: Documented private variable tkPriv renamed tk::Priv.
-
- * generic/tkBind.c:
- * generic/tkMenu.c:
- * generic/tkTextDisp.c:
- * library/bgerror.tcl:
- * library/button.tcl:
- * library/choosedir.tcl:
- * library/clrpick.tcl:
- * library/comdlg.tcl:
- * library/console.tcl:
- * library/dialog.tcl:
- * library/entry.tcl:
- * library/focus.tcl:
- * library/listbox.tcl:
- * library/menu.tcl:
- * library/msgbox.tcl:
- * library/optMenu.tcl:
- * library/palette.tcl:
- * library/scale.tcl:
- * library/scrlbar.tcl:
- * library/spinbox.tcl:
- * library/tclIndex:
- * library/tearoff.tcl:
- * library/text.tcl:
- * library/tk.tcl:
- * library/tkfbox.tcl:
- * library/xmfbox.tcl:
- * mac/tkMacMenu.c:
- * tests/clrpick.test:
- * tests/filebox.test:
- * tests/macMenu.test:
- * tests/menu.test:
- * tests/menuDraw.test:
- * tests/msgbox.test:
- * tests/text.test:
- * tests/textDisp.test:
- * tests/unixMenu.test:
- * tests/winMenu.test:
- * tests/xmfbox.test:
- * unix/tkUnixDialog.c: All Tk commands matching ::tk[A-Z]* and
- all Tk private variables in the global namespace were renamed to
- live in the namespace ::tk or one of its children.
-
-2001-02-13 Eric Melski <ericm@interwoven.com>
-
- * doc/photo.n: [Bug 132213] Added clarification on interpretation
- of ranges for "photoName data -from" subcommand.
-
-2001-02-12 D. Richard Hipp <drh@hwaci.com>
-
- TIP #21: Asymmetric padding in the pack and grid geometry managers.
- With this changes, you can now say "-padx {10 20}" to put 10 pixels
- of padding on the left and 20 on the right. Similar rules apply
- for vertical padding. See the revised documentation for details.
-
-2001-01-02 Andreas Kupries <a.kupries@westend.com>
-
- * Everything below belongs together and implements TIP #8
- (SF patch #102833).
-
- * win/tkWinWm.c (line 56f): Added icon structures.
- * win/tkWinWm.c (struct WmInfo, line 242): Added reference to
- optional icon for titlebar.
- * win/tkWinWm.c (struct ThreadSpecificData, line 335): Added
- reference to optional default icon for toplevel windows.
- * win/tkWinWm.c (line 387 ... 1169): All the new functions required
- to deal with icon specifications, 'InitWm' changed.
- * win/tkWinWm.c (TkWmNewWindow, UpdateWrapper, TkWmDeadWindow, Tk_WmCmd):
- Added initialization and handling of the new fields.
- * doc/wm.n: Documentation updated to explain the newly available
- functionality.
-
-2000-12-13 jeff hobbs <jhobbs@interwoven.com>
-
- * generic/tkObj.c (SetMMFromAny): Added ability to recognize
- double type object to speed up canvas coord calculations.
- [Patch 403327]
-
-2000-12-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/entry.n: Improved documentation of interplay between the
- -state and -textvariable options.
-
-2000-11-29 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * tests/image.test (image-1.10): Improved this test, which
- previously only worked if the command failed to delete the root
- window, and caused *major* trouble otherwise...
- * generic/tkImage.c (EventuallyDeleteImage): Created this function
- so that images that get deleted during the creation of an image
- won't cause a nasty core dump. Properly fixes bug #120819.
-
-2000-11-28 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/image.n:
- * generic/tkImage.c (Tk_ImageObjCmd): Backed out previous change.
- Bug #120819 is back again in force. Left the test in there
- though.
-
-2000-11-23 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/image.n:
- * tests/image.test (image-1.10):
- * generic/tkImage.c (Tk_ImageObjCmd): Prohibited image names that
- start with "." since they can cause some really obscure
- crashes. Fixes Bug #120819.
-
-2000-11-21 Eric Melski <ericm@ajubasolutions.com>
-
- Overall change: Implemented TIP 5, which exports
- TkClassProcs/TkSetClassProcs as Tk_ClassProcs/Tk_SetClassProcs,
- adding a size field to Tk_ClassProcs to allow for future
- expansion, and renaming the geometryProc to worldChangedProc,
- which is more in keeping with the actual use of the callback.
-
- * unix/mkLinks: Added link for Tk_SetClassProcs.
-
- * doc/SetClassProcs.3: Documentation for
- Tk_ClassProcs/Tk_SetClassProcs.
-
- * generic/tkCanvas.c:
- * generic/tkEntry.c:
- * generic/tkFrame.c:
- * generic/tkListbox.c:
- * generic/tkMenu.c:
- * generic/tkMessage.c:
- * generic/tkScale.c:
- * generic/tkText.c: Updated to use Tk_ClassProcs/Tk_SetClassProcs
- instead of TkClassProcs/TkSetClassProcs.
-
- * generic/tkMenubutton.c:
- * generic/tkScrollbar.c:
- * generic/tkButton.c: Updated to use Tk_SetClassProcs instead of
- TkSetClassProcs.
-
- * generic/tkMenubutton.h:
- * generic/tkScrollbar.h:
- * generic/tkButton.h:
- * win/tkWinButton.c:
- * win/tkWinScrlbr.c:
- * mac/tkMacButton.c:
- * mac/tkMacMenubutton.c:
- * mac/tkMacScrlbr.c:
- * unix/tkUnixButton.c:
- * unix/tkUnixMenubu.c:
- * unix/tkUnixScrlbr.c: Updated to use Tk_ClassProcs instead of
- TkClassProcs.
-
- * generic/tkDecls.h:
- * generic/tkStubInit.c:
- * generic/tkIntDecls.h: Regenned from tk.decls, tkInt.decls.
-
- * generic/tk.h: Added declaration of Tk_ClassProcs, with size
- field. Added typedef's for Tk_ClassCreateProc,
- Tk_ClassWorldChangedProc, Tk_ClassModalProc. Added definition of
- Tk_GetClassProc macro, shorthand for extracting a member of the
- Tk_ClassProcs structure.
-
- * generic/tkInt.h: Removed declaration of TkClassProcs,
- TkClassGeometryProc, etc.
-
- * generic/tkBind.c (Tk_BindEvent): Updated to use Tk_GetClassProc
- macro to extract modalProc; added check that the modalProc is non-NULL.
-
- * generic/tkFont.c (RecomputeWidgets): Updated to use
- Tk_GetClassProc macro to extract worldChangedProc; added comment
- about the choice of a recursive versus iterative algorithm for
- propagating world changed messages.
-
- * generic/tkWindow.c (Tk_MakeWindowExist): Updated to use
- Tk_GetClassProc macro to extract createProc from Tk_ClassProcs.
-
- * generic/tk.decls: Added declaration for Tk_SetClassProcs.
-
- * generic/tkInt.decls: Commented out declaration for
- TkSetClassProcs, which is made public by this change. The entry
- is left in place, but commented, so that future developers will
- know not to reuse it's stub number.
-
-2000-11-21 Donal K. Fellows <fellowsd@cs.man.ac.uk>
-
- * doc/ConfigWidg.3: Added deprecation note from Bug #120944 - use
- Tk_SetOption() instead.
-
- * generic/tkImgPhoto.c (TkPhotoGetValidRegion): Applied patch to
- create this function and add it to tkInt stubs. Should now be
- possible to write an extension that accesses the transparency data
- in a photo image. Bug #120930
-
-2000-11-03 Jeff Hobbs <hobbs@ajubasolutions.com>
-
- 8.4a2 RELEASE
-
- * generic/tkWindow.c (Initialize): added call to Tcl_SetMainLoop.
- This only has effect when tclsh is run (not wish), and then Tk is
- loaded in interactively.
-
-2000-11-02 Jeff Hobbs <hobbs@ajubasolutions.com>
-
- * win/tkWinButton.c:
- * win/tkWinDialog.c:
- * win/tkWinScrlbr.c:
- * win/tkWinWm.c: fixed up code for Win64 support. This mostly
- remains in _WIN64 #ifdef's, until updated compilers are standard.
-
- * win/tcl.m4:
- * win/makefile.vc: updated for Win64 compile support
-
- * unix/configure:
- * win/configure: checked in configure scripts so people doing
- CVS checkouts aren't required to have autoconf. Changes to
- configure.in in the future will require the corresponding
- configure script to also be re-autoconf'ed and checked in.
-
- * doc/event.n: added note that key events require window focus.
-
-2000-11-01 Jeff Hobbs <hobbs@ajubasolutions.com>
-
- * win/tkWinDialog.c (GetFileNameW, GetFileNameA,
- Tk_ChooseDirectoryObjCmd): created
- work-around for change in NT5.0/98 that caused no initialdir
- setting to open the browser up in the user's documents dir.
-
- * tests/color.test: marked color-2.6 nonPortable as we can't
- reliably assume what 'red' maps to.
-
-2000-11-01 Eric Melski <ericm@ajubasolutions.com>
-
- * tests/winDialog.test: Corrected expected results for bad option
- tests (5.2, 5.5) to include -multiple option.
-
- * win/tkWinDialog.c: Added branch for 0 return from
- CommDlgExtendedError() switches; this was formerly treated as an
- error, but it actually is not, since it just means the user hit
- cancel or closed the dialog. (GetFileNameW): Added better smarts
- such that -multiple is not considered a valid option for
- tk_getSaveFile.
- Removed CommDlgExtendedError() checks for color and choosedir
- dialogs, and removed all except the explicit invalid filename
- checks for the file dialogs.
-
-2000-10-30 David Gravereaux <davygrvy@ajubasolutions.com>
-
- * win/configure.in:
- * win/Makefile.in:
- * win/makefile.vc:
- * win/rc/tk.rc:
- * win/rc/tk_base.rc (new):
- * win/rc/wish.rc: Added logic to derive filenames better in the
- resource scripts based on compile options along with better
- support for building a static wish shell with cursor resources.
-
-2000-10-27 Jeff Hobbs <hobbs@ajubasolutions.com>
-
- * unix/tcl.m4: added support for AIX-5.
-
- * tests/tk.test:
- * doc/tk.n: updated to reflect default on status of useinputmethods.
- * library/tk.tcl: tk useinputmethods is set to 1 by default. This
- enables Kanji and dead-char input by default. Intro'd in
- 1999-12-16 with default off to avoid some problems with older X
- servers that would slow down widget creation over time.
-
- * win/Makefile.in (test, winhelp, tktest): corrected the
- TCL_LIBRARY path specification.
-
-2000-10-18 Eric Melski <ericm@ajubasolutions.com>
-
- * win/tkWinDraw.c (RenderObject): Applied patch from [Bug: 6368],
- which corrects rendering of 1-pixel wide stippled lines on Windows.
-
- * generic/tkCanvLine.c (DisplayLine): Applied patch from
- [Bug: 6368], corrects bugs relating to use of active- and
- disabledwidth values for displaying lines (disabledwidth was never
- used, and activewidth/disablewidths would only possibly be used
- when greater than default width, rather than when simply not equal
- to default width).
-
- * library/tkfbox.tcl (OkCmd): Applied patch from [Bug: 6365],
- which adds safety for directory names containing spaces or which
- are non-lists.
-
- * win/tkWinDialog.c (GetFileNameW, GetFileNameA,
- Tk_ChooseColorObjCmd, Tk_ChooseDirectoryObjCmd): Added error
- checking for the return value from the common dialog functions, so
- that the commands will not silently fail if the common dialog
- returns an error. [Bug: 6369].
-
-2000-10-10 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkConfig.c (Tk_InitOptions): Added
- Tcl_IncrRefCount/Tcl_DecrRefCount calls on valuePtr, to prevent
- memory leaks when the value object comes from the option
- database. [Bug: 6275].
-
-2000-10-06 Jeff Hobbs <hobbs@ajubasolutions.com>
-
- * win/Makefile.in (cat32.${OBJEXT}): add win/ subdirectory to
- cat32 target to correctly find the source file.
-
-2000-10-05 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkCmds.c (Tk_WinfoObjCmd): Added check for
- TK_ANONYMOUS_WINDOW flag in the [winfo children] subcommand; if
- set, the window will not be printed in the list of children.
-
- * doc/CrtWindow.3: Added entry for Tk_CreateAnonymousWindow.
-
- * generic/tkWindow.c
- (Tk_CreateAnonymousWindow): New API for creating anonymous
- windows. These windows are manipulable from C, but not from Tcl,
- because they have no pathname associated with them. They are used
- initially by widgets that do rubber-band resizing (panedwindow,
- multi-column listbox, etc.), and may be useful for other widgets
- as well (dropbox, combobox).
- (Tk_DestroyWindow): Added check for TK_ANONYMOUS_WINDOW flag when
- determining whether to generate a DestroyNotify event.
-
- * generic/tkStubInit.c:
- * generic/tkDecls.h: Regen'd from tk.decls.
-
- * generic/tk.decls: Added Tk_CreateAnonymousWindow declaration.
-
- * generic/tk.h: Added TK_ANONYMOUS_WINDOW flag for Tk_Window's.
-
-2000-10-04 Eric Melski <ericm@ajubasolutions.com>
-
- * doc/MaintGeom.3: Noted that Tk_MaintainGeometry handles direct
- descendants properly.
-
- * generic/tkGeometry.c (Tk_MaintainGeometry): Added a check for
- the case in which the slave window is a direct descendant of the
- master window. In this case, we need not set up the additional
- infrastructure normally provide by Tk_MaintainGeometry, because we
- can rely on the parent/child relationship to handle it for us
- implicitly. In this case, Tk_MaintainGeometry just calls directly
- to Tk_MoveResizeWindow. This allows geometry managers to simply
- always use Tk_MaintainGeometry to maintain geometry for slaves,
- and avoid doing the direct descendant check themselves.
- (Tk_UnmaintainGeometry): Added a matching check for the direct
- descendant case; in this case, Tk_UnmaintainGeometry simply
- returns immediately.
-
-2000-10-01 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkButton.c (ConfigureButton): Added tests for -compound
- option, so that when there is a textvariable and an image, and
- -compound is not none, the button will display both the
- textvariable and the image.
-
- * doc/SetOptions.3: Added note that restoreProc and freeProc may
- be NULL.
-
- * generic/tkConfig.c (Tk_RestoreSavedOptions): For custom options,
- added test that the restoreProc is not NULL, to allow for custom
- options that don't care about supporting Tk_RestoreSavedOptions.
-
-2000-09-29 D. Richard Hipp <drh@hwaci.com>
-
- * generic/tkBitmap.c: Changes to prevent a BadMatch error from the
- Xserver when the same bitmap is used on two or more screens of the
- same display.
-
- * tests/menu.test: Print a warning if the TK_ALT_DISPLAY environment
- variable is not configured so as to test for the bug fix above.
-
- * library/tk.tcl (::tk::SetGrabFocus): "Catch" the grab in case
- another application already holds the grab and the "grab" command
- fails.
-
-2000-09-29 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/Makefile.in: commented use of TESTFLAGS
- * unix/Makefile.in: added TESTFLAGS to test and testlang targets to
- conform with Windows makefile and TEA style.
-
-2000-09-29 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkTest.c: Fixed tests to use updated API.
-
- * doc/SetOptions.3:
- * generic/tk.h:
- * generic/tkConfig.c: Changed interface for Tk_CustomOptionSetProc
- and Tk_CustomOptionGetProc; these now take a pointer to the start
- of the widget record, and an integer offset to the slot for the
- option value, instead of just a pointer to the slot. This allows
- more sophisticated options to do interesting things based on other
- data in the widget record.
-
-2000-09-17 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tk.h: Added declaration of Tk_ObjCustomOption structure,
- used for TK_OPTION_CUSTOM, and typedef's of the functions
- Tk_CustomOptionSetProc, Tk_CustomOptionGetProc,
- Tk_CustomOptionRestoreProc, and Tk_CustomOptionFreeProc, used for
- TK_OPTION_CUSTOM.
-
- * doc/SetOptions.3: Added documentation of TK_OPTION_CUSTOM, and
- section "CUSTOM OPTION TYPES" explaining how to create and use
- custom options.
-
- * tests/config.test: Added tests for custom option type.
-
- * generic/tkTest.c: Added test support for TK_OPTION_CUSTOM to
- TestobjconfigObjCmd. Added CustomOption* functions to implement a
- test custom option.
-
- * generic/tkConfig.c: Added new option type TK_OPTION_CUSTOM,
- which allows the definition of custom option types by creating
- parsing, printing, freeing, and restoring procedures for a custom
- option. This is needed by the text and canvas widgets if they are
- to be fully objectified.
-
-2000-09-07 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/Tk_Init.3:
- * doc/bell.n:
- * doc/loadTk.n: minor doc cleanup
-
-2000-09-06 Eric Melski <ericm@ajubasolutions.com>
-
- * doc/HWNDToWindow.3:
- * doc/GetHWND.3: Changed synopsis to indicate the tkPlatDecls.h
- should be included, not tk.h.
-
- * generic/tkPlatDecls.h: Removed #include <windows.h> for Windows,
- a better solution for now is to update the docs and have extension
- authors #include <tkPlatDecls.h>.
-
- * generic/tk.h: Removed '#include "tkPlatDecls.h"', as the
- incorrect inclusion order between windows.h/tkPlatDecls.h causes
- build conflicts on Windows.
-
- * generic/tkPlatDecls.h: Added #include <windows.h> for Windows,
- so that HWND, etc., are defined properly.
-
-2000-09-06 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/canvas.n: fixed doc bug (ellson). [Bug: 6218]
-
- * README:
- * generic/tk.h:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in: updated to patchlevel 8.4a2
-
- * generic/tkMessage.c (MessageWidgetObjCmd): initialized result to
- avoid pedantic warning.
-
- * generic/tkGrab.c (Tk_GrabObjCmd): changed len arg from size_t to
- int to fix pedantic warning.
-
-2000-09-01 Eric Melski <ericm@ajubasolutions.com>
-
- * win/makefile.vc (install-libraries):
- * win/Makefile.in (install-libraries):
- * unix/Makefile.in (install-libraries): Added tkPlatDecls.h to
- list of header files to install.
-
- * generic/tk.h: Added #include "tkPlatDecls.h", which declares the
- platform specific component of the public Tk stubs API's.
-
-2000-08-29 Eric Melski <ericm@ajubasolutions.com>
-
- * win/tkWinMenu.c (DrawWindowsSystemBitmap): Use scratchDC
- for determining the source's logical coordinates. Patch from
- [Bug: 6134 (Markus Oberhumer)].
-
- * win/tkWinMenu.c (SetDefaults): Compute the indicatorDimensions[]
- under Windows NT/2000 in the same way as under Windows 95/98.
- Patch from [Bug: 6134 (Markus Oberhumer)].
-
- * win/tkWinFont.c (GetScreenFont): Added a memset() to
- pacify memory checkers. Patch from [Bug: 6134 (Markus Oberhumer)].
-
- * library/tkfbox.tcl (::tk::dialog::file::Update): Corrected
- handling of multi-pattern filters (eg, "* *.*"), which was broken
- by the getOpenFile performance patches applied earlier.
-
-2000-08-24 Eric Melski <ericm@ajubasolutions.com>
-
- * doc/toplevel.n:
- * doc/spinbox.n:
- * doc/scrollbar.n:
- * doc/scale.n:
- * doc/menubutton.n:
- * doc/menu.n:
- * doc/listbox.n:
- * doc/entry.n:
- * doc/frame.n:
- * doc/message.n:
- * doc/checkbutton.n:
- * doc/radiobutton.n:
- * doc/button.n:
- * doc/label.n:
- * doc/canvas.n:
- * doc/text.n: Fixed Standard Options section to make best use of
- new tab settings in man.macros.
-
-2000-08-24 Mo DeJong <mdejong@redhat.com>
-
- * unix/README: Update to account for removal of --enable-gcc.
- * unix/configure.in:
- * unix/tcl.m4 (SC_ENABLE_GCC): Remove --enable-gcc option.
- * win/configure.in:
- * win/tcl.m4 (SC_ENABLE_GCC): Remove --enable-gcc option.
- Remove quick hack that provided cross compile support for
- windows builds.
-
-2000-08-23 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkButton.c (ButtonTextVarProc): reversed change below,
- it was not correct.
-
-2000-08-22 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkButton.c (ButtonTextVarProc): changed order of
- incr/decr of new value object, in case they are equal.
-
-2000-08-18 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkImgPhoto.c (ImgPhotoGet): Removed redundant call to
- DitherInstance; this call was formerly being made from
- ImgPhotoGet->ImgPhotoConfigureInstance->DitherInstance, and
- ImgPhotoGet->DitherInstance. The second call was removed.
-
-2000-08-10 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/SetOptions.3: added missing ')'.
-
-2000-08-09 Eric Melski <ericm@ajubasolutions.com>
-
- * doc/SetOptions.3: Updated documentation to reflect support for
- TK_OPTION_NULL_OK for TK_OPTION_DOUBLE and TK_OPTION_PIXELS.
-
- * generic/tkConfig.c: Added for TK_OPTION_NULL_OK support for
- TK_OPTION_DOUBLE and TK_OPTION_PIXELS.
-
- * doc/place.n: Updated, reformatted manual entry.
-
- * tests/place.test: Added many tests.
-
- * generic/tkPlace.c (Tk_PlaceObjCmd): Updated to use Tk
- widget-option management facilities to manage place options (-x,
- -y, etc.), which simplifies the placer code. Added support for
- [place configure pathName] and [place configure pathName -option],
- similar to the behavior of the configure subcommand supported by
- widgets.
-
-2000-08-08 Eric Melski <ericm@ajubasolutions.com>
-
- * tests/place.test: Extended test suite to test error returns from
- [place].
-
- * generic/tkInt.h: Replaced Tk_PlaceCmd prototype with
- Tk_PlaceObjCmd prototype.
-
- * generic/tkWindow.c: Updated [place] command entry to use new
- Tcl_Obj interface.
-
- * generic/tkPlace.c (Tk_PlaceObjCmd): Tcl_Obj'ified [place] command.
-
-2000-08-07 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkWindow.c: Updated [selection] command entry to use
- new Tcl_Obj interface.
-
- * generic/tkInt.h: Replaced Tk_SelectionCmd prototype with
- Tk_SelectionObjCmd prototype.
-
- * tests/select.test: Updated test suite to recognize standardized
- error messages.
-
- * generic/tkSelect.c (Tk_SelectionObjCmd): Tcl_Obj'ified
- [selection] command.
-
-2000-08-07 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/cursors.n: changed .SS to more compatible macros.
-
-2000-08-05 Jeff Hobbs <hobbs@scriptics.com>
-
- * library/safetk.tcl: rationalized the setting of tk_library when
- initialized Tk in a safe interpreter.
-
-2000-08-03 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkWindow.c: Updated "grab" command entry to use
- Tcl_Obj'ified command.
-
- * generic/tkInt.h: Replaced Tk_GrabCmd prototype with
- Tk_GrabObjCmd prototype.
-
- * tests/grab.test: Initial suite of tests for [grab] command.
-
- * generic/tkGrab.c (Tk_GrabObjCmd): Tcl_Obj'ified [grab] command.
-
- * generic/tkInt.h: Removed Tk_AfterCmd function prototype; the
- function does not exist (since 4.0p3). Cleaned up some line
- wrapping.
-
- * generic/tk.h: Removed "#define Tk_AfterCmd Tcl_AfterCmd";
- nothing in the core uses Tk_AfterCmd, and Tcl_AfterCmd doesn't exist
- anymore anyway.
-
- * generic/tkInt.h: Replace Tk_BindCmd prototype with
- Tk_BindObjCmd prototype.
-
- * generic/tkWindow.c: Updated "bind" command entry to use
- Tcl_Obj'ified command.
-
- * generic/tkCmds.c (Tk_BindObjCmd): Tcl_Obj'ified [bind] command.
-
- * tests/bind.test: Tweaked expected error messages for [bindtags]
- to comply with updated error messages.
-
- * generic/tkMenu.c (CloneMenu): Replaced calls to Tk_BindtagsCmd
- with equivalent calls to Tk_BindtagsObjCmd.
-
- * generic/tkInt.h: Replace Tk_BindtagsCmd prototype with
- Tk_BindtagsObjCmd prototype.
-
- * generic/tkWindow.c: Updated "bindtags" command entry to use
- Tcl_Obj'ified command.
-
- * generic/tkCmds.c (Tk_BindtagsObjCmd): Tcl_Obj'ified [bindtags]
- command.
-
-2000-08-02 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkCmds.c (Tk_TkwaitObjCmd): Tcl_Obj'ified [tkwait] command.
-
- * generic/tkWindow.c: Updated "tkwait" command entry to use
- Tcl_Obj'ified command.
-
- * generic/tkInt.h: Replace Tk_TkwaitCmd prototype with
- Tk_TkwaitObjCmd prototype.
-
- * generic/tkGrid.c (Tk_GridCmd): Split [grid] subcommands into
- separate functions instead of inlining them all in Tk_GridCmd.
-
-2000-08-01 Eric Melski <ericm@ajubasolutions.com>
-
- * generic/tkInt.h: Replaced prototype for Tk_MessageCmd with
- prototype for Tk_MessageObjCmd.
-
- * generic/tkWindow.c: Marked message command as using the new
- MessageObjCmd instead of the old MessageCmd.
-
- * tests/message.test: Added tests for the message widget.
-
- * generic/tkMessage.c: Obj'ified the message widget.
-
- * generic/tkInt.h: Removed prototype for Tk_ClipboardCmd, added
- prototype for Tk_ClipboardObjCmd.
-
- * generic/tkWindow.c: Updated function pointers for clipboard
- command to use Tcl_Obj version.
-
- * tests/clipboard.test: Updated tests to expect standard error
- messages.
-
- * generic/tkClipboard.c (Tk_ClipboardObjCmd): Obj'ified
- Tk_ClipboardCmd -> Tk_ClipboardObjCmd.
-
-2000-07-28 Eric Melski <ericm@ajubasolutions.com>
-
- * unix/tkUnixButton.c (TkpDisplayButton): Added bits to change
- the indicator color when radio-/check-buttons are disabled. This
- reduces the visual incongruity when a group of these controls are
- disabled together.
-
- * win/tkWinMenu.c (ReconfigureWindowsMenu): Added MF_GRAYED bit
- for disabled menu entries, to ensure that those which are drawn by
- the system are shown grayed (such as entries on menubars) [Bug: 4372].
-
- * doc/label.n: Added -disabledforeground to list of options [Bug:
- 6053].
-
- * mac/tkMacDefault.h:
- * unix/tkUnixDefault.h: Added default values for listbox
- disabledforeground and state.
-
- * win/tkWinDefault.h: Changed default listbox background color to
- white and listbox selection borderwidth to 0, in keeping with the
- "Microsoft Windows User Experience"; added default values for
- listbox disabledforeground and listbox state.
-
- * doc/listbox.n: Added documentation for -state option.
-
- * generic/tkListbox.c: Added support for -state to listbox. [RFE:
- 6052].
-
- * tests/listbox.test: Tests for listbox disabled state.
-
-2000-07-27 Mo DeJong <mdejong@redhat.com>
-
- * win/configure.in: TCL_STUB_LIB_FLAG and
- TK_STUB_LIB_FLAG should not include ${TCL_DBGX}
- in win/tkConfig.sh, fix that.
-
-2000-07-25 Joe English <jenglish@flightlab.com>
- * doc: CanvPsY.3, ConfigWidg.3, CrtImgType.3, CrtItemType.3,
- FontId.3, GetFont.3, canvas.n, font.n, options.n, text.n:
- Documentation fix: Replaced references to XFontStruct *
- and Tk_FontStruct with Tk_Font.
-
-2000-07-24 Eric Melski <ericm@ajubasolutions.com>
-
- * tests/text.test: Added tests for -regexp -nocase searches with
- backslash character classes.
-
- * generic/tkText.c (TextSearchCmd): Text search did not work
- properly when -regexp and -nocase were used, in combination with
- backslash character classes represented by capital letters (ie,
- \W, \M); altered implementation of -regexp -nocase searches to use
- new regexp interfaces to fix this problem. [Bug: 5988].
-
-2000-07-21 Eric Melski <ericm@ajubasolutions.com>
-
- * tests/text.test: Added tests for searching when text is elided.
-
- * generic/tkText.c (TextSearchCmd): Text search was not returning
- the correct index when the search covered (but did not search)
- elided characters; corrected this by adjusting the match index by
- the number of elided characters preceeding the start of the match,
- just as is done with embedded windows, etc. [Bug: 5470].
-
-2000-07-21 Mo DeJong <mdejong@redhat.com>
-
- * win/configure.in: Add TK_STUB_LIB_FLAG and
- TK_BUILD_STUB_LIB_SPEC. These are needed to build a stub enabled
- extension.
-
-2000-07-20 Eric Melski <ericm@ajubasolutions.com>
-
- * unix/tkUnixDraw.c (TkScrollWindow): Replaced a use of a trinary
- operator with an if/else, to avoid build problems on some
- platforms [Bug: 5819].
-
- * win/makefile.vc: Applied patch from Don Porter to enhance nmake
- support on NT/Alpha [RFE: 5939].
-
-2000-07-19 Eric Melski <ericm@ajubasolutions.com>
-
- * library/text.tcl: Enhanced <Tab> binding to behave like normal
- <Tab> bindings when the text widget is disabled (ie, it advances
- focus to the next widget).
-
- * generic/tkText.c (TextSearchCmd): Added a test for a NULL
- segment pointer when doing backwards searches for "" on an empty
- text widget. [Bug: 6007].
-
-2000-07-18 Mo DeJong <mdejong@redhat.com>
-
- * unix/aclocal.m4: Use tcl.m4.
-
- * unix/configure.in: Properly quote LOCALES variable. Properly quote
- argument to m4 macro.
-
- * unix/tcl.m4: Add updated file from tcl.
-
- * win/tcl.m4: Updated file from tcl.
-
-2000-07-18 Eric Melski <ericm@ajubasolutions.com>
-
- * library/tkfbox.tcl: Fixed keyboard navigation in the iconlist.
-
- * unix/configure.in (MAKE_LIB): Corrected definition of MAKE_LIB
- for shared builds, with patch from Mike Hopkirk.
-
-2000-07-18 Mo DeJong <mdejong@redhat.com>
-
- * win/Makefile.in: Fix TCL_GENERIC_DIR variable
- so that it uses the TK_SRC_DIR in the same way
- as the unix version.
-
-2000-07-17 David Gravereaux <davygrvy@ajubasolutions.com>
-
- * generic/tkConsole.c: Added comments for a Win2K OS bug with
- GetStdHandle(STD_OUTPUT_HANDLE). No change was done to the code
- as the resulting behaviour of ShouldUseConsoleChannel() was
- correct, anyways. [BUG: 5971]
-
-2000-07-17 Eric Melski <ericm@scriptics.com>
-
- * generic/tkStubImg.c (Tk_InitImageArgs): Applied patch from [Bug:
- 5990], from Anselm Lingnau, which correctly sets the value of
- useNewImage to 0 when the new image system is not to be used,
- instead of leaving it at -1, which causes the check to be
- performed more times than is really necessary.
-
- * library/bgerror.tcl: Fixed a typo in one of the bgerror dialog
- label.
-
- * library/msgs/it.msg: Italian message catalog, from Paolo
- Brutti. [RFE: 6012].
-
-2000-07-07 Eric Melski <ericm@ajubasolutions.com>
-
- * library/msgs/el.msg: Greek message catalog, from George Petasis.
-
-2000-07-07 Mo DeJong <mdejong@redhat.com>
-
- * win/configure.in: Fix subst of TK_SHARED_BUILD
- variable in tkConfig.sh.in. Fix definition of
- TK_SRC_DIR variable so that it matches the
- unix version.
-
-2000-07-05 Mo DeJong <mdejong@redhat.com>
-
- * generic/tkFileFilter.c (AddClause): Cast to match function prototype.
- * win/stubs.c (_XInitImageFuncPtrs): Add return value for function.
- * win/tkWinButton.c (buttonStyles, ButtonBindProc, ComputeStyle):
- Remove unused declarations.
- * win/tkWinColor.c (GetColorByName, GetColorByValue): Remove unused
- function declarations.
- * win/tkWinDialog.c (TrySetDirectory): Remove unused function
- declaration.
- * win/tkWinEmbed.c (TkWinEmbeddedEventProc): Cast to match function
- prototype.
- * win/tkWinMenu.c (winMenuMutex, MenuExitProc): Remove unused
- declaration.
- * win/tkWinWindow.c (StackWindow): Remove unused declaration.
- * win/tkWinWm.c (ConfigureEvent): Remove unused declaration.
- * win/tkWinX.c (winXMutex): Remove unused declaration.
- * xlib/ximage.c (XCreateBitmapFromData): Cast to match function
- prototype.
-
-2000-07-05 Eric Melski <ericm@ajubasolutions.com>
-
- * tests/imgPhoto.test: Added test for GIF writing code [Bug: 5823].
-
- * generic/tkImgGIF.c: Applied patch from Jan Nijtmans to fix a
- problem with the GIF writing code [Bug: 5823].
-
- * generic/tkCursor.c: Added initialization for nextPtr field of
- TkCursor, patch from Nijtmans/Howlett.
-
-2000-07-05 Eric Melski <ericm@ajubasolutions.com>
-
- * library/msgs/nl.msg: Dutch message catalog for dialogs, from Jan
- Nijtmans.
-
-2000-06-30 Eric Melski <ericm@scriptics.com>
-
- * doc/keysyms.n:
- * doc/colors.n: Added extra .CE/.CS pairs to break up the large
- text block, so that the generated Windows help file could
- accomodate the manual entry. [Bug: 5862]
-
- * tests/filebox.test: Adjusted tests to accomodate -multiple.
-
- * library/xmfbox.tcl: Adjusted arguments list construction such
- that -multiple is not presented as an option for tk_getSaveFile.
-
- * library/tk.tcl: Added test for safe interpreter status before
- attempting to load message catalogs (which is impossible in a
- standard safe interpreter). This means that SafeTk will not have
- localized dialogs, unless a means is found for loading the message
- catalog files.
-
-2000-06-29 Eric Melski <ericm@scriptics.com>
-
- * library/msgs/de.msg: German message catalog.
-
- * library/msgs/en.msg: English message catalog.
-
- * library/msgs/es.msg: Spanish message catalog.
-
- * library/msgs/fr.msg: French message catalog.
-
- * unix/Makefile.in:
- * unix/configure.in:
- * library/tk.tcl:
- * library/clrpick.tcl:
- * library/choosedir.tcl:
- * library/console.tcl:
- * library/msgbox.tcl:
- * library/tkfbox.tcl:
- * library/xmfbox.tcl:
- * library/bgerror.tcl: Applied patches from Laurent Duperval to
- provide localization of Tk dialogs. [RFE: 2671].
-
-2000-06-27 Eric Melski <ericm@scriptics.com>
-
- * generic/tkMenu.c (DeleteMenuCloneEntries): Applied fix from
- [Bug: 5275], which corrected a segfault-causing indexing problem
- when deleting entries from torn-off menus.
-
-2000-06-22 Eric Melski <ericm@ajubasolutions.com>
-
- * doc/getOpenFile.n: Updated with information about -multiple.
-
- * library/choosedir.tcl: Tweaked to handle modified tkIconList API's.
-
- * library/tkfbox.tcl: Preliminary implementation of multiple
- selection; based on patch from [RFE: 604]. Some of the tkIconList
- functions changed to support this and to make the dialog faster.
-
- * library/xmfbox.tcl: Added support for multiple selection, from
- patch in [RFE: 4999].
-
-2000-06-21 Eric Melski <ericm@scriptics.com>
-
- * library/text.tcl: Corrected behavior of text widget with respect
- to this sequence of events: click, shift-click. Previously, the
- shift-click just moved the cursor and anchor; now, the shift-click
- will select the text between the click and the shift-click, which
- is the behavior most users expect. [Bug: 5929].
-
-2000-06-19 Eric Melski <ericm@scriptics.com>
-
- * library/bgerror.tcl: Added auto-truncation for long error
- messages (more than 30 characters wide, or more than 4 lines
- long), so that the dialog remains a manageable size. [RFE: 5782]
-
-2000-06-15 Eric Melski <ericm@scriptics.com>
-
- * win/tkWinDialog.c: Patched to support tk_getOpenFile
- -multiple. [RFE: 604].
-
-2000-06-13 Eric Melski <ericm@scriptics.com>
-
- * win/aclocal.m4:
- * win/configure.in:
- * win/Makefile.in: Applied patch from [RFE: 5844], to provide
- support for the mingw compile environment for Windows.
-
-2000-06-06 Jeff Hobbs <hobbs@scriptics.com>
-
- 8.4a1 RELEASE
-
-2000-06-03 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/CrtCmHdlr.3: new doc for ClientMessage handler procs
- * generic/tk.h: added typdef for Tk_ClientMessageProc
- * generic/tkStubInit.c:
- * generic/tkDecls.h:
- * generic/tk.decls: Added Tk_CreateClientMessageHandler and
- Tk_DeleteClientMessageHandler declarations.
- * generic/tkEvent.c (Tk_HandleEvent): Added
- Tk_CreateClientMessageHandler and Tk_DeleteClientMessageHandler to
- allow adding event handlers that invoke for ClientMessage events.
- This is necessary to support unix dnd protocols.
-
-2000-06-02 Jeff Hobbs <hobbs@scriptics.com>
-
- * canvas.test: added test for 5783.
- * generic/tkCanvPoly.c (DisplayPolygon): added checks for the
- polygon fillGC not being empty to prevent segfault. [Bug: 5783]
-
-2000-05-31 Eric Melski <ericm@scriptics.com>
-
- * library/bgerror.tcl: Improved bgerror based on work by Donal
- K. Fellows; no longer dependant on tk_dialog; features a
- Windows-esque "Details" button, and a customizable extra function
- button that allows the user to (for example) save the stack trace
- to a file.
-
-2000-05-30 Eric Melski <ericm@scriptics.com>
-
- * generic/tkImgGIF.c: Changed defines for GIF87a/GIF89a to be
- static char arrays with integer initialization, to address EBCIDIC
- vs. ASCII encoding issues and to handle compilers that don't deal
- with "\xAB" syntax for specifying hex values in strings.
-
-2000-05-28 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/spinbox.n: (new file) docs for spinbox widget
- * generic/tkInt.h: added Tk_SpinboxObjCmd declaration
- * generic/tkEntry.c: added 'spinbox' widget - an extension of the
- entry widget type.
- * generic/tkWindow.c: added 'spinbox' to core Tk commands
- * library/spinbox.tcl: (new file) binding and helper procs for spinbox
- * library/tk.tcl: added spinbox.tcl to list of files to source
- * tests/entry.test: updated changed error messages
- * tests/spinbox.test: (new file) test suite for spinbox
-
- * generic/tkPlace.c (Tk_PlaceCmd): reworked place master/slave
- table init'n to prevent seg fault when using place on multiple
- displays.
-
- * generic/tk.h: added comments ot Tk_FakeWin structure
-
-2000-05-26 Eric Melski <ericm@scriptics.com>
-
- * generic/tkOption.c (Tk_GetOption): Extended Tk_GetOption to
- support a new syntax for option names in option tables. If the
- option name has an embedded ".", it indicates that the name field
- contains both an option name and an overriding widget class, in
- the form "class.option". The lookup for the option value will be
- performed as though the widget class is that specified, rather
- than the actual widget class.
- (SetupStacks): Replaced several lines of array element copying
- with a for loop for conciseness.
-
-2000-05-25 Eric Melski <ericm@scriptics.com>
-
- * library/button.tcl: Tweaks for -overrelief handling on Windows.
-
- * doc/radiobutton.n: Added documentation for -overrelief option.
-
- * doc/checkbutton.n: Added documentation for -overrelief option.
-
- * doc/label.n: Added documentation for -state option.
-
- * generic/tkButton.c: Added -overrelief option for checkbuttons,
- and radiobuttons.
-
- * library/button.tcl (tkButtonDown, macintosh version): Added
- protection against querying the -repeatdelay option from a widget
- that doesn't support it (ie, checkbuttons, radiobuttons, etc).
- Other platforms use a different binding script for checkbuttons
- and radiobuttons, so they don't have this issue.
- (tkCheckRadioEnter, windows version): Added code to handle
- -overrelief for check/radiobuttons on windows.
-
-2000-05-22 Eric Melski <ericm@scriptics.com>
-
- * generic/tkButton.c: Added -activeforeground, -activebackground
- for labels, for the -state option.
-
- * doc/label.n: Added documentation for -state option,
- -activeforeground, -activebackground.
-
-2000-05-22 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/Makefile.in (install-libraries): corrected to install X
- headers [Bug: 5516]
-
- * doc/bind.n:
- * doc/canvas.n:
- * doc/entry.n:
- * doc/listbox.n:
- * doc/photo.n: doc fix-ups [Bug: 5396]
-
-2000-05-17 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/bell.n:
- * tests/bell.test:
- * generic/tkCmds.c (Tk_BellObjCmd): added -nice option to
- optionally avoid resetting screen saver [Bug: 4279]
-
-2000-05-15 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinWm.c (Tk_WmCmd): changed wm deiconify from using idle
- callback to calling restack and focus code immediately.
-
-2000-05-17 Eric Melski <ericm@scriptics.com>
-
- Overall change: Added "-readonlybackground" option for entries,
- to enable a visual change when state goes to readonly.
-
- * mac/tkMacDefault.h (DEF_ENTRY_READONLY_BG_COLOR,
- DEF_ENTRY_READONLY_BG_COLOR):
- * win/tkWinDefault.h (DEF_ENTRY_READONLY_BG_COLOR,
- DEF_ENTRY_READONLY_BG_COLOR):
- * unix/tkUnixDefault.h (DEF_ENTRY_READONLY_BG_COLOR,
- DEF_ENTRY_READONLY_BG_COLOR): Added default values for entry
- -readonlybackground option.
-
- * generic/tkEntry.c: Added -readonlybackground option, cleaned up
- excessive use of graphics contexts.
-
- * tests/entry.test: Added configuration test for
- -readonlybackground option.
-
- * doc/entry.n: Added documentation for -readonlybackground option.
-
- Overall change: changed implementation of "link" relief for
- buttons. Instead of a new relief style (-relief link), there is a
- new option, -overrelief, which if set is used when the mouse is
- over the button.
-
- * doc/SetOptions.3: Added information about TK_OPTION_NULL_OK with
- TK_OPTION_RELIEF.
-
- * win/tkWinButton.c: Removed bits about TK_RELIEF_LINK.
-
- * tests/button.test: Added tests for -overrelief; removed tests
- for -relief link.
-
- * mac/tkMacButton.c: Removed bits about TK_RELIEF_LINK.
-
- * generic/tkOldConfig.c: Removed bits about TK_RELIEF_LINK.
-
- * generic/tkConfig.c: Removed bits about TK_RELIEF_LINK; added
- support for TK_OPTION_NULL_OK for TK_OPTION_RELIEF.
-
- * library/button.tcl: Added binding support for -overrelief.
-
- * generic/tk3d.c (Tk_GetRelief): Added branch for TK_RELIEF_NULL.
-
- * generic/tkButton.c: Added -overrelief option; removed
- Enter/Leave EventProc masks and handlers.
-
- * generic/tk.h: Added TK_RELIEF_NULL definition, removed
- TK_RELIEF_LINK.
-
- * mac/tkMacDefault.h (DEF_BUTTON_OVER_RELIEF):
- * win/tkWinDefault.h (DEF_BUTTON_OVER_RELIEF):
- * unix/tkUnixDefault.h (DEF_BUTTON_OVER_RELIEF): Added default
- value for the -overrelief option.
-
-2000-05-16 Eric Melski <ericm@scriptics.com>
-
- * win/tkWinMenu.c (ReconfigureWindowsMenu): Added code to add the
- MF_SEPARATOR bit for SEPARATOR_ENTRY menu items. This causes
- separator entries on the system menu to be drawn correctly [Bug: 5451].
-
-2000-05-15 Eric Melski <ericm@scriptics.com>
-
- * doc/image.n: Added documentation for [image inuse] command.
-
- * tests/image.test: Added tests for [image inuse] command.
-
- * generic/tkImage.c (Tk_ImageObjCmd): Added [image inuse] command,
- which provides a means for programmers to determine if a given
- image is in use by any widgets. [RFE: 3327].
-
-2000-05-14 Eric Melski <ericm@scriptics.com>
-
- * doc/clipboard.n: Added documentation for "clipboard get".
-
- * generic/tkClipboard.c (Tk_ClipboardCmd): Added "clipboard get"
- subcommand [RFE: 4628].
-
- * tests/clipboard.test: Updated to use "clipboard get" instead of
- "selection get -s CLIPBOARD".
-
- * library/entry.tcl: Adjusted Button-1 binding to set focus to the
- entry when it is readonly or normal.
-
- * doc/entry.n: Added documentation for readonly state,
- -disabledforeground, -disabledbackground.
-
- * tests/entry.test: Added tests for readonly state.
-
- * generic/tkEntry.c: Added support for "readonly" state, and
- redefined "disabled" state. A disabled entry will display its
- text in a dimmed color and possibly with a different background,
- and will be completely unusable (no selection, no editing). A
- readonly entry will look like a normal entry, but it will not be
- editable; selection is still allowed. [RFE: 4239]. To support the
- new disabled state properly, "-disabledforeground" and
- "-disabledbackground" options were added.
- *** THIS IS A BACKWARDS INCOMPATIBLE BEHAVIOR CHANGE ***
-
- * win/tkWinDefault.h:
- * mac/tkMacDefault.h:
- * unix/tkUnixDefault.h: Added DEF_ENTRY_DISABLED_FG,
- DEF_ENTRY_DISABLED_BG_COLOR, DEF_ENTRY_DISABLED_BG_MONO.
-
-2000-05-12 Eric Melski <ericm@scriptics.com>
-
- * unix/tkUnixButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
- * mac/tkMacButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
- * win/tkWinButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
- Added code for drawing compound buttons.
-
- * tests/button.test: Added configuration tests for -repeatdelay,
- -repeatinterval, -compound.
-
- * library/button.tcl: Added support for -repeatedelay,
- -repeatinterval options.
-
- * generic/tkOldConfig.c: Changed handling of link relief so that
- proper error messages are used.
-
- * generic/tkButton.h: Added -compound, -repeatdelay,
- -repeatinterval options.
-
- * generic/tkButton.c: Added event watchers for enter/leave events,
- for link relief support.
-
- * generic/tk3d.c: Changed handling of link relief so that proper
- error messages are used.
-
- * generic/tk.h: Changed values of
- TK_OPTION_LINK_OK/TK_CONFIG_LINK_OK for link relief support.
-
-2000-05-12 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinFont.c (LoadFontRanges): improved support for all chars
- in 0-255 range for bitmap ANSI fonts. May be improved to handle
- bitmap non-ANSI fonts in the future. [Bug: 2172]
-
- * win/tkWinWm.c (RaiseWinWhenIdle): added TK_DONT_DESTROY_WINDOW
- to flag check to prevent timing related core dump. [Bug: 5438]
-
-2000-05-11 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinTest.c (TestclipboardObjCmd): ensured CloseClipboard
- would always get called for each OpenClipboard.
-
- * tests/focus.test (focusSetupAlt): removed wm withdraw from proc
- as it would cause a hang for tkwait visibility
-
- * tests/menu.test:
- * generic/tk3d.c:
- * generic/tkColor.c:
- * generic/tkCursor.c: corrected handling of 3DBorder, Cursor and
- Color objects on multiple screens. [Bug: 5454]
-
-2000-05-09 Eric Melski <ericm@scriptics.com>
-
- * doc/button.n: Added documentation for link relief.
-
- * tests/button.test: Added tests for link relief for buttons.
-
- * generic/tk.h (TK_CONFIG_LINK_OK): Added definition of
- TK_RELIEF_LINK, TK_OPTION_LINK_OK and TK_CONFIG_LINK_OK. [RFE: 4348]
-
- * generic/tk3d.c: Added support for link relief. [RFE: 4348]
-
- * mac/tkMacButton.c (TkpDisplayButton):
- * unix/tkUnixButton.c (TkpDisplayButton): Added support for link
- relief. [RFE: 4348]
-
- * generic/tkOldConfig.c (Tk_ConfigureWidget):
- * generic/tkConfig.c (DoObjConfig): Added understanding of link
- relief, which is allowed only for widgets that have
- TK_OPTION_LINK_OK or TK_CONFIG_LINK_OK set for the "-relief"
- option. [RFE: 4348]
-
- * generic/tkButton.c: Added TK_OPTION_LINK_OK to "-relief" option
- for buttons. [RFE: 4348]
-
- * win/tkWinWm.c (EX_TRANSIENT_STYLE): Removed WS_EX_TOOLWINDOW
- style bit, so that transient windows have full-size titlebars
- (like the tk_getOpenFile dialog).
-
- * win/tkWinMenu.c (GetMenuSeparatorGeometry): Tweaked height
- requested for separator bars to be (linespace - (2*descent))
- instead of just (linespace); this makes the separator occupy a
- more correct amount of vertical space. [Bug: 5303].
-
-2000-05-09 Jeff Hobbs <hobbs@scriptics.com>
-
- * library/focus.tcl: fixed calling of takeFocus proc [Bug: 5372]
-
-2000-05-02 Jeff Hobbs <hobbs@scriptics.com>
-
- * README:
- * generic/tk.h:
- * library/tk.tcl:
- * mac/README:
- * unix/README:
- * unix/configure.in:
- * unix/tk.spec:
- * win/README:
- * win/aclocal.m4:
- * win/configure.in:
- * win/makefile.vc: updated patchlevel to 8.4a1
-
- * unix/Makefile.in: added tk.spec to dist target
-
-2000-04-27 Eric Melski <ericm@scriptics.com>
-
- * doc/Tk_Init.3: Added Tk_SafeInit information [Bug: 1884].
-
- * doc/keysyms.n: Man page enumerating keysyms [RFE: 1645].
-
- * doc/colors.n: Man page enumerating valid color names [RFE: 1645].
-
- * doc/cursors.n: Man page enumerating valid cursor values [RFE: 1645].
-
- * library/msgbox.tcl: Corrected Unix tk_messageBox implementation
- to make the first button the default when no default is specified
- [Bug: 2218].
-
- * doc/messageBox.n: Updated documentation with regards to
- selection of default button when none is specified (now it will
- use the first button as the default in that case) [Bug: 2218].
-
-2000-04-26 Jeff Hobbs <hobbs@scriptics.com>
-
- 8.3.1 RELEASE
-
- * README:
- * mac/README:
- * unix/README:
- * unix/tk.spec:
- * win/README: Updating URLs to reference dev.scriptics.com
-
-2000-04-25 Jeff Hobbs <hobbs@scriptics.com>
-
- * unix/Makefile.in:
- * win/Makefile.in: makefile cleanup
-
-2000-04-25 Eric Melski <ericm@scriptics.com>
-
- * generic/tkMain.c: Fixed function header comment for Tk_MainEx.
-
- * unix/mkLinks:
- * doc/GetScroll.3: Added information about Tk_GetScrollInfoObj
- [Bug: 1866].
-
-2000-04-24 Eric Melski <ericm@scriptics.com>
-
- * unix/mkLinks:
- * doc/Grab.3: Man page for Tk_Grab and Tk_Ungrab [Bug: 1868, 1889]
-
- * unix/mkLinks:
- * doc/MainWin.3: Added entry for Tk_GetNumMainWindows [Bug: 1865].
-
- * unix/mkLinks:
- * doc/GetHINSTANCE.3: Man page for Tk_GetHINSTANCE [Bug: 1862].
-
-2000-04-24 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkImage.c (Tk_PostscriptImage): added check to create
- necessary prolog for photos
- * generic/tkCanvPs.c: added Tk_PostscriptPhoto that outputs PS for
- photo images
- * generic/tkImgPhoto.c: new func ImgPhotoPostscript and added that
- in as ps proc in tkPhotoImageType.
- * generic/tkStubInit.c:
- * generic/tkDecls.h:
- * generic/tk.decls: added Tk_PostscriptPhoto
-
- * generic/tkConfig.c (DoObjConfig): removed direct setting of
- interp->result.
-
- * mac/tkMacWm.c (Tk_WmCmd): initialized gotToplevel in
- colormapwindows case (bug found by Reasoning, Inc's automated code
- testing).
-
-2000-04-24 Eric Melski <ericm@scriptics.com>
-
- * unix/mkLinks:
- * doc/GetHWND.3: Man page for Tk_GetHWND [Bug: 1863].
-
- * unix/mkLinks:
- * doc/HWNDToWindow.3: Man page for Tk_HWNDToWindow [Bug: 1869].
-
- * unix/mkLinks:
- * doc/AddOption.3: Man page for Tk_AddOption [Bug: 1854]
-
-2000-04-22 Jim Ingham <jingham@cygnus.com>
-
- * mac/tkMacDialog.c (Tk_MacGetOpenFile): Add empty bodies for the
- "-initialfile" and "-defaultextension" options.
-
- * mac/tkMacDialog.c (NavServicesGetFile): Only cons the result up
- into a list if multiple is true.
-
- * mac/tkMacMenus.c (SourceDialog): Use the "tk_getOpenFile"
- instead of hand-coding the dialog with StandardGetFile. This way
- we get the Navigation dialogs for free.
-
- * doc/getOpenFile.n: Document the -multiple and -message flags
- which are only implemented on the Mac. Also note that the -title
- works on the Mac with Nav Services installed.
-
-2000-04-19 Eric Melski <ericm@scriptics.com>
-
- * doc/WinViewable.3:
- * unix/mkLinks: Removed docs for Tk_IsViewable.
-
- * win/tkWinDialog.c: Removed calls to Tk_IsViewable.
-
- * generic/tkUtil.c:
- * generic/tkStubInit.c:
- * generic/tkDecls.h:
- * generic/tkCmds.c:
- * generic/tk.decls: Removed Tk_IsViewable function (it was not
- actually needed).
-
-2000-04-19 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/aclocal.m4: made SC_PROG_TCLSH search specifically for
- tclsh*.exe type files to find an executable.
-
- * win/Makefile.in: fixed up cleanup, winhelp, cat32 targets
-
- * library/console.tcl: made console use systemfixed font on Win
-
- * generic/tkEntry.c: removed unnecessary ENTRY_VALIDATE #define
-
-2000-04-19 Eric Melski <ericm@scriptics.com>
-
- * generic/tkRectOval.c (ConfigureRectOval): Added checks for valid
- outline settings before creating of outline GC; this means that it
- is really possible now to have an oval or rectangle with no
- outline. [Bug: 5029].
-
-2000-04-19 Jeff Hobbs <hobbs@scriptics.com>
-
- * library/choosedir.tcl (::tk::dialog::file::chooseDir::Config):
- * library/tkfbox.tcl (::tk::dialog::file::Config): removed the
- extraneous glob on -initialdir after file isdir already returned 1
- and moved cd trick into this case as the else already uses [pwd].
- [Bug: 5181]
-
- * win/winMain.c: moved extern call out of WinMain func
-
- * README:
- * generic/tk.h:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in: bumped to version 8.3.1
-
- * library/msgbox.tcl (tkMessageBox): changed to use grid in some
- places, realign icon to anchor nw.
-
- * mac/tkMacScale.c: reverted tkMacScale.c to 1.5 equivalent (it
- was accidentally bumped forward).
-
-2000-04-18 Eric Melski <ericm@scriptics.com>
-
- * win/tkWinPointer.c: Changed Mod2Mask in TkWinGetModifierState to
- ALT_MASK, to fix some event problems [Bugs: 1160, 5088].
-
- * win/tkWinX.c: Changed Mod2Mask in GetState to ALT_MASK, to fix
- some event problems [Bugs: 1160, 5088].
-
- * generic/tkInt.h: Moved definition of ALT_MASK and META_MASK here
- so that it would be accessible from other modules than tkBind.c.
-
- * generic/tkBind.c: Added code in BindEvent to check for ALT_MASK
- and META_MASK in the event state field, as this field may not be
- set up with the correct display modifier mask bits if the XEvent
- structure was created by [event generate] or by the Windows X
- emulation. [Bugs: 1160, 5088].
-
-2000-04-18 Scott Redman <redman@HILO>
-
- * win/tk.rc:
- * win/wish.rc:
- * win/wish.ico: Modified copyright dates in Windows resource
- files. Updated the icon for wish.exe.
-
-2000-04-17 Eric Melski <ericm@scriptics.com>
-
- * win/tkWinDialog.c: Added checks for visibility of parent window
- before creating MessageBox and ChooseColor dialogs; this prevents
- the application from locking when the parent is withdrawn and the
- message box is created. In these cases, the window will be
- created without a parent.
-
- * unix/mkLinks: Added WinViewable.3.
-
- * tests/msgbox.test: Added tests for patch from [Bug: 4997].
-
- * library/msgbox.tcl:
- * library/dialog.tcl: Applied patch from [Bug: 4997]; detaches
- dialog window from parent if parent is not viewable.
-
- * library/bgerror.tcl: Removed workaround from [Bug: 4370]; this
- is superceeded by patches to dialog.tcl.
-
- * generic/tkCmds.c: Changed WinfoObjCmd to use Tk_IsViewable
- function to determine visibility of windows instead of inlining
- the code.
-
- * generic/tkStubInit.c:
- * generic/tkDecls.h:
- * generic/tk.decls: Added Tk_IsViewable declaration.
-
-2000-04-17 Eric Melski <ericm@scriptics.com>
-
- * library/text.tcl: Tweaked double-/triple-click selection;
- previously, anchor and insert marks were placed in unexpected
- locations following a double or triple click. Now they are placed
- logically. Also tweaked the extension of selection via
- shift-double-clicks so that it no longer selects the contiguous
- whitespace on the side of the selection opposite the
- double-click. [RFE: 4253].
-
- * doc/menu.n: Added note regarding rendering of
- checkbuttons/radiobuttons in menubars on different platforms --
- some systems do not draw indicators for check/radiobuttons in
- menubars.
-
- * library/menu.tcl: Corrected behavior of
- checkbuttons/commands/radiobuttons in menubars [Bug: 630].
-
- * tests/grid.test: Added test for [grid propagate . 0] to not toggle.
-
- * generic/tkGrid.c: Fixed bogus logic in [grid propagate] that
- caused [grid propagate . 0] to act as a toggle instead of an
- absolute set. [Bug: 2286].
-
-2000-04-16 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinColor.c (FindSystemColor): correct calculation of
- colors when shifting value. [Bug: 4919]
-
-2000-04-16 Jim Ingham <jingham@cygnus.com>
-
- * mac/tkMacPort.h: protect against strncasecmp already defined -
- it is in the Pro5 version of MSL.
-
- * mac/tkMacWindowMgr.c (GenerateKeyEvent): Check for a null tkWin.
- If the hidden window we use for double-buffering controls manages
- to percolate to the top (should never happen, but...) this will
- keep us from crashing.
-
- * mac/tkMacButton.c (InitSampleControls): Hide the
- double-buffering window BEHIND the first "." window you can find.
- This will keep it from ever being the front window, and thus a
- black hole for events. * mac/tkMacButton.c (ButtonEventProc):
- Disable the controls when the window is in the background. This
- is required by the MacOS HIG. This doesn't always get called when
- it should, it still needs more work.
-
- * mac/tkMacDialog.c: Pretty substantial rewrite to include
- Navigation Services support for systems which have it.
-
-2000-04-14 Eric Melski <ericm@scriptics.com>
-
- * win/tkWinKey.c: Added check for ASCII delete character in
- KeycodeToKeysym, to fix [Bug: 5090]. See comment in code for more
- information.
-
- * generic/ks_names.h: Added Scroll_Lock and Sys_Req definitions.
-
- * win/tkWinKey.c: Changed implementation of KeycodeToKeysym,
- et. al., to use a keycode table for lookups; this will result in
- faster keycode -> keysym translations for non-ASCII keys like
- Control, Alt, etc.
-
-2000-04-14 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinWm.c (WmProc): added check in WM_MOUSEACTIVATE so we
- correctly activate native menus when clicking in when we didn't
- have focus [Bug: 2272]
-
- * generic/tkCanvas.c (CanvasEventProc:2451): corrected cast
-
- * generic/tkEntry.c (Tk_EntryObjCmd): adjusted finishing error
- cases and changed TK_CONFIG_NULL_OK to TK_OPTION_NULL_OK
-
- * tests/scale.test:
- * generic/tkScale.c:
- * generic/tkScale.h:
- * unix/tkUnixScale.c:
- * mac/tkMacScale.c: moved (PixelToValue|ValueToPixel|SetScaleValue)
- to tkScale.c. Caused an associated variable to be immediately set
- [Bug: 4833]
-
- * library/scale.tcl (tkScaleActivate): reduced number of scale
- redisplays by checking current value of state before setting it
- again. [Bug: 4191]
-
- * tests/winDialog.test: tk_chooseDirectory seems to get a noop
- from GetOpenFileName in the static build, hanging some tests.
- The tests were fixed to timeout (noop cause unknown).
-
- * unix/aclocal.m4 (SC_ENABLE_THREADS): enhanced the detection of
- pthread_mutex_init [Bug: 4359] and (SC_CONFIG_CFLAGS) added
- --enable-64bit-vis switch for Sparc VIS compilation [Bug: 4995]
-
-2000-04-13 Eric Melski <ericm@scriptics.com>
-
- * win/tkWinKey.c: Added smarts to check whether the left or right
- Control, Shift, or Alt key was pressed. [Bug: 870].
-
- * win/tkWinMenu.c: Corrected code that created separator items on
- menus; originally, it requested that the system be responsible for
- drawing those items, so it would ignore configuration items like
- the widget background. Now, we draw the separators ourselves (as
- we do with every other kind of menu item already). [Bug: 1166].
-
- * win/tkWin3d.c:
- * unix/tkUnix3d.c: Applied patch from [RFE: 2501]: adds more
- sophisticated smarts to TkpGetShadows, so that the highlight of a
- very bright color is actually distinguishable from the color, and
- the shadow of a very dark color is similarly distinguishable from
- the color.
-
- * generic/tkCanvas.c: Applied patch from [Bug: 4202]; adds a check
- for NULL tkwin in Tk_CanvasEventuallyRedraw.
-
-2000-04-12 Jeff Hobbs <hobbs@scriptics.com>
-
- * test/winClipboard.test:
- * win/tkWinInt.h:
- * win/tkWinClipboard.c (UpdateClipboard):
- * win/tkWinX.c (GenerateXEvent): added updatingClipboard tsd and
- TkWinUpdatingClipboard accessor function to allow us to flag
- ourselves when we are the ones updating the clipboard. This
- corrected inability to create our own clipboard types within a Tk
- application. [Bug: 2338 4318]
- * win/tkWinTest.c (TestclipboardCmd): improved TestclipboardCmd
- with better error handling and obj'ification
-
-2000-04-11 Eric Melski <ericm@scriptics.com>
-
- * msgcat.n: Added docs for new behavior from patch in [Bug: 4158].
-
- * msgcat.test: Added tests for new behavior from patch in [Bug:
- 4158].
-
- * msgcat.tcl: Applied patch from [Bug: 4158], which enables
- msgcat::mc to search the entire namespace ancestry chain for
- message translations (ie, first it checks the current namespace,
- then the parent, then the parent's parent, etc). Also allows the
- specification of additional args for msgcat::mc; if extra args are
- given, the [format] command is used to substitute the additional
- args in the translated message.
-
- * library/bgerror.tcl: Moved check for withdrawn state after check
- for tkerror; this was causing problems when tkerror was used.
-
-2000-04-10 Eric Melski <ericm@scriptics.com>
-
- * library/bgerror.tcl: Added check for withdrawn state of . and
- unsetting of transient bit for .bgerrorDialog if . is not
- viewable; this protects against the application hanging on systems
- like Windows, where transient windows are withdrawn with their
- parents. [Bug: 4370].
-
- * tests/event.test: Added test for [event generate $widget
- <Alt-z>] [Bug: 4611].
-
- * tests/choosedir.test: Changed "namespace import ::tcltest" to
- "namespace import -force ::tcltest".
-
- * win/tkWinKey.c:
- * unix/tkUnixKey.c:
- * mac/tkMacKeyboard.c: Changed InitKeymapInfo to
- TkpInitKeymapInfo. [Bug: 4611].
-
- * generic/tkStubInit.c:
- * generic/tkIntDecls.h: Re-gen'd from tkInt.decls.
-
- * generic/tkInt.decls: Added TkpInitKeymapInfo to list of function
- decls.
-
- * generic/tkBind.c (HandleEventGenerate): Added code to initialize
- keymap info if necessary, and to correctly set modifier bits in
- XEvent structure create to handle [event generate] calls.
- Previously, the alt/meta bits were not set correctly, so [event
- generate $widget <Alt-z>] would always fail. [Bug: 4611]
-
-2000-04-07 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkGrid.c (InitMasterData): fixed uninit'd data in
- GridMaster struct [Bug: 4387]
-
- * library/safetk.tcl (disallowTk): made disallowTk work in the
- simple case.
-
- * library/comdlg.tcl (tkFocusGroup_In): fixed key navigation
- problems in dialogs under CDE [Bug: 2960]
-
- * tests/winDialog.test: removed knownBug constraint from 5.16
-
- * win/tkWinFont.c (GetScreenFont): corrected adjustment against
- LC_FACESIZE limitation for NT [Bug: 4931]
-
- * win/makefile.vc (TKTEST_OBJS):
- * win/Makefile.in (TKTEST_OBJS): moved tkWinTest.c from normal
- objs to TKTEST_OBJS where it belonged.
-
-2000-04-03 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkTest.c: fixed incorrect platform inclusion for
- TkplatformtestInit (it would never get called).
-
- * unix/Makefile.in (MAN_INSTALL_DIR): patch to accept --mandir
- correctly [Bug: 4085]
-
- * library/clrpick.tcl (tkColorDialog_Config): error now thrown
- when -initialcolor "" specified. [Bug: 4198]
-
-2000-03-31 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/DrawFocHlt.3: doc name correction
-
- * generic/tkEntry.c: set TK_OPTION_NULL_OK bit on -invcmd option
- and removed #ifdef ENTRY_VALIDATE expressions
-
- * library/menu.tcl (tkMenuInvoke): corrected naming of tearoffs
- [Bug: 4506]
-
- * library/tkfbox.tcl (tkIconList_Goto): caused browsecmd to be
- called in tkIconList_Select. This causes the entry to be set
- properly when using the type-in-name-in-listbox bindings.
-
- * win/tkWinDialog.c: added unicode-aware open/save file dialogs
-
- * win/tkWinFont.c (TkpFontPkgInit): move private ref to platformId
- to TkWinGetPlatformId
-
- * win/tkWinMenu.c (SetDefaults): moved private use of versionInfo
- to TkWinGetPlatformId and removed all code for
- (versionInfo.dwMajorVersion < 4) (== Win32s)
-
- * win/tkWinX.c:
- * win/tkWin32Dll.c: moved TkWinGetPlatformId to tkWinX.c
- * win/tkWinInit.c: added TkWinXInit to TkpInit to ensure that its
- called for static Windows shells. [Bug: 3647]
-
- * win/tkWinInt.h:
- * win/tkWinX.c:
- * win/tkWinDraw.c (SetUpGraphicsPort):
- * win/tkWinScrlbr.c (UpdateScrollbar): removed use of tkpIsWin32s
-
- * win/tkWinInt.h (TkWinDCState struct): added bkmode value
- * win/tkWinDraw.c (TkWinGetDrawableDC, et al): added support for
- properly transparent dashed lines on Windows. [Bug: 4617]
-
-2000-03-30 Eric Melski <ericm@scriptics.com>
-
- * generic/tkImgGIF.c: Fixed some ANSI specific bits to avoid
- compile problems with non-ANSI compilers (ie, replace const with
- CONST, etc). [Bug: 4223].
-
- * unix/configure.in: Applied patch from [Bug: 4237]; ensures that
- srcdir is fully qualified.
-
- * unix/Makefile.in: Applied patch from [Bug: 4237]; if tcltest was
- not compiled, make test/tktest failed. Now it has a rule to build
- tcltest if it has not been built.
-
-2000-03-28 Eric Melski <ericm@scriptics.com>
-
- * library/tkfbox.tcl: Moved an overlooked tkFDialog* function in
- ::tk::dialog::file namespace.
-
- * tests/unixWm.test: Added tests for memory leak conditions in
- tkUnixWm.c.
-
- * tests/canvas.test: Added test for bad configuration options on
- empty and non-empty canvas.
-
- * generic/tkCanvas.c: Removed bad code in CANV_CONFIGURE block of
- CanvasWidgetCmd; this was causing non-empty canvases to improperly
- handle bad configuration options [Bug: 4456].
-
-2000-03-27 Eric Melski <ericm@scriptics.com>
-
- * unix/tkUnixWm.c: Applied patch from [Bug: 4405]; fixes memory
- leak in Unix wm command.
-
-2000-03-24 Eric Melski <ericm@scriptics.com>
-
- * tests/filebox.test:
- * tests/choosedir.test: Updated tests.
-
- * library/xmfbox.tcl: Updated to stash data array in
- ::tk::dialog::file namespace instead of in global namespace.
-
- * library/tkfbox.tcl: Extended some functions to support creation
- of a choosedir dialog, to allow greater code reuse between the two
- dialogs. Moved tkFDialog* functions into a namespace
- (::tk::dialog::file). Because these are private Tk functions (and
- should thus not be used directly by users), this should not impact
- anybody (the tk_getOpenFile and tk_getSaveFile commands still
- exist at the global scope).
-
- * library/tk.tcl:
- * library/tclIndex: Updated function names for tkFDialog*
- functions and choosedir functions.
-
- * library/choosedir.tcl: New and improved implementation of
- tk_chooseDirectory dialog. Based on tk_getOpenFile dialog.
-
-2000-03-23 Eric Melski <ericm@scriptics.com>
-
- * generic/tkWindow.c:
- * generic/tkInt.h: Updated Tcl_OptionCmd -> Tcl_OptionObjCmd
-
- * generic/tkOption.c: Tcl_Obj'ectified the "option" command.
-
-2000-03-22 Eric Melski <ericm@scriptics.com>
-
- * library/listbox.tcl (tkListboxCancel): Added a check for empty
- string value for tkPriv(listboxPrev). Without this check, it's
- possible to get a stack trace under certain conditions. [Bug: 4373].
-
-2000-03-15 Sven Delmas <sven@scriptics.com>
-
- * win/tkWinDialog.c: Changed the behavior for the
- tk_chooseDirectory dialog under Windows. Instead of trying to
- return the currently selected listbox entry (which didn't work in
- case the user selected the initial directory anyway), we now
- return the value shown in the entry. This seems to be in
- accordance with the expected behavior for this dialog.
-
-2000-03-14 Eric Melski <ericm@scriptics.com>
-
- * tests/choosedir.test: Marked test 3.1 and 3.2 as bad until the
- issue with those tests on IRIX can be determined.
-
-2000-03-10 Eric Melski <ericm@scriptics.com>
-
- * library/menu.tcl: Applied patch from [Bug: 4155]; protects
- against grabs on non-viewable windows.
-
-2000-03-08 Eric Melski <ericm@scriptics.com>
-
- * tests/choosedir.test: Modified test 3.1 (-mustexist works) to be
- more careful about cleaning up its potentially troublesome after
- events.
-
-2000-03-07 Eric Melski <ericm@scriptics.com>
+ * generic/tkGrid.c: Fixed bug in geometry calculations for widgets that
+ span multiple columns/row. Bug was introduced in 8.5a1 when fixing
+ 792387. [Bug 1175092]
- * tests/button.test:
- * generic/tkButton.c: Added -disabledforeground/-state to labels.
+2005-03-29 Jeff Hobbs <jeffh@ActiveState.com>
-2000-03-07 Jeff Hobbs <hobbs@scriptics.com>
+ * win/tcl.m4, win/configure: do not require cygpath in macros to allow
+ msys alone as an alternative.
- * tests/entry.test:
- * generic/tkEntry.c (EntrySetValue): malloc the value when
- validating because validation could cause the pointer to become
- invalid. Also fixed configure to not trigger focus-based
- validation. Improved use of Tcl_WrongNumArgs. [Bug: 4320]
+2005-03-27 Vince Darley <vincentdarley@users.sourceforge.net>
-2000-03-06 Eric Melski <ericm@scriptics.com>
+ * tests/textDisp.test: added test for fix of 2005-03-15.
- * library/menu.tcl: Added a check in tkMenuFirstEntry that changes
- menu behavior to only auto-post an immediate child cascade if we
- are currently on a menubar menu. This prevents massive
- auto-cascading in cases where the first entry of the cascade is
- itself a cascade, and the first entry of that cascade is a
- cascade, and the first entry of that cascade is a cascade
- ... [Bug: 676].
+2005-03-24 Jim Ingham <jingham@apple.com>
- * generic/tkOldConfig.c: Added check for NULL tkwin value in
- Tk_ConfigureWidget [Bug: 4079]
+ * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): Dopey bug - do
+ not reset the width for entry widgets - we didn't change it for them.
- * generic/tkWindow.c: Added check for NULL tkwin value in
- Tk_NameToWindow [Bug: 4079]
+2005-03-23 Jim Ingham <jingham@apple.com>
-2000-03-02 Jeff Hobbs <hobbs@scriptics.com>
+ These changes allow us to draw the Entry and Spinbox widget with a
+ native look and feel on Mac OS X.
- * tests/color.test:
- * xlib/xcolors.c (XParseColor FindColor):
- * win/tkWinColor.c (XAllocColor): Fixed bit fiddling for colors to
- return "correct" values for color mapping. [Bug: 4282]
+ * generic/tkEntry.h: New file, extracting the definitions of Entry and
+ Spinbox.
+ * generic/tkEntry.c (DisplayEntry): Call out to TkpDrawSpinboxButtons
+ and TkpDrawEntryBorderAndFocus. Also provide default implementations
+ for X11 & Win.
+ * macosx/tkMacOSXEntry.c: New file, implements the entry & focus and
+ spinbox button drawing.
+ * tkMacOSXDefaults.h: Change the Mac OS X defaults so they fit the
+ native widget shapes.
- * unix/Makefile.in (SCRIPT_INSTALL_DIR): removed extraneous '/'
- * unix/aclocal.m4: corrected TCL_NEEDS_EXP_FILE to be 1 for AIX
+ This is cleanup thanks to Neil Madden <nem@cs.nott.ac.uk>.
- * win/tkWinInt.h: change extern to EXTERN for TkWinChildProc
- declaration with extra #defs. [Bug: 4240]
-
- * library/focus.tcl: fixed tkFocusOK to protect $w in
- uplevel with list. [Bug: 4208]
-
- * doc/CrtItemType.3: fixed docs for Tk_CreateItemType to reflect
- changes made in 8.3.0 (but old style would still work as well).
- [Bug: 4252]
-
- * tests/config.test: extra test to check object cleanup when
- destroying the widget
- * generic/tkListbox.c (DestroyListbox): fixed crash in
- DestroyListbox due to null tkwin. [Bug: 4207]
-
- * tests/entry.test: added test suite for entry validation
- * doc/entry.n: improved docs discussing caveats and gotchas when
- mixing textvar with widget validation
- * generic/tkEntry.c (EntryValidateChange): improved handling of
- validation with relation to -textvariable. Previously, it would
- turn off whenever the textvar was set. Now it will it will turn
- off only when the textvar is set and validation returns 0. Added
- %V (type of validation occuring) to %-subs to help work with
- trickier validation.
-
-2000-03-01 Eric Melski <ericm@scriptics.com>
-
- * tests/clrpick.test:
- * library/clrpick.tcl: Added code to make color chooser dialog
- inherit screen setting from parent (bug #2334)
-
-2000-02-25 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinWm.c (RaiseWinWhenIdle): Checked for the possibility
- that the window could be destroyed (can occur with
- wm deiconify .toplevel; destroy .toplevel).
-
-2000-02-25 Eric Melski <ericm@scriptics.com>
-
- * generic/tkImgGIF.c: Applied "spirit of" the patch in 1605 (the
- submitted patch was more complicated than necessary and did not
- extend to writing GIF's, only reading), to allow reading/writing
- of GIF files on EBCDIC and other non-ASCII based systems.
-
-2000-02-14 Eric Melski <ericm@scriptics.com>
-
- * unix/tk.spec: RPM specification for producing a binary Tk RPM
- for Linux.
-
- * unix/Makefile.in: Added rpm target to generate Tk
- binary RPM.
-
-2000-02-10 Jeff Hobbs <hobbs@scriptics.com>
-
- 8.3.0 RELEASE
-
- * changes: updated for 8.3.0 release
-
- * generic/tkImgGIF.c (FileReadGIF): added cast for trashBuffer
-
- * generic/tkIntXlibDecls.h:
- * generic/tkInt.decls: declared some Xlib emulation calls for
- the Mac
-
- * generic/tkFrame.c (TkInstallFrameMenu): added extra panic to
- inform user of bad call when framePtr is NULL [Bug: 2530]
-
- * generic/tkMenu.c (DestroyMenuInstance): Placed checks around
- menu name objects before trying to incr the ref. [Bug: 3402]
-
- * generic/tkTest.c: removed USE_OLD_IMAGE def for Mac
-
- * library/listbox.tcl:
- * library/text.tcl: added support for <4> and <5> for mousewheel
- style scrolling on Unix for mice that map to these buttons.
-
- * tests/scrollbar.test: fixed check of testmetrics command to
- allow unix tests to run (testmetrics is mac/pc only)
-
- * unix/tkUnixWm.c (Tk_CoordsToWindow): qualified delete of error
- handler as the goto label is reached from above and below.
-
- * unix/configure.in:
- * unix/aclocal.m4: cleaned up macros to coincide with tcl.m4,
- added -export-dynamic to LDFLAGS for FreeBSD-3+ [Bug: 2998]
-
- * unix/README:
- * unix/Makefile.in (dist): removed porting.notes and porting.old
- from distribution and CVS. The information was very outdated. Now
- refer to http://dev.scriptics.com/services/support/platforms.html
-
- * xlib/xgc.c: #def'd out XDrawSegments for the Mac, and added
- some extra include info for the Mac
-
-2000-02-09 Jim Ingham <jingham@cygnus.com>
-
- * mac/tkMacButton.c: Stop removing the appearance window from the
- Window List. It is not clear why Ray did this, and it causes the
- Appearance manager to crash at random times.
-
- * mac/tkMacWM.c: Add support in unsupported1 style for the Appearance
- specification of window styles, including floating window support.
- * mac/tkMacWindowMgr.c: Operate on the front non-floating window,
- unless the mouse is directly over the floating window. Also,
- keystrokes go to the front non-floating window.
- * mac/tkMacAppInit.c: Initialize floating window support.
- * mac/tkMacScrlbr.c:
- * mac/tkMacmenu.c: Fixes for floating windows - operate on the
- FrontNonFloatingWindow.
- * mac/tkMacLibrary.r: Fix typo in File info string.
- * mac/tkMacApplication.r: Fix typo in file info string. Add
- Finder balloon help for no apparent reason.
-
- * mac/tkMacSubwindows.c: Change panic in tkMacGetDrawablePort to
- Debugger. This is only a temporary fix. The panic is only
- triggered when a safeTk interpreter is torn down, and ignoring it
- does no harm. I haven't figured out how to avoid it yet, however.
- Also use the Appearance MoveWindowStructure call when available.
-
- New Files:
- * MW_TkOldImageHeader.h: Handle #defining USE_OLD_IMAGE for tkImgPPM.c.
- * MW_TkTestHeader.h:
- * MW_TkTestHeader.pch:
- * MW_TkHeader.h: Add separate prefix files for test & release
- versions of Tk, so we can just have separate targets w/o having to
- edit files.
-
- * tclets.r: The D&D Tclets icon in rez form so we can have a
- target for this.
-
- The above are curtesy of Daniel Steffen (steffen@math.mq.edu.au)
-
- * tkMacAppearanceStubs.c: Stubs of the Mac Appearance calls I use
- so I can link the static 68K Shell without putting ifdef's all
- over the code.
-
-2000-02-08 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tk.decls:
- * generic/tkBind.c:
- * generic/tkInt.decls:
- * generic/tkIntDecls.h:
- * generic/tkStubInit.c:
- * mac/tkMacKeyboard.c:
- * unix/tkUnixKey.c:
- * win/tkWinKey.c: Fix for keyboard handling of "dead" keys and
- caps lock from Peter Spjuth. [Bug: 4105 3359 2493]
- Split functions into platform specific files:
- Static functions GetKeySym(), SetKeycodeAndState() and InitKeymapInfo()
- from tkBind.c moved into platform files tkWinKey.c tkUnixKey.c and
- tkMacKeyboard.c. GetKeySym() and SetKeycodeAndState() renamed to
- Tkp* and made public (as private functions) in tkInt.decls.
-
- Step 2, fixes in tkWinKey.c
- New static function: KeycodeToKeysym(), based on XKeycodeToKeysym()
- but with different arguments, and a lot of improvements.
- TkpGetString() changed to use KeycodeToKeysym() + other fixes.
- TkpGetKeySym() changed to use KeycodeToKeysym() + other fixes.
- InitKeymapInfo() changed to use KeycodeToKeysym().
- TkpSetKeycodeAndState() rewritten, mostly by copying code from
- XKeysymToKeycode().
- XKeycodeToKeysym() rewritten. Preferably it should be removed.
-
- EXPLANATION: The main problem is ToAscii() which has a lot of side
- effects, and also that XKeycodeToKeysym() is not provided enough
- input to do a proper job. The changes' main goal is to avoid
- calling ToAscii() if not necessary, and to provide it with as
- correct information as possible when called. Also some attempts
- to clean up what ToAscii() did are done. See the code for details.
-
- BUGS FIXED: Typing shifted (and AltGr) dead keys did not work.
- Keyboard lock lamps did not work on Win98.
- Events regarding AltGr-keys behaved badly.
- Example: On a Swedish keyboard, $ is typed with AltGr-4.
- That keyboard event would get the keysym '4' not 'dollar'.
- Also, doing [event generete . <Key-dollar>] would send keysym '4'.
- Translation to ascii in TkpGetString did not handle return and
- tab correctly. I.e. [event generate . <Key-Return>] gave wrong %A
-
- * generic/tkDecls.h:
- * generic/tk.decls:
- * generic/tk.h: moved new public functions created in dash patch
- to the stubs interface [Bug: 4062]
-
- * generic/tk.h:
- * doc/CrtImgType.3:
- * doc/CrtPhImgFmt.3:
- * generic/tk.h:
- * generic/tkImgGIF.c:
- * generic/tkImgPhoto.c:
- * generic/tkStubImg.c (new file):
- * generic/tkTest.c:
- * unix/Makefile.in:
- * win/Makefile.in:
- * win/makefile.vc: improved support for moving from the old style
- image C API to the new obj'ified one with new Tk_InitImageArgs
- command and stub'ing of image code. See docs for how to make the
- transition. [Bug: 4060]
-
- * library/tk.tcl: wrapped check for tcl_platform(os) around info
- exists because it won't in safe interpreters
-
- * win/tkWinFont.c: corrected symbol font use to only work on 8-bit
- characters [Bug: 2406]
-
- * unix/aclocal.m4: changed all -fpic to -fPIC
-
- * README:
- * unix/configure.in:
- * win/configure.in:
- * generic/tk.h (TK_RELEASE_SERIAL): Moved to 8.3.0 patchlevel
-
-2000-02-07 Eric Melski <ericm@scriptics.com>
-
- * library/tkfbox.tcl: Applied patch from bug #4117,
- tk_getOpenFile/getSaveFile doesn't do the right thing when user
- types a directory name in the entry and a default extension is
- specified.
-
-2000-02-05 Jeff Hobbs <hobbs@scriptics.com>
-
- * unix/tkUnixScale.c (TkpDestroyScale): changed ckfree to
- Tcl_EventuallyFree to behave with Tcl_Preserve in TkpDisplayScale
- (prevents possible segfault).
-
-2000-02-03 Eric Melski <ericm@scriptics.com>
-
- * tests/canvText.test: test for fix for bug #2525.
-
- * generic/tkFont.c (Tk_ComputeTextLayout): Was erroneously setting
- the width of newline-only text display chunks to some arbitrary
- huge number, instead of 0; this was interfering with things like
- the canvas find enclosed feature. (bug #2525).
-
- * tests/text.test:
- * generic/tkText.c (DumpLine/DumpSegment): Changed DumpSegment to
- take a TkTextIndex instead of two integer offsets, so that it
- could use TkTextPrintIndex to format the offsets into an index,
- which makes it UTF smart (bug #2582).
-
-2000-02-01 Eric Melski <ericm@scriptics.com>
-
- * library/tk.tcl:
- * library/tclIndex:
- * library/choosedir.tcl: Moved choosedir functions into the
- ::tk::dialog::chooseDir namespace instead of a toplevel
- ::tkChooseDirectory namespace. Additional cleanup on the
- chooseDir dialog.
-
-2000-02-01 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/text.n: clarified docs on what happens during a search with
- -count when images/windows are embedded
-
- * win/Makefile.in (install-*): reduced verbosity of install
-
- * win/tkWinPixmap.c (XGetGeometry): added support for windows in
- XGetGeometry [Bug: 4069]
-
- * win/tkWinFont.c (GetScreenFont): fixed possible mem overrun with
- long font names [Bug: 4108]
-
- * win/tkWinDialog.c: added EnableWindow calls to dialogs to
- correct for possible loss of control in parent Tk toplevel
- [Bug: 1212 et al]
-
- * generic/tkRectOval.c (ConfigureRectOval):
- * generic/tkCanvLine.c (ConfigureLine):
- * generic/tkCanvPoly.c (ConfigurePoly):
- * generic/tkCanvArc.c (Configure/DisplayArc): fixed handling for
- negative dash values [Bug: 4104]
-
- * generic/tkScale.c (TkRoundToResolution): fixed incorrect
- assumption that (N+1)*delta = N*delta + delta with floating point
- math [Bug: 3689, 4099]
- (DestroyScale) Fixed check for cancelling TkpDisplayScale (was
- REDRAW_ALL, is now REDRAW_PENDING)
-
- * tests/listbox.test: corrected test case for listbox itemconfigure
-
- * unix/aclocal.m4: added *BSD ELF recognition for
- SHARED_LIB_SUFFIX determination (from Tcl's tcl.m4)
-
-2000-01-27 Eric Melski <ericm@scriptics.com>
-
- * generic/tkImgPhoto.c: Removed unneccesary object translation in
- MatchStringFormat (bug #4103).
-
-2000-01-27 Eric Melski <ericm@scriptics.com>
-
- * generic/tkImgGIF.c: Additional code cleanup (now we only have
- one decoder! neat!)
-
-2000-01-26 Eric Melski <ericm@scriptics.com>
-
- * doc/getOpenFile.n:
- * doc/chooseDirectory.n: Man page/cross links for
- tk_chooseDirectory (bug #1786).
-
- * library/tk.tcl:
- * library/tclIndex: Added hooks for tk_chooseDirectory. (bug #1786)
-
- * library/choosedir.tcl: tk_chooseDirectory implementation for
- Unix/Mac (bug #1786).
-
- * generic/tkImgPhoto.c: Added some comments regarding slow
- processing of transparent images.
+ * macosx/tkMacOSXWm.c (TkMacOSXWinStyle) New function.
+ (TkUnsupported1ObjCmd): New function, replaces the un-objectified
+ version of the command.
+ * generic/tkInt.h: Swap TkUnsupported1Cmd for TkUnsupported1ObjCmd.
+ * generic/tkWindow.c (): Ditto.
- * generic/tkImgGIF.c: Improved GIF decoder for ~60% speed
- increase. Added some comments on how to further improve the
- implementation, time permitting.
+ This adds a "-notify" flag to "wm attributes" that will bounce the
+ dock icon on Mac OS X. This is from Revar Desmera <revarbat@gmail.com>
- * doc/photo.n: Added a description of what the -data string can
- contain (base64 or binary data).
+ * macosx/tkMacOSXWm.c (WmAttrGetNotifyStatus, WmAttrSetNotifyStatus):
+ New functions.
+ (WmAttributesCmd): Add the -notify.
+ * doc/wm.n: Document -notify.
- * generic/tkImgPhoto.c: Fixed bug with use of binary data for
- "-data" option to "image create" command.
+2005-03-19 Donal K. Fellows <dkf@users.sf.net>
-2000-01-21 Eric Melski <ericm@scriptics.com>
+ * generic/tkConsole.c (Tk_CreateConsoleWindow,TkConsolePrint): Rewrite
+ so that TkConsolePrint cannot become detached from the console when the
+ [console] command is renamed. [Bug 1016385]
- * library/tkfbox.tcl: Fixed bug relating to incorrect parent
- values for error message boxes displayed by the file dialog (bug
- #3616).
+2005-03-15 Vince Darley <vincentdarley@users.sourceforge.net>
- * tests/text.test:
- * generic/tkText.c: Fixed bug relating to regexp searching for
- empty lines; previously, the starting line was ignored. (bug #1643).
+ * generic/tkTextDisp.c: fix for [Bug 1143776] in adjusting displayed
+ lines when running into the bottom of the window.
-2000-01-20 Jeff Hobbs <hobbs@scriptics.com>
+2005-03-14 Jim Ingham <jingham@apple.com>
- * library/text.tcl: fixed double-click selection behavior where
- there were embedded windows/widgets in the same line. [Bug: 3989]
+ * macosx/tkMacOSXScrlbr.c (ThumbActionProc): No need to use "update
+ idletasks" here, TclServiceIdle will do as well and it is simpler.
- * win/tkWinWm.c (TkWmProtocolEventProc): cached atom name as the
- window could get destroyed during eval [Bug: 2513]
+ These changes implement a change on the Mac OS X side. When we unmap a
+ window we mark all its children as unmapped (not following toplevels.
+ But we preserve whether they had been mapped before, and when the
+ parent is remapped, we remap the children as well. [Bug 940117]
- * generic/tkCanvLine.c (LineCoords): fixed segfault when too few
- coords were passed to a line with certain options set (it should
- always have thrown an error anyway). [Bug: 4042]
+ * macosx/tkMacOSXInt.h: Added TK_MAPPED_IN_PARENT
+ * macosx/tkMacOSXSubwindows.c (FixMappingFlags): New function.
+ (XMapWindow): Call FixMappingFlags.
+ (XUnMapWindow): Ditto.
- * tests/text.test:
- * generic/tkText.c: fixed missing " in error case and missing
- 'dump' in subcommand listing [Bug: 4036]
+ * macosx/tkMacOSXSubwindows.c (XMoveResizeWindow): Update the xOff &
+ yOff data in the Macdrawable even if the native window hasn't been
+ created yet. [Bug 700305]
+ (XMoveWindow): Ditto.
+ (XResizeWindow): Ditto.
- * generic/tkListbox.c: adjusted use of basic string concatenation
- in (non-K&R behavior) [Bug: 4027]
- Swapped bg/fg class for -select(bg|fg) for listbox and their
- items [Bug: 4039]
+2005-03-15 Pat Thoyts <patthoyts@users.sourceforge.net>
- * unix/mkLinks:
- * doc/WindowId.3: added docs for Tk_IsContainer and Tk_IsEmbedded
+ * unix/tcl.m4: Updated the OpenBSD configuration and regenerated the
+ * unix/configure: configure script.
- * doc/text.n: clarified mark gravity definition and usage of
- ``word'' in binding definitions. [Bug: 2004 2277 1388]
+2005-03-14 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * generic/tkInt.h: moved new TkDisplay useInputMethods structure
- element to end to not disturb position of previous elements in
- the structure (as compared to Tk <=8.2).
+ * generic/tkEvent.c (InvokeClientMessageHandlers): Ensure that client
+ messages are handled correctly. Thanks to George Petasis for tracking
+ this down. [Bug 1162356]
-2000-01-20 Eric Melski <ericm@scriptics.com>
+2005-03-11 Jim Ingham <jingham@apple.com>
- * tests/grid.test: Added a test for the consecutive ^ and multiple
- widget case (bug #1386).
+ * macosx/tkMacOSXButton.c (TkpDisplayButton): Set the port to the
+ Button window's port BEFORE you set the clip, otherwise you are setting
+ the clip on the wrong window!
+ Also, a little cleanup - move x & y into the branches where they are
+ used, and don't compute the TextAnchor if we are using the native
+ button text, since we aren't going to use it.
+ (TkMacOSXDrawControl): Call ShowControl & SetControlVisibility in a
+ more logical order.
- * generic/tkGrid.c: Fixed interpretation of consecutive ^
- characters in grid command. Previously, ^ ^ was interpreted as
- meaning that there must be a 2-column widget above to extend,
- neglecting the case where there was actually 2 1-column widgets
- above. Now, ^ ^ is interpreted as a possible width; the gridder
- will consume as many ^'s as there are columns in the widget, and
- leave the rest for the extension of other widgets. (bug #1386).
+ * tkMacOSXInt.h: Add TkMacOSXGenerateFocusEvent.
+ * tkMacOSXSubwindows.c (XDestroyWindow): We don't get Activate events
+ for the remaining windows when a Floating window is destroyed. This can
+ cause the focus to disappear. So catch this case when the window is
+ being destroyed and move the focus here.
-2000-01-19 Eric Melski <ericm@scriptics.com>
+ * tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): Make this public
+ (used to be GenerateFocusEvent) since we need it here and in
+ tkMacOSXSubwindows.c. Then change the name everywhere it is used. [Bug
+ 1124237]
- * library/tk.tcl: Created a virtual event <<PrevWindow>> for
- reverse tab traversals, with one default binding <Shift-Tab>, and
- OS specific bindings for Linux, HP-UX, and IRIX. (bug #3163)
+2005-03-10 Jim Ingham <jingham@apple.com>
-2000-01-13 Jeff Hobbs <hobbs@scriptics.com>
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): In the
+ inDrag section, set the GrafPort to the drag window's GrafPort before
+ doing LocalToGlobal. [Bug 1160025]
- * changes: updated changes file to reflect 8.3b2 mods
- * README:
- * generic/tk.h:
- * unix/configure.in:
- * win/configure.in: updated to patchlevel 8.3b2
+2005-03-09 Jim Ingham <jingham@apple.com>
- * win/tkWinWm.c: added visibility event handler to make sure
- that transient window wrappers would be updated when the master
- was initially mapped.
+ * macosx/tkMacOSXInit.c (TkpInit): Check to see if the environment
+ variable XCNOSTDIN is set, and if so, close stdin & stdout. This is
+ necessary to make remote debugging under Xcode work properly.
-2000-01-12 Jeff Hobbs <hobbs@scriptics.com>
+2005-03-08 Jeff Hobbs <jeffh@ActiveState.com>
- * tests/text.test: changed test to reflect change of -hidden
- to -elide in search options.
+ * win/tkWinWm.c (WinSetIcon): fix GCLP_ICONSM -> GCLP_HICONSM.
- * win/tkWinScrlbr.c: added check for valid hwnd in ModalLoopProc
- to avoid crash when building statically
+ * win/makefile.vc: clarify necessary defined vars that can come from
+ MSVC or the Platform SDK.
- * doc/event.n:
- * generic/tkBind.c: prevented core with event -warp on Windows
- when window wasn't mapped [Bug: 4004] and added docs stating
- the requirement for mapped windows.
+2005-02-28 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkCanvas.c: fixed mem leak with TagSearchExprInit
- [Bug: 3977]
+ * win/tkWinX.c (GenerateXEvent): correct %A translation on MouseWheel.
+ [Bug 1118340]
- * generic/tkStubInit.c:
- * generic/tkDecls.h: remove non-existent
- Tk_(Get|Create)CanvasVisitor prototypes
-
- * generic/tkText.c:
- * generic/tkEntry.c: fixed cursor to not blink when widget was
- disabled [Bug: 1807]
+2005-02-24 Daniel Steffen <das@users.sourceforge.net>
- * generic/tkRectOval.c: added note about change to bloat for
- RectOval bounds calculation for WIN32 only
+ * macosx/tkMacOSX.h: fixed incorrect inclusion of internal header.
+ * macosx/tkMacOSXNotify.c: corrected included headers.
- * library/dialog.tcl: improved handling of $default arg to allow
- for name of given button, as well as bounds checking
+2005-02-22 Daniel Steffen <das@users.sourceforge.net>
- * doc/wm.n:
- * tests/winWm.test:
- * tests/unixWm.test:
- * mac/tkMacWm.c:
- * unix/tkUnixWm.c: fixed possible X error being raised [Bug: 3377]
- * win/tkWinWm.c: wm deiconify in zoom state [Bug: 2077],
- fixed possible flashing of unmapped toplevel in deiconify [Bug: 3338]
- and fixed mapping of transient window [Bug: 572]
- Also, for all wm's, extended 'wm state' command to allow setting
- of the state, and added official support of 'zoomed' state on Win.
+ * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd, NavServicesGetFile):
+ fixed encoding problems with -initialfile & -filetypes and corrected
+ potential buffer overrun with -initialdir/-initialfile. [Bug 1146057]
- * unix/aclocal.m4: strtod bug on Tru64 [Bug: 3378]
+2005-02-16 Mo DeJong <mdejong@users.sourceforge.net>
- * unix/Makefile.in: added tests to prevent unnecessary chmod +x
- in source dirs while installing [Bug: 3367]
+ TIP#223 IMPLEMENTATION
- * unix/configure.in: properly sub'ed in TK_SHARED_BUILD [Bug: 3385]
+ * doc/wm.n: Add documentation for -fullscreen attribute.
+ * tests/winWm.test: Add -fullscreen to wm attribute usage message.
+ * tests/wm.test: Add -fullscreen to wm attribute usage message. Add
+ -fullscreen attribute test cases for Windows.
+ * win/tkWinWm.c (WmInfo, UpdateWrapper, TkpWmSetFullScreen)
+ (WmAttributesCmd, UpdateGeometryInfo):
+ Implement TIP 223 [wm attributes -fullscreen].
-2000-01-05 Jeff Hobbs <hobbs@scriptics.com>
+2005-02-14 Vince Darley <vincentdarley@users.sourceforge.net>
- * doc/text.n:
* generic/tkText.c:
* generic/tkText.h:
- * generic/tkTextBTree.c:
* generic/tkTextDisp.c:
- * generic/tkTextTag.c: removed the -state option for text tags,
- and reoriented it around -elide, as -state disabled was never
- implemented, and -state hidden is better as -elide.
-
- * mac/tkMacClipboard.c: fixed i18n problems with clipboard [Bug: 3544]
-
- * library/entry.tcl:
- * library/focus.tcl:
- * library/listbox.tcl:
- * library/scale.tcl:
- * library/scrlbar.tcl:
- * library/tearoff.tcl:
- * library/text.tcl:
- * library/tkfbox.tcl:
- * library/xmfbox.tcl: fixed unprotected arg parsing through eval/after
- [Bug: 3943]
-
- * unix/Makefile.in: added unix/aclocal.m4 to distribution [Bug: 3938]
- * unix/aclocal.m4: changed NetBSD SHLIB_CFLAGS from -fpic to -fPIC
-
- * win/tkWinImage.c: added static declaration to function
-
-1999-12-22 Jeff Hobbs <hobbs@scriptics.com>
-
- * changes: updated changes file
-
- * generic/tkScale.c:
- * generic/tkScale.h:
- * mac/tkMacScale.c:
- * unix/tkUnixScale.c: fixed potential segv from patch in 3897
-
- * tests/unixWm.test: nonPOrtable -> nonPortable
-
-1999-12-21 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tk.h:
- * unix/configure.in:
- * win/configure.in:
- * win/aclocal.m4:
- * README: updated for patch level 8.3b1
-
- * unix/tkUnixWm.c: fixed panic in Tk_CoordsToWindow to print error
- and continue instead (for Tix) [Bug: 716 et al]
-
- * scale.test:
- * generic/tkScale.c:
- * generic/tkScale.h: fixed possible core when freeing options
- (cursor) associated with scale widget [Bug: 3897]
-
- * doc/MeasureChar.3: fixed docs for Tk_MeasureChars to reflect code
- * doc/listbox.n: fixed formatting problem
-
- * generic/tk3d.c: added extra calculations to ensure that thin
- frames get refreshed too [Bug: 3596]
-
- * unix/tkUnixMenu.c:
- * unix/tkUnixFont.c:
- * generic/tkCanvText.c:
- * generic/tkEntry.c:
- * generic/tkFont.c:
- * generic/tkImgPPM.c: removed extranneous vars that were set but
- never used.
-
- * mac/tclMacHLEvents.c: fixed applescript for I18N [Bug: 3644]
-
- * unix/aclocal.m4: removed -O flag for AIX when using the IBM
- compiler (several versions have a bug that crops up in the text
- widget). [Bug: 2316]
-
- * unix/Makefile.in: removed extra slash in SCRIPT_INSTALL_DIR
- [Bug: 3896]
-
- * library/listbox.tcl: added extra checks for existence of
- tkPriv(listboxSelection) before it was used. [Bug: 3892]
-
-1999-12-16 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/GetCursor.3:
- * win/tkWinCursor.c: added support for Windows cursors to
- TkGetCursorByName (.ani, .cur) using -cursor @<filename>
- (Ascher) [Bug: 1350]
-
- * win/tkWinWm.c: fixed 'wm deiconify' to update position of the
- toplevel if event is waiting before mapping. (Mao) [Bug: 3687]
- This removes the need for 'update idle' before 'wm deiconify' on
- Windows.
-
- * doc/listbox.n: added doc for <<ListboxSelect>> [Bug: 3500]
-
- * doc/getOpenFile.n: removed note that -initialfile didn't work
- for tk_getOpenFile
- * library/tkfbox.tcl: updated tk_get*File to better match the
- Windows file box it emulates, give proper support to -initialfile,
- and fixes lack of global tkPriv call. [Bug: 3735 3882]
-
- * doc/tk.n: added doc for 'tk useinputmethods ...'
- * tests/tk.test:
- * unix/tkUnixKey.c:
- * generic/tkCmds.c:
- * generic/tkEvent.c:
- * generic/tkWindow.c:
- * generic/tkInt.h: add 'tk useinputmethods ?-display win? ?bool?'
- call to provide support for disabling/enabling the use of XIM on
- X. This was previously all done at compile time, and always on.
- Now it is turned off by default, even when available, and the user
- must turn it on to use XIM (per display).
-
- * generic/tkCanvUtil.c: fixed bug in Tk_CanvasPsOutline that freed
- mem it shouldn't.
-
- * generic/tkFont.c: added "bitstream cyberbit" (popular Windows
- CJK font) to list of font fallbacks. (kenny) [Bug: 2407]
-
- * mac/tkMacMenu.c: finished bug 3075 by changing the char values of
- what was checked (verified correctness on Mac).
-
-1999-12-13 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/canvas.n: added docs for items added by dash patch (-*dash*,
- -state, -active*, -disabled*, -offset, essentially rewrote the
- man patch for completely updated 8.3 canvas widget.
- * doc/entry.n: added docs for entry widget validation
- * doc/event.n: added docs for -warp
- * doc/text.n: doc'ed new -state value 'hidden'
- * doc/GetDash.3: (new file) man page explaining Tk_GetDash
- * generic/tkStubInit.c:
- * generic/tkDecls.h:
- * generic/tkIntXlibDecls.h:
- * generic/tkInt.decls: added XSetDashes and XWarpPointer
- * generic/tk.decls: added Tk_CreateSmoothMethod, and reserved
- two spots
- * generic/tk.h: added Tk_SmoothMethod struct,
- state item to canvas record, #defines for item state,
- support for using old char*-based canvas item C creation
- procedures with -DUSE_OLD_CANVAS,
- Tk_Dash, Tk_TSOffset (-offsets) & Tk_Outline structs and #defs,
- decls for dash, outline and postscript routines
- * generic/tkBind.c: added support for Quadruple clicks, and added
- the -warp option to 'event' with pointer warping routines
- * xlib/xgc.c:
- * generic/tkRectOval.c:
- * generic/tkCanvArc.c:
- * generic/tkCanvBmap.c:
- * generic/tkCanvImg.c:
- * generic/tkCanvLine.c:
- * generic/tkCanvPoly.c:
- * generic/tkCanvPs.c:
- * generic/tkCanvText.c:
- * generic/tkCanvUtil.c:
- * generic/tkCanvWind.c:
- * generic/tkCanvas.c:
- * generic/tkCanvas.h: Canvas and items received overhaul to with
- the addition of the dash patch (Nijtmans, et al) This includes
- objectification of the 'canvas' command, as well as support for
- (where appropriate) dashes in items, extended stipple support,
- state for all items, and postscript generation of images and
- windows. See the new canvas man page for related docs.
- * generic/tkEntry.c: added entry widget validation, see entry.n
- * generic/tkEvent.c: on simulated events, ButtonPress should
- be matched with ButtonRelease to be correct
- * generic/tkFont.c: corrected possible null reference
- * generic/tkFrame.c: made frame a Tcl_Obj based command
- * generic/tkGet.c: added TkGetDoublePixels
- * generic/tkImage.c: bug fixes from Img patch and new
- Tk_PostscriptImage and Tk_SetTSOrigin functions
- * generic/tkImgBmap.c: new ImgBmapPostscript function
- * generic/tkImgPhoto.c: new Tk_CreatePhotoOption, Tk_DitherPhoto
- * generic/tkInt.h: declarations for some new functions
- * generic/tkMessage.c: reworked relief drawing
- * generic/tkOldConfig.c: added TK_CONFIG_OBJS so old style
- ConfigureWidget calls can pass in Tcl_Obj arrays
- * generic/tkScrollbar.c:
- * generic/tkScrollbar.h: made -orient use an option table
- * generic/tkText.c:
- * generic/tkText.h: made -wrap and -state use option tables
+ * generic/tkTextIndex.c:
* generic/tkTextBTree.c:
- * generic/tkTextDisp.c:
- * generic/tkTextImage.c:
- * generic/tkTextMark.c:
- * generic/tkTextTag.c:
- * generic/tkTextWind.c: added support for -elide and -state hidden
- * generic/tkTrig.c: changed TkMakeBezierCurve to support returning
- the upper limit of points needed for spline
- * generic/tkUtil.c: new option table parsing routines
- * generic/tkWindow.c: init'ing of warp stuff, mouseButtonState
-
- related bug ids for the fixes:
- [Bug: 648 1541 1540 1779 2168 2311 2297 2340 2348 2578 3386]
-
- * tests/bind.test:
- * tests/canvImg.test:
- * tests/canvPsArc.tcl:
- * tests/canvPsImg.tcl: (new file)
- * tests/canvRect.test:
- * tests/canvText.test:
- * tests/canvas.test:
- * tests/defs.tcl:
- * tests/entry.test:
- * tests/event.test:
- * tests/font.test:
- * tests/frame.test:
- * tests/imgPhoto.test:
- * tests/safe.test:
- * tests/scale.test:
- * tests/scrollbar.test:
- * tests/select.test:
- * tests/text.test:
+ * doc/text.n:
* tests/textDisp.test:
- * tests/textTag.test:
- * tests/unixFont.test:
- * tests/unixWm.test:
- * tests/visual_bb.test:
- * tests/winClipboard.test: tests for the dash patch changes
-
- * unix/mkLinks: added GetDash.3 into the mkLink step
-
- * mac/tkMacDraw.c: mac still needs pointer warping routine
- * mac/tkMacXStubs.c:
- * win/tkWinDraw.c:
- * win/tkWinPointer.c: added support for pointer warping and
- platform specific support for dash patch items
-
-1999-12-12 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkText.c: fixed bug in TextSearchCmd for multibyte chars
- (Darley) [Bug: 3839]
-
- * unix/aclocal.m4: added warning when configuring with
- --enable-threads that Tk may have problems
-
-1999-12-09 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkImgGIF.c: updated casting
-
- * win/makefile.vc: removed 16bit stuff, simplified makefile.
-
-1999-12-06 Scott Redman <redman@scriptics.com>
-
- * generic/tkMain.c: need to include tclInt.h for new hook
- functions that are internal-use-only.
-
-1999-12-06 Jeff Hobbs <hobbs@scriptics.com>
-
- * library/comdlg.tcl: removed tclVerifyInteger and tclSortNoCase,
- they weren't used, and were not actually correct
-
- * mac/tkMacFont.c:
- * mac/tkMacMenu.c:
- * mac/tkMacWindowMgr.c: fixed greyed out menu items, handling of
- ... elipsis, font mapping problem, and enabled generated menu
- posting [Bug: 3705]
-
-1999-12-02 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkInt.h:
- * generic/tkWindow.c:
- * generic/tkCmds.c: converted Tk_DestroyCmd, Tk_LowerCmd and
- Tk_RaiseCmd to their ObjCmd equivalent.
-
- * library/msgbox.tcl: added color icons for tk_messageBox on Unix
- and Mac when tk_strictMotif isn't set. (Hipp)
- * library/tk.tcl: added window bounds checking to ::tk::PlaceWindow
-
- * tests/imgPPM.test: fixed test 2.2 to use -format ppm (since
- we know have GIF write capability)
-
-1999-12-01 Scott Redman <redman@scriptics.com>
-
- * generic/tkMain.c :
- * unix/tkAppInit.c:
- * win/winMain.c: Added added hooks into the main() code for
- supporting TclPro and other "big" shells more easily without
- requiring a copy of the main() code.
-
-1999-11-29 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkImgGIF.c: added GIF writing that uses miGIF RLE
- [Bug: 2039, new patch]
-
- * library/entry.tcl: fixed up tkEntrySeeInsert (Nemthi)
-
- * generic/tkListbox.c: fixed 'get' of listbox to return a string
- when only one item is requested.
-
- * tests/clrpick.test:
- * tests/filebox.test: minor whitespace cleanup
-
- * library/tk.tcl: fixed missing $w in ::tk::PlaceWindow
-
-1999-11-24 Jeff Hobbs <hobbs@scriptics.com>
-
- * library/clrpick.tcl:
- * library/msgbox.tcl:
- * library/tk.tcl:
- * library/tkfbox.tcl:
- * library/xmfbox.tcl: fixed dialogs to center over -parent,
- added utility functions ::tk::PlaceWindow, ::tk::SetFocusGrab,
- ::tk::RestoreFocusGrab to tk.tcl to help
-
-1999-11-23 Eric Melski <ericm@scriptics.com>
-
- * tests/listbox.test: Added a test to check that the topIndex is
- update when items are removed from the listvar variable.
-
- * generic/tkListbox.c: Added a check the updates the topIndex when
- items are removed from the listvar variable.
-
- * tests/listbox.test: Added a test to check that the vertical
- scrollbar is updated when the listvar changes.
-
- * generic/tkListbox.c (ListboxListVarProc): added a check that
- sets the UPDATE_V_SCROLLBAR flag if the length of the listvar has
- changed.
-
-1999-11-23 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tk.h:
- * generic/tkConfig.c: added support for TK_OPTION_DONT_SET_DEFAULT
- as equiv for TK_CONFIG_DONT_SET_DEFAULT
- * generic/tkListbox.c: added TK_OPTION_DONT_SET_DEFAULT to the
- item specs
-
-1999-11-19 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkColor.c:
- * generic/tkColor.h: fixed Tk_NameOfColor to work correctly,
- with minor change to TkColor struct.
-
- * generic/tkConsole.c: added static declaration to
- ConsoleDeleteProc function (proto already had it)
-
- * win/tkWinInt.h: removed TkFontAttributes typedef (was
- redundant with tkFont.h).
- * win/tkWinPort.h: put #ifndef __GNUC__ around redefinition
- of str[n]casecmp, as cygwin uses the originals.
- * win/tkWinX.c: changed GetCurrentTime to GetTickCount (the
- former is deprecated). [Bug: 2053]
-
-1999-11-19 Eric Melski <ericm@scriptics.com>
-
- * tests/listbox.test: Added tests for itemcget and itemconfigure.
-
- * doc/listbox.n: Added documentation for -listvar option and for
- itemconfigure and itemcget commands.
-
- * generic/tkListbox.c: Added support for itemconfigure/itemcget
- listbox subcommands (addresses rfe #936)
-
-1999-11-17 Eric Melski <ericm@scriptics.com>
-
- * tests/listbox.test: Updated tests for new error messages.
-
- * generic/tkListbox.c: Improved error messages for bad -listvar's.
-
- * tests/listbox.test: Added tests for bad -listvar's.
-
- * generic/tkListbox.c: Added handlers for bad -listvar's (ie, bad
- lists)
-
- * tests/listbox.test: Added tests for ListboxUpdateHScrollbar.
-
- * generic/tkListbox.c: Changed some old static buffers to base
- size on TCL_DOUBLLE_SPACE instead of (completely) hardcoding the size.
-
- * tests/listbox.test: New tests for -listvar functionality, and an
- odd extra case that wasn't covered before.
-
- * generic/tkListbox.c: Tests exposed some bugs, now fixed.
-
-1999-11-16 Eric Melski <ericm@scriptics.com>
-
- * tests/listbox.test: Fixed tests to comply with new objectified
- error messages. No -listvar specific tests yet.
-
- * win/tkWinDefault.h:
- * unix/tkUnixDefault.h:
- * mac/tkMacDefault.h: Added default value for -listvar option.
-
- * generic/tkWindow.c: Changed "listbox" mapping from old-school to
- new-school objectified command.
-
- * generic/tkListbox.c: Objectified listbox; added support for
- -listvar option. Converted internal structure to use a Tcl list
- object to store the data.
-
- * generic/tkInt.h: Changed reference to Tk_ListboxCmd to
- Tk_ListboxObjCmd.
-
-1999-11-09 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkGrid.c: changed Tcl_Alloc to ckalloc
-
- * generic/tkEntry.c: fixed C expr error in destroy of entry
- that could lead to 'malformed bucket chain' error
-
- * win/winMain.c: corrected winMain to not do a DebugBreak when
- returning an error message from the top level
-
-1999-10-30 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinKey.c: fixed XKeysymToKeycode to handle mapping of
- symbolic keysyms (Left, Home, ...) with event generate
-
- * library/entry.tcl: change tkEntrySeeInsert to avoid the use
- of a while loop that could eat CPU tremendously. Behavior of
- moving the cursor at the right edge changes slightly (previously
- it tried to keep the cursor at the right edge, now it moves the
- cursor to a "central right" location - better IMHO).
-
-1999-10-28 Jeff Hobbs <hobbs@scriptics.com>
-
- * doc/CrtImgType.3:
- * doc/CrtPhImgFmt.3:
- * doc/FindPhoto.3:
- * doc/photo.n:
- * generic/tk.h:
- * generic/tkCmds.c:
- * generic/tkImage.c:
- * generic/tkImgBmap.c:
- * generic/tkImgGIF.c:
- * generic/tkImgPPM.c:
- * generic/tkImgPhoto.c:
- * generic/tkInt.h:
- * generic/tkTest.c:
- * generic/tkWindow.c:
- * tests/imgPhoto.test: added Img patch (Nijtmans) with docs,
- headers #def'd with USE_OLD_IMAGE. Upgrades image stuff to
- Tcl_Obj API, adds alpha channel (images are now 32 bpp)
-
- * makefile.vc: changed 'c:/program files' to c:/progra~1
-
-1999-10-19 Jeff Hobbs <hobbs@scriptics.com>
-
- * library/scrlbar.tcl: changed tkScrollButtonUp to check for
- existence of tkPriv(relief) in order to avoid spurious release
- events
-
- * unix/Makefile.in: added ChangeLog to dist archive
-
-1999-09-24 Jeff Hobbs <hobbs@scriptics.com>
-
- * */README:
- * win/makefile.vc:
- * */configure.in:
- * generic/tk.h:
- * library/tk.tcl: up'd to 8.3a1
-
- * unix/Makefile.in: changed 'mkdir' to 'mkdir -p'
-
- * library/dialog.tcl: changed {Times 18} to {Times 12} for
- dialog font.
-
-1999-09-16 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkFont.c: fixed processing of font options and error
- returned [Bug: 2075]
-
- * win/tkWinWm.c: fixed bug in 'wm deiconify' that raised the
- wrong toplevel, and changed it to not set focus on overridden
- toplevels
-
-1999-09-15 Jeff Hobbs <hobbs@scriptics.com>
-
- * unix/aclocal.m4: added fix for FreeBSD-[1-2] recognition [Bug: 2070]
- and fix to AIX-* to get ldAix right [Bug: 2624], fixed AIX
- version check (readjust from 8-21 fix) and several other config
- fixes for AIX
- * mac/tkMacMenubutton.c:
- * unix/tkUnixMenubu.c: fixed permanently stippled menubutton image
- * win/tkWinButton.c: fixed possible pointer smash [Bug: 2733]
-
-1999-09-14 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinMenu.c: fix for stack overrun in GetTextFace [Bug: 909]
+ * tests/textIndex.test: fix of longstanding elide problem when eliding
+ a newline without eliding the entire logical line. [Bug 443848]
-1999-09-01 Jeff Hobbs <hobbs@scriptics.com>
+2005-02-14 Jeff Hobbs <jeffh@ActiveState.com>
- * win/tkWinDraw.c:
- * unix/tkUnixDraw.c: fixed header style for TkpDrawHighlightBorder
- * generic/tkCanvas.c: fixed GC error (bg <> fg) in tkCanvas.c
- (from code added to support TkpDrawHighlightBorder) [Bug: 2676]
- * unix/aclocal.m4: added -bnoentry to the AIX-* flags
- * library/msgbox.tcl: changed the behavior of tk_messageBox on
- Unix to be more Windows like in handling of <Return> and the
- default button
- * library/button.tcl:
- * library/clrpick.tcl:
- * library/comdlg.tcl:
- * library/console.tcl:
- * library/dialog.tcl:
- * library/entry.tcl:
- * library/focus.tcl:
- * library/listbox.tcl:
- * library/menu.tcl:
- * library/msgbox.tcl:
- * library/palette.tcl:
- * library/safetk.tcl:
- * library/scale.tcl:
- * library/scrlbar.tcl:
- * library/tearoff.tcl:
- * library/text.tcl:
- * library/tk.tcl:
- * library/tkfbox.tcl:
- * library/xmfbox.tcl: updated commands to use [string] ops
- instead of expr equality operators
-
-1999-08-21 Jeff Hobbs <hobbs@scriptics.com>
-
- * unix/aclocal.m4: Changed AIX-4.[2-9] check to AIX-4.[1-9]
- [Bug: 1909]
-
-1999-08-20 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkCursor.c: fixed bug in GetCursorFromObj that caused
- panic [Bug: 2562]
-
- * TK 8.2.0 RELEASED
-
-1999-08-13 Jim Ingham <jingham@cygnus.com>
-
- * mac/tkMacMenu.c: Tk_DrawChars ends up setting the menu background
- wrong. There is no clean way to stop it, so I use lower level routines
- here to draw the text.
- * mac/tkMacProjects.sea.hqx: Rearrange the projects so that the build
- directory is separate from the sources. Much more convenient!
-
-1999-08-10 Jeff Hobbs <hobbs@scriptics.com>
-
- * win/tkWinWm.c: changed "wm deiconify" on Windows to raise and
- force the focus on the deiconified window (behavioral change from
- 8.1 to comply better with Windows style) [Bug: 1609]
- * doc/wm.n: clarified behavior of "wm deiconify".
- * generic/tkInt.decls: added TkSetFocusWin
- * generic/tkFocus.c: changed static SetFocus to TkSetFocusWin
-
- * library/clrpick.tcl:
- * library/console.tcl:
- * library/tk.tcl: fixed code where abbreviations where used
- in calling widget methods (confuses iWidgets) [Bug: 2422]
-
-1999-08-09 Jeff Hobbs <hobbs@scriptics.com>
-
- * library/button.tcl: cleaned up programming (config -> configure)
- and fixed Windows relief bug [Bug: 664]
- * library/entry.tcl: changed Entry C/C/P to not use global data
- (now uses tkPriv(data)) [Bug: 1475]
- * library/listbox.tcl: fixed extended mode script error [Bug: 866]
- * doc/options.n: clarified that -troughcolor doesn't work on Windows
- * doc/wm.n: fixed wm positionfrom docs [Bug: 2284]
-
-1999-08-01 Jeff Hobbs <hobbs@scriptics.com>
-
- * mac/tkMacPort.h: wrapped panic in #ifndef panic to avoid
- compiler errors when used with stubs-#defines, from Vince Darley.
- [Bug: 2389]
-
-1999-07-31 Scott Redman <redman@scriptics.com>
-
- * xlib/X11/Xlib.h: Remove XFillRectangle since it is now in the
- stub tables.
-
-1999-07-30 Jeff Hobbs <hobbs@scriptics.com>
-
- * generic/tkInt.decls: Added stub entry for XFillRectangle [Bug: 2446]
-
-1999-07-30 <redman@scriptics.com>
-
- * win/makefile.vc: Corrected building threaded tktest.exe on
- Windows. Needed to link in .obj files from Tcl, needs to change
- later so that code is in Tk and doesn't require a Tcl build.
- Also added runtest target.
-
-1999-07-29 <redman@scriptics.com>
-
- * generic/tkConsole.c: Allow tcl to open CON and NUL, even for std
- channels. Checking for bad/unusable std channels was moved to Tk
- since its only purpose was to check whether to use the Tk Console
- Window for the std channels. [Bug: 2393 2392 2209 2458]
-
- * win/Makefile.in: Corrected building threaded tktest.exe on
- Windows. Needed to link in .obj files from Tcl, needs to change
- later so that code is in Tk and doesn't require a Tcl build.
-
-1999-07-22 <redman@scriptics.com>
-
- * Changed version to 8.2b2
-
- * win/tkWinPort.h: Block out include of sys/stat.h in order to
- build extensions with MetroWerks compiler for Win32. [Bug: 2385]
-
- * unix/Makefile.in: Need to make install-sh executable before
- calling (with chmod +x). [Bug: 2413]
-
- * library/menu.tcl: Applied patch from Jeff Hobbs to fix typo.
- [Bug: 2425]
-
-1999-07-21 <redman@scriptics.com>
-
- * unix/Makefile.in: Add Windows configure script to distribution.
-
-1999-07-16 <redman@scriptics.com>
-
- * unix/Makefile.in:
- * win/Makefile.in: Copy the prolog.ps from the generic directory
- for install-libraries.
-
- * unix/aclocal.m4: Check for Alpha/Linux to set the IEEE flag to
- the compiler to be -mieee. Patch from Don Porter.
-
-1999-07-08 <stanton@scriptics.com>
-
- * tests/unixSelect.test: Fixed broken test.
-
- * win/makefile.vc: Added special case target to ensure that
- tkStubLib.obj is built with -DSTATIC_BUILD.
-
- * win/tkWinX.c (TkWinChildProc): Changed to pass
- WM_WINDOWPOSCHANGED through to DefWindowProc to make OpenGL
- sub-windows happy. This allows Windows to generate the WM_SIZE
- and WM_MOVE messages.
-
-1999-07-08 <redman@scriptics.com>
-
- * unix/configure.in: Fix Tk stub lib file names and flags.
-
-1999-06-30 <redman@scriptics.com>
-
- * generic/tkGrid.c: removed deprecated functions (applied patch
- from Jan Nijtmans). [Bug: 2080]
-
- * generic/tkImgGIF.c:
- * generic/tkImgPPM.c:
- * generic/tkImgPhoto.c: Applied patch to allow Img extension to
- work with 8.2, from Jan Nijtmans. [Bug: 2068]
-
- * win/tkWinWm.c: Applied patch from Don Porter to prevent the
- windows code from calling the Tcl functions when the stub table
- has not been initialized in TkWinWmCleanup. [Bug: 2269]
-
-1999-06-16 <wart@scriptics.com>
-
- * unix/configure.in:
- * unix/Makefile.in:
- * unix/aclocal.m4: Numerous build changes to make Tk conform to
- the proposed TEA spec
-
- * tkConsole.c: changed some variable types from (int) to (size_t)
- to prevent compiler warnings. Cast return value from strlen()
- to (int) in one place for the same reason.
-
-1999-06-03 <stanton@scriptics.com>
-
- * unix/tkUnixSelect.c:
- * tests/unixSelect.test:
- * generic/tkSelect.c: Fixed selection code to handle Unicode data
- in COMPOUND_TEXT and STRING selections. [Bug: 1791]
-
-1999-06-02 <stanton@scriptics.com>
-
- * generic/tkIntXlibDecls.h:
- * xlib/X11/Xlib.h: Added Mac specific defines to help with
- compilation.
-
- * generic/tkFont.c: lint
-
-1999-06-01 <stanton@scriptics.com>
-
- * unix/tkUnixSelect.c: Improved I18N selection support.
- COMPOUND_TEXT is converted to/from iso2022, and STRING is
- converted to/from iso8859-1. There are still a few loose ends to
- tie up before this is completely done.
-
- * unix/tkUnixFont.c: Eliminated redundant case folding code.
-
- * generic/tkFont.c: Eliminated use of isupper/tolower in favor of
- Unicode variants.
-
-1999-05-24 <stanton@scriptics.com>
-
- * generic/tkStubLib.c:
- * generic/tkStubInit.c:
- * generic/tkIntXlibDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkIntDecls.h:
- * generic/tkInt.decls:
- * generic/tkConsole.c: Various changes to try to get the Mac
- builds working.
-
-1999-05-21 <stanton@scriptics.com>
-
- * win/tkWinClipboard.c: Fixed clipboard code to handle lack of
- CF_LOCALE information (e.g. from command.com).
-
-1999-05-20 <redman@scriptics.com>
-
- * library/console.tcl: Changed copyright string to read 1999
- Scriptics Corp. in wish console about box.
-
-1999-05-19 <redman@scriptics.com>
-
- * generic/tk.h: Add extern "C" block around entire header file for
- C++ compilers to fix linkage issues. Submitted by Don Porter and
- Paul Duffin.
-
-1999-05-18 <stanton@scriptics.com>
-
- * tests/winClipboard.test:
- * win/tkWinClipboard.c: Fixed clipboard code so it handles Unicode
- data properly on Windows NT and 95. [Bug: 1791]
-
-1999-05-07 <stanton@scriptics.com>
-
- * library/menu.tcl: Fixed bug where tk_popup fails when called too
- quickly. [Bug: 2009]
-
-1999-04-30 <stanton@scriptics.com>
-
- * Changed version number to 8.1.1.
-
-1999-04-30 <stanton@scriptics.com>
-
- * Merged changes from 8.1.0 branch:
-
- * generic/tkDecls.h:
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkIntXlibDecls.h:
- * generic/tkPlatDecls.h:
- * generic/tkStubInit.c: Changed to avoid the need for forward
- declarations in stub initializers. Added extern "C" blocks around
- stub table pointer declarations so the stubs can be used from C++
- code. [Bug: 1934]
-
- * generic/tkInt.decls: Added TkClipBox, XDrawSegments, and
- XForceScreenSaver to stubs.
-
- * generic/tkStubLib.c: Reordered declarations to avoid
- circularities and forward references.
-
- * generic/tkStubInit.c: Added includes for Mac.
-
- * generic/tkMenubutton.c: lint
-
- * generic/tkEntry.c: Fixed bad option table entry.
-
- * generic/tkImgBmap.c:
- * generic/tkImgPPM.c:
- * generic/tkImgPhoto.c: Set the -translation and -encoding options
- to binary for image files. (reported by Marco Gazzetta)
-
-1999-04-23 <stanton@scriptics.com>
-
- * generic/tkInt.decls: Added TkClipBox, XDrawSegments, and
- XForceScreenSaver to stubs.
-
- * generic/tkStubLib.c: Reordered declarations to avoid
- circularities and forward references.
-
- * generic/tkStubInit.c: Added includes for Mac.
-
- * generic/tkMenubutton.c: lint
-
- * generic/tkEntry.c: Fixed bad option table entry.
-
-1999-04-22 <redman@scriptics.com>
-
- * generic/tkImgBmap.c:
- * generic/tkImgPPM.c:
- * generic/tkImgPhoto.c: Set the -translation and -encoding options
- to binary for image files. (reported by Marco Gazzetta)
-
-1999-04-20 <redman@scriptics.com>
-
- * xlib/X11/Xlib.h: changed definition of Status type to use a
- typedef instead of a #define to avoid conflicting with the cygwin
- win32 headers [Bug 1804]
-
-1999-04-15 <stanton@scriptics.com>
-
- * Merged 8.1 branch into the main trunk
-
-1999-04-09 <redman@scriptics.com>
-
- * generic/tkWindow.c: Fixed deadlock situation when the Initialize()
- function returns without releasing the mutex. Found while testing
- Bug 1700, during safe.test (tk).
-
-1999-04-06 <stanton@scriptics.com>
-
- * generic/tkMain.c (Tk_MainEx): Changed to reset result before
- calling Tcl_EvalFile. The ensures that error messages will be
- generated cleanly.
-
- * tests/winfo.test: Enabled tests that previously failed.
-
-1999-04-05 <stanton@scriptics.com>
-
- * library/bgerror.tcl:
- * library/button.tcl:
- * library/clrpick.tcl:
- * library/console.tcl:
- * library/dialog.tcl:
- * library/entry.tcl:
- * library/focus.tcl:
- * library/listbox.tcl:
- * library/menu.tcl:
- * library/msgbox.tcl:
- * library/palette.tcl:
- * library/scale.tcl:
- * library/scrlbar.tcl:
- * library/tearoff.tcl:
- * library/text.tcl:
- * library/tk.tcl: Lots of minor performance improvements
- contributed by Jeffrey Hobbs. [Bug: 1118]
-
- * win/tkWinWm.c (Tk_WmCmd): Fixed bad code in tracing
- suboption. [Bug: 1519]
-
- * library/tkfbox.tcl: Change to restore button text after an
- action to avoid the sticky "Open" button in a save dialog.
- [Bug: 1640]
-
- * library/entry.tcl: Fixed so selection is returned using the
- -show character during cut and paste operations. [Bug: 1687]
-
-1999-04-5 <redman@scriptics.com>
-
- * generic/tkInt.decls:
- * generic/tkIntXlibDecls.h:
- * generic/tkStubInit.c:
- * xlib/xgc.c:
- * xlib/X11/Xlib.h:
- * xlib/X11/Xutil.h: Added more X functions to the Win & Mac stubs
- tables.
-
-1999-04-05 <stanton@scriptics.com>
-
- * unix/configure.in:
- * generic/tkCanvPs.c: Added configure test for pw_gecos field in
- pwd to support OS/390. [Bug: 1724]
-
-1999-04-02 <stanton@scriptics.com>
+ * doc/options.n: note -cursor {} behavior. [Bug 965618]
- * tests/text.test:
- * generic/tkText.c: Fixed handling of Unicode in text searches.
- The -count option was returning byte counts instead of character
- counts. [Bug: 1056, 1148, 1666]
-
-1999-04-01 <redman@scriptics.com>
-
- * generic/tk.decls:
- * generic/tk.h:
- * generic/tkStubInit.c:
- * generic/tkWindow.c:
- * unix/Makefile.in:
- * win/makefile.vc: Tk now uses its own stub library to store
- pointers to its own stubs table.
-
- * doc/dde.n: (removed)
- * doc/send.n:
- * generic/tk.decls:
- * tests/winSend.test:
- * generic/tkPlatDecls.h:
- * win/tkWinSend.c: Removed the DDE-based send and dde commands,
- they were causing Tk to lock up when any window on the system was
- not processing its message queue (more importantly, windows in Tcl
- and Tk). The send command needs to be rewritten to prevent the
- deadlock situation (soon). The dde command is being pushed into
- its own package and will provide almost all of the capabilities
- that send did before (using a "dde eval" command), not yet
- completed.
-
-1999-03-31 <redman@scriptics.com>
-
- * win/tkWinSend.c: Modified dde/send code to work properly on
- Win95/Win98. String lengths are not returned properly by DDE, so
- NULL terminate all strings going in and ignore the string length
- coming back out. Do not destroy handles until all necessary work
- on those handles (and child handles) is done.
-
-1999-03-30 <stanton@scriptics.com>
-
- * generic/tkWindow.c (Tk_DestroyWindow): Image handlers are now
- finalized before the font subsystem since complex image handlers
- may contain references to fonts (e.g. Tix compound images).
- [Bug: 1603]
-
-1999-03-29 <stanton@scriptics.com>
-
- * doc/MeasureChar.3:
- * doc/TextLayout.3:
- * generic/tk.decls:
- * generic/tkCanvText.c:
- * generic/tkEntry.c:
- * generic/tkFont.c:
- * generic/tkListbox.c:
- * generic/tkMessage.c:
- * mac/tkMacFont.c:
- * unix/tkUnixButton.c:
- * unix/tkUnixFont.c:
- * unix/tkUnixMenu.c:
- * win/tkWinFont.c:
- * win/tkWinMenu.c: Standardized text layout and font interfaces
- so they are consistent with respect to byte versus character
- oriented indices. The layout functions all manipulate character
- oriented values while the lower level measurement functions all
- operate on byte oriented values. This distinction was not clear
- and so the functions were being used improperly in a number of
- places. [Bug: 1053, 747, 749, 1646]
-
- * generic/tk.decls: Eliminated uses of C++ STL types string and
- list from declarations.
-
- * generic/tkFont.c: Changes to named fonts were not being
- propagated in some cases. [Bug: 1144]
-
- * xlib/X11/Xlib.h:
- * generic/tkInt.decls: Added XParseColor to xlib stub
- tables. [Bug: 1574]
-
- * doc/GetBitmap.3:
- * generic/tkBitmap.c (BitmapInit): Eliminated use of Tk_Uid's in
- bitmaps. Added a few CONST declarations.
-
-1999-03-29 <redman@scriptics.com>
-
- * unix/configure.in:
- * unix/Makefile.in:
- * win/makefile.vc:
- * generic/tkDecls.h:
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkPlatDecls.h:
- * generic/tkIntXlibDecls.h: Removed stub functions. Always use the
- Tcl stubs when building with --enable-shared.
-
-
-1999-03-26 <redman@scriptics.com>
-
- * generic/tkTextIndex.c:
- * tests/testIndex.test: Avoid looking past the beginning of the
- array storing data for the text widget (.t index end-2c). Added
- test case to check for the bug. [Bug 991]
-
- * generic/tkConsole.c: Copy static strings into a Tcl_DString
- before passing to Tcl_Eval, in case the compiler puts static
- strings into read-only memory.
-
-1999-03-26 <suresh@scriptics.com>
-
- * unix/configure.in:
- --nameble-shared is now the default and builds Tk as a shared
- library; specify --disable-shared to build a static Tk library
- and shell.
-
-1999-03-26 <surles@scriptics.com>
-
- * library/menu.tcl: Fixed bug reported by Bryan Oakley in the
- menubutton bindings. There was a false assumption that there was
- always a menu attached to the button. [Bug 1116]
-
-1999-03-26 <redman@scriptics.com>
-
- * unix/configure.in: Removed --enable-tcl-stub. Linking Tk to Tcl
- stubs is causing too many problems when linking executables like wish.
- Until the Tk is a fully loadable extension, linking against the Tcl
- stubs is not supported in Tk.
-
-1999-03-19 <redman@scriptics.com>
-
- * generic/tkBitmap.c:
- * generic/tkCursor.c:
- * generic/tkGC.c: When creating hash tables that key off of XID
- handles, make sure to pass TCL_ONE_WORD_KEYS. XIDs are guaranteed
- to be 32bit numbers, although on some 64bit systems (including 64bit
- Solaris 7) they are packed into a 64bit value where the upper 32bits
- are zero. The normal method of sizeof(XID)/sizeof(int) causes the
- hash table code to assume that the XID is a pointer to an array of
- two ints, which it is not. Tk now supports 64bit Solaris 7.
-
-1999-03-17 <stanton@scriptics.com>
-
- * win/makefile.vc:
- * generic/tk.h: Changed to use TCL_BETA_RELEASE macro, and fixed
- so this works in rc files.
-
- * win/makefile.vc:
- * win/makefile.bc:
- * win/README:
- * unix/configure.in:
- * generic/tk.h:
- * README: Updated version to 8.1b3.
-
-1999-03-14 <stanton@GASPODE>
-
- * unix/configure.in: Added missing stub related definitions.
-
- * unix/Makefile.in: Install tkDecls.h in addition to tk.h.
-
- * generic/tkStubLib.c: Added flags to ensure we are using Tcl
- stub macros.
-
-1999-03-11 <stanton@GASPODE>
-
- * generic/tkInt.decls: Added reserved slot for XSetDashes for use
- by the dash patch.
-
-1999-03-10 <redman@scriptics.com>
-
- * xlib/xdraw.c:
- * xlib/X11/Xlib.h:
- * mac/tkMac.h:
- * mac/tkMacInt.h:
- * mac/tkMacPort.h:
- * mac/tkMacXStubs.c:
- * mac/tkMacAppInit.c:
- * mac/tkMacCursor.c:
- * win/makefile.vc:
- * win/tkWin.h:
- * win/tkWinInt.h:
- * win/tkWinPort.h:
- * win/winMain.c:
- * generic/tk.h:
- * generic/tkInt.h:
- * generic/tk.decls:
- * generic/tkInt.decls:
- * generic/tkDecls.h:
- * generic/tkPlatDecls.h:
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkIntXlibDecls.h:
- * generic/tkStubs.c:
- * generic/tkPlatStubs.c:
- * generic/tkIntStubs.c:
- * generic/tkIntPlatStubs.c:
- * generic/tkIntXlibStubs.c:
- * generic/tkStubInit.c:
- * generic/tkStubLib.c:
- * generic/tkBind.c:
- * generic/tkCmds.c:
- * generic/tkConfig.c:
- * generic/tkConsole.c:
- * generic/tkCursor.c:
- * generic/tkGrab.c:
- * generic/tkImgPhoto.c:
- * generic/tkMain.c:
- * generic/tkMenu.c:
- * generic/tkPointer.c:
- * generic/tkTextDisp.c:
- * generic/tkWindow.c:
- * unix/tkUnixInt.h:
- * unix/tkUnixPort.h:
- * unix/Makefile.in:
- * unix/configure.in:
- * unix/tkConfig.sh.in:
- * unix/tkUnix.c:
- * unix/tkUnix3d.c:
- * unix/tkUnixDraw.c:
- * unix/tkUnixFont.c:
- * unix/tkUnixMenubu.c: Stubs implementation for 8.1. Tk_Main() is
- replaced with a macro which calls Tk_MainEx(). Tk can link to the Tcl
- stubs library, wish links directly to Tcl and Tk. Use
- --enable-tcl-stubs to link Tk to the Tcl stubs library (Unix), on
- by default on Windows. Exported all public functions through the
- stubs mechanism (see the *.decls files) and many of the internal
- functions. Most of the changes dealt with shifting around the
- function declarations in the header files. Mac code may not
- compile, but it shouldn't take much work to fix this.
-
- * mac/tkMacMenu.c: Added dummy TkpMenuThreadInit for Mac to be
- consistent with Unix and Windows versions.
-
-1999-03-08 <lfb@scriptics.com>
-
- * win/tkWinWm.c: Toplevel class no longer shared between
- threads.
-
- * win/tkWinX.c: Multiple threads no longer share the same
- TkDisplay structure. Required because TkDisplay stores much
- thread-specific data for a given thread.
-
- * win/tkWinSend.c: Moved application instance handle out
- out thread-local storage. DDE was failing to initialize
- when the instance handles were different between threads.
-
- * win/makefile.vc: Added THREADDEFINES for building with
- threads enabled.
-
- * generic/tkMenu.c:
- * win/tkWinMenu.c:
- * unix/tkUnixMenu.c: Added TkpMenuThreadInit for initializing
- thread-specific Menu state.
-
-1999-03-01 <redman@scriptics.com>
-
- * win/tkWinWm.c:
- * win/tkWinPointer.c:
- * win/tkWinInt.h: Fix "focus -force" for Windows. The Win32 API
- function SetForegroundWindow() does not work unless the window
- handle is a toplevel window (a Windows toplevel). The handle
- being passed was a Tk toplevel, which is a child of the Windows
- toplevel.
-
-1999-02-26 <redman@scriptics.com>
-
- * win/cat.c: Remove this file, use the one in the Tcl source directory.
-
- * win/makefile.vc: Remove the wishc.exe from the default targets. Add
- a separate console-wish target to build it. The need for a
- console-wish will go away soon, so we don't want to encourage its
- use.
-
-1999-02-25 <redman@scriptics.com>
-
- * win/tkWinWm.c: Properly initialize the tsdPtr->firstWindow field.
-
- * win/cat.c: Code for cat32.exe, copied from the Tcl sources. Required
- in order to run the test suite from the makefile
-
- * win/winMain.c: Add main() for a console-based wishc.exe, which meant
- adding code to disable the call to Tk_ConsoleInit().
-
- * generic/tkConsole.c: Check the standard handles before creating the
- new standard channels. This allows a windows app that has stdin,
- stdout, or stderr to correctly connect to them.
-
- * generic/tkMain.c: Add a proper check for the interactive mode, since
- the standard channels may actually be connected in windows mode or
- even in the console-based wish.
-
- * win/makefile.vc: Add targets for wishc.exe (console-based wish) and
- cat32.exe (for testing). Fix the test suite target so it can be run
- from the makefile (which can happen since the standard handles have
- been fixed).
-
-1999-02-12 <lfb@scriptics.com>
-
- * generic/tkMenuButton.h:
- * generic/tkMenuButton.c:
- * mac/tkMacMenubutton.c:
- * mac/tkMacDefault.h
- * unix/tkUnixMenubu.c: Eliminated Tk_Uids used by -state option.
- * unix/tkUnixDefault.h
- * win/tkWinDefault.h
-
-
- * generic/tk.h:
- * generic/tkScale.h:
- * generic/tkScale.c:
- * generic/tkWindow.c:
- * unix/tkUnixScale.c:
- * unix/tkUnixDefault.h:
- * unix/tkWinDefault.h:
- * mac/tkMacDefault.h: Objectified scale widget.
-
- * win/tkWinX.c: Removed Thread-specific data from process
- initialization code that was stopping the Tk Dll from
- loading.
-
-1999-02-11 <stanton@GASPODE>
-
- * README:
- * generic/tk.h:
- * unix/configure.in:
- * win/README:
- * win/makefile.bc:
- * win/makefile.vc: Updated version to 8.1b2.
-
- * unix/tkUnixSend.c: Fixed one more Tcl_*ObjVar instance.
-
-1999-02-04 <stanton@GASPODE>
-
- * Various cleanup related to the Tcl_Eval and Tcl_ObjSetVar
- changes in Tcl.
-
- INTEGRATED PATCHES FROM 8.0.5b2:
-
- * win/tkWinMenu.c (TkpDestroyMenu): Changed so modalMenuPtr is
- cleared when it is being destroyed.
-
- * generic/tkImgPhoto.c: Changed so color tables are freed
- immediately instead of being delayed. This ensures that color
- tables are properly disposed at process exit.
-
- * library/prolog.ps: Changed string that determines font height to
- include European character with an umlaut.
-
- * generic/tkImgBmap.c (ImgBmapConfigureInstance): If an image
- mask changed but ended up with the same XID, the GC failed to be
- updated and so the new mask was not used. [Bug: 970]
-
- * generic/tkFocus.c (SetFocus): Changed so focus window is always
- set if -force is specified. This fixes the problem on Windows
- where Tk does not activate the window if it already has focus.
+2005-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * generic/tkConsole.c: Fixed so errors in console eval are
- reported properly. Eliminated duplicate result messages. [Bug: 973]
+ * tests/all.tcl: Add a [package require Tk] so that a missing display
+ causes an early failure and keeps the error trace short. Issue observed
+ in [FRQ 11122147], even though that's unrelated.
- * win/tkWinWm.c: Changed so windows that aren't resizable don't
- have resize handles and the zoom box is disabled.
+2005-02-11 Jeff Hobbs <jeffh@ActiveState.com>
- * win/tkWinInt.h:
- * win/tkWinPointer.c: Changed to cancel the mouse timer when a
- user initiated move/resize loop begins.
+ * library/panedwindow.tcl (::tk::panedwindow::Cursor): check window
+ existence on delayed call. [Bug 949792]
- * unix/configure.in: TK_LD_SEARCH_FLAGS was set incorrectly if
- SHLIB_LD_LIBS='${LIBS}', and shared linking is performed through
- the C compiler. Systems affected are Linux, MP-RAS and NEXTSTEP,
- but also with gcc on many more systems. [Bug: 908]
+ * doc/text.n: note 'image' key in 'dump' command. [Bug 1115907]
- * win/makefile.vc: First stab at install target. Fixed quoting so
- paths with spaces work.
+ * win/tkWinWm.c (TkWinGetIcon): fix toplevel retrieval for determining
+ icon ref (potential crash). [Bug 1105738]
- * tests/main.test:
- * tests/unixWm.test: Better cleanup of temporary files.
+ * generic/tkCanvBmap.c (ConfigureBitmap, ComputeBitmapBbox): Fixed
+ possible crash with disabled bmap and bbox handling [Bug 1119460]
+ (BitmapToPostscript): made aware of various bitmap types
- * mac/tkMacAppInit.c:
- * generic/tkTest.c:
- * generic/tkAppInit.c:
- * win/winMain.c: Changed some EXTERN declarations to extern
- since they are not defining exported interfaces. This avoids
- generating useless declspec() attributes and makes the windows
- makefile simpler.
+ * unix/Makefile.in: remove SHLIB_LD_FLAGS (only for AIX, inlined into
+ * unix/tcl.m4: SHLIB_LD). Combine AIX-* and AIX-5 branches in
+ * unix/configure: SC_CONFIG_CFLAGS. Correct gcc builds for AIX-4+ and
+ HP-UX-11. autoconf-2.59 gen'd.
- * library/menu.tcl (tkMenuFind): Changed so keyboard shortcuts
- will only be found in the current toplevel. Previously, they
- might be found in menus attached to other toplevels that might not
- even be mapped. [Bug: 924]
+2005-02-09 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * generic/tkCanvLine.c: Changed to treat zero width lines like
- they have width 1 for purposes of selection. [Bug: 925]
+ * tests/wm.test: Convert to use more tcltest2 features.
- * win/tkWinFont.c (Tk_MeasureChars): Added a workaround for a bug
- in GetTextExtentExPoint on Win NT 4.0/Japanese. [Bug: 1006]
+2005-02-07 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * unix/tkUnixSend.c (Tk_SetAppName): Fixed uninitialized memory
- access bug. [Bug: 919]
+ * generic/tkCanvas.c (CanvasWidgetCmd): Fix stupid mistake in variable
+ names, reported by Andreas Leitgeb.
-1999-1-28 <stanton@GASPODE>
+2005-02-03 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
- * generic/tkGrid.c: Fixed bug in "grid forget" that failed to cancel
- pending idle handlers, resulting in a crash in a few odd cases.
+ * generic/tkCanvas.c (GetStaticUids): New function to manage the
+ thread-specific data detailing the list of all uids in a thread.
+ (typeList): Protect this (the other piece of global data) with a mutex.
+ [Bug 1114977]
-1999-01-06 <lfb@JUSTICE>
+2005-01-31 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tk.h, generic/tkGet.c, generic/tkConfig.c,
- * generic/tkOldConfig.c, generic/tkEntry.c, generic/tkMenubutton.c,
- * generic/tkMenubutton.h, generic/tkScale.c, generic/tkScale.h,
- * generic/tkTextDisplay.c, generic/tkText.c, unix/tkUnixMenubu.c,
- * unix/tkUnixScale.c, mac/tkMacMenu.c, mac/tkMacMenubutton.c,
+ * unix/tcl.m4, unix/configure: add solaris-64 gcc build support. [Bug
+ 1021871]
- Removed global Tk_Uids dealing with "-state" configuration option
- and added new TK_CONFIG_STATE configSpec that doesn't use
- Tk_Uids.
+2005-01-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-1998-12-11 === Tk 8.1b1 Release ===
+ * generic/tkImgPhoto.c (PhotoFormatThreadExitProc): Made the comments
+ in the code more relevant to the function they were documenting! [Bug
+ 1110553]
-1998-12-11 <stanton@GASPODE>
+ * library/msgs/es_ES.msg: Added more localization for Spanish Spanish.
+ [Bug 1111213]
- * generic/tkMain.c (Tk_Main): Fixed improper command line encoding
- handling.
+2005-01-25 Daniel Steffen <das@users.sourceforge.net>
-1998-12-08 <stanton@GASPODE>
+ * macosx/tkMacOSXInit.c (TkpInit): set tcl_interactive to 1 to show
+ console at startup instead of directly calling [console show].
- * win/tkWinClipboard.c (TkSelGetSelection, TkWinClipboardRender):
- Changed to handle multibyte characters properly. [Bug: 935]
+ * unix/tcl.m4 (Darwin): fixed bug with static build linking to dynamic
+ library in /usr/lib etc instead of linking to static library earlier in
+ search path. [Tcl Bug 956908]
+ Removed obsolete references to Rhapsody.
+ * unix/configure: autoconf-2.57
-1998-12-07 <stanton@GASPODE>
+2005-01-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * library/xmfbox.tcl (tkMotifFDialog_Create): In the cached case,
- the data array was not being initialized with the correct set of
- widgets.
+ * library/demos/menu.tcl: Reworked to make dialogs children of the
+ demo widget so that they are properly visible. Issue reported by Keith
+ Nash <k.j.nash@usa.net>
-1998-12-4 <welch@SAGE>
+2005-01-13 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * Changed patchLevel to 8.1b1
+ * library/tkfbox.tcl (IconList_Selection, IconList_Create):
+ (IconList_Arrange): Assorted tk_getOpenFile fixes. [part of Bug 600313]
+ (IconList_ShiftMotion1): Also fix shift-drag.
- * generic/tkMenu.c (ConfigureMenuCloneEntries): The -menu configuration
- option was being incorrectly specified as just "menu".
+2005-01-12 Don Porter <dgp@users.sourceforge.net>
-1998-11-30 <stanton@GASPODE>
+ * unix/tcl.m4: Sync'ed to Tcl's copy.
+ * unix/configure: autoconf-2.57
- * generic/tkButton.c (ConfigureButton): The error result was
- getting lost when restoring configuration options. [Bug: 619]
+2005-01-12 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-1998-11-25 <stanton@GASPODE>
+ * doc/event.n: Added section on predefined virtual events. [Bug 608115]
- * unix/tkUnixFont.c (GetFontAttributes): Initialize an unspecified
- family to an empty string.
- (FontMapLoadPage): if the font included characters below 32, the
- index computation was incorrect because the range was shifted up
- to 32.
- (CreateClosestFont): check for empty locale as well as NULL.
+2005-01-11 Vince Darley <vincentdarley@users.sourceforge.net>
- * generic/tkFont.c (TkFontParseXLFD): initialize charset to
- iso8859-1 if no charset is specified.
+ * generic/tkTextDisp.c: fix to scrollbar height calculations of text
+ widgets containing a single very long (wrapped) line. This fixes at
+ least part of [Bug 1093631].
- * mac/tkMacHLEvents.c (OdocHandler): added conversion from
- external string to UTF [Bug: 869]
+2005-01-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * integrated tk8.0.4 changes.
+ * generic/tkObj.c (TkParsePadAmount):
+ * generic/tkPack.c: Moved function to tkObj.c and rewrote so that it
+ takes advantage of Tcl_Objs properly and cannot leave objects in an
+ inconsistent state. [Bug 1098779]
- * generic/tkBind.c: fixed deletion order bug where a crash would
- result if a binding deleted "."
+2005-01-10 Joe English <jenglish@users.sourceforge.net>
- * generic/tkMenu.c (MenuWidgetObjCmd): disabled menu entries were
- getting reenabled whenever the mouse passed over the entry [Bug: 860]
+ * unix/Makefile.in, unix/configure.in, unix/tkConfig.sh.in:
+ Remove ${DBGX}, ${TK_DBGX} from Tk build system. [Patch 1081595]
+ * unix/tcl.m4: re-synced with tcl/unix/tcl.m4
+ * unix/configure: Regenerated.
- * unix/tkUnixMenu.c (TkpComputeStandardMenuGeometry): hidemargin
- option was not honored properly in menus [Bug: 859]
+2005-01-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-1998-11-24 <stanton@GASPODE>
+ * generic/tkWindow.c (GetScreen): Make sure the result is reset on all
+ error paths to stop strange errors. [Bug 697915]
- * tkMacMenu.c, tkUnixMenu.c, tkWinMenu.c, tkMenuDraw.c, tkMenu.h,
- * tkMenu.c: Backed out the previous fix for bug 620 and
- eliminated a bunch of code that created unnecessary objects.
- Changed back to using internal types instead of objects for many
- configuration options. There are many more fixes like this that
- could be made, but some require a little restructuring of the
- code. In any case the leaks are fixed and there is a lot less
- allocation happening. [Bug: 620]
+2005-01-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-1998-11-19 <stanton@GASPODE>
+ * doc/loadTk.n, doc/toplevel.n: Convert to other form of emacs mode
+ control comment to prevent problems with old versions of man. [Bug
+ 1085127]
- * tkMenu.c (DestroyMenuEntry): fixed memory leaks [Bug: 620]
+2005-01-03 Jeff Hobbs <jeffh@ActiveState.com>
- * tkWinX.c (GetTranslatedKey): fixed bad code merge
+ * win/tkWinWm.c (TkWinWmCleanup): clean up layered window class. This
+ caused crash in reinit of Tk (as seen in plugin).
- * tkWinWm.c, tkWinMenu.c: fixed titles and menus so they properly
- display Unicode [Bug: 819]
+ ******************************************************************
+ *** CHANGELOG ENTRIES FOR 2004 AND 2003 IN "ChangeLog.2004" ***
+ *** CHANGELOG ENTRIES FOR 2002 AND EARLIER IN "ChangeLog.2002" ***
+ ******************************************************************
diff --git a/ChangeLog.2002 b/ChangeLog.2002
new file mode 100644
index 0000000..b523e7d
--- /dev/null
+++ b/ChangeLog.2002
@@ -0,0 +1,7877 @@
+2002-12-27 David Gravereaux <davygrvy@pobox.com>
+
+ * generic/tkText.h: ANSI unfriendly typedef for TkTextBTree
+ repaired for C++ compilers.
+
+2002-12-27 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c (WaitForEvent): process Map and Unmap events
+ as well as Configure events during WaitFor{Configure|Map}Notify.
+ Fixes [Bug 578569] (WaitForMapNotify could process Map and Unmap
+ events out of order, making Tk think a window was unmapped when
+ it really wasn't).
+
+2002-12-18 Todd M. Helfter <tmh@purdue.edu>
+
+ * doc/label.n: Fixed documentation of the -compound option to
+ the label widget. The option was simply missing from the
+ man page [Bug 577540]
+
+2002-12-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/photo.n: Fixed documentation of the put subcommand to no
+ longer talk about files and to mention that you can use colour
+ names for working with solid colours. [Bug 640026]
+
+2002-12-13 Don Porter <dgp@users.sf.net>
+
+ * generic/tkMain.c (Tk_Main): Call on Tcl*StartupScript*() routines
+ to store the startup script, if any. [Bug 616245].
+
+2002-12-10 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: tclThreadTest.obj not required to link
+ tktest.exe [Bug 651396]
+
+2002-12-08 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkEntry.c (ConfigureEntry): keep a flag to indicate when
+ a var is traced to prevent double-traces caused by configuring the
+ widget in traces with validation on. (dejong)
+
+2002-12-07 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkInt.decls: add TkWinSetHINSTANCE decl
+ * generic/tkIntPlatDecls.h: regen
+ * generic/tkStubInit.c: regen
+ * win/tkWinInit.c (TkpInit): While init and cleanup aren't correct
+ * win/tkWinX.c (TkWinXInit): in DllMain, we had to specify the
+ * win/tkWin32Dll.c (DllMain): true HINSTANCE or the resources of a
+ dynamic Tk weren't being loaded correctly. Created a new function
+ TkWinSetHINSTANCE for this purpose.
+
+2002-12-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinX.c (TkWinXInit): Move cleanup into an exit handler
+ * win/tkWin32Dll.c (DllMain): to ensure that it will be called
+ * win/tkWinWm.c (TkWinWmCleanup): without having to unload the dll.
+ Also reset the static int initialized on cleanup to allow reinit.
+
+2002-12-01 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/event.test (_keypress, _text_ind_to_x_y): Force focus to
+ widget in _keypress method to avoid problems with window managers
+ that use focus follows mouse. [Bug 526209]
+
+2002-12-01 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Add wm-transient-6.3 to check that a transient
+ remains withdrawn when it is first withdrawn and then turned into
+ a transient.
+ * unix/tkUnixWm.c:
+ * win/tkWinWm.c: Replace WM_TRANSIENT_WITHDRAWN with WM_WITHDRAWN
+ and set this flag whenever a window is explicitly withdrawn. This
+ fixes the test case added above. [Bug 644356]
+
+2002-11-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/textDisp.test:
+ * generic/tkTextDisp.c (TkTextSeeCmd): handle see for unmapped
+ text displays. [Bug #641778]
+
+2002-11-19 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXScrlbr.c (TkpDisplayScrollbar): If the
+ scrollbar width is set to 12 or less (but 12 is what you
+ should use) use the small metric scrollbar.
+
+ (UpdateControlValues): Fix thinko in setting off AUTO_ADJUST for
+ the place geometry manager.
+
+2002-11-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in: add macosx/*.tcl (buildTkConfig.tcl in
+ particular) to the dist target.
+
+2002-11-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkWindow.c (Tk_DestroyWindow, DeleteWindowsExitProc):
+ Add TkHalfdeadWindow type and halfdeadWindowList to keep track of
+ windows that were only partially deallocated before a call to
+ exit. Finish cleaning up these windows in DeleteWindowsExitProc.
+ Keep track of cleanup status in Tk_DestroyWindow so that a window
+ with a Destroy binding which calls exit will get fully destroyed.
+ * tests/window.test: Add Tk_DestroyWindow tests for an assortment
+ of half dead window cases. [Bug 630533]
+
+2002-11-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: fixed erroneous
+ removal of libtkstub before Wish was built.
+
+2002-11-07 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/unixWm.test: Add short delay to test unixWm-51.7
+ to account for raise/lower changes in TIP 107. This allows
+ the test case to pass under Window Maker on Linux.
+
+2002-11-07 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/place.test:
+ * generic/tkPlace.c: place info did not return all settings,
+ and didn't make sure the result was a proper list.
+ Put '-in' first in result to be more consistent with how
+ grid/pack info behaves. [Bug #635025][Bug #532022]
+
+2002-11-07 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in: added macosx/README to dist target.
+ * macosx/Wish.pbproj/project.pbxproj: fix to 'wish' script
+ to allow it to work when not installed into '/'.
+
+2002-11-06 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+ * win/configure: Regen.
+ * win/configure.in: Check that AR, RANLIB, and RC
+ are found on the path when building with gcc.
+
+2002-11-04 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: added Wish linker flag
+ -headerpad_max_install_names to allow use of 'install_name_tool'.
+ fixed tkConfig.sh generation and redo_prebinding in the case where
+ Tk is not installed alongside Tcl.
+
+2002-11-03 David Gravereaux <davygrvy@pobox.com>
+
+ * win/winMain.c (Tcl_AppInit): Calls Registry_Init() and
+ Dde_Init() when STATIC_BUILD and TCL_USE_STATIC_PACKAGES macros
+ are set.
+
+ * win/makefile.vc: linkexten option now sets the
+ TCL_USE_STATIC_PACKAGES macro which also adds the registry and
+ dde static lib files to the link of the shell. [Patch 479697]
+
+ * win/rules.vc: Matches the one from Tcl.
+
+ * win/buildall.vc.bat: More useful commentary.
+
+2002-11-01 Andreas Kupries <andreask@activestate.com>
+
+ * win/makefile.vc (TCLREGLIBNAME): Updated to registry 1.1.
+
+2002-10-29 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/README: added info on new package searching in
+ Frameworks directories.
+
+2002-10-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.4.1 TAGGED FOR RELEASE ***
+
+ * changes: updated for 8.4.1 release
+
+2002-10-21 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/README: revised according to Jim's suggestions
+ * macosx/tkMacOSXAppInit.c: use standard PATH_MAX from <limits.h>
+
+2002-10-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/winMain.c (WinMain, main): remove obsolete SetMessageQueue call
+
+ * win/configure: Regen.
+ * win/tcl.m4 (SC_CONFIG_CFLAGS): Check for bug in Cygwin version
+ of windres and work around that case by passing a POSIX path
+ instead of a Windows native path. One can't always pass a POSIX
+ path because the mingw native toolchain accepts only Windows
+ native paths. (dejong)
+
+ * win/tkWinPort.h: define OPEN_MAX only if not defined.
+ [Patch #625472] (howell)
+
+2002-10-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tkMacAppInit.c: removed tcltest dependency.
+ [Bug #592639] (porter)
+
+2002-10-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/imgPhoto.test:
+ * generic/tkImgPhoto.c (ImgPhotoConfigureMaster): fix arg handling
+ for missing -format or -data options. [Bug #624974]
+
+ * tests/text.test: properly return the number of
+ * unix/tkUnixFont.c (ControlUtfProc): bytes consumed. [Bug #624732]
+
+2002-10-17 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/README: info specific to building and running
+ TclTk on Mac OS X, answers to tcl-mac list FAQs.
+ * macosx/Makefile: permission fix after embedded install.
+ * macosx/Wish.pbproj/project.pbxproj: after install, fix
+ permissions of uninstalled products.
+
+2002-10-17 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: added TEXT document
+ type to plist so that files can be dragged onto Wish Shell.
+
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXFont.c: added private proc
+ TkMacOSXUseAntialiasedText() to enable/disable quickdraw
+ text antialiasing where available, default is enabled.
+ Added a linked boolean ::tk::mac::antialiasedtext with
+ write trace to allow control of antialiasing from tcl.
+
+2002-10-16 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXMenu.c: fix to accelerators shown in menus
+ with non-alphanumeric keys.
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXKeyboard.c: applied first patch from [Patch
+ #622582] to fix some of [Bug #616988]. Further work is needed
+ in this area, but this will let foreign keyboards at least work
+ reasonably with Tk.
+
+2002-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure:
+ * unix/tcl.m4: add AIX-5 ppc build support. Remove unused
+ SC_ENABLE_MEMDEBUG.
+
+ * win/configure:
+ * win/tcl.m4: Add --enable-shared=mem support.
+
+2002-10-10 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/grid.test:
+ * generic/tkGrid.c: The grid size was not updated properly
+ when removing a widget from a grid. [Bug #621241] (forssen)
+
+2002-10-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/canvPs.test: tests for canvas embedded window ps generation
+ * generic/tkCanvWind.c (CanvasPsWindow): removed dead code loop.
+ * generic/tkCanvas.h: moved TkColormapData struct to tkCanvPs.c
+ * generic/tkCanvPs.c (TkImageGetColor): corrected bogus use of
+ TkColormapData on Windows (Windows now requires RGB pixel data
+ from image).
+ * win/tkWinImage.c (XGetImage, XGetImageZPixmap): added support
+ for generating ps for embedded widgets on canvases on Windows,
+ tested for 8, 16, 24 and 32-bit depths (XGetImageZPixmap not used).
+
+ * library/tk.tcl: simplified the adding of extra <ISO_Left_Tab>
+ and <hpBackTab> events to <<PrevWindow>>.
+
+2002-10-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/README: doc'ed --enable-symbols options.
+ * unix/Makefile.in: comment docs
+ * unix/configure: regen
+ * unix/tcl.m4: replaced SC_ENABLE_MEMDEBUG with a more intelligent
+ SC_ENABLE_SYMBOLS that takes yes|no|mem|all as options now.
+
+2002-10-09 Don Porter <dgp@users.sf.net>
+
+ * generic/tk.h: Added reminder comment to edit
+ macosx/Wish.pbproj/project.pbxproj when version number changes.
+
+2002-10-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Makefile: don't remove tclsh after building embedded.
+
+ * macosx/Wish.pbproj/project.pbxproj: bumped version to 8.4.1;
+ added missing library/mkpsenc.tcl to framework.
+
+2002-10-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkInt.decls(tkIntXlib): added XQueryTree declaration for
+ mac & aqua, since it's now called from ParentXId via Tk_HandleEvent.
+ * generic/tkIntXlibDecls.h:
+ * generic/tkStubInit.c: regen.
+ * mac/tkMacXStubs.c: added XQueryTree stub
+
+ * mac/tkMacEmbed.c (TkpUseWindow): check that container window
+ has -container option set (sync with other platforms).
+
+ * mac/tkMacBitmap.c:
+ * mac/tkMacFont.c:
+ * mac/tkMacSend.c:
+ * mac/tkMacTest.c:
+ * mac/tkMacWm.c: CONSTification.
+
+ * mac/tkMacProjects.sea.hqx: added tkStyle.c and tkUndo.c to
+ tk library projects.
+
+2002-10-09 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImgPhoto.c (ImgPhotoSetSize): Only error-out if we
+ fail to allocate a non-empty buffer; getting a NULL when we
+ allocate an empty buffer is no problem since nothing will look at
+ the value anyway. [Bug 619544]
+ Also tidied up file to take into account the fact that we're using
+ 32 bits per pixel in the master to accommodate the alpha channel
+ as well as RGB.
+
+2002-10-08 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/winButton.test: add option clear to top to prevent option
+ leakage from other tests causing problems. [Bug #582382]
+
+ * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd): leave the
+ DestroyPanedWindow proc to free the pwPtr, add a Preserve
+ reference to the pwPtr->tkwin.
+ (DestroyPanedWindow): Release the pwPtr->tkwin.
+
+ * generic/tkFocus.c (TkFocusFilterEvent): Ignore event if we are
+ focusing into a dead window. [Bug #588831] (griffin)
+
+2002-10-02 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXScrlbr.c (TkpDisplayScrollbar): Put the Tk scrollbar
+ pointer into the control reference data for the Mac scrollbar, so we
+ can get it out again in the ScrollbarActionProc.
+
+2002-10-02 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (TextBlinkProc): don't blink the cursor unless
+ it is visible. [Bug #616791] [Patch #614474] (bonfield)
+
+ * tests/entry.test: added entry-20.7
+ * generic/tkEntry.c (EntryTextVarProc): check if the entry is
+ being deleted before handling an associated textvariable.
+ [Bug #607390 #617446]
+
+2002-10-01 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/unixSelect.test (unixSelect-1.1[89]): Altered these tests
+ to work around [Bug #616923]
+ * unix/tkUnixSelect.c (SelRcvIncrProc,TkSelPropProc): It turns out
+ a much simpler and more robust solution is possible if we leverage
+ Tcl's encoding engine by using the same code path as for the
+ normal string selection. It might be a bit slower, but it should
+ be a lot more correct. [Bug #614650]
+
+2002-09-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/panedwindow.test: added panedwindow-28.[12]
+ * generic/tkPanedWindow.c (PanedWindowCmdDeletedProc):
+ (Tk_PanedWindowObjCmd): when destroying the panedwindow, destroy
+ the proxy before the parent to avoid dependency conflicts.
+ [Bug #616589]
+
+2002-09-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/unixSelect.test: Test for various things that can fail to
+ work in 8.4.0...
+ * unix/tkUnixSelect.c (TkSelPropProc,SelRcvIncrProc): Incremental
+ transfers of UTF8_STRING selections should now work; Tk will now
+ tag them with the right size and only transfer complete UTF8
+ characters. Previously, things only worked when the transfer
+ could only happen in one go, and even then not always. [Bug 614650]
+
+ * doc/bind.n: Doc-fix to mention that %A substitutes UNICODE
+ characters rather than ASCII ones. Tk's done this ever since 8.1
+ in any case; after all, it is the right thing to do.
+
+2002-09-27 Don Porter <dgp@users.sf.net>
+
+ * README: Bumped to version 8.4.1 to avoid confusion
+ * generic/tk.h: of CVS snapshots with release 8.4.0.
+ * unix/README:
+ * unix/configure.in:
+ * unix/tk.spec
+ * win/configure.in:
+
+ * unix/configure: autoconf
+ * win/configure:
+
+2002-09-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure: regen.
+ * unix/tcl.m4: improve AIX-4/5 64bit compilation support.
+
+ * unix/Makefile.in: add macosx subdir to dist target.
+ Do not generate .Z, only .gz and .zip in alldist target.
+
+2002-09-18 Mumit Khan <khan@nanotech.wisc.edu>
+
+ Added basic Cygwin support.
+
+ * win/tcl.m4 (SC_PATH_TCLCONFIG): Support one-tree build.
+ (SC_PATH_TKCONFIG): Likewise.
+ (SC_PROG_TCLSH): Likewise.
+ (SC_CONFIG_CFLAGS): Assume real Cygwin port and remove -mno-cygwin
+ flags. Add -mwin32 to extra_cflags and extra_ldflags.
+ Remove ``-e _WinMain@16'' from LDFLAGS_WINDOW.
+ * win/configure: Regenerate.
+
+ * win/tkWinPort.h (tchar.h): Do not include on Cygwin.
+ (_T): Define for Cygwin.
+ * win/winMain.c (main): Conditionally define.
+
+2002-09-26 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Makefile: preserve environment value of INSTALL_ROOT.
+ When embedding only use deployment build. Force relink before
+ embedded build to ensure new linker flags are picked up.
+
+ * macosx/buildTkConfig.tcl (new):
+ * macosx/Wish.pbproj/project.pbxproj: synthesize tkConfig.sh
+ based on tclConfig.sh in Tcl.framework and tkConfig.sh.in.
+ Add symbolic links to debug lib, stub libs and tkConfig.sh
+ in framework toplevel. Made tkIntXlibDecls.h a public header
+ since Headers/X11/Xlib.h includes it. Install wish8.4 script
+ that runs "Wish Shell.app" and corresponding wish link.
+ Use tcl headers from built Tcl.framework instead of from tcl
+ source directory.
+
+ * macosx/tkMacOSXPort.h: added missing standard unix includes
+ and defines, similarly to tkUnixPort.h.
+ * macosx/tkMacOSXNotify.c: removed dependency on internal tcl
+ header "tclPort.h"
+
+ * unix/Makefile.in:
+ * unix/install-sh: copied support for 'install-strip' target
+ over from tcl/unix/{Makefile.in,install-sh}
+
+2002-09-22 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXScrlbr.c (UpdateControlValue): HiliteControl
+ doesn't give the proper "nothing to scroll" look on Mac OS X.
+ You have to set the min value greater than the max value to
+ get this.
+
+2002-09-15 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+ * unix/tkUnixEvent.c (TkpCloseDisplay): Use PEEK_XCLOSEIM
+ to examine the input context queue before invoking
+ XCloseIM. Generate an assert if there is an input
+ context that has not been freed.
+ [Patch 570902]
+
+2002-09-13 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * generic/tk.h: Moved RC_INVOKED down so that tcl.h is still
+ included when running the resource compiler. <tcl.h> excludes the
+ unnecessary parts on its own. This reenables the Windows build. It
+ failed because the non-inclusion of tcl.h caused the resource
+ compiler to miss some vital macro definitions (TCL_FINAL_RELEASE,
+ STRINGIFY, ...).
+
+2002-09-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tk.h:
+ * mac/tkMacApplication.r:
+ * mac/tkMacLibrary.r:
+ * mac/tkMacResource.r:
+ * macosx/tkAboutDlg.r:
+ * macosx/tkMacOSXApplication.r:
+ * macosx/tkMacOSXLibrary.r:
+ * macosx/tkMacOSXResource.r: unified use of the two equivalent
+ resource compiler header inclusion defines RC_INVOKED and
+ RESOURCE_INCLUDED, now use RC_INVOKED throughout.
+
+ * macosx/tkMacOSXAppInit.c: improved detection of Wish startup
+ by the finder (by checking if stdin is /dev/null), in which
+ case we want to bring up the Tk console window.
+
+ * macosx/tkMacOSXHLEvents.c: added 'rapp' apple event handler.
+
+2002-09-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: reference & install
+ tk/generic/prolog.ps instead of tk/library/prolog.ps.
+
+2002-09-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: added backwards
+ compatibility for OSX 10.1 ProjectBuilder 2.0.
+
+2002-09-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in: added DYLIB_INSTALL_DIR variable for Darwin
+ and set it to default value ${LIB_RUNTIME_DIR}
+ * unix/tcl.m4 (Darwin): use DYLIB_INSTALL_DIR instead of
+ LIB_RUNTIME_DIR in the -install_name argument to ld.
+ * unix/configure: regen.
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Makefile: added support for building Tcl as an embedded
+ framework, i.e. using an dyld install_name containing
+ @executable_path/../Frameworks via the new DYLIB_INSTALL_DIR
+ unix/Makefile variable.
+
+2002-09-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.4.0 TAGGED FOR RELEASE ***
+
+2002-09-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXNotify.c (Tk_MacOSXSetupTkNotifier): corrected
+ Mac Jaguar event loop issue.
+
+ * library/tk.tcl: use command instead of control on Aqua bindings.
+ Force dialogs to appear below fixed native Mac menubar.
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXKeyboard.c: Keypress/release events for pure
+ modifier keys were not being passed to Tk.
+ Deadkey presses were inserting null characters into text windows.
+ Now they do nothing. (Still not ideal, but better than before!)
+ * macosx/tkMacOSXMenu.c: Allow more than 200 menus to exist -
+ increased to 2000.
+ * macosx/tkMacOSXMouseEvent.c: Bad interactions between floating
+ windows and ordinary ones. Ensure that local<->global coordinate
+ transformations are wrt to the correct window.
+ * macosx/tkMacOSXWm.c: Better error msg for 'wm attributes'.
+ Remove crash in 'wm transient'.
+ Add 'noActivates' and 'noUpdates' flags to unsupported command.
+ [Patch #606658] (darley)
+
+ * library/xmfbox.tcl (::tk::MotifFDialog_ActivateSEnt): corrected
+ msgcat code with XPG specifier. [Patch #606719] (miller)
+
+2002-09-06 Don Porter <dgp@users.sf.net>
+
+ * tests/unixWm.test (unixWm-50.3): Constrained test that hangs
+ on Windows.
+
+2002-09-05 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: added overlooked missing
+ TK_PATCH_LEVEL version bump to 8.4.0.
+
+2002-09-04 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * win/Makefile.in (install-libraries): Added code section to
+ install the message catalogs. Copied same section from
+ unix/Makefile.in and adapted it to the slightly different
+ environment.
+
+2002-09-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/button.tcl: further restrict buttons to not resetting
+ the "original" relief if it has changed in the interim. This
+ prevents code that simulated overrelief buttons from not working
+ in 8.4. [Bug #604270]
+
+2002-09-03 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: Bumped version number to
+ 8.4.0 and updated copyright info.
+
+2002-09-03 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c: fix to 'wm attributes' error-handling bug.
+
+2002-09-03 Don Porter <dgp@users.sf.net>
+
+ * changes: Updated for 8.4.0 release
+
+2002-09-02 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/cursor.test: reverted 2002-08-31 change for OS X to use
+ 'heart' cursor because 'arrow' on windows has a pre-skewed use
+ count. [Bug #602667]
+
+ * tests/button.test: added button-14.1
+ * win/tkWinButton.c (TkpComputeButtonGeometry): correct Win button
+ sizing to be equal for one-line buttons with -height of 0 or 1, as
+ well as -height 0 buttons with empty text and no image, which
+ should be the same as single-line text buttons. [Bug #565485]
+
+ * library/button.tcl (::tk::ButtonLeave): correctly restore state
+ of button to normal for unix bindings. [Bug #597920]
+
+ * doc/tk.n: added tk windowingsystem docs.
+
+ * tests/wm.test:
+ * unix/tkUnixWm.c: remove possible 2-second delay in 'raise'.
+ [Patch #601518] (english) TIP #107
+
+ * unix/tcl.m4: add support for 64-bit builds on HP-11 with gcc.
+ * unix/configure.in: make sure to substitute LD_LIBRARY_PATH_VAR.
+ * unix/configure: regend
+
+ * README: Bumped version number to 8.4.0
+ * generic/tk.h:
+ * unix/configure:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure:
+ * win/configure.in:
+
+ * generic/tkCmds.c:
+ * generic/tkWindow.c: made 'tk' available in safe interpreters,
+ but only the caret and windowingsystem subcommands may be called.
+ * tests/safe.test (safe-1.2): noted that tk is now available in
+ safe interps, but not the appname/scaling subcommands.
+
+ * tests/tk.test (tk-1.2): noted new tk windowingsystem subcommand
+
+2002-08-31 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4: update from Tcl
+
+ * unix/Makefile.in: import of TK_SHLIB_LD_EXTRAS for Tk library
+ specific linker settings. Added use of new LD_LIBRARY_PATH_VAR.
+
+ * unix/configure: regen
+
+2002-08-31 Daniel Steffen <das@users.sourceforge.net>
+
+ *** macosx-8-4-branch merged into the mainline [tcl patch #602770] ***
+
+ * generic/tk.decls:
+ * generic/tkInt.decls: added new "aqua" specific entries to the
+ stubs tables. Changed all "unix" entries to "x11" to allow us to
+ distinguish and build both "aqua" on MacOSX and "x11" on MacOSX.
+
+ * generic/tk.h: added a #ifnded RESOURCE_INCLUDED so that tk.h can
+ be passed to the resource compiler.
+
+ * generic/tkCmds.c (Tk_TkObjCmd): added [tk windowingsystem]
+ subcommand: returns "x11" when running on X11, "win32" on Windows,
+ "classic" on MacOS9 and "aqua" on MacOSX Aqua (i.e. Carbon)
+
+ * generic/tkFont.c (TkFontGetFirstTextLayout): new private function
+ returning the first chunk of a Tk_TextLayout, i.e. until the first
+ font change on the first line (or the whole first line if there is
+ no such font change).
+
+ * generic/tkMain.c: made Tcl_ThreadDataKey static
+
+ * library/demos/puzzle.tcl: fixed button metrics for aqua
+
+ * tests/cursor.test: check for presence of arrow cursor instead of
+ heart cursor
+
+ * xlib/xcolors.c: changed xColors static initialization to more
+ standard C
+
+ * macosx/Wish.pbproj/jingham.pbxuser (new):
+ * macosx/Wish.pbproj/project.pbxproj (new): project for Apple's
+ ProjectBuilder IDE.
+
+ * macosx/Makefile (new): simple makefile for building the project
+ from the command line via the ProjectBuilder tool 'pbxbuild'.
+
+ * macosx/tkMacOSXAppInit.c (new): macosx specific AppInit looking
+ for a AppMain.tcl file in its bundled Resources/Scripts folder. If
+ present, argv[1] is set to that file and the Scripts folder is
+ added to the auto_path. This allows tk apps to embed scripts within
+ their bundle directory structure.
+
+ * macosx/tkMacOSXInit.c (new): macosx adapted version of
+ tkUnixInit.c: we initialize & cache the Carbon native encoding
+ (e.g. 'macRoman') and try to find the tk script library files
+ inside Tk packaged as a framework.
+
+ * macosx/tkMacOSXNotify.c (new): new macosx specific merged
+ Carbon/select-based notifier.
+
+ * macosx/tkMacOSXEvent.c (new):
+ * macosx/tkMacOSXEvent.h (new):
+ * macosx/tkMacOSXKeyEvent.c (new):
+ * macosx/tkMacOSXMouseEvent.c (new):
+ * macosx/tkMacOSXWindowEvent.c (new): new macosx specific event
+ handling functionality.
+
+ * macosx/tkMacOSX.h (new):
+ * macosx/tkMacOSXBitmap.c (new):
+ * macosx/tkMacOSXButton.c (new):
+ * macosx/tkMacOSXClipboard.c (new):
+ * macosx/tkMacOSXColor.c (new):
+ * macosx/tkMacOSXConfig.c (new):
+ * macosx/tkMacOSXCursor.c (new):
+ * macosx/tkMacOSXDefault.h (new):
+ * macosx/tkMacOSXDialog.c (new):
+ * macosx/tkMacOSXDraw.c (new):
+ * macosx/tkMacOSXEmbed.c (new):
+ * macosx/tkMacOSXFont.c (new):
+ * macosx/tkMacOSXHLEvents.c (new):
+ * macosx/tkMacOSXInt.h (new):
+ * macosx/tkMacOSXKeyboard.c (new):
+ * macosx/tkMacOSXMenu.c (new):
+ * macosx/tkMacOSXMenubutton.c (new):
+ * macosx/tkMacOSXMenus.c (new):
+ * macosx/tkMacOSXPort.h (new):
+ * macosx/tkMacOSXRegion.c (new):
+ * macosx/tkMacOSXScale.c (new):
+ * macosx/tkMacOSXScrlbr.c (new):
+ * macosx/tkMacOSXSubwindows.c (new):
+ * macosx/tkMacOSXTest.c (new):
+ * macosx/tkMacOSXUtil.c (new):
+ * macosx/tkMacOSXUtil.h (new):
+ * macosx/tkMacOSXWm.c (new):
+ * macosx/tkMacOSXWm.h (new):
+ * macosx/tkMacOSXXStubs.c (new): macosx ports of classic mac Tk
+ implementation in tk/mac.
+
+ * macosx/tkMacOSXSend.c (new): only send to local interp
+ implemented currently.
+
+ * macosx/tkMacOSXDebug.h (new):
+ * macosx/tkMacOSXDebug.c (new): new macosx specific functions for
+ debugging MacOS events, regions, etc.
+
+ * macosx/tkAboutDlg.r (new):
+ * macosx/tkMacOSXApplication.r (new):
+ * macosx/tkMacOSXCursors.r (new):
+ * macosx/tkMacOSXLibrary.r (new):
+ * macosx/tkMacOSXMenu.r (new):
+ * macosx/tkMacOSXResource.r (new):
+ * macosx/tkMacOSXXCursors.r (new):
+ * macosx/tclets.r (new): sources for Rez resource compiler.
+
+ * macosx/Wish.icns (new): Wish application icon.
+
+ * generic/tk.h:
+ * generic/default.h:
+ * generic/tkBind.c:
+ * generic/tkCmds.c:
+ * generic/tkGrab.c:
+ * generic/tkPointer.c:
+ * generic/tkPort.h:
+ * generic/tkSelect.c:
+ * generic/tkStubLib.c:
+ * generic/tkTest.c:
+ * generic/tkText.c:
+ * generic/tkWindow.c:
+ * unix/tkUnix3d.c:
+ * xlib/xgc.c:
+ * xlib/X11/X.h:
+ * xlib/X11/Xlib.h:
+ * xlib/X11/Xutil.h: added #includes and #ifdefs for macosx
+
+ * library/bgerror.tcl:
+ * library/button.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/entry.tcl:
+ * library/listbox.tcl:
+ * library/menu.tcl:
+ * library/msgbox.tcl:
+ * library/scrlbar.tcl:
+ * library/spinbox.tcl:
+ * library/text.tcl:
+ * library/tk.tcl:
+ * library/demos/menu.tcl:
+ * library/demos/menubu.tcl:
+ * library/demos/widget: check [tk windowingsystem] instead of
+ and/or in addition to $tcl_platform(platform).
+
+ * generic/tkInt.h:
+ * mac/tkMacBitmap.c:
+ * mac/tkMacWm.c: added missing CONSTification
+
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkStubInit.c: regen
+
+2002-08-27 D. Richard Hipp <drh@hwaci.com>
+
+ * doc/checkbutton.n: [Bug 582457] Fix the -offrelief option so
+ * doc/radiobutton.n: that when -offrelief is flat and -relief is
+ * mac/tkMacButton.c: sunken and -overrelief is raised, buttons
+ * unix/tkUnixButton.c: work look toolbar buttons under Windows.
+ * win/tkWinButton.c: See also: TIP #82.
+
+2002-08-26 Don Porter <dgp@users.sf.net>
+
+ * win/Makefile.in: Removed dependence on the (parts of) the
+ * win/winMain.c: tcltest executable on Windows. It was not
+ used, and the dependency complicated the Makefile. [Bug 592638].
+
+2002-08-20 Don Porter <dgp@users.sf.net>
+
+ * README: Bumped version number to 8.4b3 to distinguish
+ * generic/tk.h: HEAD from the 8.4b2 release.
+ * unix/configure.in:
+ * win/configure.in:
+ * unix/tk.spec:
+
+ * unix/configure: autoconf
+ * win/configure:
+
+ * generic/tk.h: Added compile-time check that the tcl.h header file
+ #included by Tk 8.4 is one from Tcl 8.4. This is needed to be sure
+ that new #defines like CONST84 are available. [Bug 597432].
+
+2002-08-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (install-binaries): simplified pkgIndex.tcl
+ file created on installation.
+ * win/Makefile.in (install-binaries): corrected and simplified
+ creation of pkgIndex.tcl file on installation.
+
+2002-08-14 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/tkWinDialog.c:
+ * win/makefile.vc: broken compilation and link from changes
+ Hobbs-08-07 fixed.
+ * win/tkWinTest.c: CONST problem resolved.
+
+2002-08-13 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/button.tcl: change the bindings to use Priv($w,relief)
+ instead of just Priv(relief). This ensures that neighboring
+ buttons don't confuse (over)relief settings.
+
+2002-08-13 Reinhard Max <max@suse.de>
+
+ * unix/tkUnixSend.c (Tk_SetAppName): Fixed a compiler warning.
+
+2002-08-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/image2.tcl: Tweaked the behaviour of the directory
+ box on resize, as resizing of the overall window tends to be
+ common given the sample images.
+
+2002-08-08 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/tkUnixWm.c (WmTransientCmd): Apply fix for
+ wm transient assertion error that was applied
+ to tkWinWm.c for Tk Bug #592201.
+
+2002-08-08 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Add deleteWindows at start of
+ new transient tests so they do not fail if the
+ toplevels already exist.
+ * unix/tkUnixWm.c: Revert patch for Tk Bug #592201
+ which incorrectly removed numTransients member.
+
+2002-08-08 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c:
+ * win/tkWinWm.c:
+ * tests/wm.test: Fix for Tk Bug #592201 "wm transient fails with
+ two masters"; fixes panic after a transient window is reassigned
+ to new master and either master is subsequently destroyed.
+
+2002-08-08 Don Porter <dgp@users.sf.net>
+
+ * tests/unixWm.test: Corrected packaging of unixWm-50.3 so that
+ [setupbg] and [cleanupbg] always balance, no matter what tests
+ are skipped.
+
+2002-08-08 Reinhard Max <max@suse.de>
+
+ * unix/Makefile.in: Fixed typos in DISTNAME, and ZIPNAME.
+
+2002-08-08 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.4b2 TAGGED FOR RELEASE ***
+
+ * generic/tkButton.c (TkButtonWorldChanged): added GCFont handling
+ to the disabledGc of buttons when compound != none. The drawing
+ appears to be incorrect across platforms still. [Bug #477740]
+
+ * generic/tkImgGIF.c (FileReadGIF): fixed -from handling for gifs
+ [Bug #467524] (obermeier)
+
+2002-08-07 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkCanvUtil.c (TkSmoothParseProc): recognize the built-in
+ bezier method by name. [Bug #578654]
+ * doc/canvas.n: update to note that -smooth really doesn't take
+ or return just booleans.
+
+ * win/tkWinMenu.c (TkpSetWindowMenuBar): fixed logic bug in when
+ to idle call ReconfigureWindowsMenu.
+
+ * doc/GetBitmap.3: removed doc refs to deprecated
+ Tk_GetBitmapFromData. [Bug #590379]
+
+ * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd):
+ * library/panedwindow.tcl: changed class from PanedWindow to
+ Panedwindow to not conflict with existing bwidgets, but also to be
+ more regular with other names used in the core.
+
+ * tests/panedwindow.test: added -text foobar to some test buttons
+ to enable correct testing of panedwindow across platforms.
+ [Bug #582370]
+
+ * win/tkWinDialog.c: enabled use of the updated native Windows
+ directory browser (tk_chooseDirectory). This does require
+ shell32.dll v4.71 or greater. [Patch #468139]
+
+ * win/configure:
+ * win/tcl.m4: added shell32 to libs for updated native Windows
+ tk_chooseDirectory dialog.
+
+2002-08-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkPanedWindow.c (RESIZE_PENDING): Separated out flag for
+ indicating that a resize needs to be issued.
+ (PanedWindowReqProc): Do the old behaviour when the panedwindow is
+ not mapped; easiest way of making the test suite pass while still
+ preserving improved behaviour in the face of children whose size
+ is not known immediately.
+
+2002-08-06 Don Porter <dgp@users.sf.net>
+
+ * tests/defs.tcl: removed file. No longer needed now that Tk is
+ using the tcltest package to do its testing.
+
+2002-08-05 Don Porter <dgp@users.sf.net>
+
+ * win/tkWinFont.c: Additional changes to fix CONST warnings on
+ * win/tkWinWM.c: Windows due to latest patch. Tks Vince Darley.
+
+ * doc/3DBorder.3: Applied companion patch for Tcl Patch 585105,
+ * doc/BindTable.3: updating Tk to use Tcl 8.4's fully CONST-ified
+ * doc/ConfigWidg.3: interface, and fully CONSTifying Tk at the
+ * doc/CrtImgType.3: same time.
+ * doc/CrtWindow.3:
+ * doc/DeleteImg.3: This patch includes purging Tk of its last
+ * doc/FindPhoto.3: direct access to interp->result. [Bug 589853]
+ * doc/GetAnchor.3:
+ * doc/GetBitmap.3: The substantial changes include copying
+ * doc/GetCapStyl.3: event sequence strings into Tcl_DStrings
+ * doc/GetClrmap.3: in tkBind.c, and copying [text] indices into
+ * doc/GetColor.3: Tcl_DStrings because parsing them involved
+ * doc/GetCursor.3: overwriting them. If this causes performance
+ * doc/GetFont.3: trouble, that can be resolved by further
+ * doc/GetImage.3: converting them to Tcl_Obj's.
+ * doc/GetJoinStl.3:
+ * doc/GetJustify.3: The #defines USE_NON_CONST and USE_COMPAT_CONST
+ * doc/GetOption.3: have the same effect for Tk as they do for Tcl.
+ * doc/GetRelief.3: (They actually change tcl.h)
+ * doc/GetScroll.3:
+ * doc/GetVisual.3:
+ * doc/InternAtom.3:
+ * doc/NameOfImg.3:
+ * doc/SetAppName.3:
+ * doc/WindowId.3:
+ * generic/tk.decls:
+ * generic/tk.h:
+ * generic/tk3d.c:
+ * generic/tkAtom.c:
+ * generic/tkBind.c:
+ * generic/tkBitmap.c:
+ * generic/tkButton.c:
+ * generic/tkCanvArc.c:
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvImg.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvPs.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvUtil.c:
+ * generic/tkCanvWind.c:
+ * generic/tkCanvas.c:
+ * generic/tkCanvas.h:
+ * generic/tkClipboard.c:
+ * generic/tkCmds.c:
+ * generic/tkColor.c:
+ * generic/tkConfig.c:
+ * generic/tkConsole.c:
+ * generic/tkCursor.c:
+ * generic/tkDecls.h:
+ * generic/tkEntry.c:
+ * generic/tkFont.c:
+ * generic/tkFrame.c:
+ * generic/tkGet.c:
+ * generic/tkGrid.c:
+ * generic/tkImage.c:
+ * generic/tkImgBmap.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkInt.decls:
+ * generic/tkInt.h:
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkListbox.c:
+ * generic/tkMenu.c:
+ * generic/tkMenubutton.c:
+ * generic/tkMessage.c:
+ * generic/tkOldConfig.c:
+ * generic/tkOption.c:
+ * generic/tkRectOval.c:
+ * generic/tkScale.c:
+ * generic/tkScrollbar.c:
+ * generic/tkSelect.c:
+ * generic/tkStyle.c:
+ * generic/tkTest.c:
+ * generic/tkText.c:
+ * generic/tkText.h:
+ * generic/tkTextBTree.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextImage.c:
+ * generic/tkTextIndex.c:
+ * generic/tkTextMark.c:
+ * generic/tkTextTag.c:
+ * generic/tkTextWind.c:
+ * generic/tkUtil.c:
+ * generic/tkVisual.c:
+ * generic/tkWindow.c:
+ * mac/tkMacConfig.c:
+ * mac/tkMacCursor.c:
+ * mac/tkMacEmbed.c:
+ * mac/tkMacSend.c:
+ * unix/tkUnixConfig.c:
+ * unix/tkUnixCursor.c:
+ * unix/tkUnixEmbed.c:
+ * unix/tkUnixFont.c:
+ * unix/tkUnixSelect.c:
+ * unix/tkUnixSend.c:
+ * unix/tkUnixWm.c:
+ * win/tkWinConfig.c:
+ * win/tkWinCursor.c:
+ * win/tkWinEmbed.c:
+ * win/tkWinMenu.c:
+ * win/tkWinSend.c:
+
+2002-08-02 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkPanedWindow.c (DestroyPanedWindow): Idle calls need to
+ be deleted on destruction of the window, or things can *really* go
+ pear-shaped.
+
+2002-07-31 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkPanedWindow.c (PanedWindowReqProc): Postpone pane
+ arrangement until idle, as is done in other window managers, to
+ fix problems with size calculations when the children don't
+ already know their sizes anyway.
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2002-07-29 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/configure.in: Remove code that was setting
+ CC_SEARCH_FLAGS and LD_SEARCH_FLAGS to try to
+ account for cc vs ld linking. Tcl now handles this.
+ * unix/tcl.m4: Update from Tcl.
+
+2002-07-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in: Add MAJOR_VERSION, MINOR_VERSION,
+ PATCH_LEVEL, INSTALL_LIBRARY, STUB_LIB_FILE, and LIB_FILE
+ to support changes in tcl.m4 related to library builds.
+ Use MAKE_LIB macro to avoid dealing with RANLIB issues.
+ Rename TK_CC_SEARCH_FLAGS to CC_SEARCH_FLAGS and
+ rename TK_LD_SEARCH_FLAGS to LD_SEARCH_FLAGS.
+ Use new INSTALL_LIB and INSTALL_STUB_LIB substs to
+ deal with ranlib issues when install libraries.
+ * unix/configure: Regen.
+ * unix/configure.in: Remove AC_PROG_RANLIB since
+ this is done by tcl.m4 now. Define CC_SEARCH_FLAGS
+ instead of TK_CC_SEARCH_FLAGS and so on.
+ Use MAKE_LIB and MAKE_STUB_LIB from tcl.m4.
+ Remove AC_SUBST calls that are no done in tcl.m4.
+ * unix/tcl.m4: Update from Tcl.
+ * unix/tkConfig.sh.in: Subst CC_SEARCH_FLAGS and
+ LD_SEARCH_FLAGS.
+
+2002-07-25 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkInt.h:
+ * generic/tkWindow.c:
+ * mac/tkMacWm.c:
+ * unix/tkUnixWm.c:
+ * win/tkWinWm.c:
+ * tests/wm.test:
+ * tests/winWm.test:
+ * tests/unixWm.test: Objectifed wm. [Patch #564521]
+ Note: At this point the Mac file is completely untested
+ and may not even compile.
+
+2002-07-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/spinbox.test: added spinbox-22.[1-3]
+ * generic/tkEntry.c (ConfigureEntry): made the textvariable value
+ take precedence over changed -from/-to values, unless it must be
+ constrained. [Bug #559078]
+
+ * library/spinbox.tcl (MouseSelect): when not in the entry, just
+ return instead of invoking - ButtonUp handles invoking already.
+ [Bug #499168]
+
+ * library/tk.tcl (RestoreFocusGrab): handle the case where the
+ FocusGrab info is not set. [Bug #553283]
+
+2002-07-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/canvas.test: added canvas-14.[1-6]
+ * generic/tkCanvas.c (CanvasWidgetCmd): corrected handling of
+ 'scan' subcommand args. Also removed early return cases to goto
+ done instead where the canvasPtr would be Tcl_Release'd. This may
+ solve other problems with unreleased canvasPtr's. [Bug #581560]
+
+ * win/tkWinButton.c (TkpDisplayButton): corrected display of focus
+ ring around the actual text when the button is a compound button.
+ [Bug #583691]
+
+ * unix/README: Corrected notes about running user interactive Tk
+ tests. [Bug #462320]
+
+ * generic/tkText.c (TextEditUndo): set isDirtyIncrement to -1 when
+ reverting to note proper "dirtiness". [Bug #580362] (callewaert)
+
+ * generic/tkEntry.c (DisplayEntry): correct cursor position before
+ calling Tk_SetCaretPos. (yamamoto)
+
+2002-07-23 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2002-07-22 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * library/choosedir.tcl (tk::dialog::file::chooseDir):
+ * library/clrpick.tcl (tk::dialog::file::chooseDir):
+ * library/msgbox.tcl (tk::MessageBox):
+ * library/tkfbox.tcl (tk::dialog::file):
+ * library/xmfbox.tcl (tk::MotifFDialog):
+ Revert [Tk patch 568278]. The transient window workaround
+ is no longer needed since the fix for [Tk bug 570764]
+ solved the problem for withdrawn transients.
+
+2002-07-19 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure:
+ * unix/configure.in:
+ * win/configure:
+ * win/configure.in: Add AC_PREREQ(2.13) in an attempt
+ to make it more clear that the configure scripts
+ must be generated with autoconf version 2.13.
+ [Tcl Bug 583573]
+
+2002-07-19 D. Richard Hipp <drh@hwaci.com>
+
+ * library/mkpsec.tcl: Fix a bug that was causing postscript generation
+ to fail under Win2K.
+
+2002-07-18 Reinhard Max <max@suse.de>
+
+ * unix/tkUnixSend.c: Using Tcl_GetTime instead of TclpGetTime.
+
+2002-07-17 Reinhard Max <max@suse.de>
+
+ * library/unsupported.tcl: Extended ExposePrivateVariable, and
+ ExposePrivateCommand to accept patterns as well.
+
+2002-07-17 Don Porter <dgp@users.sf.net>
+
+ * generic/tkFont.c: Corrected reversed logic in assert -> panic
+ conversion. [Bug 582799]
+
+2002-07-16 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkFont.c (TkFontPkgFree): Call panic instead
+ of assert since assert is not used in the rest of Tk.
+ [Tk bug 579651]
+
+2002-07-16 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in:
+ * win/Makefile.in: Add a more descriptive warning
+ in the event `make genstubs` needs to be rerun.
+
+2002-07-16 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/tkWinWm.c:
+ * doc/wm.n: fix for part of [Bug 581627], and made iconbitmap
+ code on Windows more flexible about reading in icons [Bug
+ 220800].
+
+2002-07-15 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.bc (new): re-add of the borland makefile. Submitted
+ by Helmut Giese <hgiese@ratiosoft.com>. This needs testing, still.
+
+2002-07-15 Don Porter <dgp@users.sf.net>
+
+ * Fixes for [Bug 581627, 581795].
+ * generic/tkTest.c: Test commands not supported on non-Unix
+ platforms should not be defined there in the first place.
+ * tests/constraints.tcl: Fixed "secureserver" constraint.
+ * tests/unixWm.test: Some tests needed "unix" constraint.
+ * win/tkWinWm.c: Typo in error message.
+
+2002-07-14 Don Porter <dgp@users.sf.net>
+
+ * tests/event.test: Fixes to enable testing of only userInteraction
+ * tests/visual_bb.test: tests.
+
+ * README: Bumped HEAD to version 8.4b2 in order to
+ * generic/tk.h: distinguish it from the 8.4b1 release.
+ * unix/configure*: Also extended LOCALES to cover all message
+ * unix/tk.spec: catalogs.
+ * win/configure*:
+
+ * tests/focustTcl.test: Conversion bug: Corrected backwards logic.
+ * tests/imgPhoto.test: Conversion bug: overwrote unix/README.
+
+ * tests/all.tcl: Completed conversion of Tk test suite
+ * tests/constraints.tcl: to use tcltest.
+ * tests/[b-v]*.test:
+ * unix/Makefile.in:
+
+2002-07-12 Don Porter <dgp@users.sf.net>
+
+ * tests/constraints.tcl: Converted more files to tcltest and
+ * tests/[g-x]*.test: factored out common code.
+
+2002-07-11 Don Porter <dgp@users.sf.net>
+
+ * tests/canvPsImg.tcl: Converted several files in the
+ * tests/constraints.tcl (new file): Tk test suite for testing by
+ * tests/[r-x]*.test: tcltest 2.1.
+ * unix/Makefile.in:
+
+2002-07-11 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinDialog.c (Tk_ChooseDirectoryObjCmd): initialize
+ utfTitle to NULL, add a few more notes about limitations of
+ possible new Tk_ChooseDirectoryObjCmd function.
+
+2002-07-11 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/imgPhoto.test (imgPhoto-15.1): Added test of mem-alloc
+ failure, but this is non-portable.
+ * generic/tkImgPhoto.c (ImgPhotoSetSize): Allowed this function to
+ fail when it can't allocate enough memory. Note that not all the
+ places that call it can fail nicely without API changes; some
+ still panic but at least some of the potential failures are now
+ handled gracefully.
+
+ * tests/visual_bb.test (lpr): Stopped this from relying on
+ external files; direct piping is much more flexible for this
+ application.
+
+2002-07-09 Don Porter <dgp@users.sf.net>
+
+ * generic/tkTest.c: Removed unused dependence on TclThread_Init()
+ * tests/defs.tcl: and [testthread]. [Bug 578165, Tcl Bug 531413]
+
+2002-07-08 David Gravereaux <davygrvy@pobox.com>
+
+ * unix/Makefile.in: Added missing win/lamp.bmp to the dist
+ target.
+
+2002-07-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.4b1 TAGGED FOR RELEASE ***
+
+2002-07-04 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/bgerror.tcl (bgerror): Stopped the bgerror dialog from
+ getting wider than the screen; in theory really long messages
+ could make it become taller than the screen now, but that's much
+ less likely to happen. Also trimmed a little bit of internal
+ space so that the icon-message gap is the same as the icon-frame
+ and message-frame gaps.
+
+2002-07-01 Don Porter <dgp@users.sf.net>
+
+ * unix/configure:
+ * unix/tcl.m4: Updated to latest tcl.m4 from Tcl.
+
+2002-06-28 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/msgbox.tcl (MessageBox): Force all non-button widgets to
+ have the same background as the containing toplevel. [Bug #552515]
+
+2002-06-27 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * win/Makefile.in (install-binaries): Fix of troubled Makefile
+ quoting introduced by [Patch 521356] causing the installed to
+ fail.
+
+2002-06-25 Don Porter <dgp@users.sf.net>
+
+ * unix/tkUnixFont.c: (Tk_DrawChars) silence compiler warning.
+
+2002-06-26 David Gravereaux <davygrvy@pobox.com>
+
+ * generic/tkStyle.c: <eol> of the committing cvs client didn't
+ match the <eol> of the file itself. Windows users where getting
+ \r\r\n. Problem fixed.
+
+2002-06-26 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * generic/tkFont.c (TkTextLayoutToPostscript): fixed potential
+ buffer overflow which could be intentionally triggered from
+ within safe interpreter -- malicious applet could modify
+ tk::psglyphs array.
+
+2002-06-26 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * tests/font.test (font-32.1): updated this test
+ to expect the new behavior of canvas postscript.
+
+2002-06-25 Don Porter <dgp@users.sf.net>
+
+ * unix/Makefile.in: Expanded install-binaries target to create
+ * win/Makefile.in: and install a pkgIndex.tcl file to enable
+ Tk as a loadable package [Patch 521356]
+
+2002-06-25 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * library/mkpsenc.tcl: (added) utilities to generate
+ Postscript prolog for current system encoding.
+ * generic/tkCanvPs.c (TkCanvPostscriptCmd): now
+ uses mkpsenc.tcl to generate Postscript prolog.
+ * generic/tkFont.c (TkTextLayoutToPostscript): modified
+ according to patch #546910. Now outputs system-encoded
+ characters (for unibyte) or Adobe glyph names (for
+ multibyte or outside-locale).
+ * tests/canvText.test (canvText-17.1): updated this test
+ to expect the new behavior of canvas postscript.
+
+2002-06-25 Reinhard Max <max@suse.de>
+
+ * unix/tcl.m4: New macro SC_CONFIG_MANPAGES.
+ * unix/configure.in: Added support for symlinks and compression
+ * unix/Makefile.in: when installing the manpages. [Patch 518052]
+ Default is still hardlinks and no compression.
+
+ * unix/mkLinks: generated
+ * unix/configure:
+
+ * unix/README: Added documentation for the new features.
+
+ * unix/configure: Replaced ${exec_prefix}/lib
+ * unix/tcl.m4 (SC_PATH_TCLCONFIG): by ${libdir}.
+
+2002-06-24 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/winWm.test: Verify that both an unmapped
+ and already mapped toplevel are raised and receive
+ the focus when deiconified.
+ * tests/wm.test: Add wm deiconify tests. Check that
+ a toplevel that has never been mapped is not mapped
+ by the deiconify command since it should be done
+ at idle by MapFrame.
+ * win/tkWinWm.c (Tk_WmCmd): Check the WM_NEVER_MAPPED
+ flag while processing the wm deiconify command.
+ The WM_UPDATE_PENDING flag should never be set when
+ WM_NEVER_MAPPED is set, but double check so that
+ the implementation is more explicit and matches
+ the comment just above.
+ Return without invoking TkWmRestackToplevel or
+ TkSetFocusWin on a toplevel that has never been
+ mapped. This fixes a bug where a toplevel is mapped
+ with the wrong size and is then resized by the
+ idle call to MapFrame. [Tk bug 233150]
+
+2002-06-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (UpdateGeometryInfo): remove the check for a null
+ wrapper introduced in r1.41 on 2002-06-15 because it prevented
+ geometry setting from taking effect if the window was not on the
+ screen. Another check may go in it's place as IsIconic and
+ IsZoomed should not be passed NULL.
+
+2002-06-22 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Remove invalid minsize test. Add update
+ calls to wm transient tests so that idle handlers get
+ run. This is needed to get the tests to pass under Win32.
+ * unix/tkUnixWm.c (WmWaitMapProc): Move the special
+ transient withdrawn check into the if body to
+ make it easier to set a breakpoint on this test
+ inside a debugger. No functional changes.
+ * win/tkWinWm.c (WmWaitVisibilityOrMapProc): Ditto.
+
+2002-06-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/wm.n: TIP #95 Windows implementation and
+ * mac/tkMacWm.c (Tk_WmCmd): docs with mac and unix stubs.
+ * unix/tkUnixWm.c (Tk_WmCmd):
+ * win/tkWinWm.c (Tk_WmCmd):
+ * tests/unixWm.test:
+ * tests/winWm.test: more wm attr tests will be needed.
+
+ * generic/tkGrid.c (GridReqProc): check that gridPtr is not NULL
+ (may be when embedded). [Bug #548791] (halliday)
+
+ * generic/tkFont.c (TkFontPkgFree): changed panic on freeing fonts
+ to an assert, and wrapped panic in #ifdef PURIFY. [Bug #568701]
+
+ * library/menu.tcl: corrected menus from being posted offscreen
+ on Windows. [Bug #464451] (darley)
+
+ * library/console.tcl: corrected the defaultPrompt substitution
+ [Bug #553207] and made Tab a default expansion key (like Escape).
+
+ * win/tkWinEmbed.c (EmbedWindowDeleted): added a check for a null
+ containerPtr. The core of this bug is likely elsewhere. [Bug #476176]
+
+ * doc/text.n: TIP #93 implementation that
+ * generic/tkText.c (TextWidgetCmd): enhances the text get and
+ * generic/tkTextIndex.c (TkTextGetIndex): delete methods to accept
+ * tests/text.test: multiple range pairs.
+ This handles the delete case in an atomic, fixed-index fashion.
+
+2002-06-21 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Add tests to make sure a withdrawn
+ transient does not get remapped by state changes
+ in the master.
+ * unix/tkUnixWm.c (Tk_WmCmd, WmWaitMapProc):
+ * win/tkWinWm.c (Tk_WmCmd, WmWaitVisibilityOrMapProc):
+ Add a WM_TRANSIENT_WITHDRAWN flag that gets set by the
+ withdraw, deiconify, or state wm subcommands. Check
+ this flag before mapping a transient when processing
+ a MapNotify event. [Tk bug 570764]
+
+2002-06-21 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * unix/tk.spec (version), README, win/configure.in, unix/configure.in:
+ * generic/tk.h (TK_RELEASE_*, TK_PATCH_LEVEL): Bumped to beta1.
+
+2002-06-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/text.n: TIP #104 implementation which generalizes the
+ * generic/tkText.c: undo/redo stack to not be tied solely to the
+ * generic/tkText.h: text widget. The APIs are still private.
+ * generic/tkUndo.c: This also adds a stack limiting ability and
+ * generic/tkUndo.h: a -maxundo option to the text widget (in
+ * library/text.tcl: addition to the options from TIP #26) should
+ * mac/tkMacDefault.h: users want to limit the undo/redo stack
+ * tests/text.test: (should not be necessary in most cases).
+ * unix/Makefile.in: [Patch #554763] (callewart)
+ * unix/tkUnixDefault.h:
+ * win/Makefile.in:
+ * win/makefile.vc:
+ * win/tkWinDefault.h:
+
+2002-06-21 Don Porter <dgp@users.sf.net>
+
+ * unix/Makefile.in: Removed unnecessary dependence of tktest
+ * unix/tkAppInit.c: executable on the tcltest executable on
+ Unix. If there are similar dependencies on other platforms, they
+ can probably be removed as well. [Bug 572134].
+
+2002-06-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/listbox.n:
+ * generic/tkListbox.c (DisplayListbox):
+ * mac/tkMacDefault.h: TIP #94 implementation adding -activestyle
+ * tests/listbox.test: option to the listbox. This adds the ability
+ * unix/tkUnixDefault.h: to have listboxes look native on Windows, and
+ * win/tkWinDefault.h: "nicer" elsewhere using the 'dotbox' style.
+
+2002-06-20 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkGrid.c: Corrected the test for grid propagate change.
+ [Bug #571433]
+
+2002-06-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/panedwindow.test:
+ * generic/tkPanedWindow.c: ensure that sash index is lower bounds
+ checked. [Bug #548727]
+
+2002-06-19 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkClipboard.c (TkClipCleanup): Add code
+ to set dispPtr->clipWindow to NULL, this was
+ accidently removed by last commit. Fixes
+ a crash while running the tests under win32.
+
+2002-06-19 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkBind.c (TkBindDeadWindow):
+ Handle case where Tk_DestroyWindow is invoked
+ on clipboard and send windows.
+ * generic/tkClipboard.c (TkClipCleanup):
+ Invoke Tk_DestroyWindow to cleanup the
+ dispPtr->clipWindow. Call Tcl_Preserve
+ and Tcl_Release on the window to avoid an
+ invalid memory ref on shutdown.
+ * generic/tkEvent.c (Tk_HandleEvent):
+ Panic if XCreateIC is invoked twice for
+ the same window. This should never happen,
+ the check were just added to make sure it
+ does not since this could lead to crashes
+ in XCloseIM.
+ * generic/tkFocus.c (TkFocusDeadWindow):
+ Handle case where Tk_DestroyWindow is invoked
+ on clipboard and send windows.
+ * generic/tkOption.c (TkOptionDeadWindow): Ditto.
+ * generic/tkWindow.c (TkCloseDisplay): Move
+ deletion of dispPtr->winTable after TkpCloseDisplay
+ call since Tk_DestroyWindow uses it and could
+ be called by TkpCloseDisplay for clipboard/send windows.
+ Also invoke ckfree for the dispPtr instead of
+ doing it in TkpCloseDisplay.
+ (Tk_DestroyWindow): Check for a null winPtr->mainPtr
+ before doing certain cleanup tasks so the we can
+ invoke Tk_DestroyWindow on clipboard and send windows.
+ We need to do this so that XDestroyIC will get invoked
+ for the input contexts of each window.
+ * mac/tkMacXStubs.c (TkpCloseDisplay): Don't free
+ the displayPtr since this is now done in TkCloseDisplay.
+ * unix/tkUnixEvent.c (TkpCloseDisplay, OpenIM): Remove
+ conditional compilation around calls to XCloseIM
+ since I am confident that the crashes related to
+ input contexts has been fixed. Don't free
+ the displayPtr since this is now done in TkCloseDisplay.
+ * unix/tkUnixSend.c (TkSendCleanup): Invoke the
+ Tk_DestroyWindow method to cleanup the special
+ send window. This will call XDestroyIC and thereby
+ avoid a crash in XCloseIM. The send window needs
+ to be Tcl_Preserve and Tcl_Release to avoid an
+ invalid memory ref on shutdown.
+ * win/tkWinX.c (TkpCloseDisplay): Don't free
+ the displayPtr since this is now done in TkCloseDisplay.
+ [Tk patch 570902]
+
+2002-06-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkStyle.c: TIP#48 style engine.
+ See http://purl.org/tcl/tip/48.html for details.
+
+ * generic/tkConfig.c (GetOptionFromObj): Split to allow for access
+ to option tables via name as well as via object.
+ (TkGetOptionSpec): Semi-public interface to GetOption functionality.
+ (DoObjConfig, Tk_RestoreSavedOptions, FreeResources)
+ (GetObjectForOption): Basic style support for configure.
+
+ * generic/tkWindow.c (TkCreateMainWindow, Tk_DestroyWindow): Added
+ calls to set up and tear down the style subsystem.
+
+ * generic/tk.decls, generic/tk.h: Many declarations forming TIP#48
+ public interface.
+
+ * generic/tkInt.decls (TkStylePkgInit,TkStylePkgFree):
+ * generic/tkInt.h (TkGetOptionSpec): Supporting declarations.
+
+ * unix/Makefile.in, win/Makefile.in, win/makefile.vc: Added
+ tkStyle.c to list of generic source files.
+
+2002-06-18 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/defs.tcl (makeFile): Defined the return value of this
+ procedure to be the filename of the created file, as in the real
+ tcltest package...
+
+2002-06-17 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkImage.c (Tk_ImageObjCmd, DeleteImage): Call
+ Tcl_Preserve and Tcl_Release for the masterPtr->winPtr
+ window to avoid accessing memory that had already
+ been deallocated in DeleteImage.
+
+2002-06-17 David Gravereaux <davygrvy@pobox.com>
+
+ Trims to support the removal of RESOURCE_INCLUDED from rc
+ scripts from Tcl's accepted FR #565088.
+
+ * generic/tk.h: Changed RESOURCE_INCLUDED to be RC_INVOKED
+ as the RC tool defines this already by default.
+
+ * win/rc/tk.rc:
+ * win/rc/wish.rc: removed the #define RESOURCE_INCLUDED lines.
+
+2002-06-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (dist): correct installation of
+ wish.exe.manifest to DISTDIR target directory.
+
+ * generic/tkCmds.c (Tk_TkObjCmd):
+ * generic/tkInt.h (struct TkCaret):
+ * mac/tkMacXStubs.c (Tk_SetCaretPos):
+ * unix/tkUnixKey.c (TkpGetString, Tk_SetCaretPos):
+ * win/tkWinX.c (Tk_SetCaretPos):
+ * tests/tk.test: Added 'tk caret' implementation of TIP#96
+ * doc/SetCaret.3 (new): which adds a TkCaret structure element to
+ * doc/tk.n: TkDisplay for maintaining state.
+
+ * unix/tkUnixSend.c (TkSendCleanup): special cleanup of
+ inputContext to avoid bug in XCloseIM. (dejong)
+
+2002-06-17 Don Porter <dgp@users.sf.net>
+
+ * library/msgs/en_gb.msg: Added catalog for UK English.
+ Currently includes only Color -> Colour translation.
+
+2002-06-17 D. Richard Hipp <drh@hwaci.com>
+
+ * doc/checkbutton.n:
+ * doc/radiobutton.n:
+ * generic/tkButton.c:
+ * generic/tkButton.h:
+ * mac/tkMacButton.c:
+ * tests/button.test:
+ * unix/tkUnixButton.c:
+ * win/tkWinButton.c: Implementation of TIP#82 - Added the
+ -offrelief option to checkbutton and radiobutton.
+
+2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkWindow.c (Tk_DestroyWindow): Set the pathName
+ component of a window to NULL after its memory has been
+ deallocated to avoid a possible illegal memory access
+ as a result of a call to Tk_PathName() on a Tk_Window
+ structure of a window that has already been destroyed.
+ [Tk bug 521946]
+
+2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkOption.c (Tk_GetOption): Allocate
+ memory with ckalloc not malloc. This keeps
+ Tk from erroring out when built with
+ TCL_MEM_DEBUG.
+
+2002-06-14 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkBind.c (HandleEventGenerate):
+ * generic/tkInt.h: changed warpInProgress boolean from int to a
+ bit in the flags variable (TK_DISPLAY_IN_WARP)
+
+ * generic/tkCmds.c (Tk_TkObjCmd):
+ * unix/tkUnixKey.c (TkpGetString):
+ * generic/tkEvent.c (Tk_HandleEvent):
+ * generic/tkInt.h: changed useInputMethods boolean from int to a
+ bit in the flags variable (TK_DISPLAY_USE_IM)
+
+ * generic/tkInt.h:
+ * generic/tkCmds.c (Tk_WmObjCmd):
+ * unix/tkUnixWm.c (Tk_WmCmd):
+ * win/tkWinWm.c (Tk_WmCmd): changed wmTracing from being an int to
+ just a bit in the flags variable (TK_DISPLAY_WM_TRACING)
+
+ * generic/tkEvent.c (Tk_HandleEvent):
+ * unix/tkUnixEvent.c (OpenIM):
+ * unix/tkUnixKey.c (TkpGetString):
+ * generic/tkInt.h: added TK_DISPLAY_XIM_SPOT flag bit for TkDisplay
+ and used this to allow a runtime check to see if over-the-spot XIM
+ is possible. If not it will try and fallback to the old-style
+ input context, which handles things like dead keys input.
+
+ * generic/tk.decls: added TIP #84 implementation that adds a
+ * generic/tkDecls.h: Tk_CollapseMotionEvents API which controls Tk's
+ * generic/tkEvent.c: collapsing of incoming motion events on its
+ * generic/tkInt.h: windows. The default remains to do collapsing.
+ * generic/tkStubInit.c: Added a flags parameter to the internal display
+ * generic/tkWindow.c: structure to support this and be used in the
+ * doc/QWinEvent.3: future for other bits. [Tk patch 564642]
+
+ * unix/mkLinks: updated from current docs
+
+2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkEvent.c (TkXErrorHandler): Declare static
+ function to avoid compiler error with VC++.
+ * generic/tkBind.c (ExpandPercents): Cast argument to
+ Tk_GetAtomName in order to avoid compiler warning.
+
+2002-06-14 Joe English <jenglish@users.sf.net>
+
+ * doc/bind.n:
+ * generic/tk.h:
+ * generic/tkBind.c:
+ * generic/tkCanvWind.c:
+ * generic/tkCmds.c:
+ * generic/tkEvent.c:
+ * generic/tkFocus.c:
+ * generic/tkGrab.c:
+ * generic/tkGrid.c:
+ * generic/tkImage.c:
+ * generic/tkPack.c:
+ * generic/tkPlace.c:
+ * generic/tkPointer.c:
+ * generic/tkTextWind.c:
+ * generic/tkWindow.c:
+ * mac/tkMacSubwindows.c:
+ * mac/tkMacWindowMgr.c
+ * mac/tkMacWm.c:
+ * unix/Makefile.in:
+ * unix/tkUnixEmbed.c:
+ * unix/tkUnixWm.c:
+ * win/tkWinScrlbr.c:
+ * win/tkWinWindow.c:
+ * win/tkWinWm.c: Implementation of TIP #47 by Neil McKay
+ "Modifying Tk to Allow Writing X Window managers".
+ Add CirculateRequest, Create, MapRequest, ResizeRequest,
+ and ConfigureRequest event types;
+ Split TK_TOPLEVEL flag into TK_TOPLEVEL, TK_HAS_WRAPPER,
+ TK_WIN_MANAGED, and TK_TOP_HIERARCHY. [Tk patch 572978]
+
+2002-06-14 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * unix/tkAppInit.c: Removed now unneeded and erroneous reference
+ to 'matherr'. See Tcl ChangeLog entry 2002-05-31 Don Porter.
+
+2002-06-14 David Gravereaux <davygrvy@pobox.com>
+
+ * win/rules.vc: The test for compiler optimizations was in error.
+ Thanks goes to Roy Terry <royterry@earthlink.net> for his
+ assistance with this.
+
+2002-06-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ Implement TIP 98 [Tk patch 566765]
+
+ * doc/FindPhoto.3, generic/tk.h, generic/tk.decls:
+ * generic/tkImgPhoto.c: Changed *_Old to *_NoComposite and
+ USE_OLD_PHOTO_PUT_BLOCK to USE_COMPOSITELESS_PHOTO_PUT_BLOCK
+ following a suggestion from Don Porter.
+
+ * tests/imgPhoto.test: Added tests of -compositingrule
+
+ * doc/photo.n: Added documentation for "-compositingrule".
+ * generic/tkImgPhoto.c (ImgPhotoCmd, ParseSubcommandOptions): New
+ "-compositingrule" option for [$photo copy] subcommand, using
+ OPT_COMPOSITE flag and compositingRule field in SubcommandOptions
+ structure.
+
+ * doc/FindPhoto.3: Documented the extra argument for the
+ compositing rule and the action to take if anyone wants to
+ maintain total backward-compatability.
+
+ * generic/tk.h (TK_PHOTO_COMPOSITE_*): Defined values for use as
+ compositing rules.
+ (USE_OLD_PHOTO_PUT_BLOCK): Added a way for users to select the old
+ interface to Tk_PhotoPutBlock to provide an easier upgrade path.
+
+ * generic/tk.decls: Alter Tk_PhotoPut*Block to Tk_PhotoPut*Block_Old
+ and introduce new slots for the old name of function with an extra
+ argument at the end for the compositing rule.
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Updated "transparency set"
+ subcommand to use TkSubtractRegion().
+
+ * win/tkWinRegion.c (TkSubtractRegion):
+ * mac/tkMacRegion.c (TkSubtractRegion):
+ * generic/tkInt.decls (TkSubtractRegion):
+ * unix/tkUnixPort.h (TkSubtractRegion): Added function to perform
+ the set-difference operation on regions; it seems all platforms
+ can support it, and it makes removing rectangular bits from
+ regions much easier.
+
+ * generic/tkImgPPM.c (FileReadPPM): Reading a PPM/PGM always uses
+ the SET compositing rule because it is faster and the format does
+ not have any transparency information.
+
+ * generic/tkImgGIF.c (FileReadGIF): Reading a GIF always uses the
+ SET compositing rule because GIF files model transparency as a
+ single special colour.
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
+ Added a compositing rule to allow better control over what happens
+ to transparent pixels when inserting data into a photo image.
+
+2002-06-13 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/winfo.test: Add basic tests for winfo ismapped.
+
+2002-06-13 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/unixWm.test:
+ * tests/wm.test: Move wm minsize and wm maxsize
+ usage tests into the cross platform wm tests.
+
+2002-06-13 Don Porter <dgp@users.sf.net>
+
+ * tests/cursor.test: corrected error after cursor-2.2.
+ * tests/defs.tcl: Added enhancements to Tk's fake version of
+ tcltest required by recent cursor.test changes.
+
+2002-06-13 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/cursor.test (cursor-2.[34]): Tests added to ensure that
+ cursor specs really are well-behaved lists. Also some general
+ clean-up...
+ * win/tkWinCursor.c (TkGetCursorByName): Undone Jeff's back-off
+ and fixed things so that they should work now. Cursor specs are
+ lists first and foremost.
+
+2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * changes: Clearly label wm transient changes as
+ a POTENTIAL INCOMPATIBILITY.
+ * doc/wm.n: Remove "some window managers will" text
+ and explicitly state what behavior a transient
+ window will display. Also mention that it is an
+ error to make a window a transient of itself.
+
+2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * library/choosedir.tcl (tk::dialog::file::chooseDir):
+ * library/clrpick.tcl (tk::dialog::file::chooseDir):
+ * library/msgbox.tcl (tk::MessageBox):
+ * library/tkfbox.tcl (tk::dialog::file):
+ * library/xmfbox.tcl (tk::MotifFDialog): Remove the
+ transient property on dialogs after they have been
+ dismissed to insulate them from further state changes
+ in the master. This keeps a withdrawn dialog from
+ being mapped when the master is deiconified. [Tk patch 568278]
+
+2002-06-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinCursor.c (TkGetCursorByName): reverted fix from
+ 2002-06-06 because it broke the ability to use built-in cursors
+ like left_ptr.
+
+2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * library/choosedir.tcl (tk::dialog::file::chooseDir):
+ * library/clrpick.tcl (tk::dialog::color):
+ * library/dialog.tcl (tk_dialog):
+ * library/msgbox.tcl (tk::MessageBox):
+ * library/tkfbox.tcl (tk::dialog::file):
+ * library/xmfbox.tcl (tk::MotifFDialog_Create):
+ Only make the dialog window a transient if
+ the master is visible. This check already
+ appeared in some of the dialogs. This patch
+ just copies the check into those that were
+ lacking. [Tk patch 568253]
+
+2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * changes: Add note about new transient behavior.
+ * tests/unixWm.test: Check that the WM_TRANSIENT_FOR
+ property for a transient window is being cleared
+ when the master is destroyed.
+ * tests/wm.test: Source defs.tcl instead of using
+ tcltest to match the rest of Tk's test files.
+ Add new tests that ensure that a transient's state
+ mirrors the state of the master.
+ * unix/tkUnixWm.c (WmInfo, TkWmNewWindow, TkWmMapWindow)
+ (TkWmDeadWindow, Tk_WmCmd, WmWaitMapProc): Add numTransients
+ member to WmInfo structure. Keep state of master and
+ transient in sync using a callback that tracks MapNotify
+ and UnmapNotify events. When the master is mapped, map
+ the transient. When the master is unmapped or iconified,
+ withdraw the transient.
+ * win/tkWinWm.c (TkWmMapWindow, TkpWmSetState)
+ (TkWmDeadWindow, Tk_WmCmd, WmWaitVisibilityOrMapProc):
+ Keep state of master and transient in sync using a
+ callback that tracks MapNotify and UnmapNotify events.
+ Move masterPtr check from TkpWmSetState into TkWmMapWindow
+ to deal with WM_NEVER_MAPPED transients. Cleanup
+ numTransients and the callback in TkWmDeadWindow.
+ Cleanup numTransients and the callback only after
+ deleting a master in wm transient command to avoid
+ deleting the callback when an error is raised.
+ Add support for MapNotify and UnmapNotify events
+ to the master callback. [Tk patch 561708]
+
+2002-06-11 Joe English <jenglish@users.sf.net>
+
+ * library/menu.tcl: fix for bug report #530212 "Bad Window Path
+ Name in tkMenuFind"
+
+2002-06-10 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: Fixed a win98 issue where the /exclude option
+ for xcopy is unsupported.
+ Reported by Roy Terry <royterry@earthlink.net>.
+
+2002-06-10 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * library/tk.tcl: added utility functions to get "-underline" and
+ "-text" for labels and buttons from translatable string containing
+ "magic ampersand" [patch #566605]
+ * library/clrpick.tcl:
+ * library/msgbox.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl: some places where msgcat is used to get
+ translated label are modified to handle labels with magic ampersand.
+ * library/msgs/ru.msg: russian translations added
+ * library/msgs/cs.msg:
+ * library/msgs/de.msg:
+ * library/msgs/el.msg:
+ * library/msgs/es.msg:
+ * library/msgs/fr.msg:
+ * library/msgs/it.msg:
+ * library/msgs/nl.msg: all translation files now have labels with
+ 'magic ampersand' where appropriate. In el.msg some ampersands are
+ missing, as I don't know which underline positions seems natural
+ to "el" users.
+
+2002-06-09 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * library/bgerror.tcl (tk::dialog::error::bgerror):
+ Don't set the bgerror dialog as a transient of
+ itself since this operation is ill defined.
+
+2002-06-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * win/tkWinCursor.c (TkGetCursorByName): Fixed so that the reading
+ of cursors from a file with a cursor spec was built using [list]
+ works when the file has a space in instead of requiring fiddling
+ with backslashes.
+
+2002-06-06 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * library/msgbox.tcl (MessageBox): Add -default normal
+ when creating non-default buttons for message box.
+ They already get -default normal when they're
+ unfocused, and dialog window size used to change suddenly
+ in such cases.
+
+2002-06-05 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * unix/tkUnixFont.c (Tk_DrawChars): Don't assume that
+ one char is always one byte, and that required
+ subfont for the last character in any string is
+ the same as for the previous character
+ [Bug #559435] [Patch #559437]
+
+2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * changes: Document [wm transient .t .t] error.
+ * tests/wm.test: Check that setting a window
+ as a transient of itself raises an error. Check
+ that passing a non-toplevel window to the wm
+ transient command uses the enclosing toplevel.
+ * unix/tkUnixWm.c (Tk_WmCmd): Raise an error
+ if the user tries to make a toplevel a
+ transient of itself.
+ * win/tkWinWm.c (Tk_WmCmd): Raise an error
+ if the user tries to make a toplevel a
+ transient of itself. Test for other error
+ before checking for the transient self error.
+
+2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/tkUnixWm.c (WmInfo, TkWmCleanup, TkWmNewWindow)
+ (TkWmMapWindow, TkWmDeadWindow, Tk_WmCmd): Replace
+ WmInfo's master and masterWindowName members with
+ a masterPtr member. This implementation is much
+ simpler and mirrors the Win32 implementation. This
+ change makes it easy to check the flags of the
+ master window. No user visible changes.
+
+2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkInt.decls: Add unix decl for TkpWmSetState.
+ * generic/tkIntPlatDecls.h: Regen.
+ * generic/tkStubInit.c: Regen.
+ * tests/wm.test: Test state changes between iconic,
+ normal, and withdrawn both before and after initial
+ mapping.
+ * unix/tkUnixWm.c (Tk_WmCmd, TkpWmSetState): Move
+ state change code into TkpWmSetState to more closely
+ match the Win32 implementation. No user visible changes.
+
+2002-05-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/embed.test: Added cross platform embed tests.
+ Check that window passed to -use has the -container
+ option set.
+ * tests/wm.test: Remove useless catch call. Deiconify
+ . just in case, stackorder tests will not pass unless
+ it is in the normal state. Add -container flag to
+ embedded stackorder test.
+ * unix/tkUnixEmbed.c (TkpUseWindow):
+ * win/tkWinEmbed.c (TkpUseWindow): Lookup Tk window
+ based on the id passed in as the value for -use.
+ Generate an error if the Tk window did not have
+ the -container option set.
+
+2002-05-26 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkButton.c (ConfigureButton): When creating
+ a radiobutton with -value "" it was not drawn properly
+ if the -variable was created by the radiobutton.
+ [Bug #548765]
+
+2002-05-26 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkCanvText.c (ComputeTextBbox): Negative
+ coordinates were rounded badly causing a 1 pixel
+ displacement. [Bug #556526]
+
+2002-05-24 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * mac/tkMacWm.c (Tk_WmCmd):
+ * tests/unixWm.test: Move wm transient checks over
+ to wm.test so they will be run on all systems.
+ * tests/wm.test: Add tests to check for error when
+ an iconwindow is passed to the wm transient command.
+ * unix/tkUnixWm.c (Tk_WmCmd):
+ * win/tkWinWm.c (Tk_WmCmd): Raise an error if one
+ of the windows passed to the wm transient command
+ is an iconwindow for another toplevel.
+
+2002-05-23 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * mac/tkMacWm.c (TkWmStackorderToplevelWrapperMap):
+ * tests/wm.test: Add embedded Window test case for
+ the stackorder command.
+ * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap):
+ * win/tkWinWm.c (TkWmStackorderToplevelWrapperMap):
+ Ignore embedded windows during wm stackorder command.
+
+2002-05-21 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/configure.in: Invoke SC_ENABLE_SHARED before
+ calling SC_CONFIG_CFLAGS so that the SHARED_BUILD
+ variable can be checked inside SC_CONFIG_CFLAGS.
+ * unix/tcl.m4: Update from Tcl.
+
+2002-05-20 Don Porter <dgp@users.sourceforge.net>
+
+ * library/tk.tcl: A little namespace cleanup on Daniel Steffen's
+ latest revisions to avoid defining new global commands.
+
+2002-05-20 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tkMacInit.c:
+ * mac/tkMacTclCode.r: include msgcat package in resources
+ as bgerror depends on it. Restores ability of mac static
+ build to run standalone (except for encoding file issues).
+
+ * mac/tkMacInit.c:
+ * library/console.tcl:
+ * library/tk.tcl: fix tk.tcl not sourcing library files
+ that define bindings at startup on mac. (independent of
+ tk library files being in resources or on auto_path)
+
+2002-05-08 Don Porter <dgp@users.sourceforge.net>
+
+ * library/bgerror.tcl:
+ * library/tclIndex: Cleaned up namespace usage of the bgerror
+ dialog. Completes soft dependence on msgcat. [FR 539309]
+
+2002-05-07 David Gravereaux <davygrvy@pobox.com>
+ * win/makefile.vc: Problem with TCLDIR macro not accepting
+ forward slash path seperators resolved. Added the same logic
+ to INSTALLDIR, too. [Bug #553208]
+
+2002-04-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure:
+ * unix/tcl.m4: change HP-11 SHLIB_LD_LIBS from "" to ${LIBS} so
+ that the .sl knows its dependent libs.
+
+2002-04-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tkMacTclCode.r:
+ * mac/tkMacResource.r: added check of
+ TCLTK_NO_LIBRARY_TEXT_RESOURCES #define to allow disabling the
+ inclusion of the tk library code in the resource fork of Tk
+ executables and shared libraries.
+ Moved tk library code inclusion to separate file like in tcl.
+ Added 'panedwindow' resource.
+
+2002-04-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/button.tcl (ButtonLeave): corrected the 3
+ implementations of ButtonLeave to check for Priv(relief) existing
+ before trying to use it. [Patch #541849]
+
+ * generic/tkTextDisp.c (DisplayLineBackground):
+ * unix/tkUnix3d.c (Tk_3DHorizontalBevel):
+ * unix/tkUnixFont.c (Tk_DrawChars): applied fixes to not overrun
+ the X window 16-bit size limit. [Patch #541999] (bonfield)
+
+2002-04-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkTextDisp.c (GetXView, GetYView): Comparison with
+ previous values of scrollbar range are now done in a way that is
+ sensitive to the bizarreness of floating-point on architectures
+ where IEEE-FP is not used on the processor. Also increased the
+ size of the temporary buffer to take account of the fact that
+ TCL_DOUBLE_SPACE is meant to only imply enough space to take a
+ printed double and trailing '\0', and no more. [Bug #223739]
+ (FP_EQUAL_SCALE): New macro to help compare floating-point numbers
+ for equality in a sane way, used in GetXView and GetYView.
+
+2002-04-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkWindow.c (TkCloseDisplay): Added to centralize where a
+ display was closed. This handles freeing memory associated with a
+ display and closing it.
+ (DeleteWindowsExitProc): actually close displays. This would also
+ ideally be done in Tk_DestroyWindow when the last window on the
+ display has been closed, but that still has unresolved order of
+ cleanup problems.
+ (Tk_DestroyWindow): added TkFocusFree call.
+
+ * generic/tkStubInit.c:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntDecls.h:
+ * generic/tkInt.decls: added TkFocusFree, TkClipCleanup and
+ TkGCCleanup generic private procs, and TkWmCleanup, TkSendCleanup
+ and TkFreeXId unix private procs.
+
+ * generic/tkInt.h:
+ * unix/tkUnixXId.c (TkFreeXId): frees XID resources.
+ Made idCleanupScheduled a Tcl_TimerToken (was int) in TkDisplay
+ structure to allow us to delete the timer scheduled for it.
+
+ * unix/tkUnixWm.c (TkWmStackorderToplevel): ensure children
+ structure is freed.
+ (ConfigureEvent, ComputeReparentGeometry): Add extra wm tracing info
+ (TkWmRestackToplevel): initialize changes to 0 to prevent UMR.
+ Use WaitForConfigureNotify on all windows. This part still
+ requires fixing as it is the root of the 2 second raise delay on
+ some window managers (those that use extra wrapper windows of
+ their own).
+
+ * unix/tkUnixSend.c (TkSendCleanup): free send-related resources
+
+ * unix/tkUnixEvent.c (TkpCloseDisplay): call TkSendCleanup and
+ TkWmCleanup.
+
+ * unix/tkUnixSelect.c (SelRcvIncrProc): added missing Tcl_Release
+ of interp
+
+ * generic/tkGet.c (FreeUidThreadExitProc): free thread-specific
+ resources on thread exit
+
+ * generic/tkFocus.c (TkFocusFree): frees TkMainInfo data
+ * generic/tkClipboard.c (TkClipCleanup): frees TkDisplay data
+ * generic/tkGC.c (TkGCCleanup): frees TkDisplay data
+
+ * unix/tkUnixFont.c (FontPkgCleanup): cleanup thread specific font
+ resources on thread exit.
+
+ * mac/tkMacXStubs.c (TkpOpenDisplay): memset the initial display
+ structures to 0.
+
+ * generic/tkOption.c (OptionThreadExitProc): freed tsd option
+ stacks on thread exit.
+ (Tk_GetOption): free mem used to get Tk_Uid
+
+ * generic/tkMenu.c (ConfigureMenu): freed saved options in all
+ error cases.
+
+ * win/tkWinInt.h: declaration for TkWinGetUnicodeEncoding
+ * win/tkWinDialog.c (GetFileNameW): use TkWinGetUnicodeEncoding
+ * win/tkWinInit.c (TkpDisplayWarning): use TkWinGetUnicodeEncoding
+ * win/tkWinFont.c: use TkWinGetUnicodeEncoding instead of static
+ unicodeEncoding.
+
+ * win/tkWinX.c (Tk_SetCaretPos): remove WM_IME_STARTCOMPOSITION
+ and place the IME position within Tk_SetCaretPos. Cache results in
+ Tk_SetCaretPos to reduce unnecessary repositioning. Also call
+ DestroyCaret if we receive WM_KILLFOCUS.
+ (TkpOpenDisplay): ZeroMemory the initial display structures.
+ (TkWinGetUnicodeEncoding): Added so that Windows only needs to
+ cache this value one, and then free it in TkWinXCleanup.
+ (HandleIMEComposition): add support for Win98 and ATOK13
+ IME. (yamamoto)
+
+ * generic/tkConsole.c (ConsoleCmd): correct return that should
+ have just set result code.
+
+ * generic/tkImgPhoto.c: Added PhotoFormatThreadExitProc to clean
+ up on thread exit. (Tk_PhotoPutBlock) slight code updates
+
+ * generic/tkPanedWindow.c (DestroyPanedWindow, ConfigureSlaves):
+ fix mem leaks in not freeing slave info
+
+ * win/configure:
+ * win/tcl.m4: Enabled COFF as well as CV style debug info with
+ --enable-symbols to allow Dr. Watson users to see function info.
+ More info on debugging levels can be obtained at:
+ http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
+
+2002-04-10 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * doc/wm.n:
+ * mac/tkMacWm.c:
+ * tests/wm.test:
+ * unix/tkUnixWm.c:
+ * win/tkWinWm.c: Update wm stackorder usage message
+ to make it clear that either 1 or 3 arguments are
+ required. [Bug 540013]
+
+2002-04-08 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tkMacProjects.sea.hqx: added tkPanedWindow.c to projects
+ * mac/tkMacAppInit.c: fixes to MSL stdin/stdout hookup to the
+ TkConsole when using shared MSL libraries; fix for crashing
+ bug on exit: writing to stdin/sterr when console has already
+ been destroyed. (both fixes need support in MSL, see
+ 'CW Pro6 changes' in tcl/mac/tcltkMacBuildSupport.sea.hqx)
+ * mac/tkMacDialog.c: fixes to Navigation Services Dialog filter.
+ * mac/tkMacDraw.c: add panic for overwide TkImages that would
+ crash Tk on mac otherwise.
+
+2002-04-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * mac/tkMacXStubs.c: added Tk_SetCaretPos stub (does nothing).
+ * win/tkWinX.c: added Tk_SetCaretPos code to position IME windows
+ correctly when WM_IME_STARTCOMPOSITION is received.
+ * unix/tkUnixKey.c: added Tk_SetCaretPos and code for setting
+ XIM caret in TkpGetString.
+
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h:
+ * generic/tk.decls: added Tk_SetCaretPos declaration. This command
+ allows users to indicate the cursor position and is used by XIM
+ (Unix) or IME (Windows) to place the caret box correctly. It is
+ also part of correct Accessibility style on Windows to make the
+ magnifier jump to the focus point.
+
+ * win/tkWinButton.c (TkpDisplayButton):
+ * generic/tkTextMark.c (TkTextInsertDisplayProc):
+ * generic/tkCanvText.c (DisplayCanvText):
+ * generic/tkEntry.c (DisplayEntry): added Tk_SetCaretPos calls
+
+ * generic/tkInt.h: added TK_XIM_SPOT #define (default 1).
+ Added XFontSet attribute to TkDisplay when TK_XIM_SPOT is true.
+ * generic/tkEvent.c (Tk_HandleEvent): made sure inputContexts are
+ not getting created on DestroyNotify events (for dead windows).
+ Added over-the-spot support if TK_XIM_SPOT is defined (default).
+ The is the nicer XIM behavior, but uses a bit more memory.
+
+ * unix/tkUnixEvent.c:
+ * generic/tkWindow.c: moved OpenIM over to tkUnixEvent.c.
+ Removed setting inputContext to null in Tk_MakeWindowExist as it
+ was redundant.
+
+ * unix/tkUnixWm.c (CreateWrapper): Removed redundat setting of
+ inputContext to null.
+
+ * win/Makefile.in: changed gdb and shell targets to properly build
+ all binaries before running (otherwise an error often occured).
+
+2002-03-28 David Gravereaux <davygrvy@pobox.com>
+
+ * win/.cvsignore (new):
+ * win/lamp.bmp (new):
+ * win/makefile.vc:
+ * win/nmakehlp.c (new):
+ * win/rules.vc: Brought the makefile up-to-date with Tcl's one.
+ This now has support for Win9x issues and the winhelp target now
+ exists. Color scheme can be changed. I'm just imparting a first
+ suggestion using orange :) I'll have to think about the install
+ portion of the helpfile as I'll need to do some tricks to insert
+ tk's contents file into Tcl's using some special winhlp32.exe
+ switches. [Bug 533862 527941]
+
+ * win/makefile.vc: Tk helpfile is now installing itself into Tcl's
+ contents file as part of the install target and rebuilding the
+ contents table as desired. [Bug 527941]
+
+ * doc/console.n: Changed topic from "Tcl Built-In Commands" to
+ "Tk Built-In Commands"
+
+ * win/buildall.vc.bat: Update to match Tcl.
+
+2002-03-26 Andreas Kupries <andreask_kupries@users.sourceforge.net>
+
+ * unix/tkUnixFont.c: Added inclusion of <arpa/inet.h>. This fixes
+ a GCC/HPUX problem with missing a "htons". See also
+ "tclUnixPort.h" for equivalent code.
+
+2002-03-21 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: Changed optimize flag to -0ti instead of -02.
+ [Bug 528441]
+
+2002-03-20 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkButton.c (ButtonTextVarProc,ButtonVarProc):
+ * generic/tkCmds.c (WaitVariableProc):
+ * generic/tkEntry.c (EntryTextVarProc):
+ * generic/tkListbox.c (ListboxListVarProc):
+ * generic/tkMenu.c (MenuVarProc):
+ * generic/tkMenubutton.c (MenuButtonTextVarProc):
+ * generic/tkMessage.c (MessageTextVarProc):
+ * generic/tkScale.c (ScaleVarProc): Updates to handle change in
+ type of part2 argument of Tcl_VarTraceProc typedef. [TIP 27]
+ [Patch 532644].
+
+2002-03-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkOldConfig.c (Tk_ConfigureValue): prevent leaving
+ interp->result as NULL.
+
+2002-03-07 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/text.tcl (TextPasteSelection): Renaming of TextPaste to
+ prevent confusion with tk_textPaste. Stopped code from inserting
+ selections twice, which seems to have happened with TIP#26, and
+ reorganized code to reduce amount of stuff protected by catch
+ which is tricky to maintain.
+ (tk_textPaste): Reduce amount of code protected by catch.
+
+2002-03-06 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinX.c: Define _WIN32_IE as 0x0300
+ before including commctrl.h so that we can
+ access the InitCommonControlsEx API when
+ building Tk with mingw.
+
+2002-03-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * README, generic/tk.h, unix/configure.in, unix/tk.spec:
+ * win/configure.in: Bumped patchlevel; this might need to change
+ in the future, but it will help us distinguish between the CVS
+ version and the most recent released version.
+
+2002-03-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.4a4 TAGGED FOR RELEASE ***
+
+ * unix/README: updated --* options docs.
+
+ * unix/tk.spec: fixed URL refs to use www.tcl.tk or SF.
+
+2002-03-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * README:
+ * mac/README:
+ * unix/README:
+ * win/README: updated to use www.tcl.tk URL.
+
+2002-03-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/entry.tcl: added catch around Triple-1 binding use of
+ sel.last
+
+2002-02-28 Don Porter <dgp@users.sourceforge.net>
+
+ * library/console.tcl (ConsoleBind): Corrected console <<Paste>>
+ binding on Unix platforms.
+
+2002-02-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+ * generic/tkWindow.c (Tk_MainWindow, Tk_GetNumMainWindows):
+ protect against being called before Tcl stubs are init'ed.
+ [Bug #220916] (porter)
+
+2002-02-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (ConfigureText): reenable the blinking cursor
+ on state change where necessary. [Bug #503772]
+
+ * tests/listbox.test:
+ * generic/tkListbox.c: corrected error handling when setting to an
+ invalid listvar value. [Bug #503613]
+
+ * library/scale.tcl: mirror B2 bindings to B3 on Windows to better
+ accomodate two button mice. [Patch #493145]
+
+ * library/panedwindow.tcl: improved proxy sash handling. (boudaillier)
+
+2002-02-25 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/filebox.test: Reorganised and fixed so that tests are
+ executed fewer times (!) and the automatic extension adding
+ behaviour of tk_getSaveFile is tested.
+
+2002-02-23 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2002-02-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkPanedWindow.c (PanedWindowWidgetObjCmd): fixed returns
+ that should have been breaks instead. Corrected .pw configure
+ handling for insufficient args. [Patch #521436] (boudaillier)
+
+ * mac/tkMacDefault.h:
+ * unix/tkUnixDefault.h:
+ * win/tkWinDefault.h: changed panedwindow default relief to flat,
+ a more natural outer relief.
+
+ * library/panedwindow.tcl (ReleaseSash): changed to not pass x and
+ y args at all (they aren't used).
+ Added proc comments. Made configuring sash cursor more efficient.
+ Added Cursor timer that restores the default cursor when pointer
+ is no longer over the sash. This is necessary because Leave
+ events won't be seen when moving into a paned child.
+
+2002-02-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/widget: New section "Paned Windows"
+ * library/demos/paned2.tcl, library/demos/paned1.tcl: New files.
+
+ * library/panedwindow.tcl (ReleaseSash): Added missing arguments.
+ * library/tk.tcl: Bindings for paned window were not being loaded
+ by default.
+
+ * unix/tkUnixMenu.c (GetMenuLabelGeometry,DrawMenuEntryLabel):
+ Stop meaningless GCC warnings.
+
+2002-02-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/panedwindow.n (new):
+ * generic/tkPanedWindow.c (new):
+ * generic/tkInt.h:
+ * generic/tkWindow.c:
+ * library/panedwindow.tcl (new):
+ * mac/tkMacDefault.h:
+ * tests/panedwindow.test (new):
+ * unix/Makefile.in:
+ * unix/tkUnixDefault.h:
+ * win/Makefile.in:
+ * win/makefile.vc:
+ * win/tkWinDefault.h: added implementation of TIP #41, panedwindow
+ widget. [Patch #512503] (melski)
+
+ * generic/tkOption.c (ReadOptionFile): fixed Tcl_Seek casting to
+ remove warnings (we expect no option files with be > 2GB).
+
+ * unix/configure: regenerated
+ * unix/tcl.m4: updated to sync with Tcl's tcl.m4
+ Added --enable-64bit support for AIX-4 using IBM's xlc (-q64 flag).
+
+2002-02-19 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: First draft of updated changes for 8.4a4 release.
+
+2002-02-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImgPhoto.c (MatchFileFormat): Tcl_Seek takes
+ Tcl_WideInt offset (three places.)
+ * generic/tkImgPPM.c (FileReadPPM): Tcl_Seek takes Tcl_WideInt offset.
+ * generic/tkFrame.c (ConfigureFrame): Stop GCC warning.
+
+ * generic/tkImgGIF.c: Made file meet the formatting rules from the
+ Tcl Engineering Manual better; mostly differences in whitespace.
+
+2002-02-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure: regen'd
+ * unix/tcl.m4:
+ * unix/configure.in: added macros and calls to SC_TCL_EARLY_FLAGS
+ and SC_TCL_64BIT_FLAGS, part of TIP #72.
+
+2002-02-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * library/entry.tcl:
+ * library/text.tcl: Adjust <Double-1> and <Triple-1> bindings
+ so that no anchor point is set and the insertion cursor is
+ set to the last character in the selection. [Bug 220943]
+ * tests/event.test: Add test cases for double click and
+ drag as well as triple click and drag in the text and
+ entry widgets.
+
+2002-02-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/event.test (_text_ind_to_x_y, _get_selection): Fix
+ incorrect use of results from bbox invocation so that
+ y center point for a give index is calculated correctly.
+ Add new method to return the selection and use it in
+ test cases. Always lappend to the result list to avoid
+ case where initial result includes a space.
+
+2002-02-07 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkMain.c:
+ * mac/tkMacInit.c:
+ * mac/tkMacKeyboard.c:
+ * win/tkWinDialog.c:
+ * win/tkWinTest.c: modified some callers of Tcl routines that
+ were restored to return (char *) pointing into Tcl_DStrings.
+
+2002-02-03 eric melski <ericm@interwoven.com>
+
+ * generic/tkImage.c (Tk_ImageObjCmd): Clean up bogus for loop in
+ [image inuse] subcommand [Bug #485803].
+
+2002-02-01 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkCmds.c (Tk_TkObjCmd): don't use 'bool' as an arg as it
+ conflicts with the C99 spec. [Bug #511956] (ingham)
+
+2002-02-01 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: unset macro located in the tktest target
+ caused a failure to build. [Bug 511652]
+
+2002-01-30 Don Porter <dgp@users.sourceforge.net>
+
+ * win/stubs.c (XSetCommand): Overlooked CONSTification.
+
+2002-02-01 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/photo.n: Documented transparency subcommand.
+ * tests/imgPhoto.test (imgPhoto-4.40...imgPhoto-4.68): Tests for
+ the transparency subcommand.
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Added transparency
+ subcommand (see TIP #14.)
+
+2002-01-31 Todd Helfter <tmh@users.sourceforge.net>
+ * generic/tkMenu.c (ConfigureMenuCloneEntries)
+ * tests/menu.test (menu3.68)
+ Correct and test for logic error when cloning menus. [Bug #508988]
+
+2002-01-30 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.decls: The POTENTIAL INCOMPATIBILITY in the changing
+ interface of Tk_ParseArgv can now be removed by the -DUSE_NON_CONST
+ compiler flag.
+ * generic/tkDecls.h: make genstubs
+
+2002-01-29 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * win/tkWinInit.c (TkpGetAppName): TIP 27 fixup. The code now does
+ not write into the CONST path returned by "argv0" and
+ Tcl_SplitPath anymore.
+
+2002-01-28 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/configure.in: Don't set TCL_LIB_SPEC and
+ TCL_STUB_LIB_SPEC variables since this breaks
+ the AIX build. This was used in the past to
+ support linking with Tcl from the build dir
+ or the install dir, but it is no longer needed.
+
+2002-01-28 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in: Remove commented out vars.
+ * unix/configure: Regen.
+ * unix/configure.in: Don't subst vars that are already
+ taken care of in SC_LOAD_TCLCONFIG.
+ * unix/tcl.m4: Update from Tcl.
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl.
+
+2001-01-27 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkFileFilter.c:
+ * mac/tkMacInit.c:
+ * mac/tkMacKeyboard.c:
+ * mac/tkMacMenus.c: TIP 27 CONSTification induced changes
+
+2002-01-25 Don Porter <dgp@users.sourceforge.net>
+
+ * All changes below are Patch 505159
+
+ * doc/AddOption.3:
+ * doc/CanvTkWin.3:
+ * doc/GetPixels.3:
+ * doc/Name.3:
+ * doc/ParseArgv.3:
+ * generic/tk.decls (Tk_AddOption,Tk_CanvasGetCoord,Tk_GetPixels)
+ (Tk_GetScreenMM,Tk_NameToWindow,Tk_ParseArgv):
+ * generic/tkArgv.c (Tk_ParseArgv):
+ * generic/tkCanvLine.c (ParseArrowShape):
+ * generic/tkCanvUtil.c (Tk_CanvasGetCoord,Tk_CanvasTagsParseProc)
+ (Tk_CanvasTagsPrintProc,Tk_GetDash):
+ * generic/tkCanvas.c (ConfigureCanvas):
+ * generic/tkGet.c (Tk_GetPixels,Tk_GetScreenMM):
+ * generic/tkImgPhoto.c (ImgPhotoCmd):
+ * generic/tkMain.c (Tk_MainEx):
+ * generic/tkOldConfig.c (FormatConfigInfo):
+ * generic/tkOption.c (Tk_AddOption):
+ * generic/tkText.c (TextWidgetCmd,TkTextGetTabs,DumpSegment):
+ * generic/tkText.h (TkTextCreateTag):
+ * generic/tkTextTag.c (TkTextCreateTag):
+ * generic/tkWindow.c (Tk_NameToWindow,Initialize):
+ * mac/tkMacCursor.c (FindCursorByName,TkGetCursorByName):
+ * mac/tkMacWm.c (Tk_WmCmd):
+ * unix/tkUnixCursor.c (TkGetCursorByName):
+ * unix/tkUnixSend.c (ValidateName):
+ * unix/tkUnixWm.c (Tk_WmCmd):
+ * win/tkWinCursor.c (TkGetCursorByName):
+ * win/tkWinWm.c (Tk_WmCmd): Updated callers of Tcl_SplitList and
+ Tcl_Merge.
+ * generic/tkDecls.h: make genstubs
+ ***POTENTIAL INCOMPATIBILITY***
+ Includes a source incompatibility in the argv argument of Tcl_ParseArgv.
+
+ * generic/tkBind.c (DeleteVirtualEvent):
+ * generic/tkCanvas.c (ScrollFractions, CanvasWidgetCmd)
+ (CanvasUpdateScrollbars):
+ * generic/tkTestTag.c (TkTextTagCmd): Updated callers of
+ Tcl_GetStringResult. Rewrote PrintScrollFractions to
+ ScrollFractions to stop scribbling directly on interp->result.
+
+ * generic/tkInt.decls (TkGetDefaultScreenName, TkpDisplayWarning)
+ (TkpOpenDisplay):
+ * generic/tkCanvPs.c (Tk_PostscriptColor, Tk_PostscriptFont):
+ * generic/tkEntry.c (EntrySetValue, EntryValidateChange)
+ (ExpandPercents, EntryValueChanged, Tk_EntryObjCmd, DestroyEntry)
+ (ConfigureEntry, EntryComputeGeometry, InsertChars, DeleteChars)
+ (EntryFetchSelection, EntryTextVarProc, Tk_SpinBoxObjCmd)
+ (SpinboxWidgetObjCmd):
+ * generic/tkMain.c (Prompt):
+ * generic/tkMenu.c (MenuVarProc):
+ * generic/tkMenubutton.c (ConfigureMenuButton, MenuButtonTextVarProc):
+ * generic/tkMessage.c (ConfigureMessage, MessageTextVarProc):
+ * generic/tkWindow.c (GetScreen, Initialize):
+ * mac/tkMacInit.c (TkpInit, TkpDisplayWarning):
+ * mac/tkMacXStubs.c (TkGetDefaultScreenName, TkpOpenDisplay):
+ * unix/tkUnix.c (TkGetDefaultScreenName):
+ * unix/tkUnixEvent.c (TkpOpenDisplay):
+ * unix/tkUnixInit.c (TkpGetAppName, TkpDisplayWarning):
+ * unix/tkUnixSend.c (SendEventProc):
+ * win/tkWinInit.c (TkpGetAppName, TkpDisplayWarning):
+ * win/tkWinX.c (TkGetDefaultScreenName,TkpOpenDisplay): Updated
+ callers of Tcl_GetVar, Tcl_GetVar2
+ * generic/tkIntDecls.h: make genstubs
+
+ * generic/tkCanvPs.c (TkCanvPostscriptCmd):
+ * generic/tkImgBmap.c (TkGetBitmapData):
+ * generic/tkOption.c (ReadOptionFile):
+ * mac/tkMacInit.c (TkpInit, TkpGetAppName):
+ * win/tkWinInit.c (TkpGetAppName): Updated callers of
+ Tcl_SplitPath, Tcl_JoinPath, and Tcl_TranslateFileName.
+
+2002-01-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Rewrite stackorder tests that
+ deal with toplevels that have the overrideredirect
+ flag set. [Tk bug 492259]
+
+2002-01-18 Don Porter <dgp@users.sourceforge.net>
+
+ * win/tkWinDialog.c: Overlooked Tcl_GetIndexFromObj callers.
+
+2001-01-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tkMacDialog.c:
+ * mac/tkMacSend.c: TIP 27 CONSTification broke the mac
+ build in a few places.
+
+2002-01-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkListbox.c (ChangeListboxOffset): improved tracking
+ when scrolling on x axis with entry/text. [Bug #225025] (voskuil)
+
+2002-01-16 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk3d.c (Tk_GetReliefFromObj):
+ * generic/tkBind.c (Tk_EventObjCmd, HandleEventGenerate):
+ * generic/tkButton.c (ButtonWidgetObjCmd):
+ * generic/tkCanvas.c (CanvasWidgetCmd, FindItems):
+ * generic/tkClipboard.c (Tk_ClipboardObjCmd):
+ * generic/tkCmds.c (Tk_BellObjCmd, Tk_TkObjCmd, Tk_TkwaitObjCmd)
+ (Tk_UpdateObjCmd, Tk_WinfoObjCmd, Tk_WmObjCmd):
+ * generic/tkConfig.c (DoObjConfig):
+ * generic/tkEntry.c (EntryWidgetObjCmd, SpinboxWidgetObjCmd):
+ * generic/tkFocus.c (Tk_FocusObjCmd):
+ * generic/tkFont.c (Tk_FocusObjCmd, ConfigAttributesObj):
+ * generic/tkFrame.c (Tk_FrameObjCmd):
+ * generic/tkGet.c (Tk_GetAnchorFromObj, Tk_GetJustifyFromObj):
+ * generic/tkGrab.c (Tk_GrabObjCmd):
+ * generic/tkGrid.c (Tk_GridObjCmd, GridRowColumnConfigureCommand)
+ (GridSlavesCommand, ConfigureSlaves):
+ * generic/tkImage.c (Tk_ImageObjCmd):
+ * generic/tkImgBmap.c (ImgBmapCmd):
+ * generic/tkImgGIF.c (FileReadGIF):
+ * generic/tkImgPhoto.c (ImgPhotoCmd):
+ * generic/tkListbox.c (ListboxWidgetObjCmd, ListboxSelectionSubCmd)
+ (GetListboxIndex):
+ * generic/tkMenu.c (MenuWidgetObjCmd, MenuAddOrInsert, MenuCmd)
+ (ConfigureMenu, CloneMenu):
+ * generic/tkMenubutton.c (MenuButtonWidgetObjCmd):
+ * generic/tkMessage.c (MessageWidgetObjCmd):
+ * generic/tkOption.c (Tk_OptionObjCmd):
+ * generic/tkPack.c (Tk_PackObjCmd, ConfigureSlaves):
+ * generic/tkPlace.c (Tk_PlaceObjCmd):
+ * generic/tkScale.c (ScaleWidgetObjCmd):
+ * generic/tkSelect.c (Tk_SelectionObjCmd):
+ * generic/tkSquare.c (SquareWidgetObjCmd):
+ * generic/tkTest.c (TestobjconfigObjCmd, TrivialConfigObjCmd)
+ (TestfontObjCmd): Updates to handle change in type of tablePtr
+ argument of Tcl_GetIndexFromObj(Struct) from (char **) to
+ (CONST char **). [TIP 27] [Patch 504705]
+
+ * generic/tkCanvText.c (GetSelText):
+ * generic/tkEntry.c (Entry{FetchSelection,Setvalue},ExpandPercents):
+ * generic/tkSelect.c (HandleTclCommand):
+ * generic/tkText.c (TextSearchCmd):
+ * generic/tkTextIndex.c (TkTextMakeByteIndex, TkTextIndexBackChars):
+ * mac/tkMacFont.c (Tk_MeasureChars, BreakLine):
+ * unix/tkUnixMenu.c (DrawMenuUnderline):
+ * win/tkWinMenu.c (GetEntryText, DrawMenuUnderline): Updated
+ callers of Tcl_Utf* and Tcl_Regexp* APIs to reflect TIP 27 API
+ changes (see Tcl Patch 471509). [Patch 471513]
+
+2002-01-16 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl.
+
+2002-01-04 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkMain.c (Tk_MainEx): Updated callers of CONSTified
+ Tcl interfaces Tcl_EvalFile and TclGetStartupScriptFileName.
+
+ * generic/tkConsole.c (ConsoleOutputProc, TkConsolePrint):
+ * generic/tkInt.h (TkConsolePrint):
+ * mac/tkMacAppInit.c (TkConsolePrint): Updated Tk's console to
+ CONSTified channel driver interface. [Tcl Patch 503565, Tk Patch
+ 503983]
+
+2002-01-11 Mo DeJong <mdejong@users.sourceforge.net>
+
+ Use ${libdir} instead of ${exec_prefix}/lib. [Tcl bug 489370]
+
+ * unix/configure: Regen.
+ * unix/configure.in: Define and use libdir.
+ * win/configure: Regen.
+ * win/configure.in: Define libdir.
+
+2002-01-11 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in: Burn Tcl and Tk build
+ directories into tktest executable to avoid crashes
+ caused by ld loading a previously installed version
+ of the tcl or tk shared libraries. Remove setting
+ of LD_LIBRARY_PATH, LIBPATH, and SHLIB_PATH
+ before running tktest since it should no
+ longer be required.
+
+2002-01-11 Mo DeJong <mdejong@users.sourceforge.net>
+
+ Enable use of Tcl stubs when building Tk as
+ a shared library. This should fix the build
+ under AIX. [Bugs 220858, 220955, 220921]
+
+ * unix/Makefile.in: Add TCL_STUB_LIB_SPEC and
+ TCL_STUB_LIB_FLAG variables.
+ * unix/configure: Regen.
+ * unix/configure.in: Pass TCL_STUB_LIB_SPEC into
+ Makefile and use it when linking the tk shared library.
+ Define USE_TCL_STUBS when building shared. Subst
+ TCL_STUB_LIB_SPEC and TCL_STUB_LIB_FLAG.
+
+2002-01-08 D. Richard Hipp <drh@hwaci.com>
+
+ * win/tkWinMenu.c: Fix the following bug: If you select an entry
+ on a cascade menu then the next time the parent menu is posted, the
+ cascade entry was active. Also, if you traverse to a disabled entry
+ using keystrokes and press ENTER on the disabled entry, then that
+ entry appears active the next time the menu is posted. The same
+ patch fixes both problems.
+
+2002-01-04 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkBind.c (TkBindFree):
+ * generic/tkGrid.c (ResolveConstraints,CheckSlotData,DestroyGrid):
+ * generic/tkSelect.c (Tk_DeleteSelHandler,TkSelDeadWindow): Replaced
+ Tcl_Free calls with ckfree so that memory debugging is fully supported.
+
+2001-12-28 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * test/winButton.test:
+ * win/tkWinButton.c: added updated patch #463234 which returns the
+ default sizing behavior (not so native), but enables native L&F
+ with negative sizing (-11 for example).
+
+ * library/text.tcl (tk::TextButton1): made text receive focus even
+ in disabled state for Windows to show selection and allow
+ mouse-wheel scrolling.
+
+ * win/tkWinInit.c (TkpDisplayWarning): added Tcl_DStringFree's
+
+ * win/tkWinInt.h:
+ * win/tkWinX.c: added TkWinProcs that represent a function table
+ to switch between unicode and ansi procs on Windows. This is
+ analogous to the TclWinProcs. Using Tcl_WinUtfToTChar, we can
+ easily take advantage of using unicode functions where available
+ without having to switch on the platform id each time.
+
+ * win/tkWinWm.c (InitWindowClass): corrected init routines to
+ allow unicode in window titles on Windows (for Win2K/XP).
+ (TkWmStackorderToplevel): Corrected casts to enable debug compile
+
+ * win/configure: regen'ed
+ * win/tcl.m4: added shell32.lib to link libs, as these are
+ necessary for new directory chooser (when enabled).
+
+ * win/tkWinDialog.c (Tk_MessageBoxObjCmd): use MessageBoxW for
+ proper display of unicode errors.
+ Added patch which uses new OLE based directory chooser. This
+ still has some issues, so is disabled by default. [Patch #468139]
+ (ColorDlgHookProc) Corrected ability to use unicode chars in
+ tk_chooseColor -title.
+
+2001-12-27 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinInit.c (TkpDisplayWarning): Use MessageBoxW in case the
+ error displayed has unicode chars. [Bug #485986]
+
+2001-12-27 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tkMacInit.c:
+ * mac/tkMacResource.r: synced up tkInit features to unix/win:
+ use existing tkInit proc if defined. Added spinbox.tcl resource.
+ Used TclGetEnv() instead of Tcl_GetVar2(interp, env)
+ * mac/tkMacApplication.r:
+ * mac/tkMacLibrary.r: minor version resources cleanup
+
+2001-12-27 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkButton.c (ButtonTextVarProc): guard against being
+ called while the *button/label is being deleted. [Bug #490051]
+
+ * library/entry.tcl:
+ * library/spinbox.tcl:
+ * library/text.tcl: added extra checks against bug #220269 and
+ made spinbox reuse more of the entry procedure code.
+
+2001-12-20 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2001-12-19 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2001-12-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/configure.in: Move EXP file changes over from
+ Tcl configure script to fix AIX build with gcc. [Bug 220955]
+
+2001-12-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in:
+ * win/Makefile.in: Use $(MAKE) instead of make
+ in the tcltest rule.
+
+2001-12-18 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/event.test (event-click-drag-1.2): Corrected test that
+ failed on Solaris/CDE due to text scrolling. [Bug 413735]
+
+2001-12-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/spinbox.tcl (ButtonDown): added catch to ignore
+ possible error in after cancel when Priv(afterId) isn't defined.
+
+ * doc/spinbox.n: corrected spin(up|down) -> button(up|down)
+
+2001-12-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/getOpenFile.n: Documented change.
+ * library/tkfbox.tcl (SetFilter): Added code to guess the correct
+ default extension from whatever value was selected in the
+ filetypes option menu. Adapted from code by Chris Nelson
+ submitted in Patch #492220.
+
+2001-12-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap): added static
+
+2001-12-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c:
+ * generic/tkText.h: changed TkTextEditType enums to be prefaced
+ with TK_EDIT_ to prevent name collision.
+
+2001-12-05 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tkMacWm.c: mac implementation of wm stackorder
+ (patch 481148, TIP 74)
+
+2001-12-03 Mo DeJong <mdejong@users.sourceforge.net>
+
+ Add TK patch 481148 to implement TIP 74, the
+ wm stackorder command.
+
+ * doc/winfo.n: Update documentation for the winfo
+ children command to indicate that top-level windows
+ are not returned in stacking order.
+ * doc/wm.n: Add documentation for wm stackorder.
+ * generic/tkInt.decls (TkWmStackorderToplevel):
+ Add decl for new function.
+ * generic/tkIntDecls.h: Regen.
+ * generic/tkStubInit.c: Regen.
+ * tests/unixWm.test: Add stackorder command to test
+ for wm command usage message.
+ * tests/wm.test: Add new set of tests for generic
+ window manager methods.
+ * unix/tkUnixWm.c (Tk_WmCmd, TkWmStackorderToplevelWrapperMap)
+ (TkWmStackorderToplevel): Add unix implementation of
+ new wm stackorder command.
+ * win/tkWinWm.c (Tk_WmCmd, TkWmStackorderToplevelEnumProc)
+ (TkWmStackorderToplevelWrapperMap, TkWmStackorderToplevel): Add
+ windows implementation of new wm stackorder command.
+
+2001-12-03 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: install target changes by request from
+ Ryan Casey <scfiead@hotmail.com>.
+
+2001-11-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/widget: Further overhauling; shrank fonts, made
+ better use of fonts, added an icon, fixed the About box. Prompted
+ by Bug #487442 from Vincent Wartelle.
+
+2001-11-29 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/palette.tcl (tk_setPalette): Added heuristic to guess
+ from the background whether to use black or white for the
+ foreground when not told specifically. Suggested by Chris Nelson,
+ this makes the command fit the documentation better!
+
+2001-11-27 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: Fixed CAT32 target. cat.c is located in the Tcl
+ source, not the Tk source.
+
+2001-11-27 D. Richard Hipp <drh@hwaci.com>
+
+ * library/menu.tcl: Do not allow keyboard traversal of torn-off
+ menus to visit the (invisible) tearoff bar.
+
+2001-11-26 D. Richard Hipp <drh@hwaci.com>
+
+ * win/tkWinMenu.c: disabled menu items show the activebackground
+ color in their background. This change makes menu behavior
+ consistent with what native windows does.
+
+2001-11-24 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in: Add comments to better describe
+ TCL_EXE and when it should be available. Add
+ rule that prints message about running `make genstubs`
+ when tkStubInit.c is out of date.
+ * win/Makefile.in: Add TCL_TOOL_DIR and TCL_EXE
+ variables to better match the Tcl Makefile. Add
+ genstubs rule so tkSTubInit.c can be regenerated.
+
+2001-11-24 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/configure: Regen.
+ * win/configure.in: Don't AC_SUBST CFLAGS_DEBUG, CFLAGS_OPTIMIZE,
+ or CFLAGS_WARNING since it is now done in SC_CONFIG_CFLAGS.
+ * win/tcl.m4 (SC_CONFIG_CFLAGS): AC_SUBST DL_LIBS, CFLAGS_DEBUG,
+ CFLAGS_OPTIMIZE, and CFLAGS_WARNING.
+
+2001-11-23 Daniel Steffen <das@users.sourceforge.net>
+
+ Up-port to 8.4 of mac code changes for 8.3.3 & various new
+ changes for 8.4, some already backported to 8.3.4 (patch #435660)
+
+ * library/tk.tcl: added <Key-F1> binding for <<Undo>> on the mac (TIP26)
+
+ * library/button.tcl: fixed undefined $Priv(repeated) error for button
+ without -repeatdelay support
+
+ * generic/tkConsole.c:
+ * library/console.tcl:
+ * mac/tkMacInit.c:
+ * mac/tkMacResource.r: corrected how mac deals with tcl library
+ files present both in resources and in $tk_library directory.
+
+ * generic/tkConsole.c: crashing bug fix when printing to console
+ at program exit after the console has already been closed.
+ Now setting gStdoutInterp=NULL in ConsoleClose().
+
+ * mac/tkMacInit.c: correct use of Tcl_JoinPath in tk_library
+ initialization
+
+ * mac/tkMacMenu.c: special MDEF_PROC_OFFSET only needed for
+ exactly one specific version of the MWERKS 68k compiler .
+
+ * mac/tkMacShLib.exp: removed file
+
+ * unix/Makefile.in: removed reference to .exp files
+
+ * mac/MWTkBuildLibHeader.h:
+ * mac/MW_TkBuildLibHeader.pch:
+ * mac/MW_TkHeaderCommon.h:
+ * mac/MW_TkOldImgStaticHeader.h:
+ * mac/MW_TkStaticHeader.h:
+ * mac/MW_TkStaticHeader.pch: new precompiled header files
+
+ * mac/MW_TkHeader.pch:
+ * mac/MW_TkOldImgHeader.h:
+ * mac/MW_TkTestHeader.pch: revised precompiled header handling: now
+ include a common header file 'MW_TkHeaderCommon.h' from all .pch files,
+ the .pch files themselves now only setup #defines (e.g. BUILD_tk,
+ STATIC_BUILD, TCL_DEBUG, TCL_THREADS) like in makefiles on other
+ platforms.
+
+ * mac/tkMac.h:
+ * mac/tkMacPort.h:
+ * mac/tkMacInt.h: use of BUILD_tk and TCL_STORAGE_CLASS like on other
+ platforms, standardize #include'd files to what's done on other
+ platforms, removed use of #pragma export, changed extern to EXTERN
+ where appropriate to enable DLL export via the TCL_STORAGE_CLASS
+ mechanism.
+
+ * mac/tkMacAppearanceStubs.c: removed use of #pragma export
+
+ * mac/widget.r: new resource file for 'Widget Demos'
+
+ * mac/tkMacProjects.sea.hqx: updated mac build project files:
+ build support for CodeWarrior Pro6, UnivIntf 3.4 & shared runtime
+ libraries (see Tcl ChangeLog for details).
+ changed weak linking so that CFM68k binaries now work on all OS
+ versions from the free 7.5.5 onwards, with or without AppearanceMgr
+ and/or NavigationMgr installed.
+ added target to automatically build 'Widget Demos'
+ included XML versions of the projects for CW Pro5 or Pro7 users.
+ use compat/strtod.c instead of MSL's strtod()
+
+ * generic/tkInt.decls:
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkStubInit.c:
+
+ * mac/tkMacInt.h: MAC_TCL tk stub support was badly broken due to
+ multiply defined (mac specific) names in tk.decls and tkInt.decls,
+ removed the duplicates from the internal unsupported interfaces
+ "interface tkInt" and "interface tkIntPlat"; moved declaration of
+ TkpIsWindowFloating from tkMacInt.h to tkInt.decls: interface tkIntPlat.
+ - these changes to the stub tables might require you to recompile your
+ Tk extensions if they turn out to reference one of the removed routines
+ in the wrong table (should be unlikely).
+
+ * generic/tkMain.c: MAC_TCL: workaround for broken/non-standard isatty
+ on MW Pro6, #include <unistd.h> instead of defining isatty
+
+ * generic/tkPointer.c: MAC_TCL: #include tkMacInt.h
+
+ * generic/tkStubLib.c: MAC_TCL: removed obsolete special casing of mac
+ headers, standardize #include'd files to what's done on other platforms
+
+ * mac/tclets.r:
+ * mac/tkMacWindowMgr.c:
+ * mac/tkMacScrlbr.c:
+ * mac/tkMacMenu.c:
+ * mac/tkMacMenus.c:
+ * mac/tkMacFont.c:
+ * mac/tkMacDialog.c:
+ * mac/tkMacButton.c: renamed obsolete apple API names to modern
+ equivalents; UH3.4 support: added #include <ControlDefinitions.h>;
+ fixed munged non-ASCII chars in sources due to bungled latin1<->mac
+ roman encoding in CVS repository.
+
+ * mac/tkMacDialog.c: added support for -filetypes option (fix for bug
+ tcl #221636); added update event handling for background windows while
+ in a NavigationMgr dialog; fixed nasty bug when calling CustomGetFile
+ (missing addr operator) (fix for bug tk #220911 & tcl #219367); renamed
+ routines conflicting with standard MoreFiles headers (see Tcl ChangeLog
+ for details)
+
+ * mac/tkMacApplication.r:
+ * mac/tkMacLibrary.r:
+ * mac/tkMacResource.r: fixed obsolete copyrights/dates in version
+ strings, updated version strings to standard usage, added support for
+ '(Support Libraries)' subfolder for shared runtime libraries in
+ unmerged binaries, commented out demo setting of "Tcl Environment
+ Variables"; reorganized resources among these files to avoid
+ multiple copies in applications and shared libraries, the script
+ libraries/Xcursors etc are now no longer duplicated in Wish but are
+ only included in the resources of Tk.shlb.
+
+ * mac/tkMacMenu.c:
+ * mac/tkMacMDEF.r: changes to support MW Pro 6 68k (vers 0x2400 only)
+ compiler producing different offset to start of MDEF; fix to static 68k
+ presence testing when calling the custom MDEF
+
+ * mac/tkMacWm.c.c:
+ * mac/tkMacWindowMgr.c: added/fixed AppearanceMgr checks; override
+ AppearanceMgr version detection on static 68k to ensure static 68k Wish
+ runs on PPCs with recent AppearanceMgr
+
+ * mac/tkMacButton.c: fixed misplaced/missing variable initialization.
+
+2001-11-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (TextGetText): reworked to use DString for
+ improved speed. (callewaert, darley)
+ (DestroyText): plugged mem leak when not clearing stack (callewaert)
+ (TextGetText): more efficient string size calculation (darley)
+
+2001-11-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/entry3.tcl: New demo showing off validation and
+ password entry.
+
+ * library/demos/widget: Some reorganization to make the code
+ simpler, plus a new entry demo.
+
+2001-11-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinButton.c (TkpComputeButtonGeometry): corrected the
+ default size of Windows buttons to conform to the Windows style.
+ This changes the default size of buttons on Windows.
+ [Patch #463234] (nelson)
+ **** POTENTIAL VISUAL INCOMPATABILITY ****
+
+2001-11-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/menu.tcl: corrected menu traversal code on Unix to
+ better handle entering cascades. [Patch #481219] (oleinick)
+
+2001-11-16 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: Install target repaired.
+
+2001-11-15 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/image2.tcl: Many improvements to this
+ image-viewing demo; now uses labelframes and tk_chooseDirectory
+
+ * library/palette.tcl (::tk::RecolorTree): Made this work better
+ with CDE, which does some extremely annoying things with the
+ option database that interact badly with Tk's way of handling
+ options.
+
+ * doc/text.n: Overhauled the documentation of undo to make it
+ easier to understand.
+ * library/tk.tcl (::tk::EventMotifBindings): Added Emacs-like undo
+ binding, but not behaviour (we separate undo and redo.)
+ * library/demos/text.tcl: Show off our undo capability!
+
+2001-11-12 David Gravereaux <davygrvy@pobox.com>
+
+ * win/mkd.bat:
+ * win/rmd.bat: Removed -kb CVS attribute and added changes
+ from Llyod Lim for better stability. [Patch #456761]
+
+ * win/rules.vc(new):
+ * win/buildall.vc.bat(new):
+ * win/makefile.vc: large rewrite following Tcl's makefile.vc as
+ a guide and Patch #456761. Appears BugFree(tm).
+
+2001-11-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/text.n:
+ * generic/tkText.c:
+ * generic/tkText.h:
+ * generic/tkTextTag.c:
+ * library/text.tcl:
+ * library/tk.tcl:
+ * mac/tkMacDefault.h:
+ * tests/text.test:
+ * unix/tkUnixDefault.h:
+ * win/tkWinDefault.h: added TIP #26 implementation of simple
+ built-in undo/redo of text editing in the text widget.
+ [Patch #458879] (callewaert)
+
+2001-11-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/menu.tcl: Show off -compound support in menus.
+
+ * library/demos/radio.tcl: Added some code to both show off the
+ extra capabilities of the buttons and also show what can be done
+ with compound images on the sly.
+
+2001-11-10 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in:
+ * win/Makefile.in: Add "make gdb" target. This target
+ can run wish inside either gdb or insight.
+
+2001-11-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/clrpick.tcl: changed a few parameters so that the full
+ 0..255 range could be accessed via the mouse. [Bug #478498]
+
+ * unix/configure:
+ * unix/tcl.m4: added -lc to AIX libs, fixed path to ldAix
+
+ * win/configure:
+ * win/tcl.m4:
+ * win/makefile.vc: add comctl32.lib to build libs.
+ * win/tkWinX.c (TkWinXInit): added InitCommonControlsEx call.
+ * win/rc/tk.rc:
+ * win/rc/wish.rc:
+ * win/rc/wish.exe.manifest: added resources that specify using v6
+ of the MS Common Controls library when available (WinXP+). This
+ enables use of the themeable widgets (like scrollbars) to be used
+ in Tk. [Patch #478933]
+
+2001-11-09 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure:
+ * unix/tcl.m4: Update from Tcl.
+
+2001-11-08 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in:
+ Avoid adding libc to the LIBS and WISH_LIBS
+ variables since it is not needed when linking with CC.
+ If required when linking with LD it should be done
+ on a case by case basis in tcl.m4.
+
+2001-11-05 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/dialog2.tcl: Typo-fix.
+ * library/demos/browse, library/demos/ixset, library/demos/rolodex:
+ Installation does version number fixup, so we shouldn't. Thanks
+ to wohnivec@iol.cz for pointing these (thankfully minor) problems
+ out.
+
+2001-10-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/widget: Integrated labelframe item into the labels
+ section and added a spinbox demo to the (retitled) entry section.
+
+ * library/demos/labelframe.tcl: Adjusted so as to show off the
+ labelframe widget to better effect and have a better description.
+
+ * library/demos/spin.tcl: New demo to show off spinbox capabilities.
+
+ * library/demos/rolodex: Changes up-ported from core-8-3-1-branch
+ to make the script use more 8.*-isms, but not menus due to the way
+ the context help system works.
+
+ * library/demos/ixset: Changed to use the labelframe widget and
+ the grid geometry manager.
+
+2001-10-29 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/browse: Changes up-ported from core-8-3-1-branch
+ to make the script much more robust, particularly when neither the
+ current version of wish or the script are on the path.
+
+ * library/demos/hello: Added emacs trailing tag-line.
+
+ * library/demos/tcolor: Changes up-ported from core-8-3-1-branch
+ to make the script compliant with current good practise, as well
+ as extensive use of the new labelframe widget.
+
+ * library/demos/timer: Changes up-ported from core-8-3-1-branch to
+ make the script look and work better.
+
+ * library/demos/rmt: Changes up-ported from core-8-3-1-branch to
+ use more 8.* features and make the demo script more generally
+ useful to people.
+
+2001-10-23 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkCursor.c (Tk_GetCursorFromData): Fixed uninit nextPtr
+ field. [adapted from Patch 473875]
+ (GetCursor): Removed double-assignment to nextPtr field.
+
+2001-10-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/console.tcl: removed transpose ability until the console
+ can get a proper rewrite of tag handling.
+
+2001-10-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/defs.tcl: removed threaded build warning under X.
+
+ * library/console.tcl (ConsoleOutput): fixed undefined widget
+ argument.
+
+2001-10-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/xmfbox.tcl: fixed filtering in motif file dialog.
+ [Patch #469670] (nelson)
+
+ * generic/tkWindow.c (OpenIM): Added simple XIM patch to enable
+ basic XIM input on Unix. [Patch #412727] (fabian)
+
+2001-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure:
+ * unix/configure.in:
+ * win/configure:
+ * win/configure.in:
+ * win/tkConfig.sh.in: reworked to be a little cleaner in
+ comparison to each other, and to AC_SUBST even empty vars for
+ win/tkConfig.sh
+
+2001-10-12 Todd M. Helfter <tmh@purdue.edu>
+
+ * ChangeLog:
+ * doc/menu.n:
+ * generic/tkMenu.c:
+ * generic/tkMenu.h:
+ * generic/tkMenubutton.c:
+ * generic/tkMenubutton.h:
+ * mac/tkMacDefault.h:
+ * mac/tkMacMenu.c:
+ * mac/tkMacMenubutton.c:
+ * tests/menu.test:
+ * unix/tkUnixDefault.h:
+ * unix/tkUnixMenu.c:
+ * win/makefile.vc:
+ * win/tkWinDefault.h:
+ * win/tkWinMenu.c:
+ * win/tkWinWm.c: Implementation of TIP #63, the addition of
+ a -compound option to menu entries allowing text and an image to
+ be displayed at the same time.
+
+2001-10-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/console.tcl: added more smarts extracted from tkcon to
+ the default console.
+
+2001-10-01 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinTest.c: better error reporting from testclipboard
+
+ * win/tkWinDialog.c: minor cast changes to support Win64
+
+ * win/tkWinWindow.c: made use of standard Tk_GetHWND instead of
+ older, private TkWinGetHWND.
+
+ * win/configure: regen'ed
+ * win/tcl.m4:
+ * win/makefile.vc: updated for Win64 SDK RC1 compilation support
+
+2001-09-30 Peter Spjuth <peter.spjuth@space.se>
+
+ * doc/grid.n:
+ * generic/tkGrid.c:
+ * tests/grid.test: Added -uniform option to grid's row/column-
+ configure. [TIP 37] [Patch 459343]
+
+2001-09-26 Peter Spjuth <peter.spjuth@space.se>
+
+ * win/tkWinFont.c (Tk_DrawChars): Added support for clipping text.
+
+ * doc/frame.n:
+ * doc/labelframe.n:
+ * doc/toplevel.n:
+ * generic/tkFrame.c:
+ * generic/tkInt.h:
+ * generic/tkWindow.c:
+ * library/demos/radio.tcl:
+ * library/demos/labelframe.tcl:
+ * library/demos/widget:
+ * mac/tkMacDefault.h:
+ * tests/frame.test:
+ * unix/tkUnixDefault.h:
+ * win/tkWinDefault.h: Added labelframe widget. Added -padx/y
+ options to frame and toplevel.
+
+ * tests/grid.test:
+ * tests/pack.test:
+ * tests/place.test: Used labelframe to test geometry manager changes.
+ [TIP 18] [Patch 429164]
+
+2001-09-26 Peter Spjuth <peter.spjuth@space.se>
+
+ * doc/GeomReq.3:
+ * doc/WindowId.3:
+ * generic/tk.decls:
+ * generic/tk.h:
+ * generic/tkDecls.h:
+ * generic/tkGeometry.c:
+ * generic/tkGrid.c (ArrangeGrid):
+ * generic/tkInt.h:
+ * generic/tkPack.c (ArrangePacking):
+ * generic/tkPlace.c (RecomputePlacement):
+ * generic/tkStubInit.c:
+ * generic/tkUtil.c (TkComputeAnchor):
+ * generic/tkWindow.c (TkAllocWindow):
+ * unix/mkLinks: Geometry manager changes to support TIP#18.
+ Allows a widget to set different internal border widths on
+ different sides, and to set a minimum requested size.
+ POTENTIAL INCOMPATIBILITY. [Patch 429164]
+
+2001-09-25 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkBind.c:
+ * generic/tkInt.decls (TkpScanWindowId):
+ * unix/tkUnixPort.h (Tkp{Print,Scan}WindowId):
+ * unix/tkUnixXId.c (TkpScanWindowId):
+ * win/tkWinWindow.c (TkpScanWindowId): Corrected definition of
+ TkpScanWindowId to handle situation where types Window and int
+ do not have the same number of bits. CONST-ified too.
+
+ * generic/tkIntPlatDecls.h:
+ * generic/tkStubInit.c: make genstubs
+
+2001-09-24 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkMain.c (StdinProc): Update to handle change in
+ return type of Tcl_DStringAppend() from (char *) to (CONST char *).
+ [TIP 27]
+
+2001-09-23 Peter Spjuth <peter.spjuth@space.se>
+ * generic/tkPack.c (ConfigureSlaves):
+ * tests/pack.test:
+ * tests/grid.test: Pack accepted asymmetric values for -ipadx/y.
+ Only -padx/y supports asymmetry. [Bug #462348]
+
+2001-09-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWindow.c (TkpPrintWindowId, TkpScanWindowId): fixed to
+ work on Win64 with 64bit XIDs.
+
+ * generic/tkWindow.c (Tk_CreateAnonymousWindow):
+ * generic/tkEntry.c (GetSpinboxElement): fixed unreachable returns.
+
+ * win/tkWinX.c (TkGetServerInfo): added recognition of Win64.
+
+ * xlib/X11/X.h: made XID __int64 type for Win64.
+
+ * unix/tkUnixPort.h:
+ * mac/tkMacPort.h: add (int*) cast to TkpScanWindowId.
+ These may need to be changed to Window* (ulong).
+
+ * generic/tkCmds.c (Tk_WinfoObjCmd):
+ * generic/tkBind.c (NameToWindow):
+ correct Window id's to be of type Window
+
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkInt.decls (TkpScanWindowId): changed decl to use
+ Window* instead of int*.
+
+ * xlib/xcolors.c:
+ * generic/tkPack.c,tkWindow.c:
+ * win/tkWinFont.c,tkWinMenu.c:
+ * unix/tkUnixScale.c: minor cast fixes to prevent 64bit warnings.
+
+ * tests/scrollbar.test (scrollbar-6.27): marked knownBug because
+ it is skewed by bad dimensions returned by Windows.
+
+ * tests/textDisp.test (textDisp-4.12): corrected test to work
+ properly on Windows.
+
+ * tests/id.test,macFont.test,macMenu.test,macscrollbar.test:
+ * tests/send.test,winClipboard.test,winDialog.test,winFont.test:
+ improved use of test constraints
+
+ * win/tkWinWm.c (WinSetIcon): fixed SetClassLong for 64bit support.
+
+2001-09-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure: regen'ed
+ * unix/tcl.m4: added --enable-64bit support for HP-11 with the
+ 64-bit kernel.
+
+2001-09-17 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkGrid.c (ConfigureSlaves):
+ * generic/tkPack.c (PackAfter): Corrected type definition of
+ argument passed to Tcl_GetStringFromObj() from size_t to int.
+ Incorrect type broke [pack] and [grid] on systems where
+ sizeof(size_t) != sizeof(int). [Bugs 462375, 462342, 462338]
+
+2001-09-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/choosedir.tcl (DblClick):
+ * library/tkfbox.tcl (OkCmd, ListInvoke): Rewrote so as to avoid
+ the highly confusing string "text" and to be consistent about what
+ is and what is not a list. [Bug 459895, reported by fandom]
+
+2001-09-14 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * generic/tkImgGIF.c:
+ * generic/tkImgPPM.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkMenu.c: Applied patch [461578], provided by Vincent
+ Darley. This fixes several memory leaks in the image code. They
+ happen if there are errors during the initialization of the
+ channel the image is supposed to be read from.
+
+2001-09-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure:
+ * unix/tcl.m4: Update from Tcl.
+
+2001-09-12 D. Richard Hipp <drh@hwaci.com>
+
+ * library/tkfbox.tcl: fixed error that appeared when you would
+ click on the canvas while viewing an empty directory.
+
+2001-09-10 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure:
+ * unix/tcl.m4: Update from Tcl.
+
+2001-09-09 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/Makefile.in: Fix Windows Makefile so that
+ tcltest will automatically be compiled if the
+ user tries to build tktest.
+
+2001-09-09 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/Makefile.in: Use TKTEST variable directly
+ instead of depending on the tktest alias.
+
+2001-09-08 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/mkd.bat:
+ * win/rmd.bat:
+ Apply binary property (cvs admin -kb) to files and convert
+ to CRLF linefeed format to fix the VC++ build. [Tcl Bug #219409]
+
+2001-08-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/menu.test:
+ * tests/send.test:
+ * tests/select.test: corrected to use testConfig constraints in
+ the TK_ALT_DISPLAY case
+
+ * tests/unixSend.test: removed test file completely identical to
+ send.test. Removed platform specific named file in case somebody
+ gets send working on Win/Mac in the future.
+
+ * tests/config.test: added config-14.1 to test namespace import
+ evaluation of widgets.
+ * generic/tkButton.c (ButtonCreate):
+ * generic/tkFrame.c (CreateFrame):
+ * generic/tkMenubutton.c (Tk_MenubuttonObjCmd):
+ * generic/tkPlace.c (Tk_PlaceObjCmd):
+ * generic/tkScale.c (Tk_ScaleObjCmd):
+ * generic/tkMessage.c (Tk_MessageObjCmd):
+ * generic/tkEntry.c (Tk_EntryObjCmd, Tk_SpinboxObjCmd):
+ * generic/tkSquare.c (SquareObjCmd): redid the handling of
+ optionTables in widgets to allow them to be imported into other
+ namespaces. [Bug #456632]
+
+2001-08-28 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinDialog.c (ChooseDirectoryHookProc): work-around for MS
+ bug that caused crashing in tk_chooseDirectory on Win95.
+ [Bug #224936] (baker)
+
+ * unix/tkUnixWm.c (TkWmRestackToplevel): reworked how
+ ConfigureNotify requests were handled in relation to the parent to
+ avoid the problem with potential 'raise' delays on some wms.
+ [Bug #220260] (baker) wms that were affected should notice the
+ difference in tests unixWm-51.* not failing that failed before.
+
+2001-08-26 Don Porter <dgp@users.sourceforge.net>
+
+ * library/text.tcl (<Shift-Up> binding): Corrected TIP 44 typo
+ that broke binding. Thanks to "Michal" for the fix.
+ [Bug 455468]
+
+2001-08-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure:
+ * unix/tcl.m4: added QNX-6 build support. [Bug #219410] (loverso)
+
+ * doc/CrtPhImgFmt.3: removed bogus note about including tkPhoto.h
+
+2001-08-22 Peter Spjuth <peter.spjuth@space.se>
+
+ * generics/tkGrid.c (ConfigureSlaves):
+ * tests/grid.test: Fixed a bug where adjacent 'x' and '^' where
+ not handled properly. [Bug #452040]
+
+2001-08-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkPack.c (TkParsePadAmount): added lint init for sepChar.
+
+ * tests/dialog.test (HitReturn): fixed failing dialog-2.1 test
+ because it wasn't always getting focus properly.
+
+2001-08-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/unixFont.test (unixFont-2.[234]): fixed to be more
+ sensitive on systems that have more installed fonts.
+
+ * library/dialog.tcl (tk_dialog): changed dialog to show bar on
+ Windows as well and added some y padding between the buttons and
+ the bar. [Patch #442835] (harrismh)
+
+2001-08-20 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkInt.h:
+ * generic/tkWindow.c:
+ * generic/tkGrid.c:
+ * generic/tkPack.c:
+ * tests/grid.test:
+ * tests/oldpack.test:
+ * tests/pack.test: Objectified grid and pack commands.
+
+2001-08-20 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkObj.c (TkGetWindowFromObj): Rewrote window code to
+ reuse a previously worked-out set of window information exactly
+ when the reference window is the same and no window deletions have
+ occurred since the object was allocated (display has same epoch
+ counter.) Required changing the internal rep of the window quite
+ a bit as now need to save three words-worth of information in the
+ internal rep (this window, reference window, display epoch.)
+ * generic/tkObj.c (SetWindowFromAny, DupWindowInternalRep)
+ (FreeWindowInternalRep): Code to support new internal rep for
+ window objects.
+ * generic/tkInt.h: Added epoch counter to TkDisplay structure
+ * generic/tkWindow.c (GetScreen, Tk_DestroyWindow): Epoch counter
+ is incremented every time a window is deleted.
+
+2001-08-18 Peter Spjuth <peter.spjuth@space.se>
+
+ * doc/grid.n:
+ * tests/grid.test:
+ * generic/tkGrid.c: Grid configure rejected initial "x" and "^".
+ [Bug #418664]
+
+2001-08-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkObj.c (TkGetWindowFromObj): Was failing to reuse
+ cached window objects, forcing a call to Tcl_GetStringFromObj and
+ Tk_NameToWindow every time. This fault has been in there for
+ nearly three years...
+
+2001-08-15 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Labelled the TIP 44 changes as "POTENTIAL INCOMPATIBILITY".
+ Although technically internal changes are not incompatible, they'll
+ be perceived as such by those who get bitten, and this will help
+ them find the cause of their trouble.
+
+2001-08-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tk{Util,Font,Cursor,Color,Bitmap,3d}.c: Modified
+ objtype declarations so that they can be picked up in tkObj.c and
+ the names are now prefixed with "tk" too.
+ * generic/tkObj.c (TkRegisterObjTypes):
+ * generic/tkWindow.c (Initialize):
+ * generic/tkInt.h: Added code to register Tk's object types with
+ the Tcl runtime. [Tcl Bug 450545]
+
+2001-08-12 Mo DeJong <mdejong@redhat.com>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2001-08-10 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/image2.tcl (loadDir): Converted non-portable
+ [glob [file join $dirName *]] to [glob -directory $dirName *]
+ which is both fully portable and more reliable when directory
+ names contain glob-significant characters. [Bug 223313]
+
+2001-08-08 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/dialog.test: New file testing [tk_dialog].
+
+ * library/dialog.tcl:
+ * library/tkfbox.tcl: Corrections to problems introduced by
+ the TIP 44 changes. [Bug 449261]
+
+ * README:
+ * generic/tk.h:
+ * unix/configure:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure:
+ * win/configure.in: Bumped up patchlevel to 8.4a4 to distinguish
+ CVS snapshots from the 8.4a3 release. This does not necessarily
+ mean there will be an 8.4a4 release. [Bug 448938].
+
+2001-08-07 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (dist): added {unix,win}/tcl.m4 and
+ library/msgs/*.msg to dist target. [Bug: #448802]
+
+2001-08-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ 8.4a3 RELEASE
+
+ * changes:
+ * README: updated for 8.4a3 release
+
+ * unix/configure: regenerated
+ * unix/tcl.m4: added GNU (HURD) configuration target. (brinkmann)
+ [Patch: #442974]
+
+2001-08-06 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c:
+ * generic/tkWindow.c:
+ * library/bgerror.tcl:
+ * library/dialog.tcl:
+ * library/msgbox.tcl:
+ * library/unsupported.tcl:
+ * mac/tclets.tcl:
+ * mac/tkMacHLEvents.c:
+ * mac/tkMacWm.c: TIP 44 changes specific to the Mac and
+ Windows platforms that were overlooked before: tkOpenDocument,
+ tkConsoleExit, tkConsoleOutput, unsupported1 out of namespace :: .
+ Thanks to Vince Darley for prompting another look.
+
+2001-08-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/winMain.c (WishPanic): fixed CONST changes to go with
+ CONST-ification in Tcl.
+
+ * win/configure: regenerated
+ * win/tcl.m4: fixed DLLSUFFIX definition to always be ${DBGX}.dll.
+ This is necessary for TEA compliant builds that build shared
+ against a static-built Tk.
+ * win/Makefile.in ($(WISH)): added $(TK_STUB_LIB_FILE) to build
+ target, otherwise it wouldn't get generated in a static build.
+
+2001-08-01 Don Porter <dgp@users.sourceforge.net>
+
+ * doc/console.n:
+ * doc/menu.n:
+ * doc/text.n:
+ * doc/tkvars.n:
+ * generic/tkBind.c:
+ * generic/tkMenu.c:
+ * library/bgerror.tcl:
+ * library/button.tcl:
+ * library/choosedir.tcl:
+ * library/clrpick.tcl:
+ * library/comdlg.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/entry.tcl:
+ * library/focus.tcl:
+ * library/listbox.tcl:
+ * library/menu.tcl:
+ * library/msgbox.tcl:
+ * library/optMenu.tcl:
+ * library/palette.tcl:
+ * library/scale.tcl:
+ * library/scrlbar.tcl:
+ * library/spinbox.tcl:
+ * library/tclIndex:
+ * library/tearoff.tcl:
+ * library/text.tcl:
+ * library/tk.tcl:
+ * library/tkfbox.tcl:
+ * library/unsupported.tcl:
+ * library/xmfbox.tcl:
+ * mac/tkMacMenu.c:
+ * tests/clrpick.test:
+ * tests/filebox.test:
+ * tests/macMenu.test:
+ * tests/menu.test:
+ * tests/menuDraw.test:
+ * tests/msgbox.test:
+ * tests/text.test:
+ * tests/unixMenu.test:
+ * tests/winMenu.test:
+ * tests/xmfbox.test:
+ * unix/mkLinks:
+ * unix/tkUnixDialog.c: Merged changes from feature branch
+ dgp-privates-into-namespace, implementing TIP 44. All
+ Tk commands and variables matching tk[A-Z]* are now in the
+ ::tk namespace. See "BRANCH: dgp-privates-into-namespace"
+ entries below for details. [FR 220936]
+
+2001-07-24 Mo DeJong <mdejong@redhat.com>
+
+ * generic/default.h: Include tkWinDefault.h
+ when built with Cygwin or Mingw.
+
+2001-07-18 Don Porter <dgp@users.sourceforge.net>
+
+ BRANCH dgp-privates-into-namespace:
+ * doc/console.n: Updated names of private console commands.
+
+2001-07-16 Don Porter <dgp@users.sourceforge.net>
+
+ BRANCH dgp-privates-into-namespace:
+ * library/console.tcl:
+ * library/unsupported.tcl: Renamed tk::histNum to tk::HistNum
+ as directed by the Tcl Style Guide.
+
+2001-07-10 Mo DeJong <mdejong@redhat.com>
+
+ * unix/Makefile.in: Add AR and STLIB_LD variables.
+ * unix/configure:
+ * unix/configure.in: Use STLIB_LD when defining MAKE_LIB
+ and MAKE_STUB_LIB. Subst STLIB_LD, RANLIB, and AR.
+ * unix/tcl.m4: Update from Tcl.
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl.
+
+2001-07-06 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl.
+
+2001-07-05 Mo DeJong <mdejong@redhat.com>
+
+ * win/Makefile.in: Subst DEPARG directly instead
+ of relying on a variable. This will make Cygwin
+ build faster since an extra exec will be avoided.
+ * win/configure: Regen.
+ * win/configure.in: Subst DEPARG.
+ * win/tcl.m4: Update from Tcl.
+
+2001-07-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * README:
+ * mac/README:
+ * unix/README:
+ * win/README: updated READMEs with purls
+
+2001-07-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/canvas.test:
+ * generic/tkCanvPoly.c (PolygonToArea): Added patch that respects
+ the polygon difference of including points in the polygon even
+ when fill is empty. [Bug #226357]
+
+2001-07-03 Mo DeJong <mdejong@redhat.com>
+
+ * win/Makefile.in: Remove PATHTYPE variable.
+ * win/configure: Regen.
+ * win/configure.in: Don't subst PATHTYPE.
+ * win/tcl.m4: Update from Tcl.
+
+2001-07-03 Mo DeJong <mdejong@redhat.com>
+
+ * win/Makefile.in: Don't use VPSEP, instead just use :
+ in the VPATH.
+ * win/configure: Regen.
+ * win/configure.in: Don't subst VPSEP.
+
+2001-07-03 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/xmfbox.tcl (tkMotifFDialog_ActivateSEnt): Added missing
+ backslash [Bug #438247]
+
+2001-07-02 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkWindow.c (Tk_DestroyWindow): changed to use
+ Tcl_EventuallyFree instead of ckfree so that widgets that have
+ references to a tkwin can use them.
+
+ * generic/tkCanvArc.c:
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvWind.c:
+ * generic/tkRectOval.c: corrected argument handling in
+ Create<Item> functions that could lead to ABRs or FMRs and
+ corrected names of argc/argv to objc/objv.
+
+ * generic/tkImgGIF.c (Mgetc): corrected screwy use of ternary
+ operator and possible FMR.
+
+ * generic/tkEntry.c: corrected missing Tcl_Release that caused
+ font not freed complaints when trying valid cleanup calls.
+ * generic/tkListbox.c: made use of Tcl_Preserve/Tcl_Release to
+ prevent FMR errors in Display functions.
+
+ * unix/tkUnixScale.c (TkpDisplayScale): corrected FMR when scale
+ was deleted while calling its command.
+
+ * library/console.tcl:
+ * library/entry.tcl:
+ * library/spinbox.tcl:
+ * library/text.tcl:
+ * library/tk.tcl: added private ::tk::GetSelection command to
+ handle requesting selection. This is to support requesting
+ UTF8_STRING before generic STRING on Unix. Changed Text, Spinbox,
+ Entry and Console to use this command.
+
+ * tests/select.test:
+ * generic/tkSelect.c (Tk_CreateSelHandler, Tk_DeleteSelHandler):
+ on Unix, a UTF8_STRING handler will be created when the user
+ requests a STRING handler (in addition to the STRING handler).
+ This provides implicit support for the new UTF8_STRING selection
+ target.
+ * unix/tkUnixSelect.c (TkSelEventProc, ConvertSelection): Added
+ support for UTF8_STRING target. [RFE #418653, Patch #433283]
+
+ * generic/tkInt.h: added utf8Atom to TkDisplay structure.
+
+ * tests/listbox.test: changed 'darkblue' to 'white' in a test
+ because it isn't a portable color name.
+
+ * generic/tkEntry.c (DestroyEntry): used Tcl_EventuallyFree
+ instead of ckfree for entryPtr to prevent FMRs. [Bug #413904]
+
+2001-06-26 Mo DeJong <mdejong@redhat.com>
+
+ * unix/Makefile.in:
+ * win/Makefile.in: Add `make shell` target. This target
+ will set the proper env vars before invoking wish
+ from the build directory.
+
+2001-06-26 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure:
+ * win/configure.in: Revert cross compiling change
+ accidently added during last checkin.
+
+2001-06-26 Mo DeJong <mdejong@redhat.com>
+
+ * unix/configure: Regen.
+ * unix/configure.in: Fix last checkin by removing
+ export since that only works in bash.
+ * win/configure: Regen.
+ * win/configure.in: Ditto.
+
+2001-06-26 Mo DeJong <mdejong@redhat.com>
+
+ * unix/configure: Regen.
+ * unix/configure.in: Set CFLAGS to "" if the user
+ did not set CFLAGS in the env. This keeps AC_PROG_CC
+ from adding "-g -O2" to the CFLAGS by default.
+ * win/configure: Regen.
+ * win/configure.in: Ditto.
+
+2001-06-22 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure: Regen.
+ * win/configure.in: Use RC_DEFINE flag from tcl.m4.
+ * win/tcl.m4: Update from Tcl.
+
+2001-06-22 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl.
+
+2001-06-22 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure: Regen.
+ * win/tcl.m4 (SC_CONFIG_CFLAGS): Link to the
+ imm32 library when building with mingw gcc.
+ * win/tkWinX.c: Include the imm.h header
+ to fix compiling with mingw gcc.
+
+2001-06-22 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure: Regen.
+ * win/configure.in: Add resource compiler fix from
+ 8.3.3 to fix compiling with mingw.
+
+2001-06-22 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure: Regen.
+ * win/tcl.m4: Fix silly typo in last checkin.
+
+2001-06-22 Mo DeJong <mdejong@redhat.com>
+
+ * unix/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@.
+ Set LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@. Add LDFLAGS_DEBUG
+ and LDFLAGS_OPTIMIZE to match the way CFLAGS_DEFAULT works. Use
+ new LDFLAGS variable in the Makefile instead of @LDFLAGS@.
+ * unix/configure: Regen.
+ * unix/configure.in: Don't set CFLAGS to CFLAGS_DEFAULT, instead
+ subst CFLAGS_DEFAULT into the Makefile. Add AC_SUBST for CFLAGS_DEBUG,
+ CFLAGS_OPTIMIZE, LDFLAGS_DEFAULT, LDFLAGS_DEBUG, and LDFLAGS_OPTIMIZE.
+ Remove unused LD_FLAGS subst.
+ * unix/tcl.m4: Update from Tcl.
+ * win/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@.
+ Set LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@.
+ * win/configure: Regen.
+ * win/configure.in: Don't set CFLAGS or LDFLAGS, instead subst
+ CFLAGS_DEFAULT and LDFLAGS_DEFAULT into the Makefile.
+ * win/tcl.m4: Update from Tcl.
+
+2001-06-22 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure:
+ * win/tcl.m4: Update From Tcl.
+
+2001-06-21 eric melski <ericm@interwoven.com>
+
+ * doc/colors.n: Corrected bogus documentation with respect to
+ several shades of blue, all of which were listed as RGB 0 0 0.
+ [Bug #432104].
+
+2001-06-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/floor.tcl, library/demos/filebox.tcl,
+ * library/demos/clrpick.tcl, library/demos/vscale.tcl,
+ * library/demos/twind.tcl, library/demos/ruler.tcl,
+ * library/demos/plot.tcl, library/demos/items.tcl,
+ * library/demos/hscale.tcl, library/demos/ctext.tcl,
+ * library/demos/cscroll.tcl, library/demos/arrow.tcl,
+ * library/xmfbox.tcl, library/msgbox.tcl,
+ * library/clrpick.tcl, library/bgerror.tcl: Braced expressions.
+
+2001-06-06 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure: Regen.
+ * win/configure.in: Handle the --prefix option correctly
+ it should default to /usr/local like the unix version.
+
+2001-06-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/selection.n:
+ * doc/clipboard.n: added SEE ALSOs to cross-reference selection
+ and clipboard, with extra note for clipboard command in selection
+ docs. [Patch #422256]
+
+ * unix/tkUnixFont.c: Corrected support for iso10646 (X11 Unicode)
+ fonts on Unix. This adds a ucs-2be (UCS-2 Big Endian) encoding in
+ Tk on Unix that is used for those fonts (X11 requires
+ big-endianness). (welch) [Patch #406411; Bug #220890 #220899]
+ This differs from the 8.3.3 patch by not adding ucs-2be in the
+ preferred encodingList (seems works fine without).
+ Added alias for jisx0201* fonts to jis0201 encoding. [Bug #414033]
+
+2001-05-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinKey.c (TkpSetKeycodeAndState): removed old debug info
+
+2001-05-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinX.c: moved the initialization of tkPlatformId from
+ TkWinXInit to TkWinGetPlatformId because static builds could call
+ it before it was initialized. [Bug #427278]
+
+2001-05-28 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkFrame.c:
+ * generic/tkWindow.c:
+ * tests/frame.test: Upgraded frame to use the newer TK_OPTION
+ style when processing configuration options. Some cleanup of
+ bad comments and bad code. [part of patch #420861]
+
+2001-05-23 Mo DeJong <mdejong@redhat.com>
+
+ * unix/configure:
+ * unix/tcl.m4:
+ * win/configure:
+ * win/tcl.m4: Sync from Tcl sources.
+
+2001-05-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tcl.m4: sync'ed up wih Tcl tcl.m4. [Bug #419812]
+
+ * doc/TkInitStubs.3:
+ * generic/tk.h:
+ * generic/tkStubLib.c: CONST'ified Tk_InitStubs to match CONST
+ changes to Tcl_PkgRequireEx.
+
+2001-05-21 Todd M. Helfter <tmh@purdue.edu>
+
+ * doc/menubutton.n:
+ * generic/tkMenubutton.c:
+ * generic/tkMenubutton.h:
+ * mac/tkMacMenubutton.c:
+ * tests/menubut.test:
+ * unix/tkUnixMenubu.c: Implementation of TIP #11, the addition of
+ a -compound option to the menubutton allowing text and an image to
+ be displayed at the same time. This behavior is identical to the
+ behavior of the button widget.
+
+2001-05-16 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/console.n: Added - was erroneously placed in Tcl before...
+
+2001-04-25 Mo DeJong <mdejong@redhat.com>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl.
+
+2001-04-25 Mo DeJong <mdejong@redhat.com>
+
+ * unix/configure: Regen.
+ * unix/configure.in: Use $@ in MAKE_LIB and MAKE_STUB_LIB
+ commands instead of using a delayed subst variable. Replace
+ instances of STUB_LIB_FILE with TK_STUB_LIB_FILE.
+
+2001-04-25 Mo DeJong <mdejong@redhat.com>
+
+ * unix/Makefile.in: Use TCL_STUB_LIB_FILE instead of STUB_LIB_FILE.
+ * unix/configure: Regen.
+ * unix/configure.in: Don't subst STUB_LIB_FILE, use TCL_STUB_LIB_FILE
+ instead.
+
+2001-04-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImage.c (Tk_ImageObjCmd,DeleteImage): Better detection
+ of deletion when world is falling apart. [Bug #220819]
+
+2001-04-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinMenu.c (TkWinHandleMenuEvent): corrected reseting of
+ service mode to only occur when it was set. [Bug #220948]
+
+2001-04-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/winClipboard.test: improved results for understanding when
+ tests fail.
+
+ * tests/winDialog.test: string totitle'd some results that
+ expected [pwd] to return a capital drive letter.
+
+ * tests/cursor.test: changed tests to use 'heart' cursor because
+ 'arrow' on windows has a pre-skewed use count.
+
+ * win/tkWinDialog.c (GetFileNameA): initialize multi to 0.
+
+2001-04-02 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure:
+ * win/tcl.m4 (SHLIB_LD): added -incremental:no. [Bug #219381]
+
+ * generic/tkMenu.c (TkInvokeMenu): checked for menu deletion
+ before calling associated menu entry command. [Bug #220821]
+
+ * doc/image.n: added warning about names chosen for images.
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): corrected the src and dest
+ values for $imageName put when -format and -to are used.
+ [Bug #232741]
+
+ * tests/listbox.test: added test listbox-27.1, delete during
+ scrollbar update
+ * generic/tkListbox.c (DestroyListbox, ListboxEventProc):
+ corrected listbox to make proper use of Tcl_EventuallyFree and
+ protect against unusual listbox deletion.
+
+ * tests/entry.test: added tests entry-20.*, delete during widget
+ activity
+ * generic/tkEntry.c (DestroyEntry, EntryEventProc): fixed the
+ entry widget to survive deletion while processing scrollbar
+ updates and validation.
+
+ * tests/canvas.test: test of canvas delete during event
+ * generic/tkCanvas.c (DestroyCanvas, CanvasEventProc): fixed the
+ canvas to survive deletion during event processing. [Bug #228024]
+
+2001-04-01 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * README:
+ * mac/README: updated patchlevel to 8.4a3 and corrected links and
+ notes.
+
+ * generic/tk.h:
+ * unix/configure.in (TK_PATCH_LEVEL):
+ * unix/configure:
+ * unix/tk.spec:
+ * win/configure.in (TK_PATCH_LEVEL):
+ * win/configure: updated patchlevel to 8.4a3
+
+2001-03-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/safe.test: added note about correcting failures in
+ safe.test.
+ * library/tk.tcl: moved package require msgcat inside if case to
+ not be used in safe interps.
+
+ * win/makefile.vc:
+ * win/configure:
+ * win/tcl.m4: added imm32.lib to LIBS_GUI for Tk IME support.
+ * win/tkWinInt.h:
+ * win/tkWinKey.c:
+ * win/tkWinX.c: added support for changing IME on the fly in
+ Windows (2000). (lam) [Patch #402993]
+
+ * tests/bind.test (bind-22.18):
+ * generic/tkBind.c (NameToWindow): handled the error case where a
+ valid-looking but invalid identifier could be passed in certain
+ event generate options causing a crash. [Bug #411307]
+
+ * win/tkWinWm.c (UpdateWrapper): ensured that the passed in winPtr
+ had an existent window to operate on. [Bug #409172]
+
+ * win/Makefile.in (install-*): improved install-* targets to use
+ their base build dependency.
+
+ * generic/tkImage.c (Tk_ImageObjCmd, EventuallyDeleteImage):
+ added casts to allow compiling on Windows with debbuging.
+
+2001-03-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/msgs/de.msg: fixed translations. [Patch #403525]
+
+ * doc/canvas.n: Noted ability to specify coords as a list in the
+ docs. (techentin) [Patch #403660]
+
+ * tests/canvas.test: added test case to check obj conversion
+ * generic/tkObj.c (UpdateStringOfMM, SetMMFromAny): better
+ obj-aware screen distances. (pgbaum, hobbs) [Patch #403327]
+
+ * library/bgerror.tcl (bgerror): allow focus into details window
+ for Windows C&P to work. [Bug #220929]
+
+ * library/tk.tcl: put a catch around adding <hpBackTab> to the
+ <<PrevWindow>> virtual event as it doesn't seem to work on all HP
+ systems. [Bug #411669]
+
+ * library/tkfbox.tcl: fixed selecting directories and single files
+ with spaces using tk_getOpenFile -multiple 1. [Bug #411640]
+
+ * win/tkWinDialog.c (GetFileNameA): added support for -multiple to
+ ascii-based tk_getOpenFile (Win9*). (haneef) [Patch #403047]
+ (GetFileNameW): increased number of files that could be returned
+ by tk_getOpenFile -multiple. [Patch #412042]
+
+2001-03-29 Mo DeJong <mdejong@redhat.com>
+
+ * library/entry.tcl (tkEntryMouseSelect):
+ * library/text.tcl (tkTextSelectTo): When
+ the mouse is dragged with the button down,
+ move the insertion cursor to the current
+ mouse position.
+ * tests/event.test: Add a series of tests
+ for event generation. Add tests for selection,
+ check the position of the insertion cursor.
+
+2001-03-28 Jeff Hobbs <jeffh@gimlet.activestate.com>
+
+ * unix/configure:
+ * unix/tcl.m4: corrected IRIX-5.x config to not use -n32.
+ (english) [Patch 403626]
+
+2001-03-28 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/focus.test (focus-6.1):
+ * tests/macEmbed.test (unixEmbed-5.1):
+ * tests/macMenu.test (macMenu-21.3):
+ * tests/menu.test (menu-27.1):
+ * tests/unixEmbed.test (unixEmbed-8.2):
+ * tests/unixWm.test (unixWm-50.4): Replaced all [load {} tk]
+ in Tk test suite with [load {} Tk]. [Bug 220940, Patch 411952]
+
+2001-03-12 Don Porter <dgp@users.sourceforge.net>
+
+ BRANCH dgp-privates-into-namespace:
+ * doc/menu.n:
+ * unix/mkLinks: Added documentation for [tk_menuSetFocus].
+
+2001-03-12 Don Porter <dgp@users.sourceforge.net>
+
+ BRANCH dgp-privates-into-namespace:
+ * doc/text.n:
+ * doc/tkvars.n:
+ * unix/mkLinks: Added documentation for commands and variables
+ matching tk_text*.
+
+2001-03-08 Don Porter <dgp@users.sourceforge.net>
+
+ BRANCH dgp-privates-into-namespace:
+ * generic/tkTextDisp.c:
+ * library/unsupported.tcl:
+ * tests/textDisp.test: Restored the global variables tk_textRedraw
+ and tk_textRelayout. Since they match tk_*, they should remain
+ publicly available until at least Tk 9.
+
+2001-03-01 Don Porter <dgp@users.sourceforge.net>
+
+ BRANCH dgp-privates-into-namespace:
+ * library/unsupported.tcl: New file for Tk's unsupported
+ interfaces. Contains [tk::unsupported::ExposePrivateCommand]
+ and [tk::unsupported::ExposePrivateVariable] that restore the
+ availability of an old public name of one of Tk's private
+ commands and variables, respectively, for those applications
+ and extensions that depend on the old names against advice.
+
+2001-02-28 Don Porter <dgp@users.sourceforge.net>
+
+ BRANCH dgp-privates-into-namespace: Feature branch to move all
+ of Tk's private commands and variable into the ::tk namespace
+ and its children.
+
+ * doc/tkvars.n: Documented private variable tkPriv renamed tk::Priv.
+
+ * generic/tkBind.c:
+ * generic/tkMenu.c:
+ * generic/tkTextDisp.c:
+ * library/bgerror.tcl:
+ * library/button.tcl:
+ * library/choosedir.tcl:
+ * library/clrpick.tcl:
+ * library/comdlg.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/entry.tcl:
+ * library/focus.tcl:
+ * library/listbox.tcl:
+ * library/menu.tcl:
+ * library/msgbox.tcl:
+ * library/optMenu.tcl:
+ * library/palette.tcl:
+ * library/scale.tcl:
+ * library/scrlbar.tcl:
+ * library/spinbox.tcl:
+ * library/tclIndex:
+ * library/tearoff.tcl:
+ * library/text.tcl:
+ * library/tk.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl:
+ * mac/tkMacMenu.c:
+ * tests/clrpick.test:
+ * tests/filebox.test:
+ * tests/macMenu.test:
+ * tests/menu.test:
+ * tests/menuDraw.test:
+ * tests/msgbox.test:
+ * tests/text.test:
+ * tests/textDisp.test:
+ * tests/unixMenu.test:
+ * tests/winMenu.test:
+ * tests/xmfbox.test:
+ * unix/tkUnixDialog.c: All Tk commands matching ::tk[A-Z]* and
+ all Tk private variables in the global namespace were renamed to
+ live in the namespace ::tk or one of its children.
+
+2001-02-13 Eric Melski <ericm@interwoven.com>
+
+ * doc/photo.n: [Bug 132213] Added clarification on interpretation
+ of ranges for "photoName data -from" subcommand.
+
+2001-02-12 D. Richard Hipp <drh@hwaci.com>
+
+ TIP #21: Asymmetric padding in the pack and grid geometry managers.
+ With this changes, you can now say "-padx {10 20}" to put 10 pixels
+ of padding on the left and 20 on the right. Similar rules apply
+ for vertical padding. See the revised documentation for details.
+
+2001-01-02 Andreas Kupries <a.kupries@westend.com>
+
+ Everything below belongs together and implements TIP#8 (SF patch#102833)
+
+ * win/tkWinWm.c (line 56f): Added icon structures.
+ * win/tkWinWm.c (struct WmInfo, line 242): Added reference to
+ optional icon for titlebar.
+ * win/tkWinWm.c (struct ThreadSpecificData, line 335): Added
+ reference to optional default icon for toplevel windows.
+ * win/tkWinWm.c (line 387 ... 1169): All the new functions required
+ to deal with icon specifications, 'InitWm' changed.
+ * win/tkWinWm.c (TkWmNewWindow, UpdateWrapper, TkWmDeadWindow, Tk_WmCmd):
+ Added initialization and handling of the new fields.
+ * doc/wm.n: Documentation updated to explain the newly available
+ functionality.
+
+2000-12-13 jeff hobbs <jhobbs@interwoven.com>
+
+ * generic/tkObj.c (SetMMFromAny): Added ability to recognize
+ double type object to speed up canvas coord calculations.
+ [Patch 403327]
+
+2000-12-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/entry.n: Improved documentation of interplay between the
+ -state and -textvariable options.
+
+2000-11-29 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/image.test (image-1.10): Improved this test, which
+ previously only worked if the command failed to delete the root
+ window, and caused *major* trouble otherwise...
+ * generic/tkImage.c (EventuallyDeleteImage): Created this function
+ so that images that get deleted during the creation of an image
+ won't cause a nasty core dump. Properly fixes bug #120819.
+
+2000-11-28 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/image.n:
+ * generic/tkImage.c (Tk_ImageObjCmd): Backed out previous change.
+ Bug #120819 is back again in force. Left the test in there
+ though.
+
+2000-11-23 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/image.n:
+ * tests/image.test (image-1.10):
+ * generic/tkImage.c (Tk_ImageObjCmd): Prohibited image names that
+ start with "." since they can cause some really obscure crashes.
+ Fixes Bug #120819.
+
+2000-11-21 Eric Melski <ericm@ajubasolutions.com>
+
+ Overall change: Implemented TIP 5, which exports
+ TkClassProcs/TkSetClassProcs as Tk_ClassProcs/Tk_SetClassProcs,
+ adding a size field to Tk_ClassProcs to allow for future
+ expansion, and renaming the geometryProc to worldChangedProc,
+ which is more in keeping with the actual use of the callback.
+
+ * unix/mkLinks: Added link for Tk_SetClassProcs.
+
+ * doc/SetClassProcs.3: Documentation for
+ Tk_ClassProcs/Tk_SetClassProcs.
+
+ * generic/tkCanvas.c:
+ * generic/tkEntry.c:
+ * generic/tkFrame.c:
+ * generic/tkListbox.c:
+ * generic/tkMenu.c:
+ * generic/tkMessage.c:
+ * generic/tkScale.c:
+ * generic/tkText.c: Updated to use Tk_ClassProcs/Tk_SetClassProcs
+ instead of TkClassProcs/TkSetClassProcs.
+
+ * generic/tkMenubutton.c:
+ * generic/tkScrollbar.c:
+ * generic/tkButton.c: Updated to use Tk_SetClassProcs instead of
+ TkSetClassProcs.
+
+ * generic/tkMenubutton.h:
+ * generic/tkScrollbar.h:
+ * generic/tkButton.h:
+ * win/tkWinButton.c:
+ * win/tkWinScrlbr.c:
+ * mac/tkMacButton.c:
+ * mac/tkMacMenubutton.c:
+ * mac/tkMacScrlbr.c:
+ * unix/tkUnixButton.c:
+ * unix/tkUnixMenubu.c:
+ * unix/tkUnixScrlbr.c: Updated to use Tk_ClassProcs instead of
+ TkClassProcs.
+
+ * generic/tkDecls.h:
+ * generic/tkStubInit.c:
+ * generic/tkIntDecls.h: Regenned from tk.decls, tkInt.decls.
+
+ * generic/tk.h: Added declaration of Tk_ClassProcs, with size
+ field. Added typedef's for Tk_ClassCreateProc,
+ Tk_ClassWorldChangedProc, Tk_ClassModalProc. Added definition of
+ Tk_GetClassProc macro, shorthand for extracting a member of the
+ Tk_ClassProcs structure.
+
+ * generic/tkInt.h: Removed declaration of TkClassProcs,
+ TkClassGeometryProc, etc.
+
+ * generic/tkBind.c (Tk_BindEvent): Updated to use Tk_GetClassProc
+ macro to extract modalProc; added check that the modalProc is non-NULL.
+
+ * generic/tkFont.c (RecomputeWidgets): Updated to use
+ Tk_GetClassProc macro to extract worldChangedProc; added comment
+ about the choice of a recursive versus iterative algorithm for
+ propagating world changed messages.
+
+ * generic/tkWindow.c (Tk_MakeWindowExist): Updated to use
+ Tk_GetClassProc macro to extract createProc from Tk_ClassProcs.
+
+ * generic/tk.decls: Added declaration for Tk_SetClassProcs.
+
+ * generic/tkInt.decls: Commented out declaration for
+ TkSetClassProcs, which is made public by this change. The entry
+ is left in place, but commented, so that future developers will
+ know not to reuse it's stub number.
+
+2000-11-21 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/ConfigWidg.3: Added deprecation note from Bug #120944 - use
+ Tk_SetOption() instead.
+
+ * generic/tkImgPhoto.c (TkPhotoGetValidRegion): Applied patch to
+ create this function and add it to tkInt stubs. Should now be
+ possible to write an extension that accesses the transparency data
+ in a photo image. Bug #120930
+
+2000-11-03 Jeff Hobbs <hobbs@ajubasolutions.com>
+
+ 8.4a2 RELEASE
+
+ * generic/tkWindow.c (Initialize): added call to Tcl_SetMainLoop.
+ This only has effect when tclsh is run (not wish), and then Tk is
+ loaded in interactively.
+
+2000-11-02 Jeff Hobbs <hobbs@ajubasolutions.com>
+
+ * win/tkWinButton.c:
+ * win/tkWinDialog.c:
+ * win/tkWinScrlbr.c:
+ * win/tkWinWm.c: fixed up code for Win64 support. This mostly
+ remains in _WIN64 #ifdef's, until updated compilers are standard.
+
+ * win/tcl.m4:
+ * win/makefile.vc: updated for Win64 compile support
+
+ * unix/configure:
+ * win/configure: checked in configure scripts so people doing
+ CVS checkouts aren't required to have autoconf. Changes to
+ configure.in in the future will require the corresponding
+ configure script to also be re-autoconf'ed and checked in.
+
+ * doc/event.n: added note that key events require window focus.
+
+2000-11-01 Jeff Hobbs <hobbs@ajubasolutions.com>
+
+ * win/tkWinDialog.c (GetFileNameW, GetFileNameA)
+ (Tk_ChooseDirectoryObjCmd): created
+ work-around for change in NT5.0/98 that caused no initialdir
+ setting to open the browser up in the user's documents dir.
+
+ * tests/color.test: marked color-2.6 nonPortable as we can't
+ reliably assume what 'red' maps to.
+
+2000-11-01 Eric Melski <ericm@ajubasolutions.com>
+
+ * tests/winDialog.test: Corrected expected results for bad option
+ tests (5.2, 5.5) to include -multiple option.
+
+ * win/tkWinDialog.c: Added branch for 0 return from
+ CommDlgExtendedError() switches; this was formerly treated as an
+ error, but it actually is not, since it just means the user hit
+ cancel or closed the dialog. (GetFileNameW): Added better smarts
+ such that -multiple is not considered a valid option for
+ tk_getSaveFile.
+ Removed CommDlgExtendedError() checks for color and choosedir
+ dialogs, and removed all except the explicit invalid filename
+ checks for the file dialogs.
+
+2000-10-30 David Gravereaux <davygrvy@ajubasolutions.com>
+
+ * win/configure.in:
+ * win/Makefile.in:
+ * win/makefile.vc:
+ * win/rc/tk.rc:
+ * win/rc/tk_base.rc (new):
+ * win/rc/wish.rc: Added logic to derive filenames better in the
+ resource scripts based on compile options along with better
+ support for building a static wish shell with cursor resources.
+
+2000-10-27 Jeff Hobbs <hobbs@ajubasolutions.com>
+
+ * unix/tcl.m4: added support for AIX-5.
+
+ * tests/tk.test:
+ * doc/tk.n: updated to reflect default on status of useinputmethods.
+ * library/tk.tcl: tk useinputmethods is set to 1 by default. This
+ enables Kanji and dead-char input by default. Intro'd in
+ 1999-12-16 with default off to avoid some problems with older X
+ servers that would slow down widget creation over time.
+
+ * win/Makefile.in (test, winhelp, tktest): corrected the
+ TCL_LIBRARY path specification.
+
+2000-10-18 Eric Melski <ericm@ajubasolutions.com>
+
+ * win/tkWinDraw.c (RenderObject): Applied patch from [Bug: 6368],
+ which corrects rendering of 1-pixel wide stippled lines on Windows.
+
+ * generic/tkCanvLine.c (DisplayLine): Applied patch from
+ [Bug: 6368], corrects bugs relating to use of active- and
+ disabledwidth values for displaying lines (disabledwidth was never
+ used, and activewidth/disablewidths would only possibly be used
+ when greater than default width, rather than when simply not equal
+ to default width).
+
+ * library/tkfbox.tcl (OkCmd): Applied patch from [Bug: 6365],
+ which adds safety for directory names containing spaces or which
+ are non-lists.
+
+ * win/tkWinDialog.c (GetFileNameW, GetFileNameA)
+ (Tk_ChooseColorObjCmd, Tk_ChooseDirectoryObjCmd): Added error
+ checking for the return value from the common dialog functions, so
+ that the commands will not silently fail if the common dialog
+ returns an error. [Bug: 6369].
+
+2000-10-10 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkConfig.c (Tk_InitOptions): Added
+ Tcl_IncrRefCount/Tcl_DecrRefCount calls on valuePtr, to prevent
+ memory leaks when the value object comes from the option
+ database. [Bug: 6275].
+
+2000-10-06 Jeff Hobbs <hobbs@ajubasolutions.com>
+
+ * win/Makefile.in (cat32.${OBJEXT}): add win/ subdirectory to
+ cat32 target to correctly find the source file.
+
+2000-10-05 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkCmds.c (Tk_WinfoObjCmd): Added check for
+ TK_ANONYMOUS_WINDOW flag in the [winfo children] subcommand; if
+ set, the window will not be printed in the list of children.
+
+ * doc/CrtWindow.3: Added entry for Tk_CreateAnonymousWindow.
+
+ * generic/tkWindow.c
+ (Tk_CreateAnonymousWindow): New API for creating anonymous
+ windows. These windows are manipulable from C, but not from Tcl,
+ because they have no pathname associated with them. They are used
+ initially by widgets that do rubber-band resizing (panedwindow,
+ multi-column listbox, etc.), and may be useful for other widgets
+ as well (dropbox, combobox).
+ (Tk_DestroyWindow): Added check for TK_ANONYMOUS_WINDOW flag when
+ determining whether to generate a DestroyNotify event.
+
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h: Regen'd from tk.decls.
+
+ * generic/tk.decls: Added Tk_CreateAnonymousWindow declaration.
+
+ * generic/tk.h: Added TK_ANONYMOUS_WINDOW flag for Tk_Window's.
+
+2000-10-04 Eric Melski <ericm@ajubasolutions.com>
+
+ * doc/MaintGeom.3: Noted that Tk_MaintainGeometry handles direct
+ descendants properly.
+
+ * generic/tkGeometry.c (Tk_MaintainGeometry): Added a check for
+ the case in which the slave window is a direct descendant of the
+ master window. In this case, we need not set up the additional
+ infrastructure normally provide by Tk_MaintainGeometry, because we
+ can rely on the parent/child relationship to handle it for us
+ implicitly. In this case, Tk_MaintainGeometry just calls directly
+ to Tk_MoveResizeWindow. This allows geometry managers to simply
+ always use Tk_MaintainGeometry to maintain geometry for slaves,
+ and avoid doing the direct descendant check themselves.
+ (Tk_UnmaintainGeometry): Added a matching check for the direct
+ descendant case; in this case, Tk_UnmaintainGeometry simply
+ returns immediately.
+
+2000-10-01 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkButton.c (ConfigureButton): Added tests for -compound
+ option, so that when there is a textvariable and an image, and
+ -compound is not none, the button will display both the
+ textvariable and the image.
+
+ * doc/SetOptions.3: Added note that restoreProc and freeProc may
+ be NULL.
+
+ * generic/tkConfig.c (Tk_RestoreSavedOptions): For custom options,
+ added test that the restoreProc is not NULL, to allow for custom
+ options that don't care about supporting Tk_RestoreSavedOptions.
+
+2000-09-29 D. Richard Hipp <drh@hwaci.com>
+
+ * generic/tkBitmap.c: Changes to prevent a BadMatch error from the
+ Xserver when the same bitmap is used on two or more screens of the
+ same display.
+
+ * tests/menu.test: Print a warning if the TK_ALT_DISPLAY environment
+ variable is not configured so as to test for the bug fix above.
+
+ * library/tk.tcl (::tk::SetGrabFocus): "Catch" the grab in case
+ another application already holds the grab and the "grab" command
+ fails.
+
+2000-09-29 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/Makefile.in: commented use of TESTFLAGS
+ * unix/Makefile.in: added TESTFLAGS to test and testlang targets to
+ conform with Windows makefile and TEA style.
+
+2000-09-29 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkTest.c: Fixed tests to use updated API.
+
+ * doc/SetOptions.3:
+ * generic/tk.h:
+ * generic/tkConfig.c: Changed interface for Tk_CustomOptionSetProc
+ and Tk_CustomOptionGetProc; these now take a pointer to the start
+ of the widget record, and an integer offset to the slot for the
+ option value, instead of just a pointer to the slot. This allows
+ more sophisticated options to do interesting things based on other
+ data in the widget record.
+
+2000-09-17 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tk.h: Added declaration of Tk_ObjCustomOption structure,
+ used for TK_OPTION_CUSTOM, and typedef's of the functions
+ Tk_CustomOptionSetProc, Tk_CustomOptionGetProc,
+ Tk_CustomOptionRestoreProc, and Tk_CustomOptionFreeProc, used for
+ TK_OPTION_CUSTOM.
+
+ * doc/SetOptions.3: Added documentation of TK_OPTION_CUSTOM, and
+ section "CUSTOM OPTION TYPES" explaining how to create and use
+ custom options.
+
+ * tests/config.test: Added tests for custom option type.
+
+ * generic/tkTest.c: Added test support for TK_OPTION_CUSTOM to
+ TestobjconfigObjCmd. Added CustomOption* functions to implement a
+ test custom option.
+
+ * generic/tkConfig.c: Added new option type TK_OPTION_CUSTOM,
+ which allows the definition of custom option types by creating
+ parsing, printing, freeing, and restoring procedures for a custom
+ option. This is needed by the text and canvas widgets if they are
+ to be fully objectified.
+
+2000-09-07 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/Tk_Init.3:
+ * doc/bell.n:
+ * doc/loadTk.n: minor doc cleanup
+
+2000-09-06 Eric Melski <ericm@ajubasolutions.com>
+
+ * doc/HWNDToWindow.3:
+ * doc/GetHWND.3: Changed synopsis to indicate the tkPlatDecls.h
+ should be included, not tk.h.
+
+ * generic/tkPlatDecls.h: Removed #include <windows.h> for Windows,
+ a better solution for now is to update the docs and have extension
+ authors #include <tkPlatDecls.h>.
+
+ * generic/tk.h: Removed '#include "tkPlatDecls.h"', as the
+ incorrect inclusion order between windows.h/tkPlatDecls.h causes
+ build conflicts on Windows.
+
+ * generic/tkPlatDecls.h: Added #include <windows.h> for Windows,
+ so that HWND, etc., are defined properly.
+
+2000-09-06 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/canvas.n: fixed doc bug (ellson). [Bug: 6218]
+
+ * README:
+ * generic/tk.h:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in: updated to patchlevel 8.4a2
+
+ * generic/tkMessage.c (MessageWidgetObjCmd): initialized result to
+ avoid pedantic warning.
+
+ * generic/tkGrab.c (Tk_GrabObjCmd): changed len arg from size_t to
+ int to fix pedantic warning.
+
+2000-09-01 Eric Melski <ericm@ajubasolutions.com>
+
+ * win/makefile.vc (install-libraries):
+ * win/Makefile.in (install-libraries):
+ * unix/Makefile.in (install-libraries): Added tkPlatDecls.h to
+ list of header files to install.
+
+ * generic/tk.h: Added #include "tkPlatDecls.h", which declares the
+ platform specific component of the public Tk stubs API's.
+
+2000-08-29 Eric Melski <ericm@ajubasolutions.com>
+
+ * win/tkWinMenu.c (DrawWindowsSystemBitmap): Use scratchDC
+ for determining the source's logical coordinates. Patch from
+ [Bug: 6134 (Markus Oberhumer)].
+
+ * win/tkWinMenu.c (SetDefaults): Compute the indicatorDimensions[]
+ under Windows NT/2000 in the same way as under Windows 95/98.
+ Patch from [Bug: 6134 (Markus Oberhumer)].
+
+ * win/tkWinFont.c (GetScreenFont): Added a memset() to
+ pacify memory checkers. Patch from [Bug: 6134 (Markus Oberhumer)].
+
+ * library/tkfbox.tcl (::tk::dialog::file::Update): Corrected
+ handling of multi-pattern filters (eg, "* *.*"), which was broken
+ by the getOpenFile performance patches applied earlier.
+
+2000-08-24 Eric Melski <ericm@ajubasolutions.com>
+
+ * doc/toplevel.n:
+ * doc/spinbox.n:
+ * doc/scrollbar.n:
+ * doc/scale.n:
+ * doc/menubutton.n:
+ * doc/menu.n:
+ * doc/listbox.n:
+ * doc/entry.n:
+ * doc/frame.n:
+ * doc/message.n:
+ * doc/checkbutton.n:
+ * doc/radiobutton.n:
+ * doc/button.n:
+ * doc/label.n:
+ * doc/canvas.n:
+ * doc/text.n: Fixed Standard Options section to make best use of
+ new tab settings in man.macros.
+
+2000-08-24 Mo DeJong <mdejong@redhat.com>
+
+ * unix/README: Update to account for removal of --enable-gcc.
+ * unix/configure.in:
+ * unix/tcl.m4 (SC_ENABLE_GCC): Remove --enable-gcc option.
+ * win/configure.in:
+ * win/tcl.m4 (SC_ENABLE_GCC): Remove --enable-gcc option.
+ Remove quick hack that provided cross compile support for
+ windows builds.
+
+2000-08-23 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkButton.c (ButtonTextVarProc): reversed change below,
+ it was not correct.
+
+2000-08-22 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkButton.c (ButtonTextVarProc): changed order of
+ incr/decr of new value object, in case they are equal.
+
+2000-08-18 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkImgPhoto.c (ImgPhotoGet): Removed redundant call to
+ DitherInstance; this call was formerly being made from
+ ImgPhotoGet->ImgPhotoConfigureInstance->DitherInstance, and
+ ImgPhotoGet->DitherInstance. The second call was removed.
+
+2000-08-10 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/SetOptions.3: added missing ')'.
+
+2000-08-09 Eric Melski <ericm@ajubasolutions.com>
+
+ * doc/SetOptions.3: Updated documentation to reflect support for
+ TK_OPTION_NULL_OK for TK_OPTION_DOUBLE and TK_OPTION_PIXELS.
+
+ * generic/tkConfig.c: Added for TK_OPTION_NULL_OK support for
+ TK_OPTION_DOUBLE and TK_OPTION_PIXELS.
+
+ * doc/place.n: Updated, reformatted manual entry.
+
+ * tests/place.test: Added many tests.
+
+ * generic/tkPlace.c (Tk_PlaceObjCmd): Updated to use Tk
+ widget-option management facilities to manage place options (-x,
+ -y, etc.), which simplifies the placer code. Added support for
+ [place configure pathName] and [place configure pathName -option],
+ similar to the behavior of the configure subcommand supported by
+ widgets.
+
+2000-08-08 Eric Melski <ericm@ajubasolutions.com>
+
+ * tests/place.test: Extended test suite to test error returns from
+ [place].
+
+ * generic/tkInt.h: Replaced Tk_PlaceCmd prototype with
+ Tk_PlaceObjCmd prototype.
+
+ * generic/tkWindow.c: Updated [place] command entry to use new
+ Tcl_Obj interface.
+
+ * generic/tkPlace.c (Tk_PlaceObjCmd): Tcl_Obj'ified [place] command.
+
+2000-08-07 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkWindow.c: Updated [selection] command entry to use
+ new Tcl_Obj interface.
+
+ * generic/tkInt.h: Replaced Tk_SelectionCmd prototype with
+ Tk_SelectionObjCmd prototype.
+
+ * tests/select.test: Updated test suite to recognize standardized
+ error messages.
+
+ * generic/tkSelect.c (Tk_SelectionObjCmd): Tcl_Obj'ified
+ [selection] command.
+
+2000-08-07 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/cursors.n: changed .SS to more compatible macros.
+
+2000-08-05 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/safetk.tcl: rationalized the setting of tk_library when
+ initialized Tk in a safe interpreter.
+
+2000-08-03 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkWindow.c: Updated "grab" command entry to use
+ Tcl_Obj'ified command.
+
+ * generic/tkInt.h: Replaced Tk_GrabCmd prototype with
+ Tk_GrabObjCmd prototype.
+
+ * tests/grab.test: Initial suite of tests for [grab] command.
+
+ * generic/tkGrab.c (Tk_GrabObjCmd): Tcl_Obj'ified [grab] command.
+
+ * generic/tkInt.h: Removed Tk_AfterCmd function prototype; the
+ function does not exist (since 4.0p3). Cleaned up some line
+ wrapping.
+
+ * generic/tk.h: Removed "#define Tk_AfterCmd Tcl_AfterCmd";
+ nothing in the core uses Tk_AfterCmd, and Tcl_AfterCmd doesn't exist
+ anymore anyway.
+
+ * generic/tkInt.h: Replace Tk_BindCmd prototype with
+ Tk_BindObjCmd prototype.
+
+ * generic/tkWindow.c: Updated "bind" command entry to use
+ Tcl_Obj'ified command.
+
+ * generic/tkCmds.c (Tk_BindObjCmd): Tcl_Obj'ified [bind] command.
+
+ * tests/bind.test: Tweaked expected error messages for [bindtags]
+ to comply with updated error messages.
+
+ * generic/tkMenu.c (CloneMenu): Replaced calls to Tk_BindtagsCmd
+ with equivalent calls to Tk_BindtagsObjCmd.
+
+ * generic/tkInt.h: Replace Tk_BindtagsCmd prototype with
+ Tk_BindtagsObjCmd prototype.
+
+ * generic/tkWindow.c: Updated "bindtags" command entry to use
+ Tcl_Obj'ified command.
+
+ * generic/tkCmds.c (Tk_BindtagsObjCmd): Tcl_Obj'ified [bindtags]
+ command.
+
+2000-08-02 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkCmds.c (Tk_TkwaitObjCmd): Tcl_Obj'ified [tkwait] command.
+
+ * generic/tkWindow.c: Updated "tkwait" command entry to use
+ Tcl_Obj'ified command.
+
+ * generic/tkInt.h: Replace Tk_TkwaitCmd prototype with
+ Tk_TkwaitObjCmd prototype.
+
+ * generic/tkGrid.c (Tk_GridCmd): Split [grid] subcommands into
+ separate functions instead of inlining them all in Tk_GridCmd.
+
+2000-08-01 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkInt.h: Replaced prototype for Tk_MessageCmd with
+ prototype for Tk_MessageObjCmd.
+
+ * generic/tkWindow.c: Marked message command as using the new
+ MessageObjCmd instead of the old MessageCmd.
+
+ * tests/message.test: Added tests for the message widget.
+
+ * generic/tkMessage.c: Obj'ified the message widget.
+
+ * generic/tkInt.h: Removed prototype for Tk_ClipboardCmd, added
+ prototype for Tk_ClipboardObjCmd.
+
+ * generic/tkWindow.c: Updated function pointers for clipboard
+ command to use Tcl_Obj version.
+
+ * tests/clipboard.test: Updated tests to expect standard error
+ messages.
+
+ * generic/tkClipboard.c (Tk_ClipboardObjCmd): Obj'ified
+ Tk_ClipboardCmd -> Tk_ClipboardObjCmd.
+
+2000-07-28 Eric Melski <ericm@ajubasolutions.com>
+
+ * unix/tkUnixButton.c (TkpDisplayButton): Added bits to change
+ the indicator color when radio-/check-buttons are disabled. This
+ reduces the visual incongruity when a group of these controls are
+ disabled together.
+
+ * win/tkWinMenu.c (ReconfigureWindowsMenu): Added MF_GRAYED bit
+ for disabled menu entries, to ensure that those which are drawn by
+ the system are shown grayed (such as entries on menubars) [Bug: 4372].
+
+ * doc/label.n: Added -disabledforeground to list of options [Bug:
+ 6053].
+
+ * mac/tkMacDefault.h:
+ * unix/tkUnixDefault.h: Added default values for listbox
+ disabledforeground and state.
+
+ * win/tkWinDefault.h: Changed default listbox background color to
+ white and listbox selection borderwidth to 0, in keeping with the
+ "Microsoft Windows User Experience"; added default values for
+ listbox disabledforeground and listbox state.
+
+ * doc/listbox.n: Added documentation for -state option.
+
+ * generic/tkListbox.c: Added support for -state to listbox. [RFE:
+ 6052].
+
+ * tests/listbox.test: Tests for listbox disabled state.
+
+2000-07-27 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure.in: TCL_STUB_LIB_FLAG and
+ TK_STUB_LIB_FLAG should not include ${TCL_DBGX}
+ in win/tkConfig.sh, fix that.
+
+2000-07-25 Joe English <jenglish@flightlab.com>
+
+ * doc: CanvPsY.3, ConfigWidg.3, CrtImgType.3, CrtItemType.3,
+ FontId.3, GetFont.3, canvas.n, font.n, options.n, text.n:
+ Documentation fix: Replaced references to XFontStruct *
+ and Tk_FontStruct with Tk_Font.
+
+2000-07-24 Eric Melski <ericm@ajubasolutions.com>
+
+ * tests/text.test: Added tests for -regexp -nocase searches with
+ backslash character classes.
+
+ * generic/tkText.c (TextSearchCmd): Text search did not work
+ properly when -regexp and -nocase were used, in combination with
+ backslash character classes represented by capital letters (ie,
+ \W, \M); altered implementation of -regexp -nocase searches to use
+ new regexp interfaces to fix this problem. [Bug: 5988].
+
+2000-07-21 Eric Melski <ericm@ajubasolutions.com>
+
+ * tests/text.test: Added tests for searching when text is elided.
+
+ * generic/tkText.c (TextSearchCmd): Text search was not returning
+ the correct index when the search covered (but did not search)
+ elided characters; corrected this by adjusting the match index by
+ the number of elided characters preceeding the start of the match,
+ just as is done with embedded windows, etc. [Bug: 5470].
+
+2000-07-21 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure.in: Add TK_STUB_LIB_FLAG and
+ TK_BUILD_STUB_LIB_SPEC. These are needed to build a stub enabled
+ extension.
+
+2000-07-20 Eric Melski <ericm@ajubasolutions.com>
+
+ * unix/tkUnixDraw.c (TkScrollWindow): Replaced a use of a trinary
+ operator with an if/else, to avoid build problems on some
+ platforms [Bug: 5819].
+
+ * win/makefile.vc: Applied patch from Don Porter to enhance nmake
+ support on NT/Alpha [RFE: 5939].
+
+2000-07-19 Eric Melski <ericm@ajubasolutions.com>
+
+ * library/text.tcl: Enhanced <Tab> binding to behave like normal
+ <Tab> bindings when the text widget is disabled (ie, it advances
+ focus to the next widget).
+
+ * generic/tkText.c (TextSearchCmd): Added a test for a NULL
+ segment pointer when doing backwards searches for "" on an empty
+ text widget. [Bug: 6007].
+
+2000-07-18 Mo DeJong <mdejong@redhat.com>
+
+ * unix/aclocal.m4: Use tcl.m4.
+
+ * unix/configure.in: Properly quote LOCALES variable. Properly quote
+ argument to m4 macro.
+
+ * unix/tcl.m4: Add updated file from tcl.
+
+ * win/tcl.m4: Updated file from tcl.
+
+2000-07-18 Eric Melski <ericm@ajubasolutions.com>
+
+ * library/tkfbox.tcl: Fixed keyboard navigation in the iconlist.
+
+ * unix/configure.in (MAKE_LIB): Corrected definition of MAKE_LIB
+ for shared builds, with patch from Mike Hopkirk.
+
+2000-07-18 Mo DeJong <mdejong@redhat.com>
+
+ * win/Makefile.in: Fix TCL_GENERIC_DIR variable
+ so that it uses the TK_SRC_DIR in the same way
+ as the unix version.
+
+2000-07-17 David Gravereaux <davygrvy@ajubasolutions.com>
+
+ * generic/tkConsole.c: Added comments for a Win2K OS bug with
+ GetStdHandle(STD_OUTPUT_HANDLE). No change was done to the code
+ as the resulting behaviour of ShouldUseConsoleChannel() was
+ correct, anyways. [BUG: 5971]
+
+2000-07-17 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkStubImg.c (Tk_InitImageArgs): Applied patch from [Bug:
+ 5990], from Anselm Lingnau, which correctly sets the value of
+ useNewImage to 0 when the new image system is not to be used,
+ instead of leaving it at -1, which causes the check to be
+ performed more times than is really necessary.
+
+ * library/bgerror.tcl: Fixed a typo in one of the bgerror dialog
+ label.
+
+ * library/msgs/it.msg: Italian message catalog, from Paolo
+ Brutti. [RFE: 6012].
+
+2000-07-07 Eric Melski <ericm@ajubasolutions.com>
+
+ * library/msgs/el.msg: Greek message catalog, from George Petasis.
+
+2000-07-07 Mo DeJong <mdejong@redhat.com>
+
+ * win/configure.in: Fix subst of TK_SHARED_BUILD
+ variable in tkConfig.sh.in. Fix definition of
+ TK_SRC_DIR variable so that it matches the
+ unix version.
+
+2000-07-05 Mo DeJong <mdejong@redhat.com>
+
+ * generic/tkFileFilter.c (AddClause): Cast to match function prototype.
+ * win/stubs.c (_XInitImageFuncPtrs): Add return value for function.
+ * win/tkWinButton.c (buttonStyles, ButtonBindProc, ComputeStyle):
+ Remove unused declarations.
+ * win/tkWinColor.c (GetColorByName, GetColorByValue): Remove unused
+ function declarations.
+ * win/tkWinDialog.c (TrySetDirectory): Remove unused function
+ declaration.
+ * win/tkWinEmbed.c (TkWinEmbeddedEventProc): Cast to match function
+ prototype.
+ * win/tkWinMenu.c (winMenuMutex, MenuExitProc): Remove unused
+ declaration.
+ * win/tkWinWindow.c (StackWindow): Remove unused declaration.
+ * win/tkWinWm.c (ConfigureEvent): Remove unused declaration.
+ * win/tkWinX.c (winXMutex): Remove unused declaration.
+ * xlib/ximage.c (XCreateBitmapFromData): Cast to match function
+ prototype.
+
+2000-07-05 Eric Melski <ericm@ajubasolutions.com>
+
+ * tests/imgPhoto.test: Added test for GIF writing code [Bug: 5823].
+
+ * generic/tkImgGIF.c: Applied patch from Jan Nijtmans to fix a
+ problem with the GIF writing code [Bug: 5823].
+
+ * generic/tkCursor.c: Added initialization for nextPtr field of
+ TkCursor, patch from Nijtmans/Howlett.
+
+2000-07-05 Eric Melski <ericm@ajubasolutions.com>
+
+ * library/msgs/nl.msg: Dutch message catalog for dialogs, from Jan
+ Nijtmans.
+
+2000-06-30 Eric Melski <ericm@scriptics.com>
+
+ * doc/keysyms.n:
+ * doc/colors.n: Added extra .CE/.CS pairs to break up the large
+ text block, so that the generated Windows help file could
+ accomodate the manual entry. [Bug: 5862]
+
+ * tests/filebox.test: Adjusted tests to accomodate -multiple.
+
+ * library/xmfbox.tcl: Adjusted arguments list construction such
+ that -multiple is not presented as an option for tk_getSaveFile.
+
+ * library/tk.tcl: Added test for safe interpreter status before
+ attempting to load message catalogs (which is impossible in a
+ standard safe interpreter). This means that SafeTk will not have
+ localized dialogs, unless a means is found for loading the message
+ catalog files.
+
+2000-06-29 Eric Melski <ericm@scriptics.com>
+
+ * library/msgs/de.msg: German message catalog.
+
+ * library/msgs/en.msg: English message catalog.
+
+ * library/msgs/es.msg: Spanish message catalog.
+
+ * library/msgs/fr.msg: French message catalog.
+
+ * unix/Makefile.in:
+ * unix/configure.in:
+ * library/tk.tcl:
+ * library/clrpick.tcl:
+ * library/choosedir.tcl:
+ * library/console.tcl:
+ * library/msgbox.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl:
+ * library/bgerror.tcl: Applied patches from Laurent Duperval to
+ provide localization of Tk dialogs. [RFE: 2671].
+
+2000-06-27 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkMenu.c (DeleteMenuCloneEntries): Applied fix from
+ [Bug: 5275], which corrected a segfault-causing indexing problem
+ when deleting entries from torn-off menus.
+
+2000-06-22 Eric Melski <ericm@ajubasolutions.com>
+
+ * doc/getOpenFile.n: Updated with information about -multiple.
+
+ * library/choosedir.tcl: Tweaked to handle modified tkIconList API's.
+
+ * library/tkfbox.tcl: Preliminary implementation of multiple
+ selection; based on patch from [RFE: 604]. Some of the tkIconList
+ functions changed to support this and to make the dialog faster.
+
+ * library/xmfbox.tcl: Added support for multiple selection, from
+ patch in [RFE: 4999].
+
+2000-06-21 Eric Melski <ericm@scriptics.com>
+
+ * library/text.tcl: Corrected behavior of text widget with respect
+ to this sequence of events: click, shift-click. Previously, the
+ shift-click just moved the cursor and anchor; now, the shift-click
+ will select the text between the click and the shift-click, which
+ is the behavior most users expect. [Bug: 5929].
+
+2000-06-19 Eric Melski <ericm@scriptics.com>
+
+ * library/bgerror.tcl: Added auto-truncation for long error
+ messages (more than 30 characters wide, or more than 4 lines
+ long), so that the dialog remains a manageable size. [RFE: 5782]
+
+2000-06-15 Eric Melski <ericm@scriptics.com>
+
+ * win/tkWinDialog.c: Patched to support tk_getOpenFile
+ -multiple. [RFE: 604].
+
+2000-06-13 Eric Melski <ericm@scriptics.com>
+
+ * win/aclocal.m4:
+ * win/configure.in:
+ * win/Makefile.in: Applied patch from [RFE: 5844], to provide
+ support for the mingw compile environment for Windows.
+
+2000-06-06 Jeff Hobbs <hobbs@scriptics.com>
+
+ 8.4a1 RELEASE
+
+2000-06-03 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/CrtCmHdlr.3: new doc for ClientMessage handler procs
+ * generic/tk.h: added typdef for Tk_ClientMessageProc
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h:
+ * generic/tk.decls: Added Tk_CreateClientMessageHandler and
+ Tk_DeleteClientMessageHandler declarations.
+ * generic/tkEvent.c (Tk_HandleEvent): Added
+ Tk_CreateClientMessageHandler and Tk_DeleteClientMessageHandler to
+ allow adding event handlers that invoke for ClientMessage events.
+ This is necessary to support unix dnd protocols.
+
+2000-06-02 Jeff Hobbs <hobbs@scriptics.com>
+
+ * canvas.test: added test for 5783.
+ * generic/tkCanvPoly.c (DisplayPolygon): added checks for the
+ polygon fillGC not being empty to prevent segfault. [Bug: 5783]
+
+2000-05-31 Eric Melski <ericm@scriptics.com>
+
+ * library/bgerror.tcl: Improved bgerror based on work by Donal
+ K. Fellows; no longer dependant on tk_dialog; features a
+ Windows-esque "Details" button, and a customizable extra function
+ button that allows the user to (for example) save the stack trace
+ to a file.
+
+2000-05-30 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkImgGIF.c: Changed defines for GIF87a/GIF89a to be
+ static char arrays with integer initialization, to address EBCIDIC
+ vs. ASCII encoding issues and to handle compilers that don't deal
+ with "\xAB" syntax for specifying hex values in strings.
+
+2000-05-28 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/spinbox.n: (new file) docs for spinbox widget
+ * generic/tkInt.h: added Tk_SpinboxObjCmd declaration
+ * generic/tkEntry.c: added 'spinbox' widget - an extension of the
+ entry widget type.
+ * generic/tkWindow.c: added 'spinbox' to core Tk commands
+ * library/spinbox.tcl: (new file) binding and helper procs for spinbox
+ * library/tk.tcl: added spinbox.tcl to list of files to source
+ * tests/entry.test: updated changed error messages
+ * tests/spinbox.test: (new file) test suite for spinbox
+
+ * generic/tkPlace.c (Tk_PlaceCmd): reworked place master/slave
+ table init'n to prevent seg fault when using place on multiple
+ displays.
+
+ * generic/tk.h: added comments ot Tk_FakeWin structure
+
+2000-05-26 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkOption.c (Tk_GetOption): Extended Tk_GetOption to
+ support a new syntax for option names in option tables. If the
+ option name has an embedded ".", it indicates that the name field
+ contains both an option name and an overriding widget class, in
+ the form "class.option". The lookup for the option value will be
+ performed as though the widget class is that specified, rather
+ than the actual widget class.
+ (SetupStacks): Replaced several lines of array element copying
+ with a for loop for conciseness.
+
+2000-05-25 Eric Melski <ericm@scriptics.com>
+
+ * library/button.tcl: Tweaks for -overrelief handling on Windows.
+
+ * doc/radiobutton.n: Added documentation for -overrelief option.
+
+ * doc/checkbutton.n: Added documentation for -overrelief option.
+
+ * doc/label.n: Added documentation for -state option.
+
+ * generic/tkButton.c: Added -overrelief option for checkbuttons,
+ and radiobuttons.
+
+ * library/button.tcl (tkButtonDown, macintosh version): Added
+ protection against querying the -repeatdelay option from a widget
+ that doesn't support it (ie, checkbuttons, radiobuttons, etc).
+ Other platforms use a different binding script for checkbuttons
+ and radiobuttons, so they don't have this issue.
+ (tkCheckRadioEnter, windows version): Added code to handle
+ -overrelief for check/radiobuttons on windows.
+
+2000-05-22 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkButton.c: Added -activeforeground, -activebackground
+ for labels, for the -state option.
+
+ * doc/label.n: Added documentation for -state option,
+ -activeforeground, -activebackground.
+
+2000-05-22 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/Makefile.in (install-libraries): corrected to install X
+ headers [Bug: 5516]
+
+ * doc/bind.n:
+ * doc/canvas.n:
+ * doc/entry.n:
+ * doc/listbox.n:
+ * doc/photo.n: doc fix-ups [Bug: 5396]
+
+2000-05-17 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/bell.n:
+ * tests/bell.test:
+ * generic/tkCmds.c (Tk_BellObjCmd): added -nice option to
+ optionally avoid resetting screen saver [Bug: 4279]
+
+2000-05-15 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinWm.c (Tk_WmCmd): changed wm deiconify from using idle
+ callback to calling restack and focus code immediately.
+
+2000-05-17 Eric Melski <ericm@scriptics.com>
+
+ Overall change: Added "-readonlybackground" option for entries,
+ to enable a visual change when state goes to readonly.
+
+ * mac/tkMacDefault.h (DEF_ENTRY_READONLY_BG_COLOR)
+ (DEF_ENTRY_READONLY_BG_COLOR):
+ * win/tkWinDefault.h (DEF_ENTRY_READONLY_BG_COLOR)
+ (DEF_ENTRY_READONLY_BG_COLOR):
+ * unix/tkUnixDefault.h (DEF_ENTRY_READONLY_BG_COLOR)
+ (DEF_ENTRY_READONLY_BG_COLOR): Added default values for entry
+ -readonlybackground option.
+
+ * generic/tkEntry.c: Added -readonlybackground option, cleaned up
+ excessive use of graphics contexts.
+
+ * tests/entry.test: Added configuration test for
+ -readonlybackground option.
+
+ * doc/entry.n: Added documentation for -readonlybackground option.
+
+ Overall change: changed implementation of "link" relief for
+ buttons. Instead of a new relief style (-relief link), there is a
+ new option, -overrelief, which if set is used when the mouse is
+ over the button.
+
+ * doc/SetOptions.3: Added information about TK_OPTION_NULL_OK with
+ TK_OPTION_RELIEF.
+
+ * win/tkWinButton.c: Removed bits about TK_RELIEF_LINK.
+
+ * tests/button.test: Added tests for -overrelief; removed tests
+ for -relief link.
+
+ * mac/tkMacButton.c: Removed bits about TK_RELIEF_LINK.
+
+ * generic/tkOldConfig.c: Removed bits about TK_RELIEF_LINK.
+
+ * generic/tkConfig.c: Removed bits about TK_RELIEF_LINK; added
+ support for TK_OPTION_NULL_OK for TK_OPTION_RELIEF.
+
+ * library/button.tcl: Added binding support for -overrelief.
+
+ * generic/tk3d.c (Tk_GetRelief): Added branch for TK_RELIEF_NULL.
+
+ * generic/tkButton.c: Added -overrelief option; removed
+ Enter/Leave EventProc masks and handlers.
+
+ * generic/tk.h: Added TK_RELIEF_NULL definition, removed
+ TK_RELIEF_LINK.
+
+ * mac/tkMacDefault.h (DEF_BUTTON_OVER_RELIEF):
+ * win/tkWinDefault.h (DEF_BUTTON_OVER_RELIEF):
+ * unix/tkUnixDefault.h (DEF_BUTTON_OVER_RELIEF): Added default
+ value for the -overrelief option.
+
+2000-05-16 Eric Melski <ericm@scriptics.com>
+
+ * win/tkWinMenu.c (ReconfigureWindowsMenu): Added code to add the
+ MF_SEPARATOR bit for SEPARATOR_ENTRY menu items. This causes
+ separator entries on the system menu to be drawn correctly [Bug: 5451].
+
+2000-05-15 Eric Melski <ericm@scriptics.com>
+
+ * doc/image.n: Added documentation for [image inuse] command.
+
+ * tests/image.test: Added tests for [image inuse] command.
+
+ * generic/tkImage.c (Tk_ImageObjCmd): Added [image inuse] command,
+ which provides a means for programmers to determine if a given
+ image is in use by any widgets. [RFE: 3327].
+
+2000-05-14 Eric Melski <ericm@scriptics.com>
+
+ * doc/clipboard.n: Added documentation for "clipboard get".
+
+ * generic/tkClipboard.c (Tk_ClipboardCmd): Added "clipboard get"
+ subcommand [RFE: 4628].
+
+ * tests/clipboard.test: Updated to use "clipboard get" instead of
+ "selection get -s CLIPBOARD".
+
+ * library/entry.tcl: Adjusted Button-1 binding to set focus to the
+ entry when it is readonly or normal.
+
+ * doc/entry.n: Added documentation for readonly state,
+ -disabledforeground, -disabledbackground.
+
+ * tests/entry.test: Added tests for readonly state.
+
+ * generic/tkEntry.c: Added support for "readonly" state, and
+ redefined "disabled" state. A disabled entry will display its
+ text in a dimmed color and possibly with a different background,
+ and will be completely unusable (no selection, no editing). A
+ readonly entry will look like a normal entry, but it will not be
+ editable; selection is still allowed. [RFE: 4239]. To support the
+ new disabled state properly, "-disabledforeground" and
+ "-disabledbackground" options were added.
+ *** THIS IS A BACKWARDS INCOMPATIBLE BEHAVIOR CHANGE ***
+
+ * win/tkWinDefault.h:
+ * mac/tkMacDefault.h:
+ * unix/tkUnixDefault.h: Added DEF_ENTRY_DISABLED_FG,
+ DEF_ENTRY_DISABLED_BG_COLOR, DEF_ENTRY_DISABLED_BG_MONO.
+
+2000-05-12 Eric Melski <ericm@scriptics.com>
+
+ * unix/tkUnixButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
+ * mac/tkMacButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
+ * win/tkWinButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
+ Added code for drawing compound buttons.
+
+ * tests/button.test: Added configuration tests for -repeatdelay,
+ -repeatinterval, -compound.
+
+ * library/button.tcl: Added support for -repeatedelay,
+ -repeatinterval options.
+
+ * generic/tkOldConfig.c: Changed handling of link relief so that
+ proper error messages are used.
+
+ * generic/tkButton.h: Added -compound, -repeatdelay,
+ -repeatinterval options.
+
+ * generic/tkButton.c: Added event watchers for enter/leave events,
+ for link relief support.
+
+ * generic/tk3d.c: Changed handling of link relief so that proper
+ error messages are used.
+
+ * generic/tk.h: Changed values of
+ TK_OPTION_LINK_OK/TK_CONFIG_LINK_OK for link relief support.
+
+2000-05-12 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinFont.c (LoadFontRanges): improved support for all chars
+ in 0-255 range for bitmap ANSI fonts. May be improved to handle
+ bitmap non-ANSI fonts in the future. [Bug: 2172]
+
+ * win/tkWinWm.c (RaiseWinWhenIdle): added TK_DONT_DESTROY_WINDOW
+ to flag check to prevent timing related core dump. [Bug: 5438]
+
+2000-05-11 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinTest.c (TestclipboardObjCmd): ensured CloseClipboard
+ would always get called for each OpenClipboard.
+
+ * tests/focus.test (focusSetupAlt): removed wm withdraw from proc
+ as it would cause a hang for tkwait visibility
+
+ * tests/menu.test:
+ * generic/tk3d.c:
+ * generic/tkColor.c:
+ * generic/tkCursor.c: corrected handling of 3DBorder, Cursor and
+ Color objects on multiple screens. [Bug: 5454]
+
+2000-05-09 Eric Melski <ericm@scriptics.com>
+
+ * doc/button.n: Added documentation for link relief.
+
+ * tests/button.test: Added tests for link relief for buttons.
+
+ * generic/tk.h (TK_CONFIG_LINK_OK): Added definition of
+ TK_RELIEF_LINK, TK_OPTION_LINK_OK and TK_CONFIG_LINK_OK. [RFE: 4348]
+
+ * generic/tk3d.c: Added support for link relief. [RFE: 4348]
+
+ * mac/tkMacButton.c (TkpDisplayButton):
+ * unix/tkUnixButton.c (TkpDisplayButton): Added support for link
+ relief. [RFE: 4348]
+
+ * generic/tkOldConfig.c (Tk_ConfigureWidget):
+ * generic/tkConfig.c (DoObjConfig): Added understanding of link
+ relief, which is allowed only for widgets that have
+ TK_OPTION_LINK_OK or TK_CONFIG_LINK_OK set for the "-relief"
+ option. [RFE: 4348]
+
+ * generic/tkButton.c: Added TK_OPTION_LINK_OK to "-relief" option
+ for buttons. [RFE: 4348]
+
+ * win/tkWinWm.c (EX_TRANSIENT_STYLE): Removed WS_EX_TOOLWINDOW
+ style bit, so that transient windows have full-size titlebars
+ (like the tk_getOpenFile dialog).
+
+ * win/tkWinMenu.c (GetMenuSeparatorGeometry): Tweaked height
+ requested for separator bars to be (linespace - (2*descent))
+ instead of just (linespace); this makes the separator occupy a
+ more correct amount of vertical space. [Bug: 5303].
+
+2000-05-09 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/focus.tcl: fixed calling of takeFocus proc [Bug: 5372]
+
+2000-05-02 Jeff Hobbs <hobbs@scriptics.com>
+
+ * README:
+ * generic/tk.h:
+ * library/tk.tcl:
+ * mac/README:
+ * unix/README:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/README:
+ * win/aclocal.m4:
+ * win/configure.in:
+ * win/makefile.vc: updated patchlevel to 8.4a1
+
+ * unix/Makefile.in: added tk.spec to dist target
+
+2000-04-27 Eric Melski <ericm@scriptics.com>
+
+ * doc/Tk_Init.3: Added Tk_SafeInit information [Bug: 1884].
+
+ * doc/keysyms.n: Man page enumerating keysyms [RFE: 1645].
+
+ * doc/colors.n: Man page enumerating valid color names [RFE: 1645].
+
+ * doc/cursors.n: Man page enumerating valid cursor values [RFE: 1645].
+
+ * library/msgbox.tcl: Corrected Unix tk_messageBox implementation
+ to make the first button the default when no default is specified
+ [Bug: 2218].
+
+ * doc/messageBox.n: Updated documentation with regards to
+ selection of default button when none is specified (now it will
+ use the first button as the default in that case) [Bug: 2218].
+
+2000-04-26 Jeff Hobbs <hobbs@scriptics.com>
+
+ 8.3.1 RELEASE
+
+ * README:
+ * mac/README:
+ * unix/README:
+ * unix/tk.spec:
+ * win/README: Updating URLs to reference dev.scriptics.com
+
+2000-04-25 Jeff Hobbs <hobbs@scriptics.com>
+
+ * unix/Makefile.in:
+ * win/Makefile.in: makefile cleanup
+
+2000-04-25 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkMain.c: Fixed function header comment for Tk_MainEx.
+
+ * unix/mkLinks:
+ * doc/GetScroll.3: Added information about Tk_GetScrollInfoObj
+ [Bug: 1866].
+
+2000-04-24 Eric Melski <ericm@scriptics.com>
+
+ * unix/mkLinks:
+ * doc/Grab.3: Man page for Tk_Grab and Tk_Ungrab [Bug: 1868, 1889]
+
+ * unix/mkLinks:
+ * doc/MainWin.3: Added entry for Tk_GetNumMainWindows [Bug: 1865].
+
+ * unix/mkLinks:
+ * doc/GetHINSTANCE.3: Man page for Tk_GetHINSTANCE [Bug: 1862].
+
+2000-04-24 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkImage.c (Tk_PostscriptImage): added check to create
+ necessary prolog for photos
+ * generic/tkCanvPs.c: added Tk_PostscriptPhoto that outputs PS for
+ photo images
+ * generic/tkImgPhoto.c: new func ImgPhotoPostscript and added that
+ in as ps proc in tkPhotoImageType.
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h:
+ * generic/tk.decls: added Tk_PostscriptPhoto
+
+ * generic/tkConfig.c (DoObjConfig): removed direct setting of
+ interp->result.
+
+ * mac/tkMacWm.c (Tk_WmCmd): initialized gotToplevel in
+ colormapwindows case (bug found by Reasoning, Inc's automated code
+ testing).
+
+2000-04-24 Eric Melski <ericm@scriptics.com>
+
+ * unix/mkLinks:
+ * doc/GetHWND.3: Man page for Tk_GetHWND [Bug: 1863].
+
+ * unix/mkLinks:
+ * doc/HWNDToWindow.3: Man page for Tk_HWNDToWindow [Bug: 1869].
+
+ * unix/mkLinks:
+ * doc/AddOption.3: Man page for Tk_AddOption [Bug: 1854]
+
+2000-04-22 Jim Ingham <jingham@cygnus.com>
+
+ * mac/tkMacDialog.c (Tk_MacGetOpenFile): Add empty bodies for the
+ "-initialfile" and "-defaultextension" options.
+
+ * mac/tkMacDialog.c (NavServicesGetFile): Only cons the result up
+ into a list if multiple is true.
+
+ * mac/tkMacMenus.c (SourceDialog): Use the "tk_getOpenFile"
+ instead of hand-coding the dialog with StandardGetFile. This way
+ we get the Navigation dialogs for free.
+
+ * doc/getOpenFile.n: Document the -multiple and -message flags
+ which are only implemented on the Mac. Also note that the -title
+ works on the Mac with Nav Services installed.
+
+2000-04-19 Eric Melski <ericm@scriptics.com>
+
+ * doc/WinViewable.3:
+ * unix/mkLinks: Removed docs for Tk_IsViewable.
+
+ * win/tkWinDialog.c: Removed calls to Tk_IsViewable.
+
+ * generic/tkUtil.c:
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h:
+ * generic/tkCmds.c:
+ * generic/tk.decls: Removed Tk_IsViewable function (it was not
+ actually needed).
+
+2000-04-19 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/aclocal.m4: made SC_PROG_TCLSH search specifically for
+ tclsh*.exe type files to find an executable.
+
+ * win/Makefile.in: fixed up cleanup, winhelp, cat32 targets
+
+ * library/console.tcl: made console use systemfixed font on Win
+
+ * generic/tkEntry.c: removed unnecessary ENTRY_VALIDATE #define
+
+2000-04-19 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkRectOval.c (ConfigureRectOval): Added checks for valid
+ outline settings before creating of outline GC; this means that it
+ is really possible now to have an oval or rectangle with no
+ outline. [Bug: 5029].
+
+2000-04-19 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/choosedir.tcl (::tk::dialog::file::chooseDir::Config):
+ * library/tkfbox.tcl (::tk::dialog::file::Config): removed the
+ extraneous glob on -initialdir after file isdir already returned 1
+ and moved cd trick into this case as the else already uses [pwd].
+ [Bug: 5181]
+
+ * win/winMain.c: moved extern call out of WinMain func
+
+ * README:
+ * generic/tk.h:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in: bumped to version 8.3.1
+
+ * library/msgbox.tcl (tkMessageBox): changed to use grid in some
+ places, realign icon to anchor nw.
+
+ * mac/tkMacScale.c: reverted tkMacScale.c to 1.5 equivalent (it
+ was accidentally bumped forward).
+
+2000-04-18 Eric Melski <ericm@scriptics.com>
+
+ * win/tkWinPointer.c: Changed Mod2Mask in TkWinGetModifierState to
+ ALT_MASK, to fix some event problems [Bugs: 1160, 5088].
+
+ * win/tkWinX.c: Changed Mod2Mask in GetState to ALT_MASK, to fix
+ some event problems [Bugs: 1160, 5088].
+
+ * generic/tkInt.h: Moved definition of ALT_MASK and META_MASK here
+ so that it would be accessible from other modules than tkBind.c.
+
+ * generic/tkBind.c: Added code in BindEvent to check for ALT_MASK
+ and META_MASK in the event state field, as this field may not be
+ set up with the correct display modifier mask bits if the XEvent
+ structure was created by [event generate] or by the Windows X
+ emulation. [Bugs: 1160, 5088].
+
+2000-04-18 Scott Redman <redman@HILO>
+
+ * win/tk.rc:
+ * win/wish.rc:
+ * win/wish.ico: Modified copyright dates in Windows resource
+ files. Updated the icon for wish.exe.
+
+2000-04-17 Eric Melski <ericm@scriptics.com>
+
+ * win/tkWinDialog.c: Added checks for visibility of parent window
+ before creating MessageBox and ChooseColor dialogs; this prevents
+ the application from locking when the parent is withdrawn and the
+ message box is created. In these cases, the window will be
+ created without a parent.
+
+ * unix/mkLinks: Added WinViewable.3.
+
+ * tests/msgbox.test: Added tests for patch from [Bug: 4997].
+
+ * library/msgbox.tcl:
+ * library/dialog.tcl: Applied patch from [Bug: 4997]; detaches
+ dialog window from parent if parent is not viewable.
+
+ * library/bgerror.tcl: Removed workaround from [Bug: 4370]; this
+ is superceeded by patches to dialog.tcl.
+
+ * generic/tkCmds.c: Changed WinfoObjCmd to use Tk_IsViewable
+ function to determine visibility of windows instead of inlining
+ the code.
+
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h:
+ * generic/tk.decls: Added Tk_IsViewable declaration.
+
+2000-04-17 Eric Melski <ericm@scriptics.com>
+
+ * library/text.tcl: Tweaked double-/triple-click selection;
+ previously, anchor and insert marks were placed in unexpected
+ locations following a double or triple click. Now they are placed
+ logically. Also tweaked the extension of selection via
+ shift-double-clicks so that it no longer selects the contiguous
+ whitespace on the side of the selection opposite the
+ double-click. [RFE: 4253].
+
+ * doc/menu.n: Added note regarding rendering of
+ checkbuttons/radiobuttons in menubars on different platforms --
+ some systems do not draw indicators for check/radiobuttons in
+ menubars.
+
+ * library/menu.tcl: Corrected behavior of
+ checkbuttons/commands/radiobuttons in menubars [Bug: 630].
+
+ * tests/grid.test: Added test for [grid propagate . 0] to not toggle.
+
+ * generic/tkGrid.c: Fixed bogus logic in [grid propagate] that
+ caused [grid propagate . 0] to act as a toggle instead of an
+ absolute set. [Bug: 2286].
+
+2000-04-16 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinColor.c (FindSystemColor): correct calculation of
+ colors when shifting value. [Bug: 4919]
+
+2000-04-16 Jim Ingham <jingham@cygnus.com>
+
+ * mac/tkMacPort.h: protect against strncasecmp already defined -
+ it is in the Pro5 version of MSL.
+
+ * mac/tkMacWindowMgr.c (GenerateKeyEvent): Check for a null tkWin.
+ If the hidden window we use for double-buffering controls manages
+ to percolate to the top (should never happen, but...) this will
+ keep us from crashing.
+
+ * mac/tkMacButton.c (InitSampleControls): Hide the
+ double-buffering window BEHIND the first "." window you can find.
+ This will keep it from ever being the front window, and thus a
+ black hole for events. * mac/tkMacButton.c (ButtonEventProc):
+ Disable the controls when the window is in the background. This
+ is required by the MacOS HIG. This doesn't always get called when
+ it should, it still needs more work.
+
+ * mac/tkMacDialog.c: Pretty substantial rewrite to include
+ Navigation Services support for systems which have it.
+
+2000-04-14 Eric Melski <ericm@scriptics.com>
+
+ * win/tkWinKey.c: Added check for ASCII delete character in
+ KeycodeToKeysym, to fix [Bug: 5090]. See comment in code for more
+ information.
+
+ * generic/ks_names.h: Added Scroll_Lock and Sys_Req definitions.
+
+ * win/tkWinKey.c: Changed implementation of KeycodeToKeysym,
+ et. al., to use a keycode table for lookups; this will result in
+ faster keycode -> keysym translations for non-ASCII keys like
+ Control, Alt, etc.
+
+2000-04-14 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinWm.c (WmProc): added check in WM_MOUSEACTIVATE so we
+ correctly activate native menus when clicking in when we didn't
+ have focus [Bug: 2272]
+
+ * generic/tkCanvas.c (CanvasEventProc:2451): corrected cast
+
+ * generic/tkEntry.c (Tk_EntryObjCmd): adjusted finishing error
+ cases and changed TK_CONFIG_NULL_OK to TK_OPTION_NULL_OK
+
+ * tests/scale.test:
+ * generic/tkScale.c:
+ * generic/tkScale.h:
+ * unix/tkUnixScale.c:
+ * mac/tkMacScale.c: moved (PixelToValue|ValueToPixel|SetScaleValue)
+ to tkScale.c. Caused an associated variable to be immediately set
+ [Bug: 4833]
+
+ * library/scale.tcl (tkScaleActivate): reduced number of scale
+ redisplays by checking current value of state before setting it
+ again. [Bug: 4191]
+
+ * tests/winDialog.test: tk_chooseDirectory seems to get a noop
+ from GetOpenFileName in the static build, hanging some tests.
+ The tests were fixed to timeout (noop cause unknown).
+
+ * unix/aclocal.m4 (SC_ENABLE_THREADS): enhanced the detection of
+ pthread_mutex_init [Bug: 4359] and (SC_CONFIG_CFLAGS) added
+ --enable-64bit-vis switch for Sparc VIS compilation [Bug: 4995]
+
+2000-04-13 Eric Melski <ericm@scriptics.com>
+
+ * win/tkWinKey.c: Added smarts to check whether the left or right
+ Control, Shift, or Alt key was pressed. [Bug: 870].
+
+ * win/tkWinMenu.c: Corrected code that created separator items on
+ menus; originally, it requested that the system be responsible for
+ drawing those items, so it would ignore configuration items like
+ the widget background. Now, we draw the separators ourselves (as
+ we do with every other kind of menu item already). [Bug: 1166].
+
+ * win/tkWin3d.c:
+ * unix/tkUnix3d.c: Applied patch from [RFE: 2501]: adds more
+ sophisticated smarts to TkpGetShadows, so that the highlight of a
+ very bright color is actually distinguishable from the color, and
+ the shadow of a very dark color is similarly distinguishable from
+ the color.
+
+ * generic/tkCanvas.c: Applied patch from [Bug: 4202]; adds a check
+ for NULL tkwin in Tk_CanvasEventuallyRedraw.
+
+2000-04-12 Jeff Hobbs <hobbs@scriptics.com>
+
+ * test/winClipboard.test:
+ * win/tkWinInt.h:
+ * win/tkWinClipboard.c (UpdateClipboard):
+ * win/tkWinX.c (GenerateXEvent): added updatingClipboard tsd and
+ TkWinUpdatingClipboard accessor function to allow us to flag
+ ourselves when we are the ones updating the clipboard. This
+ corrected inability to create our own clipboard types within a Tk
+ application. [Bug: 2338 4318]
+ * win/tkWinTest.c (TestclipboardCmd): improved TestclipboardCmd
+ with better error handling and obj'ification
+
+2000-04-11 Eric Melski <ericm@scriptics.com>
+
+ * msgcat.n: Added docs for new behavior from patch in [Bug: 4158].
+
+ * msgcat.test: Added tests for new behavior from patch in [Bug:
+ 4158].
+
+ * msgcat.tcl: Applied patch from [Bug: 4158], which enables
+ msgcat::mc to search the entire namespace ancestry chain for
+ message translations (ie, first it checks the current namespace,
+ then the parent, then the parent's parent, etc). Also allows the
+ specification of additional args for msgcat::mc; if extra args are
+ given, the [format] command is used to substitute the additional
+ args in the translated message.
+
+ * library/bgerror.tcl: Moved check for withdrawn state after check
+ for tkerror; this was causing problems when tkerror was used.
+
+2000-04-10 Eric Melski <ericm@scriptics.com>
+
+ * library/bgerror.tcl: Added check for withdrawn state of . and
+ unsetting of transient bit for .bgerrorDialog if . is not
+ viewable; this protects against the application hanging on systems
+ like Windows, where transient windows are withdrawn with their
+ parents. [Bug: 4370].
+
+ * tests/event.test: Added test for [event generate $widget
+ <Alt-z>] [Bug: 4611].
+
+ * tests/choosedir.test: Changed "namespace import ::tcltest" to
+ "namespace import -force ::tcltest".
+
+ * win/tkWinKey.c:
+ * unix/tkUnixKey.c:
+ * mac/tkMacKeyboard.c: Changed InitKeymapInfo to
+ TkpInitKeymapInfo. [Bug: 4611].
+
+ * generic/tkStubInit.c:
+ * generic/tkIntDecls.h: Re-gen'd from tkInt.decls.
+
+ * generic/tkInt.decls: Added TkpInitKeymapInfo to list of function
+ decls.
+
+ * generic/tkBind.c (HandleEventGenerate): Added code to initialize
+ keymap info if necessary, and to correctly set modifier bits in
+ XEvent structure create to handle [event generate] calls.
+ Previously, the alt/meta bits were not set correctly, so [event
+ generate $widget <Alt-z>] would always fail. [Bug: 4611]
+
+2000-04-07 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkGrid.c (InitMasterData): fixed uninit'd data in
+ GridMaster struct [Bug: 4387]
+
+ * library/safetk.tcl (disallowTk): made disallowTk work in the
+ simple case.
+
+ * library/comdlg.tcl (tkFocusGroup_In): fixed key navigation
+ problems in dialogs under CDE [Bug: 2960]
+
+ * tests/winDialog.test: removed knownBug constraint from 5.16
+
+ * win/tkWinFont.c (GetScreenFont): corrected adjustment against
+ LC_FACESIZE limitation for NT [Bug: 4931]
+
+ * win/makefile.vc (TKTEST_OBJS):
+ * win/Makefile.in (TKTEST_OBJS): moved tkWinTest.c from normal
+ objs to TKTEST_OBJS where it belonged.
+
+2000-04-03 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkTest.c: fixed incorrect platform inclusion for
+ TkplatformtestInit (it would never get called).
+
+ * unix/Makefile.in (MAN_INSTALL_DIR): patch to accept --mandir
+ correctly [Bug: 4085]
+
+ * library/clrpick.tcl (tkColorDialog_Config): error now thrown
+ when -initialcolor "" specified. [Bug: 4198]
+
+2000-03-31 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/DrawFocHlt.3: doc name correction
+
+ * generic/tkEntry.c: set TK_OPTION_NULL_OK bit on -invcmd option
+ and removed #ifdef ENTRY_VALIDATE expressions
+
+ * library/menu.tcl (tkMenuInvoke): corrected naming of tearoffs
+ [Bug: 4506]
+
+ * library/tkfbox.tcl (tkIconList_Goto): caused browsecmd to be
+ called in tkIconList_Select. This causes the entry to be set
+ properly when using the type-in-name-in-listbox bindings.
+
+ * win/tkWinDialog.c: added unicode-aware open/save file dialogs
+
+ * win/tkWinFont.c (TkpFontPkgInit): move private ref to platformId
+ to TkWinGetPlatformId
+
+ * win/tkWinMenu.c (SetDefaults): moved private use of versionInfo
+ to TkWinGetPlatformId and removed all code for
+ (versionInfo.dwMajorVersion < 4) (== Win32s)
+
+ * win/tkWinX.c:
+ * win/tkWin32Dll.c: moved TkWinGetPlatformId to tkWinX.c
+ * win/tkWinInit.c: added TkWinXInit to TkpInit to ensure that its
+ called for static Windows shells. [Bug: 3647]
+
+ * win/tkWinInt.h:
+ * win/tkWinX.c:
+ * win/tkWinDraw.c (SetUpGraphicsPort):
+ * win/tkWinScrlbr.c (UpdateScrollbar): removed use of tkpIsWin32s
+
+ * win/tkWinInt.h (TkWinDCState struct): added bkmode value
+ * win/tkWinDraw.c (TkWinGetDrawableDC, et al): added support for
+ properly transparent dashed lines on Windows. [Bug: 4617]
+
+2000-03-30 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkImgGIF.c: Fixed some ANSI specific bits to avoid
+ compile problems with non-ANSI compilers (ie, replace const with
+ CONST, etc). [Bug: 4223].
+
+ * unix/configure.in: Applied patch from [Bug: 4237]; ensures that
+ srcdir is fully qualified.
+
+ * unix/Makefile.in: Applied patch from [Bug: 4237]; if tcltest was
+ not compiled, make test/tktest failed. Now it has a rule to build
+ tcltest if it has not been built.
+
+2000-03-28 Eric Melski <ericm@scriptics.com>
+
+ * library/tkfbox.tcl: Moved an overlooked tkFDialog* function in
+ ::tk::dialog::file namespace.
+
+ * tests/unixWm.test: Added tests for memory leak conditions in
+ tkUnixWm.c.
+
+ * tests/canvas.test: Added test for bad configuration options on
+ empty and non-empty canvas.
+
+ * generic/tkCanvas.c: Removed bad code in CANV_CONFIGURE block of
+ CanvasWidgetCmd; this was causing non-empty canvases to improperly
+ handle bad configuration options [Bug: 4456].
+
+2000-03-27 Eric Melski <ericm@scriptics.com>
+
+ * unix/tkUnixWm.c: Applied patch from [Bug: 4405]; fixes memory
+ leak in Unix wm command.
+
+2000-03-24 Eric Melski <ericm@scriptics.com>
+
+ * tests/filebox.test:
+ * tests/choosedir.test: Updated tests.
+
+ * library/xmfbox.tcl: Updated to stash data array in
+ ::tk::dialog::file namespace instead of in global namespace.
+
+ * library/tkfbox.tcl: Extended some functions to support creation
+ of a choosedir dialog, to allow greater code reuse between the two
+ dialogs. Moved tkFDialog* functions into a namespace
+ (::tk::dialog::file). Because these are private Tk functions (and
+ should thus not be used directly by users), this should not impact
+ anybody (the tk_getOpenFile and tk_getSaveFile commands still
+ exist at the global scope).
+
+ * library/tk.tcl:
+ * library/tclIndex: Updated function names for tkFDialog*
+ functions and choosedir functions.
+
+ * library/choosedir.tcl: New and improved implementation of
+ tk_chooseDirectory dialog. Based on tk_getOpenFile dialog.
+
+2000-03-23 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkWindow.c:
+ * generic/tkInt.h: Updated Tcl_OptionCmd -> Tcl_OptionObjCmd
+
+ * generic/tkOption.c: Tcl_Obj'ectified the "option" command.
+
+2000-03-22 Eric Melski <ericm@scriptics.com>
+
+ * library/listbox.tcl (tkListboxCancel): Added a check for empty
+ string value for tkPriv(listboxPrev). Without this check, it's
+ possible to get a stack trace under certain conditions. [Bug: 4373].
+
+2000-03-15 Sven Delmas <sven@scriptics.com>
+
+ * win/tkWinDialog.c: Changed the behavior for the
+ tk_chooseDirectory dialog under Windows. Instead of trying to
+ return the currently selected listbox entry (which didn't work in
+ case the user selected the initial directory anyway), we now
+ return the value shown in the entry. This seems to be in
+ accordance with the expected behavior for this dialog.
+
+2000-03-14 Eric Melski <ericm@scriptics.com>
+
+ * tests/choosedir.test: Marked test 3.1 and 3.2 as bad until the
+ issue with those tests on IRIX can be determined.
+
+2000-03-10 Eric Melski <ericm@scriptics.com>
+
+ * library/menu.tcl: Applied patch from [Bug: 4155]; protects
+ against grabs on non-viewable windows.
+
+2000-03-08 Eric Melski <ericm@scriptics.com>
+
+ * tests/choosedir.test: Modified test 3.1 (-mustexist works) to be
+ more careful about cleaning up its potentially troublesome after
+ events.
+
+2000-03-07 Eric Melski <ericm@scriptics.com>
+
+ * tests/button.test:
+ * generic/tkButton.c: Added -disabledforeground/-state to labels.
+
+2000-03-07 Jeff Hobbs <hobbs@scriptics.com>
+
+ * tests/entry.test:
+ * generic/tkEntry.c (EntrySetValue): malloc the value when
+ validating because validation could cause the pointer to become
+ invalid. Also fixed configure to not trigger focus-based
+ validation. Improved use of Tcl_WrongNumArgs. [Bug: 4320]
+
+2000-03-06 Eric Melski <ericm@scriptics.com>
+
+ * library/menu.tcl: Added a check in tkMenuFirstEntry that changes
+ menu behavior to only auto-post an immediate child cascade if we
+ are currently on a menubar menu. This prevents massive
+ auto-cascading in cases where the first entry of the cascade is
+ itself a cascade, and the first entry of that cascade is a
+ cascade, and the first entry of that cascade is a cascade
+ ... [Bug: 676].
+
+ * generic/tkOldConfig.c: Added check for NULL tkwin value in
+ Tk_ConfigureWidget [Bug: 4079]
+
+ * generic/tkWindow.c: Added check for NULL tkwin value in
+ Tk_NameToWindow [Bug: 4079]
+
+2000-03-02 Jeff Hobbs <hobbs@scriptics.com>
+
+ * tests/color.test:
+ * xlib/xcolors.c (XParseColor FindColor):
+ * win/tkWinColor.c (XAllocColor): Fixed bit fiddling for colors to
+ return "correct" values for color mapping. [Bug: 4282]
+
+ * unix/Makefile.in (SCRIPT_INSTALL_DIR): removed extraneous '/'
+ * unix/aclocal.m4: corrected TCL_NEEDS_EXP_FILE to be 1 for AIX
+
+ * win/tkWinInt.h: change extern to EXTERN for TkWinChildProc
+ declaration with extra #defs. [Bug: 4240]
+
+ * library/focus.tcl: fixed tkFocusOK to protect $w in
+ uplevel with list. [Bug: 4208]
+
+ * doc/CrtItemType.3: fixed docs for Tk_CreateItemType to reflect
+ changes made in 8.3.0 (but old style would still work as well).
+ [Bug: 4252]
+
+ * tests/config.test: extra test to check object cleanup when
+ destroying the widget
+ * generic/tkListbox.c (DestroyListbox): fixed crash in
+ DestroyListbox due to null tkwin. [Bug: 4207]
+
+ * tests/entry.test: added test suite for entry validation
+ * doc/entry.n: improved docs discussing caveats and gotchas when
+ mixing textvar with widget validation
+ * generic/tkEntry.c (EntryValidateChange): improved handling of
+ validation with relation to -textvariable. Previously, it would
+ turn off whenever the textvar was set. Now it will it will turn
+ off only when the textvar is set and validation returns 0. Added
+ %V (type of validation occuring) to %-subs to help work with
+ trickier validation.
+
+2000-03-01 Eric Melski <ericm@scriptics.com>
+
+ * tests/clrpick.test:
+ * library/clrpick.tcl: Added code to make color chooser dialog
+ inherit screen setting from parent (bug #2334)
+
+2000-02-25 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinWm.c (RaiseWinWhenIdle): Checked for the possibility
+ that the window could be destroyed (can occur with
+ wm deiconify .toplevel; destroy .toplevel).
+
+2000-02-25 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkImgGIF.c: Applied "spirit of" the patch in 1605 (the
+ submitted patch was more complicated than necessary and did not
+ extend to writing GIF's, only reading), to allow reading/writing
+ of GIF files on EBCDIC and other non-ASCII based systems.
+
+2000-02-14 Eric Melski <ericm@scriptics.com>
+
+ * unix/tk.spec: RPM specification for producing a binary Tk RPM
+ for Linux.
+
+ * unix/Makefile.in: Added rpm target to generate Tk
+ binary RPM.
+
+2000-02-10 Jeff Hobbs <hobbs@scriptics.com>
+
+ 8.3.0 RELEASE
+
+ * changes: updated for 8.3.0 release
+
+ * generic/tkImgGIF.c (FileReadGIF): added cast for trashBuffer
+
+ * generic/tkIntXlibDecls.h:
+ * generic/tkInt.decls: declared some Xlib emulation calls for
+ the Mac
+
+ * generic/tkFrame.c (TkInstallFrameMenu): added extra panic to
+ inform user of bad call when framePtr is NULL [Bug: 2530]
+
+ * generic/tkMenu.c (DestroyMenuInstance): Placed checks around
+ menu name objects before trying to incr the ref. [Bug: 3402]
+
+ * generic/tkTest.c: removed USE_OLD_IMAGE def for Mac
+
+ * library/listbox.tcl:
+ * library/text.tcl: added support for <4> and <5> for mousewheel
+ style scrolling on Unix for mice that map to these buttons.
+
+ * tests/scrollbar.test: fixed check of testmetrics command to
+ allow unix tests to run (testmetrics is mac/pc only)
+
+ * unix/tkUnixWm.c (Tk_CoordsToWindow): qualified delete of error
+ handler as the goto label is reached from above and below.
+
+ * unix/configure.in:
+ * unix/aclocal.m4: cleaned up macros to coincide with tcl.m4,
+ added -export-dynamic to LDFLAGS for FreeBSD-3+ [Bug: 2998]
+
+ * unix/README:
+ * unix/Makefile.in (dist): removed porting.notes and porting.old
+ from distribution and CVS. The information was very outdated. Now
+ refer to http://dev.scriptics.com/services/support/platforms.html
+
+ * xlib/xgc.c: #def'd out XDrawSegments for the Mac, and added
+ some extra include info for the Mac
+
+2000-02-09 Jim Ingham <jingham@cygnus.com>
+
+ * mac/tkMacButton.c: Stop removing the appearance window from the
+ Window List. It is not clear why Ray did this, and it causes the
+ Appearance manager to crash at random times.
+
+ * mac/tkMacWM.c: Add support in unsupported1 style for the Appearance
+ specification of window styles, including floating window support.
+ * mac/tkMacWindowMgr.c: Operate on the front non-floating window,
+ unless the mouse is directly over the floating window. Also,
+ keystrokes go to the front non-floating window.
+ * mac/tkMacAppInit.c: Initialize floating window support.
+ * mac/tkMacScrlbr.c:
+ * mac/tkMacmenu.c: Fixes for floating windows - operate on the
+ FrontNonFloatingWindow.
+ * mac/tkMacLibrary.r: Fix typo in File info string.
+ * mac/tkMacApplication.r: Fix typo in file info string. Add
+ Finder balloon help for no apparent reason.
+
+ * mac/tkMacSubwindows.c: Change panic in tkMacGetDrawablePort to
+ Debugger. This is only a temporary fix. The panic is only
+ triggered when a safeTk interpreter is torn down, and ignoring it
+ does no harm. I haven't figured out how to avoid it yet, however.
+ Also use the Appearance MoveWindowStructure call when available.
+
+ New Files:
+ * MW_TkOldImageHeader.h: Handle #defining USE_OLD_IMAGE for tkImgPPM.c.
+ * MW_TkTestHeader.h:
+ * MW_TkTestHeader.pch:
+ * MW_TkHeader.h: Add separate prefix files for test & release
+ versions of Tk, so we can just have separate targets w/o having to
+ edit files.
+
+ * tclets.r: The D&D Tclets icon in rez form so we can have a
+ target for this.
+
+ The above are curtesy of Daniel Steffen (steffen@math.mq.edu.au)
+
+ * tkMacAppearanceStubs.c: Stubs of the Mac Appearance calls I use
+ so I can link the static 68K Shell without putting ifdef's all
+ over the code.
+
+2000-02-08 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tk.decls:
+ * generic/tkBind.c:
+ * generic/tkInt.decls:
+ * generic/tkIntDecls.h:
+ * generic/tkStubInit.c:
+ * mac/tkMacKeyboard.c:
+ * unix/tkUnixKey.c:
+ * win/tkWinKey.c: Fix for keyboard handling of "dead" keys and
+ caps lock from Peter Spjuth. [Bug: 4105 3359 2493]
+ Split functions into platform specific files:
+ Static functions GetKeySym(), SetKeycodeAndState() and InitKeymapInfo()
+ from tkBind.c moved into platform files tkWinKey.c tkUnixKey.c and
+ tkMacKeyboard.c. GetKeySym() and SetKeycodeAndState() renamed to
+ Tkp* and made public (as private functions) in tkInt.decls.
+
+ Step 2, fixes in tkWinKey.c
+ New static function: KeycodeToKeysym(), based on XKeycodeToKeysym()
+ but with different arguments, and a lot of improvements.
+ TkpGetString() changed to use KeycodeToKeysym() + other fixes.
+ TkpGetKeySym() changed to use KeycodeToKeysym() + other fixes.
+ InitKeymapInfo() changed to use KeycodeToKeysym().
+ TkpSetKeycodeAndState() rewritten, mostly by copying code from
+ XKeysymToKeycode().
+ XKeycodeToKeysym() rewritten. Preferably it should be removed.
+
+ EXPLANATION: The main problem is ToAscii() which has a lot of side
+ effects, and also that XKeycodeToKeysym() is not provided enough
+ input to do a proper job. The changes' main goal is to avoid
+ calling ToAscii() if not necessary, and to provide it with as
+ correct information as possible when called. Also some attempts
+ to clean up what ToAscii() did are done. See the code for details.
+
+ BUGS FIXED: Typing shifted (and AltGr) dead keys did not work.
+ Keyboard lock lamps did not work on Win98.
+ Events regarding AltGr-keys behaved badly.
+ Example: On a Swedish keyboard, $ is typed with AltGr-4.
+ That keyboard event would get the keysym '4' not 'dollar'.
+ Also, doing [event generete . <Key-dollar>] would send keysym '4'.
+ Translation to ascii in TkpGetString did not handle return and
+ tab correctly. I.e. [event generate . <Key-Return>] gave wrong %A
+
+ * generic/tkDecls.h:
+ * generic/tk.decls:
+ * generic/tk.h: moved new public functions created in dash patch
+ to the stubs interface [Bug: 4062]
+
+ * generic/tk.h:
+ * doc/CrtImgType.3:
+ * doc/CrtPhImgFmt.3:
+ * generic/tk.h:
+ * generic/tkImgGIF.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkStubImg.c (new file):
+ * generic/tkTest.c:
+ * unix/Makefile.in:
+ * win/Makefile.in:
+ * win/makefile.vc: improved support for moving from the old style
+ image C API to the new obj'ified one with new Tk_InitImageArgs
+ command and stub'ing of image code. See docs for how to make the
+ transition. [Bug: 4060]
+
+ * library/tk.tcl: wrapped check for tcl_platform(os) around info
+ exists because it won't in safe interpreters
+
+ * win/tkWinFont.c: corrected symbol font use to only work on 8-bit
+ characters [Bug: 2406]
+
+ * unix/aclocal.m4: changed all -fpic to -fPIC
+
+ * README:
+ * unix/configure.in:
+ * win/configure.in:
+ * generic/tk.h (TK_RELEASE_SERIAL): Moved to 8.3.0 patchlevel
+
+2000-02-07 Eric Melski <ericm@scriptics.com>
+
+ * library/tkfbox.tcl: Applied patch from bug #4117,
+ tk_getOpenFile/getSaveFile doesn't do the right thing when user
+ types a directory name in the entry and a default extension is
+ specified.
+
+2000-02-05 Jeff Hobbs <hobbs@scriptics.com>
+
+ * unix/tkUnixScale.c (TkpDestroyScale): changed ckfree to
+ Tcl_EventuallyFree to behave with Tcl_Preserve in TkpDisplayScale
+ (prevents possible segfault).
+
+2000-02-03 Eric Melski <ericm@scriptics.com>
+
+ * tests/canvText.test: test for fix for bug #2525.
+
+ * generic/tkFont.c (Tk_ComputeTextLayout): Was erroneously setting
+ the width of newline-only text display chunks to some arbitrary
+ huge number, instead of 0; this was interfering with things like
+ the canvas find enclosed feature. (bug #2525).
+
+ * tests/text.test:
+ * generic/tkText.c (DumpLine/DumpSegment): Changed DumpSegment to
+ take a TkTextIndex instead of two integer offsets, so that it
+ could use TkTextPrintIndex to format the offsets into an index,
+ which makes it UTF smart (bug #2582).
+
+2000-02-01 Eric Melski <ericm@scriptics.com>
+
+ * library/tk.tcl:
+ * library/tclIndex:
+ * library/choosedir.tcl: Moved choosedir functions into the
+ ::tk::dialog::chooseDir namespace instead of a toplevel
+ ::tkChooseDirectory namespace. Additional cleanup on the
+ chooseDir dialog.
+
+2000-02-01 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/text.n: clarified docs on what happens during a search with
+ -count when images/windows are embedded
+
+ * win/Makefile.in (install-*): reduced verbosity of install
+
+ * win/tkWinPixmap.c (XGetGeometry): added support for windows in
+ XGetGeometry [Bug: 4069]
+
+ * win/tkWinFont.c (GetScreenFont): fixed possible mem overrun with
+ long font names [Bug: 4108]
+
+ * win/tkWinDialog.c: added EnableWindow calls to dialogs to
+ correct for possible loss of control in parent Tk toplevel
+ [Bug: 1212 et al]
+
+ * generic/tkRectOval.c (ConfigureRectOval):
+ * generic/tkCanvLine.c (ConfigureLine):
+ * generic/tkCanvPoly.c (ConfigurePoly):
+ * generic/tkCanvArc.c (Configure/DisplayArc): fixed handling for
+ negative dash values [Bug: 4104]
+
+ * generic/tkScale.c (TkRoundToResolution): fixed incorrect
+ assumption that (N+1)*delta = N*delta + delta with floating point
+ math [Bug: 3689, 4099]
+ (DestroyScale) Fixed check for cancelling TkpDisplayScale (was
+ REDRAW_ALL, is now REDRAW_PENDING)
+
+ * tests/listbox.test: corrected test case for listbox itemconfigure
+
+ * unix/aclocal.m4: added *BSD ELF recognition for
+ SHARED_LIB_SUFFIX determination (from Tcl's tcl.m4)
+
+2000-01-27 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkImgPhoto.c: Removed unneccesary object translation in
+ MatchStringFormat (bug #4103).
+
+2000-01-27 Eric Melski <ericm@scriptics.com>
+
+ * generic/tkImgGIF.c: Additional code cleanup (now we only have
+ one decoder! neat!)
+
+2000-01-26 Eric Melski <ericm@scriptics.com>
+
+ * doc/getOpenFile.n:
+ * doc/chooseDirectory.n: Man page/cross links for
+ tk_chooseDirectory (bug #1786).
+
+ * library/tk.tcl:
+ * library/tclIndex: Added hooks for tk_chooseDirectory. (bug #1786)
+
+ * library/choosedir.tcl: tk_chooseDirectory implementation for
+ Unix/Mac (bug #1786).
+
+ * generic/tkImgPhoto.c: Added some comments regarding slow
+ processing of transparent images.
+
+ * generic/tkImgGIF.c: Improved GIF decoder for ~60% speed
+ increase. Added some comments on how to further improve the
+ implementation, time permitting.
+
+ * doc/photo.n: Added a description of what the -data string can
+ contain (base64 or binary data).
+
+ * generic/tkImgPhoto.c: Fixed bug with use of binary data for
+ "-data" option to "image create" command.
+
+2000-01-21 Eric Melski <ericm@scriptics.com>
+
+ * library/tkfbox.tcl: Fixed bug relating to incorrect parent
+ values for error message boxes displayed by the file dialog (bug
+ #3616).
+
+ * tests/text.test:
+ * generic/tkText.c: Fixed bug relating to regexp searching for
+ empty lines; previously, the starting line was ignored. (bug #1643).
+
+2000-01-20 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/text.tcl: fixed double-click selection behavior where
+ there were embedded windows/widgets in the same line. [Bug: 3989]
+
+ * win/tkWinWm.c (TkWmProtocolEventProc): cached atom name as the
+ window could get destroyed during eval [Bug: 2513]
+
+ * generic/tkCanvLine.c (LineCoords): fixed segfault when too few
+ coords were passed to a line with certain options set (it should
+ always have thrown an error anyway). [Bug: 4042]
+
+ * tests/text.test:
+ * generic/tkText.c: fixed missing " in error case and missing
+ 'dump' in subcommand listing [Bug: 4036]
+
+ * generic/tkListbox.c: adjusted use of basic string concatenation
+ in (non-K&R behavior) [Bug: 4027]
+ Swapped bg/fg class for -select(bg|fg) for listbox and their
+ items [Bug: 4039]
+
+ * unix/mkLinks:
+ * doc/WindowId.3: added docs for Tk_IsContainer and Tk_IsEmbedded
+
+ * doc/text.n: clarified mark gravity definition and usage of
+ ``word'' in binding definitions. [Bug: 2004 2277 1388]
+
+ * generic/tkInt.h: moved new TkDisplay useInputMethods structure
+ element to end to not disturb position of previous elements in
+ the structure (as compared to Tk <=8.2).
+
+2000-01-20 Eric Melski <ericm@scriptics.com>
+
+ * tests/grid.test: Added a test for the consecutive ^ and multiple
+ widget case (bug #1386).
+
+ * generic/tkGrid.c: Fixed interpretation of consecutive ^
+ characters in grid command. Previously, ^ ^ was interpreted as
+ meaning that there must be a 2-column widget above to extend,
+ neglecting the case where there was actually 2 1-column widgets
+ above. Now, ^ ^ is interpreted as a possible width; the gridder
+ will consume as many ^'s as there are columns in the widget, and
+ leave the rest for the extension of other widgets. (bug #1386).
+
+2000-01-19 Eric Melski <ericm@scriptics.com>
+
+ * library/tk.tcl: Created a virtual event <<PrevWindow>> for
+ reverse tab traversals, with one default binding <Shift-Tab>, and
+ OS specific bindings for Linux, HP-UX, and IRIX. (bug #3163)
+
+2000-01-13 Jeff Hobbs <hobbs@scriptics.com>
+
+ * changes: updated changes file to reflect 8.3b2 mods
+ * README:
+ * generic/tk.h:
+ * unix/configure.in:
+ * win/configure.in: updated to patchlevel 8.3b2
+
+ * win/tkWinWm.c: added visibility event handler to make sure
+ that transient window wrappers would be updated when the master
+ was initially mapped.
+
+2000-01-12 Jeff Hobbs <hobbs@scriptics.com>
+
+ * tests/text.test: changed test to reflect change of -hidden
+ to -elide in search options.
+
+ * win/tkWinScrlbr.c: added check for valid hwnd in ModalLoopProc
+ to avoid crash when building statically
+
+ * doc/event.n:
+ * generic/tkBind.c: prevented core with event -warp on Windows
+ when window wasn't mapped [Bug: 4004] and added docs stating
+ the requirement for mapped windows.
+
+ * generic/tkCanvas.c: fixed mem leak with TagSearchExprInit
+ [Bug: 3977]
+
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h: remove non-existent
+ Tk_(Get|Create)CanvasVisitor prototypes
+
+ * generic/tkText.c:
+ * generic/tkEntry.c: fixed cursor to not blink when widget was
+ disabled [Bug: 1807]
+
+ * generic/tkRectOval.c: added note about change to bloat for
+ RectOval bounds calculation for WIN32 only
+
+ * library/dialog.tcl: improved handling of $default arg to allow
+ for name of given button, as well as bounds checking
+
+ * doc/wm.n:
+ * tests/winWm.test:
+ * tests/unixWm.test:
+ * mac/tkMacWm.c:
+ * unix/tkUnixWm.c: fixed possible X error being raised [Bug: 3377]
+ * win/tkWinWm.c: wm deiconify in zoom state [Bug: 2077],
+ fixed possible flashing of unmapped toplevel in deiconify [Bug: 3338]
+ and fixed mapping of transient window [Bug: 572]
+ Also, for all wm's, extended 'wm state' command to allow setting
+ of the state, and added official support of 'zoomed' state on Win.
+
+ * unix/aclocal.m4: strtod bug on Tru64 [Bug: 3378]
+
+ * unix/Makefile.in: added tests to prevent unnecessary chmod +x
+ in source dirs while installing [Bug: 3367]
+
+ * unix/configure.in: properly sub'ed in TK_SHARED_BUILD [Bug: 3385]
+
+2000-01-05 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/text.n:
+ * generic/tkText.c:
+ * generic/tkText.h:
+ * generic/tkTextBTree.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextTag.c: removed the -state option for text tags,
+ and reoriented it around -elide, as -state disabled was never
+ implemented, and -state hidden is better as -elide.
+
+ * mac/tkMacClipboard.c: fixed i18n problems with clipboard [Bug: 3544]
+
+ * library/entry.tcl:
+ * library/focus.tcl:
+ * library/listbox.tcl:
+ * library/scale.tcl:
+ * library/scrlbar.tcl:
+ * library/tearoff.tcl:
+ * library/text.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl: fixed unprotected arg parsing through eval/after
+ [Bug: 3943]
+
+ * unix/Makefile.in: added unix/aclocal.m4 to distribution [Bug: 3938]
+ * unix/aclocal.m4: changed NetBSD SHLIB_CFLAGS from -fpic to -fPIC
+
+ * win/tkWinImage.c: added static declaration to function
+
+1999-12-22 Jeff Hobbs <hobbs@scriptics.com>
+
+ * changes: updated changes file
+
+ * generic/tkScale.c:
+ * generic/tkScale.h:
+ * mac/tkMacScale.c:
+ * unix/tkUnixScale.c: fixed potential segv from patch in 3897
+
+ * tests/unixWm.test: nonPOrtable -> nonPortable
+
+1999-12-21 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tk.h:
+ * unix/configure.in:
+ * win/configure.in:
+ * win/aclocal.m4:
+ * README: updated for patch level 8.3b1
+
+ * unix/tkUnixWm.c: fixed panic in Tk_CoordsToWindow to print error
+ and continue instead (for Tix) [Bug: 716 et al]
+
+ * scale.test:
+ * generic/tkScale.c:
+ * generic/tkScale.h: fixed possible core when freeing options
+ (cursor) associated with scale widget [Bug: 3897]
+
+ * doc/MeasureChar.3: fixed docs for Tk_MeasureChars to reflect code
+ * doc/listbox.n: fixed formatting problem
+
+ * generic/tk3d.c: added extra calculations to ensure that thin
+ frames get refreshed too [Bug: 3596]
+
+ * unix/tkUnixMenu.c:
+ * unix/tkUnixFont.c:
+ * generic/tkCanvText.c:
+ * generic/tkEntry.c:
+ * generic/tkFont.c:
+ * generic/tkImgPPM.c: removed extranneous vars that were set but
+ never used.
+
+ * mac/tclMacHLEvents.c: fixed applescript for I18N [Bug: 3644]
+
+ * unix/aclocal.m4: removed -O flag for AIX when using the IBM
+ compiler (several versions have a bug that crops up in the text
+ widget). [Bug: 2316]
+
+ * unix/Makefile.in: removed extra slash in SCRIPT_INSTALL_DIR
+ [Bug: 3896]
+
+ * library/listbox.tcl: added extra checks for existence of
+ tkPriv(listboxSelection) before it was used. [Bug: 3892]
+
+1999-12-16 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/GetCursor.3:
+ * win/tkWinCursor.c: added support for Windows cursors to
+ TkGetCursorByName (.ani, .cur) using -cursor @<filename>
+ (Ascher) [Bug: 1350]
+
+ * win/tkWinWm.c: fixed 'wm deiconify' to update position of the
+ toplevel if event is waiting before mapping. (Mao) [Bug: 3687]
+ This removes the need for 'update idle' before 'wm deiconify' on
+ Windows.
+
+ * doc/listbox.n: added doc for <<ListboxSelect>> [Bug: 3500]
+
+ * doc/getOpenFile.n: removed note that -initialfile didn't work
+ for tk_getOpenFile
+ * library/tkfbox.tcl: updated tk_get*File to better match the
+ Windows file box it emulates, give proper support to -initialfile,
+ and fixes lack of global tkPriv call. [Bug: 3735 3882]
+
+ * doc/tk.n: added doc for 'tk useinputmethods ...'
+ * tests/tk.test:
+ * unix/tkUnixKey.c:
+ * generic/tkCmds.c:
+ * generic/tkEvent.c:
+ * generic/tkWindow.c:
+ * generic/tkInt.h: add 'tk useinputmethods ?-display win? ?bool?'
+ call to provide support for disabling/enabling the use of XIM on
+ X. This was previously all done at compile time, and always on.
+ Now it is turned off by default, even when available, and the user
+ must turn it on to use XIM (per display).
+
+ * generic/tkCanvUtil.c: fixed bug in Tk_CanvasPsOutline that freed
+ mem it shouldn't.
+
+ * generic/tkFont.c: added "bitstream cyberbit" (popular Windows
+ CJK font) to list of font fallbacks. (kenny) [Bug: 2407]
+
+ * mac/tkMacMenu.c: finished bug 3075 by changing the char values of
+ what was checked (verified correctness on Mac).
+
+1999-12-13 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/canvas.n: added docs for items added by dash patch (-*dash*,
+ -state, -active*, -disabled*, -offset, essentially rewrote the
+ man patch for completely updated 8.3 canvas widget.
+ * doc/entry.n: added docs for entry widget validation
+ * doc/event.n: added docs for -warp
+ * doc/text.n: doc'ed new -state value 'hidden'
+ * doc/GetDash.3: (new file) man page explaining Tk_GetDash
+ * generic/tkStubInit.c:
+ * generic/tkDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkInt.decls: added XSetDashes and XWarpPointer
+ * generic/tk.decls: added Tk_CreateSmoothMethod, and reserved
+ two spots
+ * generic/tk.h: added Tk_SmoothMethod struct,
+ state item to canvas record, #defines for item state,
+ support for using old char*-based canvas item C creation
+ procedures with -DUSE_OLD_CANVAS,
+ Tk_Dash, Tk_TSOffset (-offsets) & Tk_Outline structs and #defs,
+ decls for dash, outline and postscript routines
+ * generic/tkBind.c: added support for Quadruple clicks, and added
+ the -warp option to 'event' with pointer warping routines
+ * xlib/xgc.c:
+ * generic/tkRectOval.c:
+ * generic/tkCanvArc.c:
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvImg.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvPs.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvUtil.c:
+ * generic/tkCanvWind.c:
+ * generic/tkCanvas.c:
+ * generic/tkCanvas.h: Canvas and items received overhaul to with
+ the addition of the dash patch (Nijtmans, et al) This includes
+ objectification of the 'canvas' command, as well as support for
+ (where appropriate) dashes in items, extended stipple support,
+ state for all items, and postscript generation of images and
+ windows. See the new canvas man page for related docs.
+ * generic/tkEntry.c: added entry widget validation, see entry.n
+ * generic/tkEvent.c: on simulated events, ButtonPress should
+ be matched with ButtonRelease to be correct
+ * generic/tkFont.c: corrected possible null reference
+ * generic/tkFrame.c: made frame a Tcl_Obj based command
+ * generic/tkGet.c: added TkGetDoublePixels
+ * generic/tkImage.c: bug fixes from Img patch and new
+ Tk_PostscriptImage and Tk_SetTSOrigin functions
+ * generic/tkImgBmap.c: new ImgBmapPostscript function
+ * generic/tkImgPhoto.c: new Tk_CreatePhotoOption, Tk_DitherPhoto
+ * generic/tkInt.h: declarations for some new functions
+ * generic/tkMessage.c: reworked relief drawing
+ * generic/tkOldConfig.c: added TK_CONFIG_OBJS so old style
+ ConfigureWidget calls can pass in Tcl_Obj arrays
+ * generic/tkScrollbar.c:
+ * generic/tkScrollbar.h: made -orient use an option table
+ * generic/tkText.c:
+ * generic/tkText.h: made -wrap and -state use option tables
+ * generic/tkTextBTree.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextImage.c:
+ * generic/tkTextMark.c:
+ * generic/tkTextTag.c:
+ * generic/tkTextWind.c: added support for -elide and -state hidden
+ * generic/tkTrig.c: changed TkMakeBezierCurve to support returning
+ the upper limit of points needed for spline
+ * generic/tkUtil.c: new option table parsing routines
+ * generic/tkWindow.c: init'ing of warp stuff, mouseButtonState
+
+ related bug ids for the fixes:
+ [Bug: 648 1541 1540 1779 2168 2311 2297 2340 2348 2578 3386]
+
+ * tests/bind.test:
+ * tests/canvImg.test:
+ * tests/canvPsArc.tcl:
+ * tests/canvPsImg.tcl: (new file)
+ * tests/canvRect.test:
+ * tests/canvText.test:
+ * tests/canvas.test:
+ * tests/defs.tcl:
+ * tests/entry.test:
+ * tests/event.test:
+ * tests/font.test:
+ * tests/frame.test:
+ * tests/imgPhoto.test:
+ * tests/safe.test:
+ * tests/scale.test:
+ * tests/scrollbar.test:
+ * tests/select.test:
+ * tests/text.test:
+ * tests/textDisp.test:
+ * tests/textTag.test:
+ * tests/unixFont.test:
+ * tests/unixWm.test:
+ * tests/visual_bb.test:
+ * tests/winClipboard.test: tests for the dash patch changes
+
+ * unix/mkLinks: added GetDash.3 into the mkLink step
+
+ * mac/tkMacDraw.c: mac still needs pointer warping routine
+ * mac/tkMacXStubs.c:
+ * win/tkWinDraw.c:
+ * win/tkWinPointer.c: added support for pointer warping and
+ platform specific support for dash patch items
+
+1999-12-12 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkText.c: fixed bug in TextSearchCmd for multibyte chars
+ (Darley) [Bug: 3839]
+
+ * unix/aclocal.m4: added warning when configuring with
+ --enable-threads that Tk may have problems
+
+1999-12-09 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkImgGIF.c: updated casting
+
+ * win/makefile.vc: removed 16bit stuff, simplified makefile.
+
+1999-12-06 Scott Redman <redman@scriptics.com>
+
+ * generic/tkMain.c: need to include tclInt.h for new hook
+ functions that are internal-use-only.
+
+1999-12-06 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/comdlg.tcl: removed tclVerifyInteger and tclSortNoCase,
+ they weren't used, and were not actually correct
+
+ * mac/tkMacFont.c:
+ * mac/tkMacMenu.c:
+ * mac/tkMacWindowMgr.c: fixed greyed out menu items, handling of
+ ... elipsis, font mapping problem, and enabled generated menu
+ posting [Bug: 3705]
+
+1999-12-02 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkInt.h:
+ * generic/tkWindow.c:
+ * generic/tkCmds.c: converted Tk_DestroyCmd, Tk_LowerCmd and
+ Tk_RaiseCmd to their ObjCmd equivalent.
+
+ * library/msgbox.tcl: added color icons for tk_messageBox on Unix
+ and Mac when tk_strictMotif isn't set. (Hipp)
+ * library/tk.tcl: added window bounds checking to ::tk::PlaceWindow
+
+ * tests/imgPPM.test: fixed test 2.2 to use -format ppm (since
+ we know have GIF write capability)
+
+1999-12-01 Scott Redman <redman@scriptics.com>
+
+ * generic/tkMain.c :
+ * unix/tkAppInit.c:
+ * win/winMain.c: Added added hooks into the main() code for
+ supporting TclPro and other "big" shells more easily without
+ requiring a copy of the main() code.
+
+1999-11-29 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkImgGIF.c: added GIF writing that uses miGIF RLE
+ [Bug: 2039, new patch]
+
+ * library/entry.tcl: fixed up tkEntrySeeInsert (Nemthi)
+
+ * generic/tkListbox.c: fixed 'get' of listbox to return a string
+ when only one item is requested.
+
+ * tests/clrpick.test:
+ * tests/filebox.test: minor whitespace cleanup
+
+ * library/tk.tcl: fixed missing $w in ::tk::PlaceWindow
+
+1999-11-24 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/clrpick.tcl:
+ * library/msgbox.tcl:
+ * library/tk.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl: fixed dialogs to center over -parent,
+ added utility functions ::tk::PlaceWindow, ::tk::SetFocusGrab,
+ ::tk::RestoreFocusGrab to tk.tcl to help
+
+1999-11-23 Eric Melski <ericm@scriptics.com>
+
+ * tests/listbox.test: Added a test to check that the topIndex is
+ update when items are removed from the listvar variable.
+
+ * generic/tkListbox.c: Added a check the updates the topIndex when
+ items are removed from the listvar variable.
+
+ * tests/listbox.test: Added a test to check that the vertical
+ scrollbar is updated when the listvar changes.
+
+ * generic/tkListbox.c (ListboxListVarProc): added a check that
+ sets the UPDATE_V_SCROLLBAR flag if the length of the listvar has
+ changed.
+
+1999-11-23 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tk.h:
+ * generic/tkConfig.c: added support for TK_OPTION_DONT_SET_DEFAULT
+ as equiv for TK_CONFIG_DONT_SET_DEFAULT
+ * generic/tkListbox.c: added TK_OPTION_DONT_SET_DEFAULT to the
+ item specs
+
+1999-11-19 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkColor.c:
+ * generic/tkColor.h: fixed Tk_NameOfColor to work correctly,
+ with minor change to TkColor struct.
+
+ * generic/tkConsole.c: added static declaration to
+ ConsoleDeleteProc function (proto already had it)
+
+ * win/tkWinInt.h: removed TkFontAttributes typedef (was
+ redundant with tkFont.h).
+ * win/tkWinPort.h: put #ifndef __GNUC__ around redefinition
+ of str[n]casecmp, as cygwin uses the originals.
+ * win/tkWinX.c: changed GetCurrentTime to GetTickCount (the
+ former is deprecated). [Bug: 2053]
+
+1999-11-19 Eric Melski <ericm@scriptics.com>
+
+ * tests/listbox.test: Added tests for itemcget and itemconfigure.
+
+ * doc/listbox.n: Added documentation for -listvar option and for
+ itemconfigure and itemcget commands.
+
+ * generic/tkListbox.c: Added support for itemconfigure/itemcget
+ listbox subcommands (addresses rfe #936)
+
+1999-11-17 Eric Melski <ericm@scriptics.com>
+
+ * tests/listbox.test: Updated tests for new error messages.
+
+ * generic/tkListbox.c: Improved error messages for bad -listvar's.
+
+ * tests/listbox.test: Added tests for bad -listvar's.
+
+ * generic/tkListbox.c: Added handlers for bad -listvar's (ie, bad
+ lists)
+
+ * tests/listbox.test: Added tests for ListboxUpdateHScrollbar.
+
+ * generic/tkListbox.c: Changed some old static buffers to base
+ size on TCL_DOUBLLE_SPACE instead of (completely) hardcoding the size.
+
+ * tests/listbox.test: New tests for -listvar functionality, and an
+ odd extra case that wasn't covered before.
+
+ * generic/tkListbox.c: Tests exposed some bugs, now fixed.
+
+1999-11-16 Eric Melski <ericm@scriptics.com>
+
+ * tests/listbox.test: Fixed tests to comply with new objectified
+ error messages. No -listvar specific tests yet.
+
+ * win/tkWinDefault.h:
+ * unix/tkUnixDefault.h:
+ * mac/tkMacDefault.h: Added default value for -listvar option.
+
+ * generic/tkWindow.c: Changed "listbox" mapping from old-school to
+ new-school objectified command.
+
+ * generic/tkListbox.c: Objectified listbox; added support for
+ -listvar option. Converted internal structure to use a Tcl list
+ object to store the data.
+
+ * generic/tkInt.h: Changed reference to Tk_ListboxCmd to
+ Tk_ListboxObjCmd.
+
+1999-11-09 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkGrid.c: changed Tcl_Alloc to ckalloc
+
+ * generic/tkEntry.c: fixed C expr error in destroy of entry
+ that could lead to 'malformed bucket chain' error
+
+ * win/winMain.c: corrected winMain to not do a DebugBreak when
+ returning an error message from the top level
+
+1999-10-30 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinKey.c: fixed XKeysymToKeycode to handle mapping of
+ symbolic keysyms (Left, Home, ...) with event generate
+
+ * library/entry.tcl: change tkEntrySeeInsert to avoid the use
+ of a while loop that could eat CPU tremendously. Behavior of
+ moving the cursor at the right edge changes slightly (previously
+ it tried to keep the cursor at the right edge, now it moves the
+ cursor to a "central right" location - better IMHO).
+
+1999-10-28 Jeff Hobbs <hobbs@scriptics.com>
+
+ * doc/CrtImgType.3:
+ * doc/CrtPhImgFmt.3:
+ * doc/FindPhoto.3:
+ * doc/photo.n:
+ * generic/tk.h:
+ * generic/tkCmds.c:
+ * generic/tkImage.c:
+ * generic/tkImgBmap.c:
+ * generic/tkImgGIF.c:
+ * generic/tkImgPPM.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkInt.h:
+ * generic/tkTest.c:
+ * generic/tkWindow.c:
+ * tests/imgPhoto.test: added Img patch (Nijtmans) with docs,
+ headers #def'd with USE_OLD_IMAGE. Upgrades image stuff to
+ Tcl_Obj API, adds alpha channel (images are now 32 bpp)
+
+ * makefile.vc: changed 'c:/program files' to c:/progra~1
+
+1999-10-19 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/scrlbar.tcl: changed tkScrollButtonUp to check for
+ existence of tkPriv(relief) in order to avoid spurious release
+ events
+
+ * unix/Makefile.in: added ChangeLog to dist archive
+
+1999-09-24 Jeff Hobbs <hobbs@scriptics.com>
+
+ * */README:
+ * win/makefile.vc:
+ * */configure.in:
+ * generic/tk.h:
+ * library/tk.tcl: up'd to 8.3a1
+
+ * unix/Makefile.in: changed 'mkdir' to 'mkdir -p'
+
+ * library/dialog.tcl: changed {Times 18} to {Times 12} for
+ dialog font.
+
+1999-09-16 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkFont.c: fixed processing of font options and error
+ returned [Bug: 2075]
+
+ * win/tkWinWm.c: fixed bug in 'wm deiconify' that raised the
+ wrong toplevel, and changed it to not set focus on overridden
+ toplevels
+
+1999-09-15 Jeff Hobbs <hobbs@scriptics.com>
+
+ * unix/aclocal.m4: added fix for FreeBSD-[1-2] recognition [Bug: 2070]
+ and fix to AIX-* to get ldAix right [Bug: 2624], fixed AIX
+ version check (readjust from 8-21 fix) and several other config
+ fixes for AIX
+ * mac/tkMacMenubutton.c:
+ * unix/tkUnixMenubu.c: fixed permanently stippled menubutton image
+ * win/tkWinButton.c: fixed possible pointer smash [Bug: 2733]
+
+1999-09-14 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinMenu.c: fix for stack overrun in GetTextFace [Bug: 909]
+
+1999-09-01 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinDraw.c:
+ * unix/tkUnixDraw.c: fixed header style for TkpDrawHighlightBorder
+ * generic/tkCanvas.c: fixed GC error (bg <> fg) in tkCanvas.c
+ (from code added to support TkpDrawHighlightBorder) [Bug: 2676]
+ * unix/aclocal.m4: added -bnoentry to the AIX-* flags
+ * library/msgbox.tcl: changed the behavior of tk_messageBox on
+ Unix to be more Windows like in handling of <Return> and the
+ default button
+ * library/button.tcl:
+ * library/clrpick.tcl:
+ * library/comdlg.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/entry.tcl:
+ * library/focus.tcl:
+ * library/listbox.tcl:
+ * library/menu.tcl:
+ * library/msgbox.tcl:
+ * library/palette.tcl:
+ * library/safetk.tcl:
+ * library/scale.tcl:
+ * library/scrlbar.tcl:
+ * library/tearoff.tcl:
+ * library/text.tcl:
+ * library/tk.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl: updated commands to use [string] ops
+ instead of expr equality operators
+
+1999-08-21 Jeff Hobbs <hobbs@scriptics.com>
+
+ * unix/aclocal.m4: Changed AIX-4.[2-9] check to AIX-4.[1-9]
+ [Bug: 1909]
+
+1999-08-20 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkCursor.c: fixed bug in GetCursorFromObj that caused
+ panic [Bug: 2562]
+
+ * TK 8.2.0 RELEASED
+
+1999-08-13 Jim Ingham <jingham@cygnus.com>
+
+ * mac/tkMacMenu.c: Tk_DrawChars ends up setting the menu background
+ wrong. There is no clean way to stop it, so I use lower level routines
+ here to draw the text.
+ * mac/tkMacProjects.sea.hqx: Rearrange the projects so that the build
+ directory is separate from the sources. Much more convenient!
+
+1999-08-10 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinWm.c: changed "wm deiconify" on Windows to raise and
+ force the focus on the deiconified window (behavioral change from
+ 8.1 to comply better with Windows style) [Bug: 1609]
+ * doc/wm.n: clarified behavior of "wm deiconify".
+ * generic/tkInt.decls: added TkSetFocusWin
+ * generic/tkFocus.c: changed static SetFocus to TkSetFocusWin
+
+ * library/clrpick.tcl:
+ * library/console.tcl:
+ * library/tk.tcl: fixed code where abbreviations where used
+ in calling widget methods (confuses iWidgets) [Bug: 2422]
+
+1999-08-09 Jeff Hobbs <hobbs@scriptics.com>
+
+ * library/button.tcl: cleaned up programming (config -> configure)
+ and fixed Windows relief bug [Bug: 664]
+ * library/entry.tcl: changed Entry C/C/P to not use global data
+ (now uses tkPriv(data)) [Bug: 1475]
+ * library/listbox.tcl: fixed extended mode script error [Bug: 866]
+ * doc/options.n: clarified that -troughcolor doesn't work on Windows
+ * doc/wm.n: fixed wm positionfrom docs [Bug: 2284]
+
+1999-08-01 Jeff Hobbs <hobbs@scriptics.com>
+
+ * mac/tkMacPort.h: wrapped panic in #ifndef panic to avoid
+ compiler errors when used with stubs-#defines, from Vince Darley.
+ [Bug: 2389]
+
+1999-07-31 Scott Redman <redman@scriptics.com>
+
+ * xlib/X11/Xlib.h: Remove XFillRectangle since it is now in the
+ stub tables.
+
+1999-07-30 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkInt.decls: Added stub entry for XFillRectangle [Bug: 2446]
+
+1999-07-30 Scott Redman <redman@scriptics.com>
+
+ * win/makefile.vc: Corrected building threaded tktest.exe on
+ Windows. Needed to link in .obj files from Tcl, needs to change
+ later so that code is in Tk and doesn't require a Tcl build.
+ Also added runtest target.
+
+1999-07-29 Scott Redman <redman@scriptics.com>
+
+ * generic/tkConsole.c: Allow tcl to open CON and NUL, even for std
+ channels. Checking for bad/unusable std channels was moved to Tk
+ since its only purpose was to check whether to use the Tk Console
+ Window for the std channels. [Bug: 2393 2392 2209 2458]
+
+ * win/Makefile.in: Corrected building threaded tktest.exe on
+ Windows. Needed to link in .obj files from Tcl, needs to change
+ later so that code is in Tk and doesn't require a Tcl build.
+
+1999-07-22 Scott Redman <redman@scriptics.com>
+
+ * Changed version to 8.2b2
+
+ * win/tkWinPort.h: Block out include of sys/stat.h in order to
+ build extensions with MetroWerks compiler for Win32. [Bug: 2385]
+
+ * unix/Makefile.in: Need to make install-sh executable before
+ calling (with chmod +x). [Bug: 2413]
+
+ * library/menu.tcl: Applied patch from Jeff Hobbs to fix typo.
+ [Bug: 2425]
+
+1999-07-21 Scott Redman <redman@scriptics.com>
+
+ * unix/Makefile.in: Add Windows configure script to distribution.
+
+1999-07-16 Scott Redman <redman@scriptics.com>
+
+ * unix/Makefile.in:
+ * win/Makefile.in: Copy the prolog.ps from the generic directory
+ for install-libraries.
+
+ * unix/aclocal.m4: Check for Alpha/Linux to set the IEEE flag to
+ the compiler to be -mieee. Patch from Don Porter.
+
+1999-07-08 Scott Stanton <stanton@scriptics.com>
+
+ * tests/unixSelect.test: Fixed broken test.
+
+ * win/makefile.vc: Added special case target to ensure that
+ tkStubLib.obj is built with -DSTATIC_BUILD.
+
+ * win/tkWinX.c (TkWinChildProc): Changed to pass
+ WM_WINDOWPOSCHANGED through to DefWindowProc to make OpenGL
+ sub-windows happy. This allows Windows to generate the WM_SIZE
+ and WM_MOVE messages.
+
+1999-07-08 Scott Redman <redman@scriptics.com>
+
+ * unix/configure.in: Fix Tk stub lib file names and flags.
+
+1999-06-30 Scott Redman <redman@scriptics.com>
+
+ * generic/tkGrid.c: removed deprecated functions (applied patch
+ from Jan Nijtmans). [Bug: 2080]
+
+ * generic/tkImgGIF.c:
+ * generic/tkImgPPM.c:
+ * generic/tkImgPhoto.c: Applied patch to allow Img extension to
+ work with 8.2, from Jan Nijtmans. [Bug: 2068]
+
+ * win/tkWinWm.c: Applied patch from Don Porter to prevent the
+ windows code from calling the Tcl functions when the stub table
+ has not been initialized in TkWinWmCleanup. [Bug: 2269]
+
+1999-06-16 Michael Thomas <wart@scriptics.com>
+
+ * unix/configure.in:
+ * unix/Makefile.in:
+ * unix/aclocal.m4: Numerous build changes to make Tk conform to
+ the proposed TEA spec
+
+ * tkConsole.c: changed some variable types from (int) to (size_t)
+ to prevent compiler warnings. Cast return value from strlen()
+ to (int) in one place for the same reason.
+
+1999-06-03 Scott Stanton <stanton@scriptics.com>
+
+ * unix/tkUnixSelect.c:
+ * tests/unixSelect.test:
+ * generic/tkSelect.c: Fixed selection code to handle Unicode data
+ in COMPOUND_TEXT and STRING selections. [Bug: 1791]
+
+1999-06-02 Scott Stanton <stanton@scriptics.com>
+
+ * generic/tkIntXlibDecls.h:
+ * xlib/X11/Xlib.h: Added Mac specific defines to help with
+ compilation.
+
+ * generic/tkFont.c: lint
+
+1999-06-01 Scott Stanton <stanton@scriptics.com>
+
+ * unix/tkUnixSelect.c: Improved I18N selection support.
+ COMPOUND_TEXT is converted to/from iso2022, and STRING is
+ converted to/from iso8859-1. There are still a few loose ends to
+ tie up before this is completely done.
+
+ * unix/tkUnixFont.c: Eliminated redundant case folding code.
+
+ * generic/tkFont.c: Eliminated use of isupper/tolower in favor of
+ Unicode variants.
+
+1999-05-24 Scott Stanton <stanton@scriptics.com>
+
+ * generic/tkStubLib.c:
+ * generic/tkStubInit.c:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntDecls.h:
+ * generic/tkInt.decls:
+ * generic/tkConsole.c: Various changes to try to get the Mac
+ builds working.
+
+1999-05-21 Scott Stanton <stanton@scriptics.com>
+
+ * win/tkWinClipboard.c: Fixed clipboard code to handle lack of
+ CF_LOCALE information (e.g. from command.com).
+
+1999-05-20 Scott Redman <redman@scriptics.com>
+
+ * library/console.tcl: Changed copyright string to read 1999
+ Scriptics Corp. in wish console about box.
+
+1999-05-19 Scott Redman <redman@scriptics.com>
+
+ * generic/tk.h: Add extern "C" block around entire header file for
+ C++ compilers to fix linkage issues. Submitted by Don Porter and
+ Paul Duffin.
+
+1999-05-18 Scott Stanton <stanton@scriptics.com>
+
+ * tests/winClipboard.test:
+ * win/tkWinClipboard.c: Fixed clipboard code so it handles Unicode
+ data properly on Windows NT and 95. [Bug: 1791]
+
+1999-05-07 Scott Stanton <stanton@scriptics.com>
+
+ * library/menu.tcl: Fixed bug where tk_popup fails when called too
+ quickly. [Bug: 2009]
+
+1999-04-30 Scott Stanton <stanton@scriptics.com>
+
+ * Changed version number to 8.1.1.
+
+1999-04-30 Scott Stanton <stanton@scriptics.com>
+
+ * Merged changes from 8.1.0 branch:
+
+ * generic/tkDecls.h:
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkStubInit.c: Changed to avoid the need for forward
+ declarations in stub initializers. Added extern "C" blocks around
+ stub table pointer declarations so the stubs can be used from C++
+ code. [Bug: 1934]
+
+ * generic/tkInt.decls: Added TkClipBox, XDrawSegments, and
+ XForceScreenSaver to stubs.
+
+ * generic/tkStubLib.c: Reordered declarations to avoid
+ circularities and forward references.
+
+ * generic/tkStubInit.c: Added includes for Mac.
+
+ * generic/tkMenubutton.c: lint
+
+ * generic/tkEntry.c: Fixed bad option table entry.
+
+ * generic/tkImgBmap.c:
+ * generic/tkImgPPM.c:
+ * generic/tkImgPhoto.c: Set the -translation and -encoding options
+ to binary for image files. (reported by Marco Gazzetta)
+
+1999-04-23 Scott Stanton <stanton@scriptics.com>
+
+ * generic/tkInt.decls: Added TkClipBox, XDrawSegments, and
+ XForceScreenSaver to stubs.
+
+ * generic/tkStubLib.c: Reordered declarations to avoid
+ circularities and forward references.
+
+ * generic/tkStubInit.c: Added includes for Mac.
+
+ * generic/tkMenubutton.c: lint
+
+ * generic/tkEntry.c: Fixed bad option table entry.
+
+1999-04-22 Scott Redman <redman@scriptics.com>
+
+ * generic/tkImgBmap.c:
+ * generic/tkImgPPM.c:
+ * generic/tkImgPhoto.c: Set the -translation and -encoding options
+ to binary for image files. (reported by Marco Gazzetta)
+
+1999-04-20 Scott Redman <redman@scriptics.com>
+
+ * xlib/X11/Xlib.h: changed definition of Status type to use a
+ typedef instead of a #define to avoid conflicting with the cygwin
+ win32 headers [Bug 1804]
+
+1999-04-15 Scott Stanton <stanton@scriptics.com>
+
+ * Merged 8.1 branch into the main trunk
+
+1999-04-09 Scott Redman <redman@scriptics.com>
+
+ * generic/tkWindow.c: Fixed deadlock situation when the Initialize()
+ function returns without releasing the mutex. Found while testing
+ Bug 1700, during safe.test (tk).
+
+1999-04-06 Scott Stanton <stanton@scriptics.com>
+
+ * generic/tkMain.c (Tk_MainEx): Changed to reset result before
+ calling Tcl_EvalFile. The ensures that error messages will be
+ generated cleanly.
+
+ * tests/winfo.test: Enabled tests that previously failed.
+
+1999-04-05 Scott Stanton <stanton@scriptics.com>
+
+ * library/bgerror.tcl:
+ * library/button.tcl:
+ * library/clrpick.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/entry.tcl:
+ * library/focus.tcl:
+ * library/listbox.tcl:
+ * library/menu.tcl:
+ * library/msgbox.tcl:
+ * library/palette.tcl:
+ * library/scale.tcl:
+ * library/scrlbar.tcl:
+ * library/tearoff.tcl:
+ * library/text.tcl:
+ * library/tk.tcl: Lots of minor performance improvements
+ contributed by Jeffrey Hobbs. [Bug: 1118]
+
+ * win/tkWinWm.c (Tk_WmCmd): Fixed bad code in tracing
+ suboption. [Bug: 1519]
+
+ * library/tkfbox.tcl: Change to restore button text after an
+ action to avoid the sticky "Open" button in a save dialog.
+ [Bug: 1640]
+
+ * library/entry.tcl: Fixed so selection is returned using the
+ -show character during cut and paste operations. [Bug: 1687]
+
+1999-04-5 Scott Redman <redman@scriptics.com>
+
+ * generic/tkInt.decls:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkStubInit.c:
+ * xlib/xgc.c:
+ * xlib/X11/Xlib.h:
+ * xlib/X11/Xutil.h: Added more X functions to the Win & Mac stubs
+ tables.
+
+1999-04-05 Scott Stanton <stanton@scriptics.com>
+
+ * unix/configure.in:
+ * generic/tkCanvPs.c: Added configure test for pw_gecos field in
+ pwd to support OS/390. [Bug: 1724]
+
+1999-04-02 Scott Stanton <stanton@scriptics.com>
+
+ * tests/text.test:
+ * generic/tkText.c: Fixed handling of Unicode in text searches.
+ The -count option was returning byte counts instead of character
+ counts. [Bug: 1056, 1148, 1666]
+
+1999-04-01 Scott Redman <redman@scriptics.com>
+
+ * generic/tk.decls:
+ * generic/tk.h:
+ * generic/tkStubInit.c:
+ * generic/tkWindow.c:
+ * unix/Makefile.in:
+ * win/makefile.vc: Tk now uses its own stub library to store
+ pointers to its own stubs table.
+
+ * doc/dde.n: (removed)
+ * doc/send.n:
+ * generic/tk.decls:
+ * tests/winSend.test:
+ * generic/tkPlatDecls.h:
+ * win/tkWinSend.c: Removed the DDE-based send and dde commands,
+ they were causing Tk to lock up when any window on the system was
+ not processing its message queue (more importantly, windows in Tcl
+ and Tk). The send command needs to be rewritten to prevent the
+ deadlock situation (soon). The dde command is being pushed into
+ its own package and will provide almost all of the capabilities
+ that send did before (using a "dde eval" command), not yet
+ completed.
+
+1999-03-31 Scott Redman <redman@scriptics.com>
+
+ * win/tkWinSend.c: Modified dde/send code to work properly on
+ Win95/Win98. String lengths are not returned properly by DDE, so
+ NULL terminate all strings going in and ignore the string length
+ coming back out. Do not destroy handles until all necessary work
+ on those handles (and child handles) is done.
+
+1999-03-30 Scott Stanton <stanton@scriptics.com>
+
+ * generic/tkWindow.c (Tk_DestroyWindow): Image handlers are now
+ finalized before the font subsystem since complex image handlers
+ may contain references to fonts (e.g. Tix compound images).
+ [Bug: 1603]
+
+1999-03-29 Scott Stanton <stanton@scriptics.com>
+
+ * doc/MeasureChar.3:
+ * doc/TextLayout.3:
+ * generic/tk.decls:
+ * generic/tkCanvText.c:
+ * generic/tkEntry.c:
+ * generic/tkFont.c:
+ * generic/tkListbox.c:
+ * generic/tkMessage.c:
+ * mac/tkMacFont.c:
+ * unix/tkUnixButton.c:
+ * unix/tkUnixFont.c:
+ * unix/tkUnixMenu.c:
+ * win/tkWinFont.c:
+ * win/tkWinMenu.c: Standardized text layout and font interfaces
+ so they are consistent with respect to byte versus character
+ oriented indices. The layout functions all manipulate character
+ oriented values while the lower level measurement functions all
+ operate on byte oriented values. This distinction was not clear
+ and so the functions were being used improperly in a number of
+ places. [Bug: 1053, 747, 749, 1646]
+
+ * generic/tk.decls: Eliminated uses of C++ STL types string and
+ list from declarations.
+
+ * generic/tkFont.c: Changes to named fonts were not being
+ propagated in some cases. [Bug: 1144]
+
+ * xlib/X11/Xlib.h:
+ * generic/tkInt.decls: Added XParseColor to xlib stub
+ tables. [Bug: 1574]
+
+ * doc/GetBitmap.3:
+ * generic/tkBitmap.c (BitmapInit): Eliminated use of Tk_Uid's in
+ bitmaps. Added a few CONST declarations.
+
+1999-03-29 Scott Redman <redman@scriptics.com>
+
+ * unix/configure.in:
+ * unix/Makefile.in:
+ * win/makefile.vc:
+ * generic/tkDecls.h:
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkIntXlibDecls.h: Removed stub functions. Always use the
+ Tcl stubs when building with --enable-shared.
+
+1999-03-26 Scott Redman <redman@scriptics.com>
+
+ * generic/tkTextIndex.c:
+ * tests/testIndex.test: Avoid looking past the beginning of the
+ array storing data for the text widget (.t index end-2c). Added
+ test case to check for the bug. [Bug 991]
+
+ * generic/tkConsole.c: Copy static strings into a Tcl_DString
+ before passing to Tcl_Eval, in case the compiler puts static
+ strings into read-only memory.
+
+1999-03-26 Suresh Ankolekar <suresh@scriptics.com>
+
+ * unix/configure.in:
+ --nameble-shared is now the default and builds Tk as a shared
+ library; specify --disable-shared to build a static Tk library
+ and shell.
+
+1999-03-26 Bryan Surles <surles@scriptics.com>
+
+ * library/menu.tcl: Fixed bug reported by Bryan Oakley in the
+ menubutton bindings. There was a false assumption that there was
+ always a menu attached to the button. [Bug 1116]
+
+1999-03-26 Scott Redman <redman@scriptics.com>
+
+ * unix/configure.in: Removed --enable-tcl-stub. Linking Tk to Tcl
+ stubs is causing too many problems when linking executables like wish.
+ Until the Tk is a fully loadable extension, linking against the Tcl
+ stubs is not supported in Tk.
+
+1999-03-19 Scott Redman <redman@scriptics.com>
+
+ * generic/tkBitmap.c:
+ * generic/tkCursor.c:
+ * generic/tkGC.c: When creating hash tables that key off of XID
+ handles, make sure to pass TCL_ONE_WORD_KEYS. XIDs are guaranteed
+ to be 32bit numbers, although on some 64bit systems (including 64bit
+ Solaris 7) they are packed into a 64bit value where the upper 32bits
+ are zero. The normal method of sizeof(XID)/sizeof(int) causes the
+ hash table code to assume that the XID is a pointer to an array of
+ two ints, which it is not. Tk now supports 64bit Solaris 7.
+
+1999-03-17 Scott Stanton <stanton@scriptics.com>
+
+ * win/makefile.vc:
+ * generic/tk.h: Changed to use TCL_BETA_RELEASE macro, and fixed
+ so this works in rc files.
+
+ * win/makefile.vc:
+ * win/makefile.bc:
+ * win/README:
+ * unix/configure.in:
+ * generic/tk.h:
+ * README: Updated version to 8.1b3.
+
+1999-03-14 Scott Stanton <stanton@GASPODE>
+
+ * unix/configure.in: Added missing stub related definitions.
+
+ * unix/Makefile.in: Install tkDecls.h in addition to tk.h.
+
+ * generic/tkStubLib.c: Added flags to ensure we are using Tcl
+ stub macros.
+
+1999-03-11 Scott Stanton <stanton@GASPODE>
+
+ * generic/tkInt.decls: Added reserved slot for XSetDashes for use
+ by the dash patch.
+
+1999-03-10 Scott Redman <redman@scriptics.com>
+
+ * xlib/xdraw.c:
+ * xlib/X11/Xlib.h:
+ * mac/tkMac.h:
+ * mac/tkMacInt.h:
+ * mac/tkMacPort.h:
+ * mac/tkMacXStubs.c:
+ * mac/tkMacAppInit.c:
+ * mac/tkMacCursor.c:
+ * win/makefile.vc:
+ * win/tkWin.h:
+ * win/tkWinInt.h:
+ * win/tkWinPort.h:
+ * win/winMain.c:
+ * generic/tk.h:
+ * generic/tkInt.h:
+ * generic/tk.decls:
+ * generic/tkInt.decls:
+ * generic/tkDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkStubs.c:
+ * generic/tkPlatStubs.c:
+ * generic/tkIntStubs.c:
+ * generic/tkIntPlatStubs.c:
+ * generic/tkIntXlibStubs.c:
+ * generic/tkStubInit.c:
+ * generic/tkStubLib.c:
+ * generic/tkBind.c:
+ * generic/tkCmds.c:
+ * generic/tkConfig.c:
+ * generic/tkConsole.c:
+ * generic/tkCursor.c:
+ * generic/tkGrab.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkMain.c:
+ * generic/tkMenu.c:
+ * generic/tkPointer.c:
+ * generic/tkTextDisp.c:
+ * generic/tkWindow.c:
+ * unix/tkUnixInt.h:
+ * unix/tkUnixPort.h:
+ * unix/Makefile.in:
+ * unix/configure.in:
+ * unix/tkConfig.sh.in:
+ * unix/tkUnix.c:
+ * unix/tkUnix3d.c:
+ * unix/tkUnixDraw.c:
+ * unix/tkUnixFont.c:
+ * unix/tkUnixMenubu.c: Stubs implementation for 8.1. Tk_Main() is
+ replaced with a macro which calls Tk_MainEx(). Tk can link to the Tcl
+ stubs library, wish links directly to Tcl and Tk. Use
+ --enable-tcl-stubs to link Tk to the Tcl stubs library (Unix), on
+ by default on Windows. Exported all public functions through the
+ stubs mechanism (see the *.decls files) and many of the internal
+ functions. Most of the changes dealt with shifting around the
+ function declarations in the header files. Mac code may not
+ compile, but it shouldn't take much work to fix this.
+
+ * mac/tkMacMenu.c: Added dummy TkpMenuThreadInit for Mac to be
+ consistent with Unix and Windows versions.
+
+1999-03-08 Lee Bernhard <lfb@scriptics.com>
+
+ * win/tkWinWm.c: Toplevel class no longer shared between
+ threads.
+
+ * win/tkWinX.c: Multiple threads no longer share the same
+ TkDisplay structure. Required because TkDisplay stores much
+ thread-specific data for a given thread.
+
+ * win/tkWinSend.c: Moved application instance handle out
+ out thread-local storage. DDE was failing to initialize
+ when the instance handles were different between threads.
+
+ * win/makefile.vc: Added THREADDEFINES for building with
+ threads enabled.
+
+ * generic/tkMenu.c:
+ * win/tkWinMenu.c:
+ * unix/tkUnixMenu.c: Added TkpMenuThreadInit for initializing
+ thread-specific Menu state.
+
+1999-03-01 Scott Redman <redman@scriptics.com>
+
+ * win/tkWinWm.c:
+ * win/tkWinPointer.c:
+ * win/tkWinInt.h: Fix "focus -force" for Windows. The Win32 API
+ function SetForegroundWindow() does not work unless the window
+ handle is a toplevel window (a Windows toplevel). The handle
+ being passed was a Tk toplevel, which is a child of the Windows
+ toplevel.
+
+1999-02-26 Scott Redman <redman@scriptics.com>
+
+ * win/cat.c: Remove this file, use the one in the Tcl source directory.
+
+ * win/makefile.vc: Remove the wishc.exe from the default targets. Add
+ a separate console-wish target to build it. The need for a
+ console-wish will go away soon, so we don't want to encourage its
+ use.
+
+1999-02-25 Scott Redman <redman@scriptics.com>
+
+ * win/tkWinWm.c: Properly initialize the tsdPtr->firstWindow field.
+
+ * win/cat.c: Code for cat32.exe, copied from the Tcl sources. Required
+ in order to run the test suite from the makefile
+
+ * win/winMain.c: Add main() for a console-based wishc.exe, which meant
+ adding code to disable the call to Tk_ConsoleInit().
+
+ * generic/tkConsole.c: Check the standard handles before creating the
+ new standard channels. This allows a windows app that has stdin,
+ stdout, or stderr to correctly connect to them.
+
+ * generic/tkMain.c: Add a proper check for the interactive mode, since
+ the standard channels may actually be connected in windows mode or
+ even in the console-based wish.
+
+ * win/makefile.vc: Add targets for wishc.exe (console-based wish) and
+ cat32.exe (for testing). Fix the test suite target so it can be run
+ from the makefile (which can happen since the standard handles have
+ been fixed).
+
+1999-02-12 Lee Bernhard <lfb@scriptics.com>
+
+ * generic/tkMenuButton.h:
+ * generic/tkMenuButton.c:
+ * mac/tkMacMenubutton.c:
+ * mac/tkMacDefault.h
+ * unix/tkUnixMenubu.c: Eliminated Tk_Uids used by -state option.
+ * unix/tkUnixDefault.h
+ * win/tkWinDefault.h
+
+ * generic/tk.h:
+ * generic/tkScale.h:
+ * generic/tkScale.c:
+ * generic/tkWindow.c:
+ * unix/tkUnixScale.c:
+ * unix/tkUnixDefault.h:
+ * unix/tkWinDefault.h:
+ * mac/tkMacDefault.h: Objectified scale widget.
+
+ * win/tkWinX.c: Removed Thread-specific data from process
+ initialization code that was stopping the Tk Dll from
+ loading.
+
+1999-02-11 Scott Stanton <stanton@GASPODE>
+
+ * README:
+ * generic/tk.h:
+ * unix/configure.in:
+ * win/README:
+ * win/makefile.bc:
+ * win/makefile.vc: Updated version to 8.1b2.
+
+ * unix/tkUnixSend.c: Fixed one more Tcl_*ObjVar instance.
+
+1999-02-04 Scott Stanton <stanton@GASPODE>
+
+ * Various cleanup related to the Tcl_Eval and Tcl_ObjSetVar
+ changes in Tcl.
+
+ INTEGRATED PATCHES FROM 8.0.5b2:
+
+ * win/tkWinMenu.c (TkpDestroyMenu): Changed so modalMenuPtr is
+ cleared when it is being destroyed.
+
+ * generic/tkImgPhoto.c: Changed so color tables are freed
+ immediately instead of being delayed. This ensures that color
+ tables are properly disposed at process exit.
+
+ * library/prolog.ps: Changed string that determines font height to
+ include European character with an umlaut.
+
+ * generic/tkImgBmap.c (ImgBmapConfigureInstance): If an image
+ mask changed but ended up with the same XID, the GC failed to be
+ updated and so the new mask was not used. [Bug: 970]
+
+ * generic/tkFocus.c (SetFocus): Changed so focus window is always
+ set if -force is specified. This fixes the problem on Windows
+ where Tk does not activate the window if it already has focus.
+
+ * generic/tkConsole.c: Fixed so errors in console eval are
+ reported properly. Eliminated duplicate result messages. [Bug: 973]
+
+ * win/tkWinWm.c: Changed so windows that aren't resizable don't
+ have resize handles and the zoom box is disabled.
+
+ * win/tkWinInt.h:
+ * win/tkWinPointer.c: Changed to cancel the mouse timer when a
+ user initiated move/resize loop begins.
+
+ * unix/configure.in: TK_LD_SEARCH_FLAGS was set incorrectly if
+ SHLIB_LD_LIBS='${LIBS}', and shared linking is performed through
+ the C compiler. Systems affected are Linux, MP-RAS and NEXTSTEP,
+ but also with gcc on many more systems. [Bug: 908]
+
+ * win/makefile.vc: First stab at install target. Fixed quoting so
+ paths with spaces work.
+
+ * tests/main.test:
+ * tests/unixWm.test: Better cleanup of temporary files.
+
+ * mac/tkMacAppInit.c:
+ * generic/tkTest.c:
+ * generic/tkAppInit.c:
+ * win/winMain.c: Changed some EXTERN declarations to extern
+ since they are not defining exported interfaces. This avoids
+ generating useless declspec() attributes and makes the windows
+ makefile simpler.
+
+ * library/menu.tcl (tkMenuFind): Changed so keyboard shortcuts
+ will only be found in the current toplevel. Previously, they
+ might be found in menus attached to other toplevels that might not
+ even be mapped. [Bug: 924]
+
+ * generic/tkCanvLine.c: Changed to treat zero width lines like
+ they have width 1 for purposes of selection. [Bug: 925]
+
+ * win/tkWinFont.c (Tk_MeasureChars): Added a workaround for a bug
+ in GetTextExtentExPoint on Win NT 4.0/Japanese. [Bug: 1006]
+
+ * unix/tkUnixSend.c (Tk_SetAppName): Fixed uninitialized memory
+ access bug. [Bug: 919]
+
+1999-1-28 Scott Stanton <stanton@GASPODE>
+
+ * generic/tkGrid.c: Fixed bug in "grid forget" that failed to cancel
+ pending idle handlers, resulting in a crash in a few odd cases.
+
+1999-01-06 Lee Bernhard <lfb@JUSTICE>
+
+ * generic/tk.h, generic/tkGet.c, generic/tkConfig.c,
+ * generic/tkOldConfig.c, generic/tkEntry.c, generic/tkMenubutton.c,
+ * generic/tkMenubutton.h, generic/tkScale.c, generic/tkScale.h,
+ * generic/tkTextDisplay.c, generic/tkText.c, unix/tkUnixMenubu.c,
+ * unix/tkUnixScale.c, mac/tkMacMenu.c, mac/tkMacMenubutton.c,
+
+ Removed global Tk_Uids dealing with "-state" configuration option
+ and added new TK_CONFIG_STATE configSpec that doesn't use
+ Tk_Uids.
+
+1998-12-11 === Tk 8.1b1 Release ===
+
+1998-12-11 Scott Stanton <stanton@GASPODE>
+
+ * generic/tkMain.c (Tk_Main): Fixed improper command line encoding
+ handling.
+
+1998-12-08 Scott Stanton <stanton@GASPODE>
+
+ * win/tkWinClipboard.c (TkSelGetSelection, TkWinClipboardRender):
+ Changed to handle multibyte characters properly. [Bug: 935]
+
+1998-12-07 Scott Stanton <stanton@GASPODE>
+
+ * library/xmfbox.tcl (tkMotifFDialog_Create): In the cached case,
+ the data array was not being initialized with the correct set of
+ widgets.
+
+1998-12-4 Brent Welch <welch@SAGE>
+
+ * Changed patchLevel to 8.1b1
+
+ * generic/tkMenu.c (ConfigureMenuCloneEntries): The -menu configuration
+ option was being incorrectly specified as just "menu".
+
+1998-11-30 Scott Stanton <stanton@GASPODE>
+
+ * generic/tkButton.c (ConfigureButton): The error result was
+ getting lost when restoring configuration options. [Bug: 619]
+
+1998-11-25 Scott Stanton <stanton@GASPODE>
+
+ * unix/tkUnixFont.c (GetFontAttributes): Initialize an unspecified
+ family to an empty string.
+ (FontMapLoadPage): if the font included characters below 32, the
+ index computation was incorrect because the range was shifted up
+ to 32.
+ (CreateClosestFont): check for empty locale as well as NULL.
+
+ * generic/tkFont.c (TkFontParseXLFD): initialize charset to
+ iso8859-1 if no charset is specified.
+
+ * mac/tkMacHLEvents.c (OdocHandler): added conversion from
+ external string to UTF [Bug: 869]
+
+ * integrated tk8.0.4 changes.
+
+ * generic/tkBind.c: fixed deletion order bug where a crash would
+ result if a binding deleted "."
+
+ * generic/tkMenu.c (MenuWidgetObjCmd): disabled menu entries were
+ getting reenabled whenever the mouse passed over the entry [Bug: 860]
+
+ * unix/tkUnixMenu.c (TkpComputeStandardMenuGeometry): hidemargin
+ option was not honored properly in menus [Bug: 859]
+
+1998-11-24 Scott Stanton <stanton@GASPODE>
+
+ * tkMacMenu.c, tkUnixMenu.c, tkWinMenu.c, tkMenuDraw.c, tkMenu.h,
+ * tkMenu.c: Backed out the previous fix for bug 620 and
+ eliminated a bunch of code that created unnecessary objects.
+ Changed back to using internal types instead of objects for many
+ configuration options. There are many more fixes like this that
+ could be made, but some require a little restructuring of the
+ code. In any case the leaks are fixed and there is a lot less
+ allocation happening. [Bug: 620]
+
+1998-11-19 Scott Stanton <stanton@GASPODE>
+
+ * tkMenu.c (DestroyMenuEntry): fixed memory leaks [Bug: 620]
+
+ * tkWinX.c (GetTranslatedKey): fixed bad code merge
+
+ * tkWinWm.c, tkWinMenu.c: fixed titles and menus so they properly
+ display Unicode [Bug: 819]
diff --git a/ChangeLog.2004 b/ChangeLog.2004
new file mode 100644
index 0000000..5a02238
--- /dev/null
+++ b/ChangeLog.2004
@@ -0,0 +1,3653 @@
+2004-12-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tcl.m4, win/configure: update MSVC CFLAGS_OPT to -O2, remove -Gs
+ (included in -O2) and -GD (outdated). Use "link -lib" instead of "lib"
+ binary and remove -YX for MSVC7 portability. Add -fomit-frame-pointer
+ for gcc OPT compiles. [Bug 1092952, 1091967]
+
+2004-12-21 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/demos/*.tcl: Add [package require Tk] to all the widget demo
+ scripts so they follow standard practice better. [FRQ 815118]
+
+2004-12-20 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkFileFilter.c:
+ * generic/tkFileFilter.h:
+ * macosx/tkMacOSXDialog.c:
+ * win/tkWinDialog.c:
+ * tests/filebox.test:
+ * tests/winDialog.test: Corrected handling of MacOS file types in
+ tk_*file dialogs [Bug 1083878].
+
+2004-12-20 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/panedwindow.n: Fix silly typo. [Bug 1087842]
+
+2004-12-19 Chengye Mao <chengye.geo@yahoo.com>
+
+ * win/tkWin.h, win/tkWinEmbed.h: Make embedding work better on Windows.
+ * win/tkWinWm.c, win/tkWinX.c: [Bugs 222677, 831627, 842945, 1024364]
+
+2004-12-17 Chengye Mao <chengye.geo@yahoo.com>
+
+ * generic/tkFrame.c: Make container windows display their
+ * generic/tkWindow.c: background when they don't have content.
+
+2004-12-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * unix/tk.spec, macosx/Tk-Info.plist, macosx/Wish-Info.plist:
+ * macosx/Wish.pbproj/project.pbxproj, README, win/configure.in:
+ * unix/configure.in, generic/tk.h: Bump version to 8.5a3.
+
+2004-12-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4: synced with tcl/unix/tcl.m4
+ * unix/configure: regen
+
+2004-12-09 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
+ Added guards so that rescanning for the complex-alpha check is not done
+ in the common case of creating a simple image a bit at a time, or any
+ other time where the image was simple before and the input data has no
+ alpha channel. [Bug 1081966]
+
+2004-12-07 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/canvPs.test: Cleaned up the matching of [makeFile] and
+ * tests/choosedir.test: [removeFile] commands as indicated by the
+ * tests/filebox.test: results of a -debug 1 run of the test suite.
+ * tests/imgPPM.test: Tk test suite is now -debug 1 clean. This
+ * tests/imgPhoto.test: completes fixing [1078648].
+ * tests/listbox.test:
+ * tests/main.test:
+
+2004-12-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/bind.test, tests/button.test, tests/canvas.test:
+ * tests/cursor.test, tests/scrollbar.test: Eliminate all duplicate test
+ names. [Bug 1078648 again]
+
+2004-12-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.5a2 TAGGED FOR RELEASE ***
+
+2004-12-06 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/safe.test: Trim auto_path to improve performance [1080039]
+
+2004-12-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * changes: updated for 8.5a2 release
+
+2004-12-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/*.test: Resolve duplicate test names. [Bug 1078648]
+
+2004-12-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Make
+ overlay compositing where the target is empty no longer set the target
+ to magical gray, and also make sure that the complex-alpha flag is
+ toggled when necessary. [Patch 848161]
+
+2004-12-01 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixButton.c (TkpDisplayButton): constrain coords to
+ Tk_RedrawImage to display only portion that is valid.
+ * generic/tkImgPhoto.c (ImgPhotoDisplay): add X error suppression
+ around XGetImage to prevent app abort. [Bug 979239]
+
+2004-11-28 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c(Tk_DrawChars): Check for short integer overflow in
+ x,y coordinates [Fixes: Bug 942320 "Tk, Xft, text and long lines"]
+
+2004-11-26 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: Shell targets needed more stack space. [Bug 1066755]
+
+2004-11-20 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/text.test: fix to test's platform sensitivities [Bug 1025871]
+ * tests/textDisp.test: made test less timing sensitive [Bug 1034171],
+ and fixed a platform-sensitive test [Bug 966845]
+
+2004-11-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: reverted earlier changes for
+ tclConfig.h changes to tcl, since those have been reverted for now.
+
+ Note that newly added macosx/Wish.xcode will not work without
+ tclConfig.h, this project has not been removed again.
+
+2004-11-18 Reinhard Max <max@suse.de>
+
+ * unix/tcl.m4 (SC_CONFIG_MANPAGES): Applied an improved version of
+ * unix/configure.in: [Patch 996085], that introduces
+ * unix/Makefile.in: --enable-man-suffix.
+
+ * unix/installManPage: added
+ * unix/mkLinks.tcl: removed
+ * unix/mkLinks: removed
+ * unix/configure: generated
+
+2004-11-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkCanvWind.c (ConfigureWinItem): unmap windows immediately
+ when state hidden is requested. [Bug 982248]
+
+ * generic/tkCanvImg.c (ImageToPostscript): don't try ps generation of
+ canvas image item without image specified. [Bug 1032300]
+
+ * library/console.tcl (::tk::console::ExpandVariable): correct array
+ keyname expansion. [Bug 1004508] (bold)
+
+ * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd): set save_under X attr
+ to prevent expose events when moving sash. [Bug 1036963]
+
+2004-11-16 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * doc/text.n: clarified documentation on use of -tabs option.
+
+2004-11-16 Don Porter <dgp@users.sourceforge.net>
+
+ * library/msgs/it.msg: Updated Italian message catalog. Thanks to
+ Roberto Ugoccioni [Bug 1063675].
+
+2004-11-16 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/buildTkConfig.tcl: fixes for tclConfig.h changes.
+
+ * macosx/Wish.pbproj/project.pbxproj: fixed references to renamed
+ bitmap files.
+
+ * macosx/Wish.xcode/project.pbxproj (new):
+ * macosx/Wish.xcode/default.pbxuser (new):
+ * macosx/Wish-Info.plist (new):
+ * macosx/Tk-Info.plist (new): added new Xcode 1.5 project using native
+ targets, made possible by tclConfig.h changes.
+
+ * generic/tk.h: added version number change comments for new files.
+
+2004-11-15 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c: fix to multi-line search problem and removed
+ * tests/text.test: 'knownBug' from one test.
+
+2004-11-15 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * unix/tcl.m4, unix/configure.in: Expanded all AC_DEFINE calls to the
+ three-argument form and ported recent changes to the tcl.m4 from the
+ Tcl distribution. *No* call to AC_CONFIG_HEADERS has been added; this
+ change should be virtually entirely cosmetic.
+
+2004-11-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXXStubs.c: implemented XGetGeometry().
+
+2004-11-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkCmds.c (Tk_TkObjCmd): use correct screen data when
+ -displayof arg is passed to [tk scaling]. [Bug 800178]
+
+2004-11-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * doc/SetOptions.3:
+ * doc/text.n: fixed *roff errors uncovered by running 'make html'.
+
+ * macosx/tkMacOSXFont.c (Tk_MeasureChars,Tk_DrawChars,etc): Make sure
+ that the lastSubFontPtr remains valid even when the subfont array is
+ reallocated. [Bug 618872]
+
+2004-11-11 Reinhard Max <max@suse.de>
+
+ * generic/tkEvent.c (InvokeInputMethods): Call XSetICFocus whenever the
+ window receives focus. This fixes [Bug 905830] but avoids [Bug 1000051]
+
+2004-11-11 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkMain.c:
+ * macosx/tkMacOSXAppInit.c (removed):
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXInt.h: changes to make TkAqua dynamically loadable,
+ enabling [package require Tk] from tclsh. Startup code from
+ tkMacOSXAppInit.c moved into tkMacOSXInit.c, added code that notifies
+ the window server that an unbundled executable is a full GUI
+ application after loading Tk. [Patch 1035348]
+
+ * doc/wm.n: documented [wm attributes] on Mac OS X. [Bug 606665]
+ * macosx/tkMacOSXWm.c: implemented TIP 222 [wm attributes -alpha] on
+ Mac OS X. [Patch 892194]
+ WmIconbitmapCmd: adopted FSRef changes from [wm atttrs -titlepath].
+
+ * macosx/tkMacOSXSubwindows.c: synced spacing/formatting with
+ core-8-4-branch.
+
+ * generic/tkRectOval.c:
+ * macosx/README:
+ * macosx/tkMacOSXDefault.h:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXWm.c: forward port from core-8-4-branch of Jim's and
+ my changes for CG drawing and [wm attributes] (corresponds to 8.4
+ changes dating from 09-18, 07-27, 07-24).
+
+ * macosx/tkMacOSXMouseEvent.c: endianness fixes.
+
+ * macosx/Wish.pbproj/project.pbxproj: corrected path to html help
+ inside framework.
+
+ * macosx/Makefile: prevent parallel make from building several targets
+ at the same time.
+
+2004-11-09 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXButton.c: fix to dynamic reconfiguration of button
+ '-compound' options (cosmetic problem), [Bug 1055023]
+
+ * tests/text.test: added 'knownBug' 20.172.1 in text widget multiline
+ search routines.
+
+2004-11-08 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/demos/goldberg.tcl: Added slightly adapted version of Keith
+ Vetter's tkGoldberg as the final animation demo. Many many thanks to
+ Keith for giving his permission! [FRQ 627466]
+
+2004-11-07 Peter Spjuth <peter.spjuth@space.se>
+
+ * doc/frame.n: Added some info for -width/-height options. [Bug
+ 1055423]
+
+2004-11-07 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/grid.test:
+ * generic/tkGrid.c: Made handling of ^ a bit more consistent in corner
+ cases. This makes ^ work without any widgets in the same command. [Bug
+ 962589]
+
+2004-11-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/demos/pendulum.tcl: Added demonstrations of how to do
+ * library/demos/aniwave.tcl: animations using Tcl/Tk to the widget
+ * library/demos/anilabel.tcl: demo.
+
+2004-11-03 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/button.test: Update expected results to account for more
+ verbose errorinfo from errors in variable traces [Tcl Bug 572164]
+
+2004-11-01 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/dialog.test (dialog-1.1): Update expected result to changes in
+ the error messages produced by procs.
+
+2004-10-29 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Add Win32 test cases for attributes subcommand.
+ * win/tkWinWm.c (WmAttributesCmd): Fixup broken option processing logic
+ for attributes subcommand.
+
+2004-10-28 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWin32Dll.c (DllMain, _except_dllmain_detach_handler): Rework
+ pushing of exception handler function pointer so that compiling with
+ gcc -O3 works. Remove empty function call to avoid compiler warning.
+ Mark the DllMain function as noinline to avoid compiler error from
+ duplicated asm labels in generated code.
+
+2004-10-28 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * unix/tkUnixScale.c (DisplayHorizontalValue): Fix for [Bug 220927] by
+ Michael Schlenker to keep the labels within the window.
+
+2004-10-28 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/*.n: Assorted minor documentation fixes.
+
+2004-10-26 David Gravereaux <davygrvy@pobox.com>
+
+ * win/tkWinX.c: Signature for tkWinXCleanup needed to be
+ * generic/tkInt.decls: changed so it matches the Tcl_ExitProc
+ * generic/tkIntPlatDecls.h: typedef to avoid a bad-style cast.
+
+ * win/makefile.vc: Force TCL_LIBRARY envar when calling tclsh
+
+2004-10-26 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinRegion.c (TkpBuildRegionFromAlphaData): Fixed syntax error
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock): Removed unreferences vars.
+
+2004-10-26 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * macosx/tkMacOSXRegion.c (TkpBuildRegionFromAlphaData):
+ * win/tkWinRegion.c (TkpBuildRegionFromAlphaData): Factor out the
+ * unix/tkUnix.c (TkpBuildRegionFromAlphaData): building of region
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock): data to permit
+ better implementations on particular platforms. [Bug 919066]
+
+2004-10-24 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ TIP#177 AND TIP#179 IMPLEMENTATIONS
+
+ * doc/panedwindow.n: Docs for -hide and -stretch options.
+ * tests/panedwindow.test: Basic tests of -hide and -stretch options.
+ * generic/tkPanedWindow.c (Slave,slaveOptionSpecs,ComputeGeometry):
+ (DisplayPanedWindow,ArrangePanes,MoveSash,PanedWindowIdentifyCoords):
+ Add hide flag and stretch setting to list of options supported on a
+ panedwindow's slaves. [Patch 983886] Much thanks to Brian Griffin for
+ these options.
+
+2004-10-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (UpdateWrapper): pass SWP_NOOWNERZORDER to SetWindowPos
+ when maintaining win Z order, to prevent parent from flashing (when
+ adjusting Z order).
+
+2004-10-19 Joe English <jenglish@users.sourceforge.net>
+
+ TIP#204 IMPLEMENTATION
+
+ * library/tk.tcl, library/entry.tcl, library/spinbox.tcl:
+ TIP #204 "Virtual Events for Keyboard Traversal" [Patch 976928]
+
+2004-10-19 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/canvPsImg.tcl, tests/canvPsBmap.tcl:
+ * generic/tkBitmap.c, bitmaps/*.bmp:
+ * library/demos/icon.tcl, library/demos/items.tcl:
+ * library/demos/label.tcl, library/demos/menu.tcl:
+ * library/demos/ruler.tcl, library/demos/twind.tcl:
+ * library/demos/images/*.bmp: Renamed all X bitmap files files to have
+ an .xbm extension so Windows users won't get confused when wandering
+ around the Tcl source tree. [Bug 733835]
+
+2004-10-11 Miguel Bañon <bagnonm@users.sourceforge.net>
+
+ * library/msgs/sv.msg: Swedish message catalog from Mats Bengtsson.
+
+2004-10-09 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/wm.n: Recorded what attribute values are supported on OSX though
+ I don't know what they do.
+
+2004-10-08 Joe English <jenglish@users.sourceforge.net>
+
+ TIP#205 IMPLEMENTATION
+
+ * unix/tkUnixRFont.c: TIP #205 "Use pkgconfig Database to Register Xft
+ Support".
+
+2004-10-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ TIP#159 IMPLEMENTATION
+
+ * doc/wm.n (iconphoto): Added support for Tk photo images as
+ * generic/tkInt.h (TkDisplay): title-bar icons. TIP #159
+ * win/tkWinWm.c (WmIconphotoCmd): "wm iconphoto ?-default? image1 ..."
+ * macosx/tkMacOSXWm.c (WmIconphotoCmd): Implemented for Win/Unix,
+ * unix/tkUnixWm.c (WmIconphotoCmd): stubbed out for OS X.
+ * tests/wm.test, tests/unixWm.test, tests/winWm.test: [Bug 815751]
+
+2004-10-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkTextWind.c (EmbWinDelayedUnmap): Fix init warnings
+ * generic/tkTextTag.c (TkTextCreateTag):
+ * generic/tkTextMark.c (TkTextSetMark):
+ * generic/tkTextIndex.c (GetIndex):
+ * generic/tkUndo.c (EvaluateActionList):
+
+2004-09-24 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkCursor.c: Add missing initialization in debug routine.
+
+2004-09-24 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * library/text.tcl: corrected mousewheel scrolling [Bug 960190]
+
+ * tests/textDisp.test: made some tests more robust to slowness in
+ asynchronous height calculation callbacks [Bug 1025781]
+
+2004-09-24 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinX.c: Added declaration for advapi32 now that this file uses
+ the Reg* functions (req'd for nmake build system).
+
+2004-09-23 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTest.c
+ * tests/text.test: fix and tests for [Bug 1026485] - negative text
+ search ranges should not lead to any matches.
+
+2004-09-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinInt.h (TkWinDisplayChanged): added decl
+ * win/tkWinX.c (TkWinDisplayChanged, TkpOpenDisplay): Correctly handle
+ * win/tkWinWm.c (InvalidateSubTreeDepth, WmProc): color and screen
+ resolution changes. Tested for 16/24/32 bpp changes on XP. May need
+ more fixes for 8bpp switch, use of special colormaps, or other special
+ palette handling cases. [Bug 223689]
+
+2004-09-21 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkInt.decls: Add decl for TkWinGetPlatformTheme. It is only
+ defined under Win32.
+ * generic/tkIntPlatDecls.h: Regen.
+ * generic/tkStubInit.c: Regen.
+ * win/tkWinInt.h: Define TK_THEME_WIN_CLASSIC and TK_THEME_WIN_XP.
+ * win/tkWinMenu.c (DrawMenuEntryAccelerator, DrawMenuEntryLabel): Draw
+ a disabled 3D text highlight for the accelerator only with the Win95/98
+ look. Same goes for the menu entry text.
+ * win/tkWinX.c (TkWinGetPlatformId, TkWinGetPlatformTheme):
+ Automatically detect the Windows theme in use and return either
+ TK_THEME_WIN_CLASSIC or TK_THEME_WIN_XP when the TkWinGetPlatformTheme
+ function is invoked. [Patch 866194]
+
+2004-09-21 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinWm.c: Rework WS_EX_LAYERED and LWA_ALPHA defines so that
+ compiling with mingw works again.
+
+2004-09-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (UpdateWrapper, WmAttributesCmd): handle attribute
+ settings prior to window mapping and resort to more forceful wrapper
+ update again for -toolwindow (to remove it from taskbar).
+
+2004-09-19 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/*: Standardize style of references to manual sections and public
+ Tcl symbols along the lines of what I set out in [Tcl Patch 1022527].
+
+2004-09-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (WmAttributesCmd): correct -alpha 0.0/1.0 setting and
+ round the value.
+ (UpdateWrapper): don't adjust Z order of TOPMOST window.
+ (WmAttributesCmd): don't call UpdateWrapper for -disabled or
+ -toolwindow attr changes.
+
+2004-09-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ TIP#222 IMPLEMENTATION
+
+ * doc/wm.n:
+ * tests/winWm.test: Add 'wm attributes -alpha' to control toplevel
+ * win/tkWinInt.h: alpha transparency on Win2K/XP+.
+ * win/tkWinWm.c: TIP #222 [Patch 892194]
+
+ * win/tkWinWm.c (UpdateWrapper): Ensure that we maintain Z order and
+ * tests/winWm.test: focus of preexisting window when
+ replacing the wrapper window.
+
+2004-09-16 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc : added VC7-safe environment check as used in the Tcl
+ makefile.vc [Bug 1029349]
+
+2004-09-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkMenu.c (MenuWorldChanged): ensure that we recompute the
+ menu geometry on WorldChanged to handle font size changes. [Bug 607649]
+
+2004-09-16 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/place.test:
+ * generic/tkPlace.c: Fixed a memory leak when a placed widget was
+ forgotten. [Bug 1028888]
+
+2004-09-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinWm.c (WmIconwindowCmd): Replace bogus call to
+ XWithdrawWindow with proper code. This avoids a "couldn't send withdraw
+ message to window manager" error when the iconwindow is already mapped.
+ The wm iconwindow command does not seem to do much under Win32, but at
+ least this avoids an error message.
+
+2004-09-13 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (ReadIconFromFile): fix mem alloc to get the right size
+ for both icons ('?:' order of precedence mistake).
+
+2004-09-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/tkfbox.tcl (::tk::dialog::file::): Make sure that the state
+ is reset properly when starting to run the dialog. [Bug 845189]
+
+ * library/demos/filebox.tcl: Stop the use of tk_strictMotif from
+ poisoning the rest of the widget demo. [Bug 1013942]
+
+2004-09-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (ActivateWindow): SetFocus to grab window when clicking
+ outside the grab window hierarchy. [Bug 220908]
+ (UpdateWrapper): update to 2004-06-12 Kovalenko to account for whether
+ the override window has a transient parent, and apply WS_POPUP in the
+ correct case. The makes splash screens pop up as well as making
+ dropdowns not grab focus away from the parent.
+
+2004-09-10 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ TIP#169 IMPLEMENTATION
+
+ * doc/text.n, generic/tkTest.c, generic/tkText.c, generic/tkText.h:
+ * generic/tkTextBTree.c, generic/tkTextDisp.c, generic/tkTextImage.c:
+ * generic/tkTextIndex.c, generic/tkTextMark.c, generic/tkTextTag.c:
+ * generic/tkTextWind.c, generic/tkUndo.c, generic/tkUndo.h:
+ * library/text.tcl, library/demos/twind.tcl, library/demos/widget:
+ * tests/text.test, tests/textImage.test, tests/textIndex.test:
+ * tests/textWind.test: implementation of TIP#169, which provides the
+ new '$text peer' widget subcommand. This includes new documentation,
+ tests, and an extension to the text widget demos to illustrate some of
+ the new features. Many thanks also to Brian Griffin for the initial
+ implementation.
+
+2004-09-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/panedwindow.test: bulletproof 23.2 result [Bug 1019100]
+
+ * win/tkWinWm.c (ReadIconFromFile): when using SHGetFileInfo to
+ retrieve icon, get regular icon as well for correct Alt-Tab icon.
+
+2004-09-09 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/wish.1: Added note that the -use option is linked to the frame's
+ -container option to help with [Bug 1024364]
+
+2004-09-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/tkfbox.tcl (::tk::dialog::file::Create): use label instead of
+ button for "File of type", as it properly handles -state disabled now.
+
+2004-09-06 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Set TK_LIBRARY when execing Tk apps (test, runtest,
+ rundemo).
+
+2004-09-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * macosx/tkMacOSXMenus.c (GenerateEditEvent):
+ * macosx/tkMacOSXMenu.c (MenuSelectEvent):
+ * win/tkWinMenu.c (MenuSelectEvent): Make sure everywhere that needs to
+ NULL-out the user_data field does actually do so. (Code that uses
+ bzero() or memset() for the task just needs to be rebuilt to work).
+ [Bug 1021812]
+
+2004-09-01 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/bind.test (bind-22.163): Fix inadvertent minor breakage from
+ TIP#165. [Bug 1019085]
+
+ * doc/toplevel.n, doc/loadTk.n: More spelling/abbreviation fixes from
+ Mikhail Kolesnitchenko.
+
+2004-08-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ TIP#165 IMPLEMENTATION
+
+ * generic/tk.h (XVirtualEvent): Added user_data field to structure.
+ * generic/tkBind.c (ExpandPercents, HandleEventGenerate):
+ * generic/tkEvent.c (Tk_HandleEvent): Handle putting data into the
+ user_data field, passing it to scripts as %d substitution, and
+ releasing the field's contents once the event has been processed.
+ * doc/bind.n, doc/event.n, tests/bind.test: Docs + tests.
+
+2004-08-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/text.tcl (::tk::TextTranspose): Ensure that Transpose is an
+ atomic op to undo.
+
+2004-08-25 Don Porter <dgp@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c: Made use of Tcl_WrongNumArgs in a few
+ * win/tkWinMenu.c: appropriate spots.
+
+2004-08-22 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/SetOptions.3, doc/SetClassProcs.3, doc/MeasureChar.3:
+ * doc/GetVRoot.3, doc/GetHWND.3, doc/GetDash.3, doc/GetBitmap.3:
+ * doc/FontId.3, doc/CrtItemType.3, doc/ConfigWidg.3, doc/GetCursor.3:
+ More doc fixes from Mikhail Kolesnitchenko. [Patch 1013520]
+
+2004-08-20 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/TkInitStubs.3, doc/photo.n, doc/ParseArgv.3, doc/options.n:
+ * doc/keysyms.n, doc/font.n: More doc fixes. [Patch 1012837]
+
+ * doc/place.n, doc/pack.n, doc/grid.n, doc/getOpenFile.n:
+ * doc/event.n, doc/chooseDirectory.n, doc/bind.n:
+ Spelling and grammar fixes from Mikhail Kolesnitchenko. [Patch 1012083]
+
+ * tests/canvas.test (canvas-17.1): Report the result of the test so
+ that it can be compared. [Bug 1012331]
+
+2004-08-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinDialog.c (Tk_MessageBoxObjCmd): Inherit the icon from the
+ * win/tkWinInt.h: -parent window for the
+ * win/tkWinWm.c (TkWinGetIcon): MessageBox.
+
+2004-08-19 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c: Cast argument 7 of XChangeProperty to 'const
+ unsigned char *' (from 'const char *') to satisfy Solaris 8 Forte C
+ compiler [Bug 1012325]
+
+2004-08-19 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/safe.test (safe-1.3): Made test less sensitve to the full set
+ of existing aliases in an interp, so the it only tests whether the
+ tested ones are present.
+
+ * unix/Makefile.in: Copied LD_LIBRARY_PATH machinery from `make shell`
+ target to other similar targets so that just built libraries are
+ tested, rather than previous installations.
+
+2004-08-19 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ TIP#168 IMPLEMENTATION
+
+ * generic/tkTrig.c (TkMakeRawCurve, TkMakeRawCurvePostscript):
+ * generic/tkInt.decls: New functions to handle the geometry for "raw"
+ bezier curves.
+ * generic/tkCanvUtil.c (tkRawSmoothMethod, InitSmoothMethods)
+ (TkSmoothParseProc): Add new type of smoothing method, simplify the
+ method initialization, and change the old smoothing method to be called
+ "true" and just keep "bezier" as an alias.
+ * tests/canvas.test (canvas-17.1): Basic test of built-in smoothing
+ method support.
+ * doc/canvas.n: Documentation updates.
+
+2004-08-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkPanedWindow.c (optionSpecs): Add missing GEOMETRY flag to
+ -handlepad option. [Bug 1010938]
+
+2004-08-17 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/menu.n, doc/text.n: Assorted fixes, including spelling fixes from
+ Mikhail Kolesnitschenko. [Patch 1010083]
+
+ * doc/spinbox.n, doc/scrollbar.n, doc/scale.n, doc/panedwindow.n:
+ * doc/message.n, doc/listbox.n, doc/entry.n, doc/button.n:
+ More spelling fixes from Mikhail Kolesnitschenko. [Patch 1010607]
+
+2004-08-16 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/button.n, doc/checkbutton.n, doc/label.n, doc/menubutton.n:
+ * doc/radiobutton.n: Added cross-reference to new standard option.
+ * doc/options.n: Added standard documentation for the -compound
+ option. [Bug 712588]
+
+ * doc/canvas.n: Spelling and grammar fixes from Mikhail
+ Kolesnitschenko. [Bug 1009636]
+
+2004-08-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/tkfbox.tcl (ResolveFile): Added some environment variable
+ handling; this isn't perfect, but should do what most people want most
+ of the time. [FRQ 979101]
+ * library/xmfbox.tcl (MotifFDialog_BuildUI): Fix [Bug 987169] in the
+ Motif file dialogs as well.
+
+2004-08-10 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c: Fix for [Bug 1006686] "wm resizable command not
+ working on Solaris/CDE" (patch from Colin McDonald).
+
+2004-08-09 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/canvText.test:
+ * win/tkWinFont.c (Tk_MeasureChars): Fix for text wrapping problem that
+ appeared using canvas text under Win32. A long wrapping string that had
+ leading spaces was being incorrectly wrapped. This change makes the
+ Win32 implementation behave the same as the Unix implementation. [Patch
+ 1006286]
+
+2004-08-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/clrpick.tcl (BuildDialog):
+ * library/msgbox.tcl (MessageBox): Add scheme for cancelling dialog
+ boxes with Escape and also handle what happens when the window gets
+ nuked from outside. [Bug 987169]
+
+2004-08-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgPhoto.c (ImgPhotoBlendComplexAlpha): Clean the code up a
+ bit and add a few more comments.
+ (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Clarified the code,
+ corrected the compositing rule now that I have looked up what the right
+ thing to do is, and factorized out the compositing rule code into a few
+ simpler macros.
+
+2004-07-30 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/configure:
+ * unix/tcl.m4 (SC_CONFIG_CFLAGS): Darwin: instead of setting PLAT_OBJS
+ to explict object files in tcl.m4, refer to MAC_OSX_OBJS makefile var.
+
+2004-07-29 George Peter Staplin <georgeps@xmission.com>
+
+ * generic/tkEvent.c (TkQueueEventForAllChildren): Code from the
+ core-8-4-branch to not queue events for unmapped windows was added.
+
+2004-07-27 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkImgGIF.c (FileReadGIF): fix crash reported by Reinhard
+ Max: in case of premature end of image data, return error instead of
+ passing nil buffer to Tk_PhotoPutBlock().
+
+2004-07-22 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/tkfbox.tcl (::tk::dialog::file::Update): use -directory [pwd]
+ (instead of .) to get around some VFS edge case bugs. Correct args
+ passes to tk_messageBox when failing to cd. Add -force back to
+ namespace import of msgcat.
+
+2004-07-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkEvent.c (InvokeInputMethods): ensure IC focus is set after
+ creation. [Bug 905830]
+
+2004-07-20 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Makefile: added support to tk framework build to optionally
+ install tk manpages in addition to html help, similarly to
+ tcl/macosx/Makefile.
+
+ * macosx/Wish.pbproj/project.pbxproj: fixes for building with
+ non-default SYMROOT/OBJROOT/SRCROOT, added support for using a
+ Tcl.framework in DYLIB_INSTALL_PATH != /Library/Frameworks, added
+ optional support for building html help without tcl sources present by
+ giving explicit location of tcltk-man2html script.
+
+ * macosx/tkMacOSXMenu.c: fixed #include case sensitivity bug.
+
+ * unix/Makefile.in:
+ * win/Makefile.in: added 'install-private-headers' makefile target to
+ allow optionally installing private tk headers. [Tcl FR 922727]
+
+2004-07-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in, unix/tcl.m4: move (C|LD)FLAGS after their
+ * unix/configure.in, unix/configure: _DEFAULT to allow for env setting
+ to override m4 switches.
+ Consolidate header checks to limit redundancy in configure.
+ (CFLAGS_WARNING): Remove -Wconversion
+ (SC_ENABLE_THREADS): Set m4 to force threaded build when built against
+ a threaded Tcl core.
+ Reorder configure.in for better 64-bit build configuration, replacing
+ EXTRA_CFLAGS with CFLAGS. [Bug 874058]
+
+2004-07-14 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXCursor.c (TkpSetCursor): The code to not reset the
+ cursor more often than necessary was getting fooled when the current
+ cursor was nulled out when the current cursor gets freed. So in the
+ case where the input cursor was NULL, we have to just always set it.
+ [Bug 894550]
+
+2004-07-13 Don Porter <dgp@users.sourceforge.net>
+
+ * library/tkfbox.tcl: Corrected coding errors in most recent change.
+ Use [bind $w], not [$w configure] to modify bindings.
+
+2004-07-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/tkfbox.tcl (::tk::dialog::file::Create): Watch out for users
+ destroying the dialog indirectly. [Bug 987169]
+
+2004-07-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/canvas.n: Add paragraph to make clearer what is going on with the
+ default canvas origin. [Bug 956681]
+
+2004-07-05 George Peter Staplin <GeorgePS@XMission.com>
+
+ * generic/tkEvent.c: TK_XIM_SPOT preprocessor usage was modified
+ slightly to fix a bug that occured when TK_XIM_SPOT was defined as 0.
+ Thanks to Joe Mistachkin for reporting this bug.
+
+2004-07-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ TIP#158 IMPLEMENTATION
+
+ * tests/bind.test: Allow Win apps to distinguish keys
+ * win/tkWinX.c (GetState): on the keypad using the Extended
+ * generic/tkInt.h (EXTENDED_MASK): modifier. Thanks to Wolfgang
+ * generic/tkBind.c: Grossbauer and Kevin Kenny for
+ * doc/bind.n: developing this patch [Patch 797404]
+
+2004-07-05 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c: Set _NET_WM_NAME and _NET_WM_ICON_NAME
+ (freedesktop.org) in addition to WM_NAME and WM_ICON_NAME (ICCCM). This
+ allows the full Unicode character set to be used in window manager
+ strings (but only for newer WMs that support the EWMH spec). [Bug
+ 959973]
+
+2004-07-02 George Peter Staplin <GeorgePS@XMission.com>
+
+ * generic/tkEvent.c: Tk_HandleEvent was refactored to be more readable,
+ and during this process two bugs were found.
+ 1) Button 4 and 5 masks will now be synchronized with the TkDisplay.
+ 2) ClientMessage handlers will use the proper last pointer rather than
+ writing to the last GenericHandler pointer.
+
+ Thanks to Joe English for his help and encouragement, and DKF for
+ review.
+
+2004-07-01 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/place.n, doc/pack.n: Doc fixes. [Tcl Bug 983146]
+
+2004-06-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ TIP#153 IMPLEMENTATION
+
+ * generic/tkCmds.c (GetTopHierarchy): Modified from GetToplevel so
+ * doc/winfo.n: that [winfo toplevel] does not
+ assume that it is really working with toplevels. Occasionally this is
+ important. Thanks to Neil McKay for this patch!
+
+2004-06-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkCmds.c (Tk_WinfoObjCmd): refetch interp result obj for
+ 'winfo id' as it can change when making the window exist.
+
+2004-06-26 Joe Mistachkin <joe@mistachkin.com>
+
+ * generic/tkConsole.c (ConsoleDeleteProc): Set tsdPtr->gStdoutInterp to
+ NULL when the console command is deleted [Bug 756840]. Also, added
+ Tcl_Preserve/Tcl_Release for consoleInterp in InterpreterCmd in case it
+ gets deleted during the calls to Tcl_GlobalEval and Tcl_RecordAndEval.
+
+2004-06-24 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/canvPs.test, etc: Use standard tcltest constraint names.
+
+2004-06-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4: autoconf 2.5 fixes in Darwin section.
+ * unix/configure: autoconf-2.57
+
+2004-06-17 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/constraints.tcl, tests/*.test: Systematization of test
+ constraints so many common and basic constraints are defined once with
+ a single name.
+
+2004-06-16 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c, win/tkWinWm.c, macosx/tkMacOSXWm.c, tests/wm.test
+ * tests/unixWm.test: Fix for [Bug 742882] "Potential division by zero
+ in gridded wm geometry"
+
+2004-06-15 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * win/tkWinButton.c: Add a 3D highlight to disabled *buttons and
+ labels, the same way as it's now done for disabled menu entries.
+
+2004-06-15 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/image.n: Enhanced the documentation to take into account the
+ concerns raised in [RFE 803060]
+
+ * tests/canvas.test: Updated tests affected by the change to
+ ScrollFractions, which is now clean about result generation.
+
+ * generic/tkCanvas.c: Make tag search subsystem use symbolic names for
+ type flags for easier maintenance.
+ (FIRST_CANVAS_ITEM_MATCHING,FOR_EVERY_CANVAS_ITEM_MATCHING): Factorize
+ out searching idioms into macros to reduce the #ifdef count and make
+ braces match.
+ (ScrollFractions): Really create a list Tcl_Obj.
+
+2004-06-12 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * win/tkWinWm.c (UpdateWrapper): Let overrideredirect'ed window's
+ wrapper be the child of desktop window, thus making it to behave more
+ similarly to X11 Override Redirect. Esp. useful for combobox-like
+ megawidgets.
+
+2004-06-09 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c:
+ * tests/text.test: fix to multi-line regexp search bugs in text widget
+ (reported against Alphatk editor, not on sf). Addded 3 new tests.
+
+2004-06-09 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkUndo.c (TkUndoSetDepth): Delete the unlinked element and
+ not the next element. Stops a crash in some situations and a memory
+ leak in others. Thanks to Jiang Wu for spotting this. [Bug 969358]
+
+2004-06-08 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkCanvText.c (DisplayCanvText): Fix text rendering problem
+ with canvas text items that have a selected region. The previous
+ implementation would render the whole line and then redraw the
+ selected text if it was a different color. This caused problems when
+ the selected text foreground differs from the normal text foreground,
+ the anti-aliasing alpha pixels for the two text strings would blend
+ together resulting in strange looking text. The fix is to draw the
+ normal text and the selected text separately. This problem has only
+ been observed under Windows, with anti-aliased text. [Patch 968725]
+
+2004-06-07 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c:
+ * generic/tkTextBTree.c: fix to (Bug 965186) in which the text widget's
+ record of partial-line-height calculations (for very long wrapped
+ lines) was being incorrectly reused. This resulted in confusing
+ scrollbar-text interactions.
+
+2004-06-06 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/frame.test: Fix frame-2.8 for ![info exists env(DISPLAY)]
+
+2004-06-04 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/filebox.test: A few typo corrections in dkf's recent style
+ * tests/frame.test: upgrade for the test suite.
+ * tests/select.test:
+ * tests/visual.test:
+
+2004-06-04 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextIndex.c:
+ * generic/tkText.c:
+ * generic/tkTextDisp.c:
+ * doc/text.n: fix to shimmering infinite loop scrolling problem in text
+ widget under some rare circumstances (Bug 965398). Improved comments
+ and documentation.
+
+ * tests/textDisp.test: corrected rounding from float to int in test,
+ fixing occasional failures
+
+ * library/text.tcl: corrected mousewheel bindings for TkAqua
+
+2004-05-29 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/messageBox.n: Fix minor markup errors (backslash is \e, not \b).
+
+2004-05-24 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/messageBox.n: Added documentation for the -detail option.
+ * tests/msgbox.test: Updated test suite with correct list of options.
+ * win/tkWinDialog.c (Tk_MessageBoxObjCmd): Added "support" for the
+ -detail option by concatenating it onto the end of the message.
+
+2004-05-24 Jim Ingham <jingham@apple.com>
+
+ * tkMacOSXDialog.c (Tk_MessageBoxObjCmd): Turn on the -detail option
+ for Mac OS X.
+
+2004-05-23 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * ChangeLog.2002: Split older ChangeLog entries off into a separate
+ file.
+ * doc/bindtags.n: Added example.
+
+ * tests/*.test: Many minor fixes aiming towards making the Tk test
+ suite have better style. (A very large fraction of test files were
+ modified.)
+
+ * generic/tkVisual.c (Tk_GetVisual): Minor fix for error message.
+
+2004-05-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ TIP#152 IMPLEMENTATION (Unix only)
+
+ * library/msgbox.tcl (MessageBox): Added TIP#152's -detail option for
+ Unix/X11 platforms. Also shrank the size of the main -message text
+ which was grossly large.
+
+2004-05-12 Chengye Mao <chengye.geo@yahoo.com>
+
+ * generic/tkBind.c <HandleEventGenerate>: Modified to fix wish crash
+ due to incorrectly generate <Destroy> event. This bug was reported in
+ comp.lang.tcl but not logged.
+
+2004-05-07 Chengye Mao <chengye.geo@yahoo.com>
+
+ * win/tkWinWm.c <UpdateWrapper>: handle and destroy old wrapper
+ correctly and fix crash problem in wish exiting [Bug 767176].
+
+2004-05-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinFont.c (FindSubFontForChar): corrections to dkf patch to
+ handle subFontPtrPtr in EnumFontFamilies callback.
+
+2004-05-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * win/tkWinFont.c (Tk_MeasureChars,Tk_DrawChars,etc): Make sure that
+ the lastSubFontPtr remains valid even when the subfont array is
+ reallocated. [Bug 618872]
+
+2004-05-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixButton.c (TkpDrawCheckIndicator): allow radiobuttons to be
+ drawn when disabledforeground and/or selectcolor are NULL.
+ [Bug 826850] (griffin)
+
+ * win/tkWinMenu.c, unix/tkUnixMenu.c (DrawMenuEntryLabel): place images
+ of compound menu entries in indicator space if not a radio of
+ checkbutton. [Bug 756952] (eserte)
+
+ * win/tkWinX.c: fix drawing of unicode chars in menu
+ * win/tkWinInt.h (TkWinProcs): titles. [Bug 904371] (riefenstahl)
+ * win/tkWinMenu.c (ReconfigureWindowsMenu):
+
+ * generic/tkClipboard.c: Move TkClipCleanup from tkClipboard.c to
+ * macosx/tkMacOSXXStubs.c: being implemented in a platform-specific
+ * unix/tkUnixEvent.c: manner. The cleanup order was bad at least
+ * win/tkWinX.c: on Windows, where we reset/cleared display
+ info that was still needed for the clipboard to render. [Bug 939389,
+ 822002, 732662]
+
+ * library/panedwindow.tcl (MarkSash): call DragSash to stop sash jump
+ when B1 is pressed and released without moving. [Bug 932155]
+
+ * tests/panedwindow.test: panedwindow-25.1
+ * generic/tkPanedWindow.c (Unlink): clean up -before/-after refs to a
+ slave when removing it. [Bug 928413] (griffin)
+
+ * generic/tkImgPhoto.c (ImgPhotoConfigureMaster): force -data into
+ ByteArray and -format into String to correctly handle them if they
+ have been shimmered or created as some other object type.
+
+2004-04-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkPort.h:
+ * unix/Makefile.in:
+ * win/makefile.bc:
+ * win/Makefile.in: followup on tcl header reform [FR 922727]: removed
+ use of relative #include paths in tkPort.h to allow installation of
+ private headers outside of tk source tree; added tcl plaform source dir
+ to compiler header search path.
+
+2004-04-23 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/bind.n: Added examples (in line with the parallel programme for
+ adding examples to Tcl manual pages) and made assorted minor
+ alterations to improve the overall look.
+
+2004-04-21 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/textDisp.test: Get rid of windows that are no longer needed so
+ single-proc tests don't have extra windows hanging around unexpectedly.
+
+2004-04-21 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ Mac OS X: Fix several problems with Icelandic (and Faroese) keyboards
+ reported by Jérôme Gagnon-Voyer <gagnonje5000<at>mac<dot>com> on
+ tcl-mac on 2004-03-22.
+
+ * macosx/tkMacOSXKeyEvent.c (KLSInit): Add.
+ (GetKeyboardLayout): Add calls to Keyboard Layout Services, if present.
+ Rework classic handling. Use GetKCHREncoding(). Add parameter
+ encodingPtr.
+ (GetKCHREncoding): Add.
+
+2004-04-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/bgerror.tcl (bgerror): rework to only set -topmost bit on
+ Windows if necessary. Also use existing ::tk functions for placing
+ dialog and managing focus/grab.
+
+2004-04-04 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c: Fix for [Bug 915350] "Tk sets min, max size in
+ WM_HINTS when it shouldn't" and [Bug 922336] "Tk apps have no maximize
+ window button under KDE-3.2.1"
+
+2004-03-31 Jim Ingham <jingham@apple.com>
+
+ * tkMacOSXCarbonEvents.c (AppEventHandlerProc): Handle the
+ kEventAppHidden and kEventAppShown events.
+ (TkMacOSXInitCarbonEvents): Register for the above events.
+ * tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): Steal the
+ Command-H menu key event and allow the Application handler to have it.
+ This is currently the only way to get the Hide behavior to work. [Bug
+ 917557]
+
+ * tkMacOSMenus.c (TkMacOSXHandleMenuSelect): Remove the Quit menu
+ handler - this was for the Quit item in the File menu, but it doesn't
+ belong there.
+ (TkMacOSXInitMenus): Remove the Quit menu item from the File menu.
+
+ * tkMacOSXMenu.c (EventuallyInvokeMenu): Report errors from invoking
+ menu commands as background errors. [Bug 220871]
+
+2004-03-31 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkImgPhoto.c: Removed outdated #include's of the tclMath.h
+ * generic/tkScale.c: header file. All tk*Port.h files have long had
+ a #include <math.h>, and other parts of Tk routinely make use of
+ libm-supplied math routines.
+
+2004-03-30 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tclets.r (removed): obsolete holdover from mac classic.
+
+2004-03-26 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgPPM.c (ReadPPMStringHeader): Code to read PPM/PGM data
+ (StringReadPPM, StringMatchPPM): from strings/bytearrays. [FRQ 540375]
+
+2004-03-26 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tcl.m4: Replaced -Wno-strict-alias with more portable
+ -fno-strict-alias alternative.
+
+ * README: Bump version to 8.5a2.
+ * generic/tk.h:
+ * macosx/Wish.pbproj/project.pbxproj:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.57
+ * win/configure:
+
+2004-03-26 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgPPM.c (StringWritePPM): New function to support
+ converting of images to PPM strings. Other direction not yet done. Rest
+ of file converted to use new image API.
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Restored support for the
+ stringWriteProc of old photo formats. [Bug 923555]
+
+2004-03-25 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/winfo.n: Clarified the range of colour intensities returned by
+ [winfo rgb]. [Bug 922610]
+
+2004-03-22 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/ConfigWidg.3: Converted malloc/free to Tcl_Alloc/Tcl_Free to help
+ avoid confusion and crashes on Windows. [Bug 920695]
+
+2004-03-20 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXSubwindows.c (GenerateConfigureNotify): New function.
+ (XMoveWindow): Generate configure notify events for child widgets on
+ move.
+ (XMoveResizeWindow): Ditto.
+
+2004-03-18 Daniel Steffen <das@users.sourceforge.net>
+
+ Removed support for Mac OS Classic platform [Patch 918139]
+
+ * doc/console.n:
+ * doc/tk.n:
+ * generic/README:
+ * generic/default.h:
+ * generic/tk.decls:
+ * generic/tk.h:
+ * generic/tkBind.c:
+ * generic/tkCmds.c:
+ * generic/tkConsole.c:
+ * generic/tkFileFilter.h:
+ * generic/tkGrab.c:
+ * generic/tkInitScript.h:
+ * generic/tkInt.decls:
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkMain.c:
+ * generic/tkPlatDecls.h:
+ * generic/tkPointer.c:
+ * generic/tkPort.h:
+ * generic/tkSelect.c:
+ * generic/tkStubInit.c:
+ * generic/tkStubLib.c:
+ * generic/tkTest.c:
+ * generic/tkText.c:
+ * generic/tkWindow.c:
+ * library/bgerror.tcl:
+ * library/button.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/entry.tcl:
+ * library/msgbox.tcl:
+ * library/spinbox.tcl:
+ * library/tearoff.tcl:
+ * library/text.tcl:
+ * library/tk.tcl:
+ * library/demos/text.tcl:
+ * library/demos/widget:
+ * mac/MW_TkBuildLibHeader.h (removed):
+ * mac/MW_TkBuildLibHeader.pch (removed):
+ * mac/MW_TkHeader.h (removed):
+ * mac/MW_TkHeader.pch (removed):
+ * mac/MW_TkHeaderCommon.h (removed):
+ * mac/MW_TkOldImgHeader.h (removed):
+ * mac/MW_TkOldImgStaticHeader.h (removed):
+ * mac/MW_TkStaticHeader.h (removed):
+ * mac/MW_TkStaticHeader.pch (removed):
+ * mac/MW_TkTestHeader.h (removed):
+ * mac/MW_TkTestHeader.pch (removed):
+ * mac/README (removed):
+ * mac/bugs.doc (removed):
+ * mac/tclets.r (removed):
+ * mac/tclets.tcl (removed):
+ * mac/tkMac.h (removed):
+ * mac/tkMacAppInit.c (removed):
+ * mac/tkMacAppearanceStubs.c (removed):
+ * mac/tkMacApplication.r (removed):
+ * mac/tkMacBitmap.c (removed):
+ * mac/tkMacButton.c (removed):
+ * mac/tkMacClipboard.c (removed):
+ * mac/tkMacColor.c (removed):
+ * mac/tkMacConfig.c (removed):
+ * mac/tkMacCursor.c (removed):
+ * mac/tkMacCursors.r (removed):
+ * mac/tkMacDefault.h (removed):
+ * mac/tkMacDialog.c (removed):
+ * mac/tkMacDraw.c (removed):
+ * mac/tkMacEmbed.c (removed):
+ * mac/tkMacFont.c (removed):
+ * mac/tkMacHLEvents.c (removed):
+ * mac/tkMacInit.c (removed):
+ * mac/tkMacInt.h (removed):
+ * mac/tkMacKeyboard.c (removed):
+ * mac/tkMacLibrary.r (removed):
+ * mac/tkMacMDEF.c (removed):
+ * mac/tkMacMDEF.r (removed):
+ * mac/tkMacMenu.c (removed):
+ * mac/tkMacMenu.r (removed):
+ * mac/tkMacMenubutton.c (removed):
+ * mac/tkMacMenus.c (removed):
+ * mac/tkMacPort.h (removed):
+ * mac/tkMacProjects.sea.hqx (removed):
+ * mac/tkMacRegion.c (removed):
+ * mac/tkMacResource.r (removed):
+ * mac/tkMacScale.c (removed):
+ * mac/tkMacScrlbr.c (removed):
+ * mac/tkMacSend.c (removed):
+ * mac/tkMacSubwindows.c (removed):
+ * mac/tkMacTclCode.r (removed):
+ * mac/tkMacTest.c (removed):
+ * mac/tkMacWindowMgr.c (removed):
+ * mac/tkMacWm.c (removed):
+ * mac/tkMacXCursors.r (removed):
+ * mac/tkMacXStubs.c (removed):
+ * mac/widget.r (removed):
+ * tests/clrpick.test:
+ * tests/cursor.test:
+ * tests/entry.test:
+ * tests/font.test:
+ * tests/macEmbed.test (removed):
+ * tests/macFont.test (removed):
+ * tests/macMenu.test (removed):
+ * tests/macWinMenu.test (removed):
+ * tests/macscrollbar.test (removed):
+ * tests/menuDraw.test:
+ * tests/safe.test:
+ * tests/scrollbar.test:
+ * tests/select.test:
+ * tests/spinbox.test:
+ * tests/text.test:
+ * tests/tk.test:
+ * tests/winfo.test:
+ * tests/wm.test:
+ * unix/Makefile.in:
+ * unix/README:
+ * unix/tk.spec:
+ * unix/tkUnix3d.c:
+ * unix/tkUnixDraw.c:
+ * xlib/xgc.c:
+ * xlib/xutil.c:
+ * xlib/X11/X.h:
+ * xlib/X11/Xlib.h:
+ * xlib/X11/Xutil.h:
+ * xlib/X11/keysym.h:
+
+2004-03-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixButton.c (TkpDrawCheckIndicator): correct crash condition
+ for new radio/checkbuttons when colors are exhausted.
+ [Bug 915330] (griffin)
+
+ * generic/tkGrid.c (GridRowColumnConfigureCommand): fix lint warning
+
+ * generic/tkCanvUtil.c: fix cast warnings
+
+ * generic/tkTextImage.c (EmbImageConfigure): fix casts
+
+ * unix/tkUnixSelect.c (ConvertSelection, TkSelPropProc): fix casts
+
+ * unix/configure, unix/tcl.m4: add -Wno-strict-aliasing for GCC to
+ suppress useless type puning warnings.
+
+2004-03-08 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc:
+ * win/buildall.vc.bat: Checks MSDevDir, not MSVCDir envar.
+
+2004-03-04 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWin32Dll.c: Add variables needed when compiling with mem debug
+ under Mingw. This fixes the checking from 2003-12-25.
+
+2004-03-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.5a1 TAGGED FOR RELEASE ***
+
+ * unix/Makefile.in (dist): don't require win/lamp.bmp copy in dist
+ target (it's already handled by win/rc/*.bmp copy)
+
+ * changes: updated for 8.5a1
+
+2004-03-01 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * README: update to patchlevel 8.5a1
+ * generic/tk.h:
+ * macosx/Wish.pbproj/project.pbxproj:
+ * unix/configure, unix/configure.in, unix/tk.spec:
+ * win/configure, win/configure.in:
+
+ * unix/tcl.m4: update HP-11 build libs setup
+
+2004-03-01 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tcl.m4 (SC_CONFIG_CFLAGS): Allow 64-bit enabling on
+ IRIX64-6.5* systems. [Bug 218561]
+ * unix/configure: autoconf-2.57
+
+2004-02-28 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextIndex.c: remove use of internal Tcl interface
+ 'TclUtfToUniChar'
+
+2004-02-25 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * library/demos/widget (addFormattedText): Correct off-by-one error.
+
+2004-02-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Makefile: ensure that xcodebuild will use the Wish.pbproj
+ project even if a .xcode project is also present.
+
+ * macosx/tkMacOSXMouseEvent.c: fixed modifiers for MouseWheel events.
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/tkAboutDlg.r: changed year in copyright strings to 2004.
+
+2004-02-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXXStubs.c:
+ * xlib/ximage.c: fixed MacOSX XGetImage/XPutImage and related functions
+ to deal properly with XImages copied from screen.
+ * generic/tkCanvPs.c (TkImageGetColor): MacOSX fix. [Bug 809157]
+
+2004-02-18 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/grid.test:
+ * generic/tkGrid.c: Fixed a bug in grid geometry calculations for a
+ shrinking grid. [Bug 899246]
+
+2004-02-17 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * macosx/tkMacOSXKeyboard.c (TkpInitKeymapInfo): Don't make <Alt> and
+ <Meta> synonyms for <Command> and <Option> for now.
+
+2004-02-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkBind.c (HandleEventGenerate): only modify root[xy] with
+ [xy] when they haven't been otherwise set.
+
+ TIP#110 IMPLEMENTATION
+
+ * doc/checkbutton.n: Tristate Checkbutton and Radiobuttons
+ * doc/radiobutton.n:
+ * generic/tkButton.c:
+ * generic/tkButton.h:
+ * library/demos/check.tcl:
+ * library/demos/radio.tcl:
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXDefault.h:
+ * tests/button.test:
+ * unix/tkUnixButton.c:
+ * unix/tkUnixDefault.h:
+ * win/tkWinButton.c:
+ * win/tkWinDefault.h:
+
+2004-02-17 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/imgPhoto.test (imgPhoto-16.1): Corrected incorrect variable
+ name [Bug 899010].
+
+2004-02-15 Jim Ingham <jingham@apple.com>
+
+ * tkMacOSXDialog.c (MatchOneType): If the Macintosh filetype is 0, then
+ automatically pass the fileType check.
+
+ * tkMacOSXCarbonEvents.c: New file - this doesn't do anything yet -
+ just registers for a couple of App Events.
+
+ * tkMacOSXInit.c (TkpInit.c): Call TkMacOSXInitCarbonEvents.c.
+
+ * tkMacOSXAppInit.c: Formatting cleanups.
+ * tkMacOSXButton.c: Ditto
+ * tkMacOSXClipboard.c: Ditto
+ * tkMacOSXDebug.c: Ditto
+ * tkMacOSXDialog.c: Ditto
+ * tkMacOSXDraw.c: Ditto
+ * tkMacOSXEvent.c: Ditto
+ * tkMacOSXFont.c: Ditto
+ * tkMacOSXHLEvents.c: Ditto
+ * tkMacOSXInit.c: Ditto
+ * tkMacOSXInt.h
+ * tkMacOSXKeyEvent.c: Ditto
+ * tkMacOSXMenu.c: Ditto
+ * tkMacOSXMenubutton.c: Ditto
+ * tkMacOSXMouseEvent.c: Ditto
+ * tkMacOSXNotify.c: Ditto
+ * tkMacOSXScale.c: Ditto
+ * tkMacOSXScrlbr.c: Ditto
+ * tkMacOSXSubwindows.c: Ditto
+ * tkMacOSXWindowEvent.c: Ditto
+ * tkMacOSXWm.c: Ditto
+
+2004-02-13 Jim Ingham <jingham@apple.com>
+
+ * tkMacOSXDialog.c (Tk_GetOpenFileObjCmd): Use CFStringRef for title &
+ message options, not pascal strings.
+ (Tk_GetSaveFileObjCmd): Ditto
+ (Tk_ChooseDirectoryObjCmd): Ditto
+ (NavServicesGetFile): Now that we get CFStrings, we don't need to
+ convert them here.
+
+ * tkMacOSXMenu.c (TkMacOSXDispatchMenuEvent): Cleanup, we don't need to
+ handle the Apple Menu picks any more, but the code didn't reflect that.
+
+ * tkMacOSXWm.c (TkSetWMName): Use CFStrings for the Window Title name,
+ not Pascal strings.
+
+2004-02-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinDialog.c (ChooseDirectoryValidateProc): create a pidl for
+ -initialdir if we have a UNC path because BFFM_SETSELECTION doesn't
+ support UNC paths in strings.
+
+2004-02-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/msgs/eo.msg: Language support for Esperanto and Polish from
+ * library/msgs/pl.msg: Artur Trzewik <mail@xdobry.de> with thanks.
+
+2004-02-09 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
+ * tests/imgPhoto.test (imgPhoto-16.1): Better handling of the case when
+ copying from one area of a photo to another triggers a resizing of the
+ image. [Bug 877950]
+
+2004-02-07 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc:
+ * win/rules.vc:
+ * win/rc/tk.rc:
+ * win/rc/wish.rc: Now supports the 'unchecked' option when building.
+
+2004-02-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/menubutton.n:
+ * library/menu.tcl (::tk::MbPost): make menubuttons that post above or
+ below reverse direction when not enough space is available.
+
+2004-02-01 David Gravereaux <davygrvy@pobox.com>
+
+ * win/lamp.bmp (deleted): using win/rc/lamp.bmp instead.
+
+ * win/winMain.c: Removed our custom setargv() in favor of __argc and
+ __argv exported by the C run-time.
+
+ * win/makefile.vc:
+ * win/rc/tk.rc:
+ * win/rc/wish.rc: General clean-up.
+
+ * win/rules.vc:
+ * win/nmakehlp.c: sync'd to Tcl.
+
+2004-01-31 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c, unix/tkUnixEvent.c: Replaced TclpGetTime() with
+ Tcl_GetTime(), to remove dependency on tclInt.h [Bug 874745].
+
+2004-01-27 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkTextIndex.c: added '#include <tclInt.h>' since the code
+ uses the TclUtfToUniChar macro from that file. [Bug 874745]
+
+ * macosx/Wish.pbproj/project.pbxproj: removed erroneous reference to
+ mkpsenc.tcl in bundle resources phase (mkpsenc.tcl is already part of
+ the copy files phase to Resources/Scripts).
+
+ * macosx/Makefile: added support for 'xcodebuild' on Mac OS X 10.3.
+
+2004-01-25 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * macosx/tkMacOSXKeyboard.c: Fix regressions due to the last patches.
+
+2004-01-25 Peter Spjuth <peter.spjuth@space.se>
+
+ * library/dialog.tcl:
+ * library/msgbox.tcl: The dialogs were affected by the TIP#146
+ implementation. Added grid anchor commands to restore original
+ behaviour.
+
+2004-01-15 David Gravereaux <davygrvy@pobox.com>
+
+ * win/tkWinSendCom.c: Placed the requirement for the special COM
+ libraries into the object file itself with #pragma comment (lib, ...)
+ when built with VC++. This will simplify linking for users of the
+ static library. uuid.lib is required for VC5.2, but is implicit with
+ VC6.
+
+ * win/makefile.vc: Removed 'ole32.lib oleaut32.lib uuid.lib' from
+ $(baselibs).
+
+2004-01-12 David Gravereaux <davygrvy@pobox.com>
+
+ * generic/tk3d.c: All uses of 'panic' (the macro) changed to
+ * generic/tkBind.c: 'Tcl_Panic' (the function). The #define of
+ * generic/tkBitmap.c: panic in tcl.h clearly states it is deprecated
+ * generic/tkCanvArc.c: in the comments. [Tcl Patch 865264]
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvImg.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvWind.c:
+ * generic/tkColor.c:
+ * generic/tkConfig.c:
+ * generic/tkCursor.c:
+ * generic/tkError.c:
+ * generic/tkEvent.c:
+ * generic/tkFocus.c:
+ * generic/tkFont.c:
+ * generic/tkFrame.c:
+ * generic/tkGC.c:
+ * generic/tkGrid.c:
+ * generic/tkImgBmap.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkImgUtil.c:
+ * generic/tkMenu.c:
+ * generic/tkObj.c:
+ * generic/tkPack.c:
+ * generic/tkPlace.c:
+ * generic/tkRectOval.c:
+ * generic/tkSelect.c:
+ * generic/tkText.c:
+ * generic/tkTextBTree.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextImage.c:
+ * generic/tkTextIndex.c:
+ * generic/tkTextMark.c:
+ * generic/tkTextWind.c:
+ * generic/tkVisual.c:
+ * generic/tkWindow.c:
+ * mac/tkMacAppInit.c:
+ * mac/tkMacAppearanceStubs.c:
+ * mac/tkMacButton.c:
+ * mac/tkMacDraw.c:
+ * mac/tkMacEmbed.c:
+ * mac/tkMacFont.c:
+ * mac/tkMacInit.c:
+ * mac/tkMacMenus.c:
+ * mac/tkMacPort.h:
+ * mac/tkMacSubwindows.c:
+ * mac/tkMacWm.c:
+ * mac/tkMacXStubs.c:
+ * macosx/tkMacOSXEmbed.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXNotify.c:
+ * macosx/tkMacOSXPort.h:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+ * unix/tkUnix3d.c:
+ * unix/tkUnixColor.c:
+ * unix/tkUnixEmbed.c:
+ * unix/tkUnixEvent.c:
+ * unix/tkUnixFocus.c:
+ * unix/tkUnixFont.c:
+ * unix/tkUnixSelect.c:
+ * unix/tkUnixSend.c:
+ * unix/tkUnixWm.c:
+ * win/tkWin3d.c:
+ * win/tkWinButton.c:
+ * win/tkWinColor.c:
+ * win/tkWinDialog.c:
+ * win/tkWinDraw.c:
+ * win/tkWinEmbed.c:
+ * win/tkWinFont.c:
+ * win/tkWinPixmap.c:
+ * win/tkWinPointer.c:
+ * win/tkWinScrlbr.c:
+ * win/tkWinWm.c:
+ * win/tkWinX.c:
+
+ * win/rc/tk.rc:
+ * win/rc/tk_base.rc:
+ * win/rc/wish.rc:
+ * win/makefile.vc: Refreshed how the resource files are built. Should
+ be a bit easier for people linking with a static Tk library.
+
+ * win/lamp.bmp (deleted):
+ * win/rc/lamp.bmp (new): Moved.
+
+ * win/rules.vc: Sync'd to Tcl, respects the CHECKS=nodep command line
+ macro and was used to verify the Tcl_Panic change above.
+
+2004-01-09 Peter Spjuth <peter.spjuth@space.se>
+
+ TIP#146 IMPLEMENTATION
+
+ * doc/grid.n:
+ * tests/grid.test:
+ * generic/tkGrid.c: Implementation of TIP#146, "Add Overall Anchoring
+ to the Grid Geometry Manager", adding [grid anchor] subcommand.
+ **** POTENTIAL VISUAL INCOMPATABILITY ****
+
+2004-01-07 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c:
+ * generic/tkTextBTree.c:
+ * tests/text.test: fixed crashing [Bug 872299] in yview code, and added
+ tests and better error checking in the B-tree.
+
+2004-01-07 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextIndex.c:
+ * tests/textIndex.test: fixed bug in which 'wordstart' and 'wordend'
+ were not utf-8 aware (they haven't been changed since Tk 8.0), and
+ added tests.
+
+2004-01-07 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/tkWinMenu.c: only provide a submenu handle when the MF_POPUP flag
+ is given, fixing a recently-introduced crash when submenus are
+ disabled. Also better error checking for this sort of situation in the
+ future.
+
+2003-12-31 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: added missing private headers to
+ installed Tk.framework, so that tkInt.h can be included sucessfully
+ from Tk.framework/PrivateHeaders.
+ * generic/tkPort.h: corrected include of tkMacOSXPort.h
+
+2003-12-28 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinMenu.c (ReconfigureWindowsMenu): Fix drawing of a disabled
+ (TkWinHandleMenuEvent, DrawMenuEntryArrow): cascade menu arrow. Tk was
+ displaying a disabled cascade menu arrow in black instead of gray. This
+ was caused by a bug in the Win32 code for user drawn menu items. The
+ fix is to avoid telling Windows that the menu item is a cascade type
+ and then draw the gray arrow bitmap on our own. [Patch 865842]
+
+2003-12-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinMenu.c (DrawWindowsSystemBitmap): Fix a strange Win32 bug
+ where the logical coordinates returned by a call to DPtoLP are wrong
+ the first time a menu is posted. This bug manifested itself by drawing
+ the bitmap in the wrong place in a menu. The fix was to pass the newly
+ created DC instead of the DC from the window.
+
+2003-12-26 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinMenu.c (DrawMenuEntryAccelerator):
+ (DrawMenuEntryLabel): When drawing the label text and accelerator text
+ for a disabled menu entry be sure to draw a 3D highlight. The only
+ exception to this is when a disabled menu entry is highlighted, in that
+ case do not draw a 3D hightlight.
+
+2003-12-26 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinMenu.c (DrawMenuEntryAccelerator, DrawMenuEntryArrow): Move
+ the unused menu arrow drawing code in DrawMenuEntryAccelerator into a
+ new function named DrawMenuEntryArrow. This makes no functional change
+ but it will make it easier to fix things in the future.
+
+2003-12-25 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWin32Dll.c (DllMain): Add HAVE_NO_SEH blocks in place of __try
+ and __except statements to support gcc builds. This is needed after
+ David's changes on 2003-12-21. [Tcl patch 858493]
+
+2003-12-22 David Gravereaux <davygrvy@pobox.com>
+
+ * win/nmakehlp.c:
+ * win/rules.vc: sync'd to Tcl.
+
+ * win/makefile.vc: Uses new features of nmakehlp to get the version
+ strings from header files without the use of hardcoded values.
+
+ * generic/tk.h: removed the note about having to update makefile.vc
+ when the version changes.
+
+2003-12-22 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/text.n: Fix markup errors (".t" at beginning of line).
+
+2003-12-21 David Gravereaux <davygrvy@pobox.com>
+
+ * generic/tkEvent.c: Added three new functions: TkCreateExitHandler,
+ * generic/tkInt.h: TkDeleteExitHandler, and TkFinalize. This adds an
+ * generic/tkMenu.c: insertion point so Tk's exit handlers can be
+ * generic/tkWindow.c: called on their own from tk85.dll's DllMain for
+ * mac/tkMacButton.c: DLL_PROCESS_DETACH. These are private to the
+ * unix/tkUnixEvent.c: binary and not exported. It is possible the
+ * win/tkWin32Dll.c: Windows OS can unload Tk _prior_ to Tcl under
+ * win/tkWinEmbed.c: some conditions such as ExitProcess(). This
+ * win/tkWinMenu.c: avoids a dangling pointer problem when Tcl does
+ * win/tkWinX.c: Tcl_Finalize after Tk has been unloaded.
+ * win/winMain.c: DllMain's DLL_PROCESS_DETACH now protected with
+ SEH as DeleteWindowsExitProc is causing an exception of its own under
+ some teardown conditions. AT&T assembly syntax has not been added for
+ MinGW yet. [Tcl Patch 858493]
+
+2003-12-20 Joe English <jenglish@users.sourceforge.net>
+
+ * library/bgerror.tcl: Truncate displayed error message if it's too
+ long. [Bug 231251]
+
+2003-12-16 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/rc/wish.exe.manifest: It seems that Windows XP insists on a
+ strict format for the version value. 8.5.a0 or 8.5.0 results in an
+ unloadable executable -- must be 4 numbers.
+
+ * win/tkWinSend.c: Removed some misleading comments [Bug 846134] and
+ disabled the send package until [Bug 858822] is resolved.
+
+2003-12-16 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * win/tkWinWm.c (InstallColormaps): Check for TK_ALREADY_DEAD to avoid
+ handling of dead windows.
+
+2003-12-15 David Gravereaux <davygrvy@pobox.com>
+
+ Some silent invalid handle issues discovered with NuMega's
+ BoundsChecker [Patch 699022]
+
+ * win/tkWinMenu.c (ReconfigureWindowsMenu): Only redraw the menubar
+ when a menubar exists.
+
+ * win/tkWinWm.c (UpdateGeometryInfo): wmPtr->wrapper might be NULL. No
+ exception is thrown, but it isn't correct to ignore.
+
+2003-12-15 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * macosx/tkMacOSXKeyboard.c: General cleanup. Add support for [event
+ generate]. [Bug 860454]
+
+2003-12-15 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.h:
+ * generic/tkTextBTree.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextIndex.c: improved documentation in comments to explain
+ how pixel heights are kept track of. Also ensured correct clean-up of
+ elide-state calculation, even with very large numbers of tags. Also
+ provided slightly better updating of cache for totally elided display
+ lines.
+
+2003-12-12 David Gravereaux <davygrvy@pobox.com>
+
+ * win/tkWinEmbed.c (TkWinEmbeddedEventProc) : for loop dereferences
+ containerPtr but can't get to the if (containerPtr == NULL) test due to
+ the unhandled read memory exception for when it really is NULL.
+
+ * win/tkWinX.c (TkWinXInit): Don't restrict InitCommonControlsEx. It's
+ valid on all platforms given IE 3.0+ is installed. As tkWinX.c does set
+ #define _WIN32_IE 0x0300, I guess we can accept IE3 as the lowest
+ denominator and use the version 4.71 features of Comctl32.dll
+
+ * win/rc/wish.exe.manifest: updated version string. This file isn't
+ compiled.
+
+2003-12-10 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/textWind.test: fixed 2 tests so they run on Windows as well as
+ unix, and so their results take account of -padx/-pady settings for the
+ text widget.
+
+2003-12-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/CrtImgType.3: Fixed line-transposition error found by Eric
+ Raymond. [Bug 857159]
+
+2003-12-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure:
+ * unix/tcl.m4: updated OpenBSD build configuration based on [Patch
+ 775246] (cassoff)
+
+2003-12-09 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/tkWinWm.c: fix to memory leak on certain error cases.
+
+ * generic/tkTextTag.c: fix reading of freed tag memory, by removing all
+ references to freed tags.
+
+2003-12-08 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/entry.n: clean up usage of 'edition' as a verb.
+
+2003-12-05 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/text.test:
+ * generic/tkText.c: after debate on sf, allow decreasing tab-stops,
+ hence removing any potential backwards incompatibility, even for buggy
+ code. Added new test. [Bug 852949]
+
+ * generic/tkText.h:
+ * generic/tkTextDisp.c:
+ * generic/tkTextTag.c: fix to performance problems in the text widget
+ when inserting lines which wrap thousands of times [Bug 853003]. Note
+ that the text widget must now perform additional calculations (pixel
+ heights) compared to Tk <= 8.4, and so some actions will be slower, by
+ necessity.
+
+2003-12-05 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * win/tkWinFont.c (Tk_MeasureChars): Fix indentation. Fix memory leak.
+ Fix handling of TK_WHOLE_WORDS.
+
+2003-12-04 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c: disallow negative or decreasing tab-stops, which
+ fixes [Bug 852949], but is a
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+ with Tk 8.4.5 or earlier, but only for code which assumed (incorrectly)
+ that tab stops are relative to each other instead of relative to the
+ widget's left edge. Such code will now throw an error instead of doing
+ the wrong thing.
+
+ [[MAINTAINER NOTE: SEE TIP#256]]
+
+ * generic/tkTextDisp.c: restore previous meaning of -[xy]scrollcommand
+ [Bug 852954], and remove unused argument to 'MeasureChars'
+
+ * generic/tkTextWind.c:
+ * generic/tkTextImage.c: better border handling and fixed typos in
+ comments.
+
+ * tests/text.test: tests for negative and decreasing tab stops.
+
+ * doc/text.n: documentation of '-tabs', to clarify Tk's longstanding
+ interpretation of all distances as relative to the left edge of the
+ widget.
+
+ * library/demos/twind.tcl:
+ * library/demos/widget: minor enhancements to text widget demo, showing
+ embedded images, for example.
+
+2003-12-04 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/tkWinFont.c: applied [Patch 852669] which fixes [Bug 478568] with
+ certain bold or italic fonts on Windows.
+ * tests/textDisp.test: added test for the font measurement problem.
+
+2003-12-02 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkMenu.c (MenuVarProc): prevent this from triggering while
+ interp is being destroyed.
+
+2003-11-25 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * generic/tkPointer.c (Tk_UpdatePointer): corrected targetWinPtr check
+ (line 369) so any pointer event with winPtr==0 is really redirected to
+ the grab or restrict window (if any).
+
+2003-11-21 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c:
+ * generic/tkText.h:
+ * generic/tkText.c:
+ * tests/textDisp.test: ensure interpolated tabs are at the same
+ location as the equivalent real tabs, by making use of fractional
+ rather than integer pixel calculations.
+
+2003-11-21 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c: prevent wrapped line height calculations until
+ the widget has actually been given a geometry.
+
+ * tests/textWind.test:
+ * tests/textDisp.test: fix to [Bug 843752], allowing tests to complete
+ cross-platform. Thanks to dgp for extensive testing.
+
+2003-11-21 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/FindPhoto.3: Removed reference to long-gone header file.
+
+2003-11-20 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/tkWinSend.c:
+ * win/tkWinSendCom.c: ensure object is not shared before lappend (fix
+ for crash in Windows test suite), and clean up of files to bring them
+ closer to Tcl standards.
+
+2003-11-20 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * macosx/tkMacOSXKeyboard.c: Add PowerBook keycode 0x34 as <Return>.
+
+2003-11-18 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXScrlbr.c: Reworking Vince's fix to [Bug 842952]. This
+ version is clearer, and works helps keep the mouse better pinned to the
+ scrollbar. I also removed the glitch where the scrollbar would jump get
+ its middle over the mouse when you first moved it.
+
+2003-11-17 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/constraints.tcl:When running the test suite in a process where
+ * tests/image.test: Tk has been [load]ed, there's no guarantee that
+ * tests/select.test: child processes created by [exec [interpreter]]
+ * tests/unixWm.test: will have Tk in them. Made modifications to
+ * tests/window.test: force a [load] of Tk in those situations.
+
+2003-11-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkMenubutton.h: fixed compound menubutton handling like
+ * generic/tkMenubutton.c: *button corrections of 2003-04-25.
+ * mac/tkMacMenubutton.c (TkpDisplayMenuButton):
+ * unix/tkUnixMenubu.c (TkpDisplayMenuButton):
+
+2003-11-16 Don Porter <dgp@users.sourceforge.net>
+
+ * win/makefile.vc: Restored consistency of pkgIndex.tcl file with that
+ generated by Makefile.
+
+2003-11-15 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXScrlbr.c: [Bug 842952] correct scrollbar tracking with
+ mouse. Also increased scrollbar resolution for better scrolling in very
+ large text widgets.
+
+ * generic/tkTextDisp.c: cleanup and clarify some comments
+ * doc/text.n: cleanup some of the markup.
+
+2003-11-15 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: Fixes pkgIndex.tcl generation so a symbols build is
+ loaded when Tcl is symbols.
+
+2003-11-15 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c:
+ * tests/textDisp.test: fixes to one more old Tk [Bug 422411] this time
+ concerning inconsistent tab interpretation. Also fixed an unreported
+ new problem if a single logical line wraps to fill more than the
+ entire display.
+
+ * macosx/tkMacOSXScrlbr.c: fix to [Bug 840978] where the size of the
+ proportional scrollbar was calculated wrongly.
+
+2003-11-14 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/text.n: Fix markup errors.
+
+2003-11-15 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.h:
+ * generic/tkText.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextWind.c:
+ * generic/tkTextTag.c:
+ * tests/textDisp.test: fixes to another pair of old Tk bugs [Bug
+ 220816] (can't scroll horizontally to display all of last character),
+ [Bug 842498] (xview confused on window creation), and more efficiency
+ in tag creation. Added new tests.
+
+2003-11-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkTextDisp.c (TkTextRedrawTag): Get the correct number of
+ lines in the region to be updated. This fix due to Vince Darley.
+ (TkTextUpdateLineMetrics): Return the correct marker value when we know
+ the update loop should terminate. [Bug 837300]
+
+2003-11-13 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/event.test:
+ * library/text.tcl: fixed the text widget portion of [Bug 542199]
+
+2003-11-13 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkMenuDraw.c (TkPostSubmenu,AdjustMenuCoords): Rewrote to use
+ Tcl_EvalObjv instead of Tcl_VarEval for greater robustness. A side
+ benefit is that this should all be faster now too. [Bug 723856]
+
+2003-11-12 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.h:
+ * generic/tkText.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextIndex.c:
+ * generic/tkTextTag.c:
+ * tests/textTag.test: fixes to two very old Tk bugs [Bug 583286]
+ (focus handling with embedded windows), [Bug 220780] (tag bindings
+ trigger on window borders), and made two more functions static in
+ tkTextDisp.c.
+
+ * library/text.tcl: fixed [Tcl Bug 699642] with double/triple-click
+ insert positioning.
+
+2003-11-11 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure:
+ * unix/configure.in: use xft-config instead of pkg-config to determine
+ xft info.
+ * unix/tcl.m4: improve AIX --enable-64bit handling remove
+ -D__NO_STRING_INLINES -D__NO_MATH_INLINES from CFLAGS_OPTIMIZE on
+ Linux. Make default opt -O2 (was -O).
+
+ * generic/tkButton.c (ConfigureButton): abort option processing if the
+ button was deleted. [Bug 824479]
+
+ * generic/tkMenuDraw.c (TkPostSubmenu): add {} around menu name in case
+ it has spaces when calling Tcl_VarEval. This is a hack until this is
+ rewritten for proper Tcl_Obj handling. [Bug 723856]
+
+ * library/tkfbox.tcl (::tk::dialog::file::Update): optimize the
+ dir/files list separation by using the -tails, -directory and -type
+ option of 'glob'. Also passes the glob the -filetypes filters instead
+ of calling string match over each file. [Patch 833819]
+ (::tk::dialog::file::ActivateEnt): allow typing filename into entry
+ when tk_getOpenFile -multiple 1 is specified. [Bug 788069]
+
+ * generic/tkListbox.c (ListboxDeleteSubCmd, ListboxListVarProc): free
+ itemconfig data when removing it from table. [Bug 836483]
+
+ * macosx/tkMacOSXClipboard.c (TkSuspendClipboard, TkSelGetSelection):
+ add unicode clipboard support. [Patch 840107] (senn)
+
+2003-11-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure:
+ * win/tcl.m4: add necessary ole libs to VC LIBS_GUI line.
+
+ * win/tkWinDraw.c (XFillRectangles): correctly handle the
+ XGCValues.function parameter when filling rectangles. [Bug 820278]
+ [Patch 820282]
+
+ * win/configure:
+ * win/configure.in: define TK_LIB_FLAG, TK_LIB_SPEC,
+ TK_BUILD_LIB_SPEC, TK_STUB_LIB_SPEC, TK_STUB_LIB_PATH, and
+ TK_BUILD_STUB_LIB_PATH for tkConfig.sh [Bug 826614]
+
+ * unix/Makefile.in (SHLIB_LD_FLAGS): include in Makefile as it is used
+ in MAKE_LIB sometimes (ie: AIX-64) [Bug 829686] (jimix)
+
+2003-11-10 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c: correct yview handling of text widgets
+ containing no vertical pixels at all.
+
+2003-11-08 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tclWinSend.c: Fixed an error returning the registered name.
+
+2003-11-08 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/textDisp.test:
+ * tests/text.test:
+ * generic/tkText.h:
+ * generic/tkTextIndex.c:
+ * generic/tkTextBTree.c:
+ * generic/tkTextDisp.c: fix to another version of [Bug 833627] (crash
+ in tkchat), adding more tests. I believe the handling of nested elide
+ tags of all types is now correct!
+
+2003-11-07 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/textDisp.test:
+ * generic/tkTextDisp.c: fix to another version of [Bug 833627] (crash
+ in tkchat), adding two new tests.
+
+ * generic/tkText.c
+ * generic/tkTextIndex.c
+ * generic/tkTextDisp.c
+ * generic/tkTextWind.c
+ * generic/tkTextImage.c
+ * generic/tkTextTag.c
+ * generic/tkTextMark.c
+ * generic/tkTextBTree.c
+ * generic/tkText.h
+ * doc/text.n
+ * tests/text.test
+ * tests/textWind.test: better handling of 'elide' tags, especially
+ during line layout, counting and forward/backward index movement. Added
+ new tests to ensure correct behaviour with multiple tags of multiple
+ priorities.
+
+2003-11-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/demos/nl.msg: Dutch messages from Arjen Markus [Patch 836368]
+ * library/demos/widget: Added mechanism to support some l10n of the
+ actual hotkeys used.
+
+2003-11-04 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/textDisp.test:
+ * tests/textWind.test: fix to rest of test suite problems reported in
+ [Bug 833761]. This also has the nice effect that many more tests are
+ now run on Windows.
+
+2003-11-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/demos/widget (showCode,printCode): Added code to print the
+ source code on Unix and Win, courtesy of Arjen Markus and the Wiki.
+ [Patch 835644]
+
+2003-11-03 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c
+ * tests/textDisp.test: test and fix to a panic reported in [Bug
+ 833627], with tkchat, and an unused variable [Bug 835010]. Also fixes
+ substantial parts of [Bug 833761]
+
+2003-11-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/demos/widget, etc.: Made widget demos locate themselves
+ independently of the main Tk library using the new global variable
+ tk_demoDirectory. [Patch 832691, adapted]
+
+ * generic/tkTextDisp.c (TextGetScrollInfoObj): Stop complaints about
+ signed vs. unsigned for the length of strings.
+
+2003-11-01 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/msgs/nl.msg: Updated messages from Arjen Markus and Pascal
+ Scheffers. Thanks! [Patch 820519]
+
+2003-10-31 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkImgPhoto.c (ImgPhotoBlendComplexAlpha): OS X uses 32bpp
+ images internally always, so make use of the assumption.
+
+2003-10-31 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ TIP#155 IMPLEMENTATION
+
+ * generic/tkText.c, generic/tkTextIndex.c, generic/tkTextDisp.c
+ * generic/tkTextWind.c, generic/tkTextImage.c, generic/tkTextTag.c
+ * generic/tkTextMark.c, generic/tkTextBTree.c, generic/tkText.h
+ * doc/text.n, tests/text.test, tests/textDisp.test
+ * tests/textImage.test, tests/textIndex.test, tests/textWind.test
+ * library/text.tcl, generic/tkCanvas.c, unix/tkUnixDefault.h
+ * win/tkWinDefault.h, mac/tkMacDefault.h, macosx/tkMacOSXDefault.h
+
+ This adds the 'count' and 'replace' subcommands to the text widget, the
+ '-blockcursor' option, and in particular provides correct, smooth
+ pixel-based scrolling of the widget under all circumstances. See the
+ text.n man page for the complete new documentation. This also fixes
+ [Bugs 559450 778511 779174].
+
+ * generic/tkTextDisp.c
+ * tests/textDisp.test: tests and fix to the promptly reported [Bug
+ 833627]
+
+2003-10-31 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/tkWinMenu.c: more correct placing of images in compound menu
+ entries.
+
+2003-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkImgPhoto.c (ImgPhotoBlendComplexAlpha): add alpha blending
+ for images with partial transparency. Only operates for 15bpp+ display.
+ [Bug 809157]
+
+2003-10-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * unix/tkUnixRFont.c: Some cleaning up to get the file more in lines
+ with the general style guidelines. [Bug 832091] Still many comments
+ needed (from someone who knows the code!) for the style guide to be
+ satisfied, so bug still open.
+
+ * library/tkfbox.tcl (IconList_Create,IconList_Add): Added option
+ munging to allow some control of foreground colours on Unix in the same
+ way that you can influence the background. [Bug 795717]
+
+2003-10-28 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixFont.c (GetFontAttributes): place extra check for NULL
+ family against bad X servers.
+
+ * win/tkWinImage.c (XGetImageZPixmap): add separate 16bpp XGetImage
+ code to correctly handle 16bpp requests. This appears to never have
+ worked correctly.
+
+ * tests/focusTcl.test (setup1): expand frame size to allow for correct
+ visibility of windows that use larger default fonts.
+
+2003-10-28 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/tk.tcl (::tk::PlaceWindow): Added check for empty string
+ first when determining placement strategy. [Bug 819284]
+
+2003-10-23 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXDialog.c (NavServicesGetFile): Minor cleanups.
+ (OpenFileFilterProc): Handle FSRef's as well as FSSpec's in the input
+ file. Also convert the FSSpec filename to an C-string before passing to
+ MatchOneFile. [Bug 517600]
+ (MatchOneFile): Require the input filename to be a C-string, not a
+ pascal string.
+
+2003-10-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/dialog.tcl (tk_dialog): Constrain the dialog to be fairly
+ sensibly sized and placed. [Bug 827535]
+
+2003-10-15 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c, tests/unixWm.test: Delete WM_TRANSIENT_FOR property
+ instead of setting it to None when making a window nontransient [Bug
+ 632816 "cannot remove transient"]
+
+2003-10-14 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixPort.h(TkPutImage): changed macro argument names to match
+ function argument names ('dest' and 'src' were swapped, which was
+ confusing) [GPS]
+
+2003-10-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Applied patches from tcl bug 801467 from
+ * win/winMain.c: Joe Mistachkin
+
+2003-10-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkInt.h: move TkGetOptionSpec to stubs intDecls
+ * generic/tkIntDecls.h:
+ * generic/tkInt.decls:
+ * generic/tkStubInit.c:
+ * tkDecls.h: updated with latest genstubs
+ * tkIntPlatDecls.h:
+ * tkIntXlibDecls.h:
+ * tkPlatDecls.h:
+
+ * tests/listbox.test (13.3): correct result size
+ (4.7): correct test for possible window drift [Bug 701931] (dgp)
+
+ * unix/mkLinks:
+ * doc/GetHWND.3: add Tk_AttachHWND docs [Bug 220803]
+
+2003-10-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * mac/tkMacButton.c (TkpDisplayButton):
+ * macosx/tkMacOSXButton.c (TkpDisplayButton):
+ * unix/tkUnixButton.c (TkpDisplayButton): correct imageYOffset for
+ buttons with just images.
+
+2003-10-10 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkObj.c (TkRegisterObjTypes): Register the type of text
+ indexes.
+
+2003-10-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinButton.c (TkpDisplayButton): correct imageYOffset for
+ buttons with just images.
+
+2003-10-08 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tcl.m4: Add TIP #150 items to the TEA makefiles.
+ * win/configure:
+ * win/Makefile.in:
+
+ * win/tkWinSend.c: Clean up some warnings from gcc -Wall.
+ * win/tkWinSendCom.c:
+
+2003-10-06 Joe English <jenglish@users.sourceforge.net>
+
+ * library/text.tcl, doc/text.n: Text widget binding for Control-v is
+ now Mac-only, since it conflicts with standard <<Paste>> binding on
+ other platforms. [Bug 605277]
+
+2003-10-06 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkStyle.c: Fix double-free in style engine [Bug 798211]
+
+2003-10-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure:
+ * win/tcl.m4: removed incorrect checks for existence of optimization.
+ TCL_CFG_OPTIMIZED is now defined whenever the user does not build with
+ --enable-symbols.
+
+2003-10-06 Don Porter <dgp@users.sourceforge.net>
+
+ * doc/ConfigWidg.3: Removed reference to Tk_Offset from the NAME
+ section to resolve mkLinks conflict with SetOptions.3 [Bug 404197]
+
+ * unix/configure.in: Reconfigured to use $TCL_PREFIX as the default
+ value of --prefix, and also added warning when a TK_PREFIX value
+ different from TCL_PREFIX is selected, since [package require Tk] fails
+ in that configuration. [Bugs 428627,765642]
+
+ * unix/tcl.m4 (SC_PATH_TCLCONFIG): Corrected search path so that
+ alpha and beta releases of Tcl are not favored. [Bug 608698]
+
+ * unix/configure.in: Added check that version of Tcl header found by
+ configure matches that of the Tk we wish to build. As long as the Tk
+ sources insist on lockstep releases, Tk's configuration should verify
+ that's what we have. [Bug 749088]
+
+ * unix/configure: autoconf (2.57)
+ * unix/mkLinks: make mklinks
+
+2003-10-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/scale.tcl: Clear bug with chording mouse buttons.
+
+ * library/console.tcl: Avoid including the console in the list of
+ interpreters exposed by [winfo interps].
+
+2003-10-01 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Makefile: fixed redo prebinding bug when DESTDIR="". Added
+ support for all applicable customizable makefile variables from
+ tcl/macosx/Makefile.
+
+ * macosx/README:
+ * macosx/Wish.pbproj/project.pbxproj: ensure that the versioned wishX.X
+ script works correctly when Tk.framework with multiple versions is
+ present by referring to a copy of 'Wish Shell.app' located in
+ Tk.framework/Versions/X.X/Resources.
+
+2003-09-30 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXButton.c (TkpDisplayButton): Use the tk text drawing
+ for checkbuttons & radiobuttons as well as for labels.
+ * macosx/tkMacOSXEvent.c (XSync): New function, need to implement this
+ so drawing will get flushed in "update idletasks".
+ * tkMacOSXPort.h: convert #define of XSync to function def'n.
+
+2003-09-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/browse: Added suitable [package require] lines
+ * library/demos/hello: to all the Tk demo scripts which are
+ * library/demos/ixset: not run as part of something larger.
+ * library/demos/rmt: [FRQ 815118]
+ * library/demos/rolodex:
+ * library/demos/square:
+ * library/demos/tcolor:
+ * library/demos/timer:
+ * library/demos/widget:
+
+2003-09-30 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/safe.test: Accomodate TIP #150 in the results.
+ * tests/textWind.test: Fix a dependancy on font size in 10.1
+
+2003-09-30 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkCanvas.c (TkGetStringsFromObjs):
+ * generic/tkPanedWindow.c (PanedWindowWorldChanged): Private functions
+ should be either static or prefixed with 'Tk' (thanks to George Staplin
+ for spotting this.)
+
+2003-09-27 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ TIP#150 IMPLEMENTATION
+
+ * win/makefile.vc: Implementation of TIP #150, "Provide 'send'
+ * win/tkWinSend.c: command for Windows"
+ * win/tkWinSendCom.h:
+ * win/tkWinSendCom.c:
+
+2003-09-26 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * macosx/tkMacOSXWm.c (TkWmStackorderToplevelWrapperMap): Add
+ GetWindowFromPort() [Bug 812415]; make function static.
+
+2003-09-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/demos/widget: don't create iconwindow on aqua, but add about
+ menu like on classic.
+ * macosx/Makefile: pass MAKEOVERRIDES to pxbuild.
+ * macosx/tkMacOSXButton.c: added -compound support for bevel buttons.
+
+ * unix/configure:
+ * unix/configure.in:
+ * unix/tkConfig.sh.in: added TK_INCLUDE_SPEC to allow extensions to
+ find installed Tk headers, parallel to TCL_INCLUDE_SPEC. [Bug 777203]
+
+2003-09-18 Chengye Mao <chengye.geo@yahoo.com>
+
+ * generic/tkConsole.c: Fixed memory leak [Bug 802435]
+
+2003-09-18 Peter Spjuth <peter.spjuth@space.se>
+
+ TIP#147 IMPLEMENTATION
+
+ * doc/grid.n:
+ * tests/grid.test:
+ * generic/tkGrid.c: Implementation of TIP#147, "Make Grid's Column/Row
+ Configure Easier".
+
+2003-09-17 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkImage.c: Stopped [image create] from generating an image
+ * tests/image.test: command name that would overwrite an existing
+ command name. Thanks to Michael Schlenker. [Bug 808039].
+
+2003-09-16 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/grid.test:
+ * generic/tkGrid.c: Reworked a part of grid's geometry computations to
+ handle some tricky cases better. [Bug 792387]
+
+2003-09-05 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/bind.n: Describe %P and %s substitution for Property events.
+ [Bug 577906 "%P substitution not documented"]
+
+2003-09-05 Don Porter <dgp@users.sourceforge.net>
+
+ * doc/wish.1: Implementation of TIPs 137/151.
+ * generic/tkMain.c (Tk_MainEx): Added recognition of the -encoding
+ * tests/main.test: command line option by Tk_MainEx() and
+ thus by wish and any other program built on Tk_MainEx(). [Patch 800139]
+ This is a ***POTENTIAL INCOMPATIBILITY*** only for those C programs
+ that embed Tcl and Tk, build on Tk_MainEx(), and make use of
+ Tk_MainEx's former ability to pass a leading "-encoding" option to
+ interactive shell operations.
+
+2003-08-27 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkListbox.c (ListboxSelect): Remove unused variable
+ 'increment'. [Bug 664783]
+
+2003-08-25 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: Don't do a string compare on the $(DBGX) variable,
+ use the $(DEBUG) boolean directly. Also, don't try to regen the stubs
+ table if $(TCLSH) doesn't exist.
+
+2003-08-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/msgbox.tcl: Brought into line with the newer
+ look-and-feel for the demos.
+ * library/demos/widget (addSeeDismiss): Added support for an extra
+ button defined by the caller.
+
+2003-08-21 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWin3d.c: Applied Tk patch 791273 from Jeremy Collins which
+ improves the 3d lines for sunken widgets under windows.
+
+2003-08-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/demos/widget: Redo code view dialog, use named fonts,
+ * library/demos/arrow.tcl: add basic see/dismiss routine with images
+ * library/demos/bind.tcl: for better look & feel
+ * library/demos/bitmap.tcl:
+ * library/demos/button.tcl:
+ * library/demos/check.tcl:
+ * library/demos/clrpick.tcl:
+ * library/demos/colors.tcl:
+ * library/demos/cscroll.tcl:
+ * library/demos/ctext.tcl:
+ * library/demos/entry1.tcl:
+ * library/demos/entry2.tcl:
+ * library/demos/entry3.tcl:
+ * library/demos/filebox.tcl:
+ * library/demos/floor.tcl:
+ * library/demos/form.tcl:
+ * library/demos/hscale.tcl:
+ * library/demos/icon.tcl:
+ * library/demos/image1.tcl:
+ * library/demos/image2.tcl:
+ * library/demos/items.tcl:
+ * library/demos/label.tcl:
+ * library/demos/labelframe.tcl:
+ * library/demos/menu.tcl:
+ * library/demos/menubu.tcl:
+ * library/demos/paned1.tcl:
+ * library/demos/paned2.tcl:
+ * library/demos/plot.tcl:
+ * library/demos/puzzle.tcl:
+ * library/demos/radio.tcl:
+ * library/demos/ruler.tcl:
+ * library/demos/sayings.tcl:
+ * library/demos/search.tcl:
+ * library/demos/spin.tcl:
+ * library/demos/states.tcl:
+ * library/demos/style.tcl:
+ * library/demos/text.tcl:
+ * library/demos/twind.tcl:
+ * library/demos/unicodeout.tcl:
+ * library/demos/vscale.tcl:
+
+2003-08-20 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkCanvPs.c (Tk_PostscriptFont): Use Tcl_Obj-based interfaces
+ for working with user-supplied font maps.
+
+2003-08-19 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkPanedWindow.c (PanedWindowWorldChanged): Set window
+ background from the -background resource. Fixes [Bug 791500
+ "PanedWindow refresh glitches on X"]
+
+2003-08-19 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/bind.n: Added more information on event types and details [FRQ
+ 523593 "bind(n) manpage needs more detail"]
+
+2003-08-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl to fix Tcl bug 781109.
+
+2003-08-15 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Faster color data parsing code
+ for the [$photo put] subcommand. Now doesn't do everything through the
+ pre-8.0 list handling routines!
+
+2003-08-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * unix/tkUnixButton.c (TkpDisplayButton): Stopped accesses to NULL
+ * unix/tkUnixMenu.c (TkpDrawMenuEntry): pointers that crashed tests.
+
+ TIP #109 IMPLEMENTATION FROM Brian Griffin <bgriffin@model.com>
+ * unix/tkUnixButton.c (TkpDrawCheckIndicator, TkpDisplayButton):
+ * unix/tkUnixMenu.c (DrawMenuEntryIndicator, TkpDrawMenuEntry):
+ Much improved display of checkbuttons and radiobuttons on UNIX/X.
+
+2003-08-13 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/scale.tcl: Fix for [Bug 787065] for Button-2 press.
+ * tests/scale.test: Added test for this bug.
+
+2003-08-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXMenu.c: fixed C99'ism that breaks gcc 2.95.
+
+2003-07-28 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinDialog.c: Applied patch from [Bug 611615] which fixes a
+ problem with double clicks in file dialogs falling through to the
+ window underneath in win32.
+
+ * library/panedwindow.tcl: Apply patch from [Bug 778893] to make the
+ panedwindow -opaqueresize option work as per the docs.
+
+ * library/tk.tcl: Apply fix for [Bug 778840] for window placement when
+ using multiple desktops on windows.
+
+2003-07-24 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinCursor.c: Fix for [Bug 776646] for a native hand2 and fleur
+ (move) cursor under win.
+ * tests/cursor.test: Check that documented cursors are available.
+
+2003-07-20 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/buildTkConfig.tcl: fix to TK_BUILD_* ref generation broken by
+ changes to tcl buildsystem.
+
+2003-07-19 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinCursor.c (TkGetCursorByName): Fix bug 420510 to provide
+ consistency between unix and windows -cursor option.
+
+ * library/scale.tcl: Fix for bug 706765 to correctly handle the
+ -sliderrelief option while moving the thumb.
+
+2003-07-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixFont.c (Tk_DrawChars): do not make XGetGeometry call that
+ prevents overwidth lines as it requires a roundtrip call to the X
+ server for every string drawn. Hard-code max width to 32768 until a
+ better solution to get max width is made.
+
+ * library/panedwindow.tcl: use widget-specific Priv slots for pwAfterId
+ and panecursor items to correctly handle cursor changes with adjacant
+ panedwindows.
+
+ * generic/tkEvent.c (Tk_HandleEvent): correct XCreateIC call for
+ TK_XIM_SPOT usage. [Bug 742660] (takahashi)
+
+ * win/tkWinDialog.c: doubled the TK_MULTI_MAX_PATH value to ~10K. This
+ is a short-term solution until the -multiple option is extended. [Bug
+ 641261]
+
+2003-07-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkWindow.c:
+ * macosx/tkMacOSXDialog.c: added native tk_messageBox command,
+ (Tk_MessageBoxObjCmd) for MacOS X platform.
+
+ * macosx/tkMacOSXMenu.c: corrected encoding conversion for torn-off
+ menu entries (but many other display problems still exist with these)
+
+ * macosx/tkMacOSXMouseEvent.c: improved handling of events in the
+ presence of grabs, particularly activation events.
+
+2003-07-18 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/panedwindow.test (panedwindow-30.2):
+ * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd): Ensure that we can
+ share GCs between a panedwindow and its sash proxy, even if the
+ panedwindow is in a toplevel with a different visual. [Bug 702230]
+
+2003-07-17 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Makefile: Changes for new tcl buildsystem.
+
+ * macosx/Wish.pbproj/jingham.pbxuser:
+ * macosx/Wish.pbproj/project.pbxproj:
+ Changes for new tcl buildsystem. Changed build to include tk specific
+ html help in Tk.framework instead of Tcl.framework. Set default SYMROOT
+ in target options to simplify setting up PB (manually setting common
+ build folder for tcl & tk no longer needed).
+
+ * macosx/README: Updated info for changes to buildsystem, html help
+ location and PB setup.
+
+2003-07-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * doc/photo.n: [$photo put] has been able to take rectangles of pixel
+ colours, specified as lists of lists, for years. Now this is a
+ documented feature. [Bug 728952]
+
+ * doc/panedwindow.n: Removed warning invalidated by fix from Bug
+ 738143. [Bug 747814]
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Rewrote subcommand processing to
+ never jump to the end of the switch. I find that confusing as I can't
+ see whether there's processing still to be done from a quick glance at
+ the code, unlike with a direct return. [Bug 771988]
+ (ImgPhotoCmd, ImgPhotoSetSize, ImgPhotoInstanceSetSize): Try harder to
+ avoid zero-length mallocs()... [Bug 404421]
+
+2003-07-16 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkPack.c (ConfigureSlaves): silence compiler warning
+ [Bug 771982]
+
+2003-07-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinImage.c (XGetImage): correct init of biSizeImage in bitmap
+ header. [Bug 703697] (cap)
+
+2003-07-17 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/frame.test:
+ * generic/tkFrame.c (CreateFrame): Make sure all options can be set to
+ their default value. [Bug 697652]
+
+2003-07-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkPanedWindow.c (ArrangePanes): Ensure that the last pane
+ * tests/panedwindow.test: shrinks instead of being clipped when resized
+ below the reqsize. [Bug 748277] (spjuth)
+
+ * generic/tkWindow.c (Initialize): do not free uninit'ed dstring.
+ [Bug 755906] (mistachkin)
+
+2003-07-09 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/send.test: Strengthened constraints to stop accidental smashing
+ of Xserver access; some systems (*ahem* mine *ahem*) require
+ xhost-style security for all use... :^/
+
+2003-07-07 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkTextDisp.c (DisplayText): correct use of textPtr data with
+ respect to Tcl_Release time. [Bug 767009]
+
+2003-07-07 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImage.c (TkDeleteAllImages,etc.): Stopped the deleting of
+ hash entries from a table that has just been deleted by this function
+ when some images are Tcl_Preserve()d... [Bug 749353]
+
+2003-07-03 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXColor.c (GetControlPartColor): Use the ThemeBrushes to
+ get the control text color for buttons.
+
+2003-07-02 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/tkUnixEvent.c (TkpCloseDisplay): Don't test for XCloseIM bug
+ when the XFree86 version is newer than 4.0 since the layout of the XIM
+ structure has changed. The check is not needed for newer XFree86
+ releases since the bug we are checking for was fixed in the 4.2.99.2
+ release. [Bug 755530]
+
+2003-06-26 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * library/menu.tcl: workaround problem on some Windows systems by
+ trying to avoid posting a menu offscreen.
+
+2003-06-09 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: fix for [Bug 751553] "Xft: [font configure] does
+ not update in-use fonts". Fixed TkpGetSubFonts() to return information
+ about all subfonts, not just the first one.
+
+2003-06-01 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/configure.in: BUGFIX, --enable-xft test was broken.
+ * unix/configure: regen
+
+2003-05-31 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c (InitFont): Fill in TkFontAttributes from pattern
+ returned from GetFont (actual font) instead of the query pattern
+ (requested font).
+
+2003-05-31 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: New file
+ * unix/tkUnixDefault.h: Use different default fonts if HAVE_XFT
+ * unix/Makefile.in:
+ * unix/configure.in: Add --enable-xft flag
+ * unix/configure: regen
+ Experimental support for antialiased text under X11 [Patch 535541]
+
+2003-05-30 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkMenu.c
+ * generic/tkMenu.h
+ * generic/tkMenuDraw.c:
+ * tests/menu.test: fixed complex bug in menu clone cleanup [Bug 465324]
+ and removed 'knownBug' from a test.
+
+2003-05-29 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/text.n: Fixed markup errors.
+
+2003-05-28 Miguel Bañón <bagnonm@users.sourceforge.net>
+
+ * library/msgs/cs.msg: Updated messages from wohnivec@iol.cz
+
+2003-05-27 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c
+ * generic/tkTextTag.c
+ * generic/tkTextDisp.c
+ * generic/tkText.h: refactoring of text widget cleanup code to ensure
+ all resources are freed. [Bug 741179]
+
+ * library/tearoff.tcl: ensure torn-off menus do not appear underneath
+ the MacOS/MacOS X main menu bar.
+
+2003-05-23 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/mkLinks: Set the var S to "" at the top of the file to avoid
+ error when user has set S to something. [Bug 739833]
+
+2003-05-21 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkPanedWindow.c (PanedWindowReqProc): Thanks very much to
+ Eric Boudaillier for making panes resize correctly! [Bug 738143]
+
+ * generic/tkText.c (TextSearchCmd): Forwards and backwards aren't the
+ same. [Bug 740558] Also edited SearchCore to get it closer to the
+ Engineering Manual style guidelines.
+
+2003-05-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/textImage.test: Fixed faults in option parsing and made
+ * tests/text.test: tests conformant. [Bug 739965]
+ * generic/tkText.c (TextSearchCmd):
+
+ * library/demos/en.msg: Base catalog for the widget demo.
+ * library/demos/widget: Added message-catalog support.
+ * library/console.tcl: Reworked to use tk::AmpMenuArgs and be more "in
+ style".
+ * library/tk.tcl (tk::AmpMenuArgs): New procedure for doing
+ tk::AmpWidget-like processing for menus.
+
+ * generic/tkTextMark.c: Removed complaints about signed vs.
+ * generic/tkTextImage.c: unsigned in arguments to strncmp() by
+ * generic/tkText.c: using Tcl_GetIndexFromObj() more.
+
+2003-05-19 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ TIP#113 IMPLEMENTATION
+
+ * doc/text.n
+ * generic/tkCanvas.c
+ * generic/tkInt.h
+ * generic/tkTest.c
+ * generic/tkText.c
+ * generic/tkText.h
+ * generic/tkTextBTree.c
+ * generic/tkTextDisp.c
+ * generic/tkTextImage.c
+ * generic/tkTextIndex.c
+ * generic/tkTextMark.c
+ * generic/tkTextTag.c
+ * generic/tkTextWind.c
+ * generic/tkUndo.c
+ * generic/tkUndo.h
+ * generic/tkWindow.c
+ * library/text.tcl
+ * tests/text.test
+ * tests/textIndex.test
+ * tests/textMark.test
+ * tests/textTag.test
+ * tests/textWind.test: This adds multi-line searching and '-all'
+ searching to the text widget. In addition the changes contain a
+ complete 'objectification' of the text widget. Includes documentation
+ and new tests.
+
+2003-05-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: changed tkConfig.sh location in
+ versioned framework subdirectories to be identical to location in
+ framework toplevel; fixed stub library symbolic links to be tk version
+ specific.
+
+2003-05-15 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixFont.c: use gb2312-raw as the alias for gb2312* charset
+ fonts. gb2312.enc was made to be euc-cn for Tcl because that is what
+ is most often meant, but X really wants the original (-raw) gb2312
+ encoding. [Bug 557030]
+
+2003-05-14 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/msgs/fr.msg: updated msg catalog. [Bug 737790] (zolli)
+
+2003-05-13 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * win/makefile.vc: fix to installation of winhelp into path containing
+ a space (Bug 693512)
+
+2003-05-13 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXInit.c (TkpInit): use new versioned bundle resource
+ API to get tk runtime library for TK_VERSION. [Bug 736774]
+
+2003-05-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkCanvPoly.c (PolygonToPostscript):
+ * tests/canvPs.test: correct crash when generating postscript for a
+ single-line polygon (point) with no color. [Bug 734498] (wilm)
+
+2003-05-10 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXClipboard.c (TkSelGetSelection): Convert '\r' to '\n'
+ on the way into Tcl.
+
+2003-05-08 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/image.test (image-15.1): Test to ensure that widgets pick up
+ image information even if the image is deleted and recreated.
+
+ * generic/tkImage.c (Tk_ImageObjCmd): Use the ImageMaster's deleted
+ flag to stop deleted images from showing up in the various [image *]
+ operations. Can't delete directly from the table because that makes us
+ lose the information about what widgets want to use the image. [Bug
+ 634864]
+
+2003-04-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXButton.c (TkpDisplayButton): correct typo for
+ stippleGC [Bug 730124].
+
+2003-04-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkButton.h: Rewrote the handling of
+ * generic/tkButton.c (TkButtonWorldChanged): compound *buttons to
+ * mac/tkMacButton.c (TkpDisplayButton): correctly display mixture
+ * macosx/tkMacOSXButton.c (TkpDisplayButton): of disabledfg,
+ * unix/tkUnixButton.c (TkpDisplayButton): selectcolor, indicator,
+ * win/tkWinButton.c (TkpDisplayButton): etc. *buttons will now
+ only stipple the image, unless no disabledfg is given, in which case it
+ will stipple the whole button.
+
+ * library/bgerror.tcl: make bgerror dialog topmost on Windows to
+ prevent it being covered by other windows.
+
+ * unix/tkUnixButton.c (TkpDisplayButton): Use the normalTextGc when
+ * win/tkWinButton.c (TkpDisplayButton): displaying disabled text that
+ have images, as they get a gray50 stipple as well and the disabledGc is
+ not set up correctly for font drawing. [Bug 477740]
+
+2003-04-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure: regen
+ * win/configure.in (SHELL): force it to /bin/sh as autoconf 2.5x uses
+ /bin/bash, which can fail to find exes in the path (ie: lib).
+
+ * generic/tkCanvBmap.c: s/CreateBitmap/TkcCreateBitmap as Windows has a
+ CreateBitmap function already.
+
+ * generic/tkCursor.c: s/GetCursor/TkcGetCursor as Windows has a
+ GetCursor func already, which causes compiler warnings.
+
+2003-04-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinMenu.c (TkpInitializeMenuBindings): Rename the private menu
+ helper cmd from tk::tkWinMenuKey to tk::WinMenuKey. [Bug 721514]
+
+2003-04-14 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkBind.c (TkpGetBindingXEvent): Add helper method that can be
+ used to query the XEvent* for the currently executing binding.
+ * generic/tkInt.h: Declare TkpGetBindingXEvent.
+ * win/tkWinMenu.c (MenuKeyBindProc, TkWinMenuKeyObjCmd)
+ (TkpInitializeMenuBindings): Rename MenuKeyBindProc to
+ TkWinMenuKeyObjCmd and convert it into a Tcl command named
+ tk::tkWinMenuKey. Bind keyboard accelerator actions to this Tcl command
+ instead of using a native C binding. This makes it possible to extend
+ the existing binding with Tcl code and makes the Windows version work
+ just like the unix version.
+
+2003-04-04 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in: Subst TCL_LIBS instead of DL_LIBS and MATH_LIBS.
+ * unix/configure: Regen.
+ * unix/configure.in: Remove SC_ENABLE_THREADS invocation. Thread
+ support in an extension should be automatic when Tcl is compiled with
+ thread support. Add AC_DEFINE calls to set TCL_THREADS, _REENTRANT, and
+ _THREAD_SAFE since this was done in SC_ENABLE_THREADS. Remove socket
+ and math lib checks since these are already done in the Tcl configure
+ script.
+ * unix/tcl.m4: Update from Tcl to get TCL_LIBS fix. This fixes [Bug
+ 597847] which was caused by improper linking.
+ * unix/tkConfig.sh.in: Subst TCL_LIBS instead of MATH_LIBS and DL_LIBS.
+ [Bug 597847]
+
+2003-04-02 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/configure: Regen.
+ * win/configure.in: Set stub lib flag based on new LIBFLAGSUFFIX
+ variable.
+ * win/tcl.m4: Update from Tcl to get new LIBFLAGSUFFIX variable.
+
+2003-04-02 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/configure: Regen.
+ * win/configure.in: Don't set TCL_DLL_FILE, TCL_LIB_FILE,
+ TCL_STUB_LIB_FILE, TCL_STUB_LIB_FLAG, and TCL_BUILD_STUB_LIB_SPEC.
+ These variables are already set in tclConfig.sh. Don't subst vars that
+ are either not used, or already covered by a subst in
+ SC_LOAD_TCLCONFIG. [Bug 691908]
+
+2003-04-01 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2003-04-01 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/all.tcl: Made better use of a common -loadfile
+ * tests/constraints.tcl: to hold definitions common to all test
+ * tests/*.test: files.
+
+2003-03-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2003-03-26 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl to get BeOS changes.
+
+2003-03-22 Kevin Kenny <kennykb@acm.org>
+
+ * win/makefile.vc:
+ * win/rules.vc: Corrected several problems that prevented OPTS=symbols
+ from building properly. [Patch 707792] Thanks to Joe Mistachkin for the
+ fixes.
+
+2003-03-20 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXApplication.r (removed):
+ * macosx/tkMacOSXLibrary.r (removed):
+ * macosx/tkMacOSXResource.r (removed):
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/tkAboutDlg.r: updated copyrights, cleaned up about box,
+ removed obsolete unused resource files.
+
+ * macosx/buildTkConfig.tcl: TK_DEFS space fix.
+
+2003-03-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkConfig.sh.in: Add TK_DLL_FILE entry to mirror the TCL_DLL_FILE
+ entry in tclConfig.sh. [Patch 694271]
+
+2003-03-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/configure: Regen.
+ * win/configure.in: Don't run the AC_CYGWIN macro since it uses
+ AC_CANONICAL_HOST under autoconf 2.5X. Just check to see if __CYGWIN__
+ is defined by the compiler and set the ac_cv_cygwin variable based on
+ that. [Tcl Bug 705912]
+
+2003-03-18 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/unixWm.test (unixWm-41.2): Corrected typo in 2003-03-13 commit.
+ Thanks Larry Virden. [Bug 705567]
+
+2003-03-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Makefile:
+ * macosx/README: added support for giving 'make' the location of
+ Tcl.framework and tclsh to build and link against.
+
+ * macosx/tkMacOSXXStubs.c: fixed crash in [winfo server].
+
+2003-03-13 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/unixWm.test: Constrained all tests older than revision 1.21 to
+ run only on Unix. Alternative approach did not match maintainer habits.
+ * tests/spinbox.test (spinbox-17.4): Avoid long failure message.
+
+2003-03-13 Mo DeJong <mdejong@users.sourceforge.net>
+
+ Require autoconf 2.57 or newer, see TIP 34 for a detailed explanation
+ of why this is good. This will no doubt break the build on some
+ platforms, let the flaming begin.
+
+ * unix/configure: Regen with autoconf 2.57.
+ * unix/configure.in: Require autoconf 2.57.
+ * unix/tcl.m4: Update from Tcl.
+ * win/configure: Regen with autoconf 2.57.
+ * win/configure.in: Require autoconf 2.57.
+ * win/tcl.m4: Update from Tcl.
+
+2003-03-12 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/msgbox.tcl (tk::MessageBox): Stopped message box buttons from
+ getting very wide, and added some compensatory space so that the
+ smaller buttons still look nice (well, to me). [Bug 701812]
+
+2003-03-11 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXMenu.c (EventuallyInvokeMenu): New function, used to
+ invoke menu commands at idle time.
+ (TkMacOSXDispatchMenuEvent): Don't immediately dispatch menu commands,
+ wait till the idle loop to do so. This is more like what is done on
+ Windows, and avoids the crash from destroying a menu in it's command.
+
+ * macosx/tkMacOSXHLEvents.c (ReallyKillMe): Don't force the shell to
+ exit. According to the OS X HI guidelines, it should be possible to
+ cancel an attempt to quit, and if we force the kill, here, it would not
+ be possible to implement this.
+
+2003-03-11 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/unixWm.test: Add the testwrapper constraint to tests that
+ depend on the testwrapper command. These tests should not be run under
+ Windows for example.
+
+2003-03-11 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * doc/wm.n (minimize, maximize): Remove claim that the resizable
+ command keeps scripts from changing the size of windows since it is not
+ true. The resizable command only applies to user sizing via user
+ interaction.
+ * tests/unixWm.test: Replace broken tests with the nonPortable
+ constraint with new tests for maxsize and minsize options. These tests
+ verify that setting the minsize and maxsize will resize the window if
+ needed, and that the wm hints will be updated with the new sizes.
+ * tests/wm.test: Add an exhaustive set of tests for the wm maxsize and
+ wm minsize commands. These tests verify that setting the minsize and
+ maxsize will resize the window if needed. These tests have only been
+ run under Win98 and Window Maker under Linux, so further tweaking may
+ be needed for other systems.
+ * unix/tkUnixWm.c (UpdateGeometryInfo, UpdateSizeHints): Fixup
+ comments and initialization for the minWidth, minHeight, maxWidth,
+ maxHeight, width, and height members of the WmInfo struct. Check to
+ ensure that a new toplevel window size is not larger than the maxsize
+ or smaller than the minsize when updating the geometry at idle time.
+ Pass new width and height values to the UpdateSizeHints method so that
+ it can properly set the window min and max sizes for a window that
+ cannot be resized by the user. This fixes a bug where the window
+ resizes back to the original size when the user clicks on the window
+ border.
+ * win/tkWinWm.c (UpdateGeometryInfo): Fixup comments and
+ initialization for the minWidth, minHeight, maxWidth, maxHeight, width,
+ and height members of the WmInfo struct. Check to ensure that a new
+ toplevel window size is not larger than the maxsize or smaller than the
+ minsize when updating the geometry at idle time. [Patch 568861]
+
+2003-03-11 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkGrid.c (GridStructureProc, ConfigureSlaves): Check for a
+ NULL masterPtr and slavePtr in the GridStructureProc code to ensure
+ that a Gridder created before some error condition is ignored when it
+ comes to geometry calculations. This approach closely matches the pack
+ implementation. Keep track of a -in argument to a grid command in order
+ to detect the case of an already gridded widget that wants to change
+ some options. The previous implementation could make repeated and
+ unnecessary calls to Tk_ManageGeometry. Replace use of "parent" with
+ "master" in comments throughout the file.
+ * generic/tkPack.c (PackStructureProc): Check for a NULL masterPtr
+ before other checks so that a slave created under certain error
+ conditions is cleaned up properly. Replace use of "parent" with
+ "master" in comments throughout the file.
+ * generic/tkPlace.c (CreateSlave, ConfigureSlave, SlaveStructureProc):
+ Don't call Tk_ManageGeometry in CreateSlave since this was causing
+ incorrect results in some error cases. Rework the ConfigureSlave method
+ so that slave setup is done in one place. The call to Tk_ManageGeometry
+ was added to the one place where a slave is setup. When a slave is
+ configured but the master is not changed, simply goto the
+ scheduleLayout label. Check for a NULL master in SlaveStructureProc for
+ the sake of readability.
+ * tests/grid.test:
+ * tests/pack.test:
+ * tests/place.test: Add test to check that a winfo manager call does
+ not return incorrect results after an error condition is hit. [Patch
+ 693063]
+
+2003-03-11 Kevin Kenny <kennykb@users.sourceforge.net>
+
+ * win/makefile.vc: Backported the code that makes the makefile build
+ pkgIndex.tcl as part of the install step.
+
+2003-03-07 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXMenus.c (TkMacOSXInitMenus): No longer need to call
+ TkMacOSXSetHelpMenuItemCount.
+ * macosx/tkMacOSXMenu.c (TkMacOSXHelpMenuItemCount): Stub out since it
+ is no longer need (but is in the stubs table...).
+ (TkMacOSXDispatchMenuEvent): Get the number of system help menu items
+ from HMGetHelpMenu.
+ (ReconfigureMacintoshMenu): Ditto.
+ (TkpDestroyMenu): Ditto.
+
+2003-03-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ TIP#116 IMPLEMENTATION
+
+ * doc/FindPhoto.3: Documentation of the photo API changes due to
+ TIP#116
+
+ * generic/tkImgPhoto.c (Tk_PhotoExpand, Tk_PhotoPutBlock)
+ (Tk_PhotoPutZoomedBlock, Tk_PhotoSetSize): Added interp argument to
+ these functions and made them return a standard Tcl result, with error
+ indicating memory allocation failure instead of panic()ing.
+ [See TIP #116 at http://purl.org/tcl/tip/116.html for discussion.]
+ Each of these functions has also acquired a backward-compatability
+ variant as well, named with a _Panic suffix.
+ * generic.tk.decls: New API in new slots, back-compat API in old ones.
+ * generic/tk.h (USE_PANIC_ON_PHOTO_ALLOC_FAILURE): Allow users to
+ define this symbol to get the old 8.4 photo image API, including
+ panic() calls when things go wrong.
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Adjusted to use the new API
+ * generic/tkImgGIF.c (FileReadGIF): discussed above.
+ * generic/tkImgPPM.c (FileReadPPM):
+
+2003-03-05 David Gravereaux <davygrvy@pobox.com>
+
+ * win/rules.vc: updated default tcl version to 8.5.
+
+2003-03-04 Don Porter <dgp@users.sf.net>
+
+ * README: Bumped version number of Tk to
+ * generic/tk.h: 8.5a0.
+ * library/tk.tcl:
+ * mac/README:
+ * macosx/Wish.pbproj/project.pbxproj:
+ * unix/README:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/README:
+ * win/configure.in:
+ * win/makefile.vc:
+ * win/tcl.m4:
+
+ * unix/configure: autoconf
+ * win/configure:
+
+2003-03-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.4.2 TAGGED FOR RELEASE ***
+
+2003-02-28 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * tests/bind.test (bind-16.44):
+ * generic/tkBind.c (ExpandPercents): Only allow events to see those
+ expansions that are actually valid for them, and force the substitution
+ of the rest as "??". This stops some crashes on Windows and gets rid of
+ bogus values everywhere. [Bug 612110]
+
+2003-02-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/README: correct 8.4.3 refs to 8.4.2.
+
+ * unix/README: replace version refs with version-agnostic wording.
+
+2003-02-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinInt.h:
+ * win/tkWinDraw.c:
+ * win/tkWinFont.c (Tk_DrawChars): add support for simple XOR text
+ drawing on Windows. [Patch 685388] (martin)
+
+ * generic/tkMenu.c (TkMenuCleanup): make sure to reset static
+ menusInitialized on finalize. [Bug 548729]
+
+2003-02-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXHLEvents.c: fixed conversion of apple event parameters
+ to posix style path names. [Bug 621672] (steffen, Benjamin Riefenstahl)
+
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/tkMacOSXUtil.c (removed):
+ * macosx/tkMacOSXUtil.h (removed): removed all references to
+ tkMacOSXUtil.{c,h}, made obsolete by the patch above. [Bug 621672]
+
+2003-02-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixFont.c (CreateClosestFont, CanUseFallback): use the first
+ best font match in user font path. [Bug 647497] (dal zotto)
+
+ * generic/tkListbox.c (ListboxSelectionSubCmd):
+ * tests/listbox.test: Allow 'selection includes' to respond when
+ disabled (but only 'includes'). [Bug 632514]
+
+ * unix/tkUnixButton.c (TkpDisplayButton): Correct visual display of
+ disabled check/radiobutton to be more distinctive on unix.
+ * tests/unixButton.test: [Bug 669595] (hintermayer)
+
+ * doc/panedwindow.n: clarified the need to use 'update idle' when
+ adding unmapped windows. Needs further examination. [Bug 605105]
+
+ * generic/tkEntry.c (SpinboxWidgetObjCmd, EntryWidgetObjCmd):
+ * tests/entry.test: return 1 if selection is present even if
+ * tests/spinbox.test: entry/spinbox is disabled, as selection get will
+ still return the selection (although selection still ignore modify
+ requests when entry/spinbox is disabled). [Bug 637828]
+
+2003-02-24 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+
+ * tkMacOSXDialog.c (NavServicesGetFile): Fix bug with
+ kNavCtlSetSelection - control data should be a pointer not a handle.
+
+2003-02-21 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/clrpick.tcl (color::BuildDialog):
+ * library/msgbox.tcl (MessageBox): Yet more places that did complex
+ and fragile width calculations instead of using grid, though with these
+ it is the -uniform option that saves the day.
+
+ * library/tkfbox.tcl (file::Create): This procedure was really very
+ crufty in how it went about creating the GUI. It is far easier and more
+ robust to use the grid geometry manager than it is to tune the results
+ of pack with tweaks to -width. [Bug 673722]
+
+ * library/comdlg.tcl (FDGetFileTypes): Set an upper limit on how long a
+ file type item description string can get due to appending of types.
+ [Bug 617392]
+
+ * tests/panedwindow.test (panedwindow-30.1):
+ * generic/tkPanedWindow.c (DisplayPanedWindow, DisplayProxyWindow):
+ Use the window's depth, not the screen's default depth. [Bug 671122]
+
+2003-02-20 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/console.tcl: (aqua & macintosh) added missing <Cmd-q> binding
+ for corresponding Quit menu item shortcut.
+
+ * macosx/README: updated instructions for embedded build, added various
+ improvements by Russell Owen.
+
+ * unix/tcl.m4: update from Tcl.
+ * unix/configure: regen.
+
+2003-02-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinScrlbr.c (UpdateScrollbar): use SIF_DISABLENOSCROLL to
+ "disable" scrollbar when on Windows when there is nothing to scroll.
+ This is Windows style, and fixes [Bug 624116].
+
+ * tests/panedwindow.test:
+ * generic/tkPanedWindow.c (ValidSashIndex): corrected to note that 2
+ panes must exist before any one sash does. [tcllib Bug 689258]
+
+2003-02-20 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/panedwindow.test:
+ * generic/tkPanedWindow.c: Fixed calculation of the last slave's size
+ when increasing the size of the panedwindow. [Bug 689099]
+
+2003-02-20 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImgGIF.c (GetDataBlock): Removed pointless static variable
+ ZeroDataBlock [Bug 664788]
+
+ * unix/tkUnixFont.c (CanUseFallback): Added argument, passed through
+ from callers to FindSubFontForChar(), so that pointers into the old
+ subfont table to be updated when that table is reallocated, avoiding a
+ (sometimes fatal) FMR. [Bugs 618872, 689357]
+
+2003-02-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXKeyEvent.c: fix for uninitialized var warning.
+
+2003-02-19 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXMouseEvents.c (GeneratePollingEvents): In the case
+ where there was a capture window, we were sending the events to the
+ capture window. But the capture window (return value or
+ TkMacOSXGetCapture) is always a toplevel. So this is wrong in the case
+ that the Event's toplevel IS the capture window - in which case the
+ event should go to the subwindow most closely containing the event.
+
+2003-02-19 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+ and Jim Ingham <jingham@apple.com>
+
+ This patch changes the default Tk behavior so that events are by
+ default routed to the standard event handlers after Tk has looked at
+ them.
+
+ * macosx/tkMacOSXEvent.h: Rename "handledByTk" into "stopProcessing".
+
+ * macosx/tkMacOSXEvent.c: Update erroneous comments and remove unused
+ includes.
+ (TkMacOSXProcessAppleEvent): Don't declare events handled that we did
+ not even look at.
+ (TkMacOSXProcessEvent): Add a comment on policy for "stopProcessing".
+ (TkMacOSXProcessEvent): Remove "handling" of events that are not our
+ business.
+ (TkMacOSXProcessEvent): Rename "handledByTk" into "stopProcessing".
+ (ReceiveAndProcessEvent): Ditto.
+ (ReceiveAndProcessEvent): Tune error production of message.
+
+ * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): Rename
+ "handledByTk" into "stopProcessing".
+
+ * macosx/tkMacOSXWindowEvent.c: Ditto.
+
+ * macosx/tkMacOSXMouseEvent.c: Remove setting of "handledByTk".
+ (TkMacOSXProcessMouseEvent): Handle clicks in the "traffic lights" in
+ the window title when the window (or app) is in the background.
+
+ This patch changes the key event handling to use the MacOS translation
+ mechanisms. It also improves dead key handling.
+
+ * macosx/tkMacOSXKeyEvent.c (InitKeyData): Add.
+ (InitKeyEvent): Add.
+ (DecodeViaUnicodeResource): Rename KeycodeToUnicodeViaUnicodeResource.
+ (DecodeViaKCHRResource): Rename KeycodeToUnicodeViaKCHRResource.
+ (GetKeyboardLayout): Use a boolean flag instead of a special layout id.
+ (KeycodeToUnicodeViaUnicodeResource): Change interface and
+ implementation to return a Unicode string instead of directly filling
+ an XEvent.
+ (KeycodeToUnicodeViaKCHRResource): Ditto.
+ (KeycodeToUnicodeViaUnicodeResource): Add handling for callers that
+ don't want deadkey processing (i.e. XKeycodeToKeysym).
+ (KeycodeToUnicodeViaKCHRResource): Ditto.
+ (KeycodeToUnicodeViaUnicodeResource): Clear deadKeyState if a character
+ was produced.
+ (KeycodeToUnicodeViaKCHRResource): Use CFString and current keyboard
+ encoding instead of Tcl Tcl_ExternalToUtf() and fixed
+ TkMacOSXCarbonEncoding.
+ (TkMacOSXKeycodeToUnicode): Add.
+
+ (TkMacOSXProcessKeyboardEvent): Add some heuristics to improve keyup
+ events.
+ (deadKeyState): Split into deadKeyStateUp and deadKeyStateDown.
+ (GenerateKeyEvent): Change interface and implementation to accept a
+ Unicode string instead of individual characters.
+ (GenerateKeyEvent): Don't generate string representations for special
+ characters.
+
+ * macosx/tkMacOSXEvent.h (TkMacOSXKeycodeToUnicode): Add prototype.
+
+ * macosx/tkMacOSXKeyboard.c (KCHRPtr): Remove.
+ (XKeycodeToKeysym): Use TkMacOSXKeycodeToUnicode instead of
+ KeyTranslate.
+ (XKeycodeToKeysym): Support latin-1 keysyms.
+
+ This patch reverts the hack to put icons in menus that Vince put in
+ yesterday (but preserves the bug fix in that submission.)
+
+ * macosx/tkMacOSXMenu.c (SetMenuTitle): revert treating "<bullet>
+ number" as a request to put icon number <number> in the menu.
+
+2003-02-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * doc/entry.n:
+ * doc/text.n: Update double and triple click docs to match
+ implementation changes made on 2002-02-14.
+
+2003-02-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Makefile: reworked embedded build to no longer require
+ relinking but to use install_name_tool instead to change the
+ install_names for embedded frameworks. [Bug 644510]
+
+2003-02-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/demos/widget: New part for the widget demo showing
+ * library/demos/unicodeout.tcl: Tk's UNICODE output. [Patch 627453]
+
+2003-02-18 Andreas Kupries <andreask@activestate.com>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl (HP xnet [Bug 651811]).
+
+2003-02-18 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4: Update from Tcl.
+
+2003-02-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (TextWidgetCmd): remove unused lastEnd var. [Bug
+ 664790]
+
+ * generic/tkCanvPs.c (TkPostscriptImage): remove unused depth var. [Bug
+ 664787]
+
+ * generic/tkEntry.c (EntrySetValue): removed unused code var. [Bug
+ 664781]
+
+ * library/tk.tcl (::tk::TabToWindow): auto-highlight spinboxes as well
+ as entries when tabbing in. [Patch 683813] (bron)
+
+ * library/xmfbox.tcl (::tk::MotifFDialog_ActivateSEnt): correct sub on
+ embedded newlines. [Patch 688572] (bonfield)
+
+ * doc/colors.n: corrected B values [Bug 682714].
+
+ * win/tkWinInit.c (TkpDisplayWarning): truncate MessageBox string to
+ 1024 chars to prevent possible oversized window errors. May be
+ necessary in other MB uses (ie Tcl_AppInit). [Tcl Bug 608559]
+
+2003-02-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXMenu.c: (SetMenuTitle) fix to utf encoding problem
+ when setting menu titles, and provisional support for icons. [Tcl Bug
+ 625080]
+
+2003-02-18 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImgGIF.c (FileReadGIF): Ensure that the trashBuffer is
+ always deallocated on function exit to stop a potential memory leak.
+
+2003-02-17 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tkEvent.c (Tk_HandleEvent): Fixup button press state saving
+ code, it was incorrectly converting normal motion events into button
+ press and motion events in some cases.
+ * generic/tkInt.h: Add mouseButtonWindow member to the TkDisplay
+ structure.
+ * tests/event.test: Add test case for faulty button motion logic.
+
+2003-02-14 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * README: Bumped to 8.4.2.
+ * generic/tk.h:
+ * macosx/Wish.pbproj/project.pbxproj:
+ * unix/configure:
+ * unix/configure.in:
+ * unix/tcl.m4:
+ * unix/tk.spec:
+ * win/configure:
+ * win/configure.in:
+
+ * unix/tcl.m4: correct HP-UX ia64 --enable-64bit build flags
+
+2003-02-13 Kevin Kenny <kennykb@users.sourceforge.net>
+
+ * doc/wish.n: Added language to describe the handling of the
+ end-of-file character \u001a in script files. [Bug 685505]
+
+2003-02-10 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXCursor.c (TkMacOSXInstallCursor): Set all theme
+ cursors using SetThemeCursor or SetAnimatedThemeCursors.
+ (TkGetCursorByName): Use the theme cursors for arrow, ibeam, etc. Allow
+ animatedCursor{NUM} form for an animated cursor with count.
+ (TkpSetCursor): Don't reset the cursor if there is no change.
+ * macosx/tkMacOSXMouseEvent.c (GeneratePollingEvents): Don't directly
+ call TkMacOSXInstallCursor, it gets called by the call to
+ Tk_UpdatePointer immediately above.
+
+2003-02-05 Fred Fish <fnf@intrinsity.com>
+
+ * macosx/tkMacOSXWm.c (Tk_SetGrid): Fix precedence problem with
+ * mac/tkMacWm.c (Tk_SetGrid): '==' and '|'.
+
+2003-02-08 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkCanvArc.c (CreateArc): Rework canvas create item type
+ * generic/tkCanvBmap.c (CreateBitmap): coords handling to be
+ * generic/tkCanvImg.c (CreateImage): consistent across types and
+ * generic/tkCanvPoly.c (CreatePolygon): not pass empty coords to item
+ * generic/tkCanvLine.c (CreateLine): creation procs.
+ * generic/tkCanvText.c (CreateText):
+ * generic/tkCanvWind.c (CreateWinItem):
+ * generic/tkCanvas.c (CanvasWidgetCmd CANV_CREATE):
+ * generic/tkRectOval.c (CreateRectOval):
+ * tests/canvRect.test:
+ * tests/canvText.test:
+ * tests/canvas.test:
+
+2003-01-28 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkInt.h (TkDisplay,TkMainInfo):
+ * generic/tkObj.c (windowObjType):
+ * generic/tkWindow.c (Tk_DestroyWindow):
+ * tests/wm.test (wm-deletion-epoch-1.1): Moved 'deletionEpoch' field
+ from TkDisplay to TkMainInfo. Reworked windowObj type. Fixes [Bug
+ 671330] "segfault when e.g. deiconifying destroyed window"
+
+2003-01-23 D. Richard Hipp <drh@hwaci.com>
+
+ * library/entry.tcl: Fix the KeyPress binding on the entry widget so
+ that it enters text from left to right (not right to left) even if the
+ mouse button is being held down. [Bug 673687]
+
+2003-01-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * generic/tkFrame.c (TkToplevelWindowForCommand): Added way of mapping
+ from command names to tkwins-for-toplevels.
+ * generic/tkImage.c (Tk_ImageObjCmd): Added check to make sure that
+ you're not creating an image named the same as .'s command, which
+ refixes 220891, even when the name of the command has been changed with
+ 'rename'. The error message is better too.
+ * tests/image.test (image-1.10,image-1.11): Updated to match new error
+ message and added test for the rename case.
+
+2003-01-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkImage.c (DeleteImage): delete the image's entry in the
+ image table correctly when there are no more instances. This reopens
+ bug 220891. [Bug 669759]
+
+2003-01-18 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/loadTk.n: note that ::safe::loadTk has a prereq on
+ ::safe::interpCreate or ::safe::interpInit. [Bug 669159]
+
+ * doc/photo.n: $image put only accepts -format and -to, and note
+ extended use of -to.
+
+2003-01-17 D. Richard Hipp <drh@hwaci.com>
+
+ * generic/tkCanvUtil.c: The clipping algorithm introduced on 2003-01-08
+ was unnecessarily aggressive in reducing the size of the clipping box.
+ This did not cause a problem for normal display, but did create trouble
+ for some extensions that attempt to render a canvas on a GDI printer
+ under Windows. The patch here relaxes the constraints on the clipping
+ box somewhat. [Bug 663981]
+
+2003-01-14 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkSelect.c (Tk_CreateSelHandler): Fix for [Bug 666346]
+ "Selection handling crashes under KDE 3.0"
+ * tests/unixSelect.test (unixSelect-1.20): Added test case.
+
+2003-01-13 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinDialog.c (Tk_ChooseDirectoryObjCmd)
+ (ChooseDirectoryValidateProc, Tk_MessageBoxObjCmd): Remove unused
+ tsdPtr variable. Use TEXT macro instead of _T macro since _T does not
+ work under Cygwin. Declare flags as UINT to avoid compiler warning when
+ compiling with mingw.
+
+2003-01-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/Makefile.in: Add TCL_DEFS to AC_FLAGS so that compiler flags
+ defined by Tcl get passed to the compiler. Add empty rule for cat.c so
+ that Tk compiles under msys.
+ * win/configure: Regen.
+ * win/tcl.m4: Update from Tcl, this pulls in a subst of TCL_DEFS, it
+ also defines USE_THREAD_ALLOC when threads are used and it updates the
+ SC_ENABLE_SYMBOLS and SC_PROG_TCLSH macros to match the ones used in
+ Tcl.
+
+2003-01-10 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixEvent.c (OpenIM): Remove unused variable (Fixes: [Bug
+ 664780] "SGI warning: OpenIM")
+
+2003-01-08 D. Richard Hipp <drh@hwaci.com>
+
+ * generic/tkCanvLine.c:
+ * generic/tkCanvas.h:
+ * generic/tkCanvUtil.c: Clip long lines so that they will display
+ properly even on windowing systems where coordinates are expressed as
+ 16-bit numbers. [Bug 663981]
+
+2003-01-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkFrame.c (CreateFrame): throw a Tcl error instead of a panic
+ when we cannot get a main window and appname is NULL. This can indicate
+ that a user tried to create a frame/toplevel while Tk was dying. [Bug
+ 661792]
+
+ ******************************************************************
+ *** CHANGELOG ENTRIES FOR 2002 AND EARLIER IN "ChangeLog.2002" ***
+ ******************************************************************
diff --git a/README b/README
index 0794023..bc2a001 100644
--- a/README
+++ b/README
@@ -1,6 +1,5 @@
README: Tk
- This is the Tk 8.4.19 source distribution.
- Tcl/Tk is also available through NetCVS:
+ This is the Tk 8.5.11 source distribution.
http://tcl.sourceforge.net/
You can get any source release of Tcl from the file distributions
link at the above URL.
@@ -12,9 +11,9 @@ This directory contains the sources and documentation for Tk, an X11
toolkit implemented with the Tcl scripting language.
For details on features, incompatibilities, and potential problems with
-this release, see the Tcl/Tk 8.4 Web page at
+this release, see the Tcl/Tk 8.5 Web page at
- http://www.tcl.tk/software/tcltk/8.4.html
+ http://www.tcl.tk/software/tcltk/8.5.html
or refer to the "changes" file in this directory, which contains a
historical record of all changes to Tk.
diff --git a/bitmaps/error.bmp b/bitmaps/error.xbm
index 5a1331f..5a1331f 100644
--- a/bitmaps/error.bmp
+++ b/bitmaps/error.xbm
diff --git a/bitmaps/gray12.bmp b/bitmaps/gray12.xbm
index a0eafa1..a0eafa1 100644
--- a/bitmaps/gray12.bmp
+++ b/bitmaps/gray12.xbm
diff --git a/bitmaps/gray25.bmp b/bitmaps/gray25.xbm
index fdaef49..fdaef49 100644
--- a/bitmaps/gray25.bmp
+++ b/bitmaps/gray25.xbm
diff --git a/bitmaps/gray50.bmp b/bitmaps/gray50.xbm
index 1f9fbc0..1f9fbc0 100644
--- a/bitmaps/gray50.bmp
+++ b/bitmaps/gray50.xbm
diff --git a/bitmaps/gray75.bmp b/bitmaps/gray75.xbm
index f700b2c..f700b2c 100644
--- a/bitmaps/gray75.bmp
+++ b/bitmaps/gray75.xbm
diff --git a/bitmaps/hourglass.bmp b/bitmaps/hourglass.xbm
index bb1d8ad..bb1d8ad 100644
--- a/bitmaps/hourglass.bmp
+++ b/bitmaps/hourglass.xbm
diff --git a/bitmaps/info.bmp b/bitmaps/info.xbm
index 801476e..801476e 100644
--- a/bitmaps/info.bmp
+++ b/bitmaps/info.xbm
diff --git a/bitmaps/questhead.bmp b/bitmaps/questhead.xbm
index 17b2929..17b2929 100644
--- a/bitmaps/questhead.bmp
+++ b/bitmaps/questhead.xbm
diff --git a/bitmaps/question.bmp b/bitmaps/question.xbm
index ceba2ab..ceba2ab 100644
--- a/bitmaps/question.bmp
+++ b/bitmaps/question.xbm
diff --git a/bitmaps/warning.bmp b/bitmaps/warning.xbm
index 7925440..7925440 100644
--- a/bitmaps/warning.bmp
+++ b/bitmaps/warning.xbm
diff --git a/changes b/changes
index 0270bfc..e3a96be 100644
--- a/changes
+++ b/changes
@@ -5614,13 +5614,63 @@ with spaces in their names.
2004-02-18 (bug fix)[899246] fix shrinking grid geometry calculations
-2004-02-23 (platform support)[809157] Mac OS X: Add alpha blending for
+2003-02-23 (platform support)[809157] Mac OS X: Add alpha blending for
images with partial transparency.
2004-03-01 (platform support)[218561] Allow 64-bit configure on IRIX64-6.5*
--- Released 8.4.6, March 1, 2004 --- See ChangeLog for details ---
+Changes to 8.5a1 include all changes to the 8.4 line through 8.4.6,
+plus the following, which focuses on the high-level feature changes
+in this changeset (new minor version) rather than bug fixes:
+
+ * Tk is no longer guaranteed to work for Win95 (not tested 8.5+)
+
+ * configure scripts now require autoconf 2.57 for regeneration
+
+ * added support for anti-aliased test under X11 (already existed for
+ Win/Mac) using --enable-xft
+
+ * improved speed of 'photo put' handling
+
+ * updated demos for consistency and improved look & feel
+
+ * improve 3D line drawing for sunken widgets on Windows
+
+ * [792387] reworked 'grid' to handle some tricky geometry computations
+ better
+
+ * [TIP #109] updated look of radiobuttons and checkbuttons on X11
+
+ * [TIP #110] tristate value option for checkbuttons and radiobuttons
+
+ * [TIP #113] add multi-line searching and -all searching to the text widget
+ Full Tcl_Obj-ification of the text widget
+ * [TIP #155] add 'count' and 'replace' subcommands and a '-blockcursor'
+ option to text widgets and support smooth-scrolling of them
+ *** POTENTIAL INCOMPATIBILITY ***
+ Negative or decreasing tab-stops are explicitly disallowed
+
+ * [TIP #116] more safety for large image creation through use of attempted
+ allocation of large memory blocks
+
+ * [TIP #137/151] add -encoding option to 'wish' executable (through
+ Tk_MainEX())
+ *** POTENTIAL INCOMPATIBILITY ***
+ For Tk embedders that build on Tk_MainEx() and make use of Tk_MainEx's
+ former ability to pass a leading "-encoding" option to interactive shell
+ operations, this will now be consumed by Tk.
+
+ * [TIP #146] added 'grid anchor' subcommand for overall grid anchoring
+
+ * [TIP #147] recognize widget names and "all" as keywords in grid's
+ 'columnconfigure' and 'rowconfigure' subcommands
+
+ * [TIP #150] make 'send' available on Windows
+
+--- Released 8.5a1, March 3, 2004 --- See ChangeLog for details ---
+
2004-03-17 (platform support) Mac OS X: Grab the Command-H &
Command-Shift-H keys and use them for Hide and Hide Others before passing
keystrokes on to the generic keyboard event processing.
@@ -5740,21 +5790,176 @@ compositing of partially transparent areas.
--- Released 8.4.9, December 6, 2004 --- See ChangeLog for details ---
-2004-12-09 (performance)[1081966] BMP, JPG image load speed (fellows)
+Changes to 8.5a2 include all changes to the 8.4 line through 8.4.9, plus
+the following, which focuses on the 8.5-only changes since 8.5a1:
-2004-12-29 (platform support)[1092952,1091967] MSVC7, gcc OPT compiles (hobbs)
+2004-03-16 (bug fix)[915330] correct crash condition for new
+radio/checkbuttons when colors are exhausted (griffin)
-2005-01-11 (bug fix)[1098779] -pady accept all lists (fellows,kirkham)
+2004-03-18 (platform removal)[918139] Removed support for Mac OS Classic
+platform (steffen)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2004-03-26 (new feature)[FRQ 540375] support for
+[image create photo -format PPM -data] (fellows)
+
+2004-05-14 (bug fix)[TIP 152] -detail option for tk_messageBox (fellows)
+
+2004-06-04 (bug fix)[965398] Fix to shimmering infinite loop scrolling in
+text widget under rare circumstances (darley)
+
+2004-06-04 (bug fix) Fixed mousewheel bindings for OS X/Aqua (darley)
+
+2004-06-07 (bug fix)[965186] Fix text widget's record of
+partial-line-height calculations for very long wrapped lines, correcting
+scrollbar-text interactions (darley)
+
+2004-06-08 (bug fix)[968725] Fix text rendering problem with canvas text
+items that have a selected region. (dejong)
+
+2004-06-09 (bug fix) Fix multi-line regexp search bugs in text widget
+(darley)
-2005-01-14 (bug fix)[959973] Set _NET_WM_NAME and _NET_WM_ICON_NAME
+2004-06-15 (feature enhancement) Add 3D highlight to disabled *buttons and
+labels, as is done for disabled menu entries (kovalenko)
+
+2004-06-16 (bug fix)[742882] Fix potential division by zero in gridded wm
+geometry (english)
+
+2004-06-26 (bug fix)[756840] Fix Tk console cleanup on exit/reinit
+(mistachkin)
+
+2004-06-30 (new feature)[TIP 153] enhanced 'winfo toplevel' to recognize
+non-Tk windows (mckay)
+
+2004-07-02 (bug fix) Button 4 and 5 masks synchronized with Tk display
+(staplin)
+
+2004-07-05 (bug fix)[959973] Set _NET_WM_NAME and _NET_WM_ICON_NAME
(freedesktop.org) in addition to WM_NAME and WM_ICON_NAME (ICCCM). Allows
Unicode characters in wm titlebar on X11. (english)
-2005-01-14 (bug fix)[742882] division by zero in gridded wm geometry (english)
+2004-07-05 (new feature)[TIP 158][797404] Allow Win apps to distinguish
+keys on the keypad using the Extended modifier (grossbauer, kenny)
+
+2004-07-20 (feature enhancement)[922727] add install-private-headers target
+(steffen)
+
+2004-07-27 (bug fix) Fix segfault in case of premature end of GIF image
+data (steffen)
+
+2004-08-11 (feature)[979101] [tk_getOpenFile] consults env vars (fellows)
+
+2004-08-19 (new feature)[TIP 168] Add -smooth method for alternative bezier
+curve implementations on canvas items (hellstroem, fellows)
-2005-01-14 (bug fix)[632816] cannot remove transient (english)
+2004-08-29 (new feature)[TIP 165] Add %d binding substitution for
+user-controlled data field (fellows)
-2005-01-14 (bug fix)[568861] [wm minsize|maxsize] fix (dejong,english)
+2004-09-10 (new feature)[TIP 169] Allow for text peering with '$text peer'
+widget subcommand (griffin, darley)
+
+2004-10-08 (new feature)[TIP 205] Use pkgconfig Database to register Xft
+support (english)
+
+2004-10-11 (new language) Swedish message catalog from Mats Bengtsson
+
+2004-10-19 (new feature)[TIP 204][976928] Virtual events for keyboard
+traversal (english)
+
+2004-10-24 (new feature)[TIP 177, 179][983886] Add -hide and -stretch
+options to panedwindow widget (griffin)
+
+2004-10-26 (bug fix)[919066] Improve region handling functions
+
+2004-10-28 (bug fix)[220927] Fix scale labels to stay in window (schlenker,
+thoyts)
+
+2004-11-07 (bug fix)[962589] Made handling of ^ more consistent in grid
+(spjuth)
+
+2004-11-28 (bug fix)[942320] Fix short integer overflow in x,y coordinates
+for long lines using unix AA fonts (english)
+
+Updated test suite, documentation, and demos.
+
+--- Released 8.5a2, December 7, 2004 --- See ChangeLog for details ---
+
+2004-12-09 (performance)[1081966] BMP, JPG image load speed (fellows)
+
+2004-12-17 (feature change) Modified DisplayFrame to draw a container's
+background when the embedded window is NULL (chengyemao)
+
+2004-12-17 (bug fix)[842945][831627] Fixed a bug in ContainerEventProc
+to handle ConfigureNotify event properly; Changed CleanupContainList to
+TkWinCleanupContainerList to be invoked in TkWinXCleanup; Changed Intialize
+and CreateTopLevelWindow to create the DeleteWindowsExitProc after TkpInit
+so that finalization will be done in a proper sequence (to avoid painics
+and potential crashes in exit). (chengyemao)
+
+2004-12-17 (platform support) Added TkWinClenupContainerList into stublib.
+(chengyemao)
+
+2004-12-18 (buf fix)[222677] Close the embedded window (of a different
+process) when its container is destroyed. (chengyemao)
+
+2004-12-19 (Windows feature implementation of embedded/embedding
+Tk and bug fix) Implemented container identification, focus, raise, set
+title of and move window so that an embedded widget is able to identify
+a container, to get focus and to receive key press input. Fixed bugs include
+[1024364][1096047] and an incorrect wm overrideredirect for an embedded
+window. (chengyemao)
+
+2004-12-20 (Windows feature implementation of embedded/embedding Tk)
+Implemented overrideredirect for an embedded toplevel; correctly updated a
+frame's upper left x and y of an embedded toplevel after its container
+(of another process) moved. (chengyemao)
+
+2004-12-28 (feature implementatoin of embedded/embedding Tk of Windows)
+Implemented embedded/embedding toplevel menu. A menu may be embedded in
+a container of either the same process or a different process. Working
+fine with Windows 98. But having a problem when invoked with a mouse click
+(Windows XP): if an embedded menu is in a different process, the menu items
+may show as a blank window at the pull-down time and require the mouse
+moves over the menu items to complete display. (chengyemao)
+
+2004-12-29 (platform support)[1092952,1091967] MSVC7, gcc OPT compiles (hobbs)
+
+2005-01-03 (feature implementation of embedded/embedding Tk of Windows) Added
+a separated window handler for an embedded menu; solved the problem of
+a blank menu display with a mouse click in XP. (chengyemao)
+
+2005-01-07 (feature implementation of embedded/embedding Tk of Window) Added
+TK_STATE message (Windows) to support {wm state} for embedded windows; forced
+redraw of container after the embedded window detached; removed unnecessary
+panic in using embedded window; embeded toplevel menu of an embedded window
+automatically in wrapper updating. Modified and added functions: WmStateCmd,
+UpdateWrapper, TkpWmGetState (added) in tkWinWm.c; TkpUseWindow,
+TkWinEmbeddedEventProc in tkWinEmbed.c; TkWinChildProc in tkWinX.c.
+(chengyemao)
+
+2005-01-08 (bug fix)[1098625] Wrong toplevel geometry when created with a menu;
+[637653] Deleting a popup menu crashes wish (chengyemao)
+
+2005-01-09 (feature implementation of embedded/embedding Tk of Windows)
+Changed FrameWidgetObjCmd (tkFrame.c), TkpUseWindow (tkMacOSXEmbed.c,
+tkUnixEmbed.c, tkWinEmbed.c) to make implementation ready for a
+configurable toplevel -use option and completed the implementation for
+Windows (tkWinWm.c, tkWinEmbed.c, tkWinInt.h). Embedding with a frame
+container needs further debugging (chengyemao).
+
+2005-01-10 (enhancement)[1081595] stopped use of TK_DBGX (english)
+
+2005-01-11 (bug fix)[1098779] -pady accept all lists (fellows,kirkham)
+
+2005-01-11 (bug fix)[1093631] [text] scroll long wrapped line (darley)
+
+2005-01-18 (feature implementation of embedded/embedding Tk of Windows)
+Simplified TkpUseWindow, added Tk_DetachEmbeddedWindow and got rid of code
+for saving an embedded window object which is never used. Fixed a bug in
+TkWinHandleMenuEvent for processing WM_MENUSELECT. Wish crashed due to an
+invalid index in a case of MF_POPUP. The -use option of a toplevel can be
+configured after the toplevel is created.
2005-01-18 (bug fix) dialog visibility in demos (nash,fellows)
@@ -5762,7 +5967,7 @@ Unicode characters in wm titlebar on X11. (english)
2005-01-31 (enhancement)[1111213] msg catalog for Spain's Spanish. (poser)
-2005-02-10 (platform support) Correct gcc builds for AIX-4+, HP-UX-11 (hobbs)
+2005-02-03 (bug fix)[1114977] UID thread-safety in canvas (fellows)
2005-02-11 (bug fix)[949792] Fix error during panedwindow destroy (hobbs)
@@ -5771,21 +5976,57 @@ segfault (hobbs)
2005-02-11 (bug fix)[1119460] Disabled canvas bmap/bbox segfault (hobbs)
+2005-02-11 (platform support) Correct gcc builds for AIX-4+, HP-UX-11 (hobbs)
+
+2005-02-14 (bug fix)[443848] [text] elide newline, but not line (darley)
+
+2005-02-16 (new feature)[TIP 223] Windows: [wm attributes -fullscreen] (dejong)
+
2005-02-22 (bug fix)[1146057] Aqua: [tk_getOpenFile] encoding (steffen)
2005-02-28 (bug fix)[1118340] Fix Mousewheel %A translation (davis,hobbs)
+2005-03-09 (bug fix) Mac OS X: remote debugging under Xcode (ingham)
+
2005-03-10 (bug fix)[1160025] Aqua: offset in mouse coords (davies,ingham)
2005-03-10 (bug fix)[1124237] Aqua: floating window focus (davies,ingham)
+2005-03-14 (bug fix)[1162356] ClientMessageHandlers work now (petasis,fellows)
+
+2005-03-14 (bug fix)[1124237] Aqua: (un)map of subwindows (ingham)
+
+2005-03-14 (bug fix)[700305] Aqua: child window updates before creation
+(ingham)
+
2005-03-15 (platform support) OpenBSD ports patch (thoyts)
-2005-03-24 (enhancment) Aqua: native L&F for entry and spinbox (ingham)
+2005-03-15 (bug fix)[1143776] [text] display panic (revar,darley)
+
+2005-03-19 (bug fix)[1016385] allow [rename console] (fellows)
+
+2005-03-23 (enhancment) Aqua: native L&F for entry and spinbox (ingham)
+
+2005-03-23 (new feature) Aqua: [wm attributes -notify] (ingham)
2005-03-29 (platform support) Allow msys builds without cygwin (hobbs)
-2005-04-12 (bug fix)[1122671] font encoding alignment issue (brubaker,hobbs)
+2005-04-03 (bug fix)[1175092] grid geometry calculations (spjuth)
+
+2005-04-04 (bug fix)[1174269] [text] elide search (darley)
+
+2005-04-04 (bug fix)[1169429] [text] invisible cursor (darley)
+
+2005-04-04 (bug fix)[1083878] \0 char in [tk_getOpenFile -filetypes] (darley)
+
+2005-04-07 (bug fix)[1152809] [wm stackorder] panic; multi-DISPLAY (dejong)
+
+2005-04-14 (bug fix)[1122671] font encoding alignment issue (brubaker,hobbs)
+
+2005-04-18 (bug fix) [text] <Home> and <End> bindings (darley)
+
+2005-04-18 (bug fix)[1185640] [text] passed bogus utf-8 to Tk_MeasureChars
+(petasis,english)
2005-04-25 (platform support) Fix builds on Mac OS X 10.1 (steffen)
@@ -5803,40 +6044,36 @@ support (hobbs)
2005-05-15 (bug fix)[1202223] Aqua: [text] window -> scroll lock (kirkham)
+2005-05-22 (bug fix)[1206133] TkGetFileFilters: add all (dionizio,fellows)
+
2005-05-24 (platform support) Darwin/Aqua builds merged into unix (steffen)
2005-05-27 (behavior change) tk_popup menus now "sticky" (helfter)
+2005-05-28 (new feature)[TIP 245] [tk inactive] (max,fellows)
+
2005-05-30 (bug fix)[1161543,1010941,795869,690169] panedwindow
display/resizing (south)
2005-05-30 (bug fix)[1159367] [menu] creation segfault (schofield,hobbs)
-2005-05-31 (bug fix)[1152809] [wm stackorder] panic; multi-DISPLAY (dejong)
-
Documentation improvements [1087842,1081527,1115907,etc.]
---- Released 8.4.10, June 4, 2005 --- See ChangeLog for details ---
-
-2005-06-03 (bug fix)[1016385] allow [rename console] (fellows)
-
-2005-06-04 (bug fix)[1114977] UID thread-safety in canvas (fellows)
-
-2005-06-20 (bug fix) Eliminate buffer overflow in GIF decoder (fellows)
+--- Released 8.5a3, June 4, 2005 --- See ChangeLog for details ---
2005-06-23 (bug fix)[1176610] Aqua: default [entry] borderwidth (steffen)
-2005-06-23 (bug fix)[756840] Fix Tk console cleanup on exit/reinit (mistachkin)
+2005-07-18 (bug fix)[1240221] [$text mark prev] crash (darley)
---- Released 8.4.11, June 28, 2005 --- See ChangeLog for details ---
-
-2005-07-24 (enhancement)[1244153] use SC_PROG_TCLSH, SC_BUILD_TCLSH (dejong)
+2005-07-22 (platform support) msys build now requires msys_mingw7.zip (dejong)
2005-08-09 (Aqua enhancement) Carbon events (steffen)
-2005-08-11 (bug fix)[1252702] portable Tcl_GetStringFromObj() calls (fellows)
+2005-08-10 (bug fix)[1252702] portable Tcl_GetStringFromObj() calls (fellows)
+
+2005-08-12 (bug fix)[749908] per-thread Tk_ConfigSpec tables (fellows)
-2005-08-16 (bug fix)[749908] per-thread Tk_ConfigSpec tables (fellows)
+2005-08-23 (enhancement)[1244153] use SC_PROG_TCLSH, SC_BUILD_TCLSH (dejong)
2005-08-23 (bug fix)[1235544] adopt Tcl's SEH implementation (kenny,dejong)
@@ -5846,39 +6083,54 @@ Documentation improvements [1087842,1081527,1115907,etc.]
2005-10-04 (bug fix)[1309218] [tk_chooseDirectory -mustexist] (lemburg,hobbs)
+2005-10-04 (bug fix)[1311734] Fixed the problems that an embedded windows failed
+to respond to display changes (Windows platform) (chengyemao)
+
+2005-10-10 (new feature)[TIP 256] [$text config -tabstyle] (darley)
+
2005-10-10 (bug fix)[1319720] Tk_DeleteOptionTable() mem leak (melbardis)
+2005-10-12 (new feature) one directory test suite (starpackable) (zolli,fellows)
+
2005-10-18 (bug fix)[1328926] $argv encoding and list formatting (porter)
2005-11-06 (platform support) OpenBSD missing LIBS (thoyts)
+2005-11-10 (bug fix)[1353022] minor potential memleaks (fellows)
+
2005-11-22 (bug fix)[1353414] [selection get] compat w/OpenOffice.org (fellows)
+2005-11-14 (feature change) [bgerror] msg truncation at 45 chars (english)
+
+2005-11-15 (new feature)[TIP 231] [wm attributes] on X11 (english)
+
2005-11-22 (bug fix)[1335485] dialog and space in widget name (taylor,fellows)
-2005-11-29 (enhancement)[1369597] Win 64: --enable-64bit=amd64|ia64 (hobbs)
+2005-11-27 (platform support) Darwin 64bit, Tiger copyfile(), and
+Max OSX universal binaries support (steffen)
2005-11-29 (bug fix)[1252259] clear initial % from console (lawlor,hobbs)
-2005-11-30 (bug fix)[1289565] ClientMessage handling (staplin,hobbs)
-
2005-11-30 (bug fix)[1086049] [wm attributes -topmost] fix (courtney,hobbs)
-2005-12-01 (bug fix)[1353416] [tk_popup] wrong post location (fvogelnew1,hobbs)
+2005-12-08 (enhancement)[1369597] Win 64: --enable-64bit=amd64|ia64 (hobbs)
-2005-12-01 (workaround)[905830] Disable SCIM usage by Tk until properly
-handled (max)
-
---- Released 8.4.12, December 5, 2005 --- See ChangeLog for details ---
+2005-12-08 (bug fix)[1374935] [$text tag names] crash with peer (hobbs)
2005-12-12 (bug fix)[1377619] configure syntax error exposed in bash-3.1 (hobbs)
-2005-12-13 (Aqua) MouseWheel bindings; kEventMouseScroll events (steffen)
+2005-12-13 (Aqua) MouseWheel bindings; kEventMouseScroll events (steffen)
+
+2005-12-28 (bug fix)[1380427] text widget undo/redo crash (callewaert)
+
+2006-01-12 (new feature)[TIP 260] canvas text item -underline option (fellows)
2006-01-20 (bug fix)[905830] all events to XFilterEvent (SCIM compat) (english)
2006-01-25 (feature enhance)[1237759] update script lib to 8.4 (fradin,porter)
+2006-01-25 (feature enhance)[1409264] I10N of [bgerror] dialog (fellows)
+
2006-02-27 (bug fix)[480862] [$img configure -data] no display change (fellows)
2006-02-27 (bug fix)[470322] BitmapInit() thread safety (griffin,fellows)
@@ -5891,23 +6143,17 @@ handled (max)
2006-03-17 (bug fix)[1451587] no abbreviations in script library (thoyts)
-2006-03-20 (bug fix)[1380427] crash in undo stack (lz_ufo,callewaert,fellows)
+2006-03-21 (enhancement)[638966] Aqua: ATSUI text render (reifenstahl,steffen)
+
+2006-03-23 (platform support) new tk.spec file (max)
+
+2006-03-26 (bug fix)[1414171] crash in [$text dump -command] (macdonald,darley)
2006-03-27 (bug fix)[1458234] crash in animated GIFs (bron,fellows)
2006-03-29 (platform support)[917433] tolerate X servers that do not
accept the color names "Black" and "White" (porter)
-2006-04-05 (bug fix) several finalization issues corrected (hobbs)
-
-2006-04-05 (bug fix)[1442102] crash on full -elide [text] (hobbs)
-
-2006-04-05 (bug fix)[1374119] default keyboard charset init (hobbs)
-
-2006-04-05 (bug fix)[1414171] stop $text dump if change detected (hobbs)
-
-2006-04-05 (bug fix)[1422430] [grid] empty index list crash (hobbs)
-
2006-04-06 (bug fix)[1455241] Aqua: [wm attributes -titlepath] fix (steffen)
2006-04-07 (bug fix)[934524] Aqua: background window dragging/growing (steffen)
@@ -5925,13 +6171,13 @@ accept the color names "Black" and "White" (porter)
2006-04-11 (enhancement)[1105284] Aqua: call ::tk::mac::* procs for all
registered applevents (steffen)
-2006-04-11 (bug fix)[1212056] fix panic on safe window exit on Windows (hobbs)
-
2006-04-12 (bug fix)[1432666] grid row/col out of bounds crash (spjuth)
---- Released 8.4.13, April 19, 2006 --- See ChangeLog for details ---
+2006-04-25 (bug fix)[1475865] crash on invalid font name (fellows)
+
+Documentation improvements [1224983,1247835,1151523,1357575,1083838]
-2006-04-25 (bug fix)[1475865] crash on invalid font name from XServer (fellows)
+--- Released 8.5a4, April 27, 2006 --- See ChangeLog for details ---
2006-04-28 (bug fix)[1243318] Aqua: incorrect cursor pos in bindings (steffen)
@@ -5955,16 +6201,12 @@ registered applevents (steffen)
2006-06-01 (bug fix)[912571] [console] std chan refcount (mistachkin,hobbs)
-2006-06-05 (bug fix)[1188340] [console] thread safety (porter)
-
2006-06-14 (bug fix)[950121] Aqua: crash in draw of very wide images (steffen)
2006-06-14 (bug fix)[1501922] Aqua: invalid clip regions on redraw (steffen)
2006-06-14 (bug fix)[891141] excess variable writes by [scale] (porter)
-2006-06-15 (platform support)[1424909] MS VS2005 support (thoyts)
-
2006-07-20 (platform support) Mac OS X weak linking (steffen)
2006-07-21 (bug fix)[700311, 1525905] Aqua: pure modifier keysyms (steffen)
@@ -5981,8 +6223,6 @@ registered applevents (steffen)
2006-08-30 (new feature)[1518677] WM_UNICHAR window message (hobbs,petasis)
-2006-09-06 (bug fix)[1456342] speedier [text] delete (hobbs)
-
2006-09-10 (bug fix) Aqua: active/inactive text selection color&relief (steffen)
2006-09-10 (bug fix)[1472624] Aqua: mouse events in overrideredir wins (steffen)
@@ -5991,20 +6231,29 @@ registered applevents (steffen)
2006-09-22 (bug fix)[1562528] NULL terminates variadic calls (fellows,ryazanov)
-2006-09-26 (platform support) MSVC8 AMD64 support (thoyts)
+2006-09-22 (new feature)[TIP 268] [package provide] full patchlevel (kupries)
2006-10-05 (bug fix)[1122671] alignment fixes in ucs-2be encoding routines
(hobbs,staplin)
+2006-10-08 (new feature)[TIP 264] New public routine Tk_Interp() (thoyts)
+
2006-10-16 (bug fix)[1558051] Aqua: CG drawing matches X11 (steffen)
---- Released 8.4.14, October 19, 2006 --- See ChangeLog for details ---
+--- Released 8.5a5, October 20, 2006 --- See ChangeLog for details ---
-2006-10-31 (platform support)[1582769] Fix build with VC2003 (thoyts)
+2006-10-30 (new feature)[TIP 48] Addition of themed tk widgets to Tk as Ttk
+(themed Tk). Adds ttk::notebook, ttk::sizegrip, ttk::combobox,
+ttk::panedwindow, ttk::progressbar, ttk::menubutton, ttk::button,
+ttk::radiobutton, ttk::checkbutton, ttk::treeview, ttk::separator,
+ttk::scrollbar, ttk::entry, ttk::frame and ttk::labelframe widgets. Adds
+ttk::style command.
-2006-11-02 (enhancement) Improve OS X Carbon Update event handling (steffen).
+2006-11-02 (enhancement) Improve OS X Carbon Update event handling (steffen)
-2006-11-23 (bug fix)[1599877] Win: multibyte menu item underlines (hobbs)
+2006-11-07 (configure change) Unix --enable-xft is enabled by default (kenny)
+
+2006-11-23 (bug fix)[1599877] Fix unicode character underline in menus (hobbs)
2006-11-24 (bug fix)[1487701] Better handling of tcl_interactive on OS X to
control display of console (hobbs, steffen)
@@ -6013,17 +6262,21 @@ control display of console (hobbs, steffen)
2006-11-30 (bug fix) Fix handling of Escape binding on OS X dialogs (steffen)
-2006-12-01 (new feature) Win: [wm attributes -transparentcolor] (hobbs)
+2006-12-01 (new feature) Add -transparentcolor wm attribute on Windows (hobbs)
+
+2006-12-01 (new feature)[TIP 300] Added [font actual $font $char] (kenny)
-2006-12-04 (performance)[1608046] [$listbox itemconfigure] (rezic,hobbs)
+2006-12-04 (new feature)[TIP 286] Added [$menu xposition] subcommand (bron)
-2006-12-22 (bug fix)[1522467] use fd_mask for 64bit support (fellow,vriezen)
+2006-12-11 (enhancement) Improved EWMH support for _NET_WM_PID and
+_NET_WM_PING (fellows)
2007-01-25 (configure change) ensure CPPFLAGS env var used when set (steffen)
-2007-01-30 (enhancement) new target: `install-private-headers` (hobbs, steffen)
+2007-02-19 (configure change) Use SHLIB_SUFFIX=".so" on HP-UX IA64 (was
+".sl") (hobbs)
-2007-02-19 (bug fix)[1662959] [tk_getOpenFile] in empty dir (hobbs)
+2007-04-10 (platform support) Correctly handle theming on Vista/Aero (english)
2007-04-23 (enhancement) Allow empty value for -selectforeground opt (steffen)
@@ -6070,9 +6323,15 @@ window class of already existing windows (steffen)
2007-04-23 (platform support) Aqua: add tcl document extensions and mime type
to Wish.app's Info.plist (steffen)
-2007-05-15 (bug fix)[1677608] list shimmer crash [grid *configure] (porter)
+--- Released 8.5a6, April 25, 2007 --- See ChangeLog for details ---
---- Released 8.4.15, May 25, 2007 --- See ChangeLog for details ---
+2007-05-04 (new feature)[TIP 145] Enhanced font handling (thoyts)
+
+2007-05-14 (bug fix)[1712081] restored USE_OLD_IMAGE support (porter)
+
+2007-05-15 (bug fix)[1717830,800149] memory leaks (jenglish)
+
+2007-05-15 (bug fix)[1677608] [grid *configure] crash (porter)
2007-05-31 (platform support) Aqua: improve interaction of Expose events and
idle-time redraws (steffen)
@@ -6100,32 +6359,69 @@ installed tkMacOSXInt.h header (steffen)
2007-07-09 (bug fix) Aqua: window click activation & titlebar click handling
in presence of grabs or modal windows (steffen)
-2007-07-25 (bug fix)[1743786] Aqua: tk_getOpenFile result (steffen)
+2007-07-25 (bug fix)[1743786] Aqua: [tk_getOpenFile] result (steffen)
-2007-08-27 (bug fix)[1782105] Aqua: tk_chooseColor result (steffen)
+2007-08-01 (bug fix)[1692927] [tk_messageBox -detail] buffer (davies,thoyts)
-2007-09-11 (platform support) Windows AMD64 support (thoyts)
+2007-08-27 (bug fix)[1782105] Aqua: tk_chooseColor result (steffen)
-2007-09-11 (bug fix)[777203] add TK_INCLUDE_SPEC to tkConfig.sh (steffen)
+2007-09-06 (platform support) Aqua: drop support for Xcode 1.5 project, add
+project for Xcode 3.0 (steffen)
2007-09-11 (bug fix) Animated GIF buffer overrun (max)
2007-09-15 (platform support) SunOS-5.1x link with cc, not ld (steffen)
---- Released 8.4.16, September 21, 2007 --- See ChangeLog for details ---
+2007-09-17 (enhancement)[1780286] Aqua: combobox appearance (english)
+
+2007-09-17 (platform support)[1748251] Fix NetBSD link failures (english)
+
+2007-09-20 (bug fix)[1791052] [text] DLine layout crash (khomoutov,fellows)
+
+--- Released 8.5b1, September 26, 2007 --- See ChangeLog for details ---
+
+2007-09-26 (enhancement)[1800742] msg catalog for Hungarian. (reszo)
2007-10-11 (bug fix)[1810818] Aqua: [wm resizeable] (steffen)
-2007-10-11 (enhancement)[1800742] msg catalog for Hungarian. (reszo)
+2007-10-12 (platform support) Aqua: replace RgnHandles by HIShapeRefs (steffen)
+ *** POTENTIAL INCOMPATIBILITY for C code acessing MacDrawable Rgns ***
+
+2007-10-15 (platform support) Mac OS X: 64-bit X11 support (steffen)
+
+2007-10-15 (new feature)[TIP 125][998125] dockable frame support (hobbs)
+
+2007-10-22 (bug fix)[1814778,1780286,1609168,1349586] combobox overhaul(english)
+
+2007-10-22 (platform support) Aqua: TIP 145 and Aqua Theme fonts (steffen)
+
+2007-10-23 (bug fix)[1818441] combobox & reparentable frames (hobbs)
+
+2007-10-24 (bug fix)[1723362] Win: transparent bitmaps (mcdonald,thoyts)
2007-10-25 (bug fix)[1818491] crash in [place] manager (mcdonald)
-2007-10-26 (platform support) Mac OS X: 64-bit X11 support (steffen)
+2007-10-25 (new feature)[TIP 242][1156388] file dialog filter (hobbs)
-2007-11-09 (platform support) Aqua: replace RgnHandles by HIShapeRefs (steffen)
- *** POTENTIAL INCOMPATIBILITY for C code acessing MacDrawable Rgns ***
+2007-10-25 (bug fix)[1817596] ttk::notebook (english)
+
+2007-10-26 (bug fix)[1816252] Aqua: [wm transient] (steffen)
+
+Improvements to demo suite to make more use of Tk 8.5 features (fellows,steffen)
-2007-11-09 (enhancement) Aqua: "Run Widget Demo" menu item (steffen)
+--- Released 8.5b2, October 26, 2007 --- See ChangeLog for details ---
+
+2007-10-29 (appearance change) Default look and fonts on X11 (hobbs)
+ *** POTENTIAL INCOMPATIBILITY; [::tk::classic::restore] to undo ***
+
+2007-10-30 (bug fix)[1803723] Win: Arabic and Hebrew rendering (fellows)
+
+2007-10-30 (bug fix)[1550528] [tk_chooseDirectory -mustexist true] disables
+the "OK" until valid selection (hobbs)
+
+2007-11-03 (new feature) adjustable [console] fonts (thoyts)
+
+2007-11-04 (enhancement) Aqua: "Run Widget Demo" menu item (steffen)
2007-11-09 (bug fix) Aqua: activate event after window expansion (steffen)
@@ -6137,26 +6433,365 @@ look&feel; menubutton size with -image/-bitmap (steffen)
2007-11-09 (bug fix) Aqua: [tk_getOpenFile] (et al.) and help menu crashes on
Mac OS X Leopard (steffen)
+2007-11-11 (bug fix)[1824638] Aqua: small max-width text measuring (riefenstahl)
+
+2007-11-14 (bug fix)[1831803] sv.msg catalog for "sv" locale (fellows)
+
+Many significant improvements to the documentation and demos (fellows, hobbs,
+steffen, kupries)
+
+--- Released 8.5b3, Novemeber 19, 2007 --- See ChangeLog for details ---
+
+2007-11-25 (bug fix)[1343984] ttk::notebook bugs (english,boudaillier)
+
2007-11-26 (bug fix)[1822391] [photo put] segfault w/ PPM data (kenny)
+2007-11-26 (bug fix)[1822076] [tk_saveFile] and path w/spaces (bauer,kenny)
+
+2007-12-04 (new feature)[1844143] Danish message catalog (berg)
+
+2007-12-11 (bug fix)[1602537] crash in [$text replace] (goth,porter,fellows)
+
+2007-12-12 (bug fix)[1845899] Aqua: [wm transient] (steffen)
+
2007-12-12 (bug fix)[1809538,1799782,1737288] fixes for the <<Modified>>
virtual event on [text] widgets (hobbs)
2007-12-13 (bug fix) correctly trace menubutton -textvariable for -compound
use (hobbs)
-2007-12-18 (bug fix)[1845899] Aqua: [wm transient] (steffen)
+Several documentation and release notes improvements
+
+--- Released 8.5.0, December 18, 2007 --- See ChangeLog for details ---
+
+2007-12-30 (bug fix)[1860802] fixed Dutch message catalog (markus,fellows)
+
+2008-01-06 (bug fix)[1442006,1821939,18862692] MouseWheel for treeview (english)
+
+2008-01-08 (bug fix)[1865898,1679067] button size & state (english)
+
+2008-01-08 (bug fix)[1867122] [labelframe -style] crash (english,rib)
---- Released 8.4.17, January 4, 2008 --- See ChangeLog for details ---
+2008-01-27 (bug fix)[1835848] size value returned by [font actual] (english)
+
+2008-01-27 (bug fix)[1878298] [notebook] redraws on tab visibility (english)
+
+2008-01-31 (bug fix)[1881892] messagebox default title (hobbs)
2008-02-01 (bug fix)[CVE-2008-0553] buffer overflow in GIF format (max)
---- Released 8.4.18, February 8, 2008 --- See ChangeLog for details ---
+--- Released 8.5.1, February 5, 2008 --- See ChangeLog for details ---
2008-02-27 (bug fix)[1863346] Aqua: memleak in QD drawing (steffen)
+2008-02-29 (enhancement) Knight's tour demo (thoyts)
+
+2008-03-12 (bug fix)[1090382] crash when GetFont() fails (jenglish)
+
+2008-03-13 (enhancement) support space in INSTALL_ROOT or $builddir (steffen)
+
+2008-03-21 (bug fix)[1863007,1920030] Export Ttk stubs table (english)
+
+2008-03-26 (bug fix)[1922466] crash in [. configure -cursor] (gavilán)
+
2008-03-27 (platform support)[1921166] Solaris 64bit build fixes (steffen)
-2008-04-07 (bug fix)[1937135] Fix double-free with argv error (hobbs)
+2008-03-27 (bug fix) restored [::safe::loadTk] (hobbs)
+
+--- Released 8.5.2, March 28, 2008 --- See ChangeLog for details ---
+
+2008-04-07 (bug fix)[1937135] Tk_ParseArgv() double free crash (hobbs)
+
+2008-04-07 (bug fix)[1936238] wish -h mem explosion (bachmann,kenny)
+
+2008-04-14 (bug fix)[1941740] [tk_chooseColor -title] (thoyts)
+
+2008-04-17 (bug fix)[1327482] canvas item <Enter> events (wangnick)
+
+2008-05-23 (bug fix)[1967576] ttk::label height or width 0 panic (lawlor)
+
+2008-06-10 (enhancement)[1986818] Use Xutf8LookupString when possible (english)
+
+2008-06-12 (bug fix)[1991932] global grab segfault (steffen)
+
+2008-06-12 (platform support) Solaris/amd64 gcc 64bit support (steffen)
+
+2008-06-18 (bug fix) Aqua: missing focus on first map (steffen)
+
+--- Released 8.5.3, June 30, 2008 --- See ChangeLog for details ---
+
+2008-07-04 (bug fix)[2009213] crash in [ttk::scale] (polo,english)
+
+2008-07-26 (bug fix)[2026405] portability of [winfo id] (uchida,thoyts)
+
+2008-07-31 (bug fix) export Tk_PkgInitStubsCheck; fixes Tk embed on Windows
+
+2008-08-01 (bug fix)[2009788,2028703] unmapped toplevel crashes (thoyts)
+
+2008-08-05 (bug fix)[2010422] Tk header files revised to accommodate
+incompatible changes in recent X.org releases of X11 headers. (jenglish)
+
+--- Released 8.5.4, August 15, 2008 --- See ChangeLog for details ---
+
+2008-08-19 (behavior change) arguments passed to -[xy]scrollcommand
+callbacks, and values returned by [xy]view methods are explicitly
+formatted as doubles. (english)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2008-08-25 (bug fix)[1936220] fix [tk_getOpenFile -multiple 1] on unix (helfter)
+
+2008-08-25 (bug fix)[1023955] default menu cursor: no more Motif (helfter)
+
+2008-08-28 (bug fix) correct TK_LIBS value to include Xft (porter)
+
+2008-10-05 (bug fix)[2112563] format double values explicitly in double
+format, avoiding sensitivity to locale setting. (fellows)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2008-10-10 (bug fix)[1894038] [package require] any Tk 8.5.* in any Tcl 8.5.*
+(porter)
+
+--- Released 8.5.5, October 15, 2008 --- See ChangeLog for details ---
+
+2008-10-17 (enhancement) keyboard bindings for ttk::scale (thoyts)
+
+2008-11-12 (bug fix)[1777362] permit [text] names containing "-" (thoyts)
+
+2008-11-15 (bug fix)[2239034] limit [wm manage] to Frames (thoyts)
+
+2008-11-19 (bug fix)[2312027] Tk_Create*ImageType() thread safety (nijtmans)
+
+2008-11-22 (bug fix)[1939129,1991930] combobox behind other windows (thoyts)
+
+2008-12-22 (bug fix)[1813597,2218964] eliminate unnecessary units conversion
+in screen distances, reducing precision loss (ferrieux)
+
+2008-12-22 (bug fix)[2107938] no negative font size in PS (fellows)
+
+2008-12-22 (bug fix)[2264732] crash using nondefault visual (english)
+
+2008-12-22 (bug fix)[2207435] [ttk::entry .t -textvar ::noexist::x] (english)
+
+--- Released 8.5.6, December 23, 2008 --- See ChangeLog for details ---
+
+2009-01-07 (bug fix)[1847002] Win: prevent grab bypass (thoyts)
+
+2009-01-11 (bug fix) crash on XCreateIC failure (staplin)
+
+2009-01-14 (bug fix)[2507326] Restore aMSN compat (nijtmans)
+
+2009-01-19 (new feature) CONFIG_INSTALL_DIR - where tclConfig.sh goes (cassoff)
+
+2009-01-19 (platform support) better tools for BSD ports (cassoff)
+
+2009-02-17 (platform support) MSVC and _WIN64 (hobbs)
+
+2009-02-23 (bug fix)[1329198,456299,2507419] menu image display (mcdonald)
+
+2009-02-23 (bug fix)[2513104] fix cursor hotspots (mcdonald)
+
+2009-02-23 (bug fix)[2542828] Win: standard question_arrow cursor (danckaert)
+
+2009-02-27 (bug fix)[2645457] crash in Tk_MakeWindowExist() (thoyts)
+
+2009-03-25 (bug fix)[2178820] stop zero-size allocs in ttk (fellows)
+
+2009-03-25 (bug fix)[1871101] blurry large fonts on Vista (garvey,fellows)
+
+2009-04-10 (bug fix)[2116837] std virtual events with Caps Lock (fellows)
+
+--- Released 8.5.7, April 15, 2009 --- See ChangeLog for details ---
+
+2009-04-23 (bug fix)[2779910] updated Win chooseDir (hobbs)
+
+2009-04-24 (bug fix) prevent delete of selected folder in Win dialog (hobbs)
+
+2009-04-30 (bug fix)[2080533] panedwindow sash draw crash (fellows)
+
+2009-04-30 (bug fix)[2504402] iconphoto on non-32-bit displays (mcdonald,thoyts)
+
+2009-05-03 (bug fix)[2785744] broken flag twiddling (baker,fellows)
+
+2009-05-13 (bug fix)[2791352] XLFD parsing error (thoyts)
+
+2009-05-14 (new feature) Vista theme support (thoyts)
+
+2009-05-14 (bug fix)[1923684] confused checkbutton state (thoyts)
+
+2009-05-21 (bug fix)[2794778] Win menu keyboard traversal (thoyts)
+
+2009-06-02 (bug fix)[2799589] crash on delayed window activation (thoyts)
+
+2009-06-23 (bug fix)[220935] canvas dash update problem (nijtmans)
+
+2009-07-15 (bug fix)[2821962] photo image copy/paste (rib,fellows)
+
+2009-07-22 (bug fix)[2496114] focus in dead window crash (griffin,fellows)
+
+2009-08-01 (bug fix)[2830420] X iconphoto for big endian (misch,fellows)
+
+2009-08-04 (bug fix) [text] word-wrap of non-breaking space (fellows)
+
+2009-08-24 (bug fix) tk::MessageBox bindings for ttk::buttons (steiner,fellows)
+
+2009-08-25 (bug fix)[1909931] [send] update for Fedora 8 (fellows)
+
+2009-09-10 (bug fix) font allocation crash (berezhnoy,fellows)
+
+2009-09-14 (bug fix)[873608] win tearoff menu, no submenu arrows (traum,hobbs)
+
+2009-09-14 (bug fix)[873613] win tearoff menu repeat select (traum,hobbs)
+
+2009-09-25 (bug fix) grayscale from images (vetter,fellows)
+
+2009-10-07 (bug fix)[2088597] min scrollbar slider size (danckaert,fellows)
+
+2009-10-07 (bug fix)[2787164] combobox/menubutton arrow size (thoyts)
+
+2009-10-08 (bug fix)[2870648] file dialog cursor (danckaert,fellows)
+
+2009-10-10 (feature)[1961455] underline, overstrike Xft fonts (caffin,fellows)
+
+2009-10-15 (feature)[2794032] permit [load] into Tcl 8.6+ interps (porter)
+
+2009-10-22 (bug fix)[2168768] file dialog -typevariable scope (danckaert)
+
+2009-10-22 (bug fix)[1469210] [text] modified error (danckaert)
+
+2009-10-24 (bug fix)[2883712] 64-bit Aqua progress bar (haffner)
+
+2009-10-24 (bug fix)[1530276] X checkbutton -selectcolor (danckaert)
+
+2009-10-25 (bug fix)[1854913] [.t delete] before -startindex (danckaert)
+
+2009-10-25 (bug fix)[2809525] prevent X crash on overlong color name (goth)
+
+2009-10-29 (bug fix)[1825353] Russian Windows tiny fonts problem (thoyts)
+
+2009-11-03 (bug fix)[2891541] fix grab behaviour for main window (thoyts)
+
+--- Released 8.5.8, November 16, 2009 --- See ChangeLog for details ---
+
+2009-11-22 (bug fix)[2899949] crash on widget destroy (meier,thoyts)
+
+2009-11-24 (bug fix)[2902814] fix [wm iconphoto] on LP64 systems (fellows)
+
+2009-12-06 (bug fix)[2548661] crash in GetFontFamilyName (riefenstahl)
+
+2009-12-06 (bug fix)[2864685] Compiz menu item animation (gavilan,thoyts)
+
+2009-12-09 (bug fix)[2902573] Update Safe Tk to new Safe Base (kurpies)
+
+2009-12-11 (bug fix)[2912473] accept :: in DISPLAY name (fellows)
+
+2009-12-16 (bug fix)[2496162] crash calling Tk_DeleteOptionTable() (english)
+
+2009-12-20 (bug fix)[2917663] [send] accept SI:* on auth list (fellows)
+
+2009-12-22 (bug fix)[2919205] syntax bug in [tk_messageBox] (zaroo)
+
+2009-12-22 (bug fix)[2912356] [ttk::sizegrip] accommodate Compiz (english)
+
+2009-12-27 (bug fix)[2879927] Win: cascade menu highlight (pawlak,thoyts)
+
+2010-01-01 (bug fix)[1924761] stop [event generate] / XIM conflict (fellows)
+
+2010-01-03 (bug fix)[2848897] ODS_NOACCEL flag support (kovalenko,thoyts)
+
+2010-01-05 (bug fix)[220950] [$menu delete] bounds check (fellows)
+
+2010-01-05 [2898255] unlimited multi-file select (pawlak,fellows,thoyts)
+
+2010-01-06 (bug fix)[1163496] X: [wm transient] fix (bateman,fellows)
+
+2010-01-09 (new feature)[TIP 360] Modernize X11 Menus (thoyts)
+
+2010-01-18 (bug fix)[2932808] canvas update on state change (mcdonald,nijtmans)
+
+2010-01-19 (bug fix)[2931374] overflow in complex tag search (schmitz)
+
+2010-01-19 (new feature)[TIP 359] Extended Window Manager Hint Support (thoyts)
+
+2010-02-17 (bug fix)[2952745] crash in menu deletion (english)
+
+2010-03-11 (bug fix)[2968379] crash in peer text dump (fellows)
+
+2010-05-31 (bug fix)[3006842] crash on empty bind scripts (english)
+
+2010-08-03 (bug fix) entry validation compat with Itcl scope (hobbs)
+
+2010-08-12 (bug fix)[2585265] text <Delete>,<Backspace> note selection (fellows)
+
+2010-08-25 (feature)[3053320] update Ttk to tile 0.8.6 feature set (hobbs)
+
+--- Released 8.5.9, September 6, 2010 --- See ChangeLog for details ---
+
+2010-09-02 (bug fix)[3057573] specify combobox text fg color (english)
+
+2010-09-08 (bug fix)[2829363] [$tv see] open item -> sched display (english)
+
+2010-10-11 (bug fix)[3085489] crash in [tag add/remove] (english)
+
+2010-11-04 (enhancement) Updated German messages. (haertel,nijtmans)
+
+2010-11-16 (platform) VS 2005 SP1 MSVC compiler (nijtmans)
+
+2010-11-24 (bug fix)[3071836] crash in tk_getSaveFile (twylite)
+
+2010-12-12 (platform) OpenBSD build improvements (cassoff)
+
+2010-12-17 (platform) Revisions to support rpm 4.4.2 (cassoff)
+
+2011-01-13 (bug fix)[3154705] tk_messageBox close button disabled (skylera)
+
+2011-01-22 (enhancement) add [ttk::entry validate] (schelte,english)
+
+2011-03-10 (bug fix)[3205260] crash in [wm manage] (boudaillier, thoyts)
+
+2011-03-16 (bug fix)[3181181] tearoff submenu fix (menez, thoyts)
+
+2011-03-19 (bug fix)[3205464] [wm forget] loses window (boudaillier,thoyts)
+
+2011-03-19 (bug fix)[3223850] ttk button state disabled during click (thoyts)
+
+2011-03-22 (bug fix)[3000002] ttk scrollbar size Appearance (garvey,thoyts)
+
+2011-03-24 (bug fix)[3239768] Win menu font support (wehle)
+
+2011-03-28 (bug fix)[3129527] stop buffer overflows (dirtyepic,nijtmans)
+
+2011-04-04 (feature change)[2997657] No -container for [labelframe] (spjuth)
+
+2011-04-04 (bug fix)[723765] [grid remove] lost -in value (saye,spjuth)
+
+2011-04-22 (bug fix)[3291543] mem corrupt when [$canvas dchars] removes all
+coords of a polygon (rogers,spjuth)
+
+2011-04-30 (bug fix)[2949774] cascade menu unpost (thoyts)
+
+2011-06-06 (bug fix)[2546087] [console] treatment of '\0' (porter)
+
+2011-06-07 (bug fix)[2358545] Restore "08" in spinbox configured with -from
+and -to (porter)
+
+2011-06-07 (bug fix)[2484771] modal dialog settings (hoff, thoyts)
+
+2011-06-10 (bug fix)[3175610] incomplete line item refresh (ferrieux)
+
+2011-06-17 (bug fix)[3062331] crash in unset traces (macdonald,porter)
+
+--- Released 8.5.10, June 23, 2011 --- See ChangeLog for details ---
+
+2011-06-29 (bug fix)[3341056] new crash in unset traces (militaru,porter)
+
+2011-08-03 (bug fix)[3314770] restore file dialog resizeability (nijtmans)
+
+2011-09-22 (bug fix)[3404541] -takefocus option (dzach,english)
+
+2011-10-24 (new feature)[TIP 382] -confirmoverwrite on save dialog (porter)
+
+2011-10-25 (bug fix)[3410609] AltGr keysyms on Swiss keyboard (tasser,kenny)
+
+2011-11-02 (performance)[3431491] improved "pixels" shimmer logic (fellows)
---- Released 8.4.19, April 18, 2008 --- See ChangeLog for details ---
+--- Released 8.5.11, November 4, 2011 --- See ChangeLog for details ---
diff --git a/doc/3DBorder.3 b/doc/3DBorder.3
index 35bf666..01b359b 100644
--- a/doc/3DBorder.3
+++ b/doc/3DBorder.3
@@ -14,7 +14,6 @@ Tk_Alloc3DBorderFromObj, Tk_Get3DBorder, Tk_Get3DBorderFromObj, Tk_Draw3DRectang
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
Tk_3DBorder
\fBTk_Alloc3DBorderFromObj(\fIinterp, tkwin, objPtr\fB)\fR
.sp
@@ -23,7 +22,6 @@ Tk_3DBorder
.sp
Tk_3DBorder
\fBTk_Get3DBorderFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
void
\fBTk_Draw3DRectangle(\fItkwin, drawable, border, x, y, width, height, borderWidth, relief\fB)\fR
@@ -46,7 +44,7 @@ void
void
\fBTk_SetBackgroundFromBorder(\fItkwin, border\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOf3DBorder(\fIborder\fB)\fR
.sp
XColor *
@@ -55,9 +53,7 @@ XColor *
GC *
\fBTk_3DBorderGC(\fItkwin, border, which\fB)\fR
.sp
-.VS 8.1
\fBTk_Free3DBorderFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
\fBTk_Free3DBorder(\fIborder\fB)\fR
.SH ARGUMENTS
@@ -68,14 +64,12 @@ Interpreter to use for error reporting.
Token for window (for all procedures except \fBTk_Get3DBorder\fR,
must be the window for which the border was allocated).
.AP Tcl_Obj *objPtr in
-.VS 8.1
Pointer to object whose value describes color corresponding to
background (flat areas). Illuminated edges will be brighter than
this and shadowed edges will be darker than this.
.AP char *colorName in
Same as \fIobjPtr\fR except value is supplied as a string rather
than an object.
-.VE
.AP Drawable drawable in
X token for window or pixmap; indicates where graphics are to be drawn.
Must either be the X window for \fItkwin\fR or a pixmap with the
@@ -98,26 +92,26 @@ given by \fIx\fR, \fIy\fR, \fIwidth\fR, \fIheight\fR, negative means
border is outside rectangle.
.AP int relief in
Indicates 3-D position of interior of object relative to exterior;
-should be TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, TK_RELIEF_GROOVE,
-TK_RELIEF_SOLID, or TK_RELIEF_RIDGE (may also be TK_RELIEF_FLAT
+should be \fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR, \fBTK_RELIEF_GROOVE\fR,
+\fBTK_RELIEF_SOLID\fR, or \fBTK_RELIEF_RIDGE\fR (may also be \fBTK_RELIEF_FLAT\fR
for \fBTk_Fill3DRectangle\fR).
.AP XPoint *pointPtr in
Pointer to array of points describing the set of vertices in a polygon.
The polygon need not be closed (it will be closed automatically if it
-isn't).
+is not).
.AP int numPoints in
Number of points at \fI*pointPtr\fR.
.AP int polyBorderWidth in
Width of border in pixels. If positive, border is drawn to left of
trajectory given by \fIpointPtr\fR; if negative, border is drawn to
-right of trajectory. If \fIleftRelief\fR is TK_RELIEF_GROOVE or
-TK_RELIEF_RIDGE then the border is centered on the trajectory.
+right of trajectory. If \fIleftRelief\fR is \fBTK_RELIEF_GROOVE\fR or
+\fBTK_RELIEF_RIDGE\fR then the border is centered on the trajectory.
.AP int leftRelief in
-Height of left side of polygon's path relative to right. TK_RELIEF_RAISED
-means left side should appear higher and TK_RELIEF_SUNKEN means right side
+Height of left side of polygon's path relative to right. \fBTK_RELIEF_RAISED\fR
+means left side should appear higher and \fBTK_RELIEF_SUNKEN\fR means right side
should appear higher;
-TK_RELIEF_GROOVE and TK_RELIEF_RIDGE mean the obvious things.
-For \fBTk_Fill3DPolygon\fR, TK_RELIEF_FLAT may also be specified to
+\fBTK_RELIEF_GROOVE\fR and \fBTK_RELIEF_RIDGE\fR mean the obvious things.
+For \fBTk_Fill3DPolygon\fR, \fBTK_RELIEF_FLAT\fR may also be specified to
indicate no difference in height.
.AP int leftBevel in
Non-zero means this bevel forms the left side of the object; zero means
@@ -138,14 +132,13 @@ Non-zero means this bevel forms the top side of the object; zero means
it forms the bottom side.
.AP int which in
Specifies which of the border's graphics contexts is desired.
-Must be TK_3D_FLAT_GC, TK_3D_LIGHT_GC, or TK_3D_DARK_GC.
+Must be \fBTK_3D_FLAT_GC\fR, \fBTK_3D_LIGHT_GC\fR, or \fBTK_3D_DARK_GC\fR.
.BE
.SH DESCRIPTION
.PP
These procedures provide facilities for drawing window borders in a
way that produces a three-dimensional appearance.
-.VS 8.1
\fBTk_Alloc3DBorderFromObj\fR
allocates colors and Pixmaps needed to draw a border in the window
given by the \fItkwin\fR argument. The value of \fIobjPtr\fR
@@ -173,13 +166,12 @@ prevents \fBTk_Get3DBorder\fR from caching the return value, so
.PP
\fBTk_Get3DBorderFromObj\fR returns the token for an existing border, given
the window and color name used to create the border.
-\fBTk_Get3DBorderFromObj\fR doesn't actually create the border; it must
+\fBTk_Get3DBorderFromObj\fR does not actually create the border; it must
already have been created with a previous call to
\fBTk_Alloc3DBorderFromObj\fR or \fBTk_Get3DBorder\fR. The return
value is cached in \fIobjPtr\fR, which speeds up
future calls to \fBTk_Get3DBorderFromObj\fR with the same \fIobjPtr\fR
and \fItkwin\fR.
-.VE
.PP
Once a border structure has been created, \fBTk_Draw3DRectangle\fR may be
invoked to draw the border.
@@ -197,10 +189,10 @@ within \fIdrawable\fR (usually \fIx\fR and \fIy\fR are zero and
\fIborderWidth\fR specifies the number of pixels actually
occupied by the border. The \fIrelief\fR argument indicates
which of several three-dimensional effects is desired:
-TK_RELIEF_RAISED means that the interior of the rectangle should appear raised
-relative to the exterior of the rectangle, and
-TK_RELIEF_SUNKEN means that the interior should appear depressed.
-TK_RELIEF_GROOVE and TK_RELIEF_RIDGE mean that there should appear to be
+\fBTK_RELIEF_RAISED\fR means that the interior of the rectangle should
+appear raised relative to the exterior of the rectangle, and
+\fBTK_RELIEF_SUNKEN\fR means that the interior should appear depressed.
+\fBTK_RELIEF_GROOVE\fR and \fBTK_RELIEF_RIDGE\fR mean that there should appear to be
a groove or ridge around the exterior of the rectangle.
.PP
\fBTk_Fill3DRectangle\fR is somewhat like \fBTk_Draw3DRectangle\fR except
@@ -209,7 +201,7 @@ that it first fills the rectangular area with the background color
to the color used to create \fIborder\fR). Then it calls
\fBTk_Draw3DRectangle\fR to draw a border just inside the outer edge of
the rectangular area. The argument \fIrelief\fR indicates the desired
-effect (TK_RELIEF_FLAT means no border should be drawn; all that
+effect (\fBTK_RELIEF_FLAT\fR means no border should be drawn; all that
happens is to fill the rectangle with the background color).
.PP
The procedure \fBTk_Draw3DPolygon\fR may be used to draw more complex
@@ -228,7 +220,7 @@ it's not clear how useful this is.
\fBTk_Fill3DRectangle\fR is to \fBTk_Draw3DRectangle\fR: it fills
the polygonal area with the background color from \fIborder\fR,
then calls \fBTk_Draw3DPolygon\fR to draw a border around the
-area (unless \fIleftRelief\fR is TK_RELIEF_FLAT; in this case no
+area (unless \fIleftRelief\fR is \fBTK_RELIEF_FLAT\fR; in this case no
border is drawn).
.PP
The procedures \fBTk_3DVerticalBevel\fR and \fBTk_3DHorizontalBevel\fR
@@ -244,7 +236,9 @@ Each procedure takes \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR
arguments that describe the rectangular area of the beveled edge
(e.g., \fIwidth\fR is the border width for \fBTk_3DVerticalBevel\fR).
The \fIleftBorder\fR and \fItopBorder\fR arguments indicate the
-position of the border relative to the ``inside'' of the object, and
+position of the border relative to the
+.QW inside
+of the object, and
\fIrelief\fR indicates the relief of the inside of the object relative
to the outside.
\fBTk_3DVerticalBevel\fR just draws a rectangular region.
@@ -282,11 +276,10 @@ as long as \fIborder\fR exists.
The procedure \fBTk_3DBorderGC\fR returns one of the X graphics contexts
that are used to draw the border.
The argument \fIwhich\fR selects which one of the three possible GC's:
-TK_3D_FLAT_GC returns the context used for flat surfaces,
-TK_3D_LIGHT_GC returns the context for light shadows,
-and TK_3D_DARK_GC returns the context for dark shadows.
+\fBTK_3D_FLAT_GC\fR returns the context used for flat surfaces,
+\fBTK_3D_LIGHT_GC\fR returns the context for light shadows,
+and \fBTK_3D_DARK_GC\fR returns the context for dark shadows.
.PP
-.VS 8.1
When a border is no longer needed, \fBTk_Free3DBorderFromObj\fR
or \fBTk_Free3DBorder\fR should
be called to release the resources associated with it.
@@ -297,7 +290,6 @@ with the Tk_3DBorder token for the border.
There should be exactly one call to \fBTk_Free3DBorderFromObj\fR or
\fBTk_Free3DBorder\fR for each call to \fBTk_Alloc3DBorderFromObj\fR
or \fBTk_Get3DBorder\fR.
-.VE
.SH KEYWORDS
3D, background, border, color, depressed, illumination, object, polygon, raised, shadow, three-dimensional effect
diff --git a/doc/AddOption.3 b/doc/AddOption.3
index 3de6c2f..09a6d9e 100644
--- a/doc/AddOption.3
+++ b/doc/AddOption.3
@@ -16,9 +16,9 @@ void
.SH ARGUMENTS
.AP Tk_Window tkwin in
Token for window.
-.AP "CONST char" *name in
+.AP "const char" *name in
Multi-element name of option.
-.AP "CONST char" *value in
+.AP "const char" *value in
Value of option.
.AP int priority in
Overall priority level to use for option.
@@ -34,24 +34,19 @@ classes separated by asterisks or dots, in the usual X format.
this value will be returned in calls to \fBTk_GetOption\fR.
\fIPriority\fR specifies the priority of the value; when options are
queried using \fBTk_GetOption\fR, the value with the highest priority
-is returned. \fIPriority\fR must be between 0 and TK_MAX_PRIO. Some
+is returned. \fIPriority\fR must be between 0 and \fBTK_MAX_PRIO\fR. Some
common priority values are:
-.TP
-20
+.IP 20
Used for default values hard-coded into widgets.
-.TP
-40
+.IP 40
Used for options specified in application-specific startup files.
-.TP
-60
+.IP 60
Used for options specified in user-specific defaults files, such as
\fB.Xdefaults\fR, resource databases loaded into the X server, or
user-specific startup files.
-.TP
-80
+.IP 80
Used for options specified interactively after the application starts
running.
-.PP
.SH KEYWORDS
class, name, option, add
diff --git a/doc/BindTable.3 b/doc/BindTable.3
index 438e586..223c37b 100644
--- a/doc/BindTable.3
+++ b/doc/BindTable.3
@@ -25,7 +25,7 @@ unsigned long
int
\fBTk_DeleteBinding(\fIinterp, bindingTable, object, eventString\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_GetBinding(\fIinterp, bindingTable, object, eventString\fB)\fR
.sp
\fBTk_GetAllBindings(\fIinterp, bindingTable, object\fB)\fR
@@ -43,7 +43,7 @@ Token for binding table; must have been returned by some previous
call to \fBTk_CreateBindingTable\fR.
.AP ClientData object in
Identifies object with which binding is associated.
-.AP "CONST char" *eventString in
+.AP "const char" *eventString in
String describing event sequence.
.AP char *script in
Tcl script to invoke when binding triggers.
@@ -117,7 +117,7 @@ message is left in \fIinterp->result\fR.
\fBTk_DeleteBinding\fR removes from \fIbindingTable\fR the
binding given by \fIobject\fR and \fIeventString\fR, if
such a binding exists.
-\fBTk_DeleteBinding\fR always returns TCL_OK.
+\fBTk_DeleteBinding\fR always returns \fBTCL_OK\fR.
In some cases it may reset \fIinterp->result\fR to the default
empty value.
.PP
diff --git a/doc/CanvPsY.3 b/doc/CanvPsY.3
index c0aff6d..08b17a4 100644
--- a/doc/CanvPsY.3
+++ b/doc/CanvPsY.3
@@ -83,15 +83,15 @@ transformation.
of a bitmap.
The Postscript is generated in proper image data format for Postscript,
i.e., as data between angle brackets, one bit per pixel.
-The Postscript is appended to \fIinterp->result\fR and TCL_OK is returned
-unless an error occurs, in which case TCL_ERROR is returned and
+The Postscript is appended to \fIinterp->result\fR and \fBTCL_OK\fR is returned
+unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
\fIinterp->result\fR is overwritten with an error message.
.PP
\fBTk_CanvasPsColor\fR generates Postscript to set the current color
to correspond to its \fIcolorPtr\fR argument, taking into account any
color map specified in the \fBpostscript\fR command.
It appends the Postscript to \fIinterp->result\fR and returns
-TCL_OK unless an error occurs, in which case TCL_ERROR is returned and
+\fBTCL_OK\fR unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
\fIinterp->result\fR is overwritten with an error message.
.PP
\fBTk_CanvasPsFont\fR generates Postscript that sets the current font
@@ -99,8 +99,8 @@ to match \fItkFont\fR as closely as possible.
\fBTk_CanvasPsFont\fR takes into account any font map specified
in the \fBpostscript\fR command, and it does
the best it can at mapping X fonts to Postscript fonts.
-It appends the Postscript to \fIinterp->result\fR and returns TCL_OK
-unless an error occurs, in which case TCL_ERROR is returned and
+It appends the Postscript to \fIinterp->result\fR and returns \fBTCL_OK\fR
+unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
\fIinterp->result\fR is overwritten with an error message.
.PP
\fBTk_CanvasPsPath\fR generates Postscript to set the current path
@@ -112,8 +112,8 @@ current path in stippled fashion.
It uses \fIbitmap\fR as the stipple pattern and the current Postscript
color; ones in the stipple bitmap are drawn in the current color, and
zeroes are not drawn at all.
-The Postscript is appended to \fIinterp->result\fR and TCL_OK is
-returned, unless an error occurs, in which case TCL_ERROR is returned and
+The Postscript is appended to \fIinterp->result\fR and \fBTCL_OK\fR is
+returned, unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
\fIinterp->result\fR is overwritten with an error message.
.SH KEYWORDS
diff --git a/doc/CanvTkwin.3 b/doc/CanvTkwin.3
index fb8fff5..14db15e 100644
--- a/doc/CanvTkwin.3
+++ b/doc/CanvTkwin.3
@@ -36,7 +36,7 @@ Tk_OptionPrintProc *\fBTk_CanvasTagsPrintProc\fR;
A token that identifies a canvas widget.
.AP Tcl_Interp *interp in/out
Interpreter to use for error reporting.
-.AP "CONST char" *string in
+.AP "const char" *string in
Textual description of a canvas coordinate.
.AP double *doublePtr out
Points to place to store a converted coordinate.
@@ -85,9 +85,9 @@ coordinate (such as \fB2p\fR or \fB1.6c\fR) into a double-precision
canvas coordinate.
If \fIstring\fR is a valid coordinate description then \fBTk_CanvasGetCoord\fR
stores the corresponding canvas coordinate at *\fIdoublePtr\fR
-and returns TCL_OK.
+and returns \fBTCL_OK\fR.
Otherwise it stores an error message in \fIinterp->result\fR and
-returns TCL_ERROR.
+returns \fBTCL_ERROR\fR.
.PP
\fBTk_CanvasDrawableCoords\fR is called by type managers during
redisplay to compute where to draw things.
@@ -138,20 +138,20 @@ modified using image commands.
.PP
\fBTk_CanvasTagsParseProc\fR and \fBTk_CanvasTagsPrintProc\fR are
procedures that handle the \fB\-tags\fR option for canvas items.
-The code of a canvas type manager won't call these procedures
+The code of a canvas type manager will not call these procedures
directly, but will use their addresses to create a \fBTk_CustomOption\fR
structure for the \fB\-tags\fR option. The code typically looks
like this:
.CS
static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
- Tk_CanvasTagsPrintProc, (ClientData) NULL
+ Tk_CanvasTagsPrintProc, (ClientData) NULL
};
static Tk_ConfigSpec configSpecs[] = {
- ...
- {TK_CONFIG_CUSTOM, "\-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- ...
+ ...
+ {TK_CONFIG_CUSTOM, "\-tags", (char *) NULL, (char *) NULL,
+ (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ ...
};
.CE
diff --git a/doc/CanvTxtInfo.3 b/doc/CanvTxtInfo.3
index 7ffa07b..58bf6e1 100644
--- a/doc/CanvTxtInfo.3
+++ b/doc/CanvTxtInfo.3
@@ -33,20 +33,20 @@ text.
The structure has the following form:
.CS
typedef struct Tk_CanvasTextInfo {
- Tk_3DBorder \fIselBorder\fR;
- int \fIselBorderWidth\fR;
- XColor *\fIselFgColorPtr\fR;
- Tk_Item *\fIselItemPtr\fR;
- int \fIselectFirst\fR;
- int \fIselectLast\fR;
- Tk_Item *\fIanchorItemPtr\fR;
- int \fIselectAnchor\fR;
- Tk_3DBorder \fIinsertBorder\fR;
- int \fIinsertWidth\fR;
- int \fIinsertBorderWidth\fR;
- Tk_Item *\fIfocusItemPtr\fR;
- int \fIgotFocus\fR;
- int \fIcursorOn\fR;
+ Tk_3DBorder \fIselBorder\fR;
+ int \fIselBorderWidth\fR;
+ XColor *\fIselFgColorPtr\fR;
+ Tk_Item *\fIselItemPtr\fR;
+ int \fIselectFirst\fR;
+ int \fIselectLast\fR;
+ Tk_Item *\fIanchorItemPtr\fR;
+ int \fIselectAnchor\fR;
+ Tk_3DBorder \fIinsertBorder\fR;
+ int \fIinsertWidth\fR;
+ int \fIinsertBorderWidth\fR;
+ Tk_Item *\fIfocusItemPtr\fR;
+ int \fIgotFocus\fR;
+ int \fIcursorOn\fR;
} Tk_CanvasTextInfo;
.CE
The \fBselBorder\fR field identifies a Tk_3DBorder that should be
@@ -56,7 +56,7 @@ selected text, in pixels.
\fIselFgColorPtr\fR points to an XColor that describes the foreground
color to be used when drawing selected text.
\fIselItemPtr\fR points to the item that is currently selected, or
-NULL if there is no item selected or if the canvas doesn't have the
+NULL if there is no item selected or if the canvas does not have the
selection.
\fIselectFirst\fR and \fIselectLast\fR give the indices of the first
and last selected characters in \fIselItemPtr\fR, as returned by the
diff --git a/doc/Clipboard.3 b/doc/Clipboard.3
index 36c1726..6555290 100644
--- a/doc/Clipboard.3
+++ b/doc/Clipboard.3
@@ -44,8 +44,8 @@ number of targets.
.PP
\fBTk_ClipboardClear\fR claims the CLIPBOARD selection and frees any
data items previously stored on the clipboard in this application.
-It normally returns TCL_OK, but if an error occurs it returns
-TCL_ERROR and leaves an error message in \fIinterp->result\fR.
+It normally returns \fBTCL_OK\fR, but if an error occurs it returns
+\fBTCL_ERROR\fR and leaves an error message in \fIinterp->result\fR.
\fBTk_ClipboardClear\fR must be called before a sequence of
\fBTk_ClipboardAppend\fR calls can be issued.
.PP
@@ -54,13 +54,13 @@ The first buffer for a given \fItarget\fR determines the \fIformat\fR
for that \fItarget\fR.
Any successive appends for that \fItarget\fR must have
the same format or an error will be returned.
-\fBTk_ClipboardAppend\fR returns TCL_OK if the buffer is
+\fBTk_ClipboardAppend\fR returns \fBTCL_OK\fR if the buffer is
successfully copied onto the clipboard. If the clipboard is not
currently owned by the application, either
because \fBTk_ClipboardClear\fR has not been called or because
ownership of the clipboard has changed since the last call to
\fBTk_ClipboardClear\fR,
-\fBTk_ClipboardAppend\fR returns TCL_ERROR and leaves an error message in
+\fBTk_ClipboardAppend\fR returns \fBTCL_ERROR\fR and leaves an error message in
\fIinterp->result\fR.
.PP
In order to guarantee atomicity, no event handling should occur
diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3
index c7a8c33..6a3e41a 100644
--- a/doc/ConfigWidg.3
+++ b/doc/ConfigWidg.3
@@ -35,7 +35,7 @@ Pointer to table specifying legal configuration options for this
widget.
.AP int argc in
Number of arguments in \fIargv\fR.
-.AP "CONST char" **argv in
+.AP "const char" **argv in
Command-line options for configuring widget.
.AP char *widgRec in/out
Points to widget record structure. Fields in this structure get
@@ -43,14 +43,14 @@ modified by \fBTk_ConfigureWidget\fR to hold configuration information.
.AP int flags in
If non-zero, then it specifies an OR-ed combination of flags that
control the processing of configuration information.
-TK_CONFIG_ARGV_ONLY causes the option database and defaults to be
-ignored, and flag bits TK_CONFIG_USER_BIT and higher are used to
+\fBTK_CONFIG_ARGV_ONLY\fR causes the option database and defaults to be
+ignored, and flag bits \fBTK_CONFIG_USER_BIT\fR and higher are used to
selectively disable entries in \fIspecs\fR.
.AP "type name" type in
The name of the type of a widget record.
.AP "field name" field in
The name of a field in records of type \fItype\fR.
-.AP "CONST char" *argvName in
+.AP "const char" *argvName in
The name used on Tcl command lines to refer to a particular option
(e.g. when creating a widget or invoking the \fBconfigure\fR widget
command). If non-NULL, then information is returned only for this
@@ -61,12 +61,10 @@ Display containing widget whose record is being freed; needed in
order to free up resources.
.BE
.SH DESCRIPTION
-.VS 8.1
.PP
-Note: \fBTk_ConfigureWidget\fP should be replaced with the new
-\fBTcl_Obj\fP based API \fBTk_SetOptions\fP. The old interface is
+Note: \fBTk_ConfigureWidget\fR should be replaced with the new
+\fBTcl_Obj\fR based API \fBTk_SetOptions\fR. The old interface is
retained for backward compatibility.
-.VE
.PP
\fBTk_ConfigureWidget\fR is called to configure various aspects of a
widget, such as colors, fonts, border width, etc.
@@ -87,10 +85,10 @@ a table specifying the configuration options that are supported
\fIargv\fR) to fill in fields of a record (\fIwidgRec\fR).
It uses the option database and defaults specified in \fIspecs\fR
to fill in fields of \fIwidgRec\fR that are not specified in \fIargv\fR.
-\fBTk_ConfigureWidget\fR normally returns the value TCL_OK; in this
+\fBTk_ConfigureWidget\fR normally returns the value \fBTCL_OK\fR; in this
case it does not modify \fIinterp\fR.
If an error
-occurs then TCL_ERROR is returned and \fBTk_ConfigureWidget\fR will
+occurs then \fBTCL_ERROR\fR is returned and \fBTk_ConfigureWidget\fR will
leave an error message in \fIinterp->result\fR in the standard Tcl
fashion.
In the event of an error return, some of the fields of \fIwidgRec\fR
@@ -104,23 +102,26 @@ expected by the widget. Each of its entries specifies one configuration
option and has the following structure:
.CS
typedef struct {
- int \fItype\fR;
- char *\fIargvName\fR;
- char *\fIdbName\fR;
- char *\fIdbClass\fR;
- char *\fIdefValue\fR;
- int \fIoffset\fR;
- int \fIspecFlags\fR;
- Tk_CustomOption *\fIcustomPtr\fR;
+ int \fItype\fR;
+ char *\fIargvName\fR;
+ char *\fIdbName\fR;
+ char *\fIdbClass\fR;
+ char *\fIdefValue\fR;
+ int \fIoffset\fR;
+ int \fIspecFlags\fR;
+ Tk_CustomOption *\fIcustomPtr\fR;
} Tk_ConfigSpec;
.CE
The \fItype\fR field indicates what type of configuration option this is
-(e.g. TK_CONFIG_COLOR for a color value, or TK_CONFIG_INT for
+(e.g. \fBTK_CONFIG_COLOR\fR for a color value, or \fBTK_CONFIG_INT\fR for
an integer value). The \fItype\fR field indicates how to use the
value of the option (more on this below).
-The \fIargvName\fR field is a string such as ``\-font'' or ``\-bg'',
+The \fIargvName\fR field is a string such as
+.QW \-font
+or
+.QW \-bg ,
which is compared with the values in \fIargv\fR (if \fIargvName\fR is
-NULL it means this is a grouped entry; see GROUPED ENTRIES below). The
+NULL it means this is a grouped entry; see \fBGROUPED ENTRIES\fR below). The
\fIdbName\fR and \fIdbClass\fR fields are used to look up a value
for this option in the option database. The \fIdefValue\fR field
specifies a default value for this configuration option if no
@@ -130,7 +131,7 @@ about this option, and \fIspecFlags\fR contains additional information
to control the processing of this configuration option (see FLAGS
below).
The last field, \fIcustomPtr\fR, is only used if \fItype\fR is
-TK_CONFIG_CUSTOM; see CUSTOM OPTION TYPES below.
+\fBTK_CONFIG_CUSTOM\fR; see CUSTOM OPTION TYPES below.
.PP
\fBTk_ConfigureWidget\fR first processes \fIargv\fR to see which
(if any) configuration options are specified there. \fIArgv\fR
@@ -146,15 +147,15 @@ a value is found, then it is used as the value for the option.
Finally, if no entry is found in the option database, the
\fIdefValue\fR field of the \fIspecs\fR entry is used as the
value for the configuration option. If the \fIdefValue\fR is
-NULL, or if the TK_CONFIG_DONT_SET_DEFAULT bit is set in
+NULL, or if the \fBTK_CONFIG_DONT_SET_DEFAULT\fR bit is set in
\fIflags\fR, then there is no default value and this \fIspecs\fR entry
will be ignored if no value is specified in \fIargv\fR or the
option database.
.PP
Once a string value has been determined for a configuration option,
\fBTk_ConfigureWidget\fR translates the string value into a more useful
-form, such as a color if \fItype\fR is TK_CONFIG_COLOR or an integer
-if \fItype\fR is TK_CONFIG_INT. This value is then stored in the
+form, such as a color if \fItype\fR is \fBTK_CONFIG_COLOR\fR or an integer
+if \fItype\fR is \fBTK_CONFIG_INT\fR. This value is then stored in the
record pointed to by \fIwidgRec\fR. This record is assumed to
contain information relevant to the manager of the widget; its exact
type is unknown to \fBTk_ConfigureWidget\fR. The \fIoffset\fR field
@@ -162,7 +163,8 @@ of each \fIspecs\fR entry indicates where in \fIwidgRec\fR to store
the information about this configuration option. You should use the
\fBTk_Offset\fR macro to generate \fIoffset\fR values (see below for
a description of \fBTk_Offset\fR). The location indicated by
-\fIwidgRec\fR and \fIoffset\fR will be referred to as the ``target''
+\fIwidgRec\fR and \fIoffset\fR will be referred to as the
+.QW target
in the descriptions below.
.PP
The \fItype\fR field of each entry in \fIspecs\fR determines what
@@ -177,11 +179,11 @@ The value is converted to a \fBTk_Cursor\fR by calling
\fBTk_GetCursor\fR and the result is stored in the target.
In addition, the resulting cursor is made the active cursor
for \fItkwin\fR by calling \fBXDefineCursor\fR.
-If TK_CONFIG_NULL_OK is specified in \fIspecFlags\fR then the value
+If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value
may be an empty string, in which case the target and \fItkwin\fR's
active cursor will be set to \fBNone\fR.
If the previous value of the target
-wasn't \fBNone\fR, then it is freed by passing it to \fBTk_FreeCursor\fR.
+was not \fBNone\fR, then it is freed by passing it to \fBTk_FreeCursor\fR.
.TP
\fBTK_CONFIG_ANCHOR\fR
The value must be an ASCII string identifying an anchor point in one of the ways
@@ -194,17 +196,27 @@ The value must be an ASCII string identifying a bitmap in a form
suitable for passing to \fBTk_GetBitmap\fR. The value is converted
to a \fBPixmap\fR by calling \fBTk_GetBitmap\fR and the result
is stored in the target.
-If TK_CONFIG_NULL_OK is specified in \fIspecFlags\fR then the value
+If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value
may be an empty string, in which case the target is set to \fBNone\fR.
If the previous value of the target
-wasn't \fBNone\fR, then it is freed by passing it to \fBTk_FreeBitmap\fR.
+was not \fBNone\fR, then it is freed by passing it to \fBTk_FreeBitmap\fR.
.TP
\fBTK_CONFIG_BOOLEAN\fR
The value must be an ASCII string specifying a boolean value. Any
-of the values ``true'', ``yes'', ``on'', or ``1'',
+of the values
+.QW true ,
+.QW yes ,
+.QW on ,
+or
+.QW 1 ,
or an abbreviation of one of these values, means true;
-any of the values ``false'', ``no'', ``off'', or ``0'', or an abbreviation of
-one of these values, means false.
+any of the values
+.QW false ,
+.QW no ,
+.QW off ,
+or
+.QW 0 ,
+or an abbreviation of one of these values, means false.
The target is expected to be an integer; for true values it will
be set to 1 and for false values it will be set to 0.
.TP
@@ -213,10 +225,10 @@ The value must be an ASCII string identifying a border color in a form
suitable for passing to \fBTk_Get3DBorder\fR. The value is converted
to a (\fBTk_3DBorder *\fR) by calling \fBTk_Get3DBorder\fR and the result
is stored in the target.
-If TK_CONFIG_NULL_OK is specified in \fIspecFlags\fR then the value
+If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value
may be an empty string, in which case the target will be set to NULL.
If the previous value of the target
-wasn't NULL, then it is freed by passing it to \fBTk_Free3DBorder\fR.
+was not NULL, then it is freed by passing it to \fBTk_Free3DBorder\fR.
.TP
\fBTK_CONFIG_CAP_STYLE\fR
The value must be
@@ -231,10 +243,10 @@ The value must be an ASCII string identifying a color in a form
suitable for passing to \fBTk_GetColor\fR. The value is converted
to an (\fBXColor *\fR) by calling \fBTk_GetColor\fR and the result
is stored in the target.
-If TK_CONFIG_NULL_OK is specified in \fIspecFlags\fR then the value
+If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value
may be an empty string, in which case the target will be set to \fBNone\fR.
If the previous value of the target
-wasn't NULL, then it is freed by passing it to \fBTk_FreeColor\fR.
+was not NULL, then it is freed by passing it to \fBTk_FreeColor\fR.
.TP
\fBTK_CONFIG_CURSOR\fR
This option is identical to \fBTK_CONFIG_ACTIVE_CURSOR\fR except
@@ -244,7 +256,7 @@ that the new cursor is not made the active one for \fItkwin\fR.
This option allows applications to define new option types.
The \fIcustomPtr\fR field of the entry points to a structure
defining the new option type.
-See the section CUSTOM OPTION TYPES below for details.
+See the section \fBCUSTOM OPTION TYPES\fR below for details.
.TP
\fBTK_CONFIG_DOUBLE\fR
The value must be an ASCII floating-point number in
@@ -262,15 +274,18 @@ The value must be an ASCII string identifying a font in a form
suitable for passing to \fBTk_GetFont\fR. The value is converted
to a \fBTk_Font\fR by calling \fBTk_GetFont\fR and the result
is stored in the target.
-If TK_CONFIG_NULL_OK is specified in \fIspecFlags\fR then the value
+If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value
may be an empty string, in which case the target will be set to NULL.
If the previous value of the target
-wasn't NULL, then it is freed by passing it to \fBTk_FreeFont\fR.
+was not NULL, then it is freed by passing it to \fBTk_FreeFont\fR.
.TP
\fBTK_CONFIG_INT\fR
The value must be an ASCII integer string
-in the format accepted by \fBstrtol\fR (e.g. ``0''
-and ``0x'' prefixes may be used to specify octal or hexadecimal
+in the format accepted by \fBstrtol\fR (e.g.
+.QW 0
+and
+.QW 0x
+prefixes may be used to specify octal or hexadecimal
numbers, respectively). The string is converted to an integer
value and the integer is stored in the target.
.TP
@@ -310,29 +325,32 @@ is stored in the target.
\fBTK_CONFIG_STRING\fR
A copy
of the value is made by allocating memory space with
-\fBmalloc\fR and copying the value into the dynamically-allocated
+\fBTcl_Alloc\fR and copying the value into the dynamically-allocated
space. A pointer to the new string is stored in the target.
-If TK_CONFIG_NULL_OK is specified in \fIspecFlags\fR then the value
+If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value
may be an empty string, in which case the target will be set to NULL.
-If the previous value of the target wasn't NULL, then it is
-freed by passing it to \fBfree\fR.
+If the previous value of the target was not NULL, then it is
+freed by passing it to \fBTcl_Free\fR.
.TP
\fBTK_CONFIG_SYNONYM\fR
This \fItype\fR value identifies special entries in \fIspecs\fR that
are synonyms for other entries. If an \fIargv\fR value matches the
-\fIargvName\fR of a TK_CONFIG_SYNONYM entry, the entry isn't used
+\fIargvName\fR of a \fBTK_CONFIG_SYNONYM\fR entry, the entry is not used
directly. Instead, \fBTk_ConfigureWidget\fR searches \fIspecs\fR
for another entry whose \fIargvName\fR is the same as the \fIdbName\fR
-field in the TK_CONFIG_SYNONYM entry; this new entry is used just
+field in the \fBTK_CONFIG_SYNONYM\fR entry; this new entry is used just
as if its \fIargvName\fR had matched the \fIargv\fR value. The
synonym mechanism allows multiple \fIargv\fR values to be used for
-a single configuration option, such as ``\-background'' and ``\-bg''.
+a single configuration option, such as
+.QW \-background
+and
+.QW \-bg .
.TP
\fBTK_CONFIG_UID\fR
The value is translated to a \fBTk_Uid\fR
(by passing it to \fBTk_GetUid\fR). The resulting value
is stored in the target.
-If TK_CONFIG_NULL_OK is specified in \fIspecFlags\fR and the value
+If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR and the value
is an empty string then the target will be set to NULL.
.TP
\fBTK_CONFIG_WINDOW\fR
@@ -344,8 +362,8 @@ The value must be a window path name. It is translated to a
In some cases it is useful to generate multiple resources from
a single configuration value. For example, a color name might
be used both to generate the background color for a widget (using
-TK_CONFIG_COLOR) and to generate a 3-D border to draw around the
-widget (using TK_CONFIG_BORDER). In cases like this it is possible
+\fBTK_CONFIG_COLOR\fR) and to generate a 3-D border to draw around the
+widget (using \fBTK_CONFIG_BORDER\fR). In cases like this it is possible
to specify that several consecutive entries in \fIspecs\fR are to
be treated as a group. The first entry is used to determine a value
(using its \fIargvName\fR, \fIdbName\fR,
@@ -366,11 +384,11 @@ options. These values are used in three different ways as
described below.
.PP
First, if the \fIflags\fR argument to \fBTk_ConfigureWidget\fR has
-the TK_CONFIG_ARGV_ONLY bit set (i.e., \fIflags\fR | TK_CONFIG_ARGV_ONLY != 0),
+the \fBTK_CONFIG_ARGV_ONLY\fR bit set (i.e., \fIflags\fR | \fBTK_CONFIG_ARGV_ONLY\fR != 0),
then the option database and
\fIdefValue\fR fields are not used. In this case, if an entry in
-\fIspecs\fR doesn't match a field in \fIargv\fR then nothing happens:
-the corresponding target isn't modified. This feature is useful
+\fIspecs\fR does not match a field in \fIargv\fR then nothing happens:
+the corresponding target is not modified. This feature is useful
when the goal is to modify certain configuration options while
leaving others in their current state, such as when a \fBconfigure\fR
widget command is being processed.
@@ -399,7 +417,7 @@ on the type of the target.
This flag is typically used to allow a
feature to be turned off entirely, e.g. set a cursor value to
\fBNone\fR so that a window simply inherits its parent's cursor.
-If this bit isn't set then empty strings are processed as strings,
+If this bit is not set then empty strings are processed as strings,
which generally results in an error.
.TP
\fBTK_CONFIG_DONT_SET_DEFAULT\fR
@@ -415,21 +433,23 @@ once, save the value, and provide it before calling
\fBTk_ConfigureWidget\fR.
.TP
\fBTK_CONFIG_OPTION_SPECIFIED\fR
-This bit is set and cleared by \fBTk_ConfigureWidget\fR. Whenever
-\fBTk_ConfigureWidget\fR returns, this bit will be set in all the
-entries where a value was specified in \fIargv\fR.
-It will be zero in all other entries.
-This bit provides a way for clients to determine which values
-actually changed in a call to \fBTk_ConfigureWidget\fR.
+This bit is
+.VS 8.5
+deprecated. It used to be set and cleared by \fBTk_ConfigureWidget\fR
+so that callers could detect what entries were specified in
+\fIargv\fR, but it was removed because it was inherently
+thread-unsafe. Code that wishes to detect what options were specified
+should use \fBTk_SetOptions\fR instead.
+.VE 8.5
.PP
-The TK_CONFIG_MONO_ONLY and TK_CONFIG_COLOR_ONLY flags are typically
+The \fBTK_CONFIG_MONO_ONLY\fR and \fBTK_CONFIG_COLOR_ONLY\fR flags are typically
used to specify different default values for
monochrome and color displays. This is done by creating two
entries in \fIspecs\fR that are identical except for their
\fIdefValue\fR and \fIspecFlags\fR fields. One entry should have
-the value TK_CONFIG_MONO_ONLY in its \fIspecFlags\fR and the
+the value \fBTK_CONFIG_MONO_ONLY\fR in its \fIspecFlags\fR and the
default value for monochrome displays in its \fIdefValue\fR; the
-other entry entry should have the value TK_CONFIG_COLOR_ONLY in
+other entry should have the value \fBTK_CONFIG_COLOR_ONLY\fR in
its \fIspecFlags\fR and the appropriate \fIdefValue\fR for
color displays.
.PP
@@ -441,7 +461,7 @@ a single \fIspecs\fR table to be created with all the configuration
options for all the widget types. When processing a particular
widget type, only entries relevant to that type will be used. This
effect is achieved by setting the high-order bits (those in positions
-equal to or greater than TK_CONFIG_USER_BIT) in \fIspecFlags\fR
+equal to or greater than \fBTK_CONFIG_USER_BIT\fR) in \fIspecFlags\fR
values or in \fIflags\fR. In order for a particular entry in
\fIspecs\fR to be used, its high-order bits must match exactly
the high-order bits of the \fIflags\fR value passed to
@@ -473,7 +493,7 @@ a widget (\fIwidgRec\fR), and a NULL \fIargvName\fR argument,
\fBTk_ConfigureInfo\fR generates a string describing all of the
configuration options for the window. The string is placed
in \fIinterp->result\fR. Under normal circumstances
-it returns TCL_OK; if an error occurs then it returns TCL_ERROR
+it returns \fBTCL_OK\fR; if an error occurs then it returns \fBTCL_ERROR\fR
and \fIinterp->result\fR contains an error message.
.PP
If \fIargvName\fR is NULL, then the value left in
@@ -481,7 +501,7 @@ If \fIargvName\fR is NULL, then the value left in
consists of a list of one or more entries, each of which describes
one configuration option (i.e. one entry in \fIspecs\fR). Each
entry in the list will contain either two or five values. If the
-corresponding entry in \fIspecs\fR has type TK_CONFIG_SYNONYM, then
+corresponding entry in \fIspecs\fR has type \fBTK_CONFIG_SYNONYM\fR, then
the list will contain two values: the \fIargvName\fR for the entry
and the \fIdbName\fR (synonym name). Otherwise the list will contain
five values: \fIargvName\fR, \fIdbName\fR, \fIdbClass\fR, \fIdefValue\fR,
@@ -503,10 +523,10 @@ the \fIspecs\fR entries to consider, just as for \fBTk_ConfigureWidget\fR.
\fBTk_ConfigureValue\fR takes arguments similar to \fBTk_ConfigureInfo\fR;
instead of returning a list of values, it just returns the current value
of the option given by \fIargvName\fR (\fIargvName\fR must not be NULL).
-The value is returned in \fIinterp->result\fR and TCL_OK is
+The value is returned in \fIinterp->result\fR and \fBTCL_OK\fR is
normally returned as the procedure's result.
If an error occurs in \fBTk_ConfigureValue\fR (e.g., \fIargvName\fR is
-not a valid option name), TCL_ERROR is returned and an error message
+not a valid option name), \fBTCL_ERROR\fR is returned and an error message
is left in \fIinterp->result\fR.
This procedure is typically called to implement \fBcget\fR widget
commands.
@@ -517,8 +537,8 @@ The \fBTk_FreeOptions\fR procedure may be invoked during widget cleanup
to release all of the resources associated with configuration options.
It scans through \fIspecs\fR and for each entry corresponding to a
resource that must be explicitly freed (e.g. those with
-type TK_CONFIG_COLOR), it frees the resource in the widget record.
-If the field in the widget record doesn't refer to a resource (e.g.
+type \fBTK_CONFIG_COLOR\fR), it frees the resource in the widget record.
+If the field in the widget record does not refer to a resource (e.g.
it contains a null pointer) then no resource is freed for that
entry.
After freeing a resource, \fBTk_FreeOptions\fR sets the
@@ -531,25 +551,25 @@ configuration types by writing procedures to parse and print options
of the a type and creating a structure pointing to those procedures:
.CS
typedef struct Tk_CustomOption {
- Tk_OptionParseProc *\fIparseProc\fR;
- Tk_OptionPrintProc *\fIprintProc\fR;
- ClientData \fIclientData\fR;
+ Tk_OptionParseProc *\fIparseProc\fR;
+ Tk_OptionPrintProc *\fIprintProc\fR;
+ ClientData \fIclientData\fR;
} Tk_CustomOption;
typedef int Tk_OptionParseProc(
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- Tk_Window \fItkwin\fR,
- char *\fIvalue\fR,
- char *\fIwidgRec\fR,
- int \fIoffset\fR);
+ ClientData \fIclientData\fR,
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIvalue\fR,
+ char *\fIwidgRec\fR,
+ int \fIoffset\fR);
typedef char *Tk_OptionPrintProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIwidgRec\fR,
- int \fIoffset\fR,
- Tcl_FreeProc **\fIfreeProcPtr\fR);
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIwidgRec\fR,
+ int \fIoffset\fR,
+ Tcl_FreeProc **\fIfreeProcPtr\fR);
.CE
The Tk_CustomOption structure contains three fields, which are pointers
to the two procedures and a \fIclientData\fR value to be passed to those
@@ -577,8 +597,8 @@ The last argument, \fIoffset\fR, gives the offset in bytes from the start
of the widget record to the location where the option value is to
be placed. The procedure should translate the string to whatever
form is appropriate for the option and store the value in the widget
-record. It should normally return TCL_OK, but if an error occurs
-in translating the string to a value then it should return TCL_ERROR
+record. It should normally return \fBTCL_OK\fR, but if an error occurs
+in translating the string to a value then it should return \fBTCL_ERROR\fR
and store an error message in \fIinterp->result\fR.
.PP
The \fIprintProc\fR procedure is called
@@ -600,7 +620,7 @@ need not do anything with the \fIfreeProcPtr\fR argument.
Once \fIparseProc\fR and \fIprintProc\fR have been defined and a
Tk_CustomOption structure has been created for them, options of this
new type may be manipulated with Tk_ConfigSpec entries whose \fItype\fR
-fields are TK_CONFIG_CUSTOM and whose \fIcustomPtr\fR fields point
+fields are \fBTK_CONFIG_CUSTOM\fR and whose \fIcustomPtr\fR fields point
to the Tk_CustomOption structure.
.SH EXAMPLES
diff --git a/doc/ConfigWind.3 b/doc/ConfigWind.3
index 7d77902..f19512a 100644
--- a/doc/ConfigWind.3
+++ b/doc/ConfigWind.3
@@ -79,7 +79,6 @@ New cursor to use for \fItkwin\fR. If \fBNone\fR is specified, then
\fItkwin\fR will not have its own cursor; it will use the cursor
of its parent.
.BE
-
.SH DESCRIPTION
.PP
These procedures are analogous to the X library procedures
@@ -125,9 +124,8 @@ To change the stacking order, use the procedure \fBTk_RestackWindow\fR.
The procedure \fBTk_SetWindowColormap\fR will automatically add
\fItkwin\fR to the \fBTK_COLORMAP_WINDOWS\fR property of its
nearest top-level ancestor if the new colormap is different from
-that of \fItkwin\fR's parent and \fItkwin\fR isn't already in
+that of \fItkwin\fR's parent and \fItkwin\fR is not already in
the \fBTK_COLORMAP_WINDOWS\fR property.
-
.SH BUGS
.PP
\fBTk_SetWindowBackgroundPixmap\fR and \fBTk_SetWindowBorderPixmap\fR
@@ -143,9 +141,7 @@ and \fIpixmap\fR has been passed to the X server.
A similar problem occurs for the \fIcursor\fR argument passed to
\fBTk_DefineCursor\fR. The solution is the same as for pixmaps above:
call \fBTk_MakeWindowExist\fR before freeing the cursor.
-
.SH "SEE ALSO"
Tk_MoveToplevelWindow, Tk_RestackWindow
-
.SH KEYWORDS
attributes, border, color, configure, height, pixel, pixmap, width, window, x, y
diff --git a/doc/CrtCmHdlr.3 b/doc/CrtCmHdlr.3
index 21bc386..f8c72e5 100644
--- a/doc/CrtCmHdlr.3
+++ b/doc/CrtCmHdlr.3
@@ -25,7 +25,7 @@ Procedure to invoke whenever a ClientMessage X event occurs on any display.
.PP
\fBTk_CreateClientMessageHandler\fR arranges for \fIproc\fR to be invoked
-in the future whenever a ClientMessage X event occurs that isn't handled by
+in the future whenever a ClientMessage X event occurs that is not handled by
\fBWM_PROTOCOL\fR. \fBTk_CreateClientMessageHandler\fR is intended for use
by applications which need to watch X ClientMessage events, such as drag and
drop applications.
@@ -40,14 +40,14 @@ call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
type \fBTk_ClientMessageProc\fR:
.CS
typedef int Tk_ClientMessageProc(
- Tk_Window \fItkwin\fR,
- XEvent *\fIeventPtr\fR);
+ Tk_Window \fItkwin\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fItkwin\fR parameter to \fIproc\fR is the Tk window which is
associated with this event. \fIEventPtr\fR is a pointer to the X event.
.PP
Whenever an X ClientMessage event is processed by \fBTk_HandleEvent\fR,
-the \fIproc\fR is called if it wasn't handled as a \fBWM_PROTOCOL\fR.
+the \fIproc\fR is called if it was not handled as a \fBWM_PROTOCOL\fR.
The return value from \fIproc\fR is normally 0.
A non-zero return value indicates that the event is not to be handled
further; that is, \fIproc\fR has done all processing that is to be
diff --git a/doc/CrtConsoleChan.3 b/doc/CrtConsoleChan.3
new file mode 100644
index 0000000..65feab7
--- /dev/null
+++ b/doc/CrtConsoleChan.3
@@ -0,0 +1,44 @@
+'\"
+'\" Copyright (c) 2007 ActiveState Software Inc.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH Tk_InitConsoleChannels 3 8.5 Tk "Tk Library Procedures"
+.BS
+.SH NAME
+Tk_InitConsoleChannels \- Install the console channels as standard channels
+.SH SYNOPSIS
+.nf
+\fB#include <tk.h>\fR
+.sp
+\fBTk_InitConsoleChannels\fR(\fIinterp\fR)
+.SH ARGUMENTS
+.AS Tcl_Interp *interp in
+.AP Tcl_Interp *interp in
+Interpreter in which the console channels are created.
+.BE
+.SH DESCRIPTION
+.PP
+\fBTk_InitConsoleChannels\fR is invoked to create a set of console
+channels and install them as the standard channels. All I/O on these
+channels will be discarded until \fBTk_CreateConsoleWindow\fR is
+called to attach the console to a text widget.
+.PP
+This function is for use by shell applications based on Tk, like
+\fBwish\fR, on platforms which have no standard channels in graphical
+mode, like Win32.
+.PP
+The \fIinterp\fR argument is the interpreter in which to create and
+install the console channels.
+.PP
+\fBNOTE:\fR If this function is used it has to be called before the
+first call to \fBTcl_RegisterChannel\fR, directly, or indirectly
+through other channel functions. Because otherwise the standard
+channels will be already initialized to the system defaults, which will
+be nonsensical for the case \fBTk_InitConsoleChannels\fR is for.
+.SH "SEE ALSO"
+console(n)
+.SH KEYWORDS
+standard channels, console
diff --git a/doc/CrtErrHdlr.3 b/doc/CrtErrHdlr.3
index f123211..a75414e 100644
--- a/doc/CrtErrHdlr.3
+++ b/doc/CrtErrHdlr.3
@@ -24,13 +24,13 @@ Tk_ErrorHandler
Display whose errors are to be handled.
.AP int error in
Match only error events with this value in the \fIerror_code\fR
-field. If -1, then match any \fIerror_code\fR value.
+field. If \-1, then match any \fIerror_code\fR value.
.AP int request in
Match only error events with this value in the \fIrequest_code\fR
-field. If -1, then match any \fIrequest_code\fR value.
+field. If \-1, then match any \fIrequest_code\fR value.
.AP int minor in
Match only error events with this value in the \fIminor_code\fR
-field. If -1, then match any \fIminor_code\fR value.
+field. If \-1, then match any \fIminor_code\fR value.
.AP Tk_ErrorProc *proc in
Procedure to invoke whenever an error event is received for
\fIdisplay\fR and matches \fIerror\fR, \fIrequest\fR, and \fIminor\fR.
@@ -41,14 +41,13 @@ Arbitrary one-word value to pass to \fIproc\fR.
Token for error handler to delete (return value from a previous
call to \fBTk_CreateErrorHandler\fR).
.BE
-
.SH DESCRIPTION
.PP
\fBTk_CreateErrorHandler\fR arranges for a particular procedure
(\fIproc\fR) to be called whenever certain protocol errors occur on a
particular display (\fIdisplay\fR). Protocol errors occur when
the X protocol is used incorrectly, such as attempting to map a window
-that doesn't exist. See the Xlib documentation for \fBXSetErrorHandler\fR
+that does not exist. See the Xlib documentation for \fBXSetErrorHandler\fR
for more information on the kinds of errors that can occur.
For \fIproc\fR to be invoked
to handle a particular error, five things must occur:
@@ -56,15 +55,15 @@ to handle a particular error, five things must occur:
The error must pertain to \fIdisplay\fR.
.IP [2]
Either the \fIerror\fR argument to \fBTk_CreateErrorHandler\fR
-must have been -1, or the \fIerror\fR argument must match
+must have been \-1, or the \fIerror\fR argument must match
the \fIerror_code\fR field from the error event.
.IP [3]
Either the \fIrequest\fR argument to \fBTk_CreateErrorHandler\fR
-must have been -1, or the \fIrequest\fR argument must match
+must have been \-1, or the \fIrequest\fR argument must match
the \fIrequest_code\fR field from the error event.
.IP [4]
Either the \fIminor\fR argument to \fBTk_CreateErrorHandler\fR
-must have been -1, or the \fIminor\fR argument must match
+must have been \-1, or the \fIminor\fR argument must match
the \fIminor_code\fR field from the error event.
.IP [5]
The protocol request to which the error pertains must have been
@@ -74,8 +73,8 @@ made when the handler was active (see below for more information).
following type:
.CS
typedef int Tk_ErrorProc(
- ClientData \fIclientData\fR,
- XErrorEvent *\fIerrEventPtr\fR);
+ ClientData \fIclientData\fR,
+ XErrorEvent *\fIerrEventPtr\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
argument given to \fBTcl_CreateErrorHandler\fR when the callback
@@ -96,14 +95,13 @@ If more than more than one handler matches a particular error, then
they are invoked in turn. The handlers will be invoked in reverse
order of creation: most recently declared handler first.
If any handler returns 0, then subsequent (older) handlers will
-not be invoked. If no handler returns 0, then Tk invokes X'es
+not be invoked. If no handler returns 0, then Tk invokes X's
default error handler, which prints an error message and aborts the
program. If you wish to have a default handler that deals with errors
that no other handler can deal with, then declare it first.
.PP
-The X documentation states that ``the error handler should not call
-any functions (directly or indirectly) on the display that will
-generate protocol requests or that will look for input events.''
+The X documentation states that
+.QW "the error handler should not call any functions (directly or indirectly) on the display that will generate protocol requests or that will look for input events."
This restriction applies to handlers declared by \fBTk_CreateErrorHandler\fR;
disobey it at your own risk.
.PP
diff --git a/doc/CrtGenHdlr.3 b/doc/CrtGenHdlr.3
index 702ac30..a1bc637 100644
--- a/doc/CrtGenHdlr.3
+++ b/doc/CrtGenHdlr.3
@@ -46,8 +46,8 @@ call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
type \fBTk_GenericProc\fR:
.CS
typedef int Tk_GenericProc(
- ClientData \fIclientData\fR,
- XEvent *\fIeventPtr\fR);
+ ClientData \fIclientData\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
argument given to \fBTk_CreateGenericHandler\fR when the callback
diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3
index 65061b3..da083e0 100644
--- a/doc/CrtImgType.3
+++ b/doc/CrtImgType.3
@@ -6,7 +6,7 @@
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.so man.macros
-.TH Tk_CreateImageType 3 8.3 Tk "Tk Library Procedures"
+.TH Tk_CreateImageType 3 8.5 Tk "Tk Library Procedures"
.BS
.SH NAME
Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind of image
@@ -16,7 +16,6 @@ Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind o
.sp
\fBTk_CreateImageType\fR(\fItypePtr\fR)
.sp
-.VS
ClientData
\fBTk_GetImageMasterData\fR(\fIinterp, name, typePtrPtr\fR)
.sp
@@ -29,7 +28,7 @@ Must be static: a
pointer to this structure is retained by the image code.
.AP Tcl_Interp *interp in
Interpreter in which image was created.
-.AP "CONST char" *name in
+.AP "const char" *name in
Name of existing image.
.AP Tk_ImageType **typePtrPtr out
Points to word in which to store a pointer to type information for
@@ -38,7 +37,6 @@ the given image, if it exists.
Number of arguments
.AP char ***argvPtr in/out
Pointer to argument list
-.VE
.BE
.SH DESCRIPTION
@@ -61,12 +59,12 @@ the name of the image type and pointers to five procedures provided
by the image manager to deal with images of this type:
.CS
typedef struct Tk_ImageType {
- char *\fIname\fR;
- Tk_ImageCreateProc *\fIcreateProc\fR;
- Tk_ImageGetProc *\fIgetProc\fR;
- Tk_ImageDisplayProc *\fIdisplayProc\fR;
- Tk_ImageFreeProc *\fIfreeProc\fR;
- Tk_ImageDeleteProc *\fIdeleteProc\fR;
+ char *\fIname\fR;
+ Tk_ImageCreateProc *\fIcreateProc\fR;
+ Tk_ImageGetProc *\fIgetProc\fR;
+ Tk_ImageDisplayProc *\fIdisplayProc\fR;
+ Tk_ImageFreeProc *\fIfreeProc\fR;
+ Tk_ImageDeleteProc *\fIdeleteProc\fR;
} Tk_ImageType;
.CE
The fields of this structure will be described in later subsections
@@ -95,7 +93,7 @@ option specified for a widget or canvas item.
The following subsections describe the fields of a Tk_ImageType
in more detail.
-.SH NAME
+.SS NAME
.PP
\fItypePtr->name\fR provides a name for the image type.
Once \fBTk_CreateImageType\fR returns, this name may be used
@@ -104,30 +102,20 @@ type.
If there already existed an image type by this name then
the new image type replaces the old one.
-.SH PORTABILITY
-.PP
-In Tk 8.2 and earlier, the createProc below had a different
-signature. If you want to compile an image type using the
-old interface which should still run on all Tcl/Tk versions,
-compile it with the flag -DUSE_OLD_IMAGE. Further on, if
-you are using Stubs, you need to call the function
-Tk_InitImageArgs(interp, argc, &argv) first in your
-createProc. See below for a description of this function.
-
-.SH CREATEPROC
+.SS CREATEPROC
\fItypePtr->createProc\fR provides the address of a procedure for
Tk to call whenever \fBimage create\fR is invoked to create
an image of the new type.
\fItypePtr->createProc\fR must match the following prototype:
.CS
typedef int Tk_ImageCreateProc(
- Tcl_Interp *\fIinterp\fR,
- char *\fIname\fR,
- int \fIobjc\fR,
- Tcl_Obj *CONST \fIobjv\fR[],
- Tk_ImageType *\fItypePtr\fR,
- Tk_ImageMaster \fImaster\fR,
- ClientData *\fImasterDataPtr\fR);
+ Tcl_Interp *\fIinterp\fR,
+ char *\fIname\fR,
+ int \fIobjc\fR,
+ Tcl_Obj *const \fIobjv\fR[],
+ Tk_ImageType *\fItypePtr\fR,
+ Tk_ImageMaster \fImaster\fR,
+ ClientData *\fImasterDataPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the \fBimage\fR
command was invoked, and \fIname\fR is the name for the new image,
@@ -148,21 +136,21 @@ Typically the value is a pointer to the master data
structure for the image.
.PP
If \fIcreateProc\fR encounters an error, it should leave an error
-message in \fIinterp->result\fR and return \fBTCL_ERROR\fR; otherwise
+message in the interpreter result and return \fBTCL_ERROR\fR; otherwise
it should return \fBTCL_OK\fR.
.PP
\fIcreateProc\fR should call \fBTk_ImageChanged\fR in order to set the
size of the image and request an initial redisplay.
-.SH GETPROC
+.SS GETPROC
.PP
\fItypePtr->getProc\fR is invoked by Tk whenever a widget
calls \fBTk_GetImage\fR to use a particular image.
This procedure must match the following prototype:
.CS
typedef ClientData Tk_ImageGetProc(
- Tk_Window \fItkwin\fR,
- ClientData \fImasterData\fR);
+ Tk_Window \fItkwin\fR,
+ ClientData \fImasterData\fR);
.CE
The \fItkwin\fR argument identifies the window in which the
image will be used and \fImasterData\fR is the value
@@ -175,22 +163,22 @@ is typically the address of the instance data structure.
Tk will pass this value back to the image manager when invoking
its \fIdisplayProc\fR and \fIfreeProc\fR procedures.
-.SH DISPLAYPROC
+.SS DISPLAYPROC
.PP
\fItypePtr->displayProc\fR is invoked by Tk whenever an image needs
to be displayed (i.e., whenever a widget calls \fBTk_RedrawImage\fR).
\fIdisplayProc\fR must match the following prototype:
.CS
typedef void Tk_ImageDisplayProc(
- ClientData \fIinstanceData\fR,
- Display *\fIdisplay\fR,
- Drawable \fIdrawable\fR,
- int \fIimageX\fR,
- int \fIimageY\fR,
- int \fIwidth\fR,
- int \fIheight\fR,
- int \fIdrawableX\fR,
- int \fIdrawableY\fR);
+ ClientData \fIinstanceData\fR,
+ Display *\fIdisplay\fR,
+ Drawable \fIdrawable\fR,
+ int \fIimageX\fR,
+ int \fIimageY\fR,
+ int \fIwidth\fR,
+ int \fIheight\fR,
+ int \fIdrawableX\fR,
+ int \fIdrawableY\fR);
.CE
The \fIinstanceData\fR will be the same as the value returned by
\fIgetProc\fR when the instance was created.
@@ -208,7 +196,7 @@ the image should be displayed; \fIdisplayProc\fR should display
the given region of the image so that point (\fIimageX\fR, \fIimageY\fR)
in the image appears at (\fIdrawableX\fR, \fIdrawableY\fR) in \fIdrawable\fR.
-.SH FREEPROC
+.SS FREEPROC
.PP
\fItypePtr->freeProc\fR contains the address of a procedure that
Tk will invoke when an image instance is released (i.e., when
@@ -219,8 +207,8 @@ canvas item is changed.
\fIfreeProc\fR must match the following prototype:
.CS
typedef void Tk_ImageFreeProc(
- ClientData \fIinstanceData\fR,
- Display *\fIdisplay\fR);
+ ClientData \fIinstanceData\fR,
+ Display *\fIdisplay\fR);
.CE
The \fIinstanceData\fR will be the same as the value returned by
\fIgetProc\fR when the instance was created, and \fIdisplay\fR
@@ -228,7 +216,7 @@ is the display containing the window for the instance.
\fIfreeProc\fR should release any resources associated with the
image instance, since the instance will never be used again.
-.SH DELETEPROC
+.SS DELETEPROC
.PP
\fItypePtr->deleteProc\fR is a procedure that Tk invokes when an
image is being deleted (i.e. when the \fBimage delete\fR command
@@ -238,7 +226,7 @@ each of the image's instances.
\fIdeleteProc\fR must match the following prototype:
.CS
typedef void Tk_ImageDeleteProc(
- ClientData \fImasterData\fR);
+ ClientData \fImasterData\fR);
.CE
The \fImasterData\fR argument will be the same as the value
stored in \fI*masterDataPtr\fR by \fIcreateProc\fR when the
@@ -247,7 +235,6 @@ image was created.
the image.
.SH TK_GETIMAGEMASTERDATA
-.VS
.PP
The procedure \fBTk_GetImageMasterData\fR may be invoked to retrieve
information about an image. For example, an image manager can use this
@@ -260,19 +247,42 @@ and the return value is the ClientData value returned by the
\fIcreateProc\fR when the image was created (this is typically a
pointer to the image master data structure). If no such image exists
then NULL is returned and NULL is stored at \fI*typePtrPtr\fR.
-.VE
-.SH TK_INITIMAGEARGS
-.VS
+.SH "LEGACY INTERFACE SUPPORT"
+In Tk 8.2 and earlier, the definition of \fBTk_ImageCreateProc\fR
+was incompatibly different, with the following prototype:
+.CS
+typedef int Tk_ImageCreateProc(
+ Tcl_Interp *\fIinterp\fR,
+ char *\fIname\fR,
+ int \fIargc\fR,
+ char **\fIargv\fR,
+ Tk_ImageType *\fItypePtr\fR,
+ Tk_ImageMaster \fImaster\fR,
+ ClientData *\fImasterDataPtr\fR);
+.CE
+Legacy programs and libraries dating from those days may still
+contain code that defines extended Tk image types using the old
+interface. The Tk header file will still support this legacy
+interface if the code is compiled with the macro \fBUSE_OLD_IMAGE\fR
+defined.
+.PP
+When the \fBUSE_OLD_IMAGE\fR legacy support is enabled, you may
+see the routine \fBTk_InitImageArgs\fR in use. This was a migration
+tool used to create stub-enabled extensions that could be loaded
+into interps containing all versions of Tk 8.1 and later. Tk 8.5 no longer
+provides this routine, but uses a macro to convert any attempted
+calls of this routine into an empty comment. Any stub-enabled
+extension providing an extended image type via the legacy interface
+that is compiled against Tk 8.5 headers and linked against the
+Tk 8.5 stub library will produce a file that can be loaded only
+into interps with Tk 8.5 or later; that is, the normal stub-compatibility
+rules. If a developer needs to generate from such code a file
+that is loadable into interps with Tk 8.4 or earlier, they must
+use Tk 8.4 headers and stub libraries to do so.
.PP
-The function \fBTk_InitImageArgs\fR converts the arguments of the
-\fBcreateProc\fR from objects to strings when necessary. When
-not using stubs, not using the old interface, or running
-under an older (pre-8.3) Tk version, this function has no
-effect. This function makes porting older image handlers to
-the new interface a lot easier: After running this function,
-the arguments are guaranteed to be in string format, no
-matter how Tk deliverd them.
+Any new code written today should not make use of the legacy
+interfaces. Expect their support to go away in Tk 9.
.SH "SEE ALSO"
Tk_ImageChanged, Tk_GetImage, Tk_FreeImage, Tk_RedrawImage, Tk_SizeOfImage
diff --git a/doc/CrtItemType.3 b/doc/CrtItemType.3
index f035bc2..4f06438 100644
--- a/doc/CrtItemType.3
+++ b/doc/CrtItemType.3
@@ -22,7 +22,6 @@ Tk_ItemType *
.AP Tk_ItemType *typePtr in
Structure that defines the new type of canvas item.
.BE
-
.SH INTRODUCTION
.PP
\fBTk_CreateItemType\fR is invoked to define a new kind of canvas item
@@ -52,7 +51,6 @@ for an existing type and modify it for the new type.
Tk provides a number of utility procedures for the use of canvas
type managers, such as \fBTk_CanvasCoords\fR and \fBTk_CanvasPsColor\fR;
these are described in separate manual entries.
-
.SH "DATA STRUCTURES"
.PP
A type manager consists of a collection of procedures that provide a
@@ -64,26 +62,26 @@ information such as the name of the type and pointers to
the standard procedures implemented by the type manager:
.CS
typedef struct Tk_ItemType {
- char *\fIname\fR;
- int \fIitemSize\fR;
- Tk_ItemCreateProc *\fIcreateProc\fR;
- Tk_ConfigSpec *\fIconfigSpecs\fR;
- Tk_ItemConfigureProc *\fIconfigProc\fR;
- Tk_ItemCoordProc *\fIcoordProc\fR;
- Tk_ItemDeleteProc *\fIdeleteProc\fR;
- Tk_ItemDisplayProc *\fIdisplayProc\fR;
- int \fIalwaysRedraw\fR;
- Tk_ItemPointProc *\fIpointProc\fR;
- Tk_ItemAreaProc *\fIareaProc\fR;
- Tk_ItemPostscriptProc *\fIpostscriptProc\fR;
- Tk_ItemScaleProc *\fIscaleProc\fR;
- Tk_ItemTranslateProc *\fItranslateProc\fR;
- Tk_ItemIndexProc *\fIindexProc\fR;
- Tk_ItemCursorProc *\fIicursorProc\fR;
- Tk_ItemSelectionProc *\fIselectionProc\fR;
- Tk_ItemInsertProc *\fIinsertProc\fR;
- Tk_ItemDCharsProc *\fIdCharsProc\fR;
- Tk_ItemType *\fInextPtr\fR;
+ char *\fIname\fR;
+ int \fIitemSize\fR;
+ Tk_ItemCreateProc *\fIcreateProc\fR;
+ Tk_ConfigSpec *\fIconfigSpecs\fR;
+ Tk_ItemConfigureProc *\fIconfigProc\fR;
+ Tk_ItemCoordProc *\fIcoordProc\fR;
+ Tk_ItemDeleteProc *\fIdeleteProc\fR;
+ Tk_ItemDisplayProc *\fIdisplayProc\fR;
+ int \fIalwaysRedraw\fR;
+ Tk_ItemPointProc *\fIpointProc\fR;
+ Tk_ItemAreaProc *\fIareaProc\fR;
+ Tk_ItemPostscriptProc *\fIpostscriptProc\fR;
+ Tk_ItemScaleProc *\fIscaleProc\fR;
+ Tk_ItemTranslateProc *\fItranslateProc\fR;
+ Tk_ItemIndexProc *\fIindexProc\fR;
+ Tk_ItemCursorProc *\fIicursorProc\fR;
+ Tk_ItemSelectionProc *\fIselectionProc\fR;
+ Tk_ItemInsertProc *\fIinsertProc\fR;
+ Tk_ItemDCharsProc *\fIdCharsProc\fR;
+ Tk_ItemType *\fInextPtr\fR;
} Tk_ItemType;
.CE
.PP
@@ -111,13 +109,13 @@ the first field.
For example, the item record for bitmap items is defined as follows:
.CS
typedef struct BitmapItem {
- Tk_Item \fIheader\fR;
- double \fIx\fR, \fIy\fR;
- Tk_Anchor \fIanchor\fR;
- Pixmap \fIbitmap\fR;
- XColor *\fIfgColor\fR;
- XColor *\fIbgColor\fR;
- GC \fIgc\fR;
+ Tk_Item \fIheader\fR;
+ double \fIx\fR, \fIy\fR;
+ Tk_Anchor \fIanchor\fR;
+ Pixmap \fIbitmap\fR;
+ XColor *\fIfgColor\fR;
+ XColor *\fIbgColor\fR;
+ GC \fIgc\fR;
} BitmapItem;
.CE
The \fIheader\fR substructure contains information used by Tk
@@ -152,8 +150,7 @@ A Tk_Canvas handle is typically passed in to the
procedures of a type manager, and the type manager can pass the
handle back to library procedures such as Tk_CanvasTkwin
to fetch information about the canvas.
-
-.SH NAME
+.SS NAME
.PP
This section and the ones that follow describe each of the fields
in a Tk_ItemType structure in detail.
@@ -163,8 +160,7 @@ in \fBcreate\fR widget commands to create items of the new
type.
If there already existed an item type by this name then
the new item type replaces the old one.
-
-.SH ITEMSIZE
+.SS ITEMSIZE
\fItypePtr->itemSize\fR gives the size in bytes of item records
of this type, including the Tk_Item header.
Tk uses this size to allocate memory space for items of the type.
@@ -172,19 +168,18 @@ All of the item records for a given type must have the same size.
If variable length fields are needed for an item (such as a list
of points for a polygon), the type manager can allocate a separate
object of variable length and keep a pointer to it in the item record.
-
-.SH CREATEPROC
+.SS CREATEPROC
.PP
\fItypePtr->createProc\fR points to a procedure for
Tk to call whenever a new item of this type is created.
\fItypePtr->createProc\fR must match the following prototype:
.CS
typedef int Tk_ItemCreateProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIobjc\fR,
- Tcl_Obj* CONST \fIobjv\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIobjc\fR,
+ Tcl_Obj* const \fIobjv\fR[]);
.CE
The \fIinterp\fR argument is the interpreter in which the canvas's
\fBcreate\fR widget command was invoked, and \fIcanvas\fR is a
@@ -212,8 +207,7 @@ If an error occurs Tk will free the item record, so \fIcreateProc\fR
must be sure to leave the item record in a clean state if it returns an error
(e.g., it must free any additional memory that it allocated for
the item).
-
-.SH CONFIGSPECS
+.SS CONFIGSPECS
.PP
Each type manager must provide a standard table describing its
configuration options, in a form suitable for use with
@@ -227,8 +221,7 @@ for this type.
Note: Tk provides a custom option type \fBtk_CanvasTagsOption\fR
for implementing the \fB\-tags\fR option; see an existing type
manager for an example of how to use it in \fIconfigSpecs\fR.
-
-.SH CONFIGPROC
+.SS CONFIGPROC
.PP
\fItypePtr->configProc\fR is called by Tk whenever the
\fBitemconfigure\fR widget command is invoked to change the
@@ -236,12 +229,12 @@ configuration options for a canvas item.
This procedure must match the following prototype:
.CS
typedef int Tk_ItemConfigureProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIobjc\fR,
- Tcl_Obj* CONST \fIobjv\fR,
- int \fIflags\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIobjc\fR,
+ Tcl_Obj* const \fIobjv\fR[],
+ int \fIflags\fR);
.CE
The \fIinterp\fR objument identifies the interpreter in which the
widget command was invoked, \fIcanvas\fR is a handle for the canvas
@@ -255,7 +248,7 @@ example, if the following command is invoked:
through \fBblack\fR.
\fIobjc\fR will always be an even value.
The \fIflags\fR argument contains flags to pass to \fBTk_ConfigureWidget\fR;
-currently this value is always TK_CONFIG_ARGV_ONLY when Tk
+currently this value is always \fBTK_CONFIG_ARGV_ONLY\fR when Tk
invokes \fItypePtr->configProc\fR, but the type manager's \fIcreateProc\fR
procedure will usually invoke \fIconfigProc\fR with different flag values.
.PP
@@ -263,19 +256,18 @@ procedure will usually invoke \fIconfigProc\fR with different flag values.
leaves an error message in \fIinterp->result\fR if an error occurs.
It must update the item's bounding box to reflect the new configuration
options.
-
-.SH COORDPROC
+.SS COORDPROC
.PP
\fItypePtr->coordProc\fR is invoked by Tk to implement the \fBcoords\fR
widget command for an item.
It must match the following prototype:
.CS
typedef int Tk_ItemCoordProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIobjc\fR,
- Tcl_Obj* CONST \fIobjv\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIobjc\fR,
+ Tcl_Obj* const \fIobjv\fR[]);
.CE
The arguments \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR
all have the standard meanings, and \fIobjc\fR and \fIobjv\fR
@@ -293,17 +285,16 @@ box in the item's header), and return a standard Tcl completion
code.
If an error occurs, \fIcoordProc\fR must leave an error message in
\fIinterp->result\fR.
-
-.SH DELETEPROC
+.SS DELETEPROC
.PP
\fItypePtr->deleteProc\fR is invoked by Tk to delete an item
and free any resources allocated to it.
It must match the following prototype:
.CS
typedef void Tk_ItemDeleteProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- Display *\fIdisplay\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ Display *\fIdisplay\fR);
.CE
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual
interpretations, and \fIdisplay\fR identifies the X display containing
@@ -312,22 +303,21 @@ the canvas.
so that Tk can free the item record.
\fIdeleteProc\fR should not actually free the item record; this will
be done by Tk when \fIdeleteProc\fR returns.
-
-.SH "DISPLAYPROC AND ALWAYSREDRAW"
+.SS "DISPLAYPROC AND ALWAYSREDRAW"
.PP
\fItypePtr->displayProc\fR is invoked by Tk to redraw an item
on the screen.
It must match the following prototype:
.CS
typedef void Tk_ItemDisplayProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- Display *\fIdisplay\fR,
- Drawable \fIdst\fR,
- int \fIx\fR,
- int \fIy\fR,
- int \fIwidth\fR,
- int \fIheight\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ Display *\fIdisplay\fR,
+ Drawable \fIdst\fR,
+ int \fIx\fR,
+ int \fIy\fR,
+ int \fIwidth\fR,
+ int \fIheight\fR);
.CE
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning.
\fIdisplay\fR identifies the display containing the canvas, and
@@ -352,12 +342,11 @@ Normally an item's \fIdisplayProc\fR is only invoked if the item
overlaps the area being displayed.
However, if \fItypePtr->alwaysRedraw\fR has a non-zero value, then
\fIdisplayProc\fR is invoked during every redisplay operation,
-even if the item doesn't overlap the area of redisplay.
+even if the item does not overlap the area of redisplay.
\fIalwaysRedraw\fR should normally be set to 0; it is only
set to 1 in special cases such as window items that need to be
unmapped when they are off-screen.
-
-.SH POINTPROC
+.SS POINTPROC
.PP
\fItypePtr->pointProc\fR is invoked by Tk to find out how close
a given point is to a canvas item.
@@ -366,9 +355,9 @@ under the mouse or finding the closest item to a given point.
The procedure must match the following prototype:
.CS
typedef double Tk_ItemPointProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double *\fIpointPtr\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double *\fIpointPtr\fR);
.CE
\fIcanvas\fR and \fIitemPtr\fR have the usual meaning.
\fIpointPtr\fR points to an array of two numbers giving
@@ -376,17 +365,16 @@ the x and y coordinates of a point.
\fIpointProc\fR must return a real value giving the distance
from the point to the item, or 0 if the point lies inside
the item.
-
-.SH AREAPROC
+.SS AREAPROC
.PP
\fItypePtr->areaProc\fR is invoked by Tk to find out the relationship
between an item and a rectangular area.
It must match the following prototype:
.CS
typedef int Tk_ItemAreaProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double *\fIrectPtr\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double *\fIrectPtr\fR);
.CE
\fIcanvas\fR and \fIitemPtr\fR have the usual meaning.
\fIrectPtr\fR points to an array of four real numbers;
@@ -396,30 +384,29 @@ coordinates of the lower right corner.
\fIareaProc\fR must return \-1 if the item lies entirely outside
the given area, 0 if it lies partially inside and partially
outside the area, and 1 if it lies entirely inside the area.
-
-.SH POSTSCRIPTPROC
+.SS POSTSCRIPTPROC
.PP
\fItypePtr->postscriptProc\fR is invoked by Tk to generate
-Postcript for an item during the \fBpostscript\fR widget command.
+Postscript for an item during the \fBpostscript\fR widget command.
If the type manager is not capable of generating Postscript then
\fItypePtr->postscriptProc\fR should be NULL.
The procedure must match the following prototype:
.CS
typedef int Tk_ItemPostscriptProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIprepass\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIprepass\fR);
.CE
The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all have
standard meanings; \fIprepass\fR will be described below.
If \fIpostscriptProc\fR completes successfully, it should append
Postscript for the item to the information in \fIinterp->result\fR
(e.g. by calling \fBTcl_AppendResult\fR, not \fBTcl_SetResult\fR)
-and return TCL_OK.
+and return \fBTCL_OK\fR.
If an error occurs, \fIpostscriptProc\fR should clear the result
and replace its contents with an error message; then it should
-return TCL_ERROR.
+return \fBTCL_ERROR\fR.
.PP
Tk provides a collection of utility procedures to simplify
\fIpostscriptProc\fR.
@@ -447,19 +434,18 @@ during the first pass; the type manager can use \fIprepass\fR to skip
all Postscript generation except for calls to \fBTk_CanvasPsFont\fR.
During the second pass \fIprepass\fR will be 0, so the type manager
must generate complete Postscript.
-
-.SH SCALEPROC
+.SS SCALEPROC
\fItypePtr->scaleProc\fR is invoked by Tk to rescale a canvas item
during the \fBscale\fR widget command.
The procedure must match the following prototype:
.CS
typedef void Tk_ItemScaleProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double \fIoriginX\fR,
- double \fIoriginY\fR,
- double \fIscaleX\fR,
- double \fIscaleY\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double \fIoriginX\fR,
+ double \fIoriginY\fR,
+ double \fIscaleX\fR,
+ double \fIscaleY\fR);
.CE
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning.
\fIoriginX\fR and \fIoriginY\fR specify an origin relative to which
@@ -467,32 +453,30 @@ the item is to be scaled, and \fIscaleX\fR and \fIscaleY\fR give the
x and y scale factors.
The item should adjust its coordinates so that a point in the item
that used to have coordinates \fIx\fR and \fIy\fR will have new
-coordinates \fIx'\fR and \fIy'\fR, where
+coordinates \fIx\(fm\fR and \fIy\(fm\fR, where
.CS
-\fIx' = originX + scaleX*(x-originX)
-y' = originY + scaleY*(y-originY)\fR
+\fIx\(fm = originX + scaleX*(x-originX)
+y\(fm = originY + scaleY*(y-originY)\fR
.CE
\fIscaleProc\fR must also update the bounding box in the item's
header.
-
-.SH TRANSLATEPROC
+.SS TRANSLATEPROC
\fItypePtr->translateProc\fR is invoked by Tk to translate a canvas item
during the \fBmove\fR widget command.
The procedure must match the following prototype:
.CS
typedef void Tk_ItemTranslateProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double \fIdeltaX\fR,
- double \fIdeltaY\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double \fIdeltaX\fR,
+ double \fIdeltaY\fR);
.CE
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning,
and \fIdeltaX\fR and \fIdeltaY\fR give the amounts that should be
added to each x and y coordinate within the item.
The type manager should adjust the item's coordinates and
update the bounding box in the item's header.
-
-.SH INDEXPROC
+.SS INDEXPROC
\fItypePtr->indexProc\fR is invoked by Tk to translate a string
index specification into a numerical index, for example during the
\fBindex\fR widget command.
@@ -502,11 +486,11 @@ item types.
The procedure must match the following prototype:
.CS
typedef int Tk_ItemIndexProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- char \fIindexString\fR,
- int *\fIindexPtr\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ char \fIindexString\fR,
+ int *\fIindexPtr\fR);
.CE
The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all
have the usual meaning.
@@ -518,21 +502,20 @@ are supported (e.g., numbers, \fBinsert\fR, \fBsel.first\fR,
\fBend\fR, etc.).
\fIindexProc\fR should return a Tcl completion code and set
\fIinterp->result\fR in the event of an error.
-
-.SH ICURSORPROC
+.SS ICURSORPROC
.PP
\fItypePtr->icursorProc\fR is invoked by Tk during
the \fBicursor\fR widget command to set the position of the
insertion cursor in a textual item.
It is only relevant for item types that support an insertion cursor;
\fItypePtr->icursorProc\fR may be specified as NULL for item types
-that don't support an insertion cursor.
+that do not support an insertion cursor.
The procedure must match the following prototype:
.CS
typedef void Tk_ItemCursorProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIindex\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIindex\fR);
.CE
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings, and
\fIindex\fR is an index into the item's text, as returned by a
@@ -541,8 +524,7 @@ The type manager should position the insertion cursor in the
item just before the character given by \fIindex\fR.
Whether or not to actually display the insertion cursor is
determined by other information provided by \fBTk_CanvasGetTextInfo\fR.
-
-.SH SELECTIONPROC
+.SS SELECTIONPROC
.PP
\fItypePtr->selectionProc\fR is invoked by Tk during selection
retrievals; it must return part or all of the selected text in
@@ -553,11 +535,11 @@ item types.
The procedure must match the following prototype:
.CS
typedef int Tk_ItemSelectionProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIoffset\fR,
- char *\fIbuffer\fR,
- int \fImaxBytes\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIoffset\fR,
+ char *\fIbuffer\fR,
+ int \fImaxBytes\fR);
.CE
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
\fIoffset\fR is an offset in bytes into the selection where 0 refers
@@ -569,10 +551,9 @@ of bytes to return.
\fIselectionProc\fR should extract up to \fImaxBytes\fR characters
from the selection and copy them to \fImaxBytes\fR; it should
return a count of the number of bytes actually copied, which may
-be less than \fImaxBytes\fR if there aren't \fIoffset+maxBytes\fR bytes
+be less than \fImaxBytes\fR if there are not \fIoffset+maxBytes\fR bytes
in the selection.
-
-.SH INSERTPROC
+.SS INSERTPROC
.PP
\fItypePtr->insertProc\fR is invoked by Tk during
the \fBinsert\fR widget command to insert new text into a
@@ -583,10 +564,10 @@ item types.
The procedure must match the following prototype:
.CS
typedef void Tk_ItemInsertProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIindex\fR,
- char *\fIstring\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIindex\fR,
+ char *\fIstring\fR);
.CE
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
\fIindex\fR is an index into the item's text, as returned by a
@@ -595,8 +576,7 @@ contains new text to insert just before the character given
by \fIindex\fR.
The type manager should insert the text and recompute the bounding
box in the item's header.
-
-.SH DCHARSPROC
+.SS DCHARSPROC
.PP
\fItypePtr->dCharsProc\fR is invoked by Tk during the \fBdchars\fR
widget command to delete a range of text from a canvas item.
@@ -606,19 +586,17 @@ item types.
The procedure must match the following prototype:
.CS
typedef void Tk_ItemDCharsProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIfirst\fR,
- int \fIlast\fR);
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIfirst\fR,
+ int \fIlast\fR);
.CE
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
\fIfirst\fR and \fIlast\fR give the indices of the first and last bytes
to be deleted, as returned by previous calls to \fItypePtr->indexProc\fR.
The type manager should delete the specified characters and update
the bounding box in the item's header.
-
.SH "SEE ALSO"
Tk_CanvasPsY, Tk_CanvasTextInfo, Tk_CanvasTkwin
-
.SH KEYWORDS
canvas, focus, item type, selection, type manager
diff --git a/doc/CrtPhImgFmt.3 b/doc/CrtPhImgFmt.3
index fa50d86..0575d40 100644
--- a/doc/CrtPhImgFmt.3
+++ b/doc/CrtPhImgFmt.3
@@ -10,7 +10,7 @@
'\" Australian National University.
'\"
.so man.macros
-.TH Tk_CreatePhotoImageFormat 3 8.3 Tk "Tk Library Procedures"
+.TH Tk_CreatePhotoImageFormat 3 8.5 Tk "Tk Library Procedures"
.BS
.SH NAME
Tk_CreatePhotoImageFormat \- define new file format for photo images
@@ -46,13 +46,13 @@ handler to deal with files and strings in this format. The
Tk_PhotoImageFormat structure contains the following fields:
.CS
typedef struct Tk_PhotoImageFormat {
- char *\fIname\fR;
- Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
- Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
- Tk_ImageFileReadProc *\fIfileReadProc\fR;
- Tk_ImageStringReadProc *\fIstringReadProc\fR;
- Tk_ImageFileWriteProc *\fIfileWriteProc\fR;
- Tk_ImageStringWriteProc *\fIstringWriteProc\fR;
+ char *\fIname\fR;
+ Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
+ Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
+ Tk_ImageFileReadProc *\fIfileReadProc\fR;
+ Tk_ImageStringReadProc *\fIstringReadProc\fR;
+ Tk_ImageFileWriteProc *\fIfileWriteProc\fR;
+ Tk_ImageStringWriteProc *\fIstringWriteProc\fR;
} Tk_PhotoImageFormat;
.CE
.PP
@@ -66,14 +66,6 @@ structure should be set to NULL. The handler must provide the
procedure, and the \fIstringMatchProc\fR procedure if it provides the
\fIstringReadProc\fR procedure.
-.SH PORTABILITY
-.PP
-In Tk 8.2 and earlier, a different interface was used. Tk 8.3 will
-still support the old format handlers if the format name is in upper
-case. If you still want to compile old format handlers with Tk8.3,
-use the flag -DUSE_OLD_IMAGE. This will restore all function prototypes
-to match the pre-8.3 situation.
-
.SH NAME
.PP
\fIformatPtr->name\fR provides a name for the image type.
@@ -81,9 +73,10 @@ Once \fBTk_CreatePhotoImageFormat\fR returns, this name may be used
in the \fB\-format\fR photo image configuration and subcommand option.
The manual page for the photo image (photo(n)) describes how image
file formats are chosen based on their names and the value given to
-the \fB\-format\fR option. For new format handlers, the name should
-be in lower case. Pre-8.3 format handlers are assumed to be in
-upper case.
+the \fB\-format\fR option. The first character of \fIformatPtr->name\fR
+must not be an uppercase character from the ASCII character set
+(that is, one of the characters \fBA\fR-\fBZ\fR). Such names are used
+only for legacy interface support (see below).
.SH FILEMATCHPROC
\fIformatPtr->fileMatchProc\fR provides the address of a procedure for
@@ -92,12 +85,12 @@ suitable for reading data in a given file.
\fIformatPtr->fileMatchProc\fR must match the following prototype:
.CS
typedef int Tk_ImageFileMatchProc(
- Tcl_Channel \fIchan\fR,
- CONST char *\fIfileName\fR,
- Tcl_Obj *\fIformat\fR,
- int *\fIwidthPtr\fR,
- int *\fIheightPtr\fR,
- Tcl_Interp *\fIinterp\fR);
+ Tcl_Channel \fIchan\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ int *\fIwidthPtr\fR,
+ int *\fIheightPtr\fR,
+ Tcl_Interp *\fIinterp\fR);
.CE
The \fIfileName\fR argument is the name of the file containing the
image data, which is open for reading as \fIchan\fR. The
@@ -115,11 +108,11 @@ suitable for reading data from a given string.
\fIformatPtr->stringMatchProc\fR must match the following prototype:
.CS
typedef int Tk_ImageStringMatchProc(
- Tcl_Obj *\fIdata\fR,
- Tcl_Obj *\fIformat\fR,
- int *\fIwidthPtr\fR,
- int *\fIheightPtr\fR,
- Tcl_Interp *\fIinterp\fR);
+ Tcl_Obj *\fIdata\fR,
+ Tcl_Obj *\fIformat\fR,
+ int *\fIwidthPtr\fR,
+ int *\fIheightPtr\fR,
+ Tcl_Interp *\fIinterp\fR);
.CE
The \fIdata\fR argument points to the object containing the image
data. The \fIformat\fR argument contains the value given for
@@ -136,14 +129,14 @@ Tk to call to read data from an image file into a photo image.
\fIformatPtr->fileReadProc\fR must match the following prototype:
.CS
typedef int Tk_ImageFileReadProc(
- Tcl_Interp *\fIinterp\fR,
- Tcl_Channel \fIchan\fR,
- CONST char *\fIfileName\fR,
- Tcl_Obj *\fIformat\fR,
- PhotoHandle \fIimageHandle\fR,
- int \fIdestX\fR, int \fIdestY\fR,
- int \fIwidth\fR, int \fIheight\fR,
- int \fIsrcX\fR, int \fIsrcY\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Channel \fIchan\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ PhotoHandle \fIimageHandle\fR,
+ int \fIdestX\fR, int \fIdestY\fR,
+ int \fIwidth\fR, int \fIheight\fR,
+ int \fIsrcX\fR, int \fIsrcY\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to read the image; it should be used for reporting errors.
@@ -165,13 +158,13 @@ Tk to call to read data from a string into a photo image.
\fIformatPtr->stringReadProc\fR must match the following prototype:
.CS
typedef int Tk_ImageStringReadProc(
- Tcl_Interp *\fIinterp\fR,
- Tcl_Obj *\fIdata\fR,
- Tcl_Obj *\fIformat\fR,
- PhotoHandle \fIimageHandle\fR,
- int \fIdestX\fR, int \fIdestY\fR,
- int \fIwidth\fR, int \fIheight\fR,
- int \fIsrcX\fR, int \fIsrcY\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Obj *\fIdata\fR,
+ Tcl_Obj *\fIformat\fR,
+ PhotoHandle \fIimageHandle\fR,
+ int \fIdestX\fR, int \fIdestY\fR,
+ int \fIwidth\fR, int \fIheight\fR,
+ int \fIsrcX\fR, int \fIsrcY\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to read the image; it should be used for reporting errors.
@@ -193,10 +186,10 @@ Tk to call to write data from a photo image to a file.
\fIformatPtr->fileWriteProc\fR must match the following prototype:
.CS
typedef int Tk_ImageFileWriteProc(
- Tcl_Interp *\fIinterp\fR,
- CONST char *\fIfileName\fR,
- Tcl_Obj *\fIformat\fR,
- Tk_PhotoImageBlock *\fIblockPtr\fR);
+ Tcl_Interp *\fIinterp\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to write the image; it should be used for reporting errors.
@@ -218,9 +211,9 @@ Tk to call to translate image data from a photo image into a string.
\fIformatPtr->stringWriteProc\fR must match the following prototype:
.CS
typedef int Tk_ImageStringWriteProc(
- Tcl_Interp *\fIinterp\fR,
- Tcl_Obj *\fIformat\fR,
- Tk_PhotoImageBlock *\fIblockPtr\fR);
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Obj *\fIformat\fR,
+ Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to convert the image; it should be used for reporting errors.
@@ -236,6 +229,44 @@ after the name of the format. If appropriate, the
characters to specify further details about the image file.
The return value is a standard Tcl return value.
+.SH "LEGACY INTERFACE SUPPORT"
+In Tk 8.2 and earlier, the definition of all the function pointer
+types stored in fields of a \fBTk_PhotoImageFormat\fR struct were
+incompatibly different. Legacy programs and libraries dating from
+those days may still contain code that defines extended Tk photo image
+formats using the old interface. The Tk header file will still support
+this legacy interface if the code is compiled with the
+macro \fBUSE_OLD_IMAGE\fR defined. Alternatively, the legacy interfaces
+are used if the first character of \fIformatPtr->name\fR is an
+uppercase ASCII character (\fBA\fR-\fBZ\fR), and explicit casts
+are used to forgive the type mismatch. For example,
+.CS
+static Tk_PhotoImageFormat myFormat = {
+ "MyFormat",
+ (Tk_ImageFileMatchProc *) FileMatch,
+ NULL,
+ (Tk_ImageFileReadProc *) FileRead,
+ NULL,
+ NULL,
+ NULL
+};
+.CE
+would define a minimal \fBTk_PhotoImageFormat\fR that operates provide
+only file reading capability, where \fBFileMatch\fR and \fBFileRead\fR
+are written according to the legacy interfaces of Tk 8.2 or earlier.
+.PP
+Any stub-enabled extension providing an extended photo image format
+via the legacy interface enabled by the \fBUSE_OLD_IMAGE\fR macro
+that is compiled against Tk 8.5 headers and linked against the
+Tk 8.5 stub library will produce a file that can be loaded only
+into interps with Tk 8.5 or later; that is, the normal stub-compatibility
+rules. If a developer needs to generate from such code a file
+that is loadable into interps with Tk 8.4 or earlier, they must
+use Tk 8.4 headers and stub libraries to do so.
+.PP
+Any new code written today should not make use of the legacy
+interfaces. Expect their support to go away in Tk 9.
+
.SH "SEE ALSO"
Tk_FindPhoto, Tk_PhotoPutBlock
diff --git a/doc/CrtSelHdlr.3 b/doc/CrtSelHdlr.3
index 5a5c48b..c081c71 100644
--- a/doc/CrtSelHdlr.3
+++ b/doc/CrtSelHdlr.3
@@ -35,11 +35,10 @@ and the selection contents are requested in the format given by
.AP ClientData clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.AP Atom format in
-If the selection requestor isn't in this process, \fIformat\fR determines
+If the selection requestor is not in this process, \fIformat\fR determines
the representation used to transmit the selection to its
requestor.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_CreateSelHandler\fR arranges for a particular procedure
@@ -56,10 +55,10 @@ the selection. The most common form is STRING.
type \fBTk_SelectionProc\fR:
.CS
typedef int Tk_SelectionProc(
- ClientData \fIclientData\fR,
- int \fIoffset\fR,
- char *\fIbuffer\fR,
- int \fImaxBytes\fR);
+ ClientData \fIclientData\fR,
+ int \fIoffset\fR,
+ char *\fIbuffer\fR,
+ int \fImaxBytes\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the
\fIclientData\fR argument given to \fBTk_CreateSelHandler\fR.
@@ -75,7 +74,7 @@ at \fIbuffer\fR containing \fImaxBytes\fR or fewer characters
count of the number of non-NULL characters stored at
\fIbuffer\fR. If the selection no longer exists (e.g. it once
existed but the user deleted the range of characters containing
-it), then \fIproc\fR should return -1.
+it), then \fIproc\fR should return \-1.
.PP
When transferring large selections, Tk will break them up into
smaller pieces (typically a few thousand bytes each) for more
diff --git a/doc/CrtWindow.3 b/doc/CrtWindow.3
index a156581..8e36cb0 100644
--- a/doc/CrtWindow.3
+++ b/doc/CrtWindow.3
@@ -30,41 +30,39 @@ Tk_Window
.AS Tcl_Interp *topLevScreen
.AP Tcl_Interp *interp out
Tcl interpreter to use for error reporting. If no error occurs,
-then \fI*interp\fR isn't modified.
+then \fI*interp\fR is not modified.
.AP Tk_Window parent in
Token for the window that is to serve as the logical parent of
the new window.
-.AP "CONST char" *name in
+.AP "const char" *name in
Name to use for this window. Must be unique among all children of
the same \fIparent\fR.
-.AP "CONST char" *topLevScreen in
+.AP "const char" *topLevScreen in
Has same format as \fIscreenName\fR. If NULL, then new window is
created as an internal window. If non-NULL, new window is created as
a top-level window on screen \fItopLevScreen\fR. If \fItopLevScreen\fR
-is an empty string (``'') then new
-window is created as top-level window of \fIparent\fR's screen.
+is an empty string
+.PQ ""
+then new window is created as top-level window of \fIparent\fR's screen.
.AP Tk_Window tkwin in
Token for window.
-.AP "CONST char" *pathName in
+.AP "const char" *pathName in
Name of new window, specified as path name within application
(e.g. \fB.a.b.c\fR).
.BE
-
.SH DESCRIPTION
.PP
The procedures \fBTk_CreateWindow\fR,
-.VS
\fBTk_CreateAnonymousWindow\fR, and \fBTk_CreateWindowFromPath\fR
are used to create new windows for
use in Tk-based applications. Each of the procedures returns a token
that can be used to manipulate the window in other calls to the Tk
-library. If the window couldn't be created successfully, then NULL
+library. If the window could not be created successfully, then NULL
is returned and \fIinterp->result\fR is modified to hold an error
message.
.PP
Tk supports two different kinds of windows: internal
windows and top-level windows.
-.VE
An internal window is an interior window of a Tk application, such as a
scrollbar or menu bar or button. A top-level window is one that is
created as a child of a screen's root window, rather than as an
@@ -104,7 +102,7 @@ as in calls to \fBTk_CreateWindow\fR, the parent of the new window
must exist at the time of the call, but the new window must not
already exist.
.PP
-The window creation procedures don't
+The window creation procedures do not
actually issue the command to X to create a window.
Instead, they create a local data structure associated with
the window and defer the creation of the X window.
@@ -117,7 +115,7 @@ mapped all of the window attributes can be set while creating
the window.
.PP
The value returned by a window-creation procedure is not the
-X token for the window (it can't be, since X hasn't been
+X token for the window (it cannot be, since X has not been
asked to create the window yet). Instead, it is a token
for Tk's local data structure for the window. Most
of the Tk library procedures take Tk_Window tokens, rather
@@ -139,7 +137,7 @@ then the event handlers will be invoked later, after X has seen
the request and returned an event for it.
.PP
If a window has been created
-but hasn't been mapped, so no X window exists, it is
+but has not been mapped, so no X window exists, it is
possible to force the creation of the X window by
calling \fBTk_MakeWindowExist\fR. This procedure issues
the X commands to instantiate the window given by \fItkwin\fR.
diff --git a/doc/DeleteImg.3 b/doc/DeleteImg.3
index 91bf63f..2b9288e 100644
--- a/doc/DeleteImg.3
+++ b/doc/DeleteImg.3
@@ -18,7 +18,7 @@ Tk_DeleteImage \- Destroy an image.
.AS Tcl_Interp *interp
.AP Tcl_Interp *interp in
Interpreter for which the image was created.
-.AP "CONST char" *name in
+.AP "const char" *name in
Name of the image.
.BE
diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3
index 3d8bb12..2ea04ae 100644
--- a/doc/EventHndlr.3
+++ b/doc/EventHndlr.3
@@ -46,8 +46,8 @@ call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
type \fBTk_EventProc\fR:
.CS
typedef void Tk_EventProc(
- ClientData \fIclientData\fR,
- XEvent *\fIeventPtr\fR);
+ ClientData \fIclientData\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
argument given to \fBTk_CreateEventHandler\fR when the callback
diff --git a/doc/FindPhoto.3 b/doc/FindPhoto.3
index 7e6ee5a..08e0221 100644
--- a/doc/FindPhoto.3
+++ b/doc/FindPhoto.3
@@ -17,19 +17,19 @@ Tk_FindPhoto, Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock, Tk_PhotoGetImage, Tk_Pho
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
-\fB#include <tkPhoto.h>\fR
.sp
Tk_PhotoHandle
-.VS 8.0 br
\fBTk_FindPhoto\fR(\fIinterp, imageName\fR)
-.VE
.sp
-void
-\fBTk_PhotoPutBlock\fR(\fIhandle, blockPtr, x, y, width, height, compRule\fR)
+.VS 8.5
+int
+\fBTk_PhotoPutBlock\fR(\fIinterp, handle, blockPtr, x, y, width, height,\
+compRule\fR)
.sp
-void
-\fBTk_PhotoPutZoomedBlock\fR(\fIhandle, blockPtr, x, y, width, height,\
+int
+\fBTk_PhotoPutZoomedBlock\fR(\fIinterp, handle, blockPtr, x, y, width, height,\
zoomX, zoomY, subsampleX, subsampleY, compRule\fR)
+.VE 8.5
.sp
int
\fBTk_PhotoGetImage\fR(\fIhandle, blockPtr\fR)
@@ -37,21 +37,24 @@ int
void
\fBTk_PhotoBlank\fR(\fIhandle\fR)
.sp
-void
-\fBTk_PhotoExpand\fR(\fIhandle, width, height\fR)
+.VS 8.5
+int
+\fBTk_PhotoExpand\fR(\fIinterp, handle, width, height\fR)
+.VE 8.5
.sp
void
\fBTk_PhotoGetSize\fR(\fIhandle, widthPtr, heightPtr\fR)
.sp
-void
-\fBTk_PhotoSetSize\fR(\fIhandle, width, height\fR)
+.VS 8.5
+int
+\fBTk_PhotoSetSize\fR(\fIinterp. handle, width, height\fR)
+.VE 8.5
.SH ARGUMENTS
.AS Tk_PhotoImageBlock window_path
.AP Tcl_Interp *interp in
-.VS
-Interpreter in which image was created.
-.VE
-.AP "CONST char" *imageName in
+Interpreter in which image was created and in which error reporting is
+to be done.
+.AP "const char" *imageName in
Name of the photo image.
.AP Tk_PhotoHandle handle in
Opaque handle identifying the photo image to be affected.
@@ -67,16 +70,14 @@ to be placed within the image.
Specifies the width of the image area to be affected (for
\fBTk_PhotoPutBlock\fR) or the desired image width (for
\fBTk_PhotoExpand\fR and \fBTk_PhotoSetSize\fR).
-.VS 8.4
.AP int compRule in
Specifies the compositing rule used when combining transparent pixels
in a block of data with a photo image. Must be one of
-TK_PHOTO_COMPOSITE_OVERLAY (which puts the block of data over the top
+\fBTK_PHOTO_COMPOSITE_OVERLAY\fR (which puts the block of data over the top
of the existing photo image, with the previous contents showing
-through in the transparent bits) or TK_PHOTO_COMPOSITE_SET (which
+through in the transparent bits) or \fBTK_PHOTO_COMPOSITE_SET\fR (which
discards the existing photo image contents in the rectangle covered by
the data block.)
-.VE 8.4
.AP int height in
Specifies the height of the image area to be affected (for
\fBTk_PhotoPutBlock\fR) or the desired image height (for
@@ -122,12 +123,12 @@ The \fIblock\fR parameter is a pointer to a
\fBTk_PhotoImageBlock\fR structure, defined as follows:
.CS
typedef struct {
- unsigned char *\fIpixelPtr\fR;
- int \fIwidth\fR;
- int \fIheight\fR;
- int \fIpitch\fR;
- int \fIpixelSize\fR;
- int \fIoffset[4]\fR;
+ unsigned char *\fIpixelPtr\fR;
+ int \fIwidth\fR;
+ int \fIheight\fR;
+ int \fIpitch\fR;
+ int \fIpixelSize\fR;
+ int \fIoffset[4]\fR;
} Tk_PhotoImageBlock;
.CE
The \fIpixelPtr\fR field points to the first pixel, that is, the
@@ -143,16 +144,14 @@ to the addresses of the bytes containing the red, green, blue and alpha
have other values, e.g., for images that are stored as separate red,
green and blue planes.
.PP
-.VS 8.4
The \fIcompRule\fR parameter to \fBTk_PhotoPutBlock\fR specifies a
compositing rule that says what to do with transparent pixels. The
-value TK_PHOTO_COMPOSITE_OVERLAY says that the previous contents of
+value \fBTK_PHOTO_COMPOSITE_OVERLAY\fR says that the previous contents of
the photo image should show through, and the value
-TK_PHOTO_COMPOSITE_SET says that the previous contents of the photo
+\fBTK_PHOTO_COMPOSITE_SET\fR says that the previous contents of the photo
image should be completely ignored, and the values from the block be
copied directly across. The behavior in Tk8.3 and earlier was
-equivalent to having TK_PHOTO_COMPOSITE_OVERLAY as a compositing rule.
-.VE 8.4
+equivalent to having \fBTK_PHOTO_COMPOSITE_OVERLAY\fR as a compositing rule.
.PP
The value given for the \fIwidth\fR and \fIheight\fR parameters to
\fBTk_PhotoPutBlock\fR do not have to correspond to the values specified
@@ -162,6 +161,13 @@ given are replicated (in a tiled fashion) to fill the specified area.
These rules operate independently in the horizontal and vertical
directions.
.PP
+.VS 8.5
+\fBTk_PhotoPutBlock\fR normally returns \fBTCL_OK\fR, though if it cannot
+allocate sufficient memory to hold the resulting image, \fBTCL_ERROR\fR is
+returned instead and, if the \fIinterp\fR argument is non-NULL, an
+error message is placed in the interpreter's result.
+.VE 8.5
+.PP
\fBTk_PhotoPutZoomedBlock\fR works like \fBTk_PhotoPutBlock\fR except that
the image can be reduced or enlarged for display. The
\fIsubsampleX\fR and \fIsubsampleY\fR parameters allow the size of the
@@ -201,6 +207,13 @@ are being supplied in many small blocks, it is more efficient to use
allowing the image to expand in many small increments as image blocks
are supplied.
.PP
+.VS 8.5
+\fBTk_PhotoExpand\fR normally returns \fBTCL_OK\fR, though if it cannot
+allocate sufficient memory to hold the resulting image, \fBTCL_ERROR\fR is
+returned instead and, if the \fIinterp\fR argument is non-NULL, an
+error message is placed in the interpreter's result.
+.VE 8.5
+.PP
\fBTk_PhotoSetSize\fR specifies the size of the image, as if the user
had specified the given \fIwidth\fR and \fIheight\fR values to the
\fB\-width\fR and \fB\-height\fR configuration options. A value of
@@ -209,11 +222,17 @@ or height, but allows the width or height to be changed by subsequent
calls to \fBTk_PhotoPutBlock\fR, \fBTk_PhotoPutZoomedBlock\fR or
\fBTk_PhotoExpand\fR.
.PP
+.VS 8.5
+\fBTk_PhotoSetSize\fR normally returns \fBTCL_OK\fR, though if it cannot
+allocate sufficient memory to hold the resulting image, \fBTCL_ERROR\fR is
+returned instead and, if the \fIinterp\fR argument is non-NULL, an
+error message is placed in the interpreter's result.
+.VE 8.5
+.PP
\fBTk_PhotoGetSize\fR returns the dimensions of the image in
*\fIwidthPtr\fR and *\fIheightPtr\fR.
.SH PORTABILITY
-.VS 8.4
.PP
In Tk 8.3 and earlier, \fBTk_PhotoPutBlock\fR and
\fBTk_PhotoPutZoomedBlock\fR had different signatures. If you want to
@@ -221,7 +240,16 @@ compile code that uses the old interface against 8.4 without updating
your code, compile it with the flag
-DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK. Code linked using Stubs against
older versions of Tk will continue to work.
-.VE 8.4
+.PP
+.VS 8.5
+In Tk 8.4, \fBTk_PhotoPutBlock\fR, \fBTk_PhotoPutZoomedBlock\fR,
+\fBTk_PhotoExpand\fR and \fBTk_PhotoSetSize\fR did not take an
+\fIinterp\fR argument or return any result code. If insufficient
+memory was available for an image, Tk would panic. This behaviour is
+still supported if you compile your extension with the additional flag
+-DUSE_PANIC_ON_PHOTO_ALLOC_FAILURE. Code linked using Stubs against
+older versions of Tk will continue to work.
+.VE 8.5
.SH CREDITS
.PP
diff --git a/doc/FontId.3 b/doc/FontId.3
index bed71c3..60905a7 100644
--- a/doc/FontId.3
+++ b/doc/FontId.3
@@ -17,12 +17,10 @@ fonts
Font
\fBTk_FontId(\fItkfont\fB)\fR
.sp
-void
\fBTk_GetFontMetrics(\fItkfont, fmPtr\fB)\fR
.sp
int
\fBTk_PostscriptFontName(\fItkfont, dsPtr\fB)\fR
-
.SH ARGUMENTS
.AS Tk_FontMetrics *dsPtr
.AP Tk_Font tkfont in
@@ -30,12 +28,11 @@ Opaque font token being queried. Must have been returned by a previous
call to \fBTk_GetFont\fR.
.AP Tk_FontMetrics *fmPtr out
Pointer to structure in which the font metrics for \fItkfont\fR will
-be stored.
+be stored. See \fBDATA STRUCTURES\fR below for details.
.AP Tcl_DString *dsPtr out
Pointer to an initialized \fBTcl_DString\fR to which the name of the
Postscript font that corresponds to \fItkfont\fR will be appended.
.BE
-
.SH DESCRIPTION
.PP
Given a \fItkfont\fR, \fBTk_FontId\fR returns the token that should be
@@ -51,10 +48,12 @@ documentation for the \fBfont\fR command for definitions of the terms
ascent, descent, and linespace, used in font metrics.
.PP
\fBTk_PostscriptFontName\fR maps a \fItkfont\fR to the corresponding
-Postcript font name that should be used when printing. The return value
+Postscript font name that should be used when printing. The return value
is the size in points of the \fItkfont\fR and the Postscript font name is
appended to \fIdsPtr\fR. \fIDsPtr\fR must refer to an initialized
-\fBTcl_DString\fR. Given a ``reasonable'' Postscript printer, the
+\fBTcl_DString\fR. Given a
+.QW reasonable
+Postscript printer, the
following screen font families should print correctly:
.IP
\fBAvant Garde\fR, \fBArial\fR, \fBBookman\fR, \fBCourier\fR,
@@ -65,18 +64,18 @@ following screen font families should print correctly:
.PP
Any other font families may not print correctly because the computed
Postscript font name may be incorrect or not exist on the printer.
-.VS 8.0 br
.SH "DATA STRUCTURES"
-The Tk_FontMetrics data structure is used by Tk_GetFontMetrics to return
-information about a font and is defined as follows:
+The \fBTk_FontMetrics\fR data structure is used by \fBTk_GetFontMetrics\fR to
+return information about a font and is defined as follows:
.CS
typedef struct Tk_FontMetrics {
- int ascent;
- int descent;
- int linespace;
+ int \fIascent\fR;
+ int \fIdescent\fR;
+ int \fIlinespace\fR;
} Tk_FontMetrics;
.CE
-The \fIlinespace\fR field is the amount in pixels that the tallest
+.PP
+The \fIascent\fR field is the amount in pixels that the tallest
letter sticks up above the baseline, plus any extra blank space added
by the designer of the font.
.PP
@@ -88,6 +87,7 @@ The \fIlinespace\fR is the sum of the ascent and descent. How far
apart two lines of text in the same font should be placed so that none
of the characters in one line overlap any of the characters in the
other line.
-.VE
+.SH "SEE ALSO"
+font(n), MeasureChar(3)
.SH KEYWORDS
-font
+font, measurement, Postscript
diff --git a/doc/FreeXId.3 b/doc/FreeXId.3
index c4ad889..eb1da96 100644
--- a/doc/FreeXId.3
+++ b/doc/FreeXId.3
@@ -23,7 +23,6 @@ Display for which \fIid\fR was allocated.
Identifier of X resource (window, font, pixmap, cursor, graphics
context, or colormap) that is no longer in use.
.BE
-
.SH DESCRIPTION
.PP
The default allocator for resource identifiers provided by Xlib is very
@@ -42,9 +41,8 @@ However, if you allocate resources directly from Xlib, for example
by calling \fBXCreatePixmap\fR, then you should call \fBTk_FreeXId\fR
when you call the corresponding Xlib free procedure, such as
\fBXFreePixmap\fR.
-If you don't call \fBTk_FreeXId\fR then the resource identifier will
+If you do not call \fBTk_FreeXId\fR then the resource identifier will
be lost, which could cause problems if the application runs long enough
to lose all of the available identifiers.
-
.SH KEYWORDS
resource identifier
diff --git a/doc/GetAnchor.3 b/doc/GetAnchor.3
index 0b25cb0..8698353 100644
--- a/doc/GetAnchor.3
+++ b/doc/GetAnchor.3
@@ -14,39 +14,42 @@ Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
int
\fBTk_GetAnchorFromObj(\fIinterp, objPtr, anchorPtr\fB)\fR
-.VE
.sp
int
\fBTk_GetAnchor(\fIinterp, string, anchorPtr\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfAnchor(\fIanchor\fB)\fR
.SH ARGUMENTS
.AS "Tk_Anchor" *anchorPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting, or NULL.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
-String value contains name of anchor point: \fBn\fR, \fBne\fR,
-\fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR;
+String value contains name of anchor point:
+.QW n ,
+.QW ne ,
+.QW e ,
+.QW se ,
+.QW s ,
+.QW sw ,
+.QW w ,
+.QW nw ,
+or
+.QW center ;
internal rep will be modified to cache corresponding Tk_Anchor.
-.AP "CONST char" *string in
+.AP "const char" *string in
Same as \fIobjPtr\fR except description of anchor point is passed as
a string.
-.VE
.AP int *anchorPtr out
Pointer to location in which to store anchor position corresponding to
\fIobjPtr\fR or \fIstring\fR.
.AP Tk_Anchor anchor in
Anchor position, e.g. \fBTCL_ANCHOR_CENTER\fR.
.BE
-
.SH DESCRIPTION
.PP
-.VS 8.1
\fBTk_GetAnchorFromObj\fR places in \fI*anchorPtr\fR an anchor position
(enumerated type \fBTk_Anchor\fR)
corresponding to \fIobjPtr\fR's value. The result will be one of
@@ -59,10 +62,10 @@ position the top center point of the object at a particular place.
.PP
Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
-If \fIstring\fR doesn't contain a valid anchor position
+If \fIstring\fR does not contain a valid anchor position
or an abbreviation of one of these names, \fBTCL_ERROR\fR is returned,
\fI*anchorPtr\fR is unmodified, and an error message is
-stored in \fIinterp\fR's result if \fIinterp\fR isn't NULL.
+stored in \fIinterp\fR's result if \fIinterp\fR is not NULL.
\fBTk_GetAnchorFromObj\fR caches information about the return
value in \fIobjPtr\fR, which speeds up future calls to
\fBTk_GetAnchorFromObj\fR with the same \fIobjPtr\fR.
@@ -72,13 +75,12 @@ that the description of the anchor is specified with a string instead
of an object. This prevents \fBTk_GetAnchor\fR from caching the
return value, so \fBTk_GetAnchor\fR is less efficient than
\fBTk_GetAnchorFromObj\fR.
-.VE
.PP
\fBTk_NameOfAnchor\fR is the logical inverse of \fBTk_GetAnchor\fR.
Given an anchor position such as \fBTK_ANCHOR_N\fR it returns a
statically-allocated string corresponding to \fIanchor\fR.
-If \fIanchor\fR isn't a legal anchor value, then
-``unknown anchor position'' is returned.
-
+If \fIanchor\fR is not a legal anchor value, then
+.QW "unknown anchor position"
+is returned.
.SH KEYWORDS
anchor position
diff --git a/doc/GetBitmap.3 b/doc/GetBitmap.3
index 69e319e..a9bd2c2 100644
--- a/doc/GetBitmap.3
+++ b/doc/GetBitmap.3
@@ -14,7 +14,6 @@ Tk_AllocBitmapFromObj, Tk_GetBitmap, Tk_GetBitmapFromObj, Tk_DefineBitmap, Tk_Na
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
Pixmap
\fBTk_AllocBitmapFromObj(\fIinterp, tkwin, objPtr\fB)\fR
.sp
@@ -23,19 +22,16 @@ Pixmap
.sp
Pixmap
\fBTk_GetBitmapFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
int
\fBTk_DefineBitmap(\fIinterp, name, source, width, height\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfBitmap(\fIdisplay, bitmap\fB)\fR
.sp
\fBTk_SizeOfBitmap(\fIdisplay, bitmap, widthPtr, heightPtr\fB)\fR
.sp
-.VS 8.1
\fBTk_FreeBitmapFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
\fBTk_FreeBitmap(\fIdisplay, bitmap\fB)\fR
.SH ARGUMENTS
@@ -45,17 +41,15 @@ Interpreter to use for error reporting; if NULL then no error message
is left after errors.
.AP Tk_Window tkwin in
Token for window in which the bitmap will be used.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
String value describes desired bitmap; internal rep will be
modified to cache pointer to corresponding Pixmap.
-.AP "CONST char" *info in
+.AP "const char" *info in
Same as \fIobjPtr\fR except description of bitmap is passed as a string and
-resulting Pixmap isn't cached.
-.VE
-.AP "CONST char" *name in
+resulting Pixmap is not cached.
+.AP "const char" *name in
Name for new bitmap to be defined.
-.AP "CONST char" *source in
+.AP "const char" *source in
Data for bitmap, in standard bitmap format.
Must be stored in static memory whose value will never change.
.AP "int" width in
@@ -80,13 +74,11 @@ being used by an application. The procedures allow bitmaps to be
re-used efficiently, thereby avoiding server overhead, and also
allow bitmaps to be named with character strings.
.PP
-.VS 8.1
\fBTk_AllocBitmapFromObj\fR returns a Pixmap identifier for a bitmap
that matches the description in \fIobjPtr\fR and is suitable for use
in \fItkwin\fR. It re-uses an existing bitmap, if possible, and
creates a new one otherwise. \fIObjPtr\fR's value must have one
of the following forms:
-.VE
.TP 20
\fB@\fIfileName\fR
\fIFileName\fR must be the name of a file containing a bitmap
@@ -99,21 +91,18 @@ by Tk:
.RS
.TP 12
\fBerror\fR
-The international "don't" symbol: a circle with a diagonal line
-across it.
-.VS "" br
+The international
+.QW don't
+symbol: a circle with a diagonal line across it.
.TP 12
\fBgray75\fR
75% gray: a checkerboard pattern where three out of four bits are on.
-.VE
.TP 12
\fBgray50\fR
50% gray: a checkerboard pattern where every other bit is on.
-.VS "" br
.TP 12
\fBgray25\fR
25% gray: a checkerboard pattern where one out of every four bits is on.
-.VE
.TP 12
\fBgray12\fR
12.5% gray: a pattern where one-eighth of the bits are on, consisting of
@@ -123,7 +112,8 @@ every fourth pixel in every other row.
An hourglass symbol.
.TP 12
\fBinfo\fR
-A large letter ``i''.
+A large letter
+.QW i .
.TP 12
\fBquesthead\fR
The silhouette of a human head, with a question mark in it.
@@ -180,18 +170,17 @@ A database document icon.
A stop sign.
.TP 12
\fBnote\fR
-A face with ballon words.
+A face with balloon words.
.TP 12
\fBcaution\fR
A triangle with an exclamation point.
.RE
.LP
-.VS 8.1
Under normal conditions, \fBTk_AllocBitmapFromObj\fR
returns an identifier for the requested bitmap. If an error
occurs in creating the bitmap, such as when \fIobjPtr\fR refers
to a non-existent file, then \fBNone\fR is returned and an error
-message is left in \fIinterp\fR's result if \fIinterp\fR isn't
+message is left in \fIinterp\fR's result if \fIinterp\fR is not
NULL. \fBTk_AllocBitmapFromObj\fR caches information about the return
value in \fIobjPtr\fR, which speeds up future calls to procedures
such as \fBTk_AllocBitmapFromObj\fR and \fBTk_GetBitmapFromObj\fR.
@@ -204,13 +193,12 @@ return value, so \fBTk_GetBitmap\fR is less efficient than
.PP
\fBTk_GetBitmapFromObj\fR returns the token for an existing bitmap, given
the window and description used to create the bitmap.
-\fBTk_GetBitmapFromObj\fR doesn't actually create the bitmap; the bitmap
+\fBTk_GetBitmapFromObj\fR does not actually create the bitmap; the bitmap
must already have been created with a previous call to
\fBTk_AllocBitmapFromObj\fR or \fBTk_GetBitmap\fR. The return
value is cached in \fIobjPtr\fR, which speeds up
future calls to \fBTk_GetBitmapFromObj\fR with the same \fIobjPtr\fR
and \fItkwin\fR.
-.VE
.PP
\fBTk_DefineBitmap\fR associates a name with
in-memory bitmap data so that the name can be used in later
@@ -219,12 +207,12 @@ argument gives a name for the bitmap; it must not previously
have been used in a call to \fBTk_DefineBitmap\fR.
The arguments \fIsource\fR, \fIwidth\fR, and \fIheight\fR
describe the bitmap.
-\fBTk_DefineBitmap\fR normally returns TCL_OK; if an error occurs
+\fBTk_DefineBitmap\fR normally returns \fBTCL_OK\fR; if an error occurs
(e.g. a bitmap named \fInameId\fR has already been defined) then
-TCL_ERROR is returned and an error message is left in
+\fBTCL_ERROR\fR is returned and an error message is left in
\fIinterp->result\fR.
Note: \fBTk_DefineBitmap\fR expects the memory pointed to by
-\fIsource\fR to be static: \fBTk_DefineBitmap\fR doesn't make
+\fIsource\fR to be static: \fBTk_DefineBitmap\fR does not make
a private copy of this memory, but uses the bytes pointed to
by \fIsource\fR later in calls to \fBTk_AllocBitmapFromObj\fR or
\fBTk_GetBitmap\fR.
@@ -237,26 +225,22 @@ which was created by the \fBbitmap\fR program and contains
a stipple pattern.
The following code uses \fBTk_DefineBitmap\fR to define a
new bitmap named \fBfoo\fR:
-.VS
.CS
Pixmap bitmap;
#include "stip.bitmap"
Tk_DefineBitmap(interp, "foo", stip_bits,
- stip_width, stip_height);
+ stip_width, stip_height);
\&...
bitmap = Tk_GetBitmap(interp, tkwin, "foo");
.CE
-.VE
This code causes the bitmap file to be read
at compile-time and incorporates the bitmap information into
the program's executable image. The same bitmap file could be
read at run-time using \fBTk_GetBitmap\fR:
-.VS
.CS
Pixmap bitmap;
bitmap = Tk_GetBitmap(interp, tkwin, "@stip.bitmap");
.CE
-.VE
The second form is a bit more flexible (the file could be modified
after the program has been compiled, or a different string could be
provided to read a different file), but it is a little slower and
@@ -289,7 +273,6 @@ argument in the words pointed to by the \fIwidthPtr\fR and
\fIbitmap\fR must have been created by \fBTk_AllocBitmapFromObj\fR or
\fBTk_GetBitmap\fR.
.PP
-.VS 8.1
When a bitmap is no longer needed, \fBTk_FreeBitmapFromObj\fR or
\fBTk_FreeBitmap\fR should be called to release it.
For \fBTk_FreeBitmapFromObj\fR the bitmap to release is specified
@@ -299,7 +282,6 @@ with its Pixmap token.
There should be exactly one call to \fBTk_FreeBitmapFromObj\fR
or \fBTk_FreeBitmap\fR for each call to \fBTk_AllocBitmapFromObj\fR or
\fBTk_GetBitmap\fR.
-.VE
.SH BUGS
In determining whether an existing bitmap can be used to satisfy
diff --git a/doc/GetCapStyl.3 b/doc/GetCapStyl.3
index e9cce7b..5463f12 100644
--- a/doc/GetCapStyl.3
+++ b/doc/GetCapStyl.3
@@ -17,15 +17,18 @@ Tk_GetCapStyle, Tk_NameOfCapStyle \- translate between strings and cap styles
int
\fBTk_GetCapStyle(\fIinterp, string, capPtr\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfCapStyle(\fIcap\fB)\fR
.SH ARGUMENTS
.AS "Tcl_Interp" *capPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
-.AP "CONST char" *string in
-String containing name of cap style: one of ```butt'', ``projecting'',
-or ``round''.
+.AP "const char" *string in
+String containing name of cap style: one of
+.QW butt ,
+.QW projecting ,
+or
+.QW round .
.AP int *capPtr out
Pointer to location in which to store X cap style corresponding to
\fIstring\fR.
@@ -46,7 +49,7 @@ implies.
.PP
Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
-If \fIstring\fR doesn't contain a valid cap style
+If \fIstring\fR does not contain a valid cap style
or an abbreviation of one of these names, then an error message is
stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and
\fI*capPtr\fR is unmodified.
@@ -54,8 +57,9 @@ stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and
\fBTk_NameOfCapStyle\fR is the logical inverse of \fBTk_GetCapStyle\fR.
Given a cap style such as \fBCapButt\fR it returns a
statically-allocated string corresponding to \fIcap\fR.
-If \fIcap\fR isn't a legal cap style, then
-``unknown cap style'' is returned.
+If \fIcap\fR is not a legal cap style, then
+.QW "unknown cap style"
+is returned.
.SH KEYWORDS
butt, cap style, projecting, round
diff --git a/doc/GetClrmap.3 b/doc/GetClrmap.3
index 3c288e9..13ad9b2 100644
--- a/doc/GetClrmap.3
+++ b/doc/GetClrmap.3
@@ -9,7 +9,7 @@
.TH Tk_GetColormap 3 4.0 Tk "Tk Library Procedures"
.BS
.SH NAME
-Tk_GetColormap, Tk_FreeColormap \- allocate and free colormaps
+Tk_GetColormap, Tk_PreserveColormap, Tk_FreeColormap \- allocate and free colormaps
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -17,6 +17,8 @@ Tk_GetColormap, Tk_FreeColormap \- allocate and free colormaps
Colormap
\fBTk_GetColormap(\fIinterp, tkwin, string\fB)\fR
.sp
+\fBTk_PreserveColormap(\fIdisplay, colormap\fB)\fR
+.sp
\fBTk_FreeColormap(\fIdisplay, colormap\fB)\fR
.SH ARGUMENTS
.AS "Colormap" colormap
@@ -24,16 +26,15 @@ Colormap
Interpreter to use for error reporting.
.AP Tk_Window tkwin in
Token for window in which colormap will be used.
-.AP "CONST char" *string in
+.AP "const char" *string in
Selects a colormap: either \fBnew\fR or the name of a window
with the same screen and visual as \fItkwin\fR.
.AP Display *display in
Display for which \fIcolormap\fR was allocated.
.AP Colormap colormap in
-Colormap to free; must have been returned by a previous
+Colormap to free or preserve; must have been returned by a previous
call to \fBTk_GetColormap\fR or \fBTk_GetVisual\fR.
.BE
-
.SH DESCRIPTION
.PP
These procedures are used to manage colormaps.
@@ -42,16 +43,22 @@ If its \fIstring\fR argument is \fBnew\fR then a new colormap is
created; otherwise \fIstring\fR must be the name of another window
with the same screen and visual as \fItkwin\fR, and the colormap from that
window is returned.
-If \fIstring\fR doesn't make sense, or if it refers to a window on
+If \fIstring\fR does not make sense, or if it refers to a window on
a different screen from \fItkwin\fR or with
a different visual than \fItkwin\fR, then \fBTk_GetColormap\fR returns
-\fBNone\fR and leaves an error message in \fIinterp->result\fR.
+\fBNone\fR and leaves an error message in \fIinterp\fR's result.
+.PP
+\fBTk_PreserveColormap\fR increases the internal reference count for a
+colormap previously returned by \fBTk_GetColormap\fR, which allows the
+colormap to be stored in several locations without knowing which order
+they will be released.
.PP
\fBTk_FreeColormap\fR should be called when a colormap returned by
\fBTk_GetColormap\fR is no longer needed.
Tk maintains a reference count for each colormap returned by
\fBTk_GetColormap\fR, so there should eventually be one call to
-\fBTk_FreeColormap\fR for each call to \fBTk_GetColormap\fR.
+\fBTk_FreeColormap\fR for each call to \fBTk_GetColormap\fR and each
+call to \fBTk_PreserveColormap\fR.
When a colormap's reference count becomes zero, Tk releases the
X colormap.
.PP
@@ -66,6 +73,5 @@ If \fBTk_GetColormap\fR is called with a \fIstring\fR value of
be returned by \fBTk_GetVisual\fR; however, it can be used in other
windows by calling \fBTk_GetColormap\fR with the original window's
name as \fIstring\fR.
-
.SH KEYWORDS
-colormap
+colormap, visual
diff --git a/doc/GetColor.3 b/doc/GetColor.3
index 201edab..b5416af 100644
--- a/doc/GetColor.3
+++ b/doc/GetColor.3
@@ -13,7 +13,6 @@ Tk_AllocColorFromObj, Tk_GetColor, Tk_GetColorFromObj, Tk_GetColorByValue, Tk_Na
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
-.VS 8.1
.sp
XColor *
\fBTk_AllocColorFromObj(\fIinterp, tkwin, objPtr\fB)\fR
@@ -23,20 +22,17 @@ XColor *
.sp
XColor *
\fBTk_GetColorFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
XColor *
\fBTk_GetColorByValue(\fItkwin, prefPtr\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfColor(\fIcolorPtr\fB)\fR
.sp
GC
\fBTk_GCForColor(\fIcolorPtr, drawable\fB)\fR
.sp
-.VS 8.1
\fBTk_FreeColorFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
\fBTk_FreeColor(\fIcolorPtr\fB)\fR
.SH ARGUMENTS
@@ -45,14 +41,12 @@ GC
Interpreter to use for error reporting.
.AP Tk_Window tkwin in
Token for window in which color will be used.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
String value describes desired color; internal rep will be
modified to cache pointer to corresponding (XColor *).
.AP char *name in
Same as \fIobjPtr\fR except description of color is passed as a string and
-resulting (XColor *) isn't cached.
-.VE
+resulting (XColor *) is not cached.
.AP XColor *prefPtr in
Indicates red, green, and blue intensities of desired
color.
@@ -66,7 +60,6 @@ same screen and depth as the window for which the color was allocated.
.BE
.SH DESCRIPTION
-.VS 8.1
.PP
These procedures manage the colors being used by a Tk application.
They allow colors to be shared whenever possible, so that colormap
@@ -77,7 +70,6 @@ Given a textual description of a color, \fBTk_AllocColorFromObj\fR
locates a pixel value that may be used to render the color
in a particular window. The desired color is specified with an
object whose string value must have one of the following forms:
-.VE
.TP 20
\fIcolorname\fR
Any of the valid textual names for a color defined in the
@@ -98,7 +90,6 @@ When fewer than 16 bits are provided for each color, they represent
the most significant bits of the color. For example, #3a7 is the
same as #3000a0007000.
.PP
-.VS 8.1
\fBTk_AllocColorFromObj\fR returns a pointer to
an XColor structure; the structure indicates the exact intensities of
the allocated color (which may differ slightly from those requested,
@@ -106,7 +97,7 @@ depending on the limitations of the screen) and a pixel value
that may be used to draw with the color in \fItkwin\fR.
If an error occurs in \fBTk_AllocColorFromObj\fR (such as an unknown
color name) then NULL is returned and an error message is stored in
-\fIinterp\fR's result if \fIinterp\fR isn't NULL.
+\fIinterp\fR's result if \fIinterp\fR is not NULL.
If the colormap for \fItkwin\fR is full, \fBTk_AllocColorFromObj\fR
will use the closest existing color in the colormap.
\fBTk_AllocColorFromObj\fR caches information about
@@ -121,13 +112,12 @@ return value, so \fBTk_GetColor\fR is less efficient than
.PP
\fBTk_GetColorFromObj\fR returns the token for an existing color, given
the window and description used to create the color.
-\fBTk_GetColorFromObj\fR doesn't actually create the color; the color
+\fBTk_GetColorFromObj\fR does not actually create the color; the color
must already have been created with a previous call to
\fBTk_AllocColorFromObj\fR or \fBTk_GetColor\fR. The return
value is cached in \fIobjPtr\fR, which speeds up
future calls to \fBTk_GetColorFromObj\fR with the same \fIobjPtr\fR
and \fItkwin\fR.
-.VE
.PP
\fBTk_GetColorByValue\fR is similar to \fBTk_GetColor\fR except that
the desired color is indicated with the \fIred\fR, \fIgreen\fR, and
@@ -173,7 +163,6 @@ The graphics context is cached with the color and will exist only as
long as \fIcolorPtr\fR exists; it is freed when the last reference
to \fIcolorPtr\fR is freed by calling \fBTk_FreeColor\fR.
.PP
-.VS 8.1
When a color is no longer needed \fBTk_FreeColorFromObj\fR or
\fBTk_FreeColor\fR should be called to release it.
For \fBTk_FreeColorFromObj\fR the color to release is specified
@@ -183,6 +172,5 @@ with a pointer to its XColor structure.
There should be exactly one call to \fBTk_FreeColorFromObj\fR
or \fBTk_FreeColor\fR for each call to \fBTk_AllocColorFromObj\fR,
\fBTk_GetColor\fR, or \fBTk_GetColorByValue\fR.
-.VE
.SH KEYWORDS
color, intensity, object, pixel value
diff --git a/doc/GetCursor.3 b/doc/GetCursor.3
index daca323..953252b 100644
--- a/doc/GetCursor.3
+++ b/doc/GetCursor.3
@@ -14,7 +14,6 @@ Tk_AllocCursorFromObj, Tk_GetCursor, Tk_GetCursorFromObj, Tk_GetCursorFromData,
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
Tk_Cursor
\fBTk_AllocCursorFromObj(\fIinterp, tkwin, objPtr\fB)\fR
.sp
@@ -23,17 +22,14 @@ Tk_Cursor
.sp
Tk_Cursor
\fBTk_GetCursorFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
Tk_Cursor
\fBTk_GetCursorFromData(\fIinterp, tkwin, source, mask, width, height, xHot, yHot, fg, bg\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfCursor(\fIdisplay, cursor\fB)\fR
.sp
-.VS 8.1
\fBTk_FreeCursorFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
\fBTk_FreeCursor(\fIdisplay, cursor\fB)\fR
.SH ARGUMENTS
@@ -42,17 +38,15 @@ CONST char *
Interpreter to use for error reporting.
.AP Tk_Window tkwin in
Token for window in which the cursor will be used.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
Description of cursor; see below for possible values. Internal rep will be
modified to cache pointer to corresponding Tk_Cursor.
.AP char *name in
Same as \fIobjPtr\fR except description of cursor is passed as a string and
-resulting Tk_Cursor isn't cached.
-.VE
-.AP "CONST char" *source in
+resulting Tk_Cursor is not cached.
+.AP "const char" *source in
Data for cursor cursor, in standard cursor format.
-.AP "CONST char" *mask in
+.AP "const char" *mask in
Data for mask cursor, in standard cursor format.
.AP "int" width in
Width of \fIsource\fR and \fImask\fR.
@@ -81,7 +75,6 @@ being used by an application. The procedures allow cursors to be
re-used efficiently, thereby avoiding server overhead, and also
allow cursors to be named with character strings.
.PP
-.VS 8.1
\fBTk_AllocCursorFromObj\fR takes as argument an object describing a
cursor, and returns an opaque Tk identifier for a cursor corresponding
to the description. It re-uses an existing cursor if possible and
@@ -91,15 +84,15 @@ future calls to procedures such as \fBTk_AllocCursorFromObj\fR and
\fBTk_GetCursorFromObj\fR. If an error occurs in creating the cursor,
such as when \fIobjPtr\fR refers to a non-existent file, then \fBNone\fR
is returned and an error message will be stored in \fIinterp\fR's result
-if \fIinterp\fR isn't NULL. \fIObjPtr\fR must contain a standard Tcl
+if \fIinterp\fR is not NULL. \fIObjPtr\fR must contain a standard Tcl
list with one of the following forms:
-.VE
.TP
\fIname\fR\0[\fIfgColor\fR\0[\fIbgColor\fR]]
\fIName\fR is the name of a cursor in the standard X cursor cursor,
i.e., any of the names defined in \fBcursorcursor.h\fR, without
the \fBXC_\fR. Some example values are \fBX_cursor\fR, \fBhand2\fR,
-or \fBleft_ptr\fR. Appendix B of ``The X Window System''
+or \fBleft_ptr\fR. Appendix B of
+.QW "The X Window System"
by Scheifler & Gettys has illustrations showing what each of these
cursors looks like. If \fIfgColor\fR and \fIbgColor\fR are both
specified, they give the foreground and background colors to use
@@ -116,7 +109,7 @@ will also accept any of the standard Mac cursors
including \fBibeam\fR, \fBcrosshair\fR, \fBwatch\fR, \fBplus\fR, and
\fBarrow\fR. In addition, Tk will load Macintosh cursor resources of
the types \fBcrsr\fR (color) and \fBCURS\fR (black and white) by the
-name of the of the resource. The application and all its open
+name of the resource. The application and all its open
dynamic library's resource files will be searched for the named
cursor. If there are conflicts color cursors will always be loaded
in preference to black and white cursors.
@@ -142,7 +135,6 @@ This form only works on Windows, and will load a Windows system
cursor (\fB.ani\fR or \fB.cur\fR) from the file specified in
\fIsourceName\fR.
.PP
-.VS 8.1
\fBTk_GetCursor\fR is identical to \fBTk_AllocCursorFromObj\fR except
that the description of the cursor is specified with a string instead
of an object. This prevents \fBTk_GetCursor\fR from caching the
@@ -151,13 +143,12 @@ return value, so \fBTk_GetCursor\fR is less efficient than
.PP
\fBTk_GetCursorFromObj\fR returns the token for an existing cursor, given
the window and description used to create the cursor.
-\fBTk_GetCursorFromObj\fR doesn't actually create the cursor; the cursor
+\fBTk_GetCursorFromObj\fR does not actually create the cursor; the cursor
must already have been created with a previous call to
\fBTk_AllocCursorFromObj\fR or \fBTk_GetCursor\fR. The return
value is cached in \fIobjPtr\fR, which speeds up
future calls to \fBTk_GetCursorFromObj\fR with the same \fIobjPtr\fR
and \fItkwin\fR.
-.VE
.PP
\fBTk_GetCursorFromData\fR allows cursors to be created from
in-memory descriptions of their source and mask cursors. \fISource\fR
@@ -178,8 +169,8 @@ Tk_Cursor cursor;
#include "source.cursor"
#include "mask.cursor"
cursor = Tk_GetCursorFromData(interp, tkwin, source_bits,
- mask_bits, source_width, source_height, source_x_hot,
- source_y_hot, Tk_GetUid("red"), Tk_GetUid("blue"));
+ mask_bits, source_width, source_height, source_x_hot,
+ source_y_hot, Tk_GetUid("red"), Tk_GetUid("blue"));
.CE
.PP
Under normal conditions \fBTk_GetCursorFromData\fR
@@ -211,7 +202,6 @@ only guaranteed to persist until the next call to
\fBTk_NameOfCursor\fR. Also, this call is not portable except for
cursors returned by \fBTk_GetCursor\fR.
.PP
-.VS 8.1
When a cursor returned by \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR,
or \fBTk_GetCursorFromData\fR
is no longer needed, \fBTk_FreeCursorFromObj\fR or
@@ -223,7 +213,6 @@ with its Tk_Cursor token.
There should be exactly one call to \fBTk_FreeCursor\fR for
each call to \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR,
or \fBTk_GetCursorFromData\fR.
-.VE
.SH BUGS
In determining whether an existing cursor can be used to satisfy
diff --git a/doc/GetDash.3 b/doc/GetDash.3
index ce25b31..cc54c5a 100644
--- a/doc/GetDash.3
+++ b/doc/GetDash.3
@@ -20,7 +20,7 @@ int
.AS Tk_Dash *dashPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
-.AP "CONST char *" string in
+.AP "const char *" string in
Textual value to be converted.
.AP Tk_Dash *dashPtr out
Points to place to store the dash pattern
@@ -31,31 +31,41 @@ value converted from \fIstring\fR.
.PP
These procedure parses the string and fills in the result in the
Tk_Dash structure. The string can be a list of integers or a
-character string containing only \fB[.,-_]\fR or spaces. If all
-goes well, TCL_OK is returned. If \fIstring\fR doesn't have the
-proper syntax then TCL_ERROR is returned, an error message is left
+character string containing only
+.QW \fB.,\-_\fR
+or spaces. If all
+goes well, \fBTCL_OK\fR is returned. If \fIstring\fR does not have the
+proper syntax then \fBTCL_ERROR\fR is returned, an error message is left
in the interpreter's result, and nothing is stored at *\fIdashPtr\fR.
.PP
The first possible syntax is a list of integers. Each element
represents the number of pixels of a line segment. Only the odd
-segments are drawn using the "outline" color. The other segments
-are drawn transparent.
+segments are drawn using the
+.QW outline
+color. The other segments are drawn transparent.
.PP
The second possible syntax is a character list containing only
-5 possible characters \fB[.,-_ ]\fR. The space can be used
+5 possible characters
+.QW "\fB.,\-_ \fR" .
+The space can be used
to enlarge the space between other line elements, and can not
-occur as the first posibion in the string. Some examples:
- -dash . = -dash {2 4}
- -dash - = -dash {6 4}
- -dash -. = -dash {6 4 2 4}
- -dash -.. = -dash {6 4 2 4 2 4}
- -dash {. } = -dash {2 8}
- -dash , = -dash {4 4}
+occur as the first position in the string. Some examples:
+.CS
+ \-dash . = \-dash {2 4}
+ \-dash \- = \-dash {6 4}
+ \-dash \-. = \-dash {6 4 2 4}
+ \-dash \-.. = \-dash {6 4 2 4 2 4}
+ \-dash {. } = \-dash {2 8}
+ \-dash , = \-dash {4 4}
+.CE
.PP
The main difference of this syntax with the previous is that it
-it shape-conserving. This means that all values in the dash
+is shape-conserving. This means that all values in the dash
list will be multiplied by the line width before display. This
-assures that "." will always be displayed as a dot and "-"
+assures that
+.QW .
+will always be displayed as a dot and
+.QW \-
always as a dash regardless of the line width.
.PP
On systems where only a limited set of dash patterns, the dash
diff --git a/doc/GetFont.3 b/doc/GetFont.3
index fbfa0e3..2ca1395 100644
--- a/doc/GetFont.3
+++ b/doc/GetFont.3
@@ -14,7 +14,6 @@ Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FreeFontFr
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
Tk_Font
\fBTk_AllocFontFromObj(\fIinterp, tkwin, objPtr\fB)\fR
.sp
@@ -23,15 +22,12 @@ Tk_Font
.sp
Tk_Font
\fBTk_GetFontFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
-CONST char *
+const char *
\fBTk_NameOfFont(\fItkfont\fB)\fR
.sp
-.VS 8.1
Tk_Font
\fBTk_FreeFontFromObj(\fItkwin, objPtr\fB)\fR
-.VE
.sp
void
\fBTk_FreeFont(\fItkfont\fB)\fR
@@ -43,21 +39,18 @@ Interpreter to use for error reporting. If \fBNULL\fR, then no error
messages are left after errors.
.AP Tk_Window tkwin in
Token for window in which font will be used.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
Gives name or description of font. See documentation
for the \fBfont\fR command for details on acceptable formats.
Internal rep will be modified to cache corresponding Tk_Font.
.AP "const char" *string in
Same as \fIobjPtr\fR except description of font is passed as a string and
-resulting Tk_Font isn't cached.
-.VE
+resulting Tk_Font is not cached.
.AP Tk_Font tkfont in
Opaque font token.
.BE
.SH DESCRIPTION
.PP
-.VS 8.1
\fBTk_AllocFontFromObj\fR finds the font indicated by \fIobjPtr\fR and
returns a token that represents the font. The return value can be used
in subsequent calls to procedures such as \fBTk_GetFontMetrics\fR,
@@ -69,7 +62,7 @@ the documentation for the \fBfont\fR command for a description of the
valid formats. If \fBTk_AllocFontFromObj\fR is unsuccessful (because,
for example, \fIobjPtr\fR did not contain a valid font specification) then it
returns \fBNULL\fR and leaves an error message in \fIinterp\fR's result
-if \fIinterp\fR isn't \fBNULL\fR. \fBTk_AllocFontFromObj\fR caches
+if \fIinterp\fR is not \fBNULL\fR. \fBTk_AllocFontFromObj\fR caches
information about the return
value in \fIobjPtr\fR, which speeds up future calls to procedures
such as \fBTk_AllocFontFromObj\fR and \fBTk_GetFontFromObj\fR.
@@ -82,13 +75,12 @@ matching Tk_Font, so \fBTk_GetFont\fR is less efficient than
.PP
\fBTk_GetFontFromObj\fR returns the token for an existing font, given
the window and description used to create the font.
-\fBTk_GetFontFromObj\fR doesn't actually create the font; the font
+\fBTk_GetFontFromObj\fR does not actually create the font; the font
must already have been created with a previous call to
\fBTk_AllocFontFromObj\fR or \fBTk_GetFont\fR. The return
value is cached in \fIobjPtr\fR, which speeds up
future calls to \fBTk_GetFontFromObj\fR with the same \fIobjPtr\fR
and \fItkwin\fR.
-.VE
.PP
\fBTk_AllocFontFromObj\fR and \fBTk_GetFont\fR maintain
a database of all fonts they have allocated. If
@@ -105,7 +97,6 @@ passed to \fBTk_GetFont\fR to create the font. The string returned by
\fBTk_NameOfFont\fR is only guaranteed to persist until the \fItkfont\fR
is deleted. The caller must not modify this string.
.PP
-.VS 8.1
When a font is no longer needed,
\fBTk_FreeFontFromObj\fR or \fBTk_FreeFont\fR should be called to
release it. For \fBTk_FreeFontFromObj\fR the font to release is specified
@@ -114,10 +105,8 @@ with the same information used to create it; for
with its Tk_Font token. There should be
exactly one call to \fBTk_FreeFontFromObj\fR or \fBTk_FreeFont\fR
for each call to \fBTk_AllocFontFromObj\fR or \fBTk_GetFont\fR.
-.VE
.SH "SEE ALSO"
Tk_FontId(3)
-
.SH KEYWORDS
font
diff --git a/doc/GetHINSTANCE.3 b/doc/GetHINSTANCE.3
index 4a13786..07c9ddd 100644
--- a/doc/GetHINSTANCE.3
+++ b/doc/GetHINSTANCE.3
@@ -9,16 +9,14 @@
Tk_GetHINSTANCE \- retrieve the global application instance handle
.SH SYNOPSIS
.nf
-\fB#include <tk.h>\fR
+\fB#include <tkPlatDecls.h>\fR
.sp
HINSTANCE
\fBTk_GetHINSTANCE\fR()
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetHINSTANCE\fR returns the Windows application instance handle
for the Tk application. This function is only available on Windows platforms.
-
.SH KEYWORDS
identifier, instance
diff --git a/doc/GetHWND.3 b/doc/GetHWND.3
index 70fb0dd..06bdf37 100644
--- a/doc/GetHWND.3
+++ b/doc/GetHWND.3
@@ -6,7 +6,7 @@
.TH HWND 3 8.0 Tk "Tk Library Procedures"
.BS
.SH NAME
-Tk_GetHWND, Tk_AttachHWND \- manage interactione between the Windows handle and an X window
+Tk_GetHWND, Tk_AttachHWND \- manage interactions between the Windows handle and an X window
.SH SYNOPSIS
.nf
\fB#include <tkPlatDecls.h>\fR
diff --git a/doc/GetImage.3 b/doc/GetImage.3
index aefd9b9..fb6e4c8 100644
--- a/doc/GetImage.3
+++ b/doc/GetImage.3
@@ -28,7 +28,7 @@ Tk_Image
Place to leave error message.
.AP Tk_Window tkwin in
Window in which image will be used.
-.AP "CONST char" *name in
+.AP "const char" *name in
Name of image.
.AP Tk_ImageChangedProc *changeProc in
Procedure for Tk to invoke whenever image content or size changes.
@@ -73,7 +73,7 @@ display an image.
identifies the window where the image will be displayed.
\fBTk_GetImage\fR looks up the image in the table of existing
images and returns a token for a new instance of the image.
-If the image doesn't exist then \fBTk_GetImage\fR returns NULL
+If the image does not exist then \fBTk_GetImage\fR returns NULL
and leaves an error message in \fIinterp->result\fR.
.PP
When a widget wishes to actually display an image it must
@@ -107,13 +107,13 @@ The \fIchangeProc\fR and \fIclientData\fR arguments to
in the image; it must match the following prototype:
.CS
typedef void Tk_ImageChangedProc(
- ClientData \fIclientData\fR,
- int \fIx\fR,
- int \fIy\fR,
- int \fIwidth\fR,
- int \fIheight\fR,
- int \fIimageWidth\fR,
- int \fIimageHeight\fR);
+ ClientData \fIclientData\fR,
+ int \fIx\fR,
+ int \fIy\fR,
+ int \fIwidth\fR,
+ int \fIheight\fR,
+ int \fIimageWidth\fR,
+ int \fIimageHeight\fR);
.CE
The \fIclientData\fR argument to \fIchangeProc\fR is the same as the
\fIclientData\fR argument to \fBTk_GetImage\fR.
diff --git a/doc/GetJoinStl.3 b/doc/GetJoinStl.3
index d2e45dd..1af1a06 100644
--- a/doc/GetJoinStl.3
+++ b/doc/GetJoinStl.3
@@ -17,15 +17,18 @@ Tk_GetJoinStyle, Tk_NameOfJoinStyle \- translate between strings and join styles
int
\fBTk_GetJoinStyle(\fIinterp, string, joinPtr\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfJoinStyle(\fIjoin\fB)\fR
.SH ARGUMENTS
.AS "Tcl_Interp" *joinPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
-.AP "CONST char" *string in
-String containing name of join style: one of ``bevel'', ``miter'',
-or ``round''.
+.AP "const char" *string in
+String containing name of join style: one of
+.QW bevel ,
+.QW miter ,
+or
+.QW round .
.AP int *joinPtr out
Pointer to location in which to store X join style corresponding to
\fIstring\fR.
@@ -45,7 +48,7 @@ implies.
.PP
Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
-If \fIstring\fR doesn't contain a valid join style
+If \fIstring\fR does not contain a valid join style
or an abbreviation of one of these names, then an error message is
stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and
\fI*joinPtr\fR is unmodified.
@@ -53,8 +56,9 @@ stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and
\fBTk_NameOfJoinStyle\fR is the logical inverse of \fBTk_GetJoinStyle\fR.
Given a join style such as \fBJoinBevel\fR it returns a
statically-allocated string corresponding to \fIjoin\fR.
-If \fIjoin\fR isn't a legal join style, then
-``unknown join style'' is returned.
+If \fIjoin\fR is not a legal join style, then
+.QW "unknown join style"
+is returned.
.SH KEYWORDS
bevel, join style, miter, round
diff --git a/doc/GetJustify.3 b/doc/GetJustify.3
index 5f60336..e8535e7 100644
--- a/doc/GetJustify.3
+++ b/doc/GetJustify.3
@@ -14,41 +14,38 @@ Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify \- translate between strin
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
int
\fBTk_GetJustifyFromObj(\fIinterp, objPtr, justifyPtr\fB)\fR
.sp
int
\fBTk_GetJustify(\fIinterp, string, justifyPtr\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfJustify(\fIjustify\fB)\fR
.SH ARGUMENTS
.AS "Tk_Justify" *justifyPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting, or NULL.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
-String value contains name of justification style (\fBleft\fR, \fBright\fR, or
-\fBcenter\fR). The
-internal rep will be modified to cache corresponding justify value.
-.AP "CONST char" *string in
+String value contains name of justification style, one of
+.QW left ,
+.QW right ,
+or
+.QW center .
+The internal rep will be modified to cache corresponding justify value.
+.AP "const char" *string in
Same as \fIobjPtr\fR except description of justification style is passed as
a string.
-.VE
.AP int *justifyPtr out
Pointer to location in which to store justify value corresponding to
\fIobjPtr\fR or \fIstring\fR.
.AP Tk_Justify justify in
Justification style (one of the values listed below).
.BE
-
.SH DESCRIPTION
.PP
-.VS 8.1
\fBTk_GetJustifyFromObj\fR places in \fI*justifyPtr\fR the justify value
corresponding to \fIobjPtr\fR's value.
-.VE
This value will be one of the following:
.TP
\fBTK_JUSTIFY_LEFT\fR
@@ -63,13 +60,12 @@ the line; as a result, the left edges of lines may be ragged.
Means that the text on each line should be centered; as a result,
both the left and right edges of lines may be ragged.
.PP
-.VS 8.1
Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
-If \fIobjPtr\fR doesn't contain a valid justification style
+If \fIobjPtr\fR does not contain a valid justification style
or an abbreviation of one of these names, \fBTCL_ERROR\fR is returned,
\fI*justifyPtr\fR is unmodified, and an error message is
-stored in \fIinterp\fR's result if \fIinterp\fR isn't NULL.
+stored in \fIinterp\fR's result if \fIinterp\fR is not NULL.
\fBTk_GetJustifyFromObj\fR caches information about the return
value in \fIobjPtr\fR, which speeds up future calls to
\fBTk_GetJustifyFromObj\fR with the same \fIobjPtr\fR.
@@ -79,13 +75,13 @@ that the description of the justification is specified with a string instead
of an object. This prevents \fBTk_GetJustify\fR from caching the
return value, so \fBTk_GetJustify\fR is less efficient than
\fBTk_GetJustifyFromObj\fR.
-.VE
.PP
\fBTk_NameOfJustify\fR is the logical inverse of \fBTk_GetJustify\fR.
Given a justify value it returns a statically-allocated string
corresponding to \fIjustify\fR.
-If \fIjustify\fR isn't a legal justify value, then
-``unknown justification style'' is returned.
+If \fIjustify\fR is not a legal justify value, then
+.QW "unknown justification style"
+is returned.
.SH KEYWORDS
center, fill, justification, string
diff --git a/doc/GetOption.3 b/doc/GetOption.3
index de09f9b..79817b7 100644
--- a/doc/GetOption.3
+++ b/doc/GetOption.3
@@ -20,9 +20,9 @@ Tk_Uid
.AS Tk_Window *class
.AP Tk_Window tkwin in
Token for window.
-.AP "CONST char" *name in
+.AP "const char" *name in
Name of desired option.
-.AP "CONST char" *class in
+.AP "const char" *class in
Class of desired option. Null means there is no class for
this option; do lookup based on name only.
.BE
diff --git a/doc/GetPixels.3 b/doc/GetPixels.3
index a89c8d1..814c4eb 100644
--- a/doc/GetPixels.3
+++ b/doc/GetPixels.3
@@ -14,18 +14,14 @@ Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM \- translate
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
int
\fBTk_GetPixelsFromObj(\fIinterp, tkwin, objPtr, intPtr\fB)\fR
-.VE
.sp
int
\fBTk_GetPixels(\fIinterp, tkwin, string, intPtr\fB)\fR
.sp
-.VS 8.1
int
\fBTk_GetMMFromObj(\fIinterp, tkwin, objPtr, doublePtr\fB)\fR
-.VE
.sp
int
\fBTk_GetScreenMM(\fIinterp, tkwin, string, doublePtr\fB)\fR
@@ -36,14 +32,12 @@ Interpreter to use for error reporting.
.AP Tk_Window tkwin in
Window whose screen geometry determines the conversion between absolute
units and pixels.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
String value specifies a distance on the screen;
internal rep will be modified to cache converted distance.
-.AP "CONST char" *string in
+.AP "const char" *string in
Same as \fIobjPtr\fR except specification of distance is passed as
a string.
-.VE
.AP int *intPtr out
Pointer to location in which to store converted distance in pixels.
.AP double *doublePtr out
@@ -53,14 +47,10 @@ Pointer to location in which to store converted distance in millimeters.
.SH DESCRIPTION
.PP
These procedures take as argument a specification of distance on
-.VS 8.1
the screen (\fIobjPtr\fR or \fIstring\fR) and compute the
-.VE
corresponding distance either in integer pixels or floating-point millimeters.
In either case,
-.VS 8.1
\fIobjPtr\fR or \fIstring\fR
-.VE
specifies a screen distance as a
floating-point number followed by one of the following characters
that indicates units:
@@ -81,14 +71,13 @@ The number specifies a distance in millimeters on the screen.
The number specifies a distance in printer's points (1/72 inch)
on the screen.
.PP
-.VS 8.1
\fBTk_GetPixelsFromObj\fR converts the value of \fIobjPtr\fR to the
nearest even number of pixels and stores that value at \fI*intPtr\fR.
It returns \fBTCL_OK\fR under normal circumstances.
If an error occurs (e.g. \fIobjPtr\fR contains a number followed
-by a character that isn't one of the ones above) then
+by a character that is not one of the ones above) then
\fBTCL_ERROR\fR is returned and an error message is left
-in \fIinterp\fR's result if \fIinterp\fR isn't NULL.
+in \fIinterp\fR's result if \fIinterp\fR is not NULL.
\fBTk_GetPixelsFromObj\fR caches information about the return
value in \fIobjPtr\fR, which speeds up future calls to
\fBTk_GetPixelsFromObj\fR with the same \fIobjPtr\fR.
@@ -103,7 +92,6 @@ return value, so \fBTk_GetAnchor\fR is less efficient than
\fBTk_GetPixelsFromObj\fR and \fBTk_GetPixels\fR (respectively) except
that they convert the screen distance to millimeters and
store a double-precision floating-point result at \fI*doublePtr\fR.
-.VE
.SH KEYWORDS
centimeters, convert, inches, millimeters, pixels, points, screen units
diff --git a/doc/GetRelief.3 b/doc/GetRelief.3
index 209fb67..b97a615 100644
--- a/doc/GetRelief.3
+++ b/doc/GetRelief.3
@@ -14,52 +14,53 @@ Tk_GetReliefFromObj, Tk_GetRelief, Tk_NameOfRelief \- translate between strings
.nf
\fB#include <tk.h>\fR
.sp
-.VS 8.1
int
\fBTk_GetReliefFromObj(\fIinterp, objPtr, reliefPtr\fB)\fR
-.VE
.sp
int
\fBTk_GetRelief(\fIinterp, name, reliefPtr\fB)\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfRelief(\fIrelief\fB)\fR
.SH ARGUMENTS
.AS "Tcl_Interp" *reliefPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
-.VS 8.1 br
.AP Tcl_Obj *objPtr in/out
-String value contains name of relief (one of \fBflat\fR, \fBgroove\fR,
-\fBraised\fR, \fBridge\fR, \fBsolid\fR, or \fBsunken\fR);
-internal rep will be modified to cache corresponding relief value.
+String value contains name of relief, one of
+.QW flat ,
+.QW groove ,
+.QW raised ,
+.QW ridge ,
+.QW solid ,
+or
+.QW sunken ;
+the internal rep will be modified to cache corresponding relief value.
.AP char *string in
Same as \fIobjPtr\fR except description of relief is passed as
a string.
-.VE
.AP int *reliefPtr out
Pointer to location in which to store relief value corresponding to
\fIobjPtr\fR or \fIname\fR.
-.AP "CONST char" *name
+.AP "const char" *name
Name of the relief.
.AP int relief in
-Relief value (one of TK_RELIEF_FLAT, TK_RELIEF_RAISED, TK_RELIEF_SUNKEN,
-TK_RELIEF_GROOVE, TK_RELIEF_SOLID, or TK_RELIEF_RIDGE).
+Relief value (one of \fBTK_RELIEF_FLAT\fR, \fBTK_RELIEF_RAISED\fR,
+\fBTK_RELIEF_SUNKEN\fR, \fBTK_RELIEF_GROOVE\fR, \fBTK_RELIEF_SOLID\fR,
+or \fBTK_RELIEF_RIDGE\fR).
.BE
-
.SH DESCRIPTION
.PP
-.VS 8.1
\fBTk_GetReliefFromObj\fR places in \fI*reliefPtr\fR the relief value
corresponding to the value of \fIobjPtr\fR. This value will be one of
-TK_RELIEF_FLAT, TK_RELIEF_RAISED, TK_RELIEF_SUNKEN,
-TK_RELIEF_GROOVE, TK_RELIEF_SOLID, or TK_RELIEF_RIDGE.
-Under normal circumstances the return value is TCL_OK and
+\fBTK_RELIEF_FLAT\fR, \fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR,
+\fBTK_RELIEF_GROOVE\fR, \fBTK_RELIEF_SOLID\fR, or \fBTK_RELIEF_RIDGE\fR.
+Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
-If \fIobjPtr\fR doesn't contain one of the valid relief names
-or an abbreviation of one of them, then TCL_ERROR is returned,
+If \fIobjPtr\fR does not contain one of the valid relief names
+or an abbreviation of one of them, then \fBTCL_ERROR\fR is returned,
\fI*reliefPtr\fR is unmodified, and an error message
-is stored in \fIinterp\fR's result if \fIinterp\fR isn't NULL.
+is stored in \fIinterp\fR's result if \fIinterp\fR is not NULL.
\fBTk_GetReliefFromObj\fR caches information about the return
value in \fIobjPtr\fR, which speeds up future calls to
\fBTk_GetReliefFromObj\fR with the same \fIobjPtr\fR.
@@ -69,13 +70,12 @@ that the description of the relief is specified with a string instead
of an object. This prevents \fBTk_GetRelief\fR from caching the
return value, so \fBTk_GetRelief\fR is less efficient than
\fBTk_GetReliefFromObj\fR.
-.VE
.PP
\fBTk_NameOfRelief\fR is the logical inverse of \fBTk_GetRelief\fR.
Given a relief value it returns the corresponding string (\fBflat\fR,
\fBraised\fR, \fBsunken\fR, \fBgroove\fR, \fBsolid\fR, or \fBridge\fR).
-If \fIrelief\fR isn't a legal relief value, then ``unknown relief''
+If \fIrelief\fR is not a legal relief value, then
+.QW "unknown relief"
is returned.
-
.SH KEYWORDS
name, relief, string
diff --git a/doc/GetRootCrd.3 b/doc/GetRootCrd.3
index 48d4d70..7c46b5f 100644
--- a/doc/GetRootCrd.3
+++ b/doc/GetRootCrd.3
@@ -26,7 +26,6 @@ corresponding to left edge of \fItkwin\fR's border.
Pointer to location in which to store root-window y-coordinate
corresponding to top edge of \fItkwin\fR's border.
.BE
-
.SH DESCRIPTION
.PP
This procedure scans through the structural information maintained
@@ -34,8 +33,7 @@ by Tk to compute the root-window coordinates corresponding to
the upper-left corner of \fItkwin\fR's border. If \fItkwin\fR has
no border, then \fBTk_GetRootCoords\fR returns the root-window
coordinates corresponding to location (0,0) in \fItkwin\fR.
-\fBTk_GetRootCoords\fR is relatively efficient, since it doesn't have to
+\fBTk_GetRootCoords\fR is relatively efficient, since it does not have to
communicate with the X server.
-
.SH KEYWORDS
coordinates, root window
diff --git a/doc/GetScroll.3 b/doc/GetScroll.3
index 6ac19ce..43fbab8 100644
--- a/doc/GetScroll.3
+++ b/doc/GetScroll.3
@@ -25,13 +25,13 @@ int
Interpreter to use for error reporting.
.AP int argc in
Number of strings in \fIargv\fR array.
-.AP "CONST char" *argv[] in
+.AP "const char" *argv[] in
Argument strings. These represent the entire widget command, of
which the first word is typically the widget name and the second
word is typically \fBxview\fR or \fByview\fR.
.AP int objc in
Number of Tcl_Obj's in \fIobjv\fR array.
-.AP "Tcl_Obj *CONST" objv[] in
+.AP "Tcl_Obj *const" objv[] in
Argument objects. These represent the entire widget command, of
which the first word is typically the widget name and the second
word is typically \fBxview\fR or \fByview\fR.
diff --git a/doc/GetSelect.3 b/doc/GetSelect.3
index a747869..4f8fa8d 100644
--- a/doc/GetSelect.3
+++ b/doc/GetSelect.3
@@ -44,9 +44,9 @@ should have arguments and result that match the type
\fBTk_GetSelProc\fR:
.CS
typedef int Tk_GetSelProc(
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- char *\fIportion\fR);
+ ClientData \fIclientData\fR,
+ Tcl_Interp *\fIinterp\fR,
+ char *\fIportion\fR);
.CE
The \fIclientData\fR and \fIinterp\fR parameters to \fIproc\fR
will be copies of the corresponding arguments to
@@ -65,13 +65,13 @@ values separated by white space.
.PP
\fBTk_GetSelection\fR returns to its caller when the selection has
been completely retrieved and processed by \fIproc\fR, or when a
-fatal error has occurred (e.g. the selection owner didn't respond
-promptly). \fBTk_GetSelection\fR normally returns TCL_OK; if
-an error occurs, it returns TCL_ERROR and leaves an error message
+fatal error has occurred (e.g. the selection owner did not respond
+promptly). \fBTk_GetSelection\fR normally returns \fBTCL_OK\fR; if
+an error occurs, it returns \fBTCL_ERROR\fR and leaves an error message
in \fIinterp->result\fR. \fIProc\fR should also return either
-TCL_OK or TCL_ERROR. If \fIproc\fR encounters an error in dealing with the
+\fBTCL_OK\fR or \fBTCL_ERROR\fR. If \fIproc\fR encounters an error in dealing with the
selection, it should leave an error message in \fIinterp->result\fR
-and return TCL_ERROR; this will abort the selection retrieval.
+and return \fBTCL_ERROR\fR; this will abort the selection retrieval.
.SH KEYWORDS
format, get, selection retrieval
diff --git a/doc/GetUid.3 b/doc/GetUid.3
index 8865fc7..32d4cbf 100644
--- a/doc/GetUid.3
+++ b/doc/GetUid.3
@@ -29,7 +29,8 @@ to \fIstring\fR.
Unique identifiers are similar to atoms in Lisp, and are used
in Tk to speed up comparisons and
searches. A unique identifier (type Tk_Uid) is a string pointer
-and may be used anywhere that a variable of type ``char *''
+and may be used anywhere that a variable of type
+.QW "char *"
could be used. However, there is guaranteed to be exactly
one unique identifier for any given string value. If \fBTk_GetUid\fR
is called twice, once with string \fIa\fR and once with string
diff --git a/doc/GetVRoot.3 b/doc/GetVRoot.3
index 84e3299..d95f3ee 100644
--- a/doc/GetVRoot.3
+++ b/doc/GetVRoot.3
@@ -31,15 +31,16 @@ Points to word in which to store height of virtual root.
.SH DESCRIPTION
.PP
-\fBTkGetVRootGeometry\fR returns geometry information about the virtual
-root window associated with \fItkwin\fR. The ``associated'' virtual
-root is the one in which \fItkwin\fR's nearest top-level ancestor (or
+\fBTk_GetVRootGeometry\fR returns geometry information about the virtual
+root window associated with \fItkwin\fR. The
+.QW associated
+virtual root is the one in which \fItkwin\fR's nearest top-level ancestor (or
\fItkwin\fR itself if it is a top-level window) has
been reparented by the window manager. This window is identified by
a \fB__SWM_ROOT\fR or \fB__WM_ROOT\fR property placed on the top-level
window by the window manager.
If \fItkwin\fR is not associated with a virtual root (e.g.
-because the window manager doesn't use virtual roots) then *\fIxPtr\fR and
+because the window manager does not use virtual roots) then *\fIxPtr\fR and
*\fIyPtr\fR will be set to 0 and *\fIwidthPtr\fR and *\fIheightPtr\fR
will be set to the dimensions of the screen containing \fItkwin\fR.
diff --git a/doc/GetVisual.3 b/doc/GetVisual.3
index 01f87ba..2796660 100644
--- a/doc/GetVisual.3
+++ b/doc/GetVisual.3
@@ -22,7 +22,7 @@ Visual *
Interpreter to use for error reporting.
.AP Tk_Window tkwin in
Token for window in which the visual will be used.
-.AP "CONST char" *string in
+.AP "const char" *string in
String that identifies the desired visual. See below for
valid formats.
.AP int *depthPtr out
@@ -31,7 +31,6 @@ Depth of returned visual gets stored here.
If non-NULL then a suitable colormap for visual is found and its
identifier is stored here.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetVisual\fR takes a string description of a visual and
@@ -74,23 +73,28 @@ as \fItkwin\fR.
Use the visual whose X identifier is \fInumber\fR.
.TP 15
\fBbest\fR ?\fIdepth\fR?
-Choose the ``best possible'' visual, using the following rules, in
-decreasing order of priority:
-(a) a visual that has exactly the desired depth is best, followed
+Choose the
+.QW "best possible"
+visual, using the following rules, in decreasing order of priority:
+.RS
+.IP (a)
+a visual that has exactly the desired depth is best, followed
by a visual with greater depth than requested (but as little extra
as possible), followed by a visual with less depth than requested
(but as great a depth as possible);
-(b) if no \fIdepth\fR is specified, then the deepest available visual
+.IP (b)
+if no \fIdepth\fR is specified, then the deepest available visual
is chosen;
-(c) \fBpseudocolor\fR is better than \fBtruecolor\fR or \fBdirectcolor\fR,
+.IP (c)
+\fBpseudocolor\fR is better than \fBtruecolor\fR or \fBdirectcolor\fR,
which are better than \fBstaticcolor\fR, which is better than
\fBstaticgray\fR or \fBgrayscale\fR;
-(d) the default visual for the screen is better than any other visual.
-
+.IP (d)
+the default visual for the screen is better than any other visual.
+.RE
.SH CREDITS
.PP
The idea for \fBTk_GetVisual\fR, and the first implementation, came
from Paul Mackerras.
-
.SH KEYWORDS
colormap, screen, visual
diff --git a/doc/Grab.3 b/doc/Grab.3
index 48605e5..6bf1b69 100644
--- a/doc/Grab.3
+++ b/doc/Grab.3
@@ -45,8 +45,8 @@ keyboard events intended for a windows within the same application
specifies the window on whose behalf the pointer is to be grabbed.
\fIGrabGlobal\fR indicates whether the grab should be global or
application local; if it is non-zero, it means the grab should be
-global. Normally, \fBTk_Grab\fR returns TCL_OK; if an error occurs
-and the grab cannot be set, TCL_ERROR is returned and an error message
+global. Normally, \fBTk_Grab\fR returns \fBTCL_OK\fR; if an error occurs
+and the grab cannot be set, \fBTCL_ERROR\fR is returned and an error message
is left if \fIinterp\fR's result. Once this call completes
successfully, no window outside the tree rooted at \fItkwin\fR will
receive pointer- or keyboard-related events until the next call to
diff --git a/doc/HandleEvent.3 b/doc/HandleEvent.3
index 7909274..4d24c14 100644
--- a/doc/HandleEvent.3
+++ b/doc/HandleEvent.3
@@ -18,14 +18,15 @@ Tk_HandleEvent \- invoke event handlers for window system events
.SH ARGUMENTS
.AS XEvent *eventPtr
.AP XEvent *eventPtr in
-Pointer to X event to dispatch to relevant handler(s).
+Pointer to X event to dispatch to relevant handler(s). It is important
+that all unused fields of the structure be set to zero.
.BE
.SH DESCRIPTION
.PP
\fBTk_HandleEvent\fR is a lower-level procedure that deals with window
events. It is called by \fBTcl_ServiceEvent\fR (and indirectly by
-\fBTk_DoOneEvent\fR), and in a few other cases within Tk.
+\fBTcl_DoOneEvent\fR), and in a few other cases within Tk.
It makes callbacks to any window event
handlers (created by calls to \fBTk_CreateEventHandler\fR)
that match \fIeventPtr\fR and then returns. In some cases
diff --git a/doc/Inactive.3 b/doc/Inactive.3
new file mode 100644
index 0000000..8f37553
--- /dev/null
+++ b/doc/Inactive.3
@@ -0,0 +1,36 @@
+'\"
+'\" Copyright (c) 1998-2000 by Scriptics Corporation.
+'\" All rights reserved.
+'\"
+.so man.macros
+.TH Tk_GetUserInactiveTime 3 8.5 Tk "Tk Library Procedures"
+.BS
+.SH NAME
+Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime \- discover user inactivity time
+.SH SYNOPSIS
+.nf
+\fB#include <tk.h>\fR
+.sp
+long
+\fBTk_GetUserInactiveTime(\fIdisplay\fB)\fR
+.sp
+\fBTk_GetUserInactiveTime(\fIdisplay\fB)\fR
+.SH ARGUMENTS
+.AS Display *display
+.AP Display *display in
+The display on which the user inactivity timer is to be queried or
+reset.
+.BE
+
+.SH DESCRIPTION
+.PP
+\fBTk_GetUserInactiveTime\fR returns the number of milliseconds that
+have passed since the last user interaction (usually via keyboard or
+mouse) with the respective display. On systems and displays that do not
+support querying the user inactiviy time, \fB\-1\fR is returned.
+\fBTk_GetUserInactiveTime\fR resets the user inactivity timer of the
+given display to zero. On windowing systems that do not support
+multiple displays \fIdisplay\fR can be passed as \fBNULL\fR.
+
+.SH KEYWORDS
+idle, inactive
diff --git a/doc/InternAtom.3 b/doc/InternAtom.3
index 79b3869..a4ca96c 100644
--- a/doc/InternAtom.3
+++ b/doc/InternAtom.3
@@ -17,13 +17,13 @@ Tk_InternAtom, Tk_GetAtomName \- manage cache of X atoms
Atom
\fBTk_InternAtom(\fItkwin, name\fR)
.sp
-CONST char *
+const char *
\fBTk_GetAtomName(\fItkwin, atom\fR)
.SH ARGUMENTS
.AS Tk_Window parent
.AP Tk_Window tkwin in
Token for window. Used to map atom or name relative to a particular display.
-.AP "CONST char" *name in
+.AP "const char" *name in
String name for which atom is desired.
.AP Atom atom in
Atom for which corresponding string name is desired.
@@ -42,7 +42,8 @@ by \fBTk_GetAtomName\fR is in Tk's storage: the caller need
not free this space when finished with the string, and the caller
should not modify the contents of the returned string.
If there is no atom \fIatom\fR on \fItkwin\fR's display,
-then \fBTk_GetAtomName\fR returns the string ``?bad atom?''.
+then \fBTk_GetAtomName\fR returns the string
+.QW "?bad atom?" .
.PP
Tk caches
the information returned by \fBTk_InternAtom\fR and \fBTk_GetAtomName\fR
diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3
index d34e22e..c96a646 100644
--- a/doc/MaintGeom.3
+++ b/doc/MaintGeom.3
@@ -62,7 +62,7 @@ is unmapped, the slave is automatically removed by the screen
by X.
.PP
\fBTk_MaintainGeometry\fR deals with these problems for slaves
-whose masters aren't their parents, as well as handling the simpler
+whose masters are not their parents, as well as handling the simpler
case of slaves whose masters are their parents.
\fBTk_MaintainGeometry\fR is typically called by a window manager
once it has decided where a slave should be positioned relative
@@ -95,7 +95,6 @@ If \fBTk_MaintainGeometry\fR is called repeatedly for the same
\fImaster\fR\-\fIslave\fR pair, the information from the most
recent call supersedes any older information.
If \fBTk_UnmaintainGeometry\fR is called for a \fImaster\fR\-\fIslave\fR
-pair that is isn't currently managed, the call has no effect.
-
+pair that is is not currently managed, the call has no effect.
.SH KEYWORDS
geometry manager, map, master, parent, position, slave, unmap
diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3
index 0ceff3a..5dcf688 100644
--- a/doc/ManageGeom.3
+++ b/doc/ManageGeom.3
@@ -19,16 +19,15 @@ Tk_ManageGeometry \- arrange to handle geometry requests for a window
.AS Tk_GeometryProc clientData
.AP Tk_Window tkwin in
Token for window to be managed.
-.AP Tk_GeomMgr *mgrPtr in
+.AP "const Tk_GeomMgr" *mgrPtr in
Pointer to data structure containing information about the
geometry manager, or NULL to indicate that \fItkwin\fR's geometry
-shouldn't be managed anymore.
+should not be managed anymore.
The data structure pointed to by \fImgrPtr\fR must be static:
Tk keeps a reference to it as long as the window is managed.
.AP ClientData clientData in
Arbitrary one-word value to pass to geometry manager callbacks.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_ManageGeometry\fR arranges for a particular geometry manager,
@@ -43,9 +42,9 @@ The structure pointed to by \fImgrPtr\fR contains information about
the geometry manager:
.CS
typedef struct {
- char *\fIname\fR;
- Tk_GeomRequestProc *\fIrequestProc\fR;
- Tk_GeomLostSlaveProc *\fIlostSlaveProc\fR;
+ const char *\fIname\fR;
+ Tk_GeomRequestProc *\fIrequestProc\fR;
+ Tk_GeomLostSlaveProc *\fIlostSlaveProc\fR;
} Tk_GeomMgr;
.CE
The \fIname\fR field is the textual name for the geometry manager,
@@ -59,8 +58,8 @@ slave to change its desired geometry.
type \fBTk_GeomRequestProc\fR:
.CS
typedef void Tk_GeomRequestProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR);
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR);
.CE
The parameters to \fIrequestProc\fR will be identical to the
corresponding parameters passed to \fBTk_ManageGeometry\fR.
@@ -82,8 +81,8 @@ is the same as the window's current geometry manager.
arguments and results that match the following prototype:
.CS
typedef void Tk_GeomLostSlaveProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR);
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR);
.CE
The parameters to \fIlostSlaveProc\fR will be identical to the
corresponding parameters passed to \fBTk_ManageGeometry\fR.
diff --git a/doc/MapWindow.3 b/doc/MapWindow.3
index bf54dea..25d7ff5 100644
--- a/doc/MapWindow.3
+++ b/doc/MapWindow.3
@@ -29,7 +29,7 @@ Token for window.
These procedures may be used to map and unmap windows
managed by Tk. \fBTk_MapWindow\fR maps the window given
by \fItkwin\fR, and also creates an X window corresponding
-to \fItkwin\fR if it doesn't already exist. See the
+to \fItkwin\fR if it does not already exist. See the
\fBTk_CreateWindow\fR manual entry for information on
deferred window creation.
\fBTk_UnmapWindow\fR unmaps \fItkwin\fR's window
@@ -37,7 +37,7 @@ from the screen.
.PP
If \fItkwin\fR is a child window (i.e. \fBTk_CreateWindow\fR was
used to create a child window), then event handlers interested in map
-and unmap events are invoked immediately. If \fItkwin\fR isn't an
+and unmap events are invoked immediately. If \fItkwin\fR is not an
internal window, then the event handlers will be invoked later, after
X has seen the request and returned an event for it.
.PP
diff --git a/doc/MeasureChar.3 b/doc/MeasureChar.3
index 059d8e8..c8164f3 100644
--- a/doc/MeasureChar.3
+++ b/doc/MeasureChar.3
@@ -19,10 +19,8 @@ int
int
\fBTk_TextWidth(\fItkfont, string, numBytes\fB)\fR
.sp
-void
\fBTk_DrawChars(\fIdisplay, drawable, gc, tkfont, string, numBytes, x, y\fB)\fR
.sp
-void
\fBTk_UnderlineChars(\fIdisplay, drawable, gc, tkfont, string, x, y, firstByte, lastByte\fB)\fR
.sp
.SH ARGUMENTS
@@ -35,24 +33,22 @@ Text to be measured or displayed. Need not be null terminated. Any
non-printing meta-characters in the string (such as tabs, newlines, and
other control characters) will be measured or displayed in a
platform-dependent manner.
-.VS 8.1
.AP int numBytes in
The maximum number of bytes to consider when measuring or drawing
\fIstring\fR. Must be greater than or equal to 0.
-.VE 8.1
.AP int maxPixels in
If \fImaxPixels\fR is >= 0, it specifies the longest permissible
line length in pixels. Characters from \fIstring\fR are processed only
until this many pixels have been covered. If \fImaxPixels\fR is < 0, then
the line length is unbounded and the \fIflags\fR argument is ignored.
.AP int flags in
-Various flag bits OR-ed together: TK_PARTIAL_OK means include a character
+Various flag bits OR-ed together: \fBTK_PARTIAL_OK\fR means include a character
as long as any part of it fits in the length given by \fImaxPixels\fR;
otherwise, a character must fit completely to be considered.
-TK_WHOLE_WORDS means stop on a word boundary, if possible. If
-TK_AT_LEAST_ONE is set, it means return at least one character even if no
+\fBTK_WHOLE_WORDS\fR means stop on a word boundary, if possible. If
+\fBTK_AT_LEAST_ONE\fR is set, it means return at least one character even if no
characters could fit in the length given by \fImaxPixels\fR. If
-TK_AT_LEAST_ONE is set and TK_WHOLE_WORDS is also set, it means that if
+\fBTK_AT_LEAST_ONE\fR is set and \fBTK_WHOLE_WORDS\fR is also set, it means that if
not even one word fits on the line, return the first few letters of the
word that did fit; if not even one letter of the word fit, then the first
letter will still be returned.
@@ -69,7 +65,6 @@ must be the same as the \fItkfont\fR.
.AP int "x, y" in
Coordinates at which to place the left edge of the baseline when displaying
\fIstring\fR.
-.VS 8.1
.AP int firstByte in
The index of the first byte of the first character to underline in the
\fIstring\fR. Underlining begins at the left edge of this character.
@@ -77,23 +72,19 @@ The index of the first byte of the first character to underline in the
The index of the first byte of the last character up to which the
underline will be drawn. The character specified by \fIlastByte\fR
will not itself be underlined.
-.VE 8.1
.BE
-
.SH DESCRIPTION
.PP
These routines are for measuring and displaying simple single-font,
-single-line, strings. To measure and display single-font, multi-line,
+single-line strings. To measure and display single-font, multi-line,
justified text, refer to the documentation for \fBTk_ComputeTextLayout\fR.
There is no programming interface in the core of Tk that supports
multi-font, multi-line text; support for that behavior must be built on
top of simpler layers.
-.VS 8.1
Note that the interfaces described here are
byte-oriented not character-oriented, so index values coming from Tcl
scripts need to be converted to byte offsets using the
\fBTcl_UtfAtIndex\fR and related routines.
-.VE 8.1
.PP
A glyph is the displayable picture of a letter, number, or some other
symbol. Not all character codes in a given font have a glyph.
@@ -125,11 +116,12 @@ space in pixels the given \fIstring\fR needs.
given \fIdrawable\fR.
.PP
\fBTk_UnderlineChars\fR underlines the given range of characters in the
-given \fIstring\fR. It doesn't draw the characters (which are assumed to
+given \fIstring\fR. It does not draw the characters (which are assumed to
have been displayed previously by \fBTk_DrawChars\fR); it just draws the
underline. This procedure is used to underline a few characters without
having to construct an underlined font. To produce natively underlined
text, the appropriate underlined font should be constructed and used.
-
+.SH "SEE ALSO"
+font(n), FontId(3)
.SH KEYWORDS
-font
+font, measurement
diff --git a/doc/MoveToplev.3 b/doc/MoveToplev.3
index 88accaf..24653ab 100644
--- a/doc/MoveToplev.3
+++ b/doc/MoveToplev.3
@@ -44,7 +44,7 @@ similar in function to the \fBwm geometry\fR Tcl command except that
negative offsets cannot be specified. It is invoked by widgets such as
menus that want to appear at a particular place on the screen.
.PP
-When \fBTk_MoveToplevelWindow\fR is called it doesn't immediately
+When \fBTk_MoveToplevelWindow\fR is called it does not immediately
pass on the new desired location to the window manager; it defers
this action until all other outstanding work has been completed,
using the \fBTk_DoWhenIdle\fR mechanism.
diff --git a/doc/Name.3 b/doc/Name.3
index 4497ea6..73b09b1 100644
--- a/doc/Name.3
+++ b/doc/Name.3
@@ -28,7 +28,7 @@ Tk_Window
Token for window.
.AP Tcl_Interp *interp out
Interpreter to use for error reporting.
-.AP "CONST char" *pathName in
+.AP "const char" *pathName in
Character string containing path name of window.
.BE
@@ -53,9 +53,17 @@ The \fBTk_PathName\fR macro returns a
hierarchical name for \fItkwin\fR.
Path names have a structure similar to file names in Unix but with
dots between elements instead of slashes: the main window for
-an application has the path name ``.''; its children have names like
-``.a'' and ``.b''; their children have names like ``.a.aa'' and
-``.b.bb''; and so on. A window is considered to be be a child of
+an application has the path name
+.QW . ;
+its children have names like
+.QW .a
+and
+.QW .b ;
+their children have names like
+.QW .a.aa
+and
+.QW .b.bb ;
+and so on. A window is considered to be a child of
another window for naming purposes if the second window was named
as the first window's \fIparent\fR when the first window was created.
This is not always the same as the X window hierarchy. For
diff --git a/doc/NameOfImg.3 b/doc/NameOfImg.3
index 3e05a14..a1a69a8 100644
--- a/doc/NameOfImg.3
+++ b/doc/NameOfImg.3
@@ -13,7 +13,7 @@ Tk_NameOfImage \- Return name of image.
.nf
\fB#include <tk.h>\fR
.sp
-CONST char *
+const char *
\fBTk_NameOfImage\fR(\fItypePtr\fR)
.SH ARGUMENTS
.AS Tk_ImageMaster *masterPtr
diff --git a/doc/ParseArgv.3 b/doc/ParseArgv.3
index 07c7551..b7592b7 100644
--- a/doc/ParseArgv.3
+++ b/doc/ParseArgv.3
@@ -26,17 +26,18 @@ no Tk options will be processed.
.AP int argcPtr in/out
Pointer to number of arguments in argv; gets modified to hold
number of unprocessed arguments that remain after the call.
-.AP "CONST char" **argv in/out
+.AP "const char" **argv in/out
Command line arguments passed to main program. Modified to
hold unprocessed arguments that remain after the call.
.AP Tk_ArgvInfo *argTable in
Array of argument descriptors, terminated by element with
-type TK_ARGV_END.
+type \fBTK_ARGV_END\fR.
.AP int flags in
If non-zero, then it specifies one or more flags that control the
parsing of arguments. Different flags may be OR'ed together.
-The flags currently defined are TK_ARGV_DONT_SKIP_FIRST_ARG,
-TK_ARGV_NO_ABBREV, TK_ARGV_NO_LEFTOVERS, and TK_ARGV_NO_DEFAULTS.
+The flags currently defined are \fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR,
+\fBTK_ARGV_NO_ABBREV\fR, \fBTK_ARGV_NO_LEFTOVERS\fR, and
+\fBTK_ARGV_NO_DEFAULTS\fR.
.BE
.SH DESCRIPTION
.PP
@@ -52,13 +53,13 @@ the caller. At the end of the call
arguments that are left in \fIargv\fR, and \fIargv[*argcPtr]\fR
will hold the value NULL. Normally, \fBTk_ParseArgv\fR
assumes that \fIargv[0]\fR is a command name, so it is treated like
-an argument that doesn't match \fIargTable\fR and returned to the
-caller; however, if the TK_ARGV_DONT_SKIP_FIRST_ARG bit is set in
+an argument that does not match \fIargTable\fR and returned to the
+caller; however, if the \fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR bit is set in
\fIflags\fR then \fIargv[0]\fR will be processed just like the other
elements of \fIargv\fR.
.PP
-\fBTk_ParseArgv\fR normally returns the value TCL_OK. If an error
-occurs while parsing the arguments, then TCL_ERROR is returned and
+\fBTk_ParseArgv\fR normally returns the value \fBTCL_OK\fR. If an error
+occurs while parsing the arguments, then \fBTCL_ERROR\fR is returned and
\fBTk_ParseArgv\fR will leave an error message in \fIinterp->result\fR
in the standard Tcl fashion. In
the event of an error return, \fI*argvPtr\fR will not have been
@@ -69,14 +70,17 @@ The \fIargTable\fR array specifies the kinds of arguments that are
expected; each of its entries has the following structure:
.CS
typedef struct {
- char *\fIkey\fR;
- int \fItype\fR;
- char *\fIsrc\fR;
- char *\fIdst\fR;
- char *\fIhelp\fR;
+ char *\fIkey\fR;
+ int \fItype\fR;
+ char *\fIsrc\fR;
+ char *\fIdst\fR;
+ char *\fIhelp\fR;
} Tk_ArgvInfo;
.CE
-The \fIkey\fR field is a string such as ``\-display'' or ``\-bg''
+The \fIkey\fR field is a string such as
+.QW \-display
+or
+.QW \-bg
that is compared with the values in \fIargv\fR. \fIType\fR
indicates how to process an argument that matches \fIkey\fR
(more on this below). \fISrc\fR and \fIdst\fR are additional
@@ -101,11 +105,13 @@ skipped and returned to the caller.
.PP
Once a matching argument specifier is found, \fBTk_ParseArgv\fR
processes the argument according to the \fItype\fR field of the
-specifier. The argument that matched \fIkey\fR is called ``the matching
-argument'' in the descriptions below. As part of the processing,
+specifier. The argument that matched \fIkey\fR is called
+.QW "the matching argument"
+in the descriptions below. As part of the processing,
\fBTk_ParseArgv\fR may also use the next argument in \fIargv\fR
-after the matching argument, which is called ``the following
-argument''. The legal values for \fItype\fR, and the processing
+after the matching argument, which is called
+.QW "the following argument" .
+The legal values for \fItype\fR, and the processing
that they cause, are as follows:
.TP
\fBTK_ARGV_END\fR
@@ -120,8 +126,11 @@ The matching argument is discarded.
.TP
\fBTK_ARGV_INT\fR
The following argument must contain an
-integer string in the format accepted by \fBstrtol\fR (e.g. ``0''
-and ``0x'' prefixes may be used to specify octal or hexadecimal
+integer string in the format accepted by \fBstrtol\fR (e.g.
+.QW 0
+and
+.QW 0x
+prefixes may be used to specify octal or hexadecimal
numbers, respectively). \fIDst\fR is treated as a pointer to an
integer; the following argument is converted to an integer value
and stored at \fI*dst\fR. \fISrc\fR is ignored. The matching
@@ -130,7 +139,7 @@ and following arguments are discarded from \fIargv\fR.
\fBTK_ARGV_FLOAT\fR
The following argument must contain a floating-point number in
the format accepted by \fBstrtol\fR.
-\fIDst\fR is treated as the address of an double-precision
+\fIDst\fR is treated as the address of a double-precision
floating point value; the following argument is converted to a
double-precision value and stored at \fI*dst\fR. The matching
and following arguments are discarded from \fIargv\fR.
@@ -142,7 +151,7 @@ argument, and discards the matching and following arguments from
\fIargv\fR. \fISrc\fR is ignored.
.TP
\fBTK_ARGV_UID\fR
-This form is similar to TK_ARGV_STRING, except that the argument
+This form is similar to \fBTK_ARGV_STRING\fR, except that the argument
is turned into a Tk_Uid by calling \fBTk_GetUid\fR.
\fIDst\fR is treated as a pointer to a
Tk_Uid; \fBTk_ParseArgv\fR stores at \fI*dst\fR the Tk_Uid
@@ -159,7 +168,7 @@ argument is discarded. If \fItkwin\fR is NULL, then argument
specifiers of this type are ignored (as if they did not exist).
.TP
\fBTK_ARGV_OPTION_VALUE\fR
-This form is similar to TK_ARGV_CONST_OPTION, except that the
+This form is similar to \fBTK_ARGV_CONST_OPTION\fR, except that the
value of the option is taken from the following argument instead
of from \fIsrc\fR. \fIDst\fR is used as the name of the option.
\fISrc\fR is ignored. The matching and following arguments
@@ -178,18 +187,18 @@ specifiers of this type are ignored (as if they did not exist).
When this kind of option is encountered, \fBTk_ParseArgv\fR uses the
\fIhelp\fR fields of \fIargTable\fR to format a message describing
all the valid arguments. The message is placed in \fIinterp->result\fR
-and \fBTk_ParseArgv\fR returns TCL_ERROR. When this happens, the
+and \fBTk_ParseArgv\fR returns \fBTCL_ERROR\fR. When this happens, the
caller normally prints the help message and aborts. If the \fIkey\fR
-field of a TK_ARGV_HELP specifier is NULL, then the specifier will
+field of a \fBTK_ARGV_HELP\fR specifier is NULL, then the specifier will
never match any arguments; in this case the specifier simply provides
extra documentation, which will be included when some other
-TK_ARGV_HELP entry causes help information to be returned.
+\fBTK_ARGV_HELP\fR entry causes help information to be returned.
.TP
\fBTK_ARGV_REST\fR
This option is used by programs or commands that allow the last
several of their options to be the name and/or options for some
other program. If a \fBTK_ARGV_REST\fR argument is found, then
-\fBTk_ParseArgv\fR doesn't process any
+\fBTk_ParseArgv\fR does not process any
of the remaining arguments; it returns them all at
the beginning of \fIargv\fR (along with any other unprocessed arguments).
In addition, \fBTk_ParseArgv\fR treats \fIdst\fR as the address of an
@@ -206,16 +215,16 @@ The procedure should have the following structure:
.CS
int
\fIfunc\fR(\fIdst\fR, \fIkey\fR, \fInextArg\fR)
- char *\fIdst\fR;
- char *\fIkey\fR;
- char *\fInextArg\fR;
+ char *\fIdst\fR;
+ char *\fIkey\fR;
+ char *\fInextArg\fR;
{
}
.CE
The \fIdst\fR and \fIkey\fR parameters will contain the
corresponding fields from the \fIargTable\fR entry, and
\fInextArg\fR will point to the following argument from \fIargv\fR
-(or NULL if there aren't any more arguments left in \fIargv\fR).
+(or NULL if there are not any more arguments left in \fIargv\fR).
If \fIfunc\fR uses \fInextArg\fR (so that
\fBTk_ParseArgv\fR should discard it), then it should return 1. Otherwise it
should return 0 and \fBTkParseArgv\fR will process the following
@@ -232,11 +241,11 @@ form:
.CS
int
\fIgenfunc\fR(dst, interp, key, argc, argv)
- char *\fIdst\fR;
- Tcl_Interp *\fIinterp\fR;
- char *\fIkey\fR;
- int \fIargc\fR;
- char **\fIargv\fR;
+ char *\fIdst\fR;
+ Tcl_Interp *\fIinterp\fR;
+ char *\fIkey\fR;
+ int \fIargc\fR;
+ char **\fIargv\fR;
{
}
.CE
@@ -251,16 +260,15 @@ then return any that are left by compacting them to the beginning of
should return a count of how many arguments are left in \fIargv\fR;
\fBTk_ParseArgv\fR will process them. If \fIgenfunc\fR encounters
an error then it should leave an error message in \fIinterp->result\fR,
-in the usual Tcl fashion, and return -1; when this happens
-\fBTk_ParseArgv\fR will abort its processing and return TCL_ERROR.
+in the usual Tcl fashion, and return \-1; when this happens
+\fBTk_ParseArgv\fR will abort its processing and return \fBTCL_ERROR\fR.
.RE
-
.SH "FLAGS"
.TP
\fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR
\fBTk_ParseArgv\fR normally treats \fIargv[0]\fR as a program
or command name, and returns it to the caller just as if it
-hadn't matched \fIargTable\fR. If this flag is given, then
+had not matched \fIargTable\fR. If this flag is given, then
\fIargv[0]\fR is not given special treatment.
.TP
\fBTK_ARGV_NO_ABBREV\fR
@@ -271,17 +279,16 @@ only exact matches will be acceptable.
\fBTK_ARGV_NO_LEFTOVERS\fR
Normally, \fBTk_ParseArgv\fR returns unrecognized arguments to the
caller. If this bit is set in \fIflags\fR then \fBTk_ParseArgv\fR
-will return an error if it encounters any argument that doesn't
+will return an error if it encounters any argument that does not
match \fIargTable\fR. The only exception to this rule is \fIargv[0]\fR,
which will be returned to the caller with no errors as
-long as TK_ARGV_DONT_SKIP_FIRST_ARG isn't specified.
+long as \fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR is not specified.
.TP
\fBTK_ARGV_NO_DEFAULTS\fR
Normally, \fBTk_ParseArgv\fR searches an internal table of
standard argument specifiers in addition to \fIargTable\fR. If
this bit is set in \fIflags\fR, then \fBTk_ParseArgv\fR will
use only \fIargTable\fR and not its default table.
-
.SH EXAMPLE
.PP
Here is an example definition of an \fIargTable\fR and
@@ -303,32 +310,32 @@ Boolean exec = FALSE;
* Define option descriptions.
*/
Tk_ArgvInfo argTable[] = {
- {"-X", TK_ARGV_CONSTANT, (char *) 1, (char *) &debugFlag,
- "Turn on debugging printfs"},
- {"-N", TK_ARGV_INT, (char *) NULL, (char *) &numReps,
- "Number of repetitions"},
- {"-of", TK_ARGV_STRING, (char *) NULL, (char *) &fileName,
- "Name of file for output"},
- {"x", TK_ARGV_REST, (char *) NULL, (char *) &exec,
- "File to exec, followed by any arguments (must be last argument)."},
- {(char *) NULL, TK_ARGV_END, (char *) NULL, (char *) NULL,
- (char *) NULL}
+ {"\-X", TK_ARGV_CONSTANT, (char *) 1, (char *) &debugFlag,
+ "Turn on debugging printfs"},
+ {"\-N", TK_ARGV_INT, (char *) NULL, (char *) &numReps,
+ "Number of repetitions"},
+ {"\-of", TK_ARGV_STRING, (char *) NULL, (char *) &fileName,
+ "Name of file for output"},
+ {"x", TK_ARGV_REST, (char *) NULL, (char *) &exec,
+ "File to exec, followed by any arguments (must be last argument)."},
+ {(char *) NULL, TK_ARGV_END, (char *) NULL, (char *) NULL,
+ (char *) NULL}
};
main(argc, argv)
- int argc;
- char *argv[];
+ int argc;
+ char *argv[];
{
- \&...
+ \&...
- if (Tk_ParseArgv(interp, tkwin, &argc, argv, argTable, 0) != TCL_OK) {
- fprintf(stderr, "%s\en", interp->result);
- exit(1);
- }
+ if (Tk_ParseArgv(interp, tkwin, &argc, argv, argTable, 0) != TCL_OK) {
+ fprintf(stderr, "%s\en", interp->result);
+ exit(1);
+ }
- /*
- * Remainder of the program.
- */
+ /*
+ * Remainder of the program.
+ */
}
.CE
.PP
@@ -337,13 +344,15 @@ Note that default values can be assigned to variables named in
particular arguments are present in \fIargv\fR.
Here are some example command lines and their effects.
.CS
-prog -N 200 infile # just sets the numReps variable to 200
-prog -of out200 infile # sets fileName to reference "out200"
-prog -XN 10 infile # sets the debug flag, also sets numReps
+prog \-N 200 infile # just sets the numReps variable to 200
+prog \-of out200 infile # sets fileName to reference "out200"
+prog \-XN 10 infile # sets the debug flag, also sets numReps
.CE
In all of the above examples, \fIargc\fR will be set by \fBTk_ParseArgv\fR to 2,
-\fIargv\fR[0] will be ``prog'', \fIargv\fR[1] will be ``infile'',
+\fIargv\fR[0] will be
+.QW prog ,
+\fIargv\fR[1] will be
+.QW infile ,
and \fIargv\fR[2] will be NULL.
-
.SH KEYWORDS
arguments, command line, options
diff --git a/doc/QWinEvent.3 b/doc/QWinEvent.3
index 8bd3099..5eada22 100644
--- a/doc/QWinEvent.3
+++ b/doc/QWinEvent.3
@@ -24,7 +24,8 @@ Display for which to control motion event collapsing.
.AP int collapse in
Indicates whether motion events should be collapsed or not.
.AP XEvent *eventPtr in
-An event to add to the event queue.
+An event to add to the event queue. It is important
+that all unused fields of the structure be set to zero.
.AP Tcl_QueuePosition position in
Where to add the new event in the queue: \fBTCL_QUEUE_TAIL\fR,
\fBTCL_QUEUE_HEAD\fR, or \fBTCL_QUEUE_MARK\fR.
diff --git a/doc/RestrictEv.3 b/doc/RestrictEv.3
index b1cc9b8..da8b822 100644
--- a/doc/RestrictEv.3
+++ b/doc/RestrictEv.3
@@ -41,8 +41,8 @@ is a procedure with arguments and result that match
the type \fBTk_RestrictProc\fR:
.CS
typedef Tk_RestrictAction Tk_RestrictProc(
- ClientData \fIclientData\fR,
- XEvent *\fIeventPtr\fR);
+ ClientData \fIclientData\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fIclientData\fR argument is a copy of the \fIclientData\fR passed
to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with
@@ -68,8 +68,9 @@ bindings with the \fBbind\fR Tcl command or by calling
\fBTk_CreateEventHandler\fR and \fBTk_DeleteEventHandler\fR from C.
The main place where \fBTk_RestrictEvents\fR must be used is when
performing synchronous actions (for example, if you need to wait
-for a particular event to occur on a particular window but you don't
-want to invoke any handlers for any other events). The ``obvious''
+for a particular event to occur on a particular window but you do not
+want to invoke any handlers for any other events). The
+.QW obvious
solution in these situations is to call \fBXNextEvent\fR or
\fBXWindowEvent\fR, but these procedures cannot be used because
Tk keeps its own event queue that is separate from the X event
diff --git a/doc/SetAppName.3 b/doc/SetAppName.3
index ef9b331..b2df656 100644
--- a/doc/SetAppName.3
+++ b/doc/SetAppName.3
@@ -9,19 +9,19 @@
.TH Tk_SetAppName 3 4.0 Tk "Tk Library Procedures"
.BS
.SH NAME
-Tk_SetAppName \- Set the name of an application for ``send'' commands
+Tk_SetAppName \- Set the name of an application for 'send' commands
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
.sp
-CONST char *
+const char *
\fBTk_SetAppName\fR(\fItkwin, name\fR)
.SH ARGUMENTS
.AS Tk_Window parent
.AP Tk_Window tkwin in
Token for window in application. Used only to select a particular
application.
-.AP "CONST char" *name in
+.AP "const char" *name in
Name under which to register the application.
.BE
@@ -35,7 +35,8 @@ display will be able to use the \fBsend\fR command to invoke operations
in the application.
If \fIname\fR is already in use by some other application on the
display, then a new name will be generated by appending
-``\fB #2\fR'' to \fIname\fR; if this name is also in use,
+.QW "\fB #2\fR"
+to \fIname\fR; if this name is also in use,
the number will be incremented until an unused name is found.
The return value from the procedure is a pointer to the name actually
used.
@@ -54,7 +55,7 @@ becomes inaccessible via \fBsend\fR.
The application can be made accessible again by calling \fBTk_SetAppName\fR.
.PP
\fBTk_SetAppName\fR is called automatically by \fBTk_Init\fR,
-so applications don't normally need to call it explicitly.
+so applications do not normally need to call it explicitly.
.PP
The command \fBtk appname\fR provides Tcl-level access to the
functionality of \fBTk_SetAppName\fR.
diff --git a/doc/SetClassProcs.3 b/doc/SetClassProcs.3
index 1ab9a6c..e8820b6 100644
--- a/doc/SetClassProcs.3
+++ b/doc/SetClassProcs.3
@@ -34,10 +34,10 @@ are used as callbacks in different places.
The structure pointed to by \fIprocs\fR contains the following:
.CS
typedef struct Tk_ClassProcs {
- unsigned int \fIsize\fR;
- Tk_ClassWorldChangedProc *\fIworldChangedProc\fR;
- Tk_ClassCreateProc *\fIcreateProc\fR;
- Tk_ClassModalProc *\fImodalProc\fR;
+ unsigned int \fIsize\fR;
+ Tk_ClassWorldChangedProc *\fIworldChangedProc\fR;
+ Tk_ClassCreateProc *\fIcreateProc\fR;
+ Tk_ClassModalProc *\fImodalProc\fR;
} Tk_ClassProcs;
.CE
The \fIsize\fR field is used to simplify future expansion of the
@@ -51,10 +51,10 @@ accordingly. \fIworldChangedProc\fR should have arguments and results
that match the type \fBTk_ClassWorldChangedProc\fR:
.CS
typedef void Tk_ClassWorldChangedProc(
- ClientData \fIinstanceData\fR);
+ ClientData \fIinstanceData\fR);
.CE
The \fIinstanceData\fR parameter passed to the \fIworldChangedProc\fR
-will be identical to the \fIinstanceData\fR paramter passed to
+will be identical to the \fIinstanceData\fR parameter passed to
\fBTk_SetClassProcs\fR.
.PP
\fIcreateProc\fR is used to create platform-dependant windows. It is
@@ -62,9 +62,9 @@ invoked by \fBTk_MakeWindowExist\fR. \fIcreateProc\fR should have
arguments and results that match the type \fBTk_ClassCreateProc\fR:
.CS
typedef Window Tk_ClassCreateProc(
- Tk_Window \fItkwin\fR,
- Window \fIparent\fR,
- ClientData \fIinstanceData\fR);
+ Tk_Window \fItkwin\fR,
+ Window \fIparent\fR,
+ ClientData \fIinstanceData\fR);
.CE
The \fItkwin\fR and \fIinstanceData\fR parameters will be identical to
the \fItkwin\fR and \fIinstanceData\fR parameters passed to
@@ -77,8 +77,8 @@ triggered in order to handle a modal loop. \fImodalProc\fR should
have arguments and results that match the type \fBTk_ClassModalProc\fR:
.CS
typedef void Tk_ClassModalProc(
- Tk_Window \fItkwin\fR,
- XEvent *\fIeventPtr\fR);
+ Tk_Window \fItkwin\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fItkwin\fR parameter to \fImodalProc\fR will be identical to the
\fItkwin\fR parameter passed to \fBTk_SetClassProcs\fR. The
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index f0d5fba..6ce3db0 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -39,13 +39,13 @@ Tcl_Obj *
int
\fBTk_Offset(\fItype, field\fB)\fR
.SH ARGUMENTS
-.AS Tk_SavedOptions "*CONST objv[]" in/out
+.AS Tk_SavedOptions "*const objv[]" in/out
.AP Tcl_Interp *interp in
A Tcl interpreter. Most procedures use this only for returning error
messages; if it is NULL then no error messages are returned. For
\fBTk_CreateOptionTable\fR the value cannot be NULL; it gives the
interpreter in which the option table will be used.
-.AP Tk_OptionSpec *templatePtr in
+.AP "const Tk_OptionSpec" *templatePtr in
Points to an array of static information that describes the configuration
options that are supported. Used to build a Tk_OptionTable. The information
pointed to by this argument must exist for the lifetime of the Tk_OptionTable.
@@ -57,13 +57,13 @@ Points to structure in which values of configuration options are stored;
fields of this record are modified by procedures such as \fBTk_SetOptions\fR
and read by procedures such as \fBTk_GetOptionValue\fR.
.AP Tk_Window tkwin in
-For options such as TK_OPTION_COLOR, this argument indicates
+For options such as \fBTK_OPTION_COLOR\fR, this argument indicates
the window in which the option will be used. If \fIoptionTable\fR uses
no window-dependent options, then a NULL value may be supplied for
this argument.
.AP int objc in
Number of values in \fIobjv\fR.
-.AP Tcl_Obj "*CONST objv[]" in
+.AP Tcl_Obj "*const objv[]" in
Command-line arguments for setting configuring options.
.AP Tk_SavedOptions *savePtr out
If not NULL, the structure pointed to by this argument is filled
@@ -93,15 +93,17 @@ options are supported, these procedures handle all the details of
parsing options and storing their values into a C structure associated
with the widget or object. The procedures were designed primarily for
widgets in Tk, but they can also be used for other kinds of objects that
-have configuration options. In the rest of this manual page ``widget'' will
-be used to refer to the object whose options are being managed; in
-practice the object may not actually be a widget. The term ``widget
-record'' is used to refer to the C-level structure in
+have configuration options. In the rest of this manual page
+.QW widget
+will be used to refer to the object whose options are being managed; in
+practice the object may not actually be a widget. The term
+.QW "widget record"
+is used to refer to the C-level structure in
which information about a particular widget or object is stored.
.PP
Note: the easiest way to learn how to use these procedures is to
look at a working example. In Tk, the simplest example is the code
-that implements the button family of widgets, which is an \fBtkButton.c\fR.
+that implements the button family of widgets, which is in \fBtkButton.c\fR.
Other examples are in \fBtkSquare.c\fR and \fBtkMenu.c\fR.
.PP
In order to use these procedures, the code that implements the widget
@@ -136,10 +138,10 @@ uses the information in the option table to
choose an appropriate default for each option, then it stores the default
value directly into the widget record, overwriting any information that
was already present in the widget record. \fBTk_InitOptions\fR normally
-returns TCL_OK. If an error occurred while setting the default values
-(e.g., because a default value was erroneous) then TCL_ERROR is returned
+returns \fBTCL_OK\fR. If an error occurred while setting the default values
+(e.g., because a default value was erroneous) then \fBTCL_ERROR\fR is returned
and an error message is left in \fIinterp\fR's result if \fIinterp\fR
-isn't NULL.
+is not NULL.
.PP
\fBTk_SetOptions\fR is invoked to modify configuration options based
on information specified in a Tcl command. The command might be one that
@@ -151,13 +153,13 @@ an option and the second object gives the new value for that option.
\fBTk_SetOptions\fR looks up each name in \fIoptionTable\fR, checks that
the new value of the option conforms to the type in \fIoptionTable\fR,
and stores the value of the option into the widget record given by
-\fIrecordPtr\fR. \fBTk_SetOptions\fR normally returns TCL_OK. If
+\fIrecordPtr\fR. \fBTk_SetOptions\fR normally returns \fBTCL_OK\fR. If
an error occurred (such as an unknown option name or an illegal option
-value) then TCL_ERROR is returned and an error message is left in
-\fIinterp\fR's result if \fIinterp\fR isn't NULL.
+value) then \fBTCL_ERROR\fR is returned and an error message is left in
+\fIinterp\fR's result if \fIinterp\fR is not NULL.
.PP
\fBTk_SetOptions\fR has two additional features. First, if the
-\fImaskPtr\fR argument isn't NULL then it points to an integer
+\fImaskPtr\fR argument is not NULL then it points to an integer
value that is filled in with information about the options that were
modified. For each option in the template passed to
\fBTk_CreateOptionTable\fR there is a \fItypeMask\fR field. The
@@ -170,8 +172,8 @@ that bit set. Another bit might indicate that the geometry of the widget
must be recomputed, and so on. \fBTk_SetOptions\fR OR's together the
\fItypeMask\fR fields from all the options that were modified and returns
this value at *\fImaskPtr\fR; the caller can then use this information
-to optimize itself so that, for example, it doesn't redisplay the widget
-if the modified options don't affect the widget's appearance.
+to optimize itself so that, for example, it does not redisplay the widget
+if the modified options do not affect the widget's appearance.
.PP
The second additional feature of \fBTk_SetOptions\fR has to do with error
recovery. If an error occurs while processing configuration options, this
@@ -250,20 +252,20 @@ supported by a particular class of widgets. Each structure specifies
one configuration option and has the following fields:
.CS
typedef struct {
- Tk_OptionType \fItype\fR;
- char *\fIoptionName\fR;
- char *\fIdbName\fR;
- char *\fIdbClass\fR;
- char *\fIdefValue\fR;
- int \fIobjOffset\fR;
- int \fIinternalOffset\fR;
- int \fIflags\fR;
- ClientData \fIclientData\fR;
- int \fItypeMask\fR;
+ Tk_OptionType \fItype\fR;
+ const char *\fIoptionName\fR;
+ const char *\fIdbName\fR;
+ const char *\fIdbClass\fR;
+ const char *\fIdefValue\fR;
+ int \fIobjOffset\fR;
+ int \fIinternalOffset\fR;
+ int \fIflags\fR;
+ ClientData \fIclientData\fR;
+ int \fItypeMask\fR;
} Tk_OptionSpec;
.CE
The \fItype\fR field indicates what kind of configuration option this is
-(e.g. TK_OPTION_COLOR for a color value, or TK_OPTION_INT for
+(e.g. \fBTK_OPTION_COLOR\fR for a color value, or \fBTK_OPTION_INT\fR for
an integer value). \fIType\fR determines how the
value of the option is parsed (more on this below).
The \fIoptionName\fR field is a string such as \fB\-font\fR or \fB\-bg\fR;
@@ -283,7 +285,7 @@ The \fIflags\fR field contains additional information
to control the processing of this configuration option (see below
for details).
\fIClientData\fR provides additional type-specific data needed
-by certain types. For instance, for TK_OPTION_COLOR types,
+by certain types. For instance, for \fBTK_OPTION_COLOR\fR types,
\fIclientData\fR is a string giving the default value to use on
monochrome displays. See the descriptions of the different types
below for details.
@@ -300,22 +302,22 @@ If the \fIinternalOffset\fR field of the Tk_OptionSpec is
greater than or equal to zero, then the value of the option is stored
in a type-specific internal form at the location in the widget record
given by \fIinternalOffset\fR. For example, if the option's type is
-TK_OPTION_INT then the internal form is an integer. If the
+\fBTK_OPTION_INT\fR then the internal form is an integer. If the
\fIobjOffset\fR or \fIinternalOffset\fR field is negative then the
value is not stored in that form. At least one of the offsets must be
greater than or equal to zero.
.PP
The \fIflags\fR field consists of one or more bits ORed together. At
-present only a single flag is supported: TK_OPTION_NULL_OK. If
+present only a single flag is supported: \fBTK_OPTION_NULL_OK\fR. If
this bit is set for an option then an empty string will be accepted as
the value for the option and the resulting internal form will be a
NULL pointer, a zero value, or \fBNone\fR, depending on the type of
the option. If the flag is not set then empty strings will result
in errors.
-TK_OPTION_NULL_OK is typically used to allow a
+\fBTK_OPTION_NULL_OK\fR is typically used to allow a
feature to be turned off entirely, e.g. set a cursor value to
\fBNone\fR so that a window simply inherits its parent's cursor.
-Not all option types support the TK_OPTION_NULL_OK
+Not all option types support the \fBTK_OPTION_NULL_OK\fR
flag; for those that do, there is an explicit indication of that fact
in the descriptions below.
.PP
@@ -337,7 +339,7 @@ returned by \fBTk_GetAnchorFromObj\fR.
The value must be a standard Tk bitmap name. The internal form is a
Pixmap token like the ones returned by \fBTk_AllocBitmapFromObj\fR.
This option type requires \fItkwin\fR to be supplied to procedures
-such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag.
+such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag.
.TP
\fBTK_OPTION_BOOLEAN\fR
The value must be a standard boolean value such as \fBtrue\fR or
@@ -348,14 +350,14 @@ The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR.
The internal form is a Tk_3DBorder token like the ones returned
by \fBTk_Alloc3DBorderFromObj\fR.
This option type requires \fItkwin\fR to be supplied to procedures
-such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag.
+such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag.
.TP
\fBTK_OPTION_COLOR\fR
The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR.
The internal form is an (XColor *) token like the ones returned by
\fBTk_AllocColorFromObj\fR.
This option type requires \fItkwin\fR to be supplied to procedures
-such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag.
+such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag.
.TP
\fBTK_OPTION_CURSOR\fR
The value must be a standard cursor name such as \fBcross\fR or \fB@foo\fR.
@@ -364,25 +366,25 @@ The internal form is a Tk_Cursor token like the ones returned by
This option type requires \fItkwin\fR to be supplied to procedures
such as \fBTk_SetOptions\fR, and when the option is set the cursor
for the window is changed by calling \fBXDefineCursor\fR. This
-option type also supports the TK_OPTION_NULL_OK flag.
+option type also supports the \fBTK_OPTION_NULL_OK\fR flag.
.TP
\fBTK_OPTION_CUSTOM\fR
This option allows applications to define new option types. The
clientData field of the entry points to a structure defining the new
-option type. See the section CUSTOM OPTION TYPES below for details.
+option type. See the section \fBCUSTOM OPTION TYPES\fR below for details.
.TP
\fBTK_OPTION_DOUBLE\fR
The string value must be a floating-point number in
the format accepted by \fBstrtol\fR. The internal form is a C
-\fBdouble\fR value. This option type supports the TK_OPTION_NULL_OK
+\fBdouble\fR value. This option type supports the \fBTK_OPTION_NULL_OK\fR
flag; if a NULL value is set, the internal representation is set to zero.
.TP
\fBTK_OPTION_END\fR
Marks the end of the template. There must be a Tk_OptionSpec structure
-with \fItype\fR TK_OPTION_END at the end of each template. If the
-\fIclientData\fR field of this structure isn't NULL, then it points to
+with \fItype\fR \fBTK_OPTION_END\fR at the end of each template. If the
+\fIclientData\fR field of this structure is not NULL, then it points to
an additional array of Tk_OptionSpec's, which is itself terminated by
-another TK_OPTION_END entry. Templates may be chained arbitrarily
+another \fBTK_OPTION_END\fR entry. Templates may be chained arbitrarily
deeply. This feature allows common options to be shared by several
widget classes.
.TP
@@ -391,7 +393,7 @@ The value must be a standard font name such as \fBTimes 16\fR.
The internal form is a Tk_Font handle like the ones returned by
\fBTk_AllocFontFromObj\fR.
This option type requires \fItkwin\fR to be supplied to procedures
-such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag.
+such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag.
.TP
\fBTK_OPTION_INT\fR
The string value must be an integer in the format accepted by
@@ -408,23 +410,23 @@ The internal form is a Tk_Justify like the values returned by
The value must specify a screen distance such as \fB2i\fR or \fB6.4\fR.
The internal form is an integer value giving a
distance in pixels, like the values returned by
-\fBTk_GetPixelsFromObj\fR. Note: if the \fIobjOffset\fR field isn't
+\fBTk_GetPixelsFromObj\fR. Note: if the \fIobjOffset\fR field is not
used then information about the original value of this option will be lost.
See \fBOBJOFFSET VS. INTERNALOFFSET\fR below for details. This option
-type supports the TK_OPTION_NULL_OK flag; if a NULL value is set, the
+type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the
internal representation is set to zero.
.TP
\fBTK_OPTION_RELIEF\fR
The value must be standard relief such as \fBraised\fR.
The internal form is an integer relief value such as
-TK_RELIEF_RAISED. This option type supports the TK_OPTION_NULL_OK
+\fBTK_RELIEF_RAISED\fR. This option type supports the \fBTK_OPTION_NULL_OK\fR
flag; if the empty string is specified as the value for the option,
-the integer relief value is set to TK_RELIEF_NULL.
+the integer relief value is set to \fBTK_RELIEF_NULL\fR.
.TP
\fBTK_OPTION_STRING\fR
The value may be any string. The internal form is a (char *) pointer
that points to a dynamically allocated copy of the value.
-This option type supports the TK_OPTION_NULL_OK flag.
+This option type supports the \fBTK_OPTION_NULL_OK\fR flag.
.TP
\fBTK_OPTION_STRING_TABLE\fR
For this type, \fIclientData\fR is a pointer to an array of strings
@@ -447,7 +449,7 @@ The value must be a window path name. The internal form is a
\fBTk_Window\fR token for the window.
This option type requires \fItkwin\fR to be supplied to procedures
such as \fBTk_SetOptions\fR (in order to identify the application),
-and it supports the TK_OPTION_NULL_OK flag.
+and it supports the \fBTK_OPTION_NULL_OK\fR flag.
.SH "STORAGE MANAGEMENT ISSUES"
.PP
@@ -457,8 +459,8 @@ procedures described here will handle all of the storage allocation and
resource management issues associated with the field. When the value
of an option is changed, \fBTk_SetOptions\fR (or \fBTk_FreeSavedOptions\fR)
will automatically free any resources associated with the old value, such as
-Tk_Fonts for TK_OPTION_FONT options or dynamically allocated memory for
-TK_OPTION_STRING options. For an option stored as an object using the
+Tk_Fonts for \fBTK_OPTION_FONT\fR options or dynamically allocated memory for
+\fBTK_OPTION_STRING\fR options. For an option stored as an object using the
\fIobjOffset\fR field of a Tk_OptionSpec, the widget record shares the
object pointed to by the \fIobjv\fR value from the call to
\fBTk_SetOptions\fR. The reference count for this object is incremented
@@ -478,28 +480,28 @@ an error occurs in \fBTk_InitOptions\fR.
In most cases it is simplest to use the \fIinternalOffset\fR field of
a Tk_OptionSpec structure and not the \fIobjOffset\fR field. This
makes the internal form of the value immediately available to the
-widget code so the value doesn't have to be extracted from an object
+widget code so the value does not have to be extracted from an object
each time it is used. However, there are two cases where the
\fIobjOffset\fR field is useful. The first case is for
-TK_OPTION_PIXELS options. In this case, the internal form is
+\fBTK_OPTION_PIXELS\fR options. In this case, the internal form is
an integer pixel value that is valid only for a particular screen.
If the value of the option is retrieved, it will be returned as a simple
number. For example, after the command \fB.b configure \-borderwidth 2m\fR,
the command \fB.b configure \-borderwidth\fR might return 7, which is the
integer pixel value corresponding to \fB2m\fR. Unfortunately, this loses
-the original screen-independent value. Thus for TK_OPTION_PIXELS options
+the original screen-independent value. Thus for \fBTK_OPTION_PIXELS\fR options
it is better to use the \fIobjOffset\fR field. In this case the original
value of the option is retained in the object and can be returned when
the option is retrieved. In most cases it is convenient to use the
-\fIinternalOffset\fR field field as well, so that the integer value is
+\fIinternalOffset\fR field as well, so that the integer value is
immediately available for use in the widget code (alternatively,
\fBTk_GetPixelsFromObj\fR can be used to extract the integer value from
the object whenever it is needed). Note: the problem of losing information
-on retrievals exists only for TK_OPTION_PIXELS options.
+on retrievals exists only for \fBTK_OPTION_PIXELS\fR options.
.PP
The second reason to use the \fIobjOffset\fR field is in order to
implement new types of options not supported by these procedures.
-To implement a new type of option, you can use TK_OPTION_STRING as
+To implement a new type of option, you can use \fBTK_OPTION_STRING\fR as
the type in the Tk_OptionSpec structure and set the \fIobjOffset\fR field
but not the \fIinternalOffset\fR field. Then, after calling
\fBTk_SetOptions\fR, convert the object to internal form yourself.
@@ -512,40 +514,40 @@ free, and restore saved copies of the type and creating a structure
pointing to those procedures:
.CS
typedef struct Tk_ObjCustomOption {
- char *name;
- Tk_CustomOptionSetProc *\fIsetProc\fR;
- Tk_CustomOptionGetProc *\fIgetProc\fR;
- Tk_CustomOptionRestoreProc *\fIrestoreProc\fR;
- Tk_CustomOptionFreeProc *\fIfreeProc\fR;
- ClientData \fIclientData\fR;
+ char *name;
+ Tk_CustomOptionSetProc *\fIsetProc\fR;
+ Tk_CustomOptionGetProc *\fIgetProc\fR;
+ Tk_CustomOptionRestoreProc *\fIrestoreProc\fR;
+ Tk_CustomOptionFreeProc *\fIfreeProc\fR;
+ ClientData \fIclientData\fR;
} Tk_ObjCustomOption;
typedef int Tk_CustomOptionSetProc(
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- Tk_Window \fItkwin\fR,
- Tcl_Obj **\fIvaluePtr\fR,
- char *\fIrecordPtr\fR,
- int \fIinternalOffset\fR,
- char *\fIsaveInternalPtr\fR,
- int \fIflags\fR);
+ ClientData \fIclientData\fR,
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Window \fItkwin\fR,
+ Tcl_Obj **\fIvaluePtr\fR,
+ char *\fIrecordPtr\fR,
+ int \fIinternalOffset\fR,
+ char *\fIsaveInternalPtr\fR,
+ int \fIflags\fR);
typedef Tcl_Obj *Tk_CustomOptionGetProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIrecordPtr\fR,
- int \fIinternalOffset\fR);
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIrecordPtr\fR,
+ int \fIinternalOffset\fR);
typedef void Tk_CustomOptionRestoreProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIinternalPtr\fR,
- char *\fIsaveInternalPtr\fR);
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIinternalPtr\fR,
+ char *\fIsaveInternalPtr\fR);
typedef void Tk_CustomOptionFreeProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIinternalPtr\fR);
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIinternalPtr\fR);
.CE
.PP
The Tk_ObjCustomOption structure contains six fields: a name
@@ -581,7 +583,7 @@ value is stored as a (Tcl_Obj *) in the widget record), the Tcl_Obj
pointer referenced by \fIvaluePtr\fR is the pointer that will be
stored at the objOffset for the option. \fISetProc\fR may modify the
value if necessary; for example, \fIsetProc\fR may change the value to
-NULL to support the TK_OPTION_NULL_OK flag.
+NULL to support the \fBTK_OPTION_NULL_OK\fR flag.
.TP
\fIrecordPtr\fR
A pointer to the start of the widget record to modify.
@@ -602,8 +604,8 @@ A copy of the \fIflags\fR field in the Tk_OptionSpec structure for the
option
.RE
.PP
-\fISetProc\fR returns a standard Tcl result: TCL_OK to indicate successful
-processing, or TCL_ERROR to indicate a failure of any kind. An error
+\fISetProc\fR returns a standard Tcl result: \fBTCL_OK\fR to indicate successful
+processing, or \fBTCL_ERROR\fR to indicate a failure of any kind. An error
message may be left in the Tcl interpreter given by \fIinterp\fR in
the case of an error.
.PP
diff --git a/doc/SetVisual.3 b/doc/SetVisual.3
index f5c5890..2082220 100644
--- a/doc/SetVisual.3
+++ b/doc/SetVisual.3
@@ -40,7 +40,7 @@ actually been created in X (e.g. before \fBTk_MapWindow\fR or
The safest thing is to call \fBTk_SetWindowVisual\fR immediately
after calling \fBTk_CreateWindow\fR.
If \fItkwin\fR has already been created before \fBTk_SetWindowVisual\fR
-is called then it returns 0 and doesn't make any changes; otherwise
+is called then it returns 0 and does not make any changes; otherwise
it returns 1 to signify that the operation
completed successfully.
.PP
diff --git a/doc/StrictMotif.3 b/doc/StrictMotif.3
index d44991d..770b335 100644
--- a/doc/StrictMotif.3
+++ b/doc/StrictMotif.3
@@ -28,8 +28,9 @@ variable in the interpreter associated with \fItkwin\fR's application.
The value is returned as an integer that is either 0 or 1.
1 means that strict Motif compliance has been requested, so anything
that is not part of the Motif specification should be avoided.
-0 means that ``Motif-like'' is good enough, and extra features
-are welcome.
+0 means that
+.QW Motif-like
+is good enough, and extra features are welcome.
.PP
This procedure uses a link to the Tcl variable to provide much
faster access to the variable's value than could be had by calling
diff --git a/doc/TextLayout.3 b/doc/TextLayout.3
index d6fa032..6c4da60 100644
--- a/doc/TextLayout.3
+++ b/doc/TextLayout.3
@@ -53,10 +53,8 @@ lifetime of the text layout.
.AP int numChars in
The number of characters to consider from \fIstring\fR. If
\fInumChars\fR is less than 0, then assumes \fIstring\fR is null
-.VS 8.1
terminated and uses \fBTcl_NumUtfChars\fR to determine the length of
\fIstring\fR.
-.VE
.AP int wrapLength in
Longest permissible line length, in pixels. Lines in \fIstring\fR will
automatically be broken at word boundaries and wrapped when they reach
@@ -67,15 +65,17 @@ wrapping; lines will get as long as they need to be and only wrap if a
newline/return character is encountered.
.AP Tk_Justify justify in
How to justify the lines in a multi-line text layout. Possible values
-are TK_JUSTIFY_LEFT, TK_JUSTIFY_CENTER, or TK_JUSTIFY_RIGHT. If the text
-layout only occupies a single line, then \fIjustify\fR is irrelevant.
+are \fBTK_JUSTIFY_LEFT\fR, \fBTK_JUSTIFY_CENTER\fR, or
+\fBTK_JUSTIFY_RIGHT\fR. If the text layout only occupies a single
+line, then \fIjustify\fR is irrelevant.
.AP int flags in
-Various flag bits OR-ed together. TK_IGNORE_TABS means that tab characters
-should not be expanded to the next tab stop. TK_IGNORE_NEWLINES means that
-newline/return characters should not cause a line break. If either tabs or
-newlines/returns are ignored, then they will be treated as regular
-characters, being measured and displayed in a platform-dependent manner as
-described in \fBTk_MeasureChars\fR, and will not have any special behaviors.
+Various flag bits OR-ed together. \fBTK_IGNORE_TABS\fR means that tab
+characters should not be expanded to the next tab stop.
+\fBTK_IGNORE_NEWLINES\fR means that newline/return characters should
+not cause a line break. If either tabs or newlines/returns are
+ignored, then they will be treated as regular characters, being
+measured and displayed in a platform-dependent manner as described in
+\fBTk_MeasureChars\fR, and will not have any special behaviors.
.AP int *widthPtr out
If non-NULL, filled with either the width, in pixels, of the widest
line in the text layout, or the width, in pixels, of the bounding box for the
@@ -135,13 +135,11 @@ strings, refer to the documentation for \fBTk_MeasureChars\fR. There is
no programming interface in the core of Tk that supports multi-font,
multi-line text; support for that behavior must be built on top of
simpler layers.
-.VS 8.1
Note that unlike the lower level text display routines, the functions
described here all operate on character-oriented lengths and indices
rather than byte-oriented values. See the description of
\fBTcl_UtfAtIndex\fR for more details on converting between character
and byte offsets.
-.VE 8.1
.PP
The routines described here are built on top of the programming interface
described in the \fBTk_MeasureChars\fR documentation. Tab characters and
@@ -216,7 +214,7 @@ the given point (\fIx, y\fR) to the characters in \fIlayout\fR.
Newline/return characters and non-displaying space characters that occur at
the end of individual lines in the text layout are ignored for hit detection
purposes, but tab characters are not. The return value is 0 if the point
-actually hits the \fIlayout\fR. If the point didn't hit the \fIlayout\fR
+actually hits the \fIlayout\fR. If the point did not hit the \fIlayout\fR
then the return value is the distance in pixels from the point to the
\fIlayout\fR.
.PP
@@ -234,8 +232,7 @@ is the responsibility of the caller to take the Postscript array of
strings and add some Postscript function operate on the array to render
each of the lines. The code that represents the Postscript array of
strings is appended to \fIinterp->result\fR.
-.PP
-.SH DISPLAY MODEL
+.SH "DISPLAY MODEL"
When measuring a text layout, space characters that occur at the end of a
line are ignored. The space characters still exist and the insertion point
can be positioned amongst them, but their additional width is ignored when
diff --git a/doc/TkInitStubs.3 b/doc/TkInitStubs.3
index 421ed10..3806f95 100644
--- a/doc/TkInitStubs.3
+++ b/doc/TkInitStubs.3
@@ -1,5 +1,5 @@
'\"
-'\" Copyright (c) 1999 Scriptics Corportation
+'\" Copyright (c) 1999 Scriptics Corporation
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -13,7 +13,7 @@ Tk_InitStubs \- initialize the Tk stubs mechanism
.nf
\fB#include <tk.h>\fR
.sp
-CONST char *
+const char *
\fBTk_InitStubs\fR(\fIinterp, version, exact\fR)
.SH ARGUMENTS
.AS Tcl_Interp *interp in
@@ -48,8 +48,8 @@ Tcl functions.
Call \fBTk_InitStubs\fR if the extension before calling any other
Tk functions.
.IP 2) 5
-Define the USE_TCL_STUBS symbol. Typically, you would include the
--DUSE_TCL_STUBS flag when compiling the extension.
+Define the \fBUSE_TCL_STUBS\fR symbol. Typically, you would include the
+\fB\-DUSE_TCL_STUBS\fR flag when compiling the extension.
.IP 3) 5
Link the extension with the Tcl and Tk stubs libraries instead of
the standard Tcl and Tk libraries. On Unix platforms, the library
@@ -67,7 +67,7 @@ as long as they have the same major version number as \fIversion\fR;
non-zero means that only the specified \fIversion\fR is acceptable.
\fBTcl_InitStubs\fR returns a string containing the actual version
of Tk satisfying the request, or NULL if the Tk version is not
-acceptable, does not support the stubs mechansim, or any other
+acceptable, does not support the stubs mechanism, or any other
error condition occurred.
.SH "SEE ALSO"
\fBTcl_InitStubs\fR
diff --git a/doc/Tk_Init.3 b/doc/Tk_Init.3
index b217aff..65e2d0a 100644
--- a/doc/Tk_Init.3
+++ b/doc/Tk_Init.3
@@ -52,8 +52,9 @@ Continuous ringing of the bell is a nuisance.
.TP
\fBclipboard\fR
A malicious script could replace the contents of the clipboard with
-the string \fB"rm -r *"\fR and lead to surprises when the contents of
-the clipboard are pasted.
+the string
+.QW "\fBrm \-r *\fR"
+and lead to surprises when the contents of the clipboard are pasted.
.TP
\fBgrab\fR
Grab can be used to block the user from using any other applications.
diff --git a/doc/Tk_Main.3 b/doc/Tk_Main.3
index c247211..e67cf00 100644
--- a/doc/Tk_Main.3
+++ b/doc/Tk_Main.3
@@ -44,7 +44,8 @@ nothing but invoke \fBTk_Main\fR.
.PP
When it is has finished its own initialization, but before
it processes commands, \fBTk_Main\fR calls the procedure given by
-the \fIappInitProc\fR argument. This procedure provides a ``hook''
+the \fIappInitProc\fR argument. This procedure provides a
+.QW hook
for the application to perform its own initialization, such as defining
application-specific commands. The procedure must have an interface
that matches the type \fBTcl_AppInitProc\fR:
diff --git a/doc/WindowId.3 b/doc/WindowId.3
index e588c8e..efa326d 100644
--- a/doc/WindowId.3
+++ b/doc/WindowId.3
@@ -9,7 +9,7 @@
.TH Tk_WindowId 3 "8.4" Tk "Tk Library Procedures"
.BS
.SH NAME
-Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap \- retrieve information from Tk's local data structure
+Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap, Tk_Interp \- retrieve information from Tk's local data structure
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -23,7 +23,7 @@ Tk_Window
Display *
\fBTk_Display\fR(\fItkwin\fR)
.sp
-CONST char *
+const char *
\fBTk_DisplayName\fR(\fItkwin\fR)
.sp
int
@@ -94,6 +94,9 @@ int
.sp
Colormap
\fBTk_Colormap\fR(\fItkwin\fR)
+.sp
+Tcl_Interp *
+\fBTk_Interp\fR(\fItkwin\fR)
.SH ARGUMENTS
.AS Tk_Window tkwin
.AP Tk_Window tkwin in
@@ -116,6 +119,9 @@ yet.
\fItkwin\fR. The parent is the token that was specified when
\fItkwin\fR was created, or NULL for main windows.
.PP
+\fBTk_Interp\fR returns the Tcl interpreter associated with a
+\fItkwin\fR or NULL if there is an error.
+.PP
\fBTk_Display\fR returns a pointer to the Xlib display structure
corresponding to \fItkwin\fR. \fBTk_DisplayName\fR returns an
ASCII string identifying \fItkwin\fR's display. \fBTk_ScreenNumber\fR
@@ -144,15 +150,15 @@ is a container, and that some other application may be embedding
itself inside \fItkwin\fR.
.PP
\fBTk_IsEmbedded\fR returns a non-zero value if \fItkwin\fR
-is is not a free-standing window, but rather is embedded in some
+is not a free-standing window, but rather is embedded in some
other application.
.PP
\fBTk_IsMapped\fR returns a non-zero value if \fItkwin\fR
-is mapped and zero if \fItkwin\fR isn't mapped.
+is mapped and zero if \fItkwin\fR is not mapped.
.PP
\fBTk_IsTopLevel\fR returns a non-zero value if \fItkwin\fR
is a top-level window (its X parent is the root window of the
-screen) and zero if \fItkwin\fR isn't a top-level window.
+screen) and zero if \fItkwin\fR is not a top-level window.
.PP
\fBTk_ReqWidth\fR and \fBTk_ReqHeight\fR return information about
the window's requested size. These values correspond to the last
diff --git a/doc/bind.n b/doc/bind.n
index d5bdf2c..cd556e7 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -15,7 +15,6 @@ bind \- Arrange for X events to invoke Tcl scripts
.SH SYNOPSIS
\fBbind\fI tag\fR ?\fIsequence\fR? ?\fB+\fR??\fIscript\fR?
.BE
-
.SH "INTRODUCTION"
.PP
The \fBbind\fR command associates Tcl scripts with X events.
@@ -23,7 +22,9 @@ If all three arguments are specified, \fBbind\fR will
arrange for \fIscript\fR (a Tcl script) to be evaluated whenever
the event(s) given by \fIsequence\fR occur in the window(s)
identified by \fItag\fR.
-If \fIscript\fR is prefixed with a ``+'', then it is appended to
+If \fIscript\fR is prefixed with a
+.QW + ,
+then it is appended to
any existing binding for \fIsequence\fR; otherwise \fIscript\fR replaces
any existing binding.
If \fIscript\fR is an empty string then the current binding for
@@ -64,17 +65,15 @@ the binding applies to all windows in the application.
.PP
The \fIsequence\fR argument specifies a sequence of one or more
event patterns, with optional white space between the patterns. Each
-.VS
event pattern may
take one of three forms. In the simplest case it is a single
-.VE
printing ASCII character, such as \fBa\fR or \fB[\fR. The character
may not be a space character or the character \fB<\fR. This form of
pattern matches a \fBKeyPress\fR event for the particular
character. The second form of pattern is longer but more general.
It has the following syntax:
.CS
-\fB<\fImodifier-modifier-type-detail\fB>\fR
+\fB<\fImodifier\-modifier\-type\-detail\fB>\fR
.CE
The entire event pattern is surrounded by angle brackets.
Inside the angle brackets are zero or more modifiers, an event
@@ -82,7 +81,6 @@ type, and an extra piece of information (\fIdetail\fR) identifying
a particular button or keysym. Any of the fields may be omitted,
as long as at least one of \fItype\fR and \fIdetail\fR is present.
The fields must be separated by white space or dashes.
-.VS
.PP
The third form of pattern is used to specify a user-defined, named virtual
event. It has the following syntax:
@@ -95,26 +93,26 @@ Modifiers, such as \fBShift\fR or \fBControl\fR, may not be combined with a
virtual event to modify it. Bindings on a virtual event may be created
before the virtual event is defined, and if the definition of a virtual
event changes dynamically, all windows bound to that virtual event will
-respond immediately to the new definition.
+respond immediately to the new definition.
.PP
Some widgets (e.g. \fBmenu\fR and \fBtext\fR) issue virtual events
when their internal state is updated in some ways. Please see the
manual page for each widget for details.
-.VE
-.SH "MODIFIERS"
+.SS "MODIFIERS"
.PP
Modifiers consist of any of the following values:
.DS
.ta 6c
-\fBControl\fR \fBMod2, M2\fR
-\fBShift\fR \fBMod3, M3\fR
-\fBLock\fR \fBMod4, M4\fR
-\fBButton1, B1\fR \fBMod5, M5\fR
-\fBButton2, B2\fR \fBMeta, M\fR
-\fBButton3, B3\fR \fBAlt\fR
-\fBButton4, B4\fR \fBDouble\fR
-\fBButton5, B5\fR \fBTriple\fR
-\fBMod1, M1\fR \fBQuadruple\fR
+\fBControl\fR \fBMod1\fR, \fBM1\fR, \fBCommand\fR
+\fBAlt\fR \fBMod2\fR, \fBM2\fR, \fBOption\fR
+\fBShift\fR \fBMod3\fR, \fBM3\fR
+\fBLock\fR \fBMod4\fR, \fBM4\fR
+\fBExtended\fR \fBMod5\fR, \fBM5\fR
+\fBButton1\fR, \fBB1\fR \fBMeta\fR, \fBM\fR
+\fBButton2\fR, \fBB2\fR \fBDouble\fR
+\fBButton3\fR, \fBB3\fR \fBTriple\fR
+\fBButton4\fR, \fBB4\fR \fBQuadruple\fR
+\fBButton5\fR, \fBB5\fR
.DE
Where more than one value is listed, separated by commas, the values
are equivalent.
@@ -126,8 +124,8 @@ must include all of those specified in the event pattern.
An event may also contain additional modifiers not specified in
the binding.
For example, if button 1 is pressed while the shift and control keys
-are down, the pattern \fB<Control-Button-1>\fR will match
-the event, but \fB<Mod1-Button-1>\fR will not.
+are down, the pattern \fB<Control\-Button\-1>\fR will match
+the event, but \fB<Mod1\-Button\-1>\fR will not.
If no modifiers are specified, then any combination of modifiers may
be present in the event.
.PP
@@ -146,11 +144,24 @@ events. They cause a particular event pattern to be repeated 2, 3 or 4
times, and also place a time and space requirement on the sequence: for a
sequence of events to match a \fBDouble\fR, \fBTriple\fR or \fBQuadruple\fR
pattern, all of the events must occur close together in time and without
-substantial mouse motion in between. For example, \fB<Double-Button-1>\fR
-is equivalent to \fB<Button-1><Button-1>\fR with the extra time and space
+substantial mouse motion in between. For example, \fB<Double\-Button\-1>\fR
+is equivalent to \fB<Button\-1><Button\-1>\fR with the extra time and space
requirement.
-
-.SH "EVENT TYPES"
+.PP
+The \fBCommand\fR and \fBOption\fR modifiers are equivalents of \fBMod1\fR
+resp. \fBMod2\fR, they correspond to Macintosh-specific modifier keys.
+.PP
+.VS 8.5
+The \fBExtended\fR modifier is, at present, specific to Windows. It
+appears on events that are associated with the keys on the
+.QW "extended keyboard" .
+On a US keyboard, the extended keys include the \fBAlt\fR
+and \fBControl\fR keys at the right of the keyboard, the cursor keys
+in the cluster to the left of the numeric pad, the \fBNumLock\fR key,
+the \fBBreak\fR key, the \fBPrintScreen\fR key, and the \fB/\fR and
+\fBEnter\fR keys in the numeric keypad.
+.VE 8.5
+.SS "EVENT TYPES"
.PP
The \fItype\fR field may be any of the standard X event types, with a
few extra abbreviations. The \fItype\fR field will also accept a
@@ -158,19 +169,18 @@ couple non-standard X event types that were added to better support
the Macintosh and Windows platforms. Below is a list of all the valid
types; where two names appear together, they are synonyms.
.DS
-.ta \w'ButtonPress, Button\0\0\0'u +\w'KeyPress, Key\0\0\0'u
-\fBActivate Destroy Map
-ButtonPress, Button Enter MapRequest
-ButtonRelease Expose Motion
-Circulate FocusIn MouseWheel
-CirculateRequest FocusOut Property
-Colormap Gravity Reparent
-Configure KeyPress, Key ResizeRequest
-ConfigureRequest KeyRelease Unmap
-Create Leave Visibility
-Deactivate\fR
+.ta \w'\fBButtonPress, Button\0\0\0\fR'u +\w'\fBKeyPress, Key\0\0\0\fR'u
+\fBActivate\fR \fBDestroy\fR \fBMap\fR
+\fBButtonPress\fR, \fBButton\fR \fBEnter\fR \fBMapRequest\fR
+\fBButtonRelease\fR \fBExpose\fR \fBMotion\fR
+\fBCirculate\fR \fBFocusIn\fR \fBMouseWheel\fR
+\fBCirculateRequest\fR \fBFocusOut\fR \fBProperty\fR
+\fBColormap\fR \fBGravity\fR \fBReparent\fR
+\fBConfigure\fR \fBKeyPress\fR, \fBKey\fR \fBResizeRequest\fR
+\fBConfigureRequest\fR \fBKeyRelease\fR \fBUnmap\fR
+\fBCreate\fR \fBLeave\fR \fBVisibility\fR
+\fBDeactivate\fR
.DE
-.VS
Most of the above events have the same fields and behaviors as events
in the X Windowing system. You can find more detailed descriptions of
these events in any X window programming book. A couple of the events
@@ -189,165 +199,163 @@ active. Likewise, the \fBDeactive\fR event is sent when the window's
state changes from active to deactive. There are no useful percent
substitutions you would make when binding to these events.
.IP \fBMouseWheel\fR 5
-Some mice on the Windows platform support a mouse wheel which is used
+Many contemporary mice support a mouse wheel, which is used
for scrolling documents without using the scrollbars. By rolling the
wheel, the system will generate \fBMouseWheel\fR events that the
-application can use to scroll. On Windows, the event is
-always routed to the window that currently has focus (like \fBKey\fR
-events.) On Mac OS X,
-the event is routed to the window under the pointer. When the event
+application can use to scroll. Like \fBKey\fR events the event is
+always routed to the window that currently has focus. When the event
is received you can use the \fB%D\fR substitution to get the
\fIdelta\fR field for the event, which is a integer value describing how
the mouse wheel has moved. The smallest value for which the
system will report is defined by the OS. On Windows 95 & 98 machines
this value is at least 120 before it is reported. However, higher
-resolution devices may be available in the future. On Mac OS X, the value is
-not scaled by 120, but a value of 1 corresponds to roughly one text line.
-The sign of the value determines which direction your widget should scroll.
-Positive values should scroll up and negative values should scroll down.
-.VE
-.IP "\fBKeyPress\fP, \fBKeyRelease\fP" 5
-The \fBKeyPress\fP and \fBKeyRelease\fP events are generated
-whenever a key is pressed or released. \fBKeyPress\fP and \fBKeyRelease\fP
+resolution devices may be available in the future. The sign of the
+value determines which direction your widget should scroll. Positive
+values should scroll up and negative values should scroll down.
+.IP "\fBKeyPress\fR, \fBKeyRelease\fR" 5
+The \fBKeyPress\fR and \fBKeyRelease\fR events are generated
+whenever a key is pressed or released. \fBKeyPress\fR and \fBKeyRelease\fR
events are sent to the window which currently has the keyboard focus.
-.IP "\fBButtonPress\fP, \fBButtonRelease\fP, \fBMotion\fP" 5
-The \fBButtonPress\fP and \fBButtonRelease\fP events
+.IP "\fBButtonPress\fR, \fBButtonRelease\fR, \fBMotion\fR" 5
+The \fBButtonPress\fR and \fBButtonRelease\fR events
are generated when the user presses or releases a mouse button.
-\fBMotion\fP events are generated whenever the pointer is moved.
-\fBButtonPress\fP, \fBButtonRelease\fP, and \fBMotion\fP events are
+\fBMotion\fR events are generated whenever the pointer is moved.
+\fBButtonPress\fR, \fBButtonRelease\fR, and \fBMotion\fR events are
normally sent to the window containing the pointer.
.RS
.PP
When a mouse button is pressed, the window containing the pointer
automatically obtains a temporary pointer grab.
-Subsequent \fBButtonPress\fP, \fBButtonRelease\fP, and \fBMotion\fP
+Subsequent \fBButtonPress\fR, \fBButtonRelease\fR, and \fBMotion\fR
events will be sent to that window,
regardless of which window contains the pointer,
until all buttons have been released.
.RE
-.IP \fBConfigure\fP 5
-A \fBConfigure\fP event is sent to a window whenever its
+.IP \fBConfigure\fR 5
+A \fBConfigure\fR event is sent to a window whenever its
size, position, or border width changes, and sometimes
when it has changed position in the stacking order.
-.IP "\fBMap\fP, \fBUnmap\fP" 5
-The \fBMap\fP and \fBUnmap\fP events are generated whenever the mapping
+.IP "\fBMap\fR, \fBUnmap\fR" 5
+The \fBMap\fR and \fBUnmap\fR events are generated whenever the mapping
state of a window changes.
.RS
.PP
Windows are created in the unmapped state.
Top-level windows become mapped when they transition to the
-\fBnormal\fP state, and are unmapped in the \fBwithdrawn\fP
-and \fBiconic\fP states.
+\fBnormal\fR state, and are unmapped in the \fBwithdrawn\fR
+and \fBiconic\fR states.
Other windows become mapped when they are placed under control
-of a geometry manager (for example \fBpack\fP or \fBgrid\fP).
+of a geometry manager (for example \fBpack\fR or \fBgrid\fR).
.PP
-A window is \fIviewable\fP only if it and all of its ancestors are mapped.
-Note that geometry managers typically do not map their children until
+A window is \fIviewable\fR only if it and all of its ancestors are mapped.
+Note that geometry managers typically do not map their children until
they have been mapped themselves, and unmap all children
-when they become unmapped; hence in Tk \fBMap\fP and \fBUnmap\fP
+when they become unmapped; hence in Tk \fBMap\fR and \fBUnmap\fR
events indicate whether or not a window is viewable.
.RE
-.IP \fBVisibility\fP 5
-A window is said to be \fIobscured\fP when another window
+.IP \fBVisibility\fR 5
+A window is said to be \fIobscured\fR when another window
above it in the stacking order fully or partially overlaps it.
-\fBVisibility\fP events are generated whenever a window's
-obscurity state changes; the \fIstate\fP field (\fB%s\fP)
+\fBVisibility\fR events are generated whenever a window's
+obscurity state changes; the \fIstate\fR field (\fB%s\fR)
specifies the new state.
-.IP \fBExpose\fP 5
-An \fBExpose\fP event is generated whenever all or part of a
+.IP \fBExpose\fR 5
+An \fBExpose\fR event is generated whenever all or part of a
window should be redrawn (for example, when a window is
first mapped or if it becomes unobscured).
-It is normally not necessary for client applications to
-handle \fBExpose\fP events, since Tk handles them internally.
-.IP \fBDestroy\fP 5
-A \fBDestroy\fP event is delivered to a window when
+It is normally not necessary for client applications to
+handle \fBExpose\fR events, since Tk handles them internally.
+.IP \fBDestroy\fR 5
+A \fBDestroy\fR event is delivered to a window when
it is destroyed.
.RS
.PP
-When the \fBDestroy\fP event is delivered
-to a widget, it is in a ``half-dead'' state: the widget still exists,
-but most operations on it will fail.
+When the \fBDestroy\fR event is delivered
+to a widget, it is in a
+.QW half-dead
+state: the widget still exists, but most operations on it will fail.
.RE
-.IP "\fBFocusIn\fP, \fBFocusOut\fP" 5
-The \fBFocusIn\fP and \fBFocusOut\fP events are generated
+.IP "\fBFocusIn\fR, \fBFocusOut\fR" 5
+The \fBFocusIn\fR and \fBFocusOut\fR events are generated
whenever the keyboard focus changes.
-A \fBFocusOut\fP event is sent to the old focus window,
-and a \fBFocusIn\fP event is sent to the new one.
+A \fBFocusOut\fR event is sent to the old focus window,
+and a \fBFocusIn\fR event is sent to the new one.
.RS
.PP
In addition,
if the old and new focus windows do not share a common parent,
-``virtual crossing'' focus events are sent to the intermediate
-windows in the hierarchy.
-Thus a \fBFocusIn\fP event indicates
+.QW "virtual crossing"
+focus events are sent to the intermediate windows in the hierarchy.
+Thus a \fBFocusIn\fR event indicates
that the target window or one of its descendants has acquired the focus,
-and a \fBFocusOut\fP event indicates that the focus
+and a \fBFocusOut\fR event indicates that the focus
has been changed to a window outside the target window's hierarchy.
.PP
-The keyboard focus may be changed explicitly by a call to \fBfocus\fP,
-or implicitly by the window manager.
+The keyboard focus may be changed explicitly by a call to \fBfocus\fR,
+or implicitly by the window manager.
.RE
-.IP "\fBEnter\fP, \fBLeave\fP" 5
-An \fBEnter\fP event is sent to a window when the pointer
-enters that window, and a \fBLeave\fP event is sent when
-the pointer leaves it.
+.IP "\fBEnter\fR, \fBLeave\fR" 5
+An \fBEnter\fR event is sent to a window when the pointer
+enters that window, and a \fBLeave\fR event is sent when
+the pointer leaves it.
.RS
.PP
-If there is a pointer grab in effect, \fBEnter\fP and \fBLeave\fP
+If there is a pointer grab in effect, \fBEnter\fR and \fBLeave\fR
events are only delivered to the window owning the grab.
.PP
In addition, when the pointer moves
-between two windows, \fBEnter\fP and \fBLeave\fP
-``virtual crossing'' events are sent to intermediate windows
-in the hierarchy in the same manner as for \fBFocusIn\fP and
-\fBFocusOut\fP events.
+between two windows, \fBEnter\fR and \fBLeave\fR
+.QW "virtual crossing"
+events are sent to intermediate windows
+in the hierarchy in the same manner as for \fBFocusIn\fR and
+\fBFocusOut\fR events.
.RE
-.IP \fBProperty\fP
-A \fBProperty\fP event is sent to a window whenever an X property
+.IP \fBProperty\fR
+A \fBProperty\fR event is sent to a window whenever an X property
belonging to that window is changed or deleted.
-\fBProperty\fP events are not normally delivered to Tk applications as
+\fBProperty\fR events are not normally delivered to Tk applications as
they are handled by the Tk core.
-.IP \fBColormap\fP
-A \fBColormap\fP event is generated whenever the colormap
+.IP \fBColormap\fR
+A \fBColormap\fR event is generated whenever the colormap
associated with a window has been changed, installed, or uninstalled.
.RS
.PP
Widgets may be assigned a private colormap by
-specifying a \fB-colormap\fP option; the window manager
+specifying a \fB\-colormap\fR option; the window manager
is responsible for installing and uninstalling colormaps
as necessary.
.PP
Note that Tk provides no useful details for this event type.
.RE
'\" The following events were added in TIP#47
-.IP "\fBMapRequest\fP, \fBCirculateRequest\fP, \fBResizeRequest\fP, \fBConfigureRequest\fP, \fBCreate\fP" 5
+.IP "\fBMapRequest\fR, \fBCirculateRequest\fR, \fBResizeRequest\fR, \fBConfigureRequest\fR, \fBCreate\fR" 5
These events are not normally delivered to Tk applications.
They are included for completeness, to make it possible to
write X11 window managers in Tk.
(These events are only delivered when a client has
-selected \fBSubstructureRedirectMask\fP on a window;
+selected \fBSubstructureRedirectMask\fR on a window;
the Tk core does not use this mask.)
-.IP "\fBGravity\fP, \fBReparent\fP, \fBCirculate\fP" 5
-The events \fBGravity\fP and \fBReparent\fP
+.IP "\fBGravity\fR, \fBReparent\fR, \fBCirculate\fR" 5
+The events \fBGravity\fR and \fBReparent\fR
are not normally delivered to Tk applications.
They are included for completeness.
.RS
.PP
-A \fBCirculate\fP event indicates that the window has moved
+A \fBCirculate\fR event indicates that the window has moved
to the top or to the bottom of the stacking order as
-a result of an \fBXCirculateSubwindows\fP protocol request.
+a result of an \fBXCirculateSubwindows\fR protocol request.
Note that the stacking order may be changed for other reasons
-which do not generate a \fBCirculate\fP event, and that
-Tk does not use \fBXCirculateSubwindows()\fP internally.
+which do not generate a \fBCirculate\fR event, and that
+Tk does not use \fBXCirculateSubwindows()\fR internally.
This event type is included only for completeness;
there is no reliable way to track changes to a window's
position in the stacking order.
.RE
-.SH "EVENT DETAILS"
+.SS "EVENT DETAILS"
.PP
The last part of a long event specification is \fIdetail\fR. In the
case of a \fBButtonPress\fR or \fBButtonRelease\fR event, it is the
-number of a button (1-5). If a button number is given, then only an
+number of a button (1\-5). If a button number is given, then only an
event on that particular button will match; if no button number is
given, then an event on any button will match. Note: giving a
specific button number is different than specifying a button modifier;
@@ -356,17 +364,22 @@ while in the second it refers to some other button that is already
depressed when the matching event occurs. If a button
number is given then \fItype\fR may be omitted: if will default
to \fBButtonPress\fR. For example, the specifier \fB<1>\fR
-is equivalent to \fB<ButtonPress-1>\fR.
+is equivalent to \fB<ButtonPress\-1>\fR.
.PP
If the event type is \fBKeyPress\fR or \fBKeyRelease\fR, then
\fIdetail\fR may be specified in the form of an X keysym. Keysyms
are textual specifications for particular keys on the keyboard;
-they include all the alphanumeric ASCII characters (e.g. ``a'' is
-the keysym for the ASCII character ``a''), plus descriptions for
-non-alphanumeric characters (``comma'' is the keysym for the comma
-character), plus descriptions for all the non-ASCII keys on the
-keyboard (``Shift_L'' is the keysym for the left shift key, and
-``F1'' is the keysym for the F1 function key, if it exists). The
+they include all the alphanumeric ASCII characters (e.g.
+.QW a
+is the keysym for the ASCII character
+.QW a ),
+plus descriptions for non-alphanumeric characters
+.PQ comma "is the keysym for the comma character" ,
+plus descriptions for all the non-ASCII keys on the keyboard (e.g.
+.QW Shift_L
+is the keysym for the left shift key, and
+.QW F1
+is the keysym for the F1 function key, if it exists). The
complete list of keysyms is not presented here; it is
available in other X documentation and may vary from system to
system.
@@ -374,8 +387,8 @@ If necessary, you can use the \fB%K\fR notation described below
to print out the keysym name for a particular key.
If a keysym \fIdetail\fR is given, then the
\fItype\fR field may be omitted; it will default to \fBKeyPress\fR.
-For example, \fB<Control-comma>\fR is equivalent to
-\fB<Control-KeyPress-comma>\fR.
+For example, \fB<Control\-comma>\fR is equivalent to
+\fB<Control\-KeyPress\-comma>\fR.
.SH "BINDING SCRIPTS AND SUBSTITUTIONS"
.PP
The \fIscript\fR argument to \fBbind\fR is a Tcl script,
@@ -406,49 +419,58 @@ The \fIabove\fR field from the event,
formatted as a hexadecimal number.
Valid only for \fBConfigure\fR events.
Indicates the sibling window immediately below the receiving window
-in the stacking order, or \fB0\fP if the receiving window is at the
+in the stacking order, or \fB0\fR if the receiving window is at the
bottom.
.IP \fB%b\fR 5
The number of the button that was pressed or released. Valid only
for \fBButtonPress\fR and \fBButtonRelease\fR events.
.IP \fB%c\fR 5
The \fIcount\fR field from the event. Valid only for \fBExpose\fR events.
-Indicates that there are \fIcount\fP pending \fBExpose\fP events which have not
+Indicates that there are \fIcount\fR pending \fBExpose\fR events which have not
yet been delivered to the window.
.IP \fB%d\fR 5
-The \fIdetail\fR field from the event. The \fB%d\fR is replaced by
+The \fIdetail\fR
+.VS 8.5
+or \fIuser_data\fR
+.VE 8.5
+field from the event. The \fB%d\fR is replaced by
a string identifying the detail. For \fBEnter\fR,
\fBLeave\fR, \fBFocusIn\fR, and \fBFocusOut\fR events,
the string will be one of the following:
.RS
.DS
.ta 6c
-\fBNotifyAncestor NotifyNonlinearVirtual
-NotifyDetailNone NotifyPointer
-NotifyInferior NotifyPointerRoot
-NotifyNonlinear NotifyVirtual\fR
+\fBNotifyAncestor\fR \fBNotifyNonlinearVirtual\fR
+\fBNotifyDetailNone\fR \fBNotifyPointer\fR
+\fBNotifyInferior\fR \fBNotifyPointerRoot\fR
+\fBNotifyNonlinear\fR \fBNotifyVirtual\fR
.DE
For \fBConfigureRequest\fR events, the string will be one of:
.DS
.ta 6c
-\fBAbove Opposite
-Below None
-BottomIf TopIf\fR
+\fBAbove\fR \fBOpposite\fR
+\fBBelow\fR \fBNone\fR
+\fBBottomIf\fR \fBTopIf\fR
.DE
+.VS 8.5
+For virtual events, the string will be whatever value is stored in the
+\fIuser_data\fR field when the event was created (typically with
+\fBevent generate\fR), or the empty string if the field is NULL.
+Virtual events corresponding to key sequence presses (see \fBevent
+add\fR for details) set the \fIuser_data\fR to NULL.
+.VE 8.5
For events other than these, the substituted string is undefined.
.RE
.IP \fB%f\fR 5
The \fIfocus\fR field from the event (\fB0\fR or \fB1\fR). Valid only
-for \fBEnter\fR and \fBLeave\fR events. \fB1\fP if the receiving
-window is the focus window or a descendant of the focus window,
-\fB0\fP otherwise.
+for \fBEnter\fR and \fBLeave\fR events. \fB1\fR if the receiving
+window is the focus window or a descendant of the focus window,
+\fB0\fR otherwise.
.IP \fB%h\fR 5
-.VS
The \fIheight\fR field from the event. Valid for the \fBConfigure\fR,
\fBConfigureRequest\fR, \fBCreate\fR, \fBResizeRequest\fR, and
\fBExpose\fR events.
Indicates the new or requested height of the window.
-.VE
.IP \fB%i\fR 5
The \fIwindow\fR field from the event, represented as a hexadecimal
integer. Valid for all event types.
@@ -458,10 +480,8 @@ and \fBKeyRelease\fR events.
.IP \fB%m\fR 5
The \fImode\fR field from the event. The substituted string is one of
\fBNotifyNormal\fR, \fBNotifyGrab\fR, \fBNotifyUngrab\fR, or
-.VS
\fBNotifyWhileGrabbed\fR. Valid only for \fBEnter\fR,
\fBFocusIn\fR, \fBFocusOut\fR, and \fBLeave\fR events.
-.VE
.IP \fB%o\fR 5
The \fIoverride_redirect\fR field from the event. Valid only for
\fBMap\fR, \fBReparent\fR, and \fBConfigure\fR events.
@@ -476,36 +496,34 @@ The \fIstate\fR field from the event. For \fBButtonPress\fR,
is substituted. For \fBVisibility\fR, one of the strings
\fBVisibilityUnobscured\fR, \fBVisibilityPartiallyObscured\fR,
and \fBVisibilityFullyObscured\fR is substituted.
-For \fBProperty\fP events, substituted with
-either the string \fBNewValue\fP (indicating that the property
-has been created or modified) or \fBDelete\fP (indicating that
+For \fBProperty\fR events, substituted with
+either the string \fBNewValue\fR (indicating that the property
+has been created or modified) or \fBDelete\fR (indicating that
the property has been removed).
.IP \fB%t\fR 5
The \fItime\fR field from the event.
This is the X server timestamp (typically the time since
the last server reset) in milliseconds, when the event occurred.
-Valid for most events.
+Valid for most events.
.IP \fB%w\fR 5
The \fIwidth\fR field from the event.
Indicates the new or requested width of the window.
Valid only for
-.VS
\fBConfigure\fR, \fBConfigureRequest\fR, \fBCreate\fR,
\fBResizeRequest\fR, and \fBExpose\fR events.
-.VE
.IP "\fB%x\fR, \fB%y\fR" 5
The \fIx\fR and \fIy\fR fields from the event.
-For \fBButtonPress\fP, \fBButtonRelease\fP, \fBMotion\fP,
-\fBKeyPress\fP, \fBKeyRelease\fP, and \fBMouseWheel\fP events,
-\fB%x\fP and \fB%y\fP indicate the position of the mouse pointer
+For \fBButtonPress\fR, \fBButtonRelease\fR, \fBMotion\fR,
+\fBKeyPress\fR, \fBKeyRelease\fR, and \fBMouseWheel\fR events,
+\fB%x\fR and \fB%y\fR indicate the position of the mouse pointer
relative to the receiving window.
-For \fBEnter\fP and \fBLeave\fP events, the position where the
+For \fBEnter\fR and \fBLeave\fR events, the position where the
mouse pointer crossed the window, relative to the receiving window.
-For \fBConfigure\fP and \fBCreate\fP requests, the \fIx\fP and \fIy\fP
+For \fBConfigure\fR and \fBCreate\fR requests, the \fIx\fR and \fIy\fR
coordinates of the window relative to its parent window.
.IP \fB%A\fR 5
Substitutes the UNICODE character corresponding to the event, or
-the empty string if the event doesn't correspond to a UNICODE character
+the empty string if the event does not correspond to a UNICODE character
(e.g. the shift key was pressed). \fBXmbLookupString\fR (or
\fBXLookupString\fR when input method support is turned off) does all
the work of translating from the event to a UNICODE character.
@@ -514,18 +532,19 @@ Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
The \fIborder_width\fR field from the event. Valid only for
\fBConfigure\fR, \fBConfigureRequest\fR, and \fBCreate\fR events.
.IP \fB%D\fR 5
-.VS
This reports the \fIdelta\fR value of a \fBMouseWheel\fR event. The
\fIdelta\fR value represents the rotation units the mouse wheel has
been moved. On Windows 95 & 98 systems the smallest value for the
delta is 120. Future systems may support higher resolution values for
the delta. The sign of the value represents the direction the mouse
wheel was scrolled.
-.VE
.IP \fB%E\fR 5
The \fIsend_event\fR field from the event. Valid for all event types.
-\fB0\fP indicates that this is a ``normal'' event, \fB1\fP indicates
-that it is a ``synthetic'' event generated by \fBSendEvent\fP.
+\fB0\fR indicates that this is a
+.QW normal
+event, \fB1\fR indicates that it is a
+.QW synthetic
+event generated by \fBSendEvent\fR.
.IP \fB%K\fR 5
The keysym corresponding to the event, substituted as a textual
string. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
@@ -535,7 +554,7 @@ number. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
.IP \fB%P\fR 5
The name of the property being updated or deleted (which
may be converted to an XAtom using \fBwinfo atom\fR.) Valid
-only for \fBProperty\fP events.
+only for \fBProperty\fR events.
.IP \fB%R\fR 5
The \fIroot\fR window identifier from the event. Valid only for
events containing a \fIroot\fR field.
@@ -548,27 +567,19 @@ The \fItype\fR field from the event. Valid for all event types.
.IP \fB%W\fR 5
The path name of the window to which the event was reported (the
\fIwindow\fR field from the event). Valid for all event types.
-.IP \fB%X\fR 5
-The \fIx_root\fR field from the event.
+.IP "\fB%X\fR, \fB%Y\fR" 5
+The \fIx_root\fR and \fIy_root\fR fields from the event.
If a virtual-root window manager is being used then the substituted
-value is the corresponding x-coordinate in the virtual root.
+values are the corresponding x-coordinate and y-coordinate in the virtual root.
Valid only for
\fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
and \fBMotion\fR events.
-Same meaning as \fB%x\fP, except relative to the (virtual) root window.
-.IP \fB%Y\fR 5
-The \fIy_root\fR field from the event.
-If a virtual-root window manager is being used then the substituted
-value is the corresponding y-coordinate in the virtual root.
-Valid only for
-\fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
-and \fBMotion\fR events.
-Same meaning as \fB%y\fP, except relative to the (virtual) root window.
+Same meaning as \fB%x\fR and \fB%y\fR, except relative to the (virtual) root
+window.
.LP
The replacement string for a %-replacement is formatted as a proper
Tcl list element.
-This means that it will be surrounded with braces
-if it contains spaces, or special characters such as \fB$\fR and
+This means that spaces or special characters such as \fB$\fR and
\fB{\fR may be preceded by backslashes.
This guarantees that the string will be passed through the Tcl
parser when the binding script is evaluated.
@@ -587,7 +598,7 @@ actually executed will be
.CE
This will cause the \fBinsert\fR to receive the original replacement
string (open square bracket) as its first argument.
-If the extra backslash hadn't been added, Tcl would not have been
+If the extra backslash had not been added, Tcl would not have been
able to parse the script correctly.
.SH "MULTIPLE MATCHES"
.PP
@@ -615,36 +626,43 @@ have the same \fItag\fR, then the most specific binding
is chosen and its script is evaluated.
The following tests are applied, in order, to determine which of
several matching sequences is more specific:
-(a) an event pattern that specifies a specific button or key is more specific
-than one that doesn't;
-(b) a longer sequence (in terms of number
+.RS
+.IP (a)
+an event pattern that specifies a specific button or key is more specific
+than one that does not;
+.IP (b)
+a longer sequence (in terms of number
of events matched) is more specific than a shorter sequence;
-(c) if the modifiers specified in one pattern are a subset of the
+.IP (c)
+if the modifiers specified in one pattern are a subset of the
modifiers in another pattern, then the pattern with more modifiers
is more specific.
-(d) a virtual event whose physical pattern matches the sequence is less
-specific than the same physical pattern that is not associated with a
+.IP (d)
+a virtual event whose physical pattern matches the sequence is less
+specific than the same physical pattern that is not associated with a
virtual event.
-(e) given a sequence that matches two or more virtual events, one
+.IP (e)
+given a sequence that matches two or more virtual events, one
of the virtual events will be chosen, but the order is undefined.
+.RE
.PP
If the matching sequences contain more than one event, then tests
-(c)-(e) are applied in order from the most recent event to the least recent
+(c)\-(e) are applied in order from the most recent event to the least recent
event in the sequences. If these tests fail to determine a winner, then the
most recently registered sequence is the winner.
.PP
If there are two (or more) virtual events that are both triggered by the
same sequence, and both of those virtual events are bound to the same window
tag, then only one of the virtual events will be triggered, and it will
-be picked at random:
+be picked at random:
.CS
-event add <<Paste>> <Control-y>
-event add <<Paste>> <Button-2>
-event add <<Scroll>> <Button-2>
+event add <<Paste>> <Control\-y>
+event add <<Paste>> <Button\-2>
+event add <<Scroll>> <Button\-2>
\fBbind\fR Entry <<Paste>> {puts Paste}
\fBbind\fR Entry <<Scroll>> {puts Scroll}
.CE
-If the user types Control-y, the \fB<<Paste>>\fR binding
+If the user types Control\-y, the \fB<<Paste>>\fR binding
will be invoked, but if the user presses button 2 then one of
either the \fB<<Paste>>\fR or the \fB<<Scroll>>\fR bindings will
be invoked, but exactly which one gets invoked is undefined.
@@ -658,12 +676,12 @@ When a \fIsequence\fR specified in a \fBbind\fR command contains
more than one event pattern, then its script is executed whenever
the recent events (leading up to and including the current event)
match the given sequence. This means, for example, that if button 1 is
-clicked repeatedly the sequence \fB<Double-ButtonPress-1>\fR will match
+clicked repeatedly the sequence \fB<Double\-ButtonPress\-1>\fR will match
each button press but the first.
If extraneous events that would prevent a match occur in the middle
of an event sequence then the extraneous events are
ignored unless they are \fBKeyPress\fR or \fBButtonPress\fR events.
-For example, \fB<Double-ButtonPress-1>\fR will match a sequence of
+For example, \fB<Double\-ButtonPress\-1>\fR will match a sequence of
presses of button 1, even though there will be \fBButtonRelease\fR
events (and possibly \fBMotion\fR events) between the
\fBButtonPress\fR events.
@@ -686,7 +704,7 @@ The \fBbgerror\fR command will be executed at global level
Arrange for a string describing the motion of the mouse to be printed
out when the mouse is double-clicked:
.CS
-\fBbind\fR . <Double-1> {
+\fBbind\fR . <Double\-1> {
puts "hi from (%x,%y)"
}
.CE
@@ -695,14 +713,12 @@ A little GUI that displays what the keysym name of the last key
pressed is:
.CS
set keysym "Press any key"
-pack [label .l -textvariable keysym -padx 2m -pady 1m]
+pack [label .l \-textvariable keysym \-padx 2m \-pady 1m]
\fBbind\fR . <Key> {
set keysym "You pressed %K"
}
.CE
-
.SH "SEE ALSO"
bgerror(n), bindtags(n), event(n), focus(n), grab(n), keysyms(n)
-
.SH KEYWORDS
binding, event
diff --git a/doc/bindtags.n b/doc/bindtags.n
index 8c6557a..c5cf71b 100644
--- a/doc/bindtags.n
+++ b/doc/bindtags.n
@@ -55,8 +55,9 @@ For example, the command
.CE
reverses the order in which binding scripts will be evaluated for
a button named \fB.b\fR so that \fBall\fR bindings are invoked
-first, following by bindings for \fB.b\fR's toplevel (``.''), followed by
-class bindings, followed by bindings for \fB.b\fR.
+first, following by bindings for \fB.b\fR's toplevel
+.PQ . "" ,
+followed by class bindings, followed by bindings for \fB.b\fR.
If \fItagList\fR is an empty list then the binding tags for \fIwindow\fR
are returned to the default state described above.
.PP
@@ -94,7 +95,7 @@ proc setupBindtagsForTreeDelivery {widget} {
.CE
.SH "SEE ALSO"
-bind
+bind(n)
.SH KEYWORDS
binding, event, tag
diff --git a/doc/button.n b/doc/button.n
index 3ca4c4d..4b655a4 100644
--- a/doc/button.n
+++ b/doc/button.n
@@ -30,7 +30,6 @@ Specifies a Tcl command to associate with the button. This command
is typically invoked when mouse button 1 is released over the button
window.
.OP \-default default Default
-.VS
Specifies one of three states for the default ring: \fBnormal\fR,
\fBactive\fR, or \fBdisabled\fR. In active state, the button is drawn
with the platform specific appearance for a default button. In normal
@@ -41,15 +40,13 @@ the same size. In disabled state, the button is drawn with the
non-default button appearance without leaving space for the default
appearance. The disabled state may result in a smaller button than
the active state.
-.VE
.OP \-height height Height
Specifies a desired height for the button.
If an image or bitmap is being displayed in the button then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in lines of text.
-If this option isn't specified, the button's desired height is computed
+If this option is not specified, the button's desired height is computed
from the size of the image or bitmap or text being displayed in it.
-.VS 8.4
.OP \-overrelief overRelief OverRelief
Specifies an alternative relief for the button, to be used when the
mouse cursor is over the widget. This option can be used to make
@@ -57,7 +54,6 @@ toolbar buttons, by configuring \fB\-relief flat \-overrelief
raised\fR. If the value of this option is the empty string, then no
alternative relief is used when the mouse cursor is over the button.
The empty string is the default value.
-.VE 8.4
.OP \-state state State
Specifies one of three states for the button: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the button is displayed using the
@@ -72,9 +68,11 @@ In this state the \fBdisabledForeground\fR and
.OP \-width width Width
Specifies a desired width for the button.
If an image or bitmap is being displayed in the button then the value is in
-screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
-for text it is in characters.
-If this option isn't specified, the button's desired width is computed
+screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR).
+For a text button (no image or with \fB\-compound none\fR) then the width
+specifies how much space in characters to allocate for the text label.
+If the width is negative then this specifies a minimum width.
+If this option is not specified, the button's desired width is computed
from the size of the image or bitmap or text being displayed in it.
.BE
@@ -159,10 +157,8 @@ default behavior:
.IP [1]
A button activates whenever the mouse passes over it and deactivates
whenever the mouse leaves the button.
-.VS
Under Windows, this binding is only active when mouse button 1 has
been pressed over the button.
-.VE
.IP [2]
A button's relief is changed to sunken whenever mouse button 1 is
pressed over the button, and the relief is restored to its original
@@ -181,5 +177,26 @@ actions occur: the button is completely non-responsive.
The behavior of buttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
+.SH EXAMPLES
+This is the classic Tk
+.QW "Hello, World!"
+demonstration:
+.PP
+.CS
+ \fBbutton\fR .b \-text "Hello, World!" \-command exit
+ pack .b
+.CE
+.PP
+This example demonstrates how to handle button accelerators:
+.PP
+.CS
+ \fBbutton\fR .b1 \-text Hello \-underline 0
+ \fBbutton\fR .b2 \-text World \-underline 0
+ bind . <Key\-h> {.b1 flash; .b1 invoke}
+ bind . <Key\-w> {.b2 flash; .b2 invoke}
+ pack .b1 .b2
+.CE
+.SH "SEE ALSO"
+ttk::button(n)
.SH KEYWORDS
button, widget
diff --git a/doc/canvas.n b/doc/canvas.n
index 6a308a0..bdf1e62 100644
--- a/doc/canvas.n
+++ b/doc/canvas.n
@@ -15,19 +15,19 @@ canvas \- Create and manipulate canvas widgets
.SH SYNOPSIS
\fBcanvas\fR \fIpathName \fR?\fIoptions\fR?
.SO
-\-background \-insertborderwidth \-selectborderwidth
-\-borderwidth \-insertofftime \-selectforeground
-\-cursor \-insertontime \-takefocus
-\-highlightbackground \-insertwidth \-xscrollcommand
-\-highlightcolor \-relief \-yscrollcommand
-\-highlightthickness \-state
-\-insertbackground \-selectbackground
+\-background \-borderwidth \-cursor
+\-highlightbackground \-highlightcolor \-highlightthickness
+\-insertbackground \-insertborderwidth \-insertofftime
+\-insertontime \-insertwidth \-relief
+\-selectbackground \-selectborderwidth \-selectforeground
+\-takefocus \-xscrollcommand \-yscrollcommand
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-closeenough closeEnough CloseEnough
Specifies a floating-point value indicating how close the mouse cursor
-must be to an item before it is considered to be ``inside'' the item.
-Defaults to 1.0.
+must be to an item before it is considered to be
+.QW inside
+the item. Defaults to 1.0.
.OP \-confine confine Confine
Specifies a boolean value that indicates whether or not it should be
allowable to set the canvas's view outside the region defined by the
@@ -80,7 +80,6 @@ are selected) will also be \fByScrollIncrement\fR. If the value of
this option is less than or equal to zero, then vertical scrolling
is unconstrained.
.BE
-
.SH INTRODUCTION
.PP
The \fBcanvas\fR command creates a new window (given
@@ -110,8 +109,9 @@ The items in a canvas are ordered for purposes of display,
with the first item in the display list being displayed
first, followed by the next item in the list, and so on.
Items later in the display list obscure those that are
-earlier in the display list and are sometimes referred to
-as being ``on top'' of earlier items.
+earlier in the display list and are sometimes referred to as being
+.QW "on top"
+of earlier items.
When a new item is created it is placed at the end of the
display list, on top of everything else.
Widget commands may be used to re-arrange the order of the
@@ -134,11 +134,15 @@ canvas widget.
Each item may also have any number of \fItags\fR associated
with it. A tag is just a string of characters, and it may
take any form except that of an integer.
-For example, ``x123'' is OK but ``123'' isn't.
+For example,
+.QW x123
+is OK but
+.QW 123
+is not.
The same tag may be associated with many different items.
This is commonly done to group items in various interesting
-ways; for example, all selected items might be given the
-tag ``selected''.
+ways; for example, all selected items might be given the tag
+.QW selected .
.PP
The tag \fBall\fR is implicitly associated with every item
in the canvas; it may be used to invoke operations on
@@ -147,7 +151,8 @@ all the items in the canvas.
The tag \fBcurrent\fR is managed automatically by Tk;
it applies to the \fIcurrent item\fR, which is the
topmost item whose drawn area covers the position of
-the mouse cursor.
+the mouse cursor (different item types interpret this in varying ways; see the
+individual item type documentation for details).
If the mouse is not in the canvas widget or is not over
an item, then no item has the \fBcurrent\fR tag.
.PP
@@ -162,8 +167,12 @@ an argument specifies either an id that selects a single
item or a tag that selects zero or more items.
.PP
\fItagOrId\fR may contain a logical expressions of
-tags by using operators: '&&', '||', '^' '!', and parenthesized
-subexpressions. For example:
+tags by using operators:
+.QW \fB&&\fR ,
+.QW \fB||\fR ,
+.QW \fB^\fR ,
+.QW \fB!\fR ,
+and parenthesized subexpressions. For example:
.CS
.c find withtag {(a&&!b)||(!a&&b)}
.CE
@@ -171,7 +180,11 @@ or equivalently:
.CS
.c find withtag {a^b}
.CE
-will find only those items with either "a" or "b" tags, but not both.
+will find only those items with either
+.QW a
+or
+.QW b
+tags, but not both.
.PP
Some widget commands only operate on a single item at a
time; if \fItagOrId\fR is specified in a way that
@@ -193,12 +206,10 @@ the screen; if it is \fBc\fR then the distance is in centimeters;
\fBi\fR means inches, and \fBp\fR means printers points (1/72 inch).
Larger y-coordinates refer to points lower on the screen; larger
x-coordinates refer to points farther to the right.
-.VS
Coordinates can be specified either as an even number of parameters,
or as a single list parameter containing an even number of x and y
coordinate values.
-.VE
-.SH TRANSFORMATIONS
+.SS TRANSFORMATIONS
.PP
Normally the origin of the canvas coordinate system is at the
upper-left corner of the window containing the canvas.
@@ -238,7 +249,7 @@ support as many of these forms as practical.
Note that it is possible to refer to the character just after
the last one in the text item; this is necessary for such
tasks as inserting new text at the end of the item.
-Lines and Polygons don't support the insertion cursor
+Lines and Polygons do not support the insertion cursor
and the selection. Their indices are supposed to be even
always, because coordinates always appear in pairs.
.TP 10
@@ -267,11 +278,11 @@ is drawn in this item. Not valid for lines and polygons.
.TP 10
\fBsel.first\fR
Refers to the first selected character in the item.
-If the selection isn't in this item then this form is illegal.
+If the selection is not in this item then this form is illegal.
.TP 10
\fBsel.last\fR
Refers to the last selected character in the item.
-If the selection isn't in this item then this form is illegal.
+If the selection is not in this item then this form is illegal.
.TP 10
\fB@\fIx,y\fR
Refers to the character or coordinate at the point given by \fIx\fR and
@@ -286,24 +297,32 @@ Many items support the notion of a dash pattern for outlines.
.PP
The first possible syntax is a list of integers. Each element
represents the number of pixels of a line segment. Only the odd
-segments are drawn using the "outline" color. The other segments
-are drawn transparent.
+segments are drawn using the
+.QW outline
+color. The other segments are drawn transparent.
.PP
The second possible syntax is a character list containing only
-5 possible characters \fB[.,-_ ]\fR. The space can be used
-to enlarge the space between other line elements, and can not
+5 possible characters
+.QW "\fB.,\-_ \fR" .
+The space can be used
+to enlarge the space between other line elements, and cannot
occur as the first position in the string. Some examples:
- -dash . = -dash {2 4}
- -dash - = -dash {6 4}
- -dash -. = -dash {6 4 2 4}
- -dash -.. = -dash {6 4 2 4 2 4}
- -dash {. } = -dash {2 8}
- -dash , = -dash {4 4}
+.CS
+\-dash . \(-> \-dash {2 4}
+\-dash \- \(-> \-dash {6 4}
+\-dash \-. \(-> \-dash {6 4 2 4}
+\-dash \-.. \(-> \-dash {6 4 2 4 2 4}
+\-dash {. } \(-> \-dash {2 8}
+\-dash , \(-> \-dash {4 4}
+.CE
.PP
The main difference of this syntax with the previous is that it
is shape-conserving. This means that all values in the dash
list will be multiplied by the line width before display. This
-assures that "." will always be displayed as a dot and "-"
+assures that
+.QW .
+will always be displayed as a dot and
+.QW \-
always as a dash regardless of the line width.
.PP
On systems which support only a limited set of dash patterns, the dash
@@ -328,7 +347,7 @@ The following widget commands are possible for canvas widgets:
For each item that meets the constraints specified by
\fIsearchSpec\fR and the \fIarg\fRs, add
\fItag\fR to the list of tags associated with the item if it
-isn't already present on that list.
+is not already present on that list.
It is possible that no items will satisfy the constraints
given by \fIsearchSpec\fR and \fIarg\fRs, in which case the
command has no effect.
@@ -391,7 +410,9 @@ Selects all the items given by \fItagOrId\fR.
\fIpathName \fBbbox \fItagOrId\fR ?\fItagOrId tagOrId ...\fR?
Returns a list with four elements giving an approximate bounding box
for all the items named by the \fItagOrId\fR arguments.
-The list has the form ``\fIx1 y1 x2 y2\fR'' such that the drawn
+The list has the form
+.QW "\fIx1 y1 x2 y2\fR"
+such that the drawn
areas of all the named elements are within the region bounded by
\fIx1\fR on the left, \fIx2\fR on the right, \fIy1\fR on the top,
and \fIy2\fR on the bottom.
@@ -414,8 +435,9 @@ on the syntax of \fIsequence\fR and the substitutions performed
on \fIcommand\fR before invoking it.
If all arguments are specified then a new binding is created, replacing
any existing binding for the same \fIsequence\fR and \fItagOrId\fR
-(if the first character of \fIcommand\fR is ``+'' then \fIcommand\fR
-augments an existing binding rather than replacing it).
+(if the first character of \fIcommand\fR is
+.QW +
+then \fIcommand\fR augments an existing binding rather than replacing it).
In this case the return value is an empty string.
If \fIcommand\fR is omitted then the command returns the \fIcommand\fR
associated with \fItagOrId\fR and \fIsequence\fR (an error occurs
@@ -428,8 +450,9 @@ defined for \fItagOrId\fR.
The only events for which bindings may be specified are those related to
the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.
-The handling of events in canvases uses the current item defined in ITEM
-IDS AND TAGS above. \fBEnter\fR and \fBLeave\fR events trigger for an
+The handling of events in canvases uses the current item defined in
+\fBITEM IDS AND TAGS\fR above. \fBEnter\fR and \fBLeave\fR events
+trigger for an
item when it becomes the current item or ceases to be the current item;
note that these events are different than \fBEnter\fR and \fBLeave\fR
events for windows. Mouse-related events are directed to the current
@@ -519,11 +542,11 @@ This command returns the id for the new item.
\fIpathName \fBdchars \fItagOrId first \fR?\fIlast\fR?
For each item given by \fItagOrId\fR, delete the characters, or coordinates,
in the range given by \fIfirst\fR and \fIlast\fR, inclusive.
-If some of the items given by \fItagOrId\fR don't support
+If some of the items given by \fItagOrId\fR do not support
indexing operations then they ignore dchars.
Text items interpret \fIfirst\fR and \fIlast\fR as indices to a character,
line and polygon items interpret them indices to a coordinate (an x,y pair).
-Indices are described in INDICES above.
+Indices are described in \fBINDICES\fR above.
If \fIlast\fR is omitted, it defaults to \fIfirst\fR.
This command returns an empty string.
.TP
@@ -535,7 +558,7 @@ an empty string.
For each of the items given by \fItagOrId\fR, delete the
tag given by \fItagToDelete\fR from the list of those
associated with the item.
-If an item doesn't have the tag \fItagToDelete\fR then
+If an item does not have the tag \fItagToDelete\fR then
the item is unaffected by the command.
If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR.
This command returns an empty string.
@@ -554,8 +577,8 @@ Set the keyboard focus for the canvas widget to the item given by
If \fItagOrId\fR refers to several items, then the focus is set
to the first such item in the display list that supports the
insertion cursor.
-If \fItagOrId\fR doesn't refer to any items, or if none of them
-support the insertion cursor, then the focus isn't changed.
+If \fItagOrId\fR does not refer to any items, or if none of them
+support the insertion cursor, then the focus is not changed.
If \fItagOrId\fR is an empty
string, then the focus item is reset so that no item has the focus.
If \fItagOrId\fR is not specified then the command returns the
@@ -568,12 +591,12 @@ the insertion cursor and all keyboard events will be directed
to that item.
The focus item within a canvas and the focus window on the
screen (set with the \fBfocus\fR command) are totally independent:
-a given item doesn't actually have the input focus unless (a)
+a given item does not actually have the input focus unless (a)
its canvas is the focus window and (b) the item is the focus item
within the canvas.
In most cases it is advisable to follow the \fBfocus\fR widget
command with the \fBfocus\fR command to set the focus window to
-the canvas (if it wasn't there already).
+the canvas (if it was not there already).
.RE
.TP
\fIpathName \fBgettags\fR \fItagOrId\fR
@@ -581,27 +604,27 @@ Return a list whose elements are the tags associated with the
item given by \fItagOrId\fR.
If \fItagOrId\fR refers to more than one item, then the tags
are returned from the first such item in the display list.
-If \fItagOrId\fR doesn't refer to any items, or if the item
+If \fItagOrId\fR does not refer to any items, or if the item
contains no tags, then an empty string is returned.
.TP
\fIpathName \fBicursor \fItagOrId index\fR
Set the position of the insertion cursor for the item(s) given by \fItagOrId\fR
to just before the character whose position is given by \fIindex\fR.
-If some or all of the items given by \fItagOrId\fR don't support
+If some or all of the items given by \fItagOrId\fR do not support
an insertion cursor then this command has no effect on them.
-See INDICES above for a description of the
+See \fBINDICES\fR above for a description of the
legal forms for \fIindex\fR.
Note: the insertion cursor is only displayed in an item if
that item currently has the keyboard focus (see the widget
command \fBfocus\fR, below), but the cursor position may
-be set even when the item doesn't have the focus.
+be set even when the item does not have the focus.
This command returns an empty string.
.TP
\fIpathName \fBindex \fItagOrId index\fR
This command returns a decimal string giving the numerical index
within \fItagOrId\fR corresponding to \fIindex\fR.
\fIIndex\fR gives a textual description of the desired position
-as described in INDICES above.
+as described in \fBINDICES\fR above.
Text items interpret \fIindex\fR as an index to a character,
line and polygon items interpret it as an index to a coordinate (an x,y pair).
The return value is guaranteed to lie between 0 and the number
@@ -618,7 +641,7 @@ Text items interpret \fIbeforeThis\fR as an index to a character,
line and polygon items interpret it as an index to a coordinate (an x,y pair).
For lines and polygons the \fIstring\fR must be a valid coordinate
sequence.
-See INDICES above for information about the forms allowed
+See \fBINDICES\fR above for information about the forms allowed
for \fIbeforeThis\fR.
This command returns an empty string.
.TP
@@ -691,7 +714,7 @@ Note: by default Postscript is only generated for information that
appears in the canvas's window on the screen. If the canvas is
freshly created it may still have its initial size of 1x1 pixel
so nothing will appear in the Postscript. To get around this problem
-either invoke the "update" command to wait for the canvas window
+either invoke the \fBupdate\fR command to wait for the canvas window
to reach its final size, or else use the \fB\-width\fR and \fB\-height\fR
options to specify the area of the canvas to print.
The \fIoption\fR\-\fIvalue\fR argument pairs provide additional
@@ -703,13 +726,14 @@ options are supported:
\fIVarName\fR must be the name of an array variable
that specifies a color mapping to use in the Postscript.
Each element of \fIvarName\fR must consist of Postscript
-code to set a particular color value (e.g. ``\fB1.0 1.0 0.0 setrgbcolor\fR'').
+code to set a particular color value (e.g.
+.QW "\fB1.0 1.0 0.0 setrgbcolor\fR" ).
When outputting color information in the Postscript, Tk checks
to see if there is an element of \fIvarName\fR with the same
name as the color.
If so, Tk uses the value of the element as the Postscript command
to set the color.
-If this option hasn't been specified, or if there isn't an entry
+If this option has not been specified, or if there is no entry
in \fIvarName\fR for a given color, then Tk uses the red, green,
and blue intensities from the X color.
.TP
@@ -721,7 +745,7 @@ to black or white).
.TP
\fB\-file \fIfileName\fR
Specifies the name of the file in which to write the Postscript.
-If this option isn't specified then the Postscript is returned as the
+If this option is not specified then the Postscript is returned as the
result of the command instead of being written to a file.
.TP
\fB\-fontmap \fIvarName\fR
@@ -792,9 +816,10 @@ Defaults to the center of the page.
\fIBoolean\fR specifies whether the printed area is to be rotated 90
degrees.
In non-rotated output the x-axis of the printed area runs along
-the short dimension of the page (``portrait'' orientation);
-in rotated output the x-axis runs along the long dimension of the
-page (``landscape'' orientation).
+the short dimension of the page
+.PQ portrait orientation ;
+in rotated output the x-axis runs along the long dimension of the page
+.PQ landscape orientation .
Defaults to non-rotated.
.TP
\fB\-width \fIsize\fR
@@ -875,7 +900,7 @@ an item that supports indexing and selection; if it refers to
multiple items then the first of
these that supports indexing and the selection is used.
\fIIndex\fR gives a textual description of a position
-within \fItagOrId\fR, as described in INDICES above.
+within \fItagOrId\fR, as described in \fBINDICES\fR above.
.RS
.TP
\fIpathName \fBselect adjust \fItagOrId index\fR
@@ -885,14 +910,14 @@ end of the selection to be at \fIindex\fR (i.e. including
but not going beyond \fIindex\fR).
The other end of the selection is made the anchor point
for future \fBselect to\fR commands.
-If the selection isn't currently in \fItagOrId\fR then
+If the selection is not currently in \fItagOrId\fR then
this command behaves the same as the \fBselect to\fR widget
command.
Returns an empty string.
.TP
\fIpathName \fBselect clear\fR
Clear the selection if it is in this widget.
-If the selection isn't in this widget then the command
+If the selection is not in this widget then the command
has no effect.
Returns an empty string.
.TP
@@ -900,7 +925,7 @@ Returns an empty string.
Set the selection anchor point for the widget to be just
before the character
given by \fIindex\fR in the item given by \fItagOrId\fR.
-This command doesn't change the selection; it just sets
+This command does not change the selection; it just sets
the fixed end of the selection for future \fBselect to\fR
commands.
Returns an empty string.
@@ -920,7 +945,7 @@ it will include the character given by the anchor point only if
\fIindex\fR is greater than or equal to the anchor point.
The anchor point is determined by the most recent \fBselect adjust\fR
or \fBselect from\fR command for this widget.
-If the selection anchor point for the widget isn't currently in
+If the selection anchor point for the widget is not currently in
\fItagOrId\fR, then it is set to the same character given
by \fIindex\fR.
Returns an empty string.
@@ -931,7 +956,7 @@ Returns the type of the item given by \fItagOrId\fR, such as
\fBrectangle\fR or \fBtext\fR.
If \fItagOrId\fR refers to more than one item, then the type
of the first item in the display list is returned.
-If \fItagOrId\fR doesn't refer to any items at all then
+If \fItagOrId\fR does not refer to any items at all then
an empty string is returned.
.TP
\fIpathName \fBxview \fR?\fIargs\fR?
@@ -1015,14 +1040,14 @@ first, the form of the \fBcreate\fR command used to create
instances of the type; and second, a set of configuration options
for items of that type, which may be used in the
\fBcreate\fR and \fBitemconfigure\fR widget commands.
-Most items don't support indexing or selection or the commands
+Most items do not support indexing or selection or the commands
related to them, such as \fBindex\fR and \fBinsert\fR.
Where items do support these facilities, it is noted explicitly
in the descriptions below.
At present, text, line and polygon items provide this support.
For lines and polygons the indexing facility is used to manipulate
the coordinates of the item.
-.SH "COMMON ITEM OPTIONS"
+.SS "COMMON ITEM OPTIONS"
.PP
Many items share a common set of options. These options are
explained here, and then referred to be each widget type for brevity.
@@ -1037,12 +1062,12 @@ This option specifies dash patterns for the normal, active
state, and disabled state of an item.
\fIpattern\fR may have any of the forms accepted by \fBTk_GetDash\fR.
If the dash options are omitted then the default is a solid outline.
-See "DASH PATTERNS" for more information.
+See \fBDASH PATTERNS\fR for more information.
.TP
\fB\-dashoffset \fIoffset\fR
The starting \fIoffset\fR in pixels into the pattern provided by the
\fB\-dash\fR option. \fB\-dashoffset\fR is ignored if there is no
-\fB-dash\fR pattern. The \fIoffset\fR may have any of the forms described
+\fB\-dash\fR pattern. The \fIoffset\fR may have any of the forms described
in the \fBCOORDINATES\fR section above.
.TP
\fB\-fill \fIcolor\fR
@@ -1076,7 +1101,7 @@ Specifies the offset of stipples. The offset value can be of the form
first case the origin is the origin of the toplevel of the current window.
For the canvas itself and canvas objects the origin is the canvas origin,
but putting \fB#\fR in front of the coordinate pair indicates using the
-toplevel origin instead. For canvas objects, the \fB-offset\fR option is
+toplevel origin instead. For canvas objects, the \fB\-offset\fR option is
used for stippling as well. For the line and polygon canvas items you can
also specify an index as argument, which connects the stipple origin to one
of the coordinate points of the line/polygon.
@@ -1091,13 +1116,24 @@ outline of the item in its normal, active and disabled states.
Indicates that the outline for the item should be drawn with a stipple pattern;
\fIbitmap\fR specifies the stipple pattern to use, in any of the
forms accepted by \fBTk_GetBitmap\fR.
-If the \fB\-outline\fR option hasn't been specified then this option
+If the \fB\-outline\fR option has not been specified then this option
has no effect.
If \fIbitmap\fR is an empty string (the default), then the outline is drawn
in a solid fashion.
\fINote that stipples are not well supported on platforms that do not
use X11 as their drawing API.\fR
.TP
+\fB\-outlineoffset \fIoffset\fR
+.
+Specifies the offset of the stipple pattern used for outlines. The
+offset value can be of the form
+.QW \fIx\fB,\fIy\fR
+or the description of a side (one of \fBn\fR, \fBne\fR, \fBe\fR,
+\fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR). This
+option only has an effect when the outline is drawn as a stipple
+pattern, and is only supported under X11.
+.\" TODO: What does this actually do? What do the acceptable forms mean?!
+.TP
\fB\-stipple \fIbitmap\fR
.TP
\fB\-activestipple \fIbitmap\fR
@@ -1107,7 +1143,7 @@ This option specifies stipple patterns that should be used to fill
the item in its normal, active and disabled states.
\fIbitmap\fR specifies the stipple pattern to use, in any of the
forms accepted by \fBTk_GetBitmap\fR.
-If the \fB\-fill\fR option hasn't been specified then this option
+If the \fB\-fill\fR option has not been specified then this option
has no effect.
If \fIbitmap\fR is an empty string (the default), then filling is done
in a solid fashion.
@@ -1156,8 +1192,10 @@ After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. An arc item becomes the current item when the mouse pointer is
+over any part that is painted or (when fully transparent) that would be
+painted if both the \fB\-fill\fR and \fB\-outline\fR options were non-empty.
+.PP
The following standard options are supported by arcs:
.CS
\-dash
@@ -1171,6 +1209,7 @@ The following standard options are supported by arcs:
\-outline
\-activeoutline
\-disabledoutline
+\-outlineoffset
\-outlinestipple
\-activeoutlinestipple
\-disabledoutlinestipple
@@ -1190,7 +1229,7 @@ Specifies the size of the angular range occupied by the arc.
The arc's range extends for \fIdegrees\fR degrees counter-clockwise
from the starting angle given by the \fB\-start\fR option.
\fIDegrees\fR may be negative.
-If it is greater than 360 or less than -360, then \fIdegrees\fR
+If it is greater than 360 or less than \-360, then \fIdegrees\fR
modulo 360 is used as the extent.
.TP
\fB\-start \fIdegrees\fR
@@ -1219,15 +1258,17 @@ Bitmaps are created with widget commands of the following form:
\fIpathName \fBcreate bitmap \fIx y \fR?\fIoption value option value ...\fR?
\fIpathName \fBcreate bitmap \fIcoordList\fR ?\fIoption value option value ...\fR?
.CE
-The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
+The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR (which must have two
+elements) specify the coordinates of a
point used to position the bitmap on the display (see the \fB\-anchor\fR
option below for more information on how bitmaps are displayed).
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. A bitmap item becomes the current item when the mouse pointer
+is over any part of its bounding box.
+.PP
The following standard options are supported by bitmaps:
.CS
\-state
@@ -1249,10 +1290,11 @@ This option defaults to \fBcenter\fR.
\fB\-activebackground \fIbitmap\fR
.TP
\fB\-disabledbackground \fIbitmap\fR
-Specifies the color to use for each of the bitmap's '0' valued pixels
-in its normal, active and disabled states.
+Specifies the color to use for each of the bitmap's
+.QW 0
+valued pixels in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
-If this option isn't specified, or if it is specified as an empty
+If this option is not specified, or if it is specified as an empty
string, then nothing is displayed where the bitmap pixels are 0; this
produces a transparent effect.
.TP
@@ -1270,8 +1312,9 @@ disabled states.
\fB\-activeforeground \fIbitmap\fR
.TP
\fB\-disabledforeground \fIbitmap\fR
-Specifies the color to use for each of the bitmap's '1' valued pixels
-in its normal, active and disabled states.
+Specifies the color to use for each of the bitmap's
+.QW 1
+valued pixels in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR and
defaults to \fBblack\fR.
.SH "IMAGE ITEMS"
@@ -1290,8 +1333,9 @@ After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. An image item becomes the current item when the mouse pointer
+is over any part of its bounding box.
+.PP
The following standard options are supported by images:
.CS
\-state
@@ -1335,8 +1379,10 @@ After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. A line item is the current item whenever the mouse pointer is
+over any segment of the line, whether drawn or not and whether or not the line
+is smoothed.
+.PP
The following standard options are supported by lines:
.CS
\-dash
@@ -1377,14 +1423,16 @@ The second element gives the distance along the line from the
trailing points of the arrowhead to the tip, and the third
element gives the distance from the outside edge of the line to the
trailing points.
-If this option isn't specified then Tk picks a ``reasonable'' shape.
+If this option is not specified then Tk picks a
+.QW reasonable
+shape.
.TP
\fB\-capstyle \fIstyle\fR
Specifies the ways in which caps are to be drawn at the endpoints
of the line.
\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
(\fBbutt\fR, \fBprojecting\fR, or \fBround\fR).
-If this option isn't specified then it defaults to \fBbutt\fR.
+If this option is not specified then it defaults to \fBbutt\fR.
Where arrowheads are drawn the cap style is ignored.
.TP
\fB\-joinstyle \fIstyle\fR
@@ -1392,27 +1440,38 @@ Specifies the ways in which joints are to be drawn at the vertices
of the line.
\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
(\fBbevel\fR, \fBmiter\fR, or \fBround\fR).
-If this option isn't specified then it defaults to \fBmiter\fR.
+If this option is not specified then it defaults to \fBround\fR.
If the line only contains two points then this option is
irrelevant.
.TP
\fB\-smooth \fIsmoothMethod\fR
\fIsmoothMethod\fR must have one of the forms accepted by
-\fBTcl_GetBoolean\fR or a line smoothing method. Only \fBbezier\fR is
-supported in the core, but more can be added at runtime. If a boolean
+\fBTcl_GetBoolean\fR or a line smoothing method.
+.VS 8.5
+Only \fBtrue\fR and \fBraw\fR are
+supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean
false value or empty string is given, no smoothing is applied. A boolean
-truth value assume \fBbezier\fR smoothing.
-It indicates whether or not the line should be drawn as a curve.
-If so, the line is rendered as a set of parabolic splines: one spline
+truth value assumes \fBtrue\fR smoothing.
+If the smoothing method is \fBtrue\fR, this indicates that the line
+should be drawn as a curve, rendered as a set of quadratic splines: one spline
is drawn for the first and second line segments, one for the second
and third, and so on. Straight-line segments can be generated within
a curve by duplicating the end-points of the desired line segment.
+If the smoothing method is \fBraw\fR, this indicates that the line
+should also be drawn as a curve but where the list of coordinates is
+such that the first coordinate pair (and every third coordinate pair
+thereafter) is a knot point on a cubic Bezier curve, and the other
+coordinates are control points on the cubic Bezier curve. Straight
+line segments can be generated within a curve by making control points
+equal to their neighbouring knot points. If the last point is a
+control point and not a knot point, the point is repeated (one or two
+times) so that it also becomes a knot point.
+.VE 8.5
.TP
\fB\-splinesteps \fInumber\fR
Specifies the degree of smoothness desired for curves: each spline
will be approximated with \fInumber\fR line segments. This
-option is ignored unless the \fB\-smooth\fR option is true.
-
+option is ignored unless the \fB\-smooth\fR option is true or \fBraw\fR.
.SH "OVAL ITEMS"
.PP
Items of type \fBoval\fR appear as circular or oval regions on
@@ -1434,8 +1493,10 @@ After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. An oval item becomes the current item when the mouse pointer is
+over any part that is painted or (when fully transparent) that would be
+painted if both the \fB\-fill\fR and \fB\-outline\fR options were non-empty.
+.PP
The following standard options are supported by ovals:
.CS
\-dash
@@ -1449,6 +1510,7 @@ The following standard options are supported by ovals:
\-outline
\-activeoutline
\-disabledoutline
+\-outlineoffset
\-outlinestipple
\-activeoutlinestipple
\-disabledoutlinestipple
@@ -1481,8 +1543,10 @@ After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. A polygon item is the current item whenever the mouse pointer
+is over any part of the polygon, whether drawn or not and whether or not the
+outline is smoothed.
+.PP
The following standard options are supported by polygons:
.CS
\-dash
@@ -1515,25 +1579,41 @@ Specifies the ways in which joints are to be drawn at the vertices
of the outline.
\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
(\fBbevel\fR, \fBmiter\fR, or \fBround\fR).
-If this option isn't specified then it defaults to \fBmiter\fR.
+If this option is not specified then it defaults to \fBround\fR.
.TP
\fB\-smooth \fIboolean\fR
-\fIBoolean\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR.
-It indicates whether or not the polygon should be drawn with a
-curved perimeter.
-If so, the outline of the polygon becomes a set of parabolic splines,
-one spline for the first and second line segments, one for the second
-and third, and so on. Straight-line segments can be generated in a
-smoothed polygon by duplicating the end-points of the desired line segment.
+\fIBoolean\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR
+.VS 8.5
+or a line smoothing method. Only \fBtrue\fR and \fBraw\fR are
+supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean
+false value or empty string is given, no smoothing is applied. A boolean
+truth value assumes \fBtrue\fR smoothing.
+If the smoothing method is \fBtrue\fR, this indicates that the polygon
+should be drawn as a curve, rendered as a set of quadratic splines: one spline
+is drawn for the first and second line segments, one for the second
+and third, and so on. Straight-line segments can be generated within
+a curve by duplicating the end-points of the desired line segment.
+If the smoothing method is \fBraw\fR, this indicates that the polygon
+should also be drawn as a curve but where the list of coordinates is
+such that the first coordinate pair (and every third coordinate pair
+thereafter) is a knot point on a cubic Bezier curve, and the other
+coordinates are control points on the cubic Bezier curve. Straight
+line segments can be venerated within a curve by making control points
+equal to their neighbouring knot points. If the last point is not the
+second point of a pair of control points, the point is repeated (one or two
+times) so that it also becomes the second point of a pair of control
+points (the associated knot point will be the first control point).
+.VE 8.5
.TP
\fB\-splinesteps \fInumber\fR
Specifies the degree of smoothness desired for curves: each spline
will be approximated with \fInumber\fR line segments. This
-option is ignored unless the \fB\-smooth\fR option is true.
+option is ignored unless the \fB\-smooth\fR option is true or \fBraw\fR.
.PP
Polygon items are different from other items such as rectangles, ovals
-and arcs in that interior points are considered to be ``inside'' a
-polygon (e.g. for purposes of the \fBfind closest\fR and
+and arcs in that interior points are considered to be
+.QW inside
+a polygon (e.g. for purposes of the \fBfind closest\fR and
\fBfind overlapping\fR widget commands) even if it is not filled.
For most other item types, an
interior point is considered to be inside the item only if the item
@@ -1550,7 +1630,8 @@ following form:
\fIpathName \fBcreate rectangle \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR?
\fIpathName \fBcreate rectangle \fIcoordList\fR ?\fIoption value option value ...\fR?
.CE
-The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give
+The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR
+(which must have four elements) give
the coordinates of two diagonally opposite corners of the rectangle
(the rectangle will include its upper and left edges but not
its lower or right edges).
@@ -1558,8 +1639,11 @@ After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. A rectangle item becomes the current item when the mouse
+pointer is over any part that is painted or (when fully transparent) that
+would be painted if both the \fB\-fill\fR and \fB\-outline\fR options were
+non-empty.
+.PP
The following standard options are supported by rectangles:
.CS
\-dash
@@ -1573,6 +1657,7 @@ The following standard options are supported by rectangles:
\-outline
\-activeoutline
\-disabledoutline
+\-outlineoffset
\-outlinestipple
\-activeoutlinestipple
\-disabledoutlinestipple
@@ -1599,15 +1684,17 @@ form:
\fIpathName \fBcreate text \fIx y \fR?\fIoption value option value ...\fR?
\fIpathName \fBcreate text \fIcoordList\fR ?\fIoption value option value ...\fR?
.CE
-The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
+The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR (which must have two
+elements) specify the coordinates of a
point used to position the text on the display (see the options
below for more information on how text is displayed).
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. A text item becomes the current item when the mouse pointer
+is over any part of its bounding box.
+.PP
The following standard options are supported by text items:
.CS
\-fill
@@ -1634,7 +1721,7 @@ This option defaults to \fBcenter\fR.
\fB\-font \fIfontName\fR
Specifies the font to use for the text item.
\fIFontName\fR may be any string acceptable to \fBTk_GetFont\fR.
-If this option isn't specified, it defaults to a system-dependent
+If this option is not specified, it defaults to a system-dependent
font.
.TP
\fB\-justify \fIhow\fR
@@ -1651,6 +1738,15 @@ Newline characters cause line breaks.
The characters in the item may also be changed with the
\fBinsert\fR and \fBdelete\fR widget commands.
This option defaults to an empty string.
+.VS 8.5
+.TP
+\fB\-underline \fI\fR
+Specifies the integer index of a character within the text to be
+underlined. 0 corresponds to the first character of the text
+displayed, 1 to the next character, and so on. \-1 means that no
+underline should be drawn (if the whole text item is to be underlined,
+the appropriate font should be used instead).
+.VE 8.5
.TP
\fB\-width \fIlineLength\fR
Specifies a maximum line length for the text, in any of the forms
@@ -1671,15 +1767,19 @@ Window items are created with widget commands of the following form:
\fIpathName \fBcreate window \fIx y \fR?\fIoption value option value ...\fR?
\fIpathName \fBcreate window \fIcoordList\fR ?\fIoption value option value ...\fR?
.CE
-The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
+The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR (which must have two
+elements) specify the coordinates of a
point used to position the window on the display (see the \fB\-anchor\fR
option below for more information on how bitmaps are displayed).
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
-configuration.
-.br
+configuration. Theoretically, a window item becomes the current item when the
+mouse pointer is over any part of its bounding box, but in practice this
+typically does not happen because the mouse pointer ceases to be over the
+canvas at that point.
+.PP
The following standard options are supported by window items:
.CS
\-state
@@ -1688,6 +1788,7 @@ The following standard options are supported by window items:
The following extra options are supported for window items:
.TP
\fB\-anchor \fIanchorPos\fR
+.
\fIAnchorPos\fR tells how to position the window relative to the
positioning point for the item; it may have any of the forms
accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
@@ -1697,20 +1798,23 @@ its top center point is at the positioning point.
This option defaults to \fBcenter\fR.
.TP
\fB\-height \fIpixels\fR
+.
Specifies the height to assign to the item's window.
\fIPixels\fR may have any of the
forms described in the \fBCOORDINATES\fR section above.
-If this option isn't specified, or if it is specified as an empty
-string, then the window is given whatever height it requests internally.
+If this option is not specified, or if it is specified as zero,
+then the window is given whatever height it requests internally.
.TP
\fB\-width \fIpixels\fR
+.
Specifies the width to assign to the item's window.
\fIPixels\fR may have any of the
forms described in the \fBCOORDINATES\fR section above.
-If this option isn't specified, or if it is specified as an empty
-string, then the window is given whatever width it requests internally.
+If this option is not specified, or if it is specified as zero,
+then the window is given whatever width it requests internally.
.TP
\fB\-window \fIpathName\fR
+.
Specifies the window to associate with this item.
The window specified by \fIpathName\fR must either be a child of
the canvas widget or a child of some ancestor of the canvas widget.
@@ -1719,7 +1823,11 @@ the canvas widget or a child of some ancestor of the canvas widget.
Note: due to restrictions in the ways that windows are managed, it is not
possible to draw other graphical items (such as lines and images) on top
of window items. A window item always obscures any graphics that
-overlap it, regardless of their order in the display list.
+overlap it, regardless of their order in the display list. Also note that
+window items, unlike other canvas items, are not clipped for display by their
+containing canvas's border, and are instead clipped by the parent widget of
+the window specified by the \fB\-window\fR option; when the parent widget is
+the canvas, this means that the window item can overlap the canvas's border.
.SH "APPLICATION-DEFINED ITEM TYPES"
.PP
It is possible for individual applications to define new item
@@ -1728,7 +1836,7 @@ See the documentation for \fBTk_CreateItemType\fR.
.SH BINDINGS
.PP
In the current implementation, new canvases are not given any
-default behavior: you'll have to execute explicit Tcl commands
+default behavior: you will have to execute explicit Tcl commands
to give the canvas its behavior.
.SH CREDITS
.PP
@@ -1737,9 +1845,7 @@ Tk's canvas widget is a blatant ripoff of ideas from Joel Bartlett's
environment and preceded canvases by a year or two. Its simple
mechanisms for placing and animating graphical objects inspired the
functions of canvases.
-
.SH "SEE ALSO"
bind(n), font(n), image(n), scrollbar(n)
-
.SH KEYWORDS
canvas, widget
diff --git a/doc/checkbutton.n b/doc/checkbutton.n
index f236de2..1e05c96 100644
--- a/doc/checkbutton.n
+++ b/doc/checkbutton.n
@@ -34,31 +34,34 @@ Specifies a desired height for the button.
If an image or bitmap is being displayed in the button then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in lines of text.
-If this option isn't specified, the button's desired height is computed
+If this option is not specified, the button's desired height is computed
from the size of the image or bitmap or text being displayed in it.
.OP \-indicatoron indicatorOn IndicatorOn
Specifies whether or not the indicator should be drawn. Must be a
proper boolean value. If false, the \fBrelief\fR option is
ignored and the widget's relief is always sunken if the widget is
selected and raised otherwise.
-.VS 8.4
.OP \-offrelief offRelief OffRelief
Specifies the relief for the checkbutton when the indicator is not drawn and
-the checkbutton is off. The default value is "raised". By setting this option
-to "flat" and setting -indicatoron to false and -overrelief to raised,
-the effect is achieved
+the checkbutton is off. The default value is
+.QW raised .
+By setting this option to
+.QW flat
+and setting \fB\-indicatoron\fR to false and \fB\-overrelief\fR to
+.QW raised ,
+the effect is achieved
of having a flat button that raises on mouse-over and which is
depressed when activated. This is the behavior typically exhibited by
the Bold, Italic, and Underline checkbuttons on the toolbar of a
word-processor, for example.
-.VE 8.4
.OP \-offvalue offValue Value
Specifies value to store in the button's associated variable whenever
-this button is deselected. Defaults to ``0''.
+this button is deselected. Defaults to
+.QW 0 .
.OP \-onvalue onValue Value
Specifies value to store in the button's associated variable whenever
-this button is selected. Defaults to ``1''.
-.VS 8.4
+this button is selected. Defaults to
+.QW 1 .
.OP \-overrelief overRelief OverRelief
Specifies an alternative relief for the checkbutton, to be used when the
mouse cursor is over the widget. This option can be used to make
@@ -66,12 +69,10 @@ toolbar buttons, by configuring \fB\-relief flat \-overrelief
raised\fR. If the value of this option is the empty string, then no
alternative relief is used when the mouse cursor is over the checkbutton.
The empty string is the default value.
-.VE 8.4
.OP \-selectcolor selectColor Background
Specifies a background color to use when the button is selected.
-If \fBindicatorOn\fR is true then the color applies to the indicator.
-Under Windows, this color is used as the background for the indicator
-regardless of the select state.
+If \fBindicatorOn\fR is true then the color is used as the background for
+the indicator regardless of the select state.
If \fBindicatorOn\fR is false, this color is used as the background
for the entire widget, in place of \fBbackground\fR or \fBactiveBackground\fR,
whenever the widget is selected.
@@ -93,6 +94,19 @@ should be insensitive: the default bindings will refuse to activate
the widget and will ignore mouse button presses.
In this state the \fBdisabledForeground\fR and
\fBbackground\fR options determine how the checkbutton is displayed.
+.OP \-tristateimage tristateImage TristateImage
+.VS 8.5
+Specifies an image to display (in place of the \fBimage\fR option)
+when the checkbutton is in tri-state mode.
+This option is ignored unless the \fBimage\fR option has been
+specified.
+.VE 8.5
+.OP \-tristatevalue tristateValue Value
+.VS 8.5
+Specifies the value that causes the checkbutton to display the multi-value
+selection, also known as the tri-state mode. Defaults to
+.QW "" .
+.VE 8.5
.OP \-variable variable Variable
Specifies the name of a global variable to set to indicate whether
or not this button is selected. Defaults to the name of the
@@ -103,10 +117,9 @@ Specifies a desired width for the button.
If an image or bitmap is being displayed in the button then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in characters.
-If this option isn't specified, the button's desired width is computed
+If this option is not specified, the button's desired width is computed
from the size of the image or bitmap or text being displayed in it.
.BE
-
.SH DESCRIPTION
.PP
The \fBcheckbutton\fR command creates a new window (given by the
@@ -139,30 +152,45 @@ checkbutton.
.PP
In addition, checkbuttons can be \fIselected\fR.
If a checkbutton is selected then the indicator is normally
-.VS
drawn with a selected appearance, and
a Tcl variable associated with the checkbutton is set to a particular
value (normally 1).
-Under Unix, the indicator is drawn with a sunken relief and a special
-color. Under Windows, the indicator is drawn with a check mark inside.
+.VS 8.5
+The indicator is drawn with a check mark inside.
If the checkbutton is not selected, then the indicator is drawn with a
deselected appearance, and the associated variable is
set to a different value (typically 0).
-Under Unix, the indicator is drawn with a raised relief and no special
-color. Under Windows, the indicator is drawn without a check mark inside.
-.VE
+The indicator is drawn without a check mark inside. In the special case
+where the variable (if specified) has a value that matches the tristatevalue,
+the indicator is drawn with a tri-state appearance and is in the tri-state
+mode indicating mixed or multiple values. (This is used when the check
+box represents the state of multiple items.)
+The indicator is drawn in a platform dependent manner. Under Unix and
+Windows, the background interior of the box is
+.QW grayed .
+Under Mac, the indicator is drawn with a dash mark inside.
By default, the name of the variable associated with a checkbutton is the
same as the \fIname\fR used to create the checkbutton.
-The variable name, and the ``on'' and ``off'' values stored in it,
-may be modified with options on the command line or in the option
-database.
+The variable name, and the
+.QW on ,
+.QW off
+and
+.QW tristate
+values stored in it, may be modified with options on the command line
+or in the option database.
Configuration options may also be used to modify the way the
indicator is displayed (or whether it is displayed at all).
By default a checkbutton is configured to select and deselect
itself on alternate button clicks.
In addition, each checkbutton monitors its associated variable and
automatically selects and deselects itself when the variables value
-changes to and from the button's ``on'' value.
+changes to and from the button's
+.QW on ,
+.QW off
+and
+.QW tristate
+values.
+.VE 8.5
.SH "WIDGET COMMAND"
.PP
The \fBcheckbutton\fR command creates a new Tcl command whose
@@ -197,7 +225,8 @@ this case the command returns an empty string.
command.
.TP
\fIpathName \fBdeselect\fR
-Deselects the checkbutton and sets the associated variable to its ``off''
+Deselects the checkbutton and sets the associated variable to its
+.QW off
value.
.TP
\fIpathName \fBflash\fR
@@ -216,7 +245,8 @@ empty string if there is no command associated with the checkbutton.
This command is ignored if the checkbutton's state is \fBdisabled\fR.
.TP
\fIpathName \fBselect\fR
-Selects the checkbutton and sets the associated variable to its ``on''
+Selects the checkbutton and sets the associated variable to its
+.QW on
value.
.TP
\fIpathName \fBtoggle\fR
@@ -226,7 +256,6 @@ modifying its associated variable to reflect the new state.
.PP
Tk automatically creates class bindings for checkbuttons that give them
the following default behavior:
-.VS
.IP [1]
On Unix systems, a checkbutton activates whenever the mouse passes
over it and deactivates whenever the mouse leaves the checkbutton. On
@@ -234,26 +263,32 @@ Mac and Windows systems, when mouse button 1 is pressed over a
checkbutton, the button activates whenever the mouse pointer is inside
the button, and deactivates whenever the mouse pointer leaves the
button.
-.VE
.IP [2]
When mouse button 1 is pressed over a checkbutton, it is invoked (its
selection state toggles and the command associated with the button is
invoked, if there is one).
-.VS
.IP [3]
When a checkbutton has the input focus, the space key causes the checkbutton
to be invoked. Under Windows, there are additional key bindings; plus
-(+) and equal (=) select the button, and minus (-) deselects the button.
-.VE
+(+) and equal (=) select the button, and minus (\-) deselects the button.
.PP
If the checkbutton's state is \fBdisabled\fR then none of the above
actions occur: the checkbutton is completely non-responsive.
.PP
The behavior of checkbuttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH EXAMPLE
+This example shows a group of uncoupled checkbuttons.
+.PP
+.CS
+ labelframe .lbl \-text "Steps:"
+ \fBcheckbutton\fR .c1 \-text Lights \-variable lights
+ \fBcheckbutton\fR .c2 \-text Cameras \-variable cameras
+ \fBcheckbutton\fR .c3 \-text Action! \-variable action
+ pack .c1 .c2 .c3 \-in .lbl
+ pack .lbl
+.CE
.SH "SEE ALSO"
-button(n), options(n), radiobutton(n)
-
+button(n), options(n), radiobutton(n), ttk::checkbutton(n)
.SH KEYWORDS
checkbutton, widget
diff --git a/doc/chooseColor.n b/doc/chooseColor.n
index 8bb8d83..565934c 100644
--- a/doc/chooseColor.n
+++ b/doc/chooseColor.n
@@ -10,7 +10,6 @@
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
tk_chooseColor \- pops up a dialog box for the user to select a color.
-.PP
.SH SYNOPSIS
\fBtk_chooseColor \fR?\fIoption value ...\fR?
.BE
diff --git a/doc/chooseDirectory.n b/doc/chooseDirectory.n
index c796f86..c380ccf 100644
--- a/doc/chooseDirectory.n
+++ b/doc/chooseDirectory.n
@@ -8,11 +8,9 @@
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
tk_chooseDirectory \- pops up a dialog box for the user to select a directory.
-.PP
.SH SYNOPSIS
\fBtk_chooseDirectory \fR?\fIoption value ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The procedure \fBtk_chooseDirectory\fR pops up a dialog box for the
@@ -24,31 +22,29 @@ Specifies that the directories in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified, then
the directories in the current working directory are displayed. If the
parameter specifies a relative path, the return value will convert the
-relative path to an absolute path. This option may not always work on
-the Macintosh. This is not a bug. Rather, the \fIGeneral Controls\fR
-control panel on the Mac allows the end user to override the
-application default directory.
+relative path to an absolute path.
+.TP
+\fB\-mustexist\fR \fIboolean\fR
+Specifies whether the user may specify non-existent directories. If
+this parameter is true, then the user may only select directories that
+already exist. The default value is \fIfalse\fR.
.TP
\fB\-parent\fR \fIwindow\fR
Makes \fIwindow\fR the logical parent of the dialog. The dialog
-is displayed on top of its parent window.
+is displayed on top of its parent window. On Mac OS X, this
+turns the file dialog into a sheet attached to the parent window.
.TP
\fB\-title\fR \fItitleString\fR
Specifies a string to display as the title of the dialog box. If this
option is not specified, then a default title will be displayed.
-.TP
-\fB\-mustexist\fR \fIboolean\fR
-Specifies whether the user may specify non-existent directories. If
-this parameter is true, then the user may only select directories that
-already exist. The default value is \fIfalse\fR.
.SH EXAMPLE
.CS
-set dir [\fBtk_chooseDirectory\fR \\
+set dir [\fBtk_chooseDirectory\fR \e
\-initialdir ~ \-title "Choose a directory"]
if {$dir eq ""} {
- label .l -text "No directory selected"
+ label .l \-text "No directory selected"
} else {
- label .l -text "Selected $dir"
+ label .l \-text "Selected $dir"
}
.CE
diff --git a/doc/clipboard.n b/doc/clipboard.n
index 9fa858a..b689328 100644
--- a/doc/clipboard.n
+++ b/doc/clipboard.n
@@ -19,7 +19,7 @@ clipboard \- Manipulate Tk clipboard
.PP
This command provides a Tcl interface to the Tk clipboard,
which stores data for later retrieval using the selection mechanism
-(via the \fB-selection CLIPBOARD\fR option).
+(via the \fB\-selection CLIPBOARD\fR option).
In order to copy data into the clipboard, \fBclipboard clear\fR must
be called, followed by a sequence of one or more calls to \fBclipboard
append\fR. To ensure that the clipboard is updated atomically, all
@@ -32,8 +32,9 @@ forms are currently supported:
.TP
\fBclipboard clear\fR ?\fB\-displayof\fR \fIwindow\fR?
Claims ownership of the clipboard on \fIwindow\fR's display and removes
-any previous contents. \fIWindow\fR defaults to ``.''. Returns an
-empty string.
+any previous contents. \fIWindow\fR defaults to
+.QW . .
+Returns an empty string.
.TP
\fBclipboard append\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-format\fR \fIformat\fR? ?\fB\-type\fR \fItype\fR? ?\fB\-\|\-\fR? \fIdata\fR
Appends \fIdata\fR to the clipboard on \fIwindow\fR's
@@ -43,7 +44,9 @@ display.
.RS
.PP
\fIType\fR specifies the form in which the selection is to be returned
-(the desired ``target'' for conversion, in ICCCM terminology), and
+(the desired
+.QW target
+for conversion, in ICCCM terminology), and
should be an atom name such as STRING or FILE_NAME; see the
Inter-Client Communication Conventions Manual for complete details.
\fIType\fR defaults to STRING.
@@ -65,7 +68,7 @@ boundaries. All items appended to the clipboard with the same
\fItype\fR must have the same \fIformat\fR.
.PP
The \fIformat\fR argument is needed only for compatibility with
-clipboard requesters that don't use Tk. If the Tk toolkit is being
+clipboard requesters that do not use Tk. If the Tk toolkit is being
used to retrieve the CLIPBOARD selection then the value is converted back to
a string at the requesting end, so \fIformat\fR is
irrelevant.
@@ -77,13 +80,19 @@ with a \fB\-\fR.
.RE
.TP
\fBclipboard get\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-type\fR \fItype\fR?
-.VS 8.4
Retrieve data from the clipboard on \fIwindow\fR's display.
-\fIwindow\fR defaults to ".". \fIType\fR specifies the form in which
+\fIWindow\fR defaults to
+.QW . .
+\fIType\fR specifies the form in which
the data is to be returned and should be an atom name such as STRING
or FILE_NAME. \fIType\fR defaults to STRING. This command is
-equivalent to \fBselection get -selection CLIPBOARD\fR.
-.VE 8.4
+equivalent to
+.QW "\fBselection get \-selection CLIPBOARD\fR" .
+.RS
+.PP
+Note that on modern X11 systems, the most useful type to retrieve for
+transferred strings is not \fBSTRING\fR, but rather \fBUTF8_STRING\fR.
+.RE
.SH EXAMPLES
Get the current contents of the clipboard.
.CS
@@ -97,9 +106,49 @@ Set the clipboard to contain a fixed string.
\fBclipboard clear\fR
\fBclipboard append\fR "some fixed string"
.CE
+.PP
+You can put custom data into the clipboard by using a custom \fB\-type\fR
+option. This is not necessarily portable, but can be very useful. The
+method of passing Tcl scripts this way is effective, but should be mixed
+with safe interpreters in production code.
+.CS
+# This is a very simple canvas serializer;
+# it produces a script that recreates the item(s) when executed
+proc getItemConfig {canvas tag} {
+ set script {}
+ foreach item [$canvas find withtag $tag] {
+ append script {$canvas create } [$canvas type $item]
+ append script { } [$canvas coords $item] { }
+ foreach config [$canvas itemconf $item] {
+ lassign $config name \- \- \- value
+ append script [list $name $value] { }
+ }
+ append script \en
+ }
+ return [string trim $script]
+}
+
+# Set up a binding on a canvas to cut and paste an item
+set c [canvas .c]
+pack $c
+$c create text 150 30 \-text "cut and paste me"
+bind $c <<Cut>> {
+ \fBclipboard clear\fR
+ \fBclipboard append \-type\fR TkCanvasItem \e
+ [getItemConfig %W current]
+ # Delete because this is cut, not copy.
+ %W delete current
+}
+bind $c <<Paste>> {
+ catch {
+ set canvas %W
+ eval [\fBclipboard get \-type\fR TkCanvasItem]
+ }
+}
+.CE
.SH "SEE ALSO"
-selection(n)
+interp(n), selection(n)
.SH KEYWORDS
clear, format, clipboard, append, selection, type
diff --git a/doc/colors.n b/doc/colors.n
index 604ac52..4b8cda1 100644
--- a/doc/colors.n
+++ b/doc/colors.n
@@ -2,12 +2,12 @@
'\" Copyright (c) 1998-2000 by Scriptics Corporation.
'\" Copyright (c) 2003 ActiveState Corporation.
'\" Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
-'\"
+'\" Copyright (c) 2008 Donal K. Fellows
'\"
.so man.macros
.TH colors n 8.3 Tk "Tk Built-In Commands"
.BS
-'\" Note: do not modify the .SH NAME line immediately below!
+.\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
colors \- symbolic color names recognized by Tk
.BE
@@ -15,914 +15,932 @@ colors \- symbolic color names recognized by Tk
.PP
Tk recognizes many symbolic color names (e.g., \fBred\fR) when
specifying colors. The symbolic names recognized by Tk and their
-8-bit RGB values are:
-.CS
-\fIName\fR \fIRed\fR \fIGreen\fR \fIBlue\fR
-alice blue 240 248 255
-AliceBlue 240 248 255
-antique white 250 235 215
-AntiqueWhite 250 235 215
-AntiqueWhite1 255 239 219
-AntiqueWhite2 238 223 204
-AntiqueWhite3 205 192 176
-AntiqueWhite4 139 131 120
-aquamarine 127 255 212
-aquamarine1 127 255 212
-aquamarine2 118 238 198
-aquamarine3 102 205 170
-aquamarine4 69 139 116
-azure 240 255 255
-azure1 240 255 255
-azure2 224 238 238
-azure3 193 205 205
-azure4 131 139 139
-beige 245 245 220
-bisque 255 228 196
-bisque1 255 228 196
-bisque2 238 213 183
-bisque3 205 183 158
-bisque4 139 125 107
-black 0 0 0
-blanched almond 255 235 205
-BlanchedAlmond 255 235 205
-blue 0 0 255
-blue violet 138 43 226
-blue1 0 0 255
-blue2 0 0 238
-blue3 0 0 205
-blue4 0 0 139
-BlueViolet 138 43 226
-brown 165 42 42
-brown1 255 64 64
-brown2 238 59 59
-brown3 205 51 51
-brown4 139 35 35
-burlywood 222 184 135
-burlywood1 255 211 155
-burlywood2 238 197 145
-burlywood3 205 170 125
-burlywood4 139 115 85
-cadet blue 95 158 160
-CadetBlue 95 158 160
-CadetBlue1 152 245 255
-CadetBlue2 142 229 238
-CadetBlue3 122 197 205
-CadetBlue4 83 134 139
-chartreuse 127 255 0
-chartreuse1 127 255 0
-chartreuse2 118 238 0
-chartreuse3 102 205 0
-chartreuse4 69 139 0
-chocolate 210 105 30
-chocolate1 255 127 36
-chocolate2 238 118 33
-chocolate3 205 102 29
-chocolate4 139 69 19
-coral 255 127 80
-coral1 255 114 86
-coral2 238 106 80
-coral3 205 91 69
-coral4 139 62 47
-cornflower blue 100 149 237
-CornflowerBlue 100 149 237
-cornsilk 255 248 220
-cornsilk1 255 248 220
-cornsilk2 238 232 205
-cornsilk3 205 200 177
-cornsilk4 139 136 120
-cyan 0 255 255
-cyan1 0 255 255
-cyan2 0 238 238
-cyan3 0 205 205
-cyan4 0 139 139
-dark blue 0 0 139
-dark cyan 0 139 139
-dark goldenrod 184 134 11
-dark gray 169 169 169
-dark green 0 100 0
-dark grey 169 169 169
-dark khaki 189 183 107
-dark magenta 139 0 139
-dark olive green 85 107 47
-dark orange 255 140 0
-dark orchid 153 50 204
-dark red 139 0 0
-dark salmon 233 150 122
-dark sea green 143 188 143
-dark slate blue 72 61 139
-dark slate gray 47 79 79
-dark slate grey 47 79 79
-dark turquoise 0 206 209
-dark violet 148 0 211
-DarkBlue 0 0 139
-DarkCyan 0 139 139
-DarkGoldenrod 184 134 11
-DarkGoldenrod1 255 185 15
-DarkGoldenrod2 238 173 14
-DarkGoldenrod3 205 149 12
-DarkGoldenrod4 139 101 8
-DarkGray 169 169 169
-DarkGreen 0 100 0
-DarkGrey 169 169 169
-DarkKhaki 189 183 107
-DarkMagenta 139 0 139
-DarkOliveGreen 85 107 47
-DarkOliveGreen1 202 255 112
-DarkOliveGreen2 188 238 104
-DarkOliveGreen3 162 205 90
-DarkOliveGreen4 110 139 61
-DarkOrange 255 140 0
-DarkOrange1 255 127 0
-DarkOrange2 238 118 0
-DarkOrange3 205 102 0
-DarkOrange4 139 69 0
-DarkOrchid 153 50 204
-DarkOrchid1 191 62 255
-DarkOrchid2 178 58 238
-DarkOrchid3 154 50 205
-DarkOrchid4 104 34 139
-DarkRed 139 0 0
-DarkSalmon 233 150 122
-DarkSeaGreen 143 188 143
-DarkSeaGreen1 193 255 193
-DarkSeaGreen2 180 238 180
-DarkSeaGreen3 155 205 155
-DarkSeaGreen4 105 139 105
-DarkSlateBlue 72 61 139
-DarkSlateGray 47 79 79
-DarkSlateGray1 151 255 255
-DarkSlateGray2 141 238 238
-DarkSlateGray3 121 205 205
-DarkSlateGray4 82 139 139
-DarkSlateGrey 47 79 79
-DarkTurquoise 0 206 209
-DarkViolet 148 0 211
-deep pink 255 20 147
-deep sky blue 0 191 255
-DeepPink 255 20 147
-DeepPink1 255 20 147
-DeepPink2 238 18 137
-DeepPink3 205 16 118
-DeepPink4 139 10 80
-DeepSkyBlue 0 191 255
-DeepSkyBlue1 0 191 255
-DeepSkyBlue2 0 178 238
-DeepSkyBlue3 0 154 205
-DeepSkyBlue4 0 104 139
-dim gray 105 105 105
-dim grey 105 105 105
-DimGray 105 105 105
-DimGrey 105 105 105
-dodger blue 30 144 255
-DodgerBlue 30 144 255
-DodgerBlue1 30 144 255
-DodgerBlue2 28 134 238
-DodgerBlue3 24 116 205
-DodgerBlue4 16 78 139
-firebrick 178 34 34
-firebrick1 255 48 48
-firebrick2 238 44 44
-firebrick3 205 38 38
-firebrick4 139 26 26
-floral white 255 250 240
-FloralWhite 255 250 240
-forest green 34 139 34
-ForestGreen 34 139 34
-gainsboro 220 220 220
-ghost white 248 248 255
-GhostWhite 248 248 255
-gold 255 215 0
-gold1 255 215 0
-gold2 238 201 0
-gold3 205 173 0
-gold4 139 117 0
-goldenrod 218 165 32
-goldenrod1 255 193 37
-goldenrod2 238 180 34
-goldenrod3 205 155 29
-goldenrod4 139 105 20
-gray 190 190 190
-gray0 0 0 0
-gray1 3 3 3
-gray2 5 5 5
-gray3 8 8 8
-gray4 10 10 10
-gray5 13 13 13
-gray6 15 15 15
-gray7 18 18 18
-gray8 20 20 20
-gray9 23 23 23
-gray10 26 26 26
-gray11 28 28 28
-gray12 31 31 31
-gray13 33 33 33
-gray14 36 36 36
-gray15 38 38 38
-.CE
-.CS
-gray16 41 41 41
-gray17 43 43 43
-gray18 46 46 46
-gray19 48 48 48
-gray20 51 51 51
-gray21 54 54 54
-gray22 56 56 56
-gray23 59 59 59
-gray24 61 61 61
-gray25 64 64 64
-gray26 66 66 66
-gray27 69 69 69
-gray28 71 71 71
-gray29 74 74 74
-gray30 77 77 77
-gray31 79 79 79
-gray32 82 82 82
-gray33 84 84 84
-gray34 87 87 87
-gray35 89 89 89
-gray36 92 92 92
-gray37 94 94 94
-gray38 97 97 97
-gray39 99 99 99
-gray40 102 102 102
-gray41 105 105 105
-gray42 107 107 107
-gray43 110 110 110
-gray44 112 112 112
-gray45 115 115 115
-gray46 117 117 117
-gray47 120 120 120
-gray48 122 122 122
-gray49 125 125 125
-gray50 127 127 127
-gray51 130 130 130
-gray52 133 133 133
-gray53 135 135 135
-gray54 138 138 138
-gray55 140 140 140
-gray56 143 143 143
-gray57 145 145 145
-gray58 148 148 148
-gray59 150 150 150
-gray60 153 153 153
-gray61 156 156 156
-gray62 158 158 158
-gray63 161 161 161
-gray64 163 163 163
-gray65 166 166 166
-gray66 168 168 168
-gray67 171 171 171
-gray68 173 173 173
-gray69 176 176 176
-gray70 179 179 179
-gray71 181 181 181
-gray72 184 184 184
-gray73 186 186 186
-gray74 189 189 189
-gray75 191 191 191
-gray76 194 194 194
-gray77 196 196 196
-gray78 199 199 199
-gray79 201 201 201
-gray80 204 204 204
-gray81 207 207 207
-gray82 209 209 209
-gray83 212 212 212
-gray84 214 214 214
-gray85 217 217 217
-gray86 219 219 219
-gray87 222 222 222
-gray88 224 224 224
-gray89 227 227 227
-gray90 229 229 229
-gray91 232 232 232
-gray92 235 235 235
-gray93 237 237 237
-gray94 240 240 240
-gray95 242 242 242
-gray96 245 245 245
-gray97 247 247 247
-gray98 250 250 250
-gray99 252 252 252
-gray100 255 255 255
-green 0 255 0
-green yellow 173 255 47
-green1 0 255 0
-green2 0 238 0
-green3 0 205 0
-green4 0 139 0
-GreenYellow 173 255 47
-grey 190 190 190
-grey0 0 0 0
-grey1 3 3 3
-grey2 5 5 5
-grey3 8 8 8
-grey4 10 10 10
-grey5 13 13 13
-grey6 15 15 15
-grey7 18 18 18
-grey8 20 20 20
-grey9 23 23 23
-grey10 26 26 26
-grey11 28 28 28
-grey12 31 31 31
-grey13 33 33 33
-grey14 36 36 36
-grey15 38 38 38
-grey16 41 41 41
-grey17 43 43 43
-grey18 46 46 46
-grey19 48 48 48
-grey20 51 51 51
-grey21 54 54 54
-grey22 56 56 56
-grey23 59 59 59
-grey24 61 61 61
-grey25 64 64 64
-grey26 66 66 66
-grey27 69 69 69
-grey28 71 71 71
-grey29 74 74 74
-grey30 77 77 77
-grey31 79 79 79
-grey32 82 82 82
-grey33 84 84 84
-grey34 87 87 87
-grey35 89 89 89
-grey36 92 92 92
-grey37 94 94 94
-grey38 97 97 97
-grey39 99 99 99
-grey40 102 102 102
-grey41 105 105 105
-grey42 107 107 107
-grey43 110 110 110
-grey44 112 112 112
-grey45 115 115 115
-grey46 117 117 117
-grey47 120 120 120
-grey48 122 122 122
-grey49 125 125 125
-grey50 127 127 127
-grey51 130 130 130
-grey52 133 133 133
-grey53 135 135 135
-grey54 138 138 138
-grey55 140 140 140
-grey56 143 143 143
-grey57 145 145 145
-grey58 148 148 148
-grey59 150 150 150
-grey60 153 153 153
-grey61 156 156 156
-grey62 158 158 158
-grey63 161 161 161
-grey64 163 163 163
-grey65 166 166 166
-grey66 168 168 168
-grey67 171 171 171
-grey68 173 173 173
-grey69 176 176 176
-grey70 179 179 179
-grey71 181 181 181
-grey72 184 184 184
-grey73 186 186 186
-grey74 189 189 189
-grey75 191 191 191
-grey76 194 194 194
-grey77 196 196 196
-grey78 199 199 199
-grey79 201 201 201
-grey80 204 204 204
-grey81 207 207 207
-grey82 209 209 209
-grey83 212 212 212
-grey84 214 214 214
-grey85 217 217 217
-grey86 219 219 219
-grey87 222 222 222
-grey88 224 224 224
-grey89 227 227 227
-grey90 229 229 229
-grey91 232 232 232
-grey92 235 235 235
-grey93 237 237 237
-grey94 240 240 240
-grey95 242 242 242
-grey96 245 245 245
-grey97 247 247 247
-grey98 250 250 250
-grey99 252 252 252
-grey100 255 255 255
-honeydew 240 255 240
-honeydew1 240 255 240
-honeydew2 224 238 224
-honeydew3 193 205 193
-honeydew4 131 139 131
-hot pink 255 105 180
-.CE
-.CS
-HotPink 255 105 180
-HotPink1 255 110 180
-HotPink2 238 106 167
-HotPink3 205 96 144
-HotPink4 139 58 98
-indian red 205 92 92
-IndianRed 205 92 92
-IndianRed1 255 106 106
-IndianRed2 238 99 99
-IndianRed3 205 85 85
-IndianRed4 139 58 58
-ivory 255 255 240
-ivory1 255 255 240
-ivory2 238 238 224
-ivory3 205 205 193
-ivory4 139 139 131
-khaki 240 230 140
-khaki1 255 246 143
-khaki2 238 230 133
-khaki3 205 198 115
-khaki4 139 134 78
-lavender 230 230 250
-lavender blush 255 240 245
-LavenderBlush 255 240 245
-LavenderBlush1 255 240 245
-LavenderBlush2 238 224 229
-LavenderBlush3 205 193 197
-LavenderBlush4 139 131 134
-lawn green 124 252 0
-LawnGreen 124 252 0
-lemon chiffon 255 250 205
-LemonChiffon 255 250 205
-LemonChiffon1 255 250 205
-LemonChiffon2 238 233 191
-LemonChiffon3 205 201 165
-LemonChiffon4 139 137 112
-light blue 173 216 230
-light coral 240 128 128
-light cyan 224 255 255
-light goldenrod 238 221 130
-light goldenrod yellow 250 250 210
-light gray 211 211 211
-light green 144 238 144
-light grey 211 211 211
-light pink 255 182 193
-light salmon 255 160 122
-light sea green 32 178 170
-light sky blue 135 206 250
-light slate blue 132 112 255
-light slate gray 119 136 153
-light slate grey 119 136 153
-light steel blue 176 196 222
-light yellow 255 255 224
-LightBlue 173 216 230
-LightBlue1 191 239 255
-LightBlue2 178 223 238
-LightBlue3 154 192 205
-LightBlue4 104 131 139
-LightCoral 240 128 128
-LightCyan 224 255 255
-LightCyan1 224 255 255
-LightCyan2 209 238 238
-LightCyan3 180 205 205
-LightCyan4 122 139 139
-LightGoldenrod 238 221 130
-LightGoldenrod1 255 236 139
-LightGoldenrod2 238 220 130
-LightGoldenrod3 205 190 112
-LightGoldenrod4 139 129 76
-LightGoldenrodYellow 250 250 210
-LightGray 211 211 211
-LightGreen 144 238 144
-LightGrey 211 211 211
-LightPink 255 182 193
-LightPink1 255 174 185
-LightPink2 238 162 173
-LightPink3 205 140 149
-LightPink4 139 95 101
-LightSalmon 255 160 122
-LightSalmon1 255 160 122
-LightSalmon2 238 149 114
-LightSalmon3 205 129 98
-LightSalmon4 139 87 66
-LightSeaGreen 32 178 170
-LightSkyBlue 135 206 250
-LightSkyBlue1 176 226 255
-LightSkyBlue2 164 211 238
-LightSkyBlue3 141 182 205
-LightSkyBlue4 96 123 139
-LightSlateBlue 132 112 255
-LightSlateGray 119 136 153
-LightSlateGrey 119 136 153
-LightSteelBlue 176 196 222
-LightSteelBlue1 202 225 255
-LightSteelBlue2 188 210 238
-LightSteelBlue3 162 181 205
-LightSteelBlue4 110 123 139
-LightYellow 255 255 224
-LightYellow1 255 255 224
-LightYellow2 238 238 209
-LightYellow3 205 205 180
-LightYellow4 139 139 122
-lime green 50 205 50
-LimeGreen 50 205 50
-linen 250 240 230
-magenta 255 0 255
-magenta1 255 0 255
-magenta2 238 0 238
-magenta3 205 0 205
-magenta4 139 0 139
-maroon 176 48 96
-maroon1 255 52 179
-maroon2 238 48 167
-maroon3 205 41 144
-maroon4 139 28 98
-medium aquamarine 102 205 170
-medium blue 0 0 205
-medium orchid 186 85 211
-medium purple 147 112 219
-medium sea green 60 179 113
-medium slate blue 123 104 238
-medium spring green 0 250 154
-medium turquoise 72 209 204
-medium violet red 199 21 133
-MediumAquamarine 102 205 170
-MediumBlue 0 0 205
-MediumOrchid 186 85 211
-MediumOrchid1 224 102 255
-MediumOrchid2 209 95 238
-MediumOrchid3 180 82 205
-MediumOrchid4 122 55 139
-MediumPurple 147 112 219
-MediumPurple1 171 130 255
-MediumPurple2 159 121 238
-MediumPurple3 137 104 205
-MediumPurple4 93 71 139
-MediumSeaGreen 60 179 113
-MediumSlateBlue 123 104 238
-MediumSpringGreen 0 250 154
-MediumTurquoise 72 209 204
-MediumVioletRed 199 21 133
-midnight blue 25 25 112
-MidnightBlue 25 25 112
-mint cream 245 255 250
-MintCream 245 255 250
-misty rose 255 228 225
-MistyRose 255 228 225
-MistyRose1 255 228 225
-MistyRose2 238 213 210
-MistyRose3 205 183 181
-MistyRose4 139 125 123
-moccasin 255 228 181
-navajo white 255 222 173
-NavajoWhite 255 222 173
-NavajoWhite1 255 222 173
-NavajoWhite2 238 207 161
-NavajoWhite3 205 179 139
-NavajoWhite4 139 121 94
-navy 0 0 128
-navy blue 0 0 128
-NavyBlue 0 0 128
-old lace 253 245 230
-OldLace 253 245 230
-olive drab 107 142 35
-OliveDrab 107 142 35
-OliveDrab1 192 255 62
-OliveDrab2 179 238 58
-OliveDrab3 154 205 50
-OliveDrab4 105 139 34
-orange 255 165 0
-orange red 255 69 0
-orange1 255 165 0
-orange2 238 154 0
-orange3 205 133 0
-orange4 139 90 0
-OrangeRed 255 69 0
-OrangeRed1 255 69 0
-OrangeRed2 238 64 0
-OrangeRed3 205 55 0
-OrangeRed4 139 37 0
-orchid 218 112 214
-orchid1 255 131 250
-orchid2 238 122 233
-orchid3 205 105 201
-orchid4 139 71 137
-pale goldenrod 238 232 170
-pale green 152 251 152
-pale turquoise 175 238 238
-pale violet red 219 112 147
-PaleGoldenrod 238 232 170
-PaleGreen 152 251 152
-PaleGreen1 154 255 154
-PaleGreen2 144 238 144
-PaleGreen3 124 205 124
-PaleGreen4 84 139 84
-PaleTurquoise 175 238 238
-PaleTurquoise1 187 255 255
-PaleTurquoise2 174 238 238
-PaleTurquoise3 150 205 205
-PaleTurquoise4 102 139 139
-.CE
-.CS
-PaleVioletRed 219 112 147
-PaleVioletRed1 255 130 171
-PaleVioletRed2 238 121 159
-PaleVioletRed3 205 104 127
-PaleVioletRed4 139 71 93
-papaya whip 255 239 213
-PapayaWhip 255 239 213
-peach puff 255 218 185
-PeachPuff 255 218 185
-PeachPuff1 255 218 185
-PeachPuff2 238 203 173
-PeachPuff3 205 175 149
-PeachPuff4 139 119 101
-peru 205 133 63
-pink 255 192 203
-pink1 255 181 197
-pink2 238 169 184
-pink3 205 145 158
-pink4 139 99 108
-plum 221 160 221
-plum1 255 187 255
-plum2 238 174 238
-plum3 205 150 205
-plum4 139 102 139
-powder blue 176 224 230
-PowderBlue 176 224 230
-purple 160 32 240
-purple1 155 48 255
-purple2 145 44 238
-purple3 125 38 205
-purple4 85 26 139
-red 255 0 0
-red1 255 0 0
-red2 238 0 0
-red3 205 0 0
-red4 139 0 0
-rosy brown 188 143 143
-RosyBrown 188 143 143
-RosyBrown1 255 193 193
-RosyBrown2 238 180 180
-RosyBrown3 205 155 155
-RosyBrown4 139 105 105
-royal blue 65 105 225
-RoyalBlue 65 105 225
-RoyalBlue1 72 118 255
-RoyalBlue2 67 110 238
-RoyalBlue3 58 95 205
-RoyalBlue4 39 64 139
-saddle brown 139 69 19
-SaddleBrown 139 69 19
-salmon 250 128 114
-salmon1 255 140 105
-salmon2 238 130 98
-salmon3 205 112 84
-salmon4 139 76 57
-sandy brown 244 164 96
-SandyBrown 244 164 96
-sea green 46 139 87
-SeaGreen 46 139 87
-SeaGreen1 84 255 159
-SeaGreen2 78 238 148
-SeaGreen3 67 205 128
-SeaGreen4 46 139 87
-seashell 255 245 238
-seashell1 255 245 238
-seashell2 238 229 222
-seashell3 205 197 191
-seashell4 139 134 130
-sienna 160 82 45
-sienna1 255 130 71
-sienna2 238 121 66
-sienna3 205 104 57
-sienna4 139 71 38
-sky blue 135 206 235
-SkyBlue 135 206 235
-SkyBlue1 135 206 255
-SkyBlue2 126 192 238
-SkyBlue3 108 166 205
-SkyBlue4 74 112 139
-slate blue 106 90 205
-slate gray 112 128 144
-slate grey 112 128 144
-SlateBlue 106 90 205
-SlateBlue1 131 111 255
-SlateBlue2 122 103 238
-SlateBlue3 105 89 205
-SlateBlue4 71 60 139
-SlateGray 112 128 144
-SlateGray1 198 226 255
-SlateGray2 185 211 238
-SlateGray3 159 182 205
-SlateGray4 108 123 139
-SlateGrey 112 128 144
-snow 255 250 250
-snow1 255 250 250
-snow2 238 233 233
-snow3 205 201 201
-snow4 139 137 137
-spring green 0 255 127
-SpringGreen 0 255 127
-SpringGreen1 0 255 127
-SpringGreen2 0 238 118
-SpringGreen3 0 205 102
-SpringGreen4 0 139 69
-steel blue 70 130 180
-SteelBlue 70 130 180
-SteelBlue1 99 184 255
-SteelBlue2 92 172 238
-SteelBlue3 79 148 205
-SteelBlue4 54 100 139
-tan 210 180 140
-tan1 255 165 79
-tan2 238 154 73
-tan3 205 133 63
-tan4 139 90 43
-thistle 216 191 216
-thistle1 255 225 255
-thistle2 238 210 238
-thistle3 205 181 205
-thistle4 139 123 139
-tomato 255 99 71
-tomato1 255 99 71
-tomato2 238 92 66
-tomato3 205 79 57
-tomato4 139 54 38
-turquoise 64 224 208
-turquoise1 0 245 255
-turquoise2 0 229 238
-turquoise3 0 197 205
-turquoise4 0 134 139
-violet 238 130 238
-violet red 208 32 144
-VioletRed 208 32 144
-VioletRed1 255 62 150
-VioletRed2 238 58 140
-VioletRed3 205 50 120
-VioletRed4 139 34 82
-wheat 245 222 179
-wheat1 255 231 186
-wheat2 238 216 174
-wheat3 205 186 150
-wheat4 139 126 102
-white 255 255 255
-white smoke 245 245 245
-WhiteSmoke 245 245 245
-yellow 255 255 0
-yellow green 154 205 50
-yellow1 255 255 0
-yellow2 238 238 0
-yellow3 205 205 0
-yellow4 139 139 0
-YellowGreen 154 205 50
-.CE
-
+8-bit-per-channel RGB values are:
+.DS
+.ta 7.2cR 9.5cR 11cR
+\fBName\fR \fBRed\fR \fBGreen\fR \fBBlue\fR
+alice blue 240 248 255
+AliceBlue 240 248 255
+antique white 250 235 215
+AntiqueWhite 250 235 215
+AntiqueWhite1 255 239 219
+AntiqueWhite2 238 223 204
+AntiqueWhite3 205 192 176
+AntiqueWhite4 139 131 120
+aquamarine 127 255 212
+aquamarine1 127 255 212
+aquamarine2 118 238 198
+aquamarine3 102 205 170
+aquamarine4 69 139 116
+azure 240 255 255
+azure1 240 255 255
+azure2 224 238 238
+azure3 193 205 205
+azure4 131 139 139
+beige 245 245 220
+bisque 255 228 196
+bisque1 255 228 196
+bisque2 238 213 183
+bisque3 205 183 158
+bisque4 139 125 107
+black 0 0 0
+blanched almond 255 235 205
+BlanchedAlmond 255 235 205
+blue 0 0 255
+blue violet 138 43 226
+blue1 0 0 255
+blue2 0 0 238
+blue3 0 0 205
+blue4 0 0 139
+BlueViolet 138 43 226
+brown 165 42 42
+brown1 255 64 64
+brown2 238 59 59
+brown3 205 51 51
+brown4 139 35 35
+burlywood 222 184 135
+burlywood1 255 211 155
+burlywood2 238 197 145
+burlywood3 205 170 125
+burlywood4 139 115 85
+cadet blue 95 158 160
+CadetBlue 95 158 160
+CadetBlue1 152 245 255
+CadetBlue2 142 229 238
+CadetBlue3 122 197 205
+CadetBlue4 83 134 139
+chartreuse 127 255 0
+chartreuse1 127 255 0
+chartreuse2 118 238 0
+chartreuse3 102 205 0
+chartreuse4 69 139 0
+chocolate 210 105 30
+chocolate1 255 127 36
+chocolate2 238 118 33
+chocolate3 205 102 29
+chocolate4 139 69 19
+coral 255 127 80
+coral1 255 114 86
+coral2 238 106 80
+coral3 205 91 69
+coral4 139 62 47
+cornflower blue 100 149 237
+CornflowerBlue 100 149 237
+cornsilk 255 248 220
+cornsilk1 255 248 220
+cornsilk2 238 232 205
+cornsilk3 205 200 177
+cornsilk4 139 136 120
+cyan 0 255 255
+cyan1 0 255 255
+cyan2 0 238 238
+cyan3 0 205 205
+cyan4 0 139 139
+dark blue 0 0 139
+dark cyan 0 139 139
+dark goldenrod 184 134 11
+dark gray 169 169 169
+dark green 0 100 0
+dark grey 169 169 169
+dark khaki 189 183 107
+dark magenta 139 0 139
+dark olive green 85 107 47
+dark orange 255 140 0
+dark orchid 153 50 204
+dark red 139 0 0
+dark salmon 233 150 122
+dark sea green 143 188 143
+dark slate blue 72 61 139
+dark slate gray 47 79 79
+dark slate grey 47 79 79
+dark turquoise 0 206 209
+dark violet 148 0 211
+DarkBlue 0 0 139
+DarkCyan 0 139 139
+DarkGoldenrod 184 134 11
+DarkGoldenrod1 255 185 15
+DarkGoldenrod2 238 173 14
+DarkGoldenrod3 205 149 12
+DarkGoldenrod4 139 101 8
+DarkGray 169 169 169
+DarkGreen 0 100 0
+DarkGrey 169 169 169
+DarkKhaki 189 183 107
+DarkMagenta 139 0 139
+DarkOliveGreen 85 107 47
+DarkOliveGreen1 202 255 112
+DarkOliveGreen2 188 238 104
+DarkOliveGreen3 162 205 90
+DarkOliveGreen4 110 139 61
+DarkOrange 255 140 0
+DarkOrange1 255 127 0
+DarkOrange2 238 118 0
+DarkOrange3 205 102 0
+DarkOrange4 139 69 0
+DarkOrchid 153 50 204
+DarkOrchid1 191 62 255
+DarkOrchid2 178 58 238
+DarkOrchid3 154 50 205
+DarkOrchid4 104 34 139
+DarkRed 139 0 0
+DarkSalmon 233 150 122
+DarkSeaGreen 143 188 143
+DarkSeaGreen1 193 255 193
+DarkSeaGreen2 180 238 180
+DarkSeaGreen3 155 205 155
+DarkSeaGreen4 105 139 105
+DarkSlateBlue 72 61 139
+DarkSlateGray 47 79 79
+DarkSlateGray1 151 255 255
+DarkSlateGray2 141 238 238
+DarkSlateGray3 121 205 205
+DarkSlateGray4 82 139 139
+DarkSlateGrey 47 79 79
+DarkTurquoise 0 206 209
+DarkViolet 148 0 211
+deep pink 255 20 147
+deep sky blue 0 191 255
+DeepPink 255 20 147
+DeepPink1 255 20 147
+DeepPink2 238 18 137
+DeepPink3 205 16 118
+DeepPink4 139 10 80
+DeepSkyBlue 0 191 255
+DeepSkyBlue1 0 191 255
+DeepSkyBlue2 0 178 238
+DeepSkyBlue3 0 154 205
+DeepSkyBlue4 0 104 139
+dim gray 105 105 105
+dim grey 105 105 105
+DimGray 105 105 105
+DimGrey 105 105 105
+dodger blue 30 144 255
+DodgerBlue 30 144 255
+DodgerBlue1 30 144 255
+DodgerBlue2 28 134 238
+DodgerBlue3 24 116 205
+DodgerBlue4 16 78 139
+firebrick 178 34 34
+firebrick1 255 48 48
+firebrick2 238 44 44
+firebrick3 205 38 38
+firebrick4 139 26 26
+floral white 255 250 240
+FloralWhite 255 250 240
+forest green 34 139 34
+ForestGreen 34 139 34
+gainsboro 220 220 220
+ghost white 248 248 255
+GhostWhite 248 248 255
+gold 255 215 0
+gold1 255 215 0
+gold2 238 201 0
+gold3 205 173 0
+gold4 139 117 0
+goldenrod 218 165 32
+goldenrod1 255 193 37
+goldenrod2 238 180 34
+goldenrod3 205 155 29
+goldenrod4 139 105 20
+gray 190 190 190
+gray0 0 0 0
+gray1 3 3 3
+gray2 5 5 5
+gray3 8 8 8
+gray4 10 10 10
+gray5 13 13 13
+gray6 15 15 15
+gray7 18 18 18
+gray8 20 20 20
+gray9 23 23 23
+gray10 26 26 26
+gray11 28 28 28
+gray12 31 31 31
+gray13 33 33 33
+gray14 36 36 36
+gray15 38 38 38
+gray16 41 41 41
+gray17 43 43 43
+gray18 46 46 46
+gray19 48 48 48
+gray20 51 51 51
+gray21 54 54 54
+gray22 56 56 56
+gray23 59 59 59
+gray24 61 61 61
+gray25 64 64 64
+gray26 66 66 66
+gray27 69 69 69
+gray28 71 71 71
+gray29 74 74 74
+gray30 77 77 77
+gray31 79 79 79
+gray32 82 82 82
+gray33 84 84 84
+gray34 87 87 87
+gray35 89 89 89
+gray36 92 92 92
+gray37 94 94 94
+gray38 97 97 97
+gray39 99 99 99
+gray40 102 102 102
+gray41 105 105 105
+gray42 107 107 107
+gray43 110 110 110
+gray44 112 112 112
+gray45 115 115 115
+gray46 117 117 117
+gray47 120 120 120
+gray48 122 122 122
+gray49 125 125 125
+gray50 127 127 127
+gray51 130 130 130
+gray52 133 133 133
+gray53 135 135 135
+gray54 138 138 138
+gray55 140 140 140
+gray56 143 143 143
+gray57 145 145 145
+gray58 148 148 148
+gray59 150 150 150
+gray60 153 153 153
+gray61 156 156 156
+gray62 158 158 158
+gray63 161 161 161
+gray64 163 163 163
+gray65 166 166 166
+gray66 168 168 168
+gray67 171 171 171
+gray68 173 173 173
+gray69 176 176 176
+gray70 179 179 179
+gray71 181 181 181
+gray72 184 184 184
+gray73 186 186 186
+gray74 189 189 189
+gray75 191 191 191
+gray76 194 194 194
+gray77 196 196 196
+gray78 199 199 199
+gray79 201 201 201
+gray80 204 204 204
+gray81 207 207 207
+gray82 209 209 209
+gray83 212 212 212
+gray84 214 214 214
+gray85 217 217 217
+gray86 219 219 219
+gray87 222 222 222
+gray88 224 224 224
+gray89 227 227 227
+gray90 229 229 229
+gray91 232 232 232
+gray92 235 235 235
+gray93 237 237 237
+gray94 240 240 240
+gray95 242 242 242
+gray96 245 245 245
+gray97 247 247 247
+gray98 250 250 250
+gray99 252 252 252
+gray100 255 255 255
+green 0 255 0
+green yellow 173 255 47
+green1 0 255 0
+green2 0 238 0
+green3 0 205 0
+green4 0 139 0
+GreenYellow 173 255 47
+grey 190 190 190
+grey0 0 0 0
+grey1 3 3 3
+grey2 5 5 5
+grey3 8 8 8
+grey4 10 10 10
+grey5 13 13 13
+grey6 15 15 15
+grey7 18 18 18
+grey8 20 20 20
+grey9 23 23 23
+grey10 26 26 26
+grey11 28 28 28
+grey12 31 31 31
+grey13 33 33 33
+grey14 36 36 36
+grey15 38 38 38
+grey16 41 41 41
+grey17 43 43 43
+grey18 46 46 46
+grey19 48 48 48
+grey20 51 51 51
+grey21 54 54 54
+grey22 56 56 56
+grey23 59 59 59
+grey24 61 61 61
+grey25 64 64 64
+grey26 66 66 66
+grey27 69 69 69
+grey28 71 71 71
+grey29 74 74 74
+grey30 77 77 77
+grey31 79 79 79
+grey32 82 82 82
+grey33 84 84 84
+grey34 87 87 87
+grey35 89 89 89
+grey36 92 92 92
+grey37 94 94 94
+grey38 97 97 97
+grey39 99 99 99
+grey40 102 102 102
+grey41 105 105 105
+grey42 107 107 107
+grey43 110 110 110
+grey44 112 112 112
+grey45 115 115 115
+grey46 117 117 117
+grey47 120 120 120
+grey48 122 122 122
+grey49 125 125 125
+grey50 127 127 127
+grey51 130 130 130
+grey52 133 133 133
+grey53 135 135 135
+grey54 138 138 138
+grey55 140 140 140
+grey56 143 143 143
+grey57 145 145 145
+grey58 148 148 148
+grey59 150 150 150
+grey60 153 153 153
+grey61 156 156 156
+grey62 158 158 158
+grey63 161 161 161
+grey64 163 163 163
+grey65 166 166 166
+grey66 168 168 168
+grey67 171 171 171
+grey68 173 173 173
+grey69 176 176 176
+grey70 179 179 179
+grey71 181 181 181
+grey72 184 184 184
+grey73 186 186 186
+grey74 189 189 189
+grey75 191 191 191
+grey76 194 194 194
+grey77 196 196 196
+grey78 199 199 199
+grey79 201 201 201
+grey80 204 204 204
+grey81 207 207 207
+grey82 209 209 209
+grey83 212 212 212
+grey84 214 214 214
+grey85 217 217 217
+grey86 219 219 219
+grey87 222 222 222
+grey88 224 224 224
+grey89 227 227 227
+grey90 229 229 229
+grey91 232 232 232
+grey92 235 235 235
+grey93 237 237 237
+grey94 240 240 240
+grey95 242 242 242
+grey96 245 245 245
+grey97 247 247 247
+grey98 250 250 250
+grey99 252 252 252
+grey100 255 255 255
+honeydew 240 255 240
+honeydew1 240 255 240
+honeydew2 224 238 224
+honeydew3 193 205 193
+honeydew4 131 139 131
+hot pink 255 105 180
+HotPink 255 105 180
+HotPink1 255 110 180
+HotPink2 238 106 167
+HotPink3 205 96 144
+HotPink4 139 58 98
+indian red 205 92 92
+IndianRed 205 92 92
+IndianRed1 255 106 106
+IndianRed2 238 99 99
+IndianRed3 205 85 85
+IndianRed4 139 58 58
+ivory 255 255 240
+ivory1 255 255 240
+ivory2 238 238 224
+ivory3 205 205 193
+ivory4 139 139 131
+khaki 240 230 140
+khaki1 255 246 143
+khaki2 238 230 133
+khaki3 205 198 115
+khaki4 139 134 78
+lavender 230 230 250
+lavender blush 255 240 245
+LavenderBlush 255 240 245
+LavenderBlush1 255 240 245
+LavenderBlush2 238 224 229
+LavenderBlush3 205 193 197
+LavenderBlush4 139 131 134
+lawn green 124 252 0
+LawnGreen 124 252 0
+lemon chiffon 255 250 205
+LemonChiffon 255 250 205
+LemonChiffon1 255 250 205
+LemonChiffon2 238 233 191
+LemonChiffon3 205 201 165
+LemonChiffon4 139 137 112
+light blue 173 216 230
+light coral 240 128 128
+light cyan 224 255 255
+light goldenrod 238 221 130
+light goldenrod yellow 250 250 210
+light gray 211 211 211
+light green 144 238 144
+light grey 211 211 211
+light pink 255 182 193
+light salmon 255 160 122
+light sea green 32 178 170
+light sky blue 135 206 250
+light slate blue 132 112 255
+light slate gray 119 136 153
+light slate grey 119 136 153
+light steel blue 176 196 222
+light yellow 255 255 224
+LightBlue 173 216 230
+LightBlue1 191 239 255
+LightBlue2 178 223 238
+LightBlue3 154 192 205
+LightBlue4 104 131 139
+LightCoral 240 128 128
+LightCyan 224 255 255
+LightCyan1 224 255 255
+LightCyan2 209 238 238
+LightCyan3 180 205 205
+LightCyan4 122 139 139
+LightGoldenrod 238 221 130
+LightGoldenrod1 255 236 139
+LightGoldenrod2 238 220 130
+LightGoldenrod3 205 190 112
+LightGoldenrod4 139 129 76
+LightGoldenrodYellow 250 250 210
+LightGray 211 211 211
+LightGreen 144 238 144
+LightGrey 211 211 211
+LightPink 255 182 193
+LightPink1 255 174 185
+LightPink2 238 162 173
+LightPink3 205 140 149
+LightPink4 139 95 101
+LightSalmon 255 160 122
+LightSalmon1 255 160 122
+LightSalmon2 238 149 114
+LightSalmon3 205 129 98
+LightSalmon4 139 87 66
+LightSeaGreen 32 178 170
+LightSkyBlue 135 206 250
+LightSkyBlue1 176 226 255
+LightSkyBlue2 164 211 238
+LightSkyBlue3 141 182 205
+LightSkyBlue4 96 123 139
+LightSlateBlue 132 112 255
+LightSlateGray 119 136 153
+LightSlateGrey 119 136 153
+LightSteelBlue 176 196 222
+LightSteelBlue1 202 225 255
+LightSteelBlue2 188 210 238
+LightSteelBlue3 162 181 205
+LightSteelBlue4 110 123 139
+LightYellow 255 255 224
+LightYellow1 255 255 224
+LightYellow2 238 238 209
+LightYellow3 205 205 180
+LightYellow4 139 139 122
+lime green 50 205 50
+LimeGreen 50 205 50
+linen 250 240 230
+magenta 255 0 255
+magenta1 255 0 255
+magenta2 238 0 238
+magenta3 205 0 205
+magenta4 139 0 139
+maroon 176 48 96
+maroon1 255 52 179
+maroon2 238 48 167
+maroon3 205 41 144
+maroon4 139 28 98
+medium aquamarine 102 205 170
+medium blue 0 0 205
+medium orchid 186 85 211
+medium purple 147 112 219
+medium sea green 60 179 113
+medium slate blue 123 104 238
+medium spring green 0 250 154
+medium turquoise 72 209 204
+medium violet red 199 21 133
+MediumAquamarine 102 205 170
+MediumBlue 0 0 205
+MediumOrchid 186 85 211
+MediumOrchid1 224 102 255
+MediumOrchid2 209 95 238
+MediumOrchid3 180 82 205
+MediumOrchid4 122 55 139
+MediumPurple 147 112 219
+MediumPurple1 171 130 255
+MediumPurple2 159 121 238
+MediumPurple3 137 104 205
+MediumPurple4 93 71 139
+MediumSeaGreen 60 179 113
+MediumSlateBlue 123 104 238
+MediumSpringGreen 0 250 154
+MediumTurquoise 72 209 204
+MediumVioletRed 199 21 133
+midnight blue 25 25 112
+MidnightBlue 25 25 112
+mint cream 245 255 250
+MintCream 245 255 250
+misty rose 255 228 225
+MistyRose 255 228 225
+MistyRose1 255 228 225
+MistyRose2 238 213 210
+MistyRose3 205 183 181
+MistyRose4 139 125 123
+moccasin 255 228 181
+navajo white 255 222 173
+NavajoWhite 255 222 173
+NavajoWhite1 255 222 173
+NavajoWhite2 238 207 161
+NavajoWhite3 205 179 139
+NavajoWhite4 139 121 94
+navy 0 0 128
+navy blue 0 0 128
+NavyBlue 0 0 128
+old lace 253 245 230
+OldLace 253 245 230
+olive drab 107 142 35
+OliveDrab 107 142 35
+OliveDrab1 192 255 62
+OliveDrab2 179 238 58
+OliveDrab3 154 205 50
+OliveDrab4 105 139 34
+orange 255 165 0
+orange red 255 69 0
+orange1 255 165 0
+orange2 238 154 0
+orange3 205 133 0
+orange4 139 90 0
+OrangeRed 255 69 0
+OrangeRed1 255 69 0
+OrangeRed2 238 64 0
+OrangeRed3 205 55 0
+OrangeRed4 139 37 0
+orchid 218 112 214
+orchid1 255 131 250
+orchid2 238 122 233
+orchid3 205 105 201
+orchid4 139 71 137
+pale goldenrod 238 232 170
+pale green 152 251 152
+pale turquoise 175 238 238
+pale violet red 219 112 147
+PaleGoldenrod 238 232 170
+PaleGreen 152 251 152
+PaleGreen1 154 255 154
+PaleGreen2 144 238 144
+PaleGreen3 124 205 124
+PaleGreen4 84 139 84
+PaleTurquoise 175 238 238
+PaleTurquoise1 187 255 255
+PaleTurquoise2 174 238 238
+PaleTurquoise3 150 205 205
+PaleTurquoise4 102 139 139
+PaleVioletRed 219 112 147
+PaleVioletRed1 255 130 171
+PaleVioletRed2 238 121 159
+PaleVioletRed3 205 104 127
+PaleVioletRed4 139 71 93
+papaya whip 255 239 213
+PapayaWhip 255 239 213
+peach puff 255 218 185
+PeachPuff 255 218 185
+PeachPuff1 255 218 185
+PeachPuff2 238 203 173
+PeachPuff3 205 175 149
+PeachPuff4 139 119 101
+peru 205 133 63
+pink 255 192 203
+pink1 255 181 197
+pink2 238 169 184
+pink3 205 145 158
+pink4 139 99 108
+plum 221 160 221
+plum1 255 187 255
+plum2 238 174 238
+plum3 205 150 205
+plum4 139 102 139
+powder blue 176 224 230
+PowderBlue 176 224 230
+purple 160 32 240
+purple1 155 48 255
+purple2 145 44 238
+purple3 125 38 205
+purple4 85 26 139
+red 255 0 0
+red1 255 0 0
+red2 238 0 0
+red3 205 0 0
+red4 139 0 0
+rosy brown 188 143 143
+RosyBrown 188 143 143
+RosyBrown1 255 193 193
+RosyBrown2 238 180 180
+RosyBrown3 205 155 155
+RosyBrown4 139 105 105
+royal blue 65 105 225
+RoyalBlue 65 105 225
+RoyalBlue1 72 118 255
+RoyalBlue2 67 110 238
+RoyalBlue3 58 95 205
+RoyalBlue4 39 64 139
+saddle brown 139 69 19
+SaddleBrown 139 69 19
+salmon 250 128 114
+salmon1 255 140 105
+salmon2 238 130 98
+salmon3 205 112 84
+salmon4 139 76 57
+sandy brown 244 164 96
+SandyBrown 244 164 96
+sea green 46 139 87
+SeaGreen 46 139 87
+SeaGreen1 84 255 159
+SeaGreen2 78 238 148
+SeaGreen3 67 205 128
+SeaGreen4 46 139 87
+seashell 255 245 238
+seashell1 255 245 238
+seashell2 238 229 222
+seashell3 205 197 191
+seashell4 139 134 130
+sienna 160 82 45
+sienna1 255 130 71
+sienna2 238 121 66
+sienna3 205 104 57
+sienna4 139 71 38
+sky blue 135 206 235
+SkyBlue 135 206 235
+SkyBlue1 135 206 255
+SkyBlue2 126 192 238
+SkyBlue3 108 166 205
+SkyBlue4 74 112 139
+slate blue 106 90 205
+slate gray 112 128 144
+slate grey 112 128 144
+SlateBlue 106 90 205
+SlateBlue1 131 111 255
+SlateBlue2 122 103 238
+SlateBlue3 105 89 205
+SlateBlue4 71 60 139
+SlateGray 112 128 144
+SlateGray1 198 226 255
+SlateGray2 185 211 238
+SlateGray3 159 182 205
+SlateGray4 108 123 139
+SlateGrey 112 128 144
+snow 255 250 250
+snow1 255 250 250
+snow2 238 233 233
+snow3 205 201 201
+snow4 139 137 137
+spring green 0 255 127
+SpringGreen 0 255 127
+SpringGreen1 0 255 127
+SpringGreen2 0 238 118
+SpringGreen3 0 205 102
+SpringGreen4 0 139 69
+steel blue 70 130 180
+SteelBlue 70 130 180
+SteelBlue1 99 184 255
+SteelBlue2 92 172 238
+SteelBlue3 79 148 205
+SteelBlue4 54 100 139
+tan 210 180 140
+tan1 255 165 79
+tan2 238 154 73
+tan3 205 133 63
+tan4 139 90 43
+thistle 216 191 216
+thistle1 255 225 255
+thistle2 238 210 238
+thistle3 205 181 205
+thistle4 139 123 139
+tomato 255 99 71
+tomato1 255 99 71
+tomato2 238 92 66
+tomato3 205 79 57
+tomato4 139 54 38
+turquoise 64 224 208
+turquoise1 0 245 255
+turquoise2 0 229 238
+turquoise3 0 197 205
+turquoise4 0 134 139
+violet 238 130 238
+violet red 208 32 144
+VioletRed 208 32 144
+VioletRed1 255 62 150
+VioletRed2 238 58 140
+VioletRed3 205 50 120
+VioletRed4 139 34 82
+wheat 245 222 179
+wheat1 255 231 186
+wheat2 238 216 174
+wheat3 205 186 150
+wheat4 139 126 102
+white 255 255 255
+white smoke 245 245 245
+WhiteSmoke 245 245 245
+yellow 255 255 0
+yellow green 154 205 50
+yellow1 255 255 0
+yellow2 238 238 0
+yellow3 205 205 0
+yellow4 139 139 0
+YellowGreen 154 205 50
+.DE
.SH "PORTABILITY ISSUES"
-
.TP
\fBMac OS X\fR
+.
On Mac OS X, the following additional system colors are available
(note that the actual color values depend on the currently active OS theme,
and typically many of these will in fact be patterns rather than pure colors):
.RS
-.CS
-systemTransparent
-systemBlack
-systemWhite
-systemHighlight
-systemPrimaryHighlightColor
-systemHighlightSecondary
-systemSecondaryHighlightColor
-systemHighlightAlternate
-systemAlternatePrimaryHighlightColor
-systemHighlightText
-systemDialogBackgroundActive
-systemDialogBackgroundInactive
+.DS
+systemActiveAreaFill
+systemAlertActiveText
systemAlertBackgroundActive
systemAlertBackgroundInactive
-systemModelessDialogBackgroundActive
-systemModelessDialogBackgroundInactive
-systemUtilityWindowBackgroundActive
-systemUtilityWindowBackgroundInactive
-systemListViewSortColumnBackground
-systemListViewBackground
-systemIconLabelBackground
-systemListViewSeparator
-systemChasingArrows
-systemDragHilite
-systemWindowBody
-systemDocumentWindowBackground
-systemFinderWindowBackground
-systemScrollBarDelimiterActive
-systemScrollBarDelimiterInactive
-systemFocusHighlight
-systemPopupArrowActive
-systemPopupArrowPressed
-systemPopupArrowInactive
+systemAlertInactiveText
+systemAlternatePrimaryHighlightColor
systemAppleGuideCoachmark
-systemIconLabelBackgroundSelected
-systemStaticAreaFill
-systemActiveAreaFill
-systemButtonFrame
-systemButtonFrameActive
-systemButtonFrameInactive
+systemBevelActiveDark
+systemBevelActiveLight
+systemBevelButtonActiveText
+systemBevelButtonInactiveText
+systemBevelButtonPressedText
+systemBevelButtonStickyActiveText
+systemBevelButtonStickyInactiveText
+systemBevelInactiveDark
+systemBevelInactiveLight
+systemBlack
+systemBlackText
+systemButtonActiveDarkHighlight
+systemButtonActiveDarkShadow
+systemButtonActiveLightHighlight
+systemButtonActiveLightShadow
systemButtonFace
systemButtonFaceActive
systemButtonFaceInactive
systemButtonFacePressed
-systemButtonActiveDarkShadow
-systemButtonActiveDarkHighlight
-systemButtonActiveLightShadow
-systemButtonActiveLightHighlight
-systemButtonInactiveDarkShadow
+systemButtonFrame
+systemButtonFrameActive
+systemButtonFrameInactive
systemButtonInactiveDarkHighlight
-systemButtonInactiveLightShadow
+systemButtonInactiveDarkShadow
systemButtonInactiveLightHighlight
-systemButtonPressedDarkShadow
+systemButtonInactiveLightShadow
systemButtonPressedDarkHighlight
-systemButtonPressedLightShadow
+systemButtonPressedDarkShadow
systemButtonPressedLightHighlight
-systemBevelActiveLight
-systemBevelActiveDark
-systemBevelInactiveLight
-systemBevelInactiveDark
-systemNotificationWindowBackground
-systemMovableModalBackground
-systemSheetBackground
-systemSheetBackgroundOpaque
+systemButtonPressedLightShadow
+systemButtonText
+systemChasingArrows
+systemDialogActiveText
+systemDialogBackgroundActive
+systemDialogBackgroundInactive
+systemDialogInactiveText
+systemDocumentWindowBackground
+systemDocumentWindowTitleActiveText
+systemDocumentWindowTitleInactiveText
+systemDragHilite
systemDrawerBackground
-systemToolbarBackground
-systemSheetBackgroundTransparent
+systemFinderWindowBackground
+systemFocusHighlight
+systemHighlight
+systemHighlightAlternate
+systemHighlightSecondary
+systemHighlightText
+systemIconLabelBackground
+systemIconLabelBackgroundSelected
+systemIconLabelSelectedText
+systemIconLabelText
+systemListViewBackground
+systemListViewColumnDivider
+systemListViewEvenRowBackground
+systemListViewOddRowBackground
+systemListViewSeparator
+systemListViewSortColumnBackground
+systemListViewText
+systemListViewWindowHeaderBackground
systemMenu
-systemMenuBackground
systemMenuActive
+systemMenuActiveText
+systemMenuBackground
systemMenuBackgroundSelected
-systemListViewOddRowBackground
-systemListViewEvenRowBackground
-systemListViewColumnDivider
-systemTabPaneBackground
-systemPlacardBackground
-systemWindowHeaderBackground
-systemListViewWindowHeaderBackground
-systemSecondaryGroupBoxBackground
+systemMenuDisabled
+systemMenuItemActiveText
+systemMenuItemDisabledText
+systemMenuItemSelectedText
+systemMenuText
systemMetalBackground
-systemBlackText
-systemWhiteText
-systemDialogActiveText
-systemDialogInactiveText
-systemAlertActiveText
-systemAlertInactiveText
systemModelessDialogActiveText
+systemModelessDialogBackgroundActive
+systemModelessDialogBackgroundInactive
systemModelessDialogInactiveText
-systemWindowHeaderActiveText
-systemWindowHeaderInactiveText
+systemMovableModalBackground
+systemMovableModalWindowTitleActiveText
+systemMovableModalWindowTitleInactiveText
+systemNotificationText
+systemNotificationWindowBackground
systemPlacardActiveText
+systemPlacardBackground
systemPlacardInactiveText
systemPlacardPressedText
-systemButtonText
-systemPushButtonActiveText
-systemPushButtonInactiveText
-systemPushButtonPressedText
-systemBevelButtonActiveText
-systemBevelButtonInactiveText
-systemBevelButtonPressedText
+systemPopupArrowActive
+systemPopupArrowInactive
+systemPopupArrowPressed
systemPopupButtonActiveText
systemPopupButtonInactiveText
systemPopupButtonPressedText
-systemIconLabelText
-systemListViewText
-systemDocumentWindowTitleActiveText
-systemDocumentWindowTitleInactiveText
-systemMovableModalWindowTitleActiveText
-systemMovableModalWindowTitleInactiveText
-systemUtilityWindowTitleActiveText
-systemUtilityWindowTitleInactiveText
+systemPopupLabelActiveText
+systemPopupLabelInactiveText
systemPopupWindowTitleActiveText
systemPopupWindowTitleInactiveText
+systemPrimaryHighlightColor
+systemPushButtonActiveText
+systemPushButtonInactiveText
+systemPushButtonPressedText
systemRootMenuActiveText
-systemRootMenuSelectedText
systemRootMenuDisabledText
-systemMenuText
-systemMenuItemActiveText
-systemMenuActiveText
-systemMenuItemSelectedText
-systemMenuDisabled
-systemMenuItemDisabledText
-systemPopupLabelActiveText
-systemPopupLabelInactiveText
+systemRootMenuSelectedText
+systemScrollBarDelimiterActive
+systemScrollBarDelimiterInactive
+systemSecondaryGroupBoxBackground
+systemSecondaryHighlightColor
+systemSheetBackground
+systemSheetBackgroundOpaque
+systemSheetBackgroundTransparent
+systemStaticAreaFill
+systemSystemDetailText
systemTabFrontActiveText
-systemTabNonFrontActiveText
-systemTabNonFrontPressedText
systemTabFrontInactiveText
+systemTabNonFrontActiveText
systemTabNonFrontInactiveText
-systemIconLabelSelectedText
-systemBevelButtonStickyActiveText
-systemBevelButtonStickyInactiveText
-systemNotificationText
-systemSystemDetailText
-.CE
+systemTabNonFrontPressedText
+systemTabPaneBackground
+systemToolbarBackground
+systemTransparent
+systemUtilityWindowBackgroundActive
+systemUtilityWindowBackgroundInactive
+systemUtilityWindowTitleActiveText
+systemUtilityWindowTitleInactiveText
+systemWhite
+systemWhiteText
+systemWindowBody
+systemWindowHeaderActiveText
+systemWindowHeaderBackground
+systemWindowHeaderInactiveText
+.DE
+.RE
+.TP
+\fBWindows\fR
+.
+On Windows, the following additional system colors are available
+(note that the actual color values depend on the currently active OS theme):
+.RS
+.DS
+.ta 6c
+3dDarkShadow Highlight
+3dLight HighlightText
+ActiveBorder InactiveBorder
+ActiveCaption InactiveCaption
+AppWorkspace InactiveCaptionText
+Background InfoBackground
+ButtonFace InfoText
+ButtonHighlight Menu
+ButtonShadow MenuText
+ButtonText Scrollbar
+CaptionText Window
+DisabledText WindowFrame
+GrayText WindowText
+.DE
.RE
-
+.SH "SEE ALSO"
+options(n), Tk_GetColor(3)
.SH KEYWORDS
color, option
diff --git a/doc/console.n b/doc/console.n
index c6ea1d1..8e0691c 100644
--- a/doc/console.n
+++ b/doc/console.n
@@ -13,7 +13,6 @@ console \- Control the console on systems without a real console
.SH SYNOPSIS
\fBconsole\fR \fIsubcommand\fR ?\fIarg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The console window is a replacement for a real console to allow input
@@ -22,7 +21,13 @@ a real console. It is implemented as a separate interpreter with the
Tk toolkit loaded, and control over this interpreter is given through
the \fBconsole\fR command. The behaviour of the console window is
defined mainly through the contents of the \fIconsole.tcl\fR file in
-the Tk library (or the \fIConsole\fR resource on Macintosh systems.)
+the Tk library. Except for TkAqua, this command is not available when
+Tk is loaded into a tclsh interpreter with
+.QW "\fBpackage require Tk\fR" ,
+as a conventional terminal is expected to be present in that case.
+In TkAqua, this command is ony available when stdin is \fB/dev/null\fR
+(as is the case e.g. when the application embedding Tk is started
+from the Mac OS X Finder).
.PP
.TP
\fBconsole eval \fIscript\fR
@@ -130,9 +135,7 @@ often has the following code fragment in it so output produced by
.CS
catch {\fBconsole show\fR}
.CE
-
-.SH KEYWORDS
-console, interpreter, window, interactive, output channels
-
.SH "SEE ALSO"
destroy(n), fconfigure(n), history(n), interp(n), puts(n), text(n), wm(n)
+.SH KEYWORDS
+console, interpreter, window, interactive, output channels
diff --git a/doc/cursors.n b/doc/cursors.n
index 06a0208..8bc2a8f 100644
--- a/doc/cursors.n
+++ b/doc/cursors.n
@@ -11,10 +11,9 @@
.SH NAME
cursors \- mouse cursors available in Tk
.BE
-
.SH DESCRIPTION
.PP
-The \fB-cursor\fR widget option allows a Tk programmer to change the
+The \fB\-cursor\fR widget option allows a Tk programmer to change the
mouse cursor for a particular widget. The cursor names recognized by
Tk on all platforms are:
.CS
@@ -61,6 +60,7 @@ lr_angle
man
middlebutton
mouse
+none
pencil
pirate
plus
@@ -96,9 +96,9 @@ ur_angle
watch
xterm
.CE
-
+.PP
+The \fBnone\fR cursor can be specified to eliminate the cursor.
.SH "PORTABILITY ISSUES"
-
.TP
\fBWindows\fR
On Windows systems, the following cursors are mapped to native cursors:
@@ -110,6 +110,7 @@ crosshair
fleur
ibeam
icon
+none
sb_h_double_arrow
sb_v_double_arrow
watch
@@ -127,9 +128,7 @@ size_we
uparrow
wait
.CE
-The \fBno\fR cursor can be specified to eliminate the cursor.
.RE
-
.TP
\fBMac OS X\fR
On Mac OS X systems, the following cursors are mapped to native cursors:
@@ -139,6 +138,7 @@ arrow
cross
crosshair
ibeam
+none
plus
watch
xterm
@@ -159,7 +159,6 @@ resizeleftright
resizeup
resizedown
resizeupdown
-none
notallowed
poof
countinguphand
@@ -168,6 +167,5 @@ countingupanddownhand
spinning
.CE
.RE
-
.SH KEYWORDS
cursor, option
diff --git a/doc/destroy.n b/doc/destroy.n
index 65b0caa..93aedd5 100644
--- a/doc/destroy.n
+++ b/doc/destroy.n
@@ -14,19 +14,18 @@ destroy \- Destroy one or more windows
.SH SYNOPSIS
\fBdestroy \fR?\fIwindow window ...\fR?
.BE
-
.SH DESCRIPTION
-.VS
.PP
This command deletes the windows given by the
\fIwindow\fR arguments, plus all of their descendants.
-If a \fIwindow\fR ``.'' is deleted then the entire application
-will be destroyed.
+If a \fIwindow\fR
+.QW .
+is deleted then all windows will be destroyed and the application will
+(normally) exit.
The \fIwindow\fRs are destroyed in order, and if an error occurs
in destroying a window the command aborts without destroying the
remaining windows.
No error is returned if \fIwindow\fR does not exist.
-.VE
.SH EXAMPLE
Destroy all checkbuttons that are direct children of the given widget:
.CS
diff --git a/doc/dialog.n b/doc/dialog.n
index 1f91b3f..e72cbac 100644
--- a/doc/dialog.n
+++ b/doc/dialog.n
@@ -39,7 +39,7 @@ If this is an empty string then no bitmap is displayed in the dialog.
If this is an integer greater than or equal to zero, then it gives
the index of the button that is to be the default button for the dialog
(0 for the leftmost button, and so on).
-If less than zero or an empty string then there won't be any default
+If less than zero or an empty string then there will not be any default
button.
.TP
\fIstring\fR
@@ -53,14 +53,14 @@ mouse or by typing return to invoke the default button (if any).
Then it returns the index of the selected button: 0 for the leftmost
button, 1 for the button next to it, and so on.
If the dialog's window is destroyed before the user selects one
-of the buttons, then -1 is returned.
+of the buttons, then \-1 is returned.
.PP
While waiting for the user to respond, \fBtk_dialog\fR sets a local
grab. This prevents the user from interacting with the application
in any way except to invoke the dialog box.
.SH EXAMPLE
.CS
-set reply [\fBtk_dialog\fR .foo "The Title" "Do you want to say yes?" \\
+set reply [\fBtk_dialog\fR .foo "The Title" "Do you want to say yes?" \e
questhead 0 Yes No "I'm not sure"]
.CE
diff --git a/doc/entry.n b/doc/entry.n
index 5a34b47..58c5d64 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -25,37 +25,31 @@ entry \- Create and manipulate entry widgets
\-highlightcolor \-relief
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
-.VS 8.4
.OP \-disabledbackground disabledBackground DisabledBackground
Specifies the background color to use when the entry is disabled. If
this option is the empty string, the normal background color is used.
.OP \-disabledforeground disabledForeground DisabledForeground
Specifies the foreground color to use when the entry is disabled. If
this option is the empty string, the normal foreground color is used.
-.VE 8.4
-.VS 8.3
.OP "\-invalidcommand or \-invcmd" invalidCommand InvalidCommand
Specifies a script to eval when \fBvalidateCommand\fR returns 0.
Setting it to {} disables this feature (the default). The best use
of this option is to set it to \fIbell\fR. See \fBValidation\fR
below for more information.
-.VE
-.VS 8.4
.OP \-readonlybackground readonlyBackground ReadonlyBackground
Specifies the background color to use when the entry is readonly. If
this option is the empty string, the normal background color is used.
-.VE
.OP \-show show Show
If this option is specified, then the true contents of the entry
are not displayed in the window.
Instead, each character in the entry's value will be displayed as
-the first character in the value of this option, such as ``*''.
+the first character in the value of this option, such as
+.QW * .
This is useful, for example, if the entry is to be used to enter
a password.
If characters in the entry are selected and copied elsewhere, the
information copied will be what is displayed, not the true contents
of the entry.
-.VS 8.4
.OP \-state state State
Specifies one of three states for the entry: \fBnormal\fR,
\fBdisabled\fR, or \fBreadonly\fR. If the entry is readonly, then the
@@ -65,9 +59,7 @@ contents of the widget may still be selected. If the entry is
disabled, the value may not be changed, no insertion cursor will be
displayed, the contents will not be selectable, and the entry may
be displayed in a different color, depending on the values of the
-\fB-disabledforeground\fR and \fB-disabledbackground\fR options.
-.VE 8.4
-.VS 8.3
+\fB\-disabledforeground\fR and \fB\-disabledbackground\fR options.
.OP \-validate validate Validate
Specifies the mode in which validation should operate: \fBnone\fR,
\fBfocus\fR, \fBfocusin\fR, \fBfocusout\fR, \fBkey\fR, or \fBall\fR.
@@ -81,14 +73,12 @@ the valid Tcl boolean equivalent) then it means you reject the new edition
and it will not occur and the \fBinvalidCommand\fR will be evaluated if it
is set. If it returns 1, then the new edition occurs.
See \fBValidation\fR below for more information.
-.VE
.OP \-width width Width
Specifies an integer value indicating the desired width of the entry window,
in average-size characters of the widget's font.
If the value is less than or equal to zero, the widget picks a
size just large enough to hold its current text.
.BE
-
.SH DESCRIPTION
.PP
The \fBentry\fR command creates a new window (given by the
@@ -122,7 +112,6 @@ the standard \fBxScrollCommand\fR mechanism for interacting with
scrollbars (see the description of the \fBxScrollCommand\fR option
for details). They also support scanning, as described below.
.SH VALIDATION
-.VS 8.3
.PP
Validation works by setting the \fBvalidateCommand\fR
option to a script which will be evaluated according to the \fBvalidate\fR
@@ -149,9 +138,9 @@ are recognized:
.PP
.IP \fB%d\fR 5
Type of action: 1 for \fBinsert\fR, 0 for \fBdelete\fR,
-or -1 for focus, forced or textvariable validation.
+or \-1 for focus, forced or textvariable validation.
.IP \fB%i\fR 5
-Index of char string to be inserted/deleted, if any, otherwise -1.
+Index of char string to be inserted/deleted, if any, otherwise \-1.
.IP \fB%P\fR 5
The value of the entry if the edit is allowed. If you are configuring the
entry widget to have a new textvariable, this will be the value of that
@@ -188,23 +177,23 @@ validated. If you wish to edit the entry widget (for example set it to {})
during validation and still have the \fBvalidate\fR option set, you should
include the command
.CS
-after idle {%W config -validate %v}
+after idle {%W config \-validate %v}
.CE
in the \fBvalidateCommand\fR or \fBinvalidCommand\fR (whichever one you
were editing the entry widget from). It is also recommended to not set an
associated \fBtextVariable\fR during validation, as that can cause the
entry widget to become out of sync with the \fBtextVariable\fR.
-.VE
.SH "WIDGET COMMAND"
.PP
The \fBentry\fR command creates a new Tcl command whose
name is \fIpathName\fR. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName subcommand \fR?\fIarg arg ...\fR?
.CE
-\fIOption\fR and the \fIarg\fRs
+\fISubcommand\fR and the \fIarg\fRs
determine the exact behavior of the command.
+.SS INDICES
.PP
Many of the widget commands for entries take one or more indices as
arguments. An index specifies a particular character in the entry's
@@ -229,22 +218,27 @@ insertion cursor.
.TP 12
\fBsel.first\fR
Indicates the first character in the selection. It is an error to
-use this form if the selection isn't in the entry window.
+use this form if the selection is not in the entry window.
.TP 12
\fBsel.last\fR
Indicates the character just after the last one in the selection.
-It is an error to use this form if the selection isn't in the
+It is an error to use this form if the selection is not in the
entry window.
.TP 12
\fB@\fInumber\fR
In this form, \fInumber\fR is treated as an x-coordinate in the
entry's window; the character spanning that x-coordinate is used.
-For example, ``\fB@0\fR'' indicates the left-most character in the
-window.
+For example,
+.QW \fB@0\fR
+indicates the left-most character in the window.
.LP
-Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR''
-or ``\fBsel.f\fR''. In general, out-of-range indices are automatically
-rounded to the nearest legal value.
+Abbreviations may be used for any of the forms above, e.g.
+.QW \fBe\fR
+or
+.QW \fBsel.f\fR .
+In general, out-of-range indices are automatically rounded to the
+nearest legal value.
+.SS SUBCOMMANDS
.PP
The following commands are possible for entry widgets:
.TP
@@ -283,7 +277,7 @@ Delete one or more elements of the entry.
\fIFirst\fR is the index of the first character to delete, and
\fIlast\fR is the index of the character just after the last
one to delete.
-If \fIlast\fR isn't specified it defaults to \fIfirst\fR+1,
+If \fIlast\fR is not specified it defaults to \fIfirst\fR+1,
i.e. a single character is deleted.
This command returns an empty string.
.TP
@@ -333,19 +327,19 @@ Locate the end of the selection nearest to the character given by
(i.e. including but not going beyond \fIindex\fR). The other
end of the selection is made the anchor point for future
\fBselect to\fR commands. If the selection
-isn't currently in the entry, then a new selection is created to
+is not currently in the entry, then a new selection is created to
include the characters between \fIindex\fR and the most recent
selection anchor point, inclusive.
Returns an empty string.
.TP
\fIpathName \fBselection clear\fR
Clear the selection if it is currently in this widget. If the
-selection isn't in this widget then the command has no effect.
+selection is not in this widget then the command has no effect.
Returns an empty string.
.TP
\fIpathName \fBselection from \fIindex\fR
Set the selection anchor point to just before the character
-given by \fIindex\fR. Doesn't change the selection.
+given by \fIindex\fR. Does not change the selection.
Returns an empty string.
.TP
\fIpathName \fBselection present\fR
@@ -369,18 +363,16 @@ to the characters from the anchor point up to but not including
\fIindex\fR.
The anchor point is determined by the most recent \fBselect from\fR
or \fBselect adjust\fR command in this widget.
-If the selection isn't in this widget then a new selection is
+If the selection is not in this widget then a new selection is
created using the most recent anchor point specified for the widget.
Returns an empty string.
.RE
-.VS 8.3
.TP
\fIpathName \fBvalidate\fR
This command is used to force an evaluation of the \fBvalidateCommand\fR
independent of the conditions specified by the \fBvalidate\fR option.
This is done by temporarily setting the \fBvalidate\fR option to \fBall\fR.
It returns 0 or 1.
-.VE
.TP
\fIpathName \fBxview \fIargs\fR
This command is used to query and change the horizontal position of the
@@ -423,10 +415,11 @@ become visible.
.SH "DEFAULT BINDINGS"
.PP
Tk automatically creates class bindings for entries that give them
-the following default behavior.
-In the descriptions below, ``word'' refers to a contiguous group
-of letters, digits, or ``_'' characters, or any single character
-other than these.
+the following default behavior. In the descriptions below,
+.QW word
+refers to a contiguous group of letters, digits, or
+.QW _
+characters, or any single character other than these.
.IP [1]
Clicking mouse button 1 positions the insertion cursor
just before the character underneath the mouse cursor, sets the
@@ -487,7 +480,7 @@ Shift-End moves the cursor to the end and extends the selection
to that point.
.IP [12]
The Select key and Control-Space set the selection anchor to the position
-of the insertion cursor. They don't affect the current selection.
+of the insertion cursor. They do not affect the current selection.
Shift-Select and Control-Shift-Space adjust the selection to the
current position of the insertion cursor, selecting from the anchor
to the insertion cursor if there was not any selection previously.
@@ -531,14 +524,13 @@ If the entry is disabled using the \fB\-state\fR option, then the entry's
view can still be adjusted and text in the entry can still be selected,
but no insertion cursor will be displayed and no text modifications will
take place
-.VS
except if the entry is linked to a variable using the \fB\-textvariable\fR
option, in which case any changes to the variable are reflected by the
entry whatever the value of its \fB\-state\fR option.
-.VE
.PP
The behavior of entries can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH "SEE ALSO"
+ttk::entry(n)
.SH KEYWORDS
entry, widget
diff --git a/doc/event.n b/doc/event.n
index 49e04d3..69f336a 100644
--- a/doc/event.n
+++ b/doc/event.n
@@ -14,7 +14,6 @@ event \- Miscellaneous event facilities: define virtual events and generate even
.SH SYNOPSIS
\fBevent\fI option \fR?\fIarg arg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The \fBevent\fR command provides several facilities for dealing with
@@ -49,10 +48,8 @@ trigger anymore.
Generates a window event and arranges for it to be processed just as if
it had come from the window system.
\fIWindow\fR gives the path name of the window for which the event
-.VS 8.3
will be generated; it may also be an identifier (such as returned by
\fBwinfo id\fR) as long as it is for a window in the current application.
-.VE
\fIEvent\fR provides a basic description of
the event, such as \fB<Shift-Button-2>\fR or \fB<<Paste>>\fR.
If \fIWindow\fR is empty the whole screen is meant, and coordinates
@@ -62,14 +59,14 @@ argument of the \fBbind\fR command except that it must consist
of a single event pattern, not a sequence.
\fIOption-value\fR pairs may be used to specify additional
attributes of the event, such as the x and y mouse position; see
-EVENT FIELDS below. If the \fB\-when\fR option is not specified, the
+\fBEVENT FIELDS\fR below. If the \fB\-when\fR option is not specified, the
event is processed immediately: all of the handlers for the event
will complete before the \fBevent generate\fR command returns.
If the \fB\-when\fR option is specified then it determines when the
event is processed. Certain events, such as key events, require
that the window has focus to receive the event properly.
.TP
-\fBevent info \fR?<<\fIvirtual\fB>>\fR?
+\fBevent info \fR?\fB<<\fIvirtual\fB>>\fR?
Returns information about virtual events.
If the \fB<<\fIvirtual\fB>>\fR argument is omitted, the return value
is a list of all the virtual events that are currently defined.
@@ -77,11 +74,17 @@ If \fB<<\fIvirtual\fB>>\fR is specified then the return value is
a list whose elements are the physical event sequences currently
defined for the given virtual event; if the virtual event is
not defined then an empty string is returned.
+.RS
+.PP
+Note that virtual events that that are not bound to physical event
+sequences are \fInot\fR returned by \fBevent info\fR.
+.RE
.SH "EVENT FIELDS"
.PP
The following options are supported for the \fBevent generate\fR
-command. These correspond to the ``%'' expansions
-allowed in binding scripts for the \fBbind\fR command.
+command. These correspond to the
+.QW %
+expansions allowed in binding scripts for the \fBbind\fR command.
.TP
\fB\-above\fI window\fR
\fIWindow\fR specifies the \fIabove\fR field for the event,
@@ -105,6 +108,13 @@ Corresponds to the \fB%b\fR substitution for binding scripts.
\fINumber\fR must be an integer; it specifies the \fIcount\fR field
for the event. Valid for \fBExpose\fR events.
Corresponds to the \fB%c\fR substitution for binding scripts.
+.VS 8.5
+.TP
+\fB\-data\fI string\fR
+\fIString\fR may be any value; it specifies the \fIuser_data\fR field
+for the event. Only valid for virtual events. Corresponds to the
+\fB%d\fR substitution for virtual events in binding scripts.
+.VE 8.5
.TP
\fB\-delta\fI number\fR
\fINumber\fR must be an integer; it specifies the \fIdelta\fR field
@@ -112,7 +122,7 @@ for the \fBMouseWheel\fR event. The \fIdelta\fR refers to the
direction and magnitude the mouse wheel was rotated. Note the value
is not a screen distance but are units of motion in the mouse wheel.
Typically these values are multiples of 120. For example, 120 should
-scroll the text widget up 4 lines and -240 would scroll the text
+scroll the text widget up 4 lines and \-240 would scroll the text
widget down 8 lines. Of course, other widgets may define different
behaviors for mouse wheel motion. This field corresponds to the
\fB%D\fR substitution for binding scripts.
@@ -123,10 +133,10 @@ and must be one of the following:
.RS
.DS
.ta 6c
-\fBNotifyAncestor NotifyNonlinearVirtual
-NotifyDetailNone NotifyPointer
-NotifyInferior NotifyPointerRoot
-NotifyNonlinear NotifyVirtual\fR
+\fBNotifyAncestor\fR \fBNotifyNonlinearVirtual\fR
+\fBNotifyDetailNone\fR \fBNotifyPointer\fR
+\fBNotifyInferior\fR \fBNotifyPointerRoot\fR
+\fBNotifyNonlinear\fR \fBNotifyVirtual\fR
.DE
Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR and
\fBFocusOut\fR events.
@@ -297,6 +307,74 @@ for binding scripts.
Any options that are not specified when generating an event are filled
with the value 0, except for \fIserial\fR, which is filled with the
next X event serial number.
+.SH "PREDEFINED VIRTUAL EVENTS"
+Tk defines the following virtual events for the purposes of
+notification:
+.TP
+\fB<<AltUnderlined>>\fR
+This is sent to widget to notify it that the letter it has underlined
+(as an accelerator indicator) with the \fB\-underline\fR option has
+been pressed in combination with the Alt key. The usual response to
+this is to either focus into the widget (or some related widget) or to
+invoke the widget.
+.TP
+\fB<<ListboxSelect>>\fR
+This is sent to a listbox when the set of selected item(s) in the
+listbox is updated.
+.TP
+\fB<<MenuSelect>>\fR
+This is sent to a menu when the currently selected item in the menu
+changes. It is intended for use with context-sensitive help systems.
+.TP
+\fB<<Modified>>\fR
+This is sent to a text widget when the contents of the widget are
+changed.
+.TP
+\fB<<Selection>>\fR
+This is sent to a text widget when the selection in the widget is
+changed.
+.TP
+\fB<<TraverseIn>>\fR
+This is sent to a widget when the focus enters the widget because of a
+user-driven
+.QW "tab to widget"
+action.
+.TP
+\fB<<TraverseOut>>\fR
+This is sent to a widget when the focus leaves the widget because of a
+user-driven
+.QW "tab to widget"
+action.
+.PP
+Tk defines the following virtual events for the purposes of unifying
+bindings across multiple platforms. Users expect them to behave in the
+following way:
+.TP
+\fB<<Clear>>\fR
+Delete the currently selected widget contents.
+.TP
+\fB<<Copy>>\fR
+Copy the currently selected widget contents to the clipboard.
+.TP
+\fB<<Cut>>\fR
+Move the currently selected widget contents to the clipboard.
+.TP
+\fB<<Paste>>\fR
+Replace the currently selected widget contents with the contents of
+the clipboard.
+.TP
+\fB<<PasteSelection>>\fR
+Insert the contents of the selection at the mouse location. (This
+event has meaningful \fB%x\fR and \fB%y\fR substitutions).
+.TP
+\fB<<PrevWindow>>\fR
+Traverse to the previous window.
+.TP
+\fB<<Redo>>\fR
+Redo one undone action.
+.TP
+\fB<<Undo>>\fR
+Undo the last action.
.SH "VIRTUAL EVENT EXAMPLES"
.PP
In order for a virtual event binding to trigger, two things must
diff --git a/doc/focus.n b/doc/focus.n
index d37697a..f37e1cd 100644
--- a/doc/focus.n
+++ b/doc/focus.n
@@ -67,7 +67,7 @@ displays.
If the application currently has the input focus on \fIwindow\fR's
display, this command resets the input focus for \fIwindow\fR's display
to \fIwindow\fR and returns an empty string.
-If the application doesn't currently have the input focus on
+If the application does not currently have the input focus on
\fIwindow\fR's display, \fIwindow\fR will be remembered as the focus
for its top-level; the next time the focus arrives at the top-level,
Tk will redirect it to \fIwindow\fR.
@@ -75,12 +75,12 @@ If \fIwindow\fR is an empty string then the command does nothing.
.TP
\fBfocus \-displayof\fR \fIwindow\fR
Returns the name of the focus window on the display containing \fIwindow\fR.
-If the focus window for \fIwindow\fR's display isn't in this
+If the focus window for \fIwindow\fR's display is not in this
application, the return value is an empty string.
.TP
\fBfocus \-force \fIwindow\fR
Sets the focus of \fIwindow\fR's display to \fIwindow\fR, even if
-the application doesn't currently have the input focus for the display.
+the application does not currently have the input focus for the display.
This command should be used sparingly, if at all.
In normal usage, an application should not claim the focus for
itself; instead, it should wait for the window manager to give it
@@ -97,7 +97,7 @@ will receive the input focus the next time the window manager gives
the focus to the top-level.
.SH "QUIRKS"
.PP
-When an internal window receives the input focus, Tk doesn't actually
+When an internal window receives the input focus, Tk does not actually
set the X focus to that window; as far as X is concerned, the focus
will stay on the top-level window containing the window with the focus.
However, Tk generates FocusIn and FocusOut events just as if the X
@@ -110,11 +110,11 @@ To make a window that only participates in the focus traversal ring
when a variable is set, add the following bindings to the widgets
\fIbefore\fR and \fIafter\fR it in that focus ring:
.CS
-button .before -text "Before"
-button .middle -text "Middle"
-button .after -text "After"
-checkbutton .flag -variable traverseToMiddle -takefocus 0
-pack .flag -side left
+button .before \-text "Before"
+button .middle \-text "Middle"
+button .after \-text "After"
+checkbutton .flag \-variable traverseToMiddle \-takefocus 0
+pack .flag \-side left
pack .before .middle .after
bind .before <Tab> {
if {!$traverseToMiddle} {
@@ -122,7 +122,7 @@ bind .before <Tab> {
break
}
}
-bind .after <Shift-Tab> {
+bind .after <Shift\-Tab> {
if {!$traverseToMiddle} {
\fBfocus\fR .before
break
diff --git a/doc/focusNext.n b/doc/focusNext.n
index 1279f20..ede496f 100644
--- a/doc/focusNext.n
+++ b/doc/focusNext.n
@@ -22,8 +22,9 @@ tk_focusNext, tk_focusPrev, tk_focusFollowsMouse \- Utility procedures for manag
.SH DESCRIPTION
.PP
\fBtk_focusNext\fR is a utility procedure used for keyboard traversal.
-It returns the ``next'' window after \fIwindow\fR in focus order.
-The focus order is determined by
+It returns the
+.QW next
+window after \fIwindow\fR in focus order. The focus order is determined by
the stacking order of windows and the structure of the window hierarchy.
Among siblings, the focus order is the same as the stacking order, with the
lowest window being first.
@@ -50,7 +51,7 @@ The \fBfocus\fR command may be used to move the focus to a window
other than the one under the mouse, but as soon as the mouse moves
into a new window the focus will jump to that window.
Note: at present there is no built-in support for returning the
-application to an explicit focus model; to do this you'll have
+application to an explicit focus model; to do this you will have
to write a script that deletes the bindings created by
\fBtk_focusFollowsMouse\fR.
diff --git a/doc/font.n b/doc/font.n
index 07b7164..124fc43 100644
--- a/doc/font.n
+++ b/doc/font.n
@@ -21,28 +21,34 @@ fonts, such as defining named fonts and inspecting the actual attributes of
a font. The command has several different forms, determined by the
first argument. The following forms are currently supported:
.TP
-\fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR?
+\fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR? ?\fB\-\|\-\fR? ?\fIchar\fR?
.
Returns information about the actual attributes that are obtained when
\fIfont\fR is used on \fIwindow\fR's display; the actual attributes obtained
may differ from the attributes requested due to platform-dependent
limitations, such as the availability of font families and pointsizes.
-\fIfont\fR is a font description; see FONT DESCRIPTIONS below. If the
+\fIfont\fR is a font description; see \fBFONT DESCRIPTIONS\fR below. If the
\fIwindow\fR argument is omitted, it defaults to the main window. If
\fIoption\fR is specified, returns the value of that attribute; if it is
omitted, the return value is a list of all the attributes and their values.
-See FONT OPTIONS below for a list of the possible attributes.
+See \fBFONT OPTIONS\fR below for a list of the possible attributes. If the
+\fIchar\fR argument is supplied, it must be a single character. The font
+attributes returned will be those of the specific font used to render
+that character, which will be different from the base font if the base
+font does not contain the given character. If \fIchar\fR may be a hyphen, it
+should be preceded by \fB\-\|\-\fR to distinguish it from a misspelled
+\fIoption\fR.
.TP
-\fBfont configure \fIfontname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+\fBfont configure \fIfontname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
.
Query or modify the desired attributes for the named font called
\fIfontname\fR. If no \fIoption\fR is specified, returns a list describing
-all the options and their values for \fIfontname\fR. If a single \fIoption\fR
+all the options and their values for \fIfontname\fR. If a single \fIoption\fR
is specified with no \fIvalue\fR, then returns the current value of that
attribute. If one or more \fIoption\fR\-\fIvalue\fR pairs are specified,
then the command modifies the given named font to have the given values; in
this case, all widgets using that font will redisplay themselves using the
-new attributes for the font. See FONT OPTIONS below for a list of the
+new attributes for the font. See \fBFONT OPTIONS\fR below for a list of the
possible attributes.
.TP
\fBfont create\fR ?\fIfontname\fR? ?\fIoption value ...\fR?
@@ -51,13 +57,13 @@ Creates a new named font and returns its name. \fIfontname\fR specifies the
name for the font; if it is omitted, then Tk generates a new name of the
form \fBfont\fIx\fR, where \fIx\fR is an integer. There may be any number
of \fIoption\fR\-\fIvalue\fR pairs, which provide the desired attributes for
-the new named font. See FONT OPTIONS below for a list of the possible
+the new named font. See \fBFONT OPTIONS\fR below for a list of the possible
attributes.
.TP
\fBfont delete\fR \fIfontname\fR ?\fIfontname ...\fR?
.
Delete the specified named fonts. If there are widgets using the named font,
-the named font won't actually be deleted until all the instances are
+the named font will not actually be deleted until all the instances are
released. Those widgets will continue to display using the last known values
for the named font. If a deleted named font is subsequently recreated with
another call to \fBfont create\fR, the widgets will use the new named font
@@ -65,18 +71,21 @@ and redisplay themselves using the new attributes of that font.
.TP
\fBfont families\fR ?\fB\-displayof \fIwindow\fR?
.
-The return value is a list of the case-insensitive names of all font families
+The return value is a list of the case-insensitive names of all font families
that exist on \fIwindow\fR's display. If the \fIwindow\fR argument is
omitted, it defaults to the main window.
.TP
-\fBfont measure \fIfont\fR ?\fB\-displayof \fIwindow\fR? \fItext\fR
+\fBfont measure \fIfont\fR ?\fB\-displayof \fIwindow\fR? \fItext\fR
.
Measures the amount of space the string \fItext\fR would use in the given
\fIfont\fR when displayed in \fIwindow\fR. \fIfont\fR is a font description;
-see FONT DESCRIPTIONS below. If the \fIwindow\fR argument is omitted, it
+see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR argument is
+omitted, it
defaults to the main window. The return value is the total width in pixels
of \fItext\fR, not including the extra pixels used by highly exaggerated
-characters such as cursive ``f''. If the string contains newlines or tabs,
+characters such as cursive
+.QW f .
+If the string contains newlines or tabs,
those characters are not expanded or treated specially when measuring the
string.
.TP
@@ -84,11 +93,12 @@ string.
.
Returns information about the metrics (the font-specific data), for
\fIfont\fR when it is used on \fIwindow\fR's display. \fIfont\fR is a font
-description; see FONT DESCRIPTIONS below. If the \fIwindow\fR argument is
+description; see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR
+argument is
omitted, it defaults to the main window. If \fIoption\fR is specified,
-returns the value of that metric; if it is omitted, the return value is a
-list of all the metrics and their values. See FONT METRICS below for a list
-of the possible metrics.
+returns the value of that metric; if it is omitted, the return value is a
+list of all the metrics and their values. See \fBFONT METRICS\fR
+below for a list of the possible metrics.
.TP
\fBfont names\fR
The return value is a list of all the named fonts that are currently defined.
@@ -98,7 +108,7 @@ The following formats are accepted as a font description anywhere
\fIfont\fR is specified as an argument above; these same forms are also
permitted when specifying the \fB\-font\fR option for widgets.
.TP
-[1] \fIfontname\fR
+[1] \fIfontname\fR
.
The name of a named font, created using the \fBfont create\fR command. When
a widget uses a named font, it is guaranteed that this will never cause an
@@ -110,48 +120,56 @@ font will be substituted automatically.
[2] \fIsystemfont\fR
.
The platform-specific name of a font, interpreted by the graphics server.
-This also includes, under X, an XLFD (see [4]) for which a single ``\fB*\fR''
+This also includes, under X, an XLFD (see [4]) for which a single
+.QW \fB*\fR
character was used to elide more than one field in the middle of the
-name. See PLATFORM-SPECIFIC issues for a list of the system fonts.
-.VS 8.0 br
+name. See \fBPLATFORM-SPECIFIC\fR issues for a list of the system fonts.
.TP
[3] \fIfamily \fR?\fIsize\fR? ?\fIstyle\fR? ?\fIstyle ...\fR?
.
A properly formed list whose first element is the desired font
\fIfamily\fR and whose optional second element is the desired \fIsize\fR.
The interpretation of the \fIsize\fR attribute follows the same rules
-described for \fB\-size\fR in FONT OPTIONS below. Any additional optional
+described for \fB\-size\fR in \fBFONT OPTIONS\fR below. Any
+additional optional
arguments following the \fIsize\fR are font \fIstyle\fRs. Possible values
for the \fIstyle\fR arguments are as follows:
.RS
.DS
.ta 3c 6c 9c
-\fBnormal bold roman italic
-underline overstrike\fR
+\fBnormal\fR \fBbold\fR \fBroman\fR \fBitalic\fR
+\fBunderline\fR \fBoverstrike\fR
.DE
.RE
-.TP
+.TP
[4] X-font names (XLFD)
.
A Unix-centric font name of the form
-\fI-foundry-family-weight-slant-setwidth-addstyle-pixel-point-resx-resy-spacing-width-charset-encoding\fR.
-The ``\fB*\fR'' character may be used to skip individual fields that the
-user does not care about. There must be exactly one ``\fB*\fR'' for each
-field skipped, except that a ``\fB*\fR'' at the end of the XLFD skips any
-remaining fields; the shortest valid XLFD is simply ``\fB*\fR'', signifying
-all fields as defaults. Any fields that were skipped are given default
+\fI\-foundry\-family\-weight\-slant\-setwidth\-addstyle\-pixel\-point\-resx\-resy\-spacing\-width\-charset\-encoding\fR.
+The
+.QW \fB*\fR
+character may be used to skip individual fields that the
+user does not care about. There must be exactly one
+.QW \fB*\fR
+for each field skipped, except that a
+.QW \fB*\fR
+at the end of the XLFD skips any
+remaining fields; the shortest valid XLFD is simply
+.QW \fB*\fR ,
+signifying all fields as defaults. Any fields that were skipped are
+given default
values. For compatibility, an XLFD always chooses a font of the specified
pixel size (not point size); although this interpretation is not strictly
-correct, all existing applications using XLFDs assumed that one ``point''
+correct, all existing applications using XLFDs assumed that one
+.QW point
was in fact one pixel and would display incorrectly (generally larger) if
the correct size font were actually used.
-.VE
.TP
[5] \fIoption value \fR?\fIoption value ...\fR?
.
A properly formed list of \fIoption\fR\-\fIvalue\fR pairs that specify
the desired attributes of the font, in the same format used when defining
-a named font; see FONT OPTIONS below.
+a named font; see \fBFONT OPTIONS\fR below.
.LP
When font description \fIfont\fR is used, the system attempts to parse the
description according to each of the above five rules, in the order specified.
@@ -161,22 +179,26 @@ platforms and the closest available font will be used. In some situations
it may not be possible to find any close font (e.g., the font family was
a garbage value); in that case, some system-dependent default font is
chosen. If the font description does not match any of the above patterns,
-an error is generated.
+an error is generated.
.SH "FONT METRICS"
.
The following options are used by the \fBfont metrics\fR command to query
font-specific data determined when the font was created. These properties are
for the whole font itself and not for individual characters drawn in that
-font. In the following definitions, the ``baseline'' of a font is the
-horizontal line where the bottom of most letters line up; certain letters,
-such as lower-case ``g'' stick below the baseline.
+font. In the following definitions, the
+.QW baseline
+of a font is the
+horizontal line where the bottom of most letters line up; certain letters,
+such as lower-case
+.QW g
+stick below the baseline.
.TP
\fB\-ascent \0\fR
.
The amount in pixels that the tallest letter sticks up above the baseline of
the font, plus any extra blank space added by the designer of the font.
.TP
-\fB\-descent \0\fR
+\fB\-descent \0\fR
.
The largest amount in pixels that any letter sticks down below the baseline
of the font, plus any extra blank space added by the designer of the font.
@@ -190,29 +212,36 @@ above the baseline line plus the descent below the baseline.
.TP
\fB\-fixed \0\fR
.
-Returns a boolean flag that is ``\fB1\fR'' if this is a fixed-width font,
+Returns a boolean flag that is
+.QW \fB1\fR
+if this is a fixed-width font,
where each normal character is the same width as all the other
-characters, or is ``\fB0\fR'' if this is a proportionally-spaced font, where
-individual characters have different widths. The widths of control
-characters, tab characters, and other non-printing characters are not
+characters, or is
+.QW \fB0\fR
+if this is a proportionally-spaced font, where
+individual characters have different widths. The widths of control
+characters, tab characters, and other non-printing characters are not
included when calculating this value.
.SH "FONT OPTIONS"
The following options are supported on all platforms, and are used when
constructing a named font or when specifying a font using style [5] as
above:
.TP
-\fB\-family \fIname\fR
+\fB\-family \fIname\fR
.
The case-insensitive font family name. Tk guarantees to support the font
-families named \fBCourier\fR (a monospaced ``typewriter'' font), \fBTimes\fR
-(a serifed ``newspaper'' font), and \fBHelvetica\fR (a sans-serif
-``European'' font). The most closely matching native font family will
+families named \fBCourier\fR (a monospaced
+.QW typewriter
+font), \fBTimes\fR (a serifed
+.QW newspaper
+font), and \fBHelvetica\fR (a sans-serif
+.QW European
+font). The most closely matching native font family will
automatically be substituted when one of the above font families is used.
The \fIname\fR may also be the name of a native, platform-specific font
family; in that case it will work as desired on one platform but may not
-display correctly on other platforms. If the family is unspecified or
+display correctly on other platforms. If the family is unspecified or
unrecognized, a platform-specific default font will be chosen.
-.VS
.TP
\fB\-size \fIsize\fR
.
@@ -221,7 +250,7 @@ number, it is interpreted as a size in points. If \fIsize\fR is a negative
number, its absolute value is interpreted as a size in pixels. If a
font cannot be displayed at the specified size, a nearby size will be
chosen. If \fIsize\fR is unspecified or zero, a platform-dependent default
-size will be chosen.
+size will be chosen.
.RS
.PP
Sizes should normally be specified in points so the application will remain
@@ -232,9 +261,8 @@ to a fixed-size bitmap. The mapping between points and pixels is set when
the application starts, based on properties of the installed monitor, but it
can be overridden by calling the \fBtk scaling\fR command.
.RE
-.VE
.TP
-\fB\-weight \fIweight\fR
+\fB\-weight \fIweight\fR
.
The nominal thickness of the characters in the font. The value
\fBnormal\fR specifies a normal weight font, while \fBbold\fR specifies a
@@ -244,7 +272,7 @@ be chosen. The default weight is \fBnormal\fR.
\fB\-slant \fIslant\fR
The amount the characters in the font are slanted away from the
vertical. Valid values for slant are \fBroman\fR and \fBitalic\fR.
-A roman font is the normal, upright appearance of a font, while
+A roman font is the normal, upright appearance of a font, while
an italic font is one that is tilted some number of degrees from upright.
The closest available slant to the one specified will be chosen.
The default slant is \fBroman\fR.
@@ -253,46 +281,112 @@ The default slant is \fBroman\fR.
The value is a boolean flag that specifies whether characters in this
font should be underlined. The default value for underline is \fBfalse\fR.
.TP
-\fB\-overstrike \fIboolean\fR
+\fB\-overstrike \fIboolean\fR
The value is a boolean flag that specifies whether a horizontal line should
be drawn through the middle of characters in this font. The default value
for overstrike is \fBfalse\fR.
-.SH "PLATFORM-SPECIFIC ISSUES"
+.SH "STANDARD FONTS"
.LP
-The following named system fonts are supported:
-.RS
-.TP
-X Windows:
+The following named fonts are supported on all systems, and default to values
+that match appropriate system defaults.
+.TP
+\fBTkDefaultFont\fR
+.
+This font is the default for all GUI items not otherwise specified.
+.TP
+\fBTkTextFont\fR
+.
+This font should be used for user text in entry widgets, listboxes etc.
+.TP
+\fBTkFixedFont\fR
+.
+This font is the standard fixed-width font.
+.TP
+\fBTkMenuFont\fR
+.
+This font is used for menu items.
+.TP
+\fBTkHeadingFont\fR
+.
+This font should be used for column headings in lists and tables.
+.TP
+\fBTkCaptionFont\fR
+.
+This font should be used for window and dialog caption bars.
+.TP
+\fBTkSmallCaptionFont\fR
+.
+This font should be used for captions on contained windows or tool dialogs.
+.TP
+\fBTkIconFont\fR
+.
+This font should be used for icon captions.
+.TP
+\fBTkTooltipFont\fR
+.
+This font should be used for tooltip windows (transient information windows).
+.LP
+It is \fInot\fR advised to change these fonts, as they may be modified by Tk
+itself in response to system changes. Instead, make a copy of the font and
+modify that.
+.SH "PLATFORM-SPECIFIC FONTS"
+.PP
+The following system fonts are supported:
+.TP
+\fBX Windows\fR
All valid X font names, including those listed by xlsfonts(1), are available.
.TP
-MS Windows:
+\fBMS Windows\fR
+The following fonts are supported, and are mapped to the user's
+style defaults.
+.RS
.DS
.ta 3c 6c
-\fBsystem ansi device
-systemfixed ansifixed oemfixed\fR
+\fBsystem\fR \fBansi\fR \fBdevice\fR
+\fBsystemfixed\fR \fBansifixed\fR \fBoemfixed\fR
.DE
+.RE
.TP
-Mac OS X:
+\fBMac OS X\fR
+The following fonts are supported, and are mapped to the user's
+style defaults.
+.RS
.DS
.ta 3c 6c
-\fBsystem application menu\fR
+\fBsystem\fR \fBapplication\fR \fBmenu\fR
+.DE
+.PP
+Additionally, the following named fonts provide access to the Aqua
+theme fonts:
+.DS
+.ta 5c
+\fBsystemSystemFont\fR \fBsystemEmphasizedSystemFont\fR
+\fBsystemSmallSystemFont\fR \fBsystemSmallEmphasizedSystemFont\fR
+\fBsystemApplicationFont\fR \fBsystemLabelFont\fR
+\fBsystemViewsFont\fR \fBsystemMenuTitleFont\fR
+\fBsystemMenuItemFont\fR \fBsystemMenuItemMarkFont\fR
+\fBsystemMenuItemCmdKeyFont\fR \fBsystemWindowTitleFont\fR
+\fBsystemPushButtonFont\fR \fBsystemUtilityWindowTitleFont\fR
+\fBsystemAlertHeaderFont\fR \fBsystemToolbarFont\fR
+\fBsystemMiniSystemFont\fR \fBsystemDetailSystemFont\fR
+\fBsystemDetailEmphasizedSystemFont\fR
.DE
.RE
.SH EXAMPLE
Fill a text widget with lots of font demonstrators, one for every font
family installed on your system:
.CS
-pack [text .t -wrap none] -fill both -expand 1
+pack [text .t \-wrap none] \-fill both \-expand 1
set count 0
set tabwidth 0
-foreach family [lsort -dictionary [\fBfont families\fR]] {
- .t tag configure f[incr count] -font [list $family 10]
- .t insert end ${family}:\\t {} \\
- "This is a simple sampler\\n" f$count
- set w [\fBfont measure\fR [.t cget -font] ${family}:]
+foreach family [lsort \-dictionary [\fBfont families\fR]] {
+ .t tag configure f[incr count] \-font [list $family 10]
+ .t insert end ${family}:\\t {} \e
+ "This is a simple sampler\en" f$count
+ set w [\fBfont measure\fR [.t cget \-font] ${family}:]
if {$w+5 > $tabwidth} {
set tabwidth [expr {$w+5}]
- .t configure -tabs $tabwidth
+ .t configure \-tabs $tabwidth
}
}
.CE
diff --git a/doc/frame.n b/doc/frame.n
index ac03de9..208e414 100644
--- a/doc/frame.n
+++ b/doc/frame.n
@@ -52,11 +52,16 @@ things like geometry requests. The window should not have any
children of its own in this application.
This option may not be changed with the \fBconfigure\fR
widget command.
+Note that \fB-borderwidth\fR, \fB-padx\fR and \fB-pady\fR are ignored when
+configured as a container since a container has no border.
.OP \-height height Height
Specifies the desired height for the window in any of the forms
-acceptable to \fBTk_GetPixels\fR.
-If this option is less than or equal to zero then the window will
-not request any size at all.
+acceptable to \fBTk_GetPixels\fR. If this option is less than or equal
+to zero then the window will not request any size at all. Note that this
+sets the total height of the frame, any \fB\-borderwidth\fR or similar is
+not added. Normally \fB\-height\fR should not be used if a propagating
+geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the
+frame since the geometry manager will override the height of the frame.
.OP \-visual visual Visual
Specifies visual information for the new window in any of the
forms accepted by \fBTk_GetVisual\fR.
@@ -66,11 +71,13 @@ The \fBvisual\fR option may not be modified with the \fBconfigure\fR
widget command.
.OP \-width width Width
Specifies the desired width for the window in any of the forms
-acceptable to \fBTk_GetPixels\fR.
-If this option is less than or equal to zero then the window will
-not request any size at all.
+acceptable to \fBTk_GetPixels\fR. If this option is less than or equal
+to zero then the window will not request any size at all. Note that this
+sets the total width of the frame, any \fB\-borderwidth\fR or similar is
+not added. Normally \fB\-width\fR should not be used if a propagating
+geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the
+frame since the geometry manager will override the width of the frame.
.BE
-
.SH DESCRIPTION
.PP
The \fBframe\fR command creates a new window (given by the
@@ -86,7 +93,6 @@ A frame is a simple widget. Its primary purpose is to act as a
spacer or container for complex window layouts. The only features
of a frame are its background color and an optional 3-D border to make the
frame appear raised or sunken.
-
.SH "WIDGET COMMAND"
.PP
The \fBframe\fR command creates a new Tcl command whose
@@ -120,14 +126,11 @@ modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBframe\fR
command.
-
.SH BINDINGS
.PP
When a new frame is created, it has no default event bindings:
frames are not intended to be interactive.
-
.SH "SEE ALSO"
-labelframe(n), toplevel(n)
-
+labelframe(n), toplevel(n), ttk::frame(n)
.SH KEYWORDS
frame, widget
diff --git a/doc/getOpenFile.n b/doc/getOpenFile.n
index b13194b..8162078 100644
--- a/doc/getOpenFile.n
+++ b/doc/getOpenFile.n
@@ -11,11 +11,11 @@
.SH NAME
tk_getOpenFile, tk_getSaveFile \- pop up a dialog box for the user to select a file to open or save.
.SH SYNOPSIS
+.nf
\fBtk_getOpenFile \fR?\fIoption value ...\fR?
-.br
\fBtk_getSaveFile \fR?\fIoption value ...\fR?
+.fi
.BE
-
.SH DESCRIPTION
.PP
The procedures \fBtk_getOpenFile\fR and \fBtk_getSaveFile\fR pop up a
@@ -35,16 +35,20 @@ whether the existing file should be overwritten or not.
The following \fIoption\-value\fR pairs are possible as command line
arguments to these two commands:
.TP
+\fB\-confirmoverwrite\fR \fIboolean\fR
+Configures how the Save dialog reacts when the selected file already
+exists, and saving would overwrite it. A true value requests a
+confirmation dialog be presented to the user. A false value requests
+that the overwrite take place without confirmation. Default value is true.
+.TP
\fB\-defaultextension\fR \fIextension\fR
Specifies a string that will be appended to the filename if the user
enters a filename without an extension. The default value is the empty
string, which means no extension will be appended to the filename in
-any case. This option is ignored on the Macintosh platform, which
+any case. This option is ignored on Mac OS X, which
does not require extensions to filenames,
-.VS 8.4
and the UNIX implementation guesses reasonable values for this from
the \fB\-filetypes\fR option when this is not supplied.
-.VE 8.4
.TP
\fB\-filetypes\fR \fIfilePatternList\fR
If a \fBFile types\fR listbox exists in the file dialog on the particular
@@ -61,38 +65,42 @@ Specifies that the files in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified, then
the files in the current working directory are displayed. If the
parameter specifies a relative path, the return value will convert the
-relative path to an absolute path. This option may not always work on
-the Macintosh. This is not a bug. Rather, the \fIGeneral Controls\fR
-control panel on the Mac allows the end user to override the
-application default directory.
+relative path to an absolute path.
.TP
\fB\-initialfile\fR \fIfilename\fR
-Specifies a filename to be displayed in the dialog when it pops up. This
-option is ignored on the Macintosh platform.
-.TP
-\fB\-multiple\fR \fIboolean\fR
-Allows the user to choose multiple files from the Open dialog.
-On the Macintosh, this is only available when Navigation Services are
-installed.
+Specifies a filename to be displayed in the dialog when it pops up.
.TP
\fB\-message\fR \fIstring\fR
Specifies a message to include in the client area of the dialog.
-This is only available on the Macintosh, and only when Navigation
-Services are installed.
+This is only available on Mac OS X.
+.TP
+\fB\-multiple\fR \fIboolean\fR
+Allows the user to choose multiple files from the Open dialog.
.TP
\fB\-parent\fR \fIwindow\fR
Makes \fIwindow\fR the logical parent of the file dialog. The file
-dialog is displayed on top of its parent window.
+dialog is displayed on top of its parent window. On Mac OS X, this
+turns the file dialog into a sheet attached to the parent window.
.TP
\fB\-title\fR \fItitleString\fR
Specifies a string to display as the title of the dialog box. If this
option is not specified, then a default title is displayed.
+.TP
+\fB\-typevariable\fR \fIvariableName\fR
+The global variable \fIvariableName\fR is used to preselect which filter is
+used from \fIfilterList\fR when the dialog box is opened and is
+updated when the dialog box is closed, to the last selected
+filter. The variable is read once at the beginning to select the
+appropriate filter. If the variable does not exist, or its value does
+not match any filter typename, or is empty (\fB{}\fR), the dialog box
+will revert to the default behavior of selecting the first filter in
+the list. If the dialog is canceled, the variable is not modified.
.PP
If the user selects a file, both \fBtk_getOpenFile\fR and
\fBtk_getSaveFile\fR return the full pathname of this file. If the
user cancels the operation, both commands return the empty string.
.SH "SPECIFYING FILE PATTERNS"
-
+.PP
The \fIfilePatternList\fR value given by the \fB\-filetypes\fR option
is a list of file patterns. Each file pattern is a list of the
form
@@ -111,8 +119,8 @@ they refer to the same file type and share the same entry in the
listbox. When the user selects an entry in the listbox, all the files
that match at least one of the file patterns corresponding
to that entry are listed. Usually, each file pattern corresponds to a
-distinct type of file. The use of more than one file patterns for one
-type of file is necessary on the Macintosh platform only.
+distinct type of file. The use of more than one file pattern for one
+type of file is only necessary on the Macintosh platform.
.PP
On the Macintosh platform, a file matches a file pattern if its
name matches at least one of the \fIextension\fR(s) AND it
@@ -122,7 +130,7 @@ sample code matches with files that have a \fB\.c\fR extension AND
belong to the \fImacType\fR \fBTEXT\fR. To use the OR rule instead,
you can use two file patterns, one with the \fIextensions\fR only and
the other with the \fImacType\fR only. The \fBGIF Files\fR file type
-in the sample code matches files that EITHER have a \fB\.gif\fR
+in the sample code matches files that \fIeither\fR have a \fB\.gif\fR
extension OR belong to the \fImacType\fR \fBGIFF\fR.
.PP
On the Unix and Windows platforms, a file matches a file pattern
@@ -131,20 +139,29 @@ the file pattern. The \fImacType\fRs are ignored.
.SH "SPECIFYING EXTENSIONS"
.PP
On the Unix and Macintosh platforms, extensions are matched using
-glob-style pattern matching. On the Windows platforms, extensions are
+glob-style pattern matching. On the Windows platform, extensions are
matched by the underlying operating system. The types of possible
-extensions are: (1) the special extension * matches any
-file; (2) the special extension "" matches any files that
-do not have an extension (i.e., the filename contains no full stop
-character); (3) any character string that does not contain any wild
-card characters (* and ?).
+extensions are:
+.IP (1)
+the special extension
+.QW *
+matches any file;
+.IP (2)
+the special extension
+.MT
+matches any files that do not have an extension (i.e., the filename
+contains no full stop character);
+.IP (3)
+any character string that does not contain any wild card characters (*
+and ?).
.PP
Due to the different pattern matching rules on the various platforms,
to ensure portability, wild card characters are not allowed in the
-extensions, except as in the special extension *. Extensions
-without a full stop character (e.g. ~) are allowed but may not
-work on all platforms.
-
+extensions, except as in the special extension
+.QW * .
+Extensions without a full stop character (e.g.
+.QW ~ )
+are allowed but may not work on all platforms.
.SH EXAMPLE
.CS
set types {
@@ -155,15 +172,13 @@ set types {
{{GIF Files} {} GIFF}
{{All Files} * }
}
-set filename [tk_getOpenFile -filetypes $types]
+set filename [tk_getOpenFile \-filetypes $types]
if {$filename != ""} {
# Open the file ...
}
.CE
-
.SH "SEE ALSO"
tk_chooseDirectory
-
.SH KEYWORDS
file selection dialog
diff --git a/doc/grab.n b/doc/grab.n
index c954fab..2f7e2f1 100644
--- a/doc/grab.n
+++ b/doc/grab.n
@@ -30,8 +30,9 @@ and all events will be reported in the normal fashion.
When the pointer is outside \fIwindow\fR's tree, button presses and
releases and
mouse motion events are reported to \fIwindow\fR, and window entry
-and window exit events are ignored.
-The grab subtree ``owns'' the pointer:
+and window exit events are ignored. The grab subtree
+.QW owns
+the pointer:
windows outside the grab subtree will be visible on the screen
but they will be insensitive until the grab is released.
The tree of windows underneath the grab window can include top-level
@@ -109,7 +110,7 @@ events and not providing any mechanism for releasing the grab). Take
.PP
It took an incredibly complex and gross implementation to produce
the simple grab effect described above.
-Given the current implementation, it isn't safe for applications
+Given the current implementation, it is not safe for applications
to use the Xlib grab facilities at all except through the Tk grab
procedures.
If applications try to manipulate X's grab mechanisms directly,
@@ -118,7 +119,7 @@ things will probably break.
If a single process is managing several different Tk applications,
only one of those applications can have a local grab for a given
display at any given time. If the applications are in different
-processes, this restriction doesn't exist.
+processes, this restriction does not exist.
.SH EXAMPLE
Set a grab so that only one button may be clicked out of a group. The
other buttons are unresponsive to the mouse until the middle button is
diff --git a/doc/grid.n b/doc/grid.n
index fa22eeb..5c1c3ba 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -5,7 +5,7 @@
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.so man.macros
-.TH grid n 8.4 Tk "Tk Built-In Commands"
+.TH grid n 8.5 Tk "Tk Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
@@ -13,7 +13,6 @@ grid \- Geometry manager that arranges widgets in a grid
.SH SYNOPSIS
\fBgrid \fIoption arg \fR?\fIarg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The \fBgrid\fR command is used to communicate with the grid
@@ -25,9 +24,16 @@ on the \fIoption\fR argument:
\fBgrid \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
If the first argument to \fBgrid\fR is suitable as the first slave
argument to \fBgrid configure\fR, either a window name (any value
-starting with \fB.\fP) or one of the characters \fBx\fP or \fB^\fP
+starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR
(see the \fBRELATIVE PLACEMENT\fR section below), then the command is
processed in the same way as \fBgrid configure\fR.
+.VS 8.5
+.TP
+\fBgrid anchor \fImaster\fR ?\fIanchor\fR?
+The anchor value controls how to place the grid within the master
+when no row/column has any weight. See \fBTHE GRID ALGORITHM\fR below
+for further details. The default \fIanchor\fR is \fInw\fR.
+.VE 8.5
.TP
\fBgrid bbox \fImaster\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR?
With no arguments,
@@ -35,71 +41,77 @@ the bounding box (in pixels) of the grid is returned.
The return value consists of 4 integers. The first two are the pixel
offset from the master window (x then y) of the top-left corner of the
grid, and the second two integers are the width and height of the grid,
-also in pixels. If a single \fIcolumn\fP and \fIrow\fP is specified on
+also in pixels. If a single \fIcolumn\fR and \fIrow\fR is specified on
the command line, then the bounding box for that cell is returned, where the
-top left cell is numbered from zero. If both \fIcolumn\fP and \fIrow\fP
+top left cell is numbered from zero. If both \fIcolumn\fR and \fIrow\fR
arguments are specified, then the bounding box spanning the rows and columns
indicated is returned.
.TP
\fBgrid columnconfigure \fImaster index \fR?\fI\-option value...\fR?
-Query or set the column properties of the \fIindex\fP column of the
-geometry master, \fImaster\fP.
-.VS 8.4
-The valid options are \fB\-minsize\fP, \fB\-weight\fP, \fB\-uniform\fP
-and \fB-pad\fP.
-.VE 8.4
-If one or more options are provided, then \fIindex\fP may be given as
+Query or set the column properties of the \fIindex\fR column of the
+geometry master, \fImaster\fR.
+The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR
+and \fB\-pad\fR.
+If one or more options are provided, then \fIindex\fR may be given as
a list of column indices to which the configuration options will operate on.
-The \fB\-minsize\fP option sets the minimum size, in screen units,
+.VS 8.5
+Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR
+the options apply to all columns currently occupied be slave windows. For
+a window name, that window must be a slave of this master and the options
+apply to all columns currently occupied be the slave.
+.VE 8.5
+The \fB\-minsize\fR option sets the minimum size, in screen units,
that will be permitted for this column.
-The \fB\-weight\fP option (an integer value)
+The \fB\-weight\fR option (an integer value)
sets the relative weight for apportioning
any extra spaces among
columns.
A weight of zero (0) indicates the column will not deviate from its requested
size. A column whose weight is two will grow at twice the rate as a column
of weight one when extra space is allocated to the layout.
-.VS 8.4
-The \fB-uniform\fP option, when a non-empty value is supplied, places
-the column in a \fIuniform group\fP with other columns that have the
-same value for \fB-uniform\fP. The space for columns belonging to a
+The \fB\-uniform\fR option, when a non-empty value is supplied, places
+the column in a \fIuniform group\fR with other columns that have the
+same value for \fB\-uniform\fR. The space for columns belonging to a
uniform group is allocated so that their sizes are always in strict
-proportion to their \fB-weight\fP values. See
+proportion to their \fB\-weight\fR values. See
\fBTHE GRID ALGORITHM\fR below for further details.
-.VE 8.4
-The \fB-pad\fP option specifies the number of screen units that will be
+The \fB\-pad\fR option specifies the number of screen units that will be
added to the largest window contained completely in that column when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
If only the master window and index is specified, all the current settings
-are returned in a list of "-option value" pairs.
+are returned in a list of
+.QW "\-option value"
+pairs.
.TP
\fBgrid configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
The arguments consist of the names of one or more slave windows
followed by pairs of arguments that specify how
to manage the slaves.
-The characters \fB\-\fP, \fBx\fP and \fB^\fP,
+The characters \fB\-\fR, \fBx\fR and \fB^\fR,
can be specified instead of a window name to alter the default
-location of a \fIslave\fP, as described in the \fBRELATIVE PLACEMENT\fR
+location of a \fIslave\fR, as described in the \fBRELATIVE PLACEMENT\fR
section, below.
The following options are supported:
.RS
.TP
\fB\-column \fIn\fR
-Insert the slave so that it occupies the \fIn\fPth column in the grid.
+Insert the slave so that it occupies the \fIn\fRth column in the grid.
Column numbers start with 0. If this option is not supplied, then the
slave is arranged just to the right of previous slave specified on this
-call to \fIgrid\fP, or column "0" if it is the first slave. For each
-\fBx\fP that immediately precedes the \fIslave\fP, the column position
-is incremented by one. Thus the \fBx\fP represents a blank column
+call to \fBgrid\fR, or column
+.QW 0
+if it is the first slave. For each
+\fBx\fR that immediately precedes the \fIslave\fR, the column position
+is incremented by one. Thus the \fBx\fR represents a blank column
for this row in the grid.
.TP
\fB\-columnspan \fIn\fR
-Insert the slave so that it occupies \fIn\fP columns in the grid.
+Insert the slave so that it occupies \fIn\fR columns in the grid.
The default is one column, unless the window name is followed by a
-\fB\-\fP, in which case the columnspan is incremented once for each immediately
-following \fB\-\fP.
+\fB\-\fR, in which case the columnspan is incremented once for each immediately
+following \fB\-\fR.
.TP
\fB\-in \fIother\fR
Insert the slave(s) in the master
@@ -136,31 +148,34 @@ The \fIamount\fR defaults to 0.
This space is added outside the slave(s) border.
.TP
\fB\-row \fIn\fR
-Insert the slave so that it occupies the \fIn\fPth row in the grid.
+Insert the slave so that it occupies the \fIn\fRth row in the grid.
Row numbers start with 0. If this option is not supplied, then the
slave is arranged on the same row as the previous slave specified on this
-call to \fBgrid\fP, or the first unoccupied row if this is the first slave.
+call to \fBgrid\fR, or the first unoccupied row if this is the first slave.
.TP
\fB\-rowspan \fIn\fR
-Insert the slave so that it occupies \fIn\fP rows in the grid.
-The default is one row. If the next \fBgrid\fP command contains
-\fB^\fP characters instead of \fIslaves\fP that line up with the columns
-of this \fIslave\fP, then the \fBrowspan\fP of this \fIslave\fP is
+Insert the slave so that it occupies \fIn\fR rows in the grid.
+The default is one row. If the next \fBgrid\fR command contains
+\fB^\fR characters instead of \fIslaves\fR that line up with the columns
+of this \fIslave\fR, then the \fBrowspan\fR of this \fIslave\fR is
extended by one.
.TP
\fB\-sticky \fIstyle\fR
If a slave's cell is larger than its requested dimensions, this
option may be used to position (or stretch) the slave within its cell.
\fIStyle\fR is a string that contains zero or more of the characters
-\fBn\fP, \fBs\fP, \fBe\fP or \fBw\fP.
+\fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR.
The string can optionally contains spaces or
commas, but they are ignored. Each letter refers to a side (north, south,
-east, or west) that the slave will "stick" to. If both \fBn\fP and \fBs\fP (or
-\fBe\fP and \fBw\fP) are specified, the slave will be stretched to fill the entire
-height (or width) of its cavity. The \fBsticky\fP option subsumes the
-combination of \fB\-anchor\fP and \fB\-fill\fP that is used by \fBpack\fP.
-The default is \fB{}\fP, which causes the slave to be centered in its cavity,
-at its requested size.
+east, or west) that the slave will
+.QW stick
+to. If both \fBn\fR and \fBs\fR (or \fBe\fR and \fBw\fR) are
+specified, the slave will be stretched to fill the entire
+height (or width) of its cavity. The \fBsticky\fR option subsumes the
+combination of \fB\-anchor\fR and \fB\-fill\fR that is used by \fBpack\fR.
+The default is
+.QW "" ,
+which causes the slave to be centered in its cavity, at its requested size.
.LP
If any of the slaves are already managed by the geometry manager
then any unspecified options for them retain their previous values rather
@@ -179,13 +194,15 @@ default settings are used.
Returns a list whose elements are the current configuration state of
the slave given by \fIslave\fR in the same option-value form that
might be specified to \fBgrid configure\fR.
-The first two elements of the list are ``\fB\-in \fImaster\fR'' where
-\fImaster\fR is the slave's master.
+The first two elements of the list are
+.QW "\fB\-in \fImaster\fR"
+where \fImaster\fR is the slave's master.
.TP
\fBgrid location \fImaster x y\fR
-Given \fIx\fP and \fIy\fP values in screen units relative to the master window,
-the column and row number at that \fIx\fP and \fIy\fP location is returned.
-For locations that are above or to the left of the grid, \fB-1\fP is returned.
+Given \fIx\fR and \fIy\fR values in screen units relative to the master window,
+the column and row number at that \fIx\fR and \fIy\fR location is returned.
+For locations that are above or to the left of the grid, \fB\-1\fR is
+returned.
.TP
\fBgrid propagate \fImaster\fR ?\fIboolean\fR?
If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
@@ -200,38 +217,42 @@ for \fImaster\fR.
Propagation is enabled by default.
.TP
\fBgrid rowconfigure \fImaster index \fR?\fI\-option value...\fR?
-Query or set the row properties of the \fIindex\fP row of the
-geometry master, \fImaster\fP.
-.VS 8.4
-The valid options are \fB\-minsize\fP, \fB\-weight\fP, \fB\-uniform\fP
-and \fB-pad\fP.
-.VE 8.4
-If one or more options are provided, then \fIindex\fP may be given as
+Query or set the row properties of the \fIindex\fR row of the
+geometry master, \fImaster\fR.
+The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR
+and \fB\-pad\fR.
+If one or more options are provided, then \fIindex\fR may be given as
a list of row indices to which the configuration options will operate on.
-The \fB\-minsize\fP option sets the minimum size, in screen units,
+.VS 8.5
+Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR
+the options apply to all rows currently occupied be slave windows. For
+a window name, that window must be a slave of this master and the options
+apply to all rows currently occupied be the slave.
+.VE 8.5
+The \fB\-minsize\fR option sets the minimum size, in screen units,
that will be permitted for this row.
-The \fB\-weight\fP option (an integer value)
+The \fB\-weight\fR option (an integer value)
sets the relative weight for apportioning
any extra spaces among
rows.
A weight of zero (0) indicates the row will not deviate from its requested
size. A row whose weight is two will grow at twice the rate as a row
of weight one when extra space is allocated to the layout.
-.VS 8.4
-The \fB-uniform\fP option, when a non-empty value is supplied, places
-the row in a \fIuniform group\fP with other rows that have the
-same value for \fB-uniform\fP. The space for rows belonging to a
+The \fB\-uniform\fR option, when a non-empty value is supplied, places
+the row in a \fIuniform group\fR with other rows that have the
+same value for \fB\-uniform\fR. The space for rows belonging to a
uniform group is allocated so that their sizes are always in strict
-proportion to their \fB-weight\fP values. See
+proportion to their \fB\-weight\fR values. See
\fBTHE GRID ALGORITHM\fR below for further details.
-.VE 8.4
-The \fB-pad\fP option specifies the number of screen units that will be
+The \fB\-pad\fR option specifies the number of screen units that will be
added to the largest window contained completely in that row when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
If only the master window and index is specified, all the current settings
-are returned in a list of "-option value" pairs.
+are returned in a list of
+.QW "-option value"
+pairs.
.TP
\fBgrid remove \fIslave \fR?\fIslave ...\fR?
Removes each of the \fIslave\fRs from grid for its
@@ -243,48 +264,48 @@ slave is managed once more by the grid geometry manager, the previous
values are retained.
.TP
\fBgrid size \fImaster\fR
-Returns the size of the grid (in columns then rows) for \fImaster\fP.
-The size is determined either by the \fIslave\fP occupying the largest
-row or column, or the largest column or row with a \fBminsize\fP,
-\fBweight\fP, or \fBpad\fP that is non-zero.
+Returns the size of the grid (in columns then rows) for \fImaster\fR.
+The size is determined either by the \fIslave\fR occupying the largest
+row or column, or the largest column or row with a \fBminsize\fR,
+\fBweight\fR, or \fBpad\fR that is non-zero.
.TP
\fBgrid slaves \fImaster\fR ?\fI\-option value\fR?
If no options are supplied, a list of all of the slaves in \fImaster\fR
are returned, most recently manages first.
-\fIOption\fP can be either \fB\-row\fP or \fB\-column\fP which
-causes only the slaves in the row (or column) specified by \fIvalue\fP
+\fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which
+causes only the slaves in the row (or column) specified by \fIvalue\fR
to be returned.
.SH "RELATIVE PLACEMENT"
.PP
-The \fBgrid\fP command contains a limited set of capabilities that
+The \fBgrid\fR command contains a limited set of capabilities that
permit layouts to be created without specifying the row and column
information for each slave. This permits slaves to be rearranged,
added, or removed without the need to explicitly specify row and
column information.
-When no column or row information is specified for a \fIslave\fP,
+When no column or row information is specified for a \fIslave\fR,
default values are chosen for
-\fBcolumn\fP, \fBrow\fP, \fBcolumnspan\fP and \fBrowspan\fP
-at the time the \fIslave\fP is managed. The values are chosen
-based upon the current layout of the grid, the position of the \fIslave\fP
-relative to other \fIslave\fPs in the same grid command, and the presence
-of the characters \fB\-\fP, \fBx\fP, and \fB^\fP in \fBgrid\fP
-command where \fIslave\fP names are normally expected.
+\fBcolumn\fR, \fBrow\fR, \fBcolumnspan\fR and \fBrowspan\fR
+at the time the \fIslave\fR is managed. The values are chosen
+based upon the current layout of the grid, the position of the \fIslave\fR
+relative to other \fIslave\fRs in the same grid command, and the presence
+of the characters \fB\-\fR, \fBx\fR, and \fB^\fR in \fBgrid\fR
+command where \fIslave\fR names are normally expected.
.RS
.TP
-\fB\-\fP
-This increases the columnspan of the \fIslave\fP to the left. Several
-\fB\-\fP's in a row will successively increase the columnspan. A \fB\-\fP
-may not follow a \fB^\fP or a \fBx\fP, nor may it be the first \fIslave\fP
+\fB\-\fR
+This increases the columnspan of the \fIslave\fR to the left. Several
+\fB\-\fR's in a row will successively increase the columnspan. A \fB\-\fR
+may not follow a \fB^\fR or a \fBx\fR, nor may it be the first \fIslave\fR
argument to \fBgrid configure\fR.
.TP
-\fBx\fP
-This leaves an empty column between the \fIslave\fP on the left and
-the \fIslave\fP on the right.
+\fBx\fR
+This leaves an empty column between the \fIslave\fR on the left and
+the \fIslave\fR on the right.
.TP
-\fB^\fP
-This extends the \fBrowspan\fP of the \fIslave\fP above the \fB^\fP's
-in the grid. The number of \fB^\fP's in a row must match the number of
-columns spanned by the \fIslave\fP above it.
+\fB^\fR
+This extends the \fBrowspan\fR of the \fIslave\fR above the \fB^\fR's
+in the grid. The number of \fB^\fR's in a row must match the number of
+columns spanned by the \fIslave\fR above it.
.RE
.SH "THE GRID ALGORITHM"
.PP
@@ -296,46 +317,49 @@ In the second step, the requested size is compared against the actual size
of the master. If the sizes are different, then spaces is added to or taken
away from the layout as needed.
For the final step, each slave is positioned in its row(s) and column(s)
-based on the setting of its \fIsticky\fP flag.
+based on the setting of its \fIsticky\fR flag.
.PP
To compute the minimum size of a layout, the grid geometry manager
first looks at all slaves whose columnspan and rowspan values are one,
and computes the nominal size of each row or column to be either the
-\fIminsize\fP for that row or column, or the sum of the \fIpad\fPding
+\fIminsize\fR for that row or column, or the sum of the \fIpad\fRding
plus the size of the largest slave, whichever is greater. After that
the rows or columns in each uniform group adapt to each other. Then
the slaves whose rowspans or columnspans are greater than one are
examined. If a group of rows or columns need to be increased in size
in order to accommodate these slaves, then extra space is added to each
-row or column in the group according to its \fIweight\fP. For each
+row or column in the group according to its \fIweight\fR. For each
group whose weights are all zero, the additional space is apportioned
equally.
.PP
When multiple rows or columns belong to a uniform group, the space
allocated to them is always in proportion to their weights. (A weight
of zero is considered to be 1.) In other words, a row or column
-configured with \fB-weight 1 -uniform a\fP will have exactly the same
-size as any other row or column configured with \fB-weight 1 -uniform
-a\fP. A row or column configured with \fB-weight 2 -uniform b\fR will
-be exactly twice as large as one that is configured with \fB-weight 1
--uniform b\fP.
+configured with \fB\-weight 1 \-uniform a\fR will have exactly the same
+size as any other row or column configured with \fB\-weight 1 \-uniform
+a\fR. A row or column configured with \fB\-weight 2 \-uniform b\fR will
+be exactly twice as large as one that is configured with \fB\-weight 1
+\-uniform b\fR.
.PP
More technically, each row or column in the group will have a size
-equal to \fIk*weight\fP for some constant \fIk\fP. The constant
-\fIk\fP is chosen so that no row or column becomes smaller than its
+equal to \fIk*weight\fR for some constant \fIk\fR. The constant
+\fIk\fR is chosen so that no row or column becomes smaller than its
minimum size. For example, if all rows or columns in a group have the
same weight, then each row or column will have the same size as the
largest row or column in the group.
.PP
+.VS 8.5
For masters whose size is larger than the requested layout, the additional
space is apportioned according to the row and column weights. If all of
-the weights are zero, the layout is centered within its master.
+the weights are zero, the layout is placed within its master according to
+the \fIanchor\fR value.
For masters whose size is smaller than the requested layout, space is taken
away from columns and rows according to their weights. However, once a
column or row shrinks to its minsize, its weight is taken to be zero.
If more space needs to be removed from a layout than would be permitted, as
when all the rows or columns are at their minimum sizes, the layout is
-clipped on the bottom and right.
+placed and clipped according to the \fIanchor\fR value.
+.VE 8.5
.SH "GEOMETRY PROPAGATION"
.PP
The grid geometry manager normally computes how large a master must be to
@@ -357,19 +381,19 @@ The master for each slave must either be the slave's parent
This restriction is necessary to guarantee that the
slave can be placed over any part of its master that is
visible without danger of the slave being clipped by its parent.
-In addition, all slaves in one call to \fBgrid\fP must have the same master.
+In addition, all slaves in one call to \fBgrid\fR must have the same master.
.SH "STACKING ORDER"
.PP
If the master for a slave is not its parent then you must make sure
that the slave is higher in the stacking order than the master.
Otherwise the master will obscure the slave and it will appear as
-if the slave hasn't been managed correctly.
+if the slave has not been managed correctly.
The easiest way to make sure the slave is higher than the master is
to create the master window first: the most recently created window
will be highest in the stacking order.
.SH CREDITS
.PP
-The \fBgrid\fP command is based on ideas taken from the \fIGridBag\fP
+The \fBgrid\fR command is based on ideas taken from the \fIGridBag\fR
geometry manager written by Doug. Stein, and the \fBblt_table\fR geometry
manager, written by George Howlett.
.SH EXAMPLES
@@ -378,27 +402,30 @@ A toplevel window containing a text widget and two scrollbars:
# Make the widgets
toplevel .t
text .t.txt \-wrap none \-xscroll {.t.h set} \-yscroll {.t.v set}
-scrollbar .t.v \-orient vertical \-command {.t.txt xview}
+scrollbar .t.v \-orient vertical \-command {.t.txt yview}
scrollbar .t.h \-orient horizontal \-command {.t.txt xview}
+
# Lay them out
\fBgrid\fR .t.txt .t.v \-sticky nsew
\fBgrid\fR .t.h \-sticky nsew
+
# Tell the text widget to take all the extra room
-\fBgrid rowconfigure\fR .t 0 \-weight 1
-\fBgrid columnconfigure\fR .t 0 \-weight 1
+\fBgrid rowconfigure\fR .t .t.txt \-weight 1
+\fBgrid columnconfigure\fR .t .t.txt \-weight 1
.CE
.PP
-Three widgets of equal width, despite their different "natural" widths:
+Three widgets of equal width, despite their different
+.QW natural
+widths:
.CS
button .b \-text "Foo"
entry .e \-variable foo
label .l \-text "This is a fairly long piece of text"
+
\fBgrid\fR .b .e .l \-sticky ew
-\fBgrid columnconfigure\fR . {0 1 2} \-uniform allTheSame
+\fBgrid columnconfigure\fR . "all" \-uniform allTheSame
.CE
-
.SH "SEE ALSO"
pack(n), place(n)
-
.SH KEYWORDS
geometry manager, location, grid, cell, propagation, size, pack
diff --git a/doc/image.n b/doc/image.n
index a93ffc1..e536916 100644
--- a/doc/image.n
+++ b/doc/image.n
@@ -43,7 +43,7 @@ name wisely. It is recommended to use a separate namespace for image names
\fBimage delete \fR?\fIname name\fR ...?
Deletes each of the named images and returns an empty string.
If there are instances of the images displayed in widgets,
-the images won't actually be deleted until all of the instances
+the images will not actually be deleted until all of the instances
are released.
However, the association between the instances and the image
manager will be dropped.
diff --git a/doc/label.n b/doc/label.n
index 1aa5ee1..ef121cb 100644
--- a/doc/label.n
+++ b/doc/label.n
@@ -29,7 +29,7 @@ Specifies a desired height for the label.
If an image or bitmap is being displayed in the label then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in lines of text.
-If this option isn't specified, the label's desired height is computed
+If this option is not specified, the label's desired height is computed
from the size of the image or bitmap or text being displayed in it.
.OP \-state state State
Specifies one of three states for the label: \fBnormal\fR, \fBactive\fR,
@@ -44,10 +44,9 @@ Specifies a desired width for the label.
If an image or bitmap is being displayed in the label then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in characters.
-If this option isn't specified, the label's desired width is computed
+If this option is not specified, the label's desired width is computed
from the size of the image or bitmap or text being displayed in it.
.BE
-
.SH DESCRIPTION
.PP
The \fBlabel\fR command creates a new window (given by the
@@ -69,7 +68,6 @@ one of the characters may optionally be underlined using the
\fBunderline\fR option.
The label can be manipulated in a few simple ways, such as
changing its relief or text, using the commands described below.
-
.SH "WIDGET COMMAND"
.PP
The \fBlabel\fR command creates a new Tcl command whose
@@ -102,11 +100,27 @@ modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBlabel\fR
command.
-
.SH BINDINGS
.PP
When a new label is created, it has no default event bindings:
labels are not intended to be interactive.
-
+.SH EXAMPLE
+.CS
+# Make the widgets
+\fBlabel\fR .t \-text "This widget is at the top" \-bg red
+\fBlabel\fR .b \-text "This widget is at the bottom" \-bg green
+\fBlabel\fR .l \-text "Left\enHand\enSide"
+\fBlabel\fR .r \-text "Right\enHand\enSide"
+text .mid
+\&.mid insert end "This layout is like Java's BorderLayout"
+# Lay them out
+pack .t \-side top \-fill x
+pack .b \-side bottom \-fill x
+pack .l \-side left \-fill y
+pack .r \-side right \-fill y
+pack .mid \-expand 1 \-fill both
+.CE
+.SH "SEE ALSO"
+labelframe(n), button(n), ttk::label(n)
.SH KEYWORDS
label, widget
diff --git a/doc/labelframe.n b/doc/labelframe.n
index 2654fe8..70d04cb 100644
--- a/doc/labelframe.n
+++ b/doc/labelframe.n
@@ -44,15 +44,6 @@ If the \fBcolormap\fR option is not specified, the new window
uses the same colormap as its parent.
This option may not be changed with the \fBconfigure\fR
widget command.
-.OP \-container container Container
-The value must be a boolean. If true, it means that this window will
-be used as a container in which some other application will be embedded
-(for example, a Tk toplevel can be embedded using the \fB\-use\fR option).
-The window will support the appropriate window manager protocols for
-things like geometry requests. The window should not have any
-children of its own in this application.
-This option may not be changed with the \fBconfigure\fR
-widget command.
.OP \-height height Height
Specifies the desired height for the window in any of the forms
acceptable to \fBTk_GetPixels\fR.
@@ -83,7 +74,6 @@ acceptable to \fBTk_GetPixels\fR.
If this option is less than or equal to zero then the window will
not request any size at all.
.BE
-
.SH DESCRIPTION
.PP
The \fBlabelframe\fR command creates a new window (given by the
@@ -131,14 +121,51 @@ modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBlabelframe\fR
command.
-
.SH BINDINGS
.PP
When a new labelframe is created, it has no default event bindings:
labelframes are not intended to be interactive.
+.SH EXAMPLE
+This shows how to build part of a GUI for a hamburger vendor. The
+\fBlabelframe\fR widgets are used to organize the available choices by
+the kinds of things that the choices are being made over.
+.PP
+.CS
+grid [\fBlabelframe\fR .burger \-text "Burger"] \e
+ [\fBlabelframe\fR .bun \-text "Bun"] \-sticky news
+grid [\fBlabelframe\fR .cheese \-text "Cheese Option"] \e
+ [\fBlabelframe\fR .pickle \-text "Pickle Option"] \-sticky news
+foreach {type name val} {
+ burger Beef beef
+ burger Lamb lamb
+ burger Vegetarian beans
-.SH "SEE ALSO"
-frame(n), label(n)
+ bun Plain white
+ bun Sesame seeds
+ bun Wholemeal brown
+
+ cheese None none
+ cheese Cheddar cheddar
+ cheese Edam edam
+ cheese Brie brie
+ cheese Gruy\eu00e8re gruyere
+ cheese "Monterey Jack" jack
+ pickle None none
+ pickle Gherkins gherkins
+ pickle Onions onion
+ pickle Chili chili
+} {
+ set w [radiobutton .$type.$val \-text $name \-anchor w \e
+ \-variable $type \-value $val]
+ pack $w \-side top \-fill x
+}
+set burger beef
+set bun white
+set cheese none
+set pickle none
+.CE
+.SH "SEE ALSO"
+frame(n), label(n), ttk::labelframe(n)
.SH KEYWORDS
labelframe, widget
diff --git a/doc/listbox.n b/doc/listbox.n
index e287b09..341ce9a 100644
--- a/doc/listbox.n
+++ b/doc/listbox.n
@@ -14,24 +14,20 @@ listbox \- Create and manipulate listbox widgets
.SH SYNOPSIS
\fBlistbox\fR \fIpathName \fR?\fIoptions\fR?
.SO
-\-activestyle \-height \-selectforeground
-\-background \-highlightbackground \-setgrid
-\-borderwidth \-highlightcolor \-state
-\-cursor \-highlightthickness \-takefocus
-\-disabledforeground \-relief \-width
-\-exportselection \-selectbackground \-xscrollcommand
-\-font \-selectborderwidth \-yscrollcommand
-\-foreground
+\-background \-borderwidth \-cursor
+\-disabledforeground \-exportselection \-font
+\-foreground \-highlightbackground \-highlightcolor
+\-highlightthickness \-relief \-selectbackground
+\-selectborderwidth \-selectforeground \-setgrid
+\-takefocus \-xscrollcommand \-yscrollcommand
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
-.VS 8.4
.OP \-activestyle activeStyle ActiveStyle
Specifies the style in which to draw the active element. This must be
one of \fBdotbox\fR (show a focus ring around the active element),
\fBnone\fR (no special indication of active element) or
\fBunderline\fR (underline the active element).
-The default is \fBunderline\fR.
-.VS 8.4
+The default is \fBunderline\fR on Windows, and \fBdotbox\fR elsewhere.
.OP \-height height Height
Specifies the desired height for the window, in lines.
If zero or less, then the desired height for the window is made just
@@ -51,17 +47,16 @@ or \fBextended\fR; the default value is \fBbrowse\fR.
.OP \-state state State
Specifies one of two states for the listbox: \fBnormal\fR or \fBdisabled\fR.
If the listbox is disabled then items may not be inserted or deleted,
-items are drawn in the \fB-disabledforeground\fR color, and selection
+items are drawn in the \fB\-disabledforeground\fR color, and selection
cannot be modified and is not shown (though selection information is retained).
.OP \-width width Width
Specifies the desired width for the window in characters.
-If the font doesn't have a uniform width then the width of the
-character ``0'' is used in translating from character units to
-screen units.
+If the font does not have a uniform width then the width of the character
+.QW 0
+is used in translating from character units to screen units.
If zero or less, then the desired width for the window is made just
large enough to hold all the elements in the listbox.
.BE
-
.SH DESCRIPTION
.PP
The \fBlistbox\fR command creates a new window (given by the
@@ -93,7 +88,6 @@ may be used to change the view in the window. Listboxes allow
scrolling in both directions using the standard \fBxScrollCommand\fR
and \fByScrollCommand\fR options.
They also support scanning, as described below.
-
.SH "INDICES"
.PP
Many of the widget commands for listboxes take one or more indices
@@ -117,11 +111,9 @@ Indicates the anchor point for the selection, which is set with the
.TP 12
\fBend\fR
Indicates the end of the listbox.
-.VS 8.0
For most commands this refers to the last element in the listbox,
but for a few commands such as \fBindex\fR and \fBinsert\fR
it refers to the element just after the last one.
-.VE
.TP 12
\fB@\fIx\fB,\fIy\fR
Indicates the element that covers the point in the listbox window
@@ -132,7 +124,6 @@ point is used.
In the widget command descriptions below, arguments named \fIindex\fR,
\fIfirst\fR, and \fIlast\fR always contain text indices in one of
the above forms.
-
.SH "WIDGET COMMAND"
.PP
The \fBlistbox\fR command creates a new Tcl command whose
@@ -148,10 +139,8 @@ commands are possible for listbox widgets:
.TP
\fIpathName \fBactivate\fR \fIindex\fR
Sets the active element to the one indicated by \fIindex\fR.
-.VS 8.0
If \fIindex\fR is outside the range of elements in the listbox
then the closest element is activated.
-.VE
The active element is drawn as specified by \fB\-activestyle\fR when the
widget has the input focus, and its index may be retrieved with the
index \fBactive\fR.
@@ -165,9 +154,7 @@ of the upper-left corner of the screen area covered by the text
elements give the width and height of the area, in pixels.
If no part of the element given by \fIindex\fR is visible on the
screen,
-.VS 8.0
or if \fIindex\fR refers to a non-existent element,
-.VE
then the result is an empty string; if the element is
partially visible, the result gives the full area of the element,
including any parts that are not visible.
@@ -201,15 +188,13 @@ string is returned.
\fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
Deletes one or more elements of the listbox. \fIFirst\fR and \fIlast\fR
are indices specifying the first and last elements in the range
-to delete. If \fIlast\fR isn't specified it defaults to
+to delete. If \fIlast\fR is not specified it defaults to
\fIfirst\fR, i.e. a single element is deleted.
.TP
\fIpathName \fBget \fIfirst\fR ?\fIlast\fR?
If \fIlast\fR is omitted, returns the contents of the listbox
element indicated by \fIfirst\fR,
-.VS 8.0
or an empty string if \fIfirst\fR refers to a non-existent element.
-.VE
If \fIlast\fR is specified, the command returns a list whose elements
are all of the listbox elements between \fIfirst\fR and \fIlast\fR,
inclusive.
@@ -218,10 +203,8 @@ forms for indices.
.TP
\fIpathName \fBindex \fIindex\fR
Returns the integer index value that corresponds to \fIindex\fR.
-.VS 8.0
If \fIindex\fR is \fBend\fR the return value is a count of the number
of elements in the listbox (not the index of the last element).
-.VE
.TP
\fIpathName \fBinsert \fIindex \fR?\fIelement element ...\fR?
Inserts zero or more new elements in the list just before the
@@ -308,10 +291,8 @@ has several forms, depending on \fIoption\fR:
.TP
\fIpathName \fBselection anchor \fIindex\fR
Sets the selection anchor to the element given by \fIindex\fR.
-.VS 8.0
If \fIindex\fR refers to a non-existent element, then the closest
element is used.
-.VE
The selection anchor is the end of the selection that is fixed
while dragging out a selection with the mouse.
The index \fBanchor\fR may be used to refer to the anchor
@@ -325,7 +306,7 @@ this range.
.TP
\fIpathName \fBselection includes \fIindex\fR
Returns 1 if the element indicated by \fIindex\fR is currently
-selected, 0 if it isn't.
+selected, 0 if it is not.
.TP
\fIpathName \fBselection set \fIfirst \fR?\fIlast\fR?
Selects all of the elements in the range between
@@ -418,7 +399,6 @@ If \fInumber\fR is negative then earlier elements
become visible; if it is positive then later elements
become visible.
.RE
-
.SH "DEFAULT BINDINGS"
.PP
Tk automatically creates class bindings for listboxes that give them
@@ -432,6 +412,10 @@ In both modes, clicking button 1 on an element selects
it and deselects any other selected item.
In \fBbrowse\fR mode it is also possible to drag the selection
with button 1.
+.VS 8.5
+On button 1, the listbox will also take focus if it has a \fBnormal\fR
+state and \fB\-takefocus\fR is true.
+.VE 8.5
.PP
If the selection mode is \fBmultiple\fR or \fBextended\fR,
any number of elements may be selected at once, including discontiguous
@@ -464,7 +448,7 @@ the button down.
In \fBextended\fR mode, pressing button 1 with the Control key down
starts a toggle operation: the anchor is set to the element under
the mouse, and its selection state is reversed. The selection state
-of other elements isn't changed.
+of other elements is not changed.
If the mouse is dragged with button 1 down, then the selection state
of all elements between the anchor and the element under the mouse
is set to match that of the anchor element; the selection state of
@@ -545,10 +529,10 @@ Control-backslash deselects everything in the widget, except in
The F16 key (labelled Copy on many Sun workstations) or Meta-w
copies the selection in the widget to the clipboard, if there is
a selection.
-
.PP
The behavior of listboxes can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH "SEE ALSO"
+ttk_treeview(n)
.SH KEYWORDS
listbox, widget
diff --git a/doc/loadTk.n b/doc/loadTk.n
index 6c6a830..e1fecf6 100644
--- a/doc/loadTk.n
+++ b/doc/loadTk.n
@@ -13,15 +13,13 @@ loadTk \- Load Tk into a safe interpreter.
.SH SYNOPSIS
\fB::safe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
.BE
-
+.SH DESCRIPTION
Safe Tk is based on Safe Tcl, which provides a mechanism
that allows restricted and mediated
access to auto-loading and packages for safe interpreters.
Safe Tk adds the ability to configure the interpreter
for safe Tk operations and load Tk into safe
interpreters.
-
-.SH DESCRIPTION
.PP
The \fB::safe::loadTk\fR command initializes the required data structures
in the named safe interpreter and then loads Tk into it.
@@ -29,14 +27,17 @@ The interpreter must have been created with \fB::safe::interpCreate\fR
or have been initialized with \fB::safe::interpInit\fR.
The command returns the name of the safe interpreter.
If \fB\-use\fR is specified, the window identified by the specified system
-dependent identifier \fIwindowId\fR is used to contain the ``.''
+dependent identifier \fIwindowId\fR is used to contain the
+.QW .
window of the safe interpreter; it can be any valid id, eventually
referencing a window belonging to another application. As a convenience,
if the window you plan to use is a Tk Window of the application you
can use the window name (e.g. \fB.x.y\fR) instead of its window Id
(\fB[winfo id .x.y]\fR).
When \fB\-use\fR is not specified,
-a new toplevel window is created for the ``.'' window of
+a new toplevel window is created for the
+.QW .
+window of
the safe interpreter. On X11 if you want the embedded window
to use another display than the default one, specify it with
\fB\-display\fR.
diff --git a/doc/menu.n b/doc/menu.n
index f801ead..7a92002 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -16,14 +16,12 @@ menu, tk_menuSetFocus \- Create and manipulate menu widgets
\fBmenu\fR \fIpathName \fR?\fIoptions\fR?
\fBtk_menuSetFocus\fR \fIpathName\fR
.SO
-\-activebackground \-borderwidth \-foreground
-\-activeborderwidth \-cursor \-relief
+\-activebackground \-borderwidth \-foreground
+\-activeborderwidth \-cursor \-relief
\-activeforeground \-disabledforeground \-takefocus
\-background \-font
-
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
-.VS
.OP \-postcommand postCommand Command
If this option is specified then it provides a Tcl command to execute
each time the menu is posted. The command is invoked by the \fBpost\fR
@@ -31,7 +29,6 @@ widget command before posting the menu. Note that in Tk 8.0 on Macintosh
and Windows, all post-commands in a system of menus are executed before any
of those menus are posted.
This is due to the limitations in the individual platforms' menu managers.
-.VE
.OP \-selectcolor selectColor Background
For menu entries that are check buttons or radio buttons, this option
specifies the color to display in the indicator when the check button
@@ -49,10 +46,12 @@ to invoke whenever the menu is torn off. The actual command will
consist of the value of this option, followed by a space, followed
by the name of the menu window, followed by a space, followed by
the name of the name of the torn off menu window. For example, if
-the option's is ``\fBa b\fR'' and menu \fB.x.y\fR is torn off to
+the option's value is
+.QW "\fBa b\fR"
+and menu \fB.x.y\fR is torn off to
create a new menu \fB.x.tearoff1\fR, then the command
-``\fBa b .x.y .x.tearoff1\fR'' will be invoked.
-.VS
+.QW "\fBa b .x.y .x.tearoff1\fR"
+will be invoked.
.OP \-title title Title
The string will be used to title the window created when this menu is
torn off. If the title is NULL, then the window will have the title
@@ -65,9 +64,7 @@ returned by the configuration database will change if this option is
changed, this does not affect the menu widget's behavior. This is used
by the cloning mechanism and is not normally set outside of the Tk
library.
-.VE
.BE
-
.SH INTRODUCTION
.PP
The \fBmenu\fR command creates a new top-level window (given
@@ -81,14 +78,12 @@ The \fBmenu\fR command returns its
there must not exist a window named \fIpathName\fR, but
\fIpathName\fR's parent must exist.
.PP
-.VS
A menu is a widget that displays a collection of one-line entries arranged
in one or more columns. There exist several different types of entries,
each with different properties. Entries of different types may be
combined in a single menu. Menu entries are not the same as
entry widgets. In fact, menu entries are not even distinct widgets;
the entire menu is one widget.
-.VE
.PP
Menu entries are displayed with up to three separate fields.
The main field is a label in the form of a text string,
@@ -117,28 +112,24 @@ The default menu bindings will not allow
a disabled entry to be activated or invoked.
Disabled entries may be re-enabled, at which point it becomes
possible to activate and invoke them again.
-.VS
.PP
Whenever a menu's active entry is changed, a <<MenuSelect>> virtual
event is send to the menu. The active item can then be queried from
the menu, and an action can be taken, such as setting
context-sensitive help text for the entry.
-.VE
-
-.SH "COMMAND ENTRIES"
+.SH "TYPES OF ENTRIES"
+.SS "COMMAND ENTRIES"
.PP
The most common kind of menu entry is a command entry, which
behaves much like a button widget. When a command entry is
invoked, a Tcl command is executed. The Tcl
command is specified with the \fB\-command\fR option.
-
-.SH "SEPARATOR ENTRIES"
+.SS "SEPARATOR ENTRIES"
.PP
A separator is an entry that is displayed as a horizontal dividing
line. A separator may not be activated or invoked, and it has
no behavior other than its display appearance.
-
-.SH "CHECKBUTTON ENTRIES"
+.SS "CHECKBUTTON ENTRIES"
.PP
A checkbutton menu entry behaves much like a checkbutton widget.
When it is invoked it toggles back and forth between the selected
@@ -155,8 +146,7 @@ the menu. If a \fB\-command\fR option is specified for a checkbutton
entry, then its value is evaluated as a Tcl command each time the entry
is invoked; this happens after toggling the entry's
selected state.
-
-.SH "RADIOBUTTON ENTRIES"
+.SS "RADIOBUTTON ENTRIES"
.PP
A radiobutton menu entry behaves much like a radiobutton widget.
Radiobutton entries are organized in groups of which only one
@@ -179,8 +169,7 @@ otherwise the indicator's center is displayed in the background color for
the menu. If a \fB\-command\fR option is specified for a radiobutton
entry, then its value is evaluated as a Tcl command each time the entry
is invoked; this happens after selecting the entry.
-
-.SH "CASCADE ENTRIES"
+.SS "CASCADE ENTRIES"
.PP
A cascade entry is one with an associated menu (determined
by the \fB\-menu\fR option). Cascade entries allow the construction
@@ -199,7 +188,6 @@ Tcl command of the form
where \fImenu\fR is the path name of the associated menu, and \fIx\fR
and \fIy\fR are the root-window coordinates of the upper-right
corner of the cascade entry.
-.VS
On Unix, the lower-level menu is unposted by executing a Tcl command with
the form
.CS
@@ -208,15 +196,11 @@ the form
where \fImenu\fR is the name of the associated menu.
On other platforms, the platform's native code takes care of unposting the
menu.
-.VE
.PP
-.VS
If a \fB\-command\fR option is specified for a cascade entry then it is
evaluated as a Tcl command whenever the entry is invoked. This is not
supported on Windows.
-.VE
-
-.SH "TEAR-OFF ENTRIES"
+.SS "TEAR-OFF ENTRIES"
.PP
A tear-off entry appears at the top of the menu if enabled with the
\fBtearOff\fR option. It is not like other menu entries in that
@@ -226,8 +210,6 @@ When a tear-off entry is created it appears as a dashed line at
the top of the menu. Under the default bindings, invoking the
tear-off entry causes a torn-off copy to be made of the menu and
all of its submenus.
-
-.VS
.SH "MENUBARS"
.PP
Any menu can be set as a menubar for a toplevel window (see
@@ -244,39 +226,29 @@ example of this concerns the handling of checkbuttons and radiobuttons
within the menu. While it is permitted to put these menu elements on
menubars, they may not be drawn with indicators on some platforms, due
to system restrictions.
-.VE
-
-.VS
-.SH "SPECIAL MENUS IN MENUBARS"
+.SS "SPECIAL MENUS IN MENUBARS"
.PP
-Certain menus in a menubar will be treated specially. On the Macintosh,
-access to the special Apple and Help menus is provided. On Windows,
-access to the Windows System menu in each window is provided. On X Windows,
-a special right-justified help menu is provided. In all cases, these
-menus must be created with the command name of the menubar menu concatenated
-with the special name. So for a menubar named .menubar, on the Macintosh,
-the special menus would be .menubar.apple and .menubar.help; on Windows,
-the special menu would be .menubar.system; on X Windows, the help
-menu would be .menubar.help.
+Certain menus in a menubar will be treated specially. On the
+Macintosh, access to the special Application and Help menus is
+provided. On Windows, access to the Windows System menu in each window
+is provided. On X Windows, a special right-justified help menu may be
+provided if Motif menu compatibility is enabled. In all cases, these
+menus must be created with the command name of the menubar menu
+concatenated with the special name. So for a menubar named .menubar,
+on the Macintosh, the special menus would be .menubar.apple
+and .menubar.help; on Windows, the special menu would be .menubar.system;
+on X Windows, the help menu would be .menubar.help.
.PP
-When Tk sees an Apple menu on the Macintosh, that menu's contents make
-up the first items of the Apple menu on the screen whenever the window
-containing the menubar is in front. The menu is the
-first one that the user sees and has a title which is an Apple logo.
+When Tk sees a .menubar.apple menu on the Macintosh, that menu's contents
+make up the first items of the Application menu whenever the window
+containing the menubar is in front.
After all of the Tk-defined items, the menu will have a separator,
-followed by all of the items in the user's Apple Menu Items folder.
-Since the System uses a different menu definition procedure for
-the Apple menu than Tk uses for its menus, and the system APIs do
-not fully support everything Tk tries to do, the menu item will only
-have its text displayed. No font attributes, images, bitmaps, or colors
-will be displayed. In addition, a menu with a tearoff item will have
-the tearoff item displayed as "(TearOff)".
+followed by all standard Application menu items.
.PP
-When Tk see a Help menu on the Macintosh, the menu's contents are
-appended to the standard help menu on the right of the user's menubar
-whenever the user's menubar is in front. The first items in the menu
-are provided by Apple. Similar to the Apple Menu, customization in this
-menu is limited to what the system provides.
+When Tk sees a Help menu on the Macintosh, the menu's contents are
+appended to the standard Help menu on the right of the user's menubar
+whenever the window's menubar is in front. The first items in the menu
+are provided by Mac OS X.
.PP
When Tk sees a System menu on Windows, its items are appended to the
system menu that the menubar is attached to. This menu has an icon
@@ -285,11 +257,11 @@ Alt+Spacebar. Due to limitations in the Windows API, any font changes,
colors, images, bitmaps, or tearoff images will not appear in the
system menu.
.PP
-When Tk see a Help menu on X Windows, the menu is moved to be last in
-the menubar and is right justified.
-.VE
-
-.VS
+When Tk sees a Help menu on X Windows and Motif menu compatibility is
+enabled the menu is moved to be last in the menubar and is right
+justified. Motif menu compatibility is enabled by setting the Tk option
+\fB*Menu.useMotifHelp\fR to true or by calling
+\fBtk::classic::restore menu\fR.
.SH "CLONES"
.PP
When a menu is set as a menubar for a toplevel window, or when a menu
@@ -299,9 +271,7 @@ configuration of the original are reflected in the
clone. Additionally, any cascades that are pointed to are also cloned
so that menu traversal will work right. Clones are destroyed when
either the tearoff or menubar goes away, or when the original menu is
-destroyed.
-.VE
-
+destroyed.
.SH "WIDGET COMMAND"
.PP
The \fBmenu\fR command creates a new Tcl command whose
@@ -338,7 +308,9 @@ This form may not be abbreviated.
Same as \fBend\fR.
.TP 12
\fBnone\fR
-Indicates ``no entry at all''; this is used most commonly with
+Indicates
+.QW "no entry at all" ;
+this is used most commonly with
the \fBactivate\fR option to deactivate all the entries in the
menu. In most cases the specification of \fBnone\fR causes
nothing to happen in the widget command.
@@ -347,11 +319,12 @@ This form may not be abbreviated.
\fB@\fInumber\fR
In this form, \fInumber\fR is treated as a y-coordinate in the
menu's window; the entry closest to that y-coordinate is used.
-For example, ``\fB@0\fR'' indicates the top-most entry in the
-window.
+For example,
+.QW \fB@0\fR
+indicates the top-most entry in the window.
.TP 12
\fIpattern\fR
-If the index doesn't satisfy one of the above forms then this
+If the index does not satisfy one of the above forms then this
form is used. \fIPattern\fR is pattern-matched against the label of
each entry in the menu, in order from the top down, until a
matching entry is found. The rules of \fBTcl_StringMatch\fR
@@ -417,16 +390,13 @@ If a \fB\-image\fR option has been specified, it overrides
This option is not available for separator or tear-off entries.
.TP
\fB\-columnbreak \fIvalue\fR
-.VS 8.0
When this option is zero, the entry appears below the previous entry. When
this option is one, the entry appears at the top of a new column in the
menu.
-.VE 8.0
.TP
\fB\-command \fIvalue\fR
Specifies a Tcl command to execute when the menu entry is invoked.
Not available for separator or tear-off entries.
-.VS 8.4
.TP
\fB\-compound \fIvalue\fR
Specifies whether the menu entry should display both an image and text,
@@ -436,7 +406,6 @@ Valid values for this option are \fBbottom\fR, \fBcenter\fR,
is \fBnone\fR, meaning that the button will display either an image or
text, depending on the values of the \fB\-image\fR and \fB\-bitmap\fR
options.
-.VE
.TP
\fB\-font \fIvalue\fR
Specifies the font to use when drawing the label or accelerator
@@ -451,14 +420,12 @@ is in the normal state (neither active nor disabled).
If this option is specified as an empty string (the default), then the
\fBforeground\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
-.VS
.TP
\fB\-hidemargin \fIvalue\fR
Specifies whether the standard margins should be drawn for this menu
entry. This is useful when creating palette with images in them, i.e.,
color palettes, pattern palettes, etc. 1 indicates that the margin for
the entry is hidden; 0 means that the margin is used.
-.VE
.TP
\fB\-image \fIvalue\fR
Specifies an image to display in the menu instead of a text string
@@ -556,16 +523,14 @@ Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBmenu\fR
command.
-.VS
.TP
\fIpathName\fR \fBclone\fR \fInewPathname ?cloneType?\fR
Makes a clone of the current menu named \fInewPathName\fR. This clone
is a menu in its own right, but any changes to the clone are
-propogated to the original menu and vice versa. \fIcloneType\fR can be
+propagated to the original menu and vice versa. \fIcloneType\fR can be
\fBnormal\fR, \fBmenubar\fR, or \fBtearoff\fR. Should not normally be
called outside of the Tk library. See the \fBCLONES\fR section for
more information.
-.VE
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
Query or modify the configuration options of the widget.
@@ -644,8 +609,8 @@ returned without posting the menu.
\fIpathName \fBpostcascade \fIindex\fR
Posts the submenu associated with the cascade entry given by
\fIindex\fR, and unposts any previously posted submenu.
-If \fIindex\fR doesn't correspond to a cascade entry,
-or if \fIpathName\fR isn't posted,
+If \fIindex\fR does not correspond to a cascade entry,
+or if \fIpathName\fR is not posted,
the command has no effect except to unpost any currently posted
submenu.
.TP
@@ -656,30 +621,31 @@ command when the entry was created, such as \fBcommand\fR
or \fBseparator\fR, or \fBtearoff\fR for a tear-off entry.
.TP
\fIpathName \fBunpost\fR
-.VS
Unmap the window so that it is no longer displayed. If a
lower-level cascaded menu is posted, unpost that menu. Returns an
empty string. This subcommand does not work on Windows and the
Macintosh, as those platforms have their own way of unposting menus.
-.VE
+.TP
+\fIpathName \fBxposition \fIindex\fR
+.VS 8.5
+Returns a decimal string giving the x-coordinate within the menu
+window of the leftmost pixel in the entry specified by \fIindex\fR.
+.VE 8.5
.TP
\fIpathName \fByposition \fIindex\fR
Returns a decimal string giving the y-coordinate within the menu
window of the topmost pixel in the entry specified by \fIindex\fR.
-
.SH "MENU CONFIGURATIONS"
.PP
The default bindings support four different ways of using menus:
-.VS
.TP
\fBPulldown Menus in Menubar\fR
-This is the most command case. You create a menu widget that will become the
+This is the most common case. You create a menu widget that will become the
menu bar. You then add cascade entries to this menu, specifying the
pull down menus you wish to use in your menu bar. You then create all
of the pulldowns. Once you have done this, specify the menu using the
\fB\-menu\fR option of the toplevel's widget command. See the
\fBtoplevel\fR manual entry for details.
-.VE
.TP
\fBPulldown Menus in Menu Buttons\fR
This is the compatible way to do menu bars. You create one menubutton
@@ -711,7 +677,6 @@ the top of an existing menu. The default bindings will create a new menu
that is a copy of the original menu and leave it permanently
posted as a top-level window. The torn-off menu behaves just
the same as the original menu.
-
.SH "DEFAULT BINDINGS"
.PP
Tk automatically creates class bindings for menus that give them
@@ -763,23 +728,21 @@ Otherwise, if the current menu was posted from a
menubutton, then the current menubutton is unposted and the
next menubutton to the right is posted.
.PP
-Disabled menu entries are non-responsive: they don't activate and
+Disabled menu entries are non-responsive: they do not activate and
they ignore mouse button presses and releases.
.PP
-.VS 8.4
Several of the bindings make use of the command \fBtk_menuSetFocus\fR.
It saves the current focus and sets the focus to its \fIpathName\fR
argument, which is a menu widget.
-.VE
.PP
The behavior of menus can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
.SH BUGS
.PP
-At present it isn't possible to use the
+At present it is not possible to use the
option database to specify values for the options to individual
entries.
-
+.SH "SEE ALSO"
+bind(n), menubutton(n), ttk::menubutton(n), toplevel(n)
.SH KEYWORDS
menu, widget
diff --git a/doc/menubutton.n b/doc/menubutton.n
index 22b1df6..ade9523 100644
--- a/doc/menubutton.n
+++ b/doc/menubutton.n
@@ -37,7 +37,7 @@ Specifies a desired height for the menubutton.
If an image or bitmap is being displayed in the menubutton then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in lines of text.
-If this option isn't specified, the menubutton's desired height is computed
+If this option is not specified, the menubutton's desired height is computed
from the size of the image or bitmap or text being displayed in it.
.OP \-indicatoron indicatorOn IndicatorOn
The value must be a proper boolean value. If it is true then
@@ -64,10 +64,9 @@ Specifies a desired width for the menubutton.
If an image or bitmap is being displayed in the menubutton then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in characters.
-If this option isn't specified, the menubutton's desired width is computed
+If this option is not specified, the menubutton's desired width is computed
from the size of the image or bitmap or text being displayed in it.
.BE
-
.SH INTRODUCTION
.PP
The \fBmenubutton\fR command creates a new window (given by the
@@ -105,7 +104,6 @@ new menubutton is posted instead.
There are several interactions between menubuttons and menus; see
the \fBmenu\fR manual entry for information on various menu configurations,
such as pulldown menus and option menus.
-
.SH "WIDGET COMMAND"
.PP
The \fBmenubutton\fR command creates a new Tcl command whose
@@ -138,7 +136,6 @@ modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBmenubutton\fR
command.
-
.SH "DEFAULT BINDINGS"
.PP
Tk automatically creates class bindings for menubuttons that give them
@@ -178,7 +175,7 @@ lower-case or upper-case equivalent), may be typed in any window
under the menubutton's toplevel to post the menubutton.
.IP [8]
The F10 key may be typed in any window to post the first menubutton
-under its toplevel window that isn't disabled.
+under its toplevel window that is not disabled.
.IP [9]
If a menubutton has the input focus, the space and return keys
post the menubutton.
@@ -188,6 +185,7 @@ actions occur: the menubutton is completely non-responsive.
.PP
The behavior of menubuttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH "SEE ALSO"
+ttk::menubutton(n), menu(n)
.SH KEYWORDS
menubutton, widget
diff --git a/doc/message.n b/doc/message.n
index 94f93fe..92434f0 100644
--- a/doc/message.n
+++ b/doc/message.n
@@ -14,12 +14,11 @@ message \- Create and manipulate message widgets
.SH SYNOPSIS
\fBmessage\fR \fIpathName \fR?\fIoptions\fR?
.SO
-\-anchor \-highlightbackground \-takefocus
-\-background \-highlightcolor \-text
-\-borderwidth \-highlightthickness \-textvariable
-\-cursor \-padx \-width
-\-font \-pady
-\-foreground \-relief
+\-anchor \-background \-borderwidth
+\-cursor \-font \-foreground
+\-highlightbackground \-highlightcolor \-highlightthickness
+\-padx \-pady \-relief
+\-takefocus \-text \-textvariable
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-aspect aspect Aspect
@@ -30,7 +29,7 @@ be as wide as it is tall, 200 means the text should
be twice as wide as it is tall, 50 means the text should
be twice as tall as it is wide, and so on.
Used to choose line length for text if \fBwidth\fR option
-isn't specified.
+is not specified.
Defaults to 150.
.OP \-justify justify Justify
Specifies how to justify lines of text.
@@ -61,7 +60,6 @@ length.
If this option has a value less than or equal to zero, then
the \fBaspect\fR option determines the line length.
.BE
-
.SH DESCRIPTION
.PP
The \fBmessage\fR command creates a new window (given by the
@@ -96,10 +94,10 @@ are replaced with enough blank space to line up on the next
characters (ASCII code less than 0x20) and characters not defined
in the font are displayed as a four-character sequence \fB\ex\fIhh\fR where
\fIhh\fR is the two-digit hexadecimal number corresponding to
-the character. In the unusual case where the font doesn't contain
-all of the characters in ``0123456789abcdef\ex'' then control
-characters and undefined characters are not displayed at all.
-
+the character. In the unusual case where the font does not contain
+all of the characters in
+.QW 0123456789abcdef\ex
+then control characters and undefined characters are not displayed at all.
.SH "WIDGET COMMAND"
.PP
The \fBmessage\fR command creates a new Tcl command whose
@@ -132,16 +130,15 @@ modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBmessage\fR
command.
-
.SH "DEFAULT BINDINGS"
.PP
When a new message is created, it has no default event bindings:
messages are intended for output purposes only.
-
.SH BUGS
.PP
-Tabs don't work very well with text that is centered or right-justified.
+Tabs do not work very well with text that is centered or right-justified.
The most common result is that the line is justified wrong.
-
+.SH "SEE ALSO"
+label(n)
.SH KEYWORDS
message, widget
diff --git a/doc/messageBox.n b/doc/messageBox.n
index 0079972..5cdd26e 100644
--- a/doc/messageBox.n
+++ b/doc/messageBox.n
@@ -27,10 +27,21 @@ The following option-value pairs are supported:
.TP
\fB\-default\fR \fIname\fR
\fIName\fR gives the symbolic name of the default button for
-this message window ('ok', 'cancel', and so on). See \fB\-type\fR
+this message window (
+.QW ok ,
+.QW cancel ,
+and so on). See \fB\-type\fR
for a list of the symbolic names. If this option is not specified,
the first button in the dialog will be made the default.
.TP
+\fB\-detail\fR \fIstring\fR
+.VS 8.5
+Specifies an auxiliary message to the main message given by the
+\fB\-message\fR option. Where supported by the underlying OS, the
+message detail will be presented in a less emphasized font than the
+main message.
+.VE 8.5
+.TP
\fB\-icon\fR \fIiconImage\fR
Specifies an icon to display. \fIIconImage\fR must be one of the
following: \fBerror\fR, \fBinfo\fR, \fBquestion\fR or
@@ -76,8 +87,10 @@ and \fBcancel\fR.
.PP
.SH EXAMPLE
.CS
-set answer [\fBtk_messageBox\fR \-message "Really quit?" \-type yesno \-icon question]
-switch -- $answer {
+set answer [\fBtk_messageBox\fR \-message "Really quit?" \e
+ \-icon question \-type yesno \e
+ \-detail "Select \e"Yes\e" to make the application exit"]
+switch \-\- $answer {
yes exit
no {\fBtk_messageBox\fR \-message "I know you like this application!" \e
\-type ok}
diff --git a/doc/option.n b/doc/option.n
index e731713..b7342e2 100644
--- a/doc/option.n
+++ b/doc/option.n
@@ -19,7 +19,6 @@ option \- Add/retrieve window options to/from the option database
\fBoption readfile \fIfileName \fR?\fIpriority\fR?
.fi
.BE
-
.SH DESCRIPTION
.PP
The \fBoption\fR command allows you to add entries to the Tk option
@@ -27,7 +26,8 @@ database or to retrieve options from the database. The \fBadd\fR
form of the command adds a new option to the database.
\fIPattern\fR contains
the option being specified, and consists of names and/or classes
-separated by asterisks or dots, in the usual X format. \fIValue\fR
+separated by asterisks or dots, in the usual X format (see \fBPATTERN
+FORMAT\fR). \fIValue\fR
contains a text string to associate with \fIpattern\fR; this is the
value that will be returned in calls to \fBTk_GetOption\fR or by
invocations of the \fBoption get\fR command. If \fIpriority\fR
@@ -63,31 +63,60 @@ The \fIpriority\fR arguments to the \fBoption\fR command are
normally specified symbolically using one of the following values:
.TP
\fBwidgetDefault\fR
+.
Level 20. Used for default values hard-coded into widgets.
.TP
\fBstartupFile\fR
+.
Level 40. Used for options specified in application-specific
startup files.
.TP
\fBuserDefault\fR
+.
Level 60. Used for options specified in user-specific defaults
files, such as \fB.Xdefaults\fR, resource databases loaded into
the X server, or user-specific startup files.
.TP
\fBinteractive\fR
+.
Level 80. Used for options specified interactively after the application
-starts running. If \fIpriority\fR isn't specified, it defaults to
+starts running. If \fIpriority\fR is not specified, it defaults to
this level.
-.LP
+.PP
Any of the above keywords may be abbreviated. In addition, priorities
may be specified numerically using integers between 0 and 100,
inclusive. The numeric form is probably a bad idea except for new priority
levels other than the ones given above.
+.SH "PATTERN FORMAT"
+.PP
+Patterns consist of a sequence of words separated by either periods,
+.QW . ,
+or asterisks
+.QW * .
+The overall pattern may also be optionally preceded by an asterisk.
+.PP
+Each word in the pattern conventionally starts with either an upper-case
+letter (in which case it denotes the class of either a widget or an option) or
+any other character, when it denotes the name of a widget or option. The last
+word in the pattern always indicates the option; the preceding ones constrain
+which widgets that option will be looked for in.
+.PP
+When two words are separated by a period, the latter widget must be a direct
+child of the former (or the option must apply to only the indicated widgets).
+When two words are separated by an asterisk, any depth of widgets may lie
+between the former and latter widgets (and the option applies to all widgets
+that are children of the former widget).
+.PP
+If the overall pattern is preceded by an asterisk, then the overall pattern
+applies anywhere it can throughout the whole widget hierarchy. Otherwise the
+first word of the pattern is matched against the name and class of the
+.QW \fB.\fR
+\fBtoplevel\fR, which are usually set by options to \fBwish\fR.
.SH EXAMPLES
Instruct every button in the application to have red text on it unless
-explicitly overridden:
+explicitly overridden (note that on some platforms the option is ignored):
.CS
-\fBoption add\fR *button.foreground red startupFile
+\fBoption add\fR *Button.foreground red startupFile
.CE
.PP
Allow users to control what happens in an entry widget when the Return
@@ -98,6 +127,10 @@ entry .e
bind .e <Return> [\fBoption get\fR .e returnCommand Command]
\fBoption add\fR *.e.returnCommand bell widgetDefault
.CE
-
+.SH "SEE ALSO"
+options(n), wish(1)
.SH KEYWORDS
database, option, priority, retrieve
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/optionMenu.n b/doc/optionMenu.n
index 3ffa1cb..1f9f831 100644
--- a/doc/optionMenu.n
+++ b/doc/optionMenu.n
@@ -12,12 +12,11 @@
.SH NAME
tk_optionMenu \- Create an option menubutton and its menu
.SH SYNOPSIS
-\fBtk_optionMenu \fIw varName value \fR?\fIvalue value ...\fR?
+\fBtk_optionMenu \fIpathName varName value \fR?\fIvalue value ...\fR?
.BE
-
.SH DESCRIPTION
.PP
-This procedure creates an option menubutton whose name is \fIw\fR,
+This procedure creates an option menubutton whose name is \fIpathName\fR,
plus an associated menu.
Together they allow the user to select one of the values
given by the \fIvalue\fR arguments.
@@ -31,8 +30,12 @@ and appear in the option menubutton.
The current value can also be changed by setting the variable.
.PP
The return value from \fBtk_optionMenu\fR is the name of the menu
-associated with \fIw\fR, so that the caller can change its configuration
-options or manipulate it in other ways.
-
+associated with \fIpathName\fR, so that the caller can change its
+configuration options or manipulate it in other ways.
+.SH EXAMPLE
+.CS
+tk_optionMenu .foo myVar Foo Bar Boo Spong Wibble
+pack .foo
+.CE
.SH KEYWORDS
option menu
diff --git a/doc/options.n b/doc/options.n
index 2710300..25b0c9d 100644
--- a/doc/options.n
+++ b/doc/options.n
@@ -21,7 +21,9 @@ of the standard options supported by that widget), but if a widget does
support an option with one of the names listed below, then the option
has exactly the effect described below.
.PP
-In the descriptions below, ``Command-Line Name'' refers to the
+In the descriptions below,
+.QW "Command-Line Name"
+refers to the
switch used in class commands and \fBconfigure\fR widget commands to
set this value. For example, if an option's command-line switch is
\fB\-foreground\fR and there exists a widget \fB.a.b.c\fR, then the
@@ -32,9 +34,10 @@ command
may be used to specify the value \fBblack\fR for the option in
the widget \fB.a.b.c\fR. Command-line switches may be abbreviated,
as long as the abbreviation is unambiguous.
-``Database Name'' refers to the option's name in the option database (e.g.
-in .Xdefaults files). ``Database Class'' refers to the option's class value
-in the option database.
+.QW "Database Name"
+refers to the option's name in the option database (e.g. in .Xdefaults files).
+.QW "Database Class"
+refers to the option's class value in the option database.
.OP \-activebackground activeBackground Foreground
Specifies background color to use when drawing active elements.
An element (a widget or portion of a widget) is active if the
@@ -43,10 +46,8 @@ will cause some action to occur.
If strict Motif compliance has been requested by setting the
\fBtk_strictMotif\fR variable, this option will normally be
ignored; the normal background color will be used instead.
-.VS
For some elements on Windows and Macintosh systems, the active color
will only be used while mouse button 1 is pressed over the element.
-.VE
.OP \-activeborderwidth activeBorderWidth BorderWidth
Specifies a non-negative value indicating
the width of the 3-D border drawn around active elements. See above for
@@ -89,8 +90,9 @@ The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
.OP \-cursor cursor Cursor
Specifies the mouse cursor to be used for the widget.
The value may have any of the forms acceptable to \fBTk_GetCursor\fR.
+In addition, if an empty string is specified, it indicates that the
+widget should defer to its parent for cursor specification.
.OP \-compound compound Compound
-.VS 8.4
Specifies if the widget should display text and bitmaps/images at the
same time, and if so, where the bitmap/image should be placed relative
to the text. Must be one of the values \fBnone\fR, \fBbottom\fR,
@@ -100,7 +102,6 @@ to the text. Must be one of the values \fBnone\fR, \fBbottom\fR,
specifies that the bitmap or image should be displayed to the left of
the text, and the value \fBcenter\fR specifies that the bitmap or
image should be displayed on top of the text.
-.VE 8.4
.OP \-disabledforeground disabledForeground DisabledForeground
Specifies foreground color to use when drawing a disabled element.
If the option is specified as an empty string (which is typically the
@@ -119,7 +120,8 @@ requests when it has a selection. The default is usually for widgets
to export selections.
.OP \-font font Font
Specifies the font to use when drawing text inside the widget.
-The value may have any of the forms accepted by \fBTk_GetFont\fR.
+The value may have any of the forms described in the \fBfont\fR manual
+page under \fBFONT DESCRIPTION\fR.
.OP "\-foreground or \-fg" foreground Foreground
Specifies the normal foreground color to use when displaying the widget.
.OP \-highlightbackground highlightBackground HighlightBackground
@@ -153,12 +155,16 @@ of the 3-D border to draw around the insertion cursor.
The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
.OP \-insertofftime insertOffTime OffTime
Specifies a non-negative integer value indicating the number of
-milliseconds the insertion cursor should remain ``off'' in each blink cycle.
-If this option is zero then the cursor doesn't blink: it is on
+milliseconds the insertion cursor should remain
+.QW off
+in each blink cycle.
+If this option is zero then the cursor does not blink: it is on
all the time.
.OP \-insertontime insertOnTime OnTime
Specifies a non-negative integer value indicating the number of
-milliseconds the insertion cursor should remain ``on'' in each blink cycle.
+milliseconds the insertion cursor should remain
+.QW on
+in each blink cycle.
.OP \-insertwidth insertWidth InsertWidth
Specifies a value indicating the total width of the insertion cursor.
The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
@@ -176,7 +182,9 @@ If the value is false, updates are made continuously as the
slider is dragged.
If the value is true, updates are delayed until the mouse button
is released to end the drag; at that point a single notification
-is made (the value ``jumps'' rather than changing smoothly).
+is made (the value
+.QW jumps
+rather than changing smoothly).
.OP \-justify justify Justify
When there are multiple lines of text displayed in a widget, this
option determines how the lines line up with each other.
@@ -292,7 +300,7 @@ particular widget and may be determined by other options, such as
.OP \-troughcolor troughColor Background
Specifies the color to use for the rectangular trough areas
in widgets such as scrollbars and scales. This option is ignored for
-scrollbars on Windows (native widget doesn't recognize this option).
+scrollbars on Windows (native widget does not recognize this option).
.OP \-underline underline Underline
Specifies the integer index of a character to underline in the widget.
This option is used by the default bindings to implement keyboard
@@ -327,7 +335,11 @@ the information just after the last portion that is visible.
The command is
then passed to the Tcl interpreter for execution. Typically the
\fBxScrollCommand\fR option consists of the path name of a scrollbar
-widget followed by ``set'', e.g. ``.x.scrollbar set'': this will cause
+widget followed by
+.QW set ,
+e.g.
+.QW ".x.scrollbar set" :
+this will cause
the scrollbar to be updated whenever the view in the window changes.
If this option is not specified, then no command will be executed.
.OP \-yscrollcommand yScrollCommand ScrollCommand
diff --git a/doc/pack-old.n b/doc/pack-old.n
index 66bdc18..532b4ae 100644
--- a/doc/pack-old.n
+++ b/doc/pack-old.n
@@ -61,7 +61,7 @@ the \fIoptions\fR argument following each \fIwindow\fR consists of
a list of one or more fields that govern the placement of that
window. In the discussion below, the term \fIcavity\fR refers
to the space left in a parent when a particular child is placed
-(i.e. all the space that wasn't claimed by earlier children in
+(i.e. all the space that was not claimed by earlier children in
the packing order). The term \fIparcel\fR refers to the space
allocated to a particular child; this is not necessarily the
same as the child window's final geometry.
diff --git a/doc/pack.n b/doc/pack.n
index 13c9e0f..73e4872 100644
--- a/doc/pack.n
+++ b/doc/pack.n
@@ -25,14 +25,15 @@ on the \fIoption\fR argument:
.TP
\fBpack \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
If the first argument to \fBpack\fR is a window name (any value
-starting with ``.''), then the command is processed in the same
-way as \fBpack configure\fR.
+starting with
+.QW . ),
+then the command is processed in the same way as \fBpack configure\fR.
.TP
\fBpack configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
The arguments consist of the names of one or more slave windows
followed by pairs of arguments that specify how
to manage the slaves.
-See ``THE PACKER ALGORITHM'' below for details on how the options
+See \fBTHE PACKER ALGORITHM\fR below for details on how the options
are used by the packer.
The following options are supported:
.RS
@@ -134,13 +135,14 @@ The slaves will no longer be managed by the packer.
Returns a list whose elements are the current configuration state of
the slave given by \fIslave\fR in the same option-value form that
might be specified to \fBpack configure\fR.
-The first two elements of the list are ``\fB\-in \fImaster\fR'' where
-\fImaster\fR is the slave's master.
+The first two elements of the list are
+.QW "\fB\-in \fImaster\fR"
+where \fImaster\fR is the slave's master.
.TP
\fBpack propagate \fImaster\fR ?\fIboolean\fR?
If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
then propagation is enabled for \fImaster\fR, which must be a window
-name (see ``GEOMETRY PROPAGATION'' below).
+name (see \fBGEOMETRY PROPAGATION\fR below).
If \fIboolean\fR has a false boolean value then propagation is
disabled for \fImaster\fR.
In either of these cases an empty string is returned.
@@ -182,7 +184,7 @@ For the left or right side the height of the parcel is
the height of the cavity and the width is the requested width
of the slave plus the \fB\-ipadx\fR and \fB\-padx\fR options.
The parcel may be enlarged further because of the \fB\-expand\fR
-option (see ``EXPANSION'' below)
+option (see \fBEXPANSION\fR below)
.IP [2]
The packer chooses the dimensions of the slave.
The width will normally be the slave's requested width plus
@@ -206,7 +208,7 @@ slave and the edges of the parcel.
Once a given slave has been packed, the area of its parcel
is subtracted from the cavity, leaving a smaller rectangular
cavity for the next slave.
-If a slave doesn't use all of its parcel, the unused space
+If a slave does not use all of its parcel, the unused space
in the parcel will not be used by subsequent slaves.
If the cavity should become too small to meet the needs of
a slave then the slave will be given whatever space is
@@ -214,7 +216,7 @@ left in the cavity.
If the cavity shrinks to zero size, then all remaining slaves
on the packing list will be unmapped from the screen until
the master window becomes large enough to hold them again.
-.SH "EXPANSION"
+.SS "EXPANSION"
.PP
If a master window is so large that there will be extra space
left over after all of its slaves have been packed, then the
@@ -224,7 +226,7 @@ Extra horizontal space is distributed among the expandable
slaves whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
and extra vertical space is distributed among the expandable
slaves whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
-.SH "GEOMETRY PROPAGATION"
+.SS "GEOMETRY PROPAGATION"
.PP
The packer normally computes how large a master must be to
just exactly meet the needs of its slaves, and it sets the
@@ -250,7 +252,7 @@ visible without danger of the slave being clipped by its parent.
If the master for a slave is not its parent then you must make sure
that the slave is higher in the stacking order than the master.
Otherwise the master will obscure the slave and it will appear as
-if the slave hasn't been packed correctly.
+if the slave has not been packed correctly.
The easiest way to make sure the slave is higher than the master is
to create the master window first: the most recently created window
will be highest in the stacking order.
@@ -261,8 +263,8 @@ the stacking order of either the master or the slave.
# Make the widgets
label .t \-text "This widget is at the top" \-bg red
label .b \-text "This widget is at the bottom" \-bg green
-label .l \-text "Left\\nHand\\nSide"
-label .r \-text "Right\\nHand\\nSide"
+label .l \-text "Left\enHand\enSide"
+label .r \-text "Right\enHand\enSide"
text .mid
\&.mid insert end "This layout is like Java's BorderLayout"
# Lay them out
diff --git a/doc/palette.n b/doc/palette.n
index 76c01c7..4b1dcff 100644
--- a/doc/palette.n
+++ b/doc/palette.n
@@ -32,15 +32,15 @@ of \fIname\fR\-\fIvalue\fR pairs, where the first argument of the pair
is the name of an option in the Tk option database and the second
argument is the new value to use for that option. The following
database names are currently supported:
-.DS L
+.DS
.ta 4c 8c
-\fBactiveBackground foreground selectColor
-activeForeground highlightBackground selectBackground
-background highlightColor selectForeground
-disabledForeground insertBackground troughColor\fR
+\fBactiveBackground\fR \fBforeground\fR \fBselectColor\fR
+\fBactiveForeground\fR \fBhighlightBackground\fR \fBselectBackground\fR
+\fBbackground\fR \fBhighlightColor\fR \fBselectForeground\fR
+\fBdisabledForeground\fR \fBinsertBackground\fR \fBtroughColor\fR
.DE
\fBtk_setPalette\fR tries to compute reasonable defaults for any
-options that you don't specify. You can specify options other
+options that you do not specify. You can specify options other
than the above ones and Tk will change those options on widgets as
well. This feature may be useful if you are using custom widgets with
additional color options.
@@ -64,7 +64,8 @@ from the .Xdefaults file or options specified on the command-line
that creates a widget.
.PP
The procedure \fBtk_bisque\fR is provided for backward compatibility:
-it restores the application's colors to the light brown (``bisque'')
+it restores the application's colors to the light brown
+.PQ bisque
color scheme used in Tk 3.6 and earlier versions.
.SH KEYWORDS
diff --git a/doc/panedwindow.n b/doc/panedwindow.n
index 621767c..ccc87e7 100644
--- a/doc/panedwindow.n
+++ b/doc/panedwindow.n
@@ -14,9 +14,8 @@ panedwindow \- Create and manipulate panedwindow widgets
.SH SYNOPSIS
\fBpanedwindow\fR \fIpathName \fR?\fIoptions\fR?
.SO
-\-background \-height \-width
-\-borderwidth \-orient
-\-cursor \-relief
+\-background \-borderwidth \-cursor
+\-orient \-relief
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-handlepad handlePad HandlePad
@@ -26,6 +25,10 @@ which to draw the handle. May be any value accepted by \fBTk_GetPixels\fR.
.OP \-handlesize handleSize HandleSize
Specifies the side length of a sash handle. Handles are always
drawn as squares. May be any value accepted by \fBTk_GetPixels\fR.
+.OP \-height height Height
+Specifies a desired height for the overall panedwindow widget. May be any
+value accepted by \fBTk_GetPixels\fR. If an empty string, the widget will be
+made high enough to allow all contained widgets to have their natural height.
.OP \-opaqueresize opaqueResize OpaqueResize
Specifies whether panes should be resized as a sash is moved (true),
or if resizing should be deferred until the sash is placed (false).
@@ -45,8 +48,11 @@ Specifies the width of each sash. May be any value accepted by
.OP \-showhandle showHandle ShowHandle
Specifies whether sash handles should be shown. May be any valid Tcl
boolean value.
+.OP \-width width Width
+Specifies a desired width for the overall panedwindow widget. May be any
+value accepted by \fBTk_GetPixels\fR. If an empty string, the widget will be
+made wide enough to allow all contained widgets to have their natural width.
.BE
-
.SH DESCRIPTION
.PP
The \fBpanedwindow\fR command creates a new window (given by the
@@ -188,10 +194,17 @@ height requested internally by the window will be used initially; the
height may later be adjusted by the movement of sashes in the
panedwindow. \fISize\fR may be any value accepted by \fBTk_GetPixels\fR.
.TP
+\fB\-hide \fIboolean\fR
+.VS 8.5
+Controls the visibility of a pane. When the \fIboolean\fR is true
+(according to \fBTcl_GetBoolean\fR) the pane will not be visible, but
+it will still be maintained in the list of panes.
+.VE 8.5
+.TP
\fB\-minsize \fIn\fR
Specifies that the size of the window cannot be made less than
\fIn\fR. This constraint only affects the size of the widget in the
-paned dimension -- the x dimension for horizontal panedwindows, the y
+paned dimension \(em the x dimension for horizontal panedwindows, the y
dimension for vertical panedwindows. May be any value accepted by
\fBTk_GetPixels\fR.
.TP
@@ -209,13 +222,46 @@ have any of the forms accepted by \fBTk_GetPixels\fR.
If a window's pane is larger than the requested dimensions of the
window, this option may be used to position (or stretch) the window
within its pane. \fIStyle\fR is a string that contains zero or more
-of the characters \fBn\fP, \fBs\fP, \fBe\fP or \fBw\fP. The string
+of the characters \fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR. The string
can optionally contains spaces or commas, but they are ignored. Each
letter refers to a side (north, south, east, or west) that the window
-will "stick" to. If both \fBn\fP and \fBs\fP (or \fBe\fP and \fBw\fP)
+will
+.QW stick
+to. If both \fBn\fR and \fBs\fR (or \fBe\fR and \fBw\fR)
are specified, the window will be stretched to fill the entire height
(or width) of its cavity.
.TP
+\fB\-stretch \fIwhen\fR
+.VS 8.5
+Controls how extra space is allocated to each of the panes.
+\fIWhen\fR is one of \fBalways\fR, \fBfirst\fR, \fBlast\fR,
+\fBmiddle\fR, and \fBnever\fR.
+The panedwindow will calculate the required size of all its panes. Any
+remaining (or deficit) space will be distributed to those panes marked
+for stretching. The space will be distributed based on each panes
+current ratio of the whole. The \fIwhen\fR values have the following
+definition:
+.RS
+.TP
+\fBalways\fR
+This pane will always stretch.
+.TP
+\fBfirst\fR
+Only if this pane is the first pane (left-most or top-most) will it
+stretch.
+.TP
+\fBlast\fR
+Only if this pane is the last pane (right-most or bottom-most) will it
+stretch. This is the default value.
+.TP
+\fBmiddle\fR
+Only if this pane is not the first or last pane will it stretch.
+.TP
+\fBnever\fR
+This pane will never stretch.
+.RE
+.VE 8.5
+.TP
\fB\-width \fIsize\fR
Specify a width for the window. The width will be the outer
dimension of the window including its border, if any. If \fIsize\fR
@@ -237,6 +283,7 @@ adjusted.
When a pane is resized from outside (e.g. it is packed to expand and
fill, and the containing toplevel is resized), space is added to the final
(rightmost or bottommost) pane in the window.
-
+.SH "SEE ALSO"
+ttk::panedwindow(n)
.SH KEYWORDS
panedwindow, widget, geometry management
diff --git a/doc/photo.n b/doc/photo.n
index 7f03fe7..c14abe3 100644
--- a/doc/photo.n
+++ b/doc/photo.n
@@ -30,10 +30,8 @@ C code through a procedural interface. At present, only GIF and PPM/PGM
formats are supported, but an interface exists to allow additional
image file formats to be added easily. A photo image is transparent
in regions where no image data has been supplied
-.VS 8.4
or where it has been set transparent by the \fBtransparency set\fR
subcommand.
-.VE 8.4
.SH "CREATING PHOTOS"
.PP
Like all images, photos are created using the \fBimage create\fR
@@ -188,7 +186,6 @@ about the Y or X axes, respectively. If \fIy\fR is not given, the
default value is the same as \fIx\fR.
.TP
\fB\-compositingrule \fIrule\fR
-.VS 8.4
Specifies how transparent pixels in the source image are combined with
the destination image. When a compositing rule of \fIoverlay\fR is
set, the old contents of the destination image are visible, as if the
@@ -197,7 +194,6 @@ over the top of the destination. When a compositing rule of \fIset\fR
is set, the old contents of the destination image are discarded and
the source image is used as-is. The default compositing rule is
\fIoverlay\fR.
-.VE 8.4
.RE
.TP
\fIimageName \fBdata ?\fIoption value(s) ...\fR?
@@ -214,9 +210,14 @@ the specified color.
Specifies the name of the image file format handler to be used.
Specifically, this subcommand searches
for the first handler whose name matches an initial substring of
-\fIformat-name\fR and which has the capability to read this image data.
-If this option is not given, this subcommand uses the first
-handler that has the capability to read the image data.
+\fIformat-name\fR and which has the capability to write a string
+containing this image data.
+If this option is not given, this subcommand uses a format that
+consists of a list (one element per row) of lists (one element per
+pixel/column) of colors in
+.QW \fB#\fIrrggbb\fR
+format (where \fIrr\fR is a pair of hexadecimal digits for the red
+channel, \fIgg\fR for green, and \fIbb\fR for blue).
.TP
\fB\-from \fIx1 y1 x2 y2\fR
Specifies a rectangular region of \fIimageName\fR to be returned.
@@ -259,8 +260,8 @@ format handler to read the data.
.TP
\fB\-to \fIx1 y1\fR ?\fIx2 y2\fR?
Specifies the coordinates of the top-left corner (\fIx1\fR,\fIy1\fR)
-of the region of \fIimageName\fR into which data from \fIfilename\fR
-are to be read. The default is (0,0). If \fIx2\fR,\fIy2\fR is given
+of the region of \fIimageName\fR into which the image data will be
+copied. The default position is (0,0). If \fIx2\fR,\fIy2\fR is given
and \fIdata\fR is not large enough to cover the rectangle specified by
this option, the image data extracted will be tiled so it covers the
entire destination rectangle. Note that if \fIdata\fR specifies a
@@ -316,7 +317,6 @@ recalculate the dithered image in each window where the image is
displayed.
.TP
\fIimageName \fBtransparency \fIsubcommand ?arg arg ...?\fR
-.VS 8.4
Allows examination and manipulation of the transparency information in
the photo image. Several subcommands are available:
.RS
@@ -329,7 +329,6 @@ transparent.
Makes the pixel at (\fIx\fR,\fIy\fR) transparent if \fIboolean\fR is
true, and makes that pixel opaque otherwise.
.RE
-.VE 8.4
.TP
\fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR?
Writes image data from \fIimageName\fR to a file named \fIfilename\fR.
@@ -374,7 +373,7 @@ When reading an image file or processing
string data specified with the \fB\-data\fR configuration option, the
photo image code invokes each handler in turn until one is
found that claims to be able to read the data in the file or string.
-Usually this will find the correct handler, but if it doesn't, the
+Usually this will find the correct handler, but if it does not, the
user may give a format name with the \fB\-format\fR option to specify
which handler to use. In fact the photo image code will try those
handlers whose names begin with the string specified for the
@@ -390,10 +389,8 @@ for the \fB\-format\fR option must begin with the complete name of the
requested handler, and may contain additional information following
that, which the handler can use, for example, to specify which variant
to use of the formats supported by the handler.
-.VS 8.4
Note that not all image handlers may support writing transparency data
to a file, even where the target image format does.
-.VE 8.4
.SH "COLOR ALLOCATION"
.PP
When a photo image is displayed in a window, the photo image code
@@ -433,7 +430,7 @@ Load an image from a file and tile it to the size of a window, which
is useful for producing a tiled background:
.CS
# These lines should be called once
-\fBimage create photo\fR untiled -file "theFile.ppm"
+\fBimage create photo\fR untiled \-file "theFile.ppm"
\fBimage create photo\fR tiled
# These lines should be called whenever .someWidget changes
diff --git a/doc/place.n b/doc/place.n
index 017313f..fc7e0fb 100644
--- a/doc/place.n
+++ b/doc/place.n
@@ -102,7 +102,7 @@ In addition, \fImaster\fR and \fIwindow\fR must both be descendants
of the same top-level window.
These restrictions are necessary to guarantee
that \fIwindow\fR is visible whenever \fImaster\fR is visible.
-If this option isn't specified then the master defaults to
+If this option is not specified then the master defaults to
\fIwindow\fR's parent.
.TP
\fB\-relheight \fIsize\fR
@@ -180,7 +180,7 @@ the most recent option is used and the older one is ignored.
\fBplace forget \fIwindow\fR
Causes the placer to stop managing the geometry of \fIwindow\fR. As a
side effect of this command \fIwindow\fR will be unmapped so that it
-doesn't appear on the screen. If \fIwindow\fR isn't currently managed
+does not appear on the screen. If \fIwindow\fR is not currently managed
by the placer then the command has no effect. This command returns an
empty string.
.TP
@@ -207,12 +207,15 @@ This feature is useful in at least two situations.
First, for complex window layouts it means you can create a
hierarchy of subwindows whose only purpose
is to assist in the layout of the parent.
-The ``real children'' of the parent (i.e. the windows that
+The
+.QW "real children"
+of the parent (i.e. the windows that
are significant for the application's user interface) can be
children of the parent yet be placed inside the windows
of the geometry-management hierarchy.
-This means that the path names of the ``real children''
-don't reflect the geometry-management hierarchy and users
+This means that the path names of the
+.QW "real children"
+do not reflect the geometry-management hierarchy and users
can specify options for the real children
without being aware of the structure of the geometry-management
hierarchy.
@@ -230,7 +233,7 @@ will be repositioned as well.
.PP
Unlike many other geometry managers (such as the packer)
the placer does not make any attempt to manipulate the geometry of
-the master windows or the parents of slave windows (i.e. it doesn't
+the master windows or the parents of slave windows (i.e. it does not
set their requested sizes).
To control the sizes of these windows, make them windows like
frames and canvases that provide configuration options for this purpose.
@@ -238,7 +241,7 @@ frames and canvases that provide configuration options for this purpose.
Make the label occupy the middle bit of the toplevel, no matter how it
is resized:
.CS
-label .l \-text "In the\\nMiddle!" \-bg black \-fg white
+label .l \-text "In the\enMiddle!" \-bg black \-fg white
\fBplace\fR .l \-relwidth .3 \-relx .35 \-relheight .3 \-rely .35
.CE
diff --git a/doc/radiobutton.n b/doc/radiobutton.n
index ae9a857..29c2eec 100644
--- a/doc/radiobutton.n
+++ b/doc/radiobutton.n
@@ -34,7 +34,7 @@ Specifies a desired height for the button.
If an image or bitmap is being displayed in the button then the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in lines of text.
-If this option isn't specified, the button's desired height is computed
+If this option is not specified, the button's desired height is computed
from the size of the image or bitmap or text being displayed in it.
.OP \-indicatoron indicatorOn IndicatorOn
Specifies whether or not the indicator should be drawn. Must be a
@@ -52,25 +52,25 @@ whenever the widget is selected.
If specified as an empty string then no special color is used for
displaying when the widget is selected.
.OP \-offrelief offRelief OffRelief
-.VS 8.4
Specifies the relief for the checkbutton when the indicator is not drawn and
-the checkbutton is off. The default value is "raised". By setting this option
-to "flat" and setting -indicatoron to false and -overrelief to raised,
+the checkbutton is off. The default value is
+.QW raised .
+By setting this option to
+.QW flat
+and setting \fB\-indicatoron\fR to false and \fB\-overrelief\fR to
+.QW raised ,
the effect is achieved
of having a flat button that raises on mouse-over and which is
depressed when activated. This is the behavior typically exhibited by
the Align-Left, Align-Right, and Center radiobuttons on the toolbar of a
word-processor, for example.
-.VE 8.4
.OP \-overrelief overRelief OverRelief
-.VS 8.4
Specifies an alternative relief for the radiobutton, to be used when the
mouse cursor is over the widget. This option can be used to make
toolbar buttons, by configuring \fB\-relief flat \-overrelief
raised\fR. If the value of this option is the empty string, then no
alternative relief is used when the mouse cursor is over the radiobutton.
The empty string is the default value.
-.VE 8.4
.OP \-selectimage selectImage SelectImage
Specifies an image to display (in place of the \fBimage\fR option)
when the radiobutton is selected.
@@ -87,6 +87,19 @@ should be insensitive: the default bindings will refuse to activate
the widget and will ignore mouse button presses.
In this state the \fBdisabledForeground\fR and
\fBbackground\fR options determine how the radiobutton is displayed.
+.OP \-tristateimage tristateImage TristateImage
+.VS 8.5
+Specifies an image to display (in place of the \fBimage\fR option)
+when the radiobutton is selected.
+This option is ignored unless the \fBimage\fR option has been
+specified.
+.VE 8.5
+.OP \-tristatevalue tristateValue Value
+.VS 8.5
+Specifies the value that causes the radiobutton to display the multi-value
+selection, also known as the tri-state mode. Defaults to
+.QW "" .
+.VE 8.5
.OP \-value value Value
Specifies value to store in the button's associated variable whenever
this button is selected.
@@ -100,10 +113,9 @@ Specifies a desired width for the button.
If an image or bitmap is being displayed in the button, the value is in
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
for text it is in characters.
-If this option isn't specified, the button's desired width is computed
+If this option is not specified, the button's desired width is computed
from the size of the image or bitmap or text being displayed in it.
.BE
-
.SH DESCRIPTION
.PP
The \fBradiobutton\fR command creates a new window (given by the
@@ -117,10 +129,8 @@ text, and initial relief. The \fBradiobutton\fR command returns its
there must not exist a window named \fIpathName\fR, but
\fIpathName\fR's parent must exist.
.PP
-.VS
A radiobutton is a widget that displays a textual string, bitmap or image
and a diamond or circle called an \fIindicator\fR.
-.VE
If text is displayed, it must all be in a single font, but it
can occupy multiple lines on the screen (if it contains newlines
or if wrapping occurs because of the \fBwrapLength\fR option) and
@@ -135,7 +145,6 @@ check button.
.PP
In addition, radiobuttons can be \fIselected\fR.
If a radiobutton is selected, the indicator is normally
-.VS
drawn with a selected appearance, and
a Tcl variable associated with the radiobutton is set to a particular
value (normally 1).
@@ -144,15 +153,19 @@ color. Under Windows, the indicator is drawn with a round mark inside.
If the radiobutton is not selected, then the indicator is drawn with a
deselected appearance, and the associated variable is
set to a different value (typically 0).
-Under Unix, the indicator is drawn with a raised relief and no special
-color. Under Windows, the indicator is drawn without a round mark inside.
-.VE
+The indicator is drawn without a round mark inside.
Typically, several radiobuttons share a single variable and the
value of the variable indicates which radiobutton is to be selected.
When a radiobutton is selected it sets the value of the variable to
indicate that fact; each radiobutton also monitors the value of
the variable and automatically selects and deselects itself when the
variable's value changes.
+.VS 8.5
+If the variable's value matches the \fBtristateValue\fR, then the radiobutton is
+drawn using the tri-state mode. This mode is used to indicate mixed or
+multiple values. (This is used when the radiobutton represents the state
+of multiple items.)
+.VE 8.5
By default the variable \fBselectedButton\fR
is used; its contents give the name of the button that is
selected, or the empty string if no button associated with that
@@ -225,14 +238,12 @@ value corresponding to this widget.
Tk automatically creates class bindings for radiobuttons that give them
the following default behavior:
.IP [1]
-.VS
On Unix systems, a radiobutton activates whenever the mouse passes
over it and deactivates whenever the mouse leaves the radiobutton. On
Mac and Windows systems, when mouse button 1 is pressed over a
radiobutton, the button activates whenever the mouse pointer is inside
the button, and deactivates whenever the mouse pointer leaves the
button.
-.VE
.IP [2]
When mouse button 1 is pressed over a radiobutton it is invoked (it
becomes selected and the command associated with the button is
@@ -246,9 +257,7 @@ actions occur: the radiobutton is completely non-responsive.
.PP
The behavior of radiobuttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
.SH "SEE ALSO"
-checkbutton(n), labelframe(n), listbox(n), options(n), scale(n)
-
+checkbutton(n), labelframe(n), listbox(n), options(n), scale(n), ttk::radiobutton(n)
.SH KEYWORDS
radiobutton, widget
diff --git a/doc/raise.n b/doc/raise.n
index 643ec36..02f805f 100644
--- a/doc/raise.n
+++ b/doc/raise.n
@@ -34,11 +34,11 @@ it. This is is often necessary when building GUIs in the style where
you create your activity widgets first before laying them out on the
display:
.CS
-button .b -text "Hi there!"
-pack [frame .f -background blue]
-pack [label .f.l1 -text "This is above"]
-pack .b -in .f
-pack [label .f.l2 -text "This is below"]
+button .b \-text "Hi there!"
+pack [frame .f \-background blue]
+pack [label .f.l1 \-text "This is above"]
+pack .b \-in .f
+pack [label .f.l2 \-text "This is below"]
\fBraise\fR .b
.CE
diff --git a/doc/scale.n b/doc/scale.n
index 5b1b3b1..e750fdd 100644
--- a/doc/scale.n
+++ b/doc/scale.n
@@ -23,7 +23,8 @@ scale \- Create and manipulate scale widgets
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-bigincrement bigIncrement BigIncrement
Some interactions with the scale cause its value to change by
-``large'' increments; this option specifies the size of the
+.QW large
+increments; this option specifies the size of the
large increments. If specified as 0, the large increments default
to 1/10 the range of the scale.
.OP \-command command Command
@@ -71,7 +72,7 @@ or \fBsunken\fR.
Specifies one of three states for the scale: \fBnormal\fR,
\fBactive\fR, or \fBdisabled\fR.
If the scale is disabled then the value may not be changed and the scale
-won't activate.
+will not activate.
If the scale is active, the slider is displayed using the color
specified by the \fBactiveBackground\fR option.
.OP \-tickinterval tickInterval TickInterval
@@ -186,7 +187,7 @@ the slider; \fBtrough1\fR means that the point is over the
portion of the slider above or to the left of the slider;
and \fBtrough2\fR means that the point is over the portion
of the slider below or to the right of the slider.
-If the point isn't over one of these elements, an empty string
+If the point is not over one of these elements, an empty string
is returned.
.TP
\fIpathName \fBset\fR \fIvalue\fR
diff --git a/doc/scrollbar.n b/doc/scrollbar.n
index 7f4801a..a13574b 100644
--- a/doc/scrollbar.n
+++ b/doc/scrollbar.n
@@ -37,7 +37,7 @@ name of a widget and either \fBxview\fR (if the scrollbar is for
horizontal scrolling) or \fByview\fR (for vertical scrolling).
All scrollable widgets have \fBxview\fR and \fByview\fR commands
that take exactly the additional arguments appended by the scrollbar
-as described in SCROLLING COMMANDS below.
+as described in \fBSCROLLING COMMANDS\fR below.
.OP \-elementborderwidth elementBorderWidth BorderWidth
Specifies the width of borders drawn around the internal elements
of the scrollbar (the two arrows and the slider). The value may
@@ -51,7 +51,6 @@ scrollbars this will be the width and for horizontal scrollbars
this will be the height.
The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
.BE
-
.SH DESCRIPTION
.PP
The \fBscrollbar\fR command creates a new window (given by the
@@ -280,7 +279,7 @@ If the button is held down, the action auto-repeats.
.IP [3]
Pressing button 1 over the slider and dragging causes the view
to drag with the slider.
-If the \fBjump\fR option is true, then the view doesn't drag along
+If the \fBjump\fR option is true, then the view does not drag along
with the slider; it changes only when the mouse button is released.
.IP [4]
Pressing button 1 over \fBtrough2\fR causes the view in the
@@ -332,12 +331,13 @@ The End key adjusts the view to the bottom (right edge) of the document.
Create a window with a scrollable \fBtext\fR widget:
.CS
toplevel .tl
-text .tl.t -yscrollcommand {.tl.s set}
-\fBscrollbar\fR .tl.s -command {.tl.t yview}
-grid .tl.t .tl.s -sticky nsew
-grid columnconfigure .tl 0 -weight 1
-grid rowconfigure .tl 0 -weight 1
+text .tl.t \-yscrollcommand {.tl.s set}
+\fBscrollbar\fR .tl.s \-command {.tl.t yview}
+grid .tl.t .tl.s \-sticky nsew
+grid columnconfigure .tl 0 \-weight 1
+grid rowconfigure .tl 0 \-weight 1
.CE
-
+.SH "SEE ALSO"
+ttk:scrollbar(n)
.SH KEYWORDS
scrollbar, widget
diff --git a/doc/selection.n b/doc/selection.n
index dcf12b2..8aee321 100644
--- a/doc/selection.n
+++ b/doc/selection.n
@@ -35,35 +35,44 @@ so that no window owns the selection anymore. \fISelection\fR
specifies the X selection that should be cleared, and should be an
atom name such as PRIMARY or CLIPBOARD; see the Inter-Client
Communication Conventions Manual for complete details.
-\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to ``.''.
+\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to
+.QW . .
Returns an empty string.
.TP
\fBselection get\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR? ?\fB\-type\fR \fItype\fR?
Retrieves the value of \fIselection\fR from \fIwindow\fR's display and
returns it as a result. \fISelection\fR defaults to PRIMARY and
-\fIwindow\fR defaults to ``.''.
+\fIwindow\fR defaults to
+.QW . .
\fIType\fR specifies the form in which the selection is to be returned
-(the desired ``target'' for conversion, in ICCCM terminology), and
+(the desired
+.QW target
+for conversion, in ICCCM terminology), and
should be an atom name such as STRING or FILE_NAME; see the
Inter-Client Communication Conventions Manual for complete details.
\fIType\fR defaults to STRING. The selection owner may choose to
return the selection in any of several different representation
-formats, such as STRING, ATOM, INTEGER, etc. (this format is different
+formats, such as STRING, UTF8_STRING, ATOM, INTEGER, etc. (this format
+is different
than the selection type; see the ICCCM for all the confusing details).
If the selection is returned in a non-string format, such as INTEGER
or ATOM, the \fBselection\fR command converts it to string format as a
collection of fields separated by spaces: atoms are converted to their
textual names, and anything else is converted to hexadecimal integers.
+Note that \fBselection get\fR does not retrieve the selection in the
+UTF8_STRING format unless told to.
.TP
-\fBselection handle\fR ?\fB\-selection\fR \fIselection\fR? ?\fB\-type\fR \fItype\fR? ?\fB\-format\fR \fIformat\fR? \fIwindow command\fR
+\fBselection handle\fR ?\fB\-selection\fR \fIs\fR? ?\fB\-type\fR \fIt\fR? ?\fB\-format\fR \fIf\fR? \fIwindow command\fR
Creates a handler for selection requests, such that \fIcommand\fR will
-be executed whenever \fIselection\fR is owned by \fIwindow\fR and
-someone attempts to retrieve it in the form given by \fItype\fR
-(e.g. \fItype\fR is specified in the \fBselection get\fR command).
-\fISelection\fR defaults to PRIMARY, \fItype\fR defaults to STRING, and
-\fIformat\fR defaults to STRING. If \fIcommand\fR is an empty string
-then any existing handler for \fIwindow\fR, \fItype\fR, and
-\fIselection\fR is removed.
+be executed whenever selection \fIs\fR is owned by \fIwindow\fR and
+someone attempts to retrieve it in the form given by type \fIt\fR
+(e.g. \fIt\fR is specified in the \fBselection get\fR command).
+\fIS\fR defaults to PRIMARY, \fIt\fR defaults to STRING, and
+\fIf\fR defaults to STRING. If \fIcommand\fR is an empty string
+then any existing handler for \fIwindow\fR, \fIt\fR, and
+\fIs\fR is removed.
+Note that when the selection is handled as type STRING it is also
+automatically handled as type UTF8_STRING as well.
.RS
.PP
When \fIselection\fR is requested, \fIwindow\fR is the selection owner,
@@ -71,7 +80,6 @@ and \fItype\fR is the requested type, \fIcommand\fR will be executed
as a Tcl command with two additional numbers appended to it
(with space separators).
The two additional numbers
-.VS
are \fIoffset\fR and \fImaxChars\fR: \fIoffset\fR specifies a starting
character position in the selection and \fImaxChars\fR gives the maximum
number of characters to retrieve. The command should return a value consisting
@@ -85,16 +93,17 @@ include all of the remainder of the selection; if the length of
\fIcommand\fR will be invoked again, until it eventually
returns a result shorter than \fImaxChars\fR. The value of \fImaxChars\fR
will always be relatively large (thousands of characters).
-.VE
.PP
If \fIcommand\fR returns an error then the selection retrieval is rejected
-just as if the selection didn't exist at all.
+just as if the selection did not exist at all.
.PP
The \fIformat\fR argument specifies the representation that should be
used to transmit the selection to the requester (the second column of
Table 2 of the ICCCM), and defaults to STRING. If \fIformat\fR is
STRING, the selection is transmitted as 8-bit ASCII characters (i.e.
-just in the form returned by \fIcommand\fR). If \fIformat\fR is
+just in the form returned by \fIcommand\fR, in the system \fBencoding\fR;
+the UTF8_STRING format always uses UTF-8 as its encoding).
+If \fIformat\fR is
ATOM, then the return value from \fIcommand\fR is divided into fields
separated by white space; each field is converted to its atom value,
and the 32-bit atom value is transmitted instead of the atom name.
@@ -104,7 +113,7 @@ converted to a 32-bit integer; an array of integers is transmitted
to the selection requester.
.PP
The \fIformat\fR argument is needed only for compatibility with
-selection requesters that don't use Tk. If Tk is being
+selection requesters that do not use Tk. If Tk is being
used to retrieve the selection then the value is converted back to
a string at the requesting end, so \fIformat\fR is
irrelevant.
@@ -117,7 +126,8 @@ The first form of \fBselection own\fR returns the path name of the
window in this application that owns \fIselection\fR on the display
containing \fIwindow\fR, or an empty string if no window in this
application owns the selection. \fISelection\fR defaults to PRIMARY and
-\fIwindow\fR defaults to ``.''.
+\fIwindow\fR defaults to
+.QW . .
.PP
The second form of \fBselection own\fR causes \fIwindow\fR to become
the new owner of \fIselection\fR on \fIwindow\fR's display, returning
@@ -160,9 +170,7 @@ proc lost {} {
puts "Lost selection"
}
.CE
-
.SH "SEE ALSO"
clipboard(n)
-
.SH KEYWORDS
clear, format, handler, ICCCM, own, selection, target, type
diff --git a/doc/send.n b/doc/send.n
index 59d832b..3b2a714 100644
--- a/doc/send.n
+++ b/doc/send.n
@@ -28,9 +28,9 @@ contained entirely within the \fIcmd\fR argument. If one or
more \fIarg\fRs are present, they are concatenated to form the
command to be executed, just as for the \fBeval\fR command.
.PP
-If the initial arguments of the command begin with ``\-''
-they are treated as options. The following options are
-currently defined:
+If the initial arguments of the command begin with
+.QW \-
+they are treated as options. The following options are currently defined:
.TP
\fB\-async\fR
Requests asynchronous invocation. In this case the \fBsend\fR
@@ -47,7 +47,8 @@ the application's main window.
.TP
\fB\-\|\-\fR
Serves no purpose except to terminate the list of options. This
-option is needed only if \fIapp\fR could contain a leading ``\-''
+option is needed only if \fIapp\fR could contain a leading
+.QW \-
character.
.SH "APPLICATION NAMES"
@@ -85,16 +86,14 @@ list of enabled hosts is empty.
This means that applications cannot connect to your server unless
they use some other form of authorization
such as that provide by \fBxauth\fR.
-.VS
Under Windows, \fBsend\fR is currently disabled. Most of the
functionality is provided by the \fBdde\fR command instead.
-.VE
.SH EXAMPLE
This script fragment can be used to make an application that only runs
once on a particular display.
.CS
if {[tk appname FoobarApp] ne "FoobarApp"} {
- \fBsend\fR -async FoobarApp RemoteStart $argv
+ \fBsend\fR \-async FoobarApp RemoteStart $argv
exit
}
# The command that will be called remotely, which raises
@@ -107,6 +106,4 @@ proc RemoteStart args {
}
.CE
.SH KEYWORDS
-.VS
application, dde, name, remote execution, security, send
-.VE
diff --git a/doc/spinbox.n b/doc/spinbox.n
index 700f001..dc98251 100644
--- a/doc/spinbox.n
+++ b/doc/spinbox.n
@@ -78,7 +78,7 @@ contents of the widget may still be selected. If the spinbox is
disabled, the value may not be changed, no insertion cursor will be
displayed, the contents will not be selectable, and the spinbox may
be displayed in a different color, depending on the values of the
-\fB-disabledforeground\fR and \fB-disabledbackground\fR options.
+\fB\-disabledforeground\fR and \fB\-disabledbackground\fR options.
.OP \-to to To
A floating-point value corresponding to the highest value for the spinbox,
to be used in conjunction with \fB\-from\fR and \fB\-increment\fR. When
@@ -112,7 +112,6 @@ size just large enough to hold its current text.
Must be a proper boolean value. If on, the spinbox will wrap around the
values of data in the widget.
.BE
-
.SH DESCRIPTION
.PP
The \fBspinbox\fR command creates a new window (given by the
@@ -145,7 +144,6 @@ may be used to change the view in the window. Spinboxes use
the standard \fBxScrollCommand\fR mechanism for interacting with
scrollbars (see the description of the \fBxScrollCommand\fR option
for details). They also support scanning, as described below.
-
.SH VALIDATION
.PP
Validation works by setting the \fBvalidateCommand\fR
@@ -172,9 +170,9 @@ following substitutions are recognized:
.PP
.IP \fB%d\fR 5
Type of action: 1 for \fBinsert\fR, 0 for \fBdelete\fR,
-or -1 for focus, forced or textvariable validation.
+or \-1 for focus, forced or textvariable validation.
.IP \fB%i\fR 5
-Index of char string to be inserted/deleted, if any, otherwise -1.
+Index of char string to be inserted/deleted, if any, otherwise \-1.
.IP \fB%P\fR 5
The value of the spinbox should edition occur. If you are configuring the
spinbox widget to have a new textvariable, this will be the value of that
@@ -212,13 +210,12 @@ validated. If you wish to edit the value of the widget
during validation and still have the \fBvalidate\fR option set, you should
include the command
.CS
- \fI%W config -validate %v\fR
+ \fI%W config \-validate %v\fR
.CE
in the \fBvalidateCommand\fR or \fBinvalidCommand\fR (whichever one you
were editing the spinbox widget from). It is also recommended to not set an
associated \fBtextVariable\fR during validation, as that can cause the
spinbox widget to become out of sync with the \fBtextVariable\fR.
-
.SH "WIDGET COMMAND"
.PP
The \fBspinbox\fR command creates a new Tcl command whose
@@ -229,6 +226,7 @@ operations on the widget. It has the following general form:
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
+.SS INDICES
.PP
Many of the widget commands for spinboxes take one or more indices as
arguments. An index specifies a particular character in the spinbox's
@@ -253,22 +251,27 @@ insertion cursor.
.TP 12
\fBsel.first\fR
Indicates the first character in the selection. It is an error to
-use this form if the selection isn't in the spinbox window.
+use this form if the selection is not in the spinbox window.
.TP 12
\fBsel.last\fR
Indicates the character just after the last one in the selection.
-It is an error to use this form if the selection isn't in the
+It is an error to use this form if the selection is not in the
spinbox window.
.TP 12
\fB@\fInumber\fR
In this form, \fInumber\fR is treated as an x-coordinate in the
spinbox's window; the character spanning that x-coordinate is used.
-For example, ``\fB@0\fR'' indicates the left-most character in the
-window.
+For example,
+.QW \fB@0\fR
+indicates the left-most character in the window.
.LP
-Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR''
-or ``\fBsel.f\fR''. In general, out-of-range indices are automatically
-rounded to the nearest legal value.
+Abbreviations may be used for any of the forms above, e.g.
+.QW \fBe\fR
+or
+.QW \fBsel.f\fR .
+In general, out-of-range indices are automatically rounded to the
+nearest legal value.
+.SS SUBCOMMANDS
.PP
The following commands are possible for spinbox widgets:
.TP
@@ -307,7 +310,7 @@ Delete one or more elements of the spinbox.
\fIFirst\fR is the index of the first character to delete, and
\fIlast\fR is the index of the character just after the last
one to delete.
-If \fIlast\fR isn't specified it defaults to \fIfirst\fR+1,
+If \fIlast\fR is not specified it defaults to \fIfirst\fR+1,
i.e. a single character is deleted.
This command returns an empty string.
.TP
@@ -366,14 +369,14 @@ Locate the end of the selection nearest to the character given by
(i.e. including but not going beyond \fIindex\fR). The other
end of the selection is made the anchor point for future
\fBselect to\fR commands. If the selection
-isn't currently in the spinbox, then a new selection is created to
+is not currently in the spinbox, then a new selection is created to
include the characters between \fIindex\fR and the most recent
selection anchor point, inclusive.
Returns an empty string.
.TP
\fIpathName \fBselection clear\fR
Clear the selection if it is currently in this widget. If the
-selection isn't in this widget then the command has no effect.
+selection is not in this widget then the command has no effect.
Returns an empty string.
.TP
\fIpathName \fBselection element\fR ?\fIelement\fR?
@@ -382,7 +385,7 @@ is specified, it will be displayed depressed.
.TP
\fIpathName \fBselection from \fIindex\fR
Set the selection anchor point to just before the character
-given by \fIindex\fR. Doesn't change the selection.
+given by \fIindex\fR. Does not change the selection.
Returns an empty string.
.TP
\fIpathName \fBselection present\fR
@@ -406,7 +409,7 @@ to the characters from the anchor point up to but not including
\fIindex\fR.
The anchor point is determined by the most recent \fBselect from\fR
or \fBselect adjust\fR command in this widget.
-If the selection isn't in this widget then a new selection is
+If the selection is not in this widget then a new selection is
created using the most recent anchor point specified for the widget.
Returns an empty string.
.RE
@@ -465,9 +468,11 @@ become visible.
.PP
Tk automatically creates class bindings for spinboxes that give them
the following default behavior.
-In the descriptions below, ``word'' refers to a contiguous group
-of letters, digits, or ``_'' characters, or any single character
-other than these.
+In the descriptions below,
+.QW word
+refers to a contiguous group of letters, digits, or
+.QW _
+characters, or any single character other than these.
.IP [1]
Clicking mouse button 1 positions the insertion cursor
just before the character underneath the mouse cursor, sets the
@@ -528,7 +533,7 @@ Shift-End moves the cursor to the end and extends the selection
to that point.
.IP [12]
The Select key and Control-Space set the selection anchor to the position
-of the insertion cursor. They don't affect the current selection.
+of the insertion cursor. They do not affect the current selection.
Shift-Select and Control-Shift-Space adjust the selection to the
current position of the insertion cursor, selecting from the anchor
to the insertion cursor if there was not any selection previously.
diff --git a/doc/text.n b/doc/text.n
index ac61d41..860bb89 100644
--- a/doc/text.n
+++ b/doc/text.n
@@ -6,7 +6,7 @@
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.so man.macros
-.TH text n 8.4 Tk "Tk Built-In Commands"
+.TH text n 8.5 Tk "Tk Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
@@ -14,11 +14,9 @@ text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate text widget
.SH SYNOPSIS
.nf
\fBtext\fR \fIpathName \fR?\fIoptions\fR?
-.VS 8.4
\fBtk_textCopy\fR \fIpathName\fR
\fBtk_textCut\fR \fIpathName\fR
\fBtk_textPaste\fR \fIpathName\fR
-.VE 8.4
.SO
\-background \-highlightthickness \-relief
\-borderwidth \-insertbackground \-selectbackground
@@ -31,20 +29,37 @@ text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate text widget
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-autoseparators autoSeparators AutoSeparators
-.VS 8.4
Specifies a boolean that says whether separators are automatically
inserted in the undo stack. Only meaningful when the \fB\-undo\fR
option is true.
-.VE 8.4
+.OP \-blockcursor blockCursor BlockCursor
+.VS 8.5
+Specifies a boolean that says whether the blinking insertion cursor
+should be drawn as a character-sized rectangular block. If false
+(the default) a thin vertical line is used for the insertion cursor.
+.VE 8.5
+.OP \-endline endLine EndLine
+.VS 8.5
+Specifies an integer line index representing the last line of the
+underlying textual data store that should be contained in the widget.
+This allows a text widget to reflect only a portion of a larger piece
+of text. Instead of an integer, the empty string can be provided to
+this configuration option, which will configure the widget to end
+at the very last line in the textual data store.
+.VE 8.5
.OP \-height height Height
Specifies the desired height for the window, in units of characters
in the font given by the \fB\-font\fR option.
Must be at least one.
+.OP \-inactiveselectbackground inactiveSelectBackground Foreground
+.VS 8.5
+Specifies the colour to use for the selection (the \fBsel\fR tag) when
+the window does not have the input focus. If empty, \fB{}\fR, then no
+selection is shown when the window does not have the focus.
+.VE 8.5
.OP \-maxundo maxUndo MaxUndo
-.VS 8.4
Specifies the maximum number of compound undo actions on the undo
stack. A zero or a negative value imply an unlimited undo stack.
-.VE 8.4
.OP \-spacing1 spacing1 Spacing1
Requests additional space above each text line in the widget,
using any of the standard forms for screen distances.
@@ -66,6 +81,15 @@ If a line wraps, this option only applies to the last line
on the display.
This option may be overridden with \fB\-spacing3\fR options in
tags.
+.OP \-startline startLine StartLine
+.VS 8.5
+Specifies an integer line index representing the first line of the
+underlying textual data store that should be contained in the widget.
+This allows a text widget to reflect only a portion of a larger piece
+of text. Instead of an integer, the empty string can be provided to
+this configuration option, which will configure the widget to start
+at the very first line in the textual data store.
+.VE 8.5
.OP \-state state State
Specifies one of two states for the text: \fBnormal\fR or \fBdisabled\fR.
If the text is disabled then characters may not be inserted or deleted
@@ -89,36 +113,55 @@ at the tab position; if there is no decimal point then the least
significant digit of the number is positioned just to the left of the
tab position; if there is no number in the text then the text is
right-justified at the tab position.
-For example, \fB\-tabs {2c left 4c 6c center}\fR creates three
-tab stops at two-centimeter intervals; the first two use left
+For example,
+.QW "\fB\-tabs {2c left 4c 6c center}\fR"
+creates three tab stops at two-centimeter intervals; the first two use left
justification and the third uses center justification.
+.RS
+.PP
If the list of tab stops does not have enough elements to cover all
of the tabs in a text line, then Tk extrapolates new tab stops using
the spacing and alignment from the last tab stop in the list. Tab
-distances must be strictly positive, and must always increase from one
+distances must be strictly positive, and must always increase from one
tab stop to the next (if not, an error is thrown).
The value of the \fBtabs\fR option may be overridden by \fB\-tabs\fR
options in tags.
+.PP
If no \fB\-tabs\fR option is specified, or if it is specified as
an empty list, then Tk uses default tabs spaced every eight
-(average size) characters.
+(average size) characters. To achieve a different standard spacing,
+for example every 4 characters, simply configure the widget with
+.QW "\fB\-tabs \N'34'[expr {4 * [font measure $font 0]}] left\N'34' \-tabstyle wordprocessor\fR" .
+.RE
+.OP \-tabstyle tabStyle TabStyle
+Specifies how to interpret the relationship between tab stops on a line
+and tabs in the text of that line. The value must be \fBtabular\fR (the
+default) or \fBwordprocessor\fR. Note that tabs are interpreted as they
+are encountered in the text. If the tab style is \fBtabular\fR then the
+\fIn\fR'th tab character in the line's text will be associated with
+the \fIn\fR'th
+tab stop defined for that line. If the tab character's x coordinate
+falls to the right of the \fIn\fR'th tab stop, then a gap of a single space
+will be inserted as a fallback. If the tab style is \fBwordprocessor\fR
+then any tab character being laid out will use (and be defined by) the
+first tab stop to the right of the preceding characters already laid out
+on that line. The value of the \fBtabstyle\fR option may be overridden
+by \fB\-tabstyle\fR options in tags.
.OP \-undo undo Undo
-.VS 8.4
Specifies a boolean that says whether the undo mechanism is active or
not.
-.VE 8.4
.OP \-width width Width
Specifies the desired width for the window in units of characters
in the font given by the \fB\-font\fR option.
-If the font doesn't have a uniform width then the width of the
-character ``0'' is used in translating from character units to
-screen units.
+If the font does not have a uniform width then the width of the character
+.QW 0
+is used in translating from character units to screen units.
.OP \-wrap wrap Wrap
Specifies how to handle lines in the text that are too long to be
displayed in a single line of the text's window.
The value must be \fBnone\fR or \fBchar\fR or \fBword\fR.
A wrap mode of \fBnone\fR means that each line of text appears as
-exactly one line on the screen; extra characters that don't fit
+exactly one line on the screen; extra characters that do not fit
on the screen are not displayed.
In the other modes each line of text will be broken up into several
screen lines if necessary to keep all the characters visible.
@@ -149,7 +192,8 @@ and mouse button presses occur in particular ranges of the text.
See \fBTAGS\fR below for more details.
.PP
The second form of annotation consists of floating markers in the text
-called "marks".
+called
+.QW marks .
Marks are used to keep track of various interesting positions in the
text as it is edited.
See \fBMARKS\fR below for more details.
@@ -162,10 +206,14 @@ The fourth form of annotation allows Tk images to be embedded in a text
widget.
See \fBEMBEDDED IMAGES\fR below for more details.
.PP
-.VS 8.4
The text widget also has a built-in undo/redo mechanism.
See \fBTHE UNDO MECHANISM\fR below for more details.
-.VE 8.4
+.PP
+.VS 8.5
+The text widget allows for the creation of peer widgets. These are
+other text widgets which share the same underlying data (text, marks,
+tags, images, etc). See \fBPEER WIDGETS\fR below for more details.
+.VE 8.5
.SH INDICES
.PP
Many of the widget commands for texts take one or more indices
@@ -181,6 +229,20 @@ Where \fIbase\fR gives a starting point and the \fImodifier\fRs
adjust the index from the starting point (e.g. move forward or
backward one character). Every index must contain a \fIbase\fR,
but the \fImodifier\fRs are optional.
+.VS 8.5
+Most modifiers (as documented below) allow
+an optional submodifier. Valid submodifiers are \fBany\fR
+and \fBdisplay\fR. If the submodifier is abbreviated, then it must be
+followed by whitespace, but otherwise there need be no space between the
+submodifier and the following \fImodifier\fR. Typically the \fBdisplay\fR
+submodifier adjusts the meaning of the following \fImodifier\fR to make
+it refer to visual or non-elided units rather than logical units, but
+this is explained for each relevant case below. Lastly, where \fIcount\fR
+is used as part of a modifier, it can be positive or negative, so
+.QW "\fIbase\fR \- \-3 lines"
+is perfectly valid (and equivalent to
+.QW "\fIbase\fR +3lines" ).
+.VE 8.5
.PP
The \fIbase\fR for an index must have one of the following forms:
.TP 12
@@ -227,82 +289,163 @@ Indicates the position of the embedded image whose name is
This form generates an error if there is no embedded image
by the given name.
.PP
-If the \fIbase\fP could match more than one of the above forms, such
-as a \fImark\fP and \fIimageName\fP both having the same value, then
+If the \fIbase\fR could match more than one of the above forms, such
+as a \fImark\fR and \fIimageName\fR both having the same value, then
the form earlier in the above list takes precedence.
If modifiers follow the base index, each one of them must have one
of the forms listed below. Keywords such as \fBchars\fR and \fBwordend\fR
may be abbreviated as long as the abbreviation is unambiguous.
.TP
-\fB+ \fIcount\fB chars\fR
-Adjust the index forward by \fIcount\fR characters, moving to later
-lines in the text if necessary. If there are fewer than \fIcount\fR
-characters in the text after the current index, then set the index
-to the last character in the text.
-Spaces on either side of \fIcount\fR are optional.
-.TP
-\fB\- \fIcount\fB chars\fR
+\fB+ \fIcount\fR ?\fIsubmodifier\fR? \fBchars\fR
+.VS 8.5
+Adjust the index forward by \fIcount\fR characters, moving to later lines
+in the text if necessary. If there are fewer than \fIcount\fR characters
+in the text after the current index, then set the index to the last index
+in the text. Spaces on either side of \fIcount\fR are optional. If the
+\fBdisplay\fR submodifier is given, elided characters are skipped over
+without being counted. If \fBany\fR is given, then all characters are
+counted. For historical reasons, if neither modifier is given then the
+count actually takes place in units of index positions (see \fBindices\fR
+for details). This behaviour may be changed in a future major release,
+so if you need an index count, you are encouraged to use \fBindices\fR
+instead wherever possible.
+.VE 8.5
+.TP
+\fB\- \fIcount\fR ?\fIsubmodifier\fR? \fBchars\fR
Adjust the index backward by \fIcount\fR characters, moving to earlier
lines in the text if necessary. If there are fewer than \fIcount\fR
-characters in the text before the current index, then set the index
-to the first character in the text.
-Spaces on either side of \fIcount\fR are optional.
-.TP
-\fB+ \fIcount\fB lines\fR
+characters in the text before the current index, then set the index to
+.VS 8.5
+the first index in the text (1.0). Spaces on either side of \fIcount\fR
+are optional. If the \fBdisplay\fR submodifier is given, elided
+characters are skipped over without being counted. If \fBany\fR is
+given, then all characters are counted. For historical reasons, if
+neither modifier is given then the count actually takes place in units of
+index positions (see \fBindices\fR for details). This behaviour may be
+changed in a future major release, so if you need an index count, you are
+encouraged to use \fBindices\fR instead wherever possible.
+.VE 8.5
+.TP
+\fB+ \fIcount\fR ?\fIsubmodifier\fR? \fBindices\fR
+.VS 8.5
+Adjust the index forward by \fIcount\fR index positions, moving to later
+lines in the text if necessary. If there are fewer than \fIcount\fR
+index positions in the text after the current index, then set the index
+to the last index position in the text. Spaces on either side of
+\fIcount\fR are optional. Note that an index position is either a single
+character or a single embedded image or embedded window. If the
+\fBdisplay\fR submodifier is given, elided indices are skipped over
+without being counted. If \fBany\fR is given, then all indices are
+counted; this is also the default behaviour if no modifier is given.
+.VE 8.5
+.TP
+\fB\- \fIcount\fR ?\fIsubmodifier\fR? \fBindices\fR
+.VS 8.5
+Adjust the index backward by \fIcount\fR index positions, moving to
+earlier lines in the text if necessary. If there are fewer than
+\fIcount\fR index positions in the text before the current index, then
+set the index to the first index position (1.0) in the text. Spaces on
+either side of \fIcount\fR are optional. If the \fBdisplay\fR
+submodifier is given, elided indices are skipped over without being
+counted. If \fBany\fR is given, then all indices are counted; this is
+also the default behaviour if no modifier is given.
+.VE 8.5
+.TP
+\fB+ \fIcount\fR ?\fIsubmodifier\fR? \fBlines\fR
+.VS 8.5
Adjust the index forward by \fIcount\fR lines, retaining the same
character position within the line. If there are fewer than \fIcount\fR
-lines after the line containing the current index, then set the index
-to refer to the same character position on the last line of the text.
-Then, if the line is not long enough to contain a character at the indicated
+lines after the line containing the current index, then set the index to
+refer to the same character position on the last line of the text. Then,
+if the line is not long enough to contain a character at the indicated
character position, adjust the character position to refer to the last
-character of the line (the newline).
-Spaces on either side of \fIcount\fR are optional.
-.TP
-\fB\- \fIcount\fB lines\fR
-Adjust the index backward by \fIcount\fR lines, retaining the same
-character position within the line. If there are fewer than \fIcount\fR
-lines before the line containing the current index, then set the index
-to refer to the same character position on the first line of the text.
-Then, if the line is not long enough to contain a character at the indicated
-character position, adjust the character position to refer to the last
-character of the line (the newline).
-Spaces on either side of \fIcount\fR are optional.
-.TP
-\fBlinestart\fR
-Adjust the index to refer to the first character on the line.
-.TP
-\fBlineend\fR
-Adjust the index to refer to the last character on the line (the newline).
-.TP
-\fBwordstart\fR
+character of the line (the newline). Spaces on either side of
+\fIcount\fR are optional. If the \fBdisplay\fR submodifier is given,
+then each visual display line is counted separately. Otherwise, if
+\fBany\fR (or no modifier) is given, then each logical line (no matter
+how many times it is visually wrapped) counts just once. If the relevant
+lines are not wrapped, then these two methods of counting are equivalent.
+.VE 8.5
+.TP
+\fB\- \fIcount\fR ?\fIsubmodifier\fR? \fBlines\fR
+.VS 8.5
+Adjust the index backward by \fIcount\fR logical lines, retaining the
+same character position within the line. If there are fewer than
+\fIcount\fR lines before the line containing the current index, then set
+the index to refer to the same character position on the first line of
+the text. Then, if the line is not long enough to contain a character at
+the indicated character position, adjust the character position to refer
+to the last character of the line (the newline). Spaces on either side
+of \fIcount\fR are optional. If the \fBdisplay\fR submodifier is given,
+then each visual display line is counted separately. Otherwise, if
+\fBany\fR (or no modifier) is given, then each logical line (no matter
+how many times it is visually wrapped) counts just once. If the relevant
+lines are not wrapped, then these two methods of counting are equivalent.
+.VE 8.5
+.TP
+?\fIsubmodifier\fR? \fBlinestart\fR
+.VS 8.5
+Adjust the index to refer to the first index on the line. If the
+\fBdisplay\fR submodifier is given, this is the first index on the
+display line, otherwise on the logical line.
+.VE 8.5
+.TP
+?\fIsubmodifier\fR? \fBlineend\fR
+.VS 8.5
+Adjust the index to refer to the last index on the line (the
+newline). If the \fBdisplay\fR submodifier is given, this is the last
+index on the display line, otherwise on the logical line.
+.VE 8.5
+.TP
+?\fIsubmodifier\fR? \fBwordstart\fR
+.VS 8.5
Adjust the index to refer to the first character of the word containing
the current index. A word consists of any number of adjacent characters
-that are letters, digits, or underscores, or a single character that
-is not one of these.
-.TP
-\fBwordend\fR
+that are letters, digits, or underscores, or a single character that is
+not one of these. If the \fBdisplay\fR submodifier is given, this only
+examines non-elided characters, otherwise all characters (elided or not)
+are examined.
+.VE 8.5
+.TP
+?\fIsubmodifier\fR? \fBwordend\fR
+.VS 8.5
Adjust the index to refer to the character just after the last one of the
-word containing the current index. If the current index refers to the last
-character of the text then it is not modified.
+word containing the current index. If the current index refers to the
+last character of the text then it is not modified. If the \fBdisplay\fR
+submodifier is given, this only examines non-elided characters, otherwise
+all characters (elided or not) are examined.
.PP
If more than one modifier is present then they are applied in
-left-to-right order. For example, the index ``\fBend \- 1 chars\fR''
+left-to-right order. For example, the index
+.QW "\fBend \- 1 chars\fR"
refers to the next-to-last character in the text and
-``\fBinsert wordstart \- 1 c\fR'' refers to the character just before
+.QW "\fBinsert wordstart \- 1 c\fR"
+refers to the character just before
the first one in the word containing the insertion cursor. Modifiers
are applied one by one in this left to right order, and after each step
-the resulting index is constrained to be a valid index in the text
-widget. So, for example, the index ``\fB1.0 -1c +1c\fR'' refers to the
-index ``\fB2.0\fR''.
+the resulting index is constrained to be a valid index in the text
+widget. So, for example, the index
+.QW "\fB1.0 \-1c +1c\fR"
+refers to the index
+.QW \fB2.0\fR .
+.PP
+Where modifiers result in index changes by display lines, display chars
+or display indices, and the \fIbase\fR refers to an index inside an
+elided tag,
+that base index is considered to be equivalent to the first following
+non-elided index.
+.VE 8.5
.SH TAGS
.PP
The first form of annotation in text widgets is a tag.
A tag is a textual string that is associated with some of the characters
in a text.
Tags may contain arbitrary characters, but it is probably best to
-avoid using the characters `` '' (space), \fB+\fR, or \fB\-\fR:
+avoid using the characters
+.QW " "
+(space), \fB+\fR, or \fB\-\fR:
these characters have special meaning in indices, so tags containing
-them can't be used as indices.
+them cannot be used as indices.
There may be any number of tags associated with characters in a
text.
Each tag may refer to a single character, a range of characters, or
@@ -315,16 +458,20 @@ When a tag is defined (by associating it with characters or setting
its display options or binding commands to it), it is given
a priority higher than any existing tag.
The priority order of tags may be redefined using the
-``\fIpathName \fBtag raise\fR'' and ``\fIpathName \fBtag lower\fR''
+.QW "\fIpathName \fBtag raise\fR"
+and
+.QW "\fIpathName \fBtag lower\fR"
widget commands.
.PP
Tags serve three purposes in text widgets.
First, they control the way information is displayed on the screen.
By default, characters are displayed as determined by the
-\fBbackground\fR, \fBfont\fR, and \fBforeground\fR options for the
+\fB\-background\fR, \fB\-font\fR, and \fB\-foreground\fR options for the
text widget.
However, display options may be associated with individual tags
-using the ``\fIpathName \fBtag configure\fR'' widget command.
+using the
+.QW "\fIpathName \fBtag configure\fR"
+widget command.
If a character has been tagged, then the display options associated
with the tag override the default display style.
The following options are currently supported for tags:
@@ -338,7 +485,7 @@ It may have any of the forms accepted by \fBTk_GetColor\fR.
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern
for the background.
It may have any of the forms accepted by \fBTk_GetBitmap\fR.
-If \fIbitmap\fR hasn't been specified, or if it is specified
+If \fIbitmap\fR has not been specified, or if it is specified
as an empty string, then a solid fill will be used for the
background.
.TP
@@ -352,16 +499,17 @@ it is ignored unless the \fB\-background\fR option
has been set for the tag.
.TP
\fB\-elide \fIboolean\fR
-\fIElide\fR specifies whether the data should be elided.
-Elided data is not displayed and takes no space on screen, but further
-on behaves just as normal data.
+\fIElide\fR specifies whether the data should
+be elided. Elided data (characters, images, embedded windows, etc) is
+not displayed and takes no space on screen, but further on behaves just
+as normal data.
.TP
\fB\-fgstipple \fIbitmap\fR
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern
when drawing text and other foreground information such as
underlines.
It may have any of the forms accepted by \fBTk_GetBitmap\fR.
-If \fIbitmap\fR hasn't been specified, or if it is specified
+If \fIbitmap\fR has not been specified, or if it is specified
as an empty string, then a solid fill will be used.
.TP
\fB\-font \fIfontName\fR
@@ -374,15 +522,15 @@ foreground information such as underlines.
It may have any of the forms accepted by \fBTk_GetColor\fR.
.TP
\fB\-justify \fIjustify\fR
-If the first character of a display line has a tag for which this
+If the first non-elided character of a display line has a tag for which this
option has been specified, then \fIjustify\fR determines how to
justify the line.
It must be one of \fBleft\fR, \fBright\fR, or \fBcenter\fR.
If a line wraps, then the justification for each line on the
-display is determined by the first character of that display line.
+display is determined by the first non-elided character of that display line.
.TP
\fB\-lmargin1 \fIpixels\fR
-If the first character of a text line has a tag for which this
+If the first non-elided character of a text line has a tag for which this
option has been specified, then \fIpixels\fR specifies how
much the line should be indented from the left edge of the
window.
@@ -393,7 +541,7 @@ first line on the display; the \fB\-lmargin2\fR option controls
the indentation for subsequent lines.
.TP
\fB\-lmargin2 \fIpixels\fR
-If the first character of a display line has a tag for which this
+If the first non-elided character of a display line has a tag for which this
option has been specified, and if the display line is not the
first for its text line (i.e., the text line has wrapped), then
\fIpixels\fR specifies how much the line should be indented from
@@ -426,7 +574,7 @@ it is ignored unless the \fB\-background\fR option
has been set for the tag.
.TP
\fB\-rmargin \fIpixels\fR
-If the first character of a display line has a tag for which this
+If the first non-elided character of a display line has a tag for which this
option has been specified, then \fIpixels\fR specifies how wide
a margin to leave between the end of the line and the right
edge of the window.
@@ -434,7 +582,7 @@ edge of the window.
distances.
This option is only used when wrapping is enabled.
If a text line wraps, the right margin for each line on the
-display is determined by the first character of that display
+display is determined by the first non-elided character of that display
line.
.TP
\fB\-spacing1 \fIpixels\fR
@@ -461,14 +609,22 @@ line on the display.
\fITabList\fR specifies a set of tab stops in the same form
as for the \fB\-tabs\fR option for the text widget. This
option only applies to a display line if it applies to the
-first character on that display line.
+first non-elided character on that display line.
If this option is specified as an empty string, it cancels
the option, leaving it unspecified for the tag (the default).
If the option is specified as a non-empty string that is
an empty list, such as \fB\-tags\0{\0}\fR, then it requests
-default 8-character tabs as described for the \fBtags\fR
+default 8-character tabs as described for the \fB\-tags\fR
widget option.
.TP
+\fB\-tabstyle \fIstyle\fR
+\fIStyle\fR specifies either the \fItabular\fR or
+\fIwordprocessor\fR style of tabbing to use for the text widget.
+This option only applies to a display line if it applies to the
+first non-elided character on that display line.
+If this option is specified as an empty string, it cancels
+the option, leaving it unspecified for the tag (the default).
+.TP
\fB\-underline \fIboolean\fR
\fIBoolean\fR specifies whether or not to draw an underline underneath
characters.
@@ -485,7 +641,7 @@ for the text widget.
If a character has several tags associated with it, and if their
display options conflict, then the options of the highest priority
tag are used.
-If a particular display option hasn't been specified for a
+If a particular display option has not been specified for a
particular tag, or if it is specified as an empty string, then
that option will never be used; the next-highest-priority
tag's option will used instead.
@@ -500,17 +656,29 @@ Tcl command will be executed.
Tag bindings can be used to give behaviors to ranges of characters;
among other things, this allows hypertext-like
features to be implemented.
-For details, see the description of the \fBtag bind\fR widget
-command below.
+For details, see the description of the
+.QW "\fIpathName \fBtag bind\fR"
+widget command below.
+.VS 8.5
+Tag bindings are shared between all peer widgets
+(including any bindings for the special \fBsel\fR tag).
+.VE 8.5
.PP
The third use for tags is in managing the selection.
See \fBTHE SELECTION\fR below.
+.VS 8.5
+With the exception of the special \fBsel\fR
+tag, all tags are shared between peer text widgets, and may be
+manipulated on an equal basis from any such widget. The \fBsel\fR
+tag exists separately and independently in each peer text widget (but
+any tag bindings to \fBsel\fR are shared).
+.VE 8.5
.SH MARKS
.PP
The second form of annotation in text widgets is a mark.
Marks are used for remembering particular places in a text.
They are something like tags, in that they have names and
-they refer to places in the file, but a mark isn't associated
+they refer to places in the file, but a mark is not associated
with particular characters.
Instead, a mark is associated with the gap between two characters.
Only a single position may be associated with a mark at any given
@@ -520,12 +688,15 @@ remain; it will just have new neighbor characters.
In contrast, if the characters containing a tag are deleted then
the tag will no longer have an association with characters in
the file.
-Marks may be manipulated with the ``\fIpathName \fBmark\fR'' widget
+Marks may be manipulated with the
+.QW "\fIpathName \fBmark\fR"
+widget
command, and their current locations may be determined by using the
mark name as an index in widget commands.
.PP
-Each mark also has a "gravity", which is either \fBleft\fR or
-\fBright\fR.
+Each mark also has a
+.QW gravity ,
+which is either \fBleft\fR or \fBright\fR.
The gravity for a mark specifies what happens to the mark when
text is inserted at the point of the mark.
If a mark has left gravity, then the mark is treated as if it
@@ -549,6 +720,11 @@ exception: \fBcurrent\fR is not updated in response to mouse
motions if a mouse button is down; the update will be deferred
until all mouse buttons have been released).
Neither of these special marks may be deleted.
+.VS 8.5
+With the exception of
+these two special marks, all marks are shared between peer text
+widgets, and may be manipulated on an equal basis from any peer.
+.VE 8.5
.SH "EMBEDDED WINDOWS"
.PP
The third form of annotation in text widgets is an embedded window.
@@ -562,17 +738,25 @@ parent).
The embedded window's position on the screen will be updated as the
text is modified or scrolled, and it will be mapped and unmapped as
it moves into and out of the visible area of the text widget.
-Each embedded window occupies one character's worth of index space
+Each embedded window occupies one
+.VS 8.5
+unit's
+.VE 8.5
+worth of index space
in the text widget, and it may be referred to either by the name
of its embedded window or by its position in the widget's
index space.
If the range of text containing the embedded window is deleted then
the window is destroyed.
+.VS 8.5
+Similarly if the text widget as a whole is deleted, then the window is
+destroyed.
+.VE 8.5
.PP
When an embedded window is added to a text widget with the
-\fBwindow create\fR widget command, several configuration
+\fIpathName \fBwindow create\fR widget command, several configuration
options may be associated with it.
-These options may be modified later with the \fBwindow configure\fR
+These options may be modified later with the \fIpathName \fBwindow configure\fR
widget command.
The following options are currently supported:
.TP
@@ -594,6 +778,11 @@ this script will be evaluated when the annotation is about to
be displayed on the screen.
\fIScript\fR must create a window for the annotation and return
the name of that window as its result.
+.VS 8.5
+Two substitutions will be performed in \fIscript\fR before evaluation.
+\fI%W\fR will be substituted by the name of the parent text widget,
+and \fI%%\fR will be substituted by a single \fI%\fR.
+.VE 8.5
If the annotation's window should ever be deleted, \fIscript\fR
will be evaluated again the next time the annotation is displayed.
.TP
@@ -618,6 +807,14 @@ stretched.
.TP
\fB\-window \fIpathName\fR
Specifies the name of a window to display in the annotation.
+.VS 8.5
+Note that if a \fIpathName\fR has been set, then later configuring a
+window to the empty string will not delete the widget corresponding to
+the old \fIpathName\fR. Rather it will remove the association between
+the old \fIpathName\fR and the text widget. If multiple peer widgets
+are in use, it is usually simpler to use the \fB\-create\fR option if
+embedded windows are desired in each peer.
+.VE 8.5
.SH "EMBEDDED IMAGES"
.PP
The final form of annotation in text widgets is an embedded image.
@@ -628,30 +825,34 @@ and a particular image may be embedded in multiple places in the same
text widget.
The embedded image's position on the screen will be updated as the
text is modified or scrolled.
-Each embedded image occupies one character's worth of index space
+Each embedded image occupies one
+.VS 8.5
+unit's
+.VE 8.5
+worth of index space
in the text widget, and it may be referred to either by
its position in the widget's index space, or the name it is assigned
-when the image is inserted into the text widget with \fBimage create\fP.
+when the image is inserted into the text widget with \fIpathName \fBimage create\fR.
If the range of text containing the embedded image is deleted then
that copy of the image is removed from the screen.
.PP
-When an embedded image is added to a text widget with the \fBimage
+When an embedded image is added to a text widget with the \fIpathName \fBimage
create\fR widget command, a name unique to this instance of the image
is returned. This name may then be used to refer to this image
-instance. The name is taken to be the value of the \fB\-name\fP option
-(described below). If the \fB\-name\fP option is not provided, the
-\fB\-image\fP name is used instead. If the \fIimageName\fP is already
+instance. The name is taken to be the value of the \fB\-name\fR option
+(described below). If the \fB\-name\fR option is not provided, the
+\fB\-image\fR name is used instead. If the \fIimageName\fR is already
in use in the text widget, then \fB#\fInn\fR is added to the end of the
-\fIimageName\fP, where \fInn\fP is an arbitrary integer. This insures
-the \fIimageName\fP is unique.
-Once this name is assigned to this instance of the image, it does not
-change, even though the \fB\-image\fP or \fB\-name\fP values can be changed
-with \fBimage configure\fP.
+\fIimageName\fR, where \fInn\fR is an arbitrary integer. This insures
+the \fIimageName\fR is unique.
+Once this name is assigned to this instance of the image, it does not
+change, even though the \fB\-image\fR or \fB\-name\fR values can be changed
+with \fIpathName \fBimage configure\fR.
.PP
When an embedded image is added to a text widget with the
-\fBimage create\fR widget command, several configuration
+\fIpathName \fBimage create\fR widget command, several configuration
options may be associated with it.
-These options may be modified later with the \fBimage configure\fR
+These options may be modified later with the \fIpathName \fBimage configure\fR
widget command.
The following options are currently supported:
.TP
@@ -667,13 +868,13 @@ of the line).
.TP
\fB\-image \fIimage\fR
Specifies the name of the Tk image to display in the annotation.
-If \fIimage\fP is not a valid Tk image, then an error is returned.
+If \fIimage\fR is not a valid Tk image, then an error is returned.
.TP
\fB\-name \fIImageName\fR
Specifies the name by which this image instance may be referenced in
-the text widget. If \fIImageName\fP is not supplied, then the
+the text widget. If \fIImageName\fR is not supplied, then the
name of the Tk image is used instead.
-If the \fIimageName\fP is already in use, \fI#nn\fP is appended to
+If the \fIimageName\fR is already in use, \fI#nn\fR is appended to
the end of the name as described above.
.TP
\fB\-padx \fIpixels\fR
@@ -702,23 +903,35 @@ If the selection is claimed away by another application or by another
window within this application, then the \fBsel\fR tag will be removed
from all characters in the text.
.IP [4]
-Whenever the \fBsel\fR tag range changes a virtual event
+Whenever the \fBsel\fR tag range changes a virtual event
\fB<<Selection>>\fR is generated.
.PP
The \fBsel\fR tag is automatically defined when a text widget is
-created, and it may not be deleted with the ``\fIpathName \fBtag delete\fR''
+created, and it may not be deleted with the
+.QW "\fIpathName \fBtag delete\fR"
widget command. Furthermore, the \fBselectBackground\fR,
\fBselectBorderWidth\fR, and \fBselectForeground\fR options for
the text widget are tied to the \fB\-background\fR,
\fB\-borderwidth\fR, and \fB\-foreground\fR options for the \fBsel\fR
tag: changes in either will automatically be reflected in the
other.
+.VS 8.5
+Also the
+\fB\-inactiveselectbackground\fR option for the text widget is used
+instead of \fB\-selectbackground\fR when the text widget does not have
+the focus. This allows programmatic control over the visualization of
+the \fBsel\fR tag for foreground and background windows, or to have
+\fBsel\fR not shown at all (when \fB\-inactiveselectbackground\fR is
+empty) for background windows. Each peer text widget has its own
+\fBsel\fR tag which can be separately configured and set.
+.VE 8.5
.SH "THE INSERTION CURSOR"
.PP
The mark named \fBinsert\fR has special significance in text widgets.
It is defined automatically when a text widget is created and it
-may not be unset with the ``\fIpathName \fBmark unset\fR'' widget
-command.
+may not be unset with the
+.QW "\fIpathName \fBmark unset\fR"
+widget command.
The \fBinsert\fR mark represents the position of the insertion
cursor, and the insertion cursor will automatically be drawn at
this point whenever the text widget has the input focus.
@@ -726,17 +939,18 @@ this point whenever the text widget has the input focus.
The text widget can keep track of changes to the content of the widget
by means of the modified flag. Inserting or deleting text will set
this flag. The flag can be queried, set and cleared programmatically
-as well. Whenever the flag changes state a \fB<<Modified>>\fR virtual
-event is generated. See the \fBedit modified\fR widget command for
+as well. Whenever the flag changes state a \fB<<Modified>>\fR virtual
+event is generated. See the \fIpathName \fBedit modified\fR widget command for
more details.
.SH "THE UNDO MECHANISM"
.PP
-.VS 8.4
The text widget has an unlimited undo and redo mechanism (when the
\fB\-undo\fR widget option is true) which records every insert and
delete action on a stack.
.PP
-Boundaries (called "separators") are inserted between edit actions. The
+Boundaries (called
+.QW separators )
+are inserted between edit actions. The
purpose of these separators is to group inserts, deletes and replaces
into one compound edit action. When undoing a change everything between
two separators will be undone. The undone changes are then moved to the
@@ -757,9 +971,70 @@ automatically to the appropriate state. This automatic coupling
does not work when the modified flag has been set by the user, until
the flag has been reset again.
.PP
-See below for the \fBedit\fR widget command that controls the undo
+See below for the \fIpathName \fBedit\fR widget command that controls the undo
mechanism.
-.VE 8.4
+.SH "PEER WIDGETS"
+.PP
+.VS 8.5
+The text widget has a separate store of all its data concerning each
+line's textual contents, marks, tags, images and windows, and the undo
+stack.
+.PP
+While this data store cannot be accessed directly (i.e. without a text
+widget as an intermediary), multiple text widgets can be created, each
+of which present different views on the same underlying data. Such
+text widgets are known as peer text widgets.
+.PP
+As text is added, deleted, edited and coloured in any one widget, and as
+images, marks, tags are adjusted, all such changes will be reflected in
+all peers.
+.PP
+All data and markup is shared, except for a few small details. First,
+the \fBsel\fR tag may be set and configured (in its display style)
+differently for each peer. Second, each peer has its own \fBinsert\fR
+and \fBcurrent\fR mark positions (but all other marks are shared).
+Third, embedded windows, which are arbitrary other widgets, cannot be
+shared between peers. This means the \fB\-window\fR option of embedded
+windows is independently set for each peer (it is advisable to use
+the \fB\-create\fR script capabilities to allow each peer to create its
+own embedded windows as needed). Fourth, all of the configuration
+options of each peer (e.g. \fB\-font\fR, etc) can be set independently,
+with the exception of \fB\-undo\fR, \fB\-maxUndo\fR, \fB\-autoSeparators\fR
+(i.e. all undo, redo and modified state issues are shared).
+.PP
+Finally any single peer need not contain all lines from the underlying
+data store. When creating a peer, a contiguous range of lines (e.g.
+only lines 52 through 125) may be specified. This allows a peer to
+contain just a small portion of the overall text. The range of lines
+will expand and contract as text is inserted or deleted. The peer will
+only ever display complete lines of text (one cannot share just part of
+a line). If the peer's contents contracts to nothing (i.e. all complete
+lines in the peer widget have been deleted from another widget), then it
+is impossible for new lines to be inserted. The peer will simply become
+an empty shell on which the background can be configured, but which will
+never show any content (without manual reconfiguration of the start and
+end lines). Note that a peer which does not contain all of the
+underlying data store still has indices numbered from
+.QW 1.0
+to
+.QW end .
+It is simply that those indices reflect a subset of the total data, and
+data outside the contained range is not accessible to the peer. This
+means that the command \fIpeerName \fBindex end\fR may return quite different
+values in different peers. Similarly, commands like \fIpeerName \fBtag
+ranges\fR will not return index ranges outside that which is meaningful
+to the peer. The configuration options \fB\-startline\fR and
+\fB\-endline\fR may be used to control how much of the underlying data is
+contained in any given text widget.
+.PP
+Note that peers are really peers. Deleting the
+.QW original
+text widget will not cause any other peers to be deleted, or otherwise
+affected.
+.PP
+See below for the \fIpathName \fBpeer\fR widget command that controls the
+creation of peer widgets.
+.VE 8.5
.SH "WIDGET COMMAND"
.PP
The \fBtext\fR command creates a new Tcl command whose
@@ -795,7 +1070,7 @@ command.
\fIpathName \fBcompare\fR \fIindex1 op index2\fR
Compares the indices given by \fIindex1\fR and \fIindex2\fR according
to the relational operator given by \fIop\fR, and returns 1 if
-the relationship is satisfied and 0 if it isn't.
+the relationship is satisfied and 0 if it is not.
\fIOp\fR must be one of the operators <, <=, ==, >=, >, or !=.
If \fIop\fR is == then 1 is returned if the two indices refer to
the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR
@@ -815,6 +1090,74 @@ modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBtext\fR
command.
+.VS 8.5
+.TP
+\fIpathName \fBcount\fR \fI?options\fR? \fIindex1 index2\fR
+Counts the number of relevant things between the two indices.
+If \fIindex1\fR is after \fIindex2\fR, the result will be a negative number
+(and this holds for each of the possible options).
+The actual items which are counted depend on the
+options given. The result is a list of integers, one for the result of
+each counting option given. Valid counting options are \fB\-chars\fR,
+\fB\-displaychars\fR, \fB\-displayindices\fR, \fB\-displaylines\fR,
+\fB\-indices\fR, \fB\-lines\fR, \fB\-xpixels\fR and \fB\-ypixels\fR. The
+default value, if no option is specified, is \fB\-indices\fR. There is an
+additional possible option \fB\-update\fR which is a modifier. If given,
+then all subsequent options ensure that any possible out of date
+information is recalculated. This currently only has any effect for the
+\fI\-ypixels\fR count (which, if \fB\-update\fR is not given, will use the text
+widget's current cached value for each line). The count options are
+interpreted as follows:
+.RS
+.IP \fB\-chars\fR
+count all characters, whether elided or not. Do not count
+embedded windows or images.
+.IP \fB\-displaychars\fR
+count all non-elided characters.
+.IP \fB\-displayindices\fR
+count all non-elided characters, windows and images.
+.IP \fB\-displaylines\fR
+count all display lines (i.e. counting one for each
+time a line wraps) from the line of the first index up to, but not
+including the display line of the second index. Therefore if they are
+both on the same display line, zero will be returned. By definition
+displaylines are visible and therefore this only counts portions of
+actual visible lines.
+.IP \fB\-indices\fR
+count all characters and embedded windows or images (i.e.
+everything which counts in text-widget index space), whether they are
+elided or not.
+.IP \fB\-lines\fR
+count all logical lines (irrespective of wrapping) from
+the line of the first index up to, but not including the line of the
+second index. Therefore if they are both on the same line, zero will be
+returned. Logical lines are counted whether they are currently visible
+(non-elided) or not.
+.IP \fB\-xpixels\fR
+count the number of horizontal pixels from the first
+pixel of the first index to (but not including) the first pixel of the
+second index. To count the total desired width of the text widget
+(assuming wrapping is not enabled), first find the longest line and then
+use
+.QW ".text count \-xpixels \N'34'${line}.0\N'34' \N'34'${line}.0 lineend\N'34'" .
+.IP \fB\-ypixels\fR
+count the number of vertical pixels from the first pixel
+of the first index to (but not including) the first pixel of the second
+index. If both indices are on the same display line, zero will be
+returned. To count the total number of vertical pixels in the text
+widget, use
+.QW ".text count \-ypixels 1.0 end" ,
+and to ensure this is up to date, use
+.QW ".text count \-update \-ypixels 1.0 end" .
+.PP
+The command returns a positive or negative integer corresponding to the
+number of items counted between the two indices. One such integer is
+returned for each counting option given, so a list is returned if more
+than one option was supplied. For example
+.QW ".text count \-xpixels \-ypixels 1.3 4.5"
+is perfectly valid and will return a list of two elements.
+.RE
+.VE 8.5
.TP
\fIpathName \fBdebug \fR?\fIboolean\fR?
If \fIboolean\fR is specified, then it must have one of the true or
@@ -830,13 +1173,13 @@ There is a single debugging switch shared by all text widgets: turning
debugging on or off in any widget turns it on or off for all widgets.
For widgets with large amounts of text, the consistency checks may
cause a noticeable slow-down.
+.RS
.PP
-.VS 8.4
When debugging is turned on, the drawing routines of the text widget
set the global variables \fBtk_textRedraw\fR and \fBtk_textRelayout\fR
to the lists of indices that are redrawn. The values of these variables
are tested by Tk's test suite.
-.VE 8.4
+.RE
.TP
\fIpathName \fBdelete \fIindex1 \fR?\fIindex2 ...\fR?
Delete a range of characters from the text.
@@ -844,23 +1187,21 @@ If both \fIindex1\fR and \fIindex2\fR are specified, then delete
all the characters starting with the one given by \fIindex1\fR
and stopping just before \fIindex2\fR (i.e. the character at
\fIindex2\fR is not deleted).
-If \fIindex2\fR doesn't specify a position later in the text
+If \fIindex2\fR does not specify a position later in the text
than \fIindex1\fR then no characters are deleted.
-If \fIindex2\fR isn't specified then the single character at
+If \fIindex2\fR is not specified then the single character at
\fIindex1\fR is deleted.
It is not allowable to delete characters in a way that would leave
the text without a newline as the last character.
The command returns an empty string.
-.VS 8.4
If more indices are given, multiple ranges of text will be deleted.
All indices are first checked for validity before any deletions are made.
They are sorted and the text is removed from the last range to the
-first range to deleted text does not cause an undesired index shifting
+first range so deleted text does not cause an undesired index shifting
side-effects. If multiple ranges with the same start index are given,
then the longest range is used. If overlapping ranges are given, then
they will be merged into spans that do not cause deletion of text
outside the given ranges due to text shifted during deletion.
-.VE 8.4
.TP
\fIpathName \fBdlineinfo \fIindex\fR
Returns a list with five elements describing the area occupied
@@ -893,10 +1234,10 @@ in the following format:
.RS
\fIkey1 value1 index1 key2 value2 index2\fR ...
.LP
-The possible \fIkey\fP values are \fBtext\fP, \fBmark\fP,
-\fBtagon\fP, \fBtagoff\fP, \fBimage\fP, and \fBwindow\fP. The corresponding
-\fIvalue\fP is the text, mark name, tag name, image name, or window name.
-The \fIindex\fP information is the index of the
+The possible \fIkey\fR values are \fBtext\fR, \fBmark\fR,
+\fBtagon\fR, \fBtagoff\fR, \fBimage\fR, and \fBwindow\fR. The corresponding
+\fIvalue\fR is the text, mark name, tag name, image name, or window name.
+The \fIindex\fR information is the index of the
start of the text, mark, tag transition, image or window.
One or more of the following switches (or abbreviations thereof)
may be specified to control the dump:
@@ -909,7 +1250,7 @@ This is the default.
Instead of returning the information as the result of the dump operation,
invoke the \fIcommand\fR on each element of the text widget within the range.
The command has three arguments appended to it before it is evaluated:
-the \fIkey\fP, \fIvalue\fP, and \fIindex\fP.
+the \fIkey\fR, \fIvalue\fR, and \fIindex\fR.
.TP
\fB\-image\fR
Include information about images in the dump results.
@@ -919,7 +1260,7 @@ Include information about marks in the dump results.
.TP
\fB\-tag\fR
Include information about tag transitions in the dump results. Tag
-information is returned as \fBtagon\fP and \fBtagoff\fP elements that
+information is returned as \fBtagon\fR and \fBtagoff\fR elements that
indicate the begin and end of each range of each tag, respectively.
.TP
\fB\-text\fR
@@ -939,7 +1280,6 @@ window by its index position to get more information.
.RE
.TP
\fIpathName \fBedit \fIoption \fR?\fIarg arg ...\fR?
-.VS 8.4
This command controls the undo mechanism and the modified flag. The
exact behavior of the command depends on the \fIoption\fR argument
that follows the \fBedit\fR argument. The following forms of the
@@ -972,9 +1312,8 @@ recorded on the undo stack in between two separators. Generates an
error when the undo stack is empty. Does nothing when the \fB\-undo\fR
option is false.
.RE
-.VE 8.4
.TP
-\fIpathName \fBget \fIindex1 \fR?\fIindex2 ...\fR?
+\fIpathName \fBget\fR \fI?\-displaychars?\fR \fI\-\- index1\fR ?\fIindex2 ...\fR?
Return a range of characters from the text.
The return value will be all the characters in the text starting
with the one whose index is \fIindex1\fR and ending just before
@@ -987,11 +1326,14 @@ is past the end of the file or \fIindex2\fR is less than or equal
to \fIindex1\fR) then an empty string is returned.
If the specified range contains embedded windows, no information
about them is included in the returned string.
-.VS 8.4
If multiple index pairs are given, multiple ranges of text will be returned
in a list. Invalid ranges will not be represented with empty strings in
-the list. The ranges are returned in the order passed to \fBget\fR.
-.VE 8.4
+the list. The ranges are returned in the order passed to \fIpathName \fBget\fR.
+.VS 8.5
+If the \fB\-displaychars\fR option is given, then, within each range,
+only those characters which are not elided will be returned. This may
+have the effect that some of the returned ranges are empty strings.
+.VE 8.5
.TP
\fIpathName \fBimage \fIoption \fR?\fIarg arg ...\fR?
This command is used to manipulate embedded images.
@@ -1058,7 +1400,7 @@ tag names; the new characters will receive all of the tags in
this list and no others, regardless of the tags present around
the insertion point.
If multiple \fIchars\fR\-\fItagList\fR argument pairs are present,
-they produce the same effect as if a separate \fBinsert\fR widget
+they produce the same effect as if a separate \fIpathName \fBinsert\fR widget
command had been issued for each pair, in order.
The last \fItagList\fR argument may be omitted.
.TP
@@ -1088,11 +1430,11 @@ If \fIindex\fR is the name of a mark, then the search for
the next mark begins immediately after that mark.
This can still return a mark at the same position if
there are multiple marks at the same index.
-These semantics mean that the \fBmark next\fP operation can be used to
+These semantics mean that the \fBmark next\fR operation can be used to
step through all the marks in a text widget in the same order
-as the mark information returned by the \fBdump\fP operation.
-If a mark has been set to the special \fBend\fP index,
-then it appears to be \fIafter\fP \fBend\fP with respect to the \fBmark next\fP operation.
+as the mark information returned by the \fIpathName \fBdump\fR operation.
+If a mark has been set to the special \fBend\fR index,
+then it appears to be \fIafter\fR \fBend\fR with respect to the \fIpathName \fBmark next\fR operation.
An empty string is returned if there are no marks after \fIindex\fR.
.TP
\fIpathName \fBmark previous \fIindex\fR
@@ -1103,25 +1445,61 @@ If \fIindex\fR is the name of a mark, then the search for
the next mark begins immediately before that mark.
This can still return a mark at the same position if
there are multiple marks at the same index.
-These semantics mean that the \fBmark previous\fP operation can be used to
+These semantics mean that the \fIpathName \fBmark previous\fR operation can be used to
step through all the marks in a text widget in the reverse order
-as the mark information returned by the \fBdump\fP operation.
+as the mark information returned by the \fIpathName \fBdump\fR operation.
An empty string is returned if there are no marks before \fIindex\fR.
.TP
\fIpathName \fBmark set \fImarkName index\fR
Sets the mark named \fImarkName\fR to a position just before the
character at \fIindex\fR.
If \fImarkName\fR already exists, it is moved from its old position;
-if it doesn't exist, a new mark is created.
+if it does not exist, a new mark is created.
This command returns an empty string.
.TP
\fIpathName \fBmark unset \fImarkName \fR?\fImarkName markName ...\fR?
Remove the mark corresponding to each of the \fImarkName\fR arguments.
The removed marks will not be usable in indices and will not be
-returned by future calls to ``\fIpathName \fBmark names\fR''.
+returned by future calls to
+.QW "\fIpathName \fBmark names\fR" .
This command returns an empty string.
.RE
.TP
+\fIpathName \fBpeer\fR \fIoption args\fR
+.VS 8.5
+This command is used to create and query widget peers. It has
+two forms, depending on \fIoption\fR:
+.RS
+.TP
+\fIpathName \fBpeer create \fInewPathName\fR ?\fIoptions\fR?
+Creates a peer text widget with the given \fInewPathName\fR, and any
+optional standard configuration options (as for the \fItext\fR command).
+By default the peer will have the same start and end line as the
+parent widget, but these can be overridden with the standard
+configuration options.
+.TP
+\fIpathName \fBpeer names\fR
+Returns a list of peers of this widget (this does not include the widget
+itself). The order within this list is undefined.
+.RE
+.TP
+\fIpathName \fBreplace\fR \fIindex1 index2 chars\fR ?\fItagList chars tagList ...\fR?
+Replaces the range of characters between \fIindex1\fR and \fIindex2\fR
+with the given characters and tags. See the section on \fIpathName
+\fBinsert\fR for an explanation of the handling of the \fItagList...\fR
+arguments, and the section on \fIpathName
+\fBdelete\fR for an explanation of the handling of the indices. If
+\fIindex2\fR corresponds to an index earlier in the text than
+\fIindex1\fR, an error will be generated.
+.RS
+.PP
+The deletion and insertion are arranged so that no unnecessary
+scrolling of the window or movement of insertion cursor occurs. In
+addition the undo/redo stack are correctly modified, if undo operations
+are active in the text widget. The command returns an empty string.
+.RE
+.VE 8.5
+.TP
\fIpathName \fBscan\fR \fIoption args\fR
This command is used to implement scanning on texts. It has
two forms, depending on \fIoption\fR:
@@ -1129,14 +1507,14 @@ two forms, depending on \fIoption\fR:
.TP
\fIpathName \fBscan mark \fIx y\fR
Records \fIx\fR and \fIy\fR and the current view in the text window,
-for use in conjunction with later \fBscan dragto\fR commands.
+for use in conjunction with later \fIpathName \fBscan dragto\fR commands.
Typically this command is associated with a mouse button press in
the widget. It returns an empty string.
.TP
\fIpathName \fBscan dragto \fIx y\fR
This command computes the difference between its \fIx\fR and \fIy\fR
arguments and the \fIx\fR and \fIy\fR arguments to the last
-\fBscan mark\fR command for the widget.
+\fIpathName \fBscan mark\fR command for the widget.
It then adjusts the view by 10 times the difference in coordinates.
This command is typically associated
with mouse motion events in the widget, to produce the effect of
@@ -1161,7 +1539,13 @@ This is the default.
\fB\-backwards\fR
The search will proceed backward through the text, finding the
matching range closest to \fIindex\fR whose first character
-is before \fIindex\fR.
+is before \fIindex\fR
+.VS 8.5
+(it is not allowed to be at \fIindex\fR). Note that, for a variety of
+reasons, backwards searches can be substantially slower than forwards
+searches (particularly when using \fB\-regexp\fR), so it is recommended
+that performance-critical code use forward searches.
+.VE 8.5
.TP
\fB\-exact\fR
Use exact matching: the characters in the matching range must be
@@ -1172,6 +1556,23 @@ This is the default.
Treat \fIpattern\fR as a regular expression and match it against
the text using the rules for regular expressions (see the \fBregexp\fR
command for details).
+.VS 8.5
+The default matching automatically passes
+both the \fB\-lineanchor\fR and \fB\-linestop\fR options
+to the regexp engine (unless \fB\-nolinestop\fR is used), so that
+\fI^$\fR match beginning and end of line, and \fI.\fR, \fI[^\fR
+sequences will never match the newline character \fI\en\fR.
+.VE 8.5
+.TP
+\fB\-nolinestop\fR
+.VS 8.5
+This allows \fI.\fR and \fI[^\fR sequences to match the newline
+character \fI\en\fR, which they will otherwise not do (see the \fBregexp\fR
+command for details). This option is only meaningful if \fB\-regexp\fR
+is also given, and an error will be thrown otherwise. For example,
+to match the entire text, use
+.QW "\fIpathName \fBsearch \-nolinestop \-regexp\fR \N'34'.*\N'34' 1.0" .
+.VE 8.5
.TP
\fB\-nocase\fR
Ignore case differences between the pattern and the text.
@@ -1185,6 +1586,55 @@ elided characters if \fB\-elide\fR is not given), this is equivalent to the
number of characters matched. In either case, the range \fImatchIdx\fR to
\fImatchIdx + $count chars\fR will return the entire matched text.
.TP
+\fB\-all\fR
+.VS 8.5
+Find all matches in the given range and return a list of the indices of
+the first character of each match. If a \fB\-count\fI varName\fR switch is
+given, then \fIvarName\fR is also set to a list containing one element
+for each successful match. Note that, even for exact searches, the
+elements of this list may be different, if there are embedded images,
+windows or hidden text. Searches with \fB\-all\fR behave very
+similarly to the Tcl command \fBregexp \-all\fR, in that overlapping
+matches are not normally returned. For example, applying an
+\fB\-all\fR search of the pattern
+.QW \ew+
+against
+.QW "hello there"
+will just match twice, once for each word, and matching
+.QW "Z[a\-z]+Z"
+against
+.QW ZooZooZoo
+will just match once.
+.VE 8.5
+.TP
+\fB\-overlap\fR
+.VS 8.5
+When performing \fB\-all\fR searches, the normal behaviour is that
+matches which overlap an already-found match will not be returned. This
+switch changes that behaviour so that all matches which are not totally
+enclosed within another match are returned. For example, applying an
+\fB\-overlap\fR search of the pattern
+.QW \ew+
+against
+.QW "hello there"
+will just match twice (i.e. no different to just \fB\-all\fR),
+but matching
+.QW Z[a\-z]+Z
+against
+.QW ZooZooZoo
+will now match twice.
+An error will be thrown if this switch is used without \fB\-all\fR.
+.VE 8.5
+.TP
+\fB\-strictlimits\fR
+.VS 8.5
+When performing any search, the normal behaviour is that
+the start and stop limits are checked with respect to the
+start of the matching text. With the \fB\-strictlimits\fR flag,
+the entire matching range must lie inside the start and stop
+limits specified for the match to be valid.
+.VE 8.5
+.TP
\fB\-elide\fR
Find elided (hidden) text as well. By default only displayed text is
searched.
@@ -1193,12 +1643,15 @@ searched.
This switch has no effect except to terminate the list of switches:
the next argument will be treated as \fIpattern\fR even if it starts
with \fB\-\fR.
-.LP
-The matching range must be entirely within a single line of text.
-For regular expression matching the newlines are removed from the ends
-of the lines before matching: use the \fB$\fR feature in regular
-expressions to match the end of a line.
-For exact matching the newlines are retained.
+.PP
+.VS 8.5
+The matching range may be within a single line of text, or run across
+multiple lines (if parts of the pattern can match a new-line). For
+regular expression matching one can use the various newline-matching
+features such as \fB$\fR to match the end of a line, \fB^\fR to match
+the beginning of a line, and to control
+whether \fB.\fR is allowed to match a new-line.
+.VE 8.5
If \fIstopIndex\fR is specified, the search stops at that index:
for forward searches, no match at or after \fIstopIndex\fR will
be considered; for backward searches, no match earlier in the
@@ -1207,6 +1660,10 @@ If \fIstopIndex\fR is omitted, the entire text will be searched:
when the beginning or end of the text is reached, the search
continues at the other end until the starting location is reached
again; if \fIstopIndex\fR is specified, no wrap-around will occur.
+This means that, for example, if the search is \fB\-forwards\fR
+but \fIstopIndex\fR is earlier in the text than \fIstartIndex\fR,
+nothing will ever be found. See \fBKNOWN BUGS\fR below for a number of
+minor limitations of the \fIpathName \fBsearch\fR command.
.RE
.TP
\fIpathName \fBsee \fIindex\fR
@@ -1229,7 +1686,7 @@ supported:
\fIpathName \fBtag add \fItagName index1 \fR?\fIindex2 index1 index2 ...\fR?
Associate the tag \fItagName\fR with all of the characters starting
with \fIindex1\fR and ending just before
-\fIindex2\fR (the character at \fIindex2\fR isn't tagged).
+\fIindex2\fR (the character at \fIindex2\fR is not tagged).
A single command may contain any number of \fIindex1\fR\-\fIindex2\fR
pairs.
If the last \fIindex2\fR is omitted then the single character at
@@ -1251,8 +1708,9 @@ on the syntax of \fIsequence\fR and the substitutions performed
on \fIscript\fR before invoking it.
If all arguments are specified then a new binding is created, replacing
any existing binding for the same \fIsequence\fR and \fItagName\fR
-(if the first character of \fIscript\fR is ``+'' then \fIscript\fR
-augments an existing binding rather than replacing it).
+(if the first character of \fIscript\fR is
+.QW +
+then \fIscript\fR augments an existing binding rather than replacing it).
In this case the return value is an empty string.
If \fIscript\fR is omitted then the command returns the \fIscript\fR
associated with \fItagName\fR and \fIsequence\fR (an error occurs
@@ -1262,9 +1720,8 @@ returns a list of all the sequences for which bindings have been
defined for \fItagName\fR.
.RS
.PP
-.VS
The only events for which bindings may be specified are those related
-to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
+to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.
Event bindings for a text widget use the \fBcurrent\fR mark described
under \fBMARKS\fR above. An \fBEnter\fR event triggers for a tag when the tag
@@ -1277,7 +1734,6 @@ changed. Note that these events are different than \fBEnter\fR and
to the current character. If a virtual event is used in a binding, that
binding can trigger only if the virtual event is defined by an underlying
mouse-related or keyboard-related event.
-.VE
.PP
It is possible for the current character to have multiple tags,
and for each of them to have a binding for a particular event
@@ -1301,11 +1757,11 @@ for the window as a whole.
\fIpathName \fBtag cget\fR \fItagName option\fR
This command returns the current value of the option named \fIoption\fR
associated with the tag given by \fItagName\fR.
-\fIOption\fR may have any of the values accepted by the \fBtag configure\fR
-widget command.
+\fIOption\fR may have any of the values accepted by the \fIpathName \fBtag
+configure\fR widget command.
.TP
\fIpathName \fBtag configure \fItagName\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
-This command is similar to the \fBconfigure\fR widget command except
+This command is similar to the \fIpathName \fBconfigure\fR widget command except
that it modifies options associated with the tag given by \fItagName\fR
instead of modifying options for the overall text widget.
If no \fIoption\fR is specified, the command returns a list describing
@@ -1339,10 +1795,11 @@ Returns a list whose elements are the names of all the tags that
are active at the character position given by \fIindex\fR.
If \fIindex\fR is omitted, then the return value will describe
all of the tags that exist for the text (this includes all tags
-that have been named in a ``\fIpathName \fBtag\fR'' widget
-command but haven't been deleted by a ``\fIpathName \fBtag delete\fR''
-widget command, even if no characters are currently marked with
-the tag).
+that have been named in a
+.QW "\fIpathName \fBtag\fR"
+widget command but have not been deleted by a
+.QW "\fIpathName \fBtag delete\fR"
+widget command, even if no characters are currently marked with the tag).
The list will be sorted in order from lowest priority to highest
priority.
.TP
@@ -1398,11 +1855,11 @@ empty string is returned.
\fIpathName \fBtag remove \fItagName index1 \fR?\fIindex2 index1 index2 ...\fR?
Remove the tag \fItagName\fR from all of the characters starting
at \fIindex1\fR and ending just before
-\fIindex2\fR (the character at \fIindex2\fR isn't affected).
+\fIindex2\fR (the character at \fIindex2\fR is not affected).
A single command may contain any number of \fIindex1\fR\-\fIindex2\fR
pairs.
-If the last \fIindex2\fR is omitted then the single character at
-\fIindex1\fR is tagged.
+If the last \fIindex2\fR is omitted then the tag is removed from the
+single character at \fIindex1\fR.
If there are no characters in the specified range (e.g. \fIindex1\fR
is past the end of the file or \fIindex2\fR is less than or equal
to \fIindex1\fR) then the command has no effect.
@@ -1481,15 +1938,24 @@ span of the text is off-screen to the left.
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
-of one of these.
-If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
-\fInumber\fR average-width characters on the display; if it is
-\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
-If \fInumber\fR is negative then characters farther to the left
-become visible; if it is positive then characters farther to the right
-become visible.
+\fIWhat\fR must be \fBunits\fR, \fBpages\fR or \fBpixels\fR.
+.VS 8.5
+If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR must be an
+integer, otherwise number may be specified in any of the forms acceptable
+to \fBTk_GetPixels\fR, such as
+.QW 2.0c
+or
+.QW 1i
+(the result is rounded
+to the nearest integer value. If no units are given, pixels are
+assumed). If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
+\fInumber\fR average-width characters on the display; if it is
+\fBpages\fR then the view adjusts by \fInumber\fR screenfuls; if it is
+\fBpixels\fR then the view adjusts by \fInumber\fR pixels. If
+.VE 8.5
+\fInumber\fR is negative then characters farther to the left become
+visible; if it is positive then characters farther to the right become
+visible.
.RE
.TP
\fIpathName \fByview \fI?args\fR?
@@ -1501,37 +1967,56 @@ It can take any of the following forms:
\fIpathName \fByview\fR
Returns a list containing two elements, both of which are real fractions
between 0 and 1.
-The first element gives the position of the first character in the
+The first element gives the position of the first visible pixel of the
+first character (or image, etc) in the
top line in the window, relative to the text as a whole (0.5 means
it is halfway through the text, for example).
-The second element gives the position of the character just after
-the last one in the bottom line of the window,
+The second element gives the position of the first pixel just after the
+last visible one in the bottom line of the window,
relative to the text as a whole.
These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
option.
.TP
\fIpathName \fByview moveto\fI fraction\fR
-Adjusts the view in the window so that the character given by \fIfraction\fR
-appears on the top line of the window.
+Adjusts the view in the window so that the pixel given by \fIfraction\fR
+appears at the top of the top line of the window.
\fIFraction\fR is a fraction between 0 and 1; 0 indicates the first
-character in the text, 0.33 indicates the character one-third the
-way through the text, and so on.
+pixel of the first character in the text, 0.33 indicates the pixel that is
+one-third the way through the text; and so on.
+.VS 8.5
+Values close to 1 will
+indicate values close to the last pixel in the text (1 actually refers
+to one pixel beyond the last pixel), but in such cases the widget will
+never scroll beyond the last pixel, and so a value of 1 will effectively
+be rounded back to whatever fraction ensures the last pixel is at the
+bottom of the window, and some other pixel is at the top.
+.VE 8.5
.TP
\fIpathName \fByview scroll \fInumber what\fR
This command adjust the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
-\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
-If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
-\fInumber\fR lines on the display; if it is \fBpages\fR then
-the view adjusts by \fInumber\fR screenfuls.
+\fIWhat\fR must be \fBunits\fR, \fBpages\fR or \fBpixels\fR.
+.VS 8.5
+If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR must be an
+integer, otherwise number may be specified in any of the forms acceptable
+to \fBTk_GetPixels\fR, such as
+.QW 2.0c
+or
+.QW 1i
+(the result is rounded
+to the nearest integer value. If no units are given, pixels are
+assumed). If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
+\fInumber\fR lines on the display; if it is \fBpages\fR then the view
+adjusts by \fInumber\fR screenfuls; if it is \fBpixels\fR then the view
+adjusts by \fInumber\fR pixels.
+.VE 8.5
If \fInumber\fR is negative then earlier positions in the text
become visible; if it is positive then later positions in the text
become visible.
.TP
\fIpathName \fByview \fR?\fB\-pickplace\fR? \fIindex\fR
Changes the view in the widget's window to make \fIindex\fR visible.
-If the \fB\-pickplace\fR option isn't specified then \fIindex\fR will
+If the \fB\-pickplace\fR option is not specified then \fIindex\fR will
appear at the top of the window.
If \fB\-pickplace\fR is specified then the widget chooses where
\fIindex\fR appears in the window:
@@ -1548,9 +2033,9 @@ it will be positioned at the bottom of the window.
.IP [4]
Otherwise, \fIindex\fR will be centered in the window.
.LP
-The \fB\-pickplace\fR option has been obsoleted by the \fBsee\fR widget
-command (\fBsee\fR handles both x- and y-motion to make a location
-visible, whereas \fB\-pickplace\fR only handles motion in y).
+The \fB\-pickplace\fR option has been obsoleted by the \fIpathName \fBsee\fR widget
+command (\fIpathName \fBsee\fR handles both x- and y-motion to make a location
+visible, whereas the \fB\-pickplace\fR mode only handles motion in y).
.RE
.TP
\fIpathName \fByview \fInumber\fR
@@ -1563,8 +2048,10 @@ This command used to be used for scrolling, but now it is obsolete.
.PP
Tk automatically creates class bindings for texts that give them
the following default behavior.
-In the descriptions below, ``word'' is dependent on the value of
-the \fBtcl_wordchars\fR variable. See tclvars(n).
+In the descriptions below,
+.QW word
+is dependent on the value of
+the \fBtcl_wordchars\fR variable. See \fBtclvars\fR(n).
.IP [1]
Clicking mouse button 1 positions the insertion cursor
just before the character underneath the mouse cursor, sets the
@@ -1573,12 +2060,12 @@ Dragging with mouse button 1 strokes out a selection between
the insertion cursor and the character under the mouse.
.IP [2]
Double-clicking with mouse button 1 selects the word under the mouse
-and positions the insertion cursor at the end of the word.
+and positions the insertion cursor at the start of the word.
Dragging after a double click will stroke out a selection consisting
of whole words.
.IP [3]
Triple-clicking with mouse button 1 selects the line under the mouse
-and positions the insertion cursor at the end of the line.
+and positions the insertion cursor at the start of the line.
Dragging after a triple click will stroke out a selection consisting
of whole lines.
.IP [4]
@@ -1632,21 +2119,19 @@ The Next and Prior keys move the insertion cursor forward or backwards
by one screenful and clear any selection in the text.
If the Shift key is held down while Next or Prior is typed, then
the selection is extended to include the new character.
-Control-v moves the view down one screenful without moving the
-insertion cursor or adjusting the selection.
.IP [12]
Control-Next and Control-Prior scroll the view right or left by one page
without moving the insertion cursor or affecting the selection.
.IP [13]
Home and Control-a move the insertion cursor to the
-beginning of its line and clear any selection in the widget.
-Shift-Home moves the insertion cursor to the beginning of the line
+beginning of its display line and clear any selection in the widget.
+Shift-Home moves the insertion cursor to the beginning of the display line
and also extends the selection to that point.
.IP [14]
End and Control-e move the insertion cursor to the
-end of the line and clear any selection in the widget.
-Shift-End moves the cursor to the end of the line and extends the selection
-to that point.
+end of the display line and clear any selection in the widget.
+Shift-End moves the cursor to the end of the display line and extends
+the selection to that point.
.IP [15]
Control-Home and Meta-< move the insertion cursor to the beginning of
the text and clear any selection in the widget.
@@ -1659,7 +2144,7 @@ Control-Shift-End moves the cursor to the end of the text and extends
the selection to that point.
.IP [17]
The Select key and Control-Space set the selection anchor to the position
-of the insertion cursor. They don't affect the current selection.
+of the insertion cursor. They do not affect the current selection.
Shift-Select and Control-Shift-Space adjust the selection to the
current position of the insertion cursor, selecting from the anchor
to the insertion cursor if there was not any selection previously.
@@ -1670,24 +2155,18 @@ Control-\e clears any selection in the widget.
.IP [20]
The F16 key (labelled Copy on many Sun workstations) or Meta-w
copies the selection in the widget to the clipboard, if there is a selection.
-.VS 8.4
This action is carried out by the command \fBtk_textCopy\fR.
-.VE 8.4
.IP [21]
The F20 key (labelled Cut on many Sun workstations) or Control-w
copies the selection in the widget to the clipboard and deletes
the selection.
-.VS 8.4
This action is carried out by the command \fBtk_textCut\fR.
-.VE 8.4
If there is no selection in the widget then these keys have no effect.
.IP [22]
The F18 key (labelled Paste on many Sun workstations) or Control-y
inserts the contents of the clipboard at the position of the
insertion cursor.
-.VS 8.4
This action is carried out by the command \fBtk_textPaste\fR.
-.VE 8.4
.IP [23]
The Delete key deletes the selection, if there is one in the widget.
If there is no selection, it deletes the character to the right of
@@ -1716,16 +2195,14 @@ Control-x deletes whatever is selected in the text widget
after copying it to the clipboard.
.IP [31]
Control-t reverses the order of the two characters to the right of
-the insertion cursor.
+the insertion cursor.
.IP [32]
-.VS 8.4
Control-z (and Control-underscore on UNIX when \fBtk_strictMotif\fR is
true) undoes the last edit action if the \fB\-undo\fR option is true.
Does nothing otherwise.
.IP [33]
Control-Z (or Control-y on Windows) reapplies the last undone edit
action if the \fB\-undo\fR option is true. Does nothing otherwise.
-.VE 8.4
.PP
If the widget is disabled using the \fB\-state\fR option, then its
view can still be adjusted and text can still be selected,
@@ -1734,7 +2211,34 @@ take place.
.PP
The behavior of texts can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-.SH "PERFORMANCE ISSUES"
+.SH "KNOWN ISSUES"
+.SS "ISSUES CONCERNING CHARS AND INDICES"
+.VS 8.5
+.PP
+Before Tk 8.5, the widget used the string
+.QW chars
+to refer to index positions (which included characters, embedded
+windows and embedded images). As of Tk 8.5 the text widget deals
+separately and correctly with
+.QW chars
+and
+.QW indices .
+For backwards compatibility, however, the index modifiers
+.QW "+N chars"
+and
+.QW "\-N chars"
+continue to refer to indices.
+One must use any of the full forms
+.QW "+N any chars"
+or
+.QW "\-N any chars"
+etc. to refer to actual character indices. This confusion may be fixed in a
+future release by making the widget correctly interpret
+.QW "+N chars"
+as a synonym for
+.QW "+N any chars" .
+.VE 8.5
+.SS "PERFORMANCE ISSUES"
.PP
Text widgets should run efficiently under a variety
of conditions. The text widget uses about 2-3 bytes of
@@ -1766,10 +2270,64 @@ especially if they have many marks and tags within them.
.PP
The display line with the insert cursor is redrawn each time the
cursor blinks, which causes a steady stream of graphics traffic.
-Set the \fBinsertOffTime\fP attribute to 0 avoid this.
-
+Set the \fBinsertOffTime\fR attribute to 0 avoid this.
+.SS "KNOWN BUGS"
+.VS 8.5
+.PP
+The \fIpathName \fBsearch \-regexp\fR sub-command attempts to perform sophisticated
+regexp matching across multiple lines in an efficient fashion (since Tk
+8.5), examining each line individually, and then in small groups of lines,
+whether searching forwards or backwards. Under certain conditions the
+search result might differ from that obtained by applying the same regexp
+to the entire text from the widget in one go. For example, when
+searching with a greedy regexp, the widget will continue to attempt to
+add extra lines to the match as long as one of two conditions are true:
+either Tcl's regexp library returns a code to indicate a longer match is
+possible (but there are known bugs in Tcl which mean this code is not
+always correctly returned); or if each extra line added results in at
+least a partial match with the pattern. This means in the case where the
+first extra line added results in no match and Tcl's regexp system
+returns the incorrect code and adding a second extra line would actually
+match, the text widget will return the wrong result. In practice this is
+a rare problem, but it can occur, for example:
+.CS
+pack [text .t]
+\&.t insert 1.0 "aaaa\enbbbb\encccc\enbbbb\enaaaa\en"
+\&.t search \-regexp \-\- {(a+|b+\enc+\enb+)+\ena+} 1.0
+.CE
+will not find a match when one exists of 19
+characters starting from the first
+.QW b .
+.PP
+Whenever one possible match is fully enclosed in another, the search
+command will attempt to ensure only the larger match is returned.
+When performing backwards regexp searches it is possible that Tcl
+will not always achieve this, in the case where a match is preceded by
+one or more short, non-overlapping matches, all of which are preceded
+by a large match which actually encompasses all of them. The search
+algorithm used by the widget does not look back arbitrarily far for a
+possible match which might cover large portions of the widget.
+For example:
+.CS
+pack [text .t]
+\&.t insert 1.0 "aaaa\enbbbb\enbbbb\enbbbb\enbbbb\\n"
+\&.t search \-regexp \-backward \-\- {b+\en|a+\en(b+\en)+} end
+.CE
+matches at
+.QW 5.0
+when a true greedy match would match at
+.QW 1.0 .
+Similarly if we add \fB\-all\fR to this case, it matches at all of
+.QW 5.0 ,
+.QW 4.0 ,
+.QW 3.0
+and
+.QW 1.0 ,
+when really it should only match at
+.QW 1.0
+since that match encloses all the others.
+.VE 8.5
.SH "SEE ALSO"
entry(n), scrollbar(n)
-
.SH KEYWORDS
text, widget, tkvars
diff --git a/doc/tk.n b/doc/tk.n
index 6e807e6..377aa91 100644
--- a/doc/tk.n
+++ b/doc/tk.n
@@ -26,13 +26,17 @@ The command can take any of a number of different forms
depending on the \fIoption\fR argument. The legal forms are:
.TP
\fBtk appname \fR?\fInewName\fR?
-If \fInewName\fR isn't specified, this command returns the name
+.
+If \fInewName\fR is not specified, this command returns the name
of the application (the name that may be used in \fBsend\fR
commands to communicate with the application).
If \fInewName\fR is specified, then the name of the application
is changed to \fInewName\fR.
If the given name is already in use, then a suffix of the form
-``\fB #2\fR'' or ``\fB #3\fR'' is appended in order to make the name unique.
+.QW "\fB #2\fR"
+or
+.QW "\fB #3\fR"
+is appended in order to make the name unique.
The command's result is the name actually chosen.
\fInewName\fR should not start with a capital letter.
This will interfere with option processing, since names starting with
@@ -41,7 +45,6 @@ be able to find some options for the application.
If sends have been disabled by deleting the \fBsend\fR command,
this command will reenable them and recreate the \fBsend\fR
command.
-.VS 8.4
.TP
\fBtk caret window \fR?\fB\-x \fIx\fR? ?\fB\-y \fIy\fR? ?\fB\-height \fIheight\fR?
.
@@ -54,7 +57,6 @@ the last values used for setting the caret are return in option-value pair
format. \fI\-x\fR and \fI\-y\fR represent window-relative coordinates, and
\fI\-height\fR is the height of the current cursor location, or the height
of the specified \fIwindow\fR if none is given.
-.VE
.TP
\fBtk scaling \fR?\fB\-displayof \fIwindow\fR? ?\fInumber\fR?
.
@@ -66,7 +68,9 @@ omitted, it defaults to the main window. If the \fInumber\fR argument is
omitted, the current value of the scaling factor is returned.
.RS
.PP
-A ``point'' is a unit of measurement equal to 1/72 inch. A scaling factor
+A
+.QW point
+is a unit of measurement equal to 1/72 inch. A scaling factor
of 1.0 corresponds to 1 pixel per point, which is equivalent to a standard
72 dpi monitor. A scaling factor of 1.25 would mean 1.25 pixels per point,
which is the setting for a 90 dpi monitor; setting the scaling factor to
@@ -78,25 +82,41 @@ after the scaling factor is changed will use the new scaling factor, but it
is undefined whether existing widgets will resize themselves dynamically to
accommodate the new scaling factor.
.RE
-.VS 8.3
+.TP
+\fBtk inactive \fR?\fB\-displayof \fIwindow\fR? ?\fBreset\fR?
+.
+Returns a positive integer, the number of milliseconds since the last
+time the user interacted with the system. If the \fB\-displayof\fR
+option is given then the return value refers to the display of
+\fIwindow\fR; otherwise it refers to the display of the application's
+main window.
+.RS
+.PP
+\fBtk inactive\fR will return \-1, if querying the user inactive time
+is not supported by the system, and in safe interpreters.
+.PP
+If the literal string \fBreset\fR is given as an additional argument,
+the timer is reset and an empty string is returned. Resetting the
+inactivity time is forbidden in safe interpreters and will throw and
+error if tried.
+.RE
.TP
\fBtk useinputmethods \fR?\fB\-displayof \fIwindow\fR? ?\fIboolean\fR?
.
Sets and queries the state of whether Tk should use XIM (X Input Methods)
for filtering events. The resulting state is returned. XIM is used in
-some locales (ie: Japanese, Korean), to handle special input devices. This
+some locales (i.e., Japanese, Korean), to handle special input devices. This
feature is only significant on X. If XIM support is not available, this
will always return 0. If the \fIwindow\fR argument is omitted, it defaults
to the main window. If the \fIboolean\fR argument is omitted, the current
state is returned. This is turned on by default for the main display.
-.VE
-.VS 8.4
.TP
\fBtk windowingsystem\fR
.
Returns the current Tk windowing system, one of
\fBx11\fR (X11-based), \fBwin32\fR (MS Windows),
-\fBclassic\fR (Mac OS Classic), or \fBaqua\fR (Mac OS X Aqua).
-.VE
+or \fBaqua\fR (Mac OS X Aqua).
+.SH "SEE ALSO"
+send(n), winfo(n)
.SH KEYWORDS
application name, send
diff --git a/doc/tkvars.n b/doc/tkvars.n
index da7410e..9971698 100644
--- a/doc/tkvars.n
+++ b/doc/tkvars.n
@@ -29,7 +29,7 @@ an interpreter; this is done by searching several different directories
until one is found that contains an appropriate Tk startup script.
If the \fBTK_LIBRARY\fR environment variable exists, then
the directory it names is checked first.
-If \fBTK_LIBRARY\fR isn't set or doesn't refer to an appropriate
+If \fBTK_LIBRARY\fR is not set or does not refer to an appropriate
directory, then Tk checks several other directories based on a
compiled-in default location, the location of the Tcl library directory,
the location of the binary containing the application, and the current
diff --git a/doc/toplevel.n b/doc/toplevel.n
index c1f0081..e02eb35 100644
--- a/doc/toplevel.n
+++ b/doc/toplevel.n
@@ -72,7 +72,7 @@ This option is special in that it may not be specified via the option
database, and it may not be modified with the \fBconfigure\fR
widget command.
.OP \-use use Use
-This option is used for embedding. If the value isn't an empty string,
+This option is used for embedding. If the value is not an empty string,
it must be the window identifier of a container window, specified as
a hexadecimal string like the ones returned by the \fBwinfo id\fR
command. The toplevel widget will be created as a child of the given
diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3
new file mode 100644
index 0000000..5a0ce4f
--- /dev/null
+++ b/doc/ttk_Geometry.3
@@ -0,0 +1,223 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+.so man.macros
+.TH Geometry 3 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+Ttk_MakeBox, Ttk_PadBox, Ttk_ExpandBox, Ttk_PackBox, Ttk_StickBox, Ttk_PlaceBox, Ttk_BoxContains, Ttk_MakePadding, Ttk_UniformPadding, Ttk_AddPadding, Ttk_RelievePadding, Ttk_GetPaddingFromObj, Ttk_GetBorderFromObj, Ttk_GetStickyFromObj \- Tk themed geometry utilities
+.SH SYNOPSIS
+.nf
+\fB#include <tkTheme.h>\fR
+
+Ttk_Box
+\fBTtk_MakeBox\fR(int \fIx\fR, int \fIy\fR, int \fIwidth\fR, int \fIheight\fR);
+
+Ttk_Box
+\fBTtk_PadBox\fR(Ttk_Box \fIparcel\fR, Ttk_Padding \fIpadding\fR);
+
+Ttk_Box
+\fBTtk_ExpandBox\fR(Ttk_Box \fIparcel\fR, Ttk_Padding \fIpadding\fR);
+
+Ttk_Box
+\fBTtk_PackBox\fR(Ttk_Box *\fIcavity\fR, int \fIwidth\fR, int \fIheight\fR, Ttk_Side \fIside\fR);
+
+Ttk_Box
+\fBTtk_StickBox\fR(Ttk_Box \fIparcel\fR, int \fIwidth\fR, int \fIheight\fR, unsigned \fIsticky\fR);
+
+Ttk_Box
+\fBTtk_PlaceBox\fR(Ttk_Box *\fIcavity\fR, int \fIwidth\fR, int \fIheight\fR, Ttk_Side \fIside\fR, unsigned \fIsticky\fR);
+
+Ttk_Box
+\fBTtk_AnchorBox\fR(Ttk_Box \fIparcel\fR, int \fIwidth\fR, int \fIheight\fR, Tk_Anchor \fIanchor\fR);
+
+Ttk_Padding
+\fBTtk_MakePadding\fR(short \fIleft\fR, short \fItop\fR, short \fIright\fR, short \fIbottom\fR);
+
+Ttk_Padding
+\fBTtk_UniformPadding\fR(short \fIborder\fR);
+
+Ttk_Padding
+\fBTtk_AddPadding\fR(Ttk_Padding \fIpadding1\fR, Ttk_Padding \fIpadding2\fR;
+
+Ttk_Padding
+\fBTtk_RelievePadding\fR(Ttk_Padding \fIpadding\fR, int \fIrelief\fR);
+
+int
+\fBTtk_BoxContains\fR(Ttk_Box \fIbox\fR, int \fIx\fR, int \fIy\fR);
+
+int
+\fBTtk_GetPaddingFromObj\fR(Tcl_Interp *\fIinterp\fR, Tk_Window \fItkwin\fR, Tcl_Obj *\fIobjPtr\fR, Ttk_Padding *\fIpadding_rtn\fR);
+
+int
+\fBTtk_GetBorderFromObj\fR(Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIobjPtr\fR, Ttk_Padding *\fIpadding_rtn\fR);
+
+int
+\fBTtk_GetStickyFromObj\fR(Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIobjPtr\fR, int *\fIsticky_rtn\fR);
+.fi
+.SH ARGUMENTS
+.AP Tk_Anchor anchor in
+One of the symbolic constants \fBTK_ANCHOR_N\fR, \fBTK_ANCHOR_NE\fR,
+etc. See \fITk_GetAnchorFromObj(3)\fR.
+.AP "Ttk_Box *" cavity in/out
+A rectangular region from which a parcel is allocated.
+.AP short border in
+Extra padding (in pixels) to add uniformly to each side of a region.
+.AP short bottom in
+Extra padding (in pixels) to add to the bottom of a region.
+.AP Ttk_Box box in
+.AP "Ttk_Box *" box_rtn out
+Specifies a rectangular region.
+.AP int height in
+The height in pixels of a region.
+.AP "Tcl_Interp *" interp in
+Used to store error messages.
+.AP int left in
+Extra padding (in pixels) to add to the left side of a region.
+.AP "Tcl_Obj *" objPtr in
+String value contains a symbolic name
+to be converted to an enumerated value or bitmask.
+Internal rep may be be modified to cache corresponding value.
+.AP Ttk_Padding padding in
+.AP "Ttk_Padding *" padding_rtn out
+Extra padding to add on the inside of a region.
+.AP Ttk_Box parcel in
+A rectangular region, allocated from a cavity.
+.AP int relief in
+One of the standard Tk relief options
+(TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.).
+See \fBTk_GetReliefFromObj\fR.
+.AP short right in
+Extra padding (in pixles) to add to the right side of a region.
+.AP Ttk_Side side in
+One of \fBTTK_SIDE_LEFT\fR, \fBTTK_SIDE_TOP\fR,
+\fBTTK_SIDE_RIGHT\fR, or \fBTTK_SIDE_BOTTOM\fR.
+.AP unsigned sticky in
+A bitmask containing one or more of the bits
+\fBTTK_STICK_W\fR (west, or left),
+\fBTTK_STICK_E\fR (east, or right,
+\fBTTK_STICK_N\fR (north, or top), and
+\fBTTK_STICK_S\fR (south, or bottom).
+\fBTTK_FILL_X\fR is defined as a synonym for (TTK_STICK_W|TTK_STICK_E),
+\fBTTK_FILL_Y\fR is a synonym for (TTK_STICK_N|TTK_STICK_S),
+and \fBTTK_FILL_BOTH\fR and \fBTTK_STICK_ALL\fR
+are synonyms for (TTK_FILL_X|TTK_FILL_Y).
+See also: \fIgrid(n)\fR.
+.AP Tk_Window tkwin in
+Window whose screen geometry determines
+the conversion between absolute units and pixels.
+.AP short top in
+Extra padding at the top of a region.
+.AP int width in
+The width in pixels of a region.
+.AP int x in
+X coordinate of upper-left corner of region.
+.AP int y in
+Y coordinate of upper-left corner of region.
+.BE
+.SH "BOXES"
+.PP
+The \fBTtk_Box\fR structure represents a rectangular region of a window:
+.CS
+typedef struct {
+ int \fIx\fR;
+ int \fIy\fR;
+ int \fIwidth\fR;
+ int \fIheight\fR;
+} \fBTtk_Box\fR;
+.CE
+All coordinates are relative to the window.
+.PP
+\fBTtk_MakeBox\fR is a convenience routine that contsructs
+a \fBTtk_Box\fR structure representing a region \fIwidth\fR pixels
+wide, \fIheight\fR pixels tall, at the specified \fIx, y\fR coordinates.
+.PP
+\fBTtk_PadBox\fR returns a new box located inside the specified \fIparcel\fR,
+shrunken according to the left, top, right, and bottom margins
+specified by \fIpadding\fR.
+.PP
+\fBTtk_ExpandBox\fR is the inverse of \fBTtk_PadBox\fR:
+it returns a new box surrounding the specified \fIparcel\fR,
+expanded according to the left, top, right, and bottom margins
+specified by \fIpadding\fR.
+.PP
+\fBTtk_PackBox\fR allocates a parcel \fIwidth\fR by \fIheight\fR
+pixels wide on the specified \fIside\fR of the \fIcavity\fR,
+and shrinks the \fIcavity\fR accordingly.
+.PP
+\fBTtk_StickBox\fR places a box with the requested \fIwidth\fR
+and \fIheight\fR inside the \fIparcel\fR according to the
+\fIsticky\fR bits.
+.PP
+\fBTtk_PlaceBox\fR combines \fBTtk_PackBox\fR and \fBTtk_StickBox\fR:
+it allocates a parcel on the specified \fIside\fR of the \fIcavity\fR,
+places a box of the requested size inside the parcel according to \fIsticky\fR,
+and shrinks the \fIcavity\fR.
+.PP
+\fBTtk_AnchorBox\fR places a box with the requested \fIwidth\fR
+and \fIheight\fR inside the \fIparcel\fR according to the
+specified \fIanchor\fR option.
+.PP
+\fBTtk_BoxContains\fR tests if the specified \fIx, y\fR coordinate
+lies within the rectangular region \fIbox\fR.
+.SH "PADDDING"
+.PP
+The \fBTtk_Padding\fR structure is used to represent
+borders, internal padding, and external margins:
+.CS
+typedef struct {
+ short \fIleft\fR;
+ short \fItop\fR;
+ short \fIright\fR;
+ short \fIbottom\fR;
+} \fBTtk_Padding\fR;
+.CE
+.PP
+\fBTtk_MakePadding\fR is a convenience routine that contsructs
+a \fBTtk_Padding\fR structure with the specified left, top, right, and bottom
+components.
+.PP
+\fBTtk_UniformPadding\fR constructs a \fBTtk_Padding\fR structure
+with all components equal to the specified \fIborder\fR.
+.PP
+\fBTtk_AddPadding\fR adds two \fBTtk_Padding\fRs together
+and returns a combined padding containing the sum of the
+individual padding components.
+.PP
+\fBTtk_RelievePadding\fR
+adds an extra 2 pixels of padding to \fIpadding\fR
+according to the specified \fIrelief\fR.
+If \fIrelief\fR is \fBTK_RELIEF_SUNKEN\fR,
+adds two pixels at the top and left
+so the inner region is shifted down and to the left.
+If it is \fBTK_RELIEF_RAISED\fR, adds two pixels
+at the bottom and right so
+the inner region is shifted up and to the right.
+Otherwise, adds 1 pixel on all sides.
+This is typically used in element geometry procedures to simulate a
+.QW pressed-in
+look for pushbuttons.
+.SH "CONVERSION ROUTINES"
+.PP
+\fBTtk_GetPaddingFromObj\fR converts the string in \fIobjPtr\fR
+to a \fBTtk_Padding\fR structure.
+The string representation is a list of
+up to four length specifications
+.QW "\fIleft top right bottom\fR" .
+If fewer than four elements are specified,
+\fIbottom\fR defaults to \fItop\fR,
+\fIright\fR defaults to \fIleft\fR, and
+\fItop\fR defaults to \fIleft\fR.
+See \fBTk_GetPixelsFromObj(3)\fR for the syntax of length specifications.
+.PP
+\fBTtk_GetBorderFromObj\fR is the same as \fBTtk_GetPaddingFromObj\fR
+except that the lengths are specified as integers
+(i.e., resolution-dependant values like \fI3m\fR are not allowed).
+.PP
+\fBTtk_GetStickyFromObj\fR converts the string in \fIobjPtr\fR
+to a \fIsticky\fR bitmask. The string contains zero or more
+of the characters \fBn\fR, \fBs\fR, \fBe\fR, or \fBw\fR.
+.SH "SEE ALSO"
+Tk_GetReliefFromObj(3), Tk_GetPixelsFromObj(3), Tk_GetAnchorFromObj(3)
+.SH "KEYWORDS"
+geometry, padding, margins, box, region, sticky, relief
diff --git a/doc/ttk_Theme.3 b/doc/ttk_Theme.3
new file mode 100644
index 0000000..acd0e98
--- /dev/null
+++ b/doc/ttk_Theme.3
@@ -0,0 +1,32 @@
+'\"
+'\" Copyright (c) 2003 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH Ttk_CreateTheme 3 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+Ttk_CreateTheme, Ttk_GetTheme, Ttk_GetDefaultTheme, Ttk_GetCurrentTheme \- create and use Tk themes.
+.SH SYNOPSIS
+.nf
+Ttk_Theme Ttk_CreateTheme(\fIinterp\fR, \fIname\fR, \fIparentTheme\fR);
+Ttk_Theme Ttk_GetTheme(\fIinterp\fR, \fIname\fR);
+Ttk_Theme Ttk_GetDefaultTheme(\fIinterp\fR);
+Ttk_Theme Ttk_GetCurrentTheme(\fIinterp\fR);
+.fi
+.SH ARGUMENTS
+.AP "Tcl_Interp *" interp in
+The Tcl interpreter in which to register/query available themes.
+.AP "Ttk_Theme" parentTheme in
+Fallback or parent theme from which the new theme will
+inherit elements and layouts.
+.AP "const char *" name in
+The name of the theme.
+.BE
+.SH DESCRIPTION
+.\" TODO - Document these functions better!
+.SH "SEE ALSO"
+Ttk_RegisterLayout, Ttk_BuildLayout
+.\" .SH KEYWORDS
diff --git a/doc/ttk_button.n b/doc/ttk_button.n
new file mode 100644
index 0000000..c6f2308
--- /dev/null
+++ b/doc/ttk_button.n
@@ -0,0 +1,81 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::button n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::button \- Widget that issues a command when pressed
+.SH SYNOPSIS
+\fBttk::button\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+A \fBttk::button\fR widget displays a textual label and/or image,
+and evaluates a command when pressed.
+.SO ttk_widget
+\-class \-compound \-cursor
+\-image \-state \-style
+\-takefocus \-text \-textvariable
+\-underline \-width
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-command command Command
+A script to evaluate when the widget is invoked.
+.OP \-default default Default
+May be set to one of \fBnormal\fR, \fBactive\fR, or \fBdisabled\fR.
+In a dialog box, one button may be designated the
+.QW default
+button (meaning, roughly,
+.QW "the one that gets invoked when the user presses <Enter>" ).
+\fBactive\fR indicates that this is currently the default button;
+\fBnormal\fR means that it may become the default button, and
+\fBdisabled\fR means that it is not defaultable.
+The default is \fBnormal\fR.
+.RS
+.PP
+Depending on the theme, the default button may be displayed
+with an extra highlight ring, or with a different border color.
+.RE
+.OP \-width width Width
+If greater than zero, specifies how much space, in character widths,
+to allocate for the text label.
+If less than zero, specifies a minimum width.
+If zero or unspecified, the natural width of the text label is used.
+Note that some themes may specify a non-zero \fB\-width\fR
+in the style.
+.\" Not documented -- may go away
+.\" .OP \-padding padding Padding
+.\" .OP \-foreground foreground Foreground
+.\" .OP \-font font Font
+.\" .OP \-anchor anchor Anchor
+.\" .OP \-padding padding Padding
+.\" .OP \-relief relief Relief
+.SH "WIDGET COMMAND"
+.PP
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
+commands, buttons support the following additional widget commands:
+.TP
+\fIpathName \fBinvoke\fR
+Invokes the command associated with the button.
+.SH "STANDARD STYLES"
+.PP
+\fBTtk::button\fR widgets support the \fBToolbutton\fR style in all standard
+themes, which is useful for creating widgets for toolbars.
+.SH "COMPATIBILITY OPTIONS"
+.OP \-state state State
+May be set to \fBnormal\fR or \fBdisabled\fR to control the
+\fBdisabled\fR state bit. This is a
+.QW write-only
+option: setting it changes the widget state, but the \fBstate\fR
+widget command does not affect the state option.
+.SH "SEE ALSO"
+ttk::widget(n), button(n)
+.SH "KEYWORDS"
+widget, button, default, command
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_checkbutton.n b/doc/ttk_checkbutton.n
new file mode 100644
index 0000000..07b3205
--- /dev/null
+++ b/doc/ttk_checkbutton.n
@@ -0,0 +1,77 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::checkbutton n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::checkbutton \- On/off widget
+.SH SYNOPSIS
+\fBttk::checkbutton\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+A \fBttk::checkbutton\fR widget is used to show or change a setting.
+It has two states, selected and deselected.
+The state of the checkbutton may be linked to a Tcl variable.
+.SO ttk_widget
+\-class \-compound \-cursor
+\-image \-state \-style
+\-takefocus \-text \-textvariable
+\-underline \-width
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-command command Command
+A Tcl script to execute whenever the widget is invoked.
+.OP \-offvalue offValue OffValue
+The value to store in the associated \fB\-variable\fR
+when the widget is deselected. Defaults to \fB0\fR.
+.OP \-onvalue onValue OnValue
+The value to store in the associated \fB\-variable\fR
+when the widget is selected. Defaults to \fB1\fR.
+.OP \-variable variable Variable
+The name of a global variable whose value is linked to the widget.
+Defaults to the widget pathname if not specified.
+.SH "WIDGET COMMAND"
+.PP
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
+commands, checkbuttons support the following additional
+widget commands:
+.TP
+\fIpathname\fB invoke\fR
+Toggles between the selected and deselected states
+and evaluates the associated \fB\-command\fR.
+If the widget is currently selected, sets the \fB\-variable\fR
+to the \fB\-offvalue\fR and deselects the widget;
+otherwise, sets the \fB\-variable\fR to the \fB\-onvalue\fR
+Returns the result of the \fB\-command\fR.
+.\" Missing: select, deselect, toggle
+.\" Are these useful? They don't invoke the -command
+.\" Missing: flash. This is definitely not useful.
+.SH "WIDGET STATES"
+.PP
+The widget does not respond to user input if the \fBdisabled\fR state is set.
+The widget sets the \fBselected\fR state whenever
+the linked \fB\-variable\fR is set to the widget's \fB\-onvalue\fR,
+and clears it otherwise.
+The widget sets the \fBalternate\fR state whenever the
+linked \fB\-variable\fR is unset.
+(The \fBalternate\fR state may be used to indicate a
+.QW tri-state
+or
+.QW indeterminate
+selection.)
+.SH "STANDARD STYLES"
+.PP
+\fBTtk::checkbutton\fR widgets support the \fBToolbutton\fR style in all
+standard themes, which is useful for creating widgets for toolbars.
+.SH "SEE ALSO"
+ttk::widget(n), ttk::radiobutton(n), checkbutton(n)
+.SH "KEYWORDS"
+widget, button, toggle, check, option
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n
new file mode 100644
index 0000000..e01c6f6
--- /dev/null
+++ b/doc/ttk_combobox.n
@@ -0,0 +1,119 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::combobox n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::combobox \- text field with popdown selection list
+.SH SYNOPSIS
+\fBttk::combobox\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::combobox\fR combines a text field with a pop-down list of values;
+the user may select the value of the text field from among the
+values in the list.
+.SO ttk_widget
+\-class \-cursor \-takefocus
+\-style
+.SE
+.\" ALSO: Other entry widget options
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-exportselection exportSelection ExportSelection
+Boolean value.
+If set, the widget selection is linked to the X selection.
+.OP \-justify justify Justify
+Specifies how the text is aligned within the widget.
+Must be one of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
+.OP \-height height Height
+Specifies the height of the pop-down listbox, in rows.
+.OP \-postcommand postCommand PostCommand
+A Tcl script to evaluate immediately before displaying the listbox.
+The \fB\-postcommand\fR script may specify the \fB\-values\fR to display.
+.OP \-state state State
+One of \fBnormal\fR, \fBreadonly\fR, or \fBdisabled\fR.
+In the \fBreadonly\fR state,
+the value may not be edited directly, and
+the user can only select one of the \fB\-values\fR from the
+dropdown list.
+In the \fBnormal\fR state,
+the text field is directly editable.
+In the \fBdisabled\fR state, no interaction is possible.
+.OP \-textvariable textVariable TextVariable
+Specifies the name of a global variable whose value is linked
+to the widget value.
+Whenever the variable changes value the widget value is updated,
+and vice versa.
+.OP \-values values Values
+Specifies the list of values to display in the drop-down listbox.
+.OP \-width width Width
+Specifies an integer value indicating the desired width of the entry window,
+in average-size characters of the widget's font.
+.SH "WIDGET COMMAND"
+.PP
+The following subcommands are possible for combobox widgets:
+'\".TP
+'\"\fIpathName \fBcget\fR \fIoption\fR
+'\"Returns the current value of the specified \fIoption\fR.
+'\"See \fIttk::widget(n)\fR.
+'\".TP
+'\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+'\"Modify or query widget options.
+'\"See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBcurrent\fR ?\fInewIndex\fR?
+If \fInewIndex\fR is supplied, sets the combobox value
+to the element at position \fInewIndex\fR in the list of \fB\-values\fR.
+Otherwise, returns the index of the current value in the list of
+\fB\-values\fR or \fB\-1\fR if the current value does not appear in the list.
+.TP
+\fIpathName \fBget\fR
+Returns the current value of the combobox.
+'\".TP
+'\"\fIpathName \fBidentify \fIx y\fR
+'\"Returns the name of the element at position \fIx\fR, \fIy\fR.
+'\"See \fIttk::widget(n)\fR.
+'\".TP
+'\"\fIpathName \fBinstate \fIstateSpec\fR ?\fIscript\fR?
+'\"Test the widget state.
+'\"See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBset\fR \fIvalue\fR
+Sets the value of the combobox to \fIvalue\fR.
+'\".TP
+'\"\fIpathName \fBstate\fR ?\fIstateSpec\fR?
+'\"Modify or query the widget state.
+'\"See \fIttk::widget(n)\fR.
+.PP
+The combobox widget also supports the following \fBttk::entry\fR
+widget subcommands (see \fIttk::entry(n)\fR for details):
+.DS
+.ta 5.5c 11c
+\fBbbox\fR \fBdelete\fR \fBicursor\fR
+\fBindex\fR \fBinsert\fR \fBselection\fR
+\fBxview\fR
+.DE
+The combobox widget also supports the following generic \fBttk::widget\fR
+widget subcommands (see \fIttk::widget(n)\fR for details):
+.DS
+.ta 5.5c 11c
+\fBcget\fR \fBconfigure\fR \fBidentify\fR
+\fBinstate\fR \fBstate\fR
+.DE
+.SH "VIRTUAL EVENTS"
+.PP
+The combobox widget generates a \fB<<ComboboxSelected>>\fR virtual event
+when the user selects an element from the list of values.
+If the selection action unposts the listbox,
+this event is delivered after the listbox is unposted.
+.SH "SEE ALSO"
+ttk::widget(n), ttk::entry(n)
+.SH KEYWORDS
+choice, entry, list box, text box, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n
new file mode 100644
index 0000000..b42bd31
--- /dev/null
+++ b/doc/ttk_entry.n
@@ -0,0 +1,470 @@
+'\"
+'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
+'\" Copyright (c) 1998-2000 Scriptics Corporation.
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::entry n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::entry \- Editable text field widget
+.SH SYNOPSIS
+\fBttk::entry\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+An \fBttk::entry\fR widget displays a one-line text string and
+allows that string to be edited by the user.
+The value of the string may be linked to a Tcl variable
+with the \fB\-textvariable\fR option.
+Entry widgets support horizontal scrolling with the
+standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command.
+.SO ttk_widget
+\-class \-cursor \-style
+\-takefocus \-xscrollcommand
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-exportselection exportSelection ExportSelection
+A boolean value specifying whether or not
+a selection in the widget should be linked to the X selection.
+If the selection is exported, then selecting in the widget deselects
+the current X selection, selecting outside the widget deselects any
+widget selection, and the widget will respond to selection retrieval
+requests when it has a selection.
+.\" MAYBE: .OP \-font font Font
+.\" MAYBE: .OP \-foreground foreground Foreground
+.\" MAYBE: .OP \-insertbackground insertBackground Foreground
+.\" MAYBE: .OP \-insertwidth insertWidth InsertWidth
+.OP \-invalidcommand invalidCommand InvalidCommand
+A script template to evaluate whenever the \fBvalidateCommand\fR returns 0.
+See \fBVALIDATION\fR below for more information.
+.OP \-justify justify Justify
+Specifies how the text is aligned within the entry widget.
+One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
+.\" MAYBE: .OP \-selectbackground selectBackground Foreground
+.\" MAYBE: .OP \-selectborderwidth selectBorderWidth BorderWidth
+.\" MAYBE: .OP \-selectforeground selectForeground Background
+.OP \-show show Show
+If this option is specified, then the true contents of the entry
+are not displayed in the window.
+Instead, each character in the entry's value will be displayed as
+the first character in the value of this option, such as
+.QW *
+or a bullet.
+This is useful, for example, if the entry is to be used to enter
+a password.
+If characters in the entry are selected and copied elsewhere, the
+information copied will be what is displayed, not the true contents
+of the entry.
+.OP \-state state State
+Compatibility option; see \fIttk::widget(n)\fR for details.
+Specifies one of three states for the entry,
+\fBnormal\fR, \fBdisabled\fR, or \fBreadonly\fR.
+See \fBWIDGET STATES\fR, below.
+.OP \-textvariable textVariable Variable
+Specifies the name of a global variable whose value is linked
+to the entry widget's contents.
+Whenever the variable changes value, the widget's contents are updated,
+and vice versa.
+.OP \-validate validate Validate
+Specifies the mode in which validation should operate:
+\fBnone\fR, \fBfocus\fR, \fBfocusin\fR, \fBfocusout\fR, \fBkey\fR, or \fBall\fR.
+Default is \fBnone\fR, meaning that validation is disabled.
+See \fBVALIDATION\fR below.
+.OP \-validatecommand validateCommand ValidateCommand
+A script template to evaluate whenever validation is triggered.
+If set to the empty string (the default), validation is disabled.
+The script must return a boolean value.
+See \fBVALIDATION\fR below.
+.OP \-width width Width
+Specifies an integer value indicating the desired width of the entry window,
+in average-size characters of the widget's font.
+.\" Not in ttk: If the value is less than or equal to zero, the widget picks a
+.\" Not in ttk: size just large enough to hold its current text.
+.SH NOTES
+.PP
+A portion of the entry may be selected as described below.
+If an entry is exporting its selection (see the \fBexportSelection\fR
+option), then it will observe the standard X11 protocols for handling the
+selection; entry selections are available as type \fBSTRING\fR.
+Entries also observe the standard Tk rules for dealing with the
+input focus. When an entry has the input focus it displays an
+\fIinsert cursor\fR to indicate where new characters will be
+inserted.
+.PP
+Entries are capable of displaying strings that are too long to
+fit entirely within the widget's window. In this case, only a
+portion of the string will be displayed; commands described below
+may be used to change the view in the window. Entries use
+the standard \fBxScrollCommand\fR mechanism for interacting with
+scrollbars (see the description of the \fBxScrollCommand\fR option
+for details).
+.SH "INDICES"
+.PP
+Many of the \fBentry\fR widget commands take one or more indices as
+arguments. An index specifies a particular character in the entry's
+string, in any of the following ways:
+.IP \fInumber\fR
+Specifies the character as a numerical index, where 0 corresponds
+to the first character in the string.
+.IP \fB@\fInumber\fR
+In this form, \fInumber\fR is treated as an x-coordinate in the
+entry's window; the character spanning that x-coordinate is used.
+For example,
+.QW \fB@0\fR
+indicates the left-most character in the window.
+.IP \fBend\fR
+Indicates the character just after the last one in the entry's string.
+This is equivalent to specifying a numerical index equal to the length
+of the entry's string.
+.IP \fBinsert\fR
+Indicates the character adjacent to and immediately following the
+insert cursor.
+.IP \fBsel.first\fR
+Indicates the first character in the selection. It is an error to
+use this form if the selection is not in the entry window.
+.IP \fBsel.last\fR
+Indicates the character just after the last one in the selection.
+It is an error to use this form if the selection is not in the
+entry window.
+.LP
+Abbreviations may be used for any of the forms above, e.g.\|
+.QW \fBe\fR
+or
+.QW \fBsel.l\fR .
+In general, out-of-range indices are automatically rounded to the
+nearest legal value.
+.SH "WIDGET COMMAND"
+.PP
+The following subcommands are possible for entry widgets:
+.TP
+\fIpathName \fBbbox \fIindex\fR
+Returns a list of four numbers describing the bounding box of the
+character given by \fIindex\fR.
+The first two elements of the list give the x and y coordinates of
+the upper-left corner of the screen area covered by the character
+(in pixels relative to the widget) and the last two elements give
+the width and height of the character, in pixels.
+The bounding box may refer to a region outside the visible area
+of the window.
+'\".TP
+'\"\fIpathName \fBcget\fR \fIoption\fR
+'\"Returns the current value of the specified \fIoption\fR.
+'\"See \fIttk::widget(n)\fR.
+'\".TP
+'\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+'\"Modify or query widget options.
+'\"See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
+Delete one or more elements of the entry.
+\fIFirst\fR is the index of the first character to delete, and
+\fIlast\fR is the index of the character just after the last
+one to delete.
+If \fIlast\fR is not specified it defaults to \fIfirst\fR+1,
+i.e. a single character is deleted.
+This command returns the empty string.
+.TP
+\fIpathName \fBget\fR
+Returns the entry's string.
+.TP
+\fIpathName \fBicursor \fIindex\fR
+Arrange for the insert cursor to be displayed just before the character
+given by \fIindex\fR. Returns the empty string.
+'\".TP
+'\"\fIpathName \fBidentify \fIx y\fR
+'\"Returns the name of the element at position \fIx\fR, \fIy\fR,
+'\"or the empty string if the coordinates are outside the window.
+.TP
+\fIpathName \fBindex\fI index\fR
+Returns the numerical index corresponding to \fIindex\fR.
+.TP
+\fIpathName \fBinsert \fIindex string\fR
+Insert \fIstring\fR just before the character
+indicated by \fIindex\fR. Returns the empty string.
+'\".TP
+'\"\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
+'\"Test the widget state.
+'\"See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBselection \fIoption arg\fR
+This command is used to adjust the selection within an entry. It
+has several forms, depending on \fIoption\fR:
+.RS
+.TP
+\fIpathName \fBselection clear\fR
+Clear the selection if it is currently in this widget.
+If the selection is not in this widget then the command has no effect.
+Returns the empty string.
+.TP
+\fIpathName \fBselection present\fR
+Returns 1 if there is are characters selected in the entry,
+0 if nothing is selected.
+.TP
+\fIpathName \fBselection range \fIstart\fR \fIend\fR
+Sets the selection to include the characters starting with
+the one indexed by \fIstart\fR and ending with the one just
+before \fIend\fR.
+If \fIend\fR refers to the same character as \fIstart\fR or an
+earlier one, then the entry's selection is cleared.
+.RE
+'\".TP
+'\"\fIpathName \fBstate\fR ?\fIstateSpec\fR?
+'\"Modify or query the widget state.
+'\"See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBvalidate\fR
+Force revalidation, independent of the conditions specified
+by the \fB\-validate\fR option.
+Returns 0 if validation fails, 1 if it succeeds.
+Sets or clears the \fBinvalid\fR state accordingly.
+See \fBVALIDATION\fR below for more details.
+.TP
+\fIpathName \fBxview \fIargs\fR
+This command is used to query and change the horizontal position of the
+text in the widget's window. It can take any of the following
+forms:
+.RS
+.TP
+\fIpathName \fBxview\fR
+Returns a list containing two elements.
+Each element is a real fraction between 0 and 1; together they describe
+the horizontal span that is visible in the window.
+For example, if the first element is .2 and the second element is .6,
+20% of the entry's text is off-screen to the left, the middle 40% is visible
+in the window, and 40% of the text is off-screen to the right.
+These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
+option.
+.TP
+\fIpathName \fBxview\fR \fIindex\fR
+Adjusts the view in the window so that the character given by \fIindex\fR
+is displayed at the left edge of the window.
+.TP
+\fIpathName \fBxview moveto\fI fraction\fR
+Adjusts the view in the window so that the character \fIfraction\fR of the
+way through the text appears at the left edge of the window.
+\fIFraction\fR must be a fraction between 0 and 1.
+.TP
+\fIpathName \fBxview scroll \fInumber what\fR
+This command shifts the view in the window left or right according to
+\fInumber\fR and \fIwhat\fR.
+\fINumber\fR must be an integer.
+\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
+'\" or an abbreviation of one of these, but we don't document that.
+If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
+\fInumber\fR average-width characters on the display; if it is
+\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
+If \fInumber\fR is negative then characters farther to the left
+become visible; if it is positive then characters farther to the right
+become visible.
+.RE
+.PP
+The entry widget also supports the following generic \fBttk::widget\fR
+widget subcommands (see \fIttk::widget(n)\fR for details):
+.DS
+.ta 5.5c 11c
+\fBcget\fR \fBconfigure\fR \fBidentify\fR
+\fBinstate\fR \fBstate\fR
+.DE
+.SH VALIDATION
+.PP
+The \fB\-validate\fR, \fB\-validatecommand\fR, and \fB\-invalidcommand\fR
+options are used to enable entry widget validation.
+.SS "VALIDATION MODES"
+.PP
+There are two main validation modes: \fIprevalidation\fR,
+in which the \fB\-validatecommand\fR is evaluated prior to each edit
+and the return value is used to determine whether to accept
+or reject the change;
+and \fIrevalidation\fR, in which the \fB\-validatecommand\fR is
+evaluated to determine whether the current value is valid.
+.PP
+The \fB\-validate\fR option determines when validation occurs;
+it may be set to any of the following values:
+.RS
+.IP \fBnone\fR
+Default. This means validation will only occur when
+specifically requested by the \fBvalidate\fR widget command.
+.IP \fBkey\fR
+The entry will be prevalidated prior to each edit
+(specifically, whenever the \fBinsert\fR or \fBdelete\fR
+widget commands are called).
+If prevalidation fails, the edit is rejected.
+.IP \fBfocus\fR
+The entry is revalidated when the entry receives or loses focus.
+.IP \fBfocusin\fR
+The entry is revalidated when the entry receives focus.
+.IP \fBfocusout\fR
+The entry is revalidated when the entry loses focus.
+.IP \fBall\fR
+Validation is performed for all above conditions.
+.RE
+.PP
+The \fB\-invalidcommand\fR is evaluated whenever
+the \fB\-validatecommand\fR returns a false value.
+.PP
+The \fB\-validatecommand\fR and \fB\-invalidcommand\fR
+may modify the entry widget's value
+via the widget \fBinsert\fR or \fBdelete\fR commands,
+or by setting the linked \fB\-textvariable\fR.
+If either does so during prevalidation,
+then the edit is rejected
+regardless of the value returned by the \fB\-validatecommand\fR.
+.PP
+If \fB\-validatecommand\fR is empty (the default),
+validation always succeeds.
+.SS "VALIDATION SCRIPT SUBSTITUTIONS"
+.PP
+It is possible to perform percent substitutions on the
+\fB\-validatecommand\fR and \fB\-invalidcommand\fR,
+just as in a \fBbind\fR script.
+The following substitutions are recognized:
+.RS
+.IP \fB%d\fR
+Type of action: 1 for \fBinsert\fR prevalidation,
+0 for \fBdelete\fR prevalidation,
+or \-1 for revalidation.
+.IP \fB%i\fR
+Index of character string to be inserted/deleted, if any, otherwise \-1.
+.IP \fB%P\fR
+In prevalidation, the new value of the entry if the edit is accepted.
+In revalidation, the current value of the entry.
+.IP \fB%s\fR
+The current value of entry prior to editing.
+.IP \fB%S\fR
+The text string being inserted/deleted, if any, {} otherwise.
+.IP \fB%v\fR
+The current value of the \fB\-validate\fR option.
+.IP \fB%V\fR
+The validation condition that triggered the callback
+(\fBkey\fR, \fBfocusin\fR, \fBfocusout\fR, or \fBforced\fR).
+.IP \fB%W\fR
+The name of the entry widget.
+.RE
+.SS "DIFFERENCES FROM TK ENTRY WIDGET VALIDATION"
+.PP
+The standard Tk entry widget automatically disables validation
+(by setting \fB\-validate\fR to \fBnone\fR)
+if the \fB\-validatecommand\fR or \fB\-invalidcommand\fR modifies
+the entry's value.
+The Tk themed entry widget only disables validation if one
+of the validation scripts raises an error, or if \fB\-validatecommand\fR
+does not return a valid boolean value.
+(Thus, it is not necessary to re-enable validation after
+modifying the entry value in a validation script).
+.PP
+In addition, the standard entry widget invokes validation whenever the linked
+\fB\-textvariable\fR is modified; the Tk themed entry widget does not.
+.SH "DEFAULT BINDINGS"
+.PP
+The entry widget's default bindings enable the following behavior.
+In the descriptions below,
+.QW word
+refers to a contiguous group of letters, digits, or
+.QW _
+characters, or any single character other than these.
+.IP \0\(bu 4
+Clicking mouse button 1 positions the insert cursor
+just before the character underneath the mouse cursor, sets the
+input focus to this widget, and clears any selection in the widget.
+Dragging with mouse button 1 down strokes out a selection between
+the insert cursor and the character under the mouse.
+.IP \0\(bu 4
+Double-clicking with mouse button 1 selects the word under the mouse
+and positions the insert cursor at the end of the word.
+Dragging after a double click strokes out a selection consisting
+of whole words.
+.IP \0\(bu 4
+Triple-clicking with mouse button 1 selects all of the text in the
+entry and positions the insert cursor at the end of the line.
+.IP \0\(bu 4
+The ends of the selection can be adjusted by dragging with mouse
+button 1 while the Shift key is down.
+If the button is double-clicked before dragging then the selection
+will be adjusted in units of whole words.
+.IP \0\(bu 4
+Clicking mouse button 1 with the Control key down will position the
+insert cursor in the entry without affecting the selection.
+.IP \0\(bu 4
+If any normal printing characters are typed in an entry, they are
+inserted at the point of the insert cursor.
+.IP \0\(bu 4
+The view in the entry can be adjusted by dragging with mouse button 2.
+If mouse button 2 is clicked without moving the mouse, the selection
+is copied into the entry at the position of the mouse cursor.
+.IP \0\(bu 4
+If the mouse is dragged out of the entry on the left or right sides
+while button 1 is pressed, the entry will automatically scroll to
+make more text visible (if there is more text off-screen on the side
+where the mouse left the window).
+.IP \0\(bu 4
+The Left and Right keys move the insert cursor one character to the
+left or right; they also clear any selection in the entry.
+If Left or Right is typed with the Shift key down, then the insertion
+cursor moves and the selection is extended to include the new character.
+Control-Left and Control-Right move the insert cursor by words, and
+Control-Shift-Left and Control-Shift-Right move the insert cursor
+by words and also extend the selection.
+Control-b and Control-f behave the same as Left and Right, respectively.
+.IP \0\(bu 4
+The Home key and Control-a move the insert cursor to the
+beginning of the entry and clear any selection in the entry.
+Shift-Home moves the insert cursor to the beginning of the entry
+and extends the selection to that point.
+.IP \0\(bu 4
+The End key and Control-e move the insert cursor to the
+end of the entry and clear any selection in the entry.
+Shift-End moves the cursor to the end and extends the selection
+to that point.
+.IP \0\(bu 4
+Control-/ selects all the text in the entry.
+.IP \0\(bu 4
+Control-\e clears any selection in the entry.
+.IP \0\(bu 4
+The standard Tk <<Cut>>, <<Copy>>, <<Paste>>, and <<Clear>>
+virtual events operate on the selection in the expected manner.
+.IP \0\(bu 4
+The Delete key deletes the selection, if there is one in the entry.
+If there is no selection, it deletes the character to the right of
+the insert cursor.
+.IP \0\(bu 4
+The BackSpace key and Control-h delete the selection, if there is one
+in the entry.
+If there is no selection, it deletes the character to the left of
+the insert cursor.
+.IP \0\(bu 4
+Control-d deletes the character to the right of the insert cursor.
+.IP \0\(bu 4
+Control-k deletes all the characters to the right of the insertion
+cursor.
+.SH "WIDGET STATES"
+.PP
+In the \fBdisabled\fR state,
+the entry cannot be edited and the text cannot be selected.
+In the \fBreadonly\fR state,
+no insert cursor is displayed and
+the entry cannot be edited
+(specifically: the \fBinsert\fR and \fBdelete\fR commands have no effect).
+The \fBdisabled\fR state is the same as \fBreadonly\fR,
+and in addition text cannot be selected.
+.PP
+Note that changes to the linked \fB\-textvariable\fR will
+still be reflected in the entry, even if it is disabled or readonly.
+.PP
+Typically, the text is
+.QW grayed-out
+in the \fBdisabled\fR state,
+and a different background is used in the \fBreadonly\fR state.
+.PP
+The entry widget sets the \fBinvalid\fR state if revalidation fails,
+and clears it whenever validation succeeds.
+.SH "SEE ALSO"
+ttk::widget(n), entry(n)
+.SH KEYWORDS
+entry, widget, text field
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_frame.n b/doc/ttk_frame.n
new file mode 100644
index 0000000..9dcf2dc
--- /dev/null
+++ b/doc/ttk_frame.n
@@ -0,0 +1,56 @@
+'\"
+'\" Copyright (c) 2005 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::frame n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::frame \- Simple container widget
+.SH SYNOPSIS
+\fBttk::frame\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::frame\fR widget is a container, used to group other widgets
+together.
+.SO ttk_widget
+\-class \-cursor \-takefocus
+\-style
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-borderwidth borderWidth BorderWidth
+The desired width of the widget border. Defaults to 0.
+.OP \-relief relief Relief
+One of the standard Tk border styles:
+\fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR,
+\fBsolid\fR, or \fBsunken\fR.
+Defaults to \fBflat\fR.
+.OP \-padding padding Padding
+Additional padding to include inside the border.
+.OP \-width width Width
+If specified, the widget's requested width in pixels.
+.OP \-height height Height
+If specified, the widget's requested height in pixels.
+.SH "WIDGET COMMAND"
+.PP
+Supports the standard widget commands
+\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
+see \fIttk::widget(n)\fR.
+.SH "NOTES"
+.PP
+Note that if the \fBpack\fR, \fBgrid\fR, or other geometry managers
+are used to manage the children of the \fBframe\fR,
+by the GM's requested size will normally take precedence
+over the \fBframe\fR widget's \fB\-width\fR and \fB\-height\fR options.
+\fBpack propagate\fR and \fBgrid propagate\fR can be used
+to change this.
+.SH "SEE ALSO"
+ttk::widget(n), ttk::labelframe(n), frame(n)
+.SH "KEYWORDS"
+widget, frame, container
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_image.n b/doc/ttk_image.n
new file mode 100644
index 0000000..3d8b13c
--- /dev/null
+++ b/doc/ttk_image.n
@@ -0,0 +1,82 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk_image n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk_image \- Define an element based on an image
+.SH SYNOPSIS
+\fBttk::style element create \fIname\fR \fBimage\fR \fIimageSpec\fR ?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+The \fIimage\fR element factory creates a new element
+in the current theme whose visual appearance is determined
+by Tk images.
+\fIimageSpec\fP is a list of one or more elements.
+The first element is the default image name.
+The rest of the list is a sequence of \fIstatespec / value\fR
+pairs specifying other images to use when the element is
+in a particular state or combination of states.
+.SH OPTIONS
+.PP
+Valid \fIoptions\fR are:
+.TP
+\fB\-border\fR \fIpadding\fR
+\fIpadding\fR is a list of up to four integers, specifying
+the left, top, right, and bottom borders, respectively.
+See \fBIMAGE STRETCHING\fR, below.
+.TP
+\fB\-height \fIheight\fR
+Specifies a minimum height for the element.
+If less than zero, the base image's height is used as a default.
+.TP
+\fB\-padding\fR \fIpadding\fR
+Specifies the element's interior padding. Defaults to
+\fB\-border\fR if not specified.
+.TP
+\fB\-sticky\fR \fIspec\fR
+Specifies how the image is placed within the final parcel.
+\fIspec\fR contains zero or more characters
+.QW n ,
+.QW s ,
+.QW w ,
+or
+.QW e .
+.TP
+\fB\-width \fIwidth\fR
+Specifies a minimum width for the element.
+If less than zero, the base image's width is used as a default.
+.SH "IMAGE STRETCHING"
+.PP
+If the element's allocated parcel is larger than the image,
+the image will be placed in the parcel based on the \fB\-sticky\fR option.
+If the image needs to stretch horizontally (i.e., \fB\-sticky ew\fR)
+or vertically (\fB\-sticky ns\fR),
+subregions of the image are replicated to fill the parcel
+based on the \fB\-border\fR option.
+The \fB\-border\fR divides the image into 9 regions:
+four fixed corners, top and left edges (which may be tiled horizontally),
+left and right edges (which may be tiled vertically),
+and the central area (which may be tiled in both directions).
+.SH "EXAMPLE"
+.PP
+.CS
+set img1 [image create photo \-file button.png]
+set img2 [image create photo \-file button-pressed.png]
+set img3 [image create photo \-file button-active.png]
+style element create Button.button image \e
+ [list $img1 pressed $img2 active $img3] \e
+ \-border {2 4} \-sticky we
+.CE
+.SH "SEE ALSO"
+ttk::intro(n), ttk::style(n), ttk_vsapi(n), image(n), photo(n)
+.SH KEYWORDS
+style, theme, appearance, pixmap theme, image
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n
new file mode 100644
index 0000000..cb0c440
--- /dev/null
+++ b/doc/ttk_intro.n
@@ -0,0 +1,177 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::intro n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::intro \- Introduction to the Tk theme engine
+.BE
+.SH "OVERVIEW"
+.PP
+The Tk themed widget set is based on a revised and enhanced version
+of TIP #48 (http://tip.tcl.tk/48) specified style engine.
+The main concepts are described below.
+The basic idea is to separate, to the extent possible,
+the code implementing a widget's behavior from
+the code implementing its appearance.
+Widget class bindings are primarily responsible for
+maintaining the widget state and invoking callbacks;
+all aspects of the widget's appearance are controlled by the style of
+the widget (i.e. the style of the elements of the widget).
+.SH "THEMES"
+.PP
+A \fItheme\fR is a collection of elements and styles
+that determine the look and feel of the widget set.
+Themes can be used to:
+.IP \(bu
+isolate platform differences (X11 vs. classic Windows vs. XP vs. Aqua ...)
+.IP \(bu
+adapt to display limitations (low-color, grayscale, monochrome, tiny screens)
+.IP \(bu
+accessibility (high contrast, large type)
+.IP \(bu
+application suite branding
+.IP \(bu
+blend in with the rest of the desktop (Gnome, KDE, Java)
+.IP \(bu
+and, of course: eye candy.
+.SH "ELEMENTS"
+.PP
+An \fIelement\fR displays an individual part of a widget.
+For example, a vertical scrollbar widget contains \fBuparrow\fR,
+\fBdownarrow\fR, \fBtrough\fR and \fBslider\fR elements.
+.PP
+Element names use a recursive dotted notation.
+For example, \fBuparrow\fR identifies a generic arrow element,
+and \fBScrollbar.uparrow\fR and \fBCombobox.uparrow\fR identify
+widget-specific elements.
+When looking for an element, the style engine looks for
+the specific name first, and if an element of that name is
+not found it looks for generic elements by stripping off
+successive leading components of the element name.
+.PP
+Like widgets, elements have \fIoptions\fR which
+specify what to display and how to display it.
+For example, the \fBtext\fR element
+(which displays a text string) has
+\fB\-text\fR, \fB\-font\fR, \fB\-foreground\fR, \fB\-background\fR,
+\fB\-underline\fR, and \fB\-width\fR options.
+The value of an element option is taken from:
+.IP \(bu
+an option of the same name and type in the widget containing the element;
+.IP \(bu
+a dynamic setting specified by \fBstyle map\fR and the current state;
+.IP \(bu
+the default setting specified by \fBstyle configure\fR; or
+.IP \(bu
+the element's built-in default value for the option.
+.SH "LAYOUTS"
+.PP
+A \fIlayout\fR specifies which elements make up a widget
+and how they are arranged.
+The layout engine uses a simplified version of the \fBpack\fR
+algorithm: starting with an initial cavity equal to the size
+of the widget, elements are allocated a parcel within the cavity along
+the side specified by the \fB\-side\fR option,
+and placed within the parcel according to the \fB\-sticky\fR
+option.
+For example, the layout for a horizontal scrollbar is:
+.PP
+.CS
+ttk::\fBstyle layout\fR Horizontal.TScrollbar {
+ Scrollbar.trough \-children {
+ Scrollbar.leftarrow \-side left \-sticky w
+ Scrollbar.rightarrow \-side right \-sticky e
+ Scrollbar.thumb \-side left \-expand true \-sticky ew
+ }
+}
+.CE
+.PP
+By default, the layout for a widget is the same as its class name.
+Some widgets may override this (for example, the \fBttk::scrollbar\fR
+widget chooses different layouts based on the \fB\-orient\fR option).
+.SH "STATES"
+.PP
+In standard Tk, many widgets have a \fB\-state\fR option
+which (in most cases) is either \fBnormal\fR or \fBdisabled\fR.
+Some widgets support additional states, such
+as the \fBentry\fR widget which has a \fBreadonly\fR state
+and the various flavors of buttons which have \fBactive\fR state.
+.PP
+The themed Tk widgets generalizes this idea:
+every widget has a bitmap of independent state flags.
+Widget state flags include \fBactive\fR, \fBdisabled\fR,
+\fBpressed\fR, \fBfocus\fR, etc.,
+(see \fIttk::widget(n)\fR for the full list of state flags).
+.PP
+Instead of a \fB\-state\fR option, every widget now has
+a \fBstate\fR widget command which is used to set or query
+the state.
+A \fIstate specification\fR is a list of symbolic state names
+indicating which bits are set, each optionally prefixed with an
+exclamation point indicating that the bit is cleared instead.
+.PP
+For example, the class bindings for the \fBttk::button\fR
+widget are:
+.PP
+.CS
+bind TButton <Enter> { %W state active }
+bind TButton <Leave> { %W state !active }
+bind TButton <ButtonPress-1> { %W state pressed }
+bind TButton <Button1-Leave> { %W state !pressed }
+bind TButton <Button1-Enter> { %W state pressed }
+bind TButton <ButtonRelease-1> \e
+ { %W instate {pressed} { %W state !pressed ; %W invoke } }
+.CE
+.PP
+This specifies that the widget becomes \fBactive\fR when
+the pointer enters the widget, and inactive when it leaves.
+Similarly it becomes \fBpressed\fR when the mouse button is pressed,
+and \fB!pressed\fR on the ButtonRelease event.
+In addition, the button unpresses if
+pointer is dragged outside the widget while Button-1 is held down,
+and represses if it's dragged back in.
+Finally, when the mouse button is released, the widget's
+\fB\-command\fR is invoked, but only if the button is currently
+in the \fBpressed\fR state.
+(The actual bindings are a little more complicated than the above,
+but not by much).
+'\" Note to self: rewrite that paragraph. It's horrible.
+.SH "STYLES"
+.PP
+Each widget is associated with a \fIstyle\fR,
+which specifies values for element options.
+Style names use a recursive dotted notation like layouts and elements;
+by default, widgets use the class name to look up a style in the current theme.
+For example:
+.PP
+.CS
+ttk::\fBstyle configure\fR TButton \e
+ \-background #d9d9d9 \e
+ \-foreground black \e
+ \-relief raised \e
+ ;
+.CE
+.PP
+Many elements are displayed differently depending on the widget state.
+For example, buttons have a different background when they are active,
+a different foreground when disabled, and a different relief when pressed.
+The \fBstyle map\fR command specifies dynamic option settings
+for a particular style:
+.PP
+.CS
+ttk::\fBstyle map\fR TButton \e
+ \-background [list disabled #d9d9d9 active #ececec] \e
+ \-foreground [list disabled #a3a3a3] \e
+ \-relief [list {pressed !disabled} sunken] \e
+ ;
+.CE
+.SH "SEE ALSO"
+ttk::widget(n), ttk::style(n)
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_label.n b/doc/ttk_label.n
new file mode 100644
index 0000000..66dafeb
--- /dev/null
+++ b/doc/ttk_label.n
@@ -0,0 +1,78 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::label n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::label \- Display a text string and/or image
+.SH SYNOPSIS
+\fBttk::label\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::label\fR widget displays a textual label and/or image.
+The label may be linked to a Tcl variable
+to automatically change the displayed text.
+.SO ttk_widget
+\-class \-compound \-cursor
+\-image \-style \-takefocus
+\-text \-textvariable \-underline
+\-width
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-anchor anchor Anchor
+Specifies how the information in the widget is positioned
+relative to the inner margins. Legal values are
+\fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR,
+\fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, and \fBcenter\fR.
+See also \fB\-justify\fR.
+.OP \-background frameColor FrameColor
+The widget's background color.
+If unspecified, the theme default is used.
+.OP \-font font Font
+Font to use for label text.
+.OP \-foreground textColor TextColor
+The widget's foreground color.
+If unspecified, the theme default is used.
+.OP \-justify justify Justify
+If there are multiple lines of text, specifies how
+the lines are laid out relative to one another.
+One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
+See also \fB\-anchor\fR.
+.OP \-padding padding Padding
+Specifies the amount of extra space to allocate for the widget.
+The padding is a list of up to four length specifications
+\fIleft top right bottom\fR.
+If fewer than four elements are specified,
+\fIbottom\fR defaults to \fItop\fR,
+\fIright\fR defaults to \fIleft\fR, and
+\fItop\fR defaults to \fIleft\fR.
+.OP \-relief relief Relief
+.\" Rewrite this:
+Specifies the 3-D effect desired for the widget border.
+Valid values are
+\fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, \fBsolid\fR,
+and \fBsunken\fR.
+.OP \-text text Text
+Specifies a text string to be displayed inside the widget
+(unless overridden by \fB\-textvariable\fR).
+.OP \-wraplength wrapLength WrapLength
+Specifies the maximum line length (in pixels).
+If this option is less than or equal to zero,
+then automatic wrapping is not performed; otherwise
+the text is split into lines such that no line is longer
+than the specified value.
+.SH "WIDGET COMMAND"
+.PP
+Supports the standard widget commands
+\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
+see \fIttk::widget(n)\fR.
+.SH "SEE ALSO"
+ttk::widget(n), label(n)
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_labelframe.n b/doc/ttk_labelframe.n
new file mode 100644
index 0000000..e782f87
--- /dev/null
+++ b/doc/ttk_labelframe.n
@@ -0,0 +1,76 @@
+'\"
+'\" Copyright (c) 2005 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::labelframe n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::labelframe \- Container widget with optional label
+.SH SYNOPSIS
+\fBttk::labelframe\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::labelframe\fR widget is a container used to group other widgets
+together. It has an optional label, which may be a plain text string or
+another widget.
+.SO ttk_widget
+\-class \-cursor \-takefocus
+\-style
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.\" XXX: Currently included, but may go away:
+.\" XXX: .OP -borderwidth borderWidth BorderWidth
+.\" XXX: The desired width of the widget border. Default is theme-dependent.
+.\" XXX: .OP -relief relief Relief
+.\" XXX: One of the standard Tk border styles:
+.\" XXX: \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR,
+.\" XXX: \fBsolid\fR, or \fBsunken\fR.
+.\" XXX: Default is theme-dependent.
+.OP \-labelanchor labelAnchor LabelAnchor
+Specifies where to place the label.
+Allowed values are (clockwise from the top upper left corner):
+\fBnw\fR, \fBn\fR, \fBne\fR, \fBen\fR, \fBe\fR, \fBes\fR,
+\fBse\fR, \fBs\fR,\fBsw\fR, \fBws\fR, \fBw\fR and \fBwn\fR.
+The default value is theme-dependent.
+.\" Alternate explanation: The first character must be one of n, s, e, or w
+.\" and specifies which side the label should be placed on;
+.\" the remaining characters specify how the label is aligned on that side.
+.\" NOTE: Now allows other values as well; leave this undocumented for now
+.OP \-text text Text
+Specifies the text of the label.
+.OP \-underline underline Underline
+If set, specifies the integer index (0-based) of a character to
+underline in the text string.
+The underlined character is used for mnemonic activation.
+Mnemonic activation for a \fBttk::labelframe\fR
+sets the keyboard focus to the first child of the \fBttk::labelframe\fR widget.
+.OP \-padding padding Padding
+Additional padding to include inside the border.
+.OP \-labelwidget labelWidget LabelWidget
+The name of a widget to use for the label.
+If set, overrides the \fB\-text\fR option.
+The \fB\-labelwidget\fR must be a child of the \fBlabelframe\fR widget
+or one of the \fBlabelframe\fR's ancestors, and must belong to the
+same top-level widget as the \fBlabelframe\fR.
+.OP \-width width Width
+If specified, the widget's requested width in pixels.
+.OP \-height height Height
+If specified, the widget's requested height in pixels.
+(See \fIttk::frame(n)\fR for further notes on \fB\-width\fR and
+\fB\-height\fR).
+.SH "WIDGET COMMAND"
+.PP
+Supports the standard widget commands
+\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
+see \fIttk::widget(n)\fR.
+.SH "SEE ALSO"
+ttk::widget(n), ttk::frame(n), labelframe(n)
+.SH "KEYWORDS"
+widget, frame, container, label, groupbox
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_menubutton.n b/doc/ttk_menubutton.n
new file mode 100644
index 0000000..99b7c4d
--- /dev/null
+++ b/doc/ttk_menubutton.n
@@ -0,0 +1,54 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::menubutton n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::menubutton \- Widget that pops down a menu when pressed
+.SH SYNOPSIS
+\fBttk::menubutton\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::menubutton\fR widget displays a textual label and/or image,
+and displays a menu when pressed.
+.SO ttk_widget
+\-class \-compound \-cursor
+\-image \-state \-style
+\-takefocus \-text \-textvariable
+\-underline \-width
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-direction direction Direction
+Specifies where the menu is to be popped up relative
+to the menubutton.
+One of: \fBabove\fR, \fBbelow\fR, \fBleft\fR, \fBright\fR,
+or \fBflush\fR. The default is \fBbelow\fR.
+\fBflush\fR pops the menu up directly over the menubutton.
+.OP \-menu menu Menu
+Specifies the path name of the menu associated with the menubutton.
+To be on the safe side, the menu ought to be a direct child of the
+menubutton.
+.\" not documented: may go away:
+.\" .OP \-anchor anchor Anchor
+.\" .OP \-padding padding Pad
+.SH "WIDGET COMMAND"
+.PP
+Menubutton widgets support the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
+methods. No other widget methods are used.
+.SH "STANDARD STYLES"
+.PP
+\fBTtk::menubutton\fR widgets support the \fBToolbutton\fR style in all
+standard themes, which is useful for creating widgets for toolbars.
+.SH "SEE ALSO"
+ttk::widget(n), menu(n), menubutton(n)
+.SH "KEYWORDS"
+widget, button, menu
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_notebook.n b/doc/ttk_notebook.n
new file mode 100644
index 0000000..c0de39e
--- /dev/null
+++ b/doc/ttk_notebook.n
@@ -0,0 +1,213 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::notebook n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::notebook \- Multi-paned container widget
+.SH SYNOPSIS
+.nf
+\fBttk::notebook\fR \fIpathname \fR?\fIoptions...\fR?
+.br
+\fIpathname \fBadd\fR \fIwindow\fR ?\fIoptions...\fR?
+\fIpathname \fBinsert\fR \fIindex\fR \fIwindow\fR ?\fIoptions...\fR?
+.fi
+.BE
+.SH DESCRIPTION
+A \fBttk::notebook\fR widget manages a collection of windows
+and displays a single one at a time.
+Each slave window is associated with a \fItab\fR,
+which the user may select to change the currently-displayed window.
+.SO ttk_widget
+\-class \-cursor \-takefocus
+\-style
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-height height Height
+If present and greater than zero,
+specifies the desired height of the pane area
+(not including internal padding or tabs).
+Otherwise, the maximum height of all panes is used.
+.OP \-padding padding Padding
+Specifies the amount of extra space to add around the outside
+of the notebook.
+The padding is a list of up to four length specifications
+\fIleft top right bottom\fR.
+If fewer than four elements are specified,
+\fIbottom\fR defaults to \fItop\fR,
+\fIright\fR defaults to \fIleft\fR, and
+\fItop\fR defaults to \fIleft\fR.
+.OP \-width width Width
+If present and greater than zero,
+specifies the desired width of the pane area
+(not including internal padding).
+Otherwise, the maximum width of all panes is used.
+.SH "TAB OPTIONS"
+The following options may be specified for individual notebook panes:
+.OP \-state state State
+Either \fBnormal\fR, \fBdisabled\fR or \fBhidden\fR.
+If \fBdisabled\fR, then the tab is not selectable.
+If \fBhidden\fR, then the tab is not shown.
+.OP \-sticky sticky Sticky
+Specifies how the slave window is positioned within the pane area.
+Value is a string containing zero or more of the characters
+\fBn, s, e,\fR or \fBw\fR.
+Each letter refers to a side (north, south, east, or west)
+that the slave window will
+.QW stick
+to, as per the \fBgrid\fR geometry manager.
+.OP \-padding padding Padding
+Specifies the amount of extra space to add between the notebook and this pane.
+Syntax is the same as for the widget \fB\-padding\fR option.
+.OP \-text text Text
+Specifies a string to be displayed in the tab.
+.OP \-image image Image
+Specifies an image to display in the tab.
+See \fIttk_widget(n)\fR for details.
+.OP \-compound compound Compound
+Specifies how to display the image relative to the text,
+in the case both \fB\-text\fR and \fB\-image\fR are present.
+See \fIlabel(n)\fR for legal values.
+.OP \-underline underline Underline
+Specifies the integer index (0-based) of a character to underline
+in the text string.
+The underlined character is used for mnemonic activation
+if \fBttk::notebook::enableTraversal\fR is called.
+.SH "TAB IDENTIFIERS"
+The \fItabid\fR argument to the following commands may take
+any of the following forms:
+.IP \(bu
+An integer between zero and the number of tabs;
+.IP \(bu
+The name of a slave window;
+.IP \(bu
+A positional specification of the form
+.QW @\fIx\fR,\fIy\fR ,
+which identifies the tab
+.IP \(bu
+The literal string
+.QW \fBcurrent\fR ,
+which identifies the currently-selected tab; or:
+.IP \(bu
+The literal string
+.QW \fBend\fR ,
+which returns the number of tabs
+(only valid for
+.QW "\fIpathname \fBindex\fR" ).
+.SH "WIDGET COMMAND"
+.TP
+\fIpathname \fBadd\fR \fIwindow\fR ?\fIoptions...\fR?
+Adds a new tab to the notebook.
+See \fBTAB OPTIONS\fR for the list of available \fIoptions\fR.
+If \fIwindow\fR is currently managed by the notebook but hidden,
+it is restored to its previous position.
+.TP
+\fIpathname \fBconfigure\fR ?\fIoptions\fR?
+See \fIttk::widget(n)\fR.
+.TP
+\fIpathname \fBcget\fR \fIoption\fR
+See \fIttk::widget(n)\fR.
+.TP
+\fIpathname \fBforget\fR \fItabid\fR
+Removes the tab specified by \fItabid\fR,
+unmaps and unmanages the associated window.
+.TP
+\fIpathname \fBhide\fR \fItabid\fR
+Hides the tab specified by \fItabid\fR.
+The tab will not be displayed, but the associated window
+remains managed by the notebook and its configuration remembered.
+Hidden tabs may be restored with the \fBadd\fR command.
+.TP
+\fIpathname \fBidentify\fR \fIcomponent\fR \fIx\fR \fIy\fR
+Returns the name of the element under the point given by \fIx\fR and \fIy\fR,
+or the empty string if no component is present at that location.
+The following subcommands are supported:
+.RS
+.TP
+\fIpathname \fBidentify\fR \fBelement\fR \fIx\fR \fIy\fR
+Returns the name of the element at the specified location.
+.TP
+\fIpathname \fBidentify\fR \fBtab\fR \fIx\fR \fIy\fR
+Returns the index of the tab at the specified location.
+.RE
+.TP
+\fIpathname \fBindex\fR \fItabid\fR
+Returns the numeric index of the tab specified by \fItabid\fR,
+or the total number of tabs if \fItabid\fR is the string
+.QW \fBend\fR .
+.TP
+\fIpathname \fBinsert\fR \fIpos\fR \fIsubwindow\fR \fIoptions...\fR
+Inserts a pane at the specified position.
+\fIpos\fR is either the string \fBend\fR, an integer index,
+or the name of a managed subwindow.
+If \fIsubwindow\fR is already managed by the notebook,
+moves it to the specified position.
+See \fBTAB OPTIONS\fR for the list of available options.
+.TP
+\fIpathname \fBinstate\fR \fIstatespec \fR?\fIscript...\fR?
+See \fIttk::widget(n)\fR.
+.TP
+\fIpathname \fBselect\fR ?\fItabid\fR?
+Selects the specified tab.
+The associated slave window will be displayed,
+and the previously-selected window (if different) is unmapped.
+If \fItabid\fR is omitted, returns the widget name of the
+currently selected pane.
+.TP
+\fIpathname \fBstate\fR ?\fIstatespec\fR?
+See \fIttk::widget(n)\fR.
+.TP
+\fIpathname \fBtab\fR \fItabid\fR ?\fI\-option \fR?\fIvalue ...\fR
+Query or modify the options of the specific tab.
+If no \fI\-option\fR is specified,
+returns a dictionary of the tab option values.
+If one \fI\-option\fR is specified,
+returns the value of that \fIoption\fR.
+Otherwise, sets the \fI\-option\fRs to the corresponding \fIvalue\fRs.
+See \fBTAB OPTIONS\fR for the available options.
+.TP
+\fIpathname \fBtabs\fR
+Returns the list of windows managed by the notebook.
+.SH "KEYBOARD TRAVERSAL"
+To enable keyboard traversal for a toplevel window
+containing a notebook widget \fI$nb\fR, call:
+.CS
+ttk::notebook::enableTraversal $nb
+.CE
+.PP
+This will extend the bindings for the toplevel window
+containing the notebook as follows:
+.IP \(bu
+\fBControl-Tab\fR selects the tab following the currently selected one.
+.IP \(bu
+\fBShift-Control-Tab\fR selects the tab preceding the currently selected one.
+.IP \(bu
+\fBAlt-K\fR, where \fBK\fR is the mnemonic (underlined) character
+of any tab, will select that tab.
+.PP
+Multiple notebooks in a single toplevel may be enabled for traversal,
+including nested notebooks.
+However, notebook traversal only works properly if all panes
+are direct children of the notebook.
+.SH "VIRTUAL EVENTS"
+The notebook widget generates a \fB<<NotebookTabChanged>>\fR
+virtual event after a new tab is selected.
+.SH "EXAMPLE"
+.CS
+pack [\fBttk::notebook\fR .nb]
+\&.nb add [frame .nb.f1] \-text "First tab"
+\&.nb add [frame .nb.f2] \-text "Second tab"
+\&.nb select .nb.f2
+ttk::notebook::enableTraversal .nb
+.CE
+.SH "SEE ALSO"
+ttk::widget(n), grid(n)
+.SH "KEYWORDS"
+pane, tab
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_panedwindow.n b/doc/ttk_panedwindow.n
new file mode 100644
index 0000000..c5851c3
--- /dev/null
+++ b/doc/ttk_panedwindow.n
@@ -0,0 +1,112 @@
+'\"
+'\" Copyright (c) 2005 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::panedwindow n 8.5.9 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::panedwindow \- Multi-pane container window
+.SH SYNOPSIS
+.nf
+\fBttk::panedwindow\fR \fIpathname \fR?\fIoptions\fR?
+.br
+\fIpathname \fBadd\fR \fIwindow\fR ?\fIoptions...\fR?
+\fIpathname \fBinsert\fR \fIindex\fR \fIwindow\fR ?\fIoptions...\fR?
+.fi
+.BE
+.SH DESCRIPTION
+A \fBttk::panedwindow\fR widget displays a number of subwindows,
+stacked either vertically or horizontally.
+The user may adjust the relative sizes of the subwindows
+by dragging the sash between panes.
+.SO ttk_widget
+\-class \-cursor \-takefocus
+\-style
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-orient orient Orient
+Specifies the orientation of the window.
+If \fBvertical\fR, subpanes are stacked top-to-bottom;
+if \fBhorizontal\fR, subpanes are stacked left-to-right.
+.OP \-width width Width
+If present and greater than zero,
+specifies the desired width of the widget in pixels.
+Otherwise, the requested width is determined by the width
+of the managed windows.
+.OP \-height height Height
+If present and greater than zero,
+specifies the desired height of the widget in pixels.
+Otherwise, the requested height is determined by the height
+of the managed windows.
+.SH "PANE OPTIONS"
+The following options may be specified for each pane:
+.OP \-weight weight Weight
+An integer specifying the relative stretchability of the pane.
+When the paned window is resized, the extra space is added
+or subtracted to each pane proportionally to its \fB\-weight\fR.
+.SH "WIDGET COMMAND"
+Supports the standard \fBconfigure\fR, \fBcget\fR, \fBstate\fR,
+and \fBinstate\fR commands; see \fIttk::widget(n)\fR for details.
+Additional commands:
+.TP
+\fIpathname\fR \fBadd\fR \fIsubwindow\fR \fIoptions...\fR
+Adds a new pane to the window.
+See \fBPANE OPTIONS\fR for the list of available options.
+.TP
+\fIpathname\fR \fBforget\fR \fIpane\fR
+Removes the specified subpane from the widget.
+\fIpane\fR is either an integer index or the name of a managed subwindow.
+.TP
+\fIpathname\fR \fBidentify\fR \fIcomponent\fR \fIx\fR \fIy\fR
+Returns the name of the element under the point given by \fIx\fR and \fIy\fR,
+or the empty string if no component is present at that location.
+If \fIcomponent\fR is omitted, it defaults to \fBsash\fR.
+The following subcommands are supported:
+.RS
+.TP
+\fIpathname\fR \fBidentify\fR \fBelement\fR \fIx\fR \fIy\fR
+Returns the name of the element at the specified location.
+.TP
+\fIpathname\fR \fBidentify\fR \fBsash\fR \fIx\fR \fIy\fR
+Returns the index of the sash at the specified location.
+.RE
+.TP
+\fIpathname\fR \fBinsert\fR \fIpos\fR \fIsubwindow\fR \fIoptions...\fR
+Inserts a pane at the specified position.
+\fIpos\fR is either the string \fBend\fR, an integer index,
+or the name of a managed subwindow.
+If \fIsubwindow\fR is already managed by the paned window,
+moves it to the specified position.
+See \fBPANE OPTIONS\fR for the list of available options.
+.TP
+\fIpathname\fR \fBpane\fR \fIpane \-option \fR?\fIvalue \fR?\fI\-option value...\fR
+Query or modify the options of the specified \fIpane\fR,
+where \fIpane\fR is either an integer index or the name of a managed subwindow.
+If no \fI\-option\fR is specified, returns a dictionary of the pane
+option values.
+If one \fI\-option\fR is specified, returns the value of that \fIoption\fR.
+Otherwise, sets the \fI\-option\fRs to the corresponding \fIvalue\fRs.
+.TP
+\fIpathname\fR \fBpanes\fR
+Returns the list of all windows managed by the widget.
+.TP
+\fIpathname\fR \fBsashpos\fR \fIindex\fR ?\fInewpos\fR?
+If \fInewpos\fR is specified, sets the position
+of sash number \fIindex\fR.
+May adjust the positions of adjacent sashes
+to ensure that positions are monotonically increasing.
+Sash positions are further constrained to be between 0
+and the total size of the widget.
+.\" Full story: "total size" is either the -height (resp -width),
+.\" or the actual window height (resp actual window width),
+.\" depending on which changed most recently.
+Returns the new position of sash number \fIindex\fR.
+.\" Full story: new position may be different than the requested position.
+.SH "SEE ALSO"
+ttk::widget(n), ttk::notebook(n), panedwindow(n)
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_progressbar.n b/doc/ttk_progressbar.n
new file mode 100644
index 0000000..9381c61
--- /dev/null
+++ b/doc/ttk_progressbar.n
@@ -0,0 +1,93 @@
+'\"
+'\" Copyright (c) 2005 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::progressbar n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::progressbar \- Provide progress feedback
+.SH SYNOPSIS
+\fBttk::progressbar\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::progressbar\fR widget shows the status of a long-running
+operation. They can operate in two modes: \fIdeterminate\fR mode shows the
+amount completed relative to the total amount of work to be done, and
+\fIindeterminate\fR mode provides an animated display to let the user know
+that something is happening.
+.SO ttk_widget
+\-class \-cursor \-takefocus
+\-style
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-orient orient Orient
+One of \fBhorizontal\fR or \fBvertical\fR.
+Specifies the orientation of the progress bar.
+.OP \-length length Length
+Specifies the length of the long axis of the progress bar
+(width if horizontal, height if vertical).
+.OP \-mode mode Mode
+One of \fBdeterminate\fR or \fBindeterminate\fR.
+.OP \-maximum maximum Maximum
+A floating point number specifying the maximum \fB\-value\fR.
+Defaults to 100.
+.OP \-value value Value
+The current value of the progress bar.
+In \fIdeterminate\fR mode, this represents the amount of work completed.
+In \fIindeterminate\fR mode, it is interpreted modulo \fB\-maximum\fR;
+that is, the progress bar completes one
+.QW cycle
+when the \fB\-value\fR increases by \fB\-maximum\fR.
+.OP \-variable variable Variable
+The name of a global Tcl variable which is linked to the \fB\-value\fR.
+If specified, the \fB\-value\fR of the progress bar is
+automatically set to the value of the variable whenever
+the latter is modified.
+.OP \-phase phase Phase
+Read-only option.
+The widget periodically increments the value of this option
+whenever the \fB\-value\fR is greater than 0 and,
+in \fIdeterminate\fR mode, less than \fB\-maximum\fR.
+This option may be used by the current theme
+to provide additional animation effects.
+.SH "WIDGET COMMAND"
+.PP
+.TP
+\fIpathName \fBcget\fR \fIoption\fR
+Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+Modify or query widget options; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBidentify\fR \fIx y\fR
+Returns the name of the element at position \fIx\fR, \fIy\fR.
+See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
+Test the widget state; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBstart\fR ?\fIinterval\fR?
+Begin autoincrement mode:
+schedules a recurring timer event that calls \fBstep\fR
+every \fIinterval\fR milliseconds.
+If omitted, \fIinterval\fR defaults to 50 milliseconds (20 steps/second).
+.TP
+\fIpathName \fBstate\fR ?\fIstateSpec\fR?
+Modify or query the widget state; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBstep\fR ?\fIamount\fR?
+Increments the \fB\-value\fR by \fIamount\fR.
+\fIamount\fR defaults to 1.0 if omitted.
+.TP
+\fIpathName \fBstop\fR
+Stop autoincrement mode:
+cancels any recurring timer event initiated by \fIpathName \fBstart\fR.
+.SH "SEE ALSO"
+ttk::widget(n)
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_radiobutton.n b/doc/ttk_radiobutton.n
new file mode 100644
index 0000000..cbea359
--- /dev/null
+++ b/doc/ttk_radiobutton.n
@@ -0,0 +1,74 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::radiobutton n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::radiobutton \- Mutually exclusive option widget
+.SH SYNOPSIS
+\fBttk::radiobutton\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+\fBttk::radiobutton\fR widgets are used in groups to show or change
+a set of mutually-exclusive options.
+Radiobuttons are linked to a Tcl variable,
+and have an associated value; when a radiobutton is clicked,
+it sets the variable to its associated value.
+.SO ttk_widget
+\-class \-compound \-cursor
+\-image \-state \-style
+\-takefocus \-text \-textvariable
+\-underline \-width
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-command command Command
+A Tcl script to evaluate whenever the widget is invoked.
+.OP \-value Value Value
+The value to store in the associated \fI\-variable\fR
+when the widget is selected.
+.OP \-variable variable Variable
+The name of a global variable whose value is linked to the widget.
+Default value is \fB::selectedButton\fR.
+.SH "WIDGET COMMAND"
+.PP
+In addition to the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
+commands, radiobuttons support the following additional
+widget commands:
+.TP
+\fIpathname\fB invoke\fR
+Sets the \fB\-variable\fR to the \fB\-value\fR, selects the widget,
+and evaluates the associated \fB\-command\fR.
+Returns the result of the \fB\-command\fR, or the empty
+string if no \fB\-command\fR is specified.
+.\" Missing: select, deselect. Useful?
+.\" Missing: flash. This is definitely not useful.
+.SH "WIDGET STATES"
+.PP
+The widget does not respond to user input if the \fBdisabled\fR state is set.
+The widget sets the \fBselected\fR state whenever
+the linked \fB\-variable\fR is set to the widget's \fB\-value\fR,
+and clears it otherwise.
+The widget sets the \fBalternate\fR state whenever the
+linked \fB\-variable\fR is unset.
+(The \fBalternate\fR state may be used to indicate a
+.QW tri-state
+or
+.QW indeterminate
+selection.)
+.SH "STANDARD STYLES"
+.PP
+\fBTtk::radiobutton\fR widgets support the \fBToolbutton\fR style in all
+standard themes, which is useful for creating widgets for toolbars.
+.SH "SEE ALSO"
+ttk::widget(n), ttk::checkbutton(n), radiobutton(n)
+.SH "KEYWORDS"
+widget, button, option
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_scale.n b/doc/ttk_scale.n
new file mode 100644
index 0000000..2fd485b
--- /dev/null
+++ b/doc/ttk_scale.n
@@ -0,0 +1,101 @@
+.\"
+.\" Copyright (c) 2008 Donal Fellows
+.\"
+.\" See the file "license.terms" for information on usage and redistribution
+.\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+.\"
+.so man.macros
+.TH ttk::scale n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::scale \- Create and manipulate a scale widget
+.SH SYNOPSIS
+\fBttk::scale \fIpathName \fR?\fIoptions...\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::scale\fR widget is typically used to control the numeric value of a
+linked variable that varies uniformly over some range. A scale displays a
+\fIslider\fR that can be moved along over a \fItrough\fR, with the relative
+position of the slider over the trough indicating the value of the variable.
+.SO ttk_widget
+\-class \-cursor \-style
+\-takefocus
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-command command Command
+Specifies the prefix of a Tcl command to invoke whenever the scale's value is
+changed via a widget command. The actual command consists of this option
+followed by a space and a real number indicating the new value of the scale.
+.OP \-from from From
+A real value corresponding to the left or top end of the scale.
+.OP \-length length Length
+Specifies the desired long dimension of the scale in screen units (i.e. any of
+the forms acceptable to \fBTk_GetPixels\fR). For vertical scales this is the
+scale's height; for horizontal scales it is the scale's width.
+.OP \-orient orient Orient
+Specifies which orientation whether the widget should be laid out horizontally
+or vertically. Must be either \fBhorizontal\fR or \fBvertical\fR or an
+abbreviation of one of these.
+.OP \-to to To
+Specifies a real value corresponding to the right or bottom end of the scale.
+This value may be either less than or greater than the \fBfrom\fR option.
+.OP \-value value Value
+Specifies the current floating-point value of the variable.
+.OP \-variable variable Variable
+Specifies the name of a global variable to link to the scale. Whenever the
+value of the variable changes, the scale will update to reflect this value.
+Whenever the scale is manipulated interactively, the variable will be modified
+to reflect the scale's new value.
+.SH "WIDGET COMMAND"
+.PP
+.TP
+\fIpathName \fBcget \fIoption\fR
+.
+Returns the current value of the specified \fIoption\fR; see
+\fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBconfigure \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
+Modify or query widget options; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBget \fR?\fIx y\fR?
+.
+Get the current value of the \fB\-value\fR option, or the value corresponding
+to the coordinates \fIx,y\fR if they are specified. \fIX\fR and \fIy\fR are
+pixel coordinates relative to the scale widget origin.
+.TP
+\fIpathName \fBidentify\fR \fIx y\fR
+Returns the name of the element at position \fIx\fR, \fIy\fR.
+See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
+.
+Test the widget state; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBset \fIvalue\fR
+.
+Set the value of the widget (i.e. the \fB\-value\fR option) to \fIvalue\fR.
+The value will be clipped to the range given by the \fB\-from\fR and
+\fB\-to\fR options. Note that setting the linked variable (i.e. the variable
+named in the \fB\-variable\fR option) does not cause such clipping.
+.TP
+\fIpathName \fBstate\fR ?\fIstateSpec\fR?
+.
+Modify or query the widget state; see \fIttk::widget(n)\fR.
+.SH "INTERNAL COMMANDS"
+.PP
+.TP
+\fIpathName \fBcoords \fR?\fIvalue\fR?
+.
+Get the coordinates corresponding to \fIvalue\fR, or the coordinates
+corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR
+is omitted.
+.SH "SEE ALSO"
+ttk::widget(n), scale(n)
+.SH KEYWORDS
+scale, slider, trough, widget
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 78
+.\" End:
diff --git a/doc/ttk_scrollbar.n b/doc/ttk_scrollbar.n
new file mode 100644
index 0000000..ce9eeed
--- /dev/null
+++ b/doc/ttk_scrollbar.n
@@ -0,0 +1,163 @@
+'\"
+'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::scrollbar n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::scrollbar \- Control the viewport of a scrollable widget
+.SH SYNOPSIS
+\fBttk::scrollbar\fR \fIpathName \fR?\fIoptions...\fR?
+.BE
+.SH DESCRIPTION
+.PP
+\fBttk::scrollbar\fR widgets are typically linked to an associated window
+that displays a document of some sort, such as a file being edited or a
+drawing.
+A scrollbar displays a \fIthumb\fR in the middle portion of the scrollbar,
+whose position and size provides information about the portion of the
+document visible in the associated window.
+The thumb may be dragged by the user to control the visible region.
+Depending on the theme, two or more arrow buttons may also be present;
+these are used to scroll the visible region in discrete units.
+.SO ttk_widget
+\-class \-cursor \-style
+\-takefocus
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-command command Command
+A Tcl script prefix to evaluate
+to change the view in the widget associated with the scrollbar.
+Additional arguments are appended to the value of this option,
+as described in \fBSCROLLING COMMANDS\fR below,
+whenever the user requests a view change by manipulating the scrollbar.
+.RS
+.PP
+This option typically consists of a two-element list,
+containing the name of a scrollable widget followed by
+either \fBxview\fR (for horizontal scrollbars)
+or \fByview\fR (for vertical scrollbars).
+.RE
+.OP \-orient orient Orient
+One of \fBhorizontal\fR or \fBvertical\fR.
+Specifies the orientation of the scrollbar.
+.SH "WIDGET COMMAND"
+.PP
+.TP
+\fIpathName \fBcget\fR \fIoption\fR
+Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+Modify or query widget options; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBget\fR
+Returns the scrollbar settings in the form of a list whose
+elements are the arguments to the most recent \fBset\fR widget command.
+.TP
+\fIpathName \fBidentify\fR \fIx y\fR
+Returns the name of the element at position \fIx\fR, \fIy\fR.
+See \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
+Test the widget state; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBset\fR \fIfirst last\fR
+This command is normally invoked by the scrollbar's associated widget
+from an \fB\-xscrollcommand\fR or \fB\-yscrollcommand\fR callback.
+Specifies the visible range to be displayed.
+\fIfirst\fR and \fIlast\fR are real fractions between 0 and 1.
+.TP
+\fIpathName \fBstate\fR ?\fIstateSpec\fR?
+Modify or query the widget state; see \fIttk::widget(n)\fR.
+.SH "INTERNAL COMMANDS"
+.PP
+The following widget commands are used internally
+by the TScrollbar widget class bindings.
+.TP
+\fIpathName \fBdelta \fIdeltaX deltaY\fR
+Returns a real number indicating the fractional change in
+the scrollbar setting that corresponds to a given change
+in thumb position. For example, if the scrollbar is horizontal,
+the result indicates how much the scrollbar setting must change
+to move the thumb \fIdeltaX\fR pixels to the right (\fIdeltaY\fR is
+ignored in this case).
+If the scrollbar is vertical, the result indicates how much the
+scrollbar setting must change to move the thumb \fIdeltaY\fR pixels
+down. The arguments and the result may be zero or negative.
+.TP
+\fIpathName \fBfraction \fIx y\fR
+Returns a real number between 0 and 1 indicating where the point
+given by \fIx\fR and \fIy\fR lies in the trough area of the scrollbar,
+where 0.0 corresponds to the top or left of the trough
+and 1.0 corresponds to the bottom or right.
+\fIX\fR and \fIy\fR are pixel coordinates relative to the scrollbar
+widget.
+If \fIx\fR and \fIy\fR refer to a point outside the trough, the closest
+point in the trough is used.
+.SH "SCROLLING COMMANDS"
+.PP
+When the user interacts with the scrollbar, for example by dragging
+the thumb, the scrollbar notifies the associated widget that it
+must change its view.
+The scrollbar makes the notification by evaluating a Tcl command
+generated from the scrollbar's \fB\-command\fR option.
+The command may take any of the following forms.
+In each case, \fIprefix\fR is the contents of the
+\fB\-command\fR option, which usually has a form like \fB.t yview\fR
+.TP
+\fIprefix \fBmoveto \fIfraction\fR
+\fIFraction\fR is a real number between 0 and 1.
+The widget should adjust its view so that the point given
+by \fIfraction\fR appears at the beginning of the widget.
+If \fIfraction\fR is 0 it refers to the beginning of the
+document. 1.0 refers to the end of the document, 0.333
+refers to a point one-third of the way through the document,
+and so on.
+.TP
+\fIprefix \fBscroll \fInumber \fBunits\fR
+The widget should adjust its view by \fInumber\fR units.
+The units are defined in whatever way makes sense for the widget,
+such as characters or lines in a text widget.
+\fINumber\fR is either 1, which means one unit should scroll off
+the top or left of the window, or \-1, which means that one unit
+should scroll off the bottom or right of the window.
+.TP
+\fIprefix \fBscroll \fInumber \fBpages\fR
+The widget should adjust its view by \fInumber\fR pages.
+It is up to the widget to define the meaning of a page; typically
+it is slightly less than what fits in the window, so that there
+is a slight overlap between the old and new views.
+\fINumber\fR is either 1, which means the next page should
+become visible, or \-1, which means that the previous page should
+become visible.
+.SH "WIDGET STATES"
+.PP
+The scrollbar automatically sets the \fBdisabled\fR state bit.
+when the entire range is visible (range is 0.0 to 1.0),
+and clears it otherwise.
+It also sets the \fBactive\fR and \fBpressed\fR state flags
+of individual elements, based on the position and state of the mouse pointer.
+.SH EXAMPLE
+.PP
+.CS
+set f [frame .f]
+ttk::scrollbar $f.hsb \-orient horizontal \-command [list $f.t xview]
+ttk::scrollbar $f.vsb \-orient vertical \-command [list $f.t yview]
+text $f.t \-xscrollcommand [list $f.hsb set] \-yscrollcommand [list $f.vsb set]
+grid $f.t \-row 0 \-column 0 \-sticky nsew
+grid $f.vsb \-row 0 \-column 1 \-sticky nsew
+grid $f.hsb \-row 1 \-column 0 \-sticky nsew
+grid columnconfigure $f 0 \-weight 1
+grid rowconfigure $f 0 \-weight 1
+.CE
+.SH "SEE ALSO"
+ttk::widget(n), scrollbar(n)
+.SH KEYWORDS
+scrollbar, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_separator.n b/doc/ttk_separator.n
new file mode 100644
index 0000000..78114bd
--- /dev/null
+++ b/doc/ttk_separator.n
@@ -0,0 +1,38 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::separator n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::separator \- Separator bar
+.SH SYNOPSIS
+\fBttk::separator\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::separator\fR widget displays a horizontal or vertical separator
+bar.
+.SO ttk_widget
+\-class \-cursor \-state
+\-style \-takefocus
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-orient orient Orient
+One of \fBhorizontal\fR or \fBvertical\fR.
+Specifies the orientation of the separator.
+.SH "WIDGET COMMAND"
+.PP
+Separator widgets support the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
+methods. No other widget methods are used.
+.SH "SEE ALSO"
+ttk::widget(n)
+.SH "KEYWORDS"
+widget, separator
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_sizegrip.n b/doc/ttk_sizegrip.n
new file mode 100644
index 0000000..38de1ed
--- /dev/null
+++ b/doc/ttk_sizegrip.n
@@ -0,0 +1,69 @@
+'\"
+'\" Copyright (c) 2006 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::sizegrip n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::sizegrip \- Bottom-right corner resize widget
+.SH SYNOPSIS
+\fBttk::sizegrip\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::sizegrip\fR widget (also known as a \fIgrow box\fR)
+allows the user to resize the containing toplevel window
+by pressing and dragging the grip.
+.SO ttk_widget
+\-class \-cursor \-state
+\-style \-takefocus
+.SE
+.SH "WIDGET COMMAND"
+.PP
+Sizegrip widgets support the standard
+\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
+methods. No other widget methods are used.
+.SH "PLATFORM-SPECIFIC NOTES"
+.PP
+On Mac OSX, toplevel windows automatically include a built-in
+size grip by default.
+Adding a \fBttk::sizegrip\fR there is harmless, since
+the built-in grip will just mask the widget.
+.SH EXAMPLES
+.PP
+Using pack:
+.CS
+pack [ttk::frame $top.statusbar] \-side bottom \-fill x
+pack [\fBttk::sizegrip\fR $top.statusbar.grip] \-side right \-anchor se
+.CE
+.PP
+Using grid:
+.CS
+grid [\fBttk::sizegrip\fR $top.statusbar.grip] \e
+ \-row $lastRow \-column $lastColumn \-sticky se
+# ... optional: add vertical scrollbar in $lastColumn,
+# ... optional: add horizontal scrollbar in $lastRow
+.CE
+.SH "BUGS"
+.PP
+If the containing toplevel's position was specified
+relative to the right or bottom of the screen
+(e.g.,
+.QW "\fBwm geometry ... \fIw\fBx\fIh\fB\-\fIx\fB\-\fIy\fR"
+instead of
+.QW "\fBwm geometry ... \fIw\fBx\fIh\fB+\fIx\fB+\fIy\fR" ),
+the sizegrip widget will not resize the window.
+.PP
+\fBttk::sizegrip\fR widgets only support
+.QW southeast
+resizing.
+.SH "SEE ALSO"
+ttk::widget(n)
+.SH "KEYWORDS"
+widget, sizegrip, grow box
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n
new file mode 100644
index 0000000..fefd287
--- /dev/null
+++ b/doc/ttk_spinbox.n
@@ -0,0 +1,86 @@
+'\"
+'\" Copyright (c) 2008 Pat Thoyts
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::spinbox n 8.5.9 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::spinbox \- Selecting text field widget
+.SH SYNOPSIS
+\fBttk::spinbox\fR \fIpathName \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+A \fBttk::spinbox\fR widget is a \fBttk::entry\fR widget with built-in
+up and down buttons that are used to either modify a numeric value or
+to select among a set of values. The widget implements all the features
+of the \fBttk::entry\fR widget including support of the
+\fB\-textvariable\fR option to link the value displayed by the widget
+to a Tcl variable.
+.SO ttk_widget
+\-class \-cursor \-style
+\-takefocus \-xscrollcommand
+.SE
+.SO ttk_entry
+\-validate \-validatecommand
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-from from From
+A floating\-point value specifying the lowest value for the spinbox. This is
+used in conjunction with \fI\-to\fR and \fI\-increment\fR to set a numerical
+range.
+.OP \-to to To
+A floating\-point value specifying the highest permissible value for the
+widget. See also \fI\-from\fR and \fI\-increment\fR.
+range.
+.OP \-increment increment Increment
+A floating\-point value specifying the change in value to be applied each
+time one of the widget spin buttons is pressed. The up button applies a
+positive increment, the down button applies a negative increment.
+.OP \-values values Values
+This must be a Tcl list of values. If this option is set then this will
+override any range set using the \fI\-from\fR, \fI\-to\fR and
+\fI\-increment\fR options. The widget will instead use the values
+specified beginning with the first value.
+.OP \-wrap wrap Wrap
+Must be a proper boolean value. If on, the spinbox will wrap around the
+values of data in the widget.
+.OP \-format format Format
+Specifies an alternate format to use when setting the string value
+when using the \fB\-from\fR and \fB\-to\fR range.
+This must be a format specifier of the form \fB%<pad>.<pad>f\fR,
+as it will format a floating-point number.
+.OP \-command command Command
+Specifies a Tcl command to be invoked whenever a spinbutton is invoked.
+.SH "INDICES"
+.PP
+See the \fBttk::entry\fR manual for information about indexing characters.
+.SH "VALIDATION"
+.PP
+See the \fBttk::entry\fR manual for information about using the
+\fI\-validate\fR and \fI\-validatecommand\fR options.
+.SH "WIDGET COMMAND"
+.PP
+The following subcommands are possible for spinbox widgets in addition to
+the commands described for the \fBttk::entry\fR widget:
+.TP
+\fIpathName \fBcurrent \fIindex\fR
+.TP
+\fIpathName \fBget\fR
+Returns the spinbox's current value.
+.TP
+\fIpathName \fBset \fIvalue\fR
+Set the spinbox string to \fIvalue\fR. If a \fI\-format\fR option has
+been configured then this format will be applied. If formatting fails
+or is not set or the \fI\-values\fR option has been used then the value
+is set directly.
+.SH "SEE ALSO"
+ttk::widget(n), ttk::entry(n), spinbox(n)
+.SH KEYWORDS
+entry, spinbox, widget, text field
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_style.n b/doc/ttk_style.n
new file mode 100644
index 0000000..c32b028
--- /dev/null
+++ b/doc/ttk_style.n
@@ -0,0 +1,131 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::style n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::style \- Manipulate style database
+.SH SYNOPSIS
+\fBttk::style\fR \fIoption\fR ?\fIargs\fR?
+.BE
+.SH NOTES
+.PP
+See also the Tcl'2004 conference presentation,
+available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf
+.SH DEFINITIONS
+.PP
+Each widget is assigned a \fIstyle\fR,
+which specifies the set of elements making up the widget
+and how they are arranged, along with dynamic and default
+settings for element options.
+By default, the style name is the same as the widget's class;
+this may be overridden by the \fB\-style\fR option.
+.PP
+A \fItheme\fR is a collection of elements and styles
+which controls the overall look and feel of an application.
+.SH DESCRIPTION
+.PP
+The \fBttk::style\fR command takes the following arguments:
+.TP
+\fBttk::style configure \fIstyle\fR ?\fI\-option\fR ?\fIvalue option value...\fR? ?
+Sets the default value of the specified option(s) in \fIstyle\fR.
+.TP
+\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR?
+Sets dynamic values of the specified option(s) in \fIstyle\fR.
+Each \fIstatespec / value\fR pair is examined in order;
+the value corresponding to the first matching \fIstatespec\fR
+is used.
+.TP
+\fBttk::style lookup \fIstyle\fR \fI\-option \fR?\fIstate \fR?\fIdefault\fR??
+Returns the value specified for \fI\-option\fR in style \fIstyle\fR
+in state \fIstate\fR, using the standard lookup rules for element options.
+\fIstate\fR is a list of state names; if omitted,
+it defaults to all bits off (the
+.QW normal
+state).
+If the \fIdefault\fR argument is present, it is used as a fallback
+value in case no specification for \fI\-option\fR is found.
+.\" Otherwise -- signal error? return empty string? Leave unspecified for now.
+.TP
+\fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR?
+Define the widget layout for style \fIstyle\fR.
+See \fBLAYOUTS\fR below for the format of \fIlayoutSpec\fR.
+If \fIlayoutSpec\fR is omitted, return the layout specification
+for style \fIstyle\fR.
+.TP
+\fBttk::style element create\fR \fIelementName\fR \fItype\fR ?\fIargs...\fR?
+Creates a new element in the current theme of type \fItype\fR.
+The only cross-platform built-in element type is \fIimage\fR
+(see \fBttk_image\fR(n)) but themes may define other element types
+(see \fBTtk_RegisterElementFactory\fR). On suitable versions of Windows
+an element factory is registered to create Windows theme elements
+(see \fBttk_vsapi\fR(n)).
+.TP
+\fBttk::style element names\fR
+Returns the list of elements defined in the current theme.
+.TP
+\fBttk::style element options \fIelement\fR
+Returns the list of \fIelement\fR's options.
+.TP
+\fBttk::style theme create\fR \fIthemeName\fR ?\fB\-parent \fIbasedon\fR? ?\fB\-settings \fIscript...\fR ?
+Creates a new theme. It is an error if \fIthemeName\fR already exists.
+If \fB\-parent\fR is specified, the new theme will inherit
+styles, elements, and layouts from the parent theme \fIbasedon\fR.
+If \fB\-settings\fR is present, \fIscript\fR is evaluated in the
+context of the new theme as per \fBttk::style theme settings\fR.
+.TP
+\fBttk::style theme settings \fIthemeName\fR \fIscript\fR
+Temporarily sets the current theme to \fIthemeName\fR,
+evaluate \fIscript\fR, then restore the previous theme.
+Typically \fIscript\fR simply defines styles and elements,
+though arbitrary Tcl code may appear.
+.TP
+\fBttk::style theme names\fR
+Returns a list of all known themes.
+.TP
+\fBttk::style theme use\fR ?\fIthemeName\fR?
+Without an argument the result is the name of the current theme.
+Otherwise this command sets the current theme to \fIthemeName\fR,
+and refreshes all widgets.
+.SH LAYOUTS
+.PP
+A \fIlayout\fR specifies a list of elements, each followed
+by one or more options specifying how to arrange the element.
+The layout mechanism uses a simplified version of the \fBpack\fR
+geometry manager: given an initial cavity,
+each element is allocated a parcel.
+Valid options are:
+.TP
+\fB\-side \fIside\fR
+Specifies which side of the cavity to place the element;
+one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
+If omitted, the element occupies the entire cavity.
+.TP
+\fB\-sticky\fR \fB[\fInswe\fB]\fR
+Specifies where the element is placed inside its allocated parcel.
+.TP
+\fB\-children { \fIsublayout... \fB}\fR
+Specifies a list of elements to place inside the element.
+.\" Also: -border, -unit, -expand: may go away.
+.PP
+For example:
+.CS
+ttk::style layout Horizontal.TScrollbar {
+ Scrollbar.trough \-children {
+ Scrollbar.leftarrow \-side left
+ Scrollbar.rightarrow \-side right
+ Horizontal.Scrollbar.thumb \-side left \-sticky ew
+ }
+}
+.CE
+.SH "SEE ALSO"
+ttk::intro(n), ttk::widget(n), photo(n), ttk_image(n)
+.SH KEYWORDS
+style, theme, appearance
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_treeview.n b/doc/ttk_treeview.n
new file mode 100644
index 0000000..33cca55
--- /dev/null
+++ b/doc/ttk_treeview.n
@@ -0,0 +1,484 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::treeview n 8.5.9 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::treeview \- hierarchical multicolumn data display widget
+.SH SYNOPSIS
+\fBttk::treeview \fIpathname \fR?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+The \fBttk::treeview\fR widget displays a hierarchical collection of items.
+Each item has a textual label, an optional image,
+and an optional list of data values.
+The data values are displayed in successive columns after
+the tree label.
+.PP
+The order in which data values are displayed may be controlled
+by setting the \fB\-displaycolumns\fR widget option.
+The tree widget can also display column headings.
+Columns may be accessed by number or by symbolic names
+listed in the \fB\-columns\fR widget option;
+see \fBCOLUMN IDENTIFIERS\fR.
+.PP
+Each item is identified by a unique name.
+The widget will generate item IDs if they are not supplied by the caller.
+There is a distinguished root item, named \fB{}\fR.
+The root item itself is not displayed;
+its children appear at the top level of the hierarchy.
+.PP
+Each item also has a list of \fItags\fR,
+which can be used to associate event bindings with individual items
+and control the appearance of the item.
+.\" .PP
+.\" @@@HERE: describe selection, focus item
+.PP
+Treeview widgets support horizontal and vertical scrolling with the
+standard \fB\-\fR[\fBxy\fR]\fBscrollcommand\fR options
+and [\fBxy\fR]\fBview\fR widget commands.
+.SO ttk_widget
+\-class \-cursor \-takefocus
+\-style \-xscrollcommand \-yscrollcommand
+.SE
+.SH "WIDGET-SPECIFIC OPTIONS"
+.OP \-columns columns Columns
+A list of column identifiers,
+specifying the number of columns and their names.
+.\"X: This is a read-only option; it may only be set when the widget is created.
+.OP \-displaycolumns displayColumns DisplayColumns
+A list of column identifiers
+(either symbolic names or integer indices)
+specifying which data columns are displayed
+and the order in which they appear,
+or the string \fB#all\fP.
+If set to \fB#all\fP (the default),
+all columns are shown in the order given.
+.OP \-height height Height
+Specifies the number of rows which should be visible.
+Note:
+the requested width is determined from the sum of the column widths.
+.OP \-padding padding Padding
+Specifies the internal padding for the widget.
+The padding is a list of up to four length specifications;
+see \fBTtk_GetPaddingFromObj()\fR for details.
+.OP \-selectmode selectMode SelectMode
+Controls how the built-in class bindings manage the selection.
+One of \fBextended\fR, \fBbrowse\fR, or \fBnone\fR.
+.RS
+.PP
+If set to \fBextended\fR (the default), multiple items may be selected.
+If \fBbrowse\fR, only a single item will be selected at a time.
+If \fBnone\fR, the selection will not be changed.
+.PP
+Note that application code and tag bindings can set the selection
+however they wish, regardless of the value of \fB\-selectmode\fR.
+.RE
+.OP \-show show Show
+A list containing zero or more of the following values, specifying
+which elements of the tree to display.
+.RS
+.IP \fBtree\fR
+Display tree labels in column #0.
+.IP \fBheadings\fR
+Display the heading row.
+.PP
+The default is \fBtree headings\fR, i.e., show all elements.
+.PP
+\fBNOTE:\fR Column #0 always refers to the tree column,
+even if \fB\-show tree\fR is not specified.
+.RE
+.SH "WIDGET COMMAND"
+.PP
+.TP
+\fIpathname \fBbbox \fIitem\fR ?\fIcolumn\fR?
+Returns the bounding box (relative to the treeview widget's window)
+of the specified \fIitem\fR
+in the form \fIx y width height\fR.
+If \fIcolumn\fR is specified, returns the bounding box of that cell.
+If the \fIitem\fR is not visible
+(i.e., if it is a descendant of a closed item or is scrolled offscreen),
+returns the empty list.
+.TP
+\fIpathname \fBcget \fIoption\fR
+Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR.
+.TP
+\fIpathname \fBchildren \fIitem\fR ?\fInewchildren\fR?
+If \fInewchildren\fR is not specified,
+returns the list of children belonging to \fIitem\fR.
+.RS
+.PP
+If \fInewchildren\fR is specified, replaces \fIitem\fR's child list
+with \fInewchildren\fR.
+Items in the old child list not present in the new child list
+are detached from the tree.
+None of the items in \fInewchildren\fR may be an ancestor
+of \fIitem\fR.
+.RE
+.TP
+\fIpathname \fBcolumn \fIcolumn\fR ?\fI\-option \fR?\fIvalue \-option value...\fR?
+Query or modify the options for the specified \fIcolumn\fR.
+If no \fI\-option\fR is specified,
+returns a dictionary of option/value pairs.
+If a single \fI\-option\fR is specified,
+returns the value of that option.
+Otherwise, the options are updated with the specified values.
+The following options may be set on each column:
+.RS
+.TP
+\fB\-id \fIname\fR
+The column name. This is a read-only option.
+For example, [\fI$pathname \fBcolumn #\fIn \fB\-id\fR]
+returns the data column associated with display column #\fIn\fR.
+.TP
+\fB\-anchor\fR
+Specifies how the text in this column should be aligned
+with respect to the cell. One of
+\fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR,
+\fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR.
+.TP
+\fB\-minwidth\fR
+The minimum width of the column in pixels.
+The treeview widget will not make the column any smaller than
+\fB\-minwidth\fR when the widget is resized or the user drags a
+column separator.
+.TP
+\fB\-stretch\fR
+Specifies whether or not the column's width should be adjusted
+when the widget is resized.
+.TP
+\fB\-width \fIw\fR
+The width of the column in pixels. Default is something reasonable,
+probably 200 or so.
+.PP
+Use \fIpathname column #0\fR to configure the tree column.
+.RE
+.TP
+\fIpathname \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+Modify or query widget options; see \fIttk::widget(n)\fR.
+.TP
+\fIpathname \fBdelete \fIitemList\fR
+Deletes each of the items in \fIitemList\fR and all of their descendants.
+The root item may not be deleted.
+See also: \fBdetach\fR.
+.TP
+\fIpathname \fBdetach \fIitemList\fR
+Unlinks all of the specified items in \fIitemList\fR from the tree.
+The items and all of their descendants are still present
+and may be reinserted at another point in the tree
+with the \fBmove\fR operation,
+but will not be displayed until that is done.
+The root item may not be detached.
+See also: \fBdelete\fR.
+.TP
+\fIpathname \fBexists \fIitem\fR
+Returns 1 if the specified \fIitem\fR is present in the tree,
+0 otherwise.
+.TP
+\fIpathname \fBfocus \fR?\fIitem\fR?
+If \fIitem\fR is specified, sets the focus item to \fIitem\fR.
+Otherwise, returns the current focus item, or \fB{}\fR if there is none.
+.\" Need: way to clear the focus item. {} works for this...
+.TP
+\fIpathname \fBheading \fIcolumn\fR ?\fI\-option \fR?\fIvalue \-option value...\fR?
+Query or modify the heading options for the specified \fIcolumn\fR.
+Valid options are:
+.RS
+.TP
+\fB\-text \fItext\fR
+The text to display in the column heading.
+.TP
+\fB\-image \fIimageName\fR
+Specifies an image to display to the right of the column heading.
+.TP
+\fB\-anchor \fIanchor\fR
+Specifies how the heading text should be aligned.
+One of the standard Tk anchor values.
+.TP
+\fB\-command \fIscript\fR
+A script to evaluate when the heading label is pressed.
+.PP
+Use \fIpathname heading #0\fR to configure the tree column heading.
+.RE
+.TP
+\fIpathname \fBidentify \fIcomponent x y\fR
+Returns a description of the specified \fIcomponent\fR
+under the point given by \fIx\fR and \fIy\fR,
+or the empty string if no such \fIcomponent\fR is present at that position.
+The following subcommands are supported:
+.RS
+.TP
+\fIpathname \fBidentify region \fIx y\fR
+.RS
+Returns one of:
+.IP heading
+Tree heading area;
+use [\fBpathname identify column \fIx y\fR]
+to determine the heading number.
+.IP separator
+Space between two column headings;
+[\fBpathname identify column \fIx y\fR]
+will return the display column identifier
+of the heading to left of the separator.
+.IP tree
+The tree area.
+.IP cell
+A data cell.
+.RE
+\fIpathname \fBidentify item \fIx y\fR
+Returns the item ID of the item at position \fIy\fR.
+.TP
+\fIpathname \fBidentify column \fIx y\fR
+Returns the data column identifier of the cell at position \fIx\fR.
+The tree column has ID \fB#0\fR.
+.TP
+\fIpathname \fBidentify element \fIx y\fR
+The element at position \fIx,y\fR.
+.TP
+\fIpathname \fBidentify row \fIx y\fR
+Obsolescent synonym for \fIpathname \fBidentify item\fR.
+.PP
+See \fBCOLUMN IDENTIFIERS\fR for a discussion of display columns
+and data columns.
+.RE
+.TP
+\fIpathname \fBindex \fIitem\fR
+Returns the integer index of \fIitem\fR within its parent's list of children.
+.TP
+\fIpathname \fBinsert \fIparent index\fR ?\fB\-id \fIid\fR? \fIoptions...\fR
+Creates a new item.
+\fIparent\fR is the item ID of the parent item,
+or the empty string \fB{}\fR
+to create a new top-level item.
+\fIindex\fR is an integer, or the value \fBend\fR, specifying where in the
+list of \fIparent\fR's children to insert the new item.
+If \fIindex\fR is less than or equal to zero,
+the new node is inserted at the beginning;
+if \fIindex\fR is greater than or equal to the current number of children,
+it is inserted at the end.
+If \fB\-id\fR is specified, it is used as the item identifier;
+\fIid\fR must not already exist in the tree.
+Otherwise, a new unique identifier is generated.
+.RS
+.PP
+\fIpathname \fBinsert\fR returns the item identifier of the
+newly created item.
+See \fBITEM OPTIONS\fR for the list of available options.
+.RE
+.TP
+\fIpathname \fBinstate \fIstatespec\fR ?\fIscript\fR?
+Test the widget state; see \fIttk::widget(n)\fR.
+.TP
+\fIpathname \fBitem \fIitem\fR ?\fI\-option \fR?\fIvalue \-option value...\fR?
+Query or modify the options for the specified \fIitem\fR.
+If no \fI\-option\fR is specified,
+returns a dictionary of option/value pairs.
+If a single \fI\-option\fR is specified,
+returns the value of that option.
+Otherwise, the item's options are updated with the specified values.
+See \fBITEM OPTIONS\fR for the list of available options.
+.TP
+\fIpathname \fBmove \fIitem parent index\fR
+Moves \fIitem\fR to position \fIindex\fR in \fIparent\fR's list of children.
+It is illegal to move an item under one of its descendants.
+.RS
+.PP
+If \fIindex\fR is less than or equal to zero, \fIitem\fR is moved
+to the beginning; if greater than or equal to the number of children,
+it is moved to the end.
+.RE
+.TP
+\fIpathname \fBnext \fIitem\fR
+Returns the identifier of \fIitem\fR's next sibling,
+or \fB{}\fR if \fIitem\fR is the last child of its parent.
+.TP
+\fIpathname \fBparent \fIitem\fR
+Returns the ID of the parent of \fIitem\fR,
+or \fB{}\fR if \fIitem\fR is at the top level of the hierarchy.
+.TP
+\fIpathname \fBprev \fIitem\fR
+Returns the identifier of \fIitem\fR's previous sibling,
+or \fB{}\fR if \fIitem\fR is the first child of its parent.
+.TP
+\fIpathname \fBsee \fIitem\fR
+Ensure that \fIitem\fR is visible:
+sets all of \fIitem\fR's ancestors to \fB\-open true\fR,
+and scrolls the widget if necessary so that \fIitem\fR is
+within the visible portion of the tree.
+.TP
+\fIpathname \fBselection\fR ?\fIselop itemList\fR?
+If \fIselop\fR is not specified, returns the list of selected items.
+Otherwise, \fIselop\fR is one of the following:
+.RS
+.TP
+\fIpathname \fBselection set \fIitemList\fR
+\fIitemList\fR becomes the new selection.
+.TP
+\fIpathname \fBselection add \fIitemList\fR
+Add \fIitemList\fR to the selection
+.TP
+\fIpathname \fBselection remove \fIitemList\fR
+Remove \fIitemList\fR from the selection
+.TP
+\fIpathname \fBselection toggle \fIitemList\fR
+Toggle the selection state of each item in \fIitemList\fR.
+.RE
+.TP
+\fIpathname \fBset \fIitem\fR ?\fIcolumn\fR? ?\fIvalue\fR?
+With one argument, returns a dictionary of column/value pairs
+for the specified \fIitem\fR.
+With two arguments, returns the current value of the specified \fIcolumn\fR.
+With three arguments, sets the value of column \fIcolumn\fR
+in item \fIitem\fR to the specified \fIvalue\fR.
+See also \fBCOLUMN IDENTIFIERS\fR.
+.TP
+\fIpathname \fBstate\fR ?\fIstateSpec\fR?
+Modify or query the widget state; see \fIttk::widget(n)\fR.
+.TP
+\fIpathName \fBtag \fIargs...\fR
+.RS
+.TP
+\fIpathName \fBtag bind \fItagName \fR?\fIsequence\fR? ?\fIscript\fR?
+Add a Tk binding script for the event sequence \fIsequence\fR
+to the tag \fItagName\fR. When an X event is delivered to an item,
+binding scripts for each of the item's \fB\-tags\fR are evaluated
+in order as per \fIbindtags(n)\fR.
+.RS
+.PP
+\fB<KeyPress>\fR, \fB<KeyRelease>\fR, and virtual events
+are sent to the focus item.
+\fB<ButtonPress>\fR, \fB<ButtonRelease>\fR, and \fB<Motion>\fR events
+are sent to the item under the mouse pointer.
+No other event types are supported.
+.PP
+The binding \fIscript\fR undergoes \fB%\fR-substitutions before
+evaluation; see \fBbind(n)\fR for details.
+.RE
+.TP
+\fIpathName \fBtag configure \fItagName\fR ?\fIoption\fR? ?\fIvalue option value...\fR?
+Query or modify the options for the specified \fItagName\fR.
+If one or more \fIoption/value\fR pairs are specified,
+sets the value of those options for the specified tag.
+If a single \fIoption\fR is specified,
+returns the value of that option
+(or the empty string if the option has not been specified for \fItagName\fR).
+With no additional arguments,
+returns a dictionary of the option settings for \fItagName\fR.
+See \fBTAG OPTIONS\fR for the list of available options.
+.TP
+\fIpathName \fBtag has \fItagName\fR ?\fIitem\fR?
+If \fIitem\fR is specified, returns 1 or 0
+depending on whether the specified item has the named tag.
+Otherwise, returns a list of all items which have
+the specified tag.
+.TP
+\fIpathName \fBtag names\fR
+Returns a list of all tags used by the widget.
+.TP
+\fIpathName \fBtag add\fR \fItag\fR \fIitems\fR
+Adds the specified \fItag\fR to each of the listed \fIitems\fR.
+If \fItag\fR is already present for a particular item,
+then the \fB-tags\fR for that item are unchanged.
+.TP
+\fIpathName \fBtag remove\fR \fItag\fR ?\fIitems\fR?
+Removes the specified \fItag\fR from each of the listed \fIitems\fR.
+If \fIitems\fR is omitted, removes \fItag\fR from each item in the tree.
+If \fItag\fR is not present for a particular item,
+then the \fB-tags\fR for that item are unchanged.
+.RE
+.TP
+\fIpathName \fBxview \fIargs\fR
+Standard command for horizontal scrolling; see \fIwidget(n)\fR.
+.TP
+\fIpathName \fByview \fIargs\fR
+Standard command for vertical scrolling; see \fIttk::widget(n)\fR.
+.SH "ITEM OPTIONS"
+.PP
+The following item options may be specified for items
+in the \fBinsert\fR and \fBitem\fR widget commands.
+.OP \-text text Text
+The textual label to display for the item.
+.OP \-image image Image
+A Tk image, displayed to the left of the label.
+.OP \-values values Values
+The list of values associated with the item.
+.RS
+.PP
+Each item should have the same number of values as
+the \fB\-columns\fR widget option.
+If there are fewer values than columns,
+the remaining values are assumed empty.
+If there are more values than columns,
+the extra values are ignored.
+.RE
+.OP \-open open Open
+A boolean value indicating whether the item's children
+should be displayed (\fB\-open true\fR) or hidden (\fB\-open false\fR).
+.OP \-tags tags Tags
+A list of tags associated with this item.
+.SH "TAG OPTIONS"
+.PP
+The following options may be specified on tags:
+.IP \fB\-foreground\fR
+Specifies the text foreground color.
+.IP \fB\-background\fR
+Specifies the cell or item background color.
+.IP \fB\-font\fR
+Specifies the font to use when drawing text.
+.\" ??? Maybe: .IP \-anchor
+.\" ??? Maybe: .IP \-padding
+.\" ??? Maybe: .IP \-text
+.IP \fB\-image\fR
+Specifies the item image, in case the item's \fB\-image\fR option is empty.
+.\" .PP
+.\" \fI(@@@ TODO: sort out order of precedence for options)\fR
+.SH "COLUMN IDENTIFIERS"
+.PP
+Column identifiers take any of the following forms:
+.IP \(bu
+A symbolic name from the list of \fB\-columns\fR.
+.IP \(bu
+An integer \fIn\fR, specifying the \fIn\fRth data column.
+.IP \(bu
+A string of the form \fB#\fIn\fR, where \fIn\fR is an integer,
+specifying the \fIn\fRth display column.
+.PP
+\fBNOTE:\fR
+Item \fB\-values\fR may be displayed in a different order than
+the order in which they are stored.
+.PP
+\fBNOTE:\fR Column #0 always refers to the tree column,
+even if \fB\-show tree\fR is not specified.
+.PP
+A \fIdata column number\fR is an index into an item's \fB\-values\fR list;
+a \fIdisplay column number\fR is the column number in the tree
+where the values are displayed.
+Tree labels are displayed in column #0.
+If \fB\-displaycolumns\fR is not set,
+then data column \fIn\fR is displayed in display column \fB#\fIn+1\fR.
+Again, \fBcolumn #0 always refers to the tree column\fR.
+.SH "VIRTUAL EVENTS"
+.PP
+The treeview widget generates the following virtual events.
+.IP <<TreeviewSelect>>
+Generated whenever the selection changes.
+.IP <<TreeviewOpen>>
+Generated just before setting the focus item to \fB\-open true\fR.
+.IP <<TreeviewClose>>
+Generated just after setting the focus item to \fB\-open false\fR.
+.PP
+The \fBfocus\fR and \fBselection\fR widget commands can be used
+to determine the affected item or items.
+'\" Not yet:
+'\" In Tk 8.5, the affected item is also passed as the \fB\-detail\fR field
+'\" of the virtual event.
+.SH "SEE ALSO"
+ttk::widget(n), listbox(n), image(n), bind(n)
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_vsapi.n b/doc/ttk_vsapi.n
new file mode 100644
index 0000000..7506ec4
--- /dev/null
+++ b/doc/ttk_vsapi.n
@@ -0,0 +1,102 @@
+'\"
+'\" Copyright (c) 2008 Pat Thoyts
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk_vsapi n 8.5 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk_vsapi \- Define a Microsoft Visual Styles element
+.SH SYNOPSIS
+\fBttk::style element create \fIname\fR \fBvsapi\fR \fIclassName\fR \fIpartId\fR ?\fIstateMap\fR? ?\fIoptions\fR?
+.BE
+.SH DESCRIPTION
+.PP
+The \fIvsapi\fR element factory creates a new element
+in the current theme whose visual appearance is drawn using the
+Microsoft Visual Styles API which is reponsible for the themed styles
+on Windows XP and Vista. This factory permits any of the Visual
+Styles parts to be declared as ttk elements that can then be
+included in a style layout to modify the appearance of ttk widgets.
+.PP
+\fIclassName\fR and \fIpartId\fR are required parameters and specify
+the Visual Styles class and part as given in the Microsoft
+documentation. The \fIstateMap\fR may be provided to map ttk states to
+Visual Styles API states (see \fBSTATE MAP\fR).
+.SH "OPTIONS"
+.PP
+Valid \fIoptions\fR are:
+.TP
+\fB\-padding\fR \fIpadding\fR
+Specify the element's interior padding.
+\fIpadding\fR is a list of up to four integers specifying
+the left, top, right and bottom padding quantities respectively.
+This option may not be mixed with any other options.
+.TP
+\fB\-margins\fR \fIpadding\fR
+Specifies the elements exterior padding.
+\fIpadding\fR is a list of up to four integers specifying
+the left, top, right and bottom padding quantities respectively.
+This option may not be mixed with any other options.
+.TP
+\fB\-width\fR \fIwidth\fR
+Specifies the height for the element. If this option is set then
+the Visual Styles API will not be queried for the recommended
+size or the part. If this option is set then \fI-height\fR should
+also be set. The \fI-width\fR and \fI-height\fR options cannot
+be mixed with the \fI-padding\fR or \fI-margins\fR options.
+.TP
+\fB\-height\fR \fIheight\fR
+Specifies the height of the element. See the comments for \fI-width\fR.
+.SH "STATE MAP"
+.PP
+The \fIstateMap\fR parameter is a list of ttk states and the
+corresponding Visual Styles API state value.
+This permits the element appearence to respond to changes in the
+widget state such as becoming active or being pressed. The list should
+be as described for the \fBttk::style map\fR command but note that the
+last pair in the list should be the default state and is typically and
+empty list and 1. Unfortunately all the Visual Styles parts have
+different state values and these must be looked up either in the
+Microsoft documentation or more likely in the header files. The
+original header to use was \fItmschema.h\fR but in more recent
+versions of the Windows Development Kit this is \fIvssym32.h\fR.
+.PP
+If no \fIstateMap\fR parameter is given there is an implicit default
+map of {{} 1}
+.SH "EXAMPLE"
+.PP
+Create a correctly themed close button by changing the layout of
+a \fBttk::button\fR(n). This uses the WINDOW part WP_SMALLCLOSEBUTTON
+and as documented the states CBS_DISABLED, CBS_HOT, CBS_NORMAL and
+CBS_PUSHED are mapped from ttk states.
+.CS
+ttk::style element create smallclose vsapi WINDOW 19 \\
+ {disabled 4 pressed 3 active 2 {} 1}
+ttk::style layout CloseButton {CloseButton.smallclose -sticky news}
+pack [ttk::button .close -style CloseButton]
+.CE
+.PP
+Change the appearence of a \fBttk::checkbutton\fR(n) to use the
+Explorer pin part EBP_HEADERPIN.
+.CS
+ttk::style element create pin vsapi EXPLORERBAR 3 {
+ {pressed !selected} 3
+ {active !selected} 2
+ {pressed selected} 6
+ {active selected} 5
+ {selected} 4
+ {} 1
+}
+ttk::style layout Explorer.Pin {Explorer.Pin.pin -sticky news}
+pack [ttk::checkbutton .pin -style Explorer.Pin]
+.CE
+.SH "SEE ALSO"
+ttk::intro(n), ttk::widget(n), ttk::style(n), ttk_image(n)
+.SH "KEYWORDS"
+style, theme, appearance, windows
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n
new file mode 100644
index 0000000..98968ad
--- /dev/null
+++ b/doc/ttk_widget.n
@@ -0,0 +1,262 @@
+'\"
+'\" Copyright (c) 2004 Joe English
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH ttk::widget n 8.5.9 Tk "Tk Themed Widget"
+.BS
+.SH NAME
+ttk::widget \- Standard options and commands supported by Tk themed widgets
+.BE
+.SH DESCRIPTION
+This manual describes common widget options and commands.
+.SH "STANDARD OPTIONS"
+The following options are supported by all Tk themed widgets:
+.OP \-class undefined undefined
+Specifies the window class.
+The class is used when querying the option database
+for the window's other options, to determine the default
+bindtags for the window, and to select the widget's default
+layout and style.
+This is a read-only option:
+it may only be specified when the window is created,
+and may not be changed with the \fBconfigure\fR widget command.
+.OP \-cursor cursor Cursor
+Specifies the mouse cursor to be used for the widget.
+See \fBTk_GetCursor\fR and \fIcursors(n)\fR in the Tk reference manual
+for the legal values.
+If set to the empty string (the default),
+the cursor is inherited from the parent widget.
+.OP \-takefocus takeFocus TakeFocus
+Determines whether the window accepts the focus during keyboard traversal.
+Either \fB0\fR, \fB1\fR, a command prefix (to which the widget path
+is appended, and which should return \fB0\fR or \fB1\fR),
+or the empty string.
+See \fIoptions(n)\fR in the Tk reference manual for the full description.
+.OP \-style style Style
+May be used to specify a custom widget style.
+.SH "SCROLLABLE WIDGET OPTIONS"
+The following options are supported by widgets that
+are controllable by a scrollbar.
+See \fIscrollbar(n)\fR for more information
+.OP \-xscrollcommand xScrollCommand ScrollCommand
+A command prefix, used to communicate with horizontal scrollbars.
+.RS
+When the view in the widget's window changes, the widget will
+generate a Tcl command by concatenating the scroll command and
+two numbers.
+Each of the numbers is a fraction between 0 and 1 indicating
+a position in the document; 0 indicates the beginning,
+and 1 indicates the end.
+The first fraction indicates the first information in the widget
+that is visible in the window, and the second fraction indicates
+the information just after the last portion that is visible.
+.PP
+Typically the \fBxScrollCommand\fR option consists of the path name
+of a \fBscrollbar\fR widget followed by
+.QW set ,
+e.g.
+.QW ".x.scrollbar set" .
+This will cause the scrollbar to be updated whenever the view in the
+window changes.
+.PP
+If this option is set to the empty string (the default),
+then no command will be executed.
+.RE
+.OP \-yscrollcommand yScrollCommand ScrollCommand
+A command prefix, used to communicate with vertical scrollbars.
+See the description of \fB\-xscrollcommand\fR above for details.
+.SH "LABEL OPTIONS"
+The following options are supported by labels, buttons,
+and other button-like widgets:
+.OP \-text text Text
+Specifies a text string to be displayed inside the widget
+(unless overridden by \fB\-textvariable\fR).
+.OP \-textvariable textVariable Variable
+Specifies the name of a global variable whose value will be used
+in place of the \fB\-text\fR resource.
+.OP \-underline underline Underline
+If set, specifies the integer index (0-based) of a character to underline
+in the text string.
+The underlined character is used for mnemonic activation.
+.OP \-image image Image
+Specifies an image to display.
+This is a list of 1 or more elements.
+The first element is the default image name.
+The rest of the list is a sequence of \fIstatespec / value\fR pairs
+as per \fBstyle map\fR, specifying different images to use when
+the widget is in a particular state or combination of states.
+All images in the list should have the same size.
+.OP \-compound compound Compound
+Specifies how to display the image relative to the text,
+in the case both \fB\-text\fR and \fB\-image\fR are present.
+Valid values are:
+.RS
+.IP text
+Display text only.
+.IP image
+Display image only.
+.IP center
+Display text centered on top of image.
+.IP top
+.IP bottom
+.IP left
+.IP right
+Display image above, below, left of, or right of the text, respectively.
+.IP none
+The default; display the image if present, otherwise the text.
+.RE
+.OP \-width width Width
+If greater than zero, specifies how much space, in character widths,
+to allocate for the text label.
+If less than zero, specifies a minimum width.
+If zero or unspecified, the natural width of the text label is used.
+.SH "COMPATIBILITY OPTIONS"
+.OP \-state state State
+May be set to \fBnormal\fR or \fBdisabled\fR
+to control the \fBdisabled\fR state bit.
+This is a write-only option:
+setting it changes the widget state,
+but the \fBstate\fR widget command
+does not affect the \fB\-state\fR option.
+.SH COMMANDS
+.TP
+\fIpathName \fBcget\fR \fIoption\fR
+Returns the current value of the configuration option given
+by \fIoption\fR.
+.TP
+\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+Query or modify the configuration options of the widget.
+If one or more \fIoption\-value\fR pairs are specified,
+then the command modifies the given widget option(s)
+to have the given value(s);
+in this case the command returns an empty string.
+If \fIoption\fR is specified with no \fIvalue\fR,
+then the command returns a list describing the named option:
+the elements of the list are the
+option name, database name, database class, default value,
+and current value.
+.\" Note: Ttk widgets don't use TK_OPTION_SYNONYM.
+If no \fIoption\fR is specified, returns a list describing all of
+the available options for \fIpathName\fR.
+.TP
+\fIpathName \fBidentify\fR \fBelement\fR \fIx y\fR
+Returns the name of the element under the point given
+by \fIx\fR and \fIy\fR, or an empty string if the point does
+not lie within any element.
+\fIx\fR and \fIy\fR are pixel coordinates relative to the widget.
+Some widgets accept other \fBidentify\fR subcommands.
+.TP
+\fIpathName \fBinstate\fR \fIstatespec\fR ?\fIscript\fR?
+Test the widget's state.
+If \fIscript\fR is not specified, returns 1 if
+the widget state matches \fIstatespec\fR and 0 otherwise.
+If \fIscript\fR is specified, equivalent to
+.CS
+if {[\fIpathName\fR instate \fIstateSpec\fR]} \fIscript\fR
+.CE
+.TP
+\fIpathName \fBstate\fR ?\fIstateSpec\fR?
+Modify or inquire widget state.
+If \fIstateSpec\fR is present, sets the widget state:
+for each flag in \fIstateSpec\fR, sets the corresponding flag
+or clears it if prefixed by an exclamation point.
+.RS
+Returns a new state spec indicating which flags were changed:
+.CS
+set changes [\fIpathName \fRstate \fIspec\fR]
+\fIpathName \fRstate $changes
+.CE
+will restore \fIpathName\fR to the original state.
+If \fIstateSpec\fR is not specified,
+returns a list of the currently-enabled state flags.
+.RE
+.SH "WIDGET STATES"
+The widget state is a bitmap of independent state flags.
+Widget state flags include:
+.TP
+\fBactive\fR
+The mouse cursor is over the widget
+and pressing a mouse button will cause some action to occur. (aka
+.QW prelight
+(Gnome),
+.QW hot
+(Windows),
+.QW hover ).
+.TP
+\fBdisabled\fR
+Widget is disabled under program control (aka
+.QW unavailable ,
+.QW inactive )
+.TP
+\fBfocus\fR
+Widget has keyboard focus
+.TP
+\fBpressed\fR
+Widget is being pressed (aka
+.QW armed
+in Motif).
+.TP
+\fBselected\fR
+.QW On ,
+.QW true ,
+or
+.QW current
+for things like checkbuttons and radiobuttons.
+.TP
+\fBbackground\fR
+Windows and the Mac have a notion of an
+.QW active
+or foreground window.
+The \fBbackground\fR state is set for widgets in a background window,
+and cleared for those in the foreground window.
+.TP
+\fBreadonly\fR
+Widget should not allow user modification.
+.TP
+\fBalternate\fR
+A widget-specific alternate display format.
+For example, used for checkbuttons and radiobuttons in the
+.QW tristate
+or
+.QW mixed
+state, and for buttons with \fB\-default active\fR.
+.TP
+\fBinvalid\fR
+The widget's value is invalid.
+(Potential uses: scale widget value out of bounds,
+entry widget value failed validation.)
+.TP
+\fBhover\fR
+The mouse cursor is within the widget.
+This is similar to the \fBactive\fP state;
+it is used in some themes for widgets that
+provide distinct visual feedback for
+the active widget in addition to the active element
+within the widget.
+.PP
+A \fIstate specification\fR or \fIstateSpec\fR is a list
+of state names, optionally prefixed with an exclamation point (!)
+indicating that the bit is off.
+.SH EXAMPLES
+.CS
+set b [ttk::button .b]
+
+# Disable the widget:
+$b state disabled
+
+# Invoke the widget only if it is currently pressed and enabled:
+$b instate {pressed !disabled} { .b invoke }
+
+# Reenable widget:
+$b state !disabled
+.CE
+.SH "SEE ALSO"
+ttk::intro(n), ttk::style(n)
+.SH KEYWORDS
+state, configure, option
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/winfo.n b/doc/winfo.n
index fe62071..4b75eb9 100644
--- a/doc/winfo.n
+++ b/doc/winfo.n
@@ -55,9 +55,11 @@ Returns the class name for \fIwindow\fR.
.TP
\fBwinfo colormapfull \fIwindow\fR
Returns 1 if the colormap for \fIwindow\fR is known to be full, 0
-otherwise. The colormap for a window is ``known'' to be full if the last
+otherwise. The colormap for a window is
+.QW known
+to be full if the last
attempt to allocate a new color on that window failed and this
-application hasn't freed any colors in the colormap since the
+application has not freed any colors in the colormap since the
failed allocation.
.TP
\fBwinfo containing \fR?\fB\-displayof \fIwindow\fR? \fIrootX rootY\fR
@@ -88,7 +90,10 @@ window exists.
Returns a floating-point value giving the number of pixels
in \fIwindow\fR corresponding to the distance given by \fInumber\fR.
\fINumber\fR may be specified in any of the forms acceptable
-to \fBTk_GetScreenMM\fR, such as ``2.0c'' or ``1i''.
+to \fBTk_GetScreenMM\fR, such as
+.QW 2.0c
+or
+.QW 1i .
The return value may be fractional; for an integer value, use
\fBwinfo pixels\fR.
.TP
@@ -108,12 +113,10 @@ or use \fBwinfo reqheight\fR to get the window's requested height
instead of its actual height.
.TP
\fBwinfo id \fIwindow\fR
-.VS
Returns a hexadecimal string giving a low-level platform-specific
identifier for \fIwindow\fR. On Unix platforms, this is the X
window identifier. Under Windows, this is the Windows
HWND. On the Macintosh the value has no meaning outside Tk.
-.VE
.TP
\fBwinfo interps \fR?\fB\-displayof \fIwindow\fR?
Returns a list whose members are the names of all Tcl interpreters
@@ -128,7 +131,7 @@ Returns \fB1\fR if \fIwindow\fR is currently mapped, \fB0\fR otherwise.
\fBwinfo manager \fIwindow\fR
Returns the name of the geometry manager currently
responsible for \fIwindow\fR, or an empty string if \fIwindow\fR
-isn't managed by any geometry manager.
+is not managed by any geometry manager.
The name is usually the name of the Tcl command for the geometry
manager, such as \fBpack\fR or \fBplace\fR.
If the geometry manager is a widget, such as canvases or text, the
@@ -155,7 +158,10 @@ the display of the application's main window.
Returns the number of pixels in \fIwindow\fR corresponding
to the distance given by \fInumber\fR.
\fINumber\fR may be specified in any of the forms acceptable
-to \fBTk_GetPixels\fR, such as ``2.0c'' or ``1i''.
+to \fBTk_GetPixels\fR, such as
+.QW 2.0c
+or
+.QW 1i .
The result is rounded to the nearest integer value; for a
fractional result, use \fBwinfo fpixels\fR.
.TP
@@ -164,7 +170,7 @@ If the mouse pointer is on the same screen as \fIwindow\fR, returns the
pointer's x coordinate, measured in pixels in the screen's root window.
If a virtual root window is in use on the screen, the position is
measured in the virtual root.
-If the mouse pointer isn't on the same screen as \fIwindow\fR then
+If the mouse pointer is not on the same screen as \fIwindow\fR then
-1 is returned.
.TP
\fBwinfo pointerxy \fIwindow\fR
@@ -173,15 +179,15 @@ with two elements, which are the pointer's x and y coordinates measured
in pixels in the screen's root window.
If a virtual root window is in use on the screen, the position
is computed in the virtual root.
-If the mouse pointer isn't on the same screen as \fIwindow\fR then
-both of the returned coordinates are -1.
+If the mouse pointer is not on the same screen as \fIwindow\fR then
+both of the returned coordinates are \-1.
.TP
\fBwinfo pointery \fIwindow\fR
If the mouse pointer is on the same screen as \fIwindow\fR, returns the
pointer's y coordinate, measured in pixels in the screen's root window.
If a virtual root window is in use on the screen, the position
is computed in the virtual root.
-If the mouse pointer isn't on the same screen as \fIwindow\fR then
+If the mouse pointer is not on the same screen as \fIwindow\fR then
-1 is returned.
.TP
\fBwinfo reqheight \fIwindow\fR
@@ -252,14 +258,17 @@ in pixels.
Returns a string containing information about the server for
\fIwindow\fR's display. The exact format of this string may vary
from platform to platform. For X servers the string
-has the form ``\fBX\fImajor\fBR\fIminor vendor vendorVersion\fR''
+has the form
+.QW "\fBX\fImajor\fBR\fIminor vendor vendorVersion\fR"
where \fImajor\fR and \fIminor\fR are the version and revision
numbers provided by the server (e.g., \fBX11R5\fR), \fIvendor\fR
is the name of the vendor for the server, and \fIvendorRelease\fR
is an integer release number provided by the server.
.TP
\fBwinfo toplevel \fIwindow\fR
-Returns the path name of the top-level window containing \fIwindow\fR.
+Returns the path name of the top-of-hierarchy window containing \fIwindow\fR.
+In standard Tk this will always be a \fBtoplevel\fR widget, but extensions may
+create other kinds of top-of-hierarchy widgets.
.TP
\fBwinfo viewable \fIwindow\fR
Returns 1 if \fIwindow\fR and all of its ancestors up through the
@@ -328,9 +337,8 @@ has no border).
.SH EXAMPLE
Print where the mouse pointer is and what window it is currently over:
.CS
-set x [\fBwinfo pointerx\fR .]
-set y [\fBwinfo pointery\fR .]
-puts -nonewline "Mouse pointer at ($x,$y) which is "
+lassign [\fBwinfo pointerxy\fR .] x y
+puts \-nonewline "Mouse pointer at ($x,$y) which is "
set win [\fBwinfo containing\fR $x $y]
if {$win eq ""} {
puts "over no window"
diff --git a/doc/wish.1 b/doc/wish.1
index 5724062..28ec138 100644
--- a/doc/wish.1
+++ b/doc/wish.1
@@ -12,8 +12,13 @@
.SH NAME
wish \- Simple windowing shell
.SH SYNOPSIS
-\fBwish\fR ?\fIfileName arg arg ...\fR?
+\fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg arg ...\fR?
.SH OPTIONS
+.IP "\fB\-encoding \fIname\fR" 20
+.VS 8.5
+Specifies the encoding of the text stored in \fIfileName\fR.
+This option is only recognized prior to the \fIfileName\fR argument.
+.VE 8.5
.IP "\fB\-colormap \fInew\fR" 20
Specifies that the window should have a new private colormap instead of
using the default colormap for the screen.
@@ -30,14 +35,17 @@ as the name of the interpreter for \fBsend\fR commands.
Execute all X server commands synchronously, so that errors
are reported immediately. This will result in much slower
execution, but it is useful for debugging.
-.VS 8.0 br
.IP "\fB\-use\fR \fIid\fR" 20
Specifies that the main window for the application is to be embedded in
the window whose identifier is \fIid\fR, instead of being created as an
independent toplevel window. \fIId\fR must be specified in the same
way as the value for the \fB\-use\fR option for toplevel widgets (i.e.
it has a form like that returned by the \fBwinfo id\fR command).
-.VE
+.RS
+Note that on some platforms this will only work correctly if \fIid\fR
+refers to a Tk \fBframe\fR or \fBtoplevel\fR that has its
+\fB\-container\fR option enabled.
+.RE
.IP "\fB\-visual \fIvisual\fR" 20
Specifies the visual to use for the window.
\fIVisual\fR may have any of the forms supported by the \fBTk_GetVisual\fR
@@ -48,47 +56,60 @@ variable without interpreting them.
This provides a mechanism for passing arguments such as \fB\-name\fR
to a script instead of having \fBwish\fR interpret them.
.BE
-
.SH DESCRIPTION
.PP
\fBWish\fR is a simple program consisting of the Tcl command
language, the Tk toolkit, and a main program that reads commands
from standard input or from a file.
It creates a main window and then processes Tcl commands.
-If \fBwish\fR is invoked with no arguments, or with a first argument
-that starts with ``\-'', then it reads Tcl commands interactively from
-standard input.
+If \fBwish\fR is invoked with arguments, then the first few
+arguments, ?\fB\-encoding \fIname\fR? ?\fIfileName\fR? specify the
+name of a script file, and, optionally, the
+encoding of the text data stored in that script file. A value
+for \fIfileName\fR is recognized if the appropriate argument
+does not start with
+.QW \- .
+.PP
+If there are no arguments, or the arguments do not specify a \fIfileName\fR,
+then wish reads Tcl commands interactively from standard input.
It will continue processing commands until all windows have been
deleted or until end-of-file is reached on standard input.
-If there exists a file \fB.wishrc\fR in the home directory of
-the user, \fBwish\fR evaluates the file as a Tcl script
-just before reading the first command from standard input.
+If there exists a file
+.QW \fB.wishrc\fR
+in the home directory of the user, \fBwish\fR evaluates the file as a
+Tcl script just before reading the first command from standard input.
.PP
-If \fBwish\fR is invoked with an initial \fIfileName\fR argument, then
+If arguments to \fBwish\fR do specify a \fIfileName\fR, then
\fIfileName\fR is treated as the name of a script file.
\fBWish\fR will evaluate the script in \fIfileName\fR (which
presumably creates a user interface), then it will respond to events
until all windows have been deleted.
Commands will not be read from standard input.
-There is no automatic evaluation of \fB.wishrc\fR when the name
-of a script file is presented on the \fBwish\fR command line,
+There is no automatic evaluation of
+.QW \fB.wishrc\fR
+when the name of a script file is presented on the \fBwish\fR command line,
but the script file can always \fBsource\fR it if desired.
-
-.SH "OPTIONS"
+.PP
+Note that on Windows, the \fBwish\fIversion\fB.exe\fR program varies
+from the \fBtclsh\fIversion\fB.exe\fR program in an additional
+important way: it does not connect to a standard Windows console and
+is instead a windowed program. Because of this, it additionally
+provides access to its own \fBconsole\fR command.
+.SH "OPTION PROCESSING"
.PP
\fBWish\fR automatically processes all of the command-line options
described in the \fBOPTIONS\fR summary above.
Any other command-line arguments besides these are passed through
to the application using the \fBargc\fR and \fBargv\fR variables
described later.
-
.SH "APPLICATION NAME AND CLASS"
.PP
The name of the application, which is used for purposes such as
\fBsend\fR commands, is taken from the \fB\-name\fR option,
if it is specified; otherwise it is taken from \fIfileName\fR,
if it is specified, or from the command name by which
-\fBwish\fR was invoked. In the last two cases, if the name contains a ``/''
+\fBwish\fR was invoked. In the last two cases, if the name contains a
+.QW /
character, then only the characters after the last slash are used
as the application name.
.PP
@@ -96,7 +117,6 @@ The class of the application, which is used for purposes such as
specifying options with a \fBRESOURCE_MANAGER\fR property or .Xdefaults
file, is the same as its name except that the first letter is
capitalized.
-
.SH "VARIABLES"
.PP
\fBWish\fR sets the following Tcl variables:
@@ -107,8 +127,8 @@ not including the options described above.
.TP 15
\fBargv\fR
Contains a Tcl list whose elements are the \fIarg\fR arguments
-that follow a \fB\-\|\-\fR option or don't match any of the
-options described in OPTIONS above, in order, or an empty string
+that follow a \fB\-\|\-\fR option or do not match any of the
+options described in \fBOPTIONS\fR above, in order, or an empty string
if there are no such arguments.
.TP 15
\fBargv0\fR
@@ -126,7 +146,6 @@ window's geometry.
Contains 1 if \fBwish\fR is reading commands interactively (\fIfileName\fR
was not specified and standard input is a terminal-like
device), 0 otherwise.
-
.SH "SCRIPT FILES"
.PP
If you create a Tcl script in a file whose first line is
@@ -136,8 +155,8 @@ If you create a Tcl script in a file whose first line is
then you can invoke the script file directly from your shell if
you mark it as executable.
This assumes that \fBwish\fR has been installed in the default
-location in /usr/local/bin; if it's installed somewhere else
-then you'll have to modify the above line to match.
+location in /usr/local/bin; if it is installed somewhere else
+then you will have to modify the above line to match.
Many UNIX systems do not allow the \fB#!\fR line to exceed about
30 characters in length, so be sure that the \fBwish\fR executable
can be accessed with a short file name.
@@ -150,7 +169,7 @@ following three lines:
exec wish "$0" ${1+"$@"}\fR
.CE
This approach has three advantages over the approach in the previous
-paragraph. First, the location of the \fBwish\fR binary doesn't have
+paragraph. First, the location of the \fBwish\fR binary does not have
to be hard-wired into the script: it can be anywhere in your shell
search path. Second, it gets around the 30-character file name limit
in the previous approach.
@@ -168,27 +187,31 @@ When \fBwish\fR starts up, it treats all three lines as comments,
since the backslash at the end of the second line causes the third
line to be treated as part of the comment on the second line.
.PP
-.VS 8.4
The end of a script file may be marked either by the physical end of
-the medium, or by the character, '\\032' ('\\u001a', control-Z).
+the medium, or by the character,
+.QW \e032
+.PQ \eu001a ", control-Z" .
If this character is present in the file, the \fBwish\fR application
will read text up to but not including the character. An application
that requires this character in the file may encode it as
-``\\032'', ``\\x1a'', or ``\\u001a''; or may generate it by use of commands
-such as \fBformat\fR or \fBbinary\fR.
-.VE
+.QW \e032 ,
+.QW \ex1a ,
+or
+.QW \eu001a ;
+or may generate it by use of commands such as \fBformat\fR or \fBbinary\fR.
.SH PROMPTS
.PP
When \fBwish\fR is invoked interactively it normally prompts for each
-command with ``\fB% \fR''. You can change the prompt by setting the
+command with
+.QW "\fB% \fR" .
+You can change the prompt by setting the
variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR. If variable
\fBtcl_prompt1\fR exists then it must consist of a Tcl script
to output a prompt; instead of outputting a prompt \fBwish\fR
will evaluate the script in \fBtcl_prompt1\fR.
The variable \fBtcl_prompt2\fR is used in a similar way when
-a newline is typed but the current command isn't yet complete;
-if \fBtcl_prompt2\fR isn't set then no prompt is output for
+a newline is typed but the current command is not yet complete;
+if \fBtcl_prompt2\fR is not set then no prompt is output for
incomplete commands.
-
.SH KEYWORDS
shell, toolkit
diff --git a/doc/wm.n b/doc/wm.n
index f234b6d..93858ef 100644
--- a/doc/wm.n
+++ b/doc/wm.n
@@ -6,7 +6,7 @@
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.so man.macros
-.TH wm n 8.4 Tk "Tk Built-In Commands"
+.TH wm n 8.5 Tk "Tk Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
@@ -14,7 +14,6 @@ wm \- Communicate with window manager
.SH SYNOPSIS
\fBwm\fR \fIoption window \fR?\fIargs\fR?
.BE
-
.SH DESCRIPTION
.PP
The \fBwm\fR command is used to interact with window managers in
@@ -42,7 +41,6 @@ a Tcl list containing four elements, which are the current values
of \fIminNumer\fR, \fIminDenom\fR, \fImaxNumer\fR, and \fImaxDenom\fR
(if no aspect restrictions are in effect, then an empty string is
returned).
-.VS 8.4
.TP
\fBwm attributes \fIwindow\fR
.TP
@@ -54,66 +52,85 @@ with a window. The first form returns a list of the platform specific
flags and their values. The second form returns the value for the
specific option. The third form sets one or more of the values. The
values are as follows:
-.PP
-On Windows, the following attributes may be set.
.RS
+.PP
+All platforms support the following attributes (though X11 users
+should see the notes below):
.TP
-\fB\-disabled\fR
-Specifies whether the window is in a disabled state.
-.TP
-\fB\-toolwindow\fR
-Specifies a toolwindow style window (as defined in the MSDN).
+\fB\-fullscreen\fR
+Places the window in a mode that takes up the entire screen, has no
+borders, and covers the general use area (i.e. Start menu and taskbar on
+Windows, dock and menubar on OSX, general window decorations on X11).
.TP
\fB\-topmost\fR
Specifies whether this is a topmost window (displays above all other windows).
+.PP
+On Windows, the following attributes may be set.
.TP
\fB\-alpha\fR
+.VS 8.5
Specifies the alpha transparency level of the toplevel.
It accepts a value from \fB0.0\fR (fully transparent) to \fB1.0\fR
(opaque). Values outside that range will be constrained. This is
supported on Windows 2000/XP+. Where not supported, the \fB\-alpha\fR
value remains at \fB1.0\fR.
+.VE 8.5
+.TP
+\fB\-disabled\fR
+Specifies whether the window is in a disabled state.
+.TP
+\fB\-toolwindow\fR
+Specifies a toolwindow style window (as defined in the MSDN).
.TP
\fB\-transparentcolor\fR
+.VS 8.5
Specifies the transparent color index of the toplevel. It takes any color
value accepted by \fBTk_GetColor\fR. If the empty string is specified
(default), no transparent color is used. This is supported on Windows
2000/XP+. Where not supported, the \fB\-transparentcolor\fR value remains
at \fB{}\fR.
-.RE
+.VE 8.5
.PP
On Mac OS X, the following attributes may be set.
-.RS
+.TP
+\fB\-alpha\fR
+Specifies the alpha transparency level of the window.
+It accepts a value from \fB0.0\fR (fully transparent) to \fB1.0\fR (opaque),
+values outside that range will be constrained.
.TP
\fB\-modified\fR
Specifies the modification state of the window (determines whether the
window close widget contains the modification indicator and whether the
proxy icon is draggable).
.TP
+\fB\-notify\fR
+Specifies process notification state (bouncing of the application dock icon).
+.TP
\fB\-titlepath\fR
Specifies the path of the file referenced as the window proxy icon (which
can be dragged and dropped in lieu of the file's finder icon).
.TP
-\fB\-alpha\fR
-Specifies the alpha transparency level of the window.
-It accepts a value from \fB0.0\fR (fully transparent) to \fB1.0\fR (opaque),
-values outside that range will be constrained.
-.TP
-\fB\-topmost\fR
-Specifies whether this is a topmost window (displays above all other windows).
-.TP
\fB\-transparent\fR
Makes the window content area transparent and turns off the window shadow. For
the transparency to be effecive, the toplevel background needs to be set to a
-color with some alpha, e.g. "systemTransparent".
-.TP
-\fB\-fullscreen\fR
-Places the window in a mode that takes up the entire main screen and hides
-the dock and menu bar.
-.RE
+color with some alpha, e.g.
+.QW systemTransparent .
.PP
-On X11, there are currently no special attribute values.
-.VE 8.4
+On X11, the following attributes may be set.
+These are not supported by all window managers,
+and will have no effect under older WMs.
+.\" See http://www.freedesktop.org/Standards/wm-spec
+.TP
+\fB\-zoomed\fR
+Requests that the window should be maximized.
+This is the same as \fBwm state zoomed\fR on Windows and Mac OS X.
+.PP
+On X11, changes to window attributes are performed asynchronously.
+Querying the value of an attribute returns the current state,
+which will not be the same as the value most recently set
+if the window manager has not yet processed the request
+or if it does not support the attribute.
+.RE
.TP
\fBwm client \fIwindow\fR ?\fIname\fR?
If \fIname\fR is specified, this command stores \fIname\fR (which
@@ -122,7 +139,7 @@ the host on which the application is executing) in \fIwindow\fR's
\fBWM_CLIENT_MACHINE\fR property for use by the window manager or
session manager.
The command returns an empty string in this case.
-If \fIname\fR isn't specified, the command returns the last name
+If \fIname\fR is not specified, the command returns the last name
set in a \fBwm client\fR command for \fIwindow\fR.
If \fIname\fR is specified as an empty string, the command deletes the
\fBWM_CLIENT_MACHINE\fR property from \fIwindow\fR.
@@ -131,7 +148,9 @@ If \fIname\fR is specified as an empty string, the command deletes the
This command is used to manipulate the \fBWM_COLORMAP_WINDOWS\fR
property, which provides information to the window managers about
windows that have private colormaps.
-If \fIwindowList\fR isn't specified, the command returns a list
+.RS
+.PP
+If \fIwindowList\fR is not specified, the command returns a list
whose elements are the names of the windows in the \fBWM_COLORMAP_WINDOWS\fR
property.
If \fIwindowList\fR is specified, it consists of a list of window
@@ -140,6 +159,7 @@ property with the given windows and returns an empty string.
The \fBWM_COLORMAP_WINDOWS\fR property should normally contain a
list of the internal windows within \fIwindow\fR whose colormaps differ
from their parents.
+.PP
The order of the windows in the property indicates a priority order:
the window manager will attempt to install as many colormaps as possible
from the head of this list when \fIwindow\fR gets the colormap focus.
@@ -152,6 +172,7 @@ whose colormaps differ from their parents, followed by the top-level
itself; the order of the internal windows is undefined.
See the ICCCM documentation for more information on the
\fBWM_COLORMAP_WINDOWS\fR property.
+.RE
.TP
\fBwm command \fIwindow\fR ?\fIvalue\fR?
If \fIvalue\fR is specified, this command stores \fIvalue\fR in \fIwindow\fR's
@@ -159,7 +180,7 @@ If \fIvalue\fR is specified, this command stores \fIvalue\fR in \fIwindow\fR's
session manager and returns an empty string.
\fIValue\fR must have proper list structure; the elements should
contain the words of the command used to invoke the application.
-If \fIvalue\fR isn't specified then the command returns the last value
+If \fIvalue\fR is not specified then the command returns the last value
set in a \fBwm command\fR command for \fIwindow\fR.
If \fIvalue\fR is specified as an empty string, the command
deletes the \fBWM_COMMAND\fR property from \fIwindow\fR.
@@ -179,6 +200,8 @@ to the command, then it specifies the focus model for \fIwindow\fR.
In this case the command returns an empty string. If no additional
argument is supplied, then the command returns the current focus
model for \fIwindow\fR.
+.RS
+.PP
An \fBactive\fR focus model means that \fIwindow\fR will claim the
input focus for itself or its descendants, even at times when
the focus is currently in some other application. \fBPassive\fR means that
@@ -188,16 +211,22 @@ once the focus has been given to \fIwindow\fR or one of its descendants,
the application may re-assign the focus among \fIwindow\fR's descendants.
The focus model defaults to \fBpassive\fR, and Tk's \fBfocus\fR command
assumes a passive model of focusing.
+.RE
+.TP
+\fBwm forget \fIwindow\fR
+The \fIwindow\fR will be unmapped from the screen and will no longer
+be managed by \fBwm\fR. Windows created with the \fBtoplevel\fR
+command will be treated like \fBframe\fR windows once they are no
+longer managed by \fBwm\fR, however, the \fB\-menu\fR configuration will be
+remembered and the menus will return once the widget is managed again.
.TP
\fBwm frame \fIwindow\fR
-.VS
If \fIwindow\fR has been reparented by the window manager into a
decorative frame, the command returns the platform specific window
identifier for the outermost frame that contains \fIwindow\fR (the
window whose parent is the root or virtual root). If \fIwindow\fR
-hasn't been reparented by the window manager then the command returns
+has not been reparented by the window manager then the command returns
the platform specific window identifier for \fIwindow\fR.
-.VE
.TP
\fBwm geometry \fIwindow\fR ?\fInewGeometry\fR?
If \fInewGeometry\fR is specified, then the geometry of \fIwindow\fR
@@ -209,9 +238,12 @@ the form \fB=\fIwidth\fBx\fIheight\fB\(+-\fIx\fB\(+-\fIy\fR, where
any of \fB=\fR, \fIwidth\fBx\fIheight\fR, or \fB\(+-\fIx\fB\(+-\fIy\fR
may be omitted. \fIWidth\fR and \fIheight\fR are positive integers
specifying the desired dimensions of \fIwindow\fR. If \fIwindow\fR
-is gridded (see GRIDDED GEOMETRY MANAGEMENT below) then the dimensions
+is gridded (see \fBGRIDDED GEOMETRY MANAGEMENT\fR below) then the dimensions
are specified in grid units; otherwise they are specified in pixel
-units. \fIX\fR and \fIy\fR specify the desired location of
+units.
+.RS
+.PP
+\fIX\fR and \fIy\fR specify the desired location of
\fIwindow\fR on the screen, in pixels.
If \fIx\fR is preceded by \fB+\fR, it specifies
the number of pixels between the left edge of the screen and the left
@@ -223,10 +255,12 @@ number of pixels between the top of the screen and the top
of \fIwindow\fR's border; if \fIy\fR is preceded by \fB\-\fR then
it specifies the number of pixels between the bottom of \fIwindow\fR's
border and the bottom of the screen.
+.PP
If \fInewGeometry\fR is specified as an empty string then any
existing user-specified geometry for \fIwindow\fR is cancelled, and
the window will revert to the size requested internally by its
widgets.
+.RE
.TP
\fBwm grid \fIwindow\fR ?\fIbaseWidth baseHeight widthInc heightInc\fR?
This command indicates that \fIwindow\fR is to be managed as a
@@ -243,20 +277,25 @@ that are non-negative integers.
Tk will pass this information to the window manager; during
manual resizing, the window manager will restrict the window's size
to one of these acceptable sizes.
+.RS
+.PP
Furthermore, during manual resizing the window manager will display
the window's current size in terms of grid units rather than pixels.
If \fIbaseWidth\fR etc. are all specified as empty strings, then
\fIwindow\fR will no longer be managed as a gridded window. If
\fIbaseWidth\fR etc. are specified then the return value is an
empty string.
+.PP
Otherwise the return value is a Tcl list containing
four elements corresponding to the current \fIbaseWidth\fR,
\fIbaseHeight\fR, \fIwidthInc\fR, and \fIheightInc\fR; if
\fIwindow\fR is not currently gridded, then an empty string
is returned.
+.PP
Note: this command should not be needed very often, since the
\fBTk_SetGrid\fR library procedure and the \fBsetGrid\fR option
provide easier access to the same functionality.
+.RE
.TP
\fBwm group \fIwindow\fR ?\fIpathName\fR?
If \fIpathName\fR is specified, it gives the path name for the leader of
@@ -266,7 +305,7 @@ leader is iconified. \fIPathName\fR may be specified as an empty string to
remove \fIwindow\fR from any group association. If \fIpathName\fR is
specified then the command returns an empty string; otherwise it
returns the path name of \fIwindow\fR's current group leader, or an empty
-string if \fIwindow\fR isn't part of any group.
+string if \fIwindow\fR is not part of any group.
.TP
\fBwm iconbitmap \fIwindow\fR ?\fIbitmap\fR?
If \fIbitmap\fR is specified, then it names a bitmap in the standard
@@ -280,7 +319,9 @@ Otherwise it returns the name of
the current icon bitmap associated with \fIwindow\fR, or an empty
string if \fIwindow\fR has no icon bitmap. On the Windows operating
system, an additional flag is supported:
-\fBwm iconbitmap \fIwindow\fR ?\fB\-default\fR? ?\fIimage\fR?.
+.RS
+.TP
+\fBwm iconbitmap \fIwindow\fR ?\fB\-default\fR? ?\fIimage\fR?
If the \fB\-default\fR
flag is given, the icon is applied to all toplevel windows (existing
and future) to which no other specific icon has yet been applied.
@@ -291,9 +332,10 @@ file for which the shell has assigned an icon. Tcl will
first test if the file contains an icon, then if it has an assigned
icon, and finally, if that fails, test for
a bitmap.
+.RE
.TP
\fBwm iconify \fIwindow\fR
-Arrange for \fIwindow\fR to be iconified. It \fIwindow\fR hasn't
+Arrange for \fIwindow\fR to be iconified. It \fIwindow\fR has not
yet been mapped for the first time, this command will arrange for
it to appear in the iconified state when it is eventually mapped.
.TP
@@ -315,11 +357,35 @@ returns the name of the current icon mask associated with
If \fInewName\fR is specified, then it is passed to the window
manager; the window manager should display \fInewName\fR inside
the icon associated with \fIwindow\fR. In this case an empty
-string is returned as result. If \fInewName\fR isn't specified
+string is returned as result. If \fInewName\fR is not specified
then the command returns the current icon name for \fIwindow\fR,
or an empty string if no icon name has been specified (in this
case the window manager will normally display the window's title,
as specified with the \fBwm title\fR command).
+.VS 8.5
+.TP
+\fBwm iconphoto \fIwindow\fR ?\fB\-default\fR? \fIimage1\fR ?\fIimage2 ...\fR?
+Sets the titlebar icon for \fIwindow\fR based on the named photo images.
+If \fB\-default\fR is specified, this is applied to all future created
+toplevels as well. The data in the images is taken as a snapshot at the
+time of invocation. If the images are later changed, this is not
+reflected to the titlebar icons. Multiple images are accepted to allow
+different images sizes (e.g., 16x16 and 32x32) to be provided. The window
+manager may scale provided icons to an appropriate size.
+.RS
+.PP
+On Windows, the images are packed into a Windows icon structure.
+This will override an ico specified to \fBwm iconbitmap\fR, and
+vice versa.
+.PP
+On X, the images are arranged into the _NET_WM_ICON X property, which
+most modern window managers support. A \fBwm iconbitmap\fR may exist
+simultaneously. It is recommended to use not more than 2 icons, placing
+the larger icon first.
+.PP
+On Macintosh, this currently does nothing.
+.VE 8.5
+.RE
.TP
\fBwm iconposition \fIwindow\fR ?\fIx y\fR?
If \fIx\fR and \fIy\fR are specified, they are passed to the window
@@ -342,10 +408,19 @@ returned. Otherwise the command returns the path name of the
current icon window for \fIwindow\fR, or an empty string if there
is no icon window currently specified for \fIwindow\fR.
Button press events are disabled for \fIwindow\fR as long as it is
-an icon window; this is needed in order to allow window managers
-to ``own'' those events.
+an icon window; this is needed in order to allow window managers to
+.QW own
+those events.
Note: not all window managers support the notion of an icon window.
.TP
+\fBwm manage \fIwidget\fR
+The \fIwidget\fR specified will become a stand alone top-level window. The
+window will be decorated with the window managers title bar, etc. Only
+\fIframe\fR, \fIlabelframe\fR and \fItoplevel\fR widgets can be used
+with this command. Attempting to pass any other widget type will raise
+an error. Attempting to manage a \fItoplevel\fR widget is benign and
+achieves nothing. See also \fBGEOMETRY MANAGEMENT\fR.
+.TP
\fBwm maxsize \fIwindow\fR ?\fIwidth height\fR?
If \fIwidth\fR and \fIheight\fR are specified, they give
the maximum permissible dimensions for \fIwindow\fR.
@@ -400,7 +475,8 @@ If \fIwho\fR is specified, then the command returns an empty string.
Otherwise it returns \fBuser\fR or \fBprogram\fR to indicate the
source of the window's current position, or an empty string if
no source has been specified yet. Most window managers interpret
-``no source'' as equivalent to \fBprogram\fR.
+.QW "no source"
+as equivalent to \fBprogram\fR.
Tk will automatically set the position source to \fBuser\fR
when a \fBwm geometry\fR command is invoked, unless the source has
been set explicitly to \fBprogram\fR.
@@ -419,7 +495,7 @@ protocol handler for \fIname\fR, and \fIcommand\fR will
be invoked in the future whenever the window manager sends a
message to the client for that protocol.
In this case the command returns an empty string.
-If \fIname\fR is specified but \fIcommand\fR isn't, then the current
+If \fIname\fR is specified but \fIcommand\fR is not, then the current
command for \fIname\fR is returned, or an empty string if there
is no handler defined for \fIname\fR.
If \fIcommand\fR is specified as an empty string then the current
@@ -432,8 +508,8 @@ are currently defined for \fIwindow\fR.
.RS
.PP
Tk always defines a protocol handler for \fBWM_DELETE_WINDOW\fR, even if
-you haven't asked for one with \fBwm protocol\fR.
-If a \fBWM_DELETE_WINDOW\fR message arrives when you haven't defined
+you have not asked for one with \fBwm protocol\fR.
+If a \fBWM_DELETE_WINDOW\fR message arrives when you have not defined
a handler, then Tk handles the message by destroying the window for
which it was received.
.RE
@@ -467,18 +543,19 @@ If \fIwho\fR is specified, then the command returns an empty string.
Otherwise it returns \fBuser\fR or \fBwindow\fR to indicate the
source of the window's current size, or an empty string if
no source has been specified yet. Most window managers interpret
-``no source'' as equivalent to \fBprogram\fR.
+.QW "no source"
+as equivalent to \fBprogram\fR.
.TP
-\fBwm stackorder \fIwindow\fR ?\fIisabove|isbelow window\fR?
-The stackorder command returns a list of toplevel windows
+\fBwm stackorder \fIwindow\fR ?\fBisabove\fR|\fBisbelow \fIwindow\fR?
+The \fBstackorder\fR command returns a list of toplevel windows
in stacking order, from lowest to highest. When a single toplevel
window is passed, the returned list recursively includes all of the
window's children that are toplevels. Only those toplevels
that are currently mapped to the screen are returned.
-The stackorder command can also be used to determine if one
+The \fBstackorder\fR command can also be used to determine if one
toplevel is positioned above or below a second toplevel.
-When two window arguments separated by either \fIisabove\fR or
-\fIisbelow\fR are passed, a boolean result indicates whether
+When two window arguments separated by either \fBisabove\fR or
+\fBisbelow\fR are passed, a boolean result indicates whether
or not the first window is currently above or below the second
window in the stacking order.
.TP
@@ -497,7 +574,7 @@ iconwindow\fR command). The \fBicon\fR state cannot be set.
If \fIstring\fR is specified, then it will be passed to the window
manager for use as the title for \fIwindow\fR (the window manager
should display this string in \fIwindow\fR's title bar). In this
-case the command returns an empty string. If \fIstring\fR isn't
+case the command returns an empty string. If \fIstring\fR is not
specified then the command returns the current title for the
\fIwindow\fR. The title for a window defaults to its name.
.TP
@@ -509,7 +586,7 @@ path name for a top-level window). If \fImaster\fR
is specified as an empty string then \fIwindow\fR is marked as not
being a transient window any more. Otherwise the command
returns the path name of \fIwindow\fR's current master, or an
-empty string if \fIwindow\fR isn't currently a transient window.
+empty string if \fIwindow\fR is not currently a transient window.
A transient window will mirror state changes in the master and
inherit the state of the master when initially mapped. It is an
error to attempt to make a window a transient of itself.
@@ -552,6 +629,21 @@ all forms of resizing, including the window's natural size as
well as manual resizes and the \fBwm geometry\fR command.
You can also use the command \fBwm resizable\fR to completely
disable interactive resizing in one or both dimensions.
+.PP
+The \fBwm manage\fR and \fBwm forget\fR commands may be used to
+perform undocking and docking of windows. After a widget is managed
+by \fBwm manage\fR command, all other \fBwm\fR subcommands may be used
+with the widget. Only widgets created using the toplevel command may
+have an attached menu via the \fB\-menu\fR configure option. A toplevel
+widget may be used as a frame and managed with any of the other
+geometry managers after using the \fBwm forget\fR command. Any menu
+associated with a toplevel widget will be hidden when managed by
+another geometry managers. The menus will reappear once the window is
+managed by \fBwm\fR. All custom bindtags for widgets in a subtree
+that have their top-level widget changed via a \fBwm manage\fR or
+\fBwm forget\fR command, must be redone to adjust any top-level widget
+path in the bindtags. Bindtags that have not been customized do not
+have to be redone.
.SH "GRIDDED GEOMETRY MANAGEMENT"
.PP
Gridded geometry management occurs when one of the widgets of an
@@ -588,7 +680,7 @@ rather than pixels.
.SH BUGS
.PP
Most existing window managers appear to have bugs that affect the
-operation of the \fBwm\fR command. For example, some changes won't
+operation of the \fBwm\fR command. For example, some changes will not
take effect if the window is already active: the window will have
to be withdrawn and de-iconified in order to make the change happen.
.SH EXAMPLES
@@ -622,9 +714,7 @@ set y [expr {([winfo screenheight .]\-[winfo height .msg])/2}]
\fBwm title\fR .msg "Dialog demo"
\fBwm deiconify\fR .msg
.CE
-
.SH "SEE ALSO"
toplevel(n), winfo(n)
-
.SH KEYWORDS
aspect ratio, deiconify, focus model, geometry, grid, group, icon, iconify, increments, position, size, title, top-level window, units, window manager
diff --git a/generic/README b/generic/README
index 285127c..6ac6bb4 100644
--- a/generic/README
+++ b/generic/README
@@ -1,3 +1,3 @@
This directory contains Tk source files that work on all the platforms
-where Tk runs (e.g. UNIX, PCs, and Macintoshes). Platform-specific
-sources are in the directories ../unix, ../win, ../macosx, and ../mac.
+where Tk runs (e.g. UNIX, PCs, and MacOSX). Platform-specific
+sources are in the directories ../unix, ../win, and ../macosx.
diff --git a/generic/default.h b/generic/default.h
index 0f67ebf..6156f4d 100644
--- a/generic/default.h
+++ b/generic/default.h
@@ -15,13 +15,11 @@
#define _DEFAULT
#if defined(__WIN32__) || defined(_WIN32) || \
- defined(__CYGWIN__) || defined(__MINGW32__)
+ defined(__MINGW32__)
# include "tkWinDefault.h"
#else
# if defined(MAC_OSX_TK)
# include "tkMacOSXDefault.h"
-# elif defined(MAC_TCL)
-# include "tkMacDefault.h"
# else
# include "tkUnixDefault.h"
# endif
diff --git a/generic/prolog.ps b/generic/prolog.ps
deleted file mode 100644
index 4076282..0000000
--- a/generic/prolog.ps
+++ /dev/null
@@ -1,283 +0,0 @@
-%%BeginProlog
-50 dict begin
-
-% This is a standard prolog for Postscript generated by Tk's canvas
-% widget.
-
-% The definitions below just define all of the variables used in
-% any of the procedures here. This is needed for obscure reasons
-% explained on p. 716 of the Postscript manual (Section H.2.7,
-% "Initializing Variables," in the section on Encapsulated Postscript).
-
-/baseline 0 def
-/stipimage 0 def
-/height 0 def
-/justify 0 def
-/lineLength 0 def
-/spacing 0 def
-/stipple 0 def
-/strings 0 def
-/xoffset 0 def
-/yoffset 0 def
-/tmpstip null def
-
-% Define the array ISOLatin1Encoding (which specifies how characters are
-% encoded for ISO-8859-1 fonts), if it isn't already present (Postscript
-% level 2 is supposed to define it, but level 1 doesn't).
-
-systemdict /ISOLatin1Encoding known not {
- /ISOLatin1Encoding [
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /exclam /quotedbl /numbersign /dollar /percent /ampersand
- /quoteright
- /parenleft /parenright /asterisk /plus /comma /minus /period /slash
- /zero /one /two /three /four /five /six /seven
- /eight /nine /colon /semicolon /less /equal /greater /question
- /at /A /B /C /D /E /F /G
- /H /I /J /K /L /M /N /O
- /P /Q /R /S /T /U /V /W
- /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
- /quoteleft /a /b /c /d /e /f /g
- /h /i /j /k /l /m /n /o
- /p /q /r /s /t /u /v /w
- /x /y /z /braceleft /bar /braceright /asciitilde /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
- /dieresis /space /ring /cedilla /space /hungarumlaut /ogonek /caron
- /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
- /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen
- /registered /macron
- /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph
- /periodcentered
- /cedillar /onesuperior /ordmasculine /guillemotright /onequarter
- /onehalf /threequarters /questiondown
- /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
- /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex
- /Idieresis
- /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
- /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn
- /germandbls
- /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
- /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex
- /idieresis
- /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
- /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn
- /ydieresis
- ] def
-} if
-
-% font ISOEncode font
-% This procedure changes the encoding of a font from the default
-% Postscript encoding to ISOLatin1. It's typically invoked just
-% before invoking "setfont". The body of this procedure comes from
-% Section 5.6.1 of the Postscript book.
-
-/ISOEncode {
- dup length dict begin
- {1 index /FID ne {def} {pop pop} ifelse} forall
- /Encoding ISOLatin1Encoding def
- currentdict
- end
-
- % I'm not sure why it's necessary to use "definefont" on this new
- % font, but it seems to be important; just use the name "Temporary"
- % for the font.
-
- /Temporary exch definefont
-} bind def
-
-% StrokeClip
-%
-% This procedure converts the current path into a clip area under
-% the assumption of stroking. It's a bit tricky because some Postscript
-% interpreters get errors during strokepath for dashed lines. If
-% this happens then turn off dashes and try again.
-
-/StrokeClip {
- {strokepath} stopped {
- (This Postscript printer gets limitcheck overflows when) =
- (stippling dashed lines; lines will be printed solid instead.) =
- [] 0 setdash strokepath} if
- clip
-} bind def
-
-% desiredSize EvenPixels closestSize
-%
-% The procedure below is used for stippling. Given the optimal size
-% of a dot in a stipple pattern in the current user coordinate system,
-% compute the closest size that is an exact multiple of the device's
-% pixel size. This allows stipple patterns to be displayed without
-% aliasing effects.
-
-/EvenPixels {
- % Compute exact number of device pixels per stipple dot.
- dup 0 matrix currentmatrix dtransform
- dup mul exch dup mul add sqrt
-
- % Round to an integer, make sure the number is at least 1, and compute
- % user coord distance corresponding to this.
- dup round dup 1 lt {pop 1} if
- exch div mul
-} bind def
-
-% width height string StippleFill --
-%
-% Given a path already set up and a clipping region generated from
-% it, this procedure will fill the clipping region with a stipple
-% pattern. "String" contains a proper image description of the
-% stipple pattern and "width" and "height" give its dimensions. Each
-% stipple dot is assumed to be about one unit across in the current
-% user coordinate system. This procedure trashes the graphics state.
-
-/StippleFill {
- % The following code is needed to work around a NeWSprint bug.
-
- /tmpstip 1 index def
-
- % Change the scaling so that one user unit in user coordinates
- % corresponds to the size of one stipple dot.
- 1 EvenPixels dup scale
-
- % Compute the bounding box occupied by the path (which is now
- % the clipping region), and round the lower coordinates down
- % to the nearest starting point for the stipple pattern. Be
- % careful about negative numbers, since the rounding works
- % differently on them.
-
- pathbbox
- 4 2 roll
- 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
- 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
-
- % Stack now: width height string y1 y2 x1 x2
- % Below is a doubly-nested for loop to iterate across this area
- % in units of the stipple pattern size, going up columns then
- % across rows, blasting out a stipple-pattern-sized rectangle at
- % each position
-
- 6 index exch {
- 2 index 5 index 3 index {
- % Stack now: width height string y1 y2 x y
-
- gsave
- 1 index exch translate
- 5 index 5 index true matrix tmpstip imagemask
- grestore
- } for
- pop
- } for
- pop pop pop pop pop
-} bind def
-
-% -- AdjustColor --
-% Given a color value already set for output by the caller, adjusts
-% that value to a grayscale or mono value if requested by the CL
-% variable.
-
-/AdjustColor {
- CL 2 lt {
- currentgray
- CL 0 eq {
- .5 lt {0} {1} ifelse
- } if
- setgray
- } if
-} bind def
-
-% x y strings spacing xoffset yoffset justify stipple DrawText --
-% This procedure does all of the real work of drawing text. The
-% color and font must already have been set by the caller, and the
-% following arguments must be on the stack:
-%
-% x, y - Coordinates at which to draw text.
-% strings - An array of strings, one for each line of the text item,
-% in order from top to bottom.
-% spacing - Spacing between lines.
-% xoffset - Horizontal offset for text bbox relative to x and y: 0 for
-% nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
-% yoffset - Vertical offset for text bbox relative to x and y: 0 for
-% nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
-% justify - 0 for left justification, 0.5 for center, 1 for right justify.
-% stipple - Boolean value indicating whether or not text is to be
-% drawn in stippled fashion. If text is stippled,
-% procedure StippleText must have been defined to call
-% StippleFill in the right way.
-%
-% Also, when this procedure is invoked, the color and font must already
-% have been set for the text.
-
-/DrawText {
- /stipple exch def
- /justify exch def
- /yoffset exch def
- /xoffset exch def
- /spacing exch def
- /strings exch def
-
- % First scan through all of the text to find the widest line.
-
- /lineLength 0 def
- strings {
- stringwidth pop
- dup lineLength gt {/lineLength exch def} {pop} ifelse
- newpath
- } forall
-
- % Compute the baseline offset and the actual font height.
-
- 0 0 moveto (TXygqPZ) false charpath
- pathbbox dup /baseline exch def
- exch pop exch sub /height exch def pop
- newpath
-
- % Translate coordinates first so that the origin is at the upper-left
- % corner of the text's bounding box. Remember that x and y for
- % positioning are still on the stack.
-
- translate
- lineLength xoffset mul
- strings length 1 sub spacing mul height add yoffset mul translate
-
- % Now use the baseline and justification information to translate so
- % that the origin is at the baseline and positioning point for the
- % first line of text.
-
- justify lineLength mul baseline neg translate
-
- % Iterate over each of the lines to output it. For each line,
- % compute its width again so it can be properly justified, then
- % display it.
-
- strings {
- dup stringwidth pop
- justify neg mul 0 moveto
- stipple {
-
- % The text is stippled, so turn it into a path and print
- % by calling StippledText, which in turn calls StippleFill.
- % Unfortunately, many Postscript interpreters will get
- % overflow errors if we try to do the whole string at
- % once, so do it a character at a time.
-
- gsave
- /char (X) def
- {
- char 0 3 -1 roll put
- currentpoint
- gsave
- char true charpath clip StippleText
- grestore
- char stringwidth translate
- moveto
- } forall
- grestore
- } {show} ifelse
- 0 spacing neg translate
- } forall
-} bind def
-
-%%EndProlog
diff --git a/generic/tk.decls b/generic/tk.decls
index 2424ee0..9037e75 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -4,9 +4,9 @@
# functions that are exported by the Tk library via the stubs table.
# This file is used to generate the tkDecls.h, tkPlatDecls.h,
# tkStub.c, and tkPlatStub.c files.
-#
#
# Copyright (c) 1998-2000 Ajuba Solutions.
+# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -26,1102 +26,886 @@ hooks {tkPlat tkInt tkIntPlat tkIntXlib}
# to preserve backwards compatibility.
declare 0 generic {
- void Tk_MainLoop (void)
+ void Tk_MainLoop(void)
}
-
declare 1 generic {
- XColor *Tk_3DBorderColor (Tk_3DBorder border)
+ XColor *Tk_3DBorderColor(Tk_3DBorder border)
}
-
declare 2 generic {
- GC Tk_3DBorderGC (Tk_Window tkwin, Tk_3DBorder border,
+ GC Tk_3DBorderGC(Tk_Window tkwin, Tk_3DBorder border,
int which)
}
-
declare 3 generic {
- void Tk_3DHorizontalBevel (Tk_Window tkwin,
+ void Tk_3DHorizontalBevel(Tk_Window tkwin,
Drawable drawable, Tk_3DBorder border, int x,
int y, int width, int height, int leftIn,
int rightIn, int topBevel, int relief)
}
-
declare 4 generic {
- void Tk_3DVerticalBevel (Tk_Window tkwin,
+ void Tk_3DVerticalBevel(Tk_Window tkwin,
Drawable drawable, Tk_3DBorder border, int x,
int y, int width, int height, int leftBevel,
int relief)
}
-
declare 5 generic {
- void Tk_AddOption (Tk_Window tkwin, CONST char *name,
+ void Tk_AddOption(Tk_Window tkwin, CONST char *name,
CONST char *value, int priority)
}
-
declare 6 generic {
- void Tk_BindEvent (Tk_BindingTable bindingTable,
+ void Tk_BindEvent(Tk_BindingTable bindingTable,
XEvent *eventPtr, Tk_Window tkwin, int numObjects,
ClientData *objectPtr)
}
-
declare 7 generic {
- void Tk_CanvasDrawableCoords (Tk_Canvas canvas,
+ void Tk_CanvasDrawableCoords(Tk_Canvas canvas,
double x, double y, short *drawableXPtr,
short *drawableYPtr)
}
-
declare 8 generic {
- void Tk_CanvasEventuallyRedraw (Tk_Canvas canvas, int x1, int y1,
+ void Tk_CanvasEventuallyRedraw(Tk_Canvas canvas, int x1, int y1,
int x2, int y2)
}
-
declare 9 generic {
- int Tk_CanvasGetCoord (Tcl_Interp *interp,
+ int Tk_CanvasGetCoord(Tcl_Interp *interp,
Tk_Canvas canvas, CONST char *str, double *doublePtr)
}
-
declare 10 generic {
- Tk_CanvasTextInfo *Tk_CanvasGetTextInfo (Tk_Canvas canvas)
+ Tk_CanvasTextInfo *Tk_CanvasGetTextInfo(Tk_Canvas canvas)
}
-
declare 11 generic {
- int Tk_CanvasPsBitmap (Tcl_Interp *interp,
+ int Tk_CanvasPsBitmap(Tcl_Interp *interp,
Tk_Canvas canvas, Pixmap bitmap, int x, int y,
int width, int height)
}
-
declare 12 generic {
- int Tk_CanvasPsColor (Tcl_Interp *interp,
+ int Tk_CanvasPsColor(Tcl_Interp *interp,
Tk_Canvas canvas, XColor *colorPtr)
}
-
declare 13 generic {
- int Tk_CanvasPsFont (Tcl_Interp *interp,
+ int Tk_CanvasPsFont(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Font font)
}
-
declare 14 generic {
- void Tk_CanvasPsPath (Tcl_Interp *interp,
+ void Tk_CanvasPsPath(Tcl_Interp *interp,
Tk_Canvas canvas, double *coordPtr, int numPoints)
}
-
declare 15 generic {
- int Tk_CanvasPsStipple (Tcl_Interp *interp,
+ int Tk_CanvasPsStipple(Tcl_Interp *interp,
Tk_Canvas canvas, Pixmap bitmap)
}
-
declare 16 generic {
- double Tk_CanvasPsY (Tk_Canvas canvas, double y)
+ double Tk_CanvasPsY(Tk_Canvas canvas, double y)
}
-
declare 17 generic {
- void Tk_CanvasSetStippleOrigin (Tk_Canvas canvas, GC gc)
+ void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc)
}
-
declare 18 generic {
- int Tk_CanvasTagsParseProc (ClientData clientData, Tcl_Interp *interp,
+ int Tk_CanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp,
Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
}
-
declare 19 generic {
- char * Tk_CanvasTagsPrintProc (ClientData clientData, Tk_Window tkwin,
+ char *Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
}
-
declare 20 generic {
- Tk_Window Tk_CanvasTkwin (Tk_Canvas canvas)
+ Tk_Window Tk_CanvasTkwin(Tk_Canvas canvas)
}
-
declare 21 generic {
- void Tk_CanvasWindowCoords (Tk_Canvas canvas, double x, double y,
+ void Tk_CanvasWindowCoords(Tk_Canvas canvas, double x, double y,
short *screenXPtr, short *screenYPtr)
}
-
declare 22 generic {
- void Tk_ChangeWindowAttributes (Tk_Window tkwin, unsigned long valueMask,
+ void Tk_ChangeWindowAttributes(Tk_Window tkwin, unsigned long valueMask,
XSetWindowAttributes *attsPtr)
}
-
declare 23 generic {
- int Tk_CharBbox (Tk_TextLayout layout, int index, int *xPtr,
+ int Tk_CharBbox(Tk_TextLayout layout, int index, int *xPtr,
int *yPtr, int *widthPtr, int *heightPtr)
}
-
declare 24 generic {
- void Tk_ClearSelection (Tk_Window tkwin, Atom selection)
+ void Tk_ClearSelection(Tk_Window tkwin, Atom selection)
}
-
declare 25 generic {
- int Tk_ClipboardAppend (Tcl_Interp *interp,Tk_Window tkwin,
- Atom target, Atom format, char* buffer)
+ int Tk_ClipboardAppend(Tcl_Interp *interp, Tk_Window tkwin,
+ Atom target, Atom format, char *buffer)
}
-
declare 26 generic {
- int Tk_ClipboardClear (Tcl_Interp *interp, Tk_Window tkwin)
+ int Tk_ClipboardClear(Tcl_Interp *interp, Tk_Window tkwin)
}
-
declare 27 generic {
- int Tk_ConfigureInfo (Tcl_Interp *interp,
+ int Tk_ConfigureInfo(Tcl_Interp *interp,
Tk_Window tkwin, Tk_ConfigSpec *specs,
char *widgRec, CONST char *argvName, int flags)
}
-
declare 28 generic {
- int Tk_ConfigureValue (Tcl_Interp *interp,
+ int Tk_ConfigureValue(Tcl_Interp *interp,
Tk_Window tkwin, Tk_ConfigSpec *specs,
char *widgRec, CONST char *argvName, int flags)
}
-
declare 29 generic {
- int Tk_ConfigureWidget (Tcl_Interp *interp,
+ int Tk_ConfigureWidget(Tcl_Interp *interp,
Tk_Window tkwin, Tk_ConfigSpec *specs,
int argc, CONST84 char **argv, char *widgRec,
int flags)
}
-
declare 30 generic {
- void Tk_ConfigureWindow (Tk_Window tkwin,
+ void Tk_ConfigureWindow(Tk_Window tkwin,
unsigned int valueMask, XWindowChanges *valuePtr)
}
-
declare 31 generic {
- Tk_TextLayout Tk_ComputeTextLayout (Tk_Font font,
+ Tk_TextLayout Tk_ComputeTextLayout(Tk_Font font,
CONST char *str, int numChars, int wrapLength,
Tk_Justify justify, int flags, int *widthPtr,
int *heightPtr)
}
-
declare 32 generic {
- Tk_Window Tk_CoordsToWindow (int rootX, int rootY, Tk_Window tkwin)
+ Tk_Window Tk_CoordsToWindow(int rootX, int rootY, Tk_Window tkwin)
}
-
declare 33 generic {
- unsigned long Tk_CreateBinding (Tcl_Interp *interp,
+ unsigned long Tk_CreateBinding(Tcl_Interp *interp,
Tk_BindingTable bindingTable, ClientData object,
CONST char *eventStr, CONST char *command, int append)
}
-
declare 34 generic {
- Tk_BindingTable Tk_CreateBindingTable (Tcl_Interp *interp)
+ Tk_BindingTable Tk_CreateBindingTable(Tcl_Interp *interp)
}
-
declare 35 generic {
- Tk_ErrorHandler Tk_CreateErrorHandler (Display *display,
+ Tk_ErrorHandler Tk_CreateErrorHandler(Display *display,
int errNum, int request, int minorCode,
Tk_ErrorProc *errorProc, ClientData clientData)
}
-
declare 36 generic {
- void Tk_CreateEventHandler (Tk_Window token,
+ void Tk_CreateEventHandler(Tk_Window token,
unsigned long mask, Tk_EventProc *proc,
ClientData clientData)
}
-
declare 37 generic {
- void Tk_CreateGenericHandler (Tk_GenericProc *proc, ClientData clientData)
+ void Tk_CreateGenericHandler(Tk_GenericProc *proc, ClientData clientData)
}
-
declare 38 generic {
- void Tk_CreateImageType (Tk_ImageType *typePtr)
+ void Tk_CreateImageType(Tk_ImageType *typePtr)
}
-
declare 39 generic {
- void Tk_CreateItemType (Tk_ItemType *typePtr)
+ void Tk_CreateItemType(Tk_ItemType *typePtr)
}
-
declare 40 generic {
- void Tk_CreatePhotoImageFormat (Tk_PhotoImageFormat *formatPtr)
+ void Tk_CreatePhotoImageFormat(Tk_PhotoImageFormat *formatPtr)
}
-
declare 41 generic {
- void Tk_CreateSelHandler (Tk_Window tkwin,
+ void Tk_CreateSelHandler(Tk_Window tkwin,
Atom selection, Atom target,
Tk_SelectionProc *proc, ClientData clientData,
Atom format)
}
-
declare 42 generic {
- Tk_Window Tk_CreateWindow (Tcl_Interp *interp,
+ Tk_Window Tk_CreateWindow(Tcl_Interp *interp,
Tk_Window parent, CONST char *name, CONST char *screenName)
}
-
declare 43 generic {
- Tk_Window Tk_CreateWindowFromPath (Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_Window Tk_CreateWindowFromPath(Tcl_Interp *interp, Tk_Window tkwin,
CONST char *pathName, CONST char *screenName)
}
-
declare 44 generic {
- int Tk_DefineBitmap (Tcl_Interp *interp, CONST char *name,
+ int Tk_DefineBitmap(Tcl_Interp *interp, CONST char *name,
CONST char *source, int width, int height)
}
-
declare 45 generic {
- void Tk_DefineCursor (Tk_Window window, Tk_Cursor cursor)
+ void Tk_DefineCursor(Tk_Window window, Tk_Cursor cursor)
}
-
declare 46 generic {
- void Tk_DeleteAllBindings (Tk_BindingTable bindingTable, ClientData object)
+ void Tk_DeleteAllBindings(Tk_BindingTable bindingTable, ClientData object)
}
-
declare 47 generic {
- int Tk_DeleteBinding (Tcl_Interp *interp,
+ int Tk_DeleteBinding(Tcl_Interp *interp,
Tk_BindingTable bindingTable, ClientData object,
CONST char *eventStr)
}
-
declare 48 generic {
- void Tk_DeleteBindingTable (Tk_BindingTable bindingTable)
+ void Tk_DeleteBindingTable(Tk_BindingTable bindingTable)
}
-
declare 49 generic {
- void Tk_DeleteErrorHandler (Tk_ErrorHandler handler)
+ void Tk_DeleteErrorHandler(Tk_ErrorHandler handler)
}
-
declare 50 generic {
- void Tk_DeleteEventHandler (Tk_Window token,
+ void Tk_DeleteEventHandler(Tk_Window token,
unsigned long mask, Tk_EventProc *proc,
ClientData clientData)
}
-
declare 51 generic {
- void Tk_DeleteGenericHandler (Tk_GenericProc *proc, ClientData clientData)
+ void Tk_DeleteGenericHandler(Tk_GenericProc *proc, ClientData clientData)
}
-
declare 52 generic {
- void Tk_DeleteImage (Tcl_Interp *interp, CONST char *name)
+ void Tk_DeleteImage(Tcl_Interp *interp, CONST char *name)
}
-
declare 53 generic {
- void Tk_DeleteSelHandler (Tk_Window tkwin, Atom selection, Atom target)
+ void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target)
}
-
declare 54 generic {
- void Tk_DestroyWindow (Tk_Window tkwin)
+ void Tk_DestroyWindow(Tk_Window tkwin)
}
-
declare 55 generic {
- CONST84_RETURN char * Tk_DisplayName (Tk_Window tkwin)
+ CONST84_RETURN char *Tk_DisplayName(Tk_Window tkwin)
}
-
declare 56 generic {
- int Tk_DistanceToTextLayout (Tk_TextLayout layout, int x, int y)
+ int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x, int y)
}
-
declare 57 generic {
- void Tk_Draw3DPolygon (Tk_Window tkwin,
+ void Tk_Draw3DPolygon(Tk_Window tkwin,
Drawable drawable, Tk_3DBorder border,
XPoint *pointPtr, int numPoints, int borderWidth,
int leftRelief)
}
-
declare 58 generic {
- void Tk_Draw3DRectangle (Tk_Window tkwin, Drawable drawable,
+ void Tk_Draw3DRectangle(Tk_Window tkwin, Drawable drawable,
Tk_3DBorder border, int x, int y, int width, int height,
int borderWidth, int relief)
}
-
declare 59 generic {
- void Tk_DrawChars (Display *display, Drawable drawable, GC gc,
+ void Tk_DrawChars(Display *display, Drawable drawable, GC gc,
Tk_Font tkfont, CONST char *source, int numBytes, int x, int y)
}
-
declare 60 generic {
- void Tk_DrawFocusHighlight (Tk_Window tkwin, GC gc, int width,
+ void Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc, int width,
Drawable drawable)
}
-
declare 61 generic {
- void Tk_DrawTextLayout (Display *display,
+ void Tk_DrawTextLayout(Display *display,
Drawable drawable, GC gc, Tk_TextLayout layout,
int x, int y, int firstChar, int lastChar)
}
-
declare 62 generic {
- void Tk_Fill3DPolygon (Tk_Window tkwin,
+ void Tk_Fill3DPolygon(Tk_Window tkwin,
Drawable drawable, Tk_3DBorder border,
XPoint *pointPtr, int numPoints, int borderWidth,
int leftRelief)
}
-
declare 63 generic {
- void Tk_Fill3DRectangle (Tk_Window tkwin,
+ void Tk_Fill3DRectangle(Tk_Window tkwin,
Drawable drawable, Tk_3DBorder border, int x,
int y, int width, int height, int borderWidth,
int relief)
}
-
declare 64 generic {
- Tk_PhotoHandle Tk_FindPhoto (Tcl_Interp *interp, CONST char *imageName)
+ Tk_PhotoHandle Tk_FindPhoto(Tcl_Interp *interp, CONST char *imageName)
}
-
declare 65 generic {
- Font Tk_FontId (Tk_Font font)
+ Font Tk_FontId(Tk_Font font)
}
-
declare 66 generic {
- void Tk_Free3DBorder (Tk_3DBorder border)
+ void Tk_Free3DBorder(Tk_3DBorder border)
}
-
declare 67 generic {
- void Tk_FreeBitmap (Display *display, Pixmap bitmap)
+ void Tk_FreeBitmap(Display *display, Pixmap bitmap)
}
-
declare 68 generic {
- void Tk_FreeColor (XColor *colorPtr)
+ void Tk_FreeColor(XColor *colorPtr)
}
-
declare 69 generic {
- void Tk_FreeColormap (Display *display, Colormap colormap)
+ void Tk_FreeColormap(Display *display, Colormap colormap)
}
-
declare 70 generic {
- void Tk_FreeCursor (Display *display, Tk_Cursor cursor)
+ void Tk_FreeCursor(Display *display, Tk_Cursor cursor)
}
-
declare 71 generic {
- void Tk_FreeFont (Tk_Font f)
+ void Tk_FreeFont(Tk_Font f)
}
-
declare 72 generic {
- void Tk_FreeGC (Display *display, GC gc)
+ void Tk_FreeGC(Display *display, GC gc)
}
-
declare 73 generic {
- void Tk_FreeImage (Tk_Image image)
+ void Tk_FreeImage(Tk_Image image)
}
-
declare 74 generic {
- void Tk_FreeOptions (Tk_ConfigSpec *specs,
+ void Tk_FreeOptions(Tk_ConfigSpec *specs,
char *widgRec, Display *display, int needFlags)
}
-
declare 75 generic {
- void Tk_FreePixmap (Display *display, Pixmap pixmap)
+ void Tk_FreePixmap(Display *display, Pixmap pixmap)
}
-
declare 76 generic {
- void Tk_FreeTextLayout (Tk_TextLayout textLayout)
+ void Tk_FreeTextLayout(Tk_TextLayout textLayout)
}
-
declare 77 generic {
- void Tk_FreeXId (Display *display, XID xid)
+ void Tk_FreeXId(Display *display, XID xid)
}
-
declare 78 generic {
- GC Tk_GCForColor (XColor *colorPtr, Drawable drawable)
+ GC Tk_GCForColor(XColor *colorPtr, Drawable drawable)
}
-
declare 79 generic {
- void Tk_GeometryRequest (Tk_Window tkwin, int reqWidth, int reqHeight)
+ void Tk_GeometryRequest(Tk_Window tkwin, int reqWidth, int reqHeight)
}
-
declare 80 generic {
- Tk_3DBorder Tk_Get3DBorder (Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_3DBorder Tk_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin,
Tk_Uid colorName)
}
-
declare 81 generic {
- void Tk_GetAllBindings (Tcl_Interp *interp,
+ void Tk_GetAllBindings(Tcl_Interp *interp,
Tk_BindingTable bindingTable, ClientData object)
}
-
declare 82 generic {
- int Tk_GetAnchor (Tcl_Interp *interp,
+ int Tk_GetAnchor(Tcl_Interp *interp,
CONST char *str, Tk_Anchor *anchorPtr)
}
-
declare 83 generic {
- CONST84_RETURN char * Tk_GetAtomName (Tk_Window tkwin, Atom atom)
+ CONST84_RETURN char *Tk_GetAtomName(Tk_Window tkwin, Atom atom)
}
-
declare 84 generic {
- CONST84_RETURN char * Tk_GetBinding (Tcl_Interp *interp,
+ CONST84_RETURN char *Tk_GetBinding(Tcl_Interp *interp,
Tk_BindingTable bindingTable, ClientData object,
CONST char *eventStr)
}
-
declare 85 generic {
- Pixmap Tk_GetBitmap (Tcl_Interp *interp, Tk_Window tkwin, CONST char * str)
+ Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin, CONST char *str)
}
-
declare 86 generic {
- Pixmap Tk_GetBitmapFromData (Tcl_Interp *interp,
+ Pixmap Tk_GetBitmapFromData(Tcl_Interp *interp,
Tk_Window tkwin, CONST char *source, int width, int height)
}
-
declare 87 generic {
- int Tk_GetCapStyle (Tcl_Interp *interp, CONST char *str, int *capPtr)
+ int Tk_GetCapStyle(Tcl_Interp *interp, CONST char *str, int *capPtr)
}
-
declare 88 generic {
- XColor * Tk_GetColor (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name)
+ XColor *Tk_GetColor(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name)
}
-
declare 89 generic {
- XColor * Tk_GetColorByValue (Tk_Window tkwin, XColor *colorPtr)
+ XColor *Tk_GetColorByValue(Tk_Window tkwin, XColor *colorPtr)
}
-
declare 90 generic {
- Colormap Tk_GetColormap (Tcl_Interp *interp, Tk_Window tkwin,
+ Colormap Tk_GetColormap(Tcl_Interp *interp, Tk_Window tkwin,
CONST char *str)
}
-
declare 91 generic {
- Tk_Cursor Tk_GetCursor (Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_Cursor Tk_GetCursor(Tcl_Interp *interp, Tk_Window tkwin,
Tk_Uid str)
}
-
declare 92 generic {
- Tk_Cursor Tk_GetCursorFromData (Tcl_Interp *interp,
+ 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)
}
-
declare 93 generic {
- Tk_Font Tk_GetFont (Tcl_Interp *interp,
+ Tk_Font Tk_GetFont(Tcl_Interp *interp,
Tk_Window tkwin, CONST char *str)
}
-
declare 94 generic {
- Tk_Font Tk_GetFontFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ Tk_Font Tk_GetFontFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 95 generic {
- void Tk_GetFontMetrics (Tk_Font font, Tk_FontMetrics *fmPtr)
+ void Tk_GetFontMetrics(Tk_Font font, Tk_FontMetrics *fmPtr)
}
-
declare 96 generic {
- GC Tk_GetGC (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr)
+ GC Tk_GetGC(Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr)
}
-
declare 97 generic {
- Tk_Image Tk_GetImage (Tcl_Interp *interp, Tk_Window tkwin, CONST char *name,
+ Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, CONST char *name,
Tk_ImageChangedProc *changeProc, ClientData clientData)
}
-
declare 98 generic {
- ClientData Tk_GetImageMasterData (Tcl_Interp *interp,
+ ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
CONST char *name, Tk_ImageType **typePtrPtr)
}
-
declare 99 generic {
- Tk_ItemType * Tk_GetItemTypes (void)
+ Tk_ItemType *Tk_GetItemTypes(void)
}
-
declare 100 generic {
- int Tk_GetJoinStyle (Tcl_Interp *interp, CONST char *str, int *joinPtr)
+ int Tk_GetJoinStyle(Tcl_Interp *interp, CONST char *str, int *joinPtr)
}
-
declare 101 generic {
- int Tk_GetJustify (Tcl_Interp *interp,
+ int Tk_GetJustify(Tcl_Interp *interp,
CONST char *str, Tk_Justify *justifyPtr)
}
-
declare 102 generic {
- int Tk_GetNumMainWindows (void)
+ int Tk_GetNumMainWindows(void)
}
-
declare 103 generic {
- Tk_Uid Tk_GetOption (Tk_Window tkwin, CONST char *name,
+ Tk_Uid Tk_GetOption(Tk_Window tkwin, CONST char *name,
CONST char *className)
}
-
declare 104 generic {
- int Tk_GetPixels (Tcl_Interp *interp,
+ int Tk_GetPixels(Tcl_Interp *interp,
Tk_Window tkwin, CONST char *str, int *intPtr)
}
-
declare 105 generic {
- Pixmap Tk_GetPixmap (Display *display, Drawable d,
+ Pixmap Tk_GetPixmap(Display *display, Drawable d,
int width, int height, int depth)
}
-
declare 106 generic {
- int Tk_GetRelief (Tcl_Interp *interp, CONST char *name, int *reliefPtr)
+ int Tk_GetRelief(Tcl_Interp *interp, CONST char *name, int *reliefPtr)
}
-
declare 107 generic {
- void Tk_GetRootCoords (Tk_Window tkwin, int *xPtr, int *yPtr)
+ void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr)
}
-
declare 108 generic {
- int Tk_GetScrollInfo (Tcl_Interp *interp,
+ int Tk_GetScrollInfo(Tcl_Interp *interp,
int argc, CONST84 char **argv, double *dblPtr, int *intPtr)
}
-
declare 109 generic {
- int Tk_GetScreenMM (Tcl_Interp *interp,
+ int Tk_GetScreenMM(Tcl_Interp *interp,
Tk_Window tkwin, CONST char *str, double *doublePtr)
}
-
declare 110 generic {
- int Tk_GetSelection (Tcl_Interp *interp,
+ int Tk_GetSelection(Tcl_Interp *interp,
Tk_Window tkwin, Atom selection, Atom target,
Tk_GetSelProc *proc, ClientData clientData)
}
-
declare 111 generic {
- Tk_Uid Tk_GetUid (CONST char *str)
+ Tk_Uid Tk_GetUid(CONST char *str)
}
-
declare 112 generic {
- Visual * Tk_GetVisual (Tcl_Interp *interp,
+ Visual *Tk_GetVisual(Tcl_Interp *interp,
Tk_Window tkwin, CONST char *str, int *depthPtr,
Colormap *colormapPtr)
}
-
declare 113 generic {
- void Tk_GetVRootGeometry (Tk_Window tkwin,
+ void Tk_GetVRootGeometry(Tk_Window tkwin,
int *xPtr, int *yPtr, int *widthPtr, int *heightPtr)
}
-
declare 114 generic {
- int Tk_Grab (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal)
+ int Tk_Grab(Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal)
}
-
declare 115 generic {
- void Tk_HandleEvent (XEvent *eventPtr)
+ void Tk_HandleEvent(XEvent *eventPtr)
}
-
declare 116 generic {
- Tk_Window Tk_IdToWindow (Display *display, Window window)
+ Tk_Window Tk_IdToWindow(Display *display, Window window)
}
-
declare 117 generic {
- void Tk_ImageChanged (Tk_ImageMaster master, int x, int y,
+ void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
int width, int height, int imageWidth, int imageHeight)
}
-
declare 118 generic {
- int Tk_Init (Tcl_Interp *interp)
+ int Tk_Init(Tcl_Interp *interp)
}
-
declare 119 generic {
- Atom Tk_InternAtom (Tk_Window tkwin, CONST char *name)
+ Atom Tk_InternAtom(Tk_Window tkwin, CONST char *name)
}
-
declare 120 generic {
- int Tk_IntersectTextLayout (Tk_TextLayout layout, int x, int y,
+ int Tk_IntersectTextLayout(Tk_TextLayout layout, int x, int y,
int width, int height)
}
-
declare 121 generic {
- void Tk_MaintainGeometry (Tk_Window slave,
+ void Tk_MaintainGeometry(Tk_Window slave,
Tk_Window master, int x, int y, int width, int height)
}
-
declare 122 generic {
- Tk_Window Tk_MainWindow (Tcl_Interp *interp)
+ Tk_Window Tk_MainWindow(Tcl_Interp *interp)
}
-
declare 123 generic {
- void Tk_MakeWindowExist (Tk_Window tkwin)
+ void Tk_MakeWindowExist(Tk_Window tkwin)
}
-
declare 124 generic {
- void Tk_ManageGeometry (Tk_Window tkwin,
- Tk_GeomMgr *mgrPtr, ClientData clientData)
+ void Tk_ManageGeometry(Tk_Window tkwin,
+ CONST Tk_GeomMgr *mgrPtr, ClientData clientData)
}
-
declare 125 generic {
- void Tk_MapWindow (Tk_Window tkwin)
+ void Tk_MapWindow(Tk_Window tkwin)
}
-
declare 126 generic {
- int Tk_MeasureChars (Tk_Font tkfont,
+ int Tk_MeasureChars(Tk_Font tkfont,
CONST char *source, int numBytes, int maxPixels,
int flags, int *lengthPtr)
}
-
declare 127 generic {
- void Tk_MoveResizeWindow (Tk_Window tkwin,
+ void Tk_MoveResizeWindow(Tk_Window tkwin,
int x, int y, int width, int height)
}
-
declare 128 generic {
- void Tk_MoveWindow (Tk_Window tkwin, int x, int y)
+ void Tk_MoveWindow(Tk_Window tkwin, int x, int y)
}
-
declare 129 generic {
- void Tk_MoveToplevelWindow (Tk_Window tkwin, int x, int y)
+ void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y)
}
-
declare 130 generic {
- CONST84_RETURN char * Tk_NameOf3DBorder (Tk_3DBorder border)
+ CONST84_RETURN char *Tk_NameOf3DBorder(Tk_3DBorder border)
}
-
declare 131 generic {
- CONST84_RETURN char * Tk_NameOfAnchor (Tk_Anchor anchor)
+ CONST84_RETURN char *Tk_NameOfAnchor(Tk_Anchor anchor)
}
-
declare 132 generic {
- CONST84_RETURN char * Tk_NameOfBitmap (Display *display, Pixmap bitmap)
+ CONST84_RETURN char *Tk_NameOfBitmap(Display *display, Pixmap bitmap)
}
-
declare 133 generic {
- CONST84_RETURN char * Tk_NameOfCapStyle (int cap)
+ CONST84_RETURN char *Tk_NameOfCapStyle(int cap)
}
-
declare 134 generic {
- CONST84_RETURN char * Tk_NameOfColor (XColor *colorPtr)
+ CONST84_RETURN char *Tk_NameOfColor(XColor *colorPtr)
}
-
declare 135 generic {
- CONST84_RETURN char * Tk_NameOfCursor (Display *display, Tk_Cursor cursor)
+ CONST84_RETURN char *Tk_NameOfCursor(Display *display, Tk_Cursor cursor)
}
-
declare 136 generic {
- CONST84_RETURN char * Tk_NameOfFont (Tk_Font font)
+ CONST84_RETURN char *Tk_NameOfFont(Tk_Font font)
}
-
declare 137 generic {
- CONST84_RETURN char * Tk_NameOfImage (Tk_ImageMaster imageMaster)
+ CONST84_RETURN char *Tk_NameOfImage(Tk_ImageMaster imageMaster)
}
-
declare 138 generic {
- CONST84_RETURN char * Tk_NameOfJoinStyle (int join)
+ CONST84_RETURN char *Tk_NameOfJoinStyle(int join)
}
-
declare 139 generic {
- CONST84_RETURN char * Tk_NameOfJustify (Tk_Justify justify)
+ CONST84_RETURN char *Tk_NameOfJustify(Tk_Justify justify)
}
-
declare 140 generic {
- CONST84_RETURN char * Tk_NameOfRelief (int relief)
+ CONST84_RETURN char *Tk_NameOfRelief(int relief)
}
-
declare 141 generic {
- Tk_Window Tk_NameToWindow (Tcl_Interp *interp,
+ Tk_Window Tk_NameToWindow(Tcl_Interp *interp,
CONST char *pathName, Tk_Window tkwin)
}
-
declare 142 generic {
- void Tk_OwnSelection (Tk_Window tkwin,
+ void Tk_OwnSelection(Tk_Window tkwin,
Atom selection, Tk_LostSelProc *proc,
ClientData clientData)
}
-
declare 143 generic {
- int Tk_ParseArgv (Tcl_Interp *interp,
+ int Tk_ParseArgv(Tcl_Interp *interp,
Tk_Window tkwin, int *argcPtr, CONST84 char **argv,
Tk_ArgvInfo *argTable, int flags)
}
-
declare 144 generic {
- void Tk_PhotoPutBlock_NoComposite (Tk_PhotoHandle handle,
+ void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height)
}
-
declare 145 generic {
- void Tk_PhotoPutZoomedBlock_NoComposite (Tk_PhotoHandle handle,
+ void Tk_PhotoPutZoomedBlock_NoComposite(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int zoomX, int zoomY,
int subsampleX, int subsampleY)
}
-
declare 146 generic {
- int Tk_PhotoGetImage (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr)
+ int Tk_PhotoGetImage(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr)
}
-
declare 147 generic {
- void Tk_PhotoBlank (Tk_PhotoHandle handle)
+ void Tk_PhotoBlank(Tk_PhotoHandle handle)
}
-
declare 148 generic {
- void Tk_PhotoExpand (Tk_PhotoHandle handle, int width, int height )
+ void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle, int width, int height )
}
-
declare 149 generic {
- void Tk_PhotoGetSize (Tk_PhotoHandle handle, int *widthPtr, int *heightPtr)
+ void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr)
}
-
declare 150 generic {
- void Tk_PhotoSetSize (Tk_PhotoHandle handle, int width, int height)
+ void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle, int width, int height)
}
-
declare 151 generic {
- int Tk_PointToChar (Tk_TextLayout layout, int x, int y)
+ int Tk_PointToChar(Tk_TextLayout layout, int x, int y)
}
-
declare 152 generic {
- int Tk_PostscriptFontName (Tk_Font tkfont, Tcl_DString *dsPtr)
+ int Tk_PostscriptFontName(Tk_Font tkfont, Tcl_DString *dsPtr)
}
-
declare 153 generic {
- void Tk_PreserveColormap (Display *display, Colormap colormap)
+ void Tk_PreserveColormap(Display *display, Colormap colormap)
}
-
declare 154 generic {
- void Tk_QueueWindowEvent (XEvent *eventPtr, Tcl_QueuePosition position)
+ void Tk_QueueWindowEvent(XEvent *eventPtr, Tcl_QueuePosition position)
}
-
declare 155 generic {
- void Tk_RedrawImage (Tk_Image image, int imageX,
+ void Tk_RedrawImage(Tk_Image image, int imageX,
int imageY, int width, int height,
Drawable drawable, int drawableX, int drawableY)
}
-
declare 156 generic {
- void Tk_ResizeWindow (Tk_Window tkwin, int width, int height)
+ void Tk_ResizeWindow(Tk_Window tkwin, int width, int height)
}
-
declare 157 generic {
- int Tk_RestackWindow (Tk_Window tkwin, int aboveBelow, Tk_Window other)
+ int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow, Tk_Window other)
}
-
declare 158 generic {
- Tk_RestrictProc *Tk_RestrictEvents (Tk_RestrictProc *proc,
+ Tk_RestrictProc *Tk_RestrictEvents(Tk_RestrictProc *proc,
ClientData arg, ClientData *prevArgPtr)
}
-
declare 159 generic {
- int Tk_SafeInit (Tcl_Interp *interp)
+ int Tk_SafeInit(Tcl_Interp *interp)
}
-
declare 160 generic {
- CONST char * Tk_SetAppName (Tk_Window tkwin, CONST char *name)
+ CONST char *Tk_SetAppName(Tk_Window tkwin, CONST char *name)
}
-
declare 161 generic {
- void Tk_SetBackgroundFromBorder (Tk_Window tkwin, Tk_3DBorder border)
+ void Tk_SetBackgroundFromBorder(Tk_Window tkwin, Tk_3DBorder border)
}
-
declare 162 generic {
- void Tk_SetClass (Tk_Window tkwin, CONST char *className)
+ void Tk_SetClass(Tk_Window tkwin, CONST char *className)
}
-
declare 163 generic {
- void Tk_SetGrid (Tk_Window tkwin, int reqWidth, int reqHeight,
+ void Tk_SetGrid(Tk_Window tkwin, int reqWidth, int reqHeight,
int gridWidth, int gridHeight)
}
-
declare 164 generic {
- void Tk_SetInternalBorder (Tk_Window tkwin, int width)
+ void Tk_SetInternalBorder(Tk_Window tkwin, int width)
}
-
declare 165 generic {
- void Tk_SetWindowBackground (Tk_Window tkwin, unsigned long pixel)
+ void Tk_SetWindowBackground(Tk_Window tkwin, unsigned long pixel)
}
-
declare 166 generic {
- void Tk_SetWindowBackgroundPixmap (Tk_Window tkwin, Pixmap pixmap)
+ void Tk_SetWindowBackgroundPixmap(Tk_Window tkwin, Pixmap pixmap)
}
-
declare 167 generic {
- void Tk_SetWindowBorder (Tk_Window tkwin, unsigned long pixel)
+ void Tk_SetWindowBorder(Tk_Window tkwin, unsigned long pixel)
}
-
declare 168 generic {
- void Tk_SetWindowBorderWidth (Tk_Window tkwin, int width)
+ void Tk_SetWindowBorderWidth(Tk_Window tkwin, int width)
}
-
declare 169 generic {
- void Tk_SetWindowBorderPixmap (Tk_Window tkwin, Pixmap pixmap)
+ void Tk_SetWindowBorderPixmap(Tk_Window tkwin, Pixmap pixmap)
}
-
declare 170 generic {
- void Tk_SetWindowColormap (Tk_Window tkwin, Colormap colormap)
+ void Tk_SetWindowColormap(Tk_Window tkwin, Colormap colormap)
}
-
declare 171 generic {
- int Tk_SetWindowVisual (Tk_Window tkwin, Visual *visual, int depth,
+ int Tk_SetWindowVisual(Tk_Window tkwin, Visual *visual, int depth,
Colormap colormap)
}
-
declare 172 generic {
- void Tk_SizeOfBitmap (Display *display, Pixmap bitmap, int *widthPtr,
+ void Tk_SizeOfBitmap(Display *display, Pixmap bitmap, int *widthPtr,
int *heightPtr)
}
-
declare 173 generic {
- void Tk_SizeOfImage (Tk_Image image, int *widthPtr, int *heightPtr)
+ void Tk_SizeOfImage(Tk_Image image, int *widthPtr, int *heightPtr)
}
-
declare 174 generic {
- int Tk_StrictMotif (Tk_Window tkwin)
+ int Tk_StrictMotif(Tk_Window tkwin)
}
-
declare 175 generic {
- void Tk_TextLayoutToPostscript (Tcl_Interp *interp, Tk_TextLayout layout)
+ void Tk_TextLayoutToPostscript(Tcl_Interp *interp, Tk_TextLayout layout)
}
-
declare 176 generic {
- int Tk_TextWidth (Tk_Font font, CONST char *str, int numBytes)
+ int Tk_TextWidth(Tk_Font font, CONST char *str, int numBytes)
}
-
declare 177 generic {
- void Tk_UndefineCursor (Tk_Window window)
+ void Tk_UndefineCursor(Tk_Window window)
}
-
declare 178 generic {
- void Tk_UnderlineChars (Display *display,
+ void Tk_UnderlineChars(Display *display,
Drawable drawable, GC gc, Tk_Font tkfont,
CONST char *source, int x, int y, int firstByte,
int lastByte)
}
-
declare 179 generic {
- void Tk_UnderlineTextLayout (Display *display, Drawable drawable, GC gc,
+ void Tk_UnderlineTextLayout(Display *display, Drawable drawable, GC gc,
Tk_TextLayout layout, int x, int y,
int underline)
}
-
declare 180 generic {
- void Tk_Ungrab (Tk_Window tkwin)
+ void Tk_Ungrab(Tk_Window tkwin)
}
-
declare 181 generic {
- void Tk_UnmaintainGeometry (Tk_Window slave, Tk_Window master)
+ void Tk_UnmaintainGeometry(Tk_Window slave, Tk_Window master)
}
-
declare 182 generic {
- void Tk_UnmapWindow (Tk_Window tkwin)
+ void Tk_UnmapWindow(Tk_Window tkwin)
}
-
declare 183 generic {
- void Tk_UnsetGrid (Tk_Window tkwin)
+ void Tk_UnsetGrid(Tk_Window tkwin)
}
-
declare 184 generic {
- void Tk_UpdatePointer (Tk_Window tkwin, int x, int y, int state)
+ void Tk_UpdatePointer(Tk_Window tkwin, int x, int y, int state)
}
# new functions for 8.1
declare 185 generic {
- Pixmap Tk_AllocBitmapFromObj (Tcl_Interp *interp, Tk_Window tkwin,
+ Pixmap Tk_AllocBitmapFromObj(Tcl_Interp *interp, Tk_Window tkwin,
Tcl_Obj *objPtr)
}
-
declare 186 generic {
- Tk_3DBorder Tk_Alloc3DBorderFromObj (Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_3DBorder Tk_Alloc3DBorderFromObj(Tcl_Interp *interp, Tk_Window tkwin,
Tcl_Obj *objPtr)
}
-
declare 187 generic {
- XColor * Tk_AllocColorFromObj (Tcl_Interp *interp, Tk_Window tkwin,
+ XColor *Tk_AllocColorFromObj(Tcl_Interp *interp, Tk_Window tkwin,
Tcl_Obj *objPtr)
}
-
declare 188 generic {
- Tk_Cursor Tk_AllocCursorFromObj (Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_Cursor Tk_AllocCursorFromObj(Tcl_Interp *interp, Tk_Window tkwin,
Tcl_Obj *objPtr)
}
-
declare 189 generic {
- Tk_Font Tk_AllocFontFromObj (Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_Font Tk_AllocFontFromObj(Tcl_Interp *interp, Tk_Window tkwin,
Tcl_Obj *objPtr)
}
-
declare 190 generic {
- Tk_OptionTable Tk_CreateOptionTable (Tcl_Interp *interp,
+ Tk_OptionTable Tk_CreateOptionTable(Tcl_Interp *interp,
CONST Tk_OptionSpec *templatePtr)
}
-
declare 191 generic {
- void Tk_DeleteOptionTable (Tk_OptionTable optionTable)
+ void Tk_DeleteOptionTable(Tk_OptionTable optionTable)
}
-
declare 192 generic {
- void Tk_Free3DBorderFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ void Tk_Free3DBorderFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 193 generic {
- void Tk_FreeBitmapFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ void Tk_FreeBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 194 generic {
- void Tk_FreeColorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 195 generic {
- void Tk_FreeConfigOptions (char *recordPtr, Tk_OptionTable optionToken,
+ void Tk_FreeConfigOptions(char *recordPtr, Tk_OptionTable optionToken,
Tk_Window tkwin)
}
-
declare 196 generic {
- void Tk_FreeSavedOptions (Tk_SavedOptions *savePtr)
+ void Tk_FreeSavedOptions(Tk_SavedOptions *savePtr)
}
-
declare 197 generic {
- void Tk_FreeCursorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ void Tk_FreeCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 198 generic {
- void Tk_FreeFontFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ void Tk_FreeFontFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 199 generic {
- Tk_3DBorder Tk_Get3DBorderFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ Tk_3DBorder Tk_Get3DBorderFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 200 generic {
- int Tk_GetAnchorFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr,
+ int Tk_GetAnchorFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tk_Anchor *anchorPtr)
}
-
declare 201 generic {
- Pixmap Tk_GetBitmapFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ Pixmap Tk_GetBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 202 generic {
- XColor * Tk_GetColorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ XColor *Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 203 generic {
- Tk_Cursor Tk_GetCursorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr)
+ Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
}
-
declare 204 generic {
- Tcl_Obj * Tk_GetOptionInfo (Tcl_Interp *interp,
+ Tcl_Obj *Tk_GetOptionInfo(Tcl_Interp *interp,
char *recordPtr, Tk_OptionTable optionTable,
Tcl_Obj *namePtr, Tk_Window tkwin)
}
-
declare 205 generic {
- Tcl_Obj * Tk_GetOptionValue (Tcl_Interp *interp, char *recordPtr,
+ Tcl_Obj *Tk_GetOptionValue(Tcl_Interp *interp, char *recordPtr,
Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin)
}
-
declare 206 generic {
- int Tk_GetJustifyFromObj (Tcl_Interp *interp,
+ int Tk_GetJustifyFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tk_Justify *justifyPtr)
}
-
declare 207 generic {
- int Tk_GetMMFromObj (Tcl_Interp *interp,
+ int Tk_GetMMFromObj(Tcl_Interp *interp,
Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr)
}
-
declare 208 generic {
- int Tk_GetPixelsFromObj (Tcl_Interp *interp,
+ int Tk_GetPixelsFromObj(Tcl_Interp *interp,
Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr)
}
-
declare 209 generic {
- int Tk_GetReliefFromObj (Tcl_Interp *interp,
+ int Tk_GetReliefFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, int *resultPtr)
}
-
declare 210 generic {
- int Tk_GetScrollInfoObj (Tcl_Interp *interp,
+ int Tk_GetScrollInfoObj(Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[], double *dblPtr, int *intPtr)
}
-
declare 211 generic {
- int Tk_InitOptions (Tcl_Interp *interp, char *recordPtr,
+ int Tk_InitOptions(Tcl_Interp *interp, char *recordPtr,
Tk_OptionTable optionToken, Tk_Window tkwin)
}
-
declare 212 generic {
- void Tk_MainEx (int argc, char **argv, Tcl_AppInitProc *appInitProc,
+ void Tk_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc,
Tcl_Interp *interp)
}
-
declare 213 generic {
- void Tk_RestoreSavedOptions (Tk_SavedOptions *savePtr)
+ void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr)
}
-
declare 214 generic {
- int Tk_SetOptions (Tcl_Interp *interp, char *recordPtr,
+ 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)
}
-
declare 215 generic {
- void Tk_InitConsoleChannels (Tcl_Interp *interp)
+ void Tk_InitConsoleChannels(Tcl_Interp *interp)
}
-
declare 216 generic {
- int Tk_CreateConsoleWindow (Tcl_Interp *interp)
+ int Tk_CreateConsoleWindow(Tcl_Interp *interp)
}
-
declare 217 generic {
- void Tk_CreateSmoothMethod (Tcl_Interp *interp, Tk_SmoothMethod *method)
+ void Tk_CreateSmoothMethod(Tcl_Interp *interp, Tk_SmoothMethod *method)
}
#declare 218 generic {
-# void Tk_CreateCanvasVisitor (Tcl_Interp *interp, VOID *typePtr)
+# void Tk_CreateCanvasVisitor(Tcl_Interp *interp, VOID *typePtr)
#}
#declare 219 generic {
-# VOID *Tk_GetCanvasVisitor (Tcl_Interp *interp, CONST char *name)
+# VOID *Tk_GetCanvasVisitor(Tcl_Interp *interp, CONST char *name)
#}
declare 220 generic {
- int Tk_GetDash (Tcl_Interp *interp, CONST char *value, Tk_Dash *dash)
+ int Tk_GetDash(Tcl_Interp *interp, CONST char *value, Tk_Dash *dash)
}
declare 221 generic {
- void Tk_CreateOutline (Tk_Outline *outline)
+ void Tk_CreateOutline(Tk_Outline *outline)
}
declare 222 generic {
- void Tk_DeleteOutline (Display *display, Tk_Outline *outline)
+ void Tk_DeleteOutline(Display *display, Tk_Outline *outline)
}
declare 223 generic {
- int Tk_ConfigOutlineGC (XGCValues *gcValues, Tk_Canvas canvas,
+ int Tk_ConfigOutlineGC(XGCValues *gcValues, Tk_Canvas canvas,
Tk_Item *item, Tk_Outline *outline)
}
declare 224 generic {
- int Tk_ChangeOutlineGC (Tk_Canvas canvas, Tk_Item *item,
+ int Tk_ChangeOutlineGC(Tk_Canvas canvas, Tk_Item *item,
Tk_Outline *outline)
}
declare 225 generic {
- int Tk_ResetOutlineGC (Tk_Canvas canvas, Tk_Item *item,
+ int Tk_ResetOutlineGC(Tk_Canvas canvas, Tk_Item *item,
Tk_Outline *outline)
}
declare 226 generic {
- int Tk_CanvasPsOutline (Tk_Canvas canvas, Tk_Item *item,
+ int Tk_CanvasPsOutline(Tk_Canvas canvas, Tk_Item *item,
Tk_Outline *outline)
}
declare 227 generic {
- void Tk_SetTSOrigin (Tk_Window tkwin, GC gc, int x, int y)
+ void Tk_SetTSOrigin(Tk_Window tkwin, GC gc, int x, int y)
}
declare 228 generic {
- int Tk_CanvasGetCoordFromObj (Tcl_Interp *interp, Tk_Canvas canvas,
+ int Tk_CanvasGetCoordFromObj(Tcl_Interp *interp, Tk_Canvas canvas,
Tcl_Obj *obj, double *doublePtr)
}
declare 229 generic {
- void Tk_CanvasSetOffset (Tk_Canvas canvas, GC gc, Tk_TSOffset *offset)
+ void Tk_CanvasSetOffset(Tk_Canvas canvas, GC gc, Tk_TSOffset *offset)
}
declare 230 generic {
- void Tk_DitherPhoto (Tk_PhotoHandle handle, int x, int y, int width,
+ void Tk_DitherPhoto(Tk_PhotoHandle handle, int x, int y, int width,
int height)
}
declare 231 generic {
- int Tk_PostscriptBitmap (Tcl_Interp *interp, Tk_Window tkwin,
+ int Tk_PostscriptBitmap(Tcl_Interp *interp, Tk_Window tkwin,
Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX,
int startY, int width, int height)
}
declare 232 generic {
- int Tk_PostscriptColor (Tcl_Interp *interp, Tk_PostscriptInfo psInfo,
+ int Tk_PostscriptColor(Tcl_Interp *interp, Tk_PostscriptInfo psInfo,
XColor *colorPtr)
}
declare 233 generic {
- int Tk_PostscriptFont (Tcl_Interp *interp, Tk_PostscriptInfo psInfo,
+ int Tk_PostscriptFont(Tcl_Interp *interp, Tk_PostscriptInfo psInfo,
Tk_Font font)
}
declare 234 generic {
- int Tk_PostscriptImage (Tk_Image image, Tcl_Interp *interp,
+ int Tk_PostscriptImage(Tk_Image image, Tcl_Interp *interp,
Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y,
int width, int height, int prepass)
}
declare 235 generic {
- void Tk_PostscriptPath (Tcl_Interp *interp, Tk_PostscriptInfo psInfo,
+ void Tk_PostscriptPath(Tcl_Interp *interp, Tk_PostscriptInfo psInfo,
double *coordPtr, int numPoints)
}
declare 236 generic {
- int Tk_PostscriptStipple (Tcl_Interp *interp, Tk_Window tkwin,
+ int Tk_PostscriptStipple(Tcl_Interp *interp, Tk_Window tkwin,
Tk_PostscriptInfo psInfo, Pixmap bitmap)
}
declare 237 generic {
- double Tk_PostscriptY (double y, Tk_PostscriptInfo psInfo)
+ double Tk_PostscriptY(double y, Tk_PostscriptInfo psInfo)
}
declare 238 generic {
- int Tk_PostscriptPhoto (Tcl_Interp *interp,
+ int Tk_PostscriptPhoto(Tcl_Interp *interp,
Tk_PhotoImageBlock *blockPtr, Tk_PostscriptInfo psInfo,
int width, int height)
}
@@ -1129,254 +913,267 @@ declare 238 generic {
# New in 8.4a1
#
declare 239 generic {
- void Tk_CreateClientMessageHandler (Tk_ClientMessageProc *proc)
+ void Tk_CreateClientMessageHandler(Tk_ClientMessageProc *proc)
}
declare 240 generic {
- void Tk_DeleteClientMessageHandler (Tk_ClientMessageProc *proc)
+ void Tk_DeleteClientMessageHandler(Tk_ClientMessageProc *proc)
}
# New in 8.4a2
#
declare 241 generic {
- Tk_Window Tk_CreateAnonymousWindow (Tcl_Interp *interp,
+ Tk_Window Tk_CreateAnonymousWindow(Tcl_Interp *interp,
Tk_Window parent, CONST char *screenName)
}
declare 242 generic {
- void Tk_SetClassProcs (Tk_Window tkwin,
+ void Tk_SetClassProcs(Tk_Window tkwin,
Tk_ClassProcs *procs, ClientData instanceData)
}
# New in 8.4a4
#
declare 243 generic {
- void Tk_SetInternalBorderEx (Tk_Window tkwin, int left, int right,
+ void Tk_SetInternalBorderEx(Tk_Window tkwin, int left, int right,
int top, int bottom)
}
declare 244 generic {
- void Tk_SetMinimumRequestSize (Tk_Window tkwin,
+ void Tk_SetMinimumRequestSize(Tk_Window tkwin,
int minWidth, int minHeight)
}
# New in 8.4a5
#
declare 245 generic {
- void Tk_SetCaretPos (Tk_Window tkwin, int x, int y, int height)
+ void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
}
-
declare 246 generic {
- void Tk_PhotoPutBlock (Tk_PhotoHandle handle,
+ void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int compRule)
}
declare 247 generic {
- void Tk_PhotoPutZoomedBlock (Tk_PhotoHandle handle,
+ void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle,
Tk_PhotoImageBlock *blockPtr, int x, int y,
int width, int height, int zoomX, int zoomY,
int subsampleX, int subsampleY, int compRule)
}
-
declare 248 generic {
- int Tk_CollapseMotionEvents (Display *display, int collapse)
+ int Tk_CollapseMotionEvents(Display *display, int collapse)
}
# Style engine
declare 249 generic {
- Tk_StyleEngine Tk_RegisterStyleEngine (CONST char *name,
+ Tk_StyleEngine Tk_RegisterStyleEngine(CONST char *name,
Tk_StyleEngine parent)
}
declare 250 generic {
- Tk_StyleEngine Tk_GetStyleEngine (CONST char *name)
+ Tk_StyleEngine Tk_GetStyleEngine(CONST char *name)
}
declare 251 generic {
- int Tk_RegisterStyledElement (Tk_StyleEngine engine,
+ int Tk_RegisterStyledElement(Tk_StyleEngine engine,
Tk_ElementSpec *templatePtr)
}
declare 252 generic {
- int Tk_GetElementId (CONST char *name)
+ int Tk_GetElementId(CONST char *name)
}
declare 253 generic {
- Tk_Style Tk_CreateStyle (CONST char *name, Tk_StyleEngine engine,
+ Tk_Style Tk_CreateStyle(CONST char *name, Tk_StyleEngine engine,
ClientData clientData)
}
declare 254 generic {
- Tk_Style Tk_GetStyle (Tcl_Interp *interp, CONST char *name)
+ Tk_Style Tk_GetStyle(Tcl_Interp *interp, CONST char *name)
}
declare 255 generic {
- void Tk_FreeStyle (Tk_Style style)
+ void Tk_FreeStyle(Tk_Style style)
}
declare 256 generic {
- CONST char * Tk_NameOfStyle (Tk_Style style)
+ CONST char *Tk_NameOfStyle(Tk_Style style)
}
declare 257 generic {
- Tk_Style Tk_AllocStyleFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr)
+ Tk_Style Tk_AllocStyleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
}
declare 258 generic {
- Tk_Style Tk_GetStyleFromObj (Tcl_Obj *objPtr)
+ Tk_Style Tk_GetStyleFromObj(Tcl_Obj *objPtr)
}
declare 259 generic {
- void Tk_FreeStyleFromObj (Tcl_Obj *objPtr)
+ void Tk_FreeStyleFromObj(Tcl_Obj *objPtr)
}
declare 260 generic {
- Tk_StyledElement Tk_GetStyledElement (Tk_Style style, int elementId,
+ Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId,
Tk_OptionTable optionTable)
}
declare 261 generic {
- void Tk_GetElementSize (Tk_Style style, Tk_StyledElement element,
+ void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element,
char *recordPtr, Tk_Window tkwin, int width, int height,
int inner, int *widthPtr, int *heightPtr)
}
declare 262 generic {
- void Tk_GetElementBox (Tk_Style style, Tk_StyledElement element,
+ void Tk_GetElementBox(Tk_Style style, Tk_StyledElement element,
char *recordPtr, Tk_Window tkwin, int x, int y, int width,
int height, int inner, int *xPtr, int *yPtr, int *widthPtr,
int *heightPtr)
}
declare 263 generic {
- int Tk_GetElementBorderWidth (Tk_Style style, Tk_StyledElement element,
+ int Tk_GetElementBorderWidth(Tk_Style style, Tk_StyledElement element,
char *recordPtr, Tk_Window tkwin)
}
declare 264 generic {
- void Tk_DrawElement (Tk_Style style, Tk_StyledElement element,
+ void Tk_DrawElement(Tk_Style style, Tk_StyledElement element,
char *recordPtr, Tk_Window tkwin, Drawable d, int x, int y,
int width, int height, int state)
}
+# TIP#116
+declare 265 generic {
+ int Tk_PhotoExpand(Tcl_Interp *interp, Tk_PhotoHandle handle,
+ int width, int height)
+}
+declare 266 generic {
+ int Tk_PhotoPutBlock(Tcl_Interp *interp, Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height,
+ int compRule)
+}
+declare 267 generic {
+ int Tk_PhotoPutZoomedBlock(Tcl_Interp *interp, Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height,
+ int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule)
+}
+declare 268 generic {
+ int Tk_PhotoSetSize(Tcl_Interp *interp, Tk_PhotoHandle handle,
+ int width, int height)
+}
+# TIP#245
+declare 269 generic {
+ long Tk_GetUserInactiveTime(Display *dpy)
+}
+declare 270 generic {
+ void Tk_ResetUserInactiveTime(Display *dpy)
+}
+
+# TIP #264
+declare 271 generic {
+ Tcl_Interp *Tk_Interp(Tk_Window tkwin)
+}
+
+# Now that the Tk 8.2 -> 8.3 transition is long past, use more conventional
+# means to continue support for extensions using the USE_OLD_IMAGE to
+# continue use of their string-based Tcl_ImageTypes and Tcl_PhotoImageFormats.
+#
+# Note that this restores the usual rules for stub compatibility. Stub-enabled
+# extensions compiled against 8.5 headers and linked to the 8.5 stub library
+# will produce a file [load]able into an interp with Tk 8.X, for X >= 5.
+# It will *not* be [load]able into interps with Tk 8.4 (or Tk 8.2!).
+# Developers who need to produce a file [load]able into legacy interps must
+# build against legacy sources.
+declare 272 generic {
+ void Tk_CreateOldImageType(Tk_ImageType *typePtr)
+}
+declare 273 generic {
+ void Tk_CreateOldPhotoImageFormat(Tk_PhotoImageFormat *formatPtr)
+}
# Define the platform specific public Tk interface. These functions are
# only available on the designated platform.
interface tkPlat
+################################
# Unix specific functions
# (none)
+################################
# Windows specific functions
declare 0 win {
- Window Tk_AttachHWND (Tk_Window tkwin, HWND hwnd)
+ Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd)
}
-
declare 1 win {
- HINSTANCE Tk_GetHINSTANCE (void)
+ HINSTANCE Tk_GetHINSTANCE(void)
}
-
declare 2 win {
- HWND Tk_GetHWND (Window window)
+ HWND Tk_GetHWND(Window window)
}
-
declare 3 win {
- Tk_Window Tk_HWNDToWindow (HWND hwnd)
+ Tk_Window Tk_HWNDToWindow(HWND hwnd)
}
-
declare 4 win {
- void Tk_PointerEvent (HWND hwnd, int x, int y)
+ void Tk_PointerEvent(HWND hwnd, int x, int y)
}
-
declare 5 win {
- int Tk_TranslateWinEvent (HWND hwnd,
+ int Tk_TranslateWinEvent(HWND hwnd,
UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)
}
-# Mac specific functions
-
-declare 0 mac {
- void Tk_MacSetEmbedHandler (
- Tk_MacEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacEmbedGetClipProc *getClipProc,
- Tk_MacEmbedGetOffsetInParentProc *getOffsetProc)
-}
-
-declare 1 mac {
- void Tk_MacTurnOffMenus (void)
-}
-
-declare 2 mac {
- void Tk_MacTkOwnsCursor (int tkOwnsIt)
-}
-
-declare 3 mac {
- void TkMacInitMenus (Tcl_Interp *interp)
-}
-
-declare 4 mac {
- void TkMacInitAppleEvents (Tcl_Interp *interp)
-}
-
-declare 5 mac {
- int TkMacConvertEvent (EventRecord *eventPtr)
-}
-
-declare 6 mac {
- int TkMacConvertTkEvent (EventRecord *eventPtr, Window window)
-}
-
-declare 7 mac {
- void TkGenWMConfigureEvent (Tk_Window tkwin,
- int x, int y, int width, int height, int flags)
-}
-
-declare 8 mac {
- void TkMacInvalClipRgns (TkWindow *winPtr)
-}
-
-declare 9 mac {
- int TkMacHaveAppearance (void)
-}
-
-declare 10 mac {
- GWorldPtr TkMacGetDrawablePort (Drawable drawable)
-}
-
-# Mac OS X specific functions
+################################
+# Aqua specific functions
declare 0 aqua {
- void Tk_MacOSXSetEmbedHandler ( \
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, \
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, \
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, \
- Tk_MacOSXEmbedGetClipProc *getClipProc, \
+ void Tk_MacOSXSetEmbedHandler(
+ Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
+ Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
+ Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
+ Tk_MacOSXEmbedGetClipProc *getClipProc,
Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
}
-
declare 1 aqua {
- void Tk_MacOSXTurnOffMenus (void)
+ void Tk_MacOSXTurnOffMenus(void)
}
-
declare 2 aqua {
- void Tk_MacOSXTkOwnsCursor (int tkOwnsIt)
+ void Tk_MacOSXTkOwnsCursor(int tkOwnsIt)
}
-
declare 3 aqua {
- void TkMacOSXInitMenus (Tcl_Interp *interp)
+ void TkMacOSXInitMenus(Tcl_Interp *interp)
}
-
declare 4 aqua {
- void TkMacOSXInitAppleEvents (Tcl_Interp *interp)
+ void TkMacOSXInitAppleEvents(Tcl_Interp *interp)
}
-
declare 5 aqua {
- void TkGenWMConfigureEvent (Tk_Window tkwin, \
- int x, int y, int width, int height, int flags)
+ void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, int width,
+ int height, int flags)
}
-
declare 6 aqua {
- void TkMacOSXInvalClipRgns (Tk_Window tkwin)
+ void TkMacOSXInvalClipRgns(Tk_Window tkwin)
}
-
declare 7 aqua {
- GWorldPtr TkMacOSXGetDrawablePort (Drawable drawable)
+ GWorldPtr TkMacOSXGetDrawablePort(Drawable drawable)
}
-
declare 8 aqua {
- ControlRef TkMacOSXGetRootControl (Drawable drawable)
+ ControlRef TkMacOSXGetRootControl(Drawable drawable)
}
-
declare 9 aqua {
- void Tk_MacOSXSetupTkNotifier (void)
+ void Tk_MacOSXSetupTkNotifier(void)
}
-
declare 10 aqua {
- int Tk_MacOSXIsAppInFront (void)
+ int Tk_MacOSXIsAppInFront(void)
+}
+
+##############################################################################
+
+# Public functions that are not accessible via the stubs table.
+
+export {
+ CONST char *Tk_InitStubs(Tcl_Interp *interp, CONST char *version,
+ int exact)
+}
+export {
+ CONST char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, CONST char *version,
+ int exact)
+}
+
+# Global variables that need to be exported from the tcl shared library.
+
+export {
+ TkStubs *tkStubsPtr (fool checkstubs)
+}
+export {
+ TkPlatStubs *tkPlatStubsPtr (fool checkstubs)
+}
+export {
+ TkIntStubs *tkIntStubsPtr (fool checkstubs)
+}
+export {
+ TkIntPlatStubs *tkIntPlatStubsPtr (fool checkstubs)
+}
+export {
+ TkIntXlibStubs *tkIntXlibStubsPtr (fool checkstubs)
}
diff --git a/generic/tk.h b/generic/tk.h
index e777947..af7b05c 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -1,26 +1,24 @@
/*
* tk.h --
*
- * Declarations for Tk-related things that are visible
- * outside of the Tk module itself.
+ * Declarations for Tk-related things that are visible outside of the Tk
+ * module itself.
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994 The Australian National University.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 Ajuba Solutions.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TK
#define _TK
-#ifndef _TCL
#include <tcl.h>
-#if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION != 4)
-# error Tk 8.4 must be compiled with tcl.h from Tcl 8.4
-#endif
+#if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION != 5)
+# error Tk 8.5 must be compiled with tcl.h from Tcl 8.5
#endif
/*
@@ -35,46 +33,43 @@ extern "C" {
* When version numbers change here, you must also go into the following files
* and update the version numbers:
*
- * library/tk.tcl (only if Major.minor changes, not patchlevel)
+ * library/tk.tcl (2 LOC patch)
* unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch)
* win/configure.in (as above)
- * win/makefile.vc (not patchlevel)
* README (sections 0 and 1)
- * mac/README (not patchlevel)
+ * macosx/Wish.xcode/project.pbxproj (not patchlevel) 1 LOC
+ * macosx/Wish-Common.xcconfig (not patchlevel) 1 LOC
* win/README (not patchlevel)
* unix/README (not patchlevel)
- * unix/tk.spec (3 LOC Major/Minor, 2 LOC patch)
+ * unix/tk.spec (1 LOC patch)
* win/tcl.m4 (not patchlevel)
*
- * You may also need to update some of these files when the numbers change
- * for the version of Tcl that this release of Tk is compiled against.
+ * You may also need to update some of these files when the numbers change for
+ * the version of Tcl that this release of Tk is compiled against.
*/
-#define TK_MAJOR_VERSION 8
-#define TK_MINOR_VERSION 4
-#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE
-#define TK_RELEASE_SERIAL 19
+#define TK_MAJOR_VERSION 8
+#define TK_MINOR_VERSION 5
+#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE
+#define TK_RELEASE_SERIAL 11
-#define TK_VERSION "8.4"
-#define TK_PATCH_LEVEL "8.4.19"
+#define TK_VERSION "8.5"
+#define TK_PATCH_LEVEL "8.5.11"
-/*
- * A special definition used to allow this header file to be included
- * from windows or mac resource files so that they can obtain version
- * information. RC_INVOKED is defined by default by the windows RC tool
- * and manually set for macintosh.
+/*
+ * A special definition used to allow this header file to be included from
+ * windows or mac resource files so that they can obtain version information.
+ * RC_INVOKED is defined by default by the windows RC tool and manually set
+ * for macintosh.
*
- * Resource compilers don't like all the C stuff, like typedefs and
- * procedure declarations, that occur below, so block them out.
+ * Resource compilers don't like all the C stuff, like typedefs and procedure
+ * declarations, that occur below, so block them out.
*/
-
+
#ifndef RC_INVOKED
-
+
#ifndef _XLIB_H
-# if defined (MAC_TCL)
-# include <Xlib.h>
-# include <X.h>
-# elif defined(MAC_OSX_TK)
+# if defined(MAC_OSX_TK)
# include <X11/Xlib.h>
# include <X11/X.h>
# else
@@ -89,7 +84,7 @@ extern "C" {
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLEXPORT
#endif
-
+
/*
* Decide whether or not to use input methods.
*/
@@ -122,11 +117,11 @@ typedef struct Tk_StyledElement_ *Tk_StyledElement;
* Additional types exported to clients.
*/
-typedef CONST char *Tk_Uid;
+typedef const char *Tk_Uid;
/*
- * The enum below defines the valid types for Tk configuration options
- * as implemented by Tk_InitOptions, Tk_SetOptions, etc.
+ * The enum below defines the valid types for Tk configuration options as
+ * implemented by Tk_InitOptions, Tk_SetOptions, etc.
*/
typedef enum {
@@ -152,56 +147,54 @@ typedef enum {
} Tk_OptionType;
/*
- * Structures of the following type are used by widgets to specify
- * their configuration options. Typically each widget has a static
- * array of these structures, where each element of the array describes
- * a single configuration option. The array is passed to
- * Tk_CreateOptionTable.
+ * Structures of the following type are used by widgets to specify their
+ * configuration options. Typically each widget has a static array of these
+ * structures, where each element of the array describes a single
+ * configuration option. The array is passed to Tk_CreateOptionTable.
*/
typedef struct Tk_OptionSpec {
- Tk_OptionType type; /* Type of option, such as TK_OPTION_COLOR;
- * see definitions above. Last option in
- * table must have type TK_OPTION_END. */
- char *optionName; /* Name used to specify option in Tcl
+ Tk_OptionType type; /* Type of option, such as TK_OPTION_COLOR;
+ * see definitions above. Last option in table
+ * must have type TK_OPTION_END. */
+ const char *optionName; /* Name used to specify option in Tcl
* commands. */
- char *dbName; /* Name for option in option database. */
- char *dbClass; /* Class for option in database. */
- char *defValue; /* Default value for option if not specified
- * in command line, the option database,
- * or the system. */
+ const char *dbName; /* Name for option in option database. */
+ const char *dbClass; /* Class for option in database. */
+ const char *defValue; /* Default value for option if not specified
+ * in command line, the option database, or
+ * the system. */
int objOffset; /* Where in record to store a Tcl_Obj * that
* holds the value of this option, specified
- * as an offset in bytes from the start of
- * the record. Use the Tk_Offset macro to
- * generate values for this. -1 means don't
- * store the Tcl_Obj in the record. */
+ * as an offset in bytes from the start of the
+ * record. Use the Tk_Offset macro to generate
+ * values for this. -1 means don't store the
+ * Tcl_Obj in the record. */
int internalOffset; /* Where in record to store the internal
* representation of the value of this option,
- * such as an int or XColor *. This field
- * is specified as an offset in bytes
- * from the start of the record. Use the
- * Tk_Offset macro to generate values for it.
- * -1 means don't store the internal
- * representation in the record. */
+ * such as an int or XColor *. This field is
+ * specified as an offset in bytes from the
+ * start of the record. Use the Tk_Offset
+ * macro to generate values for it. -1 means
+ * don't store the internal representation in
+ * the record. */
int flags; /* Any combination of the values defined
* below. */
ClientData clientData; /* An alternate place to put option-specific
- * data. Used for the monochrome default value
+ * data. Used for the monochrome default value
* for colors, etc. */
- int typeMask; /* An arbitrary bit mask defined by the
- * class manager; typically bits correspond
- * to certain kinds of options such as all
- * those that require a redisplay when they
- * change. Tk_SetOptions returns the bit-wise
- * OR of the typeMasks of all options that
- * were changed. */
+ int typeMask; /* An arbitrary bit mask defined by the class
+ * manager; typically bits correspond to
+ * certain kinds of options such as all those
+ * that require a redisplay when they change.
+ * Tk_SetOptions returns the bit-wise OR of
+ * the typeMasks of all options that were
+ * changed. */
} Tk_OptionSpec;
/*
- * Flag values for Tk_OptionSpec structures. These flags are shared by
- * Tk_ConfigSpec structures, so be sure to coordinate any changes
- * carefully.
+ * Flag values for Tk_OptionSpec structures. These flags are shared by
+ * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully.
*/
#define TK_OPTION_NULL_OK (1 << 0)
@@ -222,28 +215,29 @@ typedef void (Tk_CustomOptionRestoreProc) _ANSI_ARGS_((ClientData clientData,
Tk_Window tkwin, char *internalPtr, char *saveInternalPtr));
typedef void (Tk_CustomOptionFreeProc) _ANSI_ARGS_((ClientData clientData,
Tk_Window tkwin, char *internalPtr));
-
+
typedef struct Tk_ObjCustomOption {
- char *name; /* Name of the custom option. */
- Tk_CustomOptionSetProc *setProc; /* Function to use to set a record's
- * option value from a Tcl_Obj */
- Tk_CustomOptionGetProc *getProc; /* Function to use to get a Tcl_Obj
- * representation from an internal
- * representation of an option. */
- Tk_CustomOptionRestoreProc *restoreProc; /* Function to use to restore a
- * saved value for the internal
- * representation. */
- Tk_CustomOptionFreeProc *freeProc; /* Function to use to free the internal
- * representation of an option. */
- ClientData clientData; /* Arbitrary one-word value passed to
- * the handling procs. */
+ const char *name; /* Name of the custom option. */
+ Tk_CustomOptionSetProc *setProc;
+ /* Function to use to set a record's option
+ * value from a Tcl_Obj */
+ Tk_CustomOptionGetProc *getProc;
+ /* Function to use to get a Tcl_Obj
+ * representation from an internal
+ * representation of an option. */
+ Tk_CustomOptionRestoreProc *restoreProc;
+ /* Function to use to restore a saved value
+ * for the internal representation. */
+ Tk_CustomOptionFreeProc *freeProc;
+ /* Function to use to free the internal
+ * representation of an option. */
+ ClientData clientData; /* Arbitrary one-word value passed to the
+ * handling procs. */
} Tk_ObjCustomOption;
-
/*
- * Macro to use to fill in "offset" fields of the Tk_OptionSpec.
- * struct. Computes number of bytes from beginning of structure
- * to a given field.
+ * Macro to use to fill in "offset" fields of the Tk_OptionSpec structure.
+ * Computes number of bytes from beginning of structure to a given field.
*/
#ifdef offsetof
@@ -253,34 +247,30 @@ typedef struct Tk_ObjCustomOption {
#endif
/*
- * The following two structures are used for error handling. When
- * configuration options are being modified, the old values are
- * saved in a Tk_SavedOptions structure. If an error occurs, then the
- * contents of the structure can be used to restore all of the old
- * values. The contents of this structure are for the private use
- * Tk. No-one outside Tk should ever read or write any of the fields
- * of these structures.
+ * The following two structures are used for error handling. When config
+ * options are being modified, the old values are saved in a Tk_SavedOptions
+ * structure. If an error occurs, then the contents of the structure can be
+ * used to restore all of the old values. The contents of this structure are
+ * for the private use Tk. No-one outside Tk should ever read or write any of
+ * the fields of these structures.
*/
typedef struct Tk_SavedOption {
- struct TkOption *optionPtr; /* Points to information that describes
- * the option. */
- Tcl_Obj *valuePtr; /* The old value of the option, in
- * the form of a Tcl object; may be
- * NULL if the value wasn't saved as
- * an object. */
- double internalForm; /* The old value of the option, in
- * some internal representation such
- * as an int or (XColor *). Valid
- * only if optionPtr->specPtr->objOffset
- * is < 0. The space must be large
- * enough to accommodate a double, a
- * long, or a pointer; right now it
- * looks like a double is big
- * enough. Also, using a double
- * guarantees that the field is
- * properly aligned for storing large
- * values. */
+ struct TkOption *optionPtr; /* Points to information that describes the
+ * option. */
+ Tcl_Obj *valuePtr; /* The old value of the option, in the form of
+ * a Tcl object; may be NULL if the value was
+ * not saved as an object. */
+ double internalForm; /* The old value of the option, in some
+ * internal representation such as an int or
+ * (XColor *). Valid only if the field
+ * optionPtr->specPtr->objOffset is < 0. The
+ * space must be large enough to accommodate a
+ * double, a long, or a pointer; right now it
+ * looks like a double (i.e., 8 bytes) is big
+ * enough. Also, using a double guarantees
+ * that the field is properly aligned for
+ * storing large values. */
} Tk_SavedOption;
#ifdef TCL_MEM_DEBUG
@@ -290,31 +280,30 @@ typedef struct Tk_SavedOption {
#endif
typedef struct Tk_SavedOptions {
- char *recordPtr; /* The data structure in which to
- * restore configuration options. */
- Tk_Window tkwin; /* Window associated with recordPtr;
- * needed to restore certain options. */
- int numItems; /* The number of valid items in
- * items field. */
+ char *recordPtr; /* The data structure in which to restore
+ * configuration options. */
+ Tk_Window tkwin; /* Window associated with recordPtr; needed to
+ * restore certain options. */
+ int numItems; /* The number of valid items in items field. */
Tk_SavedOption items[TK_NUM_SAVED_OPTIONS];
- /* Items used to hold old values. */
- struct Tk_SavedOptions *nextPtr; /* Points to next structure in list;
- * needed if too many options changed
- * to hold all the old values in a
- * single structure. NULL means no
- * more structures. */
+ /* Items used to hold old values. */
+ struct Tk_SavedOptions *nextPtr;
+ /* Points to next structure in list; needed if
+ * too many options changed to hold all the
+ * old values in a single structure. NULL
+ * means no more structures. */
} Tk_SavedOptions;
/*
- * Structure used to describe application-specific configuration
- * options: indicates procedures to call to parse an option and
- * to return a text string describing an option. THESE ARE
- * DEPRECATED; PLEASE USE THE NEW STRUCTURES LISTED ABOVE.
+ * Structure used to describe application-specific configuration options:
+ * indicates procedures to call to parse an option and to return a text string
+ * describing an option. THESE ARE DEPRECATED; PLEASE USE THE NEW STRUCTURES
+ * LISTED ABOVE.
*/
/*
- * This is a temporary flag used while tkObjConfig and new widgets
- * are in development.
+ * This is a temporary flag used while tkObjConfig and new widgets are in
+ * development.
*/
#ifndef __NO_OLD_CONFIG
@@ -327,58 +316,58 @@ typedef char *(Tk_OptionPrintProc) _ANSI_ARGS_((ClientData clientData,
Tcl_FreeProc **freeProcPtr));
typedef struct Tk_CustomOption {
- Tk_OptionParseProc *parseProc; /* Procedure to call to parse an
- * option and store it in converted
- * form. */
- Tk_OptionPrintProc *printProc; /* Procedure to return a printable
- * string describing an existing
- * option. */
- ClientData clientData; /* Arbitrary one-word value used by
- * option parser: passed to
- * parseProc and printProc. */
+ Tk_OptionParseProc *parseProc;
+ /* Procedure to call to parse an option and
+ * store it in converted form. */
+ Tk_OptionPrintProc *printProc;
+ /* Procedure to return a printable string
+ * describing an existing option. */
+ ClientData clientData; /* Arbitrary one-word value used by option
+ * parser: passed to parseProc and
+ * printProc. */
} Tk_CustomOption;
/*
- * Structure used to specify information for Tk_ConfigureWidget. Each
- * structure gives complete information for one option, including
- * how the option is specified on the command line, where it appears
- * in the option database, etc.
+ * Structure used to specify information for Tk_ConfigureWidget. Each
+ * structure gives complete information for one option, including how the
+ * option is specified on the command line, where it appears in the option
+ * database, etc.
*/
typedef struct Tk_ConfigSpec {
int type; /* Type of option, such as TK_CONFIG_COLOR;
- * see definitions below. Last option in
- * table must have type TK_CONFIG_END. */
- char *argvName; /* Switch used to specify option in argv.
- * NULL means this spec is part of a group. */
+ * see definitions below. Last option in table
+ * must have type TK_CONFIG_END. */
+ char *argvName; /* Switch used to specify option in argv. NULL
+ * means this spec is part of a group. */
Tk_Uid dbName; /* Name for option in option database. */
Tk_Uid dbClass; /* Class for option in database. */
- Tk_Uid defValue; /* Default value for option if not
- * specified in command line or database. */
- int offset; /* Where in widget record to store value;
- * use Tk_Offset macro to generate values
- * for this. */
+ Tk_Uid defValue; /* Default value for option if not specified
+ * in command line or database. */
+ int offset; /* Where in widget record to store value; use
+ * Tk_Offset macro to generate values for
+ * this. */
int specFlags; /* Any combination of the values defined
- * below; other bits are used internally
- * by tkConfig.c. */
- Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is
- * a pointer to info about how to parse and
- * print the option. Otherwise it is
+ * below; other bits are used internally by
+ * tkConfig.c. */
+ Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a
+ * pointer to info about how to parse and
+ * print the option. Otherwise it is
* irrelevant. */
} Tk_ConfigSpec;
/*
- * Type values for Tk_ConfigSpec structures. See the user
- * documentation for details.
+ * Type values for Tk_ConfigSpec structures. See the user documentation for
+ * details.
*/
typedef enum {
TK_CONFIG_BOOLEAN, TK_CONFIG_INT, TK_CONFIG_DOUBLE, TK_CONFIG_STRING,
TK_CONFIG_UID, TK_CONFIG_COLOR, TK_CONFIG_FONT, TK_CONFIG_BITMAP,
- TK_CONFIG_BORDER, TK_CONFIG_RELIEF, TK_CONFIG_CURSOR,
- TK_CONFIG_ACTIVE_CURSOR, TK_CONFIG_JUSTIFY, TK_CONFIG_ANCHOR,
+ TK_CONFIG_BORDER, TK_CONFIG_RELIEF, TK_CONFIG_CURSOR,
+ TK_CONFIG_ACTIVE_CURSOR, TK_CONFIG_JUSTIFY, TK_CONFIG_ANCHOR,
TK_CONFIG_SYNONYM, TK_CONFIG_CAP_STYLE, TK_CONFIG_JOIN_STYLE,
- TK_CONFIG_PIXELS, TK_CONFIG_MM, TK_CONFIG_WINDOW, TK_CONFIG_CUSTOM,
+ TK_CONFIG_PIXELS, TK_CONFIG_MM, TK_CONFIG_WINDOW, TK_CONFIG_CUSTOM,
TK_CONFIG_END
} Tk_ConfigTypes;
@@ -390,10 +379,10 @@ typedef enum {
#define TK_CONFIG_OBJS 0x80
/*
- * Possible flag values for Tk_ConfigSpec structures. Any bits at
- * or above TK_CONFIG_USER_BIT may be used by clients for selecting
- * certain entries. Before changing any values here, coordinate with
- * tkOldConfig.c (internal-use-only flags are defined there).
+ * Possible flag values for Tk_ConfigSpec structures. Any bits at or above
+ * TK_CONFIG_USER_BIT may be used by clients for selecting certain entries.
+ * Before changing any values here, coordinate with tkOldConfig.c
+ * (internal-use-only flags are defined there).
*/
#define TK_CONFIG_NULL_OK (1 << 0)
@@ -409,14 +398,15 @@ typedef enum {
*/
typedef struct {
- char *key; /* The key string that flags the option in the
- * argv array. */
- int type; /* Indicates option type; see below. */
- char *src; /* Value to be used in setting dst; usage
- * depends on type. */
- char *dst; /* Address of value to be modified; usage
- * depends on type. */
- char *help; /* Documentation message describing this option. */
+ char *key; /* The key string that flags the option in the
+ * argv array. */
+ int type; /* Indicates option type; see below. */
+ char *src; /* Value to be used in setting dst; usage
+ * depends on type. */
+ char *dst; /* Address of value to be modified; usage
+ * depends on type. */
+ char *help; /* Documentation message describing this
+ * option. */
} Tk_ArgvInfo;
/*
@@ -448,8 +438,8 @@ typedef struct {
#define TK_ARGV_DONT_SKIP_FIRST_ARG 0x8
/*
- * Enumerated type for describing actions to be taken in response
- * to a restrictProc established by Tk_RestrictEvents.
+ * Enumerated type for describing actions to be taken in response to a
+ * restrictProc established by Tk_RestrictEvents.
*/
typedef enum {
@@ -487,10 +477,10 @@ typedef enum {
#define TK_3D_DARK_GC 3
/*
- * Special EnterNotify/LeaveNotify "mode" for use in events
- * generated by tkShare.c. Pick a high enough value that it's
- * unlikely to conflict with existing values (like NotifyNormal)
- * or any new values defined in the future.
+ * Special EnterNotify/LeaveNotify "mode" for use in events generated by
+ * tkShare.c. Pick a high enough value that it's unlikely to conflict with
+ * existing values (like NotifyNormal) or any new values defined in the
+ * future.
*/
#define TK_NOTIFY_SHARE 20
@@ -515,7 +505,7 @@ typedef enum {
/*
* The following structure is used by Tk_GetFontMetrics() to return
- * information about the properties of a Tk_Font.
+ * information about the properties of a Tk_Font.
*/
typedef struct Tk_FontMetrics {
@@ -527,9 +517,9 @@ typedef struct Tk_FontMetrics {
* letter sticks below the baseline, plus any
* extra blank space added by the designer of
* the font. */
- int linespace; /* The sum of the ascent and descent. How
- * far apart two lines of text in the same
- * font should be placed so that none of the
+ int linespace; /* The sum of the ascent and descent. How far
+ * apart two lines of text in the same font
+ * should be placed so that none of the
* characters in one line overlap any of the
* characters in the other line. */
} Tk_FontMetrics;
@@ -563,13 +553,12 @@ typedef void (Tk_ClassModalProc) _ANSI_ARGS_((Tk_Window tkwin,
typedef struct Tk_ClassProcs {
unsigned int size;
Tk_ClassWorldChangedProc *worldChangedProc;
- /* Procedure to invoke when the widget needs to
- * respond in some way to a change in the
+ /* Procedure to invoke when the widget needs
+ * to respond in some way to a change in the
* world (font changes, etc.) */
Tk_ClassCreateProc *createProc;
- /* Procedure to invoke when the
- * platform-dependent window needs to be
- * created. */
+ /* Procedure to invoke when the platform-
+ * dependent window needs to be created. */
Tk_ClassModalProc *modalProc;
/* Procedure to invoke after all bindings on a
* widget have been triggered in order to
@@ -577,8 +566,8 @@ typedef struct Tk_ClassProcs {
} Tk_ClassProcs;
/*
- * Simple accessor for Tk_ClassProcs structure. Checks that the structure
- * is not NULL, then checks the size field and returns either the requested
+ * Simple accessor for Tk_ClassProcs structure. Checks that the structure is
+ * not NULL, then checks the size field and returns either the requested
* field, if present, or NULL if the structure is too small to have the field
* (or NULL if the structure is NULL).
*
@@ -595,9 +584,9 @@ typedef struct Tk_ClassProcs {
(((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which))
/*
- * Each geometry manager (the packer, the placer, etc.) is represented
- * by a structure of the following form, which indicates procedures
- * to invoke in the geometry manager to carry out certain functions.
+ * Each geometry manager (the packer, the placer, etc.) is represented by a
+ * structure of the following form, which indicates procedures to invoke in
+ * the geometry manager to carry out certain functions.
*/
typedef void (Tk_GeomRequestProc) _ANSI_ARGS_((ClientData clientData,
@@ -606,17 +595,17 @@ typedef void (Tk_GeomLostSlaveProc) _ANSI_ARGS_((ClientData clientData,
Tk_Window tkwin));
typedef struct Tk_GeomMgr {
- char *name; /* Name of the geometry manager (command
- * used to invoke it, or name of widget
- * class that allows embedded widgets). */
+ const char *name; /* Name of the geometry manager (command used
+ * to invoke it, or name of widget class that
+ * allows embedded widgets). */
Tk_GeomRequestProc *requestProc;
/* Procedure to invoke when a slave's
* requested geometry changes. */
Tk_GeomLostSlaveProc *lostSlaveProc;
- /* Procedure to invoke when a slave is
- * taken away from one geometry manager
- * by another. NULL means geometry manager
- * doesn't care when slaves are lost. */
+ /* Procedure to invoke when a slave is taken
+ * away from one geometry manager by another.
+ * NULL means geometry manager doesn't care
+ * when slaves are lost. */
} Tk_GeomMgr;
/*
@@ -648,40 +637,45 @@ typedef struct Tk_GeomMgr {
/*
* A virtual event shares most of its fields with the XKeyEvent and
- * XButtonEvent structures. 99% of the time a virtual event will be
- * an abstraction of a key or button event, so this structure provides
- * the most information to the user. The only difference is the changing
- * of the detail field for a virtual event so that it holds the name of the
- * virtual event being triggered.
+ * XButtonEvent structures. 99% of the time a virtual event will be an
+ * abstraction of a key or button event, so this structure provides the most
+ * information to the user. The only difference is the changing of the detail
+ * field for a virtual event so that it holds the name of the virtual event
+ * being triggered.
*
- * When using this structure, if you want your code to work correctly
- * in Tk 8.5 as well, you should ensure that you zero out all the
+ * When using this structure, you should ensure that you zero out all the
* fields first using memset() or bzero().
*/
typedef struct {
int type;
- unsigned long serial; /* # of last request processed by server */
- Bool send_event; /* True if this came from a SendEvent request */
- Display *display; /* Display the event was read from */
- Window event; /* Window on which event was requested. */
- Window root; /* root window that the event occured on */
- Window subwindow; /* child window */
- Time time; /* milliseconds */
- int x, y; /* pointer x, y coordinates in event window */
- int x_root, y_root; /* coordinates relative to root */
- unsigned int state; /* key or button mask */
- Tk_Uid name; /* Name of virtual event. */
- Bool same_screen; /* same screen flag */
- Tcl_Obj *user_data; /* not used in Tk 8.4 */
+ unsigned long serial; /* # of last request processed by server. */
+ Bool send_event; /* True if this came from a SendEvent
+ * request. */
+ Display *display; /* Display the event was read from. */
+ Window event; /* Window on which event was requested. */
+ Window root; /* Root window that the event occured on. */
+ Window subwindow; /* Child window. */
+ Time time; /* Milliseconds. */
+ int x, y; /* Pointer x, y coordinates in event
+ * window. */
+ int x_root, y_root; /* Coordinates relative to root. */
+ unsigned int state; /* Key or button mask */
+ Tk_Uid name; /* Name of virtual event. */
+ Bool same_screen; /* Same screen flag. */
+ Tcl_Obj *user_data; /* Application-specific data reference; Tk
+ * will decrement the reference count *once*
+ * when it has finished processing the
+ * event. */
} XVirtualEvent;
typedef struct {
int type;
- unsigned long serial; /* # of last request processed by server */
- Bool send_event; /* True if this came from a SendEvent request */
- Display *display; /* Display the event was read from */
- Window window; /* Window in which event occurred. */
+ unsigned long serial; /* # of last request processed by server. */
+ Bool send_event; /* True if this came from a SendEvent
+ * request. */
+ Display *display; /* Display the event was read from. */
+ Window window; /* Window in which event occurred. */
} XActivateDeactivateEvent;
typedef XActivateDeactivateEvent XActivateEvent;
typedef XActivateDeactivateEvent XDeactivateEvent;
@@ -689,29 +683,29 @@ typedef XActivateDeactivateEvent XDeactivateEvent;
/*
*--------------------------------------------------------------
*
- * Macros for querying Tk_Window structures. See the
- * manual entries for documentation.
+ * Macros for querying Tk_Window structures. See the manual entries for
+ * documentation.
*
*--------------------------------------------------------------
*/
-#define Tk_Display(tkwin) (((Tk_FakeWin *) (tkwin))->display)
-#define Tk_ScreenNumber(tkwin) (((Tk_FakeWin *) (tkwin))->screenNum)
-#define Tk_Screen(tkwin) (ScreenOfDisplay(Tk_Display(tkwin), \
- Tk_ScreenNumber(tkwin)))
-#define Tk_Depth(tkwin) (((Tk_FakeWin *) (tkwin))->depth)
-#define Tk_Visual(tkwin) (((Tk_FakeWin *) (tkwin))->visual)
-#define Tk_WindowId(tkwin) (((Tk_FakeWin *) (tkwin))->window)
-#define Tk_PathName(tkwin) (((Tk_FakeWin *) (tkwin))->pathName)
-#define Tk_Name(tkwin) (((Tk_FakeWin *) (tkwin))->nameUid)
-#define Tk_Class(tkwin) (((Tk_FakeWin *) (tkwin))->classUid)
-#define Tk_X(tkwin) (((Tk_FakeWin *) (tkwin))->changes.x)
-#define Tk_Y(tkwin) (((Tk_FakeWin *) (tkwin))->changes.y)
-#define Tk_Width(tkwin) (((Tk_FakeWin *) (tkwin))->changes.width)
+#define Tk_Display(tkwin) (((Tk_FakeWin *) (tkwin))->display)
+#define Tk_ScreenNumber(tkwin) (((Tk_FakeWin *) (tkwin))->screenNum)
+#define Tk_Screen(tkwin) \
+ (ScreenOfDisplay(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)))
+#define Tk_Depth(tkwin) (((Tk_FakeWin *) (tkwin))->depth)
+#define Tk_Visual(tkwin) (((Tk_FakeWin *) (tkwin))->visual)
+#define Tk_WindowId(tkwin) (((Tk_FakeWin *) (tkwin))->window)
+#define Tk_PathName(tkwin) (((Tk_FakeWin *) (tkwin))->pathName)
+#define Tk_Name(tkwin) (((Tk_FakeWin *) (tkwin))->nameUid)
+#define Tk_Class(tkwin) (((Tk_FakeWin *) (tkwin))->classUid)
+#define Tk_X(tkwin) (((Tk_FakeWin *) (tkwin))->changes.x)
+#define Tk_Y(tkwin) (((Tk_FakeWin *) (tkwin))->changes.y)
+#define Tk_Width(tkwin) (((Tk_FakeWin *) (tkwin))->changes.width)
#define Tk_Height(tkwin) \
(((Tk_FakeWin *) (tkwin))->changes.height)
-#define Tk_Changes(tkwin) (&((Tk_FakeWin *) (tkwin))->changes)
-#define Tk_Attributes(tkwin) (&((Tk_FakeWin *) (tkwin))->atts)
+#define Tk_Changes(tkwin) (&((Tk_FakeWin *) (tkwin))->changes)
+#define Tk_Attributes(tkwin) (&((Tk_FakeWin *) (tkwin))->atts)
#define Tk_IsEmbedded(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_EMBEDDED)
#define Tk_IsContainer(tkwin) \
@@ -726,8 +720,10 @@ typedef XActivateDeactivateEvent XDeactivateEvent;
(((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED)
#define Tk_TopWinHierarchy(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY)
-#define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)
-#define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)
+#define Tk_IsManageable(tkwin) \
+ (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE)
+#define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)
+#define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)
/* Tk_InternalBorderWidth is deprecated */
#define Tk_InternalBorderWidth(tkwin) \
(((Tk_FakeWin *) (tkwin))->internalBorderLeft)
@@ -739,20 +735,19 @@ typedef XActivateDeactivateEvent XDeactivateEvent;
(((Tk_FakeWin *) (tkwin))->internalBorderTop)
#define Tk_InternalBorderBottom(tkwin) \
(((Tk_FakeWin *) (tkwin))->internalBorderBottom)
-#define Tk_MinReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->minReqWidth)
-#define Tk_MinReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->minReqHeight)
-#define Tk_Parent(tkwin) (((Tk_FakeWin *) (tkwin))->parentPtr)
-#define Tk_Colormap(tkwin) (((Tk_FakeWin *) (tkwin))->atts.colormap)
+#define Tk_MinReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->minReqWidth)
+#define Tk_MinReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->minReqHeight)
+#define Tk_Parent(tkwin) (((Tk_FakeWin *) (tkwin))->parentPtr)
+#define Tk_Colormap(tkwin) (((Tk_FakeWin *) (tkwin))->atts.colormap)
/*
- * The structure below is needed by the macros above so that they can
- * access the fields of a Tk_Window. The fields not needed by the macros
- * are declared as "dummyX". The structure has its own type in order to
- * prevent applications from accessing Tk_Window fields except using
- * official macros. WARNING!! The structure definition must be kept
- * consistent with the TkWindow structure in tkInt.h. If you change one,
- * then change the other. See the declaration in tkInt.h for
- * documentation on what the fields are used for internally.
+ * The structure below is needed by the macros above so that they can access
+ * the fields of a Tk_Window. The fields not needed by the macros are declared
+ * as "dummyX". The structure has its own type in order to prevent apps from
+ * accessing Tk_Window fields except using official macros. WARNING!! The
+ * structure definition must be kept consistent with the TkWindow structure in
+ * tkInt.h. If you change one, then change the other. See the declaration in
+ * tkInt.h for documentation on what the fields are used for internally.
*/
typedef struct Tk_FakeWin {
@@ -807,69 +802,65 @@ typedef struct Tk_FakeWin {
* TK_ALREADY_DEAD: 1 means the window is in the process of
* being destroyed already.
* TK_NEED_CONFIG_NOTIFY: 1 means that the window has been reconfigured
- * before it was made to exist. At the time of
+ * before it was made to exist. At the time of
* making it exist a ConfigureNotify event needs
* to be generated.
- * TK_GRAB_FLAG: Used to manage grabs. See tkGrab.c for
- * details.
+ * TK_GRAB_FLAG: Used to manage grabs. See tkGrab.c for details
* TK_CHECKED_IC: 1 means we've already tried to get an input
- * context for this window; if the ic field
- * is NULL it means that there isn't a context
- * for the field.
+ * context for this window; if the ic field is
+ * NULL it means that there isn't a context for
+ * the field.
* TK_DONT_DESTROY_WINDOW: 1 means that Tk_DestroyWindow should not
* invoke XDestroyWindow to destroy this widget's
- * X window. The flag is set when the window
- * has already been destroyed elsewhere (e.g.
- * by another application) or when it will be
- * destroyed later (e.g. by destroying its
- * parent).
+ * X window. The flag is set when the window has
+ * already been destroyed elsewhere (e.g. by
+ * another application) or when it will be
+ * destroyed later (e.g. by destroying its parent)
* TK_WM_COLORMAP_WINDOW: 1 means that this window has at some time
* appeared in the WM_COLORMAP_WINDOWS property
- * for its toplevel, so we have to remove it
- * from that property if the window is
- * deleted and the toplevel isn't.
+ * for its toplevel, so we have to remove it from
+ * that property if the window is deleted and the
+ * toplevel isn't.
* TK_EMBEDDED: 1 means that this window (which must be a
* toplevel) is not a free-standing window but
* rather is embedded in some other application.
* TK_CONTAINER: 1 means that this window is a container, and
- * that some other application (either in
- * this process or elsewhere) may be
- * embedding itself inside the window.
+ * that some other application (either in this
+ * process or elsewhere) may be embedding itself
+ * inside the window.
* TK_BOTH_HALVES: 1 means that this window is used for
- * application embedding (either as
- * container or embedded application), and
- * both the containing and embedded halves
- * are associated with windows in this
- * particular process.
+ * application embedding (either as container or
+ * embedded application), and both the containing
+ * and embedded halves are associated with
+ * windows in this particular process.
* TK_DEFER_MODAL: 1 means that this window has deferred a modal
* loop until all of the bindings for the current
* event have been invoked.
- * TK_WRAPPER: 1 means that this window is the extra
- * wrapper window created around a toplevel
- * to hold the menubar under Unix. See
- * tkUnixWm.c for more information.
+ * TK_WRAPPER: 1 means that this window is the extra wrapper
+ * window created around a toplevel to hold the
+ * menubar under Unix. See tkUnixWm.c for more
+ * information.
* TK_REPARENTED: 1 means that this window has been reparented
* so that as far as the window system is
- * concerned it isn't a child of its Tk
- * parent. Initially this is used only for
- * special Unix menubar windows.
+ * concerned it isn't a child of its Tk parent.
+ * Initially this is used only for special Unix
+ * menubar windows.
* TK_ANONYMOUS_WINDOW: 1 means that this window has no name, and is
* thus not accessible from Tk.
* TK_HAS_WRAPPER 1 means that this window has a wrapper window
- * TK_WIN_MANAGED 1 means that this window is a child of the
- * root window, and is managed by the window
- * manager.
- * TK_TOP_HIERARCHY 1 means this window is at the top of a
- * physical window hierarchy within this
- * process, i.e. the window's parent
- * either doesn't exist or is not owned by
- * this Tk application.
- * TK_PROP_PROPCHANGE 1 means that PropertyNotify events in
- * this window's children should propagate
- * up to this window.
+ * TK_WIN_MANAGED 1 means that this window is a child of the root
+ * window, and is managed by the window manager.
+ * TK_TOP_HIERARCHY 1 means this window is at the top of a physical
+ * window hierarchy within this process, i.e. the
+ * window's parent either doesn't exist or is not
+ * owned by this Tk application.
+ * TK_PROP_PROPCHANGE 1 means that PropertyNotify events in the
+ * window's children should propagate up to this
+ * window.
+ * TK_WM_MANAGEABLE 1 marks a window as capable of being converted
+ * into a toplevel using [wm manage].
*/
-
#define TK_MAPPED 1
#define TK_TOP_LEVEL 2
#define TK_ALREADY_DEAD 4
@@ -889,12 +880,12 @@ typedef struct Tk_FakeWin {
#define TK_WIN_MANAGED 0x10000
#define TK_TOP_HIERARCHY 0x20000
#define TK_PROP_PROPCHANGE 0x40000
+#define TK_WM_MANAGEABLE 0x80000
/*
*--------------------------------------------------------------
*
- * Procedure prototypes and structures used for defining new canvas
- * items:
+ * Procedure prototypes and structures used for defining new canvas items:
*
*--------------------------------------------------------------
*/
@@ -915,54 +906,48 @@ typedef struct Tk_SmoothMethod {
} Tk_SmoothMethod;
/*
- * For each item in a canvas widget there exists one record with
- * the following structure. Each actual item is represented by
- * a record with the following stuff at its beginning, plus additional
- * type-specific stuff after that.
+ * For each item in a canvas widget there exists one record with the following
+ * structure. Each actual item is represented by a record with the following
+ * stuff at its beginning, plus additional type-specific stuff after that.
*/
#define TK_TAG_SPACE 3
-typedef struct Tk_Item {
- int id; /* Unique identifier for this item
- * (also serves as first tag for
- * item). */
- struct Tk_Item *nextPtr; /* Next in display list of all
- * items in this canvas. Later items
- * in list are drawn on top of earlier
- * ones. */
- Tk_Uid staticTagSpace[TK_TAG_SPACE];/* Built-in space for limited # of
- * tags. */
- Tk_Uid *tagPtr; /* Pointer to array of tags. Usually
- * points to staticTagSpace, but
- * may point to malloc-ed space if
- * there are lots of tags. */
- int tagSpace; /* Total amount of tag space available
- * at tagPtr. */
- int numTags; /* Number of tag slots actually used
- * at *tagPtr. */
- struct Tk_ItemType *typePtr; /* Table of procedures that implement
- * this type of item. */
- int x1, y1, x2, y2; /* Bounding box for item, in integer
- * canvas units. Set by item-specific
- * code and guaranteed to contain every
- * pixel drawn in item. Item area
- * includes x1 and y1 but not x2
- * and y2. */
- struct Tk_Item *prevPtr; /* Previous in display list of all
- * items in this canvas. Later items
- * in list are drawn just below earlier
- * ones. */
- Tk_State state; /* state of item */
- char *reserved1; /* reserved for future use */
- int redraw_flags; /* some flags used in the canvas */
+typedef struct Tk_Item {
+ int id; /* Unique identifier for this item (also
+ * serves as first tag for item). */
+ struct Tk_Item *nextPtr; /* Next in display list of all items in this
+ * canvas. Later items in list are drawn on
+ * top of earlier ones. */
+ Tk_Uid staticTagSpace[TK_TAG_SPACE];
+ /* Built-in space for limited # of tags. */
+ Tk_Uid *tagPtr; /* Pointer to array of tags. Usually points to
+ * staticTagSpace, but may point to malloc-ed
+ * space if there are lots of tags. */
+ int tagSpace; /* Total amount of tag space available at
+ * tagPtr. */
+ int numTags; /* Number of tag slots actually used at
+ * *tagPtr. */
+ struct Tk_ItemType *typePtr;/* Table of procedures that implement this
+ * type of item. */
+ int x1, y1, x2, y2; /* Bounding box for item, in integer canvas
+ * units. Set by item-specific code and
+ * guaranteed to contain every pixel drawn in
+ * item. Item area includes x1 and y1 but not
+ * x2 and y2. */
+ struct Tk_Item *prevPtr; /* Previous in display list of all items in
+ * this canvas. Later items in list are drawn
+ * just below earlier ones. */
+ Tk_State state; /* State of item. */
+ char *reserved1; /* reserved for future use */
+ int redraw_flags; /* Some flags used in the canvas */
/*
*------------------------------------------------------------------
- * Starting here is additional type-specific stuff; see the
- * declarations for individual types to see what is part of
- * each type. The actual space below is determined by the
- * "itemInfoSize" of the type's Tk_ItemType record.
+ * Starting here is additional type-specific stuff; see the declarations
+ * for individual types to see what is part of each type. The actual space
+ * below is determined by the "itemInfoSize" of the type's Tk_ItemType
+ * record.
*------------------------------------------------------------------
*/
} Tk_Item;
@@ -970,20 +955,19 @@ typedef struct Tk_Item {
/*
* Flag bits for canvases (redraw_flags):
*
- * TK_ITEM_STATE_DEPENDANT - 1 means that object needs to be
- * redrawn if the canvas state changes.
- * TK_ITEM_DONT_REDRAW - 1 means that the object redraw is already
- * been prepared, so the general canvas code
- * doesn't need to do that any more.
+ * TK_ITEM_STATE_DEPENDANT - 1 means that object needs to be redrawn if the
+ * canvas state changes.
+ * TK_ITEM_DONT_REDRAW - 1 means that the object redraw is already been
+ * prepared, so the general canvas code doesn't
+ * need to do that any more.
*/
#define TK_ITEM_STATE_DEPENDANT 1
#define TK_ITEM_DONT_REDRAW 2
/*
- * Records of the following type are used to describe a type of
- * item (e.g. lines, circles, etc.) that can form part of a
- * canvas widget.
+ * Records of the following type are used to describe a type of item (e.g.
+ * lines, circles, etc.) that can form part of a canvas widget.
*/
#ifdef USE_OLD_CANVAS
@@ -999,13 +983,13 @@ typedef int Tk_ItemCoordProc _ANSI_ARGS_((Tcl_Interp *interp,
#else
typedef int Tk_ItemCreateProc _ANSI_ARGS_((Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST objv[]));
+ Tcl_Obj *const objv[]));
typedef int Tk_ItemConfigureProc _ANSI_ARGS_((Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST objv[], int flags));
+ Tcl_Obj *const objv[], int flags));
typedef int Tk_ItemCoordProc _ANSI_ARGS_((Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST argv[]));
+ Tcl_Obj *const argv[]));
#endif
typedef void Tk_ItemDeleteProc _ANSI_ARGS_((Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display));
@@ -1039,100 +1023,103 @@ typedef void Tk_ItemDCharsProc _ANSI_ARGS_((Tk_Canvas canvas,
#ifndef __NO_OLD_CONFIG
typedef struct Tk_ItemType {
- char *name; /* The name of this type of item, such
- * as "line". */
- int itemSize; /* Total amount of space needed for
- * item's record. */
- Tk_ItemCreateProc *createProc; /* Procedure to create a new item of
- * this type. */
- Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration
- * specs for this type. Used for
- * returning configuration info. */
- Tk_ItemConfigureProc *configProc; /* Procedure to call to change
- * configuration options. */
- Tk_ItemCoordProc *coordProc; /* Procedure to call to get and set
- * the item's coordinates. */
- Tk_ItemDeleteProc *deleteProc; /* Procedure to delete existing item of
- * this type. */
- Tk_ItemDisplayProc *displayProc; /* Procedure to display items of
- * this type. */
- int alwaysRedraw; /* Non-zero means displayProc should
- * be called even when the item has
- * been moved off-screen. */
- Tk_ItemPointProc *pointProc; /* Computes distance from item to
- * a given point. */
- Tk_ItemAreaProc *areaProc; /* Computes whether item is inside,
- * outside, or overlapping an area. */
+ char *name; /* The name of this type of item, such as
+ * "line". */
+ int itemSize; /* Total amount of space needed for item's
+ * record. */
+ Tk_ItemCreateProc *createProc;
+ /* Procedure to create a new item of this
+ * type. */
+ Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for
+ * this type. Used for returning configuration
+ * info. */
+ Tk_ItemConfigureProc *configProc;
+ /* Procedure to call to change configuration
+ * options. */
+ Tk_ItemCoordProc *coordProc;/* Procedure to call to get and set the item's
+ * coordinates. */
+ Tk_ItemDeleteProc *deleteProc;
+ /* Procedure to delete existing item of this
+ * type. */
+ Tk_ItemDisplayProc *displayProc;
+ /* Procedure to display items of this type. */
+ int alwaysRedraw; /* Non-zero means displayProc should be called
+ * even when the item has been moved
+ * off-screen. */
+ Tk_ItemPointProc *pointProc;/* Computes distance from item to a given
+ * point. */
+ Tk_ItemAreaProc *areaProc; /* Computes whether item is inside, outside,
+ * or overlapping an area. */
Tk_ItemPostscriptProc *postscriptProc;
- /* Procedure to write a Postscript
- * description for items of this
- * type. */
- Tk_ItemScaleProc *scaleProc; /* Procedure to rescale items of
- * this type. */
- Tk_ItemTranslateProc *translateProc;/* Procedure to translate items of
- * this type. */
- Tk_ItemIndexProc *indexProc; /* Procedure to determine index of
- * indicated character. NULL if
- * item doesn't support indexing. */
- Tk_ItemCursorProc *icursorProc; /* Procedure to set insert cursor pos.
- * to just before a given position. */
- Tk_ItemSelectionProc *selectionProc;/* Procedure to return selection (in
- * STRING format) when it is in this
- * item. */
- Tk_ItemInsertProc *insertProc; /* Procedure to insert something into
- * an item. */
- Tk_ItemDCharsProc *dCharsProc; /* Procedure to delete characters
- * from an item. */
- struct Tk_ItemType *nextPtr; /* Used to link types together into
- * a list. */
- char *reserved1; /* Reserved for future extension. */
- int reserved2; /* Carefully compatible with */
- char *reserved3; /* Jan Nijtmans dash patch */
+ /* Procedure to write a Postscript description
+ * for items of this type. */
+ Tk_ItemScaleProc *scaleProc;/* Procedure to rescale items of this type. */
+ Tk_ItemTranslateProc *translateProc;
+ /* Procedure to translate items of this
+ * type. */
+ Tk_ItemIndexProc *indexProc;/* Procedure to determine index of indicated
+ * character. NULL if item doesn't support
+ * indexing. */
+ Tk_ItemCursorProc *icursorProc;
+ /* Procedure to set insert cursor posn to just
+ * before a given position. */
+ Tk_ItemSelectionProc *selectionProc;
+ /* Procedure to return selection (in STRING
+ * format) when it is in this item. */
+ Tk_ItemInsertProc *insertProc;
+ /* Procedure to insert something into an
+ * item. */
+ Tk_ItemDCharsProc *dCharsProc;
+ /* Procedure to delete characters from an
+ * item. */
+ struct Tk_ItemType *nextPtr;/* Used to link types together into a list. */
+ char *reserved1; /* Reserved for future extension. */
+ int reserved2; /* Carefully compatible with */
+ char *reserved3; /* Jan Nijtmans dash patch */
char *reserved4;
} Tk_ItemType;
#endif
/*
- * The following structure provides information about the selection and
- * the insertion cursor. It is needed by only a few items, such as
- * those that display text. It is shared by the generic canvas code
- * and the item-specific code, but most of the fields should be written
- * only by the canvas generic code.
+ * The following structure provides information about the selection and the
+ * insertion cursor. It is needed by only a few items, such as those that
+ * display text. It is shared by the generic canvas code and the item-specific
+ * code, but most of the fields should be written only by the canvas generic
+ * code.
*/
typedef struct Tk_CanvasTextInfo {
Tk_3DBorder selBorder; /* Border and background for selected
- * characters. Read-only to items.*/
- int selBorderWidth; /* Width of border around selection.
- * Read-only to items. */
+ * characters. Read-only to items.*/
+ int selBorderWidth; /* Width of border around selection. Read-only
+ * to items. */
XColor *selFgColorPtr; /* Foreground color for selected text.
* Read-only to items. */
- Tk_Item *selItemPtr; /* Pointer to selected item. NULL means
- * selection isn't in this canvas.
- * Writable by items. */
+ Tk_Item *selItemPtr; /* Pointer to selected item. NULL means
+ * selection isn't in this canvas. Writable by
+ * items. */
int selectFirst; /* Character index of first selected
- * character. Writable by items. */
- int selectLast; /* Character index of last selected
- * character. Writable by items. */
- Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor":
- * not necessarily selItemPtr. Read-only
- * to items. */
- int selectAnchor; /* Character index of fixed end of
- * selection (i.e. "select to" operation will
- * use this as one end of the selection).
+ * character. Writable by items. */
+ int selectLast; /* Character index of last selected character.
* Writable by items. */
+ Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": not
+ * necessarily selItemPtr. Read-only to
+ * items. */
+ int selectAnchor; /* Character index of fixed end of selection
+ * (i.e. "select to" operation will use this
+ * as one end of the selection). Writable by
+ * items. */
Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion
- * cursor. Read-only to items. */
- int insertWidth; /* Total width of insertion cursor. Read-only
+ * cursor. Read-only to items. */
+ int insertWidth; /* Total width of insertion cursor. Read-only
* to items. */
int insertBorderWidth; /* Width of 3-D border around insert cursor.
* Read-only to items. */
- Tk_Item *focusItemPtr; /* Item that currently has the input focus,
- * or NULL if no such item. Read-only to
- * items. */
+ Tk_Item *focusItemPtr; /* Item that currently has the input focus, or
+ * NULL if no such item. Read-only to items. */
int gotFocus; /* Non-zero means that the canvas widget has
- * the input focus. Read-only to items.*/
+ * the input focus. Read-only to items.*/
int cursorOn; /* Non-zero means that an insertion cursor
* should be displayed in focusItemPtr.
* Read-only to items.*/
@@ -1151,7 +1138,7 @@ typedef struct Tk_Dash {
} Tk_Dash;
typedef struct Tk_TSOffset {
- int flags; /* flags; see below for possible values */
+ int flags; /* Flags; see below for possible values */
int xoffset; /* x offset */
int yoffset; /* y offset */
} Tk_TSOffset;
@@ -1174,22 +1161,23 @@ typedef struct Tk_Outline {
double width; /* Width of outline. */
double activeWidth; /* Width of outline. */
double disabledWidth; /* Width of outline. */
- int offset; /* Dash offset */
- Tk_Dash dash; /* Dash pattern */
- Tk_Dash activeDash; /* Dash pattern if state is active*/
- Tk_Dash disabledDash; /* Dash pattern if state is disabled*/
- VOID *reserved1; /* reserved for future expansion */
+ int offset; /* Dash offset. */
+ Tk_Dash dash; /* Dash pattern. */
+ Tk_Dash activeDash; /* Dash pattern if state is active. */
+ Tk_Dash disabledDash; /* Dash pattern if state is disabled. */
+ VOID *reserved1; /* Reserved for future expansion. */
VOID *reserved2;
VOID *reserved3;
- Tk_TSOffset tsoffset; /* stipple offset for outline*/
+ Tk_TSOffset tsoffset; /* Stipple offset for outline. */
XColor *color; /* Outline color. */
XColor *activeColor; /* Outline color if state is active. */
XColor *disabledColor; /* Outline color if state is disabled. */
Pixmap stipple; /* Outline Stipple pattern. */
- Pixmap activeStipple; /* Outline Stipple pattern if state is active. */
- Pixmap disabledStipple; /* Outline Stipple pattern if state is disabled. */
+ Pixmap activeStipple; /* Outline Stipple pattern if state is
+ * active. */
+ Pixmap disabledStipple; /* Outline Stipple pattern if state is
+ * disabled. */
} Tk_Outline;
-
/*
*--------------------------------------------------------------
@@ -1206,7 +1194,7 @@ typedef int (Tk_ImageCreateProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tk_ImageMaster master, ClientData *masterDataPtr));
#else
typedef int (Tk_ImageCreateProc) _ANSI_ARGS_((Tcl_Interp *interp,
- char *name, int objc, Tcl_Obj *CONST objv[], Tk_ImageType *typePtr,
+ char *name, int objc, Tcl_Obj *const objv[], Tk_ImageType *typePtr,
Tk_ImageMaster master, ClientData *masterDataPtr));
#endif
typedef ClientData (Tk_ImageGetProc) _ANSI_ARGS_((Tk_Window tkwin,
@@ -1225,39 +1213,37 @@ typedef int (Tk_ImagePostscriptProc) _ANSI_ARGS_((ClientData clientData,
int x, int y, int width, int height, int prepass));
/*
- * The following structure represents a particular type of image
- * (bitmap, xpm image, etc.). It provides information common to
- * all images of that type, such as the type name and a collection
- * of procedures in the image manager that respond to various
- * events. Each image manager is represented by one of these
- * structures.
+ * The following structure represents a particular type of image (bitmap, xpm
+ * image, etc.). It provides information common to all images of that type,
+ * such as the type name and a collection of procedures in the image manager
+ * that respond to various events. Each image manager is represented by one of
+ * these structures.
*/
struct Tk_ImageType {
char *name; /* Name of image type. */
Tk_ImageCreateProc *createProc;
- /* Procedure to call to create a new image
- * of this type. */
+ /* Procedure to call to create a new image of
+ * this type. */
Tk_ImageGetProc *getProc; /* Procedure to call the first time
- * Tk_GetImage is called in a new way
- * (new visual or screen). */
+ * Tk_GetImage is called in a new way (new
+ * visual or screen). */
Tk_ImageDisplayProc *displayProc;
/* Call to draw image, in response to
* Tk_RedrawImage calls. */
- Tk_ImageFreeProc *freeProc; /* Procedure to call whenever Tk_FreeImage
- * is called to release an instance of an
+ Tk_ImageFreeProc *freeProc; /* Procedure to call whenever Tk_FreeImage is
+ * called to release an instance of an
* image. */
Tk_ImageDeleteProc *deleteProc;
- /* Procedure to call to delete image. It
- * will not be called until after freeProc
- * has been called for each instance of the
- * image. */
+ /* Procedure to call to delete image. It will
+ * not be called until after freeProc has been
+ * called for each instance of the image. */
Tk_ImagePostscriptProc *postscriptProc;
/* Procedure to call to produce postscript
* output for the image. */
struct Tk_ImageType *nextPtr;
/* Next in list of all image types currently
- * known. Filled in by Tk, not by image
+ * known. Filled in by Tk, not by image
* manager. */
char *reserved; /* reserved for future expansion */
};
@@ -1271,8 +1257,8 @@ struct Tk_ImageType {
*/
/*
- * The following type is used to identify a particular photo image
- * to be manipulated:
+ * The following type is used to identify a particular photo image to be
+ * manipulated:
*/
typedef void *Tk_PhotoHandle;
@@ -1283,29 +1269,28 @@ typedef void *Tk_PhotoHandle;
typedef struct Tk_PhotoImageBlock {
unsigned char *pixelPtr; /* Pointer to the first pixel. */
- int width; /* Width of block, in pixels. */
- int height; /* Height of block, in pixels. */
- int pitch; /* Address difference between corresponding
+ int width; /* Width of block, in pixels. */
+ int height; /* Height of block, in pixels. */
+ int pitch; /* Address difference between corresponding
* pixels in successive lines. */
- int pixelSize; /* Address difference between successive
+ int pixelSize; /* Address difference between successive
* pixels in the same line. */
- int offset[4]; /* Address differences between the red, green,
+ int offset[4]; /* Address differences between the red, green,
* blue and alpha components of the pixel and
* the pixel as a whole. */
} Tk_PhotoImageBlock;
/*
- * The following values control how blocks are combined into photo
- * images when the alpha component of a pixel is not 255, a.k.a. the
- * compositing rule.
+ * The following values control how blocks are combined into photo images when
+ * the alpha component of a pixel is not 255, a.k.a. the compositing rule.
*/
#define TK_PHOTO_COMPOSITE_OVERLAY 0
#define TK_PHOTO_COMPOSITE_SET 1
/*
- * Procedure prototypes and structures used in reading and
- * writing photo images:
+ * Procedure prototypes and structures used in reading and writing photo
+ * images:
*/
typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat;
@@ -1328,68 +1313,61 @@ typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tk_PhotoImageBlock *blockPtr));
#else
typedef int (Tk_ImageFileMatchProc) _ANSI_ARGS_((Tcl_Channel chan,
- CONST char *fileName, Tcl_Obj *format, int *widthPtr,
+ const char *fileName, Tcl_Obj *format, int *widthPtr,
int *heightPtr, Tcl_Interp *interp));
typedef int (Tk_ImageStringMatchProc) _ANSI_ARGS_((Tcl_Obj *dataObj,
Tcl_Obj *format, int *widthPtr, int *heightPtr,
Tcl_Interp *interp));
typedef int (Tk_ImageFileReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format,
+ Tcl_Channel chan, const char *fileName, Tcl_Obj *format,
Tk_PhotoHandle imageHandle, int destX, int destY,
int width, int height, int srcX, int srcY));
typedef int (Tk_ImageStringReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle,
int destX, int destY, int width, int height, int srcX, int srcY));
typedef int (Tk_ImageFileWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
+ const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
#endif
/*
- * The following structure represents a particular file format for
- * storing images (e.g., PPM, GIF, JPEG, etc.). It provides information
- * to allow image files of that format to be recognized and read into
- * a photo image.
+ * The following structure represents a particular file format for storing
+ * images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image
+ * files of that format to be recognized and read into a photo image.
*/
struct Tk_PhotoImageFormat {
char *name; /* Name of image file format */
Tk_ImageFileMatchProc *fileMatchProc;
- /* Procedure to call to determine whether
- * an image file matches this format. */
+ /* Procedure to call to determine whether an
+ * image file matches this format. */
Tk_ImageStringMatchProc *stringMatchProc;
- /* Procedure to call to determine whether
- * the data in a string matches this format. */
+ /* Procedure to call to determine whether the
+ * data in a string matches this format. */
Tk_ImageFileReadProc *fileReadProc;
- /* Procedure to call to read data from
- * an image file into a photo image. */
+ /* Procedure to call to read data from an
+ * image file into a photo image. */
Tk_ImageStringReadProc *stringReadProc;
- /* Procedure to call to read data from
- * a string into a photo image. */
+ /* Procedure to call to read data from a
+ * string into a photo image. */
Tk_ImageFileWriteProc *fileWriteProc;
- /* Procedure to call to write data from
- * a photo image to a file. */
+ /* Procedure to call to write data from a
+ * photo image to a file. */
Tk_ImageStringWriteProc *stringWriteProc;
/* Procedure to call to obtain a string
* representation of the data in a photo
* image.*/
struct Tk_PhotoImageFormat *nextPtr;
/* Next in list of all photo image formats
- * currently known. Filled in by Tk, not
- * by image format handler. */
+ * currently known. Filled in by Tk, not by
+ * image format handler. */
};
-EXTERN void Tk_CreateOldImageType _ANSI_ARGS_((
- Tk_ImageType *typePtr));
-EXTERN void Tk_CreateOldPhotoImageFormat _ANSI_ARGS_((
- Tk_PhotoImageFormat *formatPtr));
-
-#if !defined(USE_TK_STUBS) && defined(USE_OLD_IMAGE)
+#ifdef USE_OLD_IMAGE
#define Tk_CreateImageType Tk_CreateOldImageType
#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat
#endif
-
/*
*--------------------------------------------------------------
@@ -1402,6 +1380,7 @@ EXTERN void Tk_CreateOldPhotoImageFormat _ANSI_ARGS_((
/*
* Style support version tag.
*/
+
#define TK_STYLE_VERSION_1 0x1
#define TK_STYLE_VERSION TK_STYLE_VERSION_1
@@ -1411,16 +1390,16 @@ EXTERN void Tk_CreateOldPhotoImageFormat _ANSI_ARGS_((
*/
typedef void (Tk_GetElementSizeProc) _ANSI_ARGS_((ClientData clientData,
- char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
+ char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
int width, int height, int inner, int *widthPtr, int *heightPtr));
typedef void (Tk_GetElementBoxProc) _ANSI_ARGS_((ClientData clientData,
- char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
+ char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
int x, int y, int width, int height, int inner, int *xPtr, int *yPtr,
int *widthPtr, int *heightPtr));
typedef int (Tk_GetElementBorderWidthProc) _ANSI_ARGS_((ClientData clientData,
- char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin));
+ char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin));
typedef void (Tk_DrawElementProc) _ANSI_ARGS_((ClientData clientData,
- char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
+ char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
Drawable d, int x, int y, int width, int height, int state));
typedef struct Tk_ElementOptionSpec {
@@ -1435,22 +1414,18 @@ typedef struct Tk_ElementSpec {
Tk_ElementOptionSpec *options;
/* List of required options. Last one's name
* must be NULL. */
-
- /*
- * Hooks
- */
-
Tk_GetElementSizeProc *getSize;
- /* Compute the external (resp. internal) size of
- * the element from its desired internal (resp.
- * external) size. */
+ /* Compute the external (resp. internal) size
+ * of the element from its desired internal
+ * (resp. external) size. */
Tk_GetElementBoxProc *getBox;
/* Compute the inscribed or bounding boxes
* within a given area. */
Tk_GetElementBorderWidthProc *getBorderWidth;
/* Return the element's internal border width.
* Mostly useful for widgets. */
- Tk_DrawElementProc *draw; /* Draw the element in the given bounding box.*/
+ Tk_DrawElementProc *draw; /* Draw the element in the given bounding
+ * box. */
} Tk_ElementSpec;
/*
@@ -1465,9 +1440,9 @@ typedef struct Tk_ElementSpec {
/*
*--------------------------------------------------------------
*
- * The definitions below provide backward compatibility for
- * functions and types related to event handling that used to
- * be in Tk but have moved to Tcl.
+ * The definitions below provide backward compatibility for functions and
+ * types related to event handling that used to be in Tk but have moved to
+ * Tcl.
*
*--------------------------------------------------------------
*/
@@ -1510,23 +1485,20 @@ typedef struct Tk_ElementSpec {
#define Tk_Main(argc, argv, proc) \
Tk_MainEx(argc, argv, proc, Tcl_CreateInterp())
-CONST char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
+const char * Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,
+ const char *version, int exact));
+EXTERN const char * Tk_PkgInitStubsCheck _ANSI_ARGS_((Tcl_Interp *interp,
+ const char *version, int exact));
#ifndef USE_TK_STUBS
#define Tk_InitStubs(interp, version, exact) \
- Tcl_PkgRequire(interp, "Tk", version, exact)
+ Tk_PkgInitStubsCheck(interp, version, exact)
#endif
-void Tk_InitImageArgs _ANSI_ARGS_((Tcl_Interp *interp, int argc, char ***argv));
-
-#if !defined(USE_TK_STUBS) || !defined(USE_OLD_IMAGE)
-
#define Tk_InitImageArgs(interp, argc, argv) /**/
-#endif
-
/*
*--------------------------------------------------------------
@@ -1552,7 +1524,6 @@ typedef Tk_RestrictAction (Tk_RestrictProc) _ANSI_ARGS_((
typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
int offset, char *buffer, int maxBytes));
-
/*
*--------------------------------------------------------------
*
@@ -1564,12 +1535,11 @@ typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
#include "tkDecls.h"
/*
- * Allow users to say that they don't want to alter their source to
- * add the extra argument to Tk_PhotoPutBlock(); DO NOT DEFINE THIS
- * WHEN BUILDING TK.
+ * Allow users to say that they don't want to alter their source to add extra
+ * arguments to Tk_PhotoPutBlock() et al; DO NOT DEFINE THIS WHEN BUILDING TK.
*
- * This goes after the inclusion of the stubbed-decls so that the
- * declarations of what is actually there can be correct.
+ * This goes after the inclusion of the stubbed-decls so that the declarations
+ * of what is actually there can be correct.
*/
#ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK
@@ -1581,13 +1551,34 @@ typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
# undef Tk_PhotoPutZoomedBlock
# endif
# define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_NoComposite
+# define USE_PANIC_ON_PHOTO_ALLOC_FAILURE
+#else /* !USE_COMPOSITELESS_PHOTO_PUT_BLOCK */
+# ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE
+# ifdef Tk_PhotoPutBlock
+# undef Tk_PhotoPutBlock
+# endif
+# define Tk_PhotoPutBlock Tk_PhotoPutBlock_Panic
+# ifdef Tk_PhotoPutZoomedBlock
+# undef Tk_PhotoPutZoomedBlock
+# endif
+# define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_Panic
+# endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
#endif /* USE_COMPOSITELESS_PHOTO_PUT_BLOCK */
+#ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE
+# ifdef Tk_PhotoExpand
+# undef Tk_PhotoExpand
+# endif
+# define Tk_PhotoExpand Tk_PhotoExpand_Panic
+# ifdef Tk_PhotoSetSize
+# undef Tk_PhotoSetSize
+# endif
+# define Tk_PhotoSetSize Tk_PhotoSetSize_Panic
+#endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
/*
* Tcl commands exported by Tk:
*/
-
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
@@ -1596,9 +1587,17 @@ typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
/*
* end block for C++
*/
-
+
#ifdef __cplusplus
}
#endif
-
+
#endif /* _TK */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 4d9d163..caa40dd 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -1,40 +1,41 @@
-/*
+/*
* tk3d.c --
*
- * This module provides procedures to draw borders in
- * the three-dimensional Motif style.
+ * This module provides procedures to draw borders in the
+ * three-dimensional Motif style.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tk3d.h"
/*
- * The following table defines the string values for reliefs, which are
- * used by Tk_GetReliefFromObj.
+ * The following table defines the string values for reliefs, which are used
+ * by Tk_GetReliefFromObj.
*/
-static CONST char *reliefStrings[] = {"flat", "groove", "raised",
- "ridge", "solid", "sunken",
- (char *) NULL};
+static CONST char *reliefStrings[] = {
+ "flat", "groove", "raised", "ridge", "solid", "sunken", NULL
+};
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void BorderInit _ANSI_ARGS_((TkDisplay *dispPtr));
-static void DupBorderObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr,
- Tcl_Obj *dupObjPtr));
-static void FreeBorderObjProc _ANSI_ARGS_((Tcl_Obj *objPtr));
-static int Intersect _ANSI_ARGS_((XPoint *a1Ptr, XPoint *a2Ptr,
- XPoint *b1Ptr, XPoint *b2Ptr, XPoint *iPtr));
-static void InitBorderObj _ANSI_ARGS_((Tcl_Obj *objPtr));
-static void ShiftLine _ANSI_ARGS_((XPoint *p1Ptr, XPoint *p2Ptr,
- int distance, XPoint *p3Ptr));
+static void BorderInit(TkDisplay *dispPtr);
+static void DupBorderObjProc(Tcl_Obj *srcObjPtr,
+ Tcl_Obj *dupObjPtr);
+static void FreeBorderObjProc(Tcl_Obj *objPtr);
+static int Intersect(XPoint *a1Ptr, XPoint *a2Ptr,
+ XPoint *b1Ptr, XPoint *b2Ptr, XPoint *iPtr);
+static void InitBorderObj(Tcl_Obj *objPtr);
+static void ShiftLine(XPoint *p1Ptr, XPoint *p2Ptr,
+ int distance, XPoint *p3Ptr);
/*
* The following structure defines the implementation of the "border" Tcl
@@ -57,30 +58,30 @@ Tcl_ObjType tkBorderObjType = {
*
* Tk_Alloc3DBorderFromObj --
*
- * Given a Tcl_Obj *, map the value to a corresponding
- * Tk_3DBorder structure based on the tkwin given.
+ * Given a Tcl_Obj *, map the value to a corresponding Tk_3DBorder
+ * structure based on the tkwin given.
*
* Results:
- * The return value is a token for a data structure describing a
- * 3-D border. This token may be passed to procedures such as
- * Tk_Draw3DRectangle and Tk_Free3DBorder. If an error prevented
- * the border from being created then NULL is returned and an error
- * message will be left in the interp's result.
+ * The return value is a token for a data structure describing a 3-D
+ * border. This token may be passed to functions such as
+ * Tk_Draw3DRectangle and Tk_Free3DBorder. If an error prevented the
+ * border from being created then NULL is returned and an error message
+ * will be left in the interp's result.
*
* Side effects:
- * The border is added to an internal database with a reference
- * count. For each call to this procedure, there should eventually
- * be a call to FreeBorderObjProc so that the database is
- * cleaned up when borders aren't in use anymore.
+ * The border is added to an internal database with a reference count.
+ * For each call to this function, there should eventually be a call to
+ * FreeBorderObjProc so that the database is cleaned up when borders
+ * aren't in use anymore.
*
*----------------------------------------------------------------------
*/
Tk_3DBorder
-Tk_Alloc3DBorderFromObj(interp, tkwin, objPtr)
- Tcl_Interp *interp; /* Interp for error results. */
- Tk_Window tkwin; /* Need the screen the border is used on.*/
- Tcl_Obj *objPtr; /* Object giving name of color for window
+Tk_Alloc3DBorderFromObj(
+ Tcl_Interp *interp, /* Interp for error results. */
+ Tk_Window tkwin, /* Need the screen the border is used on.*/
+ Tcl_Obj *objPtr) /* Object giving name of color for window
* background. */
{
TkBorder *borderPtr;
@@ -91,15 +92,15 @@ Tk_Alloc3DBorderFromObj(interp, tkwin, objPtr)
borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1;
/*
- * If the object currently points to a TkBorder, see if it's the
- * one we want. If so, increment its reference count and return.
+ * If the object currently points to a TkBorder, see if it's the one we
+ * want. If so, increment its reference count and return.
*/
if (borderPtr != NULL) {
if (borderPtr->resourceRefCount == 0) {
/*
- * This is a stale reference: it refers to a border that's
- * no longer in use. Clear the reference.
+ * This is a stale reference: it refers to a border that's no
+ * longer in use. Clear the reference.
*/
FreeBorderObjProc(objPtr);
@@ -112,24 +113,22 @@ Tk_Alloc3DBorderFromObj(interp, tkwin, objPtr)
}
/*
- * The object didn't point to the border that we wanted. Search
- * the list of borders with the same name to see if one of the
- * others is the right one.
+ * The object didn't point to the border that we wanted. Search the list
+ * of borders with the same name to see if one of the others is the right
+ * one.
*/
/*
- * If the cached value is NULL, either the object type was not a
- * color going in, or the object is a color type but had
- * previously been freed.
+ * If the cached value is NULL, either the object type was not a color
+ * going in, or the object is a color type but had previously been freed.
*
- * If the value is not NULL, the internal rep is the value
- * of the color the last time this object was accessed. Check
- * the screen and colormap of the last access, and if they
- * match, we are done.
+ * If the value is not NULL, the internal rep is the value of the color
+ * the last time this object was accessed. Check the screen and colormap
+ * of the last access, and if they match, we are done.
*/
if (borderPtr != NULL) {
- TkBorder *firstBorderPtr =
+ TkBorder *firstBorderPtr =
(TkBorder *) Tcl_GetHashValue(borderPtr->hashPtr);
FreeBorderObjProc(objPtr);
for (borderPtr = firstBorderPtr ; borderPtr != NULL;
@@ -138,19 +137,19 @@ Tk_Alloc3DBorderFromObj(interp, tkwin, objPtr)
&& (Tk_Colormap(tkwin) == borderPtr->colormap)) {
borderPtr->resourceRefCount++;
borderPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
return (Tk_3DBorder) borderPtr;
}
}
}
/*
- * Still no luck. Call Tk_Get3DBorder to allocate a new border.
+ * Still no luck. Call Tk_Get3DBorder to allocate a new border.
*/
borderPtr = (TkBorder *) Tk_Get3DBorder(interp, tkwin,
Tcl_GetString(objPtr));
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
if (borderPtr != NULL) {
borderPtr->objRefCount++;
}
@@ -165,31 +164,31 @@ Tk_Alloc3DBorderFromObj(interp, tkwin, objPtr)
* Create a data structure for displaying a 3-D border.
*
* Results:
- * The return value is a token for a data structure describing a
- * 3-D border. This token may be passed to procedures such as
- * Tk_Draw3DRectangle and Tk_Free3DBorder. If an error prevented
- * the border from being created then NULL is returned and an error
- * message will be left in the interp's result.
+ * The return value is a token for a data structure describing a 3-D
+ * border. This token may be passed to functions such as
+ * Tk_Draw3DRectangle and Tk_Free3DBorder. If an error prevented the
+ * border from being created then NULL is returned and an error message
+ * will be left in the interp's result.
*
* Side effects:
- * Data structures, graphics contexts, etc. are allocated.
- * It is the caller's responsibility to eventually call
- * Tk_Free3DBorder to release the resources.
+ * Data structures, graphics contexts, etc. are allocated. It is the
+ * caller's responsibility to eventually call Tk_Free3DBorder to release
+ * the resources.
*
*--------------------------------------------------------------
*/
Tk_3DBorder
-Tk_Get3DBorder(interp, tkwin, colorName)
- Tcl_Interp *interp; /* Place to store an error message. */
- Tk_Window tkwin; /* Token for window in which border will
- * be drawn. */
- Tk_Uid colorName; /* String giving name of color
- * for window background. */
+Tk_Get3DBorder(
+ Tcl_Interp *interp, /* Place to store an error message. */
+ Tk_Window tkwin, /* Token for window in which border will be
+ * drawn. */
+ Tk_Uid colorName) /* String giving name of color for window
+ * background. */
{
Tcl_HashEntry *hashPtr;
TkBorder *borderPtr, *existingBorderPtr;
- int new;
+ int isNew;
XGCValues gcValues;
XColor *bgColorPtr;
TkDisplay *dispPtr;
@@ -200,8 +199,8 @@ Tk_Get3DBorder(interp, tkwin, colorName)
BorderInit(dispPtr);
}
- hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &new);
- if (!new) {
+ hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew);
+ if (!isNew) {
existingBorderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr);
for (borderPtr = existingBorderPtr; borderPtr != NULL;
borderPtr = borderPtr->nextPtr) {
@@ -216,12 +215,12 @@ Tk_Get3DBorder(interp, tkwin, colorName)
}
/*
- * No satisfactory border exists yet. Initialize a new one.
+ * No satisfactory border exists yet. Initialize a new one.
*/
bgColorPtr = Tk_GetColor(interp, tkwin, colorName);
if (bgColorPtr == NULL) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(hashPtr);
}
return NULL;
@@ -246,9 +245,8 @@ Tk_Get3DBorder(interp, tkwin, colorName)
Tcl_SetHashValue(hashPtr, borderPtr);
/*
- * Create the information for displaying the background color,
- * but delay the allocation of shadows until they are actually
- * needed for drawing.
+ * Create the information for displaying the background color, but delay
+ * the allocation of shadows until they are actually needed for drawing.
*/
gcValues.foreground = borderPtr->bgColorPtr->pixel;
@@ -267,25 +265,24 @@ Tk_Get3DBorder(interp, tkwin, colorName)
* None.
*
* Side effects:
- * A 3-D border will be drawn in the indicated drawable.
- * The outside edges of the border will be determined by x,
- * y, width, and height. The inside edges of the border
- * will be determined by the borderWidth argument.
+ * A 3-D border will be drawn in the indicated drawable. The outside
+ * edges of the border will be determined by x, y, width, and height. The
+ * inside edges of the border will be determined by the borderWidth
+ * argument.
*
*--------------------------------------------------------------
*/
void
-Tk_Draw3DRectangle(tkwin, drawable, border, x, y, width, height,
- borderWidth, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Outside area of region in
- * which border will be drawn. */
- int borderWidth; /* Desired width for border, in
- * pixels. */
- int relief; /* Type of relief: TK_RELIEF_RAISED,
+Tk_Draw3DRectangle(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Outside area of region in which border will
+ * be drawn. */
+ int borderWidth, /* Desired width for border, in pixels. */
+ int relief) /* Type of relief: TK_RELIEF_RAISED,
* TK_RELIEF_SUNKEN, TK_RELIEF_GROOVE, etc. */
{
if (width < 2*borderWidth) {
@@ -309,12 +306,11 @@ Tk_Draw3DRectangle(tkwin, drawable, border, x, y, width, height,
*
* Tk_NameOf3DBorder --
*
- * Given a border, return a textual string identifying the
- * border's color.
+ * Given a border, return a textual string identifying the border's
+ * color.
*
* Results:
- * The return value is the string that was used to create
- * the border.
+ * The return value is the string that was used to create the border.
*
* Side effects:
* None.
@@ -323,8 +319,8 @@ Tk_Draw3DRectangle(tkwin, drawable, border, x, y, width, height,
*/
CONST char *
-Tk_NameOf3DBorder(border)
- Tk_3DBorder border; /* Token for border. */
+Tk_NameOf3DBorder(
+ Tk_3DBorder border) /* Token for border. */
{
TkBorder *borderPtr = (TkBorder *) border;
@@ -336,8 +332,7 @@ Tk_NameOf3DBorder(border)
*
* Tk_3DBorderColor --
*
- * Given a 3D border, return the X color used for the "flat"
- * surfaces.
+ * Given a 3D border, return the X color used for the "flat" surfaces.
*
* Results:
* Returns the color used drawing flat surfaces with the border.
@@ -348,10 +343,10 @@ Tk_NameOf3DBorder(border)
*--------------------------------------------------------------------
*/
XColor *
-Tk_3DBorderColor(border)
- Tk_3DBorder border; /* Border whose color is wanted. */
+Tk_3DBorderColor(
+ Tk_3DBorder border) /* Border whose color is wanted. */
{
- return(((TkBorder *) border)->bgColorPtr);
+ return ((TkBorder *) border)->bgColorPtr;
}
/*
@@ -359,8 +354,8 @@ Tk_3DBorderColor(border)
*
* Tk_3DBorderGC --
*
- * Given a 3D border, returns one of the graphics contexts used to
- * draw the border.
+ * Given a 3D border, returns one of the graphics contexts used to draw
+ * the border.
*
* Results:
* Returns the graphics context given by the "which" argument.
@@ -371,10 +366,10 @@ Tk_3DBorderColor(border)
*--------------------------------------------------------------------
*/
GC
-Tk_3DBorderGC(tkwin, border, which)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Tk_3DBorder border; /* Border whose GC is wanted. */
- int which; /* Selects one of the border's 3 GC's:
+Tk_3DBorderGC(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Tk_3DBorder border, /* Border whose GC is wanted. */
+ int which) /* Selects one of the border's 3 GC's:
* TK_3D_FLAT_GC, TK_3D_LIGHT_GC, or
* TK_3D_DARK_GC. */
{
@@ -390,11 +385,11 @@ Tk_3DBorderGC(tkwin, border, which)
} else if (which == TK_3D_DARK_GC){
return borderPtr->darkGC;
}
- panic("bogus \"which\" value in Tk_3DBorderGC");
+ Tcl_Panic("bogus \"which\" value in Tk_3DBorderGC");
/*
- * The code below will never be executed, but it's needed to
- * keep compilers happy.
+ * The code below will never be executed, but it's needed to keep
+ * compilers happy.
*/
return (GC) None;
@@ -405,10 +400,9 @@ Tk_3DBorderGC(tkwin, border, which)
*
* Tk_Free3DBorder --
*
- * This procedure is called when a 3D border is no longer
- * needed. It frees the resources associated with the
- * border. After this call, the caller should never again
- * use the "border" token.
+ * This function is called when a 3D border is no longer needed. It frees
+ * the resources associated with the border. After this call, the caller
+ * should never again use the "border" token.
*
* Results:
* None.
@@ -420,8 +414,8 @@ Tk_3DBorderGC(tkwin, border, which)
*/
void
-Tk_Free3DBorder(border)
- Tk_3DBorder border; /* Token for border to be released. */
+Tk_Free3DBorder(
+ Tk_3DBorder border) /* Token for border to be released. */
{
TkBorder *borderPtr = (TkBorder *) border;
Display *display = DisplayOfScreen(borderPtr->screen);
@@ -477,27 +471,27 @@ Tk_Free3DBorder(border)
*
* Tk_Free3DBorderFromObj --
*
- * This procedure is called to release a border allocated by
- * Tk_Alloc3DBorderFromObj. It does not throw away the Tcl_Obj *;
- * it only gets rid of the hash table entry for this border
- * and clears the cached value that is normally stored in the object.
+ * This function is called to release a border allocated by
+ * Tk_Alloc3DBorderFromObj. It does not throw away the Tcl_Obj *; it only
+ * gets rid of the hash table entry for this border and clears the cached
+ * value that is normally stored in the object.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with the border represented by
- * objPtr is decremented, and the border's resources are released
- * to X if there are no remaining uses for it.
+ * The reference count associated with the border represented by objPtr
+ * is decremented, and the border's resources are released to X if there
+ * are no remaining uses for it.
*
*----------------------------------------------------------------------
*/
void
-Tk_Free3DBorderFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* The window this border lives in. Needed
- * for the screen and colormap values. */
- Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */
+Tk_Free3DBorderFromObj(
+ Tk_Window tkwin, /* The window this border lives in. Needed for
+ * the screen and colormap values. */
+ Tcl_Obj *objPtr) /* The Tcl_Obj * to be freed. */
{
Tk_Free3DBorder(Tk_Get3DBorderFromObj(tkwin, objPtr));
FreeBorderObjProc(objPtr);
@@ -506,66 +500,65 @@ Tk_Free3DBorderFromObj(tkwin, objPtr)
/*
*---------------------------------------------------------------------------
*
- * FreeBorderObjProc --
+ * FreeBorderObjProc --
*
- * This proc is called to release an object reference to a border.
- * Called when the object's internal rep is released or when
- * the cached borderPtr needs to be changed.
+ * This proc is called to release an object reference to a border. Called
+ * when the object's internal rep is released or when the cached
+ * borderPtr needs to be changed.
*
* Results:
* None.
*
* Side effects:
- * The object reference count is decremented. When both it
- * and the hash ref count go to zero, the border's resources
- * are released.
+ * The object reference count is decremented. When both it and the hash
+ * ref count go to zero, the border's resources are released.
*
*---------------------------------------------------------------------------
*/
static void
-FreeBorderObjProc(objPtr)
- Tcl_Obj *objPtr; /* The object we are releasing. */
+FreeBorderObjProc(
+ Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkBorder *borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1;
if (borderPtr != NULL) {
borderPtr->objRefCount--;
- if ((borderPtr->objRefCount == 0)
+ if ((borderPtr->objRefCount == 0)
&& (borderPtr->resourceRefCount == 0)) {
ckfree((char *) borderPtr);
}
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
}
/*
*---------------------------------------------------------------------------
*
- * DupBorderObjProc --
+ * DupBorderObjProc --
*
- * When a cached border object is duplicated, this is called to
- * update the internal reps.
+ * When a cached border object is duplicated, this is called to update
+ * the internal reps.
*
* Results:
* None.
*
* Side effects:
- * The border's objRefCount is incremented and the internal rep
- * of the copy is set to point to it.
+ * The border's objRefCount is incremented and the internal rep of the
+ * copy is set to point to it.
*
*---------------------------------------------------------------------------
*/
static void
-DupBorderObjProc(srcObjPtr, dupObjPtr)
- Tcl_Obj *srcObjPtr; /* The object we are copying from. */
- Tcl_Obj *dupObjPtr; /* The object we are copying to. */
+DupBorderObjProc(
+ Tcl_Obj *srcObjPtr, /* The object we are copying from. */
+ Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkBorder *borderPtr = (TkBorder *) srcObjPtr->internalRep.twoPtrValue.ptr1;
-
+
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
if (borderPtr != NULL) {
borderPtr->objRefCount++;
@@ -577,8 +570,8 @@ DupBorderObjProc(srcObjPtr, dupObjPtr)
*
* Tk_SetBackgroundFromBorder --
*
- * Change the background of a window to one appropriate for a given
- * 3-D border.
+ * Change the background of a window to one appropriate for a given 3-D
+ * border.
*
* Results:
* None.
@@ -590,9 +583,9 @@ DupBorderObjProc(srcObjPtr, dupObjPtr)
*/
void
-Tk_SetBackgroundFromBorder(tkwin, border)
- Tk_Window tkwin; /* Window whose background is to be set. */
- Tk_3DBorder border; /* Token for border. */
+Tk_SetBackgroundFromBorder(
+ Tk_Window tkwin, /* Window whose background is to be set. */
+ Tk_3DBorder border) /* Token for border. */
{
register TkBorder *borderPtr = (TkBorder *) border;
@@ -618,13 +611,13 @@ Tk_SetBackgroundFromBorder(tkwin, border)
*/
int
-Tk_GetReliefFromObj(interp, objPtr, resultPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *objPtr; /* The object we are trying to get the
- * value from. */
- int *resultPtr; /* Where to place the answer. */
+Tk_GetReliefFromObj(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *objPtr, /* The object we are trying to get the value
+ * from. */
+ int *resultPtr) /* Where to place the answer. */
{
- return Tcl_GetIndexFromObj(interp, objPtr, reliefStrings, "relief", 0,
+ return Tcl_GetIndexFromObj(interp, objPtr, reliefStrings, "relief", 0,
resultPtr);
}
@@ -633,13 +626,13 @@ Tk_GetReliefFromObj(interp, objPtr, resultPtr)
*
* Tk_GetRelief --
*
- * Parse a relief description and return the corresponding
- * relief value, or an error.
+ * Parse a relief description and return the corresponding relief value,
+ * or an error.
*
* Results:
- * A standard Tcl return value. If all goes well then
- * *reliefPtr is filled in with one of the values
- * TK_RELIEF_RAISED, TK_RELIEF_FLAT, or TK_RELIEF_SUNKEN.
+ * A standard Tcl return value. If all goes well then *reliefPtr is
+ * filled in with one of the values TK_RELIEF_RAISED, TK_RELIEF_FLAT, or
+ * TK_RELIEF_SUNKEN.
*
* Side effects:
* None.
@@ -648,10 +641,10 @@ Tk_GetReliefFromObj(interp, objPtr, resultPtr)
*/
int
-Tk_GetRelief(interp, name, reliefPtr)
- Tcl_Interp *interp; /* For error messages. */
- CONST char *name; /* Name of a relief type. */
- int *reliefPtr; /* Where to store converted relief. */
+Tk_GetRelief(
+ Tcl_Interp *interp, /* For error messages. */
+ CONST char *name, /* Name of a relief type. */
+ int *reliefPtr) /* Where to store converted relief. */
{
char c;
size_t length;
@@ -688,12 +681,10 @@ Tk_GetRelief(interp, name, reliefPtr)
*
* Tk_NameOfRelief --
*
- * Given a relief value, produce a string describing that
- * relief value.
+ * Given a relief value, produce a string describing that relief value.
*
* Results:
- * The return value is a static string that is equivalent
- * to relief.
+ * The return value is a static string that is equivalent to relief.
*
* Side effects:
* None.
@@ -702,9 +693,9 @@ Tk_GetRelief(interp, name, reliefPtr)
*/
CONST char *
-Tk_NameOfRelief(relief)
- int relief; /* One of TK_RELIEF_FLAT, TK_RELIEF_RAISED,
- * or TK_RELIEF_SUNKEN. */
+Tk_NameOfRelief(
+ int relief) /* One of TK_RELIEF_FLAT, TK_RELIEF_RAISED, or
+ * TK_RELIEF_SUNKEN. */
{
if (relief == TK_RELIEF_FLAT) {
return "flat";
@@ -730,39 +721,35 @@ Tk_NameOfRelief(relief)
*
* Tk_Draw3DPolygon --
*
- * Draw a border with 3-D appearance around the edge of a
- * given polygon.
+ * Draw a border with 3-D appearance around the edge of a given polygon.
*
* Results:
* None.
*
* Side effects:
- * Information is drawn in "drawable" in the form of a
- * 3-D border borderWidth units width wide on the left
- * of the trajectory given by pointPtr and numPoints (or
- * -borderWidth units wide on the right side, if borderWidth
- * is negative).
+ * Information is drawn in "drawable" in the form of a 3-D border
+ * borderWidth units width wide on the left of the trajectory given by
+ * pointPtr and numPoints (or -borderWidth units wide on the right side,
+ * if borderWidth is negative).
*
*--------------------------------------------------------------
*/
void
-Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
- borderWidth, leftRelief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- XPoint *pointPtr; /* Array of points describing
- * polygon. All points must be
- * absolute (CoordModeOrigin). */
- int numPoints; /* Number of points at *pointPtr. */
- int borderWidth; /* Width of border, measured in
- * pixels to the left of the polygon's
- * trajectory. May be negative. */
- int leftRelief; /* TK_RELIEF_RAISED or
- * TK_RELIEF_SUNKEN: indicates how
- * stuff to left of trajectory looks
- * relative to stuff on right. */
+Tk_Draw3DPolygon(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ XPoint *pointPtr, /* Array of points describing polygon. All
+ * points must be absolute
+ * (CoordModeOrigin). */
+ int numPoints, /* Number of points at *pointPtr. */
+ int borderWidth, /* Width of border, measured in pixels to the
+ * left of the polygon's trajectory. May be
+ * negative. */
+ int leftRelief) /* TK_RELIEF_RAISED or TK_RELIEF_SUNKEN:
+ * indicates how stuff to left of trajectory
+ * looks relative to stuff on right. */
{
XPoint poly[4], b1, b2, newB1, newB2;
XPoint perp, c, shift1, shift2; /* Used for handling parallel lines. */
@@ -794,8 +781,8 @@ Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
}
/*
- * If the polygon is already closed, drop the last point from it
- * (we'll close it automatically).
+ * If the polygon is already closed, drop the last point from it (we'll
+ * close it automatically).
*/
p1Ptr = &pointPtr[numPoints-1];
@@ -805,8 +792,8 @@ Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
}
/*
- * The loop below is executed once for each vertex in the polgon.
- * At the beginning of each iteration things look like this:
+ * The loop below is executed once for each vertex in the polgon. At the
+ * beginning of each iteration things look like this:
*
* poly[1] /
* * /
@@ -824,23 +811,21 @@ Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
* x-------------------------
*
* The job of this iteration is to do the following:
- * (a) Compute x (the border corner corresponding to
- * pointPtr[i]) and put it in poly[2]. As part of
- * this, compute a new b1 and b2 value for the next
- * side of the polygon.
+ * (a) Compute x (the border corner corresponding to pointPtr[i]) and put
+ * it in poly[2]. As part of this, compute a new b1 and b2 value for
+ * the next side of the polygon.
* (b) Put pointPtr[i] into poly[3].
* (c) Draw the polygon given by poly[0..3].
- * (d) Advance poly[0], poly[1], b1, and b2 for the
- * next side of the polygon.
+ * (d) Advance poly[0], poly[1], b1, and b2 for the next side of the
+ * polygon.
*/
/*
- * The above situation doesn't first come into existence until
- * two points have been processed; the first two points are
- * used to "prime the pump", so some parts of the processing
- * are ommitted for these points. The variable "pointsSeen"
- * keeps track of the priming process; it has to be separate
- * from i in order to be able to ignore duplicate points in the
+ * The above situation doesn't first come into existence until two points
+ * have been processed; the first two points are used to "prime the pump",
+ * so some parts of the processing are ommitted for these points. The
+ * variable "pointsSeen" keeps track of the priming process; it has to be
+ * separate from i in order to be able to ignore duplicate points in the
* polygon.
*/
@@ -852,9 +837,10 @@ Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
}
if ((p2Ptr->x == p1Ptr->x) && (p2Ptr->y == p1Ptr->y)) {
/*
- * Ignore duplicate points (they'd cause core dumps in
- * ShiftLine calls below).
+ * Ignore duplicate points (they'd cause core dumps in ShiftLine
+ * calls below).
*/
+
continue;
}
ShiftLine(p1Ptr, p2Ptr, borderWidth, &newB1);
@@ -866,9 +852,8 @@ Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
parallel = Intersect(&newB1, &newB2, &b1, &b2, &poly[2]);
/*
- * If two consecutive segments of the polygon are parallel,
- * then things get more complex. Consider the following
- * diagram:
+ * If two consecutive segments of the polygon are parallel, then
+ * things get more complex. Consider the following diagram:
*
* poly[1]
* *----b1-----------b2------a
@@ -880,16 +865,16 @@ Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
* --*--------*----c
* newB1 newB2
*
- * Instead of using x and *p1Ptr for poly[2] and poly[3], as
- * in the original diagram, use a and b as above. Then instead
- * of using x and *p1Ptr for the new poly[0] and poly[1], use
- * b and c as above.
+ * Instead of using x and *p1Ptr for poly[2] and poly[3], as in
+ * the original diagram, use a and b as above. Then instead of
+ * using x and *p1Ptr for the new poly[0] and poly[1], use b and c
+ * as above.
*
* Do the computation in three stages:
- * 1. Compute a point "perp" such that the line p1Ptr-perp
- * is perpendicular to p1Ptr-p2Ptr.
- * 2. Compute the points a and c by intersecting the lines
- * b1-b2 and newB1-newB2 with p1Ptr-perp.
+ * 1. Compute a point "perp" such that the line p1Ptr-perp is
+ * perpendicular to p1Ptr-p2Ptr.
+ * 2. Compute the points a and c by intersecting the lines b1-b2
+ * and newB1-newB2 with p1Ptr-perp.
* 3. Compute b by shifting p1Ptr-perp to the right and
* intersecting it with p1Ptr-p2Ptr.
*/
@@ -955,33 +940,34 @@ Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
*/
void
-Tk_Fill3DRectangle(tkwin, drawable, border, x, y, width,
- height, borderWidth, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Outside area of rectangular region. */
- int borderWidth; /* Desired width for border, in
- * pixels. Border will be *inside* region. */
- int relief; /* Indicates 3D effect: TK_RELIEF_FLAT,
+Tk_Fill3DRectangle(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Outside area of rectangular region. */
+ int borderWidth, /* Desired width for border, in pixels. Border
+ * will be *inside* region. */
+ int relief) /* Indicates 3D effect: TK_RELIEF_FLAT,
* TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */
{
register TkBorder *borderPtr = (TkBorder *) border;
int doubleBorder;
/*
- * This code is slightly tricky because it only draws the background
- * in areas not covered by the 3D border. This avoids flashing
- * effects on the screen for the border region.
+ * This code is slightly tricky because it only draws the background in
+ * areas not covered by the 3D border. This avoids flashing effects on the
+ * screen for the border region.
*/
-
+
if (relief == TK_RELIEF_FLAT) {
borderWidth = 0;
} else {
/*
- * We need to make this extra check, otherwise we will leave
- * garbage in thin frames [Bug: 3596]
+ * We need to make this extra check, otherwise we will leave garbage
+ * in thin frames [Bug: 3596]
*/
+
if (width < 2*borderWidth) {
borderWidth = width/2;
}
@@ -1020,22 +1006,21 @@ Tk_Fill3DRectangle(tkwin, drawable, border, x, y, width,
*/
void
-Tk_Fill3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
- borderWidth, leftRelief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- XPoint *pointPtr; /* Array of points describing
- * polygon. All points must be
- * absolute (CoordModeOrigin). */
- int numPoints; /* Number of points at *pointPtr. */
- int borderWidth; /* Width of border, measured in
- * pixels to the left of the polygon's
- * trajectory. May be negative. */
- int leftRelief; /* Indicates 3D effect of left side of
+Tk_Fill3DPolygon(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ XPoint *pointPtr, /* Array of points describing polygon. All
+ * points must be absolute
+ * (CoordModeOrigin). */
+ int numPoints, /* Number of points at *pointPtr. */
+ int borderWidth, /* Width of border, measured in pixels to the
+ * left of the polygon's trajectory. May be
+ * negative. */
+ int leftRelief) /* Indicates 3D effect of left side of
* trajectory relative to right:
- * TK_RELIEF_FLAT, TK_RELIEF_RAISED,
- * or TK_RELIEF_SUNKEN. */
+ * TK_RELIEF_FLAT, TK_RELIEF_RAISED, or
+ * TK_RELIEF_SUNKEN. */
{
register TkBorder *borderPtr = (TkBorder *) border;
@@ -1064,8 +1049,8 @@ Tk_Fill3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
*/
static void
-BorderInit(dispPtr)
- TkDisplay * dispPtr; /* Used to access thread-specific data. */
+BorderInit(
+ TkDisplay *dispPtr) /* Used to access thread-specific data. */
{
dispPtr->borderInit = 1;
Tcl_InitHashTable(&dispPtr->borderTable, TCL_STRING_KEYS);
@@ -1076,9 +1061,8 @@ BorderInit(dispPtr)
*
* ShiftLine --
*
- * Given two points on a line, compute a point on a
- * new line that is parallel to the given line and
- * a given distance away from it.
+ * Given two points on a line, compute a point on a new line that is
+ * parallel to the given line and a given distance away from it.
*
* Results:
* None.
@@ -1090,36 +1074,31 @@ BorderInit(dispPtr)
*/
static void
-ShiftLine(p1Ptr, p2Ptr, distance, p3Ptr)
- XPoint *p1Ptr; /* First point on line. */
- XPoint *p2Ptr; /* Second point on line. */
- int distance; /* New line is to be this many
- * units to the left of original
- * line, when looking from p1 to
- * p2. May be negative. */
- XPoint *p3Ptr; /* Store coords of point on new
- * line here. */
+ShiftLine(
+ XPoint *p1Ptr, /* First point on line. */
+ XPoint *p2Ptr, /* Second point on line. */
+ int distance, /* New line is to be this many units to the
+ * left of original line, when looking from p1
+ * to p2. May be negative. */
+ XPoint *p3Ptr) /* Store coords of point on new line here. */
{
int dx, dy, dxNeg, dyNeg;
/*
- * The table below is used for a quick approximation in
- * computing the new point. An index into the table
- * is 128 times the slope of the original line (the slope
- * must always be between 0 and 1). The value of the table
- * entry is 128 times the amount to displace the new line
- * in y for each unit of perpendicular distance. In other
- * words, the table maps from the tangent of an angle to
- * the inverse of its cosine. If the slope of the original
- * line is greater than 1, then the displacement is done in
- * x rather than in y.
+ * The table below is used for a quick approximation in computing the new
+ * point. An index into the table is 128 times the slope of the original
+ * line (the slope must always be between 0 and 1). The value of the table
+ * entry is 128 times the amount to displace the new line in y for each
+ * unit of perpendicular distance. In other words, the table maps from the
+ * tangent of an angle to the inverse of its cosine. If the slope of the
+ * original line is greater than 1, then the displacement is done in x
+ * rather than in y.
*/
static int shiftTable[129];
/*
- * Initialize the table if this is the first time it is
- * used.
+ * Initialize the table if this is the first time it is used.
*/
if (shiftTable[0] == 0) {
@@ -1171,10 +1150,9 @@ ShiftLine(p1Ptr, p2Ptr, distance, p3Ptr)
* Find the intersection point between two lines.
*
* Results:
- * Under normal conditions 0 is returned and the point
- * at *iPtr is filled in with the intersection between
- * the two lines. If the two lines are parallel, then
- * -1 is returned and *iPtr isn't modified.
+ * Under normal conditions 0 is returned and the point at *iPtr is filled
+ * in with the intersection between the two lines. If the two lines are
+ * parallel, then -1 is returned and *iPtr isn't modified.
*
* Side effects:
* None.
@@ -1183,19 +1161,19 @@ ShiftLine(p1Ptr, p2Ptr, distance, p3Ptr)
*/
static int
-Intersect(a1Ptr, a2Ptr, b1Ptr, b2Ptr, iPtr)
- XPoint *a1Ptr; /* First point of first line. */
- XPoint *a2Ptr; /* Second point of first line. */
- XPoint *b1Ptr; /* First point of second line. */
- XPoint *b2Ptr; /* Second point of second line. */
- XPoint *iPtr; /* Filled in with intersection point. */
+Intersect(
+ XPoint *a1Ptr, /* First point of first line. */
+ XPoint *a2Ptr, /* Second point of first line. */
+ XPoint *b1Ptr, /* First point of second line. */
+ XPoint *b2Ptr, /* Second point of second line. */
+ XPoint *iPtr) /* Filled in with intersection point. */
{
int dxadyb, dxbdya, dxadxb, dyadyb, p, q;
/*
- * The code below is just a straightforward manipulation of two
- * equations of the form y = (x-x1)*(y2-y1)/(x2-x1) + y1 to solve
- * for the x-coordinate of intersection, then the y-coordinate.
+ * The code below is just a straightforward manipulation of two equations
+ * of the form y = (x-x1)*(y2-y1)/(x2-x1) + y1 to solve for the
+ * x-coordinate of intersection, then the y-coordinate.
*/
dxadyb = (a2Ptr->x - a1Ptr->x)*(b2Ptr->y - b1Ptr->y);
@@ -1236,26 +1214,26 @@ Intersect(a1Ptr, a2Ptr, b1Ptr, b2Ptr, iPtr)
*
* Tk_Get3DBorderFromObj --
*
- * Returns the border referred to by a Tcl object. The border must
- * already have been allocated via a call to Tk_Alloc3DBorderFromObj
- * or Tk_Get3DBorder.
+ * Returns the border referred to by a Tcl object. The border must
+ * already have been allocated via a call to Tk_Alloc3DBorderFromObj or
+ * Tk_Get3DBorder.
*
* Results:
- * Returns the Tk_3DBorder that matches the tkwin and the string rep
- * of the name of the border given in objPtr.
+ * Returns the Tk_3DBorder that matches the tkwin and the string rep of
+ * the name of the border given in objPtr.
*
* Side effects:
- * If the object is not already a border, the conversion will free
- * any old internal representation.
+ * If the object is not already a border, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
Tk_3DBorder
-Tk_Get3DBorderFromObj(tkwin, objPtr)
- Tk_Window tkwin;
- Tcl_Obj *objPtr; /* The object whose string value selects
- * a border. */
+Tk_Get3DBorderFromObj(
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr) /* The object whose string value selects a
+ * border. */
{
TkBorder *borderPtr = NULL;
Tcl_HashEntry *hashPtr;
@@ -1266,10 +1244,9 @@ Tk_Get3DBorderFromObj(tkwin, objPtr)
}
/*
- * If we are lucky (and the user doesn't use too many different
- * displays, screens, or colormaps...) then the TkBorder
- * structure we need will be cached in the internal
- * representation of the Tcl_Obj. Check it out...
+ * If we are lucky (and the user doesn't use too many different displays,
+ * screens, or colormaps...) then the TkBorder structure we need will be
+ * cached in the internal representation of the Tcl_Obj. Check it out...
*/
borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1;
@@ -1278,22 +1255,22 @@ Tk_Get3DBorderFromObj(tkwin, objPtr)
&& (Tk_Screen(tkwin) == borderPtr->screen)
&& (Tk_Colormap(tkwin) == borderPtr->colormap)) {
/*
- * The object already points to the right border structure.
- * Just return it.
+ * The object already points to the right border structure. Just
+ * return it.
*/
+
return (Tk_3DBorder) borderPtr;
}
/*
- * If we make it here, it means we aren't so lucky. Either there
- * was no cached TkBorder in the Tcl_Obj, or the TkBorder that was
- * there is for the wrong screen/colormap. Either way, we have
- * to search for the right TkBorder. For each color name, there is
- * linked list of TkBorder structures, one structure for each
- * screen/colormap combination. The head of the linked list is
- * recorded in a hash table (where the key is the color name)
- * attached to the TkDisplay structure. Walk this list to find
- * the right TkBorder structure.
+ * If we make it here, it means we aren't so lucky. Either there was no
+ * cached TkBorder in the Tcl_Obj, or the TkBorder that was there is for
+ * the wrong screen/colormap. Either way, we have to search for the right
+ * TkBorder. For each color name, there is linked list of TkBorder
+ * structures, one structure for each screen/colormap combination. The
+ * head of the linked list is recorded in a hash table (where the key is
+ * the color name) attached to the TkDisplay structure. Walk this list to
+ * find the right TkBorder structure.
*/
hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, Tcl_GetString(objPtr));
@@ -1305,14 +1282,14 @@ Tk_Get3DBorderFromObj(tkwin, objPtr)
if ((Tk_Screen(tkwin) == borderPtr->screen)
&& (Tk_Colormap(tkwin) == borderPtr->colormap)) {
FreeBorderObjProc(objPtr);
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
borderPtr->objRefCount++;
return (Tk_3DBorder) borderPtr;
}
}
- error:
- panic("Tk_Get3DBorderFromObj called with non-existent border!");
+ error:
+ Tcl_Panic("Tk_Get3DBorderFromObj called with non-existent border!");
/*
* The following code isn't reached; it's just there to please compilers.
*/
@@ -1333,20 +1310,20 @@ Tk_Get3DBorderFromObj(tkwin, objPtr)
* unless "interp" is NULL.
*
* Side effects:
- * If no error occurs, a blank internal format for a border value
- * is intialized. The final form cannot be done without a Tk_Window.
+ * If no error occurs, a blank internal format for a border value is
+ * intialized. The final form cannot be done without a Tk_Window.
*
*----------------------------------------------------------------------
*/
static void
-InitBorderObj(objPtr)
- Tcl_Obj *objPtr; /* The object to convert. */
+InitBorderObj(
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ const Tcl_ObjType *typePtr;
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
Tcl_GetString(objPtr);
@@ -1355,7 +1332,7 @@ InitBorderObj(objPtr)
(*typePtr->freeIntRepProc)(objPtr);
}
objPtr->typePtr = &tkBorderObjType;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
/*
@@ -1363,13 +1340,13 @@ InitBorderObj(objPtr)
*
* TkDebugBorder --
*
- * This procedure returns debugging information about a border.
+ * This function returns debugging information about a border.
*
* Results:
* The return value is a list with one sublist for each TkBorder
- * corresponding to "name". Each sublist has two elements that
- * contain the resourceRefCount and objRefCount fields from the
- * TkBorder structure.
+ * corresponding to "name". Each sublist has two elements that contain
+ * the resourceRefCount and objRefCount fields from the TkBorder
+ * structure.
*
* Side effects:
* None.
@@ -1378,10 +1355,10 @@ InitBorderObj(objPtr)
*/
Tcl_Obj *
-TkDebugBorder(tkwin, name)
- Tk_Window tkwin; /* The window in which the border will be
- * used (not currently used). */
- char *name; /* Name of the desired color. */
+TkDebugBorder(
+ Tk_Window tkwin, /* The window in which the border will be used
+ * (not currently used). */
+ char *name) /* Name of the desired color. */
{
TkBorder *borderPtr;
Tcl_HashEntry *hashPtr;
@@ -1393,16 +1370,24 @@ TkDebugBorder(tkwin, name)
if (hashPtr != NULL) {
borderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr);
if (borderPtr == NULL) {
- panic("TkDebugBorder found empty hash table entry");
+ Tcl_Panic("TkDebugBorder found empty hash table entry");
}
for ( ; (borderPtr != NULL); borderPtr = borderPtr->nextPtr) {
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(borderPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(borderPtr->objRefCount));
+ Tcl_NewIntObj(borderPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
return resultPtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tk3d.h b/generic/tk3d.h
index 2905ff5..5e0a0cf 100644
--- a/generic/tk3d.h
+++ b/generic/tk3d.h
@@ -1,13 +1,12 @@
/*
* tk3d.h --
*
- * Declarations of types and functions shared by the 3d border
- * module.
+ * Declarations of types and functions shared by the 3d border module.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TK3D
@@ -22,9 +21,8 @@
/*
* One of the following data structures is allocated for each 3-D border
- * currently in use. Structures of this type are indexed by
- * borderTable, so that a single structure can be shared for several
- * uses.
+ * currently in use. Structures of this type are indexed by borderTable, so
+ * that a single structure can be shared for several uses.
*/
typedef struct TkBorder {
@@ -38,18 +36,17 @@ typedef struct TkBorder {
int resourceRefCount; /* Number of active uses of this color (each
* active use corresponds to a call to
* Tk_Alloc3DBorderFromObj or Tk_Get3DBorder).
- * If this count is 0, then this structure
- * is no longer valid and it isn't present
- * in borderTable: it is being kept around
- * only because there are objects referring
- * to it. The structure is freed when
- * resourceRefCount and objRefCount are
- * both 0. */
+ * If this count is 0, then this structure is
+ * no longer valid and it isn't present in
+ * borderTable: it is being kept around only
+ * because there are objects referring to it.
+ * The structure is freed when
+ * resourceRefCount and objRefCount are both
+ * 0. */
int objRefCount; /* The number of Tcl objects that reference
* this structure. */
- XColor *bgColorPtr; /* Background color (intensity
- * between lightColorPtr and
- * darkColorPtr). */
+ XColor *bgColorPtr; /* Background color (intensity between
+ * lightColorPtr and darkColorPtr). */
XColor *darkColorPtr; /* Color for darker areas (must free when
* deleting structure). NULL means shadows
* haven't been allocated yet.*/
@@ -57,28 +54,26 @@ typedef struct TkBorder {
* (must free this when deleting structure).
* NULL means shadows haven't been allocated
* yet. */
- Pixmap shadow; /* Stipple pattern to use for drawing
- * shadows areas. Used for displays with
- * <= 64 colors or where colormap has filled
- * up. */
- GC bgGC; /* Used (if necessary) to draw areas in
- * the background color. */
- GC darkGC; /* Used to draw darker parts of the
- * border. None means the shadow colors
- * haven't been allocated yet.*/
- GC lightGC; /* Used to draw lighter parts of
- * the border. None means the shadow colors
- * haven't been allocated yet. */
- Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in
- * order to delete structure). */
+ Pixmap shadow; /* Stipple pattern to use for drawing shadows
+ * areas. Used for displays with <= 64 colors
+ * or where colormap has filled up. */
+ GC bgGC; /* Used (if necessary) to draw areas in the
+ * background color. */
+ GC darkGC; /* Used to draw darker parts of the border.
+ * None means the shadow colors haven't been
+ * allocated yet.*/
+ GC lightGC; /* Used to draw lighter parts of the border.
+ * None means the shadow colors haven't been
+ * allocated yet. */
+ Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in order to
+ * delete structure). */
struct TkBorder *nextPtr; /* Points to the next TkBorder structure with
- * the same color name. Borders with the
- * same name but different screens or
- * colormaps are chained together off a
- * single entry in borderTable. */
+ * the same color name. Borders with the same
+ * name but different screens or colormaps are
+ * chained together off a single entry in
+ * borderTable. */
} TkBorder;
-
/*
* Maximum intensity for a color:
*/
@@ -89,10 +84,9 @@ typedef struct TkBorder {
* Declarations for platform specific interfaces used by this module.
*/
-EXTERN TkBorder * TkpGetBorder _ANSI_ARGS_((void));
-EXTERN void TkpGetShadows _ANSI_ARGS_((TkBorder *borderPtr,
- Tk_Window tkwin));
-EXTERN void TkpFreeBorder _ANSI_ARGS_((TkBorder *borderPtr));
+MODULE_SCOPE TkBorder *TkpGetBorder(void);
+MODULE_SCOPE void TkpGetShadows(TkBorder *borderPtr, Tk_Window tkwin);
+MODULE_SCOPE void TkpFreeBorder(TkBorder *borderPtr);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 4821f41..a338e45 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -1,85 +1,81 @@
/*
* tkArgv.c --
*
- * This file contains a procedure that handles table-based
- * argv-argc parsing.
+ * This file contains a function that handles table-based argv-argc
+ * parsing.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
-#include "tk.h"
+#include "tkInt.h"
/*
- * Default table of argument descriptors. These are normally available
- * in every application.
+ * Default table of argument descriptors. These are normally available in
+ * every application.
*/
static Tk_ArgvInfo defaultTable[] = {
- {"-help", TK_ARGV_HELP, (char *) NULL, (char *) NULL,
+ {"-help", TK_ARGV_HELP, NULL, NULL,
"Print summary of command-line options and abort"},
- {NULL, TK_ARGV_END, (char *) NULL, (char *) NULL,
- (char *) NULL}
+ {NULL, TK_ARGV_END, NULL, NULL, NULL}
};
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void PrintUsage _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_ArgvInfo *argTable, int flags));
+static void PrintUsage(Tcl_Interp *interp, Tk_ArgvInfo *argTable,
+ int flags);
/*
*----------------------------------------------------------------------
*
* Tk_ParseArgv --
*
- * Process an argv array according to a table of expected
- * command-line options. See the manual page for more details.
+ * Process an argv array according to a table of expected command-line
+ * options. See the manual page for more details.
*
* Results:
- * The return value is a standard Tcl return value. If an
- * error occurs then an error message is left in the interp's result.
- * Under normal conditions, both *argcPtr and *argv are modified
- * to return the arguments that couldn't be processed here (they
- * didn't match the option table, or followed an TK_ARGV_REST
- * argument).
+ * The return value is a standard Tcl return value. If an error occurs
+ * then an error message is left in the interp's result. Under normal
+ * conditions, both *argcPtr and *argv are modified to return the
+ * arguments that couldn't be processed here (they didn't match the
+ * option table, or followed an TK_ARGV_REST argument).
*
* Side effects:
- * Variables may be modified, resources may be entered for tkwin,
- * or procedures may be called. It all depends on the arguments
- * and their entries in argTable. See the user documentation
- * for details.
+ * Variables may be modified, resources may be entered for tkwin, or
+ * functions may be called. It all depends on the arguments and their
+ * entries in argTable. See the user documentation for details.
*
*----------------------------------------------------------------------
*/
int
-Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
- Tcl_Interp *interp; /* Place to store error message. */
- Tk_Window tkwin; /* Window to use for setting Tk options.
- * NULL means ignore Tk option specs. */
- int *argcPtr; /* Number of arguments in argv. Modified
- * to hold # args left in argv at end. */
- CONST char **argv; /* Array of arguments. Modified to hold
- * those that couldn't be processed here. */
- Tk_ArgvInfo *argTable; /* Array of option descriptions */
- int flags; /* Or'ed combination of various flag bits,
+Tk_ParseArgv(
+ Tcl_Interp *interp, /* Place to store error message. */
+ Tk_Window tkwin, /* Window to use for setting Tk options. NULL
+ * means ignore Tk option specs. */
+ int *argcPtr, /* Number of arguments in argv. Modified to
+ * hold # args left in argv at end. */
+ CONST char **argv, /* Array of arguments. Modified to hold those
+ * that couldn't be processed here. */
+ Tk_ArgvInfo *argTable, /* Array of option descriptions */
+ int flags) /* Or'ed combination of various flag bits,
* such as TK_ARGV_NO_DEFAULTS. */
{
register Tk_ArgvInfo *infoPtr;
- /* Pointer to the current entry in the
- * table of argument descriptions. */
+ /* Pointer to the current entry in the table
+ * of argument descriptions. */
Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */
CONST char *curArg; /* Current argument */
register char c; /* Second character of current arg (used for
- * quick check for matching; use 2nd char.
- * because first char. will almost always
- * be '-'). */
+ * quick check for matching; use 2nd char.
+ * because first char. will almost always be
+ * '-'). */
int srcIndex; /* Location from which to read next argument
* from argv. */
int dstIndex; /* Index into argv to which next unused
@@ -109,9 +105,8 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
}
/*
- * Loop throught the argument descriptors searching for one with
- * the matching key string. If found, leave a pointer to it in
- * matchPtr.
+ * Loop throught the argument descriptors searching for one with the
+ * matching key string. If found, leave a pointer to it in matchPtr.
*/
matchPtr = NULL;
@@ -123,44 +118,43 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
}
for (; (infoPtr != NULL) && (infoPtr->type != TK_ARGV_END);
infoPtr++) {
- if (infoPtr->key == NULL) {
- continue;
- }
- if ((infoPtr->key[1] != c)
- || (strncmp(infoPtr->key, curArg, length) != 0)) {
- continue;
- }
- if ((tkwin == NULL)
- && ((infoPtr->type == TK_ARGV_CONST_OPTION)
- || (infoPtr->type == TK_ARGV_OPTION_VALUE)
- || (infoPtr->type == TK_ARGV_OPTION_NAME_VALUE))) {
- continue;
- }
- if (infoPtr->key[length] == 0) {
- matchPtr = infoPtr;
- goto gotMatch;
- }
- if (flags & TK_ARGV_NO_ABBREV) {
- continue;
- }
- if (matchPtr != NULL) {
- Tcl_AppendResult(interp, "ambiguous option \"", curArg,
- "\"", (char *) NULL);
- return TCL_ERROR;
- }
- matchPtr = infoPtr;
+ if (infoPtr->key == NULL) {
+ continue;
+ }
+ if ((infoPtr->key[1] != c)
+ || (strncmp(infoPtr->key, curArg, length) != 0)) {
+ continue;
+ }
+ if ((tkwin == NULL)
+ && ((infoPtr->type == TK_ARGV_CONST_OPTION)
+ || (infoPtr->type == TK_ARGV_OPTION_VALUE)
+ || (infoPtr->type == TK_ARGV_OPTION_NAME_VALUE))) {
+ continue;
+ }
+ if (infoPtr->key[length] == 0) {
+ matchPtr = infoPtr;
+ goto gotMatch;
+ }
+ if (flags & TK_ARGV_NO_ABBREV) {
+ continue;
+ }
+ if (matchPtr != NULL) {
+ Tcl_AppendResult(interp, "ambiguous option \"", curArg,
+ "\"", NULL);
+ return TCL_ERROR;
+ }
+ matchPtr = infoPtr;
}
}
if (matchPtr == NULL) {
-
/*
- * Unrecognized argument. Just copy it down, unless the caller
+ * Unrecognized argument. Just copy it down, unless the caller
* prefers an error to be registered.
*/
if (flags & TK_ARGV_NO_LEFTOVERS) {
Tcl_AppendResult(interp, "unrecognized argument \"",
- curArg, "\"", (char *) NULL);
+ curArg, "\"", NULL);
return TCL_ERROR;
}
argv[dstIndex] = curArg;
@@ -172,154 +166,143 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
* Take the appropriate action based on the option type
*/
- gotMatch:
+ gotMatch:
infoPtr = matchPtr;
switch (infoPtr->type) {
- case TK_ARGV_CONSTANT:
- *((int *) infoPtr->dst) = (int) infoPtr->src;
- break;
- case TK_ARGV_INT:
- if (argc == 0) {
- goto missingArg;
- } else {
- char *endPtr;
-
- *((int *) infoPtr->dst) =
- strtol(argv[srcIndex], &endPtr, 0);
- if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
- Tcl_AppendResult(interp, "expected integer argument ",
- "for \"", infoPtr->key, "\" but got \"",
- argv[srcIndex], "\"", (char *) NULL);
- return TCL_ERROR;
- }
- srcIndex++;
- argc--;
- }
- break;
- case TK_ARGV_STRING:
- if (argc == 0) {
- goto missingArg;
- } else {
- *((CONST char **)infoPtr->dst) = argv[srcIndex];
- srcIndex++;
- argc--;
- }
- break;
- case TK_ARGV_UID:
- if (argc == 0) {
- goto missingArg;
- } else {
- *((Tk_Uid *)infoPtr->dst) = Tk_GetUid(argv[srcIndex]);
- srcIndex++;
- argc--;
- }
- break;
- case TK_ARGV_REST:
- *((int *) infoPtr->dst) = dstIndex;
- goto argsDone;
- case TK_ARGV_FLOAT:
- if (argc == 0) {
- goto missingArg;
- } else {
- char *endPtr;
-
- *((double *) infoPtr->dst) =
- strtod(argv[srcIndex], &endPtr);
- if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
- Tcl_AppendResult(interp, "expected floating-point ",
- "argument for \"", infoPtr->key,
- "\" but got \"", argv[srcIndex], "\"",
- (char *) NULL);
- return TCL_ERROR;
- }
- srcIndex++;
- argc--;
- }
- break;
- case TK_ARGV_FUNC: {
- typedef int (ArgvFunc) _ANSI_ARGS_ ((char *, char *,
- CONST char *));
- ArgvFunc *handlerProc;
+ case TK_ARGV_CONSTANT:
+ *((int *) infoPtr->dst) = PTR2INT(infoPtr->src);
+ break;
+ case TK_ARGV_INT:
+ if (argc == 0) {
+ goto missingArg;
+ } else {
+ char *endPtr;
- handlerProc = (ArgvFunc *) infoPtr->src;
- if ((*handlerProc)(infoPtr->dst, infoPtr->key,
- argv[srcIndex])) {
- srcIndex += 1;
- argc -= 1;
+ *((int *) infoPtr->dst) = strtol(argv[srcIndex], &endPtr, 0);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ Tcl_AppendResult(interp,"expected integer argument for \"",
+ infoPtr->key, "\" but got \"", argv[srcIndex],
+ "\"", NULL);
+ return TCL_ERROR;
}
- break;
+ srcIndex++;
+ argc--;
+ }
+ break;
+ case TK_ARGV_STRING:
+ if (argc == 0) {
+ goto missingArg;
+ }
+ *((CONST char **)infoPtr->dst) = argv[srcIndex];
+ srcIndex++;
+ argc--;
+ break;
+ case TK_ARGV_UID:
+ if (argc == 0) {
+ goto missingArg;
}
- case TK_ARGV_GENFUNC: {
- typedef int (ArgvGenFunc)_ANSI_ARGS_((char *, Tcl_Interp *,
- char *, int, CONST char **));
- ArgvGenFunc *handlerProc;
+ *((Tk_Uid *)infoPtr->dst) = Tk_GetUid(argv[srcIndex]);
+ srcIndex++;
+ argc--;
+ break;
+ case TK_ARGV_REST:
+ *((int *) infoPtr->dst) = dstIndex;
+ goto argsDone;
+ case TK_ARGV_FLOAT:
+ if (argc == 0) {
+ goto missingArg;
+ } else {
+ char *endPtr;
- handlerProc = (ArgvGenFunc *) infoPtr->src;
- argc = (*handlerProc)(infoPtr->dst, interp, infoPtr->key,
- argc, argv+srcIndex);
- if (argc < 0) {
+ *((double *) infoPtr->dst) = strtod(argv[srcIndex], &endPtr);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ Tcl_AppendResult(interp, "expected floating-point ",
+ "argument for \"", infoPtr->key, "\" but got \"",
+ argv[srcIndex], "\"", NULL);
return TCL_ERROR;
}
- break;
+ srcIndex++;
+ argc--;
}
- case TK_ARGV_HELP:
- PrintUsage (interp, argTable, flags);
- return TCL_ERROR;
- case TK_ARGV_CONST_OPTION:
- Tk_AddOption(tkwin, infoPtr->dst, infoPtr->src,
- TK_INTERACTIVE_PRIO);
- break;
- case TK_ARGV_OPTION_VALUE:
- if (argc < 1) {
- goto missingArg;
- }
- Tk_AddOption(tkwin, infoPtr->dst, argv[srcIndex],
- TK_INTERACTIVE_PRIO);
+ break;
+ case TK_ARGV_FUNC: {
+ typedef int (ArgvFunc)(char *, char *, CONST char *);
+ ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src;
+
+ if ((*handlerProc)(infoPtr->dst, infoPtr->key, argv[srcIndex])) {
srcIndex++;
argc--;
- break;
- case TK_ARGV_OPTION_NAME_VALUE:
- if (argc < 2) {
- Tcl_AppendResult(interp, "\"", curArg,
- "\" option requires two following arguments",
- (char *) NULL);
- return TCL_ERROR;
- }
- Tk_AddOption(tkwin, argv[srcIndex], argv[srcIndex+1],
- TK_INTERACTIVE_PRIO);
- srcIndex += 2;
- argc -= 2;
- break;
- default: {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "bad argument type %d in Tk_ArgvInfo",
- infoPtr->type);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ }
+ break;
+ }
+ case TK_ARGV_GENFUNC: {
+ typedef int (ArgvGenFunc)(char *, Tcl_Interp *, char *, int,
+ CONST char **);
+ ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src;
+
+ argc = (*handlerProc)(infoPtr->dst, interp, infoPtr->key,
+ argc, argv+srcIndex);
+ if (argc < 0) {
+ return TCL_ERROR;
+ }
+ break;
+ }
+ case TK_ARGV_HELP:
+ PrintUsage(interp, argTable, flags);
+ return TCL_ERROR;
+ case TK_ARGV_CONST_OPTION:
+ Tk_AddOption(tkwin, infoPtr->dst, infoPtr->src,
+ TK_INTERACTIVE_PRIO);
+ break;
+ case TK_ARGV_OPTION_VALUE:
+ if (argc < 1) {
+ goto missingArg;
+ }
+ Tk_AddOption(tkwin, infoPtr->dst, argv[srcIndex],
+ TK_INTERACTIVE_PRIO);
+ srcIndex++;
+ argc--;
+ break;
+ case TK_ARGV_OPTION_NAME_VALUE:
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "\"", curArg,
+ "\" option requires two following arguments", NULL);
return TCL_ERROR;
}
+ Tk_AddOption(tkwin, argv[srcIndex], argv[srcIndex+1],
+ TK_INTERACTIVE_PRIO);
+ srcIndex += 2;
+ argc -= 2;
+ break;
+ default: {
+ char buf[64 + TCL_INTEGER_SPACE];
+
+ sprintf(buf, "bad argument type %d in Tk_ArgvInfo", infoPtr->type);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
}
}
/*
- * If we broke out of the loop because of an OPT_REST argument,
- * copy the remaining arguments down.
+ * If we broke out of the loop because of an OPT_REST argument, copy the
+ * remaining arguments down.
*/
- argsDone:
+ argsDone:
while (argc) {
argv[dstIndex] = argv[srcIndex];
srcIndex++;
dstIndex++;
argc--;
}
- argv[dstIndex] = (char *) NULL;
+ argv[dstIndex] = NULL;
*argcPtr = dstIndex;
return TCL_OK;
- missingArg:
+ missingArg:
Tcl_AppendResult(interp, "\"", curArg,
- "\" option requires an additional argument", (char *) NULL);
+ "\" option requires an additional argument", NULL);
return TCL_ERROR;
}
@@ -331,10 +314,9 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
* Generate a help string describing command-line options.
*
* Results:
- * The interp's result will be modified to hold a help string
- * describing all the options in argTable, plus all those
- * in the default table unless TK_ARGV_NO_DEFAULTS is
- * specified in flags.
+ * The interp's result will be modified to hold a help string describing
+ * all the options in argTable, plus all those in the default table
+ * unless TK_ARGV_NO_DEFAULTS is specified in flags.
*
* Side effects:
* None.
@@ -343,31 +325,29 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
*/
static void
-PrintUsage(interp, argTable, flags)
- Tcl_Interp *interp; /* Place information in this interp's
- * result area. */
- Tk_ArgvInfo *argTable; /* Array of command-specific argument
+PrintUsage(
+ Tcl_Interp *interp, /* Place information in this interp's result
+ * area. */
+ Tk_ArgvInfo *argTable, /* Array of command-specific argument
* descriptions. */
- int flags; /* If the TK_ARGV_NO_DEFAULTS bit is set
- * in this word, then don't generate
- * information for default options. */
+ int flags) /* If the TK_ARGV_NO_DEFAULTS bit is set in
+ * this word, then don't generate information
+ * for default options. */
{
register Tk_ArgvInfo *infoPtr;
- int width, i, numSpaces;
-#define NUM_SPACES 20
- static char spaces[] = " ";
+ size_t width, i, numSpaces;
char tmp[TCL_DOUBLE_SPACE];
/*
- * First, compute the width of the widest option key, so that we
- * can make everything line up.
+ * First, compute the width of the widest option key, so that we can make
+ * everything line up.
*/
width = 4;
for (i = 0; i < 2; i++) {
for (infoPtr = i ? defaultTable : argTable;
infoPtr->type != TK_ARGV_END; infoPtr++) {
- int length;
+ size_t length;
if (infoPtr->key == NULL) {
continue;
}
@@ -378,59 +358,54 @@ PrintUsage(interp, argTable, flags)
}
}
- Tcl_AppendResult(interp, "Command-specific options:", (char *) NULL);
+ Tcl_AppendResult(interp, "Command-specific options:", NULL);
for (i = 0; ; i++) {
for (infoPtr = i ? defaultTable : argTable;
infoPtr->type != TK_ARGV_END; infoPtr++) {
if ((infoPtr->type == TK_ARGV_HELP) && (infoPtr->key == NULL)) {
- Tcl_AppendResult(interp, "\n", infoPtr->help, (char *) NULL);
+ Tcl_AppendResult(interp, "\n", infoPtr->help, NULL);
continue;
}
- Tcl_AppendResult(interp, "\n ", infoPtr->key, ":", (char *) NULL);
+ Tcl_AppendResult(interp, "\n ", infoPtr->key, ":", NULL);
numSpaces = width + 1 - strlen(infoPtr->key);
- while (numSpaces > 0) {
- if (numSpaces >= NUM_SPACES) {
- Tcl_AppendResult(interp, spaces, (char *) NULL);
- } else {
- Tcl_AppendResult(interp, spaces+NUM_SPACES-numSpaces,
- (char *) NULL);
- }
- numSpaces -= NUM_SPACES;
+ while (numSpaces-- > 0) {
+ Tcl_AppendResult(interp, " ", NULL);
}
- Tcl_AppendResult(interp, infoPtr->help, (char *) NULL);
+ Tcl_AppendResult(interp, infoPtr->help, NULL);
switch (infoPtr->type) {
- case TK_ARGV_INT: {
- sprintf(tmp, "%d", *((int *) infoPtr->dst));
- Tcl_AppendResult(interp, "\n\t\tDefault value: ",
- tmp, (char *) NULL);
- break;
- }
- case TK_ARGV_FLOAT: {
- sprintf(tmp, "%g", *((double *) infoPtr->dst));
- Tcl_AppendResult(interp, "\n\t\tDefault value: ",
- tmp, (char *) NULL);
- break;
- }
- case TK_ARGV_STRING: {
- char *string;
+ case TK_ARGV_INT:
+ sprintf(tmp, "%d", *((int *) infoPtr->dst));
+ Tcl_AppendResult(interp, "\n\t\tDefault value: ", tmp, NULL);
+ break;
+ case TK_ARGV_FLOAT:
+ Tcl_PrintDouble(NULL, *((double *) infoPtr->dst), tmp);
+ Tcl_AppendResult(interp, "\n\t\tDefault value: ", tmp, NULL);
+ break;
+ case TK_ARGV_STRING: {
+ char *string = *((char **) infoPtr->dst);
- string = *((char **) infoPtr->dst);
- if (string != NULL) {
- Tcl_AppendResult(interp, "\n\t\tDefault value: \"",
- string, "\"", (char *) NULL);
- }
- break;
- }
- default: {
- break;
+ if (string != NULL) {
+ Tcl_AppendResult(interp, "\n\t\tDefault value: \"", string,
+ "\"", NULL);
}
+ break;
+ }
+ default:
+ break;
}
}
if ((flags & TK_ARGV_NO_DEFAULTS) || (i > 0)) {
break;
}
- Tcl_AppendResult(interp, "\nGeneric options for all commands:",
- (char *) NULL);
+ Tcl_AppendResult(interp, "\nGeneric options for all commands:", NULL);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkAtom.c b/generic/tkAtom.c
index f94af81..54d3598 100644
--- a/generic/tkAtom.c
+++ b/generic/tkAtom.c
@@ -1,25 +1,23 @@
-/*
+/*
* tkAtom.c --
*
- * This file manages a cache of X Atoms in order to avoid
- * interactions with the X server. It's much like the Xmu
- * routines, except it has a cleaner interface (caller
- * doesn't have to provide permanent storage for atom names,
- * for example).
+ * This file manages a cache of X Atoms in order to avoid interactions
+ * with the X server. It's much like the Xmu routines, except it has a
+ * cleaner interface (caller doesn't have to provide permanent storage
+ * for atom names, for example).
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
- * The following are a list of the predefined atom strings.
- * They should match those found in xatom.h
+ * The following are a list of the predefined atom strings. They should match
+ * those found in xatom.h
*/
static char * atomNameArray[] = {
@@ -46,24 +44,24 @@ static char * atomNameArray[] = {
"COPYRIGHT", "NOTICE", "FONT_NAME",
"FAMILY_NAME", "FULL_NAME", "CAP_HEIGHT",
"WM_CLASS", "WM_TRANSIENT_FOR",
- (char *) NULL
+ NULL
};
/*
- * Forward references to procedures defined in this file:
+ * Forward references to functions defined in this file:
*/
-static void AtomInit _ANSI_ARGS_((TkDisplay *dispPtr));
+static void AtomInit(TkDisplay *dispPtr);
/*
*--------------------------------------------------------------
*
* Tk_InternAtom --
*
- * Given a string, produce the equivalent X atom. This
- * procedure is equivalent to XInternAtom, except that it
- * keeps a local cache of atoms. Once a name is known,
- * the server need not be contacted again for that name.
+ * Given a string, produce the equivalent X atom. This function is
+ * equivalent to XInternAtom, except that it keeps a local cache of
+ * atoms. Once a name is known, the server need not be contacted again
+ * for that name.
*
* Results:
* The return value is the Atom corresponding to name.
@@ -75,32 +73,31 @@ static void AtomInit _ANSI_ARGS_((TkDisplay *dispPtr));
*/
Atom
-Tk_InternAtom(tkwin, name)
- Tk_Window tkwin; /* Window token; map name to atom
- * for this window's display. */
- CONST char *name; /* Name to turn into atom. */
+Tk_InternAtom(
+ Tk_Window tkwin, /* Window token; map name to atom for this
+ * window's display. */
+ CONST char *name) /* Name to turn into atom. */
{
register TkDisplay *dispPtr;
register Tcl_HashEntry *hPtr;
- int new;
+ int isNew;
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->atomInit) {
AtomInit(dispPtr);
}
- hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &new);
- if (new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
+ if (isNew) {
Tcl_HashEntry *hPtr2;
Atom atom;
atom = XInternAtom(dispPtr->display, name, False);
- Tcl_SetHashValue(hPtr, atom);
- hPtr2 = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom,
- &new);
+ Tcl_SetHashValue(hPtr, INT2PTR(atom));
+ hPtr2 = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
Tcl_SetHashValue(hPtr2, Tcl_GetHashKey(&dispPtr->nameTable, hPtr));
}
- return (Atom) Tcl_GetHashValue(hPtr);
+ return (Atom) PTR2INT(Tcl_GetHashValue(hPtr));
}
/*
@@ -108,16 +105,15 @@ Tk_InternAtom(tkwin, name)
*
* Tk_GetAtomName --
*
- * This procedure is equivalent to XGetAtomName except that
- * it uses the local atom cache to avoid contacting the
- * server.
+ * This function is equivalent to XGetAtomName except that it uses the
+ * local atom cache to avoid contacting the server.
*
* Results:
- * The return value is a character string corresponding to
- * the atom given by "atom". This string's storage space
- * is static: it need not be freed by the caller, and should
- * not be modified by the caller. If "atom" doesn't exist
- * on tkwin's display, then the string "?bad atom?" is returned.
+ * The return value is a character string corresponding to the atom given
+ * by "atom". This string's storage space is static: it need not be freed
+ * by the caller, and should not be modified by the caller. If "atom"
+ * doesn't exist on tkwin's display, then the string "?bad atom?" is
+ * returned.
*
* Side effects:
* None.
@@ -126,11 +122,10 @@ Tk_InternAtom(tkwin, name)
*/
CONST char *
-Tk_GetAtomName(tkwin, atom)
- Tk_Window tkwin; /* Window token; map atom to name
- * relative to this window's
- * display. */
- Atom atom; /* Atom whose name is wanted. */
+Tk_GetAtomName(
+ Tk_Window tkwin, /* Window token; map atom to name relative to
+ * this window's display. */
+ Atom atom) /* Atom whose name is wanted. */
{
register TkDisplay *dispPtr;
register Tcl_HashEntry *hPtr;
@@ -140,14 +135,14 @@ Tk_GetAtomName(tkwin, atom)
AtomInit(dispPtr);
}
- hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
+ hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, INT2PTR(atom));
if (hPtr == NULL) {
char *name;
Tk_ErrorHandler handler;
- int new, mustFree;
+ int isNew, mustFree;
- handler= Tk_CreateErrorHandler(dispPtr->display, BadAtom,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(dispPtr->display, BadAtom, -1, -1,
+ NULL, (ClientData) NULL);
name = XGetAtomName(dispPtr->display, atom);
mustFree = 1;
if (name == NULL) {
@@ -155,15 +150,13 @@ Tk_GetAtomName(tkwin, atom)
mustFree = 0;
}
Tk_DeleteErrorHandler(handler);
- hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, (char *) name,
- &new);
- Tcl_SetHashValue(hPtr, atom);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
+ Tcl_SetHashValue(hPtr, INT2PTR(atom));
if (mustFree) {
XFree(name);
}
name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
- hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom,
- &new);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
Tcl_SetHashValue(hPtr, name);
}
return Tcl_GetHashValue(hPtr);
@@ -186,8 +179,8 @@ Tk_GetAtomName(tkwin, atom)
*/
static void
-AtomInit(dispPtr)
- register TkDisplay *dispPtr; /* Display to initialize. */
+AtomInit(
+ register TkDisplay *dispPtr)/* Display to initialize. */
{
Tcl_HashEntry *hPtr;
Atom atom;
@@ -197,19 +190,27 @@ AtomInit(dispPtr)
Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS);
for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) {
- hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
- if (hPtr == NULL) {
- char *name;
- int new;
-
- name = atomNameArray[atom - 1];
- hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, (char *) name,
- &new);
- Tcl_SetHashValue(hPtr, atom);
- name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
- hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom,
- &new);
- Tcl_SetHashValue(hPtr, name);
+ char *name;
+ int isNew;
+
+ hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, INT2PTR(atom));
+ if (hPtr != NULL) {
+ continue;
}
+
+ name = atomNameArray[atom - 1];
+ hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
+ Tcl_SetHashValue(hPtr, INT2PTR(atom));
+ name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
+ Tcl_SetHashValue(hPtr, name);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkBind.c b/generic/tkBind.c
index c3ee5a1..cf8ed1d 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -1,29 +1,27 @@
-/*
+/*
* tkBind.c --
*
- * This file provides procedures that associate Tcl commands
- * with X events or sequences of X events.
+ * This file provides functions that associate Tcl commands with X events
+ * or sequences of X events.
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
#ifdef __WIN32__
#include "tkWinInt.h"
#endif
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* UNIX */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* UNIX */
#include "tkUnixInt.h"
#endif
-
/*
* File structure:
*
@@ -44,111 +42,109 @@
* Non-package-specific helpers.
*/
-
/*
- * The following union is used to hold the detail information from an
- * XEvent (including Tk's XVirtualEvent extension).
+ * The following union is used to hold the detail information from an XEvent
+ * (including Tk's XVirtualEvent extension).
*/
+
typedef union {
- KeySym keySym; /* KeySym that corresponds to xkey.keycode. */
- int button; /* Button that was pressed (xbutton.button). */
- Tk_Uid name; /* Tk_Uid of virtual event. */
- ClientData clientData; /* Used when type of Detail is unknown, and to
- * ensure that all bytes of Detail are initialized
- * when this structure is used in a hash key. */
+ KeySym keySym; /* KeySym that corresponds to xkey.keycode. */
+ int button; /* Button that was pressed (xbutton.button). */
+ Tk_Uid name; /* Tk_Uid of virtual event. */
+ ClientData clientData; /* Used when type of Detail is unknown, and to
+ * ensure that all bytes of Detail are
+ * initialized when this structure is used in
+ * a hash key. */
} Detail;
/*
- * The structure below represents a binding table. A binding table
- * represents a domain in which event bindings may occur. It includes
- * a space of objects relative to which events occur (usually windows,
- * but not always), a history of recent events in the domain, and
- * a set of mappings that associate particular Tcl commands with sequences
- * of events in the domain. Multiple binding tables may exist at once,
- * either because there are multiple applications open, or because there
- * are multiple domains within an application with separate event
- * bindings for each (for example, each canvas widget has a separate
- * binding table for associating events with the items in the canvas).
- *
- * Note: it is probably a bad idea to reduce EVENT_BUFFER_SIZE much
- * below 30. To see this, consider a triple mouse button click while
- * the Shift key is down (and auto-repeating). There may be as many
- * as 3 auto-repeat events after each mouse button press or release
- * (see the first large comment block within Tk_BindEvent for more on
- * this), for a total of 20 events to cover the three button presses
- * and two intervening releases. If you reduce EVENT_BUFFER_SIZE too
- * much, shift multi-clicks will be lost.
- *
+ * The structure below represents a binding table. A binding table represents
+ * a domain in which event bindings may occur. It includes a space of objects
+ * relative to which events occur (usually windows, but not always), a history
+ * of recent events in the domain, and a set of mappings that associate
+ * particular Tcl commands with sequences of events in the domain. Multiple
+ * binding tables may exist at once, either because there are multiple
+ * applications open, or because there are multiple domains within an
+ * application with separate event bindings for each (for example, each canvas
+ * widget has a separate binding table for associating events with the items
+ * in the canvas).
+ *
+ * Note: it is probably a bad idea to reduce EVENT_BUFFER_SIZE much below 30.
+ * To see this, consider a triple mouse button click while the Shift key is
+ * down (and auto-repeating). There may be as many as 3 auto-repeat events
+ * after each mouse button press or release (see the first large comment block
+ * within Tk_BindEvent for more on this), for a total of 20 events to cover
+ * the three button presses and two intervening releases. If you reduce
+ * EVENT_BUFFER_SIZE too much, shift multi-clicks will be lost.
*/
#define EVENT_BUFFER_SIZE 30
typedef struct BindingTable {
- XEvent eventRing[EVENT_BUFFER_SIZE];/* Circular queue of recent events
- * (higher indices are for more recent
- * events). */
- Detail detailRing[EVENT_BUFFER_SIZE];/* "Detail" information (keySym,
- * button, Tk_Uid, or 0) for each
- * entry in eventRing. */
- int curEvent; /* Index in eventRing of most recent
- * event. Newer events have higher
- * indices. */
- Tcl_HashTable patternTable; /* Used to map from an event to a
- * list of patterns that may match that
- * event. Keys are PatternTableKey
- * structs, values are (PatSeq *). */
- Tcl_HashTable objectTable; /* Used to map from an object to a
- * list of patterns associated with
- * that object. Keys are ClientData,
- * values are (PatSeq *). */
- Tcl_Interp *interp; /* Interpreter in which commands are
- * executed. */
+ XEvent eventRing[EVENT_BUFFER_SIZE];
+ /* Circular queue of recent events (higher
+ * indices are for more recent events). */
+ Detail detailRing[EVENT_BUFFER_SIZE];
+ /* "Detail" information (keySym, button,
+ * Tk_Uid, or 0) for each entry in
+ * eventRing. */
+ int curEvent; /* Index in eventRing of most recent event.
+ * Newer events have higher indices. */
+ Tcl_HashTable patternTable; /* Used to map from an event to a list of
+ * patterns that may match that event. Keys
+ * are PatternTableKey structs, values are
+ * (PatSeq *). */
+ Tcl_HashTable objectTable; /* Used to map from an object to a list of
+ * patterns associated with that object. Keys
+ * are ClientData, values are (PatSeq *). */
+ Tcl_Interp *interp; /* Interpreter in which commands are
+ * executed. */
} BindingTable;
/*
- * The following structure represents virtual event table. A virtual event
- * table provides a way to map from platform-specific physical events such
- * as button clicks or key presses to virtual events such as <<Paste>>,
+ * The following structure represents virtual event table. A virtual event
+ * table provides a way to map from platform-specific physical events such as
+ * button clicks or key presses to virtual events such as <<Paste>>,
* <<Close>>, or <<ScrollWindow>>.
*
* A virtual event is usually never part of the event stream, but instead is
- * synthesized inline by matching low-level events. However, a virtual
- * event may be generated by platform-specific code or by Tcl scripts. In
- * that case, no lookup of the virtual event will need to be done using
- * this table, because the virtual event is actually in the event stream.
+ * synthesized inline by matching low-level events. However, a virtual event
+ * may be generated by platform-specific code or by Tcl scripts. In that case,
+ * no lookup of the virtual event will need to be done using this table,
+ * because the virtual event is actually in the event stream.
*/
typedef struct VirtualEventTable {
- Tcl_HashTable patternTable; /* Used to map from a physical event to
- * a list of patterns that may match that
- * event. Keys are PatternTableKey
- * structs, values are (PatSeq *). */
- Tcl_HashTable nameTable; /* Used to map a virtual event name to
- * the array of physical events that can
- * trigger it. Keys are the Tk_Uid names
- * of the virtual events, values are
- * PhysicalsOwned structs. */
+ Tcl_HashTable patternTable; /* Used to map from a physical event to a list
+ * of patterns that may match that event. Keys
+ * are PatternTableKey structs, values are
+ * (PatSeq *). */
+ Tcl_HashTable nameTable; /* Used to map a virtual event name to the
+ * array of physical events that can trigger
+ * it. Keys are the Tk_Uid names of the
+ * virtual events, values are PhysicalsOwned
+ * structs. */
} VirtualEventTable;
/*
- * The following structure is used as a key in a patternTable for both
- * binding tables and a virtual event tables.
+ * The following structure is used as a key in a patternTable for both binding
+ * tables and a virtual event tables.
*
- * In a binding table, the object field corresponds to the binding tag
- * for the widget whose bindings are being accessed.
+ * In a binding table, the object field corresponds to the binding tag for the
+ * widget whose bindings are being accessed.
*
- * In a virtual event table, the object field is always NULL. Virtual
- * events are a global definiton and are not tied to a particular
- * binding tag.
+ * In a virtual event table, the object field is always NULL. Virtual events
+ * are a global definiton and are not tied to a particular binding tag.
*
- * The same key is used for both types of pattern tables so that the
- * helper functions that traverse and match patterns will work for both
- * binding tables and virtual event tables.
+ * The same key is used for both types of pattern tables so that the helper
+ * functions that traverse and match patterns will work for both binding
+ * tables and virtual event tables.
*/
+
typedef struct PatternTableKey {
ClientData object; /* For binding table, identifies the binding
* tag of the object (or class of objects)
- * relative to which the event occurred.
- * For virtual event table, always NULL. */
+ * relative to which the event occurred. For
+ * virtual event table, always NULL. */
int type; /* Type of event (from X). */
Detail detail; /* Additional information, such as keysym,
* button, Tk_Uid, or 0 if nothing
@@ -162,37 +158,34 @@ typedef struct PatternTableKey {
typedef struct Pattern {
int eventType; /* Type of X event, e.g. ButtonPress. */
- int needMods; /* Mask of modifiers that must be
- * present (0 means no modifiers are
- * required). */
- Detail detail; /* Additional information that must
- * match event. Normally this is 0,
- * meaning no additional information
- * must match. For KeyPress and
- * KeyRelease events, a keySym may
- * be specified to select a
- * particular keystroke (0 means any
- * keystrokes). For button events,
- * specifies a particular button (0
- * means any buttons are OK). For virtual
- * events, specifies the Tk_Uid of the
+ int needMods; /* Mask of modifiers that must be present (0
+ * means no modifiers are required). */
+ Detail detail; /* Additional information that must match
+ * event. Normally this is 0, meaning no
+ * additional information must match. For
+ * KeyPress and KeyRelease events, a keySym
+ * may be specified to select a particular
+ * keystroke (0 means any keystrokes). For
+ * button events, specifies a particular
+ * button (0 means any buttons are OK). For
+ * virtual events, specifies the Tk_Uid of the
* virtual event name (never 0). */
} Pattern;
/*
* The following structure defines a pattern sequence, which consists of one
- * or more patterns. In order to trigger, a pattern sequence must match
- * the most recent X events (first pattern to most recent event, next
- * pattern to next event, and so on). It is used as the hash value in a
- * patternTable for both binding tables and virtual event tables.
- *
- * In a binding table, it is the sequence of physical events that make up
- * a binding for an object.
- *
- * In a virtual event table, it is the sequence of physical events that
- * define a virtual event.
- *
- * The same structure is used for both types of pattern tables so that the
+ * or more patterns. In order to trigger, a pattern sequence must match the
+ * most recent X events (first pattern to most recent event, next pattern to
+ * next event, and so on). It is used as the hash value in a patternTable for
+ * both binding tables and virtual event tables.
+ *
+ * In a binding table, it is the sequence of physical events that make up a
+ * binding for an object.
+ *
+ * In a virtual event table, it is the sequence of physical events that define
+ * a virtual event.
+ *
+ * The same structure is used for both types of pattern tables so that the
* helper functions that traverse and match patterns will work for both
* binding tables and virtual event tables.
*/
@@ -200,57 +193,56 @@ typedef struct Pattern {
typedef struct PatSeq {
int numPats; /* Number of patterns in sequence (usually
* 1). */
- TkBindEvalProc *eventProc; /* The procedure that will be invoked on
- * the clientData when this pattern sequence
+ TkBindEvalProc *eventProc; /* The function that will be invoked on the
+ * clientData when this pattern sequence
* matches. */
- TkBindFreeProc *freeProc; /* The procedure that will be invoked to
+ TkBindFreeProc *freeProc; /* The function that will be invoked to
* release the clientData when this pattern
* sequence is freed. */
ClientData clientData; /* Arbitray data passed to eventProc and
* freeProc when sequence matches. */
int flags; /* Miscellaneous flag values; see below for
* definitions. */
- int refCount; /* Number of times that this binding is in
- * the midst of executing. If greater than 1,
- * then a recursive invocation is happening.
- * Only when this is zero can the binding
- * actually be freed. */
- struct PatSeq *nextSeqPtr; /* Next in list of all pattern sequences
- * that have the same initial pattern. NULL
- * means end of list. */
- Tcl_HashEntry *hPtr; /* Pointer to hash table entry for the
- * initial pattern. This is the head of the
- * list of which nextSeqPtr forms a part. */
- struct VirtualOwners *voPtr;/* In a binding table, always NULL. In a
+ int refCount; /* Number of times that this binding is in the
+ * midst of executing. If greater than 1, then
+ * a recursive invocation is happening. Only
+ * when this is zero can the binding actually
+ * be freed. */
+ struct PatSeq *nextSeqPtr; /* Next in list of all pattern sequences that
+ * have the same initial pattern. NULL means
+ * end of list. */
+ Tcl_HashEntry *hPtr; /* Pointer to hash table entry for the initial
+ * pattern. This is the head of the list of
+ * which nextSeqPtr forms a part. */
+ struct VirtualOwners *voPtr;/* In a binding table, always NULL. In a
* virtual event table, identifies the array
* of virtual events that can be triggered by
* this event. */
- struct PatSeq *nextObjPtr; /* In a binding table, next in list of all
+ struct PatSeq *nextObjPtr; /* In a binding table, next in list of all
* pattern sequences for the same object (NULL
- * for end of list). Needed to implement
- * Tk_DeleteAllBindings. In a virtual event
+ * for end of list). Needed to implement
+ * Tk_DeleteAllBindings. In a virtual event
* table, always NULL. */
- Pattern pats[1]; /* Array of "numPats" patterns. Only one
+ Pattern pats[1]; /* Array of "numPats" patterns. Only one
* element is declared here but in actuality
- * enough space will be allocated for "numPats"
- * patterns. To match, pats[0] must match
- * event n, pats[1] must match event n-1, etc.
- */
+ * enough space will be allocated for
+ * "numPats" patterns. To match, pats[0] must
+ * match event n, pats[1] must match event
+ * n-1, etc. */
} PatSeq;
/*
* Flag values for PatSeq structures:
*
- * PAT_NEARBY 1 means that all of the events matching
- * this sequence must occur with nearby X
- * and Y mouse coordinates and close in time.
- * This is typically used to restrict multiple
- * button presses.
+ * PAT_NEARBY 1 means that all of the events matching this sequence
+ * must occur with nearby X and Y mouse coordinates and
+ * close in time. This is typically used to restrict
+ * multiple button presses.
* MARKED_DELETED 1 means that this binding has been marked as deleted
* and removed from the binding table, but its memory
- * could not be released because it was already queued for
- * execution. When the binding is actually about to be
- * executed, this flag will be checked and the binding
+ * could not be released because it was already queued
+ * for execution. When the binding is actually about to
+ * be executed, this flag will be checked and the binding
* skipped if set.
*/
@@ -258,52 +250,49 @@ typedef struct PatSeq {
#define MARKED_DELETED 0x2
/*
- * Constants that define how close together two events must be
- * in milliseconds or pixels to meet the PAT_NEARBY constraint:
+ * Constants that define how close together two events must be in milliseconds
+ * or pixels to meet the PAT_NEARBY constraint:
*/
#define NEARBY_PIXELS 5
#define NEARBY_MS 500
-
/*
* The following structure keeps track of all the virtual events that are
- * associated with a particular physical event. It is pointed to by the
- * voPtr field in a PatSeq in the patternTable of a virtual event table.
+ * associated with a particular physical event. It is pointed to by the voPtr
+ * field in a PatSeq in the patternTable of a virtual event table.
*/
typedef struct VirtualOwners {
- int numOwners; /* Number of virtual events to trigger. */
- Tcl_HashEntry *owners[1]; /* Array of pointers to entries in
- * nameTable. Enough space will
- * actually be allocated for numOwners
- * hash entries. */
+ int numOwners; /* Number of virtual events to trigger. */
+ Tcl_HashEntry *owners[1]; /* Array of pointers to entries in nameTable.
+ * Enough space will actually be allocated for
+ * numOwners hash entries. */
} VirtualOwners;
/*
- * The following structure is used in the nameTable of a virtual event
- * table to associate a virtual event with all the physical events that can
- * trigger it.
+ * The following structure is used in the nameTable of a virtual event table
+ * to associate a virtual event with all the physical events that can trigger
+ * it.
*/
typedef struct PhysicalsOwned {
- int numOwned; /* Number of physical events owned. */
- PatSeq *patSeqs[1]; /* Array of pointers to physical event
- * patterns. Enough space will actually
- * be allocated to hold numOwned. */
+ int numOwned; /* Number of physical events owned. */
+ PatSeq *patSeqs[1]; /* Array of pointers to physical event
+ * patterns. Enough space will actually be
+ * allocated to hold numOwned. */
} PhysicalsOwned;
/*
- * One of the following structures exists for each interpreter. This
- * structure keeps track of the current display and screen in the
- * interpreter, so that a script can be invoked whenever the display/screen
- * changes (the script does things like point tk::Priv at a display-specific
- * structure).
+ * One of the following structures exists for each interpreter. This structure
+ * keeps track of the current display and screen in the interpreter, so that a
+ * script can be invoked whenever the display/screen changes (the script does
+ * things like point tk::Priv at a display-specific structure).
*/
typedef struct {
- TkDisplay *curDispPtr; /* Display for last binding command invoked
- * in this application. */
- int curScreenIndex; /* Index of screen for last binding command. */
+ TkDisplay *curDispPtr; /* Display for last binding command invoked in
+ * this application. */
+ int curScreenIndex; /* Index of screen for last binding command */
int bindingDepth; /* Number of active instances of Tk_BindEvent
* in this application. */
} ScreenInfo;
@@ -311,21 +300,21 @@ typedef struct {
/*
* The following structure is used to keep track of all the C bindings that
* are awaiting invocation and whether the window they refer to has been
- * destroyed. If the window is destroyed, then all pending callbacks for
- * that window will be cancelled. The Tcl bindings will still all be
- * invoked, however.
+ * destroyed. If the window is destroyed, then all pending callbacks for that
+ * window will be cancelled. The Tcl bindings will still all be invoked,
+ * however.
*/
typedef struct PendingBinding {
struct PendingBinding *nextPtr;
- /* Next in chain of pending bindings, in
- * case a recursive binding evaluation is in
+ /* Next in chain of pending bindings, in case
+ * a recursive binding evaluation is in
* progress. */
Tk_Window tkwin; /* The window that the following bindings
* depend upon. */
- int deleted; /* Set to non-zero by window cleanup code
- * if tkwin is deleted. */
- PatSeq *matchArray[5]; /* Array of pending C bindings. The actual
+ int deleted; /* Set to non-zero by window cleanup code if
+ * tkwin is deleted. */
+ PatSeq *matchArray[5]; /* Array of pending C bindings. The actual
* size of this depends on how many C bindings
* matched the event passed to Tk_BindEvent.
* THIS FIELD MUST BE THE LAST IN THE
@@ -333,8 +322,8 @@ typedef struct PendingBinding {
} PendingBinding;
/*
- * The following structure keeps track of all the information local to
- * the binding package on a per interpreter basis.
+ * The following structure keeps track of all the information local to the
+ * binding package on a per interpreter basis.
*/
typedef struct BindInfo {
@@ -342,39 +331,38 @@ typedef struct BindInfo {
/* The virtual events that exist in this
* interpreter. */
ScreenInfo screenInfo; /* Keeps track of the current display and
- * screen, so it can be restored after
- * a binding has executed. */
+ * screen, so it can be restored after a
+ * binding has executed. */
PendingBinding *pendingList;/* The list of pending C bindings, kept in
* case a C or Tcl binding causes the target
* window to be deleted. */
- int deleted; /* 1 the application has been deleted but
- * the structure has been preserved. */
+ int deleted; /* 1 the application has been deleted but the
+ * structure has been preserved. */
} BindInfo;
-
+
/*
- * In X11R4 and earlier versions, XStringToKeysym is ridiculously
- * slow. The data structure and hash table below, along with the
- * code that uses them, implement a fast mapping from strings to
- * keysyms. In X11R5 and later releases XStringToKeysym is plenty
- * fast so this stuff isn't needed. The #define REDO_KEYSYM_LOOKUP
- * is normally undefined, so that XStringToKeysym gets used. It
- * can be set in the Makefile to enable the use of the hash table
- * below.
+ * In X11R4 and earlier versions, XStringToKeysym is ridiculously slow. The
+ * data structure and hash table below, along with the code that uses them,
+ * implement a fast mapping from strings to keysyms. In X11R5 and later
+ * releases XStringToKeysym is plenty fast so this stuff isn't needed. The
+ * #define REDO_KEYSYM_LOOKUP is normally undefined, so that XStringToKeysym
+ * gets used. It can be set in the Makefile to enable the use of the hash
+ * table below.
*/
#ifdef REDO_KEYSYM_LOOKUP
typedef struct {
- char *name; /* Name of keysym. */
- KeySym value; /* Numeric identifier for keysym. */
+ char *name; /* Name of keysym. */
+ KeySym value; /* Numeric identifier for keysym. */
} KeySymInfo;
static KeySymInfo keyArray[] = {
#ifndef lint
#include "ks_names.h"
#endif
- {(char *) NULL, 0}
+ {NULL, 0}
};
-static Tcl_HashTable keySymTable; /* keyArray hashed by keysym value. */
-static Tcl_HashTable nameTable; /* keyArray hashed by keysym name. */
+static Tcl_HashTable keySymTable; /* keyArray hashed by keysym value. */
+static Tcl_HashTable nameTable; /* keyArray hashed by keysym name. */
#endif /* REDO_KEYSYM_LOOKUP */
/*
@@ -386,16 +374,17 @@ static int initialized = 0;
TCL_DECLARE_MUTEX(bindMutex)
/*
- * A hash table is kept to map from the string names of event
- * modifiers to information about those modifiers. The structure
- * for storing this information, and the hash table built at
- * initialization time, are defined below.
+ * A hash table is kept to map from the string names of event modifiers to
+ * information about those modifiers. The structure for storing this
+ * information, and the hash table built at initialization time, are defined
+ * below.
*/
typedef struct {
char *name; /* Name of modifier. */
- int mask; /* Button/modifier mask value, * such as Button1Mask. */
- int flags; /* Various flags; see below for
+ int mask; /* Button/modifier mask value, such as
+ * Button1Mask. */
+ int flags; /* Various flags; see below for
* definitions. */
} ModInfo;
@@ -423,6 +412,7 @@ static ModInfo modArray[] = {
{"Meta", META_MASK, 0},
{"M", META_MASK, 0},
{"Alt", ALT_MASK, 0},
+ {"Extended", EXTENDED_MASK, 0},
{"B1", Button1Mask, 0},
{"Button1", Button1Mask, 0},
{"B2", Button2Mask, 0},
@@ -448,32 +438,29 @@ static ModInfo modArray[] = {
{"Double", 0, DOUBLE},
{"Triple", 0, TRIPLE},
{"Quadruple", 0, QUADRUPLE},
- {"Any", 0, 0}, /* Ignored: historical relic. */
+ {"Any", 0, 0}, /* Ignored: historical relic */
{NULL, 0, 0}
};
static Tcl_HashTable modTable;
/*
- * This module also keeps a hash table mapping from event names
- * to information about those events. The structure, an array
- * to use to initialize the hash table, and the hash table are
- * all defined below.
+ * This module also keeps a hash table mapping from event names to information
+ * about those events. The structure, an array to use to initialize the hash
+ * table, and the hash table are all defined below.
*/
typedef struct {
char *name; /* Name of event. */
- int type; /* Event type for X, such as
- * ButtonPress. */
- int eventMask; /* Mask bits (for XSelectInput)
- * for this event type. */
+ int type; /* Event type for X, such as ButtonPress. */
+ int eventMask; /* Mask bits (for XSelectInput) for this event
+ * type. */
} EventInfo;
/*
- * Note: some of the masks below are an OR-ed combination of
- * several masks. This is necessary because X doesn't report
- * up events unless you also ask for down events. Also, X
- * doesn't report button state in motion events unless you've
- * asked about button events.
+ * Note: some of the masks below are an OR-ed combination of several masks.
+ * This is necessary because X doesn't report up events unless you also ask
+ * for down events. Also, X doesn't report button state in motion events
+ * unless you've asked about button events.
*/
static EventInfo eventArray[] = {
@@ -507,18 +494,18 @@ static EventInfo eventArray[] = {
{"CirculateRequest", CirculateRequest, SubstructureRedirectMask},
{"ConfigureRequest", ConfigureRequest, SubstructureRedirectMask},
{"Create", CreateNotify, SubstructureNotifyMask},
- {"MapRequest", MapRequest, SubstructureRedirectMask},
+ {"MapRequest", MapRequest, SubstructureRedirectMask},
{"ResizeRequest", ResizeRequest, ResizeRedirectMask},
- {(char *) NULL, 0, 0}
+ {NULL, 0, 0}
};
static Tcl_HashTable eventTable;
/*
- * The defines and table below are used to classify events into
- * various groups. The reason for this is that logically identical
- * fields (e.g. "state") appear at different places in different
- * types of events. The classification masks can be used to figure
- * out quickly where to extract information from events.
+ * The defines and table below are used to classify events into various
+ * groups. The reason for this is that logically identical fields (e.g.
+ * "state") appear at different places in different types of events. The
+ * classification masks can be used to figure out quickly where to extract
+ * information from events.
*/
#define KEY 0x1
@@ -546,7 +533,7 @@ static Tcl_HashTable eventTable;
#define CIRCREQ 0x400000
#define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL)
-#define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|CROSSING|VIRTUAL)
+#define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|VIRTUAL|CROSSING)
static int flagArray[TK_LASTEVENT] = {
/* Not used */ 0,
@@ -585,18 +572,17 @@ static int flagArray[TK_LASTEVENT] = {
/* ClientMessage */ 0,
/* MappingNotify */ 0,
/* VirtualEvent */ VIRTUAL,
- /* Activate */ ACTIVATE,
+ /* Activate */ ACTIVATE,
/* Deactivate */ ACTIVATE,
/* MouseWheel */ KEY
};
/*
- * The following table is used to map between the location where an
- * generated event should be queued and the string used to specify the
- * location.
+ * The following table is used to map between the location where an generated
+ * event should be queued and the string used to specify the location.
*/
-
-static TkStateMap queuePosition[] = {
+
+static const TkStateMap queuePosition[] = {
{-1, "now"},
{TCL_QUEUE_HEAD, "head"},
{TCL_QUEUE_MARK, "mark"},
@@ -605,13 +591,13 @@ static TkStateMap queuePosition[] = {
};
/*
- * The following tables are used as a two-way map between X's internal
- * numeric values for fields in an XEvent and the strings used in Tcl. The
- * tables are used both when constructing an XEvent from user input and
- * when providing data from an XEvent to the user.
+ * The following tables are used as a two-way map between X's internal numeric
+ * values for fields in an XEvent and the strings used in Tcl. The tables are
+ * used both when constructing an XEvent from user input and when providing
+ * data from an XEvent to the user.
*/
-static TkStateMap notifyMode[] = {
+static const TkStateMap notifyMode[] = {
{NotifyNormal, "NotifyNormal"},
{NotifyGrab, "NotifyGrab"},
{NotifyUngrab, "NotifyUngrab"},
@@ -619,7 +605,7 @@ static TkStateMap notifyMode[] = {
{-1, NULL}
};
-static TkStateMap notifyDetail[] = {
+static const TkStateMap notifyDetail[] = {
{NotifyAncestor, "NotifyAncestor"},
{NotifyVirtual, "NotifyVirtual"},
{NotifyInferior, "NotifyInferior"},
@@ -631,20 +617,20 @@ static TkStateMap notifyDetail[] = {
{-1, NULL}
};
-static TkStateMap circPlace[] = {
+static const TkStateMap circPlace[] = {
{PlaceOnTop, "PlaceOnTop"},
{PlaceOnBottom, "PlaceOnBottom"},
{-1, NULL}
};
-static TkStateMap visNotify[] = {
- {VisibilityUnobscured, "VisibilityUnobscured"},
- {VisibilityPartiallyObscured, "VisibilityPartiallyObscured"},
- {VisibilityFullyObscured, "VisibilityFullyObscured"},
+static const TkStateMap visNotify[] = {
+ {VisibilityUnobscured, "VisibilityUnobscured"},
+ {VisibilityPartiallyObscured, "VisibilityPartiallyObscured"},
+ {VisibilityFullyObscured, "VisibilityFullyObscured"},
{-1, NULL}
};
-static TkStateMap configureRequestDetail[] = {
+static const TkStateMap configureRequestDetail[] = {
{None, "None"},
{Above, "Above"},
{Below, "Below"},
@@ -654,79 +640,71 @@ static TkStateMap configureRequestDetail[] = {
{-1, NULL}
};
-static TkStateMap propNotify[] = {
+static const TkStateMap propNotify[] = {
{PropertyNewValue, "NewValue"},
{PropertyDelete, "Delete"},
{-1, NULL}
};
/*
- * Prototypes for local procedures defined in this file:
+ * Prototypes for local functions defined in this file:
*/
-static void ChangeScreen _ANSI_ARGS_((Tcl_Interp *interp,
- char *dispName, int screenIndex));
-static int CreateVirtualEvent _ANSI_ARGS_((Tcl_Interp *interp,
+static void ChangeScreen(Tcl_Interp *interp, char *dispName,
+ int screenIndex);
+static int CreateVirtualEvent(Tcl_Interp *interp,
VirtualEventTable *vetPtr, char *virtString,
- char *eventString));
-static int DeleteVirtualEvent _ANSI_ARGS_((Tcl_Interp *interp,
+ char *eventString);
+static int DeleteVirtualEvent(Tcl_Interp *interp,
VirtualEventTable *vetPtr, char *virtString,
- char *eventString));
-static void DeleteVirtualEventTable _ANSI_ARGS_((
- VirtualEventTable *vetPtr));
-static void ExpandPercents _ANSI_ARGS_((TkWindow *winPtr,
- CONST char *before, XEvent *eventPtr, KeySym keySym,
- Tcl_DString *dsPtr));
-static void FreeTclBinding _ANSI_ARGS_((ClientData clientData));
-static PatSeq * FindSequence _ANSI_ARGS_((Tcl_Interp *interp,
+ char *eventString);
+static void DeleteVirtualEventTable(VirtualEventTable *vetPtr);
+static void ExpandPercents(TkWindow *winPtr, const char *before,
+ XEvent *eventPtr,KeySym keySym,Tcl_DString *dsPtr);
+static void FreeTclBinding(ClientData clientData);
+static PatSeq * FindSequence(Tcl_Interp *interp,
Tcl_HashTable *patternTablePtr, ClientData object,
- CONST char *eventString, int create,
- int allowVirtual, unsigned long *maskPtr));
-static void GetAllVirtualEvents _ANSI_ARGS_((Tcl_Interp *interp,
- VirtualEventTable *vetPtr));
-static char * GetField _ANSI_ARGS_((char *p, char *copy, int size));
-static void GetPatternString _ANSI_ARGS_((PatSeq *psPtr,
- Tcl_DString *dsPtr));
-static int GetVirtualEvent _ANSI_ARGS_((Tcl_Interp *interp,
- VirtualEventTable *vetPtr, char *virtString));
-static Tk_Uid GetVirtualEventUid _ANSI_ARGS_((Tcl_Interp *interp,
- char *virtString));
-static int HandleEventGenerate _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window main, int objc,
- Tcl_Obj *CONST objv[]));
-static void InitVirtualEventTable _ANSI_ARGS_((
- VirtualEventTable *vetPtr));
-static PatSeq * MatchPatterns _ANSI_ARGS_((TkDisplay *dispPtr,
+ const char *eventString, int create,
+ int allowVirtual, unsigned long *maskPtr);
+static void GetAllVirtualEvents(Tcl_Interp *interp,
+ VirtualEventTable *vetPtr);
+static char * GetField(char *p, char *copy, int size);
+static void GetPatternString(PatSeq *psPtr, Tcl_DString *dsPtr);
+static int GetVirtualEvent(Tcl_Interp *interp,
+ VirtualEventTable *vetPtr, char *virtString);
+static Tk_Uid GetVirtualEventUid(Tcl_Interp *interp,
+ char *virtString);
+static int HandleEventGenerate(Tcl_Interp *interp, Tk_Window main,
+ int objc, Tcl_Obj *const objv[]);
+static void InitVirtualEventTable(VirtualEventTable *vetPtr);
+static PatSeq * MatchPatterns(TkDisplay *dispPtr,
BindingTable *bindPtr, PatSeq *psPtr,
PatSeq *bestPtr, ClientData *objectPtr,
- PatSeq **sourcePtrPtr));
-static int NameToWindow _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window main, Tcl_Obj *objPtr,
- Tk_Window *tkwinPtr));
-static int ParseEventDescription _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char **eventStringPtr, Pattern *patPtr,
- unsigned long *eventMaskPtr));
-static void DoWarp _ANSI_ARGS_((ClientData clientData));
+ PatSeq **sourcePtrPtr);
+static int NameToWindow(Tcl_Interp *interp, Tk_Window main,
+ Tcl_Obj *objPtr, Tk_Window *tkwinPtr);
+static int ParseEventDescription(Tcl_Interp *interp,
+ const char **eventStringPtr, Pattern *patPtr,
+ unsigned long *eventMaskPtr);
+static void DoWarp(ClientData clientData);
/*
- * The following define is used as a short circuit for the callback
- * procedure to evaluate a TclBinding. The actual evaluation of the
- * binding is handled inline, because special things have to be done
- * with a Tcl binding before evaluation time.
+ * The following define is used as a short circuit for the callback function
+ * to evaluate a TclBinding. The actual evaluation of the binding is handled
+ * inline, because special things have to be done with a Tcl binding before
+ * evaluation time.
*/
#define EvalTclBinding ((TkBindEvalProc *) 1)
-
/*
*---------------------------------------------------------------------------
*
* TkBindInit --
*
- * This procedure is called when an application is created. It
- * initializes all the structures used by bindings and virtual
- * events. It must be called before any other functions in this
- * file are called.
+ * This function is called when an application is created. It initializes
+ * all the structures used by bindings and virtual events. It must be
+ * called before any other functions in this file are called.
*
* Results:
* None.
@@ -738,39 +716,37 @@ static void DoWarp _ANSI_ARGS_((ClientData clientData));
*/
void
-TkBindInit(mainPtr)
- TkMainInfo *mainPtr; /* The newly created application. */
+TkBindInit(
+ TkMainInfo *mainPtr) /* The newly created application. */
{
BindInfo *bindInfoPtr;
if (sizeof(XEvent) < sizeof(XVirtualEvent)) {
- panic("TkBindInit: virtual events can't be supported");
+ Tcl_Panic("TkBindInit: virtual events can't be supported");
}
/*
- * Initialize the static data structures used by the binding package.
- * They are only initialized once, no matter how many interps are
- * created.
+ * Initialize the static data structures used by the binding package. They
+ * are only initialized once, no matter how many interps are created.
*/
if (!initialized) {
- Tcl_MutexLock(&bindMutex);
+ Tcl_MutexLock(&bindMutex);
if (!initialized) {
Tcl_HashEntry *hPtr;
ModInfo *modPtr;
EventInfo *eiPtr;
int newEntry;
-
#ifdef REDO_KEYSYM_LOOKUP
KeySymInfo *kPtr;
Tcl_InitHashTable(&keySymTable, TCL_STRING_KEYS);
Tcl_InitHashTable(&nameTable, TCL_ONE_WORD_KEYS);
for (kPtr = keyArray; kPtr->name != NULL; kPtr++) {
- hPtr = Tcl_CreateHashEntry(&keySymTable, kPtr->name, &newEntry);
+ hPtr = Tcl_CreateHashEntry(&keySymTable, kPtr->name, &newEntry);
Tcl_SetHashValue(hPtr, kPtr->value);
hPtr = Tcl_CreateHashEntry(&nameTable, (char *) kPtr->value,
- &newEntry);
+ &newEntry);
if (newEntry) {
Tcl_SetHashValue(hPtr, kPtr->name);
}
@@ -779,18 +755,18 @@ TkBindInit(mainPtr)
Tcl_InitHashTable(&modTable, TCL_STRING_KEYS);
for (modPtr = modArray; modPtr->name != NULL; modPtr++) {
- hPtr = Tcl_CreateHashEntry(&modTable, modPtr->name, &newEntry);
+ hPtr = Tcl_CreateHashEntry(&modTable, modPtr->name, &newEntry);
Tcl_SetHashValue(hPtr, modPtr);
}
-
+
Tcl_InitHashTable(&eventTable, TCL_STRING_KEYS);
for (eiPtr = eventArray; eiPtr->name != NULL; eiPtr++) {
- hPtr = Tcl_CreateHashEntry(&eventTable, eiPtr->name, &newEntry);
+ hPtr = Tcl_CreateHashEntry(&eventTable, eiPtr->name, &newEntry);
Tcl_SetHashValue(hPtr, eiPtr);
}
initialized = 1;
}
- Tcl_MutexUnlock(&bindMutex);
+ Tcl_MutexUnlock(&bindMutex);
}
mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp);
@@ -812,8 +788,8 @@ TkBindInit(mainPtr)
*
* TkBindFree --
*
- * This procedure is called when an application is deleted. It
- * deletes all the structures used by bindings and virtual events.
+ * This function is called when an application is deleted. It deletes all
+ * the structures used by bindings and virtual events.
*
* Results:
* None.
@@ -825,11 +801,11 @@ TkBindInit(mainPtr)
*/
void
-TkBindFree(mainPtr)
- TkMainInfo *mainPtr; /* The newly created application. */
+TkBindFree(
+ TkMainInfo *mainPtr) /* The newly created application. */
{
BindInfo *bindInfoPtr;
-
+
Tk_DeleteBindingTable(mainPtr->bindingTable);
mainPtr->bindingTable = NULL;
@@ -848,8 +824,8 @@ TkBindFree(mainPtr)
* Set up a new domain in which event bindings may be created.
*
* Results:
- * The return value is a token for the new table, which must
- * be passed to procedures like Tk_CreateBinding.
+ * The return value is a token for the new table, which must be passed to
+ * functions like Tk_CreateBinding.
*
* Side effects:
* Memory is allocated for the new table.
@@ -858,9 +834,9 @@ TkBindFree(mainPtr)
*/
Tk_BindingTable
-Tk_CreateBindingTable(interp)
- Tcl_Interp *interp; /* Interpreter to associate with the binding
- * table: commands are executed in this
+Tk_CreateBindingTable(
+ Tcl_Interp *interp) /* Interpreter to associate with the binding
+ * table: commands are executed in this
* interpreter. */
{
BindingTable *bindPtr;
@@ -887,9 +863,8 @@ Tk_CreateBindingTable(interp)
*
* Tk_DeleteBindingTable --
*
- * Destroy a binding table and free up all its memory.
- * The caller should not use bindingTable again after
- * this procedure returns.
+ * Destroy a binding table and free up all its memory. The caller should
+ * not use bindingTable again after this function returns.
*
* Results:
* None.
@@ -901,9 +876,9 @@ Tk_CreateBindingTable(interp)
*/
void
-Tk_DeleteBindingTable(bindingTable)
- Tk_BindingTable bindingTable; /* Token for the binding table to
- * destroy. */
+Tk_DeleteBindingTable(
+ Tk_BindingTable bindingTable)
+ /* Token for the binding table to destroy. */
{
BindingTable *bindPtr = (BindingTable *) bindingTable;
PatSeq *psPtr, *nextPtr;
@@ -911,8 +886,7 @@ Tk_DeleteBindingTable(bindingTable)
Tcl_HashSearch search;
/*
- * Find and delete all of the patterns associated with the binding
- * table.
+ * Find and delete all of the patterns associated with the binding table.
*/
for (hPtr = Tcl_FirstHashEntry(&bindPtr->patternTable, &search);
@@ -931,8 +905,7 @@ Tk_DeleteBindingTable(bindingTable)
}
/*
- * Clean up the rest of the information associated with the
- * binding table.
+ * Clean up the rest of the information associated with the binding table.
*/
Tcl_DeleteHashTable(&bindPtr->patternTable);
@@ -945,41 +918,39 @@ Tk_DeleteBindingTable(bindingTable)
*
* Tk_CreateBinding --
*
- * Add a binding to a binding table, so that future calls to
- * Tk_BindEvent may execute the command in the binding.
+ * Add a binding to a binding table, so that future calls to Tk_BindEvent
+ * may execute the command in the binding.
*
* Results:
- * The return value is 0 if an error occurred while setting
- * up the binding. In this case, an error message will be
- * left in the interp's result. If all went well then the return
- * value is a mask of the event types that must be made
- * available to Tk_BindEvent in order to properly detect when
- * this binding triggers. This value can be used to determine
+ * The return value is 0 if an error occurred while setting up the
+ * binding. In this case, an error message will be left in the interp's
+ * result. If all went well then the return value is a mask of the event
+ * types that must be made available to Tk_BindEvent in order to properly
+ * detect when this binding triggers. This value can be used to determine
* what events to select for in a window, for example.
*
* Side effects:
- * An existing binding on the same event sequence may be
- * replaced.
- * The new binding may cause future calls to Tk_BindEvent to
- * behave differently than they did previously.
+ * An existing binding on the same event sequence may be replaced. The
+ * new binding may cause future calls to Tk_BindEvent to behave
+ * differently than they did previously.
*
*--------------------------------------------------------------
*/
unsigned long
-Tk_CreateBinding(interp, bindingTable, object, eventString, command, append)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_BindingTable bindingTable;
+Tk_CreateBinding(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_BindingTable bindingTable,
/* Table in which to create binding. */
- ClientData object; /* Token for object with which binding is
+ ClientData object, /* Token for object with which binding is
* associated. */
- CONST char *eventString; /* String describing event sequence that
+ const char *eventString, /* String describing event sequence that
* triggers binding. */
- CONST char *command; /* Contains Tcl command to execute when
+ const char *command, /* Contains Tcl command to execute when
* binding triggers. */
- int append; /* 0 means replace any existing binding for
+ int append) /* 0 means replace any existing binding for
* eventString; 1 means append to that
- * binding. If the existing binding is for a
+ * binding. If the existing binding is for a
* callback function and not a Tcl command
* string, the existing binding will always be
* replaced. */
@@ -987,27 +958,30 @@ Tk_CreateBinding(interp, bindingTable, object, eventString, command, append)
BindingTable *bindPtr = (BindingTable *) bindingTable;
PatSeq *psPtr;
unsigned long eventMask;
- char *new, *old;
+ char *newStr, *oldStr;
+ if (!*command) {
+ /* Silently ignore empty scripts -- see SF#3006842 */
+ return 1;
+ }
psPtr = FindSequence(interp, &bindPtr->patternTable, object, eventString,
1, 1, &eventMask);
if (psPtr == NULL) {
return 0;
}
if (psPtr->eventProc == NULL) {
- int new;
+ int isNew;
Tcl_HashEntry *hPtr;
-
+
/*
- * This pattern sequence was just created.
- * Link the pattern into the list associated with the object, so
- * that if the object goes away, these bindings will all
- * automatically be deleted.
+ * This pattern sequence was just created. Link the pattern into the
+ * list associated with the object, so that if the object goes away,
+ * these bindings will all automatically be deleted.
*/
hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object,
- &new);
- if (new) {
+ &isNew);
+ if (isNew) {
psPtr->nextObjPtr = NULL;
} else {
psPtr->nextObjPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
@@ -1025,23 +999,23 @@ Tk_CreateBinding(interp, bindingTable, object, eventString, command, append)
append = 0;
}
- old = (char *) psPtr->clientData;
- if ((append != 0) && (old != NULL)) {
- int length;
+ oldStr = (char *) psPtr->clientData;
+ if ((append != 0) && (oldStr != NULL)) {
+ size_t length;
- length = strlen(old) + strlen(command) + 2;
- new = (char *) ckalloc((unsigned) length);
- sprintf(new, "%s\n%s", old, command);
+ length = strlen(oldStr) + strlen(command) + 2;
+ newStr = (char *) ckalloc((unsigned) length);
+ sprintf(newStr, "%s\n%s", oldStr, command);
} else {
- new = (char *) ckalloc((unsigned) strlen(command) + 1);
- strcpy(new, command);
+ newStr = (char *) ckalloc((unsigned) strlen(command) + 1);
+ strcpy(newStr, command);
}
- if (old != NULL) {
- ckfree(old);
+ if (oldStr != NULL) {
+ ckfree(oldStr);
}
psPtr->eventProc = EvalTclBinding;
psPtr->freeProc = FreeTclBinding;
- psPtr->clientData = (ClientData) new;
+ psPtr->clientData = (ClientData) newStr;
return eventMask;
}
@@ -1051,39 +1025,37 @@ Tk_CreateBinding(interp, bindingTable, object, eventString, command, append)
* TkCreateBindingProcedure --
*
* Add a C binding to a binding table, so that future calls to
- * Tk_BindEvent may callback the procedure in the binding.
+ * Tk_BindEvent may callback the function in the binding.
*
* Results:
- * The return value is 0 if an error occurred while setting
- * up the binding. In this case, an error message will be
- * left in the interp's result. If all went well then the return
- * value is a mask of the event types that must be made
- * available to Tk_BindEvent in order to properly detect when
- * this binding triggers. This value can be used to determine
+
+ * The return value is 0 if an error occurred while setting up the
+ * binding. In this case, an error message will be left in the interp's
+ * result. If all went well then the return value is a mask of the event
+ * types that must be made available to Tk_BindEvent in order to properly
+ * detect when this binding triggers. This value can be used to determine
* what events to select for in a window, for example.
*
* Side effects:
- * Any existing binding on the same event sequence will be
- * replaced.
+ * Any existing binding on the same event sequence will be replaced.
*
*---------------------------------------------------------------------------
*/
unsigned long
-TkCreateBindingProcedure(interp, bindingTable, object, eventString,
- eventProc, freeProc, clientData)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_BindingTable bindingTable;
+TkCreateBindingProcedure(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_BindingTable bindingTable,
/* Table in which to create binding. */
- ClientData object; /* Token for object with which binding is
+ ClientData object, /* Token for object with which binding is
* associated. */
- CONST char *eventString; /* String describing event sequence that
+ const char *eventString, /* String describing event sequence that
* triggers binding. */
- TkBindEvalProc *eventProc; /* Procedure to invoke when binding
- * triggers. Must not be NULL. */
- TkBindFreeProc *freeProc; /* Procedure to invoke when binding is
- * freed. May be NULL for no procedure. */
- ClientData clientData; /* Arbitrary ClientData to pass to eventProc
+ TkBindEvalProc *eventProc, /* Function to invoke when binding triggers.
+ * Must not be NULL. */
+ TkBindFreeProc *freeProc, /* Function to invoke when binding is freed.
+ * May be NULL for no function. */
+ ClientData clientData) /* Arbitrary ClientData to pass to eventProc
* and freeProc. */
{
BindingTable *bindPtr = (BindingTable *) bindingTable;
@@ -1096,26 +1068,24 @@ TkCreateBindingProcedure(interp, bindingTable, object, eventString,
return 0;
}
if (psPtr->eventProc == NULL) {
- int new;
+ int isNew;
Tcl_HashEntry *hPtr;
-
+
/*
- * This pattern sequence was just created.
- * Link the pattern into the list associated with the object, so
- * that if the object goes away, these bindings will all
- * automatically be deleted.
+ * This pattern sequence was just created. Link the pattern into the
+ * list associated with the object, so that if the object goes away,
+ * these bindings will all automatically be deleted.
*/
hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object,
- &new);
- if (new) {
+ &isNew);
+ if (isNew) {
psPtr->nextObjPtr = NULL;
} else {
psPtr->nextObjPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
}
Tcl_SetHashValue(hPtr, psPtr);
} else {
-
/*
* Free existing callback.
*/
@@ -1139,24 +1109,25 @@ TkCreateBindingProcedure(interp, bindingTable, object, eventString,
* Remove an event binding from a binding table.
*
* Results:
- * The result is a standard Tcl return value. If an error
- * occurs then the interp's result will contain an error message.
+ * The result is a standard Tcl return value. If an error occurs then the
+ * interp's result will contain an error message.
*
* Side effects:
- * The binding given by object and eventString is removed
- * from bindingTable.
+ * The binding given by object and eventString is removed from
+ * bindingTable.
*
*--------------------------------------------------------------
*/
int
-Tk_DeleteBinding(interp, bindingTable, object, eventString)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_BindingTable bindingTable; /* Table in which to delete binding. */
- ClientData object; /* Token for object with which binding
- * is associated. */
- CONST char *eventString; /* String describing event sequence
- * that triggers binding. */
+Tk_DeleteBinding(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_BindingTable bindingTable,
+ /* Table in which to delete binding. */
+ ClientData object, /* Token for object with which binding is
+ * associated. */
+ const char *eventString) /* String describing event sequence that
+ * triggers binding. */
{
BindingTable *bindPtr = (BindingTable *) bindingTable;
PatSeq *psPtr, *prevPtr;
@@ -1171,13 +1142,13 @@ Tk_DeleteBinding(interp, bindingTable, object, eventString)
}
/*
- * Unlink the binding from the list for its object, then from the
- * list for its pattern.
+ * Unlink the binding from the list for its object, then from the list for
+ * its pattern.
*/
hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object);
if (hPtr == NULL) {
- panic("Tk_DeleteBinding couldn't find object table entry");
+ Tcl_Panic("Tk_DeleteBinding couldn't find object table entry");
}
prevPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
if (prevPtr == psPtr) {
@@ -1185,7 +1156,7 @@ Tk_DeleteBinding(interp, bindingTable, object, eventString)
} else {
for ( ; ; prevPtr = prevPtr->nextObjPtr) {
if (prevPtr == NULL) {
- panic("Tk_DeleteBinding couldn't find on object list");
+ Tcl_Panic("Tk_DeleteBinding couldn't find on object list");
}
if (prevPtr->nextObjPtr == psPtr) {
prevPtr->nextObjPtr = psPtr->nextObjPtr;
@@ -1203,7 +1174,7 @@ Tk_DeleteBinding(interp, bindingTable, object, eventString)
} else {
for ( ; ; prevPtr = prevPtr->nextSeqPtr) {
if (prevPtr == NULL) {
- panic("Tk_DeleteBinding couldn't find on hash chain");
+ Tcl_Panic("Tk_DeleteBinding couldn't find on hash chain");
}
if (prevPtr->nextSeqPtr == psPtr) {
prevPtr->nextSeqPtr = psPtr->nextSeqPtr;
@@ -1230,13 +1201,12 @@ Tk_DeleteBinding(interp, bindingTable, object, eventString)
* Return the command associated with a given event string.
*
* Results:
- * The return value is a pointer to the command string
- * associated with eventString for object in the domain
- * given by bindingTable. If there is no binding for
- * eventString, or if eventString is improperly formed,
- * then NULL is returned and an error message is left in
- * the interp's result. The return value is semi-static: it
- * will persist until the binding is changed or deleted.
+ * The return value is a pointer to the command string associated with
+ * eventString for object in the domain given by bindingTable. If there
+ * is no binding for eventString, or if eventString is improperly formed,
+ * then NULL is returned and an error message is left in the interp's
+ * result. The return value is semi-static: it will persist until the
+ * binding is changed or deleted.
*
* Side effects:
* None.
@@ -1244,15 +1214,15 @@ Tk_DeleteBinding(interp, bindingTable, object, eventString)
*--------------------------------------------------------------
*/
-CONST char *
-Tk_GetBinding(interp, bindingTable, object, eventString)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_BindingTable bindingTable; /* Table in which to look for
- * binding. */
- ClientData object; /* Token for object with which binding
- * is associated. */
- CONST char *eventString; /* String describing event sequence
- * that triggers binding. */
+const char *
+Tk_GetBinding(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_BindingTable bindingTable,
+ /* Table in which to look for binding. */
+ ClientData object, /* Token for object with which binding is
+ * associated. */
+ const char *eventString) /* String describing event sequence that
+ * triggers binding. */
{
BindingTable *bindPtr = (BindingTable *) bindingTable;
PatSeq *psPtr;
@@ -1264,7 +1234,7 @@ Tk_GetBinding(interp, bindingTable, object, eventString)
return NULL;
}
if (psPtr->eventProc == EvalTclBinding) {
- return (CONST char *) psPtr->clientData;
+ return (const char *) psPtr->clientData;
}
return "";
}
@@ -1274,14 +1244,14 @@ Tk_GetBinding(interp, bindingTable, object, eventString)
*
* Tk_GetAllBindings --
*
- * Return a list of event strings for all the bindings
- * associated with a given object.
+ * Return a list of event strings for all the bindings associated with a
+ * given object.
*
* Results:
- * There is no return value. The interp's result is modified to
- * hold a Tcl list with one entry for each binding associated
- * with object in bindingTable. Each entry in the list
- * contains the event string associated with one binding.
+ * There is no return value. The interp's result is modified to hold a
+ * Tcl list with one entry for each binding associated with object in
+ * bindingTable. Each entry in the list contains the event string
+ * associated with one binding.
*
* Side effects:
* None.
@@ -1290,13 +1260,11 @@ Tk_GetBinding(interp, bindingTable, object, eventString)
*/
void
-Tk_GetAllBindings(interp, bindingTable, object)
- Tcl_Interp *interp; /* Interpreter returning result or
- * error. */
- Tk_BindingTable bindingTable; /* Table in which to look for
- * bindings. */
- ClientData object; /* Token for object. */
-
+Tk_GetAllBindings(
+ Tcl_Interp *interp, /* Interpreter returning result or error. */
+ Tk_BindingTable bindingTable,
+ /* Table in which to look for bindings. */
+ ClientData object) /* Token for object. */
{
BindingTable *bindPtr = (BindingTable *) bindingTable;
PatSeq *psPtr;
@@ -1310,11 +1278,11 @@ Tk_GetAllBindings(interp, bindingTable, object)
Tcl_DStringInit(&ds);
for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr); psPtr != NULL;
psPtr = psPtr->nextObjPtr) {
- /*
- * For each binding, output information about each of the
- * patterns in its sequence.
+ /*
+ * For each binding, output information about each of the patterns in
+ * its sequence.
*/
-
+
Tcl_DStringSetLength(&ds, 0);
GetPatternString(psPtr, &ds);
Tcl_AppendElement(interp, Tcl_DStringValue(&ds));
@@ -1327,12 +1295,11 @@ Tk_GetAllBindings(interp, bindingTable, object)
*
* Tk_DeleteAllBindings --
*
- * Remove all bindings associated with a given object in a
- * given binding table.
+ * Remove all bindings associated with a given object in a given binding
+ * table.
*
* Results:
- * All bindings associated with object are removed from
- * bindingTable.
+ * All bindings associated with object are removed from bindingTable.
*
* Side effects:
* None.
@@ -1341,10 +1308,10 @@ Tk_GetAllBindings(interp, bindingTable, object)
*/
void
-Tk_DeleteAllBindings(bindingTable, object)
- Tk_BindingTable bindingTable; /* Table in which to delete
- * bindings. */
- ClientData object; /* Token for object. */
+Tk_DeleteAllBindings(
+ Tk_BindingTable bindingTable,
+ /* Table in which to delete bindings. */
+ ClientData object) /* Token for object. */
{
BindingTable *bindPtr = (BindingTable *) bindingTable;
PatSeq *psPtr, *prevPtr;
@@ -1357,12 +1324,12 @@ Tk_DeleteAllBindings(bindingTable, object)
}
for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr); psPtr != NULL;
psPtr = nextPtr) {
- nextPtr = psPtr->nextObjPtr;
+ nextPtr = psPtr->nextObjPtr;
/*
- * Be sure to remove each binding from its hash chain in the
- * pattern table. If this is the last pattern in the chain,
- * then delete the hash entry too.
+ * Be sure to remove each binding from its hash chain in the pattern
+ * table. If this is the last pattern in the chain, then delete the
+ * hash entry too.
*/
prevPtr = (PatSeq *) Tcl_GetHashValue(psPtr->hPtr);
@@ -1375,7 +1342,7 @@ Tk_DeleteAllBindings(bindingTable, object)
} else {
for ( ; ; prevPtr = prevPtr->nextSeqPtr) {
if (prevPtr == NULL) {
- panic("Tk_DeleteAllBindings couldn't find on hash chain");
+ Tcl_Panic("Tk_DeleteAllBindings couldn't find on hash chain");
}
if (prevPtr->nextSeqPtr == psPtr) {
prevPtr->nextSeqPtr = psPtr->nextSeqPtr;
@@ -1400,11 +1367,10 @@ Tk_DeleteAllBindings(bindingTable, object)
*
* Tk_BindEvent --
*
- * This procedure is invoked to process an X event. The
- * event is added to those recorded for the binding table.
- * Then each of the objects at *objectPtr is checked in
- * order to see if it has a binding that matches the recent
- * events. If so, the most specific binding is invoked for
+ * This function is invoked to process an X event. The event is added to
+ * those recorded for the binding table. Then each of the objects at
+ * *objectPtr is checked in order to see if it has a binding that matches
+ * the recent events. If so, the most specific binding is invoked for
* each object.
*
* Results:
@@ -1413,32 +1379,32 @@ Tk_DeleteAllBindings(bindingTable, object)
* Side effects:
* Depends on the command associated with the matching binding.
*
- * All Tcl bindings scripts for each object are accumulated before
- * the first binding is evaluated. If the action of a Tcl binding
- * is to change or delete a binding, or delete the window associated
- * with the binding, all the original Tcl binding scripts will still
- * fire. Contrast this with C binding procedures. If a pending C
- * binding (one that hasn't fired yet, but is queued to be fired for
- * this window) is deleted, it will not be called, and if it is
- * changed, then the new binding procedure will be called. If the
- * window itself is deleted, no further C binding procedures will be
- * called for this window. When both Tcl binding scripts and C binding
- * procedures are interleaved, the above rules still apply.
+ * All Tcl bindings scripts for each object are accumulated before the
+ * first binding is evaluated. If the action of a Tcl binding is to
+ * change or delete a binding, or delete the window associated with the
+ * binding, all the original Tcl binding scripts will still fire.
+ * Contrast this with C binding functions. If a pending C binding (one
+ * that hasn't fired yet, but is queued to be fired for this window) is
+ * deleted, it will not be called, and if it is changed, then the new
+ * binding function will be called. If the window itself is deleted, no
+ * further C binding functions will be called for this window. When both
+ * Tcl binding scripts and C binding functions are interleaved, the above
+ * rules still apply.
*
*---------------------------------------------------------------------------
*/
void
-Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
- Tk_BindingTable bindingTable; /* Table in which to look for
- * bindings. */
- XEvent *eventPtr; /* What actually happened. */
- Tk_Window tkwin; /* Window on display where event
- * occurred (needed in order to
- * locate display information). */
- int numObjects; /* Number of objects at *objectPtr. */
- ClientData *objectPtr; /* Array of one or more objects
- * to check for a matching binding. */
+Tk_BindEvent(
+ Tk_BindingTable bindingTable,
+ /* Table in which to look for bindings. */
+ XEvent *eventPtr, /* What actually happened. */
+ Tk_Window tkwin, /* Window on display where event occurred
+ * (needed in order to locate display
+ * information). */
+ int numObjects, /* Number of objects at *objectPtr. */
+ ClientData *objectPtr) /* Array of one or more objects to check for a
+ * matching binding. */
{
BindingTable *bindPtr;
TkDisplay *dispPtr;
@@ -1453,15 +1419,14 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
Tcl_DString scripts, savedResult;
Detail detail;
char *p, *end;
- PendingBinding *pendingPtr;
- PendingBinding staticPending;
- TkWindow *winPtr = (TkWindow *)tkwin;
+ PendingBinding staticPending, *pendingPtr;
+ TkWindow *winPtr = (TkWindow *) tkwin;
PatternTableKey key;
Tk_ClassModalProc *modalProc;
+
/*
- * Ignore events on windows that don't have names: these are windows
- * like wrapper windows that shouldn't be visible to the
- * application.
+ * Ignore events on windows that don't have names: these are windows like
+ * wrapper windows that shouldn't be visible to the application.
*/
if (winPtr->pathName == NULL) {
@@ -1469,21 +1434,20 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
}
/*
- * Ignore the event completely if it is an Enter, Leave, FocusIn,
- * or FocusOut event with detail NotifyInferior. The reason for
- * ignoring these events is that we don't want transitions between
- * a window and its children to visible to bindings on the parent:
- * this would cause problems for mega-widgets, since the internal
- * structure of a mega-widget isn't supposed to be visible to
- * people watching the parent.
+ * Ignore the event completely if it is an Enter, Leave, FocusIn, or
+ * FocusOut event with detail NotifyInferior. The reason for ignoring
+ * these events is that we don't want transitions between a window and its
+ * children to visible to bindings on the parent: this would cause
+ * problems for mega-widgets, since the internal structure of a
+ * mega-widget isn't supposed to be visible to people watching the parent.
*/
- if ((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify)) {
+ if ((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify)) {
if (eventPtr->xcrossing.detail == NotifyInferior) {
return;
}
}
- if ((eventPtr->type == FocusIn) || (eventPtr->type == FocusOut)) {
+ if ((eventPtr->type == FocusIn) || (eventPtr->type == FocusOut)) {
if (eventPtr->xfocus.detail == NotifyInferior) {
return;
}
@@ -1494,20 +1458,19 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
bindInfoPtr = (BindInfo *) winPtr->mainPtr->bindInfo;
/*
- * Add the new event to the ring of saved events for the
- * binding table. Two tricky points:
+ * Add the new event to the ring of saved events for the binding table.
+ * Two tricky points:
*
- * 1. Combine consecutive MotionNotify events. Do this by putting
- * the new event *on top* of the previous event.
+ * 1. Combine consecutive MotionNotify events. Do this by putting the new
+ * event *on top* of the previous event.
* 2. If a modifier key is held down, it auto-repeats to generate
- * continuous KeyPress and KeyRelease events. These can flush
- * the event ring so that valuable information is lost (such
- * as repeated button clicks). To handle this, check for the
- * special case of a modifier KeyPress arriving when the previous
- * two events are a KeyRelease and KeyPress of the same key.
- * If this happens, mark the most recent event (the KeyRelease)
- * invalid and put the new event on top of the event before that
- * (the KeyPress).
+ * continuous KeyPress and KeyRelease events. These can flush the event
+ * ring so that valuable information is lost (such as repeated button
+ * clicks). To handle this, check for the special case of a modifier
+ * KeyPress arriving when the previous two events are a KeyRelease and
+ * KeyPress of the same key. If this happens, mark the most recent
+ * event (the KeyRelease) invalid and put the new event on top of the
+ * event before that (the KeyPress).
*/
if ((eventPtr->type == MotionNotify)
@@ -1517,6 +1480,7 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
*/
} else if (eventPtr->type == KeyPress) {
int i;
+
for (i = 0; ; i++) {
if (i >= dispPtr->numModKeyCodes) {
goto advanceRingPointer;
@@ -1543,14 +1507,15 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
bindPtr->eventRing[bindPtr->curEvent].type = -1;
bindPtr->curEvent = i;
} else {
- advanceRingPointer:
+
+ advanceRingPointer:
bindPtr->curEvent++;
if (bindPtr->curEvent >= EVENT_BUFFER_SIZE) {
bindPtr->curEvent = 0;
}
}
ringPtr = &bindPtr->eventRing[bindPtr->curEvent];
- memcpy((VOID *) ringPtr, (VOID *) eventPtr, sizeof(XEvent));
+ memcpy((void *) ringPtr, (void *) eventPtr, sizeof(XEvent));
detail.clientData = 0;
flags = flagArray[ringPtr->type];
if (flags & KEY) {
@@ -1575,14 +1540,12 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
memset(&key, 0, sizeof(key));
if (ringPtr->type != VirtualEvent) {
- Tcl_HashTable *veptPtr;
+ Tcl_HashTable *veptPtr = &bindInfoPtr->virtualEventTable.patternTable;
Tcl_HashEntry *hPtr;
- veptPtr = &bindInfoPtr->virtualEventTable.patternTable;
-
- key.object = NULL;
- key.type = ringPtr->type;
- key.detail = detail;
+ key.object = NULL;
+ key.type = ringPtr->type;
+ key.detail = detail;
hPtr = Tcl_FindHashEntry(veptPtr, (char *) &key);
if (hPtr != NULL) {
@@ -1593,37 +1556,34 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
key.detail.clientData = 0;
hPtr = Tcl_FindHashEntry(veptPtr, (char *) &key);
if (hPtr != NULL) {
- vMatchNoDetailList = (PatSeq *) Tcl_GetHashValue(hPtr);
+ vMatchNoDetailList = (PatSeq *) Tcl_GetHashValue(hPtr);
}
}
}
/*
- * Loop over all the binding tags, finding the binding script or
- * callback for each one. Append all of the binding scripts, with
- * %-sequences expanded, to "scripts", with null characters separating
- * the scripts for each object. Append all the callbacks to the array
- * of pending callbacks.
+ * Loop over all the binding tags, finding the binding script or callback
+ * for each one. Append all of the binding scripts, with %-sequences
+ * expanded, to "scripts", with null characters separating the scripts for
+ * each object. Append all the callbacks to the array of pending
+ * callbacks.
*/
-
+
pendingPtr = &staticPending;
matchCount = 0;
matchSpace = sizeof(staticPending.matchArray) / sizeof(PatSeq *);
Tcl_DStringInit(&scripts);
for ( ; numObjects > 0; numObjects--, objectPtr++) {
- PatSeq *matchPtr, *sourcePtr;
+ PatSeq *matchPtr = NULL, *sourcePtr = NULL;
Tcl_HashEntry *hPtr;
- matchPtr = NULL;
- sourcePtr = NULL;
-
/*
* Match the new event against those recorded in the pattern table,
- * saving the longest matching pattern. For events with details
- * (button and key events), look for a binding for the specific
- * key or button. First see if the event matches a physical event
- * that the object is interested in, then look for a virtual event.
+ * saving the longest matching pattern. For events with details
+ * (button and key events), look for a binding for the specific key or
+ * button. First see if the event matches a physical event that the
+ * object is interested in, then look for a virtual event.
*/
key.object = *objectPtr;
@@ -1631,7 +1591,7 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
key.detail = detail;
hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key);
if (hPtr != NULL) {
- matchPtr = MatchPatterns(dispPtr, bindPtr,
+ matchPtr = MatchPatterns(dispPtr, bindPtr,
(PatSeq *) Tcl_GetHashValue(hPtr), matchPtr, NULL,
&sourcePtr);
}
@@ -1643,7 +1603,7 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
/*
* If no match was found, look for a binding for all keys or buttons
- * (detail of 0). Again, first match on a virtual event.
+ * (detail of 0). Again, first match on a virtual event.
*/
if ((detail.clientData != 0) && (matchPtr == NULL)) {
@@ -1656,24 +1616,24 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
}
if (vMatchNoDetailList != NULL) {
- matchPtr = MatchPatterns(dispPtr, bindPtr, vMatchNoDetailList,
+ matchPtr = MatchPatterns(dispPtr, bindPtr, vMatchNoDetailList,
matchPtr, objectPtr, &sourcePtr);
}
}
-
+
if (matchPtr != NULL) {
if (sourcePtr->eventProc == NULL) {
- panic("Tk_BindEvent: missing command");
+ Tcl_Panic("Tk_BindEvent: missing command");
}
if (sourcePtr->eventProc == EvalTclBinding) {
ExpandPercents(winPtr, (char *) sourcePtr->clientData,
eventPtr, detail.keySym, &scripts);
} else {
if (matchCount >= matchSpace) {
- PendingBinding *new;
+ PendingBinding *newPtr;
unsigned int oldSize, newSize;
-
+
oldSize = sizeof(staticPending)
- sizeof(staticPending.matchArray)
+ matchSpace * sizeof(PatSeq*);
@@ -1681,20 +1641,21 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
newSize = sizeof(staticPending)
- sizeof(staticPending.matchArray)
+ matchSpace * sizeof(PatSeq*);
- new = (PendingBinding *) ckalloc(newSize);
- memcpy((VOID *) new, (VOID *) pendingPtr, oldSize);
+ newPtr = (PendingBinding *) ckalloc(newSize);
+ memcpy((void *) newPtr, (void *) pendingPtr, oldSize);
if (pendingPtr != &staticPending) {
ckfree((char *) pendingPtr);
}
- pendingPtr = new;
+ pendingPtr = newPtr;
}
sourcePtr->refCount++;
pendingPtr->matchArray[matchCount] = sourcePtr;
matchCount++;
}
+
/*
- * A "" is added to the scripts string to separate the
- * various scripts that should be invoked.
+ * A "" is added to the scripts string to separate the various
+ * scripts that should be invoked.
*/
Tcl_DStringAppend(&scripts, "", 1);
@@ -1705,29 +1666,28 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
}
/*
- * Now go back through and evaluate the binding for each object,
- * in order, dealing with "break" and "continue" exceptions
- * appropriately.
+ * Now go back through and evaluate the binding for each object, in order,
+ * dealing with "break" and "continue" exceptions appropriately.
*
* There are two tricks here:
- * 1. Bindings can be invoked from in the middle of Tcl commands,
- * where the interp's result is significant (for example, a widget
- * might be deleted because of an error in creating it, so the
- * result contains an error message that is eventually going to
- * be returned by the creating command). To preserve the result,
- * we save it in a dynamic string.
- * 2. The binding's action can potentially delete the binding,
- * so bindPtr may not point to anything valid once the action
- * completes. Thus we have to save bindPtr->interp in a
- * local variable in order to restore the result.
+ * 1. Bindings can be invoked from in the middle of Tcl commands, where
+ * the interp's result is significant (for example, a widget might be
+ * deleted because of an error in creating it, so the result contains
+ * an error message that is eventually going to be returned by the
+ * creating command). To preserve the result, we save it in a dynamic
+ * string.
+ * 2. The binding's action can potentially delete the binding, so bindPtr
+ * may not point to anything valid once the action completes. Thus we
+ * have to save bindPtr->interp in a local variable in order to restore
+ * the result.
*/
interp = bindPtr->interp;
Tcl_DStringInit(&savedResult);
/*
- * Save information about the current screen, then invoke a script
- * if the screen has changed.
+ * Save information about the current screen, then invoke a script if the
+ * screen has changed.
*/
Tcl_DStringGetResult(interp, &savedResult);
@@ -1744,9 +1704,8 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
if (matchCount > 0) {
/*
* Remember the list of pending C binding callbacks, so we can mark
- * them as deleted and not call them if the act of evaluating a C
- * or Tcl binding deletes a C binding callback or even the whole
- * window.
+ * them as deleted and not call them if the act of evaluating a C or
+ * Tcl binding deletes a C binding callback or even the whole window.
*/
pendingPtr->nextPtr = bindInfoPtr->pendingList;
@@ -1754,11 +1713,11 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
pendingPtr->deleted = 0;
bindInfoPtr->pendingList = pendingPtr;
}
-
+
/*
- * Save the current value of the TK_DEFER_MODAL flag so we can
- * restore it at the end of the loop. Clear the flag so we can
- * detect any recursive requests for a modal loop.
+ * Save the current value of the TK_DEFER_MODAL flag so we can restore it
+ * at the end of the loop. Clear the flag so we can detect any recursive
+ * requests for a modal loop.
*/
flags = winPtr->flags;
@@ -1769,16 +1728,15 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
i = 0;
/*
- * Be carefule when dereferencing screenPtr or bindInfoPtr. If we
- * evaluate something that destroys ".", bindInfoPtr would have been
- * freed, but we can tell that by first checking to see if
- * winPtr->mainPtr == NULL.
+ * Be carefule when dereferencing screenPtr or bindInfoPtr. If we evaluate
+ * something that destroys ".", bindInfoPtr would have been freed, but we
+ * can tell that by first checking to see if winPtr->mainPtr == NULL.
*/
Tcl_Preserve((ClientData) bindInfoPtr);
while (p < end) {
int code;
-
+
if (!bindInfoPtr->deleted) {
screenPtr->bindingDepth++;
}
@@ -1786,7 +1744,7 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
if (*p == '\0') {
PatSeq *psPtr;
-
+
psPtr = pendingPtr->matchArray[i];
i++;
code = TCL_OK;
@@ -1804,6 +1762,7 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
}
} else {
int len = (int) strlen(p);
+
code = Tcl_EvalEx(interp, p, len, TCL_EVAL_GLOBAL);
p += len;
}
@@ -1815,7 +1774,7 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
if (code != TCL_OK) {
if (code == TCL_CONTINUE) {
/*
- * Do nothing: just go on to the next command.
+ * Do nothing: just go on to the next command.
*/
} else if (code == TCL_BREAK) {
break;
@@ -1829,13 +1788,13 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
if (matchCount > 0 && !pendingPtr->deleted) {
/*
- * Restore the original modal flag value and invoke the modal loop
- * if needed.
+ * Restore the original modal flag value and invoke the modal loop if
+ * needed.
*/
deferModal = winPtr->flags & TK_DEFER_MODAL;
- winPtr->flags = (winPtr->flags & (unsigned int) ~TK_DEFER_MODAL)
- | (flags & TK_DEFER_MODAL);
+ winPtr->flags = (winPtr->flags & (unsigned int) ~TK_DEFER_MODAL)
+ | (flags & TK_DEFER_MODAL);
if (deferModal) {
modalProc = Tk_GetClassProc(winPtr->classProcsPtr, modalProc);
if (modalProc != NULL) {
@@ -1846,12 +1805,10 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
if (!bindInfoPtr->deleted && (screenPtr->bindingDepth != 0)
&& ((oldDispPtr != screenPtr->curDispPtr)
- || (oldScreen != screenPtr->curScreenIndex))) {
-
+ || (oldScreen != screenPtr->curScreenIndex))) {
/*
- * Some other binding script is currently executing, but its
- * screen is no longer current. Change the current display
- * back again.
+ * Some other binding script is currently executing, but its screen is
+ * no longer current. Change the current display back again.
*/
screenPtr->curDispPtr = oldDispPtr;
@@ -1864,10 +1821,10 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
if (matchCount > 0) {
if (!bindInfoPtr->deleted) {
/*
- * Delete the pending list from the list of pending scripts
- * for this window.
+ * Delete the pending list from the list of pending scripts for
+ * this window.
*/
-
+
PendingBinding **curPtrPtr;
for (curPtrPtr = &bindInfoPtr->pendingList; ; ) {
@@ -1890,8 +1847,8 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
*
* TkBindDeadWindow --
*
- * This procedure is invoked when it is determined that a window is
- * dead. It cleans up bind-related information about the window
+ * This function is invoked when it is determined that a window is dead.
+ * It cleans up bind-related information about the window
*
* Results:
* None.
@@ -1901,20 +1858,22 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
*
*---------------------------------------------------------------------------
*/
-
+
void
-TkBindDeadWindow(winPtr)
- TkWindow *winPtr; /* The window that is being deleted. */
+TkBindDeadWindow(
+ TkWindow *winPtr) /* The window that is being deleted. */
{
BindInfo *bindInfoPtr;
PendingBinding *curPtr;
/*
- * Certain special windows like those used for send and clipboard
- * have no mainPtr.
+ * Certain special windows like those used for send and clipboard have no
+ * mainPtr.
*/
- if (winPtr->mainPtr == NULL)
- return;
+
+ if (winPtr->mainPtr == NULL) {
+ return;
+ }
bindInfoPtr = (BindInfo *) winPtr->mainPtr->bindInfo;
curPtr = bindInfoPtr->pendingList;
@@ -1931,58 +1890,59 @@ TkBindDeadWindow(winPtr)
*
* MatchPatterns --
*
- * Given a list of pattern sequences and a list of recent events,
- * return the pattern sequence that best matches the event list,
- * if there is one.
+ * Given a list of pattern sequences and a list of recent events, return
+ * the pattern sequence that best matches the event list, if there is
+ * one.
*
- * This procedure is used in two different ways. In the simplest
- * use, "object" is NULL and psPtr is a list of pattern sequences,
- * each of which corresponds to a binding. In this case, the
- * procedure finds the pattern sequences that match the event list
- * and returns the most specific of those, if there is more than one.
+ * This function is used in two different ways. In the simplest use,
+ * "object" is NULL and psPtr is a list of pattern sequences, each of
+ * which corresponds to a binding. In this case, the function finds the
+ * pattern sequences that match the event list and returns the most
+ * specific of those, if there is more than one.
*
- * In the second case, psPtr is a list of pattern sequences, each
- * of which corresponds to a definition for a virtual binding.
- * In order for one of these sequences to "match", it must match
- * the events (as above) but in addition there must be a binding
- * for its associated virtual event on the current object. The
- * "object" argument indicates which object the binding must be for.
+ * In the second case, psPtr is a list of pattern sequences, each of
+ * which corresponds to a definition for a virtual binding. In order for
+ * one of these sequences to "match", it must match the events (as above)
+ * but in addition there must be a binding for its associated virtual
+ * event on the current object. The "object" argument indicates which
+ * object the binding must be for.
*
* Results:
- * The return value is NULL if bestPtr is NULL and no pattern matches
- * the recent events from bindPtr. Otherwise the return value is
- * the most specific pattern sequence among bestPtr and all those
- * at psPtr that match the event list and object. If a pattern
- * sequence other than bestPtr is returned, then *bestCommandPtr
- * is filled in with a pointer to the command from the best sequence.
+
+ * The return value is NULL if bestPtr is NULL and no pattern matches the
+ * recent events from bindPtr. Otherwise the return value is the most
+ * specific pattern sequence among bestPtr and all those at psPtr that
+ * match the event list and object. If a pattern sequence other than
+ * bestPtr is returned, then *bestCommandPtr is filled in with a pointer
+ * to the command from the best sequence.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
static PatSeq *
-MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
- TkDisplay *dispPtr; /* Display from which the event came. */
- BindingTable *bindPtr; /* Information about binding table, such as
+MatchPatterns(
+ TkDisplay *dispPtr, /* Display from which the event came. */
+ BindingTable *bindPtr, /* Information about binding table, such as
* ring of recent events. */
- PatSeq *psPtr; /* List of pattern sequences. */
- PatSeq *bestPtr; /* The best match seen so far, from a
- * previous call to this procedure. NULL
- * means no prior best match. */
- ClientData *objectPtr; /* If NULL, the sequences at psPtr
- * correspond to "normal" bindings. If
- * non-NULL, the sequences at psPtr correspond
- * to virtual bindings; in order to match each
- * sequence must correspond to a virtual
- * binding for which a binding exists for
- * object in bindPtr. */
- PatSeq **sourcePtrPtr; /* Filled with the pattern sequence that
+ PatSeq *psPtr, /* List of pattern sequences. */
+ PatSeq *bestPtr, /* The best match seen so far, from a previous
+ * call to this function. NULL means no prior
+ * best match. */
+ ClientData *objectPtr, /* If NULL, the sequences at psPtr correspond
+ * to "normal" bindings. If non-NULL, the
+ * sequences at psPtr correspond to virtual
+ * bindings; in order to match each sequence
+ * must correspond to a virtual binding for
+ * which a binding exists for object in
+ * bindPtr. */
+ PatSeq **sourcePtrPtr) /* Filled with the pattern sequence that
* contains the eventProc and clientData
- * associated with the best match. If this
+ * associated with the best match. If this
* differs from the return value, it is the
* virtual event that most closely matched the
- * return value (a physical event). Not
+ * return value (a physical event). Not
* modified unless a result other than bestPtr
* is returned. */
{
@@ -1995,22 +1955,17 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
*/
for ( ; psPtr != NULL; psPtr = psPtr->nextSeqPtr) {
- XEvent *eventPtr;
- Pattern *patPtr;
- Window window;
- Detail *detailPtr;
- int patCount, ringCount, flags, state;
- int modMask;
+ XEvent *eventPtr = &bindPtr->eventRing[bindPtr->curEvent];
+ Detail *detailPtr = &bindPtr->detailRing[bindPtr->curEvent];
+ Pattern *patPtr = psPtr->pats;
+ Window window = eventPtr->xany.window;
+ int patCount, ringCount, flags, state, modMask, i;
/*
- * Iterate over all the patterns in a sequence to be
- * sure that they all match.
+ * Iterate over all the patterns in a sequence to be sure that they
+ * all match.
*/
- eventPtr = &bindPtr->eventRing[bindPtr->curEvent];
- detailPtr = &bindPtr->detailRing[bindPtr->curEvent];
- window = eventPtr->xany.window;
- patPtr = psPtr->pats;
patCount = psPtr->numPats;
ringCount = EVENT_BUFFER_SIZE;
while (patCount > 0) {
@@ -2019,21 +1974,21 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
}
if (eventPtr->xany.type != patPtr->eventType) {
/*
- * Most of the event types are considered superfluous
- * in that they are ignored if they occur in the middle
- * of a pattern sequence and have mismatching types. The
- * only ones that cannot be ignored are ButtonPress and
- * ButtonRelease events (if the next event in the pattern
- * is a KeyPress or KeyRelease) and KeyPress and KeyRelease
- * events (if the next pattern event is a ButtonPress or
- * ButtonRelease). Here are some tricky cases to consider:
+ * Most of the event types are considered superfluous in that
+ * they are ignored if they occur in the middle of a pattern
+ * sequence and have mismatching types. The only ones that
+ * cannot be ignored are ButtonPress and ButtonRelease events
+ * (if the next event in the pattern is a KeyPress or
+ * KeyRelease) and KeyPress and KeyRelease events (if the next
+ * pattern event is a ButtonPress or ButtonRelease). Here are
+ * some tricky cases to consider:
* 1. Double-Button or Double-Key events.
* 2. Double-ButtonRelease or Double-KeyRelease events.
- * 3. The arrival of various events like Enter and Leave
- * and FocusIn and GraphicsExpose between two button
- * presses or key presses.
- * 4. Modifier keys like Shift and Control shouldn't
- * generate conflicts with button events.
+ * 3. The arrival of various events like Enter and Leave and
+ * FocusIn and GraphicsExpose between two button presses or
+ * key presses.
+ * 4. Modifier keys like Shift and Control shouldn't generate
+ * conflicts with button events.
*/
if ((patPtr->eventType == KeyPress)
@@ -2046,8 +2001,6 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
|| (patPtr->eventType == ButtonRelease)) {
if ((eventPtr->xany.type == KeyPress)
|| (eventPtr->xany.type == KeyRelease)) {
- int i;
-
/*
* Ignore key events if they are modifier keys.
*/
@@ -2058,6 +2011,7 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
/*
* This key is a modifier key, so ignore it.
*/
+
goto nextEvent;
}
}
@@ -2067,32 +2021,28 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
goto nextEvent;
}
if (eventPtr->xany.type == CreateNotify
- && eventPtr->xcreatewindow.parent != window) {
+ && eventPtr->xcreatewindow.parent != window) {
goto nextSequence;
- } else
- if (eventPtr->xany.window != window) {
+ } else if (eventPtr->xany.window != window) {
goto nextSequence;
}
/*
- * Note: it's important for the keysym check to go before
- * the modifier check, so we can ignore unwanted modifier
- * keys before choking on the modifier check.
+ * Note: it's important for the keysym check to go before the
+ * modifier check, so we can ignore unwanted modifier keys before
+ * choking on the modifier check.
*/
if ((patPtr->detail.clientData != 0)
&& (patPtr->detail.clientData != detailPtr->clientData)) {
/*
- * The detail appears not to match. However, if the event
- * is a KeyPress for a modifier key then just ignore the
- * event. Otherwise event sequences like "aD" never match
- * because the shift key goes down between the "a" and the
- * "D".
+ * The detail appears not to match. However, if the event is a
+ * KeyPress for a modifier key then just ignore the event.
+ * Otherwise event sequences like "aD" never match because the
+ * shift key goes down between the "a" and the "D".
*/
if (eventPtr->xany.type == KeyPress) {
- int i;
-
for (i = 0; i < dispPtr->numModKeyCodes; i++) {
if (dispPtr->modKeyCodes[i] == eventPtr->xkey.keycode) {
goto nextEvent;
@@ -2102,7 +2052,7 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
goto nextSequence;
}
flags = flagArray[eventPtr->type];
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
+ if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
state = eventPtr->xkey.state;
} else if (flags & CROSSING) {
state = eventPtr->xcrossing.state;
@@ -2130,10 +2080,9 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
}
}
if (psPtr->flags & PAT_NEARBY) {
- XEvent *firstPtr;
+ XEvent *firstPtr = &bindPtr->eventRing[bindPtr->curEvent];
int timeDiff;
- firstPtr = &bindPtr->eventRing[bindPtr->curEvent];
timeDiff = (Time) firstPtr->xkey.time - eventPtr->xkey.time;
if ((firstPtr->xkey.x_root
< (eventPtr->xkey.x_root - NEARBY_PIXELS))
@@ -2149,7 +2098,7 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
}
patPtr++;
patCount--;
- nextEvent:
+ nextEvent:
if (eventPtr == bindPtr->eventRing) {
eventPtr = &bindPtr->eventRing[EVENT_BUFFER_SIZE-1];
detailPtr = &bindPtr->detailRing[EVENT_BUFFER_SIZE-1];
@@ -2169,9 +2118,9 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
PatternTableKey key;
/*
- * The sequence matches the physical constraints.
- * Is this object interested in any of the virtual events
- * that correspond to this sequence?
+ * The sequence matches the physical constraints. Is this object
+ * interested in any of the virtual events that correspond to this
+ * sequence?
*/
voPtr = psPtr->voPtr;
@@ -2182,26 +2131,24 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
key.detail.clientData = 0;
for (iVirt = 0; iVirt < voPtr->numOwners; iVirt++) {
- Tcl_HashEntry *hPtr = voPtr->owners[iVirt];
+ Tcl_HashEntry *hPtr = voPtr->owners[iVirt];
- key.detail.name = (Tk_Uid) Tcl_GetHashKey(hPtr->tablePtr,
+ key.detail.name = (Tk_Uid) Tcl_GetHashKey(hPtr->tablePtr,
hPtr);
hPtr = Tcl_FindHashEntry(&bindPtr->patternTable,
(char *) &key);
if (hPtr != NULL) {
-
/*
* This tag is interested in this virtual event and its
* corresponding physical event is a good match with the
* virtual event's definition.
*/
- PatSeq *virtMatchPtr;
+ PatSeq *virtMatchPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
- virtMatchPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
if ((virtMatchPtr->numPats != 1)
|| (virtMatchPtr->nextSeqPtr != NULL)) {
- panic("MatchPattern: badly constructed virtual event");
+ Tcl_Panic("MatchPattern: badly constructed virtual event");
}
sourcePtr = virtMatchPtr;
goto match;
@@ -2212,19 +2159,19 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
* The physical event matches a virtual event's definition, but
* the tag isn't interested in it.
*/
+
goto nextSequence;
}
- match:
+ match:
/*
- * This sequence matches. If we've already got another match,
- * pick whichever is most specific. Detail is most important,
- * then needMods.
+ * This sequence matches. If we've already got another match, pick
+ * whichever is most specific. Detail is most important, then
+ * needMods.
*/
if (bestPtr != NULL) {
Pattern *patPtr2;
- int i;
if (matchPtr->numPats != bestPtr->numPats) {
if (bestPtr->numPats > matchPtr->numPats) {
@@ -2252,51 +2199,49 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
}
}
}
+
/*
* Tie goes to current best pattern.
*
- * (1) For virtual vs. virtual, the least recently defined
- * virtual wins, because virtuals are examined in order of
- * definition. This order is _not_ guaranteed in the
- * documentation.
+ * (1) For virtual vs. virtual, the least recently defined virtual
+ * wins, because virtuals are examined in order of definition.
+ * This order is _not_ guaranteed in the documentation.
*
- * (2) For virtual vs. physical, the physical wins because all
- * the physicals are examined before the virtuals. This order
- * is guaranteed in the documentation.
+ * (2) For virtual vs. physical, the physical wins because all the
+ * physicals are examined before the virtuals. This order is
+ * guaranteed in the documentation.
*
* (3) For physical vs. physical pattern, the most recently
* defined physical wins, because physicals are examined in
- * reverse order of definition. This order is guaranteed in
- * the documentation.
+ * reverse order of definition. This order is guaranteed in the
+ * documentation.
*/
- goto nextSequence;
+ goto nextSequence;
}
- newBest:
+ newBest:
bestPtr = matchPtr;
bestSourcePtr = sourcePtr;
- nextSequence:
+ nextSequence:
continue;
}
*sourcePtrPtr = bestSourcePtr;
return bestPtr;
}
-
/*
*--------------------------------------------------------------
*
* ExpandPercents --
*
- * Given a command and an event, produce a new command
- * by replacing % constructs in the original command
- * with information from the X event.
+ * Given a command and an event, produce a new command by replacing %
+ * constructs in the original command with information from the X event.
*
* Results:
- * The new expanded command is appended to the dynamic string
- * given by dsPtr.
+ * The new expanded command is appended to the dynamic string given by
+ * dsPtr.
*
* Side effects:
* None.
@@ -2305,23 +2250,23 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
*/
static void
-ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
- TkWindow *winPtr; /* Window where event occurred: needed to
- * get input context. */
- CONST char *before; /* Command containing percent expressions
- * to be replaced. */
- XEvent *eventPtr; /* X event containing information to be
- * used in % replacements. */
- KeySym keySym; /* KeySym: only relevant for KeyPress and
+ExpandPercents(
+ TkWindow *winPtr, /* Window where event occurred: needed to get
+ * input context. */
+ const char *before, /* Command containing percent expressions to
+ * be replaced. */
+ XEvent *eventPtr, /* X event containing information to be used
+ * in % replacements. */
+ KeySym keySym, /* KeySym: only relevant for KeyPress and
* KeyRelease events). */
- Tcl_DString *dsPtr; /* Dynamic string in which to append new
+ Tcl_DString *dsPtr) /* Dynamic string in which to append new
* command. */
{
int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl
* list element. */
int number, flags, length;
#define NUM_SIZE 40
- CONST char *string;
+ const char *string;
Tcl_DString buf;
char numStorage[NUM_SIZE+1];
@@ -2332,10 +2277,11 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
} else {
flags = 0;
}
+
while (1) {
/*
- * Find everything up to the next % character and append it
- * to the result string.
+ * Find everything up to the next % character and append it to the
+ * result string.
*/
for (string = before; (*string != 0) && (*string != '%'); string++) {
@@ -2350,323 +2296,333 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
}
/*
- * There's a percent sequence here. Process it.
+ * There's a percent sequence here. Process it.
*/
number = 0;
string = "??";
switch (before[1]) {
- case '#':
- number = eventPtr->xany.serial;
- goto doNumber;
- case 'a':
- if (flags & CONFIG) {
- TkpPrintWindowId(numStorage, eventPtr->xconfigure.above);
- string = numStorage;
- }
- goto doString;
- case 'b':
- if (flags & BUTTON) {
- number = eventPtr->xbutton.button;
- goto doNumber;
- }
- goto doString;
- case 'c':
- if (flags & EXPOSE) {
- number = eventPtr->xexpose.count;
- goto doNumber;
- }
- goto doString;
- case 'd':
- if (flags & (CROSSING|FOCUS)) {
- if (flags & FOCUS) {
- number = eventPtr->xfocus.detail;
- } else {
- number = eventPtr->xcrossing.detail;
- }
- string = TkFindStateString(notifyDetail, number);
- } else if (flags & CONFIGREQ) {
- if (eventPtr->xconfigurerequest.value_mask & CWStackMode) {
- string = TkFindStateString(configureRequestDetail,
- eventPtr->xconfigurerequest.detail);
- } else {
- string = "";
- }
- }
- goto doString;
- case 'f':
- if (flags & CROSSING) {
- number = eventPtr->xcrossing.focus;
- goto doNumber;
- }
- goto doString;
- case 'h':
- if (flags & EXPOSE) {
- number = eventPtr->xexpose.height;
- } else if (flags & (CONFIG)) {
- number = eventPtr->xconfigure.height;
- } else if (flags & CREATE) {
- number = eventPtr->xcreatewindow.height;
- } else if (flags & CONFIGREQ) {
- number = eventPtr->xconfigurerequest.height;
- } else if (flags & RESIZEREQ) {
- number = eventPtr->xresizerequest.height;
- } else {
- goto doString;
- }
- goto doNumber;
- case 'i':
- if (flags & CREATE) {
- TkpPrintWindowId(numStorage, eventPtr->xcreatewindow.window);
- } else if (flags & CONFIGREQ) {
- TkpPrintWindowId(numStorage, eventPtr->xconfigurerequest.window);
- } else if (flags & MAPREQ) {
- TkpPrintWindowId(numStorage, eventPtr->xmaprequest.window);
- } else {
- TkpPrintWindowId(numStorage, eventPtr->xany.window);
- }
+ case '#':
+ number = eventPtr->xany.serial;
+ goto doNumber;
+ case 'a':
+ if (flags & CONFIG) {
+ TkpPrintWindowId(numStorage, eventPtr->xconfigure.above);
string = numStorage;
- goto doString;
- case 'k':
- if (flags & KEY) {
- number = eventPtr->xkey.keycode;
- goto doNumber;
- }
- goto doString;
- case 'm':
- if (flags & CROSSING) {
- number = eventPtr->xcrossing.mode;
- string = TkFindStateString(notifyMode, number);
- } else if (flags & FOCUS) {
- number = eventPtr->xfocus.mode;
- string = TkFindStateString(notifyMode, number);
- }
- goto doString;
- case 'o':
- if (flags & CREATE) {
- number = eventPtr->xcreatewindow.override_redirect;
- } else if (flags & MAP) {
- number = eventPtr->xmap.override_redirect;
- } else if (flags & REPARENT) {
- number = eventPtr->xreparent.override_redirect;
- } else if (flags & CONFIG) {
- number = eventPtr->xconfigure.override_redirect;
- } else {
- goto doString;
- }
- goto doNumber;
- case 'p':
- if (flags & CIRC) {
- string = TkFindStateString(circPlace, eventPtr->xcirculate.place);
- } else if (flags & CIRCREQ) {
- string = TkFindStateString(circPlace, eventPtr->xcirculaterequest.place);
- }
- goto doString;
- case 's':
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- number = eventPtr->xkey.state;
- } else if (flags & CROSSING) {
- number = eventPtr->xcrossing.state;
- } else if (flags & PROP) {
- string = TkFindStateString(propNotify,
- eventPtr->xproperty.state);
- goto doString;
- } else if (flags & VISIBILITY) {
- string = TkFindStateString(visNotify,
- eventPtr->xvisibility.state);
- goto doString;
- } else {
- goto doString;
- }
- goto doNumber;
- case 't':
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- number = (int) eventPtr->xkey.time;
- } else if (flags & CROSSING) {
- number = (int) eventPtr->xcrossing.time;
- } else if (flags & PROP) {
- number = (int) eventPtr->xproperty.time;
- } else {
- goto doString;
- }
+ }
+ goto doString;
+ case 'b':
+ if (flags & BUTTON) {
+ number = eventPtr->xbutton.button;
goto doNumber;
- case 'v':
- number = eventPtr->xconfigurerequest.value_mask;
+ }
+ goto doString;
+ case 'c':
+ if (flags & EXPOSE) {
+ number = eventPtr->xexpose.count;
goto doNumber;
- case 'w':
- if (flags & EXPOSE) {
- number = eventPtr->xexpose.width;
- } else if (flags & CONFIG) {
- number = eventPtr->xconfigure.width;
- } else if (flags & CREATE) {
- number = eventPtr->xcreatewindow.width;
- } else if (flags & CONFIGREQ) {
- number = eventPtr->xconfigurerequest.width;
- } else if (flags & RESIZEREQ) {
- number = eventPtr->xresizerequest.width;
+ }
+ goto doString;
+ case 'd':
+ if (flags & (CROSSING|FOCUS)) {
+ if (flags & FOCUS) {
+ number = eventPtr->xfocus.detail;
} else {
- goto doString;
+ number = eventPtr->xcrossing.detail;
}
- goto doNumber;
- case 'x':
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- number = eventPtr->xkey.x;
- } else if (flags & CROSSING) {
- number = eventPtr->xcrossing.x;
- } else if (flags & EXPOSE) {
- number = eventPtr->xexpose.x;
- } else if (flags & (CREATE|CONFIG|GRAVITY)) {
- number = eventPtr->xcreatewindow.x;
- } else if (flags & REPARENT) {
- number = eventPtr->xreparent.x;
- } else if (flags & CREATE) {
- number = eventPtr->xcreatewindow.x;
- } else if (flags & CONFIGREQ) {
- number = eventPtr->xconfigurerequest.x;
+ string = TkFindStateString(notifyDetail, number);
+ } else if (flags & CONFIGREQ) {
+ if (eventPtr->xconfigurerequest.value_mask & CWStackMode) {
+ string = TkFindStateString(configureRequestDetail,
+ eventPtr->xconfigurerequest.detail);
} else {
- goto doString;
+ string = "";
}
- goto doNumber;
- case 'y':
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- number = eventPtr->xkey.y;
- } else if (flags & EXPOSE) {
- number = eventPtr->xexpose.y;
- } else if (flags & (CREATE|CONFIG|GRAVITY)) {
- number = eventPtr->xcreatewindow.y;
- } else if (flags & REPARENT) {
- number = eventPtr->xreparent.y;
- } else if (flags & CROSSING) {
- number = eventPtr->xcrossing.y;
- } else if (flags & CREATE) {
- number = eventPtr->xcreatewindow.y;
- } else if (flags & CONFIGREQ) {
- number = eventPtr->xconfigurerequest.y;
+ } else if (flags & VIRTUAL) {
+ XVirtualEvent *vePtr = (XVirtualEvent *) eventPtr;
+
+ if (vePtr->user_data != NULL) {
+ string = Tcl_GetString(vePtr->user_data);
} else {
- goto doString;
+ string = "";
}
+ }
+ goto doString;
+ case 'f':
+ if (flags & CROSSING) {
+ number = eventPtr->xcrossing.focus;
goto doNumber;
- case 'A':
- if (flags & KEY) {
- Tcl_DStringFree(&buf);
- string = TkpGetString(winPtr, eventPtr, &buf);
- }
+ }
+ goto doString;
+ case 'h':
+ if (flags & EXPOSE) {
+ number = eventPtr->xexpose.height;
+ } else if (flags & CONFIG) {
+ number = eventPtr->xconfigure.height;
+ } else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.height;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.height;
+ } else if (flags & RESIZEREQ) {
+ number = eventPtr->xresizerequest.height;
+ } else {
goto doString;
- case 'B':
- if (flags & CREATE) {
- number = eventPtr->xcreatewindow.border_width;
- } else if (flags & CONFIGREQ) {
- number = eventPtr->xconfigurerequest.border_width;
- } else if (flags & CONFIG) {
- number = eventPtr->xconfigure.border_width;
- } else {
- goto doString;
- }
+ }
+ goto doNumber;
+ case 'i':
+ if (flags & CREATE) {
+ TkpPrintWindowId(numStorage, eventPtr->xcreatewindow.window);
+ } else if (flags & CONFIGREQ) {
+ TkpPrintWindowId(numStorage,
+ eventPtr->xconfigurerequest.window);
+ } else if (flags & MAPREQ) {
+ TkpPrintWindowId(numStorage, eventPtr->xmaprequest.window);
+ } else {
+ TkpPrintWindowId(numStorage, eventPtr->xany.window);
+ }
+ string = numStorage;
+ goto doString;
+ case 'k':
+ if (flags & KEY) {
+ number = eventPtr->xkey.keycode;
goto doNumber;
- case 'D':
- /*
- * This is used only by the MouseWheel event.
- */
- if (flags & KEY) {
- number = eventPtr->xkey.keycode;
- goto doNumber;
- }
+ }
+ goto doString;
+ case 'm':
+ if (flags & CROSSING) {
+ number = eventPtr->xcrossing.mode;
+ string = TkFindStateString(notifyMode, number);
+ } else if (flags & FOCUS) {
+ number = eventPtr->xfocus.mode;
+ string = TkFindStateString(notifyMode, number);
+ }
+ goto doString;
+ case 'o':
+ if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.override_redirect;
+ } else if (flags & MAP) {
+ number = eventPtr->xmap.override_redirect;
+ } else if (flags & REPARENT) {
+ number = eventPtr->xreparent.override_redirect;
+ } else if (flags & CONFIG) {
+ number = eventPtr->xconfigure.override_redirect;
+ } else {
goto doString;
- case 'E':
- number = (int) eventPtr->xany.send_event;
+ }
+ goto doNumber;
+ case 'p':
+ if (flags & CIRC) {
+ string = TkFindStateString(circPlace,
+ eventPtr->xcirculate.place);
+ } else if (flags & CIRCREQ) {
+ string = TkFindStateString(circPlace,
+ eventPtr->xcirculaterequest.place);
+ }
+ goto doString;
+ case 's':
+ if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ number = eventPtr->xkey.state;
goto doNumber;
- case 'K':
- if (flags & KEY) {
- char *name;
-
- name = TkKeysymToString(keySym);
- if (name != NULL) {
- string = name;
- }
- }
+ } else if (flags & CROSSING) {
+ number = eventPtr->xcrossing.state;
+ goto doNumber;
+ } else if (flags & PROP) {
+ string = TkFindStateString(propNotify,
+ eventPtr->xproperty.state);
+ } else if (flags & VISIBILITY) {
+ string = TkFindStateString(visNotify,
+ eventPtr->xvisibility.state);
+ }
+ goto doString;
+ case 't':
+ if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ number = (int) eventPtr->xkey.time;
+ } else if (flags & CROSSING) {
+ number = (int) eventPtr->xcrossing.time;
+ } else if (flags & PROP) {
+ number = (int) eventPtr->xproperty.time;
+ } else {
goto doString;
- case 'N':
- if (flags & KEY) {
- number = (int) keySym;
- goto doNumber;
- }
+ }
+ goto doNumber;
+ case 'v':
+ number = eventPtr->xconfigurerequest.value_mask;
+ goto doNumber;
+ case 'w':
+ if (flags & EXPOSE) {
+ number = eventPtr->xexpose.width;
+ } else if (flags & CONFIG) {
+ number = eventPtr->xconfigure.width;
+ } else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.width;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.width;
+ } else if (flags & RESIZEREQ) {
+ number = eventPtr->xresizerequest.width;
+ } else {
goto doString;
- case 'P':
- if (flags & PROP) {
- string = Tk_GetAtomName((Tk_Window) winPtr, eventPtr->xproperty.atom);
- }
+ }
+ goto doNumber;
+ case 'x':
+ if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ number = eventPtr->xkey.x;
+ } else if (flags & CROSSING) {
+ number = eventPtr->xcrossing.x;
+ } else if (flags & EXPOSE) {
+ number = eventPtr->xexpose.x;
+ } else if (flags & (CREATE|CONFIG|GRAVITY)) {
+ number = eventPtr->xcreatewindow.x;
+ } else if (flags & REPARENT) {
+ number = eventPtr->xreparent.x;
+ } else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.x;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.x;
+ } else {
goto doString;
- case 'R':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
- TkpPrintWindowId(numStorage, eventPtr->xkey.root);
- string = numStorage;
- }
+ }
+ goto doNumber;
+ case 'y':
+ if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ number = eventPtr->xkey.y;
+ } else if (flags & EXPOSE) {
+ number = eventPtr->xexpose.y;
+ } else if (flags & (CREATE|CONFIG|GRAVITY)) {
+ number = eventPtr->xcreatewindow.y;
+ } else if (flags & REPARENT) {
+ number = eventPtr->xreparent.y;
+ } else if (flags & CROSSING) {
+ number = eventPtr->xcrossing.y;
+ } else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.y;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.y;
+ } else {
goto doString;
- case 'S':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
- TkpPrintWindowId(numStorage, eventPtr->xkey.subwindow);
- string = numStorage;
- }
+ }
+ goto doNumber;
+ case 'A':
+ if (flags & KEY) {
+ Tcl_DStringFree(&buf);
+ string = TkpGetString(winPtr, eventPtr, &buf);
+ }
+ goto doString;
+ case 'B':
+ if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.border_width;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.border_width;
+ } else if (flags & CONFIG) {
+ number = eventPtr->xconfigure.border_width;
+ } else {
goto doString;
- case 'T':
- number = eventPtr->type;
+ }
+ goto doNumber;
+ case 'D':
+ /*
+ * This is used only by the MouseWheel event.
+ */
+
+ if (flags & KEY) {
+ number = eventPtr->xkey.keycode;
goto doNumber;
- case 'W': {
+ }
+ goto doString;
+ case 'E':
+ number = (int) eventPtr->xany.send_event;
+ goto doNumber;
+ case 'K':
+ if (flags & KEY) {
+ char *name = TkKeysymToString(keySym);
+
+ if (name != NULL) {
+ string = name;
+ }
+ }
+ goto doString;
+ case 'N':
+ if (flags & KEY) {
+ number = (int) keySym;
+ goto doNumber;
+ }
+ goto doString;
+ case 'P':
+ if (flags & PROP) {
+ string = Tk_GetAtomName((Tk_Window) winPtr,
+ eventPtr->xproperty.atom);
+ }
+ goto doString;
+ case 'R':
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ TkpPrintWindowId(numStorage, eventPtr->xkey.root);
+ string = numStorage;
+ }
+ goto doString;
+ case 'S':
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ TkpPrintWindowId(numStorage, eventPtr->xkey.subwindow);
+ string = numStorage;
+ }
+ goto doString;
+ case 'T':
+ number = eventPtr->type;
+ goto doNumber;
+ case 'W': {
+ Tk_Window tkwin;
+
+ tkwin = Tk_IdToWindow(eventPtr->xany.display,
+ eventPtr->xany.window);
+ if (tkwin != NULL) {
+ string = Tk_PathName(tkwin);
+ } else {
+ string = "??";
+ }
+ goto doString;
+ }
+ case 'X':
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
Tk_Window tkwin;
+ int x, y;
+ int width, height;
+ number = eventPtr->xkey.x_root;
tkwin = Tk_IdToWindow(eventPtr->xany.display,
eventPtr->xany.window);
if (tkwin != NULL) {
- string = Tk_PathName(tkwin);
- } else {
- string = "??";
+ Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
+ number -= x;
}
- goto doString;
+ goto doNumber;
}
- case 'X':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
- Tk_Window tkwin;
- int x, y;
- int width, height;
-
- number = eventPtr->xkey.x_root;
- tkwin = Tk_IdToWindow(eventPtr->xany.display,
- eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= x;
- }
- goto doNumber;
- }
- goto doString;
- case 'Y':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
- Tk_Window tkwin;
- int x, y;
- int width, height;
-
- number = eventPtr->xkey.y_root;
- tkwin = Tk_IdToWindow(eventPtr->xany.display,
- eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= y;
- }
- goto doNumber;
+ goto doString;
+ case 'Y':
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ Tk_Window tkwin;
+ int x, y;
+ int width, height;
+
+ number = eventPtr->xkey.y_root;
+ tkwin = Tk_IdToWindow(eventPtr->xany.display,
+ eventPtr->xany.window);
+ if (tkwin != NULL) {
+ Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
+ number -= y;
}
- goto doString;
- default:
- numStorage[0] = before[1];
- numStorage[1] = '\0';
- string = numStorage;
- goto doString;
+ goto doNumber;
+ }
+ goto doString;
+ default:
+ numStorage[0] = before[1];
+ numStorage[1] = '\0';
+ string = numStorage;
+ goto doString;
}
- doNumber:
+ doNumber:
sprintf(numStorage, "%d", number);
string = numStorage;
- doString:
+ doString:
spaceNeeded = Tcl_ScanElement(string, &cvtFlags);
length = Tcl_DStringLength(dsPtr);
Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
@@ -2684,28 +2640,27 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
*
* ChangeScreen --
*
- * This procedure is invoked whenever the current screen changes
- * in an application. It invokes a Tcl procedure named
- * "tk::ScreenChanged", passing it the screen name as argument.
- * tk::ScreenChanged does things like making the tk::Priv variable
- * point to an array for the current display.
+ * This function is invoked whenever the current screen changes in an
+ * application. It invokes a Tcl command named "tk::ScreenChanged",
+ * passing it the screen name as argument. tk::ScreenChanged does things
+ * like making the tk::Priv variable point to an array for the current
+ * display.
*
* Results:
* None.
*
* Side effects:
- * Depends on what tk::ScreenChanged does. If an error occurs
- * them bgerror will be invoked.
+ * Depends on what tk::ScreenChanged does. If an error occurs then
+ * bgerror will be invoked.
*
*----------------------------------------------------------------------
*/
static void
-ChangeScreen(interp, dispName, screenIndex)
- Tcl_Interp *interp; /* Interpreter in which to invoke
- * command. */
- char *dispName; /* Name of new display. */
- int screenIndex; /* Index of new screen. */
+ChangeScreen(
+ Tcl_Interp *interp, /* Interpreter in which to invoke command. */
+ char *dispName, /* Name of new display. */
+ int screenIndex) /* Index of new screen. */
{
Tcl_DString cmd;
int code;
@@ -2718,21 +2673,21 @@ ChangeScreen(interp, dispName, screenIndex)
Tcl_DStringAppend(&cmd, screen, -1);
code = Tcl_EvalEx(interp, Tcl_DStringValue(&cmd), Tcl_DStringLength(&cmd),
TCL_EVAL_GLOBAL);
+ Tcl_DStringFree(&cmd);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (changing screen in event binding)");
Tcl_BackgroundError(interp);
}
}
-
/*
*----------------------------------------------------------------------
*
* Tk_EventCmd --
*
- * This procedure is invoked to process the "event" Tcl command.
- * It is used to define and generate events.
+ * This function is invoked to process the "event" Tcl command. It is
+ * used to define and generate events.
*
* Results:
* A standard Tcl result.
@@ -2744,17 +2699,17 @@ ChangeScreen(interp, dispName, screenIndex)
*/
int
-Tk_EventObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_EventObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int index;
Tk_Window tkwin;
VirtualEventTable *vetPtr;
TkBindInfo bindInfo;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"add", "delete", "generate", "info",
NULL
};
@@ -2776,64 +2731,61 @@ Tk_EventObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case EVENT_ADD: {
- int i;
- char *name, *event;
-
- if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "virtual sequence ?sequence ...?");
- return TCL_ERROR;
- }
- name = Tcl_GetStringFromObj(objv[2], NULL);
- for (i = 3; i < objc; i++) {
- event = Tcl_GetStringFromObj(objv[i], NULL);
- if (CreateVirtualEvent(interp, vetPtr, name, event) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- break;
+ case EVENT_ADD: {
+ int i;
+ char *name, *event;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "virtual sequence ?sequence ...?");
+ return TCL_ERROR;
}
- case EVENT_DELETE: {
- int i;
- char *name, *event;
-
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "virtual ?sequence sequence ...?");
+ name = Tcl_GetString(objv[2]);
+ for (i = 3; i < objc; i++) {
+ event = Tcl_GetString(objv[i]);
+ if (CreateVirtualEvent(interp, vetPtr, name, event) != TCL_OK) {
return TCL_ERROR;
}
- name = Tcl_GetStringFromObj(objv[2], NULL);
- if (objc == 3) {
- return DeleteVirtualEvent(interp, vetPtr, name, NULL);
- }
- for (i = 3; i < objc; i++) {
- event = Tcl_GetStringFromObj(objv[i], NULL);
- if (DeleteVirtualEvent(interp, vetPtr, name, event) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- break;
}
- case EVENT_GENERATE: {
- if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "window event ?options?");
- return TCL_ERROR;
- }
- return HandleEventGenerate(interp, tkwin, objc - 2, objv + 2);
+ break;
+ }
+ case EVENT_DELETE: {
+ int i;
+ char *name, *event;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "virtual ?sequence sequence ...?");
+ return TCL_ERROR;
}
- case EVENT_INFO: {
- if (objc == 2) {
- GetAllVirtualEvents(interp, vetPtr);
- return TCL_OK;
- } else if (objc == 3) {
- return GetVirtualEvent(interp, vetPtr,
- Tcl_GetStringFromObj(objv[2], NULL));
- } else {
- Tcl_WrongNumArgs(interp, 2, objv, "?virtual?");
+ name = Tcl_GetString(objv[2]);
+ if (objc == 3) {
+ return DeleteVirtualEvent(interp, vetPtr, name, NULL);
+ }
+ for (i = 3; i < objc; i++) {
+ event = Tcl_GetString(objv[i]);
+ if (DeleteVirtualEvent(interp, vetPtr, name, event) != TCL_OK) {
return TCL_ERROR;
}
}
+ break;
+ }
+ case EVENT_GENERATE:
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window event ?options?");
+ return TCL_ERROR;
+ }
+ return HandleEventGenerate(interp, tkwin, objc - 2, objv + 2);
+ case EVENT_INFO:
+ if (objc == 2) {
+ GetAllVirtualEvents(interp, vetPtr);
+ return TCL_OK;
+ } else if (objc == 3) {
+ return GetVirtualEvent(interp, vetPtr, Tcl_GetString(objv[2]));
+ } else {
+ Tcl_WrongNumArgs(interp, 2, objv, "?virtual?");
+ return TCL_ERROR;
+ }
}
return TCL_OK;
}
@@ -2843,8 +2795,8 @@ Tk_EventObjCmd(clientData, interp, objc, objv)
*
* InitVirtualEventTable --
*
- * Given storage for a virtual event table, set up the fields to
- * prepare a new domain in which virtual events may be defined.
+ * Given storage for a virtual event table, set up the fields to prepare
+ * a new domain in which virtual events may be defined.
*
* Results:
* None.
@@ -2856,9 +2808,9 @@ Tk_EventObjCmd(clientData, interp, objc, objv)
*/
static void
-InitVirtualEventTable(vetPtr)
- VirtualEventTable *vetPtr; /* Pointer to virtual event table. Memory
- * is supplied by the caller. */
+InitVirtualEventTable(
+ VirtualEventTable *vetPtr) /* Pointer to virtual event table. Memory is
+ * supplied by the caller. */
{
Tcl_InitHashTable(&vetPtr->patternTable,
sizeof(PatternTableKey) / sizeof(int));
@@ -2870,7 +2822,7 @@ InitVirtualEventTable(vetPtr)
*
* DeleteVirtualEventTable --
*
- * Delete the contents of a virtual event table. The caller is
+ * Delete the contents of a virtual event table. The caller is
* responsible for freeing any memory used by the table itself.
*
* Results:
@@ -2883,8 +2835,8 @@ InitVirtualEventTable(vetPtr)
*/
static void
-DeleteVirtualEventTable(vetPtr)
- VirtualEventTable *vetPtr; /* The virtual event table to delete. */
+DeleteVirtualEventTable(
+ VirtualEventTable *vetPtr) /* The virtual event table to delete. */
{
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -2903,7 +2855,7 @@ DeleteVirtualEventTable(vetPtr)
hPtr = Tcl_FirstHashEntry(&vetPtr->nameTable, &search);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- ckfree((char *) Tcl_GetHashValue(hPtr));
+ ckfree((char *) Tcl_GetHashValue(hPtr));
}
Tcl_DeleteHashTable(&vetPtr->nameTable);
}
@@ -2913,29 +2865,27 @@ DeleteVirtualEventTable(vetPtr)
*
* CreateVirtualEvent --
*
- * Add a new definition for a virtual event. If the virtual event
- * is already defined, the new definition augments those that
- * already exist.
+ * Add a new definition for a virtual event. If the virtual event is
+ * already defined, the new definition augments those that already exist.
*
* Results:
- * The return value is TCL_ERROR if an error occured while
- * creating the virtual binding. In this case, an error message
- * will be left in the interp's result. If all went well then the
- * return value is TCL_OK.
+ * The return value is TCL_ERROR if an error occured while creating the
+ * virtual binding. In this case, an error message will be left in the
+ * interp's result. If all went well then the return value is TCL_OK.
*
* Side effects:
- * The virtual event may cause future calls to Tk_BindEvent to
- * behave differently than they did previously.
+ * The virtual event may cause future calls to Tk_BindEvent to behave
+ * differently than they did previously.
*
*----------------------------------------------------------------------
*/
static int
-CreateVirtualEvent(interp, vetPtr, virtString, eventString)
- Tcl_Interp *interp; /* Used for error reporting. */
- VirtualEventTable *vetPtr;/* Table in which to augment virtual event. */
- char *virtString; /* Name of new virtual event. */
- char *eventString; /* String describing physical event that
+CreateVirtualEvent(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ VirtualEventTable *vetPtr, /* Table in which to augment virtual event. */
+ char *virtString, /* Name of new virtual event. */
+ char *eventString) /* String describing physical event that
* triggers virtual event. */
{
PatSeq *psPtr;
@@ -2945,10 +2895,10 @@ CreateVirtualEvent(interp, vetPtr, virtString, eventString)
PhysicalsOwned *poPtr;
VirtualOwners *voPtr;
Tk_Uid virtUid;
-
+
virtUid = GetVirtualEventUid(interp, virtString);
if (virtUid == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
/*
@@ -2958,7 +2908,7 @@ CreateVirtualEvent(interp, vetPtr, virtString, eventString)
psPtr = FindSequence(interp, &vetPtr->patternTable, NULL, eventString,
1, 0, &eventMask);
if (psPtr == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
/*
@@ -2976,20 +2926,21 @@ CreateVirtualEvent(interp, vetPtr, virtString, eventString)
poPtr = (PhysicalsOwned *) ckalloc(sizeof(PhysicalsOwned));
poPtr->numOwned = 0;
} else {
- /*
+ /*
* See if this virtual event is already defined for this physical
* event and just return if it is.
*/
int i;
+
for (i = 0; i < poPtr->numOwned; i++) {
if (poPtr->patSeqs[i] == psPtr) {
- return TCL_OK;
+ return TCL_OK;
}
}
poPtr = (PhysicalsOwned *) ckrealloc((char *) poPtr,
sizeof(PhysicalsOwned) + poPtr->numOwned * sizeof(PatSeq *));
- }
+ }
Tcl_SetHashValue(vhPtr, (ClientData) poPtr);
poPtr->patSeqs[poPtr->numOwned] = psPtr;
poPtr->numOwned++;
@@ -3000,10 +2951,10 @@ CreateVirtualEvent(interp, vetPtr, virtString, eventString)
voPtr = psPtr->voPtr;
if (voPtr == NULL) {
- voPtr = (VirtualOwners *) ckalloc(sizeof(VirtualOwners));
+ voPtr = (VirtualOwners *) ckalloc(sizeof(VirtualOwners));
voPtr->numOwners = 0;
} else {
- voPtr = (VirtualOwners *) ckrealloc((char *) voPtr,
+ voPtr = (VirtualOwners *) ckrealloc((char *) voPtr,
sizeof(VirtualOwners)
+ voPtr->numOwners * sizeof(Tcl_HashEntry *));
}
@@ -3019,31 +2970,31 @@ CreateVirtualEvent(interp, vetPtr, virtString, eventString)
*
* DeleteVirtualEvent --
*
- * Remove the definition of a given virtual event. If the
- * event string is NULL, all definitions of the virtual event
- * will be removed. Otherwise, just the specified definition
- * of the virtual event will be removed.
+ * Remove the definition of a given virtual event. If the event string is
+ * NULL, all definitions of the virtual event will be removed.
+ * Otherwise, just the specified definition of the virtual event will be
+ * removed.
*
* Results:
- * The result is a standard Tcl return value. If an error
- * occurs then the interp's result will contain an error message.
- * It is not an error to attempt to delete a virtual event that
- * does not exist or a definition that does not exist.
+ * The result is a standard Tcl return value. If an error occurs then the
+ * interp's result will contain an error message. It is not an error to
+ * attempt to delete a virtual event that does not exist or a definition
+ * that does not exist.
*
* Side effects:
- * The virtual event given by virtString may be removed from the
- * virtual event table.
+ * The virtual event given by virtString may be removed from the virtual
+ * event table.
*
*--------------------------------------------------------------
*/
static int
-DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
- Tcl_Interp *interp; /* Used for error reporting. */
- VirtualEventTable *vetPtr;/* Table in which to delete event. */
- char *virtString; /* String describing event sequence that
+DeleteVirtualEvent(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ VirtualEventTable *vetPtr, /* Table in which to delete event. */
+ char *virtString, /* String describing event sequence that
* triggers binding. */
- char *eventString; /* The event sequence that should be deleted,
+ char *eventString) /* The event sequence that should be deleted,
* or NULL to delete all event sequences for
* the entire virtual event. */
{
@@ -3055,12 +3006,12 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
virtUid = GetVirtualEventUid(interp, virtString);
if (virtUid == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
-
+
vhPtr = Tcl_FindHashEntry(&vetPtr->nameTable, virtUid);
if (vhPtr == NULL) {
- return TCL_OK;
+ return TCL_OK;
}
poPtr = (PhysicalsOwned *) Tcl_GetHashValue(vhPtr);
@@ -3069,28 +3020,27 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
unsigned long eventMask;
/*
- * Delete only the specific physical event associated with the
- * virtual event. If the physical event doesn't already exist, or
- * the virtual event doesn't own that physical event, return w/o
- * doing anything.
+ * Delete only the specific physical event associated with the virtual
+ * event. If the physical event doesn't already exist, or the virtual
+ * event doesn't own that physical event, return w/o doing anything.
*/
eventPSPtr = FindSequence(interp, &vetPtr->patternTable, NULL,
eventString, 0, 0, &eventMask);
if (eventPSPtr == NULL) {
- CONST char *string;
+ const char *string = Tcl_GetStringResult(interp);
- string = Tcl_GetStringResult(interp);
return (string[0] != '\0') ? TCL_ERROR : TCL_OK;
}
}
for (iPhys = poPtr->numOwned; --iPhys >= 0; ) {
PatSeq *psPtr = poPtr->patSeqs[iPhys];
+
if ((eventPSPtr == NULL) || (psPtr == eventPSPtr)) {
int iVirt;
VirtualOwners *voPtr;
-
+
/*
* Remove association between this physical event and the given
* virtual event that it triggers.
@@ -3103,15 +3053,17 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
}
}
if (iVirt == voPtr->numOwners) {
- panic("DeleteVirtualEvent: couldn't find owner");
+ Tcl_Panic("DeleteVirtualEvent: couldn't find owner");
}
voPtr->numOwners--;
if (voPtr->numOwners == 0) {
/*
- * Removed last reference to this physical event, so
- * remove it from physical->virtual map.
+ * Removed last reference to this physical event, so remove it
+ * from physical->virtual map.
*/
+
PatSeq *prevPtr = (PatSeq *) Tcl_GetHashValue(psPtr->hPtr);
+
if (prevPtr == psPtr) {
if (psPtr->nextSeqPtr == NULL) {
Tcl_DeleteHashEntry(psPtr->hPtr);
@@ -3122,7 +3074,7 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
} else {
for ( ; ; prevPtr = prevPtr->nextSeqPtr) {
if (prevPtr == NULL) {
- panic("DeleteVirtualEvent couldn't find on hash chain");
+ Tcl_Panic("DeleteVirtualEvent couldn't find on hash chain");
}
if (prevPtr->nextSeqPtr == psPtr) {
prevPtr->nextSeqPtr = psPtr->nextSeqPtr;
@@ -3135,23 +3087,23 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
} else {
/*
* This physical event still triggers some other virtual
- * event(s). Consolidate the list of virtual owners for
- * this physical event so it no longer triggers the
- * given virtual event.
+ * event(s). Consolidate the list of virtual owners for this
+ * physical event so it no longer triggers the given virtual
+ * event.
*/
+
voPtr->owners[iVirt] = voPtr->owners[voPtr->numOwners];
}
/*
- * Now delete the virtual event's reference to the physical
- * event.
+ * Now delete the virtual event's reference to the physical event.
*/
poPtr->numOwned--;
if (eventPSPtr != NULL && poPtr->numOwned != 0) {
- /*
- * Just deleting this one physical event. Consolidate list
- * of owned physical events and return.
+ /*
+ * Just deleting this one physical event. Consolidate list of
+ * owned physical events and return.
*/
poPtr->patSeqs[iPhys] = poPtr->patSeqs[poPtr->numOwned];
@@ -3162,10 +3114,10 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
if (poPtr->numOwned == 0) {
/*
- * All the physical events for this virtual event were deleted,
- * either because there was only one associated physical event or
- * because the caller was deleting the entire virtual event. Now
- * the virtual event itself should be deleted.
+ * All the physical events for this virtual event were deleted, either
+ * because there was only one associated physical event or because the
+ * caller was deleting the entire virtual event. Now the virtual event
+ * itself should be deleted.
*/
ckfree((char *) poPtr);
@@ -3179,16 +3131,16 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
*
* GetVirtualEvent --
*
- * Return the list of physical events that can invoke the
- * given virtual event.
+ * Return the list of physical events that can invoke the given virtual
+ * event.
*
* Results:
* The return value is TCL_OK and the interp's result is filled with the
* string representation of the physical events associated with the
* virtual event; if there are no physical events for the given virtual
- * event, the interp's result is filled with and empty string. If the
- * virtual event string is improperly formed, then TCL_ERROR is
- * returned and an error message is left in the interp's result.
+ * event, the interp's result is filled with and empty string. If the
+ * virtual event string is improperly formed, then TCL_ERROR is returned
+ * and an error message is left in the interp's result.
*
* Side effects:
* None.
@@ -3197,10 +3149,10 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
*/
static int
-GetVirtualEvent(interp, vetPtr, virtString)
- Tcl_Interp *interp; /* Interpreter for reporting. */
- VirtualEventTable *vetPtr;/* Table in which to look for event. */
- char *virtString; /* String describing virtual event. */
+GetVirtualEvent(
+ Tcl_Interp *interp, /* Interpreter for reporting. */
+ VirtualEventTable *vetPtr, /* Table in which to look for event. */
+ char *virtString) /* String describing virtual event. */
{
Tcl_HashEntry *vhPtr;
Tcl_DString ds;
@@ -3210,12 +3162,12 @@ GetVirtualEvent(interp, vetPtr, virtString)
virtUid = GetVirtualEventUid(interp, virtString);
if (virtUid == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
vhPtr = Tcl_FindHashEntry(&vetPtr->nameTable, virtUid);
if (vhPtr == NULL) {
- return TCL_OK;
+ return TCL_OK;
}
Tcl_DStringInit(&ds);
@@ -3236,13 +3188,12 @@ GetVirtualEvent(interp, vetPtr, virtString)
*
* GetAllVirtualEvents --
*
- * Return a list that contains the names of all the virtual
- * event defined.
+ * Return a list that contains the names of all the virtual event
+ * defined.
*
* Results:
- * There is no return value. The interp's result is modified to
- * hold a Tcl list with one entry for each virtual event in
- * nameTable.
+ * There is no return value. The interp's result is modified to hold a
+ * Tcl list with one entry for each virtual event in nameTable.
*
* Side effects:
* None.
@@ -3251,9 +3202,9 @@ GetVirtualEvent(interp, vetPtr, virtString)
*/
static void
-GetAllVirtualEvents(interp, vetPtr)
- Tcl_Interp *interp; /* Interpreter returning result. */
- VirtualEventTable *vetPtr;/* Table containing events. */
+GetAllVirtualEvents(
+ Tcl_Interp *interp, /* Interpreter returning result. */
+ VirtualEventTable *vetPtr) /* Table containing events. */
{
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -3263,11 +3214,11 @@ GetAllVirtualEvents(interp, vetPtr)
hPtr = Tcl_FirstHashEntry(&vetPtr->nameTable, &search);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_DStringSetLength(&ds, 0);
+ Tcl_DStringSetLength(&ds, 0);
Tcl_DStringAppend(&ds, "<<", 2);
Tcl_DStringAppend(&ds, Tcl_GetHashKey(hPtr->tablePtr, hPtr), -1);
Tcl_DStringAppend(&ds, ">>", 2);
- Tcl_AppendElement(interp, Tcl_DStringValue(&ds));
+ Tcl_AppendElement(interp, Tcl_DStringValue(&ds));
}
Tcl_DStringFree(&ds);
@@ -3278,45 +3229,45 @@ GetAllVirtualEvents(interp, vetPtr)
*
* HandleEventGenerate --
*
- * Helper function for the "event generate" command. Generate and
- * process an XEvent, constructed from information parsed from the
- * event description string and its optional arguments.
+ * Helper function for the "event generate" command. Generate and process
+ * an XEvent, constructed from information parsed from the event
+ * description string and its optional arguments.
*
* argv[0] contains name of the target window.
* argv[1] contains pattern string for one event (e.g, <Control-v>).
- * argv[2..argc-1] contains -field/option pairs for specifying
- * additional detail in the generated event.
+ * argv[2..argc-1] contains -field/option pairs for specifying additional
+ * detail in the generated event.
*
- * Either virtual or physical events can be generated this way.
- * The event description string must contain the specification
- * for only one event.
+ * Either virtual or physical events can be generated this way. The event
+ * description string must contain the specification for only one event.
*
* Results:
* None.
*
* Side effects:
- * When constructing the event,
- * event.xany.serial is filled with the current X serial number.
- * event.xany.window is filled with the target window.
- * event.xany.display is filled with the target window's display.
+ * When constructing the event,
+ * event.xany.serial is filled with the current X serial number.
+ * event.xany.window is filled with the target window.
+ * event.xany.display is filled with the target window's display.
* Any other fields in eventPtr which are not specified by the pattern
* string or the optional arguments, are set to 0.
*
- * The event may be handled sychronously or asynchronously, depending
- * on the value specified by the optional "-when" option. The
- * default setting is synchronous.
+ * The event may be handled sychronously or asynchronously, depending on
+ * the value specified by the optional "-when" option. The default
+ * setting is synchronous.
*
*---------------------------------------------------------------------------
*/
+
static int
-HandleEventGenerate(interp, mainWin, objc, objv)
- Tcl_Interp *interp; /* Interp for errors return and name lookup. */
- Tk_Window mainWin; /* Main window associated with interp. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+HandleEventGenerate(
+ Tcl_Interp *interp, /* Interp for errors return and name lookup. */
+ Tk_Window mainWin, /* Main window associated with interp. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- XEvent event;
- CONST char *p;
+ union {XEvent general; XVirtualEvent virtual;} event;
+ const char *p;
char *name, *windowName;
int count, flags, synch, i, number, warp;
Tcl_QueuePosition pos;
@@ -3324,10 +3275,11 @@ HandleEventGenerate(interp, mainWin, objc, objv)
Tk_Window tkwin, tkwin2;
TkWindow *mainPtr;
unsigned long eventMask;
- static CONST char *fieldStrings[] = {
+ Tcl_Obj *userDataObj;
+ static const char *fieldStrings[] = {
"-when", "-above", "-borderwidth", "-button",
- "-count", "-delta", "-detail", "-focus",
- "-height",
+ "-count", "-data", "-delta", "-detail",
+ "-focus", "-height",
"-keycode", "-keysym", "-mode", "-override",
"-place", "-root", "-rootx", "-rooty",
"-sendevent", "-serial", "-state", "-subwindow",
@@ -3336,8 +3288,8 @@ HandleEventGenerate(interp, mainWin, objc, objv)
};
enum field {
EVENT_WHEN, EVENT_ABOVE, EVENT_BORDER, EVENT_BUTTON,
- EVENT_COUNT, EVENT_DELTA, EVENT_DETAIL, EVENT_FOCUS,
- EVENT_HEIGHT,
+ EVENT_COUNT, EVENT_DATA, EVENT_DELTA, EVENT_DETAIL,
+ EVENT_FOCUS, EVENT_HEIGHT,
EVENT_KEYCODE, EVENT_KEYSYM, EVENT_MODE, EVENT_OVERRIDE,
EVENT_PLACE, EVENT_ROOT, EVENT_ROOTX, EVENT_ROOTY,
EVENT_SEND, EVENT_SERIAL, EVENT_STATE, EVENT_SUBWINDOW,
@@ -3345,7 +3297,7 @@ HandleEventGenerate(interp, mainWin, objc, objv)
EVENT_X, EVENT_Y
};
- windowName = Tcl_GetStringFromObj(objv[0], NULL);
+ windowName = Tcl_GetString(objv[0]);
if (!windowName[0]) {
tkwin = mainWin;
} else if (NameToWindow(interp, mainWin, objv[0], &tkwin) != TCL_OK) {
@@ -3355,18 +3307,16 @@ HandleEventGenerate(interp, mainWin, objc, objv)
mainPtr = (TkWindow *) mainWin;
if ((tkwin == NULL)
|| (mainPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr)) {
- char *name;
-
- name = Tcl_GetStringFromObj(objv[0], NULL);
- Tcl_AppendResult(interp, "window id \"", name,
- "\" doesn't exist in this application", (char *) NULL);
+ Tcl_AppendResult(interp, "window id \"", Tcl_GetString(objv[0]),
+ "\" doesn't exist in this application", NULL);
return TCL_ERROR;
}
- name = Tcl_GetStringFromObj(objv[1], NULL);
+ name = Tcl_GetString(objv[1]);
p = name;
eventMask = 0;
+ userDataObj = NULL;
count = ParseEventDescription(interp, &p, &pat, &eventMask);
if (count == 0) {
return TCL_ERROR;
@@ -3382,48 +3332,49 @@ HandleEventGenerate(interp, mainWin, objc, objv)
return TCL_ERROR;
}
- memset((VOID *) &event, 0, sizeof(event));
- event.xany.type = pat.eventType;
- event.xany.serial = NextRequest(Tk_Display(tkwin));
- event.xany.send_event = False;
+ memset((void *) &event, 0, sizeof(event));
+ event.general.xany.type = pat.eventType;
+ event.general.xany.serial = NextRequest(Tk_Display(tkwin));
+ event.general.xany.send_event = False;
if (windowName[0]) {
- event.xany.window = Tk_WindowId(tkwin);
+ event.general.xany.window = Tk_WindowId(tkwin);
} else {
- event.xany.window = RootWindow(Tk_Display(tkwin), Tk_ScreenNumber(tkwin));
+ event.general.xany.window =
+ RootWindow(Tk_Display(tkwin), Tk_ScreenNumber(tkwin));
}
- event.xany.display = Tk_Display(tkwin);
+ event.general.xany.display = Tk_Display(tkwin);
- flags = flagArray[event.xany.type];
+ flags = flagArray[event.general.xany.type];
if (flags & DESTROY) {
/*
- * Event DesotryNotify should be generated by destroying
- * the window.
+ * Event DestroyNotify should be generated by destroying the window.
*/
+
Tk_DestroyWindow(tkwin);
return TCL_OK;
}
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- event.xkey.state = pat.needMods;
- if ((flags & KEY) && (event.xany.type != MouseWheelEvent)) {
- TkpSetKeycodeAndState(tkwin, pat.detail.keySym, &event);
+ if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ event.general.xkey.state = pat.needMods;
+ if ((flags & KEY) && (event.general.xany.type != MouseWheelEvent)) {
+ TkpSetKeycodeAndState(tkwin, pat.detail.keySym, &event.general);
} else if (flags & BUTTON) {
- event.xbutton.button = pat.detail.button;
+ event.general.xbutton.button = pat.detail.button;
} else if (flags & VIRTUAL) {
- ((XVirtualEvent *) &event)->name = pat.detail.name;
+ event.virtual.name = pat.detail.name;
}
}
if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) {
- event.xcreatewindow.window = event.xany.window;
+ event.general.xcreatewindow.window = event.general.xany.window;
}
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.x_root = -1;
- event.xkey.y_root = -1;
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ event.general.xkey.x_root = -1;
+ event.general.xkey.y_root = -1;
}
/*
- * Process the remaining arguments to fill in additional fields
- * of the event.
+ * Process the remaining arguments to fill in additional fields of the
+ * event.
*/
synch = 1;
@@ -3432,7 +3383,7 @@ HandleEventGenerate(interp, mainWin, objc, objv)
for (i = 2; i < objc; i += 2) {
Tcl_Obj *optionPtr, *valuePtr;
int index;
-
+
optionPtr = objv[i];
valuePtr = objv[i + 1];
@@ -3442,446 +3393,451 @@ HandleEventGenerate(interp, mainWin, objc, objv)
}
if (objc & 1) {
/*
- * This test occurs after Tcl_GetIndexFromObj() so that
- * "event generate <Button> -xyz" will return the error message
- * that "-xyz" is a bad option, rather than that the value
- * for "-xyz" is missing.
+ * This test occurs after Tcl_GetIndexFromObj() so that "event
+ * generate <Button> -xyz" will return the error message that
+ * "-xyz" is a bad option, rather than that the value for "-xyz"
+ * is missing.
*/
- Tcl_AppendResult(interp, "value for \"",
- Tcl_GetStringFromObj(optionPtr, NULL), "\" missing",
- (char *) NULL);
+ Tcl_AppendResult(interp, "value for \"", Tcl_GetString(optionPtr),
+ "\" missing", NULL);
return TCL_ERROR;
}
switch ((enum field) index) {
- case EVENT_WARP: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &warp) != TCL_OK) {
- return TCL_ERROR;
- }
- if (!(flags & (KEY_BUTTON_MOTION_VIRTUAL))) {
- goto badopt;
- }
- break;
+ case EVENT_WARP:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &warp) != TCL_OK) {
+ return TCL_ERROR;
}
- case EVENT_WHEN: {
- pos = (Tcl_QueuePosition) TkFindStateNumObj(interp, optionPtr,
- queuePosition, valuePtr);
- if ((int) pos < -1) {
- return TCL_ERROR;
- }
- synch = 0;
- if ((int) pos == -1) {
- synch = 1;
- }
- break;
+ if (!(flags & KEY_BUTTON_MOTION_VIRTUAL)) {
+ goto badopt;
}
- case EVENT_ABOVE: {
- if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & CONFIG) {
- event.xconfigure.above = Tk_WindowId(tkwin2);
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_WHEN:
+ pos = (Tcl_QueuePosition) TkFindStateNumObj(interp, optionPtr,
+ queuePosition, valuePtr);
+ if ((int) pos < -1) {
+ return TCL_ERROR;
}
- case EVENT_BORDER: {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (CREATE|CONFIG)) {
- event.xcreatewindow.border_width = number;
- } else {
- goto badopt;
- }
- break;
+ synch = 0;
+ if ((int) pos == -1) {
+ synch = 1;
}
- case EVENT_BUTTON: {
- if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & BUTTON) {
- event.xbutton.button = number;
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_ABOVE:
+ if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
+ return TCL_ERROR;
}
- case EVENT_COUNT: {
- if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & EXPOSE) {
- event.xexpose.count = number;
- } else {
- goto badopt;
- }
- break;
+ if (flags & CONFIG) {
+ event.general.xconfigure.above = Tk_WindowId(tkwin2);
+ } else {
+ goto badopt;
}
- case EVENT_DELTA: {
- if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if ((flags & KEY) && (event.xkey.type == MouseWheelEvent)) {
- event.xkey.keycode = number;
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_BORDER:
+ if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
+ return TCL_ERROR;
}
- case EVENT_DETAIL: {
- number = TkFindStateNumObj(interp, optionPtr, notifyDetail,
- valuePtr);
- if (number < 0) {
- return TCL_ERROR;
- }
- if (flags & FOCUS) {
- event.xfocus.detail = number;
- } else if (flags & CROSSING) {
- event.xcrossing.detail = number;
- } else {
- goto badopt;
- }
- break;
+ if (flags & (CREATE|CONFIG)) {
+ event.general.xcreatewindow.border_width = number;
+ } else {
+ goto badopt;
}
- case EVENT_FOCUS: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & CROSSING) {
- event.xcrossing.focus = number;
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_BUTTON:
+ if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
}
- case EVENT_HEIGHT: {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & EXPOSE) {
- event.xexpose.height = number;
- } else if (flags & CONFIG) {
- event.xconfigure.height = number;
- } else {
- goto badopt;
- }
- break;
+ if (flags & BUTTON) {
+ event.general.xbutton.button = number;
+ } else {
+ goto badopt;
}
- case EVENT_KEYCODE: {
- if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if ((flags & KEY) && (event.xkey.type != MouseWheelEvent)) {
- event.xkey.keycode = number;
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_COUNT:
+ if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & EXPOSE) {
+ event.general.xexpose.count = number;
+ } else {
+ goto badopt;
}
- case EVENT_KEYSYM: {
- KeySym keysym;
- char *value;
+ break;
+ case EVENT_DATA:
+ if (flags & VIRTUAL) {
+ /*
+ * Do not increment reference count until after parsing
+ * completes and we know that the event generation is really
+ * going to happen.
+ */
- value = Tcl_GetStringFromObj(valuePtr, NULL);
- keysym = TkStringToKeysym(value);
- if (keysym == NoSymbol) {
- Tcl_AppendResult(interp, "unknown keysym \"", value, "\"",
- (char *) NULL);
- return TCL_ERROR;
- }
+ userDataObj = valuePtr;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_DELTA:
+ if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if ((flags & KEY) && (event.general.xkey.type == MouseWheelEvent)) {
+ event.general.xkey.keycode = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_DETAIL:
+ number = TkFindStateNumObj(interp, optionPtr, notifyDetail,
+ valuePtr);
+ if (number < 0) {
+ return TCL_ERROR;
+ }
+ if (flags & FOCUS) {
+ event.general.xfocus.detail = number;
+ } else if (flags & CROSSING) {
+ event.general.xcrossing.detail = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_FOCUS:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & CROSSING) {
+ event.general.xcrossing.focus = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_HEIGHT:
+ if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr,
+ &number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & EXPOSE) {
+ event.general.xexpose.height = number;
+ } else if (flags & CONFIG) {
+ event.general.xconfigure.height = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_KEYCODE:
+ if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if ((flags & KEY) && (event.general.xkey.type != MouseWheelEvent)) {
+ event.general.xkey.keycode = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_KEYSYM: {
+ KeySym keysym;
+ char *value;
+
+ value = Tcl_GetString(valuePtr);
+ keysym = TkStringToKeysym(value);
+ if (keysym == NoSymbol) {
+ Tcl_AppendResult(interp, "unknown keysym \"", value, "\"",
+ NULL);
+ return TCL_ERROR;
+ }
- TkpSetKeycodeAndState(tkwin, keysym, &event);
- if (event.xkey.keycode == 0) {
- Tcl_AppendResult(interp, "no keycode for keysym \"", value,
- "\"", (char *) NULL);
- return TCL_ERROR;
- }
- if (!(flags & KEY) || (event.xkey.type == MouseWheelEvent)) {
- goto badopt;
- }
- break;
+ TkpSetKeycodeAndState(tkwin, keysym, &event.general);
+ if (event.general.xkey.keycode == 0) {
+ Tcl_AppendResult(interp, "no keycode for keysym \"", value,
+ "\"", NULL);
+ return TCL_ERROR;
}
- case EVENT_MODE: {
- number = TkFindStateNumObj(interp, optionPtr, notifyMode,
- valuePtr);
- if (number < 0) {
- return TCL_ERROR;
- }
- if (flags & CROSSING) {
- event.xcrossing.mode = number;
- } else if (flags & FOCUS) {
- event.xfocus.mode = number;
- } else {
- goto badopt;
- }
- break;
+ if (!(flags & KEY)
+ || (event.general.xkey.type == MouseWheelEvent)) {
+ goto badopt;
}
- case EVENT_OVERRIDE: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & CREATE) {
- event.xcreatewindow.override_redirect = number;
- } else if (flags & MAP) {
- event.xmap.override_redirect = number;
- } else if (flags & REPARENT) {
- event.xreparent.override_redirect = number;
- } else if (flags & CONFIG) {
- event.xconfigure.override_redirect = number;
- } else {
- goto badopt;
- }
- break;
+ break;
+ }
+ case EVENT_MODE:
+ number = TkFindStateNumObj(interp,optionPtr,notifyMode,valuePtr);
+ if (number < 0) {
+ return TCL_ERROR;
}
- case EVENT_PLACE: {
- number = TkFindStateNumObj(interp, optionPtr, circPlace,
- valuePtr);
- if (number < 0) {
- return TCL_ERROR;
- }
- if (flags & CIRC) {
- event.xcirculate.place = number;
- } else {
- goto badopt;
- }
- break;
+ if (flags & CROSSING) {
+ event.general.xcrossing.mode = number;
+ } else if (flags & FOCUS) {
+ event.general.xfocus.mode = number;
+ } else {
+ goto badopt;
}
- case EVENT_ROOT: {
- if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.root = Tk_WindowId(tkwin2);
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_OVERRIDE:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
}
- case EVENT_ROOTX: {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.x_root = number;
- } else {
- goto badopt;
- }
- break;
+ if (flags & CREATE) {
+ event.general.xcreatewindow.override_redirect = number;
+ } else if (flags & MAP) {
+ event.general.xmap.override_redirect = number;
+ } else if (flags & REPARENT) {
+ event.general.xreparent.override_redirect = number;
+ } else if (flags & CONFIG) {
+ event.general.xconfigure.override_redirect = number;
+ } else {
+ goto badopt;
}
- case EVENT_ROOTY: {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.y_root = number;
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_PLACE:
+ number = TkFindStateNumObj(interp, optionPtr, circPlace, valuePtr);
+ if (number < 0) {
+ return TCL_ERROR;
+ }
+ if (flags & CIRC) {
+ event.general.xcirculate.place = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_ROOT:
+ if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
+ return TCL_ERROR;
}
- case EVENT_SEND: {
- CONST char *value;
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ event.general.xkey.root = Tk_WindowId(tkwin2);
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_ROOTX:
+ if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ event.general.xkey.x_root = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_ROOTY:
+ if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ event.general.xkey.y_root = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_SEND: {
+ const char *value;
- value = Tcl_GetStringFromObj(valuePtr, NULL);
- if (isdigit(UCHAR(value[0]))) {
- /*
- * Allow arbitrary integer values for the field; they
- * are needed by a few of the tests in the Tk test suite.
- */
+ value = Tcl_GetString(valuePtr);
+ if (isdigit(UCHAR(value[0]))) {
+ /*
+ * Allow arbitrary integer values for the field; they are
+ * needed by a few of the tests in the Tk test suite.
+ */
- if (Tcl_GetIntFromObj(interp, valuePtr, &number)
- != TCL_OK) {
- return TCL_ERROR;
- }
- } else {
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &number)
- != TCL_OK) {
- return TCL_ERROR;
- }
- }
- event.xany.send_event = number;
- break;
- }
- case EVENT_SERIAL: {
if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- event.xany.serial = number;
- break;
- }
- case EVENT_STATE: {
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- if (Tcl_GetIntFromObj(interp, valuePtr, &number)
- != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- event.xkey.state = number;
- } else {
- event.xcrossing.state = number;
- }
- } else if (flags & VISIBILITY) {
- number = TkFindStateNumObj(interp, optionPtr, visNotify,
- valuePtr);
- if (number < 0) {
- return TCL_ERROR;
- }
- event.xvisibility.state = number;
- } else {
- goto badopt;
- }
- break;
- }
- case EVENT_SUBWINDOW: {
- if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
+ } else {
+ if (Tcl_GetBooleanFromObj(interp,valuePtr,&number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.subwindow = Tk_WindowId(tkwin2);
- } else {
- goto badopt;
- }
- break;
}
- case EVENT_TIME: {
+ event.general.xany.send_event = number;
+ break;
+ }
+ case EVENT_SERIAL:
+ if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ event.general.xany.serial = number;
+ break;
+ case EVENT_STATE:
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.time = (Time) number;
- } else if (flags & PROP) {
- event.xproperty.time = (Time) number;
+ if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ event.general.xkey.state = number;
} else {
- goto badopt;
+ event.general.xcrossing.state = number;
}
- break;
- }
- case EVENT_WIDTH: {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number)
- != TCL_OK) {
+ } else if (flags & VISIBILITY) {
+ number = TkFindStateNumObj(interp, optionPtr, visNotify,
+ valuePtr);
+ if (number < 0) {
return TCL_ERROR;
}
- if (flags & EXPOSE) {
- event.xexpose.width = number;
- } else if (flags & (CREATE|CONFIG)) {
- event.xcreatewindow.width = number;
- } else {
- goto badopt;
- }
- break;
+ event.general.xvisibility.state = number;
+ } else {
+ goto badopt;
}
- case EVENT_WINDOW: {
- if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG
- |GRAVITY|CIRC)) {
- event.xcreatewindow.window = Tk_WindowId(tkwin2);
- } else {
- goto badopt;
- }
- break;
+ break;
+ case EVENT_SUBWINDOW:
+ if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
+ return TCL_ERROR;
}
- case EVENT_X: {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number)
- != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.x = number;
- /*
- * Only modify rootx as well if it hasn't been changed.
- */
- if (event.xkey.x_root == -1) {
- int rootX, rootY;
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ event.general.xkey.subwindow = Tk_WindowId(tkwin2);
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_TIME:
+ if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ event.general.xkey.time = (Time) number;
+ } else if (flags & PROP) {
+ event.general.xproperty.time = (Time) number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_WIDTH:
+ if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & EXPOSE) {
+ event.general.xexpose.width = number;
+ } else if (flags & (CREATE|CONFIG)) {
+ event.general.xcreatewindow.width = number;
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_WINDOW:
+ if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) {
+ event.general.xcreatewindow.window = Tk_WindowId(tkwin2);
+ } else {
+ goto badopt;
+ }
+ break;
+ case EVENT_X:
+ if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
+ event.general.xkey.x = number;
- Tk_GetRootCoords(tkwin, &rootX, &rootY);
- event.xkey.x_root = rootX + number;
- }
- } else if (flags & EXPOSE) {
- event.xexpose.x = number;
- } else if (flags & (CREATE|CONFIG|GRAVITY)) {
- event.xcreatewindow.x = number;
- } else if (flags & REPARENT) {
- event.xreparent.x = number;
- } else {
- goto badopt;
+ /*
+ * Only modify rootx as well if it hasn't been changed.
+ */
+
+ if (event.general.xkey.x_root == -1) {
+ int rootX, rootY;
+
+ Tk_GetRootCoords(tkwin, &rootX, &rootY);
+ event.general.xkey.x_root = rootX + number;
}
- break;
+ } else if (flags & EXPOSE) {
+ event.general.xexpose.x = number;
+ } else if (flags & (CREATE|CONFIG|GRAVITY)) {
+ event.general.xcreatewindow.x = number;
+ } else if (flags & REPARENT) {
+ event.general.xreparent.x = number;
+ } else {
+ goto badopt;
}
- case EVENT_Y: {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number)
- != TCL_OK) {
- return TCL_ERROR;
- }
- if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
- event.xkey.y = number;
- /*
- * Only modify rooty as well if it hasn't been changed.
- */
- if (event.xkey.y_root == -1) {
- int rootX, rootY;
+ break;
+ case EVENT_Y:
+ if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ event.general.xkey.y = number;
- Tk_GetRootCoords(tkwin, &rootX, &rootY);
- event.xkey.y_root = rootY + number;
- }
- } else if (flags & EXPOSE) {
- event.xexpose.y = number;
- } else if (flags & (CREATE|CONFIG|GRAVITY)) {
- event.xcreatewindow.y = number;
- } else if (flags & REPARENT) {
- event.xreparent.y = number;
- } else {
- goto badopt;
+ /*
+ * Only modify rooty as well if it hasn't been changed.
+ */
+
+ if (event.general.xkey.y_root == -1) {
+ int rootX, rootY;
+
+ Tk_GetRootCoords(tkwin, &rootX, &rootY);
+ event.general.xkey.y_root = rootY + number;
}
- break;
+ } else if (flags & EXPOSE) {
+ event.general.xexpose.y = number;
+ } else if (flags & (CREATE|CONFIG|GRAVITY)) {
+ event.general.xcreatewindow.y = number;
+ } else if (flags & REPARENT) {
+ event.general.xreparent.y = number;
+ } else {
+ goto badopt;
}
+ break;
}
continue;
-
- badopt:
+
+ badopt:
Tcl_AppendResult(interp, name, " event doesn't accept \"",
- Tcl_GetStringFromObj(optionPtr, NULL), "\" option", NULL);
+ Tcl_GetString(optionPtr), "\" option", NULL);
return TCL_ERROR;
}
+ if (userDataObj != NULL) {
+ XVirtualEvent *vePtr = (XVirtualEvent *) &event;
+
+ /*
+ * Must be virtual event to set that variable to non-NULL. Now we want
+ * to install the object into the event. Note that we must incr the
+ * refcount before firing it into the low-level event subsystem; the
+ * refcount will be decremented once the event has been processed.
+ */
+
+ vePtr->user_data = userDataObj;
+ Tcl_IncrRefCount(userDataObj);
+ }
+
+ /*
+ * Now we have constructed the event, inject it into the event handling
+ * code.
+ */
+
if (synch != 0) {
- Tk_HandleEvent(&event);
+ Tk_HandleEvent(&event.general);
} else {
- Tk_QueueWindowEvent(&event, pos);
+ Tk_QueueWindowEvent(&event.general, pos);
}
+
/*
- * We only allow warping if the window is mapped
+ * We only allow warping if the window is mapped.
*/
+
if ((warp != 0) && Tk_IsMapped(tkwin)) {
- TkDisplay *dispPtr;
- dispPtr = TkGetDisplay(event.xmotion.display);
+ TkDisplay *dispPtr = TkGetDisplay(event.general.xmotion.display);
+
if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
Tcl_DoWhenIdle(DoWarp, (ClientData) dispPtr);
dispPtr->flags |= TK_DISPLAY_IN_WARP;
}
- dispPtr->warpWindow = event.xany.window;
- dispPtr->warpX = event.xkey.x;
- dispPtr->warpY = event.xkey.y;
+ dispPtr->warpWindow = event.general.xany.window;
+ dispPtr->warpX = event.general.xkey.x;
+ dispPtr->warpY = event.general.xkey.y;
}
Tcl_ResetResult(interp);
return TCL_OK;
-
}
+
static int
-NameToWindow(interp, mainWin, objPtr, tkwinPtr)
- Tcl_Interp *interp; /* Interp for error return and name lookup. */
- Tk_Window mainWin; /* Main window of application. */
- Tcl_Obj *objPtr; /* Contains name or id string of window. */
- Tk_Window *tkwinPtr; /* Filled with token for window. */
+NameToWindow(
+ Tcl_Interp *interp, /* Interp for error return and name lookup. */
+ Tk_Window mainWin, /* Main window of application. */
+ Tcl_Obj *objPtr, /* Contains name or id string of window. */
+ Tk_Window *tkwinPtr) /* Filled with token for window. */
{
char *name;
Tk_Window tkwin;
Window id;
- name = Tcl_GetStringFromObj(objPtr, NULL);
+ name = Tcl_GetString(objPtr);
if (name[0] == '.') {
tkwin = Tk_NameToWindow(interp, name, mainWin);
if (tkwin == NULL) {
@@ -3891,14 +3847,14 @@ NameToWindow(interp, mainWin, objPtr, tkwinPtr)
} else {
/*
* Check for the winPtr being valid, even if it looks ok to
- * TkpScanWindowId. [Bug #411307]
+ * TkpScanWindowId. [Bug #411307]
*/
if ((TkpScanWindowId(NULL, name, &id) != TCL_OK) ||
((*tkwinPtr = Tk_IdToWindow(Tk_Display(mainWin), id))
== NULL)) {
Tcl_AppendResult(interp, "bad window name/identifier \"",
- name, "\"", (char *) NULL);
+ name, "\"", NULL);
return TCL_ERROR;
}
}
@@ -3921,13 +3877,13 @@ NameToWindow(interp, mainWin, objPtr, tkwinPtr)
*-------------------------------------------------------------------------
*/
static void
-DoWarp(clientData)
- ClientData clientData;
+DoWarp(
+ ClientData clientData)
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
XWarpPointer(dispPtr->display, (Window) None, (Window) dispPtr->warpWindow,
- 0, 0, 0, 0, (int) dispPtr->warpX, (int) dispPtr->warpY);
+ 0, 0, 0, 0, (int) dispPtr->warpX, (int) dispPtr->warpY);
XForceScreenSaver(dispPtr->display, ScreenSaverReset);
dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
}
@@ -3937,35 +3893,36 @@ DoWarp(clientData)
*
* GetVirtualEventUid --
*
- * Determine if the given string is in the proper format for a
- * virtual event.
+ * Determine if the given string is in the proper format for a virtual
+ * event.
*
* Results:
- * The return value is NULL if the virtual event string was
- * not in the proper format. In this case, an error message
- * will be left in the interp's result. Otherwise the return
- * value is a Tk_Uid that represents the virtual event.
+ * The return value is NULL if the virtual event string was not in the
+ * proper format. In this case, an error message will be left in the
+ * interp's result. Otherwise the return value is a Tk_Uid that
+ * represents the virtual event.
*
* Side effects:
* None.
*
*-------------------------------------------------------------------------
*/
+
static Tk_Uid
-GetVirtualEventUid(interp, virtString)
- Tcl_Interp *interp;
- char *virtString;
+GetVirtualEventUid(
+ Tcl_Interp *interp,
+ char *virtString)
{
Tk_Uid uid;
- int length;
+ size_t length;
length = strlen(virtString);
if (length < 5 || virtString[0] != '<' || virtString[1] != '<' ||
virtString[length - 2] != '>' || virtString[length - 1] != '>') {
- Tcl_AppendResult(interp, "virtual event \"", virtString,
- "\" is badly formed", (char *) NULL);
- return NULL;
+ Tcl_AppendResult(interp, "virtual event \"", virtString,
+ "\" is badly formed", NULL);
+ return NULL;
}
virtString[length - 2] = '\0';
uid = Tk_GetUid(virtString + 2);
@@ -3973,27 +3930,24 @@ GetVirtualEventUid(interp, virtString)
return uid;
}
-
/*
*----------------------------------------------------------------------
*
* FindSequence --
*
- * Find the entry in the pattern table that corresponds to a
- * particular pattern string, and return a pointer to that
- * entry.
+ * Find the entry in the pattern table that corresponds to a particular
+ * pattern string, and return a pointer to that entry.
*
* Results:
- * The return value is normally a pointer to the PatSeq
- * in patternTable that corresponds to eventString. If an error
- * was found while parsing eventString, or if "create" is 0 and
- * no pattern sequence previously existed, then NULL is returned
- * and the interp's result contains a message describing the problem.
- * If no pattern sequence previously existed for eventString, then
- * a new one is created with a NULL command field. In a successful
- * return, *maskPtr is filled in with a mask of the event types
- * on which the pattern sequence depends.
+ * The return value is normally a pointer to the PatSeq in patternTable
+ * that corresponds to eventString. If an error was found while parsing
+ * eventString, or if "create" is 0 and no pattern sequence previously
+ * existed, then NULL is returned and the interp's result contains a
+ * message describing the problem. If no pattern sequence previously
+ * existed for eventString, then a new one is created with a NULL command
+ * field. In a successful return, *maskPtr is filled in with a mask of
+ * the event types on which the pattern sequence depends.
*
* Side effects:
* A new pattern sequence may be allocated.
@@ -4002,45 +3956,39 @@ GetVirtualEventUid(interp, virtString)
*/
static PatSeq *
-FindSequence(interp, patternTablePtr, object, eventString, create,
- allowVirtual, maskPtr)
- Tcl_Interp *interp; /* Interpreter to use for error
- * reporting. */
- Tcl_HashTable *patternTablePtr; /* Table to use for lookup. */
- ClientData object; /* For binding table, token for object with
- * which binding is associated.
- * For virtual event table, NULL. */
- CONST char *eventString; /* String description of pattern to
- * match on. See user documentation
- * for details. */
- int create; /* 0 means don't create the entry if
- * it doesn't already exist. Non-zero
- * means create. */
- int allowVirtual; /* 0 means that virtual events are not
- * allowed in the sequence. Non-zero
- * otherwise. */
- unsigned long *maskPtr; /* *maskPtr is filled in with the event
- * types on which this pattern sequence
- * depends. */
+FindSequence(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tcl_HashTable *patternTablePtr,
+ /* Table to use for lookup. */
+ ClientData object, /* For binding table, token for object with
+ * which binding is associated. For virtual
+ * event table, NULL. */
+ const char *eventString, /* String description of pattern to match on.
+ * See user documentation for details. */
+ int create, /* 0 means don't create the entry if it
+ * doesn't already exist. Non-zero means
+ * create. */
+ int allowVirtual, /* 0 means that virtual events are not allowed
+ * in the sequence. Non-zero otherwise. */
+ unsigned long *maskPtr) /* *maskPtr is filled in with the event types
+ * on which this pattern sequence depends. */
{
-
Pattern pats[EVENT_BUFFER_SIZE];
int numPats, virtualFound;
- CONST char *p;
+ const char *p;
Pattern *patPtr;
PatSeq *psPtr;
Tcl_HashEntry *hPtr;
- int flags, count, new;
+ int flags, count, isNew;
size_t sequenceSize;
unsigned long eventMask;
PatternTableKey key;
/*
*-------------------------------------------------------------
- * Step 1: parse the pattern string to produce an array
- * of Patterns. The array is generated backwards, so
- * that the lowest-indexed pattern corresponds to the last
- * event that must occur.
+ * Step 1: parse the pattern string to produce an array of Patterns. The
+ * array is generated backwards, so that the lowest-indexed pattern
+ * corresponds to the last event that must occur.
*-------------------------------------------------------------
*/
@@ -4065,7 +4013,7 @@ FindSequence(interp, patternTablePtr, object, eventString, create,
if (eventMask & VirtualEventMask) {
if (allowVirtual == 0) {
- Tcl_SetResult(interp,
+ Tcl_SetResult(interp,
"virtual event not allowed in definition of another virtual event",
TCL_STATIC);
return NULL;
@@ -4087,8 +4035,8 @@ FindSequence(interp, patternTablePtr, object, eventString, create,
/*
*-------------------------------------------------------------
- * Step 2: find the sequence in the binding table if it exists,
- * and add a new sequence to the table if it doesn't.
+ * Step 2: find the sequence in the binding table if it exists, and add a
+ * new sequence to the table if it doesn't.
*-------------------------------------------------------------
*/
@@ -4101,15 +4049,15 @@ FindSequence(interp, patternTablePtr, object, eventString, create,
TCL_STATIC);
return NULL;
}
-
+
patPtr = &pats[EVENT_BUFFER_SIZE-numPats];
memset(&key, 0, sizeof(key));
key.object = object;
key.type = patPtr->eventType;
key.detail = patPtr->detail;
- hPtr = Tcl_CreateHashEntry(patternTablePtr, (char *) &key, &new);
+ hPtr = Tcl_CreateHashEntry(patternTablePtr, (char *) &key, &isNew);
sequenceSize = numPats*sizeof(Pattern);
- if (!new) {
+ if (!isNew) {
for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr); psPtr != NULL;
psPtr = psPtr->nextSeqPtr) {
if ((numPats == psPtr->numPats)
@@ -4121,17 +4069,18 @@ FindSequence(interp, patternTablePtr, object, eventString, create,
}
}
if (!create) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(hPtr);
}
+
/*
- * No binding exists for the sequence, so return an empty error.
- * This is a special error that the caller will check for in order
- * to silently ignore this case. This is a hack that maintains
- * backward compatibility for Tk_GetBinding but the various "bind"
- * commands silently ignore missing bindings.
+ * No binding exists for the sequence, so return an empty error. This
+ * is a special error that the caller will check for in order to
+ * silently ignore this case. This is a hack that maintains backward
+ * compatibility for Tk_GetBinding but the various "bind" commands
+ * silently ignore missing bindings.
*/
-
+
return NULL;
}
psPtr = (PatSeq *) ckalloc((unsigned) (sizeof(PatSeq)
@@ -4148,9 +4097,9 @@ FindSequence(interp, patternTablePtr, object, eventString, create,
psPtr->nextObjPtr = NULL;
Tcl_SetHashValue(hPtr, psPtr);
- memcpy((VOID *) psPtr->pats, (VOID *) patPtr, sequenceSize);
+ memcpy((void *) psPtr->pats, (void *) patPtr, sequenceSize);
- done:
+ done:
*maskPtr = eventMask;
return psPtr;
}
@@ -4160,34 +4109,31 @@ FindSequence(interp, patternTablePtr, object, eventString, create,
*
* ParseEventDescription --
*
- * Fill Pattern buffer with information about event from
- * event string.
+ * Fill Pattern buffer with information about event from event string.
*
* Results:
- * Leaves error message in interp and returns 0 if there was an
- * error due to a badly formed event string. Returns 1 if proper
- * event was specified, 2 if Double modifier was used in event
- * string, or 3 if Triple was used.
+ * Leaves error message in interp and returns 0 if there was an error due
+ * to a badly formed event string. Returns 1 if proper event was
+ * specified, 2 if Double modifier was used in event string, or 3 if
+ * Triple was used.
*
* Side effects:
* On exit, eventStringPtr points to rest of event string (after the
- * closing '>', so that this procedure can be called repeatedly to
- * parse all the events in the entire sequence.
+ * closing '>', so that this function can be called repeatedly to parse
+ * all the events in the entire sequence.
*
*---------------------------------------------------------------------------
*/
static int
-ParseEventDescription(interp, eventStringPtr, patPtr,
- eventMaskPtr)
- Tcl_Interp *interp; /* For error messages. */
- CONST char **eventStringPtr;/* On input, holds a pointer to start of
- * event string. On exit, gets pointer to
- * rest of string after parsed event. */
- Pattern *patPtr; /* Filled with the pattern parsed from the
+ParseEventDescription(
+ Tcl_Interp *interp, /* For error messages. */
+ const char **eventStringPtr,/* On input, holds a pointer to start of event
+ * string. On exit, gets pointer to rest of
+ * string after parsed event. */
+ Pattern *patPtr, /* Filled with the pattern parsed from the
* event string. */
- unsigned long *eventMaskPtr;/* Filled with event mask of matched event. */
-
+ unsigned long *eventMaskPtr)/* Filled with event mask of matched event. */
{
char *p;
unsigned long eventMask;
@@ -4206,7 +4152,7 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
eventMask = 0;
count = 1;
-
+
/*
* Handle simple ASCII characters.
*/
@@ -4224,7 +4170,7 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
patPtr->detail.keySym = *p;
} else {
char buf[64];
-
+
sprintf(buf, "bad ASCII character 0x%x", (unsigned char) *p);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
count = 0;
@@ -4236,8 +4182,8 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
}
/*
- * A fancier event description. This can be either a virtual event
- * or a physical event.
+ * A fancier event description. This can be either a virtual event or a
+ * physical event.
*
* A virtual event description consists of:
*
@@ -4248,30 +4194,30 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
* A physical event description consists of:
*
* 1. open angle bracket.
- * 2. any number of modifiers, each followed by spaces
- * or dashes.
+ * 2. any number of modifiers, each followed by spaces or dashes.
* 3. an optional event name.
- * 4. an option button or keysym name. Either this or
- * item 3 *must* be present; if both are present
- * then they are separated by spaces or dashes.
+ * 4. an option button or keysym name. Either this or item 3 *must* be
+ * present; if both are present then they are separated by spaces or
+ * dashes.
* 5. a close angle bracket.
*/
p++;
if (*p == '<') {
/*
- * This is a virtual event: soak up all the characters up to
- * the next '>'.
+ * This is a virtual event: soak up all the characters up to the next
+ * '>'.
*/
- char *field = p + 1;
+ char *field = p + 1;
+
p = strchr(field, '>');
if (p == field) {
Tcl_SetResult(interp, "virtual event \"<<>>\" is badly formed",
TCL_STATIC);
count = 0;
goto done;
- }
+ }
if ((p == NULL) || (p[1] != '>')) {
Tcl_SetResult(interp, "missing \">\" in virtual binding",
TCL_STATIC);
@@ -4290,13 +4236,15 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
while (1) {
ModInfo *modPtr;
+
p = GetField(p, field, FIELD_SIZE);
if (*p == '>') {
/*
* This solves the problem of, e.g., <Control-M> being
- * misinterpreted as Control + Meta + missing keysym
- * instead of Control + KeyPress + M.
+ * misinterpreted as Control + Meta + missing keysym instead of
+ * Control + KeyPress + M.
*/
+
break;
}
hPtr = Tcl_FindHashEntry(&modTable, field);
@@ -4305,10 +4253,13 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
}
modPtr = (ModInfo *) Tcl_GetHashValue(hPtr);
patPtr->needMods |= modPtr->mask;
- if (modPtr->flags & (MULT_CLICKS)) {
+ if (modPtr->flags & MULT_CLICKS) {
int i = modPtr->flags & MULT_CLICKS;
+
count = 2;
- while (i >>= 1) count++;
+ while (i >>= 1) {
+ count++;
+ }
}
while ((*p == '-') || isspace(UCHAR(*p))) {
p++;
@@ -4318,8 +4269,7 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
eventFlags = 0;
hPtr = Tcl_FindHashEntry(&eventTable, field);
if (hPtr != NULL) {
- EventInfo *eiPtr;
- eiPtr = (EventInfo *) Tcl_GetHashValue(hPtr);
+ EventInfo *eiPtr = (EventInfo *) Tcl_GetHashValue(hPtr);
patPtr->eventType = eiPtr->type;
eventFlags = flagArray[eiPtr->type];
@@ -4338,17 +4288,18 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
goto getKeysym;
} else if ((eventFlags & BUTTON) == 0) {
Tcl_AppendResult(interp, "specified button \"", field,
- "\" for non-button event", (char *) NULL);
+ "\" for non-button event", NULL);
count = 0;
goto done;
}
patPtr->detail.button = (*field - '0');
} else {
- getKeysym:
+
+ getKeysym:
patPtr->detail.keySym = TkStringToKeysym(field);
if (patPtr->detail.keySym == NoSymbol) {
Tcl_AppendResult(interp, "bad event type or keysym \"",
- field, "\"", (char *) NULL);
+ field, "\"", NULL);
count = 0;
goto done;
}
@@ -4357,7 +4308,7 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
eventMask = KeyPressMask;
} else if ((eventFlags & KEY) == 0) {
Tcl_AppendResult(interp, "specified keysym \"", field,
- "\" for non-key event", (char *) NULL);
+ "\" for non-key event", NULL);
count = 0;
goto done;
}
@@ -4389,10 +4340,10 @@ ParseEventDescription(interp, eventStringPtr, patPtr,
}
p++;
-end:
+ end:
*eventStringPtr += (p - Tcl_DStringValue(&copy));
*eventMaskPtr |= eventMask;
-done:
+ done:
Tcl_DStringFree(&copy);
return count;
}
@@ -4402,17 +4353,15 @@ done:
*
* GetField --
*
- * Used to parse pattern descriptions. Copies up to
- * size characters from p to copy, stopping at end of
- * string, space, "-", ">", or whenever size is
- * exceeded.
+ * Used to parse pattern descriptions. Copies up to size characters from
+ * p to copy, stopping at end of string, space, "-", ">", or whenever
+ * size is exceeded.
*
* Results:
- * The return value is a pointer to the character just
- * after the last one copied (usually "-" or space or
- * ">", but could be anything if size was exceeded).
- * Also places NULL-terminated string (up to size
- * character, including NULL), at copy.
+ * The return value is a pointer to the character just after the last one
+ * copied (usually "-" or space or ">", but could be anything if size was
+ * exceeded). Also places NULL-terminated string (up to size character,
+ * including NULL), at copy.
*
* Side effects:
* None.
@@ -4421,11 +4370,10 @@ done:
*/
static char *
-GetField(p, copy, size)
- char *p; /* Pointer to part of pattern. */
- char *copy; /* Place to copy field. */
- int size; /* Maximum number of characters to
- * copy. */
+GetField(
+ char *p, /* Pointer to part of pattern. */
+ char *copy, /* Place to copy field. */
+ int size) /* Maximum number of characters to copy. */
{
while ((*p != '\0') && !isspace(UCHAR(*p)) && (*p != '>')
&& (*p != '-') && (size > 1)) {
@@ -4443,22 +4391,23 @@ GetField(p, copy, size)
*
* GetPatternString --
*
- * Produce a string version of the given event, for displaying to
- * the user.
+ * Produce a string version of the given event, for displaying to the
+ * user.
*
* Results:
* The string is left in dsPtr.
*
* Side effects:
- * It is the caller's responsibility to initialize the DString before
- * and to free it after calling this procedure.
+ * It is the caller's responsibility to initialize the DString before and
+ * to free it after calling this function.
*
*---------------------------------------------------------------------------
*/
+
static void
-GetPatternString(psPtr, dsPtr)
- PatSeq *psPtr;
- Tcl_DString *dsPtr;
+GetPatternString(
+ PatSeq *psPtr,
+ Tcl_DString *dsPtr)
{
Pattern *patPtr;
char c, buffer[TCL_INTEGER_SPACE];
@@ -4473,19 +4422,17 @@ GetPatternString(psPtr, dsPtr)
for (patsLeft = psPtr->numPats, patPtr = &psPtr->pats[psPtr->numPats - 1];
patsLeft > 0; patsLeft--, patPtr--) {
-
/*
* Check for simple case of an ASCII character.
*/
if ((patPtr->eventType == KeyPress)
- && ((psPtr->flags & PAT_NEARBY) == 0)
+ && ((psPtr->flags & PAT_NEARBY) == 0)
&& (patPtr->needMods == 0)
&& (patPtr->detail.keySym < 128)
&& isprint(UCHAR(patPtr->detail.keySym))
&& (patPtr->detail.keySym != '<')
&& (patPtr->detail.keySym != ' ')) {
-
c = (char) patPtr->detail.keySym;
Tcl_DStringAppend(dsPtr, &c, 1);
continue;
@@ -4503,12 +4450,13 @@ GetPatternString(psPtr, dsPtr)
}
/*
- * It's a more general event specification. First check
- * for "Double", "Triple", "Quadruple", then modifiers,
- * then event type, then keysym or button detail.
+ * It's a more general event specification. First check for "Double",
+ * "Triple", "Quadruple", then modifiers, then event type, then keysym
+ * or button detail.
*/
Tcl_DStringAppend(dsPtr, "<", 1);
+
if ((psPtr->flags & PAT_NEARBY) && (patsLeft > 1)
&& (memcmp((char *) patPtr, (char *) (patPtr-1),
sizeof(Pattern)) == 0)) {
@@ -4530,6 +4478,7 @@ GetPatternString(psPtr, dsPtr)
Tcl_DStringAppend(dsPtr, "Double-", 7);
}
}
+
for (needMods = patPtr->needMods, modPtr = modArray;
needMods != 0; modPtr++) {
if (modPtr->mask & needMods) {
@@ -4538,6 +4487,7 @@ GetPatternString(psPtr, dsPtr)
Tcl_DStringAppend(dsPtr, "-", 1);
}
}
+
for (eiPtr = eventArray; eiPtr->name != NULL; eiPtr++) {
if (eiPtr->type == patPtr->eventType) {
Tcl_DStringAppend(dsPtr, eiPtr->name, -1);
@@ -4551,9 +4501,7 @@ GetPatternString(psPtr, dsPtr)
if (patPtr->detail.clientData != 0) {
if ((patPtr->eventType == KeyPress)
|| (patPtr->eventType == KeyRelease)) {
- char *string;
-
- string = TkKeysymToString(patPtr->detail.keySym);
+ char *string = TkKeysymToString(patPtr->detail.keySym);
if (string != NULL) {
Tcl_DStringAppend(dsPtr, string, -1);
}
@@ -4562,6 +4510,7 @@ GetPatternString(psPtr, dsPtr)
Tcl_DStringAppend(dsPtr, buffer, -1);
}
}
+
Tcl_DStringAppend(dsPtr, ">", 1);
}
}
@@ -4571,8 +4520,8 @@ GetPatternString(psPtr, dsPtr)
*
* EvalTclBinding --
*
- * The procedure that is invoked by Tk_BindEvent when a Tcl binding
- * is fired.
+ * The function that is invoked by Tk_BindEvent when a Tcl binding is
+ * fired.
*
* Results:
* A standard Tcl result code, the result of globally evaluating the
@@ -4585,8 +4534,8 @@ GetPatternString(psPtr, dsPtr)
*/
static void
-FreeTclBinding(clientData)
- ClientData clientData;
+FreeTclBinding(
+ ClientData clientData)
{
ckfree((char *) clientData);
}
@@ -4596,12 +4545,11 @@ FreeTclBinding(clientData)
*
* TkStringToKeysym --
*
- * This procedure finds the keysym associated with a given keysym
- * name.
+ * This function finds the keysym associated with a given keysym name.
*
* Results:
- * The return value is the keysym that corresponds to name, or
- * NoSymbol if there is no such keysym.
+ * The return value is the keysym that corresponds to name, or NoSymbol
+ * if there is no such keysym.
*
* Side effects:
* None.
@@ -4610,19 +4558,18 @@ FreeTclBinding(clientData)
*/
KeySym
-TkStringToKeysym(name)
- char *name; /* Name of a keysym. */
+TkStringToKeysym(
+ char *name) /* Name of a keysym. */
{
#ifdef REDO_KEYSYM_LOOKUP
- Tcl_HashEntry *hPtr;
- KeySym keysym;
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&keySymTable, name);
- hPtr = Tcl_FindHashEntry(&keySymTable, name);
if (hPtr != NULL) {
return (KeySym) Tcl_GetHashValue(hPtr);
}
if (strlen(name) == 1) {
- keysym = (KeySym) (unsigned char) name[0];
+ KeySym keysym = (KeySym) (unsigned char) name[0];
+
if (TkKeysymToString(keysym) != NULL) {
return keysym;
}
@@ -4636,12 +4583,11 @@ TkStringToKeysym(name)
*
* TkKeysymToString --
*
- * This procedure finds the keysym name associated with a given
- * keysym.
+ * This function finds the keysym name associated with a given keysym.
*
* Results:
- * The return value is a pointer to a static string containing
- * the name of the given keysym, or NULL if there is no known name.
+ * The return value is a pointer to a static string containing the name
+ * of the given keysym, or NULL if there is no known name.
*
* Side effects:
* None.
@@ -4650,17 +4596,17 @@ TkStringToKeysym(name)
*/
char *
-TkKeysymToString(keysym)
- KeySym keysym;
+TkKeysymToString(
+ KeySym keysym)
{
#ifdef REDO_KEYSYM_LOOKUP
- Tcl_HashEntry *hPtr;
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
- hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
if (hPtr != NULL) {
return (char *) Tcl_GetHashValue(hPtr);
}
#endif /* REDO_KEYSYM_LOOKUP */
+
return XKeysymToString(keysym);
}
@@ -4669,25 +4615,24 @@ TkKeysymToString(keysym)
*
* TkCopyAndGlobalEval --
*
- * This procedure makes a copy of a script then passes to Tcl
- * to evaluate it. It's used in situations where the execution of
- * a command may cause the original command string to be reallocated.
+ * This function makes a copy of a script then calls Tcl_GlobalEval to
+ * evaluate it. It's used in situations where the execution of a command
+ * may cause the original command string to be reallocated.
*
* Results:
- * Returns the result of evaluating script, including both a standard
- * Tcl completion code and a string in the interp's result.
+ * Returns the result of evaluating script, including both a standard Tcl
+ * completion code and a string in the interp's result.
*
* Side effects:
- * None.
+ * Any; depends on script.
*
*----------------------------------------------------------------------
*/
int
-TkCopyAndGlobalEval(interp, script)
- Tcl_Interp *interp; /* Interpreter in which to evaluate
- * script. */
- char *script; /* Script to evaluate. */
+TkCopyAndGlobalEval(
+ Tcl_Interp *interp, /* Interpreter in which to evaluate script. */
+ char *script) /* Script to evaluate. */
{
Tcl_DString buffer;
int code;
@@ -4699,5 +4644,40 @@ TkCopyAndGlobalEval(interp, script)
Tcl_DStringFree(&buffer);
return code;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetBindingXEvent --
+ *
+ * This function returns the XEvent associated with the currently
+ * executing binding. This function can only be invoked while a binding
+ * is executing.
+ *
+ * Results:
+ * Returns a pointer to the XEvent that caused the current binding code
+ * to be run.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+XEvent *
+TkpGetBindingXEvent(
+ Tcl_Interp *interp) /* Interpreter. */
+{
+ TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
+ BindingTable *bindPtr = (BindingTable *) winPtr->mainPtr->bindingTable;
+ return &(bindPtr->eventRing[bindPtr->curEvent]);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index 5c8a9fc..09545d6 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -1,43 +1,42 @@
-/*
+/*
* tkBitmap.c --
*
* This file maintains a database of read-only bitmaps for the Tk
- * toolkit. This allows bitmaps to be shared between widgets and
- * also avoids interactions with the X server.
+ * toolkit. This allows bitmaps to be shared between widgets and also
+ * avoids interactions with the X server.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
* The includes below are for pre-defined bitmaps.
*
- * Platform-specific issue: Windows complains when the bitmaps are
- * included, because an array of characters is being initialized with
- * integers as elements. For lint purposes, the following pragmas
- * temporarily turn off that warning message.
+ * Platform-specific issue: Windows complains when the bitmaps are included,
+ * because an array of characters is being initialized with integers as
+ * elements. For lint purposes, the following pragmas temporarily turn off
+ * that warning message.
*/
#if defined(_MSC_VER)
#pragma warning (disable : 4305)
#endif
-#include "error.bmp"
-#include "gray12.bmp"
-#include "gray25.bmp"
-#include "gray50.bmp"
-#include "gray75.bmp"
-#include "hourglass.bmp"
-#include "info.bmp"
-#include "questhead.bmp"
-#include "question.bmp"
-#include "warning.bmp"
+#include "error.xbm"
+#include "gray12.xbm"
+#include "gray25.xbm"
+#include "gray50.xbm"
+#include "gray75.xbm"
+#include "hourglass.xbm"
+#include "info.xbm"
+#include "questhead.xbm"
+#include "question.xbm"
+#include "warning.xbm"
#if defined(_MSC_VER)
#pragma warning (default : 4305)
@@ -45,82 +44,80 @@
/*
* One of the following data structures exists for each bitmap that is
- * currently in use. Each structure is indexed with both "idTable" and
+ * currently in use. Each structure is indexed with both "idTable" and
* "nameTable".
*/
typedef struct TkBitmap {
- Pixmap bitmap; /* X identifier for bitmap. None means this
- * bitmap was created by Tk_DefineBitmap
- * and it isn't currently in use. */
+ Pixmap bitmap; /* X identifier for bitmap. None means this
+ * bitmap was created by Tk_DefineBitmap and
+ * it isn't currently in use. */
int width, height; /* Dimensions of bitmap. */
Display *display; /* Display for which bitmap is valid. */
- int screenNum; /* Screen on which bitmap is valid */
+ int screenNum; /* Screen on which bitmap is valid. */
int resourceRefCount; /* Number of active uses of this bitmap (each
* active use corresponds to a call to
- * Tk_AllocBitmapFromObj or Tk_GetBitmap).
- * If this count is 0, then this TkBitmap
+ * Tk_AllocBitmapFromObj or Tk_GetBitmap). If
+ * this count is 0, then this TkBitmap
* structure is no longer valid and it isn't
* present in nameTable: it is being kept
* around only because there are objects
- * referring to it. The structure is freed
- * when resourceRefCount and objRefCount
- * are both 0. */
- int objRefCount; /* Number of Tcl_Obj's that reference
- * this structure. */
+ * referring to it. The structure is freed
+ * when resourceRefCount and objRefCount are
+ * both 0. */
+ int objRefCount; /* Number of Tcl_Obj's that reference this
+ * structure. */
Tcl_HashEntry *nameHashPtr; /* Entry in nameTable for this structure
* (needed when deleting). */
- Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure
- * (needed when deleting). */
+ Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure (needed
+ * when deleting). */
struct TkBitmap *nextPtr; /* Points to the next TkBitmap structure with
- * the same name. All bitmaps with the
- * same name (but different displays or
- * screens) are chained together off a
- * single entry in nameTable. */
+ * the same name. All bitmaps with the same
+ * name (but different displays or screens)
+ * are chained together off a single entry in
+ * nameTable. */
} TkBitmap;
-/*
- * Used in bitmapDataTable, stored in the TkDisplay structure, to map
- * between in-core data about a bitmap to its TkBitmap structure.
+/*
+ * Used in bitmapDataTable, stored in the TkDisplay structure, to map between
+ * in-core data about a bitmap to its TkBitmap structure.
*/
typedef struct {
- CONST char *source; /* Bitmap bits. */
+ const char *source; /* Bitmap bits. */
int width, height; /* Dimensions of bitmap. */
} DataKey;
typedef struct ThreadSpecificData {
- int initialized; /* 0 means table below needs initializing. */
+ int initialized; /* 0 means table below needs initializing. */
Tcl_HashTable predefBitmapTable;
- /* Hash table created by Tk_DefineBitmap
- * to map from a name to a collection
- * of in-core data about a bitmap. The
- * table is indexed by the address of the
- * data for the bitmap, and the entries
- * contain pointers to TkPredefBitmap
- * structures. */
+ /* Hash table created by Tk_DefineBitmap to
+ * map from a name to a collection of in-core
+ * data about a bitmap. The table is indexed
+ * by the address of the data for the bitmap,
+ * and the entries contain pointers to
+ * TkPredefBitmap structures. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void BitmapInit _ANSI_ARGS_((TkDisplay *dispPtr));
-static void DupBitmapObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr,
- Tcl_Obj *dupObjPtr));
-static void FreeBitmap _ANSI_ARGS_((TkBitmap *bitmapPtr));
-static void FreeBitmapObjProc _ANSI_ARGS_((Tcl_Obj *objPtr));
-static TkBitmap * GetBitmap _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *name));
-static TkBitmap * GetBitmapFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj *objPtr));
-static void InitBitmapObj _ANSI_ARGS_((Tcl_Obj *objPtr));
+static void BitmapInit(TkDisplay *dispPtr);
+static void DupBitmapObjProc(Tcl_Obj *srcObjPtr,
+ Tcl_Obj *dupObjPtr);
+static void FreeBitmap(TkBitmap *bitmapPtr);
+static void FreeBitmapObjProc(Tcl_Obj *objPtr);
+static TkBitmap * GetBitmap(Tcl_Interp *interp, Tk_Window tkwin,
+ const char *name);
+static TkBitmap * GetBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+static void InitBitmapObj(Tcl_Obj *objPtr);
/*
* The following structure defines the implementation of the "bitmap" Tcl
- * object, which maps a string bitmap name to a TkBitmap object. The
- * ptr1 field of the Tcl_Obj points to a TkBitmap object.
+ * object, which maps a string bitmap name to a TkBitmap object. The ptr1
+ * field of the Tcl_Obj points to a TkBitmap object.
*/
Tcl_ObjType tkBitmapObjType = {
@@ -136,33 +133,33 @@ Tcl_ObjType tkBitmapObjType = {
*
* Tk_AllocBitmapFromObj --
*
- * Given a Tcl_Obj *, map the value to a corresponding
- * Pixmap structure based on the tkwin given.
+ * Given a Tcl_Obj *, map the value to a corresponding Pixmap structure
+ * based on the tkwin given.
*
* Results:
- * The return value is the X identifer for the desired bitmap
- * (i.e. a Pixmap with a single plane), unless string couldn't be
- * parsed correctly. In this case, None is returned and an error
- * message is left in the interp's result. The caller should never
- * modify the bitmap that is returned, and should eventually call
- * Tk_FreeBitmapFromObj when the bitmap is no longer needed.
+ * The return value is the X identifer for the desired bitmap (i.e. a
+ * Pixmap with a single plane), unless string couldn't be parsed
+ * correctly. In this case, None is returned and an error message is left
+ * in the interp's result. The caller should never modify the bitmap that
+ * is returned, and should eventually call Tk_FreeBitmapFromObj when the
+ * bitmap is no longer needed.
*
* Side effects:
* The bitmap is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeBitmapFromObj, so that the database can be cleaned up
- * when bitmaps aren't needed anymore.
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeBitmapFromObj, so that the database can be cleaned up when
+ * bitmaps aren't needed anymore.
*
*----------------------------------------------------------------------
*/
Pixmap
-Tk_AllocBitmapFromObj(interp, tkwin, objPtr)
- Tcl_Interp *interp; /* Interp for error results. This may
- * be NULL. */
- Tk_Window tkwin; /* Need the screen the bitmap is used on.*/
- Tcl_Obj *objPtr; /* Object describing bitmap; see manual
- * entry for legal syntax of string value. */
+Tk_AllocBitmapFromObj(
+ Tcl_Interp *interp, /* Interp for error results. This may be
+ * NULL. */
+ Tk_Window tkwin, /* Need the screen the bitmap is used on.*/
+ Tcl_Obj *objPtr) /* Object describing bitmap; see manual entry
+ * for legal syntax of string value. */
{
TkBitmap *bitmapPtr;
@@ -172,54 +169,54 @@ Tk_AllocBitmapFromObj(interp, tkwin, objPtr)
bitmapPtr = (TkBitmap *) objPtr->internalRep.twoPtrValue.ptr1;
/*
- * If the object currently points to a TkBitmap, see if it's the
- * one we want. If so, increment its reference count and return.
+ * If the object currently points to a TkBitmap, see if it's the one we
+ * want. If so, increment its reference count and return.
*/
if (bitmapPtr != NULL) {
if (bitmapPtr->resourceRefCount == 0) {
/*
- * This is a stale reference: it refers to a TkBitmap that's
- * no longer in use. Clear the reference.
+ * This is a stale reference: it refers to a TkBitmap that's no
+ * longer in use. Clear the reference.
*/
FreeBitmapObjProc(objPtr);
bitmapPtr = NULL;
- } else if ( (Tk_Display(tkwin) == bitmapPtr->display)
- && (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) {
+ } else if ((Tk_Display(tkwin) == bitmapPtr->display)
+ && (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum)) {
bitmapPtr->resourceRefCount++;
return bitmapPtr->bitmap;
}
}
/*
- * The object didn't point to the TkBitmap that we wanted. Search
- * the list of TkBitmaps with the same name to see if one of the
- * others is the right one.
+ * The object didn't point to the TkBitmap that we wanted. Search the list
+ * of TkBitmaps with the same name to see if one of the others is the
+ * right one.
*/
if (bitmapPtr != NULL) {
- TkBitmap *firstBitmapPtr =
- (TkBitmap *) Tcl_GetHashValue(bitmapPtr->nameHashPtr);
+ TkBitmap *firstBitmapPtr = (TkBitmap *)
+ Tcl_GetHashValue(bitmapPtr->nameHashPtr);
FreeBitmapObjProc(objPtr);
for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
- if ( (Tk_Display(tkwin) == bitmapPtr->display) &&
- (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) {
+ if ((Tk_Display(tkwin) == bitmapPtr->display) &&
+ (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum)) {
bitmapPtr->resourceRefCount++;
bitmapPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) bitmapPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) bitmapPtr;
return bitmapPtr->bitmap;
}
}
}
/*
- * Still no luck. Call GetBitmap to allocate a new TkBitmap object.
+ * Still no luck. Call GetBitmap to allocate a new TkBitmap object.
*/
bitmapPtr = GetBitmap(interp, tkwin, Tcl_GetString(objPtr));
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) bitmapPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) bitmapPtr;
if (bitmapPtr == NULL) {
return None;
}
@@ -232,35 +229,36 @@ Tk_AllocBitmapFromObj(interp, tkwin, objPtr)
*
* Tk_GetBitmap --
*
- * Given a string describing a bitmap, locate (or create if necessary)
- * a bitmap that fits the description.
+ * Given a string describing a bitmap, locate (or create if necessary) a
+ * bitmap that fits the description.
*
* Results:
- * The return value is the X identifer for the desired bitmap
- * (i.e. a Pixmap with a single plane), unless string couldn't be
- * parsed correctly. In this case, None is returned and an error
- * message is left in the interp's result. The caller should never
- * modify the bitmap that is returned, and should eventually call
- * Tk_FreeBitmap when the bitmap is no longer needed.
+ * The return value is the X identifer for the desired bitmap (i.e. a
+ * Pixmap with a single plane), unless string couldn't be parsed
+ * correctly. In this case, None is returned and an error message is left
+ * in the interp's result. The caller should never modify the bitmap that
+ * is returned, and should eventually call Tk_FreeBitmap when the bitmap
+ * is no longer needed.
*
* Side effects:
* The bitmap is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeBitmap, so that the database can be cleaned up when bitmaps
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeBitmap, so that the database can be cleaned up when bitmaps
* aren't needed anymore.
*
*----------------------------------------------------------------------
*/
Pixmap
-Tk_GetBitmap(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting,
+Tk_GetBitmap(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting,
* this may be NULL. */
- Tk_Window tkwin; /* Window in which bitmap will be used. */
- CONST char *string; /* Description of bitmap. See manual entry
- * for details on legal syntax. */
+ Tk_Window tkwin, /* Window in which bitmap will be used. */
+ const char *string) /* Description of bitmap. See manual entry for
+ * details on legal syntax. */
{
TkBitmap *bitmapPtr = GetBitmap(interp, tkwin, string);
+
if (bitmapPtr == NULL) {
return None;
}
@@ -272,53 +270,52 @@ Tk_GetBitmap(interp, tkwin, string)
*
* GetBitmap --
*
- * Given a string describing a bitmap, locate (or create if necessary)
- * a bitmap that fits the description. This routine returns the
- * internal data structure for the bitmap. This avoids extra
- * hash table lookups in Tk_AllocBitmapFromObj.
+ * Given a string describing a bitmap, locate (or create if necessary) a
+ * bitmap that fits the description. This routine returns the internal
+ * data structure for the bitmap. This avoids extra hash table lookups in
+ * Tk_AllocBitmapFromObj.
*
* Results:
- * The return value is the X identifer for the desired bitmap
- * (i.e. a Pixmap with a single plane), unless string couldn't be
- * parsed correctly. In this case, None is returned and an error
- * message is left in the interp's result. The caller should never
- * modify the bitmap that is returned, and should eventually call
- * Tk_FreeBitmap when the bitmap is no longer needed.
+ * The return value is the X identifer for the desired bitmap (i.e. a
+ * Pixmap with a single plane), unless string couldn't be parsed
+ * correctly. In this case, None is returned and an error message is left
+ * in the interp's result. The caller should never modify the bitmap that
+ * is returned, and should eventually call Tk_FreeBitmap when the bitmap
+ * is no longer needed.
*
* Side effects:
* The bitmap is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeBitmap or Tk_FreeBitmapFromObj, so that the database can
- * be cleaned up when bitmaps aren't needed anymore.
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeBitmap or Tk_FreeBitmapFromObj, so that the database can be
+ * cleaned up when bitmaps aren't needed anymore.
*
*----------------------------------------------------------------------
*/
static TkBitmap *
-GetBitmap(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting,
+GetBitmap(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting,
* this may be NULL. */
- Tk_Window tkwin; /* Window in which bitmap will be used. */
- CONST char *string; /* Description of bitmap. See manual entry
- * for details on legal syntax. */
+ Tk_Window tkwin, /* Window in which bitmap will be used. */
+ const char *string) /* Description of bitmap. See manual entry for
+ * details on legal syntax. */
{
Tcl_HashEntry *nameHashPtr, *predefHashPtr;
TkBitmap *bitmapPtr, *existingBitmapPtr;
TkPredefBitmap *predefPtr;
- int new;
Pixmap bitmap;
- int width, height;
- int dummy2;
+ int isNew, width, height, dummy2;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!dispPtr->bitmapInit) {
BitmapInit(dispPtr);
}
- nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string, &new);
- if (!new) {
+ nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string,
+ &isNew);
+ if (!isNew) {
existingBitmapPtr = (TkBitmap *) Tcl_GetHashValue(nameHashPtr);
for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
@@ -333,26 +330,25 @@ GetBitmap(interp, tkwin, string)
}
/*
- * No suitable bitmap exists. Create a new bitmap from the
- * information contained in the string. If the string starts
- * with "@" then the rest of the string is a file name containing
- * the bitmap. Otherwise the string must refer to a bitmap
- * defined by a call to Tk_DefineBitmap.
+ * No suitable bitmap exists. Create a new bitmap from the information
+ * contained in the string. If the string starts with "@" then the rest of
+ * the string is a file name containing the bitmap. Otherwise the string
+ * must refer to a bitmap defined by a call to Tk_DefineBitmap.
*/
if (*string == '@') { /* INTL: ISO char */
Tcl_DString buffer;
int result;
- if (Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't specify bitmap with '@' in a",
- " safe interpreter", (char *) NULL);
- goto error;
- }
+ if (Tcl_IsSafe(interp)) {
+ Tcl_AppendResult(interp, "can't specify bitmap with '@' in a",
+ " safe interpreter", NULL);
+ goto error;
+ }
/*
- * Note that we need to cast away the CONST from the string because
- * Tcl_TranslateFileName is non const, even though it doesn't modify
+ * Note that we need to cast away the const from the string because
+ * Tcl_TranslateFileName is non-const, even though it doesn't modify
* the string.
*/
@@ -366,29 +362,29 @@ GetBitmap(interp, tkwin, string)
&bitmap, &dummy2, &dummy2);
if (result != BitmapSuccess) {
if (interp != NULL) {
- Tcl_AppendResult(interp, "error reading bitmap file \"", string,
- "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "error reading bitmap file \"",
+ string, "\"", NULL);
}
Tcl_DStringFree(&buffer);
goto error;
}
Tcl_DStringFree(&buffer);
} else {
- predefHashPtr = Tcl_FindHashEntry(&tsdPtr->predefBitmapTable,
- string);
+ predefHashPtr = Tcl_FindHashEntry(&tsdPtr->predefBitmapTable, string);
if (predefHashPtr == NULL) {
/*
- * The following platform specific call allows the user to
- * define bitmaps that may only exist during run time. If
- * it returns None nothing was found and we return the error.
+ * The following platform specific call allows the user to define
+ * bitmaps that may only exist during run time. If it returns None
+ * nothing was found and we return the error.
*/
+
bitmap = TkpGetNativeAppBitmap(Tk_Display(tkwin), string,
&width, &height);
-
+
if (bitmap == None) {
if (interp != NULL) {
Tcl_AppendResult(interp, "bitmap \"", string,
- "\" not defined", (char *) NULL);
+ "\" not defined", NULL);
}
goto error;
}
@@ -400,13 +396,12 @@ GetBitmap(interp, tkwin, string)
bitmap = TkpCreateNativeBitmap(Tk_Display(tkwin),
predefPtr->source);
if (bitmap == None) {
- panic("native bitmap creation failed");
+ Tcl_Panic("native bitmap creation failed");
}
} else {
bitmap = XCreateBitmapFromData(Tk_Display(tkwin),
- RootWindowOfScreen(Tk_Screen(tkwin)),
- predefPtr->source,
- (unsigned) width, (unsigned) height);
+ RootWindowOfScreen(Tk_Screen(tkwin)),
+ predefPtr->source, (unsigned)width, (unsigned)height);
}
}
}
@@ -424,18 +419,18 @@ GetBitmap(interp, tkwin, string)
bitmapPtr->resourceRefCount = 1;
bitmapPtr->objRefCount = 0;
bitmapPtr->nameHashPtr = nameHashPtr;
- bitmapPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapIdTable,
- (char *) bitmap, &new);
- if (!new) {
- panic("bitmap already registered in Tk_GetBitmap");
+ bitmapPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapIdTable,
+ (char *) bitmap, &isNew);
+ if (!isNew) {
+ Tcl_Panic("bitmap already registered in Tk_GetBitmap");
}
bitmapPtr->nextPtr = existingBitmapPtr;
Tcl_SetHashValue(nameHashPtr, bitmapPtr);
Tcl_SetHashValue(bitmapPtr->idHashPtr, bitmapPtr);
return bitmapPtr;
- error:
- if (new) {
+ error:
+ if (isNew) {
Tcl_DeleteHashEntry(nameHashPtr);
}
return NULL;
@@ -446,53 +441,53 @@ GetBitmap(interp, tkwin, string)
*
* Tk_DefineBitmap --
*
- * This procedure associates a textual name with a binary bitmap
- * description, so that the name may be used to refer to the
- * bitmap in future calls to Tk_GetBitmap.
+ * This function associates a textual name with a binary bitmap
+ * description, so that the name may be used to refer to the bitmap in
+ * future calls to Tk_GetBitmap.
*
* Results:
- * A standard Tcl result. If an error occurs then TCL_ERROR is
- * returned and a message is left in the interp's result.
+ * A standard Tcl result. If an error occurs then TCL_ERROR is returned
+ * and a message is left in the interp's result.
*
* Side effects:
- * "Name" is entered into the bitmap table and may be used from
- * here on to refer to the given bitmap.
+ * "Name" is entered into the bitmap table and may be used from here on
+ * to refer to the given bitmap.
*
*----------------------------------------------------------------------
*/
int
-Tk_DefineBitmap(interp, name, source, width, height)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- CONST char *name; /* Name to use for bitmap. Must not already
- * be defined as a bitmap. */
- CONST char *source; /* Address of bits for bitmap. */
- int width; /* Width of bitmap. */
- int height; /* Height of bitmap. */
+Tk_DefineBitmap(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ const char *name, /* Name to use for bitmap. Must not already be
+ * defined as a bitmap. */
+ const char *source, /* Address of bits for bitmap. */
+ int width, /* Width of bitmap. */
+ int height) /* Height of bitmap. */
{
- int new;
+ int isNew;
Tcl_HashEntry *predefHashPtr;
TkPredefBitmap *predefPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- /*
+ /*
* Initialize the Bitmap module if not initialized already for this
- * thread. Since the current TkDisplay structure cannot be
- * introspected from here, pass a NULL pointer to BitmapInit,
- * which will know to initialize only the data in the
- * ThreadSpecificData structure for the current thread.
- */
+ * thread. Since the current TkDisplay structure cannot be introspected
+ * from here, pass a NULL pointer to BitmapInit, which will know to
+ * initialize only the data in the ThreadSpecificData structure for the
+ * current thread.
+ */
if (!tsdPtr->initialized) {
- BitmapInit((TkDisplay *) NULL);
+ BitmapInit(NULL);
}
- predefHashPtr = Tcl_CreateHashEntry(&tsdPtr->predefBitmapTable,
- name, &new);
- if (!new) {
- Tcl_AppendResult(interp, "bitmap \"", name,
- "\" is already defined", (char *) NULL);
+ predefHashPtr = Tcl_CreateHashEntry(&tsdPtr->predefBitmapTable,
+ name, &isNew);
+ if (!isNew) {
+ Tcl_AppendResult(interp, "bitmap \"", name, "\" is already defined",
+ NULL);
return TCL_ERROR;
}
predefPtr = (TkPredefBitmap *) ckalloc(sizeof(TkPredefBitmap));
@@ -509,8 +504,7 @@ Tk_DefineBitmap(interp, name, source, width, height)
*
* Tk_NameOfBitmap --
*
- * Given a bitmap, return a textual string identifying the
- * bitmap.
+ * Given a bitmap, return a textual string identifying the bitmap.
*
* Results:
* The return value is the string name associated with bitmap.
@@ -521,19 +515,18 @@ Tk_DefineBitmap(interp, name, source, width, height)
*--------------------------------------------------------------
*/
-CONST char *
-Tk_NameOfBitmap(display, bitmap)
- Display *display; /* Display for which bitmap was
- * allocated. */
- Pixmap bitmap; /* Bitmap whose name is wanted. */
+const char *
+Tk_NameOfBitmap(
+ Display *display, /* Display for which bitmap was allocated. */
+ Pixmap bitmap) /* Bitmap whose name is wanted. */
{
Tcl_HashEntry *idHashPtr;
TkBitmap *bitmapPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
if (dispPtr == NULL || !dispPtr->bitmapInit) {
- unknown:
- panic("Tk_NameOfBitmap received unknown bitmap argument");
+ unknown:
+ Tcl_Panic("Tk_NameOfBitmap received unknown bitmap argument");
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap);
@@ -549,35 +542,33 @@ Tk_NameOfBitmap(display, bitmap)
*
* Tk_SizeOfBitmap --
*
- * Given a bitmap managed by this module, returns the width
- * and height of the bitmap.
+ * Given a bitmap managed by this module, returns the width and height of
+ * the bitmap.
*
* Results:
- * The words at *widthPtr and *heightPtr are filled in with
- * the dimenstions of bitmap.
+ * The words at *widthPtr and *heightPtr are filled in with the
+ * dimenstions of bitmap.
*
* Side effects:
- * If bitmap isn't managed by this module then the procedure
- * panics..
+ * If bitmap isn't managed by this module then the function panics..
*
*--------------------------------------------------------------
*/
void
-Tk_SizeOfBitmap(display, bitmap, widthPtr, heightPtr)
- Display *display; /* Display for which bitmap was
- * allocated. */
- Pixmap bitmap; /* Bitmap whose size is wanted. */
- int *widthPtr; /* Store bitmap width here. */
- int *heightPtr; /* Store bitmap height here. */
+Tk_SizeOfBitmap(
+ Display *display, /* Display for which bitmap was allocated. */
+ Pixmap bitmap, /* Bitmap whose size is wanted. */
+ int *widthPtr, /* Store bitmap width here. */
+ int *heightPtr) /* Store bitmap height here. */
{
Tcl_HashEntry *idHashPtr;
TkBitmap *bitmapPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
if (!dispPtr->bitmapInit) {
- unknownBitmap:
- panic("Tk_SizeOfBitmap received unknown bitmap argument");
+ unknownBitmap:
+ Tcl_Panic("Tk_SizeOfBitmap received unknown bitmap argument");
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap);
@@ -594,23 +585,23 @@ Tk_SizeOfBitmap(display, bitmap, widthPtr, heightPtr)
*
* FreeBitmap --
*
- * This procedure does all the work of releasing a bitmap allocated by
- * Tk_GetBitmap or TkGetBitmapFromData. It is invoked by both
+ * This function does all the work of releasing a bitmap allocated by
+ * Tk_GetBitmap or TkGetBitmapFromData. It is invoked by both
* Tk_FreeBitmap and Tk_FreeBitmapFromObj
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with bitmap is decremented, and
- * it is officially deallocated if no-one is using it anymore.
+ * The reference count associated with bitmap is decremented, and it is
+ * officially deallocated if no-one is using it anymore.
*
*----------------------------------------------------------------------
*/
static void
-FreeBitmap(bitmapPtr)
- TkBitmap *bitmapPtr; /* Bitmap to be released. */
+FreeBitmap(
+ TkBitmap *bitmapPtr) /* Bitmap to be released. */
{
TkBitmap *prevPtr;
@@ -644,35 +635,34 @@ FreeBitmap(bitmapPtr)
*
* Tk_FreeBitmap --
*
- * This procedure is called to release a bitmap allocated by
- * Tk_GetBitmap or TkGetBitmapFromData.
+ * This function is called to release a bitmap allocated by Tk_GetBitmap
+ * or TkGetBitmapFromData.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with bitmap is decremented, and
- * it is officially deallocated if no-one is using it anymore.
+ * The reference count associated with bitmap is decremented, and it is
+ * officially deallocated if no-one is using it anymore.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeBitmap(display, bitmap)
- Display *display; /* Display for which bitmap was
- * allocated. */
- Pixmap bitmap; /* Bitmap to be released. */
+Tk_FreeBitmap(
+ Display *display, /* Display for which bitmap was allocated. */
+ Pixmap bitmap) /* Bitmap to be released. */
{
Tcl_HashEntry *idHashPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
if (!dispPtr->bitmapInit) {
- panic("Tk_FreeBitmap called before Tk_GetBitmap");
+ Tcl_Panic("Tk_FreeBitmap called before Tk_GetBitmap");
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap);
if (idHashPtr == NULL) {
- panic("Tk_FreeBitmap received unknown bitmap argument");
+ Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument");
}
FreeBitmap((TkBitmap *) Tcl_GetHashValue(idHashPtr));
}
@@ -682,27 +672,27 @@ Tk_FreeBitmap(display, bitmap)
*
* Tk_FreeBitmapFromObj --
*
- * This procedure is called to release a bitmap allocated by
- * Tk_AllocBitmapFromObj. It does not throw away the Tcl_Obj *;
- * it only gets rid of the hash table entry for this bitmap
- * and clears the cached value that is normally stored in the object.
+ * This function is called to release a bitmap allocated by
+ * Tk_AllocBitmapFromObj. It does not throw away the Tcl_Obj *; it only
+ * gets rid of the hash table entry for this bitmap and clears the cached
+ * value that is normally stored in the object.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with the bitmap represented by
- * objPtr is decremented, and the bitmap is released to X if there are
- * no remaining uses for it.
+ * The reference count associated with the bitmap represented by objPtr
+ * is decremented, and the bitmap is released to X if there are no
+ * remaining uses for it.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeBitmapFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* The window this bitmap lives in. Needed
- * for the display value. */
- Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */
+Tk_FreeBitmapFromObj(
+ Tk_Window tkwin, /* The window this bitmap lives in. Needed for
+ * the display value. */
+ Tcl_Obj *objPtr) /* The Tcl_Obj * to be freed. */
{
FreeBitmap(GetBitmapFromObj(tkwin, objPtr));
}
@@ -710,26 +700,25 @@ Tk_FreeBitmapFromObj(tkwin, objPtr)
/*
*---------------------------------------------------------------------------
*
- * FreeBitmapObjProc --
+ * FreeBitmapObjProc --
*
* This proc is called to release an object reference to a bitmap.
- * Called when the object's internal rep is released or when
- * the cached bitmapPtr needs to be changed.
+ * Called when the object's internal rep is released or when the cached
+ * bitmapPtr needs to be changed.
*
* Results:
* None.
*
* Side effects:
- * The object reference count is decremented. When both it
- * and the hash ref count go to zero, the color's resources
- * are released.
+ * The object reference count is decremented. When both it and the hash
+ * ref count go to zero, the color's resources are released.
*
*---------------------------------------------------------------------------
*/
static void
-FreeBitmapObjProc(objPtr)
- Tcl_Obj *objPtr; /* The object we are releasing. */
+FreeBitmapObjProc(
+ Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkBitmap *bitmapPtr = (TkBitmap *) objPtr->internalRep.twoPtrValue.ptr1;
@@ -739,37 +728,37 @@ FreeBitmapObjProc(objPtr)
&& (bitmapPtr->resourceRefCount == 0)) {
ckfree((char *) bitmapPtr);
}
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
}
/*
*---------------------------------------------------------------------------
*
- * DupBitmapObjProc --
+ * DupBitmapObjProc --
*
- * When a cached bitmap object is duplicated, this is called to
- * update the internal reps.
+ * When a cached bitmap object is duplicated, this is called to update
+ * the internal reps.
*
* Results:
* None.
*
* Side effects:
- * The color's objRefCount is incremented and the internal rep
- * of the copy is set to point to it.
+ * The color's objRefCount is incremented and the internal rep of the
+ * copy is set to point to it.
*
*---------------------------------------------------------------------------
*/
static void
-DupBitmapObjProc(srcObjPtr, dupObjPtr)
- Tcl_Obj *srcObjPtr; /* The object we are copying from. */
- Tcl_Obj *dupObjPtr; /* The object we are copying to. */
+DupBitmapObjProc(
+ Tcl_Obj *srcObjPtr, /* The object we are copying from. */
+ Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkBitmap *bitmapPtr = (TkBitmap *) srcObjPtr->internalRep.twoPtrValue.ptr1;
-
+
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (VOID *) bitmapPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) bitmapPtr;
if (bitmapPtr != NULL) {
bitmapPtr->objRefCount++;
@@ -781,22 +770,22 @@ DupBitmapObjProc(srcObjPtr, dupObjPtr)
*
* Tk_GetBitmapFromData --
*
- * Given a description of the bits for a bitmap, make a bitmap that
- * has the given properties. *** NOTE: this procedure is obsolete
- * and really shouldn't be used anymore. ***
+ * Given a description of the bits for a bitmap, make a bitmap that has
+ * the given properties. *** NOTE: this function is obsolete and really
+ * shouldn't be used anymore. ***
*
* Results:
- * The return value is the X identifer for the desired bitmap
- * (a one-plane Pixmap), unless it couldn't be created properly.
- * In this case, None is returned and an error message is left in
- * the interp's result. The caller should never modify the bitmap that
- * is returned, and should eventually call Tk_FreeBitmap when the
- * bitmap is no longer needed.
+ * The return value is the X identifer for the desired bitmap (a
+ * one-plane Pixmap), unless it couldn't be created properly. In this
+ * case, None is returned and an error message is left in the interp's
+ * result. The caller should never modify the bitmap that is returned,
+ * and should eventually call Tk_FreeBitmap when the bitmap is no longer
+ * needed.
*
* Side effects:
* The bitmap is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeBitmap, so that the database can be cleaned up when bitmaps
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeBitmap, so that the database can be cleaned up when bitmaps
* aren't needed anymore.
*
*----------------------------------------------------------------------
@@ -804,15 +793,15 @@ DupBitmapObjProc(srcObjPtr, dupObjPtr)
/* ARGSUSED */
Pixmap
-Tk_GetBitmapFromData(interp, tkwin, source, width, height)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which bitmap will be used. */
- CONST char *source; /* Bitmap data for bitmap shape. */
- int width, height; /* Dimensions of bitmap. */
+Tk_GetBitmapFromData(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which bitmap will be used. */
+ const char *source, /* Bitmap data for bitmap shape. */
+ int width, int height) /* Dimensions of bitmap. */
{
DataKey nameKey;
Tcl_HashEntry *dataHashPtr;
- int new;
+ int isNew;
char string[16 + TCL_INTEGER_SPACE];
char *name;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -826,9 +815,9 @@ Tk_GetBitmapFromData(interp, tkwin, source, width, height)
nameKey.source = source;
nameKey.width = width;
nameKey.height = height;
- dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable,
- (char *) &nameKey, &new);
- if (!new) {
+ dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable,
+ (char *) &nameKey, &isNew);
+ if (!isNew) {
name = (char *) Tcl_GetHashValue(dataHashPtr);
} else {
dispPtr->bitmapAutoNumber++;
@@ -848,27 +837,28 @@ Tk_GetBitmapFromData(interp, tkwin, source, width, height)
*
* Tk_GetBitmapFromObj --
*
- * Returns the bitmap referred to by a Tcl object. The bitmap must
- * already have been allocated via a call to Tk_AllocBitmapFromObj
- * or Tk_GetBitmap.
+ * Returns the bitmap referred to by a Tcl object. The bitmap must
+ * already have been allocated via a call to Tk_AllocBitmapFromObj or
+ * Tk_GetBitmap.
*
* Results:
- * Returns the Pixmap that matches the tkwin and the string rep
- * of objPtr.
+ * Returns the Pixmap that matches the tkwin and the string rep of
+ * objPtr.
*
* Side effects:
- * If the object is not already a bitmap, the conversion will free
- * any old internal representation.
+ * If the object is not already a bitmap, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
Pixmap
-Tk_GetBitmapFromObj(tkwin, objPtr)
- Tk_Window tkwin;
- Tcl_Obj *objPtr; /* The object from which to get pixels. */
+Tk_GetBitmapFromObj(
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr) /* The object from which to get pixels. */
{
TkBitmap *bitmapPtr = GetBitmapFromObj(tkwin, objPtr);
+
return bitmapPtr->bitmap;
}
@@ -877,28 +867,28 @@ Tk_GetBitmapFromObj(tkwin, objPtr)
*
* GetBitmapFromObj --
*
- * Returns the bitmap referred to by a Tcl object. The bitmap must
- * already have been allocated via a call to Tk_AllocBitmapFromObj
- * or Tk_GetBitmap.
+ * Returns the bitmap referred to by a Tcl object. The bitmap must
+ * already have been allocated via a call to Tk_AllocBitmapFromObj or
+ * Tk_GetBitmap.
*
* Results:
- * Returns the TkBitmap * that matches the tkwin and the string rep
- * of objPtr.
+ * Returns the TkBitmap * that matches the tkwin and the string rep of
+ * objPtr.
*
* Side effects:
- * If the object is not already a bitmap, the conversion will free
- * any old internal representation.
+ * If the object is not already a bitmap, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
static TkBitmap *
-GetBitmapFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* Window in which the bitmap will be used. */
- Tcl_Obj *objPtr; /* The object that describes the desired
+GetBitmapFromObj(
+ Tk_Window tkwin, /* Window in which the bitmap will be used. */
+ Tcl_Obj *objPtr) /* The object that describes the desired
* bitmap. */
{
- TkBitmap *bitmapPtr;
+ TkBitmap *bitmapPtr;
Tcl_HashEntry *hashPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -907,7 +897,7 @@ GetBitmapFromObj(tkwin, objPtr)
}
bitmapPtr = (TkBitmap *) objPtr->internalRep.twoPtrValue.ptr1;
- if (bitmapPtr != NULL) {
+ if (bitmapPtr != NULL) {
if ((bitmapPtr->resourceRefCount > 0)
&& (Tk_Display(tkwin) == bitmapPtr->display)) {
return bitmapPtr;
@@ -915,29 +905,29 @@ GetBitmapFromObj(tkwin, objPtr)
hashPtr = bitmapPtr->nameHashPtr;
FreeBitmapObjProc(objPtr);
} else {
- hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable,
- Tcl_GetString(objPtr));
+ hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable,
+ Tcl_GetString(objPtr));
if (hashPtr == NULL) {
goto error;
}
- }
+ }
/*
- * At this point we've got a hash table entry, off of which hang
- * one or more TkBitmap structures. See if any of them will work.
+ * At this point we've got a hash table entry, off of which hang one or
+ * more TkBitmap structures. See if any of them will work.
*/
for (bitmapPtr = (TkBitmap *) Tcl_GetHashValue(hashPtr);
bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) {
if (Tk_Display(tkwin) == bitmapPtr->display) {
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) bitmapPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) bitmapPtr;
bitmapPtr->objRefCount++;
return bitmapPtr;
}
}
- error:
- panic("GetBitmapFromObj called with non-existent bitmap!");
+ error:
+ Tcl_Panic("GetBitmapFromObj called with non-existent bitmap!");
/*
* The following code isn't reached; it's just there to please compilers.
*/
@@ -949,27 +939,27 @@ GetBitmapFromObj(tkwin, objPtr)
*
* InitBitmapObj --
*
- * Bookeeping procedure to change an objPtr to a bitmap type.
+ * Bookeeping function to change an objPtr to a bitmap type.
*
* Results:
* None.
*
* Side effects:
- * The old internal rep of the object is freed. The internal
- * rep is cleared. The final form of the object is set
- * by either Tk_AllocBitmapFromObj or GetBitmapFromObj.
+ * The old internal rep of the object is freed. The internal rep is
+ * cleared. The final form of the object is set by either
+ * Tk_AllocBitmapFromObj or GetBitmapFromObj.
*
*----------------------------------------------------------------------
*/
static void
-InitBitmapObj(objPtr)
- Tcl_Obj *objPtr; /* The object to convert. */
+InitBitmapObj(
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ const Tcl_ObjType *typePtr;
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
Tcl_GetString(objPtr);
@@ -978,21 +968,22 @@ InitBitmapObj(objPtr)
(*typePtr->freeIntRepProc)(objPtr);
}
objPtr->typePtr = &tkBitmapObjType;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
/*
*----------------------------------------------------------------------
*
* BitmapInit --
- * Initializes hash tables used by this module. Initializes
- * tables stored in TkDisplay structure if a TkDisplay pointer
- * is passed in. Iinitializes the thread-local data
- * in the current thread's ThreadSpecificData structure.
+ *
+ * Initializes hash tables used by this module. Initializes tables stored
+ * in TkDisplay structure if a TkDisplay pointer is passed in. Also
+ * initializes the thread-local data in the current thread's
+ * ThreadSpecificData structure.
*
* Results:
- * None.
- *
+ * None.
+ *
* Side effects:
* Read the code.
*
@@ -1000,70 +991,70 @@ InitBitmapObj(objPtr)
*/
static void
-BitmapInit(dispPtr)
- TkDisplay *dispPtr; /* TkDisplay structure encapsulating
- * thread-specific data used by this
- * module, or NULL if unavailable. */
+BitmapInit(
+ TkDisplay *dispPtr) /* TkDisplay structure encapsulating
+ * thread-specific data used by this module,
+ * or NULL if unavailable. */
{
Tcl_Interp *dummy;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- /*
- * First initialize the data in the ThreadSpecificData strucuture,
- * if needed.
+ /*
+ * First initialize the data in the ThreadSpecificData strucuture, if
+ * needed.
*/
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
- dummy = Tcl_CreateInterp();
+ dummy = Tcl_CreateInterp();
Tcl_InitHashTable(&tsdPtr->predefBitmapTable, TCL_STRING_KEYS);
- Tk_DefineBitmap(dummy, "error", (char *) error_bits,
+ Tk_DefineBitmap(dummy, "error", (char *) error_bits,
error_width, error_height);
- Tk_DefineBitmap(dummy, "gray75", (char *) gray75_bits,
- gray75_width, gray75_height);
- Tk_DefineBitmap(dummy, "gray50", (char *) gray50_bits,
- gray50_width, gray50_height);
- Tk_DefineBitmap(dummy, "gray25", (char *) gray25_bits,
- gray25_width, gray25_height);
- Tk_DefineBitmap(dummy, "gray12", (char *) gray12_bits,
- gray12_width, gray12_height);
- Tk_DefineBitmap(dummy, "hourglass", (char *) hourglass_bits,
- hourglass_width, hourglass_height);
- Tk_DefineBitmap(dummy, "info", (char *) info_bits,
- info_width, info_height);
- Tk_DefineBitmap(dummy, "questhead", (char *) questhead_bits,
- questhead_width, questhead_height);
- Tk_DefineBitmap(dummy, "question", (char *) question_bits,
- question_width, question_height);
- Tk_DefineBitmap(dummy, "warning", (char *) warning_bits,
- warning_width, warning_height);
-
- TkpDefineNativeBitmaps();
- Tcl_DeleteInterp(dummy);
+ Tk_DefineBitmap(dummy, "gray75", (char *) gray75_bits,
+ gray75_width, gray75_height);
+ Tk_DefineBitmap(dummy, "gray50", (char *) gray50_bits,
+ gray50_width, gray50_height);
+ Tk_DefineBitmap(dummy, "gray25", (char *) gray25_bits,
+ gray25_width, gray25_height);
+ Tk_DefineBitmap(dummy, "gray12", (char *) gray12_bits,
+ gray12_width, gray12_height);
+ Tk_DefineBitmap(dummy, "hourglass", (char *) hourglass_bits,
+ hourglass_width, hourglass_height);
+ Tk_DefineBitmap(dummy, "info", (char *) info_bits,
+ info_width, info_height);
+ Tk_DefineBitmap(dummy, "questhead", (char *) questhead_bits,
+ questhead_width, questhead_height);
+ Tk_DefineBitmap(dummy, "question", (char *) question_bits,
+ question_width, question_height);
+ Tk_DefineBitmap(dummy, "warning", (char *) warning_bits,
+ warning_width, warning_height);
+
+ TkpDefineNativeBitmaps();
+ Tcl_DeleteInterp(dummy);
}
/*
- * Was a valid TkDisplay pointer passed? If so, initialize the
- * Bitmap module tables in that structure.
+ * Was a valid TkDisplay pointer passed? If so, initialize the Bitmap
+ * module tables in that structure.
*/
if (dispPtr != NULL) {
- dispPtr->bitmapInit = 1;
+ dispPtr->bitmapInit = 1;
Tcl_InitHashTable(&dispPtr->bitmapNameTable, TCL_STRING_KEYS);
- Tcl_InitHashTable(&dispPtr->bitmapDataTable, sizeof(DataKey)
- /sizeof(int));
+ Tcl_InitHashTable(&dispPtr->bitmapDataTable,
+ sizeof(DataKey) / sizeof(int));
/*
- * The call below is tricky: can't use sizeof(IdKey) because it
- * gets padded with extra unpredictable bytes on some 64-bit
- * machines.
+ * The call below is tricky: can't use sizeof(IdKey) because it gets
+ * padded with extra unpredictable bytes on some 64-bit machines.
*/
/*
* The comment above doesn't make sense...
*/
+
Tcl_InitHashTable(&dispPtr->bitmapIdTable, TCL_ONE_WORD_KEYS);
}
}
@@ -1073,8 +1064,8 @@ BitmapInit(dispPtr)
*
* TkReadBitmapFile --
*
- * Loads a bitmap image in X bitmap format into the specified
- * drawable. This is equivelent to the XReadBitmapFile in X.
+ * Loads a bitmap image in X bitmap format into the specified drawable.
+ * This is equivelent to the XReadBitmapFile in X.
*
* Results:
* Sets the size, hotspot, and bitmap on success.
@@ -1086,16 +1077,15 @@ BitmapInit(dispPtr)
*/
int
-TkReadBitmapFile(display, d, filename, width_return, height_return,
- bitmap_return, x_hot_return, y_hot_return)
- 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;
+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)
{
char *data;
@@ -1108,23 +1098,22 @@ TkReadBitmapFile(display, d, filename, width_return, height_return,
*bitmap_return = XCreateBitmapFromData(display, d, data, *width_return,
*height_return);
-
ckfree(data);
return BitmapSuccess;
- }
+}
/*
*----------------------------------------------------------------------
*
* TkDebugBitmap --
*
- * This procedure returns debugging information about a bitmap.
+ * This function returns debugging information about a bitmap.
*
* Results:
* The return value is a list with one sublist for each TkBitmap
- * corresponding to "name". Each sublist has two elements that
- * contain the resourceRefCount and objRefCount fields from the
- * TkBitmap structure.
+ * corresponding to "name". Each sublist has two elements that contain
+ * the resourceRefCount and objRefCount fields from the TkBitmap
+ * structure.
*
* Side effects:
* None.
@@ -1133,10 +1122,10 @@ TkReadBitmapFile(display, d, filename, width_return, height_return,
*/
Tcl_Obj *
-TkDebugBitmap(tkwin, name)
- Tk_Window tkwin; /* The window in which the bitmap will be
- * used (not currently used). */
- char *name; /* Name of the desired color. */
+TkDebugBitmap(
+ Tk_Window tkwin, /* The window in which the bitmap will be used
+ * (not currently used). */
+ char *name) /* Name of the desired color. */
{
TkBitmap *bitmapPtr;
Tcl_HashEntry *hashPtr;
@@ -1148,45 +1137,54 @@ TkDebugBitmap(tkwin, name)
if (hashPtr != NULL) {
bitmapPtr = (TkBitmap *) Tcl_GetHashValue(hashPtr);
if (bitmapPtr == NULL) {
- panic("TkDebugBitmap found empty hash table entry");
+ Tcl_Panic("TkDebugBitmap found empty hash table entry");
}
for ( ; (bitmapPtr != NULL); bitmapPtr = bitmapPtr->nextPtr) {
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(bitmapPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(bitmapPtr->objRefCount));
+ Tcl_NewIntObj(bitmapPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
return resultPtr;
}
-
/*
*----------------------------------------------------------------------
*
* TkGetBitmapPredefTable --
- * This procedure is used by tkMacBitmap.c to access the thread-
- * specific predefBitmap table that maps from the names of
- * the predefined bitmaps to data associated with those
- * bitmaps. It is required because the table is allocated in
- * thread-local storage and is not visible outside this file.
+ *
+ * This function is used by tkMacBitmap.c to access the thread-specific
+ * predefBitmap table that maps from the names of the predefined bitmaps
+ * to data associated with those bitmaps. It is required because the
+ * table is allocated in thread-local storage and is not visible outside
+ * this file.
* Results:
- * Returns a pointer to the predefined bitmap hash table for
- * the current thread.
+ * Returns a pointer to the predefined bitmap hash table for the current
+ * thread.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
+
Tcl_HashTable *
-TkGetBitmapPredefTable()
+TkGetBitmapPredefTable(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return &tsdPtr->predefBitmapTable;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 3783985..4e3c06c 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -1,39 +1,40 @@
-/*
+/*
* tkButton.c --
*
- * This module implements a collection of button-like
- * widgets for the Tk toolkit. The widgets implemented
- * include labels, buttons, checkbuttons, and radiobuttons.
+ * This module implements a collection of button-like widgets for the Tk
+ * toolkit. The widgets implemented include buttons, checkbuttons,
+ * radiobuttons, and labels.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkButton.h"
#include "default.h"
-typedef struct ThreadSpecificData {
+typedef struct ThreadSpecificData {
int defaultsInitialized;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Class names for buttons, indexed by one of the type values defined
- * in tkButton.h.
+ * Class names for buttons, indexed by one of the type values defined in
+ * tkButton.h.
*/
-static char *classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
+static const char *classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
/*
- * The following table defines the legal values for the -default option.
- * It is used together with the "enum defaultValue" declaration in tkButton.h.
+ * The following table defines the legal values for the -default option. It is
+ * used together with the "enum defaultValue" declaration in tkButton.h.
*/
-static char *defaultStrings[] = {
- "active", "disabled", "normal", (char *) NULL
+static const char *defaultStrings[] = {
+ "active", "disabled", "normal", NULL
};
/*
@@ -41,8 +42,8 @@ static char *defaultStrings[] = {
* It is used together with the "enum state" declaration in tkButton.h.
*/
-static char *stateStrings[] = {
- "active", "disabled", "normal", (char *) NULL
+static const char *stateStrings[] = {
+ "active", "disabled", "normal", NULL
};
/*
@@ -50,8 +51,8 @@ static char *stateStrings[] = {
* It is used with the "enum compound" declaration in tkButton.h
*/
-static char *compoundStrings[] = {
- "bottom", "center", "left", "none", "right", "top", (char *) NULL
+static const char *compoundStrings[] = {
+ "bottom", "center", "left", "none", "right", "top", NULL
};
char tkDefButtonBorderWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_BORDER_WIDTH;
@@ -73,10 +74,10 @@ static Tk_OptionSpec labelOptionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
0, (ClientData) DEF_BUTTON_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
@@ -93,8 +94,8 @@ static Tk_OptionSpec labelOptionSpecs[] = {
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
-1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
@@ -143,8 +144,7 @@ static Tk_OptionSpec labelOptionSpecs[] = {
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
Tk_Offset(TkButton, wrapLength), 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0}
};
static Tk_OptionSpec buttonOptionSpecs[] = {
@@ -159,10 +159,10 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
0, (ClientData) DEF_BUTTON_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
@@ -185,8 +185,8 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
-1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
@@ -245,8 +245,7 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
Tk_Offset(TkButton, wrapLength), 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
static Tk_OptionSpec checkbuttonOptionSpecs[] = {
@@ -261,10 +260,10 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
0, (ClientData) DEF_BUTTON_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
@@ -284,8 +283,8 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = {
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
-1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
@@ -344,6 +343,11 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1,
TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage",
+ DEF_BUTTON_IMAGE, Tk_Offset(TkButton, tristateImagePtr), -1,
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue",
+ DEF_BUTTON_TRISTATE_VALUE, Tk_Offset(TkButton, tristateValuePtr), -1, 0, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0},
{TK_OPTION_STRING, "-variable", "variable", "Variable",
@@ -354,8 +358,7 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
Tk_Offset(TkButton, wrapLength), 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
static Tk_OptionSpec radiobuttonOptionSpecs[] = {
@@ -370,10 +373,10 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder),
0, (ClientData) DEF_BUTTON_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
@@ -393,8 +396,8 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = {
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
-1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
@@ -450,6 +453,11 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = {
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1,
TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage",
+ DEF_BUTTON_IMAGE, Tk_Offset(TkButton, tristateImagePtr), -1,
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue",
+ DEF_BUTTON_TRISTATE_VALUE, Tk_Offset(TkButton, tristateValuePtr), -1, 0, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0},
{TK_OPTION_STRING, "-value", "value", "Value",
@@ -462,17 +470,15 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = {
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr),
Tk_Offset(TkButton, wrapLength), 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
- * The following table maps from one of the type values defined in
- * tkButton.h, such as TYPE_LABEL, to the option template for that
- * class of widgets.
+ * The following table maps from one of the type values defined in tkButton.h,
+ * such as TYPE_LABEL, to the option template for that class of widgets.
*/
-static Tk_OptionSpec *optionSpecs[] = {
+static Tk_OptionSpec * const optionSpecs[] = {
labelOptionSpecs,
buttonOptionSpecs,
checkbuttonOptionSpecs,
@@ -480,18 +486,17 @@ static Tk_OptionSpec *optionSpecs[] = {
};
/*
- * The following tables define the widget commands supported by
- * each of the classes, and map the indexes into the string tables
- * into a single enumerated type used to dispatch the widget command.
+ * The following tables define the widget commands supported by each of the
+ * classes, and map the indexes into the string tables into a single
+ * enumerated type used to dispatch the widget command.
*/
-static CONST char *commandNames[][8] = {
- {"cget", "configure", (char *) NULL},
- {"cget", "configure", "flash", "invoke", (char *) NULL},
- {"cget", "configure", "deselect", "flash", "invoke", "select",
- "toggle", (char *) NULL},
+static const char *commandNames[][8] = {
+ {"cget", "configure", NULL},
+ {"cget", "configure", "flash", "invoke", NULL},
{"cget", "configure", "deselect", "flash", "invoke", "select",
- (char *) NULL}
+ "toggle", NULL},
+ {"cget", "configure", "deselect", "flash", "invoke", "select", NULL}
};
enum command {
COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DESELECT, COMMAND_FLASH,
@@ -507,91 +512,92 @@ static enum command map[][8] = {
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void ButtonCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static int ButtonCreate _ANSI_ARGS_((ClientData clientData,
+static void ButtonCmdDeletedProc(ClientData clientData);
+static int ButtonCreate(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[], int type));
-static void ButtonEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void ButtonImageProc _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[], int type);
+static void ButtonEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void ButtonImageProc(ClientData clientData,
int x, int y, int width, int height,
- int imgWidth, int imgHeight));
-static void ButtonSelectImageProc _ANSI_ARGS_((
- ClientData clientData, int x, int y, int width,
- int height, int imgWidth, int imgHeight));
-static char * ButtonTextVarProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static char * ButtonVarProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static int ButtonWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
+ int imgWidth, int imgHeight);
+static void ButtonSelectImageProc(ClientData clientData,
+ int x, int y, int width, int height,
+ int imgWidth, int imgHeight);
+static void ButtonTristateImageProc(ClientData clientData,
+ int x, int y, int width, int height,
+ int imgWidth, int imgHeight);
+static char * ButtonTextVarProc(ClientData clientData,
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
+static char * ButtonVarProc(ClientData clientData,
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
+static int ButtonWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int ConfigureButton _ANSI_ARGS_((Tcl_Interp *interp,
- TkButton *butPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static void DestroyButton _ANSI_ARGS_((TkButton *butPtr));
+ Tcl_Obj *const objv[]);
+static int ConfigureButton(Tcl_Interp *interp, TkButton *butPtr,
+ int objc, Tcl_Obj *const objv[]);
+static void DestroyButton(TkButton *butPtr);
/*
*--------------------------------------------------------------
*
* Tk_ButtonCmd, Tk_CheckbuttonCmd, Tk_LabelCmd, Tk_RadiobuttonCmd --
*
- * These procedures are invoked to process the "button", "label",
- * "radiobutton", and "checkbutton" Tcl commands. See the
- * user documentation for details on what they do.
+ * These functions are invoked to process the "button", "label",
+ * "radiobutton", and "checkbutton" Tcl commands. See the user
+ * documentation for details on what they do.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * See the user documentation. These procedures are just wrappers;
- * they call ButtonCreate to do all of the real work.
+ * See the user documentation. These functions are just wrappers; they
+ * call ButtonCreate to do all of the real work.
*
*--------------------------------------------------------------
*/
int
-Tk_ButtonObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+Tk_ButtonObjCmd(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
return ButtonCreate(clientData, interp, objc, objv, TYPE_BUTTON);
}
int
-Tk_CheckbuttonObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+Tk_CheckbuttonObjCmd(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
return ButtonCreate(clientData, interp, objc, objv, TYPE_CHECK_BUTTON);
}
int
-Tk_LabelObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+Tk_LabelObjCmd(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
return ButtonCreate(clientData, interp, objc, objv, TYPE_LABEL);
}
int
-Tk_RadiobuttonObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+Tk_RadiobuttonObjCmd(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
return ButtonCreate(clientData, interp, objc, objv, TYPE_RADIO_BUTTON);
}
@@ -601,9 +607,9 @@ Tk_RadiobuttonObjCmd(clientData, interp, objc, objv)
*
* ButtonCreate --
*
- * This procedure does all the real work of implementing the
- * "button", "label", "radiobutton", and "checkbutton" Tcl
- * commands. See the user documentation for details on what it does.
+ * This function does all the real work of implementing the "button",
+ * "label", "radiobutton", and "checkbutton" Tcl commands. See the user
+ * documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -615,20 +621,20 @@ Tk_RadiobuttonObjCmd(clientData, interp, objc, objv)
*/
static int
-ButtonCreate(clientData, interp, objc, objv, type)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
- int type; /* Type of button to create: TYPE_LABEL,
+ButtonCreate(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[], /* Argument values. */
+ int type) /* Type of button to create: TYPE_LABEL,
* TYPE_BUTTON, TYPE_CHECK_BUTTON, or
* TYPE_RADIO_BUTTON. */
{
TkButton *butPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->defaultsInitialized) {
TkpButtonSetDefaults(optionSpecs[type]);
@@ -645,14 +651,14 @@ ButtonCreate(clientData, interp, objc, objv, type)
*/
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
/*
- * Create the option table for this widget class. If it has already
- * been created, the cached pointer will be returned.
+ * Create the option table for this widget class. If it has already been
+ * created, the cached pointer will be returned.
*/
optionTable = Tk_CreateOptionTable(interp, optionSpecs[type]);
@@ -681,6 +687,8 @@ ButtonCreate(clientData, interp, objc, objv, type)
butPtr->image = NULL;
butPtr->selectImagePtr = NULL;
butPtr->selectImage = NULL;
+ butPtr->tristateImagePtr = NULL;
+ butPtr->tristateImage = NULL;
butPtr->state = STATE_NORMAL;
butPtr->normalBorder = NULL;
butPtr->activeBorder = NULL;
@@ -725,6 +733,7 @@ ButtonCreate(clientData, interp, objc, objv, type)
butPtr->selVarNamePtr = NULL;
butPtr->onValuePtr = NULL;
butPtr->offValuePtr = NULL;
+ butPtr->tristateValuePtr = NULL;
butPtr->cursor = None;
butPtr->takeFocusPtr = NULL;
butPtr->commandPtr = NULL;
@@ -754,9 +763,9 @@ ButtonCreate(clientData, interp, objc, objv, type)
*
* ButtonWidgetCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -768,11 +777,11 @@ ButtonCreate(clientData, interp, objc, objv, type)
*/
static int
-ButtonWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about button widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+ButtonWidgetObjCmd(
+ ClientData clientData, /* Information about button widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
TkButton *butPtr = (TkButton *) clientData;
int index;
@@ -791,137 +800,126 @@ ButtonWidgetObjCmd(clientData, interp, objc, objv)
Tcl_Preserve((ClientData) butPtr);
switch (map[butPtr->type][index]) {
- case COMMAND_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "cget option");
- goto error;
- }
- objPtr = Tk_GetOptionValue(interp, (char *) butPtr,
- butPtr->optionTable, objv[2], butPtr->tkwin);
+ case COMMAND_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "cget option");
+ goto error;
+ }
+ objPtr = Tk_GetOptionValue(interp, (char *) butPtr,
+ butPtr->optionTable, objv[2], butPtr->tkwin);
+ if (objPtr == NULL) {
+ goto error;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ }
+ break;
+
+ case COMMAND_CONFIGURE:
+ if (objc <= 3) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) butPtr,
+ butPtr->optionTable, (objc == 3) ? objv[2] : NULL,
+ butPtr->tkwin);
if (objPtr == NULL) {
- goto error;
+ goto error;
} else {
Tcl_SetObjResult(interp, objPtr);
}
- break;
+ } else {
+ result = ConfigureButton(interp, butPtr, objc-2, objv+2);
}
+ break;
- case COMMAND_CONFIGURE: {
- if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) butPtr,
- butPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- butPtr->tkwin);
- if (objPtr == NULL) {
- goto error;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- }
- } else {
- result = ConfigureButton(interp, butPtr, objc-2, objv+2);
- }
- break;
+ case COMMAND_DESELECT:
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "deselect");
+ goto error;
}
-
- case COMMAND_DESELECT: {
- if (objc > 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "deselect");
+ if (butPtr->type == TYPE_CHECK_BUTTON) {
+ if (Tcl_ObjSetVar2(interp, butPtr->selVarNamePtr, NULL,
+ butPtr->offValuePtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
+ == NULL) {
goto error;
}
- if (butPtr->type == TYPE_CHECK_BUTTON) {
- if (Tcl_ObjSetVar2(interp, butPtr->selVarNamePtr, NULL,
- butPtr->offValuePtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
- == NULL) {
- goto error;
- }
- } else if (butPtr->flags & SELECTED) {
- if (Tcl_ObjSetVar2(interp,
- butPtr->selVarNamePtr, NULL, Tcl_NewObj(),
- TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
- == NULL) {
- goto error;
- }
+ } else if (butPtr->flags & SELECTED) {
+ if (Tcl_ObjSetVar2(interp, butPtr->selVarNamePtr, NULL,
+ Tcl_NewObj(), TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL){
+ goto error;
}
- break;
}
+ break;
- case COMMAND_FLASH: {
+ case COMMAND_FLASH:
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "flash");
+ goto error;
+ }
+ if (butPtr->state != STATE_DISABLED) {
int i;
- if (objc > 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "flash");
- goto error;
- }
- if (butPtr->state != STATE_DISABLED) {
- for (i = 0; i < 4; i++) {
- if (butPtr->state == STATE_NORMAL) {
- butPtr->state = STATE_ACTIVE;
- Tk_SetBackgroundFromBorder(butPtr->tkwin,
- butPtr->activeBorder);
- } else {
- butPtr->state = STATE_NORMAL;
- Tk_SetBackgroundFromBorder(butPtr->tkwin,
- butPtr->normalBorder);
- }
- TkpDisplayButton((ClientData) butPtr);
-
- /*
- * Special note: must cancel any existing idle handler
- * for TkpDisplayButton; it's no longer needed, and
- * TkpDisplayButton cleared the REDRAW_PENDING flag.
- */
-
- Tcl_CancelIdleCall(TkpDisplayButton, (ClientData) butPtr);
- XFlush(butPtr->display);
- Tcl_Sleep(50);
+ for (i = 0; i < 4; i++) {
+ if (butPtr->state == STATE_NORMAL) {
+ butPtr->state = STATE_ACTIVE;
+ Tk_SetBackgroundFromBorder(butPtr->tkwin,
+ butPtr->activeBorder);
+ } else {
+ butPtr->state = STATE_NORMAL;
+ Tk_SetBackgroundFromBorder(butPtr->tkwin,
+ butPtr->normalBorder);
}
+ TkpDisplayButton((ClientData) butPtr);
+
+ /*
+ * Special note: must cancel any existing idle handler for
+ * TkpDisplayButton; it's no longer needed, and
+ * TkpDisplayButton cleared the REDRAW_PENDING flag.
+ */
+
+ Tcl_CancelIdleCall(TkpDisplayButton, (ClientData) butPtr);
+ XFlush(butPtr->display);
+ Tcl_Sleep(50);
}
- break;
}
+ break;
- case COMMAND_INVOKE: {
- if (objc > 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "invoke");
- goto error;
- }
- if (butPtr->state != STATE_DISABLED) {
- result = TkInvokeButton(butPtr);
- }
- break;
+ case COMMAND_INVOKE:
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "invoke");
+ goto error;
+ }
+ if (butPtr->state != STATE_DISABLED) {
+ result = TkInvokeButton(butPtr);
}
+ break;
- case COMMAND_SELECT: {
- if (objc > 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "select");
- goto error;
- }
- if (Tcl_ObjSetVar2(interp, butPtr->selVarNamePtr, NULL,
- butPtr->onValuePtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
- == NULL) {
- goto error;
- }
- break;
+ case COMMAND_SELECT:
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "select");
+ goto error;
}
+ if (Tcl_ObjSetVar2(interp, butPtr->selVarNamePtr, NULL,
+ butPtr->onValuePtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
+ == NULL) {
+ goto error;
+ }
+ break;
- case COMMAND_TOGGLE: {
- if (objc > 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "toggle");
- goto error;
- }
- if (Tcl_ObjSetVar2(interp, butPtr->selVarNamePtr, NULL,
- (butPtr->flags & SELECTED) ? butPtr->offValuePtr
- : butPtr->onValuePtr,
- TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
- == NULL) {
- goto error;
- }
- break;
+ case COMMAND_TOGGLE:
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "toggle");
+ goto error;
+ }
+ if (Tcl_ObjSetVar2(interp, butPtr->selVarNamePtr, NULL,
+ (butPtr->flags & SELECTED) ? butPtr->offValuePtr
+ : butPtr->onValuePtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
+ == NULL) {
+ goto error;
}
+ break;
}
Tcl_Release((ClientData) butPtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) butPtr);
return TCL_ERROR;
}
@@ -931,8 +929,8 @@ ButtonWidgetObjCmd(clientData, interp, objc, objv)
*
* DestroyButton --
*
- * This procedure is invoked by ButtonEventProc to free all the
- * resources of a button and clean up its state.
+ * This function is invoked by ButtonEventProc to free all the resources
+ * of a button and clean up its state.
*
* Results:
* None.
@@ -944,8 +942,8 @@ ButtonWidgetObjCmd(clientData, interp, objc, objv)
*/
static void
-DestroyButton(butPtr)
- TkButton *butPtr; /* Info about button widget. */
+DestroyButton(
+ TkButton *butPtr) /* Info about button widget. */
{
butPtr->flags |= BUTTON_DELETED;
TkpDestroyButton(butPtr);
@@ -955,9 +953,8 @@ DestroyButton(butPtr)
}
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeOptions handle all the standard option-related stuff.
*/
Tcl_DeleteCommandFromToken(butPtr->interp, butPtr->widgetCmd);
@@ -972,6 +969,9 @@ DestroyButton(butPtr)
if (butPtr->selectImage != NULL) {
Tk_FreeImage(butPtr->selectImage);
}
+ if (butPtr->tristateImage != NULL) {
+ Tk_FreeImage(butPtr->tristateImage);
+ }
if (butPtr->normalTextGC != None) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
@@ -1009,28 +1009,28 @@ DestroyButton(butPtr)
*
* ConfigureButton --
*
- * This procedure is called to process an objc/objv list to set
+ * This function is called to process an objc/objv list to set
* configuration options for a button widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then an error message is left in interp's result.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then an error message is left in interp's result.
*
* Side effects:
- * Configuration information, such as text string, colors, font,
- * etc. get set for butPtr; old resources get freed, if there
- * were any. The button is redisplayed.
+ * Configuration information, such as text string, colors, font, etc. get
+ * set for butPtr; old resources get freed, if there were any. The button
+ * is redisplayed.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureButton(interp, butPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- register TkButton *butPtr; /* Information about widget; may or may
+ConfigureButton(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register TkButton *butPtr, /* Information about widget; may or may
* not already have values for some fields. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
Tk_SavedOptions savedOptions;
Tcl_Obj *errorResult = NULL;
@@ -1042,21 +1042,21 @@ ConfigureButton(interp, butPtr, objc, objv)
*/
if (butPtr->textVarNamePtr != NULL) {
- Tcl_UntraceVar(interp, Tcl_GetString(butPtr->textVarNamePtr),
+ Tcl_UntraceVar(interp, Tcl_GetString(butPtr->textVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonTextVarProc, (ClientData) butPtr);
}
if (butPtr->selVarNamePtr != NULL) {
- Tcl_UntraceVar(interp, Tcl_GetString(butPtr->selVarNamePtr),
+ Tcl_UntraceVar(interp, Tcl_GetString(butPtr->selVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, (ClientData) butPtr);
}
/*
- * The following loop is potentially executed twice. During the
- * first pass configuration options get set to their new values.
- * If there is an error in this pass, we execute a second pass
- * to restore all the options to their previous values.
+ * The following loop is potentially executed twice. During the first pass
+ * configuration options get set to their new values. If there is an error
+ * in this pass, we execute a second pass to restore all the options to
+ * their previous values.
*/
for (error = 0; error <= 1; error++) {
@@ -1067,7 +1067,7 @@ ConfigureButton(interp, butPtr, objc, objv)
if (Tk_SetOptions(interp, (char *) butPtr,
butPtr->optionTable, objc, objv,
- butPtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) {
+ butPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
}
} else {
@@ -1089,8 +1089,8 @@ ConfigureButton(interp, butPtr, objc, objv)
/*
* A few options need special processing, such as setting the
- * background from a 3-D border, or filling in complicated
- * defaults that couldn't be specified to Tk_SetOptions.
+ * background from a 3-D border, or filling in complicated defaults
+ * that couldn't be specified to Tk_SetOptions.
*/
if ((butPtr->state == STATE_ACTIVE)
@@ -1114,28 +1114,43 @@ ConfigureButton(interp, butPtr, objc, objv)
if (butPtr->type >= TYPE_CHECK_BUTTON) {
Tcl_Obj *valuePtr, *namePtr;
-
+
if (butPtr->selVarNamePtr == NULL) {
butPtr->selVarNamePtr = Tcl_NewStringObj(
Tk_Name(butPtr->tkwin), -1);
Tcl_IncrRefCount(butPtr->selVarNamePtr);
}
namePtr = butPtr->selVarNamePtr;
-
+
/*
* Select the button if the associated variable has the
- * appropriate value, initialize the variable if it doesn't
- * exist, then set a trace on the variable to monitor future
- * changes to its value.
+ * appropriate value, initialize the variable if it doesn't exist,
+ * then set a trace on the variable to monitor future changes to
+ * its value.
*/
-
+
valuePtr = Tcl_ObjGetVar2(interp, namePtr, NULL, TCL_GLOBAL_ONLY);
butPtr->flags &= ~SELECTED;
+ butPtr->flags &= ~TRISTATED;
if (valuePtr != NULL) {
- if (strcmp(Tcl_GetString(valuePtr),
- Tcl_GetString(butPtr->onValuePtr)) == 0) {
+ const char *value = Tcl_GetString(valuePtr);
+ if (strcmp(value, Tcl_GetString(butPtr->onValuePtr)) == 0) {
butPtr->flags |= SELECTED;
- }
+ } else if (strcmp(value,
+ Tcl_GetString(butPtr->tristateValuePtr)) == 0) {
+ butPtr->flags |= TRISTATED;
+
+ /*
+ * For checkbuttons if the tristate value is the
+ * same as the offvalue then prefer off to tristate
+ */
+
+ if (butPtr->offValuePtr
+ && strcmp(value,
+ Tcl_GetString(butPtr->offValuePtr)) == 0) {
+ butPtr->flags &= ~TRISTATED;
+ }
+ }
} else {
if (Tcl_ObjSetVar2(interp, namePtr, NULL,
(butPtr->type == TYPE_CHECK_BUTTON)
@@ -1146,8 +1161,8 @@ ConfigureButton(interp, butPtr, objc, objv)
}
/*
- * If a radiobutton has the empty string as value
- * it should be selected.
+ * If a radiobutton has the empty string as value it should be
+ * selected.
*/
if ((butPtr->type == TYPE_RADIO_BUTTON) &&
@@ -1158,11 +1173,11 @@ ConfigureButton(interp, butPtr, objc, objv)
}
/*
- * Get the images for the widget, if there are any. Allocate the
- * new images before freeing the old ones, so that the reference
- * counts don't go to zero and cause image data to be discarded.
+ * Get the images for the widget, if there are any. Allocate the new
+ * images before freeing the old ones, so that the reference counts
+ * don't go to zero and cause image data to be discarded.
*/
-
+
if (butPtr->imagePtr != NULL) {
image = Tk_GetImage(butPtr->interp, butPtr->tkwin,
Tcl_GetString(butPtr->imagePtr), ButtonImageProc,
@@ -1191,6 +1206,20 @@ ConfigureButton(interp, butPtr, objc, objv)
Tk_FreeImage(butPtr->selectImage);
}
butPtr->selectImage = image;
+ if (butPtr->tristateImagePtr != NULL) {
+ image = Tk_GetImage(butPtr->interp, butPtr->tkwin,
+ Tcl_GetString(butPtr->tristateImagePtr),
+ ButtonTristateImageProc, (ClientData) butPtr);
+ if (image == NULL) {
+ continue;
+ }
+ } else {
+ image = NULL;
+ }
+ if (butPtr->tristateImage != NULL) {
+ Tk_FreeImage(butPtr->tristateImage);
+ }
+ butPtr->tristateImage = image;
haveImage = 0;
if (butPtr->imagePtr != NULL || butPtr->bitmap != None) {
@@ -1203,7 +1232,7 @@ ConfigureButton(interp, butPtr, objc, objv)
* on the variable's value, create the variable if it doesn't
* exist, and fetch its current value.
*/
-
+
Tcl_Obj *valuePtr, *namePtr;
namePtr = butPtr->textVarNamePtr;
@@ -1222,22 +1251,21 @@ ConfigureButton(interp, butPtr, objc, objv)
Tcl_IncrRefCount(butPtr->textPtr);
}
}
-
+
if ((butPtr->bitmap != None) || (butPtr->imagePtr != NULL)) {
/*
- * The button must display the contents of an image or
- * bitmap.
+ * The button must display the contents of an image or bitmap.
*/
if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->widthPtr,
&butPtr->width) != TCL_OK) {
- widthError:
+ widthError:
Tcl_AddErrorInfo(interp, "\n (processing -width option)");
continue;
}
if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->heightPtr,
&butPtr->height) != TCL_OK) {
- heightError:
+ heightError:
Tcl_AddErrorInfo(interp, "\n (processing -height option)");
continue;
}
@@ -1275,7 +1303,7 @@ ConfigureButton(interp, butPtr, objc, objv)
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, (ClientData) butPtr);
}
-
+
TkButtonWorldChanged((ClientData) butPtr);
if (error) {
Tcl_SetObjResult(interp, errorResult);
@@ -1291,9 +1319,9 @@ ConfigureButton(interp, butPtr, objc, objv)
*
* TkButtonWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
*
* Results:
* None.
@@ -1303,10 +1331,10 @@ ConfigureButton(interp, butPtr, objc, objv)
*
*---------------------------------------------------------------------------
*/
-
+
void
-TkButtonWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+TkButtonWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC newGC;
@@ -1322,7 +1350,7 @@ TkButtonWorldChanged(instanceData)
gcValues.font = Tk_FontId(butPtr->tkfont);
gcValues.foreground = butPtr->normalFg->pixel;
gcValues.background = Tk_3DBorderColor(butPtr->normalBorder)->pixel;
-
+
/*
* Note: GraphicsExpose events are disabled in normalTextGC because it's
* used to copy stuff from an off-screen pixmap onto the screen (we know
@@ -1369,8 +1397,8 @@ TkButtonWorldChanged(instanceData)
}
/*
- * Allocate the disabled graphics context, for drawing text in
- * its disabled state.
+ * Allocate the disabled graphics context, for drawing text in its
+ * disabled state.
*/
mask = GCForeground | GCBackground | GCFont;
@@ -1406,31 +1434,31 @@ TkButtonWorldChanged(instanceData)
*
* ButtonEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on buttons.
+ * This function is invoked by the Tk dispatcher for various events on
+ * buttons.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-ButtonEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+ButtonEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkButton *butPtr = (TkButton *) clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
} else if (eventPtr->type == ConfigureNotify) {
/*
- * Must redraw after size changes, since layout could have changed
- * and borders will need to be redrawn.
+ * Must redraw after size changes, since layout could have changed and
+ * borders will need to be redrawn.
*/
goto redraw;
@@ -1453,7 +1481,7 @@ ButtonEventProc(clientData, eventPtr)
}
return;
- redraw:
+ redraw:
if ((butPtr->tkwin != NULL) && !(butPtr->flags & REDRAW_PENDING)) {
Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
butPtr->flags |= REDRAW_PENDING;
@@ -1465,9 +1493,9 @@ ButtonEventProc(clientData, eventPtr)
*
* ButtonCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -1479,16 +1507,16 @@ ButtonEventProc(clientData, eventPtr)
*/
static void
-ButtonCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+ButtonCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TkButton *butPtr = (TkButton *) clientData;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted or because the command
- * was deleted, and then this procedure destroys the widget. The
- * BUTTON_DELETED flag distinguishes these cases.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted or because the command was deleted,
+ * and then this function destroys the widget. The BUTTON_DELETED flag
+ * distinguishes these cases.
*/
if (!(butPtr->flags & BUTTON_DELETED)) {
@@ -1501,14 +1529,14 @@ ButtonCmdDeletedProc(clientData)
*
* TkInvokeButton --
*
- * This procedure is called to carry out the actions associated
- * with a button, such as invoking a Tcl command or setting a
- * variable. This procedure is invoked, for example, when the
- * button is invoked via the mouse.
+ * This function is called to carry out the actions associated with a
+ * button, such as invoking a Tcl command or setting a variable. This
+ * function is invoked, for example, when the button is invoked via the
+ * mouse.
*
* Results:
- * A standard Tcl return value. Information is also left in
- * the interp's result.
+ * A standard Tcl return value. Information is also left in the interp's
+ * result.
*
* Side effects:
* Depends on the button and its associated command.
@@ -1517,8 +1545,8 @@ ButtonCmdDeletedProc(clientData)
*/
int
-TkInvokeButton(butPtr)
- TkButton *butPtr; /* Information about button. */
+TkInvokeButton(
+ TkButton *butPtr) /* Information about button. */
{
Tcl_Obj *namePtr = butPtr->selVarNamePtr;
@@ -1555,10 +1583,9 @@ TkInvokeButton(butPtr)
*
* ButtonVarProc --
*
- * This procedure is invoked when someone changes the
- * state variable associated with a radio button. Depending
- * on the new value of the button's variable, the button
- * may be selected or deselected.
+ * This function is invoked when someone changes the state variable
+ * associated with a radio button. Depending on the new value of the
+ * button's variable, the button may be selected or deselected.
*
* Results:
* NULL is always returned.
@@ -1571,12 +1598,12 @@ TkInvokeButton(butPtr)
/* ARGSUSED */
static char *
-ButtonVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about button. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Name of variable. */
- CONST char *name2; /* Second part of variable name. */
- int flags; /* Information about what happened. */
+ButtonVarProc(
+ ClientData clientData, /* Information about button. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ const char *name1, /* Name of variable. */
+ const char *name2, /* Second part of variable name. */
+ int flags) /* Information about what happened. */
{
register TkButton *butPtr = (TkButton *) clientData;
char *name, *value;
@@ -1585,12 +1612,13 @@ ButtonVarProc(clientData, interp, name1, name2, flags)
name = Tcl_GetString(butPtr->selVarNamePtr);
/*
- * If the variable is being unset, then just re-establish the
- * trace unless the whole interpreter is going away.
+ * If the variable is being unset, then just re-establish the trace unless
+ * the whole interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
butPtr->flags &= ~SELECTED;
+ butPtr->flags &= ~TRISTATED;
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
Tcl_TraceVar(interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
@@ -1600,34 +1628,47 @@ ButtonVarProc(clientData, interp, name1, name2, flags)
}
/*
- * Use the value of the variable to update the selected status of
- * the button.
+ * Use the value of the variable to update the selected status of the
+ * button.
*/
valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY);
if (valuePtr == NULL) {
- value = "";
+ value = Tcl_GetString(butPtr->tristateValuePtr);
} else {
value = Tcl_GetString(valuePtr);
}
if (strcmp(value, Tcl_GetString(butPtr->onValuePtr)) == 0) {
if (butPtr->flags & SELECTED) {
- return (char *) NULL;
+ return NULL;
}
butPtr->flags |= SELECTED;
- } else if (butPtr->flags & SELECTED) {
- butPtr->flags &= ~SELECTED;
+ butPtr->flags &= ~TRISTATED;
+ } else if (butPtr->offValuePtr
+ && strcmp(value, Tcl_GetString(butPtr->offValuePtr)) == 0) {
+ if (!(butPtr->flags & (SELECTED | TRISTATED))) {
+ return NULL;
+ }
+ butPtr->flags &= ~(SELECTED | TRISTATED);
+ } else if (strcmp(value, Tcl_GetString(butPtr->tristateValuePtr)) == 0) {
+ if (butPtr->flags & TRISTATED) {
+ return NULL;
+ }
+ butPtr->flags |= TRISTATED;
+ butPtr->flags &= ~SELECTED;
+ } else if (butPtr->flags & (SELECTED | TRISTATED)) {
+ butPtr->flags &= ~(SELECTED | TRISTATED);
} else {
- return (char *) NULL;
+ return NULL;
}
- redisplay:
+ redisplay:
if ((butPtr->tkwin != NULL) && Tk_IsMapped(butPtr->tkwin)
&& !(butPtr->flags & REDRAW_PENDING)) {
Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
butPtr->flags |= REDRAW_PENDING;
}
- return (char *) NULL;
+ return NULL;
}
/*
@@ -1635,52 +1676,51 @@ ButtonVarProc(clientData, interp, name1, name2, flags)
*
* ButtonTextVarProc --
*
- * This procedure is invoked when someone changes the variable
- * whose contents are to be displayed in a button.
+ * This function is invoked when someone changes the variable whose
+ * contents are to be displayed in a button.
*
* Results:
* NULL is always returned.
*
* Side effects:
- * The text displayed in the button will change to match the
- * variable.
+ * The text displayed in the button will change to match the variable.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static char *
-ButtonTextVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about button. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Not used. */
- CONST char *name2; /* Not used. */
- int flags; /* Information about what happened. */
+ButtonTextVarProc(
+ ClientData clientData, /* Information about button. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ const char *name1, /* Not used. */
+ const char *name2, /* Not used. */
+ int flags) /* Information about what happened. */
{
TkButton *butPtr = (TkButton *) clientData;
char *name;
Tcl_Obj *valuePtr;
if (butPtr->flags & BUTTON_DELETED) {
- return (char *) NULL;
+ return NULL;
}
name = Tcl_GetString(butPtr->textVarNamePtr);
/*
- * If the variable is unset, then immediately recreate it unless
- * the whole interpreter is going away.
+ * If the variable is unset, then immediately recreate it unless the whole
+ * interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
- Tcl_SetVar2Ex(interp, name, NULL, butPtr->textPtr,
+ Tcl_SetVar2Ex(interp, name, NULL, butPtr->textPtr,
TCL_GLOBAL_ONLY);
Tcl_TraceVar(interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonTextVarProc, clientData);
}
- return (char *) NULL;
+ return NULL;
}
valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY);
@@ -1697,7 +1737,7 @@ ButtonTextVarProc(clientData, interp, name1, name2, flags)
Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
butPtr->flags |= REDRAW_PENDING;
}
- return (char *) NULL;
+ return NULL;
}
/*
@@ -1705,9 +1745,9 @@ ButtonTextVarProc(clientData, interp, name1, name2, flags)
*
* ButtonImageProc --
*
- * This procedure is invoked by the image code whenever the manager
- * for an image does something that affects the size or contents
- * of an image displayed in a button.
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the size or contents of an image
+ * displayed in a button.
*
* Results:
* None.
@@ -1719,13 +1759,13 @@ ButtonTextVarProc(clientData, interp, name1, name2, flags)
*/
static void
-ButtonImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
- ClientData clientData; /* Pointer to widget record. */
- int x, y; /* Upper left pixel (within image)
- * that must be redisplayed. */
- int width, height; /* Dimensions of area to redisplay
- * (may be <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+ButtonImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (might be
+ * <= 0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkButton *butPtr = (TkButton *) clientData;
@@ -1743,9 +1783,9 @@ ButtonImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
*
* ButtonSelectImageProc --
*
- * This procedure is invoked by the image code whenever the manager
- * for an image does something that affects the size or contents
- * of the image displayed in a button when it is selected.
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the size or contents of the image
+ * displayed in a button when it is selected.
*
* Results:
* None.
@@ -1757,18 +1797,18 @@ ButtonImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
*/
static void
-ButtonSelectImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
- ClientData clientData; /* Pointer to widget record. */
- int x, y; /* Upper left pixel (within image)
- * that must be redisplayed. */
- int width, height; /* Dimensions of area to redisplay
- * (may be <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+ButtonSelectImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (might be
+ * <= 0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkButton *butPtr = (TkButton *) clientData;
/*
- * Don't recompute geometry: it's controlled by the primary image.
+ * Don't recompute geometry: it's controlled by the primary image.
*/
if ((butPtr->flags & SELECTED) && (butPtr->tkwin != NULL)
@@ -1778,3 +1818,52 @@ ButtonSelectImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
butPtr->flags |= REDRAW_PENDING;
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ButtonTristateImageProc --
+ *
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the size or contents of the image
+ * displayed in a button when it is selected.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May arrange for the button to get redisplayed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ButtonTristateImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (might be
+ * <= 0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
+{
+ register TkButton *butPtr = (TkButton *) clientData;
+
+ /*
+ * Don't recompute geometry: it's controlled by the primary image.
+ */
+
+ if ((butPtr->flags & TRISTATED) && (butPtr->tkwin != NULL)
+ && Tk_IsMapped(butPtr->tkwin)
+ && !(butPtr->flags & REDRAW_PENDING)) {
+ Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
+ butPtr->flags |= REDRAW_PENDING;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkButton.h b/generic/tkButton.h
index 9547c9a..4fde4c1 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -1,13 +1,13 @@
/*
* tkButton.h --
*
- * Declarations of types and functions used to implement
- * button-like widgets.
+ * Declarations of types and functions used to implement button-like
+ * widgets.
*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKBUTTON
@@ -48,20 +48,20 @@ enum defaultState {
};
/*
- * A data structure of the following type is kept for each
- * widget managed by this file:
+ * A data structure of the following type is kept for each widget managed by
+ * this file:
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the button. NULL
- * means that the window has been destroyed. */
- Display *display; /* Display containing widget. Needed to
- * free up resources after tkwin is gone. */
+ Tk_Window tkwin; /* Window that embodies the button. NULL means
+ * that the window has been destroyed. */
+ Display *display; /* Display containing widget. Needed to free
+ * up resources after tkwin is gone. */
Tcl_Interp *interp; /* Interpreter associated with button. */
Tcl_Command widgetCmd; /* Token for button's widget command. */
int type; /* Type of widget, such as TYPE_LABEL:
* restricts operations that may be performed
- * on widget. See below for legal values. */
+ * on widget. See below for legal values. */
Tk_OptionTable optionTable; /* Table that defines configuration options
* available for this widget. */
@@ -71,96 +71,102 @@ typedef struct {
Tcl_Obj *textPtr; /* Value of -text option: specifies text to
* display in button. */
- int underline; /* Value of -underline option: specifies
- * index of character to underline. < 0 means
- * don't underline anything. */
+ int underline; /* Value of -underline option: specifies index
+ * of character to underline. < 0 means don't
+ * underline anything. */
Tcl_Obj *textVarNamePtr; /* Value of -textvariable option: specifies
- * name of variable or NULL. If non-NULL,
+ * name of variable or NULL. If non-NULL,
* button displays the contents of this
* variable. */
- Pixmap bitmap; /* Value of -bitmap option. If not None,
+ Pixmap bitmap; /* Value of -bitmap option. If not None,
* specifies bitmap to display and text and
* textVar are ignored. */
- Tcl_Obj *imagePtr; /* Value of -image option: specifies image
- * to display in window, or NULL if none.
- * If non-NULL, bitmap, text, and textVarName
- * are ignored.*/
+ Tcl_Obj *imagePtr; /* Value of -image option: specifies image to
+ * display in window, or NULL if none. If
+ * non-NULL, bitmap, text, and textVarName are
+ * ignored.*/
Tk_Image image; /* Derived from imagePtr by calling
- * Tk_GetImage, or NULL if imagePtr is NULL. */
+ * Tk_GetImage, or NULL if imagePtr is
+ * NULL. */
Tcl_Obj *selectImagePtr; /* Value of -selectimage option: specifies
* image to display in window when selected,
- * or NULL if none. Ignored if imagePtr is
+ * or NULL if none. Ignored if imagePtr is
* NULL. */
Tk_Image selectImage; /* Derived from selectImagePtr by calling
- * Tk_GetImage, or NULL if selectImagePtr
- * is NULL. */
+ * Tk_GetImage, or NULL if selectImagePtr is
+ * NULL. */
+ Tcl_Obj *tristateImagePtr; /* Value of -tristateimage option: specifies
+ * image to display in window when selected,
+ * or NULL if none. Ignored if imagePtr is
+ * NULL. */
+ Tk_Image tristateImage; /* Derived from tristateImagePtr by calling
+ * Tk_GetImage, or NULL if tristateImagePtr is
+ * NULL. */
/*
* Information used when displaying widget:
*/
- enum state state; /* Value of -state option: specifies
- * state of button for display purposes.*/
+ enum state state; /* Value of -state option: specifies state of
+ * button for display purposes.*/
Tk_3DBorder normalBorder; /* Value of -background option: specifies
* color for background (and border) when
* window isn't active. */
- Tk_3DBorder activeBorder; /* Value of -activebackground option:
- * this is the color used to draw 3-D border
- * and background when widget is active. */
+ Tk_3DBorder activeBorder; /* Value of -activebackground option: this is
+ * the color used to draw 3-D border and
+ * background when widget is active. */
Tcl_Obj *borderWidthPtr; /* Value of -borderWidth option: specifies
* width of border in pixels. */
int borderWidth; /* Integer value corresponding to
- * borderWidthPtr. Always >= 0. */
+ * borderWidthPtr. Always >= 0. */
int relief; /* Value of -relief option: specifies 3-d
* effect for border, such as
* TK_RELIEF_RAISED. */
- int overRelief; /* Value of -overrelief option: specifies a 3-d
- * effect for the border, such as
+ int overRelief; /* Value of -overrelief option: specifies a
+ * 3-d effect for the border, such as
* TK_RELIEF_RAISED, to be used when the mouse
* is over the button. */
int offRelief; /* Value of -offrelief option: specifies a 3-d
* effect for the border, such as
* TK_RELIEF_RAISED, to be used when a
- * checkbutton or radiobutton without
- * indicator is off */
+ * checkbutton or radiobutton without
+ * indicator is off. */
Tcl_Obj *highlightWidthPtr; /* Value of -highlightthickness option:
* specifies width in pixels of highlight to
* draw around widget when it has the focus.
* <= 0 means don't draw a highlight. */
int highlightWidth; /* Integer value corresponding to
- * highlightWidthPtr. Always >= 0. */
+ * highlightWidthPtr. Always >= 0. */
Tk_3DBorder highlightBorder;/* Value of -highlightbackground option:
* specifies background with which to draw 3-D
* default ring and focus highlight area when
* highlight is off. */
- XColor *highlightColorPtr; /* Value of -highlightcolor option:
- * specifies color for drawing traversal
- * highlight. */
+ XColor *highlightColorPtr; /* Value of -highlightcolor option: specifies
+ * color for drawing traversal highlight. */
int inset; /* Total width of all borders, including
* traversal highlight and 3-D border.
- * Indicates how much interior stuff must
- * be offset from outside edges to leave
- * room for borders. */
- Tk_Font tkfont; /* Value of -font option: specifies font
- * to use for display text. */
+ * Indicates how much interior stuff must be
+ * offset from outside edges to leave room for
+ * borders. */
+ Tk_Font tkfont; /* Value of -font option: specifies font to
+ * use for display text. */
XColor *normalFg; /* Value of -font option: specifies foreground
* color in normal mode. */
XColor *activeFg; /* Value of -activeforeground option:
- * foreground color in active mode. NULL
- * means use -foreground instead. */
+ * foreground color in active mode. NULL means
+ * use -foreground instead. */
XColor *disabledFg; /* Value of -disabledforeground option:
- * foreground color when disabled. NULL
- * means use normalFg with a 50% stipple
- * instead. */
- GC normalTextGC; /* GC for drawing text in normal mode. Also
+ * foreground color when disabled. NULL means
+ * use normalFg with a 50% stipple instead. */
+ GC normalTextGC; /* GC for drawing text in normal mode. Also
* used to copy from off-screen pixmap onto
* screen. */
GC activeTextGC; /* GC for drawing text in active mode (NULL
* means use normalTextGC). */
GC disabledGC; /* Used to produce disabled effect for text
* and check/radio marks. */
- GC stippleGC; /* Used to produce disabled stipple effect
- * for images when disabled. */
+ GC stippleGC; /* Used to produce disabled stipple effect for
+ * images when disabled. */
Pixmap gray; /* Pixmap for displaying disabled text if
* disabledFg is NULL. */
GC copyGC; /* Used for copying information from an
@@ -169,33 +175,34 @@ typedef struct {
int width; /* Integer value corresponding to widthPtr. */
Tcl_Obj *heightPtr; /* Value of -height option. */
int height; /* Integer value corresponding to heightPtr. */
- Tcl_Obj *wrapLengthPtr; /* Value of -wraplength option: specifies
- * line length (in pixels) at which to wrap
- * onto next line. <= 0 means don't wrap
- * except at newlines. */
+ Tcl_Obj *wrapLengthPtr; /* Value of -wraplength option: specifies line
+ * length (in pixels) at which to wrap onto
+ * next line. <= 0 means don't wrap except at
+ * newlines. */
int wrapLength; /* Integer value corresponding to
* wrapLengthPtr. */
Tcl_Obj *padXPtr; /* Value of -padx option: specifies how many
* pixels of extra space to leave on left and
- * right of text. Ignored for bitmaps and
+ * right of text. Ignored for bitmaps and
* images. */
int padX; /* Integer value corresponding to padXPtr. */
Tcl_Obj *padYPtr; /* Value of -padx option: specifies how many
* pixels of extra space to leave above and
- * below text. Ignored for bitmaps and
+ * below text. Ignored for bitmaps and
* images. */
int padY; /* Integer value corresponding to padYPtr. */
Tk_Anchor anchor; /* Value of -anchor option: specifies where
* text/bitmap should be displayed inside
* button region. */
- Tk_Justify justify; /* Value of -justify option: specifies how
- * to align lines of multi-line text. */
- int indicatorOn; /* Value of -indicatoron option: 1 means
- * draw indicator in checkbuttons and
- * radiobuttons, 0 means don't draw it. */
+ Tk_Justify justify; /* Value of -justify option: specifies how to
+ * align lines of multi-line text. */
+ int indicatorOn; /* Value of -indicatoron option: 1 means draw
+ * indicator in checkbuttons and radiobuttons,
+ * 0 means don't draw it. */
Tk_3DBorder selectBorder; /* Value of -selectcolor option: specifies
* color for drawing indicator background, or
- * perhaps widget background, when selected. */
+ * perhaps widget background, when
+ * selected. */
int textWidth; /* Width needed to display text as requested,
* in pixels. */
int textHeight; /* Height needed to display text as requested,
@@ -206,26 +213,28 @@ typedef struct {
int indicatorDiameter; /* Diameter of indicator, in pixels. */
enum defaultState defaultState;
/* Value of -default option, such as
- * DEFAULT_NORMAL: specifies state
- * of default ring for buttons (normal,
- * active, or disabled). NULL for other
- * classes. */
+ * DEFAULT_NORMAL: specifies state of default
+ * ring for buttons (normal, active, or
+ * disabled). NULL for other classes. */
/*
- * For check and radio buttons, the fields below are used
- * to manage the variable indicating the button's state.
+ * For check and radio buttons, the fields below are used to manage the
+ * variable indicating the button's state.
*/
Tcl_Obj *selVarNamePtr; /* Value of -variable option: specifies name
- * of variable used to control selected
- * state of button. */
+ * of variable used to control selected state
+ * of button. */
Tcl_Obj *onValuePtr; /* Value of -offvalue option: specifies value
* to store in variable when this button is
* selected. */
Tcl_Obj *offValuePtr; /* Value of -offvalue option: specifies value
- * to store in variable when this button
- * isn't selected. Used only by
- * checkbuttons. */
+ * to store in variable when this button isn't
+ * selected. Used only by checkbuttons. */
+ Tcl_Obj *tristateValuePtr; /* Value of -tristatevalue option: specifies
+ * value to display Tristate or Multivalue
+ * mode when variable matches this value.
+ * Used by check- buttons. */
/*
* Miscellaneous information:
@@ -233,31 +242,30 @@ typedef struct {
Tk_Cursor cursor; /* Value of -cursor option: if not None,
* specifies current cursor for window. */
- Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
+ Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
* scripts. */
- Tcl_Obj *commandPtr; /* Value of -command option: specifies script
- * to execute when button is invoked. If
- * widget is label or has no command, this
- * is NULL. */
- int compound; /* Value of -compound option; specifies whether
- * the button should show both an image and
- * text, and, if so, how. */
- int repeatDelay; /* Value of -repeatdelay option; specifies
- * the number of ms after which the button will
+ Tcl_Obj *commandPtr; /* Value of -command option: specifies script
+ * to execute when button is invoked. If
+ * widget is label or has no command, this is
+ * NULL. */
+ int compound; /* Value of -compound option; specifies
+ * whether the button should show both an
+ * image and text, and, if so, how. */
+ int repeatDelay; /* Value of -repeatdelay option; specifies the
+ * number of ms after which the button will
* start to auto-repeat its command. */
int repeatInterval; /* Value of -repeatinterval option; specifies
* the number of ms between auto-repeat
* invocataions of the button command. */
- int flags; /* Various flags; see below for
+ int flags; /* Various flags; see below for
* definitions. */
} TkButton;
/*
- * Possible "type" values for buttons. These are the kinds of
- * widgets supported by this file. The ordering of the type
- * numbers is significant: greater means more features and is
- * used in the code.
+ * Possible "type" values for buttons. These are the kinds of widgets
+ * supported by this file. The ordering of the type numbers is significant:
+ * greater means more features and is used in the code.
*/
#define TYPE_LABEL 0
@@ -268,51 +276,46 @@ typedef struct {
/*
* Flag bits for buttons:
*
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler
- * has already been queued to redraw
- * this window.
- * SELECTED: Non-zero means this button is selected,
- * so special highlight should be drawn.
- * GOT_FOCUS: Non-zero means this button currently
- * has the input focus.
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
+ * already been queued to redraw this window.
+ * SELECTED: Non-zero means this button is selected, so
+ * special highlight should be drawn.
+ * GOT_FOCUS: Non-zero means this button currently has the
+ * input focus.
* BUTTON_DELETED: Non-zero needs that this button has been
- * deleted, or is in the process of being
- * deleted.
+ * deleted, or is in the process of being deleted
*/
#define REDRAW_PENDING (1 << 0)
#define SELECTED (1 << 1)
#define GOT_FOCUS (1 << 2)
#define BUTTON_DELETED (1 << 3)
+#define TRISTATED (1 << 4)
+
/*
- * Declaration of button class functions structure
- * and button/label defaults, for use in optionSpecs.
+ * Declaration of variables shared between the files in the button module.
*/
-extern Tk_ClassProcs tkpButtonProcs;
-extern char tkDefButtonBorderWidth[TCL_INTEGER_SPACE];
+MODULE_SCOPE Tk_ClassProcs tkpButtonProcs;
+MODULE_SCOPE char tkDefButtonBorderWidth[TCL_INTEGER_SPACE];
/*
- * Declaration of procedures used in the implementation of the button
- * widget.
+ * Declaration of functions used in the implementation of the button widget.
*/
#ifndef TkpButtonSetDefaults
-EXTERN void TkpButtonSetDefaults _ANSI_ARGS_((
- Tk_OptionSpec *specPtr));
+MODULE_SCOPE void TkpButtonSetDefaults(Tk_OptionSpec *specPtr);
#endif
-EXTERN void TkButtonWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-EXTERN void TkpComputeButtonGeometry _ANSI_ARGS_((
- TkButton *butPtr));
-EXTERN TkButton * TkpCreateButton _ANSI_ARGS_((Tk_Window tkwin));
+MODULE_SCOPE void TkButtonWorldChanged(ClientData instanceData);
+MODULE_SCOPE void TkpComputeButtonGeometry(TkButton *butPtr);
+MODULE_SCOPE TkButton *TkpCreateButton(Tk_Window tkwin);
#ifndef TkpDestroyButton
-EXTERN void TkpDestroyButton _ANSI_ARGS_((TkButton *butPtr));
+MODULE_SCOPE void TkpDestroyButton(TkButton *butPtr);
#endif
#ifndef TkpDisplayButton
-EXTERN void TkpDisplayButton _ANSI_ARGS_((ClientData clientData));
+MODULE_SCOPE void TkpDisplayButton(ClientData clientData);
#endif
-EXTERN int TkInvokeButton _ANSI_ARGS_((TkButton *butPtr));
+MODULE_SCOPE int TkInvokeButton(TkButton *butPtr);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index 9bee1ef..ecd57b8 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkCanvArc.c --
*
* This file implements arc items for canvas widgets.
@@ -6,14 +6,14 @@
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
-#include "tkPort.h"
#include "tkInt.h"
#include "tkCanvas.h"
+
/*
* The structure below defines the record for each arc item.
*/
@@ -22,41 +22,42 @@ typedef enum {
PIESLICE_STYLE, CHORD_STYLE, ARC_STYLE
} Style;
-typedef struct ArcItem {
+typedef struct ArcItem {
Tk_Item header; /* Generic stuff that's the same for all
- * types. MUST BE FIRST IN STRUCTURE. */
+ * types. MUST BE FIRST IN STRUCTURE. */
Tk_Outline outline; /* Outline structure */
double bbox[4]; /* Coordinates (x1, y1, x2, y2) of bounding
* box for oval of which arc is a piece. */
double start; /* Angle at which arc begins, in degrees
* between 0 and 360. */
- double extent; /* Extent of arc (angular distance from
- * start to end of arc) in degrees between
- * -360 and 360. */
- double *outlinePtr; /* Points to (x,y) coordinates for points
- * that define one or two closed polygons
+ double extent; /* Extent of arc (angular distance from start
+ * to end of arc) in degrees between -360 and
+ * 360. */
+ double *outlinePtr; /* Points to (x,y) coordinates for points that
+ * define one or two closed polygons
* representing the portion of the outline
- * that isn't part of the arc (the V-shape
- * for a pie slice or a line-like segment
- * for a chord). Malloc'ed. */
- int numOutlinePoints; /* Number of points at outlinePtr. Zero
- * means no space allocated. */
+ * that isn't part of the arc (the V-shape for
+ * a pie slice or a line-like segment for a
+ * chord). Malloc'ed. */
+ int numOutlinePoints; /* Number of points at outlinePtr. Zero means
+ * no space allocated. */
Tk_TSOffset tsoffset;
XColor *fillColor; /* Color for filling arc (used for drawing
- * outline too when style is "arc"). NULL
+ * outline too when style is "arc"). NULL
* means don't fill arc. */
XColor *activeFillColor; /* Color for filling arc (used for drawing
* outline too when style is "arc" and state
- * is "active"). NULL means use fillColor. */
+ * is "active"). NULL means use fillColor. */
XColor *disabledFillColor; /* Color for filling arc (used for drawing
* outline too when style is "arc" and state
* is "disabled". NULL means use fillColor */
Pixmap fillStipple; /* Stipple bitmap for filling item. */
- Pixmap activeFillStipple; /* Stipple bitmap for filling item if state
- * is active. */
- Pixmap disabledFillStipple; /* Stipple bitmap for filling item if state
- * is disabled. */
- Style style; /* How to draw arc: arc, chord, or pieslice. */
+ Pixmap activeFillStipple; /* Stipple bitmap for filling item if state is
+ * active. */
+ Pixmap disabledFillStipple; /* Stipple bitmap for filling item if state is
+ * disabled. */
+ Style style; /* How to draw arc: arc, chord, or
+ * pieslice. */
GC fillGC; /* Graphics context for filling item. */
double center1[2]; /* Coordinates of center of arc outline at
* start (see ComputeArcOutline). */
@@ -65,8 +66,8 @@ typedef struct ArcItem {
} ArcItem;
/*
- * The definitions below define the sizes of the polygons used to
- * display outline information for various styles of arcs:
+ * The definitions below define the sizes of the polygons used to display
+ * outline information for various styles of arcs:
*/
#define CHORD_OUTLINE_PTS 7
@@ -77,14 +78,11 @@ typedef struct ArcItem {
* Information used for parsing configuration specs:
*/
-static int StyleParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
+static int StyleParseProc(ClientData clientData, Tcl_Interp *interp,
Tk_Window tkwin, CONST char *value,
- char *widgRec, int offset));
-static char * StylePrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
+ char *widgRec, int offset);
+static char * StylePrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
static Tk_CustomOption stateOption = {
(Tk_OptionParseProc *) TkStateParseProc,
@@ -112,169 +110,152 @@ static Tk_CustomOption pixelOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_CUSTOM, "-activedash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.activeDash),
+ {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-activefill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, activeFillColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-activeoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.activeColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activeoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.activeStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, activeFillStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-activewidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-activefill", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, activeFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.activeColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.activeStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, activeFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
"0.0", Tk_Offset(ArcItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_CUSTOM, "-dash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.dash),
+ {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_PIXELS, "-dashoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
"0", Tk_Offset(ArcItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-disableddash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.disabledDash),
+ {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-disabledfill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, disabledFillColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-disabledoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.disabledColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.disabledStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, disabledFillStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-disabledwidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.disabledStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, disabledFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(ArcItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_DOUBLE, "-extent", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_DOUBLE, "-extent", NULL, NULL,
"90", Tk_Offset(ArcItem, extent), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_COLOR, "-fill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, fillColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-offset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-fill", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, fillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
"0,0", Tk_Offset(ArcItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_COLOR, "-outline", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-outline", NULL, NULL,
"black", Tk_Offset(ArcItem, outline.color), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-outlineoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
"0,0", Tk_Offset(ArcItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_BITMAP, "-outlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, outline.stipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_DOUBLE, "-start", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, outline.stipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_DOUBLE, "-start", NULL, NULL,
"0", Tk_Offset(ArcItem, start), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_BITMAP, "-stipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, fillStipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-style", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ArcItem, style), TK_CONFIG_DONT_SET_DEFAULT,
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, fillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-style", NULL, NULL,
+ NULL, Tk_Offset(ArcItem, style), TK_CONFIG_DONT_SET_DEFAULT,
&styleOption},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_CUSTOM, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_CUSTOM, "-width", NULL, NULL,
"1.0", Tk_Offset(ArcItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT,
&pixelOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static void ComputeArcBbox _ANSI_ARGS_((Tk_Canvas canvas,
- ArcItem *arcPtr));
-static int ConfigureArc _ANSI_ARGS_((Tcl_Interp *interp,
+static void ComputeArcBbox(Tk_Canvas canvas, ArcItem *arcPtr);
+static int ConfigureArc(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags));
-static int CreateArc _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST objv[], int flags);
+static int CreateArc(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void DeleteArc _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayArc _ANSI_ARGS_((Tk_Canvas canvas,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DeleteArc(Tk_Canvas canvas,
+ Tk_Item *itemPtr, Display *display);
+static void DisplayArc(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static int ArcCoords _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static int ArcToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *rectPtr));
-static double ArcToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *coordPtr));
-static int ArcToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static void ScaleArc _ANSI_ARGS_((Tk_Canvas canvas,
+ int x, int y, int width, int height);
+static int ArcCoords(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]);
+static int ArcToArea(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *rectPtr);
+static double ArcToPoint(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *coordPtr);
+static int ArcToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static void ScaleArc(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void TranslateArc _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
-static int AngleInRange _ANSI_ARGS_((double x, double y,
- double start, double extent));
-static void ComputeArcOutline _ANSI_ARGS_((Tk_Canvas canvas,
- ArcItem *arcPtr));
-static int HorizLineToArc _ANSI_ARGS_((double x1, double x2,
+ double scaleX, double scaleY);
+static void TranslateArc(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double deltaX, double deltaY);
+static int AngleInRange(double x, double y,
+ double start, double extent);
+static void ComputeArcOutline(Tk_Canvas canvas, ArcItem *arcPtr);
+static int HorizLineToArc(double x1, double x2,
double y, double rx, double ry,
- double start, double extent));
-static int VertLineToArc _ANSI_ARGS_((double x, double y1,
+ double start, double extent);
+static int VertLineToArc(double x, double y1,
double y2, double rx, double ry,
- double start, double extent));
+ double start, double extent);
/*
- * The structures below defines the arc item types by means of procedures
- * that can be invoked by generic item code.
+ * The structures below defines the arc item types by means of functions that
+ * can be invoked by generic item code.
*/
Tk_ItemType tkArcType = {
- "arc", /* name */
- sizeof(ArcItem), /* itemSize */
- CreateArc, /* createProc */
- configSpecs, /* configSpecs */
- ConfigureArc, /* configureProc */
- ArcCoords, /* coordProc */
- DeleteArc, /* deleteProc */
- DisplayArc, /* displayProc */
- TK_CONFIG_OBJS, /* flags */
- ArcToPoint, /* pointProc */
- ArcToArea, /* areaProc */
- ArcToPostscript, /* postscriptProc */
- ScaleArc, /* scaleProc */
- TranslateArc, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* icursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ "arc", /* name */
+ sizeof(ArcItem), /* itemSize */
+ CreateArc, /* createProc */
+ configSpecs, /* configSpecs */
+ ConfigureArc, /* configureProc */
+ ArcCoords, /* coordProc */
+ DeleteArc, /* deleteProc */
+ DisplayArc, /* displayProc */
+ TK_CONFIG_OBJS, /* flags */
+ ArcToPoint, /* pointProc */
+ ArcToArea, /* areaProc */
+ ArcToPostscript, /* postscriptProc */
+ ScaleArc, /* scaleProc */
+ TranslateArc, /* translateProc */
+ NULL, /* indexProc */
+ NULL, /* icursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
#ifndef PI
-# define PI 3.14159265358979323846
+#define PI 3.14159265358979323846
#endif
-
/*
*--------------------------------------------------------------
*
* CreateArc --
*
- * This procedure is invoked to create a new arc item in
- * a canvas.
+ * This function is invoked to create a new arc item in a canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item, then an error message is left in
- * the interp's result; in this case itemPtr is
- * left uninitialized, so it can be safely freed by the
+ * A standard Tcl return value. If an error occurred in creating the
+ * item, then an error message is left in the interp's result; in this
+ * case itemPtr is left uninitialized, so it can be safely freed by the
* caller.
*
* Side effects:
@@ -284,24 +265,24 @@ Tk_ItemType tkArcType = {
*/
static int
-CreateArc(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header
- * has been initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing arc. */
+CreateArc(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
+ * initialized by caller. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing arc. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
int i;
if (objc == 0) {
- panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords\n");
}
/*
- * Carry out initialization that is needed in order to clean
- * up after errors during the the remainder of this procedure.
+ * Carry out initialization that is needed in order to clean up after
+ * errors during the the remainder of this function.
*/
Tk_CreateOutline(&(arcPtr->outline));
@@ -327,6 +308,7 @@ CreateArc(interp, canvas, itemPtr, objc, objv)
for (i = 1; i < objc; i++) {
char *arg = Tcl_GetString(objv[i]);
+
if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
break;
}
@@ -337,7 +319,8 @@ CreateArc(interp, canvas, itemPtr, objc, objv)
if (ConfigureArc(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) {
return TCL_OK;
}
- error:
+
+ error:
DeleteArc(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -347,9 +330,8 @@ CreateArc(interp, canvas, itemPtr, objc, objv)
*
* ArcCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on arcs. See the user documentation for details
- * on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * arcs. See the user documentation for details on what it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -361,21 +343,20 @@ CreateArc(interp, canvas, itemPtr, objc, objv)
*/
static int
-ArcCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be
- * read or modified. */
- int objc; /* Number of coordinates supplied in
- * objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1,
- * x2, y2, ... */
+ArcCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
+ * modified. */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
if (objc == 0) {
Tcl_Obj *obj = Tcl_NewObj();
Tcl_Obj *subobj = Tcl_NewDoubleObj(arcPtr->bbox[0]);
+
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewDoubleObj(arcPtr->bbox[1]);
Tcl_ListObjAppendElement(interp, obj, subobj);
@@ -391,7 +372,7 @@ ArcCoords(interp, canvas, itemPtr, objc, objv)
return TCL_ERROR;
} else if (objc != 4) {
char buf[64 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "wrong # coordinates: expected 4, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
@@ -410,7 +391,7 @@ ArcCoords(interp, canvas, itemPtr, objc, objv)
ComputeArcBbox(canvas, arcPtr);
} else {
char buf[64 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
@@ -423,28 +404,28 @@ ArcCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigureArc --
*
- * This procedure is invoked to configure various aspects
- * of a arc item, such as its outline and fill colors.
+ * This function is invoked to configure various aspects of a arc item,
+ * such as its outline and fill colors.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
- * Configuration information, such as colors and stipple
- * patterns, may be set for itemPtr.
+ * Configuration information, such as colors and stipple patterns, may be
+ * set for itemPtr.
*
*--------------------------------------------------------------
*/
static int
-ConfigureArc(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Arc item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureArc(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Arc item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
XGCValues gcValues;
@@ -466,8 +447,8 @@ ConfigureArc(interp, canvas, itemPtr, objc, objv, flags)
state = itemPtr->state;
/*
- * A few of the options require additional processing, such as
- * style and graphics contexts.
+ * A few of the options require additional processing, such as style and
+ * graphics contexts.
*/
if (arcPtr->outline.activeWidth > arcPtr->outline.width ||
@@ -506,8 +487,7 @@ ConfigureArc(interp, canvas, itemPtr, objc, objv, flags)
i = (int) (arcPtr->extent/360.0);
arcPtr->extent -= i*360.0;
- mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr,
- &(arcPtr->outline));
+ mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(arcPtr->outline));
if (mask) {
gcValues.cap_style = CapButt;
mask |= GCCapStyle;
@@ -596,8 +576,8 @@ ConfigureArc(interp, canvas, itemPtr, objc, objv, flags)
*
* DeleteArc --
*
- * This procedure is called to clean up the data structure
- * associated with a arc item.
+ * This function is called to clean up the data structure associated with
+ * an arc item.
*
* Results:
* None.
@@ -609,11 +589,10 @@ ConfigureArc(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteArc(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall canvas. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for
- * canvas. */
+DeleteArc(
+ Tk_Canvas canvas, /* Info about overall canvas. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
@@ -649,31 +628,29 @@ DeleteArc(canvas, itemPtr, display)
*
* ComputeArcBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of an arc.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of an arc.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
-ComputeArcBbox(canvas, arcPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- ArcItem *arcPtr; /* Item whose bbox is to be
- * recomputed. */
+ComputeArcBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ ArcItem *arcPtr) /* Item whose bbox is to be recomputed. */
{
double tmp, center[2], point[2];
double width;
Tk_State state = arcPtr->header.state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -700,14 +677,14 @@ ComputeArcBbox(canvas, arcPtr)
*/
if (arcPtr->bbox[1] > arcPtr->bbox[3]) {
- double tmp;
- tmp = arcPtr->bbox[3];
+ double tmp = arcPtr->bbox[3];
+
arcPtr->bbox[3] = arcPtr->bbox[1];
arcPtr->bbox[1] = tmp;
}
if (arcPtr->bbox[0] > arcPtr->bbox[2]) {
- double tmp;
- tmp = arcPtr->bbox[2];
+ double tmp = arcPtr->bbox[2];
+
arcPtr->bbox[2] = arcPtr->bbox[0];
arcPtr->bbox[0] = tmp;
}
@@ -715,10 +692,10 @@ ComputeArcBbox(canvas, arcPtr)
ComputeArcOutline(canvas,arcPtr);
/*
- * To compute the bounding box, start with the the bbox formed
- * by the two endpoints of the arc. Then add in the center of
- * the arc's oval (if relevant) and the 3-o'clock, 6-o'clock,
- * 9-o'clock, and 12-o'clock positions, if they are relevant.
+ * To compute the bounding box, start with the the bbox formed by the two
+ * endpoints of the arc. Then add in the center of the arc's oval (if
+ * relevant) and the 3-o'clock, 6-o'clock, 9-o'clock, and 12-o'clock
+ * positions, if they are relevant.
*/
arcPtr->header.x1 = arcPtr->header.x2 = (int) arcPtr->center1[0];
@@ -768,8 +745,8 @@ ComputeArcBbox(canvas, arcPtr)
}
/*
- * Lastly, expand by the width of the arc (if the arc's outline is
- * being drawn) and add one extra pixel just for safety.
+ * Lastly, expand by the width of the arc (if the arc's outline is being
+ * drawn) and add one extra pixel just for safety.
*/
if (arcPtr->outline.gc == None) {
@@ -788,28 +765,26 @@ ComputeArcBbox(canvas, arcPtr)
*
* DisplayArc --
*
- * This procedure is invoked to draw an arc item in a given
- * drawable.
+ * This function is invoked to draw an arc item in a given drawable.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
static void
-DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw
- * item. */
- int x, y, width, height; /* Describes region of canvas that
- * must be redisplayed (not used). */
+DisplayArc(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, /* Describes region of canvas that must be */
+ int width, int height) /* redisplayed (not used). */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
short x1, y1, x2, y2;
@@ -818,7 +793,7 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
Tk_State state = itemPtr->state;
Pixmap stipple;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
lineWidth = arcPtr->outline.width;
@@ -837,7 +812,7 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
if (arcPtr->activeFillStipple != None) {
stipple = arcPtr->activeFillStipple;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (arcPtr->outline.disabledWidth > 0) {
lineWidth = arcPtr->outline.disabledWidth;
}
@@ -850,8 +825,8 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
}
/*
- * Compute the screen coordinates of the bounding box for the item,
- * plus integer values for the angles.
+ * Compute the screen coordinates of the bounding box for the item, plus
+ * integer values for the angles.
*/
Tk_CanvasDrawableCoords(canvas, arcPtr->bbox[0], arcPtr->bbox[1],
@@ -868,16 +843,18 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
extent = (int) ((64*arcPtr->extent) + 0.5);
/*
- * Display filled arc first (if wanted), then outline. If the extent
- * is zero then don't invoke XFillArc or XDrawArc, since this causes
- * some window servers to crash and should be a no-op anyway.
+ * Display filled arc first (if wanted), then outline. If the extent is
+ * zero then don't invoke XFillArc or XDrawArc, since this causes some
+ * window servers to crash and should be a no-op anyway.
*/
if ((arcPtr->fillGC != None) && (extent != 0)) {
if (stipple != None) {
- int w=0; int h=0;
+ int w = 0;
+ int h = 0;
Tk_TSOffset *tsoffset = &arcPtr->tsoffset;
int flags = tsoffset->flags;
+
if (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE)) {
Tk_SizeOfBitmap(display, stipple, &w, &h);
if (flags & TK_OFFSET_CENTER) {
@@ -914,10 +891,10 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
}
/*
- * If the outline width is very thin, don't use polygons to draw
- * the linear parts of the outline (this often results in nothing
- * being displayed); just draw lines instead. The same is done if
- * the outline is dashed, because then polygons don't work.
+ * If the outline width is very thin, don't use polygons to draw the
+ * linear parts of the outline (this often results in nothing being
+ * displayed); just draw lines instead. The same is done if the
+ * outline is dashed, because then polygons don't work.
*/
if (lineWidth < 1.5 || dashnumber != 0) {
@@ -948,8 +925,8 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
display, drawable, arcPtr->outline.gc, None);
TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
- PIE_OUTLINE2_PTS, display, drawable, arcPtr->outline.gc,
- None);
+ PIE_OUTLINE2_PTS, display, drawable,
+ arcPtr->outline.gc, None);
}
}
@@ -962,17 +939,16 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
*
* ArcToPoint --
*
- * Computes the distance from a given point to a given
- * arc, in canvas units.
+ * Computes the distance from a given point to a given arc, in canvas
+ * units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are coordPtr[0] and coordPtr[1] is inside the arc. If the
- * point isn't inside the arc then the return value is the
- * distance from the point to the arc. If itemPtr is filled,
- * then anywhere in the interior is considered "inside"; if
- * itemPtr isn't filled, then "inside" means only the area
- * occupied by the outline.
+ * The return value is 0 if the point whose x and y coordinates are
+ * coordPtr[0] and coordPtr[1] is inside the arc. If the point isn't
+ * inside the arc then the return value is the distance from the point to
+ * the arc. If itemPtr is filled, then anywhere in the interior is
+ * considered "inside"; if itemPtr isn't filled, then "inside" means only
+ * the area occupied by the outline.
*
* Side effects:
* None.
@@ -982,10 +958,10 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
/* ARGSUSED */
static double
-ArcToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+ArcToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
double vertex[2], pointAngle, diff, dist, newDist;
@@ -993,7 +969,7 @@ ArcToPoint(canvas, itemPtr, pointPtr)
int filled, angleInRange;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -1009,10 +985,9 @@ ArcToPoint(canvas, itemPtr, pointPtr)
}
/*
- * See if the point is within the angular range of the arc.
- * Remember, X angles are backwards from the way we'd normally
- * think of them. Also, compensate for any eccentricity of
- * the oval.
+ * See if the point is within the angular range of the arc. Remember, X
+ * angles are backwards from the way we'd normally think of them. Also,
+ * compensate for any eccentricity of the oval.
*/
vertex[0] = (arcPtr->bbox[0] + arcPtr->bbox[2])/2.0;
@@ -1039,14 +1014,13 @@ ArcToPoint(canvas, itemPtr, pointPtr)
((arcPtr->extent < 0) && ((diff - 360.0) >= arcPtr->extent));
/*
- * Now perform different tests depending on what kind of arc
- * we're dealing with.
+ * Now perform different tests depending on what kind of arc we're dealing
+ * with.
*/
if (arcPtr->style == ARC_STYLE) {
if (angleInRange) {
- return TkOvalToPoint(arcPtr->bbox, width,
- 0, pointPtr);
+ return TkOvalToPoint(arcPtr->bbox, width, 0, pointPtr);
}
dist = hypot(pointPtr[0] - arcPtr->center1[0],
pointPtr[1] - arcPtr->center1[1]);
@@ -1072,7 +1046,7 @@ ArcToPoint(canvas, itemPtr, pointPtr)
dist = TkPolygonToPoint(arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
pointPtr);
newDist = TkPolygonToPoint(arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
- PIE_OUTLINE2_PTS, pointPtr);
+ PIE_OUTLINE2_PTS, pointPtr);
} else {
dist = TkLineToPoint(vertex, arcPtr->center1, pointPtr);
newDist = TkLineToPoint(vertex, arcPtr->center2, pointPtr);
@@ -1090,17 +1064,16 @@ ArcToPoint(canvas, itemPtr, pointPtr)
}
/*
- * This is a chord-style arc. We have to deal specially with the
- * triangular piece that represents the difference between a
- * chord-style arc and a pie-slice arc (for small angles this piece
- * is excluded here where it would be included for pie slices;
- * for large angles the piece is included here but would be
- * excluded for pie slices).
+ * This is a chord-style arc. We have to deal specially with the
+ * triangular piece that represents the difference between a chord-style
+ * arc and a pie-slice arc (for small angles this piece is excluded here
+ * where it would be included for pie slices; for large angles the piece
+ * is included here but would be excluded for pie slices).
*/
if (width > 1.0) {
dist = TkPolygonToPoint(arcPtr->outlinePtr, CHORD_OUTLINE_PTS,
- pointPtr);
+ pointPtr);
} else {
dist = TkLineToPoint(arcPtr->center1, arcPtr->center2, pointPtr);
}
@@ -1134,14 +1107,13 @@ ArcToPoint(canvas, itemPtr, pointPtr)
*
* ArcToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given area.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given area.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -1151,26 +1123,25 @@ ArcToPoint(canvas, itemPtr, pointPtr)
/* ARGSUSED */
static int
-ArcToArea(canvas, itemPtr, rectPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against arc. */
- double *rectPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
- * area. */
+ArcToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against arc. */
+ double *rectPtr) /* Pointer to array of four coordinates (x1,
+ * y1, x2, y2) describing rectangular area. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
- double rx, ry; /* Radii for transformed oval: these define
- * an oval centered at the origin. */
- double tRect[4]; /* Transformed version of x1, y1, x2, y2,
- * for coord. system where arc is centered
- * on the origin. */
+ double rx, ry; /* Radii for transformed oval: these define an
+ * oval centered at the origin. */
+ double tRect[4]; /* Transformed version of x1, y1, x2, y2, for
+ * coord. system where arc is centered on the
+ * origin. */
double center[2], width, angle, tmp;
double points[20], *pointPtr;
int numPoints, filled;
int inside; /* Non-zero means every test so far suggests
- * that arc is inside rectangle. 0 means
- * every test so far shows arc to be outside
- * of rectangle. */
+ * that arc is inside rectangle. 0 means every
+ * test so far shows arc to be outside of
+ * rectangle. */
int newInside;
Tk_State state = itemPtr->state;
@@ -1182,7 +1153,7 @@ ArcToArea(canvas, itemPtr, rectPtr)
if (arcPtr->outline.activeWidth>width) {
width = (double) arcPtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (arcPtr->outline.disabledWidth>0) {
width = (double) arcPtr->outline.disabledWidth;
}
@@ -1198,8 +1169,8 @@ ArcToArea(canvas, itemPtr, rectPtr)
}
/*
- * Transform both the arc and the rectangle so that the arc's oval
- * is centered on the origin.
+ * Transform both the arc and the rectangle so that the arc's oval is
+ * centered on the origin.
*/
center[0] = (arcPtr->bbox[0] + arcPtr->bbox[2])/2.0;
@@ -1212,17 +1183,16 @@ ArcToArea(canvas, itemPtr, rectPtr)
ry = arcPtr->bbox[3] - center[1] + width/2.0;
/*
- * Find the extreme points of the arc and see whether these are all
- * inside the rectangle (in which case we're done), partly in and
- * partly out (in which case we're done), or all outside (in which
- * case we have more work to do). The extreme points include the
- * following, which are checked in order:
+ * Find the extreme points of the arc and see whether these are all inside
+ * the rectangle (in which case we're done), partly in and partly out (in
+ * which case we're done), or all outside (in which case we have more work
+ * to do). The extreme points include the following, which are checked in
+ * order:
*
- * 1. The outside points of the arc, corresponding to start and
- * extent.
+ * 1. The outside points of the arc, corresponding to start and extent.
* 2. The center of the arc (but only in pie-slice mode).
- * 3. The 12, 3, 6, and 9-o'clock positions (but only if the arc
- * includes those angles).
+ * 3. The 12, 3, 6, and 9-o'clock positions (but only if the arc includes
+ * those angles).
*/
pointPtr = points;
@@ -1283,8 +1253,8 @@ ArcToArea(canvas, itemPtr, rectPtr)
}
/*
- * Now that we've located the extreme points, loop through them all
- * to see which are inside the rectangle.
+ * Now that we've located the extreme points, loop through them all to see
+ * which are inside the rectangle.
*/
inside = (points[0] > tRect[0]) && (points[0] < tRect[2])
@@ -1302,17 +1272,17 @@ ArcToArea(canvas, itemPtr, rectPtr)
}
/*
- * So far, oval appears to be outside rectangle, but can't yet tell
- * for sure. Next, test each of the four sides of the rectangle
- * against the bounding region for the arc. If any intersections
- * are found, then return "overlapping". First, test against the
- * polygon(s) forming the sides of a chord or pie-slice.
+ * So far, oval appears to be outside rectangle, but can't yet tell for
+ * sure. Next, test each of the four sides of the rectangle against the
+ * bounding region for the arc. If any intersections are found, then
+ * return "overlapping". First, test against the polygon(s) forming the
+ * sides of a chord or pie-slice.
*/
if (arcPtr->style == PIESLICE_STYLE) {
if (width >= 1.0) {
if (TkPolygonToArea(arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
- rectPtr) != -1) {
+ rectPtr) != -1) {
return 0;
}
if (TkPolygonToArea(arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
@@ -1340,9 +1310,9 @@ ArcToArea(canvas, itemPtr, rectPtr)
}
/*
- * Next check for overlap between each of the four sides and the
- * outer perimiter of the arc. If the arc isn't filled, then also
- * check the inner perimeter of the arc.
+ * Next check for overlap between each of the four sides and the outer
+ * perimiter of the arc. If the arc isn't filled, then also check the
+ * inner perimeter of the arc.
*/
if (HorizLineToArc(tRect[0], tRect[2], tRect[1], rx, ry, arcPtr->start,
@@ -1371,11 +1341,11 @@ ArcToArea(canvas, itemPtr, rectPtr)
}
/*
- * The arc still appears to be totally disjoint from the rectangle,
- * but it's also possible that the rectangle is totally inside the arc.
- * Do one last check, which is to check one point of the rectangle
- * to see if it's inside the arc. If it is, we've got overlap. If
- * it isn't, the arc's really outside the rectangle.
+ * The arc still appears to be totally disjoint from the rectangle, but
+ * it's also possible that the rectangle is totally inside the arc. Do one
+ * last check, which is to check one point of the rectangle to see if it's
+ * inside the arc. If it is, we've got overlap. If it isn't, the arc's
+ * really outside the rectangle.
*/
if (ArcToPoint(canvas, itemPtr, rectPtr) == 0.0) {
@@ -1389,15 +1359,14 @@ ArcToArea(canvas, itemPtr, rectPtr)
*
* ScaleArc --
*
- * This procedure is invoked to rescale an arc item.
+ * This function is invoked to rescale an arc item.
*
* Results:
* None.
*
* Side effects:
- * The arc referred to by itemPtr is rescaled so that the
- * following transformation is applied to all point
- * coordinates:
+ * The arc referred to by itemPtr is rescaled so that the following
+ * transformation is applied to all point coordinates:
* x' = originX + scaleX*(x-originX)
* y' = originY + scaleY*(y-originY)
*
@@ -1405,12 +1374,13 @@ ArcToArea(canvas, itemPtr, rectPtr)
*/
static void
-ScaleArc(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing arc. */
- Tk_Item *itemPtr; /* Arc to be scaled. */
- double originX, originY; /* Origin about which to scale rect. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleArc(
+ Tk_Canvas canvas, /* Canvas containing arc. */
+ Tk_Item *itemPtr, /* Arc to be scaled. */
+ double originX, /* Origin about which to scale rect. */
+ double originY,
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
@@ -1426,25 +1396,24 @@ ScaleArc(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* TranslateArc --
*
- * This procedure is called to move an arc by a given amount.
+ * This function is called to move an arc by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the arc is offset by (xDelta, yDelta), and
- * the bounding box is updated in the generic part of the item
- * structure.
+ * The position of the arc is offset by (xDelta, yDelta), and the
+ * bounding box is updated in the generic part of the item structure.
*
*--------------------------------------------------------------
*/
static void
-TranslateArc(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be
- * moved. */
+TranslateArc(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, /* Amount by which item is to be moved. */
+ double deltaY)
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
@@ -1460,26 +1429,25 @@ TranslateArc(canvas, itemPtr, deltaX, deltaY)
*
* ComputeArcOutline --
*
- * This procedure creates a polygon describing everything in
- * the outline for an arc except what's in the curved part.
- * For a "pie slice" arc this is a V-shaped chunk, and for
- * a "chord" arc this is a linear chunk (with cutaway corners).
- * For "arc" arcs, this stuff isn't relevant.
+ * This function creates a polygon describing everything in the outline
+ * for an arc except what's in the curved part. For a "pie slice" arc
+ * this is a V-shaped chunk, and for a "chord" arc this is a linear chunk
+ * (with cutaway corners). For "arc" arcs, this stuff isn't relevant.
*
* Results:
* None.
*
* Side effects:
- * The information at arcPtr->outlinePtr gets modified, and
- * storage for arcPtr->outlinePtr may be allocated or freed.
+ * The information at arcPtr->outlinePtr gets modified, and storage for
+ * arcPtr->outlinePtr may be allocated or freed.
*
*--------------------------------------------------------------
*/
static void
-ComputeArcOutline(canvas,arcPtr)
- Tk_Canvas canvas; /* Information about overall canvas. */
- ArcItem *arcPtr; /* Information about arc. */
+ComputeArcOutline(
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ ArcItem *arcPtr) /* Information about arc. */
{
double sin1, cos1, sin2, cos2, angle, width, halfWidth;
double boxWidth, boxHeight;
@@ -1487,10 +1455,9 @@ ComputeArcOutline(canvas,arcPtr)
double *outlinePtr;
Tk_State state = arcPtr->header.state;
-
/*
- * Make sure that the outlinePtr array is large enough to hold
- * either a chord or pie-slice outline.
+ * Make sure that the outlinePtr array is large enough to hold either a
+ * chord or pie-slice outline.
*/
if (arcPtr->numOutlinePoints == 0) {
@@ -1500,14 +1467,13 @@ ComputeArcOutline(canvas,arcPtr)
}
outlinePtr = arcPtr->outlinePtr;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
/*
- * First compute the two points that lie at the centers of
- * the ends of the curved arc segment, which are marked with
- * X's in the figure below:
+ * First compute the two points that lie at the centers of the ends of the
+ * curved arc segment, which are marked with X's in the figure below:
*
*
* * * *
@@ -1517,13 +1483,13 @@ ComputeArcOutline(canvas,arcPtr)
* * * * *
* X * * X
*
- * The code is tricky because the arc can be ovular in shape.
- * It computes the position for a unit circle, and then
- * scales to fit the shape of the arc's bounding box.
+ * The code is tricky because the arc can be ovular in shape. It computes
+ * the position for a unit circle, and then scales to fit the shape of the
+ * arc's bounding box.
*
- * Also, watch out because angles go counter-clockwise like you
- * might expect, but the y-coordinate system is inverted. To
- * handle this, just negate the angles in all the computations.
+ * Also, watch out because angles go counter-clockwise like you might
+ * expect, but the y-coordinate system is inverted. To handle this, just
+ * negate the angles in all the computations.
*/
boxWidth = arcPtr->bbox[2] - arcPtr->bbox[0];
@@ -1542,8 +1508,8 @@ ComputeArcOutline(canvas,arcPtr)
arcPtr->center2[1] = vertex[1] + sin2*boxHeight/2.0;
/*
- * Next compute the "outermost corners" of the arc, which are
- * marked with X's in the figure below:
+ * Next compute the "outermost corners" of the arc, which are marked with
+ * X's in the figure below:
*
* * * *
* * *
@@ -1552,12 +1518,11 @@ ComputeArcOutline(canvas,arcPtr)
* X * * X
* * *
*
- * The code below is tricky because it has to handle eccentricity
- * in the shape of the oval. The key in the code below is to
- * realize that the slope of the line from arcPtr->center1 to corner1
- * is (boxWidth*sin1)/(boxHeight*cos1), and similarly for arcPtr->center2
- * and corner2. These formulas can be computed from the formula for
- * the oval.
+ * The code below is tricky because it has to handle eccentricity in the
+ * shape of the oval. The key in the code below is to realize that the
+ * slope of the line from arcPtr->center1 to corner1 is (boxWidth*sin1)
+ * divided by (boxHeight*cos1), and similarly for arcPtr->center2 and
+ * corner2. These formulas can be computed from the formula for the oval.
*/
width = arcPtr->outline.width;
@@ -1565,7 +1530,7 @@ ComputeArcOutline(canvas,arcPtr)
if (arcPtr->outline.activeWidth>arcPtr->outline.width) {
width = arcPtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (arcPtr->outline.disabledWidth>arcPtr->outline.width) {
width = arcPtr->outline.disabledWidth;
}
@@ -1588,10 +1553,10 @@ ComputeArcOutline(canvas,arcPtr)
corner2[1] = arcPtr->center2[1] + sin(angle)*halfWidth;
/*
- * For a chord outline, generate a six-sided polygon with three
- * points for each end of the chord. The first and third points
- * for each end are butt points generated on either side of the
- * center point. The second point is the corner point.
+ * For a chord outline, generate a six-sided polygon with three points for
+ * each end of the chord. The first and third points for each end are butt
+ * points generated on either side of the center point. The second point
+ * is the corner point.
*/
if (arcPtr->style == CHORD_STYLE) {
@@ -1611,10 +1576,9 @@ ComputeArcOutline(canvas,arcPtr)
- arcPtr->center1[1];
} else if (arcPtr->style == PIESLICE_STYLE) {
/*
- * For pie slices, generate two polygons, one for each side
- * of the pie slice. The first arm has a shape like this,
- * where the center of the oval is X, arcPtr->center1 is at Y, and
- * corner1 is at Z:
+ * For pie slices, generate two polygons, one for each side of the pie
+ * slice. The first arm has a shape like this, where the center of the
+ * oval is X, arcPtr->center1 is at Y, and corner1 is at Z:
*
* _____________________
* | \
@@ -1622,7 +1586,6 @@ ComputeArcOutline(canvas,arcPtr)
* X Y Z
* | /
* |_____________________/
- *
*/
TkGetButtPoints(arcPtr->center1, vertex, width, 0,
@@ -1639,7 +1602,6 @@ ComputeArcOutline(canvas,arcPtr)
/*
* The second arm has a shape like this:
*
- *
* ______________________
* / \
* / \
@@ -1648,10 +1610,10 @@ ComputeArcOutline(canvas,arcPtr)
* \______________________/
*
* Similar to above X is the center of the oval/circle, Y is
- * arcPtr->center2, and Z is corner2. The extra jog out to the left
- * of X is needed in or to produce a butted joint with the
- * first arm; the corner to the right of X is one of the
- * first two points of the first arm, depending on extent.
+ * arcPtr->center2, and Z is corner2. The extra jog out to the left of
+ * X is needed in or to produce a butted joint with the first arm; the
+ * corner to the right of X is one of the first two points of the
+ * first arm, depending on extent.
*/
TkGetButtPoints(arcPtr->center2, vertex, width, 0,
@@ -1680,15 +1642,13 @@ ComputeArcOutline(canvas,arcPtr)
*
* HorizLineToArc --
*
- * Determines whether a horizontal line segment intersects
- * a given arc.
+ * Determines whether a horizontal line segment intersects a given arc.
*
* Results:
- * The return value is 1 if the given line intersects the
- * infinitely-thin arc section defined by rx, ry, start,
- * and extent, and 0 otherwise. Only the perimeter of the
- * arc is checked: interior areas (e.g. pie-slice or chord)
- * are not checked.
+ * The return value is 1 if the given line intersects the infinitely-thin
+ * arc section defined by rx, ry, start, and extent, and 0 otherwise.
+ * Only the perimeter of the arc is checked: interior areas (e.g. chord
+ * or pie-slice) are not checked.
*
* Side effects:
* None.
@@ -1697,25 +1657,24 @@ ComputeArcOutline(canvas,arcPtr)
*/
static int
-HorizLineToArc(x1, x2, y, rx, ry, start, extent)
- double x1, x2; /* X-coords of endpoints of line segment.
- * X1 must be <= x2. */
- double y; /* Y-coordinate of line segment. */
- double rx, ry; /* These x- and y-radii define an oval
+HorizLineToArc(
+ double x1, double x2, /* X-coords of endpoints of line segment. X1
+ * must be <= x2. */
+ double y, /* Y-coordinate of line segment. */
+ double rx, double ry, /* These x- and y-radii define an oval
* centered at the origin. */
- double start, extent; /* Angles that define extent of arc, in
- * the standard fashion for this module. */
+ double start, double extent)/* Angles that define extent of arc, in the
+ * standard fashion for this module. */
{
- double tmp;
+ double tmp, x;
double tx, ty; /* Coordinates of intersection point in
* transformed coordinate system. */
- double x;
/*
- * Compute the x-coordinate of one possible intersection point
- * between the arc and the line. Use a transformed coordinate
- * system where the oval is a unit circle centered at the origin.
- * Then scale back to get actual x-coordinate.
+ * Compute the x-coordinate of one possible intersection point between the
+ * arc and the line. Use a transformed coordinate system where the oval is
+ * a unit circle centered at the origin. Then scale back to get actual
+ * x-coordinate.
*/
ty = y/ry;
@@ -1744,15 +1703,13 @@ HorizLineToArc(x1, x2, y, rx, ry, start, extent)
*
* VertLineToArc --
*
- * Determines whether a vertical line segment intersects
- * a given arc.
+ * Determines whether a vertical line segment intersects a given arc.
*
* Results:
- * The return value is 1 if the given line intersects the
- * infinitely-thin arc section defined by rx, ry, start,
- * and extent, and 0 otherwise. Only the perimeter of the
- * arc is checked: interior areas (e.g. pie-slice or chord)
- * are not checked.
+ * The return value is 1 if the given line intersects the infinitely-thin
+ * arc section defined by rx, ry, start, and extent, and 0 otherwise.
+ * Only the perimeter of the arc is checked: interior areas (e.g. chord
+ * or pie-slice) are not checked.
*
* Side effects:
* None.
@@ -1761,25 +1718,24 @@ HorizLineToArc(x1, x2, y, rx, ry, start, extent)
*/
static int
-VertLineToArc(x, y1, y2, rx, ry, start, extent)
- double x; /* X-coordinate of line segment. */
- double y1, y2; /* Y-coords of endpoints of line segment.
- * Y1 must be <= y2. */
- double rx, ry; /* These x- and y-radii define an oval
+VertLineToArc(
+ double x, /* X-coordinate of line segment. */
+ double y1, double y2, /* Y-coords of endpoints of line segment. Y1
+ * must be <= y2. */
+ double rx, double ry, /* These x- and y-radii define an oval
* centered at the origin. */
- double start, extent; /* Angles that define extent of arc, in
- * the standard fashion for this module. */
+ double start, double extent)/* Angles that define extent of arc, in the
+ * standard fashion for this module. */
{
- double tmp;
+ double tmp, y;
double tx, ty; /* Coordinates of intersection point in
* transformed coordinate system. */
- double y;
/*
- * Compute the y-coordinate of one possible intersection point
- * between the arc and the line. Use a transformed coordinate
- * system where the oval is a unit circle centered at the origin.
- * Then scale back to get actual y-coordinate.
+ * Compute the y-coordinate of one possible intersection point between the
+ * arc and the line. Use a transformed coordinate system where the oval is
+ * a unit circle centered at the origin. Then scale back to get actual
+ * y-coordinate.
*/
tx = x/rx;
@@ -1808,15 +1764,14 @@ VertLineToArc(x, y1, y2, rx, ry, start, extent)
*
* AngleInRange --
*
- * Determine whether the angle from the origin to a given
- * point is within a given range.
+ * Determine whether the angle from the origin to a given point is within
+ * a given range.
*
* Results:
- * The return value is 1 if the angle from (0,0) to (x,y)
- * is in the range given by start and extent, where angles
- * are interpreted in the standard way for ovals (meaning
- * backwards from normal interpretation). Otherwise the
- * return value is 0.
+ * The return value is 1 if the angle from (0,0) to (x,y) is in the range
+ * given by start and extent, where angles are interpreted in the
+ * standard way for ovals (meaning backwards from normal interpretation).
+ * Otherwise the return value is 0.
*
* Side effects:
* None.
@@ -1825,11 +1780,11 @@ VertLineToArc(x, y1, y2, rx, ry, start, extent)
*/
static int
-AngleInRange(x, y, start, extent)
- double x, y; /* Coordinate of point; angle measured
- * from origin to here, relative to x-axis. */
- double start; /* First angle, degrees, >=0, <=360. */
- double extent; /* Size of arc in degrees >=-360, <=360. */
+AngleInRange(
+ double x, double y, /* Coordinate of point; angle measured from
+ * origin to here, relative to x-axis. */
+ double start, /* First angle, degrees, >=0, <=360. */
+ double extent) /* Size of arc in degrees >=-360, <=360. */
{
double diff;
@@ -1855,15 +1810,13 @@ AngleInRange(x, y, start, extent)
*
* ArcToPostscript --
*
- * This procedure is called to generate Postscript for
- * arc items.
+ * This function is called to generate Postscript for arc items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in the interp's result, replacing whatever used
- * to be there. If no error occurs, then Postscript for the
- * item is appended to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in the interp's
+ * result, replacing whatever used to be there. If no error occurs, then
+ * Postscript for the item is appended to the result.
*
* Side effects:
* None.
@@ -1872,15 +1825,13 @@ AngleInRange(x, y, start, extent)
*/
static int
-ArcToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is
- * wanted. */
- int prepass; /* 1 means this is a prepass to
- * collect font information; 0 means
- * final Postscript is being created. */
+ArcToPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
char buffer[400];
@@ -1900,7 +1851,7 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
ang2 = arcPtr->start;
}
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
color = arcPtr->outline.color;
@@ -1920,7 +1871,7 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
if (arcPtr->activeFillStipple!=None) {
fillStipple = arcPtr->activeFillStipple;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (arcPtr->outline.disabledColor!=NULL) {
color = arcPtr->outline.disabledColor;
}
@@ -1936,15 +1887,15 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
}
/*
- * If the arc is filled, output Postscript for the interior region
- * of the arc.
+ * If the arc is filled, output Postscript for the interior region of the
+ * arc.
*/
if (arcPtr->fillGC != None) {
sprintf(buffer, "matrix currentmatrix\n%.15g %.15g translate %.15g %.15g scale\n",
(arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2,
(arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
if (arcPtr->style == CHORD_STYLE) {
sprintf(buffer, "0 0 1 %.15g %.15g arc closepath\nsetmatrix\n",
ang1, ang2);
@@ -1953,21 +1904,20 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
"0 0 moveto 0 0 1 %.15g %.15g arc closepath\nsetmatrix\n",
ang1, ang2);
}
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) {
return TCL_ERROR;
- };
+ }
if (fillStipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
- if (Tk_CanvasPsStipple(interp, canvas, fillStipple)
- != TCL_OK) {
+ Tcl_AppendResult(interp, "clip ", NULL);
+ if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) {
return TCL_ERROR;
}
if (arcPtr->outline.gc != None) {
- Tcl_AppendResult(interp, "grestore gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
}
@@ -1979,16 +1929,15 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
sprintf(buffer, "matrix currentmatrix\n%.15g %.15g translate %.15g %.15g scale\n",
(arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2,
(arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
sprintf(buffer, "0 0 1 %.15g %.15g", ang1, ang2);
Tcl_AppendResult(interp, buffer,
- " arc\nsetmatrix\n0 setlinecap\n", (char *) NULL);
- if (Tk_CanvasPsOutline(canvas, itemPtr,
- &(arcPtr->outline)) != TCL_OK) {
+ " arc\nsetmatrix\n0 setlinecap\n", NULL);
+ if (Tk_CanvasPsOutline(canvas, itemPtr, &(arcPtr->outline)) != TCL_OK){
return TCL_ERROR;
}
if (arcPtr->style != ARC_STYLE) {
- Tcl_AppendResult(interp, "grestore gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
if (arcPtr->style == CHORD_STYLE) {
Tk_CanvasPsPath(interp, canvas, arcPtr->outlinePtr,
CHORD_OUTLINE_PTS);
@@ -2000,15 +1949,14 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
return TCL_ERROR;
}
if (stipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
- if (Tk_CanvasPsStipple(interp, canvas,
- stipple) != TCL_OK) {
+ Tcl_AppendResult(interp, "clip ", NULL);
+ if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK){
return TCL_ERROR;
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
- Tcl_AppendResult(interp, "grestore gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
Tk_CanvasPsPath(interp, canvas,
arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
PIE_OUTLINE2_PTS);
@@ -2018,13 +1966,12 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
return TCL_ERROR;
}
if (stipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
- if (Tk_CanvasPsStipple(interp, canvas,
- stipple) != TCL_OK) {
+ Tcl_AppendResult(interp, "clip ", NULL);
+ if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
return TCL_ERROR;
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
}
}
@@ -2037,34 +1984,34 @@ ArcToPostscript(interp, canvas, itemPtr, prepass)
*
* StyleParseProc --
*
- * This procedure is invoked during option processing to handle
- * the "-style" option.
+ * This function is invoked during option processing to handle the
+ * "-style" option.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * The state for a given item gets replaced by the state
- * indicated in the value argument.
+ * The state for a given item gets replaced by the state indicated in the
+ * value argument.
*
*--------------------------------------------------------------
*/
static int
-StyleParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* some flags.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
+StyleParseProc(
+ ClientData clientData, /* some flags.*/
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ CONST char *value, /* Value of option. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset) /* Offset into item. */
{
int c;
size_t length;
register Style *stylePtr = (Style *) (widgRec + offset);
- if(value == NULL || *value == 0) {
+ if (value == NULL || *value == 0) {
*stylePtr = PIESLICE_STYLE;
return TCL_OK;
}
@@ -2085,9 +2032,8 @@ StyleParseProc(clientData, interp, tkwin, value, widgRec, offset)
return TCL_OK;
}
- Tcl_AppendResult(interp, "bad -style option \"",
- value, "\": must be arc, chord, or pieslice",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad -style option \"", value,
+ "\": must be arc, chord, or pieslice", NULL);
*stylePtr = PIESLICE_STYLE;
return TCL_ERROR;
}
@@ -2097,16 +2043,15 @@ StyleParseProc(clientData, interp, tkwin, value, widgRec, offset)
*
* StylePrintProc --
*
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-style"
- * configuration option.
+ * This function is invoked by the Tk configuration code to produce a
+ * printable string for the "-style" configuration option.
*
* Results:
- * The return value is a string describing the state for
- * the item referred to by "widgRec". In addition, *freeProcPtr
- * is filled in with the address of a procedure to call to free
- * the result string when it's no longer needed (or NULL to
- * indicate that the string doesn't need to be freed).
+ * The return value is a string describing the state for the item
+ * referred to by "widgRec". In addition, *freeProcPtr is filled in with
+ * the address of a function to call to free the result string when it's
+ * no longer needed (or NULL to indicate that the string doesn't need to
+ * be freed).
*
* Side effects:
* None.
@@ -2115,22 +2060,30 @@ StyleParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
static char *
-StylePrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Ignored. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
+StylePrintProc(
+ ClientData clientData, /* Ignored. */
+ Tk_Window tkwin, /* Ignored. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset, /* Offset into item. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ * information about how to reclaim storage
+ * for return string. */
{
register Style *stylePtr = (Style *) (widgRec + offset);
- if (*stylePtr==ARC_STYLE) {
+ if (*stylePtr == ARC_STYLE) {
return "arc";
- } else if (*stylePtr==CHORD_STYLE) {
+ } else if (*stylePtr == CHORD_STYLE) {
return "chord";
} else {
return "pieslice";
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index f308c52..30aa429 100644
--- a/generic/tkCanvBmap.c
+++ b/generic/tkCanvBmap.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkCanvBmap.c --
*
* This file implements bitmap items for canvas widgets.
@@ -6,13 +6,12 @@
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
/*
@@ -21,11 +20,10 @@
typedef struct BitmapItem {
Tk_Item header; /* Generic stuff that's the same for all
- * types. MUST BE FIRST IN STRUCTURE. */
+ * types. MUST BE FIRST IN STRUCTURE. */
double x, y; /* Coordinates of positioning point for
* bitmap. */
- Tk_Anchor anchor; /* Where to anchor bitmap relative to
- * (x,y). */
+ Tk_Anchor anchor; /* Where to anchor bitmap relative to (x,y) */
Pixmap bitmap; /* Bitmap to display in window. */
Pixmap activeBitmap; /* Bitmap to display in window. */
Pixmap disabledBitmap; /* Bitmap to display in window. */
@@ -35,8 +33,8 @@ typedef struct BitmapItem {
XColor *bgColor; /* Background color to use for bitmap. */
XColor *activeBgColor; /* Background color to use for bitmap. */
XColor *disabledBgColor; /* Background color to use for bitmap. */
- GC gc; /* Graphics context to use for drawing
- * bitmap on screen. */
+ GC gc; /* Graphics context to use for drawing bitmap
+ * on screen. */
} BitmapItem;
/*
@@ -53,96 +51,95 @@ static Tk_CustomOption tagsOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_COLOR, "-activebackground", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activebitmap", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-activeforeground", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, activeFgColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_ANCHOR, "-anchor", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-activebackground", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activebitmap", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-activeforeground", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, activeFgColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
"center", Tk_Offset(BitmapItem, anchor), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_COLOR, "-background", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, bgColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-bitmap", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, bitmap), TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-disabledbackground", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, disabledBgColor),
+ {TK_CONFIG_COLOR, "-background", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, bgColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-bitmap", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, bitmap), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-disabledbackground", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, disabledBgColor),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledbitmap", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, disabledBitmap),
+ {TK_CONFIG_BITMAP, "-disabledbitmap", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, disabledBitmap),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-disabledforeground", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapItem, disabledFgColor),
+ {TK_CONFIG_COLOR, "-disabledforeground", NULL, NULL,
+ NULL, Tk_Offset(BitmapItem, disabledFgColor),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-foreground", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-foreground", NULL, NULL,
"black", Tk_Offset(BitmapItem, fgColor), 0},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
&stateOption},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static int BitmapCoords _ANSI_ARGS_((Tcl_Interp *interp,
+static int BitmapCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static int BitmapToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *rectPtr));
-static double BitmapToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *coordPtr));
-static int BitmapToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static void ComputeBitmapBbox _ANSI_ARGS_((Tk_Canvas canvas,
- BitmapItem *bmapPtr));
-static int ConfigureBitmap _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST objv[]);
+static int BitmapToArea(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *rectPtr);
+static double BitmapToPoint(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *coordPtr);
+static int BitmapToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static void ComputeBitmapBbox(Tk_Canvas canvas,
+ BitmapItem *bmapPtr);
+static int ConfigureBitmap(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags));
-static int TkcCreateBitmap _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST objv[], int flags);
+static int TkcCreateBitmap(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void DeleteBitmap _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayBitmap _ANSI_ARGS_((Tk_Canvas canvas,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DeleteBitmap(Tk_Canvas canvas,
+ Tk_Item *itemPtr, Display *display);
+static void DisplayBitmap(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static void ScaleBitmap _ANSI_ARGS_((Tk_Canvas canvas,
+ int x, int y, int width, int height);
+static void ScaleBitmap(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void TranslateBitmap _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
+ double scaleX, double scaleY);
+static void TranslateBitmap(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double deltaX, double deltaY);
/*
- * The structures below defines the bitmap item type in terms of
- * procedures that can be invoked by generic item code.
+ * The structures below defines the bitmap item type in terms of functions
+ * that can be invoked by generic item code.
*/
Tk_ItemType tkBitmapType = {
- "bitmap", /* name */
- sizeof(BitmapItem), /* itemSize */
- TkcCreateBitmap, /* createProc */
- configSpecs, /* configSpecs */
- ConfigureBitmap, /* configureProc */
- BitmapCoords, /* coordProc */
- DeleteBitmap, /* deleteProc */
- DisplayBitmap, /* displayProc */
- TK_CONFIG_OBJS, /* flags */
- BitmapToPoint, /* pointProc */
- BitmapToArea, /* areaProc */
- BitmapToPostscript, /* postscriptProc */
- ScaleBitmap, /* scaleProc */
- TranslateBitmap, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* icursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ "bitmap", /* name */
+ sizeof(BitmapItem), /* itemSize */
+ TkcCreateBitmap, /* createProc */
+ configSpecs, /* configSpecs */
+ ConfigureBitmap, /* configureProc */
+ BitmapCoords, /* coordProc */
+ DeleteBitmap, /* deleteProc */
+ DisplayBitmap, /* displayProc */
+ TK_CONFIG_OBJS, /* flags */
+ BitmapToPoint, /* pointProc */
+ BitmapToArea, /* areaProc */
+ BitmapToPostscript, /* postscriptProc */
+ ScaleBitmap, /* scaleProc */
+ TranslateBitmap, /* translateProc */
+ NULL, /* indexProc */
+ NULL, /* icursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
/*
@@ -150,14 +147,13 @@ Tk_ItemType tkBitmapType = {
*
* TkcCreateBitmap --
*
- * This procedure is invoked to create a new bitmap
- * item in a canvas.
+ * This function is invoked to create a new bitmap item in a canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item, then an error message is left in
- * the interp's result; in this case itemPtr is left uninitialized,
- * so it can be safely freed by the caller.
+ * A standard Tcl return value. If an error occurred in creating the
+ * item, then an error message is left in the interp's result; in this
+ * case itemPtr is left uninitialized, so it can be safely freed by the
+ * caller.
*
* Side effects:
* A new bitmap item is created.
@@ -166,13 +162,13 @@ Tk_ItemType tkBitmapType = {
*/
static int
-TkcCreateBitmap(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header
- * has been initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */
+TkcCreateBitmap(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
+ * initialized by caller. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
int i;
@@ -198,8 +194,8 @@ TkcCreateBitmap(interp, canvas, itemPtr, objc, objv)
bmapPtr->gc = None;
/*
- * Process the arguments to fill in the item record.
- * Only 1 (list) or 2 (x y) coords are allowed.
+ * Process the arguments to fill in the item record. Only 1 (list) or 2 (x
+ * y) coords are allowed.
*/
if (objc == 1) {
@@ -219,7 +215,7 @@ TkcCreateBitmap(interp, canvas, itemPtr, objc, objv)
return TCL_OK;
}
- error:
+ error:
DeleteBitmap(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -229,9 +225,8 @@ TkcCreateBitmap(interp, canvas, itemPtr, objc, objv)
*
* BitmapCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on bitmap items. See the user documentation for
- * details on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * bitmap items. See the user documentation for details on what it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -243,20 +238,19 @@ TkcCreateBitmap(interp, canvas, itemPtr, objc, objv)
*/
static int
-BitmapCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be
- * read or modified. */
- int objc; /* Number of coordinates supplied in
- * objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1,
- * x2, y2, ... */
+BitmapCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
+ * modified. */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
if (objc == 0) {
Tcl_Obj *obj = Tcl_NewObj();
+
Tcl_Obj *subobj = Tcl_NewDoubleObj(bmapPtr->x);
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewDoubleObj(bmapPtr->y);
@@ -297,12 +291,12 @@ BitmapCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigureBitmap --
*
- * This procedure is invoked to configure various aspects
- * of a bitmap item, such as its anchor position.
+ * This function is invoked to configure various aspects of a bitmap
+ * item, such as its anchor position.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
* Configuration information may be set for itemPtr.
@@ -311,13 +305,13 @@ BitmapCoords(interp, canvas, itemPtr, objc, objv)
*/
static int
-ConfigureBitmap(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Bitmap item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureBitmap(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Bitmap item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
XGCValues gcValues;
@@ -336,8 +330,8 @@ ConfigureBitmap(interp, canvas, itemPtr, objc, objv, flags)
}
/*
- * A few of the options require additional processing, such as those
- * that determine the graphics context.
+ * A few of the options require additional processing, such as those that
+ * determine the graphics context.
*/
state = itemPtr->state;
@@ -410,8 +404,8 @@ ConfigureBitmap(interp, canvas, itemPtr, objc, objv, flags)
*
* DeleteBitmap --
*
- * This procedure is called to clean up the data structure
- * associated with a bitmap item.
+ * This function is called to clean up the data structure associated with
+ * a bitmap item.
*
* Results:
* None.
@@ -423,11 +417,10 @@ ConfigureBitmap(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteBitmap(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall canvas widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for
- * canvas. */
+DeleteBitmap(
+ Tk_Canvas canvas, /* Info about overall canvas widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
@@ -468,27 +461,24 @@ DeleteBitmap(canvas, itemPtr, display)
*
* ComputeBitmapBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of a bitmap item.
- * This procedure is where the child bitmap's placement is
- * computed.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of a bitmap item. This function is where the
+ * child bitmap's placement is computed.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
-ComputeBitmapBbox(canvas, bmapPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- BitmapItem *bmapPtr; /* Item whose bbox is to be
- * recomputed. */
+ComputeBitmapBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ BitmapItem *bmapPtr) /* Item whose bbox is to be recomputed. */
{
int width, height;
int x, y;
@@ -525,36 +515,36 @@ ComputeBitmapBbox(canvas, bmapPtr)
Tk_SizeOfBitmap(Tk_Display(Tk_CanvasTkwin(canvas)), bitmap,
&width, &height);
switch (bmapPtr->anchor) {
- case TK_ANCHOR_N:
- x -= width/2;
- break;
- case TK_ANCHOR_NE:
- x -= width;
- break;
- case TK_ANCHOR_E:
- x -= width;
- y -= height/2;
- break;
- case TK_ANCHOR_SE:
- x -= width;
- y -= height;
- break;
- case TK_ANCHOR_S:
- x -= width/2;
- y -= height;
- break;
- case TK_ANCHOR_SW:
- y -= height;
- break;
- case TK_ANCHOR_W:
- y -= height/2;
- break;
- case TK_ANCHOR_NW:
- break;
- case TK_ANCHOR_CENTER:
- x -= width/2;
- y -= height/2;
- break;
+ case TK_ANCHOR_N:
+ x -= width/2;
+ break;
+ case TK_ANCHOR_NE:
+ x -= width;
+ break;
+ case TK_ANCHOR_E:
+ x -= width;
+ y -= height/2;
+ break;
+ case TK_ANCHOR_SE:
+ x -= width;
+ y -= height;
+ break;
+ case TK_ANCHOR_S:
+ x -= width/2;
+ y -= height;
+ break;
+ case TK_ANCHOR_SW:
+ y -= height;
+ break;
+ case TK_ANCHOR_W:
+ y -= height/2;
+ break;
+ case TK_ANCHOR_NW:
+ break;
+ case TK_ANCHOR_CENTER:
+ x -= width/2;
+ y -= height/2;
+ break;
}
/*
@@ -572,28 +562,27 @@ ComputeBitmapBbox(canvas, bmapPtr)
*
* DisplayBitmap --
*
- * This procedure is invoked to draw a bitmap item in a given
- * drawable.
+ * This function is invoked to draw a bitmap item in a given drawable.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
static void
-DisplayBitmap(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw
- * item. */
- int x, y, width, height; /* Describes region of canvas that
- * must be redisplayed (not used). */
+DisplayBitmap(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, int width, int height)
+ /* Describes region of canvas that must be
+ * redisplayed (not used). */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
int bmapX, bmapY, bmapWidth, bmapHeight;
@@ -602,9 +591,8 @@ DisplayBitmap(canvas, itemPtr, display, drawable, x, y, width, height)
Tk_State state = itemPtr->state;
/*
- * If the area being displayed doesn't cover the whole bitmap,
- * then only redisplay the part of the bitmap that needs
- * redisplay.
+ * If the area being displayed doesn't cover the whole bitmap, then only
+ * redisplay the part of the bitmap that needs redisplay.
*/
if (state == TK_STATE_NULL) {
@@ -650,9 +638,9 @@ DisplayBitmap(canvas, itemPtr, display, drawable, x, y, width, height)
&drawableX, &drawableY);
/*
- * Must modify the mask origin within the graphics context
- * to line up with the bitmap's origin (in order to make
- * bitmaps with "-background {}" work right).
+ * Must modify the mask origin within the graphics context to line up
+ * with the bitmap's origin (in order to make bitmaps with
+ * "-background {}" work right).
*/
XSetClipOrigin(display, bmapPtr->gc, drawableX - bmapX,
@@ -669,14 +657,14 @@ DisplayBitmap(canvas, itemPtr, display, drawable, x, y, width, height)
*
* BitmapToPoint --
*
- * Computes the distance from a given point to a given
- * rectangle, in canvas units.
+ * Computes the distance from a given point to a given rectangle, in
+ * canvas units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are coordPtr[0] and coordPtr[1] is inside the bitmap. If the
- * point isn't inside the bitmap then the return value is the
- * distance from the point to the bitmap.
+ * The return value is 0 if the point whose x and y coordinates are
+ * coordPtr[0] and coordPtr[1] is inside the bitmap. If the point isn't
+ * inside the bitmap then the return value is the distance from the point
+ * to the bitmap.
*
* Side effects:
* None.
@@ -686,10 +674,10 @@ DisplayBitmap(canvas, itemPtr, display, drawable, x, y, width, height)
/* ARGSUSED */
static double
-BitmapToPoint(canvas, itemPtr, coordPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *coordPtr; /* Pointer to x and y coordinates. */
+BitmapToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *coordPtr) /* Pointer to x and y coordinates. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
double x1, x2, y1, y2, xDiff, yDiff;
@@ -727,14 +715,13 @@ BitmapToPoint(canvas, itemPtr, coordPtr)
*
* BitmapToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangle.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangle.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -744,12 +731,12 @@ BitmapToPoint(canvas, itemPtr, coordPtr)
/* ARGSUSED */
static int
-BitmapToArea(canvas, itemPtr, rectPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against rectangle. */
- double *rectPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
- * area. */
+BitmapToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against rectangle. */
+ double *rectPtr) /* Pointer to array of four coordinates
+ * (x1,y1,x2,y2) describing rectangular
+ * area. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
@@ -773,16 +760,16 @@ BitmapToArea(canvas, itemPtr, rectPtr)
*
* ScaleBitmap --
*
- * This procedure is invoked to rescale a bitmap item in a
- * canvas. It is one of the standard item procedures for
- * bitmap items, and is invoked by the generic canvas code.
+ * This function is invoked to rescale a bitmap item in a canvas. It is
+ * one of the standard item functions for bitmap items, and is invoked by
+ * the generic canvas code.
*
* Results:
* None.
*
* Side effects:
- * The item referred to by itemPtr is rescaled so that the
- * following transformation is applied to all point coordinates:
+ * The item referred to by itemPtr is rescaled so that the following
+ * transformation is applied to all point coordinates:
* x' = originX + scaleX*(x-originX)
* y' = originY + scaleY*(y-originY)
*
@@ -790,12 +777,13 @@ BitmapToArea(canvas, itemPtr, rectPtr)
*/
static void
-ScaleBitmap(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing rectangle. */
- Tk_Item *itemPtr; /* Rectangle to be scaled. */
- double originX, originY; /* Origin about which to scale item. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleBitmap(
+ Tk_Canvas canvas, /* Canvas containing rectangle. */
+ Tk_Item *itemPtr, /* Rectangle to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale item. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
@@ -809,25 +797,24 @@ ScaleBitmap(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* TranslateBitmap --
*
- * This procedure is called to move an item by a given amount.
+ * This function is called to move an item by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the item is offset by (xDelta, yDelta), and
- * the bounding box is updated in the generic part of the item
- * structure.
+ * The position of the item is offset by (xDelta, yDelta), and the
+ * bounding box is updated in the generic part of the item structure.
*
*--------------------------------------------------------------
*/
static void
-TranslateBitmap(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be
- * moved. */
+TranslateBitmap(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
@@ -841,15 +828,13 @@ TranslateBitmap(canvas, itemPtr, deltaX, deltaY)
*
* BitmapToPostscript --
*
- * This procedure is called to generate Postscript for
- * bitmap items.
+ * This function is called to generate Postscript for bitmap items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in the interp's result, replacing whatever used to be there.
- * If no error occurs, then Postscript for the item is appended
- * to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in the interp's
+ * result, replacing whatever used to be there. If no error occurs, then
+ * Postscript for the item is appended to the result.
*
* Side effects:
* None.
@@ -858,15 +843,13 @@ TranslateBitmap(canvas, itemPtr, deltaX, deltaY)
*/
static int
-BitmapToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is
- * wanted. */
- int prepass; /* 1 means this is a prepass to
- * collect font information; 0 means
- * final Postscript is being created. */
+BitmapToPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
double x, y;
@@ -911,8 +894,8 @@ BitmapToPostscript(interp, canvas, itemPtr, prepass)
}
/*
- * Compute the coordinates of the lower-left corner of the bitmap,
- * taking into account the anchor position for the bitmp.
+ * Compute the coordinates of the lower-left corner of the bitmap, taking
+ * into account the anchor position for the bitmp.
*/
x = bmapPtr->x;
@@ -920,15 +903,15 @@ BitmapToPostscript(interp, canvas, itemPtr, prepass)
Tk_SizeOfBitmap(Tk_Display(Tk_CanvasTkwin(canvas)), bitmap,
&width, &height);
switch (bmapPtr->anchor) {
- case TK_ANCHOR_NW: y -= height; break;
- case TK_ANCHOR_N: x -= width/2.0; y -= height; break;
- case TK_ANCHOR_NE: x -= width; y -= height; break;
- case TK_ANCHOR_E: x -= width; y -= height/2.0; break;
- case TK_ANCHOR_SE: x -= width; break;
- case TK_ANCHOR_S: x -= width/2.0; break;
- case TK_ANCHOR_SW: break;
- case TK_ANCHOR_W: y -= height/2.0; break;
- case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
+ case TK_ANCHOR_NW: y -= height; break;
+ case TK_ANCHOR_N: x -= width/2.0; y -= height; break;
+ case TK_ANCHOR_NE: x -= width; y -= height; break;
+ case TK_ANCHOR_E: x -= width; y -= height/2.0; break;
+ case TK_ANCHOR_SE: x -= width; break;
+ case TK_ANCHOR_S: x -= width/2.0; break;
+ case TK_ANCHOR_SW: break;
+ case TK_ANCHOR_W: y -= height/2.0; break;
+ case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
}
/*
@@ -939,18 +922,18 @@ BitmapToPostscript(interp, canvas, itemPtr, prepass)
sprintf(buffer,
"%.15g %.15g moveto %d 0 rlineto 0 %d rlineto %d %s\n",
x, y, width, height, -width, "0 rlineto closepath");
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
if (Tk_CanvasPsColor(interp, canvas, bgColor) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
/*
- * Draw the bitmap, if there is a foreground color. If the bitmap
- * is very large, then chop it up into multiple bitmaps, each
- * consisting of one or more rows. This is needed because Postscript
- * can't handle single strings longer than 64 KBytes long.
+ * Draw the bitmap, if there is a foreground color. If the bitmap is very
+ * large, then chop it up into multiple bitmaps, each consisting of one or
+ * more rows. This is needed because Postscript can't handle single
+ * strings longer than 64 KBytes long.
*/
if (fgColor != NULL) {
@@ -960,8 +943,7 @@ BitmapToPostscript(interp, canvas, itemPtr, prepass)
if (width > 60000) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "can't generate Postscript",
- " for bitmaps more than 60000 pixels wide",
- (char *) NULL);
+ " for bitmaps more than 60000 pixels wide", NULL);
return TCL_ERROR;
}
rowsAtOnce = 60000/width;
@@ -969,7 +951,7 @@ BitmapToPostscript(interp, canvas, itemPtr, prepass)
rowsAtOnce = 1;
}
sprintf(buffer, "%.15g %.15g translate\n", x, y+height);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
for (curRow = 0; curRow < height; curRow += rowsAtOnce) {
rowsThisTime = rowsAtOnce;
if (rowsThisTime > (height - curRow)) {
@@ -977,13 +959,21 @@ BitmapToPostscript(interp, canvas, itemPtr, prepass)
}
sprintf(buffer, "0 -%.15g translate\n%d %d true matrix {\n",
(double) rowsThisTime, width, rowsThisTime);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
if (Tk_CanvasPsBitmap(interp, canvas, bitmap,
0, curRow, width, rowsThisTime) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_AppendResult(interp, "\n} imagemask\n", (char *) NULL);
+ Tcl_AppendResult(interp, "\n} imagemask\n", NULL);
}
}
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index ba85b4f..9e928c7 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkCanvImg.c --
*
* This file implements image items for canvas widgets.
@@ -6,13 +6,12 @@
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
/*
@@ -21,24 +20,24 @@
typedef struct ImageItem {
Tk_Item header; /* Generic stuff that's the same for all
- * types. MUST BE FIRST IN STRUCTURE. */
+ * types. MUST BE FIRST IN STRUCTURE. */
Tk_Canvas canvas; /* Canvas containing the image. */
double x, y; /* Coordinates of positioning point for
* image. */
- Tk_Anchor anchor; /* Where to anchor image relative to
- * (x,y). */
- char *imageString; /* String describing -image option (malloc-ed).
- * NULL means no image right now. */
+ Tk_Anchor anchor; /* Where to anchor image relative to (x,y). */
+ char *imageString; /* String describing -image option
+ * (malloc-ed). NULL means no image right
+ * now. */
char *activeImageString; /* String describing -activeimage option.
* NULL means no image right now. */
char *disabledImageString; /* String describing -disabledimage option.
* NULL means no image right now. */
- Tk_Image image; /* Image to display in window, or NULL if
- * no image at present. */
- Tk_Image activeImage; /* Image to display in window, or NULL if
- * no image at present. */
- Tk_Image disabledImage; /* Image to display in window, or NULL if
- * no image at present. */
+ Tk_Image image; /* Image to display in window, or NULL if no
+ * image at present. */
+ Tk_Image activeImage; /* Image to display in window, or NULL if no
+ * image at present. */
+ Tk_Image disabledImage; /* Image to display in window, or NULL if no
+ * image at present. */
} ImageItem;
/*
@@ -55,86 +54,81 @@ static Tk_CustomOption tagsOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_STRING, "-activeimage", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ImageItem, activeImageString),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_ANCHOR, "-anchor", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-activeimage", NULL, NULL,
+ NULL, Tk_Offset(ImageItem, activeImageString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
"center", Tk_Offset(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_STRING, "-disabledimage", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ImageItem, disabledImageString),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-image", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_STRING, "-disabledimage", NULL, NULL,
+ NULL, Tk_Offset(ImageItem, disabledImageString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_STRING, "-image", NULL, NULL,
+ NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static void ImageChangedProc _ANSI_ARGS_((ClientData clientData,
+static void ImageChangedProc(ClientData clientData,
int x, int y, int width, int height, int imgWidth,
- int imgHeight));
-static int ImageCoords _ANSI_ARGS_((Tcl_Interp *interp,
+ int imgHeight);
+static int ImageCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST argv[]));
-static int ImageToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *rectPtr));
-static double ImageToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *coordPtr));
-static int ImageToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static void ComputeImageBbox _ANSI_ARGS_((Tk_Canvas canvas,
- ImageItem *imgPtr));
-static int ConfigureImage _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST argv[]);
+static int ImageToArea(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *rectPtr);
+static double ImageToPoint(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *coordPtr);
+static int ImageToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static void ComputeImageBbox(Tk_Canvas canvas, ImageItem *imgPtr);
+static int ConfigureImage(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST argv[], int flags));
-static int CreateImage _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST argv[], int flags);
+static int CreateImage(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST argv[]));
-static void DeleteImage _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayImage _ANSI_ARGS_((Tk_Canvas canvas,
+ int argc, Tcl_Obj *CONST argv[]);
+static void DeleteImage(Tk_Canvas canvas,
+ Tk_Item *itemPtr, Display *display);
+static void DisplayImage(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static void ScaleImage _ANSI_ARGS_((Tk_Canvas canvas,
+ int x, int y, int width, int height);
+static void ScaleImage(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void TranslateImage _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
+ double scaleX, double scaleY);
+static void TranslateImage(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double deltaX, double deltaY);
/*
- * The structures below defines the image item type in terms of
- * procedures that can be invoked by generic item code.
+ * The structures below defines the image item type in terms of functions that
+ * can be invoked by generic item code.
*/
Tk_ItemType tkImageType = {
- "image", /* name */
- sizeof(ImageItem), /* itemSize */
- CreateImage, /* createProc */
- configSpecs, /* configSpecs */
- ConfigureImage, /* configureProc */
- ImageCoords, /* coordProc */
- DeleteImage, /* deleteProc */
- DisplayImage, /* displayProc */
- TK_CONFIG_OBJS, /* flags */
- ImageToPoint, /* pointProc */
- ImageToArea, /* areaProc */
- ImageToPostscript, /* postscriptProc */
- ScaleImage, /* scaleProc */
- TranslateImage, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* icursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ "image", /* name */
+ sizeof(ImageItem), /* itemSize */
+ CreateImage, /* createProc */
+ configSpecs, /* configSpecs */
+ ConfigureImage, /* configureProc */
+ ImageCoords, /* coordProc */
+ DeleteImage, /* deleteProc */
+ DisplayImage, /* displayProc */
+ TK_CONFIG_OBJS, /* flags */
+ ImageToPoint, /* pointProc */
+ ImageToArea, /* areaProc */
+ ImageToPostscript, /* postscriptProc */
+ ScaleImage, /* scaleProc */
+ TranslateImage, /* translateProc */
+ NULL, /* indexProc */
+ NULL, /* icursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
/*
@@ -142,14 +136,13 @@ Tk_ItemType tkImageType = {
*
* CreateImage --
*
- * This procedure is invoked to create a new image
- * item in a canvas.
+ * This function is invoked to create a new image item in a canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item, then an error message is left in
- * the interp's result; in this case itemPtr is left uninitialized,
- * so it can be safely freed by the caller.
+ * A standard Tcl return value. If an error occurred in creating the
+ * item, then an error message is left in the interp's result; in this
+ * case itemPtr is left uninitialized, so it can be safely freed by the
+ * caller.
*
* Side effects:
* A new image item is created.
@@ -158,19 +151,19 @@ Tk_ItemType tkImageType = {
*/
static int
-CreateImage(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header
- * has been initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */
+CreateImage(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
+ * initialized by caller. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
int i;
if (objc == 0) {
- panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords\n");
}
/*
@@ -187,8 +180,8 @@ CreateImage(interp, canvas, itemPtr, objc, objv)
imgPtr->disabledImage = NULL;
/*
- * Process the arguments to fill in the item record.
- * Only 1 (list) or 2 (x y) coords are allowed.
+ * Process the arguments to fill in the item record. Only 1 (list) or 2 (x
+ * y) coords are allowed.
*/
if (objc == 1) {
@@ -207,7 +200,7 @@ CreateImage(interp, canvas, itemPtr, objc, objv)
return TCL_OK;
}
- error:
+ error:
DeleteImage(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -217,9 +210,8 @@ CreateImage(interp, canvas, itemPtr, objc, objv)
*
* ImageCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on image items. See the user documentation for
- * details on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * image items. See the user documentation for details on what it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -231,20 +223,19 @@ CreateImage(interp, canvas, itemPtr, objc, objv)
*/
static int
-ImageCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be
- * read or modified. */
- int objc; /* Number of coordinates supplied in
- * objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1,
- * x2, y2, ... */
+ImageCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
+ * modified. */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
if (objc == 0) {
Tcl_Obj *obj = Tcl_NewObj();
+
Tcl_Obj *subobj = Tcl_NewDoubleObj(imgPtr->x);
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewDoubleObj(imgPtr->y);
@@ -271,7 +262,7 @@ ImageCoords(interp, canvas, itemPtr, objc, objv)
ComputeImageBbox(canvas, imgPtr);
} else {
char buf[64];
-
+
sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
@@ -284,12 +275,12 @@ ImageCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigureImage --
*
- * This procedure is invoked to configure various aspects
- * of an image item, such as its anchor position.
+ * This function is invoked to configure various aspects of an image
+ * item, such as its anchor position.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
* Configuration information may be set for itemPtr.
@@ -298,13 +289,13 @@ ImageCoords(interp, canvas, itemPtr, objc, objv)
*/
static int
-ConfigureImage(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Image item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureImage(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Image item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
Tk_Window tkwin;
@@ -317,10 +308,10 @@ ConfigureImage(interp, canvas, itemPtr, objc, objv, flags)
}
/*
- * Create the image. Save the old image around and don't free it
- * until after the new one is allocated. This keeps the reference
- * count from going to zero so the image doesn't have to be recreated
- * if it hasn't changed.
+ * Create the image. Save the old image around and don't free it until
+ * after the new one is allocated. This keeps the reference count from
+ * going to zero so the image doesn't have to be recreated if it hasn't
+ * changed.
*/
if (imgPtr->activeImageString != NULL) {
@@ -376,8 +367,8 @@ ConfigureImage(interp, canvas, itemPtr, objc, objv, flags)
*
* DeleteImage --
*
- * This procedure is called to clean up the data structure
- * associated with a image item.
+ * This function is called to clean up the data structure associated with
+ * a image item.
*
* Results:
* None.
@@ -389,11 +380,10 @@ ConfigureImage(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteImage(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall canvas widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for
- * canvas. */
+DeleteImage(
+ Tk_Canvas canvas, /* Info about overall canvas widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
@@ -422,27 +412,24 @@ DeleteImage(canvas, itemPtr, display)
*
* ComputeImageBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of a image item.
- * This procedure is where the child image's placement is
- * computed.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of a image item. This function is where the
+ * child image's placement is computed.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
-ComputeImageBbox(canvas, imgPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- ImageItem *imgPtr; /* Item whose bbox is to be
- * recomputed. */
+ComputeImageBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ ImageItem *imgPtr) /* Item whose bbox is to be recomputed. */
{
int width, height;
int x, y;
@@ -478,36 +465,36 @@ ComputeImageBbox(canvas, imgPtr)
Tk_SizeOfImage(image, &width, &height);
switch (imgPtr->anchor) {
- case TK_ANCHOR_N:
- x -= width/2;
- break;
- case TK_ANCHOR_NE:
- x -= width;
- break;
- case TK_ANCHOR_E:
- x -= width;
- y -= height/2;
- break;
- case TK_ANCHOR_SE:
- x -= width;
- y -= height;
- break;
- case TK_ANCHOR_S:
- x -= width/2;
- y -= height;
- break;
- case TK_ANCHOR_SW:
- y -= height;
- break;
- case TK_ANCHOR_W:
- y -= height/2;
- break;
- case TK_ANCHOR_NW:
- break;
- case TK_ANCHOR_CENTER:
- x -= width/2;
- y -= height/2;
- break;
+ case TK_ANCHOR_N:
+ x -= width/2;
+ break;
+ case TK_ANCHOR_NE:
+ x -= width;
+ break;
+ case TK_ANCHOR_E:
+ x -= width;
+ y -= height/2;
+ break;
+ case TK_ANCHOR_SE:
+ x -= width;
+ y -= height;
+ break;
+ case TK_ANCHOR_S:
+ x -= width/2;
+ y -= height;
+ break;
+ case TK_ANCHOR_SW:
+ y -= height;
+ break;
+ case TK_ANCHOR_W:
+ y -= height/2;
+ break;
+ case TK_ANCHOR_NW:
+ break;
+ case TK_ANCHOR_CENTER:
+ x -= width/2;
+ y -= height/2;
+ break;
}
/*
@@ -525,35 +512,34 @@ ComputeImageBbox(canvas, imgPtr)
*
* DisplayImage --
*
- * This procedure is invoked to draw a image item in a given
- * drawable.
+ * This function is invoked to draw a image item in a given drawable.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
static void
-DisplayImage(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw
- * item. */
- int x, y, width, height; /* Describes region of canvas that
- * must be redisplayed (not used). */
+DisplayImage(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, int width, int height)
+ /* Describes region of canvas that must be
+ * redisplayed (not used). */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
short drawableX, drawableY;
Tk_Image image;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -587,14 +573,14 @@ DisplayImage(canvas, itemPtr, display, drawable, x, y, width, height)
*
* ImageToPoint --
*
- * Computes the distance from a given point to a given
- * rectangle, in canvas units.
+ * Computes the distance from a given point to a given rectangle, in
+ * canvas units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are coordPtr[0] and coordPtr[1] is inside the image. If the
- * point isn't inside the image then the return value is the
- * distance from the point to the image.
+ * The return value is 0 if the point whose x and y coordinates are
+ * coordPtr[0] and coordPtr[1] is inside the image. If the point isn't
+ * inside the image then the return value is the distance from the point
+ * to the image.
*
* Side effects:
* None.
@@ -603,10 +589,10 @@ DisplayImage(canvas, itemPtr, display, drawable, x, y, width, height)
*/
static double
-ImageToPoint(canvas, itemPtr, coordPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *coordPtr; /* Pointer to x and y coordinates. */
+ImageToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *coordPtr) /* Pointer to x and y coordinates. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
double x1, x2, y1, y2, xDiff, yDiff;
@@ -644,14 +630,13 @@ ImageToPoint(canvas, itemPtr, coordPtr)
*
* ImageToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangle.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangle.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -660,12 +645,12 @@ ImageToPoint(canvas, itemPtr, coordPtr)
*/
static int
-ImageToArea(canvas, itemPtr, rectPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against rectangle. */
- double *rectPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
- * area. */
+ImageToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against rectangle. */
+ double *rectPtr) /* Pointer to array of four coordinates
+ * (x1,y1,x2,y2) describing rectangular
+ * area. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
@@ -689,15 +674,13 @@ ImageToArea(canvas, itemPtr, rectPtr)
*
* ImageToPostscript --
*
- * This procedure is called to generate Postscript for
- * image items.
+ * This function is called to generate Postscript for image items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in interp->result, replacing whatever used to be there.
- * If no error occurs, then Postscript for the item is appended
- * to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in interp->result,
+ * replacing whatever used to be there. If no error occurs, then
+ * Postscript for the item is appended to the result.
*
* Side effects:
* None.
@@ -706,15 +689,13 @@ ImageToArea(canvas, itemPtr, rectPtr)
*/
static int
-ImageToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is
- * wanted. */
- int prepass; /* 1 means this is a prepass to
- * collect font information; 0 means
- * final Postscript is being created.*/
+ImageToPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created.*/
{
ImageItem *imgPtr = (ImageItem *)itemPtr;
Tk_Window canvasWin = Tk_CanvasTkwin(canvas);
@@ -725,7 +706,7 @@ ImageToPostscript(interp, canvas, itemPtr, prepass)
Tk_Image image;
Tk_State state = itemPtr->state;
- if (state == TK_STATE_NULL) {
+ if(state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -743,33 +724,34 @@ ImageToPostscript(interp, canvas, itemPtr, prepass)
/*
* Image item without actual image specified.
*/
- return TCL_OK;
+
+ return TCL_OK;
}
Tk_SizeOfImage(image, &width, &height);
/*
- * Compute the coordinates of the lower-left corner of the image,
- * taking into account the anchor position for the image.
+ * Compute the coordinates of the lower-left corner of the image, taking
+ * into account the anchor position for the image.
*/
x = imgPtr->x;
y = Tk_CanvasPsY(canvas, imgPtr->y);
switch (imgPtr->anchor) {
- case TK_ANCHOR_NW: y -= height; break;
- case TK_ANCHOR_N: x -= width/2.0; y -= height; break;
- case TK_ANCHOR_NE: x -= width; y -= height; break;
- case TK_ANCHOR_E: x -= width; y -= height/2.0; break;
- case TK_ANCHOR_SE: x -= width; break;
- case TK_ANCHOR_S: x -= width/2.0; break;
- case TK_ANCHOR_SW: break;
- case TK_ANCHOR_W: y -= height/2.0; break;
- case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
+ case TK_ANCHOR_NW: y -= height; break;
+ case TK_ANCHOR_N: x -= width/2.0; y -= height; break;
+ case TK_ANCHOR_NE: x -= width; y -= height; break;
+ case TK_ANCHOR_E: x -= width; y -= height/2.0; break;
+ case TK_ANCHOR_SE: x -= width; break;
+ case TK_ANCHOR_S: x -= width/2.0; break;
+ case TK_ANCHOR_SW: break;
+ case TK_ANCHOR_W: y -= height/2.0; break;
+ case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
}
if (!prepass) {
sprintf(buffer, "%.15g %.15g", x, y);
- Tcl_AppendResult(interp, buffer, " translate\n", (char *) NULL);
+ Tcl_AppendResult(interp, buffer, " translate\n", NULL);
}
return Tk_PostscriptImage(image, interp, canvasWin,
@@ -781,14 +763,14 @@ ImageToPostscript(interp, canvas, itemPtr, prepass)
*
* ScaleImage --
*
- * This procedure is invoked to rescale an item.
+ * This function is invoked to rescale an item.
*
* Results:
* None.
*
* Side effects:
- * The item referred to by itemPtr is rescaled so that the
- * following transformation is applied to all point coordinates:
+ * The item referred to by itemPtr is rescaled so that the following
+ * transformation is applied to all point coordinates:
* x' = originX + scaleX*(x-originX)
* y' = originY + scaleY*(y-originY)
*
@@ -796,12 +778,13 @@ ImageToPostscript(interp, canvas, itemPtr, prepass)
*/
static void
-ScaleImage(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing rectangle. */
- Tk_Item *itemPtr; /* Rectangle to be scaled. */
- double originX, originY; /* Origin about which to scale rect. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleImage(
+ Tk_Canvas canvas, /* Canvas containing rectangle. */
+ Tk_Item *itemPtr, /* Rectangle to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale rect. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
@@ -815,25 +798,24 @@ ScaleImage(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* TranslateImage --
*
- * This procedure is called to move an item by a given amount.
+ * This function is called to move an item by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the item is offset by (xDelta, yDelta), and
- * the bounding box is updated in the generic part of the item
- * structure.
+ * The position of the item is offset by (xDelta, yDelta), and the
+ * bounding box is updated in the generic part of the item structure.
*
*--------------------------------------------------------------
*/
static void
-TranslateImage(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be
- * moved. */
+TranslateImage(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
@@ -847,9 +829,9 @@ TranslateImage(canvas, itemPtr, deltaX, deltaY)
*
* ImageChangedProc --
*
- * This procedure is invoked by the image code whenever the manager
- * for an image does something that affects the image's size or
- * how it is displayed.
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the image's size or how it is
+ * displayed.
*
* Results:
* None.
@@ -861,21 +843,21 @@ TranslateImage(canvas, itemPtr, deltaX, deltaY)
*/
static void
-ImageChangedProc(clientData, x, y, width, height, imgWidth, imgHeight)
- ClientData clientData; /* Pointer to canvas item for image. */
- int x, y; /* Upper left pixel (within image)
- * that must be redisplayed. */
- int width, height; /* Dimensions of area to redisplay
- * (may be <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+ImageChangedProc(
+ ClientData clientData, /* Pointer to canvas item for image. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (may be <=
+ * 0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
ImageItem *imgPtr = (ImageItem *) clientData;
/*
- * If the image's size changed and it's not anchored at its
- * northwest corner then just redisplay the entire area of the
- * image. This is a bit over-conservative, but we need to do
- * something because a size change also means a position change.
+ * If the image's size changed and it's not anchored at its northwest
+ * corner then just redisplay the entire area of the image. This is a bit
+ * over-conservative, but we need to do something because a size change
+ * also means a position change.
*/
if (((imgPtr->header.x2 - imgPtr->header.x1) != imgWidth)
@@ -885,9 +867,17 @@ ImageChangedProc(clientData, x, y, width, height, imgWidth, imgHeight)
height = imgHeight;
Tk_CanvasEventuallyRedraw(imgPtr->canvas, imgPtr->header.x1,
imgPtr->header.y1, imgPtr->header.x2, imgPtr->header.y2);
- }
+ }
ComputeImageBbox(imgPtr->canvas, imgPtr);
Tk_CanvasEventuallyRedraw(imgPtr->canvas, imgPtr->header.x1 + x,
imgPtr->header.y1 + y, (int) (imgPtr->header.x1 + x + width),
(int) (imgPtr->header.y1 + y + height));
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 4c7b9be..cce3460 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkCanvLine.c --
*
* This file implements line items for canvas widgets.
@@ -7,13 +7,12 @@
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
/*
@@ -26,21 +25,21 @@ typedef enum {
typedef struct LineItem {
Tk_Item header; /* Generic stuff that's the same for all
- * types. MUST BE FIRST IN STRUCTURE. */
+ * types. MUST BE FIRST IN STRUCTURE. */
Tk_Outline outline; /* Outline structure */
- Tk_Canvas canvas; /* Canvas containing item. Needed for
- * parsing arrow shapes. */
+ Tk_Canvas canvas; /* Canvas containing item. Needed for parsing
+ * arrow shapes. */
int numPoints; /* Number of points in line (always >= 0). */
- double *coordPtr; /* Pointer to malloc-ed array containing
- * x- and y-coords of all points in line.
+ double *coordPtr; /* Pointer to malloc-ed array containing x-
+ * and y-coords of all points in line.
* X-coords are even-valued indices, y-coords
* are corresponding odd-valued indices. If
- * the line has arrowheads then the first
- * and last points have been adjusted to refer
- * to the necks of the arrowheads rather than
- * their tips. The actual endpoints are
- * stored in the *firstArrowPtr and
- * *lastArrowPtr, if they exist. */
+ * the line has arrowheads then the first and
+ * last points have been adjusted to refer to
+ * the necks of the arrowheads rather than
+ * their tips. The actual endpoints are stored
+ * in the *firstArrowPtr and *lastArrowPtr, if
+ * they exist. */
int capStyle; /* Cap style for line. */
int joinStyle; /* Join style for line. */
GC arrowGC; /* Graphics context for drawing arrowheads. */
@@ -53,13 +52,13 @@ typedef struct LineItem {
* edge of shaft. */
double *firstArrowPtr; /* Points to array of PTS_IN_ARROW points
* describing polygon for arrowhead at first
- * point in line. First point of arrowhead
- * is tip. Malloc'ed. NULL means no arrowhead
- * at first point. */
+ * point in line. First point of arrowhead is
+ * tip. Malloc'ed. NULL means no arrowhead at
+ * first point. */
double *lastArrowPtr; /* Points to polygon for arrowhead at last
* point in line (PTS_IN_ARROW points, first
- * of which is tip). Malloc'ed. NULL means
- * no arrowhead at last point. */
+ * of which is tip). Malloc'ed. NULL means no
+ * arrowhead at last point. */
Tk_SmoothMethod *smooth; /* Non-zero means draw line smoothed (i.e.
* with Bezier splines). */
int splineSteps; /* Number of steps in each spline segment. */
@@ -72,65 +71,63 @@ typedef struct LineItem {
#define PTS_IN_ARROW 6
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static int ArrowheadPostscript _ANSI_ARGS_((Tcl_Interp *interp,
+static int ArrowheadPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, LineItem *linePtr,
- double *arrowPtr));
-static void ComputeLineBbox _ANSI_ARGS_((Tk_Canvas canvas,
- LineItem *linePtr));
-static int ConfigureLine _ANSI_ARGS_((Tcl_Interp *interp,
+ double *arrowPtr);
+static void ComputeLineBbox(Tk_Canvas canvas, LineItem *linePtr);
+static int ConfigureLine(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags));
-static int ConfigureArrows _ANSI_ARGS_((Tk_Canvas canvas,
- LineItem *linePtr));
-static int CreateLine _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST objv[], int flags);
+static int ConfigureArrows(Tk_Canvas canvas, LineItem *linePtr);
+static int CreateLine(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void DeleteLine _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayLine _ANSI_ARGS_((Tk_Canvas canvas,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DeleteLine(Tk_Canvas canvas,
+ Tk_Item *itemPtr, Display *display);
+static void DisplayLine(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static int GetLineIndex _ANSI_ARGS_((Tcl_Interp *interp,
+ int x, int y, int width, int height);
+static int GetLineIndex(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- Tcl_Obj *obj, int *indexPtr));
-static int LineCoords _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *obj, int *indexPtr);
+static int LineCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void LineDeleteCoords _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last));
-static void LineInsert _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj));
-static int LineToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *rectPtr));
-static double LineToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *coordPtr));
-static int LineToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static int ArrowParseProc _ANSI_ARGS_((ClientData clientData,
+ int objc, Tcl_Obj *CONST objv[]);
+static void LineDeleteCoords(Tk_Canvas canvas,
+ Tk_Item *itemPtr, int first, int last);
+static void LineInsert(Tk_Canvas canvas,
+ Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj);
+static int LineToArea(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *rectPtr);
+static double LineToPoint(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *coordPtr);
+static int LineToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static int ArrowParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *recordPtr, int offset));
-static char * ArrowPrintProc _ANSI_ARGS_((ClientData clientData,
+ CONST char *value, char *recordPtr, int offset);
+static char * ArrowPrintProc(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
- Tcl_FreeProc **freeProcPtr));
-static int ParseArrowShape _ANSI_ARGS_((ClientData clientData,
+ Tcl_FreeProc **freeProcPtr);
+static int ParseArrowShape(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *recordPtr, int offset));
-static char * PrintArrowShape _ANSI_ARGS_((ClientData clientData,
+ CONST char *value, char *recordPtr, int offset);
+static char * PrintArrowShape(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
- Tcl_FreeProc **freeProcPtr));
-static void ScaleLine _ANSI_ARGS_((Tk_Canvas canvas,
+ Tcl_FreeProc **freeProcPtr);
+static void ScaleLine(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void TranslateLine _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
+ double scaleX, double scaleY);
+static void TranslateLine(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double deltaX, double deltaY);
/*
- * Information used for parsing configuration specs. If you change any
- * of the default strings, be sure to change the corresponding default
- * values in CreateLine.
+ * Information used for parsing configuration specs. If you change any of the
+ * default strings, be sure to change the corresponding default values in
+ * CreateLine.
*/
static Tk_CustomOption arrowShapeOption = {
@@ -168,73 +165,65 @@ static Tk_CustomOption pixelOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_CUSTOM, "-activedash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.activeDash),
+ {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-activefill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.activeColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.activeStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-activewidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-activefill", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.activeColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
"0.0", Tk_Offset(LineItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_CUSTOM, "-arrow", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-arrow", NULL, NULL,
"none", Tk_Offset(LineItem, arrow), TK_CONFIG_DONT_SET_DEFAULT, &arrowOption},
- {TK_CONFIG_CUSTOM, "-arrowshape", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-arrowshape", NULL, NULL,
"8 10 3", Tk_Offset(LineItem, arrowShapeA),
TK_CONFIG_DONT_SET_DEFAULT, &arrowShapeOption},
- {TK_CONFIG_CAP_STYLE, "-capstyle", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CAP_STYLE, "-capstyle", NULL, NULL,
"butt", Tk_Offset(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_COLOR, "-fill", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-dash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.dash),
+ {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_PIXELS, "-dashoffset", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(LineItem, outline.offset),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-disableddash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.disabledDash),
+ {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
+ "0", Tk_Offset(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT},
+ {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-disabledfill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.disabledColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.disabledStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-disabledwidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(LineItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_JOIN_STYLE, "-joinstyle", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL,
"round", Tk_Offset(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-offset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
"0,0", Tk_Offset(LineItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_CUSTOM, "-smooth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-smooth", NULL, NULL,
"0", Tk_Offset(LineItem, smooth),
TK_CONFIG_DONT_SET_DEFAULT, &smoothOption},
- {TK_CONFIG_INT, "-splinesteps", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_INT, "-splinesteps", NULL, NULL,
"12", Tk_Offset(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_BITMAP, "-stipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(LineItem, outline.stipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_CUSTOM, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
+ NULL, Tk_Offset(LineItem, outline.stipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_CUSTOM, "-width", NULL, NULL,
"1.0", Tk_Offset(LineItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * The structures below defines the line item type by means
- * of procedures that can be invoked by generic item code.
+ * The structures below defines the line item type by means of functions that
+ * can be invoked by generic item code.
*/
Tk_ItemType tkLineType = {
@@ -253,17 +242,17 @@ Tk_ItemType tkLineType = {
ScaleLine, /* scaleProc */
TranslateLine, /* translateProc */
(Tk_ItemIndexProc *) GetLineIndex, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* icursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
+ NULL, /* icursorProc */
+ NULL, /* selectionProc */
(Tk_ItemInsertProc *) LineInsert, /* insertProc */
LineDeleteCoords, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ NULL, /* nextPtr */
};
/*
- * The definition below determines how large are static arrays
- * used to hold spline points (splines larger than this have to
- * have their arrays malloc-ed).
+ * The definition below determines how large are static arrays used to hold
+ * spline points (splines larger than this have to have their arrays
+ * malloc-ed).
*/
#define MAX_STATIC_POINTS 200
@@ -273,14 +262,13 @@ Tk_ItemType tkLineType = {
*
* CreateLine --
*
- * This procedure is invoked to create a new line item in
- * a canvas.
+ * This function is invoked to create a new line item in a canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item, then an error message is left in
- * the interp's result; in this case itemPtr is left uninitialized,
- * so it can be safely freed by the caller.
+ * A standard Tcl return value. If an error occurred in creating the
+ * item, then an error message is left in the interp's result; in this
+ * case itemPtr is left uninitialized, so it can be safely freed by the
+ * caller.
*
* Side effects:
* A new line item is created.
@@ -289,25 +277,24 @@ Tk_ItemType tkLineType = {
*/
static int
-CreateLine(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header
- * has been initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing line. */
+CreateLine(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
+ * initialized by caller. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing line. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int i;
if (objc == 0) {
- panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords\n");
}
/*
- * Carry out initialization that is needed to set defaults and to
- * allow proper cleanup after errors during the the remainder of
- * this procedure.
+ * Carry out initialization that is needed to set defaults and to allow
+ * proper cleanup after errors during the the remainder of this function.
*/
Tk_CreateOutline(&(linePtr->outline));
@@ -323,17 +310,18 @@ CreateLine(interp, canvas, itemPtr, objc, objv)
linePtr->arrowShapeC = (float)3.0;
linePtr->firstArrowPtr = NULL;
linePtr->lastArrowPtr = NULL;
- linePtr->smooth = (Tk_SmoothMethod *) NULL;
+ linePtr->smooth = NULL;
linePtr->splineSteps = 12;
/*
- * Count the number of points and then parse them into a point
- * array. Leading arguments are assumed to be points if they
- * start with a digit or a minus sign followed by a digit.
+ * Count the number of points and then parse them into a point array.
+ * Leading arguments are assumed to be points if they start with a digit
+ * or a minus sign followed by a digit.
*/
for (i = 1; i < objc; i++) {
char *arg = Tcl_GetString(objv[i]);
+
if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
break;
}
@@ -345,7 +333,7 @@ CreateLine(interp, canvas, itemPtr, objc, objv)
return TCL_OK;
}
- error:
+ error:
DeleteLine(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -355,9 +343,8 @@ CreateLine(interp, canvas, itemPtr, objc, objv)
*
* LineCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on lines. See the user documentation for details
- * on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * lines. See the user documentation for details on what it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -369,15 +356,13 @@ CreateLine(interp, canvas, itemPtr, objc, objv)
*/
static int
-LineCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be
- * read or modified. */
- int objc; /* Number of coordinates supplied in
- * objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1,
- * x2, y2, ... */
+LineCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
+ * modified. */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
LineItem *linePtr = (LineItem *) itemPtr;
int i, numPoints;
@@ -414,20 +399,22 @@ LineCoords(interp, canvas, itemPtr, objc, objv)
}
if (objc & 1) {
char buf[64 + TCL_INTEGER_SPACE];
+
sprintf(buf, "wrong # coordinates: expected an even number, got %d",
objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
} else if (objc < 4) {
char buf[64 + TCL_INTEGER_SPACE];
+
sprintf(buf, "wrong # coordinates: expected at least 4, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
} else {
numPoints = objc/2;
if (linePtr->numPoints != numPoints) {
- coordPtr = (double *) ckalloc((unsigned)
- (sizeof(double) * objc));
+ coordPtr = (double *)
+ ckalloc((unsigned) (sizeof(double) * objc));
if (linePtr->coordPtr != NULL) {
ckfree((char *) linePtr->coordPtr);
}
@@ -468,28 +455,28 @@ LineCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigureLine --
*
- * This procedure is invoked to configure various aspects
- * of a line item such as its background color.
+ * This function is invoked to configure various aspects of a line item
+ * such as its background color.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
- * Configuration information, such as colors and stipple
- * patterns, may be set for itemPtr.
+ * Configuration information, such as colors and stipple patterns, may be
+ * set for itemPtr.
*
*--------------------------------------------------------------
*/
static int
-ConfigureLine(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Line item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureLine(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Line item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
LineItem *linePtr = (LineItem *) itemPtr;
XGCValues gcValues;
@@ -505,8 +492,8 @@ ConfigureLine(interp, canvas, itemPtr, objc, objv, flags)
}
/*
- * A few of the options require additional processing, such as
- * graphics contexts.
+ * A few of the options require additional processing, such as graphics
+ * contexts.
*/
state = itemPtr->state;
@@ -571,9 +558,8 @@ ConfigureLine(interp, canvas, itemPtr, objc, objv, flags)
}
/*
- * Setup arrowheads, if needed. If arrowheads are turned off,
- * restore the line's endpoints (they were shortened when the
- * arrowheads were added).
+ * Setup arrowheads, if needed. If arrowheads are turned off, restore the
+ * line's endpoints (they were shortened when the arrowheads were added).
*/
if ((linePtr->firstArrowPtr != NULL) && (linePtr->arrow != ARROWS_FIRST)
@@ -611,8 +597,8 @@ ConfigureLine(interp, canvas, itemPtr, objc, objv, flags)
*
* DeleteLine --
*
- * This procedure is called to clean up the data structure
- * associated with a line item.
+ * This function is called to clean up the data structure associated with
+ * a line item.
*
* Results:
* None.
@@ -624,11 +610,10 @@ ConfigureLine(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteLine(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall canvas widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for
- * canvas. */
+DeleteLine(
+ Tk_Canvas canvas, /* Info about overall canvas widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
LineItem *linePtr = (LineItem *) itemPtr;
@@ -652,24 +637,22 @@ DeleteLine(canvas, itemPtr, display)
*
* ComputeLineBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of a line.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of a line.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
*
*--------------------------------------------------------------
*/
static void
-ComputeLineBbox(canvas, linePtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- LineItem *linePtr; /* Item whose bbos is to be
- * recomputed. */
+ComputeLineBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ LineItem *linePtr) /* Item whose bbos is to be recomputed. */
{
double *coordPtr;
int i, intWidth;
@@ -705,13 +688,12 @@ ComputeLineBbox(canvas, linePtr)
linePtr->header.y1 = linePtr->header.y2 = (int) coordPtr[1];
/*
- * Compute the bounding box of all the points in the line,
- * then expand in all directions by the line's width to take
- * care of butting or rounded corners and projecting or
- * rounded caps. This expansion is an overestimate (worst-case
- * is square root of two over two) but it's simple. Don't do
- * anything special for curves. This causes an additional
- * overestimate in the bounding box, but is faster.
+ * Compute the bounding box of all the points in the line, then expand in
+ * all directions by the line's width to take care of butting or rounded
+ * corners and projecting or rounded caps. This expansion is an
+ * overestimate (worst-case is square root of two over two) but it's
+ * simple. eDon't do anything special for curves. This causes an
+ * additional overestimate in the bounding box, but is faster.
*/
for (i = 1, coordPtr = linePtr->coordPtr+2; i < linePtr->numPoints;
@@ -780,9 +762,9 @@ ComputeLineBbox(canvas, linePtr)
}
/*
- * For mitered lines, make a second pass through all the points.
- * Compute the locations of the two miter vertex points and add
- * those into the bounding box.
+ * For mitered lines, make a second pass through all the points. Compute
+ * the locations of the two miter vertex points and add those into the
+ * bounding box.
*/
if (linePtr->joinStyle == JoinMiter) {
@@ -790,7 +772,7 @@ ComputeLineBbox(canvas, linePtr)
i--, coordPtr += 2) {
double miter[4];
int j;
-
+
if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
width, miter, miter+2)) {
for (j = 0; j < 4; j += 2) {
@@ -820,8 +802,8 @@ ComputeLineBbox(canvas, linePtr)
}
/*
- * Add one more pixel of fudge factor just to be safe (e.g.
- * X may round differently than we do).
+ * Add one more pixel of fudge factor just to be safe (e.g. X may round
+ * differently than we do).
*/
linePtr->header.x1 -= 1;
@@ -835,28 +817,27 @@ ComputeLineBbox(canvas, linePtr)
*
* DisplayLine --
*
- * This procedure is invoked to draw a line item in a given
- * drawable.
+ * This function is invoked to draw a line item in a given drawable.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
static void
-DisplayLine(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw
- * item. */
- int x, y, width, height; /* Describes region of canvas that
- * must be redisplayed (not used). */
+DisplayLine(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, int width, int height)
+ /* Describes region of canvas that must be
+ * redisplayed (not used). */
{
LineItem *linePtr = (LineItem *) itemPtr;
XPoint staticPoints[MAX_STATIC_POINTS*3];
@@ -883,16 +864,15 @@ DisplayLine(canvas, itemPtr, display, drawable, x, y, width, height)
}
}
/*
- * Build up an array of points in screen coordinates. Use a
- * static array unless the line has an enormous number of points;
- * in this case, dynamically allocate an array. For smoothed lines,
- * generate the curve points on each redisplay.
+ * Build up an array of points in screen coordinates. Use a static array
+ * unless the line has an enormous number of points; in this case,
+ * dynamically allocate an array. For smoothed lines, generate the curve
+ * points on each redisplay.
*/
if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
- numPoints = linePtr->smooth->coordProc(canvas, (double *) NULL,
- linePtr->numPoints, linePtr->splineSteps, (XPoint *) NULL,
- (double *) NULL);
+ numPoints = linePtr->smooth->coordProc(canvas, NULL,
+ linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
} else {
numPoints = linePtr->numPoints;
}
@@ -905,18 +885,17 @@ DisplayLine(canvas, itemPtr, display, drawable, x, y, width, height)
if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
- linePtr->numPoints, linePtr->splineSteps, pointPtr,
- (double *) NULL);
+ linePtr->numPoints, linePtr->splineSteps, pointPtr, NULL);
} else {
numPoints = TkCanvTranslatePath((TkCanvas*)canvas, numPoints,
linePtr->coordPtr, 0, pointPtr);
}
/*
- * Display line, the free up line storage if it was dynamically
- * allocated. If we're stippling, then modify the stipple offset
- * in the GC. Be sure to reset the offset when done, since the
- * GC is supposed to be read-only.
+ * Display line, the free up line storage if it was dynamically allocated.
+ * If we're stippling, then modify the stipple offset in the GC. Be sure
+ * to reset the offset when done, since the GC is supposed to be
+ * read-only.
*/
if (Tk_ChangeOutlineGC(canvas, itemPtr, &(linePtr->outline))) {
@@ -972,24 +951,24 @@ DisplayLine(canvas, itemPtr, display, drawable, x, y, width, height)
*/
static void
-LineInsert(canvas, itemPtr, beforeThis, obj)
- Tk_Canvas canvas; /* Canvas containing text item. */
- Tk_Item *itemPtr; /* Line item to be modified. */
- int beforeThis; /* Index before which new coordinates
- * are to be inserted. */
- Tcl_Obj *obj; /* New coordinates to be inserted. */
+LineInsert(
+ Tk_Canvas canvas, /* Canvas containing text item. */
+ Tk_Item *itemPtr, /* Line item to be modified. */
+ int beforeThis, /* Index before which new coordinates are to
+ * be inserted. */
+ Tcl_Obj *obj) /* New coordinates to be inserted. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int length, objc, i;
- double *new, *coordPtr;
+ double *newCoordPtr, *coordPtr;
Tk_State state = itemPtr->state;
Tcl_Obj **objv;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
- if (!obj || (Tcl_ListObjGetElements((Tcl_Interp *) NULL, obj, &objc, &objv) != TCL_OK)
+ if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK)
|| !objc || objc&1) {
return;
}
@@ -1008,38 +987,40 @@ LineInsert(canvas, itemPtr, beforeThis, obj)
linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
}
- new = (double *) ckalloc((unsigned)(sizeof(double) * (length + objc)));
- for(i=0; i<beforeThis; i++) {
- new[i] = linePtr->coordPtr[i];
+ newCoordPtr = (double *)
+ ckalloc(sizeof(double) * (unsigned)(length + objc));
+ for (i=0; i<beforeThis; i++) {
+ newCoordPtr[i] = linePtr->coordPtr[i];
}
- for(i=0; i<objc; i++) {
- if (Tcl_GetDoubleFromObj((Tcl_Interp *) NULL,objv[i],
- new+(i+beforeThis))!=TCL_OK) {
+ for (i=0; i<objc; i++) {
+ if (Tcl_GetDoubleFromObj(NULL, objv[i],
+ &newCoordPtr[i + beforeThis]) != TCL_OK) {
Tcl_ResetResult(((TkCanvas *)canvas)->interp);
- ckfree((char *) new);
+ ckfree((char *) newCoordPtr);
return;
}
}
- for(i=beforeThis; i<length; i++) {
- new[i+objc] = linePtr->coordPtr[i];
+ for (i=beforeThis; i<length; i++) {
+ newCoordPtr[i+objc] = linePtr->coordPtr[i];
}
if (linePtr->coordPtr) {
ckfree((char *) linePtr->coordPtr);
}
- linePtr->coordPtr = new;
+ linePtr->coordPtr = newCoordPtr;
length += objc;
linePtr->numPoints = length / 2;
if ((length>3) && (state != TK_STATE_HIDDEN)) {
/*
- * This is some optimizing code that will result that only the part
- * of the polygon that changed (and the objects that are overlapping
- * with that part) need to be redrawn. A special flag is set that
- * instructs the general canvas code not to redraw the whole
- * object. If this flag is not set, the canvas will do the redrawing,
- * otherwise I have to do it here.
+ * This is some optimizing code that will result that only the part of
+ * the polygon that changed (and the objects that are overlapping with
+ * that part) need to be redrawn. A special flag is set that instructs
+ * the general canvas code not to redraw the whole object. If this
+ * flag is not set, the canvas will do the redrawing, otherwise I have
+ * to do it here.
*/
+
itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
if (beforeThis>0) {beforeThis -= 2; objc+=2; }
@@ -1055,23 +1036,29 @@ LineInsert(canvas, itemPtr, beforeThis, obj)
itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[beforeThis];
itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[beforeThis+1];
if ((linePtr->firstArrowPtr != NULL) && (beforeThis<1)) {
- /* include old first arrow */
+ /*
+ * Include old first arrow.
+ */
+
for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
}
}
if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+objc)>=length)) {
- /* include old last arrow */
+ /*
+ * Include old last arrow.
+ */
+
for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
}
}
coordPtr = linePtr->coordPtr+beforeThis+2;
- for(i=2; i<objc; i+=2) {
+ for (i=2; i<objc; i+=2) {
TkIncludePoint(itemPtr, coordPtr);
- coordPtr+=2;
+ coordPtr+=2;
}
}
if (linePtr->firstArrowPtr != NULL) {
@@ -1083,21 +1070,28 @@ LineInsert(canvas, itemPtr, beforeThis, obj)
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
- ConfigureArrows(canvas, linePtr);
+ ConfigureArrows(canvas, linePtr);
}
- if(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
+ if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
double width;
int intWidth;
+
if ((linePtr->firstArrowPtr != NULL) && (beforeThis>2)) {
- /* include new first arrow */
+ /*
+ * Include new first arrow.
+ */
+
for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+objc)<(length-2))) {
- /* include new right arrow */
+ if ((linePtr->lastArrowPtr != NULL) && (beforeThis+objc < length-2)) {
+ /*
+ * Include new right arrow.
+ */
+
for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
@@ -1105,13 +1099,13 @@ LineInsert(canvas, itemPtr, beforeThis, obj)
}
width = linePtr->outline.width;
if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (linePtr->outline.activeWidth>width) {
- width = linePtr->outline.activeWidth;
- }
+ if (linePtr->outline.activeWidth>width) {
+ width = linePtr->outline.activeWidth;
+ }
} else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
- width = linePtr->outline.disabledWidth;
- }
+ if (linePtr->outline.disabledWidth>0) {
+ width = linePtr->outline.disabledWidth;
+ }
}
intWidth = (int) (width + 0.5);
if (intWidth < 1) {
@@ -1137,18 +1131,18 @@ LineInsert(canvas, itemPtr, beforeThis, obj)
* None.
*
* Side effects:
- * Characters between "first" and "last", inclusive, get
- * deleted from itemPtr.
+ * Characters between "first" and "last", inclusive, get deleted from
+ * itemPtr.
*
*--------------------------------------------------------------
*/
static void
-LineDeleteCoords(canvas, itemPtr, first, last)
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Item in which to delete characters. */
- int first; /* Index of first character to delete. */
- int last; /* Index of last character to delete. */
+LineDeleteCoords(
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Item in which to delete characters. */
+ int first, /* Index of first character to delete. */
+ int last) /* Index of last character to delete. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int count, i, first1, last1;
@@ -1156,7 +1150,7 @@ LineDeleteCoords(canvas, itemPtr, first, last)
double *coordPtr;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -1180,36 +1174,51 @@ LineDeleteCoords(canvas, itemPtr, first, last)
linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
}
- first1 = first; last1 = last;
- if(first1>0) first1 -= 2;
- if(last1<length-2) last1 += 2;
+ first1 = first;
+ last1 = last;
+ if (first1 > 0) {
+ first1 -= 2;
+ }
+ if (last1 < length-2) {
+ last1 += 2;
+ }
if (linePtr->smooth) {
- if(first1>0) first1 -= 2;
- if(last1<length-2) last1 += 2;
+ if (first1 > 0) {
+ first1 -= 2;
+ }
+ if (last1 < length-2) {
+ last1 += 2;
+ }
}
- if((first1<2) && (last1 >= length-2)) {
+ if (!(first1 < 2) && (last1 >= length-2)) {
/*
- * This is some optimizing code that will result that only the part
- * of the line that changed (and the objects that are overlapping
- * with that part) need to be redrawn. A special flag is set that
- * instructs the general canvas code not to redraw the whole
- * object. If this flag is set, the redrawing has to be done here,
- * otherwise the general Canvas code will take care of it.
+ * This is some optimizing code that will result that only the part of
+ * the line that changed (and the objects that are overlapping with
+ * that part) need to be redrawn. A special flag is set that instructs
+ * the general canvas code not to redraw the whole object. If this
+ * flag is set, the redrawing has to be done here, otherwise the
+ * general Canvas code will take care of it.
*/
itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[first1];
itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[first1+1];
- if ((linePtr->firstArrowPtr != NULL) && (first1<2)) {
- /* include old first arrow */
+ if ((linePtr->firstArrowPtr != NULL) && (first1 < 2)) {
+ /*
+ * Include old first arrow.
+ */
+
for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && (last1>=length-2)) {
- /* include old last arrow */
+ if ((linePtr->lastArrowPtr != NULL) && (last1 >= length-2)) {
+ /*
+ * Include old last arrow.
+ */
+
for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
@@ -1218,7 +1227,7 @@ LineDeleteCoords(canvas, itemPtr, first, last)
coordPtr = linePtr->coordPtr+first1+2;
for (i=first1+2; i<=last1; i+=2) {
TkIncludePoint(itemPtr, coordPtr);
- coordPtr+=2;
+ coordPtr += 2;
}
}
@@ -1236,20 +1245,27 @@ LineDeleteCoords(canvas, itemPtr, first, last)
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
- ConfigureArrows(canvas, linePtr);
+ ConfigureArrows(canvas, linePtr);
}
- if(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
+ if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
double width;
int intWidth;
- if ((linePtr->firstArrowPtr != NULL) && (first1<4)) {
- /* include new first arrow */
+
+ if ((linePtr->firstArrowPtr != NULL) && (first1 < 4)) {
+ /*
+ * Include new first arrow.
+ */
+
for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && (last1>(length-4))) {
- /* include new right arrow */
+ if ((linePtr->lastArrowPtr != NULL) && (last1 > length-4)) {
+ /*
+ * Include new right arrow.
+ */
+
for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW;
i++, coordPtr += 2) {
TkIncludePoint(itemPtr, coordPtr);
@@ -1257,20 +1273,22 @@ LineDeleteCoords(canvas, itemPtr, first, last)
}
width = linePtr->outline.width;
if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (linePtr->outline.activeWidth>width) {
- width = linePtr->outline.activeWidth;
- }
+ if (linePtr->outline.activeWidth > width) {
+ width = linePtr->outline.activeWidth;
+ }
} else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
- width = linePtr->outline.disabledWidth;
- }
+ if (linePtr->outline.disabledWidth > 0) {
+ width = linePtr->outline.disabledWidth;
+ }
}
intWidth = (int) (width + 0.5);
if (intWidth < 1) {
intWidth = 1;
}
- itemPtr->x1 -= intWidth; itemPtr->y1 -= intWidth;
- itemPtr->x2 += intWidth; itemPtr->y2 += intWidth;
+ itemPtr->x1 -= intWidth;
+ itemPtr->y1 -= intWidth;
+ itemPtr->x2 += intWidth;
+ itemPtr->y2 += intWidth;
Tk_CanvasEventuallyRedraw(canvas, itemPtr->x1, itemPtr->y1,
itemPtr->x2, itemPtr->y2);
}
@@ -1282,14 +1300,14 @@ LineDeleteCoords(canvas, itemPtr, first, last)
*
* LineToPoint --
*
- * Computes the distance from a given point to a given
- * line, in canvas units.
+ * Computes the distance from a given point to a given line, in canvas
+ * units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are pointPtr[0] and pointPtr[1] is inside the line. If the
- * point isn't inside the line then the return value is the
- * distance from the point to the line.
+ * The return value is 0 if the point whose x and y coordinates are
+ * pointPtr[0] and pointPtr[1] is inside the line. If the point isn't
+ * inside the line then the return value is the distance from the point
+ * to the line.
*
* Side effects:
* None.
@@ -1299,10 +1317,10 @@ LineDeleteCoords(canvas, itemPtr, first, last)
/* ARGSUSED */
static double
-LineToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+LineToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
Tk_State state = itemPtr->state;
LineItem *linePtr = (LineItem *) itemPtr;
@@ -1311,15 +1329,15 @@ LineToPoint(canvas, itemPtr, pointPtr)
double poly[10];
double bestDist, dist, width;
int numPoints, count;
- int changedMiterToBevel; /* Non-zero means that a mitered corner
- * had to be treated as beveled after all
- * because the angle was < 11 degrees. */
+ int changedMiterToBevel; /* Non-zero means that a mitered corner had to
+ * be treated as beveled after all because the
+ * angle was < 11 degrees. */
bestDist = 1.0e36;
/*
- * Handle smoothed lines by generating an expanded set of points
- * against which to do the check.
+ * Handle smoothed lines by generating an expanded set of points against
+ * which to do the check.
*/
if(state == TK_STATE_NULL) {
@@ -1338,9 +1356,8 @@ LineToPoint(canvas, itemPtr, pointPtr)
}
if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
- numPoints = linePtr->smooth->coordProc(canvas, (double *) NULL,
- linePtr->numPoints, linePtr->splineSteps, (XPoint *) NULL,
- (double *) NULL);
+ numPoints = linePtr->smooth->coordProc(canvas, NULL,
+ linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
@@ -1348,8 +1365,7 @@ LineToPoint(canvas, itemPtr, pointPtr)
(2*numPoints*sizeof(double)));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
- linePtr->numPoints, linePtr->splineSteps, (XPoint *) NULL,
- linePoints);
+ linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
} else {
numPoints = linePtr->numPoints;
linePoints = linePtr->coordPtr;
@@ -1362,26 +1378,25 @@ LineToPoint(canvas, itemPtr, pointPtr)
if (!numPoints || itemPtr->state==TK_STATE_HIDDEN) {
return bestDist;
} else if (numPoints == 1) {
- bestDist = hypot(linePoints[0] - pointPtr[0], linePoints[1] - pointPtr[1])
- - width/2.0;
+ bestDist = hypot(linePoints[0]-pointPtr[0], linePoints[1]-pointPtr[1])
+ - width/2.0;
if (bestDist < 0) bestDist = 0;
return bestDist;
}
/*
- * The overall idea is to iterate through all of the edges of
- * the line, computing a polygon for each edge and testing the
- * point against that polygon. In addition, there are additional
- * tests to deal with rounded joints and caps.
+ * The overall idea is to iterate through all of the edges of the line,
+ * computing a polygon for each edge and testing the point against that
+ * polygon. In addition, there are additional tests to deal with rounded
+ * joints and caps.
*/
changedMiterToBevel = 0;
for (count = numPoints, coordPtr = linePoints; count >= 2;
count--, coordPtr += 2) {
-
/*
- * If rounding is done around the first point then compute
- * the distance between the point and the point.
+ * If rounding is done around the first point then compute the
+ * distance between the point and the point.
*/
if (((linePtr->capStyle == CapRound) && (count == numPoints))
@@ -1398,9 +1413,9 @@ LineToPoint(canvas, itemPtr, pointPtr)
}
/*
- * Compute the polygonal shape corresponding to this edge,
- * consisting of two points for the first point of the edge
- * and two points for the last point of the edge.
+ * Compute the polygonal shape corresponding to this edge, consisting
+ * of two points for the first point of the edge and two points for
+ * the last point of the edge.
*/
if (count == numPoints) {
@@ -1412,14 +1427,13 @@ LineToPoint(canvas, itemPtr, pointPtr)
poly[2] = poly[4];
poly[3] = poly[5];
} else {
- TkGetButtPoints(coordPtr+2, coordPtr, width, 0,
- poly, poly+2);
+ TkGetButtPoints(coordPtr+2, coordPtr, width, 0, poly, poly+2);
/*
- * If this line uses beveled joints, then check the distance
- * to a polygon comprising the last two points of the previous
- * polygon and the first two from this polygon; this checks
- * the wedges that fill the mitered joint.
+ * If this line uses beveled joints, then check the distance to a
+ * polygon comprising the last two points of the previous polygon
+ * and the first two from this polygon; this checks the wedges
+ * that fill the mitered joint.
*/
if ((linePtr->joinStyle == JoinBevel) || changedMiterToBevel) {
@@ -1442,8 +1456,8 @@ LineToPoint(canvas, itemPtr, pointPtr)
if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
width, poly+4, poly+6) == 0) {
changedMiterToBevel = 1;
- TkGetButtPoints(coordPtr, coordPtr+2, width,
- 0, poly+4, poly+6);
+ TkGetButtPoints(coordPtr, coordPtr+2, width, 0,
+ poly+4, poly+6);
}
} else {
TkGetButtPoints(coordPtr, coordPtr+2, width, 0,
@@ -1461,8 +1475,8 @@ LineToPoint(canvas, itemPtr, pointPtr)
}
/*
- * If caps are rounded, check the distance to the cap around the
- * final end point of the line.
+ * If caps are rounded, check the distance to the cap around the final end
+ * point of the line.
*/
if (linePtr->capStyle == CapRound) {
@@ -1503,7 +1517,7 @@ LineToPoint(canvas, itemPtr, pointPtr)
}
}
- done:
+ done:
if ((linePoints != staticSpace) && (linePoints != linePtr->coordPtr)) {
ckfree((char *) linePoints);
}
@@ -1515,14 +1529,12 @@ LineToPoint(canvas, itemPtr, pointPtr)
*
* LineToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangular area.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangular area.
*
* Results:
- * -1 is returned if the item is entirely outside the
- * area, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area, 0 if it
+ * overlaps, and 1 if it is entirely inside the given area.
*
* Side effects:
* None.
@@ -1532,10 +1544,10 @@ LineToPoint(canvas, itemPtr, pointPtr)
/* ARGSUSED */
static int
-LineToArea(canvas, itemPtr, rectPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against line. */
- double *rectPtr;
+LineToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against line. */
+ double *rectPtr)
{
LineItem *linePtr = (LineItem *) itemPtr;
double staticSpace[2*MAX_STATIC_POINTS];
@@ -1564,6 +1576,7 @@ LineToArea(canvas, itemPtr, rectPtr)
return -1;
} else if (linePtr->numPoints == 1) {
double oval[4];
+
oval[0] = linePtr->coordPtr[0]-radius;
oval[1] = linePtr->coordPtr[1]-radius;
oval[2] = linePtr->coordPtr[0]+radius;
@@ -1572,14 +1585,13 @@ LineToArea(canvas, itemPtr, rectPtr)
}
/*
- * Handle smoothed lines by generating an expanded set of points
- * against which to do the check.
+ * Handle smoothed lines by generating an expanded set of points against
+ * which to do the check.
*/
if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
- numPoints = linePtr->smooth->coordProc(canvas, (double *) NULL,
- linePtr->numPoints, linePtr->splineSteps, (XPoint *) NULL,
- (double *) NULL);
+ numPoints = linePtr->smooth->coordProc(canvas, NULL,
+ linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
@@ -1587,8 +1599,7 @@ LineToArea(canvas, itemPtr, rectPtr)
(2*numPoints*sizeof(double)));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
- linePtr->numPoints, linePtr->splineSteps, (XPoint *) NULL,
- linePoints);
+ linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
} else {
numPoints = linePtr->numPoints;
linePoints = linePtr->coordPtr;
@@ -1602,7 +1613,7 @@ LineToArea(canvas, itemPtr, rectPtr)
width = 1.0;
}
- result = TkThickPolyLineToArea(linePoints, numPoints,
+ result = TkThickPolyLineToArea(linePoints, numPoints,
width, linePtr->capStyle, linePtr->joinStyle,
rectPtr);
if (result == 0) {
@@ -1630,7 +1641,7 @@ LineToArea(canvas, itemPtr, rectPtr)
}
}
- done:
+ done:
if ((linePoints != staticSpace) && (linePoints != linePtr->coordPtr)) {
ckfree((char *) linePoints);
}
@@ -1642,15 +1653,14 @@ LineToArea(canvas, itemPtr, rectPtr)
*
* ScaleLine --
*
- * This procedure is invoked to rescale a line item.
+ * This function is invoked to rescale a line item.
*
* Results:
* None.
*
* Side effects:
- * The line referred to by itemPtr is rescaled so that the
- * following transformation is applied to all point
- * coordinates:
+ * The line referred to by itemPtr is rescaled so that the following
+ * transformation is applied to all point coordinates:
* x' = originX + scaleX*(x-originX)
* y' = originY + scaleY*(y-originY)
*
@@ -1658,20 +1668,21 @@ LineToArea(canvas, itemPtr, rectPtr)
*/
static void
-ScaleLine(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing line. */
- Tk_Item *itemPtr; /* Line to be scaled. */
- double originX, originY; /* Origin about which to scale rect. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleLine(
+ Tk_Canvas canvas, /* Canvas containing line. */
+ Tk_Item *itemPtr, /* Line to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale rect. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
LineItem *linePtr = (LineItem *) itemPtr;
double *coordPtr;
int i;
/*
- * Delete any arrowheads before scaling all the points (so that
- * the end-points of the line get restored).
+ * Delete any arrowheads before scaling all the points (so that the
+ * end-points of the line get restored).
*/
if (linePtr->firstArrowPtr != NULL) {
@@ -1705,14 +1716,13 @@ ScaleLine(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* GetLineIndex --
*
- * Parse an index into a line item and return either its value
- * or an error.
+ * Parse an index into a line item and return either its value or an
+ * error.
*
* Results:
- * A standard Tcl result. If all went well, then *indexPtr is
- * filled in with the index (into itemPtr) corresponding to
- * string. Otherwise an error message is left in
- * interp->result.
+ * A standard Tcl result. If all went well, then *indexPtr is filled in
+ * with the index (into itemPtr) corresponding to string. Otherwise an
+ * error message is left in interp->result.
*
* Side effects:
* None.
@@ -1721,14 +1731,14 @@ ScaleLine(canvas, itemPtr, originX, originY, scaleX, scaleY)
*/
static int
-GetLineIndex(interp, canvas, itemPtr, obj, indexPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item for which the index is being
+GetLineIndex(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
- Tcl_Obj *obj; /* Specification of a particular coord
- * in itemPtr's line. */
- int *indexPtr; /* Where to store converted index. */
+ Tcl_Obj *obj, /* Specification of a particular coord in
+ * itemPtr's line. */
+ int *indexPtr) /* Where to store converted index. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int length;
@@ -1738,16 +1748,14 @@ GetLineIndex(interp, canvas, itemPtr, obj, indexPtr)
if (strncmp(string, "end", (unsigned) length) == 0) {
*indexPtr = 2*linePtr->numPoints;
} else {
- badIndex:
-
/*
- * Some of the paths here leave messages in interp->result,
- * so we have to clear it out before storing our own message.
+ * Some of the paths here leave messages in interp->result, so we
+ * have to clear it out before storing our own message.
*/
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
- Tcl_AppendResult(interp, "bad index \"", string, "\"",
- (char *) NULL);
+ badIndex:
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
+ Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
return TCL_ERROR;
}
} else if (string[0] == '@') {
@@ -1780,7 +1788,7 @@ GetLineIndex(interp, canvas, itemPtr, obj, indexPtr)
if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) {
goto badIndex;
}
- *indexPtr &= -2; /* if index is odd, make it even */
+ *indexPtr &= -2; /* if index is odd, make it even */
if (*indexPtr < 0){
*indexPtr = 0;
} else if (*indexPtr > (2*linePtr->numPoints)) {
@@ -1795,25 +1803,24 @@ GetLineIndex(interp, canvas, itemPtr, obj, indexPtr)
*
* TranslateLine --
*
- * This procedure is called to move a line by a given amount.
+ * This function is called to move a line by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the line is offset by (xDelta, yDelta), and
- * the bounding box is updated in the generic part of the item
- * structure.
+ * The position of the line is offset by (xDelta, yDelta), and the
+ * bounding box is updated in the generic part of the item structure.
*
*--------------------------------------------------------------
*/
static void
-TranslateLine(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be
- * moved. */
+TranslateLine(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
LineItem *linePtr = (LineItem *) itemPtr;
double *coordPtr;
@@ -1846,13 +1853,13 @@ TranslateLine(canvas, itemPtr, deltaX, deltaY)
*
* ParseArrowShape --
*
- * This procedure is called back during option parsing to
- * parse arrow shape information.
+ * This function is called back during option parsing to parse arrow
+ * shape information.
*
* Results:
- * The return value is a standard Tcl result: TCL_OK means
- * that the arrow shape information was parsed ok, and
- * TCL_ERROR means it couldn't be parsed.
+ * The return value is a standard Tcl result: TCL_OK means that the arrow
+ * shape information was parsed ok, and TCL_ERROR means it couldn't be
+ * parsed.
*
* Side effects:
* Arrow information in recordPtr is updated.
@@ -1862,14 +1869,14 @@ TranslateLine(canvas, itemPtr, deltaX, deltaY)
/* ARGSUSED */
static int
-ParseArrowShape(clientData, interp, tkwin, value, recordPtr, offset)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Window tkwin; /* Not used. */
- CONST char *value; /* Textual specification of arrow shape. */
- char *recordPtr; /* Pointer to item record in which to
- * store arrow information. */
- int offset; /* Offset of shape information in widget
+ParseArrowShape(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Window tkwin, /* Not used. */
+ CONST char *value, /* Textual specification of arrow shape. */
+ char *recordPtr, /* Pointer to item record in which to store
+ * arrow information. */
+ int offset) /* Offset of shape information in widget
* record. */
{
LineItem *linePtr = (LineItem *) recordPtr;
@@ -1878,14 +1885,14 @@ ParseArrowShape(clientData, interp, tkwin, value, recordPtr, offset)
CONST char **argv = NULL;
if (offset != Tk_Offset(LineItem, arrowShapeA)) {
- panic("ParseArrowShape received bogus offset");
+ Tcl_Panic("ParseArrowShape received bogus offset");
}
if (Tcl_SplitList(interp, (char *) value, &argc, &argv) != TCL_OK) {
syntaxError:
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad arrow shape \"", value,
- "\": must be list with three numbers", (char *) NULL);
+ "\": must be list with three numbers", NULL);
if (argv != NULL) {
ckfree((char *) argv);
}
@@ -1913,8 +1920,8 @@ ParseArrowShape(clientData, interp, tkwin, value, recordPtr, offset)
*
* PrintArrowShape --
*
- * This procedure is a callback invoked by the configuration
- * code to return a printable value describing an arrow shape.
+ * This function is a callback invoked by the configuration code to
+ * return a printable value describing an arrow shape.
*
* Results:
* None.
@@ -1927,14 +1934,14 @@ ParseArrowShape(clientData, interp, tkwin, value, recordPtr, offset)
/* ARGSUSED */
static char *
-PrintArrowShape(clientData, tkwin, recordPtr, offset, freeProcPtr)
- ClientData clientData; /* Not used. */
- Tk_Window tkwin; /* Window associated with linePtr's widget. */
- char *recordPtr; /* Pointer to item record containing current
+PrintArrowShape(
+ ClientData clientData, /* Not used. */
+ Tk_Window tkwin, /* Window associated with linePtr's widget. */
+ char *recordPtr, /* Pointer to item record containing current
* shape information. */
- int offset; /* Offset of arrow information in record. */
- Tcl_FreeProc **freeProcPtr; /* Store address of procedure to call to
- * free string here. */
+ int offset, /* Offset of arrow information in record. */
+ Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free
+ * string here. */
{
LineItem *linePtr = (LineItem *) recordPtr;
char *buffer;
@@ -1952,27 +1959,27 @@ PrintArrowShape(clientData, tkwin, recordPtr, offset, freeProcPtr)
*
* ArrowParseProc --
*
- * This procedure is invoked during option processing to handle
- * the "-arrow" option.
+ * This function is invoked during option processing to handle the
+ * "-arrow" option.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * The arrow for a given item gets replaced by the arrow
- * indicated in the value argument.
+ * The arrow for a given item gets replaced by the arrow indicated in the
+ * value argument.
*
*--------------------------------------------------------------
*/
static int
-ArrowParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* some flags.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
+ArrowParseProc(
+ ClientData clientData, /* some flags.*/
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ CONST char *value, /* Value of option. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset) /* Offset into item. */
{
int c;
size_t length;
@@ -2004,9 +2011,8 @@ ArrowParseProc(clientData, interp, tkwin, value, widgRec, offset)
return TCL_OK;
}
- Tcl_AppendResult(interp, "bad arrow spec \"", value,
- "\": must be none, first, last, or both",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad arrow spec \"", value,
+ "\": must be none, first, last, or both", NULL);
*arrowPtr = ARROWS_NONE;
return TCL_ERROR;
}
@@ -2016,16 +2022,15 @@ ArrowParseProc(clientData, interp, tkwin, value, widgRec, offset)
*
* ArrowPrintProc --
*
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-arrow"
- * configuration option.
+ * This function is invoked by the Tk configuration code to produce a
+ * printable string for the "-arrow" configuration option.
*
* Results:
- * The return value is a string describing the arrows for
- * the item referred to by "widgRec". In addition, *freeProcPtr
- * is filled in with the address of a procedure to call to free
- * the result string when it's no longer needed (or NULL to
- * indicate that the string doesn't need to be freed).
+ * The return value is a string describing the arrows for the item
+ * referred to by "widgRec". In addition, *freeProcPtr is filled in with
+ * the address of a function to call to free the result string when it's
+ * no longer needed (or NULL to indicate that the string doesn't need to
+ * be freed).
*
* Side effects:
* None.
@@ -2034,25 +2039,25 @@ ArrowParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
static char *
-ArrowPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
+ArrowPrintProc(
+ ClientData clientData, /* Ignored. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset, /* Offset into item. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ * information about how to reclaim storage
+ * for return string. */
{
register Arrows *arrowPtr = (Arrows *) (widgRec + offset);
switch (*arrowPtr) {
- case ARROWS_FIRST:
+ case ARROWS_FIRST:
return "first";
- case ARROWS_LAST:
+ case ARROWS_LAST:
return "last";
- case ARROWS_BOTH:
+ case ARROWS_BOTH:
return "both";
- default:
+ default:
return "none";
}
}
@@ -2062,40 +2067,38 @@ ArrowPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*
* ConfigureArrows --
*
- * If arrowheads have been requested for a line, this
- * procedure makes arrangements for the arrowheads.
+ * If arrowheads have been requested for a line, this function makes
+ * arrangements for the arrowheads.
*
* Results:
* Always returns TCL_OK.
*
* Side effects:
- * Information in linePtr is set up for one or two arrowheads.
- * the firstArrowPtr and lastArrowPtr polygons are allocated
- * and initialized, if need be, and the end points of the line
- * are adjusted so that a thick line doesn't stick out past
- * the arrowheads.
+ * Information in linePtr is set up for one or two arrowheads. The
+ * firstArrowPtr and lastArrowPtr polygons are allocated and initialized,
+ * if need be, and the end points of the line are adjusted so that a
+ * thick line doesn't stick out past the arrowheads.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
-ConfigureArrows(canvas, linePtr)
- Tk_Canvas canvas; /* Canvas in which arrows will be
- * displayed (interp and tkwin
- * fields are needed). */
- LineItem *linePtr; /* Item to configure for arrows. */
+ConfigureArrows(
+ Tk_Canvas canvas, /* Canvas in which arrows will be displayed
+ * (interp and tkwin fields are needed). */
+ LineItem *linePtr) /* Item to configure for arrows. */
{
double *poly, *coordPtr;
double dx, dy, length, sinTheta, cosTheta, temp;
- double fracHeight; /* Line width as fraction of
- * arrowhead width. */
- double backup; /* Distance to backup end points
- * so the line ends in the middle
- * of the arrowhead. */
- double vertX, vertY; /* Position of arrowhead vertex. */
- double shapeA, shapeB, shapeC; /* Adjusted coordinates (see
- * explanation below). */
+ double fracHeight; /* Line width as fraction of arrowhead
+ * width. */
+ double backup; /* Distance to backup end points so the line
+ * ends in the middle of the arrowhead. */
+ double vertX, vertY; /* Position of arrowhead vertex. */
+ double shapeA, shapeB, shapeC;
+ /* Adjusted coordinates (see explanation
+ * below). */
double width;
Tk_State state = linePtr->header.state;
@@ -2119,10 +2122,10 @@ ConfigureArrows(canvas, linePtr)
}
/*
- * The code below makes a tiny increase in the shape parameters
- * for the line. This is a bit of a hack, but it seems to result
- * in displays that more closely approximate the specified parameters.
- * Without the adjustment, the arrows come out smaller than expected.
+ * The code below makes a tiny increase in the shape parameters for the
+ * line. This is a bit of a hack, but it seems to result in displays that
+ * more closely approximate the specified parameters. Without the
+ * adjustment, the arrows come out smaller than expected.
*/
shapeA = linePtr->arrowShapeA + 0.001;
@@ -2130,9 +2133,9 @@ ConfigureArrows(canvas, linePtr)
shapeC = linePtr->arrowShapeC + width/2.0 + 0.001;
/*
- * If there's an arrowhead on the first point of the line, compute
- * its polygon and adjust the first point of the line so that the
- * line doesn't stick out past the leading edge of the arrowhead.
+ * If there's an arrowhead on the first point of the line, compute its
+ * polygon and adjust the first point of the line so that the line doesn't
+ * stick out past the leading edge of the arrowhead.
*/
fracHeight = (width/2.0)/shapeC;
@@ -2169,9 +2172,8 @@ ConfigureArrows(canvas, linePtr)
poly[7] = poly[9]*fracHeight + vertY*(1.0-fracHeight);
/*
- * Polygon done. Now move the first point towards the second so
- * that the corners at the end of the line are inside the
- * arrowhead.
+ * Polygon done. Now move the first point towards the second so that
+ * the corners at the end of the line are inside the arrowhead.
*/
linePtr->coordPtr[0] = poly[0] - backup*cosTheta;
@@ -2186,8 +2188,8 @@ ConfigureArrows(canvas, linePtr)
coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2);
poly = linePtr->lastArrowPtr;
if (poly == NULL) {
- poly = (double *) ckalloc((unsigned)
- (2*PTS_IN_ARROW*sizeof(double)));
+ poly = (double *)
+ ckalloc((unsigned) (2*PTS_IN_ARROW*sizeof(double)));
poly[0] = poly[10] = coordPtr[2];
poly[1] = poly[11] = coordPtr[3];
linePtr->lastArrowPtr = poly;
@@ -2203,10 +2205,10 @@ ConfigureArrows(canvas, linePtr)
}
vertX = poly[0] - shapeA*cosTheta;
vertY = poly[1] - shapeA*sinTheta;
- temp = shapeC*sinTheta;
+ temp = shapeC * sinTheta;
poly[2] = poly[0] - shapeB*cosTheta + temp;
poly[8] = poly[2] - 2*temp;
- temp = shapeC*cosTheta;
+ temp = shapeC * cosTheta;
poly[3] = poly[1] - shapeB*sinTheta - temp;
poly[9] = poly[3] + 2*temp;
poly[4] = poly[2]*fracHeight + vertX*(1.0-fracHeight);
@@ -2225,15 +2227,13 @@ ConfigureArrows(canvas, linePtr)
*
* LineToPostscript --
*
- * This procedure is called to generate Postscript for
- * line items.
+ * This function is called to generate Postscript for line items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in the interp's result, replacing whatever used
- * to be there. If no error occurs, then Postscript for the
- * item is appended to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in the interp's
+ * result, replacing whatever used to be there. If no error occurs, then
+ * Postscript for the item is appended to the result.
*
* Side effects:
* None.
@@ -2242,15 +2242,13 @@ ConfigureArrows(canvas, linePtr)
*/
static int
-LineToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is
- * wanted. */
- int prepass; /* 1 means this is a prepass to
- * collect font information; 0 means
- * final Postscript is being created. */
+LineToPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created. */
{
LineItem *linePtr = (LineItem *) itemPtr;
char buffer[64 + TCL_INTEGER_SPACE];
@@ -2299,24 +2297,23 @@ LineToPostscript(interp, canvas, itemPtr, prepass)
linePtr->coordPtr[0], Tk_CanvasPsY(canvas, linePtr->coordPtr[1]),
width/2.0, width/2.0);
Tcl_AppendResult(interp, "matrix currentmatrix\n",buffer,
- " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", (char *) NULL);
- if (Tk_CanvasPsColor(interp, canvas, color)
- != TCL_OK) {
+ " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", NULL);
+ if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
return TCL_ERROR;
}
if (stipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
+ Tcl_AppendResult(interp, "clip ", NULL);
if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
return TCL_ERROR;
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
return TCL_OK;
}
/*
- * Generate a path for the line's center-line (do this differently
- * for straight lines and smoothed lines).
+ * Generate a path for the line's center-line (do this differently for
+ * straight lines and smoothed lines).
*/
if ((!linePtr->smooth) || (linePtr->numPoints < 3)) {
@@ -2327,29 +2324,27 @@ LineToPostscript(interp, canvas, itemPtr, prepass)
linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps);
} else {
/*
- * Special hack: Postscript printers don't appear to be able
- * to turn a path drawn with "curveto"s into a clipping path
- * without exceeding resource limits, so TkMakeBezierPostscript
- * won't work for stippled curves. Instead, generate all of
- * the intermediate points here and output them into the
- * Postscript file with "lineto"s instead.
+ * Special hack: Postscript printers don't appear to be able to
+ * turn a path drawn with "curveto"s into a clipping path without
+ * exceeding resource limits, so TkMakeBezierPostscript won't work
+ * for stippled curves. Instead, generate all of the intermediate
+ * points here and output them into the Postscript file with
+ * "lineto"s instead.
*/
double staticPoints[2*MAX_STATIC_POINTS];
double *pointPtr;
int numPoints;
- numPoints = linePtr->smooth->coordProc(canvas, (double *) NULL,
- linePtr->numPoints, linePtr->splineSteps, (XPoint *) NULL,
- (double *) NULL);
+ numPoints = linePtr->smooth->coordProc(canvas, NULL,
+ linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
pointPtr = staticPoints;
if (numPoints > MAX_STATIC_POINTS) {
pointPtr = (double *) ckalloc((unsigned)
(numPoints * 2 * sizeof(double)));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
- linePtr->numPoints, linePtr->splineSteps, (XPoint *) NULL,
- pointPtr);
+ linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr);
Tk_CanvasPsPath(interp, canvas, pointPtr, numPoints);
if (pointPtr != staticPoints) {
ckfree((char *) pointPtr);
@@ -2367,17 +2362,16 @@ LineToPostscript(interp, canvas, itemPtr, prepass)
} else if (linePtr->capStyle == CapProjecting) {
style = "2 setlinecap\n";
}
- Tcl_AppendResult(interp, style, (char *) NULL);
+ Tcl_AppendResult(interp, style, NULL);
style = "0 setlinejoin\n";
if (linePtr->joinStyle == JoinRound) {
style = "1 setlinejoin\n";
} else if (linePtr->joinStyle == JoinBevel) {
style = "2 setlinejoin\n";
}
- Tcl_AppendResult(interp, style, (char *) NULL);
+ Tcl_AppendResult(interp, style, NULL);
- if (Tk_CanvasPsOutline(canvas, itemPtr,
- &(linePtr->outline)) != TCL_OK) {
+ if (Tk_CanvasPsOutline(canvas, itemPtr, &(linePtr->outline)) != TCL_OK) {
return TCL_ERROR;
}
@@ -2387,8 +2381,7 @@ LineToPostscript(interp, canvas, itemPtr, prepass)
if (linePtr->firstArrowPtr != NULL) {
if (stipple != None) {
- Tcl_AppendResult(interp, "grestore gsave\n",
- (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
}
if (ArrowheadPostscript(interp, canvas, linePtr,
linePtr->firstArrowPtr) != TCL_OK) {
@@ -2397,7 +2390,7 @@ LineToPostscript(interp, canvas, itemPtr, prepass)
}
if (linePtr->lastArrowPtr != NULL) {
if (stipple != None) {
- Tcl_AppendResult(interp, "grestore gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
}
if (ArrowheadPostscript(interp, canvas, linePtr,
linePtr->lastArrowPtr) != TCL_OK) {
@@ -2412,15 +2405,14 @@ LineToPostscript(interp, canvas, itemPtr, prepass)
*
* ArrowheadPostscript --
*
- * This procedure is called to generate Postscript for
- * an arrowhead for a line item.
+ * This function is called to generate Postscript for an arrowhead for a
+ * line item.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in the interp's result, replacing whatever used
- * to be there. If no error occurs, then Postscript for the
- * arrowhead is appended to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in the interp's
+ * result, replacing whatever used to be there. If no error occurs, then
+ * Postscript for the arrowhead is appended to the result.
*
* Side effects:
* None.
@@ -2429,14 +2421,13 @@ LineToPostscript(interp, canvas, itemPtr, prepass)
*/
static int
-ArrowheadPostscript(interp, canvas, linePtr, arrowPtr)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- LineItem *linePtr; /* Line item for which Postscript is
- * being generated. */
- double *arrowPtr; /* Pointer to first of five points
- * describing arrowhead polygon. */
+ArrowheadPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ LineItem *linePtr, /* Line item for which Postscript is being
+ * generated. */
+ double *arrowPtr) /* Pointer to first of five points describing
+ * arrowhead polygon. */
{
Pixmap stipple;
Tk_State state = linePtr->header.state;
@@ -2458,13 +2449,20 @@ ArrowheadPostscript(interp, canvas, linePtr, arrowPtr)
Tk_CanvasPsPath(interp, canvas, arrowPtr, PTS_IN_ARROW);
if (stipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
- if (Tk_CanvasPsStipple(interp, canvas, stipple)
- != TCL_OK) {
+ Tcl_AppendResult(interp, "clip ", NULL);
+ if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
return TCL_ERROR;
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 3027c88..b86bc63 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkCanvPoly.c --
*
* This file implements polygon items for canvas widgets.
@@ -7,13 +7,12 @@
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 Ajuba Solutions.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
/*
@@ -22,24 +21,28 @@
typedef struct PolygonItem {
Tk_Item header; /* Generic stuff that's the same for all
- * types. MUST BE FIRST IN STRUCTURE. */
+ * types. MUST BE FIRST IN STRUCTURE. */
Tk_Outline outline; /* Outline structure */
- int numPoints; /* Number of points in polygon.
- * Polygon is always closed. */
+ int numPoints; /* Number of points in polygon. Polygon is
+ * always closed. */
int pointsAllocated; /* Number of points for which space is
* allocated at *coordPtr. */
- double *coordPtr; /* Pointer to malloc-ed array containing
- * x- and y-coords of all points in polygon.
+ double *coordPtr; /* Pointer to malloc-ed array containing x-
+ * and y-coords of all points in polygon.
* X-coords are even-valued indices, y-coords
* are corresponding odd-valued indices. */
int joinStyle; /* Join style for outline */
Tk_TSOffset tsoffset;
XColor *fillColor; /* Foreground color for polygon. */
- XColor *activeFillColor; /* Foreground color for polygon if state is active. */
- XColor *disabledFillColor; /* Foreground color for polygon if state is disabled. */
+ XColor *activeFillColor; /* Foreground color for polygon if state is
+ * active. */
+ XColor *disabledFillColor; /* Foreground color for polygon if state is
+ * disabled. */
Pixmap fillStipple; /* Stipple bitmap for filling polygon. */
- Pixmap activeFillStipple; /* Stipple bitmap for filling polygon if state is active. */
- Pixmap disabledFillStipple; /* Stipple bitmap for filling polygon if state is disabled. */
+ Pixmap activeFillStipple; /* Stipple bitmap for filling polygon if state
+ * is active. */
+ Pixmap disabledFillStipple; /* Stipple bitmap for filling polygon if state
+ * is disabled. */
GC fillGC; /* Graphics context for filling polygon. */
Tk_SmoothMethod *smooth; /* Non-zero means draw shape smoothed (i.e.
* with Bezier splines). */
@@ -79,125 +82,116 @@ static Tk_CustomOption pixelOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_CUSTOM, "-activedash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.activeDash),
+ {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-activefill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, activeFillColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-activeoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.activeColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activeoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.activeStipple),
+ {TK_CONFIG_COLOR, "-activefill", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.activeStipple),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, activeFillStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-activewidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
"0.0", Tk_Offset(PolygonItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_CUSTOM, "-dash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.dash),
+ {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_PIXELS, "-dashoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
"0", Tk_Offset(PolygonItem, outline.offset),
TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-disableddash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.disabledDash),
+ {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-disabledfill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, disabledFillColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-disabledoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.disabledColor),
+ {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.disabledColor),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.disabledStipple),
+ {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.disabledStipple),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, disabledFillStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-disabledwidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(PolygonItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_COLOR, "-fill", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_JOIN_STYLE, "-joinstyle", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL,
"round", Tk_Offset(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-offset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
"0,0", Tk_Offset(PolygonItem, tsoffset),
TK_CONFIG_NULL_OK, &offsetOption},
- {TK_CONFIG_COLOR, "-outline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.color),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-outlineoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-outline", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.color), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
"0,0", Tk_Offset(PolygonItem, outline.tsoffset),
TK_CONFIG_NULL_OK, &offsetOption},
- {TK_CONFIG_BITMAP, "-outlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, outline.stipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-smooth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-smooth", NULL, NULL,
"0", Tk_Offset(PolygonItem, smooth),
TK_CONFIG_DONT_SET_DEFAULT, &smoothOption},
- {TK_CONFIG_INT, "-splinesteps", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_INT, "-splinesteps", NULL, NULL,
"12", Tk_Offset(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_BITMAP, "-stipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PolygonItem, fillStipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_CUSTOM, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
+ NULL, Tk_Offset(PolygonItem, fillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_CUSTOM, "-width", NULL, NULL,
"1.0", Tk_Offset(PolygonItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static void ComputePolygonBbox _ANSI_ARGS_((Tk_Canvas canvas,
- PolygonItem *polyPtr));
-static int ConfigurePolygon _ANSI_ARGS_((Tcl_Interp *interp,
+static void ComputePolygonBbox(Tk_Canvas canvas,
+ PolygonItem *polyPtr);
+static int ConfigurePolygon(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags));
-static int CreatePolygon _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST objv[], int flags);
+static int CreatePolygon(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void DeletePolygon _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayPolygon _ANSI_ARGS_((Tk_Canvas canvas,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DeletePolygon(Tk_Canvas canvas,
+ Tk_Item *itemPtr, Display *display);
+static void DisplayPolygon(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static int GetPolygonIndex _ANSI_ARGS_((Tcl_Interp *interp,
+ int x, int y, int width, int height);
+static int GetPolygonIndex(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- Tcl_Obj *obj, int *indexPtr));
-static int PolygonCoords _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *obj, int *indexPtr);
+static int PolygonCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void PolygonDeleteCoords _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last));
-static void PolygonInsert _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj));
-static int PolygonToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *rectPtr));
-static double PolygonToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *pointPtr));
-static int PolygonToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static void ScalePolygon _ANSI_ARGS_((Tk_Canvas canvas,
+ int objc, Tcl_Obj *CONST objv[]);
+static void PolygonDeleteCoords(Tk_Canvas canvas,
+ Tk_Item *itemPtr, int first, int last);
+static void PolygonInsert(Tk_Canvas canvas,
+ Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj);
+static int PolygonToArea(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *rectPtr);
+static double PolygonToPoint(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *pointPtr);
+static int PolygonToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static void ScalePolygon(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void TranslatePolygon _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
+ double scaleX, double scaleY);
+static void TranslatePolygon(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double deltaX, double deltaY);
/*
- * The structures below defines the polygon item type by means
- * of procedures that can be invoked by generic item code.
+ * The structures below defines the polygon item type by means of functions
+ * that can be invoked by generic item code.
*/
Tk_ItemType tkPolygonType = {
@@ -216,17 +210,17 @@ Tk_ItemType tkPolygonType = {
ScalePolygon, /* scaleProc */
TranslatePolygon, /* translateProc */
(Tk_ItemIndexProc *) GetPolygonIndex,/* indexProc */
- (Tk_ItemCursorProc *) NULL, /* icursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
+ NULL, /* icursorProc */
+ NULL, /* selectionProc */
(Tk_ItemInsertProc *) PolygonInsert,/* insertProc */
PolygonDeleteCoords, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ NULL, /* nextPtr */
};
/*
- * The definition below determines how large are static arrays
- * used to hold spline points (splines larger than this have to
- * have their arrays malloc-ed).
+ * The definition below determines how large are static arrays used to hold
+ * spline points (splines larger than this have to have their arrays
+ * malloc-ed).
*/
#define MAX_STATIC_POINTS 200
@@ -236,14 +230,12 @@ Tk_ItemType tkPolygonType = {
*
* CreatePolygon --
*
- * This procedure is invoked to create a new polygon item in
- * a canvas.
+ * This function is invoked to create a new polygon item in a canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item, then an error message is left in
- * the interp's result; in this case itemPtr is
- * left uninitialized, so it can be safely freed by the
+ * A standard Tcl return value. If an error occurred in creating the
+ * item, then an error message is left in the interp's result; in this
+ * case itemPtr is left uninitialized, so it can be safely freed by the
* caller.
*
* Side effects:
@@ -253,24 +245,24 @@ Tk_ItemType tkPolygonType = {
*/
static int
-CreatePolygon(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header
- * has been initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing polygon. */
+CreatePolygon(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
+ * initialized by caller. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing polygon. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int i;
if (objc == 0) {
- panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords\n");
}
/*
- * Carry out initialization that is needed in order to clean
- * up after errors during the the remainder of this procedure.
+ * Carry out initialization that is needed in order to clean up after
+ * errors during the the remainder of this function.
*/
Tk_CreateOutline(&(polyPtr->outline));
@@ -288,14 +280,14 @@ CreatePolygon(interp, canvas, itemPtr, objc, objv)
polyPtr->activeFillStipple = None;
polyPtr->disabledFillStipple = None;
polyPtr->fillGC = None;
- polyPtr->smooth = (Tk_SmoothMethod *) NULL;
+ polyPtr->smooth = NULL;
polyPtr->splineSteps = 12;
polyPtr->autoClosed = 0;
/*
- * Count the number of points and then parse them into a point
- * array. Leading arguments are assumed to be points if they
- * start with a digit or a minus sign followed by a digit.
+ * Count the number of points and then parse them into a point array.
+ * Leading arguments are assumed to be points if they start with a digit
+ * or a minus sign followed by a digit.
*/
for (i = 0; i < objc; i++) {
@@ -313,7 +305,7 @@ CreatePolygon(interp, canvas, itemPtr, objc, objv)
return TCL_OK;
}
- error:
+ error:
DeletePolygon(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -323,9 +315,8 @@ CreatePolygon(interp, canvas, itemPtr, objc, objv)
*
* PolygonCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on polygons. See the user documentation for details
- * on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * polygons. See the user documentation for details on what it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -337,25 +328,25 @@ CreatePolygon(interp, canvas, itemPtr, objc, objv)
*/
static int
-PolygonCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be
- * read or modified. */
- int objc; /* Number of coordinates supplied in
- * objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1,
- * x2, y2, ... */
+PolygonCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
+ * modified. */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int i, numPoints;
if (objc == 0) {
/*
- * Print the coords used to create the polygon. If we auto
- * closed the polygon then we don't report the last point.
+ * Print the coords used to create the polygon. If we auto closed the
+ * polygon then we don't report the last point.
*/
+
Tcl_Obj *subobj, *obj = Tcl_NewObj();
+
for (i = 0; i < 2*(polyPtr->numPoints - polyPtr->autoClosed); i++) {
subobj = Tcl_NewDoubleObj(polyPtr->coordPtr[i]);
Tcl_ListObjAppendElement(interp, obj, subobj);
@@ -371,6 +362,7 @@ PolygonCoords(interp, canvas, itemPtr, objc, objv)
}
if (objc & 1) {
char buf[64 + TCL_INTEGER_SPACE];
+
sprintf(buf, "wrong # coordinates: expected an even number, got %d",
objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
@@ -383,8 +375,8 @@ PolygonCoords(interp, canvas, itemPtr, objc, objv)
}
/*
- * One extra point gets allocated here, because we always
- * add another point to close the polygon.
+ * One extra point gets allocated here, because we always add
+ * another point to close the polygon.
*/
polyPtr->coordPtr = (double *) ckalloc((unsigned)
@@ -403,7 +395,7 @@ PolygonCoords(interp, canvas, itemPtr, objc, objv)
/*
* Close the polygon if it isn't already closed.
*/
-
+
if (objc>2 && ((polyPtr->coordPtr[objc-2] != polyPtr->coordPtr[0])
|| (polyPtr->coordPtr[objc-1] != polyPtr->coordPtr[1]))) {
polyPtr->autoClosed = 1;
@@ -421,28 +413,28 @@ PolygonCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigurePolygon --
*
- * This procedure is invoked to configure various aspects
- * of a polygon item such as its background color.
+ * This function is invoked to configure various aspects of a polygon
+ * item such as its background color.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
- * Configuration information, such as colors and stipple
- * patterns, may be set for itemPtr.
+ * Configuration information, such as colors and stipple patterns, may be
+ * set for itemPtr.
*
*--------------------------------------------------------------
*/
static int
-ConfigurePolygon(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Polygon item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigurePolygon(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Polygon item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
XGCValues gcValues;
@@ -460,8 +452,8 @@ ConfigurePolygon(interp, canvas, itemPtr, objc, objv, flags)
}
/*
- * A few of the options require additional processing, such as
- * graphics contexts.
+ * A few of the options require additional processing, such as graphics
+ * contexts.
*/
state = itemPtr->state;
@@ -562,8 +554,8 @@ ConfigurePolygon(interp, canvas, itemPtr, objc, objv, flags)
*
* DeletePolygon --
*
- * This procedure is called to clean up the data structure
- * associated with a polygon item.
+ * This function is called to clean up the data structure associated with
+ * a polygon item.
*
* Results:
* None.
@@ -575,11 +567,10 @@ ConfigurePolygon(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeletePolygon(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall canvas widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for
- * canvas. */
+DeletePolygon(
+ Tk_Canvas canvas, /* Info about overall canvas widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
@@ -615,24 +606,22 @@ DeletePolygon(canvas, itemPtr, display)
*
* ComputePolygonBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of a polygon.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of a polygon.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
*
*--------------------------------------------------------------
*/
static void
-ComputePolygonBbox(canvas, polyPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- PolygonItem *polyPtr; /* Item whose bbox is to be
- * recomputed. */
+ComputePolygonBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ PolygonItem *polyPtr) /* Item whose bbox is to be recomputed. */
{
double *coordPtr;
int i;
@@ -664,12 +653,11 @@ ComputePolygonBbox(canvas, polyPtr)
polyPtr->header.y1 = polyPtr->header.y2 = (int) coordPtr[1];
/*
- * Compute the bounding box of all the points in the polygon,
- * then expand in all directions by the outline's width to take
- * care of butting or rounded corners and projecting or
- * rounded caps. This expansion is an overestimate (worst-case
- * is square root of two over two) but it's simple. Don't do
- * anything special for curves. This causes an additional
+ * Compute the bounding box of all the points in the polygon, then expand
+ * in all directions by the outline's width to take care of butting or
+ * rounded corners and projecting or rounded caps. This expansion is an
+ * overestimate (worst-case is square root of two over two) but it's
+ * simple. Don't do anything special for curves. This causes an additional
* overestimate in the bounding box, but is faster.
*/
@@ -715,6 +703,7 @@ ComputePolygonBbox(canvas, polyPtr)
if (tsoffset) {
if (tsoffset->flags & TK_OFFSET_INDEX) {
int index = tsoffset->flags & ~TK_OFFSET_INDEX;
+
if (tsoffset->flags == INT_MAX) {
index = (polyPtr->numPoints - 1) * 2;
}
@@ -750,13 +739,14 @@ ComputePolygonBbox(canvas, polyPtr)
/*
* For mitered lines, make a second pass through all the points.
- * Compute the locations of the two miter vertex points and add
- * those into the bounding box.
+ * Compute the locations of the two miter vertex points and add those
+ * into the bounding box.
*/
if (polyPtr->joinStyle == JoinMiter) {
double miter[4];
int j;
+
coordPtr = polyPtr->coordPtr;
if (polyPtr->numPoints>3) {
if (TkGetMiterPoints(coordPtr+2*(polyPtr->numPoints-2),
@@ -767,9 +757,8 @@ ComputePolygonBbox(canvas, polyPtr)
}
}
}
- for (i = polyPtr->numPoints ; i >= 3;
- i--, coordPtr += 2) {
-
+ for (i = polyPtr->numPoints ; i >= 3; i--, coordPtr += 2) {
+
if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
width, miter, miter+2)) {
for (j = 0; j < 4; j += 2) {
@@ -781,8 +770,8 @@ ComputePolygonBbox(canvas, polyPtr)
}
/*
- * Add one more pixel of fudge factor just to be safe (e.g.
- * X may round differently than we do).
+ * Add one more pixel of fudge factor just to be safe (e.g. X may round
+ * differently than we do).
*/
polyPtr->header.x1 -= 1;
@@ -796,34 +785,33 @@ ComputePolygonBbox(canvas, polyPtr)
*
* TkFillPolygon --
*
- * This procedure is invoked to convert a polygon to screen
- * coordinates and display it using a particular GC.
+ * This function is invoked to convert a polygon to screen coordinates
+ * and display it using a particular GC.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
void
-TkFillPolygon(canvas, coordPtr, numPoints, display, drawable, gc, outlineGC)
- Tk_Canvas canvas; /* Canvas whose coordinate system
- * is to be used for drawing. */
- double *coordPtr; /* Array of coordinates for polygon:
- * x1, y1, x2, y2, .... */
- int numPoints; /* Twice this many coordinates are
- * present at *coordPtr. */
- Display *display; /* Display on which to draw polygon. */
- Drawable drawable; /* Pixmap or window in which to draw
- * polygon. */
- GC gc; /* Graphics context for drawing. */
- GC outlineGC; /* If not None, use this to draw an
- * outline around the polygon after
- * filling it. */
+TkFillPolygon(
+ Tk_Canvas canvas, /* Canvas whose coordinate system is to be
+ * used for drawing. */
+ double *coordPtr, /* Array of coordinates for polygon: x1, y1,
+ * x2, y2, .... */
+ int numPoints, /* Twice this many coordinates are present at
+ * *coordPtr. */
+ Display *display, /* Display on which to draw polygon. */
+ Drawable drawable, /* Pixmap or window in which to draw
+ * polygon. */
+ GC gc, /* Graphics context for drawing. */
+ GC outlineGC) /* If not None, use this to draw an outline
+ * around the polygon after filling it. */
{
XPoint staticPoints[MAX_STATIC_POINTS];
XPoint *pointPtr;
@@ -831,9 +819,9 @@ TkFillPolygon(canvas, coordPtr, numPoints, display, drawable, gc, outlineGC)
int i;
/*
- * Build up an array of points in screen coordinates. Use a
- * static array unless the polygon has an enormous number of points;
- * in this case, dynamically allocate an array.
+ * Build up an array of points in screen coordinates. Use a static array
+ * unless the polygon has an enormous number of points; in this case,
+ * dynamically allocate an array.
*/
if (numPoints <= MAX_STATIC_POINTS) {
@@ -842,7 +830,7 @@ TkFillPolygon(canvas, coordPtr, numPoints, display, drawable, gc, outlineGC)
pointPtr = (XPoint *) ckalloc((unsigned) (numPoints * sizeof(XPoint)));
}
- for (i = 0, pPtr = pointPtr; i < numPoints; i += 1, coordPtr += 2, pPtr++) {
+ for (i=0, pPtr=pointPtr ; i<numPoints; i+=1, coordPtr+=2, pPtr++) {
Tk_CanvasDrawableCoords(canvas, coordPtr[0], coordPtr[1], &pPtr->x,
&pPtr->y);
}
@@ -870,28 +858,27 @@ TkFillPolygon(canvas, coordPtr, numPoints, display, drawable, gc, outlineGC)
*
* DisplayPolygon --
*
- * This procedure is invoked to draw a polygon item in a given
- * drawable.
+ * This function is invoked to draw a polygon item in a given drawable.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
static void
-DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw
- * item. */
- int x, y, width, height; /* Describes region of canvas that
- * must be redisplayed (not used). */
+DisplayPolygon(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, int width, int height)
+ /* Describes region of canvas that must be
+ * redisplayed (not used). */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
Tk_State state = itemPtr->state;
@@ -904,7 +891,7 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height)
return;
}
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
@@ -922,16 +909,17 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height)
stipple = polyPtr->disabledFillStipple;
}
}
+
/*
- * If we're stippling then modify the stipple offset in the GC. Be
- * sure to reset the offset when done, since the GC is supposed to be
- * read-only.
+ * If we're stippling then modify the stipple offset in the GC. Be sure to
+ * reset the offset when done, since the GC is supposed to be read-only.
*/
if ((stipple != None) && (polyPtr->fillGC != None)) {
Tk_TSOffset *tsoffset = &polyPtr->tsoffset;
int w=0; int h=0;
int flags = tsoffset->flags;
+
if (!(flags & TK_OFFSET_INDEX) && (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) {
Tk_SizeOfBitmap(display, stipple, &w, &h);
if (flags & TK_OFFSET_CENTER) {
@@ -956,6 +944,7 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height)
if(polyPtr->numPoints < 3) {
short x,y;
int intLineWidth = (int) (linewidth + 0.5);
+
if (intLineWidth < 1) {
intLineWidth = 1;
}
@@ -974,13 +963,12 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height)
XPoint *pointPtr;
/*
- * This is a smoothed polygon. Display using a set of generated
- * spline points rather than the original points.
+ * This is a smoothed polygon. Display using a set of generated spline
+ * points rather than the original points.
*/
- numPoints = polyPtr->smooth->coordProc(canvas, (double *) NULL,
- polyPtr->numPoints, polyPtr->splineSteps, (XPoint *) NULL,
- (double *) NULL);
+ numPoints = polyPtr->smooth->coordProc(canvas, NULL,
+ polyPtr->numPoints, polyPtr->splineSteps, NULL, NULL);
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
@@ -988,8 +976,7 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height)
(numPoints * sizeof(XPoint)));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
- polyPtr->numPoints, polyPtr->splineSteps, pointPtr,
- (double *) NULL);
+ polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL);
if (polyPtr->fillGC != None) {
XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr,
numPoints, Complex, CoordModeOrigin);
@@ -1025,118 +1012,134 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height)
*/
static void
-PolygonInsert(canvas, itemPtr, beforeThis, obj)
- Tk_Canvas canvas; /* Canvas containing text item. */
- Tk_Item *itemPtr; /* Line item to be modified. */
- int beforeThis; /* Index before which new coordinates
- * are to be inserted. */
- Tcl_Obj *obj; /* New coordinates to be inserted. */
+PolygonInsert(
+ Tk_Canvas canvas, /* Canvas containing text item. */
+ Tk_Item *itemPtr, /* Line item to be modified. */
+ int beforeThis, /* Index before which new coordinates are to
+ * be inserted. */
+ Tcl_Obj *obj) /* New coordinates to be inserted. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int length, objc, i;
Tcl_Obj **objv;
- double *new;
+ double *newCoordPtr;
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
- if (!obj || (Tcl_ListObjGetElements((Tcl_Interp *) NULL, obj, &objc, &objv) != TCL_OK)
+ if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK)
|| !objc || objc&1) {
return;
}
length = 2*(polyPtr->numPoints - polyPtr->autoClosed);
- while(beforeThis>length) beforeThis-=length;
- while(beforeThis<0) beforeThis+=length;
- new = (double *) ckalloc((unsigned)(sizeof(double) * (length + 2 + objc)));
+ while (beforeThis>length) {
+ beforeThis -= length;
+ }
+ while (beforeThis<0) {
+ beforeThis += length;
+ }
+ newCoordPtr = (double *)
+ ckalloc(sizeof(double) * (unsigned)(length + 2 + objc));
for (i=0; i<beforeThis; i++) {
- new[i] = polyPtr->coordPtr[i];
+ newCoordPtr[i] = polyPtr->coordPtr[i];
}
for (i=0; i<objc; i++) {
- if (Tcl_GetDoubleFromObj((Tcl_Interp *) NULL,objv[i],
- new+(i+beforeThis))!=TCL_OK) {
- ckfree((char *) new);
+ if (Tcl_GetDoubleFromObj(NULL, objv[i],
+ &newCoordPtr[i+beforeThis]) != TCL_OK){
+ ckfree((char *) newCoordPtr);
return;
}
}
- for(i=beforeThis; i<length; i++) {
- new[i+objc] = polyPtr->coordPtr[i];
+ for (i=beforeThis; i<length; i++) {
+ newCoordPtr[i+objc] = polyPtr->coordPtr[i];
}
- if(polyPtr->coordPtr) ckfree((char *) polyPtr->coordPtr);
- length+=objc;
- polyPtr->coordPtr = new;
+ if (polyPtr->coordPtr) {
+ ckfree((char *) polyPtr->coordPtr);
+ }
+ length += objc;
+ polyPtr->coordPtr = newCoordPtr;
polyPtr->numPoints = (length/2) + polyPtr->autoClosed;
/*
- * Close the polygon if it isn't already closed, or remove autoclosing
- * if the user's coordinates are now closed.
+ * Close the polygon if it isn't already closed, or remove autoclosing if
+ * the user's coordinates are now closed.
*/
if (polyPtr->autoClosed) {
- if ((new[length-2] == new[0]) && (new[length-1] == new[1])) {
+ if ((newCoordPtr[length-2] == newCoordPtr[0])
+ && (newCoordPtr[length-1] == newCoordPtr[1])) {
polyPtr->autoClosed = 0;
polyPtr->numPoints--;
}
- }
- else {
- if ((new[length-2] != new[0]) || (new[length-1] != new[1])) {
+ } else {
+ if ((newCoordPtr[length-2] != newCoordPtr[0])
+ || (newCoordPtr[length-1] != newCoordPtr[1])) {
polyPtr->autoClosed = 1;
polyPtr->numPoints++;
}
}
- new[length] = new[0];
- new[length+1] = new[1];
+ newCoordPtr[length] = newCoordPtr[0];
+ newCoordPtr[length+1] = newCoordPtr[1];
if (((length-objc)>3) && (state != TK_STATE_HIDDEN)) {
/*
- * This is some optimizing code that will result that only the part
- * of the polygon that changed (and the objects that are overlapping
- * with that part) need to be redrawn. A special flag is set that
- * instructs the general canvas code not to redraw the whole
- * object. If this flag is not set, the canvas will do the redrawing,
- * otherwise I have to do it here.
+ * This is some optimizing code that will result that only the part of
+ * the polygon that changed (and the objects that are overlapping with
+ * that part) need to be redrawn. A special flag is set that instructs
+ * the general canvas code not to redraw the whole object. If this
+ * flag is not set, the canvas will do the redrawing, otherwise I have
+ * to do it here.
*/
+
double width;
int j;
itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
/*
- * The header elements that normally are used for the
- * bounding box, are now used to calculate the bounding
- * box for only the part that has to be redrawn. That
- * doesn't matter, because afterwards the bounding
- * box has to be re-calculated anyway.
+ * The header elements that normally are used for the bounding box,
+ * are now used to calculate the bounding box for only the part that
+ * has to be redrawn. That doesn't matter, because afterwards the
+ * bounding box has to be re-calculated anyway.
*/
itemPtr->x1 = itemPtr->x2 = (int) polyPtr->coordPtr[beforeThis];
itemPtr->y1 = itemPtr->y2 = (int) polyPtr->coordPtr[beforeThis+1];
beforeThis-=2; objc+=4;
- if(polyPtr->smooth) {
- beforeThis-=2; objc+=4;
- } /* be carefull; beforeThis could now be negative */
- for(i=beforeThis; i<beforeThis+objc; i+=2) {
- j=i;
- if(j<0) j+=length;
- if(j>=length) j-=length;
- TkIncludePoint(itemPtr, polyPtr->coordPtr+j);
+ if (polyPtr->smooth) {
+ beforeThis-=2;
+ objc+=4;
+ }
+
+ /*
+ * Be careful; beforeThis could now be negative
+ */
+
+ for (i=beforeThis; i<beforeThis+objc; i+=2) {
+ j = i;
+ if (j<0) {
+ j += length;
+ } else if (j>=length) {
+ j -= length;
+ }
+ TkIncludePoint(itemPtr, polyPtr->coordPtr+j);
}
width = polyPtr->outline.width;
if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (polyPtr->outline.activeWidth>width) {
- width = polyPtr->outline.activeWidth;
- }
+ if (polyPtr->outline.activeWidth > width) {
+ width = polyPtr->outline.activeWidth;
+ }
} else if (state==TK_STATE_DISABLED) {
- if (polyPtr->outline.disabledWidth>0.0) {
- width = polyPtr->outline.disabledWidth;
- }
+ if (polyPtr->outline.disabledWidth > 0.0) {
+ width = polyPtr->outline.disabledWidth;
+ }
}
itemPtr->x1 -= (int) width; itemPtr->y1 -= (int) width;
itemPtr->x2 += (int) width; itemPtr->y2 += (int) width;
Tk_CanvasEventuallyRedraw(canvas,
- itemPtr->x1, itemPtr->y1,
- itemPtr->x2, itemPtr->y2);
+ itemPtr->x1, itemPtr->y1, itemPtr->x2, itemPtr->y2);
}
ComputePolygonBbox(canvas, polyPtr);
@@ -1153,37 +1156,47 @@ PolygonInsert(canvas, itemPtr, beforeThis, obj)
* None.
*
* Side effects:
- * Characters between "first" and "last", inclusive, get
- * deleted from itemPtr.
+ * Characters between "first" and "last", inclusive, get deleted from
+ * itemPtr.
*
*--------------------------------------------------------------
*/
static void
-PolygonDeleteCoords(canvas, itemPtr, first, last)
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Item in which to delete characters. */
- int first; /* Index of first character to delete. */
- int last; /* Index of last character to delete. */
+PolygonDeleteCoords(
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Item in which to delete characters. */
+ int first, /* Index of first character to delete. */
+ int last) /* Index of last character to delete. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int count, i;
int length = 2*(polyPtr->numPoints - polyPtr->autoClosed);
- while(first>=length) first-=length;
- while(first<0) first+=length;
- while(last>=length) last-=length;
- while(last<0) last+=length;
+ while (first>=length) {
+ first -= length;
+ }
+ while (first<0) {
+ first += length;
+ }
+ while (last>=length) {
+ last -= length;
+ }
+ while (last<0) {
+ last += length;
+ }
first &= -2;
last &= -2;
count = last + 2 - first;
- if(count<=0) count +=length;
+ if (count<=0) {
+ count += length;
+ }
- if(count >= length) {
+ if (count >= length) {
polyPtr->numPoints = 0;
- if(polyPtr->coordPtr != NULL) {
+ if (polyPtr->coordPtr != NULL) {
ckfree((char *) polyPtr->coordPtr);
polyPtr->coordPtr = NULL;
}
@@ -1191,7 +1204,7 @@ PolygonDeleteCoords(canvas, itemPtr, first, last)
return;
}
- if(last>=first) {
+ if (last>=first) {
for(i=last+2; i<length; i++) {
polyPtr->coordPtr[i-count] = polyPtr->coordPtr[i];
}
@@ -1211,14 +1224,14 @@ PolygonDeleteCoords(canvas, itemPtr, first, last)
*
* PolygonToPoint --
*
- * Computes the distance from a given point to a given
- * polygon, in canvas units.
+ * Computes the distance from a given point to a given polygon, in canvas
+ * units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are pointPtr[0] and pointPtr[1] is inside the polygon. If the
- * point isn't inside the polygon then the return value is the
- * distance from the point to the polygon.
+ * The return value is 0 if the point whose x and y coordinates are
+ * pointPtr[0] and pointPtr[1] is inside the polygon. If the point isn't
+ * inside the polygon then the return value is the distance from the
+ * point to the polygon.
*
* Side effects:
* None.
@@ -1228,10 +1241,10 @@ PolygonDeleteCoords(canvas, itemPtr, first, last)
/* ARGSUSED */
static double
-PolygonToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+PolygonToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
double *coordPtr, *polyPoints;
@@ -1240,15 +1253,15 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
double radius;
double bestDist, dist;
int numPoints, count;
- int changedMiterToBevel; /* Non-zero means that a mitered corner
- * had to be treated as beveled after all
- * because the angle was < 11 degrees. */
+ int changedMiterToBevel; /* Non-zero means that a mitered corner had to
+ * be treated as beveled after all because the
+ * angle was < 11 degrees. */
double width;
Tk_State state = itemPtr->state;
bestDist = 1.0e36;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
width = polyPtr->outline.width;
@@ -1269,9 +1282,9 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
*/
if ((polyPtr->smooth) && (polyPtr->numPoints>2)) {
- numPoints = polyPtr->smooth->coordProc(canvas, (double *) NULL,
- polyPtr->numPoints, polyPtr->splineSteps, (XPoint *) NULL,
- (double *) NULL);
+ numPoints = polyPtr->smooth->coordProc(canvas, NULL,
+ polyPtr->numPoints, polyPtr->splineSteps, NULL,
+ NULL);
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
@@ -1279,7 +1292,7 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
(2*numPoints*sizeof(double)));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
- polyPtr->numPoints, polyPtr->splineSteps, (XPoint *) NULL,
+ polyPtr->numPoints, polyPtr->splineSteps, NULL,
polyPoints);
} else {
numPoints = polyPtr->numPoints;
@@ -1300,22 +1313,23 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
}
}
- if ((polyPtr->outline.gc == None) || (width <= 1)) goto donepoint;
+ if ((polyPtr->outline.gc == None) || (width <= 1)) {
+ goto donepoint;
+ }
/*
- * The overall idea is to iterate through all of the edges of
- * the line, computing a polygon for each edge and testing the
- * point against that polygon. In addition, there are additional
- * tests to deal with rounded joints and caps.
+ * The overall idea is to iterate through all of the edges of the line,
+ * computing a polygon for each edge and testing the point against that
+ * polygon. In addition, there are additional tests to deal with rounded
+ * joints and caps.
*/
changedMiterToBevel = 0;
for (count = numPoints, coordPtr = polyPoints; count >= 2;
count--, coordPtr += 2) {
-
/*
- * If rounding is done around the first point then compute
- * the distance between the point and the point.
+ * If rounding is done around the first point then compute the
+ * distance between the point and the point.
*/
if (polyPtr->joinStyle == JoinRound) {
@@ -1330,9 +1344,9 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
}
/*
- * Compute the polygonal shape corresponding to this edge,
- * consisting of two points for the first point of the edge
- * and two points for the last point of the edge.
+ * Compute the polygonal shape corresponding to this edge, consisting
+ * of two points for the first point of the edge and two points for
+ * the last point of the edge.
*/
if (count == numPoints) {
@@ -1348,10 +1362,10 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
poly, poly+2);
/*
- * If this line uses beveled joints, then check the distance
- * to a polygon comprising the last two points of the previous
- * polygon and the first two from this polygon; this checks
- * the wedges that fill the mitered joint.
+ * If this line uses beveled joints, then check the distance to a
+ * polygon comprising the last two points of the previous polygon
+ * and the first two from this polygon; this checks the wedges
+ * that fill the mitered joint.
*/
if ((polyPtr->joinStyle == JoinBevel) || changedMiterToBevel) {
@@ -1374,8 +1388,8 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
(double) width, poly+4, poly+6) == 0) {
changedMiterToBevel = 1;
- TkGetButtPoints(coordPtr, coordPtr+2, (double) width,
- 0, poly+4, poly+6);
+ TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0,
+ poly+4, poly+6);
}
} else {
TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0,
@@ -1392,7 +1406,7 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
}
}
- donepoint:
+ donepoint:
if ((polyPoints != staticSpace) && polyPoints != polyPtr->coordPtr) {
ckfree((char *) polyPoints);
}
@@ -1404,14 +1418,13 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
*
* PolygonToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangular area.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangular area.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -1421,12 +1434,12 @@ PolygonToPoint(canvas, itemPtr, pointPtr)
/* ARGSUSED */
static int
-PolygonToArea(canvas, itemPtr, rectPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against polygon. */
- double *rectPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
- * area. */
+PolygonToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against polygon. */
+ double *rectPtr) /* Pointer to array of four coordinates
+ * (x1,y1,x2,y2) describing rectangular
+ * area. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
double *coordPtr;
@@ -1434,19 +1447,18 @@ PolygonToArea(canvas, itemPtr, rectPtr)
double *polyPoints, poly[10];
double radius;
int numPoints, count;
- int changedMiterToBevel; /* Non-zero means that a mitered corner
- * had to be treated as beveled after all
- * because the angle was < 11 degrees. */
- int inside; /* Tentative guess about what to return,
- * based on all points seen so far: one
- * means everything seen so far was
- * inside the area; -1 means everything
- * was outside the area. 0 means overlap
- * has been found. */
+ int changedMiterToBevel; /* Non-zero means that a mitered corner had to
+ * be treated as beveled after all because the
+ * angle was < 11 degrees. */
+ int inside; /* Tentative guess about what to return, based
+ * on all points seen so far: one means
+ * everything seen so far was inside the area;
+ * -1 means everything was outside the area. 0
+ * means overlap has been found. */
double width;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -1468,60 +1480,62 @@ PolygonToArea(canvas, itemPtr, rectPtr)
return -1;
} else if (polyPtr->numPoints <3) {
double oval[4];
+
oval[0] = polyPtr->coordPtr[0]-radius;
oval[1] = polyPtr->coordPtr[1]-radius;
oval[2] = polyPtr->coordPtr[0]+radius;
oval[3] = polyPtr->coordPtr[1]+radius;
return TkOvalToArea(oval, rectPtr);
}
+
/*
* Handle smoothed polygons by generating an expanded set of points
* against which to do the check.
*/
if (polyPtr->smooth) {
- numPoints = polyPtr->smooth->coordProc(canvas, (double *) NULL,
- polyPtr->numPoints, polyPtr->splineSteps, (XPoint *) NULL,
- (double *) NULL);
+ numPoints = polyPtr->smooth->coordProc(canvas, NULL,
+ polyPtr->numPoints, polyPtr->splineSteps, NULL, NULL);
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
- polyPoints = (double *) ckalloc((unsigned)
- (2*numPoints*sizeof(double)));
+ polyPoints = (double *)
+ ckalloc((unsigned) (2*numPoints*sizeof(double)));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
- polyPtr->numPoints, polyPtr->splineSteps, (XPoint *) NULL,
- polyPoints);
+ polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
} else {
numPoints = polyPtr->numPoints;
polyPoints = polyPtr->coordPtr;
}
/*
- * Simple test to see if we are in the polygon. Polygons are
- * different from othe canvas items in that they register points
- * being inside even if it isn't filled.
+ * Simple test to see if we are in the polygon. Polygons are different
+ * from othe canvas items in that they register points being inside even
+ * if it isn't filled.
*/
+
inside = TkPolygonToArea(polyPoints, numPoints, rectPtr);
- if (inside==0) goto donearea;
+ if (inside==0) {
+ goto donearea;
+ }
- if (polyPtr->outline.gc == None) goto donearea ;
+ if (polyPtr->outline.gc == None) {
+ goto donearea;
+ }
/*
- * Iterate through all of the edges of the line, computing a polygon
- * for each edge and testing the area against that polygon. In
- * addition, there are additional tests to deal with rounded joints
- * and caps.
+ * Iterate through all of the edges of the line, computing a polygon for
+ * each edge and testing the area against that polygon. In addition, there
+ * are additional tests to deal with rounded joints and caps.
*/
changedMiterToBevel = 0;
for (count = numPoints, coordPtr = polyPoints; count >= 2;
count--, coordPtr += 2) {
-
/*
- * If rounding is done around the first point of the edge
- * then test a circular region around the point with the
- * area.
+ * If rounding is done around the first point of the edge then test a
+ * circular region around the point with the area.
*/
if (polyPtr->joinStyle == JoinRound) {
@@ -1536,28 +1550,26 @@ PolygonToArea(canvas, itemPtr, rectPtr)
}
/*
- * Compute the polygonal shape corresponding to this edge,
- * consisting of two points for the first point of the edge
- * and two points for the last point of the edge.
+ * Compute the polygonal shape corresponding to this edge, consisting
+ * of two points for the first point of the edge and two points for
+ * the last point of the edge.
*/
if (count == numPoints) {
- TkGetButtPoints(coordPtr+2, coordPtr, width,
- 0, poly, poly+2);
+ TkGetButtPoints(coordPtr+2, coordPtr, width, 0, poly, poly+2);
} else if ((polyPtr->joinStyle == JoinMiter) && !changedMiterToBevel) {
poly[0] = poly[6];
poly[1] = poly[7];
poly[2] = poly[4];
poly[3] = poly[5];
} else {
- TkGetButtPoints(coordPtr+2, coordPtr, width, 0,
- poly, poly+2);
+ TkGetButtPoints(coordPtr+2, coordPtr, width, 0, poly, poly+2);
/*
- * If the last joint was beveled, then also check a
- * polygon comprising the last two points of the previous
- * polygon and the first two from this polygon; this checks
- * the wedges that fill the beveled joint.
+ * If the last joint was beveled, then also check a polygon
+ * comprising the last two points of the previous polygon and the
+ * first two from this polygon; this checks the wedges that fill
+ * the beveled joint.
*/
if ((polyPtr->joinStyle == JoinBevel) || changedMiterToBevel) {
@@ -1571,18 +1583,15 @@ PolygonToArea(canvas, itemPtr, rectPtr)
}
}
if (count == 2) {
- TkGetButtPoints(coordPtr, coordPtr+2, width,
- 0, poly+4, poly+6);
+ TkGetButtPoints(coordPtr, coordPtr+2, width, 0, poly+4, poly+6);
} else if (polyPtr->joinStyle == JoinMiter) {
if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
width, poly+4, poly+6) == 0) {
changedMiterToBevel = 1;
- TkGetButtPoints(coordPtr, coordPtr+2, width,
- 0, poly+4, poly+6);
+ TkGetButtPoints(coordPtr, coordPtr+2, width,0, poly+4, poly+6);
}
} else {
- TkGetButtPoints(coordPtr, coordPtr+2, width, 0,
- poly+4, poly+6);
+ TkGetButtPoints(coordPtr, coordPtr+2, width, 0, poly+4, poly+6);
}
poly[8] = poly[0];
poly[9] = poly[1];
@@ -1592,7 +1601,7 @@ PolygonToArea(canvas, itemPtr, rectPtr)
}
}
- donearea:
+ donearea:
if ((polyPoints != staticSpace) && (polyPoints != polyPtr->coordPtr)) {
ckfree((char *) polyPoints);
}
@@ -1604,15 +1613,14 @@ PolygonToArea(canvas, itemPtr, rectPtr)
*
* ScalePolygon --
*
- * This procedure is invoked to rescale a polygon item.
+ * This function is invoked to rescale a polygon item.
*
* Results:
* None.
*
* Side effects:
- * The polygon referred to by itemPtr is rescaled so that the
- * following transformation is applied to all point
- * coordinates:
+ * The polygon referred to by itemPtr is rescaled so that the following
+ * transformation is applied to all point coordinates:
* x' = originX + scaleX*(x-originX)
* y' = originY + scaleY*(y-originY)
*
@@ -1620,12 +1628,13 @@ PolygonToArea(canvas, itemPtr, rectPtr)
*/
static void
-ScalePolygon(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing polygon. */
- Tk_Item *itemPtr; /* Polygon to be scaled. */
- double originX, originY; /* Origin about which to scale rect. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScalePolygon(
+ Tk_Canvas canvas, /* Canvas containing polygon. */
+ Tk_Item *itemPtr, /* Polygon to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale rect. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
double *coordPtr;
@@ -1644,14 +1653,13 @@ ScalePolygon(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* GetPolygonIndex --
*
- * Parse an index into a polygon item and return either its value
- * or an error.
+ * Parse an index into a polygon item and return either its value or an
+ * error.
*
* Results:
- * A standard Tcl result. If all went well, then *indexPtr is
- * filled in with the index (into itemPtr) corresponding to
- * string. Otherwise an error message is left in
- * interp->result.
+ * A standard Tcl result. If all went well, then *indexPtr is filled in
+ * with the index (into itemPtr) corresponding to string. Otherwise an
+ * error message is left in interp->result.
*
* Side effects:
* None.
@@ -1660,33 +1668,31 @@ ScalePolygon(canvas, itemPtr, originX, originY, scaleX, scaleY)
*/
static int
-GetPolygonIndex(interp, canvas, itemPtr, obj, indexPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item for which the index is being
+GetPolygonIndex(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
- Tcl_Obj *obj; /* Specification of a particular coord
- * in itemPtr's line. */
- int *indexPtr; /* Where to store converted index. */
+ Tcl_Obj *obj, /* Specification of a particular coord in
+ * itemPtr's line. */
+ int *indexPtr) /* Where to store converted index. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int length;
char *string = Tcl_GetStringFromObj(obj, &length);
if (string[0] == 'e') {
- if (strncmp(string, "end", (unsigned) length) == 0) {
+ if (strncmp(string, "end", (unsigned)length) == 0) {
*indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed);
} else {
- badIndex:
-
/*
- * Some of the paths here leave messages in interp->result,
- * so we have to clear it out before storing our own message.
+ * Some of the paths here leave messages in interp->result, so we
+ * have to clear it out before storing our own message.
*/
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
- Tcl_AppendResult(interp, "bad index \"", string, "\"",
- (char *) NULL);
+ badIndex:
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
+ Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
return TCL_ERROR;
}
} else if (string[0] == '@') {
@@ -1717,6 +1723,7 @@ GetPolygonIndex(interp, canvas, itemPtr, obj, indexPtr)
}
} else {
int count = 2*(polyPtr->numPoints - polyPtr->autoClosed);
+
if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) {
goto badIndex;
}
@@ -1739,26 +1746,24 @@ GetPolygonIndex(interp, canvas, itemPtr, obj, indexPtr)
*
* TranslatePolygon --
*
- * This procedure is called to move a polygon by a given
- * amount.
+ * This function is called to move a polygon by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the polygon is offset by (xDelta, yDelta),
- * and the bounding box is updated in the generic part of the
- * item structure.
+ * The position of the polygon is offset by (xDelta, yDelta), and the
+ * bounding box is updated in the generic part of the item structure.
*
*--------------------------------------------------------------
*/
static void
-TranslatePolygon(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be
- * moved. */
+TranslatePolygon(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
double *coordPtr;
@@ -1777,15 +1782,13 @@ TranslatePolygon(canvas, itemPtr, deltaX, deltaY)
*
* PolygonToPostscript --
*
- * This procedure is called to generate Postscript for
- * polygon items.
+ * This function is called to generate Postscript for polygon items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in the interp's result, replacing whatever used
- * to be there. If no error occurs, then Postscript for the
- * item is appended to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in the interp's
+ * result, replacing whatever used to be there. If no error occurs, then
+ * Postscript for the item is appended to the result.
*
* Side effects:
* None.
@@ -1794,15 +1797,13 @@ TranslatePolygon(canvas, itemPtr, deltaX, deltaY)
*/
static int
-PolygonToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is
- * wanted. */
- int prepass; /* 1 means this is a prepass to
- * collect font information; 0 means
- * final Postscript is being created. */
+PolygonToPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
char *style;
@@ -1868,17 +1869,17 @@ PolygonToPostscript(interp, canvas, itemPtr, prepass)
polyPtr->coordPtr[0], Tk_CanvasPsY(canvas, polyPtr->coordPtr[1]),
width/2.0, width/2.0);
Tcl_AppendResult(interp, "matrix currentmatrix\n",string,
- " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", (char *) NULL);
+ " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", NULL);
if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
return TCL_ERROR;
}
if (stipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
+ Tcl_AppendResult(interp, "clip ", NULL);
if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
return TCL_ERROR;
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
return TCL_OK;
}
@@ -1899,16 +1900,15 @@ PolygonToPostscript(interp, canvas, itemPtr, prepass)
return TCL_ERROR;
}
if (fillStipple != None) {
- Tcl_AppendResult(interp, "eoclip ", (char *) NULL);
- if (Tk_CanvasPsStipple(interp, canvas, fillStipple)
- != TCL_OK) {
+ Tcl_AppendResult(interp, "eoclip ", NULL);
+ if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) {
return TCL_ERROR;
}
if (color != NULL) {
- Tcl_AppendResult(interp, "grestore gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
}
} else {
- Tcl_AppendResult(interp, "eofill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "eofill\n", NULL);
}
}
@@ -1917,13 +1917,12 @@ PolygonToPostscript(interp, canvas, itemPtr, prepass)
*/
if (color != NULL) {
-
if (!polyPtr->smooth || !polyPtr->smooth->postscriptProc) {
Tk_CanvasPsPath(interp, canvas, polyPtr->coordPtr,
- polyPtr->numPoints);
+ polyPtr->numPoints);
} else {
polyPtr->smooth->postscriptProc(interp, canvas, polyPtr->coordPtr,
- polyPtr->numPoints, polyPtr->splineSteps);
+ polyPtr->numPoints, polyPtr->splineSteps);
}
if (polyPtr->joinStyle == JoinRound) {
@@ -1933,8 +1932,7 @@ PolygonToPostscript(interp, canvas, itemPtr, prepass)
} else {
style = "0";
}
- Tcl_AppendResult(interp, style," setlinejoin 1 setlinecap\n",
- (char *) NULL);
+ Tcl_AppendResult(interp, style," setlinejoin 1 setlinecap\n", NULL);
if (Tk_CanvasPsOutline(canvas, itemPtr,
&(polyPtr->outline)) != TCL_OK) {
return TCL_ERROR;
@@ -1942,3 +1940,11 @@ PolygonToPostscript(interp, canvas, itemPtr, prepass)
}
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 88e106a..ac8f105 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -1,28 +1,28 @@
-/*
+/*
* tkCanvPs.c --
*
- * This module provides Postscript output support for canvases,
- * including the "postscript" widget command plus a few utility
- * procedures used for generating Postscript.
+ * This module provides Postscript output support for canvases, including
+ * the "postscript" widget command plus a few utility functions used for
+ * generating Postscript.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
#include "tkCanvas.h"
-#include "tkPort.h"
+#include "tkFont.h"
/*
* See tkCanvas.h for key data structures used to implement canvases.
*/
/*
- * The following definition is used in generating postscript for images
- * and windows.
+ * The following definition is used in generating postscript for images and
+ * windows.
*/
typedef struct TkColormapData { /* Hold color information for a window */
@@ -36,11 +36,12 @@ typedef struct TkColormapData { /* Hold color information for a window */
/*
* One of the following structures is created to keep track of Postscript
- * output being generated. It consists mostly of information provided on
- * the widget command line.
+ * output being generated. It consists mostly of information provided on the
+ * widget command line.
*/
typedef struct TkPostscriptInfo {
+ Tk_Window tkwin; /* The canvas being printed. */
int x, y, width, height; /* Area to print, in canvas pixel
* coordinates. */
int x2, y2; /* x+width and y+height. */
@@ -55,93 +56,90 @@ typedef struct TkPostscriptInfo {
double scale; /* Scale factor for conversion: each pixel
* maps into this many points. */
Tk_Anchor pageAnchor; /* How to anchor bbox on Postscript page. */
- int rotate; /* Non-zero means output should be rotated
- * on page (landscape mode). */
+ int rotate; /* Non-zero means output should be rotated on
+ * page (landscape mode). */
char *fontVar; /* If non-NULL, gives name of global variable
* containing font mapping information.
* Malloc'ed. */
char *colorVar; /* If non-NULL, give name of global variable
* containing color mapping information.
* Malloc'ed. */
- char *colorMode; /* Mode for handling colors: "monochrome",
+ char *colorMode; /* Mode for handling colors: "monochrome",
* "gray", or "color". Malloc'ed. */
- int colorLevel; /* Numeric value corresponding to colorMode:
- * 0 for mono, 1 for gray, 2 for color. */
+ int colorLevel; /* Numeric value corresponding to colorMode: 0
+ * for mono, 1 for gray, 2 for color. */
char *fileName; /* Name of file in which to write Postscript;
* NULL means return Postscript info as
* result. Malloc'ed. */
- char *channelName; /* If -channel is specified, the name of
- * the channel to use. */
+ char *channelName; /* If -channel is specified, the name of the
+ * channel to use. */
Tcl_Channel chan; /* Open channel corresponding to fileName. */
Tcl_HashTable fontTable; /* Hash table containing names of all font
- * families used in output. The hash table
+ * families used in output. The hash table
* values are not used. */
- int prepass; /* Non-zero means that we're currently in
- * the pre-pass that collects font information,
- * so the Postscript generated isn't
- * relevant. */
- int prolog; /* Non-zero means output should contain
- the file prolog.ps in the header. */
+ int prepass; /* Non-zero means that we're currently in the
+ * pre-pass that collects font information, so
+ * the Postscript generated isn't relevant. */
+ int prolog; /* Non-zero means output should contain the
+ * prolog definitions in the header. */
} TkPostscriptInfo;
/*
- * The table below provides a template that's used to process arguments
- * to the canvas "postscript" command and fill in TkPostscriptInfo
- * structures.
+ * The table below provides a template that's used to process arguments to the
+ * canvas "postscript" command and fill in TkPostscriptInfo structures.
*/
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_STRING, "-colormap", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-colormap", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, colorVar), 0},
- {TK_CONFIG_STRING, "-colormode", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-colormode", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, colorMode), 0},
- {TK_CONFIG_STRING, "-file", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-file", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, fileName), 0},
- {TK_CONFIG_STRING, "-channel", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-channel", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, channelName), 0},
- {TK_CONFIG_STRING, "-fontmap", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-fontmap", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, fontVar), 0},
- {TK_CONFIG_PIXELS, "-height", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-height", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, height), 0},
- {TK_CONFIG_ANCHOR, "-pageanchor", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_ANCHOR, "-pageanchor", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, pageAnchor), 0},
- {TK_CONFIG_STRING, "-pageheight", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-pageheight", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, pageHeightString), 0},
- {TK_CONFIG_STRING, "-pagewidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-pagewidth", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, pageWidthString), 0},
- {TK_CONFIG_STRING, "-pagex", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-pagex", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, pageXString), 0},
- {TK_CONFIG_STRING, "-pagey", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-pagey", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, pageYString), 0},
- {TK_CONFIG_BOOLEAN, "-prolog", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BOOLEAN, "-prolog", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, prolog), 0},
- {TK_CONFIG_BOOLEAN, "-rotate", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BOOLEAN, "-rotate", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, rotate), 0},
- {TK_CONFIG_PIXELS, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-width", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, width), 0},
- {TK_CONFIG_PIXELS, "-x", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-x", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, x), 0},
- {TK_CONFIG_PIXELS, "-y", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-y", NULL, NULL,
"", Tk_Offset(TkPostscriptInfo, y), 0},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int GetPostscriptPoints _ANSI_ARGS_((Tcl_Interp *interp,
- char *string, double *doublePtr));
+static int GetPostscriptPoints(Tcl_Interp *interp,
+ char *string, double *doublePtr);
/*
*--------------------------------------------------------------
*
* TkCanvPostscriptCmd --
*
- * This procedure is invoked to process the "postscript" options
- * of the widget command for canvas widgets. See the user
- * documentation for details on what it does.
+ * This function is invoked to process the "postscript" options of the
+ * widget command for canvas widgets. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -154,16 +152,15 @@ static int GetPostscriptPoints _ANSI_ARGS_((Tcl_Interp *interp,
/* ARGSUSED */
int
-TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
- TkCanvas *canvasPtr; /* Information about canvas widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Caller has
- * already parsed this command enough
- * to know that argv[1] is
- * "postscript". */
+TkCanvPostscriptCmd(
+ TkCanvas *canvasPtr, /* Information about canvas widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. Caller has already parsed
+ * this command enough to know that argv[1] is
+ * "postscript". */
{
- TkPostscriptInfo psInfo;
+ TkPostscriptInfo psInfo, *psInfoPtr = &psInfo;
Tk_PostscriptInfo oldInfoPtr;
int result;
Tk_Item *itemPtr;
@@ -173,30 +170,28 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
time_t now;
size_t length;
Tk_Window tkwin = canvasPtr->tkwin;
- int deltaX = 0, deltaY = 0; /* Offset of lower-left corner of
- * area to be marked up, measured
- * in canvas units from the positioning
- * point on the page (reflects
- * anchor position). Initial values
- * needed only to stop compiler
- * warnings. */
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
Tcl_DString buffer;
- char psenccmd[]="::tk::ensure_psenc_is_loaded";
+ char psenccmd[] = "::tk::ensure_psenc_is_loaded";
+ int deltaX = 0, deltaY = 0; /* Offset of lower-left corner of area to be
+ * marked up, measured in canvas units from
+ * the positioning point on the page (reflects
+ * anchor position). Initial values needed
+ * only to stop compiler warnings. */
/*
- *----------------------------------------------------------------
- * Initialize the data structure describing Postscript generation,
- * then process all the arguments to fill the data structure in.
- *----------------------------------------------------------------
+ * Initialize the data structure describing Postscript generation, then
+ * process all the arguments to fill the data structure in.
*/
+
result = Tcl_EvalEx(interp,psenccmd,-1,TCL_EVAL_GLOBAL);
if (result != TCL_OK) {
return result;
}
oldInfoPtr = canvasPtr->psInfo;
- canvasPtr->psInfo = (Tk_PostscriptInfo) &psInfo;
+ canvasPtr->psInfo = (Tk_PostscriptInfo) psInfoPtr;
+ psInfo.tkwin = canvasPtr->tkwin;
psInfo.x = canvasPtr->xOrigin;
psInfo.y = canvasPtr->yOrigin;
psInfo.width = -1;
@@ -220,9 +215,8 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
psInfo.prepass = 0;
psInfo.prolog = 1;
Tcl_InitHashTable(&psInfo.fontTable, TCL_STRING_KEYS);
- result = Tk_ConfigureWidget(interp, tkwin,
- configSpecs, argc-2, argv+2, (char *) &psInfo,
- TK_CONFIG_ARGV_ONLY);
+ result = Tk_ConfigureWidget(interp, tkwin, configSpecs, argc-2, argv+2,
+ (char *) &psInfo, TK_CONFIG_ARGV_ONLY);
if (result != TCL_OK) {
goto cleanup;
}
@@ -265,38 +259,38 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
psInfo.scale /= WidthOfScreen(Tk_Screen(tkwin));
}
switch (psInfo.pageAnchor) {
- case TK_ANCHOR_NW:
- case TK_ANCHOR_W:
- case TK_ANCHOR_SW:
- deltaX = 0;
- break;
- case TK_ANCHOR_N:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_S:
- deltaX = -psInfo.width/2;
- break;
- case TK_ANCHOR_NE:
- case TK_ANCHOR_E:
- case TK_ANCHOR_SE:
- deltaX = -psInfo.width;
- break;
+ case TK_ANCHOR_NW:
+ case TK_ANCHOR_W:
+ case TK_ANCHOR_SW:
+ deltaX = 0;
+ break;
+ case TK_ANCHOR_N:
+ case TK_ANCHOR_CENTER:
+ case TK_ANCHOR_S:
+ deltaX = -psInfo.width/2;
+ break;
+ case TK_ANCHOR_NE:
+ case TK_ANCHOR_E:
+ case TK_ANCHOR_SE:
+ deltaX = -psInfo.width;
+ break;
}
switch (psInfo.pageAnchor) {
- case TK_ANCHOR_NW:
- case TK_ANCHOR_N:
- case TK_ANCHOR_NE:
- deltaY = - psInfo.height;
- break;
- case TK_ANCHOR_W:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_E:
- deltaY = -psInfo.height/2;
- break;
- case TK_ANCHOR_SW:
- case TK_ANCHOR_S:
- case TK_ANCHOR_SE:
- deltaY = 0;
- break;
+ case TK_ANCHOR_NW:
+ case TK_ANCHOR_N:
+ case TK_ANCHOR_NE:
+ deltaY = - psInfo.height;
+ break;
+ case TK_ANCHOR_W:
+ case TK_ANCHOR_CENTER:
+ case TK_ANCHOR_E:
+ deltaY = -psInfo.height/2;
+ break;
+ case TK_ANCHOR_SW:
+ case TK_ANCHOR_S:
+ case TK_ANCHOR_SE:
+ deltaY = 0;
+ break;
}
if (psInfo.colorMode == NULL) {
@@ -310,22 +304,20 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
} else if (strncmp(psInfo.colorMode, "color", length) == 0) {
psInfo.colorLevel = 2;
} else {
- Tcl_AppendResult(interp, "bad color mode \"",
- psInfo.colorMode, "\": must be monochrome, ",
- "gray, or color", (char *) NULL);
+ Tcl_AppendResult(interp, "bad color mode \"", psInfo.colorMode,
+ "\": must be monochrome, gray, or color", NULL);
goto cleanup;
}
}
if (psInfo.fileName != NULL) {
-
/*
* Check that -file and -channel are not both specified.
*/
if (psInfo.channelName != NULL) {
Tcl_AppendResult(interp, "can't specify both -file",
- " and -channel", (char *) NULL);
+ " and -channel", NULL);
result = TCL_ERROR;
goto cleanup;
}
@@ -337,11 +329,11 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
if (Tcl_IsSafe(interp)) {
Tcl_AppendResult(interp, "can't specify -file in a",
- " safe interpreter", (char *) NULL);
+ " safe interpreter", NULL);
result = TCL_ERROR;
goto cleanup;
}
-
+
p = Tcl_TranslateFileName(interp, psInfo.fileName, &buffer);
if (p == NULL) {
goto cleanup;
@@ -355,35 +347,31 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
if (psInfo.channelName != NULL) {
int mode;
-
+
/*
- * Check that the channel is found in this interpreter and that it
- * is open for writing.
+ * Check that the channel is found in this interpreter and that it is
+ * open for writing.
*/
- psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName,
- &mode);
+ psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName, &mode);
if (psInfo.chan == (Tcl_Channel) NULL) {
result = TCL_ERROR;
goto cleanup;
}
if ((mode & TCL_WRITABLE) == 0) {
- Tcl_AppendResult(interp, "channel \"",
- psInfo.channelName, "\" wasn't opened for writing",
- (char *) NULL);
+ Tcl_AppendResult(interp, "channel \"", psInfo.channelName,
+ "\" wasn't opened for writing", NULL);
result = TCL_ERROR;
goto cleanup;
}
}
-
+
/*
- *--------------------------------------------------------
- * Make a pre-pass over all of the items, generating Postscript
- * and then throwing it away. The purpose of this pass is just
- * to collect information about all the fonts in use, so that
- * we can output font information in the proper form required
- * by the Document Structuring Conventions.
- *--------------------------------------------------------
+ * Make a pre-pass over all of the items, generating Postscript and then
+ * throwing it away. The purpose of this pass is just to collect
+ * information about all the fonts in use, so that we can output font
+ * information in the proper form required by the Document Structuring
+ * Conventions.
*/
psInfo.prepass = 1;
@@ -401,11 +389,10 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
Tcl_ResetResult(interp);
if (result != TCL_OK) {
/*
- * An error just occurred. Just skip out of this loop.
- * There's no need to report the error now; it can be
- * reported later (errors can happen later that don't
- * happen now, so we still have to check for errors later
- * anyway).
+ * An error just occurred. Just skip out of this loop. There's no
+ * need to report the error now; it can be reported later (errors
+ * can happen later that don't happen now, so we still have to
+ * check for errors later anyway).
*/
break;
}
@@ -413,117 +400,109 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
psInfo.prepass = 0;
/*
- *--------------------------------------------------------
* Generate the header and prolog for the Postscript.
- *--------------------------------------------------------
*/
if (psInfo.prolog) {
- Tcl_AppendResult(interp, "%!PS-Adobe-3.0 EPSF-3.0\n",
- "%%Creator: Tk Canvas Widget\n", (char *) NULL);
+ Tcl_AppendResult(interp, "%!PS-Adobe-3.0 EPSF-3.0\n",
+ "%%Creator: Tk Canvas Widget\n", NULL);
#ifdef HAVE_PW_GECOS
- if (!Tcl_IsSafe(interp)) {
- struct passwd *pwPtr = getpwuid(getuid()); /* INTL: Native. */
- Tcl_AppendResult(interp, "%%For: ",
- (pwPtr != NULL) ? pwPtr->pw_gecos : "Unknown", "\n",
- (char *) NULL);
- endpwent();
- }
+ if (!Tcl_IsSafe(interp)) {
+ struct passwd *pwPtr = getpwuid(getuid()); /* INTL: Native. */
+
+ Tcl_AppendResult(interp, "%%For: ",
+ (pwPtr != NULL) ? pwPtr->pw_gecos : "Unknown", "\n", NULL);
+ endpwent();
+ }
#endif /* HAVE_PW_GECOS */
- Tcl_AppendResult(interp, "%%Title: Window ",
- Tk_PathName(tkwin), "\n", (char *) NULL);
- time(&now);
- Tcl_AppendResult(interp, "%%CreationDate: ",
- ctime(&now), (char *) NULL); /* INTL: Native. */
- if (!psInfo.rotate) {
- sprintf(string, "%d %d %d %d",
- (int) (psInfo.pageX + psInfo.scale*deltaX),
- (int) (psInfo.pageY + psInfo.scale*deltaY),
- (int) (psInfo.pageX + psInfo.scale*(deltaX + psInfo.width)
- + 1.0),
- (int) (psInfo.pageY + psInfo.scale*(deltaY + psInfo.height)
- + 1.0));
- } else {
- sprintf(string, "%d %d %d %d",
- (int) (psInfo.pageX - psInfo.scale*(deltaY + psInfo.height)),
- (int) (psInfo.pageY + psInfo.scale*deltaX),
- (int) (psInfo.pageX - psInfo.scale*deltaY + 1.0),
- (int) (psInfo.pageY + psInfo.scale*(deltaX + psInfo.width)
- + 1.0));
- }
- Tcl_AppendResult(interp, "%%BoundingBox: ", string,
- "\n", (char *) NULL);
- Tcl_AppendResult(interp, "%%Pages: 1\n",
- "%%DocumentData: Clean7Bit\n", (char *) NULL);
- Tcl_AppendResult(interp, "%%Orientation: ",
- psInfo.rotate ? "Landscape\n" : "Portrait\n", (char *) NULL);
- p = "%%DocumentNeededResources: font ";
- for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_AppendResult(interp, p,
- Tcl_GetHashKey(&psInfo.fontTable, hPtr),
- "\n", (char *) NULL);
- p = "%%+ font ";
- }
- Tcl_AppendResult(interp, "%%EndComments\n\n", (char *) NULL);
+ Tcl_AppendResult(interp, "%%Title: Window ", Tk_PathName(tkwin), "\n",
+ NULL);
+ time(&now);
+ Tcl_AppendResult(interp, "%%CreationDate: ",
+ ctime(&now), NULL); /* INTL: Native. */
+ if (!psInfo.rotate) {
+ sprintf(string, "%d %d %d %d",
+ (int) (psInfo.pageX + psInfo.scale*deltaX),
+ (int) (psInfo.pageY + psInfo.scale*deltaY),
+ (int) (psInfo.pageX + psInfo.scale*(deltaX + psInfo.width)
+ + 1.0),
+ (int) (psInfo.pageY + psInfo.scale*(deltaY + psInfo.height)
+ + 1.0));
+ } else {
+ sprintf(string, "%d %d %d %d",
+ (int) (psInfo.pageX - psInfo.scale*(deltaY+psInfo.height)),
+ (int) (psInfo.pageY + psInfo.scale*deltaX),
+ (int) (psInfo.pageX - psInfo.scale*deltaY + 1.0),
+ (int) (psInfo.pageY + psInfo.scale*(deltaX + psInfo.width)
+ + 1.0));
+ }
+ Tcl_AppendResult(interp, "%%BoundingBox: ", string, "\n", NULL);
+ Tcl_AppendResult(interp, "%%Pages: 1\n",
+ "%%DocumentData: Clean7Bit\n", NULL);
+ Tcl_AppendResult(interp, "%%Orientation: ",
+ psInfo.rotate ? "Landscape\n" : "Portrait\n", NULL);
+ p = "%%DocumentNeededResources: font ";
+ for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search);
+ hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_AppendResult(interp, p,
+ Tcl_GetHashKey(&psInfo.fontTable, hPtr), "\n", NULL);
+ p = "%%+ font ";
+ }
+ Tcl_AppendResult(interp, "%%EndComments\n\n", NULL);
- /*
- * Insert the prolog
- */
- Tcl_AppendResult(interp, Tcl_GetVar(interp,"::tk::ps_preamable",
- TCL_GLOBAL_ONLY), (char *) NULL);
+ /*
+ * Insert the prolog
+ */
- if (psInfo.chan != NULL) {
- Tcl_Write(psInfo.chan, Tcl_GetStringResult(interp), -1);
- Tcl_ResetResult(canvasPtr->interp);
- }
+ Tcl_AppendResult(interp, Tcl_GetVar(interp,"::tk::ps_preamable",
+ TCL_GLOBAL_ONLY), NULL);
- /*
- *-----------------------------------------------------------
- * Document setup: set the color level and include fonts.
- *-----------------------------------------------------------
- */
+ if (psInfo.chan != NULL) {
+ Tcl_Write(psInfo.chan, Tcl_GetStringResult(interp), -1);
+ Tcl_ResetResult(canvasPtr->interp);
+ }
- sprintf(string, "/CL %d def\n", psInfo.colorLevel);
- Tcl_AppendResult(interp, "%%BeginSetup\n", string,
- (char *) NULL);
- for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_AppendResult(interp, "%%IncludeResource: font ",
- Tcl_GetHashKey(&psInfo.fontTable, hPtr), "\n", (char *) NULL);
- }
- Tcl_AppendResult(interp, "%%EndSetup\n\n", (char *) NULL);
+ /*
+ * Document setup: set the color level and include fonts.
+ */
- /*
- *-----------------------------------------------------------
- * Page setup: move to page positioning point, rotate if
- * needed, set scale factor, offset for proper anchor position,
- * and set clip region.
- *-----------------------------------------------------------
- */
+ sprintf(string, "/CL %d def\n", psInfo.colorLevel);
+ Tcl_AppendResult(interp, "%%BeginSetup\n", string, NULL);
+ for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search);
+ hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_AppendResult(interp, "%%IncludeResource: font ",
+ Tcl_GetHashKey(&psInfo.fontTable, hPtr), "\n", NULL);
+ }
+ Tcl_AppendResult(interp, "%%EndSetup\n\n", NULL);
- Tcl_AppendResult(interp, "%%Page: 1 1\n", "save\n",
- (char *) NULL);
- sprintf(string, "%.1f %.1f translate\n", psInfo.pageX, psInfo.pageY);
- Tcl_AppendResult(interp, string, (char *) NULL);
- if (psInfo.rotate) {
- Tcl_AppendResult(interp, "90 rotate\n", (char *) NULL);
- }
- sprintf(string, "%.4g %.4g scale\n", psInfo.scale, psInfo.scale);
- Tcl_AppendResult(interp, string, (char *) NULL);
- sprintf(string, "%d %d translate\n", deltaX - psInfo.x, deltaY);
- Tcl_AppendResult(interp, string, (char *) NULL);
- sprintf(string, "%d %.15g moveto %d %.15g lineto %d %.15g lineto %d %.15g",
- psInfo.x,
- Tk_PostscriptY((double) psInfo.y, (Tk_PostscriptInfo) &psInfo),
- psInfo.x2,
- Tk_PostscriptY((double) psInfo.y, (Tk_PostscriptInfo) &psInfo),
- psInfo.x2,
- Tk_PostscriptY((double) psInfo.y2, (Tk_PostscriptInfo) &psInfo),
- psInfo.x,
- Tk_PostscriptY((double) psInfo.y2, (Tk_PostscriptInfo) &psInfo));
- Tcl_AppendResult(interp, string,
- " lineto closepath clip newpath\n", (char *) NULL);
+ /*
+ * Page setup: move to page positioning point, rotate if needed, set
+ * scale factor, offset for proper anchor position, and set clip
+ * region.
+ */
+
+ Tcl_AppendResult(interp, "%%Page: 1 1\n", "save\n", NULL);
+ sprintf(string, "%.1f %.1f translate\n", psInfo.pageX, psInfo.pageY);
+ Tcl_AppendResult(interp, string, NULL);
+ if (psInfo.rotate) {
+ Tcl_AppendResult(interp, "90 rotate\n", NULL);
+ }
+ sprintf(string, "%.4g %.4g scale\n", psInfo.scale, psInfo.scale);
+ Tcl_AppendResult(interp, string, NULL);
+ sprintf(string, "%d %d translate\n", deltaX - psInfo.x, deltaY);
+ Tcl_AppendResult(interp, string, NULL);
+ sprintf(string,
+ "%d %.15g moveto %d %.15g lineto %d %.15g lineto %d %.15g",
+ psInfo.x, Tk_PostscriptY((double)psInfo.y,
+ (Tk_PostscriptInfo)psInfoPtr),
+ psInfo.x2, Tk_PostscriptY((double)psInfo.y,
+ (Tk_PostscriptInfo)psInfoPtr),
+ psInfo.x2, Tk_PostscriptY((double)psInfo.y2,
+ (Tk_PostscriptInfo)psInfoPtr),
+ psInfo.x, Tk_PostscriptY((double)psInfo.y2,
+ (Tk_PostscriptInfo)psInfoPtr));
+ Tcl_AppendResult(interp, string,
+ " lineto closepath clip newpath\n", NULL);
}
if (psInfo.chan != NULL) {
Tcl_Write(psInfo.chan, Tcl_GetStringResult(interp), -1);
@@ -531,10 +510,8 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
}
/*
- *---------------------------------------------------------------------
* Iterate through all the items, having each relevant one draw itself.
* Quit if any of the items returns an error.
- *---------------------------------------------------------------------
*/
result = TCL_OK;
@@ -550,7 +527,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
if (itemPtr->state == TK_STATE_HIDDEN) {
continue;
}
- Tcl_AppendResult(interp, "gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "gsave\n", NULL);
result = (*itemPtr->typePtr->postscriptProc)(interp,
(Tk_Canvas) canvasPtr, itemPtr, 0);
if (result != TCL_OK) {
@@ -561,7 +538,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
Tcl_AddErrorInfo(interp, msg);
goto cleanup;
}
- Tcl_AppendResult(interp, "grestore\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore\n", NULL);
if (psInfo.chan != NULL) {
Tcl_Write(psInfo.chan, Tcl_GetStringResult(interp), -1);
Tcl_ResetResult(interp);
@@ -569,15 +546,13 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
}
/*
- *---------------------------------------------------------------------
- * Output page-end information, such as commands to print the page
- * and document trailer stuff.
- *---------------------------------------------------------------------
+ * Output page-end information, such as commands to print the page and
+ * document trailer stuff.
*/
if (psInfo.prolog) {
- Tcl_AppendResult(interp, "restore showpage\n\n",
- "%%Trailer\nend\n%%EOF\n", (char *) NULL);
+ Tcl_AppendResult(interp, "restore showpage\n\n",
+ "%%Trailer\nend\n%%EOF\n", NULL);
}
if (psInfo.chan != NULL) {
Tcl_Write(psInfo.chan, Tcl_GetStringResult(interp), -1);
@@ -588,7 +563,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
* Clean up psInfo to release malloc'ed stuff.
*/
- cleanup:
+ cleanup:
if (psInfo.pageXString != NULL) {
ckfree(psInfo.pageXString);
}
@@ -629,16 +604,15 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
*
* Tk_PostscriptColor --
*
- * This procedure is called by individual canvas items when
- * they want to set a color value for output. Given information
- * about an X color, this procedure will generate Postscript
- * commands to set up an appropriate color in Postscript.
+ * This function is called by individual canvas items when they want to
+ * set a color value for output. Given information about an X color, this
+ * function will generate Postscript commands to set up an appropriate
+ * color in Postscript.
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in the interp's result.
- * If no error occurs, then additional Postscript will be
- * appended to the interp's result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in the interp's result. If no error occurs, then
+ * additional Postscript will be appended to the interp's result.
*
* Side effects:
* None.
@@ -647,10 +621,10 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
*/
int
-Tk_PostscriptColor(interp, psInfo, colorPtr)
- Tcl_Interp *interp;
- Tk_PostscriptInfo psInfo; /* Postscript info. */
- XColor *colorPtr; /* Information about color. */
+Tk_PostscriptColor(
+ Tcl_Interp *interp,
+ Tk_PostscriptInfo psInfo, /* Postscript info. */
+ XColor *colorPtr) /* Information about color. */
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
int tmp;
@@ -662,9 +636,8 @@ Tk_PostscriptColor(interp, psInfo, colorPtr)
}
/*
- * If there is a color map defined, then look up the color's name
- * in the map and use the Postscript commands found there, if there
- * are any.
+ * If there is a color map defined, then look up the color's name in the
+ * map and use the Postscript commands found there, if there are any.
*/
if (psInfoPtr->colorVar != NULL) {
@@ -673,22 +646,21 @@ Tk_PostscriptColor(interp, psInfo, colorPtr)
cmdString = Tcl_GetVar2(interp, psInfoPtr->colorVar,
Tk_NameOfColor(colorPtr), 0);
if (cmdString != NULL) {
- Tcl_AppendResult(interp, cmdString, "\n", (char *) NULL);
+ Tcl_AppendResult(interp, cmdString, "\n", NULL);
return TCL_OK;
}
}
/*
- * No color map entry for this color. Grab the color's intensities
- * and output Postscript commands for them. Special note: X uses
- * a range of 0-65535 for intensities, but most displays only use
- * a range of 0-255, which maps to (0, 256, 512, ... 65280) in the
- * X scale. This means that there's no way to get perfect white,
- * since the highest intensity is only 65280 out of 65535. To
- * work around this problem, rescale the X intensity to a 0-255
- * scale and use that as the basis for the Postscript colors. This
- * scheme still won't work if the display only uses 4 bits per color,
- * but most diplays use at least 8 bits.
+ * No color map entry for this color. Grab the color's intensities and
+ * output Postscript commands for them. Special note: X uses a range of
+ * 0-65535 for intensities, but most displays only use a range of 0-255,
+ * which maps to (0, 256, 512, ... 65280) in the X scale. This means that
+ * there's no way to get perfect white, since the highest intensity is
+ * only 65280 out of 65535. To work around this problem, rescale the X
+ * intensity to a 0-255 scale and use that as the basis for the Postscript
+ * colors. This scheme still won't work if the display only uses 4 bits
+ * per color, but most diplays use at least 8 bits.
*/
tmp = colorPtr->red;
@@ -699,7 +671,7 @@ Tk_PostscriptColor(interp, psInfo, colorPtr)
blue = ((double) (tmp >> 8))/255.0;
sprintf(string, "%.3f %.3f %.3f setrgbcolor AdjustColor\n",
red, green, blue);
- Tcl_AppendResult(interp, string, (char *) NULL);
+ Tcl_AppendResult(interp, string, NULL);
return TCL_OK;
}
@@ -708,88 +680,89 @@ Tk_PostscriptColor(interp, psInfo, colorPtr)
*
* Tk_PostscriptFont --
*
- * This procedure is called by individual canvas items when
- * they want to output text. Given information about an X
- * font, this procedure will generate Postscript commands
- * to set up an appropriate font in Postscript.
+ * This function is called by individual canvas items when they want to
+ * output text. Given information about an X font, this function will
+ * generate Postscript commands to set up an appropriate font in
+ * Postscript.
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in the interp's result.
- * If no error occurs, then additional Postscript will be
- * appended to the interp's result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in the interp's result. If no error occurs, then
+ * additional Postscript will be appended to the interp's result.
*
* Side effects:
- * The Postscript font name is entered into psInfoPtr->fontTable
- * if it wasn't already there.
+ * The Postscript font name is entered into psInfoPtr->fontTable if it
+ * wasn't already there.
*
*--------------------------------------------------------------
*/
int
-Tk_PostscriptFont(interp, psInfo, tkfont)
- Tcl_Interp *interp;
- Tk_PostscriptInfo psInfo; /* Postscript Info. */
- Tk_Font tkfont; /* Information about font in which text
- * is to be printed. */
+Tk_PostscriptFont(
+ Tcl_Interp *interp,
+ Tk_PostscriptInfo psInfo, /* Postscript Info. */
+ Tk_Font tkfont) /* Information about font in which text is to
+ * be printed. */
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
- char *end;
char pointString[TCL_INTEGER_SPACE];
Tcl_DString ds;
int i, points;
/*
- * First, look up the font's name in the font map, if there is one.
- * If there is an entry for this font, it consists of a list
- * containing font name and size. Use this information.
+ * First, look up the font's name in the font map, if there is one. If
+ * there is an entry for this font, it consists of a list containing font
+ * name and size. Use this information.
*/
- Tcl_DStringInit(&ds);
-
if (psInfoPtr->fontVar != NULL) {
- CONST char *list;
- int argc;
+ CONST char *name = Tk_NameOfFont(tkfont);
+ Tcl_Obj **objv;
+ int objc;
double size;
- CONST char **argv;
- CONST char *name;
+ Tcl_Obj *list = Tcl_GetVar2Ex(interp, psInfoPtr->fontVar, name, 0);
- name = Tk_NameOfFont(tkfont);
- list = Tcl_GetVar2(interp, psInfoPtr->fontVar, name, 0);
if (list != NULL) {
- if (Tcl_SplitList(interp, list, &argc, &argv) != TCL_OK) {
- badMapEntry:
+ CONST char *fontname;
+
+ if (Tcl_ListObjGetElements(interp, list, &objc, &objv) != TCL_OK
+ || objc != 2
+ || Tcl_GetString(objv[0])[0]=='\0'
+ || Tcl_GetDoubleFromObj(interp, objv[1], &size) != TCL_OK
+ || size <= 0) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad font map entry for \"", name,
- "\": \"", list, "\"", (char *) NULL);
+ "\": \"", Tcl_GetString(list), "\"", NULL);
return TCL_ERROR;
}
- if (argc != 2) {
- goto badMapEntry;
- }
- size = strtod(argv[1], &end);
- if ((size <= 0) || (*end != 0)) {
- goto badMapEntry;
- }
- Tcl_DStringAppend(&ds, argv[0], -1);
- points = (int) size;
-
- ckfree((char *) argv);
- goto findfont;
+ fontname = Tcl_GetString(objv[0]);
+ sprintf(pointString, "%d", (int)size);
+
+ Tcl_AppendResult(interp, "/", fontname, " findfont ",
+ pointString, " scalefont ", NULL);
+ if (strncasecmp(fontname, "Symbol", 7) != 0) {
+ Tcl_AppendResult(interp, "ISOEncode ", NULL);
+ }
+ Tcl_AppendResult(interp, "setfont\n", NULL);
+ Tcl_CreateHashEntry(&psInfoPtr->fontTable, fontname, &i);
+ return TCL_OK;
}
- }
+ }
- points = Tk_PostscriptFontName(tkfont, &ds);
+ /*
+ * Nothing in the font map, so fall back to the old guessing technique.
+ */
- findfont:
- sprintf(pointString, "%d", points);
+ Tcl_DStringInit(&ds);
+ points = Tk_PostscriptFontName(tkfont, &ds);
+ sprintf(pointString, "%d", TkFontGetPoints(psInfoPtr->tkwin, points));
Tcl_AppendResult(interp, "/", Tcl_DStringValue(&ds), " findfont ",
- pointString, " scalefont ", (char *) NULL);
+ pointString, " scalefont ", NULL);
if (strncasecmp(Tcl_DStringValue(&ds), "Symbol", 7) != 0) {
- Tcl_AppendResult(interp, "ISOEncode ", (char *) NULL);
+ Tcl_AppendResult(interp, "ISOEncode ", NULL);
}
- Tcl_AppendResult(interp, "setfont\n", (char *) NULL);
+ Tcl_AppendResult(interp, "setfont\n", NULL);
Tcl_CreateHashEntry(&psInfoPtr->fontTable, Tcl_DStringValue(&ds), &i);
Tcl_DStringFree(&ds);
@@ -801,16 +774,14 @@ Tk_PostscriptFont(interp, psInfo, tkfont)
*
* Tk_PostscriptBitmap --
*
- * This procedure is called to output the contents of a
- * sub-region of a bitmap in proper image data format for
- * Postscript (i.e. data between angle brackets, one bit
- * per pixel).
+ * This function is called to output the contents of a sub-region of a
+ * bitmap in proper image data format for Postscript (i.e. data between
+ * angle brackets, one bit per pixel).
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in the interp's result.
- * If no error occurs, then additional Postscript will be
- * appended to the interp's result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in the interp's result. If no error occurs, then
+ * additional Postscript will be appended to the interp's result.
*
* Side effects:
* None.
@@ -819,16 +790,14 @@ Tk_PostscriptFont(interp, psInfo, tkfont)
*/
int
-Tk_PostscriptBitmap(interp, tkwin, psInfo, bitmap, startX, startY, width,
- height)
- Tcl_Interp *interp;
- Tk_Window tkwin;
- Tk_PostscriptInfo psInfo; /* Postscript info. */
- Pixmap bitmap; /* Bitmap for which to generate
- * Postscript. */
- int startX, startY; /* Coordinates of upper-left corner
- * of rectangular region to output. */
- int width, height; /* Height of rectangular region. */
+Tk_PostscriptBitmap(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tk_PostscriptInfo psInfo, /* Postscript info. */
+ Pixmap bitmap, /* Bitmap for which to generate Postscript. */
+ int startX, int startY, /* Coordinates of upper-left corner of
+ * rectangular region to output. */
+ int width, int height) /* Height of rectangular region. */
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
XImage *imagePtr;
@@ -845,10 +814,10 @@ Tk_PostscriptBitmap(interp, tkwin, psInfo, bitmap, startX, startY, width,
/*
* The following call should probably be a call to Tk_SizeOfBitmap
- * instead, but it seems that we are occasionally invoked by custom
- * item types that create their own bitmaps without registering them
- * with Tk. XGetGeometry is a bit slower than Tk_SizeOfBitmap, but
- * it shouldn't matter here.
+ * instead, but it seems that we are occasionally invoked by custom item
+ * types that create their own bitmaps without registering them with Tk.
+ * XGetGeometry is a bit slower than Tk_SizeOfBitmap, but it shouldn't
+ * matter here.
*/
XGetGeometry(Tk_Display(tkwin), bitmap, &dummyRoot,
@@ -856,7 +825,7 @@ Tk_PostscriptBitmap(interp, tkwin, psInfo, bitmap, startX, startY, width,
(unsigned int *) &totalHeight, &dummyBorderwidth, &dummyDepth);
imagePtr = XGetImage(Tk_Display(tkwin), bitmap, 0, 0,
totalWidth, totalHeight, 1, XYPixmap);
- Tcl_AppendResult(interp, "<", (char *) NULL);
+ Tcl_AppendResult(interp, "<", NULL);
mask = 0x80;
value = 0;
charsInLine = 0;
@@ -870,25 +839,25 @@ Tk_PostscriptBitmap(interp, tkwin, psInfo, bitmap, startX, startY, width,
mask >>= 1;
if (mask == 0) {
sprintf(string, "%02x", value);
- Tcl_AppendResult(interp, string, (char *) NULL);
+ Tcl_AppendResult(interp, string, NULL);
mask = 0x80;
value = 0;
charsInLine += 2;
if (charsInLine >= 60) {
- Tcl_AppendResult(interp, "\n", (char *) NULL);
+ Tcl_AppendResult(interp, "\n", NULL);
charsInLine = 0;
}
}
}
if (mask != 0x80) {
sprintf(string, "%02x", value);
- Tcl_AppendResult(interp, string, (char *) NULL);
+ Tcl_AppendResult(interp, string, NULL);
mask = 0x80;
value = 0;
charsInLine += 2;
}
}
- Tcl_AppendResult(interp, ">", (char *) NULL);
+ Tcl_AppendResult(interp, ">", NULL);
XDestroyImage(imagePtr);
return TCL_OK;
}
@@ -898,18 +867,16 @@ Tk_PostscriptBitmap(interp, tkwin, psInfo, bitmap, startX, startY, width,
*
* Tk_PostscriptStipple --
*
- * This procedure is called by individual canvas items when
- * they have created a path that they'd like to be filled with
- * a stipple pattern. Given information about an X bitmap,
- * this procedure will generate Postscript commands to fill
- * the current clip region using a stipple pattern defined by the
- * bitmap.
+ * This function is called by individual canvas items when they have
+ * created a path that they'd like to be filled with a stipple pattern.
+ * Given information about an X bitmap, this function will generate
+ * Postscript commands to fill the current clip region using a stipple
+ * pattern defined by the bitmap.
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in the interp's result.
- * If no error occurs, then additional Postscript will be
- * appended to the interp's result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in the interp's result. If no error occurs, then
+ * additional Postscript will be appended to the interp's result.
*
* Side effects:
* None.
@@ -918,12 +885,12 @@ Tk_PostscriptBitmap(interp, tkwin, psInfo, bitmap, startX, startY, width,
*/
int
-Tk_PostscriptStipple(interp, tkwin, psInfo, bitmap)
- Tcl_Interp *interp;
- Tk_Window tkwin;
- Tk_PostscriptInfo psInfo; /* Interpreter for returning Postscript
- * or error message. */
- Pixmap bitmap; /* Bitmap to use for stippling. */
+Tk_PostscriptStipple(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tk_PostscriptInfo psInfo, /* Interpreter for returning Postscript or
+ * error message. */
+ Pixmap bitmap) /* Bitmap to use for stippling. */
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
int width, height;
@@ -938,22 +905,22 @@ Tk_PostscriptStipple(interp, tkwin, psInfo, bitmap)
/*
* The following call should probably be a call to Tk_SizeOfBitmap
- * instead, but it seems that we are occasionally invoked by custom
- * item types that create their own bitmaps without registering them
- * with Tk. XGetGeometry is a bit slower than Tk_SizeOfBitmap, but
- * it shouldn't matter here.
+ * instead, but it seems that we are occasionally invoked by custom item
+ * types that create their own bitmaps without registering them with Tk.
+ * XGetGeometry is a bit slower than Tk_SizeOfBitmap, but it shouldn't
+ * matter here.
*/
XGetGeometry(Tk_Display(tkwin), bitmap, &dummyRoot,
(int *) &dummyX, (int *) &dummyY, (unsigned *) &width,
(unsigned *) &height, &dummyBorderwidth, &dummyDepth);
sprintf(string, "%d %d ", width, height);
- Tcl_AppendResult(interp, string, (char *) NULL);
+ Tcl_AppendResult(interp, string, NULL);
if (Tk_PostscriptBitmap(interp, tkwin, psInfo, bitmap, 0, 0,
width, height) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_AppendResult(interp, " StippleFill\n", (char *) NULL);
+ Tcl_AppendResult(interp, " StippleFill\n", NULL);
return TCL_OK;
}
@@ -962,12 +929,13 @@ Tk_PostscriptStipple(interp, tkwin, psInfo, bitmap)
*
* Tk_PostscriptY --
*
- * Given a y-coordinate in local coordinates, this procedure
- * returns a y-coordinate to use for Postscript output.
+ * Given a y-coordinate in local coordinates, this function returns a
+ * y-coordinate to use for Postscript output. Required because canvases
+ * have their origin in the top-left, but postscript pages have their
+ * origin in the bottom left.
*
* Results:
- * Returns the Postscript coordinate that corresponds to
- * "y".
+ * Returns the Postscript coordinate that corresponds to "y".
*
* Side effects:
* None.
@@ -976,9 +944,9 @@ Tk_PostscriptStipple(interp, tkwin, psInfo, bitmap)
*/
double
-Tk_PostscriptY(y, psInfo)
- double y; /* Y-coordinate in canvas coords. */
- Tk_PostscriptInfo psInfo; /* Postscript info */
+Tk_PostscriptY(
+ double y, /* Y-coordinate in canvas coords. */
+ Tk_PostscriptInfo psInfo) /* Postscript info */
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
@@ -990,8 +958,8 @@ Tk_PostscriptY(y, psInfo)
*
* Tk_PostscriptPath --
*
- * Given an array of points for a path, generate Postscript
- * commands to create the path.
+ * Given an array of points for a path, generate Postscript commands to
+ * create the path.
*
* Results:
* Postscript commands get appended to what's in the interp's result.
@@ -1003,14 +971,13 @@ Tk_PostscriptY(y, psInfo)
*/
void
-Tk_PostscriptPath(interp, psInfo, coordPtr, numPoints)
- Tcl_Interp *interp;
- Tk_PostscriptInfo psInfo; /* Canvas on whose behalf Postscript
- * is being generated. */
- double *coordPtr; /* Pointer to first in array of
- * 2*numPoints coordinates giving
- * points for path. */
- int numPoints; /* Number of points at *coordPtr. */
+Tk_PostscriptPath(
+ Tcl_Interp *interp,
+ Tk_PostscriptInfo psInfo, /* Canvas on whose behalf Postscript is being
+ * generated. */
+ double *coordPtr, /* Pointer to first in array of 2*numPoints
+ * coordinates giving points for path. */
+ int numPoints) /* Number of points at *coordPtr. */
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
char buffer[200];
@@ -1020,12 +987,12 @@ Tk_PostscriptPath(interp, psInfo, coordPtr, numPoints)
}
sprintf(buffer, "%.15g %.15g moveto\n", coordPtr[0],
Tk_PostscriptY(coordPtr[1], psInfo));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
for (numPoints--, coordPtr += 2; numPoints > 0;
numPoints--, coordPtr += 2) {
sprintf(buffer, "%.15g %.15g lineto\n", coordPtr[0],
Tk_PostscriptY(coordPtr[1], psInfo));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
}
}
@@ -1034,15 +1001,14 @@ Tk_PostscriptPath(interp, psInfo, coordPtr, numPoints)
*
* GetPostscriptPoints --
*
- * Given a string, returns the number of Postscript points
- * corresponding to that string.
+ * Given a string, returns the number of Postscript points corresponding
+ * to that string.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * screen distance is stored at *doublePtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the screen distance is stored
+ * at *doublePtr; otherwise TCL_ERROR is returned and an error message is
+ * left in the interp's result.
*
* Side effects:
* None.
@@ -1051,44 +1017,41 @@ Tk_PostscriptPath(interp, psInfo, coordPtr, numPoints)
*/
static int
-GetPostscriptPoints(interp, string, doublePtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- char *string; /* String describing a screen distance. */
- double *doublePtr; /* Place to store converted result. */
+GetPostscriptPoints(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ char *string, /* String describing a screen distance. */
+ double *doublePtr) /* Place to store converted result. */
{
char *end;
double d;
d = strtod(string, &end);
if (end == string) {
- error:
- Tcl_AppendResult(interp, "bad distance \"", string,
- "\"", (char *) NULL);
- return TCL_ERROR;
+ goto error;
}
while ((*end != '\0') && isspace(UCHAR(*end))) {
end++;
}
switch (*end) {
- case 'c':
- d *= 72.0/2.54;
- end++;
- break;
- case 'i':
- d *= 72.0;
- end++;
- break;
- case 'm':
- d *= 72.0/25.4;
- end++;
- break;
- case 0:
- break;
- case 'p':
- end++;
- break;
- default:
- goto error;
+ case 'c':
+ d *= 72.0/2.54;
+ end++;
+ break;
+ case 'i':
+ d *= 72.0;
+ end++;
+ break;
+ case 'm':
+ d *= 72.0/25.4;
+ end++;
+ break;
+ case 0:
+ break;
+ case 'p':
+ end++;
+ break;
+ default:
+ goto error;
}
while ((*end != '\0') && isspace(UCHAR(*end))) {
end++;
@@ -1098,34 +1061,37 @@ GetPostscriptPoints(interp, string, doublePtr)
}
*doublePtr = d;
return TCL_OK;
-}
+ error:
+ Tcl_AppendResult(interp, "bad distance \"", string, "\"", NULL);
+ return TCL_ERROR;
+}
+
/*
*--------------------------------------------------------------
*
* TkImageGetColor --
*
- * This procedure converts a pixel value to three floating
- * point numbers, representing the amount of red, green, and
- * blue in that pixel on the screen. It makes use of colormap
- * data passed as an argument, and should work for all Visual
- * types.
+ * This function converts a pixel value to three floating point numbers,
+ * representing the amount of red, green, and blue in that pixel on the
+ * screen. It makes use of colormap data passed as an argument, and
+ * should work for all Visual types.
*
- * This implementation is bogus on Windows because the colormap
- * data is never filled in. Instead all postscript generated
- * data coming through here is expected to be RGB color data.
- * To handle lower bit-depth images properly, XQueryColors
- * must be implemented for Windows.
+ * This implementation is bogus on Windows because the colormap data is
+ * never filled in. Instead all postscript generated data coming through
+ * here is expected to be RGB color data. To handle lower bit-depth
+ * images properly, XQueryColors must be implemented for Windows.
*
* Results:
- * Returns red, green, and blue color values in the range
- * 0 to 1. There are no error returns.
+ * Returns red, green, and blue color values in the range 0 to 1. There
+ * are no error returns.
*
* Side effects:
* None.
*
*--------------------------------------------------------------
*/
+
#ifdef WIN32
#include <windows.h>
@@ -1134,35 +1100,41 @@ GetPostscriptPoints(interp, string, doublePtr)
#define GetRValue(rgb) ((BYTE)(rgb))
#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8))
#define GetBValue(rgb) ((BYTE)((rgb)>>16))
-*/
-#else
+ */
+
+#else /* !WIN32 */
+
#define GetRValue(rgb) ((rgb & cdata->red_mask) >> cdata->red_shift)
#define GetGValue(rgb) ((rgb & cdata->green_mask) >> cdata->green_shift)
#define GetBValue(rgb) ((rgb & cdata->blue_mask) >> cdata->blue_shift)
-#endif
+
+#endif /* WIN32 */
#if defined(WIN32) || defined(MAC_OSX_TK)
static void
-TkImageGetColor(cdata, pixel, red, green, blue)
- TkColormapData *cdata; /* Colormap data */
- unsigned long pixel; /* Pixel value to look up */
- double *red, *green, *blue; /* Color data to return */
+TkImageGetColor(
+ TkColormapData *cdata, /* Colormap data */
+ unsigned long pixel, /* Pixel value to look up */
+ double *red, double *green, double *blue)
+ /* Color data to return */
{
*red = (double) GetRValue(pixel) / 255.0;
*green = (double) GetGValue(pixel) / 255.0;
*blue = (double) GetBValue(pixel) / 255.0;
}
-#else
+#else /* ! (WIN32 || MAC_OSX_TK) */
static void
-TkImageGetColor(cdata, pixel, red, green, blue)
- TkColormapData *cdata; /* Colormap data */
- unsigned long pixel; /* Pixel value to look up */
- double *red, *green, *blue; /* Color data to return */
+TkImageGetColor(
+ TkColormapData *cdata, /* Colormap data */
+ unsigned long pixel, /* Pixel value to look up */
+ double *red, double *green, double *blue)
+ /* Color data to return */
{
if (cdata->separated) {
int r = GetRValue(pixel);
int g = GetGValue(pixel);
int b = GetBValue(pixel);
+
*red = cdata->colors[r].red / 65535.0;
*green = cdata->colors[g].green / 65535.0;
*blue = cdata->colors[b].blue / 65535.0;
@@ -1172,24 +1144,22 @@ TkImageGetColor(cdata, pixel, red, green, blue)
*blue = cdata->colors[pixel].blue / 65535.0;
}
}
-#endif
-
+#endif /* WIN32 || MAC_OSX_TK */
+
/*
*--------------------------------------------------------------
*
* TkPostscriptImage --
*
- * This procedure is called to output the contents of an
- * image in Postscript, using a format appropriate for the
- * current color mode (i.e. one bit per pixel in monochrome,
- * one byte per pixel in gray, and three bytes per pixel in
- * color).
+ * This function is called to output the contents of an image in
+ * Postscript, using a format appropriate for the current color mode
+ * (i.e. one bit per pixel in monochrome, one byte per pixel in gray, and
+ * three bytes per pixel in color).
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
- * If no error occurs, then additional Postscript will be
- * appended to interp->result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in interp->result. If no error occurs, then
+ * additional Postscript will be appended to interp->result.
*
* Side effects:
* None.
@@ -1198,13 +1168,13 @@ TkImageGetColor(cdata, pixel, red, green, blue)
*/
int
-TkPostscriptImage(interp, tkwin, psInfo, ximage, x, y, width, height)
- Tcl_Interp *interp;
- Tk_Window tkwin;
- Tk_PostscriptInfo psInfo; /* postscript info */
- XImage *ximage; /* Image to draw */
- int x, y; /* First pixel to output */
- int width, height; /* Width and height of area */
+TkPostscriptImage(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tk_PostscriptInfo psInfo, /* postscript info */
+ XImage *ximage, /* Image to draw */
+ int x, int y, /* First pixel to output */
+ int width, int height) /* Width and height of area */
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
char buffer[256];
@@ -1225,9 +1195,8 @@ TkPostscriptImage(interp, tkwin, psInfo, ximage, x, y, width, height)
visual = Tk_Visual(tkwin);
/*
- * Obtain information about the colormap, ie the mapping between
- * pixel values and RGB values. The code below should work
- * for all Visual types.
+ * Obtain information about the colormap, ie the mapping between pixel
+ * values and RGB values. The code below should work for all Visual types.
*/
ncolors = visual->map_entries;
@@ -1242,33 +1211,42 @@ TkPostscriptImage(interp, tkwin, psInfo, ximage, x, y, width, height)
cdata.red_shift = 0;
cdata.green_shift = 0;
cdata.blue_shift = 0;
- while ((0x0001 & (cdata.red_mask >> cdata.red_shift)) == 0)
+
+ while ((0x0001 & (cdata.red_mask >> cdata.red_shift)) == 0) {
cdata.red_shift ++;
- while ((0x0001 & (cdata.green_mask >> cdata.green_shift)) == 0)
+ }
+ while ((0x0001 & (cdata.green_mask >> cdata.green_shift)) == 0) {
cdata.green_shift ++;
- while ((0x0001 & (cdata.blue_mask >> cdata.blue_shift)) == 0)
+ }
+ while ((0x0001 & (cdata.blue_mask >> cdata.blue_shift)) == 0) {
cdata.blue_shift ++;
- for (i = 0; i < ncolors; i ++)
+ }
+
+ for (i = 0; i < ncolors; i ++) {
cdata.colors[i].pixel =
- ((i << cdata.red_shift) & cdata.red_mask) |
- ((i << cdata.green_shift) & cdata.green_mask) |
- ((i << cdata.blue_shift) & cdata.blue_mask);
+ ((i << cdata.red_shift) & cdata.red_mask) |
+ ((i << cdata.green_shift) & cdata.green_mask) |
+ ((i << cdata.blue_shift) & cdata.blue_mask);
+ }
} else {
cdata.separated=0;
- for (i = 0; i < ncolors; i ++)
+ for (i = 0; i < ncolors; i ++) {
cdata.colors[i].pixel = i;
+ }
}
- if (visual->class == StaticGray || visual->class == GrayScale)
+
+ if (visual->class == StaticGray || visual->class == GrayScale) {
cdata.color = 0;
- else
+ } else {
cdata.color = 1;
+ }
XQueryColors(Tk_Display(tkwin), cmap, cdata.colors, ncolors);
/*
- * Figure out which color level to use (possibly lower than the
- * one specified by the user). For example, if the user specifies
- * color with monochrome screen, use gray or monochrome mode instead.
+ * Figure out which color level to use (possibly lower than the one
+ * specified by the user). For example, if the user specifies color with
+ * monochrome screen, use gray or monochrome mode instead.
*/
if (!cdata.color && level == 2) {
@@ -1280,15 +1258,15 @@ TkPostscriptImage(interp, tkwin, psInfo, ximage, x, y, width, height)
}
/*
- * Check that at least one row of the image can be represented
- * with a string less than 64 KB long (this is a limit in the
- * Postscript interpreter).
+ * Check that at least one row of the image can be represented with a
+ * string less than 64 KB long (this is a limit in the Postscript
+ * interpreter).
*/
switch (level) {
- case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
- case 1: bytesPerLine = width; maxWidth = 60000; break;
- case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
+ case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
+ case 1: bytesPerLine = width; maxWidth = 60000; break;
+ case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
}
if (bytesPerLine > 60000) {
@@ -1296,7 +1274,7 @@ TkPostscriptImage(interp, tkwin, psInfo, ximage, x, y, width, height)
sprintf(buffer,
"Can't generate Postscript for images more than %d pixels wide",
maxWidth);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
ckfree((char *) cdata.colors);
return TCL_ERROR;
}
@@ -1306,107 +1284,110 @@ TkPostscriptImage(interp, tkwin, psInfo, ximage, x, y, width, height)
for (band = height-1; band >= 0; band -= maxRows) {
int rows = (band >= maxRows) ? maxRows : band + 1;
int lineLen = 0;
+
switch (level) {
- case 0:
- sprintf(buffer, "%d %d 1 matrix {\n<", width, rows);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- break;
- case 1:
- sprintf(buffer, "%d %d 8 matrix {\n<", width, rows);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- break;
- case 2:
- sprintf(buffer, "%d %d 8 matrix {\n<",
- width, rows);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- break;
+ case 0:
+ sprintf(buffer, "%d %d 1 matrix {\n<", width, rows);
+ Tcl_AppendResult(interp, buffer, NULL);
+ break;
+ case 1:
+ sprintf(buffer, "%d %d 8 matrix {\n<", width, rows);
+ Tcl_AppendResult(interp, buffer, NULL);
+ break;
+ case 2:
+ sprintf(buffer, "%d %d 8 matrix {\n<", width, rows);
+ Tcl_AppendResult(interp, buffer, NULL);
+ break;
}
for (yy = band; yy > band - rows; yy--) {
switch (level) {
- case 0: {
- /*
- * Generate data for image in monochrome mode.
- * No attempt at dithering is made--instead, just
- * set a threshold.
- */
- unsigned char mask=0x80;
- unsigned char data=0x00;
- for (xx = x; xx< x+width; xx++) {
- TkImageGetColor(&cdata, XGetPixel(ximage, xx, yy),
- &red, &green, &blue);
- if (0.30 * red + 0.59 * green + 0.11 * blue > 0.5)
- data |= mask;
- mask >>= 1;
- if (mask == 0) {
- sprintf(buffer, "%02X", data);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- lineLen += 2;
- if (lineLen > 60) {
- lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
- }
- mask=0x80;
- data=0x00;
- }
- }
- if ((width % 8) != 0) {
- sprintf(buffer, "%02X", data);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- mask=0x80;
- data=0x00;
+ case 0: {
+ /*
+ * Generate data for image in monochrome mode. No attempt at
+ * dithering is made--instead, just set a threshold.
+ */
+
+ unsigned char mask = 0x80;
+ unsigned char data = 0x00;
+
+ for (xx = x; xx< x+width; xx++) {
+ TkImageGetColor(&cdata, XGetPixel(ximage, xx, yy),
+ &red, &green, &blue);
+ if (0.30 * red + 0.59 * green + 0.11 * blue > 0.5) {
+ data |= mask;
}
- break;
- }
- case 1: {
- /*
- * Generate data in gray mode--in this case, take a
- * weighted sum of the red, green, and blue values.
- */
- for (xx = x; xx < x+width; xx ++) {
- TkImageGetColor(&cdata, XGetPixel(ximage, xx, yy),
- &red, &green, &blue);
- sprintf(buffer, "%02X", (int) floor(0.5 + 255.0 *
- (0.30 * red + 0.59 * green + 0.11 * blue)));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ mask >>= 1;
+ if (mask == 0) {
+ sprintf(buffer, "%02X", data);
+ Tcl_AppendResult(interp, buffer, NULL);
lineLen += 2;
if (lineLen > 60) {
lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
+ Tcl_AppendResult(interp, "\n", NULL);
}
+ mask=0x80;
+ data=0x00;
}
- break;
}
- case 2: {
- /*
- * Finally, color mode. Here, just output the red, green,
- * and blue values directly.
- */
- for (xx = x; xx < x+width; xx++) {
- TkImageGetColor(&cdata, XGetPixel(ximage, xx, yy),
- &red, &green, &blue);
- sprintf(buffer, "%02X%02X%02X",
- (int) floor(0.5 + 255.0 * red),
- (int) floor(0.5 + 255.0 * green),
- (int) floor(0.5 + 255.0 * blue));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- lineLen += 6;
- if (lineLen > 60) {
- lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
- }
+ if ((width % 8) != 0) {
+ sprintf(buffer, "%02X", data);
+ Tcl_AppendResult(interp, buffer, NULL);
+ mask=0x80;
+ data=0x00;
+ }
+ break;
+ }
+ case 1:
+ /*
+ * Generate data in gray mode; in this case, take a weighted
+ * sum of the red, green, and blue values.
+ */
+
+ for (xx = x; xx < x+width; xx ++) {
+ TkImageGetColor(&cdata, XGetPixel(ximage, xx, yy),
+ &red, &green, &blue);
+ sprintf(buffer, "%02X", (int) floor(0.5 + 255.0 *
+ (0.30 * red + 0.59 * green + 0.11 * blue)));
+ Tcl_AppendResult(interp, buffer, NULL);
+ lineLen += 2;
+ if (lineLen > 60) {
+ lineLen = 0;
+ Tcl_AppendResult(interp, "\n", NULL);
+ }
+ }
+ break;
+ case 2:
+ /*
+ * Finally, color mode. Here, just output the red, green, and
+ * blue values directly.
+ */
+
+ for (xx = x; xx < x+width; xx++) {
+ TkImageGetColor(&cdata, XGetPixel(ximage, xx, yy),
+ &red, &green, &blue);
+ sprintf(buffer, "%02X%02X%02X",
+ (int) floor(0.5 + 255.0 * red),
+ (int) floor(0.5 + 255.0 * green),
+ (int) floor(0.5 + 255.0 * blue));
+ Tcl_AppendResult(interp, buffer, NULL);
+ lineLen += 6;
+ if (lineLen > 60) {
+ lineLen = 0;
+ Tcl_AppendResult(interp, "\n", NULL);
}
- break;
}
+ break;
}
}
switch (level) {
- case 0: sprintf(buffer, ">\n} image\n"); break;
- case 1: sprintf(buffer, ">\n} image\n"); break;
- case 2: sprintf(buffer, ">\n} false 3 colorimage\n"); break;
+ case 0: case 1:
+ sprintf(buffer, ">\n} image\n"); break;
+ case 2:
+ sprintf(buffer, ">\n} false 3 colorimage\n"); break;
}
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
sprintf(buffer, "0 %d translate\n", rows);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
}
ckfree((char *) cdata.colors);
return TCL_OK;
@@ -1417,28 +1398,28 @@ TkPostscriptImage(interp, tkwin, psInfo, ximage, x, y, width, height)
*
* Tk_PostscriptPhoto --
*
- * This procedure is called to output the contents of a
- * photo image in Postscript, using a format appropriate for
- * the requested postscript color mode (i.e. one byte per pixel
- * in gray, and three bytes per pixel in color).
+ * This function is called to output the contents of a photo image in
+ * Postscript, using a format appropriate for the requested postscript
+ * color mode (i.e. one byte per pixel in gray, and three bytes per pixel
+ * in color).
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
- * If no error occurs, then additional Postscript will be
- * appended to the interpreter's result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in interp->result. If no error occurs, then
+ * additional Postscript will be appended to the interpreter's result.
*
* Side effects:
* None.
*
*--------------------------------------------------------------
*/
+
int
-Tk_PostscriptPhoto(interp, blockPtr, psInfo, width, height)
- Tcl_Interp *interp;
- Tk_PhotoImageBlock *blockPtr;
- Tk_PostscriptInfo psInfo;
- int width, height;
+Tk_PostscriptPhoto(
+ Tcl_Interp *interp,
+ Tk_PhotoImageBlock *blockPtr,
+ Tk_PostscriptInfo psInfo,
+ int width, int height)
{
TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo;
int colorLevel = psInfoPtr->colorLevel;
@@ -1462,20 +1443,20 @@ Tk_PostscriptPhoto(interp, blockPtr, psInfo, width, height)
}
/*
- * Define the "TkPhoto" function, which is a modified version
- * of the original "transparentimage" function posted
- * by ian@five-d.com (Ian Kemmish) to comp.lang.postscript.
- * For a monochrome colorLevel this is a slightly different
- * version that uses the imagemask command instead of image.
+ * Define the "TkPhoto" function, which is a modified version of the
+ * original "transparentimage" function posted by ian@five-d.com (Ian
+ * Kemmish) to comp.lang.postscript. For a monochrome colorLevel this is a
+ * slightly different version that uses the imagemask command instead of
+ * image.
*/
- if( !codeIncluded && (colorLevel != 0) ) {
+ if (!codeIncluded && (colorLevel != 0)) {
/*
* Color and gray-scale code.
*/
codeIncluded = !0;
- Tcl_AppendResult( interp,
+ Tcl_AppendResult(interp,
"/TkPhoto { \n",
" gsave \n",
" 32 dict begin \n",
@@ -1544,14 +1525,14 @@ Tk_PostscriptPhoto(interp, blockPtr, psInfo, width, height)
" } for \n",
" end \n",
" grestore \n",
- "} bind def \n\n\n", (char *) NULL);
- } else if( !codeIncluded && (colorLevel == 0) ) {
+ "} bind def \n\n\n", NULL);
+ } else if (!codeIncluded && (colorLevel == 0)) {
/*
* Monochrome-only code
*/
codeIncluded = !0;
- Tcl_AppendResult( interp,
+ Tcl_AppendResult(interp,
"/TkPhoto { \n",
" gsave \n",
" 32 dict begin \n",
@@ -1588,27 +1569,26 @@ Tk_PostscriptPhoto(interp, blockPtr, psInfo, width, height)
" } for \n",
" end \n",
" grestore \n",
- "} bind def \n\n\n", (char *) NULL);
+ "} bind def \n\n\n", NULL);
}
/*
- * Check that at least one row of the image can be represented
- * with a string less than 64 KB long (this is a limit in the
- * Postscript interpreter).
+ * Check that at least one row of the image can be represented with a
+ * string less than 64 KB long (this is a limit in the Postscript
+ * interpreter).
*/
- switch (colorLevel)
- {
- case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
- case 1: bytesPerLine = width; maxWidth = 60000; break;
- case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
- }
+ switch (colorLevel) {
+ case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
+ case 1: bytesPerLine = width; maxWidth = 60000; break;
+ case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
+ }
if (bytesPerLine > 60000) {
Tcl_ResetResult(interp);
sprintf(buffer,
"Can't generate Postscript for images more than %d pixels wide",
maxWidth);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
return TCL_ERROR;
}
@@ -1617,45 +1597,37 @@ Tk_PostscriptPhoto(interp, blockPtr, psInfo, width, height)
*/
switch (colorLevel) {
- case 0:
- strcpy( cspace, "/DeviceGray");
- strcpy( decode, "[1 0]");
- bpc = 1;
- break;
- case 1:
- strcpy( cspace, "/DeviceGray");
- strcpy( decode, "[0 1]");
- bpc = 8;
- break;
- default:
- strcpy( cspace, "/DeviceRGB");
- strcpy( decode, "[0 1 0 1 0 1]");
- bpc = 8;
- break;
+ case 0:
+ strcpy(cspace, "/DeviceGray");
+ strcpy(decode, "[1 0]");
+ bpc = 1;
+ break;
+ case 1:
+ strcpy(cspace, "/DeviceGray");
+ strcpy(decode, "[0 1]");
+ bpc = 8;
+ break;
+ default:
+ strcpy(cspace, "/DeviceRGB");
+ strcpy(decode, "[0 1 0 1 0 1]");
+ bpc = 8;
+ break;
}
- Tcl_AppendResult(interp,
- cspace, " setcolorspace\n\n", (char *) NULL);
+ Tcl_AppendResult(interp, cspace, " setcolorspace\n\n", NULL);
- sprintf(buffer,
- " /Width %d\n /Height %d\n /BitsPerComponent %d\n",
+ sprintf(buffer, " /Width %d\n /Height %d\n /BitsPerComponent %d\n",
width, height, bpc);
- Tcl_AppendResult(interp,
- "<<\n /ImageType 1\n", buffer,
- " /DataSource currentfile",
- " /ASCIIHexDecode filter\n", (char *) NULL);
-
-
- sprintf(buffer,
- " /ImageMatrix [1 0 0 -1 0 %d]\n", height);
- Tcl_AppendResult(interp, buffer,
- " /Decode ", decode, "\n>>\n1 TkPhoto\n", (char *) NULL);
+ Tcl_AppendResult(interp, "<<\n /ImageType 1\n", buffer,
+ " /DataSource currentfile /ASCIIHexDecode filter\n", NULL);
+ sprintf(buffer, " /ImageMatrix [1 0 0 -1 0 %d]\n", height);
+ Tcl_AppendResult(interp, buffer, " /Decode ", decode,
+ "\n>>\n1 TkPhoto\n", NULL);
/*
- * Check the PhotoImageBlock information.
- * We assume that:
+ * Check the PhotoImageBlock information. We assume that:
* if pixelSize is 1,2 or 4, the image is R,G,B,A;
* if pixelSize is 3, the image is R,G,B and offset[3] is bogus.
*/
@@ -1678,198 +1650,192 @@ Tk_PostscriptPhoto(interp, blockPtr, psInfo, width, height)
alphaOffset = blockPtr->offset[3];
}
-
for (yy = 0, lineLen=0; yy < height; yy++) {
switch (colorLevel) {
- case 0: {
- /*
- * Generate data for image in monochrome mode.
- * No attempt at dithering is made--instead, just
- * set a threshold.
- * To handle transparecies we need to output two lines:
- * one for the black pixels, one for the white ones.
- */
+ case 0: {
+ /*
+ * Generate data for image in monochrome mode. No attempt at
+ * dithering is made--instead, just set a threshold. To handle
+ * transparecies we need to output two lines: one for the black
+ * pixels, one for the white ones.
+ */
- unsigned char mask=0x80;
- unsigned char data=0x00;
- for (xx = 0; xx< width; xx ++) {
- pixelPtr = blockPtr->pixelPtr
- + (yy * blockPtr->pitch)
+ unsigned char mask = 0x80;
+ unsigned char data = 0x00;
+
+ for (xx = 0; xx< width; xx ++) {
+ pixelPtr = blockPtr->pixelPtr + (yy * blockPtr->pitch)
+ (xx *blockPtr->pixelSize);
- red = pixelPtr[blockPtr->offset[0]];
- green = pixelPtr[blockPtr->offset[1]];
- blue = pixelPtr[blockPtr->offset[2]];
+ red = pixelPtr[blockPtr->offset[0]];
+ green = pixelPtr[blockPtr->offset[1]];
+ blue = pixelPtr[blockPtr->offset[2]];
- alpha = *(alphaPtr + (yy * alphaPitch)
- + (xx * alphaIncr) + alphaOffset);
+ alpha = *(alphaPtr + (yy * alphaPitch)
+ + (xx * alphaIncr) + alphaOffset);
- /*
- * If pixel is less than threshold, then it is black.
- */
+ /*
+ * If pixel is less than threshold, then it is black.
+ */
- if ((alpha != 0) &&
- ( 0.3086 * red
- + 0.6094 * green
- + 0.082 * blue < 128)) {
- data |= mask;
- }
- mask >>= 1;
- if (mask == 0) {
- sprintf(buffer, "%02X", data);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- lineLen += 2;
- if (lineLen >= 60) {
- lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
- }
- mask=0x80;
- data=0x00;
- }
+ if ((alpha != 0) &&
+ (0.3086*red + 0.6094*green + 0.082*blue < 128)) {
+ data |= mask;
}
- if ((width % 8) != 0) {
+ mask >>= 1;
+ if (mask == 0) {
sprintf(buffer, "%02X", data);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- mask=0x80;
- data=0x00;
+ Tcl_AppendResult(interp, buffer, NULL);
+ lineLen += 2;
+ if (lineLen >= 60) {
+ lineLen = 0;
+ Tcl_AppendResult(interp, "\n", NULL);
+ }
+ mask = 0x80;
+ data = 0x00;
}
+ }
+ if ((width % 8) != 0) {
+ sprintf(buffer, "%02X", data);
+ Tcl_AppendResult(interp, buffer, NULL);
+ mask = 0x80;
+ data = 0x00;
+ }
- mask=0x80;
- data=0x00;
- for (xx = 0; xx< width; xx ++) {
- pixelPtr = blockPtr->pixelPtr
- + (yy * blockPtr->pitch)
+ mask = 0x80;
+ data = 0x00;
+ for (xx=0 ; xx<width ; xx++) {
+ pixelPtr = blockPtr->pixelPtr + (yy * blockPtr->pitch)
+ (xx *blockPtr->pixelSize);
- red = pixelPtr[blockPtr->offset[0]];
- green = pixelPtr[blockPtr->offset[1]];
- blue = pixelPtr[blockPtr->offset[2]];
-
- alpha = *(alphaPtr + (yy * alphaPitch)
- + (xx * alphaIncr) + alphaOffset);
-
- /*
- * If pixel is greater than threshold, then it is white.
- */
-
- if ((alpha != 0) &&
- ( 0.3086 * red
- + 0.6094 * green
- + 0.082 * blue >= 128)) {
- data |= mask;
- }
- mask >>= 1;
- if (mask == 0) {
- sprintf(buffer, "%02X", data);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- lineLen += 2;
- if (lineLen >= 60) {
- lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
- }
- mask=0x80;
- data=0x00;
- }
- }
- if ((width % 8) != 0) {
- sprintf(buffer, "%02X", data);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- mask=0x80;
- data=0x00;
- }
- break;
- }
- case 1: {
+ red = pixelPtr[blockPtr->offset[0]];
+ green = pixelPtr[blockPtr->offset[1]];
+ blue = pixelPtr[blockPtr->offset[2]];
+
+ alpha = *(alphaPtr + (yy * alphaPitch)
+ + (xx * alphaIncr) + alphaOffset);
+
/*
- * Generate transparency data.
- * We must prevent a transparent value of 0
- * because of a bug in some HP printers.
+ * If pixel is greater than threshold, then it is white.
*/
- for (xx = 0; xx < width; xx ++) {
- alpha = *(alphaPtr + (yy * alphaPitch)
- + (xx * alphaIncr) + alphaOffset);
- sprintf(buffer, "%02X", alpha | 0x01);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ if ((alpha != 0) &&
+ (0.3086*red + 0.6094*green + 0.082*blue >= 128)) {
+ data |= mask;
+ }
+ mask >>= 1;
+ if (mask == 0) {
+ sprintf(buffer, "%02X", data);
+ Tcl_AppendResult(interp, buffer, NULL);
lineLen += 2;
if (lineLen >= 60) {
lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
+ Tcl_AppendResult(interp, "\n", NULL);
}
+ mask = 0x80;
+ data = 0x00;
}
+ }
+ if ((width % 8) != 0) {
+ sprintf(buffer, "%02X", data);
+ Tcl_AppendResult(interp, buffer, NULL);
+ mask = 0x80;
+ data = 0x00;
+ }
+ break;
+ }
+ case 1: {
+ /*
+ * Generate transparency data. We must prevent a transparent value
+ * of 0 because of a bug in some HP printers.
+ */
+ for (xx = 0; xx < width; xx ++) {
+ alpha = *(alphaPtr + (yy * alphaPitch)
+ + (xx * alphaIncr) + alphaOffset);
+ sprintf(buffer, "%02X", alpha | 0x01);
+ Tcl_AppendResult(interp, buffer, NULL);
+ lineLen += 2;
+ if (lineLen >= 60) {
+ lineLen = 0;
+ Tcl_AppendResult(interp, "\n", NULL);
+ }
+ }
- /*
- * Generate data in gray mode--in this case, take a
- * weighted sum of the red, green, and blue values.
- */
+ /*
+ * Generate data in gray mode; in this case, take a weighted sum
+ * of the red, green, and blue values.
+ */
- for (xx = 0; xx < width; xx ++) {
- pixelPtr = blockPtr->pixelPtr
- + (yy * blockPtr->pitch)
+ for (xx = 0; xx < width; xx ++) {
+ pixelPtr = blockPtr->pixelPtr + (yy * blockPtr->pitch)
+ (xx *blockPtr->pixelSize);
- red = pixelPtr[blockPtr->offset[0]];
- green = pixelPtr[blockPtr->offset[1]];
- blue = pixelPtr[blockPtr->offset[2]];
-
- sprintf(buffer, "%02X", (int) floor(0.5 +
- ( 0.3086 * red + 0.6094 * green + 0.0820 * blue)));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- lineLen += 2;
- if (lineLen >= 60) {
- lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
- }
+ red = pixelPtr[blockPtr->offset[0]];
+ green = pixelPtr[blockPtr->offset[1]];
+ blue = pixelPtr[blockPtr->offset[2]];
+
+ sprintf(buffer, "%02X", (int) floor(0.5 +
+ ( 0.3086 * red + 0.6094 * green + 0.0820 * blue)));
+ Tcl_AppendResult(interp, buffer, NULL);
+ lineLen += 2;
+ if (lineLen >= 60) {
+ lineLen = 0;
+ Tcl_AppendResult(interp, "\n", NULL);
}
- break;
}
- default: {
- /*
- * Generate transparency data.
- * We must prevent a transparent value of 0
- * because of a bug in some HP printers.
- */
+ break;
+ }
+ default:
+ /*
+ * Generate transparency data. We must prevent a transparent value
+ * of 0 because of a bug in some HP printers.
+ */
- for (xx = 0; xx < width; xx ++) {
- alpha = *(alphaPtr + (yy * alphaPitch)
- + (xx * alphaIncr) + alphaOffset);
- sprintf(buffer, "%02X", alpha | 0x01);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- lineLen += 2;
- if (lineLen >= 60) {
- lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
- }
+ for (xx = 0; xx < width; xx ++) {
+ alpha = *(alphaPtr + (yy * alphaPitch)
+ + (xx * alphaIncr) + alphaOffset);
+ sprintf(buffer, "%02X", alpha | 0x01);
+ Tcl_AppendResult(interp, buffer, NULL);
+ lineLen += 2;
+ if (lineLen >= 60) {
+ lineLen = 0;
+ Tcl_AppendResult(interp, "\n", NULL);
}
+ }
+ /*
+ * Finally, color mode. Here, just output the red, green, and blue
+ * values directly.
+ */
- /*
- * Finally, color mode. Here, just output the red, green,
- * and blue values directly.
- */
-
- for (xx = 0; xx < width; xx ++) {
- pixelPtr = blockPtr->pixelPtr
- + (yy * blockPtr->pitch)
- + (xx *blockPtr->pixelSize);
-
- sprintf(buffer, "%02X%02X%02X",
- pixelPtr[blockPtr->offset[0]],
- pixelPtr[blockPtr->offset[1]],
- pixelPtr[blockPtr->offset[2]]);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
- lineLen += 6;
- if (lineLen >= 60) {
- lineLen = 0;
- Tcl_AppendResult(interp, "\n", (char *) NULL);
- }
+ for (xx = 0; xx < width; xx ++) {
+ pixelPtr = blockPtr->pixelPtr + (yy * blockPtr->pitch)
+ + (xx * blockPtr->pixelSize);
+
+ sprintf(buffer, "%02X%02X%02X",
+ pixelPtr[blockPtr->offset[0]],
+ pixelPtr[blockPtr->offset[1]],
+ pixelPtr[blockPtr->offset[2]]);
+ Tcl_AppendResult(interp, buffer, NULL);
+ lineLen += 6;
+ if (lineLen >= 60) {
+ lineLen = 0;
+ Tcl_AppendResult(interp, "\n", NULL);
}
- break;
}
+ break;
}
}
- Tcl_AppendResult(interp, ">\n", (char *) NULL);
+ Tcl_AppendResult(interp, ">\n", NULL);
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 282482f..24c3c7f 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkCanvText.c --
*
* This file implements text items for canvas widgets.
@@ -6,33 +6,32 @@
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
#include "tkInt.h"
#include "tkCanvas.h"
-#include "tkPort.h"
#include "default.h"
/*
* The structure below defines the record for each text item.
*/
-typedef struct TextItem {
+typedef struct TextItem {
Tk_Item header; /* Generic stuff that's the same for all
- * types. MUST BE FIRST IN STRUCTURE. */
+ * types. MUST BE FIRST IN STRUCTURE. */
Tk_CanvasTextInfo *textInfoPtr;
/* Pointer to a structure containing
* information about the selection and
- * insertion cursor. The structure is owned
- * by (and shared with) the generic canvas
+ * insertion cursor. The structure is owned by
+ * (and shared with) the generic canvas
* code. */
/*
* Fields that are set by widget commands other than "configure".
*/
-
+
double x, y; /* Positioning point for text. */
int insertPos; /* Character index of character just before
* which the insertion cursor is displayed. */
@@ -52,8 +51,10 @@ typedef struct TextItem {
Pixmap activeStipple; /* Stipple bitmap for text, or None. */
Pixmap disabledStipple; /* Stipple bitmap for text, or None. */
char *text; /* Text for item (malloc-ed). */
- int width; /* Width of lines for word-wrap, pixels.
- * Zero means no word-wrap. */
+ int width; /* Width of lines for word-wrap, pixels. Zero
+ * means no word-wrap. */
+ int underline; /* Index of character to put underline beneath
+ * or -1 for no underlining. */
/*
* Fields whose values are derived from the current values of the
@@ -63,18 +64,18 @@ typedef struct TextItem {
int numChars; /* Length of text in characters. */
int numBytes; /* Length of text in bytes. */
Tk_TextLayout textLayout; /* Cached text layout information. */
- int leftEdge; /* Pixel location of the left edge of the
- * text item; where the left border of the
- * text layout is drawn. */
- int rightEdge; /* Pixel just to right of right edge of
- * area of text item. Used for selecting up
- * to end of line. */
+ int leftEdge; /* Pixel location of the left edge of the text
+ * item; where the left border of the text
+ * layout is drawn. */
+ int rightEdge; /* Pixel just to right of right edge of area
+ * of text item. Used for selecting up to end
+ * of line. */
GC gc; /* Graphics context for drawing text. */
GC selTextGC; /* Graphics context for selected text. */
GC cursorOffGC; /* If not None, this gives a graphics context
* to use to draw the insertion cursor when
- * it's off. Used if the selection and
- * insertion cursor colors are the same. */
+ * it's off. Used if the selection and
+ * insertion cursor colors are the same. */
} TextItem;
/*
@@ -95,89 +96,86 @@ static Tk_CustomOption offsetOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_COLOR, "-activefill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TextItem, activeColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TextItem, activeStipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_ANCHOR, "-anchor", (char *) NULL, (char *) NULL,
- "center", Tk_Offset(TextItem, anchor),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_COLOR, "-disabledfill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TextItem, disabledColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TextItem, disabledStipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-fill", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-activefill", NULL, NULL,
+ NULL, Tk_Offset(TextItem, activeColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
+ NULL, Tk_Offset(TextItem, activeStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
+ "center", Tk_Offset(TextItem, anchor), TK_CONFIG_DONT_SET_DEFAULT},
+ {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
+ NULL, Tk_Offset(TextItem, disabledColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
+ NULL, Tk_Offset(TextItem, disabledStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(TextItem, color), TK_CONFIG_NULL_OK},
- {TK_CONFIG_FONT, "-font", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_FONT, "-font", NULL, NULL,
DEF_CANVTEXT_FONT, Tk_Offset(TextItem, tkfont), 0},
- {TK_CONFIG_JUSTIFY, "-justify", (char *) NULL, (char *) NULL,
- "left", Tk_Offset(TextItem, justify),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-offset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_JUSTIFY, "-justify", NULL, NULL,
+ "left", Tk_Offset(TextItem, justify), TK_CONFIG_DONT_SET_DEFAULT},
+ {TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
"0,0", Tk_Offset(TextItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_BITMAP, "-stipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TextItem, stipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_STRING, "-text", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
+ NULL, Tk_Offset(TextItem, stipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_STRING, "-text", NULL, NULL,
"", Tk_Offset(TextItem, text), 0},
- {TK_CONFIG_PIXELS, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_INT, "-underline", NULL, NULL,
+ "-1", Tk_Offset(TextItem, underline), 0},
+ {TK_CONFIG_PIXELS, "-width", NULL, NULL,
"0", Tk_Offset(TextItem, width), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static void ComputeTextBbox _ANSI_ARGS_((Tk_Canvas canvas,
- TextItem *textPtr));
-static int ConfigureText _ANSI_ARGS_((Tcl_Interp *interp,
+static void ComputeTextBbox(Tk_Canvas canvas, TextItem *textPtr);
+static int ConfigureText(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST objv[], int flags));
-static int CreateText _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST objv[], int flags);
+static int CreateText(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST objv[]));
-static void DeleteText _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayCanvText _ANSI_ARGS_((Tk_Canvas canvas,
+ int argc, Tcl_Obj *CONST objv[]);
+static void DeleteText(Tk_Canvas canvas,
+ Tk_Item *itemPtr, Display *display);
+static void DisplayCanvText(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static int GetSelText _ANSI_ARGS_((Tk_Canvas canvas,
+ int x, int y, int width, int height);
+static int GetSelText(Tk_Canvas canvas,
Tk_Item *itemPtr, int offset, char *buffer,
- int maxBytes));
-static int GetTextIndex _ANSI_ARGS_((Tcl_Interp *interp,
+ int maxBytes);
+static int GetTextIndex(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- Tcl_Obj *obj, int *indexPtr));
-static void ScaleText _ANSI_ARGS_((Tk_Canvas canvas,
+ Tcl_Obj *obj, int *indexPtr);
+static void ScaleText(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void SetTextCursor _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, int index));
-static int TextCoords _ANSI_ARGS_((Tcl_Interp *interp,
+ double scaleX, double scaleY);
+static void SetTextCursor(Tk_Canvas canvas,
+ Tk_Item *itemPtr, int index);
+static int TextCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST objv[]));
-static void TextDeleteChars _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last));
-static void TextInsert _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, int beforeThis, char *string));
-static int TextToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *rectPtr));
-static double TextToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *pointPtr));
-static int TextToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static void TranslateText _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
+ int argc, Tcl_Obj *CONST objv[]);
+static void TextDeleteChars(Tk_Canvas canvas,
+ Tk_Item *itemPtr, int first, int last);
+static void TextInsert(Tk_Canvas canvas,
+ Tk_Item *itemPtr, int beforeThis, char *string);
+static int TextToArea(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *rectPtr);
+static double TextToPoint(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *pointPtr);
+static int TextToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static void TranslateText(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double deltaX, double deltaY);
/*
- * The structures below defines the rectangle and oval item types
- * by means of procedures that can be invoked by generic item code.
+ * The structures below defines the rectangle and oval item types by means of
+ * functions that can be invoked by generic item code.
*/
Tk_ItemType tkTextType = {
@@ -200,7 +198,7 @@ Tk_ItemType tkTextType = {
GetSelText, /* selectionProc */
TextInsert, /* insertProc */
TextDeleteChars, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ NULL, /* nextPtr */
};
/*
@@ -208,14 +206,12 @@ Tk_ItemType tkTextType = {
*
* CreateText --
*
- * This procedure is invoked to create a new text item
- * in a canvas.
+ * This function is invoked to create a new text item in a canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item then an error message is left in
- * the interp's result; in this case itemPtr is left uninitialized
- * so it can be safely freed by the caller.
+ * A standard Tcl return value. If an error occurred in creating the item
+ * then an error message is left in the interp's result; in this case
+ * itemPtr is left uninitialized so it can be safely freed by the caller.
*
* Side effects:
* A new text item is created.
@@ -224,24 +220,24 @@ Tk_ItemType tkTextType = {
*/
static int
-CreateText(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header has been
+CreateText(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
{
TextItem *textPtr = (TextItem *) itemPtr;
int i;
if (objc == 0) {
- panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords\n");
}
/*
* Carry out initialization that is needed in order to clean up after
- * errors during the the remainder of this procedure.
+ * errors during the the remainder of this function.
*/
textPtr->textInfoPtr = Tk_CanvasGetTextInfo(canvas);
@@ -262,6 +258,7 @@ CreateText(interp, canvas, itemPtr, objc, objv)
textPtr->disabledStipple = None;
textPtr->text = NULL;
textPtr->width = 0;
+ textPtr->underline = -1;
textPtr->numChars = 0;
textPtr->numBytes = 0;
@@ -273,14 +270,15 @@ CreateText(interp, canvas, itemPtr, objc, objv)
textPtr->cursorOffGC = None;
/*
- * Process the arguments to fill in the item record.
- * Only 1 (list) or 2 (x y) coords are allowed.
+ * Process the arguments to fill in the item record. Only 1 (list) or 2 (x
+ * y) coords are allowed.
*/
if (objc == 1) {
i = 1;
} else {
char *arg = Tcl_GetString(objv[1]);
+
i = 2;
if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
i = 1;
@@ -293,7 +291,7 @@ CreateText(interp, canvas, itemPtr, objc, objv)
return TCL_OK;
}
- error:
+ error:
DeleteText(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -303,9 +301,8 @@ CreateText(interp, canvas, itemPtr, objc, objv)
*
* TextCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on text items. See the user documentation for
- * details on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * text items. See the user documentation for details on what it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -317,18 +314,19 @@ CreateText(interp, canvas, itemPtr, objc, objv)
*/
static int
-TextCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be read or
+TextCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
- int objc; /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, x2, y2, ... */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
TextItem *textPtr = (TextItem *) itemPtr;
if (objc == 0) {
Tcl_Obj *obj = Tcl_NewObj();
+
Tcl_Obj *subobj = Tcl_NewDoubleObj(textPtr->x);
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewDoubleObj(textPtr->y);
@@ -347,15 +345,16 @@ TextCoords(interp, canvas, itemPtr, objc, objv)
return TCL_ERROR;
}
}
- if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &textPtr->x) != TCL_OK)
+ if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0],
+ &textPtr->x) != TCL_OK)
|| (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1],
- &textPtr->y) != TCL_OK)) {
+ &textPtr->y) != TCL_OK)) {
return TCL_ERROR;
}
ComputeTextBbox(canvas, textPtr);
} else {
char buf[64 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
@@ -368,28 +367,28 @@ TextCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigureText --
*
- * This procedure is invoked to configure various aspects
- * of a text item, such as its border and background colors.
+ * This function is invoked to configure various aspects of a text item,
+ * such as its border and background colors.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
- * Configuration information, such as colors and stipple
- * patterns, may be set for itemPtr.
+ * Configuration information, such as colors and stipple patterns, may be
+ * set for itemPtr.
*
*--------------------------------------------------------------
*/
static int
-ConfigureText(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Rectangle item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureText(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
TextItem *textPtr = (TextItem *) itemPtr;
XGCValues gcValues;
@@ -409,14 +408,13 @@ ConfigureText(interp, canvas, itemPtr, objc, objv, flags)
}
/*
- * A few of the options require additional processing, such as
- * graphics contexts.
+ * A few of the options require additional processing, such as graphics
+ * contexts.
*/
state = itemPtr->state;
- if (textPtr->activeColor != NULL ||
- textPtr->activeStipple != None) {
+ if (textPtr->activeColor != NULL || textPtr->activeStipple != None) {
itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT;
} else {
itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT;
@@ -497,14 +495,14 @@ ConfigureText(interp, canvas, itemPtr, objc, objv, flags)
/*
- * If the text was changed, move the selection and insertion indices
- * to keep them inside the item.
+ * If the text was changed, move the selection and insertion indices to
+ * keep them inside the item.
*/
textPtr->numBytes = strlen(textPtr->text);
textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes);
if (textInfoPtr->selItemPtr == itemPtr) {
-
+
if (textInfoPtr->selectFirst >= textPtr->numChars) {
textInfoPtr->selItemPtr = NULL;
} else {
@@ -530,8 +528,8 @@ ConfigureText(interp, canvas, itemPtr, objc, objv, flags)
*
* DeleteText --
*
- * This procedure is called to clean up the data structure
- * associated with a text item.
+ * This function is called to clean up the data structure associated with
+ * a text item.
*
* Results:
* None.
@@ -543,10 +541,10 @@ ConfigureText(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteText(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall canvas widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for canvas. */
+DeleteText(
+ Tk_Canvas canvas, /* Info about overall canvas widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -590,26 +588,25 @@ DeleteText(canvas, itemPtr, display)
*
* ComputeTextBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of a text item.
- * In addition, it recomputes all of the geometry information
- * used to display a text item or check for mouse hits.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of a text item. In addition, it recomputes
+ * all of the geometry information used to display a text item or check
+ * for mouse hits.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr, and the linePtr structure is regenerated
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr,
+ * and the linePtr structure is regenerated for itemPtr.
*
*--------------------------------------------------------------
*/
static void
-ComputeTextBbox(canvas, textPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- TextItem *textPtr; /* Item whose bbox is to be recomputed. */
+ComputeTextBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ TextItem *textPtr) /* Item whose bbox is to be recomputed. */
{
Tk_CanvasTextInfo *textInfoPtr;
int leftX, topY, width, height, fudge;
@@ -629,57 +626,56 @@ ComputeTextBbox(canvas, textPtr)
}
/*
- * Use overall geometry information to compute the top-left corner
- * of the bounding box for the text item.
+ * Use overall geometry information to compute the top-left corner of the
+ * bounding box for the text item.
*/
leftX = (int) floor(textPtr->x + 0.5);
topY = (int) floor(textPtr->y + 0.5);
switch (textPtr->anchor) {
- case TK_ANCHOR_NW:
- case TK_ANCHOR_N:
- case TK_ANCHOR_NE:
- break;
-
- case TK_ANCHOR_W:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_E:
- topY -= height / 2;
- break;
-
- case TK_ANCHOR_SW:
- case TK_ANCHOR_S:
- case TK_ANCHOR_SE:
- topY -= height;
- break;
+ case TK_ANCHOR_NW:
+ case TK_ANCHOR_N:
+ case TK_ANCHOR_NE:
+ break;
+
+ case TK_ANCHOR_W:
+ case TK_ANCHOR_CENTER:
+ case TK_ANCHOR_E:
+ topY -= height / 2;
+ break;
+
+ case TK_ANCHOR_SW:
+ case TK_ANCHOR_S:
+ case TK_ANCHOR_SE:
+ topY -= height;
+ break;
}
switch (textPtr->anchor) {
- case TK_ANCHOR_NW:
- case TK_ANCHOR_W:
- case TK_ANCHOR_SW:
- break;
+ case TK_ANCHOR_NW:
+ case TK_ANCHOR_W:
+ case TK_ANCHOR_SW:
+ break;
- case TK_ANCHOR_N:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_S:
- leftX -= width / 2;
- break;
+ case TK_ANCHOR_N:
+ case TK_ANCHOR_CENTER:
+ case TK_ANCHOR_S:
+ leftX -= width / 2;
+ break;
- case TK_ANCHOR_NE:
- case TK_ANCHOR_E:
- case TK_ANCHOR_SE:
- leftX -= width;
- break;
+ case TK_ANCHOR_NE:
+ case TK_ANCHOR_E:
+ case TK_ANCHOR_SE:
+ leftX -= width;
+ break;
}
- textPtr->leftEdge = leftX;
+ textPtr->leftEdge = leftX;
textPtr->rightEdge = leftX + width;
/*
- * Last of all, update the bounding box for the item. The item's
- * bounding box includes the bounding box of all its lines, plus
- * an extra fudge factor for the cursor border (which could
- * potentially be quite large).
+ * Last of all, update the bounding box for the item. The item's bounding
+ * box includes the bounding box of all its lines, plus an extra fudge
+ * factor for the cursor border (which could potentially be quite large).
*/
textInfoPtr = textPtr->textInfoPtr;
@@ -698,26 +694,26 @@ ComputeTextBbox(canvas, textPtr)
*
* DisplayCanvText --
*
- * This procedure is invoked to draw a text item in a given
- * drawable.
+ * This function is invoked to draw a text item in a given drawable.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
static void
-DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw item. */
- int x, y, width, height; /* Describes region of canvas that must be
+DisplayCanvText(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, int width, int height)
+ /* Describes region of canvas that must be
* redisplayed (not used). */
{
TextItem *textPtr;
@@ -749,8 +745,8 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
}
/*
- * If we're stippling, then modify the stipple offset in the GC. Be
- * sure to reset the offset when done, since the GC is supposed to be
+ * If we're stippling, then modify the stipple offset in the GC. Be sure
+ * to reset the offset when done, since the GC is supposed to be
* read-only.
*/
@@ -792,7 +788,7 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
for (y = yFirst ; y <= yLast; y += height) {
if (y == yLast) {
width = xLast + wLast - x;
- } else {
+ } else {
width = textPtr->rightEdge - textPtr->leftEdge - x;
}
Tk_CanvasDrawableCoords(canvas,
@@ -811,11 +807,11 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
/*
* If the insertion point should be displayed, then draw a special
- * background for the cursor before drawing the text. Note: if
- * we're the cursor item but the cursor is turned off, then redraw
- * background over the area of the cursor. This guarantees that
- * the selection won't make the cursor invisible on mono displays,
- * where both are drawn in the same color.
+ * background for the cursor before drawing the text. Note: if we're the
+ * cursor item but the cursor is turned off, then redraw background over
+ * the area of the cursor. This guarantees that the selection won't make
+ * the cursor invisible on mono displays, where both are drawn in the same
+ * color.
*/
if ((textInfoPtr->focusItemPtr == itemPtr) && (textInfoPtr->gotFocus)) {
@@ -836,11 +832,10 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED);
} else if (textPtr->cursorOffGC != None) {
/*
- * Redraw the background over the area of the cursor,
- * even though the cursor is turned off. This
- * guarantees that the selection won't make the cursor
- * invisible on mono displays, where both may be drawn
- * in the same color.
+ * Redraw the background over the area of the cursor, even
+ * though the cursor is turned off. This guarantees that the
+ * selection won't make the cursor invisible on mono displays,
+ * where both may be drawn in the same color.
*/
XFillRectangle(display, drawable, textPtr->cursorOffGC,
@@ -851,16 +846,14 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
}
}
-
/*
- * If there is no selected text or the selected text foreground
- * is the same as the regular text foreground, then draw one
- * text string. If there is selected text and the foregrounds
- * differ, draw the regular text up to the selection, draw
- * the selection, then draw the rest of the regular text.
- * Drawing the regular text and then the selected text over
- * it would causes problems with anti-aliased text because the
- * two anti-aliasing colors would blend together.
+ * If there is no selected text or the selected text foreground is the
+ * same as the regular text foreground, then draw one text string. If
+ * there is selected text and the foregrounds differ, draw the regular
+ * text up to the selection, draw the selection, then draw the rest of the
+ * regular text. Drawing the regular text and then the selected text over
+ * it would causes problems with anti-aliased text because the two
+ * anti-aliasing colors would blend together.
*/
Tk_CanvasDrawableCoords(canvas, (double) textPtr->leftEdge,
@@ -878,6 +871,8 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout,
drawableX, drawableY, 0, -1);
}
+ Tk_UnderlineTextLayout(display, drawable, textPtr->gc, textPtr->textLayout,
+ drawableX, drawableY, textPtr->underline);
if (stipple != None) {
XSetTSOrigin(display, textPtr->gc, 0, 0);
@@ -895,24 +890,23 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
* None.
*
* Side effects:
- * The text in the given item is modified. The cursor and
- * selection positions are also modified to reflect the
- * insertion.
+ * The text in the given item is modified. The cursor and selection
+ * positions are also modified to reflect the insertion.
*
*--------------------------------------------------------------
*/
static void
-TextInsert(canvas, itemPtr, index, string)
- Tk_Canvas canvas; /* Canvas containing text item. */
- Tk_Item *itemPtr; /* Text item to be modified. */
- int index; /* Character index before which string is
- * to be inserted. */
- char *string; /* New characters to be inserted. */
+TextInsert(
+ Tk_Canvas canvas, /* Canvas containing text item. */
+ Tk_Item *itemPtr, /* Text item to be modified. */
+ int index, /* Character index before which string is to
+ * be inserted. */
+ char *string) /* New characters to be inserted. */
{
TextItem *textPtr = (TextItem *) itemPtr;
int byteIndex, byteCount, charsAdded;
- char *new, *text;
+ char *newStr, *text;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
string = Tcl_GetStringFromObj((Tcl_Obj *) string, &byteCount);
@@ -931,20 +925,20 @@ TextInsert(canvas, itemPtr, index, string)
return;
}
- new = (char *) ckalloc((unsigned) textPtr->numBytes + byteCount + 1);
- memcpy(new, text, (size_t) byteIndex);
- strcpy(new + byteIndex, string);
- strcpy(new + byteIndex + byteCount, text + byteIndex);
+ newStr = (char *) ckalloc((unsigned) textPtr->numBytes + byteCount + 1);
+ memcpy(newStr, text, (size_t) byteIndex);
+ strcpy(newStr + byteIndex, string);
+ strcpy(newStr + byteIndex + byteCount, text + byteIndex);
ckfree(text);
- textPtr->text = new;
+ textPtr->text = newStr;
charsAdded = Tcl_NumUtfChars(string, byteCount);
textPtr->numChars += charsAdded;
textPtr->numBytes += byteCount;
/*
* Inserting characters invalidates indices such as those for the
- * selection and cursor. Update the indices appropriately.
+ * selection and cursor. Update the indices appropriately.
*/
if (textInfoPtr->selItemPtr == itemPtr) {
@@ -976,25 +970,24 @@ TextInsert(canvas, itemPtr, index, string)
* None.
*
* Side effects:
- * Characters between "first" and "last", inclusive, get
- * deleted from itemPtr, and things like the selection
- * position get updated.
+ * Characters between "first" and "last", inclusive, get deleted from
+ * itemPtr, and things like the selection position get updated.
*
*--------------------------------------------------------------
*/
static void
-TextDeleteChars(canvas, itemPtr, first, last)
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Item in which to delete characters. */
- int first; /* Character index of first character to
+TextDeleteChars(
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Item in which to delete characters. */
+ int first, /* Character index of first character to
* delete. */
- int last; /* Character index of last character to
- * delete (inclusive). */
+ int last) /* Character index of last character to delete
+ * (inclusive). */
{
TextItem *textPtr = (TextItem *) itemPtr;
int byteIndex, byteCount, charsRemoved;
- char *new, *text;
+ char *newStr, *text;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
text = textPtr->text;
@@ -1012,19 +1005,19 @@ TextDeleteChars(canvas, itemPtr, first, last)
byteIndex = Tcl_UtfAtIndex(text, first) - text;
byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved)
- (text + byteIndex);
-
- new = (char *) ckalloc((unsigned) (textPtr->numBytes + 1 - byteCount));
- memcpy(new, text, (size_t) byteIndex);
- strcpy(new + byteIndex, text + byteIndex + byteCount);
+
+ newStr = (char *) ckalloc((unsigned) (textPtr->numBytes + 1 - byteCount));
+ memcpy(newStr, text, (size_t) byteIndex);
+ strcpy(newStr + byteIndex, text + byteIndex + byteCount);
ckfree(text);
- textPtr->text = new;
+ textPtr->text = newStr;
textPtr->numChars -= charsRemoved;
textPtr->numBytes -= byteCount;
/*
- * Update indexes for the selection and cursor to reflect the
- * renumbering of the remaining characters.
+ * Update indexes for the selection and cursor to reflect the renumbering
+ * of the remaining characters.
*/
if (textInfoPtr->selItemPtr == itemPtr) {
@@ -1066,14 +1059,14 @@ TextDeleteChars(canvas, itemPtr, first, last)
*
* TextToPoint --
*
- * Computes the distance from a given point to a given
- * text item, in canvas units.
+ * Computes the distance from a given point to a given text item, in
+ * canvas units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are pointPtr[0] and pointPtr[1] is inside the text item. If
- * the point isn't inside the text item then the return value
- * is the distance from the point to the text item.
+ * The return value is 0 if the point whose x and y coordinates are
+ * pointPtr[0] and pointPtr[1] is inside the text item. If the point
+ * isn't inside the text item then the return value is the distance from
+ * the point to the text item.
*
* Side effects:
* None.
@@ -1082,10 +1075,10 @@ TextDeleteChars(canvas, itemPtr, first, last)
*/
static double
-TextToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+TextToPoint(
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
TextItem *textPtr;
Tk_State state = itemPtr->state;
@@ -1095,7 +1088,7 @@ TextToPoint(canvas, itemPtr, pointPtr)
state = ((TkCanvas *)canvas)->canvas_state;
}
textPtr = (TextItem *) itemPtr;
- value = (double) Tk_DistanceToTextLayout(textPtr->textLayout,
+ value = (double) Tk_DistanceToTextLayout(textPtr->textLayout,
(int) pointPtr[0] - textPtr->leftEdge,
(int) pointPtr[1] - textPtr->header.y1);
@@ -1111,14 +1104,13 @@ TextToPoint(canvas, itemPtr, pointPtr)
*
* TextToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangle.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangle.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -1127,12 +1119,12 @@ TextToPoint(canvas, itemPtr, pointPtr)
*/
static int
-TextToArea(canvas, itemPtr, rectPtr)
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Item to check against rectangle. */
- double *rectPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
- * area. */
+TextToArea(
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Item to check against rectangle. */
+ double *rectPtr) /* Pointer to array of four coordinates
+ * (x1,y1,x2,y2) describing rectangular
+ * area. */
{
TextItem *textPtr;
Tk_State state = itemPtr->state;
@@ -1154,26 +1146,27 @@ TextToArea(canvas, itemPtr, rectPtr)
*
* ScaleText --
*
- * This procedure is invoked to rescale a text item.
+ * This function is invoked to rescale a text item.
*
* Results:
* None.
*
* Side effects:
- * Scales the position of the text, but not the size
- * of the font for the text.
+ * Scales the position of the text, but not the size of the font for the
+ * text.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
-ScaleText(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing rectangle. */
- Tk_Item *itemPtr; /* Rectangle to be scaled. */
- double originX, originY; /* Origin about which to scale rect. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleText(
+ Tk_Canvas canvas, /* Canvas containing rectangle. */
+ Tk_Item *itemPtr, /* Rectangle to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale rect. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -1188,25 +1181,24 @@ ScaleText(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* TranslateText --
*
- * This procedure is called to move a text item by a
- * given amount.
+ * This function is called to move a text item by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the text item is offset by (xDelta, yDelta),
- * and the bounding box is updated in the generic part of the
- * item structure.
+ * The position of the text item is offset by (xDelta, yDelta), and the
+ * bounding box is updated in the generic part of the item structure.
*
*--------------------------------------------------------------
*/
static void
-TranslateText(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be moved. */
+TranslateText(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -1220,14 +1212,13 @@ TranslateText(canvas, itemPtr, deltaX, deltaY)
*
* GetTextIndex --
*
- * Parse an index into a text item and return either its value
- * or an error.
+ * Parse an index into a text item and return either its value or an
+ * error.
*
* Results:
- * A standard Tcl result. If all went well, then *indexPtr is
- * filled in with the index (into itemPtr) corresponding to
- * string. Otherwise an error message is left in
- * the interp's result.
+ * A standard Tcl result. If all went well, then *indexPtr is filled in
+ * with the index (into itemPtr) corresponding to string. Otherwise an
+ * error message is left in the interp's result.
*
* Side effects:
* None.
@@ -1236,18 +1227,19 @@ TranslateText(canvas, itemPtr, deltaX, deltaY)
*/
static int
-GetTextIndex(interp, canvas, itemPtr, obj, indexPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item for which the index is being
+GetTextIndex(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
- Tcl_Obj *obj; /* Specification of a particular character
- * in itemPtr's text. */
- int *indexPtr; /* Where to store converted character
+ Tcl_Obj *obj, /* Specification of a particular character in
+ * itemPtr's text. */
+ int *indexPtr) /* Where to store converted character
* index. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- int c, length;
+ int length;
+ int c;
TkCanvas *canvasPtr = (TkCanvas *) canvas;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
char *string = Tcl_GetStringFromObj(obj, &length);
@@ -1256,17 +1248,18 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr)
if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) {
*indexPtr = textPtr->numChars;
- } else if ((c=='i') && (strncmp(string, "insert", (unsigned) length)==0)) {
+ } else if ((c == 'i')
+ && (strncmp(string, "insert", (unsigned) length) == 0)) {
*indexPtr = textPtr->insertPos;
- } else if ((c=='s') && (strncmp(string, "sel.first", (unsigned) length)==0)
- && (length >= 5)) {
+ } else if ((c == 's') && (length >= 5)
+ && (strncmp(string, "sel.first", (unsigned) length) == 0)) {
if (textInfoPtr->selItemPtr != itemPtr) {
Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC);
return TCL_ERROR;
}
*indexPtr = textInfoPtr->selectFirst;
- } else if ((c=='s') && (strncmp(string, "sel.last", (unsigned) length)==0)
- && (length >= 5)) {
+ } else if ((c == 's') && (length >= 5)
+ && (strncmp(string, "sel.last", (unsigned) length) == 0)) {
if (textInfoPtr->selItemPtr != itemPtr) {
Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC);
return TCL_ERROR;
@@ -1292,7 +1285,7 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr)
*indexPtr = Tk_PointToChar(textPtr->textLayout,
x + canvasPtr->scrollX1 - textPtr->leftEdge,
y + canvasPtr->scrollY1 - textPtr->header.y1);
- } else if (Tcl_GetIntFromObj((Tcl_Interp *)NULL, obj, indexPtr) == TCL_OK) {
+ } else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) {
if (*indexPtr < 0){
*indexPtr = 0;
} else if (*indexPtr > textPtr->numChars) {
@@ -1300,14 +1293,13 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr)
}
} else {
/*
- * Some of the paths here leave messages in the interp's result,
- * so we have to clear it out before storing our own message.
+ * Some of the paths here leave messages in the interp's result, so we
+ * have to clear it out before storing our own message.
*/
- badIndex:
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
- Tcl_AppendResult(interp, "bad index \"", string, "\"",
- (char *) NULL);
+ badIndex:
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
+ Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1331,18 +1323,18 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr)
/* ARGSUSED */
static void
-SetTextCursor(canvas, itemPtr, index)
- Tk_Canvas canvas; /* Record describing canvas widget. */
- Tk_Item *itemPtr; /* Text item in which cursor position is to
- * be set. */
- int index; /* Character index of character just before
+SetTextCursor(
+ Tk_Canvas canvas, /* Record describing canvas widget. */
+ Tk_Item *itemPtr, /* Text item in which cursor position is to be
+ * set. */
+ int index) /* Character index of character just before
* which cursor is to be positioned. */
{
TextItem *textPtr = (TextItem *) itemPtr;
if (index < 0) {
textPtr->insertPos = 0;
- } else if (index > textPtr->numChars) {
+ } else if (index > textPtr->numChars) {
textPtr->insertPos = textPtr->numChars;
} else {
textPtr->insertPos = index;
@@ -1354,15 +1346,14 @@ SetTextCursor(canvas, itemPtr, index)
*
* GetSelText --
*
- * This procedure is invoked to return the selected portion
- * of a text item. It is only called when this item has
- * the selection.
+ * This function is invoked to return the selected portion of a text
+ * item. It is only called when this item has the selection.
*
* Results:
- * The return value is the number of non-NULL bytes stored
- * at buffer. Buffer is filled (or partially filled) with a
- * NULL-terminated string containing part or all of the selection,
- * as given by offset and maxBytes.
+ * The return value is the number of non-NULL bytes stored at buffer.
+ * Buffer is filled (or partially filled) with a NULL-terminated string
+ * containing part or all of the selection, as given by offset and
+ * maxBytes.
*
* Side effects:
* None.
@@ -1371,18 +1362,18 @@ SetTextCursor(canvas, itemPtr, index)
*/
static int
-GetSelText(canvas, itemPtr, offset, buffer, maxBytes)
- Tk_Canvas canvas; /* Canvas containing selection. */
- Tk_Item *itemPtr; /* Text item containing selection. */
- int offset; /* Byte offset within selection of first
+GetSelText(
+ Tk_Canvas canvas, /* Canvas containing selection. */
+ Tk_Item *itemPtr, /* Text item containing selection. */
+ int offset, /* Byte offset within selection of first
* character to be returned. */
- char *buffer; /* Location in which to place selection. */
- int maxBytes; /* Maximum number of bytes to place at
- * buffer, not including terminating NULL
+ char *buffer, /* Location in which to place selection. */
+ int maxBytes) /* Maximum number of bytes to place at buffer,
+ * not including terminating NULL
* character. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- int byteCount;
+ int byteCount;
char *text;
CONST char *selStart, *selEnd;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
@@ -1412,15 +1403,13 @@ GetSelText(canvas, itemPtr, offset, buffer, maxBytes)
*
* TextToPostscript --
*
- * This procedure is called to generate Postscript for
- * text items.
+ * This function is called to generate Postscript for text items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in the interp's result, replacing whatever used
- * to be there. If no error occurs, then Postscript for the
- * item is appended to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in the interp's
+ * result, replacing whatever used to be there. If no error occurs, then
+ * Postscript for the item is appended to the result.
*
* Side effects:
* None.
@@ -1429,13 +1418,13 @@ GetSelText(canvas, itemPtr, offset, buffer, maxBytes)
*/
static int
-TextToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Leave Postscript or error message here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is wanted. */
- int prepass; /* 1 means this is a prepass to collect
- * font information; 0 means final Postscript
- * is being created. */
+TextToPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created. */
{
TextItem *textPtr = (TextItem *) itemPtr;
int x, y;
@@ -1446,7 +1435,7 @@ TextToPostscript(interp, canvas, itemPtr, prepass)
Pixmap stipple;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
color = textPtr->color;
@@ -1480,41 +1469,53 @@ TextToPostscript(interp, canvas, itemPtr, prepass)
return TCL_ERROR;
}
if (stipple != None) {
- Tcl_AppendResult(interp, "/StippleText {\n ",
- (char *) NULL);
+ Tcl_AppendResult(interp, "/StippleText {\n ", NULL);
Tk_CanvasPsStipple(interp, canvas, stipple);
- Tcl_AppendResult(interp, "} bind def\n", (char *) NULL);
+ Tcl_AppendResult(interp, "} bind def\n", NULL);
}
sprintf(buffer, "%.15g %.15g [\n", textPtr->x,
Tk_CanvasPsY(canvas, textPtr->y));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
Tk_TextLayoutToPostscript(interp, textPtr->textLayout);
x = 0; y = 0; justify = NULL; /* lint. */
switch (textPtr->anchor) {
- case TK_ANCHOR_NW: x = 0; y = 0; break;
- case TK_ANCHOR_N: x = 1; y = 0; break;
- case TK_ANCHOR_NE: x = 2; y = 0; break;
- case TK_ANCHOR_E: x = 2; y = 1; break;
- case TK_ANCHOR_SE: x = 2; y = 2; break;
- case TK_ANCHOR_S: x = 1; y = 2; break;
- case TK_ANCHOR_SW: x = 0; y = 2; break;
- case TK_ANCHOR_W: x = 0; y = 1; break;
- case TK_ANCHOR_CENTER: x = 1; y = 1; break;
+ case TK_ANCHOR_NW: x = 0; y = 0; break;
+ case TK_ANCHOR_N: x = 1; y = 0; break;
+ case TK_ANCHOR_NE: x = 2; y = 0; break;
+ case TK_ANCHOR_E: x = 2; y = 1; break;
+ case TK_ANCHOR_SE: x = 2; y = 2; break;
+ case TK_ANCHOR_S: x = 1; y = 2; break;
+ case TK_ANCHOR_SW: x = 0; y = 2; break;
+ case TK_ANCHOR_W: x = 0; y = 1; break;
+ case TK_ANCHOR_CENTER: x = 1; y = 1; break;
}
switch (textPtr->justify) {
- case TK_JUSTIFY_LEFT: justify = "0"; break;
- case TK_JUSTIFY_CENTER: justify = "0.5";break;
- case TK_JUSTIFY_RIGHT: justify = "1"; break;
+ case TK_JUSTIFY_LEFT: justify = "0"; break;
+ case TK_JUSTIFY_CENTER: justify = "0.5"; break;
+ case TK_JUSTIFY_RIGHT: justify = "1"; break;
}
Tk_GetFontMetrics(textPtr->tkfont, &fm);
- sprintf(buffer, "] %d %g %g %s %s DrawText\n",
- fm.linespace, x / -2.0, y / 2.0, justify,
- ((stipple == None) ? "false" : "true"));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ sprintf(buffer, "] %d ", fm.linespace);
+ Tcl_AppendResult(interp, buffer, NULL);
+ Tcl_PrintDouble(NULL, x / -2.0, buffer);
+ Tcl_AppendResult(interp, buffer, NULL);
+ Tcl_PrintDouble(NULL, y / 2.0, buffer);
+ Tcl_AppendResult(interp, " ", buffer, NULL);
+ sprintf(buffer, " %s %s DrawText\n",
+ justify, ((stipple == None) ? "false" : "true"));
+ Tcl_AppendResult(interp, buffer, NULL);
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 8ad3b5c..eca3789 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -1,29 +1,64 @@
-/*
+/*
* tkCanvUtil.c --
*
- * This procedure contains a collection of utility procedures
- * used by the implementations of various canvas item types.
+ * This file contains a collection of utility functions used by the
+ * implementations of various canvas item types.
*
* Copyright (c) 1994 Sun Microsystems, Inc.
- * Copyright (c) 1994 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
#include "tkCanvas.h"
-#include "tkPort.h"
#include <assert.h>
+/*
+ * Structures defined only in this file.
+ */
+
+typedef struct SmoothAssocData {
+ struct SmoothAssocData *nextPtr;
+ /* Pointer to next SmoothAssocData. */
+ Tk_SmoothMethod smooth; /* Name and functions associated with this
+ * option. */
+} SmoothAssocData;
+
+Tk_SmoothMethod tkBezierSmoothMethod = {
+ "true",
+ TkMakeBezierCurve,
+ (void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
+ int numPoints, int numSteps)) TkMakeBezierPostscript,
+};
+static Tk_SmoothMethod tkRawSmoothMethod = {
+ "raw",
+ TkMakeRawCurve,
+ (void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
+ int numPoints, int numSteps)) TkMakeRawCurvePostscript,
+};
+
+/*
+ * Function forward-declarations.
+ */
+
+static void SmoothMethodCleanupProc(ClientData clientData,
+ Tcl_Interp *interp);
+static SmoothAssocData *InitSmoothMethods(Tcl_Interp *interp);
+static int DashConvert(char *l, CONST char *p, int n,
+ double width);
+static void TranslateAndAppendCoords(TkCanvas *canvPtr,
+ double x, double y, XPoint *outArr, int numOut);
+
+#define ABS(a) ((a>=0)?(a):(-(a)))
/*
*----------------------------------------------------------------------
*
* Tk_CanvasTkwin --
*
- * Given a token for a canvas, this procedure returns the
- * widget that represents the canvas.
+ * Given a token for a canvas, this function returns the widget that
+ * represents the canvas.
*
* Results:
* The return value is a handle for the widget.
@@ -35,8 +70,8 @@
*/
Tk_Window
-Tk_CanvasTkwin(canvas)
- Tk_Canvas canvas; /* Token for the canvas. */
+Tk_CanvasTkwin(
+ Tk_Canvas canvas) /* Token for the canvas. */
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
return canvasPtr->tkwin;
@@ -47,16 +82,15 @@ Tk_CanvasTkwin(canvas)
*
* Tk_CanvasDrawableCoords --
*
- * Given an (x,y) coordinate pair within a canvas, this procedure
+ * Given an (x,y) coordinate pair within a canvas, this function
* returns the corresponding coordinates at which the point should
* be drawn in the drawable used for display.
*
* Results:
- * There is no return value. The values at *drawableXPtr and
- * *drawableYPtr are filled in with the coordinates at which
- * x and y should be drawn. These coordinates are clipped
- * to fit within a "short", since this is what X uses in
- * most cases for drawing.
+ * There is no return value. The values at *drawableXPtr and
+ * *drawableYPtr are filled in with the coordinates at which x and y
+ * should be drawn. These coordinates are clipped to fit within a
+ * "short", since this is what X uses in most cases for drawing.
*
* Side effects:
* None.
@@ -65,11 +99,12 @@ Tk_CanvasTkwin(canvas)
*/
void
-Tk_CanvasDrawableCoords(canvas, x, y, drawableXPtr, drawableYPtr)
- Tk_Canvas canvas; /* Token for the canvas. */
- double x, y; /* Coordinates in canvas space. */
- short *drawableXPtr, *drawableYPtr; /* Screen coordinates are stored
- * here. */
+Tk_CanvasDrawableCoords(
+ Tk_Canvas canvas, /* Token for the canvas. */
+ double x, /* Coordinates in canvas space. */
+ double y,
+ short *drawableXPtr, /* Screen coordinates are stored here. */
+ short *drawableYPtr)
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
double tmp;
@@ -88,7 +123,7 @@ Tk_CanvasDrawableCoords(canvas, x, y, drawableXPtr, drawableYPtr)
*drawableXPtr = (short) tmp;
}
- tmp = y - canvasPtr->drawableYOrigin;
+ tmp = y - canvasPtr->drawableYOrigin;
if (tmp > 0) {
tmp += 0.5;
} else {
@@ -108,15 +143,14 @@ Tk_CanvasDrawableCoords(canvas, x, y, drawableXPtr, drawableYPtr)
*
* Tk_CanvasWindowCoords --
*
- * Given an (x,y) coordinate pair within a canvas, this procedure
- * returns the corresponding coordinates in the canvas's window.
+ * Given an (x,y) coordinate pair within a canvas, this function returns
+ * the corresponding coordinates in the canvas's window.
*
* Results:
- * There is no return value. The values at *screenXPtr and
- * *screenYPtr are filled in with the coordinates at which
- * (x,y) appears in the canvas's window. These coordinates
- * are clipped to fit within a "short", since this is what X
- * uses in most cases for drawing.
+ * There is no return value. The values at *screenXPtr and *screenYPtr
+ * are filled in with the coordinates at which (x,y) appears in the
+ * canvas's window. These coordinates are clipped to fit within a
+ * "short", since this is what X uses in most cases for drawing.
*
* Side effects:
* None.
@@ -125,11 +159,12 @@ Tk_CanvasDrawableCoords(canvas, x, y, drawableXPtr, drawableYPtr)
*/
void
-Tk_CanvasWindowCoords(canvas, x, y, screenXPtr, screenYPtr)
- Tk_Canvas canvas; /* Token for the canvas. */
- double x, y; /* Coordinates in canvas space. */
- short *screenXPtr, *screenYPtr; /* Screen coordinates are stored
- * here. */
+Tk_CanvasWindowCoords(
+ Tk_Canvas canvas, /* Token for the canvas. */
+ double x, /* Coordinates in canvas space. */
+ double y,
+ short *screenXPtr, /* Screen coordinates are stored here. */
+ short *screenYPtr)
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
double tmp;
@@ -148,7 +183,7 @@ Tk_CanvasWindowCoords(canvas, x, y, screenXPtr, screenYPtr)
*screenXPtr = (short) tmp;
}
- tmp = y - canvasPtr->yOrigin;
+ tmp = y - canvasPtr->yOrigin;
if (tmp > 0) {
tmp += 0.5;
} else {
@@ -172,11 +207,10 @@ Tk_CanvasWindowCoords(canvas, x, y, screenXPtr, screenYPtr)
* corresponding to that string.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * canvas coordinate is stored at *doublePtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the canvas coordinate is
+ * stored at *doublePtr; otherwise TCL_ERROR is returned and an error
+ * message is left in the interp's result.
*
* Side effects:
* None.
@@ -185,14 +219,15 @@ Tk_CanvasWindowCoords(canvas, x, y, screenXPtr, screenYPtr)
*/
int
-Tk_CanvasGetCoord(interp, canvas, string, doublePtr)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to which coordinate applies. */
- CONST char *string; /* Describes coordinate (any screen
- * coordinate form may be used here). */
- double *doublePtr; /* Place to store converted coordinate. */
+Tk_CanvasGetCoord(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to which coordinate applies. */
+ CONST char *string, /* Describes coordinate (any screen coordinate
+ * form may be used here). */
+ double *doublePtr) /* Place to store converted coordinate. */
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
+
if (Tk_GetScreenMM(canvasPtr->interp, canvasPtr->tkwin, string,
doublePtr) != TCL_OK) {
return TCL_ERROR;
@@ -210,11 +245,10 @@ Tk_CanvasGetCoord(interp, canvas, string, doublePtr)
* corresponding to that string.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * canvas coordinate is stored at *doublePtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * interp->result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the canvas coordinate is
+ * stored at *doublePtr; otherwise TCL_ERROR is returned and an error
+ * message is left in interp->result.
*
* Side effects:
* None.
@@ -223,20 +257,16 @@ Tk_CanvasGetCoord(interp, canvas, string, doublePtr)
*/
int
-Tk_CanvasGetCoordFromObj(interp, canvas, obj, doublePtr)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to which coordinate applies. */
- Tcl_Obj *obj; /* Describes coordinate (any screen
- * coordinate form may be used here). */
- double *doublePtr; /* Place to store converted coordinate. */
+Tk_CanvasGetCoordFromObj(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to which coordinate applies. */
+ Tcl_Obj *obj, /* Describes coordinate (any screen coordinate
+ * form may be used here). */
+ double *doublePtr) /* Place to store converted coordinate. */
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
- if (Tk_GetMMFromObj(canvasPtr->interp, canvasPtr->tkwin, obj,
- doublePtr) != TCL_OK) {
- return TCL_ERROR;
- }
- *doublePtr *= canvasPtr->pixelsPerMM;
- return TCL_OK;
+
+ return Tk_GetDoublePixelsFromObj(canvasPtr->interp, canvasPtr->tkwin, obj, doublePtr);
}
/*
@@ -244,9 +274,9 @@ Tk_CanvasGetCoordFromObj(interp, canvas, obj, doublePtr)
*
* Tk_CanvasSetStippleOrigin --
*
- * This procedure sets the stipple origin in a graphics context
- * so that stipples drawn with the GC will line up with other
- * stipples previously drawn in the canvas.
+ * This function sets the stipple origin in a graphics context so that
+ * stipples drawn with the GC will line up with other stipples previously
+ * drawn in the canvas.
*
* Results:
* None.
@@ -258,12 +288,11 @@ Tk_CanvasGetCoordFromObj(interp, canvas, obj, doublePtr)
*/
void
-Tk_CanvasSetStippleOrigin(canvas, gc)
- Tk_Canvas canvas; /* Token for a canvas. */
- GC gc; /* Graphics context that is about to be
- * used to draw a stippled pattern as
- * part of redisplaying the canvas. */
-
+Tk_CanvasSetStippleOrigin(
+ Tk_Canvas canvas, /* Token for a canvas. */
+ GC gc) /* Graphics context that is about to be used
+ * to draw a stippled pattern as part of
+ * redisplaying the canvas. */
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
@@ -276,9 +305,9 @@ Tk_CanvasSetStippleOrigin(canvas, gc)
*
* Tk_CanvasSetOffset--
*
- * This procedure sets the stipple offset in a graphics
- * context so that stipples drawn with the GC will
- * line up with other stipples with the same offset.
+ * This function sets the stipple offset in a graphics context so that
+ * stipples drawn with the GC will line up with other stipples with the
+ * same offset.
*
* Results:
* None.
@@ -290,12 +319,12 @@ Tk_CanvasSetStippleOrigin(canvas, gc)
*/
void
-Tk_CanvasSetOffset(canvas, gc, offset)
- Tk_Canvas canvas; /* Token for a canvas. */
- GC gc; /* Graphics context that is about to be
- * used to draw a stippled pattern as
- * part of redisplaying the canvas. */
- Tk_TSOffset *offset; /* offset (may be NULL pointer)*/
+Tk_CanvasSetOffset(
+ Tk_Canvas canvas, /* Token for a canvas. */
+ GC gc, /* Graphics context that is about to be used
+ * to draw a stippled pattern as part of
+ * redisplaying the canvas. */
+ Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
int flags = 0;
@@ -320,17 +349,16 @@ Tk_CanvasSetOffset(canvas, gc, offset)
*
* Tk_CanvasGetTextInfo --
*
- * This procedure returns a pointer to a structure containing
- * information about the selection and insertion cursor for
- * a canvas widget. Items such as text items save the pointer
- * and use it to share access to the information with the generic
- * canvas code.
+ * This function returns a pointer to a structure containing information
+ * about the selection and insertion cursor for a canvas widget. Items
+ * such as text items save the pointer and use it to share access to the
+ * information with the generic canvas code.
*
* Results:
* The return value is a pointer to the structure holding text
- * information for the canvas. Most of the fields should not
- * be modified outside the generic canvas code; see the user
- * documentation for details.
+ * information for the canvas. Most of the fields should not be modified
+ * outside the generic canvas code; see the user documentation for
+ * details.
*
* Side effects:
* None.
@@ -339,8 +367,8 @@ Tk_CanvasSetOffset(canvas, gc, offset)
*/
Tk_CanvasTextInfo *
-Tk_CanvasGetTextInfo(canvas)
- Tk_Canvas canvas; /* Token for the canvas widget. */
+Tk_CanvasGetTextInfo(
+ Tk_Canvas canvas) /* Token for the canvas widget. */
{
return &((TkCanvas *) canvas)->textInfo;
}
@@ -350,28 +378,27 @@ Tk_CanvasGetTextInfo(canvas)
*
* Tk_CanvasTagsParseProc --
*
- * This procedure is invoked during option processing to handle
- * "-tags" options for canvas items.
+ * This function is invoked during option processing to handle "-tags"
+ * options for canvas items.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * The tags for a given item get replaced by those indicated
- * in the value argument.
+ * The tags for a given item get replaced by those indicated in the value
+ * argument.
*
*--------------------------------------------------------------
*/
int
-Tk_CanvasTagsParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* Not used.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option (list of tag
- * names). */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item (ignored). */
+Tk_CanvasTagsParseProc(
+ ClientData clientData, /* Not used.*/
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ CONST char *value, /* Value of option (list of tag names). */
+ char *widgRec, /* Pointer to record for item. */
+ int offset) /* Offset into item (ignored). */
{
register Tk_Item *itemPtr = (Tk_Item *) widgRec;
int argc, i;
@@ -387,8 +414,7 @@ Tk_CanvasTagsParseProc(clientData, interp, tkwin, value, widgRec, offset)
}
/*
- * Make sure that there's enough space in the item to hold the
- * tag names.
+ * Make sure that there's enough space in the item to hold the tag names.
*/
if (itemPtr->tagSpace < argc) {
@@ -415,16 +441,16 @@ Tk_CanvasTagsParseProc(clientData, interp, tkwin, value, widgRec, offset)
*
* Tk_CanvasTagsPrintProc --
*
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-tags" configuration
- * option for canvas items.
+ * This function is invoked by the Tk configuration code to produce a
+ * printable string for the "-tags" configuration option for canvas
+ * items.
*
* Results:
- * The return value is a string describing all the tags for
- * the item referred to by "widgRec". In addition, *freeProcPtr
- * is filled in with the address of a procedure to call to free
- * the result string when it's no longer needed (or NULL to
- * indicate that the string doesn't need to be freed).
+ * The return value is a string describing all the tags for the item
+ * referred to by "widgRec". In addition, *freeProcPtr is filled in with
+ * the address of a function to call to free the result string when it's
+ * no longer needed (or NULL to indicate that the string doesn't need to
+ * be freed).
*
* Side effects:
* None.
@@ -433,61 +459,55 @@ Tk_CanvasTagsParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
char *
-Tk_CanvasTagsPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Ignored. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
+Tk_CanvasTagsPrintProc(
+ ClientData clientData, /* Ignored. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset, /* Ignored. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ * information about how to reclaim storage
+ * for return string. */
{
register Tk_Item *itemPtr = (Tk_Item *) widgRec;
if (itemPtr->numTags == 0) {
- *freeProcPtr = (Tcl_FreeProc *) NULL;
+ *freeProcPtr = NULL;
return "";
}
if (itemPtr->numTags == 1) {
- *freeProcPtr = (Tcl_FreeProc *) NULL;
+ *freeProcPtr = NULL;
return (char *) itemPtr->tagPtr[0];
}
*freeProcPtr = TCL_DYNAMIC;
return Tcl_Merge(itemPtr->numTags, (CONST char **) itemPtr->tagPtr);
}
-
-static int DashConvert _ANSI_ARGS_((char *l, CONST char *p,
- int n, double width));
-#define ABS(a) ((a>=0)?(a):(-(a)))
-
/*
*--------------------------------------------------------------
*
* TkCanvasDashParseProc --
*
- * This procedure is invoked during option processing to handle
- * "-dash", "-activedash" and "-disableddash" options for canvas
- * objects.
+ * This function is invoked during option processing to handle "-dash",
+ * "-activedash" and "-disableddash" options for canvas objects.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * The dash list for a given canvas object gets replaced by
- * those indicated in the value argument.
+ * The dash list for a given canvas object gets replaced by those
+ * indicated in the value argument.
*
*--------------------------------------------------------------
*/
int
-TkCanvasDashParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* Not used.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
+TkCanvasDashParseProc(
+ ClientData clientData, /* Not used.*/
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ CONST char *value, /* Value of option. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset) /* Offset into item. */
{
return Tk_GetDash(interp, value, (Tk_Dash *)(widgRec+offset));
}
@@ -497,16 +517,16 @@ TkCanvasDashParseProc(clientData, interp, tkwin, value, widgRec, offset)
*
* TkCanvasDashPrintProc --
*
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-dash", "-activedash"
- * and "-disableddash" configuration options for canvas items.
+ * This function is invoked by the Tk configuration code to produce a
+ * printable string for the "-dash", "-activedash" and "-disableddash"
+ * configuration options for canvas items.
*
* Results:
- * The return value is a string describing all the dash list for
- * the item referred to by "widgRec"and "offset". In addition,
- * *freeProcPtr is filled in with the address of a procedure to
- * call to free the result string when it's no longer needed (or
- * NULL to indicate that the string doesn't need to be freed).
+ * The return value is a string describing all the dash list for the item
+ * referred to by "widgRec"and "offset". In addition, *freeProcPtr is
+ * filled in with the address of a function to call to free the result
+ * string when it's no longer needed (or NULL to indicate that the string
+ * doesn't need to be freed).
*
* Side effects:
* None.
@@ -515,14 +535,14 @@ TkCanvasDashParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
char *
-TkCanvasDashPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset in record for item. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
+TkCanvasDashPrintProc(
+ ClientData clientData, /* Ignored. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset, /* Offset in record for item. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ * information about how to reclaim storage
+ * for return string. */
{
Tk_Dash *dash = (Tk_Dash *) (widgRec+offset);
char *buffer;
@@ -533,18 +553,18 @@ TkCanvasDashPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
i = -i;
*freeProcPtr = TCL_DYNAMIC;
buffer = (char *) ckalloc((unsigned int) (i+1));
- p = (i > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
+ p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
memcpy(buffer, p, (unsigned int) i);
buffer[i] = 0;
return buffer;
} else if (!i) {
- *freeProcPtr = (Tcl_FreeProc *) NULL;
+ *freeProcPtr = NULL;
return "";
}
buffer = (char *)ckalloc((unsigned int) (4*i));
*freeProcPtr = TCL_DYNAMIC;
- p = (i > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
+ p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
sprintf(buffer, "%d", *p++ & 0xff);
while(--i) {
sprintf(buffer+strlen(buffer), " %d", *p++ & 0xff);
@@ -555,46 +575,80 @@ TkCanvasDashPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
/*
*--------------------------------------------------------------
*
- * Tk_CreateSmoothMethod --
+ * InitSmoothMethods --
*
- * This procedure is invoked to add additional values
- * for the "-smooth" option to the list.
+ * This function is invoked to set up the initial state of the list of
+ * "-smooth" methods. It should only be called when the list installed
+ * in the interpreter is NULL.
*
* Results:
- * A standard Tcl return value.
+ * Pointer to the start of the list of default smooth methods.
*
* Side effects:
- * In the future "-smooth <name>" will be accepted as
- * smooth method for the line and polygon.
+ * A linked list of smooth methods is created and attached to the
+ * interpreter's association key "smoothMethod"
*
*--------------------------------------------------------------
*/
-Tk_SmoothMethod tkBezierSmoothMethod = {
- "bezier",
- TkMakeBezierCurve,
- (void (*) _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas,
- double *coordPtr, int numPoints, int numSteps)))
- TkMakeBezierPostscript,
-};
+static SmoothAssocData *
+InitSmoothMethods(
+ Tcl_Interp *interp)
+{
+ SmoothAssocData *methods, *ptr;
-static void SmoothMethodCleanupProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp));
+ methods = (SmoothAssocData *) ckalloc(sizeof(SmoothAssocData));
+ methods->smooth.name = tkRawSmoothMethod.name;
+ methods->smooth.coordProc = tkRawSmoothMethod.coordProc;
+ methods->smooth.postscriptProc = tkRawSmoothMethod.postscriptProc;
-typedef struct SmoothAssocData {
- struct SmoothAssocData *nextPtr; /* pointer to next SmoothAssocData */
- Tk_SmoothMethod smooth; /* name and functions associated with this
- * option */
-} SmoothAssocData;
+ methods->nextPtr = (SmoothAssocData *) ckalloc(sizeof(SmoothAssocData));
+
+ ptr = methods->nextPtr;
+ ptr->smooth.name = tkBezierSmoothMethod.name;
+ ptr->smooth.coordProc = tkBezierSmoothMethod.coordProc;
+ ptr->smooth.postscriptProc = tkBezierSmoothMethod.postscriptProc;
+ ptr->nextPtr = NULL;
+
+ Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc,
+ (ClientData) methods);
+ return methods;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * Tk_CreateSmoothMethod --
+ *
+ * This function is invoked to add additional values for the "-smooth"
+ * option to the list.
+ *
+ * Results:
+ * A standard Tcl return value.
+ *
+ * Side effects:
+ * In the future "-smooth <name>" will be accepted as smooth method for
+ * the line and polygon.
+ *
+ *--------------------------------------------------------------
+ */
void
-Tk_CreateSmoothMethod(interp, smooth)
- Tcl_Interp *interp;
- Tk_SmoothMethod *smooth;
+Tk_CreateSmoothMethod(
+ Tcl_Interp *interp,
+ Tk_SmoothMethod *smooth)
{
SmoothAssocData *methods, *typePtr2, *prevPtr, *ptr;
methods = (SmoothAssocData *) Tcl_GetAssocData(interp, "smoothMethod",
- (Tcl_InterpDeleteProc **) NULL);
+ NULL);
+
+ /*
+ * Initialize if we were not previously initialized.
+ */
+
+ if (methods == NULL) {
+ methods = InitSmoothMethods(interp);
+ }
/*
* If there's already a smooth method with the given name, remove it.
@@ -618,15 +672,16 @@ Tk_CreateSmoothMethod(interp, smooth)
ptr->smooth.postscriptProc = smooth->postscriptProc;
ptr->nextPtr = methods;
Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc,
- (ClientData) ptr);
+ (ClientData) ptr);
}
+
/*
*----------------------------------------------------------------------
*
* SmoothMethodCleanupProc --
*
- * This procedure is invoked whenever an interpreter is deleted
- * to cleanup the smooth methods.
+ * This function is invoked whenever an interpreter is deleted to
+ * cleanup the smooth methods.
*
* Results:
* None.
@@ -638,10 +693,10 @@ Tk_CreateSmoothMethod(interp, smooth)
*/
static void
-SmoothMethodCleanupProc(clientData, interp)
- ClientData clientData; /* Points to "smoothMethod" AssocData
- * for the interpreter. */
- Tcl_Interp *interp; /* Interpreter that is being deleted. */
+SmoothMethodCleanupProc(
+ ClientData clientData, /* Points to "smoothMethod" AssocData for the
+ * interpreter. */
+ Tcl_Interp *interp) /* Interpreter that is being deleted. */
{
SmoothAssocData *ptr, *methods = (SmoothAssocData *) clientData;
@@ -655,8 +710,8 @@ SmoothMethodCleanupProc(clientData, interp)
*
* TkSmoothParseProc --
*
- * This procedure is invoked during option processing to handle
- * the "-smooth" option.
+ * This function is invoked during option processing to handle the
+ * "-smooth" option.
*
* Results:
* A standard Tcl return value.
@@ -669,33 +724,54 @@ SmoothMethodCleanupProc(clientData, interp)
*/
int
-TkSmoothParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* some flags.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
+TkSmoothParseProc(
+ ClientData clientData, /* some flags.*/
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ CONST char *value, /* Value of option. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset) /* Offset into item. */
{
register Tk_SmoothMethod **smoothPtr =
- (Tk_SmoothMethod **) (widgRec + offset);
+ (Tk_SmoothMethod **) (widgRec + offset);
Tk_SmoothMethod *smooth = NULL;
int b;
size_t length;
SmoothAssocData *methods;
if (value == NULL || *value == 0) {
- *smoothPtr = (Tk_SmoothMethod *) NULL;
+ *smoothPtr = NULL;
return TCL_OK;
}
length = strlen(value);
methods = (SmoothAssocData *) Tcl_GetAssocData(interp, "smoothMethod",
- (Tcl_InterpDeleteProc **) NULL);
- while (methods != (SmoothAssocData *) NULL) {
+ NULL);
+
+ /*
+ * Not initialized yet; fix that now.
+ */
+
+ if (methods == NULL) {
+ methods = InitSmoothMethods(interp);
+ }
+
+ /*
+ * Backward compatability hack.
+ */
+
+ if (strncmp(value, "bezier", length) == 0) {
+ smooth = &tkBezierSmoothMethod;
+ }
+
+ /*
+ * Search the list of installed smooth methods.
+ */
+
+ while (methods != NULL) {
if (strncmp(value, methods->smooth.name, length) == 0) {
- if (smooth != (Tk_SmoothMethod *) NULL) {
- Tcl_AppendResult(interp, "ambigeous smooth method \"", value,
- "\"", (char *) NULL);
+ if (smooth != NULL) {
+ Tcl_AppendResult(interp, "ambiguous smooth method \"", value,
+ "\"", NULL);
return TCL_ERROR;
}
smooth = &methods->smooth;
@@ -705,19 +781,16 @@ TkSmoothParseProc(clientData, interp, tkwin, value, widgRec, offset)
if (smooth) {
*smoothPtr = smooth;
return TCL_OK;
- } else if (strncmp(value, tkBezierSmoothMethod.name, length) == 0) {
- /*
- * We need to do handle the built-in bezier method.
- */
- *smoothPtr = &tkBezierSmoothMethod;
- return TCL_OK;
}
+ /*
+ * Did not find it. Try parsing as a boolean instead.
+ */
if (Tcl_GetBoolean(interp, (char *) value, &b) != TCL_OK) {
return TCL_ERROR;
}
- *smoothPtr = b ? &tkBezierSmoothMethod : (Tk_SmoothMethod*) NULL;
+ *smoothPtr = b ? &tkBezierSmoothMethod : NULL;
return TCL_OK;
}
/*
@@ -725,16 +798,15 @@ TkSmoothParseProc(clientData, interp, tkwin, value, widgRec, offset)
*
* TkSmoothPrintProc --
*
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-smooth"
- * configuration option.
+ * This function is invoked by the Tk configuration code to produce a
+ * printable string for the "-smooth" configuration option.
*
* Results:
- * The return value is a string describing the smooth option for
- * the item referred to by "widgRec". In addition, *freeProcPtr
- * is filled in with the address of a procedure to call to free
- * the result string when it's no longer needed (or NULL to
- * indicate that the string doesn't need to be freed).
+ * The return value is a string describing the smooth option for the item
+ * referred to by "widgRec". In addition, *freeProcPtr is filled in with
+ * the address of a function to call to free the result string when it's
+ * no longer needed (or NULL to indicate that the string doesn't need to
+ * be freed).
*
* Side effects:
* None.
@@ -743,16 +815,17 @@ TkSmoothParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
char *
-TkSmoothPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
+TkSmoothPrintProc(
+ ClientData clientData, /* Ignored. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset, /* Offset into item. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ * information about how to reclaim storage
+ * for return string. */
{
- register Tk_SmoothMethod **smoothPtr = (Tk_SmoothMethod **) (widgRec + offset);
+ register Tk_SmoothMethod **smoothPtr =
+ (Tk_SmoothMethod **) (widgRec + offset);
return (*smoothPtr) ? (*smoothPtr)->name : "0";
}
@@ -761,13 +834,12 @@ TkSmoothPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*
* Tk_GetDash
*
- * This procedure is used to parse a string, assuming
- * it is dash information.
+ * This function is used to parse a string, assuming it is dash
+ * information.
*
* Results:
- * The return value is a standard Tcl result: TCL_OK means
- * that the dash information was parsed ok, and
- * TCL_ERROR means it couldn't be parsed.
+ * The return value is a standard Tcl result: TCL_OK means that the dash
+ * information was parsed ok, and TCL_ERROR means it couldn't be parsed.
*
* Side effects:
* Dash information in the dash structure is updated.
@@ -776,29 +848,34 @@ TkSmoothPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*/
int
-Tk_GetDash(interp, value, dash)
- Tcl_Interp *interp; /* Used for error reporting. */
- CONST char *value; /* Textual specification of dash list. */
- Tk_Dash *dash; /* Pointer to record in which to
- * store dash information. */
+Tk_GetDash(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ CONST char *value, /* Textual specification of dash list. */
+ Tk_Dash *dash) /* Pointer to record in which to store dash
+ * information. */
{
int argc, i;
CONST char **largv, **argv = NULL;
char *pt;
- if ((value==(char *) NULL) || (*value==0) ) {
+ if ((value==NULL) || (*value==0) ) {
dash->number = 0;
return TCL_OK;
}
- if ((*value == '.') || (*value == ',') ||
- (*value == '-') || (*value == '_')) {
- i = DashConvert((char *) NULL, value, -1, 0.0);
+
+ /*
+ * switch is usually compiled more efficiently than a chain of conditions.
+ */
+
+ switch (*value) {
+ case '.': case ',': case '-': case '_':
+ i = DashConvert(NULL, value, -1, 0.0);
if (i>0) {
i = strlen(value);
} else {
goto badDashList;
}
- if (i > sizeof(char *)) {
+ if (i > (int)sizeof(char *)) {
dash->pattern.pt = pt = (char *) ckalloc(strlen(value));
} else {
pt = dash->pattern.array;
@@ -807,26 +884,16 @@ Tk_GetDash(interp, value, dash)
dash->number = -i;
return TCL_OK;
}
+
if (Tcl_SplitList(interp, (char *) value, &argc, &argv) != TCL_OK) {
Tcl_ResetResult(interp);
- badDashList:
- Tcl_AppendResult(interp, "bad dash list \"", value,
- "\": must be a list of integers or a format like \"-..\"",
- (char *) NULL);
- syntaxError:
- if (argv != NULL) {
- ckfree((char *) argv);
- }
- if (ABS(dash->number) > sizeof(char *))
- ckfree((char *) dash->pattern.pt);
- dash->number = 0;
- return TCL_ERROR;
+ goto badDashList;
}
- if (ABS(dash->number) > sizeof(char *)) {
+ if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
ckfree((char *) dash->pattern.pt);
}
- if (argc > sizeof(char *)) {
+ if (argc > (int)sizeof(char *)) {
dash->pattern.pt = pt = (char *) ckalloc((unsigned int) argc);
} else {
pt = dash->pattern.array;
@@ -834,23 +901,41 @@ Tk_GetDash(interp, value, dash)
dash->number = argc;
largv = argv;
- while(argc>0) {
- if (Tcl_GetInt(interp, *largv, &i) != TCL_OK ||
- i < 1 || i>255) {
+ while (argc>0) {
+ if (Tcl_GetInt(interp, *largv, &i) != TCL_OK || i < 1 || i>255) {
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "expected integer in the range 1..255 but got \"",
- *largv, "\"", (char *) NULL);
+ Tcl_AppendResult(interp,
+ "expected integer in the range 1..255 but got \"",
+ *largv, "\"", NULL);
goto syntaxError;
}
*pt++ = i;
- argc--; largv++;
+ argc--;
+ largv++;
}
-
+
if (argv != NULL) {
ckfree((char *) argv);
}
-
return TCL_OK;
+
+ /*
+ * Something went wrong. Generate error message, clean up and return.
+ */
+
+ badDashList:
+ Tcl_AppendResult(interp, "bad dash list \"", value,
+ "\": must be a list of integers or a format like \"-..\"",
+ NULL);
+ syntaxError:
+ if (argv != NULL) {
+ ckfree((char *) argv);
+ }
+ if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
+ ckfree((char *) dash->pattern.pt);
+ }
+ dash->number = 0;
+ return TCL_ERROR;
}
/*
@@ -858,8 +943,8 @@ Tk_GetDash(interp, value, dash)
*
* Tk_CreateOutline
*
- * This procedure initializes the Tk_Outline structure
- * with default values.
+ * This function initializes the Tk_Outline structure with default
+ * values.
*
* Results:
* None
@@ -870,8 +955,9 @@ Tk_GetDash(interp, value, dash)
*--------------------------------------------------------------
*/
-void Tk_CreateOutline(outline)
- Tk_Outline *outline;
+void
+Tk_CreateOutline(
+ Tk_Outline *outline) /* Outline structure to be filled in. */
{
outline->gc = None;
outline->width = 1.0;
@@ -897,8 +983,8 @@ void Tk_CreateOutline(outline)
*
* Tk_DeleteOutline
*
- * This procedure frees all memory that might be
- * allocated and referenced in the Tk_Outline structure.
+ * This function frees all memory that might be allocated and referenced
+ * in the Tk_Outline structure.
*
* Results:
* None
@@ -909,20 +995,21 @@ void Tk_CreateOutline(outline)
*--------------------------------------------------------------
*/
-void Tk_DeleteOutline(display, outline)
- Display *display; /* Display containing window */
- Tk_Outline *outline;
+void
+Tk_DeleteOutline(
+ Display *display, /* Display containing window. */
+ Tk_Outline *outline)
{
if (outline->gc != None) {
Tk_FreeGC(display, outline->gc);
}
- if (ABS(outline->dash.number) > sizeof(char *)) {
+ if ((unsigned int)ABS(outline->dash.number) > sizeof(char *)) {
ckfree((char *) outline->dash.pattern.pt);
}
- if (ABS(outline->activeDash.number) > sizeof(char *)) {
+ if ((unsigned int)ABS(outline->activeDash.number) > sizeof(char *)) {
ckfree((char *) outline->activeDash.pattern.pt);
}
- if (ABS(outline->disabledDash.number) > sizeof(char *)) {
+ if ((unsigned int)ABS(outline->disabledDash.number) > sizeof(char *)) {
ckfree((char *) outline->disabledDash.pattern.pt);
}
if (outline->color != NULL) {
@@ -950,15 +1037,14 @@ void Tk_DeleteOutline(display, outline)
*
* Tk_ConfigOutlineGC
*
- * This procedure should be called in the canvas object
- * during the configure command. The graphics context
- * description in gcValues is updated according to the
- * information in the dash structure, as far as possible.
+ * This function should be called in the canvas object during the
+ * configure command. The graphics context description in gcValues is
+ * updated according to the information in the dash structure, as far as
+ * possible.
*
* Results:
- * The return-value is a mask, indicating which
- * elements of gcValues have been updated.
- * 0 means there is no outline.
+ * The return-value is a mask, indicating which elements of gcValues have
+ * been updated. 0 means there is no outline.
*
* Side effects:
* GC information in gcValues is updated.
@@ -966,11 +1052,12 @@ void Tk_DeleteOutline(display, outline)
*--------------------------------------------------------------
*/
-int Tk_ConfigOutlineGC(gcValues, canvas, item, outline)
- XGCValues *gcValues;
- Tk_Canvas canvas;
- Tk_Item *item;
- Tk_Outline *outline;
+int
+Tk_ConfigOutlineGC(
+ XGCValues *gcValues,
+ Tk_Canvas canvas,
+ Tk_Item *item,
+ Tk_Outline *outline)
{
int mask = 0;
double width;
@@ -1015,7 +1102,7 @@ int Tk_ConfigOutlineGC(gcValues, canvas, item, outline)
if (outline->activeStipple!=None) {
stipple = outline->activeStipple;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (outline->disabledWidth>0) {
width = outline->disabledWidth;
}
@@ -1047,12 +1134,10 @@ int Tk_ConfigOutlineGC(gcValues, canvas, item, outline)
if (mask && (dash->number != 0)) {
gcValues->line_style = LineOnOffDash;
gcValues->dash_offset = outline->offset;
- if (dash->number >= 2) {
- gcValues->dashes = 4;
- } else if (dash->number > 0) {
+ if (dash->number > 0) {
gcValues->dashes = dash->pattern.array[0];
} else {
- gcValues->dashes = (char) (4 * width);
+ gcValues->dashes = (char) (4 * width + 0.5);
}
mask |= GCLineStyle|GCDashList|GCDashOffset;
}
@@ -1064,15 +1149,12 @@ int Tk_ConfigOutlineGC(gcValues, canvas, item, outline)
*
* Tk_ChangeOutlineGC
*
- * Updates the GC to represent the full information of
- * the dash structure. Partly this is already done in
- * Tk_ConfigOutlineGC().
- * This function should be called just before drawing
- * the dashed item.
+ * Updates the GC to represent the full information of the dash
+ * structure. Partly this is already done in Tk_ConfigOutlineGC(). This
+ * function should be called just before drawing the dashed item.
*
* Results:
- * 1 if there is a stipple pattern.
- * 0 otherwise.
+ * 1 if there is a stipple pattern, and 0 otherwise.
*
* Side effects:
* GC is updated.
@@ -1081,10 +1163,10 @@ int Tk_ConfigOutlineGC(gcValues, canvas, item, outline)
*/
int
-Tk_ChangeOutlineGC(canvas, item, outline)
- Tk_Canvas canvas;
- Tk_Item *item;
- Tk_Outline *outline;
+Tk_ChangeOutlineGC(
+ Tk_Canvas canvas,
+ Tk_Item *item,
+ Tk_Outline *outline)
{
CONST char *p;
double width;
@@ -1134,25 +1216,30 @@ Tk_ChangeOutlineGC(canvas, item, outline)
return 0;
}
- if ((dash->number<-1) || ((dash->number == -1) && (dash->pattern.array[1]!=','))) {
+ if ((dash->number<-1) ||
+ ((dash->number == -1) && (dash->pattern.array[0] != ','))) {
char *q;
int i = -dash->number;
- p = (i > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
+ p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
q = (char *) ckalloc(2*(unsigned int)i);
i = DashConvert(q, p, i, width);
- XSetDashes(((TkCanvas *)canvas)->display, outline->gc, outline->offset, q, i);
+ XSetDashes(((TkCanvas *)canvas)->display, outline->gc,
+ outline->offset, q, i);
ckfree(q);
- } else if ( dash->number>2 || (dash->number==2 &&
- (dash->pattern.array[0]!=dash->pattern.array[1]))) {
- p = (char *) (dash->number > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
- XSetDashes(((TkCanvas *)canvas)->display, outline->gc, outline->offset, p, dash->number);
+ } else if (dash->number>2 || (dash->number==2 &&
+ (dash->pattern.array[0]!=dash->pattern.array[1]))) {
+ p = (dash->number > (int)sizeof(char *))
+ ? dash->pattern.pt : dash->pattern.array;
+ XSetDashes(((TkCanvas *)canvas)->display, outline->gc,
+ outline->offset, p, dash->number);
}
if (stipple!=None) {
int w=0; int h=0;
Tk_TSOffset *tsoffset = &outline->tsoffset;
int flags = tsoffset->flags;
- if (!(flags & TK_OFFSET_INDEX) && (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) {
+ if (!(flags & TK_OFFSET_INDEX) &&
+ (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) {
Tk_SizeOfBitmap(((TkCanvas *)canvas)->display, stipple, &w, &h);
if (flags & TK_OFFSET_CENTER) {
w /= 2;
@@ -1181,26 +1268,24 @@ Tk_ChangeOutlineGC(canvas, item, outline)
*
* Tk_ResetOutlineGC
*
- * Restores the GC to the situation before
- * Tk_ChangeDashGC() was called.
- * This function should be called just after the dashed
- * item is drawn, because the GC is supposed to be
- * read-only.
+ * Restores the GC to the situation before Tk_ChangeDashGC() was called.
+ * This function should be called just after the dashed item is drawn,
+ * because the GC is supposed to be read-only.
*
* Results:
- * 1 if there is a stipple pattern.
- * 0 otherwise.
+ * 1 if there is a stipple pattern, and 0 otherwise.
*
* Side effects:
* GC is updated.
*
*--------------------------------------------------------------
*/
+
int
-Tk_ResetOutlineGC(canvas, item, outline)
- Tk_Canvas canvas;
- Tk_Item *item;
- Tk_Outline *outline;
+Tk_ResetOutlineGC(
+ Tk_Canvas canvas,
+ Tk_Item *item,
+ Tk_Outline *outline)
{
char dashList;
double width;
@@ -1232,7 +1317,7 @@ Tk_ResetOutlineGC(canvas, item, outline)
if (outline->activeStipple!=None) {
stipple = outline->activeStipple;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (outline->disabledWidth>width) {
width = outline->disabledWidth;
}
@@ -1251,14 +1336,12 @@ Tk_ResetOutlineGC(canvas, item, outline)
}
if ((dash->number > 2) || (dash->number < -1) || (dash->number==2 &&
- (dash->pattern.array[0] != dash->pattern.array[1])) ||
- ((dash->number == -1) && (dash->pattern.array[1] != ','))) {
- if (dash->number < 0) {
- dashList = (int) (4 * width + 0.5);
- } else if (dash->number<3) {
+ (dash->pattern.array[0] != dash->pattern.array[1])) ||
+ ((dash->number == -1) && (dash->pattern.array[0] != ','))) {
+ if (dash->number > 0) {
dashList = dash->pattern.array[0];
} else {
- dashList = 4;
+ dashList = (char) (4 * width + 0.5);
}
XSetDashes(((TkCanvas *)canvas)->display, outline->gc,
outline->offset, &dashList , 1);
@@ -1269,30 +1352,30 @@ Tk_ResetOutlineGC(canvas, item, outline)
}
return 0;
}
-
/*
*--------------------------------------------------------------
*
* Tk_CanvasPsOutline
*
- * Creates the postscript command for the correct
- * Outline-information (width, dash, color and stipple).
+ * Creates the postscript command for the correct Outline-information
+ * (width, dash, color and stipple).
*
* Results:
* TCL_OK if succeeded, otherwise TCL_ERROR.
*
* Side effects:
- * canvas->interp->result contains the postscript string,
- * or an error message if the result was TCL_ERROR.
+ * canvas->interp->result contains the postscript string, or an error
+ * message if the result was TCL_ERROR.
*
*--------------------------------------------------------------
*/
+
int
-Tk_CanvasPsOutline(canvas, item, outline)
- Tk_Canvas canvas;
- Tk_Item *item;
- Tk_Outline *outline;
+Tk_CanvasPsOutline(
+ Tk_Canvas canvas,
+ Tk_Item *item,
+ Tk_Outline *outline)
{
char string[41];
char pattern[11];
@@ -1314,6 +1397,7 @@ Tk_CanvasPsOutline(canvas, item, outline)
if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
+
if (((TkCanvas *)canvas)->currentItemPtr == item) {
if (outline->activeWidth > width) {
width = outline->activeWidth;
@@ -1342,7 +1426,7 @@ Tk_CanvasPsOutline(canvas, item, outline)
}
}
sprintf(string, "%.15g setlinewidth\n", width);
- Tcl_AppendResult(interp, string, (char *) NULL);
+ Tcl_AppendResult(interp, string, NULL);
if (dash->number > 10) {
str = (char *)ckalloc((unsigned int) (1 + 4*dash->number));
@@ -1350,38 +1434,40 @@ Tk_CanvasPsOutline(canvas, item, outline)
str = (char *)ckalloc((unsigned int) (1 - 8*dash->number));
lptr = (char *)ckalloc((unsigned int) (1 - 2*dash->number));
}
- ptr = (char *) ((ABS(dash->number) > sizeof(char *)) ) ?
- dash->pattern.pt : dash->pattern.array;
+ ptr = ((unsigned int)ABS(dash->number) > sizeof(char *)) ?
+ dash->pattern.pt : dash->pattern.array;
if (dash->number > 0) {
char *ptr0 = ptr;
+
sprintf(str, "[%d", *ptr++ & 0xff);
i = dash->number-1;
while (i--) {
sprintf(str+strlen(str), " %d", *ptr++ & 0xff);
}
- Tcl_AppendResult(interp, str, (char *)NULL);
+ Tcl_AppendResult(interp, str, NULL);
if (dash->number&1) {
- Tcl_AppendResult(interp, " ", str+1, (char *)NULL);
+ Tcl_AppendResult(interp, " ", str+1, NULL);
}
sprintf(str, "] %d setdash\n", outline->offset);
- Tcl_AppendResult(interp, str, (char *)NULL);
+ Tcl_AppendResult(interp, str, NULL);
ptr = ptr0;
} else if (dash->number < 0) {
if ((i = DashConvert(lptr, ptr, -dash->number, width)) != 0) {
char *lptr0 = lptr;
+
sprintf(str, "[%d", *lptr++ & 0xff);
while (--i) {
sprintf(str+strlen(str), " %d", *lptr++ & 0xff);
}
- Tcl_AppendResult(interp, str, (char *)NULL);
+ Tcl_AppendResult(interp, str, NULL);
sprintf(str, "] %d setdash\n", outline->offset);
- Tcl_AppendResult(interp, str, (char *)NULL);
+ Tcl_AppendResult(interp, str, NULL);
lptr = lptr0;
} else {
- Tcl_AppendResult(interp, "[] 0 setdash\n", (char *)NULL);
+ Tcl_AppendResult(interp, "[] 0 setdash\n", NULL);
}
} else {
- Tcl_AppendResult(interp, "[] 0 setdash\n", (char *)NULL);
+ Tcl_AppendResult(interp, "[] 0 setdash\n", NULL);
}
if (str != string) {
ckfree(str);
@@ -1393,32 +1479,28 @@ Tk_CanvasPsOutline(canvas, item, outline)
return TCL_ERROR;
}
if (stipple != None) {
- Tcl_AppendResult(interp, "StrokeClip ", (char *) NULL);
+ Tcl_AppendResult(interp, "StrokeClip ", NULL);
if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
return TCL_ERROR;
}
} else {
- Tcl_AppendResult(interp, "stroke\n", (char *) NULL);
+ Tcl_AppendResult(interp, "stroke\n", NULL);
}
return TCL_OK;
}
-
/*
*--------------------------------------------------------------
*
* DashConvert
*
- * Converts a character-like dash-list (e.g. "-..")
- * into an X11-style. l must point to a string that
- * holds room to at least 2*n characters. if
- * l == NULL, this function can be used for
- * syntax checking only.
+ * Converts a character-like dash-list (e.g. "-..") into an X11-style. l
+ * must point to a string that holds room to at least 2*n characters. If
+ * l == NULL, this function can be used for syntax checking only.
*
* Results:
- * The length of the resulting X11 compatible
- * dash-list. -1 if failed.
+ * The length of the resulting X11 compatible dash-list. -1 if failed.
*
* Side effects:
* None
@@ -1427,11 +1509,13 @@ Tk_CanvasPsOutline(canvas, item, outline)
*/
static int
-DashConvert (l, p, n, width)
- char *l;
- CONST char *p;
- int n;
- double width;
+DashConvert(
+ char *l, /* Must be at least 2*n chars long, or NULL to
+ * indicate "just check syntax". */
+ CONST char *p, /* String to parse. */
+ int n, /* Length of string to parse, or -1 to
+ * indicate that strlen() should be used. */
+ double width) /* Width of line. */
{
int result = 0;
int size, intWidth;
@@ -1445,30 +1529,28 @@ DashConvert (l, p, n, width)
}
while (n-- && *p) {
switch (*p++) {
- case ' ':
- if (result) {
- if (l) {
- l[-1] += intWidth + 1;
- }
- continue;
- } else {
- return 0;
+ case ' ':
+ if (result) {
+ if (l) {
+ l[-1] += intWidth + 1;
}
- break;
- case '_':
- size = 8;
- break;
- case '-':
- size = 6;
- break;
- case ',':
- size = 4;
- break;
- case '.':
- size = 2;
- break;
- default:
- return -1;
+ continue;
+ }
+ return 0;
+ case '_':
+ size = 8;
+ break;
+ case '-':
+ size = 6;
+ break;
+ case ',':
+ size = 4;
+ break;
+ case '.':
+ size = 2;
+ break;
+ default:
+ return -1;
}
if (l) {
*l++ = size * intWidth;
@@ -1482,14 +1564,14 @@ DashConvert (l, p, n, width)
/*
*----------------------------------------------------------------------
*
- * translateAndAppendCoords --
+ * TranslateAndAppendCoords --
*
* This is a helper routine for TkCanvTranslatePath() below.
*
- * Given an (x,y) coordinate pair within a canvas, this procedure
- * computes the corresponding coordinates at which the point should
- * be drawn in the drawable used for display. Those coordinates are
- * then written into outArr[numOut*2] and outArr[numOut*2+1].
+ * Given an (x,y) coordinate pair within a canvas, this function computes
+ * the corresponding coordinates at which the point should be drawn in
+ * the drawable used for display. Those coordinates are then written into
+ * outArr[numOut*2] and outArr[numOut*2+1].
*
* Results:
* There is no return value.
@@ -1501,11 +1583,12 @@ DashConvert (l, p, n, width)
*/
static void
-translateAndAppendCoords(canvPtr, x, y, outArr, numOut)
- TkCanvas *canvPtr; /* The canvas. */
- double x, y; /* Coordinates in canvas space. */
- XPoint *outArr; /* Write results into this array */
- int numOut; /* Num of prior entries in outArr[] */
+TranslateAndAppendCoords(
+ TkCanvas *canvPtr, /* The canvas. */
+ double x, /* Coordinates in canvas space. */
+ double y,
+ XPoint *outArr, /* Write results into this array */
+ int numOut) /* Num of prior entries in outArr[] */
{
double tmp;
@@ -1517,7 +1600,7 @@ translateAndAppendCoords(canvPtr, x, y, outArr, numOut)
}
outArr[numOut].x = (short) tmp;
- tmp = y - canvPtr->drawableYOrigin;
+ tmp = y - canvPtr->drawableYOrigin;
if (tmp > 0) {
tmp += 0.5;
} else {
@@ -1531,225 +1614,262 @@ translateAndAppendCoords(canvPtr, x, y, outArr, numOut)
*
* TkCanvTranslatePath
*
- * Translate a line or polygon path so that all vertices are
- * within a rectangle that is 1000 pixels larger than the total
- * size of the canvas window. This will prevent pixel coordinates
- * from overflowing the 16-bit integer size limitation imposed by
- * most windowing systems.
- *
- * coordPtr must point to an array of doubles, two doubles per
- * vertex. There are a total of numVertex vertices, or 2*numVertex
- * entries in coordPtr. The result vertices written into outArr
- * have their coordinate origin shifted to canvPtr->drawableXOrigin
- * by canvPtr->drawableYOrigin. There might be as many as 3 times
- * more output vertices than there are input vertices. The calling
- * function should allocate space accordingly.
- *
- * This routine limits the width and height of a canvas window
- * to 31767 pixels. At the highest resolution display devices
- * available today (210 ppi in Jan 2003) that's a window that is
- * over 13 feet wide and tall. Should be enough for the near
- * future.
+ * Translate a line or polygon path so that all vertices are within a
+ * rectangle that is 1000 pixels larger than the total size of the canvas
+ * window. This will prevent pixel coordinates from overflowing the
+ * 16-bit integer size limitation imposed by most windowing systems.
+ *
+ * coordPtr must point to an array of doubles, two doubles per vertex.
+ * There are a total of numVertex vertices, or 2*numVertex entries in
+ * coordPtr. The result vertices written into outArr have their
+ * coordinate origin shifted to canvPtr->drawableXOrigin by
+ * canvPtr->drawableYOrigin. There might be as many as 3 times more
+ * output vertices than there are input vertices. The calling function
+ * should allocate space accordingly.
+ *
+ * This routine limits the width and height of a canvas window to 31767
+ * pixels. At the highest resolution display devices available today (210
+ * ppi in Jan 2003) that's a window that is over 13 feet wide and tall.
+ * Should be enough for the near future.
*
* Results:
- * Clipped and translated path vertices are written into outArr[].
- * There might be as many as twice the vertices in outArr[] as there
- * are in coordPtr[]. The return value is the number of vertices
- * actually written into outArr[].
+ * Clipped and translated path vertices are written into outArr[]. There
+ * might be as many as twice the vertices in outArr[] as there are in
+ * coordPtr[]. The return value is the number of vertices actually
+ * written into outArr[].
*
* Side effects:
* None
*
*--------------------------------------------------------------
*/
+
int
-TkCanvTranslatePath (canvPtr, numVertex, coordArr, closedPath, outArr)
- TkCanvas *canvPtr; /* The canvas */
- int numVertex; /* Number of vertices specified by coordArr[] */
- double *coordArr; /* X and Y coordinates for each vertex */
- int closedPath; /* True if this is a closed polygon */
- XPoint *outArr; /* Write results here, if not NULL */
+TkCanvTranslatePath(
+ TkCanvas *canvPtr, /* The canvas */
+ int numVertex, /* Number of vertices specified by
+ * coordArr[] */
+ double *coordArr, /* X and Y coordinates for each vertex */
+ int closedPath, /* True if this is a closed polygon */
+ XPoint *outArr) /* Write results here, if not NULL */
{
- int numOutput = 0; /* Number of output coordinates */
- double lft, rgh; /* Left and right sides of the bounding box */
- double top, btm; /* Top and bottom sizes of the bounding box */
- double *tempArr; /* Temporary storage used by the clipper */
- double *a, *b, *t; /* Pointers to parts of the temporary storage */
- int i, j; /* Loop counters */
- int maxOutput; /* Maximum number of outputs that we will allow */
- double limit[4]; /* Boundries at which clipping occurs */
- double staticSpace[480]; /* Temp space from the stack */
+ int numOutput = 0; /* Number of output coordinates */
+ double lft, rgh; /* Left and right sides of the bounding box */
+ double top, btm; /* Top and bottom sizes of the bounding box */
+ double *tempArr; /* Temporary storage used by the clipper */
+ double *a, *b, *t; /* Pointers to parts of the temporary
+ * storage */
+ int i, j; /* Loop counters */
+ int maxOutput; /* Maximum number of outputs that we will
+ * allow */
+ double limit[4]; /* Boundries at which clipping occurs */
+ double staticSpace[480]; /* Temp space from the stack */
/*
- ** Constrain all vertices of the path to be within a box that is no
- ** larger than 32000 pixels wide or height. The top-left corner of
- ** this clipping box is 1000 pixels above and to the left of the top
- ** left corner of the window on which the canvas is displayed.
- **
- ** This means that a canvas will not display properly on a canvas
- ** window that is larger than 31000 pixels wide or high. That is not
- ** a problem today, but might someday become a factor for ultra-high
- ** resolutions displays.
- **
- ** The X11 protocol allows us (in theory) to expand the size of the
- ** clipping box to 32767 pixels. But we have found experimentally that
- ** XFree86 sometimes fails to draw lines correctly if they are longer
- ** than about 32500 pixels. So we have left a little margin in the
- ** size to mask that bug.
- */
+ * Constrain all vertices of the path to be within a box that is no larger
+ * than 32000 pixels wide or height. The top-left corner of this clipping
+ * box is 1000 pixels above and to the left of the top left corner of the
+ * window on which the canvas is displayed.
+ *
+ * This means that a canvas will not display properly on a canvas window
+ * that is larger than 31000 pixels wide or high. That is not a problem
+ * today, but might someday become a factor for ultra-high resolutions
+ * displays.
+ *
+ * The X11 protocol allows us (in theory) to expand the size of the
+ * clipping box to 32767 pixels. But we have found experimentally that
+ * XFree86 sometimes fails to draw lines correctly if they are longer than
+ * about 32500 pixels. So we have left a little margin in the size to mask
+ * that bug.
+ */
+
lft = canvPtr->xOrigin - 1000.0;
top = canvPtr->yOrigin - 1000.0;
rgh = lft + 32000.0;
btm = top + 32000.0;
- /* Try the common case first - no clipping. Loop over the input
- ** coordinates and translate them into appropriate output coordinates.
- ** But if a vertex outside of the bounding box is seen, break out of
- ** the loop.
- **
- ** Most of the time, no clipping is needed, so this one loop is
- ** sufficient to do the translation.
- */
- for(i=0; i<numVertex; i++){
- double x, y;
- x = coordArr[i*2];
- y = coordArr[i*2+1];
- if( x<lft || x>rgh || y<top || y>btm ) break;
- translateAndAppendCoords(canvPtr, x, y, outArr, numOutput++);
- }
- if( i==numVertex ){
- assert( numOutput==numVertex );
- return numOutput;
- }
-
- /* If we reach this point, it means that some clipping is required.
- ** Begin by allocating some working storage - at least 6 times as much space
- ** as coordArr[] requires. Divide this space into two separate arrays
- ** a[] and b[]. Initialize a[] to be equal to coordArr[].
- */
- if( numVertex*12 <= sizeof(staticSpace)/sizeof(staticSpace[0]) ){
- tempArr = staticSpace;
+ /*
+ * Try the common case first - no clipping. Loop over the input
+ * coordinates and translate them into appropriate output coordinates.
+ * But if a vertex outside of the bounding box is seen, break out of the
+ * loop.
+ *
+ * Most of the time, no clipping is needed, so this one loop is sufficient
+ * to do the translation.
+ */
+
+ for (i=0; i<numVertex; i++){
+ double x, y;
+
+ x = coordArr[i*2];
+ y = coordArr[i*2+1];
+ if (x<lft || x>rgh || y<top || y>btm) {
+ break;
+ }
+ TranslateAndAppendCoords(canvPtr, x, y, outArr, numOutput++);
+ }
+ if (i == numVertex){
+ assert(numOutput == numVertex);
+ return numOutput;
+ }
+
+ /*
+ * If we reach this point, it means that some clipping is required. Begin
+ * by allocating some working storage - at least 6 times as much space as
+ * coordArr[] requires. Divide this space into two separate arrays a[] and
+ * b[]. Initialize a[] to be equal to coordArr[].
+ */
+
+ if (numVertex*12 <= (int)(sizeof(staticSpace)/sizeof(staticSpace[0]))) {
+ tempArr = staticSpace;
} else {
- tempArr = (double*)ckalloc( numVertex*12*sizeof(tempArr[0]) );
+ tempArr = (double *)ckalloc(numVertex*12*sizeof(tempArr[0]));
}
- for(i=0; i<numVertex*2; i++){
- tempArr[i] = coordArr[i];
+ for (i=0; i<numVertex*2; i++){
+ tempArr[i] = coordArr[i];
}
a = tempArr;
b = &tempArr[numVertex*6];
- /* We will make four passes through the input data. On each pass,
- ** we copy the contents of a[] over into b[]. As we copy, we clip
- ** any line segments that extend to the right past xClip then we
- ** rotate the coordinate system 90 degrees clockwise. After each
- ** pass is complete, we interchange a[] and b[] in preparation for
- ** the next pass.
- **
- ** Each pass clips line segments that extend beyond a single side
- ** of the bounding box, and four passes rotate the coordinate system
- ** back to its original value. I'm not an expert on graphics
- ** algorithms, but I think this is called Cohen-Sutherland polygon
- ** clipping.
- **
- ** The limit[] array contains the xClip value used for each of the
- ** four passes.
- */
+ /*
+ * We will make four passes through the input data. On each pass, we copy
+ * the contents of a[] over into b[]. As we copy, we clip any line
+ * segments that extend to the right past xClip then we rotate the
+ * coordinate system 90 degrees clockwise. After each pass is complete, we
+ * interchange a[] and b[] in preparation for the next pass.
+ *
+ * Each pass clips line segments that extend beyond a single side of the
+ * bounding box, and four passes rotate the coordinate system back to its
+ * original value. I'm not an expert on graphics algorithms, but I think
+ * this is called Cohen-Sutherland polygon clipping.
+ *
+ * The limit[] array contains the xClip value used for each of the four
+ * passes.
+ */
+
limit[0] = rgh;
limit[1] = -top;
limit[2] = -lft;
limit[3] = btm;
- /* This is the loop that makes the four passes through the data.
- */
+ /*
+ * This is the loop that makes the four passes through the data.
+ */
+
maxOutput = numVertex*3;
- for(j=0; j<4; j++){
- double xClip = limit[j];
- int inside = a[0]<xClip;
- double priorY = a[1];
- numOutput = 0;
-
- /* Clip everything to the right of xClip. Store the results in
- ** b[] rotated by 90 degrees clockwise.
- */
- for(i=0; i<numVertex; i++){
- double x = a[i*2];
- double y = a[i*2+1];
- if( x>=xClip ){
- /* The current vertex is to the right of xClip.
- */
- if( inside ){
- /* If the current vertex is to the right of xClip but
- ** the previous vertex was left of xClip, then draw a
- ** line segment from the previous vertex to until it
- ** intersects the vertical at xClip.
- */
- double x0, y0, yN;
- assert( i>0 );
- x0 = a[i*2-2];
- y0 = a[i*2-1];
- yN = y0 + (y - y0)*(xClip-x0)/(x-x0);
- b[numOutput*2] = -yN;
- b[numOutput*2+1] = xClip;
- numOutput++;
- assert( numOutput<=maxOutput );
- priorY = yN;
- inside = 0;
- }else if( i==0 ){
- /* If the first vertex is to the right of xClip, add
- ** a vertex that is the projection of the first vertex
- ** onto the vertical xClip line.
- */
- b[0] = -y;
- b[1] = xClip;
- numOutput = 1;
- priorY = y;
- }
- }else{
- /* The current vertex is to the left of xClip
- */
- if( !inside ){
- /* If the current vertex is on the left of xClip and
- ** one or more prior vertices where to the right, then
- ** we have to draw a line segment along xClip that extends
- ** from the spot where we first crossed from left to right
- ** to the spot where we cross back from right to left.
- */
- double x0, y0, yN;
- assert( i>0 );
- x0 = a[i*2-2];
- y0 = a[i*2-1];
- yN = y0 + (y - y0)*(xClip-x0)/(x-x0);
- if( yN!=priorY ){
- b[numOutput*2] = -yN;
- b[numOutput*2+1] = xClip;
- numOutput++;
- assert( numOutput<=maxOutput );
- }
- inside = 1;
- }
- b[numOutput*2] = -y;
- b[numOutput*2+1] = x;
- numOutput++;
- assert( numOutput<=maxOutput );
- }
- }
-
- /* Interchange a[] and b[] in preparation for the next pass.
- */
- t = a;
- a = b;
- b = t;
- numVertex = numOutput;
- }
-
- /* All clipping is now finished. Convert the coordinates from doubles
- ** into XPoints and translate the origin for the drawable.
- */
- for(i=0; i<numVertex; i++){
- translateAndAppendCoords(canvPtr, a[i*2], a[i*2+1], outArr, i);
- }
- if( tempArr!=staticSpace ){
- ckfree((char *) tempArr);
+ for (j=0; j<4; j++){
+ double xClip = limit[j];
+ int inside = a[0]<xClip;
+ double priorY = a[1];
+ numOutput = 0;
+
+ /*
+ * Clip everything to the right of xClip. Store the results in b[]
+ * rotated by 90 degrees clockwise.
+ */
+
+ for (i=0; i<numVertex; i++){
+ double x = a[i*2];
+ double y = a[i*2+1];
+
+ if (x >= xClip) {
+ /*
+ * The current vertex is to the right of xClip.
+ */
+
+ if (inside) {
+ /*
+ * If the current vertex is to the right of xClip but the
+ * previous vertex was left of xClip, then draw a line
+ * segment from the previous vertex to until it intersects
+ * the vertical at xClip.
+ */
+
+ double x0, y0, yN;
+
+ assert(i > 0);
+ x0 = a[i*2-2];
+ y0 = a[i*2-1];
+ yN = y0 + (y - y0)*(xClip-x0)/(x-x0);
+ b[numOutput*2] = -yN;
+ b[numOutput*2+1] = xClip;
+ numOutput++;
+ assert(numOutput <= maxOutput);
+ priorY = yN;
+ inside = 0;
+ } else if (i == 0) {
+ /*
+ * If the first vertex is to the right of xClip, add a
+ * vertex that is the projection of the first vertex onto
+ * the vertical xClip line.
+ */
+
+ b[0] = -y;
+ b[1] = xClip;
+ numOutput = 1;
+ priorY = y;
+ }
+ } else {
+ /*
+ * The current vertex is to the left of xClip
+ */
+ if (!inside) {
+ /* If the current vertex is on the left of xClip and one
+ * or more prior vertices where to the right, then we have
+ * to draw a line segment along xClip that extends from
+ * the spot where we first crossed from left to right to
+ * the spot where we cross back from right to left.
+ */
+
+ double x0, y0, yN;
+
+ assert(i > 0);
+ x0 = a[i*2-2];
+ y0 = a[i*2-1];
+ yN = y0 + (y - y0)*(xClip-x0)/(x-x0);
+ if (yN != priorY) {
+ b[numOutput*2] = -yN;
+ b[numOutput*2+1] = xClip;
+ numOutput++;
+ assert(numOutput <= maxOutput);
+ }
+ inside = 1;
+ }
+ b[numOutput*2] = -y;
+ b[numOutput*2+1] = x;
+ numOutput++;
+ assert(numOutput <= maxOutput);
+ }
+ }
+
+ /*
+ * Interchange a[] and b[] in preparation for the next pass.
+ */
+
+ t = a;
+ a = b;
+ b = t;
+ numVertex = numOutput;
+ }
+
+ /*
+ * All clipping is now finished. Convert the coordinates from doubles into
+ * XPoints and translate the origin for the drawable.
+ */
+
+ for (i=0; i<numVertex; i++){
+ TranslateAndAppendCoords(canvPtr, a[i*2], a[i*2+1], outArr, i);
+ }
+ if (tempArr != staticSpace) {
+ ckfree((char *) tempArr);
}
return numOutput;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index 96fcadd..b62859c 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkCanvWind.c --
*
* This file implements window items for canvas widgets.
@@ -6,13 +6,12 @@
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
/*
@@ -49,103 +48,99 @@ static Tk_CustomOption tagsOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_ANCHOR, "-anchor", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
"center", Tk_Offset(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_PIXELS, "-height", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-height", NULL, NULL,
"0", Tk_Offset(WindowItem, height), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_PIXELS, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_PIXELS, "-width", NULL, NULL,
"0", Tk_Offset(WindowItem, width), TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_WINDOW, "-window", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(WindowItem, tkwin), TK_CONFIG_NULL_OK},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_WINDOW, "-window", NULL, NULL,
+ NULL, Tk_Offset(WindowItem, tkwin), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static void ComputeWindowBbox _ANSI_ARGS_((Tk_Canvas canvas,
- WindowItem *winItemPtr));
-static int ConfigureWinItem _ANSI_ARGS_((Tcl_Interp *interp,
+static void ComputeWindowBbox(Tk_Canvas canvas,
+ WindowItem *winItemPtr);
+static int ConfigureWinItem(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags));
-static int CreateWinItem _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *CONST objv[], int flags);
+static int CreateWinItem(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void DeleteWinItem _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayWinItem _ANSI_ARGS_((Tk_Canvas canvas,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DeleteWinItem(Tk_Canvas canvas,
+ Tk_Item *itemPtr, Display *display);
+static void DisplayWinItem(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static void ScaleWinItem _ANSI_ARGS_((Tk_Canvas canvas,
+ int x, int y, int width, int height);
+static void ScaleWinItem(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void TranslateWinItem _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
-static int WinItemCoords _ANSI_ARGS_((Tcl_Interp *interp,
+ double scaleX, double scaleY);
+static void TranslateWinItem(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double deltaX, double deltaY);
+static int WinItemCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static void WinItemLostSlaveProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin));
-static void WinItemRequestProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void WinItemStructureProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static int WinItemToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *rectPtr));
-static int WinItemToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static double WinItemToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *pointPtr));
+ Tcl_Obj *CONST objv[]);
+static void WinItemLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
+static void WinItemRequestProc(ClientData clientData,
+ Tk_Window tkwin);
+static void WinItemStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static int WinItemToArea(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *rectPtr);
+static int WinItemToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static double WinItemToPoint(Tk_Canvas canvas,
+ Tk_Item *itemPtr, double *pointPtr);
#ifdef X_GetImage
-static int xerrorhandler _ANSI_ARGS_((ClientData clientData,
- XErrorEvent *e));
+static int xerrorhandler(ClientData clientData, XErrorEvent *e);
#endif
-static int CanvasPsWindow _ANSI_ARGS_((Tcl_Interp *interp,
+static int CanvasPsWindow(Tcl_Interp *interp,
Tk_Window tkwin, Tk_Canvas canvas, double x,
- double y, int width, int height));
+ double y, int width, int height);
/*
- * The structure below defines the window item type by means of procedures
+ * The structure below defines the window item type by means of functions
* that can be invoked by generic item code.
*/
Tk_ItemType tkWindowType = {
- "window", /* name */
- sizeof(WindowItem), /* itemSize */
- CreateWinItem, /* createProc */
- configSpecs, /* configSpecs */
- ConfigureWinItem, /* configureProc */
- WinItemCoords, /* coordProc */
- DeleteWinItem, /* deleteProc */
- DisplayWinItem, /* displayProc */
- 1|TK_CONFIG_OBJS, /* flags */
- WinItemToPoint, /* pointProc */
- WinItemToArea, /* areaProc */
- WinItemToPostscript, /* postscriptProc */
- ScaleWinItem, /* scaleProc */
- TranslateWinItem, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* cursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ "window", /* name */
+ sizeof(WindowItem), /* itemSize */
+ CreateWinItem, /* createProc */
+ configSpecs, /* configSpecs */
+ ConfigureWinItem, /* configureProc */
+ WinItemCoords, /* coordProc */
+ DeleteWinItem, /* deleteProc */
+ DisplayWinItem, /* displayProc */
+ 1|TK_CONFIG_OBJS, /* flags */
+ WinItemToPoint, /* pointProc */
+ WinItemToArea, /* areaProc */
+ WinItemToPostscript, /* postscriptProc */
+ ScaleWinItem, /* scaleProc */
+ TranslateWinItem, /* translateProc */
+ NULL, /* indexProc */
+ NULL, /* cursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
-
/*
- * The structure below defines the official type record for the
- * placer:
+ * The structure below defines the official type record for the canvas (as
+ * geometry manager):
*/
-static Tk_GeomMgr canvasGeomType = {
+static const Tk_GeomMgr canvasGeomType = {
"canvas", /* name */
WinItemRequestProc, /* requestProc */
WinItemLostSlaveProc, /* lostSlaveProc */
@@ -156,14 +151,12 @@ static Tk_GeomMgr canvasGeomType = {
*
* CreateWinItem --
*
- * This procedure is invoked to create a new window
- * item in a canvas.
+ * This function is invoked to create a new window item in a canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item, then an error message is left in
- * the interp's result; in this case itemPtr is
- * left uninitialized, so it can be safely freed by the
+ * A standard Tcl return value. If an error occurred in creating the
+ * item, then an error message is left in the interp's result; in this
+ * case itemPtr is left uninitialized, so it can be safely freed by the
* caller.
*
* Side effects:
@@ -173,19 +166,19 @@ static Tk_GeomMgr canvasGeomType = {
*/
static int
-CreateWinItem(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header
- * has been initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing window. */
+CreateWinItem(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
+ * initialized by caller. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing window. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
int i;
if (objc == 0) {
- panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords\n");
}
/*
@@ -199,8 +192,8 @@ CreateWinItem(interp, canvas, itemPtr, objc, objv)
winItemPtr->canvas = canvas;
/*
- * Process the arguments to fill in the item record.
- * Only 1 (list) or 2 (x y) coords are allowed.
+ * Process the arguments to fill in the item record. Only 1 (list) or 2 (x
+ * y) coords are allowed.
*/
if (objc == 1) {
@@ -220,7 +213,7 @@ CreateWinItem(interp, canvas, itemPtr, objc, objv)
return TCL_OK;
}
- error:
+ error:
DeleteWinItem(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -230,9 +223,8 @@ CreateWinItem(interp, canvas, itemPtr, objc, objv)
*
* WinItemCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on window items. See the user documentation for
- * details on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * window items. See the user documentation for details on what it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -244,15 +236,13 @@ CreateWinItem(interp, canvas, itemPtr, objc, objv)
*/
static int
-WinItemCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be
- * read or modified. */
- int objc; /* Number of coordinates supplied in
- * objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1,
- * x2, y2, ... */
+WinItemCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
+ * modified. */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
@@ -297,12 +287,12 @@ WinItemCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigureWinItem --
*
- * This procedure is invoked to configure various aspects
- * of a window item, such as its anchor position.
+ * This function is invoked to configure various aspects of a window
+ * item, such as its anchor position.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
* Configuration information may be set for itemPtr.
@@ -311,13 +301,13 @@ WinItemCoords(interp, canvas, itemPtr, objc, objv)
*/
static int
-ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Window item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureWinItem(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Window item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
Tk_Window oldWindow;
@@ -338,8 +328,7 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
if (oldWindow != NULL) {
Tk_DeleteEventHandler(oldWindow, StructureNotifyMask,
WinItemStructureProc, (ClientData) winItemPtr);
- Tk_ManageGeometry(oldWindow, (Tk_GeomMgr *) NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL);
Tk_UnmaintainGeometry(oldWindow, canvasTkwin);
Tk_UnmapWindow(oldWindow);
}
@@ -347,10 +336,10 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
Tk_Window ancestor, parent;
/*
- * Make sure that the canvas is either the parent of the
- * window associated with the item or a descendant of that
- * parent. Also, don't allow a top-of-hierarchy window to be
- * managed inside a canvas.
+ * Make sure that the canvas is either the parent of the window
+ * associated with the item or a descendant of that parent. Also,
+ * don't allow a top-of-hierarchy window to be managed inside a
+ * canvas.
*/
parent = Tk_Parent(winItemPtr->tkwin);
@@ -360,10 +349,10 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
break;
}
if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
- badWindow:
+ badWindow:
Tcl_AppendResult(interp, "can't use ",
Tk_PathName(winItemPtr->tkwin),
- " in a window item of this canvas", (char *) NULL);
+ " in a window item of this canvas", NULL);
winItemPtr->tkwin = NULL;
return TCL_ERROR;
}
@@ -399,8 +388,8 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
*
* DeleteWinItem --
*
- * This procedure is called to clean up the data structure
- * associated with a window item.
+ * This function is called to clean up the data structure associated with
+ * a window item.
*
* Results:
* None.
@@ -412,11 +401,10 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteWinItem(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Overall info about widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for
- * canvas. */
+DeleteWinItem(
+ Tk_Canvas canvas, /* Overall info about widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas);
@@ -424,7 +412,7 @@ DeleteWinItem(canvas, itemPtr, display)
if (winItemPtr->tkwin != NULL) {
Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask,
WinItemStructureProc, (ClientData) winItemPtr);
- Tk_ManageGeometry(winItemPtr->tkwin, (Tk_GeomMgr *) NULL,
+ Tk_ManageGeometry(winItemPtr->tkwin, NULL,
(ClientData) NULL);
if (canvasTkwin != Tk_Parent(winItemPtr->tkwin)) {
Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin);
@@ -438,26 +426,23 @@ DeleteWinItem(canvas, itemPtr, display)
*
* ComputeWindowBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of a window item.
- * This procedure is where the child window's placement is
- * computed.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of a window item. This function is where the
+ * child window's placement is computed.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
*
*--------------------------------------------------------------
*/
static void
-ComputeWindowBbox(canvas, winItemPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- WindowItem *winItemPtr; /* Item whose bbox is to be
- * recomputed. */
+ComputeWindowBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ WindowItem *winItemPtr) /* Item whose bbox is to be recomputed. */
{
int width, height, x, y;
Tk_State state = winItemPtr->header.state;
@@ -470,10 +455,10 @@ ComputeWindowBbox(canvas, winItemPtr)
}
if ((winItemPtr->tkwin == NULL) || (state == TK_STATE_HIDDEN)) {
/*
- * There is no window for this item yet. Just give it a 1x1
- * bounding box. Don't give it a 0x0 bounding box; there are
- * strange cases where this bounding box might be used as the
- * dimensions of the window, and 0x0 causes problems under X.
+ * There is no window for this item yet. Just give it a 1x1 bounding
+ * box. Don't give it a 0x0 bounding box; there are strange cases
+ * where this bounding box might be used as the dimensions of the
+ * window, and 0x0 causes problems under X.
*/
winItemPtr->header.x1 = x;
@@ -507,36 +492,36 @@ ComputeWindowBbox(canvas, winItemPtr)
*/
switch (winItemPtr->anchor) {
- case TK_ANCHOR_N:
- x -= width/2;
- break;
- case TK_ANCHOR_NE:
- x -= width;
- break;
- case TK_ANCHOR_E:
- x -= width;
- y -= height/2;
- break;
- case TK_ANCHOR_SE:
- x -= width;
- y -= height;
- break;
- case TK_ANCHOR_S:
- x -= width/2;
- y -= height;
- break;
- case TK_ANCHOR_SW:
- y -= height;
- break;
- case TK_ANCHOR_W:
- y -= height/2;
- break;
- case TK_ANCHOR_NW:
- break;
- case TK_ANCHOR_CENTER:
- x -= width/2;
- y -= height/2;
- break;
+ case TK_ANCHOR_N:
+ x -= width/2;
+ break;
+ case TK_ANCHOR_NE:
+ x -= width;
+ break;
+ case TK_ANCHOR_E:
+ x -= width;
+ y -= height/2;
+ break;
+ case TK_ANCHOR_SE:
+ x -= width;
+ y -= height;
+ break;
+ case TK_ANCHOR_S:
+ x -= width/2;
+ y -= height;
+ break;
+ case TK_ANCHOR_SW:
+ y -= height;
+ break;
+ case TK_ANCHOR_W:
+ y -= height/2;
+ break;
+ case TK_ANCHOR_NW:
+ break;
+ case TK_ANCHOR_CENTER:
+ x -= width/2;
+ y -= height/2;
+ break;
}
/*
@@ -554,36 +539,32 @@ ComputeWindowBbox(canvas, winItemPtr)
*
* DisplayWinItem --
*
- * This procedure is invoked to "draw" a window item in a given
- * drawable. Since the window draws itself, we needn't do any
- * actual redisplay here. However, this procedure takes care
- * of actually repositioning the child window so that it occupies
- * the correct screen position.
+ * This function is invoked to "draw" a window item in a given drawable.
+ * Since the window draws itself, we needn't do any actual redisplay
+ * here. However, this function takes care of actually repositioning the
+ * child window so that it occupies the correct screen position.
*
* Results:
* None.
*
* Side effects:
- * The child window's position may get changed. Note: this
- * procedure gets called both when a window needs to be displayed
- * and when it ceases to be visible on the screen (e.g. it was
- * scrolled or moved off-screen or the enclosing canvas is
- * unmapped).
+ * The child window's position may get changed. Note: this function gets
+ * called both when a window needs to be displayed and when it ceases to
+ * be visible on the screen (e.g. it was scrolled or moved off-screen or
+ * the enclosing canvas is unmapped).
*
*--------------------------------------------------------------
*/
static void
-DisplayWinItem(canvas, itemPtr, display, drawable, regionX, regionY,
- regionWidth, regionHeight)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw
- * item. */
- int regionX, regionY, regionWidth, regionHeight;
- /* Describes region of canvas that
- * must be redisplayed (not used). */
+DisplayWinItem(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int regionX, int regionY, int regionWidth, int regionHeight)
+ /* Describes region of canvas that must be
+ * redisplayed (not used). */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
int width, height;
@@ -616,16 +597,16 @@ DisplayWinItem(canvas, itemPtr, display, drawable, regionX, regionY,
height = winItemPtr->header.y2 - winItemPtr->header.y1;
/*
- * If the window is completely out of the visible area of the canvas
- * then unmap it. This code used not to be present (why unmap the
- * window if it isn't visible anyway?) but this could cause the
- * window to suddenly reappear if the canvas window got resized.
+ * If the window is completely out of the visible area of the canvas then
+ * unmap it. This code used not to be present (why unmap the window if it
+ * isn't visible anyway?) but this could cause the window to suddenly
+ * reappear if the canvas window got resized.
*/
if (((x + width) <= 0) || ((y + height) <= 0)
|| (x >= Tk_Width(canvasTkwin)) || (y >= Tk_Height(canvasTkwin))) {
if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) {
- Tk_UnmapWindow(winItemPtr->tkwin);
+ Tk_UnmapWindow(winItemPtr->tkwin);
} else {
Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin);
}
@@ -633,8 +614,8 @@ DisplayWinItem(canvas, itemPtr, display, drawable, regionX, regionY,
}
/*
- * Reposition and map the window (but in different ways depending
- * on whether the canvas is the window's parent).
+ * Reposition and map the window (but in different ways depending on
+ * whether the canvas is the window's parent).
*/
if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) {
@@ -655,14 +636,14 @@ DisplayWinItem(canvas, itemPtr, display, drawable, regionX, regionY,
*
* WinItemToPoint --
*
- * Computes the distance from a given point to a given
- * window, in canvas units.
+ * Computes the distance from a given point to a given window, in canvas
+ * units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are coordPtr[0] and coordPtr[1] is inside the window. If the
- * point isn't inside the window then the return value is the
- * distance from the point to the window.
+ * The return value is 0 if the point whose x and y coordinates are
+ * coordPtr[0] and coordPtr[1] is inside the window. If the point isn't
+ * inside the window then the return value is the distance from the point
+ * to the window.
*
* Side effects:
* None.
@@ -671,10 +652,10 @@ DisplayWinItem(canvas, itemPtr, display, drawable, regionX, regionY,
*/
static double
-WinItemToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+WinItemToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
double x1, x2, y1, y2, xDiff, yDiff;
@@ -712,14 +693,13 @@ WinItemToPoint(canvas, itemPtr, pointPtr)
*
* WinItemToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangle.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangle.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -728,11 +708,11 @@ WinItemToPoint(canvas, itemPtr, pointPtr)
*/
static int
-WinItemToArea(canvas, itemPtr, rectPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against rectangle. */
- double *rectPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
+WinItemToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against rectangle. */
+ double *rectPtr) /* Pointer to array of four coordinates
+ * (x1,y1,x2,y2) describing rectangular
* area. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
@@ -757,8 +737,8 @@ WinItemToArea(canvas, itemPtr, rectPtr)
*
* xerrorhandler --
*
- * This is a dummy function to catch X11 errors during an
- * attempt to print a canvas window.
+ * This is a dummy function to catch X11 errors during an attempt to
+ * print a canvas window.
*
* Results:
* None.
@@ -771,11 +751,11 @@ WinItemToArea(canvas, itemPtr, rectPtr)
#ifdef X_GetImage
static int
-xerrorhandler(clientData, e)
- ClientData clientData;
- XErrorEvent *e;
+xerrorhandler(
+ ClientData clientData,
+ XErrorEvent *e)
{
- return 0;
+ return 0;
}
#endif
@@ -785,15 +765,13 @@ xerrorhandler(clientData, e)
*
* WinItemToPostscript --
*
- * This procedure is called to generate Postscript for
- * window items.
+ * This function is called to generate Postscript for window items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in interp->result, replacing whatever used to be there.
- * If no error occurs, then Postscript for the item is appended
- * to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in interp->result,
+ * replacing whatever used to be there. If no error occurs, then
+ * Postscript for the item is appended to the result.
*
* Side effects:
* None.
@@ -802,15 +780,13 @@ xerrorhandler(clientData, e)
*/
static int
-WinItemToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is
- * wanted. */
- int prepass; /* 1 means this is a prepass to
- * collect font information; 0 means
- * final Postscript is being created.*/
+WinItemToPostscript(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created. */
{
WindowItem *winItemPtr = (WindowItem *)itemPtr;
@@ -821,80 +797,75 @@ WinItemToPostscript(interp, canvas, itemPtr, prepass)
if (prepass || winItemPtr->tkwin == NULL) {
return TCL_OK;
}
-
+
width = Tk_Width(tkwin);
height = Tk_Height(tkwin);
/*
- * Compute the coordinates of the lower-left corner of the window,
- * taking into account the anchor position for the window.
+ * Compute the coordinates of the lower-left corner of the window, taking
+ * into account the anchor position for the window.
*/
x = winItemPtr->x;
y = Tk_CanvasPsY(canvas, winItemPtr->y);
-
+
switch (winItemPtr->anchor) {
- case TK_ANCHOR_NW: y -= height; break;
- case TK_ANCHOR_N: x -= width/2.0; y -= height; break;
- case TK_ANCHOR_NE: x -= width; y -= height; break;
- case TK_ANCHOR_E: x -= width; y -= height/2.0; break;
- case TK_ANCHOR_SE: x -= width; break;
- case TK_ANCHOR_S: x -= width/2.0; break;
- case TK_ANCHOR_SW: break;
- case TK_ANCHOR_W: y -= height/2.0; break;
- case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
+ case TK_ANCHOR_NW: y -= height; break;
+ case TK_ANCHOR_N: x -= width/2.0; y -= height; break;
+ case TK_ANCHOR_NE: x -= width; y -= height; break;
+ case TK_ANCHOR_E: x -= width; y -= height/2.0; break;
+ case TK_ANCHOR_SE: x -= width; break;
+ case TK_ANCHOR_S: x -= width/2.0; break;
+ case TK_ANCHOR_SW: break;
+ case TK_ANCHOR_W: y -= height/2.0; break;
+ case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
}
return CanvasPsWindow(interp, tkwin, canvas, x, y, width, height);
}
-
+
static int
-CanvasPsWindow(interp, tkwin, canvas, x, y, width, height)
- Tcl_Interp *interp; /* Leave Postscript or error message
- * here. */
- Tk_Window tkwin; /* window to be printed */
- Tk_Canvas canvas; /* Information about overall canvas. */
- double x, y; /* origin of window. */
- int width, height; /* width/height of window. */
+CanvasPsWindow(
+ Tcl_Interp *interp, /* Leave Postscript or error message here. */
+ Tk_Window tkwin, /* window to be printed */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ double x, double y, /* origin of window. */
+ int width, int height) /* width/height of window. */
{
char buffer[256];
XImage *ximage;
int result;
Tcl_DString buffer1, buffer2;
#ifdef X_GetImage
- Tk_ErrorHandler handle;
+ Tk_ErrorHandler handle;
#endif
sprintf(buffer, "\n%%%% %s item (%s, %d x %d)\n%.15g %.15g translate\n",
Tk_Class(tkwin), Tk_PathName(tkwin), width, height, x, y);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
- /* first try if the widget has its own "postscript" command. If it
- * exists, this will produce much better postscript than
- * when a pixmap is used.
+ /*
+ * First try if the widget has its own "postscript" command. If it exists,
+ * this will produce much better postscript than when a pixmap is used.
*/
Tcl_DStringInit(&buffer1);
Tcl_DStringInit(&buffer2);
Tcl_DStringGetResult(interp, &buffer2);
- sprintf (buffer, "%s postscript -prolog 0\n", Tk_PathName(tkwin));
+ sprintf(buffer, "%s postscript -prolog 0\n", Tk_PathName(tkwin));
result = Tcl_Eval(interp, buffer);
Tcl_DStringGetResult(interp, &buffer1);
Tcl_DStringResult(interp, &buffer2);
Tcl_DStringFree(&buffer2);
if (result == TCL_OK) {
- Tcl_AppendResult(interp,
- "50 dict begin\nsave\ngsave\n",
- (char *) NULL);
- sprintf (buffer,
- "0 %d moveto %d 0 rlineto 0 -%d rlineto -%d",
+ Tcl_AppendResult(interp, "50 dict begin\nsave\ngsave\n", NULL);
+ sprintf(buffer, "0 %d moveto %d 0 rlineto 0 -%d rlineto -%d",
height, width, height, width);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
Tcl_AppendResult(interp, " 0 rlineto closepath\n",
"1.000 1.000 1.000 setrgbcolor AdjustColor\nfill\ngrestore\n",
- Tcl_DStringValue(&buffer1), "\nrestore\nend\n\n\n",
- (char *) NULL);
+ Tcl_DStringValue(&buffer1), "\nrestore\nend\n\n\n", NULL);
Tcl_DStringFree(&buffer1);
return result;
@@ -902,17 +873,18 @@ CanvasPsWindow(interp, tkwin, canvas, x, y, width, height)
Tcl_DStringFree(&buffer1);
/*
- * If the window is off the screen it will generate an BadMatch/XError
- * We catch any BadMatch errors here
+ * If the window is off the screen it will generate a BadMatch/XError. We
+ * catch any BadMatch errors here
*/
+
#ifdef X_GetImage
handle = Tk_CreateErrorHandler(Tk_Display(tkwin), BadMatch,
X_GetImage, -1, xerrorhandler, (ClientData) tkwin);
#endif
/*
- * Generate an XImage from the window. We can then read pixel
- * values out of the XImage.
+ * Generate an XImage from the window. We can then read pixel values out
+ * of the XImage.
*/
ximage = XGetImage(Tk_Display(tkwin), Tk_WindowId(tkwin), 0, 0,
@@ -922,7 +894,7 @@ CanvasPsWindow(interp, tkwin, canvas, x, y, width, height)
Tk_DeleteErrorHandler(handle);
#endif
- if (ximage == (XImage*) NULL) {
+ if (ximage == NULL) {
return TCL_OK;
}
@@ -938,15 +910,14 @@ CanvasPsWindow(interp, tkwin, canvas, x, y, width, height)
*
* ScaleWinItem --
*
- * This procedure is invoked to rescale a window item.
+ * This function is invoked to rescale a window item.
*
* Results:
* None.
*
* Side effects:
- * The window referred to by itemPtr is rescaled
- * so that the following transformation is applied to all
- * point coordinates:
+ * The window referred to by itemPtr is rescaled so that the following
+ * transformation is applied to all point coordinates:
* x' = originX + scaleX*(x-originX)
* y' = originY + scaleY*(y-originY)
*
@@ -954,12 +925,13 @@ CanvasPsWindow(interp, tkwin, canvas, x, y, width, height)
*/
static void
-ScaleWinItem(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing window. */
- Tk_Item *itemPtr; /* Window to be scaled. */
- double originX, originY; /* Origin about which to scale window. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleWinItem(
+ Tk_Canvas canvas, /* Canvas containing window. */
+ Tk_Item *itemPtr, /* Window to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale window. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
@@ -979,25 +951,24 @@ ScaleWinItem(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* TranslateWinItem --
*
- * This procedure is called to move a window by a given amount.
+ * This function is called to move a window by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the window is offset by (xDelta, yDelta),
- * and the bounding box is updated in the generic part of the
- * item structure.
+ * The position of the window is offset by (xDelta, yDelta), and the
+ * bounding box is updated in the generic part of the item structure.
*
*--------------------------------------------------------------
*/
static void
-TranslateWinItem(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be
- * moved. */
+TranslateWinItem(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
@@ -1011,25 +982,23 @@ TranslateWinItem(canvas, itemPtr, deltaX, deltaY)
*
* WinItemStructureProc --
*
- * This procedure is invoked whenever StructureNotify events
- * occur for a window that's managed as part of a canvas window
- * item. This procudure's only purpose is to clean up when
- * windows are deleted.
+ * This function is invoked whenever StructureNotify events occur for a
+ * window that's managed as part of a canvas window item. This function's
+ * only purpose is to clean up when windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * The window is disassociated from the window item when it is
- * deleted.
+ * The window is disassociated from the window item when it is deleted.
*
*--------------------------------------------------------------
*/
static void
-WinItemStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to record describing window item. */
- XEvent *eventPtr; /* Describes what just happened. */
+WinItemStructureProc(
+ ClientData clientData, /* Pointer to record describing window item. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
WindowItem *winItemPtr = (WindowItem *) clientData;
@@ -1043,8 +1012,8 @@ WinItemStructureProc(clientData, eventPtr)
*
* WinItemRequestProc --
*
- * This procedure is invoked whenever a window that's associated
- * with a window canvas item changes its requested dimensions.
+ * This function is invoked whenever a window that's associated with a
+ * window canvas item changes its requested dimensions.
*
* Results:
* None.
@@ -1057,10 +1026,9 @@ WinItemStructureProc(clientData, eventPtr)
*/
static void
-WinItemRequestProc(clientData, tkwin)
- ClientData clientData; /* Pointer to record for window item. */
- Tk_Window tkwin; /* Window that changed its desired
- * size. */
+WinItemRequestProc(
+ ClientData clientData, /* Pointer to record for window item. */
+ Tk_Window tkwin) /* Window that changed its desired size. */
{
WindowItem *winItemPtr = (WindowItem *) clientData;
@@ -1080,8 +1048,8 @@ WinItemRequestProc(clientData, tkwin)
*
* WinItemLostSlaveProc --
*
- * This procedure is invoked by Tk whenever some other geometry
- * claims control over a slave that used to be managed by us.
+ * This function is invoked by Tk whenever some other geometry claims
+ * control over a slave that used to be managed by us.
*
* Results:
* None.
@@ -1094,10 +1062,10 @@ WinItemRequestProc(clientData, tkwin)
/* ARGSUSED */
static void
-WinItemLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* WindowItem structure for slave window that
+WinItemLostSlaveProc(
+ ClientData clientData, /* WindowItem structure for slave window that
* was stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
WindowItem *winItemPtr = (WindowItem *) clientData;
Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas);
@@ -1110,3 +1078,11 @@ WinItemLostSlaveProc(clientData, tkwin)
Tk_UnmapWindow(winItemPtr->tkwin);
winItemPtr->tkwin = NULL;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 8f9641f..14fe1ab 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -1,23 +1,22 @@
-/*
+/*
* tkCanvas.c --
*
- * This module implements canvas widgets for the Tk toolkit.
- * A canvas displays a background and a collection of graphical
- * objects such as rectangles, lines, and texts.
+ * This module implements canvas widgets for the Tk toolkit. A canvas
+ * displays a background and a collection of graphical objects such as
+ * rectangles, lines, and texts.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/* #define USE_OLD_TAG_SEARCH 1 */
#include "default.h"
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
#ifdef TK_NO_DOUBLE_BUFFERING
#ifdef MAC_OSX_TK
@@ -31,32 +30,29 @@
#ifdef USE_OLD_TAG_SEARCH
/*
- * The structure defined below is used to keep track of a tag search
- * in progress. No field should be accessed by anyone other than
- * StartTagSearch and NextItem.
+ * The structure defined below is used to keep track of a tag search in
+ * progress. No field should be accessed by anyone other than StartTagSearch
+ * and NextItem.
*/
typedef struct TagSearch {
TkCanvas *canvasPtr; /* Canvas widget being searched. */
- Tk_Uid tag; /* Tag to search for. 0 means return
- * all items. */
+ Tk_Uid tag; /* Tag to search for. 0 means return all
+ * items. */
Tk_Item *currentPtr; /* Pointer to last item returned. */
- Tk_Item *lastPtr; /* The item right before the currentPtr
- * is tracked so if the currentPtr is
- * deleted we don't have to start from the
- * beginning. */
+ Tk_Item *lastPtr; /* The item right before the currentPtr is
+ * tracked so if the currentPtr is deleted we
+ * don't have to start from the beginning. */
int searchOver; /* Non-zero means NextItem should always
* return NULL. */
} TagSearch;
#else /* USE_OLD_TAG_SEARCH */
/*
- * The structure defined below is used to keep track of a tag search
- * in progress. No field should be accessed by anyone other than
- * TagSearchScan, TagSearchFirst, TagSearchNext,
- * TagSearchScanExpr, TagSearchEvalExpr,
- * TagSearchExprInit, TagSearchExprDestroy,
- * TagSearchDestroy.
+ * The structure defined below is used to keep track of a tag search in
+ * progress. No field should be accessed by anyone other than TagSearchScan,
+ * TagSearchFirst, TagSearchNext, TagSearchScanExpr, TagSearchEvalExpr,
+ * TagSearchExprInit, TagSearchExprDestroy, TagSearchDestroy.
* (
* Not quite accurate: the TagSearch structure is also accessed from:
* CanvasWidgetCmd, FindItems, RelinkItems
@@ -72,24 +68,32 @@ typedef struct TagSearch {
typedef struct TagSearch {
TkCanvas *canvasPtr; /* Canvas widget being searched. */
Tk_Item *currentPtr; /* Pointer to last item returned. */
- Tk_Item *lastPtr; /* The item right before the currentPtr
- * is tracked so if the currentPtr is
- * deleted we don't have to start from the
- * beginning. */
+ Tk_Item *lastPtr; /* The item right before the currentPtr is
+ * tracked so if the currentPtr is deleted we
+ * don't have to start from the beginning. */
int searchOver; /* Non-zero means NextItem should always
* return NULL. */
- int type; /* search type */
- int id; /* item id for searches by id */
+ int type; /* Search type (see #defs below) */
+ int id; /* Item id for searches by id */
+ char *string; /* Tag expression string */
+ int stringIndex; /* Current position in string scan */
+ int stringLength; /* Length of tag expression string */
+ char *rewritebuffer; /* Tag string (after removing escapes) */
+ unsigned int rewritebufferAllocated;
+ /* Available space for rewrites. */
+ TagSearchExpr *expr; /* Compiled tag expression. */
+} TagSearch;
- char *string; /* tag expression string */
- int stringIndex; /* current position in string scan */
- int stringLength; /* length of tag expression string */
+/*
+ * Values for the TagSearch type field.
+ */
- char *rewritebuffer; /* tag string (after removing escapes) */
- unsigned int rewritebufferAllocated; /* available space for rewrites */
+#define SEARCH_TYPE_EMPTY 0 /* Looking for empty tag */
+#define SEARCH_TYPE_ID 1 /* Looking for an item by id */
+#define SEARCH_TYPE_ALL 2 /* Looking for all items */
+#define SEARCH_TYPE_TAG 3 /* Looking for an item by simple tag */
+#define SEARCH_TYPE_EXPR 4 /* Compound search */
- TagSearchExpr *expr; /* compiled tag expression */
-} TagSearch;
#endif /* USE_OLD_TAG_SEARCH */
/*
@@ -119,10 +123,8 @@ static Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_BORDER, "-background", "background", "Background",
DEF_CANVAS_BG_MONO, Tk_Offset(TkCanvas, bgBorder),
TK_CONFIG_MONO_ONLY},
- {TK_CONFIG_SYNONYM, "-bd", "borderWidth", (char *) NULL,
- (char *) NULL, 0, 0},
- {TK_CONFIG_SYNONYM, "-bg", "background", (char *) NULL,
- (char *) NULL, 0, 0},
+ {TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0},
+ {TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0},
{TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_CANVAS_BORDER_WIDTH, Tk_Offset(TkCanvas, borderWidth), 0},
{TK_CONFIG_DOUBLE, "-closeenough", "closeEnough", "CloseEnough",
@@ -203,13 +205,12 @@ static Tk_ConfigSpec configSpecs[] = {
"ScrollIncrement",
DEF_CANVAS_Y_SCROLL_INCREMENT, Tk_Offset(TkCanvas, yScrollIncrement),
0},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * List of all the item types known at present. This is *global* and
- * is protected by typeListMutex.
+ * List of all the item types known at present. This is *global* and is
+ * protected by typeListMutex.
*/
static Tk_ItemType *typeList = NULL; /* NULL means initialization hasn't
@@ -218,9 +219,10 @@ TCL_DECLARE_MUTEX(typeListMutex)
#ifndef USE_OLD_TAG_SEARCH
/*
- * Uids for operands in compiled advanced tag search expressions
+ * Uids for operands in compiled advanced tag search expressions.
* Initialization is done by GetStaticUids()
*/
+
typedef struct {
Tk_Uid allUid;
Tk_Uid currentUid;
@@ -235,107 +237,89 @@ typedef struct {
} SearchUids;
static Tcl_ThreadDataKey dataKey;
-static SearchUids *GetStaticUids _ANSI_ARGS_((void));
+static SearchUids * GetStaticUids(void);
#endif /* USE_OLD_TAG_SEARCH */
/*
- * Standard item types provided by Tk:
+ * Prototypes for functions defined later in this file:
*/
-extern Tk_ItemType tkArcType, tkBitmapType, tkImageType, tkLineType;
-extern Tk_ItemType tkOvalType, tkPolygonType;
-extern Tk_ItemType tkRectangleType, tkTextType, tkWindowType;
-
-/*
- * Prototypes for procedures defined later in this file:
- */
-
-static void CanvasBindProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void CanvasBlinkProc _ANSI_ARGS_((ClientData clientData));
-static void CanvasCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void CanvasDoEvent _ANSI_ARGS_((TkCanvas *canvasPtr,
- XEvent *eventPtr));
-static void CanvasEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int CanvasFetchSelection _ANSI_ARGS_((
- ClientData clientData, int offset,
- char *buffer, int maxBytes));
-static Tk_Item * CanvasFindClosest _ANSI_ARGS_((TkCanvas *canvasPtr,
- double coords[2]));
-static void CanvasFocusProc _ANSI_ARGS_((TkCanvas *canvasPtr,
- int gotFocus));
-static void CanvasLostSelection _ANSI_ARGS_((
- ClientData clientData));
-static void CanvasSelectTo _ANSI_ARGS_((TkCanvas *canvasPtr,
- Tk_Item *itemPtr, int index));
-static void CanvasSetOrigin _ANSI_ARGS_((TkCanvas *canvasPtr,
- int xOrigin, int yOrigin));
-static void CanvasUpdateScrollbars _ANSI_ARGS_((
- TkCanvas *canvasPtr));
-static int CanvasWidgetCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, Tcl_Obj *CONST *argv));
-static void CanvasWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static int ConfigureCanvas _ANSI_ARGS_((Tcl_Interp *interp,
- TkCanvas *canvasPtr, int argc, Tcl_Obj *CONST *argv,
- int flags));
-static void DestroyCanvas _ANSI_ARGS_((char *memPtr));
-static void DisplayCanvas _ANSI_ARGS_((ClientData clientData));
-static void DoItem _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Item *itemPtr, Tk_Uid tag));
-static void EventuallyRedrawItem _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr));
+static void CanvasBindProc(ClientData clientData,
+ XEvent *eventPtr);
+static void CanvasBlinkProc(ClientData clientData);
+static void CanvasCmdDeletedProc(ClientData clientData);
+static void CanvasDoEvent(TkCanvas *canvasPtr, XEvent *eventPtr);
+static void CanvasEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static int CanvasFetchSelection(ClientData clientData, int offset,
+ char *buffer, int maxBytes);
+static Tk_Item * CanvasFindClosest(TkCanvas *canvasPtr,
+ double coords[2]);
+static void CanvasFocusProc(TkCanvas *canvasPtr, int gotFocus);
+static void CanvasLostSelection(ClientData clientData);
+static void CanvasSelectTo(TkCanvas *canvasPtr,
+ Tk_Item *itemPtr, int index);
+static void CanvasSetOrigin(TkCanvas *canvasPtr,
+ int xOrigin, int yOrigin);
+static void CanvasUpdateScrollbars(TkCanvas *canvasPtr);
+static int CanvasWidgetCmd(ClientData clientData,
+ Tcl_Interp *interp, int argc,
+ Tcl_Obj *CONST *argv);
+static void CanvasWorldChanged(
+ ClientData instanceData);
+static int ConfigureCanvas(Tcl_Interp *interp,
+ TkCanvas *canvasPtr, int argc,
+ Tcl_Obj *CONST *argv, int flags);
+static void DestroyCanvas(char *memPtr);
+static void DisplayCanvas(ClientData clientData);
+static void DoItem(Tcl_Interp *interp,
+ Tk_Item *itemPtr, Tk_Uid tag);
+static void EventuallyRedrawItem(Tk_Canvas canvas,
+ Tk_Item *itemPtr);
#ifdef USE_OLD_TAG_SEARCH
-static int FindItems _ANSI_ARGS_((Tcl_Interp *interp,
- TkCanvas *canvasPtr, int argc, Tcl_Obj *CONST *argv,
- Tcl_Obj *newTagObj, int first));
+static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
+ int argc, Tcl_Obj *CONST *argv,
+ Tcl_Obj *newTagObj, int first);
#else /* USE_OLD_TAG_SEARCH */
-static int FindItems _ANSI_ARGS_((Tcl_Interp *interp,
- TkCanvas *canvasPtr, int argc, Tcl_Obj *CONST *argv,
+static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
+ int argc, Tcl_Obj *CONST *argv,
Tcl_Obj *newTagObj, int first,
- TagSearch **searchPtrPtr));
+ TagSearch **searchPtrPtr);
#endif /* USE_OLD_TAG_SEARCH */
-static int FindArea _ANSI_ARGS_((Tcl_Interp *interp,
- TkCanvas *canvasPtr, Tcl_Obj *CONST *argv, Tk_Uid uid,
- int enclosed));
-static double GridAlign _ANSI_ARGS_((double coord, double spacing));
-static CONST char** GetStringsFromObjs _ANSI_ARGS_((int argc,
- Tcl_Obj *CONST *objv));
-static void InitCanvas _ANSI_ARGS_((void));
+static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr,
+ Tcl_Obj *CONST *argv, Tk_Uid uid, int enclosed);
+static double GridAlign(double coord, double spacing);
+static CONST char** TkGetStringsFromObjs(int argc, Tcl_Obj *CONST *objv);
+static void InitCanvas(void);
#ifdef USE_OLD_TAG_SEARCH
-static Tk_Item * NextItem _ANSI_ARGS_((TagSearch *searchPtr));
+static Tk_Item * NextItem(TagSearch *searchPtr);
#endif /* USE_OLD_TAG_SEARCH */
-static void PickCurrentItem _ANSI_ARGS_((TkCanvas *canvasPtr,
- XEvent *eventPtr));
-static Tcl_Obj * ScrollFractions _ANSI_ARGS_((int screen1,
- int screen2, int object1, int object2));
+static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr);
+static Tcl_Obj * ScrollFractions(int screen1,
+ int screen2, int object1, int object2);
#ifdef USE_OLD_TAG_SEARCH
-static void RelinkItems _ANSI_ARGS_((TkCanvas *canvasPtr,
- Tcl_Obj *tag, Tk_Item *prevPtr));
-static Tk_Item * StartTagSearch _ANSI_ARGS_((TkCanvas *canvasPtr,
- Tcl_Obj *tag, TagSearch *searchPtr));
+static void RelinkItems(TkCanvas *canvasPtr,
+ Tcl_Obj *tag, Tk_Item *prevPtr);
+static Tk_Item * StartTagSearch(TkCanvas *canvasPtr,
+ Tcl_Obj *tag, TagSearch *searchPtr);
#else /* USE_OLD_TAG_SEARCH */
-static int RelinkItems _ANSI_ARGS_((TkCanvas *canvasPtr,
- Tcl_Obj *tag, Tk_Item *prevPtr,
- TagSearch **searchPtrPtr));
-static void TagSearchExprInit _ANSI_ARGS_ ((
- TagSearchExpr **exprPtrPtr));
-static void TagSearchExprDestroy _ANSI_ARGS_((TagSearchExpr *expr));
-static void TagSearchDestroy _ANSI_ARGS_((TagSearch *searchPtr));
-static int TagSearchScan _ANSI_ARGS_((TkCanvas *canvasPtr,
- Tcl_Obj *tag, TagSearch **searchPtrPtr));
-static int TagSearchScanExpr _ANSI_ARGS_((Tcl_Interp *interp,
- TagSearch *searchPtr, TagSearchExpr *expr));
-static int TagSearchEvalExpr _ANSI_ARGS_((TagSearchExpr *expr,
- Tk_Item *itemPtr));
-static Tk_Item * TagSearchFirst _ANSI_ARGS_((TagSearch *searchPtr));
-static Tk_Item * TagSearchNext _ANSI_ARGS_((TagSearch *searchPtr));
+static int RelinkItems(TkCanvas *canvasPtr, Tcl_Obj *tag,
+ Tk_Item *prevPtr, TagSearch **searchPtrPtr);
+static void TagSearchExprInit(TagSearchExpr **exprPtrPtr);
+static void TagSearchExprDestroy(TagSearchExpr *expr);
+static void TagSearchDestroy(TagSearch *searchPtr);
+static int TagSearchScan(TkCanvas *canvasPtr,
+ Tcl_Obj *tag, TagSearch **searchPtrPtr);
+static int TagSearchScanExpr(Tcl_Interp *interp,
+ TagSearch *searchPtr, TagSearchExpr *expr);
+static int TagSearchEvalExpr(TagSearchExpr *expr,
+ Tk_Item *itemPtr);
+static Tk_Item * TagSearchFirst(TagSearch *searchPtr);
+static Tk_Item * TagSearchNext(TagSearch *searchPtr);
#endif /* USE_OLD_TAG_SEARCH */
/*
- * The structure below defines canvas class behavior by means of procedures
+ * The structure below defines canvas class behavior by means of functions
* that can be invoked from generic window code.
*/
@@ -344,15 +328,38 @@ static Tk_ClassProcs canvasClass = {
CanvasWorldChanged, /* worldChangedProc */
};
+/*
+ * Macros that significantly simplify all code that finds items.
+ */
+
+#ifdef USE_OLD_TAG_SEARCH
+#define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
+ (itemPtr) = StartTagSearch(canvasPtr,(objPtr),&search)
+#define FOR_EVERY_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
+ for ((itemPtr) = StartTagSearch(canvasPtr, (objPtr), &search); \
+ (itemPtr) != NULL; (itemPtr) = NextItem(&search))
+#else /* USE_OLD_TAG_SEARCH */
+#define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
+ if ((result=TagSearchScan(canvasPtr,(objPtr),(searchPtrPtr))) != TCL_OK){ \
+ errorExitClause; \
+ } \
+ itemPtr = TagSearchFirst(*(searchPtrPtr));
+#define FOR_EVERY_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
+ if ((result=TagSearchScan(canvasPtr,(objPtr),(searchPtrPtr))) != TCL_OK){ \
+ errorExitClause; \
+ } \
+ for (itemPtr = TagSearchFirst(*(searchPtrPtr)); \
+ itemPtr != NULL; itemPtr = TagSearchNext(*(searchPtrPtr)))
+#endif /* USE_OLD_TAG_SEARCH */
+
/*
*--------------------------------------------------------------
*
* Tk_CanvasObjCmd --
*
- * This procedure is invoked to process the "canvas" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "canvas" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -364,16 +371,15 @@ static Tk_ClassProcs canvasClass = {
*/
int
-Tk_CanvasObjCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- Tcl_Obj *CONST argv[]; /* Argument objects. */
+Tk_CanvasObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ Tcl_Obj *CONST argv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
TkCanvas *canvasPtr;
- Tk_Window new;
+ Tk_Window newWin;
if (typeList == NULL) {
InitCanvas();
@@ -384,21 +390,20 @@ Tk_CanvasObjCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
- new = Tk_CreateWindowFromPath(interp, tkwin,
- Tcl_GetString(argv[1]), (char *) NULL);
- if (new == NULL) {
+ newWin = Tk_CreateWindowFromPath(interp,tkwin,Tcl_GetString(argv[1]),NULL);
+ if (newWin == NULL) {
return TCL_ERROR;
}
/*
- * Initialize fields that won't be initialized by ConfigureCanvas,
- * or which ConfigureCanvas expects to have reasonable values
- * (e.g. resource pointers).
+ * Initialize fields that won't be initialized by ConfigureCanvas, or
+ * which ConfigureCanvas expects to have reasonable values (e.g. resource
+ * pointers).
*/
canvasPtr = (TkCanvas *) ckalloc(sizeof(TkCanvas));
- canvasPtr->tkwin = new;
- canvasPtr->display = Tk_Display(new);
+ canvasPtr->tkwin = newWin;
+ canvasPtr->display = Tk_Display(newWin);
canvasPtr->interp = interp;
canvasPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(canvasPtr->tkwin), CanvasWidgetCmd,
@@ -460,8 +465,8 @@ Tk_CanvasObjCmd(clientData, interp, argc, argv)
canvasPtr->hotPrevPtr = NULL;
canvasPtr->cursor = None;
canvasPtr->takeFocus = NULL;
- canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(new));
- canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(new));
+ canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin));
+ canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin));
canvasPtr->flags = 0;
canvasPtr->nextId = 1;
canvasPtr->psInfo = NULL;
@@ -492,7 +497,7 @@ Tk_CanvasObjCmd(clientData, interp, argc, argv)
Tcl_SetResult(interp, Tk_PathName(canvasPtr->tkwin), TCL_STATIC);
return TCL_OK;
- error:
+ error:
Tk_DestroyWindow(canvasPtr->tkwin);
return TCL_ERROR;
}
@@ -502,9 +507,9 @@ Tk_CanvasObjCmd(clientData, interp, argc, argv)
*
* CanvasWidgetCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -516,22 +521,21 @@ Tk_CanvasObjCmd(clientData, interp, argc, argv)
*/
static int
-CanvasWidgetCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about canvas
- * widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+CanvasWidgetCmd(
+ ClientData clientData, /* Information about canvas widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
- int c, length, result;
- Tk_Item *itemPtr = NULL; /* Initialization needed only to
- * prevent compiler warning. */
+ int c, result;
+ Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent
+ * compiler warning. */
#ifdef USE_OLD_TAG_SEARCH
TagSearch search;
#else /* USE_OLD_TAG_SEARCH */
- TagSearch *searchPtr = NULL; /* Allocated by first TagSearchScan
- * Freed by TagSearchDestroy */
+ TagSearch *searchPtr = NULL;/* Allocated by first TagSearchScan, freed by
+ * TagSearchDestroy */
#endif /* USE_OLD_TAG_SEARCH */
int index;
@@ -569,7 +573,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = TCL_OK;
switch ((enum options) index) {
- case CANV_ADDTAG: {
+ case CANV_ADDTAG:
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg arg ...?");
result = TCL_ERROR;
@@ -581,13 +585,12 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = FindItems(interp, canvasPtr, objc, objv, objv[2], 3, &searchPtr);
#endif /* USE_OLD_TAG_SEARCH */
break;
- }
- case CANV_BBOX: {
+ case CANV_BBOX: {
int i, gotAny;
- int x1 = 0, y1 = 0, x2 = 0, y2 = 0; /* Initializations needed
- * only to prevent compiler
- * warnings. */
+ int x1 = 0, y1 = 0, x2 = 0, y2 = 0; /* Initializations needed only
+ * to prevent overcautious
+ * compiler warnings. */
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?tagOrId ...?");
@@ -596,17 +599,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
gotAny = 0;
for (i = 2; i < objc; i++) {
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[i], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[i], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
-
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[i], &searchPtr, goto done) {
if ((itemPtr->x1 >= itemPtr->x2)
|| (itemPtr->y1 >= itemPtr->y2)) {
continue;
@@ -635,13 +628,13 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
if (gotAny) {
char buf[TCL_INTEGER_SPACE * 4];
-
+
sprintf(buf, "%d %d %d %d", x1, y1, x2, y2);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
break;
- }
- case CANV_BIND: {
+ }
+ case CANV_BIND: {
ClientData object;
if ((objc < 3) || (objc > 5)) {
@@ -651,8 +644,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
/*
- * Figure out what object to use for the binding (individual
- * item vs. tag).
+ * Figure out what object to use for the binding (individual item vs.
+ * tag).
*/
object = 0;
@@ -674,7 +667,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
if (object == 0) {
Tcl_AppendResult(interp, "item \"", Tcl_GetString(objv[2]),
- "\" doesn't exist", (char *) NULL);
+ "\" doesn't exist", NULL);
result = TCL_ERROR;
goto done;
}
@@ -683,13 +676,15 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
object = (ClientData) Tk_GetUid(Tcl_GetString(objv[2]));
}
#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
+ result = TagSearchScan(canvasPtr, objv[2], &searchPtr);
+ if (result != TCL_OK) {
goto done;
}
- if (searchPtr->type == 1) {
+ if (searchPtr->type == SEARCH_TYPE_ID) {
Tcl_HashEntry *entryPtr;
- entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char *) searchPtr->id);
+ entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
+ (char *) INT2PTR(searchPtr->id));
if (entryPtr != NULL) {
itemPtr = (Tk_Item *) Tcl_GetHashValue(entryPtr);
object = (ClientData) itemPtr;
@@ -697,7 +692,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
if (object == 0) {
Tcl_AppendResult(interp, "item \"", Tcl_GetString(objv[2]),
- "\" doesn't exist", (char *) NULL);
+ "\" doesn't exist", NULL);
result = TCL_ERROR;
goto done;
}
@@ -707,8 +702,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
#endif /* USE_OLD_TAG_SEARCH */
/*
- * Make a binding table if the canvas doesn't already have
- * one.
+ * Make a binding table if the canvas doesn't already have one.
*/
if (canvasPtr->bindingTable == NULL) {
@@ -718,18 +712,19 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
if (objc == 5) {
int append = 0;
unsigned long mask;
- char* argv4 = Tcl_GetStringFromObj(objv[4],NULL);
+ char* argv4 = Tcl_GetString(objv[4]);
if (argv4[0] == 0) {
result = Tk_DeleteBinding(interp, canvasPtr->bindingTable,
- object, Tcl_GetStringFromObj(objv[3], NULL));
+ object, Tcl_GetString(objv[3]));
goto done;
}
#ifndef USE_OLD_TAG_SEARCH
- if (searchPtr->type == 4) {
- /*
- * if new tag expression, then insert in linked list
- */
+ if (searchPtr->type == SEARCH_TYPE_EXPR) {
+ /*
+ * If new tag expression, then insert in linked list.
+ */
+
TagSearchExpr *expr, **lastPtr;
lastPtr = &(canvasPtr->bindTagExprs);
@@ -741,25 +736,27 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
if (!expr) {
/*
- * transfer ownership of expr to bindTagExprs list
+ * Transfer ownership of expr to bindTagExprs list.
*/
+
*lastPtr = searchPtr->expr;
searchPtr->expr->next = NULL;
/*
- * flag in TagSearch that expr has changed ownership
- * so that TagSearchDestroy doesn't try to free it
+ * Flag in TagSearch that expr has changed ownership so
+ * that TagSearchDestroy doesn't try to free it.
*/
+
searchPtr->expr = NULL;
}
- }
+ }
#endif /* not USE_OLD_TAG_SEARCH */
if (argv4[0] == '+') {
argv4++;
append = 1;
}
mask = Tk_CreateBinding(interp, canvasPtr->bindingTable,
- object, Tcl_GetStringFromObj(objv[3],NULL), argv4, append);
+ object, Tcl_GetString(objv[3]), argv4, append);
if (mask == 0) {
result = TCL_ERROR;
goto done;
@@ -770,27 +767,28 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
|EnterWindowMask|LeaveWindowMask|KeyPressMask
|KeyReleaseMask|PointerMotionMask|VirtualEventMask)) {
Tk_DeleteBinding(interp, canvasPtr->bindingTable,
- object, Tcl_GetStringFromObj(objv[3], NULL));
+ object, Tcl_GetString(objv[3]));
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "requested illegal events; ",
"only key, button, motion, enter, leave, and virtual ",
- "events may be used", (char *) NULL);
+ "events may be used", NULL);
result = TCL_ERROR;
goto done;
}
} else if (objc == 4) {
CONST char *command;
-
+
command = Tk_GetBinding(interp, canvasPtr->bindingTable,
- object, Tcl_GetStringFromObj(objv[3], NULL));
+ object, Tcl_GetString(objv[3]));
if (command == NULL) {
CONST char *string;
- string = Tcl_GetStringResult(interp);
+ string = Tcl_GetStringResult(interp);
+
/*
- * Ignore missing binding errors. This is a special hack
- * that relies on the error message returned by FindSequence
- * in tkBind.c.
+ * Ignore missing binding errors. This is a special hack that
+ * relies on the error message returned by FindSequence in
+ * tkBind.c.
*/
if (string[0] != '\0') {
@@ -806,8 +804,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
Tk_GetAllBindings(interp, canvasPtr->bindingTable, object);
}
break;
- }
- case CANV_CANVASX: {
+ }
+ case CANV_CANVASX: {
int x;
double grid;
char buf[TCL_DOUBLE_SPACE];
@@ -834,8 +832,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
Tcl_PrintDouble(interp, GridAlign((double) x, grid), buf);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
- }
- case CANV_CANVASY: {
+ }
+ case CANV_CANVASY: {
int y;
double grid;
char buf[TCL_DOUBLE_SPACE];
@@ -862,8 +860,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
Tcl_PrintDouble(interp, GridAlign((double) y, grid), buf);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
- }
- case CANV_CGET: {
+ }
+ case CANV_CGET:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option");
result = TCL_ERROR;
@@ -872,11 +870,10 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = Tk_ConfigureValue(interp, canvasPtr->tkwin, configSpecs,
(char *) canvasPtr, Tcl_GetString(objv[2]), 0);
break;
- }
- case CANV_CONFIGURE: {
+ case CANV_CONFIGURE:
if (objc == 2) {
result = Tk_ConfigureInfo(interp, canvasPtr->tkwin, configSpecs,
- (char *) canvasPtr, (char *) NULL, 0);
+ (char *) canvasPtr, NULL, 0);
} else if (objc == 3) {
result = Tk_ConfigureInfo(interp, canvasPtr->tkwin, configSpecs,
(char *) canvasPtr, Tcl_GetString(objv[2]), 0);
@@ -885,43 +882,37 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
TK_CONFIG_ARGV_ONLY);
}
break;
- }
- case CANV_COORDS: {
+ case CANV_COORDS:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?x y x y ...?");
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- itemPtr = TagSearchFirst(searchPtr);
-#endif /* USE_OLD_TAG_SEARCH */
+ FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done);
if (itemPtr != NULL) {
if (objc != 3) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
}
if (itemPtr->typePtr->coordProc != NULL) {
- if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = (*itemPtr->typePtr->coordProc)(interp,
- (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3);
- } else {
- CONST char **args = GetStringsFromObjs(objc-3, objv+3);
- result = (*itemPtr->typePtr->coordProc)(interp,
- (Tk_Canvas) canvasPtr, itemPtr, objc-3, (Tcl_Obj **) args);
- if (args) ckfree((char *) args);
- }
+ if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
+ result = (*itemPtr->typePtr->coordProc)(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3);
+ } else {
+ CONST char **args = TkGetStringsFromObjs(objc-3, objv+3);
+ result = (*itemPtr->typePtr->coordProc)(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, objc-3,
+ (Tcl_Obj **) args);
+ if (args != NULL) {
+ ckfree((char *) args);
+ }
+ }
}
if (objc != 3) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
}
}
break;
- }
- case CANV_CREATE: {
+ case CANV_CREATE: {
Tk_ItemType *typePtr;
Tk_ItemType *matchPtr = NULL;
Tk_Item *itemPtr;
@@ -929,6 +920,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
int isNew = 0;
Tcl_HashEntry *entryPtr;
char *arg;
+ int length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg arg ...?");
@@ -940,13 +932,12 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
Tcl_MutexLock(&typeListMutex);
for (typePtr = typeList; typePtr != NULL; typePtr = typePtr->nextPtr) {
if ((c == typePtr->name[0])
- && (strncmp(arg, typePtr->name, (unsigned) length) == 0)) {
+ && (strncmp(arg, typePtr->name, (unsigned)length) == 0)) {
if (matchPtr != NULL) {
Tcl_MutexUnlock(&typeListMutex);
- badType:
+ badType:
Tcl_AppendResult(interp,
- "unknown or ambiguous item type \"",
- arg, "\"", (char *) NULL);
+ "unknown or ambiguous item type \"",arg,"\"",NULL);
result = TCL_ERROR;
goto done;
}
@@ -984,10 +975,12 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = (*typePtr->createProc)(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc-3, objv+3);
} else {
- CONST char **args = GetStringsFromObjs(objc-3, objv+3);
+ CONST char **args = TkGetStringsFromObjs(objc-3, objv+3);
result = (*typePtr->createProc)(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc-3, (Tcl_Obj **) args);
- if (args) ckfree((char *) args);
+ if (args != NULL) {
+ ckfree((char *) args);
+ }
}
if (result != TCL_OK) {
ckfree((char *) itemPtr);
@@ -996,7 +989,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
itemPtr->nextPtr = NULL;
entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable,
- (char *) itemPtr->id, &isNew);
+ (char *) INT2PTR(itemPtr->id), &isNew);
Tcl_SetHashValue(entryPtr, itemPtr);
itemPtr->prevPtr = canvasPtr->lastItemPtr;
canvasPtr->hotPtr = itemPtr;
@@ -1013,8 +1006,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
sprintf(buf, "%d", itemPtr->id);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
- }
- case CANV_DCHARS: {
+ }
+ case CANV_DCHARS: {
int first, last;
int x1,x2,y1,y2;
@@ -1023,37 +1016,32 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
if ((itemPtr->typePtr->indexProc == NULL)
|| (itemPtr->typePtr->dCharsProc == NULL)) {
continue;
}
if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, (char *) objv[3], &first);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[3],
+ &first);
} else {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, Tcl_GetStringFromObj(objv[3], NULL), &first);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, Tcl_GetString(objv[3]),
+ &first);
}
if (result != TCL_OK) {
goto done;
}
if (objc == 5) {
if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, (char *) objv[4], &last);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[4],
+ &last);
} else {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, Tcl_GetStringFromObj(objv[4], NULL), &last);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr,
+ Tcl_GetString(objv[4]), &last);
}
if (result != TCL_OK) {
goto done;
@@ -1063,10 +1051,10 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
/*
- * Redraw both item's old and new areas: it's possible
- * that a delete could result in a new area larger than
- * the old area. Except if the insertProc sets the
- * TK_ITEM_DONT_REDRAW flag, nothing more needs to be done.
+ * Redraw both item's old and new areas: it's possible that a
+ * delete could result in a new area larger than the old area.
+ * Except if the insertProc sets the TK_ITEM_DONT_REDRAW flag,
+ * nothing more needs to be done.
*/
x1 = itemPtr->x1; y1 = itemPtr->y1;
@@ -1082,22 +1070,13 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
}
break;
- }
- case CANV_DELETE: {
+ }
+ case CANV_DELETE: {
int i;
Tcl_HashEntry *entryPtr;
for (i = 2; i < objc; i++) {
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[i], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[i], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[i], &searchPtr, goto done) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
if (canvasPtr->bindingTable != NULL) {
Tk_DeleteAllBindings(canvasPtr->bindingTable,
@@ -1109,7 +1088,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
ckfree((char *) itemPtr->tagPtr);
}
entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
- (char *) itemPtr->id);
+ (char *) INT2PTR(itemPtr->id));
Tcl_DeleteHashEntry(entryPtr);
if (itemPtr->nextPtr != NULL) {
itemPtr->nextPtr->prevPtr = itemPtr->prevPtr;
@@ -1148,8 +1127,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
}
break;
- }
- case CANV_DTAG: {
+ }
+ case CANV_DTAG: {
Tk_Uid tag;
int i;
@@ -1159,20 +1138,11 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
goto done;
}
if (objc == 4) {
- tag = Tk_GetUid(Tcl_GetStringFromObj(objv[3], NULL));
+ tag = Tk_GetUid(Tcl_GetString(objv[3]));
} else {
- tag = Tk_GetUid(Tcl_GetStringFromObj(objv[2], NULL));
+ tag = Tk_GetUid(Tcl_GetString(objv[2]));
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
for (i = itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == tag) {
itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1];
@@ -1181,22 +1151,21 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
}
break;
- }
- case CANV_FIND: {
+ }
+ case CANV_FIND:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "searchCommand ?arg arg ...?");
result = TCL_ERROR;
goto done;
}
#ifdef USE_OLD_TAG_SEARCH
- result = FindItems(interp, canvasPtr, objc, objv, (Tcl_Obj *) NULL, 2);
+ result = FindItems(interp, canvasPtr, objc, objv, NULL, 2);
#else /* USE_OLD_TAG_SEARCH */
- result = FindItems(interp, canvasPtr, objc, objv,
- (Tcl_Obj *) NULL, 2, &searchPtr);
+ result = FindItems(interp, canvasPtr, objc, objv, NULL, 2,
+ &searchPtr);
#endif /* USE_OLD_TAG_SEARCH */
break;
- }
- case CANV_FOCUS: {
+ case CANV_FOCUS:
if (objc > 3) {
Tcl_WrongNumArgs(interp, 2, objv, "?tagOrId?");
result = TCL_ERROR;
@@ -1206,7 +1175,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
if (objc == 2) {
if (itemPtr != NULL) {
char buf[TCL_INTEGER_SPACE];
-
+
sprintf(buf, "%d", itemPtr->id);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
@@ -1215,20 +1184,11 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
if ((itemPtr != NULL) && (canvasPtr->textInfo.gotFocus)) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
}
- if (Tcl_GetStringFromObj(objv[2], NULL)[0] == 0) {
+ if (Tcl_GetString(objv[2])[0] == 0) {
canvasPtr->textInfo.focusItemPtr = NULL;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
if (itemPtr->typePtr->icursorProc != NULL) {
break;
}
@@ -1241,21 +1201,13 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
}
break;
- }
- case CANV_GETTAGS: {
+ case CANV_GETTAGS:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId");
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- itemPtr = TagSearchFirst(searchPtr);
-#endif /* USE_OLD_TAG_SEARCH */
+ FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done);
if (itemPtr != NULL) {
int i;
for (i = 0; i < itemPtr->numTags; i++) {
@@ -1263,8 +1215,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
}
break;
- }
- case CANV_ICURSOR: {
+ case CANV_ICURSOR: {
int index;
if (objc != 4) {
@@ -1272,26 +1223,19 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
if ((itemPtr->typePtr->indexProc == NULL)
|| (itemPtr->typePtr->icursorProc == NULL)) {
goto done;
}
if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, (char *) objv[3], &index);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[3],
+ &index);
} else {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, Tcl_GetStringFromObj(objv[3], NULL), &index);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, Tcl_GetString(objv[3]),
+ &index);
}
if (result != TCL_OK) {
goto done;
@@ -1304,9 +1248,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
}
break;
- }
- case CANV_INDEX: {
-
+ }
+ case CANV_INDEX: {
int index;
char buf[TCL_INTEGER_SPACE];
@@ -1315,23 +1258,14 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
if (itemPtr->typePtr->indexProc != NULL) {
break;
}
}
if (itemPtr == NULL) {
Tcl_AppendResult(interp, "can't find an indexable item \"",
- Tcl_GetStringFromObj(objv[2], NULL), "\"", (char *) NULL);
+ Tcl_GetString(objv[2]), "\"", NULL);
result = TCL_ERROR;
goto done;
}
@@ -1340,7 +1274,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
itemPtr, (char *) objv[3], &index);
} else {
result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, Tcl_GetStringFromObj(objv[3], NULL), &index);
+ itemPtr, Tcl_GetString(objv[3]), &index);
}
if (result != TCL_OK) {
goto done;
@@ -1348,8 +1282,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
sprintf(buf, "%d", index);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
- }
- case CANV_INSERT: {
+ }
+ case CANV_INSERT: {
int beforeThis;
int x1,x2,y1,y2;
@@ -1358,37 +1292,29 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
if ((itemPtr->typePtr->indexProc == NULL)
|| (itemPtr->typePtr->insertProc == NULL)) {
continue;
}
if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, (char *) objv[3], &beforeThis);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[3],
+ &beforeThis);
} else {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, Tcl_GetStringFromObj(objv[3], NULL), &beforeThis);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, Tcl_GetString(objv[3]),
+ &beforeThis);
}
if (result != TCL_OK) {
goto done;
}
/*
- * Redraw both item's old and new areas: it's possible
- * that an insertion could result in a new area either
- * larger or smaller than the old area. Except if the
- * insertProc sets the TK_ITEM_DONT_REDRAW flag, nothing
- * more needs to be done.
+ * Redraw both item's old and new areas: it's possible that an
+ * insertion could result in a new area either larger or smaller
+ * than the old area. Except if the insertProc sets the
+ * TK_ITEM_DONT_REDRAW flag, nothing more needs to be done.
*/
x1 = itemPtr->x1; y1 = itemPtr->y1;
@@ -1399,7 +1325,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
itemPtr, beforeThis, (char *) objv[4]);
} else {
(*itemPtr->typePtr->insertProc)((Tk_Canvas) canvasPtr,
- itemPtr, beforeThis, Tcl_GetStringFromObj(objv[4], NULL));
+ itemPtr, beforeThis, Tcl_GetString(objv[4]));
}
if (!(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW)) {
Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
@@ -1409,48 +1335,31 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
}
break;
- }
- case CANV_ITEMCGET: {
+ }
+ case CANV_ITEMCGET:
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId option");
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- itemPtr = TagSearchFirst(searchPtr);
-#endif /* USE_OLD_TAG_SEARCH */
+ FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done);
if (itemPtr != NULL) {
result = Tk_ConfigureValue(canvasPtr->interp, canvasPtr->tkwin,
itemPtr->typePtr->configSpecs, (char *) itemPtr,
- Tcl_GetStringFromObj(objv[3], NULL), 0);
+ Tcl_GetString(objv[3]), 0);
}
break;
- }
- case CANV_ITEMCONFIGURE: {
+ case CANV_ITEMCONFIGURE:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?option value ...?");
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
if (objc == 3) {
result = Tk_ConfigureInfo(canvasPtr->interp, canvasPtr->tkwin,
itemPtr->typePtr->configSpecs, (char *) itemPtr,
- (char *) NULL, 0);
+ NULL, 0);
} else if (objc == 4) {
result = Tk_ConfigureInfo(canvasPtr->interp, canvasPtr->tkwin,
itemPtr->typePtr->configSpecs, (char *) itemPtr,
@@ -1458,15 +1367,17 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
} else {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = (*itemPtr->typePtr->configProc)(interp,
- (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3,
- TK_CONFIG_ARGV_ONLY);
+ result = (*itemPtr->typePtr->configProc)(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3,
+ TK_CONFIG_ARGV_ONLY);
} else {
- CONST char **args = GetStringsFromObjs(objc-3, objv+3);
- result = (*itemPtr->typePtr->configProc)(interp,
- (Tk_Canvas) canvasPtr, itemPtr, objc-3, (Tcl_Obj **) args,
- TK_CONFIG_ARGV_ONLY);
- if (args) ckfree((char *) args);
+ CONST char **args = TkGetStringsFromObjs(objc-3, objv+3);
+ result = (*itemPtr->typePtr->configProc)(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, objc-3,
+ (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY);
+ if (args != NULL) {
+ ckfree((char *) args);
+ }
}
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
canvasPtr->flags |= REPICK_NEEDED;
@@ -1476,8 +1387,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
}
break;
- }
- case CANV_LOWER: {
+ case CANV_LOWER: {
Tk_Item *itemPtr;
if ((objc != 3) && (objc != 4)) {
@@ -1487,24 +1397,16 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
/*
- * First find the item just after which we'll insert the
- * named items.
+ * First find the item just after which we'll insert the named items.
*/
if (objc == 3) {
itemPtr = NULL;
} else {
-#ifdef USE_OLD_TAG_SEARCH
- itemPtr = StartTagSearch(canvasPtr, objv[3], &search);
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[3], &searchPtr)) != TCL_OK) {
- goto done;
- }
- itemPtr = TagSearchFirst(searchPtr);
-#endif /* USE_OLD_TAG_SEARCH */
+ FIRST_CANVAS_ITEM_MATCHING(objv[3], &searchPtr, goto done);
if (itemPtr == NULL) {
Tcl_AppendResult(interp, "tag \"", Tcl_GetString(objv[3]),
- "\" doesn't match any items", (char *) NULL);
+ "\" doesn't match any items", NULL);
result = TCL_ERROR;
goto done;
}
@@ -1513,13 +1415,11 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
#ifdef USE_OLD_TAG_SEARCH
RelinkItems(canvasPtr, objv[2], itemPtr);
#else /* USE_OLD_TAG_SEARCH */
- if ((result = RelinkItems(canvasPtr, objv[2], itemPtr, &searchPtr)) != TCL_OK) {
- goto done;
- }
+ result = RelinkItems(canvasPtr, objv[2], itemPtr, &searchPtr);
#endif /* USE_OLD_TAG_SEARCH */
break;
- }
- case CANV_MOVE: {
+ }
+ case CANV_MOVE: {
double xAmount, yAmount;
if (objc != 5) {
@@ -1533,16 +1433,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
(void) (*itemPtr->typePtr->translateProc)((Tk_Canvas) canvasPtr,
itemPtr, xAmount, yAmount);
@@ -1550,14 +1441,17 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
canvasPtr->flags |= REPICK_NEEDED;
}
break;
- }
- case CANV_POSTSCRIPT: {
- CONST char **args = GetStringsFromObjs(objc, objv);
+ }
+ case CANV_POSTSCRIPT: {
+ CONST char **args = TkGetStringsFromObjs(objc, objv);
+
result = TkCanvPostscriptCmd(canvasPtr, interp, objc, args);
- if (args) ckfree((char *) args);
+ if (args != NULL) {
+ ckfree((char *) args);
+ }
break;
- }
- case CANV_RAISE: {
+ }
+ case CANV_RAISE: {
Tk_Item *prevPtr;
if ((objc != 3) && (objc != 4)) {
@@ -1567,29 +1461,19 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
/*
- * First find the item just after which we'll insert the
- * named items.
+ * First find the item just after which we'll insert the named items.
*/
if (objc == 3) {
prevPtr = canvasPtr->lastItemPtr;
} else {
prevPtr = NULL;
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[3], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[3], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[3], &searchPtr, goto done) {
prevPtr = itemPtr;
}
if (prevPtr == NULL) {
- Tcl_AppendResult(interp, "tagOrId \"", Tcl_GetStringFromObj(objv[3], NULL),
- "\" doesn't match any items", (char *) NULL);
+ Tcl_AppendResult(interp, "tagOrId \"", Tcl_GetString(objv[3]),
+ "\" doesn't match any items", NULL);
result = TCL_ERROR;
goto done;
}
@@ -1597,14 +1481,11 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
#ifdef USE_OLD_TAG_SEARCH
RelinkItems(canvasPtr, objv[2], prevPtr);
#else /* USE_OLD_TAG_SEARCH */
- result = RelinkItems(canvasPtr, objv[2], prevPtr, &searchPtr);
- if (result != TCL_OK) {
- goto done;
- }
+ result = RelinkItems(canvasPtr, objv[2], prevPtr, &searchPtr);
#endif /* USE_OLD_TAG_SEARCH */
break;
- }
- case CANV_SCALE: {
+ }
+ case CANV_SCALE: {
double xOrigin, yOrigin, xScale, yScale;
if (objc != 7) {
@@ -1626,16 +1507,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
(void) (*itemPtr->typePtr->scaleProc)((Tk_Canvas) canvasPtr,
itemPtr, xOrigin, yOrigin, xScale, yScale);
@@ -1643,9 +1515,9 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
canvasPtr->flags |= REPICK_NEEDED;
}
break;
- }
- case CANV_SCAN: {
- int x, y, gain=10;
+ }
+ case CANV_SCAN: {
+ int x, y, gain = 10;
static CONST char *optionStrings[] = {
"mark", "dragto", NULL
};
@@ -1687,8 +1559,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
CanvasSetOrigin(canvasPtr, newXOrigin, newYOrigin);
}
break;
- }
- case CANV_SELECT: {
+ }
+ case CANV_SELECT: {
int index, optionindex;
static CONST char *optionStrings[] = {
"adjust", "clear", "from", "item", "to", NULL
@@ -1703,16 +1575,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
goto done;
}
if (objc >= 4) {
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, objv[3], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[3], &searchPtr)) != TCL_OK) {
- goto done;
- }
- for (itemPtr = TagSearchFirst(searchPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(searchPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[3], &searchPtr, goto done) {
if ((itemPtr->typePtr->indexProc != NULL)
&& (itemPtr->typePtr->selectionProc != NULL)){
break;
@@ -1721,30 +1584,32 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
if (itemPtr == NULL) {
Tcl_AppendResult(interp,
"can't find an indexable and selectable item \"",
- Tcl_GetStringFromObj(objv[3], NULL), "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
result = TCL_ERROR;
goto done;
}
}
if (objc == 5) {
if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, (char *) objv[4], &index);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[4],
+ &index);
} else {
- result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, Tcl_GetStringFromObj(objv[4], NULL), &index);
+ result = itemPtr->typePtr->indexProc(interp,
+ (Tk_Canvas) canvasPtr, itemPtr, Tcl_GetString(objv[4]),
+ &index);
}
if (result != TCL_OK) {
goto done;
}
}
- if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings, "select option", 0,
- &optionindex) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings,
+ "select option", 0, &optionindex) != TCL_OK) {
result = TCL_ERROR;
goto done;
}
switch ((enum options) optionindex) {
- case CANV_ADJUST: {
+ case CANV_ADJUST:
if (objc != 5) {
Tcl_WrongNumArgs(interp, 3, objv, "tagOrId index");
result = TCL_ERROR;
@@ -1762,10 +1627,9 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
CanvasSelectTo(canvasPtr, itemPtr, index);
break;
- }
- case CANV_CLEAR: {
+ case CANV_CLEAR:
if (objc != 3) {
- Tcl_AppendResult(interp, 3, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
result = TCL_ERROR;
goto done;
}
@@ -1776,8 +1640,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
goto done;
break;
- }
- case CANV_FROM: {
+ case CANV_FROM:
if (objc != 5) {
Tcl_WrongNumArgs(interp, 3, objv, "tagOrId index");
result = TCL_ERROR;
@@ -1786,22 +1649,18 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
canvasPtr->textInfo.anchorItemPtr = itemPtr;
canvasPtr->textInfo.selectAnchor = index;
break;
- }
- case CANV_ITEM: {
+ case CANV_ITEM:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
result = TCL_ERROR;
goto done;
}
if (canvasPtr->textInfo.selItemPtr != NULL) {
- char buf[TCL_INTEGER_SPACE];
-
- sprintf(buf, "%d", canvasPtr->textInfo.selItemPtr->id);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp,
+ Tcl_NewIntObj(canvasPtr->textInfo.selItemPtr->id));
}
break;
- }
- case CANV_TO: {
+ case CANV_TO:
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index");
result = TCL_ERROR;
@@ -1809,30 +1668,21 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
}
CanvasSelectTo(canvasPtr, itemPtr, index);
break;
- }
}
break;
- }
- case CANV_TYPE: {
+ }
+ case CANV_TYPE:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "tag");
result = TCL_ERROR;
goto done;
}
-#ifdef USE_OLD_TAG_SEARCH
- itemPtr = StartTagSearch(canvasPtr, objv[2], &search);
-#else /* USE_OLD_TAG_SEARCH */
- if ((result = TagSearchScan(canvasPtr, objv[2], &searchPtr)) != TCL_OK) {
- goto done;
- }
- itemPtr = TagSearchFirst(searchPtr);
-#endif /* USE_OLD_TAG_SEARCH */
+ FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done);
if (itemPtr != NULL) {
Tcl_SetResult(interp, itemPtr->typePtr->name, TCL_STATIC);
}
break;
- }
- case CANV_XVIEW: {
+ case CANV_XVIEW: {
int count, type;
int newX = 0; /* Initialization needed only to prevent
* gcc warnings. */
@@ -1845,84 +1695,89 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
- canvasPtr->inset, canvasPtr->scrollX1,
canvasPtr->scrollX2));
} else {
- CONST char **args = GetStringsFromObjs(objc, objv);
+ CONST char **args = TkGetStringsFromObjs(objc, objv);
type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count);
- if (args) ckfree((char *) args);
+ if (args != NULL) {
+ ckfree((char *) args);
+ }
switch (type) {
- case TK_SCROLL_ERROR:
- result = TCL_ERROR;
- goto done;
- case TK_SCROLL_MOVETO:
- newX = canvasPtr->scrollX1 - canvasPtr->inset
- + (int) (fraction * (canvasPtr->scrollX2
- - canvasPtr->scrollX1) + 0.5);
- break;
- case TK_SCROLL_PAGES:
- newX = (int) (canvasPtr->xOrigin + count * .9
- * (Tk_Width(canvasPtr->tkwin) - 2*canvasPtr->inset));
- break;
- case TK_SCROLL_UNITS:
- if (canvasPtr->xScrollIncrement > 0) {
- newX = canvasPtr->xOrigin
- + count*canvasPtr->xScrollIncrement;
- } else {
- newX = (int) (canvasPtr->xOrigin + count * .1
- * (Tk_Width(canvasPtr->tkwin)
- - 2*canvasPtr->inset));
- }
- break;
+ case TK_SCROLL_ERROR:
+ result = TCL_ERROR;
+ goto done;
+ case TK_SCROLL_MOVETO:
+ newX = canvasPtr->scrollX1 - canvasPtr->inset
+ + (int) (fraction * (canvasPtr->scrollX2
+ - canvasPtr->scrollX1) + 0.5);
+ break;
+ case TK_SCROLL_PAGES:
+ newX = (int) (canvasPtr->xOrigin + count * .9
+ * (Tk_Width(canvasPtr->tkwin) - 2*canvasPtr->inset));
+ break;
+ case TK_SCROLL_UNITS:
+ if (canvasPtr->xScrollIncrement > 0) {
+ newX = canvasPtr->xOrigin
+ + count*canvasPtr->xScrollIncrement;
+ } else {
+ newX = (int) (canvasPtr->xOrigin + count * .1
+ * (Tk_Width(canvasPtr->tkwin)
+ - 2*canvasPtr->inset));
+ }
+ break;
}
CanvasSetOrigin(canvasPtr, newX, canvasPtr->yOrigin);
}
break;
- }
- case CANV_YVIEW: {
+ }
+ case CANV_YVIEW: {
int count, type;
int newY = 0; /* Initialization needed only to prevent
* gcc warnings. */
double fraction;
if (objc == 2) {
- Tcl_SetObjResult(interp,ScrollFractions(\
+ Tcl_SetObjResult(interp, ScrollFractions(
canvasPtr->yOrigin + canvasPtr->inset,
canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)
- - canvasPtr->inset, canvasPtr->scrollY1,
- canvasPtr->scrollY2));
+ - canvasPtr->inset,
+ canvasPtr->scrollY1, canvasPtr->scrollY2));
} else {
- CONST char **args = GetStringsFromObjs(objc, objv);
+ CONST char **args = TkGetStringsFromObjs(objc, objv);
type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count);
- if (args) ckfree((char *) args);
+ if (args != NULL) {
+ ckfree((char *) args);
+ }
switch (type) {
- case TK_SCROLL_ERROR:
- result = TCL_ERROR;
- goto done;
- case TK_SCROLL_MOVETO:
- newY = canvasPtr->scrollY1 - canvasPtr->inset
- + (int) (fraction*(canvasPtr->scrollY2
- - canvasPtr->scrollY1) + 0.5);
- break;
- case TK_SCROLL_PAGES:
- newY = (int) (canvasPtr->yOrigin + count * .9
+ case TK_SCROLL_ERROR:
+ result = TCL_ERROR;
+ goto done;
+ case TK_SCROLL_MOVETO:
+ newY = canvasPtr->scrollY1 - canvasPtr->inset
+ + (int) (fraction*(canvasPtr->scrollY2
+ - canvasPtr->scrollY1) + 0.5);
+ break;
+ case TK_SCROLL_PAGES:
+ newY = (int) (canvasPtr->yOrigin + count * .9
+ * (Tk_Height(canvasPtr->tkwin)
+ - 2*canvasPtr->inset));
+ break;
+ case TK_SCROLL_UNITS:
+ if (canvasPtr->yScrollIncrement > 0) {
+ newY = canvasPtr->yOrigin
+ + count*canvasPtr->yScrollIncrement;
+ } else {
+ newY = (int) (canvasPtr->yOrigin + count * .1
* (Tk_Height(canvasPtr->tkwin)
- 2*canvasPtr->inset));
- break;
- case TK_SCROLL_UNITS:
- if (canvasPtr->yScrollIncrement > 0) {
- newY = canvasPtr->yOrigin
- + count*canvasPtr->yScrollIncrement;
- } else {
- newY = (int) (canvasPtr->yOrigin + count * .1
- * (Tk_Height(canvasPtr->tkwin)
- - 2*canvasPtr->inset));
- }
- break;
+ }
+ break;
}
CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, newY);
}
break;
- }
}
- done:
+ }
+
+ done:
#ifndef USE_OLD_TAG_SEARCH
TagSearchDestroy(searchPtr);
#endif /* not USE_OLD_TAG_SEARCH */
@@ -1935,9 +1790,9 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
*
* DestroyCanvas --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a canvas at a safe time
- * (when no-one is using it anymore).
+ * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
+ * up the internal structure of a canvas at a safe time (when no-one is
+ * using it anymore).
*
* Results:
* None.
@@ -1949,8 +1804,8 @@ CanvasWidgetCmd(clientData, interp, objc, objv)
*/
static void
-DestroyCanvas(memPtr)
- char *memPtr; /* Info about canvas widget. */
+DestroyCanvas(
+ char *memPtr) /* Info about canvas widget. */
{
TkCanvas *canvasPtr = (TkCanvas *) memPtr;
Tk_Item *itemPtr;
@@ -1974,9 +1829,8 @@ DestroyCanvas(memPtr)
}
/*
- * Free up all the stuff that requires special handling,
- * then let Tk_FreeOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeOptions handle all the standard option-related stuff.
*/
Tcl_DeleteHashTable(&canvasPtr->idTable);
@@ -1990,7 +1844,7 @@ DestroyCanvas(memPtr)
TagSearchExprDestroy(expr);
expr = next;
}
-#endif
+#endif /* USE_OLD_TAG_SEARCH */
Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler);
if (canvasPtr->bindingTable != NULL) {
Tk_DeleteBindingTable(canvasPtr->bindingTable);
@@ -2005,33 +1859,33 @@ DestroyCanvas(memPtr)
*
* ConfigureCanvas --
*
- * This procedure is called to process an objv/objc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a canvas widget.
+ * This function is called to process an objv/objc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a canvas
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for canvasPtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for canvasPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureCanvas(interp, canvasPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- TkCanvas *canvasPtr; /* Information about widget; may or may
- * not already have values for some fields. */
- int objc; /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureCanvas(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ TkCanvas *canvasPtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of valid entries in objv. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
XGCValues gcValues;
- GC new;
+ GC newGC;
+ Tk_State old_canvas_state=canvasPtr->canvas_state;
if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs,
objc, (CONST char **) objv, (char *) canvasPtr,
@@ -2040,9 +1894,8 @@ ConfigureCanvas(interp, canvasPtr, objc, objv, flags)
}
/*
- * A few options need special processing, such as setting the
- * background from a 3-D border and creating a GC for copying
- * bits to the screen.
+ * A few options need special processing, such as setting the background
+ * from a 3-D border and creating a GC for copying bits to the screen.
*/
Tk_SetBackgroundFromBorder(canvasPtr->tkwin, canvasPtr->bgBorder);
@@ -2055,12 +1908,33 @@ ConfigureCanvas(interp, canvasPtr, objc, objv, flags)
gcValues.function = GXcopy;
gcValues.graphics_exposures = False;
gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
- new = Tk_GetGC(canvasPtr->tkwin,
+ newGC = Tk_GetGC(canvasPtr->tkwin,
GCFunction|GCGraphicsExposures|GCForeground, &gcValues);
if (canvasPtr->pixmapGC != None) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
- canvasPtr->pixmapGC = new;
+ canvasPtr->pixmapGC = newGC;
+
+ /*
+ * Reconfigure items to reflect changed state disabled/normal.
+ */
+
+ if ( old_canvas_state != canvasPtr->canvas_state ) {
+ Tk_Item *itemPtr;
+ int result;
+
+ for ( itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
+ itemPtr = itemPtr->nextPtr) {
+ if ( itemPtr->state == TK_STATE_NULL ) {
+ result = (*itemPtr->typePtr->configProc)(canvasPtr->interp,
+ (Tk_Canvas) canvasPtr, itemPtr, 0, NULL,
+ TK_CONFIG_ARGV_ONLY);
+ if (result != TCL_OK) {
+ Tcl_ResetResult(canvasPtr->interp);
+ }
+ }
+ }
+ }
/*
* Reset the desired dimensions for the window.
@@ -2070,8 +1944,8 @@ ConfigureCanvas(interp, canvasPtr, objc, objv, flags)
canvasPtr->height + 2*canvasPtr->inset);
/*
- * Restart the cursor timing sequence in case the on-time or off-time
- * just changed.
+ * Restart the cursor timing sequence in case the on-time or off-time just
+ * changed.
*/
if (canvasPtr->textInfo.gotFocus) {
@@ -2096,7 +1970,7 @@ ConfigureCanvas(interp, canvasPtr, objc, objv, flags)
}
if (argc2 != 4) {
Tcl_AppendResult(interp, "bad scrollRegion \"",
- canvasPtr->regionString, "\"", (char *) NULL);
+ canvasPtr->regionString, "\"", NULL);
badRegion:
ckfree(canvasPtr->regionString);
ckfree((char *) argv2);
@@ -2133,8 +2007,8 @@ ConfigureCanvas(interp, canvasPtr, objc, objv, flags)
}
/*
- * Reset the canvas's origin (this is a no-op unless confine
- * mode has just been turned on or the scroll region has changed).
+ * Reset the canvas's origin (this is a no-op unless confine mode has just
+ * been turned on or the scroll region has changed).
*/
CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin);
@@ -2151,24 +2025,24 @@ ConfigureCanvas(interp, canvasPtr, objc, objv, flags)
*
* CanvasWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Configures all items in the canvas with a empty argc/argv, for
- * the side effect of causing all the items to recompute their
- * geometry and to be redisplayed.
+ * Configures all items in the canvas with a empty argc/argv, for the
+ * side effect of causing all the items to recompute their geometry and
+ * to be redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
static void
-CanvasWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+CanvasWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
TkCanvas *canvasPtr;
Tk_Item *itemPtr;
@@ -2196,9 +2070,9 @@ CanvasWorldChanged(instanceData)
*
* DisplayCanvas --
*
- * This procedure redraws the contents of a canvas window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This function redraws the contents of a canvas window. It is invoked
+ * as a do-when-idle handler, so it only runs when there's nothing else
+ * for the application to do.
*
* Results:
* None.
@@ -2210,8 +2084,8 @@ CanvasWorldChanged(instanceData)
*/
static void
-DisplayCanvas(clientData)
- ClientData clientData; /* Information about widget. */
+DisplayCanvas(
+ ClientData clientData) /* Information about widget. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
Tk_Window tkwin = canvasPtr->tkwin;
@@ -2228,8 +2102,8 @@ DisplayCanvas(clientData)
}
/*
- * Choose a new current item if that is needed (this could cause
- * event handlers to be invoked).
+ * Choose a new current item if that is needed (this could cause event
+ * handlers to be invoked).
*/
while (canvasPtr->flags & REPICK_NEEDED) {
@@ -2244,9 +2118,9 @@ DisplayCanvas(clientData)
}
/*
- * Scan through the item list, registering the bounding box
- * for all items that didn't do that for the final coordinates
- * yet. This can be determined by the FORCE_REDRAW flag.
+ * Scan through the item list, registering the bounding box for all items
+ * that didn't do that for the final coordinates yet. This can be
+ * determined by the FORCE_REDRAW flag.
*/
for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
@@ -2258,8 +2132,8 @@ DisplayCanvas(clientData)
}
}
/*
- * Compute the intersection between the area that needs redrawing
- * and the area that's visible on the screen.
+ * Compute the intersection between the area that needs redrawing and the
+ * area that's visible on the screen.
*/
if ((canvasPtr->redrawX1 < canvasPtr->redrawX2)
@@ -2283,43 +2157,39 @@ DisplayCanvas(clientData)
if ((screenX1 >= screenX2) || (screenY1 >= screenY2)) {
goto borders;
}
-
+
width = screenX2 - screenX1;
height = screenY2 - screenY1;
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Redrawing is done in a temporary pixmap that is allocated
- * here and freed at the end of the procedure. All drawing
- * is done to the pixmap, and the pixmap is copied to the
- * screen at the end of the procedure. The temporary pixmap
- * serves two purposes:
+ * Redrawing is done in a temporary pixmap that is allocated here and
+ * freed at the end of the function. All drawing is done to the
+ * pixmap, and the pixmap is copied to the screen at the end of the
+ * function. The temporary pixmap serves two purposes:
*
- * 1. It provides a smoother visual effect (no clearing and
- * gradual redraw will be visible to users).
- * 2. It allows us to redraw only the objects that overlap
- * the redraw area. Otherwise incorrect results could
- * occur from redrawing things that stick outside of
- * the redraw area (we'd have to redraw everything in
- * order to make the overlaps look right).
+ * 1. It provides a smoother visual effect (no clearing and gradual
+ * redraw will be visible to users).
+ * 2. It allows us to redraw only the objects that overlap the redraw
+ * area. Otherwise incorrect results could occur from redrawing
+ * things that stick outside of the redraw area (we'd have to
+ * redraw everything in order to make the overlaps look right).
*
* Some tricky points about the pixmap:
*
- * 1. We only allocate a large enough pixmap to hold the
- * area that has to be redisplayed. This saves time in
- * in the X server for large objects that cover much
- * more than the area being redisplayed: only the area
- * of the pixmap will actually have to be redrawn.
- * 2. Some X servers (e.g. the one for DECstations) have troubles
- * with characters that overlap an edge of the pixmap (on the
- * DEC servers, as of 8/18/92, such characters are drawn one
- * pixel too far to the right). To handle this problem,
- * make the pixmap a bit larger than is absolutely needed
- * so that for normal-sized fonts the characters that overlap
- * the edge of the pixmap will be outside the area we care
- * about.
+ * 1. We only allocate a large enough pixmap to hold the area that has
+ * to be redisplayed. This saves time in in the X server for large
+ * objects that cover much more than the area being redisplayed:
+ * only the area of the pixmap will actually have to be redrawn.
+ * 2. Some X servers (e.g. the one for DECstations) have troubles with
+ * with characters that overlap an edge of the pixmap (on the DEC
+ * servers, as of 8/18/92, such characters are drawn one pixel too
+ * far to the right). To handle this problem, make the pixmap a bit
+ * larger than is absolutely needed so that for normal-sized fonts
+ * the characters that overlap the edge of the pixmap will be
+ * outside the area we care about.
*/
-
+
canvasPtr->drawableXOrigin = screenX1 - 30;
canvasPtr->drawableYOrigin = screenY1 - 30;
pixmap = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
@@ -2334,24 +2204,24 @@ DisplayCanvas(clientData)
screenX1 - canvasPtr->xOrigin, screenY1 - canvasPtr->yOrigin,
width, height);
#endif /* TK_NO_DOUBLE_BUFFERING */
-
+
/*
* Clear the area to be redrawn.
*/
-
+
XFillRectangle(Tk_Display(tkwin), pixmap, canvasPtr->pixmapGC,
screenX1 - canvasPtr->drawableXOrigin,
screenY1 - canvasPtr->drawableYOrigin, (unsigned int) width,
(unsigned int) height);
-
+
/*
- * Scan through the item list, redrawing those items that need it.
- * An item must be redraw if either (a) it intersects the smaller
+ * Scan through the item list, redrawing those items that need it. An
+ * item must be redraw if either (a) it intersects the smaller
* on-screen area or (b) it intersects the full canvas area and its
- * type requests that it be redrawn always (e.g. so subwindows can
- * be unmapped when they move off-screen).
+ * type requests that it be redrawn always (e.g. so subwindows can be
+ * unmapped when they move off-screen).
*/
-
+
for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
itemPtr = itemPtr->nextPtr) {
if ((itemPtr->x1 >= screenX2)
@@ -2375,13 +2245,13 @@ DisplayCanvas(clientData)
canvasPtr->display, pixmap, screenX1, screenY1, width,
height);
}
-
+
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Copy from the temporary pixmap to the screen, then free up
- * the temporary pixmap.
+ * Copy from the temporary pixmap to the screen, then free up the
+ * temporary pixmap.
*/
-
+
XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin),
canvasPtr->pixmapGC,
screenX1 - canvasPtr->drawableXOrigin,
@@ -2398,7 +2268,7 @@ DisplayCanvas(clientData)
* Draw the window borders, if needed.
*/
- borders:
+ borders:
if (canvasPtr->flags & REDRAW_BORDERS) {
canvasPtr->flags &= ~REDRAW_BORDERS;
if (canvasPtr->borderWidth > 0) {
@@ -2426,7 +2296,7 @@ DisplayCanvas(clientData)
}
}
- done:
+ done:
canvasPtr->flags &= ~(REDRAW_PENDING|BBOX_NOT_EMPTY);
canvasPtr->redrawX1 = canvasPtr->redrawX2 = 0;
canvasPtr->redrawY1 = canvasPtr->redrawY2 = 0;
@@ -2440,23 +2310,23 @@ DisplayCanvas(clientData)
*
* CanvasEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on canvases.
+ * This function is invoked by the Tk dispatcher for various events on
+ * canvases.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-CanvasEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+CanvasEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
@@ -2491,8 +2361,8 @@ CanvasEventProc(clientData, eventPtr)
canvasPtr->flags |= UPDATE_SCROLLBARS;
/*
- * The call below is needed in order to recenter the canvas if
- * it's confined and its scroll region is smaller than the window.
+ * The call below is needed in order to recenter the canvas if it's
+ * confined and its scroll region is smaller than the window.
*/
CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin);
@@ -2513,9 +2383,9 @@ CanvasEventProc(clientData, eventPtr)
Tk_Item *itemPtr;
/*
- * Special hack: if the canvas is unmapped, then must notify
- * all items with "alwaysRedraw" set, so that they know that
- * they are no longer displayed.
+ * Special hack: if the canvas is unmapped, then must notify all items
+ * with "alwaysRedraw" set, so that they know that they are no longer
+ * displayed.
*/
for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
@@ -2533,9 +2403,9 @@ CanvasEventProc(clientData, eventPtr)
*
* CanvasCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -2547,17 +2417,17 @@ CanvasEventProc(clientData, eventPtr)
*/
static void
-CanvasCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+CanvasCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
Tk_Window tkwin = canvasPtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
if (tkwin != NULL) {
@@ -2571,8 +2441,8 @@ CanvasCmdDeletedProc(clientData)
*
* Tk_CanvasEventuallyRedraw --
*
- * Arrange for part or all of a canvas widget to redrawn at
- * some convenient time in the future.
+ * Arrange for part or all of a canvas widget to redrawn at some
+ * convenient time in the future.
*
* Results:
* None.
@@ -2584,18 +2454,20 @@ CanvasCmdDeletedProc(clientData)
*/
void
-Tk_CanvasEventuallyRedraw(canvas, x1, y1, x2, y2)
- Tk_Canvas canvas; /* Information about widget. */
- int x1, y1; /* Upper left corner of area to redraw.
- * Pixels on edge are redrawn. */
- int x2, y2; /* Lower right corner of area to redraw.
+Tk_CanvasEventuallyRedraw(
+ Tk_Canvas canvas, /* Information about widget. */
+ int x1, int y1, /* Upper left corner of area to redraw. Pixels
+ * on edge are redrawn. */
+ int x2, int y2) /* Lower right corner of area to redraw.
* Pixels on edge are not redrawn. */
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
+
/*
* If tkwin is NULL, the canvas has been destroyed, so we can't really
* redraw it.
*/
+
if (canvasPtr->tkwin == NULL) {
return;
}
@@ -2637,8 +2509,8 @@ Tk_CanvasEventuallyRedraw(canvas, x1, y1, x2, y2)
*
* EventuallyRedrawItem --
*
- * Arrange for part or all of a canvas widget to redrawn at
- * some convenient time in the future.
+ * Arrange for part or all of a canvas widget to redrawn at some
+ * convenient time in the future.
*
* Results:
* None.
@@ -2650,9 +2522,9 @@ Tk_CanvasEventuallyRedraw(canvas, x1, y1, x2, y2)
*/
static void
-EventuallyRedrawItem(canvas, itemPtr)
- Tk_Canvas canvas; /* Information about widget. */
- Tk_Item *itemPtr; /* item to be redrawn. */
+EventuallyRedrawItem(
+ Tk_Canvas canvas, /* Information about widget. */
+ Tk_Item *itemPtr) /* Item to be redrawn. */
{
TkCanvas *canvasPtr = (TkCanvas *) canvas;
if ((itemPtr->x1 >= itemPtr->x2) || (itemPtr->y1 >= itemPtr->y2) ||
@@ -2698,27 +2570,26 @@ EventuallyRedrawItem(canvas, itemPtr)
*
* Tk_CreateItemType --
*
- * This procedure may be invoked to add a new kind of canvas
- * element to the core item types supported by Tk.
+ * This function may be invoked to add a new kind of canvas element to
+ * the core item types supported by Tk.
*
* Results:
* None.
*
* Side effects:
- * From now on, the new item type will be useable in canvas
- * widgets (e.g. typePtr->name can be used as the item type
- * in "create" widget commands). If there was already a
- * type with the same name as in typePtr, it is replaced with
- * the new type.
+ * From now on, the new item type will be useable in canvas widgets
+ * (e.g. typePtr->name can be used as the item type in "create" widget
+ * commands). If there was already a type with the same name as in
+ * typePtr, it is replaced with the new type.
*
*--------------------------------------------------------------
*/
void
-Tk_CreateItemType(typePtr)
- Tk_ItemType *typePtr; /* Information about item type;
- * storage must be statically
- * allocated (must live forever). */
+Tk_CreateItemType(
+ Tk_ItemType *typePtr) /* Information about item type; storage must
+ * be statically allocated (must live
+ * forever). */
{
Tk_ItemType *typePtr2, *prevPtr;
@@ -2752,14 +2623,14 @@ Tk_CreateItemType(typePtr)
*
* Tk_GetItemTypes --
*
- * This procedure returns a pointer to the list of all item
- * types. Note that this is inherently thread-unsafe, but since
- * item types are only ever registered very rarely this is
- * unlikely to be a problem in practice.
+ * This function returns a pointer to the list of all item types. Note
+ * that this is inherently thread-unsafe, but since item types are only
+ * ever registered very rarely this is unlikely to be a problem in
+ * practice.
*
* Results:
- * The return value is a pointer to the first in the list
- * of item types currently supported by canvases.
+ * The return value is a pointer to the first in the list of item types
+ * currently supported by canvases.
*
* Side effects:
* None.
@@ -2768,7 +2639,7 @@ Tk_CreateItemType(typePtr)
*/
Tk_ItemType *
-Tk_GetItemTypes()
+Tk_GetItemTypes(void)
{
if (typeList == NULL) {
InitCanvas();
@@ -2777,13 +2648,12 @@ Tk_GetItemTypes()
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* InitCanvas --
*
- * This procedure is invoked to perform once-only-ever
- * initialization for the module, such as setting up the type
- * table.
+ * This function is invoked to perform once-only-ever initialization for
+ * the module, such as setting up the type table.
*
* Results:
* None.
@@ -2791,11 +2661,11 @@ Tk_GetItemTypes()
* Side effects:
* None.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static void
-InitCanvas()
+InitCanvas(void)
{
Tcl_MutexLock(&typeListMutex);
if (typeList != NULL) {
@@ -2821,33 +2691,30 @@ InitCanvas()
*
* StartTagSearch --
*
- * This procedure is called to initiate an enumeration of
- * all items in a given canvas that contain a given tag.
+ * This function is called to initiate an enumeration of all items in a
+ * given canvas that contain a given tag.
*
* Results:
- * The return value is a pointer to the first item in
- * canvasPtr that matches tag, or NULL if there is no
- * such item. The information at *searchPtr is initialized
- * such that successive calls to NextItem will return
- * successive items that match tag.
+ * The return value is a pointer to the first item in canvasPtr that
+ * matches tag, or NULL if there is no such item. The information at
+ * *searchPtr is initialized such that successive calls to NextItem will
+ * return successive items that match tag.
*
* Side effects:
- * SearchPtr is linked into a list of searches in progress
- * on canvasPtr, so that elements can safely be deleted
- * while the search is in progress. EndTagSearch must be
- * called at the end of the search to unlink searchPtr from
- * this list.
+ * SearchPtr is linked into a list of searches in progress on canvasPtr,
+ * so that elements can safely be deleted while the search is in
+ * progress. EndTagSearch must be called at the end of the search to
+ * unlink searchPtr from this list.
*
*--------------------------------------------------------------
*/
static Tk_Item *
-StartTagSearch(canvasPtr, tagObj, searchPtr)
- TkCanvas *canvasPtr; /* Canvas whose items are to be
- * searched. */
- Tcl_Obj *tagObj; /* Object giving tag value. */
- TagSearch *searchPtr; /* Record describing tag search;
- * will be initialized here. */
+StartTagSearch(
+ TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */
+ Tcl_Obj *tagObj, /* Object giving tag value. */
+ TagSearch *searchPtr) /* Record describing tag search; will be
+ * initialized here. */
{
int id;
Tk_Item *itemPtr, *lastPtr;
@@ -2869,10 +2736,10 @@ StartTagSearch(canvasPtr, tagObj, searchPtr)
searchPtr->searchOver = 0;
/*
- * Find the first matching item in one of several ways. If the tag
- * is a number then it selects the single item with the matching
- * identifier. In this case see if the item being requested is the
- * hot item, in which case the search can be skipped.
+ * Find the first matching item in one of several ways. If the tag is a
+ * number then it selects the single item with the matching identifier.
+ * In this case see if the item being requested is the hot item, in which
+ * case the search can be skipped.
*/
if (isdigit(UCHAR(*tag))) {
@@ -2883,7 +2750,7 @@ StartTagSearch(canvasPtr, tagObj, searchPtr)
id = strtoul(tag, &end, 0);
if (*end == 0) {
itemPtr = canvasPtr->hotPtr;
- lastPtr = canvasPtr->hotPrevPtr;
+ lastPtr = canvasPtr->hotPrevPtr;
if ((itemPtr == NULL) || (itemPtr->id != id) || (lastPtr == NULL)
|| (lastPtr->nextPtr != itemPtr)) {
dispPtr->numSlowSearches++;
@@ -2916,7 +2783,7 @@ StartTagSearch(canvasPtr, tagObj, searchPtr)
}
/*
- * None of the above. Search for an item with a matching tag.
+ * None of the above. Search for an item with a matching tag.
*/
for (lastPtr = NULL, itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
@@ -2940,15 +2807,15 @@ StartTagSearch(canvasPtr, tagObj, searchPtr)
*
* NextItem --
*
- * This procedure returns successive items that match a given
- * tag; it should be called only after StartTagSearch has been
- * used to begin a search.
+ * This function returns successive items that match a given tag; it
+ * should be called only after StartTagSearch has been used to begin a
+ * search.
*
* Results:
- * The return value is a pointer to the next item that matches
- * the tag specified to StartTagSearch, or NULL if no such
- * item exists. *SearchPtr is updated so that the next call
- * to this procedure will return the next item.
+ * The return value is a pointer to the next item that matches the tag
+ * specified to StartTagSearch, or NULL if no such item exists.
+ * *SearchPtr is updated so that the next call to this function will
+ * return the next item.
*
* Side effects:
* None.
@@ -2957,9 +2824,8 @@ StartTagSearch(canvasPtr, tagObj, searchPtr)
*/
static Tk_Item *
-NextItem(searchPtr)
- TagSearch *searchPtr; /* Record describing search in
- * progress. */
+NextItem(
+ TagSearch *searchPtr) /* Record describing search in progress. */
{
Tk_Item *itemPtr, *lastPtr;
int count;
@@ -2967,8 +2833,8 @@ NextItem(searchPtr)
Tk_Uid *tagPtr;
/*
- * Find next item in list (this may not actually be a suitable
- * one to return), and return if there are no items left.
+ * Find next item in list (this may not actually be a suitable one to
+ * return), and return if there are no items left.
*/
lastPtr = searchPtr->lastPtr;
@@ -2983,10 +2849,10 @@ NextItem(searchPtr)
}
if (itemPtr != searchPtr->currentPtr) {
/*
- * The structure of the list has changed. Probably the
- * previously-returned item was removed from the list.
- * In this case, don't advance lastPtr; just return
- * its new successor (i.e. do nothing here).
+ * The structure of the list has changed. Probably the previously-
+ * returned item was removed from the list. In this case, don't
+ * advance lastPtr; just return its new successor (i.e. do nothing
+ * here).
*/
} else {
lastPtr = itemPtr;
@@ -3023,29 +2889,28 @@ NextItem(searchPtr)
return NULL;
}
-#else /* USE_OLD_TAG_SEARCH */
+#else /* !USE_OLD_TAG_SEARCH */
/*
*----------------------------------------------------------------------
*
* GetStaticUids --
*
- *This procedure is invoked to return a structure filled with
- *the Uids used when doing tag searching. If it was never before
- *called in the current thread, it initializes the structure for
- *that thread (uids are only ever local to one thread [Bug
- *1114977]).
+ * This function is invoked to return a structure filled with the Uids
+ * used when doing tag searching. If it was never before called in the
+ * current thread, it initializes the structure for that thread (uids are
+ * only ever local to one thread [Bug 1114977]).
*
* Results:
- *None.
+ * None.
*
* Side effects:
- *None.
+ * None.
*
*----------------------------------------------------------------------
*/
static SearchUids *
-GetStaticUids()
+GetStaticUids(void)
{
SearchUids *searchUids = (SearchUids *)
Tcl_GetThreadData(&dataKey, sizeof(SearchUids));
@@ -3070,7 +2935,7 @@ GetStaticUids()
*
* TagSearchExprInit --
*
- * This procedure allocates and initializes one TagSearchExpr struct.
+ * This function allocates and initializes one TagSearchExpr struct.
*
* Results:
*
@@ -3080,8 +2945,8 @@ GetStaticUids()
*/
static void
-TagSearchExprInit(exprPtrPtr)
- TagSearchExpr **exprPtrPtr;
+TagSearchExprInit(
+ TagSearchExpr **exprPtrPtr)
{
TagSearchExpr* expr = *exprPtrPtr;
@@ -3096,67 +2961,63 @@ TagSearchExprInit(exprPtrPtr)
expr->length = 0;
*exprPtrPtr = expr;
}
-
+
/*
*--------------------------------------------------------------
*
* TagSearchExprDestroy --
*
- * This procedure destroys one TagSearchExpr structure.
+ * This function destroys one TagSearchExpr structure.
*
* Results:
*
* Side effects:
*
*--------------------------------------------------------------
- */
+ */
static void
-TagSearchExprDestroy(expr)
- TagSearchExpr *expr;
+TagSearchExprDestroy(
+ TagSearchExpr *expr)
{
if (expr) {
if (expr->uids) {
- ckfree((char *)expr->uids);
+ ckfree((char *)expr->uids);
}
- ckfree((char *)expr);
+ ckfree((char *)expr);
}
}
-
+
/*
*--------------------------------------------------------------
*
* TagSearchScan --
*
- * This procedure is called to initiate an enumeration of
- * all items in a given canvas that contain a tag that matches
- * the tagOrId expression.
+ * This function is called to initiate an enumeration of all items in a
+ * given canvas that contain a tag that matches the tagOrId expression.
*
* Results:
- * The return value indicates if the tagOrId expression
- * was successfully scanned (syntax).
- * The information at *searchPtr is initialized
- * such that a call to TagSearchFirst, followed by
- * successive calls to TagSearchNext will return items
- * that match tag.
+ * The return value indicates if the tagOrId expression was successfully
+ * scanned (syntax). The information at *searchPtr is initialized such
+ * that a call to TagSearchFirst, followed by successive calls to
+ * TagSearchNext will return items that match tag.
*
* Side effects:
- * SearchPtr is linked into a list of searches in progress
- * on canvasPtr, so that elements can safely be deleted
- * while the search is in progress.
+ * SearchPtr is linked into a list of searches in progress on canvasPtr,
+ * so that elements can safely be deleted while the search is in
+ * progress.
*
*--------------------------------------------------------------
*/
static int
-TagSearchScan(canvasPtr, tagObj, searchPtrPtr)
- TkCanvas *canvasPtr; /* Canvas whose items are to be
- * searched. */
- Tcl_Obj *tagObj; /* Object giving tag value. */
- TagSearch **searchPtrPtr; /* Record describing tag search;
- * will be initialized here. */
+TagSearchScan(
+ TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */
+ Tcl_Obj *tagObj, /* Object giving tag value. */
+ TagSearch **searchPtrPtr) /* Record describing tag search; will be
+ * initialized here. */
{
- char *tag = Tcl_GetStringFromObj(tagObj,NULL);
+ char *tag = Tcl_GetString(tagObj);
int i;
TagSearch *searchPtr;
@@ -3165,61 +3026,78 @@ TagSearchScan(canvasPtr, tagObj, searchPtrPtr)
*/
if (*searchPtrPtr) {
- searchPtr = *searchPtrPtr;
+ searchPtr = *searchPtrPtr;
} else {
- /* Allocate primary search struct on first call */
- *searchPtrPtr = searchPtr = (TagSearch *) ckalloc(sizeof(TagSearch));
+ /*
+ * Allocate primary search struct on first call.
+ */
+
+ *searchPtrPtr = searchPtr = (TagSearch *) ckalloc(sizeof(TagSearch));
searchPtr->expr = NULL;
- /* Allocate buffer for rewritten tags (after de-escaping) */
- searchPtr->rewritebufferAllocated = 100;
- searchPtr->rewritebuffer =
- ckalloc(searchPtr->rewritebufferAllocated);
+ /*
+ * Allocate buffer for rewritten tags (after de-escaping).
+ */
+
+ searchPtr->rewritebufferAllocated = 100;
+ searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated);
}
TagSearchExprInit(&(searchPtr->expr));
- /* How long is the tagOrId ? */
+ /*
+ * How long is the tagOrId?
+ */
+
searchPtr->stringLength = strlen(tag);
- /* Make sure there is enough buffer to hold rewritten tags */
+ /*
+ * Make sure there is enough buffer to hold rewritten tags.
+ */
+
if ((unsigned int)searchPtr->stringLength >=
searchPtr->rewritebufferAllocated) {
- searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100;
- searchPtr->rewritebuffer =
- ckrealloc(searchPtr->rewritebuffer,
- searchPtr->rewritebufferAllocated);
+ searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100;
+ searchPtr->rewritebuffer =
+ ckrealloc(searchPtr->rewritebuffer,
+ searchPtr->rewritebufferAllocated);
}
- /* Initialize search */
+ /*
+ * Initialize search.
+ */
+
searchPtr->canvasPtr = canvasPtr;
searchPtr->searchOver = 0;
- searchPtr->type = 0;
+ searchPtr->type = SEARCH_TYPE_EMPTY;
/*
- * Find the first matching item in one of several ways. If the tag
- * is a number then it selects the single item with the matching
- * identifier. In this case see if the item being requested is the
- * hot item, in which case the search can be skipped.
+ * Find the first matching item in one of several ways. If the tag is a
+ * number then it selects the single item with the matching identifier.
+ * In this case see if the item being requested is the hot item, in which
+ * case the search can be skipped.
*/
if (searchPtr->stringLength && isdigit(UCHAR(*tag))) {
- char *end;
+ char *end;
- searchPtr->id = strtoul(tag, &end, 0);
- if (*end == 0) {
- searchPtr->type = 1;
- return TCL_OK;
+ searchPtr->id = strtoul(tag, &end, 0);
+ if (*end == 0) {
+ searchPtr->type = SEARCH_TYPE_ID;
+ return TCL_OK;
}
}
/*
- * For all other tags and tag expressions convert to a UID.
- * This UID is kept forever, but this should be thought of
- * as a cache rather than as a memory leak.
+ * For all other tags and tag expressions convert to a UID. This UID is
+ * kept forever, but this should be thought of as a cache rather than as a
+ * memory leak.
*/
searchPtr->expr->uid = Tk_GetUid(tag);
- /* short circuit impossible searches for null tags */
+ /*
+ * Short circuit impossible searches for null tags.
+ */
+
if (searchPtr->stringLength == 0) {
return TCL_OK;
}
@@ -3228,55 +3106,58 @@ TagSearchScan(canvasPtr, tagObj, searchPtrPtr)
* Pre-scan tag for at least one unquoted "&&" "||" "^" "!"
* if not found then use string as simple tag
*/
+
for (i = 0; i < searchPtr->stringLength ; i++) {
- if (tag[i] == '"') {
- i++;
- for ( ; i < searchPtr->stringLength; i++) {
- if (tag[i] == '\\') {
- i++;
- continue;
- }
- if (tag[i] == '"') {
- break;
- }
- }
- } else {
- if ((tag[i] == '&' && tag[i+1] == '&')
- || (tag[i] == '|' && tag[i+1] == '|')
- || (tag[i] == '^')
- || (tag[i] == '!')) {
- searchPtr->type = 4;
- break;
- }
- }
+ if (tag[i] == '"') {
+ i++;
+ for ( ; i < searchPtr->stringLength; i++) {
+ if (tag[i] == '\\') {
+ i++;
+ continue;
+ }
+ if (tag[i] == '"') {
+ break;
+ }
+ }
+ } else if ((tag[i] == '&' && tag[i+1] == '&')
+ || (tag[i] == '|' && tag[i+1] == '|')
+ || (tag[i] == '^')
+ || (tag[i] == '!')) {
+ searchPtr->type = SEARCH_TYPE_EXPR;
+ break;
+ }
}
searchPtr->string = tag;
searchPtr->stringIndex = 0;
- if (searchPtr->type == 4) {
- /*
- * an operator was found in the prescan, so
- * now compile the tag expression into array of Tk_Uid
- * flagging any syntax errors found
- */
- if (TagSearchScanExpr(canvasPtr->interp, searchPtr, searchPtr->expr) != TCL_OK) {
- /* Syntax error in tag expression */
- /* Result message set by TagSearchScanExpr */
+ if (searchPtr->type == SEARCH_TYPE_EXPR) {
+ /*
+ * An operator was found in the prescan, so now compile the tag
+ * expression into array of Tk_Uid flagging any syntax errors found.
+ */
+
+ if (TagSearchScanExpr(canvasPtr->interp, searchPtr,
+ searchPtr->expr) != TCL_OK) {
+ /*
+ * Syntax error in tag expression. The result message was set by
+ * TagSearchScanExpr.
+ */
+
return TCL_ERROR;
}
searchPtr->expr->length = searchPtr->expr->index;
+ } else if (searchPtr->expr->uid == GetStaticUids()->allUid) {
+ /*
+ * All items match.
+ */
+
+ searchPtr->type = SEARCH_TYPE_ALL;
} else {
- if (searchPtr->expr->uid == GetStaticUids()->allUid) {
- /*
- * All items match.
- */
- searchPtr->type = 2;
- } else {
- /*
- * Optimized single-tag search
- */
- searchPtr->type = 3;
- }
+ /*
+ * Optimized single-tag search
+ */
+
+ searchPtr->type = SEARCH_TYPE_TAG;
}
return TCL_OK;
}
@@ -3286,24 +3167,26 @@ TagSearchScan(canvasPtr, tagObj, searchPtrPtr)
*
* TagSearchDestroy --
*
- * This procedure destroys any dynamic structures that
- * may have been allocated by TagSearchScan.
+ * This function destroys any dynamic structures that may have been
+ * allocated by TagSearchScan.
*
* Results:
+ * None
*
* Side effects:
+ * Deallocates memory.
*
*--------------------------------------------------------------
*/
static void
-TagSearchDestroy(searchPtr)
- TagSearch *searchPtr; /* Record describing tag search */
+TagSearchDestroy(
+ TagSearch *searchPtr) /* Record describing tag search */
{
if (searchPtr) {
- TagSearchExprDestroy(searchPtr->expr);
- ckfree((char *)searchPtr->rewritebuffer);
- ckfree((char *)searchPtr);
+ TagSearchExprDestroy(searchPtr->expr);
+ ckfree((char *)searchPtr->rewritebuffer);
+ ckfree((char *)searchPtr);
}
}
@@ -3312,16 +3195,14 @@ TagSearchDestroy(searchPtr)
*
* TagSearchScanExpr --
*
- * This recursive procedure is called to scan a tag expression
- * and compile it into an array of Tk_Uids.
+ * This recursive function is called to scan a tag expression and compile
+ * it into an array of Tk_Uids.
*
* Results:
- * The return value indicates if the tagOrId expression
- * was successfully scanned (syntax).
- * The information at *searchPtr is initialized
- * such that a call to TagSearchFirst, followed by
- * successive calls to TagSearchNext will return items
- * that match tag.
+ * The return value indicates if the tagOrId expression was successfully
+ * scanned (syntax). The information at *searchPtr is initialized such
+ * that a call to TagSearchFirst, followed by successive calls to
+ * TagSearchNext will return items that match tag.
*
* Side effects:
*
@@ -3329,216 +3210,233 @@ TagSearchDestroy(searchPtr)
*/
static int
-TagSearchScanExpr(interp, searchPtr, expr)
- Tcl_Interp *interp; /* Current interpreter. */
- TagSearch *searchPtr; /* Search data */
- TagSearchExpr *expr; /* compiled expression result */
+TagSearchScanExpr(
+ Tcl_Interp *interp, /* Current interpreter. */
+ TagSearch *searchPtr, /* Search data */
+ TagSearchExpr *expr) /* compiled expression result */
{
- int looking_for_tag; /* When true, scanner expects
- * next char(s) to be a tag,
- * else operand expected */
- int found_tag; /* One or more tags found */
- int found_endquote; /* For quoted tag string parsing */
- int negate_result; /* Pending negation of next tag value */
- char *tag; /* tag from tag expression string */
+ int looking_for_tag; /* When true, scanner expects next char(s) to
+ * be a tag, else operand expected */
+ int found_tag; /* One or more tags found */
+ int found_endquote; /* For quoted tag string parsing */
+ int negate_result; /* Pending negation of next tag value */
+ char *tag; /* Tag from tag expression string */
char c;
SearchUids *searchUids; /* Collection of uids for basic search
* expression terms. */
-
+
searchUids = GetStaticUids();
negate_result = 0;
found_tag = 0;
looking_for_tag = 1;
while (searchPtr->stringIndex < searchPtr->stringLength) {
- c = searchPtr->string[searchPtr->stringIndex++];
+ c = searchPtr->string[searchPtr->stringIndex++];
- if (expr->allocated == expr->index) {
- expr->allocated += 15;
+ /*
+ * Need two slots free at this point, not one. [Bug 2931374]
+ */
+
+ if (expr->index >= expr->allocated-1) {
+ expr->allocated += 15;
if (expr->uids) {
- expr->uids =
- (Tk_Uid *) ckrealloc((char *)(expr->uids),
- (expr->allocated)*sizeof(Tk_Uid));
+ expr->uids = (Tk_Uid *)
+ ckrealloc((char *)(expr->uids),
+ (expr->allocated)*sizeof(Tk_Uid));
} else {
- expr->uids =
- (Tk_Uid *) ckalloc((expr->allocated)*sizeof(Tk_Uid));
+ expr->uids = (Tk_Uid *)
+ ckalloc((expr->allocated)*sizeof(Tk_Uid));
}
- }
-
- if (looking_for_tag) {
-
- switch (c) {
- case ' ' : /* ignore unquoted whitespace */
- case '\t' :
- case '\n' :
- case '\r' :
- break;
-
- case '!' : /* negate next tag or subexpr */
- if (looking_for_tag > 1) {
- Tcl_AppendResult(interp,
- "Too many '!' in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- looking_for_tag++;
- negate_result = 1;
- break;
-
- case '(' : /* scan (negated) subexpr recursively */
- if (negate_result) {
- expr->uids[expr->index++] = searchUids->negparenUid;
- negate_result = 0;
- } else {
- expr->uids[expr->index++] = searchUids->parenUid;
+ }
+
+ if (looking_for_tag) {
+
+ switch (c) {
+ case ' ': /* ignore unquoted whitespace */
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+
+ case '!': /* negate next tag or subexpr */
+ if (looking_for_tag > 1) {
+ Tcl_AppendResult(interp,
+ "Too many '!' in tag search expression",
+ NULL);
+ return TCL_ERROR;
+ }
+ looking_for_tag++;
+ negate_result = 1;
+ break;
+
+ case '(': /* scan (negated) subexpr recursively */
+ if (negate_result) {
+ expr->uids[expr->index++] = searchUids->negparenUid;
+ negate_result = 0;
+ } else {
+ expr->uids[expr->index++] = searchUids->parenUid;
+ }
+ if (TagSearchScanExpr(interp, searchPtr, expr) != TCL_OK) {
+ /*
+ * Result string should be already set by nested call to
+ * tag_expr_scan()
+ */
+
+ return TCL_ERROR;
+ }
+ looking_for_tag = 0;
+ found_tag = 1;
+ break;
+
+ case '"': /* quoted tag string */
+ if (negate_result) {
+ expr->uids[expr->index++] = searchUids->negtagvalUid;
+ negate_result = 0;
+ } else {
+ expr->uids[expr->index++] = searchUids->tagvalUid;
+ }
+ tag = searchPtr->rewritebuffer;
+ found_endquote = 0;
+ while (searchPtr->stringIndex < searchPtr->stringLength) {
+ c = searchPtr->string[searchPtr->stringIndex++];
+ if (c == '\\') {
+ c = searchPtr->string[searchPtr->stringIndex++];
}
- if (TagSearchScanExpr(interp, searchPtr, expr) != TCL_OK) {
- /* Result string should be already set
- * by nested call to tag_expr_scan() */
- return TCL_ERROR;
+ if (c == '"') {
+ found_endquote = 1;
+ break;
}
- looking_for_tag = 0;
- found_tag = 1;
- break;
-
- case '"' : /* quoted tag string */
- if (negate_result) {
- expr->uids[expr->index++] = searchUids->negtagvalUid;
- negate_result = 0;
- } else {
- expr->uids[expr->index++] = searchUids->tagvalUid;
+ *tag++ = c;
+ }
+ if (! found_endquote) {
+ Tcl_AppendResult(interp,
+ "Missing endquote in tag search expression",
+ NULL);
+ return TCL_ERROR;
+ }
+ if (! (tag - searchPtr->rewritebuffer)) {
+ Tcl_AppendResult(interp,
+ "Null quoted tag string in tag search expression",
+ NULL);
+ return TCL_ERROR;
+ }
+ *tag++ = '\0';
+ expr->uids[expr->index++] =
+ Tk_GetUid(searchPtr->rewritebuffer);
+ looking_for_tag = 0;
+ found_tag = 1;
+ break;
+
+ case '&': /* illegal chars when looking for tag */
+ case '|':
+ case '^':
+ case ')':
+ Tcl_AppendResult(interp,
+ "Unexpected operator in tag search expression",
+ NULL);
+ return TCL_ERROR;
+
+ default: /* unquoted tag string */
+ if (negate_result) {
+ expr->uids[expr->index++] = searchUids->negtagvalUid;
+ negate_result = 0;
+ } else {
+ expr->uids[expr->index++] = searchUids->tagvalUid;
+ }
+ tag = searchPtr->rewritebuffer;
+ *tag++ = c;
+
+ /*
+ * Copy rest of tag, including any embedded whitespace.
+ */
+
+ while (searchPtr->stringIndex < searchPtr->stringLength) {
+ c = searchPtr->string[searchPtr->stringIndex];
+ if (c == '!' || c == '&' || c == '|' || c == '^'
+ || c == '(' || c == ')' || c == '"') {
+ break;
}
- tag = searchPtr->rewritebuffer;
- found_endquote = 0;
- while (searchPtr->stringIndex < searchPtr->stringLength) {
- c = searchPtr->string[searchPtr->stringIndex++];
- if (c == '\\') {
- c = searchPtr->string[searchPtr->stringIndex++];
- }
- if (c == '"') {
- found_endquote = 1;
- break;
- }
- *tag++ = c;
- }
- if (! found_endquote) {
- Tcl_AppendResult(interp,
- "Missing endquote in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- if (! (tag - searchPtr->rewritebuffer)) {
- Tcl_AppendResult(interp,
- "Null quoted tag string in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- *tag++ = '\0';
- expr->uids[expr->index++] =
- Tk_GetUid(searchPtr->rewritebuffer);
- looking_for_tag = 0;
- found_tag = 1;
- break;
-
- case '&' : /* illegal chars when looking for tag */
- case '|' :
- case '^' :
- case ')' :
- Tcl_AppendResult(interp,
- "Unexpected operator in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
-
- default : /* unquoted tag string */
- if (negate_result) {
- expr->uids[expr->index++] = searchUids->negtagvalUid;
- negate_result = 0;
- } else {
- expr->uids[expr->index++] = searchUids->tagvalUid;
- }
- tag = searchPtr->rewritebuffer;
- *tag++ = c;
- /* copy rest of tag, including any embedded whitespace */
- while (searchPtr->stringIndex < searchPtr->stringLength) {
- c = searchPtr->string[searchPtr->stringIndex];
- if (c == '!' || c == '&' || c == '|' || c == '^'
- || c == '(' || c == ')' || c == '"') {
- break;
- }
- *tag++ = c;
- searchPtr->stringIndex++;
- }
- /* remove trailing whitespace */
- while (1) {
- c = *--tag;
- /* there must have been one non-whitespace char,
- * so this will terminate */
- if (c != ' ' && c != '\t' && c != '\n' && c != '\r') {
- break;
- }
- }
- *++tag = '\0';
- expr->uids[expr->index++] =
- Tk_GetUid(searchPtr->rewritebuffer);
- looking_for_tag = 0;
- found_tag = 1;
- }
-
- } else { /* ! looking_for_tag */
-
- switch (c) {
- case ' ' : /* ignore whitespace */
- case '\t' :
- case '\n' :
- case '\r' :
- break;
-
- case '&' : /* AND operator */
- c = searchPtr->string[searchPtr->stringIndex++];
- if (c != '&') {
- Tcl_AppendResult(interp,
- "Singleton '&' in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- expr->uids[expr->index++] = searchUids->andUid;
- looking_for_tag = 1;
- break;
-
- case '|' : /* OR operator */
- c = searchPtr->string[searchPtr->stringIndex++];
- if (c != '|') {
- Tcl_AppendResult(interp,
- "Singleton '|' in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- expr->uids[expr->index++] = searchUids->orUid;
- looking_for_tag = 1;
- break;
-
- case '^' : /* XOR operator */
- expr->uids[expr->index++] = searchUids->xorUid;
- looking_for_tag = 1;
- break;
-
- case ')' : /* end subexpression */
- expr->uids[expr->index++] = searchUids->endparenUid;
- goto breakwhile;
-
- default : /* syntax error */
- Tcl_AppendResult(interp,
- "Invalid boolean operator in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- }
- }
- breakwhile:
+ *tag++ = c;
+ searchPtr->stringIndex++;
+ }
+
+ /*
+ * Remove trailing whitespace.
+ */
+
+ while (1) {
+ c = *--tag;
+
+ /*
+ * There must have been one non-whitespace char, so this
+ * will terminate.
+ */
+
+ if (c != ' ' && c != '\t' && c != '\n' && c != '\r') {
+ break;
+ }
+ }
+ *++tag = '\0';
+ expr->uids[expr->index++] =
+ Tk_GetUid(searchPtr->rewritebuffer);
+ looking_for_tag = 0;
+ found_tag = 1;
+ }
+
+ } else { /* ! looking_for_tag */
+ switch (c) {
+ case ' ': /* ignore whitespace */
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+
+ case '&': /* AND operator */
+ c = searchPtr->string[searchPtr->stringIndex++];
+ if (c != '&') {
+ Tcl_AppendResult(interp,
+ "Singleton '&' in tag search expression",
+ NULL);
+ return TCL_ERROR;
+ }
+ expr->uids[expr->index++] = searchUids->andUid;
+ looking_for_tag = 1;
+ break;
+
+ case '|': /* OR operator */
+ c = searchPtr->string[searchPtr->stringIndex++];
+ if (c != '|') {
+ Tcl_AppendResult(interp,
+ "Singleton '|' in tag search expression",
+ NULL);
+ return TCL_ERROR;
+ }
+ expr->uids[expr->index++] = searchUids->orUid;
+ looking_for_tag = 1;
+ break;
+
+ case '^' : /* XOR operator */
+ expr->uids[expr->index++] = searchUids->xorUid;
+ looking_for_tag = 1;
+ break;
+
+ case ')' : /* end subexpression */
+ expr->uids[expr->index++] = searchUids->endparenUid;
+ goto breakwhile;
+
+ default: /* syntax error */
+ Tcl_AppendResult(interp,
+ "Invalid boolean operator in tag search expression",
+ NULL);
+ return TCL_ERROR;
+ }
+ }
+ }
+
+ breakwhile:
if (found_tag && ! looking_for_tag) {
- return TCL_OK;
+ return TCL_OK;
}
- Tcl_AppendResult(interp, "Missing tag in tag search expression",
- (char *) NULL);
+ Tcl_AppendResult(interp, "Missing tag in tag search expression", NULL);
return TCL_ERROR;
}
@@ -3547,11 +3445,11 @@ TagSearchScanExpr(interp, searchPtr, expr)
*
* TagSearchEvalExpr --
*
- * This recursive procedure is called to eval a tag expression.
+ * This recursive function is called to eval a tag expression.
*
* Results:
- * The return value indicates if the tagOrId expression
- * successfully matched the tags of the current item.
+ * The return value indicates if the tagOrId expression successfully
+ * matched the tags of the current item.
*
* Side effects:
*
@@ -3559,18 +3457,17 @@ TagSearchScanExpr(interp, searchPtr, expr)
*/
static int
-TagSearchEvalExpr(expr, itemPtr)
- TagSearchExpr *expr; /* Search expression */
- Tk_Item *itemPtr; /* Item being test for match */
+TagSearchEvalExpr(
+ TagSearchExpr *expr, /* Search expression */
+ Tk_Item *itemPtr) /* Item being test for match */
{
- int looking_for_tag; /* When true, scanner expects
- * next char(s) to be a tag,
- * else operand expected */
- int negate_result; /* Pending negation of next tag value */
+ int looking_for_tag; /* When true, scanner expects next char(s) to
+ * be a tag, else operand expected. */
+ int negate_result; /* Pending negation of next tag value */
Tk_Uid uid;
Tk_Uid *tagPtr;
int count;
- int result; /* Value of expr so far */
+ int result; /* Value of expr so far */
int parendepth;
SearchUids *searchUids; /* Collection of uids for basic search
* expression terms. */
@@ -3581,77 +3478,84 @@ TagSearchEvalExpr(expr, itemPtr)
negate_result = 0;
looking_for_tag = 1;
while (expr->index < expr->length) {
- uid = expr->uids[expr->index++];
- if (looking_for_tag) {
- if (uid == searchUids->tagvalUid) {
+ uid = expr->uids[expr->index++];
+ if (looking_for_tag) {
+ if (uid == searchUids->tagvalUid) {
/*
- * assert(expr->index < expr->length);
+ * assert(expr->index < expr->length);
*/
- uid = expr->uids[expr->index++];
- result = 0;
- /*
- * set result 1 if tag is found in item's tags
- */
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
- count > 0; tagPtr++, count--) {
- if (*tagPtr == uid) {
- result = 1;
- break;
- }
- }
-
- } else if (uid == searchUids->negtagvalUid) {
- negate_result = ! negate_result;
+ uid = expr->uids[expr->index++];
+ result = 0;
+
+ /*
+ * set result 1 if tag is found in item's tags
+ */
+
+ for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ count > 0; tagPtr++, count--) {
+ if (*tagPtr == uid) {
+ result = 1;
+ break;
+ }
+ }
+
+ } else if (uid == searchUids->negtagvalUid) {
+ negate_result = ! negate_result;
/*
- * assert(expr->index < expr->length);
+ * assert(expr->index < expr->length);
*/
- uid = expr->uids[expr->index++];
- result = 0;
- /*
- * set result 1 if tag is found in item's tags
- */
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
- count > 0; tagPtr++, count--) {
- if (*tagPtr == uid) {
- result = 1;
- break;
- }
- }
-
- } else if (uid == searchUids->parenUid) {
- /*
- * evaluate subexpressions with recursion
- */
- result = TagSearchEvalExpr(expr, itemPtr);
-
- } else if (uid == searchUids->negparenUid) {
- negate_result = ! negate_result;
- /*
- * evaluate subexpressions with recursion
- */
- result = TagSearchEvalExpr(expr, itemPtr);
+ uid = expr->uids[expr->index++];
+ result = 0;
+
+ /*
+ * set result 1 if tag is found in item's tags
+ */
+
+ for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ count > 0; tagPtr++, count--) {
+ if (*tagPtr == uid) {
+ result = 1;
+ break;
+ }
+ }
+
+ } else if (uid == searchUids->parenUid) {
+ /*
+ * Evaluate subexpressions with recursion
+ */
+
+ result = TagSearchEvalExpr(expr, itemPtr);
+
+ } else if (uid == searchUids->negparenUid) {
+ negate_result = ! negate_result;
+
+ /*
+ * Evaluate subexpressions with recursion
+ */
+
+ result = TagSearchEvalExpr(expr, itemPtr);
/*
- * } else {
- * assert(0);
+ * } else {
+ * assert(0);
*/
- }
- if (negate_result) {
- result = ! result;
- negate_result = 0;
- }
- looking_for_tag = 0;
- } else { /* ! looking_for_tag */
- if (((uid == searchUids->andUid) && (!result)) ||
+ }
+ if (negate_result) {
+ result = ! result;
+ negate_result = 0;
+ }
+ looking_for_tag = 0;
+ } else { /* ! looking_for_tag */
+ if (((uid == searchUids->andUid) && (!result)) ||
((uid == searchUids->orUid) && result)) {
- /*
- * short circuit expression evaluation
- *
- * if result before && is 0, or result before || is 1,
- * then the expression is decided and no further
- * evaluation is needed.
- */
-
- parendepth = 0;
+ /*
+ * Short circuit expression evaluation.
+ *
+ * if result before && is 0, or result before || is 1, then
+ * the expression is decided and no further evaluation is
+ * needed.
+ */
+
+ parendepth = 0;
while (expr->index < expr->length) {
uid = expr->uids[expr->index++];
if (uid == searchUids->tagvalUid ||
@@ -3663,7 +3567,7 @@ TagSearchEvalExpr(expr, itemPtr)
uid == searchUids->negparenUid) {
parendepth++;
continue;
- }
+ }
if (uid == searchUids->endparenUid) {
parendepth--;
if (parendepth < 0) {
@@ -3671,24 +3575,24 @@ TagSearchEvalExpr(expr, itemPtr)
}
}
}
- return result;
+ return result;
- } else if (uid == searchUids->xorUid) {
- /*
- * if the previous result was 1
- * then negate the next result
- */
- negate_result = result;
+ } else if (uid == searchUids->xorUid) {
+ /*
+ * If the previous result was 1 then negate the next result.
+ */
- } else if (uid == searchUids->endparenUid) {
- return result;
+ negate_result = result;
+
+ } else if (uid == searchUids->endparenUid) {
+ return result;
/*
- * } else {
- * assert(0);
+ * } else {
+ * assert(0);
*/
- }
- looking_for_tag = 1;
- }
+ }
+ looking_for_tag = 1;
+ }
}
/*
* assert(! looking_for_tag);
@@ -3701,104 +3605,103 @@ TagSearchEvalExpr(expr, itemPtr)
*
* TagSearchFirst --
*
- * This procedure is called to get the first item
- * item that matches a preestablished search predicate
- * that was set by TagSearchScan.
+ * This function is called to get the first item item that matches a
+ * preestablished search predicate that was set by TagSearchScan.
*
* Results:
- * The return value is a pointer to the first item, or NULL
- * if there is no such item. The information at *searchPtr
- * is updated such that successive calls to TagSearchNext
- * will return successive items.
+ * The return value is a pointer to the first item, or NULL if there is
+ * no such item. The information at *searchPtr is updated such that
+ * successive calls to TagSearchNext will return successive items.
*
* Side effects:
- * SearchPtr is linked into a list of searches in progress
- * on canvasPtr, so that elements can safely be deleted
- * while the search is in progress.
+ * SearchPtr is linked into a list of searches in progress on canvasPtr,
+ * so that elements can safely be deleted while the search is in
+ * progress.
*
*--------------------------------------------------------------
*/
static Tk_Item *
-TagSearchFirst(searchPtr)
- TagSearch *searchPtr; /* Record describing tag search */
+TagSearchFirst(
+ TagSearch *searchPtr) /* Record describing tag search */
{
Tk_Item *itemPtr, *lastPtr;
Tk_Uid uid, *tagPtr;
int count;
- /* short circuit impossible searches for null tags */
+ /*
+ * Short circuit impossible searches for null tags.
+ */
+
if (searchPtr->stringLength == 0) {
- return NULL;
+ return NULL;
}
/*
- * Find the first matching item in one of several ways. If the tag
- * is a number then it selects the single item with the matching
- * identifier. In this case see if the item being requested is the
- * hot item, in which case the search can be skipped.
+ * Find the first matching item in one of several ways. If the tag is a
+ * number then it selects the single item with the matching identifier.
+ * In this case see if the item being requested is the hot item, in which
+ * case the search can be skipped.
*/
- if (searchPtr->type == 1) {
- Tcl_HashEntry *entryPtr;
-
- itemPtr = searchPtr->canvasPtr->hotPtr;
- lastPtr = searchPtr->canvasPtr->hotPrevPtr;
- if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id) ||
- (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) {
- entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable,
- (char *) searchPtr->id);
- if (entryPtr != NULL) {
- itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr);
- lastPtr = itemPtr->prevPtr;
- } else {
- lastPtr = itemPtr = NULL;
- }
- }
- searchPtr->lastPtr = lastPtr;
- searchPtr->searchOver = 1;
- searchPtr->canvasPtr->hotPtr = itemPtr;
- searchPtr->canvasPtr->hotPrevPtr = lastPtr;
- return itemPtr;
- }
-
- if (searchPtr->type == 2) {
-
- /*
- * All items match.
- */
-
- searchPtr->lastPtr = NULL;
- searchPtr->currentPtr = searchPtr->canvasPtr->firstItemPtr;
- return searchPtr->canvasPtr->firstItemPtr;
- }
-
- if (searchPtr->type == 3) {
-
- /*
- * Optimized single-tag search
- */
-
- uid = searchPtr->expr->uid;
- for (lastPtr = NULL, itemPtr = searchPtr->canvasPtr->firstItemPtr;
- itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
- count > 0; tagPtr++, count--) {
- if (*tagPtr == uid) {
- searchPtr->lastPtr = lastPtr;
- searchPtr->currentPtr = itemPtr;
- return itemPtr;
- }
- }
- }
+ if (searchPtr->type == SEARCH_TYPE_ID) {
+ Tcl_HashEntry *entryPtr;
+
+ itemPtr = searchPtr->canvasPtr->hotPtr;
+ lastPtr = searchPtr->canvasPtr->hotPrevPtr;
+ if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id)
+ || (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) {
+ entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable,
+ (char *) INT2PTR(searchPtr->id));
+ if (entryPtr != NULL) {
+ itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr);
+ lastPtr = itemPtr->prevPtr;
+ } else {
+ lastPtr = itemPtr = NULL;
+ }
+ }
+ searchPtr->lastPtr = lastPtr;
+ searchPtr->searchOver = 1;
+ searchPtr->canvasPtr->hotPtr = itemPtr;
+ searchPtr->canvasPtr->hotPrevPtr = lastPtr;
+ return itemPtr;
+ }
+
+ if (searchPtr->type == SEARCH_TYPE_ALL) {
+ /*
+ * All items match.
+ */
+
+ searchPtr->lastPtr = NULL;
+ searchPtr->currentPtr = searchPtr->canvasPtr->firstItemPtr;
+ return searchPtr->canvasPtr->firstItemPtr;
+ }
+
+ if (searchPtr->type == SEARCH_TYPE_TAG) {
+ /*
+ * Optimized single-tag search
+ */
+
+ uid = searchPtr->expr->uid;
+ for (lastPtr = NULL, itemPtr = searchPtr->canvasPtr->firstItemPtr;
+ itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
+ for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ count > 0; tagPtr++, count--) {
+ if (*tagPtr == uid) {
+ searchPtr->lastPtr = lastPtr;
+ searchPtr->currentPtr = itemPtr;
+ return itemPtr;
+ }
+ }
+ }
} else {
/*
- * None of the above. Search for an item matching the tag expression.
+ * None of the above. Search for an item matching the tag expression.
*/
for (lastPtr = NULL, itemPtr = searchPtr->canvasPtr->firstItemPtr;
- itemPtr != NULL; lastPtr=itemPtr, itemPtr=itemPtr->nextPtr) {
+ itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
searchPtr->expr->index = 0;
if (TagSearchEvalExpr(searchPtr->expr, itemPtr)) {
searchPtr->lastPtr = lastPtr;
@@ -3817,89 +3720,86 @@ TagSearchFirst(searchPtr)
*
* TagSearchNext --
*
- * This procedure returns successive items that match a given
- * tag; it should be called only after TagSearchFirst has been
- * used to begin a search.
+ * This function returns successive items that match a given tag; it
+ * should be called only after TagSearchFirst has been used to begin a
+ * search.
*
* Results:
- * The return value is a pointer to the next item that matches
- * the tag expr specified to TagSearchScan, or NULL if no such
- * item exists. *SearchPtr is updated so that the next call
- * to this procedure will return the next item.
+ * The return value is a pointer to the next item that matches the tag
+ * expr specified to TagSearchScan, or NULL if no such item exists.
+ * *SearchPtr is updated so that the next call to this function will
+ * return the next item.
*
* Side effects:
- * None.
+ * None.
*
*--------------------------------------------------------------
*/
static Tk_Item *
-TagSearchNext(searchPtr)
- TagSearch *searchPtr; /* Record describing search in
- * progress. */
+TagSearchNext(
+ TagSearch *searchPtr) /* Record describing search in progress. */
{
Tk_Item *itemPtr, *lastPtr;
Tk_Uid uid, *tagPtr;
int count;
/*
- * Find next item in list (this may not actually be a suitable
- * one to return), and return if there are no items left.
+ * Find next item in list (this may not actually be a suitable one to
+ * return), and return if there are no items left.
*/
lastPtr = searchPtr->lastPtr;
if (lastPtr == NULL) {
- itemPtr = searchPtr->canvasPtr->firstItemPtr;
+ itemPtr = searchPtr->canvasPtr->firstItemPtr;
} else {
- itemPtr = lastPtr->nextPtr;
+ itemPtr = lastPtr->nextPtr;
}
if ((itemPtr == NULL) || (searchPtr->searchOver)) {
- searchPtr->searchOver = 1;
- return NULL;
+ searchPtr->searchOver = 1;
+ return NULL;
}
if (itemPtr != searchPtr->currentPtr) {
- /*
- * The structure of the list has changed. Probably the
- * previously-returned item was removed from the list.
- * In this case, don't advance lastPtr; just return
- * its new successor (i.e. do nothing here).
- */
+ /*
+ * The structure of the list has changed. Probably the previously-
+ * returned item was removed from the list. In this case, don't
+ * advance lastPtr; just return its new successor (i.e. do nothing
+ * here).
+ */
} else {
- lastPtr = itemPtr;
- itemPtr = lastPtr->nextPtr;
+ lastPtr = itemPtr;
+ itemPtr = lastPtr->nextPtr;
}
- if (searchPtr->type == 2) {
-
- /*
- * All items match.
- */
+ if (searchPtr->type == SEARCH_TYPE_ALL) {
+ /*
+ * All items match.
+ */
- searchPtr->lastPtr = lastPtr;
- searchPtr->currentPtr = itemPtr;
- return itemPtr;
+ searchPtr->lastPtr = lastPtr;
+ searchPtr->currentPtr = itemPtr;
+ return itemPtr;
}
- if (searchPtr->type == 3) {
-
- /*
- * Optimized single-tag search
- */
+ if (searchPtr->type == SEARCH_TYPE_TAG) {
+ /*
+ * Optimized single-tag search
+ */
- uid = searchPtr->expr->uid;
- for ( ; itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
- count > 0; tagPtr++, count--) {
- if (*tagPtr == uid) {
- searchPtr->lastPtr = lastPtr;
- searchPtr->currentPtr = itemPtr;
- return itemPtr;
- }
- }
- }
- searchPtr->lastPtr = lastPtr;
- searchPtr->searchOver = 1;
- return NULL;
+ uid = searchPtr->expr->uid;
+ for (; itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
+ for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ count > 0; tagPtr++, count--) {
+ if (*tagPtr == uid) {
+ searchPtr->lastPtr = lastPtr;
+ searchPtr->currentPtr = itemPtr;
+ return itemPtr;
+ }
+ }
+ }
+ searchPtr->lastPtr = lastPtr;
+ searchPtr->searchOver = 1;
+ return NULL;
}
/*
@@ -3907,12 +3807,12 @@ TagSearchNext(searchPtr)
*/
for ( ; itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
- searchPtr->expr->index = 0;
- if (TagSearchEvalExpr(searchPtr->expr, itemPtr)) {
- searchPtr->lastPtr = lastPtr;
- searchPtr->currentPtr = itemPtr;
- return itemPtr;
- }
+ searchPtr->expr->index = 0;
+ if (TagSearchEvalExpr(searchPtr->expr, itemPtr)) {
+ searchPtr->lastPtr = lastPtr;
+ searchPtr->currentPtr = itemPtr;
+ return itemPtr;
+ }
}
searchPtr->lastPtr = lastPtr;
searchPtr->searchOver = 1;
@@ -3925,29 +3825,27 @@ TagSearchNext(searchPtr)
*
* DoItem --
*
- * This is a utility procedure called by FindItems. It
- * either adds itemPtr's id to the result forming in interp,
- * or it adds a new tag to itemPtr, depending on the value
- * of tag.
+ * This is a utility function called by FindItems. It either adds
+ * itemPtr's id to the result forming in interp, or it adds a new tag to
+ * itemPtr, depending on the value of tag.
*
* Results:
* None.
*
* Side effects:
- * If tag is NULL then itemPtr's id is added as a list element
- * to the interp's result; otherwise tag is added to itemPtr's
- * list of tags.
+ * If tag is NULL then itemPtr's id is added as a list element to the
+ * interp's result; otherwise tag is added to itemPtr's list of tags.
*
*--------------------------------------------------------------
*/
static void
-DoItem(interp, itemPtr, tag)
- Tcl_Interp *interp; /* Interpreter in which to (possibly)
- * record item id. */
- Tk_Item *itemPtr; /* Item to (possibly) modify. */
- Tk_Uid tag; /* Tag to add to those already
- * present for item, or NULL. */
+DoItem(
+ Tcl_Interp *interp, /* Interpreter in which to (possibly) record
+ * item id. */
+ Tk_Item *itemPtr, /* Item to (possibly) modify. */
+ Tk_Uid tag) /* Tag to add to those already present for
+ * item, or NULL. */
{
Tk_Uid *tagPtr;
int count;
@@ -3972,18 +3870,17 @@ DoItem(interp, itemPtr, tag)
}
/*
- * Grow the tag space if there's no more room left in the current
- * block.
+ * Grow the tag space if there's no more room left in the current block.
*/
if (itemPtr->tagSpace == itemPtr->numTags) {
Tk_Uid *newTagPtr;
itemPtr->tagSpace += 5;
- newTagPtr = (Tk_Uid *) ckalloc((unsigned)
- (itemPtr->tagSpace * sizeof(Tk_Uid)));
- memcpy((VOID *) newTagPtr, (VOID *) itemPtr->tagPtr,
- (itemPtr->numTags * sizeof(Tk_Uid)));
+ newTagPtr = (Tk_Uid *)
+ ckalloc((unsigned) (itemPtr->tagSpace * sizeof(Tk_Uid)));
+ memcpy((void *) newTagPtr, itemPtr->tagPtr,
+ itemPtr->numTags * sizeof(Tk_Uid));
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
ckfree((char *) itemPtr->tagPtr);
}
@@ -4004,57 +3901,51 @@ DoItem(interp, itemPtr, tag)
*
* FindItems --
*
- * This procedure does all the work of implementing the
- * "find" and "addtag" options of the canvas widget command,
- * which locate items that have certain features (location,
- * tags, position in display list, etc.).
+ * This function does all the work of implementing the "find" and
+ * "addtag" options of the canvas widget command, which locate items that
+ * have certain features (location, tags, position in display list, etc.)
*
* Results:
- * A standard Tcl return value. If newTag is NULL, then a
- * list of ids from all the items that match argc/argv is
- * returned in the interp's result. If newTag is NULL, then
- * the normal the interp's result is an empty string. If an error
- * occurs, then the interp's result will hold an error message.
+ * A standard Tcl return value. If newTag is NULL, then a list of ids
+ * from all the items that match objc/objv is returned in the interp's
+ * result. If newTag is NULL, then the normal the interp's result is an
+ * empty string. If an error occurs, then the interp's result will hold
+ * an error message.
*
* Side effects:
- * If newTag is non-NULL, then all the items that match the
- * information in argc/argv have that tag added to their
- * lists of tags.
+ * If newTag is non-NULL, then all the items that match the information
+ * in objc/objv have that tag added to their lists of tags.
*
*--------------------------------------------------------------
*/
static int
-#ifdef USE_OLD_TAG_SEARCH
-FindItems(interp, canvasPtr, argc, argv, newTag, first)
-#else /* USE_OLD_TAG_SEARCH */
-FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
-#endif /* USE_OLD_TAG_SEARCH */
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- TkCanvas *canvasPtr; /* Canvas whose items are to be
- * searched. */
- int argc; /* Number of entries in argv. Must be
- * greater than zero. */
- Tcl_Obj *CONST *argv; /* Arguments that describe what items
- * to search for (see user doc on
- * "find" and "addtag" options). */
- Tcl_Obj *newTag; /* If non-NULL, gives new tag to set
- * on all found items; if NULL, then
- * ids of found items are returned
- * in the interp's result. */
- int first; /* For error messages: gives number
- * of elements of argv which are already
- * handled. */
+FindItems(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */
+ int objc, /* Number of entries in argv. Must be greater
+ * than zero. */
+ Tcl_Obj *CONST *objv, /* Arguments that describe what items to
+ * search for (see user doc on "find" and
+ * "addtag" options). */
+ Tcl_Obj *newTag, /* If non-NULL, gives new tag to set on all
+ * found items; if NULL, then ids of found
+ * items are returned in the interp's
+ * result. */
+ int first /* For error messages: gives number of
+ * elements of objv which are already
+ * handled. */
#ifndef USE_OLD_TAG_SEARCH
- TagSearch **searchPtrPtr; /* From CanvasWidgetCmd local vars*/
+ ,TagSearch **searchPtrPtr /* From CanvasWidgetCmd local vars*/
#endif /* not USE_OLD_TAG_SEARCH */
+ )
{
#ifdef USE_OLD_TAG_SEARCH
TagSearch search;
#endif /* USE_OLD_TAG_SEARCH */
Tk_Item *itemPtr;
Tk_Uid uid;
- int index;
+ int index, result;
static CONST char *optionStrings[] = {
"above", "all", "below", "closest",
"enclosed", "overlapping", "withtag", NULL
@@ -4065,41 +3956,34 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
};
if (newTag != NULL) {
- uid = Tk_GetUid(Tcl_GetStringFromObj(newTag, NULL));
+ uid = Tk_GetUid(Tcl_GetString(newTag));
} else {
uid = NULL;
}
- if (Tcl_GetIndexFromObj(interp, argv[first], optionStrings, "search command", 0,
- &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[first], optionStrings,
+ "search command", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum options) index) {
- case CANV_ABOVE: {
+ case CANV_ABOVE: {
Tk_Item *lastPtr = NULL;
- if (argc != first+2) {
- Tcl_WrongNumArgs(interp, first+1, argv, "tagOrId");
+
+ if (objc != first+2) {
+ Tcl_WrongNumArgs(interp, first+1, objv, "tagOrId");
return TCL_ERROR;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, argv[first+1], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if (TagSearchScan(canvasPtr, argv[first+1], searchPtrPtr) != TCL_OK) {
- return TCL_ERROR;
- }
- for (itemPtr = TagSearchFirst(*searchPtrPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(*searchPtrPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[first+1], searchPtrPtr,
+ return TCL_ERROR) {
lastPtr = itemPtr;
}
if ((lastPtr != NULL) && (lastPtr->nextPtr != NULL)) {
DoItem(interp, lastPtr->nextPtr, uid);
}
break;
- }
- case CANV_ALL: {
- if (argc != first+1) {
- Tcl_WrongNumArgs(interp, first+1, argv, (char *) NULL);
+ }
+ case CANV_ALL:
+ if (objc != first+1) {
+ Tcl_WrongNumArgs(interp, first+1, objv, NULL);
return TCL_ERROR;
}
@@ -4108,52 +3992,43 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
DoItem(interp, itemPtr, uid);
}
break;
- }
- case CANV_BELOW: {
- Tk_Item *itemPtr;
- if (argc != first+2) {
- Tcl_WrongNumArgs(interp, first+1, argv, "tagOrId");
+ case CANV_BELOW:
+ if (objc != first+2) {
+ Tcl_WrongNumArgs(interp, first+1, objv, "tagOrId");
return TCL_ERROR;
}
-#ifdef USE_OLD_TAG_SEARCH
- itemPtr = StartTagSearch(canvasPtr, argv[first+1], &search);
-#else /* USE_OLD_TAG_SEARCH */
- if (TagSearchScan(canvasPtr, argv[first+1], searchPtrPtr) != TCL_OK) {
- return TCL_ERROR;
- }
- itemPtr = TagSearchFirst(*searchPtrPtr);
-#endif /* USE_OLD_TAG_SEARCH */
+ FIRST_CANVAS_ITEM_MATCHING(objv[first+1], searchPtrPtr,
+ return TCL_ERROR);
if (itemPtr != NULL) {
if (itemPtr->prevPtr != NULL) {
DoItem(interp, itemPtr->prevPtr, uid);
}
}
break;
- }
- case CANV_CLOSEST: {
+ case CANV_CLOSEST: {
double closestDist;
Tk_Item *startPtr, *closestPtr;
double coords[2], halo;
int x1, y1, x2, y2;
- if ((argc < first+3) || (argc > first+5)) {
- Tcl_WrongNumArgs(interp, first+1, argv, "x y ?halo? ?start?");
+ if ((objc < first+3) || (objc > first+5)) {
+ Tcl_WrongNumArgs(interp, first+1, objv, "x y ?halo? ?start?");
return TCL_ERROR;
}
- if ((Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, argv[first+1],
+ if ((Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, objv[first+1],
&coords[0]) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp,
- (Tk_Canvas) canvasPtr, argv[first+2], &coords[1]) != TCL_OK)) {
+ (Tk_Canvas) canvasPtr, objv[first+2], &coords[1]) != TCL_OK)) {
return TCL_ERROR;
}
- if (argc > first+3) {
- if (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, argv[first+3],
+ if (objc > first+3) {
+ if (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, objv[first+3],
&halo) != TCL_OK) {
return TCL_ERROR;
}
if (halo < 0.0) {
Tcl_AppendResult(interp, "can't have negative halo value \"",
- Tcl_GetString(argv[3]), "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
return TCL_ERROR;
}
} else {
@@ -4165,31 +4040,26 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
*/
startPtr = canvasPtr->firstItemPtr;
- if (argc == first+5) {
-#ifdef USE_OLD_TAG_SEARCH
- itemPtr = StartTagSearch(canvasPtr, argv[first+4], &search);
-#else /* USE_OLD_TAG_SEARCH */
- if (TagSearchScan(canvasPtr, argv[first+4], searchPtrPtr) != TCL_OK) {
- return TCL_ERROR;
- }
- itemPtr = TagSearchFirst(*searchPtrPtr);
-#endif /* USE_OLD_TAG_SEARCH */
+ if (objc == first+5) {
+ FIRST_CANVAS_ITEM_MATCHING(objv[first+4], searchPtrPtr,
+ return TCL_ERROR);
if (itemPtr != NULL) {
startPtr = itemPtr;
}
}
/*
- * The code below is optimized so that it can eliminate most
- * items without having to call their item-specific procedures.
- * This is done by keeping a bounding box (x1, y1, x2, y2) that
- * an item's bbox must overlap if the item is to have any
- * chance of being closer than the closest so far.
+ * The code below is optimized so that it can eliminate most items
+ * without having to call their item-specific functions. This is done
+ * by keeping a bounding box (x1, y1, x2, y2) that an item's bbox must
+ * overlap if the item is to have any chance of being closer than the
+ * closest so far.
*/
itemPtr = startPtr;
while(itemPtr && (itemPtr->state == TK_STATE_HIDDEN ||
- (itemPtr->state == TK_STATE_NULL && canvasPtr->canvas_state == TK_STATE_HIDDEN))) {
+ (itemPtr->state == TK_STATE_NULL &&
+ canvasPtr->canvas_state == TK_STATE_HIDDEN))) {
itemPtr = itemPtr->nextPtr;
}
if (itemPtr == NULL) {
@@ -4204,8 +4074,8 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
double newDist;
/*
- * Update the bounding box using itemPtr, which is the
- * new closest item.
+ * Update the bounding box using itemPtr, which is the new closest
+ * item.
*/
x1 = (int) (coords[0] - closestDist - halo - 1);
@@ -4215,9 +4085,9 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
closestPtr = itemPtr;
/*
- * Search for an item that beats the current closest one.
- * Work circularly through the canvas's item list until
- * getting back to the starting item.
+ * Search for an item that beats the current closest one. Work
+ * circularly through the canvas's item list until getting back to
+ * the starting item.
*/
while (1) {
@@ -4229,7 +4099,8 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
DoItem(interp, closestPtr, uid);
return TCL_OK;
}
- if (itemPtr->state == TK_STATE_HIDDEN || (itemPtr->state == TK_STATE_NULL &&
+ if (itemPtr->state == TK_STATE_HIDDEN ||
+ (itemPtr->state == TK_STATE_NULL &&
canvasPtr->canvas_state == TK_STATE_HIDDEN)) {
continue;
}
@@ -4249,39 +4120,28 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
}
}
break;
- }
- case CANV_ENCLOSED: {
- if (argc != first+5) {
- Tcl_WrongNumArgs(interp, first+1, argv, "x1 y1 x2 y2");
+ }
+ case CANV_ENCLOSED:
+ if (objc != first+5) {
+ Tcl_WrongNumArgs(interp, first+1, objv, "x1 y1 x2 y2");
return TCL_ERROR;
}
- return FindArea(interp, canvasPtr, argv+first+1, uid, 1);
- }
- case CANV_OVERLAPPING: {
- if (argc != first+5) {
- Tcl_WrongNumArgs(interp, first+1, argv, "x1 y1 x2 y2");
+ return FindArea(interp, canvasPtr, objv+first+1, uid, 1);
+ case CANV_OVERLAPPING:
+ if (objc != first+5) {
+ Tcl_WrongNumArgs(interp, first+1, objv, "x1 y1 x2 y2");
return TCL_ERROR;
}
- return FindArea(interp, canvasPtr, argv+first+1, uid, 0);
- }
- case CANV_WITHTAG: {
- if (argc != first+2) {
- Tcl_WrongNumArgs(interp, first+1, argv, "tagOrId");
+ return FindArea(interp, canvasPtr, objv+first+1, uid, 0);
+ case CANV_WITHTAG:
+ if (objc != first+2) {
+ Tcl_WrongNumArgs(interp, first+1, objv, "tagOrId");
return TCL_ERROR;
}
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, argv[first+1], &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if (TagSearchScan(canvasPtr, argv[first+1], searchPtrPtr) != TCL_OK) {
- return TCL_ERROR;
- }
- for (itemPtr = TagSearchFirst(*searchPtrPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(*searchPtrPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(objv[first+1], searchPtrPtr,
+ return TCL_ERROR) {
DoItem(interp, itemPtr, uid);
}
- }
}
return TCL_OK;
}
@@ -4291,53 +4151,49 @@ FindItems(interp, canvasPtr, argc, argv, newTag, first, searchPtrPtr)
*
* FindArea --
*
- * This procedure implements area searches for the "find"
- * and "addtag" options.
+ * This function implements area searches for the "find" and "addtag"
+ * options.
*
* Results:
- * A standard Tcl return value. If newTag is NULL, then a
- * list of ids from all the items overlapping or enclosed
- * by the rectangle given by argc is returned in the interp's result.
- * If newTag is NULL, then the normal the interp's result is an
- * empty string. If an error occurs, then the interp's result will
- * hold an error message.
+ * A standard Tcl return value. If newTag is NULL, then a list of ids
+ * from all the items overlapping or enclosed by the rectangle given by
+ * objc is returned in the interp's result. If newTag is NULL, then the
+ * normal the interp's result is an empty string. If an error occurs,
+ * then the interp's result will hold an error message.
*
* Side effects:
- * If uid is non-NULL, then all the items overlapping
- * or enclosed by the area in argv have that tag added to
- * their lists of tags.
+ * If uid is non-NULL, then all the items overlapping or enclosed by the
+ * area in objv have that tag added to their lists of tags.
*
*--------------------------------------------------------------
*/
static int
-FindArea(interp, canvasPtr, argv, uid, enclosed)
- Tcl_Interp *interp; /* Interpreter for error reporting
- * and result storing. */
- TkCanvas *canvasPtr; /* Canvas whose items are to be
- * searched. */
- Tcl_Obj *CONST *argv; /* Array of four arguments that
- * give the coordinates of the
- * rectangular area to search. */
- Tk_Uid uid; /* If non-NULL, gives new tag to set
- * on all found items; if NULL, then
- * ids of found items are returned
- * in the interp's result. */
- int enclosed; /* 0 means overlapping or enclosed
- * items are OK, 1 means only enclosed
- * items are OK. */
+FindArea(
+ Tcl_Interp *interp, /* Interpreter for error reporting and result
+ * storing. */
+ TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */
+ Tcl_Obj *CONST *objv, /* Array of four arguments that give the
+ * coordinates of the rectangular area to
+ * search. */
+ Tk_Uid uid, /* If non-NULL, gives new tag to set on all
+ * found items; if NULL, then ids of found
+ * items are returned in the interp's
+ * result. */
+ int enclosed) /* 0 means overlapping or enclosed items are
+ * OK, 1 means only enclosed items are OK. */
{
double rect[4], tmp;
int x1, y1, x2, y2;
Tk_Item *itemPtr;
- if ((Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, argv[0],
+ if ((Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, objv[0],
&rect[0]) != TCL_OK)
- || (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, argv[1],
+ || (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, objv[1],
&rect[1]) != TCL_OK)
- || (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, argv[2],
+ || (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, objv[2],
&rect[2]) != TCL_OK)
- || (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, argv[3],
+ || (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr, objv[3],
&rect[3]) != TCL_OK)) {
return TCL_ERROR;
}
@@ -4349,8 +4205,8 @@ FindArea(interp, canvasPtr, argv, uid, enclosed)
}
/*
- * Use an integer bounding box for a quick test, to avoid
- * calling item-specific code except for items that are close.
+ * Use an integer bounding box for a quick test, to avoid calling
+ * item-specific code except for items that are close.
*/
x1 = (int) (rect[0]-1.0);
@@ -4380,65 +4236,60 @@ FindArea(interp, canvasPtr, argv, uid, enclosed)
*
* RelinkItems --
*
- * Move one or more items to a different place in the
- * display order for a canvas.
+ * Move one or more items to a different place in the display order for a
+ * canvas.
*
* Results:
* None.
*
* Side effects:
- * The items identified by "tag" are moved so that they
- * are all together in the display list and immediately
- * after prevPtr. The order of the moved items relative
- * to each other is not changed.
+ * The items identified by "tag" are moved so that they are all together
+ * in the display list and immediately after prevPtr. The order of the
+ * moved items relative to each other is not changed.
*
*--------------------------------------------------------------
*/
#ifdef USE_OLD_TAG_SEARCH
static void
-RelinkItems(canvasPtr, tag, prevPtr)
+RelinkItems(
+ TkCanvas *canvasPtr, /* Canvas to be modified. */
+ Tcl_Obj *tag, /* Tag identifying items to be moved in the
+ * redisplay list. */
+ Tk_Item *prevPtr) /* Reposition the items so that they go just
+ * after this item (NULL means put at
+ * beginning of list). */
#else /* USE_OLD_TAG_SEARCH */
static int
-RelinkItems(canvasPtr, tag, prevPtr, searchPtrPtr)
+RelinkItems(
+ TkCanvas *canvasPtr, /* Canvas to be modified. */
+ Tcl_Obj *tag, /* Tag identifying items to be moved in the
+ * redisplay list. */
+ Tk_Item *prevPtr, /* Reposition the items so that they go just
+ * after this item (NULL means put at
+ * beginning of list). */
+ TagSearch **searchPtrPtr) /* From CanvasWidgetCmd local vars */
#endif /* USE_OLD_TAG_SEARCH */
- TkCanvas *canvasPtr; /* Canvas to be modified. */
- Tcl_Obj *tag; /* Tag identifying items to be moved
- * in the redisplay list. */
- Tk_Item *prevPtr; /* Reposition the items so that they
- * go just after this item (NULL means
- * put at beginning of list). */
-#ifndef USE_OLD_TAG_SEARCH
- TagSearch **searchPtrPtr; /* From CanvasWidgetCmd local vars */
-#endif /* not USE_OLD_TAG_SEARCH */
{
Tk_Item *itemPtr;
#ifdef USE_OLD_TAG_SEARCH
TagSearch search;
#endif /* USE_OLD_TAG_SEARCH */
Tk_Item *firstMovePtr, *lastMovePtr;
+ int result;
/*
- * Find all of the items to be moved and remove them from
- * the list, making an auxiliary list running from firstMovePtr
- * to lastMovePtr. Record their areas for redisplay.
+ * Find all of the items to be moved and remove them from the list, making
+ * an auxiliary list running from firstMovePtr to lastMovePtr. Record
+ * their areas for redisplay.
*/
firstMovePtr = lastMovePtr = NULL;
-#ifdef USE_OLD_TAG_SEARCH
- for (itemPtr = StartTagSearch(canvasPtr, tag, &search);
- itemPtr != NULL; itemPtr = NextItem(&search)) {
-#else /* USE_OLD_TAG_SEARCH */
- if (TagSearchScan(canvasPtr, tag, searchPtrPtr) != TCL_OK) {
- return TCL_ERROR;
- }
- for (itemPtr = TagSearchFirst(*searchPtrPtr);
- itemPtr != NULL; itemPtr = TagSearchNext(*searchPtrPtr)) {
-#endif /* USE_OLD_TAG_SEARCH */
+ FOR_EVERY_CANVAS_ITEM_MATCHING(tag, searchPtrPtr, return TCL_ERROR) {
if (itemPtr == prevPtr) {
/*
- * Item after which insertion is to occur is being
- * moved! Switch to insert after its predecessor.
+ * Item after which insertion is to occur is being moved! Switch
+ * to insert after its predecessor.
*/
prevPtr = prevPtr->prevPtr;
@@ -4470,15 +4321,15 @@ RelinkItems(canvasPtr, tag, prevPtr, searchPtrPtr)
}
/*
- * Insert the list of to-be-moved items back into the canvas's
- * at the desired position.
+ * Insert the list of to-be-moved items back into the canvas's at the
+ * desired position.
*/
if (firstMovePtr == NULL) {
#ifdef USE_OLD_TAG_SEARCH
return;
#else /* USE_OLD_TAG_SEARCH */
- return TCL_OK;
+ return TCL_OK;
#endif /* USE_OLD_TAG_SEARCH */
}
if (prevPtr == NULL) {
@@ -4510,24 +4361,23 @@ RelinkItems(canvasPtr, tag, prevPtr, searchPtrPtr)
*
* CanvasBindProc --
*
- * This procedure is invoked by the Tk dispatcher to handle
- * events associated with bindings on items.
+ * This function is invoked by the Tk dispatcher to handle events
+ * associated with bindings on items.
*
* Results:
* None.
*
* Side effects:
- * Depends on the command invoked as part of the binding
- * (if there was any).
+ * Depends on the command invoked as part of the binding (if there was
+ * any).
*
*--------------------------------------------------------------
*/
static void
-CanvasBindProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to canvas structure. */
- XEvent *eventPtr; /* Pointer to X event that just
- * happened. */
+CanvasBindProc(
+ ClientData clientData, /* Pointer to canvas structure. */
+ XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
@@ -4535,47 +4385,46 @@ CanvasBindProc(clientData, eventPtr)
/*
* This code below keeps track of the current modifier state in
- * canvasPtr>state. This information is used to defer repicks of
- * the current item while buttons are down.
+ * canvasPtr>state. This information is used to defer repicks of the
+ * current item while buttons are down.
*/
if ((eventPtr->type == ButtonPress) || (eventPtr->type == ButtonRelease)) {
int mask;
switch (eventPtr->xbutton.button) {
- case Button1:
- mask = Button1Mask;
- break;
- case Button2:
- mask = Button2Mask;
- break;
- case Button3:
- mask = Button3Mask;
- break;
- case Button4:
- mask = Button4Mask;
- break;
- case Button5:
- mask = Button5Mask;
- break;
- default:
- mask = 0;
- break;
+ case Button1:
+ mask = Button1Mask;
+ break;
+ case Button2:
+ mask = Button2Mask;
+ break;
+ case Button3:
+ mask = Button3Mask;
+ break;
+ case Button4:
+ mask = Button4Mask;
+ break;
+ case Button5:
+ mask = Button5Mask;
+ break;
+ default:
+ mask = 0;
+ break;
}
/*
- * For button press events, repick the current item using the
- * button state before the event, then process the event. For
- * button release events, first process the event, then repick
- * the current item using the button state *after* the event
- * (the button has logically gone up before we change the
- * current item).
+ * For button press events, repick the current item using the button
+ * state before the event, then process the event. For button release
+ * events, first process the event, then repick the current item using
+ * the button state *after* the event (the button has logically gone
+ * up before we change the current item).
*/
if (eventPtr->type == ButtonPress) {
/*
- * On a button press, first repick the current item using
- * the button state before the event, the process the event.
+ * On a button press, first repick the current item using the
+ * button state before the event, the process the event.
*/
canvasPtr->state = eventPtr->xbutton.state;
@@ -4584,9 +4433,9 @@ CanvasBindProc(clientData, eventPtr)
CanvasDoEvent(canvasPtr, eventPtr);
} else {
/*
- * Button release: first process the event, with the button
- * still considered to be down. Then repick the current
- * item under the assumption that the button is no longer down.
+ * Button release: first process the event, with the button still
+ * considered to be down. Then repick the current item under the
+ * assumption that the button is no longer down.
*/
canvasPtr->state = eventPtr->xbutton.state;
@@ -4608,7 +4457,7 @@ CanvasBindProc(clientData, eventPtr)
}
CanvasDoEvent(canvasPtr, eventPtr);
- done:
+ done:
Tcl_Release((ClientData) canvasPtr);
}
@@ -4617,34 +4466,31 @@ CanvasBindProc(clientData, eventPtr)
*
* PickCurrentItem --
*
- * Find the topmost item in a canvas that contains a given
- * location and mark the the current item. If the current
- * item has changed, generate a fake exit event on the old
- * current item, a fake enter event on the new current item
- * item and force a redraw of the two items. Canvas items
- * that are hidden or disabled are ignored.
+ * Find the topmost item in a canvas that contains a given location and
+ * mark the the current item. If the current item has changed, generate a
+ * fake exit event on the old current item, a fake enter event on the new
+ * current item item and force a redraw of the two items. Canvas items
+ * that are hidden or disabled are ignored.
*
* Results:
* None.
*
* Side effects:
- * The current item for canvasPtr may change. If it does,
- * then the commands associated with item entry and exit
- * could do just about anything. A binding script could
- * delete the canvas, so callers should protect themselves
- * with Tcl_Preserve and Tcl_Release.
+ * The current item for canvasPtr may change. If it does, then the
+ * commands associated with item entry and exit could do just about
+ * anything. A binding script could delete the canvas, so callers should
+ * protect themselves with Tcl_Preserve and Tcl_Release.
*
*--------------------------------------------------------------
*/
static void
-PickCurrentItem(canvasPtr, eventPtr)
- TkCanvas *canvasPtr; /* Canvas widget in which to select
- * current item. */
- XEvent *eventPtr; /* Event describing location of
- * mouse cursor. Must be EnterWindow,
- * LeaveWindow, ButtonRelease, or
- * MotionNotify. */
+PickCurrentItem(
+ TkCanvas *canvasPtr, /* Canvas widget in which to select current
+ * item. */
+ XEvent *eventPtr) /* Event describing location of mouse cursor.
+ * Must be EnterWindow, LeaveWindow,
+ * ButtonRelease, or MotionNotify. */
{
double coords[2];
int buttonDown;
@@ -4654,23 +4500,24 @@ PickCurrentItem(canvasPtr, eventPtr)
#endif
/*
- * Check whether or not a button is down. If so, we'll log entry
- * and exit into and out of the current item, but not entry into
- * any other item. This implements a form of grabbing equivalent
- * to what the X server does for windows.
+ * Check whether or not a button is down. If so, we'll log entry and exit
+ * into and out of the current item, but not entry into any other item.
+ * This implements a form of grabbing equivalent to what the X server does
+ * for windows.
*/
buttonDown = canvasPtr->state
& (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask);
/*
- * Save information about this event in the canvas. The event in
- * the canvas is used for two purposes:
+ * Save information about this event in the canvas. The event in the
+ * canvas is used for two purposes:
*
* 1. Event bindings: if the current item changes, fake events are
* generated to allow item-enter and item-leave bindings to trigger.
- * 2. Reselection: if the current item gets deleted, can use the
- * saved event to find a new current item.
+ * 2. Reselection: if the current item gets deleted, can use the saved
+ * event to find a new current item.
+ *
* Translate MotionNotify events into EnterNotify events, since that's
* what gets reported to item handlers.
*/
@@ -4703,10 +4550,10 @@ PickCurrentItem(canvasPtr, eventPtr)
}
/*
- * If this is a recursive call (there's already a partially completed
- * call pending on the stack; it's in the middle of processing a
- * Leave event handler for the old current item) then just return;
- * the pending call will do everything that's needed.
+ * If this is a recursive call (there's already a partially completed call
+ * pending on the stack; it's in the middle of processing a Leave event
+ * handler for the old current item) then just return; the pending call
+ * will do everything that's needed.
*/
if (canvasPtr->flags & REPICK_IN_PROGRESS) {
@@ -4714,8 +4561,8 @@ PickCurrentItem(canvasPtr, eventPtr)
}
/*
- * A LeaveNotify event automatically means that there's no current
- * object, so the check for closest item can be skipped.
+ * A LeaveNotify event automatically means that there's no current object,
+ * so the check for closest item can be skipped.
*/
coords[0] = canvasPtr->pickEvent.xcrossing.x + canvasPtr->xOrigin;
@@ -4738,12 +4585,11 @@ PickCurrentItem(canvasPtr, eventPtr)
if (!buttonDown) {
canvasPtr->flags &= ~LEFT_GRABBED_ITEM;
}
-
+
/*
- * Simulate a LeaveNotify event on the previous current item and
- * an EnterNotify event on the new current item. Remove the "current"
- * tag from the previous current item and place it on the new current
- * item.
+ * Simulate a LeaveNotify event on the previous current item and an
+ * EnterNotify event on the new current item. Remove the "current" tag
+ * from the previous current item and place it on the new current item.
*/
if ((canvasPtr->newCurrentPtr != canvasPtr->currentItemPtr)
@@ -4757,9 +4603,9 @@ PickCurrentItem(canvasPtr, eventPtr)
event.type = LeaveNotify;
/*
- * If the event's detail happens to be NotifyInferior the
- * binding mechanism will discard the event. To be consistent,
- * always use NotifyAncestor.
+ * If the event's detail happens to be NotifyInferior the binding
+ * mechanism will discard the event. To be consistent, always use
+ * NotifyAncestor.
*/
event.xcrossing.detail = NotifyAncestor;
@@ -4768,28 +4614,29 @@ PickCurrentItem(canvasPtr, eventPtr)
canvasPtr->flags &= ~REPICK_IN_PROGRESS;
/*
- * The check below is needed because there could be an event
- * handler for <LeaveNotify> that deletes the current item.
+ * The check below is needed because there could be an event handler
+ * for <LeaveNotify> that deletes the current item.
*/
if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) {
for (i = itemPtr->numTags-1; i >= 0; i--) {
#ifdef USE_OLD_TAG_SEARCH
- if (itemPtr->tagPtr[i] == Tk_GetUid("current")) {
+ if (itemPtr->tagPtr[i] == Tk_GetUid("current"))
#else /* USE_OLD_TAG_SEARCH */
- if (itemPtr->tagPtr[i] == searchUids->currentUid) {
+ if (itemPtr->tagPtr[i] == searchUids->currentUid)
#endif /* USE_OLD_TAG_SEARCH */
+ /* then */ {
itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1];
itemPtr->numTags--;
break;
}
}
}
-
+
/*
- * Note: during CanvasDoEvent above, it's possible that
- * canvasPtr->newCurrentPtr got reset to NULL because the
- * item was deleted.
+ * Note: during CanvasDoEvent above, it's possible that
+ * canvasPtr->newCurrentPtr got reset to NULL because the item was
+ * deleted.
*/
}
if ((canvasPtr->newCurrentPtr != canvasPtr->currentItemPtr) && buttonDown) {
@@ -4798,9 +4645,9 @@ PickCurrentItem(canvasPtr, eventPtr)
}
/*
- * Special note: it's possible that canvasPtr->newCurrentPtr ==
- * canvasPtr->currentItemPtr here. This can happen, for example,
- * if LEFT_GRABBED_ITEM was set.
+ * Special note: it's possible that canvasPtr->newCurrentPtr ==
+ * canvasPtr->currentItemPtr here. This can happen, for example, if
+ * LEFT_GRABBED_ITEM was set.
*/
prevItemPtr = canvasPtr->currentItemPtr;
@@ -4810,23 +4657,21 @@ PickCurrentItem(canvasPtr, eventPtr)
(prevItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT)) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr, prevItemPtr);
(*prevItemPtr->typePtr->configProc)(canvasPtr->interp,
- (Tk_Canvas) canvasPtr, prevItemPtr, 0, (Tcl_Obj **) NULL,
+ (Tk_Canvas) canvasPtr, prevItemPtr, 0, NULL,
TK_CONFIG_ARGV_ONLY);
}
if (canvasPtr->currentItemPtr != NULL) {
XEvent event;
#ifdef USE_OLD_TAG_SEARCH
- DoItem((Tcl_Interp *) NULL, canvasPtr->currentItemPtr,
- Tk_GetUid("current"));
+ DoItem(NULL, canvasPtr->currentItemPtr, Tk_GetUid("current"));
#else /* USE_OLD_TAG_SEARCH */
- DoItem((Tcl_Interp *) NULL, canvasPtr->currentItemPtr,
- searchUids->currentUid);
+ DoItem(NULL, canvasPtr->currentItemPtr, searchUids->currentUid);
#endif /* USE_OLD_TAG_SEA */
if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT &&
prevItemPtr != canvasPtr->currentItemPtr)) {
(*canvasPtr->currentItemPtr->typePtr->configProc)(canvasPtr->interp,
- (Tk_Canvas) canvasPtr, canvasPtr->currentItemPtr, 0, (Tcl_Obj **) NULL,
+ (Tk_Canvas) canvasPtr, canvasPtr->currentItemPtr, 0, NULL,
TK_CONFIG_ARGV_ONLY);
EventuallyRedrawItem((Tk_Canvas) canvasPtr,
canvasPtr->currentItemPtr);
@@ -4843,13 +4688,13 @@ PickCurrentItem(canvasPtr, eventPtr)
*
* CanvasFindClosest --
*
- * Given x and y coordinates, find the topmost canvas item that
- * is "close" to the coordinates. Canvas items that are hidden
- * or disabled are ignored.
+ * Given x and y coordinates, find the topmost canvas item that is
+ * "close" to the coordinates. Canvas items that are hidden or disabled
+ * are ignored.
*
* Results:
- * The return value is a pointer to the topmost item that is
- * close to (x,y), or NULL if no item is close.
+ * The return value is a pointer to the topmost item that is close to
+ * (x,y), or NULL if no item is close.
*
* Side effects:
* None.
@@ -4858,10 +4703,10 @@ PickCurrentItem(canvasPtr, eventPtr)
*/
static Tk_Item *
-CanvasFindClosest(canvasPtr, coords)
- TkCanvas *canvasPtr; /* Canvas widget to search. */
- double coords[2]; /* Desired x,y position in canvas,
- * not screen, coordinates.) */
+CanvasFindClosest(
+ TkCanvas *canvasPtr, /* Canvas widget to search. */
+ double coords[2]) /* Desired x,y position in canvas, not screen,
+ * coordinates.) */
{
Tk_Item *itemPtr;
Tk_Item *bestPtr;
@@ -4897,27 +4742,25 @@ CanvasFindClosest(canvasPtr, coords)
*
* CanvasDoEvent --
*
- * This procedure is called to invoke binding processing
- * for a new event that is associated with the current item
- * for a canvas.
+ * This function is called to invoke binding processing for a new event
+ * that is associated with the current item for a canvas.
*
* Results:
* None.
*
* Side effects:
- * Depends on the bindings for the canvas. A binding script
- * could delete the canvas, so callers should protect themselves
- * with Tcl_Preserve and Tcl_Release.
+ * Depends on the bindings for the canvas. A binding script could delete
+ * the canvas, so callers should protect themselves with Tcl_Preserve and
+ * Tcl_Release.
*
*--------------------------------------------------------------
*/
static void
-CanvasDoEvent(canvasPtr, eventPtr)
- TkCanvas *canvasPtr; /* Canvas widget in which event
- * occurred. */
- XEvent *eventPtr; /* Real or simulated X event that
- * is to be processed. */
+CanvasDoEvent(
+ TkCanvas *canvasPtr, /* Canvas widget in which event occurred. */
+ XEvent *eventPtr) /* Real or simulated X event that is to be
+ * processed. */
{
#define NUM_STATIC 3
ClientData staticObjects[NUM_STATIC];
@@ -4944,30 +4787,30 @@ CanvasDoEvent(canvasPtr, eventPtr)
#ifdef USE_OLD_TAG_SEARCH
/*
- * Set up an array with all the relevant objects for processing
- * this event. The relevant objects are (a) the event's item,
- * (b) the tags associated with the event's item, and (c) the
- * tag "all". If there are a lot of tags then malloc an array
- * to hold all of the objects.
+ * Set up an array with all the relevant objects for processing this
+ * event. The relevant objects are (a) the event's item, (b) the tags
+ * associated with the event's item, and (c) the tag "all". If there are a
+ * lot of tags then malloc an array to hold all of the objects.
*/
numObjects = itemPtr->numTags + 2;
#else /* USE_OLD_TAG_SEARCH */
/*
- * Set up an array with all the relevant objects for processing
- * this event. The relevant objects are:
+ * Set up an array with all the relevant objects for processing this
+ * event. The relevant objects are:
* (a) the event's item,
- * (b) the tags associated with the event's item,
+ * (b) the tags associated with the event's item,
* (c) the expressions that are true for the event's item's tags, and
- * (d) the tag "all".
+ * (d) the tag "all".
*
- * If there are a lot of tags then malloc an array to hold all of
- * the objects.
+ * If there are a lot of tags then malloc an array to hold all of the
+ * objects.
*/
/*
- * flag and count all expressions that match item's tags
+ * Flag and count all expressions that match item's tags.
*/
+
numExprs = 0;
expr = canvasPtr->bindTagExprs;
while (expr) {
@@ -4984,8 +4827,8 @@ CanvasDoEvent(canvasPtr, eventPtr)
if (numObjects <= NUM_STATIC) {
objectPtr = staticObjects;
} else {
- objectPtr = (ClientData *)
- ckalloc((unsigned) (numObjects * sizeof(ClientData)));
+ objectPtr = (ClientData *) ckalloc((unsigned)
+ (numObjects * sizeof(ClientData)));
}
#ifdef USE_OLD_TAG_SEARCH
objectPtr[0] = (ClientData) Tk_GetUid("all");
@@ -4996,10 +4839,12 @@ CanvasDoEvent(canvasPtr, eventPtr)
objectPtr[i+1] = (ClientData) itemPtr->tagPtr[i];
}
objectPtr[itemPtr->numTags+1] = (ClientData) itemPtr;
+
#ifndef USE_OLD_TAG_SEARCH
/*
- * copy uids of matching expressions into object array
+ * Copy uids of matching expressions into object array
*/
+
i = itemPtr->numTags+2;
expr = canvasPtr->bindTagExprs;
while (expr) {
@@ -5011,8 +4856,8 @@ CanvasDoEvent(canvasPtr, eventPtr)
#endif /* not USE_OLD_TAG_SEARCH */
/*
- * Invoke the binding system, then free up the object array if
- * it was malloc-ed.
+ * Invoke the binding system, then free up the object array if it was
+ * malloc-ed.
*/
if (canvasPtr->tkwin != NULL) {
@@ -5029,22 +4874,22 @@ CanvasDoEvent(canvasPtr, eventPtr)
*
* CanvasBlinkProc --
*
- * This procedure is called as a timer handler to blink the
- * insertion cursor off and on.
+ * This function is called as a timer handler to blink the insertion
+ * cursor off and on.
*
* Results:
* None.
*
* Side effects:
- * The cursor gets turned on or off, redisplay gets invoked,
- * and this procedure reschedules itself.
+ * The cursor gets turned on or off, redisplay gets invoked, and this
+ * function reschedules itself.
*
*----------------------------------------------------------------------
*/
static void
-CanvasBlinkProc(clientData)
- ClientData clientData; /* Pointer to record describing entry. */
+CanvasBlinkProc(
+ ClientData clientData) /* Pointer to record describing entry. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
@@ -5073,9 +4918,9 @@ CanvasBlinkProc(clientData)
*
* CanvasFocusProc --
*
- * This procedure is called whenever a canvas gets or loses the
- * input focus. It's also called whenever the window is
- * reconfigured while it has the focus.
+ * This function is called whenever a canvas gets or loses the input
+ * focus. It's also called whenever the window is reconfigured while it
+ * has the focus.
*
* Results:
* None.
@@ -5087,9 +4932,9 @@ CanvasBlinkProc(clientData)
*/
static void
-CanvasFocusProc(canvasPtr, gotFocus)
- TkCanvas *canvasPtr; /* Canvas that just got or lost focus. */
- int gotFocus; /* 1 means window is getting focus, 0 means
+CanvasFocusProc(
+ TkCanvas *canvasPtr, /* Canvas that just got or lost focus. */
+ int gotFocus) /* 1 means window is getting focus, 0 means
* it's losing it. */
{
Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler);
@@ -5124,8 +4969,8 @@ CanvasFocusProc(canvasPtr, gotFocus)
*
* CanvasSelectTo --
*
- * Modify the selection by moving its un-anchored end. This could
- * make the selection either larger or smaller.
+ * Modify the selection by moving its un-anchored end. This could make
+ * the selection either larger or smaller.
*
* Results:
* None.
@@ -5137,10 +4982,10 @@ CanvasFocusProc(canvasPtr, gotFocus)
*/
static void
-CanvasSelectTo(canvasPtr, itemPtr, index)
- TkCanvas *canvasPtr; /* Information about widget. */
- Tk_Item *itemPtr; /* Item that is to hold selection. */
- int index; /* Index of element that is to become the
+CanvasSelectTo(
+ TkCanvas *canvasPtr, /* Information about widget. */
+ Tk_Item *itemPtr, /* Item that is to hold selection. */
+ int index) /* Index of element that is to become the
* "other" end of the selection. */
{
int oldFirst, oldLast;
@@ -5186,15 +5031,15 @@ CanvasSelectTo(canvasPtr, itemPtr, index)
*
* CanvasFetchSelection --
*
- * This procedure is invoked by Tk to return part or all of
- * the selection, when the selection is in a canvas widget.
- * This procedure always returns the selection as a STRING.
+ * This function is invoked by Tk to return part or all of the selection,
+ * when the selection is in a canvas widget. This function always returns
+ * the selection as a STRING.
*
* Results:
- * The return value is the number of non-NULL bytes stored
- * at buffer. Buffer is filled (or partially filled) with a
- * NULL-terminated string containing part or all of the selection,
- * as given by offset and maxBytes.
+ * The return value is the number of non-NULL bytes stored at buffer.
+ * Buffer is filled (or partially filled) with a NULL-terminated string
+ * containing part or all of the selection, as given by offset and
+ * maxBytes.
*
* Side effects:
* None.
@@ -5203,15 +5048,14 @@ CanvasSelectTo(canvasPtr, itemPtr, index)
*/
static int
-CanvasFetchSelection(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Information about canvas widget. */
- int offset; /* Offset within selection of first
- * character to be returned. */
- char *buffer; /* Location in which to place
- * selection. */
- int maxBytes; /* Maximum number of bytes to place
- * at buffer, not including terminating
- * NULL character. */
+CanvasFetchSelection(
+ ClientData clientData, /* Information about canvas widget. */
+ int offset, /* Offset within selection of first character
+ * to be returned. */
+ char *buffer, /* Location in which to place selection. */
+ int maxBytes) /* Maximum number of bytes to place at buffer,
+ * not including terminating NULL
+ * character. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
@@ -5231,22 +5075,22 @@ CanvasFetchSelection(clientData, offset, buffer, maxBytes)
*
* CanvasLostSelection --
*
- * This procedure is called back by Tk when the selection is
- * grabbed away from a canvas widget.
+ * This function is called back by Tk when the selection is grabbed away
+ * from a canvas widget.
*
* Results:
* None.
*
* Side effects:
- * The existing selection is unhighlighted, and the window is
- * marked as not containing a selection.
+ * The existing selection is unhighlighted, and the window is marked as
+ * not containing a selection.
*
*----------------------------------------------------------------------
*/
static void
-CanvasLostSelection(clientData)
- ClientData clientData; /* Information about entry widget. */
+CanvasLostSelection(
+ ClientData clientData) /* Information about entry widget. */
{
TkCanvas *canvasPtr = (TkCanvas *) clientData;
@@ -5262,13 +5106,11 @@ CanvasLostSelection(clientData)
*
* GridAlign --
*
- * Given a coordinate and a grid spacing, this procedure
- * computes the location of the nearest grid line to the
- * coordinate.
+ * Given a coordinate and a grid spacing, this function computes the
+ * location of the nearest grid line to the coordinate.
*
* Results:
- * The return value is the location of the grid line nearest
- * to coord.
+ * The return value is the location of the grid line nearest to coord.
*
* Side effects:
* None.
@@ -5277,10 +5119,10 @@ CanvasLostSelection(clientData)
*/
static double
-GridAlign(coord, spacing)
- double coord; /* Coordinate to grid-align. */
- double spacing; /* Spacing between grid lines. If <= 0
- * then no alignment is done. */
+GridAlign(
+ double coord, /* Coordinate to grid-align. */
+ double spacing) /* Spacing between grid lines. If <= 0 then no
+ * alignment is done. */
{
if (spacing <= 0.0) {
return coord;
@@ -5296,15 +5138,14 @@ GridAlign(coord, spacing)
*
* ScrollFractions --
*
- * Given the range that's visible in the window and the "100%
- * range" for what's in the canvas, return a list of two
- * doubles representing the scroll fractions. This procedure
- * is used for both x and y scrolling.
+ * Given the range that's visible in the window and the "100% range" for
+ * what's in the canvas, return a list of two doubles representing the
+ * scroll fractions. This function is used for both x and y scrolling.
*
* Results:
- * The memory pointed to by string is modified to hold
- * two real numbers containing the scroll fractions (between
- * 0 and 1) corresponding to the other arguments.
+ * A List Tcl_Obj with two real numbers (Double Tcl_Objs) containing the
+ * scroll fractions (between 0 and 1) corresponding to the other
+ * arguments.
*
* Side effects:
* None.
@@ -5313,14 +5154,14 @@ GridAlign(coord, spacing)
*/
static Tcl_Obj *
-ScrollFractions(screen1, screen2, object1, object2)
- int screen1; /* Lowest coordinate visible in the window. */
- int screen2; /* Highest coordinate visible in the window. */
- int object1; /* Lowest coordinate in the object. */
- int object2; /* Highest coordinate in the object. */
+ScrollFractions(
+ int screen1, /* Lowest coordinate visible in the window. */
+ int screen2, /* Highest coordinate visible in the window. */
+ int object1, /* Lowest coordinate in the object. */
+ int object2) /* Highest coordinate in the object. */
{
+ Tcl_Obj *buffer[2];
double range, f1, f2;
- char buffer[2*TCL_DOUBLE_SPACE+2];
range = object2 - object1;
if (range <= 0) {
@@ -5339,8 +5180,9 @@ ScrollFractions(screen1, screen2, object1, object2)
f2 = f1;
}
}
- sprintf(buffer, "%g %g", f1, f2);
- return Tcl_NewStringObj(buffer, -1);
+ buffer[0] = Tcl_NewDoubleObj(f1);
+ buffer[1] = Tcl_NewDoubleObj(f2);
+ return Tcl_NewListObj(2, buffer);
}
/*
@@ -5348,46 +5190,45 @@ ScrollFractions(screen1, screen2, object1, object2)
*
* CanvasUpdateScrollbars --
*
- * This procedure is invoked whenever a canvas has changed in
- * a way that requires scrollbars to be redisplayed (e.g. the
- * view in the canvas has changed).
+ * This function is invoked whenever a canvas has changed in a way that
+ * requires scrollbars to be redisplayed (e.g. the view in the canvas has
+ * changed).
*
* Results:
* None.
*
* Side effects:
- * If there are scrollbars associated with the canvas, then
- * their scrolling commands are invoked to cause them to
- * redisplay. If errors occur, additional Tcl commands may
- * be invoked to process the errors.
+ * If there are scrollbars associated with the canvas, then their
+ * scrolling commands are invoked to cause them to redisplay. If errors
+ * occur, additional Tcl commands may be invoked to process the errors.
*
*--------------------------------------------------------------
*/
static void
-CanvasUpdateScrollbars(canvasPtr)
- TkCanvas *canvasPtr; /* Information about canvas. */
+CanvasUpdateScrollbars(
+ TkCanvas *canvasPtr) /* Information about canvas. */
{
int result;
Tcl_Interp *interp;
- int xOrigin, yOrigin, inset, width, height, scrollX1, scrollX2,
- scrollY1, scrollY2;
+ int xOrigin, yOrigin, inset, width, height;
+ int scrollX1, scrollX2, scrollY1, scrollY2;
char *xScrollCmd, *yScrollCmd;
/*
* Save all the relevant values from the canvasPtr, because it might be
* deleted as part of either of the two calls to Tcl_VarEval below.
*/
-
+
interp = canvasPtr->interp;
Tcl_Preserve((ClientData) interp);
xScrollCmd = canvasPtr->xScrollCmd;
- if (xScrollCmd != (char *) NULL) {
- Tcl_Preserve((ClientData) xScrollCmd);
+ if (xScrollCmd != NULL) {
+ Tcl_Preserve((ClientData) xScrollCmd);
}
yScrollCmd = canvasPtr->yScrollCmd;
- if (yScrollCmd != (char *) NULL) {
- Tcl_Preserve((ClientData) yScrollCmd);
+ if (yScrollCmd != NULL) {
+ Tcl_Preserve((ClientData) yScrollCmd);
}
xOrigin = canvasPtr->xOrigin;
yOrigin = canvasPtr->yOrigin;
@@ -5402,27 +5243,27 @@ CanvasUpdateScrollbars(canvasPtr)
if (canvasPtr->xScrollCmd != NULL) {
Tcl_Obj *fractions = ScrollFractions(xOrigin + inset,
xOrigin + width - inset, scrollX1, scrollX2);
- result = Tcl_VarEval(interp, xScrollCmd, " ",
- Tcl_GetString(fractions), (char *) NULL);
+ result = Tcl_VarEval(interp, xScrollCmd, " ", Tcl_GetString(fractions),
+ NULL);
Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
Tcl_BackgroundError(interp);
}
Tcl_ResetResult(interp);
- Tcl_Release((ClientData) xScrollCmd);
+ Tcl_Release((ClientData) xScrollCmd);
}
if (yScrollCmd != NULL) {
Tcl_Obj *fractions = ScrollFractions(yOrigin + inset,
yOrigin + height - inset, scrollY1, scrollY2);
- result = Tcl_VarEval(interp, yScrollCmd, " ",
- Tcl_GetString(fractions), (char *) NULL);
+ result = Tcl_VarEval(interp, yScrollCmd, " ", Tcl_GetString(fractions),
+ NULL);
Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
Tcl_BackgroundError(interp);
}
Tcl_ResetResult(interp);
- Tcl_Release((ClientData) yScrollCmd);
+ Tcl_Release((ClientData) yScrollCmd);
}
Tcl_Release((ClientData) interp);
}
@@ -5432,38 +5273,35 @@ CanvasUpdateScrollbars(canvasPtr)
*
* CanvasSetOrigin --
*
- * This procedure is invoked to change the mapping between
- * canvas coordinates and screen coordinates in the canvas
- * window.
+ * This function is invoked to change the mapping between canvas
+ * coordinates and screen coordinates in the canvas window.
*
* Results:
* None.
*
* Side effects:
- * The canvas will be redisplayed to reflect the change in
- * view. In addition, scrollbars will be updated if there
- * are any.
+ * The canvas will be redisplayed to reflect the change in view. In
+ * addition, scrollbars will be updated if there are any.
*
*--------------------------------------------------------------
*/
static void
-CanvasSetOrigin(canvasPtr, xOrigin, yOrigin)
- TkCanvas *canvasPtr; /* Information about canvas. */
- int xOrigin; /* New X origin for canvas (canvas x-coord
+CanvasSetOrigin(
+ TkCanvas *canvasPtr, /* Information about canvas. */
+ int xOrigin, /* New X origin for canvas (canvas x-coord
* corresponding to left edge of canvas
* window). */
- int yOrigin; /* New Y origin for canvas (canvas y-coord
+ int yOrigin) /* New Y origin for canvas (canvas y-coord
* corresponding to top edge of canvas
* window). */
{
int left, right, top, bottom, delta;
/*
- * If scroll increments have been set, round the window origin
- * to the nearest multiple of the increments. Remember, the
- * origin is the place just inside the borders, not the upper
- * left corner.
+ * If scroll increments have been set, round the window origin to the
+ * nearest multiple of the increments. Remember, the origin is the place
+ * just inside the borders, not the upper left corner.
*/
if (canvasPtr->xScrollIncrement > 0) {
@@ -5491,13 +5329,13 @@ CanvasSetOrigin(canvasPtr, xOrigin, yOrigin)
/*
* Adjust the origin if necessary to keep as much as possible of the
- * canvas in the view. The variables left, right, etc. keep track of
- * how much extra space there is on each side of the view before it
- * will stick out past the scroll region. If one side sticks out past
- * the edge of the scroll region, adjust the view to bring that side
- * back to the edge of the scrollregion (but don't move it so much that
- * the other side sticks out now). If scroll increments are in effect,
- * be sure to adjust only by full increments.
+ * canvas in the view. The variables left, right, etc. keep track of how
+ * much extra space there is on each side of the view before it will stick
+ * out past the scroll region. If one side sticks out past the edge of
+ * the scroll region, adjust the view to bring that side back to the edge
+ * of the scrollregion (but don't move it so much that the other side
+ * sticks out now). If scroll increments are in effect, be sure to adjust
+ * only by full increments.
*/
if ((canvasPtr->confine) && (canvasPtr->regionString != NULL)) {
@@ -5540,11 +5378,11 @@ CanvasSetOrigin(canvasPtr, xOrigin, yOrigin)
}
/*
- * Tricky point: must redisplay not only everything that's visible
- * in the window's final configuration, but also everything that was
- * visible in the initial configuration. This is needed because some
- * item types, like windows, need to know when they move off-screen
- * so they can explicitly undisplay themselves.
+ * Tricky point: must redisplay not only everything that's visible in the
+ * window's final configuration, but also everything that was visible in
+ * the initial configuration. This is needed because some item types, like
+ * windows, need to know when they move off-screen so they can explicitly
+ * undisplay themselves.
*/
Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
@@ -5559,37 +5397,38 @@ CanvasSetOrigin(canvasPtr, xOrigin, yOrigin)
canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin),
canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin));
}
-
+
/*
*----------------------------------------------------------------------
*
- * GetStringsFromObjs
+ * TkGetStringsFromObjs --
*
* Results:
* Converts object list into string list.
*
* Side effects:
- * Memory is allocated for the argv array, which must
- * be freed using ckfree() when no longer needed.
+ * Memory is allocated for the objv array, which must be freed using
+ * ckfree() when no longer needed.
*
*----------------------------------------------------------------------
*/
+
/* ARGSUSED */
static CONST char **
-GetStringsFromObjs(argc, objv)
- int argc;
- Tcl_Obj *CONST objv[];
+TkGetStringsFromObjs(
+ int objc,
+ Tcl_Obj *CONST objv[])
{
register int i;
CONST char **argv;
- if (argc <= 0) {
+ if (objc <= 0) {
return NULL;
}
- argv = (CONST char **) ckalloc((argc+1) * sizeof(char *));
- for (i = 0; i < argc; i++) {
- argv[i] = Tcl_GetStringFromObj(objv[i], NULL);
+ argv = (CONST char **) ckalloc((objc+1) * sizeof(char *));
+ for (i = 0; i < objc; i++) {
+ argv[i] = Tcl_GetString(objv[i]);
}
- argv[argc] = 0;
+ argv[objc] = 0;
return argv;
}
@@ -5598,16 +5437,15 @@ GetStringsFromObjs(argc, objv)
*
* Tk_CanvasPsColor --
*
- * This procedure is called by individual canvas items when
- * they want to set a color value for output. Given information
- * about an X color, this procedure will generate Postscript
- * commands to set up an appropriate color in Postscript.
+ * This function is called by individual canvas items when they want to
+ * set a color value for output. Given information about an X color, this
+ * function will generate Postscript commands to set up an appropriate
+ * color in Postscript.
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
- * If no error occurs, then additional Postscript will be
- * appended to interp->result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in interp->result. If no error occurs, then
+ * additional Postscript will be appended to interp->result.
*
* Side effects:
* None.
@@ -5616,11 +5454,11 @@ GetStringsFromObjs(argc, objv)
*/
int
-Tk_CanvasPsColor(interp, canvas, colorPtr)
- Tcl_Interp *interp; /* Interpreter for returning Postscript
- * or error message. */
- Tk_Canvas canvas; /* Information about canvas. */
- XColor *colorPtr; /* Information about color. */
+Tk_CanvasPsColor(
+ Tcl_Interp *interp, /* Interpreter for returning Postscript or
+ * error message. */
+ Tk_Canvas canvas, /* Information about canvas. */
+ XColor *colorPtr) /* Information about color. */
{
return Tk_PostscriptColor(interp, ((TkCanvas *) canvas)->psInfo,
colorPtr);
@@ -5631,31 +5469,30 @@ Tk_CanvasPsColor(interp, canvas, colorPtr)
*
* Tk_CanvasPsFont --
*
- * This procedure is called by individual canvas items when
- * they want to output text. Given information about an X
- * font, this procedure will generate Postscript commands
- * to set up an appropriate font in Postscript.
+ * This function is called by individual canvas items when they want to
+ * output text. Given information about an X font, this function will
+ * generate Postscript commands to set up an appropriate font in
+ * Postscript.
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
- * If no error occurs, then additional Postscript will be
- * appended to the interp->result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in interp->result. If no error occurs, then
+ * additional Postscript will be appended to the interp->result.
*
* Side effects:
- * The Postscript font name is entered into psInfoPtr->fontTable
- * if it wasn't already there.
+ * The Postscript font name is entered into psInfoPtr->fontTable if it
+ * wasn't already there.
*
*--------------------------------------------------------------
*/
int
-Tk_CanvasPsFont(interp, canvas, tkfont)
- Tcl_Interp *interp; /* Interpreter for returning Postscript
- * or error message. */
- Tk_Canvas canvas; /* Information about canvas. */
- Tk_Font tkfont; /* Information about font in which text
- * is to be printed. */
+Tk_CanvasPsFont(
+ Tcl_Interp *interp, /* Interpreter for returning Postscript or
+ * error message. */
+ Tk_Canvas canvas, /* Information about canvas. */
+ Tk_Font tkfont) /* Information about font in which text is to
+ * be printed. */
{
return Tk_PostscriptFont(interp, ((TkCanvas *) canvas)->psInfo, tkfont);
}
@@ -5665,16 +5502,14 @@ Tk_CanvasPsFont(interp, canvas, tkfont)
*
* Tk_CanvasPsBitmap --
*
- * This procedure is called to output the contents of a
- * sub-region of a bitmap in proper image data format for
- * Postscript (i.e. data between angle brackets, one bit
- * per pixel).
+ * This function is called to output the contents of a sub-region of a
+ * bitmap in proper image data format for Postscript (i.e. data between
+ * angle brackets, one bit per pixel).
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
- * If no error occurs, then additional Postscript will be
- * appended to interp->result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in interp->result. If no error occurs, then
+ * additional Postscript will be appended to interp->result.
*
* Side effects:
* None.
@@ -5683,15 +5518,14 @@ Tk_CanvasPsFont(interp, canvas, tkfont)
*/
int
-Tk_CanvasPsBitmap(interp, canvas, bitmap, startX, startY, width, height)
- Tcl_Interp *interp; /* Interpreter for returning Postscript
- * or error message. */
- Tk_Canvas canvas; /* Information about canvas. */
- Pixmap bitmap; /* Bitmap for which to generate
- * Postscript. */
- int startX, startY; /* Coordinates of upper-left corner
- * of rectangular region to output. */
- int width, height; /* Height of rectangular region. */
+Tk_CanvasPsBitmap(
+ Tcl_Interp *interp, /* Interpreter for returning Postscript or
+ * error message. */
+ Tk_Canvas canvas, /* Information about canvas. */
+ Pixmap bitmap, /* Bitmap for which to generate Postscript. */
+ int startX, int startY, /* Coordinates of upper-left corner of
+ * rectangular region to output. */
+ int width, int height) /* Size of rectangular region. */
{
return Tk_PostscriptBitmap(interp, ((TkCanvas *) canvas)->tkwin,
((TkCanvas *) canvas)->psInfo, bitmap, startX, startY,
@@ -5703,18 +5537,16 @@ Tk_CanvasPsBitmap(interp, canvas, bitmap, startX, startY, width, height)
*
* Tk_CanvasPsStipple --
*
- * This procedure is called by individual canvas items when
- * they have created a path that they'd like to be filled with
- * a stipple pattern. Given information about an X bitmap,
- * this procedure will generate Postscript commands to fill
- * the current clip region using a stipple pattern defined by the
- * bitmap.
+ * This function is called by individual canvas items when they have
+ * created a path that they'd like to be filled with a stipple pattern.
+ * Given information about an X bitmap, this function will generate
+ * Postscript commands to fill the current clip region using a stipple
+ * pattern defined by the bitmap.
*
* Results:
- * Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
- * If no error occurs, then additional Postscript will be
- * appended to interp->result.
+ * Returns a standard Tcl return value. If an error occurs then an error
+ * message will be left in interp->result. If no error occurs, then
+ * additional Postscript will be appended to interp->result.
*
* Side effects:
* None.
@@ -5723,11 +5555,11 @@ Tk_CanvasPsBitmap(interp, canvas, bitmap, startX, startY, width, height)
*/
int
-Tk_CanvasPsStipple(interp, canvas, bitmap)
- Tcl_Interp *interp; /* Interpreter for returning Postscript
- * or error message. */
- Tk_Canvas canvas; /* Information about canvas. */
- Pixmap bitmap; /* Bitmap to use for stippling. */
+Tk_CanvasPsStipple(
+ Tcl_Interp *interp, /* Interpreter for returning Postscript or
+ * error message. */
+ Tk_Canvas canvas, /* Information about canvas. */
+ Pixmap bitmap) /* Bitmap to use for stippling. */
{
return Tk_PostscriptStipple(interp, ((TkCanvas *) canvas)->tkwin,
((TkCanvas *) canvas)->psInfo, bitmap);
@@ -5738,12 +5570,11 @@ Tk_CanvasPsStipple(interp, canvas, bitmap)
*
* Tk_CanvasPsY --
*
- * Given a y-coordinate in canvas coordinates, this procedure
- * returns a y-coordinate to use for Postscript output.
+ * Given a y-coordinate in canvas coordinates, this function returns a
+ * y-coordinate to use for Postscript output.
*
* Results:
- * Returns the Postscript coordinate that corresponds to
- * "y".
+ * Returns the Postscript coordinate that corresponds to "y".
*
* Side effects:
* None.
@@ -5752,10 +5583,10 @@ Tk_CanvasPsStipple(interp, canvas, bitmap)
*/
double
-Tk_CanvasPsY(canvas, y)
- Tk_Canvas canvas; /* Token for canvas on whose behalf
- * Postscript is being generated. */
- double y; /* Y-coordinate in canvas coords. */
+Tk_CanvasPsY(
+ Tk_Canvas canvas, /* Token for canvas on whose behalf Postscript
+ * is being generated. */
+ double y) /* Y-coordinate in canvas coords. */
{
return Tk_PostscriptY(y, ((TkCanvas *) canvas)->psInfo);
}
@@ -5765,8 +5596,8 @@ Tk_CanvasPsY(canvas, y)
*
* Tk_CanvasPsPath --
*
- * Given an array of points for a path, generate Postscript
- * commands to create the path.
+ * Given an array of points for a path, generate Postscript commands to
+ * create the path.
*
* Results:
* Postscript commands get appended to what's in interp->result.
@@ -5778,16 +5609,23 @@ Tk_CanvasPsY(canvas, y)
*/
void
-Tk_CanvasPsPath(interp, canvas, coordPtr, numPoints)
- Tcl_Interp *interp; /* Put generated Postscript in this
- * interpreter's result field. */
- Tk_Canvas canvas; /* Canvas on whose behalf Postscript
- * is being generated. */
- double *coordPtr; /* Pointer to first in array of
- * 2*numPoints coordinates giving
- * points for path. */
- int numPoints; /* Number of points at *coordPtr. */
+Tk_CanvasPsPath(
+ Tcl_Interp *interp, /* Put generated Postscript in this
+ * interpreter's result field. */
+ Tk_Canvas canvas, /* Canvas on whose behalf Postscript is being
+ * generated. */
+ double *coordPtr, /* Pointer to first in array of 2*numPoints
+ * coordinates giving points for path. */
+ int numPoints) /* Number of points at *coordPtr. */
{
Tk_PostscriptPath(interp, ((TkCanvas *) canvas)->psInfo,
coordPtr, numPoints);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCanvas.h b/generic/tkCanvas.h
index ad6c555..d009cfa 100644
--- a/generic/tkCanvas.h
+++ b/generic/tkCanvas.h
@@ -1,15 +1,14 @@
/*
* tkCanvas.h --
*
- * Declarations shared among all the files that implement
- * canvas widgets.
+ * Declarations shared among all the files that implement canvas widgets.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1995 Sun Microsystems, Inc.
* Copyright (c) 1998 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKCANVAS
@@ -23,36 +22,39 @@
typedef struct TagSearchExpr_s TagSearchExpr;
struct TagSearchExpr_s {
- TagSearchExpr *next; /* for linked lists of expressions - used in bindings */
- Tk_Uid uid; /* the uid of the whole expression */
- Tk_Uid *uids; /* expresion compiled to an array of uids */
- int allocated; /* available space for array of uids */
- int length; /* length of expression */
- int index; /* current position in expression evaluation */
- int match; /* this expression matches event's item's tags*/
+ TagSearchExpr *next; /* For linked lists of expressions - used in
+ * bindings. */
+ Tk_Uid uid; /* The uid of the whole expression. */
+ Tk_Uid *uids; /* Expresion compiled to an array of uids. */
+ int allocated; /* Available space for array of uids. */
+ int length; /* Length of expression. */
+ int index; /* Current position in expression
+ * evaluation. */
+ int match; /* This expression matches event's item's
+ * tags. */
};
#endif /* not USE_OLD_TAG_SEARCH */
/*
- * The record below describes a canvas widget. It is made available
- * to the item procedures so they can access certain shared fields such
- * as the overall displacement and scale factor for the canvas.
+ * The record below describes a canvas widget. It is made available to the
+ * item functions so they can access certain shared fields such as the overall
+ * displacement and scale factor for the canvas.
*/
typedef struct TkCanvas {
- Tk_Window tkwin; /* Window that embodies the canvas. NULL
- * means that the window has been destroyed
- * but the data structures haven't yet been
- * cleaned up.*/
- Display *display; /* Display containing widget; needed, among
+ Tk_Window tkwin; /* Window that embodies the canvas. NULL means
+ * that the window has been destroyed but the
+ * data structures haven't yet been cleaned
+ * up.*/
+ Display *display; /* Display containing widget; needed, among
* other things, to release resources after
* tkwin has already gone away. */
Tcl_Interp *interp; /* Interpreter associated with canvas. */
Tcl_Command widgetCmd; /* Token for canvas's widget command. */
- Tk_Item *firstItemPtr; /* First in list of all items in canvas,
- * or NULL if canvas empty. */
- Tk_Item *lastItemPtr; /* Last in list of all items in canvas,
- * or NULL if canvas empty. */
+ Tk_Item *firstItemPtr; /* First in list of all items in canvas, or
+ * NULL if canvas empty. */
+ Tk_Item *lastItemPtr; /* Last in list of all items in canvas, or
+ * NULL if canvas empty. */
/*
* Information used when displaying widget:
@@ -62,39 +64,39 @@ typedef struct TkCanvas {
Tk_3DBorder bgBorder; /* Used for canvas background. */
int relief; /* Indicates whether window as a whole is
* raised, sunken, or flat. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * <= 0 means don't draw a highlight. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. <= 0 means
+ * don't draw a highlight. */
XColor *highlightBgColorPtr;
- /* Color for drawing traversal highlight
- * area when highlight is off. */
+ /* Color for drawing traversal highlight area
+ * when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
int inset; /* Total width of all borders, including
* traversal highlight and 3-D border.
- * Indicates how much interior stuff must
- * be offset from outside edges to leave
- * room for borders. */
+ * Indicates how much interior stuff must be
+ * offset from outside edges to leave room for
+ * borders. */
GC pixmapGC; /* Used to copy bits from a pixmap to the
* screen and also to clear the pixmap. */
int width, height; /* Dimensions to request for canvas window,
* specified in pixels. */
- int redrawX1, redrawY1; /* Upper left corner of area to redraw,
- * in pixel coordinates. Border pixels
- * are included. Only valid if
- * REDRAW_PENDING flag is set. */
- int redrawX2, redrawY2; /* Lower right corner of area to redraw,
- * in integer canvas coordinates. Border
- * pixels will *not* be redrawn. */
- int confine; /* Non-zero means constrain view to keep
- * as much of canvas visible as possible. */
+ int redrawX1, redrawY1; /* Upper left corner of area to redraw, in
+ * pixel coordinates. Border pixels are
+ * included. Only valid if REDRAW_PENDING flag
+ * is set. */
+ int redrawX2, redrawY2; /* Lower right corner of area to redraw, in
+ * integer canvas coordinates. Border pixels
+ * will *not* be redrawn. */
+ int confine; /* Non-zero means constrain view to keep as
+ * much of canvas visible as possible. */
/*
* Information used to manage the selection and insertion cursor:
*/
- Tk_CanvasTextInfo textInfo; /* Contains lots of fields; see tk.h for
- * details. This structure is shared with
- * the code that implements individual items. */
+ Tk_CanvasTextInfo textInfo; /* Contains lots of fields; see tk.h for
+ * details. This structure is shared with the
+ * code that implements individual items. */
int insertOnTime; /* Number of milliseconds cursor should spend
* in "on" state for each blink. */
int insertOffTime; /* Number of milliseconds cursor should spend
@@ -104,7 +106,7 @@ typedef struct TkCanvas {
* off. */
/*
- * Transformation applied to canvas as a whole: to compute screen
+ * Transformation applied to canvas as a whole: to compute screen
* coordinates (X,Y) from canvas coordinates (x,y), do the following:
*
* X = x - xOrigin;
@@ -116,65 +118,63 @@ typedef struct TkCanvas {
* canvas pixel units. */
int drawableXOrigin, drawableYOrigin;
/* During redisplay, these fields give the
- * canvas coordinates corresponding to
- * the upper-left corner of the drawable
- * where items are actually being drawn
- * (typically a pixmap smaller than the
- * whole window). */
+ * canvas coordinates corresponding to the
+ * upper-left corner of the drawable where
+ * items are actually being drawn (typically a
+ * pixmap smaller than the whole window). */
/*
* Information used for event bindings associated with items.
*/
Tk_BindingTable bindingTable;
- /* Table of all bindings currently defined
- * for this canvas. NULL means that no
- * bindings exist, so the table hasn't been
- * created. Each "object" used for this
- * table is either a Tk_Uid for a tag or
- * the address of an item named by id. */
+ /* Table of all bindings currently defined for
+ * this canvas. NULL means that no bindings
+ * exist, so the table hasn't been created.
+ * Each "object" used for this table is either
+ * a Tk_Uid for a tag or the address of an
+ * item named by id. */
Tk_Item *currentItemPtr; /* The item currently containing the mouse
* pointer, or NULL if none. */
Tk_Item *newCurrentPtr; /* The item that is about to become the
- * current one, or NULL. This field is
- * used to detect deletions of the new
- * current item pointer that occur during
- * Leave processing of the previous current
- * item. */
- double closeEnough; /* The mouse is assumed to be inside an
- * item if it is this close to it. */
- XEvent pickEvent; /* The event upon which the current choice
- * of currentItem is based. Must be saved
- * so that if the currentItem is deleted,
- * can pick another. */
- int state; /* Last known modifier state. Used to
- * defer picking a new current object
- * while buttons are down. */
+ * current one, or NULL. This field is used to
+ * detect deletions of the new current item
+ * pointer that occur during Leave processing
+ * of the previous current item. */
+ double closeEnough; /* The mouse is assumed to be inside an item
+ * if it is this close to it. */
+ XEvent pickEvent; /* The event upon which the current choice of
+ * currentItem is based. Must be saved so that
+ * if the currentItem is deleted, can pick
+ * another. */
+ int state; /* Last known modifier state. Used to defer
+ * picking a new current object while buttons
+ * are down. */
/*
* Information used for managing scrollbars:
*/
char *xScrollCmd; /* Command prefix for communicating with
- * horizontal scrollbar. NULL means no
- * horizontal scrollbar. Malloc'ed*/
+ * horizontal scrollbar. NULL means no
+ * horizontal scrollbar. Malloc'ed. */
char *yScrollCmd; /* Command prefix for communicating with
- * vertical scrollbar. NULL means no
- * vertical scrollbar. Malloc'ed*/
+ * vertical scrollbar. NULL means no vertical
+ * scrollbar. Malloc'ed. */
int scrollX1, scrollY1, scrollX2, scrollY2;
/* These four coordinates define the region
* that is the 100% area for scrolling (i.e.
* these numbers determine the size and
* location of the sliders on scrollbars).
* Units are pixels in canvas coords. */
- char *regionString; /* The option string from which scrollX1
- * etc. are derived. Malloc'ed. */
+ char *regionString; /* The option string from which scrollX1 etc.
+ * are derived. Malloc'ed. */
int xScrollIncrement; /* If >0, defines a grid for horizontal
- * scrolling. This is the size of the "unit",
+ * scrolling. This is the size of the "unit",
* and the left edge of the screen will always
* lie on an even unit boundary. */
int yScrollIncrement; /* If >0, defines a grid for horizontal
- * scrolling. This is the size of the "unit",
+ * scrolling. This is the size of the "unit",
* and the left edge of the screen will always
* lie on an even unit boundary. */
@@ -195,11 +195,11 @@ typedef struct TkCanvas {
*/
Tk_Item *hotPtr; /* Pointer to "hot" item (one that's been
- * recently used. NULL means there's no
- * hot item. */
+ * recently used. NULL means there's no hot
+ * item. */
Tk_Item *hotPrevPtr; /* Pointer to predecessor to hotPtr (NULL
- * means item is first in list). This is
- * only a hint and may not really be hotPtr's
+ * means item is first in list). This is only
+ * a hint and may not really be hotPtr's
* predecessor. */
/*
@@ -207,61 +207,61 @@ typedef struct TkCanvas {
*/
Tk_Cursor cursor; /* Current cursor for window, or None. */
- char *takeFocus; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
- double pixelsPerMM; /* Scale factor between MM and pixels;
- * used when converting coordinates. */
- int flags; /* Various flags; see below for
+ char *takeFocus; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
+ double pixelsPerMM; /* Scale factor between MM and pixels; used
+ * when converting coordinates. */
+ int flags; /* Various flags; see below for
* definitions. */
- int nextId; /* Number to use as id for next item
- * created in widget. */
- Tk_PostscriptInfo psInfo;
- /* Pointer to information used for generating
- * Postscript for the canvas. NULL means
- * no Postscript is currently being
- * generated. */
+ int nextId; /* Number to use as id for next item created
+ * in widget. */
+ Tk_PostscriptInfo psInfo; /* Pointer to information used for generating
+ * Postscript for the canvas. NULL means no
+ * Postscript is currently being generated. */
Tcl_HashTable idTable; /* Table of integer indices. */
+
/*
* Additional information, added by the 'dash'-patch
*/
- VOID *reserved1;
- Tk_State canvas_state; /* state of canvas */
- VOID *reserved2;
- VOID *reserved3;
+
+ void *reserved1;
+ Tk_State canvas_state; /* State of canvas. */
+ void *reserved2;
+ void *reserved3;
Tk_TSOffset tsoffset;
#ifndef USE_OLD_TAG_SEARCH
- TagSearchExpr *bindTagExprs; /* linked list of tag expressions used in bindings */
+ TagSearchExpr *bindTagExprs;/* Linked list of tag expressions used in
+ * bindings. */
#endif
} TkCanvas;
/*
* Flag bits for canvases:
*
- * REDRAW_PENDING - 1 means a DoWhenIdle handler has already
- * been created to redraw some or all of the
- * canvas.
+ * REDRAW_PENDING - 1 means a DoWhenIdle handler has already been
+ * created to redraw some or all of the canvas.
* REDRAW_BORDERS - 1 means that the borders need to be redrawn
* during the next redisplay operation.
* REPICK_NEEDED - 1 means DisplayCanvas should pick a new
* current item before redrawing the canvas.
- * GOT_FOCUS - 1 means the focus is currently in this
- * widget, so should draw the insertion cursor
- * and traversal highlight.
+ * GOT_FOCUS - 1 means the focus is currently in this widget,
+ * so should draw the insertion cursor and
+ * traversal highlight.
* CURSOR_ON - 1 means the insertion cursor is in the "on"
- * phase of its blink cycle. 0 means either
- * we don't have the focus or the cursor is in
- * the "off" phase of its cycle.
- * UPDATE_SCROLLBARS - 1 means the scrollbars should get updated
- * as part of the next display operation.
- * LEFT_GRABBED_ITEM - 1 means that the mouse left the current
- * item while a grab was in effect, so we
- * didn't change canvasPtr->currentItemPtr.
+ * phase of its blink cycle. 0 means either we
+ * don't have the focus or the cursor is in the
+ * "off" phase of its cycle.
+ * UPDATE_SCROLLBARS - 1 means the scrollbars should get updated as
+ * part of the next display operation.
+ * LEFT_GRABBED_ITEM - 1 means that the mouse left the current item
+ * while a grab was in effect, so we didn't
+ * change canvasPtr->currentItemPtr.
* REPICK_IN_PROGRESS - 1 means PickCurrentItem is currently
- * executing. If it should be called recursively,
+ * executing. If it should be called recursively,
* it should simply return immediately.
- * BBOX_NOT_EMPTY - 1 means that the bounding box of the area
- * that should be redrawn is not empty.
+ * BBOX_NOT_EMPTY - 1 means that the bounding box of the area that
+ * should be redrawn is not empty.
*/
#define REDRAW_PENDING 1
@@ -277,8 +277,8 @@ typedef struct TkCanvas {
/*
* Flag bits for canvas items (redraw_flags):
*
- * FORCE_REDRAW - 1 means that the new coordinates of some
- * item are not yet registered using
+ * FORCE_REDRAW - 1 means that the new coordinates of some item
+ * are not yet registered using
* Tk_CanvasEventuallyRedraw(). It should still
* be done by the general canvas code.
*/
@@ -286,20 +286,21 @@ typedef struct TkCanvas {
#define FORCE_REDRAW 8
/*
- * Canvas-related procedures that are shared among Tk modules but not
- * exported to the outside world:
+ * Canvas-related functions that are shared among Tk modules but not exported
+ * to the outside world:
*/
-extern int TkCanvPostscriptCmd _ANSI_ARGS_((TkCanvas *canvasPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-
+MODULE_SCOPE int TkCanvPostscriptCmd(TkCanvas *canvasPtr,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+MODULE_SCOPE int TkCanvTranslatePath(TkCanvas *canvPtr,
+ int numVertex, double *coordPtr, int closed,
+ XPoint *outPtr);
/*
- * Other procedures that are shared among Tk canvas modules but not exported
- * to the outside world:
+ * Standard item types provided by Tk:
*/
-extern int TkCanvTranslatePath _ANSI_ARGS_((TkCanvas *canvPtr,
- int numVertex, double *coordPtr, int closed,
- XPoint *outPtr));
+MODULE_SCOPE Tk_ItemType tkArcType, tkBitmapType, tkImageType, tkLineType;
+MODULE_SCOPE Tk_ItemType tkOvalType, tkPolygonType;
+MODULE_SCOPE Tk_ItemType tkRectangleType, tkTextType, tkWindowType;
#endif /* _TKCANVAS */
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 8c37f09..9428894 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -1,48 +1,46 @@
/*
* tkClipboard.c --
*
- * This file manages the clipboard for the Tk toolkit,
- * maintaining a collection of data buffers that will be
- * supplied on demand to requesting applications.
+ * This file manages the clipboard for the Tk toolkit, maintaining a
+ * collection of data buffers that will be supplied on demand to
+ * requesting applications.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
#include "tkSelect.h"
/*
- * Prototypes for procedures used only in this file:
+ * Prototypes for functions used only in this file:
*/
-static int ClipboardAppHandler _ANSI_ARGS_((ClientData clientData,
- int offset, char *buffer, int maxBytes));
-static int ClipboardHandler _ANSI_ARGS_((ClientData clientData,
- int offset, char *buffer, int maxBytes));
-static int ClipboardWindowHandler _ANSI_ARGS_((
- ClientData clientData, int offset, char *buffer,
- int maxBytes));
-static void ClipboardLostSel _ANSI_ARGS_((ClientData clientData));
-static int ClipboardGetProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, char *portion));
+static int ClipboardAppHandler(ClientData clientData,
+ int offset, char *buffer, int maxBytes);
+static int ClipboardHandler(ClientData clientData,
+ int offset, char *buffer, int maxBytes);
+static int ClipboardWindowHandler(ClientData clientData,
+ int offset, char *buffer, int maxBytes);
+static void ClipboardLostSel(ClientData clientData);
+static int ClipboardGetProc(ClientData clientData,
+ Tcl_Interp *interp, char *portion);
/*
*----------------------------------------------------------------------
*
* ClipboardHandler --
*
- * This procedure acts as selection handler for the
- * clipboard manager. It extracts the required chunk of
- * data from the buffer chain for a given selection target.
+ * This function acts as selection handler for the clipboard manager. It
+ * extracts the required chunk of data from the buffer chain for a given
+ * selection target.
*
* Results:
- * The return value is a count of the number of bytes
- * actually stored at buffer.
+ * The return value is a count of the number of bytes actually stored at
+ * buffer.
*
* Side effects:
* None.
@@ -51,17 +49,17 @@ static int ClipboardGetProc _ANSI_ARGS_((ClientData clientData,
*/
static int
-ClipboardHandler(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Information about data to fetch. */
- int offset; /* Return selection bytes starting at this
+ClipboardHandler(
+ ClientData clientData, /* Information about data to fetch. */
+ int offset, /* Return selection bytes starting at this
* offset. */
- char *buffer; /* Place to store converted selection. */
- int maxBytes; /* Maximum # of bytes to store at buffer. */
+ char *buffer, /* Place to store converted selection. */
+ int maxBytes) /* Maximum # of bytes to store at buffer. */
{
TkClipboardTarget *targetPtr = (TkClipboardTarget*) clientData;
TkClipboardBuffer *cbPtr;
char *srcPtr, *destPtr;
- int count = 0;
+ size_t count = 0;
int scanned = 0;
size_t length, freeCount;
@@ -104,7 +102,7 @@ ClipboardHandler(clientData, offset, buffer, maxBytes)
srcPtr = cbPtr->buffer;
length = cbPtr->length;
}
- return count;
+ return (int)count;
}
/*
@@ -112,16 +110,15 @@ ClipboardHandler(clientData, offset, buffer, maxBytes)
*
* ClipboardAppHandler --
*
- * This procedure acts as selection handler for retrievals of type
- * TK_APPLICATION. It returns the name of the application that
- * owns the clipboard. Note: we can't use the default Tk
- * selection handler for this selection type, because the clipboard
- * window isn't a "real" window and doesn't have the necessary
- * information.
+ * This function acts as selection handler for retrievals of type
+ * TK_APPLICATION. It returns the name of the application that owns the
+ * clipboard. Note: we can't use the default Tk selection handler for
+ * this selection type, because the clipboard window isn't a "real"
+ * window and doesn't have the necessary information.
*
* Results:
- * The return value is a count of the number of bytes
- * actually stored at buffer.
+ * The return value is a count of the number of bytes actually stored at
+ * buffer.
*
* Side effects:
* None.
@@ -130,12 +127,12 @@ ClipboardHandler(clientData, offset, buffer, maxBytes)
*/
static int
-ClipboardAppHandler(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Pointer to TkDisplay structure. */
- int offset; /* Return selection bytes starting at this
+ClipboardAppHandler(
+ ClientData clientData, /* Pointer to TkDisplay structure. */
+ int offset, /* Return selection bytes starting at this
* offset. */
- char *buffer; /* Place to store converted selection. */
- int maxBytes; /* Maximum # of bytes to store at buffer. */
+ char *buffer, /* Place to store converted selection. */
+ int maxBytes) /* Maximum # of bytes to store at buffer. */
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
size_t length;
@@ -151,7 +148,7 @@ ClipboardAppHandler(clientData, offset, buffer, maxBytes)
length = maxBytes;
}
strncpy(buffer, p, length);
- return length;
+ return (int)length;
}
/*
@@ -159,15 +156,13 @@ ClipboardAppHandler(clientData, offset, buffer, maxBytes)
*
* ClipboardWindowHandler --
*
- * This procedure acts as selection handler for retrievals of
- * type TK_WINDOW. Since the clipboard doesn't correspond to
- * any particular window, we just return ".". We can't use Tk's
- * default handler for this selection type, because the clipboard
- * window isn't a valid window.
+ * This function acts as selection handler for retrievals of type
+ * TK_WINDOW. Since the clipboard doesn't correspond to any particular
+ * window, we just return ".". We can't use Tk's default handler for this
+ * selection type, because the clipboard window isn't a valid window.
*
* Results:
- * The return value is 1, the number of non-null bytes stored
- * at buffer.
+ * The return value is 1, the number of non-null bytes stored at buffer.
*
* Side effects:
* None.
@@ -176,12 +171,12 @@ ClipboardAppHandler(clientData, offset, buffer, maxBytes)
*/
static int
-ClipboardWindowHandler(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Not used. */
- int offset; /* Return selection bytes starting at this
+ClipboardWindowHandler(
+ ClientData clientData, /* Not used. */
+ int offset, /* Return selection bytes starting at this
* offset. */
- char *buffer; /* Place to store converted selection. */
- int maxBytes; /* Maximum # of bytes to store at buffer. */
+ char *buffer, /* Place to store converted selection. */
+ int maxBytes) /* Maximum # of bytes to store at buffer. */
{
buffer[0] = '.';
buffer[1] = 0;
@@ -193,9 +188,9 @@ ClipboardWindowHandler(clientData, offset, buffer, maxBytes)
*
* ClipboardLostSel --
*
- * This procedure is invoked whenever clipboard ownership is
- * claimed by another window. It just sets a flag so that we
- * know the clipboard was taken away.
+ * This function is invoked whenever clipboard ownership is claimed by
+ * another window. It just sets a flag so that we know the clipboard was
+ * taken away.
*
* Results:
* None.
@@ -207,8 +202,8 @@ ClipboardWindowHandler(clientData, offset, buffer, maxBytes)
*/
static void
-ClipboardLostSel(clientData)
- ClientData clientData; /* Pointer to TkDisplay structure. */
+ClipboardLostSel(
+ ClientData clientData) /* Pointer to TkDisplay structure. */
{
TkDisplay *dispPtr = (TkDisplay*) clientData;
@@ -220,33 +215,31 @@ ClipboardLostSel(clientData)
*
* Tk_ClipboardClear --
*
- * Take control of the clipboard and clear out the previous
- * contents. This procedure must be invoked before any
- * calls to Tk_ClipboardAppend.
+ * Take control of the clipboard and clear out the previous contents.
+ * This function must be invoked before any calls to Tk_ClipboardAppend.
*
* Results:
- * A standard Tcl result. If an error occurs, an error message is
- * left in the interp's result.
+ * A standard Tcl result. If an error occurs, an error message is left in
+ * the interp's result.
*
* Side effects:
- * From now on, requests for the CLIPBOARD selection will be
- * directed to the clipboard manager routines associated with
- * clipWindow for the display of tkwin. In order to guarantee
- * atomicity, no event handling should occur between
- * Tk_ClipboardClear and the following Tk_ClipboardAppend
- * calls. This procedure may cause a user-defined LostSel command
- * to be invoked when the CLIPBOARD is claimed, so any calling
- * function should be reentrant at the point Tk_ClipboardClear is
+ * From now on, requests for the CLIPBOARD selection will be directed to
+ * the clipboard manager routines associated with clipWindow for the
+ * display of tkwin. In order to guarantee atomicity, no event handling
+ * should occur between Tk_ClipboardClear and the following
+ * Tk_ClipboardAppend calls. This function may cause a user-defined
+ * LostSel command to be invoked when the CLIPBOARD is claimed, so any
+ * calling function should be reentrant at the point Tk_ClipboardClear is
* invoked.
*
*----------------------------------------------------------------------
*/
int
-Tk_ClipboardClear(interp, tkwin)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in application that is clearing
- * clipboard; identifies application and
+Tk_ClipboardClear(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin) /* Window in application that is clearing
+ * clipboard; identifies application and
* display. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -264,8 +257,8 @@ Tk_ClipboardClear(interp, tkwin)
}
/*
- * Discard any existing clipboard data and delete the selection
- * handler(s) associated with that data.
+ * Discard any existing clipboard data and delete the selection handler(s)
+ * associated with that data.
*/
for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
@@ -301,38 +294,37 @@ Tk_ClipboardClear(interp, tkwin)
*
* Tk_ClipboardAppend --
*
- * Append a buffer of data to the clipboard. The first buffer of
- * a given type determines the format for that type. Any successive
- * appends to that type must have the same format or an error will
- * be returned. Tk_ClipboardClear must be called before a sequence
- * of Tk_ClipboardAppend calls can be issued. In order to guarantee
+ * Append a buffer of data to the clipboard. The first buffer of a given
+ * type determines the format for that type. Any successive appends to
+ * that type must have the same format or an error will be returned.
+ * Tk_ClipboardClear must be called before a sequence of
+ * Tk_ClipboardAppend calls can be issued. In order to guarantee
* atomicity, no event handling should occur between Tk_ClipboardClear
* and the following Tk_ClipboardAppend calls.
*
* Results:
- * A standard Tcl result. If an error is returned, an error message
- * is left in the interp's result.
+ * A standard Tcl result. If an error is returned, an error message is
+ * left in the interp's result.
*
* Side effects:
- * The specified buffer will be copied onto the end of the clipboard.
- * The clipboard maintains a list of buffers which will be used to
- * supply the data for a selection get request. The first time a given
- * type is appended, Tk_ClipboardAppend will register a selection
- * handler of the appropriate type.
+ * The specified buffer will be copied onto the end of the clipboard.
+ * The clipboard maintains a list of buffers which will be used to supply
+ * the data for a selection get request. The first time a given type is
+ * appended, Tk_ClipboardAppend will register a selection handler of the
+ * appropriate type.
*
*----------------------------------------------------------------------
*/
int
-Tk_ClipboardAppend(interp, tkwin, type, format, buffer)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Window tkwin; /* Window that selects a display. */
- Atom type; /* The desired conversion type for this
+Tk_ClipboardAppend(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Window tkwin, /* Window that selects a display. */
+ Atom type, /* The desired conversion type for this
* clipboard item, e.g. STRING or LENGTH. */
- Atom format; /* Format in which the selection
- * information should be returned to
- * the requestor. */
- char* buffer; /* NULL terminated string containing the data
+ Atom format, /* Format in which the selection information
+ * should be returned to the requestor. */
+ char* buffer) /* NULL terminated string containing the data
* to be added to the clipboard. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -341,8 +333,8 @@ Tk_ClipboardAppend(interp, tkwin, type, format, buffer)
TkClipboardBuffer *cbPtr;
/*
- * If this application doesn't already own the clipboard, clear
- * the clipboard. If we don't own the clipboard selection, claim it.
+ * If this application doesn't already own the clipboard, clear the
+ * clipboard. If we don't own the clipboard selection, claim it.
*/
if (dispPtr->clipboardAppPtr != winPtr->mainPtr) {
@@ -355,14 +347,15 @@ Tk_ClipboardAppend(interp, tkwin, type, format, buffer)
/*
* Check to see if the specified target is already present on the
- * clipboard. If it isn't, we need to create a new target; otherwise,
- * we just append the new buffer to the clipboard list.
+ * clipboard. If it isn't, we need to create a new target; otherwise, we
+ * just append the new buffer to the clipboard list.
*/
for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
targetPtr = targetPtr->nextPtr) {
- if (targetPtr->type == type)
+ if (targetPtr->type == type) {
break;
+ }
}
if (targetPtr == NULL) {
targetPtr = (TkClipboardTarget*) ckalloc(sizeof(TkClipboardTarget));
@@ -377,7 +370,7 @@ Tk_ClipboardAppend(interp, tkwin, type, format, buffer)
Tcl_AppendResult(interp, "format \"", Tk_GetAtomName(tkwin, format),
"\" does not match current format \"",
Tk_GetAtomName(tkwin, targetPtr->format),"\" for ",
- Tk_GetAtomName(tkwin, type), (char *) NULL);
+ Tk_GetAtomName(tkwin, type), NULL);
return TCL_ERROR;
}
@@ -408,9 +401,8 @@ Tk_ClipboardAppend(interp, tkwin, type, format, buffer)
*
* Tk_ClipboardObjCmd --
*
- * This procedure is invoked to process the "clipboard" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "clipboard" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -422,12 +414,11 @@ Tk_ClipboardAppend(interp, tkwin, type, format, buffer)
*/
int
-Tk_ClipboardObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings. */
+Tk_ClipboardObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument strings. */
{
Tk_Window tkwin = (Tk_Window) clientData;
char *path = NULL;
@@ -447,173 +438,173 @@ Tk_ClipboardObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case CLIPBOARD_APPEND: {
- Atom target, format;
- char *targetName = NULL;
- char *formatName = NULL;
- char *string;
- static CONST char *appendOptionStrings[] = {
- "-displayof", "-format", "-type", NULL
- };
- enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT,
- APPEND_TYPE };
- int subIndex, length;
-
- for (i = 2; i < objc - 1; i++) {
- string = Tcl_GetStringFromObj(objv[i], &length);
- if (string[0] != '-') {
- break;
- }
-
- /*
- * If the argument is "--", it signifies the end of arguments.
- */
- if (string[1] == '-' && length == 2) {
- i++;
- break;
- }
- if (Tcl_GetIndexFromObj(interp, objv[i], appendOptionStrings,
- "option", 0, &subIndex) != TCL_OK) {
- return TCL_ERROR;
- }
-
- /*
- * Increment i so that it points to the value for the flag
- * instead of the flag itself.
- */
+ case CLIPBOARD_APPEND: {
+ Atom target, format;
+ char *targetName = NULL;
+ char *formatName = NULL;
+ char *string;
+ static CONST char *appendOptionStrings[] = {
+ "-displayof", "-format", "-type", NULL
+ };
+ enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE };
+ int subIndex, length;
+
+ for (i = 2; i < objc - 1; i++) {
+ string = Tcl_GetStringFromObj(objv[i], &length);
+ if (string[0] != '-') {
+ break;
+ }
+ /*
+ * If the argument is "--", it signifies the end of arguments.
+ */
+ if (string[1] == '-' && length == 2) {
i++;
- if (i >= objc) {
- Tcl_AppendResult(interp, "value for \"", string,
- "\" missing", (char *) NULL);
- return TCL_ERROR;
- }
- switch ((enum appendOptions) subIndex) {
- case APPEND_DISPLAYOF:
- path = Tcl_GetString(objv[i]);
- break;
- case APPEND_FORMAT:
- formatName = Tcl_GetString(objv[i]);
- break;
- case APPEND_TYPE:
- targetName = Tcl_GetString(objv[i]);
- break;
- }
+ break;
}
- if (objc - i != 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "?options? data");
+ if (Tcl_GetIndexFromObj(interp, objv[i], appendOptionStrings,
+ "option", 0, &subIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (path != NULL) {
- tkwin = Tk_NameToWindow(interp, path, tkwin);
- }
- if (tkwin == NULL) {
+
+ /*
+ * Increment i so that it points to the value for the flag instead
+ * of the flag itself.
+ */
+
+ i++;
+ if (i >= objc) {
+ Tcl_AppendResult(interp, "value for \"", string,
+ "\" missing", NULL);
return TCL_ERROR;
}
- if (targetName != NULL) {
- target = Tk_InternAtom(tkwin, targetName);
- } else {
- target = XA_STRING;
- }
- if (formatName != NULL) {
- format = Tk_InternAtom(tkwin, formatName);
- } else {
- format = XA_STRING;
+ switch ((enum appendOptions) subIndex) {
+ case APPEND_DISPLAYOF:
+ path = Tcl_GetString(objv[i]);
+ break;
+ case APPEND_FORMAT:
+ formatName = Tcl_GetString(objv[i]);
+ break;
+ case APPEND_TYPE:
+ targetName = Tcl_GetString(objv[i]);
+ break;
}
- return Tk_ClipboardAppend(interp, tkwin, target, format,
- Tcl_GetString(objv[i]));
}
- case CLIPBOARD_CLEAR: {
- static CONST char *clearOptionStrings[] = { "-displayof", NULL };
- enum clearOptions { CLEAR_DISPLAYOF };
- int subIndex;
- if (objc != 2 && objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
- return TCL_ERROR;
- }
+ if (objc - i != 1) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?options? data");
+ return TCL_ERROR;
+ }
+ if (path != NULL) {
+ tkwin = Tk_NameToWindow(interp, path, tkwin);
+ }
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ if (targetName != NULL) {
+ target = Tk_InternAtom(tkwin, targetName);
+ } else {
+ target = XA_STRING;
+ }
+ if (formatName != NULL) {
+ format = Tk_InternAtom(tkwin, formatName);
+ } else {
+ format = XA_STRING;
+ }
+ return Tk_ClipboardAppend(interp, tkwin, target, format,
+ Tcl_GetString(objv[i]));
+ }
+ case CLIPBOARD_CLEAR: {
+ static CONST char *clearOptionStrings[] = { "-displayof", NULL };
+ enum clearOptions { CLEAR_DISPLAYOF };
+ int subIndex;
+
+ if (objc != 2 && objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
+ return TCL_ERROR;
+ }
- if (objc == 4) {
- if (Tcl_GetIndexFromObj(interp, objv[2], clearOptionStrings,
- "option", 0, &subIndex) != TCL_OK) {
- return TCL_ERROR;
- }
- if ((enum clearOptions) subIndex == CLEAR_DISPLAYOF) {
- path = Tcl_GetString(objv[3]);
- }
- }
- if (path != NULL) {
- tkwin = Tk_NameToWindow(interp, path, tkwin);
- }
- if (tkwin == NULL) {
+ if (objc == 4) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], clearOptionStrings,
+ "option", 0, &subIndex) != TCL_OK) {
return TCL_ERROR;
}
- return Tk_ClipboardClear(interp, tkwin);
- }
- case CLIPBOARD_GET: {
- Atom target;
- char *targetName = NULL;
- Tcl_DString selBytes;
- int result;
- char *string;
- static CONST char *getOptionStrings[] = {
- "-displayof", "-type", NULL
- };
- enum getOptions { APPEND_DISPLAYOF, APPEND_TYPE };
- int subIndex;
-
- for (i = 2; i < objc; i++) {
- string = Tcl_GetString(objv[i]);
- if (string[0] != '-') {
- break;
- }
- if (Tcl_GetIndexFromObj(interp, objv[i], getOptionStrings,
- "option", 0, &subIndex) != TCL_OK) {
- return TCL_ERROR;
- }
- i++;
- if (i >= objc) {
- Tcl_AppendResult(interp, "value for \"", string,
- "\" missing", (char *) NULL);
- return TCL_ERROR;
- }
- switch ((enum getOptions) subIndex) {
- case APPEND_DISPLAYOF:
- path = Tcl_GetString(objv[i]);
- break;
- case APPEND_TYPE:
- targetName = Tcl_GetString(objv[i]);
- break;
- }
+ if ((enum clearOptions) subIndex == CLEAR_DISPLAYOF) {
+ path = Tcl_GetString(objv[3]);
}
- if (path != NULL) {
- tkwin = Tk_NameToWindow(interp, path, tkwin);
+ }
+ if (path != NULL) {
+ tkwin = Tk_NameToWindow(interp, path, tkwin);
+ }
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ return Tk_ClipboardClear(interp, tkwin);
+ }
+ case CLIPBOARD_GET: {
+ Atom target;
+ char *targetName = NULL;
+ Tcl_DString selBytes;
+ int result;
+ char *string;
+ static CONST char *getOptionStrings[] = {
+ "-displayof", "-type", NULL
+ };
+ enum getOptions { APPEND_DISPLAYOF, APPEND_TYPE };
+ int subIndex;
+
+ for (i = 2; i < objc; i++) {
+ string = Tcl_GetString(objv[i]);
+ if (string[0] != '-') {
+ break;
}
- if (tkwin == NULL) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], getOptionStrings,
+ "option", 0, &subIndex) != TCL_OK) {
return TCL_ERROR;
}
- selection = Tk_InternAtom(tkwin, "CLIPBOARD");
-
- if (objc - i > 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "?options?");
+ i++;
+ if (i >= objc) {
+ Tcl_AppendResult(interp, "value for \"", string,
+ "\" missing", NULL);
return TCL_ERROR;
- } else if (objc - i == 1) {
- target = Tk_InternAtom(tkwin, Tcl_GetString(objv[i]));
- } else if (targetName != NULL) {
- target = Tk_InternAtom(tkwin, targetName);
- } else {
- target = XA_STRING;
}
-
- Tcl_DStringInit(&selBytes);
- result = Tk_GetSelection(interp, tkwin, selection, target,
- ClipboardGetProc, (ClientData) &selBytes);
- if (result == TCL_OK) {
- Tcl_DStringResult(interp, &selBytes);
- } else {
- Tcl_DStringFree(&selBytes);
+ switch ((enum getOptions) subIndex) {
+ case APPEND_DISPLAYOF:
+ path = Tcl_GetString(objv[i]);
+ break;
+ case APPEND_TYPE:
+ targetName = Tcl_GetString(objv[i]);
+ break;
}
- return result;
}
+ if (path != NULL) {
+ tkwin = Tk_NameToWindow(interp, path, tkwin);
+ }
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ selection = Tk_InternAtom(tkwin, "CLIPBOARD");
+
+ if (objc - i > 1) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?options?");
+ return TCL_ERROR;
+ } else if (objc - i == 1) {
+ target = Tk_InternAtom(tkwin, Tcl_GetString(objv[i]));
+ } else if (targetName != NULL) {
+ target = Tk_InternAtom(tkwin, targetName);
+ } else {
+ target = XA_STRING;
+ }
+
+ Tcl_DStringInit(&selBytes);
+ result = Tk_GetSelection(interp, tkwin, selection, target,
+ ClipboardGetProc, (ClientData) &selBytes);
+ if (result == TCL_OK) {
+ Tcl_DStringResult(interp, &selBytes);
+ } else {
+ Tcl_DStringFree(&selBytes);
+ }
+ return result;
+ }
}
return TCL_OK;
}
@@ -623,8 +614,8 @@ Tk_ClipboardObjCmd(clientData, interp, objc, objv)
*
* TkClipInit --
*
- * This procedure is called to initialize the window for claiming
- * clipboard ownership and for receiving selection get results. This
+ * This function is called to initialize the window for claiming
+ * clipboard ownership and for receiving selection get results. This
* function is called from tkSelect.c as well as tkClipboard.c.
*
* Results:
@@ -639,17 +630,16 @@ Tk_ClipboardObjCmd(clientData, interp, objc, objv)
*/
int
-TkClipInit(interp, dispPtr)
- Tcl_Interp *interp; /* Interpreter to use for error
- * reporting. */
- register TkDisplay *dispPtr;/* Display to initialize. */
+TkClipInit(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ register TkDisplay *dispPtr)/* Display to initialize. */
{
XSetWindowAttributes atts;
dispPtr->clipTargetPtr = NULL;
dispPtr->clipboardActive = 0;
dispPtr->clipboardAppPtr = NULL;
-
+
/*
* Create the window used for clipboard ownership and selection retrieval,
* and set up an event handler for it.
@@ -667,17 +657,17 @@ TkClipInit(interp, dispPtr)
if (dispPtr->multipleAtom == None) {
/*
- * Need to invoke selection initialization to make sure that
- * atoms we depend on below are defined.
+ * Need to invoke selection initialization to make sure that atoms we
+ * depend on below are defined.
*/
TkSelInit(dispPtr->clipWindow);
}
/*
- * Create selection handlers for types TK_APPLICATION and TK_WINDOW
- * on this window. Can't use the default handlers for these types
- * because this isn't a full-fledged window.
+ * Create selection handlers for types TK_APPLICATION and TK_WINDOW on
+ * this window. Can't use the default handlers for these types because
+ * this isn't a full-fledged window.
*/
Tk_CreateSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
@@ -694,29 +684,37 @@ TkClipInit(interp, dispPtr)
*
* ClipboardGetProc --
*
- * This procedure is invoked to process pieces of the selection
- * as they arrive during "clipboard get" commands.
+ * This function is invoked to process pieces of the selection as they
+ * arrive during "clipboard get" commands.
*
* Results:
* Always returns TCL_OK.
*
* Side effects:
- * Bytes get appended to the dynamic string pointed to by the
- * clientData argument.
+ * Bytes get appended to the dynamic string pointed to by the clientData
+ * argument.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
-ClipboardGetProc(clientData, interp, portion)
- ClientData clientData; /* Dynamic string holding partially
- * assembled selection. */
- Tcl_Interp *interp; /* Interpreter used for error
- * reporting (not used). */
- char *portion; /* New information to be appended. */
+ClipboardGetProc(
+ ClientData clientData, /* Dynamic string holding partially assembled
+ * selection. */
+ Tcl_Interp *interp, /* Interpreter used for error reporting (not
+ * used). */
+ char *portion) /* New information to be appended. */
{
Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1);
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 16cfd8d..a86ef84 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -1,50 +1,47 @@
-/*
+/*
* tkCmds.c --
*
- * This file contains a collection of Tk-related Tcl commands
- * that didn't fit in any particular file of the toolkit.
+ * This file contains a collection of Tk-related Tcl commands that didn't
+ * fit in any particular file of the toolkit.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 2000 Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
#if defined(WIN32)
#include "tkWinInt.h"
-#elif defined(MAC_TCL)
-#include "tkMacInt.h"
-#elif defined(MAC_OSX_TK)
+#elif defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#else
#include "tkUnixInt.h"
#endif
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static TkWindow * GetToplevel _ANSI_ARGS_((Tk_Window tkwin));
-static char * WaitVariableProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static void WaitVisibilityProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void WaitWindowProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
+static TkWindow * GetTopHierarchy(Tk_Window tkwin);
+static char * WaitVariableProc(ClientData clientData,
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
+static void WaitVisibilityProc(ClientData clientData,
+ XEvent *eventPtr);
+static void WaitWindowProc(ClientData clientData,
+ XEvent *eventPtr);
/*
*----------------------------------------------------------------------
*
* Tk_BellObjCmd --
*
- * This procedure is invoked to process the "bell" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "bell" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -56,18 +53,21 @@ static void WaitWindowProc _ANSI_ARGS_((ClientData clientData,
*/
int
-Tk_BellObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_BellObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *bellOptions[] = {"-displayof", "-nice", (char *) NULL};
+ static const char *bellOptions[] = {
+ "-displayof", "-nice", NULL
+ };
enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE };
Tk_Window tkwin = (Tk_Window) clientData;
int i, index, nice = 0;
if (objc > 4) {
+ wrongArgs:
Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window? ?-nice?");
return TCL_ERROR;
}
@@ -78,20 +78,18 @@ Tk_BellObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
switch ((enum options) index) {
- case TK_BELL_DISPLAYOF:
- if (++i >= objc) {
- Tcl_WrongNumArgs(interp, 1, objv,
- "?-displayof window? ?-nice?");
- return TCL_ERROR;
- }
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), tkwin);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- break;
- case TK_BELL_NICE:
- nice = 1;
- break;
+ case TK_BELL_DISPLAYOF:
+ if (++i >= objc) {
+ goto wrongArgs;
+ }
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), tkwin);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_BELL_NICE:
+ nice = 1;
+ break;
}
}
XBell(Tk_Display(tkwin), 0);
@@ -107,8 +105,8 @@ Tk_BellObjCmd(clientData, interp, objc, objv)
*
* Tk_BindObjCmd --
*
- * This procedure is invoked to process the "bind" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "bind" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -120,23 +118,23 @@ Tk_BellObjCmd(clientData, interp, objc, objv)
*/
int
-Tk_BindObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_BindObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
TkWindow *winPtr;
ClientData object;
char *string;
-
+
if ((objc < 2) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "window ?pattern? ?command?");
return TCL_ERROR;
}
string = Tcl_GetString(objv[1]);
-
+
/*
* Bind tags either a window name or a tag name for the first argument.
* If the argument starts with ".", assume it is a window; otherwise, it
@@ -155,8 +153,8 @@ Tk_BindObjCmd(clientData, interp, objc, objv)
}
/*
- * If there are four arguments, the command is modifying a binding. If
- * there are three arguments, the command is querying a binding. If there
+ * If there are four arguments, the command is modifying a binding. If
+ * there are three arguments, the command is querying a binding. If there
* are only two arguments, the command is querying all the bindings for
* the given tag/window.
*/
@@ -167,7 +165,7 @@ Tk_BindObjCmd(clientData, interp, objc, objv)
char *sequence, *script;
sequence = Tcl_GetString(objv[2]);
script = Tcl_GetString(objv[3]);
-
+
/*
* If the script is null, just delete the binding.
*/
@@ -181,7 +179,7 @@ Tk_BindObjCmd(clientData, interp, objc, objv)
* If the script begins with "+", append this script to the existing
* binding.
*/
-
+
if (script[0] == '+') {
script++;
append = 1;
@@ -192,7 +190,7 @@ Tk_BindObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
} else if (objc == 3) {
- CONST char *command;
+ const char *command;
command = Tk_GetBinding(interp, winPtr->mainPtr->bindingTable,
object, Tcl_GetString(objv[2]));
@@ -212,8 +210,8 @@ Tk_BindObjCmd(clientData, interp, objc, objv)
*
* TkBindEventProc --
*
- * This procedure is invoked by Tk_HandleEvent for each event; it
- * causes any appropriate bindings for that event to be invoked.
+ * This function is invoked by Tk_HandleEvent for each event; it causes
+ * any appropriate bindings for that event to be invoked.
*
* Results:
* None.
@@ -226,9 +224,9 @@ Tk_BindObjCmd(clientData, interp, objc, objv)
*/
void
-TkBindEventProc(winPtr, eventPtr)
- TkWindow *winPtr; /* Pointer to info about window. */
- XEvent *eventPtr; /* Information about event. */
+TkBindEventProc(
+ TkWindow *winPtr, /* Pointer to info about window. */
+ XEvent *eventPtr) /* Information about event. */
{
#define MAX_OBJS 20
ClientData objects[MAX_OBJS], *objPtr;
@@ -244,8 +242,8 @@ TkBindEventProc(winPtr, eventPtr)
objPtr = objects;
if (winPtr->numTags != 0) {
/*
- * Make a copy of the tags for the window, replacing window names
- * with pointers to the pathName from the appropriate window.
+ * Make a copy of the tags for the window, replacing window names with
+ * pointers to the pathName from the appropriate window.
*/
if (winPtr->numTags > MAX_OBJS) {
@@ -293,8 +291,8 @@ TkBindEventProc(winPtr, eventPtr)
*
* Tk_BindtagsObjCmd --
*
- * This procedure is invoked to process the "bindtags" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "bindtags" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -306,18 +304,18 @@ TkBindEventProc(winPtr, eventPtr)
*/
int
-Tk_BindtagsObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_BindtagsObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
TkWindow *winPtr, *winPtr2;
int i, length;
char *p;
Tcl_Obj *listPtr, **tags;
-
+
if ((objc < 2) || (objc > 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "window ?taglist?");
return TCL_ERROR;
@@ -375,9 +373,9 @@ Tk_BindtagsObjCmd(clientData, interp, objc, objv)
/*
* Handle names starting with "." specially: store a malloc'ed
- * string, rather than a Uid; at event time we'll look up the
- * name in the window table and use the corresponding window,
- * if there is one.
+ * string, rather than a Uid; at event time we'll look up the name
+ * in the window table and use the corresponding window, if there
+ * is one.
*/
copy = (char *) ckalloc((unsigned) (strlen(p) + 1));
@@ -395,9 +393,9 @@ Tk_BindtagsObjCmd(clientData, interp, objc, objv)
*
* TkFreeBindingTags --
*
- * This procedure is called to free all of the binding tags
- * associated with a window; typically it is only invoked where
- * there are window-specific tags.
+ * This function is called to free all of the binding tags associated
+ * with a window; typically it is only invoked where there are
+ * window-specific tags.
*
* Results:
* None.
@@ -409,8 +407,8 @@ Tk_BindtagsObjCmd(clientData, interp, objc, objv)
*/
void
-TkFreeBindingTags(winPtr)
- TkWindow *winPtr; /* Window whose tags are to be released. */
+TkFreeBindingTags(
+ TkWindow *winPtr) /* Window whose tags are to be released. */
{
int i;
char *p;
@@ -419,10 +417,10 @@ TkFreeBindingTags(winPtr)
p = (char *) (winPtr->tagPtr[i]);
if (*p == '.') {
/*
- * Names starting with "." are malloced rather than Uids, so
- * they have to be freed.
+ * Names starting with "." are malloced rather than Uids, so they
+ * have to be freed.
*/
-
+
ckfree(p);
}
}
@@ -436,8 +434,8 @@ TkFreeBindingTags(winPtr)
*
* Tk_DestroyObjCmd --
*
- * This procedure is invoked to process the "destroy" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "destroy" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -449,12 +447,11 @@ TkFreeBindingTags(winPtr)
*/
int
-Tk_DestroyObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_DestroyObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window window;
Tk_Window tkwin = (Tk_Window) clientData;
@@ -469,13 +466,12 @@ Tk_DestroyObjCmd(clientData, interp, objc, objv)
Tk_DestroyWindow(window);
if (window == tkwin) {
/*
- * We just deleted the main window for the application! This
- * makes it impossible to do anything more (tkwin isn't
- * valid anymore).
+ * We just deleted the main window for the application! This makes
+ * it impossible to do anything more (tkwin isn't valid anymore).
*/
break;
- }
+ }
}
return TCL_OK;
}
@@ -485,8 +481,8 @@ Tk_DestroyObjCmd(clientData, interp, objc, objv)
*
* Tk_LowerObjCmd --
*
- * This procedure is invoked to process the "lower" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "lower" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -499,12 +495,11 @@ Tk_DestroyObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
int
-Tk_LowerObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_LowerObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window mainwin = (Tk_Window) clientData;
Tk_Window tkwin, other;
@@ -529,7 +524,7 @@ Tk_LowerObjCmd(clientData, interp, objc, objv)
if (Tk_RestackWindow(tkwin, Below, other) != TCL_OK) {
Tcl_AppendResult(interp, "can't lower \"", Tcl_GetString(objv[1]),
"\" below \"", (other ? Tcl_GetString(objv[2]) : ""),
- "\"", (char *) NULL);
+ "\"", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -540,8 +535,8 @@ Tk_LowerObjCmd(clientData, interp, objc, objv)
*
* Tk_RaiseObjCmd --
*
- * This procedure is invoked to process the "raise" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "raise" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -554,12 +549,11 @@ Tk_LowerObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
int
-Tk_RaiseObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_RaiseObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window mainwin = (Tk_Window) clientData;
Tk_Window tkwin, other;
@@ -584,7 +578,7 @@ Tk_RaiseObjCmd(clientData, interp, objc, objv)
if (Tk_RestackWindow(tkwin, Above, other) != TCL_OK) {
Tcl_AppendResult(interp, "can't raise \"", Tcl_GetString(objv[1]),
"\" above \"", (other ? Tcl_GetString(objv[2]) : ""),
- "\"", (char *) NULL);
+ "\"", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -595,8 +589,8 @@ Tk_RaiseObjCmd(clientData, interp, objc, objv)
*
* Tk_TkObjCmd --
*
- * This procedure is invoked to process the "tk" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "tk" Tcl command. See the user
+ * documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -608,21 +602,21 @@ Tk_RaiseObjCmd(clientData, interp, objc, objv)
*/
int
-Tk_TkObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_TkObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int index;
Tk_Window tkwin;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"appname", "caret", "scaling", "useinputmethods",
- "windowingsystem", NULL
+ "windowingsystem", "inactive", NULL
};
enum options {
TK_APPNAME, TK_CARET, TK_SCALING, TK_USE_IM,
- TK_WINDOWINGSYSTEM
+ TK_WINDOWINGSYSTEM, TK_INACTIVE
};
tkwin = (Tk_Window) clientData;
@@ -637,216 +631,257 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case TK_APPNAME: {
- TkWindow *winPtr;
- char *string;
-
- if (Tcl_IsSafe(interp)) {
- Tcl_SetResult(interp,
- "appname not accessible in a safe interpreter",
- TCL_STATIC);
- return TCL_ERROR;
- }
+ case TK_APPNAME: {
+ TkWindow *winPtr;
+ char *string;
+
+ if (Tcl_IsSafe(interp)) {
+ Tcl_SetResult(interp,
+ "appname not accessible in a safe interpreter",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
- winPtr = (TkWindow *) tkwin;
+ winPtr = (TkWindow *) tkwin;
- if (objc > 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "?newName?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- string = Tcl_GetStringFromObj(objv[2], NULL);
- winPtr->nameUid = Tk_GetUid(Tk_SetAppName(tkwin, string));
- }
- Tcl_AppendResult(interp, winPtr->nameUid, NULL);
- break;
+ if (objc > 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?newName?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ string = Tcl_GetString(objv[2]);
+ winPtr->nameUid = Tk_GetUid(Tk_SetAppName(tkwin, string));
+ }
+ Tcl_AppendResult(interp, winPtr->nameUid, NULL);
+ break;
+ }
+ case TK_CARET: {
+ Tcl_Obj *objPtr;
+ TkCaret *caretPtr;
+ Tk_Window window;
+ static const char *caretStrings[] = {
+ "-x", "-y", "-height", NULL
+ };
+ enum caretOptions {
+ TK_CARET_X, TK_CARET_Y, TK_CARET_HEIGHT
+ };
+
+ if ((objc < 3) || ((objc > 4) && !(objc & 1))) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "window ?-x x? ?-y y? ?-height height?");
+ return TCL_ERROR;
}
- case TK_CARET: {
- Tcl_Obj *objPtr;
- TkCaret *caretPtr;
- Tk_Window window;
- static CONST char *caretStrings[]
- = { "-x", "-y", "-height", NULL };
- enum caretOptions
- { TK_CARET_X, TK_CARET_Y, TK_CARET_HEIGHT };
-
- if ((objc < 3) || ((objc > 4) && !(objc & 1))) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "window ?-x x? ?-y y? ?-height height?");
+ window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
+ if (window == NULL) {
+ return TCL_ERROR;
+ }
+ caretPtr = &(((TkWindow *) window)->dispPtr->caret);
+ if (objc == 3) {
+ /*
+ * Return all the current values
+ */
+
+ objPtr = Tcl_NewObj();
+ Tcl_ListObjAppendElement(interp, objPtr,
+ Tcl_NewStringObj("-height", 7));
+ Tcl_ListObjAppendElement(interp, objPtr,
+ Tcl_NewIntObj(caretPtr->height));
+ Tcl_ListObjAppendElement(interp, objPtr,
+ Tcl_NewStringObj("-x", 2));
+ Tcl_ListObjAppendElement(interp, objPtr,
+ Tcl_NewIntObj(caretPtr->x));
+ Tcl_ListObjAppendElement(interp, objPtr,
+ Tcl_NewStringObj("-y", 2));
+ Tcl_ListObjAppendElement(interp, objPtr,
+ Tcl_NewIntObj(caretPtr->y));
+ Tcl_SetObjResult(interp, objPtr);
+ } else if (objc == 4) {
+ int value;
+
+ /*
+ * Return the current value of the selected option
+ */
+
+ if (Tcl_GetIndexFromObj(interp, objv[3], caretStrings,
+ "caret option", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
- window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
- if (window == NULL) {
- return TCL_ERROR;
+ if (index == TK_CARET_X) {
+ value = caretPtr->x;
+ } else if (index == TK_CARET_Y) {
+ value = caretPtr->y;
+ } else /* if (index == TK_CARET_HEIGHT) -- last case */ {
+ value = caretPtr->height;
}
- caretPtr = &(((TkWindow *) window)->dispPtr->caret);
- if (objc == 3) {
- /*
- * Return all the current values
- */
- objPtr = Tcl_NewObj();
- Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewStringObj("-height", 7));
- Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewIntObj(caretPtr->height));
- Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewStringObj("-x", 2));
- Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewIntObj(caretPtr->x));
- Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewStringObj("-y", 2));
- Tcl_ListObjAppendElement(interp, objPtr,
- Tcl_NewIntObj(caretPtr->y));
- Tcl_SetObjResult(interp, objPtr);
- } else if (objc == 4) {
- int value;
- /*
- * Return the current value of the selected option
- */
- if (Tcl_GetIndexFromObj(interp, objv[3], caretStrings,
- "caret option", 0, &index) != TCL_OK) {
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), value);
+ } else {
+ int i, value, x = 0, y = 0, height = -1;
+
+ for (i = 3; i < objc; i += 2) {
+ if ((Tcl_GetIndexFromObj(interp, objv[i], caretStrings,
+ "caret option", 0, &index) != TCL_OK) ||
+ Tcl_GetIntFromObj(interp,objv[i+1],&value) != TCL_OK) {
return TCL_ERROR;
}
if (index == TK_CARET_X) {
- value = caretPtr->x;
+ x = value;
} else if (index == TK_CARET_Y) {
- value = caretPtr->y;
+ y = value;
} else /* if (index == TK_CARET_HEIGHT) -- last case */ {
- value = caretPtr->height;
- }
- Tcl_SetIntObj(Tcl_GetObjResult(interp), value);
- } else {
- int i, value, x = 0, y = 0, height = -1;
-
- for (i = 3; i < objc; i += 2) {
- if ((Tcl_GetIndexFromObj(interp, objv[i], caretStrings,
- "caret option", 0, &index) != TCL_OK) ||
- (Tcl_GetIntFromObj(interp, objv[i+1], &value)
- != TCL_OK)) {
- return TCL_ERROR;
- }
- if (index == TK_CARET_X) {
- x = value;
- } else if (index == TK_CARET_Y) {
- y = value;
- } else /* if (index == TK_CARET_HEIGHT) -- last case */ {
- height = value;
- }
- }
- if (height < 0) {
- height = Tk_Height(window);
+ height = value;
}
- Tk_SetCaretPos(window, x, y, height);
}
- break;
+ if (height < 0) {
+ height = Tk_Height(window);
+ }
+ Tk_SetCaretPos(window, x, y, height);
+ }
+ break;
+ }
+ case TK_SCALING: {
+ Screen *screenPtr;
+ int skip, width, height;
+ double d;
+
+ if (Tcl_IsSafe(interp)) {
+ Tcl_SetResult(interp,
+ "scaling not accessible in a safe interpreter",
+ TCL_STATIC);
+ return TCL_ERROR;
}
- case TK_SCALING: {
- Screen *screenPtr;
- int skip, width, height;
- double d;
- if (Tcl_IsSafe(interp)) {
- Tcl_SetResult(interp,
- "scaling not accessible in a safe interpreter",
- TCL_STATIC);
+ skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
+ }
+ screenPtr = Tk_Screen(tkwin);
+ if (objc - skip == 2) {
+ d = 25.4 / 72;
+ d *= WidthOfScreen(screenPtr);
+ d /= WidthMMOfScreen(screenPtr);
+ Tcl_SetDoubleObj(Tcl_GetObjResult(interp), d);
+ } else if (objc - skip == 3) {
+ if (Tcl_GetDoubleFromObj(interp, objv[2+skip], &d) != TCL_OK) {
return TCL_ERROR;
}
-
- skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
+ d = (25.4 / 72) / d;
+ width = (int) (d * WidthOfScreen(screenPtr) + 0.5);
+ if (width <= 0) {
+ width = 1;
}
- screenPtr = Tk_Screen(tkwin);
- if (objc - skip == 2) {
- d = 25.4 / 72;
- d *= WidthOfScreen(screenPtr);
- d /= WidthMMOfScreen(screenPtr);
- Tcl_SetDoubleObj(Tcl_GetObjResult(interp), d);
- } else if (objc - skip == 3) {
- if (Tcl_GetDoubleFromObj(interp, objv[2+skip], &d) != TCL_OK) {
- return TCL_ERROR;
- }
- d = (25.4 / 72) / d;
- width = (int) (d * WidthOfScreen(screenPtr) + 0.5);
- if (width <= 0) {
- width = 1;
- }
- height = (int) (d * HeightOfScreen(screenPtr) + 0.5);
- if (height <= 0) {
- height = 1;
- }
- WidthMMOfScreen(screenPtr) = width;
- HeightMMOfScreen(screenPtr) = height;
- } else {
- Tcl_WrongNumArgs(interp, 2, objv,
- "?-displayof window? ?factor?");
- return TCL_ERROR;
+ height = (int) (d * HeightOfScreen(screenPtr) + 0.5);
+ if (height <= 0) {
+ height = 1;
}
- break;
+ WidthMMOfScreen(screenPtr) = width;
+ HeightMMOfScreen(screenPtr) = height;
+ } else {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "?-displayof window? ?factor?");
+ return TCL_ERROR;
+ }
+ break;
+ }
+ case TK_USE_IM: {
+ TkDisplay *dispPtr;
+ int skip;
+
+ if (Tcl_IsSafe(interp)) {
+ Tcl_SetResult(interp,
+ "useinputmethods not accessible in a safe interpreter",
+ TCL_STATIC);
+ return TCL_ERROR;
}
- case TK_USE_IM: {
- TkDisplay *dispPtr;
- int skip;
- if (Tcl_IsSafe(interp)) {
- Tcl_SetResult(interp,
- "useinputmethods not accessible in a safe interpreter",
- TCL_STATIC);
- return TCL_ERROR;
- }
+ skip = TkGetDisplayOf(interp, objc-2, objv+2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
+ }
+ dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ if ((objc - skip) == 3) {
+ /*
+ * In the case where TK_USE_INPUT_METHODS is not defined, this
+ * will be ignored and we will always return 0. That will indicate
+ * to the user that input methods are just not available.
+ */
- skip = TkGetDisplayOf(interp, objc-2, objv+2, &tkwin);
- if (skip < 0) {
+ int boolVal;
+
+ if (Tcl_GetBooleanFromObj(interp, objv[2+skip],
+ &boolVal) != TCL_OK) {
return TCL_ERROR;
}
- dispPtr = ((TkWindow *) tkwin)->dispPtr;
- if ((objc - skip) == 3) {
- /*
- * In the case where TK_USE_INPUT_METHODS is not defined,
- * this will be ignored and we will always return 0.
- * That will indicate to the user that input methods
- * are just not available.
- */
- int boolVal;
- if (Tcl_GetBooleanFromObj(interp, objv[2+skip], &boolVal)
- != TCL_OK) {
- return TCL_ERROR;
- }
#ifdef TK_USE_INPUT_METHODS
- if (boolVal) {
- dispPtr->flags |= TK_DISPLAY_USE_IM;
- } else {
- dispPtr->flags &= ~TK_DISPLAY_USE_IM;
- }
-#endif /* TK_USE_INPUT_METHODS */
- } else if ((objc - skip) != 2) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "?-displayof window? ?boolean?");
- return TCL_ERROR;
+ if (boolVal) {
+ dispPtr->flags |= TK_DISPLAY_USE_IM;
+ } else {
+ dispPtr->flags &= ~TK_DISPLAY_USE_IM;
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp),
- (int) (dispPtr->flags & TK_DISPLAY_USE_IM));
- break;
+#endif /* TK_USE_INPUT_METHODS */
+ } else if ((objc - skip) != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "?-displayof window? ?boolean?");
+ return TCL_ERROR;
+ }
+ Tcl_SetBooleanObj(Tcl_GetObjResult(interp),
+ (int) (dispPtr->flags & TK_DISPLAY_USE_IM));
+ break;
+ }
+ case TK_WINDOWINGSYSTEM: {
+ const char *windowingsystem;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ return TCL_ERROR;
}
- case TK_WINDOWINGSYSTEM: {
- CONST char *windowingsystem;
-
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, NULL);
- return TCL_ERROR;
- }
#if defined(WIN32)
- windowingsystem = "win32";
-#elif defined(MAC_TCL)
- windowingsystem = "classic";
+ windowingsystem = "win32";
#elif defined(MAC_OSX_TK)
- windowingsystem = "aqua";
+ windowingsystem = "aqua";
#else
- windowingsystem = "x11";
+ windowingsystem = "x11";
#endif
- Tcl_SetStringObj(Tcl_GetObjResult(interp), windowingsystem, -1);
- break;
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), windowingsystem, -1);
+ break;
+ }
+ case TK_INACTIVE: {
+ int skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+
+ if (skip < 0) {
+ return TCL_ERROR;
+ }
+ if (objc - skip == 2) {
+ long inactive;
+
+ inactive = (Tcl_IsSafe(interp) ? -1 :
+ Tk_GetUserInactiveTime(Tk_Display(tkwin)));
+ Tcl_SetObjResult(interp, Tcl_NewLongObj(inactive));
+
+ } else if (objc - skip == 3) {
+ char *string;
+
+ string = Tcl_GetString(objv[objc-1]);
+ if (strcmp(string, "reset") != 0) {
+ Tcl_Obj *msg = Tcl_NewStringObj("bad option \"", -1);
+
+ Tcl_AppendStringsToObj(msg, string, "\": must be reset", NULL);
+ Tcl_SetObjResult(interp, msg);
+ return TCL_ERROR;
+ }
+ if (Tcl_IsSafe(interp)) {
+ Tcl_SetResult(interp,
+ "resetting the user inactivity timer "
+ "is not allowed in a safe interpreter", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ Tk_ResetUserInactiveTime(Tk_Display(tkwin));
+ Tcl_ResetResult(interp);
+ } else {
+ Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? ?reset?");
+ return TCL_ERROR;
}
+ break;
+ }
}
return TCL_OK;
}
@@ -856,8 +891,8 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
*
* Tk_TkwaitObjCmd --
*
- * This procedure is invoked to process the "tkwait" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "tkwait" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -870,19 +905,21 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
int
-Tk_TkwaitObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_TkwaitObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
int done, index;
- static CONST char *optionStrings[] = { "variable", "visibility", "window",
- (char *) NULL };
- enum options { TKWAIT_VARIABLE, TKWAIT_VISIBILITY, TKWAIT_WINDOW };
-
+ static const char *optionStrings[] = {
+ "variable", "visibility", "window", NULL
+ };
+ enum options {
+ TKWAIT_VARIABLE, TKWAIT_VISIBILITY, TKWAIT_WINDOW
+ };
+
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "variable|visibility|window name");
return TCL_ERROR;
@@ -894,78 +931,78 @@ Tk_TkwaitObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case TKWAIT_VARIABLE: {
- if (Tcl_TraceVar(interp, Tcl_GetString(objv[2]),
- TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- WaitVariableProc, (ClientData) &done) != TCL_OK) {
- return TCL_ERROR;
- }
- done = 0;
- while (!done) {
- Tcl_DoOneEvent(0);
- }
- Tcl_UntraceVar(interp, Tcl_GetString(objv[2]),
- TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- WaitVariableProc, (ClientData) &done);
- break;
+ case TKWAIT_VARIABLE:
+ if (Tcl_TraceVar(interp, Tcl_GetString(objv[2]),
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ WaitVariableProc, (ClientData) &done) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ done = 0;
+ while (!done) {
+ Tcl_DoOneEvent(0);
}
-
- case TKWAIT_VISIBILITY: {
- Tk_Window window;
+ Tcl_UntraceVar(interp, Tcl_GetString(objv[2]),
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ WaitVariableProc, (ClientData) &done);
+ break;
- window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
- if (window == NULL) {
- return TCL_ERROR;
- }
- Tk_CreateEventHandler(window,
- VisibilityChangeMask|StructureNotifyMask,
- WaitVisibilityProc, (ClientData) &done);
- done = 0;
- while (!done) {
- Tcl_DoOneEvent(0);
- }
- if (done != 1) {
- /*
- * Note that we do not delete the event handler because it
- * was deleted automatically when the window was destroyed.
- */
-
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "window \"", Tcl_GetString(objv[2]),
- "\" was deleted before its visibility changed",
- (char *) NULL);
- return TCL_ERROR;
- }
- Tk_DeleteEventHandler(window,
- VisibilityChangeMask|StructureNotifyMask,
- WaitVisibilityProc, (ClientData) &done);
- break;
+ case TKWAIT_VISIBILITY: {
+ Tk_Window window;
+
+ window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
+ if (window == NULL) {
+ return TCL_ERROR;
}
-
- case TKWAIT_WINDOW: {
- Tk_Window window;
-
- window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
- if (window == NULL) {
- return TCL_ERROR;
- }
- Tk_CreateEventHandler(window, StructureNotifyMask,
- WaitWindowProc, (ClientData) &done);
- done = 0;
- while (!done) {
- Tcl_DoOneEvent(0);
- }
+ Tk_CreateEventHandler(window,
+ VisibilityChangeMask|StructureNotifyMask,
+ WaitVisibilityProc, (ClientData) &done);
+ done = 0;
+ while (!done) {
+ Tcl_DoOneEvent(0);
+ }
+ if (done != 1) {
/*
- * Note: there's no need to delete the event handler. It was
+ * Note that we do not delete the event handler because it was
* deleted automatically when the window was destroyed.
*/
- break;
+
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "window \"", Tcl_GetString(objv[2]),
+ "\" was deleted before its visibility changed", NULL);
+ return TCL_ERROR;
}
+ Tk_DeleteEventHandler(window,
+ VisibilityChangeMask|StructureNotifyMask,
+ WaitVisibilityProc, (ClientData) &done);
+ break;
+ }
+
+ case TKWAIT_WINDOW: {
+ Tk_Window window;
+
+ window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
+ if (window == NULL) {
+ return TCL_ERROR;
+ }
+ Tk_CreateEventHandler(window, StructureNotifyMask,
+ WaitWindowProc, (ClientData) &done);
+ done = 0;
+ while (!done) {
+ Tcl_DoOneEvent(0);
+ }
+
+ /*
+ * Note: there's no need to delete the event handler. It was deleted
+ * automatically when the window was destroyed.
+ */
+
+ break;
+ }
}
/*
- * Clear out the interpreter's result, since it may have been set
- * by event handlers.
+ * Clear out the interpreter's result, since it may have been set by event
+ * handlers.
*/
Tcl_ResetResult(interp);
@@ -974,24 +1011,24 @@ Tk_TkwaitObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
static char *
-WaitVariableProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Pointer to integer to set to 1. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Name of variable. */
- CONST char *name2; /* Second part of variable name. */
- int flags; /* Information about what happened. */
+WaitVariableProc(
+ ClientData clientData, /* Pointer to integer to set to 1. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ const char *name1, /* Name of variable. */
+ const char *name2, /* Second part of variable name. */
+ int flags) /* Information about what happened. */
{
int *donePtr = (int *) clientData;
*donePtr = 1;
- return (char *) NULL;
+ return NULL;
}
/*ARGSUSED*/
static void
-WaitVisibilityProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to integer to set to 1. */
- XEvent *eventPtr; /* Information about event (not used). */
+WaitVisibilityProc(
+ ClientData clientData, /* Pointer to integer to set to 1. */
+ XEvent *eventPtr) /* Information about event (not used). */
{
int *donePtr = (int *) clientData;
@@ -1004,9 +1041,9 @@ WaitVisibilityProc(clientData, eventPtr)
}
static void
-WaitWindowProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to integer to set to 1. */
- XEvent *eventPtr; /* Information about event. */
+WaitWindowProc(
+ ClientData clientData, /* Pointer to integer to set to 1. */
+ XEvent *eventPtr) /* Information about event. */
{
int *donePtr = (int *) clientData;
@@ -1020,8 +1057,8 @@ WaitWindowProc(clientData, eventPtr)
*
* Tk_UpdateObjCmd --
*
- * This procedure is invoked to process the "update" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "update" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1034,14 +1071,13 @@ WaitWindowProc(clientData, eventPtr)
/* ARGSUSED */
int
-Tk_UpdateObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_UpdateObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *updateOptions[] = {"idletasks", (char *) NULL};
+ static const char *updateOptions[] = {"idletasks", NULL};
int flags, index;
TkDisplay *dispPtr;
@@ -1054,19 +1090,18 @@ Tk_UpdateObjCmd(clientData, interp, objc, objv)
}
flags = TCL_IDLE_EVENTS;
} else {
- Tcl_WrongNumArgs(interp, 1, objv, "?idletasks?");
+ Tcl_WrongNumArgs(interp, 1, objv, "?idletasks?");
return TCL_ERROR;
}
/*
- * Handle all pending events, sync all displays, and repeat over
- * and over again until all pending events have been handled.
- * Special note: it's possible that the entire application could
- * be destroyed by an event handler that occurs during the update.
- * Thus, don't use any information from tkwin after calling
- * Tcl_DoOneEvent.
+ * Handle all pending events, sync all displays, and repeat over and over
+ * again until all pending events have been handled. Special note: it's
+ * possible that the entire application could be destroyed by an event
+ * handler that occurs during the update. Thus, don't use any information
+ * from tkwin after calling Tcl_DoOneEvent.
*/
-
+
while (1) {
while (Tcl_DoOneEvent(flags) != 0) {
/* Empty loop body */
@@ -1081,8 +1116,8 @@ Tk_UpdateObjCmd(clientData, interp, objc, objv)
}
/*
- * Must clear the interpreter's result because event handlers could
- * have executed commands.
+ * Must clear the interpreter's result because event handlers could have
+ * executed commands.
*/
Tcl_ResetResult(interp);
@@ -1094,8 +1129,8 @@ Tk_UpdateObjCmd(clientData, interp, objc, objv)
*
* Tk_WinfoObjCmd --
*
- * This procedure is invoked to process the "winfo" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "winfo" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1107,12 +1142,11 @@ Tk_UpdateObjCmd(clientData, interp, objc, objv)
*/
int
-Tk_WinfoObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_WinfoObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int index, x, y, width, height, useX, useY, class, skip;
char *string;
@@ -1120,7 +1154,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
Tk_Window tkwin;
Tcl_Obj *resultPtr;
- static TkStateMap visualMap[] = {
+ static const TkStateMap visualMap[] = {
{PseudoColor, "pseudocolor"},
{GrayScale, "grayscale"},
{DirectColor, "directcolor"},
@@ -1129,7 +1163,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
{StaticGray, "staticgray"},
{-1, NULL}
};
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"cells", "children", "class", "colormapfull",
"depth", "geometry", "height", "id",
"ismapped", "manager", "name", "parent",
@@ -1140,7 +1174,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
"toplevel", "viewable", "visual", "visualid",
"vrootheight", "vrootwidth", "vrootx", "vrooty",
"width", "x", "y",
-
+
"atom", "atomname", "containing", "interps",
"pathname",
@@ -1160,7 +1194,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
WIN_TOPLEVEL, WIN_VIEWABLE, WIN_VISUAL, WIN_VISUALID,
WIN_VROOTHEIGHT,WIN_VROOTWIDTH, WIN_VROOTX, WIN_VROOTY,
WIN_WIDTH, WIN_X, WIN_Y,
-
+
WIN_ATOM, WIN_ATOMNAME, WIN_CONTAINING, WIN_INTERPS,
WIN_PATHNAME,
@@ -1169,7 +1203,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
};
tkwin = (Tk_Window) clientData;
-
+
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?");
return TCL_ERROR;
@@ -1184,7 +1218,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- string = Tcl_GetStringFromObj(objv[2], NULL);
+ string = Tcl_GetString(objv[2]);
tkwin = Tk_NameToWindow(interp, string, tkwin);
if (tkwin == NULL) {
return TCL_ERROR;
@@ -1194,502 +1228,468 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
resultPtr = Tcl_GetObjResult(interp);
switch ((enum options) index) {
- case WIN_CELLS: {
- Tcl_SetIntObj(resultPtr, Tk_Visual(tkwin)->map_entries);
- break;
- }
- case WIN_CHILDREN: {
- Tcl_Obj *strPtr;
-
- winPtr = winPtr->childList;
- for ( ; winPtr != NULL; winPtr = winPtr->nextPtr) {
- if (!(winPtr->flags & TK_ANONYMOUS_WINDOW)) {
- strPtr = Tcl_NewStringObj(winPtr->pathName, -1);
- Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
- }
+ case WIN_CELLS:
+ Tcl_SetIntObj(resultPtr, Tk_Visual(tkwin)->map_entries);
+ break;
+ case WIN_CHILDREN: {
+ Tcl_Obj *strPtr;
+
+ winPtr = winPtr->childList;
+ for ( ; winPtr != NULL; winPtr = winPtr->nextPtr) {
+ if (!(winPtr->flags & TK_ANONYMOUS_WINDOW)) {
+ strPtr = Tcl_NewStringObj(winPtr->pathName, -1);
+ Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
}
- break;
- }
- case WIN_CLASS: {
- Tcl_SetStringObj(resultPtr, Tk_Class(tkwin), -1);
- break;
- }
- case WIN_COLORMAPFULL: {
- Tcl_SetBooleanObj(resultPtr,
- TkpCmapStressed(tkwin, Tk_Colormap(tkwin)));
- break;
}
- case WIN_DEPTH: {
- Tcl_SetIntObj(resultPtr, Tk_Depth(tkwin));
- break;
- }
- case WIN_GEOMETRY: {
- char buf[16 + TCL_INTEGER_SPACE * 4];
+ break;
+ }
+ case WIN_CLASS:
+ Tcl_SetStringObj(resultPtr, Tk_Class(tkwin), -1);
+ break;
+ case WIN_COLORMAPFULL:
+ Tcl_SetBooleanObj(resultPtr,
+ TkpCmapStressed(tkwin, Tk_Colormap(tkwin)));
+ break;
+ case WIN_DEPTH:
+ Tcl_SetIntObj(resultPtr, Tk_Depth(tkwin));
+ break;
+ case WIN_GEOMETRY: {
+ char buf[16 + TCL_INTEGER_SPACE * 4];
+
+ sprintf(buf, "%dx%d+%d+%d", Tk_Width(tkwin), Tk_Height(tkwin),
+ Tk_X(tkwin), Tk_Y(tkwin));
+ Tcl_SetStringObj(resultPtr, buf, -1);
+ break;
+ }
+ case WIN_HEIGHT:
+ Tcl_SetIntObj(resultPtr, Tk_Height(tkwin));
+ break;
+ case WIN_ID: {
+ char buf[TCL_INTEGER_SPACE];
- sprintf(buf, "%dx%d+%d+%d", Tk_Width(tkwin), Tk_Height(tkwin),
- Tk_X(tkwin), Tk_Y(tkwin));
- Tcl_SetStringObj(resultPtr, buf, -1);
- break;
- }
- case WIN_HEIGHT: {
- Tcl_SetIntObj(resultPtr, Tk_Height(tkwin));
- break;
+ Tk_MakeWindowExist(tkwin);
+ TkpPrintWindowId(buf, Tk_WindowId(tkwin));
+
+ /*
+ * interp result may have changed, refetch it
+ */
+
+ resultPtr = Tcl_GetObjResult(interp);
+ Tcl_SetStringObj(resultPtr, buf, -1);
+ break;
+ }
+ case WIN_ISMAPPED:
+ Tcl_SetBooleanObj(resultPtr, (int) Tk_IsMapped(tkwin));
+ break;
+ case WIN_MANAGER:
+ if (winPtr->geomMgrPtr != NULL) {
+ Tcl_SetStringObj(resultPtr, winPtr->geomMgrPtr->name, -1);
+ }
+ break;
+ case WIN_NAME:
+ Tcl_SetStringObj(resultPtr, Tk_Name(tkwin), -1);
+ break;
+ case WIN_PARENT:
+ if (winPtr->parentPtr != NULL) {
+ Tcl_SetStringObj(resultPtr, winPtr->parentPtr->pathName, -1);
+ }
+ break;
+ case WIN_POINTERX:
+ useX = 1;
+ useY = 0;
+ goto pointerxy;
+ case WIN_POINTERY:
+ useX = 0;
+ useY = 1;
+ goto pointerxy;
+ case WIN_POINTERXY:
+ useX = 1;
+ useY = 1;
+
+ pointerxy:
+ winPtr = GetTopHierarchy(tkwin);
+ if (winPtr == NULL) {
+ x = -1;
+ y = -1;
+ } else {
+ TkGetPointerCoords((Tk_Window) winPtr, &x, &y);
}
- case WIN_ID: {
- char buf[TCL_INTEGER_SPACE];
-
- Tk_MakeWindowExist(tkwin);
- TkpPrintWindowId(buf, Tk_WindowId(tkwin));
- /*
- * interp result may have changed, refetch it
- */
- resultPtr = Tcl_GetObjResult(interp);
+ if (useX & useY) {
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ sprintf(buf, "%d %d", x, y);
Tcl_SetStringObj(resultPtr, buf, -1);
- break;
- }
- case WIN_ISMAPPED: {
- Tcl_SetBooleanObj(resultPtr, (int) Tk_IsMapped(tkwin));
- break;
- }
- case WIN_MANAGER: {
- if (winPtr->geomMgrPtr != NULL) {
- Tcl_SetStringObj(resultPtr, winPtr->geomMgrPtr->name, -1);
- }
- break;
- }
- case WIN_NAME: {
- Tcl_SetStringObj(resultPtr, Tk_Name(tkwin), -1);
- break;
- }
- case WIN_PARENT: {
- if (winPtr->parentPtr != NULL) {
- Tcl_SetStringObj(resultPtr, winPtr->parentPtr->pathName, -1);
- }
- break;
+ } else if (useX) {
+ Tcl_SetIntObj(resultPtr, x);
+ } else {
+ Tcl_SetIntObj(resultPtr, y);
}
- case WIN_POINTERX: {
- useX = 1;
- useY = 0;
- goto pointerxy;
- }
- case WIN_POINTERY: {
- useX = 0;
- useY = 1;
- goto pointerxy;
- }
- case WIN_POINTERXY: {
- useX = 1;
- useY = 1;
-
- pointerxy:
- winPtr = GetToplevel(tkwin);
- if (winPtr == NULL) {
- x = -1;
- y = -1;
- } else {
- TkGetPointerCoords((Tk_Window) winPtr, &x, &y);
+ break;
+ case WIN_REQHEIGHT:
+ Tcl_SetIntObj(resultPtr, Tk_ReqHeight(tkwin));
+ break;
+ case WIN_REQWIDTH:
+ Tcl_SetIntObj(resultPtr, Tk_ReqWidth(tkwin));
+ break;
+ case WIN_ROOTX:
+ Tk_GetRootCoords(tkwin, &x, &y);
+ Tcl_SetIntObj(resultPtr, x);
+ break;
+ case WIN_ROOTY:
+ Tk_GetRootCoords(tkwin, &x, &y);
+ Tcl_SetIntObj(resultPtr, y);
+ break;
+ case WIN_SCREEN: {
+ char buf[TCL_INTEGER_SPACE];
+
+ sprintf(buf, "%d", Tk_ScreenNumber(tkwin));
+ Tcl_AppendStringsToObj(resultPtr, Tk_DisplayName(tkwin),".",buf, NULL);
+ break;
+ }
+ case WIN_SCREENCELLS:
+ Tcl_SetIntObj(resultPtr, CellsOfScreen(Tk_Screen(tkwin)));
+ break;
+ case WIN_SCREENDEPTH:
+ Tcl_SetIntObj(resultPtr, DefaultDepthOfScreen(Tk_Screen(tkwin)));
+ break;
+ case WIN_SCREENHEIGHT:
+ Tcl_SetIntObj(resultPtr, HeightOfScreen(Tk_Screen(tkwin)));
+ break;
+ case WIN_SCREENWIDTH:
+ Tcl_SetIntObj(resultPtr, WidthOfScreen(Tk_Screen(tkwin)));
+ break;
+ case WIN_SCREENMMHEIGHT:
+ Tcl_SetIntObj(resultPtr, HeightMMOfScreen(Tk_Screen(tkwin)));
+ break;
+ case WIN_SCREENMMWIDTH:
+ Tcl_SetIntObj(resultPtr, WidthMMOfScreen(Tk_Screen(tkwin)));
+ break;
+ case WIN_SCREENVISUAL:
+ class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class;
+ goto visual;
+ case WIN_SERVER:
+ TkGetServerInfo(interp, tkwin);
+ break;
+ case WIN_TOPLEVEL:
+ winPtr = GetTopHierarchy(tkwin);
+ if (winPtr != NULL) {
+ Tcl_SetStringObj(resultPtr, winPtr->pathName, -1);
+ }
+ break;
+ case WIN_VIEWABLE: {
+ int viewable = 0;
+
+ for ( ; ; winPtr = winPtr->parentPtr) {
+ if ((winPtr == NULL) || !(winPtr->flags & TK_MAPPED)) {
+ break;
}
- if (useX & useY) {
- char buf[TCL_INTEGER_SPACE * 2];
-
- sprintf(buf, "%d %d", x, y);
- Tcl_SetStringObj(resultPtr, buf, -1);
- } else if (useX) {
- Tcl_SetIntObj(resultPtr, x);
- } else {
- Tcl_SetIntObj(resultPtr, y);
+ if (winPtr->flags & TK_TOP_HIERARCHY) {
+ viewable = 1;
+ break;
}
- break;
}
- case WIN_REQHEIGHT: {
- Tcl_SetIntObj(resultPtr, Tk_ReqHeight(tkwin));
- break;
- }
- case WIN_REQWIDTH: {
- Tcl_SetIntObj(resultPtr, Tk_ReqWidth(tkwin));
- break;
- }
- case WIN_ROOTX: {
- Tk_GetRootCoords(tkwin, &x, &y);
- Tcl_SetIntObj(resultPtr, x);
- break;
- }
- case WIN_ROOTY: {
- Tk_GetRootCoords(tkwin, &x, &y);
- Tcl_SetIntObj(resultPtr, y);
- break;
+
+ Tcl_SetBooleanObj(resultPtr, viewable);
+ break;
+ }
+ case WIN_VISUAL:
+ class = Tk_Visual(tkwin)->class;
+
+ visual:
+ string = TkFindStateString(visualMap, class);
+ if (string == NULL) {
+ string = "unknown";
+ }
+ Tcl_SetStringObj(resultPtr, string, -1);
+ break;
+ case WIN_VISUALID: {
+ char buf[TCL_INTEGER_SPACE];
+
+ sprintf(buf, "0x%x",
+ (unsigned int) XVisualIDFromVisual(Tk_Visual(tkwin)));
+ Tcl_SetStringObj(resultPtr, buf, -1);
+ break;
+ }
+ case WIN_VROOTHEIGHT:
+ Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
+ Tcl_SetIntObj(resultPtr, height);
+ break;
+ case WIN_VROOTWIDTH:
+ Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
+ Tcl_SetIntObj(resultPtr, width);
+ break;
+ case WIN_VROOTX:
+ Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
+ Tcl_SetIntObj(resultPtr, x);
+ break;
+ case WIN_VROOTY:
+ Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
+ Tcl_SetIntObj(resultPtr, y);
+ break;
+ case WIN_WIDTH:
+ Tcl_SetIntObj(resultPtr, Tk_Width(tkwin));
+ break;
+ case WIN_X:
+ Tcl_SetIntObj(resultPtr, Tk_X(tkwin));
+ break;
+ case WIN_Y:
+ Tcl_SetIntObj(resultPtr, Tk_Y(tkwin));
+ break;
+
+ /*
+ * Uses -displayof.
+ */
+
+ case WIN_ATOM:
+ skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
}
- case WIN_SCREEN: {
- char buf[TCL_INTEGER_SPACE];
-
- sprintf(buf, "%d", Tk_ScreenNumber(tkwin));
- Tcl_AppendStringsToObj(resultPtr, Tk_DisplayName(tkwin), ".",
- buf, NULL);
- break;
+ if (objc - skip != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? name");
+ return TCL_ERROR;
}
- case WIN_SCREENCELLS: {
- Tcl_SetIntObj(resultPtr, CellsOfScreen(Tk_Screen(tkwin)));
- break;
+ objv += skip;
+ string = Tcl_GetString(objv[2]);
+ Tcl_SetLongObj(resultPtr, (long) Tk_InternAtom(tkwin, string));
+ break;
+ case WIN_ATOMNAME: {
+ const char *name;
+ long id;
+
+ skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
}
- case WIN_SCREENDEPTH: {
- Tcl_SetIntObj(resultPtr, DefaultDepthOfScreen(Tk_Screen(tkwin)));
- break;
+ if (objc - skip != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id");
+ return TCL_ERROR;
}
- case WIN_SCREENHEIGHT: {
- Tcl_SetIntObj(resultPtr, HeightOfScreen(Tk_Screen(tkwin)));
- break;
+ objv += skip;
+ if (Tcl_GetLongFromObj(interp, objv[2], &id) != TCL_OK) {
+ return TCL_ERROR;
}
- case WIN_SCREENWIDTH: {
- Tcl_SetIntObj(resultPtr, WidthOfScreen(Tk_Screen(tkwin)));
- break;
+ name = Tk_GetAtomName(tkwin, (Atom) id);
+ if (strcmp(name, "?bad atom?") == 0) {
+ string = Tcl_GetString(objv[2]);
+ Tcl_AppendStringsToObj(resultPtr,
+ "no atom exists with id \"", string, "\"", NULL);
+ return TCL_ERROR;
}
- case WIN_SCREENMMHEIGHT: {
- Tcl_SetIntObj(resultPtr, HeightMMOfScreen(Tk_Screen(tkwin)));
- break;
+ Tcl_SetStringObj(resultPtr, name, -1);
+ break;
+ }
+ case WIN_CONTAINING:
+ skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
}
- case WIN_SCREENMMWIDTH: {
- Tcl_SetIntObj(resultPtr, WidthMMOfScreen(Tk_Screen(tkwin)));
- break;
+ if (objc - skip != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "?-displayof window? rootX rootY");
+ return TCL_ERROR;
}
- case WIN_SCREENVISUAL: {
- class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class;
- goto visual;
+ objv += skip;
+ string = Tcl_GetString(objv[2]);
+ if (Tk_GetPixels(interp, tkwin, string, &x) != TCL_OK) {
+ return TCL_ERROR;
}
- case WIN_SERVER: {
- TkGetServerInfo(interp, tkwin);
- break;
+ string = Tcl_GetString(objv[3]);
+ if (Tk_GetPixels(interp, tkwin, string, &y) != TCL_OK) {
+ return TCL_ERROR;
}
- case WIN_TOPLEVEL: {
- winPtr = GetToplevel(tkwin);
- if (winPtr != NULL) {
- Tcl_SetStringObj(resultPtr, winPtr->pathName, -1);
- }
- break;
+ tkwin = Tk_CoordsToWindow(x, y, tkwin);
+ if (tkwin != NULL) {
+ Tcl_SetStringObj(resultPtr, Tk_PathName(tkwin), -1);
}
- case WIN_VIEWABLE: {
- int viewable = 0;
- for ( ; ; winPtr = winPtr->parentPtr) {
- if ((winPtr == NULL) || !(winPtr->flags & TK_MAPPED)) {
- break;
- }
- if (winPtr->flags & TK_TOP_HIERARCHY) {
- viewable = 1;
- break;
- }
- }
+ break;
+ case WIN_INTERPS: {
+ int result;
- Tcl_SetBooleanObj(resultPtr, viewable);
- break;
+ skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
}
- case WIN_VISUAL: {
- class = Tk_Visual(tkwin)->class;
-
- visual:
- string = TkFindStateString(visualMap, class);
- if (string == NULL) {
- string = "unknown";
- }
- Tcl_SetStringObj(resultPtr, string, -1);
- break;
+ if (objc - skip != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
+ return TCL_ERROR;
}
- case WIN_VISUALID: {
- char buf[TCL_INTEGER_SPACE];
+ result = TkGetInterpNames(interp, tkwin);
+ return result;
+ }
+ case WIN_PATHNAME: {
+ Window id;
- sprintf(buf, "0x%x",
- (unsigned int) XVisualIDFromVisual(Tk_Visual(tkwin)));
- Tcl_SetStringObj(resultPtr, buf, -1);
- break;
- }
- case WIN_VROOTHEIGHT: {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetIntObj(resultPtr, height);
- break;
- }
- case WIN_VROOTWIDTH: {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetIntObj(resultPtr, width);
- break;
- }
- case WIN_VROOTX: {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetIntObj(resultPtr, x);
- break;
- }
- case WIN_VROOTY: {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- Tcl_SetIntObj(resultPtr, y);
- break;
+ skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
}
- case WIN_WIDTH: {
- Tcl_SetIntObj(resultPtr, Tk_Width(tkwin));
- break;
+ if (objc - skip != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id");
+ return TCL_ERROR;
}
- case WIN_X: {
- Tcl_SetIntObj(resultPtr, Tk_X(tkwin));
- break;
+ string = Tcl_GetString(objv[2 + skip]);
+ if (TkpScanWindowId(interp, string, &id) != TCL_OK) {
+ return TCL_ERROR;
}
- case WIN_Y: {
- Tcl_SetIntObj(resultPtr, Tk_Y(tkwin));
- break;
+ winPtr = (TkWindow *)Tk_IdToWindow(Tk_Display(tkwin), id);
+ if ((winPtr == NULL) ||
+ (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr)) {
+ Tcl_AppendStringsToObj(resultPtr, "window id \"", string,
+ "\" doesn't exist in this application", NULL);
+ return TCL_ERROR;
}
/*
- * Uses -displayof.
+ * If the window is a utility window with no associated path (such as
+ * a wrapper window or send communication window), just return an
+ * empty string.
*/
-
- case WIN_ATOM: {
- skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if (objc - skip != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? name");
- return TCL_ERROR;
- }
- objv += skip;
- string = Tcl_GetStringFromObj(objv[2], NULL);
- Tcl_SetLongObj(resultPtr, (long) Tk_InternAtom(tkwin, string));
- break;
- }
- case WIN_ATOMNAME: {
- CONST char *name;
- long id;
-
- skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if (objc - skip != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id");
- return TCL_ERROR;
- }
- objv += skip;
- if (Tcl_GetLongFromObj(interp, objv[2], &id) != TCL_OK) {
- return TCL_ERROR;
- }
- name = Tk_GetAtomName(tkwin, (Atom) id);
- if (strcmp(name, "?bad atom?") == 0) {
- string = Tcl_GetStringFromObj(objv[2], NULL);
- Tcl_AppendStringsToObj(resultPtr,
- "no atom exists with id \"", string, "\"", NULL);
- return TCL_ERROR;
- }
- Tcl_SetStringObj(resultPtr, name, -1);
- break;
- }
- case WIN_CONTAINING: {
- skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if (objc - skip != 4) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "?-displayof window? rootX rootY");
- return TCL_ERROR;
- }
- objv += skip;
- string = Tcl_GetStringFromObj(objv[2], NULL);
- if (Tk_GetPixels(interp, tkwin, string, &x) != TCL_OK) {
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[3], NULL);
- if (Tk_GetPixels(interp, tkwin, string, &y) != TCL_OK) {
- return TCL_ERROR;
- }
- tkwin = Tk_CoordsToWindow(x, y, tkwin);
- if (tkwin != NULL) {
- Tcl_SetStringObj(resultPtr, Tk_PathName(tkwin), -1);
- }
- break;
- }
- case WIN_INTERPS: {
- int result;
-
- skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if (objc - skip != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
- return TCL_ERROR;
- }
- result = TkGetInterpNames(interp, tkwin);
- return result;
- }
- case WIN_PATHNAME: {
- Window id;
- skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if (objc - skip != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id");
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[2 + skip], NULL);
- if (TkpScanWindowId(interp, string, &id) != TCL_OK) {
- return TCL_ERROR;
- }
- winPtr = (TkWindow *)Tk_IdToWindow(Tk_Display(tkwin), id);
- if ((winPtr == NULL) ||
- (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr)) {
- Tcl_AppendStringsToObj(resultPtr, "window id \"", string,
- "\" doesn't exist in this application", (char *) NULL);
- return TCL_ERROR;
- }
-
- /*
- * If the window is a utility window with no associated path
- * (such as a wrapper window or send communication window), just
- * return an empty string.
- */
-
- tkwin = (Tk_Window) winPtr;
- if (Tk_PathName(tkwin) != NULL) {
- Tcl_SetStringObj(resultPtr, Tk_PathName(tkwin), -1);
- }
- break;
+ tkwin = (Tk_Window) winPtr;
+ if (Tk_PathName(tkwin) != NULL) {
+ Tcl_SetStringObj(resultPtr, Tk_PathName(tkwin), -1);
}
+ break;
+ }
/*
* objv[3] is window.
*/
- case WIN_EXISTS: {
- int alive;
+ case WIN_EXISTS: {
+ int alive;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window");
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[2], NULL);
- winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin);
- Tcl_ResetResult(interp);
- resultPtr = Tcl_GetObjResult(interp);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window");
+ return TCL_ERROR;
+ }
+ string = Tcl_GetString(objv[2]);
+ winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin);
+ Tcl_ResetResult(interp);
+ resultPtr = Tcl_GetObjResult(interp);
- alive = 1;
- if ((winPtr == NULL) || (winPtr->flags & TK_ALREADY_DEAD)) {
- alive = 0;
- }
- Tcl_SetBooleanObj(resultPtr, alive);
- break;
+ alive = 1;
+ if ((winPtr == NULL) || (winPtr->flags & TK_ALREADY_DEAD)) {
+ alive = 0;
}
- case WIN_FPIXELS: {
- double mm, pixels;
+ Tcl_SetBooleanObj(resultPtr, alive);
+ break;
+ }
+ case WIN_FPIXELS: {
+ double mm, pixels;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "window number");
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[2], NULL);
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[3], NULL);
- if (Tk_GetScreenMM(interp, tkwin, string, &mm) != TCL_OK) {
- return TCL_ERROR;
- }
- pixels = mm * WidthOfScreen(Tk_Screen(tkwin))
- / WidthMMOfScreen(Tk_Screen(tkwin));
- Tcl_SetDoubleObj(resultPtr, pixels);
- break;
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window number");
+ return TCL_ERROR;
}
- case WIN_PIXELS: {
- int pixels;
-
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "window number");
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[2], NULL);
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[3], NULL);
- if (Tk_GetPixels(interp, tkwin, string, &pixels) != TCL_OK) {
- return TCL_ERROR;
- }
- Tcl_SetIntObj(resultPtr, pixels);
- break;
+ string = Tcl_GetString(objv[2]);
+ tkwin = Tk_NameToWindow(interp, string, tkwin);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ string = Tcl_GetString(objv[3]);
+ if (Tk_GetScreenMM(interp, tkwin, string, &mm) != TCL_OK) {
+ return TCL_ERROR;
}
- case WIN_RGB: {
- XColor *colorPtr;
- char buf[TCL_INTEGER_SPACE * 3];
+ pixels = mm * WidthOfScreen(Tk_Screen(tkwin))
+ / WidthMMOfScreen(Tk_Screen(tkwin));
+ Tcl_SetDoubleObj(resultPtr, pixels);
+ break;
+ }
+ case WIN_PIXELS: {
+ int pixels;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "window colorName");
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[2], NULL);
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[3], NULL);
- colorPtr = Tk_GetColor(interp, tkwin, string);
- if (colorPtr == NULL) {
- return TCL_ERROR;
- }
- sprintf(buf, "%d %d %d", colorPtr->red, colorPtr->green,
- colorPtr->blue);
- Tk_FreeColor(colorPtr);
- Tcl_SetStringObj(resultPtr, buf, -1);
- break;
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window number");
+ return TCL_ERROR;
}
- case WIN_VISUALSAVAILABLE: {
- XVisualInfo template, *visInfoPtr;
- int count, i;
- int includeVisualId;
- Tcl_Obj *strPtr;
- char buf[16 + TCL_INTEGER_SPACE];
- char visualIdString[TCL_INTEGER_SPACE];
-
- if (objc == 3) {
- includeVisualId = 0;
- } else if ((objc == 4)
- && (strcmp(Tcl_GetStringFromObj(objv[3], NULL),
- "includeids") == 0)) {
- includeVisualId = 1;
- } else {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?includeids?");
- return TCL_ERROR;
- }
+ string = Tcl_GetString(objv[2]);
+ tkwin = Tk_NameToWindow(interp, string, tkwin);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ string = Tcl_GetString(objv[3]);
+ if (Tk_GetPixels(interp, tkwin, string, &pixels) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tcl_SetIntObj(resultPtr, pixels);
+ break;
+ }
+ case WIN_RGB: {
+ XColor *colorPtr;
+ char buf[TCL_INTEGER_SPACE * 3];
- string = Tcl_GetStringFromObj(objv[2], NULL);
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window colorName");
+ return TCL_ERROR;
+ }
+ string = Tcl_GetString(objv[2]);
+ tkwin = Tk_NameToWindow(interp, string, tkwin);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ string = Tcl_GetString(objv[3]);
+ colorPtr = Tk_GetColor(interp, tkwin, string);
+ if (colorPtr == NULL) {
+ return TCL_ERROR;
+ }
+ sprintf(buf, "%d %d %d", colorPtr->red, colorPtr->green,
+ colorPtr->blue);
+ Tk_FreeColor(colorPtr);
+ Tcl_SetStringObj(resultPtr, buf, -1);
+ break;
+ }
+ case WIN_VISUALSAVAILABLE: {
+ XVisualInfo template, *visInfoPtr;
+ int count, i;
+ int includeVisualId;
+ Tcl_Obj *strPtr;
+ char buf[16 + TCL_INTEGER_SPACE];
+ char visualIdString[TCL_INTEGER_SPACE];
+
+ if (objc == 3) {
+ includeVisualId = 0;
+ } else if ((objc == 4)
+ && (strcmp(Tcl_GetString(objv[3]), "includeids") == 0)) {
+ includeVisualId = 1;
+ } else {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?includeids?");
+ return TCL_ERROR;
+ }
- template.screen = Tk_ScreenNumber(tkwin);
- visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask,
- &template, &count);
- if (visInfoPtr == NULL) {
- Tcl_SetStringObj(resultPtr,
- "can't find any visuals for screen", -1);
- return TCL_ERROR;
+ string = Tcl_GetString(objv[2]);
+ tkwin = Tk_NameToWindow(interp, string, tkwin);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+
+ template.screen = Tk_ScreenNumber(tkwin);
+ visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask,
+ &template, &count);
+ if (visInfoPtr == NULL) {
+ Tcl_SetStringObj(resultPtr,
+ "can't find any visuals for screen", -1);
+ return TCL_ERROR;
+ }
+ for (i = 0; i < count; i++) {
+ string = TkFindStateString(visualMap, visInfoPtr[i].class);
+ if (string == NULL) {
+ strcpy(buf, "unknown");
+ } else {
+ sprintf(buf, "%s %d", string, visInfoPtr[i].depth);
}
- for (i = 0; i < count; i++) {
- string = TkFindStateString(visualMap, visInfoPtr[i].class);
- if (string == NULL) {
- strcpy(buf, "unknown");
- } else {
- sprintf(buf, "%s %d", string, visInfoPtr[i].depth);
- }
- if (includeVisualId) {
- sprintf(visualIdString, " 0x%x",
- (unsigned int) visInfoPtr[i].visualid);
- strcat(buf, visualIdString);
- }
- strPtr = Tcl_NewStringObj(buf, -1);
- Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
+ if (includeVisualId) {
+ sprintf(visualIdString, " 0x%x",
+ (unsigned int) visInfoPtr[i].visualid);
+ strcat(buf, visualIdString);
}
- XFree((char *) visInfoPtr);
- break;
+ strPtr = Tcl_NewStringObj(buf, -1);
+ Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
}
+ XFree((char *) visInfoPtr);
+ break;
+ }
}
return TCL_OK;
}
@@ -1700,8 +1700,8 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
*
* Tk_WmObjCmd --
*
- * This procedure is invoked to process the "wm" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm" Tcl command. See the user
+ * documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1714,24 +1714,23 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
int
-Tk_WmObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_WmObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin;
TkWindow *winPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"aspect", "client", "command", "deiconify",
"focusmodel", "frame", "geometry", "grid",
"group", "iconbitmap", "iconify", "iconmask",
"iconname", "iconposition", "iconwindow", "maxsize",
"minsize", "overrideredirect", "positionfrom", "protocol",
"resizable", "sizefrom", "state", "title",
- "tracing", "transient", "withdraw", (char *) NULL
+ "tracing", "transient", "withdraw", NULL
};
enum options {
TKWM_ASPECT, TKWM_CLIENT, TKWM_COMMAND, TKWM_DEICONIFY,
@@ -1790,127 +1789,119 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
}
if (!(winPtr->flags & TK_TOP_LEVEL)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
switch ((enum options) index) {
- case TKWM_ASPECT: {
- TkpWmAspectCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_CLIENT: {
- TkpWmClientCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_COMMAND: {
- TkpWmCommandCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_DEICONIFY: {
- TkpWmDeiconifyCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_FOCUSMOD: {
- TkpWmFocusmodCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_FRAME: {
- TkpWmFrameCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_GEOMETRY: {
- TkpWmGeometryCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_GRID: {
- TkpWmGridCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_GROUP: {
- TkpWmGroupCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_ICONBMP: {
- TkpWmIconbitmapCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_ICONIFY: {
- TkpWmIconifyCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_ICONMASK: {
- TkpWmIconmaskCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_ICONNAME: {
- /* slight Unix variation */
- TkpWmIconnameCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_ICONPOS: {
- /* nearly same - 1 line more on Unix */
- TkpWmIconpositionCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_ICONWIN: {
- TkpWmIconwindowCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_MAXSIZE: {
- /* nearly same, win diffs */
- TkpWmMaxsizeCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_MINSIZE: {
- /* nearly same, win diffs */
- TkpWmMinsizeCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_OVERRIDE: {
- /* almost same */
- TkpWmOverrideCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_POSFROM: {
- /* Equal across platforms */
- TkpWmPositionfromCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_PROTOCOL: {
- /* Equal across platforms */
- TkpWmProtocolCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_RESIZABLE: {
- /* almost same */
- TkpWmResizableCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_SIZEFROM: {
- /* Equal across platforms */
- TkpWmSizefromCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_STATE: {
- TkpWmStateCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_TITLE: {
- TkpWmTitleCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_TRANSIENT: {
- TkpWmTransientCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
- case TKWM_WITHDRAW: {
- TkpWmWithdrawCmd(interp, tkwin, winPtr, objc, objv);
- break;
- }
+ case TKWM_ASPECT:
+ TkpWmAspectCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_CLIENT:
+ TkpWmClientCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_COMMAND:
+ TkpWmCommandCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_DEICONIFY:
+ TkpWmDeiconifyCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_FOCUSMOD:
+ TkpWmFocusmodCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_FRAME:
+ TkpWmFrameCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_GEOMETRY:
+ TkpWmGeometryCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_GRID:
+ TkpWmGridCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_GROUP:
+ TkpWmGroupCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_ICONBMP:
+ TkpWmIconbitmapCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_ICONIFY:
+ TkpWmIconifyCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_ICONMASK:
+ TkpWmIconmaskCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_ICONNAME:
+ /*
+ * Slight Unix variation.
+ */
+ TkpWmIconnameCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_ICONPOS:
+ /*
+ * nearly same - 1 line more on Unix.
+ */
+ TkpWmIconpositionCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_ICONWIN:
+ TkpWmIconwindowCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_MAXSIZE:
+ /*
+ * Nearly same, win diffs.
+ */
+ TkpWmMaxsizeCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_MINSIZE:
+ /*
+ * Nearly same, win diffs
+ */
+ TkpWmMinsizeCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_OVERRIDE:
+ /*
+ * Almost same.
+ */
+ TkpWmOverrideCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_POSFROM:
+ /*
+ * Equal across platforms
+ */
+ TkpWmPositionfromCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_PROTOCOL:
+ /*
+ * Equal across platforms
+ */
+ TkpWmProtocolCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_RESIZABLE:
+ /*
+ * Almost same
+ */
+ TkpWmResizableCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_SIZEFROM:
+ /*
+ * Equal across platforms
+ */
+ TkpWmSizefromCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_STATE:
+ TkpWmStateCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_TITLE:
+ TkpWmTitleCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_TRANSIENT:
+ TkpWmTransientCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ case TKWM_WITHDRAW:
+ TkpWmWithdrawCmd(interp, tkwin, winPtr, objc, objv);
+ break;
}
- updateGeom:
+ updateGeom:
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
@@ -1924,21 +1915,20 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*
* TkGetDisplayOf --
*
- * Parses a "-displayof window" option for various commands. If
- * present, the literal "-displayof" should be in objv[0] and the
- * window name in objv[1].
+ * Parses a "-displayof window" option for various commands. If present,
+ * the literal "-displayof" should be in objv[0] and the window name in
+ * objv[1].
*
* Results:
- * The return value is 0 if the argument strings did not contain
- * the "-displayof" option. The return value is 2 if the
- * argument strings contained both the "-displayof" option and
- * a valid window name. Otherwise, the return value is -1 if
- * the window name was missing or did not specify a valid window.
+ * The return value is 0 if the argument strings did not contain the
+ * "-displayof" option. The return value is 2 if the argument strings
+ * contained both the "-displayof" option and a valid window name.
+ * Otherwise, the return value is -1 if the window name was missing or
+ * did not specify a valid window.
*
- * If the return value was 2, *tkwinPtr is filled with the
- * token for the window specified on the command line. If the
- * return value was -1, an error message is left in interp's
- * result object.
+ * If the return value was 2, *tkwinPtr is filled with the token for the
+ * window specified on the command line. If the return value was -1, an
+ * error message is left in interp's result object.
*
* Side effects:
* None.
@@ -1947,14 +1937,14 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*/
int
-TkGetDisplayOf(interp, objc, objv, tkwinPtr)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. If it is present,
+TkGetDisplayOf(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[], /* Argument objects. If it is present,
* "-displayof" should be in objv[0] and
* objv[1] the name of a window. */
- Tk_Window *tkwinPtr; /* On input, contains main window of
- * application associated with interp. On
+ Tk_Window *tkwinPtr) /* On input, contains main window of
+ * application associated with interp. On
* output, filled with window specified as
* option to "-displayof" argument, or
* unmodified if "-displayof" argument was not
@@ -1962,7 +1952,7 @@ TkGetDisplayOf(interp, objc, objv, tkwinPtr)
{
char *string;
int length;
-
+
if (objc < 1) {
return 0;
}
@@ -1974,8 +1964,7 @@ TkGetDisplayOf(interp, objc, objv, tkwinPtr)
"value for \"-displayof\" missing", -1);
return -1;
}
- string = Tcl_GetStringFromObj(objv[1], NULL);
- *tkwinPtr = Tk_NameToWindow(interp, string, *tkwinPtr);
+ *tkwinPtr = Tk_NameToWindow(interp, Tcl_GetString(objv[1]), *tkwinPtr);
if (*tkwinPtr == NULL) {
return -1;
}
@@ -1990,11 +1979,11 @@ TkGetDisplayOf(interp, objc, objv, tkwinPtr)
* TkDeadAppCmd --
*
* If an application has been deleted then all Tk commands will be
- * re-bound to this procedure.
+ * re-bound to this function.
*
* Results:
- * A standard Tcl error is reported to let the user know that
- * the application is dead.
+ * A standard Tcl error is reported to let the user know that the
+ * application is dead.
*
* Side effects:
* See the user documentation.
@@ -2004,28 +1993,28 @@ TkGetDisplayOf(interp, objc, objv, tkwinPtr)
/* ARGSUSED */
int
-TkDeadAppCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Dummy. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TkDeadAppCmd(
+ ClientData clientData, /* Dummy. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ const char **argv) /* Argument strings. */
{
Tcl_AppendResult(interp, "can't invoke \"", argv[0],
- "\" command: application has been destroyed", (char *) NULL);
+ "\" command: application has been destroyed", NULL);
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
- * GetToplevel --
+ * GetTopHierarchy --
*
- * Retrieves the toplevel window which is the nearest ancestor of
- * of the specified window.
+ * Retrieves the top-of-hierarchy window which is the nearest ancestor of
+ * the specified window.
*
* Results:
- * Returns the toplevel window or NULL if the window has no
- * ancestor which is a toplevel.
+ * Returns the top-of-hierarchy window, or NULL if the window has no
+ * ancestor which is at the top of a physical window hierarchy.
*
* Side effects:
* None.
@@ -2034,17 +2023,22 @@ TkDeadAppCmd(clientData, interp, argc, argv)
*/
static TkWindow *
-GetToplevel(tkwin)
- Tk_Window tkwin; /* Window for which the toplevel should be
- * deterined. */
+GetTopHierarchy(
+ Tk_Window tkwin) /* Window for which the top-of-hierarchy
+ * ancestor should be deterined. */
{
- TkWindow *winPtr = (TkWindow *) tkwin;
-
- while (!(winPtr->flags & TK_TOP_LEVEL)) {
- winPtr = winPtr->parentPtr;
- if (winPtr == NULL) {
- return NULL;
- }
- }
- return winPtr;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+
+ while ((winPtr != NULL) && !(winPtr->flags & TK_TOP_HIERARCHY)) {
+ winPtr = winPtr->parentPtr;
+ }
+ return winPtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkColor.c b/generic/tkColor.c
index f06c43f..6836c52 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -1,21 +1,22 @@
-/*
+/*
* tkColor.c --
*
- * This file maintains a database of color values for the Tk
- * toolkit, in order to avoid round-trips to the server to
- * map color names to pixel values.
+ * This file maintains a database of color values for the Tk toolkit, in
+ * order to avoid round-trips to the server to map color names to pixel
+ * values.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkColor.h"
/*
- * Structures of the following following type are used as keys for
+ * Structures of the following following type are used as keys for
* colorValueTable (in TkDisplay).
*/
@@ -26,30 +27,28 @@ typedef struct {
Display *display; /* Display for colormap. */
} ValueKey;
-
/*
- * The structure below is used to allocate thread-local data.
+ * The structure below is used to allocate thread-local data.
*/
typedef struct ThreadSpecificData {
- char rgbString[20]; /* */
+ char rgbString[20]; /* */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void ColorInit _ANSI_ARGS_((TkDisplay *dispPtr));
-static void DupColorObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr,
- Tcl_Obj *dupObjPtr));
-static void FreeColorObjProc _ANSI_ARGS_((Tcl_Obj *objPtr));
-static void InitColorObj _ANSI_ARGS_((Tcl_Obj *objPtr));
+static void ColorInit(TkDisplay *dispPtr);
+static void DupColorObjProc(Tcl_Obj *srcObjPtr,Tcl_Obj *dupObjPtr);
+static void FreeColorObjProc(Tcl_Obj *objPtr);
+static void InitColorObj(Tcl_Obj *objPtr);
/*
* The following structure defines the implementation of the "color" Tcl
- * object, which maps a string color name to a TkColor object. The
- * ptr1 field of the Tcl_Obj points to a TkColor object.
+ * object, which maps a string color name to a TkColor object. The ptr1 field
+ * of the Tcl_Obj points to a TkColor object.
*/
Tcl_ObjType tkColorObjType = {
@@ -65,32 +64,31 @@ Tcl_ObjType tkColorObjType = {
*
* Tk_AllocColorFromObj --
*
- * Given a Tcl_Obj *, map the value to a corresponding
- * XColor structure based on the tkwin given.
+ * Given a Tcl_Obj *, map the value to a corresponding XColor structure
+ * based on the tkwin given.
*
* Results:
- * The return value is a pointer to an XColor structure that
- * indicates the red, blue, and green intensities for the color
- * given by the string in objPtr, and also specifies a pixel value
- * to use to draw in that color. If an error occurs, NULL is
- * returned and an error message will be left in interp's result
- * (unless interp is NULL).
+ * The return value is a pointer to an XColor structure that indicates
+ * the red, blue, and green intensities for the color given by the string
+ * in objPtr, and also specifies a pixel value to use to draw in that
+ * color. If an error occurs, NULL is returned and an error message will
+ * be left in interp's result (unless interp is NULL).
*
* Side effects:
- * The color is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeColorFromObj so that the database is cleaned up when colors
+ * The color is added to an internal database with a reference count. For
+ * each call to this function, there should eventually be a call to
+ * Tk_FreeColorFromObj so that the database is cleaned up when colors
* aren't in use anymore.
*
*----------------------------------------------------------------------
*/
XColor *
-Tk_AllocColorFromObj(interp, tkwin, objPtr)
- Tcl_Interp *interp; /* Used only for error reporting. If NULL,
+Tk_AllocColorFromObj(
+ Tcl_Interp *interp, /* Used only for error reporting. If NULL,
* then no messages are provided. */
- Tk_Window tkwin; /* Window in which the color will be used.*/
- Tcl_Obj *objPtr; /* Object that describes the color; string
+ Tk_Window tkwin, /* Window in which the color will be used.*/
+ Tcl_Obj *objPtr) /* Object that describes the color; string
* value is a color name such as "red" or
* "#ff0000".*/
{
@@ -102,15 +100,15 @@ Tk_AllocColorFromObj(interp, tkwin, objPtr)
tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1;
/*
- * If the object currently points to a TkColor, see if it's the
- * one we want. If so, increment its reference count and return.
+ * If the object currently points to a TkColor, see if it's the one we
+ * want. If so, increment its reference count and return.
*/
if (tkColPtr != NULL) {
if (tkColPtr->resourceRefCount == 0) {
/*
- * This is a stale reference: it refers to a TkColor that's
- * no longer in use. Clear the reference.
+ * This is a stale reference: it refers to a TkColor that's no
+ * longer in use. Clear the reference.
*/
FreeColorObjProc(objPtr);
@@ -123,14 +121,14 @@ Tk_AllocColorFromObj(interp, tkwin, objPtr)
}
/*
- * The object didn't point to the TkColor that we wanted. Search
- * the list of TkColors with the same name to see if one of the
- * other TkColors is the right one.
+ * The object didn't point to the TkColor that we wanted. Search the list
+ * of TkColors with the same name to see if one of the other TkColors is
+ * the right one.
*/
if (tkColPtr != NULL) {
- TkColor *firstColorPtr =
- (TkColor *) Tcl_GetHashValue(tkColPtr->hashPtr);
+ TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
+
FreeColorObjProc(objPtr);
for (tkColPtr = firstColorPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
@@ -138,18 +136,18 @@ Tk_AllocColorFromObj(interp, tkwin, objPtr)
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
tkColPtr->resourceRefCount++;
tkColPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) tkColPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
return (XColor *) tkColPtr;
}
}
}
/*
- * Still no luck. Call Tk_GetColor to allocate a new TkColor object.
+ * Still no luck. Call Tk_GetColor to allocate a new TkColor object.
*/
tkColPtr = (TkColor *) Tk_GetColor(interp, tkwin, Tcl_GetString(objPtr));
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) tkColPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
if (tkColPtr != NULL) {
tkColPtr->objRefCount++;
}
@@ -165,31 +163,31 @@ Tk_AllocColorFromObj(interp, tkwin, objPtr)
* XColor structure.
*
* Results:
- * The return value is a pointer to an XColor structure that
- * indicates the red, blue, and green intensities for the color
- * given by "name", and also specifies a pixel value to use to
- * draw in that color. If an error occurs, NULL is returned and
- * an error message will be left in the interp's result.
+ * The return value is a pointer to an XColor structure that indicates
+ * the red, blue, and green intensities for the color given by "name",
+ * and also specifies a pixel value to use to draw in that color. If an
+ * error occurs, NULL is returned and an error message will be left in
+ * the interp's result.
*
* Side effects:
- * The color is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeColor so that the database is cleaned up when colors
- * aren't in use anymore.
+ * The color is added to an internal database with a reference count. For
+ * each call to this function, there should eventually be a call to
+ * Tk_FreeColor so that the database is cleaned up when colors aren't in
+ * use anymore.
*
*----------------------------------------------------------------------
*/
XColor *
-Tk_GetColor(interp, tkwin, name)
- Tcl_Interp *interp; /* Place to leave error message if
- * color can't be found. */
- Tk_Window tkwin; /* Window in which color will be used. */
- Tk_Uid name; /* Name of color to be allocated (in form
+Tk_GetColor(
+ Tcl_Interp *interp, /* Place to leave error message if color can't
+ * be found. */
+ Tk_Window tkwin, /* Window in which color will be used. */
+ Tk_Uid name) /* Name of color to be allocated (in form
* suitable for passing to XParseColor). */
{
Tcl_HashEntry *nameHashPtr;
- int new;
+ int isNew;
TkColor *tkColPtr;
TkColor *existingColPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -199,14 +197,13 @@ Tk_GetColor(interp, tkwin, name)
}
/*
- * First, check to see if there's already a mapping for this color
- * name.
+ * First, check to see if there's already a mapping for this color name.
*/
- nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &new);
- if (!new) {
- existingColPtr = (TkColor *) Tcl_GetHashValue(nameHashPtr);
- for (tkColPtr = existingColPtr; tkColPtr != NULL;
+ nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew);
+ if (!isNew) {
+ existingColPtr = Tcl_GetHashValue(nameHashPtr);
+ for (tkColPtr = existingColPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
if ((tkColPtr->screen == Tk_Screen(tkwin))
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
@@ -219,8 +216,7 @@ Tk_GetColor(interp, tkwin, name)
}
/*
- * The name isn't currently known. Map from the name to a pixel
- * value.
+ * The name isn't currently known. Map from the name to a pixel value.
*/
tkColPtr = TkpGetColor(tkwin, name);
@@ -228,28 +224,28 @@ Tk_GetColor(interp, tkwin, name)
if (interp != NULL) {
if (*name == '#') {
Tcl_AppendResult(interp, "invalid color name \"", name,
- "\"", (char *) NULL);
+ "\"", NULL);
} else {
Tcl_AppendResult(interp, "unknown color name \"", name,
- "\"", (char *) NULL);
+ "\"", NULL);
}
}
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(nameHashPtr);
}
- return (XColor *) NULL;
+ return NULL;
}
/*
- * Now create a new TkColor structure and add it to colorNameTable
- * (in TkDisplay).
+ * Now create a new TkColor structure and add it to colorNameTable (in
+ * TkDisplay).
*/
tkColPtr->magic = COLOR_MAGIC;
tkColPtr->gc = None;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = Tk_Colormap(tkwin);
- tkColPtr->visual = Tk_Visual(tkwin);
+ tkColPtr->visual = Tk_Visual(tkwin);
tkColPtr->resourceRefCount = 1;
tkColPtr->objRefCount = 0;
tkColPtr->type = TK_COLOR_BY_NAME;
@@ -265,34 +261,33 @@ Tk_GetColor(interp, tkwin, name)
*
* Tk_GetColorByValue --
*
- * Given a desired set of red-green-blue intensities for a color,
- * locate a pixel value to use to draw that color in a given
- * window.
+ * Given a desired set of red-green-blue intensities for a color, locate
+ * a pixel value to use to draw that color in a given window.
*
* Results:
- * The return value is a pointer to an XColor structure that
- * indicates the closest red, blue, and green intensities available
- * to those specified in colorPtr, and also specifies a pixel
- * value to use to draw in that color.
+ * The return value is a pointer to an XColor structure that indicates
+ * the closest red, blue, and green intensities available to those
+ * specified in colorPtr, and also specifies a pixel value to use to draw
+ * in that color.
*
* Side effects:
- * The color is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeColor, so that the database is cleaned up when colors
- * aren't in use anymore.
+ * The color is added to an internal database with a reference count. For
+ * each call to this function, there should eventually be a call to
+ * Tk_FreeColor, so that the database is cleaned up when colors aren't in
+ * use anymore.
*
*----------------------------------------------------------------------
*/
XColor *
-Tk_GetColorByValue(tkwin, colorPtr)
- Tk_Window tkwin; /* Window where color will be used. */
- XColor *colorPtr; /* Red, green, and blue fields indicate
+Tk_GetColorByValue(
+ Tk_Window tkwin, /* Window where color will be used. */
+ XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
ValueKey valueKey;
Tcl_HashEntry *valueHashPtr;
- int new;
+ int isNew;
TkColor *tkColPtr;
Display *display = Tk_Display(tkwin);
TkDisplay *dispPtr = TkGetDisplay(display);
@@ -302,26 +297,28 @@ Tk_GetColorByValue(tkwin, colorPtr)
}
/*
- * First, check to see if there's already a mapping for this color
- * name.
+ * First, check to see if there's already a mapping for this color name.
+ * Must clear the structure first; it's not tightly packed on 64-bit
+ * systems. [Bug 2911570]
*/
+ memset(&valueKey, 0, sizeof(ValueKey));
valueKey.red = colorPtr->red;
valueKey.green = colorPtr->green;
valueKey.blue = colorPtr->blue;
valueKey.colormap = Tk_Colormap(tkwin);
valueKey.display = display;
- valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
- (char *) &valueKey, &new);
- if (!new) {
- tkColPtr = (TkColor *) Tcl_GetHashValue(valueHashPtr);
+ valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
+ (char *) &valueKey, &isNew);
+ if (!isNew) {
+ tkColPtr = Tcl_GetHashValue(valueHashPtr);
tkColPtr->resourceRefCount++;
return &tkColPtr->color;
}
/*
- * The name isn't currently known. Find a pixel value for this
- * color and add a new structure to colorValueTable (in TkDisplay).
+ * The name isn't currently known. Find a pixel value for this color and
+ * add a new structure to colorValueTable (in TkDisplay).
*/
tkColPtr = TkpGetColorByValue(tkwin, colorPtr);
@@ -329,7 +326,7 @@ Tk_GetColorByValue(tkwin, colorPtr)
tkColPtr->gc = None;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = valueKey.colormap;
- tkColPtr->visual = Tk_Visual(tkwin);
+ tkColPtr->visual = Tk_Visual(tkwin);
tkColPtr->resourceRefCount = 1;
tkColPtr->objRefCount = 0;
tkColPtr->type = TK_COLOR_BY_VALUE;
@@ -344,16 +341,14 @@ Tk_GetColorByValue(tkwin, colorPtr)
*
* Tk_NameOfColor --
*
- * Given a color, return a textual string identifying
- * the color.
+ * Given a color, return a textual string identifying the color.
*
* Results:
- * If colorPtr was created by Tk_GetColor, then the return
- * value is the "string" that was used to create it.
- * Otherwise the return value is a string that could have
- * been passed to Tk_GetColor to allocate that color. The
- * storage for the returned string is only guaranteed to
- * persist up until the next call to this procedure.
+ * If colorPtr was created by Tk_GetColor, then the return value is the
+ * "string" that was used to create it. Otherwise the return value is a
+ * string that could have been passed to Tk_GetColor to allocate that
+ * color. The storage for the returned string is only guaranteed to
+ * persist up until the next call to this function.
*
* Side effects:
* None.
@@ -362,18 +357,18 @@ Tk_GetColorByValue(tkwin, colorPtr)
*/
CONST char *
-Tk_NameOfColor(colorPtr)
- XColor *colorPtr; /* Color whose name is desired. */
+Tk_NameOfColor(
+ XColor *colorPtr) /* Color whose name is desired. */
{
register TkColor *tkColPtr = (TkColor *) colorPtr;
-
- if ((tkColPtr->magic == COLOR_MAGIC) &&
- (tkColPtr->type == TK_COLOR_BY_NAME)) {
+
+ if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) {
return tkColPtr->hashPtr->key.string;
} else {
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red,
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red,
colorPtr->green, colorPtr->blue);
return tsdPtr->rgbString;
}
@@ -384,15 +379,14 @@ Tk_NameOfColor(colorPtr)
*
* Tk_GCForColor --
*
- * Given a color allocated from this module, this procedure
- * returns a GC that can be used for simple drawing with that
- * color.
+ * Given a color allocated from this module, this function returns a GC
+ * that can be used for simple drawing with that color.
*
* Results:
- * The return value is a GC with color set as its foreground
- * color and all other fields defaulted. This GC is only valid
- * as long as the color exists; it is freed automatically when
- * the last reference to the color is freed.
+ * The return value is a GC with color set as its foreground color and
+ * all other fields defaulted. This GC is only valid as long as the color
+ * exists; it is freed automatically when the last reference to the color
+ * is freed.
*
* Side effects:
* None.
@@ -401,24 +395,23 @@ Tk_NameOfColor(colorPtr)
*/
GC
-Tk_GCForColor(colorPtr, drawable)
- XColor *colorPtr; /* Color for which a GC is desired. Must
- * have been allocated by Tk_GetColor. */
- Drawable drawable; /* Drawable in which the color will be
- * used (must have same screen and depth
- * as the one for which the color was
- * allocated). */
+Tk_GCForColor(
+ XColor *colorPtr, /* Color for which a GC is desired. Must have
+ * been allocated by Tk_GetColor. */
+ Drawable drawable) /* Drawable in which the color will be used
+ * (must have same screen and depth as the one
+ * for which the color was allocated). */
{
TkColor *tkColPtr = (TkColor *) colorPtr;
XGCValues gcValues;
/*
- * Do a quick sanity check to make sure this color was really
- * allocated by Tk_GetColor.
+ * Do a quick sanity check to make sure this color was really allocated by
+ * Tk_GetColor.
*/
if (tkColPtr->magic != COLOR_MAGIC) {
- panic("Tk_GCForColor called with bogus color");
+ Tcl_Panic("Tk_GCForColor called with bogus color");
}
if (tkColPtr->gc == None) {
@@ -434,23 +427,21 @@ Tk_GCForColor(colorPtr, drawable)
*
* Tk_FreeColor --
*
- * This procedure is called to release a color allocated by
- * Tk_GetColor.
+ * This function is called to release a color allocated by Tk_GetColor.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with colorPtr is deleted, and
- * the color is released to X if there are no remaining uses
- * for it.
+ * The reference count associated with colorPtr is deleted, and the color
+ * is released to X if there are no remaining uses for it.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeColor(colorPtr)
- XColor *colorPtr; /* Color to be released. Must have been
+Tk_FreeColor(
+ XColor *colorPtr) /* Color to be released. Must have been
* allocated by Tk_GetColor or
* Tk_GetColorByValue. */
{
@@ -459,12 +450,12 @@ Tk_FreeColor(colorPtr)
TkColor *prevPtr;
/*
- * Do a quick sanity check to make sure this color was really
- * allocated by Tk_GetColor.
+ * Do a quick sanity check to make sure this color was really allocated by
+ * Tk_GetColor.
*/
if (tkColPtr->magic != COLOR_MAGIC) {
- panic("Tk_FreeColor called with bogus color");
+ Tcl_Panic("Tk_FreeColor called with bogus color");
}
tkColPtr->resourceRefCount--;
@@ -474,8 +465,8 @@ Tk_FreeColor(colorPtr)
/*
* This color is no longer being actively used, so free the color
- * resources associated with it and remove it from the hash table.
- * no longer any objects referencing it.
+ * resources associated with it and remove it from the hash table. No
+ * longer any objects referencing it.
*/
if (tkColPtr->gc != None) {
@@ -484,11 +475,11 @@ Tk_FreeColor(colorPtr)
}
TkpFreeColor(tkColPtr);
- prevPtr = (TkColor *) Tcl_GetHashValue(tkColPtr->hashPtr);
+ prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
if (prevPtr == tkColPtr) {
if (tkColPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(tkColPtr->hashPtr);
- } else {
+ } else {
Tcl_SetHashValue(tkColPtr->hashPtr, tkColPtr->nextPtr);
}
} else {
@@ -499,10 +490,9 @@ Tk_FreeColor(colorPtr)
}
/*
- * Free the TkColor structure if there are no objects referencing
- * it. However, if there are objects referencing it then keep the
- * structure around; it will get freed when the last reference is
- * cleared
+ * Free the TkColor structure if there are no objects referencing it.
+ * However, if there are objects referencing it then keep the structure
+ * around; it will get freed when the last reference is cleared
*/
if (tkColPtr->objRefCount == 0) {
@@ -515,27 +505,27 @@ Tk_FreeColor(colorPtr)
*
* Tk_FreeColorFromObj --
*
- * This procedure is called to release a color allocated by
- * Tk_AllocColorFromObj. It does not throw away the Tcl_Obj *;
- * it only gets rid of the hash table entry for this color
- * and clears the cached value that is normally stored in the object.
+ * This function is called to release a color allocated by
+ * Tk_AllocColorFromObj. It does not throw away the Tcl_Obj *; it only
+ * gets rid of the hash table entry for this color and clears the cached
+ * value that is normally stored in the object.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with the color represented by
- * objPtr is decremented, and the color is released to X if there are
- * no remaining uses for it.
+ * The reference count associated with the color represented by objPtr is
+ * decremented, and the color is released to X if there are no remaining
+ * uses for it.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeColorFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* The window this color lives in. Needed
- * for the screen and colormap values. */
- Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */
+Tk_FreeColorFromObj(
+ Tk_Window tkwin, /* The window this color lives in. Needed for
+ * the screen and colormap values. */
+ Tcl_Obj *objPtr) /* The Tcl_Obj * to be freed. */
{
Tk_FreeColor(Tk_GetColorFromObj(tkwin, objPtr));
FreeColorObjProc(objPtr);
@@ -544,66 +534,65 @@ Tk_FreeColorFromObj(tkwin, objPtr)
/*
*---------------------------------------------------------------------------
*
- * FreeColorObjProc --
+ * FreeColorObjProc --
*
- * This proc is called to release an object reference to a color.
- * Called when the object's internal rep is released or when
- * the cached tkColPtr needs to be changed.
+ * This proc is called to release an object reference to a color. Called
+ * when the object's internal rep is released or when the cached tkColPtr
+ * needs to be changed.
*
* Results:
* None.
*
* Side effects:
- * The object reference count is decremented. When both it
- * and the hash ref count go to zero, the color's resources
- * are released.
+ * The object reference count is decremented. When both it and the hash
+ * ref count go to zero, the color's resources are released.
*
*---------------------------------------------------------------------------
*/
static void
-FreeColorObjProc(objPtr)
- Tcl_Obj *objPtr; /* The object we are releasing. */
+FreeColorObjProc(
+ Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkColor *tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1;
if (tkColPtr != NULL) {
tkColPtr->objRefCount--;
- if ((tkColPtr->objRefCount == 0)
+ if ((tkColPtr->objRefCount == 0)
&& (tkColPtr->resourceRefCount == 0)) {
ckfree((char *) tkColPtr);
}
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
}
/*
*---------------------------------------------------------------------------
*
- * DupColorObjProc --
+ * DupColorObjProc --
*
- * When a cached color object is duplicated, this is called to
- * update the internal reps.
+ * When a cached color object is duplicated, this is called to update the
+ * internal reps.
*
* Results:
* None.
*
* Side effects:
- * The color's objRefCount is incremented and the internal rep
- * of the copy is set to point to it.
+ * The color's objRefCount is incremented and the internal rep of the
+ * copy is set to point to it.
*
*---------------------------------------------------------------------------
*/
static void
-DupColorObjProc(srcObjPtr, dupObjPtr)
- Tcl_Obj *srcObjPtr; /* The object we are copying from. */
- Tcl_Obj *dupObjPtr; /* The object we are copying to. */
+DupColorObjProc(
+ Tcl_Obj *srcObjPtr, /* The object we are copying from. */
+ Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkColor *tkColPtr = (TkColor *) srcObjPtr->internalRep.twoPtrValue.ptr1;
-
+
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (VOID *) tkColPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
if (tkColPtr != NULL) {
tkColPtr->objRefCount++;
@@ -615,26 +604,25 @@ DupColorObjProc(srcObjPtr, dupObjPtr)
*
* Tk_GetColorFromObj --
*
- * Returns the color referred to by a Tcl object. The color must
- * already have been allocated via a call to Tk_AllocColorFromObj
- * or Tk_GetColor.
+ * Returns the color referred to by a Tcl object. The color must already
+ * have been allocated via a call to Tk_AllocColorFromObj or Tk_GetColor.
*
* Results:
- * Returns the XColor * that matches the tkwin and the string rep
- * of objPtr.
+ * Returns the XColor * that matches the tkwin and the string rep of
+ * objPtr.
*
* Side effects:
- * If the object is not already a color, the conversion will free
- * any old internal representation.
+ * If the object is not already a color, the conversion will free any old
+ * internal representation.
*
*----------------------------------------------------------------------
*/
XColor *
-Tk_GetColorFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* The window in which the color will be
+Tk_GetColorFromObj(
+ Tk_Window tkwin, /* The window in which the color will be
* used. */
- Tcl_Obj *objPtr; /* String value contains the name of the
+ Tcl_Obj *objPtr) /* String value contains the name of the
* desired color. */
{
TkColor *tkColPtr;
@@ -644,51 +632,52 @@ Tk_GetColorFromObj(tkwin, objPtr)
if (objPtr->typePtr != &tkColorObjType) {
InitColorObj(objPtr);
}
-
+
/*
- * First check to see if the internal representation of the object
- * is defined and is a color that is valid for the current screen
- * and color map. If it is, we are done.
+ * First check to see if the internal representation of the object is
+ * defined and is a color that is valid for the current screen and color
+ * map. If it is, we are done.
*/
+
tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1;
if ((tkColPtr != NULL)
&& (tkColPtr->resourceRefCount > 0)
&& (Tk_Screen(tkwin) == tkColPtr->screen)
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
/*
- * The object already points to the right TkColor structure.
- * Just return it.
+ * The object already points to the right TkColor structure. Just
+ * return it.
*/
return (XColor *) tkColPtr;
}
/*
- * If we reach this point, it means that the TkColor structure
- * that we have cached in the internal representation is not valid
- * for the current screen and colormap. But there is a list of
- * other TkColor structures attached to the TkDisplay. Walk this
- * list looking for the right TkColor structure.
+ * If we reach this point, it means that the TkColor structure that we
+ * have cached in the internal representation is not valid for the current
+ * screen and colormap. But there is a list of other TkColor structures
+ * attached to the TkDisplay. Walk this list looking for the right TkColor
+ * structure.
*/
- hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable,
+ hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable,
Tcl_GetString(objPtr));
if (hashPtr == NULL) {
goto error;
}
- for (tkColPtr = (TkColor *) Tcl_GetHashValue(hashPtr);
+ for (tkColPtr = Tcl_GetHashValue(hashPtr);
(tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) {
if ((Tk_Screen(tkwin) == tkColPtr->screen)
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
FreeColorObjProc(objPtr);
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) tkColPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
tkColPtr->objRefCount++;
return (XColor *) tkColPtr;
}
}
- error:
- panic(" Tk_GetColorFromObj called with non-existent color!");
+ error:
+ Tcl_Panic("Tk_GetColorFromObj called with non-existent color!");
/*
* The following code isn't reached; it's just there to please compilers.
*/
@@ -700,28 +689,27 @@ Tk_GetColorFromObj(tkwin, objPtr)
*
* InitColorObj --
*
- * Bookeeping procedure to change an objPtr to a color type.
+ * Bookeeping function to change an objPtr to a color type.
*
* Results:
* None.
*
* Side effects:
- * The old internal rep of the object is freed. The object's
- * type is set to color with a NULL TkColor pointer (the pointer
- * will be set later by either Tk_AllocColorFromObj or
- * Tk_GetColorFromObj).
+ * The old internal rep of the object is freed. The object's type is set
+ * to color with a NULL TkColor pointer (the pointer will be set later by
+ * either Tk_AllocColorFromObj or Tk_GetColorFromObj).
*
*----------------------------------------------------------------------
*/
static void
-InitColorObj(objPtr)
- Tcl_Obj *objPtr; /* The object to convert. */
+InitColorObj(
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ const Tcl_ObjType *typePtr;
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
Tcl_GetString(objPtr);
@@ -730,7 +718,7 @@ InitColorObj(objPtr)
(*typePtr->freeIntRepProc)(objPtr);
}
objPtr->typePtr = &tkColorObjType;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
/*
@@ -750,14 +738,14 @@ InitColorObj(objPtr)
*/
static void
-ColorInit(dispPtr)
- TkDisplay *dispPtr;
+ColorInit(
+ TkDisplay *dispPtr)
{
if (!dispPtr->colorInit) {
- dispPtr->colorInit = 1;
+ dispPtr->colorInit = 1;
Tcl_InitHashTable(&dispPtr->colorNameTable, TCL_STRING_KEYS);
- Tcl_InitHashTable(&dispPtr->colorValueTable,
- sizeof(ValueKey)/sizeof(int));
+ Tcl_InitHashTable(&dispPtr->colorValueTable,
+ sizeof(ValueKey)/sizeof(int));
}
}
@@ -766,13 +754,13 @@ ColorInit(dispPtr)
*
* TkDebugColor --
*
- * This procedure returns debugging information about a color.
+ * This function returns debugging information about a color.
*
* Results:
* The return value is a list with one sublist for each TkColor
- * corresponding to "name". Each sublist has two elements that
- * contain the resourceRefCount and objRefCount fields from the
- * TkColor structure.
+ * corresponding to "name". Each sublist has two elements that contain
+ * the resourceRefCount and objRefCount fields from the TkColor
+ * structure.
*
* Side effects:
* None.
@@ -781,31 +769,40 @@ ColorInit(dispPtr)
*/
Tcl_Obj *
-TkDebugColor(tkwin, name)
- Tk_Window tkwin; /* The window in which the color will be
- * used (not currently used). */
- char *name; /* Name of the desired color. */
+TkDebugColor(
+ Tk_Window tkwin, /* The window in which the color will be used
+ * (not currently used). */
+ char *name) /* Name of the desired color. */
{
- TkColor *tkColPtr;
Tcl_HashEntry *hashPtr;
- Tcl_Obj *resultPtr, *objPtr;
+ Tcl_Obj *resultPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name);
if (hashPtr != NULL) {
- tkColPtr = (TkColor *) Tcl_GetHashValue(hashPtr);
+ TkColor *tkColPtr = Tcl_GetHashValue(hashPtr);
+
if (tkColPtr == NULL) {
- panic("TkDebugColor found empty hash table entry");
+ Tcl_Panic("TkDebugColor found empty hash table entry");
}
for ( ; (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) {
- objPtr = Tcl_NewObj();
+ Tcl_Obj *objPtr = Tcl_NewObj();
+
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(tkColPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(tkColPtr->objRefCount));
+ Tcl_NewIntObj(tkColPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
return resultPtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkColor.h b/generic/tkColor.h
index 2a59e05..d4679cf 100644
--- a/generic/tkColor.h
+++ b/generic/tkColor.h
@@ -1,13 +1,12 @@
/*
* tkColor.h --
*
- * Declarations of data types and functions used by the
- * Tk color module.
+ * Declarations of data types and functions used by the Tk color module.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKCOLOR
@@ -16,14 +15,14 @@
#include <tkInt.h>
#ifdef BUILD_tk
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLEXPORT
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
#endif
/*
- * One of the following data structures is used to keep track of
- * each color that is being used by the application; typically there
- * is a colormap entry allocated for each of these colors.
+ * One of the following data structures is used to keep track of each color
+ * that is being used by the application; typically there is a colormap entry
+ * allocated for each of these colors.
*/
#define TK_COLOR_BY_NAME 1
@@ -34,39 +33,38 @@
typedef struct TkColor {
XColor color; /* Information about this color. */
unsigned int magic; /* Used for quick integrity check on this
- * structure. Must always have the
- * value COLOR_MAGIC. */
+ * structure. Must always have the value
+ * COLOR_MAGIC. */
GC gc; /* Simple gc with this color as foreground
- * color and all other fields defaulted.
- * May be None. */
- Screen *screen; /* Screen where this color is valid. Used
- * to delete it, and to find its display. */
+ * color and all other fields defaulted. May
+ * be None. */
+ Screen *screen; /* Screen where this color is valid. Used to
+ * delete it, and to find its display. */
Colormap colormap; /* Colormap from which this entry was
* allocated. */
- Visual *visual; /* Visual associated with colormap. */
+ Visual *visual; /* Visual associated with colormap. */
int resourceRefCount; /* Number of active uses of this color (each
* active use corresponds to a call to
- * Tk_AllocColorFromObj or Tk_GetColor).
- * If this count is 0, then this TkColor
+ * Tk_AllocColorFromObj or Tk_GetColor). If
+ * this count is 0, then this TkColor
* structure is no longer valid and it isn't
- * present in a hash table: it is being
- * kept around only because there are objects
- * referring to it. The structure is freed
- * when resourceRefCount and objRefCount
- * are both 0. */
+ * present in a hash table: it is being kept
+ * around only because there are objects
+ * referring to it. The structure is freed
+ * when resourceRefCount and objRefCount are
+ * both 0. */
int objRefCount; /* The number of Tcl objects that reference
* this structure. */
- int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE */
+ int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE. */
Tcl_HashEntry *hashPtr; /* Pointer to hash table entry for this
* structure. (for use in deleting entry). */
struct TkColor *nextPtr; /* Points to the next TkColor structure with
- * the same color name. Colors with the
- * same name but different screens or
- * colormaps are chained together off a
- * single entry in nameTable. For colors in
- * valueTable (those allocated by
- * Tk_GetColorByValue) this field is always
- * NULL. */
+ * the same color name. Colors with the same
+ * name but different screens or colormaps are
+ * chained together off a single entry in
+ * nameTable. For colors in valueTable (those
+ * allocated by Tk_GetColorByValue) this field
+ * is always NULL. */
} TkColor;
/*
@@ -74,14 +72,12 @@ typedef struct TkColor {
*/
#ifndef TkpFreeColor
-EXTERN void TkpFreeColor _ANSI_ARGS_((TkColor *tkColPtr));
+MODULE_SCOPE void TkpFreeColor(TkColor *tkColPtr);
#endif
-EXTERN TkColor * TkpGetColor _ANSI_ARGS_((Tk_Window tkwin,
- Tk_Uid name));
-EXTERN TkColor * TkpGetColorByValue _ANSI_ARGS_((Tk_Window tkwin,
- XColor *colorPtr));
+MODULE_SCOPE TkColor * TkpGetColor(Tk_Window tkwin, Tk_Uid name);
+MODULE_SCOPE TkColor * TkpGetColorByValue(Tk_Window tkwin, XColor *colorPtr);
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLIMPORT
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLIMPORT
#endif /* _TKCOLOR */
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 1e66af0..ed47210 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -1,13 +1,13 @@
-/*
+/*
* tkConfig.c --
*
- * This file contains procedures that manage configuration options
- * for widgets and other things.
+ * This file contains functions that manage configuration options for
+ * widgets and other things.
*
* Copyright (c) 1997-1998 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/*
@@ -23,129 +23,123 @@
#define __NO_OLD_CONFIG
#endif
-#include "tk.h"
#include "tkInt.h"
-#include "tkPort.h"
#include "tkFont.h"
/*
- * The following definition is an AssocData key used to keep track of
- * all of the option tables that have been created for an interpreter.
+ * The following definition is an AssocData key used to keep track of all of
+ * the option tables that have been created for an interpreter.
*/
#define OPTION_HASH_KEY "TkOptionTable"
/*
- * The following two structures are used along with Tk_OptionSpec
- * structures to manage configuration options. Tk_OptionSpec is
- * static templates that are compiled into the code of a widget
- * or other object manager. However, to look up options efficiently
- * we need to supplement the static information with additional
- * dynamic information, and this dynamic information may be different
- * for each application. Thus we create structures of the following
- * two types to hold all of the dynamic information; this is done
- * by Tk_CreateOptionTable.
- *
- * One of the following structures corresponds to each Tk_OptionSpec.
- * These structures exist as arrays inside TkOptionTable structures.
+ * The following two structures are used along with Tk_OptionSpec structures
+ * to manage configuration options. Tk_OptionSpec is static templates that are
+ * compiled into the code of a widget or other object manager. However, to
+ * look up options efficiently we need to supplement the static information
+ * with additional dynamic information, and this dynamic information may be
+ * different for each application. Thus we create structures of the following
+ * two types to hold all of the dynamic information; this is done by
+ * Tk_CreateOptionTable.
+ *
+ * One of the following structures corresponds to each Tk_OptionSpec. These
+ * structures exist as arrays inside TkOptionTable structures.
*/
typedef struct TkOption {
- CONST Tk_OptionSpec *specPtr; /* The original spec from the template
- * passed to Tk_CreateOptionTable.*/
- Tk_Uid dbNameUID; /* The Uid form of the option database
- * name. */
- Tk_Uid dbClassUID; /* The Uid form of the option database
- * class name. */
- Tcl_Obj *defaultPtr; /* Default value for this option. */
+ CONST Tk_OptionSpec *specPtr;
+ /* The original spec from the template passed
+ * to Tk_CreateOptionTable.*/
+ Tk_Uid dbNameUID; /* The Uid form of the option database
+ * name. */
+ Tk_Uid dbClassUID; /* The Uid form of the option database class
+ * name. */
+ Tcl_Obj *defaultPtr; /* Default value for this option. */
union {
- Tcl_Obj *monoColorPtr; /* For color and border options, this
- * is an alternate default value to
- * use on monochrome displays. */
- struct TkOption *synonymPtr; /* For synonym options, this points to
- * the master entry. */
- struct Tk_ObjCustomOption *custom; /* For TK_OPTION_CUSTOM. */
+ Tcl_Obj *monoColorPtr; /* For color and border options, this is an
+ * alternate default value to use on
+ * monochrome displays. */
+ struct TkOption *synonymPtr;
+ /* For synonym options, this points to the
+ * master entry. */
+ struct Tk_ObjCustomOption *custom;
+ /* For TK_OPTION_CUSTOM. */
} extra;
- int flags; /* Miscellaneous flag values; see
- * below for definitions. */
+ int flags; /* Miscellaneous flag values; see below for
+ * definitions. */
} Option;
/*
* Flag bits defined for Option structures:
*
- * OPTION_NEEDS_FREEING - 1 means that FreeResources must be
- * invoke to free resources associated with
- * the option when it is no longer needed.
+ * OPTION_NEEDS_FREEING - 1 means that FreeResources must be invoked to
+ * free resources associated with the option when
+ * it is no longer needed.
*/
#define OPTION_NEEDS_FREEING 1
/*
- * One of the following exists for each Tk_OptionSpec array that has
- * been passed to Tk_CreateOptionTable.
+ * One of the following exists for each Tk_OptionSpec array that has been
+ * passed to Tk_CreateOptionTable.
*/
typedef struct OptionTable {
- int refCount; /* Counts the number of uses of this
- * table (the number of times
- * Tk_CreateOptionTable has returned
- * it). This can be greater than 1 if
- * it is shared along several option
- * table chains, or if the same table
- * is used for multiple purposes. */
- Tcl_HashEntry *hashEntryPtr; /* Hash table entry that refers to this
- * table; used to delete the entry. */
- struct OptionTable *nextPtr; /* If templatePtr was part of a chain
- * of templates, this points to the
- * table corresponding to the next
- * template in the chain. */
- int numOptions; /* The number of items in the options
- * array below. */
- Option options[1]; /* Information about the individual
- * options in the table. This must be
- * the last field in the structure:
- * the actual size of the array will
- * be numOptions, not 1. */
+ int refCount; /* Counts the number of uses of this table
+ * (the number of times Tk_CreateOptionTable
+ * has returned it). This can be greater than
+ * 1 if it is shared along several option
+ * table chains, or if the same table is used
+ * for multiple purposes. */
+ Tcl_HashEntry *hashEntryPtr;/* Hash table entry that refers to this table;
+ * used to delete the entry. */
+ struct OptionTable *nextPtr;/* If templatePtr was part of a chain of
+ * templates, this points to the table
+ * corresponding to the next template in the
+ * chain. */
+ int numOptions; /* The number of items in the options array
+ * below. */
+ Option options[1]; /* Information about the individual options in
+ * the table. This must be the last field in
+ * the structure: the actual size of the array
+ * will be numOptions, not 1. */
} OptionTable;
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int DoObjConfig _ANSI_ARGS_((Tcl_Interp *interp,
- char *recordPtr, Option *optionPtr,
- Tcl_Obj *valuePtr, Tk_Window tkwin,
- Tk_SavedOption *savePtr));
-static void DestroyOptionHashTable _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp));
-static void FreeResources _ANSI_ARGS_((Option *optionPtr,
- Tcl_Obj *objPtr, char *internalPtr,
- Tk_Window tkwin));
-static Tcl_Obj * GetConfigList _ANSI_ARGS_((char *recordPtr,
- Option *optionPtr, Tk_Window tkwin));
-static Tcl_Obj * GetObjectForOption _ANSI_ARGS_((char *recordPtr,
- Option *optionPtr, Tk_Window tkwin));
-static Option * GetOption _ANSI_ARGS_((CONST char *name,
- OptionTable *tablePtr));
-static Option * GetOptionFromObj _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *objPtr, OptionTable *tablePtr));
-static int ObjectIsEmpty _ANSI_ARGS_((Tcl_Obj *objPtr));
-static int SetOptionFromAny _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *objPtr));
+static int DoObjConfig(Tcl_Interp *interp, char *recordPtr,
+ Option *optionPtr, Tcl_Obj *valuePtr,
+ Tk_Window tkwin, Tk_SavedOption *savePtr);
+static void DestroyOptionHashTable(ClientData clientData,
+ Tcl_Interp *interp);
+static void FreeResources(Option *optionPtr, Tcl_Obj *objPtr,
+ char *internalPtr, Tk_Window tkwin);
+static Tcl_Obj * GetConfigList(char *recordPtr,
+ Option *optionPtr, Tk_Window tkwin);
+static Tcl_Obj * GetObjectForOption(char *recordPtr,
+ Option *optionPtr, Tk_Window tkwin);
+static Option * GetOption(CONST char *name, OptionTable *tablePtr);
+static Option * GetOptionFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, OptionTable *tablePtr);
+static int ObjectIsEmpty(Tcl_Obj *objPtr);
+static int SetOptionFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
/*
- * The structure below defines an object type that is used to cache the
- * result of looking up an option name. If an object has this type, then
- * its internalPtr1 field points to the OptionTable in which it was looked up,
- * and the internalPtr2 field points to the entry that matched.
+ * The structure below defines an object type that is used to cache the result
+ * of looking up an option name. If an object has this type, then its
+ * internalPtr1 field points to the OptionTable in which it was looked up, and
+ * the internalPtr2 field points to the entry that matched.
*/
Tcl_ObjType tkOptionObjType = {
- "option", /* name */
- (Tcl_FreeInternalRepProc *) NULL, /* freeIntRepProc */
- (Tcl_DupInternalRepProc *) NULL, /* dupIntRepProc */
- (Tcl_UpdateStringProc *) NULL, /* updateStringProc */
- SetOptionFromAny /* setFromAnyProc */
+ "option", /* name */
+ NULL, /* freeIntRepProc */
+ NULL, /* dupIntRepProc */
+ NULL, /* updateStringProc */
+ SetOptionFromAny /* setFromAnyProc */
};
/*
@@ -153,12 +147,12 @@ Tcl_ObjType tkOptionObjType = {
*
* Tk_CreateOptionTable --
*
- * Given a template for configuration options, this procedure
- * creates a table that may be used to look up options efficiently.
+ * Given a template for configuration options, this function creates a
+ * table that may be used to look up options efficiently.
*
* Results:
- * Returns a token to a structure that can be passed to procedures
- * such as Tk_InitOptions, Tk_SetOptions, and Tk_FreeConfigOptions.
+ * Returns a token to a structure that can be passed to functions such as
+ * Tk_InitOptions, Tk_SetOptions, and Tk_FreeConfigOptions.
*
* Side effects:
* Storage is allocated.
@@ -167,12 +161,12 @@ Tcl_ObjType tkOptionObjType = {
*/
Tk_OptionTable
-Tk_CreateOptionTable(interp, templatePtr)
- Tcl_Interp *interp; /* Interpreter associated with the
- * application in which this table
- * will be used. */
- CONST Tk_OptionSpec *templatePtr; /* Static information about the
- * configuration options. */
+Tk_CreateOptionTable(
+ Tcl_Interp *interp, /* Interpreter associated with the application
+ * in which this table will be used. */
+ CONST Tk_OptionSpec *templatePtr)
+ /* Static information about the configuration
+ * options. */
{
Tcl_HashTable *hashTablePtr;
Tcl_HashEntry *hashEntryPtr;
@@ -183,13 +177,13 @@ Tk_CreateOptionTable(interp, templatePtr)
int numOptions, i;
/*
- * We use an AssocData value in the interpreter to keep a hash
- * table of all the option tables we've created for this application.
- * This is used for two purposes. First, it allows us to share the
- * tables (e.g. in several chains) and second, we use the deletion
- * callback for the AssocData to delete all the option tables when
- * the interpreter is deleted. The code below finds the hash table
- * or creates a new one if it doesn't already exist.
+ * We use an AssocData value in the interpreter to keep a hash table of
+ * all the option tables we've created for this application. This is used
+ * for two purposes. First, it allows us to share the tables (e.g. in
+ * several chains) and second, we use the deletion callback for the
+ * AssocData to delete all the option tables when the interpreter is
+ * deleted. The code below finds the hash table or creates a new one if it
+ * doesn't already exist.
*/
hashTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, OPTION_HASH_KEY,
@@ -202,8 +196,8 @@ Tk_CreateOptionTable(interp, templatePtr)
}
/*
- * See if a table has already been created for this template. If
- * so, just reuse the existing table.
+ * See if a table has already been created for this template. If so, just
+ * reuse the existing table.
*/
hashEntryPtr = Tcl_CreateHashEntry(hashTablePtr, (char *) templatePtr,
@@ -215,8 +209,8 @@ Tk_CreateOptionTable(interp, templatePtr)
}
/*
- * Count the number of options in the template, then create the
- * table structure.
+ * Count the number of options in the template, then create the table
+ * structure.
*/
numOptions = 0;
@@ -245,14 +239,13 @@ Tk_CreateOptionTable(interp, templatePtr)
if (specPtr->type == TK_OPTION_SYNONYM) {
/*
- * This is a synonym option; find the master option that it
- * refers to and create a pointer from the synonym to the
- * master.
+ * This is a synonym option; find the master option that it refers
+ * to and create a pointer from the synonym to the master.
*/
for (specPtr2 = templatePtr, i = 0; ; specPtr2++, i++) {
if (specPtr2->type == TK_OPTION_END) {
- panic("Tk_CreateOptionTable couldn't find synonym");
+ Tcl_Panic("Tk_CreateOptionTable couldn't find synonym");
}
if (strcmp(specPtr2->optionName,
(char *) specPtr->clientData) == 0) {
@@ -265,12 +258,10 @@ Tk_CreateOptionTable(interp, templatePtr)
optionPtr->dbNameUID = Tk_GetUid(specPtr->dbName);
}
if (specPtr->dbClass != NULL) {
- optionPtr->dbClassUID =
- Tk_GetUid(specPtr->dbClass);
+ optionPtr->dbClassUID = Tk_GetUid(specPtr->dbClass);
}
if (specPtr->defValue != NULL) {
- optionPtr->defaultPtr =
- Tcl_NewStringObj(specPtr->defValue, -1);
+ optionPtr->defaultPtr = Tcl_NewStringObj(specPtr->defValue,-1);
Tcl_IncrRefCount(optionPtr->defaultPtr);
}
if (((specPtr->type == TK_OPTION_COLOR)
@@ -286,7 +277,7 @@ Tk_CreateOptionTable(interp, templatePtr)
* Get the custom parsing, etc., functions.
*/
optionPtr->extra.custom =
- (Tk_ObjCustomOption *)specPtr->clientData;
+ (Tk_ObjCustomOption *) specPtr->clientData;
}
}
if (((specPtr->type == TK_OPTION_STRING)
@@ -304,9 +295,9 @@ Tk_CreateOptionTable(interp, templatePtr)
Tcl_SetHashValue(hashEntryPtr, tablePtr);
/*
- * Finally, check to see if this template chains to another template
- * with additional options. If so, call ourselves recursively to
- * create the next table(s).
+ * Finally, check to see if this template chains to another template with
+ * additional options. If so, call ourselves recursively to create the
+ * next table(s).
*/
if (specPtr->clientData != NULL) {
@@ -322,22 +313,22 @@ Tk_CreateOptionTable(interp, templatePtr)
*
* Tk_DeleteOptionTable --
*
- * Called to release resources used by an option table when
- * the table is no longer needed.
+ * Called to release resources used by an option table when the table is
+ * no longer needed.
*
* Results:
* None.
*
* Side effects:
- * The option table and associated resources (such as additional
- * option tables chained off it) are destroyed.
+ * The option table and associated resources (such as additional option
+ * tables chained off it) are destroyed.
*
*----------------------------------------------------------------------
*/
void
-Tk_DeleteOptionTable(optionTable)
- Tk_OptionTable optionTable; /* The option table to delete. */
+Tk_DeleteOptionTable(
+ Tk_OptionTable optionTable) /* The option table to delete. */
{
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
@@ -372,25 +363,25 @@ Tk_DeleteOptionTable(optionTable)
*
* DestroyOptionHashTable --
*
- * This procedure is the deletion callback associated with the
- * AssocData entry created by Tk_CreateOptionTable. It is
- * invoked when an interpreter is deleted, and deletes all of
- * the option tables associated with that interpreter.
+ * This function is the deletion callback associated with the AssocData
+ * entry created by Tk_CreateOptionTable. It is invoked when an
+ * interpreter is deleted, and deletes all of the option tables
+ * associated with that interpreter.
*
* Results:
* None.
*
* Side effects:
- * The option hash table is destroyed along with all of the
- * OptionTable structures that it refers to.
+ * The option hash table is destroyed along with all of the OptionTable
+ * structures that it refers to.
*
*----------------------------------------------------------------------
*/
static void
-DestroyOptionHashTable(clientData, interp)
- ClientData clientData; /* The hash table we are destroying */
- Tcl_Interp *interp; /* The interpreter we are destroying */
+DestroyOptionHashTable(
+ ClientData clientData, /* The hash table we are destroying */
+ Tcl_Interp *interp) /* The interpreter we are destroying */
{
Tcl_HashTable *hashTablePtr = (Tcl_HashTable *) clientData;
Tcl_HashSearch search;
@@ -404,13 +395,12 @@ DestroyOptionHashTable(clientData, interp)
/*
* The following statements do two tricky things:
- * 1. They ensure that the option table is deleted, even if
- * there are outstanding references to it.
- * 2. They ensure that Tk_DeleteOptionTable doesn't delete
- * other tables chained from this one; we'll do it when
- * we come across the hash table entry for the chained
- * table (in fact, the chained table may already have
- * been deleted).
+ * 1. They ensure that the option table is deleted, even if there are
+ * outstanding references to it.
+ * 2. They ensure that Tk_DeleteOptionTable doesn't delete other
+ * tables chained from this one; we'll do it when we come across
+ * the hash table entry for the chained table (in fact, the chained
+ * table may already have been deleted).
*/
tablePtr->refCount = 1;
@@ -426,16 +416,16 @@ DestroyOptionHashTable(clientData, interp)
*
* Tk_InitOptions --
*
- * This procedure is invoked when an object such as a widget
- * is created. It supplies an initial value for each configuration
- * option (the value may come from the option database, a system
- * default, or the default in the option table).
+ * This function is invoked when an object such as a widget is created.
+ * It supplies an initial value for each configuration option (the value
+ * may come from the option database, a system default, or the default in
+ * the option table).
*
* Results:
- * The return value is TCL_OK if the procedure completed
- * successfully, and TCL_ERROR if one of the initial values was
- * bogus. If an error occurs and interp isn't NULL, then an
- * error message will be left in its result.
+ * The return value is TCL_OK if the function completed successfully, and
+ * TCL_ERROR if one of the initial values was bogus. If an error occurs
+ * and interp isn't NULL, then an error message will be left in its
+ * result.
*
* Side effects:
* Fields of recordPtr are filled in with initial values.
@@ -444,21 +434,21 @@ DestroyOptionHashTable(clientData, interp)
*/
int
-Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
- Tcl_Interp *interp; /* Interpreter for error reporting. NULL
- * means don't leave an error message. */
- char *recordPtr; /* Pointer to the record to configure.
- * Note: the caller should have properly
- * initialized the record with NULL
- * pointers for each option value. */
- Tk_OptionTable optionTable; /* The token which matches the config
- * specs for the widget in question. */
- Tk_Window tkwin; /* Certain options types (such as
- * TK_OPTION_COLOR) need fields out
- * of the window they are used in to
- * be able to calculate their values.
- * Not needed unless one of these
- * options is in the configSpecs record. */
+Tk_InitOptions(
+ Tcl_Interp *interp, /* Interpreter for error reporting. NULL means
+ * don't leave an error message. */
+ char *recordPtr, /* Pointer to the record to configure. Note:
+ * the caller should have properly initialized
+ * the record with NULL pointers for each
+ * option value. */
+ Tk_OptionTable optionTable, /* The token which matches the config specs
+ * for the widget in question. */
+ Tk_Window tkwin) /* Certain options types (such as
+ * TK_OPTION_COLOR) need fields out of the
+ * window they are used in to be able to
+ * calculate their values. Not needed unless
+ * one of these options is in the configSpecs
+ * record. */
{
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
@@ -471,8 +461,8 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
/*
* If this table chains to other tables, handle their initialization
- * first. That way, if both tables refer to the same field of the
- * record, the value in the first table will win.
+ * first. That way, if both tables refer to the same field of the record,
+ * the value in the first table will win.
*/
if (tablePtr->nextPtr != NULL) {
@@ -489,11 +479,11 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
for (optionPtr = tablePtr->options, count = tablePtr->numOptions;
count > 0; optionPtr++, count--) {
-
/*
* If we specify TK_OPTION_DONT_SET_DEFAULT, then the user has
* processed and set a default for this already.
*/
+
if ((optionPtr->specPtr->type == TK_OPTION_SYNONYM) ||
(optionPtr->specPtr->flags & TK_OPTION_DONT_SET_DEFAULT)) {
continue;
@@ -502,12 +492,12 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
/*
* We look in three places for the initial value, using the first
- * non-NULL value that we find. First, check the option database.
+ * non-NULL value that we find. First, check the option database.
*/
valuePtr = NULL;
if (optionPtr->dbNameUID != NULL) {
- value = Tk_GetOption(tkwin, optionPtr->dbNameUID,
+ value = Tk_GetOption(tkwin, optionPtr->dbNameUID,
optionPtr->dbClassUID);
if (value != NULL) {
valuePtr = Tcl_NewStringObj(value, -1);
@@ -518,6 +508,7 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
/*
* Second, check for a system-specific default value.
*/
+
if ((valuePtr == NULL)
&& (optionPtr->dbNameUID != NULL)) {
valuePtr = TkpGetSystemDefault(tkwin, optionPtr->dbNameUID,
@@ -528,16 +519,16 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
}
/*
- * Third and last, use the default value supplied by the option
- * table. In the case of color objects, we pick one of two
- * values depending on whether the screen is mono or color.
+ * Third and last, use the default value supplied by the option table.
+ * In the case of color objects, we pick one of two values depending
+ * on whether the screen is mono or color.
*/
if (valuePtr == NULL) {
- if ((tkwin != NULL)
+ if ((tkwin != NULL)
&& ((optionPtr->specPtr->type == TK_OPTION_COLOR)
|| (optionPtr->specPtr->type == TK_OPTION_BORDER))
- && (Tk_Depth(tkwin) <= 1)
+ && (Tk_Depth(tkwin) <= 1)
&& (optionPtr->extra.monoColorPtr != NULL)) {
valuePtr = optionPtr->extra.monoColorPtr;
} else {
@@ -554,25 +545,26 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
* referenced here, and will be properly free'd when finished,
* regardless of what DoObjConfig does.
*/
+
Tcl_IncrRefCount(valuePtr);
-
+
if (DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin,
- (Tk_SavedOption *) NULL) != TCL_OK) {
+ NULL) != TCL_OK) {
if (interp != NULL) {
char msg[200];
-
+
switch (source) {
- case OPTION_DATABASE:
- sprintf(msg, "\n (database entry for \"%.50s\")",
- optionPtr->specPtr->optionName);
- break;
- case SYSTEM_DEFAULT:
- sprintf(msg, "\n (system default for \"%.50s\")",
- optionPtr->specPtr->optionName);
- break;
- case TABLE_DEFAULT:
- sprintf(msg, "\n (default value for \"%.50s\")",
- optionPtr->specPtr->optionName);
+ case OPTION_DATABASE:
+ sprintf(msg, "\n (database entry for \"%.50s\")",
+ optionPtr->specPtr->optionName);
+ break;
+ case SYSTEM_DEFAULT:
+ sprintf(msg, "\n (system default for \"%.50s\")",
+ optionPtr->specPtr->optionName);
+ break;
+ case TABLE_DEFAULT:
+ sprintf(msg, "\n (default value for \"%.50s\")",
+ optionPtr->specPtr->optionName);
}
if (tkwin != NULL) {
sprintf(msg + strlen(msg) - 1, " in widget \"%.50s\")",
@@ -593,40 +585,38 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
*
* DoObjConfig --
*
- * This procedure applies a new value for a configuration option
- * to the record being configured.
+ * This function applies a new value for a configuration option to the
+ * record being configured.
*
* Results:
- * The return value is TCL_OK if the procedure completed
- * successfully. If an error occurred then TCL_ERROR is
- * returned and an error message is left in interp's result, if
- * interp isn't NULL. In addition, if oldValuePtrPtr isn't
- * NULL then it *oldValuePtrPtr is filled in with a pointer
- * to the option's old value.
+ * The return value is TCL_OK if the function completed successfully. If
+ * an error occurred then TCL_ERROR is returned and an error message is
+ * left in interp's result, if interp isn't NULL. In addition, if
+ * oldValuePtrPtr isn't NULL then it *oldValuePtrPtr is filled in with a
+ * pointer to the option's old value.
*
* Side effects:
- * RecordPtr gets modified to hold the new value in the form of
- * a Tcl_Obj, an internal representation, or both. The old
- * value is freed if oldValuePtrPtr is NULL.
+ * RecordPtr gets modified to hold the new value in the form of a
+ * Tcl_Obj, an internal representation, or both. The old value is freed
+ * if oldValuePtrPtr is NULL.
*
*--------------------------------------------------------------
*/
static int
-DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr)
- Tcl_Interp *interp; /* Interpreter for error reporting. If
- * NULL, then no message is left if an error
+DoObjConfig(
+ Tcl_Interp *interp, /* Interpreter for error reporting. If NULL,
+ * then no message is left if an error
* occurs. */
- char *recordPtr; /* The record to modify to hold the new
- * option value. */
- Option *optionPtr; /* Pointer to information about the
- * option. */
- Tcl_Obj *valuePtr; /* New value for option. */
- Tk_Window tkwin; /* Window in which option will be used (needed
+ char *recordPtr, /* The record to modify to hold the new option
+ * value. */
+ Option *optionPtr, /* Pointer to information about the option. */
+ Tcl_Obj *valuePtr, /* New value for option. */
+ Tk_Window tkwin, /* Window in which option will be used (needed
* to allocate resources for some options).
- * May be NULL if the option doesn't
- * require window-related resources. */
- Tk_SavedOption *savedOptionPtr;
+ * May be NULL if the option doesn't require
+ * window-related resources. */
+ Tk_SavedOption *savedOptionPtr)
/* If NULL, the old value for the option will
* be freed. If non-NULL, the old value will
* be stored here, and it becomes the property
@@ -634,13 +624,14 @@ DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr)
* free the old value). */
{
Tcl_Obj **slotPtrPtr, *oldPtr;
- char *internalPtr; /* Points to location in record where
- * internal representation of value should
- * be stored, or NULL. */
+ char *internalPtr; /* Points to location in record where internal
+ * representation of value should be stored,
+ * or NULL. */
char *oldInternalPtr; /* Points to location in which to save old
* internal representation of value. */
- Tk_SavedOption internal; /* Used to save the old internal representation
- * of the value if savedOptionPtr is NULL. */
+ Tk_SavedOption internal; /* Used to save the old internal
+ * representation of the value if
+ * savedOptionPtr is NULL. */
CONST Tk_OptionSpec *specPtr;
int nullOK;
@@ -658,8 +649,8 @@ DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr)
}
/*
- * Apply the new value in a type-specific way. Also remember the
- * old object and internal forms, if they exist.
+ * Apply the new value in a type-specific way. Also remember the old
+ * object and internal forms, if they exist.
*/
if (specPtr->internalOffset >= 0) {
@@ -676,296 +667,293 @@ DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr)
}
nullOK = (optionPtr->specPtr->flags & TK_OPTION_NULL_OK);
switch (optionPtr->specPtr->type) {
- case TK_OPTION_BOOLEAN: {
- int new;
+ case TK_OPTION_BOOLEAN: {
+ int newBool;
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &new)
- != TCL_OK) {
- return TCL_ERROR;
- }
- if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = new;
- }
- break;
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &newBool) != TCL_OK) {
+ return TCL_ERROR;
}
- case TK_OPTION_INT: {
- int new;
-
- if (Tcl_GetIntFromObj(interp, valuePtr, &new) != TCL_OK) {
- return TCL_ERROR;
- }
- if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = new;
- }
- break;
+ if (internalPtr != NULL) {
+ *((int *) oldInternalPtr) = *((int *) internalPtr);
+ *((int *) internalPtr) = newBool;
}
- case TK_OPTION_DOUBLE: {
- double new;
-
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = 0;
- } else {
- if (Tcl_GetDoubleFromObj(interp, valuePtr, &new) != TCL_OK) {
- return TCL_ERROR;
- }
- }
+ break;
+ }
+ case TK_OPTION_INT: {
+ int newInt;
- if (internalPtr != NULL) {
- *((double *) oldInternalPtr) = *((double *) internalPtr);
- *((double *) internalPtr) = new;
- }
- break;
+ if (Tcl_GetIntFromObj(interp, valuePtr, &newInt) != TCL_OK) {
+ return TCL_ERROR;
}
- case TK_OPTION_STRING: {
- char *new, *value;
- int length;
-
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- }
- if (internalPtr != NULL) {
- if (valuePtr != NULL) {
- value = Tcl_GetStringFromObj(valuePtr, &length);
- new = ckalloc((unsigned) (length + 1));
- strcpy(new, value);
- } else {
- new = NULL;
- }
- *((char **) oldInternalPtr) = *((char **) internalPtr);
- *((char **) internalPtr) = new;
- }
- break;
+ if (internalPtr != NULL) {
+ *((int *) oldInternalPtr) = *((int *) internalPtr);
+ *((int *) internalPtr) = newInt;
}
- case TK_OPTION_STRING_TABLE: {
- int new;
+ break;
+ }
+ case TK_OPTION_DOUBLE: {
+ double newDbl;
- if (Tcl_GetIndexFromObj(interp, valuePtr,
- (CONST char **) optionPtr->specPtr->clientData,
- optionPtr->specPtr->optionName+1, 0, &new) != TCL_OK) {
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newDbl = 0;
+ } else {
+ if (Tcl_GetDoubleFromObj(interp, valuePtr, &newDbl) != TCL_OK) {
return TCL_ERROR;
}
- if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = new;
- }
- break;
}
- case TK_OPTION_COLOR: {
- XColor *newPtr;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- newPtr = NULL;
- } else {
- newPtr = Tk_AllocColorFromObj(interp, tkwin, valuePtr);
- if (newPtr == NULL) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((XColor **) oldInternalPtr) = *((XColor **) internalPtr);
- *((XColor **) internalPtr) = newPtr;
- }
- break;
+ if (internalPtr != NULL) {
+ *((double *) oldInternalPtr) = *((double *) internalPtr);
+ *((double *) internalPtr) = newDbl;
}
- case TK_OPTION_FONT: {
- Tk_Font new;
+ break;
+ }
+ case TK_OPTION_STRING: {
+ char *newStr, *value;
+ int length;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = NULL;
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ }
+ if (internalPtr != NULL) {
+ if (valuePtr != NULL) {
+ value = Tcl_GetStringFromObj(valuePtr, &length);
+ newStr = ckalloc((unsigned) (length + 1));
+ strcpy(newStr, value);
} else {
- new = Tk_AllocFontFromObj(interp, tkwin, valuePtr);
- if (new == NULL) {
- return TCL_ERROR;
- }
+ newStr = NULL;
}
- if (internalPtr != NULL) {
- *((Tk_Font *) oldInternalPtr) = *((Tk_Font *) internalPtr);
- *((Tk_Font *) internalPtr) = new;
- }
- break;
+ *((char **) oldInternalPtr) = *((char **) internalPtr);
+ *((char **) internalPtr) = newStr;
}
- case TK_OPTION_STYLE: {
- Tk_Style new;
+ break;
+ }
+ case TK_OPTION_STRING_TABLE: {
+ int newValue;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = NULL;
- } else {
- new = Tk_AllocStyleFromObj(interp, valuePtr);
- if (new == NULL) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((Tk_Style *) oldInternalPtr) = *((Tk_Style *) internalPtr);
- *((Tk_Style *) internalPtr) = new;
- }
- break;
+ if (Tcl_GetIndexFromObj(interp, valuePtr,
+ (CONST char **) optionPtr->specPtr->clientData,
+ optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (internalPtr != NULL) {
+ *((int *) oldInternalPtr) = *((int *) internalPtr);
+ *((int *) internalPtr) = newValue;
}
- case TK_OPTION_BITMAP: {
- Pixmap new;
+ break;
+ }
+ case TK_OPTION_COLOR: {
+ XColor *newPtr;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = None;
- } else {
- new = Tk_AllocBitmapFromObj(interp, tkwin, valuePtr);
- if (new == None) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((Pixmap *) oldInternalPtr) = *((Pixmap *) internalPtr);
- *((Pixmap *) internalPtr) = new;
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newPtr = NULL;
+ } else {
+ newPtr = Tk_AllocColorFromObj(interp, tkwin, valuePtr);
+ if (newPtr == NULL) {
+ return TCL_ERROR;
}
- break;
}
- case TK_OPTION_BORDER: {
- Tk_3DBorder new;
+ if (internalPtr != NULL) {
+ *((XColor **) oldInternalPtr) = *((XColor **) internalPtr);
+ *((XColor **) internalPtr) = newPtr;
+ }
+ break;
+ }
+ case TK_OPTION_FONT: {
+ Tk_Font newFont;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = NULL;
- } else {
- new = Tk_Alloc3DBorderFromObj(interp, tkwin, valuePtr);
- if (new == NULL) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((Tk_3DBorder *) oldInternalPtr) =
- *((Tk_3DBorder *) internalPtr);
- *((Tk_3DBorder *) internalPtr) = new;
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newFont = NULL;
+ } else {
+ newFont = Tk_AllocFontFromObj(interp, tkwin, valuePtr);
+ if (newFont == NULL) {
+ return TCL_ERROR;
}
- break;
}
- case TK_OPTION_RELIEF: {
- int new;
+ if (internalPtr != NULL) {
+ *((Tk_Font *) oldInternalPtr) = *((Tk_Font *) internalPtr);
+ *((Tk_Font *) internalPtr) = newFont;
+ }
+ break;
+ }
+ case TK_OPTION_STYLE: {
+ Tk_Style newStyle;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = TK_RELIEF_NULL;
- } else {
- if (Tk_GetReliefFromObj(interp, valuePtr, &new) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = new;
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newStyle = NULL;
+ } else {
+ newStyle = Tk_AllocStyleFromObj(interp, valuePtr);
+ if (newStyle == NULL) {
+ return TCL_ERROR;
}
- break;
}
- case TK_OPTION_CURSOR: {
- Tk_Cursor new;
+ if (internalPtr != NULL) {
+ *((Tk_Style *) oldInternalPtr) = *((Tk_Style *) internalPtr);
+ *((Tk_Style *) internalPtr) = newStyle;
+ }
+ break;
+ }
+ case TK_OPTION_BITMAP: {
+ Pixmap newBitmap;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- new = None;
- valuePtr = NULL;
- } else {
- new = Tk_AllocCursorFromObj(interp, tkwin, valuePtr);
- if (new == None) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((Tk_Cursor *) oldInternalPtr) = *((Tk_Cursor *) internalPtr);
- *((Tk_Cursor *) internalPtr) = new;
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newBitmap = None;
+ } else {
+ newBitmap = Tk_AllocBitmapFromObj(interp, tkwin, valuePtr);
+ if (newBitmap == None) {
+ return TCL_ERROR;
}
- Tk_DefineCursor(tkwin, new);
- break;
}
- case TK_OPTION_JUSTIFY: {
- Tk_Justify new;
+ if (internalPtr != NULL) {
+ *((Pixmap *) oldInternalPtr) = *((Pixmap *) internalPtr);
+ *((Pixmap *) internalPtr) = newBitmap;
+ }
+ break;
+ }
+ case TK_OPTION_BORDER: {
+ Tk_3DBorder newBorder;
- if (Tk_GetJustifyFromObj(interp, valuePtr, &new) != TCL_OK) {
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newBorder = NULL;
+ } else {
+ newBorder = Tk_Alloc3DBorderFromObj(interp, tkwin, valuePtr);
+ if (newBorder == NULL) {
return TCL_ERROR;
}
- if (internalPtr != NULL) {
- *((Tk_Justify *) oldInternalPtr)
- = *((Tk_Justify *) internalPtr);
- *((Tk_Justify *) internalPtr) = new;
- }
- break;
}
- case TK_OPTION_ANCHOR: {
- Tk_Anchor new;
+ if (internalPtr != NULL) {
+ *((Tk_3DBorder *) oldInternalPtr) = *((Tk_3DBorder *) internalPtr);
+ *((Tk_3DBorder *) internalPtr) = newBorder;
+ }
+ break;
+ }
+ case TK_OPTION_RELIEF: {
+ int newRelief;
- if (Tk_GetAnchorFromObj(interp, valuePtr, &new) != TCL_OK) {
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newRelief = TK_RELIEF_NULL;
+ } else {
+ if (Tk_GetReliefFromObj(interp, valuePtr, &newRelief) != TCL_OK) {
return TCL_ERROR;
}
- if (internalPtr != NULL) {
- *((Tk_Anchor *) oldInternalPtr)
- = *((Tk_Anchor *) internalPtr);
- *((Tk_Anchor *) internalPtr) = new;
- }
- break;
}
- case TK_OPTION_PIXELS: {
- int new;
+ if (internalPtr != NULL) {
+ *((int *) oldInternalPtr) = *((int *) internalPtr);
+ *((int *) internalPtr) = newRelief;
+ }
+ break;
+ }
+ case TK_OPTION_CURSOR: {
+ Tk_Cursor newCursor;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = 0;
- } else {
- if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr,
- &new) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = new;
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ newCursor = None;
+ valuePtr = NULL;
+ } else {
+ newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr);
+ if (newCursor == None) {
+ return TCL_ERROR;
}
- break;
}
- case TK_OPTION_WINDOW: {
- Tk_Window new;
+ if (internalPtr != NULL) {
+ *((Tk_Cursor *) oldInternalPtr) = *((Tk_Cursor *) internalPtr);
+ *((Tk_Cursor *) internalPtr) = newCursor;
+ }
+ Tk_DefineCursor(tkwin, newCursor);
+ break;
+ }
+ case TK_OPTION_JUSTIFY: {
+ Tk_Justify newJustify;
- if (nullOK && ObjectIsEmpty(valuePtr)) {
- valuePtr = NULL;
- new = None;
- } else {
- if (TkGetWindowFromObj(interp, tkwin, valuePtr, &new)
- != TCL_OK) {
- return TCL_ERROR;
- }
- }
- if (internalPtr != NULL) {
- *((Tk_Window *) oldInternalPtr) = *((Tk_Window *) internalPtr);
- *((Tk_Window *) internalPtr) = new;
+ if (Tk_GetJustifyFromObj(interp, valuePtr, &newJustify) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (internalPtr != NULL) {
+ *((Tk_Justify *) oldInternalPtr) = *((Tk_Justify *) internalPtr);
+ *((Tk_Justify *) internalPtr) = newJustify;
+ }
+ break;
+ }
+ case TK_OPTION_ANCHOR: {
+ Tk_Anchor newAnchor;
+
+ if (Tk_GetAnchorFromObj(interp, valuePtr, &newAnchor) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (internalPtr != NULL) {
+ *((Tk_Anchor *) oldInternalPtr) = *((Tk_Anchor *) internalPtr);
+ *((Tk_Anchor *) internalPtr) = newAnchor;
+ }
+ break;
+ }
+ case TK_OPTION_PIXELS: {
+ int newPixels;
+
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newPixels = 0;
+ } else {
+ if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr,
+ &newPixels) != TCL_OK) {
+ return TCL_ERROR;
}
- break;
}
- case TK_OPTION_CUSTOM: {
- Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- if (custom->setProc(custom->clientData, interp, tkwin,
- &valuePtr, recordPtr, optionPtr->specPtr->internalOffset,
- (char *)oldInternalPtr,
- optionPtr->specPtr->flags) != TCL_OK) {
+ if (internalPtr != NULL) {
+ *((int *) oldInternalPtr) = *((int *) internalPtr);
+ *((int *) internalPtr) = newPixels;
+ }
+ break;
+ }
+ case TK_OPTION_WINDOW: {
+ Tk_Window newWin;
+
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newWin = None;
+ } else {
+ if (TkGetWindowFromObj(interp, tkwin, valuePtr,
+ &newWin) != TCL_OK) {
return TCL_ERROR;
}
- break;
}
-
- default: {
- char buf[40+TCL_INTEGER_SPACE];
- sprintf(buf, "bad config table: unknown type %d",
- optionPtr->specPtr->type);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ if (internalPtr != NULL) {
+ *((Tk_Window *) oldInternalPtr) = *((Tk_Window *) internalPtr);
+ *((Tk_Window *) internalPtr) = newWin;
+ }
+ break;
+ }
+ case TK_OPTION_CUSTOM: {
+ Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+
+ if (custom->setProc(custom->clientData, interp, tkwin,
+ &valuePtr, recordPtr, optionPtr->specPtr->internalOffset,
+ (char *)oldInternalPtr, optionPtr->specPtr->flags) != TCL_OK) {
return TCL_ERROR;
}
+ break;
+ }
+
+ {
+ char buf[40+TCL_INTEGER_SPACE];
+
+ default:
+ sprintf(buf, "bad config table: unknown type %d",
+ optionPtr->specPtr->type);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
}
/*
- * Release resources associated with the old value, if we're not
- * returning it to the caller, then install the new object value into
- * the record.
+ * Release resources associated with the old value, if we're not returning
+ * it to the caller, then install the new object value into the record.
*/
if (savedOptionPtr == NULL) {
@@ -990,12 +978,11 @@ DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr)
*
* ObjectIsEmpty --
*
- * This procedure tests whether the string value of an object is
- * empty.
+ * This function tests whether the string value of an object is empty.
*
* Results:
- * The return value is 1 if the string value of objPtr has length
- * zero, and 0 otherwise.
+ * The return value is 1 if the string value of objPtr has length zero,
+ * and 0 otherwise.
*
* Side effects:
* None.
@@ -1004,8 +991,8 @@ DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr)
*/
static int
-ObjectIsEmpty(objPtr)
- Tcl_Obj *objPtr; /* Object to test. May be NULL. */
+ObjectIsEmpty(
+ Tcl_Obj *objPtr) /* Object to test. May be NULL. */
{
int length;
@@ -1024,15 +1011,14 @@ ObjectIsEmpty(objPtr)
*
* GetOption --
*
- * This procedure searches through a chained option table to find
- * the entry for a particular option name.
+ * This function searches through a chained option table to find the
+ * entry for a particular option name.
*
* Results:
- * The return value is a pointer to the matching entry, or NULL
- * if no matching entry could be found.
- * Note: if the matching entry is a synonym then this procedure
- * returns a pointer to the synonym entry, *not* the "real" entry
- * that the synonym refers to.
+ * The return value is a pointer to the matching entry, or NULL if no
+ * matching entry could be found. Note: if the matching entry is a
+ * synonym then this function returns a pointer to the synonym entry,
+ * *not* the "real" entry that the synonym refers to.
*
* Side effects:
* None.
@@ -1041,10 +1027,10 @@ ObjectIsEmpty(objPtr)
*/
static Option *
-GetOption(name, tablePtr)
- CONST char *name; /* String balue to be looked up in the
- * option table. */
- OptionTable *tablePtr; /* Table in which to look up name. */
+GetOption(
+ CONST char *name, /* String balue to be looked up in the option
+ * table. */
+ OptionTable *tablePtr) /* Table in which to look up name. */
{
Option *bestPtr, *optionPtr;
OptionTable *tablePtr2;
@@ -1052,14 +1038,13 @@ GetOption(name, tablePtr)
int count;
/*
- * Search through all of the option tables in the chain to find the
- * best match. Some tricky aspects:
+ * Search through all of the option tables in the chain to find the best
+ * match. Some tricky aspects:
*
* 1. We have to accept unique abbreviations.
- * 2. The same name could appear in different tables in the chain.
- * If this happens, we use the entry from the first table. We
- * have to be careful to distinguish this case from an ambiguous
- * abbreviation.
+ * 2. The same name could appear in different tables in the chain. If this
+ * happens, we use the entry from the first table. We have to be
+ * careful to distinguish this case from an ambiguous abbreviation.
*/
bestPtr = NULL;
@@ -1071,40 +1056,38 @@ GetOption(name, tablePtr)
*p1 == *p2; p1++, p2++) {
if (*p1 == 0) {
/*
- * This is an exact match. We're done.
+ * This is an exact match. We're done.
*/
- bestPtr = optionPtr;
- goto done;
+ return optionPtr;
}
}
if (*p1 == 0) {
/*
- * The name is an abbreviation for this option. Keep
- * to make sure that the abbreviation only matches one
- * option name. If we've already found a match in the
- * past, then it is an error unless the full names for
- * the two options are identical; in this case, the first
- * option overrides the second.
+ * The name is an abbreviation for this option. Keep to make
+ * sure that the abbreviation only matches one option name.
+ * If we've already found a match in the past, then it is an
+ * error unless the full names for the two options are
+ * identical; in this case, the first option overrides the
+ * second.
*/
if (bestPtr == NULL) {
bestPtr = optionPtr;
- } else {
- if (strcmp(bestPtr->specPtr->optionName,
- optionPtr->specPtr->optionName) != 0) {
- goto error;
- }
+ } else if (strcmp(bestPtr->specPtr->optionName,
+ optionPtr->specPtr->optionName) != 0) {
+ return NULL;
}
}
}
}
- done:
- return bestPtr;
+ /*
+ * Return whatever we have found, which could be NULL if nothing
+ * matched. The multiple-matching case is handled above.
+ */
- error:
- return NULL;
+ return bestPtr;
}
/*
@@ -1112,32 +1095,30 @@ GetOption(name, tablePtr)
*
* GetOptionFromObj --
*
- * This procedure searches through a chained option table to find
- * the entry for a particular option name.
+ * This function searches through a chained option table to find the
+ * entry for a particular option name.
*
* Results:
- * The return value is a pointer to the matching entry, or NULL
- * if no matching entry could be found. If NULL is returned and
- * interp is not NULL than an error message is left in its result.
- * Note: if the matching entry is a synonym then this procedure
- * returns a pointer to the synonym entry, *not* the "real" entry
- * that the synonym refers to.
+ * The return value is a pointer to the matching entry, or NULL if no
+ * matching entry could be found. If NULL is returned and interp is not
+ * NULL than an error message is left in its result. Note: if the
+ * matching entry is a synonym then this function returns a pointer to
+ * the synonym entry, *not* the "real" entry that the synonym refers to.
*
* Side effects:
- * Information about the matching entry is cached in the object
- * containing the name, so that future lookups can proceed more
- * quickly.
+ * Information about the matching entry is cached in the object
+ * containing the name, so that future lookups can proceed more quickly.
*
*----------------------------------------------------------------------
*/
static Option *
-GetOptionFromObj(interp, objPtr, tablePtr)
- Tcl_Interp *interp; /* Used only for error reporting; if NULL
- * no message is left after an error. */
- Tcl_Obj *objPtr; /* Object whose string value is to be
- * looked up in the option table. */
- OptionTable *tablePtr; /* Table in which to look up objPtr. */
+GetOptionFromObj(
+ Tcl_Interp *interp, /* Used only for error reporting; if NULL no
+ * message is left after an error. */
+ Tcl_Obj *objPtr, /* Object whose string value is to be looked
+ * up in the option table. */
+ OptionTable *tablePtr) /* Table in which to look up objPtr. */
{
Option *bestPtr;
char *name;
@@ -1147,16 +1128,16 @@ GetOptionFromObj(interp, objPtr, tablePtr)
*/
if (objPtr->typePtr == &tkOptionObjType) {
- if (objPtr->internalRep.twoPtrValue.ptr1 == (VOID *) tablePtr) {
- return (Option *) objPtr->internalRep.twoPtrValue.ptr2;
- }
+ if (objPtr->internalRep.twoPtrValue.ptr1 == (void *) tablePtr) {
+ return (Option *) objPtr->internalRep.twoPtrValue.ptr2;
+ }
}
/*
* The answer isn't cached.
*/
- name = Tcl_GetStringFromObj(objPtr, NULL);
+ name = Tcl_GetString(objPtr);
bestPtr = GetOption(name, tablePtr);
if (bestPtr == NULL) {
goto error;
@@ -1166,15 +1147,14 @@ GetOptionFromObj(interp, objPtr, tablePtr)
&& (objPtr->typePtr->freeIntRepProc != NULL)) {
objPtr->typePtr->freeIntRepProc(objPtr);
}
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) tablePtr;
- objPtr->internalRep.twoPtrValue.ptr2 = (VOID *) bestPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) tablePtr;
+ objPtr->internalRep.twoPtrValue.ptr2 = (void *) bestPtr;
objPtr->typePtr = &tkOptionObjType;
return bestPtr;
- error:
+ error:
if (interp != NULL) {
- Tcl_AppendResult(interp, "unknown option \"", name,
- "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "unknown option \"", name, "\"", NULL);
}
return NULL;
}
@@ -1184,29 +1164,28 @@ GetOptionFromObj(interp, objPtr, tablePtr)
*
* TkGetOptionSpec --
*
- * This procedure searches through a chained option table to find
- * the option spec for a particular option name.
+ * This function searches through a chained option table to find the
+ * option spec for a particular option name.
*
* Results:
- * The return value is a pointer to the option spec of the matching
- * entry, or NULL if no matching entry could be found.
- * Note: if the matching entry is a synonym then this procedure
- * returns a pointer to the option spec of the synonym entry, *not*
- * the "real" entry that the synonym refers to.
- * Note: this call is primarily used by the style management code
- * (tkStyle.c) to look up an element's option spec into a widget's
- * option table.
+ * The return value is a pointer to the option spec of the matching
+ * entry, or NULL if no matching entry could be found. Note: if the
+ * matching entry is a synonym then this function returns a pointer to
+ * the option spec of the synonym entry, *not* the "real" entry that the
+ * synonym refers to. Note: this call is primarily used by the style
+ * management code (tkStyle.c) to look up an element's option spec into a
+ * widget's option table.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
CONST Tk_OptionSpec *
-TkGetOptionSpec(name, optionTable)
- CONST char *name; /* String value to be looked up. */
- Tk_OptionTable optionTable; /* Table in which to look up name. */
+TkGetOptionSpec(
+ CONST char *name, /* String value to be looked up. */
+ Tk_OptionTable optionTable) /* Table in which to look up name. */
{
Option *optionPtr;
@@ -1222,14 +1201,14 @@ TkGetOptionSpec(name, optionTable)
*
* SetOptionFromAny --
*
- * This procedure is called to convert a Tcl object to option
- * internal form. However, this doesn't make sense (need to have a
- * table of options in order to do the conversion) so the
- * procedure always generates an error.
+ * This function is called to convert a Tcl object to option internal
+ * form. However, this doesn't make sense (need to have a table of
+ * options in order to do the conversion) so the function always
+ * generates an error.
*
* Results:
- * The return value is always TCL_ERROR, and an error message is
- * left in interp's result if interp isn't NULL.
+ * The return value is always TCL_ERROR, and an error message is left in
+ * interp's result if interp isn't NULL.
*
* Side effects:
* None.
@@ -1238,9 +1217,9 @@ TkGetOptionSpec(name, optionTable)
*/
static int
-SetOptionFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- register Tcl_Obj *objPtr; /* The object to convert. */
+SetOptionFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ register Tcl_Obj *objPtr) /* The object to convert. */
{
Tcl_AppendToObj(Tcl_GetObjResult(interp),
"can't convert value to option except via GetOptionFromObj API",
@@ -1253,53 +1232,47 @@ SetOptionFromAny(interp, objPtr)
*
* Tk_SetOptions --
*
- * Process one or more name-value pairs for configuration options
- * and fill in fields of a record with new values.
+ * Process one or more name-value pairs for configuration options and
+ * fill in fields of a record with new values.
*
* Results:
- * If all goes well then TCL_OK is returned and the old values of
- * any modified objects are saved in *savePtr, if it isn't NULL (the
- * caller must eventually call Tk_RestoreSavedOptions or
- * Tk_FreeSavedOptions to free the contents of *savePtr). In
- * addition, if maskPtr isn't NULL then *maskPtr is filled in with
- * the OR of the typeMask bits from all modified options. If an
- * error occurs then TCL_ERROR is returned and a message
- * is left in interp's result unless interp is NULL; nothing is
+ * If all goes well then TCL_OK is returned and the old values of any
+ * modified objects are saved in *savePtr, if it isn't NULL (the caller
+ * must eventually call Tk_RestoreSavedOptions or Tk_FreeSavedOptions to
+ * free the contents of *savePtr). In addition, if maskPtr isn't NULL
+ * then *maskPtr is filled in with the OR of the typeMask bits from all
+ * modified options. If an error occurs then TCL_ERROR is returned and a
+ * message is left in interp's result unless interp is NULL; nothing is
* saved in *savePtr or *maskPtr in this case.
*
* Side effects:
- * The fields of recordPtr get filled in with object pointers
- * from objc/objv. Old information in widgRec's fields gets
- * recycled. Information may be left at *savePtr.
+ * The fields of recordPtr get filled in with object pointers from
+ * objc/objv. Old information in widgRec's fields gets recycled.
+ * Information may be left at *savePtr.
*
*--------------------------------------------------------------
*/
int
-Tk_SetOptions(interp, recordPtr, optionTable, objc, objv, tkwin, savePtr,
- maskPtr)
- Tcl_Interp *interp; /* Interpreter for error reporting.
- * If NULL, then no error message is
- * returned.*/
- char *recordPtr; /* The record to configure. */
- Tk_OptionTable optionTable; /* Describes valid options. */
- int objc; /* The number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Contains one or more name-value
- * pairs. */
- Tk_Window tkwin; /* Window associated with the thing
- * being configured; needed for some
- * options (such as colors). */
- Tk_SavedOptions *savePtr; /* If non-NULL, the old values of
- * modified options are saved here
- * so that they can be restored
- * after an error. */
- int *maskPtr; /* It non-NULL, this word is modified
- * on a successful return to hold the
- * bit-wise OR of the typeMask fields
- * of all options that were modified
- * by this call. Used by the caller
- * to figure out which options
- * actually changed. */
+Tk_SetOptions(
+ Tcl_Interp *interp, /* Interpreter for error reporting. If NULL,
+ * then no error message is returned.*/
+ char *recordPtr, /* The record to configure. */
+ Tk_OptionTable optionTable, /* Describes valid options. */
+ int objc, /* The number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Contains one or more name-value pairs. */
+ Tk_Window tkwin, /* Window associated with the thing being
+ * configured; needed for some options (such
+ * as colors). */
+ Tk_SavedOptions *savePtr, /* If non-NULL, the old values of modified
+ * options are saved here so that they can be
+ * restored after an error. */
+ int *maskPtr) /* It non-NULL, this word is modified on a
+ * successful return to hold the bit-wise OR
+ * of the typeMask fields of all options that
+ * were modified by this call. Used by the
+ * caller to figure out which options actually
+ * changed. */
{
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
@@ -1315,8 +1288,8 @@ Tk_SetOptions(interp, recordPtr, optionTable, objc, objv, tkwin, savePtr,
lastSavePtr = savePtr;
/*
- * Scan through all of the arguments, processing those
- * that match entries in the option table.
+ * Scan through all of the arguments, processing those that match entries
+ * in the option table.
*/
mask = 0;
@@ -1333,19 +1306,18 @@ Tk_SetOptions(interp, recordPtr, optionTable, objc, objv, tkwin, savePtr,
if (interp != NULL) {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"value for \"", Tcl_GetStringFromObj(*objv, NULL),
- "\" missing", (char *) NULL);
+ "\" missing", NULL);
goto error;
}
}
if ((savePtr != NULL)
&& (lastSavePtr->numItems >= TK_NUM_SAVED_OPTIONS)) {
/*
- * We've run out of space for saving old option values. Allocate
+ * We've run out of space for saving old option values. Allocate
* more space.
*/
- newSavePtr = (Tk_SavedOptions *) ckalloc(sizeof(
- Tk_SavedOptions));
+ newSavePtr = (Tk_SavedOptions *) ckalloc(sizeof(Tk_SavedOptions));
newSavePtr->recordPtr = recordPtr;
newSavePtr->tkwin = tkwin;
newSavePtr->numItems = 0;
@@ -1355,7 +1327,7 @@ Tk_SetOptions(interp, recordPtr, optionTable, objc, objv, tkwin, savePtr,
}
if (DoObjConfig(interp, recordPtr, optionPtr, objv[1], tkwin,
(savePtr != NULL) ? &lastSavePtr->items[lastSavePtr->numItems]
- : (Tk_SavedOption *) NULL) != TCL_OK) {
+ : NULL) != TCL_OK) {
char msg[100];
sprintf(msg, "\n (processing \"%.40s\" option)",
@@ -1373,7 +1345,7 @@ Tk_SetOptions(interp, recordPtr, optionTable, objc, objv, tkwin, savePtr,
}
return TCL_OK;
- error:
+ error:
if (savePtr != NULL) {
Tk_RestoreSavedOptions(savePtr);
}
@@ -1385,38 +1357,38 @@ Tk_SetOptions(interp, recordPtr, optionTable, objc, objv, tkwin, savePtr,
*
* Tk_RestoreSavedOptions --
*
- * This procedure undoes the effect of a previous call to
- * Tk_SetOptions by restoring all of the options to their value
- * before the call to Tk_SetOptions.
+ * This function undoes the effect of a previous call to Tk_SetOptions by
+ * restoring all of the options to their value before the call to
+ * Tk_SetOptions.
*
* Results:
* None.
*
* Side effects:
- * The configutation record is restored and all the information
- * stored in savePtr is freed.
+ * The configutation record is restored and all the information stored in
+ * savePtr is freed.
*
*----------------------------------------------------------------------
*/
void
-Tk_RestoreSavedOptions(savePtr)
- Tk_SavedOptions *savePtr; /* Holds saved option information; must
- * have been passed to Tk_SetOptions. */
+Tk_RestoreSavedOptions(
+ Tk_SavedOptions *savePtr) /* Holds saved option information; must have
+ * been passed to Tk_SetOptions. */
{
int i;
Option *optionPtr;
Tcl_Obj *newPtr; /* New object value of option, which we
- * replace with old value and free. Taken
- * from record. */
+ * replace with old value and free. Taken from
+ * record. */
char *internalPtr; /* Points to internal value of option in
* record. */
CONST Tk_OptionSpec *specPtr;
/*
- * Be sure to restore the options in the opposite order they were
- * set. This is important because it's possible that the same
- * option name was used twice in a single call to Tk_SetOptions.
+ * Be sure to restore the options in the opposite order they were set.
+ * This is important because it's possible that the same option name was
+ * used twice in a single call to Tk_SetOptions.
*/
if (savePtr->nextPtr != NULL) {
@@ -1429,8 +1401,8 @@ Tk_RestoreSavedOptions(savePtr)
specPtr = optionPtr->specPtr;
/*
- * First free the new value of the option, which is currently
- * in the record.
+ * First free the new value of the option, which is currently in the
+ * record.
*/
if (specPtr->objOffset >= 0) {
@@ -1459,101 +1431,69 @@ Tk_RestoreSavedOptions(savePtr)
= savePtr->items[i].valuePtr;
}
if (specPtr->internalOffset >= 0) {
+ register char *ptr = (char *) &savePtr->items[i].internalForm;
+
switch (specPtr->type) {
- case TK_OPTION_BOOLEAN: {
- *((int *) internalPtr)
- = *((int *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_INT: {
- *((int *) internalPtr)
- = *((int *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_DOUBLE: {
- *((double *) internalPtr)
- = *((double *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_STRING: {
- *((char **) internalPtr)
- = *((char **) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_STRING_TABLE: {
- *((int *) internalPtr)
- = *((int *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_COLOR: {
- *((XColor **) internalPtr)
- = *((XColor **) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_FONT: {
- *((Tk_Font *) internalPtr)
- = *((Tk_Font *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_STYLE: {
- *((Tk_Style *) internalPtr)
- = *((Tk_Style *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_BITMAP: {
- *((Pixmap *) internalPtr)
- = *((Pixmap *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_BORDER: {
- *((Tk_3DBorder *) internalPtr)
- = *((Tk_3DBorder *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_RELIEF: {
- *((int *) internalPtr)
- = *((int *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_CURSOR: {
- *((Tk_Cursor *) internalPtr)
- = *((Tk_Cursor *) &savePtr->items[i].internalForm);
- Tk_DefineCursor(savePtr->tkwin,
- *((Tk_Cursor *) internalPtr));
- break;
- }
- case TK_OPTION_JUSTIFY: {
- *((Tk_Justify *) internalPtr)
- = *((Tk_Justify *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_ANCHOR: {
- *((Tk_Anchor *) internalPtr)
- = *((Tk_Anchor *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_PIXELS: {
- *((int *) internalPtr)
- = *((int *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_WINDOW: {
- *((Tk_Window *) internalPtr)
- = *((Tk_Window *) &savePtr->items[i].internalForm);
- break;
- }
- case TK_OPTION_CUSTOM: {
- Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- if (custom->restoreProc != NULL) {
- custom->restoreProc(custom->clientData, savePtr->tkwin,
- internalPtr,
- (char *)&savePtr->items[i].internalForm);
- }
- break;
- }
- default: {
- panic("bad option type in Tk_RestoreSavedOptions");
+ case TK_OPTION_BOOLEAN:
+ *((int *) internalPtr) = *((int *) ptr);
+ break;
+ case TK_OPTION_INT:
+ *((int *) internalPtr) = *((int *) ptr);
+ break;
+ case TK_OPTION_DOUBLE:
+ *((double *) internalPtr) = *((double *) ptr);
+ break;
+ case TK_OPTION_STRING:
+ *((char **) internalPtr) = *((char **) ptr);
+ break;
+ case TK_OPTION_STRING_TABLE:
+ *((int *) internalPtr) = *((int *) ptr);
+ break;
+ case TK_OPTION_COLOR:
+ *((XColor **) internalPtr) = *((XColor **) ptr);
+ break;
+ case TK_OPTION_FONT:
+ *((Tk_Font *) internalPtr) = *((Tk_Font *) ptr);
+ break;
+ case TK_OPTION_STYLE:
+ *((Tk_Style *) internalPtr) = *((Tk_Style *) ptr);
+ break;
+ case TK_OPTION_BITMAP:
+ *((Pixmap *) internalPtr) = *((Pixmap *) ptr);
+ break;
+ case TK_OPTION_BORDER:
+ *((Tk_3DBorder *) internalPtr) = *((Tk_3DBorder *) ptr);
+ break;
+ case TK_OPTION_RELIEF:
+ *((int *) internalPtr) = *((int *) ptr);
+ break;
+ case TK_OPTION_CURSOR:
+ *((Tk_Cursor *) internalPtr) = *((Tk_Cursor *) ptr);
+ Tk_DefineCursor(savePtr->tkwin, *((Tk_Cursor *) internalPtr));
+ break;
+ case TK_OPTION_JUSTIFY:
+ *((Tk_Justify *) internalPtr) = *((Tk_Justify *) ptr);
+ break;
+ case TK_OPTION_ANCHOR:
+ *((Tk_Anchor *) internalPtr) = *((Tk_Anchor *) ptr);
+ break;
+ case TK_OPTION_PIXELS:
+ *((int *) internalPtr) = *((int *) ptr);
+ break;
+ case TK_OPTION_WINDOW:
+ *((Tk_Window *) internalPtr) = *((Tk_Window *) ptr);
+ break;
+ case TK_OPTION_CUSTOM: {
+ Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+
+ if (custom->restoreProc != NULL) {
+ custom->restoreProc(custom->clientData, savePtr->tkwin,
+ internalPtr, ptr);
}
+ break;
+ }
+ default:
+ Tcl_Panic("bad option type in Tk_RestoreSavedOptions");
}
}
}
@@ -1565,8 +1505,8 @@ Tk_RestoreSavedOptions(savePtr)
*
* Tk_FreeSavedOptions --
*
- * Free all of the saved configuration option values from a
- * previous call to Tk_SetOptions.
+ * Free all of the saved configuration option values from a previous call
+ * to Tk_SetOptions.
*
* Results:
* None.
@@ -1578,9 +1518,9 @@ Tk_RestoreSavedOptions(savePtr)
*/
void
-Tk_FreeSavedOptions(savePtr)
- Tk_SavedOptions *savePtr; /* Contains options saved in a previous
- * call to Tk_SetOptions. */
+Tk_FreeSavedOptions(
+ Tk_SavedOptions *savePtr) /* Contains options saved in a previous call
+ * to Tk_SetOptions. */
{
int count;
Tk_SavedOption *savedOptionPtr;
@@ -1613,25 +1553,25 @@ Tk_FreeSavedOptions(savePtr)
* None.
*
* Side effects:
- * All of the Tcl_Obj's in recordPtr that are controlled by
- * configuration options in optionTable are freed.
+ * All of the Tcl_Obj's in recordPtr that are controlled by configuration
+ * options in optionTable are freed.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
void
-Tk_FreeConfigOptions(recordPtr, optionTable, tkwin)
- char *recordPtr; /* Record whose fields contain current
- * values for options. */
- Tk_OptionTable optionTable; /* Describes legal options. */
- Tk_Window tkwin; /* Window associated with recordPtr; needed
+Tk_FreeConfigOptions(
+ char *recordPtr, /* Record whose fields contain current values
+ * for options. */
+ Tk_OptionTable optionTable, /* Describes legal options. */
+ Tk_Window tkwin) /* Window associated with recordPtr; needed
* for freeing some options. */
{
OptionTable *tablePtr;
Option *optionPtr;
int count;
- Tcl_Obj **oldPtrPtr, *oldPtr;
+ Tcl_Obj **oldPtrPtr, *oldPtr;
char *oldInternalPtr;
CONST Tk_OptionSpec *specPtr;
@@ -1670,114 +1610,113 @@ Tk_FreeConfigOptions(recordPtr, optionTable, tkwin)
*
* FreeResources --
*
- * Free system resources associated with a configuration option,
- * such as colors or fonts.
+ * Free system resources associated with a configuration option, such as
+ * colors or fonts.
*
* Results:
* None.
*
* Side effects:
- * Any system resources associated with objPtr are released. However,
+ * Any system resources associated with objPtr are released. However,
* objPtr itself is not freed.
*
*----------------------------------------------------------------------
*/
static void
-FreeResources(optionPtr, objPtr, internalPtr, tkwin)
- Option *optionPtr; /* Description of the configuration option. */
- Tcl_Obj *objPtr; /* The current value of the option, specified
+FreeResources(
+ Option *optionPtr, /* Description of the configuration option. */
+ Tcl_Obj *objPtr, /* The current value of the option, specified
* as an object. */
- char *internalPtr; /* A pointer to an internal representation for
+ char *internalPtr, /* A pointer to an internal representation for
* the option's value, such as an int or
- * (XColor *). Only valid if
+ * (XColor *). Only valid if
* optionPtr->specPtr->internalOffset >= 0. */
- Tk_Window tkwin; /* The window in which this option is used. */
+ Tk_Window tkwin) /* The window in which this option is used. */
{
int internalFormExists;
/*
* If there exists an internal form for the value, use it to free
- * resources (also zero out the internal form). If there is no
- * internal form, then use the object form.
+ * resources (also zero out the internal form). If there is no internal
+ * form, then use the object form.
*/
internalFormExists = optionPtr->specPtr->internalOffset >= 0;
switch (optionPtr->specPtr->type) {
- case TK_OPTION_STRING:
- if (internalFormExists) {
- if (*((char **) internalPtr) != NULL) {
- ckfree(*((char **) internalPtr));
- *((char **) internalPtr) = NULL;
- }
- }
- break;
- case TK_OPTION_COLOR:
- if (internalFormExists) {
- if (*((XColor **) internalPtr) != NULL) {
- Tk_FreeColor(*((XColor **) internalPtr));
- *((XColor **) internalPtr) = NULL;
- }
- } else if (objPtr != NULL) {
- Tk_FreeColorFromObj(tkwin, objPtr);
- }
- break;
- case TK_OPTION_FONT:
- if (internalFormExists) {
- Tk_FreeFont(*((Tk_Font *) internalPtr));
- *((Tk_Font *) internalPtr) = NULL;
- } else if (objPtr != NULL) {
- Tk_FreeFontFromObj(tkwin, objPtr);
- }
- break;
- case TK_OPTION_STYLE:
- if (internalFormExists) {
- Tk_FreeStyle(*((Tk_Style *) internalPtr));
- *((Tk_Style *) internalPtr) = NULL;
- } else if (objPtr != NULL) {
- Tk_FreeStyleFromObj(objPtr);
- }
- break;
- case TK_OPTION_BITMAP:
- if (internalFormExists) {
- if (*((Pixmap *) internalPtr) != None) {
- Tk_FreeBitmap(Tk_Display(tkwin), *((Pixmap *) internalPtr));
- *((Pixmap *) internalPtr) = None;
- }
- } else if (objPtr != NULL) {
- Tk_FreeBitmapFromObj(tkwin, objPtr);
- }
- break;
- case TK_OPTION_BORDER:
- if (internalFormExists) {
- if (*((Tk_3DBorder *) internalPtr) != NULL) {
- Tk_Free3DBorder(*((Tk_3DBorder *) internalPtr));
- *((Tk_3DBorder *) internalPtr) = NULL;
- }
- } else if (objPtr != NULL) {
- Tk_Free3DBorderFromObj(tkwin, objPtr);
- }
- break;
- case TK_OPTION_CURSOR:
- if (internalFormExists) {
- if (*((Tk_Cursor *) internalPtr) != None) {
- Tk_FreeCursor(Tk_Display(tkwin),
- *((Tk_Cursor *) internalPtr));
- *((Tk_Cursor *) internalPtr) = None;
- }
- } else if (objPtr != NULL) {
- Tk_FreeCursorFromObj(tkwin, objPtr);
- }
- break;
- case TK_OPTION_CUSTOM: {
- Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- if (internalFormExists && custom->freeProc != NULL) {
- custom->freeProc(custom->clientData, tkwin, internalPtr);
- }
- break;
- }
- default:
- break;
+ case TK_OPTION_STRING:
+ if (internalFormExists) {
+ if (*((char **) internalPtr) != NULL) {
+ ckfree(*((char **) internalPtr));
+ *((char **) internalPtr) = NULL;
+ }
+ }
+ break;
+ case TK_OPTION_COLOR:
+ if (internalFormExists) {
+ if (*((XColor **) internalPtr) != NULL) {
+ Tk_FreeColor(*((XColor **) internalPtr));
+ *((XColor **) internalPtr) = NULL;
+ }
+ } else if (objPtr != NULL) {
+ Tk_FreeColorFromObj(tkwin, objPtr);
+ }
+ break;
+ case TK_OPTION_FONT:
+ if (internalFormExists) {
+ Tk_FreeFont(*((Tk_Font *) internalPtr));
+ *((Tk_Font *) internalPtr) = NULL;
+ } else if (objPtr != NULL) {
+ Tk_FreeFontFromObj(tkwin, objPtr);
+ }
+ break;
+ case TK_OPTION_STYLE:
+ if (internalFormExists) {
+ Tk_FreeStyle(*((Tk_Style *) internalPtr));
+ *((Tk_Style *) internalPtr) = NULL;
+ } else if (objPtr != NULL) {
+ Tk_FreeStyleFromObj(objPtr);
+ }
+ break;
+ case TK_OPTION_BITMAP:
+ if (internalFormExists) {
+ if (*((Pixmap *) internalPtr) != None) {
+ Tk_FreeBitmap(Tk_Display(tkwin), *((Pixmap *) internalPtr));
+ *((Pixmap *) internalPtr) = None;
+ }
+ } else if (objPtr != NULL) {
+ Tk_FreeBitmapFromObj(tkwin, objPtr);
+ }
+ break;
+ case TK_OPTION_BORDER:
+ if (internalFormExists) {
+ if (*((Tk_3DBorder *) internalPtr) != NULL) {
+ Tk_Free3DBorder(*((Tk_3DBorder *) internalPtr));
+ *((Tk_3DBorder *) internalPtr) = NULL;
+ }
+ } else if (objPtr != NULL) {
+ Tk_Free3DBorderFromObj(tkwin, objPtr);
+ }
+ break;
+ case TK_OPTION_CURSOR:
+ if (internalFormExists) {
+ if (*((Tk_Cursor *) internalPtr) != None) {
+ Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr));
+ *((Tk_Cursor *) internalPtr) = None;
+ }
+ } else if (objPtr != NULL) {
+ Tk_FreeCursorFromObj(tkwin, objPtr);
+ }
+ break;
+ case TK_OPTION_CUSTOM: {
+ Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+ if (internalFormExists && custom->freeProc != NULL) {
+ custom->freeProc(custom->clientData, tkwin, internalPtr);
+ }
+ break;
+ }
+ default:
+ break;
}
}
@@ -1786,23 +1725,21 @@ FreeResources(optionPtr, objPtr, internalPtr, tkwin)
*
* Tk_GetOptionInfo --
*
- * Returns a list object containing complete information about
- * either a single option or all the configuration options in a
- * table.
+ * Returns a list object containing complete information about either a
+ * single option or all the configuration options in a table.
*
* Results:
- * This procedure normally returns a pointer to an object.
- * If namePtr isn't NULL, then the result object is a list with
- * five elements: the option's name, its database name, database
- * class, default value, and current value. If the option is a
- * synonym then the list will contain only two values: the option
- * name and the name of the option it refers to. If namePtr is
- * NULL, then information is returned for every option in the
- * option table: the result will have one sub-list (in the form
- * described above) for each option in the table. If an error
- * occurs (e.g. because namePtr isn't valid) then NULL is returned
- * and an error message will be left in interp's result unless
- * interp is NULL.
+
+ * This function normally returns a pointer to an object. If namePtr
+ * isn't NULL, then the result object is a list with five elements: the
+ * option's name, its database name, database class, default value, and
+ * current value. If the option is a synonym then the list will contain
+ * only two values: the option name and the name of the option it refers
+ * to. If namePtr is NULL, then information is returned for every option
+ * in the option table: the result will have one sub-list (in the form
+ * described above) for each option in the table. If an error occurs
+ * (e.g. because namePtr isn't valid) then NULL is returned and an error
+ * message will be left in interp's result unless interp is NULL.
*
* Side effects:
* None.
@@ -1811,18 +1748,18 @@ FreeResources(optionPtr, objPtr, internalPtr, tkwin)
*/
Tcl_Obj *
-Tk_GetOptionInfo(interp, recordPtr, optionTable, namePtr, tkwin)
- Tcl_Interp *interp; /* Interpreter for error reporting. If
- * NULL, then no error message is created. */
- char *recordPtr; /* Record whose fields contain current
- * values for options. */
- Tk_OptionTable optionTable; /* Describes all the legal options. */
- Tcl_Obj *namePtr; /* If non-NULL, the string value selects
- * a single option whose info is to be
- * returned. Otherwise info is returned for
- * all options in optionTable. */
- Tk_Window tkwin; /* Window associated with recordPtr; needed
- * to compute correct default value for some
+Tk_GetOptionInfo(
+ Tcl_Interp *interp, /* Interpreter for error reporting. If NULL,
+ * then no error message is created. */
+ char *recordPtr, /* Record whose fields contain current values
+ * for options. */
+ Tk_OptionTable optionTable, /* Describes all the legal options. */
+ Tcl_Obj *namePtr, /* If non-NULL, the string value selects a
+ * single option whose info is to be returned.
+ * Otherwise info is returned for all options
+ * in optionTable. */
+ Tk_Window tkwin) /* Window associated with recordPtr; needed to
+ * compute correct default value for some
* options. */
{
Tcl_Obj *resultPtr;
@@ -1831,14 +1768,14 @@ Tk_GetOptionInfo(interp, recordPtr, optionTable, namePtr, tkwin)
int count;
/*
- * If information is only wanted for a single configuration
- * spec, then handle that one spec specially.
+ * If information is only wanted for a single configuration spec, then
+ * handle that one spec specially.
*/
if (namePtr != NULL) {
optionPtr = GetOptionFromObj(interp, namePtr, tablePtr);
if (optionPtr == NULL) {
- return (Tcl_Obj *) NULL;
+ return NULL;
}
if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) {
optionPtr = optionPtr->extra.synonymPtr;
@@ -1847,11 +1784,11 @@ Tk_GetOptionInfo(interp, recordPtr, optionTable, namePtr, tkwin)
}
/*
- * Loop through all the specs, creating a big list with all
- * their information.
+ * Loop through all the specs, creating a big list with all their
+ * information.
*/
- resultPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
+ resultPtr = Tcl_NewListObj(0, NULL);
for (; tablePtr != NULL; tablePtr = tablePtr->nextPtr) {
for (optionPtr = tablePtr->options, count = tablePtr->numOptions;
count > 0; optionPtr++, count--) {
@@ -1867,12 +1804,12 @@ Tk_GetOptionInfo(interp, recordPtr, optionTable, namePtr, tkwin)
*
* GetConfigList --
*
- * Create a valid Tcl list holding the configuration information
- * for a single configuration option.
+ * Create a valid Tcl list holding the configuration information for a
+ * single configuration option.
*
* Results:
- * A Tcl list, dynamically allocated. The caller is expected to
- * arrange for this list to be freed eventually.
+ * A Tcl list, dynamically allocated. The caller is expected to arrange
+ * for this list to be freed eventually.
*
* Side effects:
* Memory is allocated.
@@ -1881,37 +1818,37 @@ Tk_GetOptionInfo(interp, recordPtr, optionTable, namePtr, tkwin)
*/
static Tcl_Obj *
-GetConfigList(recordPtr, optionPtr, tkwin)
- char *recordPtr; /* Pointer to record holding current
- * values of configuration options. */
- Option *optionPtr; /* Pointer to information describing a
+GetConfigList(
+ char *recordPtr, /* Pointer to record holding current values of
+ * configuration options. */
+ Option *optionPtr, /* Pointer to information describing a
* particular option. */
- Tk_Window tkwin; /* Window corresponding to recordPtr. */
+ Tk_Window tkwin) /* Window corresponding to recordPtr. */
{
Tcl_Obj *listPtr, *elementPtr;
- listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, listPtr,
+ listPtr = Tcl_NewListObj(0, NULL);
+ Tcl_ListObjAppendElement(NULL, listPtr,
Tcl_NewStringObj(optionPtr->specPtr->optionName, -1));
if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) {
elementPtr = Tcl_NewStringObj(
optionPtr->extra.synonymPtr->specPtr->optionName, -1);
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, listPtr, elementPtr);
+ Tcl_ListObjAppendElement(NULL, listPtr, elementPtr);
} else {
if (optionPtr->dbNameUID == NULL) {
elementPtr = Tcl_NewObj();
} else {
elementPtr = Tcl_NewStringObj(optionPtr->dbNameUID, -1);
}
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, listPtr, elementPtr);
+ Tcl_ListObjAppendElement(NULL, listPtr, elementPtr);
if (optionPtr->dbClassUID == NULL) {
elementPtr = Tcl_NewObj();
} else {
elementPtr = Tcl_NewStringObj(optionPtr->dbClassUID, -1);
}
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, listPtr, elementPtr);
+ Tcl_ListObjAppendElement(NULL, listPtr, elementPtr);
if ((tkwin != NULL) && ((optionPtr->specPtr->type == TK_OPTION_COLOR)
|| (optionPtr->specPtr->type == TK_OPTION_BORDER))
@@ -1923,7 +1860,7 @@ GetConfigList(recordPtr, optionPtr, tkwin)
} else {
elementPtr = Tcl_NewObj();
}
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, listPtr, elementPtr);
+ Tcl_ListObjAppendElement(NULL, listPtr, elementPtr);
if (optionPtr->specPtr->objOffset >= 0) {
elementPtr = *((Tcl_Obj **) (recordPtr
@@ -1934,7 +1871,7 @@ GetConfigList(recordPtr, optionPtr, tkwin)
} else {
elementPtr = GetObjectForOption(recordPtr, optionPtr, tkwin);
}
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, listPtr, elementPtr);
+ Tcl_ListObjAppendElement(NULL, listPtr, elementPtr);
}
return listPtr;
}
@@ -1944,14 +1881,13 @@ GetConfigList(recordPtr, optionPtr, tkwin)
*
* GetObjectForOption --
*
- * This procedure is called to create an object that contains the
- * value for an option. It is invoked by GetConfigList and
- * Tk_GetOptionValue when only the internal form of an option is
- * stored in the record.
+ * This function is called to create an object that contains the value
+ * for an option. It is invoked by GetConfigList and Tk_GetOptionValue
+ * when only the internal form of an option is stored in the record.
*
* Results:
- * The return value is a pointer to a Tcl object. The caller
- * must call Tcl_IncrRefCount on this object to preserve it.
+ * The return value is a pointer to a Tcl object. The caller must call
+ * Tcl_IncrRefCount on this object to preserve it.
*
* Side effects:
* None.
@@ -1960,13 +1896,13 @@ GetConfigList(recordPtr, optionPtr, tkwin)
*/
static Tcl_Obj *
-GetObjectForOption(recordPtr, optionPtr, tkwin)
- char *recordPtr; /* Pointer to record holding current
- * values of configuration options. */
- Option *optionPtr; /* Pointer to information describing an
- * option whose internal value is stored
- * in *recordPtr. */
- Tk_Window tkwin; /* Window corresponding to recordPtr. */
+GetObjectForOption(
+ char *recordPtr, /* Pointer to record holding current values of
+ * configuration options. */
+ Option *optionPtr, /* Pointer to information describing an option
+ * whose internal value is stored in
+ * *recordPtr. */
+ Tk_Window tkwin) /* Window corresponding to recordPtr. */
{
Tcl_Obj *objPtr;
char *internalPtr; /* Points to internal value of option in
@@ -1975,107 +1911,103 @@ GetObjectForOption(recordPtr, optionPtr, tkwin)
internalPtr = recordPtr + optionPtr->specPtr->internalOffset;
objPtr = NULL;
switch (optionPtr->specPtr->type) {
- case TK_OPTION_BOOLEAN: {
- objPtr = Tcl_NewIntObj(*((int *) internalPtr));
- break;
- }
- case TK_OPTION_INT: {
- objPtr = Tcl_NewIntObj(*((int *) internalPtr));
- break;
- }
- case TK_OPTION_DOUBLE: {
- objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
- break;
+ case TK_OPTION_BOOLEAN:
+ objPtr = Tcl_NewIntObj(*((int *) internalPtr));
+ break;
+ case TK_OPTION_INT:
+ objPtr = Tcl_NewIntObj(*((int *) internalPtr));
+ break;
+ case TK_OPTION_DOUBLE:
+ objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
+ break;
+ case TK_OPTION_STRING:
+ objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1);
+ break;
+ case TK_OPTION_STRING_TABLE:
+ objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
+ *((int *) internalPtr)], -1);
+ break;
+ case TK_OPTION_COLOR: {
+ XColor *colorPtr = *((XColor **) internalPtr);
+
+ if (colorPtr != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ }
+ break;
+ }
+ case TK_OPTION_FONT: {
+ Tk_Font tkfont = *((Tk_Font *) internalPtr);
+
+ if (tkfont != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
}
- case TK_OPTION_STRING: {
- objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1);
- break;
+ break;
+ }
+ case TK_OPTION_STYLE: {
+ Tk_Style style = *((Tk_Style *) internalPtr);
+
+ if (style != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
}
- case TK_OPTION_STRING_TABLE: {
+ break;
+ }
+ case TK_OPTION_BITMAP: {
+ Pixmap pixmap = *((Pixmap *) internalPtr);
+
+ if (pixmap != None) {
objPtr = Tcl_NewStringObj(
- ((char **) optionPtr->specPtr->clientData)[
- *((int *) internalPtr)], -1);
- break;
- }
- case TK_OPTION_COLOR: {
- XColor *colorPtr = *((XColor **) internalPtr);
- if (colorPtr != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
- }
- break;
- }
- case TK_OPTION_FONT: {
- Tk_Font tkfont = *((Tk_Font *) internalPtr);
- if (tkfont != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
- }
- break;
- }
- case TK_OPTION_STYLE: {
- Tk_Style style = *((Tk_Style *) internalPtr);
- if (style != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
- }
- break;
- }
- case TK_OPTION_BITMAP: {
- Pixmap pixmap = *((Pixmap *) internalPtr);
- if (pixmap != None) {
- objPtr = Tcl_NewStringObj(Tk_NameOfBitmap(Tk_Display(tkwin),
- pixmap), -1);
- }
- break;
- }
- case TK_OPTION_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) internalPtr);
- if (border != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
- }
- break;
- }
- case TK_OPTION_RELIEF: {
- objPtr = Tcl_NewStringObj(Tk_NameOfRelief(
- *((int *) internalPtr)), -1);
- break;
- }
- case TK_OPTION_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
- if (cursor != None) {
- objPtr = Tcl_NewStringObj(
- Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
- }
- break;
+ Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1);
}
- case TK_OPTION_JUSTIFY: {
- objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
- *((Tk_Justify *) internalPtr)), -1);
- break;
- }
- case TK_OPTION_ANCHOR: {
- objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
- *((Tk_Anchor *) internalPtr)), -1);
- break;
- }
- case TK_OPTION_PIXELS: {
- objPtr = Tcl_NewIntObj(*((int *) internalPtr));
- break;
- }
- case TK_OPTION_WINDOW: {
- Tk_Window tkwin = *((Tk_Window *) internalPtr);
- if (tkwin != NULL) {
- objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
- }
- break;
- }
- case TK_OPTION_CUSTOM: {
- Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- objPtr = custom->getProc(custom->clientData, tkwin, recordPtr,
- optionPtr->specPtr->internalOffset);
- break;
+ break;
+ }
+ case TK_OPTION_BORDER: {
+ Tk_3DBorder border = *((Tk_3DBorder *) internalPtr);
+
+ if (border != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
}
- default: {
- panic("bad option type in GetObjectForOption");
+ break;
+ }
+ case TK_OPTION_RELIEF:
+ objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1);
+ break;
+ case TK_OPTION_CURSOR: {
+ Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
+
+ if (cursor != None) {
+ objPtr = Tcl_NewStringObj(
+ Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
}
+ break;
+ }
+ case TK_OPTION_JUSTIFY:
+ objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
+ *((Tk_Justify *) internalPtr)), -1);
+ break;
+ case TK_OPTION_ANCHOR:
+ objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
+ *((Tk_Anchor *) internalPtr)), -1);
+ break;
+ case TK_OPTION_PIXELS:
+ objPtr = Tcl_NewIntObj(*((int *) internalPtr));
+ break;
+ case TK_OPTION_WINDOW: {
+ Tk_Window tkwin = *((Tk_Window *) internalPtr);
+
+ if (tkwin != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ }
+ break;
+ }
+ case TK_OPTION_CUSTOM: {
+ Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+
+ objPtr = custom->getProc(custom->clientData, tkwin, recordPtr,
+ optionPtr->specPtr->internalOffset);
+ break;
+ }
+ default:
+ Tcl_Panic("bad option type in GetObjectForOption");
}
if (objPtr == NULL) {
objPtr = Tcl_NewObj();
@@ -2088,14 +2020,13 @@ GetObjectForOption(recordPtr, optionPtr, tkwin)
*
* Tk_GetOptionValue --
*
- * This procedure returns the current value of a configuration
- * option.
+ * This function returns the current value of a configuration option.
*
* Results:
- * The return value is the object holding the current value of
- * the option given by namePtr. If no such option exists, then
- * the return value is NULL and an error message is left in
- * interp's result (if interp isn't NULL).
+ * The return value is the object holding the current value of the option
+ * given by namePtr. If no such option exists, then the return value is
+ * NULL and an error message is left in interp's result (if interp isn't
+ * NULL).
*
* Side effects:
* None.
@@ -2104,16 +2035,16 @@ GetObjectForOption(recordPtr, optionPtr, tkwin)
*/
Tcl_Obj *
-Tk_GetOptionValue(interp, recordPtr, optionTable, namePtr, tkwin)
- Tcl_Interp *interp; /* Interpreter for error reporting. If
- * NULL then no messages are provided for
+Tk_GetOptionValue(
+ Tcl_Interp *interp, /* Interpreter for error reporting. If NULL
+ * then no messages are provided for
* errors. */
- char *recordPtr; /* Record whose fields contain current
- * values for options. */
- Tk_OptionTable optionTable; /* Describes legal options. */
- Tcl_Obj *namePtr; /* Gives the command-line name for the
- * option whose value is to be returned. */
- Tk_Window tkwin; /* Window corresponding to recordPtr. */
+ char *recordPtr, /* Record whose fields contain current values
+ * for options. */
+ Tk_OptionTable optionTable, /* Describes legal options. */
+ Tcl_Obj *namePtr, /* Gives the command-line name for the option
+ * whose value is to be returned. */
+ Tk_Window tkwin) /* Window corresponding to recordPtr. */
{
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
@@ -2127,16 +2058,16 @@ Tk_GetOptionValue(interp, recordPtr, optionTable, namePtr, tkwin)
optionPtr = optionPtr->extra.synonymPtr;
}
if (optionPtr->specPtr->objOffset >= 0) {
- resultPtr = *((Tcl_Obj **) (recordPtr + optionPtr->specPtr->objOffset));
+ resultPtr = *((Tcl_Obj **) (recordPtr+optionPtr->specPtr->objOffset));
if (resultPtr == NULL) {
/*
* This option has a null value and is represented by a null
- * object pointer. We can't return the null pointer, since that
- * would indicate an error. Instead, return a new empty object.
+ * object pointer. We can't return the null pointer, since that
+ * would indicate an error. Instead, return a new empty object.
*/
-
+
resultPtr = Tcl_NewObj();
- }
+ }
} else {
resultPtr = GetObjectForOption(recordPtr, optionPtr, tkwin);
}
@@ -2148,19 +2079,17 @@ Tk_GetOptionValue(interp, recordPtr, optionTable, namePtr, tkwin)
*
* TkDebugConfig --
*
- * This is a debugging procedure that returns information about
- * one of the configuration tables that currently exists for an
- * interpreter.
+ * This is a debugging function that returns information about one of the
+ * configuration tables that currently exists for an interpreter.
*
* Results:
- * If the specified table exists in the given interpreter, then a
- * list is returned describing the table and any other tables that
- * it chains to: for each table there will be three list elements
- * giving the reference count for the table, the number of elements
- * in the table, and the command-line name for the first option
- * in the table. If the table doesn't exist in the interpreter
- * then an empty object is returned. The reference count for the
- * returned object is 0.
+ * If the specified table exists in the given interpreter, then a list is
+ * returned describing the table and any other tables that it chains to:
+ * for each table there will be three list elements giving the reference
+ * count for the table, the number of elements in the table, and the
+ * command-line name for the first option in the table. If the table
+ * doesn't exist in the interpreter then an empty object is returned.
+ * The reference count for the returned object is 0.
*
* Side effects:
* None.
@@ -2169,12 +2098,12 @@ Tk_GetOptionValue(interp, recordPtr, optionTable, namePtr, tkwin)
*/
Tcl_Obj *
-TkDebugConfig(interp, table)
- Tcl_Interp *interp; /* Interpreter in which the table is
- * defined. */
- Tk_OptionTable table; /* Table about which information is to
- * be returned. May not necessarily
- * exist in the interpreter anymore. */
+TkDebugConfig(
+ Tcl_Interp *interp, /* Interpreter in which the table is
+ * defined. */
+ Tk_OptionTable table) /* Table about which information is to be
+ * returned. May not necessarily exist in the
+ * interpreter anymore. */
{
OptionTable *tablePtr = (OptionTable *) table;
Tcl_HashTable *hashTablePtr;
@@ -2190,8 +2119,8 @@ TkDebugConfig(interp, table)
}
/*
- * Scan all the tables for this interpreter to make sure that the
- * one we want still is valid.
+ * Scan all the tables for this interpreter to make sure that the one we
+ * want still is valid.
*/
for (hashEntryPtr = Tcl_FirstHashEntry(hashTablePtr, &search);
@@ -2199,17 +2128,23 @@ TkDebugConfig(interp, table)
hashEntryPtr = Tcl_NextHashEntry(&search)) {
if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) {
for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) {
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, objPtr,
+ Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(tablePtr->refCount));
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, objPtr,
+ Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(tablePtr->numOptions));
- Tcl_ListObjAppendElement((Tcl_Interp *) NULL, objPtr,
- Tcl_NewStringObj(
- tablePtr->options[0].specPtr->optionName,
- -1));
+ Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(
+ tablePtr->options[0].specPtr->optionName, -1));
}
break;
}
}
return objPtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 307b9b5..b10aaaf 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -1,15 +1,14 @@
-/*
+/*
* tkConsole.c --
*
- * This file implements a Tcl console for systems that may not
- * otherwise have access to a console. It uses the Text widget
- * and provides special access via a console command.
+ * This file implements a Tcl console for systems that may not otherwise
+ * have access to a console. It uses the Text widget and provides special
+ * access via a console command.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tk.h"
@@ -23,8 +22,8 @@
*/
typedef struct ConsoleInfo {
- Tcl_Interp *consoleInterp; /* Interpreter displaying the console. */
- Tcl_Interp *interp; /* Interpreter controlled by console. */
+ Tcl_Interp *consoleInterp; /* Interpreter displaying the console. */
+ Tcl_Interp *interp; /* Interpreter controlled by console. */
int refCount;
} ConsoleInfo;
@@ -40,30 +39,26 @@ typedef struct ChannelData {
int type; /* TCL_STDOUT or TCL_STDERR */
} ChannelData;
-/*
+/*
* Prototypes for local procedures defined in this file:
*/
-static int ConsoleClose _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp));
-static void ConsoleDeleteProc _ANSI_ARGS_((ClientData clientData));
-static void ConsoleEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int ConsoleHandle _ANSI_ARGS_((ClientData instandeData,
- int direction, ClientData *handlePtr));
-static int ConsoleInput _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toRead, int *errorCode));
-static int ConsoleObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int ConsoleOutput _ANSI_ARGS_((ClientData instanceData,
- CONST char *buf, int toWrite, int *errorCode));
-static void ConsoleWatch _ANSI_ARGS_((ClientData instanceData,
- int mask));
-static void DeleteConsoleInterp _ANSI_ARGS_((ClientData clientData));
-static void InterpDeleteProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp));
-static int InterpreterObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
+static int ConsoleClose(ClientData instanceData, Tcl_Interp *interp);
+static void ConsoleDeleteProc(ClientData clientData);
+static void ConsoleEventProc(ClientData clientData, XEvent *eventPtr);
+static int ConsoleHandle(ClientData instanceData,
+ int direction, ClientData *handlePtr);
+static int ConsoleInput(ClientData instanceData,
+ char *buf, int toRead, int *errorCode);
+static int ConsoleObjCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int ConsoleOutput(ClientData instanceData,
+ CONST char *buf, int toWrite, int *errorCode);
+static void ConsoleWatch(ClientData instanceData, int mask);
+static void DeleteConsoleInterp(ClientData clientData);
+static void InterpDeleteProc(ClientData clientData, Tcl_Interp *interp);
+static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
/*
* This structure describes the channel type structure for file based IO:
@@ -84,13 +79,12 @@ static Tcl_ChannelType consoleChannelType = {
NULL, /* Always non-blocking.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
- NULL, /* wide seek proc */
- NULL, /* thread action proc */
+ NULL, /* wide seek proc */
+ NULL, /* thread action proc */
+ NULL
};
-
#ifdef __WIN32__
-
#include <windows.h>
/*
@@ -98,20 +92,21 @@ static Tcl_ChannelType consoleChannelType = {
*
* ShouldUseConsoleChannel
*
- * Check to see if console window should be used for a given
- * standard channel
+ * Check to see if console window should be used for a given standard
+ * channel.
*
* Results:
* None.
*
* Side effects:
- * Creates the console channel and installs it as the standard
- * channels.
+ * Creates the console channel and installs it as the standard channels.
*
*----------------------------------------------------------------------
*/
-static int ShouldUseConsoleChannel(type)
- int type;
+
+static int
+ShouldUseConsoleChannel(
+ int type)
{
DWORD handleId; /* Standard handle to retrieve. */
DCB dcb;
@@ -120,18 +115,18 @@ static int ShouldUseConsoleChannel(type)
HANDLE handle;
switch (type) {
- case TCL_STDIN:
- handleId = STD_INPUT_HANDLE;
- break;
- case TCL_STDOUT:
- handleId = STD_OUTPUT_HANDLE;
- break;
- case TCL_STDERR:
- handleId = STD_ERROR_HANDLE;
- break;
- default:
- return 0;
- break;
+ case TCL_STDIN:
+ handleId = STD_INPUT_HANDLE;
+ break;
+ case TCL_STDOUT:
+ handleId = STD_OUTPUT_HANDLE;
+ break;
+ case TCL_STDERR:
+ handleId = STD_ERROR_HANDLE;
+ break;
+ default:
+ return 0;
+ break;
}
handle = GetStdHandle(handleId);
@@ -139,7 +134,7 @@ static int ShouldUseConsoleChannel(type)
/*
* Note that we need to check for 0 because Windows will return 0 if this
* is not a console mode application, even though this is not a valid
- * handle.
+ * handle.
*/
if ((handle == INVALID_HANDLE_VALUE) || (handle == 0)) {
@@ -147,27 +142,27 @@ static int ShouldUseConsoleChannel(type)
}
/*
- * Win2K BUG: GetStdHandle(STD_OUTPUT_HANDLE) can return what appears
- * to be a valid handle. See TclpGetDefaultStdChannel() for this change
- * implemented. We didn't change it here because GetFileType() [below]
- * will catch this with FILE_TYPE_UNKNOWN and appropriately return a
- * value of 1, anyways.
+ * Win2K BUG: GetStdHandle(STD_OUTPUT_HANDLE) can return what appears to
+ * be a valid handle. See TclpGetDefaultStdChannel() for this change
+ * implemented. We didn't change it here because GetFileType() [below]
+ * will catch this with FILE_TYPE_UNKNOWN and appropriately return a value
+ * of 1, anyways.
*
* char dummyBuff[1];
* DWORD dummyWritten;
*
* if ((type == TCL_STDOUT)
- * && !WriteFile(handle, dummyBuff, 0, &dummyWritten, NULL)) {
- * return 1;
+ * && !WriteFile(handle, dummyBuff, 0, &dummyWritten, NULL)) {
+ * return 1;
* }
*/
fileType = GetFileType(handle);
/*
- * If the file is a character device, we need to try to figure out
- * whether it is a serial port, a console, or something else. We
- * test for the console case first because this is more common.
+ * If the file is a character device, we need to try to figure out whether
+ * it is a serial port, a console, or something else. We test for the
+ * console case first because this is more common.
*/
if (fileType == FILE_TYPE_CHAR) {
@@ -175,10 +170,10 @@ static int ShouldUseConsoleChannel(type)
if (!GetConsoleMode(handle, &consoleParams) &&
!GetCommState(handle, &dcb)) {
/*
- * Don't use a CHAR type channel for stdio, otherwise Tk
- * runs into trouble with the MS DevStudio debugger.
+ * Don't use a CHAR type channel for stdio, otherwise Tk runs into
+ * trouble with the MS DevStudio debugger.
*/
-
+
return 1;
}
} else if (fileType == FILE_TYPE_UNKNOWN) {
@@ -202,23 +197,22 @@ static int ShouldUseConsoleChannel(type)
*
* Tk_InitConsoleChannels --
*
- * Create the console channels and install them as the standard
- * channels. All I/O will be discarded until Tk_CreateConsoleWindow
- * is called to attach the console to a text widget.
+ * Create the console channels and install them as the standard channels.
+ * All I/O will be discarded until Tk_CreateConsoleWindow is called to
+ * attach the console to a text widget.
*
* Results:
* None.
*
* Side effects:
- * Creates the console channel and installs it as the standard
- * channels.
+ * Creates the console channel and installs it as the standard channels.
*
*----------------------------------------------------------------------
*/
void
-Tk_InitConsoleChannels(interp)
- Tcl_Interp *interp;
+Tk_InitConsoleChannels(
+ Tcl_Interp *interp)
{
static Tcl_ThreadDataKey consoleInitKey;
int *consoleInitPtr, doIn, doOut, doErr;
@@ -226,11 +220,11 @@ Tk_InitConsoleChannels(interp)
Tcl_Channel consoleChannel;
/*
- * Ensure that we are getting the matching version of Tcl. This is
- * really only an issue when Tk is loaded dynamically.
+ * Ensure that we are getting the matching version of Tcl. This is really
+ * only an issue when Tk is loaded dynamically.
*/
- if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+ if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
return;
}
@@ -326,9 +320,9 @@ Tk_InitConsoleChannels(interp)
*
* Tk_CreateConsoleWindow --
*
- * Initialize the console. This code actually creates a new
- * application and associated interpreter. This effectivly hides
- * the implementation from the main application.
+ * Initialize the console. This code actually creates a new application
+ * and associated interpreter. This effectivly hides the implementation
+ * from the main application.
*
* Results:
* None.
@@ -339,9 +333,9 @@ Tk_InitConsoleChannels(interp)
*----------------------------------------------------------------------
*/
-int
-Tk_CreateConsoleWindow(interp)
- Tcl_Interp *interp; /* Interpreter to use for prompting. */
+int
+Tk_CreateConsoleWindow(
+ Tcl_Interp *interp) /* Interpreter to use for prompting. */
{
Tcl_Channel chan;
ConsoleInfo *info;
@@ -350,32 +344,26 @@ Tk_CreateConsoleWindow(interp)
int result = TCL_OK;
int haveConsoleChannel = 1;
-#ifdef MAC_TCL
- static const char *initCmd = "if {[catch {source $tk_library:console.tcl}]} {source -rsrc console}";
-#else
- static const char *initCmd = "source $tk_library/console.tcl";
-#endif
-
/* Init an interp with Tcl and Tk */
Tcl_Interp *consoleInterp = Tcl_CreateInterp();
if (Tcl_Init(consoleInterp) != TCL_OK) {
- goto error;
+ goto error;
}
if (Tk_Init(consoleInterp) != TCL_OK) {
goto error;
}
-
+
/*
* Fetch the instance data from whatever std channel is a
* console channel. If none, create fresh instance data.
*/
if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDIN))
- == &consoleChannelType) {
+ == &consoleChannelType) {
} else if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDOUT))
- == &consoleChannelType) {
+ == &consoleChannelType) {
} else if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDERR))
- == &consoleChannelType) {
+ == &consoleChannelType) {
} else {
haveConsoleChannel = 0;
}
@@ -422,14 +410,14 @@ Tk_CreateConsoleWindow(interp)
Tcl_CallWhenDeleted(consoleInterp, InterpDeleteProc, (ClientData) info);
info->refCount++;
Tcl_CreateThreadExitHandler(DeleteConsoleInterp,
- (ClientData) consoleInterp);
-
- /*
- * Add console commands to the interp
+ (ClientData) consoleInterp);
+
+ /*
+ * Add console commands to the interp
*/
token = Tcl_CreateObjCommand(interp, "console", ConsoleObjCmd,
- (ClientData) info, ConsoleDeleteProc);
+ (ClientData) info, ConsoleDeleteProc);
info->refCount++;
/*
@@ -448,22 +436,10 @@ Tk_CreateConsoleWindow(interp)
}
Tcl_Preserve((ClientData) consoleInterp);
- result = Tcl_GlobalEval(consoleInterp, initCmd);
+ result = Tcl_GlobalEval(consoleInterp, "source $tk_library/console.tcl");
if (result == TCL_ERROR) {
- Tcl_Obj *objPtr = Tcl_GetVar2Ex(consoleInterp, "errorCode", NULL,
- TCL_GLOBAL_ONLY);
- Tcl_ResetResult(interp);
- if (objPtr) {
- Tcl_SetObjErrorCode(interp, objPtr);
- }
-
- objPtr = Tcl_GetVar2Ex(consoleInterp, "errorInfo", NULL,
- TCL_GLOBAL_ONLY);
- if (objPtr) {
- int numBytes;
- CONST char *message = Tcl_GetStringFromObj(objPtr, &numBytes);
- Tcl_AddObjErrorInfo(interp, message, numBytes);
- }
+ Tcl_SetReturnOptions(interp,
+ Tcl_GetReturnOptions(consoleInterp, result));
Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp));
}
Tcl_Release((ClientData) consoleInterp);
@@ -480,7 +456,7 @@ Tk_CreateConsoleWindow(interp)
goto error;
}
return TCL_OK;
-
+
error:
Tcl_AddErrorInfo(interp, "\n (creating console window)");
if (!Tcl_InterpDeleted(consoleInterp)) {
@@ -494,12 +470,12 @@ Tk_CreateConsoleWindow(interp)
*
* ConsoleOutput--
*
- * Writes the given output on the IO channel. Returns count of how
- * many characters were actually written, and an error indication.
+ * Writes the given output on the IO channel. Returns count of how many
+ * characters were actually written, and an error indication.
*
* Results:
- * A count of how many characters were written is returned and an
- * error indication is returned in an output argument.
+ * A count of how many characters were written is returned and an error
+ * indication is returned in an output argument.
*
* Side effects:
* Writes output on the actual channel.
@@ -508,11 +484,11 @@ Tk_CreateConsoleWindow(interp)
*/
static int
-ConsoleOutput(instanceData, buf, toWrite, errorCode)
- ClientData instanceData; /* Indicates which device to use. */
- CONST char *buf; /* The data buffer. */
- int toWrite; /* How many bytes to write? */
- int *errorCode; /* Where to store error code. */
+ConsoleOutput(
+ ClientData instanceData, /* Indicates which device to use. */
+ CONST char *buf, /* The data buffer. */
+ int toWrite, /* How many bytes to write? */
+ int *errorCode) /* Where to store error code. */
{
ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
@@ -564,7 +540,7 @@ ConsoleOutput(instanceData, buf, toWrite, errorCode)
*
* ConsoleInput --
*
- * Read input from the console. Not currently implemented.
+ * Read input from the console. Not currently implemented.
*
* Results:
* Always returns EOF.
@@ -577,12 +553,12 @@ ConsoleOutput(instanceData, buf, toWrite, errorCode)
/* ARGSUSED */
static int
-ConsoleInput(instanceData, buf, bufSize, errorCode)
- ClientData instanceData; /* Unused. */
- char *buf; /* Where to store data read. */
- int bufSize; /* How much space is available
- * in the buffer? */
- int *errorCode; /* Where to store error code. */
+ConsoleInput(
+ ClientData instanceData, /* Unused. */
+ char *buf, /* Where to store data read. */
+ int bufSize, /* How much space is available in the
+ * buffer? */
+ int *errorCode) /* Where to store error code. */
{
return 0; /* Always return EOF. */
}
@@ -605,9 +581,9 @@ ConsoleInput(instanceData, buf, bufSize, errorCode)
/* ARGSUSED */
static int
-ConsoleClose(instanceData, interp)
- ClientData instanceData; /* Unused. */
- Tcl_Interp *interp; /* Unused. */
+ConsoleClose(
+ ClientData instanceData, /* Unused. */
+ Tcl_Interp *interp) /* Unused. */
{
ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
@@ -627,9 +603,9 @@ ConsoleClose(instanceData, interp)
*
* ConsoleWatch --
*
- * Called by the notifier to set up the console device so that
- * events will be noticed. Since there are no events on the
- * console, this routine just returns without doing anything.
+ * Called by the notifier to set up the console device so that events
+ * will be noticed. Since there are no events on the console, this
+ * routine just returns without doing anything.
*
* Results:
* None.
@@ -642,12 +618,11 @@ ConsoleClose(instanceData, interp)
/* ARGSUSED */
static void
-ConsoleWatch(instanceData, mask)
- ClientData instanceData; /* Device ID for the channel. */
- int mask; /* OR-ed combination of
- * TCL_READABLE, TCL_WRITABLE and
- * TCL_EXCEPTION, for the events
- * we are interested in. */
+ConsoleWatch(
+ ClientData instanceData, /* Device ID for the channel. */
+ int mask) /* OR-ed combination of TCL_READABLE,
+ * TCL_WRITABLE and TCL_EXCEPTION, for the
+ * events we are interested in. */
{
}
@@ -657,8 +632,7 @@ ConsoleWatch(instanceData, mask)
* ConsoleHandle --
*
* Invoked by the generic IO layer to get a handle from a channel.
- * Because console channels are not devices, this function always
- * fails.
+ * Because console channels are not devices, this function always fails.
*
* Results:
* Always returns TCL_ERROR.
@@ -671,12 +645,12 @@ ConsoleWatch(instanceData, mask)
/* ARGSUSED */
static int
-ConsoleHandle(instanceData, direction, handlePtr)
- ClientData instanceData; /* Device ID for the channel. */
- int direction; /* TCL_READABLE or TCL_WRITABLE to indicate
+ConsoleHandle(
+ ClientData instanceData, /* Device ID for the channel. */
+ int direction, /* TCL_READABLE or TCL_WRITABLE to indicate
* which direction of the channel is being
* requested. */
- ClientData *handlePtr; /* Where to store handle */
+ ClientData *handlePtr) /* Where to store handle */
{
return TCL_ERROR;
}
@@ -699,11 +673,11 @@ ConsoleHandle(instanceData, direction, handlePtr)
*/
static int
-ConsoleObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Access to the console interp */
- Tcl_Interp *interp; /* Current interpreter */
- int objc; /* Number of arguments */
- Tcl_Obj *CONST objv[]; /* Argument objects */
+ConsoleObjCmd(
+ ClientData clientData, /* Access to the console interp */
+ Tcl_Interp *interp, /* Current interpreter */
+ int objc, /* Number of arguments */
+ Tcl_Obj *CONST objv[]) /* Argument objects */
{
int index, result;
static CONST char *options[] = {"eval", "hide", "show", "title", NULL};
@@ -759,22 +733,8 @@ ConsoleObjCmd(clientData, interp, objc, objv)
if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) {
Tcl_Preserve((ClientData) consoleInterp);
result = Tcl_GlobalEvalObj(consoleInterp, cmd);
- if (result == TCL_ERROR) {
- Tcl_Obj *objPtr = Tcl_GetVar2Ex(consoleInterp, "errorCode",
- NULL, TCL_GLOBAL_ONLY);
- Tcl_ResetResult(interp);
- if (objPtr) {
- Tcl_SetObjErrorCode(interp, objPtr);
- }
-
- objPtr = Tcl_GetVar2Ex(consoleInterp, "errorInfo",
- NULL, TCL_GLOBAL_ONLY);
- if (objPtr) {
- int numBytes;
- CONST char *message = Tcl_GetStringFromObj(objPtr, &numBytes);
- Tcl_AddObjErrorInfo(interp, message, numBytes);
- }
- }
+ Tcl_SetReturnOptions(interp,
+ Tcl_GetReturnOptions(consoleInterp, result));
Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp));
Tcl_Release((ClientData) consoleInterp);
} else {
@@ -790,8 +750,8 @@ ConsoleObjCmd(clientData, interp, objc, objv)
*
* InterpreterObjCmd --
*
- * This command allows the console interp to communicate with the
- * main interpreter.
+ * This command allows the console interp to communicate with the main
+ * interpreter.
*
* Results:
* A standard Tcl result.
@@ -800,11 +760,11 @@ ConsoleObjCmd(clientData, interp, objc, objv)
*/
static int
-InterpreterObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Not used */
- Tcl_Interp *interp; /* Current interpreter */
- int objc; /* Number of arguments */
- Tcl_Obj *CONST objv[]; /* Argument objects */
+InterpreterObjCmd(
+ ClientData clientData, /* */
+ Tcl_Interp *interp, /* Current interpreter */
+ int objc, /* Number of arguments */
+ Tcl_Obj *CONST objv[]) /* Argument objects */
{
int index, result = TCL_OK;
static CONST char *options[] = {"eval", "record", NULL};
@@ -817,7 +777,7 @@ InterpreterObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, &index)
- != TCL_OK) {
+ != TCL_OK) {
return TCL_ERROR;
}
@@ -834,30 +794,16 @@ InterpreterObjCmd(clientData, interp, objc, objv)
Tcl_Preserve((ClientData) otherInterp);
switch ((enum option) index) {
case OTHER_EVAL:
- result = Tcl_GlobalEvalObj(otherInterp, objv[2]);
+ result = Tcl_GlobalEvalObj(otherInterp, objv[2]);
/*
* TODO: Should exceptions be filtered here?
*/
- if (result == TCL_ERROR) {
- Tcl_Obj *objPtr = Tcl_GetVar2Ex(otherInterp, "errorCode",
- NULL, TCL_GLOBAL_ONLY);
- Tcl_ResetResult(interp);
- if (objPtr) {
- Tcl_SetObjErrorCode(interp, objPtr);
- }
-
- objPtr = Tcl_GetVar2Ex(otherInterp, "errorInfo",
- NULL, TCL_GLOBAL_ONLY);
- if (objPtr) {
- int numBytes;
- CONST char *message = Tcl_GetStringFromObj(objPtr, &numBytes);
- Tcl_AddObjErrorInfo(interp, message, numBytes);
- }
- }
+ Tcl_SetReturnOptions(interp,
+ Tcl_GetReturnOptions(otherInterp, result));
Tcl_SetObjResult(interp, Tcl_GetObjResult(otherInterp));
break;
case OTHER_RECORD:
- Tcl_RecordAndEvalObj(otherInterp, objv[2], TCL_EVAL_GLOBAL);
+ Tcl_RecordAndEvalObj(otherInterp, objv[2], TCL_EVAL_GLOBAL);
/*
* By not setting result, we discard any exceptions or errors here
* and always return TCL_OK. All the caller wants is the
@@ -882,8 +828,8 @@ InterpreterObjCmd(clientData, interp, objc, objv)
*/
static void
-DeleteConsoleInterp(clientData)
- ClientData clientData;
+DeleteConsoleInterp(
+ ClientData clientData)
{
Tcl_Interp *interp = (Tcl_Interp *)clientData;
Tcl_DeleteInterp(interp);
@@ -894,23 +840,28 @@ DeleteConsoleInterp(clientData)
*
* InterpDeleteProc --
*
- * React when the interp in which the console is displayed is deleted
- * for any reason.
+ * React when the interp in which the console is displayed is deleted
+ * for any reason.
*
* Results:
* None.
+ *
+ * Side effects:
+ * A new console it created.
+ *
+ *----------------------------------------------------------------------
*/
static void
-InterpDeleteProc(clientData, interp)
- ClientData clientData;
- Tcl_Interp *interp;
+InterpDeleteProc(
+ ClientData clientData,
+ Tcl_Interp *interp)
{
ConsoleInfo *info = (ConsoleInfo *) clientData;
- if(info->consoleInterp == interp) {
+ if (info->consoleInterp == interp) {
Tcl_DeleteThreadExitHandler(DeleteConsoleInterp,
- (ClientData) info-> consoleInterp);
+ (ClientData) info->consoleInterp);
info->consoleInterp = NULL;
}
if (--info->refCount <= 0) {
@@ -924,20 +875,20 @@ InterpDeleteProc(clientData, interp)
* ConsoleDeleteProc --
*
* If the console command is deleted we destroy the console window and
- * all associated data structures.
-
+ * all associated data structures.
+ *
* Results:
* None.
*
* Side effects:
- * A new console is created.
+ * A new console it created.
*
*----------------------------------------------------------------------
*/
static void
-ConsoleDeleteProc(clientData)
- ClientData clientData;
+ConsoleDeleteProc(
+ ClientData clientData)
{
ConsoleInfo *info = (ConsoleInfo *) clientData;
@@ -954,10 +905,11 @@ ConsoleDeleteProc(clientData)
*
* ConsoleEventProc --
*
- * This event function is registered on the main window of the slave
- * interpreter. If the user or a running script causes the main window to
- * be destroyed, then we need to inform the console interpreter by
+ * This event function is registered on the main window of the slave
+ * interpreter. If the user or a running script causes the main window to
+ * be destroyed, then we need to inform the console interpreter by
* invoking "::tk::ConsoleExit".
+ *
* Results:
* None.
*
@@ -968,9 +920,9 @@ ConsoleDeleteProc(clientData)
*/
static void
-ConsoleEventProc(clientData, eventPtr)
- ClientData clientData;
- XEvent *eventPtr;
+ConsoleEventProc(
+ ClientData clientData,
+ XEvent *eventPtr)
{
if (eventPtr->type == DestroyNotify) {
ConsoleInfo *info = (ConsoleInfo *) clientData;
@@ -985,3 +937,11 @@ ConsoleEventProc(clientData, eventPtr)
}
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 466d0ef..606a349 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -1,52 +1,50 @@
-/*
+/*
* tkCursor.c --
*
* This file maintains a database of read-only cursors for the Tk
- * toolkit. This allows cursors to be shared between widgets and
- * also avoids round-trips to the X server.
+ * toolkit. This allows cursors to be shared between widgets and also
+ * avoids round-trips to the X server.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
- * A TkCursor structure exists for each cursor that is currently
- * active. Each structure is indexed with two hash tables defined
- * below. One of the tables is cursorIdTable, and the other is either
- * cursorNameTable or cursorDataTable, each of which are stored in the
- * TkDisplay structure for the current thread.
+ * A TkCursor structure exists for each cursor that is currently active. Each
+ * structure is indexed with two hash tables defined below. One of the tables
+ * is cursorIdTable, and the other is either cursorNameTable or
+ * cursorDataTable, each of which are stored in the TkDisplay structure for
+ * the current thread.
*/
typedef struct {
CONST char *source; /* Cursor bits. */
CONST char *mask; /* Mask bits. */
- int width, height; /* Dimensions of cursor (and data
- * and mask). */
+ int width, height; /* Dimensions of cursor (and data and
+ * mask). */
int xHot, yHot; /* Location of cursor hot-spot. */
Tk_Uid fg, bg; /* Colors for cursor. */
Display *display; /* Display on which cursor will be used. */
} DataKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void CursorInit _ANSI_ARGS_((TkDisplay *dispPtr));
-static void DupCursorObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr,
- Tcl_Obj *dupObjPtr));
-static void FreeCursor _ANSI_ARGS_((TkCursor *cursorPtr));
-static void FreeCursorObjProc _ANSI_ARGS_((Tcl_Obj *objPtr));
-static TkCursor * TkcGetCursor _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *name));
-static TkCursor * GetCursorFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj *objPtr));
-static void InitCursorObj _ANSI_ARGS_((Tcl_Obj *objPtr));
+static void CursorInit(TkDisplay *dispPtr);
+static void DupCursorObjProc(Tcl_Obj *srcObjPtr,
+ Tcl_Obj *dupObjPtr);
+static void FreeCursor(TkCursor *cursorPtr);
+static void FreeCursorObjProc(Tcl_Obj *objPtr);
+static TkCursor * TkcGetCursor(Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *name);
+static TkCursor * GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+static void InitCursorObj(Tcl_Obj *objPtr);
/*
* The following structure defines the implementation of the "cursor" Tcl
@@ -69,33 +67,32 @@ Tcl_ObjType tkCursorObjType = {
*
* Tk_AllocCursorFromObj --
*
- * Given a Tcl_Obj *, map the value to a corresponding
- * Tk_Cursor structure based on the tkwin given.
+ * Given a Tcl_Obj *, map the value to a corresponding Tk_Cursor
+ * structure based on the tkwin given.
*
* Results:
- * The return value is the X identifer for the desired cursor,
- * unless objPtr couldn't be parsed correctly. In this case,
- * None is returned and an error message is left in the interp's result.
- * The caller should never modify the cursor that is returned, and
- * should eventually call Tk_FreeCursorFromObj when the cursor is no
- * longer needed.
+ * The return value is the X identifer for the desired cursor, unless
+ * objPtr couldn't be parsed correctly. In this case, None is returned
+ * and an error message is left in the interp's result. The caller should
+ * never modify the cursor that is returned, and should eventually call
+ * Tk_FreeCursorFromObj when the cursor is no longer needed.
*
* Side effects:
* The cursor is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeCursorFromObj, so that the database can be cleaned up
- * when cursors aren't needed anymore.
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeCursorFromObj, so that the database can be cleaned up when
+ * cursors aren't needed anymore.
*
*----------------------------------------------------------------------
*/
Tk_Cursor
-Tk_AllocCursorFromObj(interp, tkwin, objPtr)
- Tcl_Interp *interp; /* Interp for error results. */
- Tk_Window tkwin; /* Window in which the cursor will be used.*/
- Tcl_Obj *objPtr; /* Object describing cursor; see manual
- * entry for description of legal
- * syntax of this obj's string rep. */
+Tk_AllocCursorFromObj(
+ Tcl_Interp *interp, /* Interp for error results. */
+ Tk_Window tkwin, /* Window in which the cursor will be used.*/
+ Tcl_Obj *objPtr) /* Object describing cursor; see manual entry
+ * for description of legal syntax of this
+ * obj's string rep. */
{
TkCursor *cursorPtr;
@@ -105,16 +102,17 @@ Tk_AllocCursorFromObj(interp, tkwin, objPtr)
cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1;
/*
- * If the object currently points to a TkCursor, see if it's the
- * one we want. If so, increment its reference count and return.
+ * If the object currently points to a TkCursor, see if it's the one we
+ * want. If so, increment its reference count and return.
*/
if (cursorPtr != NULL) {
if (cursorPtr->resourceRefCount == 0) {
/*
- * This is a stale reference: it refers to a TkCursor that's
- * no longer in use. Clear the reference.
+ * This is a stale reference: it refers to a TkCursor that's no
+ * longer in use. Clear the reference.
*/
+
FreeCursorObjProc(objPtr);
cursorPtr = NULL;
} else if (Tk_Display(tkwin) == cursorPtr->display) {
@@ -124,38 +122,37 @@ Tk_AllocCursorFromObj(interp, tkwin, objPtr)
}
/*
- * The object didn't point to the TkCursor that we wanted. Search
- * the list of TkCursors with the same name to see if one of the
- * other TkCursors is the right one.
+ * The object didn't point to the TkCursor that we wanted. Search the list
+ * of TkCursors with the same name to see if one of the other TkCursors is
+ * the right one.
*/
if (cursorPtr != NULL) {
- TkCursor *firstCursorPtr =
- (TkCursor *) Tcl_GetHashValue(cursorPtr->hashPtr);
+ TkCursor *firstCursorPtr = (TkCursor *)
+ Tcl_GetHashValue(cursorPtr->hashPtr);
FreeCursorObjProc(objPtr);
for (cursorPtr = firstCursorPtr; cursorPtr != NULL;
cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
cursorPtr->resourceRefCount++;
cursorPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) cursorPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
return cursorPtr->cursor;
}
}
}
/*
- * Still no luck. Call TkcGetCursor to allocate a new TkCursor object.
+ * Still no luck. Call TkcGetCursor to allocate a new TkCursor object.
*/
cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr));
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) cursorPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
if (cursorPtr == NULL) {
return None;
- } else {
- cursorPtr->objRefCount++;
- return cursorPtr->cursor;
}
+ cursorPtr->objRefCount++;
+ return cursorPtr->cursor;
}
/*
@@ -163,32 +160,31 @@ Tk_AllocCursorFromObj(interp, tkwin, objPtr)
*
* Tk_GetCursor --
*
- * Given a string describing a cursor, locate (or create if necessary)
- * a cursor that fits the description.
+ * Given a string describing a cursor, locate (or create if necessary) a
+ * cursor that fits the description.
*
* Results:
- * The return value is the X identifer for the desired cursor,
- * unless string couldn't be parsed correctly. In this case,
- * None is returned and an error message is left in the interp's result.
- * The caller should never modify the cursor that is returned, and
- * should eventually call Tk_FreeCursor when the cursor is no longer
- * needed.
+ * The return value is the X identifer for the desired cursor, unless
+ * string couldn't be parsed correctly. In this case, None is returned
+ * and an error message is left in the interp's result. The caller should
+ * never modify the cursor that is returned, and should eventually call
+ * Tk_FreeCursor when the cursor is no longer needed.
*
* Side effects:
* The cursor is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeCursor, so that the database can be cleaned up when cursors
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeCursor, so that the database can be cleaned up when cursors
* aren't needed anymore.
*
*----------------------------------------------------------------------
*/
Tk_Cursor
-Tk_GetCursor(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which cursor will be used. */
- Tk_Uid string; /* Description of cursor. See manual entry
- * for details on legal syntax. */
+Tk_GetCursor(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ Tk_Uid string) /* Description of cursor. See manual entry for
+ * details on legal syntax. */
{
TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string);
if (cursorPtr == NULL) {
@@ -202,48 +198,47 @@ Tk_GetCursor(interp, tkwin, string)
*
* TkcGetCursor --
*
- * Given a string describing a cursor, locate (or create if necessary)
- * a cursor that fits the description. This routine returns the
- * internal data structure for the cursor, which avoids extra
- * hash table lookups in Tk_AllocCursorFromObj.
+ * Given a string describing a cursor, locate (or create if necessary) a
+ * cursor that fits the description. This routine returns the internal
+ * data structure for the cursor, which avoids extra hash table lookups
+ * in Tk_AllocCursorFromObj.
*
* Results:
- * The return value is a pointer to the TkCursor for the desired
- * cursor, unless string couldn't be parsed correctly. In this
- * case, NULL is returned and an error message is left in the
- * interp's result. The caller should never modify the cursor that
- * is returned, and should eventually call Tk_FreeCursor when the
- * cursor is no longer needed.
+ * The return value is a pointer to the TkCursor for the desired cursor,
+ * unless string couldn't be parsed correctly. In this case, NULL is
+ * returned and an error message is left in the interp's result. The
+ * caller should never modify the cursor that is returned, and should
+ * eventually call Tk_FreeCursor when the cursor is no longer needed.
*
* Side effects:
* The cursor is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeCursor, so that the database can be cleaned up when cursors
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeCursor, so that the database can be cleaned up when cursors
* aren't needed anymore.
*
*----------------------------------------------------------------------
*/
static TkCursor *
-TkcGetCursor(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which cursor will be used. */
- CONST char *string; /* Description of cursor. See manual entry
- * for details on legal syntax. */
+TkcGetCursor(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ CONST char *string) /* Description of cursor. See manual entry for
+ * details on legal syntax. */
{
Tcl_HashEntry *nameHashPtr;
register TkCursor *cursorPtr;
TkCursor *existingCursorPtr = NULL;
- int new;
+ int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->cursorInit) {
CursorInit(dispPtr);
}
- nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable,
- string, &new);
- if (!new) {
+ nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable,
+ string, &isNew);
+ if (!isNew) {
existingCursorPtr = (TkCursor *) Tcl_GetHashValue(nameHashPtr);
for (cursorPtr = existingCursorPtr; cursorPtr != NULL;
cursorPtr = cursorPtr->nextPtr) {
@@ -259,7 +254,7 @@ TkcGetCursor(interp, tkwin, string)
cursorPtr = TkGetCursorByName(interp, tkwin, string);
if (cursorPtr == NULL) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(nameHashPtr);
}
return NULL;
@@ -275,10 +270,10 @@ TkcGetCursor(interp, tkwin, string)
cursorPtr->otherTable = &dispPtr->cursorNameTable;
cursorPtr->hashPtr = nameHashPtr;
cursorPtr->nextPtr = existingCursorPtr;
- cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable,
- (char *) cursorPtr->cursor, &new);
- if (!new) {
- panic("cursor already registered in Tk_GetCursor");
+ cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable,
+ (char *) cursorPtr->cursor, &isNew);
+ if (!isNew) {
+ Tcl_Panic("cursor already registered in Tk_GetCursor");
}
Tcl_SetHashValue(nameHashPtr, cursorPtr);
Tcl_SetHashValue(cursorPtr->idHashPtr, cursorPtr);
@@ -291,46 +286,43 @@ TkcGetCursor(interp, tkwin, string)
*
* Tk_GetCursorFromData --
*
- * Given a description of the bits and colors for a cursor,
- * make a cursor that has the given properties.
+ * Given a description of the bits and colors for a cursor, make a cursor
+ * that has the given properties.
*
* Results:
- * The return value is the X identifer for the desired cursor,
- * unless it couldn't be created properly. In this case, None is
- * returned and an error message is left in the interp's result. The
- * caller should never modify the cursor that is returned, and
- * should eventually call Tk_FreeCursor when the cursor is no
- * longer needed.
+ * The return value is the X identifer for the desired cursor, unless it
+ * couldn't be created properly. In this case, None is returned and an
+ * error message is left in the interp's result. The caller should never
+ * modify the cursor that is returned, and should eventually call
+ * Tk_FreeCursor when the cursor is no longer needed.
*
* Side effects:
* The cursor is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeCursor, so that the database can be cleaned up when cursors
+ * For each call to this function, there should eventually be a call to
+ * Tk_FreeCursor, so that the database can be cleaned up when cursors
* aren't needed anymore.
*
*----------------------------------------------------------------------
*/
Tk_Cursor
-Tk_GetCursorFromData(interp, tkwin, source, mask, width, height,
- xHot, yHot, fg, bg)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which cursor will be used. */
- CONST char *source; /* Bitmap data for cursor shape. */
- CONST char *mask; /* Bitmap data for cursor mask. */
- int width, height; /* Dimensions of cursor. */
- int xHot, yHot; /* Location of hot-spot in cursor. */
- Tk_Uid fg; /* Foreground color for cursor. */
- Tk_Uid bg; /* Background color for cursor. */
+Tk_GetCursorFromData(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ CONST char *source, /* Bitmap data for cursor shape. */
+ CONST char *mask, /* Bitmap data for cursor mask. */
+ int width, int height, /* Dimensions of cursor. */
+ int xHot, int yHot, /* Location of hot-spot in cursor. */
+ Tk_Uid fg, /* Foreground color for cursor. */
+ Tk_Uid bg) /* Background color for cursor. */
{
DataKey dataKey;
Tcl_HashEntry *dataHashPtr;
register TkCursor *cursorPtr;
- int new;
+ int isNew;
XColor fgColor, bgColor;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
-
if (!dispPtr->cursorInit) {
CursorInit(dispPtr);
}
@@ -344,27 +336,25 @@ Tk_GetCursorFromData(interp, tkwin, source, mask, width, height,
dataKey.fg = fg;
dataKey.bg = bg;
dataKey.display = Tk_Display(tkwin);
- dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable,
- (char *) &dataKey, &new);
- if (!new) {
+ dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable,
+ (char *) &dataKey, &isNew);
+ if (!isNew) {
cursorPtr = (TkCursor *) Tcl_GetHashValue(dataHashPtr);
cursorPtr->resourceRefCount++;
return cursorPtr->cursor;
}
/*
- * No suitable cursor exists yet. Make one using the data
- * available and add it to the database.
+ * No suitable cursor exists yet. Make one using the data available and
+ * add it to the database.
*/
if (XParseColor(dataKey.display, Tk_Colormap(tkwin), fg, &fgColor) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", fg, "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "invalid color name \"", fg, "\"", NULL);
goto error;
}
if (XParseColor(dataKey.display, Tk_Colormap(tkwin), bg, &bgColor) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", bg, "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "invalid color name \"", bg, "\"", NULL);
goto error;
}
@@ -379,18 +369,18 @@ Tk_GetCursorFromData(interp, tkwin, source, mask, width, height,
cursorPtr->otherTable = &dispPtr->cursorDataTable;
cursorPtr->hashPtr = dataHashPtr;
cursorPtr->objRefCount = 0;
- cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable,
- (char *) cursorPtr->cursor, &new);
+ cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable,
+ (char *) cursorPtr->cursor, &isNew);
cursorPtr->nextPtr = NULL;
- if (!new) {
- panic("cursor already registered in Tk_GetCursorFromData");
+ if (!isNew) {
+ Tcl_Panic("cursor already registered in Tk_GetCursorFromData");
}
Tcl_SetHashValue(dataHashPtr, cursorPtr);
Tcl_SetHashValue(cursorPtr->idHashPtr, cursorPtr);
return cursorPtr->cursor;
- error:
+ error:
Tcl_DeleteHashEntry(dataHashPtr);
return None;
}
@@ -403,12 +393,11 @@ Tk_GetCursorFromData(interp, tkwin, source, mask, width, height,
* Given a cursor, return a textual string identifying it.
*
* Results:
- * If cursor was created by Tk_GetCursor, then the return
- * value is the "string" that was used to create it.
- * Otherwise the return value is a string giving the X
- * identifier for the cursor. The storage for the returned
- * string is only guaranteed to persist up until the next
- * call to this procedure.
+ * If cursor was created by Tk_GetCursor, then the return value is the
+ * "string" that was used to create it. Otherwise the return value is a
+ * string giving the X identifier for the cursor. The storage for the
+ * returned string is only guaranteed to persist up until the next call
+ * to this function.
*
* Side effects:
* None.
@@ -417,9 +406,9 @@ Tk_GetCursorFromData(interp, tkwin, source, mask, width, height,
*/
CONST char *
-Tk_NameOfCursor(display, cursor)
- Display *display; /* Display for which cursor was allocated. */
- Tk_Cursor cursor; /* Identifier for cursor whose name is
+Tk_NameOfCursor(
+ Display *display, /* Display for which cursor was allocated. */
+ Tk_Cursor cursor) /* Identifier for cursor whose name is
* wanted. */
{
Tcl_HashEntry *idHashPtr;
@@ -429,9 +418,8 @@ Tk_NameOfCursor(display, cursor)
dispPtr = TkGetDisplay(display);
if (!dispPtr->cursorInit) {
- printid:
- sprintf(dispPtr->cursorString, "cursor id 0x%x",
- (unsigned int) cursor);
+ printid:
+ sprintf(dispPtr->cursorString, "cursor id %p", cursor);
return dispPtr->cursorString;
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);
@@ -450,23 +438,22 @@ Tk_NameOfCursor(display, cursor)
*
* FreeCursor --
*
- * This procedure is invoked by both Tk_FreeCursor and
- * Tk_FreeCursorFromObj; it does all the real work of deallocating
- * a cursor.
+ * This function is invoked by both Tk_FreeCursorFromObj and
+ * Tk_FreeCursor; it does all the real work of deallocating a cursor.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with cursor is decremented, and
- * it is officially deallocated if no-one is using it anymore.
+ * The reference count associated with cursor is decremented, and it is
+ * officially deallocated if no-one is using it anymore.
*
*----------------------------------------------------------------------
*/
static void
-FreeCursor(cursorPtr)
- TkCursor *cursorPtr; /* Cursor to be released. */
+FreeCursor(
+ TkCursor *cursorPtr) /* Cursor to be released. */
{
TkCursor *prevPtr;
@@ -500,34 +487,34 @@ FreeCursor(cursorPtr)
*
* Tk_FreeCursor --
*
- * This procedure is called to release a cursor allocated by
- * Tk_GetCursor or TkGetCursorFromData.
+ * This function is called to release a cursor allocated by Tk_GetCursor
+ * or TkGetCursorFromData.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with cursor is decremented, and
- * it is officially deallocated if no-one is using it anymore.
+ * The reference count associated with cursor is decremented, and it is
+ * officially deallocated if no-one is using it anymore.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeCursor(display, cursor)
- Display *display; /* Display for which cursor was allocated. */
- Tk_Cursor cursor; /* Identifier for cursor to be released. */
+Tk_FreeCursor(
+ Display *display, /* Display for which cursor was allocated. */
+ Tk_Cursor cursor) /* Identifier for cursor to be released. */
{
Tcl_HashEntry *idHashPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
if (!dispPtr->cursorInit) {
- panic("Tk_FreeCursor called before Tk_GetCursor");
+ Tcl_Panic("Tk_FreeCursor called before Tk_GetCursor");
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);
if (idHashPtr == NULL) {
- panic("Tk_FreeCursor received unknown cursor argument");
+ Tcl_Panic("Tk_FreeCursor received unknown cursor argument");
}
FreeCursor((TkCursor *) Tcl_GetHashValue(idHashPtr));
}
@@ -537,27 +524,27 @@ Tk_FreeCursor(display, cursor)
*
* Tk_FreeCursorFromObj --
*
- * This procedure is called to release a cursor allocated by
- * Tk_AllocCursorFromObj. It does not throw away the Tcl_Obj *;
- * it only gets rid of the hash table entry for this cursor
- * and clears the cached value that is normally stored in the object.
+ * This function is called to release a cursor allocated by
+ * Tk_AllocCursorFromObj. It does not throw away the Tcl_Obj *; it only
+ * gets rid of the hash table entry for this cursor and clears the cached
+ * value that is normally stored in the object.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with the cursor represented by
- * objPtr is decremented, and the cursor is released to X if there are
- * no remaining uses for it.
+ * The reference count associated with the cursor represented by objPtr
+ * is decremented, and the cursor is released to X if there are no
+ * remaining uses for it.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeCursorFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* The window this cursor lives in. Needed
- * for the display value. */
- Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */
+Tk_FreeCursorFromObj(
+ Tk_Window tkwin, /* The window this cursor lives in. Needed for
+ * the display value. */
+ Tcl_Obj *objPtr) /* The Tcl_Obj * to be freed. */
{
FreeCursor(GetCursorFromObj(tkwin, objPtr));
FreeCursorObjProc(objPtr);
@@ -566,66 +553,65 @@ Tk_FreeCursorFromObj(tkwin, objPtr)
/*
*---------------------------------------------------------------------------
*
- * FreeCursorFromObjProc --
+ * FreeCursorFromObjProc --
*
* This proc is called to release an object reference to a cursor.
- * Called when the object's internal rep is released or when
- * the cached tkColPtr needs to be changed.
+ * Called when the object's internal rep is released or when the cached
+ * tkColPtr needs to be changed.
*
* Results:
* None.
*
* Side effects:
- * The object reference count is decremented. When both it
- * and the hash ref count go to zero, the color's resources
- * are released.
+ * The object reference count is decremented. When both it and the hash
+ * ref count go to zero, the color's resources are released.
*
*---------------------------------------------------------------------------
*/
static void
-FreeCursorObjProc(objPtr)
- Tcl_Obj *objPtr; /* The object we are releasing. */
+FreeCursorObjProc(
+ Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkCursor *cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1;
if (cursorPtr != NULL) {
cursorPtr->objRefCount--;
- if ((cursorPtr->objRefCount == 0)
+ if ((cursorPtr->objRefCount == 0)
&& (cursorPtr->resourceRefCount == 0)) {
ckfree((char *) cursorPtr);
}
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
}
/*
*---------------------------------------------------------------------------
*
- * DupCursorObjProc --
+ * DupCursorObjProc --
*
- * When a cached cursor object is duplicated, this is called to
- * update the internal reps.
+ * When a cached cursor object is duplicated, this is called to update
+ * the internal reps.
*
* Results:
* None.
*
* Side effects:
- * The color's objRefCount is incremented and the internal rep
- * of the copy is set to point to it.
+ * The color's objRefCount is incremented and the internal rep of the
+ * copy is set to point to it.
*
*---------------------------------------------------------------------------
*/
static void
-DupCursorObjProc(srcObjPtr, dupObjPtr)
- Tcl_Obj *srcObjPtr; /* The object we are copying from. */
- Tcl_Obj *dupObjPtr; /* The object we are copying to. */
+DupCursorObjProc(
+ Tcl_Obj *srcObjPtr, /* The object we are copying from. */
+ Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkCursor *cursorPtr = (TkCursor *) srcObjPtr->internalRep.twoPtrValue.ptr1;
-
+
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (VOID *) cursorPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
if (cursorPtr != NULL) {
cursorPtr->objRefCount++;
@@ -638,27 +624,31 @@ DupCursorObjProc(srcObjPtr, dupObjPtr)
* Tk_GetCursorFromObj --
*
* Returns the cursor referred to buy a Tcl object. The cursor must
- * already have been allocated via a call to Tk_AllocCursorFromObj or
+ * already have been allocated via a call to Tk_AllocCursorFromObj or
* Tk_GetCursor.
*
* Results:
- * Returns the Tk_Cursor that matches the tkwin and the string rep
- * of the name of the cursor given in objPtr.
+ * Returns the Tk_Cursor that matches the tkwin and the string rep of the
+ * name of the cursor given in objPtr.
*
* Side effects:
- * If the object is not already a cursor, the conversion will free
- * any old internal representation.
+ * If the object is not already a cursor, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
Tk_Cursor
-Tk_GetCursorFromObj(tkwin, objPtr)
- Tk_Window tkwin;
- Tcl_Obj *objPtr; /* The object from which to get pixels. */
+Tk_GetCursorFromObj(
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr) /* The object from which to get pixels. */
{
TkCursor *cursorPtr = GetCursorFromObj(tkwin, objPtr);
- /* GetCursorFromObj should never return NULL */
+
+ /*
+ * GetCursorFromObj should never return NULL
+ */
+
return cursorPtr->cursor;
}
@@ -667,25 +657,25 @@ Tk_GetCursorFromObj(tkwin, objPtr)
*
* GetCursorFromObj --
*
- * Returns the cursor referred to by a Tcl object. The cursor must
- * already have been allocated via a call to Tk_AllocCursorFromObj
- * or Tk_GetCursor.
+ * Returns the cursor referred to by a Tcl object. The cursor must
+ * already have been allocated via a call to Tk_AllocCursorFromObj or
+ * Tk_GetCursor.
*
* Results:
- * Returns the TkCursor * that matches the tkwin and the string rep
- * of the name of the cursor given in objPtr.
+ * Returns the TkCursor * that matches the tkwin and the string rep of
+ * the name of the cursor given in objPtr.
*
* Side effects:
- * If the object is not already a cursor, the conversion will free
- * any old internal representation.
+ * If the object is not already a cursor, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
static TkCursor *
-GetCursorFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* Window in which the cursor will be used. */
- Tcl_Obj *objPtr; /* The object that describes the desired
+GetCursorFromObj(
+ Tk_Window tkwin, /* Window in which the cursor will be used. */
+ Tcl_Obj *objPtr) /* The object that describes the desired
* cursor. */
{
TkCursor *cursorPtr;
@@ -697,11 +687,12 @@ GetCursorFromObj(tkwin, objPtr)
}
/*
- * The internal representation is a cache of the last cursor used
- * with the given name. But there can be lots different cursors
- * for each cursor name; one cursor for each display. Check to
- * see if the cursor we have cached is the one that is needed.
+ * The internal representation is a cache of the last cursor used with the
+ * given name. But there can be lots different cursors for each cursor
+ * name; one cursor for each display. Check to see if the cursor we have
+ * cached is the one that is needed.
*/
+
cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1;
if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) {
return cursorPtr;
@@ -721,14 +712,14 @@ GetCursorFromObj(tkwin, objPtr)
cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
FreeCursorObjProc(objPtr);
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) cursorPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
cursorPtr->objRefCount++;
return cursorPtr;
}
}
- error:
- panic("GetCursorFromObj called with non-existent cursor!");
+ error:
+ Tcl_Panic("GetCursorFromObj called with non-existent cursor!");
/*
* The following code isn't reached; it's just there to please compilers.
*/
@@ -740,27 +731,27 @@ GetCursorFromObj(tkwin, objPtr)
*
* InitCursorObj --
*
- * Bookeeping procedure to change an objPtr to a cursor type.
+ * Bookeeping function to change an objPtr to a cursor type.
*
* Results:
* None.
*
* Side effects:
- * The old internal rep of the object is freed. The internal
- * rep is cleared. The final form of the object is set
- * by either Tk_AllocCursorFromObj or GetCursorFromObj.
+ * The old internal rep of the object is freed. The internal rep is
+ * cleared. The final form of the object is set by either
+ * Tk_AllocCursorFromObj or GetCursorFromObj.
*
*----------------------------------------------------------------------
*/
static void
-InitCursorObj(objPtr)
- Tcl_Obj *objPtr; /* The object to convert. */
+InitCursorObj(
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ const Tcl_ObjType *typePtr;
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
Tcl_GetString(objPtr);
@@ -769,7 +760,7 @@ InitCursorObj(objPtr)
(*typePtr->freeIntRepProc)(objPtr);
}
objPtr->typePtr = &tkCursorObjType;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
+ objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
/*
@@ -789,26 +780,26 @@ InitCursorObj(objPtr)
*/
static void
-CursorInit(dispPtr)
- TkDisplay *dispPtr; /* Display used to store thread-specific data. */
+CursorInit(
+ TkDisplay *dispPtr) /* Display used to store thread-specific
+ * data. */
{
Tcl_InitHashTable(&dispPtr->cursorNameTable, TCL_STRING_KEYS);
Tcl_InitHashTable(&dispPtr->cursorDataTable, sizeof(DataKey)/sizeof(int));
/*
- * The call below is tricky: can't use sizeof(IdKey) because it
- * gets padded with extra unpredictable bytes on some 64-bit
- * machines.
+ * The call below is tricky: can't use sizeof(IdKey) because it gets
+ * padded with extra unpredictable bytes on some 64-bit machines.
*/
- /*
- * Old code....
- * Tcl_InitHashTable(&dispPtr->cursorIdTable, sizeof(Display *)
+ /*
+ * Old code....
+ * Tcl_InitHashTable(&dispPtr->cursorIdTable, sizeof(Display *)
* /sizeof(int));
*
- * The comment above doesn't make sense.
- * However, XIDs should only be 32 bits, by the definition of X,
- * so the code above causes Tk to crash. Here is the real code:
+ * The comment above doesn't make sense. However, XIDs should only be 32
+ * bits, by the definition of X, so the code above causes Tk to crash.
+ * Here is the real code:
*/
Tcl_InitHashTable(&dispPtr->cursorIdTable, TCL_ONE_WORD_KEYS);
@@ -821,13 +812,13 @@ CursorInit(dispPtr)
*
* TkDebugCursor --
*
- * This procedure returns debugging information about a cursor.
+ * This function returns debugging information about a cursor.
*
* Results:
* The return value is a list with one sublist for each TkCursor
- * corresponding to "name". Each sublist has two elements that
- * contain the resourceRefCount and objRefCount fields from the
- * TkCursor structure.
+ * corresponding to "name". Each sublist has two elements that contain
+ * the resourceRefCount and objRefCount fields from the TkCursor
+ * structure.
*
* Side effects:
* None.
@@ -836,10 +827,10 @@ CursorInit(dispPtr)
*/
Tcl_Obj *
-TkDebugCursor(tkwin, name)
- Tk_Window tkwin; /* The window in which the cursor will be
- * used (not currently used). */
- char *name; /* Name of the desired color. */
+TkDebugCursor(
+ Tk_Window tkwin, /* The window in which the cursor will be used
+ * (not currently used). */
+ char *name) /* Name of the desired color. */
{
TkCursor *cursorPtr;
Tcl_HashEntry *hashPtr;
@@ -854,16 +845,24 @@ TkDebugCursor(tkwin, name)
if (hashPtr != NULL) {
cursorPtr = (TkCursor *) Tcl_GetHashValue(hashPtr);
if (cursorPtr == NULL) {
- panic("TkDebugCursor found empty hash table entry");
+ Tcl_Panic("TkDebugCursor found empty hash table entry");
}
for ( ; (cursorPtr != NULL); cursorPtr = cursorPtr->nextPtr) {
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(cursorPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(cursorPtr->objRefCount));
+ Tcl_NewIntObj(cursorPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
return resultPtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index 4584dac..d06df4b 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -29,891 +29,1651 @@
* Exported function declarations:
*/
+#ifndef Tk_MainLoop_TCL_DECLARED
+#define Tk_MainLoop_TCL_DECLARED
/* 0 */
-EXTERN void Tk_MainLoop _ANSI_ARGS_((void));
+EXTERN void Tk_MainLoop(void);
+#endif
+#ifndef Tk_3DBorderColor_TCL_DECLARED
+#define Tk_3DBorderColor_TCL_DECLARED
/* 1 */
-EXTERN XColor * Tk_3DBorderColor _ANSI_ARGS_((Tk_3DBorder border));
+EXTERN XColor * Tk_3DBorderColor(Tk_3DBorder border);
+#endif
+#ifndef Tk_3DBorderGC_TCL_DECLARED
+#define Tk_3DBorderGC_TCL_DECLARED
/* 2 */
-EXTERN GC Tk_3DBorderGC _ANSI_ARGS_((Tk_Window tkwin,
- Tk_3DBorder border, int which));
+EXTERN GC Tk_3DBorderGC(Tk_Window tkwin, Tk_3DBorder border,
+ int which);
+#endif
+#ifndef Tk_3DHorizontalBevel_TCL_DECLARED
+#define Tk_3DHorizontalBevel_TCL_DECLARED
/* 3 */
-EXTERN void Tk_3DHorizontalBevel _ANSI_ARGS_((Tk_Window tkwin,
- Drawable drawable, Tk_3DBorder border, int x,
- int y, int width, int height, int leftIn,
- int rightIn, int topBevel, int relief));
+EXTERN void Tk_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);
+#endif
+#ifndef Tk_3DVerticalBevel_TCL_DECLARED
+#define Tk_3DVerticalBevel_TCL_DECLARED
/* 4 */
-EXTERN void Tk_3DVerticalBevel _ANSI_ARGS_((Tk_Window tkwin,
- Drawable drawable, Tk_3DBorder border, int x,
- int y, int width, int height, int leftBevel,
- int relief));
+EXTERN void Tk_3DVerticalBevel(Tk_Window tkwin,
+ Drawable drawable, Tk_3DBorder border, int x,
+ int y, int width, int height, int leftBevel,
+ int relief);
+#endif
+#ifndef Tk_AddOption_TCL_DECLARED
+#define Tk_AddOption_TCL_DECLARED
/* 5 */
-EXTERN void Tk_AddOption _ANSI_ARGS_((Tk_Window tkwin,
- CONST char * name, CONST char * value,
- int priority));
+EXTERN void Tk_AddOption(Tk_Window tkwin, CONST char *name,
+ CONST char *value, int priority);
+#endif
+#ifndef Tk_BindEvent_TCL_DECLARED
+#define Tk_BindEvent_TCL_DECLARED
/* 6 */
-EXTERN void Tk_BindEvent _ANSI_ARGS_((
- Tk_BindingTable bindingTable,
- XEvent * eventPtr, Tk_Window tkwin,
- int numObjects, ClientData * objectPtr));
+EXTERN void Tk_BindEvent(Tk_BindingTable bindingTable,
+ XEvent *eventPtr, Tk_Window tkwin,
+ int numObjects, ClientData *objectPtr);
+#endif
+#ifndef Tk_CanvasDrawableCoords_TCL_DECLARED
+#define Tk_CanvasDrawableCoords_TCL_DECLARED
/* 7 */
-EXTERN void Tk_CanvasDrawableCoords _ANSI_ARGS_((
- Tk_Canvas canvas, double x, double y,
- short * drawableXPtr, short * drawableYPtr));
+EXTERN void Tk_CanvasDrawableCoords(Tk_Canvas canvas, double x,
+ double y, short *drawableXPtr,
+ short *drawableYPtr);
+#endif
+#ifndef Tk_CanvasEventuallyRedraw_TCL_DECLARED
+#define Tk_CanvasEventuallyRedraw_TCL_DECLARED
/* 8 */
-EXTERN void Tk_CanvasEventuallyRedraw _ANSI_ARGS_((
- Tk_Canvas canvas, int x1, int y1, int x2,
- int y2));
+EXTERN void Tk_CanvasEventuallyRedraw(Tk_Canvas canvas, int x1,
+ int y1, int x2, int y2);
+#endif
+#ifndef Tk_CanvasGetCoord_TCL_DECLARED
+#define Tk_CanvasGetCoord_TCL_DECLARED
/* 9 */
-EXTERN int Tk_CanvasGetCoord _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Canvas canvas, CONST char * str,
- double * doublePtr));
+EXTERN int Tk_CanvasGetCoord(Tcl_Interp *interp,
+ Tk_Canvas canvas, CONST char *str,
+ double *doublePtr);
+#endif
+#ifndef Tk_CanvasGetTextInfo_TCL_DECLARED
+#define Tk_CanvasGetTextInfo_TCL_DECLARED
/* 10 */
-EXTERN Tk_CanvasTextInfo * Tk_CanvasGetTextInfo _ANSI_ARGS_((
- Tk_Canvas canvas));
+EXTERN Tk_CanvasTextInfo * Tk_CanvasGetTextInfo(Tk_Canvas canvas);
+#endif
+#ifndef Tk_CanvasPsBitmap_TCL_DECLARED
+#define Tk_CanvasPsBitmap_TCL_DECLARED
/* 11 */
-EXTERN int Tk_CanvasPsBitmap _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Canvas canvas, Pixmap bitmap, int x,
- int y, int width, int height));
+EXTERN int Tk_CanvasPsBitmap(Tcl_Interp *interp,
+ Tk_Canvas canvas, Pixmap bitmap, int x,
+ int y, int width, int height);
+#endif
+#ifndef Tk_CanvasPsColor_TCL_DECLARED
+#define Tk_CanvasPsColor_TCL_DECLARED
/* 12 */
-EXTERN int Tk_CanvasPsColor _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Canvas canvas, XColor * colorPtr));
+EXTERN int Tk_CanvasPsColor(Tcl_Interp *interp,
+ Tk_Canvas canvas, XColor *colorPtr);
+#endif
+#ifndef Tk_CanvasPsFont_TCL_DECLARED
+#define Tk_CanvasPsFont_TCL_DECLARED
/* 13 */
-EXTERN int Tk_CanvasPsFont _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Canvas canvas, Tk_Font font));
+EXTERN int Tk_CanvasPsFont(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Font font);
+#endif
+#ifndef Tk_CanvasPsPath_TCL_DECLARED
+#define Tk_CanvasPsPath_TCL_DECLARED
/* 14 */
-EXTERN void Tk_CanvasPsPath _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Canvas canvas, double * coordPtr,
- int numPoints));
+EXTERN void Tk_CanvasPsPath(Tcl_Interp *interp, Tk_Canvas canvas,
+ double *coordPtr, int numPoints);
+#endif
+#ifndef Tk_CanvasPsStipple_TCL_DECLARED
+#define Tk_CanvasPsStipple_TCL_DECLARED
/* 15 */
-EXTERN int Tk_CanvasPsStipple _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Canvas canvas, Pixmap bitmap));
+EXTERN int Tk_CanvasPsStipple(Tcl_Interp *interp,
+ Tk_Canvas canvas, Pixmap bitmap);
+#endif
+#ifndef Tk_CanvasPsY_TCL_DECLARED
+#define Tk_CanvasPsY_TCL_DECLARED
/* 16 */
-EXTERN double Tk_CanvasPsY _ANSI_ARGS_((Tk_Canvas canvas, double y));
+EXTERN double Tk_CanvasPsY(Tk_Canvas canvas, double y);
+#endif
+#ifndef Tk_CanvasSetStippleOrigin_TCL_DECLARED
+#define Tk_CanvasSetStippleOrigin_TCL_DECLARED
/* 17 */
-EXTERN void Tk_CanvasSetStippleOrigin _ANSI_ARGS_((
- Tk_Canvas canvas, GC gc));
+EXTERN void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc);
+#endif
+#ifndef Tk_CanvasTagsParseProc_TCL_DECLARED
+#define Tk_CanvasTagsParseProc_TCL_DECLARED
/* 18 */
-EXTERN int Tk_CanvasTagsParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * value,
- char * widgRec, int offset));
+EXTERN int Tk_CanvasTagsParseProc(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *value, char *widgRec, int offset);
+#endif
+#ifndef Tk_CanvasTagsPrintProc_TCL_DECLARED
+#define Tk_CanvasTagsPrintProc_TCL_DECLARED
/* 19 */
-EXTERN char * Tk_CanvasTagsPrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char * widgRec, int offset,
- Tcl_FreeProc ** freeProcPtr));
+EXTERN char * Tk_CanvasTagsPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec, int offset,
+ Tcl_FreeProc **freeProcPtr);
+#endif
+#ifndef Tk_CanvasTkwin_TCL_DECLARED
+#define Tk_CanvasTkwin_TCL_DECLARED
/* 20 */
-EXTERN Tk_Window Tk_CanvasTkwin _ANSI_ARGS_((Tk_Canvas canvas));
+EXTERN Tk_Window Tk_CanvasTkwin(Tk_Canvas canvas);
+#endif
+#ifndef Tk_CanvasWindowCoords_TCL_DECLARED
+#define Tk_CanvasWindowCoords_TCL_DECLARED
/* 21 */
-EXTERN void Tk_CanvasWindowCoords _ANSI_ARGS_((Tk_Canvas canvas,
- double x, double y, short * screenXPtr,
- short * screenYPtr));
+EXTERN void Tk_CanvasWindowCoords(Tk_Canvas canvas, double x,
+ double y, short *screenXPtr,
+ short *screenYPtr);
+#endif
+#ifndef Tk_ChangeWindowAttributes_TCL_DECLARED
+#define Tk_ChangeWindowAttributes_TCL_DECLARED
/* 22 */
-EXTERN void Tk_ChangeWindowAttributes _ANSI_ARGS_((
- Tk_Window tkwin, unsigned long valueMask,
- XSetWindowAttributes * attsPtr));
+EXTERN void Tk_ChangeWindowAttributes(Tk_Window tkwin,
+ unsigned long valueMask,
+ XSetWindowAttributes *attsPtr);
+#endif
+#ifndef Tk_CharBbox_TCL_DECLARED
+#define Tk_CharBbox_TCL_DECLARED
/* 23 */
-EXTERN int Tk_CharBbox _ANSI_ARGS_((Tk_TextLayout layout,
- int index, int * xPtr, int * yPtr,
- int * widthPtr, int * heightPtr));
+EXTERN int Tk_CharBbox(Tk_TextLayout layout, int index,
+ int *xPtr, int *yPtr, int *widthPtr,
+ int *heightPtr);
+#endif
+#ifndef Tk_ClearSelection_TCL_DECLARED
+#define Tk_ClearSelection_TCL_DECLARED
/* 24 */
-EXTERN void Tk_ClearSelection _ANSI_ARGS_((Tk_Window tkwin,
- Atom selection));
+EXTERN void Tk_ClearSelection(Tk_Window tkwin, Atom selection);
+#endif
+#ifndef Tk_ClipboardAppend_TCL_DECLARED
+#define Tk_ClipboardAppend_TCL_DECLARED
/* 25 */
-EXTERN int Tk_ClipboardAppend _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Atom target, Atom format,
- char* buffer));
+EXTERN int Tk_ClipboardAppend(Tcl_Interp *interp,
+ Tk_Window tkwin, Atom target, Atom format,
+ char *buffer);
+#endif
+#ifndef Tk_ClipboardClear_TCL_DECLARED
+#define Tk_ClipboardClear_TCL_DECLARED
/* 26 */
-EXTERN int Tk_ClipboardClear _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin));
+EXTERN int Tk_ClipboardClear(Tcl_Interp *interp,
+ Tk_Window tkwin);
+#endif
+#ifndef Tk_ConfigureInfo_TCL_DECLARED
+#define Tk_ConfigureInfo_TCL_DECLARED
/* 27 */
-EXTERN int Tk_ConfigureInfo _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_ConfigSpec * specs,
- char * widgRec, CONST char * argvName,
- int flags));
+EXTERN int Tk_ConfigureInfo(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_ConfigSpec *specs, char *widgRec,
+ CONST char *argvName, int flags);
+#endif
+#ifndef Tk_ConfigureValue_TCL_DECLARED
+#define Tk_ConfigureValue_TCL_DECLARED
/* 28 */
-EXTERN int Tk_ConfigureValue _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_ConfigSpec * specs,
- char * widgRec, CONST char * argvName,
- int flags));
+EXTERN int Tk_ConfigureValue(Tcl_Interp *interp,
+ Tk_Window tkwin, Tk_ConfigSpec *specs,
+ char *widgRec, CONST char *argvName,
+ int flags);
+#endif
+#ifndef Tk_ConfigureWidget_TCL_DECLARED
+#define Tk_ConfigureWidget_TCL_DECLARED
/* 29 */
-EXTERN int Tk_ConfigureWidget _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_ConfigSpec * specs,
- int argc, CONST84 char ** argv,
- char * widgRec, int flags));
+EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp,
+ Tk_Window tkwin, Tk_ConfigSpec *specs,
+ int argc, CONST84 char **argv, char *widgRec,
+ int flags);
+#endif
+#ifndef Tk_ConfigureWindow_TCL_DECLARED
+#define Tk_ConfigureWindow_TCL_DECLARED
/* 30 */
-EXTERN void Tk_ConfigureWindow _ANSI_ARGS_((Tk_Window tkwin,
- unsigned int valueMask,
- XWindowChanges * valuePtr));
+EXTERN void Tk_ConfigureWindow(Tk_Window tkwin,
+ unsigned int valueMask,
+ XWindowChanges *valuePtr);
+#endif
+#ifndef Tk_ComputeTextLayout_TCL_DECLARED
+#define Tk_ComputeTextLayout_TCL_DECLARED
/* 31 */
-EXTERN Tk_TextLayout Tk_ComputeTextLayout _ANSI_ARGS_((Tk_Font font,
- CONST char * str, int numChars,
- int wrapLength, Tk_Justify justify,
- int flags, int * widthPtr, int * heightPtr));
+EXTERN Tk_TextLayout Tk_ComputeTextLayout(Tk_Font font, CONST char *str,
+ int numChars, int wrapLength,
+ Tk_Justify justify, int flags, int *widthPtr,
+ int *heightPtr);
+#endif
+#ifndef Tk_CoordsToWindow_TCL_DECLARED
+#define Tk_CoordsToWindow_TCL_DECLARED
/* 32 */
-EXTERN Tk_Window Tk_CoordsToWindow _ANSI_ARGS_((int rootX, int rootY,
- Tk_Window tkwin));
+EXTERN Tk_Window Tk_CoordsToWindow(int rootX, int rootY,
+ Tk_Window tkwin);
+#endif
+#ifndef Tk_CreateBinding_TCL_DECLARED
+#define Tk_CreateBinding_TCL_DECLARED
/* 33 */
-EXTERN unsigned long Tk_CreateBinding _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_BindingTable bindingTable,
- ClientData object, CONST char * eventStr,
- CONST char * command, int append));
+EXTERN unsigned long Tk_CreateBinding(Tcl_Interp *interp,
+ Tk_BindingTable bindingTable,
+ ClientData object, CONST char *eventStr,
+ CONST char *command, int append);
+#endif
+#ifndef Tk_CreateBindingTable_TCL_DECLARED
+#define Tk_CreateBindingTable_TCL_DECLARED
/* 34 */
-EXTERN Tk_BindingTable Tk_CreateBindingTable _ANSI_ARGS_((
- Tcl_Interp * interp));
+EXTERN Tk_BindingTable Tk_CreateBindingTable(Tcl_Interp *interp);
+#endif
+#ifndef Tk_CreateErrorHandler_TCL_DECLARED
+#define Tk_CreateErrorHandler_TCL_DECLARED
/* 35 */
-EXTERN Tk_ErrorHandler Tk_CreateErrorHandler _ANSI_ARGS_((Display * display,
- int errNum, int request, int minorCode,
- Tk_ErrorProc * errorProc,
- ClientData clientData));
+EXTERN Tk_ErrorHandler Tk_CreateErrorHandler(Display *display, int errNum,
+ int request, int minorCode,
+ Tk_ErrorProc *errorProc,
+ ClientData clientData);
+#endif
+#ifndef Tk_CreateEventHandler_TCL_DECLARED
+#define Tk_CreateEventHandler_TCL_DECLARED
/* 36 */
-EXTERN void Tk_CreateEventHandler _ANSI_ARGS_((Tk_Window token,
- unsigned long mask, Tk_EventProc * proc,
- ClientData clientData));
+EXTERN void Tk_CreateEventHandler(Tk_Window token,
+ unsigned long mask, Tk_EventProc *proc,
+ ClientData clientData);
+#endif
+#ifndef Tk_CreateGenericHandler_TCL_DECLARED
+#define Tk_CreateGenericHandler_TCL_DECLARED
/* 37 */
-EXTERN void Tk_CreateGenericHandler _ANSI_ARGS_((
- Tk_GenericProc * proc, ClientData clientData));
+EXTERN void Tk_CreateGenericHandler(Tk_GenericProc *proc,
+ ClientData clientData);
+#endif
+#ifndef Tk_CreateImageType_TCL_DECLARED
+#define Tk_CreateImageType_TCL_DECLARED
/* 38 */
-EXTERN void Tk_CreateImageType _ANSI_ARGS_((
- Tk_ImageType * typePtr));
+EXTERN void Tk_CreateImageType(Tk_ImageType *typePtr);
+#endif
+#ifndef Tk_CreateItemType_TCL_DECLARED
+#define Tk_CreateItemType_TCL_DECLARED
/* 39 */
-EXTERN void Tk_CreateItemType _ANSI_ARGS_((Tk_ItemType * typePtr));
+EXTERN void Tk_CreateItemType(Tk_ItemType *typePtr);
+#endif
+#ifndef Tk_CreatePhotoImageFormat_TCL_DECLARED
+#define Tk_CreatePhotoImageFormat_TCL_DECLARED
/* 40 */
-EXTERN void Tk_CreatePhotoImageFormat _ANSI_ARGS_((
- Tk_PhotoImageFormat * formatPtr));
+EXTERN void Tk_CreatePhotoImageFormat(
+ Tk_PhotoImageFormat *formatPtr);
+#endif
+#ifndef Tk_CreateSelHandler_TCL_DECLARED
+#define Tk_CreateSelHandler_TCL_DECLARED
/* 41 */
-EXTERN void Tk_CreateSelHandler _ANSI_ARGS_((Tk_Window tkwin,
- Atom selection, Atom target,
- Tk_SelectionProc * proc,
- ClientData clientData, Atom format));
+EXTERN void Tk_CreateSelHandler(Tk_Window tkwin, Atom selection,
+ Atom target, Tk_SelectionProc *proc,
+ ClientData clientData, Atom format);
+#endif
+#ifndef Tk_CreateWindow_TCL_DECLARED
+#define Tk_CreateWindow_TCL_DECLARED
/* 42 */
-EXTERN Tk_Window Tk_CreateWindow _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window parent, CONST char * name,
- CONST char * screenName));
+EXTERN Tk_Window Tk_CreateWindow(Tcl_Interp *interp, Tk_Window parent,
+ CONST char *name, CONST char *screenName);
+#endif
+#ifndef Tk_CreateWindowFromPath_TCL_DECLARED
+#define Tk_CreateWindowFromPath_TCL_DECLARED
/* 43 */
-EXTERN Tk_Window Tk_CreateWindowFromPath _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window tkwin,
- CONST char * pathName,
- CONST char * screenName));
+EXTERN Tk_Window Tk_CreateWindowFromPath(Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *pathName,
+ CONST char *screenName);
+#endif
+#ifndef Tk_DefineBitmap_TCL_DECLARED
+#define Tk_DefineBitmap_TCL_DECLARED
/* 44 */
-EXTERN int Tk_DefineBitmap _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * name, CONST char * source,
- int width, int height));
+EXTERN int Tk_DefineBitmap(Tcl_Interp *interp, CONST char *name,
+ CONST char *source, int width, int height);
+#endif
+#ifndef Tk_DefineCursor_TCL_DECLARED
+#define Tk_DefineCursor_TCL_DECLARED
/* 45 */
-EXTERN void Tk_DefineCursor _ANSI_ARGS_((Tk_Window window,
- Tk_Cursor cursor));
+EXTERN void Tk_DefineCursor(Tk_Window window, Tk_Cursor cursor);
+#endif
+#ifndef Tk_DeleteAllBindings_TCL_DECLARED
+#define Tk_DeleteAllBindings_TCL_DECLARED
/* 46 */
-EXTERN void Tk_DeleteAllBindings _ANSI_ARGS_((
- Tk_BindingTable bindingTable,
- ClientData object));
+EXTERN void Tk_DeleteAllBindings(Tk_BindingTable bindingTable,
+ ClientData object);
+#endif
+#ifndef Tk_DeleteBinding_TCL_DECLARED
+#define Tk_DeleteBinding_TCL_DECLARED
/* 47 */
-EXTERN int Tk_DeleteBinding _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_BindingTable bindingTable,
- ClientData object, CONST char * eventStr));
+EXTERN int Tk_DeleteBinding(Tcl_Interp *interp,
+ Tk_BindingTable bindingTable,
+ ClientData object, CONST char *eventStr);
+#endif
+#ifndef Tk_DeleteBindingTable_TCL_DECLARED
+#define Tk_DeleteBindingTable_TCL_DECLARED
/* 48 */
-EXTERN void Tk_DeleteBindingTable _ANSI_ARGS_((
- Tk_BindingTable bindingTable));
+EXTERN void Tk_DeleteBindingTable(Tk_BindingTable bindingTable);
+#endif
+#ifndef Tk_DeleteErrorHandler_TCL_DECLARED
+#define Tk_DeleteErrorHandler_TCL_DECLARED
/* 49 */
-EXTERN void Tk_DeleteErrorHandler _ANSI_ARGS_((
- Tk_ErrorHandler handler));
+EXTERN void Tk_DeleteErrorHandler(Tk_ErrorHandler handler);
+#endif
+#ifndef Tk_DeleteEventHandler_TCL_DECLARED
+#define Tk_DeleteEventHandler_TCL_DECLARED
/* 50 */
-EXTERN void Tk_DeleteEventHandler _ANSI_ARGS_((Tk_Window token,
- unsigned long mask, Tk_EventProc * proc,
- ClientData clientData));
+EXTERN void Tk_DeleteEventHandler(Tk_Window token,
+ unsigned long mask, Tk_EventProc *proc,
+ ClientData clientData);
+#endif
+#ifndef Tk_DeleteGenericHandler_TCL_DECLARED
+#define Tk_DeleteGenericHandler_TCL_DECLARED
/* 51 */
-EXTERN void Tk_DeleteGenericHandler _ANSI_ARGS_((
- Tk_GenericProc * proc, ClientData clientData));
+EXTERN void Tk_DeleteGenericHandler(Tk_GenericProc *proc,
+ ClientData clientData);
+#endif
+#ifndef Tk_DeleteImage_TCL_DECLARED
+#define Tk_DeleteImage_TCL_DECLARED
/* 52 */
-EXTERN void Tk_DeleteImage _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * name));
+EXTERN void Tk_DeleteImage(Tcl_Interp *interp, CONST char *name);
+#endif
+#ifndef Tk_DeleteSelHandler_TCL_DECLARED
+#define Tk_DeleteSelHandler_TCL_DECLARED
/* 53 */
-EXTERN void Tk_DeleteSelHandler _ANSI_ARGS_((Tk_Window tkwin,
- Atom selection, Atom target));
+EXTERN void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection,
+ Atom target);
+#endif
+#ifndef Tk_DestroyWindow_TCL_DECLARED
+#define Tk_DestroyWindow_TCL_DECLARED
/* 54 */
-EXTERN void Tk_DestroyWindow _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void Tk_DestroyWindow(Tk_Window tkwin);
+#endif
+#ifndef Tk_DisplayName_TCL_DECLARED
+#define Tk_DisplayName_TCL_DECLARED
/* 55 */
-EXTERN CONST84_RETURN char * Tk_DisplayName _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN CONST84_RETURN char * Tk_DisplayName(Tk_Window tkwin);
+#endif
+#ifndef Tk_DistanceToTextLayout_TCL_DECLARED
+#define Tk_DistanceToTextLayout_TCL_DECLARED
/* 56 */
-EXTERN int Tk_DistanceToTextLayout _ANSI_ARGS_((
- Tk_TextLayout layout, int x, int y));
+EXTERN int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x,
+ int y);
+#endif
+#ifndef Tk_Draw3DPolygon_TCL_DECLARED
+#define Tk_Draw3DPolygon_TCL_DECLARED
/* 57 */
-EXTERN void Tk_Draw3DPolygon _ANSI_ARGS_((Tk_Window tkwin,
- Drawable drawable, Tk_3DBorder border,
- XPoint * pointPtr, int numPoints,
- int borderWidth, int leftRelief));
+EXTERN void Tk_Draw3DPolygon(Tk_Window tkwin, Drawable drawable,
+ Tk_3DBorder border, XPoint *pointPtr,
+ int numPoints, int borderWidth,
+ int leftRelief);
+#endif
+#ifndef Tk_Draw3DRectangle_TCL_DECLARED
+#define Tk_Draw3DRectangle_TCL_DECLARED
/* 58 */
-EXTERN void Tk_Draw3DRectangle _ANSI_ARGS_((Tk_Window tkwin,
- Drawable drawable, Tk_3DBorder border, int x,
- int y, int width, int height,
- int borderWidth, int relief));
+EXTERN void Tk_Draw3DRectangle(Tk_Window tkwin,
+ Drawable drawable, Tk_3DBorder border, int x,
+ int y, int width, int height,
+ int borderWidth, int relief);
+#endif
+#ifndef Tk_DrawChars_TCL_DECLARED
+#define Tk_DrawChars_TCL_DECLARED
/* 59 */
-EXTERN void Tk_DrawChars _ANSI_ARGS_((Display * display,
- Drawable drawable, GC gc, Tk_Font tkfont,
- CONST char * source, int numBytes, int x,
- int y));
+EXTERN void Tk_DrawChars(Display *display, Drawable drawable,
+ GC gc, Tk_Font tkfont, CONST char *source,
+ int numBytes, int x, int y);
+#endif
+#ifndef Tk_DrawFocusHighlight_TCL_DECLARED
+#define Tk_DrawFocusHighlight_TCL_DECLARED
/* 60 */
-EXTERN void Tk_DrawFocusHighlight _ANSI_ARGS_((Tk_Window tkwin,
- GC gc, int width, Drawable drawable));
+EXTERN void Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc,
+ int width, Drawable drawable);
+#endif
+#ifndef Tk_DrawTextLayout_TCL_DECLARED
+#define Tk_DrawTextLayout_TCL_DECLARED
/* 61 */
-EXTERN void Tk_DrawTextLayout _ANSI_ARGS_((Display * display,
- Drawable drawable, GC gc,
- Tk_TextLayout layout, int x, int y,
- int firstChar, int lastChar));
+EXTERN void Tk_DrawTextLayout(Display *display,
+ Drawable drawable, GC gc,
+ Tk_TextLayout layout, int x, int y,
+ int firstChar, int lastChar);
+#endif
+#ifndef Tk_Fill3DPolygon_TCL_DECLARED
+#define Tk_Fill3DPolygon_TCL_DECLARED
/* 62 */
-EXTERN void Tk_Fill3DPolygon _ANSI_ARGS_((Tk_Window tkwin,
- Drawable drawable, Tk_3DBorder border,
- XPoint * pointPtr, int numPoints,
- int borderWidth, int leftRelief));
+EXTERN void Tk_Fill3DPolygon(Tk_Window tkwin, Drawable drawable,
+ Tk_3DBorder border, XPoint *pointPtr,
+ int numPoints, int borderWidth,
+ int leftRelief);
+#endif
+#ifndef Tk_Fill3DRectangle_TCL_DECLARED
+#define Tk_Fill3DRectangle_TCL_DECLARED
/* 63 */
-EXTERN void Tk_Fill3DRectangle _ANSI_ARGS_((Tk_Window tkwin,
- Drawable drawable, Tk_3DBorder border, int x,
- int y, int width, int height,
- int borderWidth, int relief));
+EXTERN void Tk_Fill3DRectangle(Tk_Window tkwin,
+ Drawable drawable, Tk_3DBorder border, int x,
+ int y, int width, int height,
+ int borderWidth, int relief);
+#endif
+#ifndef Tk_FindPhoto_TCL_DECLARED
+#define Tk_FindPhoto_TCL_DECLARED
/* 64 */
-EXTERN Tk_PhotoHandle Tk_FindPhoto _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * imageName));
+EXTERN Tk_PhotoHandle Tk_FindPhoto(Tcl_Interp *interp,
+ CONST char *imageName);
+#endif
+#ifndef Tk_FontId_TCL_DECLARED
+#define Tk_FontId_TCL_DECLARED
/* 65 */
-EXTERN Font Tk_FontId _ANSI_ARGS_((Tk_Font font));
+EXTERN Font Tk_FontId(Tk_Font font);
+#endif
+#ifndef Tk_Free3DBorder_TCL_DECLARED
+#define Tk_Free3DBorder_TCL_DECLARED
/* 66 */
-EXTERN void Tk_Free3DBorder _ANSI_ARGS_((Tk_3DBorder border));
+EXTERN void Tk_Free3DBorder(Tk_3DBorder border);
+#endif
+#ifndef Tk_FreeBitmap_TCL_DECLARED
+#define Tk_FreeBitmap_TCL_DECLARED
/* 67 */
-EXTERN void Tk_FreeBitmap _ANSI_ARGS_((Display * display,
- Pixmap bitmap));
+EXTERN void Tk_FreeBitmap(Display *display, Pixmap bitmap);
+#endif
+#ifndef Tk_FreeColor_TCL_DECLARED
+#define Tk_FreeColor_TCL_DECLARED
/* 68 */
-EXTERN void Tk_FreeColor _ANSI_ARGS_((XColor * colorPtr));
+EXTERN void Tk_FreeColor(XColor *colorPtr);
+#endif
+#ifndef Tk_FreeColormap_TCL_DECLARED
+#define Tk_FreeColormap_TCL_DECLARED
/* 69 */
-EXTERN void Tk_FreeColormap _ANSI_ARGS_((Display * display,
- Colormap colormap));
+EXTERN void Tk_FreeColormap(Display *display, Colormap colormap);
+#endif
+#ifndef Tk_FreeCursor_TCL_DECLARED
+#define Tk_FreeCursor_TCL_DECLARED
/* 70 */
-EXTERN void Tk_FreeCursor _ANSI_ARGS_((Display * display,
- Tk_Cursor cursor));
+EXTERN void Tk_FreeCursor(Display *display, Tk_Cursor cursor);
+#endif
+#ifndef Tk_FreeFont_TCL_DECLARED
+#define Tk_FreeFont_TCL_DECLARED
/* 71 */
-EXTERN void Tk_FreeFont _ANSI_ARGS_((Tk_Font f));
+EXTERN void Tk_FreeFont(Tk_Font f);
+#endif
+#ifndef Tk_FreeGC_TCL_DECLARED
+#define Tk_FreeGC_TCL_DECLARED
/* 72 */
-EXTERN void Tk_FreeGC _ANSI_ARGS_((Display * display, GC gc));
+EXTERN void Tk_FreeGC(Display *display, GC gc);
+#endif
+#ifndef Tk_FreeImage_TCL_DECLARED
+#define Tk_FreeImage_TCL_DECLARED
/* 73 */
-EXTERN void Tk_FreeImage _ANSI_ARGS_((Tk_Image image));
+EXTERN void Tk_FreeImage(Tk_Image image);
+#endif
+#ifndef Tk_FreeOptions_TCL_DECLARED
+#define Tk_FreeOptions_TCL_DECLARED
/* 74 */
-EXTERN void Tk_FreeOptions _ANSI_ARGS_((Tk_ConfigSpec * specs,
- char * widgRec, Display * display,
- int needFlags));
+EXTERN void Tk_FreeOptions(Tk_ConfigSpec *specs, char *widgRec,
+ Display *display, int needFlags);
+#endif
+#ifndef Tk_FreePixmap_TCL_DECLARED
+#define Tk_FreePixmap_TCL_DECLARED
/* 75 */
-EXTERN void Tk_FreePixmap _ANSI_ARGS_((Display * display,
- Pixmap pixmap));
+EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap);
+#endif
+#ifndef Tk_FreeTextLayout_TCL_DECLARED
+#define Tk_FreeTextLayout_TCL_DECLARED
/* 76 */
-EXTERN void Tk_FreeTextLayout _ANSI_ARGS_((
- Tk_TextLayout textLayout));
+EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout);
+#endif
+#ifndef Tk_FreeXId_TCL_DECLARED
+#define Tk_FreeXId_TCL_DECLARED
/* 77 */
-EXTERN void Tk_FreeXId _ANSI_ARGS_((Display * display, XID xid));
+EXTERN void Tk_FreeXId(Display *display, XID xid);
+#endif
+#ifndef Tk_GCForColor_TCL_DECLARED
+#define Tk_GCForColor_TCL_DECLARED
/* 78 */
-EXTERN GC Tk_GCForColor _ANSI_ARGS_((XColor * colorPtr,
- Drawable drawable));
+EXTERN GC Tk_GCForColor(XColor *colorPtr, Drawable drawable);
+#endif
+#ifndef Tk_GeometryRequest_TCL_DECLARED
+#define Tk_GeometryRequest_TCL_DECLARED
/* 79 */
-EXTERN void Tk_GeometryRequest _ANSI_ARGS_((Tk_Window tkwin,
- int reqWidth, int reqHeight));
+EXTERN void Tk_GeometryRequest(Tk_Window tkwin, int reqWidth,
+ int reqHeight);
+#endif
+#ifndef Tk_Get3DBorder_TCL_DECLARED
+#define Tk_Get3DBorder_TCL_DECLARED
/* 80 */
-EXTERN Tk_3DBorder Tk_Get3DBorder _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_Uid colorName));
+EXTERN Tk_3DBorder Tk_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_Uid colorName);
+#endif
+#ifndef Tk_GetAllBindings_TCL_DECLARED
+#define Tk_GetAllBindings_TCL_DECLARED
/* 81 */
-EXTERN void Tk_GetAllBindings _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_BindingTable bindingTable,
- ClientData object));
+EXTERN void Tk_GetAllBindings(Tcl_Interp *interp,
+ Tk_BindingTable bindingTable,
+ ClientData object);
+#endif
+#ifndef Tk_GetAnchor_TCL_DECLARED
+#define Tk_GetAnchor_TCL_DECLARED
/* 82 */
-EXTERN int Tk_GetAnchor _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * str, Tk_Anchor * anchorPtr));
+EXTERN int Tk_GetAnchor(Tcl_Interp *interp, CONST char *str,
+ Tk_Anchor *anchorPtr);
+#endif
+#ifndef Tk_GetAtomName_TCL_DECLARED
+#define Tk_GetAtomName_TCL_DECLARED
/* 83 */
-EXTERN CONST84_RETURN char * Tk_GetAtomName _ANSI_ARGS_((Tk_Window tkwin,
- Atom atom));
+EXTERN CONST84_RETURN char * Tk_GetAtomName(Tk_Window tkwin, Atom atom);
+#endif
+#ifndef Tk_GetBinding_TCL_DECLARED
+#define Tk_GetBinding_TCL_DECLARED
/* 84 */
-EXTERN CONST84_RETURN char * Tk_GetBinding _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_BindingTable bindingTable,
- ClientData object, CONST char * eventStr));
+EXTERN CONST84_RETURN char * Tk_GetBinding(Tcl_Interp *interp,
+ Tk_BindingTable bindingTable,
+ ClientData object, CONST char *eventStr);
+#endif
+#ifndef Tk_GetBitmap_TCL_DECLARED
+#define Tk_GetBitmap_TCL_DECLARED
/* 85 */
-EXTERN Pixmap Tk_GetBitmap _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * str));
+EXTERN Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *str);
+#endif
+#ifndef Tk_GetBitmapFromData_TCL_DECLARED
+#define Tk_GetBitmapFromData_TCL_DECLARED
/* 86 */
-EXTERN Pixmap Tk_GetBitmapFromData _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window tkwin,
- CONST char * source, int width, int height));
+EXTERN Pixmap Tk_GetBitmapFromData(Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *source,
+ int width, int height);
+#endif
+#ifndef Tk_GetCapStyle_TCL_DECLARED
+#define Tk_GetCapStyle_TCL_DECLARED
/* 87 */
-EXTERN int Tk_GetCapStyle _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * str, int * capPtr));
+EXTERN int Tk_GetCapStyle(Tcl_Interp *interp, CONST char *str,
+ int *capPtr);
+#endif
+#ifndef Tk_GetColor_TCL_DECLARED
+#define Tk_GetColor_TCL_DECLARED
/* 88 */
-EXTERN XColor * Tk_GetColor _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_Uid name));
+EXTERN XColor * Tk_GetColor(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_Uid name);
+#endif
+#ifndef Tk_GetColorByValue_TCL_DECLARED
+#define Tk_GetColorByValue_TCL_DECLARED
/* 89 */
-EXTERN XColor * Tk_GetColorByValue _ANSI_ARGS_((Tk_Window tkwin,
- XColor * colorPtr));
+EXTERN XColor * Tk_GetColorByValue(Tk_Window tkwin, XColor *colorPtr);
+#endif
+#ifndef Tk_GetColormap_TCL_DECLARED
+#define Tk_GetColormap_TCL_DECLARED
/* 90 */
-EXTERN Colormap Tk_GetColormap _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * str));
+EXTERN Colormap Tk_GetColormap(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *str);
+#endif
+#ifndef Tk_GetCursor_TCL_DECLARED
+#define Tk_GetCursor_TCL_DECLARED
/* 91 */
-EXTERN Tk_Cursor Tk_GetCursor _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_Uid str));
+EXTERN Tk_Cursor Tk_GetCursor(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_Uid str);
+#endif
+#ifndef Tk_GetCursorFromData_TCL_DECLARED
+#define Tk_GetCursorFromData_TCL_DECLARED
/* 92 */
-EXTERN Tk_Cursor Tk_GetCursorFromData _ANSI_ARGS_((
- 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));
+EXTERN 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);
+#endif
+#ifndef Tk_GetFont_TCL_DECLARED
+#define Tk_GetFont_TCL_DECLARED
/* 93 */
-EXTERN Tk_Font Tk_GetFont _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * str));
+EXTERN Tk_Font Tk_GetFont(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *str);
+#endif
+#ifndef Tk_GetFontFromObj_TCL_DECLARED
+#define Tk_GetFontFromObj_TCL_DECLARED
/* 94 */
-EXTERN Tk_Font Tk_GetFontFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN Tk_Font Tk_GetFontFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_GetFontMetrics_TCL_DECLARED
+#define Tk_GetFontMetrics_TCL_DECLARED
/* 95 */
-EXTERN void Tk_GetFontMetrics _ANSI_ARGS_((Tk_Font font,
- Tk_FontMetrics * fmPtr));
+EXTERN void Tk_GetFontMetrics(Tk_Font font,
+ Tk_FontMetrics *fmPtr);
+#endif
+#ifndef Tk_GetGC_TCL_DECLARED
+#define Tk_GetGC_TCL_DECLARED
/* 96 */
-EXTERN GC Tk_GetGC _ANSI_ARGS_((Tk_Window tkwin,
- unsigned long valueMask,
- XGCValues * valuePtr));
+EXTERN GC Tk_GetGC(Tk_Window tkwin, unsigned long valueMask,
+ XGCValues *valuePtr);
+#endif
+#ifndef Tk_GetImage_TCL_DECLARED
+#define Tk_GetImage_TCL_DECLARED
/* 97 */
-EXTERN Tk_Image Tk_GetImage _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * name,
- Tk_ImageChangedProc * changeProc,
- ClientData clientData));
+EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *name,
+ Tk_ImageChangedProc *changeProc,
+ ClientData clientData);
+#endif
+#ifndef Tk_GetImageMasterData_TCL_DECLARED
+#define Tk_GetImageMasterData_TCL_DECLARED
/* 98 */
-EXTERN ClientData Tk_GetImageMasterData _ANSI_ARGS_((
- Tcl_Interp * interp, CONST char * name,
- Tk_ImageType ** typePtrPtr));
+EXTERN ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
+ CONST char *name, Tk_ImageType **typePtrPtr);
+#endif
+#ifndef Tk_GetItemTypes_TCL_DECLARED
+#define Tk_GetItemTypes_TCL_DECLARED
/* 99 */
-EXTERN Tk_ItemType * Tk_GetItemTypes _ANSI_ARGS_((void));
+EXTERN Tk_ItemType * Tk_GetItemTypes(void);
+#endif
+#ifndef Tk_GetJoinStyle_TCL_DECLARED
+#define Tk_GetJoinStyle_TCL_DECLARED
/* 100 */
-EXTERN int Tk_GetJoinStyle _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * str, int * joinPtr));
+EXTERN int Tk_GetJoinStyle(Tcl_Interp *interp, CONST char *str,
+ int *joinPtr);
+#endif
+#ifndef Tk_GetJustify_TCL_DECLARED
+#define Tk_GetJustify_TCL_DECLARED
/* 101 */
-EXTERN int Tk_GetJustify _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * str, Tk_Justify * justifyPtr));
+EXTERN int Tk_GetJustify(Tcl_Interp *interp, CONST char *str,
+ Tk_Justify *justifyPtr);
+#endif
+#ifndef Tk_GetNumMainWindows_TCL_DECLARED
+#define Tk_GetNumMainWindows_TCL_DECLARED
/* 102 */
-EXTERN int Tk_GetNumMainWindows _ANSI_ARGS_((void));
+EXTERN int Tk_GetNumMainWindows(void);
+#endif
+#ifndef Tk_GetOption_TCL_DECLARED
+#define Tk_GetOption_TCL_DECLARED
/* 103 */
-EXTERN Tk_Uid Tk_GetOption _ANSI_ARGS_((Tk_Window tkwin,
- CONST char * name, CONST char * className));
+EXTERN Tk_Uid Tk_GetOption(Tk_Window tkwin, CONST char *name,
+ CONST char *className);
+#endif
+#ifndef Tk_GetPixels_TCL_DECLARED
+#define Tk_GetPixels_TCL_DECLARED
/* 104 */
-EXTERN int Tk_GetPixels _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * str,
- int * intPtr));
+EXTERN int Tk_GetPixels(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *str, int *intPtr);
+#endif
+#ifndef Tk_GetPixmap_TCL_DECLARED
+#define Tk_GetPixmap_TCL_DECLARED
/* 105 */
-EXTERN Pixmap Tk_GetPixmap _ANSI_ARGS_((Display * display,
- Drawable d, int width, int height, int depth));
+EXTERN Pixmap Tk_GetPixmap(Display *display, Drawable d, int width,
+ int height, int depth);
+#endif
+#ifndef Tk_GetRelief_TCL_DECLARED
+#define Tk_GetRelief_TCL_DECLARED
/* 106 */
-EXTERN int Tk_GetRelief _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * name, int * reliefPtr));
+EXTERN int Tk_GetRelief(Tcl_Interp *interp, CONST char *name,
+ int *reliefPtr);
+#endif
+#ifndef Tk_GetRootCoords_TCL_DECLARED
+#define Tk_GetRootCoords_TCL_DECLARED
/* 107 */
-EXTERN void Tk_GetRootCoords _ANSI_ARGS_((Tk_Window tkwin,
- int * xPtr, int * yPtr));
+EXTERN void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr,
+ int *yPtr);
+#endif
+#ifndef Tk_GetScrollInfo_TCL_DECLARED
+#define Tk_GetScrollInfo_TCL_DECLARED
/* 108 */
-EXTERN int Tk_GetScrollInfo _ANSI_ARGS_((Tcl_Interp * interp,
- int argc, CONST84 char ** argv,
- double * dblPtr, int * intPtr));
+EXTERN int Tk_GetScrollInfo(Tcl_Interp *interp, int argc,
+ CONST84 char **argv, double *dblPtr,
+ int *intPtr);
+#endif
+#ifndef Tk_GetScreenMM_TCL_DECLARED
+#define Tk_GetScreenMM_TCL_DECLARED
/* 109 */
-EXTERN int Tk_GetScreenMM _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * str,
- double * doublePtr));
+EXTERN int Tk_GetScreenMM(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *str, double *doublePtr);
+#endif
+#ifndef Tk_GetSelection_TCL_DECLARED
+#define Tk_GetSelection_TCL_DECLARED
/* 110 */
-EXTERN int Tk_GetSelection _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Atom selection, Atom target,
- Tk_GetSelProc * proc, ClientData clientData));
+EXTERN int Tk_GetSelection(Tcl_Interp *interp, Tk_Window tkwin,
+ Atom selection, Atom target,
+ Tk_GetSelProc *proc, ClientData clientData);
+#endif
+#ifndef Tk_GetUid_TCL_DECLARED
+#define Tk_GetUid_TCL_DECLARED
/* 111 */
-EXTERN Tk_Uid Tk_GetUid _ANSI_ARGS_((CONST char * str));
+EXTERN Tk_Uid Tk_GetUid(CONST char *str);
+#endif
+#ifndef Tk_GetVisual_TCL_DECLARED
+#define Tk_GetVisual_TCL_DECLARED
/* 112 */
-EXTERN Visual * Tk_GetVisual _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * str,
- int * depthPtr, Colormap * colormapPtr));
+EXTERN Visual * Tk_GetVisual(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *str, int *depthPtr,
+ Colormap *colormapPtr);
+#endif
+#ifndef Tk_GetVRootGeometry_TCL_DECLARED
+#define Tk_GetVRootGeometry_TCL_DECLARED
/* 113 */
-EXTERN void Tk_GetVRootGeometry _ANSI_ARGS_((Tk_Window tkwin,
- int * xPtr, int * yPtr, int * widthPtr,
- int * heightPtr));
+EXTERN void Tk_GetVRootGeometry(Tk_Window tkwin, int *xPtr,
+ int *yPtr, int *widthPtr, int *heightPtr);
+#endif
+#ifndef Tk_Grab_TCL_DECLARED
+#define Tk_Grab_TCL_DECLARED
/* 114 */
-EXTERN int Tk_Grab _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, int grabGlobal));
+EXTERN int Tk_Grab(Tcl_Interp *interp, Tk_Window tkwin,
+ int grabGlobal);
+#endif
+#ifndef Tk_HandleEvent_TCL_DECLARED
+#define Tk_HandleEvent_TCL_DECLARED
/* 115 */
-EXTERN void Tk_HandleEvent _ANSI_ARGS_((XEvent * eventPtr));
+EXTERN void Tk_HandleEvent(XEvent *eventPtr);
+#endif
+#ifndef Tk_IdToWindow_TCL_DECLARED
+#define Tk_IdToWindow_TCL_DECLARED
/* 116 */
-EXTERN Tk_Window Tk_IdToWindow _ANSI_ARGS_((Display * display,
- Window window));
+EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window);
+#endif
+#ifndef Tk_ImageChanged_TCL_DECLARED
+#define Tk_ImageChanged_TCL_DECLARED
/* 117 */
-EXTERN void Tk_ImageChanged _ANSI_ARGS_((Tk_ImageMaster master,
- int x, int y, int width, int height,
- int imageWidth, int imageHeight));
+EXTERN void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
+ int width, int height, int imageWidth,
+ int imageHeight);
+#endif
+#ifndef Tk_Init_TCL_DECLARED
+#define Tk_Init_TCL_DECLARED
/* 118 */
-EXTERN int Tk_Init _ANSI_ARGS_((Tcl_Interp * interp));
+EXTERN int Tk_Init(Tcl_Interp *interp);
+#endif
+#ifndef Tk_InternAtom_TCL_DECLARED
+#define Tk_InternAtom_TCL_DECLARED
/* 119 */
-EXTERN Atom Tk_InternAtom _ANSI_ARGS_((Tk_Window tkwin,
- CONST char * name));
+EXTERN Atom Tk_InternAtom(Tk_Window tkwin, CONST char *name);
+#endif
+#ifndef Tk_IntersectTextLayout_TCL_DECLARED
+#define Tk_IntersectTextLayout_TCL_DECLARED
/* 120 */
-EXTERN int Tk_IntersectTextLayout _ANSI_ARGS_((
- Tk_TextLayout layout, int x, int y,
- int width, int height));
+EXTERN int Tk_IntersectTextLayout(Tk_TextLayout layout, int x,
+ int y, int width, int height);
+#endif
+#ifndef Tk_MaintainGeometry_TCL_DECLARED
+#define Tk_MaintainGeometry_TCL_DECLARED
/* 121 */
-EXTERN void Tk_MaintainGeometry _ANSI_ARGS_((Tk_Window slave,
- Tk_Window master, int x, int y, int width,
- int height));
+EXTERN void Tk_MaintainGeometry(Tk_Window slave,
+ Tk_Window master, int x, int y, int width,
+ int height);
+#endif
+#ifndef Tk_MainWindow_TCL_DECLARED
+#define Tk_MainWindow_TCL_DECLARED
/* 122 */
-EXTERN Tk_Window Tk_MainWindow _ANSI_ARGS_((Tcl_Interp * interp));
+EXTERN Tk_Window Tk_MainWindow(Tcl_Interp *interp);
+#endif
+#ifndef Tk_MakeWindowExist_TCL_DECLARED
+#define Tk_MakeWindowExist_TCL_DECLARED
/* 123 */
-EXTERN void Tk_MakeWindowExist _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void Tk_MakeWindowExist(Tk_Window tkwin);
+#endif
+#ifndef Tk_ManageGeometry_TCL_DECLARED
+#define Tk_ManageGeometry_TCL_DECLARED
/* 124 */
-EXTERN void Tk_ManageGeometry _ANSI_ARGS_((Tk_Window tkwin,
- Tk_GeomMgr * mgrPtr, ClientData clientData));
+EXTERN void Tk_ManageGeometry(Tk_Window tkwin,
+ CONST Tk_GeomMgr *mgrPtr,
+ ClientData clientData);
+#endif
+#ifndef Tk_MapWindow_TCL_DECLARED
+#define Tk_MapWindow_TCL_DECLARED
/* 125 */
-EXTERN void Tk_MapWindow _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void Tk_MapWindow(Tk_Window tkwin);
+#endif
+#ifndef Tk_MeasureChars_TCL_DECLARED
+#define Tk_MeasureChars_TCL_DECLARED
/* 126 */
-EXTERN int Tk_MeasureChars _ANSI_ARGS_((Tk_Font tkfont,
- CONST char * source, int numBytes,
- int maxPixels, int flags, int * lengthPtr));
+EXTERN int Tk_MeasureChars(Tk_Font tkfont, CONST char *source,
+ int numBytes, int maxPixels, int flags,
+ int *lengthPtr);
+#endif
+#ifndef Tk_MoveResizeWindow_TCL_DECLARED
+#define Tk_MoveResizeWindow_TCL_DECLARED
/* 127 */
-EXTERN void Tk_MoveResizeWindow _ANSI_ARGS_((Tk_Window tkwin,
- int x, int y, int width, int height));
+EXTERN void Tk_MoveResizeWindow(Tk_Window tkwin, int x, int y,
+ int width, int height);
+#endif
+#ifndef Tk_MoveWindow_TCL_DECLARED
+#define Tk_MoveWindow_TCL_DECLARED
/* 128 */
-EXTERN void Tk_MoveWindow _ANSI_ARGS_((Tk_Window tkwin, int x,
- int y));
+EXTERN void Tk_MoveWindow(Tk_Window tkwin, int x, int y);
+#endif
+#ifndef Tk_MoveToplevelWindow_TCL_DECLARED
+#define Tk_MoveToplevelWindow_TCL_DECLARED
/* 129 */
-EXTERN void Tk_MoveToplevelWindow _ANSI_ARGS_((Tk_Window tkwin,
- int x, int y));
+EXTERN void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y);
+#endif
+#ifndef Tk_NameOf3DBorder_TCL_DECLARED
+#define Tk_NameOf3DBorder_TCL_DECLARED
/* 130 */
-EXTERN CONST84_RETURN char * Tk_NameOf3DBorder _ANSI_ARGS_((
- Tk_3DBorder border));
+EXTERN CONST84_RETURN char * Tk_NameOf3DBorder(Tk_3DBorder border);
+#endif
+#ifndef Tk_NameOfAnchor_TCL_DECLARED
+#define Tk_NameOfAnchor_TCL_DECLARED
/* 131 */
-EXTERN CONST84_RETURN char * Tk_NameOfAnchor _ANSI_ARGS_((Tk_Anchor anchor));
+EXTERN CONST84_RETURN char * Tk_NameOfAnchor(Tk_Anchor anchor);
+#endif
+#ifndef Tk_NameOfBitmap_TCL_DECLARED
+#define Tk_NameOfBitmap_TCL_DECLARED
/* 132 */
-EXTERN CONST84_RETURN char * Tk_NameOfBitmap _ANSI_ARGS_((Display * display,
- Pixmap bitmap));
+EXTERN CONST84_RETURN char * Tk_NameOfBitmap(Display *display, Pixmap bitmap);
+#endif
+#ifndef Tk_NameOfCapStyle_TCL_DECLARED
+#define Tk_NameOfCapStyle_TCL_DECLARED
/* 133 */
-EXTERN CONST84_RETURN char * Tk_NameOfCapStyle _ANSI_ARGS_((int cap));
+EXTERN CONST84_RETURN char * Tk_NameOfCapStyle(int cap);
+#endif
+#ifndef Tk_NameOfColor_TCL_DECLARED
+#define Tk_NameOfColor_TCL_DECLARED
/* 134 */
-EXTERN CONST84_RETURN char * Tk_NameOfColor _ANSI_ARGS_((XColor * colorPtr));
+EXTERN CONST84_RETURN char * Tk_NameOfColor(XColor *colorPtr);
+#endif
+#ifndef Tk_NameOfCursor_TCL_DECLARED
+#define Tk_NameOfCursor_TCL_DECLARED
/* 135 */
-EXTERN CONST84_RETURN char * Tk_NameOfCursor _ANSI_ARGS_((Display * display,
- Tk_Cursor cursor));
+EXTERN CONST84_RETURN char * Tk_NameOfCursor(Display *display,
+ Tk_Cursor cursor);
+#endif
+#ifndef Tk_NameOfFont_TCL_DECLARED
+#define Tk_NameOfFont_TCL_DECLARED
/* 136 */
-EXTERN CONST84_RETURN char * Tk_NameOfFont _ANSI_ARGS_((Tk_Font font));
+EXTERN CONST84_RETURN char * Tk_NameOfFont(Tk_Font font);
+#endif
+#ifndef Tk_NameOfImage_TCL_DECLARED
+#define Tk_NameOfImage_TCL_DECLARED
/* 137 */
-EXTERN CONST84_RETURN char * Tk_NameOfImage _ANSI_ARGS_((
- Tk_ImageMaster imageMaster));
+EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageMaster imageMaster);
+#endif
+#ifndef Tk_NameOfJoinStyle_TCL_DECLARED
+#define Tk_NameOfJoinStyle_TCL_DECLARED
/* 138 */
-EXTERN CONST84_RETURN char * Tk_NameOfJoinStyle _ANSI_ARGS_((int join));
+EXTERN CONST84_RETURN char * Tk_NameOfJoinStyle(int join);
+#endif
+#ifndef Tk_NameOfJustify_TCL_DECLARED
+#define Tk_NameOfJustify_TCL_DECLARED
/* 139 */
-EXTERN CONST84_RETURN char * Tk_NameOfJustify _ANSI_ARGS_((
- Tk_Justify justify));
+EXTERN CONST84_RETURN char * Tk_NameOfJustify(Tk_Justify justify);
+#endif
+#ifndef Tk_NameOfRelief_TCL_DECLARED
+#define Tk_NameOfRelief_TCL_DECLARED
/* 140 */
-EXTERN CONST84_RETURN char * Tk_NameOfRelief _ANSI_ARGS_((int relief));
+EXTERN CONST84_RETURN char * Tk_NameOfRelief(int relief);
+#endif
+#ifndef Tk_NameToWindow_TCL_DECLARED
+#define Tk_NameToWindow_TCL_DECLARED
/* 141 */
-EXTERN Tk_Window Tk_NameToWindow _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * pathName, Tk_Window tkwin));
+EXTERN Tk_Window Tk_NameToWindow(Tcl_Interp *interp,
+ CONST char *pathName, Tk_Window tkwin);
+#endif
+#ifndef Tk_OwnSelection_TCL_DECLARED
+#define Tk_OwnSelection_TCL_DECLARED
/* 142 */
-EXTERN void Tk_OwnSelection _ANSI_ARGS_((Tk_Window tkwin,
- Atom selection, Tk_LostSelProc * proc,
- ClientData clientData));
+EXTERN void Tk_OwnSelection(Tk_Window tkwin, Atom selection,
+ Tk_LostSelProc *proc, ClientData clientData);
+#endif
+#ifndef Tk_ParseArgv_TCL_DECLARED
+#define Tk_ParseArgv_TCL_DECLARED
/* 143 */
-EXTERN int Tk_ParseArgv _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, int * argcPtr,
- CONST84 char ** argv, Tk_ArgvInfo * argTable,
- int flags));
+EXTERN int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin,
+ int *argcPtr, CONST84 char **argv,
+ Tk_ArgvInfo *argTable, int flags);
+#endif
+#ifndef Tk_PhotoPutBlock_NoComposite_TCL_DECLARED
+#define Tk_PhotoPutBlock_NoComposite_TCL_DECLARED
/* 144 */
-EXTERN void Tk_PhotoPutBlock_NoComposite _ANSI_ARGS_((
- Tk_PhotoHandle handle,
- Tk_PhotoImageBlock * blockPtr, int x, int y,
- int width, int height));
+EXTERN void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr, int x, int y,
+ int width, int height);
+#endif
+#ifndef Tk_PhotoPutZoomedBlock_NoComposite_TCL_DECLARED
+#define Tk_PhotoPutZoomedBlock_NoComposite_TCL_DECLARED
/* 145 */
-EXTERN void Tk_PhotoPutZoomedBlock_NoComposite _ANSI_ARGS_((
- Tk_PhotoHandle handle,
- Tk_PhotoImageBlock * blockPtr, int x, int y,
- int width, int height, int zoomX, int zoomY,
- int subsampleX, int subsampleY));
+EXTERN 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);
+#endif
+#ifndef Tk_PhotoGetImage_TCL_DECLARED
+#define Tk_PhotoGetImage_TCL_DECLARED
/* 146 */
-EXTERN int Tk_PhotoGetImage _ANSI_ARGS_((Tk_PhotoHandle handle,
- Tk_PhotoImageBlock * blockPtr));
+EXTERN int Tk_PhotoGetImage(Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr);
+#endif
+#ifndef Tk_PhotoBlank_TCL_DECLARED
+#define Tk_PhotoBlank_TCL_DECLARED
/* 147 */
-EXTERN void Tk_PhotoBlank _ANSI_ARGS_((Tk_PhotoHandle handle));
+EXTERN void Tk_PhotoBlank(Tk_PhotoHandle handle);
+#endif
+#ifndef Tk_PhotoExpand_Panic_TCL_DECLARED
+#define Tk_PhotoExpand_Panic_TCL_DECLARED
/* 148 */
-EXTERN void Tk_PhotoExpand _ANSI_ARGS_((Tk_PhotoHandle handle,
- int width, int height));
+EXTERN void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle,
+ int width, int height);
+#endif
+#ifndef Tk_PhotoGetSize_TCL_DECLARED
+#define Tk_PhotoGetSize_TCL_DECLARED
/* 149 */
-EXTERN void Tk_PhotoGetSize _ANSI_ARGS_((Tk_PhotoHandle handle,
- int * widthPtr, int * heightPtr));
+EXTERN void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr,
+ int *heightPtr);
+#endif
+#ifndef Tk_PhotoSetSize_Panic_TCL_DECLARED
+#define Tk_PhotoSetSize_Panic_TCL_DECLARED
/* 150 */
-EXTERN void Tk_PhotoSetSize _ANSI_ARGS_((Tk_PhotoHandle handle,
- int width, int height));
+EXTERN void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle,
+ int width, int height);
+#endif
+#ifndef Tk_PointToChar_TCL_DECLARED
+#define Tk_PointToChar_TCL_DECLARED
/* 151 */
-EXTERN int Tk_PointToChar _ANSI_ARGS_((Tk_TextLayout layout,
- int x, int y));
+EXTERN int Tk_PointToChar(Tk_TextLayout layout, int x, int y);
+#endif
+#ifndef Tk_PostscriptFontName_TCL_DECLARED
+#define Tk_PostscriptFontName_TCL_DECLARED
/* 152 */
-EXTERN int Tk_PostscriptFontName _ANSI_ARGS_((Tk_Font tkfont,
- Tcl_DString * dsPtr));
+EXTERN int Tk_PostscriptFontName(Tk_Font tkfont,
+ Tcl_DString *dsPtr);
+#endif
+#ifndef Tk_PreserveColormap_TCL_DECLARED
+#define Tk_PreserveColormap_TCL_DECLARED
/* 153 */
-EXTERN void Tk_PreserveColormap _ANSI_ARGS_((Display * display,
- Colormap colormap));
+EXTERN void Tk_PreserveColormap(Display *display,
+ Colormap colormap);
+#endif
+#ifndef Tk_QueueWindowEvent_TCL_DECLARED
+#define Tk_QueueWindowEvent_TCL_DECLARED
/* 154 */
-EXTERN void Tk_QueueWindowEvent _ANSI_ARGS_((XEvent * eventPtr,
- Tcl_QueuePosition position));
+EXTERN void Tk_QueueWindowEvent(XEvent *eventPtr,
+ Tcl_QueuePosition position);
+#endif
+#ifndef Tk_RedrawImage_TCL_DECLARED
+#define Tk_RedrawImage_TCL_DECLARED
/* 155 */
-EXTERN void Tk_RedrawImage _ANSI_ARGS_((Tk_Image image,
- int imageX, int imageY, int width,
- int height, Drawable drawable, int drawableX,
- int drawableY));
+EXTERN void Tk_RedrawImage(Tk_Image image, int imageX,
+ int imageY, int width, int height,
+ Drawable drawable, int drawableX,
+ int drawableY);
+#endif
+#ifndef Tk_ResizeWindow_TCL_DECLARED
+#define Tk_ResizeWindow_TCL_DECLARED
/* 156 */
-EXTERN void Tk_ResizeWindow _ANSI_ARGS_((Tk_Window tkwin,
- int width, int height));
+EXTERN void Tk_ResizeWindow(Tk_Window tkwin, int width,
+ int height);
+#endif
+#ifndef Tk_RestackWindow_TCL_DECLARED
+#define Tk_RestackWindow_TCL_DECLARED
/* 157 */
-EXTERN int Tk_RestackWindow _ANSI_ARGS_((Tk_Window tkwin,
- int aboveBelow, Tk_Window other));
+EXTERN int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow,
+ Tk_Window other);
+#endif
+#ifndef Tk_RestrictEvents_TCL_DECLARED
+#define Tk_RestrictEvents_TCL_DECLARED
/* 158 */
-EXTERN Tk_RestrictProc * Tk_RestrictEvents _ANSI_ARGS_((
- Tk_RestrictProc * proc, ClientData arg,
- ClientData * prevArgPtr));
+EXTERN Tk_RestrictProc * Tk_RestrictEvents(Tk_RestrictProc *proc,
+ ClientData arg, ClientData *prevArgPtr);
+#endif
+#ifndef Tk_SafeInit_TCL_DECLARED
+#define Tk_SafeInit_TCL_DECLARED
/* 159 */
-EXTERN int Tk_SafeInit _ANSI_ARGS_((Tcl_Interp * interp));
+EXTERN int Tk_SafeInit(Tcl_Interp *interp);
+#endif
+#ifndef Tk_SetAppName_TCL_DECLARED
+#define Tk_SetAppName_TCL_DECLARED
/* 160 */
-EXTERN CONST char * Tk_SetAppName _ANSI_ARGS_((Tk_Window tkwin,
- CONST char * name));
+EXTERN CONST char * Tk_SetAppName(Tk_Window tkwin, CONST char *name);
+#endif
+#ifndef Tk_SetBackgroundFromBorder_TCL_DECLARED
+#define Tk_SetBackgroundFromBorder_TCL_DECLARED
/* 161 */
-EXTERN void Tk_SetBackgroundFromBorder _ANSI_ARGS_((
- Tk_Window tkwin, Tk_3DBorder border));
+EXTERN void Tk_SetBackgroundFromBorder(Tk_Window tkwin,
+ Tk_3DBorder border);
+#endif
+#ifndef Tk_SetClass_TCL_DECLARED
+#define Tk_SetClass_TCL_DECLARED
/* 162 */
-EXTERN void Tk_SetClass _ANSI_ARGS_((Tk_Window tkwin,
- CONST char * className));
+EXTERN void Tk_SetClass(Tk_Window tkwin, CONST char *className);
+#endif
+#ifndef Tk_SetGrid_TCL_DECLARED
+#define Tk_SetGrid_TCL_DECLARED
/* 163 */
-EXTERN void Tk_SetGrid _ANSI_ARGS_((Tk_Window tkwin,
- int reqWidth, int reqHeight, int gridWidth,
- int gridHeight));
+EXTERN void Tk_SetGrid(Tk_Window tkwin, int reqWidth,
+ int reqHeight, int gridWidth, int gridHeight);
+#endif
+#ifndef Tk_SetInternalBorder_TCL_DECLARED
+#define Tk_SetInternalBorder_TCL_DECLARED
/* 164 */
-EXTERN void Tk_SetInternalBorder _ANSI_ARGS_((Tk_Window tkwin,
- int width));
+EXTERN void Tk_SetInternalBorder(Tk_Window tkwin, int width);
+#endif
+#ifndef Tk_SetWindowBackground_TCL_DECLARED
+#define Tk_SetWindowBackground_TCL_DECLARED
/* 165 */
-EXTERN void Tk_SetWindowBackground _ANSI_ARGS_((Tk_Window tkwin,
- unsigned long pixel));
+EXTERN void Tk_SetWindowBackground(Tk_Window tkwin,
+ unsigned long pixel);
+#endif
+#ifndef Tk_SetWindowBackgroundPixmap_TCL_DECLARED
+#define Tk_SetWindowBackgroundPixmap_TCL_DECLARED
/* 166 */
-EXTERN void Tk_SetWindowBackgroundPixmap _ANSI_ARGS_((
- Tk_Window tkwin, Pixmap pixmap));
+EXTERN void Tk_SetWindowBackgroundPixmap(Tk_Window tkwin,
+ Pixmap pixmap);
+#endif
+#ifndef Tk_SetWindowBorder_TCL_DECLARED
+#define Tk_SetWindowBorder_TCL_DECLARED
/* 167 */
-EXTERN void Tk_SetWindowBorder _ANSI_ARGS_((Tk_Window tkwin,
- unsigned long pixel));
+EXTERN void Tk_SetWindowBorder(Tk_Window tkwin,
+ unsigned long pixel);
+#endif
+#ifndef Tk_SetWindowBorderWidth_TCL_DECLARED
+#define Tk_SetWindowBorderWidth_TCL_DECLARED
/* 168 */
-EXTERN void Tk_SetWindowBorderWidth _ANSI_ARGS_((Tk_Window tkwin,
- int width));
+EXTERN void Tk_SetWindowBorderWidth(Tk_Window tkwin, int width);
+#endif
+#ifndef Tk_SetWindowBorderPixmap_TCL_DECLARED
+#define Tk_SetWindowBorderPixmap_TCL_DECLARED
/* 169 */
-EXTERN void Tk_SetWindowBorderPixmap _ANSI_ARGS_((
- Tk_Window tkwin, Pixmap pixmap));
+EXTERN void Tk_SetWindowBorderPixmap(Tk_Window tkwin,
+ Pixmap pixmap);
+#endif
+#ifndef Tk_SetWindowColormap_TCL_DECLARED
+#define Tk_SetWindowColormap_TCL_DECLARED
/* 170 */
-EXTERN void Tk_SetWindowColormap _ANSI_ARGS_((Tk_Window tkwin,
- Colormap colormap));
+EXTERN void Tk_SetWindowColormap(Tk_Window tkwin,
+ Colormap colormap);
+#endif
+#ifndef Tk_SetWindowVisual_TCL_DECLARED
+#define Tk_SetWindowVisual_TCL_DECLARED
/* 171 */
-EXTERN int Tk_SetWindowVisual _ANSI_ARGS_((Tk_Window tkwin,
- Visual * visual, int depth,
- Colormap colormap));
+EXTERN int Tk_SetWindowVisual(Tk_Window tkwin, Visual *visual,
+ int depth, Colormap colormap);
+#endif
+#ifndef Tk_SizeOfBitmap_TCL_DECLARED
+#define Tk_SizeOfBitmap_TCL_DECLARED
/* 172 */
-EXTERN void Tk_SizeOfBitmap _ANSI_ARGS_((Display * display,
- Pixmap bitmap, int * widthPtr,
- int * heightPtr));
+EXTERN void Tk_SizeOfBitmap(Display *display, Pixmap bitmap,
+ int *widthPtr, int *heightPtr);
+#endif
+#ifndef Tk_SizeOfImage_TCL_DECLARED
+#define Tk_SizeOfImage_TCL_DECLARED
/* 173 */
-EXTERN void Tk_SizeOfImage _ANSI_ARGS_((Tk_Image image,
- int * widthPtr, int * heightPtr));
+EXTERN void Tk_SizeOfImage(Tk_Image image, int *widthPtr,
+ int *heightPtr);
+#endif
+#ifndef Tk_StrictMotif_TCL_DECLARED
+#define Tk_StrictMotif_TCL_DECLARED
/* 174 */
-EXTERN int Tk_StrictMotif _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN int Tk_StrictMotif(Tk_Window tkwin);
+#endif
+#ifndef Tk_TextLayoutToPostscript_TCL_DECLARED
+#define Tk_TextLayoutToPostscript_TCL_DECLARED
/* 175 */
-EXTERN void Tk_TextLayoutToPostscript _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_TextLayout layout));
+EXTERN void Tk_TextLayoutToPostscript(Tcl_Interp *interp,
+ Tk_TextLayout layout);
+#endif
+#ifndef Tk_TextWidth_TCL_DECLARED
+#define Tk_TextWidth_TCL_DECLARED
/* 176 */
-EXTERN int Tk_TextWidth _ANSI_ARGS_((Tk_Font font,
- CONST char * str, int numBytes));
+EXTERN int Tk_TextWidth(Tk_Font font, CONST char *str,
+ int numBytes);
+#endif
+#ifndef Tk_UndefineCursor_TCL_DECLARED
+#define Tk_UndefineCursor_TCL_DECLARED
/* 177 */
-EXTERN void Tk_UndefineCursor _ANSI_ARGS_((Tk_Window window));
+EXTERN void Tk_UndefineCursor(Tk_Window window);
+#endif
+#ifndef Tk_UnderlineChars_TCL_DECLARED
+#define Tk_UnderlineChars_TCL_DECLARED
/* 178 */
-EXTERN void Tk_UnderlineChars _ANSI_ARGS_((Display * display,
- Drawable drawable, GC gc, Tk_Font tkfont,
- CONST char * source, int x, int y,
- int firstByte, int lastByte));
+EXTERN void Tk_UnderlineChars(Display *display,
+ Drawable drawable, GC gc, Tk_Font tkfont,
+ CONST char *source, int x, int y,
+ int firstByte, int lastByte);
+#endif
+#ifndef Tk_UnderlineTextLayout_TCL_DECLARED
+#define Tk_UnderlineTextLayout_TCL_DECLARED
/* 179 */
-EXTERN void Tk_UnderlineTextLayout _ANSI_ARGS_((
- Display * display, Drawable drawable, GC gc,
- Tk_TextLayout layout, int x, int y,
- int underline));
+EXTERN void Tk_UnderlineTextLayout(Display *display,
+ Drawable drawable, GC gc,
+ Tk_TextLayout layout, int x, int y,
+ int underline);
+#endif
+#ifndef Tk_Ungrab_TCL_DECLARED
+#define Tk_Ungrab_TCL_DECLARED
/* 180 */
-EXTERN void Tk_Ungrab _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void Tk_Ungrab(Tk_Window tkwin);
+#endif
+#ifndef Tk_UnmaintainGeometry_TCL_DECLARED
+#define Tk_UnmaintainGeometry_TCL_DECLARED
/* 181 */
-EXTERN void Tk_UnmaintainGeometry _ANSI_ARGS_((Tk_Window slave,
- Tk_Window master));
+EXTERN void Tk_UnmaintainGeometry(Tk_Window slave,
+ Tk_Window master);
+#endif
+#ifndef Tk_UnmapWindow_TCL_DECLARED
+#define Tk_UnmapWindow_TCL_DECLARED
/* 182 */
-EXTERN void Tk_UnmapWindow _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void Tk_UnmapWindow(Tk_Window tkwin);
+#endif
+#ifndef Tk_UnsetGrid_TCL_DECLARED
+#define Tk_UnsetGrid_TCL_DECLARED
/* 183 */
-EXTERN void Tk_UnsetGrid _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void Tk_UnsetGrid(Tk_Window tkwin);
+#endif
+#ifndef Tk_UpdatePointer_TCL_DECLARED
+#define Tk_UpdatePointer_TCL_DECLARED
/* 184 */
-EXTERN void Tk_UpdatePointer _ANSI_ARGS_((Tk_Window tkwin, int x,
- int y, int state));
+EXTERN void Tk_UpdatePointer(Tk_Window tkwin, int x, int y,
+ int state);
+#endif
+#ifndef Tk_AllocBitmapFromObj_TCL_DECLARED
+#define Tk_AllocBitmapFromObj_TCL_DECLARED
/* 185 */
-EXTERN Pixmap Tk_AllocBitmapFromObj _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN Pixmap Tk_AllocBitmapFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_Alloc3DBorderFromObj_TCL_DECLARED
+#define Tk_Alloc3DBorderFromObj_TCL_DECLARED
/* 186 */
-EXTERN Tk_3DBorder Tk_Alloc3DBorderFromObj _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN Tk_3DBorder Tk_Alloc3DBorderFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_AllocColorFromObj_TCL_DECLARED
+#define Tk_AllocColorFromObj_TCL_DECLARED
/* 187 */
-EXTERN XColor * Tk_AllocColorFromObj _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN XColor * Tk_AllocColorFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_AllocCursorFromObj_TCL_DECLARED
+#define Tk_AllocCursorFromObj_TCL_DECLARED
/* 188 */
-EXTERN Tk_Cursor Tk_AllocCursorFromObj _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN Tk_Cursor Tk_AllocCursorFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_AllocFontFromObj_TCL_DECLARED
+#define Tk_AllocFontFromObj_TCL_DECLARED
/* 189 */
-EXTERN Tk_Font Tk_AllocFontFromObj _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tcl_Obj * objPtr));
+EXTERN Tk_Font Tk_AllocFontFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_CreateOptionTable_TCL_DECLARED
+#define Tk_CreateOptionTable_TCL_DECLARED
/* 190 */
-EXTERN Tk_OptionTable Tk_CreateOptionTable _ANSI_ARGS_((
- Tcl_Interp * interp,
- CONST Tk_OptionSpec * templatePtr));
+EXTERN Tk_OptionTable Tk_CreateOptionTable(Tcl_Interp *interp,
+ CONST Tk_OptionSpec *templatePtr);
+#endif
+#ifndef Tk_DeleteOptionTable_TCL_DECLARED
+#define Tk_DeleteOptionTable_TCL_DECLARED
/* 191 */
-EXTERN void Tk_DeleteOptionTable _ANSI_ARGS_((
- Tk_OptionTable optionTable));
+EXTERN void Tk_DeleteOptionTable(Tk_OptionTable optionTable);
+#endif
+#ifndef Tk_Free3DBorderFromObj_TCL_DECLARED
+#define Tk_Free3DBorderFromObj_TCL_DECLARED
/* 192 */
-EXTERN void Tk_Free3DBorderFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN void Tk_Free3DBorderFromObj(Tk_Window tkwin,
+ Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_FreeBitmapFromObj_TCL_DECLARED
+#define Tk_FreeBitmapFromObj_TCL_DECLARED
/* 193 */
-EXTERN void Tk_FreeBitmapFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN void Tk_FreeBitmapFromObj(Tk_Window tkwin,
+ Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_FreeColorFromObj_TCL_DECLARED
+#define Tk_FreeColorFromObj_TCL_DECLARED
/* 194 */
-EXTERN void Tk_FreeColorFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_FreeConfigOptions_TCL_DECLARED
+#define Tk_FreeConfigOptions_TCL_DECLARED
/* 195 */
-EXTERN void Tk_FreeConfigOptions _ANSI_ARGS_((char * recordPtr,
- Tk_OptionTable optionToken, Tk_Window tkwin));
+EXTERN void Tk_FreeConfigOptions(char *recordPtr,
+ Tk_OptionTable optionToken, Tk_Window tkwin);
+#endif
+#ifndef Tk_FreeSavedOptions_TCL_DECLARED
+#define Tk_FreeSavedOptions_TCL_DECLARED
/* 196 */
-EXTERN void Tk_FreeSavedOptions _ANSI_ARGS_((
- Tk_SavedOptions * savePtr));
+EXTERN void Tk_FreeSavedOptions(Tk_SavedOptions *savePtr);
+#endif
+#ifndef Tk_FreeCursorFromObj_TCL_DECLARED
+#define Tk_FreeCursorFromObj_TCL_DECLARED
/* 197 */
-EXTERN void Tk_FreeCursorFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN void Tk_FreeCursorFromObj(Tk_Window tkwin,
+ Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_FreeFontFromObj_TCL_DECLARED
+#define Tk_FreeFontFromObj_TCL_DECLARED
/* 198 */
-EXTERN void Tk_FreeFontFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN void Tk_FreeFontFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_Get3DBorderFromObj_TCL_DECLARED
+#define Tk_Get3DBorderFromObj_TCL_DECLARED
/* 199 */
-EXTERN Tk_3DBorder Tk_Get3DBorderFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN Tk_3DBorder Tk_Get3DBorderFromObj(Tk_Window tkwin,
+ Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_GetAnchorFromObj_TCL_DECLARED
+#define Tk_GetAnchorFromObj_TCL_DECLARED
/* 200 */
-EXTERN int Tk_GetAnchorFromObj _ANSI_ARGS_((Tcl_Interp * interp,
- Tcl_Obj * objPtr, Tk_Anchor * anchorPtr));
+EXTERN int Tk_GetAnchorFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Tk_Anchor *anchorPtr);
+#endif
+#ifndef Tk_GetBitmapFromObj_TCL_DECLARED
+#define Tk_GetBitmapFromObj_TCL_DECLARED
/* 201 */
-EXTERN Pixmap Tk_GetBitmapFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN Pixmap Tk_GetBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_GetColorFromObj_TCL_DECLARED
+#define Tk_GetColorFromObj_TCL_DECLARED
/* 202 */
-EXTERN XColor * Tk_GetColorFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN XColor * Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_GetCursorFromObj_TCL_DECLARED
+#define Tk_GetCursorFromObj_TCL_DECLARED
/* 203 */
-EXTERN Tk_Cursor Tk_GetCursorFromObj _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Obj * objPtr));
+EXTERN Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_GetOptionInfo_TCL_DECLARED
+#define Tk_GetOptionInfo_TCL_DECLARED
/* 204 */
-EXTERN Tcl_Obj * Tk_GetOptionInfo _ANSI_ARGS_((Tcl_Interp * interp,
- char * recordPtr, Tk_OptionTable optionTable,
- Tcl_Obj * namePtr, Tk_Window tkwin));
+EXTERN Tcl_Obj * Tk_GetOptionInfo(Tcl_Interp *interp, char *recordPtr,
+ Tk_OptionTable optionTable, Tcl_Obj *namePtr,
+ Tk_Window tkwin);
+#endif
+#ifndef Tk_GetOptionValue_TCL_DECLARED
+#define Tk_GetOptionValue_TCL_DECLARED
/* 205 */
-EXTERN Tcl_Obj * Tk_GetOptionValue _ANSI_ARGS_((Tcl_Interp * interp,
- char * recordPtr, Tk_OptionTable optionTable,
- Tcl_Obj * namePtr, Tk_Window tkwin));
+EXTERN Tcl_Obj * Tk_GetOptionValue(Tcl_Interp *interp,
+ char *recordPtr, Tk_OptionTable optionTable,
+ Tcl_Obj *namePtr, Tk_Window tkwin);
+#endif
+#ifndef Tk_GetJustifyFromObj_TCL_DECLARED
+#define Tk_GetJustifyFromObj_TCL_DECLARED
/* 206 */
-EXTERN int Tk_GetJustifyFromObj _ANSI_ARGS_((
- Tcl_Interp * interp, Tcl_Obj * objPtr,
- Tk_Justify * justifyPtr));
+EXTERN int Tk_GetJustifyFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Tk_Justify *justifyPtr);
+#endif
+#ifndef Tk_GetMMFromObj_TCL_DECLARED
+#define Tk_GetMMFromObj_TCL_DECLARED
/* 207 */
-EXTERN int Tk_GetMMFromObj _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tcl_Obj * objPtr,
- double * doublePtr));
+EXTERN int Tk_GetMMFromObj(Tcl_Interp *interp, Tk_Window tkwin,
+ Tcl_Obj *objPtr, double *doublePtr);
+#endif
+#ifndef Tk_GetPixelsFromObj_TCL_DECLARED
+#define Tk_GetPixelsFromObj_TCL_DECLARED
/* 208 */
-EXTERN int Tk_GetPixelsFromObj _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tcl_Obj * objPtr,
- int * intPtr));
+EXTERN int Tk_GetPixelsFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr,
+ int *intPtr);
+#endif
+#ifndef Tk_GetReliefFromObj_TCL_DECLARED
+#define Tk_GetReliefFromObj_TCL_DECLARED
/* 209 */
-EXTERN int Tk_GetReliefFromObj _ANSI_ARGS_((Tcl_Interp * interp,
- Tcl_Obj * objPtr, int * resultPtr));
+EXTERN int Tk_GetReliefFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, int *resultPtr);
+#endif
+#ifndef Tk_GetScrollInfoObj_TCL_DECLARED
+#define Tk_GetScrollInfoObj_TCL_DECLARED
/* 210 */
-EXTERN int Tk_GetScrollInfoObj _ANSI_ARGS_((Tcl_Interp * interp,
- int objc, Tcl_Obj *CONST objv[],
- double * dblPtr, int * intPtr));
+EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[], double *dblPtr,
+ int *intPtr);
+#endif
+#ifndef Tk_InitOptions_TCL_DECLARED
+#define Tk_InitOptions_TCL_DECLARED
/* 211 */
-EXTERN int Tk_InitOptions _ANSI_ARGS_((Tcl_Interp * interp,
- char * recordPtr, Tk_OptionTable optionToken,
- Tk_Window tkwin));
+EXTERN int Tk_InitOptions(Tcl_Interp *interp, char *recordPtr,
+ Tk_OptionTable optionToken, Tk_Window tkwin);
+#endif
+#ifndef Tk_MainEx_TCL_DECLARED
+#define Tk_MainEx_TCL_DECLARED
/* 212 */
-EXTERN void Tk_MainEx _ANSI_ARGS_((int argc, char ** argv,
- Tcl_AppInitProc * appInitProc,
- Tcl_Interp * interp));
+EXTERN void Tk_MainEx(int argc, char **argv,
+ Tcl_AppInitProc *appInitProc,
+ Tcl_Interp *interp);
+#endif
+#ifndef Tk_RestoreSavedOptions_TCL_DECLARED
+#define Tk_RestoreSavedOptions_TCL_DECLARED
/* 213 */
-EXTERN void Tk_RestoreSavedOptions _ANSI_ARGS_((
- Tk_SavedOptions * savePtr));
+EXTERN void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr);
+#endif
+#ifndef Tk_SetOptions_TCL_DECLARED
+#define Tk_SetOptions_TCL_DECLARED
/* 214 */
-EXTERN int Tk_SetOptions _ANSI_ARGS_((Tcl_Interp * interp,
- char * recordPtr, Tk_OptionTable optionTable,
- int objc, Tcl_Obj *CONST objv[],
- Tk_Window tkwin, Tk_SavedOptions * savePtr,
- int * maskPtr));
+EXTERN 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);
+#endif
+#ifndef Tk_InitConsoleChannels_TCL_DECLARED
+#define Tk_InitConsoleChannels_TCL_DECLARED
/* 215 */
-EXTERN void Tk_InitConsoleChannels _ANSI_ARGS_((
- Tcl_Interp * interp));
+EXTERN void Tk_InitConsoleChannels(Tcl_Interp *interp);
+#endif
+#ifndef Tk_CreateConsoleWindow_TCL_DECLARED
+#define Tk_CreateConsoleWindow_TCL_DECLARED
/* 216 */
-EXTERN int Tk_CreateConsoleWindow _ANSI_ARGS_((
- Tcl_Interp * interp));
+EXTERN int Tk_CreateConsoleWindow(Tcl_Interp *interp);
+#endif
+#ifndef Tk_CreateSmoothMethod_TCL_DECLARED
+#define Tk_CreateSmoothMethod_TCL_DECLARED
/* 217 */
-EXTERN void Tk_CreateSmoothMethod _ANSI_ARGS_((
- Tcl_Interp * interp,
- Tk_SmoothMethod * method));
+EXTERN void Tk_CreateSmoothMethod(Tcl_Interp *interp,
+ Tk_SmoothMethod *method);
+#endif
/* Slot 218 is reserved */
/* Slot 219 is reserved */
+#ifndef Tk_GetDash_TCL_DECLARED
+#define Tk_GetDash_TCL_DECLARED
/* 220 */
-EXTERN int Tk_GetDash _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * value, Tk_Dash * dash));
+EXTERN int Tk_GetDash(Tcl_Interp *interp, CONST char *value,
+ Tk_Dash *dash);
+#endif
+#ifndef Tk_CreateOutline_TCL_DECLARED
+#define Tk_CreateOutline_TCL_DECLARED
/* 221 */
-EXTERN void Tk_CreateOutline _ANSI_ARGS_((Tk_Outline * outline));
+EXTERN void Tk_CreateOutline(Tk_Outline *outline);
+#endif
+#ifndef Tk_DeleteOutline_TCL_DECLARED
+#define Tk_DeleteOutline_TCL_DECLARED
/* 222 */
-EXTERN void Tk_DeleteOutline _ANSI_ARGS_((Display * display,
- Tk_Outline * outline));
+EXTERN void Tk_DeleteOutline(Display *display,
+ Tk_Outline *outline);
+#endif
+#ifndef Tk_ConfigOutlineGC_TCL_DECLARED
+#define Tk_ConfigOutlineGC_TCL_DECLARED
/* 223 */
-EXTERN int Tk_ConfigOutlineGC _ANSI_ARGS_((XGCValues * gcValues,
- Tk_Canvas canvas, Tk_Item * item,
- Tk_Outline * outline));
+EXTERN int Tk_ConfigOutlineGC(XGCValues *gcValues,
+ Tk_Canvas canvas, Tk_Item *item,
+ Tk_Outline *outline);
+#endif
+#ifndef Tk_ChangeOutlineGC_TCL_DECLARED
+#define Tk_ChangeOutlineGC_TCL_DECLARED
/* 224 */
-EXTERN int Tk_ChangeOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item * item, Tk_Outline * outline));
+EXTERN int Tk_ChangeOutlineGC(Tk_Canvas canvas, Tk_Item *item,
+ Tk_Outline *outline);
+#endif
+#ifndef Tk_ResetOutlineGC_TCL_DECLARED
+#define Tk_ResetOutlineGC_TCL_DECLARED
/* 225 */
-EXTERN int Tk_ResetOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item * item, Tk_Outline * outline));
+EXTERN int Tk_ResetOutlineGC(Tk_Canvas canvas, Tk_Item *item,
+ Tk_Outline *outline);
+#endif
+#ifndef Tk_CanvasPsOutline_TCL_DECLARED
+#define Tk_CanvasPsOutline_TCL_DECLARED
/* 226 */
-EXTERN int Tk_CanvasPsOutline _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item * item, Tk_Outline * outline));
+EXTERN int Tk_CanvasPsOutline(Tk_Canvas canvas, Tk_Item *item,
+ Tk_Outline *outline);
+#endif
+#ifndef Tk_SetTSOrigin_TCL_DECLARED
+#define Tk_SetTSOrigin_TCL_DECLARED
/* 227 */
-EXTERN void Tk_SetTSOrigin _ANSI_ARGS_((Tk_Window tkwin, GC gc,
- int x, int y));
+EXTERN void Tk_SetTSOrigin(Tk_Window tkwin, GC gc, int x, int y);
+#endif
+#ifndef Tk_CanvasGetCoordFromObj_TCL_DECLARED
+#define Tk_CanvasGetCoordFromObj_TCL_DECLARED
/* 228 */
-EXTERN int Tk_CanvasGetCoordFromObj _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Canvas canvas,
- Tcl_Obj * obj, double * doublePtr));
+EXTERN int Tk_CanvasGetCoordFromObj(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tcl_Obj *obj,
+ double *doublePtr);
+#endif
+#ifndef Tk_CanvasSetOffset_TCL_DECLARED
+#define Tk_CanvasSetOffset_TCL_DECLARED
/* 229 */
-EXTERN void Tk_CanvasSetOffset _ANSI_ARGS_((Tk_Canvas canvas,
- GC gc, Tk_TSOffset * offset));
+EXTERN void Tk_CanvasSetOffset(Tk_Canvas canvas, GC gc,
+ Tk_TSOffset *offset);
+#endif
+#ifndef Tk_DitherPhoto_TCL_DECLARED
+#define Tk_DitherPhoto_TCL_DECLARED
/* 230 */
-EXTERN void Tk_DitherPhoto _ANSI_ARGS_((Tk_PhotoHandle handle,
- int x, int y, int width, int height));
+EXTERN void Tk_DitherPhoto(Tk_PhotoHandle handle, int x, int y,
+ int width, int height);
+#endif
+#ifndef Tk_PostscriptBitmap_TCL_DECLARED
+#define Tk_PostscriptBitmap_TCL_DECLARED
/* 231 */
-EXTERN int Tk_PostscriptBitmap _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_PostscriptInfo psInfo,
- Pixmap bitmap, int startX, int startY,
- int width, int height));
+EXTERN int Tk_PostscriptBitmap(Tcl_Interp *interp,
+ Tk_Window tkwin, Tk_PostscriptInfo psInfo,
+ Pixmap bitmap, int startX, int startY,
+ int width, int height);
+#endif
+#ifndef Tk_PostscriptColor_TCL_DECLARED
+#define Tk_PostscriptColor_TCL_DECLARED
/* 232 */
-EXTERN int Tk_PostscriptColor _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_PostscriptInfo psInfo, XColor * colorPtr));
+EXTERN int Tk_PostscriptColor(Tcl_Interp *interp,
+ Tk_PostscriptInfo psInfo, XColor *colorPtr);
+#endif
+#ifndef Tk_PostscriptFont_TCL_DECLARED
+#define Tk_PostscriptFont_TCL_DECLARED
/* 233 */
-EXTERN int Tk_PostscriptFont _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_PostscriptInfo psInfo, Tk_Font font));
+EXTERN int Tk_PostscriptFont(Tcl_Interp *interp,
+ Tk_PostscriptInfo psInfo, Tk_Font font);
+#endif
+#ifndef Tk_PostscriptImage_TCL_DECLARED
+#define Tk_PostscriptImage_TCL_DECLARED
/* 234 */
-EXTERN int Tk_PostscriptImage _ANSI_ARGS_((Tk_Image image,
- Tcl_Interp * interp, Tk_Window tkwin,
- Tk_PostscriptInfo psinfo, int x, int y,
- int width, int height, int prepass));
+EXTERN int Tk_PostscriptImage(Tk_Image image,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_PostscriptInfo psinfo, int x, int y,
+ int width, int height, int prepass);
+#endif
+#ifndef Tk_PostscriptPath_TCL_DECLARED
+#define Tk_PostscriptPath_TCL_DECLARED
/* 235 */
-EXTERN void Tk_PostscriptPath _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_PostscriptInfo psInfo, double * coordPtr,
- int numPoints));
+EXTERN void Tk_PostscriptPath(Tcl_Interp *interp,
+ Tk_PostscriptInfo psInfo, double *coordPtr,
+ int numPoints);
+#endif
+#ifndef Tk_PostscriptStipple_TCL_DECLARED
+#define Tk_PostscriptStipple_TCL_DECLARED
/* 236 */
-EXTERN int Tk_PostscriptStipple _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window tkwin,
- Tk_PostscriptInfo psInfo, Pixmap bitmap));
+EXTERN int Tk_PostscriptStipple(Tcl_Interp *interp,
+ Tk_Window tkwin, Tk_PostscriptInfo psInfo,
+ Pixmap bitmap);
+#endif
+#ifndef Tk_PostscriptY_TCL_DECLARED
+#define Tk_PostscriptY_TCL_DECLARED
/* 237 */
-EXTERN double Tk_PostscriptY _ANSI_ARGS_((double y,
- Tk_PostscriptInfo psInfo));
+EXTERN double Tk_PostscriptY(double y, Tk_PostscriptInfo psInfo);
+#endif
+#ifndef Tk_PostscriptPhoto_TCL_DECLARED
+#define Tk_PostscriptPhoto_TCL_DECLARED
/* 238 */
-EXTERN int Tk_PostscriptPhoto _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_PhotoImageBlock * blockPtr,
- Tk_PostscriptInfo psInfo, int width,
- int height));
+EXTERN int Tk_PostscriptPhoto(Tcl_Interp *interp,
+ Tk_PhotoImageBlock *blockPtr,
+ Tk_PostscriptInfo psInfo, int width,
+ int height);
+#endif
+#ifndef Tk_CreateClientMessageHandler_TCL_DECLARED
+#define Tk_CreateClientMessageHandler_TCL_DECLARED
/* 239 */
-EXTERN void Tk_CreateClientMessageHandler _ANSI_ARGS_((
- Tk_ClientMessageProc * proc));
+EXTERN void Tk_CreateClientMessageHandler(
+ Tk_ClientMessageProc *proc);
+#endif
+#ifndef Tk_DeleteClientMessageHandler_TCL_DECLARED
+#define Tk_DeleteClientMessageHandler_TCL_DECLARED
/* 240 */
-EXTERN void Tk_DeleteClientMessageHandler _ANSI_ARGS_((
- Tk_ClientMessageProc * proc));
+EXTERN void Tk_DeleteClientMessageHandler(
+ Tk_ClientMessageProc *proc);
+#endif
+#ifndef Tk_CreateAnonymousWindow_TCL_DECLARED
+#define Tk_CreateAnonymousWindow_TCL_DECLARED
/* 241 */
-EXTERN Tk_Window Tk_CreateAnonymousWindow _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Window parent,
- CONST char * screenName));
+EXTERN Tk_Window Tk_CreateAnonymousWindow(Tcl_Interp *interp,
+ Tk_Window parent, CONST char *screenName);
+#endif
+#ifndef Tk_SetClassProcs_TCL_DECLARED
+#define Tk_SetClassProcs_TCL_DECLARED
/* 242 */
-EXTERN void Tk_SetClassProcs _ANSI_ARGS_((Tk_Window tkwin,
- Tk_ClassProcs * procs,
- ClientData instanceData));
+EXTERN void Tk_SetClassProcs(Tk_Window tkwin,
+ Tk_ClassProcs *procs,
+ ClientData instanceData);
+#endif
+#ifndef Tk_SetInternalBorderEx_TCL_DECLARED
+#define Tk_SetInternalBorderEx_TCL_DECLARED
/* 243 */
-EXTERN void Tk_SetInternalBorderEx _ANSI_ARGS_((Tk_Window tkwin,
- int left, int right, int top, int bottom));
+EXTERN void Tk_SetInternalBorderEx(Tk_Window tkwin, int left,
+ int right, int top, int bottom);
+#endif
+#ifndef Tk_SetMinimumRequestSize_TCL_DECLARED
+#define Tk_SetMinimumRequestSize_TCL_DECLARED
/* 244 */
-EXTERN void Tk_SetMinimumRequestSize _ANSI_ARGS_((
- Tk_Window tkwin, int minWidth, int minHeight));
+EXTERN void Tk_SetMinimumRequestSize(Tk_Window tkwin,
+ int minWidth, int minHeight);
+#endif
+#ifndef Tk_SetCaretPos_TCL_DECLARED
+#define Tk_SetCaretPos_TCL_DECLARED
/* 245 */
-EXTERN void Tk_SetCaretPos _ANSI_ARGS_((Tk_Window tkwin, int x,
- int y, int height));
+EXTERN void Tk_SetCaretPos(Tk_Window tkwin, int x, int y,
+ int height);
+#endif
+#ifndef Tk_PhotoPutBlock_Panic_TCL_DECLARED
+#define Tk_PhotoPutBlock_Panic_TCL_DECLARED
/* 246 */
-EXTERN void Tk_PhotoPutBlock _ANSI_ARGS_((Tk_PhotoHandle handle,
- Tk_PhotoImageBlock * blockPtr, int x, int y,
- int width, int height, int compRule));
+EXTERN void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr, int x, int y,
+ int width, int height, int compRule);
+#endif
+#ifndef Tk_PhotoPutZoomedBlock_Panic_TCL_DECLARED
+#define Tk_PhotoPutZoomedBlock_Panic_TCL_DECLARED
/* 247 */
-EXTERN void Tk_PhotoPutZoomedBlock _ANSI_ARGS_((
- Tk_PhotoHandle handle,
- Tk_PhotoImageBlock * blockPtr, int x, int y,
- int width, int height, int zoomX, int zoomY,
- int subsampleX, int subsampleY, int compRule));
+EXTERN 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);
+#endif
+#ifndef Tk_CollapseMotionEvents_TCL_DECLARED
+#define Tk_CollapseMotionEvents_TCL_DECLARED
/* 248 */
-EXTERN int Tk_CollapseMotionEvents _ANSI_ARGS_((
- Display * display, int collapse));
+EXTERN int Tk_CollapseMotionEvents(Display *display,
+ int collapse);
+#endif
+#ifndef Tk_RegisterStyleEngine_TCL_DECLARED
+#define Tk_RegisterStyleEngine_TCL_DECLARED
/* 249 */
-EXTERN Tk_StyleEngine Tk_RegisterStyleEngine _ANSI_ARGS_((
- CONST char * name, Tk_StyleEngine parent));
+EXTERN Tk_StyleEngine Tk_RegisterStyleEngine(CONST char *name,
+ Tk_StyleEngine parent);
+#endif
+#ifndef Tk_GetStyleEngine_TCL_DECLARED
+#define Tk_GetStyleEngine_TCL_DECLARED
/* 250 */
-EXTERN Tk_StyleEngine Tk_GetStyleEngine _ANSI_ARGS_((CONST char * name));
+EXTERN Tk_StyleEngine Tk_GetStyleEngine(CONST char *name);
+#endif
+#ifndef Tk_RegisterStyledElement_TCL_DECLARED
+#define Tk_RegisterStyledElement_TCL_DECLARED
/* 251 */
-EXTERN int Tk_RegisterStyledElement _ANSI_ARGS_((
- Tk_StyleEngine engine,
- Tk_ElementSpec * templatePtr));
+EXTERN int Tk_RegisterStyledElement(Tk_StyleEngine engine,
+ Tk_ElementSpec *templatePtr);
+#endif
+#ifndef Tk_GetElementId_TCL_DECLARED
+#define Tk_GetElementId_TCL_DECLARED
/* 252 */
-EXTERN int Tk_GetElementId _ANSI_ARGS_((CONST char * name));
+EXTERN int Tk_GetElementId(CONST char *name);
+#endif
+#ifndef Tk_CreateStyle_TCL_DECLARED
+#define Tk_CreateStyle_TCL_DECLARED
/* 253 */
-EXTERN Tk_Style Tk_CreateStyle _ANSI_ARGS_((CONST char * name,
- Tk_StyleEngine engine, ClientData clientData));
+EXTERN Tk_Style Tk_CreateStyle(CONST char *name,
+ Tk_StyleEngine engine, ClientData clientData);
+#endif
+#ifndef Tk_GetStyle_TCL_DECLARED
+#define Tk_GetStyle_TCL_DECLARED
/* 254 */
-EXTERN Tk_Style Tk_GetStyle _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * name));
+EXTERN Tk_Style Tk_GetStyle(Tcl_Interp *interp, CONST char *name);
+#endif
+#ifndef Tk_FreeStyle_TCL_DECLARED
+#define Tk_FreeStyle_TCL_DECLARED
/* 255 */
-EXTERN void Tk_FreeStyle _ANSI_ARGS_((Tk_Style style));
+EXTERN void Tk_FreeStyle(Tk_Style style);
+#endif
+#ifndef Tk_NameOfStyle_TCL_DECLARED
+#define Tk_NameOfStyle_TCL_DECLARED
/* 256 */
-EXTERN CONST char * Tk_NameOfStyle _ANSI_ARGS_((Tk_Style style));
+EXTERN CONST char * Tk_NameOfStyle(Tk_Style style);
+#endif
+#ifndef Tk_AllocStyleFromObj_TCL_DECLARED
+#define Tk_AllocStyleFromObj_TCL_DECLARED
/* 257 */
-EXTERN Tk_Style Tk_AllocStyleFromObj _ANSI_ARGS_((
- Tcl_Interp * interp, Tcl_Obj * objPtr));
+EXTERN Tk_Style Tk_AllocStyleFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_GetStyleFromObj_TCL_DECLARED
+#define Tk_GetStyleFromObj_TCL_DECLARED
/* 258 */
-EXTERN Tk_Style Tk_GetStyleFromObj _ANSI_ARGS_((Tcl_Obj * objPtr));
+EXTERN Tk_Style Tk_GetStyleFromObj(Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_FreeStyleFromObj_TCL_DECLARED
+#define Tk_FreeStyleFromObj_TCL_DECLARED
/* 259 */
-EXTERN void Tk_FreeStyleFromObj _ANSI_ARGS_((Tcl_Obj * objPtr));
+EXTERN void Tk_FreeStyleFromObj(Tcl_Obj *objPtr);
+#endif
+#ifndef Tk_GetStyledElement_TCL_DECLARED
+#define Tk_GetStyledElement_TCL_DECLARED
/* 260 */
-EXTERN Tk_StyledElement Tk_GetStyledElement _ANSI_ARGS_((Tk_Style style,
- int elementId, Tk_OptionTable optionTable));
+EXTERN Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId,
+ Tk_OptionTable optionTable);
+#endif
+#ifndef Tk_GetElementSize_TCL_DECLARED
+#define Tk_GetElementSize_TCL_DECLARED
/* 261 */
-EXTERN void Tk_GetElementSize _ANSI_ARGS_((Tk_Style style,
- Tk_StyledElement element, char * recordPtr,
- Tk_Window tkwin, int width, int height,
- int inner, int * widthPtr, int * heightPtr));
+EXTERN void Tk_GetElementSize(Tk_Style style,
+ Tk_StyledElement element, char *recordPtr,
+ Tk_Window tkwin, int width, int height,
+ int inner, int *widthPtr, int *heightPtr);
+#endif
+#ifndef Tk_GetElementBox_TCL_DECLARED
+#define Tk_GetElementBox_TCL_DECLARED
/* 262 */
-EXTERN void Tk_GetElementBox _ANSI_ARGS_((Tk_Style style,
- Tk_StyledElement element, char * recordPtr,
- Tk_Window tkwin, int x, int y, int width,
- int height, int inner, int * xPtr,
- int * yPtr, int * widthPtr, int * heightPtr));
+EXTERN void Tk_GetElementBox(Tk_Style style,
+ Tk_StyledElement element, char *recordPtr,
+ Tk_Window tkwin, int x, int y, int width,
+ int height, int inner, int *xPtr, int *yPtr,
+ int *widthPtr, int *heightPtr);
+#endif
+#ifndef Tk_GetElementBorderWidth_TCL_DECLARED
+#define Tk_GetElementBorderWidth_TCL_DECLARED
/* 263 */
-EXTERN int Tk_GetElementBorderWidth _ANSI_ARGS_((Tk_Style style,
- Tk_StyledElement element, char * recordPtr,
- Tk_Window tkwin));
+EXTERN int Tk_GetElementBorderWidth(Tk_Style style,
+ Tk_StyledElement element, char *recordPtr,
+ Tk_Window tkwin);
+#endif
+#ifndef Tk_DrawElement_TCL_DECLARED
+#define Tk_DrawElement_TCL_DECLARED
/* 264 */
-EXTERN void Tk_DrawElement _ANSI_ARGS_((Tk_Style style,
- Tk_StyledElement element, char * recordPtr,
- Tk_Window tkwin, Drawable d, int x, int y,
- int width, int height, int state));
+EXTERN void Tk_DrawElement(Tk_Style style,
+ Tk_StyledElement element, char *recordPtr,
+ Tk_Window tkwin, Drawable d, int x, int y,
+ int width, int height, int state);
+#endif
+#ifndef Tk_PhotoExpand_TCL_DECLARED
+#define Tk_PhotoExpand_TCL_DECLARED
+/* 265 */
+EXTERN int Tk_PhotoExpand(Tcl_Interp *interp,
+ Tk_PhotoHandle handle, int width, int height);
+#endif
+#ifndef Tk_PhotoPutBlock_TCL_DECLARED
+#define Tk_PhotoPutBlock_TCL_DECLARED
+/* 266 */
+EXTERN int Tk_PhotoPutBlock(Tcl_Interp *interp,
+ Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr, int x, int y,
+ int width, int height, int compRule);
+#endif
+#ifndef Tk_PhotoPutZoomedBlock_TCL_DECLARED
+#define Tk_PhotoPutZoomedBlock_TCL_DECLARED
+/* 267 */
+EXTERN int Tk_PhotoPutZoomedBlock(Tcl_Interp *interp,
+ Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr, int x, int y,
+ int width, int height, int zoomX, int zoomY,
+ int subsampleX, int subsampleY, int compRule);
+#endif
+#ifndef Tk_PhotoSetSize_TCL_DECLARED
+#define Tk_PhotoSetSize_TCL_DECLARED
+/* 268 */
+EXTERN int Tk_PhotoSetSize(Tcl_Interp *interp,
+ Tk_PhotoHandle handle, int width, int height);
+#endif
+#ifndef Tk_GetUserInactiveTime_TCL_DECLARED
+#define Tk_GetUserInactiveTime_TCL_DECLARED
+/* 269 */
+EXTERN long Tk_GetUserInactiveTime(Display *dpy);
+#endif
+#ifndef Tk_ResetUserInactiveTime_TCL_DECLARED
+#define Tk_ResetUserInactiveTime_TCL_DECLARED
+/* 270 */
+EXTERN void Tk_ResetUserInactiveTime(Display *dpy);
+#endif
+#ifndef Tk_Interp_TCL_DECLARED
+#define Tk_Interp_TCL_DECLARED
+/* 271 */
+EXTERN Tcl_Interp * Tk_Interp(Tk_Window tkwin);
+#endif
+#ifndef Tk_CreateOldImageType_TCL_DECLARED
+#define Tk_CreateOldImageType_TCL_DECLARED
+/* 272 */
+EXTERN void Tk_CreateOldImageType(Tk_ImageType *typePtr);
+#endif
+#ifndef Tk_CreateOldPhotoImageFormat_TCL_DECLARED
+#define Tk_CreateOldPhotoImageFormat_TCL_DECLARED
+/* 273 */
+EXTERN void Tk_CreateOldPhotoImageFormat(
+ Tk_PhotoImageFormat *formatPtr);
+#endif
typedef struct TkStubHooks {
struct TkPlatStubs *tkPlatStubs;
@@ -926,271 +1686,280 @@ typedef struct TkStubs {
int magic;
struct TkStubHooks *hooks;
- void (*tk_MainLoop) _ANSI_ARGS_((void)); /* 0 */
- XColor * (*tk_3DBorderColor) _ANSI_ARGS_((Tk_3DBorder border)); /* 1 */
- GC (*tk_3DBorderGC) _ANSI_ARGS_((Tk_Window tkwin, Tk_3DBorder border, int which)); /* 2 */
- void (*tk_3DHorizontalBevel) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftIn, int rightIn, int topBevel, int relief)); /* 3 */
- void (*tk_3DVerticalBevel) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftBevel, int relief)); /* 4 */
- void (*tk_AddOption) _ANSI_ARGS_((Tk_Window tkwin, CONST char * name, CONST char * value, int priority)); /* 5 */
- void (*tk_BindEvent) _ANSI_ARGS_((Tk_BindingTable bindingTable, XEvent * eventPtr, Tk_Window tkwin, int numObjects, ClientData * objectPtr)); /* 6 */
- void (*tk_CanvasDrawableCoords) _ANSI_ARGS_((Tk_Canvas canvas, double x, double y, short * drawableXPtr, short * drawableYPtr)); /* 7 */
- void (*tk_CanvasEventuallyRedraw) _ANSI_ARGS_((Tk_Canvas canvas, int x1, int y1, int x2, int y2)); /* 8 */
- int (*tk_CanvasGetCoord) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, CONST char * str, double * doublePtr)); /* 9 */
- Tk_CanvasTextInfo * (*tk_CanvasGetTextInfo) _ANSI_ARGS_((Tk_Canvas canvas)); /* 10 */
- int (*tk_CanvasPsBitmap) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, Pixmap bitmap, int x, int y, int width, int height)); /* 11 */
- int (*tk_CanvasPsColor) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, XColor * colorPtr)); /* 12 */
- int (*tk_CanvasPsFont) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, Tk_Font font)); /* 13 */
- void (*tk_CanvasPsPath) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, double * coordPtr, int numPoints)); /* 14 */
- int (*tk_CanvasPsStipple) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, Pixmap bitmap)); /* 15 */
- double (*tk_CanvasPsY) _ANSI_ARGS_((Tk_Canvas canvas, double y)); /* 16 */
- void (*tk_CanvasSetStippleOrigin) _ANSI_ARGS_((Tk_Canvas canvas, GC gc)); /* 17 */
- int (*tk_CanvasTagsParseProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp * interp, Tk_Window tkwin, CONST char * value, char * widgRec, int offset)); /* 18 */
- char * (*tk_CanvasTagsPrintProc) _ANSI_ARGS_((ClientData clientData, Tk_Window tkwin, char * widgRec, int offset, Tcl_FreeProc ** freeProcPtr)); /* 19 */
- Tk_Window (*tk_CanvasTkwin) _ANSI_ARGS_((Tk_Canvas canvas)); /* 20 */
- void (*tk_CanvasWindowCoords) _ANSI_ARGS_((Tk_Canvas canvas, double x, double y, short * screenXPtr, short * screenYPtr)); /* 21 */
- void (*tk_ChangeWindowAttributes) _ANSI_ARGS_((Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes * attsPtr)); /* 22 */
- int (*tk_CharBbox) _ANSI_ARGS_((Tk_TextLayout layout, int index, int * xPtr, int * yPtr, int * widthPtr, int * heightPtr)); /* 23 */
- void (*tk_ClearSelection) _ANSI_ARGS_((Tk_Window tkwin, Atom selection)); /* 24 */
- int (*tk_ClipboardAppend) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Atom target, Atom format, char* buffer)); /* 25 */
- int (*tk_ClipboardClear) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin)); /* 26 */
- int (*tk_ConfigureInfo) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, char * widgRec, CONST char * argvName, int flags)); /* 27 */
- int (*tk_ConfigureValue) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, char * widgRec, CONST char * argvName, int flags)); /* 28 */
- int (*tk_ConfigureWidget) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, int argc, CONST84 char ** argv, char * widgRec, int flags)); /* 29 */
- void (*tk_ConfigureWindow) _ANSI_ARGS_((Tk_Window tkwin, unsigned int valueMask, XWindowChanges * valuePtr)); /* 30 */
- Tk_TextLayout (*tk_ComputeTextLayout) _ANSI_ARGS_((Tk_Font font, CONST char * str, int numChars, int wrapLength, Tk_Justify justify, int flags, int * widthPtr, int * heightPtr)); /* 31 */
- Tk_Window (*tk_CoordsToWindow) _ANSI_ARGS_((int rootX, int rootY, Tk_Window tkwin)); /* 32 */
- unsigned long (*tk_CreateBinding) _ANSI_ARGS_((Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventStr, CONST char * command, int append)); /* 33 */
- Tk_BindingTable (*tk_CreateBindingTable) _ANSI_ARGS_((Tcl_Interp * interp)); /* 34 */
- Tk_ErrorHandler (*tk_CreateErrorHandler) _ANSI_ARGS_((Display * display, int errNum, int request, int minorCode, Tk_ErrorProc * errorProc, ClientData clientData)); /* 35 */
- void (*tk_CreateEventHandler) _ANSI_ARGS_((Tk_Window token, unsigned long mask, Tk_EventProc * proc, ClientData clientData)); /* 36 */
- void (*tk_CreateGenericHandler) _ANSI_ARGS_((Tk_GenericProc * proc, ClientData clientData)); /* 37 */
- void (*tk_CreateImageType) _ANSI_ARGS_((Tk_ImageType * typePtr)); /* 38 */
- void (*tk_CreateItemType) _ANSI_ARGS_((Tk_ItemType * typePtr)); /* 39 */
- void (*tk_CreatePhotoImageFormat) _ANSI_ARGS_((Tk_PhotoImageFormat * formatPtr)); /* 40 */
- void (*tk_CreateSelHandler) _ANSI_ARGS_((Tk_Window tkwin, Atom selection, Atom target, Tk_SelectionProc * proc, ClientData clientData, Atom format)); /* 41 */
- Tk_Window (*tk_CreateWindow) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window parent, CONST char * name, CONST char * screenName)); /* 42 */
- Tk_Window (*tk_CreateWindowFromPath) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * pathName, CONST char * screenName)); /* 43 */
- int (*tk_DefineBitmap) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * source, int width, int height)); /* 44 */
- void (*tk_DefineCursor) _ANSI_ARGS_((Tk_Window window, Tk_Cursor cursor)); /* 45 */
- void (*tk_DeleteAllBindings) _ANSI_ARGS_((Tk_BindingTable bindingTable, ClientData object)); /* 46 */
- int (*tk_DeleteBinding) _ANSI_ARGS_((Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventStr)); /* 47 */
- void (*tk_DeleteBindingTable) _ANSI_ARGS_((Tk_BindingTable bindingTable)); /* 48 */
- void (*tk_DeleteErrorHandler) _ANSI_ARGS_((Tk_ErrorHandler handler)); /* 49 */
- void (*tk_DeleteEventHandler) _ANSI_ARGS_((Tk_Window token, unsigned long mask, Tk_EventProc * proc, ClientData clientData)); /* 50 */
- void (*tk_DeleteGenericHandler) _ANSI_ARGS_((Tk_GenericProc * proc, ClientData clientData)); /* 51 */
- void (*tk_DeleteImage) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 52 */
- void (*tk_DeleteSelHandler) _ANSI_ARGS_((Tk_Window tkwin, Atom selection, Atom target)); /* 53 */
- void (*tk_DestroyWindow) _ANSI_ARGS_((Tk_Window tkwin)); /* 54 */
- CONST84_RETURN char * (*tk_DisplayName) _ANSI_ARGS_((Tk_Window tkwin)); /* 55 */
- int (*tk_DistanceToTextLayout) _ANSI_ARGS_((Tk_TextLayout layout, int x, int y)); /* 56 */
- void (*tk_Draw3DPolygon) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint * pointPtr, int numPoints, int borderWidth, int leftRelief)); /* 57 */
- void (*tk_Draw3DRectangle) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief)); /* 58 */
- void (*tk_DrawChars) _ANSI_ARGS_((Display * display, Drawable drawable, GC gc, Tk_Font tkfont, CONST char * source, int numBytes, int x, int y)); /* 59 */
- void (*tk_DrawFocusHighlight) _ANSI_ARGS_((Tk_Window tkwin, GC gc, int width, Drawable drawable)); /* 60 */
- void (*tk_DrawTextLayout) _ANSI_ARGS_((Display * display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int firstChar, int lastChar)); /* 61 */
- void (*tk_Fill3DPolygon) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint * pointPtr, int numPoints, int borderWidth, int leftRelief)); /* 62 */
- void (*tk_Fill3DRectangle) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief)); /* 63 */
- Tk_PhotoHandle (*tk_FindPhoto) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * imageName)); /* 64 */
- Font (*tk_FontId) _ANSI_ARGS_((Tk_Font font)); /* 65 */
- void (*tk_Free3DBorder) _ANSI_ARGS_((Tk_3DBorder border)); /* 66 */
- void (*tk_FreeBitmap) _ANSI_ARGS_((Display * display, Pixmap bitmap)); /* 67 */
- void (*tk_FreeColor) _ANSI_ARGS_((XColor * colorPtr)); /* 68 */
- void (*tk_FreeColormap) _ANSI_ARGS_((Display * display, Colormap colormap)); /* 69 */
- void (*tk_FreeCursor) _ANSI_ARGS_((Display * display, Tk_Cursor cursor)); /* 70 */
- void (*tk_FreeFont) _ANSI_ARGS_((Tk_Font f)); /* 71 */
- void (*tk_FreeGC) _ANSI_ARGS_((Display * display, GC gc)); /* 72 */
- void (*tk_FreeImage) _ANSI_ARGS_((Tk_Image image)); /* 73 */
- void (*tk_FreeOptions) _ANSI_ARGS_((Tk_ConfigSpec * specs, char * widgRec, Display * display, int needFlags)); /* 74 */
- void (*tk_FreePixmap) _ANSI_ARGS_((Display * display, Pixmap pixmap)); /* 75 */
- void (*tk_FreeTextLayout) _ANSI_ARGS_((Tk_TextLayout textLayout)); /* 76 */
- void (*tk_FreeXId) _ANSI_ARGS_((Display * display, XID xid)); /* 77 */
- GC (*tk_GCForColor) _ANSI_ARGS_((XColor * colorPtr, Drawable drawable)); /* 78 */
- void (*tk_GeometryRequest) _ANSI_ARGS_((Tk_Window tkwin, int reqWidth, int reqHeight)); /* 79 */
- Tk_3DBorder (*tk_Get3DBorder) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid colorName)); /* 80 */
- void (*tk_GetAllBindings) _ANSI_ARGS_((Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object)); /* 81 */
- int (*tk_GetAnchor) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, Tk_Anchor * anchorPtr)); /* 82 */
- CONST84_RETURN char * (*tk_GetAtomName) _ANSI_ARGS_((Tk_Window tkwin, Atom atom)); /* 83 */
- CONST84_RETURN char * (*tk_GetBinding) _ANSI_ARGS_((Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventStr)); /* 84 */
- Pixmap (*tk_GetBitmap) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str)); /* 85 */
- Pixmap (*tk_GetBitmapFromData) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * source, int width, int height)); /* 86 */
- int (*tk_GetCapStyle) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int * capPtr)); /* 87 */
- XColor * (*tk_GetColor) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid name)); /* 88 */
- XColor * (*tk_GetColorByValue) _ANSI_ARGS_((Tk_Window tkwin, XColor * colorPtr)); /* 89 */
- Colormap (*tk_GetColormap) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str)); /* 90 */
- Tk_Cursor (*tk_GetCursor) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid str)); /* 91 */
- Tk_Cursor (*tk_GetCursorFromData) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * source, CONST char * mask, int width, int height, int xHot, int yHot, Tk_Uid fg, Tk_Uid bg)); /* 92 */
- Tk_Font (*tk_GetFont) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str)); /* 93 */
- Tk_Font (*tk_GetFontFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 94 */
- void (*tk_GetFontMetrics) _ANSI_ARGS_((Tk_Font font, Tk_FontMetrics * fmPtr)); /* 95 */
- GC (*tk_GetGC) _ANSI_ARGS_((Tk_Window tkwin, unsigned long valueMask, XGCValues * valuePtr)); /* 96 */
- Tk_Image (*tk_GetImage) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * name, Tk_ImageChangedProc * changeProc, ClientData clientData)); /* 97 */
- ClientData (*tk_GetImageMasterData) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tk_ImageType ** typePtrPtr)); /* 98 */
- Tk_ItemType * (*tk_GetItemTypes) _ANSI_ARGS_((void)); /* 99 */
- int (*tk_GetJoinStyle) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int * joinPtr)); /* 100 */
- int (*tk_GetJustify) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, Tk_Justify * justifyPtr)); /* 101 */
- int (*tk_GetNumMainWindows) _ANSI_ARGS_((void)); /* 102 */
- Tk_Uid (*tk_GetOption) _ANSI_ARGS_((Tk_Window tkwin, CONST char * name, CONST char * className)); /* 103 */
- int (*tk_GetPixels) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, int * intPtr)); /* 104 */
- Pixmap (*tk_GetPixmap) _ANSI_ARGS_((Display * display, Drawable d, int width, int height, int depth)); /* 105 */
- int (*tk_GetRelief) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, int * reliefPtr)); /* 106 */
- void (*tk_GetRootCoords) _ANSI_ARGS_((Tk_Window tkwin, int * xPtr, int * yPtr)); /* 107 */
- int (*tk_GetScrollInfo) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST84 char ** argv, double * dblPtr, int * intPtr)); /* 108 */
- int (*tk_GetScreenMM) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, double * doublePtr)); /* 109 */
- int (*tk_GetSelection) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc * proc, ClientData clientData)); /* 110 */
- Tk_Uid (*tk_GetUid) _ANSI_ARGS_((CONST char * str)); /* 111 */
- Visual * (*tk_GetVisual) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, int * depthPtr, Colormap * colormapPtr)); /* 112 */
- void (*tk_GetVRootGeometry) _ANSI_ARGS_((Tk_Window tkwin, int * xPtr, int * yPtr, int * widthPtr, int * heightPtr)); /* 113 */
- int (*tk_Grab) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, int grabGlobal)); /* 114 */
- void (*tk_HandleEvent) _ANSI_ARGS_((XEvent * eventPtr)); /* 115 */
- Tk_Window (*tk_IdToWindow) _ANSI_ARGS_((Display * display, Window window)); /* 116 */
- void (*tk_ImageChanged) _ANSI_ARGS_((Tk_ImageMaster master, int x, int y, int width, int height, int imageWidth, int imageHeight)); /* 117 */
- int (*tk_Init) _ANSI_ARGS_((Tcl_Interp * interp)); /* 118 */
- Atom (*tk_InternAtom) _ANSI_ARGS_((Tk_Window tkwin, CONST char * name)); /* 119 */
- int (*tk_IntersectTextLayout) _ANSI_ARGS_((Tk_TextLayout layout, int x, int y, int width, int height)); /* 120 */
- void (*tk_MaintainGeometry) _ANSI_ARGS_((Tk_Window slave, Tk_Window master, int x, int y, int width, int height)); /* 121 */
- Tk_Window (*tk_MainWindow) _ANSI_ARGS_((Tcl_Interp * interp)); /* 122 */
- void (*tk_MakeWindowExist) _ANSI_ARGS_((Tk_Window tkwin)); /* 123 */
- void (*tk_ManageGeometry) _ANSI_ARGS_((Tk_Window tkwin, Tk_GeomMgr * mgrPtr, ClientData clientData)); /* 124 */
- void (*tk_MapWindow) _ANSI_ARGS_((Tk_Window tkwin)); /* 125 */
- int (*tk_MeasureChars) _ANSI_ARGS_((Tk_Font tkfont, CONST char * source, int numBytes, int maxPixels, int flags, int * lengthPtr)); /* 126 */
- void (*tk_MoveResizeWindow) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height)); /* 127 */
- void (*tk_MoveWindow) _ANSI_ARGS_((Tk_Window tkwin, int x, int y)); /* 128 */
- void (*tk_MoveToplevelWindow) _ANSI_ARGS_((Tk_Window tkwin, int x, int y)); /* 129 */
- CONST84_RETURN char * (*tk_NameOf3DBorder) _ANSI_ARGS_((Tk_3DBorder border)); /* 130 */
- CONST84_RETURN char * (*tk_NameOfAnchor) _ANSI_ARGS_((Tk_Anchor anchor)); /* 131 */
- CONST84_RETURN char * (*tk_NameOfBitmap) _ANSI_ARGS_((Display * display, Pixmap bitmap)); /* 132 */
- CONST84_RETURN char * (*tk_NameOfCapStyle) _ANSI_ARGS_((int cap)); /* 133 */
- CONST84_RETURN char * (*tk_NameOfColor) _ANSI_ARGS_((XColor * colorPtr)); /* 134 */
- CONST84_RETURN char * (*tk_NameOfCursor) _ANSI_ARGS_((Display * display, Tk_Cursor cursor)); /* 135 */
- CONST84_RETURN char * (*tk_NameOfFont) _ANSI_ARGS_((Tk_Font font)); /* 136 */
- CONST84_RETURN char * (*tk_NameOfImage) _ANSI_ARGS_((Tk_ImageMaster imageMaster)); /* 137 */
- CONST84_RETURN char * (*tk_NameOfJoinStyle) _ANSI_ARGS_((int join)); /* 138 */
- CONST84_RETURN char * (*tk_NameOfJustify) _ANSI_ARGS_((Tk_Justify justify)); /* 139 */
- CONST84_RETURN char * (*tk_NameOfRelief) _ANSI_ARGS_((int relief)); /* 140 */
- Tk_Window (*tk_NameToWindow) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pathName, Tk_Window tkwin)); /* 141 */
- void (*tk_OwnSelection) _ANSI_ARGS_((Tk_Window tkwin, Atom selection, Tk_LostSelProc * proc, ClientData clientData)); /* 142 */
- int (*tk_ParseArgv) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, CONST84 char ** argv, Tk_ArgvInfo * argTable, int flags)); /* 143 */
- void (*tk_PhotoPutBlock_NoComposite) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height)); /* 144 */
- void (*tk_PhotoPutZoomedBlock_NoComposite) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY)); /* 145 */
- int (*tk_PhotoGetImage) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr)); /* 146 */
- void (*tk_PhotoBlank) _ANSI_ARGS_((Tk_PhotoHandle handle)); /* 147 */
- void (*tk_PhotoExpand) _ANSI_ARGS_((Tk_PhotoHandle handle, int width, int height)); /* 148 */
- void (*tk_PhotoGetSize) _ANSI_ARGS_((Tk_PhotoHandle handle, int * widthPtr, int * heightPtr)); /* 149 */
- void (*tk_PhotoSetSize) _ANSI_ARGS_((Tk_PhotoHandle handle, int width, int height)); /* 150 */
- int (*tk_PointToChar) _ANSI_ARGS_((Tk_TextLayout layout, int x, int y)); /* 151 */
- int (*tk_PostscriptFontName) _ANSI_ARGS_((Tk_Font tkfont, Tcl_DString * dsPtr)); /* 152 */
- void (*tk_PreserveColormap) _ANSI_ARGS_((Display * display, Colormap colormap)); /* 153 */
- void (*tk_QueueWindowEvent) _ANSI_ARGS_((XEvent * eventPtr, Tcl_QueuePosition position)); /* 154 */
- void (*tk_RedrawImage) _ANSI_ARGS_((Tk_Image image, int imageX, int imageY, int width, int height, Drawable drawable, int drawableX, int drawableY)); /* 155 */
- void (*tk_ResizeWindow) _ANSI_ARGS_((Tk_Window tkwin, int width, int height)); /* 156 */
- int (*tk_RestackWindow) _ANSI_ARGS_((Tk_Window tkwin, int aboveBelow, Tk_Window other)); /* 157 */
- Tk_RestrictProc * (*tk_RestrictEvents) _ANSI_ARGS_((Tk_RestrictProc * proc, ClientData arg, ClientData * prevArgPtr)); /* 158 */
- int (*tk_SafeInit) _ANSI_ARGS_((Tcl_Interp * interp)); /* 159 */
- CONST char * (*tk_SetAppName) _ANSI_ARGS_((Tk_Window tkwin, CONST char * name)); /* 160 */
- void (*tk_SetBackgroundFromBorder) _ANSI_ARGS_((Tk_Window tkwin, Tk_3DBorder border)); /* 161 */
- void (*tk_SetClass) _ANSI_ARGS_((Tk_Window tkwin, CONST char * className)); /* 162 */
- void (*tk_SetGrid) _ANSI_ARGS_((Tk_Window tkwin, int reqWidth, int reqHeight, int gridWidth, int gridHeight)); /* 163 */
- void (*tk_SetInternalBorder) _ANSI_ARGS_((Tk_Window tkwin, int width)); /* 164 */
- void (*tk_SetWindowBackground) _ANSI_ARGS_((Tk_Window tkwin, unsigned long pixel)); /* 165 */
- void (*tk_SetWindowBackgroundPixmap) _ANSI_ARGS_((Tk_Window tkwin, Pixmap pixmap)); /* 166 */
- void (*tk_SetWindowBorder) _ANSI_ARGS_((Tk_Window tkwin, unsigned long pixel)); /* 167 */
- void (*tk_SetWindowBorderWidth) _ANSI_ARGS_((Tk_Window tkwin, int width)); /* 168 */
- void (*tk_SetWindowBorderPixmap) _ANSI_ARGS_((Tk_Window tkwin, Pixmap pixmap)); /* 169 */
- void (*tk_SetWindowColormap) _ANSI_ARGS_((Tk_Window tkwin, Colormap colormap)); /* 170 */
- int (*tk_SetWindowVisual) _ANSI_ARGS_((Tk_Window tkwin, Visual * visual, int depth, Colormap colormap)); /* 171 */
- void (*tk_SizeOfBitmap) _ANSI_ARGS_((Display * display, Pixmap bitmap, int * widthPtr, int * heightPtr)); /* 172 */
- void (*tk_SizeOfImage) _ANSI_ARGS_((Tk_Image image, int * widthPtr, int * heightPtr)); /* 173 */
- int (*tk_StrictMotif) _ANSI_ARGS_((Tk_Window tkwin)); /* 174 */
- void (*tk_TextLayoutToPostscript) _ANSI_ARGS_((Tcl_Interp * interp, Tk_TextLayout layout)); /* 175 */
- int (*tk_TextWidth) _ANSI_ARGS_((Tk_Font font, CONST char * str, int numBytes)); /* 176 */
- void (*tk_UndefineCursor) _ANSI_ARGS_((Tk_Window window)); /* 177 */
- void (*tk_UnderlineChars) _ANSI_ARGS_((Display * display, Drawable drawable, GC gc, Tk_Font tkfont, CONST char * source, int x, int y, int firstByte, int lastByte)); /* 178 */
- void (*tk_UnderlineTextLayout) _ANSI_ARGS_((Display * display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline)); /* 179 */
- void (*tk_Ungrab) _ANSI_ARGS_((Tk_Window tkwin)); /* 180 */
- void (*tk_UnmaintainGeometry) _ANSI_ARGS_((Tk_Window slave, Tk_Window master)); /* 181 */
- void (*tk_UnmapWindow) _ANSI_ARGS_((Tk_Window tkwin)); /* 182 */
- void (*tk_UnsetGrid) _ANSI_ARGS_((Tk_Window tkwin)); /* 183 */
- void (*tk_UpdatePointer) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int state)); /* 184 */
- Pixmap (*tk_AllocBitmapFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr)); /* 185 */
- Tk_3DBorder (*tk_Alloc3DBorderFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr)); /* 186 */
- XColor * (*tk_AllocColorFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr)); /* 187 */
- Tk_Cursor (*tk_AllocCursorFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr)); /* 188 */
- Tk_Font (*tk_AllocFontFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr)); /* 189 */
- Tk_OptionTable (*tk_CreateOptionTable) _ANSI_ARGS_((Tcl_Interp * interp, CONST Tk_OptionSpec * templatePtr)); /* 190 */
- void (*tk_DeleteOptionTable) _ANSI_ARGS_((Tk_OptionTable optionTable)); /* 191 */
- void (*tk_Free3DBorderFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 192 */
- void (*tk_FreeBitmapFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 193 */
- void (*tk_FreeColorFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 194 */
- void (*tk_FreeConfigOptions) _ANSI_ARGS_((char * recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin)); /* 195 */
- void (*tk_FreeSavedOptions) _ANSI_ARGS_((Tk_SavedOptions * savePtr)); /* 196 */
- void (*tk_FreeCursorFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 197 */
- void (*tk_FreeFontFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 198 */
- Tk_3DBorder (*tk_Get3DBorderFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 199 */
- int (*tk_GetAnchorFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, Tk_Anchor * anchorPtr)); /* 200 */
- Pixmap (*tk_GetBitmapFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 201 */
- XColor * (*tk_GetColorFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 202 */
- Tk_Cursor (*tk_GetCursorFromObj) _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj * objPtr)); /* 203 */
- Tcl_Obj * (*tk_GetOptionInfo) _ANSI_ARGS_((Tcl_Interp * interp, char * recordPtr, Tk_OptionTable optionTable, Tcl_Obj * namePtr, Tk_Window tkwin)); /* 204 */
- Tcl_Obj * (*tk_GetOptionValue) _ANSI_ARGS_((Tcl_Interp * interp, char * recordPtr, Tk_OptionTable optionTable, Tcl_Obj * namePtr, Tk_Window tkwin)); /* 205 */
- int (*tk_GetJustifyFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, Tk_Justify * justifyPtr)); /* 206 */
- int (*tk_GetMMFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, double * doublePtr)); /* 207 */
- int (*tk_GetPixelsFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, int * intPtr)); /* 208 */
- int (*tk_GetReliefFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * resultPtr)); /* 209 */
- int (*tk_GetScrollInfoObj) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], double * dblPtr, int * intPtr)); /* 210 */
- int (*tk_InitOptions) _ANSI_ARGS_((Tcl_Interp * interp, char * recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin)); /* 211 */
- void (*tk_MainEx) _ANSI_ARGS_((int argc, char ** argv, Tcl_AppInitProc * appInitProc, Tcl_Interp * interp)); /* 212 */
- void (*tk_RestoreSavedOptions) _ANSI_ARGS_((Tk_SavedOptions * savePtr)); /* 213 */
- int (*tk_SetOptions) _ANSI_ARGS_((Tcl_Interp * interp, char * recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *CONST objv[], Tk_Window tkwin, Tk_SavedOptions * savePtr, int * maskPtr)); /* 214 */
- void (*tk_InitConsoleChannels) _ANSI_ARGS_((Tcl_Interp * interp)); /* 215 */
- int (*tk_CreateConsoleWindow) _ANSI_ARGS_((Tcl_Interp * interp)); /* 216 */
- void (*tk_CreateSmoothMethod) _ANSI_ARGS_((Tcl_Interp * interp, Tk_SmoothMethod * method)); /* 217 */
- void *reserved218;
- void *reserved219;
- int (*tk_GetDash) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * value, Tk_Dash * dash)); /* 220 */
- void (*tk_CreateOutline) _ANSI_ARGS_((Tk_Outline * outline)); /* 221 */
- void (*tk_DeleteOutline) _ANSI_ARGS_((Display * display, Tk_Outline * outline)); /* 222 */
- int (*tk_ConfigOutlineGC) _ANSI_ARGS_((XGCValues * gcValues, Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 223 */
- int (*tk_ChangeOutlineGC) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 224 */
- int (*tk_ResetOutlineGC) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 225 */
- int (*tk_CanvasPsOutline) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 226 */
- void (*tk_SetTSOrigin) _ANSI_ARGS_((Tk_Window tkwin, GC gc, int x, int y)); /* 227 */
- int (*tk_CanvasGetCoordFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, Tcl_Obj * obj, double * doublePtr)); /* 228 */
- void (*tk_CanvasSetOffset) _ANSI_ARGS_((Tk_Canvas canvas, GC gc, Tk_TSOffset * offset)); /* 229 */
- void (*tk_DitherPhoto) _ANSI_ARGS_((Tk_PhotoHandle handle, int x, int y, int width, int height)); /* 230 */
- int (*tk_PostscriptBitmap) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX, int startY, int width, int height)); /* 231 */
- int (*tk_PostscriptColor) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, XColor * colorPtr)); /* 232 */
- int (*tk_PostscriptFont) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, Tk_Font font)); /* 233 */
- int (*tk_PostscriptImage) _ANSI_ARGS_((Tk_Image image, Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass)); /* 234 */
- void (*tk_PostscriptPath) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, double * coordPtr, int numPoints)); /* 235 */
- int (*tk_PostscriptStipple) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap)); /* 236 */
- double (*tk_PostscriptY) _ANSI_ARGS_((double y, Tk_PostscriptInfo psInfo)); /* 237 */
- int (*tk_PostscriptPhoto) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PhotoImageBlock * blockPtr, Tk_PostscriptInfo psInfo, int width, int height)); /* 238 */
- void (*tk_CreateClientMessageHandler) _ANSI_ARGS_((Tk_ClientMessageProc * proc)); /* 239 */
- void (*tk_DeleteClientMessageHandler) _ANSI_ARGS_((Tk_ClientMessageProc * proc)); /* 240 */
- Tk_Window (*tk_CreateAnonymousWindow) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window parent, CONST char * screenName)); /* 241 */
- void (*tk_SetClassProcs) _ANSI_ARGS_((Tk_Window tkwin, Tk_ClassProcs * procs, ClientData instanceData)); /* 242 */
- void (*tk_SetInternalBorderEx) _ANSI_ARGS_((Tk_Window tkwin, int left, int right, int top, int bottom)); /* 243 */
- void (*tk_SetMinimumRequestSize) _ANSI_ARGS_((Tk_Window tkwin, int minWidth, int minHeight)); /* 244 */
- void (*tk_SetCaretPos) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int height)); /* 245 */
- void (*tk_PhotoPutBlock) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int compRule)); /* 246 */
- void (*tk_PhotoPutZoomedBlock) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule)); /* 247 */
- int (*tk_CollapseMotionEvents) _ANSI_ARGS_((Display * display, int collapse)); /* 248 */
- Tk_StyleEngine (*tk_RegisterStyleEngine) _ANSI_ARGS_((CONST char * name, Tk_StyleEngine parent)); /* 249 */
- Tk_StyleEngine (*tk_GetStyleEngine) _ANSI_ARGS_((CONST char * name)); /* 250 */
- int (*tk_RegisterStyledElement) _ANSI_ARGS_((Tk_StyleEngine engine, Tk_ElementSpec * templatePtr)); /* 251 */
- int (*tk_GetElementId) _ANSI_ARGS_((CONST char * name)); /* 252 */
- Tk_Style (*tk_CreateStyle) _ANSI_ARGS_((CONST char * name, Tk_StyleEngine engine, ClientData clientData)); /* 253 */
- Tk_Style (*tk_GetStyle) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 254 */
- void (*tk_FreeStyle) _ANSI_ARGS_((Tk_Style style)); /* 255 */
- CONST char * (*tk_NameOfStyle) _ANSI_ARGS_((Tk_Style style)); /* 256 */
- Tk_Style (*tk_AllocStyleFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 257 */
- Tk_Style (*tk_GetStyleFromObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 258 */
- void (*tk_FreeStyleFromObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 259 */
- Tk_StyledElement (*tk_GetStyledElement) _ANSI_ARGS_((Tk_Style style, int elementId, Tk_OptionTable optionTable)); /* 260 */
- void (*tk_GetElementSize) _ANSI_ARGS_((Tk_Style style, Tk_StyledElement element, char * recordPtr, Tk_Window tkwin, int width, int height, int inner, int * widthPtr, int * heightPtr)); /* 261 */
- void (*tk_GetElementBox) _ANSI_ARGS_((Tk_Style style, Tk_StyledElement element, char * recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int * xPtr, int * yPtr, int * widthPtr, int * heightPtr)); /* 262 */
- int (*tk_GetElementBorderWidth) _ANSI_ARGS_((Tk_Style style, Tk_StyledElement element, char * recordPtr, Tk_Window tkwin)); /* 263 */
- void (*tk_DrawElement) _ANSI_ARGS_((Tk_Style style, Tk_StyledElement element, char * recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state)); /* 264 */
+ void (*tk_MainLoop) (void); /* 0 */
+ XColor * (*tk_3DBorderColor) (Tk_3DBorder border); /* 1 */
+ GC (*tk_3DBorderGC) (Tk_Window tkwin, Tk_3DBorder border, int which); /* 2 */
+ 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 */
+ void (*tk_3DVerticalBevel) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftBevel, int relief); /* 4 */
+ void (*tk_AddOption) (Tk_Window tkwin, CONST char *name, CONST char *value, int priority); /* 5 */
+ void (*tk_BindEvent) (Tk_BindingTable bindingTable, XEvent *eventPtr, Tk_Window tkwin, int numObjects, ClientData *objectPtr); /* 6 */
+ void (*tk_CanvasDrawableCoords) (Tk_Canvas canvas, double x, double y, short *drawableXPtr, short *drawableYPtr); /* 7 */
+ void (*tk_CanvasEventuallyRedraw) (Tk_Canvas canvas, int x1, int y1, int x2, int y2); /* 8 */
+ int (*tk_CanvasGetCoord) (Tcl_Interp *interp, Tk_Canvas canvas, CONST char *str, double *doublePtr); /* 9 */
+ Tk_CanvasTextInfo * (*tk_CanvasGetTextInfo) (Tk_Canvas canvas); /* 10 */
+ int (*tk_CanvasPsBitmap) (Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap, int x, int y, int width, int height); /* 11 */
+ int (*tk_CanvasPsColor) (Tcl_Interp *interp, Tk_Canvas canvas, XColor *colorPtr); /* 12 */
+ int (*tk_CanvasPsFont) (Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font); /* 13 */
+ void (*tk_CanvasPsPath) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, int numPoints); /* 14 */
+ int (*tk_CanvasPsStipple) (Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap); /* 15 */
+ double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */
+ void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */
+ int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 18 */
+ char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 19 */
+ Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */
+ void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 21 */
+ void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 22 */
+ int (*tk_CharBbox) (Tk_TextLayout layout, int index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 23 */
+ void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */
+ int (*tk_ClipboardAppend) (Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, char *buffer); /* 25 */
+ int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */
+ int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specs, char *widgRec, CONST char *argvName, int flags); /* 27 */
+ int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specs, char *widgRec, CONST char *argvName, int flags); /* 28 */
+ int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specs, int argc, CONST84 char **argv, char *widgRec, int flags); /* 29 */
+ void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */
+ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, CONST char *str, int numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */
+ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */
+ unsigned long (*tk_CreateBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, CONST char *eventStr, CONST char *command, int append); /* 33 */
+ Tk_BindingTable (*tk_CreateBindingTable) (Tcl_Interp *interp); /* 34 */
+ Tk_ErrorHandler (*tk_CreateErrorHandler) (Display *display, int errNum, int request, int minorCode, Tk_ErrorProc *errorProc, ClientData clientData); /* 35 */
+ void (*tk_CreateEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, ClientData clientData); /* 36 */
+ void (*tk_CreateGenericHandler) (Tk_GenericProc *proc, ClientData clientData); /* 37 */
+ void (*tk_CreateImageType) (Tk_ImageType *typePtr); /* 38 */
+ void (*tk_CreateItemType) (Tk_ItemType *typePtr); /* 39 */
+ void (*tk_CreatePhotoImageFormat) (Tk_PhotoImageFormat *formatPtr); /* 40 */
+ void (*tk_CreateSelHandler) (Tk_Window tkwin, Atom selection, Atom target, Tk_SelectionProc *proc, ClientData clientData, Atom format); /* 41 */
+ Tk_Window (*tk_CreateWindow) (Tcl_Interp *interp, Tk_Window parent, CONST char *name, CONST char *screenName); /* 42 */
+ Tk_Window (*tk_CreateWindowFromPath) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *pathName, CONST char *screenName); /* 43 */
+ int (*tk_DefineBitmap) (Tcl_Interp *interp, CONST char *name, CONST char *source, int width, int height); /* 44 */
+ void (*tk_DefineCursor) (Tk_Window window, Tk_Cursor cursor); /* 45 */
+ void (*tk_DeleteAllBindings) (Tk_BindingTable bindingTable, ClientData object); /* 46 */
+ int (*tk_DeleteBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, CONST char *eventStr); /* 47 */
+ void (*tk_DeleteBindingTable) (Tk_BindingTable bindingTable); /* 48 */
+ void (*tk_DeleteErrorHandler) (Tk_ErrorHandler handler); /* 49 */
+ void (*tk_DeleteEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, ClientData clientData); /* 50 */
+ void (*tk_DeleteGenericHandler) (Tk_GenericProc *proc, ClientData clientData); /* 51 */
+ void (*tk_DeleteImage) (Tcl_Interp *interp, CONST char *name); /* 52 */
+ void (*tk_DeleteSelHandler) (Tk_Window tkwin, Atom selection, Atom target); /* 53 */
+ void (*tk_DestroyWindow) (Tk_Window tkwin); /* 54 */
+ CONST84_RETURN char * (*tk_DisplayName) (Tk_Window tkwin); /* 55 */
+ int (*tk_DistanceToTextLayout) (Tk_TextLayout layout, int x, int y); /* 56 */
+ void (*tk_Draw3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, int numPoints, int borderWidth, int leftRelief); /* 57 */
+ void (*tk_Draw3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 58 */
+ void (*tk_DrawChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, CONST char *source, int numBytes, int x, int y); /* 59 */
+ void (*tk_DrawFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable); /* 60 */
+ void (*tk_DrawTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int firstChar, int lastChar); /* 61 */
+ void (*tk_Fill3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, int numPoints, int borderWidth, int leftRelief); /* 62 */
+ void (*tk_Fill3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 63 */
+ Tk_PhotoHandle (*tk_FindPhoto) (Tcl_Interp *interp, CONST char *imageName); /* 64 */
+ Font (*tk_FontId) (Tk_Font font); /* 65 */
+ void (*tk_Free3DBorder) (Tk_3DBorder border); /* 66 */
+ void (*tk_FreeBitmap) (Display *display, Pixmap bitmap); /* 67 */
+ void (*tk_FreeColor) (XColor *colorPtr); /* 68 */
+ void (*tk_FreeColormap) (Display *display, Colormap colormap); /* 69 */
+ void (*tk_FreeCursor) (Display *display, Tk_Cursor cursor); /* 70 */
+ void (*tk_FreeFont) (Tk_Font f); /* 71 */
+ void (*tk_FreeGC) (Display *display, GC gc); /* 72 */
+ void (*tk_FreeImage) (Tk_Image image); /* 73 */
+ void (*tk_FreeOptions) (Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags); /* 74 */
+ void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */
+ void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */
+ void (*tk_FreeXId) (Display *display, XID xid); /* 77 */
+ GC (*tk_GCForColor) (XColor *colorPtr, Drawable drawable); /* 78 */
+ void (*tk_GeometryRequest) (Tk_Window tkwin, int reqWidth, int reqHeight); /* 79 */
+ Tk_3DBorder (*tk_Get3DBorder) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName); /* 80 */
+ void (*tk_GetAllBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object); /* 81 */
+ int (*tk_GetAnchor) (Tcl_Interp *interp, CONST char *str, Tk_Anchor *anchorPtr); /* 82 */
+ CONST84_RETURN char * (*tk_GetAtomName) (Tk_Window tkwin, Atom atom); /* 83 */
+ CONST84_RETURN char * (*tk_GetBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, CONST char *eventStr); /* 84 */
+ Pixmap (*tk_GetBitmap) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *str); /* 85 */
+ Pixmap (*tk_GetBitmapFromData) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *source, int width, int height); /* 86 */
+ int (*tk_GetCapStyle) (Tcl_Interp *interp, CONST char *str, int *capPtr); /* 87 */
+ XColor * (*tk_GetColor) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name); /* 88 */
+ XColor * (*tk_GetColorByValue) (Tk_Window tkwin, XColor *colorPtr); /* 89 */
+ Colormap (*tk_GetColormap) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *str); /* 90 */
+ Tk_Cursor (*tk_GetCursor) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid str); /* 91 */
+ Tk_Cursor (*tk_GetCursorFromData) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *source, CONST char *mask, int width, int height, int xHot, int yHot, Tk_Uid fg, Tk_Uid bg); /* 92 */
+ Tk_Font (*tk_GetFont) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *str); /* 93 */
+ Tk_Font (*tk_GetFontFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 94 */
+ void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics *fmPtr); /* 95 */
+ GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 96 */
+ Tk_Image (*tk_GetImage) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 97 */
+ ClientData (*tk_GetImageMasterData) (Tcl_Interp *interp, CONST char *name, Tk_ImageType **typePtrPtr); /* 98 */
+ Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */
+ int (*tk_GetJoinStyle) (Tcl_Interp *interp, CONST char *str, int *joinPtr); /* 100 */
+ int (*tk_GetJustify) (Tcl_Interp *interp, CONST char *str, Tk_Justify *justifyPtr); /* 101 */
+ int (*tk_GetNumMainWindows) (void); /* 102 */
+ Tk_Uid (*tk_GetOption) (Tk_Window tkwin, CONST char *name, CONST char *className); /* 103 */
+ int (*tk_GetPixels) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *str, int *intPtr); /* 104 */
+ Pixmap (*tk_GetPixmap) (Display *display, Drawable d, int width, int height, int depth); /* 105 */
+ int (*tk_GetRelief) (Tcl_Interp *interp, CONST char *name, int *reliefPtr); /* 106 */
+ void (*tk_GetRootCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 107 */
+ int (*tk_GetScrollInfo) (Tcl_Interp *interp, int argc, CONST84 char **argv, double *dblPtr, int *intPtr); /* 108 */
+ int (*tk_GetScreenMM) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *str, double *doublePtr); /* 109 */
+ int (*tk_GetSelection) (Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, ClientData clientData); /* 110 */
+ Tk_Uid (*tk_GetUid) (CONST char *str); /* 111 */
+ Visual * (*tk_GetVisual) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *str, int *depthPtr, Colormap *colormapPtr); /* 112 */
+ void (*tk_GetVRootGeometry) (Tk_Window tkwin, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 113 */
+ int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */
+ void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */
+ Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */
+ void (*tk_ImageChanged) (Tk_ImageMaster master, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
+ int (*tk_Init) (Tcl_Interp *interp); /* 118 */
+ Atom (*tk_InternAtom) (Tk_Window tkwin, CONST char *name); /* 119 */
+ int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */
+ void (*tk_MaintainGeometry) (Tk_Window slave, Tk_Window master, int x, int y, int width, int height); /* 121 */
+ Tk_Window (*tk_MainWindow) (Tcl_Interp *interp); /* 122 */
+ void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */
+ void (*tk_ManageGeometry) (Tk_Window tkwin, CONST Tk_GeomMgr *mgrPtr, ClientData clientData); /* 124 */
+ void (*tk_MapWindow) (Tk_Window tkwin); /* 125 */
+ int (*tk_MeasureChars) (Tk_Font tkfont, CONST char *source, int numBytes, int maxPixels, int flags, int *lengthPtr); /* 126 */
+ void (*tk_MoveResizeWindow) (Tk_Window tkwin, int x, int y, int width, int height); /* 127 */
+ void (*tk_MoveWindow) (Tk_Window tkwin, int x, int y); /* 128 */
+ void (*tk_MoveToplevelWindow) (Tk_Window tkwin, int x, int y); /* 129 */
+ CONST84_RETURN char * (*tk_NameOf3DBorder) (Tk_3DBorder border); /* 130 */
+ CONST84_RETURN char * (*tk_NameOfAnchor) (Tk_Anchor anchor); /* 131 */
+ CONST84_RETURN char * (*tk_NameOfBitmap) (Display *display, Pixmap bitmap); /* 132 */
+ CONST84_RETURN char * (*tk_NameOfCapStyle) (int cap); /* 133 */
+ CONST84_RETURN char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */
+ CONST84_RETURN char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */
+ CONST84_RETURN char * (*tk_NameOfFont) (Tk_Font font); /* 136 */
+ CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageMaster imageMaster); /* 137 */
+ CONST84_RETURN char * (*tk_NameOfJoinStyle) (int join); /* 138 */
+ CONST84_RETURN char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */
+ CONST84_RETURN char * (*tk_NameOfRelief) (int relief); /* 140 */
+ Tk_Window (*tk_NameToWindow) (Tcl_Interp *interp, CONST char *pathName, Tk_Window tkwin); /* 141 */
+ void (*tk_OwnSelection) (Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, ClientData clientData); /* 142 */
+ int (*tk_ParseArgv) (Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, CONST84 char **argv, Tk_ArgvInfo *argTable, int flags); /* 143 */
+ void (*tk_PhotoPutBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height); /* 144 */
+ void (*tk_PhotoPutZoomedBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY); /* 145 */
+ int (*tk_PhotoGetImage) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 146 */
+ void (*tk_PhotoBlank) (Tk_PhotoHandle handle); /* 147 */
+ void (*tk_PhotoExpand_Panic) (Tk_PhotoHandle handle, int width, int height); /* 148 */
+ void (*tk_PhotoGetSize) (Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); /* 149 */
+ void (*tk_PhotoSetSize_Panic) (Tk_PhotoHandle handle, int width, int height); /* 150 */
+ int (*tk_PointToChar) (Tk_TextLayout layout, int x, int y); /* 151 */
+ int (*tk_PostscriptFontName) (Tk_Font tkfont, Tcl_DString *dsPtr); /* 152 */
+ void (*tk_PreserveColormap) (Display *display, Colormap colormap); /* 153 */
+ void (*tk_QueueWindowEvent) (XEvent *eventPtr, Tcl_QueuePosition position); /* 154 */
+ void (*tk_RedrawImage) (Tk_Image image, int imageX, int imageY, int width, int height, Drawable drawable, int drawableX, int drawableY); /* 155 */
+ void (*tk_ResizeWindow) (Tk_Window tkwin, int width, int height); /* 156 */
+ int (*tk_RestackWindow) (Tk_Window tkwin, int aboveBelow, Tk_Window other); /* 157 */
+ Tk_RestrictProc * (*tk_RestrictEvents) (Tk_RestrictProc *proc, ClientData arg, ClientData *prevArgPtr); /* 158 */
+ int (*tk_SafeInit) (Tcl_Interp *interp); /* 159 */
+ CONST char * (*tk_SetAppName) (Tk_Window tkwin, CONST char *name); /* 160 */
+ void (*tk_SetBackgroundFromBorder) (Tk_Window tkwin, Tk_3DBorder border); /* 161 */
+ void (*tk_SetClass) (Tk_Window tkwin, CONST char *className); /* 162 */
+ void (*tk_SetGrid) (Tk_Window tkwin, int reqWidth, int reqHeight, int gridWidth, int gridHeight); /* 163 */
+ void (*tk_SetInternalBorder) (Tk_Window tkwin, int width); /* 164 */
+ void (*tk_SetWindowBackground) (Tk_Window tkwin, unsigned long pixel); /* 165 */
+ void (*tk_SetWindowBackgroundPixmap) (Tk_Window tkwin, Pixmap pixmap); /* 166 */
+ void (*tk_SetWindowBorder) (Tk_Window tkwin, unsigned long pixel); /* 167 */
+ void (*tk_SetWindowBorderWidth) (Tk_Window tkwin, int width); /* 168 */
+ void (*tk_SetWindowBorderPixmap) (Tk_Window tkwin, Pixmap pixmap); /* 169 */
+ void (*tk_SetWindowColormap) (Tk_Window tkwin, Colormap colormap); /* 170 */
+ int (*tk_SetWindowVisual) (Tk_Window tkwin, Visual *visual, int depth, Colormap colormap); /* 171 */
+ void (*tk_SizeOfBitmap) (Display *display, Pixmap bitmap, int *widthPtr, int *heightPtr); /* 172 */
+ void (*tk_SizeOfImage) (Tk_Image image, int *widthPtr, int *heightPtr); /* 173 */
+ int (*tk_StrictMotif) (Tk_Window tkwin); /* 174 */
+ void (*tk_TextLayoutToPostscript) (Tcl_Interp *interp, Tk_TextLayout layout); /* 175 */
+ int (*tk_TextWidth) (Tk_Font font, CONST char *str, int numBytes); /* 176 */
+ void (*tk_UndefineCursor) (Tk_Window window); /* 177 */
+ void (*tk_UnderlineChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, CONST char *source, int x, int y, int firstByte, int lastByte); /* 178 */
+ void (*tk_UnderlineTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 179 */
+ void (*tk_Ungrab) (Tk_Window tkwin); /* 180 */
+ void (*tk_UnmaintainGeometry) (Tk_Window slave, Tk_Window master); /* 181 */
+ void (*tk_UnmapWindow) (Tk_Window tkwin); /* 182 */
+ void (*tk_UnsetGrid) (Tk_Window tkwin); /* 183 */
+ void (*tk_UpdatePointer) (Tk_Window tkwin, int x, int y, int state); /* 184 */
+ Pixmap (*tk_AllocBitmapFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 185 */
+ Tk_3DBorder (*tk_Alloc3DBorderFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 186 */
+ XColor * (*tk_AllocColorFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 187 */
+ Tk_Cursor (*tk_AllocCursorFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 188 */
+ Tk_Font (*tk_AllocFontFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 189 */
+ Tk_OptionTable (*tk_CreateOptionTable) (Tcl_Interp *interp, CONST Tk_OptionSpec *templatePtr); /* 190 */
+ void (*tk_DeleteOptionTable) (Tk_OptionTable optionTable); /* 191 */
+ void (*tk_Free3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 192 */
+ void (*tk_FreeBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 193 */
+ void (*tk_FreeColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 194 */
+ void (*tk_FreeConfigOptions) (char *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 195 */
+ void (*tk_FreeSavedOptions) (Tk_SavedOptions *savePtr); /* 196 */
+ void (*tk_FreeCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 197 */
+ void (*tk_FreeFontFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 198 */
+ Tk_3DBorder (*tk_Get3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 199 */
+ int (*tk_GetAnchorFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Anchor *anchorPtr); /* 200 */
+ Pixmap (*tk_GetBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 201 */
+ XColor * (*tk_GetColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 202 */
+ Tk_Cursor (*tk_GetCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */
+ Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */
+ Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */
+ int (*tk_GetJustifyFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr); /* 206 */
+ int (*tk_GetMMFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 207 */
+ int (*tk_GetPixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 208 */
+ int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */
+ int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], double *dblPtr, int *intPtr); /* 210 */
+ int (*tk_InitOptions) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */
+ void (*tk_MainEx) (int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 212 */
+ void (*tk_RestoreSavedOptions) (Tk_SavedOptions *savePtr); /* 213 */
+ int (*tk_SetOptions) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *CONST objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */
+ void (*tk_InitConsoleChannels) (Tcl_Interp *interp); /* 215 */
+ int (*tk_CreateConsoleWindow) (Tcl_Interp *interp); /* 216 */
+ void (*tk_CreateSmoothMethod) (Tcl_Interp *interp, Tk_SmoothMethod *method); /* 217 */
+ VOID *reserved218;
+ VOID *reserved219;
+ int (*tk_GetDash) (Tcl_Interp *interp, CONST char *value, Tk_Dash *dash); /* 220 */
+ void (*tk_CreateOutline) (Tk_Outline *outline); /* 221 */
+ void (*tk_DeleteOutline) (Display *display, Tk_Outline *outline); /* 222 */
+ int (*tk_ConfigOutlineGC) (XGCValues *gcValues, Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 223 */
+ int (*tk_ChangeOutlineGC) (Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 224 */
+ int (*tk_ResetOutlineGC) (Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 225 */
+ int (*tk_CanvasPsOutline) (Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 226 */
+ void (*tk_SetTSOrigin) (Tk_Window tkwin, GC gc, int x, int y); /* 227 */
+ int (*tk_CanvasGetCoordFromObj) (Tcl_Interp *interp, Tk_Canvas canvas, Tcl_Obj *obj, double *doublePtr); /* 228 */
+ void (*tk_CanvasSetOffset) (Tk_Canvas canvas, GC gc, Tk_TSOffset *offset); /* 229 */
+ void (*tk_DitherPhoto) (Tk_PhotoHandle handle, int x, int y, int width, int height); /* 230 */
+ int (*tk_PostscriptBitmap) (Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX, int startY, int width, int height); /* 231 */
+ int (*tk_PostscriptColor) (Tcl_Interp *interp, Tk_PostscriptInfo psInfo, XColor *colorPtr); /* 232 */
+ int (*tk_PostscriptFont) (Tcl_Interp *interp, Tk_PostscriptInfo psInfo, Tk_Font font); /* 233 */
+ int (*tk_PostscriptImage) (Tk_Image image, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass); /* 234 */
+ void (*tk_PostscriptPath) (Tcl_Interp *interp, Tk_PostscriptInfo psInfo, double *coordPtr, int numPoints); /* 235 */
+ int (*tk_PostscriptStipple) (Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap); /* 236 */
+ double (*tk_PostscriptY) (double y, Tk_PostscriptInfo psInfo); /* 237 */
+ int (*tk_PostscriptPhoto) (Tcl_Interp *interp, Tk_PhotoImageBlock *blockPtr, Tk_PostscriptInfo psInfo, int width, int height); /* 238 */
+ void (*tk_CreateClientMessageHandler) (Tk_ClientMessageProc *proc); /* 239 */
+ void (*tk_DeleteClientMessageHandler) (Tk_ClientMessageProc *proc); /* 240 */
+ Tk_Window (*tk_CreateAnonymousWindow) (Tcl_Interp *interp, Tk_Window parent, CONST char *screenName); /* 241 */
+ void (*tk_SetClassProcs) (Tk_Window tkwin, Tk_ClassProcs *procs, ClientData instanceData); /* 242 */
+ void (*tk_SetInternalBorderEx) (Tk_Window tkwin, int left, int right, int top, int bottom); /* 243 */
+ void (*tk_SetMinimumRequestSize) (Tk_Window tkwin, int minWidth, int minHeight); /* 244 */
+ void (*tk_SetCaretPos) (Tk_Window tkwin, int x, int y, int height); /* 245 */
+ void (*tk_PhotoPutBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 246 */
+ void (*tk_PhotoPutZoomedBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 247 */
+ int (*tk_CollapseMotionEvents) (Display *display, int collapse); /* 248 */
+ Tk_StyleEngine (*tk_RegisterStyleEngine) (CONST char *name, Tk_StyleEngine parent); /* 249 */
+ Tk_StyleEngine (*tk_GetStyleEngine) (CONST char *name); /* 250 */
+ int (*tk_RegisterStyledElement) (Tk_StyleEngine engine, Tk_ElementSpec *templatePtr); /* 251 */
+ int (*tk_GetElementId) (CONST char *name); /* 252 */
+ Tk_Style (*tk_CreateStyle) (CONST char *name, Tk_StyleEngine engine, ClientData clientData); /* 253 */
+ Tk_Style (*tk_GetStyle) (Tcl_Interp *interp, CONST char *name); /* 254 */
+ void (*tk_FreeStyle) (Tk_Style style); /* 255 */
+ CONST char * (*tk_NameOfStyle) (Tk_Style style); /* 256 */
+ Tk_Style (*tk_AllocStyleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 257 */
+ Tk_Style (*tk_GetStyleFromObj) (Tcl_Obj *objPtr); /* 258 */
+ void (*tk_FreeStyleFromObj) (Tcl_Obj *objPtr); /* 259 */
+ Tk_StyledElement (*tk_GetStyledElement) (Tk_Style style, int elementId, Tk_OptionTable optionTable); /* 260 */
+ void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */
+ void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */
+ int (*tk_GetElementBorderWidth) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin); /* 263 */
+ void (*tk_DrawElement) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 264 */
+ int (*tk_PhotoExpand) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 265 */
+ int (*tk_PhotoPutBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 266 */
+ int (*tk_PhotoPutZoomedBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 267 */
+ int (*tk_PhotoSetSize) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 268 */
+ long (*tk_GetUserInactiveTime) (Display *dpy); /* 269 */
+ void (*tk_ResetUserInactiveTime) (Display *dpy); /* 270 */
+ Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
+ void (*tk_CreateOldImageType) (Tk_ImageType *typePtr); /* 272 */
+ void (*tk_CreateOldPhotoImageFormat) (Tk_PhotoImageFormat *formatPtr); /* 273 */
} TkStubs;
#ifdef __cplusplus
@@ -1799,17 +2568,17 @@ extern TkStubs *tkStubsPtr;
#define Tk_PhotoBlank \
(tkStubsPtr->tk_PhotoBlank) /* 147 */
#endif
-#ifndef Tk_PhotoExpand
-#define Tk_PhotoExpand \
- (tkStubsPtr->tk_PhotoExpand) /* 148 */
+#ifndef Tk_PhotoExpand_Panic
+#define Tk_PhotoExpand_Panic \
+ (tkStubsPtr->tk_PhotoExpand_Panic) /* 148 */
#endif
#ifndef Tk_PhotoGetSize
#define Tk_PhotoGetSize \
(tkStubsPtr->tk_PhotoGetSize) /* 149 */
#endif
-#ifndef Tk_PhotoSetSize
-#define Tk_PhotoSetSize \
- (tkStubsPtr->tk_PhotoSetSize) /* 150 */
+#ifndef Tk_PhotoSetSize_Panic
+#define Tk_PhotoSetSize_Panic \
+ (tkStubsPtr->tk_PhotoSetSize_Panic) /* 150 */
#endif
#ifndef Tk_PointToChar
#define Tk_PointToChar \
@@ -2185,13 +2954,13 @@ extern TkStubs *tkStubsPtr;
#define Tk_SetCaretPos \
(tkStubsPtr->tk_SetCaretPos) /* 245 */
#endif
-#ifndef Tk_PhotoPutBlock
-#define Tk_PhotoPutBlock \
- (tkStubsPtr->tk_PhotoPutBlock) /* 246 */
+#ifndef Tk_PhotoPutBlock_Panic
+#define Tk_PhotoPutBlock_Panic \
+ (tkStubsPtr->tk_PhotoPutBlock_Panic) /* 246 */
#endif
-#ifndef Tk_PhotoPutZoomedBlock
-#define Tk_PhotoPutZoomedBlock \
- (tkStubsPtr->tk_PhotoPutZoomedBlock) /* 247 */
+#ifndef Tk_PhotoPutZoomedBlock_Panic
+#define Tk_PhotoPutZoomedBlock_Panic \
+ (tkStubsPtr->tk_PhotoPutZoomedBlock_Panic) /* 247 */
#endif
#ifndef Tk_CollapseMotionEvents
#define Tk_CollapseMotionEvents \
@@ -2261,6 +3030,42 @@ extern TkStubs *tkStubsPtr;
#define Tk_DrawElement \
(tkStubsPtr->tk_DrawElement) /* 264 */
#endif
+#ifndef Tk_PhotoExpand
+#define Tk_PhotoExpand \
+ (tkStubsPtr->tk_PhotoExpand) /* 265 */
+#endif
+#ifndef Tk_PhotoPutBlock
+#define Tk_PhotoPutBlock \
+ (tkStubsPtr->tk_PhotoPutBlock) /* 266 */
+#endif
+#ifndef Tk_PhotoPutZoomedBlock
+#define Tk_PhotoPutZoomedBlock \
+ (tkStubsPtr->tk_PhotoPutZoomedBlock) /* 267 */
+#endif
+#ifndef Tk_PhotoSetSize
+#define Tk_PhotoSetSize \
+ (tkStubsPtr->tk_PhotoSetSize) /* 268 */
+#endif
+#ifndef Tk_GetUserInactiveTime
+#define Tk_GetUserInactiveTime \
+ (tkStubsPtr->tk_GetUserInactiveTime) /* 269 */
+#endif
+#ifndef Tk_ResetUserInactiveTime
+#define Tk_ResetUserInactiveTime \
+ (tkStubsPtr->tk_ResetUserInactiveTime) /* 270 */
+#endif
+#ifndef Tk_Interp
+#define Tk_Interp \
+ (tkStubsPtr->tk_Interp) /* 271 */
+#endif
+#ifndef Tk_CreateOldImageType
+#define Tk_CreateOldImageType \
+ (tkStubsPtr->tk_CreateOldImageType) /* 272 */
+#endif
+#ifndef Tk_CreateOldPhotoImageFormat
+#define Tk_CreateOldPhotoImageFormat \
+ (tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */
+#endif
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index afd6b15..8f181cd 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1,9 +1,9 @@
-/*
- * Entry.c --
+/*
+ * tkEntry.c --
*
* This module implements entry and spinbox widgets for the Tk toolkit.
- * An entry displays a string and allows the string to be edited.
- * A spinbox expands on the entry by adding up/down buttons that control
+ * An entry displays a string and allows the string to be edited. A
+ * spinbox expands on the entry by adding up/down buttons that control
* the value of the entry widget.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
@@ -11,32 +11,32 @@
* Copyright (c) 2000 Ajuba Solutions.
* Copyright (c) 2002 ActiveState Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
#include "default.h"
#include "tkEntry.h"
-
/*
- * The following macro defines how many extra pixels to leave on each
- * side of the text in the entry.
+ * The following macro defines how many extra pixels to leave on each side of
+ * the text in the entry.
*/
#define XPAD 1
#define YPAD 1
/*
- * A comparison function for double values. For Spinboxes.
+ * A comparison function for double values. For Spinboxes.
*/
+
#define MIN_DBL_VAL 1E-9
#define DOUBLES_EQ(d1, d2) (fabs((d1) - (d2)) < MIN_DBL_VAL)
static char *stateStrings[] = {
- "disabled", "normal", "readonly", (char *) NULL
+ "disabled", "normal", "readonly", NULL
};
/*
@@ -44,7 +44,7 @@ static char *stateStrings[] = {
*/
static char *validateStrings[] = {
- "all", "key", "focus", "focusin", "focusout", "none", (char *) NULL
+ "all", "key", "focus", "focusin", "focusout", "none", NULL
};
enum validateType {
VALIDATE_ALL, VALIDATE_KEY, VALIDATE_FOCUS,
@@ -61,115 +61,104 @@ enum validateType {
* Information used for Entry objv parsing.
*/
-static Tk_OptionSpec entryOptSpec[] = {
+static const Tk_OptionSpec entryOptSpec[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder),
0, (ClientData) DEF_ENTRY_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth),
- 0, 0, 0},
+ DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BORDER, "-disabledbackground", "disabledBackground",
- "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1,
- Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
+ "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1,
+ Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK,
+ (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
- "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1,
- Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
+ "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1,
+ Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
- Tk_Offset(Entry, exportSelection), 0, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
+ Tk_Offset(Entry, exportSelection), 0, 0, 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0,
- 0, 0},
+ DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG,
- -1, Tk_Offset(Entry, highlightBgColorPtr),
- 0, 0, 0},
+ -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr),
- 0, 0, 0},
+ DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
+ "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
Tk_Offset(Entry, highlightWidth), 0, 0, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_ENTRY_INSERT_BG,
- -1, Tk_Offset(Entry, insertBorder),
- 0, 0, 0},
- {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
- "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
- Tk_Offset(Entry, insertBorderWidth), 0,
- (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
+ DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
+ "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
+ Tk_Offset(Entry, insertBorderWidth), 0,
+ (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
- DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
+ 0, 0, 0},
{TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0},
{TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-invcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
+ {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0},
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
- "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1,
- Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
+ "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1,
+ Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
+ (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief),
- 0, 0, 0},
+ DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder),
- 0, (ClientData) DEF_ENTRY_SELECT_MONO, 0},
- {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
- "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1,
- Tk_Offset(Entry, selBorderWidth),
- 0, (ClientData) DEF_ENTRY_SELECT_BD_MONO, 0},
+ DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder),
+ 0, (ClientData) DEF_ENTRY_SELECT_MONO, 0},
+ {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
+ "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1,
+ Tk_Offset(Entry, selBorderWidth),
+ 0, (ClientData) DEF_ENTRY_SELECT_BD_MONO, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr),
TK_CONFIG_NULL_OK, (ClientData) DEF_ENTRY_SELECT_FG_MONO, 0},
{TK_OPTION_STRING, "-show", "show", "Show",
- DEF_ENTRY_SHOW, -1, Tk_Offset(Entry, showChar),
- TK_OPTION_NULL_OK, 0, 0},
+ DEF_ENTRY_SHOW, -1, Tk_Offset(Entry, showChar),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state),
- 0, (ClientData) stateStrings, 0},
+ DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state),
+ 0, (ClientData) stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus),
- TK_OPTION_NULL_OK, 0, 0},
+ DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
DEF_ENTRY_TEXT_VARIABLE, -1, Tk_Offset(Entry, textVarName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
- DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
- 0, (ClientData) validateStrings, 0},
- {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
- (char *) NULL, -1, Tk_Offset(Entry, validateCmd),
- TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-vcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
+ DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
+ 0, (ClientData) validateStrings, 0},
+ {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand",
+ NULL, -1, Tk_Offset(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
{TK_OPTION_INT, "-width", "width", "Width",
DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
@@ -189,20 +178,19 @@ static Tk_OptionSpec entryOptSpec[] = {
#define DEF_SPINBOX_VALUES ""
#define DEF_SPINBOX_WRAP "0"
-static Tk_OptionSpec sbOptSpec[] = {
+static const Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Background",
DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(Spinbox, activeBorder),
0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder),
0, (ClientData) DEF_ENTRY_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth),
- 0, 0, 0},
+ DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0},
{TK_OPTION_BORDER, "-buttonbackground", "Button.background", "Background",
DEF_BUTTON_BG_COLOR, -1, Tk_Offset(Spinbox, buttonBorder),
0, (ClientData) DEF_BUTTON_BG_MONO, 0},
@@ -210,11 +198,9 @@ static Tk_OptionSpec sbOptSpec[] = {
DEF_BUTTON_CURSOR, -1, Tk_Offset(Spinbox, bCursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-buttondownrelief", "Button.relief", "Relief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief),
- 0, 0, 0},
+ DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief), 0, 0, 0},
{TK_OPTION_RELIEF, "-buttonuprelief", "Button.relief", "Relief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief),
- 0, 0, 0},
+ DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_SPINBOX_CMD, -1, Tk_Offset(Spinbox, command),
TK_OPTION_NULL_OK, 0, 0},
@@ -222,22 +208,21 @@ static Tk_OptionSpec sbOptSpec[] = {
DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BORDER, "-disabledbackground", "disabledBackground",
- "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1,
- Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
+ "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1,
+ Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK,
+ (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
- "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1,
- Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
+ "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1,
+ Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
- Tk_Offset(Entry, exportSelection), 0, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
+ Tk_Offset(Entry, exportSelection), 0, 0, 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0,
- 0, 0},
+ DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0},
{TK_OPTION_STRING, "-format", "format", "Format",
DEF_SPINBOX_FORMAT, -1, Tk_Offset(Spinbox, reqFormat),
TK_OPTION_NULL_OK, 0, 0},
@@ -245,84 +230,77 @@ static Tk_OptionSpec sbOptSpec[] = {
DEF_SPINBOX_FROM, -1, Tk_Offset(Spinbox, fromValue), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG,
- -1, Tk_Offset(Entry, highlightBgColorPtr),
- 0, 0, 0},
+ -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr),
- 0, 0, 0},
+ DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
+ "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
Tk_Offset(Entry, highlightWidth), 0, 0, 0},
{TK_OPTION_DOUBLE, "-increment", "increment", "Increment",
DEF_SPINBOX_INCREMENT, -1, Tk_Offset(Spinbox, increment), 0, 0, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder),
- 0, 0, 0},
- {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
- "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
- Tk_Offset(Entry, insertBorderWidth), 0,
- (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
+ DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
+ "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
+ Tk_Offset(Entry, insertBorderWidth), 0,
+ (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
- DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
+ 0, 0, 0},
{TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0},
{TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-invcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
+ {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief),
- 0, 0, 0},
+ DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
- "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1,
- Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
+ "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1,
+ Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
+ (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
- DEF_SPINBOX_REPEAT_DELAY, -1, Tk_Offset(Spinbox, repeatDelay),
- 0, 0, 0},
+ DEF_SPINBOX_REPEAT_DELAY, -1, Tk_Offset(Spinbox, repeatDelay),
+ 0, 0, 0},
{TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval",
- DEF_SPINBOX_REPEAT_INTERVAL, -1, Tk_Offset(Spinbox, repeatInterval),
- 0, 0, 0},
+ DEF_SPINBOX_REPEAT_INTERVAL, -1, Tk_Offset(Spinbox, repeatInterval),
+ 0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder),
- 0, (ClientData) DEF_ENTRY_SELECT_MONO, 0},
- {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
- "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1,
- Tk_Offset(Entry, selBorderWidth),
- 0, (ClientData) DEF_ENTRY_SELECT_BD_MONO, 0},
+ DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder),
+ 0, (ClientData) DEF_ENTRY_SELECT_MONO, 0},
+ {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
+ "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1,
+ Tk_Offset(Entry, selBorderWidth),
+ 0, (ClientData) DEF_ENTRY_SELECT_BD_MONO, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr),
TK_CONFIG_NULL_OK, (ClientData) DEF_ENTRY_SELECT_FG_MONO, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state),
- 0, (ClientData) stateStrings, 0},
+ DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state),
+ 0, (ClientData) stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus),
- TK_CONFIG_NULL_OK, 0, 0},
+ DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus),
+ TK_CONFIG_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
DEF_ENTRY_TEXT_VARIABLE, -1, Tk_Offset(Entry, textVarName),
TK_CONFIG_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-to", "to", "To",
DEF_SPINBOX_TO, -1, Tk_Offset(Spinbox, toValue), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
- DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
- 0, (ClientData) validateStrings, 0},
- {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
- (char *) NULL, -1, Tk_Offset(Entry, validateCmd),
- TK_CONFIG_NULL_OK, 0, 0},
+ DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
+ 0, (ClientData) validateStrings, 0},
+ {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand",
+ NULL, -1, Tk_Offset(Entry, validateCmd), TK_CONFIG_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-values", "values", "Values",
- DEF_SPINBOX_VALUES, -1, Tk_Offset(Spinbox, valueStr),
- TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-vcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
+ DEF_SPINBOX_VALUES, -1, Tk_Offset(Spinbox, valueStr),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
{TK_OPTION_INT, "-width", "width", "Width",
DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0},
{TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap",
@@ -330,29 +308,28 @@ static Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd),
TK_CONFIG_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
- * The following tables define the entry widget commands (and sub-
- * commands) and map the indexes into the string tables into
- * enumerated types used to dispatch the entry widget command.
+ * The following tables define the entry widget commands (and sub-commands)
+ * and map the indexes into the string tables into enumerated types used to
+ * dispatch the entry widget command.
*/
static CONST char *entryCmdNames[] = {
- "bbox", "cget", "configure", "delete", "get", "icursor", "index",
- "insert", "scan", "selection", "validate", "xview", (char *) NULL
+ "bbox", "cget", "configure", "delete", "get", "icursor", "index",
+ "insert", "scan", "selection", "validate", "xview", NULL
};
enum entryCmd {
- COMMAND_BBOX, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELETE,
- COMMAND_GET, COMMAND_ICURSOR, COMMAND_INDEX, COMMAND_INSERT,
+ COMMAND_BBOX, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELETE,
+ COMMAND_GET, COMMAND_ICURSOR, COMMAND_INDEX, COMMAND_INSERT,
COMMAND_SCAN, COMMAND_SELECTION, COMMAND_VALIDATE, COMMAND_XVIEW
};
static CONST char *selCmdNames[] = {
- "adjust", "clear", "from", "present", "range", "to", (char *) NULL
+ "adjust", "clear", "from", "present", "range", "to", NULL
};
enum selCmd {
@@ -361,31 +338,30 @@ enum selCmd {
};
/*
- * The following tables define the spinbox widget commands (and sub-
- * commands) and map the indexes into the string tables into
- * enumerated types used to dispatch the spinbox widget command.
+ * The following tables define the spinbox widget commands (and sub-commands)
+ * and map the indexes into the string tables into enumerated types used to
+ * dispatch the spinbox widget command.
*/
static CONST char *sbCmdNames[] = {
"bbox", "cget", "configure", "delete", "get", "icursor", "identify",
"index", "insert", "invoke", "scan", "selection", "set",
- "validate", "xview", (char *) NULL
+ "validate", "xview", NULL
};
enum sbCmd {
- SB_CMD_BBOX, SB_CMD_CGET, SB_CMD_CONFIGURE, SB_CMD_DELETE,
+ SB_CMD_BBOX, SB_CMD_CGET, SB_CMD_CONFIGURE, SB_CMD_DELETE,
SB_CMD_GET, SB_CMD_ICURSOR, SB_CMD_IDENTIFY, SB_CMD_INDEX,
SB_CMD_INSERT, SB_CMD_INVOKE, SB_CMD_SCAN, SB_CMD_SELECTION,
SB_CMD_SET, SB_CMD_VALIDATE, SB_CMD_XVIEW
};
static CONST char *sbSelCmdNames[] = {
- "adjust", "clear", "element", "from", "present", "range", "to",
- (char *) NULL
+ "adjust", "clear", "element", "from", "present", "range", "to", NULL
};
enum sbselCmd {
- SB_SEL_ADJUST, SB_SEL_CLEAR, SB_SEL_ELEMENT, SB_SEL_FROM,
+ SB_SEL_ADJUST, SB_SEL_CLEAR, SB_SEL_ELEMENT, SB_SEL_FROM,
SB_SEL_PRESENT, SB_SEL_RANGE, SB_SEL_TO
};
@@ -393,91 +369,80 @@ enum sbselCmd {
* Extra for selection of elements
*/
-/*
- * This is the string array corresponding to the enum in selelement.
- * If you modify them, you must modify the strings here.
+/*
+ * This is the string array corresponding to the enum in selelement. If you
+ * modify them, you must modify the strings here.
*/
-
+
static CONST char *selElementNames[] = {
- "none", "buttondown", "buttonup", (char *) NULL, "entry"
+ "none", "buttondown", "buttonup", NULL, "entry"
};
+
/*
- * Flags for GetEntryIndex procedure:
+ * Flags for GetEntryIndex function:
*/
#define ZERO_OK 1
#define LAST_PLUS_ONE_OK 2
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int ConfigureEntry _ANSI_ARGS_((Tcl_Interp *interp,
- Entry *entryPtr, int objc,
- Tcl_Obj *CONST objv[], int flags));
-static void DeleteChars _ANSI_ARGS_((Entry *entryPtr, int index,
- int count));
-static void DestroyEntry _ANSI_ARGS_((char *memPtr));
-static void DisplayEntry _ANSI_ARGS_((ClientData clientData));
-static void EntryBlinkProc _ANSI_ARGS_((ClientData clientData));
-static void EntryCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void EntryComputeGeometry _ANSI_ARGS_((Entry *entryPtr));
-static void EntryEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EntryFocusProc _ANSI_ARGS_ ((Entry *entryPtr,
- int gotFocus));
-static int EntryFetchSelection _ANSI_ARGS_((ClientData clientData,
- int offset, char *buffer, int maxBytes));
-static void EntryLostSelection _ANSI_ARGS_((
- ClientData clientData));
-static void EventuallyRedraw _ANSI_ARGS_((Entry *entryPtr));
-static void EntryScanTo _ANSI_ARGS_((Entry *entryPtr, int y));
-static void EntrySetValue _ANSI_ARGS_((Entry *entryPtr,
- CONST char *value));
-static void EntrySelectTo _ANSI_ARGS_((
- Entry *entryPtr, int index));
-static char * EntryTextVarProc _ANSI_ARGS_((ClientData clientData,
+static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr,
+ int objc, Tcl_Obj *CONST objv[], int flags);
+static void DeleteChars(Entry *entryPtr, int index, int count);
+static void DestroyEntry(char *memPtr);
+static void DisplayEntry(ClientData clientData);
+static void EntryBlinkProc(ClientData clientData);
+static void EntryCmdDeletedProc(ClientData clientData);
+static void EntryComputeGeometry(Entry *entryPtr);
+static void EntryEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EntryFocusProc(Entry *entryPtr, int gotFocus);
+static int EntryFetchSelection(ClientData clientData, int offset,
+ char *buffer, int maxBytes);
+static void EntryLostSelection(ClientData clientData);
+static void EventuallyRedraw(Entry *entryPtr);
+static void EntryScanTo(Entry *entryPtr, int y);
+static void EntrySetValue(Entry *entryPtr, CONST char *value);
+static void EntrySelectTo(Entry *entryPtr, int index);
+static char * EntryTextVarProc(ClientData clientData,
Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static void EntryUpdateScrollbar _ANSI_ARGS_((Entry *entryPtr));
-static int EntryValidate _ANSI_ARGS_((Entry *entryPtr,
- char *cmd));
-static int EntryValidateChange _ANSI_ARGS_((Entry *entryPtr,
- char *change, CONST char *new, int index,
- int type));
-static void ExpandPercents _ANSI_ARGS_((Entry *entryPtr,
- CONST char *before, char *change, CONST char *new,
- int index, int type, Tcl_DString *dsPtr));
-static void EntryValueChanged _ANSI_ARGS_((Entry *entryPtr,
- CONST char *newValue));
-static void EntryVisibleRange _ANSI_ARGS_((Entry *entryPtr,
- double *firstPtr, double *lastPtr));
-static int EntryWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void EntryWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static int GetEntryIndex _ANSI_ARGS_((Tcl_Interp *interp,
- Entry *entryPtr, char *string, int *indexPtr));
-static void InsertChars _ANSI_ARGS_((Entry *entryPtr, int index,
- char *string));
+ CONST char *name2, int flags);
+static void EntryUpdateScrollbar(Entry *entryPtr);
+static int EntryValidate(Entry *entryPtr, char *cmd);
+static int EntryValidateChange(Entry *entryPtr, char *change,
+ CONST char *newStr, int index, int type);
+static void ExpandPercents(Entry *entryPtr, CONST char *before,
+ CONST char *change, CONST char *newStr, int index,
+ int type, Tcl_DString *dsPtr);
+static void EntryValueChanged(Entry *entryPtr,
+ CONST char *newValue);
+static void EntryVisibleRange(Entry *entryPtr,
+ double *firstPtr, double *lastPtr);
+static int EntryWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void EntryWorldChanged(ClientData instanceData);
+static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr,
+ char *string, int *indexPtr);
+static void InsertChars(Entry *entryPtr, int index, char *string);
/*
* These forward declarations are the spinbox specific ones:
*/
-static int SpinboxWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int GetSpinboxElement _ANSI_ARGS_((Spinbox *sbPtr,
- int x, int y));
-static int SpinboxInvoke _ANSI_ARGS_((Tcl_Interp *interp,
- Spinbox *sbPtr, int element));
-static int ComputeFormat _ANSI_ARGS_((Spinbox *sbPtr));
+static int SpinboxWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int GetSpinboxElement(Spinbox *sbPtr, int x, int y);
+static int SpinboxInvoke(Tcl_Interp *interp, Spinbox *sbPtr,
+ int element);
+static int ComputeFormat(Spinbox *sbPtr);
/*
- * The structure below defines widget class behavior by means of procedures
+ * The structure below defines widget class behavior by means of functions
* that can be invoked from generic window code.
*/
@@ -492,9 +457,8 @@ static Tk_ClassProcs entryClass = {
*
* Tk_EntryObjCmd --
*
- * This procedure is invoked to process the "entry" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "entry" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -506,11 +470,11 @@ static Tk_ClassProcs entryClass = {
*/
int
-Tk_EntryObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_EntryObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register Entry *entryPtr;
Tk_OptionTable optionTable;
@@ -523,27 +487,27 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
/*
- * Create the option table for this widget class. If it has already
- * been created, Tk will return the cached value.
+ * Create the option table for this widget class. If it has already been
+ * created, Tk will return the cached value.
*/
optionTable = Tk_CreateOptionTable(interp, entryOptSpec);
/*
- * Initialize the fields of the structure that won't be initialized
- * by ConfigureEntry, or that ConfigureEntry requires to be
- * initialized already (e.g. resource pointers). Only the non-NULL/0
- * data must be initialized as memset covers the rest.
+ * Initialize the fields of the structure that won't be initialized by
+ * ConfigureEntry, or that ConfigureEntry requires to be initialized
+ * already (e.g. resource pointers). Only the non-NULL/0 data must be
+ * initialized as memset covers the rest.
*/
entryPtr = (Entry *) ckalloc(sizeof(Entry));
- memset((VOID *) entryPtr, 0, sizeof(Entry));
+ memset(entryPtr, 0, sizeof(Entry));
entryPtr->tkwin = tkwin;
entryPtr->display = Tk_Display(tkwin);
@@ -573,7 +537,7 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
entryPtr->validate = VALIDATE_NONE;
/*
- * Keep a hold of the associated tkwin until we destroy the listbox,
+ * Keep a hold of the associated tkwin until we destroy the entry,
* otherwise Tk might free it while we still need it.
*/
@@ -603,9 +567,9 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
*
* EntryWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -617,11 +581,11 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
*/
static int
-EntryWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about entry widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+EntryWidgetObjCmd(
+ ClientData clientData, /* Information about entry widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Entry *entryPtr = (Entry *) clientData;
int cmdIndex, selIndex, result;
@@ -632,9 +596,9 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
- /*
- * Parse the widget command by looking up the second token in
- * the list of valid command names.
+ /*
+ * Parse the widget command by looking up the second token in the list of
+ * valid command names.
*/
result = Tcl_GetIndexFromObj(interp, objv[1], entryCmdNames,
@@ -645,398 +609,381 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
Tcl_Preserve((ClientData) entryPtr);
switch ((enum entryCmd) cmdIndex) {
- case COMMAND_BBOX: {
- int index, x, y, width, height;
- char buf[TCL_INTEGER_SPACE * 4];
+ case COMMAND_BBOX: {
+ int index, x, y, width, height;
+ char buf[TCL_INTEGER_SPACE * 4];
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
- }
- if ((index == entryPtr->numChars) && (index > 0)) {
- index--;
- }
- Tk_CharBbox(entryPtr->textLayout, index, &x, &y,
- &width, &height);
- sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX,
- y + entryPtr->layoutY, width, height);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- break;
- }
-
- case COMMAND_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
- goto error;
- }
-
- objPtr = Tk_GetOptionValue(interp, (char *) entryPtr,
- entryPtr->optionTable, objv[2], entryPtr->tkwin);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
+ goto error;
+ }
+ if ((index == entryPtr->numChars) && (index > 0)) {
+ index--;
+ }
+ Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
+ sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX,
+ y + entryPtr->layoutY, width, height);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ break;
+ }
+
+ case COMMAND_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ goto error;
+ }
+
+ objPtr = Tk_GetOptionValue(interp, (char *) entryPtr,
+ entryPtr->optionTable, objv[2], entryPtr->tkwin);
+ if (objPtr == NULL) {
+ goto error;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ }
+ break;
+
+ case COMMAND_CONFIGURE:
+ if (objc <= 3) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
+ entryPtr->optionTable,
+ (objc == 3) ? objv[2] : NULL,
+ entryPtr->tkwin);
if (objPtr == NULL) {
- goto error;
+ goto error;
} else {
Tcl_SetObjResult(interp, objPtr);
}
- break;
+ } else {
+ result = ConfigureEntry(interp, entryPtr, objc-2, objv+2, 0);
}
+ break;
- case COMMAND_CONFIGURE: {
- if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
- entryPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- entryPtr->tkwin);
- if (objPtr == NULL) {
- goto error;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- }
- } else {
- result = ConfigureEntry(interp, entryPtr, objc-2, objv+2, 0);
- }
- break;
+ case COMMAND_DELETE: {
+ int first, last;
+
+ if ((objc < 3) || (objc > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &first) != TCL_OK) {
+ goto error;
+ }
+ if (objc == 3) {
+ last = first + 1;
+ } else if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
+ &last) != TCL_OK) {
+ goto error;
}
+ if ((last >= first) && (entryPtr->state == STATE_NORMAL)) {
+ DeleteChars(entryPtr, first, last - first);
+ }
+ break;
+ }
- case COMMAND_DELETE: {
- int first, last;
+ case COMMAND_GET:
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ goto error;
+ }
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
+ break;
- if ((objc < 3) || (objc > 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &first) != TCL_OK) {
- goto error;
- }
- if (objc == 3) {
- last = first + 1;
- } else {
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
- &last) != TCL_OK) {
- goto error;
- }
- }
- if ((last >= first) && (entryPtr->state == STATE_NORMAL)) {
- DeleteChars(entryPtr, first, last - first);
- }
- break;
+ case COMMAND_ICURSOR:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pos");
+ goto error;
}
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &entryPtr->insertPos) != TCL_OK) {
+ goto error;
+ }
+ EventuallyRedraw(entryPtr);
+ break;
- case COMMAND_GET: {
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
- goto error;
- }
- Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
- break;
+ case COMMAND_INDEX: {
+ int index;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "string");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
+ goto error;
}
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ break;
+ }
- case COMMAND_ICURSOR: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "pos");
+ case COMMAND_INSERT: {
+ int index;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index text");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
+ goto error;
+ }
+ if (entryPtr->state == STATE_NORMAL) {
+ InsertChars(entryPtr, index, Tcl_GetString(objv[3]));
+ }
+ break;
+ }
+
+ case COMMAND_SCAN: {
+ int x;
+ char *minorCmd;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x");
+ goto error;
+ }
+ if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
+ goto error;
+ }
+
+ minorCmd = Tcl_GetString(objv[2]);
+ if (minorCmd[0] == 'm'
+ && (strncmp(minorCmd, "mark", strlen(minorCmd)) == 0)) {
+ entryPtr->scanMarkX = x;
+ entryPtr->scanMarkIndex = entryPtr->leftIndex;
+ } else if ((minorCmd[0] == 'd')
+ && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) {
+ EntryScanTo(entryPtr, x);
+ } else {
+ Tcl_AppendResult(interp, "bad scan option \"",
+ Tcl_GetString(objv[2]), "\": must be mark or dragto",
+ NULL);
+ goto error;
+ }
+ break;
+ }
+
+ case COMMAND_SELECTION: {
+ int index, index2;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
+ goto error;
+ }
+
+ /*
+ * Parse the selection sub-command, using the command table
+ * "selCmdNames" defined above.
+ */
+
+ result = Tcl_GetIndexFromObj(interp, objv[2], selCmdNames,
+ "selection option", 0, &selIndex);
+ if (result != TCL_OK) {
+ goto error;
+ }
+
+ /*
+ * Disabled entries don't allow the selection to be modified, but
+ * 'selection present' must return a boolean.
+ */
+
+ if ((entryPtr->state == STATE_DISABLED)
+ && (selIndex != SELECTION_PRESENT)) {
+ goto done;
+ }
+
+ switch (selIndex) {
+ case SELECTION_ADJUST:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &entryPtr->insertPos) != TCL_OK) {
- goto error;
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ goto error;
}
- EventuallyRedraw(entryPtr);
+ if (entryPtr->selectFirst >= 0) {
+ int half1, half2;
+
+ half1 = (entryPtr->selectFirst + entryPtr->selectLast)/2;
+ half2 = (entryPtr->selectFirst + entryPtr->selectLast + 1)/2;
+ if (index < half1) {
+ entryPtr->selectAnchor = entryPtr->selectLast;
+ } else if (index > half2) {
+ entryPtr->selectAnchor = entryPtr->selectFirst;
+ } else {
+ /*
+ * We're at about the halfway point in the selection; just
+ * keep the existing anchor.
+ */
+ }
+ }
+ EntrySelectTo(entryPtr, index);
break;
- }
-
- case COMMAND_INDEX: {
- int index;
+ case SELECTION_CLEAR:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "string");
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
+ if (entryPtr->selectFirst >= 0) {
+ entryPtr->selectFirst = -1;
+ entryPtr->selectLast = -1;
+ EventuallyRedraw(entryPtr);
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
- break;
- }
-
- case COMMAND_INSERT: {
- int index;
+ goto done;
+ case SELECTION_FROM:
if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "index text");
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
- }
- if (entryPtr->state == STATE_NORMAL) {
- InsertChars(entryPtr, index, Tcl_GetString(objv[3]));
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ goto error;
}
+ entryPtr->selectAnchor = index;
break;
- }
- case COMMAND_SCAN: {
- int x;
- char *minorCmd;
+ case SELECTION_PRESENT:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ goto error;
+ }
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj((entryPtr->selectFirst >= 0)));
+ goto done;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x");
+ case SELECTION_RANGE:
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "start end");
goto error;
}
- if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
- goto error;
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
+ &index) != TCL_OK) {
+ goto error;
}
-
- minorCmd = Tcl_GetString(objv[2]);
- if (minorCmd[0] == 'm'
- && (strncmp(minorCmd, "mark", strlen(minorCmd)) == 0)) {
- entryPtr->scanMarkX = x;
- entryPtr->scanMarkIndex = entryPtr->leftIndex;
- } else if ((minorCmd[0] == 'd')
- && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) {
- EntryScanTo(entryPtr, x);
- } else {
- Tcl_AppendResult(interp, "bad scan option \"",
- Tcl_GetString(objv[2]), "\": must be mark or dragto",
- (char *) NULL);
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[4]),
+ &index2) != TCL_OK) {
goto error;
}
+ if (index >= index2) {
+ entryPtr->selectFirst = -1;
+ entryPtr->selectLast = -1;
+ } else {
+ entryPtr->selectFirst = index;
+ entryPtr->selectLast = index2;
+ }
+ if (!(entryPtr->flags & GOT_SELECTION)
+ && (entryPtr->exportSelection)) {
+ Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
+ EntryLostSelection, (ClientData) entryPtr);
+ entryPtr->flags |= GOT_SELECTION;
+ }
+ EventuallyRedraw(entryPtr);
break;
- }
-
- case COMMAND_SELECTION: {
- int index, index2;
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
+ case SELECTION_TO:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
goto error;
}
-
- /*
- * Parse the selection sub-command, using the command
- * table "selCmdNames" defined above.
- */
-
- result = Tcl_GetIndexFromObj(interp, objv[2], selCmdNames,
- "selection option", 0, &selIndex);
- if (result != TCL_OK) {
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[3]), &index) != TCL_OK) {
goto error;
}
+ EntrySelectTo(entryPtr, index);
+ break;
+ }
+ break;
+ }
- /*
- * Disabled entries don't allow the selection to be modified,
- * but 'selection present' must return a boolean.
- */
-
- if ((entryPtr->state == STATE_DISABLED)
- && (selIndex != SELECTION_PRESENT)) {
- goto done;
- }
-
- switch (selIndex) {
- case SELECTION_ADJUST: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- if (entryPtr->selectFirst >= 0) {
- int half1, half2;
-
- half1 = (entryPtr->selectFirst
- + entryPtr->selectLast)/2;
- half2 = (entryPtr->selectFirst
- + entryPtr->selectLast + 1)/2;
- if (index < half1) {
- entryPtr->selectAnchor = entryPtr->selectLast;
- } else if (index > half2) {
- entryPtr->selectAnchor = entryPtr->selectFirst;
- } else {
- /*
- * We're at about the halfway point in the
- * selection; just keep the existing anchor.
- */
- }
- }
- EntrySelectTo(entryPtr, index);
- break;
- }
-
- case SELECTION_CLEAR: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
- goto error;
- }
- if (entryPtr->selectFirst >= 0) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
- EventuallyRedraw(entryPtr);
- }
- goto done;
- }
-
- case SELECTION_FROM: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- entryPtr->selectAnchor = index;
- break;
- }
-
- case SELECTION_PRESENT: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
- goto error;
- }
- Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj((entryPtr->selectFirst >= 0)));
- goto done;
- }
+ case COMMAND_VALIDATE: {
+ int code;
- case SELECTION_RANGE: {
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "start end");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[4]),& index2) != TCL_OK) {
- goto error;
- }
- if (index >= index2) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
- } else {
- entryPtr->selectFirst = index;
- entryPtr->selectLast = index2;
- }
- if (!(entryPtr->flags & GOT_SELECTION)
- && (entryPtr->exportSelection)) {
- Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
- EntryLostSelection, (ClientData) entryPtr);
- entryPtr->flags |= GOT_SELECTION;
- }
- EventuallyRedraw(entryPtr);
- break;
- }
-
- case SELECTION_TO: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- EntrySelectTo(entryPtr, index);
- break;
- }
- }
- break;
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ goto error;
+ }
+ selIndex = entryPtr->validate;
+ entryPtr->validate = VALIDATE_ALL;
+ code = EntryValidateChange(entryPtr, NULL, entryPtr->string,
+ -1, VALIDATE_FORCED);
+ if (entryPtr->validate != VALIDATE_NONE) {
+ entryPtr->validate = selIndex;
}
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj((code == TCL_OK)));
+ break;
+ }
- case COMMAND_VALIDATE: {
- int code;
+ case COMMAND_XVIEW: {
+ int index;
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ if (objc == 2) {
+ double first, last;
+ char buf[TCL_DOUBLE_SPACE];
+
+ EntryVisibleRange(entryPtr, &first, &last);
+ Tcl_PrintDouble(NULL, first, buf);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_PrintDouble(NULL, last, buf);
+ Tcl_AppendResult(interp, " ", buf, NULL);
+ goto done;
+ } else if (objc == 3) {
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
goto error;
}
- selIndex = entryPtr->validate;
- entryPtr->validate = VALIDATE_ALL;
- code = EntryValidateChange(entryPtr, (char *) NULL,
- entryPtr->string, -1, VALIDATE_FORCED);
- if (entryPtr->validate != VALIDATE_NONE) {
- entryPtr->validate = selIndex;
- }
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj((code == TCL_OK)));
- break;
- }
+ } else {
+ double fraction;
+ int count;
- case COMMAND_XVIEW: {
- int index;
-
- if (objc == 2) {
- double first, last;
- char buf[TCL_DOUBLE_SPACE * 2];
-
- EntryVisibleRange(entryPtr, &first, &last);
- sprintf(buf, "%g %g", first, last);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- goto done;
- } else if (objc == 3) {
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
- }
- } else {
- double fraction;
- int count;
-
- index = entryPtr->leftIndex;
- switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction,
- &count)) {
- case TK_SCROLL_ERROR: {
- goto error;
- }
- case TK_SCROLL_MOVETO: {
- index = (int) ((fraction * entryPtr->numChars) + 0.5);
- break;
- }
- case TK_SCROLL_PAGES: {
- int charsPerPage;
-
- charsPerPage = ((Tk_Width(entryPtr->tkwin)
- - 2 * entryPtr->inset)
- / entryPtr->avgWidth) - 2;
- if (charsPerPage < 1) {
- charsPerPage = 1;
- }
- index += count * charsPerPage;
- break;
- }
- case TK_SCROLL_UNITS: {
- index += count;
- break;
- }
+ index = entryPtr->leftIndex;
+ switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction,
+ &count)) {
+ case TK_SCROLL_ERROR:
+ goto error;
+ case TK_SCROLL_MOVETO:
+ index = (int) ((fraction * entryPtr->numChars) + 0.5);
+ break;
+ case TK_SCROLL_PAGES: {
+ int charsPerPage;
+
+ charsPerPage = ((Tk_Width(entryPtr->tkwin)
+ - 2 * entryPtr->inset) / entryPtr->avgWidth) - 2;
+ if (charsPerPage < 1) {
+ charsPerPage = 1;
}
+ index += count * charsPerPage;
+ break;
}
- if (index >= entryPtr->numChars) {
- index = entryPtr->numChars - 1;
- }
- if (index < 0) {
- index = 0;
+ case TK_SCROLL_UNITS:
+ index += count;
+ break;
}
- entryPtr->leftIndex = index;
- entryPtr->flags |= UPDATE_SCROLLBAR;
- EntryComputeGeometry(entryPtr);
- EventuallyRedraw(entryPtr);
- break;
}
+ if (index >= entryPtr->numChars) {
+ index = entryPtr->numChars - 1;
+ }
+ if (index < 0) {
+ index = 0;
+ }
+ entryPtr->leftIndex = index;
+ entryPtr->flags |= UPDATE_SCROLLBAR;
+ EntryComputeGeometry(entryPtr);
+ EventuallyRedraw(entryPtr);
+ break;
+ }
}
- done:
+ done:
Tcl_Release((ClientData) entryPtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) entryPtr);
return TCL_ERROR;
}
@@ -1046,9 +993,9 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
*
* DestroyEntry --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of an entry at a safe time
- * (when no-one is using it anymore).
+ * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
+ * up the internal structure of an entry at a safe time (when no-one is
+ * using it anymore).
*
* Results:
* None.
@@ -1060,15 +1007,14 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
*/
static void
-DestroyEntry(memPtr)
- char *memPtr; /* Info about entry widget. */
+DestroyEntry(
+ char *memPtr) /* Info about entry widget. */
{
Entry *entryPtr = (Entry *) memPtr;
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeOptions handle all the standard option-related stuff.
*/
ckfree((char *)entryPtr->string);
@@ -1113,43 +1059,43 @@ DestroyEntry(memPtr)
*
* ConfigureEntry --
*
- * This procedure is called to process an argv/argc list, plus
- * the Tk option database, in order to configure (or reconfigure)
- * an entry widget.
+ * This function is called to process an argv/argc list, plus the Tk
+ * option database, in order to configure (or reconfigure) an entry
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for entryPtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for entryPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureEntry(interp, entryPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Entry *entryPtr; /* Information about widget; may or may not
+ConfigureEntry(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Entry *entryPtr, /* Information about widget; may or may not
* already have values for some fields. */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
Tk_SavedOptions savedOptions;
Tk_3DBorder border;
Tcl_Obj *errorResult = NULL;
- Spinbox *sbPtr = (Spinbox *) entryPtr; /* Only used when this widget
- * is of type TK_SPINBOX */
- char *oldValues = NULL; /* lint initialization */
- char *oldFormat = NULL; /* lint initialization */
+ Spinbox *sbPtr = (Spinbox *) entryPtr;
+ /* Only used when this widget is of type
+ * TK_SPINBOX */
+ char *oldValues = NULL; /* lint initialization */
+ char *oldFormat = NULL; /* lint initialization */
int error;
- int oldExport = 0; /* lint initialization */
- int valuesChanged = 0; /* lint initialization */
- double oldFrom = 0.0; /* lint initialization */
- double oldTo = 0.0; /* lint initialization */
+ int oldExport = 0; /* lint initialization */
+ int valuesChanged = 0; /* lint initialization */
+ double oldFrom = 0.0; /* lint initialization */
+ double oldTo = 0.0; /* lint initialization */
/*
* Eliminate any existing trace on a variable monitored by the entry.
@@ -1157,16 +1103,17 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
if ((entryPtr->textVarName != NULL)
&& (entryPtr->flags & ENTRY_VAR_TRACED)) {
- Tcl_UntraceVar(interp, entryPtr->textVarName,
+ Tcl_UntraceVar(interp, entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
EntryTextVarProc, (ClientData) entryPtr);
entryPtr->flags &= ~ENTRY_VAR_TRACED;
}
/*
- * Store old values that we need to effect certain behavior if
- * they change value
+ * Store old values that we need to effect certain behavior if they change
+ * value.
*/
+
oldExport = entryPtr->exportSelection;
if (entryPtr->type == TK_SPINBOX) {
oldValues = sbPtr->valueStr;
@@ -1183,7 +1130,7 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
if (Tk_SetOptions(interp, (char *) entryPtr,
entryPtr->optionTable, objc, objv,
- entryPtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) {
+ entryPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
}
} else {
@@ -1233,6 +1180,7 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
* calculate the minimum space we'll need for the values as
* strings.
*/
+
int min, max;
size_t formatLen, formatSpace = TCL_DOUBLE_SPACE;
char fbuf[4], *fmt = sbPtr->reqFormat;
@@ -1241,7 +1189,7 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
if ((fmt[0] != '%') || (fmt[formatLen-1] != 'f')) {
badFormatOpt:
Tcl_AppendResult(interp, "bad spinbox format specifier \"",
- sbPtr->reqFormat, "\"", (char *) NULL);
+ sbPtr->reqFormat, "\"", NULL);
continue;
}
if ((sscanf(fmt, "%%%d.%d%[f]", &min, &max, fbuf) == 3)
@@ -1259,16 +1207,19 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
formatSpace = TCL_DOUBLE_SPACE;
}
sbPtr->formatBuf = ckrealloc(sbPtr->formatBuf, formatSpace);
+
/*
- * We perturb the value of oldFrom to allow us to go into
- * the branch below that will reformat the displayed value.
+ * We perturb the value of oldFrom to allow us to go into the
+ * branch below that will reformat the displayed value.
*/
+
oldFrom = sbPtr->fromValue - 1;
}
/*
- * See if we have to rearrange our listObj data
+ * See if we have to rearrange our listObj data.
*/
+
if (oldValues != sbPtr->valueStr) {
if (sbPtr->listObj != NULL) {
Tcl_DecrRefCount(sbPtr->listObj);
@@ -1294,13 +1245,14 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
}
/*
- * Restart the cursor timing sequence in case the on-time or
- * off-time just changed. Set validate temporarily to none,
- * so the configure doesn't cause it to be triggered.
+ * Restart the cursor timing sequence in case the on-time or off-time
+ * just changed. Set validate temporarily to none, so the configure
+ * doesn't cause it to be triggered.
*/
if (entryPtr->flags & GOT_FOCUS) {
int validate = entryPtr->validate;
+
entryPtr->validate = VALIDATE_NONE;
EntryFocusProc(entryPtr, 1);
entryPtr->validate = validate;
@@ -1311,8 +1263,8 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
*/
if (entryPtr->exportSelection && (!oldExport)
- && (entryPtr->selectFirst != -1)
- && !(entryPtr->flags & GOT_SELECTION)) {
+ && (entryPtr->selectFirst != -1)
+ && !(entryPtr->flags & GOT_SELECTION)) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection,
(ClientData) entryPtr);
entryPtr->flags |= GOT_SELECTION;
@@ -1324,12 +1276,12 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
*/
Tk_SetInternalBorder(entryPtr->tkwin,
- entryPtr->borderWidth + entryPtr->highlightWidth);
+ entryPtr->borderWidth + entryPtr->highlightWidth);
if (entryPtr->highlightWidth <= 0) {
entryPtr->highlightWidth = 0;
}
- entryPtr->inset = entryPtr->highlightWidth
- + entryPtr->borderWidth + XPAD;
+ entryPtr->inset = entryPtr->highlightWidth
+ + entryPtr->borderWidth + XPAD;
break;
}
if (!error) {
@@ -1359,9 +1311,10 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
Tcl_Obj *objPtr;
/*
- * No check for error return, because there shouldn't be one
- * given the check for valid list above
+ * No check for error return, because there shouldn't be one given
+ * the check for valid list above.
*/
+
Tcl_ListObjIndex(interp, sbPtr->listObj, 0, &objPtr);
EntryValueChanged(entryPtr, Tcl_GetString(objPtr));
} else if ((sbPtr->valueStr == NULL)
@@ -1370,15 +1323,15 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
|| !DOUBLES_EQ(sbPtr->toValue, oldTo))) {
/*
* If the valueStr is empty and -from && -to are specified, check
- * to see if the current string is within the range. If not,
- * it will be constrained to the nearest edge. If the current
- * string isn't a double value, we set it to -from.
+ * to see if the current string is within the range. If not, it
+ * will be constrained to the nearest edge. If the current string
+ * isn't a double value, we set it to -from.
*/
- int code;
+
double dvalue;
- code = Tcl_GetDouble(NULL, entryPtr->string, &dvalue);
- if (code != TCL_OK) {
+ if (sscanf(entryPtr->string, "%lf", &dvalue) == 0) {
+ /* Scan failure */
dvalue = sbPtr->fromValue;
} else {
if (dvalue > sbPtr->toValue) {
@@ -1393,8 +1346,8 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
}
/*
- * Set up a trace on the variable's value after we've possibly
- * constrained the value according to new -from/-to values.
+ * Set up a trace on the variable's value after we've possibly constrained
+ * the value according to new -from/-to values.
*/
if ((entryPtr->textVarName != NULL)
@@ -1407,11 +1360,11 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
EntryWorldChanged((ClientData) entryPtr);
if (error) {
- Tcl_SetObjResult(interp, errorResult);
+ Tcl_SetObjResult(interp, errorResult);
Tcl_DecrRefCount(errorResult);
return TCL_ERROR;
} else {
- return TCL_OK;
+ return TCL_OK;
}
}
@@ -1420,22 +1373,22 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
*
* EntryWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Entry will be relayed out and redisplayed.
+ * Entry will be relayed out and redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
static void
-EntryWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+EntryWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC gc = None;
@@ -1461,27 +1414,27 @@ EntryWorldChanged(instanceData)
}
/*
- * Default background and foreground are from the normal state.
- * In a disabled state, both of those may be overridden; in the readonly
- * state, the background may be overridden.
+ * Default background and foreground are from the normal state. In a
+ * disabled state, both of those may be overridden; in the readonly state,
+ * the background may be overridden.
*/
border = entryPtr->normalBorder;
colorPtr = entryPtr->fgColorPtr;
switch (entryPtr->state) {
- case STATE_DISABLED:
- if (entryPtr->disabledBorder != NULL) {
- border = entryPtr->disabledBorder;
- }
- if (entryPtr->dfgColorPtr != NULL) {
- colorPtr = entryPtr->dfgColorPtr;
- }
- break;
- case STATE_READONLY:
- if (entryPtr->readonlyBorder != NULL) {
- border = entryPtr->readonlyBorder;
- }
- break;
+ case STATE_DISABLED:
+ if (entryPtr->disabledBorder != NULL) {
+ border = entryPtr->disabledBorder;
+ }
+ if (entryPtr->dfgColorPtr != NULL) {
+ colorPtr = entryPtr->dfgColorPtr;
+ }
+ break;
+ case STATE_READONLY:
+ if (entryPtr->readonlyBorder != NULL) {
+ border = entryPtr->readonlyBorder;
+ }
+ break;
}
Tk_SetBackgroundFromBorder(entryPtr->tkwin, border);
@@ -1507,8 +1460,7 @@ EntryWorldChanged(instanceData)
entryPtr->selTextGC = gc;
/*
- * Recompute the window's geometry and arrange for it to be
- * redisplayed.
+ * Recompute the window's geometry and arrange for it to be redisplayed.
*/
EntryComputeGeometry(entryPtr);
@@ -1516,18 +1468,17 @@ EntryWorldChanged(instanceData)
EventuallyRedraw(entryPtr);
}
-#ifndef MAC_OSX_TK
+#ifndef MAC_OSX_TK
/*
*--------------------------------------------------------------
*
* TkpDrawEntryBorderAndFocus --
*
- * This procedure redraws the border of an entry widget.
- * It overrides the generic border drawing code if the
- * entry widget parameters are such that the native widget
- * drawing is a good fit.
- * This version just returns o, so platforms that don't
- * do special native drawing don't have to implement it.
+ * This function redraws the border of an entry widget. It overrides the
+ * generic border drawing code if the entry widget parameters are such
+ * that the native widget drawing is a good fit. This version just
+ * returns 0, so platforms that don't do special native drawing don't
+ * have to implement it.
*
* Results:
* 1 if it has drawn the border, 0 if not.
@@ -1539,26 +1490,24 @@ EntryWorldChanged(instanceData)
*/
int
-TkpDrawEntryBorderAndFocus(entryPtr, pixmap, isSpinbox)
- Entry *entryPtr;
- Drawable pixmap;
- int isSpinbox;
+TkpDrawEntryBorderAndFocus(
+ Entry *entryPtr,
+ Drawable pixmap,
+ int isSpinbox)
{
return 0;
}
-
-
+
/*
*--------------------------------------------------------------
*
* TkpDrawSpinboxButtons --
*
- * This procedure redraws the buttons of an spinbox widget.
- * It overrides the generic button drawing code if the
- * spinbox widget parameters are such that the native widget
- * drawing is a good fit.
- * This version just returns 0, so platforms that don't
- * do special native drawing don't have to implement it.
+ * This function redraws the buttons of an spinbox widget. It overrides
+ * the generic button drawing code if the spinbox widget parameters are
+ * such that the native widget drawing is a good fit. This version just
+ * returns 0, so platforms that don't do special native drawing don't
+ * have to implement it.
*
* Results:
* 1 if it has drawn the border, 0 if not.
@@ -1570,20 +1519,20 @@ TkpDrawEntryBorderAndFocus(entryPtr, pixmap, isSpinbox)
*/
int
-TkpDrawSpinboxButtons(sbPtr, pixmap)
- Spinbox *sbPtr;
- Pixmap pixmap;
+TkpDrawSpinboxButtons(
+ Spinbox *sbPtr,
+ Pixmap pixmap)
{
return 0;
}
#endif /* Not MAC_OSX_TK */
-
+
/*
*--------------------------------------------------------------
*
* DisplayEntry --
*
- * This procedure redraws the contents of an entry window.
+ * This function redraws the contents of an entry window.
*
* Results:
* None.
@@ -1595,8 +1544,8 @@ TkpDrawSpinboxButtons(sbPtr, pixmap)
*/
static void
-DisplayEntry(clientData)
- ClientData clientData; /* Information about window. */
+DisplayEntry(
+ ClientData clientData) /* Information about window. */
{
Entry *entryPtr = (Entry *) clientData;
Tk_Window tkwin = entryPtr->tkwin;
@@ -1620,9 +1569,9 @@ DisplayEntry(clientData)
if (entryPtr->flags & UPDATE_SCROLLBAR) {
entryPtr->flags &= ~UPDATE_SCROLLBAR;
- /*
- * Preserve/Release because updating the scrollbar can have
- * the side-effect of destroying or unmapping the entry widget.
+ /*
+ * Preserve/Release because updating the scrollbar can have the
+ * side-effect of destroying or unmapping the entry widget.
*/
Tcl_Preserve((ClientData) entryPtr);
@@ -1637,10 +1586,10 @@ DisplayEntry(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * In order to avoid screen flashes, this procedure redraws the
- * textual area of the entry into off-screen memory, then copies
- * it back on-screen in a single operation. This means there's
- * no point in time where the on-screen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the textual
+ * area of the entry into off-screen memory, then copies it back on-screen
+ * in a single operation. This means there's no point in time where the
+ * on-screen image has been cleared.
*/
pixmap = Tk_GetPixmap(entryPtr->display, Tk_WindowId(tkwin),
@@ -1650,18 +1599,17 @@ DisplayEntry(clientData)
#endif /* TK_NO_DOUBLE_BUFFERING */
/*
- * Compute x-coordinate of the pixel just after last visible
- * one, plus vertical position of baseline of text.
+ * Compute x-coordinate of the pixel just after last visible one, plus
+ * vertical position of baseline of text.
*/
xBound = Tk_Width(tkwin) - entryPtr->inset - entryPtr->xWidth;
baseY = (Tk_Height(tkwin) + fm.ascent - fm.descent) / 2;
/*
- * On Windows and Mac, we need to hide the selection whenever we
- * don't have the focus.
+ * Hide the selection whenever we don't have the focus, unless we
+ * always want to show selection.
*/
-
if (TkpAlwaysShowSelection(entryPtr->tkwin)) {
showSelection = 1;
} else {
@@ -1669,9 +1617,9 @@ DisplayEntry(clientData)
}
/*
- * Draw the background in three layers. From bottom to top the
- * layers are: normal background, selection background, and
- * insertion cursor background.
+ * Draw the background in three layers. From bottom to top the layers are:
+ * normal background, selection background, and insertion cursor
+ * background.
*/
if ((entryPtr->state == STATE_DISABLED) &&
@@ -1711,16 +1659,16 @@ DisplayEntry(clientData)
MAC_OSX_ENTRY_SELECT_RELIEF
#endif
);
- }
+ }
}
/*
- * Draw a special background for the insertion cursor, overriding
- * even the selection background. As a special hack to keep the
- * cursor visible when the insertion cursor color is the same as
- * the color for selected text (e.g., on mono displays), write
- * background in the cursor area (instead of nothing) when the
- * cursor isn't on. Otherwise the selection would hide the cursor.
+ * Draw a special background for the insertion cursor, overriding even the
+ * selection background. As a special hack to keep the cursor visible when
+ * the insertion cursor color is the same as the color for selected text
+ * (e.g., on mono displays), write background in the cursor area (instead
+ * of nothing) when the cursor isn't on. Otherwise the selection would
+ * hide the cursor.
*/
if ((entryPtr->state == STATE_NORMAL) && (entryPtr->flags & GOT_FOCUS)) {
@@ -1730,25 +1678,22 @@ DisplayEntry(clientData)
cursorX -= (entryPtr->insertWidth)/2;
Tk_SetCaretPos(entryPtr->tkwin, cursorX, baseY - fm.ascent,
fm.ascent + fm.descent);
- if (entryPtr->insertPos >= entryPtr->leftIndex) {
- if (cursorX < xBound) {
- if (entryPtr->flags & CURSOR_ON) {
- Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder,
- cursorX, baseY - fm.ascent, entryPtr->insertWidth,
- fm.ascent + fm.descent,
- entryPtr->insertBorderWidth,
- TK_RELIEF_RAISED);
- } else if (entryPtr->insertBorder == entryPtr->selBorder) {
- Tk_Fill3DRectangle(tkwin, pixmap, border,
- cursorX, baseY - fm.ascent, entryPtr->insertWidth,
- fm.ascent + fm.descent, 0, TK_RELIEF_FLAT);
- }
+ if (entryPtr->insertPos >= entryPtr->leftIndex && cursorX < xBound) {
+ if (entryPtr->flags & CURSOR_ON) {
+ Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder,
+ cursorX, baseY - fm.ascent, entryPtr->insertWidth,
+ fm.ascent + fm.descent, entryPtr->insertBorderWidth,
+ TK_RELIEF_RAISED);
+ } else if (entryPtr->insertBorder == entryPtr->selBorder) {
+ Tk_Fill3DRectangle(tkwin, pixmap, border, cursorX,
+ baseY - fm.ascent, entryPtr->insertWidth,
+ fm.ascent + fm.descent, 0, TK_RELIEF_FLAT);
}
}
}
/*
- * Draw the text in two pieces: first the unselected portion, then the
+ * Draw the text in two pieces: first the unselected portion, then the
* selected portion on top of it.
*/
@@ -1778,17 +1723,18 @@ DisplayEntry(clientData)
/*
* Draw the spin button controls.
*/
- if (TkpDrawSpinboxButtons(sbPtr, pixmap) == 0) {
- xWidth = entryPtr->xWidth;
- pad = XPAD + 1;
- inset = entryPtr->inset - XPAD;
- startx = Tk_Width(tkwin) - (xWidth + inset);
- height = (Tk_Height(tkwin) - 2*inset)/2;
+
+ if (TkpDrawSpinboxButtons(sbPtr, pixmap) == 0) {
+ xWidth = entryPtr->xWidth;
+ pad = XPAD + 1;
+ inset = entryPtr->inset - XPAD;
+ startx = Tk_Width(tkwin) - (xWidth + inset);
+ height = (Tk_Height(tkwin) - 2*inset)/2;
#if 0
- Tk_Fill3DRectangle(tkwin, pixmap, sbPtr->buttonBorder,
- startx, inset, xWidth, height, 1, sbPtr->buRelief);
- Tk_Fill3DRectangle(tkwin, pixmap, sbPtr->buttonBorder,
- startx, inset+height, xWidth, height, 1, sbPtr->bdRelief);
+ Tk_Fill3DRectangle(tkwin, pixmap, sbPtr->buttonBorder,
+ startx, inset, xWidth, height, 1, sbPtr->buRelief);
+ Tk_Fill3DRectangle(tkwin, pixmap, sbPtr->buttonBorder,
+ startx, inset+height, xWidth, height, 1, sbPtr->bdRelief);
#else
Tk_Fill3DRectangle(tkwin, pixmap, sbPtr->buttonBorder,
startx, inset, xWidth, height, 1,
@@ -1799,90 +1745,97 @@ DisplayEntry(clientData)
(sbPtr->selElement == SEL_BUTTONDOWN) ?
TK_RELIEF_SUNKEN : TK_RELIEF_RAISED);
#endif
-
- xWidth -= 2*pad;
- /*
- * Only draw the triangles if we have enough display space
- */
- if ((xWidth > 1)) {
- XPoint points[3];
- int starty, space, offset;
-
- space = height - 2*pad;
- /*
- * Ensure width of triangle is odd to guarantee a sharp tip
- */
- if (!(xWidth % 2)) {
- xWidth++;
- }
- tHeight = (xWidth + 1) / 2;
- if (tHeight > space) {
- tHeight = space;
- }
- space = (space - tHeight) / 2;
- startx += pad;
- starty = inset + height - pad - space;
- offset = (sbPtr->selElement == SEL_BUTTONUP);
- /*
- * The points are slightly different for the up and down arrows
- * because (for *.x), we need to account for a bug in the way
- * XFillPolygon draws triangles, and we want to shift
- * the arrows differently when allowing for depressed behavior.
- */
- points[0].x = startx + offset;
- points[0].y = starty + (offset ? 0 : -1);
- points[1].x = startx + xWidth/2 + offset;
- points[1].y = starty - tHeight + (offset ? 0 : -1);
- points[2].x = startx + xWidth + offset;
- points[2].y = points[0].y;
- XFillPolygon(entryPtr->display, pixmap, entryPtr->textGC,
- points, 3, Convex, CoordModeOrigin);
-
- starty = inset + height + pad + space;
- offset = (sbPtr->selElement == SEL_BUTTONDOWN);
- points[0].x = startx + 1 + offset;
- points[0].y = starty + (offset ? 1 : 0);
- points[1].x = startx + xWidth/2 + offset;
- points[1].y = starty + tHeight + (offset ? 0 : -1);
- points[2].x = startx - 1 + xWidth + offset;
- points[2].y = points[0].y;
- XFillPolygon(entryPtr->display, pixmap, entryPtr->textGC,
- points, 3, Convex, CoordModeOrigin);
- }
- }
+
+ xWidth -= 2*pad;
+
+ /*
+ * Only draw the triangles if we have enough display space
+ */
+
+ if ((xWidth > 1)) {
+ XPoint points[3];
+ int starty, space, offset;
+
+ space = height - 2*pad;
+
+ /*
+ * Ensure width of triangle is odd to guarantee a sharp tip
+ */
+
+ if (!(xWidth % 2)) {
+ xWidth++;
+ }
+ tHeight = (xWidth + 1) / 2;
+ if (tHeight > space) {
+ tHeight = space;
+ }
+ space = (space - tHeight) / 2;
+ startx += pad;
+ starty = inset + height - pad - space;
+ offset = (sbPtr->selElement == SEL_BUTTONUP);
+
+ /*
+ * The points are slightly different for the up and down
+ * arrows because (for *.x), we need to account for a bug in
+ * the way XFillPolygon draws triangles, and we want to shift
+ * the arrows differently when allowing for depressed
+ * behavior.
+ */
+
+ points[0].x = startx + offset;
+ points[0].y = starty + (offset ? 0 : -1);
+ points[1].x = startx + xWidth/2 + offset;
+ points[1].y = starty - tHeight + (offset ? 0 : -1);
+ points[2].x = startx + xWidth + offset;
+ points[2].y = points[0].y;
+ XFillPolygon(entryPtr->display, pixmap, entryPtr->textGC,
+ points, 3, Convex, CoordModeOrigin);
+
+ starty = inset + height + pad + space;
+ offset = (sbPtr->selElement == SEL_BUTTONDOWN);
+ points[0].x = startx + 1 + offset;
+ points[0].y = starty + (offset ? 1 : 0);
+ points[1].x = startx + xWidth/2 + offset;
+ points[1].y = starty + tHeight + (offset ? 0 : -1);
+ points[2].x = startx - 1 + xWidth + offset;
+ points[2].y = points[0].y;
+ XFillPolygon(entryPtr->display, pixmap, entryPtr->textGC,
+ points, 3, Convex, CoordModeOrigin);
+ }
+ }
}
/*
- * Draw the border and focus highlight last, so they will overwrite
- * any text that extends past the viewable part of the window.
+ * Draw the border and focus highlight last, so they will overwrite any
+ * text that extends past the viewable part of the window.
*/
- if (!TkpDrawEntryBorderAndFocus(entryPtr, pixmap,
- (entryPtr->type == TK_SPINBOX))) {
- xBound = entryPtr->highlightWidth;
- if (entryPtr->relief != TK_RELIEF_FLAT) {
+ if (!TkpDrawEntryBorderAndFocus(entryPtr, pixmap,
+ (entryPtr->type == TK_SPINBOX))) {
+ xBound = entryPtr->highlightWidth;
+ if (entryPtr->relief != TK_RELIEF_FLAT) {
Tk_Draw3DRectangle(tkwin, pixmap, border, xBound, xBound,
- Tk_Width(tkwin) - 2 * xBound,
+ Tk_Width(tkwin) - 2 * xBound,
Tk_Height(tkwin) - 2 * xBound,
entryPtr->borderWidth, entryPtr->relief);
- }
- if (xBound > 0) {
+ }
+ if (xBound > 0) {
GC fgGC, bgGC;
bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, pixmap);
if (entryPtr->flags & GOT_FOCUS) {
- fgGC = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap);
- TkpDrawHighlightBorder(tkwin, fgGC, bgGC, xBound, pixmap);
+ fgGC = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap);
+ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, xBound, pixmap);
} else {
- TkpDrawHighlightBorder(tkwin, bgGC, bgGC, xBound, pixmap);
+ TkpDrawHighlightBorder(tkwin, bgGC, bgGC, xBound, pixmap);
}
- }
+ }
}
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Everything's been redisplayed; now copy the pixmap onto the screen
- * and free up the pixmap.
+ * Everything's been redisplayed; now copy the pixmap onto the screen and
+ * free up the pixmap.
*/
XCopyArea(entryPtr->display, pixmap, Tk_WindowId(tkwin), entryPtr->textGC,
@@ -1898,24 +1851,24 @@ DisplayEntry(clientData)
*
* EntryComputeGeometry --
*
- * This procedure is invoked to recompute information about where
- * in its window an entry's string will be displayed. It also
- * computes the requested size for the window.
+ * This function is invoked to recompute information about where in its
+ * window an entry's string will be displayed. It also computes the
+ * requested size for the window.
*
* Results:
* None.
*
* Side effects:
- * The leftX and tabOrigin fields are recomputed for entryPtr,
- * and leftIndex may be adjusted. Tk_GeometryRequest is called
- * to register the desired dimensions for the window.
+ * The leftX and tabOrigin fields are recomputed for entryPtr, and
+ * leftIndex may be adjusted. Tk_GeometryRequest is called to register
+ * the desired dimensions for the window.
*
*----------------------------------------------------------------------
*/
static void
-EntryComputeGeometry(entryPtr)
- Entry *entryPtr; /* Widget record for entry. */
+EntryComputeGeometry(
+ Entry *entryPtr) /* Widget record for entry. */
{
int totalLength, overflow, maxOffScreen, rightX;
int height, width, i;
@@ -1929,8 +1882,8 @@ EntryComputeGeometry(entryPtr)
}
/*
- * If we're displaying a special character instead of the value of
- * the entry, recompute the displayString.
+ * If we're displaying a special character instead of the value of the
+ * entry, recompute the displayString.
*/
if (entryPtr->showChar != NULL) {
@@ -1939,10 +1892,10 @@ EntryComputeGeometry(entryPtr)
int size;
/*
- * Normalize the special character so we can safely duplicate it
- * in the display string. If we didn't do this, then two malformed
- * characters might end up looking like one valid UTF character in
- * the resulting string.
+ * Normalize the special character so we can safely duplicate it in
+ * the display string. If we didn't do this, then two malformed
+ * characters might end up looking like one valid UTF character in the
+ * resulting string.
*/
Tcl_UtfToUniChar(entryPtr->showChar, &ch);
@@ -1966,21 +1919,21 @@ EntryComputeGeometry(entryPtr)
entryPtr->layoutY = (Tk_Height(entryPtr->tkwin) - height) / 2;
/*
- * Recompute where the leftmost character on the display will
- * be drawn (entryPtr->leftX) and adjust leftIndex if necessary
- * so that we don't let characters hang off the edge of the
- * window unless the entire window is full.
+ * Recompute where the leftmost character on the display will be drawn
+ * (entryPtr->leftX) and adjust leftIndex if necessary so that we don't
+ * let characters hang off the edge of the window unless the entire window
+ * is full.
*/
overflow = totalLength -
- (Tk_Width(entryPtr->tkwin) - 2*entryPtr->inset - entryPtr->xWidth);
+ (Tk_Width(entryPtr->tkwin) - 2*entryPtr->inset - entryPtr->xWidth);
if (overflow <= 0) {
entryPtr->leftIndex = 0;
if (entryPtr->justify == TK_JUSTIFY_LEFT) {
entryPtr->leftX = entryPtr->inset;
} else if (entryPtr->justify == TK_JUSTIFY_RIGHT) {
entryPtr->leftX = Tk_Width(entryPtr->tkwin) - entryPtr->inset
- - entryPtr->xWidth - totalLength;
+ - entryPtr->xWidth - totalLength;
} else {
entryPtr->leftX = (Tk_Width(entryPtr->tkwin)
- entryPtr->xWidth - totalLength)/2;
@@ -1988,10 +1941,10 @@ EntryComputeGeometry(entryPtr)
entryPtr->layoutX = entryPtr->leftX;
} else {
/*
- * The whole string can't fit in the window. Compute the
- * maximum number of characters that may be off-screen to
- * the left without leaving empty space on the right of the
- * window, then don't let leftIndex be any greater than that.
+ * The whole string can't fit in the window. Compute the maximum
+ * number of characters that may be off-screen to the left without
+ * leaving empty space on the right of the window, then don't let
+ * leftIndex be any greater than that.
*/
maxOffScreen = Tk_PointToChar(entryPtr->textLayout, overflow, 0);
@@ -2040,23 +1993,25 @@ EntryComputeGeometry(entryPtr)
* None.
*
* Side effects:
- * New information gets added to entryPtr; it will be redisplayed
- * soon, but not necessarily immediately.
+ * New information gets added to entryPtr; it will be redisplayed soon,
+ * but not necessarily immediately.
*
*----------------------------------------------------------------------
*/
static void
-InsertChars(entryPtr, index, value)
- Entry *entryPtr; /* Entry that is to get the new elements. */
- int index; /* Add the new elements before this
- * character index. */
- char *value; /* New characters to add (NULL-terminated
+InsertChars(
+ Entry *entryPtr, /* Entry that is to get the new elements. */
+ int index, /* Add the new elements before this character
+ * index. */
+ char *value) /* New characters to add (NULL-terminated
* string). */
{
- int byteIndex, byteCount, oldChars, charsAdded, newByteCount;
+ ptrdiff_t byteIndex;
+ size_t byteCount, newByteCount;
+ int oldChars, charsAdded;
CONST char *string;
- char *new;
+ char *newStr;
string = entryPtr->string;
byteIndex = Tcl_UtfAtIndex(string, index) - string;
@@ -2066,48 +2021,47 @@ InsertChars(entryPtr, index, value)
}
newByteCount = entryPtr->numBytes + byteCount + 1;
- new = (char *) ckalloc((unsigned) newByteCount);
- memcpy(new, string, (size_t) byteIndex);
- strcpy(new + byteIndex, value);
- strcpy(new + byteIndex + byteCount, string + byteIndex);
+ newStr = (char *) ckalloc((unsigned) newByteCount);
+ memcpy(newStr, string, byteIndex);
+ strcpy(newStr + byteIndex, value);
+ strcpy(newStr + byteIndex + byteCount, string + byteIndex);
if ((entryPtr->validate == VALIDATE_KEY ||
- entryPtr->validate == VALIDATE_ALL) &&
- EntryValidateChange(entryPtr, value, new, index,
- VALIDATE_INSERT) != TCL_OK) {
- ckfree(new);
+ entryPtr->validate == VALIDATE_ALL) &&
+ EntryValidateChange(entryPtr, value, newStr, index,
+ VALIDATE_INSERT) != TCL_OK) {
+ ckfree(newStr);
return;
}
ckfree((char *)string);
- entryPtr->string = new;
+ entryPtr->string = newStr;
/*
- * The following construction is used because inserting improperly
- * formed UTF-8 sequences between other improperly formed UTF-8
- * sequences could result in actually forming valid UTF-8 sequences;
- * the number of characters added may not be Tcl_NumUtfChars(string, -1),
- * because of context. The actual number of characters added is how
- * many characters are in the string now minus the number that
- * used to be there.
+ * The following construction is used because inserting improperly formed
+ * UTF-8 sequences between other improperly formed UTF-8 sequences could
+ * result in actually forming valid UTF-8 sequences; the number of
+ * characters added may not be Tcl_NumUtfChars(string, -1), because of
+ * context. The actual number of characters added is how many characters
+ * are in the string now minus the number that used to be there.
*/
oldChars = entryPtr->numChars;
- entryPtr->numChars = Tcl_NumUtfChars(new, -1);
+ entryPtr->numChars = Tcl_NumUtfChars(newStr, -1);
charsAdded = entryPtr->numChars - oldChars;
entryPtr->numBytes += byteCount;
if (entryPtr->displayString == string) {
- entryPtr->displayString = new;
+ entryPtr->displayString = newStr;
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
/*
- * Inserting characters invalidates all indexes into the string.
- * Touch up the indexes so that they still refer to the same
- * characters (at new positions). When updating the selection
- * end-points, don't include the new text in the selection unless
- * it was completely surrounded by the selection.
+ * Inserting characters invalidates all indexes into the string. Touch up
+ * the indexes so that they still refer to the same characters (at new
+ * positions). When updating the selection end-points, don't include the
+ * new text in the selection unless it was completely surrounded by the
+ * selection.
*/
if (entryPtr->selectFirst >= index) {
@@ -2116,8 +2070,7 @@ InsertChars(entryPtr, index, value)
if (entryPtr->selectLast > index) {
entryPtr->selectLast += charsAdded;
}
- if ((entryPtr->selectAnchor > index)
- || (entryPtr->selectFirst >= index)) {
+ if ((entryPtr->selectAnchor > index) || (entryPtr->selectFirst >= index)) {
entryPtr->selectAnchor += charsAdded;
}
if (entryPtr->leftIndex > index) {
@@ -2147,14 +2100,14 @@ InsertChars(entryPtr, index, value)
*/
static void
-DeleteChars(entryPtr, index, count)
- Entry *entryPtr; /* Entry widget to modify. */
- int index; /* Index of first character to delete. */
- int count; /* How many characters to delete. */
+DeleteChars(
+ Entry *entryPtr, /* Entry widget to modify. */
+ int index, /* Index of first character to delete. */
+ int count) /* How many characters to delete. */
{
int byteIndex, byteCount, newByteCount;
CONST char *string;
- char *new, *todelete;
+ char *newStr, *toDelete;
if ((index + count) > entryPtr->numChars) {
count = entryPtr->numChars - index;
@@ -2165,41 +2118,41 @@ DeleteChars(entryPtr, index, count)
string = entryPtr->string;
byteIndex = Tcl_UtfAtIndex(string, index) - string;
- byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string + byteIndex);
+ byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex);
newByteCount = entryPtr->numBytes + 1 - byteCount;
- new = (char *) ckalloc((unsigned) newByteCount);
- memcpy(new, string, (size_t) byteIndex);
- strcpy(new + byteIndex, string + byteIndex + byteCount);
+ newStr = (char *) ckalloc((unsigned) newByteCount);
+ memcpy(newStr, string, (size_t) byteIndex);
+ strcpy(newStr + byteIndex, string + byteIndex + byteCount);
- todelete = (char *) ckalloc((unsigned) (byteCount + 1));
- memcpy(todelete, string + byteIndex, (size_t) byteCount);
- todelete[byteCount] = '\0';
+ toDelete = (char *) ckalloc((unsigned) (byteCount + 1));
+ memcpy(toDelete, string + byteIndex, (size_t) byteCount);
+ toDelete[byteCount] = '\0';
if ((entryPtr->validate == VALIDATE_KEY ||
- entryPtr->validate == VALIDATE_ALL) &&
- EntryValidateChange(entryPtr, todelete, new, index,
- VALIDATE_DELETE) != TCL_OK) {
- ckfree(new);
- ckfree(todelete);
+ entryPtr->validate == VALIDATE_ALL) &&
+ EntryValidateChange(entryPtr, toDelete, newStr, index,
+ VALIDATE_DELETE) != TCL_OK) {
+ ckfree(newStr);
+ ckfree(toDelete);
return;
}
- ckfree(todelete);
+ ckfree(toDelete);
ckfree((char *)entryPtr->string);
- entryPtr->string = new;
+ entryPtr->string = newStr;
entryPtr->numChars -= count;
entryPtr->numBytes -= byteCount;
if (entryPtr->displayString == string) {
- entryPtr->displayString = new;
+ entryPtr->displayString = newStr;
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
/*
* Deleting characters results in the remaining characters being
- * renumbered. Update the various indexes into the string to reflect
- * this change.
+ * renumbered. Update the various indexes into the string to reflect this
+ * change.
*/
if (entryPtr->selectFirst >= index) {
@@ -2249,10 +2202,9 @@ DeleteChars(entryPtr, index, count)
*
* EntryValueChanged --
*
- * This procedure is invoked when characters are inserted into
- * an entry or deleted from it. It updates the entry's associated
- * variable, if there is one, and does other bookkeeping such
- * as arranging for redisplay.
+ * This function is invoked when characters are inserted into an entry or
+ * deleted from it. It updates the entry's associated variable, if there
+ * is one, and does other bookkeeping such as arranging for redisplay.
*
* Results:
* None.
@@ -2264,10 +2216,10 @@ DeleteChars(entryPtr, index, count)
*/
static void
-EntryValueChanged(entryPtr, newValue)
- Entry *entryPtr; /* Entry whose value just changed. */
- CONST char *newValue; /* If this value is not NULL, we first
- * force the value of the entry to this */
+EntryValueChanged(
+ Entry *entryPtr, /* Entry whose value just changed. */
+ CONST char *newValue) /* If this value is not NULL, we first force
+ * the value of the entry to this. */
{
if (newValue != NULL) {
EntrySetValue(entryPtr, newValue);
@@ -2283,10 +2235,10 @@ EntryValueChanged(entryPtr, newValue)
if ((newValue != NULL) && (strcmp(newValue, entryPtr->string) != 0)) {
/*
* The value of the variable is different than what we asked for.
- * This means that a trace on the variable modified it. In this
- * case our trace procedure wasn't invoked since the modification
- * came while a trace was already active on the variable. So,
- * update our value to reflect the variable's latest value.
+ * This means that a trace on the variable modified it. In this case
+ * our trace function wasn't invoked since the modification came while
+ * a trace was already active on the variable. So, update our value to
+ * reflect the variable's latest value.
*/
EntrySetValue(entryPtr, newValue);
@@ -2306,27 +2258,27 @@ EntryValueChanged(entryPtr, newValue)
*
* EntrySetValue --
*
- * Replace the contents of a text entry with a given value. This
- * procedure is invoked when updating the entry from the entry's
- * associated variable.
+ * Replace the contents of a text entry with a given value. This function
+ * is invoked when updating the entry from the entry's associated
+ * variable.
*
* Results:
* None.
*
* Side effects:
- * The string displayed in the entry will change. The selection,
- * insertion point, and view may have to be adjusted to keep them
- * within the bounds of the new string. Note: this procedure does
- * *not* update the entry's associated variable, since that could
- * result in an infinite loop.
+ * The string displayed in the entry will change. The selection,
+ * insertion point, and view may have to be adjusted to keep them within
+ * the bounds of the new string. Note: this function does *not* update
+ * the entry's associated variable, since that could result in an
+ * infinite loop.
*
*----------------------------------------------------------------------
*/
static void
-EntrySetValue(entryPtr, value)
- Entry *entryPtr; /* Entry whose value is to be changed. */
- CONST char *value; /* New text to display in entry. */
+EntrySetValue(
+ Entry *entryPtr, /* Entry whose value is to be changed. */
+ CONST char *value) /* New text to display in entry. */
{
CONST char *oldSource;
int valueLen, malloced = 0;
@@ -2340,23 +2292,27 @@ EntrySetValue(entryPtr, value)
entryPtr->flags |= VALIDATE_ABORT;
} else {
/*
- * If we validate, we create a copy of the value, as it may
- * point to volatile memory, like the value of the -textvar
- * which may get freed during validation
+ * If we validate, we create a copy of the value, as it may point to
+ * volatile memory, like the value of the -textvar which may get freed
+ * during validation
*/
+
char *tmp = (char *) ckalloc((unsigned) (valueLen + 1));
+
strcpy(tmp, value);
value = tmp;
malloced = 1;
entryPtr->flags |= VALIDATE_VAR;
- (void) EntryValidateChange(entryPtr, (char *) NULL, value, -1,
+ (void) EntryValidateChange(entryPtr, NULL, value, -1,
VALIDATE_FORCED);
entryPtr->flags &= ~VALIDATE_VAR;
+
/*
* If VALIDATE_ABORT has been set, then this operation should be
* aborted because the validatecommand did something else instead
*/
+
if (entryPtr->flags & VALIDATE_ABORT) {
entryPtr->flags &= ~VALIDATE_ABORT;
ckfree((char *)value);
@@ -2371,6 +2327,7 @@ EntrySetValue(entryPtr, value)
entryPtr->string = value;
} else {
char *tmp = (char *) ckalloc((unsigned) (valueLen + 1));
+
strcpy(tmp, value);
entryPtr->string = tmp;
}
@@ -2411,23 +2368,23 @@ EntrySetValue(entryPtr, value)
*
* EntryEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on entries.
+ * This function is invoked by the Tk dispatcher for various events on
+ * entries.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-EntryEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+EntryEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
Entry *entryPtr = (Entry *) clientData;
@@ -2458,34 +2415,33 @@ EntryEventProc(clientData, eventPtr)
}
switch (eventPtr->type) {
- case Expose:
- EventuallyRedraw(entryPtr);
- entryPtr->flags |= BORDER_NEEDED;
- break;
- case DestroyNotify:
- if (!(entryPtr->flags & ENTRY_DELETED)) {
- entryPtr->flags |= (ENTRY_DELETED | VALIDATE_ABORT);
- Tcl_DeleteCommandFromToken(entryPtr->interp,
- entryPtr->widgetCmd);
- if (entryPtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(DisplayEntry, clientData);
- }
- Tcl_EventuallyFree(clientData, DestroyEntry);
- }
- break;
- case ConfigureNotify:
- Tcl_Preserve((ClientData) entryPtr);
- entryPtr->flags |= UPDATE_SCROLLBAR;
- EntryComputeGeometry(entryPtr);
- EventuallyRedraw(entryPtr);
- Tcl_Release((ClientData) entryPtr);
- break;
- case FocusIn:
- case FocusOut:
- if (eventPtr->xfocus.detail != NotifyInferior) {
- EntryFocusProc(entryPtr, (eventPtr->type == FocusIn));
+ case Expose:
+ EventuallyRedraw(entryPtr);
+ entryPtr->flags |= BORDER_NEEDED;
+ break;
+ case DestroyNotify:
+ if (!(entryPtr->flags & ENTRY_DELETED)) {
+ entryPtr->flags |= (ENTRY_DELETED | VALIDATE_ABORT);
+ Tcl_DeleteCommandFromToken(entryPtr->interp, entryPtr->widgetCmd);
+ if (entryPtr->flags & REDRAW_PENDING) {
+ Tcl_CancelIdleCall(DisplayEntry, clientData);
}
- break;
+ Tcl_EventuallyFree(clientData, DestroyEntry);
+ }
+ break;
+ case ConfigureNotify:
+ Tcl_Preserve((ClientData) entryPtr);
+ entryPtr->flags |= UPDATE_SCROLLBAR;
+ EntryComputeGeometry(entryPtr);
+ EventuallyRedraw(entryPtr);
+ Tcl_Release((ClientData) entryPtr);
+ break;
+ case FocusIn:
+ case FocusOut:
+ if (eventPtr->xfocus.detail != NotifyInferior) {
+ EntryFocusProc(entryPtr, (eventPtr->type == FocusIn));
+ }
+ break;
}
}
@@ -2494,9 +2450,9 @@ EntryEventProc(clientData, eventPtr)
*
* EntryCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -2508,20 +2464,20 @@ EntryEventProc(clientData, eventPtr)
*/
static void
-EntryCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+EntryCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
Entry *entryPtr = (Entry *) clientData;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
if (!(entryPtr->flags & ENTRY_DELETED)) {
- Tk_DestroyWindow(entryPtr->tkwin);
+ Tk_DestroyWindow(entryPtr->tkwin);
}
}
@@ -2530,15 +2486,14 @@ EntryCmdDeletedProc(clientData)
*
* GetEntryIndex --
*
- * Parse an index into an entry and return either its value
- * or an error.
+ * Parse an index into an entry and return either its value or an error.
*
* Results:
- * A standard Tcl result. If all went well, then *indexPtr is
- * filled in with the character index (into entryPtr) corresponding to
- * string. The index value is guaranteed to lie between 0 and
- * the number of characters in the string, inclusive. If an
- * error occurs then an error message is left in the interp's result.
+ * A standard Tcl result. If all went well, then *indexPtr is filled in
+ * with the character index (into entryPtr) corresponding to string. The
+ * index value is guaranteed to lie between 0 and the number of
+ * characters in the string, inclusive. If an error occurs then an error
+ * message is left in the interp's result.
*
* Side effects:
* None.
@@ -2547,13 +2502,12 @@ EntryCmdDeletedProc(clientData)
*/
static int
-GetEntryIndex(interp, entryPtr, string, indexPtr)
- Tcl_Interp *interp; /* For error messages. */
- Entry *entryPtr; /* Entry for which the index is being
+GetEntryIndex(
+ Tcl_Interp *interp, /* For error messages. */
+ Entry *entryPtr, /* Entry for which the index is being
* specified. */
- char *string; /* Specifies character in entryPtr. */
- int *indexPtr; /* Where to store converted character
- * index. */
+ char *string, /* Specifies character in entryPtr. */
+ int *indexPtr) /* Where to store converted character index */
{
size_t length;
@@ -2563,17 +2517,17 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
if (strncmp(string, "anchor", length) == 0) {
*indexPtr = entryPtr->selectAnchor;
} else {
- badIndex:
+ badIndex:
/*
* Some of the paths here leave messages in the interp's result,
* so we have to clear it out before storing our own message.
*/
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
Tcl_AppendResult(interp, "bad ",
(entryPtr->type == TK_ENTRY) ? "entry" : "spinbox",
- " index \"", string, "\"", (char *) NULL);
+ " index \"", string, "\"", NULL);
return TCL_ERROR;
}
} else if (string[0] == 'e') {
@@ -2590,9 +2544,9 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
}
} else if (string[0] == 's') {
if (entryPtr->selectFirst < 0) {
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
Tcl_AppendResult(interp, "selection isn't in widget ",
- Tk_PathName(entryPtr->tkwin), (char *) NULL);
+ Tk_PathName(entryPtr->tkwin), NULL);
return TCL_ERROR;
}
if (length < 5) {
@@ -2625,10 +2579,10 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
x - entryPtr->layoutX, 0);
/*
- * Special trick: if the x-position was off-screen to the right,
- * round the index up to refer to the character just after the
- * last visible one on the screen. This is needed to enable the
- * last character to be selected, for example.
+ * Special trick: if the x-position was off-screen to the right, round
+ * the index up to refer to the character just after the last visible
+ * one on the screen. This is needed to enable the last character to
+ * be selected, for example.
*/
if (roundUp && (*indexPtr < entryPtr->numChars)) {
@@ -2642,7 +2596,7 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
*indexPtr = 0;
} else if (*indexPtr > entryPtr->numChars) {
*indexPtr = entryPtr->numChars;
- }
+ }
}
return TCL_OK;
}
@@ -2652,8 +2606,8 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
*
* EntryScanTo --
*
- * Given a y-coordinate (presumably of the curent mouse location)
- * drag the view in the window to implement the scan operation.
+ * Given a y-coordinate (presumably of the curent mouse location) drag
+ * the view in the window to implement the scan operation.
*
* Results:
* None.
@@ -2665,21 +2619,21 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
*/
static void
-EntryScanTo(entryPtr, x)
- Entry *entryPtr; /* Information about widget. */
- int x; /* X-coordinate to use for scan operation. */
+EntryScanTo(
+ Entry *entryPtr, /* Information about widget. */
+ int x) /* X-coordinate to use for scan operation. */
{
int newLeftIndex;
/*
- * Compute new leftIndex for entry by amplifying the difference
- * between the current position and the place where the scan
- * started (the "mark" position). If we run off the left or right
- * side of the entry, then reset the mark point so that the current
- * position continues to correspond to the edge of the window.
- * This means that the picture will start dragging as soon as the
- * mouse reverses direction (without this reset, might have to slide
- * mouse a long ways back before the picture starts moving again).
+ * Compute new leftIndex for entry by amplifying the difference between
+ * the current position and the place where the scan started (the "mark"
+ * position). If we run off the left or right side of the entry, then
+ * reset the mark point so that the current position continues to
+ * correspond to the edge of the window. This means that the picture will
+ * start dragging as soon as the mouse reverses direction (without this
+ * reset, might have to slide mouse a long ways back before the picture
+ * starts moving again).
*/
newLeftIndex = entryPtr->scanMarkIndex
@@ -2691,7 +2645,7 @@ EntryScanTo(entryPtr, x)
if (newLeftIndex < 0) {
newLeftIndex = entryPtr->scanMarkIndex = 0;
entryPtr->scanMarkX = x;
- }
+ }
if (newLeftIndex != entryPtr->leftIndex) {
entryPtr->leftIndex = newLeftIndex;
@@ -2710,8 +2664,8 @@ EntryScanTo(entryPtr, x)
*
* EntrySelectTo --
*
- * Modify the selection by moving its un-anchored end. This could
- * make the selection either larger or smaller.
+ * Modify the selection by moving its un-anchored end. This could make
+ * the selection either larger or smaller.
*
* Results:
* None.
@@ -2723,9 +2677,9 @@ EntryScanTo(entryPtr, x)
*/
static void
-EntrySelectTo(entryPtr, index)
- Entry *entryPtr; /* Information about widget. */
- int index; /* Character index of element that is to
+EntrySelectTo(
+ Entry *entryPtr, /* Information about widget. */
+ int index) /* Character index of element that is to
* become the "other" end of the selection. */
{
int newFirst, newLast;
@@ -2771,15 +2725,15 @@ EntrySelectTo(entryPtr, index)
*
* EntryFetchSelection --
*
- * This procedure is called back by Tk when the selection is
- * requested by someone. It returns part or all of the selection
- * in a buffer provided by the caller.
+ * This function is called back by Tk when the selection is requested by
+ * someone. It returns part or all of the selection in a buffer provided
+ * by the caller.
*
* Results:
- * The return value is the number of non-NULL bytes stored
- * at buffer. Buffer is filled (or partially filled) with a
- * NULL-terminated string containing part or all of the selection,
- * as given by offset and maxBytes.
+ * The return value is the number of non-NULL bytes stored at buffer.
+ * Buffer is filled (or partially filled) with a NULL-terminated string
+ * containing part or all of the selection, as given by offset and
+ * maxBytes.
*
* Side effects:
* None.
@@ -2788,14 +2742,13 @@ EntrySelectTo(entryPtr, index)
*/
static int
-EntryFetchSelection(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Information about entry widget. */
- int offset; /* Byte offset within selection of first
+EntryFetchSelection(
+ ClientData clientData, /* Information about entry widget. */
+ int offset, /* Byte offset within selection of first
* character to be returned. */
- char *buffer; /* Location in which to place selection. */
- int maxBytes; /* Maximum number of bytes to place at
- * buffer, not including terminating NULL
- * character. */
+ char *buffer, /* Location in which to place selection. */
+ int maxBytes) /* Maximum number of bytes to place at buffer,
+ * not including terminating NUL character. */
{
Entry *entryPtr = (Entry *) clientData;
int byteCount;
@@ -2826,32 +2779,32 @@ EntryFetchSelection(clientData, offset, buffer, maxBytes)
*
* EntryLostSelection --
*
- * This procedure is called back by Tk when the selection is
- * grabbed away from an entry widget.
+ * This function is called back by Tk when the selection is grabbed away
+ * from an entry widget.
*
* Results:
* None.
*
* Side effects:
- * The existing selection is unhighlighted, and the window is
- * marked as not containing a selection.
+ * The existing selection is unhighlighted, and the window is marked as
+ * not containing a selection.
*
*----------------------------------------------------------------------
*/
static void
-EntryLostSelection(clientData)
- ClientData clientData; /* Information about entry widget. */
+EntryLostSelection(
+ ClientData clientData) /* Information about entry widget. */
{
Entry *entryPtr = (Entry *) clientData;
entryPtr->flags &= ~GOT_SELECTION;
/*
- * On Windows and Mac systems, we want to remember the selection
- * for the next time the focus enters the window. On Unix, we need
- * to clear the selection since it is always visible. This is
- * controlled by ::tk::AlwaysShowSelection.
+ * On Windows and Mac systems, we want to remember the selection for the
+ * next time the focus enters the window. On Unix, we need to clear the
+ * selection since it is always visible.
+ * This is controlled by ::tk::AlwaysShowSelection.
*/
if (TkpAlwaysShowSelection(entryPtr->tkwin)
@@ -2873,26 +2826,26 @@ EntryLostSelection(clientData)
* None.
*
* Side effects:
- * Information gets redisplayed. Right now we don't do selective
- * redisplays: the whole window will be redrawn. This doesn't
- * seem to hurt performance noticeably, but if it does then this
- * could be changed.
+ * Information gets redisplayed. Right now we don't do selective
+ * redisplays: the whole window will be redrawn. This doesn't seem to
+ * hurt performance noticeably, but if it does then this could be
+ * changed.
*
*----------------------------------------------------------------------
*/
static void
-EventuallyRedraw(entryPtr)
- Entry *entryPtr; /* Information about widget. */
+EventuallyRedraw(
+ Entry *entryPtr) /* Information about widget. */
{
if ((entryPtr->flags & ENTRY_DELETED) || !Tk_IsMapped(entryPtr->tkwin)) {
return;
}
/*
- * Right now we don't do selective redisplays: the whole window
- * will be redrawn. This doesn't seem to hurt performance noticeably,
- * but if it does then this could be changed.
+ * Right now we don't do selective redisplays: the whole window will be
+ * redrawn. This doesn't seem to hurt performance noticeably, but if it
+ * does then this could be changed.
*/
if (!(entryPtr->flags & REDRAW_PENDING)) {
@@ -2906,13 +2859,12 @@ EventuallyRedraw(entryPtr)
*
* EntryVisibleRange --
*
- * Return information about the range of the entry that is
- * currently visible.
+ * Return information about the range of the entry that is currently
+ * visible.
*
* Results:
- * *firstPtr and *lastPtr are modified to hold fractions between
- * 0 and 1 identifying the range of characters visible in the
- * entry.
+ * *firstPtr and *lastPtr are modified to hold fractions between 0 and 1
+ * identifying the range of characters visible in the entry.
*
* Side effects:
* None.
@@ -2921,11 +2873,11 @@ EventuallyRedraw(entryPtr)
*/
static void
-EntryVisibleRange(entryPtr, firstPtr, lastPtr)
- Entry *entryPtr; /* Information about widget. */
- double *firstPtr; /* Return position of first visible
- * character in widget. */
- double *lastPtr; /* Return position of char just after last
+EntryVisibleRange(
+ Entry *entryPtr, /* Information about widget. */
+ double *firstPtr, /* Return position of first visible character
+ * in widget. */
+ double *lastPtr) /* Return position of char just after last
* visible one. */
{
int charsInWindow;
@@ -2956,10 +2908,10 @@ EntryVisibleRange(entryPtr, firstPtr, lastPtr)
*
* EntryUpdateScrollbar --
*
- * This procedure is invoked whenever information has changed in
- * an entry in a way that would invalidate a scrollbar display.
- * If there is an associated scrollbar, then this procedure updates
- * it by invoking a Tcl command.
+ * This function is invoked whenever information has changed in an entry
+ * in a way that would invalidate a scrollbar display. If there is an
+ * associated scrollbar, then this function updates it by invoking a Tcl
+ * command.
*
* Results:
* None.
@@ -2972,10 +2924,10 @@ EntryVisibleRange(entryPtr, firstPtr, lastPtr)
*/
static void
-EntryUpdateScrollbar(entryPtr)
- Entry *entryPtr; /* Information about widget. */
+EntryUpdateScrollbar(
+ Entry *entryPtr) /* Information about widget. */
{
- char args[TCL_DOUBLE_SPACE * 2];
+ char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE];
int code;
double first, last;
Tcl_Interp *interp;
@@ -2987,8 +2939,10 @@ EntryUpdateScrollbar(entryPtr)
interp = entryPtr->interp;
Tcl_Preserve((ClientData) interp);
EntryVisibleRange(entryPtr, &first, &last);
- sprintf(args, " %g %g", first, last);
- code = Tcl_VarEval(interp, entryPtr->scrollCmd, args, (char *) NULL);
+ Tcl_PrintDouble(NULL, first, firstStr);
+ Tcl_PrintDouble(NULL, last, lastStr);
+ code = Tcl_VarEval(interp, entryPtr->scrollCmd, " ", firstStr, " ",
+ lastStr, NULL);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (horizontal scrolling command executed by ");
@@ -2996,7 +2950,7 @@ EntryUpdateScrollbar(entryPtr)
Tcl_AddErrorInfo(interp, ")");
Tcl_BackgroundError(interp);
}
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
Tcl_Release((ClientData) interp);
}
@@ -3005,22 +2959,22 @@ EntryUpdateScrollbar(entryPtr)
*
* EntryBlinkProc --
*
- * This procedure is called as a timer handler to blink the
- * insertion cursor off and on.
+ * This function is called as a timer handler to blink the insertion
+ * cursor off and on.
*
* Results:
* None.
*
* Side effects:
- * The cursor gets turned on or off, redisplay gets invoked,
- * and this procedure reschedules itself.
+ * The cursor gets turned on or off, redisplay gets invoked, and this
+ * function reschedules itself.
*
*----------------------------------------------------------------------
*/
static void
-EntryBlinkProc(clientData)
- ClientData clientData; /* Pointer to record describing entry. */
+EntryBlinkProc(
+ ClientData clientData) /* Pointer to record describing entry. */
{
Entry *entryPtr = (Entry *) clientData;
@@ -3046,9 +3000,9 @@ EntryBlinkProc(clientData)
*
* EntryFocusProc --
*
- * This procedure is called whenever the entry gets or loses the
- * input focus. It's also called whenever the window is reconfigured
- * while it has the focus.
+ * This function is called whenever the entry gets or loses the input
+ * focus. It's also called whenever the window is reconfigured while it
+ * has the focus.
*
* Results:
* None.
@@ -3060,9 +3014,9 @@ EntryBlinkProc(clientData)
*/
static void
-EntryFocusProc(entryPtr, gotFocus)
- Entry *entryPtr; /* Entry that got or lost focus. */
- int gotFocus; /* 1 means window is getting focus, 0 means
+EntryFocusProc(
+ Entry *entryPtr, /* Entry that got or lost focus. */
+ int gotFocus) /* 1 means window is getting focus, 0 means
* it's losing it. */
{
Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler);
@@ -3076,7 +3030,7 @@ EntryFocusProc(entryPtr, gotFocus)
if (entryPtr->validate == VALIDATE_ALL ||
entryPtr->validate == VALIDATE_FOCUS ||
entryPtr->validate == VALIDATE_FOCUSIN) {
- EntryValidateChange(entryPtr, (char *) NULL,
+ EntryValidateChange(entryPtr, NULL,
entryPtr->string, -1, VALIDATE_FOCUSIN);
}
} else {
@@ -3085,7 +3039,7 @@ EntryFocusProc(entryPtr, gotFocus)
if (entryPtr->validate == VALIDATE_ALL ||
entryPtr->validate == VALIDATE_FOCUS ||
entryPtr->validate == VALIDATE_FOCUSOUT) {
- EntryValidateChange(entryPtr, (char *) NULL,
+ EntryValidateChange(entryPtr, NULL,
entryPtr->string, -1, VALIDATE_FOCUSOUT);
}
}
@@ -3097,27 +3051,26 @@ EntryFocusProc(entryPtr, gotFocus)
*
* EntryTextVarProc --
*
- * This procedure is invoked when someone changes the variable
- * whose contents are to be displayed in an entry.
+ * This function is invoked when someone changes the variable whose
+ * contents are to be displayed in an entry.
*
* Results:
* NULL is always returned.
*
* Side effects:
- * The text displayed in the entry will change to match the
- * variable.
+ * The text displayed in the entry will change to match the variable.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static char *
-EntryTextVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about button. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Not used. */
- CONST char *name2; /* Not used. */
- int flags; /* Information about what happened. */
+EntryTextVarProc(
+ ClientData clientData, /* Information about button. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ CONST char *name1, /* Not used. */
+ CONST char *name2, /* Not used. */
+ int flags) /* Information about what happened. */
{
Entry *entryPtr = (Entry *) clientData;
CONST char *value;
@@ -3126,12 +3079,12 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
/*
* Just abort early if we entered here while being deleted.
*/
- return (char *) NULL;
+ return NULL;
}
/*
- * If the variable is unset, then immediately recreate it unless
- * the whole interpreter is going away.
+ * If the variable is unset, then immediately recreate it unless the whole
+ * interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
@@ -3143,14 +3096,13 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
EntryTextVarProc, clientData);
entryPtr->flags |= ENTRY_VAR_TRACED;
}
- return (char *) NULL;
+ return NULL;
}
/*
- * Update the entry's text with the value of the variable, unless
- * the entry already has that value (this happens when the variable
- * changes value because we changed it because someone typed in
- * the entry).
+ * Update the entry's text with the value of the variable, unless the
+ * entry already has that value (this happens when the variable changes
+ * value because we changed it because someone typed in the entry).
*/
value = Tcl_GetVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY);
@@ -3158,7 +3110,7 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
value = "";
}
EntrySetValue(entryPtr, value);
- return (char *) NULL;
+ return NULL;
}
/*
@@ -3166,25 +3118,25 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
*
* EntryValidate --
*
- * This procedure is invoked when any character is added or
- * removed from the entry widget, or a focus has trigerred validation.
+ * This function is invoked when any character is added or removed from
+ * the entry widget, or a focus has trigerred validation.
*
* Results:
- * TCL_OK if the validatecommand passes the new string.
- * TCL_BREAK if the vcmd executed OK, but rejects the string.
- * TCL_ERROR if an error occurred while executing the vcmd
- * or a valid Tcl_Bool is not returned.
+
+ * TCL_OK if the validatecommand passes the new string. TCL_BREAK if the
+ * vcmd executed OK, but rejects the string. TCL_ERROR if an error
+ * occurred while executing the vcmd or a valid Tcl_Bool is not returned.
*
* Side effects:
- * An error condition may arise
+ * An error condition may arise
*
*--------------------------------------------------------------
*/
static int
-EntryValidate(entryPtr, cmd)
- register Entry *entryPtr; /* Entry that needs validation. */
- register char *cmd; /* Validation command (NULL-terminated
+EntryValidate(
+ register Entry *entryPtr, /* Entry that needs validation. */
+ register char *cmd) /* Validation command (NULL-terminated
* string). */
{
register Tcl_Interp *interp = entryPtr->interp;
@@ -3193,9 +3145,10 @@ EntryValidate(entryPtr, cmd)
code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
/*
- * We accept TCL_OK and TCL_RETURN as valid return codes from the
- * command callback.
+ * We accept TCL_OK and TCL_RETURN as valid return codes from the command
+ * callback.
*/
+
if (code != TCL_OK && code != TCL_RETURN) {
Tcl_AddErrorInfo(interp, "\n\t(in validation command executed by ");
Tcl_AddErrorInfo(interp, Tk_PathName(entryPtr->tkwin));
@@ -3207,8 +3160,9 @@ EntryValidate(entryPtr, cmd)
/*
* The command callback should return an acceptable Tcl boolean.
*/
+
if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp),
- &bool) != TCL_OK) {
+ &bool) != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\nvalid boolean not returned by validation command");
Tcl_BackgroundError(interp);
@@ -3225,45 +3179,45 @@ EntryValidate(entryPtr, cmd)
*
* EntryValidateChange --
*
- * This procedure is invoked when any character is added or
- * removed from the entry widget, or a focus has trigerred validation.
+ * This function is invoked when any character is added or removed from
+ * the entry widget, or a focus has trigerred validation.
*
* Results:
- * TCL_OK if the validatecommand accepts the new string,
- * TCL_ERROR if any problems occured with validatecommand.
+ * TCL_OK if the validatecommand accepts the new string, TCL_ERROR if any
+ * problems occured with validatecommand.
*
* Side effects:
- * The insertion/deletion may be aborted, and the
- * validatecommand might turn itself off (if an error
- * or loop condition arises).
+ * The insertion/deletion may be aborted, and the validatecommand might
+ * turn itself off (if an error or loop condition arises).
*
*--------------------------------------------------------------
*/
static int
-EntryValidateChange(entryPtr, change, new, index, type)
- register Entry *entryPtr; /* Entry that needs validation. */
- char *change; /* Characters to be added/deleted
- * (NULL-terminated string). */
- CONST char *new; /* Potential new value of entry string */
- int index; /* index of insert/delete, -1 otherwise */
- int type; /* forced, delete, insert,
- * focusin or focusout */
+EntryValidateChange(
+ register Entry *entryPtr, /* Entry that needs validation. */
+ char *change, /* Characters to be added/deleted
+ * (NUL-terminated string). */
+ CONST char *newValue, /* Potential new value of entry string */
+ int index, /* index of insert/delete, -1 otherwise */
+ int type) /* forced, delete, insert, focusin or
+ * focusout */
{
int code, varValidate = (entryPtr->flags & VALIDATE_VAR);
char *p;
Tcl_DString script;
-
+
if (entryPtr->validateCmd == NULL ||
entryPtr->validate == VALIDATE_NONE) {
return (varValidate ? TCL_ERROR : TCL_OK);
}
/*
- * If we're already validating, then we're hitting a loop condition
- * Return and set validate to 0 to disallow further validations
- * and prevent current validation from finishing
+ * If we're already validating, then we're hitting a loop condition Return
+ * and set validate to 0 to disallow further validations and prevent
+ * current validation from finishing
*/
+
if (entryPtr->flags & VALIDATING) {
entryPtr->validate = VALIDATE_NONE;
return (varValidate ? TCL_ERROR : TCL_OK);
@@ -3277,7 +3231,7 @@ EntryValidateChange(entryPtr, change, new, index, type)
Tcl_DStringInit(&script);
ExpandPercents(entryPtr, entryPtr->validateCmd,
- change, new, index, type, &script);
+ change, newValue, index, type, &script);
Tcl_DStringAppend(&script, "", 1);
p = Tcl_DStringValue(&script);
@@ -3285,10 +3239,10 @@ EntryValidateChange(entryPtr, change, new, index, type)
Tcl_DStringFree(&script);
/*
- * If e->validate has become VALIDATE_NONE during the validation, or
- * we now have VALIDATE_VAR set (from EntrySetValue) and didn't before,
- * it means that a loop condition almost occured. Do not allow
- * this validation result to finish.
+ * If e->validate has become VALIDATE_NONE during the validation, or we
+ * now have VALIDATE_VAR set (from EntrySetValue) and didn't before, it
+ * means that a loop condition almost occured. Do not allow this
+ * validation result to finish.
*/
if (entryPtr->validate == VALIDATE_NONE
@@ -3297,8 +3251,8 @@ EntryValidateChange(entryPtr, change, new, index, type)
}
/*
- * It's possible that the user deleted the entry during validation.
- * In that case, abort future validation and return an error.
+ * It's possible that the user deleted the entry during validation. In
+ * that case, abort future validation and return an error.
*/
if (entryPtr->flags & ENTRY_DELETED) {
@@ -3307,20 +3261,19 @@ EntryValidateChange(entryPtr, change, new, index, type)
/*
* If validate will return ERROR, then disallow further validations
- * Otherwise, if it didn't accept the new string (returned TCL_BREAK)
- * then eval the invalidCmd (if it's set)
+ * Otherwise, if it didn't accept the new string (returned TCL_BREAK) then
+ * eval the invalidCmd (if it's set)
*/
if (code == TCL_ERROR) {
entryPtr->validate = VALIDATE_NONE;
} else if (code == TCL_BREAK) {
/*
- * If we were doing forced validation (like via a variable
- * trace) and the command returned 0, the we turn off validation
- * because we assume that textvariables have precedence in
- * managing the value. We also don't call the invcmd, as it
- * may want to do entry manipulation which the setting of the
- * var will later wipe anyway.
+ * If we were doing forced validation (like via a variable trace) and
+ * the command returned 0, the we turn off validation because we
+ * assume that textvariables have precedence in managing the value.
+ * We also don't call the invcmd, as it may want to do entry
+ * manipulation which the setting of the var will later wipe anyway.
*/
if (varValidate) {
@@ -3328,13 +3281,13 @@ EntryValidateChange(entryPtr, change, new, index, type)
} else if (entryPtr->invalidCmd != NULL) {
Tcl_DStringInit(&script);
ExpandPercents(entryPtr, entryPtr->invalidCmd,
- change, new, index, type, &script);
+ change, newValue, index, type, &script);
Tcl_DStringAppend(&script, "", 1);
p = Tcl_DStringValue(&script);
if (Tcl_EvalEx(entryPtr->interp, p, -1,
TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT) != TCL_OK) {
Tcl_AddErrorInfo(entryPtr->interp,
- "\n\t(in invalidcommand executed by entry)");
+ "\n\t(in invalidcommand executed by entry)");
Tcl_BackgroundError(entryPtr->interp);
code = TCL_ERROR;
entryPtr->validate = VALIDATE_NONE;
@@ -3342,8 +3295,9 @@ EntryValidateChange(entryPtr, change, new, index, type)
Tcl_DStringFree(&script);
/*
- * It's possible that the user deleted the entry during validation.
- * In that case, abort future validation and return an error.
+ * It's possible that the user deleted the entry during
+ * validation. In that case, abort future validation and return an
+ * error.
*/
if (entryPtr->flags & ENTRY_DELETED) {
@@ -3362,13 +3316,12 @@ EntryValidateChange(entryPtr, change, new, index, type)
*
* ExpandPercents --
*
- * Given a command and an event, produce a new command
- * by replacing % constructs in the original command
- * with information from the X event.
+ * Given a command and an event, produce a new command by replacing %
+ * constructs in the original command with information from the X event.
*
* Results:
- * The new expanded command is appended to the dynamic string
- * given by dsPtr.
+ * The new expanded command is appended to the dynamic string given by
+ * dsPtr.
*
* Side effects:
* None.
@@ -3377,18 +3330,18 @@ EntryValidateChange(entryPtr, change, new, index, type)
*/
static void
-ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
- register Entry *entryPtr; /* Entry that needs validation. */
- register CONST char *before;
- /* Command containing percent
- * expressions to be replaced. */
- char *change; /* Characters to added/deleted
- * (NULL-terminated string). */
- CONST char *new; /* Potential new value of entry string */
- int index; /* index of insert/delete */
- int type; /* INSERT or DELETE */
- Tcl_DString *dsPtr; /* Dynamic string in which to append
- * new command. */
+ExpandPercents(
+ register Entry *entryPtr, /* Entry that needs validation. */
+ register CONST char *before,
+ /* Command containing percent expressions to
+ * be replaced. */
+ CONST char *change, /* Characters to added/deleted (NUL-terminated
+ * string). */
+ CONST char *newValue, /* Potential new value of entry string */
+ int index, /* index of insert/delete */
+ int type, /* INSERT or DELETE */
+ Tcl_DString *dsPtr) /* Dynamic string in which to append new
+ * command. */
{
int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl
* list element. */
@@ -3402,14 +3355,18 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
break;
}
/*
- * Find everything up to the next % character and append it
- * to the result string.
+ * Find everything up to the next % character and append it to the
+ * result string.
*/
string = before;
- /* No need to convert '%', as it is in ascii range */
+
+ /*
+ * No need to convert '%', as it is in ascii range.
+ */
+
string = Tcl_UtfFindFirst(before, '%');
- if (string == (char *) NULL) {
+ if (string == NULL) {
Tcl_DStringAppend(dsPtr, before, -1);
break;
} else if (string != before) {
@@ -3418,7 +3375,7 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
}
/*
- * There's a percent sequence here. Process it.
+ * There's a percent sequence here. Process it.
*/
before++; /* skip over % */
@@ -3431,80 +3388,82 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
/*
* -command %-substitution
*/
+
switch (ch) {
- case 's': /* Current string value of spinbox */
- string = entryPtr->string;
- break;
- case 'd': /* direction, up or down */
- string = change;
- break;
- case 'W': /* widget name */
- string = Tk_PathName(entryPtr->tkwin);
- break;
- default:
- length = Tcl_UniCharToUtf(ch, numStorage);
- numStorage[length] = '\0';
- string = numStorage;
- break;
+ case 's': /* Current string value of spinbox */
+ string = entryPtr->string;
+ break;
+ case 'd': /* direction, up or down */
+ string = change;
+ break;
+ case 'W': /* widget name */
+ string = Tk_PathName(entryPtr->tkwin);
+ break;
+ default:
+ length = Tcl_UniCharToUtf(ch, numStorage);
+ numStorage[length] = '\0';
+ string = numStorage;
+ break;
}
} else {
/*
* -validatecommand / -invalidcommand %-substitution
*/
+
switch (ch) {
- case 'd': /* Type of call that caused validation */
- switch (type) {
- case VALIDATE_INSERT:
- number = 1;
- break;
- case VALIDATE_DELETE:
- number = 0;
- break;
- default:
- number = -1;
- break;
- }
- sprintf(numStorage, "%d", number);
- string = numStorage;
- break;
- case 'i': /* index of insert/delete */
- sprintf(numStorage, "%d", index);
- string = numStorage;
+ case 'd': /* Type of call that caused validation */
+ switch (type) {
+ case VALIDATE_INSERT:
+ number = 1;
break;
- case 'P': /* 'Peeked' new value of the string */
- string = new;
+ case VALIDATE_DELETE:
+ number = 0;
break;
- case 's': /* Current string value of spinbox */
- string = entryPtr->string;
- break;
- case 'S': /* string to be inserted/deleted, if any */
- string = change;
- break;
- case 'v': /* type of validation currently set */
- string = validateStrings[entryPtr->validate];
+ default:
+ number = -1;
break;
- case 'V': /* type of validation in effect */
- switch (type) {
- case VALIDATE_INSERT:
- case VALIDATE_DELETE:
- string = validateStrings[VALIDATE_KEY];
- break;
- case VALIDATE_FORCED:
- string = "forced";
- break;
- default:
- string = validateStrings[type];
- break;
- }
+ }
+ sprintf(numStorage, "%d", number);
+ string = numStorage;
+ break;
+ case 'i': /* index of insert/delete */
+ sprintf(numStorage, "%d", index);
+ string = numStorage;
+ break;
+ case 'P': /* 'Peeked' new value of the string */
+ string = newValue;
+ break;
+ case 's': /* Current string value of spinbox */
+ string = entryPtr->string;
+ break;
+ case 'S': /* string to be inserted/deleted, if any */
+ string = change;
+ break;
+ case 'v': /* type of validation currently set */
+ string = validateStrings[entryPtr->validate];
+ break;
+ case 'V': /* type of validation in effect */
+ switch (type) {
+ case VALIDATE_INSERT:
+ case VALIDATE_DELETE:
+ string = validateStrings[VALIDATE_KEY];
break;
- case 'W': /* widget name */
- string = Tk_PathName(entryPtr->tkwin);
+ case VALIDATE_FORCED:
+ string = "forced";
break;
default:
- length = Tcl_UniCharToUtf(ch, numStorage);
- numStorage[length] = '\0';
- string = numStorage;
+ string = validateStrings[type];
break;
+ }
+ break;
+ case 'W': /* widget name */
+ string = Tk_PathName(entryPtr->tkwin);
+ break;
+ default:
+ length = Tcl_UniCharToUtf(ch, numStorage);
+ numStorage[length] = '\0';
+ string = numStorage;
+ break;
}
}
@@ -3523,9 +3482,8 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
*
* Tk_SpinboxObjCmd --
*
- * This procedure is invoked to process the "spinbox" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "spinbox" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3537,11 +3495,11 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
*/
int
-Tk_SpinboxObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_SpinboxObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register Entry *entryPtr;
register Spinbox *sbPtr;
@@ -3555,28 +3513,28 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
/*
- * Create the option table for this widget class. If it has already
- * been created, Tk will return the cached value.
+ * Create the option table for this widget class. If it has already been
+ * created, Tk will return the cached value.
*/
optionTable = Tk_CreateOptionTable(interp, sbOptSpec);
/*
- * Initialize the fields of the structure that won't be initialized
- * by ConfigureEntry, or that ConfigureEntry requires to be
- * initialized already (e.g. resource pointers). Only the non-NULL/0
- * data must be initialized as memset covers the rest.
+ * Initialize the fields of the structure that won't be initialized by
+ * ConfigureEntry, or that ConfigureEntry requires to be initialized
+ * already (e.g. resource pointers). Only the non-NULL/0 data must be
+ * initialized as memset covers the rest.
*/
sbPtr = (Spinbox *) ckalloc(sizeof(Spinbox));
entryPtr = (Entry *) sbPtr;
- memset((VOID *) sbPtr, 0, sizeof(Spinbox));
+ memset(sbPtr, 0, sizeof(Spinbox));
entryPtr->tkwin = tkwin;
entryPtr->display = Tk_Display(tkwin);
@@ -3618,7 +3576,7 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
sbPtr->buRelief = TK_RELIEF_FLAT;
/*
- * Keep a hold of the associated tkwin until we destroy the listbox,
+ * Keep a hold of the associated tkwin until we destroy the spinbox,
* otherwise Tk might free it while we still need it.
*/
@@ -3640,7 +3598,7 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
if (ConfigureEntry(interp, entryPtr, objc-2, objv+2, 0) != TCL_OK) {
goto error;
}
-
+
Tcl_SetResult(interp, Tk_PathName(entryPtr->tkwin), TCL_STATIC);
return TCL_OK;
@@ -3654,9 +3612,9 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
*
* SpinboxWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3668,11 +3626,11 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
*/
static int
-SpinboxWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about spinbox widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+SpinboxWidgetObjCmd(
+ ClientData clientData, /* Information about spinbox widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Entry *entryPtr = (Entry *) clientData;
Spinbox *sbPtr = (Spinbox *) clientData;
@@ -3685,8 +3643,8 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
}
/*
- * Parse the widget command by looking up the second token in
- * the list of valid command names.
+ * Parse the widget command by looking up the second token in the list of
+ * valid command names.
*/
result = Tcl_GetIndexFromObj(interp, objv[1], sbCmdNames,
@@ -3697,471 +3655,454 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
Tcl_Preserve((ClientData) entryPtr);
switch ((enum sbCmd) cmdIndex) {
- case SB_CMD_BBOX: {
- int index, x, y, width, height;
- char buf[TCL_INTEGER_SPACE * 4];
+ case SB_CMD_BBOX: {
+ int index, x, y, width, height;
+ char buf[TCL_INTEGER_SPACE * 4];
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
- }
- if ((index == entryPtr->numChars) && (index > 0)) {
- index--;
- }
- Tk_CharBbox(entryPtr->textLayout, index, &x, &y,
- &width, &height);
- sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX,
- y + entryPtr->layoutY, width, height);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- break;
- }
-
- case SB_CMD_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
- goto error;
- }
-
- objPtr = Tk_GetOptionValue(interp, (char *) entryPtr,
- entryPtr->optionTable, objv[2], entryPtr->tkwin);
- if (objPtr == NULL) {
- goto error;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- }
- break;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
+ goto error;
+ }
+ if ((index == entryPtr->numChars) && (index > 0)) {
+ index--;
}
+ Tk_CharBbox(entryPtr->textLayout, index, &x, &y,
+ &width, &height);
+ sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX,
+ y + entryPtr->layoutY, width, height);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ break;
+ }
- case SB_CMD_CONFIGURE: {
- if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
- entryPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- entryPtr->tkwin);
- if (objPtr == NULL) {
- goto error;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- }
- } else {
- result = ConfigureEntry(interp, entryPtr, objc-2, objv+2, 0);
- }
- break;
+ case SB_CMD_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ goto error;
}
- case SB_CMD_DELETE: {
- int first, last;
+ objPtr = Tk_GetOptionValue(interp, (char *) entryPtr,
+ entryPtr->optionTable, objv[2], entryPtr->tkwin);
+ if (objPtr == NULL) {
+ goto error;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ }
+ break;
- if ((objc < 3) || (objc > 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
+ case SB_CMD_CONFIGURE:
+ if (objc <= 3) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
+ entryPtr->optionTable,
+ (objc == 3) ? objv[2] : NULL,
+ entryPtr->tkwin);
+ if (objPtr == NULL) {
goto error;
- }
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &first) != TCL_OK) {
- goto error;
- }
- if (objc == 3) {
- last = first + 1;
} else {
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
- &last) != TCL_OK) {
- goto error;
- }
- }
- if ((last >= first) && (entryPtr->state == STATE_NORMAL)) {
- DeleteChars(entryPtr, first, last - first);
+ Tcl_SetObjResult(interp, objPtr);
}
- break;
+ } else {
+ result = ConfigureEntry(interp, entryPtr, objc-2, objv+2, 0);
}
+ break;
+
+ case SB_CMD_DELETE: {
+ int first, last;
- case SB_CMD_GET: {
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ if ((objc < 3) || (objc > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &first) != TCL_OK) {
+ goto error;
+ }
+ if (objc == 3) {
+ last = first + 1;
+ } else {
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
+ &last) != TCL_OK) {
goto error;
}
- Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
- break;
}
+ if ((last >= first) && (entryPtr->state == STATE_NORMAL)) {
+ DeleteChars(entryPtr, first, last - first);
+ }
+ break;
+ }
- case SB_CMD_ICURSOR: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "pos");
+ case SB_CMD_GET:
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ goto error;
+ }
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
+ break;
+
+ case SB_CMD_ICURSOR:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pos");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &entryPtr->insertPos) != TCL_OK) {
+ goto error;
+ }
+ EventuallyRedraw(entryPtr);
+ break;
+
+ case SB_CMD_IDENTIFY: {
+ int x, y, elem;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "x y");
+ goto error;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) ||
+ (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
+ goto error;
+ }
+ elem = GetSpinboxElement(sbPtr, x, y);
+ if (elem != SEL_NONE) {
+ Tcl_SetStringObj(Tcl_GetObjResult(interp),
+ selElementNames[elem], -1);
+ }
+ break;
+ }
+
+ case SB_CMD_INDEX: {
+ int index;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "string");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
+ goto error;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ break;
+ }
+
+ case SB_CMD_INSERT: {
+ int index;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index text");
+ goto error;
+ }
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
+ goto error;
+ }
+ if (entryPtr->state == STATE_NORMAL) {
+ InsertChars(entryPtr, index, Tcl_GetString(objv[3]));
+ }
+ break;
+ }
+
+ case SB_CMD_INVOKE:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "elemName");
+ goto error;
+ }
+ result = Tcl_GetIndexFromObj(interp, objv[2],
+ selElementNames, "element", 0, &cmdIndex);
+ if (result != TCL_OK) {
+ goto error;
+ }
+ if (entryPtr->state != STATE_DISABLED) {
+ if (SpinboxInvoke(interp, sbPtr, cmdIndex) != TCL_OK) {
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &entryPtr->insertPos) != TCL_OK) {
- goto error;
- }
- EventuallyRedraw(entryPtr);
- break;
}
-
- case SB_CMD_IDENTIFY: {
- int x, y, elem;
+ break;
+ case SB_CMD_SCAN: {
+ int x;
+ char *minorCmd;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x");
+ goto error;
+ }
+ if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
+ goto error;
+ }
+
+ minorCmd = Tcl_GetString(objv[2]);
+ if (minorCmd[0] == 'm'
+ && (strncmp(minorCmd, "mark", strlen(minorCmd)) == 0)) {
+ entryPtr->scanMarkX = x;
+ entryPtr->scanMarkIndex = entryPtr->leftIndex;
+ } else if ((minorCmd[0] == 'd')
+ && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) {
+ EntryScanTo(entryPtr, x);
+ } else {
+ Tcl_AppendResult(interp, "bad scan option \"",
+ Tcl_GetString(objv[2]), "\": must be mark or dragto",
+ NULL);
+ goto error;
+ }
+ break;
+ }
+
+ case SB_CMD_SELECTION: {
+ int index, index2;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
+ goto error;
+ }
+
+ /*
+ * Parse the selection sub-command, using the command table
+ * "sbSelCmdNames" defined above.
+ */
+
+ result = Tcl_GetIndexFromObj(interp, objv[2], sbSelCmdNames,
+ "selection option", 0, &selIndex);
+ if (result != TCL_OK) {
+ goto error;
+ }
+
+ /*
+ * Disabled entries don't allow the selection to be modified, but
+ * 'selection present' must return a boolean.
+ */
+
+ if ((entryPtr->state == STATE_DISABLED)
+ && (selIndex != SB_SEL_PRESENT)) {
+ goto done;
+ }
+
+ switch (selIndex) {
+ case SB_SEL_ADJUST:
if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "x y");
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
goto error;
}
- if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) ||
- (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[3]), &index) != TCL_OK) {
goto error;
}
- elem = GetSpinboxElement(sbPtr, x, y);
- if (elem != SEL_NONE) {
- Tcl_SetStringObj(Tcl_GetObjResult(interp),
- selElementNames[elem], -1);
+ if (entryPtr->selectFirst >= 0) {
+ int half1, half2;
+
+ half1 = (entryPtr->selectFirst + entryPtr->selectLast)/2;
+ half2 = (entryPtr->selectFirst + entryPtr->selectLast + 1)/2;
+ if (index < half1) {
+ entryPtr->selectAnchor = entryPtr->selectLast;
+ } else if (index > half2) {
+ entryPtr->selectAnchor = entryPtr->selectFirst;
+ } else {
+ /*
+ * We're at about the halfway point in the selection; just
+ * keep the existing anchor.
+ */
+ }
}
+ EntrySelectTo(entryPtr, index);
break;
- }
-
- case SB_CMD_INDEX: {
- int index;
+ case SB_SEL_CLEAR:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "string");
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
+ if (entryPtr->selectFirst >= 0) {
+ entryPtr->selectFirst = -1;
+ entryPtr->selectLast = -1;
+ EventuallyRedraw(entryPtr);
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
- break;
- }
-
- case SB_CMD_INSERT: {
- int index;
+ goto done;
+ case SB_SEL_FROM:
if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "index text");
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
- }
- if (entryPtr->state == STATE_NORMAL) {
- InsertChars(entryPtr, index, Tcl_GetString(objv[3]));
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ goto error;
}
+ entryPtr->selectAnchor = index;
break;
- }
- case SB_CMD_INVOKE: {
+ case SB_SEL_PRESENT:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "elemName");
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
- result = Tcl_GetIndexFromObj(interp, objv[2],
- selElementNames, "element", 0, &cmdIndex);
- if (result != TCL_OK) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj((entryPtr->selectFirst >= 0)));
+ goto done;
+
+ case SB_SEL_RANGE:
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "start end");
goto error;
}
- if (entryPtr->state != STATE_DISABLED) {
- if (SpinboxInvoke(interp, sbPtr, cmdIndex) != TCL_OK) {
- goto error;
- }
- }
- break;
- }
-
- case SB_CMD_SCAN: {
- int x;
- char *minorCmd;
-
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x");
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[3]), &index) != TCL_OK) {
goto error;
}
- if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
- goto error;
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[4]),& index2) != TCL_OK) {
+ goto error;
}
-
- minorCmd = Tcl_GetString(objv[2]);
- if (minorCmd[0] == 'm'
- && (strncmp(minorCmd, "mark", strlen(minorCmd)) == 0)) {
- entryPtr->scanMarkX = x;
- entryPtr->scanMarkIndex = entryPtr->leftIndex;
- } else if ((minorCmd[0] == 'd')
- && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) {
- EntryScanTo(entryPtr, x);
+ if (index >= index2) {
+ entryPtr->selectFirst = -1;
+ entryPtr->selectLast = -1;
} else {
- Tcl_AppendResult(interp, "bad scan option \"",
- Tcl_GetString(objv[2]), "\": must be mark or dragto",
- (char *) NULL);
- goto error;
+ entryPtr->selectFirst = index;
+ entryPtr->selectLast = index2;
+ }
+ if (!(entryPtr->flags & GOT_SELECTION)
+ && (entryPtr->exportSelection)) {
+ Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
+ EntryLostSelection, (ClientData) entryPtr);
+ entryPtr->flags |= GOT_SELECTION;
}
+ EventuallyRedraw(entryPtr);
break;
- }
-
- case SB_CMD_SELECTION: {
- int index, index2;
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
+ case SB_SEL_TO:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
goto error;
}
-
- /*
- * Parse the selection sub-command, using the command
- * table "sbSelCmdNames" defined above.
- */
-
- result = Tcl_GetIndexFromObj(interp, objv[2], sbSelCmdNames,
- "selection option", 0, &selIndex);
- if (result != TCL_OK) {
- goto error;
+ if (GetEntryIndex(interp, entryPtr,
+ Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ goto error;
}
+ EntrySelectTo(entryPtr, index);
+ break;
- /*
- * Disabled entries don't allow the selection to be modified,
- * but 'selection present' must return a boolean.
- */
-
- if ((entryPtr->state == STATE_DISABLED)
- && (selIndex != SB_SEL_PRESENT)) {
- goto done;
+ case SB_SEL_ELEMENT:
+ if ((objc < 3) || (objc > 4)) {
+ Tcl_WrongNumArgs(interp, 3, objv, "?elemName?");
+ goto error;
}
+ if (objc == 3) {
+ Tcl_SetStringObj(Tcl_GetObjResult(interp),
+ selElementNames[sbPtr->selElement], -1);
+ } else {
+ int lastElement = sbPtr->selElement;
- switch (selIndex) {
- case SB_SEL_ADJUST: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- if (entryPtr->selectFirst >= 0) {
- int half1, half2;
-
- half1 = (entryPtr->selectFirst
- + entryPtr->selectLast)/2;
- half2 = (entryPtr->selectFirst
- + entryPtr->selectLast + 1)/2;
- if (index < half1) {
- entryPtr->selectAnchor = entryPtr->selectLast;
- } else if (index > half2) {
- entryPtr->selectAnchor = entryPtr->selectFirst;
- } else {
- /*
- * We're at about the halfway point in the
- * selection; just keep the existing anchor.
- */
- }
- }
- EntrySelectTo(entryPtr, index);
- break;
- }
-
- case SB_SEL_CLEAR: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
- goto error;
- }
- if (entryPtr->selectFirst >= 0) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
- EventuallyRedraw(entryPtr);
- }
- goto done;
- }
-
- case SB_SEL_FROM: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- entryPtr->selectAnchor = index;
- break;
- }
-
- case SB_SEL_PRESENT: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
- goto error;
- }
- Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj((entryPtr->selectFirst >= 0)));
- goto done;
+ result = Tcl_GetIndexFromObj(interp, objv[3], selElementNames,
+ "selection element", 0, &(sbPtr->selElement));
+ if (result != TCL_OK) {
+ goto error;
}
-
- case SB_SEL_RANGE: {
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "start end");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[4]),& index2) != TCL_OK) {
- goto error;
- }
- if (index >= index2) {
- entryPtr->selectFirst = -1;
- entryPtr->selectLast = -1;
- } else {
- entryPtr->selectFirst = index;
- entryPtr->selectLast = index2;
- }
- if (!(entryPtr->flags & GOT_SELECTION)
- && (entryPtr->exportSelection)) {
- Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
- EntryLostSelection, (ClientData) entryPtr);
- entryPtr->flags |= GOT_SELECTION;
- }
+ if (lastElement != sbPtr->selElement) {
EventuallyRedraw(entryPtr);
- break;
- }
-
- case SB_SEL_TO: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- goto error;
- }
- if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
- goto error;
- }
- EntrySelectTo(entryPtr, index);
- break;
- }
-
- case SB_SEL_ELEMENT: {
- if ((objc < 3) || (objc > 4)) {
- Tcl_WrongNumArgs(interp, 3, objv, "?elemName?");
- goto error;
- }
- if (objc == 3) {
- Tcl_SetStringObj(Tcl_GetObjResult(interp),
- selElementNames[sbPtr->selElement], -1);
- } else {
- int lastElement = sbPtr->selElement;
-
- result = Tcl_GetIndexFromObj(interp, objv[3],
- selElementNames, "selection element", 0,
- &(sbPtr->selElement));
- if (result != TCL_OK) {
- goto error;
- }
- if (lastElement != sbPtr->selElement) {
- EventuallyRedraw(entryPtr);
- }
- }
- break;
}
}
break;
}
+ break;
+ }
+
+ case SB_CMD_SET:
+ if (objc > 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?string?");
+ goto error;
+ }
+ if (objc == 3) {
+ EntryValueChanged(entryPtr, Tcl_GetString(objv[2]));
+ }
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
+ break;
- case SB_CMD_SET: {
- if (objc > 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "?string?");
- goto error;
- }
- if (objc == 3) {
- EntryValueChanged(entryPtr, Tcl_GetString(objv[2]));
- }
- Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
- break;
+ case SB_CMD_VALIDATE: {
+ int code;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ goto error;
}
+ selIndex = entryPtr->validate;
+ entryPtr->validate = VALIDATE_ALL;
+ code = EntryValidateChange(entryPtr, NULL, entryPtr->string,
+ -1, VALIDATE_FORCED);
+ if (entryPtr->validate != VALIDATE_NONE) {
+ entryPtr->validate = selIndex;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj((code == TCL_OK)));
+ break;
+ }
- case SB_CMD_VALIDATE: {
- int code;
+ case SB_CMD_XVIEW: {
+ int index;
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ if (objc == 2) {
+ double first, last;
+ char buf[TCL_DOUBLE_SPACE];
+
+ EntryVisibleRange(entryPtr, &first, &last);
+ Tcl_PrintDouble(NULL, first, buf);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_PrintDouble(NULL, last, buf);
+ Tcl_AppendResult(interp, " ", buf, NULL);
+ goto done;
+ } else if (objc == 3) {
+ if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ &index) != TCL_OK) {
goto error;
}
- selIndex = entryPtr->validate;
- entryPtr->validate = VALIDATE_ALL;
- code = EntryValidateChange(entryPtr, (char *) NULL,
- entryPtr->string, -1, VALIDATE_FORCED);
- if (entryPtr->validate != VALIDATE_NONE) {
- entryPtr->validate = selIndex;
- }
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj((code == TCL_OK)));
- break;
- }
+ } else {
+ double fraction;
+ int count;
- case SB_CMD_XVIEW: {
- int index;
-
- if (objc == 2) {
- double first, last;
- char buf[TCL_DOUBLE_SPACE * 2];
-
- EntryVisibleRange(entryPtr, &first, &last);
- sprintf(buf, "%g %g", first, last);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- goto done;
- } else if (objc == 3) {
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
- &index) != TCL_OK) {
- goto error;
- }
- } else {
- double fraction;
- int count;
-
- index = entryPtr->leftIndex;
- switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction,
- &count)) {
- case TK_SCROLL_ERROR: {
- goto error;
- }
- case TK_SCROLL_MOVETO: {
- index = (int) ((fraction * entryPtr->numChars) + 0.5);
- break;
- }
- case TK_SCROLL_PAGES: {
- int charsPerPage;
-
- charsPerPage = ((Tk_Width(entryPtr->tkwin)
- - 2 * entryPtr->inset - entryPtr->xWidth)
- / entryPtr->avgWidth) - 2;
- if (charsPerPage < 1) {
- charsPerPage = 1;
- }
- index += count * charsPerPage;
- break;
- }
- case TK_SCROLL_UNITS: {
- index += count;
- break;
- }
+ index = entryPtr->leftIndex;
+ switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction,
+ &count)) {
+ case TK_SCROLL_ERROR:
+ goto error;
+ case TK_SCROLL_MOVETO:
+ index = (int) ((fraction * entryPtr->numChars) + 0.5);
+ break;
+ case TK_SCROLL_PAGES: {
+ int charsPerPage;
+
+ charsPerPage = ((Tk_Width(entryPtr->tkwin)
+ - 2 * entryPtr->inset - entryPtr->xWidth)
+ / entryPtr->avgWidth) - 2;
+ if (charsPerPage < 1) {
+ charsPerPage = 1;
}
+ index += count * charsPerPage;
+ break;
}
- if (index >= entryPtr->numChars) {
- index = entryPtr->numChars - 1;
+ case TK_SCROLL_UNITS:
+ index += count;
+ break;
}
- if (index < 0) {
- index = 0;
- }
- entryPtr->leftIndex = index;
- entryPtr->flags |= UPDATE_SCROLLBAR;
- EntryComputeGeometry(entryPtr);
- EventuallyRedraw(entryPtr);
- break;
}
+ if (index >= entryPtr->numChars) {
+ index = entryPtr->numChars - 1;
+ }
+ if (index < 0) {
+ index = 0;
+ }
+ entryPtr->leftIndex = index;
+ entryPtr->flags |= UPDATE_SCROLLBAR;
+ EntryComputeGeometry(entryPtr);
+ EventuallyRedraw(entryPtr);
+ break;
+ }
}
- done:
+ done:
Tcl_Release((ClientData) entryPtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) entryPtr);
return TCL_ERROR;
}
@@ -4183,11 +4124,10 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
*/
static int
-GetSpinboxElement(sbPtr, x, y)
- Spinbox *sbPtr; /* Spinbox for which the index is being
+GetSpinboxElement(
+ Spinbox *sbPtr, /* Spinbox for which the index is being
* specified. */
- int x; /* x coord */
- int y; /* y coord */
+ int x, int y) /* Widget-relative coordinates. */
{
Entry *entryPtr = (Entry *) sbPtr;
@@ -4211,25 +4151,25 @@ GetSpinboxElement(sbPtr, x, y)
*
* SpinboxInvoke --
*
- * This procedure is invoked when the invoke method for the
- * widget is called.
+ * This function is invoked when the invoke method for the widget is
+ * called.
*
* Results:
* TCL_OK.
*
* Side effects:
- * An background error condition may arise when invoking the
- * callback. The widget value may change.
+ * An background error condition may arise when invoking the callback.
+ * The widget value may change.
*
*--------------------------------------------------------------
*/
static int
-SpinboxInvoke(interp, sbPtr, element)
- register Tcl_Interp *interp; /* Current interpreter. */
- register Spinbox *sbPtr; /* Spinbox to invoke. */
- int element; /* element to invoke, either the "up"
- * or "down" button. */
+SpinboxInvoke(
+ register Tcl_Interp *interp,/* Current interpreter. */
+ register Spinbox *sbPtr, /* Spinbox to invoke. */
+ int element) /* Element to invoke, either the "up" or
+ * "down" button. */
{
Entry *entryPtr = (Entry *) sbPtr;
char *type;
@@ -4237,16 +4177,16 @@ SpinboxInvoke(interp, sbPtr, element)
Tcl_DString script;
switch (element) {
- case SEL_BUTTONUP:
- type = "up";
- up = 1;
- break;
- case SEL_BUTTONDOWN:
- type = "down";
- up = 0;
- break;
- default:
- return TCL_OK;
+ case SEL_BUTTONUP:
+ type = "up";
+ up = 1;
+ break;
+ case SEL_BUTTONDOWN:
+ type = "down";
+ up = 0;
+ break;
+ default:
+ return TCL_OK;
}
if (fabs(sbPtr->increment) > MIN_DBL_VAL) {
@@ -4256,11 +4196,11 @@ SpinboxInvoke(interp, sbPtr, element)
Tcl_ListObjIndex(interp, sbPtr->listObj, sbPtr->eIndex, &objPtr);
if (strcmp(Tcl_GetString(objPtr), entryPtr->string)) {
/*
- * Somehow the string changed from what we expected,
- * so let's do a search on the list to see if the current
- * value is there. If not, move to the first element of
- * the list.
+ * Somehow the string changed from what we expected, so let's
+ * do a search on the list to see if the current value is
+ * there. If not, move to the first element of the list.
*/
+
int i, listc, elemLen, length = entryPtr->numChars;
char *bytes;
Tcl_Obj **listv;
@@ -4298,45 +4238,46 @@ SpinboxInvoke(interp, sbPtr, element)
} else if (!DOUBLES_EQ(sbPtr->fromValue, sbPtr->toValue)) {
double dvalue;
- if (Tcl_GetDouble(NULL, entryPtr->string, &dvalue) != TCL_OK) {
+ if (sscanf(entryPtr->string, "%lf", &dvalue) == 0) {
/*
- * If the string is empty, or isn't a valid double value,
- * just use the -from value
+ * If the string doesn't scan as a double value, just
+ * use the -from value
*/
+
dvalue = sbPtr->fromValue;
- } else {
- if (up) {
- dvalue += sbPtr->increment;
- if (dvalue > sbPtr->toValue) {
- if (sbPtr->wrap) {
- dvalue = sbPtr->fromValue;
- } else {
- dvalue = sbPtr->toValue;
- }
- } else if (dvalue < sbPtr->fromValue) {
- /*
- * It's possible that when pressing up, we are
- * still less than the fromValue, because the
- * user may have manipulated the value by hand.
- */
+ } else if (up) {
+ dvalue += sbPtr->increment;
+ if (dvalue > sbPtr->toValue) {
+ if (sbPtr->wrap) {
dvalue = sbPtr->fromValue;
+ } else {
+ dvalue = sbPtr->toValue;
}
- } else {
- dvalue -= sbPtr->increment;
- if (dvalue < sbPtr->fromValue) {
- if (sbPtr->wrap) {
- dvalue = sbPtr->toValue;
- } else {
- dvalue = sbPtr->fromValue;
- }
- } else if (dvalue > sbPtr->toValue) {
- /*
- * It's possible that when pressing down, we are
- * still greater than the toValue, because the
- * user may have manipulated the value by hand.
- */
+ } else if (dvalue < sbPtr->fromValue) {
+ /*
+ * It's possible that when pressing up, we are still less
+ * than the fromValue, because the user may have
+ * manipulated the value by hand.
+ */
+
+ dvalue = sbPtr->fromValue;
+ }
+ } else {
+ dvalue -= sbPtr->increment;
+ if (dvalue < sbPtr->fromValue) {
+ if (sbPtr->wrap) {
dvalue = sbPtr->toValue;
+ } else {
+ dvalue = sbPtr->fromValue;
}
+ } else if (dvalue > sbPtr->toValue) {
+ /*
+ * It's possible that when pressing down, we are still
+ * greater than the toValue, because the user may have
+ * manipulated the value by hand.
+ */
+
+ dvalue = sbPtr->toValue;
}
}
sprintf(sbPtr->formatBuf, sbPtr->valueFormat, dvalue);
@@ -4357,9 +4298,11 @@ SpinboxInvoke(interp, sbPtr, element)
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n\t(in command executed by spinbox)");
Tcl_BackgroundError(interp);
+
/*
* Yes, it's an error, but a bg one, so we return OK
*/
+
return TCL_OK;
}
@@ -4374,9 +4317,9 @@ SpinboxInvoke(interp, sbPtr, element)
*
* ComputeFormat --
*
- * This procedure is invoked to recompute the "format" fields
- * of a spinbox's widget record, which determines how the value
- * of the dial is converted to a string.
+ * This function is invoked to recompute the "format" fields of a
+ * spinbox's widget record, which determines how the value of the dial is
+ * converted to a string.
*
* Results:
* Tcl result code.
@@ -4386,17 +4329,18 @@ SpinboxInvoke(interp, sbPtr, element)
*
*----------------------------------------------------------------------
*/
+
static int
-ComputeFormat(sbPtr)
- Spinbox *sbPtr; /* Information about dial widget. */
+ComputeFormat(
+ Spinbox *sbPtr) /* Information about dial widget. */
{
double maxValue, x;
int mostSigDigit, numDigits, leastSigDigit, afterDecimal;
int eDigits, fDigits;
/*
- * Compute the displacement from the decimal of the most significant
- * digit required for any number in the dial's range.
+ * Compute the displacement from the decimal of the most significant digit
+ * required for any number in the dial's range.
*/
if (sbPtr->reqFormat) {
@@ -4418,6 +4362,7 @@ ComputeFormat(sbPtr)
/*
* A increment was specified, so use it.
*/
+
leastSigDigit = (int) floor(log10(sbPtr->increment));
} else {
leastSigDigit = 0;
@@ -4428,13 +4373,13 @@ ComputeFormat(sbPtr)
}
/*
- * Compute the number of characters required using "e" format and
- * "f" format, and then choose whichever one takes fewer characters.
+ * Compute the number of characters required using "e" format and "f"
+ * format, and then choose whichever one takes fewer characters.
*/
eDigits = numDigits + 4;
if (numDigits > 1) {
- eDigits++; /* Decimal point. */
+ eDigits++; /* Decimal point. */
}
afterDecimal = numDigits - mostSigDigit - 1;
if (afterDecimal < 0) {
@@ -4442,10 +4387,10 @@ ComputeFormat(sbPtr)
}
fDigits = (mostSigDigit >= 0) ? mostSigDigit + afterDecimal : afterDecimal;
if (afterDecimal > 0) {
- fDigits++; /* Decimal point. */
+ fDigits++; /* Decimal point. */
}
if (mostSigDigit < 0) {
- fDigits++; /* Zero to left of decimal point. */
+ fDigits++; /* Zero to left of decimal point. */
}
if (fDigits <= eDigits) {
sprintf(sbPtr->digitFormat, "%%.%df", afterDecimal);
@@ -4455,3 +4400,11 @@ ComputeFormat(sbPtr)
sbPtr->valueFormat = sbPtr->digitFormat;
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkEntry.h b/generic/tkEntry.h
index 3bb2f1d..7f8aa1f 100644
--- a/generic/tkEntry.h
+++ b/generic/tkEntry.h
@@ -1,13 +1,12 @@
/*
* tkEntry.h --
- *
- * This module defined the structures for the Entry & SpinBox widgets.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * This module defined the structures for the Entry & SpinBox widgets.
*
- * Copyright (c) 2002 Apple Computer, Inc.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
+ * Copyright (c) 2002 Apple Computer, Inc.
*/
#ifndef _TKENTRY
@@ -18,8 +17,8 @@
#endif
#ifdef BUILD_tk
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLEXPORT
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
#endif
enum EntryType {
@@ -27,16 +26,16 @@ enum EntryType {
};
/*
- * A data structure of the following type is kept for each Entry
- * widget managed by this file:
+ * A data structure of the following type is kept for each Entry widget
+ * managed by this file:
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the entry. NULL
- * means that the window has been destroyed
- * but the data structures haven't yet been
- * cleaned up.*/
- Display *display; /* Display containing widget. Used, among
+ Tk_Window tkwin; /* Window that embodies the entry. NULL means
+ * that the window has been destroyed but the
+ * data structures haven't yet been cleaned
+ * up.*/
+ Display *display; /* Display containing widget. Used, among
* other things, so that resources can be
* freed even after tkwin has gone away. */
Tcl_Interp *interp; /* Interpreter associated with entry. */
@@ -48,9 +47,9 @@ typedef struct {
/*
* Fields that are set by widget commands other than "configure".
*/
-
+
CONST char *string; /* Pointer to storage for string;
- * NULL-terminated; malloc-ed. */
+ * NULL-terminated; malloc-ed. */
int insertPos; /* Character index before which next typed
* character will be inserted. */
@@ -58,8 +57,8 @@ typedef struct {
* Information about what's selected, if any.
*/
- int selectFirst; /* Character index of first selected
- * character (-1 means nothing selected. */
+ int selectFirst; /* Character index of first selected character
+ * (-1 means nothing selected. */
int selectLast; /* Character index just after last selected
* character (-1 means nothing selected. */
int selectAnchor; /* Fixed end of selection (i.e. "select to"
@@ -81,11 +80,11 @@ typedef struct {
Tk_3DBorder normalBorder; /* Used for drawing border around whole
* window, plus used for background. */
- Tk_3DBorder disabledBorder; /* Used for drawing border around whole
- * window in disabled state, plus used for
+ Tk_3DBorder disabledBorder; /* Used for drawing border around whole window
+ * in disabled state, plus used for
* background. */
- Tk_3DBorder readonlyBorder; /* Used for drawing border around whole
- * window in readonly state, plus used for
+ Tk_3DBorder readonlyBorder; /* Used for drawing border around whole window
+ * in readonly state, plus used for
* background. */
int borderWidth; /* Width of 3-D border around window. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
@@ -94,12 +93,12 @@ typedef struct {
Tk_Font tkfont; /* Information about text font, or NULL. */
XColor *fgColorPtr; /* Text color in normal mode. */
XColor *dfgColorPtr; /* Text color in disabled mode. */
- XColor *highlightBgColorPtr;/* Color for drawing traversal highlight
- * area when highlight is off. */
+ XColor *highlightBgColorPtr;/* Color for drawing traversal highlight area
+ * when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * <= 0 means don't draw a highlight. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. <= 0 means
+ * don't draw a highlight. */
Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion
* cursor. */
int insertBorderWidth; /* Width of 3-D border around insert cursor. */
@@ -115,44 +114,46 @@ typedef struct {
* characters. */
int selBorderWidth; /* Width of border around selection. */
XColor *selFgColorPtr; /* Foreground color for selected text. */
- int state; /* Normal or disabled. Entry is read-only
- * when disabled. */
- char *textVarName; /* Name of variable (malloc'ed) or NULL.
- * If non-NULL, entry's string tracks the
- * contents of this variable and vice versa. */
- char *takeFocus; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
+ int state; /* Normal or disabled. Entry is read-only when
+ * disabled. */
+ char *textVarName; /* Name of variable (malloc'ed) or NULL. If
+ * non-NULL, entry's string tracks the
+ * contents of this variable and vice
+ * versa. */
+ char *takeFocus; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
int prefWidth; /* Desired width of window, measured in
* average characters. */
char *scrollCmd; /* Command prefix for communicating with
- * scrollbar(s). Malloc'ed. NULL means
- * no command to issue. */
- char *showChar; /* Value of -show option. If non-NULL, first
+ * scrollbar(s). Malloc'ed. NULL means no
+ * command to issue. */
+ char *showChar; /* Value of -show option. If non-NULL, first
* character is used for displaying all
- * characters in entry. Malloc'ed.
- * This is only used by the Entry widget. */
+ * characters in entry. Malloc'ed. This is
+ * only used by the Entry widget. */
/*
* Fields whose values are derived from the current values of the
* configuration settings above.
*/
- CONST char *displayString; /* String to use when displaying. This may
- * be a pointer to string, or a pointer to
+ CONST char *displayString; /* String to use when displaying. This may be
+ * a pointer to string, or a pointer to
* malloced memory with the same character
- * length as string but whose characters
- * are all equal to showChar. */
+ * length as string but whose characters are
+ * all equal to showChar. */
int numBytes; /* Length of string in bytes. */
- int numChars; /* Length of string in characters. Both
- * string and displayString have the same
- * character length, but may have different
- * byte lengths due to being made from
- * different UTF-8 characters. */
+ int numChars; /* Length of string in characters. Both string
+ * and displayString have the same character
+ * length, but may have different byte lengths
+ * due to being made from different UTF-8
+ * characters. */
int numDisplayBytes; /* Length of displayString in bytes. */
int inset; /* Number of pixels on the left and right
- * sides that are taken up by XPAD, borderWidth
- * (if any), and highlightWidth (if any). */
+ * sides that are taken up by XPAD,
+ * borderWidth (if any), and highlightWidth
+ * (if any). */
Tk_TextLayout textLayout; /* Cached text layout information. */
int layoutX, layoutY; /* Origin for layout. */
int leftX; /* X position at which character at leftIndex
@@ -166,23 +167,22 @@ typedef struct {
GC selTextGC; /* For drawing selected text. */
GC highlightGC; /* For drawing traversal highlight. */
int avgWidth; /* Width of average character. */
- int xWidth; /* Extra width to reserve for widget.
- * Used by spinboxes for button space. */
- int flags; /* Miscellaneous flags; see below for
+ int xWidth; /* Extra width to reserve for widget. Used by
+ * spinboxes for button space. */
+ int flags; /* Miscellaneous flags; see below for
* definitions. */
- int validate; /* Non-zero means try to validate */
- char *validateCmd; /* Command prefix to use when invoking
- * validate command. NULL means don't
- * invoke commands. Malloc'ed. */
+ int validate; /* Non-zero means try to validate */
+ char *validateCmd; /* Command prefix to use when invoking
+ * validate command. NULL means don't invoke
+ * commands. Malloc'ed. */
char *invalidCmd; /* Command called when a validation returns 0
* (successfully fails), defaults to {}. */
-
} Entry;
/*
- * A data structure of the following type is kept for each spinbox
- * widget managed by this file:
+ * A data structure of the following type is kept for each spinbox widget
+ * managed by this file:
*/
typedef struct {
@@ -200,8 +200,8 @@ typedef struct {
Tk_Cursor bCursor; /* cursor for buttons, or None. */
int bdRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
int buRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
- char *command; /* Command to invoke for spin buttons.
- * NULL means no command to issue. */
+ char *command; /* Command to invoke for spin buttons. NULL
+ * means no command to issue. */
/*
* Spinbox specific fields for use with configuration settings above.
@@ -216,38 +216,37 @@ typedef struct {
int repeatInterval; /* repeat interval */
double fromValue; /* Value corresponding to left/top of dial */
- double toValue; /* Value corresponding to right/bottom
- * of dial */
- double increment; /* If > 0, all values are rounded to an
- * even multiple of this value. */
+ double toValue; /* Value corresponding to right/bottom of
+ * dial */
+ double increment; /* If > 0, all values are rounded to an even
+ * multiple of this value. */
char *formatBuf; /* string into which to format value.
* Malloc'ed. */
char *reqFormat; /* Sprintf conversion specifier used for the
- * value that the users requests. Malloc'ed. */
- char *valueFormat; /* Sprintf conversion specifier used for
- * the value. */
+ * value that the users requests. Malloc'ed */
+ char *valueFormat; /* Sprintf conversion specifier used for the
+ * value. */
char digitFormat[10]; /* Sprintf conversion specifier computed from
- * digits and other information; used for
- * the value. */
+ * digits and other information; used for the
+ * value. */
char *valueStr; /* Values List. Malloc'ed. */
Tcl_Obj *listObj; /* Pointer to the list object being used */
int eIndex; /* Holds the current index into elements */
int nElements; /* Holds the current count of elements */
-
} Spinbox;
/*
- * Assigned bits of "flags" fields of Entry structures, and what those
- * bits mean:
+ * Assigned bits of "flags" fields of Entry structures, and what those bits
+ * mean:
*
* REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
* already been queued to redisplay the entry.
* BORDER_NEEDED: Non-zero means 3-D border must be redrawn
- * around window during redisplay. Normally
- * only text portion needs to be redrawn.
+ * around window during redisplay. Normally only
+ * text portion needs to be redrawn.
* CURSOR_ON: Non-zero means insert cursor is displayed at
- * present. 0 means it isn't displayed.
+ * present. 0 means it isn't displayed.
* GOT_FOCUS: Non-zero means this window has the input
* focus.
* UPDATE_SCROLLBAR: Non-zero means scrollbar should be updated
@@ -268,40 +267,40 @@ typedef struct {
#define GOT_FOCUS 8
#define UPDATE_SCROLLBAR 0x10
#define GOT_SELECTION 0x20
-#define ENTRY_DELETED 0x40
-#define VALIDATING 0x80
-#define VALIDATE_VAR 0x100
-#define VALIDATE_ABORT 0x200
-#define ENTRY_VAR_TRACED 0x400
+#define ENTRY_DELETED 0x40
+#define VALIDATING 0x80
+#define VALIDATE_VAR 0x100
+#define VALIDATE_ABORT 0x200
+#define ENTRY_VAR_TRACED 0x400
/*
- * The following enum is used to define a type for the -state option
- * of the Entry widget. These values are used as indices into the
- * string table below.
+ * The following enum is used to define a type for the -state option of the
+ * Entry widget. These values are used as indices into the string table below.
*/
enum state {
STATE_DISABLED, STATE_NORMAL, STATE_READONLY
};
-/*
+/*
* This is the element index corresponding to the strings in selElementNames.
* If you modify them, you must modify the numbers here.
*/
-
+
enum selelement {
SEL_NONE, SEL_BUTTONDOWN, SEL_BUTTONUP, SEL_NULL, SEL_ENTRY
};
/*
- * Declaration of procedures used in the implementation of the native side
- * of the Entry widget.
+ * Declaration of functions used in the implementation of the native side of
+ * the Entry widget.
*/
-int TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox);
-int TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d);
+MODULE_SCOPE int TkpDrawEntryBorderAndFocus(Entry *entryPtr,
+ Drawable d, int isSpinbox);
+MODULE_SCOPE int TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d);
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLIMPORT
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLIMPORT
-#endif /* _TKBUTTON */
+#endif /* _TKENTRY */
diff --git a/generic/tkError.c b/generic/tkError.c
index dabf898..6617c37 100644
--- a/generic/tkError.c
+++ b/generic/tkError.c
@@ -1,109 +1,98 @@
-/*
+/*
* tkError.c --
*
- * This file provides a high-performance mechanism for
- * selectively dealing with errors that occur in talking
- * to the X server. This is useful, for example, when
- * communicating with a window that may not exist.
+ * This file provides a high-performance mechanism for selectively
+ * dealing with errors that occur in talking to the X server. This is
+ * useful, for example, when communicating with a window that may not
+ * exist.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
- * The default X error handler gets saved here, so that it can
- * be invoked if an error occurs that we can't handle.
+ * The default X error handler gets saved here, so that it can be invoked if
+ * an error occurs that we can't handle.
*/
-static int (*defaultHandler) _ANSI_ARGS_((Display *display,
- XErrorEvent *eventPtr)) = NULL;
-
+typedef int (*TkXErrorHandler)(Display *display, XErrorEvent *eventPtr);
+static TkXErrorHandler defaultHandler = NULL;
/*
* Forward references to procedures declared later in this file:
*/
-static int ErrorProc _ANSI_ARGS_((Display *display,
- XErrorEvent *errEventPtr));
+static int ErrorProc(Display *display, XErrorEvent *errEventPtr);
/*
*--------------------------------------------------------------
*
* Tk_CreateErrorHandler --
*
- * Arrange for all a given procedure to be invoked whenever
- * certain errors occur.
+ * Arrange for all a given procedure to be invoked whenever certain
+ * errors occur.
*
* Results:
- * The return value is a token identifying the handler;
- * it must be passed to Tk_DeleteErrorHandler to delete the
- * handler.
+ * The return value is a token identifying the handler; it must be passed
+ * to Tk_DeleteErrorHandler to delete the handler.
*
* Side effects:
- * If an X error occurs that matches the error, request,
- * and minor arguments, then errorProc will be invoked.
- * ErrorProc should have the following structure:
+ * If an X error occurs that matches the error, request, and minor
+ * arguments, then errorProc will be invoked. ErrorProc should have the
+ * following structure:
*
* int
- * errorProc(clientData, errorEventPtr)
- * caddr_t clientData;
- * XErrorEvent *errorEventPtr;
- * {
+ * errorProc(caddr_t clientData, XErrorEvent *errorEventPtr) {
* }
*
- * The clientData argument will be the same as the clientData
- * argument to this procedure, and errorEvent will describe
- * the error. If errorProc returns 0, it means that it
- * completely "handled" the error: no further processing
- * should be done. If errorProc returns 1, it means that it
- * didn't know how to deal with the error, so we should look
- * for other error handlers, or invoke the default error
- * handler if no other handler returns zero. Handlers are
- * invoked in order of age: youngest handler first.
+ * The clientData argument will be the same as the clientData argument to
+ * this procedure, and errorEvent will describe the error. If errorProc
+ * returns 0, it means that it completely "handled" the error: no further
+ * processing should be done. If errorProc returns 1, it means that it
+ * didn't know how to deal with the error, so we should look for other
+ * error handlers, or invoke the default error handler if no other
+ * handler returns zero. Handlers are invoked in order of age: youngest
+ * handler first.
*
- * Note: errorProc will only be called for errors associated
- * with X requests made AFTER this call, but BEFORE the handler
- * is deleted by calling Tk_DeleteErrorHandler.
+ * Note: errorProc will only be called for errors associated with X
+ * requests made AFTER this call, but BEFORE the handler is deleted by
+ * calling Tk_DeleteErrorHandler.
*
*--------------------------------------------------------------
*/
Tk_ErrorHandler
-Tk_CreateErrorHandler(display, error, request, minorCode, errorProc, clientData)
- Display *display; /* Display for which to handle
+Tk_CreateErrorHandler(
+ Display *display, /* Display for which to handle errors. */
+ int error, /* Consider only errors with this error_code
+ * (-1 means consider all errors). */
+ int request, /* Consider only errors with this major
+ * request code (-1 means consider all major
+ * codes). */
+ int minorCode, /* Consider only errors with this minor
+ * request code (-1 means consider all minor
+ * codes). */
+ Tk_ErrorProc *errorProc, /* Procedure to invoke when a matching error
+ * occurs. NULL means just ignore matching
* errors. */
- int error; /* Consider only errors with this
- * error_code (-1 means consider
- * all errors). */
- int request; /* Consider only errors with this
- * major request code (-1 means
- * consider all major codes). */
- int minorCode; /* Consider only errors with this
- * minor request code (-1 means
- * consider all minor codes). */
- Tk_ErrorProc *errorProc; /* Procedure to invoke when a
- * matching error occurs. NULL means
- * just ignore matching errors. */
- ClientData clientData; /* Arbitrary value to pass to
- * errorProc. */
+ ClientData clientData) /* Arbitrary value to pass to errorProc. */
{
register TkErrorHandler *errorPtr;
register TkDisplay *dispPtr;
/*
- * Find the display. If Tk doesn't know about this display then
- * it's an error: panic.
+ * Find the display. If Tk doesn't know about this display then it's an
+ * error: panic.
*/
dispPtr = TkGetDisplay(display);
if (dispPtr == NULL) {
- panic("Unknown display passed to Tk_CreateErrorHandler");
+ Tcl_Panic("Unknown display passed to Tk_CreateErrorHandler");
}
/*
@@ -144,22 +133,19 @@ Tk_CreateErrorHandler(display, error, request, minorCode, errorProc, clientData)
* None.
*
* Side effects:
- * The handler denoted by the "handler" argument will not
- * be invoked for any X errors associated with requests
- * made after this call. However, if errors arrive later
- * for requests made BEFORE this call, then the handler
- * will still be invoked. Call XSync if you want to be
- * sure that all outstanding errors have been received
- * and processed.
+ * The handler denoted by the "handler" argument will not be invoked for
+ * any X errors associated with requests made after this call. However,
+ * if errors arrive later for requests made BEFORE this call, then the
+ * handler will still be invoked. Call XSync if you want to be sure that
+ * all outstanding errors have been received and processed.
*
*--------------------------------------------------------------
*/
void
-Tk_DeleteErrorHandler(handler)
- Tk_ErrorHandler handler; /* Token for handler to delete;
- * was previous return value from
- * Tk_CreateErrorHandler. */
+Tk_DeleteErrorHandler(
+ Tk_ErrorHandler handler) /* Token for handler to delete; was previous
+ * return value from Tk_CreateErrorHandler. */
{
register TkErrorHandler *errorPtr = (TkErrorHandler *) handler;
register TkDisplay *dispPtr = errorPtr->dispPtr;
@@ -167,17 +153,15 @@ Tk_DeleteErrorHandler(handler)
errorPtr->lastRequest = NextRequest(dispPtr->display) - 1;
/*
- * Every once-in-a-while, cleanup handlers that are no longer
- * active. We probably won't be able to free the handler that
- * was just deleted (need to wait for any outstanding requests to
- * be processed by server), but there may be previously-deleted
- * handlers that are now ready for garbage collection. To reduce
- * the cost of the cleanup, let a few dead handlers pile up, then
- * clean them all at once. This adds a bit of overhead to errors
- * that might occur while the dead handlers are hanging around,
- * but reduces the overhead of scanning the list to clean up
- * (particularly if there are many handlers that stay around
- * forever).
+ * Every once-in-a-while, cleanup handlers that are no longer active. We
+ * probably won't be able to free the handler that was just deleted (need
+ * to wait for any outstanding requests to be processed by server), but
+ * there may be previously-deleted handlers that are now ready for garbage
+ * collection. To reduce the cost of the cleanup, let a few dead handlers
+ * pile up, then clean them all at once. This adds a bit of overhead to
+ * errors that might occur while the dead handlers are hanging around, but
+ * reduces the overhead of scanning the list to clean up (particularly if
+ * there are many handlers that stay around forever).
*/
dispPtr->deleteCount += 1;
@@ -211,35 +195,33 @@ Tk_DeleteErrorHandler(handler)
*
* ErrorProc --
*
- * This procedure is invoked by the X system when error
- * events arrive.
+ * This procedure is invoked by the X system when error events arrive.
*
* Results:
- * If it returns, the return value is zero. However,
- * it is possible that one of the error handlers may
- * just exit.
+ * If it returns, the return value is zero. However, it is possible that
+ * one of the error handlers may just exit.
*
* Side effects:
- * This procedure does two things. First, it uses the
- * serial # in the error event to eliminate handlers whose
- * expiration serials are now in the past. Second, it
- * invokes any handlers that want to deal with the error.
+ * This procedure does two things. First, it uses the serial # in the
+ * error event to eliminate handlers whose expiration serials are now in
+ * the past. Second, it invokes any handlers that want to deal with the
+ * error.
*
*--------------------------------------------------------------
*/
static int
-ErrorProc(display, errEventPtr)
- Display *display; /* Display for which error
- * occurred. */
- register XErrorEvent *errEventPtr; /* Information about error. */
+ErrorProc(
+ Display *display, /* Display for which error occurred. */
+ register XErrorEvent *errEventPtr)
+ /* Information about error. */
{
register TkDisplay *dispPtr;
register TkErrorHandler *errorPtr;
/*
- * See if we know anything about the display. If not, then
- * invoke the default error handler.
+ * See if we know anything about the display. If not, then invoke the
+ * default error handler.
*/
dispPtr = TkGetDisplay(display);
@@ -264,42 +246,47 @@ ErrorProc(display, errEventPtr)
&& (errorPtr->lastRequest < errEventPtr->serial))) {
continue;
}
- if (errorPtr->errorProc == NULL) {
+ if (errorPtr->errorProc == NULL || (*errorPtr->errorProc)(
+ errorPtr->clientData, errEventPtr) == 0) {
return 0;
- } else {
- if ((*errorPtr->errorProc)(errorPtr->clientData,
- errEventPtr) == 0) {
- return 0;
- }
}
}
/*
- * See if the error is a BadWindow error. If so, and it refers
- * to a window that still exists in our window table, then ignore
- * the error. Errors like this can occur if a window owned by us
- * is deleted by someone externally, like a window manager. We'll
- * ignore the errors at least long enough to clean up internally and
- * remove the entry from the window table.
+ * See if the error is a BadWindow error. If so, and it refers to a window
+ * that still exists in our window table, then ignore the error. Errors
+ * like this can occur if a window owned by us is deleted by someone
+ * externally, like a window manager. We'll ignore the errors at least
+ * long enough to clean up internally and remove the entry from the window
+ * table.
*
- * NOTE: For embedding, we must also check whether the window was
- * recently deleted. If so, it may be that Tk generated operations on
- * windows that were deleted by the container. Now we are getting
- * the errors (BadWindow) after Tk already deleted the window itself.
+ * NOTE: For embedding, we must also check whether the window was recently
+ * deleted. If so, it may be that Tk generated operations on windows that
+ * were deleted by the container. Now we are getting the errors
+ * (BadWindow) after Tk already deleted the window itself.
*/
- if ((errEventPtr->error_code == BadWindow) &&
- ((Tk_IdToWindow(display, (Window) errEventPtr->resourceid) !=
- NULL) ||
- (TkpWindowWasRecentlyDeleted((Window) errEventPtr->resourceid,
- dispPtr)))) {
- return 0;
+ if (errEventPtr->error_code == BadWindow) {
+ Window w = (Window) errEventPtr->resourceid;
+
+ if (Tk_IdToWindow(display, w) != NULL
+ || TkpWindowWasRecentlyDeleted(w, dispPtr)) {
+ return 0;
+ }
}
/*
- * We couldn't handle the error. Use the default handler.
+ * We couldn't handle the error. Use the default handler.
*/
- couldntHandle:
+ couldntHandle:
return (*defaultHandler)(display, errEventPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 2b4943f..7c41c22 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -1,69 +1,67 @@
-/*
+/*
* tkEvent.c --
*
- * This file provides basic low-level facilities for managing
- * X events in Tk.
+ * This file provides basic low-level facilities for managing X events in
+ * Tk.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1995 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 Ajuba Solutions.
+ * Copyright (c) 2004 George Peter Staplin
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
-#include <signal.h>
/*
- * There's a potential problem if a handler is deleted while it's
- * current (i.e. its procedure is executing), since Tk_HandleEvent
- * will need to read the handler's "nextPtr" field when the procedure
- * returns. To handle this problem, structures of the type below
- * indicate the next handler to be processed for any (recursively
- * nested) dispatches in progress. The nextHandler fields get
- * updated if the handlers pointed to are deleted. Tk_HandleEvent
- * also needs to know if the entire window gets deleted; the winPtr
- * field is set to zero if that particular window gets deleted.
+ * There's a potential problem if a handler is deleted while it's current
+ * (i.e. its function is executing), since Tk_HandleEvent will need to read
+ * the handler's "nextPtr" field when the function returns. To handle this
+ * problem, structures of the type below indicate the next handler to be
+ * processed for any (recursively nested) dispatches in progress. The
+ * nextHandler fields get updated if the handlers pointed to are deleted.
+ * Tk_HandleEvent also needs to know if the entire window gets deleted; the
+ * winPtr field is set to zero if that particular window gets deleted.
*/
typedef struct InProgress {
- XEvent *eventPtr; /* Event currently being handled. */
- TkWindow *winPtr; /* Window for event. Gets set to None if
- * window is deleted while event is being
- * handled. */
- TkEventHandler *nextHandler; /* Next handler in search. */
- struct InProgress *nextPtr; /* Next higher nested search. */
+ XEvent *eventPtr; /* Event currently being handled. */
+ TkWindow *winPtr; /* Window for event. Gets set to None if
+ * window is deleted while event is being
+ * handled. */
+ TkEventHandler *nextHandler;/* Next handler in search. */
+ struct InProgress *nextPtr; /* Next higher nested search. */
} InProgress;
/*
- * For each call to Tk_CreateGenericHandler, an instance of the following
- * structure will be created. All of the active handlers are linked into a
- * list.
+ * For each call to Tk_CreateGenericHandler or Tk_CreateClientMessageHandler,
+ * an instance of the following structure will be created. All of the active
+ * handlers are linked into a list.
*/
typedef struct GenericHandler {
- Tk_GenericProc *proc; /* Procedure to dispatch on all X events. */
- ClientData clientData; /* Client data to pass to procedure. */
- int deleteFlag; /* Flag to set when this handler is deleted. */
+ Tk_GenericProc *proc; /* Function to dispatch on all X events. */
+ ClientData clientData; /* Client data to pass to function. */
+ int deleteFlag; /* Flag to set when this handler is
+ * deleted. */
struct GenericHandler *nextPtr;
/* Next handler in list of all generic
* handlers, or NULL for end of list. */
} GenericHandler;
/*
- * There's a potential problem if Tk_HandleEvent is entered recursively.
- * A handler cannot be deleted physically until we have returned from
- * calling it. Otherwise, we're looking at unallocated memory in advancing to
- * its `next' entry. We deal with the problem by using the `delete flag' and
+ * There's a potential problem if Tk_HandleEvent is entered recursively. A
+ * handler cannot be deleted physically until we have returned from calling
+ * it. Otherwise, we're looking at unallocated memory in advancing to its
+ * `next' entry. We deal with the problem by using the `delete flag' and
* deleting handlers only when it's known that there's no handler active.
- *
*/
/*
- * The following structure is used for queueing X-style events on the
- * Tcl event queue.
+ * The following structure is used for queueing X-style events on the Tcl
+ * event queue.
*/
typedef struct TkWindowEvent {
@@ -75,7 +73,7 @@ typedef struct TkWindowEvent {
* Array of event masks corresponding to each X event:
*/
-static unsigned long eventMasks[TK_LASTEVENT] = {
+static unsigned long realEventMasks[MappingNotify+1] = {
0,
0,
KeyPressMask, /* KeyPress */
@@ -113,106 +111,694 @@ static unsigned long eventMasks[TK_LASTEVENT] = {
0, /* SelectionNotify */
ColormapChangeMask, /* ColormapNotify */
0, /* ClientMessage */
- 0, /* Mapping Notify */
+ 0 /* Mapping Notify */
+};
+
+static unsigned long virtualEventMasks[TK_LASTEVENT-VirtualEvent] = {
VirtualEventMask, /* VirtualEvents */
ActivateMask, /* ActivateNotify */
ActivateMask, /* DeactivateNotify */
MouseWheelMask /* MouseWheelEvent */
};
+/*
+ * For each exit handler created with a call to TkCreateExitHandler or
+ * TkCreateThreadExitHandler there is a structure of the following type:
+ */
+
+typedef struct ExitHandler {
+ Tcl_ExitProc *proc; /* Function to call when process exits. */
+ ClientData clientData; /* One word of information to pass to proc. */
+ struct ExitHandler *nextPtr;/* Next in list of all exit handlers for this
+ * application, or NULL for end of list. */
+} ExitHandler;
/*
- * The structure below is used to store Data for the Event module that
- * must be kept thread-local. The "dataKey" is used to fetch the
- * thread-specific storage for the current thread.
+ * The structure below is used to store Data for the Event module that must be
+ * kept thread-local. The "dataKey" is used to fetch the thread-specific
+ * storage for the current thread.
*/
typedef struct ThreadSpecificData {
- int handlersActive; /* The following variable has a non-zero
- * value when a handler is active. */
- InProgress *pendingPtr; /* Topmost search in progress, or
- * NULL if none. */
+ int handlersActive; /* The following variable has a non-zero value
+ * when a handler is active. */
+ InProgress *pendingPtr; /* Topmost search in progress, or NULL if
+ * none. */
+
+ /*
+ * List of generic handler records.
+ */
+
+ GenericHandler *genericList;/* First handler in the list, or NULL. */
+ GenericHandler *lastGenericPtr;
+ /* Last handler in list. */
- GenericHandler *genericList; /* First handler in the list, or NULL. */
- GenericHandler *lastGenericPtr; /* Last handler in list. */
+ /*
+ * List of client message handler records.
+ */
- GenericHandler *cmList; /* First handler in the list, or NULL. */
+ GenericHandler *cmList; /* First handler in the list, or NULL. */
GenericHandler *lastCmPtr; /* Last handler in list. */
/*
- * If someone has called Tk_RestrictEvents, the information below
- * keeps track of it.
+ * If someone has called Tk_RestrictEvents, the information below keeps
+ * track of it.
*/
Tk_RestrictProc *restrictProc;
- /* Procedure to call. NULL means no
+ /* Function to call. NULL means no
* restrictProc is currently in effect. */
ClientData restrictArg; /* Argument to pass to restrictProc. */
+ ExitHandler *firstExitPtr; /* First in list of all exit handlers for this
+ * thread. */
+ int inExit; /* True when this thread is exiting. This is
+ * used as a hack to decide to close the
+ * standard channels. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Prototypes for procedures that are only referenced locally within
- * this file.
+ * There are both per-process and per-thread exit handlers. The first list is
+ * controlled by a mutex. The other is in thread local storage.
+ */
+
+static ExitHandler *firstExitPtr = NULL;
+ /* First in list of all exit handlers for
+ * application. */
+TCL_DECLARE_MUTEX(exitMutex)
+
+/*
+ * Prototypes for functions that are only referenced locally within this file.
+ */
+
+static void CleanUpTkEvent(XEvent *eventPtr);
+static void DelayedMotionProc(ClientData clientData);
+static int GetButtonMask(unsigned int Button);
+static unsigned long GetEventMaskFromXEvent(XEvent *eventPtr);
+static TkWindow * GetTkWindowFromXEvent(XEvent *eventPtr);
+static void InvokeClientMessageHandlers(ThreadSpecificData *tsdPtr,
+ Tk_Window tkwin, XEvent *eventPtr);
+static int InvokeFocusHandlers(TkWindow **winPtrPtr,
+ unsigned long mask, XEvent *eventPtr);
+static int InvokeGenericHandlers(ThreadSpecificData *tsdPtr,
+ XEvent *eventPtr);
+static int InvokeMouseHandlers(TkWindow *winPtr,
+ unsigned long mask, XEvent *eventPtr);
+static Window ParentXId(Display *display, Window w);
+static int RefreshKeyboardMappingIfNeeded(XEvent *eventPtr);
+static int TkXErrorHandler(ClientData clientData,
+ XErrorEvent *errEventPtr);
+static void UpdateButtonEventState(XEvent *eventPtr);
+static int WindowEventProc(Tcl_Event *evPtr, int flags);
+#ifdef TK_USE_INPUT_METHODS
+static void CreateXIC(TkWindow *winPtr);
+#endif /* TK_USE_INPUT_METHODS */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InvokeFocusHandlers --
+ *
+ * Call focus-related code to look at FocusIn, FocusOut, Enter, and Leave
+ * events; depending on its return value, ignore the event.
+ *
+ * Results:
+ * 0 further processing can be done on the event.
+ * 1 we are done with the event passed.
+ *
+ * Side effects:
+ * The *winPtrPtr in the caller may be changed to the TkWindow for the
+ * window with focus.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+InvokeFocusHandlers(
+ TkWindow **winPtrPtr,
+ unsigned long mask,
+ XEvent *eventPtr)
+{
+ if ((mask & (FocusChangeMask|EnterWindowMask|LeaveWindowMask))
+ && (TkFocusFilterEvent(*winPtrPtr, eventPtr) == 0)) {
+ return 1;
+ }
+
+ /*
+ * MouseWheel events are not focus specific on Mac OS X.
+ */
+
+#ifdef MAC_OSX_TK
+#define FOCUS_DIRECTED_EVENT_MASK (KeyPressMask|KeyReleaseMask)
+#else
+#define FOCUS_DIRECTED_EVENT_MASK (KeyPressMask|KeyReleaseMask|MouseWheelMask)
+#endif
+
+ if (mask & FOCUS_DIRECTED_EVENT_MASK) {
+ (*winPtrPtr)->dispPtr->lastEventTime = eventPtr->xkey.time;
+ *winPtrPtr = TkFocusKeyEvent(*winPtrPtr, eventPtr);
+ if (*winPtrPtr == NULL) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InvokeMouseHandlers --
+ *
+ * Call a grab-related function to do special processing on pointer
+ * events.
+ *
+ * Results:
+ * 0 further processing can be done on the event.
+ * 1 we are done with the event passed.
+ *
+ * Side effects:
+ * New events may be queued from TkPointerEvent and grabs may be added
+ * and/or removed. The eventPtr may be changed by TkPointerEvent in some
+ * cases.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+InvokeMouseHandlers(
+ TkWindow *winPtr,
+ unsigned long mask,
+ XEvent *eventPtr)
+{
+ if (mask & (ButtonPressMask|ButtonReleaseMask|PointerMotionMask
+ |EnterWindowMask|LeaveWindowMask)) {
+
+ if (mask & (ButtonPressMask|ButtonReleaseMask)) {
+ winPtr->dispPtr->lastEventTime = eventPtr->xbutton.time;
+ } else if (mask & PointerMotionMask) {
+ winPtr->dispPtr->lastEventTime = eventPtr->xmotion.time;
+ } else {
+ winPtr->dispPtr->lastEventTime = eventPtr->xcrossing.time;
+ }
+
+ if (TkPointerEvent(eventPtr, winPtr) == 0) {
+ /*
+ * The event should be ignored to make grab work correctly (as the
+ * comment for TkPointerEvent states).
+ */
+
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateXIC --
+ *
+ * Create the X input context for our winPtr.
+ * XIM is only ever enabled on Unix.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#if defined(TK_USE_INPUT_METHODS)
+static void
+CreateXIC(
+ TkWindow *winPtr)
+{
+ TkDisplay *dispPtr = winPtr->dispPtr;
+ long im_event_mask = 0L;
+ const char *preedit_attname = NULL;
+ XVaNestedList preedit_attlist = NULL;
+
+ if (dispPtr->inputStyle & XIMPreeditPosition) {
+ XPoint spot = {0, 0};
+
+ preedit_attname = XNPreeditAttributes;
+ preedit_attlist = XVaCreateNestedList(0,
+ XNSpotLocation, &spot,
+ XNFontSet, dispPtr->inputXfs,
+ (void *) NULL);
+ }
+
+ winPtr->inputContext = XCreateIC(dispPtr->inputMethod,
+ XNInputStyle, dispPtr->inputStyle,
+ XNClientWindow, winPtr->window,
+ XNFocusWindow, winPtr->window,
+ preedit_attname, preedit_attlist,
+ (void *) NULL);
+
+ if (preedit_attlist) {
+ XFree(preedit_attlist);
+ }
+
+
+ if (winPtr->inputContext == NULL) {
+ /* XCreateIC failed. */
+ return;
+ }
+
+ /*
+ * Adjust the window's event mask if the IM requires it.
+ */
+ XGetICValues(winPtr->inputContext, XNFilterEvents, &im_event_mask, (void *) NULL);
+ if ((winPtr->atts.event_mask & im_event_mask) != im_event_mask) {
+ winPtr->atts.event_mask |= im_event_mask;
+ XSelectInput(winPtr->display, winPtr->window, winPtr->atts.event_mask);
+ }
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetTkWindowFromXEvent --
+ *
+ * Attempt to find which TkWindow is associated with an event. If it
+ * fails we attempt to get the TkWindow from the parent for a property
+ * notification.
+ *
+ * Results:
+ * The TkWindow associated with the event or NULL.
+ *
+ * Side effects:
+ * TkSelPropProc may influence selection on windows not known to Tk.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static TkWindow *
+GetTkWindowFromXEvent(
+ XEvent *eventPtr)
+{
+ TkWindow *winPtr;
+ Window parentXId, handlerWindow = eventPtr->xany.window;
+
+ if ((eventPtr->xany.type == StructureNotifyMask)
+ && (eventPtr->xmap.event != eventPtr->xmap.window)) {
+ handlerWindow = eventPtr->xmap.event;
+ }
+
+ winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, handlerWindow);
+
+ if (winPtr == NULL) {
+ /*
+ * There isn't a TkWindow structure for this window. However, if the
+ * event is a PropertyNotify event then call the selection manager (it
+ * deals beneath-the-table with certain properties). Also, if the
+ * window's parent is a Tk window that has the TK_PROP_PROPCHANGE flag
+ * set, then we must propagate the PropertyNotify event up to the
+ * parent.
+ */
+
+ if (eventPtr->type != PropertyNotify) {
+ return NULL;
+ }
+ TkSelPropProc(eventPtr);
+ parentXId = ParentXId(eventPtr->xany.display, handlerWindow);
+ if (parentXId == None) {
+ return NULL;
+ }
+ winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, parentXId);
+ if (winPtr == NULL) {
+ return NULL;
+ }
+ if (!(winPtr->flags & TK_PROP_PROPCHANGE)) {
+ return NULL;
+ }
+ }
+ return winPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetEventMaskFromXEvent --
+ *
+ * The event type is looked up in our eventMasks tables, and may be
+ * changed to a different mask depending on the state of the event and
+ * window members.
+ *
+ * Results:
+ * The mask for the event.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static unsigned long
+GetEventMaskFromXEvent(
+ XEvent *eventPtr)
+{
+ unsigned long mask;
+
+ /*
+ * Get the event mask from the correct table. Note that there are two
+ * tables here because that means we no longer need this code to rely on
+ * the exact value of VirtualEvent, which has caused us problems in the
+ * past when X11 changed the value of LASTEvent. [Bug ???]
+ */
+
+ if (eventPtr->xany.type <= MappingNotify) {
+ mask = realEventMasks[eventPtr->xany.type];
+ } else if (eventPtr->xany.type >= VirtualEvent
+ && eventPtr->xany.type<TK_LASTEVENT) {
+ mask = virtualEventMasks[eventPtr->xany.type - VirtualEvent];
+ } else {
+ mask = 0;
+ }
+
+ /*
+ * Events selected by StructureNotify require special handling. They look
+ * the same as those selected by SubstructureNotify. The only difference
+ * is whether the "event" and "window" fields are the same. Compare the
+ * two fields and convert StructureNotify to SubstructureNotify if
+ * necessary.
+ */
+
+ if (mask == StructureNotifyMask) {
+ if (eventPtr->xmap.event != eventPtr->xmap.window) {
+ mask = SubstructureNotifyMask;
+ }
+ }
+ return mask;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RefreshKeyboardMappingIfNeeded --
+ *
+ * If the event is a MappingNotify event, find its display and refresh
+ * the keyboard mapping information for the display.
+ *
+ * Results:
+ * 0 if the event was not a MappingNotify event
+ * 1 if the event was a MappingNotify event
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+RefreshKeyboardMappingIfNeeded(
+ XEvent *eventPtr)
+{
+ TkDisplay *dispPtr;
+
+ if (eventPtr->type == MappingNotify) {
+ dispPtr = TkGetDisplay(eventPtr->xmapping.display);
+ if (dispPtr != NULL) {
+ XRefreshKeyboardMapping(&eventPtr->xmapping);
+ dispPtr->bindInfoStale = 1;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetButtonMask --
+ *
+ * Return the proper Button${n}Mask for the button.
+ *
+ * Results:
+ * A button mask.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetButtonMask(
+ unsigned int button)
+{
+ switch (button) {
+ case 1:
+ return Button1Mask;
+ case 2:
+ return Button2Mask;
+ case 3:
+ return Button3Mask;
+ case 4:
+ return Button4Mask;
+ case 5:
+ return Button5Mask;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateButtonEventState --
+ *
+ * Update the button event state in our TkDisplay using the XEvent
+ * passed. We also may modify the the XEvent passed to fit some aspects
+ * of our TkDisplay.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The TkDisplay's private button state may be modified. The eventPtr's
+ * state may be updated to reflect masks stored in our TkDisplay that the
+ * event doesn't contain. The eventPtr may also be modified to not
+ * contain a button state for the window in which it was not pressed in.
+ *
+ *----------------------------------------------------------------------
*/
-static void DelayedMotionProc _ANSI_ARGS_((ClientData clientData));
-static int WindowEventProc _ANSI_ARGS_((Tcl_Event *evPtr,
- int flags));
-static int TkXErrorHandler _ANSI_ARGS_((ClientData clientData,
- XErrorEvent *errEventPtr));
+static void
+UpdateButtonEventState(
+ XEvent *eventPtr)
+{
+ TkDisplay *dispPtr;
+ int allButtonsMask = Button1Mask | Button2Mask | Button3Mask
+ | Button4Mask | Button5Mask;
+ switch (eventPtr->type) {
+ case ButtonPress:
+ dispPtr = TkGetDisplay(eventPtr->xbutton.display);
+ dispPtr->mouseButtonWindow = eventPtr->xbutton.window;
+ eventPtr->xbutton.state |= dispPtr->mouseButtonState;
+
+ dispPtr->mouseButtonState |= GetButtonMask(eventPtr->xbutton.button);
+ break;
+
+ case ButtonRelease:
+ dispPtr = TkGetDisplay(eventPtr->xbutton.display);
+ dispPtr->mouseButtonWindow = None;
+ dispPtr->mouseButtonState &= ~GetButtonMask(eventPtr->xbutton.button);
+ eventPtr->xbutton.state |= dispPtr->mouseButtonState;
+ break;
+
+ case MotionNotify:
+ dispPtr = TkGetDisplay(eventPtr->xmotion.display);
+ if (dispPtr->mouseButtonState & allButtonsMask) {
+ if (eventPtr->xbutton.window != dispPtr->mouseButtonWindow) {
+ /*
+ * This motion event should not be interpreted as a button
+ * press + motion event since this is not the same window the
+ * button was pressed down in.
+ */
+
+ dispPtr->mouseButtonState &= ~allButtonsMask;
+ dispPtr->mouseButtonWindow = None;
+ } else {
+ eventPtr->xmotion.state |= dispPtr->mouseButtonState;
+ }
+ }
+ break;
+ }
+}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
+ *
+ * InvokeClientMessageHandlers --
+ *
+ * Iterate the list of handlers and invoke the function pointer for each.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Handlers may be deleted and events may be sent to handlers.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+InvokeClientMessageHandlers(
+ ThreadSpecificData *tsdPtr,
+ Tk_Window tkwin,
+ XEvent *eventPtr)
+{
+ GenericHandler *prevPtr, *tmpPtr, *curPtr = tsdPtr->cmList;
+
+ for (prevPtr = NULL; curPtr != NULL; ) {
+ if (curPtr->deleteFlag) {
+ if (!tsdPtr->handlersActive) {
+ /*
+ * This handler needs to be deleted and there are no calls
+ * pending through any handlers, so now is a safe time to
+ * delete it.
+ */
+
+ tmpPtr = curPtr->nextPtr;
+ if (prevPtr == NULL) {
+ tsdPtr->cmList = tmpPtr;
+ } else {
+ prevPtr->nextPtr = tmpPtr;
+ }
+ if (tmpPtr == NULL) {
+ tsdPtr->lastCmPtr = prevPtr;
+ }
+ (void) ckfree((char *) curPtr);
+ curPtr = tmpPtr;
+ continue;
+ }
+ } else {
+ int done;
+
+ tsdPtr->handlersActive++;
+ done = (*(Tk_ClientMessageProc *)curPtr->proc)(tkwin, eventPtr);
+ tsdPtr->handlersActive--;
+ if (done) {
+ break;
+ }
+ }
+ prevPtr = curPtr;
+ curPtr = curPtr->nextPtr;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InvokeGenericHandlers --
+ *
+ * Iterate the list of handlers and invoke the function pointer for each.
+ * If the handler invoked returns a non-zero value then we are done.
+ *
+ * Results:
+ * 0 when the event wasn't handled by a handler. Non-zero when it was
+ * processed and handled by a handler.
+ *
+ * Side effects:
+ * Handlers may be deleted and events may be sent to handlers.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+InvokeGenericHandlers(
+ ThreadSpecificData *tsdPtr,
+ XEvent *eventPtr)
+{
+ GenericHandler *prevPtr, *tmpPtr, *curPtr = tsdPtr->genericList;
+
+ for (prevPtr = NULL; curPtr != NULL; ) {
+ if (curPtr->deleteFlag) {
+ if (!tsdPtr->handlersActive) {
+ /*
+ * This handler needs to be deleted and there are no calls
+ * pending through the handler, so now is a safe time to
+ * delete it.
+ */
+
+ tmpPtr = curPtr->nextPtr;
+ if (prevPtr == NULL) {
+ tsdPtr->genericList = tmpPtr;
+ } else {
+ prevPtr->nextPtr = tmpPtr;
+ }
+ if (tmpPtr == NULL) {
+ tsdPtr->lastGenericPtr = prevPtr;
+ }
+ (void) ckfree((char *) curPtr);
+ curPtr = tmpPtr;
+ continue;
+ }
+ } else {
+ int done;
+
+ tsdPtr->handlersActive++;
+ done = (*curPtr->proc)(curPtr->clientData, eventPtr);
+ tsdPtr->handlersActive--;
+ if (done) {
+ return done;
+ }
+ }
+ prevPtr = curPtr;
+ curPtr = curPtr->nextPtr;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
*
* Tk_CreateEventHandler --
*
- * Arrange for a given procedure to be invoked whenever
- * events from a given class occur in a given window.
+ * Arrange for a given function to be invoked whenever events from a
+ * given class occur in a given window.
*
* Results:
* None.
*
* Side effects:
- * From now on, whenever an event of the type given by
- * mask occurs for token and is processed by Tk_HandleEvent,
- * proc will be called. See the manual entry for details
- * of the calling sequence and return value for proc.
+ * From now on, whenever an event of the type given by mask occurs for
+ * token and is processed by Tk_HandleEvent, proc will be called. See the
+ * manual entry for details of the calling sequence and return value for
+ * proc.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_CreateEventHandler(token, mask, proc, clientData)
- Tk_Window token; /* Token for window in which to
- * create handler. */
- unsigned long mask; /* Events for which proc should
- * be called. */
- Tk_EventProc *proc; /* Procedure to call for each
- * selected event */
- ClientData clientData; /* Arbitrary data to pass to proc. */
+Tk_CreateEventHandler(
+ Tk_Window token, /* Token for window in which to create
+ * handler. */
+ unsigned long mask, /* Events for which proc should be called. */
+ Tk_EventProc *proc, /* Function to call for each selected event */
+ ClientData clientData) /* Arbitrary data to pass to proc. */
{
register TkEventHandler *handlerPtr;
register TkWindow *winPtr = (TkWindow *) token;
- int found;
/*
- * Skim through the list of existing handlers to (a) compute the
- * overall event mask for the window (so we can pass this new
- * value to the X system) and (b) see if there's already a handler
- * declared with the same callback and clientData (if so, just
- * change the mask). If no existing handler matches, then create
- * a new handler.
+ * Skim through the list of existing handlers to (a) compute the overall
+ * event mask for the window (so we can pass this new value to the X
+ * system) and (b) see if there's already a handler declared with the same
+ * callback and clientData (if so, just change the mask). If no existing
+ * handler matches, then create a new handler.
*/
- found = 0;
if (winPtr->handlerList == NULL) {
- handlerPtr = (TkEventHandler *) ckalloc(
- (unsigned) sizeof(TkEventHandler));
+ /*
+ * No event handlers defined at all, so must create.
+ */
+
+ handlerPtr = (TkEventHandler *) ckalloc(sizeof(TkEventHandler));
winPtr->handlerList = handlerPtr;
- goto initHandler;
} else {
+ int found = 0;
+
for (handlerPtr = winPtr->handlerList; ;
handlerPtr = handlerPtr->nextPtr) {
if ((handlerPtr->proc == proc)
@@ -224,31 +810,43 @@ Tk_CreateEventHandler(token, mask, proc, clientData)
break;
}
}
- }
- /*
- * Create a new handler if no matching old handler was found.
- */
+ /*
+ * If we found anything, we're done because we do not need to use
+ * XSelectInput; Tk always selects on all events anyway in order to
+ * support binding on classes, 'all' and other bind-tags.
+ */
+
+ if (found) {
+ return;
+ }
+
+ /*
+ * No event handler matched, so create a new one.
+ */
- if (!found) {
handlerPtr->nextPtr = (TkEventHandler *)
ckalloc(sizeof(TkEventHandler));
handlerPtr = handlerPtr->nextPtr;
- initHandler:
- handlerPtr->mask = mask;
- handlerPtr->proc = proc;
- handlerPtr->clientData = clientData;
- handlerPtr->nextPtr = NULL;
}
/*
- * No need to call XSelectInput: Tk always selects on all events
- * for all windows (needed to support bindings on classes and "all").
+ * Initialize the new event handler.
+ */
+
+ handlerPtr->mask = mask;
+ handlerPtr->proc = proc;
+ handlerPtr->clientData = clientData;
+ handlerPtr->nextPtr = NULL;
+
+ /*
+ * No need to call XSelectInput: Tk always selects on all events for all
+ * windows (needed to support bindings on classes and "all").
*/
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* Tk_DeleteEventHandler --
*
@@ -258,30 +856,29 @@ Tk_CreateEventHandler(token, mask, proc, clientData)
* None.
*
* Side effects:
- * If there existed a handler as described by the
- * parameters, the handler is deleted so that proc
- * will not be invoked again.
+ * If there existed a handler as described by the parameters, the handler
+ * is deleted so that proc will not be invoked again.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_DeleteEventHandler(token, mask, proc, clientData)
- Tk_Window token; /* Same as corresponding arguments passed */
- unsigned long mask; /* previously to Tk_CreateEventHandler. */
- Tk_EventProc *proc;
- ClientData clientData;
+Tk_DeleteEventHandler(
+ Tk_Window token, /* Same as corresponding arguments passed */
+ unsigned long mask, /* previously to Tk_CreateEventHandler. */
+ Tk_EventProc *proc,
+ ClientData clientData)
{
register TkEventHandler *handlerPtr;
register InProgress *ipPtr;
TkEventHandler *prevPtr;
register TkWindow *winPtr = (TkWindow *) token;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Find the event handler to be deleted, or return
- * immediately if it doesn't exist.
+ * Find the event handler to be deleted, or return immediately if it
+ * doesn't exist.
*/
for (handlerPtr = winPtr->handlerList, prevPtr = NULL; ;
@@ -296,8 +893,8 @@ Tk_DeleteEventHandler(token, mask, proc, clientData)
}
/*
- * If Tk_HandleEvent is about to process this handler, tell it to
- * process the next one instead.
+ * If Tk_HandleEvent is about to process this handler, tell it to process
+ * the next one instead.
*/
for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL; ipPtr = ipPtr->nextPtr) {
@@ -317,43 +914,42 @@ Tk_DeleteEventHandler(token, mask, proc, clientData)
}
ckfree((char *) handlerPtr);
-
/*
- * No need to call XSelectInput: Tk always selects on all events
- * for all windows (needed to support bindings on classes and "all").
+ * No need to call XSelectInput: Tk always selects on all events for all
+ * windows (needed to support bindings on classes and "all").
*/
}
-/*--------------------------------------------------------------
+/*----------------------------------------------------------------------
*
* Tk_CreateGenericHandler --
*
- * Register a procedure to be called on each X event, regardless
- * of display or window. Generic handlers are useful for capturing
- * events that aren't associated with windows, or events for windows
- * not managed by Tk.
+ * Register a function to be called on each X event, regardless of
+ * display or window. Generic handlers are useful for capturing events
+ * that aren't associated with windows, or events for windows not managed
+ * by Tk.
*
* Results:
* None.
*
* Side Effects:
- * From now on, whenever an X event is given to Tk_HandleEvent,
- * invoke proc, giving it clientData and the event as arguments.
+ * From now on, whenever an X event is given to Tk_HandleEvent, invoke
+ * proc, giving it clientData and the event as arguments.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_CreateGenericHandler(proc, clientData)
- Tk_GenericProc *proc; /* Procedure to call on every event. */
- ClientData clientData; /* One-word value to pass to proc. */
+Tk_CreateGenericHandler(
+ Tk_GenericProc *proc, /* Function to call on every event. */
+ ClientData clientData) /* One-word value to pass to proc. */
{
GenericHandler *handlerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- handlerPtr = (GenericHandler *) ckalloc (sizeof (GenericHandler));
-
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ handlerPtr = (GenericHandler *) ckalloc(sizeof(GenericHandler));
+
handlerPtr->proc = proc;
handlerPtr->clientData = clientData;
handlerPtr->deleteFlag = 0;
@@ -367,7 +963,7 @@ Tk_CreateGenericHandler(proc, clientData)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* Tk_DeleteGenericHandler --
*
@@ -377,77 +973,76 @@ Tk_CreateGenericHandler(proc, clientData)
* None.
*
* Side Effects:
- * If there existed a handler as described by the parameters,
- * that handler is logically deleted so that proc will not be
- * invoked again. The physical deletion happens in the event
- * loop in Tk_HandleEvent.
+ * If there existed a handler as described by the parameters, that
+ * handler is logically deleted so that proc will not be invoked again.
+ * The physical deletion happens in the event loop in Tk_HandleEvent.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_DeleteGenericHandler(proc, clientData)
- Tk_GenericProc *proc;
- ClientData clientData;
+Tk_DeleteGenericHandler(
+ Tk_GenericProc *proc,
+ ClientData clientData)
{
GenericHandler * handler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- for (handler = tsdPtr->genericList; handler; handler = handler->nextPtr) {
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ for (handler=tsdPtr->genericList ; handler ; handler=handler->nextPtr) {
if ((handler->proc == proc) && (handler->clientData == clientData)) {
handler->deleteFlag = 1;
}
}
}
-/*--------------------------------------------------------------
+/*----------------------------------------------------------------------
*
* Tk_CreateClientMessageHandler --
*
- * Register a procedure to be called on each ClientMessage event.
+ * Register a function to be called on each ClientMessage event.
* ClientMessage handlers are useful for Drag&Drop extensions.
*
* Results:
* None.
*
* Side Effects:
- * From now on, whenever a ClientMessage event is received that isn't
- * a WM_PROTOCOL event or SelectionEvent, invoke proc, giving it
- * tkwin and the event as arguments.
+ * From now on, whenever a ClientMessage event is received that isn't a
+ * WM_PROTOCOL event or SelectionEvent, invoke proc, giving it tkwin and
+ * the event as arguments.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_CreateClientMessageHandler(proc)
- Tk_ClientMessageProc *proc; /* Procedure to call on event. */
+Tk_CreateClientMessageHandler(
+ Tk_ClientMessageProc *proc) /* Function to call on event. */
{
GenericHandler *handlerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * We use a GenericHandler struct, because it's basically the same,
- * except with an extra clientData field we'll never use.
+ * We use a GenericHandler struct, because it's basically the same, except
+ * with an extra clientData field we'll never use.
*/
- handlerPtr = (GenericHandler *)
- ckalloc (sizeof (GenericHandler));
- handlerPtr->proc = (Tk_GenericProc *) proc;
- handlerPtr->clientData = NULL; /* never used */
- handlerPtr->deleteFlag = 0;
- handlerPtr->nextPtr = NULL;
+ handlerPtr = (GenericHandler *) ckalloc(sizeof(GenericHandler));
+
+ handlerPtr->proc = (Tk_GenericProc *) proc;
+ handlerPtr->clientData = NULL; /* never used */
+ handlerPtr->deleteFlag = 0;
+ handlerPtr->nextPtr = NULL;
if (tsdPtr->cmList == NULL) {
- tsdPtr->cmList = handlerPtr;
+ tsdPtr->cmList = handlerPtr;
} else {
tsdPtr->lastCmPtr->nextPtr = handlerPtr;
}
- tsdPtr->lastCmPtr = handlerPtr;
+ tsdPtr->lastCmPtr = handlerPtr;
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* Tk_DeleteClientMessageHandler --
*
@@ -457,24 +1052,23 @@ Tk_CreateClientMessageHandler(proc)
* None.
*
* Side Effects:
- * If there existed a handler as described by the parameters,
- * that handler is logically deleted so that proc will not be
- * invoked again. The physical deletion happens in the event
- * loop in TkClientMessageEventProc.
+ * If there existed a handler as described by the parameters, that
+ * handler is logically deleted so that proc will not be invoked again.
+ * The physical deletion happens in the event loop in
+ * TkClientMessageEventProc.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_DeleteClientMessageHandler(proc)
- Tk_ClientMessageProc *proc;
+Tk_DeleteClientMessageHandler(
+ Tk_ClientMessageProc *proc)
{
GenericHandler * handler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (handler = tsdPtr->cmList; handler != NULL;
- handler = handler->nextPtr) {
+ for (handler=tsdPtr->cmList ; handler!=NULL ; handler=handler->nextPtr) {
if (handler->proc == (Tk_GenericProc *) proc) {
handler->deleteFlag = 1;
}
@@ -482,14 +1076,13 @@ Tk_DeleteClientMessageHandler(proc)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* TkEventInit --
*
- * This procedures initializes all the event module
- * structures used by the current thread. It must be
- * called before any other procedure in this file is
- * called.
+ * This functions initializes all the event module structures used by the
+ * current thread. It must be called before any other function in this
+ * file is called.
*
* Results:
* None.
@@ -497,14 +1090,14 @@ Tk_DeleteClientMessageHandler(proc)
* Side Effects:
* None.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-TkEventInit _ANSI_ARGS_((void))
+TkEventInit(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->handlersActive = 0;
tsdPtr->pendingPtr = NULL;
@@ -517,28 +1110,26 @@ TkEventInit _ANSI_ARGS_((void))
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* TkXErrorHandler --
*
- * TkXErrorHandler is an error handler, to be installed
- * via Tk_CreateErrorHandler, that will set a flag if an
- * X error occurred.
+ * TkXErrorHandler is an error handler, to be installed via
+ * Tk_CreateErrorHandler, that will set a flag if an X error occurred.
*
* Results:
- * Always returns 0, indicating that the X error was
- * handled.
+ * Always returns 0, indicating that the X error was handled.
*
* Side effects:
* None.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static int
-TkXErrorHandler (clientData, errEventPtr)
- ClientData clientData; /* Pointer to flag we set */
- XErrorEvent *errEventPtr; /* X error info */
+TkXErrorHandler(
+ ClientData clientData, /* Pointer to flag we set. */
+ XErrorEvent *errEventPtr) /* X error info. */
{
int *error;
@@ -548,12 +1139,12 @@ TkXErrorHandler (clientData, errEventPtr)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* ParentXId --
*
- * Returns the parent of the given window, or "None"
- * if the window doesn't exist.
+ * Returns the parent of the given window, or "None" if the window
+ * doesn't exist.
*
* Results:
* Returns an X window ID.
@@ -561,13 +1152,13 @@ TkXErrorHandler (clientData, errEventPtr)
* Side effects:
* None.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static Window
-ParentXId(display, w)
- Display *display;
- Window w;
+ParentXId(
+ Display *display,
+ Window w)
{
Tk_ErrorHandler handler;
int gotXError;
@@ -577,17 +1168,23 @@ ParentXId(display, w)
Window *childList;
unsigned int nChildren;
- /* Handle errors ourselves. */
+ /*
+ * Handle errors ourselves.
+ */
gotXError = 0;
handler = Tk_CreateErrorHandler(display, -1, -1, -1,
- TkXErrorHandler, (ClientData) (&gotXError));
+ TkXErrorHandler, (ClientData) (&gotXError));
- /* Get the parent window. */
+ /*
+ * Get the parent window.
+ */
status = XQueryTree(display, w, &root, &parent, &childList, &nChildren);
- /* Do some cleanup; gotta return "None" if we got an error. */
+ /*
+ * Do some cleanup; gotta return "None" if we got an error.
+ */
Tk_DeleteErrorHandler(handler);
XSync(display, False);
@@ -595,19 +1192,19 @@ ParentXId(display, w)
XFree(childList);
}
if (status == 0) {
- parent = None;
+ parent = None;
}
return parent;
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* Tk_HandleEvent --
*
- * Given an event, invoke all the handlers that have
- * been registered for the event.
+ * Given an event, invoke all the handlers that have been registered for
+ * the event.
*
* Results:
* None.
@@ -615,348 +1212,106 @@ ParentXId(display, w)
* Side effects:
* Depends on the handlers.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_HandleEvent(eventPtr)
- XEvent *eventPtr; /* Event to dispatch. */
+Tk_HandleEvent(
+ XEvent *eventPtr) /* Event to dispatch. */
{
register TkEventHandler *handlerPtr;
- register GenericHandler *genericPtr;
- register GenericHandler *genPrevPtr;
TkWindow *winPtr;
unsigned long mask;
InProgress ip;
- Window handlerWindow;
- Window parentXId;
- TkDisplay *dispPtr;
- Tcl_Interp *interp = (Tcl_Interp *) NULL;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- /*
- * Hack for simulated X-events: Correct the state field
- * of the event record to match with the ButtonPress
- * and ButtonRelease events.
- */
-
- if (eventPtr->type==ButtonPress) {
- dispPtr = TkGetDisplay(eventPtr->xbutton.display);
- dispPtr->mouseButtonWindow = eventPtr->xbutton.window;
- eventPtr->xbutton.state |= dispPtr->mouseButtonState;
- switch (eventPtr->xbutton.button) {
- case 1: dispPtr->mouseButtonState |= Button1Mask; break;
- case 2: dispPtr->mouseButtonState |= Button2Mask; break;
- case 3: dispPtr->mouseButtonState |= Button3Mask; break;
- }
- } else if (eventPtr->type==ButtonRelease) {
- dispPtr = TkGetDisplay(eventPtr->xbutton.display);
- dispPtr->mouseButtonWindow = 0;
- switch (eventPtr->xbutton.button) {
- case 1: dispPtr->mouseButtonState &= ~Button1Mask; break;
- case 2: dispPtr->mouseButtonState &= ~Button2Mask; break;
- case 3: dispPtr->mouseButtonState &= ~Button3Mask; break;
- }
- eventPtr->xbutton.state |= dispPtr->mouseButtonState;
- } else if (eventPtr->type==MotionNotify) {
- dispPtr = TkGetDisplay(eventPtr->xmotion.display);
- if (dispPtr->mouseButtonState & (Button1Mask|Button2Mask|Button3Mask)) {
- if (eventPtr->xbutton.window != dispPtr->mouseButtonWindow) {
- /*
- * This motion event should not be interpreted as a button
- * press + motion event since this is not the same window
- * the button was pressed down in.
- */
- dispPtr->mouseButtonState &=
- ~(Button1Mask|Button2Mask|Button3Mask);
- dispPtr->mouseButtonWindow = 0;
- } else {
- eventPtr->xmotion.state |= dispPtr->mouseButtonState;
- }
- }
- }
-
- /*
- * Next, invoke all the generic event handlers (those that are
- * invoked for all events). If a generic event handler reports that
- * an event is fully processed, go no further.
- */
+ Tcl_Interp *interp = NULL;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (genPrevPtr = NULL, genericPtr = tsdPtr->genericList;
- genericPtr != NULL; ) {
- if (genericPtr->deleteFlag) {
- if (!tsdPtr->handlersActive) {
- GenericHandler *tmpPtr;
-
- /*
- * This handler needs to be deleted and there are no
- * calls pending through the handler, so now is a safe
- * time to delete it.
- */
-
- tmpPtr = genericPtr->nextPtr;
- if (genPrevPtr == NULL) {
- tsdPtr->genericList = tmpPtr;
- } else {
- genPrevPtr->nextPtr = tmpPtr;
- }
- if (tmpPtr == NULL) {
- tsdPtr->lastGenericPtr = genPrevPtr;
- }
- (void) ckfree((char *) genericPtr);
- genericPtr = tmpPtr;
- continue;
- }
- } else {
- int done;
-
- tsdPtr->handlersActive++;
- done = (*genericPtr->proc)(genericPtr->clientData, eventPtr);
- tsdPtr->handlersActive--;
- if (done) {
- return;
- }
- }
- genPrevPtr = genericPtr;
- genericPtr = genPrevPtr->nextPtr;
- }
+ UpdateButtonEventState(eventPtr);
/*
- * If the event is a MappingNotify event, find its display and
- * refresh the keyboard mapping information for the display.
- * After that there's nothing else to do with the event, so just
- * quit.
+ * If the generic handler processed this event we are done and can return.
*/
- if (eventPtr->type == MappingNotify) {
- dispPtr = TkGetDisplay(eventPtr->xmapping.display);
- if (dispPtr != NULL) {
- XRefreshKeyboardMapping(&eventPtr->xmapping);
- dispPtr->bindInfoStale = 1;
- }
- return;
+ if (InvokeGenericHandlers(tsdPtr, eventPtr)) {
+ goto releaseEventResources;
}
- /*
- * Events selected by StructureNotify require special handling.
- * They look the same as those selected by SubstructureNotify.
- * The only difference is whether the "event" and "window" fields
- * are the same. Compare the two fields and convert StructureNotify
- * to SubstructureNotify if necessary.
- */
-
- handlerWindow = eventPtr->xany.window;
- mask = eventMasks[eventPtr->xany.type];
- if (mask == StructureNotifyMask) {
- if (eventPtr->xmap.event != eventPtr->xmap.window) {
- mask = SubstructureNotifyMask;
- handlerWindow = eventPtr->xmap.event;
- }
- }
- winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, handlerWindow);
- if (winPtr == NULL) {
+ if (RefreshKeyboardMappingIfNeeded(eventPtr)) {
/*
- * There isn't a TkWindow structure for this window.
- * However, if the event is a PropertyNotify event then call
- * the selection manager (it deals beneath-the-table with
- * certain properties). Also, if the window's parent is a
- * Tk window that has the TK_PROP_PROPCHANGE flag set, then
- * we must propagate the PropertyNotify event up to the parent.
+ * We are done with a MappingNotify event.
*/
- if (eventPtr->type != PropertyNotify) {
- return;
- }
-
- TkSelPropProc(eventPtr);
-
- /* Get handlerWindow's parent. */
-
- parentXId = ParentXId(eventPtr->xany.display, handlerWindow);
- if (parentXId == None) {
- return;
- }
-
- winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, parentXId);
- if (winPtr == NULL) {
- return;
- }
+ goto releaseEventResources;
+ }
- if (!(winPtr->flags & TK_PROP_PROPCHANGE)) {
- return;
- }
+ mask = GetEventMaskFromXEvent(eventPtr);
+ winPtr = GetTkWindowFromXEvent(eventPtr);
- handlerWindow = parentXId;
+ if (winPtr == NULL) {
+ goto releaseEventResources;
}
/*
* Once a window has started getting deleted, don't process any more
- * events for it except for the DestroyNotify event. This check is
- * needed because a DestroyNotify handler could re-invoke the event
- * loop, causing other pending events to be handled for the window
- * (the window doesn't get totally expunged from our tables until
- * after the DestroyNotify event has been completely handled).
+ * events for it except for the DestroyNotify event. This check is needed
+ * because a DestroyNotify handler could re-invoke the event loop, causing
+ * other pending events to be handled for the window (the window doesn't
+ * get totally expunged from our tables until after the DestroyNotify
+ * event has been completely handled).
*/
if ((winPtr->flags & TK_ALREADY_DEAD)
&& (eventPtr->type != DestroyNotify)) {
- return;
+ goto releaseEventResources;
}
if (winPtr->mainPtr != NULL) {
+ int result;
+
+ interp = winPtr->mainPtr->interp;
- /*
- * Protect interpreter for this window from possible deletion
- * while we are dealing with the event for this window. Thus,
- * widget writers do not have to worry about protecting the
- * interpreter in their own code.
- */
-
- interp = winPtr->mainPtr->interp;
- Tcl_Preserve((ClientData) interp);
-
- /*
- * Call focus-related code to look at FocusIn, FocusOut, Enter,
- * and Leave events; depending on its return value, ignore the
- * event.
- */
-
- if ((mask & (FocusChangeMask|EnterWindowMask|LeaveWindowMask))
- && !TkFocusFilterEvent(winPtr, eventPtr)) {
- Tcl_Release((ClientData) interp);
- return;
- }
-
- /*
- * Redirect KeyPress and KeyRelease events to the focus window,
- * or ignore them entirely if there is no focus window. We also
- * route the MouseWheel event to the focus window. The MouseWheel
- * event is an extension to the X event set. Currently, it is only
- * available on the Windows version of Tk.
- */
-
-#ifdef MAC_OSX_TK
- /* MouseWheel events are not focus specific on Mac OS X */
- if (mask & (KeyPressMask|KeyReleaseMask)) {
-#else
- if (mask & (KeyPressMask|KeyReleaseMask|MouseWheelMask)) {
-#endif
- winPtr->dispPtr->lastEventTime = eventPtr->xkey.time;
- winPtr = TkFocusKeyEvent(winPtr, eventPtr);
- if (winPtr == NULL) {
- Tcl_Release((ClientData) interp);
- return;
- }
- }
-
/*
- * Call a grab-related procedure to do special processing on
- * pointer events.
+ * Protect interpreter for this window from possible deletion while we
+ * are dealing with the event for this window. Thus, widget writers do
+ * not have to worry about protecting the interpreter in their own
+ * code.
*/
-
- if (mask & (ButtonPressMask|ButtonReleaseMask|PointerMotionMask
- |EnterWindowMask|LeaveWindowMask)) {
- if (mask & (ButtonPressMask|ButtonReleaseMask)) {
- winPtr->dispPtr->lastEventTime = eventPtr->xbutton.time;
- } else if (mask & PointerMotionMask) {
- winPtr->dispPtr->lastEventTime = eventPtr->xmotion.time;
- } else {
- winPtr->dispPtr->lastEventTime = eventPtr->xcrossing.time;
- }
- if (TkPointerEvent(eventPtr, winPtr) == 0) {
- goto done;
- }
+
+ Tcl_Preserve((ClientData) interp);
+
+ result = ((InvokeFocusHandlers(&winPtr, mask, eventPtr))
+ || (InvokeMouseHandlers(winPtr, mask, eventPtr)));
+
+ if (result) {
+ goto releaseInterpreter;
}
}
-#ifdef TK_USE_INPUT_METHODS
/*
- * Pass the event to the input method(s), if there are any, and
- * discard the event if the input method(s) insist. Create the
- * input context for the window if it hasn't already been done
- * (XFilterEvent needs this context). XIM is only ever enabled on
- * Unix, but this hasn't been factored out of the generic code yet.
+ * Create the input context for the window if it hasn't already been done
+ * (XFilterEvent needs this context). When the event is a FocusIn event,
+ * set the input context focus to the receiving window. This code is only
+ * ever active for X11.
*/
- dispPtr = winPtr->dispPtr;
- if ((dispPtr->flags & TK_DISPLAY_USE_IM)) {
- long im_event_mask = 0L;
+
+#ifdef TK_USE_INPUT_METHODS
+ if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) {
if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
winPtr->flags |= TK_CHECKED_IC;
- if (dispPtr->inputMethod != NULL) {
-#if TK_XIM_SPOT
- if (dispPtr->flags & TK_DISPLAY_XIM_SPOT) {
- XVaNestedList preedit_attr;
- XPoint spot = {0, 0};
-
- if (dispPtr->inputXfs == NULL) {
- /*
- * We only need to create one XFontSet
- */
- char **missing_list;
- int missing_count;
- char *def_string;
-
- dispPtr->inputXfs = XCreateFontSet(dispPtr->display,
- "-*-*-*-R-Normal--14-130-75-75-*-*",
- &missing_list, &missing_count, &def_string);
- if (missing_count > 0) {
- XFreeStringList(missing_list);
- }
- }
-
- preedit_attr = XVaCreateNestedList(0, XNSpotLocation,
- &spot, XNFontSet, dispPtr->inputXfs, NULL);
- if (winPtr->inputContext != NULL)
- panic("inputContext not NULL");
- winPtr->inputContext = XCreateIC(dispPtr->inputMethod,
- XNInputStyle, XIMPreeditPosition|XIMStatusNothing,
- XNClientWindow, winPtr->window,
- XNFocusWindow, winPtr->window,
- XNPreeditAttributes, preedit_attr,
- NULL);
- XFree(preedit_attr);
- } else {
- if (winPtr->inputContext != NULL)
- panic("inputContext not NULL");
- winPtr->inputContext = XCreateIC(dispPtr->inputMethod,
- XNInputStyle, XIMPreeditNothing|XIMStatusNothing,
- XNClientWindow, winPtr->window,
- XNFocusWindow, winPtr->window,
- NULL);
- }
-#else
- if (winPtr->inputContext != NULL)
- panic("inputContext not NULL");
- winPtr->inputContext = XCreateIC(dispPtr->inputMethod,
- XNInputStyle, XIMPreeditNothing|XIMStatusNothing,
- XNClientWindow, winPtr->window,
- XNFocusWindow, winPtr->window,
- NULL);
-#endif
- }
- }
- if (winPtr->inputContext != NULL &&
- (eventPtr->xany.type == FocusIn)) {
- XGetICValues(winPtr->inputContext,
- XNFilterEvents, &im_event_mask, NULL);
- if (im_event_mask != 0L) {
- XSelectInput(winPtr->display, winPtr->window,
- winPtr->atts.event_mask | im_event_mask);
- XSetICFocus(winPtr->inputContext);
+ if (winPtr->dispPtr->inputMethod != NULL) {
+ CreateXIC(winPtr);
}
}
- if (eventPtr->type == KeyPress || eventPtr->type == KeyRelease) {
- if (XFilterEvent(eventPtr, None)) {
- goto done;
- }
+ if (eventPtr->type == FocusIn && winPtr->inputContext != NULL) {
+ XSetICFocus(winPtr->inputContext);
}
}
-#endif /* TK_USE_INPUT_METHODS */
+#endif
/*
- * For events where it hasn't already been done, update the current
- * time in the display.
+ * For events where it hasn't already been done, update the current time
+ * in the display.
*/
if (eventPtr->type == PropertyNotify) {
@@ -964,8 +1319,8 @@ Tk_HandleEvent(eventPtr)
}
/*
- * There's a potential interaction here with Tk_DeleteEventHandler.
- * Read the documentation for pendingPtr.
+ * There's a potential interaction here with Tk_DeleteEventHandler. Read
+ * the documentation for pendingPtr.
*/
ip.eventPtr = eventPtr;
@@ -983,49 +1338,8 @@ Tk_HandleEvent(eventPtr)
Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS")) {
TkWmProtocolEventProc(winPtr, eventPtr);
} else {
- /*
- * Finally, invoke any ClientMessage event handlers.
- */
-
- for (genPrevPtr = NULL, genericPtr = tsdPtr->cmList;
- genericPtr != NULL; ) {
- if (genericPtr->deleteFlag) {
- if (!tsdPtr->handlersActive) {
- GenericHandler *tmpPtr;
-
- /*
- * This handler needs to be deleted and there are
- * no calls pending through any handlers, so now
- * is a safe time to delete it.
- */
-
- tmpPtr = genericPtr->nextPtr;
- if (genPrevPtr == NULL) {
- tsdPtr->cmList = tmpPtr;
- } else {
- genPrevPtr->nextPtr = tmpPtr;
- }
- if (tmpPtr == NULL) {
- tsdPtr->lastCmPtr = genPrevPtr;
- }
- (void) ckfree((char *) genericPtr);
- genericPtr = tmpPtr;
- continue;
- }
- } else {
- int done;
-
- tsdPtr->handlersActive++;
- done = (*(Tk_ClientMessageProc *)genericPtr->proc)
- ((Tk_Window) winPtr, eventPtr);
- tsdPtr->handlersActive--;
- if (done) {
- break;
- }
- }
- genPrevPtr = genericPtr;
- genericPtr = genPrevPtr->nextPtr;
- }
+ InvokeClientMessageHandlers(tsdPtr, (Tk_Window)winPtr,
+ eventPtr);
}
}
} else {
@@ -1040,44 +1354,53 @@ Tk_HandleEvent(eventPtr)
}
/*
- * Pass the event to the "bind" command mechanism. But, don't
- * do this for SubstructureNotify events. The "bind" command
- * doesn't support them anyway, and it's easier to filter out
- * these events here than in the lower-level procedures.
+ * Pass the event to the "bind" command mechanism. But, don't do this
+ * for SubstructureNotify events. The "bind" command doesn't support
+ * them anyway, and it's easier to filter out these events here than
+ * in the lower-level functions.
*/
/*
- * ...well, except when we use the tkwm patches, in which case
- * we DO handle CreateNotify events, so we gotta pass 'em through.
+ * ...well, except when we use the tkwm patches, in which case we DO
+ * handle CreateNotify events, so we gotta pass 'em through.
*/
if ((ip.winPtr != None)
&& ((mask != SubstructureNotifyMask)
- || (eventPtr->type == CreateNotify))) {
+ || (eventPtr->type == CreateNotify))) {
TkBindEventProc(winPtr, eventPtr);
}
}
tsdPtr->pendingPtr = ip.nextPtr;
-done:
/*
* Release the interpreter for this window so that it can be potentially
* deleted if requested.
*/
-
- if (interp != (Tcl_Interp *) NULL) {
- Tcl_Release((ClientData) interp);
+
+ releaseInterpreter:
+ if (interp != NULL) {
+ Tcl_Release((ClientData) interp);
}
+
+ /*
+ * Release the user_data from the event (if it is a virtual event and the
+ * field was non-NULL in the first place.) Note that this is done using a
+ * Tcl_Obj interface, and we set the field back to NULL afterwards out of
+ * paranoia. Also clean up any cached %A substitutions from key events.
+ */
+
+ releaseEventResources:
+ CleanUpTkEvent(eventPtr);
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* TkEventDeadWindow --
*
- * This procedure is invoked when it is determined that
- * a window is dead. It cleans up event-related information
- * about the window.
+ * This function is invoked when it is determined that a window is dead.
+ * It cleans up event-related information about the window.
*
* Results:
* None.
@@ -1085,31 +1408,30 @@ done:
* Side effects:
* Various things get cleaned up and recycled.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-TkEventDeadWindow(winPtr)
- TkWindow *winPtr; /* Information about the window
- * that is being deleted. */
+TkEventDeadWindow(
+ TkWindow *winPtr) /* Information about the window that is being
+ * deleted. */
{
register TkEventHandler *handlerPtr;
register InProgress *ipPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * While deleting all the handlers, be careful to check for
- * Tk_HandleEvent being about to process one of the deleted
- * handlers. If it is, tell it to quit (all of the handlers
- * are being deleted).
+ * While deleting all the handlers, be careful to check for Tk_HandleEvent
+ * being about to process one of the deleted handlers. If it is, tell it
+ * to quit (all of the handlers are being deleted).
*/
while (winPtr->handlerList != NULL) {
handlerPtr = winPtr->handlerList;
winPtr->handlerList = handlerPtr->nextPtr;
- for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL;
- ipPtr = ipPtr->nextPtr) {
+ for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL;
+ ipPtr = ipPtr->nextPtr) {
if (ipPtr->nextHandler == handlerPtr) {
ipPtr->nextHandler = NULL;
}
@@ -1126,15 +1448,13 @@ TkEventDeadWindow(winPtr)
*
* TkCurrentTime --
*
- * Try to deduce the current time. "Current time" means the time
- * of the event that led to the current code being executed, which
- * means the time in the most recently-nested invocation of
- * Tk_HandleEvent.
+ * Try to deduce the current time. "Current time" means the time of the
+ * event that led to the current code being executed, which means the
+ * time in the most recently-nested invocation of Tk_HandleEvent.
*
* Results:
- * The return value is the time from the current event, or
- * CurrentTime if there is no current event or if the current
- * event contains no time.
+ * The return value is the time from the current event, or CurrentTime if
+ * there is no current event or if the current event contains no time.
*
* Side effects:
* None.
@@ -1143,31 +1463,31 @@ TkEventDeadWindow(winPtr)
*/
Time
-TkCurrentTime(dispPtr)
- TkDisplay *dispPtr; /* Display for which the time is desired. */
+TkCurrentTime(
+ TkDisplay *dispPtr) /* Display for which the time is desired. */
{
register XEvent *eventPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->pendingPtr == NULL) {
return dispPtr->lastEventTime;
}
eventPtr = tsdPtr->pendingPtr->eventPtr;
switch (eventPtr->type) {
- case ButtonPress:
- case ButtonRelease:
- return eventPtr->xbutton.time;
- case KeyPress:
- case KeyRelease:
- return eventPtr->xkey.time;
- case MotionNotify:
- return eventPtr->xmotion.time;
- case EnterNotify:
- case LeaveNotify:
- return eventPtr->xcrossing.time;
- case PropertyNotify:
- return eventPtr->xproperty.time;
+ case ButtonPress:
+ case ButtonRelease:
+ return eventPtr->xbutton.time;
+ case KeyPress:
+ case KeyRelease:
+ return eventPtr->xkey.time;
+ case MotionNotify:
+ return eventPtr->xmotion.time;
+ case EnterNotify:
+ case LeaveNotify:
+ return eventPtr->xcrossing.time;
+ case PropertyNotify:
+ return eventPtr->xproperty.time;
}
return dispPtr->lastEventTime;
}
@@ -1177,15 +1497,14 @@ TkCurrentTime(dispPtr)
*
* Tk_RestrictEvents --
*
- * This procedure is used to globally restrict the set of events
- * that will be dispatched. The restriction is done by filtering
- * all incoming X events through a procedure that determines
- * whether they are to be processed immediately, deferred, or
- * discarded.
+ * This function is used to globally restrict the set of events that will
+ * be dispatched. The restriction is done by filtering all incoming X
+ * events through a function that determines whether they are to be
+ * processed immediately, deferred, or discarded.
*
* Results:
- * The return value is the previous restriction procedure in effect,
- * if there was one, or NULL if there wasn't.
+ * The return value is the previous restriction function in effect, if
+ * there was one, or NULL if there wasn't.
*
* Side effects:
* From now on, proc will be called to determine whether to process,
@@ -1195,16 +1514,15 @@ TkCurrentTime(dispPtr)
*/
Tk_RestrictProc *
-Tk_RestrictEvents(proc, arg, prevArgPtr)
- Tk_RestrictProc *proc; /* Procedure to call for each incoming
- * event. */
- ClientData arg; /* Arbitrary argument to pass to proc. */
- ClientData *prevArgPtr; /* Place to store information about previous
+Tk_RestrictEvents(
+ Tk_RestrictProc *proc, /* Function to call for each incoming event */
+ ClientData arg, /* Arbitrary argument to pass to proc. */
+ ClientData *prevArgPtr) /* Place to store information about previous
* argument. */
{
Tk_RestrictProc *prev;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
prev = tsdPtr->restrictProc;
*prevArgPtr = tsdPtr->restrictArg;
@@ -1218,7 +1536,7 @@ Tk_RestrictEvents(proc, arg, prevArgPtr)
*
* Tk_CollapseMotionEvents --
*
- * This procedure controls whether we collapse motion events in a
+ * This function controls whether we collapse motion events in a
* particular display or not.
*
* Results:
@@ -1231,10 +1549,10 @@ Tk_RestrictEvents(proc, arg, prevArgPtr)
*/
int
-Tk_CollapseMotionEvents(display, collapse)
- Display *display; /* Display handling these events. */
- int collapse; /* boolean value that specifies whether
- * motion events should be collapsed. */
+Tk_CollapseMotionEvents(
+ Display *display, /* Display handling these events. */
+ int collapse) /* Boolean value that specifies whether motion
+ * events should be collapsed. */
{
TkDisplay *dispPtr = (TkDisplay *) display;
int prev = (dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS);
@@ -1252,28 +1570,26 @@ Tk_CollapseMotionEvents(display, collapse)
*
* Tk_QueueWindowEvent --
*
- * Given an X-style window event, this procedure adds it to the
- * Tcl event queue at the given position. This procedure also
- * performs mouse motion event collapsing if possible.
+ * Given an X-style window event, this function adds it to the Tcl event
+ * queue at the given position. This function also performs mouse motion
+ * event collapsing if possible.
*
* Results:
* None.
*
* Side effects:
- * Adds stuff to the event queue, which will eventually be
- * processed.
+ * Adds stuff to the event queue, which will eventually be processed.
*
*----------------------------------------------------------------------
*/
void
-Tk_QueueWindowEvent(eventPtr, position)
- XEvent *eventPtr; /* Event to add to queue. This
- * procedures copies it before adding
- * it to the queue. */
- Tcl_QueuePosition position; /* Where to put it on the queue:
- * TCL_QUEUE_TAIL, TCL_QUEUE_HEAD,
- * or TCL_QUEUE_MARK. */
+Tk_QueueWindowEvent(
+ XEvent *eventPtr, /* Event to add to queue. This function copies
+ * it before adding it to the queue. */
+ Tcl_QueuePosition position) /* Where to put it on the queue:
+ * TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, or
+ * TCL_QUEUE_MARK. */
{
TkWindowEvent *wevPtr;
TkDisplay *dispPtr;
@@ -1292,10 +1608,11 @@ Tk_QueueWindowEvent(eventPtr, position)
}
/*
- * Don't filter motion events if the user
- * defaulting to true (1), which could be set to false (0) when the
- * user wishes to receive all the motion data)
+ * Don't filter motion events if the user defaulting to true (1), which
+ * could be set to false (0) when the user wishes to receive all the
+ * motion data)
*/
+
if (!(dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS)) {
wevPtr = (TkWindowEvent *) ckalloc(sizeof(TkWindowEvent));
wevPtr->header.proc = WindowEventProc;
@@ -1308,9 +1625,8 @@ Tk_QueueWindowEvent(eventPtr, position)
if ((eventPtr->type == MotionNotify) && (eventPtr->xmotion.window
== dispPtr->delayedMotionPtr->event.xmotion.window)) {
/*
- * The new event is a motion event in the same window as the
- * saved motion event. Just replace the saved event with the
- * new one.
+ * The new event is a motion event in the same window as the saved
+ * motion event. Just replace the saved event with the new one.
*/
dispPtr->delayedMotionPtr->event = *eventPtr;
@@ -1319,7 +1635,7 @@ Tk_QueueWindowEvent(eventPtr, position)
&& (eventPtr->type != NoExpose)
&& (eventPtr->type != Expose)) {
/*
- * The new event may conflict with the saved motion event. Queue
+ * The new event may conflict with the saved motion event. Queue
* the saved motion event now so that it will be processed before
* the new event.
*/
@@ -1335,13 +1651,13 @@ Tk_QueueWindowEvent(eventPtr, position)
wevPtr->event = *eventPtr;
if ((eventPtr->type == MotionNotify) && (position == TCL_QUEUE_TAIL)) {
/*
- * The new event is a motion event so don't queue it immediately;
- * save it around in case another motion event arrives that it can
- * be collapsed with.
+ * The new event is a motion event so don't queue it immediately; save
+ * it around in case another motion event arrives that it can be
+ * collapsed with.
*/
if (dispPtr->delayedMotionPtr != NULL) {
- panic("Tk_QueueWindowEvent found unexpected delayed motion event");
+ Tcl_Panic("Tk_QueueWindowEvent found unexpected delayed motion event");
}
dispPtr->delayedMotionPtr = wevPtr;
Tcl_DoWhenIdle(DelayedMotionProc, (ClientData) dispPtr);
@@ -1351,12 +1667,12 @@ Tk_QueueWindowEvent(eventPtr, position)
}
/*
- *---------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* TkQueueEventForAllChildren --
*
- * Given an XEvent, recursively queue the event for this window and
- * all non-toplevel children of the given window.
+ * Given an XEvent, recursively queue the event for this window and all
+ * non-toplevel children of the given window.
*
* Results:
* None.
@@ -1364,23 +1680,23 @@ Tk_QueueWindowEvent(eventPtr, position)
* Side effects:
* Events queued.
*
- *---------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-TkQueueEventForAllChildren(winPtr, eventPtr)
- TkWindow *winPtr; /* Window to which event is sent. */
- XEvent *eventPtr; /* The event to be sent. */
+TkQueueEventForAllChildren(
+ TkWindow *winPtr, /* Window to which event is sent. */
+ XEvent *eventPtr) /* The event to be sent. */
{
TkWindow *childPtr;
if (!Tk_IsMapped(winPtr)) {
- return;
+ return;
}
-
+
eventPtr->xany.window = winPtr->window;
Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_TAIL);
-
+
childPtr = winPtr->childList;
while (childPtr != NULL) {
if (!Tk_TopWinHierarchy(childPtr)) {
@@ -1395,16 +1711,16 @@ TkQueueEventForAllChildren(winPtr, eventPtr)
*
* WindowEventProc --
*
- * This procedure is called by Tcl_DoOneEvent when a window event
- * reaches the front of the event queue. This procedure is responsible
- * for actually handling the event.
+ * This function is called by Tcl_DoOneEvent when a window event reaches
+ * the front of the event queue. This function is responsible for
+ * actually handling the event.
*
* Results:
- * Returns 1 if the event was handled, meaning it should be removed
- * from the queue. Returns 0 if the event was not handled, meaning
- * it should stay on the queue. The event isn't handled if the
- * TCL_WINDOW_EVENTS bit isn't set in flags, if a restrict proc
- * prevents the event from being handled.
+ * Returns 1 if the event was handled, meaning it should be removed from
+ * the queue. Returns 0 if the event was not handled, meaning it should
+ * stay on the queue. The event isn't handled if the TCL_WINDOW_EVENTS
+ * bit isn't set in flags, if a restrict proc prevents the event from
+ * being handled.
*
* Side effects:
* Whatever the event handlers for the event do.
@@ -1413,15 +1729,15 @@ TkQueueEventForAllChildren(winPtr, eventPtr)
*/
static int
-WindowEventProc(evPtr, flags)
- Tcl_Event *evPtr; /* Event to service. */
- int flags; /* Flags that indicate what events to
- * handle, such as TCL_WINDOW_EVENTS. */
+WindowEventProc(
+ Tcl_Event *evPtr, /* Event to service. */
+ int flags) /* Flags that indicate what events to handle,
+ * such as TCL_WINDOW_EVENTS. */
{
TkWindowEvent *wevPtr = (TkWindowEvent *) evPtr;
Tk_RestrictAction result;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(flags & TCL_WINDOW_EVENTS)) {
return 0;
@@ -1436,68 +1752,398 @@ WindowEventProc(evPtr, flags)
* TK_DELETE_EVENT: return and say we processed the event,
* even though we didn't do anything at all.
*/
+
+ CleanUpTkEvent(&wevPtr->event);
return 1;
}
}
}
Tk_HandleEvent(&wevPtr->event);
+ CleanUpTkEvent(&wevPtr->event);
return 1;
}
/*
*----------------------------------------------------------------------
*
+ * CleanUpTkEvent --
+ *
+ * This function is called to remove and deallocate any information in
+ * the event which is not directly in the event structure itself. It may
+ * be called multiple times per event, so it takes care to set the
+ * cleared pointer fields to NULL afterwards.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Makes the event no longer have any external resources.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CleanUpTkEvent(
+ XEvent *eventPtr)
+{
+ switch (eventPtr->type) {
+ case KeyPress:
+ case KeyRelease: {
+ TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr;
+
+ if (kePtr->charValuePtr != NULL) {
+ ckfree(kePtr->charValuePtr);
+ kePtr->charValuePtr = NULL;
+ kePtr->charValueLen = 0;
+ }
+ break;
+ }
+
+ case VirtualEvent: {
+ XVirtualEvent *vePtr = (XVirtualEvent *) eventPtr;
+
+ if (vePtr->user_data != NULL) {
+ Tcl_DecrRefCount(vePtr->user_data);
+ vePtr->user_data = NULL;
+ }
+ break;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* DelayedMotionProc --
*
- * This procedure is invoked as an idle handler when a mouse motion
- * event has been delayed. It queues the delayed event so that it
- * will finally be serviced.
+ * This function is invoked as an idle handler when a mouse motion event
+ * has been delayed. It queues the delayed event so that it will finally
+ * be serviced.
*
* Results:
* None.
*
* Side effects:
- * The delayed mouse motion event gets added to the Tcl event
- * queue for servicing.
+ * The delayed mouse motion event gets added to the Tcl event queue for
+ * servicing.
*
*----------------------------------------------------------------------
*/
static void
-DelayedMotionProc(clientData)
- ClientData clientData; /* Pointer to display containing a delayed
+DelayedMotionProc(
+ ClientData clientData) /* Pointer to display containing a delayed
* motion event to be serviced. */
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
if (dispPtr->delayedMotionPtr == NULL) {
- panic("DelayedMotionProc found no delayed mouse motion event");
+ Tcl_Panic("DelayedMotionProc found no delayed mouse motion event");
}
Tcl_QueueEvent(&dispPtr->delayedMotionPtr->header, TCL_QUEUE_TAIL);
dispPtr->delayedMotionPtr = NULL;
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
+ *
+ * TkCreateExitHandler --
+ *
+ * Same as Tcl_CreateExitHandler, but private to Tk.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects.
+ * Sets a handler with Tcl_CreateExitHandler if this is the first call.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkCreateExitHandler(
+ Tcl_ExitProc *proc, /* Function to invoke. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
+{
+ ExitHandler *exitPtr;
+
+ exitPtr = (ExitHandler *) ckalloc(sizeof(ExitHandler));
+ exitPtr->proc = proc;
+ exitPtr->clientData = clientData;
+ Tcl_MutexLock(&exitMutex);
+
+ /*
+ * The call to TclInExit() is disabled here. That's a private Tcl routine,
+ * and calling it is causing some trouble with portability of building Tk.
+ * We should avoid private Tcl routines generally.
+ *
+ * In this case, the TclInExit() call is being used only to prevent a
+ * Tcl_CreateExitHandler() call when Tcl finalization is in progress.
+ * That's a situation that shouldn't happen anyway. Recent changes within
+ * Tcl_Finalize now cause a Tcl_Panic() to happen if exit handlers get
+ * added after exit handling is complete. By disabling the guard here,
+ * that panic will serve to help us find the buggy conditions and correct
+ * them.
+ *
+ * We can restore this guard if we find we must (hopefully getting public
+ * access to TclInExit() if we discover extensions really do need this),
+ * but during alpha development, this is a good time to dig in and find
+ * the root causes of finalization bugs.
+ */
+
+ if (firstExitPtr == NULL/* && !TclInExit()*/) {
+ Tcl_CreateExitHandler(TkFinalize, NULL);
+ }
+ exitPtr->nextPtr = firstExitPtr;
+ firstExitPtr = exitPtr;
+ Tcl_MutexUnlock(&exitMutex);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkDeleteExitHandler --
+ *
+ * Same as Tcl_DeleteExitHandler, but private to Tk.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects.
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkDeleteExitHandler(
+ Tcl_ExitProc *proc, /* Function that was previously registered. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
+{
+ ExitHandler *exitPtr, *prevPtr;
+
+ Tcl_MutexLock(&exitMutex);
+ for (prevPtr = NULL, exitPtr = firstExitPtr; exitPtr != NULL;
+ prevPtr = exitPtr, exitPtr = exitPtr->nextPtr) {
+ if ((exitPtr->proc == proc)
+ && (exitPtr->clientData == clientData)) {
+ if (prevPtr == NULL) {
+ firstExitPtr = exitPtr->nextPtr;
+ } else {
+ prevPtr->nextPtr = exitPtr->nextPtr;
+ }
+ ckfree((char *) exitPtr);
+ break;
+ }
+ }
+ Tcl_MutexUnlock(&exitMutex);
+ return;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkCreateThreadExitHandler --
+ *
+ * Same as Tcl_CreateThreadExitHandler, but private to Tk.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Proc will be invoked with clientData as argument when the application
+ * exits.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkCreateThreadExitHandler(
+ Tcl_ExitProc *proc, /* Function to invoke. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
+{
+ ExitHandler *exitPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ exitPtr = (ExitHandler *) ckalloc(sizeof(ExitHandler));
+ exitPtr->proc = proc;
+ exitPtr->clientData = clientData;
+
+ /*
+ * See comments in TkCreateExitHandler().
+ */
+
+ if (tsdPtr->firstExitPtr == NULL/* && !TclInExit()*/) {
+ Tcl_CreateThreadExitHandler(TkFinalizeThread, NULL);
+ }
+ exitPtr->nextPtr = tsdPtr->firstExitPtr;
+ tsdPtr->firstExitPtr = exitPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkDeleteThreadExitHandler --
+ *
+ * Same as Tcl_DeleteThreadExitHandler, but private to Tk.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * If there is an exit handler corresponding to proc and clientData then
+ * it is cancelled; if no such handler exists then nothing happens.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkDeleteThreadExitHandler(
+ Tcl_ExitProc *proc, /* Function that was previously registered. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
+{
+ ExitHandler *exitPtr, *prevPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ for (prevPtr = NULL, exitPtr = tsdPtr->firstExitPtr; exitPtr != NULL;
+ prevPtr = exitPtr, exitPtr = exitPtr->nextPtr) {
+ if ((exitPtr->proc == proc)
+ && (exitPtr->clientData == clientData)) {
+ if (prevPtr == NULL) {
+ tsdPtr->firstExitPtr = exitPtr->nextPtr;
+ } else {
+ prevPtr->nextPtr = exitPtr->nextPtr;
+ }
+ ckfree((char *) exitPtr);
+ return;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkFinalize --
+ *
+ * Runs our private exit handlers and removes itself from Tcl. This is
+ * benificial should we want to protect from dangling pointers should the
+ * Tk shared library be unloaded prior to Tcl which can happen on windows
+ * should the process be forcefully exiting from an exception handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects.
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkFinalize(
+ ClientData clientData) /* Arbitrary value to pass to proc. */
+{
+ ExitHandler *exitPtr;
+
+ Tcl_DeleteExitHandler(TkFinalize, NULL);
+
+ Tcl_MutexLock(&exitMutex);
+ for (exitPtr = firstExitPtr; exitPtr != NULL; exitPtr = firstExitPtr) {
+ /*
+ * Be careful to remove the handler from the list before invoking its
+ * callback. This protects us against double-freeing if the callback
+ * should call TkDeleteExitHandler on itself.
+ */
+
+ firstExitPtr = exitPtr->nextPtr;
+ Tcl_MutexUnlock(&exitMutex);
+ (*exitPtr->proc)(exitPtr->clientData);
+ ckfree((char *) exitPtr);
+ Tcl_MutexLock(&exitMutex);
+ }
+ firstExitPtr = NULL;
+ Tcl_MutexUnlock(&exitMutex);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkFinalizeThread --
+ *
+ * Runs our private thread exit handlers and removes itself from Tcl.
+ * This is benificial should we want to protect from dangling pointers
+ * should the Tk shared library be unloaded prior to Tcl which can happen
+ * on Windows should the process be forcefully exiting from an exception
+ * handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects.
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkFinalizeThread(
+ ClientData clientData) /* Arbitrary value to pass to proc. */
+{
+ ExitHandler *exitPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL);
+
+ if (tsdPtr != NULL) {
+ tsdPtr->inExit = 1;
+
+ for (exitPtr = tsdPtr->firstExitPtr; exitPtr != NULL;
+ exitPtr = tsdPtr->firstExitPtr) {
+ /*
+ * Be careful to remove the handler from the list before invoking
+ * its callback. This protects us against double-freeing if the
+ * callback should call TkDeleteThreadExitHandler on itself.
+ */
+
+ tsdPtr->firstExitPtr = exitPtr->nextPtr;
+ (*exitPtr->proc)(exitPtr->clientData);
+ ckfree((char *) exitPtr);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
*
* Tk_MainLoop --
*
- * Call Tcl_DoOneEvent over and over again in an infinite
- * loop as long as there exist any main windows.
+ * Call Tcl_DoOneEvent over and over again in an infinite loop as long as
+ * there exist any main windows.
*
* Results:
* None.
*
* Side effects:
- * Arbitrary; depends on handlers for events.
+ * Arbitrary; depends on handlers for events.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
void
-Tk_MainLoop()
+Tk_MainLoop(void)
{
while (Tk_GetNumMainWindows() > 0) {
Tcl_DoOneEvent(0);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c
index 3fa8303..547dd9b 100644
--- a/generic/tkFileFilter.c
+++ b/generic/tkFileFilter.c
@@ -6,33 +6,29 @@
*
* Copyright (c) 1996 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
#include "tkFileFilter.h"
-static int AddClause _ANSI_ARGS_((
- Tcl_Interp * interp, FileFilter * filterPtr,
- CONST char * patternsStr, CONST char * ostypesStr,
- int isWindows));
-static void FreeClauses _ANSI_ARGS_((FileFilter * filterPtr));
-static void FreeGlobPatterns _ANSI_ARGS_((
- FileFilterClause * clausePtr));
-static void FreeMacFileTypes _ANSI_ARGS_((
- FileFilterClause * clausePtr));
-static FileFilter * GetFilter _ANSI_ARGS_((FileFilterList * flistPtr,
- CONST char * name));
+static int AddClause(Tcl_Interp *interp,
+ FileFilter *filterPtr, Tcl_Obj *patternsObj,
+ Tcl_Obj *ostypesObj, int isWindows);
+static void FreeClauses(FileFilter *filterPtr);
+static void FreeGlobPatterns(FileFilterClause *clausePtr);
+static void FreeMacFileTypes(FileFilterClause *clausePtr);
+static FileFilter * GetFilter(FileFilterList *flistPtr, CONST char *name);
/*
*----------------------------------------------------------------------
*
* TkInitFileFilters --
*
- * Initializes a FileFilterList data structure. A FileFilterList
- * must be initialized EXACTLY ONCE before any calls to
- * TkGetFileFilters() is made. The usual flow of control is:
+ * Initializes a FileFilterList data structure. A FileFilterList must be
+ * initialized EXACTLY ONCE before any calls to TkGetFileFilters() is
+ * made. The usual flow of control is:
* TkInitFileFilters(&flist);
* TkGetFileFilters(&flist, ...);
* TkGetFileFilters(&flist, ...);
@@ -44,12 +40,13 @@ static FileFilter * GetFilter _ANSI_ARGS_((FileFilterList * flistPtr,
*
* Side effects:
* The fields in flistPtr are initialized.
+ *
*----------------------------------------------------------------------
*/
void
-TkInitFileFilters(flistPtr)
- FileFilterList * flistPtr; /* The structure to be initialized. */
+TkInitFileFilters(
+ FileFilterList *flistPtr) /* The structure to be initialized. */
{
flistPtr->filters = NULL;
flistPtr->filtersTail = NULL;
@@ -61,11 +58,11 @@ TkInitFileFilters(flistPtr)
*
* TkGetFileFilters --
*
- * This function is called by the Mac and Windows implementation
- * of tk_getOpenFile and tk_getSaveFile to translate the string
- * value of the -filetypes option of into an easy-to-parse C
- * structure (flistPtr). The caller of this function will then use
- * flistPtr to perform filetype matching in a platform specific way.
+ * This function is called by the Mac and Windows implementation of
+ * tk_getOpenFile and tk_getSaveFile to translate the string value of the
+ * -filetypes option into an easy-to-parse C structure (flistPtr). The
+ * caller of this function will then use flistPtr to perform filetype
+ * matching in a platform specific way.
*
* flistPtr must be initialized (See comments in TkInitFileFilters).
*
@@ -73,85 +70,74 @@ TkInitFileFilters(flistPtr)
* A standard TCL return value.
*
* Side effects:
- * The fields in flistPtr are changed according to string.
+ * The fields in flistPtr are changed according to 'types'.
+ *
*----------------------------------------------------------------------
*/
+
int
-TkGetFileFilters(interp, flistPtr, string, isWindows)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- FileFilterList * flistPtr; /* Stores the list of file filters. */
- char * string; /* Value of the -filetypes option. */
- int isWindows; /* True if we are running on Windows. */
+TkGetFileFilters(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ FileFilterList *flistPtr, /* Stores the list of file filters. */
+ Tcl_Obj *types, /* Value of the -filetypes option. */
+ int isWindows) /* True if we are running on Windows. */
{
- int listArgc;
- CONST char ** listArgv = NULL;
- CONST char ** typeInfo = NULL;
- int code = TCL_OK;
+ int listObjc;
+ Tcl_Obj ** listObjv = NULL;
int i;
- if (Tcl_SplitList(interp, string, &listArgc, &listArgv) != TCL_OK) {
+ if (types == NULL) {
+ return TCL_OK;
+ }
+
+ if (Tcl_ListObjGetElements(interp, types, &listObjc,
+ &listObjv) != TCL_OK) {
return TCL_ERROR;
}
- if (listArgc == 0) {
- goto done;
+ if (listObjc == 0) {
+ return TCL_OK;
}
/*
- * Free the filter information that have been allocated the previous
- * time -- the -filefilters option may have been used more than once in
- * the command line.
+ * Free the filter information that have been allocated the previous time;
+ * the -filefilters option may have been used more than once in the
+ * command line.
*/
TkFreeFileFilters(flistPtr);
- for (i = 0; i<listArgc; i++) {
+ for (i = 0; i<listObjc; i++) {
/*
- * Each file type should have two or three elements: the first one
- * is the name of the type and the second is the filter of the type.
- * The third is the Mac OSType ID, but we don't care about them here.
+ * Each file type should have two or three elements: the first one is
+ * the name of the type and the second is the filter of the type. The
+ * third is the Mac OSType ID, but we don't care about them here.
*/
+
int count;
- FileFilter * filterPtr;
+ FileFilter *filterPtr;
+ Tcl_Obj **typeInfo;
- if (Tcl_SplitList(interp, listArgv[i], &count, &typeInfo) != TCL_OK) {
- code = TCL_ERROR;
- goto done;
+ if (Tcl_ListObjGetElements(interp, listObjv[i], &count,
+ &typeInfo) != TCL_OK) {
+ return TCL_ERROR;
}
-
+
if (count != 2 && count != 3) {
- Tcl_AppendResult(interp, "bad file type \"", listArgv[i], "\", ",
- "should be \"typeName {extension ?extensions ...?} ",
- "?{macType ?macTypes ...?}?\"", NULL);
- code = TCL_ERROR;
- goto done;
+ Tcl_AppendResult(interp, "bad file type \"",
+ Tcl_GetString(listObjv[i]), "\", ",
+ "should be \"typeName {extension ?extensions ...?} ",
+ "?{macType ?macTypes ...?}?\"", NULL);
+ return TCL_ERROR;
}
- filterPtr = GetFilter(flistPtr, typeInfo[0]);
-
- if (count == 2) {
- code = AddClause(interp, filterPtr, typeInfo[1], NULL,
- isWindows);
- } else {
- code = AddClause(interp, filterPtr, typeInfo[1], typeInfo[2],
- isWindows);
- }
- if (code != TCL_OK) {
- goto done;
- }
+ filterPtr = GetFilter(flistPtr, Tcl_GetString(typeInfo[0]));
- if (typeInfo) {
- ckfree((char*)typeInfo);
+ if (AddClause(interp, filterPtr, typeInfo[1],
+ (count==2 ? NULL : typeInfo[2]), isWindows) != TCL_OK) {
+ return TCL_ERROR;
}
- typeInfo = NULL;
}
- done:
- if (typeInfo) {
- ckfree((char*)typeInfo);
- }
- if (listArgv) {
- ckfree((char*)listArgv);
- }
- return code;
+ return TCL_OK;
}
/*
@@ -166,19 +152,20 @@ TkGetFileFilters(interp, flistPtr, string, isWindows)
*
* Side effects:
* The fields allocated by TkGetFileFilters() are freed.
+ *
*----------------------------------------------------------------------
*/
void
-TkFreeFileFilters(flistPtr)
- FileFilterList * flistPtr; /* List of file filters to free */
+TkFreeFileFilters(
+ FileFilterList *flistPtr) /* List of file filters to free */
{
- FileFilter * filterPtr, *toFree;
+ FileFilter *filterPtr, *toFree;
filterPtr=flistPtr->filters;
- while (filterPtr) {
+ while (filterPtr != NULL) {
toFree = filterPtr;
- filterPtr=filterPtr->next;
+ filterPtr = filterPtr->next;
FreeClauses(toFree);
ckfree((char*)toFree->name);
ckfree((char*)toFree);
@@ -198,41 +185,82 @@ TkFreeFileFilters(flistPtr)
*
* Side effects:
* The list of filter clauses are updated in filterPtr.
+ *
*----------------------------------------------------------------------
*/
-static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows)
- Tcl_Interp * interp; /* Interpreter to use for error reporting. */
- FileFilter * filterPtr; /* Stores the new filter clause */
- CONST char * patternsStr; /* A TCL list of glob patterns. */
- CONST char * ostypesStr; /* A TCL list of Mac OSType strings. */
- int isWindows; /* True if we are running on Windows; False
- * if we are running on the Mac; Glob
- * patterns need to be processed differently
- * on these two platforms */
+static int
+AddClause(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ FileFilter *filterPtr, /* Stores the new filter clause */
+ Tcl_Obj *patternsObj, /* A Tcl list of glob patterns. */
+ Tcl_Obj *ostypesObj, /* A Tcl list of Mac OSType strings. */
+ int isWindows) /* True if we are running on Windows; False if
+ * we are running on the Mac; Glob patterns
+ * need to be processed differently on these
+ * two platforms */
{
- CONST char ** globList = NULL;
- int globCount;
- CONST char ** ostypeList = NULL;
- int ostypeCount;
- FileFilterClause * clausePtr;
- int i;
- int code = TCL_OK;
+ Tcl_Obj **globList = NULL, **ostypeList = NULL;
+ int globCount, ostypeCount, i, code = TCL_OK;
+ FileFilterClause *clausePtr;
+ Tcl_Encoding macRoman = NULL;
- if (Tcl_SplitList(interp, patternsStr, &globCount, &globList)!= TCL_OK) {
+ if (Tcl_ListObjGetElements(interp, patternsObj,
+ &globCount, &globList) != TCL_OK) {
code = TCL_ERROR;
goto done;
}
- if (ostypesStr != NULL) {
- if (Tcl_SplitList(interp, ostypesStr, &ostypeCount, &ostypeList)
- != TCL_OK) {
+ if (ostypesObj != NULL) {
+ if (Tcl_ListObjGetElements(interp, ostypesObj,
+ &ostypeCount, &ostypeList) != TCL_OK) {
code = TCL_ERROR;
goto done;
}
+
+ /*
+ * We probably need this encoding now...
+ */
+
+ macRoman = Tcl_GetEncoding(NULL, "macRoman");
+
+ /*
+ * Might be cleaner to use 'Tcl_GetOSTypeFromObj' but that is actually
+ * static to the MacOS X/Darwin version of Tcl, and would therefore
+ * require further code refactoring.
+ */
+
for (i=0; i<ostypeCount; i++) {
- if (strlen(ostypeList[i]) != 4) {
+ int len;
+ CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
+
+ /*
+ * If len is < 4, it is definitely an error. If equal or longer,
+ * we need to use the macRoman encoding to determine the correct
+ * length (assuming there may be non-ascii characters, e.g.,
+ * embedded nulls or accented characters in the string, the
+ * macRoman length will be different).
+ *
+ * If we couldn't load the encoding, then we can't actually check
+ * the correct length. But here we assume we're probably operating
+ * on unix/windows with a minimal set of encodings and so don't
+ * care about MacOS types. So we won't signal an error.
+ */
+
+ if (len >= 4 && macRoman != NULL) {
+ Tcl_DString osTypeDS;
+
+ /*
+ * Convert utf to macRoman, since MacOS types are defined to
+ * be 4 macRoman characters long
+ */
+
+ Tcl_UtfToExternalDString(macRoman, strType, len, &osTypeDS);
+ len = Tcl_DStringLength(&osTypeDS);
+ Tcl_DStringFree(&osTypeDS);
+ }
+ if (len != 4) {
Tcl_AppendResult(interp, "bad Macintosh file type \"",
- ostypeList[i], "\"", NULL);
+ Tcl_GetString(ostypeList[i]), "\"", NULL);
code = TCL_ERROR;
goto done;
}
@@ -240,7 +268,7 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows)
}
/*
- * Add the clause into the list of clauses
+ * Add the clause into the list of clauses
*/
clausePtr = (FileFilterClause*)ckalloc(sizeof(FileFilterClause));
@@ -259,40 +287,40 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows)
if (globCount > 0 && globList != NULL) {
for (i=0; i<globCount; i++) {
- GlobPattern * globPtr = (GlobPattern*)ckalloc(sizeof(GlobPattern));
+ GlobPattern *globPtr = (GlobPattern*)ckalloc(sizeof(GlobPattern));
int len;
-
- len = (strlen(globList[i]) + 1) * sizeof(char);
- if (globList[i][0] && globList[i][0] != '*') {
+ CONST char *str = Tcl_GetStringFromObj(globList[i], &len);
+ len = (len + 1) * sizeof(char);
+
+ if (str[0] && str[0] != '*') {
/*
* Prepend a "*" to patterns that do not have a leading "*"
*/
+
globPtr->pattern = (char*)ckalloc((unsigned int) len+1);
globPtr->pattern[0] = '*';
- strcpy(globPtr->pattern+1, globList[i]);
- }
- else if (isWindows) {
- if (strcmp(globList[i], "*") == 0) {
- globPtr->pattern = (char*)ckalloc(4*sizeof(char));
+ strcpy(globPtr->pattern+1, str);
+ } else if (isWindows) {
+ if (strcmp(str, "*") == 0) {
+ globPtr->pattern = (char*)ckalloc(4 * sizeof(char));
strcpy(globPtr->pattern, "*.*");
- }
- else if (strcmp(globList[i], "") == 0) {
+ } else if (strcmp(str, "") == 0) {
/*
* An empty string means "match all files with no
* extensions"
* BUG: "*." actually matches with all files on Win95
*/
- globPtr->pattern = (char*)ckalloc(3*sizeof(char));
+
+ globPtr->pattern = (char *) ckalloc(3 * sizeof(char));
strcpy(globPtr->pattern, "*.");
- }
- else {
- globPtr->pattern = (char*)ckalloc((unsigned int) len);
- strcpy(globPtr->pattern, globList[i]);
+ } else {
+ globPtr->pattern = (char *) ckalloc((unsigned int) len);
+ strcpy(globPtr->pattern, str);
}
} else {
- globPtr->pattern = (char*)ckalloc((unsigned int) len);
- strcpy(globPtr->pattern, globList[i]);
+ globPtr->pattern = (char *) ckalloc((unsigned int) len);
+ strcpy(globPtr->pattern, str);
}
/*
@@ -308,13 +336,27 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows)
globPtr->next = NULL;
}
}
- if (ostypeCount > 0 && ostypeList != NULL) {
+ if (ostypeList != NULL && ostypeCount > 0) {
+ if (macRoman == NULL) {
+ macRoman = Tcl_GetEncoding(NULL, "macRoman");
+ }
for (i=0; i<ostypeCount; i++) {
- MacFileType * mfPtr = (MacFileType*)ckalloc(sizeof(MacFileType));
- CONST char *string = ostypeList[i];
+ Tcl_DString osTypeDS;
+ int len;
+ MacFileType *mfPtr = (MacFileType *) ckalloc(sizeof(MacFileType));
+ CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
+ char *string;
+ /*
+ * Convert utf to macRoman, since MacOS types are defined to be 4
+ * macRoman characters long
+ */
+
+ Tcl_UtfToExternalDString(macRoman, strType, len, &osTypeDS);
+ string = Tcl_DStringValue(&osTypeDS);
mfPtr->type = (OSType) string[0] << 24 | (OSType) string[1] << 16 |
(OSType) string[2] << 8 | (OSType) string[3];
+ Tcl_DStringFree(&osTypeDS);
/*
* Add the Mac type pattern into the list of Mac types
@@ -331,15 +373,11 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows)
}
done:
- if (globList) {
- ckfree((char*)globList);
+ if (macRoman != NULL) {
+ Tcl_FreeEncoding(macRoman);
}
- if (ostypeList) {
- ckfree((char*)ostypeList);
- }
-
return code;
-}
+}
/*
*----------------------------------------------------------------------
@@ -353,28 +391,30 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows)
*
* Side effects:
* The list of filters are updated in flistPtr.
+ *
*----------------------------------------------------------------------
*/
-static FileFilter * GetFilter(flistPtr, name)
- FileFilterList * flistPtr; /* The FileFilterList that contains the
- * newly created filter */
- CONST char * name; /* Name of the filter. It is usually displayed
+static FileFilter *
+GetFilter(
+ FileFilterList *flistPtr, /* The FileFilterList that contains the newly
+ * created filter */
+ CONST char *name) /* Name of the filter. It is usually displayed
* in the "File Types" listbox in the file
* dialogs. */
{
- FileFilter * filterPtr;
+ FileFilter *filterPtr = flistPtr->filters;
- for (filterPtr=flistPtr->filters; filterPtr; filterPtr=filterPtr->next) {
- if (strcmp(filterPtr->name, name)==0) {
+ for (; filterPtr; filterPtr=filterPtr->next) {
+ if (strcmp(filterPtr->name, name) == 0) {
return filterPtr;
}
}
- filterPtr = (FileFilter*)ckalloc(sizeof(FileFilter));
+ filterPtr = (FileFilter *) ckalloc(sizeof(FileFilter));
filterPtr->clauses = NULL;
filterPtr->clausesTail = NULL;
- filterPtr->name = (char*)ckalloc((strlen(name)+1) * sizeof(char));
+ filterPtr->name = (char *) ckalloc((strlen(name)+1) * sizeof(char));
strcpy(filterPtr->name, name);
if (flistPtr->filters == NULL) {
@@ -401,22 +441,23 @@ static FileFilter * GetFilter(flistPtr, name)
*
* Side effects:
* The list of clauses in filterPtr->clauses are freed.
+ *
*----------------------------------------------------------------------
*/
static void
-FreeClauses(filterPtr)
- FileFilter * filterPtr; /* FileFilter whose clauses are to be freed */
+FreeClauses(
+ FileFilter *filterPtr) /* FileFilter whose clauses are to be freed */
{
- FileFilterClause * clausePtr, * toFree;
+ FileFilterClause *clausePtr = filterPtr->clauses;
+
+ while (clausePtr != NULL) {
+ FileFilterClause *toFree = clausePtr;
+ clausePtr = clausePtr->next;
- clausePtr = filterPtr->clauses;
- while (clausePtr) {
- toFree = clausePtr;
- clausePtr=clausePtr->next;
FreeGlobPatterns(toFree);
FreeMacFileTypes(toFree);
- ckfree((char*)toFree);
+ ckfree((char *) toFree);
}
filterPtr->clauses = NULL;
filterPtr->clausesTail = NULL;
@@ -434,22 +475,22 @@ FreeClauses(filterPtr)
*
* Side effects:
* The list of glob patterns in clausePtr->patterns are freed.
+ *
*----------------------------------------------------------------------
*/
static void
-FreeGlobPatterns(clausePtr)
- FileFilterClause * clausePtr;/* The clause whose patterns are to be freed*/
+FreeGlobPatterns(
+ FileFilterClause *clausePtr)/* The clause whose patterns are to be freed*/
{
- GlobPattern * globPtr, * toFree;
+ GlobPattern *globPtr = clausePtr->patterns;
- globPtr = clausePtr->patterns;
- while (globPtr) {
- toFree = globPtr;
- globPtr=globPtr->next;
+ while (globPtr != NULL) {
+ GlobPattern *toFree = globPtr;
+ globPtr = globPtr->next;
- ckfree((char*)toFree->pattern);
- ckfree((char*)toFree);
+ ckfree((char *) toFree->pattern);
+ ckfree((char *) toFree);
}
clausePtr->patterns = NULL;
}
@@ -466,21 +507,29 @@ FreeGlobPatterns(clausePtr)
*
* Side effects:
* The list of Mac file types in clausePtr->macTypes are freed.
+ *
*----------------------------------------------------------------------
*/
static void
-FreeMacFileTypes(clausePtr)
- FileFilterClause * clausePtr; /* The clause whose mac types are to be
- * freed */
+FreeMacFileTypes(
+ FileFilterClause *clausePtr)/* The clause whose mac types are to be
+ * freed */
{
- MacFileType * mfPtr, * toFree;
+ MacFileType *mfPtr = clausePtr->macTypes;
- mfPtr = clausePtr->macTypes;
- while (mfPtr) {
- toFree = mfPtr;
- mfPtr=mfPtr->next;
- ckfree((char*)toFree);
+ while (mfPtr != NULL) {
+ MacFileType *toFree = mfPtr;
+ mfPtr = mfPtr->next;
+ ckfree((char *) toFree);
}
clausePtr->macTypes = NULL;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkFileFilter.h b/generic/tkFileFilter.h
index 8d7021e..24002df 100644
--- a/generic/tkFileFilter.h
+++ b/generic/tkFileFilter.h
@@ -1,23 +1,19 @@
/*
* tkFileFilter.h --
*
- * Declarations for the file filter processing routines needed by
- * the file selection dialogs.
+ * Declarations for the file filter processing routines needed by the
+ * file selection dialogs.
*
* Copyright (c) 1996 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TK_FILE_FILTER
#define _TK_FILE_FILTER
-#ifdef MAC_TCL
-#include <StandardFile.h>
-#else
#define OSType long
-#endif
#ifdef BUILD_tk
# undef TCL_STORAGE_CLASS
@@ -25,65 +21,65 @@
#endif
typedef struct GlobPattern {
- struct GlobPattern * next; /* Chains to the next glob pattern
- * in a glob pattern list */
- char * pattern; /* String value of the pattern, such
- * as "*.txt" or "*.*"
- */
+ struct GlobPattern *next; /* Chains to the next glob pattern in a glob
+ * pattern list */
+ char *pattern; /* String value of the pattern, such as
+ * "*.txt" or "*.*" */
} GlobPattern;
typedef struct MacFileType {
- struct MacFileType * next; /* Chains to the next mac file type
- * in a mac file type list */
- OSType type; /* Mac file type, such as 'TEXT' or
- * 'GIFF' */
+ struct MacFileType *next; /* Chains to the next mac file type in a mac
+ * file type list */
+ OSType type; /* Mac file type, such as 'TEXT' or 'GIFF' */
} MacFileType;
typedef struct FileFilterClause {
- struct FileFilterClause * next; /* Chains to the next clause in
- * a clause list */
- GlobPattern * patterns; /* Head of glob pattern type list */
- GlobPattern * patternsTail; /* Tail of glob pattern type list */
- MacFileType * macTypes; /* Head of mac file type list */
- MacFileType * macTypesTail; /* Tail of mac file type list */
+ struct FileFilterClause *next;
+ /* Chains to the next clause in a clause
+ * list */
+ GlobPattern *patterns; /* Head of glob pattern type list */
+ GlobPattern *patternsTail; /* Tail of glob pattern type list */
+ MacFileType *macTypes; /* Head of mac file type list */
+ MacFileType *macTypesTail; /* Tail of mac file type list */
} FileFilterClause;
typedef struct FileFilter {
- struct FileFilter * next; /* Chains to the next filter
- * in a filter list */
- char * name; /* Name of the file filter,
- * such as "Text Documents" */
- FileFilterClause * clauses; /* Head of the clauses list */
- FileFilterClause * clausesTail; /* Tail of the clauses list */
+ struct FileFilter *next; /* Chains to the next filter in a filter
+ * list */
+ char *name; /* Name of the file filter, such as "Text
+ * Documents" */
+ FileFilterClause *clauses; /* Head of the clauses list */
+ FileFilterClause *clausesTail;
+ /* Tail of the clauses list */
} FileFilter;
-/*----------------------------------------------------------------------
+/*
+ *----------------------------------------------------------------------
+ *
* FileFilterList --
*
- * The routine TkGetFileFilters() translates the string value of the
- * -filefilters option into a FileFilterList structure, which consists
- * of a list of file filters.
+ * The routine TkGetFileFilters() translates the string value of the
+ * -filefilters option into a FileFilterList structure, which consists of
+ * a list of file filters.
+ *
+ * Each file filter consists of one or more clauses. Each clause has one
+ * or more glob patterns and/or one or more Mac file types
*
- * Each file filter consists of one or more clauses. Each clause has
- * one or more glob patterns and/or one or more Mac file types
*----------------------------------------------------------------------
*/
typedef struct FileFilterList {
- FileFilter * filters; /* Head of the filter list */
- FileFilter * filtersTail; /* Tail of the filter list */
- int numFilters; /* number of filters in the list */
+ FileFilter *filters; /* Head of the filter list */
+ FileFilter *filtersTail; /* Tail of the filter list */
+ int numFilters; /* number of filters in the list */
} FileFilterList;
-EXTERN void TkFreeFileFilters _ANSI_ARGS_((
- FileFilterList * flistPtr));
-EXTERN void TkInitFileFilters _ANSI_ARGS_((
- FileFilterList * flistPtr));
-EXTERN int TkGetFileFilters _ANSI_ARGS_ ((Tcl_Interp *interp,
- FileFilterList * flistPtr, char * string,
- int isWindows));
+MODULE_SCOPE void TkFreeFileFilters(FileFilterList *flistPtr);
+MODULE_SCOPE void TkInitFileFilters(FileFilterList *flistPtr);
+MODULE_SCOPE int TkGetFileFilters(Tcl_Interp *interp,
+ FileFilterList *flistPtr, Tcl_Obj *valuePtr,
+ int isWindows);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
-
#endif
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index aad1305..42d8be3 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -1,23 +1,20 @@
-/*
+/*
* tkFocus.c --
*
- * This file contains procedures that manage the input
- * focus for Tk.
+ * This file contains functions that manage the input focus for Tk.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
-
/*
- * For each top-level window that has ever received the focus, there
- * is a record of the following type:
+ * For each top-level window that has ever received the focus, there is a
+ * record of the following type:
*/
typedef struct TkToplevelFocusInfo {
@@ -31,19 +28,17 @@ typedef struct TkToplevelFocusInfo {
} ToplevelFocusInfo;
/*
- * One of the following structures exists for each display used by
- * each application. These are linked together from the TkMainInfo
- * structure. These structures are needed because it isn't
- * sufficient to store a single piece of focus information in each
- * display or in each application: we need the cross-product.
- * There needs to be separate information for each display, because
- * it's possible to have multiple focus windows active simultaneously
- * on different displays. There also needs to be separate information
- * for each application, because of embedding: if an embedded
- * application has the focus, its container application also has
- * the focus. Thus we keep a list of structures for each application:
- * the same display can appear in structures for several applications
- * at once.
+ * One of the following structures exists for each display used by each
+ * application. These are linked together from the TkMainInfo structure.
+ * These structures are needed because it isn't sufficient to store a single
+ * piece of focus information in each display or in each application: we need
+ * the cross-product. There needs to be separate information for each display,
+ * because it's possible to have multiple focus windows active simultaneously
+ * on different displays. There also needs to be separate information for each
+ * application, because of embedding: if an embedded application has the
+ * focus, its container application also has the focus. Thus we keep a list of
+ * structures for each application: the same display can appear in structures
+ * for several applications at once.
*/
typedef struct TkDisplayFocusInfo {
@@ -58,49 +53,54 @@ typedef struct TkDisplayFocusInfo {
* supposed to receive the X input focus as
* soon as it is mapped (needed to handle the
* fact that X won't allow the focus on an
- * unmapped window). NULL means no delayed
+ * unmapped window). NULL means no delayed
* focus op in progress for this display. */
- int forceFocus; /* Associated with focusOnMapPtr: non-zero
+ int forceFocus; /* Associated with focusOnMapPtr: non-zero
* means claim the focus even if some other
* application currently has it. */
unsigned long focusSerial; /* Serial number of last request this
* application made to change the focus on
- * this display. Used to identify stale
- * focus notifications coming from the
- * X server. */
+ * this display. Used to identify stale focus
+ * notifications coming from the X server. */
struct TkDisplayFocusInfo *nextPtr;
- /* Next in list of all display focus
- * records for a given application. */
+ /* Next in list of all display focus records
+ * for a given application. */
} DisplayFocusInfo;
/*
- * The following magic value is stored in the "send_event" field of
- * FocusIn and FocusOut events that are generated in this file. This
- * allows us to separate "real" events coming from the server from
- * those that we generated.
+ * The following magic value is stored in the "send_event" field of FocusIn
+ * and FocusOut events that are generated in this file. This allows us to
+ * separate "real" events coming from the server from those that we generated.
*/
-#define GENERATED_EVENT_MAGIC ((Bool) 0x547321ac)
+#define GENERATED_EVENT_MAGIC ((Bool) 0x547321ac)
/*
- * Forward declarations for procedures defined in this file:
+ * Debugging support...
*/
+#define DEBUG(dispPtr, arguments) \
+ if ((dispPtr)->focusDebug) { \
+ printf arguments; \
+ }
-static DisplayFocusInfo *FindDisplayFocusInfo _ANSI_ARGS_((TkMainInfo *mainPtr,
- TkDisplay *dispPtr));
-static void FocusMapProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void GenerateFocusEvents _ANSI_ARGS_((TkWindow *sourcePtr,
- TkWindow *destPtr));
+/*
+ * Forward declarations for functions defined in this file:
+ */
+
+static DisplayFocusInfo*FindDisplayFocusInfo(TkMainInfo *mainPtr,
+ TkDisplay *dispPtr);
+static void FocusMapProc(ClientData clientData, XEvent *eventPtr);
+static void GenerateFocusEvents(TkWindow *sourcePtr,
+ TkWindow *destPtr);
/*
*--------------------------------------------------------------
*
* Tk_FocusObjCmd --
*
- * This procedure is invoked to process the "focus" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "focus" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -112,15 +112,14 @@ static void GenerateFocusEvents _ANSI_ARGS_((TkWindow *sourcePtr,
*/
int
-Tk_FocusObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_FocusObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
static CONST char *focusOptions[] = {
- "-displayof", "-force", "-lastfor", (char *) NULL
+ "-displayof", "-force", "-lastfor", NULL
};
Tk_Window tkwin = (Tk_Window) clientData;
TkWindow *winPtr = (TkWindow *) clientData;
@@ -142,17 +141,17 @@ Tk_FocusObjCmd(clientData, interp, objc, objv)
}
/*
- * If invoked with a single argument beginning with "." then focus
- * on that window.
+ * If invoked with a single argument beginning with "." then focus on that
+ * window.
*/
if (objc == 2) {
- windowName = Tcl_GetStringFromObj(objv[1], NULL);
+ windowName = Tcl_GetString(objv[1]);
/*
* The empty string case exists for backwards compatibility.
*/
-
+
if (windowName[0] == '\0') {
return TCL_OK;
}
@@ -168,6 +167,10 @@ Tk_FocusObjCmd(clientData, interp, objc, objv)
}
}
+ /*
+ * We have a subcommand to parse and act upon.
+ */
+
if (Tcl_GetIndexFromObj(interp, objv[1], focusOptions, "option", 0,
&index) != TCL_OK) {
return TCL_ERROR;
@@ -177,63 +180,58 @@ Tk_FocusObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
switch (index) {
- case 0: { /* -displayof */
- windowName = Tcl_GetStringFromObj(objv[2], NULL);
- newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
- if (newPtr == NULL) {
- return TCL_ERROR;
- }
- newPtr = TkGetFocusWin(newPtr);
- if (newPtr != NULL) {
- Tcl_SetResult(interp, newPtr->pathName, TCL_STATIC);
- }
- break;
+ case 0: /* -displayof */
+ windowName = Tcl_GetString(objv[2]);
+ newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
+ if (newPtr == NULL) {
+ return TCL_ERROR;
+ }
+ newPtr = TkGetFocusWin(newPtr);
+ if (newPtr != NULL) {
+ Tcl_SetResult(interp, newPtr->pathName, TCL_STATIC);
}
- case 1: { /* -force */
- windowName = Tcl_GetStringFromObj(objv[2], NULL);
+ break;
+ case 1: /* -force */
+ windowName = Tcl_GetString(objv[2]);
- /*
- * The empty string case exists for backwards compatibility.
- */
-
- if (windowName[0] == '\0') {
- return TCL_OK;
- }
- newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
- if (newPtr == NULL) {
- return TCL_ERROR;
- }
- TkSetFocusWin(newPtr, 1);
- break;
+ /*
+ * The empty string case exists for backwards compatibility.
+ */
+
+ if (windowName[0] == '\0') {
+ return TCL_OK;
}
- case 2: { /* -lastfor */
- windowName = Tcl_GetStringFromObj(objv[2], NULL);
- newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
- if (newPtr == NULL) {
- return TCL_ERROR;
+ newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
+ if (newPtr == NULL) {
+ return TCL_ERROR;
+ }
+ TkSetFocusWin(newPtr, 1);
+ break;
+ case 2: /* -lastfor */
+ windowName = Tcl_GetString(objv[2]);
+ newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
+ if (newPtr == NULL) {
+ return TCL_ERROR;
+ }
+ for (topLevelPtr = newPtr; topLevelPtr != NULL;
+ topLevelPtr = topLevelPtr->parentPtr) {
+ if (!(topLevelPtr->flags & TK_TOP_HIERARCHY)) {
+ continue;
}
- for (topLevelPtr = newPtr; topLevelPtr != NULL;
- topLevelPtr = topLevelPtr->parentPtr) {
- if (topLevelPtr->flags & TK_TOP_HIERARCHY) {
- for (tlFocusPtr = newPtr->mainPtr->tlFocusPtr;
- tlFocusPtr != NULL;
- tlFocusPtr = tlFocusPtr->nextPtr) {
- if (tlFocusPtr->topLevelPtr == topLevelPtr) {
- Tcl_SetResult(interp,
- tlFocusPtr->focusWinPtr->pathName,
- TCL_STATIC);
- return TCL_OK;
- }
- }
- Tcl_SetResult(interp, topLevelPtr->pathName, TCL_STATIC);
+ for (tlFocusPtr = newPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
+ tlFocusPtr = tlFocusPtr->nextPtr) {
+ if (tlFocusPtr->topLevelPtr == topLevelPtr) {
+ Tcl_SetResult(interp,
+ tlFocusPtr->focusWinPtr->pathName, TCL_STATIC);
return TCL_OK;
}
}
- break;
- }
- default: {
- panic("bad const entries to focusOptions in focus command");
+ Tcl_SetResult(interp, topLevelPtr->pathName, TCL_STATIC);
+ return TCL_OK;
}
+ break;
+ default:
+ Tcl_Panic("bad const entries to focusOptions in focus command");
}
return TCL_OK;
}
@@ -243,13 +241,13 @@ Tk_FocusObjCmd(clientData, interp, objc, objv)
*
* TkFocusFilterEvent --
*
- * This procedure is invoked by Tk_HandleEvent when it encounters
- * a FocusIn, FocusOut, Enter, or Leave event.
+ * This function is invoked by Tk_HandleEvent when it encounters a
+ * FocusIn, FocusOut, Enter, or Leave event.
*
* Results:
- * A return value of 1 means that Tk_HandleEvent should process
- * the event normally (i.e. event handlers should be invoked).
- * A return value of 0 means that this event should be ignored.
+ * A return value of 1 means that Tk_HandleEvent should process the event
+ * normally (i.e. event handlers should be invoked). A return value of 0
+ * means that this event should be ignored.
*
* Side effects:
* Additional events may be generated, and the focus may switch.
@@ -258,27 +256,25 @@ Tk_FocusObjCmd(clientData, interp, objc, objv)
*/
int
-TkFocusFilterEvent(winPtr, eventPtr)
- TkWindow *winPtr; /* Window that focus event is directed to. */
- XEvent *eventPtr; /* FocusIn, FocusOut, Enter, or Leave
+TkFocusFilterEvent(
+ TkWindow *winPtr, /* Window that focus event is directed to. */
+ XEvent *eventPtr) /* FocusIn, FocusOut, Enter, or Leave
* event. */
{
/*
- * Design notes: the window manager and X server work together to
- * transfer the focus among top-level windows. This procedure takes
- * care of transferring the focus from a top-level or wrapper window
- * to the actual window within that top-level that has the focus.
- * We do this by synthesizing X events to move the focus around.
- * None of the FocusIn and FocusOut events generated by X are ever
- * used outside of this procedure; only the synthesized events get
- * through to the rest of the application. At one point (e.g.
- * Tk4.0b1) Tk used to call X to move the focus from a top-level to
- * one of its descendants, then just pass through the events
- * generated by X. This approach didn't work very well, for a
- * variety of reasons. For example, if X generates the events they
- * go at the back of the event queue, which could cause problems if
- * other things have already happened, such as moving the focus to
- * yet another window.
+ * Design notes: the window manager and X server work together to transfer
+ * the focus among top-level windows. This function takes care of
+ * transferring the focus from a top-level or wrapper window to the actual
+ * window within that top-level that has the focus. We do this by
+ * synthesizing X events to move the focus around. None of the FocusIn and
+ * FocusOut events generated by X are ever used outside of this function;
+ * only the synthesized events get through to the rest of the application.
+ * At one point (e.g. Tk4.0b1) Tk used to call X to move the focus from a
+ * top-level to one of its descendants, then just pass through the events
+ * generated by X. This approach didn't work very well, for a variety of
+ * reasons. For example, if X generates the events they go at the back of
+ * the event queue, which could cause problems if other things have
+ * already happened, such as moving the focus to yet another window.
*/
ToplevelFocusInfo *tlFocusPtr;
@@ -288,8 +284,8 @@ TkFocusFilterEvent(winPtr, eventPtr)
int retValue, delta;
/*
- * If this was a generated event, just turn off the generated
- * flag and pass the event through to Tk bindings.
+ * If this was a generated event, just turn off the generated flag and
+ * pass the event through to Tk bindings.
*/
if (eventPtr->xfocus.send_event == GENERATED_EVENT_MAGIC) {
@@ -298,11 +294,11 @@ TkFocusFilterEvent(winPtr, eventPtr)
}
/*
- * Check for special events generated by embedded applications to
- * request the input focus. If this is one of those events, make
- * the change in focus and return without any additional processing
- * of the event (note: the "detail" field of the event indicates
- * whether to claim the focus even if we don't already have it).
+ * Check for special events generated by embedded applications to request
+ * the input focus. If this is one of those events, make the change in
+ * focus and return without any additional processing of the event (note:
+ * the "detail" field of the event indicates whether to claim the focus
+ * even if we don't already have it).
*/
if ((eventPtr->xfocus.mode == EMBEDDED_APP_WANTS_FOCUS)
@@ -312,10 +308,9 @@ TkFocusFilterEvent(winPtr, eventPtr)
}
/*
- * This was not a generated event. We'll return 1 (so that the
- * event will be processed) if it's an Enter or Leave event, and
- * 0 (so that the event won't be processed) if it's a FocusIn or
- * FocusOut event.
+ * This was not a generated event. We'll return 1 (so that the event will
+ * be processed) if it's an Enter or Leave event, and 0 (so that the event
+ * won't be processed) if it's a FocusIn or FocusOut event.
*/
retValue = 0;
@@ -323,26 +318,26 @@ TkFocusFilterEvent(winPtr, eventPtr)
if (eventPtr->type == FocusIn) {
/*
* Skip FocusIn events that cause confusion
- * NotifyVirtual and NotifyNonlinearVirtual - Virtual events occur
- * on windows in between the origin and destination of the
- * focus change. For FocusIn we may see this when focus
- * goes into an embedded child. We don't care about this,
- * although we may end up getting a NotifyPointer later.
- * NotifyInferior - focus is coming to us from an embedded child.
- * When focus is on an embeded focus, we still think we have
- * the focus, too, so this message doesn't change our state.
- * NotifyPointerRoot - should never happen because this is sent
- * to the root window.
+ * NotifyVirtual and NotifyNonlinearVirtual - Virtual events occur on
+ * windows in between the origin and destination of the focus
+ * change. For FocusIn we may see this when focus goes into an
+ * embedded child. We don't care about this, although we may end
+ * up getting a NotifyPointer later.
+ * NotifyInferior - focus is coming to us from an embedded child. When
+ * focus is on an embeded focus, we still think we have the
+ * focus, too, so this message doesn't change our state.
+ * NotifyPointerRoot - should never happen because this is sent to the
+ * root window.
*
* Interesting FocusIn events are
* NotifyAncestor - focus is coming from our parent, probably the root.
* NotifyNonlinear - focus is coming from a different branch, probably
* another toplevel.
- * NotifyPointer - implicit focus because of the mouse position.
- * This is only interesting on toplevels, when it means that the
- * focus has been set to the root window but the mouse is over
- * this toplevel. We take the focus implicitly (probably no
- * window manager)
+ * NotifyPointer - implicit focus because of the mouse position. This
+ * is only interesting on toplevels, when it means that the focus
+ * has been set to the root window but the mouse is over this
+ * toplevel. We take the focus implicitly (probably no window
+ * manager)
*/
if ((eventPtr->xfocus.detail == NotifyVirtual)
@@ -355,12 +350,12 @@ TkFocusFilterEvent(winPtr, eventPtr)
/*
* Skip FocusOut events that cause confusion.
* NotifyPointer - the pointer is in us or a child, and we are losing
- * focus because of an XSetInputFocus. Other focus events
- * will set our state properly.
- * NotifyPointerRoot - should never happen because this is sent
- * to the root window.
- * NotifyInferior - focus leaving us for an embedded child. We
- * retain a notion of focus when an embedded child has focus.
+ * focus because of an XSetInputFocus. Other focus events will
+ * set our state properly.
+ * NotifyPointerRoot - should never happen because this is sent to the
+ * root window.
+ * NotifyInferior - focus leaving us for an embedded child. We retain
+ * a notion of focus when an embedded child has focus.
*
* Interesting events are:
* NotifyAncestor - focus is going to root.
@@ -392,8 +387,8 @@ TkFocusFilterEvent(winPtr, eventPtr)
}
/*
- * If there is a grab in effect and this window is outside the
- * grabbed tree, then ignore the event.
+ * If there is a grab in effect and this window is outside the grabbed
+ * tree, then ignore the event.
*/
if (TkGrabState(winPtr) == TK_GRAB_EXCLUDED) {
@@ -401,16 +396,15 @@ TkFocusFilterEvent(winPtr, eventPtr)
}
/*
- * It is possible that there were outstanding FocusIn and FocusOut
- * events on their way to us at the time the focus was changed
- * internally with the "focus" command. If so, these events could
- * potentially cause us to lose the focus (switch it to the window
- * of the last FocusIn event) even though the focus change occurred
- * after those events. The following code detects this and ignores
- * the stale events.
+ * It is possible that there were outstanding FocusIn and FocusOut events
+ * on their way to us at the time the focus was changed internally with
+ * the "focus" command. If so, these events could potentially cause us to
+ * lose the focus (switch it to the window of the last FocusIn event) even
+ * though the focus change occurred after those events. The following code
+ * detects this and ignores the stale events.
*
- * Note: the focusSerial is only generated by TkpChangeFocus,
- * whereas in Tk 4.2 there was always a nop marker generated.
+ * Note: the focusSerial is only generated by TkpChangeFocus, whereas in
+ * Tk 4.2 there was always a nop marker generated.
*/
delta = eventPtr->xfocus.serial - displayFocusPtr->focusSerial;
@@ -440,6 +434,7 @@ TkFocusFilterEvent(winPtr, eventPtr)
/*
* Ignore event if newFocus window is already dead!
*/
+
if (newFocusPtr->flags & TK_ALREADY_DEAD) {
return retValue;
}
@@ -451,7 +446,7 @@ TkFocusFilterEvent(winPtr, eventPtr)
/*
* NotifyPointer gets set when the focus has been set to the root
- * window but we have the pointer. We'll treat this like an implicit
+ * window but we have the pointer. We'll treat this like an implicit
* focus in event so that upon Leave events we release focus.
*/
@@ -463,12 +458,12 @@ TkFocusFilterEvent(winPtr, eventPtr)
}
}
} else if (eventPtr->type == FocusOut) {
- GenerateFocusEvents(displayFocusPtr->focusWinPtr, (TkWindow *) NULL);
+ GenerateFocusEvents(displayFocusPtr->focusWinPtr, NULL);
/*
- * Reset dispPtr->focusPtr, but only if it currently is the same
- * as this application's focusWinPtr: this check is needed to
- * handle embedded applications in the same process.
+ * Reset dispPtr->focusPtr, but only if it currently is the same as
+ * this application's focusWinPtr: this check is needed to handle
+ * embedded applications in the same process.
*/
if (dispPtr->focusPtr == displayFocusPtr->focusWinPtr) {
@@ -478,25 +473,22 @@ TkFocusFilterEvent(winPtr, eventPtr)
} else if (eventPtr->type == EnterNotify) {
/*
* If there is no window manager, or if the window manager isn't
- * moving the focus around (e.g. the disgusting "NoTitleFocus"
- * option has been selected in twm), then we won't get FocusIn
- * or FocusOut events. Instead, the "focus" field will be set
- * in an Enter event to indicate that we've already got the focus
- * when the mouse enters the window (even though we didn't get
- * a FocusIn event). Watch for this and grab the focus when it
- * happens. Note: if this is an embedded application then don't
- * accept the focus implicitly like this; the container
- * application will give us the focus explicitly if it wants us
- * to have it.
+ * moving the focus around (e.g. the disgusting "NoTitleFocus" option
+ * has been selected in twm), then we won't get FocusIn or FocusOut
+ * events. Instead, the "focus" field will be set in an Enter event to
+ * indicate that we've already got the focus when the mouse enters the
+ * window (even though we didn't get a FocusIn event). Watch for this
+ * and grab the focus when it happens. Note: if this is an embedded
+ * application then don't accept the focus implicitly like this; the
+ * container application will give us the focus explicitly if it wants
+ * us to have it.
*/
if (eventPtr->xcrossing.focus &&
- (displayFocusPtr->focusWinPtr == NULL)
+ (displayFocusPtr->focusWinPtr == NULL)
&& !(winPtr->flags & TK_EMBEDDED)) {
- if (dispPtr->focusDebug) {
- printf("Focussed implicitly on %s\n",
- newFocusPtr->pathName);
- }
+ DEBUG(dispPtr,
+ ("Focussed implicitly on %s\n", newFocusPtr->pathName));
GenerateFocusEvents(displayFocusPtr->focusWinPtr, newFocusPtr);
displayFocusPtr->focusWinPtr = newFocusPtr;
@@ -507,22 +499,19 @@ TkFocusFilterEvent(winPtr, eventPtr)
/*
* If the pointer just left a window for which we automatically
* claimed the focus on enter, move the focus back to the root
- * window, where it was before we claimed it above. Note:
+ * window, where it was before we claimed it above. Note:
* dispPtr->implicitWinPtr may not be the same as
- * displayFocusPtr->focusWinPtr (e.g. because the "focus"
- * command was used to redirect the focus after it arrived at
- * dispPtr->implicitWinPtr)!! In addition, we generate events
+ * displayFocusPtr->focusWinPtr (e.g. because the "focus" command
+ * was used to redirect the focus after it arrived at
+ * dispPtr->implicitWinPtr)!! In addition, we generate events
* because the window manager won't give us a FocusOut event when
- * we focus on the root.
+ * we focus on the root.
*/
if ((dispPtr->implicitWinPtr != NULL)
&& !(winPtr->flags & TK_EMBEDDED)) {
- if (dispPtr->focusDebug) {
- printf("Defocussed implicit Async\n");
- }
- GenerateFocusEvents(displayFocusPtr->focusWinPtr,
- (TkWindow *) NULL);
+ DEBUG(dispPtr, ("Defocussed implicit Async\n"));
+ GenerateFocusEvents(displayFocusPtr->focusWinPtr, NULL);
XSetInputFocus(dispPtr->display, PointerRoot, RevertToPointerRoot,
CurrentTime);
displayFocusPtr->focusWinPtr = NULL;
@@ -537,8 +526,8 @@ TkFocusFilterEvent(winPtr, eventPtr)
*
* TkSetFocusWin --
*
- * This procedure is invoked to change the focus window for a
- * given display in a given application.
+ * This function is invoked to change the focus window for a given
+ * display in a given application.
*
* Results:
* None.
@@ -551,12 +540,12 @@ TkFocusFilterEvent(winPtr, eventPtr)
*/
void
-TkSetFocusWin(winPtr, force)
- TkWindow *winPtr; /* Window that is to be the new focus for
- * its display and application. */
- int force; /* If non-zero, set the X focus to this
- * window even if the application doesn't
- * currently have the X focus. */
+TkSetFocusWin(
+ TkWindow *winPtr, /* Window that is to be the new focus for its
+ * display and application. */
+ int force) /* If non-zero, set the X focus to this window
+ * even if the application doesn't currently
+ * have the X focus. */
{
ToplevelFocusInfo *tlFocusPtr;
DisplayFocusInfo *displayFocusPtr;
@@ -566,9 +555,9 @@ TkSetFocusWin(winPtr, force)
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
/*
- * If force is set, we should make sure we grab the focus regardless
- * of the current focus window since under Windows, we may need to
- * take control away from another application.
+ * If force is set, we should make sure we grab the focus regardless of
+ * the current focus window since under Windows, we may need to take
+ * control away from another application.
*/
if (winPtr == displayFocusPtr->focusWinPtr && !force) {
@@ -576,18 +565,19 @@ TkSetFocusWin(winPtr, force)
}
/*
- * Find the top-level window for winPtr, then find (or create)
- * a record for the top-level. Also see whether winPtr and all its
- * ancestors are mapped.
+ * Find the top-level window for winPtr, then find (or create) a record
+ * for the top-level. Also see whether winPtr and all its ancestors are
+ * mapped.
*/
allMapped = 1;
for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) {
if (topLevelPtr == NULL) {
/*
- * The window is being deleted. No point in worrying about
- * giving it the focus.
+ * The window is being deleted. No point in worrying about giving
+ * it the focus.
*/
+
return;
}
if (!(topLevelPtr->flags & TK_MAPPED)) {
@@ -599,11 +589,11 @@ TkSetFocusWin(winPtr, force)
}
/*
- * If the new focus window isn't mapped, then we can't focus on it
- * (X will generate an error, for example). Instead, create an
- * event handler that will set the focus to this window once it gets
- * mapped. At the same time, delete any old handler that might be
- * around; it's no longer relevant.
+ * If the new focus window isn't mapped, then we can't focus on it (X will
+ * generate an error, for example). Instead, create an event handler that
+ * will set the focus to this window once it gets mapped. At the same
+ * time, delete any old handler that might be around; it's no longer
+ * relevant.
*/
if (displayFocusPtr->focusOnMapPtr != NULL) {
@@ -637,16 +627,15 @@ TkSetFocusWin(winPtr, force)
tlFocusPtr->focusWinPtr = winPtr;
/*
- * Reset the window system's focus window and generate focus events,
- * with two special cases:
+ * Reset the window system's focus window and generate focus events, with
+ * two special cases:
*
- * 1. If the application is embedded and doesn't currently have the
- * focus, don't set the focus directly. Instead, see if the
- * embedding code can claim the focus from the enclosing
- * container.
- * 2. Otherwise, if the application doesn't currently have the
- * focus, don't change the window system's focus unless it was
- * already in this application or "force" was specified.
+ * 1. If the application is embedded and doesn't currently have the focus,
+ * don't set the focus directly. Instead, see if the embedding code can
+ * claim the focus from the enclosing container.
+ * 2. Otherwise, if the application doesn't currently have the focus,
+ * don't change the window system's focus unless it was already in this
+ * application or "force" was specified.
*/
if ((topLevelPtr->flags & TK_EMBEDDED)
@@ -654,12 +643,11 @@ TkSetFocusWin(winPtr, force)
TkpClaimFocus(topLevelPtr, force);
} else if ((displayFocusPtr->focusWinPtr != NULL) || force) {
/*
- * Generate events to shift focus between Tk windows.
- * We do this regardless of what TkpChangeFocus does with
- * the real X focus so that Tk widgets track focus commands
- * when there is no window manager. GenerateFocusEvents will
- * set up a serial number marker so we discard focus events
- * that are triggered by the ChangeFocus.
+ * Generate events to shift focus between Tk windows. We do this
+ * regardless of what TkpChangeFocus does with the real X focus so
+ * that Tk widgets track focus commands when there is no window
+ * manager. GenerateFocusEvents will set up a serial number marker so
+ * we discard focus events that are triggered by the ChangeFocus.
*/
serial = TkpChangeFocus(TkpGetWrapperWindow(topLevelPtr), force);
@@ -677,13 +665,13 @@ TkSetFocusWin(winPtr, force)
*
* TkGetFocusWin --
*
- * Given a window, this procedure returns the current focus
- * window for its application and display.
+ * Given a window, this function returns the current focus window for its
+ * application and display.
*
* Results:
- * The return value is a pointer to the window that currently
- * has the input focus for the specified application and
- * display, or NULL if none.
+ * The return value is a pointer to the window that currently has the
+ * input focus for the specified application and display, or NULL if
+ * none.
*
* Side effects:
* None.
@@ -692,14 +680,14 @@ TkSetFocusWin(winPtr, force)
*/
TkWindow *
-TkGetFocusWin(winPtr)
- TkWindow *winPtr; /* Window that selects an application
- * and a display. */
+TkGetFocusWin(
+ TkWindow *winPtr) /* Window that selects an application and a
+ * display. */
{
DisplayFocusInfo *displayFocusPtr;
if (winPtr == NULL) {
- return (TkWindow *) NULL;
+ return NULL;
}
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
@@ -711,16 +699,16 @@ TkGetFocusWin(winPtr)
*
* TkFocusKeyEvent --
*
- * Given a window and a key press or release event that arrived for
- * the window, use information about the keyboard focus to compute
- * which window should really get the event. In addition, update
- * the event to refer to its new window.
+ * Given a window and a key press or release event that arrived for the
+ * window, use information about the keyboard focus to compute which
+ * window should really get the event. In addition, update the event to
+ * refer to its new window.
*
* Results:
- * The return value is a pointer to the window that has the input
- * focus in winPtr's application, or NULL if winPtr's application
- * doesn't have the input focus. If a non-NULL value is returned,
- * eventPtr will be updated to refer properly to the focus window.
+ * The return value is a pointer to the window that has the input focus
+ * in winPtr's application, or NULL if winPtr's application doesn't have
+ * the input focus. If a non-NULL value is returned, eventPtr will be
+ * updated to refer properly to the focus window.
*
* Side effects:
* None.
@@ -729,11 +717,11 @@ TkGetFocusWin(winPtr)
*/
TkWindow *
-TkFocusKeyEvent(winPtr, eventPtr)
- TkWindow *winPtr; /* Window that selects an application
- * and a display. */
- XEvent *eventPtr; /* X event to redirect (should be KeyPress
- * or KeyRelease). */
+TkFocusKeyEvent(
+ TkWindow *winPtr, /* Window that selects an application and a
+ * display. */
+ XEvent *eventPtr) /* X event to redirect (should be KeyPress or
+ * KeyRelease). */
{
DisplayFocusInfo *displayFocusPtr;
TkWindow *focusWinPtr;
@@ -760,9 +748,9 @@ TkFocusKeyEvent(winPtr, eventPtr)
if ((focusWinPtr != NULL) && (focusWinPtr->mainPtr == winPtr->mainPtr)) {
/*
- * Map the x and y coordinates to make sense in the context of
- * the focus window, if possible (make both -1 if the map-from
- * and map-to windows don't share the same screen).
+ * Map the x and y coordinates to make sense in the context of the
+ * focus window, if possible (make both -1 if the map-from and map-to
+ * windows don't share the same screen).
*/
if ((focusWinPtr->display != winPtr->display)
@@ -781,13 +769,13 @@ TkFocusKeyEvent(winPtr, eventPtr)
}
/*
- * The event doesn't belong to us. Perhaps, due to embedding, it
- * really belongs to someone else. Give the embedding code a chance
- * to redirect the event.
+ * The event doesn't belong to us. Perhaps, due to embedding, it really
+ * belongs to someone else. Give the embedding code a chance to redirect
+ * the event.
*/
TkpRedirectKeyEvent(winPtr, eventPtr);
- return (TkWindow *) NULL;
+ return NULL;
}
/*
@@ -795,9 +783,8 @@ TkFocusKeyEvent(winPtr, eventPtr)
*
* TkFocusDeadWindow --
*
- * This procedure is invoked when it is determined that
- * a window is dead. It cleans up focus-related information
- * about the window.
+ * This function is invoked when it is determined that a window is dead.
+ * It cleans up focus-related information about the window.
*
* Results:
* None.
@@ -809,25 +796,26 @@ TkFocusKeyEvent(winPtr, eventPtr)
*/
void
-TkFocusDeadWindow(winPtr)
- register TkWindow *winPtr; /* Information about the window
- * that is being deleted. */
+TkFocusDeadWindow(
+ register TkWindow *winPtr) /* Information about the window that is being
+ * deleted. */
{
ToplevelFocusInfo *tlFocusPtr, *prevPtr;
DisplayFocusInfo *displayFocusPtr;
TkDisplay *dispPtr = winPtr->dispPtr;
/*
- * Certain special windows like those used for send and clipboard
- * have no mainPtr.
+ * Certain special windows like those used for send and clipboard have no
+ * mainPtr.
*/
- if (winPtr->mainPtr == NULL)
- return;
+ if (winPtr->mainPtr == NULL) {
+ return;
+ }
/*
- * Search for focus records that refer to this window either as
- * the top-level window or the current focus window.
+ * Search for focus records that refer to this window either as the
+ * top-level window or the current focus window.
*/
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
@@ -836,16 +824,14 @@ TkFocusDeadWindow(winPtr)
prevPtr = tlFocusPtr, tlFocusPtr = tlFocusPtr->nextPtr) {
if (winPtr == tlFocusPtr->topLevelPtr) {
/*
- * The top-level window is the one being deleted: free
- * the focus record and release the focus back to PointerRoot
- * if we acquired it implicitly.
+ * The top-level window is the one being deleted: free the focus
+ * record and release the focus back to PointerRoot if we acquired
+ * it implicitly.
*/
if (dispPtr->implicitWinPtr == winPtr) {
- if (dispPtr->focusDebug) {
- printf("releasing focus to root after %s died\n",
- tlFocusPtr->topLevelPtr->pathName);
- }
+ DEBUG(dispPtr, ("releasing focus to root after %s died\n",
+ tlFocusPtr->topLevelPtr->pathName));
dispPtr->implicitWinPtr = NULL;
displayFocusPtr->focusWinPtr = NULL;
dispPtr->focusPtr = NULL;
@@ -863,18 +849,15 @@ TkFocusDeadWindow(winPtr)
break;
} else if (winPtr == tlFocusPtr->focusWinPtr) {
/*
- * The deleted window had the focus for its top-level:
- * move the focus to the top-level itself.
+ * The deleted window had the focus for its top-level: move the
+ * focus to the top-level itself.
*/
tlFocusPtr->focusWinPtr = tlFocusPtr->topLevelPtr;
if ((displayFocusPtr->focusWinPtr == winPtr)
&& !(tlFocusPtr->topLevelPtr->flags & TK_ALREADY_DEAD)) {
- if (dispPtr->focusDebug) {
- printf("forwarding focus to %s after %s died\n",
- tlFocusPtr->topLevelPtr->pathName,
- winPtr->pathName);
- }
+ DEBUG(dispPtr, ("forwarding focus to %s after %s died\n",
+ tlFocusPtr->topLevelPtr->pathName, winPtr->pathName));
GenerateFocusEvents(displayFocusPtr->focusWinPtr,
tlFocusPtr->topLevelPtr);
displayFocusPtr->focusWinPtr = tlFocusPtr->topLevelPtr;
@@ -890,9 +873,7 @@ TkFocusDeadWindow(winPtr)
*/
if (displayFocusPtr->focusWinPtr == winPtr) {
- if (dispPtr->focusDebug) {
- printf("focus cleared after %s died\n", winPtr->pathName);
- }
+ DEBUG(dispPtr, ("focus cleared after %s died\n", winPtr->pathName));
displayFocusPtr->focusWinPtr = NULL;
}
@@ -906,8 +887,8 @@ TkFocusDeadWindow(winPtr)
*
* GenerateFocusEvents --
*
- * This procedure is called to create FocusIn and FocusOut events to
- * move the input focus from one window to another.
+ * This function is called to create FocusIn and FocusOut events to move
+ * the input focus from one window to another.
*
* Results:
* None.
@@ -919,12 +900,11 @@ TkFocusDeadWindow(winPtr)
*/
static void
-GenerateFocusEvents(sourcePtr, destPtr)
- TkWindow *sourcePtr; /* Window that used to have the focus (may
- * be NULL). */
- TkWindow *destPtr; /* New window to have the focus (may be
+GenerateFocusEvents(
+ TkWindow *sourcePtr, /* Window that used to have the focus (may be
+ * NULL). */
+ TkWindow *destPtr) /* New window to have the focus (may be
* NULL). */
-
{
XEvent event;
TkWindow *winPtr;
@@ -950,26 +930,26 @@ GenerateFocusEvents(sourcePtr, destPtr)
*
* FocusMapProc --
*
- * This procedure is called as an event handler for VisibilityNotify
- * events, if a window receives the focus at a time when its
- * toplevel isn't mapped. The procedure is needed because X
- * won't allow the focus to be set to an unmapped window; we
- * detect when the toplevel is mapped and set the focus to it then.
+ * This function is called as an event handler for VisibilityNotify
+ * events, if a window receives the focus at a time when its toplevel
+ * isn't mapped. The function is needed because X won't allow the focus
+ * to be set to an unmapped window; we detect when the toplevel is mapped
+ * and set the focus to it then.
*
* Results:
* None.
*
* Side effects:
- * If this is a map event, the focus gets set to the toplevel
- * given by clientData.
+ * If this is a map event, the focus gets set to the toplevel given by
+ * clientData.
*
*----------------------------------------------------------------------
*/
static void
-FocusMapProc(clientData, eventPtr)
- ClientData clientData; /* Toplevel window. */
- XEvent *eventPtr; /* Information about event. */
+FocusMapProc(
+ ClientData clientData, /* Toplevel window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkWindow *winPtr = (TkWindow *) clientData;
DisplayFocusInfo *displayFocusPtr;
@@ -977,10 +957,8 @@ FocusMapProc(clientData, eventPtr)
if (eventPtr->type == VisibilityNotify) {
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr,
winPtr->dispPtr);
- if (winPtr->dispPtr->focusDebug) {
- printf("auto-focussing on %s, force %d\n", winPtr->pathName,
- displayFocusPtr->forceFocus);
- }
+ DEBUG(winPtr->dispPtr, ("auto-focussing on %s, force %d\n",
+ winPtr->pathName, displayFocusPtr->forceFocus));
Tk_DeleteEventHandler((Tk_Window) winPtr, VisibilityChangeMask,
FocusMapProc, clientData);
displayFocusPtr->focusOnMapPtr = NULL;
@@ -993,9 +971,9 @@ FocusMapProc(clientData, eventPtr)
*
* FindDisplayFocusInfo --
*
- * Given an application and a display, this procedure locate the
- * focus record for that combination. If no such record exists,
- * it creates a new record and initializes it.
+ * Given an application and a display, this function locate the focus
+ * record for that combination. If no such record exists, it creates a
+ * new record and initializes it.
*
* Results:
* The return value is a pointer to the record.
@@ -1007,10 +985,10 @@ FocusMapProc(clientData, eventPtr)
*/
static DisplayFocusInfo *
-FindDisplayFocusInfo(mainPtr, dispPtr)
- TkMainInfo *mainPtr; /* Record that identifies a particular
+FindDisplayFocusInfo(
+ TkMainInfo *mainPtr, /* Record that identifies a particular
* application. */
- TkDisplay *dispPtr; /* Display whose focus information is
+ TkDisplay *dispPtr) /* Display whose focus information is
* needed. */
{
DisplayFocusInfo *displayFocusPtr;
@@ -1024,7 +1002,7 @@ FindDisplayFocusInfo(mainPtr, dispPtr)
}
/*
- * The record doesn't exist yet. Make a new one.
+ * The record doesn't exist yet. Make a new one.
*/
displayFocusPtr = (DisplayFocusInfo *) ckalloc(sizeof(DisplayFocusInfo));
@@ -1055,21 +1033,154 @@ FindDisplayFocusInfo(mainPtr, dispPtr)
*/
void
-TkFocusFree(mainPtr)
- TkMainInfo *mainPtr; /* Record that identifies a particular
+TkFocusFree(
+ TkMainInfo *mainPtr) /* Record that identifies a particular
* application. */
{
- DisplayFocusInfo *displayFocusPtr;
- ToplevelFocusInfo *tlFocusPtr;
-
while (mainPtr->displayFocusPtr != NULL) {
- displayFocusPtr = mainPtr->displayFocusPtr;
+ DisplayFocusInfo *displayFocusPtr = mainPtr->displayFocusPtr;
+
mainPtr->displayFocusPtr = mainPtr->displayFocusPtr->nextPtr;
ckfree((char *) displayFocusPtr);
}
while (mainPtr->tlFocusPtr != NULL) {
- tlFocusPtr = mainPtr->tlFocusPtr;
+ ToplevelFocusInfo *tlFocusPtr = mainPtr->tlFocusPtr;
+
mainPtr->tlFocusPtr = mainPtr->tlFocusPtr->nextPtr;
ckfree((char *) tlFocusPtr);
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkFocusSplit --
+ *
+ * Adjust focus window for a newly managed toplevel, thus splitting
+ * the toplevel into two toplevels.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A new record is allocated for the new toplevel window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkFocusSplit(winPtr)
+ TkWindow *winPtr; /* Window is the new toplevel
+ * Any focus point at or below window
+ * must be moved to this new toplevel */
+{
+ ToplevelFocusInfo *tlFocusPtr;
+ TkWindow *topLevelPtr;
+ TkWindow *subWinPtr;
+
+ FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
+
+ /*
+ * Find the top-level window for winPtr, then find (or create)
+ * a record for the top-level. Also see whether winPtr and all its
+ * ancestors are mapped.
+ */
+
+ for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) {
+ if (topLevelPtr == NULL) {
+ /*
+ * The window is being deleted. No point in worrying about
+ * giving it the focus.
+ */
+ return;
+ }
+ if (topLevelPtr->flags & TK_TOP_HIERARCHY) {
+ break;
+ }
+ }
+
+ /* Search all focus records to find child windows of winPtr */
+ for (tlFocusPtr = winPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
+ tlFocusPtr = tlFocusPtr->nextPtr) {
+ if (tlFocusPtr->topLevelPtr == topLevelPtr) {
+ break;
+ }
+ }
+
+ if (tlFocusPtr == NULL) {
+ /* No focus record for this toplevel, nothing to do. */
+ return;
+ }
+
+ /* See if current focusWin is child of the new toplevel */
+ for (subWinPtr = tlFocusPtr->focusWinPtr;
+ subWinPtr && subWinPtr != winPtr && subWinPtr != topLevelPtr;
+ subWinPtr = subWinPtr->parentPtr) {}
+
+ if (subWinPtr == winPtr) {
+ /* Move focus to new toplevel */
+ ToplevelFocusInfo *newTlFocusPtr;
+
+ newTlFocusPtr = (ToplevelFocusInfo *) ckalloc(sizeof(ToplevelFocusInfo));
+ newTlFocusPtr->topLevelPtr = winPtr;
+ newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr;
+ newTlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr;
+ winPtr->mainPtr->tlFocusPtr = newTlFocusPtr;
+ /* Move old toplevel's focus to the toplevel itself */
+ tlFocusPtr->focusWinPtr = topLevelPtr;
+ }
+ /* If it's not, then let focus progress naturally */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkFocusJoin --
+ *
+ * Remove the focus record for this window that is nolonger managed
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A tlFocusPtr record is removed
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkFocusJoin(winPtr)
+ TkWindow *winPtr; /* Window is no longer a toplevel */
+{
+ ToplevelFocusInfo *tlFocusPtr;
+ ToplevelFocusInfo *tmpPtr;
+
+ /*
+ * Remove old toplevel record
+ */
+ if (winPtr && winPtr->mainPtr && winPtr->mainPtr->tlFocusPtr
+ && winPtr->mainPtr->tlFocusPtr->topLevelPtr == winPtr) {
+ tmpPtr = winPtr->mainPtr->tlFocusPtr;
+ winPtr->mainPtr->tlFocusPtr = tmpPtr->nextPtr;
+ ckfree((char *)tmpPtr);
+ } else {
+ for (tlFocusPtr = winPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
+ tlFocusPtr = tlFocusPtr->nextPtr) {
+ if (tlFocusPtr->nextPtr &&
+ tlFocusPtr->nextPtr->topLevelPtr == winPtr) {
+ tmpPtr = tlFocusPtr->nextPtr;
+ tlFocusPtr->nextPtr = tmpPtr->nextPtr;
+ ckfree((char *)tmpPtr);
+ break;
+ }
+ }
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 95feec3..1a6474f 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -1,44 +1,42 @@
-/*
+/*
* tkFont.c --
*
- * This file maintains a database of fonts for the Tk toolkit.
- * It also provides several utility procedures for measuring and
- * displaying text.
+ * This file maintains a database of fonts for the Tk toolkit. It also
+ * provides several utility functions for measuring and displaying text.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
#include "tkFont.h"
/*
- * The following structure is used to keep track of all the fonts that
- * exist in the current application. It must be stored in the
- * TkMainInfo for the application.
+ * The following structure is used to keep track of all the fonts that exist
+ * in the current application. It must be stored in the TkMainInfo for the
+ * application.
*/
-
+
typedef struct TkFontInfo {
- Tcl_HashTable fontCache; /* Map a string to an existing Tk_Font.
- * Keys are string font names, values are
- * TkFont pointers. */
+ Tcl_HashTable fontCache; /* Map a string to an existing Tk_Font. Keys
+ * are string font names, values are TkFont
+ * pointers. */
Tcl_HashTable namedTable; /* Map a name to a set of attributes for a
* font, used when constructing a Tk_Font from
- * a named font description. Keys are
- * strings, values are NamedFont pointers. */
+ * a named font description. Keys are strings,
+ * values are NamedFont pointers. */
TkMainInfo *mainPtr; /* Application that owns this structure. */
int updatePending; /* Non-zero when a World Changed event has
- * already been queued to handle a change to
- * a named font. */
+ * already been queued to handle a change to a
+ * named font. */
} TkFontInfo;
/*
* The following data structure is used to keep track of the font attributes
- * for each named font that has been defined. The named font is only deleted
+ * for each named font that has been defined. The named font is only deleted
* when the last reference to it goes away.
*/
@@ -48,84 +46,83 @@ typedef struct NamedFont {
* last reference goes away. */
TkFontAttributes fa; /* Desired attributes for named font. */
} NamedFont;
-
+
/*
- * The following two structures are used to keep track of string
- * measurement information when using the text layout facilities.
+ * The following two structures are used to keep track of string measurement
+ * information when using the text layout facilities.
*
* A LayoutChunk represents a contiguous range of text that can be measured
- * and displayed by low-level text calls. In general, chunks will be
- * delimited by newlines and tabs. Low-level, platform-specific things
- * like kerning and non-integer character widths may occur between the
- * characters in a single chunk, but not between characters in different
- * chunks.
- *
- * A TextLayout is a collection of LayoutChunks. It can be displayed with
- * respect to any origin. It is the implementation of the Tk_TextLayout
- * opaque token.
+ * and displayed by low-level text calls. In general, chunks will be delimited
+ * by newlines and tabs. Low-level, platform-specific things like kerning and
+ * non-integer character widths may occur between the characters in a single
+ * chunk, but not between characters in different chunks.
+ *
+ * A TextLayout is a collection of LayoutChunks. It can be displayed with
+ * respect to any origin. It is the implementation of the Tk_TextLayout opaque
+ * token.
*/
typedef struct LayoutChunk {
- CONST char *start; /* Pointer to simple string to be displayed.
+ const char *start; /* Pointer to simple string to be displayed.
* This is a pointer into the TkTextLayout's
* string. */
int numBytes; /* The number of bytes in this chunk. */
int numChars; /* The number of characters in this chunk. */
int numDisplayChars; /* The number of characters to display when
- * this chunk is displayed. Can be less than
+ * this chunk is displayed. Can be less than
* numChars if extra space characters were
- * absorbed by the end of the chunk. This
- * will be < 0 if this is a chunk that is
- * holding a tab or newline. */
+ * absorbed by the end of the chunk. This will
+ * be < 0 if this is a chunk that is holding a
+ * tab or newline. */
int x, y; /* The origin of the first character in this
* chunk with respect to the upper-left hand
* corner of the TextLayout. */
- int totalWidth; /* Width in pixels of this chunk. Used
- * when hit testing the invisible spaces at
- * the end of a chunk. */
+ int totalWidth; /* Width in pixels of this chunk. Used when
+ * hit testing the invisible spaces at the end
+ * of a chunk. */
int displayWidth; /* Width in pixels of the displayable
- * characters in this chunk. Can be less than
+ * characters in this chunk. Can be less than
* width if extra space characters were
* absorbed by the end of the chunk. */
} LayoutChunk;
typedef struct TextLayout {
Tk_Font tkfont; /* The font used when laying out the text. */
- CONST char *string; /* The string that was layed out. */
- int width; /* The maximum width of all lines in the
- * text layout. */
- int numChunks; /* Number of chunks actually used in
- * following array. */
- LayoutChunk chunks[1]; /* Array of chunks. The actual size will
- * be maxChunks. THIS FIELD MUST BE THE LAST
- * IN THE STRUCTURE. */
+ const char *string; /* The string that was layed out. */
+ int width; /* The maximum width of all lines in the text
+ * layout. */
+ int numChunks; /* Number of chunks actually used in following
+ * array. */
+ LayoutChunk chunks[1]; /* Array of chunks. The actual size will be
+ * maxChunks. THIS FIELD MUST BE THE LAST IN
+ * THE STRUCTURE. */
} TextLayout;
/*
* The following structures are used as two-way maps between the values for
- * the fields in the TkFontAttributes structure and the strings used in
- * Tcl, when parsing both option-value format and style-list format font
- * name strings.
+ * the fields in the TkFontAttributes structure and the strings used in Tcl,
+ * when parsing both option-value format and style-list format font name
+ * strings.
*/
-static TkStateMap weightMap[] = {
+static const TkStateMap weightMap[] = {
{TK_FW_NORMAL, "normal"},
{TK_FW_BOLD, "bold"},
{TK_FW_UNKNOWN, NULL}
};
-static TkStateMap slantMap[] = {
+static const TkStateMap slantMap[] = {
{TK_FS_ROMAN, "roman"},
{TK_FS_ITALIC, "italic"},
{TK_FS_UNKNOWN, NULL}
};
-static TkStateMap underlineMap[] = {
+static const TkStateMap underlineMap[] = {
{1, "underline"},
{0, NULL}
};
-static TkStateMap overstrikeMap[] = {
+static const TkStateMap overstrikeMap[] = {
{1, "overstrike"},
{0, NULL}
};
@@ -135,7 +132,7 @@ static TkStateMap overstrikeMap[] = {
* TkFontAttributes.
*/
-static TkStateMap xlfdWeightMap[] = {
+static const TkStateMap xlfdWeightMap[] = {
{TK_FW_NORMAL, "normal"},
{TK_FW_NORMAL, "medium"},
{TK_FW_NORMAL, "book"},
@@ -144,16 +141,16 @@ static TkStateMap xlfdWeightMap[] = {
{TK_FW_BOLD, "demi"},
{TK_FW_BOLD, "demibold"},
{TK_FW_NORMAL, NULL} /* Assume anything else is "normal". */
-};
+};
-static TkStateMap xlfdSlantMap[] = {
+static const TkStateMap xlfdSlantMap[] = {
{TK_FS_ROMAN, "r"},
{TK_FS_ITALIC, "i"},
{TK_FS_OBLIQUE, "o"},
{TK_FS_ROMAN, NULL} /* Assume anything else is "roman". */
};
-static TkStateMap xlfdSetwidthMap[] = {
+static const TkStateMap xlfdSetwidthMap[] = {
{TK_SW_NORMAL, "normal"},
{TK_SW_CONDENSE, "narrow"},
{TK_SW_CONDENSE, "semicondensed"},
@@ -162,11 +159,11 @@ static TkStateMap xlfdSetwidthMap[] = {
};
/*
- * The following structure and defines specify the valid builtin options
- * when configuring a set of font attributes.
+ * The following structure and defines specify the valid builtin options when
+ * configuring a set of font attributes.
*/
-static CONST char *fontOpt[] = {
+static const char *fontOpt[] = {
"-family",
"-size",
"-weight",
@@ -185,10 +182,10 @@ static CONST char *fontOpt[] = {
#define FONT_NUMFIELDS 6
/*
- * Hardcoded font aliases. These are used to describe (mostly) identical
- * fonts whose names differ from platform to platform. If the
- * user-supplied font name matches any of the names in one of the alias
- * lists, the other names in the alias list are also automatically tried.
+ * Hardcoded font aliases. These are used to describe (mostly) identical fonts
+ * whose names differ from platform to platform. If the user-supplied font
+ * name matches any of the names in one of the alias lists, the other names in
+ * the alias list are also automatically tried.
*/
static char *timesAliases[] = {
@@ -226,7 +223,7 @@ static char *gothicAliases[] = {
/* Windows (MS goshikku). */
"\344\270\270\343\202\264\343\202\267\343\203\203\343\202\257\342\210\222\357\274\255",
/* Mac (goshikku-M). */
- NULL
+ NULL
};
static char *dingbatsAliases[] = {
@@ -245,43 +242,46 @@ static char **fontAliases[] = {
gothicAliases,
dingbatsAliases,
NULL
-};
+};
/*
- * Hardcoded font classes. If the character cannot be found in the base
- * font, the classes are examined in order to see if some other similar
- * font should be examined also.
+ * Hardcoded font classes. If the character cannot be found in the base font,
+ * the classes are examined in order to see if some other similar font should
+ * be examined also.
*/
static char *systemClass[] = {
- "fixed", /* Unix. */
- /* Windows. */
- "chicago", "osaka", "sistemny", /* Mac. */
+ "fixed", /* Unix. */
+ /* Windows. */
+ "chicago", "osaka", "sistemny",
+ /* Mac. */
NULL
};
static char *serifClass[] = {
- "times", "palatino", "mincho", /* All platforms. */
- "song ti", /* Unix. */
- "ms serif", "simplified arabic", /* Windows. */
- "latinski", /* Mac. */
+ "times", "palatino", "mincho",
+ /* All platforms. */
+ "song ti", /* Unix. */
+ "ms serif", "simplified arabic",
+ /* Windows. */
+ "latinski", /* Mac. */
NULL
};
static char *sansClass[] = {
- "helvetica", "gothic", /* All platforms. */
- /* Unix. */
+ "helvetica", "gothic", /* All platforms. */
+ /* Unix. */
"ms sans serif", "traditional arabic",
- /* Windows. */
- "bastion", /* Mac. */
+ /* Windows. */
+ "bastion", /* Mac. */
NULL
};
static char *monoClass[] = {
- "courier", "gothic", /* All platforms. */
- "fangsong ti", /* Unix. */
- "simplified arabic fixed", /* Windows. */
- "monaco", "pryamoy", /* Mac. */
+ "courier", "gothic", /* All platforms. */
+ "fangsong ti", /* Unix. */
+ "simplified arabic fixed", /* Windows. */
+ "monaco", "pryamoy", /* Mac. */
NULL
};
@@ -299,9 +299,9 @@ static char **fontFallbacks[] = {
};
/*
- * Global fallbacks. If the character could not be found in the preferred
- * fallback list, this list is examined. If the character still cannot be
- * found, all font families in the system are examined.
+ * Global fallbacks. If the character could not be found in the preferred
+ * fallback list, this list is examined. If the character still cannot be
+ * found, all font families in the system are examined.
*/
static char *globalFontClass[] = {
@@ -314,43 +314,35 @@ static char *globalFontClass[] = {
};
#define GetFontAttributes(tkfont) \
- ((CONST TkFontAttributes *) &((TkFont *) (tkfont))->fa)
+ ((const TkFontAttributes *) &((TkFont *) (tkfont))->fa)
#define GetFontMetrics(tkfont) \
- ((CONST TkFontMetrics *) &((TkFont *) (tkfont))->fm)
-
-
-static int ConfigAttributesObj _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, int objc, Tcl_Obj *CONST objv[],
- TkFontAttributes *faPtr));
-static int CreateNamedFont _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *name,
- TkFontAttributes *faPtr));
-static void DupFontObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr,
- Tcl_Obj *dupObjPtr));
-static int FieldSpecified _ANSI_ARGS_((CONST char *field));
-static void FreeFontObjProc _ANSI_ARGS_((Tcl_Obj *objPtr));
-static int GetAttributeInfoObj _ANSI_ARGS_((Tcl_Interp *interp,
- CONST TkFontAttributes *faPtr, Tcl_Obj *objPtr));
-static LayoutChunk * NewChunk _ANSI_ARGS_((TextLayout **layoutPtrPtr,
- int *maxPtr, CONST char *start, int numChars,
- int curX, int newX, int y));
-static int ParseFontNameObj _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *objPtr,
- TkFontAttributes *faPtr));
-static void RecomputeWidgets _ANSI_ARGS_((TkWindow *winPtr));
-static int SetFontFromAny _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *objPtr));
-static void TheWorldHasChanged _ANSI_ARGS_((
- ClientData clientData));
-static void UpdateDependentFonts _ANSI_ARGS_((TkFontInfo *fiPtr,
- Tk_Window tkwin, Tcl_HashEntry *namedHashPtr));
+ ((const TkFontMetrics *) &((TkFont *) (tkfont))->fm)
+
+
+static int ConfigAttributesObj(Tcl_Interp *interp,
+ Tk_Window tkwin, int objc, Tcl_Obj *const objv[],
+ TkFontAttributes *faPtr);
+static void DupFontObjProc(Tcl_Obj *srcObjPtr, Tcl_Obj *dupObjPtr);
+static int FieldSpecified(const char *field);
+static void FreeFontObjProc(Tcl_Obj *objPtr);
+static int GetAttributeInfoObj(Tcl_Interp *interp,
+ const TkFontAttributes *faPtr, Tcl_Obj *objPtr);
+static LayoutChunk * NewChunk(TextLayout **layoutPtrPtr, int *maxPtr,
+ const char *start, int numChars, int curX,
+ int newX, int y);
+static int ParseFontNameObj(Tcl_Interp *interp, Tk_Window tkwin,
+ Tcl_Obj *objPtr, TkFontAttributes *faPtr);
+static void RecomputeWidgets(TkWindow *winPtr);
+static int SetFontFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
+static void TheWorldHasChanged(ClientData clientData);
+static void UpdateDependentFonts(TkFontInfo *fiPtr,
+ Tk_Window tkwin, Tcl_HashEntry *namedHashPtr);
/*
* The following structure defines the implementation of the "font" Tcl
- * object, used for drawing. The internalRep.twoPtrValue.ptr1 field of
- * each font object points to the TkFont structure for the font, or
- * NULL.
+ * object, used for drawing. The internalRep.twoPtrValue.ptr1 field of each
+ * font object points to the TkFont structure for the font, or NULL.
*/
Tcl_ObjType tkFontObjType = {
@@ -360,29 +352,29 @@ Tcl_ObjType tkFontObjType = {
NULL, /* updateStringProc */
SetFontFromAny /* setFromAnyProc */
};
-
/*
*---------------------------------------------------------------------------
*
* TkFontPkgInit --
*
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the font
- * package on a per application basis.
+ * This function is called when an application is created. It initializes
+ * all the structures that are used by the font package on a per
+ * application basis.
*
* Results:
- * Stores a token in the mainPtr to hold information needed by this
- * package on a per application basis.
+ * Stores a token in the mainPtr to hold information needed by this
+ * package on a per application basis.
*
* Side effects:
* Memory allocated.
*
*---------------------------------------------------------------------------
*/
+
void
-TkFontPkgInit(mainPtr)
- TkMainInfo *mainPtr; /* The application being created. */
+TkFontPkgInit(
+ TkMainInfo *mainPtr) /* The application being created. */
{
TkFontInfo *fiPtr;
@@ -401,9 +393,9 @@ TkFontPkgInit(mainPtr)
*
* TkFontPkgFree --
*
- * This procedure is called when an application is deleted. It
- * deletes all the structures that were used by the font package
- * for this application.
+ * This function is called when an application is deleted. It deletes all
+ * the structures that were used by the font package for this
+ * application.
*
* Results:
* None.
@@ -415,8 +407,8 @@ TkFontPkgInit(mainPtr)
*/
void
-TkFontPkgFree(mainPtr)
- TkMainInfo *mainPtr; /* The application being deleted. */
+TkFontPkgFree(
+ TkMainInfo *mainPtr) /* The application being deleted. */
{
TkFontInfo *fiPtr;
Tcl_HashEntry *hPtr, *searchPtr;
@@ -431,15 +423,17 @@ TkFontPkgFree(mainPtr)
searchPtr = Tcl_NextHashEntry(&search)) {
fontsLeft++;
#ifdef DEBUG_FONTS
- fprintf(stderr, "Font %s still in cache.\n",
+ fprintf(stderr, "Font %s still in cache.\n",
Tcl_GetHashKey(&fiPtr->fontCache, searchPtr));
#endif
}
+
#ifdef PURIFY
if (fontsLeft) {
- panic("TkFontPkgFree: all fonts should have been freed already");
+ Tcl_Panic("TkFontPkgFree: all fonts should have been freed already");
}
#endif
+
Tcl_DeleteHashTable(&fiPtr->fontCache);
hPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search);
@@ -457,10 +451,10 @@ TkFontPkgFree(mainPtr)
/*
*---------------------------------------------------------------------------
*
- * Tk_FontObjCmd --
+ * Tk_FontObjCmd --
*
- * This procedure is implemented to process the "font" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is implemented to process the "font" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -472,16 +466,16 @@ TkFontPkgFree(mainPtr)
*/
int
-Tk_FontObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_FontObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int index;
Tk_Window tkwin;
TkFontInfo *fiPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"actual", "configure", "create", "delete",
"families", "measure", "metrics", "names",
NULL
@@ -504,259 +498,320 @@ Tk_FontObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case FONT_ACTUAL: {
- int skip, result;
- Tk_Font tkfont;
- Tcl_Obj *objPtr;
- CONST TkFontAttributes *faPtr;
+ case FONT_ACTUAL: {
+ int skip, result, n;
+ const char *s;
+ Tk_Font tkfont;
+ Tcl_Obj *optPtr, *charPtr, *resultPtr;
+ Tcl_UniChar uniChar = 0;
+ const TkFontAttributes *faPtr;
+ TkFontAttributes fa;
- skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if ((objc < 3) || (objc - skip > 4)) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option?");
- return TCL_ERROR;
- }
- tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
- if (tkfont == NULL) {
- return TCL_ERROR;
- }
- objc -= skip;
- objv += skip;
- faPtr = GetFontAttributes(tkfont);
- objPtr = NULL;
- if (objc > 3) {
- objPtr = objv[3];
- }
- result = GetAttributeInfoObj(interp, faPtr, objPtr);
- Tk_FreeFont(tkfont);
- return result;
+ /*
+ * Params 0 and 1 are 'font actual'. Param 2 is the font name. 3-4 may
+ * be '-displayof $window'
+ */
+
+ skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
}
- case FONT_CONFIGURE: {
- int result;
- char *string;
- Tcl_Obj *objPtr;
- NamedFont *nfPtr;
- Tcl_HashEntry *namedHashPtr;
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "fontname ?options?");
- return TCL_ERROR;
- }
- string = Tcl_GetString(objv[2]);
- namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
- nfPtr = NULL; /* lint. */
- if (namedHashPtr != NULL) {
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
- }
- if ((namedHashPtr == NULL) || (nfPtr->deletePending != 0)) {
- Tcl_AppendResult(interp, "named font \"", string,
- "\" doesn't exist", NULL);
- return TCL_ERROR;
- }
- if (objc == 3) {
- objPtr = NULL;
- } else if (objc == 4) {
- objPtr = objv[3];
+ /*
+ * Next parameter may be an option.
+ */
+
+ n = skip + 3;
+ optPtr = NULL;
+ charPtr = NULL;
+ if (n < objc) {
+ s = Tcl_GetString(objv[n]);
+ if (s[0] == '-' && s[1] != '-') {
+ optPtr = objv[n];
+ ++n;
} else {
- result = ConfigAttributesObj(interp, tkwin, objc - 3,
- objv + 3, &nfPtr->fa);
- UpdateDependentFonts(fiPtr, tkwin, namedHashPtr);
- return result;
+ optPtr = NULL;
}
- return GetAttributeInfoObj(interp, &nfPtr->fa, objPtr);
}
- case FONT_CREATE: {
- int skip, i;
- char *name;
- char buf[16 + TCL_INTEGER_SPACE];
- TkFontAttributes fa;
- Tcl_HashEntry *namedHashPtr;
- skip = 3;
- if (objc < 3) {
- name = NULL;
- } else {
- name = Tcl_GetString(objv[2]);
- if (name[0] == '-') {
- name = NULL;
- }
- }
- if (name == NULL) {
- /*
- * No font name specified. Generate one of the form "fontX".
- */
+ /*
+ * Next parameter may be '--' to mark end of options.
+ */
- for (i = 1; ; i++) {
- sprintf(buf, "font%d", i);
- namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, buf);
- if (namedHashPtr == NULL) {
- break;
- }
- }
- name = buf;
- skip = 2;
+ if (n < objc) {
+ if (!strcmp(Tcl_GetString(objv[n]), "--")) {
+ ++n;
}
- TkInitFontAttributes(&fa);
- if (ConfigAttributesObj(interp, tkwin, objc - skip, objv + skip,
- &fa) != TCL_OK) {
- return TCL_ERROR;
- }
- if (CreateNamedFont(interp, tkwin, name, &fa) != TCL_OK) {
+ }
+
+ /*
+ * Next parameter is the character to get font information for.
+ */
+
+ if (n < objc) {
+ charPtr = objv[n];
+ ++n;
+ }
+
+ /*
+ * If there were fewer than 3 args, or args remain, that's an error.
+ */
+
+ if (objc < 3 || n < objc) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "font ?-displayof window? ?option? ?--? ?char?");
+ return TCL_ERROR;
+ }
+
+ /*
+ * The 'charPtr' arg must be a single Unicode.
+ */
+
+ if (charPtr != NULL) {
+ if (Tcl_GetCharLength(charPtr) != 1) {
+ resultPtr = Tcl_NewStringObj(
+ "expected a single character but got \"", -1);
+ Tcl_AppendLimitedToObj(resultPtr, Tcl_GetString(charPtr),
+ -1, 40, "...");
+ Tcl_AppendToObj(resultPtr, "\"", -1);
+ Tcl_SetObjResult(interp, resultPtr);
return TCL_ERROR;
}
- Tcl_AppendResult(interp, name, NULL);
- break;
+ uniChar = Tcl_GetUniChar(charPtr, 0);
+ }
+
+ /*
+ * Find the font.
+ */
+
+ tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
+ if (tkfont == NULL) {
+ return TCL_ERROR;
}
- case FONT_DELETE: {
- int i;
- char *string;
- NamedFont *nfPtr;
- Tcl_HashEntry *namedHashPtr;
+ /*
+ * Determine the font attributes.
+ */
+
+ if (charPtr == NULL) {
+ faPtr = GetFontAttributes(tkfont);
+ } else {
+ TkpGetFontAttrsForChar(tkwin, tkfont, uniChar, &fa);
+ faPtr = &fa;
+ }
+ result = GetAttributeInfoObj(interp, faPtr, optPtr);
+
+ Tk_FreeFont(tkfont);
+ return result;
+ }
+ case FONT_CONFIGURE: {
+ int result;
+ char *string;
+ Tcl_Obj *objPtr;
+ NamedFont *nfPtr;
+ Tcl_HashEntry *namedHashPtr;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "fontname ?options?");
+ return TCL_ERROR;
+ }
+ string = Tcl_GetString(objv[2]);
+ namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
+ nfPtr = NULL; /* lint. */
+ if (namedHashPtr != NULL) {
+ nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ }
+ if ((namedHashPtr == NULL) || (nfPtr->deletePending != 0)) {
+ Tcl_AppendResult(interp, "named font \"", string,
+ "\" doesn't exist", NULL);
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ objPtr = NULL;
+ } else if (objc == 4) {
+ objPtr = objv[3];
+ } else {
+ result = ConfigAttributesObj(interp, tkwin, objc - 3, objv + 3,
+ &nfPtr->fa);
+ UpdateDependentFonts(fiPtr, tkwin, namedHashPtr);
+ return result;
+ }
+ return GetAttributeInfoObj(interp, &nfPtr->fa, objPtr);
+ }
+ case FONT_CREATE: {
+ int skip, i;
+ char *name;
+ char buf[16 + TCL_INTEGER_SPACE];
+ TkFontAttributes fa;
+ Tcl_HashEntry *namedHashPtr;
+
+ skip = 3;
+ if (objc < 3) {
+ name = NULL;
+ } else {
+ name = Tcl_GetString(objv[2]);
+ if (name[0] == '-') {
+ name = NULL;
+ }
+ }
+ if (name == NULL) {
/*
- * Delete the named font. If there are still widgets using this
- * font, then it isn't deleted right away.
+ * No font name specified. Generate one of the form "fontX".
*/
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "fontname ?fontname ...?");
- return TCL_ERROR;
- }
- for (i = 2; i < objc; i++) {
- string = Tcl_GetString(objv[i]);
- namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
+ for (i = 1; ; i++) {
+ sprintf(buf, "font%d", i);
+ namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, buf);
if (namedHashPtr == NULL) {
- Tcl_AppendResult(interp, "named font \"", string,
- "\" doesn't exist", (char *) NULL);
- return TCL_ERROR;
- }
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
- if (nfPtr->refCount != 0) {
- nfPtr->deletePending = 1;
- } else {
- Tcl_DeleteHashEntry(namedHashPtr);
- ckfree((char *) nfPtr);
+ break;
}
}
- break;
+ name = buf;
+ skip = 2;
+ }
+ TkInitFontAttributes(&fa);
+ if (ConfigAttributesObj(interp, tkwin, objc - skip, objv + skip,
+ &fa) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (TkCreateNamedFont(interp, tkwin, name, &fa) != TCL_OK) {
+ return TCL_ERROR;
}
- case FONT_FAMILIES: {
- int skip;
+ Tcl_AppendResult(interp, name, NULL);
+ break;
+ }
+ case FONT_DELETE: {
+ int i, result = TCL_OK;
+ char *string;
- skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if (objc - skip != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
- return TCL_ERROR;
- }
- TkpGetFontFamilies(interp, tkwin);
- break;
+ /*
+ * Delete the named font. If there are still widgets using this font,
+ * then it isn't deleted right away.
+ */
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "fontname ?fontname ...?");
+ return TCL_ERROR;
}
- case FONT_MEASURE: {
- char *string;
- Tk_Font tkfont;
- int length, skip;
- Tcl_Obj *resultPtr;
-
- skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
- }
- if (objc - skip != 4) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? text");
- return TCL_ERROR;
- }
- tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
- if (tkfont == NULL) {
- return TCL_ERROR;
- }
- string = Tcl_GetStringFromObj(objv[3 + skip], &length);
- resultPtr = Tcl_GetObjResult(interp);
- Tcl_SetIntObj(resultPtr, Tk_TextWidth(tkfont, string, length));
- Tk_FreeFont(tkfont);
- break;
+ for (i = 2; i < objc && result == TCL_OK; i++) {
+ string = Tcl_GetString(objv[i]);
+ result = TkDeleteNamedFont(interp, tkwin, string);
+ }
+ return result;
+ }
+ case FONT_FAMILIES: {
+ int skip;
+
+ skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
}
- case FONT_METRICS: {
- Tk_Font tkfont;
- int skip, index, i;
- CONST TkFontMetrics *fmPtr;
- static CONST char *switches[] = {
- "-ascent", "-descent", "-linespace", "-fixed", NULL
- };
+ if (objc - skip != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
+ return TCL_ERROR;
+ }
+ TkpGetFontFamilies(interp, tkwin);
+ break;
+ }
+ case FONT_MEASURE: {
+ char *string;
+ Tk_Font tkfont;
+ int length = 0, skip = 0;
+ Tcl_Obj *resultPtr;
+ if (objc > 4) {
skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
if (skip < 0) {
return TCL_ERROR;
}
- if ((objc < 3) || ((objc - skip) > 4)) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option?");
- return TCL_ERROR;
- }
- tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
- if (tkfont == NULL) {
+ }
+ if (objc - skip != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "font ?-displayof window? text");
+ return TCL_ERROR;
+ }
+ tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
+ if (tkfont == NULL) {
+ return TCL_ERROR;
+ }
+ string = Tcl_GetStringFromObj(objv[3 + skip], &length);
+ resultPtr = Tcl_GetObjResult(interp);
+ Tcl_SetIntObj(resultPtr, Tk_TextWidth(tkfont, string, length));
+ Tk_FreeFont(tkfont);
+ break;
+ }
+ case FONT_METRICS: {
+ Tk_Font tkfont;
+ int skip, index, i;
+ const TkFontMetrics *fmPtr;
+ static const char *switches[] = {
+ "-ascent", "-descent", "-linespace", "-fixed", NULL
+ };
+
+ skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
+ }
+ if ((objc < 3) || ((objc - skip) > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "font ?-displayof window? ?option?");
+ return TCL_ERROR;
+ }
+ tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
+ if (tkfont == NULL) {
+ return TCL_ERROR;
+ }
+ objc -= skip;
+ objv += skip;
+ fmPtr = GetFontMetrics(tkfont);
+ if (objc == 3) {
+ char buf[64 + TCL_INTEGER_SPACE * 4];
+
+ sprintf(buf, "-ascent %d -descent %d -linespace %d -fixed %d",
+ fmPtr->ascent, fmPtr->descent,
+ fmPtr->ascent + fmPtr->descent, fmPtr->fixed);
+ Tcl_AppendResult(interp, buf, NULL);
+ } else {
+ if (Tcl_GetIndexFromObj(interp, objv[3], switches, "metric", 0,
+ &index) != TCL_OK) {
+ Tk_FreeFont(tkfont);
return TCL_ERROR;
}
- objc -= skip;
- objv += skip;
- fmPtr = GetFontMetrics(tkfont);
- if (objc == 3) {
- char buf[64 + TCL_INTEGER_SPACE * 4];
-
- sprintf(buf, "-ascent %d -descent %d -linespace %d -fixed %d",
- fmPtr->ascent, fmPtr->descent,
- fmPtr->ascent + fmPtr->descent,
- fmPtr->fixed);
- Tcl_AppendResult(interp, buf, NULL);
- } else {
- if (Tcl_GetIndexFromObj(interp, objv[3], switches,
- "metric", 0, &index) != TCL_OK) {
- Tk_FreeFont(tkfont);
- return TCL_ERROR;
- }
- i = 0; /* Needed only to prevent compiler
- * warning. */
- switch (index) {
- case 0: i = fmPtr->ascent; break;
- case 1: i = fmPtr->descent; break;
- case 2: i = fmPtr->ascent + fmPtr->descent; break;
- case 3: i = fmPtr->fixed; break;
- }
- Tcl_SetIntObj(Tcl_GetObjResult(interp), i);
+ i = 0; /* Needed only to prevent compiler warning. */
+ switch (index) {
+ case 0: i = fmPtr->ascent; break;
+ case 1: i = fmPtr->descent; break;
+ case 2: i = fmPtr->ascent + fmPtr->descent; break;
+ case 3: i = fmPtr->fixed; break;
}
- Tk_FreeFont(tkfont);
- break;
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), i);
}
- case FONT_NAMES: {
- char *string;
- NamedFont *nfPtr;
- Tcl_HashSearch search;
- Tcl_HashEntry *namedHashPtr;
- Tcl_Obj *strPtr, *resultPtr;
-
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "names");
- return TCL_ERROR;
- }
- resultPtr = Tcl_GetObjResult(interp);
- namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search);
- while (namedHashPtr != NULL) {
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
- if (nfPtr->deletePending == 0) {
- string = Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr);
- strPtr = Tcl_NewStringObj(string, -1);
- Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
- }
- namedHashPtr = Tcl_NextHashEntry(&search);
+ Tk_FreeFont(tkfont);
+ break;
+ }
+ case FONT_NAMES: {
+ char *string;
+ NamedFont *nfPtr;
+ Tcl_HashSearch search;
+ Tcl_HashEntry *namedHashPtr;
+ Tcl_Obj *strPtr, *resultPtr;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "names");
+ return TCL_ERROR;
+ }
+ resultPtr = Tcl_GetObjResult(interp);
+ namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search);
+ while (namedHashPtr != NULL) {
+ nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ if (nfPtr->deletePending == 0) {
+ string = Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr);
+ strPtr = Tcl_NewStringObj(string, -1);
+ Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
}
- break;
+ namedHashPtr = Tcl_NextHashEntry(&search);
}
+ break;
+ }
}
return TCL_OK;
}
@@ -766,10 +821,10 @@ Tk_FontObjCmd(clientData, interp, objc, objv)
*
* UpdateDependentFonts, TheWorldHasChanged, RecomputeWidgets --
*
- * Called when the attributes of a named font changes. Updates all
- * the instantiated fonts that depend on that named font and then
- * uses the brute force approach and prepares every widget to
- * recompute its geometry.
+ * Called when the attributes of a named font changes. Updates all the
+ * instantiated fonts that depend on that named font and then uses the
+ * brute force approach and prepares every widget to recompute its
+ * geometry.
*
* Results:
* None.
@@ -781,10 +836,10 @@ Tk_FontObjCmd(clientData, interp, objc, objv)
*/
static void
-UpdateDependentFonts(fiPtr, tkwin, namedHashPtr)
- TkFontInfo *fiPtr; /* Info about application's fonts. */
- Tk_Window tkwin; /* A window in the application. */
- Tcl_HashEntry *namedHashPtr;/* The named font that is changing. */
+UpdateDependentFonts(
+ TkFontInfo *fiPtr, /* Info about application's fonts. */
+ Tk_Window tkwin, /* A window in the application. */
+ Tcl_HashEntry *namedHashPtr)/* The named font that is changing. */
{
Tcl_HashEntry *cacheHashPtr;
Tcl_HashSearch search;
@@ -794,8 +849,8 @@ UpdateDependentFonts(fiPtr, tkwin, namedHashPtr)
nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
if (nfPtr->refCount == 0) {
/*
- * Well nobody's using this named font, so don't have to tell
- * any widgets to recompute themselves.
+ * Well nobody's using this named font, so don't have to tell any
+ * widgets to recompute themselves.
*/
return;
@@ -818,8 +873,8 @@ UpdateDependentFonts(fiPtr, tkwin, namedHashPtr)
}
static void
-TheWorldHasChanged(clientData)
- ClientData clientData; /* Info about application's fonts. */
+TheWorldHasChanged(
+ ClientData clientData) /* Info about application's fonts. */
{
TkFontInfo *fiPtr;
@@ -830,8 +885,8 @@ TheWorldHasChanged(clientData)
}
static void
-RecomputeWidgets(winPtr)
- TkWindow *winPtr; /* Window to which command is sent. */
+RecomputeWidgets(
+ TkWindow *winPtr) /* Window to which command is sent. */
{
Tk_ClassWorldChangedProc *proc;
proc = Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc);
@@ -842,22 +897,23 @@ RecomputeWidgets(winPtr)
/*
* Notify all the descendants of this window that the world has changed.
*
- * This could be done recursively or iteratively. The recursive version
- * is easier to implement and understand, and typically, windows with a
- * -font option will be leaf nodes in the widget heirarchy (buttons,
- * labels, etc.), so the recursion depth will be shallow.
+ * This could be done recursively or iteratively. The recursive version is
+ * easier to implement and understand, and typically, windows with a -font
+ * option will be leaf nodes in the widget heirarchy (buttons, labels,
+ * etc.), so the recursion depth will be shallow.
*
- * However, the additional overhead of the recursive calls may become
- * a performance problem if typical usage alters such that -font'ed widgets
- * appear high in the heirarchy, causing deep recursion. This could happen
+ * However, the additional overhead of the recursive calls may become a
+ * performance problem if typical usage alters such that -font'ed widgets
+ * appear high in the heirarchy, causing deep recursion. This could happen
* with text widgets, or more likely with the (not yet existant) labeled
- * frame widget. With these widgets it is possible, even likely, that a
+ * frame widget. With these widgets it is possible, even likely, that a
* -font'ed widget (text or labeled frame) will not be a leaf node, but
- * will instead have many descendants. If this is ever found to cause
- * a performance problem, it may be worth investigating an iterative
- * version of the code below.
+ * will instead have many descendants. If this is ever found to cause a
+ * performance problem, it may be worth investigating an iterative version
+ * of the code below.
*/
- for (winPtr = winPtr->childList; winPtr != NULL; winPtr = winPtr->nextPtr) {
+
+ for (winPtr=winPtr->childList ; winPtr!=NULL ; winPtr=winPtr->nextPtr) {
RecomputeWidgets(winPtr);
}
}
@@ -865,56 +921,57 @@ RecomputeWidgets(winPtr)
/*
*---------------------------------------------------------------------------
*
- * CreateNamedFont --
+ * TkCreateNamedFont --
*
- * Create the specified named font with the given attributes in the
- * named font table associated with the interp.
+ * Create the specified named font with the given attributes in the named
+ * font table associated with the interp.
*
* Results:
- * Returns TCL_OK if the font was successfully created, or TCL_ERROR
- * if the named font already existed. If TCL_ERROR is returned, an
- * error message is left in the interp's result.
+ * Returns TCL_OK if the font was successfully created, or TCL_ERROR if
+ * the named font already existed. If TCL_ERROR is returned, an error
+ * message is left in the interp's result.
*
* Side effects:
* Assume there used to exist a named font by the specified name, and
* that the named font had been deleted, but there were still some
- * widgets using the named font at the time it was deleted. If a
- * new named font is created with the same name, all those widgets
- * that were using the old named font will be redisplayed using
- * the new named font's attributes.
+ * widgets using the named font at the time it was deleted. If a new
+ * named font is created with the same name, all those widgets that were
+ * using the old named font will be redisplayed using the new named
+ * font's attributes.
*
*---------------------------------------------------------------------------
*/
-static int
-CreateNamedFont(interp, tkwin, name, faPtr)
- Tcl_Interp *interp; /* Interp for error return. */
- Tk_Window tkwin; /* A window associated with interp. */
- CONST char *name; /* Name for the new named font. */
- TkFontAttributes *faPtr; /* Attributes for the new named font. */
+int
+TkCreateNamedFont(
+ Tcl_Interp *interp, /* Interp for error return (can be NULL). */
+ Tk_Window tkwin, /* A window associated with interp. */
+ const char *name, /* Name for the new named font. */
+ TkFontAttributes *faPtr) /* Attributes for the new named font. */
{
TkFontInfo *fiPtr;
Tcl_HashEntry *namedHashPtr;
- int new;
- NamedFont *nfPtr;
+ int isNew;
+ NamedFont *nfPtr;
fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
- namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &new);
-
- if (new == 0) {
+ namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew);
+
+ if (!isNew) {
nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
if (nfPtr->deletePending == 0) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "named font \"", name,
- "\" already exists", (char *) NULL);
+ if (interp) {
+ Tcl_AppendResult(interp, "named font \"", name,
+ "\" already exists", NULL);
+ }
return TCL_ERROR;
}
/*
- * Recreating a named font with the same name as a previous
- * named font. Some widgets were still using that named
- * font, so they need to get redisplayed.
+ * Recreating a named font with the same name as a previous named
+ * font. Some widgets were still using that named font, so they need
+ * to get redisplayed.
*/
nfPtr->fa = *faPtr;
@@ -927,7 +984,7 @@ CreateNamedFont(interp, tkwin, name, faPtr)
nfPtr->deletePending = 0;
Tcl_SetHashValue(namedHashPtr, nfPtr);
nfPtr->fa = *faPtr;
- nfPtr->refCount = 0;
+ nfPtr->refCount = 0;
nfPtr->deletePending = 0;
return TCL_OK;
}
@@ -935,76 +992,116 @@ CreateNamedFont(interp, tkwin, name, faPtr)
/*
*---------------------------------------------------------------------------
*
- * Tk_GetFont --
+ * TkDeleteNamedFont --
+ *
+ * Delete the named font. If there are still widgets using this font,
+ * then it isn't deleted right away.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkDeleteNamedFont(
+ Tcl_Interp *interp, /* Interp for error return (can be NULL). */
+ Tk_Window tkwin, /* A window associated with interp. */
+ CONST char *name) /* Name for the new named font. */
+{
+ TkFontInfo *fiPtr;
+ NamedFont *nfPtr;
+ Tcl_HashEntry *namedHashPtr;
+
+ fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
+
+ namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, name);
+ if (namedHashPtr == NULL) {
+ if (interp) {
+ Tcl_AppendResult(interp, "named font \"", name,
+ "\" doesn't exist", NULL);
+ }
+ return TCL_ERROR;
+ }
+ nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ if (nfPtr->refCount != 0) {
+ nfPtr->deletePending = 1;
+ } else {
+ Tcl_DeleteHashEntry(namedHashPtr);
+ ckfree((char *) nfPtr);
+ }
+ return TCL_OK;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * Tk_GetFont --
*
* Given a string description of a font, map the description to a
* corresponding Tk_Font that represents the font.
*
* Results:
- * The return value is token for the font, or NULL if an error
- * prevented the font from being created. If NULL is returned, an
- * error message will be left in the interp's result.
+ * The return value is token for the font, or NULL if an error prevented
+ * the font from being created. If NULL is returned, an error message
+ * will be left in the interp's result.
*
* Side effects:
- * The font is added to an internal database with a reference
- * count. For each call to this procedure, there should eventually
- * be a call to Tk_FreeFont() or Tk_FreeFontFromObj() so that the
- * database is cleaned up when fonts aren't in use anymore.
+ * The font is added to an internal database with a reference count. For
+ * each call to this function, there should eventually be a call to
+ * Tk_FreeFont() or Tk_FreeFontFromObj() so that the database is cleaned
+ * up when fonts aren't in use anymore.
*
*---------------------------------------------------------------------------
*/
Tk_Font
-Tk_GetFont(interp, tkwin, string)
- Tcl_Interp *interp; /* Interp for database and error return, or
- * NULL for no error messages. */
- Tk_Window tkwin; /* For display on which font will be used. */
- CONST char *string; /* String describing font, as: named font,
+Tk_GetFont(
+ Tcl_Interp *interp, /* Interp for database and error return. */
+ Tk_Window tkwin, /* For display on which font will be used. */
+ const char *string) /* String describing font, as: named font,
* native format, or parseable string. */
{
- Tk_Font tkfont;
+ Tk_Font tkfont;
Tcl_Obj *strPtr;
strPtr = Tcl_NewStringObj((char *) string, -1);
Tcl_IncrRefCount(strPtr);
tkfont = Tk_AllocFontFromObj(interp, tkwin, strPtr);
- Tcl_DecrRefCount(strPtr);
+ Tcl_DecrRefCount(strPtr);
return tkfont;
}
/*
*---------------------------------------------------------------------------
*
- * Tk_AllocFontFromObj --
+ * Tk_AllocFontFromObj --
*
* Given a string description of a font, map the description to a
* corresponding Tk_Font that represents the font.
*
* Results:
- * The return value is token for the font, or NULL if an error
- * prevented the font from being created. If NULL is returned, an
- * error message will be left in interp's result object (if non-NULL).
+ * The return value is token for the font, or NULL if an error prevented
+ * the font from being created. If NULL is returned, an error message
+ * will be left in interp's result object.
*
* Side effects:
- * The font is added to an internal database with a reference
- * count. For each call to this procedure, there should eventually
- * be a call to Tk_FreeFont() or Tk_FreeFontFromObj() so that the
- * database is cleaned up when fonts aren't in use anymore.
+ * The font is added to an internal database with a reference count. For
+ * each call to this function, there should eventually be a call to
+ * Tk_FreeFont() or Tk_FreeFontFromObj() so that the database is cleaned
+ * up when fonts aren't in use anymore.
*
*---------------------------------------------------------------------------
*/
Tk_Font
-Tk_AllocFontFromObj(interp, tkwin, objPtr)
- Tcl_Interp *interp; /* Interp for database and error return. */
- Tk_Window tkwin; /* For screen on which font will be used. */
- Tcl_Obj *objPtr; /* Object describing font, as: named font,
+Tk_AllocFontFromObj(
+ Tcl_Interp *interp, /* Interp for database and error return. */
+ Tk_Window tkwin, /* For screen on which font will be used. */
+ Tcl_Obj *objPtr) /* Object describing font, as: named font,
* native format, or parseable string. */
{
TkFontInfo *fiPtr;
Tcl_HashEntry *cacheHashPtr, *namedHashPtr;
TkFont *fontPtr, *firstFontPtr, *oldFontPtr;
- int new, descent;
+ int isNew, descent;
NamedFont *nfPtr;
fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
@@ -1017,8 +1114,8 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
if (oldFontPtr != NULL) {
if (oldFontPtr->resourceRefCount == 0) {
/*
- * This is a stale reference: it refers to a TkFont that's
- * no longer in use. Clear the reference.
+ * This is a stale reference: it refers to a TkFont that's no
+ * longer in use. Clear the reference.
*/
FreeFontObjProc(objPtr);
@@ -1030,17 +1127,17 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
}
/*
- * Next, search the list of fonts that have the name we want, to see
- * if one of them is for the right screen.
+ * Next, search the list of fonts that have the name we want, to see if
+ * one of them is for the right screen.
*/
- new = 0;
+ isNew = 0;
if (oldFontPtr != NULL) {
cacheHashPtr = oldFontPtr->cacheHashPtr;
FreeFontObjProc(objPtr);
} else {
cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache,
- Tcl_GetString(objPtr), &new);
+ Tcl_GetString(objPtr), &isNew);
}
firstFontPtr = (TkFont *) Tcl_GetHashValue(cacheHashPtr);
for (fontPtr = firstFontPtr; (fontPtr != NULL);
@@ -1048,13 +1145,13 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
if (Tk_Screen(tkwin) == fontPtr->screen) {
fontPtr->resourceRefCount++;
fontPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) fontPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
return (Tk_Font) fontPtr;
}
}
/*
- * The desired font isn't in the table. Make a new one.
+ * The desired font isn't in the table. Make a new one.
*/
namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable,
@@ -1079,7 +1176,7 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
Tcl_Obj *dupObjPtr = Tcl_DuplicateObj(objPtr);
if (ParseFontNameObj(interp, tkwin, dupObjPtr, &fa) != TCL_OK) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(cacheHashPtr);
}
Tcl_DecrRefCount(dupObjPtr);
@@ -1095,6 +1192,19 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
}
}
+ /*
+ * Detect the system font engine going wrong and fail more gracefully.
+ */
+
+ if (fontPtr == NULL) {
+ if (isNew) {
+ Tcl_DeleteHashEntry(cacheHashPtr);
+ }
+ Tcl_AppendResult(interp, "failed to allocate font due to ",
+ "internal system font engine problem", NULL);
+ return NULL;
+ }
+
fontPtr->resourceRefCount = 1;
fontPtr->objRefCount = 1;
fontPtr->cacheHashPtr = cacheHashPtr;
@@ -1122,7 +1232,7 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
* Get information used for drawing underlines in generic code on a
* non-underlined font.
*/
-
+
descent = fontPtr->fm.descent;
fontPtr->underlinePos = descent / 2;
fontPtr->underlineHeight = TkFontGetPixels(tkwin, fontPtr->fa.size) / 10;
@@ -1131,9 +1241,9 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
}
if (fontPtr->underlinePos + fontPtr->underlineHeight > descent) {
/*
- * If this set of values would cause the bottom of the underline
- * bar to stick below the descent of the font, jack the underline
- * up a bit higher.
+ * If this set of values would cause the bottom of the underline bar
+ * to stick below the descent of the font, jack the underline up a bit
+ * higher.
*/
fontPtr->underlineHeight = descent - fontPtr->underlinePos;
@@ -1142,8 +1252,8 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
fontPtr->underlineHeight = 1;
}
}
-
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) fontPtr;
+
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
return (Tk_Font) fontPtr;
}
@@ -1152,31 +1262,31 @@ Tk_AllocFontFromObj(interp, tkwin, objPtr)
*
* Tk_GetFontFromObj --
*
- * Find the font that corresponds to a given object. The font must
- * have already been created by Tk_GetFont or Tk_AllocFontFromObj.
+ * Find the font that corresponds to a given object. The font must have
+ * already been created by Tk_GetFont or Tk_AllocFontFromObj.
*
* Results:
- * The return value is a token for the font that matches objPtr
- * and is suitable for use in tkwin.
+ * The return value is a token for the font that matches objPtr and is
+ * suitable for use in tkwin.
*
* Side effects:
- * If the object is not already a font ref, the conversion will free
- * any old internal representation.
+ * If the object is not already a font ref, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
Tk_Font
-Tk_GetFontFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* The window that the font will be used in. */
- Tcl_Obj *objPtr; /* The object from which to get the font. */
+Tk_GetFontFromObj(
+ Tk_Window tkwin, /* The window that the font will be used in. */
+ Tcl_Obj *objPtr) /* The object from which to get the font. */
{
TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
TkFont *fontPtr;
Tcl_HashEntry *hashPtr;
-
+
if (objPtr->typePtr != &tkFontObjType) {
- SetFontFromAny((Tcl_Interp *) NULL, objPtr);
+ SetFontFromAny(NULL, objPtr);
}
fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1;
@@ -1184,8 +1294,8 @@ Tk_GetFontFromObj(tkwin, objPtr)
if (fontPtr != NULL) {
if (fontPtr->resourceRefCount == 0) {
/*
- * This is a stale reference: it refers to a TkFont that's
- * no longer in use. Clear the reference.
+ * This is a stale reference: it refers to a TkFont that's no
+ * longer in use. Clear the reference.
*/
FreeFontObjProc(objPtr);
@@ -1196,8 +1306,8 @@ Tk_GetFontFromObj(tkwin, objPtr)
}
/*
- * Next, search the list of fonts that have the name we want, to see
- * if one of them is for the right screen.
+ * Next, search the list of fonts that have the name we want, to see if
+ * one of them is for the right screen.
*/
if (fontPtr != NULL) {
@@ -1211,13 +1321,13 @@ Tk_GetFontFromObj(tkwin, objPtr)
fontPtr = fontPtr->nextPtr) {
if (Tk_Screen(tkwin) == fontPtr->screen) {
fontPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) fontPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
return (Tk_Font) fontPtr;
}
}
}
- panic("Tk_GetFontFromObj called with non-existent font!");
+ Tcl_Panic("Tk_GetFontFromObj called with non-existent font!");
return NULL;
}
@@ -1226,28 +1336,28 @@ Tk_GetFontFromObj(tkwin, objPtr)
*
* SetFontFromAny --
*
- * Convert the internal representation of a Tcl object to the
- * font internal form.
+ * Convert the internal representation of a Tcl object to the font
+ * internal form.
*
* Results:
* Always returns TCL_OK.
*
* Side effects:
- * The object is left with its typePtr pointing to tkFontObjType.
- * The TkFont pointer is NULL.
+ * The object is left with its typePtr pointing to tkFontObjType. The
+ * TkFont pointer is NULL.
*
*----------------------------------------------------------------------
*/
static int
-SetFontFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr; /* The object to convert. */
+SetFontFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ const Tcl_ObjType *typePtr;
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
Tcl_GetString(objPtr);
@@ -1269,10 +1379,10 @@ SetFontFromAny(interp, objPtr)
* Given a font, return a textual string identifying it.
*
* Results:
- * The return value is the description that was passed to
- * Tk_GetFont() to create the font. The storage for the returned
- * string is only guaranteed to persist until the font is deleted.
- * The caller should not modify this string.
+ * The return value is the description that was passed to Tk_GetFont() to
+ * create the font. The storage for the returned string is only
+ * guaranteed to persist until the font is deleted. The caller should not
+ * modify this string.
*
* Side effects:
* None.
@@ -1280,9 +1390,9 @@ SetFontFromAny(interp, objPtr)
*---------------------------------------------------------------------------
*/
-CONST char *
-Tk_NameOfFont(tkfont)
- Tk_Font tkfont; /* Font whose name is desired. */
+const char *
+Tk_NameOfFont(
+ Tk_Font tkfont) /* Font whose name is desired. */
{
TkFont *fontPtr;
@@ -1293,7 +1403,7 @@ Tk_NameOfFont(tkfont)
/*
*---------------------------------------------------------------------------
*
- * Tk_FreeFont --
+ * Tk_FreeFont --
*
* Called to release a font allocated by Tk_GetFont().
*
@@ -1301,15 +1411,15 @@ Tk_NameOfFont(tkfont)
* None.
*
* Side effects:
- * The reference count associated with font is decremented, and
- * only deallocated when no one is using it.
+ * The reference count associated with font is decremented, and only
+ * deallocated when no one is using it.
*
*---------------------------------------------------------------------------
*/
void
-Tk_FreeFont(tkfont)
- Tk_Font tkfont; /* Font to be released. */
+Tk_FreeFont(
+ Tk_Font tkfont) /* Font to be released. */
{
TkFont *fontPtr, *prevPtr;
NamedFont *nfPtr;
@@ -1324,9 +1434,8 @@ Tk_FreeFont(tkfont)
}
if (fontPtr->namedHashPtr != NULL) {
/*
- * This font derived from a named font. Reduce the reference
- * count on the named font and free it if no-one else is
- * using it.
+ * This font derived from a named font. Reduce the reference count on
+ * the named font and free it if no-one else is using it.
*/
nfPtr = (NamedFont *) Tcl_GetHashValue(fontPtr->namedHashPtr);
@@ -1341,7 +1450,7 @@ Tk_FreeFont(tkfont)
if (prevPtr == fontPtr) {
if (fontPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(fontPtr->cacheHashPtr);
- } else {
+ } else {
Tcl_SetHashValue(fontPtr->cacheHashPtr, fontPtr->nextPtr);
}
} else {
@@ -1360,7 +1469,7 @@ Tk_FreeFont(tkfont)
/*
*---------------------------------------------------------------------------
*
- * Tk_FreeFontFromObj --
+ * Tk_FreeFontFromObj --
*
* Called to release a font inside a Tcl_Obj *. Decrements the refCount
* of the font and removes it from the hash tables if necessary.
@@ -1369,17 +1478,17 @@ Tk_FreeFont(tkfont)
* None.
*
* Side effects:
- * The reference count associated with font is decremented, and
- * only deallocated when no one is using it.
+ * The reference count associated with font is decremented, and only
+ * deallocated when no one is using it.
*
*---------------------------------------------------------------------------
*/
void
-Tk_FreeFontFromObj(tkwin, objPtr)
- Tk_Window tkwin; /* The window this font lives in. Needed
- * for the screen value. */
- Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */
+Tk_FreeFontFromObj(
+ Tk_Window tkwin, /* The window this font lives in. Needed for
+ * the screen value. */
+ Tcl_Obj *objPtr) /* The Tcl_Obj * to be freed. */
{
Tk_FreeFont(Tk_GetFontFromObj(tkwin, objPtr));
}
@@ -1387,26 +1496,25 @@ Tk_FreeFontFromObj(tkwin, objPtr)
/*
*---------------------------------------------------------------------------
*
- * FreeFontObjProc --
+ * FreeFontObjProc --
*
- * This proc is called to release an object reference to a font.
- * Called when the object's internal rep is released or when
- * the cached fontPtr needs to be changed.
+ * This proc is called to release an object reference to a font. Called
+ * when the object's internal rep is released or when the cached fontPtr
+ * needs to be changed.
*
* Results:
* None.
*
* Side effects:
- * The object reference count is decremented. When both it
- * and the hash ref count go to zero, the font's resources
- * are released.
+ * The object reference count is decremented. When both it and the hash
+ * ref count go to zero, the font's resources are released.
*
*---------------------------------------------------------------------------
*/
static void
-FreeFontObjProc(objPtr)
- Tcl_Obj *objPtr; /* The object we are releasing. */
+FreeFontObjProc(
+ Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkFont *fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1;
@@ -1422,30 +1530,30 @@ FreeFontObjProc(objPtr)
/*
*---------------------------------------------------------------------------
*
- * DupFontObjProc --
+ * DupFontObjProc --
*
- * When a cached font object is duplicated, this is called to
- * update the internal reps.
+ * When a cached font object is duplicated, this is called to update the
+ * internal reps.
*
* Results:
* None.
*
* Side effects:
- * The font's objRefCount is incremented and the internal rep
- * of the copy is set to point to it.
+ * The font's objRefCount is incremented and the internal rep of the copy
+ * is set to point to it.
*
*---------------------------------------------------------------------------
*/
static void
-DupFontObjProc(srcObjPtr, dupObjPtr)
- Tcl_Obj *srcObjPtr; /* The object we are copying from. */
- Tcl_Obj *dupObjPtr; /* The object we are copying to. */
+DupFontObjProc(
+ Tcl_Obj *srcObjPtr, /* The object we are copying from. */
+ Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkFont *fontPtr = (TkFont *) srcObjPtr->internalRep.twoPtrValue.ptr1;
-
+
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (VOID *) fontPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
if (fontPtr != NULL) {
fontPtr->objRefCount++;
@@ -1457,10 +1565,10 @@ DupFontObjProc(srcObjPtr, dupObjPtr)
*
* Tk_FontId --
*
- * Given a font, return an opaque handle that should be selected
- * into the XGCValues structure in order to get the constructed
- * gc to use this font. This procedure would go away if the
- * XGCValues structure were replaced with a TkGCValues structure.
+ * Given a font, return an opaque handle that should be selected into the
+ * XGCValues structure in order to get the constructed gc to use this
+ * font. This function would go away if the XGCValues structure were
+ * replaced with a TkGCValues structure.
*
* Results:
* As above.
@@ -1472,8 +1580,9 @@ DupFontObjProc(srcObjPtr, dupObjPtr)
*/
Font
-Tk_FontId(tkfont)
- Tk_Font tkfont; /* Font that is going to be selected into GC. */
+Tk_FontId(
+ Tk_Font tkfont) /* Font that is going to be selected into
+ * GC. */
{
TkFont *fontPtr;
@@ -1486,26 +1595,27 @@ Tk_FontId(tkfont)
*
* Tk_GetFontMetrics --
*
- * Returns overall ascent and descent metrics for the given font.
- * These values can be used to space multiple lines of text and
- * to align the baselines of text in different fonts.
+ * Returns overall ascent and descent metrics for the given font. These
+ * values can be used to space multiple lines of text and to align the
+ * baselines of text in different fonts.
*
* Results:
- * If *heightPtr is non-NULL, it is filled with the overall height
- * of the font, which is the sum of the ascent and descent.
- * If *ascentPtr or *descentPtr is non-NULL, they are filled with
- * the ascent and/or descent information for the font.
+ * If *heightPtr is non-NULL, it is filled with the overall height of the
+ * font, which is the sum of the ascent and descent. If *ascentPtr or
+ * *descentPtr is non-NULL, they are filled with the ascent and/or
+ * descent information for the font.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
+
void
-Tk_GetFontMetrics(tkfont, fmPtr)
- Tk_Font tkfont; /* Font in which metrics are calculated. */
- Tk_FontMetrics *fmPtr; /* Pointer to structure in which font
- * metrics for tkfont will be stored. */
+Tk_GetFontMetrics(
+ Tk_Font tkfont, /* Font in which metrics are calculated. */
+ Tk_FontMetrics *fmPtr) /* Pointer to structure in which font metrics
+ * for tkfont will be stored. */
{
TkFont *fontPtr;
@@ -1520,33 +1630,32 @@ Tk_GetFontMetrics(tkfont, fmPtr)
*
* Tk_PostscriptFontName --
*
- * Given a Tk_Font, return the name of the corresponding Postscript
- * font.
+ * Given a Tk_Font, return the name of the corresponding Postscript font.
*
* Results:
- * The return value is the pointsize of the given Tk_Font.
- * The name of the Postscript font is appended to dsPtr.
+ * The return value is the pointsize of the given Tk_Font. The name of
+ * the Postscript font is appended to dsPtr.
*
* Side effects:
- * If the font does not exist on the printer, the print job will
- * fail at print time. Given a "reasonable" Postscript printer,
- * the following Tk_Font font families should print correctly:
+ * If the font does not exist on the printer, the print job will fail at
+ * print time. Given a "reasonable" Postscript printer, the following
+ * Tk_Font font families should print correctly:
*
* Avant Garde, Arial, Bookman, Courier, Courier New, Geneva,
* Helvetica, Monaco, New Century Schoolbook, New York,
* Palatino, Symbol, Times, Times New Roman, Zapf Chancery,
* and Zapf Dingbats.
*
- * Any other Tk_Font font families may not print correctly
- * because the computed Postscript font name may be incorrect.
+ * Any other Tk_Font font families may not print correctly because the
+ * computed Postscript font name may be incorrect.
*
*---------------------------------------------------------------------------
*/
int
-Tk_PostscriptFontName(tkfont, dsPtr)
- Tk_Font tkfont; /* Font in which text will be printed. */
- Tcl_DString *dsPtr; /* Pointer to an initialized Tcl_DString to
+Tk_PostscriptFontName(
+ Tk_Font tkfont, /* Font in which text will be printed. */
+ Tcl_DString *dsPtr) /* Pointer to an initialized Tcl_DString to
* which the name of the Postscript font that
* corresponds to tkfont will be appended. */
{
@@ -1559,9 +1668,9 @@ Tk_PostscriptFontName(tkfont, dsPtr)
fontPtr = (TkFont *) tkfont;
/*
- * Convert the case-insensitive Tk_Font family name to the
- * case-sensitive Postscript family name. Take out any spaces and
- * capitalize the first letter of each word.
+ * Convert the case-insensitive Tk_Font family name to the case-sensitive
+ * Postscript family name. Take out any spaces and capitalize the first
+ * letter of each word.
*/
family = fontPtr->fa.family;
@@ -1589,8 +1698,8 @@ Tk_PostscriptFontName(tkfont, dsPtr)
/*
* Inline, capitalize the first letter of each word, lowercase the
* rest of the letters in each word, and then take out the spaces
- * between the words. This may make the DString shorter, which is
- * safe to do.
+ * between the words. This may make the DString shorter, which is safe
+ * to do.
*/
Tcl_DStringAppend(dsPtr, family, -1);
@@ -1607,7 +1716,7 @@ Tk_PostscriptFontName(tkfont, dsPtr)
ch = Tcl_UniCharToUpper(ch);
upper = 0;
} else {
- ch = Tcl_UniCharToLower(ch);
+ ch = Tcl_UniCharToLower(ch);
}
dest += Tcl_UniCharToUtf(ch, dest);
}
@@ -1655,14 +1764,12 @@ Tk_PostscriptFontName(tkfont, dsPtr)
slantString = NULL;
if (fontPtr->fa.slant == TK_FS_ROMAN) {
;
+ } else if ((strcmp(family, "Helvetica") == 0)
+ || (strcmp(family, "Courier") == 0)
+ || (strcmp(family, "AvantGarde") == 0)) {
+ slantString = "Oblique";
} else {
- if ((strcmp(family, "Helvetica") == 0)
- || (strcmp(family, "Courier") == 0)
- || (strcmp(family, "AvantGarde") == 0)) {
- slantString = "Oblique";
- } else {
- slantString = "Italic";
- }
+ slantString = "Italic";
}
/*
@@ -1671,7 +1778,7 @@ Tk_PostscriptFontName(tkfont, dsPtr)
*/
if ((slantString == NULL) && (weightString == NULL)) {
- if ((strcmp(family, "Times") == 0)
+ if ((strcmp(family, "Times") == 0)
|| (strcmp(family, "NewCenturySchlbk") == 0)
|| (strcmp(family, "Palatino") == 0)) {
Tcl_DStringAppend(dsPtr, "-Roman", -1);
@@ -1695,8 +1802,8 @@ Tk_PostscriptFontName(tkfont, dsPtr)
* Tk_TextWidth --
*
* A wrapper function for the more complicated interface of
- * Tk_MeasureChars. Computes how much space the given
- * simple string needs.
+ * Tk_MeasureChars. Computes how much space the given simple string
+ * needs.
*
* Results:
* The return value is the width (in pixels) of the given string.
@@ -1708,11 +1815,11 @@ Tk_PostscriptFontName(tkfont, dsPtr)
*/
int
-Tk_TextWidth(tkfont, string, numBytes)
- Tk_Font tkfont; /* Font in which text will be measured. */
- CONST char *string; /* String whose width will be computed. */
- int numBytes; /* Number of bytes to consider from
- * string, or < 0 for strlen(). */
+Tk_TextWidth(
+ Tk_Font tkfont, /* Font in which text will be measured. */
+ const char *string, /* String whose width will be computed. */
+ int numBytes) /* Number of bytes to consider from string, or
+ * < 0 for strlen(). */
{
int width;
@@ -1726,15 +1833,15 @@ Tk_TextWidth(tkfont, string, numBytes)
/*
*---------------------------------------------------------------------------
*
- * Tk_UnderlineChars --
+ * Tk_UnderlineChars, TkUnderlineCharsInContext --
*
- * This procedure draws an underline for a given range of characters
- * in a given string. It doesn't draw the characters (which are
- * assumed to have been displayed previously); it just draws the
- * underline. This procedure would mainly be used to quickly
- * underline a few characters without having to construct an
- * underlined font. To produce properly underlined text, the
- * appropriate underlined font should be constructed and used.
+ * These procedures draw an underline for a given range of characters in
+ * a given string. They don't draw the characters (which are assumed to
+ * have been displayed previously); they just draw the underline. These
+ * procedures would mainly be used to quickly underline a few characters
+ * without having to construct an underlined font. To produce properly
+ * underlined text, the appropriate underlined font should be constructed
+ * and used.
*
* Results:
* None.
@@ -1746,30 +1853,53 @@ Tk_TextWidth(tkfont, string, numBytes)
*/
void
-Tk_UnderlineChars(display, drawable, gc, tkfont, string, x, y, firstByte,
- lastByte)
- Display *display; /* Display on which to draw. */
- Drawable drawable; /* Window or pixmap in which to draw. */
- GC gc; /* Graphics context for actually drawing
+Tk_UnderlineChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for actually drawing
* line. */
- Tk_Font tkfont; /* Font used in GC; must have been allocated
- * by Tk_GetFont(). Used for character
+ Tk_Font tkfont, /* Font used in GC; must have been allocated
+ * by Tk_GetFont(). Used for character
* dimensions, etc. */
- CONST char *string; /* String containing characters to be
+ const char *string, /* String containing characters to be
* underlined or overstruck. */
- int x, y; /* Coordinates at which first character of
+ int x, int y, /* Coordinates at which first character of
* string is drawn. */
- int firstByte; /* Index of first byte of first character. */
- int lastByte; /* Index of first byte after the last
+ int firstByte, /* Index of first byte of first character. */
+ int lastByte) /* Index of first byte after the last
+ * character. */
+{
+ TkUnderlineCharsInContext(display, drawable, gc, tkfont, string,
+ lastByte, x, y, firstByte, lastByte);
+}
+
+void
+TkUnderlineCharsInContext(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for actually drawing
+ * line. */
+ Tk_Font tkfont, /* Font used in GC; must have been allocated
+ * by Tk_GetFont(). Used for character
+ * dimensions, etc. */
+ const char *string, /* String containing characters to be
+ * underlined or overstruck. */
+ int numBytes, /* Number of bytes in string. */
+ int x, int y, /* Coordinates at which the first character of
+ * the whole string would be drawn. */
+ int firstByte, /* Index of first byte of first character. */
+ int lastByte) /* Index of first byte after the last
* character. */
{
TkFont *fontPtr;
int startX, endX;
fontPtr = (TkFont *) tkfont;
-
- Tk_MeasureChars(tkfont, string, firstByte, -1, 0, &startX);
- Tk_MeasureChars(tkfont, string, lastByte, -1, 0, &endX);
+
+ TkpMeasureCharsInContext(tkfont, string, numBytes, 0, firstByte, -1, 0,
+ &startX);
+ TkpMeasureCharsInContext(tkfont, string, numBytes, 0, lastByte, -1, 0,
+ &endX);
XFillRectangle(display, drawable, gc, x + startX,
y + fontPtr->underlinePos, (unsigned int) (endX - startX),
@@ -1781,66 +1911,60 @@ Tk_UnderlineChars(display, drawable, gc, tkfont, string, x, y, firstByte,
*
* Tk_ComputeTextLayout --
*
- * Computes the amount of screen space needed to display a
- * multi-line, justified string of text. Records all the
- * measurements that were done to determine to size and
- * positioning of the individual lines of text; this information
- * can be used by the Tk_DrawTextLayout() procedure to
+ * Computes the amount of screen space needed to display a multi-line,
+ * justified string of text. Records all the measurements that were done
+ * to determine to size and positioning of the individual lines of text;
+ * this information can be used by the Tk_DrawTextLayout() function to
* display the text quickly (without remeasuring it).
*
- * This procedure is useful for simple widgets that want to
- * display single-font, multi-line text and want Tk to handle the
- * details.
+ * This function is useful for simple widgets that want to display
+ * single-font, multi-line text and want Tk to handle the details.
*
* Results:
- * The return value is a Tk_TextLayout token that holds the
- * measurement information for the given string. The token is
- * only valid for the given string. If the string is freed,
- * the token is no longer valid and must also be freed. To free
- * the token, call Tk_FreeTextLayout().
+ * The return value is a Tk_TextLayout token that holds the measurement
+ * information for the given string. The token is only valid for the
+ * given string. If the string is freed, the token is no longer valid and
+ * must also be freed. To free the token, call Tk_FreeTextLayout().
*
- * The dimensions of the screen area needed to display the text
- * are stored in *widthPtr and *heightPtr.
+ * The dimensions of the screen area needed to display the text are
+ * stored in *widthPtr and *heightPtr.
*
* Side effects:
- * Memory is allocated to hold the measurement information.
+ * Memory is allocated to hold the measurement information.
*
*---------------------------------------------------------------------------
*/
Tk_TextLayout
-Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
- widthPtr, heightPtr)
- Tk_Font tkfont; /* Font that will be used to display text. */
- CONST char *string; /* String whose dimensions are to be
+Tk_ComputeTextLayout(
+ Tk_Font tkfont, /* Font that will be used to display text. */
+ const char *string, /* String whose dimensions are to be
* computed. */
- int numChars; /* Number of characters to consider from
+ int numChars, /* Number of characters to consider from
* string, or < 0 for strlen(). */
- int wrapLength; /* Longest permissible line length, in
- * pixels. <= 0 means no automatic wrapping:
- * just let lines get as long as needed. */
- Tk_Justify justify; /* How to justify lines. */
- int flags; /* Flag bits OR-ed together.
- * TK_IGNORE_TABS means that tab characters
- * should not be expanded. TK_IGNORE_NEWLINES
- * means that newline characters should not
- * cause a line break. */
- int *widthPtr; /* Filled with width of string. */
- int *heightPtr; /* Filled with height of string. */
+ int wrapLength, /* Longest permissible line length, in pixels.
+ * <= 0 means no automatic wrapping: just let
+ * lines get as long as needed. */
+ Tk_Justify justify, /* How to justify lines. */
+ int flags, /* Flag bits OR-ed together. TK_IGNORE_TABS
+ * means that tab characters should not be
+ * expanded. TK_IGNORE_NEWLINES means that
+ * newline characters should not cause a line
+ * break. */
+ int *widthPtr, /* Filled with width of string. */
+ int *heightPtr) /* Filled with height of string. */
{
TkFont *fontPtr;
- CONST char *start, *end, *special;
- int n, y, bytesThisChunk, maxChunks;
- int baseline, height, curX, newX, maxWidth;
+ const char *start, *end, *special;
+ int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight;
+ int baseline, height, curX, newX, maxWidth, *lineLengths;
TextLayout *layoutPtr;
LayoutChunk *chunkPtr;
- CONST TkFontMetrics *fmPtr;
+ const TkFontMetrics *fmPtr;
Tcl_DString lineBuffer;
- int *lineLengths;
- int curLine, layoutHeight;
Tcl_DStringInit(&lineBuffer);
-
+
fontPtr = (TkFont *) tkfont;
if ((fontPtr == NULL) || (string == NULL)) {
if (widthPtr != NULL) {
@@ -1865,11 +1989,11 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
maxChunks = 1;
- layoutPtr = (TextLayout *) ckalloc(sizeof(TextLayout)
- + (maxChunks - 1) * sizeof(LayoutChunk));
- layoutPtr->tkfont = tkfont;
- layoutPtr->string = string;
- layoutPtr->numChunks = 0;
+ layoutPtr = (TextLayout *)
+ ckalloc(sizeof(TextLayout) + (maxChunks-1) * sizeof(LayoutChunk));
+ layoutPtr->tkfont = tkfont;
+ layoutPtr->string = string;
+ layoutPtr->numChunks = 0;
baseline = fmPtr->ascent;
maxWidth = 0;
@@ -1884,7 +2008,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
special = string;
flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES;
- flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE;
+ flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE;
for (start = string; start < end; ) {
if (start >= special) {
/*
@@ -1892,7 +2016,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
*
* INTL: Note that it is safe to increment by byte, because we are
* looking for 7-bit characters that will appear unchanged in
- * UTF-8. At some point we may need to support the full Unicode
+ * UTF-8. At some point we may need to support the full Unicode
* whitespace set.
*/
@@ -1912,7 +2036,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
/*
* Special points at the next special character (or the end of the
- * string). Process characters between start and special.
+ * string). Process characters between start and special.
*/
chunkPtr = NULL;
@@ -1924,7 +2048,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
if (bytesThisChunk > 0) {
chunkPtr = NewChunk(&layoutPtr, &maxChunks, start,
bytesThisChunk, curX, newX, baseline);
-
+
start += bytesThisChunk;
curX = newX;
}
@@ -1934,8 +2058,8 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
/*
* Handle the special character.
*
- * INTL: Special will be pointing at a 7-bit character so we
- * can safely treat it as a single byte.
+ * INTL: Special will be pointing at a 7-bit character so we can
+ * safely treat it as a single byte.
*/
chunkPtr = NULL;
@@ -1955,7 +2079,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
flags &= ~TK_AT_LEAST_ONE;
continue;
}
- } else {
+ } else {
NewChunk(&layoutPtr, &maxChunks, start, 1, curX, curX,
baseline)->numDisplayChars = -1;
start++;
@@ -1964,9 +2088,9 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
}
/*
- * No more characters are going to go on this line, either because
- * no more characters can fit or there are no more characters left.
- * Consume all extra spaces at end of line.
+ * No more characters are going to go on this line, either because no
+ * more characters can fit or there are no more characters left.
+ * Consume all extra spaces at end of line.
*/
while ((start < end) && isspace(UCHAR(*start))) { /* INTL: ISO space */
@@ -1983,12 +2107,12 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
start++;
}
if (chunkPtr != NULL) {
- CONST char *end;
+ const char *end;
/*
- * Append all the extra spaces on this line to the end of the
- * last text chunk. This is a little tricky because we are
- * switching back and forth between characters and bytes.
+ * Append all the extra spaces on this line to the end of the last
+ * text chunk. This is a little tricky because we are switching
+ * back and forth between characters and bytes.
*/
end = chunkPtr->start + chunkPtr->numBytes;
@@ -2002,7 +2126,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
}
}
- wrapLine:
+ wrapLine:
flags |= TK_AT_LEAST_ONE;
/*
@@ -2015,8 +2139,8 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
}
/*
- * Remember width of this line, so that all chunks on this line
- * can be centered or right justified, if necessary.
+ * Remember width of this line, so that all chunks on this line can be
+ * centered or right justified, if necessary.
*/
Tcl_DStringAppend(&lineBuffer, (char *) &curX, sizeof(curX));
@@ -2026,9 +2150,8 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
}
/*
- * If last line ends with a newline, then we need to make a 0 width
- * chunk on the next line. Otherwise "Hello" and "Hello\n" are the
- * same height.
+ * If last line ends with a newline, then we need to make a 0 width chunk
+ * on the next line. Otherwise "Hello" and "Hello\n" are the same height.
*/
if ((layoutPtr->numChunks > 0) && ((flags & TK_IGNORE_NEWLINES) == 0)) {
@@ -2039,7 +2162,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
Tcl_DStringAppend(&lineBuffer, (char *) &curX, sizeof(curX));
baseline += height;
}
- }
+ }
layoutPtr->width = maxWidth;
layoutHeight = baseline - fmPtr->ascent;
@@ -2047,9 +2170,9 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
layoutHeight = height;
/*
- * This fake chunk is used by the other procedures so that they can
- * pretend that there is a chunk with no chars in it, which makes
- * the coding simpler.
+ * This fake chunk is used by the other functions so that they can
+ * pretend that there is a chunk with no chars in it, which makes the
+ * coding simpler.
*/
layoutPtr->numChunks = 1;
@@ -2066,7 +2189,7 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
* Using maximum line length, shift all the chunks so that the lines
* are all justified correctly.
*/
-
+
curLine = 0;
chunkPtr = layoutPtr->chunks;
y = chunkPtr->y;
@@ -2104,8 +2227,8 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
*
* Tk_FreeTextLayout --
*
- * This procedure is called to release the storage associated with
- * a Tk_TextLayout when it is no longer needed.
+ * This function is called to release the storage associated with a
+ * Tk_TextLayout when it is no longer needed.
*
* Results:
* None.
@@ -2117,8 +2240,8 @@ Tk_ComputeTextLayout(tkfont, string, numChars, wrapLength, justify, flags,
*/
void
-Tk_FreeTextLayout(textLayout)
- Tk_TextLayout textLayout; /* The text layout to be released. */
+Tk_FreeTextLayout(
+ Tk_TextLayout textLayout) /* The text layout to be released. */
{
TextLayout *layoutPtr;
@@ -2136,9 +2259,8 @@ Tk_FreeTextLayout(textLayout)
* Use the information in the Tk_TextLayout token to display a
* multi-line, justified string of text.
*
- * This procedure is useful for simple widgets that need to
- * display single-font, multi-line text and want Tk to handle
- * the details.
+ * This function is useful for simple widgets that need to display
+ * single-font, multi-line text and want Tk to handle the details.
*
* Results:
* None.
@@ -2150,25 +2272,25 @@ Tk_FreeTextLayout(textLayout)
*/
void
-Tk_DrawTextLayout(display, drawable, gc, layout, x, y, firstChar, lastChar)
- Display *display; /* Display on which to draw. */
- Drawable drawable; /* Window or pixmap in which to draw. */
- GC gc; /* Graphics context to use for drawing text. */
- Tk_TextLayout layout; /* Layout information, from a previous call
- * to Tk_ComputeTextLayout(). */
- int x, y; /* Upper-left hand corner of rectangle in
+Tk_DrawTextLayout(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context to use for drawing text. */
+ Tk_TextLayout layout, /* Layout information, from a previous call to
+ * Tk_ComputeTextLayout(). */
+ int x, int y, /* Upper-left hand corner of rectangle in
* which to draw (pixels). */
- int firstChar; /* The index of the first character to draw
- * from the given text item. 0 specfies the
+ int firstChar, /* The index of the first character to draw
+ * from the given text item. 0 specfies the
* beginning. */
- int lastChar; /* The index just after the last character
- * to draw from the given text item. A number
- * < 0 means to draw all characters. */
+ int lastChar) /* The index just after the last character to
+ * draw from the given text item. A number < 0
+ * means to draw all characters. */
{
TextLayout *layoutPtr;
int i, numDisplayChars, drawX;
- CONST char *firstByte;
- CONST char *lastByte;
+ const char *firstByte;
+ const char *lastByte;
LayoutChunk *chunkPtr;
layoutPtr = (TextLayout *) layout;
@@ -2214,15 +2336,14 @@ Tk_DrawTextLayout(display, drawable, gc, layout, x, y, firstChar, lastChar)
*
* Tk_UnderlineTextLayout --
*
- * Use the information in the Tk_TextLayout token to display an
- * underline below an individual character. This procedure does
- * not draw the text, just the underline.
+ * Use the information in the Tk_TextLayout token to display an underline
+ * below an individual character. This function does not draw the text,
+ * just the underline.
*
- * This procedure is useful for simple widgets that need to
- * display single-font, multi-line text with an individual
- * character underlined and want Tk to handle the details.
- * To display larger amounts of underlined text, construct
- * and use an underlined font.
+ * This function is useful for simple widgets that need to display
+ * single-font, multi-line text with an individual character underlined
+ * and want Tk to handle the details. To display larger amounts of
+ * underlined text, construct and use an underlined font.
*
* Results:
* None.
@@ -2234,16 +2355,16 @@ Tk_DrawTextLayout(display, drawable, gc, layout, x, y, firstChar, lastChar)
*/
void
-Tk_UnderlineTextLayout(display, drawable, gc, layout, x, y, underline)
- Display *display; /* Display on which to draw. */
- Drawable drawable; /* Window or pixmap in which to draw. */
- GC gc; /* Graphics context to use for drawing text. */
- Tk_TextLayout layout; /* Layout information, from a previous call
- * to Tk_ComputeTextLayout(). */
- int x, y; /* Upper-left hand corner of rectangle in
+Tk_UnderlineTextLayout(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context to use for drawing text. */
+ Tk_TextLayout layout, /* Layout information, from a previous call to
+ * Tk_ComputeTextLayout(). */
+ int x, int y, /* Upper-left hand corner of rectangle in
* which to draw (pixels). */
- int underline; /* Index of the single character to
- * underline, or -1 for no underline. */
+ int underline) /* Index of the single character to underline,
+ * or -1 for no underline. */
{
TextLayout *layoutPtr;
TkFont *fontPtr;
@@ -2254,7 +2375,7 @@ Tk_UnderlineTextLayout(display, drawable, gc, layout, x, y, underline)
layoutPtr = (TextLayout *) layout;
fontPtr = (TkFont *) layoutPtr->tkfont;
- XFillRectangle(display, drawable, gc, x + xx,
+ XFillRectangle(display, drawable, gc, x + xx,
y + yy + fontPtr->fm.ascent + fontPtr->underlinePos,
(unsigned int) width, (unsigned int) fontPtr->underlineHeight);
}
@@ -2266,25 +2387,25 @@ Tk_UnderlineTextLayout(display, drawable, gc, layout, x, y, underline)
* Tk_PointToChar --
*
* Use the information in the Tk_TextLayout token to determine the
- * character closest to the given point. The point must be
- * specified with respect to the upper-left hand corner of the
- * text layout, which is considered to be located at (0, 0).
+ * character closest to the given point. The point must be specified with
+ * respect to the upper-left hand corner of the text layout, which is
+ * considered to be located at (0, 0).
*
- * Any point whose y-value is less that 0 will be considered closest
- * to the first character in the text layout; any point whose y-value
- * is greater than the height of the text layout will be considered
- * closest to the last character in the text layout.
+ * Any point whose y-value is less that 0 will be considered closest to
+ * the first character in the text layout; any point whose y-value is
+ * greater than the height of the text layout will be considered closest
+ * to the last character in the text layout.
*
- * Any point whose x-value is less than 0 will be considered closest
- * to the first character on that line; any point whose x-value is
- * greater than the width of the text layout will be considered
- * closest to the last character on that line.
+ * Any point whose x-value is less than 0 will be considered closest to
+ * the first character on that line; any point whose x-value is greater
+ * than the width of the text layout will be considered closest to the
+ * last character on that line.
*
* Results:
- * The return value is the index of the character that was
- * closest to the point. Given a text layout with no characters,
- * the value 0 will always be returned, referring to a hypothetical
- * zero-width placeholder character.
+ * The return value is the index of the character that was closest to the
+ * point. Given a text layout with no characters, the value 0 will always
+ * be returned, referring to a hypothetical zero-width placeholder
+ * character.
*
* Side effects:
* None.
@@ -2293,12 +2414,12 @@ Tk_UnderlineTextLayout(display, drawable, gc, layout, x, y, underline)
*/
int
-Tk_PointToChar(layout, x, y)
- Tk_TextLayout layout; /* Layout information, from a previous call
- * to Tk_ComputeTextLayout(). */
- int x, y; /* Coordinates of point to check, with
- * respect to the upper-left corner of the
- * text layout. */
+Tk_PointToChar(
+ Tk_TextLayout layout, /* Layout information, from a previous call to
+ * Tk_ComputeTextLayout(). */
+ int x, int y) /* Coordinates of point to check, with respect
+ * to the upper-left corner of the text
+ * layout. */
{
TextLayout *layoutPtr;
LayoutChunk *chunkPtr, *lastPtr;
@@ -2307,8 +2428,8 @@ Tk_PointToChar(layout, x, y)
if (y < 0) {
/*
- * Point lies above any line in this layout. Return the index of
- * the first char.
+ * Point lies above any line in this layout. Return the index of the
+ * first char.
*/
return 0;
@@ -2327,30 +2448,30 @@ Tk_PointToChar(layout, x, y)
if (y < baseline + fontPtr->fm.descent) {
if (x < chunkPtr->x) {
/*
- * Point is to the left of all chunks on this line. Return
- * the index of the first character on this line.
+ * Point is to the left of all chunks on this line. Return the
+ * index of the first character on this line.
*/
return numChars;
}
if (x >= layoutPtr->width) {
/*
- * If point lies off right side of the text layout, return
- * the last char in the last chunk on this line. Without
- * this, it might return the index of the first char that
- * was located outside of the text layout.
+ * If point lies off right side of the text layout, return the
+ * last char in the last chunk on this line. Without this, it
+ * might return the index of the first char that was located
+ * outside of the text layout.
*/
x = INT_MAX;
}
/*
- * Examine all chunks on this line to see which one contains
- * the specified point.
+ * Examine all chunks on this line to see which one contains the
+ * specified point.
*/
lastPtr = chunkPtr;
- while ((i < layoutPtr->numChunks) && (chunkPtr->y == baseline)) {
+ while ((i < layoutPtr->numChunks) && (chunkPtr->y == baseline)) {
if (x < chunkPtr->x + chunkPtr->totalWidth) {
/*
* Point falls on one of the characters in this chunk.
@@ -2377,7 +2498,7 @@ Tk_PointToChar(layout, x, y)
/*
* Point is to the right of all chars in all the chunks on this
- * line. Return the index just past the last char in the last
+ * line. Return the index just past the last char in the last
* chunk on this line.
*/
@@ -2393,8 +2514,8 @@ Tk_PointToChar(layout, x, y)
}
/*
- * Point lies below any line in this text layout. Return the index
- * just past the last char.
+ * Point lies below any line in this text layout. Return the index just
+ * past the last char.
*/
return (lastPtr->start + lastPtr->numChars) - layoutPtr->string;
@@ -2405,29 +2526,28 @@ Tk_PointToChar(layout, x, y)
*
* Tk_CharBbox --
*
- * Use the information in the Tk_TextLayout token to return the
- * bounding box for the character specified by index.
+ * Use the information in the Tk_TextLayout token to return the bounding
+ * box for the character specified by index.
*
- * The width of the bounding box is the advance width of the
- * character, and does not include and left- or right-bearing.
- * Any character that extends partially outside of the
- * text layout is considered to be truncated at the edge. Any
- * character which is located completely outside of the text
- * layout is considered to be zero-width and pegged against
- * the edge.
+ * The width of the bounding box is the advance width of the character,
+ * and does not include and left- or right-bearing. Any character that
+ * extends partially outside of the text layout is considered to be
+ * truncated at the edge. Any character which is located completely
+ * outside of the text layout is considered to be zero-width and pegged
+ * against the edge.
*
* The height of the bounding box is the line height for this font,
- * extending from the top of the ascent to the bottom of the
- * descent. Information about the actual height of the individual
- * letter is not available.
+ * extending from the top of the ascent to the bottom of the descent.
+ * Information about the actual height of the individual letter is not
+ * available.
+ *
+ * A text layout that contains no characters is considered to contain a
+ * single zero-width placeholder character.
*
- * A text layout that contains no characters is considered to
- * contain a single zero-width placeholder character.
- *
* Results:
- * The return value is 0 if the index did not specify a character
- * in the text layout, or non-zero otherwise. In that case,
- * *bbox is filled with the bounding box of the character.
+ * The return value is 0 if the index did not specify a character in the
+ * text layout, or non-zero otherwise. In that case, *bbox is filled with
+ * the bounding box of the character.
*
* Side effects:
* None.
@@ -2436,25 +2556,26 @@ Tk_PointToChar(layout, x, y)
*/
int
-Tk_CharBbox(layout, index, xPtr, yPtr, widthPtr, heightPtr)
- Tk_TextLayout layout; /* Layout information, from a previous call to
- * Tk_ComputeTextLayout(). */
- int index; /* The index of the character whose bbox is
- * desired. */
- int *xPtr, *yPtr; /* Filled with the upper-left hand corner, in
- * pixels, of the bounding box for the character
- * specified by index, if non-NULL. */
- int *widthPtr, *heightPtr;
- /* Filled with the width and height of the
- * bounding box for the character specified by
- * index, if non-NULL. */
+Tk_CharBbox(
+ Tk_TextLayout layout, /* Layout information, from a previous call to
+ * Tk_ComputeTextLayout(). */
+ int index, /* The index of the character whose bbox is
+ * desired. */
+ int *xPtr, int *yPtr, /* Filled with the upper-left hand corner, in
+ * pixels, of the bounding box for the
+ * character specified by index, if
+ * non-NULL. */
+ int *widthPtr, int *heightPtr)
+ /* Filled with the width and height of the
+ * bounding box for the character specified by
+ * index, if non-NULL. */
{
TextLayout *layoutPtr;
LayoutChunk *chunkPtr;
- int i, x, w;
+ int i, x = 0, w;
Tk_Font tkfont;
TkFont *fontPtr;
- CONST char *end;
+ const char *end;
if (index < 0) {
return 0;
@@ -2476,7 +2597,7 @@ Tk_CharBbox(layout, index, xPtr, yPtr, widthPtr, heightPtr)
end = Tcl_UtfAtIndex(chunkPtr->start, index);
if (xPtr != NULL) {
Tk_MeasureChars(tkfont, chunkPtr->start,
- end - chunkPtr->start, -1, 0, &x);
+ end - chunkPtr->start, -1, 0, &x);
x += chunkPtr->x;
}
if (widthPtr != NULL) {
@@ -2488,25 +2609,26 @@ Tk_CharBbox(layout, index, xPtr, yPtr, widthPtr, heightPtr)
index -= chunkPtr->numChars;
chunkPtr++;
}
- if (index == 0) {
- /*
- * Special case to get location just past last char in layout.
- */
-
- chunkPtr--;
- x = chunkPtr->x + chunkPtr->totalWidth;
- w = 0;
- } else {
+ if (index != 0) {
return 0;
}
/*
- * Ensure that the bbox lies within the text layout. This forces all
- * chars that extend off the right edge of the text layout to have
- * truncated widths, and all chars that are completely off the right
- * edge of the text layout to peg to the edge and have 0 width.
+ * Special case to get location just past last char in layout.
+ */
+
+ chunkPtr--;
+ x = chunkPtr->x + chunkPtr->totalWidth;
+ w = 0;
+
+ /*
+ * Ensure that the bbox lies within the text layout. This forces all chars
+ * that extend off the right edge of the text layout to have truncated
+ * widths, and all chars that are completely off the right edge of the
+ * text layout to peg to the edge and have 0 width.
*/
- check:
+
+ check:
if (yPtr != NULL) {
*yPtr = chunkPtr->y - fontPtr->fm.ascent;
}
@@ -2535,16 +2657,15 @@ Tk_CharBbox(layout, index, xPtr, yPtr, widthPtr, heightPtr)
*
* Tk_DistanceToTextLayout --
*
- * Computes the distance in pixels from the given point to the
- * given text layout. Non-displaying space characters that occur
- * at the end of individual lines in the text layout are ignored
- * for hit detection purposes.
+ * Computes the distance in pixels from the given point to the given text
+ * layout. Non-displaying space characters that occur at the end of
+ * individual lines in the text layout are ignored for hit detection
+ * purposes.
*
* Results:
- * The return value is 0 if the point (x, y) is inside the text
- * layout. If the point isn't inside the text layout then the
- * return value is the distance in pixels from the point to the
- * text item.
+ * The return value is 0 if the point (x, y) is inside the text layout.
+ * If the point isn't inside the text layout then the return value is the
+ * distance in pixels from the point to the text item.
*
* Side effects:
* None.
@@ -2553,12 +2674,12 @@ Tk_CharBbox(layout, index, xPtr, yPtr, widthPtr, heightPtr)
*/
int
-Tk_DistanceToTextLayout(layout, x, y)
- Tk_TextLayout layout; /* Layout information, from a previous call
+Tk_DistanceToTextLayout(
+ Tk_TextLayout layout, /* Layout information, from a previous call
* to Tk_ComputeTextLayout(). */
- int x, y; /* Coordinates of point to check, with
- * respect to the upper-left corner of the
- * text layout (in pixels). */
+ int x, int y) /* Coordinates of point to check, with respect
+ * to the upper-left corner of the text layout
+ * (in pixels). */
{
int i, x1, x2, y1, y2, xDiff, yDiff, dist, minDist, ascent, descent;
LayoutChunk *chunkPtr;
@@ -2569,14 +2690,14 @@ Tk_DistanceToTextLayout(layout, x, y)
fontPtr = (TkFont *) layoutPtr->tkfont;
ascent = fontPtr->fm.ascent;
descent = fontPtr->fm.descent;
-
+
minDist = 0;
chunkPtr = layoutPtr->chunks;
for (i = 0; i < layoutPtr->numChunks; i++) {
if (chunkPtr->start[0] == '\n') {
/*
- * Newline characters are not counted when computing distance
- * (but tab characters would still be considered).
+ * Newline characters are not counted when computing distance (but
+ * tab characters would still be considered).
*/
chunkPtr++;
@@ -2620,15 +2741,15 @@ Tk_DistanceToTextLayout(layout, x, y)
*
* Tk_IntersectTextLayout --
*
- * Determines whether a text layout lies entirely inside,
- * entirely outside, or overlaps a given rectangle. Non-displaying
- * space characters that occur at the end of individual lines in
- * the text layout are ignored for intersection calculations.
+ * Determines whether a text layout lies entirely inside, entirely
+ * outside, or overlaps a given rectangle. Non-displaying space
+ * characters that occur at the end of individual lines in the text
+ * layout are ignored for intersection calculations.
*
* Results:
- * The return value is -1 if the text layout is entirely outside of
- * the rectangle, 0 if it overlaps, and 1 if it is entirely inside
- * of the rectangle.
+ * The return value is -1 if the text layout is entirely outside of the
+ * rectangle, 0 if it overlaps, and 1 if it is entirely inside of the
+ * rectangle.
*
* Side effects:
* None.
@@ -2637,15 +2758,15 @@ Tk_DistanceToTextLayout(layout, x, y)
*/
int
-Tk_IntersectTextLayout(layout, x, y, width, height)
- Tk_TextLayout layout; /* Layout information, from a previous call
- * to Tk_ComputeTextLayout(). */
- int x, y; /* Upper-left hand corner, in pixels, of
+Tk_IntersectTextLayout(
+ Tk_TextLayout layout, /* Layout information, from a previous call to
+ * Tk_ComputeTextLayout(). */
+ int x, int y, /* Upper-left hand corner, in pixels, of
* rectangular area to compare with text
- * layout. Coordinates are with respect to
- * the upper-left hand corner of the text
- * layout itself. */
- int width, height; /* The width and height of the above
+ * layout. Coordinates are with respect to the
+ * upper-left hand corner of the text layout
+ * itself. */
+ int width, int height) /* The width and height of the above
* rectangular area, in pixels. */
{
int result, i, x1, y1, x2, y2;
@@ -2656,19 +2777,19 @@ Tk_IntersectTextLayout(layout, x, y, width, height)
/*
* Scan the chunks one at a time, seeing whether each is entirely in,
- * entirely out, or overlapping the rectangle. If an overlap is
- * detected, return immediately; otherwise wait until all chunks have
- * been processed and see if they were all inside or all outside.
+ * entirely out, or overlapping the rectangle. If an overlap is detected,
+ * return immediately; otherwise wait until all chunks have been processed
+ * and see if they were all inside or all outside.
*/
-
+
layoutPtr = (TextLayout *) layout;
chunkPtr = layoutPtr->chunks;
fontPtr = (TkFont *) layoutPtr->tkfont;
- left = x;
- top = y;
- right = x + width;
- bottom = y + height;
+ left = x;
+ top = y;
+ right = x + width;
+ bottom = y + height;
result = 0;
for (i = 0; i < layoutPtr->numChunks; i++) {
@@ -2711,34 +2832,32 @@ Tk_IntersectTextLayout(layout, x, y, width, height)
*
* Tk_TextLayoutToPostscript --
*
- * Outputs the contents of a text layout in Postscript format.
- * The set of lines in the text layout will be rendered by the user
- * supplied Postscript function. The function should be of the form:
+ * Outputs the contents of a text layout in Postscript format. The set of
+ * lines in the text layout will be rendered by the user supplied
+ * Postscript function. The function should be of the form:
*
- * justify x y string function --
+ * justify x y string function --
*
* Justify is -1, 0, or 1, depending on whether the following string
- * should be left, center, or right justified, x and y is the
- * location for the origin of the string, string is the sequence
- * of characters to be printed, and function is the name of the
- * caller-provided function; the function should leave nothing
- * on the stack.
- *
- * The meaning of the origin of the string (x and y) depends on
- * the justification. For left justification, x is where the
- * left edge of the string should appear. For center justification,
- * x is where the center of the string should appear. And for right
- * justification, x is where the right edge of the string should
- * appear. This behavior is necessary because, for example, right
- * justified text on the screen is justified with screen metrics.
- * The same string needs to be justified with printer metrics on
- * the printer to appear in the correct place with respect to other
- * similarly justified strings. In all circumstances, y is the
- * location of the baseline for the string.
+ * should be left, center, or right justified, x and y is the location
+ * for the origin of the string, string is the sequence of characters to
+ * be printed, and function is the name of the caller-provided function;
+ * the function should leave nothing on the stack.
+ *
+ * The meaning of the origin of the string (x and y) depends on the
+ * justification. For left justification, x is where the left edge of the
+ * string should appear. For center justification, x is where the center
+ * of the string should appear. And for right justification, x is where
+ * the right edge of the string should appear. This behavior is necessary
+ * because, for example, right justified text on the screen is justified
+ * with screen metrics. The same string needs to be justified with
+ * printer metrics on the printer to appear in the correct place with
+ * respect to other similarly justified strings. In all circumstances, y
+ * is the location of the baseline for the string.
*
* Results:
- * The interp's result is modified to hold the Postscript code that
- * will render the text layout.
+ * The interp's result is modified to hold the Postscript code that will
+ * render the text layout.
*
* Side effects:
* None.
@@ -2747,20 +2866,17 @@ Tk_IntersectTextLayout(layout, x, y, width, height)
*/
void
-Tk_TextLayoutToPostscript(interp, layout)
- Tcl_Interp *interp; /* Filled with Postscript code. */
- Tk_TextLayout layout; /* The layout to be rendered. */
+Tk_TextLayoutToPostscript(
+ Tcl_Interp *interp, /* Filled with Postscript code. */
+ Tk_TextLayout layout) /* The layout to be rendered. */
{
#define MAXUSE 128
- char buf[MAXUSE+30];
+ char buf[MAXUSE+30], uindex[5] = "\0\0\0\0", one_char[5];
LayoutChunk *chunkPtr;
- int i, j, used, c, baseline;
+ int i, j, used, c, baseline, charsize;
Tcl_UniChar ch;
- CONST char *p, *last_p,*glyphname;
+ const char *p, *last_p, *glyphname;
TextLayout *layoutPtr;
- char uindex[5]="\0\0\0\0";
- char one_char[5];
- int charsize;
int bytecount=0;
layoutPtr = (TextLayout *) layout;
@@ -2787,23 +2903,24 @@ Tk_TextLayoutToPostscript(interp, layout)
p = chunkPtr->start;
for (j = 0; j < chunkPtr->numDisplayChars; j++) {
/*
- * INTL: For now we just treat the characters as binary
- * data and display the lower byte. Eventually this should
- * be revised to handle international postscript fonts.
+ * INTL: For now we just treat the characters as binary data
+ * and display the lower byte. Eventually this should be
+ * revised to handle international postscript fonts.
*/
- last_p=p;
- p +=(charsize= Tcl_UtfToUniChar(p,&ch));
- Tcl_UtfToExternal(interp,NULL,last_p,charsize,0,NULL,one_char,4,
- NULL,&bytecount,NULL);
- if (bytecount == 1) {
+
+ last_p = p;
+ p += (charsize = Tcl_UtfToUniChar(p,&ch));
+ Tcl_UtfToExternal(interp, NULL, last_p, charsize, 0, NULL,
+ one_char, 4, NULL, &bytecount, NULL);
+ if (bytecount == 1) {
c = UCHAR(one_char[0]);
/* c = UCHAR( ch & 0xFF) */;
if ((c == '(') || (c == ')') || (c == '\\') || (c < 0x20)
|| (c >= UCHAR(0x7f))) {
/*
- * Tricky point: the "03" is necessary in the sprintf
+ * Tricky point: the "03" is necessary in the sprintf
* below, so that a full three digits of octal are
- * always generated. Without the "03", a number
+ * always generated. Without the "03", a number
* following this sequence could be interpreted by
* Postscript as part of this sequence.
*/
@@ -2814,36 +2931,42 @@ Tk_TextLayoutToPostscript(interp, layout)
buf[used++] = c;
}
} else {
- /* This character doesn't belong to system character set.
- * So, we must use full glyph name */
- sprintf(uindex,"%04X",ch); /* endianness? */
- if ((glyphname = Tcl_GetVar2( interp , "::tk::psglyphs",uindex,0))) {
- if (used > 0 && buf [used-1] == '(')
+ /*
+ * This character doesn't belong to system character set.
+ * So, we must use full glyph name.
+ */
+
+ sprintf(uindex, "%04X", ch); /* endianness? */
+ glyphname = Tcl_GetVar2(interp,"::tk::psglyphs",uindex,0);
+ if (glyphname) {
+ if (used > 0 && buf [used-1] == '(') {
--used;
- else
+ } else {
buf[used++] = ')';
+ }
buf[used++] = '/';
- while( (*glyphname) && (used < (MAXUSE+27)))
+ while ((*glyphname) && (used < (MAXUSE+27))) {
buf[used++] = *glyphname++ ;
+ }
buf[used++] = '(';
}
-
+
}
if (used >= MAXUSE) {
buf[used] = '\0';
- Tcl_AppendResult(interp, buf, (char *) NULL);
+ Tcl_AppendResult(interp, buf, NULL);
used = 0;
}
}
}
if (used >= MAXUSE) {
/*
- * If there are a whole bunch of returns or tabs in a row,
- * then buf[] could get filled up.
+ * If there are a whole bunch of returns or tabs in a row, then
+ * buf[] could get filled up.
*/
-
+
buf[used] = '\0';
- Tcl_AppendResult(interp, buf, (char *) NULL);
+ Tcl_AppendResult(interp, buf, NULL);
used = 0;
}
chunkPtr++;
@@ -2852,7 +2975,7 @@ Tk_TextLayoutToPostscript(interp, layout)
buf[used++] = ']';
buf[used++] = '\n';
buf[used] = '\0';
- Tcl_AppendResult(interp, buf, (char *) NULL);
+ Tcl_AppendResult(interp, buf, NULL);
}
/*
@@ -2864,33 +2987,32 @@ Tk_TextLayoutToPostscript(interp, layout)
* initialized font attributes structure.
*
* Results:
- * A standard Tcl return value. If TCL_ERROR is returned, an
- * error message will be left in interp's result object (if non-NULL).
+ * A standard Tcl return value. If TCL_ERROR is returned, an error
+ * message will be left in interp's result object.
*
* Side effects:
* The fields of the font attributes structure get filled in with
- * information from argc/argv. If an error occurs while parsing,
- * the font attributes structure will contain all modifications
- * specified in the command line options up to the point of the
- * error.
+ * information from argc/argv. If an error occurs while parsing, the font
+ * attributes structure will contain all modifications specified in the
+ * command line options up to the point of the error.
*
*---------------------------------------------------------------------------
*/
static int
-ConfigAttributesObj(interp, tkwin, objc, objv, faPtr)
- Tcl_Interp *interp; /* Interp for error return, or NULL. */
- Tk_Window tkwin; /* For display on which font will be used. */
- int objc; /* Number of elements in argv. */
- Tcl_Obj *CONST objv[]; /* Command line options. */
- TkFontAttributes *faPtr; /* Font attributes structure whose fields
- * are to be modified. Structure must already
- * be properly initialized. */
+ConfigAttributesObj(
+ Tcl_Interp *interp, /* Interp for error return. */
+ Tk_Window tkwin, /* For display on which font will be used. */
+ int objc, /* Number of elements in argv. */
+ Tcl_Obj *const objv[], /* Command line options. */
+ TkFontAttributes *faPtr) /* Font attributes structure whose fields are
+ * to be modified. Structure must already be
+ * properly initialized. */
{
int i, n, index;
Tcl_Obj *optionPtr, *valuePtr;
char *value;
-
+
for (i = 0; i < objc; i += 2) {
optionPtr = objv[i];
valuePtr = objv[i + 1];
@@ -2901,63 +3023,55 @@ ConfigAttributesObj(interp, tkwin, objc, objv, faPtr)
}
if ((i+2 >= objc) && (objc & 1)) {
/*
- * This test occurs after Tcl_GetIndexFromObj() so that
- * "font create xyz -xyz" will return the error message
- * that "-xyz" is a bad option, rather than that the value
- * for "-xyz" is missing.
+ * This test occurs after Tcl_GetIndexFromObj() so that "font
+ * create xyz -xyz" will return the error message that "-xyz" is a
+ * bad option, rather than that the value for "-xyz" is missing.
*/
if (interp != NULL) {
Tcl_AppendResult(interp, "value for \"",
- Tcl_GetString(optionPtr), "\" option missing",
- (char *) NULL);
+ Tcl_GetString(optionPtr), "\" option missing", NULL);
}
return TCL_ERROR;
}
switch (index) {
- case FONT_FAMILY: {
- value = Tcl_GetString(valuePtr);
- faPtr->family = Tk_GetUid(value);
- break;
- }
- case FONT_SIZE: {
- if (Tcl_GetIntFromObj(interp, valuePtr, &n) != TCL_OK) {
- return TCL_ERROR;
- }
- faPtr->size = n;
- break;
+ case FONT_FAMILY:
+ value = Tcl_GetString(valuePtr);
+ faPtr->family = Tk_GetUid(value);
+ break;
+ case FONT_SIZE:
+ if (Tcl_GetIntFromObj(interp, valuePtr, &n) != TCL_OK) {
+ return TCL_ERROR;
}
- case FONT_WEIGHT: {
- n = TkFindStateNumObj(interp, optionPtr, weightMap, valuePtr);
- if (n == TK_FW_UNKNOWN) {
- return TCL_ERROR;
- }
- faPtr->weight = n;
- break;
+ faPtr->size = n;
+ break;
+ case FONT_WEIGHT:
+ n = TkFindStateNumObj(interp, optionPtr, weightMap, valuePtr);
+ if (n == TK_FW_UNKNOWN) {
+ return TCL_ERROR;
}
- case FONT_SLANT: {
- n = TkFindStateNumObj(interp, optionPtr, slantMap, valuePtr);
- if (n == TK_FS_UNKNOWN) {
- return TCL_ERROR;
- }
- faPtr->slant = n;
- break;
+ faPtr->weight = n;
+ break;
+ case FONT_SLANT:
+ n = TkFindStateNumObj(interp, optionPtr, slantMap, valuePtr);
+ if (n == TK_FS_UNKNOWN) {
+ return TCL_ERROR;
}
- case FONT_UNDERLINE: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &n) != TCL_OK) {
- return TCL_ERROR;
- }
- faPtr->underline = n;
- break;
+ faPtr->slant = n;
+ break;
+ case FONT_UNDERLINE:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &n) != TCL_OK) {
+ return TCL_ERROR;
}
- case FONT_OVERSTRIKE: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &n) != TCL_OK) {
- return TCL_ERROR;
- }
- faPtr->overstrike = n;
- break;
+ faPtr->underline = n;
+ break;
+ case FONT_OVERSTRIKE:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &n) != TCL_OK) {
+ return TCL_ERROR;
}
+ faPtr->overstrike = n;
+ break;
}
}
return TCL_OK;
@@ -2971,14 +3085,13 @@ ConfigAttributesObj(interp, tkwin, objc, objv, faPtr)
* Return information about the font attributes as a Tcl list.
*
* Results:
- * The return value is TCL_OK if the objPtr was non-NULL and
- * specified a valid font attribute, TCL_ERROR otherwise. If TCL_OK
- * is returned, the interp's result object is modified to hold a
- * description of either the current value of a single option, or a
- * list of all options and their current values for the given font
- * attributes. If TCL_ERROR is returned, the interp's result is
- * set to an error message describing that the objPtr did not refer
- * to a valid option.
+ * The return value is TCL_OK if the objPtr was non-NULL and specified a
+ * valid font attribute, TCL_ERROR otherwise. If TCL_OK is returned, the
+ * interp's result object is modified to hold a description of either the
+ * current value of a single option, or a list of all options and their
+ * current values for the given font attributes. If TCL_ERROR is
+ * returned, the interp's result is set to an error message describing
+ * that the objPtr did not refer to a valid option.
*
* Side effects:
* None.
@@ -2987,16 +3100,16 @@ ConfigAttributesObj(interp, tkwin, objc, objv, faPtr)
*/
static int
-GetAttributeInfoObj(interp, faPtr, objPtr)
- Tcl_Interp *interp; /* Interp to hold result. */
- CONST TkFontAttributes *faPtr; /* The font attributes to inspect. */
- Tcl_Obj *objPtr; /* If non-NULL, indicates the single
- * option whose value is to be
- * returned. Otherwise information is
- * returned for all options. */
+GetAttributeInfoObj(
+ Tcl_Interp *interp, /* Interp to hold result. */
+ const TkFontAttributes *faPtr,
+ /* The font attributes to inspect. */
+ Tcl_Obj *objPtr) /* If non-NULL, indicates the single option
+ * whose value is to be returned. Otherwise
+ * information is returned for all options. */
{
int i, index, start, end;
- CONST char *str;
+ const char *str;
Tcl_Obj *optionPtr, *valuePtr, *resultPtr;
resultPtr = Tcl_GetObjResult(interp);
@@ -3015,32 +3128,32 @@ GetAttributeInfoObj(interp, faPtr, objPtr)
valuePtr = NULL;
for (i = start; i < end; i++) {
switch (i) {
- case FONT_FAMILY:
- str = faPtr->family;
- valuePtr = Tcl_NewStringObj(str, ((str == NULL) ? 0 : -1));
- break;
+ case FONT_FAMILY:
+ str = faPtr->family;
+ valuePtr = Tcl_NewStringObj(str, ((str == NULL) ? 0 : -1));
+ break;
- case FONT_SIZE:
- valuePtr = Tcl_NewIntObj(faPtr->size);
- break;
+ case FONT_SIZE:
+ valuePtr = Tcl_NewIntObj(faPtr->size);
+ break;
- case FONT_WEIGHT:
- str = TkFindStateString(weightMap, faPtr->weight);
- valuePtr = Tcl_NewStringObj(str, -1);
- break;
-
- case FONT_SLANT:
- str = TkFindStateString(slantMap, faPtr->slant);
- valuePtr = Tcl_NewStringObj(str, -1);
- break;
+ case FONT_WEIGHT:
+ str = TkFindStateString(weightMap, faPtr->weight);
+ valuePtr = Tcl_NewStringObj(str, -1);
+ break;
- case FONT_UNDERLINE:
- valuePtr = Tcl_NewBooleanObj(faPtr->underline);
- break;
+ case FONT_SLANT:
+ str = TkFindStateString(slantMap, faPtr->slant);
+ valuePtr = Tcl_NewStringObj(str, -1);
+ break;
- case FONT_OVERSTRIKE:
- valuePtr = Tcl_NewBooleanObj(faPtr->overstrike);
- break;
+ case FONT_UNDERLINE:
+ valuePtr = Tcl_NewBooleanObj(faPtr->underline);
+ break;
+
+ case FONT_OVERSTRIKE:
+ valuePtr = Tcl_NewBooleanObj(faPtr->overstrike);
+ break;
}
if (objPtr != NULL) {
Tcl_SetObjResult(interp, valuePtr);
@@ -3058,8 +3171,8 @@ GetAttributeInfoObj(interp, faPtr, objPtr)
*
* ParseFontNameObj --
*
- * Converts a object into a set of font attributes that can be used
- * to construct a font.
+ * Converts a object into a set of font attributes that can be used to
+ * construct a font.
*
* The string rep of the object can be one of the following forms:
* XLFD (see X documentation)
@@ -3067,10 +3180,10 @@ GetAttributeInfoObj(interp, faPtr, objPtr)
* "-option value [-option value ...]"
*
* Results:
- * The return value is TCL_ERROR if the object was syntactically
- * invalid. In that case an error message is left in interp's
- * result object. Otherwise, fills the font attribute buffer with
- * the values parsed from the string and returns TCL_OK;
+ * The return value is TCL_ERROR if the object was syntactically invalid.
+ * In that case an error message is left in interp's result object.
+ * Otherwise, fills the font attribute buffer with the values parsed from
+ * the string and returns TCL_OK;
*
* Side effects:
* None.
@@ -3079,13 +3192,12 @@ GetAttributeInfoObj(interp, faPtr, objPtr)
*/
static int
-ParseFontNameObj(interp, tkwin, objPtr, faPtr)
- Tcl_Interp *interp; /* Interp for error return, or NULL if no
- * error messages are to be generated. */
- Tk_Window tkwin; /* For display on which font is used. */
- Tcl_Obj *objPtr; /* Parseable font description object. */
- TkFontAttributes *faPtr; /* Filled with attributes parsed from font
- * name. Any attributes that were not
+ParseFontNameObj(
+ Tcl_Interp *interp, /* Interp for error return. */
+ Tk_Window tkwin, /* For display on which font is used. */
+ Tcl_Obj *objPtr, /* Parseable font description object. */
+ TkFontAttributes *faPtr) /* Filled with attributes parsed from font
+ * name. Any attributes that were not
* specified in font name are filled with
* default values. */
{
@@ -3093,7 +3205,7 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr)
int objc, result, i, n;
Tcl_Obj **objv;
char *string;
-
+
TkInitFontAttributes(faPtr);
string = Tcl_GetString(objPtr);
@@ -3102,7 +3214,7 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr)
* This may be an XLFD or an "-option value" string.
*
* If the string begins with "-*" or a "-foundry-family-*" pattern,
- * then consider it an XLFD.
+ * then consider it an XLFD.
*/
if (string[1] == '*') {
@@ -3120,13 +3232,13 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr)
return ConfigAttributesObj(interp, tkwin, objc, objv, faPtr);
}
-
+
if (*string == '*') {
/*
- * This is appears to be an XLFD. Under Unix, all valid XLFDs were
- * already handled by TkpGetNativeFont. If we are here, either we
- * have something that initially looks like an XLFD but isn't or we
- * have encountered an XLFD on Windows or Mac.
+ * This is appears to be an XLFD. Under Unix, all valid XLFDs were
+ * already handled by TkpGetNativeFont. If we are here, either we have
+ * something that initially looks like an XLFD but isn't or we have
+ * encountered an XLFD on Windows or Mac.
*/
xlfd:
@@ -3134,18 +3246,32 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr)
if (result == TCL_OK) {
return TCL_OK;
}
+
+ /*
+ * If the string failed to parse but was considered to be a XLFD
+ * then it may be a "-option value" string with a hyphenated family
+ * name as per bug 2791352
+ */
+
+ if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (ConfigAttributesObj(interp, tkwin, objc, objv, faPtr) == TCL_OK) {
+ return TCL_OK;
+ }
}
/*
- * Wasn't an XLFD or "-option value" string. Try it as a
- * "font size style" list.
+ * Wasn't an XLFD or "-option value" string. Try it as a "font size style"
+ * list.
*/
if ((Tcl_ListObjGetElements(NULL, objPtr, &objc, &objv) != TCL_OK)
|| (objc < 1)) {
if (interp != NULL) {
Tcl_AppendResult(interp, "font \"", string, "\" doesn't exist",
- (char *) NULL);
+ NULL);
}
return TCL_ERROR;
}
@@ -3193,7 +3319,7 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr)
if (interp != NULL) {
Tcl_AppendResult(interp, "unknown font style \"",
- Tcl_GetString(objv[i]), "\"", (char *) NULL);
+ Tcl_GetString(objv[i]), "\"", NULL);
}
return TCL_ERROR;
}
@@ -3205,9 +3331,8 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr)
*
* NewChunk --
*
- * Helper function for Tk_ComputeTextLayout(). Encapsulates a
- * measured set of characters in a chunk that can be quickly
- * drawn.
+ * Helper function for Tk_ComputeTextLayout(). Encapsulates a measured
+ * set of characters in a chunk that can be quickly drawn.
*
* Results:
* A pointer to the new chunk in the text layout.
@@ -3215,28 +3340,28 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr)
* Side effects:
* The text layout is reallocated to hold more chunks as necessary.
*
- * Currently, Tk_ComputeTextLayout() stores contiguous ranges of
- * "normal" characters in a chunk, along with individual tab
- * and newline chars in their own chunks. All characters in the
- * text layout are accounted for.
+ * Currently, Tk_ComputeTextLayout() stores contiguous ranges of "normal"
+ * characters in a chunk, along with individual tab and newline chars in
+ * their own chunks. All characters in the text layout are accounted for.
*
*---------------------------------------------------------------------------
*/
+
static LayoutChunk *
-NewChunk(layoutPtrPtr, maxPtr, start, numBytes, curX, newX, y)
- TextLayout **layoutPtrPtr;
- int *maxPtr;
- CONST char *start;
- int numBytes;
- int curX;
- int newX;
- int y;
+NewChunk(
+ TextLayout **layoutPtrPtr,
+ int *maxPtr,
+ const char *start,
+ int numBytes,
+ int curX,
+ int newX,
+ int y)
{
TextLayout *layoutPtr;
LayoutChunk *chunkPtr;
int maxChunks, numChars;
size_t s;
-
+
layoutPtr = *layoutPtrPtr;
maxChunks = *maxPtr;
if (layoutPtr->numChunks == maxChunks) {
@@ -3271,8 +3396,8 @@ NewChunk(layoutPtrPtr, maxPtr, start, numBytes, curX, newX, y)
*
* Results:
* Return value is TCL_ERROR if string was not a fully specified XLFD.
- * Otherwise, fills font attribute buffer with the values parsed
- * from the XLFD and returns TCL_OK.
+ * Otherwise, fills font attribute buffer with the values parsed from the
+ * XLFD and returns TCL_OK.
*
* Side effects:
* None.
@@ -3281,25 +3406,25 @@ NewChunk(layoutPtrPtr, maxPtr, start, numBytes, curX, newX, y)
*/
int
-TkFontParseXLFD(string, faPtr, xaPtr)
- CONST char *string; /* Parseable font description string. */
- TkFontAttributes *faPtr; /* Filled with attributes parsed from font
- * name. Any attributes that were not
+TkFontParseXLFD(
+ const char *string, /* Parseable font description string. */
+ TkFontAttributes *faPtr, /* Filled with attributes parsed from font
+ * name. Any attributes that were not
* specified in font name are filled with
* default values. */
- TkXLFDAttributes *xaPtr; /* Filled with X-specific attributes parsed
- * from font name. Any attributes that were
+ TkXLFDAttributes *xaPtr) /* Filled with X-specific attributes parsed
+ * from font name. Any attributes that were
* not specified in font name are filled with
- * default values. May be NULL if such
+ * default values. May be NULL if such
* information is not desired. */
{
char *src;
- CONST char *str;
+ const char *str;
int i, j;
char *field[XLFD_NUMFIELDS + 2];
Tcl_DString ds;
TkXLFDAttributes xa;
-
+
if (xaPtr == NULL) {
xaPtr = &xa;
}
@@ -3338,13 +3463,13 @@ TkFontParseXLFD(string, faPtr, xaPtr)
/*
* An XLFD of the form -adobe-times-medium-r-*-12-*-* is pretty common,
- * but it is (strictly) malformed, because the first * is eliding both
- * the Setwidth and the Addstyle fields. If the Addstyle field is a
- * number, then assume the above incorrect form was used and shift all
- * the rest of the fields right by one, so the number gets interpreted
- * as a pixelsize. This fix is so that we don't get a million reports
- * that "it works under X (as a native font name), but gives a syntax
- * error under Windows (as a parsed set of attributes)".
+ * but it is (strictly) malformed, because the first * is eliding both the
+ * Setwidth and the Addstyle fields. If the Addstyle field is a number,
+ * then assume the above incorrect form was used and shift all the rest of
+ * the fields right by one, so the number gets interpreted as a pixelsize.
+ * This fix is so that we don't get a million reports that "it works under
+ * X (as a native font name), but gives a syntax error under Windows (as a
+ * parsed set of attributes)".
*/
if ((i > XLFD_ADD_STYLE) && (FieldSpecified(field[XLFD_ADD_STYLE]))) {
@@ -3394,8 +3519,8 @@ TkFontParseXLFD(string, faPtr, xaPtr)
/* XLFD_ADD_STYLE ignored. */
/*
- * Pointsize in tenths of a point, but treat it as tenths of a pixel
- * for historical compatibility.
+ * Pointsize in tenths of a point, but treat it as tenths of a pixel for
+ * historical compatibility.
*/
faPtr->size = 12;
@@ -3422,7 +3547,7 @@ TkFontParseXLFD(string, faPtr, xaPtr)
}
/*
- * Pixel height of font. If specified, overrides pointsize.
+ * Pixel height of font. If specified, overrides pointsize.
*/
if (FieldSpecified(field[XLFD_PIXEL_SIZE])) {
@@ -3432,9 +3557,9 @@ TkFontParseXLFD(string, faPtr, xaPtr)
*
* [ N1 N2 N3 N4 ]
*
- * where N1 is the pixel size, and where N2, N3, and N4
- * are some additional numbers that I don't know
- * the purpose of, so I ignore them.
+ * where N1 is the pixel size, and where N2, N3, and N4 are some
+ * additional numbers that I don't know the purpose of, so I
+ * ignore them.
*/
faPtr->size = atoi(field[XLFD_PIXEL_SIZE] + 1);
@@ -3468,12 +3593,12 @@ TkFontParseXLFD(string, faPtr, xaPtr)
*
* FieldSpecified --
*
- * Helper function for TkParseXLFD(). Determines if a field in the
- * XLFD was set to a non-null, non-don't-care value.
+ * Helper function for TkParseXLFD(). Determines if a field in the XLFD
+ * was set to a non-null, non-don't-care value.
*
* Results:
- * The return value is 0 if the field in the XLFD was not set and
- * should be ignored, non-zero otherwise.
+ * The return value is 0 if the field in the XLFD was not set and should
+ * be ignored, non-zero otherwise.
*
* Side effects:
* None.
@@ -3482,11 +3607,12 @@ TkFontParseXLFD(string, faPtr, xaPtr)
*/
static int
-FieldSpecified(field)
- CONST char *field; /* The field of the XLFD to check. Strictly
- * speaking, only when the string is "*" does it mean
- * don't-care. However, an unspecified or question
- * mark is also interpreted as don't-care. */
+FieldSpecified(
+ const char *field) /* The field of the XLFD to check. Strictly
+ * speaking, only when the string is "*" does
+ * it mean don't-care. However, an unspecified
+ * or question mark is also interpreted as
+ * don't-care. */
{
char ch;
@@ -3513,11 +3639,11 @@ FieldSpecified(field)
*
*---------------------------------------------------------------------------
*/
-
+
int
-TkFontGetPixels(tkwin, size)
- Tk_Window tkwin; /* For point->pixel conversion factor. */
- int size; /* Font size. */
+TkFontGetPixels(
+ Tk_Window tkwin, /* For point->pixel conversion factor. */
+ int size) /* Font size. */
{
double d;
@@ -3547,11 +3673,11 @@ TkFontGetPixels(tkwin, size)
*
*---------------------------------------------------------------------------
*/
-
+
int
-TkFontGetPoints(tkwin, size)
- Tk_Window tkwin; /* For pixel->point conversion factor. */
- int size; /* Font size. */
+TkFontGetPoints(
+ Tk_Window tkwin, /* For pixel->point conversion factor. */
+ int size) /* Font size. */
{
double d;
@@ -3570,24 +3696,24 @@ TkFontGetPoints(tkwin, size)
*
* TkFontGetAliasList --
*
- * Given a font name, find the list of all aliases for that font
- * name. One of the names in this list will probably be the name
- * that this platform expects when asking for the font.
+ * Given a font name, find the list of all aliases for that font name.
+ * One of the names in this list will probably be the name that this
+ * platform expects when asking for the font.
*
* Results:
- * As above. The return value is NULL if the font name has no
- * aliases.
+
+ * As above. The return value is NULL if the font name has no aliases.
*
* Side effects:
* None.
*
*-------------------------------------------------------------------------
*/
-
+
char **
-TkFontGetAliasList(faceName)
- CONST char *faceName; /* Font name to test for aliases. */
-{
+TkFontGetAliasList(
+ const char *faceName) /* Font name to test for aliases. */
+{
int i, j;
for (i = 0; fontAliases[i] != NULL; i++) {
@@ -3605,9 +3731,8 @@ TkFontGetAliasList(faceName)
*
* TkFontGetFallbacks --
*
- * Get the list of font fallbacks that the platform-specific code
- * can use to try to find the closest matching font the name
- * requested.
+ * Get the list of font fallbacks that the platform-specific code can use
+ * to try to find the closest matching font the name requested.
*
* Results:
* As above.
@@ -3617,9 +3742,9 @@ TkFontGetAliasList(faceName)
*
*-------------------------------------------------------------------------
*/
-
+
char ***
-TkFontGetFallbacks()
+TkFontGetFallbacks(void)
{
return fontFallbacks;
}
@@ -3642,9 +3767,9 @@ TkFontGetFallbacks()
*
*-------------------------------------------------------------------------
*/
-
+
char **
-TkFontGetGlobalClass()
+TkFontGetGlobalClass(void)
{
return globalFontClass;
}
@@ -3654,8 +3779,8 @@ TkFontGetGlobalClass()
*
* TkFontGetSymbolClass --
*
- * Get the list of fonts that are symbolic; used if the operating
- * system cannot apriori identify symbolic fonts on its own.
+ * Get the list of fonts that are symbolic; used if the operating system
+ * cannot apriori identify symbolic fonts on its own.
*
* Results:
* As above.
@@ -3665,9 +3790,9 @@ TkFontGetGlobalClass()
*
*-------------------------------------------------------------------------
*/
-
+
char **
-TkFontGetSymbolClass()
+TkFontGetSymbolClass(void)
{
return symbolClass;
}
@@ -3677,13 +3802,12 @@ TkFontGetSymbolClass()
*
* TkDebugFont --
*
- * This procedure returns debugging information about a font.
+ * This function returns debugging information about a font.
*
* Results:
* The return value is a list with one sublist for each TkFont
- * corresponding to "name". Each sublist has two elements that
- * contain the resourceRefCount and objRefCount fields from the
- * TkFont structure.
+ * corresponding to "name". Each sublist has two elements that contain
+ * the resourceRefCount and objRefCount fields from the TkFont structure.
*
* Side effects:
* None.
@@ -3692,10 +3816,10 @@ TkFontGetSymbolClass()
*/
Tcl_Obj *
-TkDebugFont(tkwin, name)
- Tk_Window tkwin; /* The window in which the font will be
- * used (not currently used). */
- char *name; /* Name of the desired color. */
+TkDebugFont(
+ Tk_Window tkwin, /* The window in which the font will be used
+ * (not currently used). */
+ char *name) /* Name of the desired color. */
{
TkFont *fontPtr;
Tcl_HashEntry *hashPtr;
@@ -3707,14 +3831,14 @@ TkDebugFont(tkwin, name)
if (hashPtr != NULL) {
fontPtr = (TkFont *) Tcl_GetHashValue(hashPtr);
if (fontPtr == NULL) {
- panic("TkDebugFont found empty hash table entry");
+ Tcl_Panic("TkDebugFont found empty hash table entry");
}
for ( ; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) {
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(fontPtr->resourceRefCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(fontPtr->objRefCount));
+ Tcl_NewIntObj(fontPtr->objRefCount));
Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
}
}
@@ -3726,13 +3850,13 @@ TkDebugFont(tkwin, name)
*
* TkFontGetFirstTextLayout --
*
- * This procedure returns the first chunk of a Tk_TextLayout,
- * i.e. until the first font change on the first line (or the
- * whole first line if there is no such font change).
+ * This function returns the first chunk of a Tk_TextLayout, i.e. until
+ * the first font change on the first line (or the whole first line if
+ * there is no such font change).
*
* Results:
- * The return value is the byte length of the chunk, the chunk
- * itself is copied into dst and its Tk_Font into font.
+ * The return value is the byte length of the chunk, the chunk itself is
+ * copied into dst and its Tk_Font into font.
*
* Side effects:
* None.
@@ -3742,21 +3866,20 @@ TkDebugFont(tkwin, name)
int
TkFontGetFirstTextLayout(
- Tk_TextLayout layout, /* Layout information, from a previous call
- * to Tk_ComputeTextLayout(). */
- Tk_Font * font,
- char * dst)
+ Tk_TextLayout layout, /* Layout information, from a previous call to
+ * Tk_ComputeTextLayout(). */
+ Tk_Font *font,
+ char *dst)
{
- TextLayout *layoutPtr;
+ TextLayout *layoutPtr;
LayoutChunk *chunkPtr;
int numBytesInChunk;
layoutPtr = (TextLayout *)layout;
- if ((layoutPtr==NULL)
- || (layoutPtr->numChunks==0)
- || (layoutPtr->chunks->numDisplayChars <= 0)) {
- dst[0] = '\0';
- return 0;
+ if ((layoutPtr==NULL) || (layoutPtr->numChunks==0)
+ || (layoutPtr->chunks->numDisplayChars <= 0)) {
+ dst[0] = '\0';
+ return 0;
}
chunkPtr = layoutPtr->chunks;
numBytesInChunk = chunkPtr->numBytes;
@@ -3764,3 +3887,11 @@ TkFontGetFirstTextLayout(
*font = layoutPtr->tkfont;
return numBytesInChunk;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkFont.h b/generic/tkFont.h
index 71c598c..ef6336c 100644
--- a/generic/tkFont.h
+++ b/generic/tkFont.h
@@ -1,40 +1,40 @@
/*
* tkFont.h --
*
- * Declarations for interfaces between the generic and platform-
- * specific parts of the font package. This information is not
- * visible outside of the font package.
+ * Declarations for interfaces between the generic and platform-specific
+ * parts of the font package. This information is not visible outside of
+ * the font package.
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKFONT
#define _TKFONT
#ifdef BUILD_tk
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLEXPORT
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
#endif
/*
- * The following structure keeps track of the attributes of a font. It can
- * be used to keep track of either the desired attributes or the actual
+ * The following structure keeps track of the attributes of a font. It can be
+ * used to keep track of either the desired attributes or the actual
* attributes gotten when the font was instantiated.
*/
-typedef struct TkFontAttributes {
- Tk_Uid family; /* Font family, or NULL to represent
- * plaform-specific default system font. */
+struct TkFontAttributes {
+ Tk_Uid family; /* Font family, or NULL to represent plaform-
+ * specific default system font. */
int size; /* Pointsize of font, 0 for default size, or
* negative number meaning pixel size. */
int weight; /* Weight flag; see below for def'n. */
int slant; /* Slant flag; see below for def'n. */
int underline; /* Non-zero for underline font. */
int overstrike; /* Non-zero for overstrike font. */
-} TkFontAttributes;
+};
/*
* Possible values for the "weight" field in a TkFontAttributes structure.
@@ -45,7 +45,7 @@ typedef struct TkFontAttributes {
#define TK_FW_NORMAL 0
#define TK_FW_BOLD 1
-#define TK_FW_UNKNOWN -1 /* Unknown weight. This value is used for
+#define TK_FW_UNKNOWN -1 /* Unknown weight. This value is used for
* error checking and is never actually stored
* in the weight field. */
@@ -53,21 +53,21 @@ typedef struct TkFontAttributes {
* Possible values for the "slant" field in a TkFontAttributes structure.
*/
-#define TK_FS_ROMAN 0
+#define TK_FS_ROMAN 0
#define TK_FS_ITALIC 1
-#define TK_FS_OBLIQUE 2 /* This value is only used when parsing X
- * font names to determine the closest
- * match. It is only stored in the
- * XLFDAttributes structure, never in the
- * slant field of the TkFontAttributes. */
+#define TK_FS_OBLIQUE 2 /* This value is only used when parsing X font
+ * names to determine the closest match. It is
+ * only stored in the XLFDAttributes
+ * structure, never in the slant field of the
+ * TkFontAttributes. */
-#define TK_FS_UNKNOWN -1 /* Unknown slant. This value is used for
- * error checking and is never actually stored
- * in the slant field. */
+#define TK_FS_UNKNOWN -1 /* Unknown slant. This value is used for error
+ * checking and is never actually stored in
+ * the slant field. */
/*
* The following structure keeps track of the metrics for an instantiated
- * font. The metrics are the physical properties of the font itself.
+ * font. The metrics are the physical properties of the font itself.
*/
typedef struct TkFontMetrics {
@@ -80,9 +80,9 @@ typedef struct TkFontMetrics {
/*
* The following structure is used to keep track of the generic information
- * about a font. Each platform-specific font is represented by a structure
- * with the following structure at its beginning, plus any platform-
- * specific stuff after that.
+ * about a font. Each platform-specific font is represented by a structure
+ * with the following structure at its beginning, plus any platform-specific
+ * stuff after that.
*/
typedef struct TkFont {
@@ -92,14 +92,14 @@ typedef struct TkFont {
int resourceRefCount; /* Number of active uses of this font (each
* active use corresponds to a call to
- * Tk_AllocFontFromTable or Tk_GetFont).
- * If this count is 0, then this TkFont
- * structure is no longer valid and it isn't
- * present in a hash table: it is being
- * kept around only because there are objects
- * referring to it. The structure is freed
- * when resourceRefCount and objRefCount
- * are both 0. */
+ * Tk_AllocFontFromTable or Tk_GetFont). If
+ * this count is 0, then this TkFont structure
+ * is no longer valid and it isn't present in
+ * a hash table: it is being kept around only
+ * because there are objects referring to it.
+ * The structure is freed when
+ * resourceRefCount and objRefCount are both
+ * 0. */
int objRefCount; /* The number of Tcl objects that reference
* this structure. */
Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
@@ -110,9 +110,9 @@ typedef struct TkFont {
* was not based on a named font. */
Screen *screen; /* The screen where this font is valid. */
int tabWidth; /* Width of tabs in this font (pixels). */
- int underlinePos; /* Offset from baseline to origin of
- * underline bar (used for drawing underlines
- * on a non-underlined font). */
+ int underlinePos; /* Offset from baseline to origin of underline
+ * bar (used for drawing underlines on a
+ * non-underlined font). */
int underlineHeight; /* Height of underline bar (used for drawing
* underlines on a non-underlined font). */
@@ -122,33 +122,33 @@ typedef struct TkFont {
*/
Font fid; /* For backwards compatibility with XGCValues
- * structures. Remove when TkGCValues is
- * implemented. */
+ * structures. Remove when TkGCValues is
+ * implemented. */
TkFontAttributes fa; /* Actual font attributes obtained when the
* the font was created, as opposed to the
* desired attributes passed in to
- * TkpGetFontFromAttributes(). The desired
+ * TkpGetFontFromAttributes(). The desired
* metrics can be determined from the string
* that was used to create this font. */
TkFontMetrics fm; /* Font metrics determined when font was
* created. */
struct TkFont *nextPtr; /* Points to the next TkFont structure with
- * the same name. All fonts with the
- * same name (but different displays) are
- * chained together off a single entry in
- * a hash table. */
+ * the same name. All fonts with the same name
+ * (but different displays) are chained
+ * together off a single entry in a hash
+ * table. */
} TkFont;
/*
- * The following structure is used to return attributes when parsing an
- * XLFD. The extra information is of interest to the Unix-specific code
- * when attempting to find the closest matching font.
+ * The following structure is used to return attributes when parsing an XLFD.
+ * The extra information is of interest to the Unix-specific code when
+ * attempting to find the closest matching font.
*/
typedef struct TkXLFDAttributes {
Tk_Uid foundry; /* The foundry of the font. */
- int slant; /* The tristate value for the slant, which
- * is significant under X. */
+ int slant; /* The tristate value for the slant, which is
+ * significant under X. */
int setwidth; /* The proportionate width, see below for
* definition. */
Tk_Uid charset; /* The actual charset string. */
@@ -163,8 +163,8 @@ typedef struct TkXLFDAttributes {
#define TK_SW_NORMAL 0
#define TK_SW_CONDENSE 1
#define TK_SW_EXPAND 2
-#define TK_SW_UNKNOWN 3 /* Unknown setwidth. This value may be
- * stored in the setwidth field. */
+#define TK_SW_UNKNOWN 3 /* Unknown setwidth. This value may be stored
+ * in the setwidth field. */
/*
* The following defines specify the meaning of the fields in a fully
@@ -193,34 +193,34 @@ typedef struct TkXLFDAttributes {
#define TkInitFontAttributes(fa) memset((fa), 0, sizeof(TkFontAttributes));
#define TkInitXLFDAttributes(xa) memset((xa), 0, sizeof(TkXLFDAttributes));
-EXTERN int TkFontParseXLFD _ANSI_ARGS_((CONST char *string,
- TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr));
-EXTERN char ** TkFontGetAliasList _ANSI_ARGS_((CONST char *faceName));
-EXTERN char *** TkFontGetFallbacks _ANSI_ARGS_((void));
-EXTERN int TkFontGetPixels _ANSI_ARGS_((Tk_Window tkwin,
- int size));
-EXTERN int TkFontGetPoints _ANSI_ARGS_((Tk_Window tkwin,
- int size));
-EXTERN char ** TkFontGetGlobalClass _ANSI_ARGS_((void));
-EXTERN char ** TkFontGetSymbolClass _ANSI_ARGS_((void));
-EXTERN int TkFontGetFirstTextLayout _ANSI_ARGS_((
- Tk_TextLayout layout, Tk_Font *font, char *dst));
+MODULE_SCOPE int TkFontParseXLFD(CONST char *string,
+ TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr);
+MODULE_SCOPE char ** TkFontGetAliasList(CONST char *faceName);
+MODULE_SCOPE char *** TkFontGetFallbacks(void);
+MODULE_SCOPE int TkFontGetPixels(Tk_Window tkwin, int size);
+MODULE_SCOPE int TkFontGetPoints(Tk_Window tkwin, int size);
+MODULE_SCOPE char ** TkFontGetGlobalClass(void);
+MODULE_SCOPE char ** TkFontGetSymbolClass(void);
+MODULE_SCOPE int TkCreateNamedFont(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *name, TkFontAttributes *faPtr);
+MODULE_SCOPE int TkDeleteNamedFont(Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *name);
+MODULE_SCOPE int TkFontGetFirstTextLayout(Tk_TextLayout layout,
+ Tk_Font *font, char *dst);
/*
- * Low-level API exported by platform-specific code to generic code.
+ * Low-level API exported by platform-specific code to generic code.
*/
-EXTERN void TkpDeleteFont _ANSI_ARGS_((TkFont *tkFontPtr));
-EXTERN void TkpFontPkgInit _ANSI_ARGS_((TkMainInfo *mainPtr));
-EXTERN TkFont * TkpGetFontFromAttributes _ANSI_ARGS_((
- TkFont *tkFontPtr, Tk_Window tkwin,
- CONST TkFontAttributes *faPtr));
-EXTERN void TkpGetFontFamilies _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin));
-EXTERN TkFont * TkpGetNativeFont _ANSI_ARGS_((Tk_Window tkwin,
- CONST char *name));
-
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLIMPORT
+MODULE_SCOPE void TkpDeleteFont(TkFont *tkFontPtr);
+MODULE_SCOPE void TkpFontPkgInit(TkMainInfo *mainPtr);
+MODULE_SCOPE TkFont * TkpGetFontFromAttributes(TkFont *tkFontPtr,
+ Tk_Window tkwin, CONST TkFontAttributes *faPtr);
+MODULE_SCOPE void TkpGetFontFamilies(Tcl_Interp *interp,
+ Tk_Window tkwin);
+MODULE_SCOPE TkFont * TkpGetNativeFont(Tk_Window tkwin, CONST char *name);
+
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLIMPORT
#endif /* _TKFONT */
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 453ad73..8662dd3 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -1,20 +1,18 @@
-/*
+/*
* tkFrame.c --
*
* This module implements "frame", "labelframe" and "toplevel" widgets
- * for the Tk toolkit. Frames are windows with a background color
- * and possibly a 3-D effect, but not much else in the way of
- * attributes.
+ * for the Tk toolkit. Frames are windows with a background color and
+ * possibly a 3-D effect, but not much else in the way of attributes.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "default.h"
-#include "tkPort.h"
#include "tkInt.h"
/*
@@ -31,29 +29,29 @@ enum FrameType {
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the frame. NULL
- * means that the window has been destroyed
- * but the data structures haven't yet been
- * cleaned up. */
- Display *display; /* Display containing widget. Used, among
+ Tk_Window tkwin; /* Window that embodies the frame. NULL means
+ * that the window has been destroyed but the
+ * data structures haven't yet been cleaned
+ * up. */
+ Display *display; /* Display containing widget. Used, among
* other things, so that resources can be
* freed even after tkwin has gone away. */
- Tcl_Interp *interp; /* Interpreter associated with widget. Used
- * to delete widget command. */
+ Tcl_Interp *interp; /* Interpreter associated with widget. Used to
+ * delete widget command. */
Tcl_Command widgetCmd; /* Token for frame's widget command. */
Tk_OptionTable optionTable; /* Table that defines configuration options
* available for this widget. */
char *className; /* Class name for widget (from configuration
- * option). Malloc-ed. */
+ * option). Malloc-ed. */
enum FrameType type; /* Type of widget, such as TYPE_FRAME. */
- char *screenName; /* Screen on which widget is created. Non-null
- * only for top-levels. Malloc-ed, may be
+ char *screenName; /* Screen on which widget is created. Non-null
+ * only for top-levels. Malloc-ed, may be
* NULL. */
char *visualName; /* Textual description of visual for window,
- * from -visual option. Malloc-ed, may be
+ * from -visual option. Malloc-ed, may be
* NULL. */
char *colormapName; /* Textual description of colormap for window,
- * from -colormap option. Malloc-ed, may be
+ * from -colormap option. Malloc-ed, may be
* NULL. */
char *menuName; /* Textual description of menu to use for
* menubar. Malloc-ed, may be NULL. */
@@ -61,32 +59,32 @@ typedef struct {
* allocated for this window, which must be
* freed when the window is deleted. */
Tk_3DBorder border; /* Structure used to draw 3-D border and
- * background. NULL means no background
- * or border. */
+ * background. NULL means no background or
+ * border. */
int borderWidth; /* Width of 3-D border (if any). */
int relief; /* 3-d effect: TK_RELIEF_RAISED etc. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * 0 means don't draw a highlight. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. 0 means don't
+ * draw a highlight. */
XColor *highlightBgColorPtr;
- /* Color for drawing traversal highlight
- * area when highlight is off. */
+ /* Color for drawing traversal highlight area
+ * when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
- int width; /* Width to request for window. <= 0 means
+ int width; /* Width to request for window. <= 0 means
* don't request any size. */
- int height; /* Height to request for window. <= 0 means
+ int height; /* Height to request for window. <= 0 means
* don't request any size. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
- char *takeFocus; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
+ char *takeFocus; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
int isContainer; /* 1 means this window is a container, 0 means
* that it isn't. */
char *useThis; /* If the window is embedded, this points to
* the name of the window in which it is
- * embedded (malloc'ed). For non-embedded
+ * embedded (malloc'ed). For non-embedded
* windows this is NULL. */
- int flags; /* Various flags; see below for
+ int flags; /* Various flags; see below for
* definitions. */
Tcl_Obj *padXPtr; /* Value of -padx option: specifies how many
* pixels of extra space to leave on left and
@@ -99,46 +97,41 @@ typedef struct {
} Frame;
/*
- * A data structure of the following type is kept for each labelframe
- * widget managed by this file:
+ * A data structure of the following type is kept for each labelframe widget
+ * managed by this file:
*/
typedef struct {
Frame frame; /* A pointer to the generic frame structure.
* This must be the first element of the
* Labelframe. */
-
/*
* Labelframe specific configuration settings.
*/
-
Tcl_Obj *textPtr; /* Value of -text option: specifies text to
* display in button. */
- Tk_Font tkfont; /* Value of -font option: specifies font
- * to use for display text. */
+ Tk_Font tkfont; /* Value of -font option: specifies font to
+ * use for display text. */
XColor *textColorPtr; /* Value of -fg option: specifies foreground
* color in normal mode. */
int labelAnchor; /* Value of -labelanchor option: specifies
* where to place the label. */
- Tk_Window labelWin; /* Value of -labelwidget option: Window to
- * use as label for the frame. */
-
+ Tk_Window labelWin; /* Value of -labelwidget option: Window to use
+ * as label for the frame. */
/*
* Labelframe specific fields for use with configuration settings above.
*/
-
GC textGC; /* GC for drawing text in normal mode. */
Tk_TextLayout textLayout; /* Stored text layout information. */
XRectangle labelBox; /* The label's actual size and position. */
int labelReqWidth; /* The label's requested width. */
int labelReqHeight; /* The label's requested height. */
int labelTextX, labelTextY; /* Position of the text to be drawn. */
-
} Labelframe;
/*
- * The following macros define how many extra pixels to leave
- * around a label's text.
+ * The following macros define how many extra pixels to leave around a label's
+ * text.
*/
#define LABELSPACING 1
@@ -147,20 +140,19 @@ typedef struct {
/*
* Flag bits for frames:
*
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler
- * has already been queued to redraw
- * this window.
- * GOT_FOCUS: Non-zero means this widget currently
- * has the input focus.
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
+ * already been queued to redraw this window.
+ * GOT_FOCUS: Non-zero means this widget currently has the
+ * input focus.
*/
#define REDRAW_PENDING 1
#define GOT_FOCUS 4
/*
- * The following enum is used to define a type for the -labelanchor option
- * of the Labelframe widget. These values are used as indices into the
- * string table below.
+ * The following enum is used to define a type for the -labelanchor option of
+ * the Labelframe widget. These values are used as indices into the string
+ * table below.
*/
enum labelanchor {
@@ -172,32 +164,34 @@ enum labelanchor {
static char *labelAnchorStrings[] = {
"e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws",
- (char *) NULL
+ NULL
};
/*
- * Information used for parsing configuration options. There are
- * one common table used by all and one table for each widget class.
+ * Information used for parsing configuration options. There are one common
+ * table used by all and one table for each widget class.
*/
-static Tk_OptionSpec commonOptSpec[] = {
+static const Tk_OptionSpec commonOptSpec[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_FRAME_BG_COLOR, -1, Tk_Offset(Frame, border),
TK_OPTION_NULL_OK, (ClientData) DEF_FRAME_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_STRING, "-colormap", "colormap", "Colormap",
DEF_FRAME_COLORMAP, -1, Tk_Offset(Frame, colormapName),
TK_OPTION_NULL_OK, 0, 0},
+ /*
+ * Having -container is useless in a labelframe since a container has
+ * no border. It should be deprecated.
+ */
{TK_OPTION_BOOLEAN, "-container", "container", "Container",
- DEF_FRAME_CONTAINER, -1, Tk_Offset(Frame, isContainer),
- 0, 0, 0},
+ DEF_FRAME_CONTAINER, -1, Tk_Offset(Frame, isContainer), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_FRAME_CURSOR, -1, Tk_Offset(Frame, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", "height", "Height",
- DEF_FRAME_HEIGHT, -1, Tk_Offset(Frame, height),
- 0, 0, 0},
+ DEF_FRAME_HEIGHT, -1, Tk_Offset(Frame, height), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_FRAME_HIGHLIGHT_BG, -1,
Tk_Offset(Frame, highlightBgColorPtr), 0, 0, 0},
@@ -220,82 +214,71 @@ static Tk_OptionSpec commonOptSpec[] = {
DEF_FRAME_VISUAL, -1, Tk_Offset(Frame, visualName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width),
- 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, 0, 0, 0}
+ DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width), 0, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
-static Tk_OptionSpec frameOptSpec[] = {
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+static const Tk_OptionSpec frameOptSpec[] = {
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth),
- 0, 0, 0},
+ DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-class", "class", "Class",
- DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className),
- 0, 0, 0},
+ DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief),
- 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
+ DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL,
+ NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
};
-static Tk_OptionSpec toplevelOptSpec[] = {
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+static const Tk_OptionSpec toplevelOptSpec[] = {
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth),
- 0, 0, 0},
+ DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-class", "class", "Class",
- DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className),
- 0, 0, 0},
+ DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
{TK_OPTION_STRING, "-menu", "menu", "Menu",
DEF_TOPLEVEL_MENU, -1, Tk_Offset(Frame, menuName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief),
- 0, 0, 0},
+ DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
{TK_OPTION_STRING, "-screen", "screen", "Screen",
DEF_TOPLEVEL_SCREEN, -1, Tk_Offset(Frame, screenName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-use", "use", "Use",
DEF_TOPLEVEL_USE, -1, Tk_Offset(Frame, useThis),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
+ {TK_OPTION_END, NULL, NULL, NULL,
+ NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
};
-static Tk_OptionSpec labelframeOptSpec[] = {
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+static const Tk_OptionSpec labelframeOptSpec[] = {
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_LABELFRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth),
- 0, 0, 0},
- {TK_OPTION_STRING, "-class", "class", "Class",
- DEF_LABELFRAME_CLASS, -1, Tk_Offset(Frame, className),
0, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_STRING, "-class", "class", "Class",
+ DEF_LABELFRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_LABELFRAME_FONT, -1, Tk_Offset(Labelframe, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
DEF_LABELFRAME_FG, -1, Tk_Offset(Labelframe, textColorPtr), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-labelanchor", "labelAnchor", "LabelAnchor",
DEF_LABELFRAME_LABELANCHOR, -1, Tk_Offset(Labelframe, labelAnchor),
- 0, (ClientData) labelAnchorStrings, 0},
+ 0, (ClientData) labelAnchorStrings, 0},
{TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget",
- (char *) NULL, -1, Tk_Offset(Labelframe, labelWin),
- TK_OPTION_NULL_OK, 0, 0},
+ NULL, -1, Tk_Offset(Labelframe, labelWin), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_LABELFRAME_RELIEF, -1, Tk_Offset(Frame, relief),
- 0, 0, 0},
+ DEF_LABELFRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
DEF_LABELFRAME_TEXT, Tk_Offset(Labelframe, textPtr), -1,
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
+ {TK_OPTION_END, NULL, NULL, NULL,
+ NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
};
/*
@@ -305,48 +288,47 @@ static Tk_OptionSpec labelframeOptSpec[] = {
static char *classNames[] = {"Frame", "Toplevel", "Labelframe"};
/*
- * The following table maps from FrameType to the option template for
- * that class of widgets.
+ * The following table maps from FrameType to the option template for that
+ * class of widgets.
*/
-static Tk_OptionSpec *optionSpecs[] = {
+static const Tk_OptionSpec * const optionSpecs[] = {
frameOptSpec,
toplevelOptSpec,
labelframeOptSpec,
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void ComputeFrameGeometry _ANSI_ARGS_((Frame *framePtr));
-static int ConfigureFrame _ANSI_ARGS_((Tcl_Interp *interp,
- Frame *framePtr, int objc, Tcl_Obj *CONST objv[]));
-static int CreateFrame _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST argv[],
- enum FrameType type, char *appName));
-static void DestroyFrame _ANSI_ARGS_((char *memPtr));
-static void DestroyFramePartly _ANSI_ARGS_((Frame *framePtr));
-static void DisplayFrame _ANSI_ARGS_((ClientData clientData));
-static void FrameCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void FrameEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void FrameLostSlaveProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin));
-static void FrameRequestProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void FrameStructureProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static int FrameWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static void FrameWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static void MapFrame _ANSI_ARGS_((ClientData clientData));
+static void ComputeFrameGeometry(Frame *framePtr);
+static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr,
+ int objc, Tcl_Obj *CONST objv[]);
+static int CreateFrame(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST argv[],
+ enum FrameType type, char *appName);
+static void DestroyFrame(char *memPtr);
+static void DestroyFramePartly(Frame *framePtr);
+static void DisplayFrame(ClientData clientData);
+static void FrameCmdDeletedProc(ClientData clientData);
+static void FrameEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void FrameLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
+static void FrameRequestProc(ClientData clientData,
+ Tk_Window tkwin);
+static void FrameStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static int FrameWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void FrameWorldChanged(ClientData instanceData);
+static void MapFrame(ClientData clientData);
/*
- * The structure below defines frame class behavior by means of procedures
- * that can be invoked from generic window code.
+ * The structure below defines frame class behavior by means of functions that
+ * can be invoked from generic window code.
*/
static Tk_ClassProcs frameClass = {
@@ -355,67 +337,63 @@ static Tk_ClassProcs frameClass = {
};
/*
- * The structure below defines the official type record for the
- * labelframe's geometry manager:
+ * The structure below defines the official type record for the labelframe's
+ * geometry manager:
*/
-static Tk_GeomMgr frameGeomType = {
- "labelframe", /* name */
- FrameRequestProc, /* requestProc */
- FrameLostSlaveProc /* lostSlaveProc */
+static const Tk_GeomMgr frameGeomType = {
+ "labelframe", /* name */
+ FrameRequestProc, /* requestProc */
+ FrameLostSlaveProc /* lostSlaveProc */
};
-
/*
*--------------------------------------------------------------
*
* Tk_FrameObjCmd, Tk_ToplevelObjCmd, Tk_LabelframeObjCmd --
*
- * These procedures are invoked to process the "frame",
- * "toplevel" and "labelframe" Tcl commands. See the user
- * documentation for details on what they do.
+ * These functions are invoked to process the "frame", "toplevel" and
+ * "labelframe" Tcl commands. See the user documentation for details on
+ * what they do.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * See the user documentation. These procedures are just wrappers;
- * they call CreateFrame to do all of the real work.
+ * See the user documentation. These functions are just wrappers; they
+ * call CreateFrame to do all of the real work.
*
*--------------------------------------------------------------
*/
int
-Tk_FrameObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_FrameObjCmd(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- return CreateFrame(clientData, interp, objc, objv, TYPE_FRAME,
- (char *) NULL);
+ return CreateFrame(clientData, interp, objc, objv, TYPE_FRAME, NULL);
}
int
-Tk_ToplevelObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_ToplevelObjCmd(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- return CreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL,
- (char *) NULL);
+ return CreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, NULL);
}
int
-Tk_LabelframeObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_LabelframeObjCmd(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- return CreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME,
- (char *) NULL);
+ return CreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, NULL);
}
/*
@@ -423,10 +401,10 @@ Tk_LabelframeObjCmd(clientData, interp, objc, objv)
*
* TkCreateFrame --
*
- * This procedure is the old command procedure for the "frame"
- * and "toplevel" commands. Now it is used directly by Tk_Init to
- * create a new main window. See the user documentation for the
- * "frame" and "toplevel" commands for details on what it does.
+ * This function is the old command function for the "frame" and
+ * "toplevel" commands. Now it is used directly by Tk_Init to create a
+ * new main window. See the user documentation for the "frame" and
+ * "toplevel" commands for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -438,20 +416,21 @@ Tk_LabelframeObjCmd(clientData, interp, objc, objv)
*/
int
-TkCreateFrame(clientData, interp, argc, argv, toplevel, appName)
- ClientData clientData; /* Either NULL or pointer to option table. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
- int toplevel; /* Non-zero means create a toplevel window,
+TkCreateFrame(
+ ClientData clientData, /* Either NULL or pointer to option table. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ char **argv, /* Argument strings. */
+ int toplevel, /* Non-zero means create a toplevel window,
* zero means create a frame. */
- char *appName; /* Should only be non-NULL if there is no main
+ char *appName) /* Should only be non-NULL if there is no main
* window associated with the interpreter.
- * Gives the base name to use for the
- * new application. */
+ * Gives the base name to use for the new
+ * application. */
{
int result, i;
Tcl_Obj **objv = (Tcl_Obj **) ckalloc((argc+1) * sizeof(Tcl_Obj **));
+
for (i=0; i<argc; i++) {
objv[i] = Tcl_NewStringObj(argv[i], -1);
Tcl_IncrRefCount(objv[i]);
@@ -467,23 +446,23 @@ TkCreateFrame(clientData, interp, argc, argv, toplevel, appName)
}
static int
-CreateFrame(clientData, interp, objc, objv, type, appName)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
- enum FrameType type; /* What widget type to create. */
- char *appName; /* Should only be non-NULL if there are no
- * Main window associated with the interpreter.
- * Gives the base name to use for the
- * new application. */
+CreateFrame(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ enum FrameType type, /* What widget type to create. */
+ char *appName) /* Should only be non-NULL if there are no
+ * Main window associated with the
+ * interpreter. Gives the base name to use for
+ * the new application. */
{
Tk_Window tkwin;
Frame *framePtr;
Tk_OptionTable optionTable;
- Tk_Window new;
+ Tk_Window newWin;
CONST char *className, *screenName, *visualName, *colormapName, *arg, *useOption;
- int i, c, depth, length;
+ int i, c, length, depth;
unsigned int mask;
Colormap colormap;
Visual *visual;
@@ -494,17 +473,17 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
}
/*
- * Create the option table for this widget class. If it has already
- * been created, the cached pointer will be returned.
+ * Create the option table for this widget class. If it has already been
+ * created, the cached pointer will be returned.
*/
optionTable = Tk_CreateOptionTable(interp, optionSpecs[type]);
/*
- * Pre-process the argument list. Scan through it to find any
- * "-class", "-screen", "-visual", and "-colormap" options. These
- * arguments need to be processed specially, before the window
- * is configured using the usual Tk mechanisms.
+ * Pre-process the argument list. Scan through it to find any "-class",
+ * "-screen", "-visual", and "-colormap" options. These arguments need to
+ * be processed specially, before the window is configured using the usual
+ * Tk mechanisms.
*/
className = colormapName = screenName = visualName = useOption = NULL;
@@ -515,8 +494,8 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
continue;
}
c = arg[1];
- if ((c == 'c') && (strncmp(arg, "-class", (unsigned) length) == 0)
- && (length >= 3)) {
+ if ((c == 'c') && (length >= 3)
+ && (strncmp(arg, "-class", (unsigned) length) == 0)) {
className = Tcl_GetString(objv[i+1]);
} else if ((c == 'c')
&& (strncmp(arg, "-colormap", (unsigned) length) == 0)) {
@@ -534,18 +513,17 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
}
/*
- * Create the window, and deal with the special options -use,
- * -classname, -colormap, -screenname, and -visual. These options
- * must be handle before calling ConfigureFrame below, and they must
- * also be processed in a particular order, for the following
- * reasons:
- * 1. Must set the window's class before calling ConfigureFrame,
- * so that unspecified options are looked up in the option
- * database using the correct class.
- * 2. Must set visual information before calling ConfigureFrame
- * so that colors are allocated in a proper colormap.
+ * Create the window, and deal with the special options -use, -classname,
+ * -colormap, -screenname, and -visual. These options must be handle
+ * before calling ConfigureFrame below, and they must also be processed in
+ * a particular order, for the following reasons:
+ * 1. Must set the window's class before calling ConfigureFrame, so that
+ * unspecified options are looked up in the option database using the
+ * correct class.
+ * 2. Must set visual information before calling ConfigureFrame so that
+ * colors are allocated in a proper colormap.
* 3. Must call TkpUseWindow before setting non-default visual
- * information, since TkpUseWindow changes the defaults.
+ * information, since TkpUseWindow changes the defaults.
*/
if (screenName == NULL) {
@@ -553,88 +531,93 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
}
/*
- * Main window associated with interpreter.
- * If we're called by Tk_Init to create a
- * new application, then this is NULL.
+ * Main window associated with interpreter. If we're called by Tk_Init to
+ * create a new application, then this is NULL.
*/
tkwin = Tk_MainWindow(interp);
if (tkwin != NULL) {
- new = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]),
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]),
screenName);
} else if (appName == NULL) {
/*
- * This occurs when someone tried to create a frame/toplevel
- * while we are being destroyed. Let an error be thrown.
+ * This occurs when someone tried to create a frame/toplevel while we
+ * are being destroyed. Let an error be thrown.
*/
Tcl_AppendResult(interp, "unable to create widget \"",
- Tcl_GetString(objv[1]), "\"", (char *) NULL);
- new = NULL;
+ Tcl_GetString(objv[1]), "\"", NULL);
+ newWin = NULL;
} else {
/*
- * We were called from Tk_Init; create a new application.
+ * We were called from Tk_Init; create a new application.
*/
- new = TkCreateMainWindow(interp, screenName, appName);
+ newWin = TkCreateMainWindow(interp, screenName, appName);
}
- if (new == NULL) {
+ if (newWin == NULL) {
goto error;
+ } else {
+ /*
+ * Mark Tk frames as suitable candidates for [wm manage]
+ */
+ TkWindow *winPtr = (TkWindow *)newWin;
+ winPtr->flags |= TK_WM_MANAGEABLE;
}
if (className == NULL) {
- className = Tk_GetOption(new, "class", "Class");
+ className = Tk_GetOption(newWin, "class", "Class");
if (className == NULL) {
className = classNames[type];
}
}
- Tk_SetClass(new, className);
+ Tk_SetClass(newWin, className);
if (useOption == NULL) {
- useOption = Tk_GetOption(new, "use", "Use");
+ useOption = Tk_GetOption(newWin, "use", "Use");
}
if ((useOption != NULL) && (*useOption != 0)) {
- if (TkpUseWindow(interp, new, useOption) != TCL_OK) {
+ if (TkpUseWindow(interp, newWin, useOption) != TCL_OK) {
goto error;
}
}
if (visualName == NULL) {
- visualName = Tk_GetOption(new, "visual", "Visual");
+ visualName = Tk_GetOption(newWin, "visual", "Visual");
}
if (colormapName == NULL) {
- colormapName = Tk_GetOption(new, "colormap", "Colormap");
+ colormapName = Tk_GetOption(newWin, "colormap", "Colormap");
}
if ((colormapName != NULL) && (*colormapName == 0)) {
colormapName = NULL;
}
if (visualName != NULL) {
- visual = Tk_GetVisual(interp, new, visualName, &depth,
- (colormapName == NULL) ? &colormap : (Colormap *) NULL);
+ visual = Tk_GetVisual(interp, newWin, visualName, &depth,
+ (colormapName == NULL) ? &colormap : NULL);
if (visual == NULL) {
goto error;
}
- Tk_SetWindowVisual(new, visual, depth, colormap);
+ Tk_SetWindowVisual(newWin, visual, depth, colormap);
}
if (colormapName != NULL) {
- colormap = Tk_GetColormap(interp, new, colormapName);
+ colormap = Tk_GetColormap(interp, newWin, colormapName);
if (colormap == None) {
goto error;
}
- Tk_SetWindowColormap(new, colormap);
+ Tk_SetWindowColormap(newWin, colormap);
}
/*
- * For top-level windows, provide an initial geometry request of
- * 200x200, just so the window looks nicer on the screen if it
- * doesn't request a size for itself.
+ * For top-level windows, provide an initial geometry request of 200x200,
+ * just so the window looks nicer on the screen if it doesn't request a
+ * size for itself.
*/
if (type == TYPE_TOPLEVEL) {
- Tk_GeometryRequest(new, 200, 200);
+ Tk_GeometryRequest(newWin, 200, 200);
}
/*
- * Create the widget record, process configuration options, and
- * create event handlers. Then fill in a few additional fields
- * in the widget record from the special options.
+ * Create the widget record, process configuration options, and create
+ * event handlers. Then fill in a few additional fields in the widget
+ * record from the special options.
*/
if (type == TYPE_LABELFRAME) {
@@ -644,11 +627,11 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
framePtr = (Frame *) ckalloc(sizeof(Frame));
memset((void *) framePtr, 0, (sizeof(Frame)));
}
- framePtr->tkwin = new;
- framePtr->display = Tk_Display(new);
+ framePtr->tkwin = newWin;
+ framePtr->display = Tk_Display(newWin);
framePtr->interp = interp;
framePtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(new), FrameWidgetObjCmd,
+ Tk_PathName(newWin), FrameWidgetObjCmd,
(ClientData) framePtr, FrameCmdDeletedProc);
framePtr->optionTable = optionTable;
framePtr->type = type;
@@ -665,14 +648,15 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
/*
* Store backreference to frame widget in window structure.
*/
- Tk_SetClassProcs(new, &frameClass, (ClientData) framePtr);
+
+ Tk_SetClassProcs(newWin, &frameClass, (ClientData) framePtr);
mask = ExposureMask | StructureNotifyMask | FocusChangeMask;
if (type == TYPE_TOPLEVEL) {
- mask |= ActivateMask;
+ mask |= ActivateMask;
}
- Tk_CreateEventHandler(new, mask, FrameEventProc, (ClientData) framePtr);
- if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, new)
+ Tk_CreateEventHandler(newWin, mask, FrameEventProc, (ClientData) framePtr);
+ if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, newWin)
!= TCL_OK) ||
(ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) {
goto error;
@@ -682,19 +666,19 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
TkpMakeContainer(framePtr->tkwin);
} else {
Tcl_AppendResult(interp, "A window cannot have both the -use ",
- "and the -container option set.", (char *) NULL);
+ "and the -container option set.", NULL);
goto error;
}
}
if (type == TYPE_TOPLEVEL) {
Tcl_DoWhenIdle(MapFrame, (ClientData) framePtr);
}
- Tcl_SetResult(interp, Tk_PathName(new), TCL_STATIC);
+ Tcl_SetResult(interp, Tk_PathName(newWin), TCL_STATIC);
return TCL_OK;
- error:
- if (new != NULL) {
- Tk_DestroyWindow(new);
+ error:
+ if (newWin != NULL) {
+ Tk_DestroyWindow(newWin);
}
return TCL_ERROR;
}
@@ -704,9 +688,9 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
*
* FrameWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a frame widget. See the user
- * documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a frame widget. See the user documentation for details on what it
+ * does.
*
* Results:
* A standard Tcl result.
@@ -718,14 +702,14 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
*/
static int
-FrameWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about frame widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+FrameWidgetObjCmd(
+ ClientData clientData, /* Information about frame widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
static CONST char *frameOptions[] = {
- "cget", "configure", (char *) NULL
+ "cget", "configure", NULL
};
enum options {
FRAME_CGET, FRAME_CONFIGURE
@@ -745,27 +729,26 @@ FrameWidgetObjCmd(clientData, interp, objc, objv)
}
Tcl_Preserve((ClientData) framePtr);
switch ((enum options) index) {
- case FRAME_CGET: {
+ case FRAME_CGET:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option");
result = TCL_ERROR;
goto done;
}
- objPtr = Tk_GetOptionValue(interp, (char *) framePtr,
+ objPtr = Tk_GetOptionValue(interp, (char *) framePtr,
framePtr->optionTable, objv[2], framePtr->tkwin);
- if (objPtr == NULL) {
+ if (objPtr == NULL) {
result = TCL_ERROR;
goto done;
- } else {
+ } else {
Tcl_SetObjResult(interp, objPtr);
- }
+ }
break;
- }
- case FRAME_CONFIGURE: {
+ case FRAME_CONFIGURE:
if (objc <= 3) {
objPtr = Tk_GetOptionInfo(interp, (char *) framePtr,
framePtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
+ (objc == 3) ? objv[2] : NULL,
framePtr->tkwin);
if (objPtr == NULL) {
result = TCL_ERROR;
@@ -775,8 +758,8 @@ FrameWidgetObjCmd(clientData, interp, objc, objv)
}
} else {
/*
- * Don't allow the options -class, -colormap, -container,
- * -newcmap, -screen, -use, or -visual to be changed.
+ * Don't allow the options -class, -colormap, -container, -screen,
+ * -use, or -visual to be changed.
*/
for (i = 2; i < objc; i++) {
@@ -785,34 +768,47 @@ FrameWidgetObjCmd(clientData, interp, objc, objv)
continue;
}
c = arg[1];
- if (((c == 'c')
- && (strncmp(arg, "-class", (unsigned) length) == 0)
- && (length >= 2))
- || ((c == 'c')
- && (strncmp(arg, "-colormap", (unsigned) length) == 0)
- && (length >= 3))
- || ((c == 'c')
- && (strncmp(arg, "-container", (unsigned) length) == 0)
- && (length >= 3))
- || ((c == 's') && (framePtr->type == TYPE_TOPLEVEL)
- && (strncmp(arg, "-screen", (unsigned) length) == 0))
- || ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL)
- && (strncmp(arg, "-use", (unsigned) length) == 0))
- || ((c == 'v')
- && (strncmp(arg, "-visual", (unsigned) length) ==0))) {
- Tcl_AppendResult(interp, "can't modify ", arg,
- " option after widget is created", (char *) NULL);
- result = TCL_ERROR;
- goto done;
+ if (((c == 'c') && (length >= 2)
+ && (strncmp(arg, "-class", (unsigned)length) == 0))
+ || ((c == 'c') && (length >= 3)
+ && (strncmp(arg, "-colormap", (unsigned)length) == 0))
+ || ((c == 'c') && (length >= 3)
+ && (strncmp(arg, "-container", (unsigned)length) == 0))
+ || ((c == 's') && (framePtr->type == TYPE_TOPLEVEL)
+ && (strncmp(arg, "-screen", (unsigned)length) == 0))
+ || ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL)
+ && (strncmp(arg, "-use", (unsigned)length) == 0))
+ || ((c == 'v')
+ && (strncmp(arg, "-visual", (unsigned)length) == 0))) {
+
+ #ifdef SUPPORT_CONFIG_EMBEDDED
+ if (c == 'u') {
+ CONST char *string = Tcl_GetString(objv[i+1]);
+ if (TkpUseWindow(interp, framePtr->tkwin,
+ string) != TCL_OK) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ } else {
+ Tcl_AppendResult(interp, "can't modify ", arg,
+ " option after widget is created", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+ #else
+ Tcl_AppendResult(interp, "can't modify ", arg,
+ " option after widget is created", NULL);
+ result = TCL_ERROR;
+ goto done;
+ #endif
}
}
result = ConfigureFrame(interp, framePtr, objc-2, objv+2);
}
break;
- }
}
- done:
+ done:
Tcl_Release((ClientData) framePtr);
return result;
}
@@ -822,9 +818,9 @@ FrameWidgetObjCmd(clientData, interp, objc, objv)
*
* DestroyFrame --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a frame at a safe time
- * (when no-one is using it anymore).
+ * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
+ * up the internal structure of a frame at a safe time (when no-one is
+ * using it anymore).
*
* Results:
* None.
@@ -836,8 +832,8 @@ FrameWidgetObjCmd(clientData, interp, objc, objv)
*/
static void
-DestroyFrame(memPtr)
- char *memPtr; /* Info about frame widget. */
+DestroyFrame(
+ char *memPtr) /* Info about frame widget. */
{
register Frame *framePtr = (Frame *) memPtr;
register Labelframe *labelframePtr = (Labelframe *) memPtr;
@@ -859,10 +855,9 @@ DestroyFrame(memPtr)
*
* DestroyFramePartly --
*
- * This procedure is invoked to clean up everything that needs
- * tkwin to be defined when deleted. During the destruction
- * process tkwin is always set to NULL and this procedure must
- * be called before that happens.
+ * This function is invoked to clean up everything that needs tkwin to be
+ * defined when deleted. During the destruction process tkwin is always
+ * set to NULL and this function must be called before that happens.
*
* Results:
* None.
@@ -874,16 +869,15 @@ DestroyFrame(memPtr)
*/
static void
-DestroyFramePartly(framePtr)
- Frame *framePtr; /* Info about frame widget. */
+DestroyFramePartly(
+ Frame *framePtr) /* Info about frame widget. */
{
register Labelframe *labelframePtr = (Labelframe *) framePtr;
if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) {
Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask,
FrameStructureProc, (ClientData) framePtr);
- Tk_ManageGeometry(labelframePtr->labelWin, (Tk_GeomMgr *) NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(labelframePtr->labelWin, NULL, (ClientData) NULL);
if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) {
Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin);
}
@@ -892,7 +886,7 @@ DestroyFramePartly(framePtr)
}
Tk_FreeConfigOptions((char *) framePtr, framePtr->optionTable,
- framePtr->tkwin);
+ framePtr->tkwin);
}
/*
@@ -900,29 +894,28 @@ DestroyFramePartly(framePtr)
*
* ConfigureFrame --
*
- * This procedure is called to process an objv/objc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a frame widget.
+ * This function is called to process an objv/objc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a frame
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as text string, colors, font,
- * etc. get set for framePtr; old resources get freed, if there
- * were any.
+ * Configuration information, such as text string, colors, font, etc. get
+ * set for framePtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureFrame(interp, framePtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- register Frame *framePtr; /* Information about widget; may or may
- * not already have values for some fields. */
- int objc; /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
+ConfigureFrame(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register Frame *framePtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of valid entries in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments. */
{
Tk_SavedOptions savedOptions;
char *oldMenuName;
@@ -932,7 +925,7 @@ ConfigureFrame(interp, framePtr, objc, objv)
/*
* Need the old menubar name for the menu code to delete it.
*/
-
+
if (framePtr->menuName == NULL) {
oldMenuName = NULL;
} else {
@@ -945,7 +938,7 @@ ConfigureFrame(interp, framePtr, objc, objv)
}
if (Tk_SetOptions(interp, (char *) framePtr,
framePtr->optionTable, objc, objv,
- framePtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) {
+ framePtr->tkwin, &savedOptions, NULL) != TCL_OK) {
if (oldMenuName != NULL) {
ckfree(oldMenuName);
}
@@ -958,10 +951,11 @@ ConfigureFrame(interp, framePtr, objc, objv)
* A few of the options require additional processing.
*/
- if (((oldMenuName == NULL) && (framePtr->menuName != NULL))
+ if ((((oldMenuName == NULL) && (framePtr->menuName != NULL))
|| ((oldMenuName != NULL) && (framePtr->menuName == NULL))
|| ((oldMenuName != NULL) && (framePtr->menuName != NULL)
- && strcmp(oldMenuName, framePtr->menuName) != 0)) {
+ && strcmp(oldMenuName, framePtr->menuName) != 0))
+ && framePtr->type == TYPE_TOPLEVEL) {
TkSetWindowMenuBar(interp, framePtr->tkwin, oldMenuName,
framePtr->menuName);
}
@@ -987,8 +981,8 @@ ConfigureFrame(interp, framePtr, objc, objv)
}
/*
- * If a -labelwidget is specified, check that it is valid and set
- * up geometry management for it.
+ * If a -labelwidget is specified, check that it is valid and set up
+ * geometry management for it.
*/
if (framePtr->type == TYPE_LABELFRAME) {
@@ -996,8 +990,7 @@ ConfigureFrame(interp, framePtr, objc, objv)
if (oldWindow != NULL) {
Tk_DeleteEventHandler(oldWindow, StructureNotifyMask,
FrameStructureProc, (ClientData) framePtr);
- Tk_ManageGeometry(oldWindow, (Tk_GeomMgr *) NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL);
Tk_UnmaintainGeometry(oldWindow, framePtr->tkwin);
Tk_UnmapWindow(oldWindow);
}
@@ -1005,10 +998,9 @@ ConfigureFrame(interp, framePtr, objc, objv)
Tk_Window ancestor, parent, sibling = NULL;
/*
- * Make sure that the frame is either the parent of the
- * window used as label or a descendant of that
- * parent. Also, don't allow a top-level window to be
- * managed inside the frame.
+ * Make sure that the frame is either the parent of the window
+ * used as label or a descendant of that parent. Also, don't
+ * allow a top-level window to be managed inside the frame.
*/
parent = Tk_Parent(labelframePtr->labelWin);
@@ -1022,7 +1014,7 @@ ConfigureFrame(interp, framePtr, objc, objv)
badWindow:
Tcl_AppendResult(interp, "can't use ",
Tk_PathName(labelframePtr->labelWin),
- " as label in this frame", (char *) NULL);
+ " as label in this frame", NULL);
labelframePtr->labelWin = NULL;
return TCL_ERROR;
}
@@ -1040,9 +1032,8 @@ ConfigureFrame(interp, framePtr, objc, objv)
(ClientData) framePtr);
/*
- * If the frame is not parent to the label, make
- * sure the label is above its sibling in the stacking
- * order.
+ * If the frame is not parent to the label, make sure the
+ * label is above its sibling in the stacking order.
*/
if (sibling != NULL) {
@@ -1062,22 +1053,22 @@ ConfigureFrame(interp, framePtr, objc, objv)
*
* FrameWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Frame will be relayed out and redisplayed.
+ * Frame will be relayed out and redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
static void
-FrameWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+FrameWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
Frame *framePtr = (Frame *) instanceData;
Labelframe *labelframePtr = (Labelframe *) framePtr;
@@ -1096,8 +1087,8 @@ FrameWorldChanged(instanceData)
if (framePtr->type == TYPE_LABELFRAME) {
/*
- * The textGC is needed even in the labelWin case, so it's
- * always created for a labelframe.
+ * The textGC is needed even in the labelWin case, so it's always
+ * created for a labelframe.
*/
gcValues.font = Tk_FontId(labelframePtr->tkfont);
@@ -1113,7 +1104,7 @@ FrameWorldChanged(instanceData)
/*
* Calculate label size.
*/
-
+
labelframePtr->labelReqWidth = labelframePtr->labelReqHeight = 0;
if (anyTextLabel) {
@@ -1129,13 +1120,13 @@ FrameWorldChanged(instanceData)
labelframePtr->labelReqHeight = Tk_ReqHeight(labelframePtr->labelWin);
}
- /*
- * Make sure label size is at least as big as the border.
- * This simplifies later calculations and gives a better
- * appearance with thick borders.
+ /*
+ * Make sure label size is at least as big as the border. This
+ * simplifies later calculations and gives a better appearance with
+ * thick borders.
*/
-
- if ((labelframePtr->labelAnchor >= LABELANCHOR_N) &&
+
+ if ((labelframePtr->labelAnchor >= LABELANCHOR_N) &&
(labelframePtr->labelAnchor <= LABELANCHOR_SW)) {
if (labelframePtr->labelReqHeight < framePtr->borderWidth) {
labelframePtr->labelReqHeight = framePtr->borderWidth;
@@ -1151,34 +1142,34 @@ FrameWorldChanged(instanceData)
* Calculate individual border widths.
*/
- bWidthBottom = bWidthTop = bWidthRight = bWidthLeft =
- framePtr->borderWidth + framePtr->highlightWidth;
+ bWidthBottom = bWidthTop = bWidthRight = bWidthLeft =
+ framePtr->borderWidth + framePtr->highlightWidth;
bWidthLeft += framePtr->padX;
bWidthRight += framePtr->padX;
bWidthTop += framePtr->padY;
bWidthBottom += framePtr->padY;
-
+
if (anyTextLabel || anyWindowLabel) {
switch (labelframePtr->labelAnchor) {
- case LABELANCHOR_E:
- case LABELANCHOR_EN:
- case LABELANCHOR_ES:
+ case LABELANCHOR_E:
+ case LABELANCHOR_EN:
+ case LABELANCHOR_ES:
bWidthRight += labelframePtr->labelReqWidth -
framePtr->borderWidth;
break;
- case LABELANCHOR_N:
- case LABELANCHOR_NE:
- case LABELANCHOR_NW:
+ case LABELANCHOR_N:
+ case LABELANCHOR_NE:
+ case LABELANCHOR_NW:
bWidthTop += labelframePtr->labelReqHeight - framePtr->borderWidth;
break;
- case LABELANCHOR_S:
- case LABELANCHOR_SE:
- case LABELANCHOR_SW:
+ case LABELANCHOR_S:
+ case LABELANCHOR_SE:
+ case LABELANCHOR_SW:
bWidthBottom += labelframePtr->labelReqHeight -
framePtr->borderWidth;
break;
- default:
+ default:
bWidthLeft += labelframePtr->labelReqWidth - framePtr->borderWidth;
break;
}
@@ -1197,11 +1188,12 @@ FrameWorldChanged(instanceData)
int minwidth = labelframePtr->labelReqWidth;
int minheight = labelframePtr->labelReqHeight;
int padding = framePtr->highlightWidth;
+
if (framePtr->borderWidth > 0) {
padding += framePtr->borderWidth + LABELMARGIN;
}
padding *= 2;
- if ((labelframePtr->labelAnchor >= LABELANCHOR_N) &&
+ if ((labelframePtr->labelAnchor >= LABELANCHOR_N) &&
(labelframePtr->labelAnchor <= LABELANCHOR_SW)) {
minwidth += padding;
minheight += framePtr->borderWidth + framePtr->highlightWidth;
@@ -1229,9 +1221,9 @@ FrameWorldChanged(instanceData)
*
* ComputeFrameGeometry --
*
- * This procedure is called to compute various geometrical
- * information for a frame, such as where various things get
- * displayed. It's called when the window is reconfigured.
+ * This function is called to compute various geometrical information for
+ * a frame, such as where various things get displayed. It's called when
+ * the window is reconfigured.
*
* Results:
* None.
@@ -1243,8 +1235,8 @@ FrameWorldChanged(instanceData)
*/
static void
-ComputeFrameGeometry(framePtr)
- register Frame *framePtr; /* Information about widget. */
+ComputeFrameGeometry(
+ register Frame *framePtr) /* Information about widget. */
{
int otherWidth, otherHeight, otherWidthT, otherHeightT, padding;
int maxWidth, maxHeight;
@@ -1256,12 +1248,13 @@ ComputeFrameGeometry(framePtr)
*/
if (framePtr->type != TYPE_LABELFRAME) return;
- if ((labelframePtr->textPtr == NULL) &&
- (labelframePtr->labelWin == NULL)) return;
+ if (labelframePtr->textPtr == NULL && labelframePtr->labelWin == NULL) {
+ return;
+ }
tkwin = framePtr->tkwin;
- /*
+ /*
* Calculate the available size for the label
*/
@@ -1270,15 +1263,15 @@ ComputeFrameGeometry(framePtr)
padding = framePtr->highlightWidth;
if (framePtr->borderWidth > 0) {
- padding += framePtr->borderWidth + LABELMARGIN;
+ padding += framePtr->borderWidth + LABELMARGIN;
}
padding *= 2;
maxHeight = Tk_Height(tkwin);
maxWidth = Tk_Width(tkwin);
- if ((labelframePtr->labelAnchor >= LABELANCHOR_N) &&
- (labelframePtr->labelAnchor <= LABELANCHOR_SW)) {
+ if ((labelframePtr->labelAnchor >= LABELANCHOR_N) &&
+ (labelframePtr->labelAnchor <= LABELANCHOR_SW)) {
maxWidth -= padding;
if (maxWidth < 1) maxWidth = 1;
} else {
@@ -1293,9 +1286,9 @@ ComputeFrameGeometry(framePtr)
}
/*
- * Calculate label and text position.
- * The text's position is based on the requested size (= the text's
- * real size) to get proper alignment if the text does not fit.
+ * Calculate label and text position. The text's position is based on the
+ * requested size (= the text's real size) to get proper alignment if the
+ * text does not fit.
*/
otherWidth = Tk_Width(tkwin) - labelframePtr->labelBox.width;
@@ -1305,64 +1298,64 @@ ComputeFrameGeometry(framePtr)
padding = framePtr->highlightWidth;
switch (labelframePtr->labelAnchor) {
- case LABELANCHOR_E:
- case LABELANCHOR_EN:
- case LABELANCHOR_ES:
- labelframePtr->labelTextX = otherWidthT - padding;
- labelframePtr->labelBox.x = otherWidth - padding;
- break;
- case LABELANCHOR_N:
- case LABELANCHOR_NE:
- case LABELANCHOR_NW:
- labelframePtr->labelTextY = padding;
- labelframePtr->labelBox.y = padding;
- break;
- case LABELANCHOR_S:
- case LABELANCHOR_SE:
- case LABELANCHOR_SW:
- labelframePtr->labelTextY = otherHeightT - padding;
- labelframePtr->labelBox.y = otherHeight - padding;
- break;
- default:
- labelframePtr->labelTextX = padding;
- labelframePtr->labelBox.x = padding;
- break;
+ case LABELANCHOR_E:
+ case LABELANCHOR_EN:
+ case LABELANCHOR_ES:
+ labelframePtr->labelTextX = otherWidthT - padding;
+ labelframePtr->labelBox.x = otherWidth - padding;
+ break;
+ case LABELANCHOR_N:
+ case LABELANCHOR_NE:
+ case LABELANCHOR_NW:
+ labelframePtr->labelTextY = padding;
+ labelframePtr->labelBox.y = padding;
+ break;
+ case LABELANCHOR_S:
+ case LABELANCHOR_SE:
+ case LABELANCHOR_SW:
+ labelframePtr->labelTextY = otherHeightT - padding;
+ labelframePtr->labelBox.y = otherHeight - padding;
+ break;
+ default:
+ labelframePtr->labelTextX = padding;
+ labelframePtr->labelBox.x = padding;
+ break;
}
if (framePtr->borderWidth > 0) {
- padding += framePtr->borderWidth + LABELMARGIN;
+ padding += framePtr->borderWidth + LABELMARGIN;
}
switch (labelframePtr->labelAnchor) {
- case LABELANCHOR_NW:
- case LABELANCHOR_SW:
- labelframePtr->labelTextX = padding;
- labelframePtr->labelBox.x = padding;
- break;
- case LABELANCHOR_N:
- case LABELANCHOR_S:
- labelframePtr->labelTextX = otherWidthT / 2;
- labelframePtr->labelBox.x = otherWidth / 2;
- break;
- case LABELANCHOR_NE:
- case LABELANCHOR_SE:
- labelframePtr->labelTextX = otherWidthT - padding;
- labelframePtr->labelBox.x = otherWidth - padding;
- break;
- case LABELANCHOR_EN:
- case LABELANCHOR_WN:
- labelframePtr->labelTextY = padding;
- labelframePtr->labelBox.y = padding;
- break;
- case LABELANCHOR_E:
- case LABELANCHOR_W:
- labelframePtr->labelTextY = otherHeightT / 2;
- labelframePtr->labelBox.y = otherHeight / 2;
- break;
- default:
+ case LABELANCHOR_NW:
+ case LABELANCHOR_SW:
+ labelframePtr->labelTextX = padding;
+ labelframePtr->labelBox.x = padding;
+ break;
+ case LABELANCHOR_N:
+ case LABELANCHOR_S:
+ labelframePtr->labelTextX = otherWidthT / 2;
+ labelframePtr->labelBox.x = otherWidth / 2;
+ break;
+ case LABELANCHOR_NE:
+ case LABELANCHOR_SE:
+ labelframePtr->labelTextX = otherWidthT - padding;
+ labelframePtr->labelBox.x = otherWidth - padding;
+ break;
+ case LABELANCHOR_EN:
+ case LABELANCHOR_WN:
+ labelframePtr->labelTextY = padding;
+ labelframePtr->labelBox.y = padding;
+ break;
+ case LABELANCHOR_E:
+ case LABELANCHOR_W:
+ labelframePtr->labelTextY = otherHeightT / 2;
+ labelframePtr->labelBox.y = otherHeight / 2;
+ break;
+ default:
labelframePtr->labelTextY = otherHeightT - padding;
labelframePtr->labelBox.y = otherHeight - padding;
- break;
+ break;
}
}
@@ -1371,21 +1364,20 @@ ComputeFrameGeometry(framePtr)
*
* DisplayFrame --
*
- * This procedure is invoked to display a frame widget.
+ * This function is invoked to display a frame widget.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the frame in its
- * current mode.
+ * Commands are output to X to display the frame in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DisplayFrame(clientData)
- ClientData clientData; /* Information about widget. */
+DisplayFrame(
+ ClientData clientData) /* Information about widget. */
{
register Frame *framePtr = (Frame *) clientData;
register Tk_Window tkwin = framePtr->tkwin;
@@ -1394,8 +1386,7 @@ DisplayFrame(clientData)
TkRegion clipRegion = NULL;
framePtr->flags &= ~REDRAW_PENDING;
- if ((framePtr->tkwin == NULL) || !Tk_IsMapped(tkwin)
- || framePtr->isContainer) {
+ if ((framePtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
return;
}
@@ -1406,7 +1397,7 @@ DisplayFrame(clientData)
hlWidth = framePtr->highlightWidth;
if (hlWidth != 0) {
- GC fgGC, bgGC;
+ GC fgGC, bgGC;
bgGC = Tk_GCForColor(framePtr->highlightBgColorPtr,
Tk_WindowId(tkwin));
@@ -1429,11 +1420,11 @@ DisplayFrame(clientData)
if (framePtr->type != TYPE_LABELFRAME) {
/*
- * Pass to platform specific draw function. In general, it just
- * draws a simple rectangle, but it may "theme" the background.
+ * Pass to platform specific draw function. In general, it just draws
+ * a simple rectangle, but it may "theme" the background.
*/
- noLabel:
+ noLabel:
TkpDrawFrame(tkwin, framePtr->border, hlWidth,
framePtr->borderWidth, framePtr->relief);
} else {
@@ -1446,10 +1437,10 @@ DisplayFrame(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * In order to avoid screen flashes, this procedure redraws the
- * frame into off-screen memory, then copies it back on-screen
- * in a single operation. This means there's no point in time
- * where the on-screen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the frame
+ * into off-screen memory, then copies it back on-screen in a single
+ * operation. This means there's no point in time where the on-screen
+ * image has been cleared.
*/
pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin),
@@ -1458,7 +1449,7 @@ DisplayFrame(clientData)
pixmap = Tk_WindowId(tkwin);
#endif /* TK_NO_DOUBLE_BUFFERING */
- /*
+ /*
* Clear the pixmap.
*/
@@ -1474,61 +1465,56 @@ DisplayFrame(clientData)
bdY2 = Tk_Height(tkwin) - hlWidth;
switch (labelframePtr->labelAnchor) {
- case LABELANCHOR_E:
- case LABELANCHOR_EN:
- case LABELANCHOR_ES:
- bdX2 -= (labelframePtr->labelBox.width - framePtr->borderWidth)
- / 2;
+ case LABELANCHOR_E:
+ case LABELANCHOR_EN:
+ case LABELANCHOR_ES:
+ bdX2 -= (labelframePtr->labelBox.width-framePtr->borderWidth) / 2;
break;
- case LABELANCHOR_N:
- case LABELANCHOR_NE:
- case LABELANCHOR_NW:
- /*
- * Since the glyphs of the text tend to be in the lower part
- * we favor a lower border position by rounding up.
+ case LABELANCHOR_N:
+ case LABELANCHOR_NE:
+ case LABELANCHOR_NW:
+ /*
+ * Since the glyphs of the text tend to be in the lower part we
+ * favor a lower border position by rounding up.
*/
- bdY1 += (labelframePtr->labelBox.height - framePtr->borderWidth +1)
- / 2;
+ bdY1 += (labelframePtr->labelBox.height-framePtr->borderWidth+1)/2;
break;
- case LABELANCHOR_S:
- case LABELANCHOR_SE:
- case LABELANCHOR_SW:
- bdY2 -= (labelframePtr->labelBox.height - framePtr->borderWidth)
- / 2;
+ case LABELANCHOR_S:
+ case LABELANCHOR_SE:
+ case LABELANCHOR_SW:
+ bdY2 -= (labelframePtr->labelBox.height-framePtr->borderWidth) / 2;
break;
- default:
- bdX1 += (labelframePtr->labelBox.width - framePtr->borderWidth)
- / 2;
+ default:
+ bdX1 += (labelframePtr->labelBox.width-framePtr->borderWidth) / 2;
break;
}
- /*
- * Draw border
- */
+ /*
+ * Draw border
+ */
Tk_Draw3DRectangle(tkwin, pixmap, framePtr->border, bdX1, bdY1,
bdX2 - bdX1, bdY2 - bdY1, framePtr->borderWidth,
framePtr->relief);
- if (labelframePtr->labelWin == NULL) {
- /*
- * Clear behind the label
- */
-
- Tk_Fill3DRectangle(tkwin, pixmap,
- framePtr->border, labelframePtr->labelBox.x,
- labelframePtr->labelBox.y, labelframePtr->labelBox.width,
- labelframePtr->labelBox.height, 0, TK_RELIEF_FLAT);
-
- /*
- * Draw label.
- * If there is not room for the entire label, use clipping to
- * get a nice appearance.
- */
-
+ if (labelframePtr->labelWin == NULL) {
+ /*
+ * Clear behind the label
+ */
+
+ Tk_Fill3DRectangle(tkwin, pixmap,
+ framePtr->border, labelframePtr->labelBox.x,
+ labelframePtr->labelBox.y, labelframePtr->labelBox.width,
+ labelframePtr->labelBox.height, 0, TK_RELIEF_FLAT);
+
+ /*
+ * Draw label. If there is not room for the entire label, use
+ * clipping to get a nice appearance.
+ */
+
if ((labelframePtr->labelBox.width < labelframePtr->labelReqWidth)
- || (labelframePtr->labelBox.height <
+ || (labelframePtr->labelBox.height <
labelframePtr->labelReqHeight)) {
clipRegion = TkCreateRegion();
TkUnionRectWithRegion(&labelframePtr->labelBox, clipRegion,
@@ -1537,37 +1523,37 @@ DisplayFrame(clientData)
clipRegion);
}
- Tk_DrawTextLayout(framePtr->display, pixmap,
- labelframePtr->textGC, labelframePtr->textLayout,
- labelframePtr->labelTextX + LABELSPACING,
- labelframePtr->labelTextY + LABELSPACING, 0, -1);
+ Tk_DrawTextLayout(framePtr->display, pixmap,
+ labelframePtr->textGC, labelframePtr->textLayout,
+ labelframePtr->labelTextX + LABELSPACING,
+ labelframePtr->labelTextY + LABELSPACING, 0, -1);
if (clipRegion != NULL) {
XSetClipMask(framePtr->display, labelframePtr->textGC, None);
TkDestroyRegion(clipRegion);
}
- } else {
+ } else {
/*
* Reposition and map the window (but in different ways depending
* on whether the frame is the window's parent).
*/
-
+
if (framePtr->tkwin == Tk_Parent(labelframePtr->labelWin)) {
if ((labelframePtr->labelBox.x != Tk_X(labelframePtr->labelWin))
|| (labelframePtr->labelBox.y !=
Tk_Y(labelframePtr->labelWin))
- || (labelframePtr->labelBox.width !=
+ || (labelframePtr->labelBox.width !=
Tk_Width(labelframePtr->labelWin))
- || (labelframePtr->labelBox.height !=
+ || (labelframePtr->labelBox.height !=
Tk_Height(labelframePtr->labelWin))) {
Tk_MoveResizeWindow(labelframePtr->labelWin,
- labelframePtr->labelBox.x, labelframePtr->labelBox.y,
+ labelframePtr->labelBox.x, labelframePtr->labelBox.y,
labelframePtr->labelBox.width,
labelframePtr->labelBox.height);
}
Tk_MapWindow(labelframePtr->labelWin);
} else {
- Tk_MaintainGeometry(labelframePtr->labelWin, framePtr->tkwin,
+ Tk_MaintainGeometry(labelframePtr->labelWin, framePtr->tkwin,
labelframePtr->labelBox.x, labelframePtr->labelBox.y,
labelframePtr->labelBox.width,
labelframePtr->labelBox.height);
@@ -1577,7 +1563,7 @@ DisplayFrame(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Everything's been redisplayed; now copy the pixmap onto the screen
+ * Everything's been redisplayed; now copy the pixmap onto the screen
* and free up the pixmap.
*/
@@ -1597,24 +1583,24 @@ DisplayFrame(clientData)
*
* FrameEventProc --
*
- * This procedure is invoked by the Tk dispatcher on
- * structure changes to a frame. For frames with 3D
- * borders, this procedure is also invoked for exposures.
+ * This function is invoked by the Tk dispatcher on structure changes to
+ * a frame. For frames with 3D borders, this function is also invoked for
+ * exposures.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-FrameEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- register XEvent *eventPtr; /* Information about event. */
+FrameEventProc(
+ ClientData clientData, /* Information about window. */
+ register XEvent *eventPtr) /* Information about event. */
{
register Frame *framePtr = (Frame *) clientData;
@@ -1631,15 +1617,14 @@ FrameEventProc(clientData, eventPtr)
framePtr->menuName = NULL;
}
if (framePtr->tkwin != NULL) {
-
/*
- * If this window is a container, then this event could be
- * coming from the embedded application, in which case
- * Tk_DestroyWindow hasn't been called yet. When Tk_DestroyWindow
- * is called later, then another destroy event will be generated.
- * We need to be sure we ignore the second event, since the frame
- * could be gone by then. To do so, delete the event handler
- * explicitly (normally it's done implicitly by Tk_DestroyWindow).
+ * If this window is a container, then this event could be coming
+ * from the embedded application, in which case Tk_DestroyWindow
+ * hasn't been called yet. When Tk_DestroyWindow is called later,
+ * then another destroy event will be generated. We need to be
+ * sure we ignore the second event, since the frame could be gone
+ * by then. To do so, delete the event handler explicitly
+ * (normally it's done implicitly by Tk_DestroyWindow).
*/
/*
@@ -1647,13 +1632,13 @@ FrameEventProc(clientData, eventPtr)
* DestroyFrame, we must free all options now.
*/
- DestroyFramePartly(framePtr);
+ DestroyFramePartly(framePtr);
Tk_DeleteEventHandler(framePtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
FrameEventProc, (ClientData) framePtr);
framePtr->tkwin = NULL;
- Tcl_DeleteCommandFromToken(framePtr->interp, framePtr->widgetCmd);
+ Tcl_DeleteCommandFromToken(framePtr->interp, framePtr->widgetCmd);
}
if (framePtr->flags & REDRAW_PENDING) {
Tcl_CancelIdleCall(DisplayFrame, (ClientData) framePtr);
@@ -1680,7 +1665,7 @@ FrameEventProc(clientData, eventPtr)
}
return;
- redraw:
+ redraw:
if ((framePtr->tkwin != NULL) && !(framePtr->flags & REDRAW_PENDING)) {
Tcl_DoWhenIdle(DisplayFrame, (ClientData) framePtr);
framePtr->flags |= REDRAW_PENDING;
@@ -1692,9 +1677,9 @@ FrameEventProc(clientData, eventPtr)
*
* FrameCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -1706,8 +1691,8 @@ FrameEventProc(clientData, eventPtr)
*/
static void
-FrameCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+FrameCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
Frame *framePtr = (Frame *) clientData;
Tk_Window tkwin = framePtr->tkwin;
@@ -1720,19 +1705,19 @@ FrameCmdDeletedProc(clientData)
}
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
if (tkwin != NULL) {
- /*
- * Some options need tkwin to be freed, so we free them here,
- * before setting tkwin to NULL.
+ /*
+ * Some options need tkwin to be freed, so we free them here, before
+ * setting tkwin to NULL.
*/
- DestroyFramePartly(framePtr);
+ DestroyFramePartly(framePtr);
framePtr->tkwin = NULL;
Tk_DestroyWindow(tkwin);
@@ -1744,8 +1729,8 @@ FrameCmdDeletedProc(clientData)
*
* MapFrame --
*
- * This procedure is invoked as a when-idle handler to map a
- * newly-created top-level frame.
+ * This function is invoked as a when-idle handler to map a newly-created
+ * top-level frame.
*
* Results:
* None.
@@ -1757,16 +1742,16 @@ FrameCmdDeletedProc(clientData)
*/
static void
-MapFrame(clientData)
- ClientData clientData; /* Pointer to frame structure. */
+MapFrame(
+ ClientData clientData) /* Pointer to frame structure. */
{
Frame *framePtr = (Frame *) clientData;
/*
- * Wait for all other background events to be processed before
- * mapping window. This ensures that the window's correct geometry
- * will have been determined before it is first mapped, so that the
- * window manager doesn't get a false idea of its desired geometry.
+ * Wait for all other background events to be processed before mapping
+ * window. This ensures that the window's correct geometry will have been
+ * determined before it is first mapped, so that the window manager
+ * doesn't get a false idea of its desired geometry.
*/
Tcl_Preserve((ClientData) framePtr);
@@ -1776,8 +1761,8 @@ MapFrame(clientData)
}
/*
- * After each event, make sure that the window still exists
- * and quit if the window has been destroyed.
+ * After each event, make sure that the window still exists and quit
+ * if the window has been destroyed.
*/
if (framePtr->tkwin == NULL) {
@@ -1794,24 +1779,23 @@ MapFrame(clientData)
*
* TkInstallFrameMenu --
*
- * This function is needed when a Windows HWND is created
- * and a menubar has been set to the window with a system
- * menu. It notifies the menu package so that the system
- * menu can be rebuilt.
+ * This function is needed when a Windows HWND is created and a menubar
+ * has been set to the window with a system menu. It notifies the menu
+ * package so that the system menu can be rebuilt.
*
* Results:
* None.
*
* Side effects:
- * The system menu (if any) is created for the menubar
- * associated with this frame.
+ * The system menu (if any) is created for the menubar associated with
+ * this frame.
*
*--------------------------------------------------------------
*/
void
-TkInstallFrameMenu(tkwin)
- Tk_Window tkwin; /* The window that was just created. */
+TkInstallFrameMenu(
+ Tk_Window tkwin) /* The window that was just created. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -1819,9 +1803,9 @@ TkInstallFrameMenu(tkwin)
Frame *framePtr;
framePtr = (Frame*) winPtr->instanceData;
if (framePtr == NULL) {
- panic("TkInstallFrameMenu couldn't get frame pointer");
+ Tcl_Panic("TkInstallFrameMenu couldn't get frame pointer");
}
- TkpMenuNotifyToplevelCreate(winPtr->mainPtr->interp,
+ TkpMenuNotifyToplevelCreate(winPtr->mainPtr->interp,
framePtr->menuName);
}
}
@@ -1831,32 +1815,30 @@ TkInstallFrameMenu(tkwin)
*
* FrameStructureProc --
*
- * This procedure is invoked whenever StructureNotify events
- * occur for a window that's managed as label for the frame.
- * This procudure's only purpose is to clean up when windows
- * are deleted.
+ * This function is invoked whenever StructureNotify events occur for a
+ * window that's managed as label for the frame. This procudure's only
+ * purpose is to clean up when windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * The window is disassociated from the frame when it is
- * deleted.
+ * The window is disassociated from the frame when it is deleted.
*
*--------------------------------------------------------------
*/
static void
-FrameStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to record describing frame. */
- XEvent *eventPtr; /* Describes what just happened. */
+FrameStructureProc(
+ ClientData clientData, /* Pointer to record describing frame. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
Labelframe *labelframePtr = (Labelframe *) clientData;
if (eventPtr->type == DestroyNotify) {
/*
- * This should only happen in a labelframe but it doesn't
- * hurt to be careful.
+ * This should only happen in a labelframe but it doesn't hurt to be
+ * careful.
*/
if (labelframePtr->frame.type == TYPE_LABELFRAME) {
@@ -1871,24 +1853,23 @@ FrameStructureProc(clientData, eventPtr)
*
* FrameRequestProc --
*
- * This procedure is invoked whenever a window that's associated
- * with a frame changes its requested dimensions.
+ * This function is invoked whenever a window that's associated with a
+ * frame changes its requested dimensions.
*
* Results:
* None.
*
* Side effects:
- * The size and location on the screen of the window may change.
- * depending on the options specified for the frame.
+ * The size and location on the screen of the window may change depending
+ * on the options specified for the frame.
*
*--------------------------------------------------------------
*/
static void
-FrameRequestProc(clientData, tkwin)
- ClientData clientData; /* Pointer to record for frame. */
- Tk_Window tkwin; /* Window that changed its desired
- * size. */
+FrameRequestProc(
+ ClientData clientData, /* Pointer to record for frame. */
+ Tk_Window tkwin) /* Window that changed its desired size. */
{
Frame *framePtr = (Frame *) clientData;
@@ -1900,8 +1881,8 @@ FrameRequestProc(clientData, tkwin)
*
* FrameLostSlaveProc --
*
- * This procedure is invoked by Tk whenever some other geometry
- * claims control over a slave that used to be managed by us.
+ * This function is invoked by Tk whenever some other geometry claims
+ * control over a slave that used to be managed by us.
*
* Results:
* None.
@@ -1913,19 +1894,19 @@ FrameRequestProc(clientData, tkwin)
*/
static void
-FrameLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Frame structure for slave window that
- * was stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+FrameLostSlaveProc(
+ ClientData clientData, /* Frame structure for slave window that was
+ * stolen away. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
Frame *framePtr = (Frame *) clientData;
Labelframe *labelframePtr = (Labelframe *) clientData;
/*
- * This should only happen in a labelframe but it doesn't
- * hurt to be careful.
+ * This should only happen in a labelframe but it doesn't hurt to be
+ * careful.
*/
-
+
if (labelframePtr->frame.type == TYPE_LABELFRAME) {
Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask,
FrameStructureProc, (ClientData) labelframePtr);
@@ -1938,20 +1919,46 @@ FrameLostSlaveProc(clientData, tkwin)
FrameWorldChanged((ClientData) framePtr);
}
+void
+TkMapTopFrame (tkwin)
+ Tk_Window tkwin;
+{
+ Frame *framePtr = ((TkWindow*)tkwin)->instanceData;
+ Tk_OptionTable optionTable;
+ if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) {
+ framePtr->type = TYPE_TOPLEVEL;
+ Tcl_DoWhenIdle(MapFrame, (ClientData)framePtr);
+ if (framePtr->menuName != NULL) {
+ TkSetWindowMenuBar(framePtr->interp, framePtr->tkwin, NULL,
+ framePtr->menuName);
+ }
+ } else if (!Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_TOPLEVEL) {
+ framePtr->type = TYPE_FRAME;
+ } else {
+ /* Not a frame or toplevel, skip it */
+ return;
+ }
+ /*
+ * The option table has already been created so
+ * the cached pointer will be returned.
+ */
+ optionTable = Tk_CreateOptionTable(framePtr->interp, optionSpecs[framePtr->type]);
+ framePtr->optionTable = optionTable;
+}
+
/*
*--------------------------------------------------------------
*
* TkToplevelWindowFromCommandToken --
*
- * If the given command name to the command for a toplevel window
- * in the given interpreter, return the tkwin for that toplevel
- * window. Note that this lookup can't be done using the
- * standard tkwin internal table because the command might have
- * been renamed.
+ * If the given command name to the command for a toplevel window in the
+ * given interpreter, return the tkwin for that toplevel window. Note
+ * that this lookup can't be done using the standard tkwin internal table
+ * because the command might have been renamed.
*
* Results:
- * A Tk_Window token, or NULL if the name does not refer to a
- * toplevel window.
+ * A Tk_Window token, or NULL if the name does not refer to a toplevel
+ * window.
*
* Side effects:
* None.
@@ -1960,9 +1967,9 @@ FrameLostSlaveProc(clientData, tkwin)
*/
Tk_Window
-TkToplevelWindowForCommand(interp, cmdName)
- Tcl_Interp *interp;
- CONST char *cmdName;
+TkToplevelWindowForCommand(
+ Tcl_Interp *interp,
+ CONST char *cmdName)
{
Tcl_CmdInfo cmdInfo;
Frame *framePtr;
@@ -1979,3 +1986,11 @@ TkToplevelWindowForCommand(interp, cmdName)
}
return framePtr->tkwin;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkGC.c b/generic/tkGC.c
index 46a3a56..800e4d3 100644
--- a/generic/tkGC.c
+++ b/generic/tkGC.c
@@ -1,24 +1,23 @@
-/*
+/*
* tkGC.c --
*
- * This file maintains a database of read-only graphics contexts
- * for the Tk toolkit, in order to allow GC's to be shared.
+ * This file maintains a database of read-only graphics contexts for the
+ * Tk toolkit, in order to allow GC's to be shared.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
- * One of the following data structures exists for each GC that is
- * currently active. The structure is indexed with two hash tables,
- * one based on the values in the graphics context and the other
- * based on the display and GC identifier.
+ * One of the following data structures exists for each GC that is currently
+ * active. The structure is indexed with two hash tables, one based on the
+ * values in the graphics context and the other based on the display and GC
+ * identifier.
*/
typedef struct {
@@ -37,48 +36,48 @@ typedef struct {
} ValueKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void GCInit _ANSI_ARGS_((TkDisplay *dispPtr));
+static void GCInit(TkDisplay *dispPtr);
/*
*----------------------------------------------------------------------
*
* Tk_GetGC --
*
- * Given a desired set of values for a graphics context, find
- * a read-only graphics context with the desired values.
+ * Given a desired set of values for a graphics context, find a read-only
+ * graphics context with the desired values.
*
* Results:
- * The return value is the X identifer for the desired graphics
- * context. The caller should never modify this GC, and should
- * call Tk_FreeGC when the GC is no longer needed.
+ * The return value is the X identifer for the desired graphics context.
+ * The caller should never modify this GC, and should call Tk_FreeGC when
+ * the GC is no longer needed.
*
* Side effects:
- * The GC is added to an internal database with a reference count.
- * For each call to this procedure, there should eventually be a call
- * to Tk_FreeGC, so that the database can be cleaned up when GC's
- * aren't needed anymore.
+ * The GC is added to an internal database with a reference count. For
+ * each call to this function, there should eventually be a call to
+ * Tk_FreeGC, so that the database can be cleaned up when GC's aren't
+ * needed anymore.
*
*----------------------------------------------------------------------
*/
GC
-Tk_GetGC(tkwin, valueMask, valuePtr)
- Tk_Window tkwin; /* Window in which GC will be used. */
- register unsigned long valueMask;
- /* 1 bits correspond to values specified
- * in *valuesPtr; other values are set
- * from defaults. */
- register XGCValues *valuePtr;
- /* Values are specified here for bits set
- * in valueMask. */
+Tk_GetGC(
+ Tk_Window tkwin, /* Window in which GC will be used. */
+ register unsigned long valueMask,
+ /* 1 bits correspond to values specified in
+ * *valuesPtr; other values are set from
+ * defaults. */
+ register XGCValues *valuePtr)
+ /* Values are specified here for bits set in
+ * valueMask. */
{
ValueKey valueKey;
Tcl_HashEntry *valueHashPtr, *idHashPtr;
register TkGC *gcPtr;
- int new;
+ int isNew;
Drawable d, freeDrawable;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -87,15 +86,15 @@ Tk_GetGC(tkwin, valueMask, valuePtr)
}
/*
- * Must zero valueKey at start to clear out pad bytes that may be
- * part of structure on some systems.
+ * Must zero valueKey at start to clear out pad bytes that may be part of
+ * structure on some systems.
*/
- memset((VOID *) &valueKey, 0, sizeof(valueKey));
+ memset(&valueKey, 0, sizeof(valueKey));
/*
- * First, check to see if there's already a GC that will work
- * for this request (exact matches only, sorry).
+ * First, check to see if there's already a GC that will work for this
+ * request (exact matches only, sorry).
*/
if (valueMask & GCFunction) {
@@ -216,24 +215,24 @@ Tk_GetGC(tkwin, valueMask, valuePtr)
valueKey.display = Tk_Display(tkwin);
valueKey.screenNum = Tk_ScreenNumber(tkwin);
valueKey.depth = Tk_Depth(tkwin);
- valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable,
- (char *) &valueKey, &new);
- if (!new) {
+ valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable,
+ (char *) &valueKey, &isNew);
+ if (!isNew) {
gcPtr = (TkGC *) Tcl_GetHashValue(valueHashPtr);
gcPtr->refCount++;
return gcPtr->gc;
}
/*
- * No GC is currently available for this set of values. Allocate a
- * new GC and add a new structure to the database.
+ * No GC is currently available for this set of values. Allocate a new GC
+ * and add a new structure to the database.
*/
gcPtr = (TkGC *) ckalloc(sizeof(TkGC));
/*
- * Find or make a drawable to use to specify the screen and depth
- * of the GC. We may have to make a small pixmap, to avoid doing
+ * Find or make a drawable to use to specify the screen and depth of the
+ * GC. We may have to make a small pixmap, to avoid doing
* Tk_MakeWindowExist on the window.
*/
@@ -254,10 +253,10 @@ Tk_GetGC(tkwin, valueMask, valuePtr)
gcPtr->display = valueKey.display;
gcPtr->refCount = 1;
gcPtr->valueHashPtr = valueHashPtr;
- idHashPtr = Tcl_CreateHashEntry(&dispPtr->gcIdTable,
- (char *) gcPtr->gc, &new);
- if (!new) {
- panic("GC already registered in Tk_GetGC");
+ idHashPtr = Tcl_CreateHashEntry(&dispPtr->gcIdTable,
+ (char *) gcPtr->gc, &isNew);
+ if (!isNew) {
+ Tcl_Panic("GC already registered in Tk_GetGC");
}
Tcl_SetHashValue(valueHashPtr, gcPtr);
Tcl_SetHashValue(idHashPtr, gcPtr);
@@ -273,43 +272,44 @@ Tk_GetGC(tkwin, valueMask, valuePtr)
*
* Tk_FreeGC --
*
- * This procedure is called to release a graphics context allocated by
+ * This function is called to release a graphics context allocated by
* Tk_GetGC.
*
* Results:
* None.
*
* Side effects:
- * The reference count associated with gc is decremented, and
- * gc is officially deallocated if no-one is using it anymore.
+ * The reference count associated with gc is decremented, and gc is
+ * officially deallocated if no-one is using it anymore.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeGC(display, gc)
- Display *display; /* Display for which gc was allocated. */
- GC gc; /* Graphics context to be released. */
+Tk_FreeGC(
+ Display *display, /* Display for which gc was allocated. */
+ GC gc) /* Graphics context to be released. */
{
Tcl_HashEntry *idHashPtr;
register TkGC *gcPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
if (!dispPtr->gcInit) {
- panic("Tk_FreeGC called before Tk_GetGC");
+ Tcl_Panic("Tk_FreeGC called before Tk_GetGC");
}
if (dispPtr->gcInit < 0) {
/*
- * The GCCleanup has been called, and remaining GCs have been
- * freed. This may still get called by other things shutting
- * down, but the GCs should no longer be in use.
+ * The GCCleanup has been called, and remaining GCs have been freed.
+ * This may still get called by other things shutting down, but the
+ * GCs should no longer be in use.
*/
+
return;
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->gcIdTable, (char *) gc);
if (idHashPtr == NULL) {
- panic("Tk_FreeGC received unknown gc argument");
+ Tcl_Panic("Tk_FreeGC received unknown gc argument");
}
gcPtr = (TkGC *) Tcl_GetHashValue(idHashPtr);
gcPtr->refCount--;
@@ -327,9 +327,8 @@ Tk_FreeGC(display, gc)
*
* TkGCCleanup --
*
- * Frees the structures used for GC management.
- * We need to have it called near the end, when other cleanup that
- * calls Tk_FreeGC is all done.
+ * Frees the structures used for GC management. We need to have it called
+ * near the end, when other cleanup that calls Tk_FreeGC is all done.
*
* Results:
* None.
@@ -341,22 +340,23 @@ Tk_FreeGC(display, gc)
*/
void
-TkGCCleanup(dispPtr)
- TkDisplay *dispPtr; /* display to clean up resources in */
+TkGCCleanup(
+ TkDisplay *dispPtr) /* display to clean up resources in */
{
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
TkGC *gcPtr;
for (entryPtr = Tcl_FirstHashEntry(&dispPtr->gcIdTable, &search);
- entryPtr != NULL;
- entryPtr = Tcl_NextHashEntry(&search)) {
+ entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) {
gcPtr = (TkGC *) Tcl_GetHashValue(entryPtr);
+
/*
- * This call is not needed, as it is only used on Unix to restore
- * the Id to the stack pool, and we don't want to use them anymore.
+ * This call is not needed, as it is only used on Unix to restore the
+ * Id to the stack pool, and we don't want to use them anymore.
* Tk_FreeXId(gcPtr->display, (XID) XGContextFromGC(gcPtr->gc));
*/
+
XFreeGC(gcPtr->display, gcPtr->gc);
Tcl_DeleteHashEntry(gcPtr->valueHashPtr);
Tcl_DeleteHashEntry(entryPtr);
@@ -384,13 +384,21 @@ TkGCCleanup(dispPtr)
*/
static void
-GCInit(dispPtr)
- TkDisplay *dispPtr;
+GCInit(
+ TkDisplay *dispPtr)
{
if (dispPtr->gcInit < 0) {
- panic("called GCInit after GCCleanup");
+ Tcl_Panic("called GCInit after GCCleanup");
}
dispPtr->gcInit = 1;
Tcl_InitHashTable(&dispPtr->gcValueTable, sizeof(ValueKey)/sizeof(int));
Tcl_InitHashTable(&dispPtr->gcIdTable, TCL_ONE_WORD_KEYS);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index d53b6dd..4c8e4f8 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -1,23 +1,22 @@
-/*
+/*
* tkGeometry.c --
*
- * This file contains generic Tk code for geometry management
- * (stuff that's used by all geometry managers).
+ * This file contains generic Tk code for geometry management (stuff
+ * that's used by all geometry managers).
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
- * Data structures of the following type are used by Tk_MaintainGeometry.
- * For each slave managed by Tk_MaintainGeometry, there is one of these
- * structures associated with its master.
+ * Data structures of the following type are used by Tk_MaintainGeometry. For
+ * each slave managed by Tk_MaintainGeometry, there is one of these structures
+ * associated with its master.
*/
typedef struct MaintainSlave {
@@ -29,68 +28,67 @@ typedef struct MaintainSlave {
* master. */
int width, height; /* Desired dimensions of slave. */
struct MaintainSlave *nextPtr;
- /* Next in list of Maintains associated
- * with master. */
+ /* Next in list of Maintains associated with
+ * master. */
} MaintainSlave;
/*
- * For each window that has been specified as a master to
- * Tk_MaintainGeometry, there is a structure of the following type:
+ * For each window that has been specified as a master to Tk_MaintainGeometry,
+ * there is a structure of the following type:
*/
typedef struct MaintainMaster {
- Tk_Window ancestor; /* The lowest ancestor of this window
- * for which we have *not* created a
- * StructureNotify handler. May be the
- * same as the window itself. */
- int checkScheduled; /* Non-zero means that there is already a
- * call to MaintainCheckProc scheduled as
- * an idle handler. */
- MaintainSlave *slavePtr; /* First in list of all slaves associated
- * with this master. */
+ Tk_Window ancestor; /* The lowest ancestor of this window for
+ * which we have *not* created a
+ * StructureNotify handler. May be the same as
+ * the window itself. */
+ int checkScheduled; /* Non-zero means that there is already a call
+ * to MaintainCheckProc scheduled as an idle
+ * handler. */
+ MaintainSlave *slavePtr; /* First in list of all slaves associated with
+ * this master. */
} MaintainMaster;
/*
* Prototypes for static procedures in this file:
*/
-static void MaintainCheckProc _ANSI_ARGS_((ClientData clientData));
-static void MaintainMasterProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void MaintainSlaveProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
+static void MaintainCheckProc(ClientData clientData);
+static void MaintainMasterProc(ClientData clientData,
+ XEvent *eventPtr);
+static void MaintainSlaveProc(ClientData clientData,
+ XEvent *eventPtr);
/*
*--------------------------------------------------------------
*
* Tk_ManageGeometry --
*
- * Arrange for a particular procedure to manage the geometry
- * of a given slave window.
+ * Arrange for a particular procedure to manage the geometry of a given
+ * slave window.
*
* Results:
* None.
*
* Side effects:
- * Proc becomes the new geometry manager for tkwin, replacing
- * any previous geometry manager. The geometry manager will
- * be notified (by calling procedures in *mgrPtr) when interesting
- * things happen in the future. If there was an existing geometry
- * manager for tkwin different from the new one, it is notified
- * by calling its lostSlaveProc.
+ * Proc becomes the new geometry manager for tkwin, replacing any
+ * previous geometry manager. The geometry manager will be notified (by
+ * calling procedures in *mgrPtr) when interesting things happen in the
+ * future. If there was an existing geometry manager for tkwin different
+ * from the new one, it is notified by calling its lostSlaveProc.
*
*--------------------------------------------------------------
*/
void
-Tk_ManageGeometry(tkwin, mgrPtr, clientData)
- Tk_Window tkwin; /* Window whose geometry is to
- * be managed by proc. */
- Tk_GeomMgr *mgrPtr; /* Static structure describing the
- * geometry manager. This structure
- * must never go away. */
- ClientData clientData; /* Arbitrary one-word argument to
- * pass to geometry manager procedures. */
+Tk_ManageGeometry(
+ Tk_Window tkwin, /* Window whose geometry is to be managed by
+ * proc. */
+ CONST Tk_GeomMgr *mgrPtr, /* Static structure describing the geometry
+ * manager. This structure must never go
+ * away. */
+ ClientData clientData) /* Arbitrary one-word argument to pass to
+ * geometry manager procedures. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -110,37 +108,35 @@ Tk_ManageGeometry(tkwin, mgrPtr, clientData)
*
* Tk_GeometryRequest --
*
- * This procedure is invoked by widget code to indicate
- * its preferences about the size of a window it manages.
- * In general, widget code should call this procedure
- * rather than Tk_ResizeWindow.
+ * This procedure is invoked by widget code to indicate its preferences
+ * about the size of a window it manages. In general, widget code should
+ * call this procedure rather than Tk_ResizeWindow.
*
* Results:
* None.
*
* Side effects:
- * The geometry manager for tkwin (if any) is invoked to
- * handle the request. If possible, it will reconfigure
- * tkwin and/or other windows to satisfy the request. The
- * caller gets no indication of success or failure, but it
- * will get X events if the window size was actually
+ * The geometry manager for tkwin (if any) is invoked to handle the
+ * request. If possible, it will reconfigure tkwin and/or other windows
+ * to satisfy the request. The caller gets no indication of success or
+ * failure, but it will get X events if the window size was actually
* changed.
*
*--------------------------------------------------------------
*/
void
-Tk_GeometryRequest(tkwin, reqWidth, reqHeight)
- Tk_Window tkwin; /* Window that geometry information
- * pertains to. */
- int reqWidth, reqHeight; /* Minimum desired dimensions for
- * window, in pixels. */
+Tk_GeometryRequest(
+ Tk_Window tkwin, /* Window that geometry information pertains
+ * to. */
+ int reqWidth, int reqHeight)/* Minimum desired dimensions for window, in
+ * pixels. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
/*
- * X gets very upset if a window requests a width or height of
- * zero, so rounds requested sizes up to at least 1.
+ * X gets very upset if a window requests a width or height of zero, so
+ * rounds requested sizes up to at least 1.
*/
if (reqWidth <= 0) {
@@ -165,9 +161,9 @@ Tk_GeometryRequest(tkwin, reqWidth, reqHeight)
*
* Tk_SetInternalBorderEx --
*
- * Notify relevant geometry managers that a window has an internal
- * border of a given width and that child windows should not be
- * placed on that border.
+ * Notify relevant geometry managers that a window has an internal border
+ * of a given width and that child windows should not be placed on that
+ * border.
*
* Results:
* None.
@@ -181,10 +177,10 @@ Tk_GeometryRequest(tkwin, reqWidth, reqHeight)
*/
void
-Tk_SetInternalBorderEx(tkwin, left, right, top, bottom)
- Tk_Window tkwin; /* Window that will have internal border. */
- int left, right; /* Width of internal border, in pixels. */
- int top, bottom;
+Tk_SetInternalBorderEx(
+ Tk_Window tkwin, /* Window that will have internal border. */
+ int left, int right, /* Width of internal border, in pixels. */
+ int top, int bottom)
{
register TkWindow *winPtr = (TkWindow *) tkwin;
register int changed = 0;
@@ -223,40 +219,40 @@ Tk_SetInternalBorderEx(tkwin, left, right, top, bottom)
/*
* All the slaves for which this is the master window must now be
- * repositioned to take account of the new internal border width.
- * To signal all the geometry managers to do this, just resize the
- * window to its current size. The ConfigureNotify event will
- * cause geometry managers to recompute everything.
+ * repositioned to take account of the new internal border width. To
+ * signal all the geometry managers to do this, just resize the window to
+ * its current size. The ConfigureNotify event will cause geometry
+ * managers to recompute everything.
*/
if (changed) {
Tk_ResizeWindow(tkwin, Tk_Width(tkwin), Tk_Height(tkwin));
}
}
+
/*
*----------------------------------------------------------------------
*
* Tk_SetInternalBorder --
*
- * Notify relevant geometry managers that a window has an internal
- * border of a given width and that child windows should not be
- * placed on that border.
+ * Notify relevant geometry managers that a window has an internal border
+ * of a given width and that child windows should not be placed on that
+ * border.
*
* Results:
* None.
*
* Side effects:
- * The border width is recorded for the window, and all geometry
- * managers of all children are notified so that can re-layout, if
- * necessary.
+ * The border width is recorded for the window, and all geometry managers
+ * of all children are notified so that can re-layout, if necessary.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetInternalBorder(tkwin, width)
- Tk_Window tkwin; /* Window that will have internal border. */
- int width; /* Width of internal border, in pixels. */
+Tk_SetInternalBorder(
+ Tk_Window tkwin, /* Window that will have internal border. */
+ int width) /* Width of internal border, in pixels. */
{
Tk_SetInternalBorderEx(tkwin, width, width, width, width);
}
@@ -266,23 +262,23 @@ Tk_SetInternalBorder(tkwin, width)
*
* Tk_SetMinimumRequestSize --
*
- * Notify relevant geometry managers that a window has a minimum
- * request size.
+ * Notify relevant geometry managers that a window has a minimum request
+ * size.
*
* Results:
* None.
*
* Side effects:
- * The minimum request size is recorded for the window, and
- * a new size is requested for the window, if necessary.
+ * The minimum request size is recorded for the window, and a new size is
+ * requested for the window, if necessary.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetMinimumRequestSize(tkwin, minWidth, minHeight)
- Tk_Window tkwin; /* Window that will have internal border. */
- int minWidth, minHeight; /* Minimum requested size, in pixels. */
+Tk_SetMinimumRequestSize(
+ Tk_Window tkwin, /* Window that will have internal border. */
+ int minWidth, int minHeight)/* Minimum requested size, in pixels. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -295,11 +291,11 @@ Tk_SetMinimumRequestSize(tkwin, minWidth, minHeight)
winPtr->minReqHeight = minHeight;
/*
- * The changed min size may cause geometry managers to get a
- * different result, so make them recompute.
- * To signal all the geometry managers to do this, just resize the
- * window to its current size. The ConfigureNotify event will
- * cause geometry managers to recompute everything.
+ * The changed min size may cause geometry managers to get a different
+ * result, so make them recompute. To signal all the geometry managers to
+ * do this, just resize the window to its current size. The
+ * ConfigureNotify event will cause geometry managers to recompute
+ * everything.
*/
Tk_ResizeWindow(tkwin, Tk_Width(tkwin), Tk_Height(tkwin));
@@ -310,40 +306,40 @@ Tk_SetMinimumRequestSize(tkwin, minWidth, minHeight)
*
* Tk_MaintainGeometry --
*
- * This procedure is invoked by geometry managers to handle slaves
- * whose master's are not their parents. It translates the desired
- * geometry for the slave into the coordinate system of the parent
- * and respositions the slave if it isn't already at the right place.
- * Furthermore, it sets up event handlers so that if the master (or
- * any of its ancestors up to the slave's parent) is mapped, unmapped,
- * or moved, then the slave will be adjusted to match.
+ * This procedure is invoked by geometry managers to handle slaves whose
+ * master's are not their parents. It translates the desired geometry for
+ * the slave into the coordinate system of the parent and respositions
+ * the slave if it isn't already at the right place. Furthermore, it sets
+ * up event handlers so that if the master (or any of its ancestors up to
+ * the slave's parent) is mapped, unmapped, or moved, then the slave will
+ * be adjusted to match.
*
* Results:
* None.
*
* Side effects:
- * Event handlers are created and state is allocated to keep track
- * of slave. Note: if slave was already managed for master by
- * Tk_MaintainGeometry, then the previous information is replaced
- * with the new information. The caller must eventually call
- * Tk_UnmaintainGeometry to eliminate the correspondence (or, the
- * state is automatically freed when either window is destroyed).
+ * Event handlers are created and state is allocated to keep track of
+ * slave. Note: if slave was already managed for master by
+ * Tk_MaintainGeometry, then the previous information is replaced with
+ * the new information. The caller must eventually call
+ * Tk_UnmaintainGeometry to eliminate the correspondence (or, the state
+ * is automatically freed when either window is destroyed).
*
*----------------------------------------------------------------------
*/
void
-Tk_MaintainGeometry(slave, master, x, y, width, height)
- Tk_Window slave; /* Slave for geometry management. */
- Tk_Window master; /* Master for slave; must be a descendant
- * of slave's parent. */
- int x, y; /* Desired position of slave within master. */
- int width, height; /* Desired dimensions for slave. */
+Tk_MaintainGeometry(
+ Tk_Window slave, /* Slave for geometry management. */
+ Tk_Window master, /* Master for slave; must be a descendant of
+ * slave's parent. */
+ int x, int y, /* Desired position of slave within master. */
+ int width, int height) /* Desired dimensions for slave. */
{
Tcl_HashEntry *hPtr;
MaintainMaster *masterPtr;
register MaintainSlave *slavePtr;
- int new, map;
+ int isNew, map;
Tk_Window ancestor, parent;
TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr;
@@ -354,6 +350,7 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
* call to Tk_MoveResizeWindow; the parent/child relationship will
* take care of the rest.
*/
+
Tk_MoveResizeWindow(slave, x, y, width, height);
/*
@@ -361,6 +358,7 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
* until the master is mapped later (in which case mapping the slave
* is taken care of elsewhere).
*/
+
if (Tk_IsMapped(master)) {
Tk_MapWindow(slave);
}
@@ -373,14 +371,14 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
}
/*
- * See if there is already a MaintainMaster structure for the master;
- * if not, then create one.
+ * See if there is already a MaintainMaster structure for the master; if
+ * not, then create one.
*/
parent = Tk_Parent(slave);
- hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable,
- (char *) master, &new);
- if (!new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable,
+ (char *) master, &isNew);
+ if (!isNew) {
masterPtr = (MaintainMaster *) Tcl_GetHashValue(hPtr);
} else {
masterPtr = (MaintainMaster *) ckalloc(sizeof(MaintainMaster));
@@ -391,8 +389,8 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
}
/*
- * Create a MaintainSlave structure for the slave if there isn't
- * already one.
+ * Create a MaintainSlave structure for the slave if there isn't already
+ * one.
*/
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
@@ -410,10 +408,10 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
(ClientData) slavePtr);
/*
- * Make sure that there are event handlers registered for all
- * the windows between master and slave's parent (including master
- * but not slave's parent). There may already be handlers for master
- * and some of its ancestors (masterPtr->ancestor tells how many).
+ * Make sure that there are event handlers registered for all the windows
+ * between master and slave's parent (including master but not slave's
+ * parent). There may already be handlers for master and some of its
+ * ancestors (masterPtr->ancestor tells how many).
*/
for (ancestor = master; ancestor != parent;
@@ -426,11 +424,11 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
}
/*
- * Fill in up-to-date information in the structure, then update the
- * window if it's not currently in the right place or state.
+ * Fill in up-to-date information in the structure, then update the window
+ * if it's not currently in the right place or state.
*/
- gotSlave:
+ gotSlave:
slavePtr->x = x;
slavePtr->y = y;
slavePtr->width = width;
@@ -464,26 +462,25 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
*
* Tk_UnmaintainGeometry --
*
- * This procedure cancels a previous Tk_MaintainGeometry call,
- * so that the relationship between slave and master is no longer
- * maintained.
+ * This procedure cancels a previous Tk_MaintainGeometry call, so that
+ * the relationship between slave and master is no longer maintained.
*
* Results:
* None.
*
* Side effects:
- * The slave is unmapped and state is released, so that slave won't
- * track master any more. If we weren't previously managing slave
- * relative to master, then this procedure has no effect.
+ * The slave is unmapped and state is released, so that slave won't track
+ * master any more. If we weren't previously managing slave relative to
+ * master, then this procedure has no effect.
*
*----------------------------------------------------------------------
*/
void
-Tk_UnmaintainGeometry(slave, master)
- Tk_Window slave; /* Slave for geometry management. */
- Tk_Window master; /* Master for slave; must be a descendant
- * of slave's parent. */
+Tk_UnmaintainGeometry(
+ Tk_Window slave, /* Slave for geometry management. */
+ Tk_Window master) /* Master for slave; must be a descendant of
+ * slave's parent. */
{
Tcl_HashEntry *hPtr;
MaintainMaster *masterPtr;
@@ -495,11 +492,11 @@ Tk_UnmaintainGeometry(slave, master)
/*
* If the slave is a direct descendant of the master,
* Tk_MaintainGeometry will not have set up any of the extra
- * infrastructure. Don't even bother to look for it, just return.
+ * infrastructure. Don't even bother to look for it, just return.
*/
return;
}
-
+
if (!dispPtr->geomInit) {
dispPtr->geomInit = 1;
Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS);
@@ -554,27 +551,27 @@ Tk_UnmaintainGeometry(slave, master)
*
* MaintainMasterProc --
*
- * This procedure is invoked by the Tk event dispatcher in
- * response to StructureNotify events on the master or one
- * of its ancestors, on behalf of Tk_MaintainGeometry.
+ * This procedure is invoked by the Tk event dispatcher in response to
+ * StructureNotify events on the master or one of its ancestors, on
+ * behalf of Tk_MaintainGeometry.
*
* Results:
* None.
*
* Side effects:
- * It schedules a call to MaintainCheckProc, which will eventually
- * caused the postions and mapped states to be recalculated for all
- * the maintained slaves of the master. Or, if the master window is
- * being deleted then state is cleaned up.
+ * It schedules a call to MaintainCheckProc, which will eventually caused
+ * the postions and mapped states to be recalculated for all the
+ * maintained slaves of the master. Or, if the master window is being
+ * deleted then state is cleaned up.
*
*----------------------------------------------------------------------
*/
static void
-MaintainMasterProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to MaintainMaster structure
- * for the master window. */
- XEvent *eventPtr; /* Describes what just happened. */
+MaintainMasterProc(
+ ClientData clientData, /* Pointer to MaintainMaster structure for the
+ * master window. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
MaintainMaster *masterPtr = (MaintainMaster *) clientData;
MaintainSlave *slavePtr;
@@ -589,9 +586,9 @@ MaintainMasterProc(clientData, eventPtr)
}
} else if (eventPtr->type == DestroyNotify) {
/*
- * Delete all of the state associated with this master, but
- * be careful not to use masterPtr after the last slave is
- * deleted, since its memory will have been freed.
+ * Delete all of the state associated with this master, but be careful
+ * not to use masterPtr after the last slave is deleted, since its
+ * memory will have been freed.
*/
done = 0;
@@ -610,25 +607,25 @@ MaintainMasterProc(clientData, eventPtr)
*
* MaintainSlaveProc --
*
- * This procedure is invoked by the Tk event dispatcher in
- * response to StructureNotify events on a slave being managed
- * by Tk_MaintainGeometry.
+ * This procedure is invoked by the Tk event dispatcher in response to
+ * StructureNotify events on a slave being managed by
+ * Tk_MaintainGeometry.
*
* Results:
* None.
*
* Side effects:
- * If the event is a DestroyNotify event then the Maintain state
- * and event handlers for this slave are deleted.
+ * If the event is a DestroyNotify event then the Maintain state and
+ * event handlers for this slave are deleted.
*
*----------------------------------------------------------------------
*/
static void
-MaintainSlaveProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to MaintainSlave structure
- * for master-slave pair. */
- XEvent *eventPtr; /* Describes what just happened. */
+MaintainSlaveProc(
+ ClientData clientData, /* Pointer to MaintainSlave structure for
+ * master-slave pair. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
MaintainSlave *slavePtr = (MaintainSlave *) clientData;
@@ -642,12 +639,11 @@ MaintainSlaveProc(clientData, eventPtr)
*
* MaintainCheckProc --
*
- * This procedure is invoked by the Tk event dispatcher as an
- * idle handler, when a master or one of its ancestors has been
- * reconfigured, mapped, or unmapped. Its job is to scan all of
- * the slaves for the master and reposition them, map them, or
- * unmap them as needed to maintain their geometry relative to
- * the master.
+ * This procedure is invoked by the Tk event dispatcher as an idle
+ * handler, when a master or one of its ancestors has been reconfigured,
+ * mapped, or unmapped. Its job is to scan all of the slaves for the
+ * master and reposition them, map them, or unmap them as needed to
+ * maintain their geometry relative to the master.
*
* Results:
* None.
@@ -659,9 +655,9 @@ MaintainSlaveProc(clientData, eventPtr)
*/
static void
-MaintainCheckProc(clientData)
- ClientData clientData; /* Pointer to MaintainMaster structure
- * for the master window. */
+MaintainCheckProc(
+ ClientData clientData) /* Pointer to MaintainMaster structure for the
+ * master window. */
{
MaintainMaster *masterPtr = (MaintainMaster *) clientData;
MaintainSlave *slavePtr;
@@ -696,3 +692,11 @@ MaintainCheckProc(clientData)
}
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 10643ea..9fc0d50 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -1,27 +1,25 @@
-/*
+/*
* tkGet.c --
*
- * This file contains a number of "Tk_GetXXX" procedures, which
- * parse text strings into useful forms for Tk. This file has
- * the simpler procedures, like Tk_GetDirection and Tk_GetUid.
- * The more complex procedures like Tk_GetColor are in separate
- * files.
+ * This file contains a number of "Tk_GetXXX" procedures, which parse
+ * text strings into useful forms for Tk. This file has the simpler
+ * functions, like Tk_GetDirection and Tk_GetUid. The more complex
+ * functions like Tk_GetColor are in separate files.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
/*
- * One of these structures is created per thread to store
- * thread-specific data. In this case, it is used to house the
- * Tk_Uid structs used by each thread. The "dataKey" below is
- * used to locate the ThreadSpecificData for the current thread.
+ * One of these structures is created per thread to store thread-specific
+ * data. In this case, it is used to house the Tk_Uid structs used by each
+ * thread. The "dataKey" below is used to locate the ThreadSpecificData for
+ * the current thread.
*/
typedef struct ThreadSpecificData {
@@ -30,7 +28,7 @@ typedef struct ThreadSpecificData {
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-static void FreeUidThreadExitProc _ANSI_ARGS_((ClientData clientData));
+static void FreeUidThreadExitProc(ClientData clientData);
/*
* The following tables defines the string values for reliefs, which are
@@ -38,12 +36,11 @@ static void FreeUidThreadExitProc _ANSI_ARGS_((ClientData clientData));
*/
static CONST char *anchorStrings[] = {
- "n", "ne", "e", "se", "s", "sw", "w", "nw", "center", (char *) NULL
+ "n", "ne", "e", "se", "s", "sw", "w", "nw", "center", NULL
};
static CONST char *justifyStrings[] = {
- "left", "right", "center", (char *) NULL
+ "left", "right", "center", NULL
};
-
/*
*----------------------------------------------------------------------
@@ -64,17 +61,17 @@ static CONST char *justifyStrings[] = {
*/
int
-Tk_GetAnchorFromObj(interp, objPtr, anchorPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *objPtr; /* The object we are trying to get the
- * value from. */
- Tk_Anchor *anchorPtr; /* Where to place the Tk_Anchor that
+Tk_GetAnchorFromObj(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *objPtr, /* The object we are trying to get the value
+ * from. */
+ Tk_Anchor *anchorPtr) /* Where to place the Tk_Anchor that
* corresponds to the string value of
* objPtr. */
{
int index, code;
- code = Tcl_GetIndexFromObj(interp, objPtr, anchorStrings, "anchor", 0,
+ code = Tcl_GetIndexFromObj(interp, objPtr, anchorStrings, "anchor", 0,
&index);
if (code == TCL_OK) {
*anchorPtr = (Tk_Anchor) index;
@@ -90,11 +87,10 @@ Tk_GetAnchorFromObj(interp, objPtr, anchorPtr)
* Given a string, return the corresponding Tk_Anchor.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * position is stored at *anchorPtr; otherwise TCL_ERROR
- * is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the position is stored at
+ * *anchorPtr; otherwise TCL_ERROR is returned and an error message is
+ * left in the interp's result.
*
* Side effects:
* None.
@@ -103,62 +99,61 @@ Tk_GetAnchorFromObj(interp, objPtr, anchorPtr)
*/
int
-Tk_GetAnchor(interp, string, anchorPtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- CONST char *string; /* String describing a direction. */
- Tk_Anchor *anchorPtr; /* Where to store Tk_Anchor corresponding
- * to string. */
+Tk_GetAnchor(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ CONST char *string, /* String describing a direction. */
+ Tk_Anchor *anchorPtr) /* Where to store Tk_Anchor corresponding to
+ * string. */
{
switch (string[0]) {
- case 'n':
- if (string[1] == 0) {
- *anchorPtr = TK_ANCHOR_N;
- return TCL_OK;
- } else if ((string[1] == 'e') && (string[2] == 0)) {
- *anchorPtr = TK_ANCHOR_NE;
- return TCL_OK;
- } else if ((string[1] == 'w') && (string[2] == 0)) {
- *anchorPtr = TK_ANCHOR_NW;
- return TCL_OK;
- }
- goto error;
- case 's':
- if (string[1] == 0) {
- *anchorPtr = TK_ANCHOR_S;
- return TCL_OK;
- } else if ((string[1] == 'e') && (string[2] == 0)) {
- *anchorPtr = TK_ANCHOR_SE;
- return TCL_OK;
- } else if ((string[1] == 'w') && (string[2] == 0)) {
- *anchorPtr = TK_ANCHOR_SW;
- return TCL_OK;
- } else {
- goto error;
- }
- case 'e':
- if (string[1] == 0) {
- *anchorPtr = TK_ANCHOR_E;
- return TCL_OK;
- }
- goto error;
- case 'w':
- if (string[1] == 0) {
- *anchorPtr = TK_ANCHOR_W;
- return TCL_OK;
- }
- goto error;
- case 'c':
- if (strncmp(string, "center", strlen(string)) == 0) {
- *anchorPtr = TK_ANCHOR_CENTER;
- return TCL_OK;
- }
+ case 'n':
+ if (string[1] == 0) {
+ *anchorPtr = TK_ANCHOR_N;
+ return TCL_OK;
+ } else if ((string[1] == 'e') && (string[2] == 0)) {
+ *anchorPtr = TK_ANCHOR_NE;
+ return TCL_OK;
+ } else if ((string[1] == 'w') && (string[2] == 0)) {
+ *anchorPtr = TK_ANCHOR_NW;
+ return TCL_OK;
+ }
+ goto error;
+ case 's':
+ if (string[1] == 0) {
+ *anchorPtr = TK_ANCHOR_S;
+ return TCL_OK;
+ } else if ((string[1] == 'e') && (string[2] == 0)) {
+ *anchorPtr = TK_ANCHOR_SE;
+ return TCL_OK;
+ } else if ((string[1] == 'w') && (string[2] == 0)) {
+ *anchorPtr = TK_ANCHOR_SW;
+ return TCL_OK;
+ } else {
goto error;
+ }
+ case 'e':
+ if (string[1] == 0) {
+ *anchorPtr = TK_ANCHOR_E;
+ return TCL_OK;
+ }
+ goto error;
+ case 'w':
+ if (string[1] == 0) {
+ *anchorPtr = TK_ANCHOR_W;
+ return TCL_OK;
+ }
+ goto error;
+ case 'c':
+ if (strncmp(string, "center", strlen(string)) == 0) {
+ *anchorPtr = TK_ANCHOR_CENTER;
+ return TCL_OK;
+ }
+ goto error;
}
- error:
+ error:
Tcl_AppendResult(interp, "bad anchor position \"", string,
- "\": must be n, ne, e, se, s, sw, w, nw, or center",
- (char *) NULL);
+ "\": must be n, ne, e, se, s, sw, w, nw, or center", NULL);
return TCL_ERROR;
}
@@ -167,8 +162,7 @@ Tk_GetAnchor(interp, string, anchorPtr)
*
* Tk_NameOfAnchor --
*
- * Given a Tk_Anchor, return the string that corresponds
- * to it.
+ * Given a Tk_Anchor, return the string that corresponds to it.
*
* Results:
* None.
@@ -180,20 +174,20 @@ Tk_GetAnchor(interp, string, anchorPtr)
*/
CONST char *
-Tk_NameOfAnchor(anchor)
- Tk_Anchor anchor; /* Anchor for which identifying string
- * is desired. */
+Tk_NameOfAnchor(
+ Tk_Anchor anchor) /* Anchor for which identifying string is
+ * desired. */
{
switch (anchor) {
- case TK_ANCHOR_N: return "n";
- case TK_ANCHOR_NE: return "ne";
- case TK_ANCHOR_E: return "e";
- case TK_ANCHOR_SE: return "se";
- case TK_ANCHOR_S: return "s";
- case TK_ANCHOR_SW: return "sw";
- case TK_ANCHOR_W: return "w";
- case TK_ANCHOR_NW: return "nw";
- case TK_ANCHOR_CENTER: return "center";
+ case TK_ANCHOR_N: return "n";
+ case TK_ANCHOR_NE: return "ne";
+ case TK_ANCHOR_E: return "e";
+ case TK_ANCHOR_SE: return "se";
+ case TK_ANCHOR_S: return "s";
+ case TK_ANCHOR_SW: return "sw";
+ case TK_ANCHOR_W: return "w";
+ case TK_ANCHOR_NW: return "nw";
+ case TK_ANCHOR_CENTER: return "center";
}
return "unknown anchor position";
}
@@ -206,11 +200,10 @@ Tk_NameOfAnchor(anchor)
* Given a string, return the corresponding Tk JoinStyle.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * justification is stored at *joinPtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the justification is stored at
+ * *joinPtr; otherwise TCL_ERROR is returned and an error message is left
+ * in the interp's result.
*
* Side effects:
* None.
@@ -219,11 +212,11 @@ Tk_NameOfAnchor(anchor)
*/
int
-Tk_GetJoinStyle(interp, string, joinPtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- CONST char *string; /* String describing a justification style. */
- int *joinPtr; /* Where to store join style corresponding
- * to string. */
+Tk_GetJoinStyle(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ CONST char *string, /* String describing a justification style. */
+ int *joinPtr) /* Where to store join style corresponding to
+ * string. */
{
int c;
size_t length;
@@ -245,8 +238,7 @@ Tk_GetJoinStyle(interp, string, joinPtr)
}
Tcl_AppendResult(interp, "bad join style \"", string,
- "\": must be bevel, miter, or round",
- (char *) NULL);
+ "\": must be bevel, miter, or round", NULL);
return TCL_ERROR;
}
@@ -255,8 +247,7 @@ Tk_GetJoinStyle(interp, string, joinPtr)
*
* Tk_NameOfJoinStyle --
*
- * Given a Tk JoinStyle, return the string that corresponds
- * to it.
+ * Given a Tk JoinStyle, return the string that corresponds to it.
*
* Results:
* None.
@@ -268,14 +259,14 @@ Tk_GetJoinStyle(interp, string, joinPtr)
*/
CONST char *
-Tk_NameOfJoinStyle(join)
- int join; /* Join style for which identifying string
- * is desired. */
+Tk_NameOfJoinStyle(
+ int join) /* Join style for which identifying string is
+ * desired. */
{
switch (join) {
- case JoinBevel: return "bevel";
- case JoinMiter: return "miter";
- case JoinRound: return "round";
+ case JoinBevel: return "bevel";
+ case JoinMiter: return "miter";
+ case JoinRound: return "round";
}
return "unknown join style";
}
@@ -288,11 +279,10 @@ Tk_NameOfJoinStyle(join)
* Given a string, return the corresponding Tk CapStyle.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * justification is stored at *capPtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the justification is stored at
+ * *capPtr; otherwise TCL_ERROR is returned and an error message is left
+ * in the interp's result.
*
* Side effects:
* None.
@@ -301,11 +291,11 @@ Tk_NameOfJoinStyle(join)
*/
int
-Tk_GetCapStyle(interp, string, capPtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- CONST char *string; /* String describing a justification style. */
- int *capPtr; /* Where to store cap style corresponding
- * to string. */
+Tk_GetCapStyle(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ CONST char *string, /* String describing a justification style. */
+ int *capPtr) /* Where to store cap style corresponding to
+ * string. */
{
int c;
size_t length;
@@ -327,8 +317,7 @@ Tk_GetCapStyle(interp, string, capPtr)
}
Tcl_AppendResult(interp, "bad cap style \"", string,
- "\": must be butt, projecting, or round",
- (char *) NULL);
+ "\": must be butt, projecting, or round", NULL);
return TCL_ERROR;
}
@@ -337,8 +326,7 @@ Tk_GetCapStyle(interp, string, capPtr)
*
* Tk_NameOfCapStyle --
*
- * Given a Tk CapStyle, return the string that corresponds
- * to it.
+ * Given a Tk CapStyle, return the string that corresponds to it.
*
* Results:
* None.
@@ -350,14 +338,14 @@ Tk_GetCapStyle(interp, string, capPtr)
*/
CONST char *
-Tk_NameOfCapStyle(cap)
- int cap; /* Cap style for which identifying string
- * is desired. */
+Tk_NameOfCapStyle(
+ int cap) /* Cap style for which identifying string is
+ * desired. */
{
switch (cap) {
- case CapButt: return "butt";
- case CapProjecting: return "projecting";
- case CapRound: return "round";
+ case CapButt: return "butt";
+ case CapProjecting: return "projecting";
+ case CapRound: return "round";
}
return "unknown cap style";
}
@@ -381,11 +369,11 @@ Tk_NameOfCapStyle(cap)
*/
int
-Tk_GetJustifyFromObj(interp, objPtr, justifyPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *objPtr; /* The object we are trying to get the
- * value from. */
- Tk_Justify *justifyPtr; /* Where to place the Tk_Justify that
+Tk_GetJustifyFromObj(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *objPtr, /* The object we are trying to get the value
+ * from. */
+ Tk_Justify *justifyPtr) /* Where to place the Tk_Justify that
* corresponds to the string value of
* objPtr. */
{
@@ -407,11 +395,10 @@ Tk_GetJustifyFromObj(interp, objPtr, justifyPtr)
* Given a string, return the corresponding Tk_Justify.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * justification is stored at *justifyPtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the justification is stored at
+ * *justifyPtr; otherwise TCL_ERROR is returned and an error message is
+ * left in the interp's result.
*
* Side effects:
* None.
@@ -420,11 +407,11 @@ Tk_GetJustifyFromObj(interp, objPtr, justifyPtr)
*/
int
-Tk_GetJustify(interp, string, justifyPtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- CONST char *string; /* String describing a justification style. */
- Tk_Justify *justifyPtr; /* Where to store Tk_Justify corresponding
- * to string. */
+Tk_GetJustify(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ CONST char *string, /* String describing a justification style. */
+ Tk_Justify *justifyPtr) /* Where to store Tk_Justify corresponding to
+ * string. */
{
int c;
size_t length;
@@ -446,8 +433,7 @@ Tk_GetJustify(interp, string, justifyPtr)
}
Tcl_AppendResult(interp, "bad justification \"", string,
- "\": must be left, right, or center",
- (char *) NULL);
+ "\": must be left, right, or center", NULL);
return TCL_ERROR;
}
@@ -469,14 +455,14 @@ Tk_GetJustify(interp, string, justifyPtr)
*/
CONST char *
-Tk_NameOfJustify(justify)
- Tk_Justify justify; /* Justification style for which
- * identifying string is desired. */
+Tk_NameOfJustify(
+ Tk_Justify justify) /* Justification style for which identifying
+ * string is desired. */
{
switch (justify) {
- case TK_JUSTIFY_LEFT: return "left";
- case TK_JUSTIFY_RIGHT: return "right";
- case TK_JUSTIFY_CENTER: return "center";
+ case TK_JUSTIFY_LEFT: return "left";
+ case TK_JUSTIFY_RIGHT: return "right";
+ case TK_JUSTIFY_CENTER: return "center";
}
return "unknown justification style";
}
@@ -498,10 +484,10 @@ Tk_NameOfJustify(justify)
*/
static void
-FreeUidThreadExitProc(clientData)
- ClientData clientData; /* Not used. */
+FreeUidThreadExitProc(
+ ClientData clientData) /* Not used. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DeleteHashTable(&tsdPtr->uidTable);
tsdPtr->initialized = 0;
@@ -512,17 +498,16 @@ FreeUidThreadExitProc(clientData)
*
* Tk_GetUid --
*
- * Given a string, this procedure returns a unique identifier
- * for the string.
+ * Given a string, this function returns a unique identifier for the
+ * string.
*
* Results:
- * This procedure returns a Tk_Uid corresponding to the "string"
- * argument. The Tk_Uid has a string value identical to string
- * (strcmp will return 0), but it's guaranteed that any other
- * calls to this procedure with a string equal to "string" will
- * return exactly the same result (i.e. can compare Tk_Uid
- * *values* directly, without having to call strcmp on what they
- * point to).
+ * This function returns a Tk_Uid corresponding to the "string" argument.
+ * The Tk_Uid has a string value identical to string (strcmp will return
+ * 0), but it's guaranteed that any other calls to this function with a
+ * string equal to "string" will return exactly the same result (i.e. can
+ * compare Tk_Uid *values* directly, without having to call strcmp on
+ * what they point to).
*
* Side effects:
* New information may be entered into the identifier table.
@@ -531,11 +516,11 @@ FreeUidThreadExitProc(clientData)
*/
Tk_Uid
-Tk_GetUid(string)
- CONST char *string; /* String to convert. */
+Tk_GetUid(
+ CONST char *string) /* String to convert. */
{
int dummy;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashTable *tablePtr = &tsdPtr->uidTable;
@@ -553,15 +538,14 @@ Tk_GetUid(string)
*
* Tk_GetScreenMM --
*
- * Given a string, returns the number of screen millimeters
- * corresponding to that string.
+ * Given a string, returns the number of screen millimeters corresponding
+ * to that string.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * screen distance is stored at *doublePtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the screen distance is stored
+ * at *doublePtr; otherwise TCL_ERROR is returned and an error message is
+ * left in the interp's result.
*
* Side effects:
* None.
@@ -570,13 +554,13 @@ Tk_GetUid(string)
*/
int
-Tk_GetScreenMM(interp, tkwin, string, doublePtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- Tk_Window tkwin; /* Window whose screen determines conversion
+Tk_GetScreenMM(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ Tk_Window tkwin, /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- CONST char *string; /* String describing a screen distance. */
- double *doublePtr; /* Place to store converted result. */
+ CONST char *string, /* String describing a screen distance. */
+ double *doublePtr) /* Place to store converted result. */
{
char *end;
double d;
@@ -584,35 +568,34 @@ Tk_GetScreenMM(interp, tkwin, string, doublePtr)
d = strtod(string, &end);
if (end == string) {
error:
- Tcl_AppendResult(interp, "bad screen distance \"", string,
- "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "bad screen distance \"", string, "\"", NULL);
return TCL_ERROR;
}
while ((*end != '\0') && isspace(UCHAR(*end))) {
end++;
}
switch (*end) {
- case 0:
- d /= WidthOfScreen(Tk_Screen(tkwin));
- d *= WidthMMOfScreen(Tk_Screen(tkwin));
- break;
- case 'c':
- d *= 10;
- end++;
- break;
- case 'i':
- d *= 25.4;
- end++;
- break;
- case 'm':
- end++;
- break;
- case 'p':
- d *= 25.4/72.0;
- end++;
- break;
- default:
- goto error;
+ case 0:
+ d /= WidthOfScreen(Tk_Screen(tkwin));
+ d *= WidthMMOfScreen(Tk_Screen(tkwin));
+ break;
+ case 'c':
+ d *= 10;
+ end++;
+ break;
+ case 'i':
+ d *= 25.4;
+ end++;
+ break;
+ case 'm':
+ end++;
+ break;
+ case 'p':
+ d *= 25.4/72.0;
+ end++;
+ break;
+ default:
+ goto error;
}
while ((*end != '\0') && isspace(UCHAR(*end))) {
end++;
@@ -629,15 +612,14 @@ Tk_GetScreenMM(interp, tkwin, string, doublePtr)
*
* Tk_GetPixels --
*
- * Given a string, returns the number of pixels corresponding
- * to that string.
+ * Given a string, returns the number of pixels corresponding to that
+ * string.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * rounded pixel distance is stored at *intPtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * the interp's result.
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the rounded pixel distance is
+ * stored at *intPtr; otherwise TCL_ERROR is returned and an error
+ * message is left in the interp's result.
*
* Side effects:
* None.
@@ -646,13 +628,13 @@ Tk_GetScreenMM(interp, tkwin, string, doublePtr)
*/
int
-Tk_GetPixels(interp, tkwin, string, intPtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- Tk_Window tkwin; /* Window whose screen determines conversion
+Tk_GetPixels(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ Tk_Window tkwin, /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- CONST char *string; /* String describing a number of pixels. */
- int *intPtr; /* Place to store converted result. */
+ CONST char *string, /* String describing a number of pixels. */
+ int *intPtr) /* Place to store converted result. */
{
double d;
@@ -672,15 +654,15 @@ Tk_GetPixels(interp, tkwin, string, intPtr)
*
* TkGetDoublePixels --
*
- * Given a string, returns the number of pixels corresponding
- * to that string.
+ * Given a string, returns the number of pixels corresponding to that
+ * string.
*
* Results:
- * The return value is a standard Tcl return result. If
- * TCL_OK is returned, then everything went well and the
- * pixel distance is stored at *doublePtr; otherwise
- * TCL_ERROR is returned and an error message is left in
- * interp->result.
+
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the pixel distance is stored
+ * at *doublePtr; otherwise TCL_ERROR is returned and an error message is
+ * left in interp->result.
*
* Side effects:
* None.
@@ -689,52 +671,51 @@ Tk_GetPixels(interp, tkwin, string, intPtr)
*/
int
-TkGetDoublePixels(interp, tkwin, string, doublePtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- Tk_Window tkwin; /* Window whose screen determines conversion
+TkGetDoublePixels(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ Tk_Window tkwin, /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- CONST char *string; /* String describing a number of pixels. */
- double *doublePtr; /* Place to store converted result. */
+ CONST char *string, /* String describing a number of pixels. */
+ double *doublePtr) /* Place to store converted result. */
{
char *end;
double d;
d = strtod((char *) string, &end);
if (end == string) {
- error:
- Tcl_AppendResult(interp, "bad screen distance \"", string,
- "\"", (char *) NULL);
+ error:
+ Tcl_AppendResult(interp, "bad screen distance \"", string, "\"", NULL);
return TCL_ERROR;
}
while ((*end != '\0') && isspace(UCHAR(*end))) {
end++;
}
switch (*end) {
- case 0:
- break;
- case 'c':
- d *= 10*WidthOfScreen(Tk_Screen(tkwin));
- d /= WidthMMOfScreen(Tk_Screen(tkwin));
- end++;
- break;
- case 'i':
- d *= 25.4*WidthOfScreen(Tk_Screen(tkwin));
- d /= WidthMMOfScreen(Tk_Screen(tkwin));
- end++;
- break;
- case 'm':
- d *= WidthOfScreen(Tk_Screen(tkwin));
- d /= WidthMMOfScreen(Tk_Screen(tkwin));
- end++;
- break;
- case 'p':
- d *= (25.4/72.0)*WidthOfScreen(Tk_Screen(tkwin));
- d /= WidthMMOfScreen(Tk_Screen(tkwin));
- end++;
- break;
- default:
- goto error;
+ case 0:
+ break;
+ case 'c':
+ d *= 10*WidthOfScreen(Tk_Screen(tkwin));
+ d /= WidthMMOfScreen(Tk_Screen(tkwin));
+ end++;
+ break;
+ case 'i':
+ d *= 25.4*WidthOfScreen(Tk_Screen(tkwin));
+ d /= WidthMMOfScreen(Tk_Screen(tkwin));
+ end++;
+ break;
+ case 'm':
+ d *= WidthOfScreen(Tk_Screen(tkwin));
+ d /= WidthMMOfScreen(Tk_Screen(tkwin));
+ end++;
+ break;
+ case 'p':
+ d *= (25.4/72.0)*WidthOfScreen(Tk_Screen(tkwin));
+ d /= WidthMMOfScreen(Tk_Screen(tkwin));
+ end++;
+ break;
+ default:
+ goto error;
}
while ((*end != '\0') && isspace(UCHAR(*end))) {
end++;
@@ -745,5 +726,11 @@ TkGetDoublePixels(interp, tkwin, string, doublePtr)
*doublePtr = d;
return TCL_OK;
}
-
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 3f4748c..57f8614 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -1,45 +1,42 @@
-/*
+/*
* tkGrab.c --
*
- * This file provides procedures that implement grabs for Tk.
+ * This file provides functions that implement grabs for Tk.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif
/*
- * The grab state machine has four states: ungrabbed, button pressed,
- * grabbed, and button pressed while grabbed. In addition, there are
- * three pieces of grab state information: the current grab window,
- * the current restrict window, and whether the mouse is captured.
- *
- * The current grab window specifies the point in the Tk window
- * heirarchy above which pointer events will not be reported. Any
- * window within the subtree below the grab window will continue to
- * receive events as normal. Events outside of the grab tree will be
- * reported to the grab window.
- *
- * If the current restrict window is set, then all pointer events will
- * be reported only to the restrict window. The restrict window is
- * normally set during an automatic button grab.
- *
- * The mouse capture state specifies whether the window system will
- * report mouse events outside of any Tk toplevels. This is set
- * during a global grab or an automatic button grab.
- *
- * The transitions between different states is given in the following
- * table:
- *
+ * The grab state machine has four states: ungrabbed, button pressed, grabbed,
+ * and button pressed while grabbed. In addition, there are three pieces of
+ * grab state information: the current grab window, the current restrict
+ * window, and whether the mouse is captured.
+ *
+ * The current grab window specifies the point in the Tk window heirarchy
+ * above which pointer events will not be reported. Any window within the
+ * subtree below the grab window will continue to receive events as normal.
+ * Events outside of the grab tree will be reported to the grab window.
+ *
+ * If the current restrict window is set, then all pointer events will be
+ * reported only to the restrict window. The restrict window is normally set
+ * during an automatic button grab.
+ *
+ * The mouse capture state specifies whether the window system will report
+ * mouse events outside of any Tk toplevels. This is set during a global grab
+ * or an automatic button grab.
+ *
+ * The transitions between different states is given in the following table:
+ *
* Event\State U B G GB
* ----------- -- -- -- --
* FirstPress B B GB GB
@@ -60,15 +57,14 @@
* Grabbed 1 0 b/g
* Grab and Button 1 1 1
*
- * Note: 0 means variable is set to NULL, 1 means variable is set to
- * some window, b/g means the variable is set to a window if a button
- * is currently down or a global grab is in effect.
+ * Note: 0 means variable is set to NULL, 1 means variable is set to some
+ * window, b/g means the variable is set to a window if a button is currently
+ * down or a global grab is in effect.
*
- * The final complication to all of this is enter and leave events.
- * In order to correctly handle all of the various cases, Tk cannot
- * rely on X enter/leave events in all situations. The following
- * describes the correct sequence of enter and leave events that
- * should be observed by Tk scripts:
+ * The final complication to all of this is enter and leave events. In order
+ * to correctly handle all of the various cases, Tk cannot rely on X
+ * enter/leave events in all situations. The following describes the correct
+ * sequence of enter and leave events that should be observed by Tk scripts:
*
* Event(state) Enter/Leave From -> To
* ------------ ----------------------
@@ -80,13 +76,13 @@
* Ungrab(G): anc(grab window, event window) -> event window
* Ungrab(GB): restrict window -> event window
*
- * Note: anc(x,y) returns the least ancestor of y that is in the tree
- * of x, terminating at toplevels.
+ * Note: anc(x,y) returns the least ancestor of y that is in the tree of x,
+ * terminating at toplevels.
*/
/*
- * The following structure is used to pass information to
- * GrabRestrictProc from EatGrabEvents.
+ * The following structure is used to pass information to GrabRestrictProc
+ * from EatGrabEvents.
*/
typedef struct {
@@ -99,47 +95,46 @@ typedef struct {
*
* GRAB_GLOBAL 1 means this is a global grab (we grabbed via
* the server so all applications are locked out).
- * 0 means this is a local grab that affects
- * only this application.
+ * 0 means this is a local grab that affects only
+ * this application.
* GRAB_TEMP_GLOBAL 1 means we've temporarily grabbed via the
- * server because a button is down and we want
- * to make sure that we get the button-up
- * event. The grab will be released when the
- * last mouse button goes up.
+ * server because a button is down and we want to
+ * make sure that we get the button-up event. The
+ * grab will be released when the last mouse
+ * button goes up.
*/
#define GRAB_GLOBAL 1
#define GRAB_TEMP_GLOBAL 4
/*
- * The following structure is a Tcl_Event that triggers a change in
- * the grabWinPtr field of a display. This event guarantees that
- * the change occurs in the proper order relative to enter and leave
- * events.
+ * The following structure is a Tcl_Event that triggers a change in the
+ * grabWinPtr field of a display. This event guarantees that the change occurs
+ * in the proper order relative to enter and leave events.
*/
typedef struct NewGrabWinEvent {
Tcl_Event header; /* Standard information for all Tcl events. */
TkDisplay *dispPtr; /* Display whose grab window is to change. */
- Window grabWindow; /* New grab window for display. This is
+ Window grabWindow; /* New grab window for display. This is
* recorded instead of a (TkWindow *) because
- * it will allow us to detect cases where
- * the window is destroyed before this event
- * is processed. */
+ * it will allow us to detect cases where the
+ * window is destroyed before this event is
+ * processed. */
} NewGrabWinEvent;
/*
* The following magic value is stored in the "send_event" field of
- * EnterNotify and LeaveNotify events that are generated in this
- * file. This allows us to separate "real" events coming from the
- * server from those that we generated.
+ * EnterNotify and LeaveNotify events that are generated in this file. This
+ * allows us to separate "real" events coming from the server from those that
+ * we generated.
*/
#define GENERATED_EVENT_MAGIC ((Bool) 0x147321ac)
/*
- * Mask that selects any of the state bits corresponding to buttons,
- * plus masks that select individual buttons' bits:
+ * Mask that selects any of the state bits corresponding to buttons, plus
+ * masks that select individual buttons' bits:
*/
#define ALL_BUTTONS \
@@ -149,32 +144,27 @@ static unsigned int buttonStates[] = {
};
/*
- * Forward declarations for procedures declared later in this file:
+ * Forward declarations for functions declared later in this file:
*/
-static void EatGrabEvents _ANSI_ARGS_((TkDisplay *dispPtr,
- unsigned int serial));
-static TkWindow * FindCommonAncestor _ANSI_ARGS_((TkWindow *winPtr1,
- TkWindow *winPtr2, int *countPtr1,
- int *countPtr2));
-static Tk_RestrictAction GrabRestrictProc _ANSI_ARGS_((ClientData arg,
- XEvent *eventPtr));
-static int GrabWinEventProc _ANSI_ARGS_((Tcl_Event *evPtr,
- int flags));
-static void MovePointer2 _ANSI_ARGS_((TkWindow *sourcePtr,
- TkWindow *destPtr, int mode, int leaveEvents,
- int EnterEvents));
-static void QueueGrabWindowChange _ANSI_ARGS_((TkDisplay *dispPtr,
- TkWindow *grabWinPtr));
-static void ReleaseButtonGrab _ANSI_ARGS_((TkDisplay *dispPtr));
+static void EatGrabEvents(TkDisplay *dispPtr, unsigned int serial);
+static TkWindow * FindCommonAncestor(TkWindow *winPtr1,
+ TkWindow *winPtr2, int *countPtr1, int *countPtr2);
+static Tk_RestrictAction GrabRestrictProc(ClientData arg, XEvent *eventPtr);
+static int GrabWinEventProc(Tcl_Event *evPtr, int flags);
+static void MovePointer2(TkWindow *sourcePtr, TkWindow *destPtr,
+ int mode, int leaveEvents, int EnterEvents);
+static void QueueGrabWindowChange(TkDisplay *dispPtr,
+ TkWindow *grabWinPtr);
+static void ReleaseButtonGrab(TkDisplay *dispPtr);
/*
*----------------------------------------------------------------------
*
* Tk_GrabObjCmd --
*
- * This procedure is invoked to process the "grab" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "grab" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -187,12 +177,11 @@ static void ReleaseButtonGrab _ANSI_ARGS_((TkDisplay *dispPtr));
/* ARGSUSED */
int
-Tk_GrabObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_GrabObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int globalGrab;
Tk_Window tkwin;
@@ -200,14 +189,16 @@ Tk_GrabObjCmd(clientData, interp, objc, objv)
char *arg;
int index;
int len;
- static CONST char *optionStrings[] = { "current", "release",
- "set", "status", (char *) NULL };
-
- static CONST char *flagStrings[] = { "-global", (char *) NULL };
-
- enum options { GRABCMD_CURRENT, GRABCMD_RELEASE,
- GRABCMD_SET, GRABCMD_STATUS };
-
+ static CONST char *optionStrings[] = {
+ "current", "release", "set", "status", NULL
+ };
+ static CONST char *flagStrings[] = {
+ "-global", NULL
+ };
+ enum options {
+ GRABCMD_CURRENT, GRABCMD_RELEASE, GRABCMD_SET, GRABCMD_STATUS
+ };
+
if (objc < 2) {
/*
* Can't use Tcl_WrongNumArgs here because we want the message to
@@ -221,8 +212,7 @@ Tk_GrabObjCmd(clientData, interp, objc, objv)
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetString(objv[0]), " ?-global? window\" or \"",
- Tcl_GetString(objv[0]), " option ?arg arg ...?\"",
- (char *) NULL);
+ Tcl_GetString(objv[0]), " option ?arg arg ...?\"", NULL);
return TCL_ERROR;
}
@@ -262,115 +252,114 @@ Tk_GrabObjCmd(clientData, interp, objc, objv)
}
/*
- * First argument is not a window name and not "-global", find out
- * which option it is.
+ * First argument is not a window name and not "-global", find out which
+ * option it is.
*/
if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
&index) != TCL_OK) {
return TCL_ERROR;
}
-
+
switch ((enum options) index) {
- case GRABCMD_CURRENT: {
- /* [grab current ?window?] */
- if (objc > 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "current ?window?");
+ case GRABCMD_CURRENT:
+ /* [grab current ?window?] */
+ if (objc > 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "current ?window?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
+ (Tk_Window) clientData);
+ if (tkwin == NULL) {
return TCL_ERROR;
}
- if (objc == 3) {
- tkwin = Tk_NameToWindow(interp,
- Tcl_GetString(objv[2]), (Tk_Window) clientData);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ if (dispPtr->eventualGrabWinPtr != NULL) {
+ Tcl_SetResult(interp, dispPtr->eventualGrabWinPtr->pathName,
+ TCL_STATIC);
+ }
+ } else {
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
+ dispPtr = dispPtr->nextPtr) {
if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_SetResult(interp,
- dispPtr->eventualGrabWinPtr->pathName, TCL_STATIC);
- }
- } else {
- for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
- dispPtr = dispPtr->nextPtr) {
- if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_AppendElement(interp,
- dispPtr->eventualGrabWinPtr->pathName);
- }
+ Tcl_AppendElement(interp,
+ dispPtr->eventualGrabWinPtr->pathName);
}
}
- return TCL_OK;
}
+ return TCL_OK;
- case GRABCMD_RELEASE: {
- /* [grab release window] */
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "release window");
- return TCL_ERROR;
- }
- tkwin = Tk_NameToWindow(interp,
- Tcl_GetString(objv[2]), (Tk_Window) clientData);
- if (tkwin == NULL) {
- Tcl_ResetResult(interp);
- } else {
- Tk_Ungrab(tkwin);
- }
- break;
+ case GRABCMD_RELEASE:
+ /* [grab release window] */
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "release window");
+ return TCL_ERROR;
}
-
- case GRABCMD_SET: {
- /* [grab set ?-global? window] */
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 1, objv, "set ?-global? window");
- return TCL_ERROR;
- }
- if (objc == 3) {
- globalGrab = 0;
- tkwin = Tk_NameToWindow(interp,
- Tcl_GetString(objv[2]), (Tk_Window) clientData);
- } else {
- globalGrab = 1;
- /*
- * We could just test the argument by hand instead of using
- * Tcl_GetIndexFromObj; the benefit of using the function is
- * that it sets up the error message for us, so we are
- * certain to be consistant with the rest of Tcl.
- */
- if (Tcl_GetIndexFromObj(interp, objv[2], flagStrings, "option",
- 0, &index) != TCL_OK) {
- return TCL_ERROR;
- }
- tkwin = Tk_NameToWindow(interp,
- Tcl_GetString(objv[3]), (Tk_Window) clientData);
- }
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- return Tk_Grab(interp, tkwin, globalGrab);
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
+ (Tk_Window) clientData);
+ if (tkwin == NULL) {
+ Tcl_ResetResult(interp);
+ } else {
+ Tk_Ungrab(tkwin);
}
+ break;
- case GRABCMD_STATUS: {
- /* [grab status window] */
- TkWindow *winPtr;
+ case GRABCMD_SET:
+ /* [grab set ?-global? window] */
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 1, objv, "set ?-global? window");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ globalGrab = 0;
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
+ (Tk_Window) clientData);
+ } else {
+ globalGrab = 1;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "status window");
- return TCL_ERROR;
- }
- winPtr = (TkWindow *) Tk_NameToWindow(interp,
- Tcl_GetString(objv[2]), (Tk_Window) clientData);
- if (winPtr == NULL) {
+ /*
+ * We could just test the argument by hand instead of using
+ * Tcl_GetIndexFromObj; the benefit of using the function is that
+ * it sets up the error message for us, so we are certain to be
+ * consistant with the rest of Tcl.
+ */
+
+ if (Tcl_GetIndexFromObj(interp, objv[2], flagStrings, "option",
+ 0, &index) != TCL_OK) {
return TCL_ERROR;
}
- dispPtr = winPtr->dispPtr;
- if (dispPtr->eventualGrabWinPtr != winPtr) {
- Tcl_SetResult(interp, "none", TCL_STATIC);
- } else if (dispPtr->grabFlags & GRAB_GLOBAL) {
- Tcl_SetResult(interp, "global", TCL_STATIC);
- } else {
- Tcl_SetResult(interp, "local", TCL_STATIC);
- }
- break;
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]),
+ (Tk_Window) clientData);
+ }
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ return Tk_Grab(interp, tkwin, globalGrab);
+
+ case GRABCMD_STATUS: {
+ /* [grab status window] */
+ TkWindow *winPtr;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "status window");
+ return TCL_ERROR;
+ }
+ winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
+ (Tk_Window) clientData);
+ if (winPtr == NULL) {
+ return TCL_ERROR;
+ }
+ dispPtr = winPtr->dispPtr;
+ if (dispPtr->eventualGrabWinPtr != winPtr) {
+ Tcl_SetResult(interp, "none", TCL_STATIC);
+ } else if (dispPtr->grabFlags & GRAB_GLOBAL) {
+ Tcl_SetResult(interp, "global", TCL_STATIC);
+ } else {
+ Tcl_SetResult(interp, "local", TCL_STATIC);
}
+ break;
+ }
}
return TCL_OK;
@@ -381,34 +370,32 @@ Tk_GrabObjCmd(clientData, interp, objc, objv)
*
* Tk_Grab --
*
- * Grabs the pointer and keyboard, so that mouse-related events are
- * only reported relative to a given window and its descendants.
+ * Grabs the pointer and keyboard, so that mouse-related events are only
+ * reported relative to a given window and its descendants.
*
* Results:
- * A standard Tcl result is returned. TCL_OK is the normal return
- * value; if the grab could not be set then TCL_ERROR is returned
- * and the interp's result will hold an error message.
+ * A standard Tcl result is returned. TCL_OK is the normal return value;
+ * if the grab could not be set then TCL_ERROR is returned and the
+ * interp's result will hold an error message.
*
* Side effects:
- * Once this call completes successfully, no window outside the
- * tree rooted at tkwin will receive pointer- or keyboard-related
- * events until the next call to Tk_Ungrab. If a previous grab was
- * in effect within this application, then it is replaced with a new
- * one.
+ * Once this call completes successfully, no window outside the tree
+ * rooted at tkwin will receive pointer- or keyboard-related events until
+ * the next call to Tk_Ungrab. If a previous grab was in effect within
+ * this application, then it is replaced with a new one.
*
*----------------------------------------------------------------------
*/
int
-Tk_Grab(interp, tkwin, grabGlobal)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Window tkwin; /* Window on whose behalf the pointer
- * is to be grabbed. */
- int grabGlobal; /* Non-zero means issue a grab to the
- * server so that no other application
- * gets mouse or keyboard events.
- * Zero means the grab only applies
- * within this application. */
+Tk_Grab(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Window tkwin, /* Window on whose behalf the pointer is to be
+ * grabbed. */
+ int grabGlobal) /* Non-zero means issue a grab to the server
+ * so that no other application gets mouse or
+ * keyboard events. Zero means the grab only
+ * applies within this application. */
{
int grabResult, numTries;
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -423,7 +410,7 @@ Tk_Grab(interp, tkwin, grabGlobal)
return TCL_OK;
}
if (dispPtr->eventualGrabWinPtr->mainPtr != winPtr->mainPtr) {
- alreadyGrabbed:
+ alreadyGrabbed:
Tcl_SetResult(interp, "grab failed: another application has grab",
TCL_STATIC);
return TCL_ERROR;
@@ -438,11 +425,11 @@ Tk_Grab(interp, tkwin, grabGlobal)
unsigned int state;
/*
- * Local grab. However, if any mouse buttons are down, turn
- * it into a global grab temporarily, until the last button
- * goes up. This does two things: (a) it makes sure that we
- * see the button-up event; and (b) it allows us to track mouse
- * motion among all of the windows of this application.
+ * Local grab. However, if any mouse buttons are down, turn it into a
+ * global grab temporarily, until the last button goes up. This does
+ * two things: (a) it makes sure that we see the button-up event; and
+ * (b) it allows us to track mouse motion among all of the windows of
+ * this application.
*/
dispPtr->grabFlags &= ~(GRAB_GLOBAL|GRAB_TEMP_GLOBAL);
@@ -454,30 +441,28 @@ Tk_Grab(interp, tkwin, grabGlobal)
}
} else {
dispPtr->grabFlags |= GRAB_GLOBAL;
- setGlobalGrab:
+ setGlobalGrab:
/*
- * Tricky point: must ungrab before grabbing. This is needed
- * in case there is a button auto-grab already in effect. If
- * there is, and the mouse has moved to a different window, X
- * won't generate enter and leave events to move the mouse if
- * we grab without ungrabbing.
+ * Tricky point: must ungrab before grabbing. This is needed in case
+ * there is a button auto-grab already in effect. If there is, and the
+ * mouse has moved to a different window, X won't generate enter and
+ * leave events to move the mouse if we grab without ungrabbing.
*/
XUngrabPointer(dispPtr->display, CurrentTime);
serial = NextRequest(dispPtr->display);
/*
- * Another tricky point: there are races with some window
- * managers that can cause grabs to fail because the window
- * manager hasn't released its grab quickly enough. To work
- * around this problem, retry a few times after AlreadyGrabbed
- * errors to give the grab release enough time to register with
- * the server.
+ * Another tricky point: there are races with some window managers
+ * that can cause grabs to fail because the window manager hasn't
+ * released its grab quickly enough. To work around this problem,
+ * retry a few times after AlreadyGrabbed errors to give the grab
+ * release enough time to register with the server.
*/
- grabResult = 0; /* Needed only to prevent gcc
- * compiler warnings. */
+ grabResult = 0; /* Needed only to prevent gcc compiler
+ * warnings. */
for (numTries = 0; numTries < 10; numTries++) {
grabResult = XGrabPointer(dispPtr->display, winPtr->window,
True, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask
@@ -489,7 +474,7 @@ Tk_Grab(interp, tkwin, grabGlobal)
Tcl_Sleep(100);
}
if (grabResult != 0) {
- grabError:
+ grabError:
if (grabResult == GrabNotViewable) {
Tcl_SetResult(interp, "grab failed: window not viewable",
TCL_STATIC);
@@ -503,10 +488,10 @@ Tk_Grab(interp, tkwin, grabGlobal)
TCL_STATIC);
} else {
char msg[64 + TCL_INTEGER_SPACE];
-
+
sprintf(msg, "grab failed for unknown reason (code %d)",
grabResult);
- Tcl_AppendResult(interp, msg, (char *) NULL);
+ Tcl_AppendResult(interp, msg, NULL);
}
return TCL_ERROR;
}
@@ -519,13 +504,13 @@ Tk_Grab(interp, tkwin, grabGlobal)
/*
* Eat up any grab-related events generated by the server for the
- * grab. There are several reasons for doing this:
+ * grab. There are several reasons for doing this:
*
* 1. We have to synthesize the events for local grabs anyway, since
* the server doesn't participate in them.
* 2. The server doesn't always generate the right events for global
- * grabs (e.g. it generates events even if the current window is
- * in the grab tree, which we don't want).
+ * grabs (e.g. it generates events even if the current window is in
+ * the grab tree, which we don't want).
* 3. We want all the grab-related events to be processed immediately
* (before other events that are already queued); events coming
* from the server will be in the wrong place, but events we
@@ -536,8 +521,8 @@ Tk_Grab(interp, tkwin, grabGlobal)
}
/*
- * Synthesize leave events to move the pointer from its current window
- * up to the lowest ancestor that it has in common with the grab window.
+ * Synthesize leave events to move the pointer from its current window up
+ * to the lowest ancestor that it has in common with the grab window.
* However, only do this if the pointer is outside the grab window's
* subtree but inside the grab window's application.
*/
@@ -563,8 +548,8 @@ Tk_Grab(interp, tkwin, grabGlobal)
*
* Tk_Ungrab --
*
- * Releases a grab on the mouse pointer and keyboard, if there
- * is one set on the specified window.
+ * Releases a grab on the mouse pointer and keyboard, if there is one set
+ * on the specified window.
*
* Results:
* None.
@@ -577,9 +562,8 @@ Tk_Grab(interp, tkwin, grabGlobal)
*/
void
-Tk_Ungrab(tkwin)
- Tk_Window tkwin; /* Window whose grab should be
- * released. */
+Tk_Ungrab(
+ Tk_Window tkwin) /* Window whose grab should be released. */
{
TkDisplay *dispPtr;
TkWindow *grabWinPtr, *winPtr;
@@ -591,7 +575,7 @@ Tk_Ungrab(tkwin)
return;
}
ReleaseButtonGrab(dispPtr);
- QueueGrabWindowChange(dispPtr, (TkWindow *) NULL);
+ QueueGrabWindowChange(dispPtr, NULL);
if (dispPtr->grabFlags & (GRAB_GLOBAL|GRAB_TEMP_GLOBAL)) {
dispPtr->grabFlags &= ~(GRAB_GLOBAL|GRAB_TEMP_GLOBAL);
serial = NextRequest(dispPtr->display);
@@ -601,17 +585,17 @@ Tk_Ungrab(tkwin)
}
/*
- * Generate events to move the pointer back to the window where it
- * really is. Some notes:
- * 1. As with grabs, only do this if the "real" window is not a
- * descendant of the grab window, since in this case the pointer
- * is already where it's supposed to be.
+ * Generate events to move the pointer back to the window where it really
+ * is. Some notes:
+ * 1. As with grabs, only do this if the "real" window is not a descendant
+ * of the grab window, since in this case the pointer is already where
+ * it's supposed to be.
* 2. If the "real" window is in some other application then don't
- * generate any events at all, since everything's already been
- * reported correctly.
- * 3. Only generate enter events. Don't generate leave events,
- * because we never told the lower-level windows that they
- * had the pointer in the first place.
+ * generate any events at all, since everything's already been reported
+ * correctly.
+ * 3. Only generate enter events. Don't generate leave events, because we
+ * never told the lower-level windows that they had the pointer in the
+ * first place.
*/
for (winPtr = dispPtr->serverWinPtr; ; winPtr = winPtr->parentPtr) {
@@ -634,26 +618,26 @@ Tk_Ungrab(tkwin)
*
* ReleaseButtonGrab --
*
- * This procedure is called to release a simulated button grab, if
- * there is one in effect. A button grab is present whenever
- * dispPtr->buttonWinPtr is non-NULL or when the GRAB_TEMP_GLOBAL
- * flag is set.
+ * This function is called to release a simulated button grab, if there
+ * is one in effect. A button grab is present whenever
+ * dispPtr->buttonWinPtr is non-NULL or when the GRAB_TEMP_GLOBAL flag is
+ * set.
*
* Results:
* None.
*
* Side effects:
- * DispPtr->buttonWinPtr is reset to NULL, and enter and leave
- * events are generated if necessary to move the pointer from
- * the button grab window to its current window.
+ * DispPtr->buttonWinPtr is reset to NULL, and enter and leave events are
+ * generated if necessary to move the pointer from the button grab window
+ * to its current window.
*
*----------------------------------------------------------------------
*/
static void
-ReleaseButtonGrab(dispPtr)
- register TkDisplay *dispPtr; /* Display whose button grab is to be
- * released. */
+ReleaseButtonGrab(
+ register TkDisplay *dispPtr)/* Display whose button grab is to be
+ * released. */
{
unsigned int serial;
@@ -678,64 +662,64 @@ ReleaseButtonGrab(dispPtr)
*
* TkPointerEvent --
*
- * This procedure is called for each pointer-related event, before
- * the event has been processed. It does various things to make
- * grabs work correctly.
+ * This function is called for each pointer-related event, before the
+ * event has been processed. It does various things to make grabs work
+ * correctly.
*
* Results:
- * If the return value is 1 it means the event should be processed
- * (event handlers should be invoked). If the return value is 0
- * it means the event should be ignored in order to make grabs
- * work correctly. In some cases this procedure modifies the event.
+ * If the return value is 1 it means the event should be processed (event
+ * handlers should be invoked). If the return value is 0 it means the
+ * event should be ignored in order to make grabs work correctly. In some
+ * cases this function modifies the event.
*
* Side effects:
- * Grab state information may be updated. New events may also be
- * pushed back onto the event queue to replace or augment the
- * one passed in here.
+ * Grab state information may be updated. New events may also be pushed
+ * back onto the event queue to replace or augment the one passed in
+ * here.
*
*----------------------------------------------------------------------
*/
int
-TkPointerEvent(eventPtr, winPtr)
- register XEvent *eventPtr; /* Pointer to the event. */
- TkWindow *winPtr; /* Tk's information for window
- * where event was reported. */
+TkPointerEvent(
+ register XEvent *eventPtr, /* Pointer to the event. */
+ TkWindow *winPtr) /* Tk's information for window where event was
+ * reported. */
{
register TkWindow *winPtr2;
TkDisplay *dispPtr = winPtr->dispPtr;
unsigned int serial;
int outsideGrabTree = 0;
int ancestorOfGrab = 0;
- int appGrabbed = 0; /* Non-zero means event is being
- * reported to an application that is
- * affected by the grab. */
+ int appGrabbed = 0; /* Non-zero means event is being reported to
+ * an application that is affected by the
+ * grab. */
/*
* Collect information about the grab (if any).
*/
switch (TkGrabState(winPtr)) {
- case TK_GRAB_IN_TREE:
- appGrabbed = 1;
- break;
- case TK_GRAB_ANCESTOR:
- appGrabbed = 1;
- outsideGrabTree = 1;
- ancestorOfGrab = 1;
- break;
- case TK_GRAB_EXCLUDED:
- appGrabbed = 1;
- outsideGrabTree = 1;
- break;
+ case TK_GRAB_IN_TREE:
+ appGrabbed = 1;
+ break;
+ case TK_GRAB_ANCESTOR:
+ appGrabbed = 1;
+ outsideGrabTree = 1;
+ ancestorOfGrab = 1;
+ break;
+ case TK_GRAB_EXCLUDED:
+ appGrabbed = 1;
+ outsideGrabTree = 1;
+ break;
}
if ((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify)) {
/*
- * Keep track of what window the mouse is *really* over.
- * Any events that we generate have a special send_event value,
- * which is detected below and used to ignore the event for
- * purposes of setting serverWinPtr.
+ * Keep track of what window the mouse is *really* over. Any events
+ * that we generate have a special send_event value, which is detected
+ * below and used to ignore the event for purposes of setting
+ * serverWinPtr.
*/
if (eventPtr->xcrossing.send_event != GENERATED_EVENT_MAGIC) {
@@ -748,13 +732,13 @@ TkPointerEvent(eventPtr, winPtr)
}
/*
- * When a grab is active, X continues to report enter and leave
- * events for windows outside the tree of the grab window:
- * 1. Detect these events and ignore them except for
- * windows above the grab window.
- * 2. Allow Enter and Leave events to pass through the
- * windows above the grab window, but never let them
- * end up with the pointer *in* one of those windows.
+ * When a grab is active, X continues to report enter and leave events
+ * for windows outside the tree of the grab window:
+ * 1. Detect these events and ignore them except for windows above the
+ * grab window.
+ * 2. Allow Enter and Leave events to pass through the windows above
+ * the grab window, but never let them end up with the pointer *in*
+ * one of those windows.
*/
if (dispPtr->grabWinPtr != NULL) {
@@ -763,22 +747,21 @@ TkPointerEvent(eventPtr, winPtr)
return 0;
}
switch (eventPtr->xcrossing.detail) {
- case NotifyInferior:
- return 0;
- case NotifyAncestor:
- eventPtr->xcrossing.detail = NotifyVirtual;
- break;
- case NotifyNonlinear:
- eventPtr->xcrossing.detail = NotifyNonlinearVirtual;
- break;
+ case NotifyInferior:
+ return 0;
+ case NotifyAncestor:
+ eventPtr->xcrossing.detail = NotifyVirtual;
+ break;
+ case NotifyNonlinear:
+ eventPtr->xcrossing.detail = NotifyNonlinearVirtual;
+ break;
}
}
/*
- * Make buttons have the same grab-like behavior inside a grab
- * as they do outside a grab: do this by ignoring enter and
- * leave events except for the window in which the button was
- * pressed.
+ * Make buttons have the same grab-like behavior inside a grab as
+ * they do outside a grab: do this by ignoring enter and leave
+ * events except for the window in which the button was pressed.
*/
if ((dispPtr->buttonWinPtr != NULL)
@@ -796,12 +779,12 @@ TkPointerEvent(eventPtr, winPtr)
if (eventPtr->type == MotionNotify) {
/*
* When grabs are active, X reports motion events relative to the
- * window under the pointer. Instead, it should report the events
+ * window under the pointer. Instead, it should report the events
* relative to the window the button went down in, if there is a
- * button down. Otherwise, if the pointer window is outside the
- * subtree of the grab window, the events should be reported
- * relative to the grab window. Otherwise, the event should be
- * reported to the pointer window.
+ * button down. Otherwise, if the pointer window is outside the
+ * subtree of the grab window, the events should be reported relative
+ * to the grab window. Otherwise, the event should be reported to the
+ * pointer window.
*/
winPtr2 = winPtr;
@@ -820,32 +803,32 @@ TkPointerEvent(eventPtr, winPtr)
/*
* Process ButtonPress and ButtonRelease events:
- * 1. Keep track of whether a button is down and what window it
- * went down in.
- * 2. If the first button goes down outside the grab tree, pretend
- * it went down in the grab window. Note: it's important to
- * redirect events to the grab window like this in order to make
- * things like menus work, where button presses outside the
- * grabbed menu need to be seen. An application can always
- * ignore the events if they occur outside its window.
- * 3. If a button press or release occurs outside the window where
- * the first button was pressed, retarget the event so it's reported
- * to the window where the first button was pressed.
- * 4. If the last button is released in a window different than where
- * the first button was pressed, generate Enter/Leave events to
- * move the mouse from the button window to its current window.
- * 5. If the grab is set at a time when a button is already down, or
- * if the window where the button was pressed was deleted, then
- * dispPtr->buttonWinPtr will stay NULL. Just forget about the
- * auto-grab for the button press; events will go to whatever
- * window contains the pointer. If this window isn't in the grab
- * tree then redirect events to the grab window.
- * 6. When a button is pressed during a local grab, the X server sets
- * a grab of its own, since it doesn't even know about our local
- * grab. This causes enter and leave events no longer to be
- * generated in the same way as for global grabs. To eliminate this
- * problem, set a temporary global grab when the first button goes
- * down and release it when the last button comes up.
+ * 1. Keep track of whether a button is down and what window it went down
+ * in.
+ * 2. If the first button goes down outside the grab tree, pretend it went
+ * down in the grab window. Note: it's important to redirect events to
+ * the grab window like this in order to make things like menus work,
+ * where button presses outside the grabbed menu need to be seen. An
+ * application can always ignore the events if they occur outside its
+ * window.
+ * 3. If a button press or release occurs outside the window where the
+ * first button was pressed, retarget the event so it's reported to the
+ * window where the first button was pressed.
+ * 4. If the last button is released in a window different than where the
+ * first button was pressed, generate Enter/Leave events to move the
+ * mouse from the button window to its current window.
+ * 5. If the grab is set at a time when a button is already down, or if
+ * the window where the button was pressed was deleted, then
+ * dispPtr->buttonWinPtr will stay NULL. Just forget about the
+ * auto-grab for the button press; events will go to whatever window
+ * contains the pointer. If this window isn't in the grab tree then
+ * redirect events to the grab window.
+ * 6. When a button is pressed during a local grab, the X server sets a
+ * grab of its own, since it doesn't even know about our local grab.
+ * This causes enter and leave events no longer to be generated in the
+ * same way as for global grabs. To eliminate this problem, set a
+ * temporary global grab when the first button goes down and release it
+ * when the last button comes up.
*/
if ((eventPtr->type == ButtonPress) || (eventPtr->type == ButtonRelease)) {
@@ -906,12 +889,12 @@ TkPointerEvent(eventPtr, winPtr)
* TkChangeEventWindow --
*
* Given an event and a new window to which the event should be
- * retargeted, modify fields of the event so that the event is
- * properly retargeted to the new window.
+ * retargeted, modify fields of the event so that the event is properly
+ * retargeted to the new window.
*
* Results:
- * The following fields of eventPtr are modified: window,
- * subwindow, x, y, same_screen.
+ * The following fields of eventPtr are modified: window, subwindow, x,
+ * y, same_screen.
*
* Side effects:
* None.
@@ -920,12 +903,12 @@ TkPointerEvent(eventPtr, winPtr)
*/
void
-TkChangeEventWindow(eventPtr, winPtr)
- register XEvent *eventPtr; /* Event to retarget. Must have
- * type ButtonPress, ButtonRelease, KeyPress,
- * KeyRelease, MotionNotify, EnterNotify,
- * or LeaveNotify. */
- TkWindow *winPtr; /* New target window for event. */
+TkChangeEventWindow(
+ register XEvent *eventPtr, /* Event to retarget. Must have type
+ * ButtonPress, ButtonRelease, KeyPress,
+ * KeyRelease, MotionNotify, EnterNotify, or
+ * LeaveNotify. */
+ TkWindow *winPtr) /* New target window for event. */
{
int x, y, sameScreen, bd;
register TkWindow *childPtr;
@@ -970,44 +953,44 @@ TkChangeEventWindow(eventPtr, winPtr)
*
* TkInOutEvents --
*
- * This procedure synthesizes EnterNotify and LeaveNotify events
- * to correctly transfer the pointer from one window to another.
- * It can also be used to generate FocusIn and FocusOut events
- * to move the input focus.
+ * This function synthesizes EnterNotify and LeaveNotify events to
+ * correctly transfer the pointer from one window to another. It can also
+ * be used to generate FocusIn and FocusOut events to move the input
+ * focus.
*
* Results:
* None.
*
* Side effects:
- * Synthesized events may be pushed back onto the event queue.
- * The event pointed to by eventPtr is modified.
+ * Synthesized events may be pushed back onto the event queue. The event
+ * pointed to by eventPtr is modified.
*
*----------------------------------------------------------------------
*/
void
-TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
- XEvent *eventPtr; /* A template X event. Must have all fields
+TkInOutEvents(
+ XEvent *eventPtr, /* A template X event. Must have all fields
* properly set except for type, window,
- * subwindow, x, y, detail, and same_screen
+ * subwindow, x, y, detail, and same_screen.
* (Not all of these fields are valid for
- * FocusIn/FocusOut events; x_root and y_root
+ * FocusIn/FocusOut events; x_root and y_root
* must be valid for Enter/Leave events, even
* though x and y needn't be valid). */
- TkWindow *sourcePtr; /* Window that used to have the pointer or
+ TkWindow *sourcePtr, /* Window that used to have the pointer or
* focus (NULL means it was not in a window
* managed by this process). */
- TkWindow *destPtr; /* Window that is to end up with the pointer
+ TkWindow *destPtr, /* Window that is to end up with the pointer
* or focus (NULL means it's not one managed
* by this process). */
- int leaveType; /* Type of events to generate for windows
- * being left (LeaveNotify or FocusOut). 0
+ int leaveType, /* Type of events to generate for windows
+ * being left (LeaveNotify or FocusOut). 0
* means don't generate leave events. */
- int enterType; /* Type of events to generate for windows
- * being entered (EnterNotify or FocusIn). 0
+ int enterType, /* Type of events to generate for windows
+ * being entered (EnterNotify or FocusIn). 0
* means don't generate enter events. */
- Tcl_QueuePosition position; /* Position at which events are added to
- * the system event queue. */
+ Tcl_QueuePosition position) /* Position at which events are added to the
+ * system event queue. */
{
register TkWindow *winPtr;
int upLevels, downLevels, i, j, focus;
@@ -1015,17 +998,15 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
/*
* There are four possible cases to deal with:
*
- * 1. SourcePtr and destPtr are the same. There's nothing to do in
- * this case.
- * 2. SourcePtr is an ancestor of destPtr in the same top-level
- * window. Must generate events down the window tree from source
- * to dest.
- * 3. DestPtr is an ancestor of sourcePtr in the same top-level
- * window. Must generate events up the window tree from sourcePtr
- * to destPtr.
- * 4. All other cases. Must first generate events up the window tree
- * from sourcePtr to its top-level, then down from destPtr's
- * top-level to destPtr. This form is called "non-linear."
+ * 1. SourcePtr and destPtr are the same. There's nothing to do in this
+ * case.
+ * 2. SourcePtr is an ancestor of destPtr in the same top-level window.
+ * Must generate events down the window tree from source to dest.
+ * 3. DestPtr is an ancestor of sourcePtr in the same top-level window.
+ * Must generate events up the window tree from sourcePtr to destPtr.
+ * 4. All other cases. Must first generate events up the window tree from
+ * sourcePtr to its top-level, then down from destPtr's top-level to
+ * destPtr. This form is called "non-linear."
*
* The call to FindCommonAncestor separates these four cases and decides
* how many levels up and down events have to be generated for.
@@ -1045,7 +1026,6 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
* Generate enter/leave events and add them to the grab event queue.
*/
-
#define QUEUE(w, t, d) \
if (w->window != None) { \
eventPtr->type = t; \
@@ -1060,7 +1040,6 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
}
if (downLevels == 0) {
-
/*
* SourcePtr is an inferior of destPtr.
*/
@@ -1076,7 +1055,6 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
QUEUE(destPtr, enterType, NotifyInferior);
}
} else if (upLevels == 0) {
-
/*
* DestPtr is an inferior of sourcePtr.
*/
@@ -1088,6 +1066,7 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
for (i = downLevels-1; i > 0; i--) {
for (winPtr = destPtr->parentPtr, j = 1; j < i;
winPtr = winPtr->parentPtr, j++) {
+ /* empty */
}
QUEUE(winPtr, enterType, NotifyVirtual);
}
@@ -1096,9 +1075,8 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
}
}
} else {
-
/*
- * Non-linear: neither window is an inferior of the other.
+ * Non-linear: neither window is an inferior of the other.
*/
if (leaveType != 0) {
@@ -1127,11 +1105,11 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
*
* MovePointer2 --
*
- * This procedure synthesizes EnterNotify and LeaveNotify events
- * to correctly transfer the pointer from one window to another.
- * It is different from TkInOutEvents in that no template X event
- * needs to be supplied; this procedure generates the template
- * event and calls TkInOutEvents.
+ * This function synthesizes EnterNotify and LeaveNotify events to
+ * correctly transfer the pointer from one window to another. It is
+ * different from TkInOutEvents in that no template X event needs to be
+ * supplied; this function generates the template event and calls
+ * TkInOutEvents.
*
* Results:
* None.
@@ -1143,20 +1121,20 @@ TkInOutEvents(eventPtr, sourcePtr, destPtr, leaveType, enterType, position)
*/
static void
-MovePointer2(sourcePtr, destPtr, mode, leaveEvents, enterEvents)
- TkWindow *sourcePtr; /* Window currently containing pointer (NULL
+MovePointer2(
+ TkWindow *sourcePtr, /* Window currently containing pointer (NULL
* means it's not one managed by this
* process). */
- TkWindow *destPtr; /* Window that is to end up containing the
- * pointer (NULL means it's not one managed
- * by this process). */
- int mode; /* Mode for enter/leave events, such as
+ TkWindow *destPtr, /* Window that is to end up containing the
+ * pointer (NULL means it's not one managed by
+ * this process). */
+ int mode, /* Mode for enter/leave events, such as
* NotifyNormal or NotifyUngrab. */
- int leaveEvents; /* Non-zero means generate leave events for the
- * windows being left. Zero means don't
+ int leaveEvents, /* Non-zero means generate leave events for
+ * the windows being left. Zero means don't
* generate leave events. */
- int enterEvents; /* Non-zero means generate enter events for the
- * windows being entered. Zero means don't
+ int enterEvents) /* Non-zero means generate enter events for
+ * the windows being entered. Zero means don't
* generate enter events. */
{
XEvent event;
@@ -1172,12 +1150,10 @@ MovePointer2(sourcePtr, destPtr, mode, leaveEvents, enterEvents)
}
}
- event.xcrossing.serial = LastKnownRequestProcessed(
- winPtr->display);
+ event.xcrossing.serial = LastKnownRequestProcessed(winPtr->display);
event.xcrossing.send_event = GENERATED_EVENT_MAGIC;
event.xcrossing.display = winPtr->display;
- event.xcrossing.root = RootWindow(winPtr->display,
- winPtr->screenNum);
+ event.xcrossing.root = RootWindow(winPtr->display, winPtr->screenNum);
event.xcrossing.time = TkCurrentTime(winPtr->dispPtr);
XQueryPointer(winPtr->display, winPtr->window, &dummy1, &dummy2,
&event.xcrossing.x_root, &event.xcrossing.y_root,
@@ -1193,30 +1169,30 @@ MovePointer2(sourcePtr, destPtr, mode, leaveEvents, enterEvents)
*
* TkGrabDeadWindow --
*
- * This procedure is invoked whenever a window is deleted, so that
+ * This function is invoked whenever a window is deleted, so that
* grab-related cleanup can be performed.
*
* Results:
* None.
*
* Side effects:
- * Various cleanups happen, such as generating events to move the
- * pointer back to its "natural" window as if an ungrab had been
- * done. See the code.
+ * Various cleanups happen, such as generating events to move the pointer
+ * back to its "natural" window as if an ungrab had been done. See the
+ * code.
*
*----------------------------------------------------------------------
*/
void
-TkGrabDeadWindow(winPtr)
- register TkWindow *winPtr; /* Window that is in the process
- * of being deleted. */
+TkGrabDeadWindow(
+ register TkWindow *winPtr) /* Window that is in the process of being
+ * deleted. */
{
TkDisplay *dispPtr = winPtr->dispPtr;
if (dispPtr->eventualGrabWinPtr == winPtr) {
/*
- * Grab window was deleted. Release the grab.
+ * Grab window was deleted. Release the grab.
*/
Tk_Ungrab((Tk_Window) dispPtr->eventualGrabWinPtr);
@@ -1240,26 +1216,25 @@ TkGrabDeadWindow(winPtr)
*
* EatGrabEvents --
*
- * This procedure is called to eliminate any Enter, Leave,
- * FocusIn, or FocusOut events in the event queue for a
- * display that have mode NotifyGrab or NotifyUngrab and
- * have a serial number no less than a given value and are not
- * generated by the grab module.
+ * This function is called to eliminate any Enter, Leave, FocusIn, or
+ * FocusOut events in the event queue for a display that have mode
+ * NotifyGrab or NotifyUngrab and have a serial number no less than a
+ * given value and are not generated by the grab module.
*
* Results:
* None.
*
* Side effects:
- * DispPtr's display gets sync-ed, and some of the events get
- * removed from the Tk event queue.
+ * DispPtr's display gets sync-ed, and some of the events get removed
+ * from the Tk event queue.
*
*----------------------------------------------------------------------
*/
static void
-EatGrabEvents(dispPtr, serial)
- TkDisplay *dispPtr; /* Display from which to consume events. */
- unsigned int serial; /* Only discard events that have a serial
+EatGrabEvents(
+ TkDisplay *dispPtr, /* Display from which to consume events. */
+ unsigned int serial) /* Only discard events that have a serial
* number at least this great. */
{
Tk_RestrictProc *oldProc;
@@ -1280,10 +1255,10 @@ EatGrabEvents(dispPtr, serial)
*
* GrabRestrictProc --
*
- * A Tk_RestrictProc used by EatGrabEvents to eliminate any
- * Enter, Leave, FocusIn, or FocusOut events in the event queue
- * for a display that has mode NotifyGrab or NotifyUngrab and
- * have a serial number no less than a given value.
+ * A Tk_RestrictProc used by EatGrabEvents to eliminate any Enter, Leave,
+ * FocusIn, or FocusOut events in the event queue for a display that has
+ * mode NotifyGrab or NotifyUngrab and have a serial number no less than
+ * a given value.
*
* Results:
* Returns either TK_DISCARD_EVENT or TK_DEFER_EVENT.
@@ -1295,17 +1270,17 @@ EatGrabEvents(dispPtr, serial)
*/
static Tk_RestrictAction
-GrabRestrictProc(arg, eventPtr)
- ClientData arg;
- XEvent *eventPtr;
+GrabRestrictProc(
+ ClientData arg,
+ XEvent *eventPtr)
{
GrabInfo *info = (GrabInfo *) arg;
int mode, diff;
/*
- * The diff caculation is trickier than it may seem. Don't forget
- * that serial numbers can wrap around, so can't compare the two
- * serial numbers directly.
+ * The diff caculation is trickier than it may seem. Don't forget that
+ * serial numbers can wrap around, so can't compare the two serial numbers
+ * directly.
*/
diff = eventPtr->xany.serial - info->serial;
@@ -1331,29 +1306,28 @@ GrabRestrictProc(arg, eventPtr)
*
* QueueGrabWindowChange --
*
- * This procedure queues a special event in the Tcl event queue,
- * which will cause the "grabWinPtr" field for the display to get
- * modified when the event is processed. This is needed to make
- * sure that the grab window changes at the proper time relative
- * to grab-related enter and leave events that are also in the
- * queue. In particular, this approach works even when multiple
- * grabs and ungrabs happen back-to-back.
+ * This function queues a special event in the Tcl event queue, which
+ * will cause the "grabWinPtr" field for the display to get modified when
+ * the event is processed. This is needed to make sure that the grab
+ * window changes at the proper time relative to grab-related enter and
+ * leave events that are also in the queue. In particular, this approach
+ * works even when multiple grabs and ungrabs happen back-to-back.
*
* Results:
* None.
*
* Side effects:
- * DispPtr->grabWinPtr will be modified later (by GrabWinEventProc)
- * when the event is removed from the grab event queue.
+ * DispPtr->grabWinPtr will be modified later (by GrabWinEventProc) when
+ * the event is removed from the grab event queue.
*
*----------------------------------------------------------------------
*/
static void
-QueueGrabWindowChange(dispPtr, grabWinPtr)
- TkDisplay *dispPtr; /* Display on which to change the grab
+QueueGrabWindowChange(
+ TkDisplay *dispPtr, /* Display on which to change the grab
* window. */
- TkWindow *grabWinPtr; /* Window that is to become the new grab
+ TkWindow *grabWinPtr) /* Window that is to become the new grab
* window (may be NULL). */
{
NewGrabWinEvent *grabEvPtr;
@@ -1375,25 +1349,25 @@ QueueGrabWindowChange(dispPtr, grabWinPtr)
*
* GrabWinEventProc --
*
- * This procedure is invoked as a handler for Tcl_Events of type
- * NewGrabWinEvent. It updates the current grab window field in
- * a display.
+ * This function is invoked as a handler for Tcl_Events of type
+ * NewGrabWinEvent. It updates the current grab window field in a
+ * display.
*
* Results:
- * Returns 1 if the event was processed, 0 if it should be deferred
- * for processing later.
+ * Returns 1 if the event was processed, 0 if it should be deferred for
+ * processing later.
*
* Side effects:
- * The grabWinPtr field is modified in the display associated with
- * the event.
+ * The grabWinPtr field is modified in the display associated with the
+ * event.
*
*----------------------------------------------------------------------
*/
static int
-GrabWinEventProc(evPtr, flags)
- Tcl_Event *evPtr; /* Event of type NewGrabWinEvent. */
- int flags; /* Flags argument to Tk_DoOneEvent: indicates
+GrabWinEventProc(
+ Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */
+ int flags) /* Flags argument to Tk_DoOneEvent: indicates
* what kinds of events are being processed
* right now. */
{
@@ -1409,19 +1383,19 @@ GrabWinEventProc(evPtr, flags)
*
* FindCommonAncestor --
*
- * Given two windows, this procedure finds their least common
- * ancestor and also computes how many levels up this ancestor
- * is from each of the original windows.
+ * Given two windows, this function finds their least common ancestor and
+ * also computes how many levels up this ancestor is from each of the
+ * original windows.
*
* Results:
- * If the windows are in different applications or top-level
- * windows, then NULL is returned and *countPtr1 and *countPtr2
- * are set to the depths of the two windows in their respective
- * top-level windows (1 means the window is a top-level, 2 means
- * its parent is a top-level, and so on). Otherwise, the return
- * value is a pointer to the common ancestor and the counts are
- * set to the distance of winPtr1 and winPtr2 from this ancestor
- * (1 means they're children, 2 means grand-children, etc.).
+ * If the windows are in different applications or top-level windows,
+ * then NULL is returned and *countPtr1 and *countPtr2 are set to the
+ * depths of the two windows in their respective top-level windows (1
+ * means the window is a top-level, 2 means its parent is a top-level,
+ * and so on). Otherwise, the return value is a pointer to the common
+ * ancestor and the counts are set to the distance of winPtr1 and winPtr2
+ * from this ancestor (1 means they're children, 2 means grand-children,
+ * etc.).
*
* Side effects:
* None.
@@ -1430,12 +1404,12 @@ GrabWinEventProc(evPtr, flags)
*/
static TkWindow *
-FindCommonAncestor(winPtr1, winPtr2, countPtr1, countPtr2)
- TkWindow *winPtr1; /* First window. May be NULL. */
- TkWindow *winPtr2; /* Second window. May be NULL. */
- int *countPtr1; /* Store nesting level of winPtr1 within
+FindCommonAncestor(
+ TkWindow *winPtr1, /* First window. May be NULL. */
+ TkWindow *winPtr2, /* Second window. May be NULL. */
+ int *countPtr1, /* Store nesting level of winPtr1 within
* common ancestor here. */
- int *countPtr2; /* Store nesting level of winPtr2 within
+ int *countPtr2) /* Store nesting level of winPtr2 within
* common ancestor here. */
{
register TkWindow *winPtr;
@@ -1456,8 +1430,8 @@ FindCommonAncestor(winPtr1, winPtr2, countPtr1, countPtr2)
}
/*
- * Search upwards from winPtr2 until an ancestor of winPtr1 is
- * found or a top-level window is reached.
+ * Search upwards from winPtr2 until an ancestor of winPtr1 is found or a
+ * top-level window is reached.
*/
winPtr = winPtr2;
@@ -1510,15 +1484,13 @@ FindCommonAncestor(winPtr1, winPtr2, countPtr1, countPtr2)
*
* TkPositionInTree --
*
- * Compute where the given window is relative to a particular
- * subtree of the window hierarchy.
+ * Compute where the given window is relative to a particular subtree of
+ * the window hierarchy.
*
* Results:
- *
- * Returns TK_GRAB_IN_TREE if the window is contained in the
- * subtree. Returns TK_GRAB_ANCESTOR if the window is an
- * ancestor of the subtree, in the same toplevel. Otherwise
- * it returns TK_GRAB_EXCLUDED.
+ * Returns TK_GRAB_IN_TREE if the window is contained in the subtree.
+ * Returns TK_GRAB_ANCESTOR if the window is an ancestor of the subtree,
+ * in the same toplevel. Otherwise it returns TK_GRAB_EXCLUDED.
*
* Side effects:
* None.
@@ -1527,9 +1499,9 @@ FindCommonAncestor(winPtr1, winPtr2, countPtr1, countPtr2)
*/
int
-TkPositionInTree(winPtr, treePtr)
- TkWindow *winPtr; /* Window to be checked. */
- TkWindow *treePtr; /* Root of tree to compare against. */
+TkPositionInTree(
+ TkWindow *winPtr, /* Window to be checked. */
+ TkWindow *treePtr) /* Root of tree to compare against. */
{
TkWindow *winPtr2;
@@ -1556,21 +1528,20 @@ TkPositionInTree(winPtr, treePtr)
*
* TkGrabState --
*
- * Given a window, this procedure returns a value that indicates
- * the grab state of the application relative to the window.
+ * Given a window, this function returns a value that indicates the grab
+ * state of the application relative to the window.
*
* Results:
* The return value is one of three things:
* TK_GRAB_NONE - no grab is in effect.
- * TK_GRAB_IN_TREE - there is a grab in effect, and winPtr
- * is in the grabbed subtree.
- * TK_GRAB_ANCESTOR - there is a grab in effect; winPtr is
- * an ancestor of the grabbed window, in
- * the same toplevel.
- * TK_GRAB_EXCLUDED - there is a grab in effect; winPtr is
- * outside the tree of the grab and is not
- * an ancestor of the grabbed window in the
- * same toplevel.
+ * TK_GRAB_IN_TREE - there is a grab in effect, and winPtr is in
+ * the grabbed subtree.
+ * TK_GRAB_ANCESTOR - there is a grab in effect; winPtr is an
+ * ancestor of the grabbed window, in the same
+ * toplevel.
+ * TK_GRAB_EXCLUDED - there is a grab in effect; winPtr is outside
+ * the tree of the grab and is not an ancestor of
+ * the grabbed window in the same toplevel.
*
* Side effects:
* None.
@@ -1579,8 +1550,8 @@ TkPositionInTree(winPtr, treePtr)
*/
int
-TkGrabState(winPtr)
- TkWindow *winPtr; /* Window for which grab information is
+TkGrabState(
+ TkWindow *winPtr) /* Window for which grab information is
* needed. */
{
TkWindow *grabWinPtr = winPtr->dispPtr->grabWinPtr;
@@ -1595,3 +1566,11 @@ TkGrabState(winPtr)
return TkPositionInTree(winPtr, grabWinPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 008e321..c6a00d5 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -5,8 +5,8 @@
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
@@ -19,26 +19,22 @@
# undef MAX
#endif
#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#ifdef MIN
-# undef MIN
-#endif
-#define MIN(x,y) ((x) > (y) ? (y) : (x))
-#define COLUMN (1) /* working on column offsets */
-#define ROW (2) /* working on row offsets */
+#define COLUMN (1) /* Working on column offsets. */
+#define ROW (2) /* Working on row offsets. */
-#define CHECK_ONLY (1) /* check max slot constraint */
-#define CHECK_SPACE (2) /* alloc more space, don't change max */
+#define CHECK_ONLY (1) /* Check max slot constraint. */
+#define CHECK_SPACE (2) /* Alloc more space, don't change max. */
/*
- * Pre-allocate enough row and column slots for "typical" sized tables
- * this value should be chosen so by the time the extra malloc's are
- * required, the layout calculations overwehlm them. [A "slot" contains
- * information for either a row or column, depending upon the context.]
+ * Pre-allocate enough row and column slots for "typical" sized tables this
+ * value should be chosen so by the time the extra malloc's are required, the
+ * layout calculations overwehlm them. [A "slot" contains information for
+ * either a row or column, depending upon the context.]
*/
-#define TYPICAL_SIZE 25 /* (arbitrary guess) */
-#define PREALLOC 10 /* extra slots to allocate */
+#define TYPICAL_SIZE 25 /* (Arbitrary guess) */
+#define PREALLOC 10 /* Extra slots to allocate. */
/*
* Pre-allocate room for uniform groups during layout.
@@ -46,10 +42,10 @@
#define UNIFORM_PREALLOC 10
-/*
- * Data structures are allocated dynamically to support arbitrary sized tables.
- * However, the space is proportional to the highest numbered slot with
- * some non-default property. This limit is used to head off mistakes and
+/*
+ * Data structures are allocated dynamically to support arbitrary sized
+ * tables. However, the space is proportional to the highest numbered slot
+ * with some non-default property. This limit is used to head off mistakes and
* denial of service attacks by limiting the amount of storage required.
*/
@@ -64,63 +60,67 @@
#define REL_VERT '^' /* Extend widget from row above. */
/*
- * Structure to hold information for grid masters. A slot is either
- * a row or column.
+ * Default value for 'grid anchor'.
+ */
+
+#define GRID_DEFAULT_ANCHOR TK_ANCHOR_NW
+
+/*
+ * Structure to hold information for grid masters. A slot is either a row or
+ * column.
*/
typedef struct SlotInfo {
- int minSize; /* The minimum size of this slot (in pixels).
+ int minSize; /* The minimum size of this slot (in pixels).
* It is set via the rowconfigure or
* columnconfigure commands. */
- int weight; /* The resize weight of this slot. (0) means
+ int weight; /* The resize weight of this slot. (0) means
* this slot doesn't resize. Extra space in
* the layout is given distributed among slots
* inproportion to their weights. */
- int pad; /* Extra padding, in pixels, required for
- * this slot. This amount is "added" to the
- * largest slave in the slot. */
- Tk_Uid uniform; /* Value of -uniform option. It is used to
+ int pad; /* Extra padding, in pixels, required for this
+ * slot. This amount is "added" to the largest
+ * slave in the slot. */
+ Tk_Uid uniform; /* Value of -uniform option. It is used to
* group slots that should have the same
* size. */
- int offset; /* This is a cached value used for
- * introspection. It is the pixel
- * offset of the right or bottom edge
- * of this slot from the beginning of the
- * layout. */
- int temp; /* This is a temporary value used for
- * calculating adjusted weights when
- * shrinking the layout below its
- * nominal size. */
+ int offset; /* This is a cached value used for
+ * introspection. It is the pixel offset of
+ * the right or bottom edge of this slot from
+ * the beginning of the layout. */
+ int temp; /* This is a temporary value used for
+ * calculating adjusted weights when shrinking
+ * the layout below its nominal size. */
} SlotInfo;
/*
- * Structure to hold information during layout calculations. There
- * is one of these for each slot, an array for each of the rows or columns.
+ * Structure to hold information during layout calculations. There is one of
+ * these for each slot, an array for each of the rows or columns.
*/
typedef struct GridLayout {
- struct Gridder *binNextPtr; /* The next slave window in this bin.
- * Each bin contains a list of all
- * slaves whose spans are >1 and whose
- * right edges fall in this slot. */
- int minSize; /* Minimum size needed for this slot,
- * in pixels. This is the space required
- * to hold any slaves contained entirely
- * in this slot, adjusted for any slot
- * constrants, such as size or padding. */
+ struct Gridder *binNextPtr; /* The next slave window in this bin. Each bin
+ * contains a list of all slaves whose spans
+ * are >1 and whose right edges fall in this
+ * slot. */
+ int minSize; /* Minimum size needed for this slot, in
+ * pixels. This is the space required to hold
+ * any slaves contained entirely in this slot,
+ * adjusted for any slot constrants, such as
+ * size or padding. */
int pad; /* Padding needed for this slot */
int weight; /* Slot weight, controls resizing. */
- Tk_Uid uniform; /* Value of -uniform option. It is used to
+ Tk_Uid uniform; /* Value of -uniform option. It is used to
* group slots that should have the same
* size. */
- int minOffset; /* The minimum offset, in pixels, from
- * the beginning of the layout to the
- * right/bottom edge of the slot calculated
- * from top/left to bottom/right. */
- int maxOffset; /* The maximum offset, in pixels, from
- * the beginning of the layout to the
- * right-or-bottom edge of the slot calculated
- * from bottom-or-right to top-or-left. */
+ int minOffset; /* The minimum offset, in pixels, from the
+ * beginning of the layout to the bottom/right
+ * edge of the slot calculated from top/left
+ * to bottom/right. */
+ int maxOffset; /* The maximum offset, in pixels, from the
+ * beginning of the layout to the bottom/right
+ * edge of the slot calculated from
+ * bottom/right to top/left. */
} GridLayout;
/*
@@ -136,81 +136,84 @@ typedef struct {
* column constraints. */
int rowEnd; /* The last row occupied by any slave. */
int rowMax; /* The number of rows with constraints. */
- int rowSpace; /* The number of slots currently allocated
- * for row constraints. */
+ int rowSpace; /* The number of slots currently allocated for
+ * row constraints. */
int startX; /* Pixel offset of this layout within its
- * parent. */
+ * master. */
int startY; /* Pixel offset of this layout within its
- * parent. */
+ * master. */
+ Tk_Anchor anchor; /* Value of anchor option: specifies where a
+ * grid without weight should be placed. */
} GridMaster;
/*
- * For each window that the grid cares about (either because
- * the window is managed by the grid or because the window
- * has slaves that are managed by the grid), there is a
- * structure of the following type:
+ * For each window that the grid cares about (either because the window is
+ * managed by the grid or because the window has slaves that are managed by
+ * the grid), there is a structure of the following type:
*/
typedef struct Gridder {
- Tk_Window tkwin; /* Tk token for window. NULL means that
- * the window has been deleted, but the
- * gridder hasn't had a chance to clean up
- * yet because the structure is still in
- * use. */
- struct Gridder *masterPtr; /* Master window within which this window
- * is managed (NULL means this window
- * isn't managed by the gridder). */
- struct Gridder *nextPtr; /* Next window managed within same
- * parent. List order doesn't matter. */
- struct Gridder *slavePtr; /* First in list of slaves managed
- * inside this window (NULL means
- * no grid slaves). */
+ Tk_Window tkwin; /* Tk token for window. NULL means that the
+ * window has been deleted, but the gridder
+ * hasn't had a chance to clean up yet because
+ * the structure is still in use. */
+ struct Gridder *masterPtr; /* Master window within which this window is
+ * managed (NULL means this window isn't
+ * managed by the gridder). */
+ struct Gridder *nextPtr; /* Next window managed within same master.
+ * List order doesn't matter. */
+ struct Gridder *slavePtr; /* First in list of slaves managed inside this
+ * window (NULL means no grid slaves). */
GridMaster *masterDataPtr; /* Additional data for geometry master. */
- int column, row; /* Location in the grid (starting
- * from zero). */
+ Tcl_Obj *in; /* Store master name when removed. */
+ int column, row; /* Location in the grid (starting from
+ * zero). */
int numCols, numRows; /* Number of columns or rows this slave spans.
* Should be at least 1. */
int padX, padY; /* Total additional pixels to leave around the
- * window. Some is of this space is on each
- * side. This is space *outside* the window:
+ * window. Some is of this space is on each
+ * side. This is space *outside* the window:
* we'll allocate extra space in frame but
* won't enlarge window). */
- int padLeft, padTop; /* The part of padX or padY to use on the
- * left or top of the widget, respectively.
- * By default, this is half of padX or padY. */
+ int padLeft, padTop; /* The part of padX or padY to use on the left
+ * or top of the widget, respectively. By
+ * default, this is half of padX or padY. */
int iPadX, iPadY; /* Total extra pixels to allocate inside the
* window (half this amount will appear on
* each side). */
int sticky; /* which sides of its cavity this window
* sticks to. See below for definitions */
- int doubleBw; /* Twice the window's last known border
- * width. If this changes, the window
- * must be re-arranged within its parent. */
- int *abortPtr; /* If non-NULL, it means that there is a nested
- * call to ArrangeGrid already working on
- * this window. *abortPtr may be set to 1 to
- * abort that nested call. This happens, for
- * example, if tkwin or any of its slaves
+ int doubleBw; /* Twice the window's last known border width.
+ * If this changes, the window must be
+ * re-arranged within its master. */
+ int *abortPtr; /* If non-NULL, it means that there is a
+ * nested call to ArrangeGrid already working
+ * on this window. *abortPtr may be set to 1
+ * to abort that nested call. This happens,
+ * for example, if tkwin or any of its slaves
* is deleted. */
- int flags; /* Miscellaneous flags; see below
- * for definitions. */
+ int flags; /* Miscellaneous flags; see below for
+ * definitions. */
/*
* These fields are used temporarily for layout calculations only.
*/
struct Gridder *binNextPtr; /* Link to next span>1 slave in this bin. */
- int size; /* Nominal size (width or height) in pixels
- * of the slave. This includes the padding. */
+ int size; /* Nominal size (width or height) in pixels of
+ * the slave. This includes the padding. */
} Gridder;
-/* Flag values for "sticky"ness The 16 combinations subsume the packer's
+/*
+ * Flag values for "sticky"ness. The 16 combinations subsume the packer's
* notion of anchor and fill.
*
- * STICK_NORTH This window sticks to the top of its cavity.
- * STICK_EAST This window sticks to the right edge of its cavity.
- * STICK_SOUTH This window sticks to the bottom of its cavity.
- * STICK_WEST This window sticks to the left edge of its cavity.
+ * STICK_NORTH This window sticks to the top of its cavity.
+ * STICK_EAST This window sticks to the right edge of its
+ * cavity.
+ * STICK_SOUTH This window sticks to the bottom of its cavity.
+ * STICK_WEST This window sticks to the left edge of its
+ * cavity.
*/
#define STICK_NORTH 1
@@ -231,14 +234,13 @@ typedef struct UniformGroup {
/*
* Flag values for Grid structures:
*
- * REQUESTED_RELAYOUT: 1 means a Tcl_DoWhenIdle request
- * has already been made to re-arrange
- * all the slaves of this window.
- *
- * DONT_PROPAGATE: 1 means don't set this window's requested
- * size. 0 means if this window is a master
- * then Tk will set its requested size to fit
- * the needs of its slaves.
+ * REQUESTED_RELAYOUT 1 means a Tcl_DoWhenIdle request has already
+ * been made to re-arrange all the slaves of this
+ * window.
+ * DONT_PROPAGATE 1 means don't set this window's requested
+ * size. 0 means if this window is a master then
+ * Tk will set its requested size to fit the
+ * needs of its slaves.
*/
#define REQUESTED_RELAYOUT 1
@@ -248,66 +250,71 @@ typedef struct UniformGroup {
* Prototypes for procedures used only in this file:
*/
-static void AdjustForSticky _ANSI_ARGS_((Gridder *slavePtr, int *xPtr,
- int *yPtr, int *widthPtr, int *heightPtr));
-static int AdjustOffsets _ANSI_ARGS_((int width,
- int elements, SlotInfo *slotPtr));
-static void ArrangeGrid _ANSI_ARGS_((ClientData clientData));
-static int CheckSlotData _ANSI_ARGS_((Gridder *masterPtr, int slot,
- int slotType, int checkOnly));
-static int ConfigureSlaves _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, int objc, Tcl_Obj *CONST objv[]));
-static void DestroyGrid _ANSI_ARGS_((char *memPtr));
-static Gridder *GetGrid _ANSI_ARGS_((Tk_Window tkwin));
-static int GridBboxCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int GridForgetRemoveCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int GridInfoCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int GridLocationCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int GridPropagateCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int GridRowColumnConfigureCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int GridSizeCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int GridSlavesCommand _ANSI_ARGS_((Tk_Window tkwin,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static void GridStructureProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void GridLostSlaveProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void GridReqProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void InitMasterData _ANSI_ARGS_((Gridder *masterPtr));
-static Tcl_Obj *NewPairObj _ANSI_ARGS_((Tcl_Interp*, int, int));
-static Tcl_Obj *NewQuadObj _ANSI_ARGS_((Tcl_Interp*, int, int, int, int));
-static int ResolveConstraints _ANSI_ARGS_((Gridder *gridPtr,
- int rowOrColumn, int maxOffset));
-static void SetGridSize _ANSI_ARGS_((Gridder *gridPtr));
-static int SetSlaveColumn _ANSI_ARGS_((Tcl_Interp *interp,
- Gridder *slavePtr, int column, int numCols));
-static int SetSlaveRow _ANSI_ARGS_((Tcl_Interp *interp,
- Gridder *slavePtr, int row, int numRows));
-static void StickyToString _ANSI_ARGS_((int flags, char *result));
-static int StringToSticky _ANSI_ARGS_((char *string));
-static void Unlink _ANSI_ARGS_((Gridder *gridPtr));
-
-static Tk_GeomMgr gridMgrType = {
+static void AdjustForSticky(Gridder *slavePtr, int *xPtr,
+ int *yPtr, int *widthPtr, int *heightPtr);
+static int AdjustOffsets(int width, int elements,
+ SlotInfo *slotPtr);
+static void ArrangeGrid(ClientData clientData);
+static int CheckSlotData(Gridder *masterPtr, int slot,
+ int slotType, int checkOnly);
+static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DestroyGrid(char *memPtr);
+static Gridder * GetGrid(Tk_Window tkwin);
+static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int GridBboxCommand(Tk_Window tkwin, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int GridForgetRemoveCommand(Tk_Window tkwin,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int GridInfoCommand(Tk_Window tkwin, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int GridLocationCommand(Tk_Window tkwin,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int GridPropagateCommand(Tk_Window tkwin,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int GridRowColumnConfigureCommand(Tk_Window tkwin,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int GridSlavesCommand(Tk_Window tkwin, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static void GridStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static void GridLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
+static void GridReqProc(ClientData clientData, Tk_Window tkwin);
+static void InitMasterData(Gridder *masterPtr);
+static Tcl_Obj * NewPairObj(int, int);
+static Tcl_Obj * NewQuadObj(int, int, int, int);
+static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn,
+ int maxOffset);
+static void SetGridSize(Gridder *gridPtr);
+static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr,
+ int column, int numCols);
+static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr,
+ int row, int numRows);
+static void StickyToString(int flags, char *result);
+static int StringToSticky(char *string);
+static void Unlink(Gridder *gridPtr);
+
+static const Tk_GeomMgr gridMgrType = {
"grid", /* name */
GridReqProc, /* requestProc */
GridLostSlaveProc, /* lostSlaveProc */
};
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* Tk_GridCmd --
*
- * This procedure is invoked to process the "grid" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "grid" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -315,31 +322,32 @@ static Tk_GeomMgr gridMgrType = {
* Side effects:
* See the user documentation.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
int
-Tk_GridObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_GridObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
static CONST char *optionStrings[] = {
- "bbox", "columnconfigure", "configure", "forget",
- "info", "location", "propagate", "remove",
- "rowconfigure", "size", "slaves", (char *) NULL };
+ "anchor", "bbox", "columnconfigure", "configure",
+ "forget", "info", "location", "propagate", "remove",
+ "rowconfigure", "size", "slaves", NULL
+ };
enum options {
- GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, GRID_FORGET,
- GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE,
- GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES };
+ GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE,
+ GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE,
+ GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES
+ };
int index;
-
-
+
if (objc >= 2) {
char *argv1 = Tcl_GetString(objv[1]);
+
if ((argv1[0] == '.') || (argv1[0] == REL_SKIP) ||
(argv1[0] == REL_VERT)) {
return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
@@ -356,22 +364,24 @@ Tk_GridObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case GRID_BBOX:
+ case GRID_ANCHOR:
+ return GridAnchorCommand(tkwin, interp, objc, objv);
+ case GRID_BBOX:
return GridBboxCommand(tkwin, interp, objc, objv);
- case GRID_CONFIGURE:
+ case GRID_CONFIGURE:
return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
- case GRID_FORGET:
- case GRID_REMOVE:
+ case GRID_FORGET:
+ case GRID_REMOVE:
return GridForgetRemoveCommand(tkwin, interp, objc, objv);
- case GRID_INFO:
+ case GRID_INFO:
return GridInfoCommand(tkwin, interp, objc, objv);
- case GRID_LOCATION:
+ case GRID_LOCATION:
return GridLocationCommand(tkwin, interp, objc, objv);
- case GRID_PROPAGATE:
+ case GRID_PROPAGATE:
return GridPropagateCommand(tkwin, interp, objc, objv);
- case GRID_SIZE:
+ case GRID_SIZE:
return GridSizeCommand(tkwin, interp, objc, objv);
- case GRID_SLAVES:
+ case GRID_SLAVES:
return GridSlavesCommand(tkwin, interp, objc, objv);
/*
@@ -383,8 +393,8 @@ Tk_GridObjCmd(clientData, interp, objc, objv)
* grid rowconfigure <master> <index> -option value -option value.
*/
- case GRID_COLUMNCONFIGURE:
- case GRID_ROWCONFIGURE:
+ case GRID_COLUMNCONFIGURE:
+ case GRID_ROWCONFIGURE:
return GridRowColumnConfigureCommand(tkwin, interp, objc, objv);
}
@@ -396,6 +406,75 @@ Tk_GridObjCmd(clientData, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
+ * GridAnchorCommand --
+ *
+ * Implementation of the [grid anchor] subcommand. See the user
+ * documentation for details on what it does.
+ *
+ * Results:
+ * Standard Tcl result.
+ *
+ * Side effects:
+ * May recompute grid geometry.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GridAnchorCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
+ Tk_Window master;
+ Gridder *masterPtr;
+ GridMaster *gridPtr;
+ Tk_Anchor old;
+
+ if (objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?anchor?");
+ return TCL_ERROR;
+ }
+
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ masterPtr = GetGrid(master);
+
+ if (objc == 3) {
+ gridPtr = masterPtr->masterDataPtr;
+ Tcl_SetResult(interp, (char *) Tk_NameOfAnchor(gridPtr == NULL ?
+ GRID_DEFAULT_ANCHOR : gridPtr->anchor), TCL_VOLATILE);
+ return TCL_OK;
+ }
+
+ InitMasterData(masterPtr);
+ gridPtr = masterPtr->masterDataPtr;
+ old = gridPtr->anchor;
+ if (Tk_GetAnchorFromObj(interp, objv[3], &gridPtr->anchor) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Only request a relayout if the anchor changes.
+ */
+
+ if (old != gridPtr->anchor) {
+ if (masterPtr->abortPtr != NULL) {
+ *masterPtr->abortPtr = 1;
+ }
+ if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
+ masterPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
+ }
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* GridBboxCommand --
*
* Implementation of the [grid bbox] subcommand.
@@ -410,11 +489,11 @@ Tk_GridObjCmd(clientData, interp, objc, objv)
*/
static int
-GridBboxCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridBboxCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr; /* master grid record */
@@ -424,17 +503,17 @@ GridBboxCommand(tkwin, interp, objc, objv)
int endX, endY; /* last column/row in the layout */
int x=0, y=0; /* starting pixels for this bounding box */
int width, height; /* size of the bounding box */
-
+
if (objc!=3 && objc != 5 && objc != 7) {
Tcl_WrongNumArgs(interp, 2, objv, "master ?column row ?column row??");
return TCL_ERROR;
}
-
+
if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
return TCL_ERROR;
}
masterPtr = GetGrid(master);
-
+
if (objc >= 5) {
if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) {
return TCL_ERROR;
@@ -445,7 +524,7 @@ GridBboxCommand(tkwin, interp, objc, objv)
column2 = column;
row2 = row;
}
-
+
if (objc == 7) {
if (Tcl_GetIntFromObj(interp, objv[5], &column2) != TCL_OK) {
return TCL_ERROR;
@@ -454,65 +533,70 @@ GridBboxCommand(tkwin, interp, objc, objv)
return TCL_ERROR;
}
}
-
+
gridPtr = masterPtr->masterDataPtr;
if (gridPtr == NULL) {
- Tcl_SetObjResult(interp, NewQuadObj(interp, 0, 0, 0, 0));
+ Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0));
return TCL_OK;
}
-
+
SetGridSize(masterPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
-
+
if ((endX == 0) || (endY == 0)) {
- Tcl_SetObjResult(interp, NewQuadObj(interp, 0, 0, 0, 0));
+ Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0));
return TCL_OK;
}
if (objc == 3) {
- row = column = 0;
+ row = 0;
+ column = 0;
row2 = endY;
column2 = endX;
}
-
+
if (column > column2) {
int temp = column;
- column = column2, column2 = temp;
+
+ column = column2;
+ column2 = temp;
}
if (row > row2) {
int temp = row;
- row = row2, row2 = temp;
+
+ row = row2;
+ row2 = temp;
}
-
+
if (column > 0 && column < endX) {
x = gridPtr->columnPtr[column-1].offset;
- } else if (column > 0) {
+ } else if (column > 0) {
x = gridPtr->columnPtr[endX-1].offset;
}
-
+
if (row > 0 && row < endY) {
y = gridPtr->rowPtr[row-1].offset;
} else if (row > 0) {
y = gridPtr->rowPtr[endY-1].offset;
}
-
+
if (column2 < 0) {
width = 0;
} else if (column2 >= endX) {
width = gridPtr->columnPtr[endX-1].offset - x;
} else {
width = gridPtr->columnPtr[column2].offset - x;
- }
-
+ }
+
if (row2 < 0) {
height = 0;
} else if (row2 >= endY) {
height = gridPtr->rowPtr[endY-1].offset - y;
} else {
height = gridPtr->rowPtr[row2].offset - y;
- }
-
- Tcl_SetObjResult(interp, NewQuadObj(interp,
+ }
+
+ Tcl_SetObjResult(interp, NewQuadObj(
x + gridPtr->startX, y + gridPtr->startY, width, height));
return TCL_OK;
}
@@ -522,8 +606,8 @@ GridBboxCommand(tkwin, interp, objc, objv)
*
* GridForgetRemoveCommand --
*
- * Implementation of the [grid forget]/[grid remove] subcommands.
- * See the user documentation for details on what these do.
+ * Implementation of the [grid forget]/[grid remove] subcommands. See the
+ * user documentation for details on what these do.
*
* Results:
* Standard Tcl result.
@@ -535,18 +619,18 @@ GridBboxCommand(tkwin, interp, objc, objv)
*/
static int
-GridForgetRemoveCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridForgetRemoveCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window slave;
Gridder *slavePtr;
int i;
char *string = Tcl_GetString(objv[1]);
char c = string[0];
-
+
for (i = 2; i < objc; i++) {
if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
return TCL_ERROR;
@@ -554,27 +638,48 @@ GridForgetRemoveCommand(tkwin, interp, objc, objv)
slavePtr = GetGrid(slave);
if (slavePtr->masterPtr != NULL) {
-
/*
* For "forget", reset all the settings to their defaults
*/
-
+
if (c == 'f') {
- slavePtr->column = slavePtr->row = -1;
+ slavePtr->column = -1;
+ slavePtr->row = -1;
slavePtr->numCols = 1;
slavePtr->numRows = 1;
- slavePtr->padX = slavePtr->padY = 0;
- slavePtr->padLeft = slavePtr->padTop = 0;
- slavePtr->iPadX = slavePtr->iPadY = 0;
+ slavePtr->padX = 0;
+ slavePtr->padY = 0;
+ slavePtr->padLeft = 0;
+ slavePtr->padTop = 0;
+ slavePtr->iPadX = 0;
+ slavePtr->iPadY = 0;
+ if (slavePtr->in != NULL) {
+ Tcl_DecrRefCount(slavePtr->in);
+ slavePtr->in = NULL;
+ }
slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
if (slavePtr->flags & REQUESTED_RELAYOUT) {
Tcl_CancelIdleCall(ArrangeGrid, (ClientData) slavePtr);
}
slavePtr->flags = 0;
slavePtr->sticky = 0;
+ } else {
+ /*
+ * When removing, store name of master to be able to
+ * restore it later, even if the master is recreated.
+ */
+
+ if (slavePtr->in != NULL) {
+ Tcl_DecrRefCount(slavePtr->in);
+ slavePtr->in = NULL;
+ }
+ if (slavePtr->masterPtr != NULL) {
+ slavePtr->in = Tcl_NewStringObj(
+ Tk_PathName(slavePtr->masterPtr->tkwin), -1);
+ Tcl_IncrRefCount(slavePtr->in);
+ }
}
- Tk_ManageGeometry(slave, (Tk_GeomMgr *) NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(slave, NULL, (ClientData) NULL);
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin,
slavePtr->masterPtr->tkwin);
@@ -591,7 +696,7 @@ GridForgetRemoveCommand(tkwin, interp, objc, objv)
*
* GridInfoCommand --
*
- * Implementation of the [grid info] subcommand. See the user
+ * Implementation of the [grid info] subcommand. See the user
* documentation for details on what it does.
*
* Results:
@@ -604,16 +709,16 @@ GridForgetRemoveCommand(tkwin, interp, objc, objv)
*/
static int
-GridInfoCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridInfoCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register Gridder *slavePtr;
Tk_Window slave;
char buffer[64 + TCL_INTEGER_SPACE * 4];
-
+
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
@@ -626,19 +731,19 @@ GridInfoCommand(tkwin, interp, objc, objv)
Tcl_ResetResult(interp);
return TCL_OK;
}
-
+
Tcl_AppendElement(interp, "-in");
Tcl_AppendElement(interp, Tk_PathName(slavePtr->masterPtr->tkwin));
sprintf(buffer, " -column %d -row %d -columnspan %d -rowspan %d",
slavePtr->column, slavePtr->row,
slavePtr->numCols, slavePtr->numRows);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
TkPrintPadAmount(interp, "ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
TkPrintPadAmount(interp, "ipady", slavePtr->iPadY/2, slavePtr->iPadY);
TkPrintPadAmount(interp, "padx", slavePtr->padLeft, slavePtr->padX);
TkPrintPadAmount(interp, "pady", slavePtr->padTop, slavePtr->padY);
StickyToString(slavePtr->sticky, buffer);
- Tcl_AppendResult(interp, " -sticky ", buffer, (char *) NULL);
+ Tcl_AppendResult(interp, " -sticky ", buffer, NULL);
return TCL_OK;
}
@@ -647,7 +752,7 @@ GridInfoCommand(tkwin, interp, objc, objv)
*
* GridLocationCommand --
*
- * Implementation of the [grid location] subcommand. See the user
+ * Implementation of the [grid location] subcommand. See the user
* documentation for details on what it does.
*
* Results:
@@ -660,58 +765,58 @@ GridInfoCommand(tkwin, interp, objc, objv)
*/
static int
-GridLocationCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridLocationCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window master;
- Gridder *masterPtr; /* master grid record */
- GridMaster *gridPtr; /* pointer to grid data */
+ Gridder *masterPtr; /* Master grid record. */
+ GridMaster *gridPtr; /* Pointer to grid data. */
register SlotInfo *slotPtr;
- int x, y; /* Offset in pixels, from edge of parent. */
- int i, j; /* Corresponding column and row indeces. */
- int endX, endY; /* end of grid */
-
+ int x, y; /* Offset in pixels, from edge of master. */
+ int i, j; /* Corresponding column and row indeces. */
+ int endX, endY; /* End of grid. */
+
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "master x y");
return TCL_ERROR;
}
-
+
if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
return TCL_ERROR;
}
-
+
if (Tk_GetPixelsFromObj(interp, master, objv[3], &x) != TCL_OK) {
return TCL_ERROR;
}
if (Tk_GetPixelsFromObj(interp, master, objv[4], &y) != TCL_OK) {
return TCL_ERROR;
}
-
+
masterPtr = GetGrid(master);
if (masterPtr->masterDataPtr == NULL) {
- Tcl_SetObjResult(interp, NewPairObj(interp, -1, -1));
+ Tcl_SetObjResult(interp, NewPairObj(-1, -1));
return TCL_OK;
}
gridPtr = masterPtr->masterDataPtr;
-
- /*
- * Update any pending requests. This is not always the
- * steady state value, as more configure events could be in
- * the pipeline, but its as close as its easy to get.
+
+ /*
+ * Update any pending requests. This is not always the steady state value,
+ * as more configure events could be in the pipeline, but its as close as
+ * its easy to get.
*/
-
+
while (masterPtr->flags & REQUESTED_RELAYOUT) {
Tcl_CancelIdleCall(ArrangeGrid, (ClientData) masterPtr);
- ArrangeGrid ((ClientData) masterPtr);
+ ArrangeGrid((ClientData) masterPtr);
}
SetGridSize(masterPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
-
- slotPtr = masterPtr->masterDataPtr->columnPtr;
+
+ slotPtr = masterPtr->masterDataPtr->columnPtr;
if (x < masterPtr->masterDataPtr->startX) {
i = -1;
} else {
@@ -720,8 +825,8 @@ GridLocationCommand(tkwin, interp, objc, objv)
/* null body */
}
}
-
- slotPtr = masterPtr->masterDataPtr->rowPtr;
+
+ slotPtr = masterPtr->masterDataPtr->rowPtr;
if (y < masterPtr->masterDataPtr->startY) {
j = -1;
} else {
@@ -730,8 +835,8 @@ GridLocationCommand(tkwin, interp, objc, objv)
/* null body */
}
}
-
- Tcl_SetObjResult(interp, NewPairObj(interp, i, j));
+
+ Tcl_SetObjResult(interp, NewPairObj(i, j));
return TCL_OK;
}
@@ -740,7 +845,7 @@ GridLocationCommand(tkwin, interp, objc, objv)
*
* GridPropagateCommand --
*
- * Implementation of the [grid propagate] subcommand. See the user
+ * Implementation of the [grid propagate] subcommand. See the user
* documentation for details on what it does.
*
* Results:
@@ -753,16 +858,16 @@ GridLocationCommand(tkwin, interp, objc, objv)
*/
static int
-GridPropagateCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridPropagateCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr;
int propagate, old;
-
+
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
return TCL_ERROR;
@@ -780,9 +885,11 @@ GridPropagateCommand(tkwin, interp, objc, objv)
if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) {
return TCL_ERROR;
}
-
- /* Only request a relayout if the propagation bit changes */
-
+
+ /*
+ * Only request a relayout if the propagation bit changes.
+ */
+
old = !(masterPtr->flags & DONT_PROPAGATE);
if (propagate != old) {
if (propagate) {
@@ -790,12 +897,12 @@ GridPropagateCommand(tkwin, interp, objc, objv)
} else {
masterPtr->flags |= DONT_PROPAGATE;
}
-
+
/*
* Re-arrange the master to allow new geometry information to
* propagate upwards to the master's master.
*/
-
+
if (masterPtr->abortPtr != NULL) {
*masterPtr->abortPtr = 1;
}
@@ -813,8 +920,7 @@ GridPropagateCommand(tkwin, interp, objc, objv)
* GridRowColumnConfigureCommand --
*
* Implementation of the [grid rowconfigure] and [grid columnconfigure]
- * subcommands. See the user documentation for details on what these
- * do.
+ * subcommands. See the user documentation for details on what these do.
*
* Results:
* Standard Tcl result.
@@ -826,27 +932,29 @@ GridPropagateCommand(tkwin, interp, objc, objv)
*/
static int
-GridRowColumnConfigureCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridRowColumnConfigureCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
+ Tk_Window master, slave;
+ Gridder *masterPtr, *slavePtr;
SlotInfo *slotPtr = NULL;
int slot; /* the column or row number */
int slotType; /* COLUMN or ROW */
int size; /* the configuration value */
- int checkOnly; /* check the size only */
int lObjc; /* Number of items in index list */
Tcl_Obj **lObjv; /* array of indices */
int ok; /* temporary TCL result code */
- int i, j;
+ int i, j, first, last;
char *string;
static CONST char *optionStrings[] = {
- "-minsize", "-pad", "-uniform", "-weight", (char *) NULL };
- enum options { ROWCOL_MINSIZE, ROWCOL_PAD, ROWCOL_UNIFORM, ROWCOL_WEIGHT };
+ "-minsize", "-pad", "-uniform", "-weight", NULL
+ };
+ enum options {
+ ROWCOL_MINSIZE, ROWCOL_PAD, ROWCOL_UNIFORM, ROWCOL_WEIGHT
+ };
int index;
Tcl_Obj *listCopy;
@@ -871,41 +979,40 @@ GridRowColumnConfigureCommand(tkwin, interp, objc, objv)
if (lObjc == 0) {
Tcl_AppendResult(interp, "no ",
(slotType == COLUMN) ? "column" : "row",
- " indices specified", (char *) NULL);
+ " indices specified", NULL);
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
- checkOnly = ((objc == 4) || (objc == 5));
masterPtr = GetGrid(master);
- if (checkOnly && (lObjc > 1)) {
- Tcl_AppendResult(interp, Tcl_GetString(objv[0]), " ",
- Tcl_GetString(objv[1]),
- ": must specify a single element on retrieval", (char *) NULL);
- Tcl_DecrRefCount(listCopy);
- return TCL_ERROR;
- }
- for (j = 0; j < lObjc; j++) {
- if (Tcl_GetIntFromObj(interp, lObjv[j], &slot) != TCL_OK) {
+ first = 0; /* lint */
+ last = 0; /* lint */
+
+ if ((objc == 4) || (objc == 5)) {
+ if (lObjc != 1) {
+ Tcl_AppendResult(interp, Tcl_GetString(objv[0]), " ",
+ Tcl_GetString(objv[1]),
+ ": must specify a single element on retrieval", NULL);
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
- ok = CheckSlotData(masterPtr, slot, slotType, checkOnly);
- if ((ok != TCL_OK) && ((objc < 4) || (objc > 5))) {
- Tcl_AppendResult(interp, Tcl_GetString(objv[0]), " ",
- Tcl_GetString(objv[1]), ": \"", Tcl_GetString(lObjv[j]),
- "\" is out of range", (char *) NULL);
+ if (Tcl_GetIntFromObj(interp, lObjv[0], &slot) != TCL_OK) {
+ Tcl_AppendResult(interp,
+ " (when retreiving options only integer indices are "
+ "allowed)", NULL);
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
- } else if (ok == TCL_OK) {
+ }
+ ok = CheckSlotData(masterPtr, slot, slotType, /* checkOnly */ 1);
+ if (ok == TCL_OK) {
slotPtr = (slotType == COLUMN) ?
masterPtr->masterDataPtr->columnPtr :
masterPtr->masterDataPtr->rowPtr;
}
/*
- * Return all of the options for this row or column. If the
- * request is out of range, return all 0's.
+ * Return all of the options for this row or column. If the request is
+ * out of range, return all 0's.
*/
if (objc == 4) {
@@ -939,116 +1046,200 @@ GridRowColumnConfigureCommand(tkwin, interp, objc, objv)
}
/*
- * Loop through each option value pair, setting the values as
- * required. If only one option is given, with no value, the
- * current value is returned.
+ * If only one option is given, with no value, the current value is
+ * returned.
*/
- for (i = 4; i < objc; i += 2) {
- if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option",
- 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[4], optionStrings, "option", 0,
+ &index) != TCL_OK) {
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
+ }
+ if (index == ROWCOL_MINSIZE) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewIntObj((ok == TCL_OK) ? slotPtr[slot].minSize : 0));
+ } else if (index == ROWCOL_WEIGHT) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewIntObj((ok == TCL_OK) ? slotPtr[slot].weight : 0));
+ } else if (index == ROWCOL_UNIFORM) {
+ Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : "";
+
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(value == NULL ? "" : value, -1));
+ } else if (index == ROWCOL_PAD) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewIntObj((ok == TCL_OK) ? slotPtr[slot].pad : 0));
+ }
+ Tcl_DecrRefCount(listCopy);
+ return TCL_OK;
+ }
+
+ for (j = 0; j < lObjc; j++) {
+ int allSlaves = 0;
+
+ if (Tcl_GetIntFromObj(NULL, lObjv[j], &slot) == TCL_OK) {
+ first = slot;
+ last = slot;
+ slavePtr = NULL;
+ } else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) {
+ /*
+ * Make sure master is initialised.
+ */
+
+ InitMasterData(masterPtr);
+
+ slavePtr = masterPtr->slavePtr;
+ if (slavePtr == NULL) {
+ continue;
+ }
+ allSlaves = 1;
+ } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &slave)
+ == TCL_OK) {
+ /*
+ * Is it gridded in this master?
+ */
+
+ slavePtr = GetGrid(slave);
+ if (slavePtr->masterPtr != masterPtr) {
+ Tcl_AppendResult(interp, Tcl_GetString(objv[0]), " ",
+ Tcl_GetString(objv[1]), ": the window \"",
+ Tcl_GetString(lObjv[j]), "\" is not managed by \"",
+ Tcl_GetString(objv[2]), "\"", NULL);
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
- if (index == ROWCOL_MINSIZE) {
- if (objc == 5) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(
- (ok == TCL_OK) ? slotPtr[slot].minSize : 0));
- } else if (Tk_GetPixelsFromObj(interp, master, objv[i+1], &size)
- != TCL_OK) {
- Tcl_DecrRefCount(listCopy);
- return TCL_ERROR;
- } else {
- slotPtr[slot].minSize = size;
- }
- } else if (index == ROWCOL_WEIGHT) {
- int wt;
- if (objc == 5) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(
- (ok == TCL_OK) ? slotPtr[slot].weight : 0));
- } else if (Tcl_GetIntFromObj(interp, objv[i+1], &wt)
- != TCL_OK) {
- Tcl_DecrRefCount(listCopy);
- return TCL_ERROR;
- } else if (wt < 0) {
- Tcl_AppendResult(interp, "invalid arg \"",
- Tcl_GetString(objv[i]),
- "\": should be non-negative", (char *) NULL);
- Tcl_DecrRefCount(listCopy);
+ } else {
+ Tcl_AppendResult(interp, Tcl_GetString(objv[0]), " ",
+ Tcl_GetString(objv[1]), ": illegal index \"",
+ Tcl_GetString(lObjv[j]), "\"", NULL);
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
+ }
+
+ /*
+ * The outer loop is only to handle "all".
+ */
+
+ do {
+ if (slavePtr != NULL) {
+ first = (slotType == COLUMN) ?
+ slavePtr->column : slavePtr->row;
+ last = first - 1 + ((slotType == COLUMN) ?
+ slavePtr->numCols : slavePtr->numRows);
+ }
+
+ for (slot = first; slot <= last; slot++) {
+ ok = CheckSlotData(masterPtr, slot, slotType, /*checkOnly*/ 0);
+ if (ok != TCL_OK) {
+ Tcl_AppendResult(interp, Tcl_GetString(objv[0]), " ",
+ Tcl_GetString(objv[1]), ": \"",
+ Tcl_GetString(lObjv[j]),
+ "\" is out of range", NULL);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
- } else {
- slotPtr[slot].weight = wt;
}
- } else if (index == ROWCOL_UNIFORM) {
- if (objc == 5) {
- Tk_Uid value;
- value = (ok == TCL_OK) ? slotPtr[slot].uniform : "";
- if (value == NULL) {
- value = "";
+ slotPtr = (slotType == COLUMN) ?
+ masterPtr->masterDataPtr->columnPtr :
+ masterPtr->masterDataPtr->rowPtr;
+
+ /*
+ * Loop through each option value pair, setting the values as
+ * required.
+ */
+
+ for (i = 4; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
+ "option", 0, &index) != TCL_OK) {
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(value, -1));
- } else {
- slotPtr[slot].uniform = Tk_GetUid(Tcl_GetString(objv[i+1]));
- if (slotPtr[slot].uniform != NULL &&
- slotPtr[slot].uniform[0] == 0) {
- slotPtr[slot].uniform = NULL;
+ if (index == ROWCOL_MINSIZE) {
+ if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ &size) != TCL_OK) {
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
+ } else {
+ slotPtr[slot].minSize = size;
+ }
+ } else if (index == ROWCOL_WEIGHT) {
+ int wt;
+
+ if (Tcl_GetIntFromObj(interp,objv[i+1],&wt)!=TCL_OK) {
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
+ } else if (wt < 0) {
+ Tcl_AppendResult(interp, "invalid arg \"",
+ Tcl_GetString(objv[i]),
+ "\": should be non-negative", NULL);
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
+ } else {
+ slotPtr[slot].weight = wt;
+ }
+ } else if (index == ROWCOL_UNIFORM) {
+ slotPtr[slot].uniform =
+ Tk_GetUid(Tcl_GetString(objv[i+1]));
+ if (slotPtr[slot].uniform != NULL &&
+ slotPtr[slot].uniform[0] == 0) {
+ slotPtr[slot].uniform = NULL;
+ }
+ } else if (index == ROWCOL_PAD) {
+ if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ &size) != TCL_OK) {
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
+ } else if (size < 0) {
+ Tcl_AppendResult(interp, "invalid arg \"",
+ Tcl_GetString(objv[i]),
+ "\": should be non-negative", NULL);
+ Tcl_DecrRefCount(listCopy);
+ return TCL_ERROR;
+ } else {
+ slotPtr[slot].pad = size;
+ }
}
}
- } else if (index == ROWCOL_PAD) {
- if (objc == 5) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(
- (ok == TCL_OK) ? slotPtr[slot].pad : 0));
- } else if (Tk_GetPixelsFromObj(interp, master, objv[i+1], &size)
- != TCL_OK) {
- Tcl_DecrRefCount(listCopy);
- return TCL_ERROR;
- } else if (size < 0) {
- Tcl_AppendResult(interp, "invalid arg \"",
- Tcl_GetString(objv[i]),
- "\": should be non-negative", (char *) NULL);
- Tcl_DecrRefCount(listCopy);
- return TCL_ERROR;
- } else {
- slotPtr[slot].pad = size;
- }
}
- }
+ if (slavePtr != NULL) {
+ slavePtr = slavePtr->nextPtr;
+ }
+ } while ((allSlaves == 1) && (slavePtr != NULL));
}
Tcl_DecrRefCount(listCopy);
/*
- * If we changed a property, re-arrange the table,
- * and check for constraint shrinkage.
+ * We changed a property, re-arrange the table, and check for constraint
+ * shrinkage. A null slotPtr will occur for 'all' checks.
*/
- if (objc != 5) {
+ if (slotPtr != NULL) {
if (slotType == ROW) {
int last = masterPtr->masterDataPtr->rowMax - 1;
+
while ((last >= 0) && (slotPtr[last].weight == 0)
- && (slotPtr[last].pad == 0)
- && (slotPtr[last].minSize == 0)
+ && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
masterPtr->masterDataPtr->rowMax = last+1;
} else {
int last = masterPtr->masterDataPtr->columnMax - 1;
+
while ((last >= 0) && (slotPtr[last].weight == 0)
- && (slotPtr[last].pad == 0)
- && (slotPtr[last].minSize == 0)
+ && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
masterPtr->masterDataPtr->columnMax = last + 1;
}
+ }
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
- }
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
- }
+ if (masterPtr->abortPtr != NULL) {
+ *masterPtr->abortPtr = 1;
+ }
+ if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
+ masterPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
}
return TCL_OK;
}
@@ -1058,7 +1249,7 @@ GridRowColumnConfigureCommand(tkwin, interp, objc, objv)
*
* GridSizeCommand --
*
- * Implementation of the [grid size] subcommand. See the user
+ * Implementation of the [grid size] subcommand. See the user
* documentation for details on what it does.
*
* Results:
@@ -1071,16 +1262,16 @@ GridRowColumnConfigureCommand(tkwin, interp, objc, objv)
*/
static int
-GridSizeCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridSizeCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr;
GridMaster *gridPtr; /* pointer to grid data */
-
+
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
@@ -1090,15 +1281,15 @@ GridSizeCommand(tkwin, interp, objc, objv)
return TCL_ERROR;
}
masterPtr = GetGrid(master);
-
+
if (masterPtr->masterDataPtr != NULL) {
SetGridSize(masterPtr);
gridPtr = masterPtr->masterDataPtr;
- Tcl_SetObjResult(interp, NewPairObj(interp,
+ Tcl_SetObjResult(interp, NewPairObj(
MAX(gridPtr->columnEnd, gridPtr->columnMax),
MAX(gridPtr->rowEnd, gridPtr->rowMax)));
} else {
- Tcl_SetObjResult(interp, NewPairObj(interp, 0, 0));
+ Tcl_SetObjResult(interp, NewPairObj(0, 0));
}
return TCL_OK;
}
@@ -1108,42 +1299,42 @@ GridSizeCommand(tkwin, interp, objc, objv)
*
* GridSlavesCommand --
*
- * Implementation of the [grid slaves] subcommand. See the user
+ * Implementation of the [grid slaves] subcommand. See the user
* documentation for details on what it does.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Places a list of slaves of the specified window in the
- * interpreter's result field.
+ * Places a list of slaves of the specified window in the interpreter's
+ * result field.
*
*----------------------------------------------------------------------
*/
static int
-GridSlavesCommand(tkwin, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+GridSlavesCommand(
+ Tk_Window tkwin, /* Main window of the application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr; /* master grid record */
Gridder *slavePtr;
- int i, value;
+ int i, value, index;
int row = -1, column = -1;
static CONST char *optionStrings[] = {
- "-column", "-row", (char *) NULL };
+ "-column", "-row", NULL
+ };
enum options { SLAVES_COLUMN, SLAVES_ROW };
- int index;
Tcl_Obj *res;
-
+
if ((objc < 3) || ((objc % 2) == 0)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value...?");
return TCL_ERROR;
}
-
+
for (i = 3; i < objc; i += 2) {
if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0,
&index) != TCL_OK) {
@@ -1154,8 +1345,7 @@ GridSlavesCommand(tkwin, interp, objc, objv)
}
if (value < 0) {
Tcl_AppendResult(interp, Tcl_GetString(objv[i]),
- " is an invalid value: should NOT be < 0",
- (char *) NULL);
+ " is an invalid value: should NOT be < 0", NULL);
return TCL_ERROR;
}
if (index == SLAVES_COLUMN) {
@@ -1172,7 +1362,7 @@ GridSlavesCommand(tkwin, interp, objc, objv)
res = Tcl_NewListObj(0, NULL);
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ slavePtr = slavePtr->nextPtr) {
if (column>=0 && (slavePtr->column > column
|| slavePtr->column+slavePtr->numCols-1 < column)) {
continue;
@@ -1189,30 +1379,29 @@ GridSlavesCommand(tkwin, interp, objc, objv)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* GridReqProc --
*
- * This procedure is invoked by Tk_GeometryRequest for
- * windows managed by the grid.
+ * This procedure is invoked by Tk_GeometryRequest for windows managed by
+ * the grid.
*
* Results:
* None.
*
* Side effects:
- * Arranges for tkwin, and all its managed siblings, to
- * be re-arranged at the next idle point.
+ * Arranges for tkwin, and all its managed siblings, to be re-arranged at
+ * the next idle point.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static void
-GridReqProc(clientData, tkwin)
- ClientData clientData; /* Grid's information about
- * window that got new preferred
- * geometry. */
- Tk_Window tkwin; /* Other Tk-related information
- * about the window. */
+GridReqProc(
+ ClientData clientData, /* Grid's information about window that got
+ * new preferred geometry. */
+ Tk_Window tkwin) /* Other Tk-related information about the
+ * window. */
{
register Gridder *gridPtr = (Gridder *) clientData;
@@ -1224,12 +1413,12 @@ GridReqProc(clientData, tkwin)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* GridLostSlaveProc --
*
- * This procedure is invoked by Tk whenever some other geometry
- * claims control over a slave that used to be managed by us.
+ * This procedure is invoked by Tk whenever some other geometry claims
+ * control over a slave that used to be managed by us.
*
* Results:
* None.
@@ -1237,14 +1426,14 @@ GridReqProc(clientData, tkwin)
* Side effects:
* Forgets all grid-related information about the slave.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static void
-GridLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Grid structure for slave window that
- * was stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+GridLostSlaveProc(
+ ClientData clientData, /* Grid structure for slave window that was
+ * stolen away. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
register Gridder *slavePtr = (Gridder *) clientData;
@@ -1256,39 +1445,38 @@ GridLostSlaveProc(clientData, tkwin)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* AdjustOffsets --
*
- * This procedure adjusts the size of the layout to fit in the
- * space provided. If it needs more space, the extra is added
- * according to the weights. If it needs less, the space is removed
- * according to the weights, but at no time does the size drop below
- * the minsize specified for that slot.
+ * This procedure adjusts the size of the layout to fit in the space
+ * provided. If it needs more space, the extra is added according to the
+ * weights. If it needs less, the space is removed according to the
+ * weights, but at no time does the size drop below the minsize specified
+ * for that slot.
*
* Results:
- * The initial offset of the layout,
- * if all the weights are zero, else 0.
+ * The size used by the layout.
*
* Side effects:
* The slot offsets are modified to shrink the layout.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static int
-AdjustOffsets(size, slots, slotPtr)
- int size; /* The total layout size (in pixels). */
- int slots; /* Number of slots. */
- register SlotInfo *slotPtr; /* Pointer to slot array. */
+AdjustOffsets(
+ int size, /* The total layout size (in pixels). */
+ int slots, /* Number of slots. */
+ register SlotInfo *slotPtr) /* Pointer to slot array. */
{
register int slot; /* Current slot. */
int diff; /* Extra pixels needed to add to the layout. */
- int totalWeight = 0; /* Sum of the weights for all the slots. */
- int weight = 0; /* Sum of the weights so far. */
+ int totalWeight; /* Sum of the weights for all the slots. */
+ int weight; /* Sum of the weights so far. */
int minSize; /* Minimum possible layout size. */
- int newDiff; /* The most pixels that can be added on
- * the current pass. */
+ int newDiff; /* The most pixels that can be added on the
+ * current pass. */
diff = size - slotPtr[slots-1].offset;
@@ -1297,24 +1485,24 @@ AdjustOffsets(size, slots, slotPtr)
*/
if (diff == 0) {
- return(0);
+ return size;
}
/*
- * If all the weights are zero, center the layout in its parent if
- * there is extra space, else clip on the bottom/right.
+ * If all the weights are zero, there is nothing more to do.
*/
+ totalWeight = 0;
for (slot = 0; slot < slots; slot++) {
totalWeight += slotPtr[slot].weight;
}
- if (totalWeight == 0 ) {
- return(diff > 0 ? diff/2 : 0);
+ if (totalWeight == 0) {
+ return slotPtr[slots-1].offset;
}
/*
- * Add extra space according to the slot weights. This is done
+ * Add extra space according to the slot weights. This is done
* cumulatively to prevent round-off error accumulation.
*/
@@ -1324,13 +1512,13 @@ AdjustOffsets(size, slots, slotPtr)
weight += slotPtr[slot].weight;
slotPtr[slot].offset += diff * weight / totalWeight;
}
- return(0);
+ return size;
}
/*
- * The layout must shrink below its requested size. Compute the
- * minimum possible size by looking at the slot minSizes.
- * Store each slot's minimum size in temp.
+ * The layout must shrink below its requested size. Compute the minimum
+ * possible size by looking at the slot minSizes. Store each slot's
+ * minimum size in temp.
*/
minSize = 0;
@@ -1346,34 +1534,35 @@ AdjustOffsets(size, slots, slotPtr)
}
/*
- * If the requested size is less than the minimum required size,
- * set the slot sizes to their minimum values, then clip on the
- * bottom/right.
+ * If the requested size is less than the minimum required size, set the
+ * slot sizes to their minimum values.
*/
if (size <= minSize) {
int offset = 0;
+
for (slot = 0; slot < slots; slot++) {
offset += slotPtr[slot].temp;
slotPtr[slot].offset = offset;
}
- return(0);
+ return minSize;
}
/*
- * Remove space from slots according to their weights. The weights
- * get renormalized anytime a slot shrinks to its minimum size.
+ * Remove space from slots according to their weights. The weights get
+ * renormalized anytime a slot shrinks to its minimum size.
*/
while (diff < 0) {
-
/*
* Find the total weight for the shrinkable slots.
*/
- for (totalWeight=slot=0; slot < slots; slot++) {
+ totalWeight = 0;
+ for (slot = 0; slot < slots; slot++) {
int current = (slot == 0) ? slotPtr[slot].offset :
slotPtr[slot].offset - slotPtr[slot-1].offset;
+
if (current > slotPtr[slot].minSize) {
totalWeight += slotPtr[slot].weight;
slotPtr[slot].temp = slotPtr[slot].weight;
@@ -1391,9 +1580,10 @@ AdjustOffsets(size, slots, slotPtr)
newDiff = diff;
for (slot = 0; slot < slots; slot++) {
- int current; /* current size of this slot */
- int maxDiff; /* max diff that would cause
- * this slot to equal its minsize */
+ int current; /* Current size of this slot. */
+ int maxDiff; /* Maximum diff that would cause this slot to
+ * equal its minsize. */
+
if (slotPtr[slot].temp == 0) {
continue;
}
@@ -1410,43 +1600,44 @@ AdjustOffsets(size, slots, slotPtr)
* Now distribute the space.
*/
- for (weight=slot=0; slot < slots; slot++) {
+ weight = 0;
+ for (slot = 0; slot < slots; slot++) {
weight += slotPtr[slot].temp;
slotPtr[slot].offset += newDiff * weight / totalWeight;
}
diff -= newDiff;
}
- return(0);
+ return size;
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* AdjustForSticky --
*
- * This procedure adjusts the size of a slave in its cavity based
- * on its "sticky" flags.
+ * This procedure adjusts the size of a slave in its cavity based on its
+ * "sticky" flags.
*
* Results:
- * The input x, y, width, and height are changed to represent the
- * desired coordinates of the slave.
+ * The input x, y, width, and height are changed to represent the desired
+ * coordinates of the slave.
*
* Side effects:
* None.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static void
-AdjustForSticky(slavePtr, xPtr, yPtr, widthPtr, heightPtr)
- Gridder *slavePtr; /* Slave window to arrange in its cavity. */
- int *xPtr; /* Pixel location of the left edge of the cavity. */
- int *yPtr; /* Pixel location of the top edge of the cavity. */
- int *widthPtr; /* Width of the cavity (in pixels). */
- int *heightPtr; /* Height of the cavity (in pixels). */
+AdjustForSticky(
+ Gridder *slavePtr, /* Slave window to arrange in its cavity. */
+ int *xPtr, /* Pixel location of the left edge of the cavity. */
+ int *yPtr, /* Pixel location of the top edge of the cavity. */
+ int *widthPtr, /* Width of the cavity (in pixels). */
+ int *heightPtr) /* Height of the cavity (in pixels). */
{
- int diffx=0; /* Cavity width - slave width. */
- int diffy=0; /* Cavity hight - slave height. */
+ int diffx = 0; /* Cavity width - slave width. */
+ int diffy = 0; /* Cavity hight - slave height. */
int sticky = slavePtr->sticky;
*xPtr += slavePtr->padLeft;
@@ -1479,14 +1670,13 @@ AdjustForSticky(slavePtr, xPtr, yPtr, widthPtr, heightPtr)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* ArrangeGrid --
*
- * This procedure is invoked (using the Tcl_DoWhenIdle
- * mechanism) to re-layout a set of windows managed by
- * the grid. It is invoked at idle time so that a
- * series of grid requests can be merged into a single
+ * This procedure is invoked (using the Tcl_DoWhenIdle mechanism) to
+ * re-layout a set of windows managed by the grid. It is invoked at idle
+ * time so that a series of grid requests can be merged into a single
* layout operation.
*
* Results:
@@ -1495,28 +1685,29 @@ AdjustForSticky(slavePtr, xPtr, yPtr, widthPtr, heightPtr)
* Side effects:
* The slaves of masterPtr may get resized or moved.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static void
-ArrangeGrid(clientData)
- ClientData clientData; /* Structure describing parent whose slaves
+ArrangeGrid(
+ ClientData clientData) /* Structure describing master whose slaves
* are to be re-layed out. */
{
register Gridder *masterPtr = (Gridder *) clientData;
- register Gridder *slavePtr;
+ register Gridder *slavePtr;
GridMaster *slotPtr = masterPtr->masterDataPtr;
int abort;
- int width, height; /* requested size of layout, in pixels */
- int realWidth, realHeight; /* actual size layout should take-up */
+ int width, height; /* Requested size of layout, in pixels. */
+ int realWidth, realHeight; /* Actual size layout should take-up. */
+ int usedX, usedY;
masterPtr->flags &= ~REQUESTED_RELAYOUT;
/*
- * If the parent has no slaves anymore, then don't do anything
- * at all: just leave the parent's size as-is. Otherwise there is
- * no way to "relinquish" control over the parent so another geometry
- * manager can take over.
+ * If the master has no slaves anymore, then don't do anything at all:
+ * just leave the master's size as-is. Otherwise there is no way to
+ * "relinquish" control over the master so another geometry manager can
+ * take over.
*/
if (masterPtr->slavePtr == NULL) {
@@ -1528,9 +1719,9 @@ ArrangeGrid(clientData)
}
/*
- * Abort any nested call to ArrangeGrid for this window, since
- * we'll do everything necessary here, and set up so this call
- * can be aborted if necessary.
+ * Abort any nested call to ArrangeGrid for this window, since we'll do
+ * everything necessary here, and set up so this call can be aborted if
+ * necessary.
*/
if (masterPtr->abortPtr != NULL) {
@@ -1545,13 +1736,13 @@ ArrangeGrid(clientData)
*/
SetGridSize(masterPtr);
- width = ResolveConstraints(masterPtr, COLUMN, 0);
+ width = ResolveConstraints(masterPtr, COLUMN, 0);
height = ResolveConstraints(masterPtr, ROW, 0);
width += Tk_InternalBorderLeft(masterPtr->tkwin) +
Tk_InternalBorderRight(masterPtr->tkwin);
height += Tk_InternalBorderTop(masterPtr->tkwin) +
Tk_InternalBorderBottom(masterPtr->tkwin);
-
+
if (width < Tk_MinReqWidth(masterPtr->tkwin)) {
width = Tk_MinReqWidth(masterPtr->tkwin);
}
@@ -1569,15 +1760,14 @@ ArrangeGrid(clientData)
}
masterPtr->abortPtr = NULL;
Tcl_Release((ClientData) masterPtr);
- return;
+ return;
}
/*
- * If the currently requested layout size doesn't match the parent's
- * window size, then adjust the slot offsets according to the
- * weights. If all of the weights are zero, center the layout in
- * its parent. I haven't decided what to do if the parent is smaller
- * than the requested size.
+ * If the currently requested layout size doesn't match the master's
+ * window size, then adjust the slot offsets according to the weights. If
+ * all of the weights are zero, place the layout according to the anchor
+ * value.
*/
realWidth = Tk_Width(masterPtr->tkwin) -
@@ -1586,23 +1776,22 @@ ArrangeGrid(clientData)
realHeight = Tk_Height(masterPtr->tkwin) -
Tk_InternalBorderTop(masterPtr->tkwin) -
Tk_InternalBorderBottom(masterPtr->tkwin);
- slotPtr->startX = AdjustOffsets(realWidth,
- MAX(slotPtr->columnEnd,slotPtr->columnMax), slotPtr->columnPtr);
- slotPtr->startY = AdjustOffsets(realHeight,
- MAX(slotPtr->rowEnd,slotPtr->rowMax), slotPtr->rowPtr);
- slotPtr->startX += Tk_InternalBorderLeft(masterPtr->tkwin);
- slotPtr->startY += Tk_InternalBorderTop(masterPtr->tkwin);
+ usedX = AdjustOffsets(realWidth,
+ MAX(slotPtr->columnEnd, slotPtr->columnMax), slotPtr->columnPtr);
+ usedY = AdjustOffsets(realHeight, MAX(slotPtr->rowEnd, slotPtr->rowMax),
+ slotPtr->rowPtr);
+ TkComputeAnchor(masterPtr->masterDataPtr->anchor, masterPtr->tkwin,
+ 0, 0, usedX, usedY, &slotPtr->startX, &slotPtr->startY);
/*
- * Now adjust the actual size of the slave to its cavity by
- * computing the cavity size, and adjusting the widget according
- * to its stickyness.
+ * Now adjust the actual size of the slave to its cavity by computing the
+ * cavity size, and adjusting the widget according to its stickyness.
*/
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort;
slavePtr = slavePtr->nextPtr) {
- int x, y; /* top left coordinate */
- int width, height; /* slot or slave size */
+ int x, y; /* Top left coordinate */
+ int width, height; /* Slot or slave size */
int col = slavePtr->column;
int row = slavePtr->row;
@@ -1612,49 +1801,47 @@ ArrangeGrid(clientData)
width = slotPtr->columnPtr[slavePtr->numCols+col-1].offset - x;
height = slotPtr->rowPtr[slavePtr->numRows+row-1].offset - y;
- x += slotPtr->startX;
- y += slotPtr->startY;
+ x += slotPtr->startX;
+ y += slotPtr->startY;
AdjustForSticky(slavePtr, &x, &y, &width, &height);
/*
- * Now put the window in the proper spot. (This was taken directly
- * from tkPack.c.) If the slave is a child of the master, then
- * do this here. Otherwise let Tk_MaintainGeometry do the work.
- */
-
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
- if ((width <= 0) || (height <= 0)) {
- Tk_UnmapWindow(slavePtr->tkwin);
- } else {
- if ((x != Tk_X(slavePtr->tkwin))
- || (y != Tk_Y(slavePtr->tkwin))
- || (width != Tk_Width(slavePtr->tkwin))
- || (height != Tk_Height(slavePtr->tkwin))) {
- Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
- }
- if (abort) {
- break;
- }
-
- /*
- * Don't map the slave if the master isn't mapped: wait
- * until the master gets mapped later.
- */
-
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
- }
- }
- } else {
- if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
- } else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin,
- x, y, width, height);
- }
- }
+ * Now put the window in the proper spot. (This was taken directly
+ * from tkPack.c.) If the slave is a child of the master, then do this
+ * here. Otherwise let Tk_MaintainGeometry do the work.
+ */
+
+ if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
+ if ((width <= 0) || (height <= 0)) {
+ Tk_UnmapWindow(slavePtr->tkwin);
+ } else {
+ if ((x != Tk_X(slavePtr->tkwin))
+ || (y != Tk_Y(slavePtr->tkwin))
+ || (width != Tk_Width(slavePtr->tkwin))
+ || (height != Tk_Height(slavePtr->tkwin))) {
+ Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
+ }
+ if (abort) {
+ break;
+ }
+
+ /*
+ * Don't map the slave if the master isn't mapped: wait until
+ * the master gets mapped later.
+ */
+
+ if (Tk_IsMapped(masterPtr->tkwin)) {
+ Tk_MapWindow(slavePtr->tkwin);
+ }
+ }
+ } else if ((width <= 0) || (height <= 0)) {
+ Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
+ Tk_UnmapWindow(slavePtr->tkwin);
+ } else {
+ Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, x, y,
+ width, height);
+ }
}
masterPtr->abortPtr = NULL;
@@ -1662,13 +1849,13 @@ ArrangeGrid(clientData)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* ResolveConstraints --
*
- * Resolve all of the column and row boundaries. Most of
- * the calculations are identical for rows and columns, so this procedure
- * is called twice, once for rows, and again for columns.
+ * Resolve all of the column and row boundaries. Most of the calculations
+ * are identical for rows and columns, so this procedure is called twice,
+ * once for rows, and again for columns.
*
* Results:
* The offset (in pixels) from the left/top edge of this layout is
@@ -1678,34 +1865,34 @@ ArrangeGrid(clientData)
* The slot offsets are copied into the SlotInfo structure for the
* geometry master.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static int
-ResolveConstraints(masterPtr, slotType, maxOffset)
- Gridder *masterPtr; /* The geometry master for this grid. */
- int slotType; /* Either ROW or COLUMN. */
- int maxOffset; /* The actual maximum size of this layout
- * in pixels, or 0 (not currently used). */
+ResolveConstraints(
+ Gridder *masterPtr, /* The geometry master for this grid. */
+ int slotType, /* Either ROW or COLUMN. */
+ int maxOffset) /* The actual maximum size of this layout in
+ * pixels, or 0 (not currently used). */
{
register SlotInfo *slotPtr; /* Pointer to row/col constraints. */
register Gridder *slavePtr; /* List of slave windows in this grid. */
int constraintCount; /* Count of rows or columns that have
- * constraints. */
+ * constraints. */
int slotCount; /* Last occupied row or column. */
- int gridCount; /* The larger of slotCount and constraintCount.
- */
+ int gridCount; /* The larger of slotCount and
+ * constraintCount. */
GridLayout *layoutPtr; /* Temporary layout structure. */
int requiredSize; /* The natural size of the grid (pixels).
* This is the minimum size needed to
* accomodate all of the slaves at their
* requested sizes. */
int offset; /* The pixel offset of the right edge of the
- * current slot from the beginning of the
- * layout. */
+ * current slot from the beginning of the
+ * layout. */
int slot; /* The current slot. */
int start; /* The first slot of a contiguous set whose
- * constraints are not yet fully resolved. */
+ * constraints are not yet fully resolved. */
int end; /* The Last slot of a contiguous set whose
* constraints are not yet fully resolved. */
UniformGroup uniformPre[UNIFORM_PREALLOC];
@@ -1713,13 +1900,14 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
UniformGroup *uniformGroupPtr;
/* Uniform groups data. */
int uniformGroups; /* Number of currently used uniform groups. */
- int uniformGroupsAlloced; /* Size of allocated space for uniform groups.
- */
+ int uniformGroupsAlloced; /* Size of allocated space for uniform
+ * groups. */
int weight, minSize;
+ int prevGrow, accWeight, grow;
/*
- * For typical sized tables, we'll use stack space for the layout data
- * to avoid the overhead of a malloc and free for every layout.
+ * For typical sized tables, we'll use stack space for the layout data to
+ * avoid the overhead of a malloc and free for every layout.
*/
GridLayout layoutData[TYPICAL_SIZE + 1];
@@ -1727,30 +1915,32 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
if (slotType == COLUMN) {
constraintCount = masterPtr->masterDataPtr->columnMax;
slotCount = masterPtr->masterDataPtr->columnEnd;
- slotPtr = masterPtr->masterDataPtr->columnPtr;
+ slotPtr = masterPtr->masterDataPtr->columnPtr;
} else {
constraintCount = masterPtr->masterDataPtr->rowMax;
slotCount = masterPtr->masterDataPtr->rowEnd;
- slotPtr = masterPtr->masterDataPtr->rowPtr;
+ slotPtr = masterPtr->masterDataPtr->rowPtr;
}
/*
* Make sure there is enough memory for the layout.
*/
- gridCount = MAX(constraintCount,slotCount);
+ gridCount = MAX(constraintCount, slotCount);
if (gridCount >= TYPICAL_SIZE) {
- layoutPtr = (GridLayout *) ckalloc(sizeof(GridLayout) * (1+gridCount));
+ layoutPtr = (GridLayout *)
+ ckalloc(sizeof(GridLayout) * (1+gridCount));
} else {
layoutPtr = layoutData;
}
/*
- * Allocate an extra layout slot to represent the left/top edge of
- * the 0th slot to make it easier to calculate slot widths from
- * offsets without special case code.
- * Initialize the "dummy" slot to the left/top of the table.
- * This slot avoids special casing the first slot.
+ * Allocate an extra layout slot to represent the left/top edge of the 0th
+ * slot to make it easier to calculate slot widths from offsets without
+ * special case code.
+ *
+ * Initialize the "dummy" slot to the left/top of the table. This slot
+ * avoids special casing the first slot.
*/
layoutPtr->minOffset = 0;
@@ -1759,74 +1949,77 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
/*
* Step 1.
- * Copy the slot constraints into the layout structure,
- * and initialize the rest of the fields.
+ * Copy the slot constraints into the layout structure, and initialize the
+ * rest of the fields.
*/
for (slot=0; slot < constraintCount; slot++) {
- layoutPtr[slot].minSize = slotPtr[slot].minSize;
- layoutPtr[slot].weight = slotPtr[slot].weight;
- layoutPtr[slot].uniform = slotPtr[slot].uniform;
- layoutPtr[slot].pad = slotPtr[slot].pad;
- layoutPtr[slot].binNextPtr = NULL;
+ layoutPtr[slot].minSize = slotPtr[slot].minSize;
+ layoutPtr[slot].weight = slotPtr[slot].weight;
+ layoutPtr[slot].uniform = slotPtr[slot].uniform;
+ layoutPtr[slot].pad = slotPtr[slot].pad;
+ layoutPtr[slot].binNextPtr = NULL;
}
- for(;slot<gridCount;slot++) {
- layoutPtr[slot].minSize = 0;
- layoutPtr[slot].weight = 0;
- layoutPtr[slot].uniform = NULL;
- layoutPtr[slot].pad = 0;
- layoutPtr[slot].binNextPtr = NULL;
+ for (; slot<gridCount; slot++) {
+ layoutPtr[slot].minSize = 0;
+ layoutPtr[slot].weight = 0;
+ layoutPtr[slot].uniform = NULL;
+ layoutPtr[slot].pad = 0;
+ layoutPtr[slot].binNextPtr = NULL;
}
/*
* Step 2.
- * Slaves with a span of 1 are used to determine the minimum size of
- * each slot. Slaves whose span is two or more slots don't
- * contribute to the minimum size of each slot directly, but can cause
- * slots to grow if their size exceeds the the sizes of the slots they
- * span.
- *
- * Bin all slaves whose spans are > 1 by their right edges. This
- * allows the computation on minimum and maximum possible layout
- * sizes at each slot boundary, without the need to re-sort the slaves.
+ * Slaves with a span of 1 are used to determine the minimum size of each
+ * slot. Slaves whose span is two or more slots don't contribute to the
+ * minimum size of each slot directly, but can cause slots to grow if
+ * their size exceeds the the sizes of the slots they span.
+ *
+ * Bin all slaves whose spans are > 1 by their right edges. This allows
+ * the computation on minimum and maximum possible layout sizes at each
+ * slot boundary, without the need to re-sort the slaves.
*/
-
+
switch (slotType) {
- case COLUMN:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- int rightEdge = slavePtr->column + slavePtr->numCols - 1;
- slavePtr->size = Tk_ReqWidth(slavePtr->tkwin) +
- slavePtr->padX + slavePtr->iPadX + slavePtr->doubleBw;
- if (slavePtr->numCols > 1) {
- slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
- layoutPtr[rightEdge].binNextPtr = slavePtr;
- } else {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
- if (size > layoutPtr[rightEdge].minSize) {
- layoutPtr[rightEdge].minSize = size;
- }
+ case COLUMN:
+ for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
+ slavePtr = slavePtr->nextPtr) {
+ int rightEdge = slavePtr->column + slavePtr->numCols - 1;
+
+ slavePtr->size = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->padX
+ + slavePtr->iPadX + slavePtr->doubleBw;
+ if (slavePtr->numCols > 1) {
+ slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = slavePtr;
+ } else {
+ int size = slavePtr->size + layoutPtr[rightEdge].pad;
+
+ if (size > layoutPtr[rightEdge].minSize) {
+ layoutPtr[rightEdge].minSize = size;
}
}
- break;
- case ROW:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- int rightEdge = slavePtr->row + slavePtr->numRows - 1;
- slavePtr->size = Tk_ReqHeight(slavePtr->tkwin) +
- slavePtr->padY + slavePtr->iPadY + slavePtr->doubleBw;
- if (slavePtr->numRows > 1) {
- slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
- layoutPtr[rightEdge].binNextPtr = slavePtr;
- } else {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
- if (size > layoutPtr[rightEdge].minSize) {
- layoutPtr[rightEdge].minSize = size;
- }
+ }
+ break;
+ case ROW:
+ for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
+ slavePtr = slavePtr->nextPtr) {
+ int rightEdge = slavePtr->row + slavePtr->numRows - 1;
+
+ slavePtr->size = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->padY
+ + slavePtr->iPadY + slavePtr->doubleBw;
+ if (slavePtr->numRows > 1) {
+ slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = slavePtr;
+ } else {
+ int size = slavePtr->size + layoutPtr[rightEdge].pad;
+
+ if (size > layoutPtr[rightEdge].minSize) {
+ layoutPtr[rightEdge].minSize = size;
}
}
- break;
}
+ break;
+ }
/*
* Step 2b.
@@ -1858,13 +2051,14 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
* sizeof(UniformGroup);
size_t newSize = (uniformGroupsAlloced + UNIFORM_PREALLOC)
* sizeof(UniformGroup);
- UniformGroup *new = (UniformGroup *) ckalloc(newSize);
- UniformGroup *old = uniformGroupPtr;
- memcpy((VOID *) new, (VOID *) old, oldSize);
- if (old != uniformPre) {
- ckfree((char *) old);
+ UniformGroup *newUG = (UniformGroup *) ckalloc(newSize);
+ UniformGroup *oldUG = uniformGroupPtr;
+
+ memcpy(newUG, oldUG, oldSize);
+ if (oldUG != uniformPre) {
+ ckfree((char *) oldUG);
}
- uniformGroupPtr = new;
+ uniformGroupPtr = newUG;
uniformGroupsAlloced += UNIFORM_PREALLOC;
}
uniformGroups++;
@@ -1907,54 +2101,58 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
/*
* Step 3.
- * Determine the minimum slot offsets going from left to right
- * that would fit all of the slaves. This determines the minimum
+ * Determine the minimum slot offsets going from left to right that would
+ * fit all of the slaves. This determines the minimum
*/
- for (offset=slot=0; slot < gridCount; slot++) {
- layoutPtr[slot].minOffset = layoutPtr[slot].minSize + offset;
- for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
- slavePtr = slavePtr->binNextPtr) {
- int span = (slotType == COLUMN) ? slavePtr->numCols : slavePtr->numRows;
- int required = slavePtr->size + layoutPtr[slot - span].minOffset;
- if (required > layoutPtr[slot].minOffset) {
- layoutPtr[slot].minOffset = required;
- }
- }
- offset = layoutPtr[slot].minOffset;
+ for (offset=0,slot=0; slot < gridCount; slot++) {
+ layoutPtr[slot].minOffset = layoutPtr[slot].minSize + offset;
+ for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
+ slavePtr = slavePtr->binNextPtr) {
+ int span = (slotType == COLUMN) ?
+ slavePtr->numCols : slavePtr->numRows;
+ int required = slavePtr->size + layoutPtr[slot - span].minOffset;
+
+ if (required > layoutPtr[slot].minOffset) {
+ layoutPtr[slot].minOffset = required;
+ }
+ }
+ offset = layoutPtr[slot].minOffset;
}
/*
* At this point, we know the minimum required size of the entire layout.
- * It might be prudent to stop here if our "master" will resize itself
- * to this size.
+ * It might be prudent to stop here if our "master" will resize itself to
+ * this size.
*/
requiredSize = offset;
if (maxOffset > offset) {
- offset=maxOffset;
+ offset=maxOffset;
}
/*
* Step 4.
- * Determine the minimum slot offsets going from right to left,
- * bounding the pixel range of each slot boundary.
- * Pre-fill all of the right offsets with the actual size of the table;
- * they will be reduced as required.
+ * Determine the minimum slot offsets going from right to left, bounding
+ * the pixel range of each slot boundary. Pre-fill all of the right
+ * offsets with the actual size of the table; they will be reduced as
+ * required.
*/
for (slot=0; slot < gridCount; slot++) {
- layoutPtr[slot].maxOffset = offset;
+ layoutPtr[slot].maxOffset = offset;
}
for (slot=gridCount-1; slot > 0;) {
- for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
- slavePtr = slavePtr->binNextPtr) {
- int span = (slotType == COLUMN) ? slavePtr->numCols : slavePtr->numRows;
- int require = offset - slavePtr->size;
- int startSlot = slot - span;
- if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) {
- layoutPtr[startSlot].maxOffset = require;
- }
+ for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
+ slavePtr = slavePtr->binNextPtr) {
+ int span = (slotType == COLUMN) ?
+ slavePtr->numCols : slavePtr->numRows;
+ int require = offset - slavePtr->size;
+ int startSlot = slot - span;
+
+ if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) {
+ layoutPtr[startSlot].maxOffset = require;
+ }
}
offset -= layoutPtr[slot].minSize;
slot--;
@@ -1967,58 +2165,56 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
/*
* Step 5.
- * At this point, each slot boundary has a range of values that
- * will satisfy the overall layout size.
- * Make repeated passes over the layout structure looking for
- * spans of slot boundaries where the minOffsets are less than
- * the maxOffsets, and adjust the offsets according to the slot
- * weights. At each pass, at least one slot boundary will have
- * its range of possible values fixed at a single value.
+ * At this point, each slot boundary has a range of values that will
+ * satisfy the overall layout size. Make repeated passes over the layout
+ * structure looking for spans of slot boundaries where the minOffsets are
+ * less than the maxOffsets, and adjust the offsets according to the slot
+ * weights. At each pass, at least one slot boundary will have its range
+ * of possible values fixed at a single value.
*/
- for (start=0; start < gridCount;) {
- int totalWeight = 0; /* Sum of the weights for all of the
- * slots in this span. */
- int need = 0; /* The minimum space needed to layout
- * this span. */
- int have; /* The actual amount of space that will
- * be taken up by this span. */
- int weight; /* Cumulative weights of the columns in
- * this span. */
- int noWeights = 0; /* True if the span has no weights. */
-
- /*
- * Find a span by identifying ranges of slots whose edges are
- * already constrained at fixed offsets, but whose internal
- * slot boundaries have a range of possible positions.
- */
-
- if (layoutPtr[start].minOffset == layoutPtr[start].maxOffset) {
+ for (start = 0; start < gridCount;) {
+ int totalWeight = 0; /* Sum of the weights for all of the slots in
+ * this span. */
+ int need = 0; /* The minimum space needed to layout this
+ * span. */
+ int have; /* The actual amount of space that will be
+ * taken up by this span. */
+ int weight; /* Cumulative weights of the columns in this
+ * span. */
+ int noWeights = 0; /* True if the span has no weights. */
+
+ /*
+ * Find a span by identifying ranges of slots whose edges are already
+ * constrained at fixed offsets, but whose internal slot boundaries
+ * have a range of possible positions.
+ */
+
+ if (layoutPtr[start].minOffset == layoutPtr[start].maxOffset) {
start++;
continue;
}
- for (end=start+1; end<gridCount; end++) {
+ for (end = start + 1; end < gridCount; end++) {
if (layoutPtr[end].minOffset == layoutPtr[end].maxOffset) {
break;
}
}
/*
- * We found a span. Compute the total weight, minumum space required,
- * for this span, and the actual amount of space the span should
- * use.
+ * We found a span. Compute the total weight, minumum space required,
+ * for this span, and the actual amount of space the span should use.
*/
- for (slot=start; slot<=end; slot++) {
+ for (slot = start; slot <= end; slot++) {
totalWeight += layoutPtr[slot].weight;
need += layoutPtr[slot].minSize;
}
have = layoutPtr[end].maxOffset - layoutPtr[start-1].minOffset;
/*
- * If all the weights in the span are zero, then distribute the
- * extra space evenly.
+ * If all the weights in the span are zero, then distribute the extra
+ * space evenly.
*/
if (totalWeight == 0) {
@@ -2028,100 +2224,180 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
/*
* It might not be possible to give the span all of the space
- * available on this pass without violating the size constraints
- * of one or more of the internal slot boundaries.
- * Determine the maximum amount of space that when added to the
- * entire span, would cause a slot boundary to have its possible
- * range reduced to one value, and reduce the amount of extra
- * space allocated on this pass accordingly.
- *
- * The calculation is done cumulatively to avoid accumulating
- * roundoff errors.
+ * available on this pass without violating the size constraints of
+ * one or more of the internal slot boundaries. Try to determine the
+ * maximum amount of space that when added to the entire span, would
+ * cause a slot boundary to have its possible range reduced to one
+ * value, and reduce the amount of extra space allocated on this pass
+ * accordingly.
+ *
+ * The calculation is done cumulatively to avoid accumulating roundoff
+ * errors.
*/
- for (weight=0,slot=start; slot<end; slot++) {
- int diff = layoutPtr[slot].maxOffset - layoutPtr[slot].minOffset;
- weight += noWeights ? 1 : layoutPtr[slot].weight;
- if ((noWeights || layoutPtr[slot].weight>0) &&
- (diff*totalWeight/weight) < (have-need)) {
- have = diff * totalWeight / weight + need;
+ do {
+ int prevMinOffset = layoutPtr[start - 1].minOffset;
+
+ prevGrow = 0;
+ accWeight = 0;
+ for (slot = start; slot <= end; slot++) {
+ weight = noWeights ? 1 : layoutPtr[slot].weight;
+ accWeight += weight;
+ grow = (have - need) * accWeight / totalWeight - prevGrow;
+ prevGrow += grow;
+
+ if ((weight > 0) &&
+ ((prevMinOffset + layoutPtr[slot].minSize + grow)
+ > layoutPtr[slot].maxOffset)) {
+ int newHave;
+
+ /*
+ * There is not enough room to grow that much. Calculate
+ * how much this slot can grow and how much "have" that
+ * corresponds to.
+ */
+
+ grow = layoutPtr[slot].maxOffset -
+ layoutPtr[slot].minSize - prevMinOffset;
+ newHave = grow * totalWeight / weight;
+ if (newHave > totalWeight) {
+ /*
+ * By distributing multiples of totalWeight we
+ * minimize rounding errors since they will only
+ * happen in the last loop(s).
+ */
+
+ newHave = newHave / totalWeight * totalWeight;
+ }
+ if (newHave <= 0) {
+ /*
+ * We can end up with a "have" of 0 here if the
+ * previous slots have taken all the space. In that
+ * case we cannot guess an appropriate "have" so we
+ * just try some lower "have" that is >= 1, to make
+ * sure this terminates.
+ */
+
+ newHave = (have - need) - 1;
+ if (newHave > (3 * totalWeight)) {
+ /*
+ * Go down 25% for large values.
+ */
+ newHave = newHave * 3 / 4;
+ }
+
+ if (newHave > totalWeight) {
+ /*
+ * Round down to a multiple of totalWeight.
+ */
+ newHave = newHave / totalWeight * totalWeight;
+ }
+
+ if (newHave <= 0) {
+ newHave = 1;
+ }
+ }
+ have = newHave + need;
+
+ /*
+ * Restart loop to check if the new "have" will fit.
+ */
+
+ break;
+ }
+ prevMinOffset += layoutPtr[slot].minSize + grow;
+ if (prevMinOffset < layoutPtr[slot].minOffset) {
+ prevMinOffset = layoutPtr[slot].minOffset;
+ }
}
- }
+
+ /*
+ * Quit the outer loop if the inner loop ran all the way.
+ */
+ } while (slot <= end);
/*
- * Now distribute the extra space among the slots by
- * adjusting the minSizes and minOffsets.
+ * Now distribute the extra space among the slots by adjusting the
+ * minSizes and minOffsets.
*/
- for (weight=0,slot=start; slot<end; slot++) {
- weight += noWeights ? 1 : layoutPtr[slot].weight;
- layoutPtr[slot].minOffset +=
- (int)((double) (have-need) * weight/totalWeight + 0.5);
- layoutPtr[slot].minSize = layoutPtr[slot].minOffset
- - layoutPtr[slot-1].minOffset;
+ prevGrow = 0;
+ accWeight = 0;
+ for (slot = start; slot <= end; slot++) {
+ accWeight += noWeights ? 1 : layoutPtr[slot].weight;
+ grow = (have - need) * accWeight / totalWeight - prevGrow;
+ prevGrow += grow;
+ layoutPtr[slot].minSize += grow;
+ if ((layoutPtr[slot-1].minOffset + layoutPtr[slot].minSize)
+ > layoutPtr[slot].minOffset) {
+ layoutPtr[slot].minOffset = layoutPtr[slot-1].minOffset +
+ layoutPtr[slot].minSize;
+ }
}
- layoutPtr[slot].minSize = layoutPtr[slot].minOffset
- - layoutPtr[slot-1].minOffset;
/*
- * Having pushed the top/left boundaries of the slots to
- * take up extra space, the bottom/right space is recalculated
- * to propagate the new space allocation.
+ * Having pushed the top/left boundaries of the slots to take up extra
+ * space, the bottom/right space is recalculated to propagate the new
+ * space allocation.
*/
- for (slot=end; slot > start; slot--) {
- layoutPtr[slot-1].maxOffset =
- layoutPtr[slot].maxOffset-layoutPtr[slot].minSize;
+ for (slot = end; slot > start; slot--) {
+ /*
+ * maxOffset may not go up.
+ */
+
+ if ((layoutPtr[slot].maxOffset-layoutPtr[slot].minSize)
+ < layoutPtr[slot-1].maxOffset) {
+ layoutPtr[slot-1].maxOffset =
+ layoutPtr[slot].maxOffset-layoutPtr[slot].minSize;
+ }
}
}
-
/*
* Step 6.
- * All of the space has been apportioned; copy the
- * layout information back into the master.
+ * All of the space has been apportioned; copy the layout information back
+ * into the master.
*/
for (slot=0; slot < gridCount; slot++) {
- slotPtr[slot].offset = layoutPtr[slot].minOffset;
+ slotPtr[slot].offset = layoutPtr[slot].minOffset;
}
--layoutPtr;
if (layoutPtr != layoutData) {
- ckfree((char *)layoutPtr);
+ ckfree((char *) layoutPtr);
}
return requiredSize;
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* GetGrid --
*
- * This internal procedure is used to locate a Grid
- * structure for a given window, creating one if one
- * doesn't exist already.
+ * This internal procedure is used to locate a Grid structure for a given
+ * window, creating one if one doesn't exist already.
*
* Results:
- * The return value is a pointer to the Grid structure
- * corresponding to tkwin.
+ * The return value is a pointer to the Grid structure corresponding to
+ * tkwin.
*
* Side effects:
- * A new grid structure may be created. If so, then
- * a callback is set up to clean things up when the
- * window is deleted.
+ * A new grid structure may be created. If so, then a callback is set up
+ * to clean things up when the window is deleted.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static Gridder *
-GetGrid(tkwin)
- Tk_Window tkwin; /* Token for window for which
- * grid structure is desired. */
+GetGrid(
+ Tk_Window tkwin) /* Token for window for which grid structure
+ * is desired. */
{
register Gridder *gridPtr;
Tcl_HashEntry *hPtr;
- int new;
+ int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->gridInit) {
@@ -2130,12 +2406,12 @@ GetGrid(tkwin)
}
/*
- * See if there's already grid for this window. If not,
- * then create a new one.
+ * See if there's already grid for this window. If not, then create a new
+ * one.
*/
- hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char *) tkwin, &new);
- if (!new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char*) tkwin, &isNew);
+ if (!isNew) {
return (Gridder *) Tcl_GetHashValue(hPtr);
}
gridPtr = (Gridder *) ckalloc(sizeof(Gridder));
@@ -2146,18 +2422,23 @@ GetGrid(tkwin)
gridPtr->slavePtr = NULL;
gridPtr->binNextPtr = NULL;
- gridPtr->column = gridPtr->row = -1;
+ gridPtr->column = -1;
+ gridPtr->row = -1;
gridPtr->numCols = 1;
gridPtr->numRows = 1;
- gridPtr->padX = gridPtr->padY = 0;
- gridPtr->padLeft = gridPtr->padTop = 0;
- gridPtr->iPadX = gridPtr->iPadY = 0;
+ gridPtr->padX = 0;
+ gridPtr->padY = 0;
+ gridPtr->padLeft = 0;
+ gridPtr->padTop = 0;
+ gridPtr->iPadX = 0;
+ gridPtr->iPadY = 0;
gridPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
gridPtr->abortPtr = NULL;
gridPtr->flags = 0;
gridPtr->sticky = 0;
gridPtr->size = 0;
+ gridPtr->in = NULL;
gridPtr->masterDataPtr = NULL;
Tcl_SetHashValue(hPtr, gridPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
@@ -2166,35 +2447,34 @@ GetGrid(tkwin)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* SetGridSize --
*
- * This internal procedure sets the size of the grid occupied
- * by slaves.
+ * This internal procedure sets the size of the grid occupied by slaves.
*
* Results:
- * none
+ * None
*
* Side effects:
- * The width and height arguments are filled in the master data structure.
- * Additional space is allocated for the constraints to accomodate
- * the offsets.
+ * The width and height arguments are filled in the master data
+ * structure. Additional space is allocated for the constraints to
+ * accomodate the offsets.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static void
-SetGridSize(masterPtr)
- Gridder *masterPtr; /* The geometry master for this grid. */
+SetGridSize(
+ Gridder *masterPtr) /* The geometry master for this grid. */
{
- register Gridder *slavePtr; /* Current slave window. */
+ register Gridder *slavePtr; /* Current slave window. */
int maxX = 0, maxY = 0;
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- maxX = MAX(maxX,slavePtr->numCols + slavePtr->column);
- maxY = MAX(maxY,slavePtr->numRows + slavePtr->row);
+ slavePtr = slavePtr->nextPtr) {
+ maxX = MAX(maxX, slavePtr->numCols + slavePtr->column);
+ maxY = MAX(maxY, slavePtr->numRows + slavePtr->row);
}
masterPtr->masterDataPtr->columnEnd = maxX;
masterPtr->masterDataPtr->rowEnd = maxY;
@@ -2207,37 +2487,37 @@ SetGridSize(masterPtr)
*
* SetSlaveColumn --
*
- * Update column data for a slave, checking that MAX_ELEMENT bound
+ * Update column data for a slave, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
- * TCL_ERROR if out of bounds, TCL_OK otherwise
+ * TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Slave fields are updated.
*
*----------------------------------------------------------------------
*/
static int
SetSlaveColumn(
- Tcl_Interp *interp, /* Interp for error message */
- Gridder *slavePtr, /* Slave to be updated */
- int column, /* New column or -1 to be unchanged */
- int numCols) /* New columnspan or -1 to be unchanged */
+ Tcl_Interp *interp, /* Interp for error message. */
+ Gridder *slavePtr, /* Slave to be updated. */
+ int column, /* New column or -1 to be unchanged. */
+ int numCols) /* New columnspan or -1 to be unchanged. */
{
int newColumn, newNumCols, lastCol;
- newColumn = (column >= 0) ? column : slavePtr->column;
+ newColumn = (column >= 0) ? column : slavePtr->column;
newNumCols = (numCols >= 1) ? numCols : slavePtr->numCols;
- lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols;
+ lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols;
if (lastCol >= MAX_ELEMENT) {
- Tcl_SetResult(interp, "Column out of bounds", TCL_STATIC);
- return TCL_ERROR;
+ Tcl_SetResult(interp, "Column out of bounds", TCL_STATIC);
+ return TCL_ERROR;
}
- slavePtr->column = newColumn;
+ slavePtr->column = newColumn;
slavePtr->numCols = newNumCols;
return TCL_OK;
}
@@ -2247,70 +2527,70 @@ SetSlaveColumn(
*
* SetSlaveRow --
*
- * Update row data for a slave, checking that MAX_ELEMENT bound
+ * Update row data for a slave, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
- * TCL_ERROR if out of bounds, TCL_OK otherwise
+ * TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Slave fields are updated.
*
*----------------------------------------------------------------------
*/
static int
SetSlaveRow(
- Tcl_Interp *interp, /* Interp for error message */
- Gridder *slavePtr, /* Slave to be updated */
- int row, /* New row or -1 to be unchanged */
- int numRows) /* New rowspan or -1 to be unchanged */
+ Tcl_Interp *interp, /* Interp for error message. */
+ Gridder *slavePtr, /* Slave to be updated. */
+ int row, /* New row or -1 to be unchanged. */
+ int numRows) /* New rowspan or -1 to be unchanged. */
{
int newRow, newNumRows, lastRow;
- newRow = (row >= 0) ? row : slavePtr->row;
+ newRow = (row >= 0) ? row : slavePtr->row;
newNumRows = (numRows >= 1) ? numRows : slavePtr->numRows;
- lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows;
+ lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows;
if (lastRow >= MAX_ELEMENT) {
- Tcl_SetResult(interp, "Row out of bounds", TCL_STATIC);
- return TCL_ERROR;
+ Tcl_SetResult(interp, "Row out of bounds", TCL_STATIC);
+ return TCL_ERROR;
}
- slavePtr->row = newRow;
+ slavePtr->row = newRow;
slavePtr->numRows = newNumRows;
return TCL_OK;
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* CheckSlotData --
*
- * This internal procedure is used to manage the storage for
- * row and column (slot) constraints.
+ * This internal procedure is used to manage the storage for row and
+ * column (slot) constraints.
*
* Results:
* TRUE if the index is OK, False otherwise.
*
* Side effects:
- * A new master grid structure may be created. If so, then
- * it is initialized. In addition, additional storage for
- * a row or column constraints may be allocated, and the constraint
- * maximums are adjusted.
+ * A new master grid structure may be created. If so, then it is
+ * initialized. In addition, additional storage for a row or column
+ * constraints may be allocated, and the constraint maximums are
+ * adjusted.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static int
-CheckSlotData(masterPtr, slot, slotType, checkOnly)
- Gridder *masterPtr; /* the geometry master for this grid */
- int slot; /* which slot to look at */
- int slotType; /* ROW or COLUMN */
- int checkOnly; /* don't allocate new space if true */
+CheckSlotData(
+ Gridder *masterPtr, /* The geometry master for this grid. */
+ int slot, /* Which slot to look at. */
+ int slotType, /* ROW or COLUMN. */
+ int checkOnly) /* Don't allocate new space if true. */
{
- int numSlot; /* number of slots already allocated (Space) */
- int end; /* last used constraint */
+ int numSlot; /* Number of slots already allocated (Space) */
+ int end; /* Last used constraint. */
/*
* If slot is out of bounds, return immediately.
@@ -2326,35 +2606,36 @@ CheckSlotData(masterPtr, slot, slotType, checkOnly)
/*
* If we need to allocate more space, allocate a little extra to avoid
- * repeated re-alloc's for large tables. We need enough space to
- * hold all of the offsets as well.
+ * repeated re-alloc's for large tables. We need enough space to hold all
+ * of the offsets as well.
*/
InitMasterData(masterPtr);
end = (slotType == ROW) ? masterPtr->masterDataPtr->rowMax :
masterPtr->masterDataPtr->columnMax;
if (checkOnly == CHECK_ONLY) {
- return (end < slot) ? TCL_ERROR : TCL_OK;
+ return ((end < slot) ? TCL_ERROR : TCL_OK);
} else {
- numSlot = (slotType == ROW) ? masterPtr->masterDataPtr->rowSpace
- : masterPtr->masterDataPtr->columnSpace;
+ numSlot = (slotType == ROW) ? masterPtr->masterDataPtr->rowSpace
+ : masterPtr->masterDataPtr->columnSpace;
if (slot >= numSlot) {
- int newNumSlot = slot + PREALLOC ;
- size_t oldSize = numSlot * sizeof(SlotInfo) ;
- size_t newSize = newNumSlot * sizeof(SlotInfo) ;
- SlotInfo *new = (SlotInfo *) ckalloc(newSize);
- SlotInfo *old = (slotType == ROW) ?
- masterPtr->masterDataPtr->rowPtr :
- masterPtr->masterDataPtr->columnPtr;
- memcpy((VOID *) new, (VOID *) old, oldSize );
- memset((VOID *) (new+numSlot), 0, newSize - oldSize );
- ckfree((char *) old);
+ int newNumSlot = slot + PREALLOC;
+ size_t oldSize = numSlot * sizeof(SlotInfo);
+ size_t newSize = newNumSlot * sizeof(SlotInfo);
+ SlotInfo *newSI = (SlotInfo *) ckalloc(newSize);
+ SlotInfo *oldSI = (slotType == ROW)
+ ? masterPtr->masterDataPtr->rowPtr
+ : masterPtr->masterDataPtr->columnPtr;
+
+ memcpy(newSI, oldSI, oldSize);
+ memset(newSI+numSlot, 0, newSize - oldSize);
+ ckfree((char *) oldSI);
if (slotType == ROW) {
- masterPtr->masterDataPtr->rowPtr = new ;
- masterPtr->masterDataPtr->rowSpace = newNumSlot ;
+ masterPtr->masterDataPtr->rowPtr = newSI;
+ masterPtr->masterDataPtr->rowSpace = newNumSlot;
} else {
- masterPtr->masterDataPtr->columnPtr = new;
- masterPtr->masterDataPtr->columnSpace = newNumSlot ;
+ masterPtr->masterDataPtr->columnPtr = newSI;
+ masterPtr->masterDataPtr->columnSpace = newNumSlot;
}
}
if (slot >= end && checkOnly != CHECK_SPACE) {
@@ -2369,33 +2650,31 @@ CheckSlotData(masterPtr, slot, slotType, checkOnly)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* InitMasterData --
*
- * This internal procedure is used to allocate and initialize
- * the data for a geometry master, if the data
- * doesn't exist already.
+ * This internal procedure is used to allocate and initialize the data
+ * for a geometry master, if the data doesn't exist already.
*
* Results:
* none
*
* Side effects:
- * A new master grid structure may be created. If so, then
- * it is initialized.
+ * A new master grid structure may be created. If so, then it is
+ * initialized.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
static void
-InitMasterData(masterPtr)
- Gridder *masterPtr;
+InitMasterData(
+ Gridder *masterPtr)
{
- size_t size;
if (masterPtr->masterDataPtr == NULL) {
- GridMaster *gridPtr = masterPtr->masterDataPtr =
- (GridMaster *) ckalloc(sizeof(GridMaster));
- size = sizeof(SlotInfo) * TYPICAL_SIZE;
+ GridMaster *gridPtr = masterPtr->masterDataPtr = (GridMaster *)
+ ckalloc(sizeof(GridMaster));
+ size_t size = sizeof(SlotInfo) * TYPICAL_SIZE;
gridPtr->columnEnd = 0;
gridPtr->columnMax = 0;
@@ -2407,9 +2686,10 @@ InitMasterData(masterPtr)
gridPtr->rowSpace = TYPICAL_SIZE;
gridPtr->startX = 0;
gridPtr->startY = 0;
+ gridPtr->anchor = GRID_DEFAULT_ANCHOR;
- memset((VOID *) gridPtr->columnPtr, 0, size);
- memset((VOID *) gridPtr->rowPtr, 0, size);
+ memset(gridPtr->columnPtr, 0, size);
+ memset(gridPtr->rowPtr, 0, size);
}
}
@@ -2418,21 +2698,21 @@ InitMasterData(masterPtr)
*
* Unlink --
*
- * Remove a grid from its parent's list of slaves.
+ * Remove a grid from its master's list of slaves.
*
* Results:
* None.
*
* Side effects:
- * The parent will be scheduled for re-arranging, and the size of the
+ * The master will be scheduled for re-arranging, and the size of the
* grid will be adjusted accordingly
*
*----------------------------------------------------------------------
*/
static void
-Unlink(slavePtr)
- register Gridder *slavePtr; /* Window to unlink. */
+Unlink(
+ register Gridder *slavePtr) /* Window to unlink. */
{
register Gridder *masterPtr, *slavePtr2;
@@ -2444,9 +2724,9 @@ Unlink(slavePtr)
if (masterPtr->slavePtr == slavePtr) {
masterPtr->slavePtr = slavePtr->nextPtr;
} else {
- for (slavePtr2 = masterPtr->slavePtr; ; slavePtr2 = slavePtr2->nextPtr) {
+ for (slavePtr2=masterPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) {
if (slavePtr2 == NULL) {
- panic("Unlink couldn't find previous window");
+ Tcl_Panic("Unlink couldn't find previous window");
}
if (slavePtr2->nextPtr == slavePtr) {
slavePtr2->nextPtr = slavePtr->nextPtr;
@@ -2471,11 +2751,11 @@ Unlink(slavePtr)
*
* DestroyGrid --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a grid at a safe time
- * (when no-one is using it anymore). Cleaning up the grid involves
- * freeing the main structure for all windows. and the master structure
- * for geometry managers.
+ * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
+ * clean up the internal structure of a grid at a safe time (when no-one
+ * is using it anymore). Cleaning up the grid involves freeing the main
+ * structure for all windows and the master structure for geometry
+ * managers.
*
* Results:
* None.
@@ -2487,8 +2767,8 @@ Unlink(slavePtr)
*/
static void
-DestroyGrid(memPtr)
- char *memPtr; /* Info about window that is now dead. */
+DestroyGrid(
+ char *memPtr) /* Info about window that is now dead. */
{
register Gridder *gridPtr = (Gridder *) memPtr;
@@ -2501,6 +2781,9 @@ DestroyGrid(memPtr)
}
ckfree((char *) gridPtr->masterDataPtr);
}
+ if (gridPtr->in != NULL) {
+ Tcl_DecrRefCount(gridPtr->in);
+ }
ckfree((char *) gridPtr);
}
@@ -2509,37 +2792,37 @@ DestroyGrid(memPtr)
*
* GridStructureProc --
*
- * This procedure is invoked by the Tk event dispatcher in response
- * to StructureNotify events.
+ * This procedure is invoked by the Tk event dispatcher in response to
+ * StructureNotify events.
*
* Results:
* None.
*
* Side effects:
* If a window was just deleted, clean up all its grid-related
- * information. If it was just resized, re-configure its slaves, if
- * any.
+ * information. If it was just resized, re-configure its slaves, if any.
*
*----------------------------------------------------------------------
*/
static void
-GridStructureProc(clientData, eventPtr)
- ClientData clientData; /* Our information about window
- * referred to by eventPtr. */
- XEvent *eventPtr; /* Describes what just happened. */
+GridStructureProc(
+ ClientData clientData, /* Our information about window referred to by
+ * eventPtr. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
register Gridder *gridPtr = (Gridder *) clientData;
TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr;
if (eventPtr->type == ConfigureNotify) {
- if (!(gridPtr->flags & REQUESTED_RELAYOUT)) {
+ if ((gridPtr->slavePtr != NULL)
+ && !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr);
}
- if (gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width) {
- if ((gridPtr->masterPtr != NULL) &&
- !(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) {
+ if ((gridPtr->masterPtr != NULL) &&
+ (gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) {
+ if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width;
gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr->masterPtr);
@@ -2552,7 +2835,7 @@ GridStructureProc(clientData, eventPtr)
Unlink(gridPtr);
}
for (gridPtr2 = gridPtr->slavePtr; gridPtr2 != NULL;
- gridPtr2 = nextPtr) {
+ gridPtr2 = nextPtr) {
Tk_UnmapWindow(gridPtr2->tkwin);
gridPtr2->masterPtr = NULL;
nextPtr = gridPtr2->nextPtr;
@@ -2566,7 +2849,8 @@ GridStructureProc(clientData, eventPtr)
gridPtr->tkwin = NULL;
Tcl_EventuallyFree((ClientData) gridPtr, DestroyGrid);
} else if (eventPtr->type == MapNotify) {
- if (!(gridPtr->flags & REQUESTED_RELAYOUT)) {
+ if ((gridPtr->slavePtr != NULL)
+ && !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr);
}
@@ -2574,7 +2858,7 @@ GridStructureProc(clientData, eventPtr)
register Gridder *gridPtr2;
for (gridPtr2 = gridPtr->slavePtr; gridPtr2 != NULL;
- gridPtr2 = gridPtr2->nextPtr) {
+ gridPtr2 = gridPtr2->nextPtr) {
Tk_UnmapWindow(gridPtr2->tkwin);
}
}
@@ -2585,15 +2869,14 @@ GridStructureProc(clientData, eventPtr)
*
* ConfigureSlaves --
*
- * This implements the guts of the "grid configure" command. Given
- * a list of slaves and configuration options, it arranges for the
- * grid to manage the slaves and sets the specified options.
- * arguments consist of windows or window shortcuts followed by
- * "-option value" pairs.
+ * This implements the guts of the "grid configure" command. Given a list
+ * of slaves and configuration options, it arranges for the grid to
+ * manage the slaves and sets the specified options. Arguments consist
+ * of windows or window shortcuts followed by "-option value" pairs.
*
* Results:
- * TCL_OK is returned if all went well. Otherwise, TCL_ERROR is
- * returned and the interp's result is set to contain an error message.
+ * TCL_OK is returned if all went well. Otherwise, TCL_ERROR is returned
+ * and the interp's result is set to contain an error message.
*
* Side effects:
* Slave windows get taken over by the grid.
@@ -2602,57 +2885,90 @@ GridStructureProc(clientData, eventPtr)
*/
static int
-ConfigureSlaves(interp, tkwin, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* Any window in application containing
- * slaves. Used to look up slave names. */
- int objc; /* Number of elements in argv. */
- Tcl_Obj *CONST objv[]; /* Argument objects: contains one or more
- * window names followed by any number
- * of "option value" pairs. Caller must
- * make sure that there is at least one
- * window name. */
+ConfigureSlaves(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* Any window in application containing
+ * slaves. Used to look up slave names. */
+ int objc, /* Number of elements in argv. */
+ Tcl_Obj *CONST objv[]) /* Argument objects: contains one or more
+ * window names followed by any number of
+ * "option value" pairs. Caller must make sure
+ * that there is at least one window name. */
{
- Gridder *masterPtr;
+ Gridder *masterPtr = NULL;
Gridder *slavePtr;
Tk_Window other, slave, parent, ancestor;
int i, j, tmp;
- int length;
int numWindows;
int width;
- int defaultColumn = 0; /* default column number */
- int defaultColumnSpan = 1; /* default number of columns */
- char *lastWindow; /* use this window to base current
- * Row/col on */
- int numSkip; /* number of 'x' found */
+ int defaultRow = -1;
+ int defaultColumn = 0; /* Default column number */
+ int defaultColumnSpan = 1; /* Default number of columns */
+ char *lastWindow; /* Use this window to base current row/col
+ * on */
+ int numSkip; /* Number of 'x' found */
static CONST char *optionStrings[] = {
"-column", "-columnspan", "-in", "-ipadx", "-ipady",
- "-padx", "-pady", "-row", "-rowspan", "-sticky",
- (char *) NULL };
+ "-padx", "-pady", "-row", "-rowspan", "-sticky", NULL
+ };
enum options {
CONF_COLUMN, CONF_COLUMNSPAN, CONF_IN, CONF_IPADX, CONF_IPADY,
CONF_PADX, CONF_PADY, CONF_ROW, CONF_ROWSPAN, CONF_STICKY };
int index;
char *string;
- char firstChar, prevChar;
+ char firstChar;
+ int positionGiven;
/*
* Count the number of windows, or window short-cuts.
*/
firstChar = 0;
- for (numWindows = i = 0; i < objc; i++) {
- prevChar = firstChar;
+ for (numWindows=0, i=0; i < objc; i++) {
+ int length;
+ char prevChar = firstChar;
+
string = Tcl_GetStringFromObj(objv[i], &length);
firstChar = string[0];
-
+
if (firstChar == '.') {
+ /*
+ * Check that windows are valid, and locate the first slave's
+ * parent window (default for -in).
+ */
+
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (masterPtr == NULL) {
+ /*
+ * Is there any saved -in from a removed slave?
+ * If there is, it becomes default for -in.
+ * If the stored master does not exist, just ignore it.
+ */
+
+ struct Gridder *slavePtr = GetGrid(slave);
+ if (slavePtr->in != NULL) {
+ if (TkGetWindowFromObj(interp, slave, slavePtr->in, &parent)
+ == TCL_OK) {
+ masterPtr = GetGrid(parent);
+ InitMasterData(masterPtr);
+ }
+ }
+ }
+ if (masterPtr == NULL) {
+ parent = Tk_Parent(slave);
+ if (parent != NULL) {
+ masterPtr = GetGrid(parent);
+ InitMasterData(masterPtr);
+ }
+ }
numWindows++;
continue;
}
if (length > 1 && i == 0) {
Tcl_AppendResult(interp, "bad argument \"", string,
- "\": must be name of window", (char *) NULL);
+ "\": must be name of window", NULL);
return TCL_ERROR;
}
if (length > 1 && firstChar == '-') {
@@ -2661,15 +2977,14 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (length > 1) {
Tcl_AppendResult(interp, "unexpected parameter, \"",
string, "\", in configure list. ",
- "Should be window name or option", (char *) NULL);
+ "Should be window name or option", NULL);
return TCL_ERROR;
}
if ((firstChar == REL_HORIZ) && ((numWindows == 0) ||
(prevChar == REL_SKIP) || (prevChar == REL_VERT))) {
Tcl_AppendResult(interp,
- "Must specify window before shortcut '-'.",
- (char *) NULL);
+ "Must specify window before shortcut '-'.", NULL);
return TCL_ERROR;
}
@@ -2679,36 +2994,79 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
Tcl_AppendResult(interp, "invalid window shortcut, \"",
- string, "\" should be '-', 'x', or '^'", (char *) NULL);
+ string, "\" should be '-', 'x', or '^'", NULL);
return TCL_ERROR;
}
numWindows = i;
if ((objc - numWindows) & 1) {
- Tcl_AppendResult(interp, "extra option or",
- " option with no value", (char *) NULL);
+ Tcl_AppendResult(interp, "extra option or option with no value", NULL);
return TCL_ERROR;
}
/*
- * Iterate over all of the slave windows and short-cuts, parsing
- * options for each slave. It's a bit wasteful to re-parse the
- * options for each slave, but things get too messy if we try to
- * parse the arguments just once at the beginning. For example,
- * if a slave already is managed we want to just change a few
- * existing values without resetting everything. If there are
- * multiple windows, the -in option only gets processed for the
- * first window.
+ * Go through all options looking for -in and -row, which are needed to be
+ * found first to handle the special case where ^ is used on a row without
+ * windows names, but with an -in option. Since all options are checked
+ * here, we do not need to handle the error case again later.
+ */
+
+ for (i = numWindows; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index == CONF_IN) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other) !=
+ TCL_OK) {
+ return TCL_ERROR;
+ }
+ masterPtr = GetGrid(other);
+ InitMasterData(masterPtr);
+ } else if (index == CONF_ROW) {
+ if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK
+ || tmp < 0) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bad row value \"",
+ Tcl_GetString(objv[i+1]), "\": must be ",
+ "a non-negative integer", NULL);
+ return TCL_ERROR;
+ }
+ defaultRow = tmp;
+ }
+ }
+
+ /*
+ * If no -row is given, use the first unoccupied row of the master.
+ */
+
+ if (defaultRow < 0) {
+ if (masterPtr != NULL && masterPtr->masterDataPtr != NULL) {
+ SetGridSize(masterPtr);
+ defaultRow = masterPtr->masterDataPtr->rowEnd;
+ } else {
+ defaultRow = 0;
+ }
+ }
+
+ /*
+ * Iterate over all of the slave windows and short-cuts, parsing options
+ * for each slave. It's a bit wasteful to re-parse the options for each
+ * slave, but things get too messy if we try to parse the arguments just
+ * once at the beginning. For example, if a slave already is managed we
+ * want to just change a few existing values without resetting everything.
+ * If there are multiple windows, the -in option only gets processed for
+ * the first window.
*/
- masterPtr = NULL;
+ positionGiven = 0;
for (j = 0; j < numWindows; j++) {
string = Tcl_GetString(objv[j]);
firstChar = string[0];
/*
- * '^' and 'x' cause us to skip a column. '-' is processed
- * as part of its preceeding slave.
+ * '^' and 'x' cause us to skip a column. '-' is processed as part of
+ * its preceeding slave.
*/
if ((firstChar == REL_VERT) || (firstChar == REL_SKIP)) {
@@ -2722,6 +3080,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows;
defaultColumnSpan++) {
char *string = Tcl_GetString(objv[j + defaultColumnSpan]);
+
if (*string != REL_HORIZ) {
break;
}
@@ -2733,7 +3092,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (Tk_TopWinHierarchy(slave)) {
Tcl_AppendResult(interp, "can't manage \"", Tcl_GetString(objv[j]),
- "\": it's a top-level window", (char *) NULL);
+ "\": it's a top-level window", NULL);
return TCL_ERROR;
}
slavePtr = GetGrid(slave);
@@ -2742,49 +3101,48 @@ ConfigureSlaves(interp, tkwin, objc, objv)
* The following statement is taken from tkPack.c:
*
* "If the slave isn't currently managed, reset all of its
- * configuration information to default values (there could
- * be old values left from a previous packer)."
+ * configuration information to default values (there could be old
+ * values left from a previous packer)."
*
- * I [D.S.] disagree with this statement. If a slave is disabled (using
- * "forget") and then re-enabled, I submit that 90% of the time the
- * programmer will want it to retain its old configuration information.
- * If the programmer doesn't want this behavior, then the
+ * I [D.S.] disagree with this statement. If a slave is disabled
+ * (using "forget") and then re-enabled, I submit that 90% of the time
+ * the programmer will want it to retain its old configuration
+ * information. If the programmer doesn't want this behavior, then the
* defaults can be reestablished by hand, without having to worry
- * about keeping track of the old state.
+ * about keeping track of the old state.
*/
for (i = numWindows; i < objc; i += 2) {
- if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (index == CONF_COLUMN) {
- if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK ||
- tmp < 0) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad column value \"",
- Tcl_GetString(objv[i+1]),
- "\": must be a non-negative integer", (char *)NULL);
+ Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0,
+ &index);
+ switch ((enum options) index) {
+ case CONF_COLUMN:
+ if (Tcl_GetIntFromObj(NULL, objv[i+1], &tmp) != TCL_OK
+ || tmp < 0) {
+ Tcl_AppendResult(interp, "bad column value \"",
+ Tcl_GetString(objv[i+1]), "\": must be ",
+ "a non-negative integer", NULL);
return TCL_ERROR;
}
if (SetSlaveColumn(interp, slavePtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_COLUMNSPAN) {
- if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK ||
- tmp <= 0) {
- Tcl_ResetResult(interp);
+ break;
+ case CONF_COLUMNSPAN:
+ if (Tcl_GetIntFromObj(NULL, objv[i+1], &tmp) != TCL_OK
+ || tmp <= 0) {
Tcl_AppendResult(interp, "bad columnspan value \"",
- Tcl_GetString(objv[i+1]),
- "\": must be a positive integer", (char *)NULL);
+ Tcl_GetString(objv[i+1]), "\": must be ",
+ "a positive integer", NULL);
return TCL_ERROR;
}
if (SetSlaveColumn(interp, slavePtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_IN) {
- if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other) !=
- TCL_OK) {
+ break;
+ case CONF_IN:
+ if (TkGetWindowFromObj(interp, tkwin, objv[i+1],
+ &other) != TCL_OK) {
return TCL_ERROR;
}
if (other == slave) {
@@ -2792,89 +3150,106 @@ ConfigureSlaves(interp, tkwin, objc, objv)
TCL_STATIC);
return TCL_ERROR;
}
+ positionGiven = 1;
masterPtr = GetGrid(other);
InitMasterData(masterPtr);
- } else if (index == CONF_IPADX) {
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
- != TCL_OK)
- || (tmp < 0)) {
- Tcl_ResetResult(interp);
+ break;
+ case CONF_STICKY: {
+ int sticky = StringToSticky(Tcl_GetString(objv[i+1]));
+
+ if (sticky == -1) {
+ Tcl_AppendResult(interp, "bad stickyness value \"",
+ Tcl_GetString(objv[i+1]), "\": must be ",
+ "a string containing n, e, s, and/or w", NULL);
+ return TCL_ERROR;
+ }
+ slavePtr->sticky = sticky;
+ break;
+ }
+ case CONF_IPADX:
+ if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ &tmp) != TCL_OK) || (tmp < 0)) {
Tcl_AppendResult(interp, "bad ipadx value \"",
- Tcl_GetString(objv[i+1]),
- "\": must be positive screen distance",
- (char *) NULL);
+ Tcl_GetString(objv[i+1]), "\": must be ",
+ "positive screen distance", NULL);
return TCL_ERROR;
}
slavePtr->iPadX = tmp*2;
- } else if (index == CONF_IPADY) {
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
- != TCL_OK)
- || (tmp < 0)) {
- Tcl_ResetResult(interp);
+ break;
+ case CONF_IPADY:
+ if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ &tmp) != TCL_OK) || (tmp < 0)) {
Tcl_AppendResult(interp, "bad ipady value \"",
- Tcl_GetString(objv[i+1]),
- "\": must be positive screen distance",
- (char *) NULL);
+ Tcl_GetString(objv[i+1]), "\": must be ",
+ "positive screen distance", NULL);
return TCL_ERROR;
}
slavePtr->iPadY = tmp*2;
- } else if (index == CONF_PADX) {
+ break;
+ case CONF_PADX:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
&slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_PADY) {
+ break;
+ case CONF_PADY:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
&slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_ROW) {
- if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK
+ break;
+ case CONF_ROW:
+ if (Tcl_GetIntFromObj(NULL, objv[i+1], &tmp) != TCL_OK
|| tmp < 0) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad grid value \"",
+ Tcl_AppendResult(interp, "bad row value \"",
Tcl_GetString(objv[i+1]),
- "\": must be a non-negative integer", (char *)NULL);
+ "\": must be a non-negative integer", NULL);
return TCL_ERROR;
}
if (SetSlaveRow(interp, slavePtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_ROWSPAN) {
- if ((Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK)
+ break;
+ case CONF_ROWSPAN:
+ if ((Tcl_GetIntFromObj(NULL, objv[i+1], &tmp) != TCL_OK)
|| tmp <= 0) {
- Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad rowspan value \"",
Tcl_GetString(objv[i+1]),
- "\": must be a positive integer", (char *)NULL);
+ "\": must be a positive integer", NULL);
return TCL_ERROR;
}
if (SetSlaveRow(interp, slavePtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_STICKY) {
- int sticky = StringToSticky(Tcl_GetString(objv[i+1]));
- if (sticky == -1) {
- Tcl_AppendResult(interp, "bad stickyness value \"",
- Tcl_GetString(objv[i+1]),
- "\": must be a string containing n, e, s, and/or w",
- (char *)NULL);
- return TCL_ERROR;
- }
- slavePtr->sticky = sticky;
+ break;
}
}
/*
- * Make sure we have a geometry master. We look at:
- * 1) the -in flag
- * 2) the geometry master of the first slave (if specified)
- * 3) the parent of the first slave.
+ * If no position was specified via -in and the slave is already
+ * packed, then leave it in its current location.
*/
-
- if (masterPtr == NULL) {
+
+ if (!positionGiven && (slavePtr->masterPtr != NULL)) {
masterPtr = slavePtr->masterPtr;
+ goto scheduleLayout;
}
+
+ /*
+ * If the same -in window is passed in again, then just leave it in
+ * its current location.
+ */
+
+ if (positionGiven && (masterPtr == slavePtr->masterPtr)) {
+ goto scheduleLayout;
+ }
+
+ /*
+ * Make sure we have a geometry master. We look at:
+ * 1) the -in flag
+ * 2) the parent of the first slave.
+ */
+
parent = Tk_Parent(slave);
if (masterPtr == NULL) {
masterPtr = GetGrid(parent);
@@ -2888,15 +3263,16 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (slavePtr->masterPtr == NULL) {
Gridder *tempPtr = masterPtr->slavePtr;
+
slavePtr->masterPtr = masterPtr;
masterPtr->slavePtr = slavePtr;
slavePtr->nextPtr = tempPtr;
}
/*
- * Make sure that the slave's parent is either the master or
- * an ancestor of the master, and that the master and slave
- * aren't the same.
+ * Make sure that the slave's parent is either the master or an
+ * ancestor of the master, and that the master and slave aren't the
+ * same.
*/
for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
@@ -2905,8 +3281,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_AppendResult(interp, "can't put ", Tcl_GetString(objv[j]),
- " inside ", Tk_PathName(masterPtr->tkwin),
- (char *) NULL);
+ " inside ", Tk_PathName(masterPtr->tkwin), NULL);
Unlink(slavePtr);
return TCL_ERROR;
}
@@ -2919,8 +3294,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (masterPtr->masterPtr == slavePtr) {
Tcl_AppendResult(interp, "can't put ", Tcl_GetString(objv[j]),
" inside ", Tk_PathName(masterPtr->tkwin),
- ", would cause management loop.",
- (char *) NULL);
+ ", would cause management loop.", NULL);
Unlink(slavePtr);
return TCL_ERROR;
}
@@ -2932,7 +3306,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
*/
if (slavePtr->column == -1) {
- if (SetSlaveColumn(interp, slavePtr, defaultColumn, -1) != TCL_OK) {
+ if (SetSlaveColumn(interp, slavePtr, defaultColumn,-1) != TCL_OK){
return TCL_ERROR;
}
}
@@ -2941,23 +3315,18 @@ ConfigureSlaves(interp, tkwin, objc, objv)
return TCL_ERROR;
}
if (slavePtr->row == -1) {
- if (masterPtr->masterDataPtr == NULL) {
- slavePtr->row = 0;
- } else {
- if (SetSlaveRow(interp, slavePtr,
- masterPtr->masterDataPtr->rowEnd, -1) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (SetSlaveRow(interp, slavePtr, defaultRow, -1) != TCL_OK) {
+ return TCL_ERROR;
}
}
defaultColumn += slavePtr->numCols;
defaultColumnSpan = 1;
/*
- * Arrange for the parent to be re-arranged at the first
- * idle moment.
+ * Arrange for the master to be re-arranged at the first idle moment.
*/
+ scheduleLayout:
if (masterPtr->abortPtr != NULL) {
*masterPtr->abortPtr = 1;
}
@@ -2967,14 +3336,16 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
}
- /* Now look for all the "^"'s. */
+ /*
+ * Now look for all the "^"'s.
+ */
lastWindow = NULL;
numSkip = 0;
for (j = 0; j < numWindows; j++) {
struct Gridder *otherPtr;
- int match; /* found a match for the ^ */
- int lastRow, lastColumn; /* implied end of table */
+ int match; /* Found a match for the ^ */
+ int lastRow, lastColumn; /* Implied end of table. */
string = Tcl_GetString(objv[j]);
firstChar = string[0];
@@ -2991,28 +3362,28 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
if (masterPtr == NULL) {
- Tcl_AppendResult(interp, "can't use '^', cant find master",
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't use '^', cant find master", NULL);
return TCL_ERROR;
}
- /* Count the number of consecutive ^'s starting from this position */
+ /*
+ * Count the number of consecutive ^'s starting from this position.
+ */
+
for (width = 1; width + j < numWindows; width++) {
char *string = Tcl_GetString(objv[j+width]);
- if (*string != REL_VERT) break;
+
+ if (*string != REL_VERT) {
+ break;
+ }
}
/*
* Find the implied grid location of the ^
*/
- if (lastWindow == NULL) {
- if (masterPtr->masterDataPtr != NULL) {
- SetGridSize(masterPtr);
- lastRow = masterPtr->masterDataPtr->rowEnd - 2;
- } else {
- lastRow = 0;
- }
+ if (lastWindow == NULL) {
+ lastRow = defaultRow - 1;
lastColumn = 0;
} else {
other = Tk_NameToWindow(interp, lastWindow, tkwin);
@@ -3023,13 +3394,13 @@ ConfigureSlaves(interp, tkwin, objc, objv)
lastColumn += numSkip;
- for (match=0, slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ match = 0;
+ for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
+ slavePtr = slavePtr->nextPtr) {
if (slavePtr->column == lastColumn
&& slavePtr->row + slavePtr->numRows - 1 == lastRow) {
if (slavePtr->numCols <= width) {
-
if (SetSlaveRow(interp, slavePtr, -1,
slavePtr->numRows + 1) != TCL_OK) {
return TCL_ERROR;
@@ -3044,14 +3415,13 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
if (!match) {
Tcl_AppendResult(interp, "can't find slave to extend with \"^\".",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
}
}
if (masterPtr == NULL) {
- Tcl_AppendResult(interp, "can't determine master window",
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't determine master window", NULL);
return TCL_ERROR;
}
SetGridSize(masterPtr);
@@ -3063,8 +3433,8 @@ ConfigureSlaves(interp, tkwin, objc, objv)
*
* StickyToString
*
- * Converts the internal boolean combination of "sticky" bits onto
- * a TCL list element containing zero or mor of n, s, e, or w.
+ * Converts the internal boolean combination of "sticky" bits onto a Tcl
+ * list element containing zero or more of n, s, e, or w.
*
* Results:
* A string is placed into the "result" pointer.
@@ -3076,9 +3446,9 @@ ConfigureSlaves(interp, tkwin, objc, objv)
*/
static void
-StickyToString(flags, result)
- int flags; /* the sticky flags */
- char *result; /* where to put the result */
+StickyToString(
+ int flags, /* The sticky flags. */
+ char *result) /* Where to put the result. */
{
int count = 0;
if (flags&STICK_NORTH) {
@@ -3096,7 +3466,7 @@ StickyToString(flags, result)
if (count) {
result[count] = '\0';
} else {
- sprintf(result,"{}");
+ sprintf(result, "{}");
}
}
@@ -3105,12 +3475,12 @@ StickyToString(flags, result)
*
* StringToSticky --
*
- * Converts an ascii string representing a widgets stickyness
- * into the boolean result.
+ * Converts an ascii string representing a widgets stickyness into the
+ * boolean result.
*
* Results:
- * The boolean combination of the "sticky" bits is retuned. If an
- * error occurs, such as an invalid character, -1 is returned instead.
+ * The boolean combination of the "sticky" bits is retuned. If an error
+ * occurs, such as an invalid character, -1 is returned instead.
*
* Side effects:
* none
@@ -3119,20 +3489,30 @@ StickyToString(flags, result)
*/
static int
-StringToSticky(string)
- char *string;
+StringToSticky(
+ char *string)
{
int sticky = 0;
char c;
while ((c = *string++) != '\0') {
switch (c) {
- case 'n': case 'N': sticky |= STICK_NORTH; break;
- case 'e': case 'E': sticky |= STICK_EAST; break;
- case 's': case 'S': sticky |= STICK_SOUTH; break;
- case 'w': case 'W': sticky |= STICK_WEST; break;
- case ' ': case ',': case '\t': case '\r': case '\n': break;
- default: return -1;
+ case 'n': case 'N':
+ sticky |= STICK_NORTH;
+ break;
+ case 'e': case 'E':
+ sticky |= STICK_EAST;
+ break;
+ case 's': case 'S':
+ sticky |= STICK_SOUTH;
+ break;
+ case 'w': case 'W':
+ sticky |= STICK_WEST;
+ break;
+ case ' ': case ',': case '\t': case '\r': case '\n':
+ break;
+ default:
+ return -1;
}
}
return sticky;
@@ -3155,14 +3535,14 @@ StringToSticky(string)
*/
static Tcl_Obj *
-NewPairObj(interp, val1, val2)
- Tcl_Interp *interp; /* Current interpreter. */
- int val1, val2;
+NewPairObj(
+ int val1, int val2)
{
- Tcl_Obj *res = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(val1));
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(val2));
- return res;
+ Tcl_Obj *ary[2];
+
+ ary[0] = Tcl_NewIntObj(val1);
+ ary[1] = Tcl_NewIntObj(val2);
+ return Tcl_NewListObj(2, ary);
}
/*
@@ -3182,14 +3562,22 @@ NewPairObj(interp, val1, val2)
*/
static Tcl_Obj *
-NewQuadObj(interp, val1, val2, val3, val4)
- Tcl_Interp *interp; /* Current interpreter. */
- int val1, val2, val3, val4;
+NewQuadObj(
+ int val1, int val2, int val3, int val4)
{
- Tcl_Obj *res = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(val1));
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(val2));
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(val3));
- Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(val4));
- return res;
+ Tcl_Obj *ary[4];
+
+ ary[0] = Tcl_NewIntObj(val1);
+ ary[1] = Tcl_NewIntObj(val2);
+ ary[2] = Tcl_NewIntObj(val3);
+ ary[3] = Tcl_NewIntObj(val4);
+ return Tcl_NewListObj(4, ary);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 35f013f..6c7c9cd 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -1,19 +1,17 @@
-/*
+/*
* tkImage.c --
*
- * This module implements the image protocol, which allows lots
- * of different kinds of images to be used in lots of different
- * widgets.
+ * This module implements the image protocol, which allows lots of
+ * different kinds of images to be used in lots of different widgets.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
/*
* Each call to Tk_GetImage returns a pointer to one of the following
@@ -25,114 +23,162 @@ typedef struct Image {
Tk_Window tkwin; /* Window passed to Tk_GetImage (needed to
* "re-get" the image later if the manager
* changes). */
- Display *display; /* Display for tkwin. Needed because when
- * the image is eventually freed tkwin may
- * not exist anymore. */
+ Display *display; /* Display for tkwin. Needed because when the
+ * image is eventually freed tkwin may not
+ * exist anymore. */
struct ImageMaster *masterPtr;
/* Master for this image (identifiers image
* manager, for example). */
- ClientData instanceData;
- /* One word argument to pass to image manager
+ ClientData instanceData; /* One word argument to pass to image manager
* when dealing with this image instance. */
Tk_ImageChangedProc *changeProc;
/* Code in widget to call when image changes
* in a way that affects redisplay. */
- ClientData widgetClientData;
- /* Argument to pass to changeProc. */
+ ClientData widgetClientData;/* Argument to pass to changeProc. */
struct Image *nextPtr; /* Next in list of all image instances
* associated with the same name. */
-
} Image;
/*
- * For each image master there is one of the following structures,
- * which represents a name in the image table and all of the images
- * instantiated from it. Entries in mainPtr->imageTable point to
- * these structures.
+ * For each image master there is one of the following structures, which
+ * represents a name in the image table and all of the images instantiated
+ * from it. Entries in mainPtr->imageTable point to these structures.
*/
typedef struct ImageMaster {
- Tk_ImageType *typePtr; /* Information about image type. NULL means
- * that no image manager owns this image: the
+ Tk_ImageType *typePtr; /* Information about image type. NULL means
+ * that no image manager owns this image: the
* image was deleted. */
- ClientData masterData; /* One-word argument to pass to image mgr
- * when dealing with the master, as opposed
- * to instances. */
+ ClientData masterData; /* One-word argument to pass to image mgr when
+ * dealing with the master, as opposed to
+ * instances. */
int width, height; /* Last known dimensions for image. */
- Tcl_HashTable *tablePtr; /* Pointer to hash table containing image
- * (the imageTable field in some TkMainInfo
+ Tcl_HashTable *tablePtr; /* Pointer to hash table containing image (the
+ * imageTable field in some TkMainInfo
* structure). */
- Tcl_HashEntry *hPtr; /* Hash entry in mainPtr->imageTable for
- * this structure (used to delete the hash
+ Tcl_HashEntry *hPtr; /* Hash entry in mainPtr->imageTable for this
+ * structure (used to delete the hash
* entry). */
Image *instancePtr; /* Pointer to first in list of instances
* derived from this name. */
int deleted; /* Flag set when image is being deleted. */
- TkWindow *winPtr; /* Main window of interpreter (used to
- * detect when the world is falling apart.) */
+ TkWindow *winPtr; /* Main window of interpreter (used to detect
+ * when the world is falling apart.) */
} ImageMaster;
typedef struct ThreadSpecificData {
- Tk_ImageType *imageTypeList;/* First in a list of all known image
- * types. */
- Tk_ImageType *oldImageTypeList;/* First in a list of all known old-style image
- * types. */
-} ThreadSpecificData;
+ Tk_ImageType *imageTypeList;/* First in a list of all known image
+ * types. */
+ Tk_ImageType *oldImageTypeList;
+ /* First in a list of all known old-style
+ * image types. */
+ int initialized; /* Set to 1 if we've initialized the
+ * structure. */
+} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Prototypes for local procedures:
+ * Prototypes for local functions:
*/
-static void DeleteImage _ANSI_ARGS_((ImageMaster *masterPtr));
-static void EventuallyDeleteImage _ANSI_ARGS_((ImageMaster *masterPtr,
- int forgetHashEntryNow));
+static void ImageTypeThreadExitProc(ClientData clientData);
+static void DeleteImage(ImageMaster *masterPtr);
+static void EventuallyDeleteImage(ImageMaster *masterPtr,
+ int forgetImageHashNow);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageTypeThreadExitProc --
+ *
+ * Clean up the registered list of image types.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The thread's linked lists of photo image formats is deleted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ImageTypeThreadExitProc(
+ ClientData clientData) /* not used */
+{
+ Tk_ImageType *freePtr;
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ while (tsdPtr->oldImageTypeList != NULL) {
+ freePtr = tsdPtr->oldImageTypeList;
+ tsdPtr->oldImageTypeList = tsdPtr->oldImageTypeList->nextPtr;
+ ckfree((char *) freePtr);
+ }
+ while (tsdPtr->imageTypeList != NULL) {
+ freePtr = tsdPtr->imageTypeList;
+ tsdPtr->imageTypeList = tsdPtr->imageTypeList->nextPtr;
+ ckfree((char *) freePtr);
+ }
+}
/*
*----------------------------------------------------------------------
*
* Tk_CreateOldImageType, Tk_CreateImageType --
*
- * This procedure is invoked by an image manager to tell Tk about
- * a new kind of image and the procedures that manage the new type.
- * The procedure is typically invoked during Tcl_AppInit.
+ * This function is invoked by an image manager to tell Tk about a new
+ * kind of image and the functions that manage the new type. The function
+ * is typically invoked during Tcl_AppInit.
*
* Results:
* None.
*
* Side effects:
- * The new image type is entered into a table used in the "image
- * create" command.
+ * The new image type is entered into a table used in the "image create"
+ * command.
*
*----------------------------------------------------------------------
*/
void
-Tk_CreateOldImageType(typePtr)
- Tk_ImageType *typePtr; /* Structure describing the type. All of
- * the fields except "nextPtr" must be filled
- * in by caller. Must not have been passed
- * to Tk_CreateImageType previously. */
+Tk_CreateOldImageType(
+ Tk_ImageType *typePtr) /* Structure describing the type. All of the
+ * fields except "nextPtr" must be filled in
+ * by caller. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tk_ImageType *copyPtr;
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- typePtr->nextPtr = tsdPtr->oldImageTypeList;
- tsdPtr->oldImageTypeList = typePtr;
+ if (!tsdPtr->initialized) {
+ tsdPtr->initialized = 1;
+ Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
+ }
+ copyPtr = (Tk_ImageType *) ckalloc(sizeof(Tk_ImageType));
+ *copyPtr = *typePtr;
+ copyPtr->nextPtr = tsdPtr->oldImageTypeList;
+ tsdPtr->oldImageTypeList = copyPtr;
}
void
-Tk_CreateImageType(typePtr)
- Tk_ImageType *typePtr; /* Structure describing the type. All of
- * the fields except "nextPtr" must be filled
- * in by caller. Must not have been passed
- * to Tk_CreateImageType previously. */
+Tk_CreateImageType(
+ Tk_ImageType *typePtr) /* Structure describing the type. All of the
+ * fields except "nextPtr" must be filled in
+ * by caller. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tk_ImageType *copyPtr;
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- typePtr->nextPtr = tsdPtr->imageTypeList;
- tsdPtr->imageTypeList = typePtr;
+ if (!tsdPtr->initialized) {
+ tsdPtr->initialized = 1;
+ Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
+ }
+ copyPtr = (Tk_ImageType *) ckalloc(sizeof(Tk_ImageType));
+ *copyPtr = *typePtr;
+ copyPtr->nextPtr = tsdPtr->imageTypeList;
+ tsdPtr->imageTypeList = copyPtr;
}
/*
@@ -140,8 +186,8 @@ Tk_CreateImageType(typePtr)
*
* Tk_ImageObjCmd --
*
- * This procedure is invoked to process the "image" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "image" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -153,30 +199,31 @@ Tk_CreateImageType(typePtr)
*/
int
-Tk_ImageObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings. */
+Tk_ImageObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument strings. */
{
static CONST char *imageOptions[] = {
"create", "delete", "height", "inuse", "names", "type", "types",
- "width", (char *) NULL
+ "width", NULL
};
enum options {
IMAGE_CREATE, IMAGE_DELETE, IMAGE_HEIGHT, IMAGE_INUSE, IMAGE_NAMES,
IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH
};
TkWindow *winPtr = (TkWindow *) clientData;
- int i, new, firstOption, index;
+ int i, isNew, firstOption, index;
Tk_ImageType *typePtr;
ImageMaster *masterPtr;
Image *imagePtr;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
- char idString[16 + TCL_INTEGER_SPACE], *name;
+ char idString[16 + TCL_INTEGER_SPACE];
TkDisplay *dispPtr = winPtr->dispPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ char *arg, *name;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (objc < 2) {
@@ -189,276 +236,256 @@ Tk_ImageObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
switch ((enum options) index) {
- case IMAGE_CREATE: {
- char *arg;
- Tcl_Obj **args;
- int oldimage = 0;
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "type ?name? ?options?");
- return TCL_ERROR;
- }
+ case IMAGE_CREATE: {
+ Tcl_Obj **args;
+ int oldimage = 0;
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "type ?name? ?options?");
+ return TCL_ERROR;
+ }
- /*
- * Look up the image type.
- */
+ /*
+ * Look up the image type.
+ */
- arg = Tcl_GetString(objv[2]);
- for (typePtr = tsdPtr->imageTypeList; typePtr != NULL;
- typePtr = typePtr->nextPtr) {
+ arg = Tcl_GetString(objv[2]);
+ for (typePtr = tsdPtr->imageTypeList; typePtr != NULL;
+ typePtr = typePtr->nextPtr) {
+ if ((*arg == typePtr->name[0])
+ && (strcmp(arg, typePtr->name) == 0)) {
+ break;
+ }
+ }
+ if (typePtr == NULL) {
+ oldimage = 1;
+ for (typePtr = tsdPtr->oldImageTypeList; typePtr != NULL;
+ typePtr = typePtr->nextPtr) {
if ((*arg == typePtr->name[0])
&& (strcmp(arg, typePtr->name) == 0)) {
break;
}
}
- if (typePtr == NULL) {
- oldimage = 1;
- for (typePtr = tsdPtr->oldImageTypeList; typePtr != NULL;
- typePtr = typePtr->nextPtr) {
- if ((*arg == typePtr->name[0])
- && (strcmp(arg, typePtr->name) == 0)) {
- break;
- }
- }
- }
- if (typePtr == NULL) {
- Tcl_AppendResult(interp, "image type \"", arg,
- "\" doesn't exist", (char *) NULL);
- return TCL_ERROR;
- }
+ }
+ if (typePtr == NULL) {
+ Tcl_AppendResult(interp, "image type \"", arg, "\" doesn't exist",
+ NULL);
+ return TCL_ERROR;
+ }
- /*
- * Figure out a name to use for the new image.
- */
+ /*
+ * Figure out a name to use for the new image.
+ */
- if ((objc == 3) || (*(arg = Tcl_GetString(objv[3])) == '-')) {
- Tcl_CmdInfo dummy;
- do {
- dispPtr->imageId++;
- sprintf(idString, "image%d", dispPtr->imageId);
- name = idString;
- } while (Tcl_GetCommandInfo(interp, name, &dummy) != 0);
- firstOption = 3;
- } else {
- TkWindow *topWin;
-
- name = arg;
- firstOption = 4;
- /*
- * Need to check if the _command_ that we are about to
- * create is the name of the current master widget
- * command (normally "." but could have been renamed)
- * and fail in that case before a really nasty and
- * hard to stop crash happens.
- */
- topWin = (TkWindow *) TkToplevelWindowForCommand(interp, name);
- if (topWin != NULL && winPtr->mainPtr->winPtr == topWin) {
- Tcl_AppendResult(interp, "images may not be named the ",
- "same as the main window", (char *) NULL);
- return TCL_ERROR;
- }
- }
+ if ((objc == 3) || (*(arg = Tcl_GetString(objv[3])) == '-')) {
+ Tcl_CmdInfo dummy;
+ do {
+ dispPtr->imageId++;
+ sprintf(idString, "image%d", dispPtr->imageId);
+ name = idString;
+ } while (Tcl_GetCommandInfo(interp, name, &dummy) != 0);
+ firstOption = 3;
+ } else {
+ TkWindow *topWin;
+
+ name = arg;
+ firstOption = 4;
/*
- * Create the data structure for the new image.
+ * Need to check if the _command_ that we are about to create is
+ * the name of the current master widget command (normally "." but
+ * could have been renamed) and fail in that case before a really
+ * nasty and hard to stop crash happens.
*/
- hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable,
- name, &new);
- if (new) {
- masterPtr = (ImageMaster *) ckalloc(sizeof(ImageMaster));
- masterPtr->typePtr = NULL;
- masterPtr->masterData = NULL;
- masterPtr->width = masterPtr->height = 1;
- masterPtr->tablePtr = &winPtr->mainPtr->imageTable;
- masterPtr->hPtr = hPtr;
- masterPtr->instancePtr = NULL;
- masterPtr->deleted = 0;
- masterPtr->winPtr = winPtr->mainPtr->winPtr;
- Tcl_Preserve((ClientData) masterPtr->winPtr);
- Tcl_SetHashValue(hPtr, masterPtr);
- } else {
- /*
- * An image already exists by this name. Disconnect the
- * instances from the master.
- */
-
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr != NULL) {
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
- imagePtr = imagePtr->nextPtr) {
- (*masterPtr->typePtr->freeProc)(
- imagePtr->instanceData, imagePtr->display);
- (*imagePtr->changeProc)(imagePtr->widgetClientData,
- 0, 0, masterPtr->width, masterPtr->height,
- masterPtr->width, masterPtr->height);
- }
- (*masterPtr->typePtr->deleteProc)(masterPtr->masterData);
- masterPtr->typePtr = NULL;
- }
+ topWin = (TkWindow *) TkToplevelWindowForCommand(interp, name);
+ if (topWin != NULL && winPtr->mainPtr->winPtr == topWin) {
+ Tcl_AppendResult(interp, "images may not be named the ",
+ "same as the main window", NULL);
+ return TCL_ERROR;
}
+ }
+ /*
+ * Create the data structure for the new image.
+ */
+
+ hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew);
+ if (isNew) {
+ masterPtr = (ImageMaster *) ckalloc(sizeof(ImageMaster));
+ masterPtr->typePtr = NULL;
+ masterPtr->masterData = NULL;
+ masterPtr->width = masterPtr->height = 1;
+ masterPtr->tablePtr = &winPtr->mainPtr->imageTable;
+ masterPtr->hPtr = hPtr;
+ masterPtr->instancePtr = NULL;
+ masterPtr->deleted = 0;
+ masterPtr->winPtr = winPtr->mainPtr->winPtr;
+ Tcl_Preserve((ClientData) masterPtr->winPtr);
+ Tcl_SetHashValue(hPtr, masterPtr);
+ } else {
/*
- * Call the image type manager so that it can perform its own
- * initialization, then re-"get" for any existing instances of
- * the image.
+ * An image already exists by this name. Disconnect the instances
+ * from the master.
*/
- objv += firstOption;
- objc -= firstOption;
- args = (Tcl_Obj **) objv;
- if (oldimage) {
- int i;
- args = (Tcl_Obj **) ckalloc((objc+1) * sizeof(char *));
- for (i = 0; i < objc; i++) {
- args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]);
+ masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ if (masterPtr->typePtr != NULL) {
+ for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ imagePtr = imagePtr->nextPtr) {
+ (*masterPtr->typePtr->freeProc)(imagePtr->instanceData,
+ imagePtr->display);
+ (*imagePtr->changeProc)(imagePtr->widgetClientData,
+ 0, 0, masterPtr->width, masterPtr->height,
+ masterPtr->width, masterPtr->height);
}
- args[objc] = NULL;
+ (*masterPtr->typePtr->deleteProc)(masterPtr->masterData);
+ masterPtr->typePtr = NULL;
}
- Tcl_Preserve((ClientData) masterPtr);
- if ((*typePtr->createProc)(interp, name, objc,
- args, typePtr, (Tk_ImageMaster) masterPtr,
- &masterPtr->masterData) != TCL_OK) {
- EventuallyDeleteImage(masterPtr, 0);
- Tcl_Release((ClientData) masterPtr);
- if (oldimage) {
- ckfree((char *) args);
- }
- return TCL_ERROR;
+ masterPtr->deleted = 0;
+ }
+
+ /*
+ * Call the image type manager so that it can perform its own
+ * initialization, then re-"get" for any existing instances of the
+ * image.
+ */
+
+ objv += firstOption;
+ objc -= firstOption;
+ args = (Tcl_Obj **) objv;
+ if (oldimage) {
+ int i;
+
+ args = (Tcl_Obj **) ckalloc((objc+1) * sizeof(char *));
+ for (i = 0; i < objc; i++) {
+ args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]);
}
+ args[objc] = NULL;
+ }
+ Tcl_Preserve((ClientData) masterPtr);
+ if ((*typePtr->createProc)(interp, name, objc, args, typePtr,
+ (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK) {
+ EventuallyDeleteImage(masterPtr, 0);
Tcl_Release((ClientData) masterPtr);
if (oldimage) {
ckfree((char *) args);
}
- masterPtr->typePtr = typePtr;
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
- imagePtr = imagePtr->nextPtr) {
- imagePtr->instanceData = (*typePtr->getProc)(
- imagePtr->tkwin, masterPtr->masterData);
- }
- Tcl_SetResult(interp,
- Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr),
- TCL_STATIC);
- break;
+ return TCL_ERROR;
}
- case IMAGE_DELETE: {
- for (i = 2; i < objc; i++) {
- char *arg = Tcl_GetString(objv[i]);
- hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, arg);
- if (hPtr == NULL) {
- Tcl_AppendResult(interp, "image \"", arg,
- "\" doesn't exist", (char *) NULL);
- return TCL_ERROR;
- }
- DeleteImage((ImageMaster *) Tcl_GetHashValue(hPtr));
- }
- break;
+ Tcl_Release((ClientData) masterPtr);
+ if (oldimage) {
+ ckfree((char *) args);
}
- case IMAGE_HEIGHT: {
- char *arg;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "name");
- return TCL_ERROR;
- }
- arg = Tcl_GetString(objv[2]);
- hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, arg);
- if (hPtr == NULL) {
- Tcl_AppendResult(interp, "image \"", arg,
- "\" doesn't exist", (char *) NULL);
- return TCL_ERROR;
- }
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
- Tcl_SetIntObj(Tcl_GetObjResult(interp), masterPtr->height);
- break;
+ masterPtr->typePtr = typePtr;
+ for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ imagePtr = imagePtr->nextPtr) {
+ imagePtr->instanceData = (*typePtr->getProc)(imagePtr->tkwin,
+ masterPtr->masterData);
}
-
- case IMAGE_INUSE: {
- int count = 0;
- char *arg;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "name");
- return TCL_ERROR;
- }
- arg = Tcl_GetString(objv[2]);
+ Tcl_SetResult(interp,
+ Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr),
+ TCL_STATIC);
+ break;
+ }
+ case IMAGE_DELETE:
+ for (i = 2; i < objc; i++) {
+ arg = Tcl_GetString(objv[i]);
hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, arg);
if (hPtr == NULL) {
- Tcl_AppendResult(interp, "image \"", arg,
- "\" doesn't exist", (char *) NULL);
- return TCL_ERROR;
+ goto alreadyDeleted;
}
masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr != NULL && masterPtr->instancePtr != NULL) {
- count = 1;
+ if (masterPtr->deleted) {
+ goto alreadyDeleted;
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), count);
- break;
+ DeleteImage(masterPtr);
}
-
- case IMAGE_NAMES: {
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, NULL);
- return TCL_ERROR;
+ break;
+ case IMAGE_NAMES:
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ return TCL_ERROR;
+ }
+ hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search);
+ for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ if (masterPtr->deleted) {
+ continue;
}
- hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search);
- for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_AppendElement(interp, Tcl_GetHashKey(
+ Tcl_AppendElement(interp, Tcl_GetHashKey(
&winPtr->mainPtr->imageTable, hPtr));
- }
- break;
}
-
- case IMAGE_TYPE: {
- char *arg;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "name");
- return TCL_ERROR;
- }
- arg = Tcl_GetString(objv[2]);
- hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, arg);
- if (hPtr == NULL) {
- Tcl_AppendResult(interp, "image \"", arg,
- "\" doesn't exist", (char *) NULL);
- return TCL_ERROR;
- }
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ break;
+ case IMAGE_TYPES:
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ return TCL_ERROR;
+ }
+ for (typePtr = tsdPtr->imageTypeList; typePtr != NULL;
+ typePtr = typePtr->nextPtr) {
+ Tcl_AppendElement(interp, typePtr->name);
+ }
+ for (typePtr = tsdPtr->oldImageTypeList; typePtr != NULL;
+ typePtr = typePtr->nextPtr) {
+ Tcl_AppendElement(interp, typePtr->name);
+ }
+ break;
+
+ case IMAGE_HEIGHT:
+ case IMAGE_INUSE:
+ case IMAGE_TYPE:
+ case IMAGE_WIDTH:
+ /*
+ * These operations all parse virtually identically. First check to
+ * see if three args are given. Then get a non-deleted master from the
+ * third arg.
+ */
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "name");
+ return TCL_ERROR;
+ }
+
+ arg = Tcl_GetString(objv[2]);
+ hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, arg);
+ if (hPtr == NULL) {
+ goto alreadyDeleted;
+ }
+ masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ if (masterPtr->deleted) {
+ goto alreadyDeleted;
+ }
+
+ /*
+ * Now we read off the specific piece of data we were asked for.
+ */
+
+ switch ((enum options) index) {
+ case IMAGE_HEIGHT:
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), masterPtr->height);
+ break;
+ case IMAGE_INUSE:
+ Tcl_SetBooleanObj(Tcl_GetObjResult(interp),
+ masterPtr->typePtr!=NULL && masterPtr->instancePtr!=NULL);
+ break;
+ case IMAGE_TYPE:
if (masterPtr->typePtr != NULL) {
Tcl_SetResult(interp, masterPtr->typePtr->name, TCL_STATIC);
}
break;
- }
- case IMAGE_TYPES: {
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, NULL);
- return TCL_ERROR;
- }
- for (typePtr = tsdPtr->imageTypeList; typePtr != NULL;
- typePtr = typePtr->nextPtr) {
- Tcl_AppendElement(interp, typePtr->name);
- }
- for (typePtr = tsdPtr->oldImageTypeList; typePtr != NULL;
- typePtr = typePtr->nextPtr) {
- Tcl_AppendElement(interp, typePtr->name);
- }
- break;
- }
- case IMAGE_WIDTH: {
- char *arg;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "name");
- return TCL_ERROR;
- }
- arg = Tcl_GetString(objv[2]);
- hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, arg);
- if (hPtr == NULL) {
- Tcl_AppendResult(interp, "image \"", arg,
- "\" doesn't exist", (char *) NULL);
- return TCL_ERROR;
- }
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ case IMAGE_WIDTH:
Tcl_SetIntObj(Tcl_GetObjResult(interp), masterPtr->width);
break;
+ default:
+ Tcl_Panic("can't happen");
}
+ break;
}
return TCL_OK;
+
+ alreadyDeleted:
+ Tcl_AppendResult(interp, "image \"", arg, "\" doesn't exist", NULL);
+ return TCL_ERROR;
}
/*
@@ -466,33 +493,32 @@ Tk_ImageObjCmd(clientData, interp, objc, objv)
*
* Tk_ImageChanged --
*
- * This procedure is called by an image manager whenever something
- * has happened that requires the image to be redrawn (some of its
- * pixels have changed, or its size has changed).
+ * This function is called by an image manager whenever something has
+ * happened that requires the image to be redrawn (some of its pixels
+ * have changed, or its size has changed).
*
* Results:
* None.
*
* Side effects:
- * Any widgets that display the image are notified so that they
- * can redisplay themselves as appropriate.
+ * Any widgets that display the image are notified so that they can
+ * redisplay themselves as appropriate.
*
*----------------------------------------------------------------------
*/
void
-Tk_ImageChanged(imageMaster, x, y, width, height, imageWidth,
- imageHeight)
- Tk_ImageMaster imageMaster; /* Image that needs redisplay. */
- int x, y; /* Coordinates of upper-left pixel of
- * region of image that needs to be
- * redrawn. */
- int width, height; /* Dimensions (in pixels) of region of
- * image to redraw. If either dimension
- * is zero then the image doesn't need to
- * be redrawn (perhaps all that happened is
- * that its size changed). */
- int imageWidth, imageHeight;/* New dimensions of image. */
+Tk_ImageChanged(
+ Tk_ImageMaster imageMaster, /* Image that needs redisplay. */
+ int x, int y, /* Coordinates of upper-left pixel of region
+ * of image that needs to be redrawn. */
+ int width, int height, /* Dimensions (in pixels) of region of image
+ * to redraw. If either dimension is zero then
+ * the image doesn't need to be redrawn
+ * (perhaps all that happened is that its size
+ * changed). */
+ int imageWidth, int imageHeight)
+ /* New dimensions of image. */
{
ImageMaster *masterPtr = (ImageMaster *) imageMaster;
Image *imagePtr;
@@ -500,7 +526,7 @@ Tk_ImageChanged(imageMaster, x, y, width, height, imageWidth,
masterPtr->width = imageWidth;
masterPtr->height = imageHeight;
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
- imagePtr = imagePtr->nextPtr) {
+ imagePtr = imagePtr->nextPtr) {
(*imagePtr->changeProc)(imagePtr->widgetClientData, x, y,
width, height, imageWidth, imageHeight);
}
@@ -511,8 +537,8 @@ Tk_ImageChanged(imageMaster, x, y, width, height, imageWidth,
*
* Tk_NameOfImage --
*
- * Given a token for an image master, this procedure returns
- * the name of the image.
+ * Given a token for an image master, this function returns the name of
+ * the image.
*
* Results:
* The return value is the string name for imageMaster.
@@ -524,8 +550,8 @@ Tk_ImageChanged(imageMaster, x, y, width, height, imageWidth,
*/
CONST char *
-Tk_NameOfImage(imageMaster)
- Tk_ImageMaster imageMaster; /* Token for image. */
+Tk_NameOfImage(
+ Tk_ImageMaster imageMaster) /* Token for image. */
{
ImageMaster *masterPtr = (ImageMaster *) imageMaster;
@@ -540,36 +566,34 @@ Tk_NameOfImage(imageMaster)
*
* Tk_GetImage --
*
- * This procedure is invoked by a widget when it wants to use
- * a particular image in a particular window.
+ * This function is invoked by a widget when it wants to use a particular
+ * image in a particular window.
*
* Results:
- * The return value is a token for the image. If there is no image
- * by the given name, then NULL is returned and an error message is
- * left in the interp's result.
+ * The return value is a token for the image. If there is no image by the
+ * given name, then NULL is returned and an error message is left in the
+ * interp's result.
*
* Side effects:
- * Tk records the fact that the widget is using the image, and
- * it will invoke changeProc later if the widget needs redisplay
- * (i.e. its size changes or some of its pixels change). The
- * caller must eventually invoke Tk_FreeImage when it no longer
- * needs the image.
+ * Tk records the fact that the widget is using the image, and it will
+ * invoke changeProc later if the widget needs redisplay (i.e. its size
+ * changes or some of its pixels change). The caller must eventually
+ * invoke Tk_FreeImage when it no longer needs the image.
*
*----------------------------------------------------------------------
*/
Tk_Image
-Tk_GetImage(interp, tkwin, name, changeProc, clientData)
- Tcl_Interp *interp; /* Place to leave error message if image
- * can't be found. */
- Tk_Window tkwin; /* Token for window in which image will
- * be used. */
- CONST char *name; /* Name of desired image. */
- Tk_ImageChangedProc *changeProc;
- /* Procedure to invoke when redisplay is
- * needed because image's pixels or size
- * changed. */
- ClientData clientData; /* One-word argument to pass to damageProc. */
+Tk_GetImage(
+ Tcl_Interp *interp, /* Place to leave error message if image can't
+ * be found. */
+ Tk_Window tkwin, /* Token for window in which image will be
+ * used. */
+ CONST char *name, /* Name of desired image. */
+ Tk_ImageChangedProc *changeProc,
+ /* Function to invoke when redisplay is needed
+ * because image's pixels or size changed. */
+ ClientData clientData) /* One-word argument to pass to damageProc. */
{
Tcl_HashEntry *hPtr;
ImageMaster *masterPtr;
@@ -583,6 +607,9 @@ Tk_GetImage(interp, tkwin, name, changeProc, clientData)
if (masterPtr->typePtr == NULL) {
goto noSuchImage;
}
+ if (masterPtr->deleted) {
+ goto noSuchImage;
+ }
imagePtr = (Image *) ckalloc(sizeof(Image));
imagePtr->tkwin = tkwin;
imagePtr->display = Tk_Display(tkwin);
@@ -595,9 +622,10 @@ Tk_GetImage(interp, tkwin, name, changeProc, clientData)
masterPtr->instancePtr = imagePtr;
return (Tk_Image) imagePtr;
- noSuchImage:
- Tcl_AppendResult(interp, "image \"", name, "\" doesn't exist",
- (char *) NULL);
+ noSuchImage:
+ if (interp) {
+ Tcl_AppendResult(interp, "image \"", name, "\" doesn't exist", NULL);
+ }
return NULL;
}
@@ -606,9 +634,9 @@ Tk_GetImage(interp, tkwin, name, changeProc, clientData)
*
* Tk_FreeImage --
*
- * This procedure is invoked by a widget when it no longer needs
- * an image acquired by a previous call to Tk_GetImage. For each
- * call to Tk_GetImage there must be exactly one call to Tk_FreeImage.
+ * This function is invoked by a widget when it no longer needs an image
+ * acquired by a previous call to Tk_GetImage. For each call to
+ * Tk_GetImage there must be exactly one call to Tk_FreeImage.
*
* Results:
* None.
@@ -620,9 +648,9 @@ Tk_GetImage(interp, tkwin, name, changeProc, clientData)
*/
void
-Tk_FreeImage(image)
- Tk_Image image; /* Token for image that is no longer
- * needed by a widget. */
+Tk_FreeImage(
+ Tk_Image image) /* Token for image that is no longer needed by
+ * a widget. */
{
Image *imagePtr = (Image *) image;
ImageMaster *masterPtr = imagePtr->masterPtr;
@@ -647,16 +675,16 @@ Tk_FreeImage(image)
}
ckfree((char *) imagePtr);
- /*
- * If there are no more instances left for the master, and if the
- * master image has been deleted, then delete the master too.
+ /*
+ * If there are no more instances left for the master, and if the master
+ * image has been deleted, then delete the master too.
*/
if ((masterPtr->typePtr == NULL) && (masterPtr->instancePtr == NULL)) {
if (masterPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(masterPtr->hPtr);
}
- Tcl_Release(masterPtr->winPtr);
+ Tcl_Release((ClientData) masterPtr->winPtr);
ckfree((char *) masterPtr);
}
}
@@ -666,29 +694,29 @@ Tk_FreeImage(image)
*
* Tk_PostscriptImage --
*
- * This procedure is called by widgets that contain images in order
- * to redisplay an image on the screen or an off-screen pixmap.
+ * This function is called by widgets that contain images in order to
+ * redisplay an image on the screen or an off-screen pixmap.
*
* Results:
* None.
*
* Side effects:
- * The image's manager is notified, and it redraws the desired
- * portion of the image before returning.
+ * The image's manager is notified, and it redraws the desired portion of
+ * the image before returning.
*
*----------------------------------------------------------------------
*/
int
-Tk_PostscriptImage(image, interp, tkwin, psinfo, x, y, width, height, prepass)
- Tk_Image image; /* Token for image to redisplay. */
- Tcl_Interp *interp;
- Tk_Window tkwin;
- Tk_PostscriptInfo psinfo; /* postscript info */
- int x, y; /* Upper-left pixel of region in image that
+Tk_PostscriptImage(
+ Tk_Image image, /* Token for image to redisplay. */
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tk_PostscriptInfo psinfo, /* postscript info */
+ int x, int y, /* Upper-left pixel of region in image that
* needs to be redisplayed. */
- int width, height; /* Dimensions of region to redraw. */
- int prepass;
+ int width, int height, /* Dimensions of region to redraw. */
+ int prepass)
{
Image *imagePtr = (Image *) image;
int result;
@@ -701,12 +729,13 @@ Tk_PostscriptImage(image, interp, tkwin, psinfo, x, y, width, height, prepass)
/*
* No master for image, so nothing to display on postscript.
*/
+
return TCL_OK;
}
/*
- * Check if an image specific postscript-generation function
- * exists; otherwise go on with generic code.
+ * Check if an image specific postscript-generation function exists;
+ * otherwise go on with generic code.
*/
if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) {
@@ -721,12 +750,12 @@ Tk_PostscriptImage(image, interp, tkwin, psinfo, x, y, width, height, prepass)
/*
* Create a Pixmap, tell the image to redraw itself there, and then
- * generate an XImage from the Pixmap. We can then read pixel
- * values out of the XImage.
+ * generate an XImage from the Pixmap. We can then read pixel values out
+ * of the XImage.
*/
- pmap = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
- width, height, Tk_Depth(tkwin));
+ pmap = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin), width, height,
+ Tk_Depth(tkwin));
gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin));
newGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
@@ -742,11 +771,13 @@ Tk_PostscriptImage(image, interp, tkwin, psinfo, x, y, width, height, prepass)
(unsigned int)width, (unsigned int)height, AllPlanes, ZPixmap);
Tk_FreePixmap(Tk_Display(tkwin), pmap);
-
+
if (ximage == NULL) {
- /* The XGetImage() function is apparently not
- * implemented on this system. Just ignore it.
+ /*
+ * The XGetImage() function is apparently not implemented on this
+ * system. Just ignore it.
*/
+
return TCL_OK;
}
result = TkPostscriptImage(interp, tkwin, psinfo, ximage, x, y,
@@ -755,39 +786,38 @@ Tk_PostscriptImage(image, interp, tkwin, psinfo, x, y, width, height, prepass)
XDestroyImage(ximage);
return result;
}
-
+
/*
*----------------------------------------------------------------------
*
* Tk_RedrawImage --
*
- * This procedure is called by widgets that contain images in order
- * to redisplay an image on the screen or an off-screen pixmap.
+ * This function is called by widgets that contain images in order to
+ * redisplay an image on the screen or an off-screen pixmap.
*
* Results:
* None.
*
* Side effects:
- * The image's manager is notified, and it redraws the desired
- * portion of the image before returning.
+ * The image's manager is notified, and it redraws the desired portion of
+ * the image before returning.
*
*----------------------------------------------------------------------
*/
void
-Tk_RedrawImage(image, imageX, imageY, width, height, drawable,
- drawableX, drawableY)
- Tk_Image image; /* Token for image to redisplay. */
- int imageX, imageY; /* Upper-left pixel of region in image that
+Tk_RedrawImage(
+ Tk_Image image, /* Token for image to redisplay. */
+ int imageX, int imageY, /* Upper-left pixel of region in image that
* needs to be redisplayed. */
- int width, height; /* Dimensions of region to redraw. */
- Drawable drawable; /* Drawable in which to display image
- * (window or pixmap). If this is a pixmap,
- * it must have the same depth as the window
- * used in the Tk_GetImage call for the
- * image. */
- int drawableX, drawableY; /* Coordinates in drawable that correspond
- * to imageX and imageY. */
+ int width, int height, /* Dimensions of region to redraw. */
+ Drawable drawable, /* Drawable in which to display image (window
+ * or pixmap). If this is a pixmap, it must
+ * have the same depth as the window used in
+ * the Tk_GetImage call for the image. */
+ int drawableX, int drawableY)
+ /* Coordinates in drawable that correspond to
+ * imageX and imageY. */
{
Image *imagePtr = (Image *) image;
@@ -829,11 +859,11 @@ Tk_RedrawImage(image, imageX, imageY, width, height, drawable,
*
* Tk_SizeOfImage --
*
- * This procedure returns the current dimensions of an image.
+ * This function returns the current dimensions of an image.
*
* Results:
- * The width and height of the image are returned in *widthPtr
- * and *heightPtr.
+ * The width and height of the image are returned in *widthPtr and
+ * *heightPtr.
*
* Side effects:
* None.
@@ -842,10 +872,10 @@ Tk_RedrawImage(image, imageX, imageY, width, height, drawable,
*/
void
-Tk_SizeOfImage(image, widthPtr, heightPtr)
- Tk_Image image; /* Token for image whose size is wanted. */
- int *widthPtr; /* Return width of image here. */
- int *heightPtr; /* Return height of image here. */
+Tk_SizeOfImage(
+ Tk_Image image, /* Token for image whose size is wanted. */
+ int *widthPtr, /* Return width of image here. */
+ int *heightPtr) /* Return height of image here. */
{
Image *imagePtr = (Image *) image;
@@ -858,25 +888,23 @@ Tk_SizeOfImage(image, widthPtr, heightPtr)
*
* Tk_DeleteImage --
*
- * Given the name of an image, this procedure destroys the
- * image.
+ * Given the name of an image, this function destroys the image.
*
* Results:
* None.
*
* Side effects:
- * The image is destroyed; existing instances will display as
- * blank areas. If no such image exists then the procedure does
- * nothing.
+ * The image is destroyed; existing instances will display as blank
+ * areas. If no such image exists then the function does nothing.
*
*----------------------------------------------------------------------
*/
void
-Tk_DeleteImage(interp, name)
- Tcl_Interp *interp; /* Interpreter in which the image was
+Tk_DeleteImage(
+ Tcl_Interp *interp, /* Interpreter in which the image was
* created. */
- CONST char *name; /* Name of image. */
+ CONST char *name) /* Name of image. */
{
Tcl_HashEntry *hPtr;
TkWindow *winPtr;
@@ -897,22 +925,22 @@ Tk_DeleteImage(interp, name)
*
* DeleteImage --
*
- * This procedure is responsible for deleting an image.
+ * This function is responsible for deleting an image.
*
* Results:
* None.
*
* Side effects:
- * The connection is dropped between instances of this image and
- * an image master. Image instances will redisplay themselves
- * as empty areas, but existing instances will not be deleted.
+ * The connection is dropped between instances of this image and an image
+ * master. Image instances will redisplay themselves as empty areas, but
+ * existing instances will not be deleted.
*
*----------------------------------------------------------------------
*/
static void
-DeleteImage(masterPtr)
- ImageMaster *masterPtr; /* Pointer to main data structure for image. */
+DeleteImage(
+ ImageMaster *masterPtr) /* Pointer to main data structure for image. */
{
Image *imagePtr;
Tk_ImageType *typePtr;
@@ -922,9 +950,9 @@ DeleteImage(masterPtr)
if (typePtr != NULL) {
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- (*typePtr->freeProc)(imagePtr->instanceData,
- imagePtr->display);
- (*imagePtr->changeProc)(imagePtr->widgetClientData, 0, 0,
+ (*typePtr->freeProc)(imagePtr->instanceData,
+ imagePtr->display);
+ (*imagePtr->changeProc)(imagePtr->widgetClientData, 0, 0,
masterPtr->width, masterPtr->height, masterPtr->width,
masterPtr->height);
}
@@ -936,6 +964,8 @@ DeleteImage(masterPtr)
}
Tcl_Release((ClientData) masterPtr->winPtr);
ckfree((char *) masterPtr);
+ } else {
+ masterPtr->deleted = 1;
}
}
@@ -950,19 +980,20 @@ DeleteImage(masterPtr)
* None.
*
* Side effects:
- * Image will get freed, though not until it is no longer
- * Tcl_Preserve()d by anything. May be called multiple times on
- * the same image without ill effects.
+ * Image will get freed, though not until it is no longer Tcl_Preserve()d
+ * by anything. May be called multiple times on the same image without
+ * ill effects.
*
*----------------------------------------------------------------------
*/
static void
-EventuallyDeleteImage(masterPtr, forgetHashEntryNow)
- ImageMaster *masterPtr; /* Pointer to main data structure for image. */
- int forgetHashEntryNow;
+EventuallyDeleteImage(
+ ImageMaster *masterPtr, /* Pointer to main data structure for image. */
+ int forgetImageHashNow) /* Flag to say whether the hash table is about
+ * to vanish. */
{
- if (forgetHashEntryNow) {
+ if (forgetImageHashNow) {
masterPtr->hPtr = NULL;
}
if (!masterPtr->deleted) {
@@ -977,10 +1008,9 @@ EventuallyDeleteImage(masterPtr, forgetHashEntryNow)
*
* TkDeleteAllImages --
*
- * This procedure is called when an application is deleted. It
- * calls back all of the managers for all images so that they
- * can cleanup, then it deletes all of Tk's internal information
- * about images.
+ * This function is called when an application is deleted. It calls back
+ * all of the managers for all images so that they can cleanup, then it
+ * deletes all of Tk's internal information about images.
*
* Results:
* None.
@@ -992,8 +1022,8 @@ EventuallyDeleteImage(masterPtr, forgetHashEntryNow)
*/
void
-TkDeleteAllImages(mainPtr)
- TkMainInfo *mainPtr; /* Structure describing application that is
+TkDeleteAllImages(
+ TkMainInfo *mainPtr) /* Structure describing application that is
* going away. */
{
Tcl_HashSearch search;
@@ -1011,15 +1041,14 @@ TkDeleteAllImages(mainPtr)
*
* Tk_GetImageMasterData --
*
- * Given the name of an image, this procedure returns the type
- * of the image and the clientData associated with its master.
+ * Given the name of an image, this function returns the type of the
+ * image and the clientData associated with its master.
*
* Results:
- * If there is no image by the given name, then NULL is returned
- * and a NULL value is stored at *typePtrPtr. Otherwise the return
- * value is the clientData returned by the createProc when the
- * image was created and a pointer to the type structure for the
- * image is stored at *typePtrPtr.
+ * If there is no image by the given name, then NULL is returned and a
+ * NULL value is stored at *typePtrPtr. Otherwise the return value is the
+ * clientData returned by the createProc when the image was created and a
+ * pointer to the type structure for the image is stored at *typePtrPtr.
*
* Side effects:
* None.
@@ -1028,12 +1057,12 @@ TkDeleteAllImages(mainPtr)
*/
ClientData
-Tk_GetImageMasterData(interp, name, typePtrPtr)
- Tcl_Interp *interp; /* Interpreter in which the image was
+Tk_GetImageMasterData(
+ Tcl_Interp *interp, /* Interpreter in which the image was
* created. */
- CONST char *name; /* Name of image. */
- Tk_ImageType **typePtrPtr; /* Points to location to fill in with
- * pointer to type information for image. */
+ CONST char *name, /* Name of image. */
+ Tk_ImageType **typePtrPtr) /* Points to location to fill in with pointer
+ * to type information for image. */
{
Tcl_HashEntry *hPtr;
TkWindow *winPtr;
@@ -1046,36 +1075,41 @@ Tk_GetImageMasterData(interp, name, typePtrPtr)
return NULL;
}
masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ if (masterPtr->deleted) {
+ *typePtrPtr = NULL;
+ return NULL;
+ }
*typePtrPtr = masterPtr->typePtr;
return masterPtr->masterData;
}
-
+
/*
*----------------------------------------------------------------------
*
* Tk_SetTSOrigin --
*
- * Set the pattern origin of the tile to a common point (i.e. the
- * origin (0,0) of the top level window) so that tiles from two
- * different widgets will match up. This done by setting the
- * GCTileStipOrigin field is set to the translated origin of the
- * toplevel window in the hierarchy.
+ * Set the pattern origin of the tile to a common point (i.e. the origin
+ * (0,0) of the top level window) so that tiles from two different
+ * widgets will match up. This done by setting the GCTileStipOrigin field
+ * is set to the translated origin of the toplevel window in the
+ * hierarchy.
*
* Results:
* None.
*
* Side Effects:
- * The GCTileStipOrigin is reset in the GC. This will cause the
- * tile origin to change when the GC is used for drawing.
+ * The GCTileStipOrigin is reset in the GC. This will cause the tile
+ * origin to change when the GC is used for drawing.
*
*----------------------------------------------------------------------
*/
+
/*ARGSUSED*/
void
-Tk_SetTSOrigin(tkwin, gc, x, y)
- Tk_Window tkwin;
- GC gc;
- int x, y;
+Tk_SetTSOrigin(
+ Tk_Window tkwin,
+ GC gc,
+ int x, int y)
{
while (!Tk_TopWinHierarchy(tkwin)) {
x -= Tk_X(tkwin) + Tk_Changes(tkwin)->border_width;
@@ -1084,4 +1118,11 @@ Tk_SetTSOrigin(tkwin, gc, x, y)
}
XSetTSOrigin(Tk_Display(tkwin), gc, x, y);
}
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index 99ae050..88c96d5 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkImgBmap.c --
*
* This procedure implements images of type "bitmap" for Tk.
@@ -12,7 +12,6 @@
*/
#include "tkInt.h"
-#include "tkPort.h"
/*
* The following data structure represents the master for a bitmap
@@ -20,21 +19,19 @@
*/
typedef struct BitmapMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means
- * the image is being deleted. */
- Tcl_Interp *interp; /* Interpreter for application that is
- * using image. */
- Tcl_Command imageCmd; /* Token for image command (used to delete
- * it when the image goes away). NULL means
- * the image command has already been
- * deleted. */
+ Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+ * image is being deleted. */
+ Tcl_Interp *interp; /* Interpreter for application that is using
+ * image. */
+ Tcl_Command imageCmd; /* Token for image command (used to delete it
+ * when the image goes away). NULL means the
+ * image command has already been deleted. */
int width, height; /* Dimensions of image. */
- char *data; /* Data comprising bitmap (suitable for
- * input to XCreateBitmapFromData). May
- * be NULL if no data. Malloc'ed. */
- char *maskData; /* Data for bitmap's mask (suitable for
- * input to XCreateBitmapFromData).
- * Malloc'ed. */
+ char *data; /* Data comprising bitmap (suitable for input
+ * to XCreateBitmapFromData). May be NULL if
+ * no data. Malloc'ed. */
+ char *maskData; /* Data for bitmap's mask (suitable for input
+ * to XCreateBitmapFromData). Malloc'ed. */
Tk_Uid fgUid; /* Value of -foreground option (malloc'ed). */
Tk_Uid bgUid; /* Value of -background option (malloc'ed). */
char *fileString; /* Value of -file option (malloc'ed). */
@@ -47,13 +44,13 @@ typedef struct BitmapMaster {
} BitmapMaster;
/*
- * The following data structure represents all of the instances of an
- * image that lie within a particular window:
+ * The following data structure represents all of the instances of an image
+ * that lie within a particular window:
*/
typedef struct BitmapInstance {
- int refCount; /* Number of instances that share this
- * data structure. */
+ int refCount; /* Number of instances that share this data
+ * structure. */
BitmapMaster *masterPtr; /* Pointer to master for image. */
Tk_Window tkwin; /* Window in which the instances will be
* displayed. */
@@ -63,37 +60,35 @@ typedef struct BitmapInstance {
Pixmap mask; /* Mask: only display bitmap pixels where
* there are 1's here. */
GC gc; /* Graphics context for displaying bitmap.
- * None means there was an error while
- * setting up the instance, so it cannot
- * be displayed. */
+ * None means there was an error while setting
+ * up the instance, so it cannot be
+ * displayed. */
struct BitmapInstance *nextPtr;
/* Next in list of all instance structures
- * associated with masterPtr (NULL means
- * end of list). */
+ * associated with masterPtr (NULL means end
+ * of list). */
} BitmapInstance;
/*
* The type record for bitmap images:
*/
-static int GetByte _ANSI_ARGS_((Tcl_Channel chan));
-static int ImgBmapCreate _ANSI_ARGS_((Tcl_Interp *interp,
+static int GetByte(Tcl_Channel chan);
+static int ImgBmapCreate(Tcl_Interp *interp,
char *name, int argc, Tcl_Obj *CONST objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *clientDataPtr));
-static ClientData ImgBmapGet _ANSI_ARGS_((Tk_Window tkwin,
- ClientData clientData));
-static void ImgBmapDisplay _ANSI_ARGS_((ClientData clientData,
- Display *display, Drawable drawable,
+ ClientData *clientDataPtr);
+static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData);
+static void ImgBmapDisplay(ClientData clientData,
+ Display *display, Drawable drawable,
int imageX, int imageY, int width, int height,
- int drawableX, int drawableY));
-static void ImgBmapFree _ANSI_ARGS_((ClientData clientData,
- Display *display));
-static void ImgBmapDelete _ANSI_ARGS_((ClientData clientData));
-static int ImgBmapPostscript _ANSI_ARGS_((ClientData clientData,
+ int drawableX, int drawableY);
+static void ImgBmapFree(ClientData clientData, Display *display);
+static void ImgBmapDelete(ClientData clientData);
+static int ImgBmapPostscript(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
Tk_PostscriptInfo psinfo, int x, int y,
- int width, int height, int prepass));
+ int width, int height, int prepass);
Tk_ImageType tkBitmapImageType = {
"bitmap", /* name */
@@ -103,7 +98,7 @@ Tk_ImageType tkBitmapImageType = {
ImgBmapFree, /* freeProc */
ImgBmapDelete, /* deleteProc */
ImgBmapPostscript, /* postscriptProc */
- (Tk_ImageType *) NULL /* nextPtr */
+ NULL /* nextPtr */
};
/*
@@ -111,28 +106,25 @@ Tk_ImageType tkBitmapImageType = {
*/
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_UID, "-background", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_UID, "-background", NULL, NULL,
"", Tk_Offset(BitmapMaster, bgUid), 0},
- {TK_CONFIG_STRING, "-data", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapMaster, dataString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-file", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapMaster, fileString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_UID, "-foreground", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-data", NULL, NULL,
+ NULL, Tk_Offset(BitmapMaster, dataString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_STRING, "-file", NULL, NULL,
+ NULL, Tk_Offset(BitmapMaster, fileString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_UID, "-foreground", NULL, NULL,
"#000000", Tk_Offset(BitmapMaster, fgUid), 0},
- {TK_CONFIG_STRING, "-maskdata", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapMaster, maskDataString),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-maskfile", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(BitmapMaster, maskFileString),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_STRING, "-maskdata", NULL, NULL,
+ NULL, Tk_Offset(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_STRING, "-maskfile", NULL, NULL,
+ NULL, Tk_Offset(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * The following data structure is used to describe the state of
- * parsing a bitmap file or string. It is used for communication
- * between TkGetBitmapData and NextBitmapWord.
+ * The following data structure is used to describe the state of parsing a
+ * bitmap file or string. It is used for communication between TkGetBitmapData
+ * and NextBitmapWord.
*/
#define MAX_WORD_LENGTH 100
@@ -140,8 +132,8 @@ typedef struct ParseInfo {
char *string; /* Next character of string data for bitmap,
* or NULL if bitmap is being read from
* file. */
- Tcl_Channel chan; /* File containing bitmap data, or NULL
- * if no file. */
+ Tcl_Channel chan; /* File containing bitmap data, or NULL if no
+ * file. */
char word[MAX_WORD_LENGTH+1];
/* Current word of bitmap data, NULL
* terminated. */
@@ -152,24 +144,20 @@ typedef struct ParseInfo {
* Prototypes for procedures used only locally in this file:
*/
-static int ImgBmapCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[]));
-static void ImgBmapCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void ImgBmapConfigureInstance _ANSI_ARGS_((
- BitmapInstance *instancePtr));
-static int ImgBmapConfigureMaster _ANSI_ARGS_((
- BitmapMaster *masterPtr, int argc, Tcl_Obj *CONST objv[],
- int flags));
-static int NextBitmapWord _ANSI_ARGS_((ParseInfo *parseInfoPtr));
+static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj *CONST objv[]);
+static void ImgBmapCmdDeletedProc(ClientData clientData);
+static void ImgBmapConfigureInstance(BitmapInstance *instancePtr);
+static int ImgBmapConfigureMaster(BitmapMaster *masterPtr,
+ int argc, Tcl_Obj *CONST objv[], int flags);
+static int NextBitmapWord(ParseInfo *parseInfoPtr);
/*
*----------------------------------------------------------------------
*
* ImgBmapCreate --
*
- * This procedure is called by the Tk image code to create "test"
- * images.
+ * This procedure is called by the Tk image code to create "test" images.
*
* Results:
* A standard Tcl result.
@@ -182,18 +170,18 @@ static int NextBitmapWord _ANSI_ARGS_((ParseInfo *parseInfoPtr));
/* ARGSUSED */
static int
-ImgBmapCreate(interp, name, argc, argv, typePtr, master, clientDataPtr)
- Tcl_Interp *interp; /* Interpreter for application containing
+ImgBmapCreate(
+ Tcl_Interp *interp, /* Interpreter for application containing
* image. */
- char *name; /* Name to use for image. */
- int argc; /* Number of arguments. */
- Tcl_Obj *CONST argv[]; /* Argument objects for options (doesn't
+ char *name, /* Name to use for image. */
+ int argc, /* Number of arguments. */
+ Tcl_Obj *CONST argv[], /* Argument objects for options (doesn't
* include image name or type). */
- Tk_ImageType *typePtr; /* Pointer to our type record (not used). */
- Tk_ImageMaster master; /* Token for image, to be used by us in
- * later callbacks. */
- ClientData *clientDataPtr; /* Store manager's token for image here;
- * it will be returned in later callbacks. */
+ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
+ Tk_ImageMaster master, /* Token for image, to be used by us in later
+ * callbacks. */
+ ClientData *clientDataPtr) /* Store manager's token for image here; it
+ * will be returned in later callbacks. */
{
BitmapMaster *masterPtr;
@@ -226,28 +214,28 @@ ImgBmapCreate(interp, name, argc, argv, typePtr, master, clientDataPtr)
* ImgBmapConfigureMaster --
*
* This procedure is called when a bitmap image is created or
- * reconfigured. It process configuration options and resets
- * any instances of the image.
+ * reconfigured. It process configuration options and resets any
+ * instances of the image.
*
* Results:
- * A standard Tcl return value. If TCL_ERROR is returned then
- * an error message is left in the masterPtr->interp's result.
+ * A standard Tcl return value. If TCL_ERROR is returned then an error
+ * message is left in the masterPtr->interp's result.
*
* Side effects:
- * Existing instances of the image will be redisplayed to match
- * the new configuration options.
+ * Existing instances of the image will be redisplayed to match the new
+ * configuration options.
*
*----------------------------------------------------------------------
*/
static int
-ImgBmapConfigureMaster(masterPtr, objc, objv, flags)
- BitmapMaster *masterPtr; /* Pointer to data structure describing
+ImgBmapConfigureMaster(
+ BitmapMaster *masterPtr, /* Pointer to data structure describing
* overall bitmap image to (reconfigure). */
- int objc; /* Number of entries in objv. */
- Tcl_Obj *CONST objv[]; /* Pairs of configuration options for image. */
- int flags; /* Flags to pass to Tk_ConfigureWidget,
- * such as TK_CONFIG_ARGV_ONLY. */
+ int objc, /* Number of entries in objv. */
+ Tcl_Obj *CONST objv[], /* Pairs of configuration options for image. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget, such
+ * as TK_CONFIG_ARGV_ONLY. */
{
BitmapInstance *instancePtr;
int maskWidth, maskHeight, dummy1, dummy2;
@@ -267,8 +255,8 @@ ImgBmapConfigureMaster(masterPtr, objc, objv, flags)
ckfree((char *) argv);
/*
- * Parse the bitmap and/or mask to create binary data. Make sure that
- * the bitmap and mask have the same dimensions.
+ * Parse the bitmap and/or mask to create binary data. Make sure that the
+ * bitmap and mask have the same dimensions.
*/
if (masterPtr->data != NULL) {
@@ -311,9 +299,9 @@ ImgBmapConfigureMaster(masterPtr, objc, objv, flags)
}
/*
- * Cycle through all of the instances of this image, regenerating
- * the information for each instance. Then force the image to be
- * redisplayed everywhere that it is used.
+ * Cycle through all of the instances of this image, regenerating the
+ * information for each instance. Then force the image to be redisplayed
+ * everywhere that it is used.
*/
for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
@@ -330,24 +318,24 @@ ImgBmapConfigureMaster(masterPtr, objc, objv, flags)
*
* ImgBmapConfigureInstance --
*
- * This procedure is called to create displaying information for
- * a bitmap image instance based on the configuration information
- * in the master. It is invoked both when new instances are
- * created and when the master is reconfigured.
+ * This procedure is called to create displaying information for a bitmap
+ * image instance based on the configuration information in the master.
+ * It is invoked both when new instances are created and when the master
+ * is reconfigured.
*
* Results:
* None.
*
* Side effects:
- * Generates errors via Tcl_BackgroundError if there are problems
- * in setting up the instance.
+ * Generates errors via Tcl_BackgroundError if there are problems in
+ * setting up the instance.
*
*----------------------------------------------------------------------
*/
static void
-ImgBmapConfigureInstance(instancePtr)
- BitmapInstance *instancePtr; /* Instance to reconfigure. */
+ImgBmapConfigureInstance(
+ BitmapInstance *instancePtr)/* Instance to reconfigure. */
{
BitmapMaster *masterPtr = instancePtr->masterPtr;
XColor *colorPtr;
@@ -357,8 +345,8 @@ ImgBmapConfigureInstance(instancePtr)
Pixmap oldBitmap, oldMask;
/*
- * For each of the options in masterPtr, translate the string
- * form into an internal form appropriate for instancePtr.
+ * For each of the options in masterPtr, translate the string form into an
+ * internal form appropriate for instancePtr.
*/
if (*masterPtr->bgUid != 0) {
@@ -385,9 +373,6 @@ ImgBmapConfigureInstance(instancePtr)
}
instancePtr->fg = colorPtr;
- oldMask = instancePtr->mask;
- instancePtr->mask = None;
-
/*
* Careful: We have to allocate new Pixmaps before deleting the old ones.
* Otherwise, The XID allocator will always return the same XID for the
@@ -447,11 +432,10 @@ ImgBmapConfigureInstance(instancePtr)
instancePtr->gc = gc;
return;
- error:
+ error:
/*
- * An error occurred: clear the graphics context in the instance to
- * make it clear that this instance cannot be displayed. Then report
- * the error.
+ * An error occurred: clear the graphics context in the instance to make
+ * it clear that this instance cannot be displayed. Then report the error.
*/
if (instancePtr->gc != None) {
@@ -469,17 +453,16 @@ ImgBmapConfigureInstance(instancePtr)
*
* TkGetBitmapData --
*
- * Given a file name or ASCII string, this procedure parses the
- * file or string contents to produce binary data for a bitmap.
+ * Given a file name or ASCII string, this procedure parses the file or
+ * string contents to produce binary data for a bitmap.
*
* Results:
- * If the bitmap description was parsed successfully then the
- * return value is a malloc-ed array containing the bitmap data.
- * The dimensions of the data are stored in *widthPtr and
- * *heightPtr. *hotXPtr and *hotYPtr are set to the bitmap
- * hotspot if one is defined, otherwise they are set to -1, -1.
- * If an error occurred, NULL is returned and an error message is
- * left in the interp's result.
+ * If the bitmap description was parsed successfully then the return
+ * value is a malloc-ed array containing the bitmap data. The dimensions
+ * of the data are stored in *widthPtr and *heightPtr. *hotXPtr and
+ * *hotYPtr are set to the bitmap hotspot if one is defined, otherwise
+ * they are set to -1, -1. If an error occurred, NULL is returned and an
+ * error message is left in the interp's result.
*
* Side effects:
* A bitmap is created.
@@ -488,18 +471,15 @@ ImgBmapConfigureInstance(instancePtr)
*/
char *
-TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
- hotXPtr, hotYPtr)
- Tcl_Interp *interp; /* For reporting errors, or NULL. */
- char *string; /* String describing bitmap. May
- * be NULL. */
- char *fileName; /* Name of file containing bitmap
- * description. Used only if string
- * is NULL. Must not be NULL if
- * string is NULL. */
- int *widthPtr, *heightPtr; /* Dimensions of bitmap get returned
- * here. */
- int *hotXPtr, *hotYPtr; /* Position of hot spot or -1,-1. */
+TkGetBitmapData(
+ Tcl_Interp *interp, /* For reporting errors, or NULL. */
+ char *string, /* String describing bitmap. May be NULL. */
+ char *fileName, /* Name of file containing bitmap description.
+ * Used only if string is NULL. Must not be
+ * NULL if string is NULL. */
+ int *widthPtr, int *heightPtr,
+ /* Dimensions of bitmap get returned here. */
+ int *hotXPtr, int *hotYPtr) /* Position of hot spot or -1,-1. */
{
int width, height, numBytes, hotX, hotY;
CONST char *expandedFileName;
@@ -510,11 +490,11 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
pi.string = string;
if (string == NULL) {
- if ((interp != NULL) && Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't get bitmap data from a file in a",
- " safe interpreter", (char *) NULL);
- return NULL;
- }
+ if ((interp != NULL) && Tcl_IsSafe(interp)) {
+ Tcl_AppendResult(interp, "can't get bitmap data from a file in a",
+ " safe interpreter", NULL);
+ return NULL;
+ }
expandedFileName = Tcl_TranslateFileName(interp, fileName, &buffer);
if (expandedFileName == NULL) {
return NULL;
@@ -525,29 +505,28 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
if (interp != NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't read bitmap file \"",
- fileName, "\": ", Tcl_PosixError(interp),
- (char *) NULL);
+ fileName, "\": ", Tcl_PosixError(interp), NULL);
}
return NULL;
}
-
- if (Tcl_SetChannelOption(interp, pi.chan, "-translation", "binary")
+
+ if (Tcl_SetChannelOption(interp, pi.chan, "-translation", "binary")
!= TCL_OK) {
- return NULL;
- }
- if (Tcl_SetChannelOption(interp, pi.chan, "-encoding", "binary")
+ return NULL;
+ }
+ if (Tcl_SetChannelOption(interp, pi.chan, "-encoding", "binary")
!= TCL_OK) {
- return NULL;
- }
+ return NULL;
+ }
} else {
pi.chan = NULL;
}
/*
- * Parse the lines that define the dimensions of the bitmap,
- * plus the first line that defines the bitmap data (it declares
- * the name of a data variable but doesn't include any actual
- * data). These lines look something like the following:
+ * Parse the lines that define the dimensions of the bitmap, plus the
+ * first line that defines the bitmap data (it declares the name of a data
+ * variable but doesn't include any actual data). These lines look
+ * something like the following:
*
* #define foo_width 16
* #define foo_height 16
@@ -555,9 +534,9 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
* #define foo_y_hot 3
* static char foo_bits[] = {
*
- * The x_hot and y_hot lines may or may not be present. It's
- * important to check for "char" in the last line, in order to
- * reject old X10-style bitmaps that used shorts.
+ * The x_hot and y_hot lines may or may not be present. It's important to
+ * check for "char" in the last line, in order to reject old X10-style
+ * bitmaps that used shorts.
*/
width = 0;
@@ -616,19 +595,18 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
} else if ((pi.word[0] == '{') && (pi.word[1] == 0)) {
if (interp != NULL) {
Tcl_AppendResult(interp, "format error in bitmap data; ",
- "looks like it's an obsolete X10 bitmap file",
- (char *) NULL);
+ "looks like it's an obsolete X10 bitmap file", NULL);
}
goto errorCleanup;
}
}
/*
- * Now we've read everything but the data. Allocate an array
- * and read in the data.
+ * Now we've read everything but the data. Allocate an array and read in
+ * the data.
*/
- getData:
+ getData:
if ((width <= 0) || (height <= 0)) {
goto error;
}
@@ -645,7 +623,7 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
}
/*
- * All done. Clean up and return.
+ * All done. Clean up and return.
*/
if (pi.chan != NULL) {
@@ -657,12 +635,12 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
*hotYPtr = hotY;
return data;
- error:
+ error:
if (interp != NULL) {
Tcl_SetResult(interp, "format error in bitmap data", TCL_STATIC);
}
-
- errorCleanup:
+
+ errorCleanup:
if (data != NULL) {
ckfree(data);
}
@@ -677,13 +655,13 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
*
* NextBitmapWord --
*
- * This procedure retrieves the next word of information (stuff
- * between commas or white space) from a bitmap description.
+ * This procedure retrieves the next word of information (stuff between
+ * commas or white space) from a bitmap description.
*
* Results:
- * Returns TCL_OK if all went well. In this case the next word,
- * and its length, will be availble in *parseInfoPtr. If the end
- * of the bitmap description was reached then TCL_ERROR is returned.
+ * Returns TCL_OK if all went well. In this case the next word, and its
+ * length, will be availble in *parseInfoPtr. If the end of the bitmap
+ * description was reached then TCL_ERROR is returned.
*
* Side effects:
* None.
@@ -692,9 +670,9 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
*/
static int
-NextBitmapWord(parseInfoPtr)
- ParseInfo *parseInfoPtr; /* Describes what we're reading
- * and where we are in it. */
+NextBitmapWord(
+ ParseInfo *parseInfoPtr) /* Describes what we're reading and where we
+ * are in it. */
{
char *src, *dst;
int c;
@@ -746,9 +724,9 @@ NextBitmapWord(parseInfoPtr)
*
* ImgBmapCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to an image managed by this module.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the Tcl command that corresponds
+ * to an image managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -760,15 +738,15 @@ NextBitmapWord(parseInfoPtr)
*/
static int
-ImgBmapCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about the image master. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+ImgBmapCmd(
+ ClientData clientData, /* Information about the image master. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- static CONST char *bmapOptions[] = {"cget", "configure", (char *) NULL};
+ static CONST char *bmapOptions[] = {"cget", "configure", NULL};
BitmapMaster *masterPtr = (BitmapMaster *) clientData;
- int code, index;
+ int index;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
@@ -779,33 +757,29 @@ ImgBmapCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
switch (index) {
- case 0: {
+ case 0: /* cget */
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option");
return TCL_ERROR;
}
return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
(char *) masterPtr, Tcl_GetString(objv[2]), 0);
- }
- case 1: {
+ case 1: /* configure */
if (objc == 2) {
- code = Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, (char *) NULL, 0);
+ return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
+ configSpecs, (char *) masterPtr, NULL, 0);
} else if (objc == 3) {
- code = Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
+ return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
configSpecs, (char *) masterPtr,
Tcl_GetString(objv[2]), 0);
} else {
- code = ImgBmapConfigureMaster(masterPtr, objc-2, objv+2,
+ return ImgBmapConfigureMaster(masterPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
- return code;
- }
- default: {
- panic("bad const entries to bmapOptions in ImgBmapCmd");
- }
+ default:
+ Tcl_Panic("bad const entries to bmapOptions in ImgBmapCmd");
+ return TCL_OK;
}
- return TCL_OK;
}
/*
@@ -813,33 +787,32 @@ ImgBmapCmd(clientData, interp, objc, objv)
*
* ImgBmapGet --
*
- * This procedure is called for each use of a bitmap image in a
- * widget.
+ * This procedure is called for each use of a bitmap image in a widget.
*
* Results:
- * The return value is a token for the instance, which is passed
- * back to us in calls to ImgBmapDisplay and ImgBmapFree.
+ * The return value is a token for the instance, which is passed back to
+ * us in calls to ImgBmapDisplay and ImgBmapFree.
*
* Side effects:
- * A data structure is set up for the instance (or, an existing
- * instance is re-used for the new one).
+ * A data structure is set up for the instance (or, an existing instance
+ * is re-used for the new one).
*
*----------------------------------------------------------------------
*/
static ClientData
-ImgBmapGet(tkwin, masterData)
- Tk_Window tkwin; /* Window in which the instance will be
+ImgBmapGet(
+ Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData; /* Pointer to our master structure for the
+ ClientData masterData) /* Pointer to our master structure for the
* image. */
{
BitmapMaster *masterPtr = (BitmapMaster *) masterData;
BitmapInstance *instancePtr;
/*
- * See if there is already an instance for this window. If so
- * then just re-use it.
+ * See if there is already an instance for this window. If so then just
+ * re-use it.
*/
for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
@@ -851,8 +824,8 @@ ImgBmapGet(tkwin, masterData)
}
/*
- * The image isn't already in use in this window. Make a new
- * instance of the image.
+ * The image isn't already in use in this window. Make a new instance of
+ * the image.
*/
instancePtr = (BitmapInstance *) ckalloc(sizeof(BitmapInstance));
@@ -897,24 +870,24 @@ ImgBmapGet(tkwin, masterData)
*/
static void
-ImgBmapDisplay(clientData, display, drawable, imageX, imageY, width,
- height, drawableX, drawableY)
- ClientData clientData; /* Pointer to BitmapInstance structure for
- * for instance to be displayed. */
- Display *display; /* Display on which to draw image. */
- Drawable drawable; /* Pixmap or window in which to draw image. */
- int imageX, imageY; /* Upper-left corner of region within image
- * to draw. */
- int width, height; /* Dimensions of region within image to draw. */
- int drawableX, drawableY; /* Coordinates within drawable that
- * correspond to imageX and imageY. */
+ImgBmapDisplay(
+ ClientData clientData, /* Pointer to BitmapInstance structure for
+ * instance to be displayed. */
+ Display *display, /* Display on which to draw image. */
+ Drawable drawable, /* Pixmap or window in which to draw image. */
+ int imageX, int imageY, /* Upper-left corner of region within image to
+ * draw. */
+ int width, int height, /* Dimensions of region within image to draw. */
+ int drawableX, int drawableY)
+ /* Coordinates within drawable that correspond
+ * to imageX and imageY. */
{
BitmapInstance *instancePtr = (BitmapInstance *) clientData;
int masking;
/*
- * If there's no graphics context, it means that an error occurred
- * while creating the image instance so it can't be displayed.
+ * If there's no graphics context, it means that an error occurred while
+ * creating the image instance so it can't be displayed.
*/
if (instancePtr->gc == None) {
@@ -922,10 +895,9 @@ ImgBmapDisplay(clientData, display, drawable, imageX, imageY, width,
}
/*
- * If masking is in effect, must modify the mask origin within
- * the graphics context to line up with the image's origin.
- * Then draw the image and reset the clip origin, if there's
- * a mask.
+ * If masking is in effect, must modify the mask origin within the
+ * graphics context to line up with the image's origin. Then draw the
+ * image and reset the clip origin, if there's a mask.
*/
masking = (instancePtr->mask != None) || (instancePtr->bg == NULL);
@@ -946,8 +918,8 @@ ImgBmapDisplay(clientData, display, drawable, imageX, imageY, width,
*
* ImgBmapFree --
*
- * This procedure is called when a widget ceases to use a
- * particular instance of an image.
+ * This procedure is called when a widget ceases to use a particular
+ * instance of an image.
*
* Results:
* None.
@@ -959,10 +931,10 @@ ImgBmapDisplay(clientData, display, drawable, imageX, imageY, width,
*/
static void
-ImgBmapFree(clientData, display)
- ClientData clientData; /* Pointer to BitmapInstance structure for
- * for instance to be displayed. */
- Display *display; /* Display containing window that used image. */
+ImgBmapFree(
+ ClientData clientData, /* Pointer to BitmapInstance structure for
+ * instance to be displayed. */
+ Display *display) /* Display containing window that used image. */
{
BitmapInstance *instancePtr = (BitmapInstance *) clientData;
BitmapInstance *prevPtr;
@@ -973,8 +945,8 @@ ImgBmapFree(clientData, display)
}
/*
- * There are no more uses of the image within this widget. Free
- * the instance structure.
+ * There are no more uses of the image within this widget. Free the
+ * instance structure.
*/
if (instancePtr->fg != NULL) {
@@ -1009,8 +981,8 @@ ImgBmapFree(clientData, display)
*
* ImgBmapDelete --
*
- * This procedure is called by the image code to delete the
- * master structure for an image.
+ * This procedure is called by the image code to delete the master
+ * structure for an image.
*
* Results:
* None.
@@ -1022,14 +994,14 @@ ImgBmapFree(clientData, display)
*/
static void
-ImgBmapDelete(masterData)
- ClientData masterData; /* Pointer to BitmapMaster structure for
- * image. Must not have any more instances. */
+ImgBmapDelete(
+ ClientData masterData) /* Pointer to BitmapMaster structure for
+ * image. Must not have any more instances. */
{
BitmapMaster *masterPtr = (BitmapMaster *) masterData;
if (masterPtr->instancePtr != NULL) {
- panic("tried to delete bitmap image when instances still exist");
+ Tcl_Panic("tried to delete bitmap image when instances still exist");
}
masterPtr->tkMaster = NULL;
if (masterPtr->imageCmd != NULL) {
@@ -1041,7 +1013,7 @@ ImgBmapDelete(masterData)
if (masterPtr->maskData != NULL) {
ckfree(masterPtr->maskData);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, (Display *) NULL, 0);
+ Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
ckfree((char *) masterPtr);
}
@@ -1050,8 +1022,8 @@ ImgBmapDelete(masterData)
*
* ImgBmapCmdDeletedProc --
*
- * This procedure is invoked when the image command for an image
- * is deleted. It deletes the image.
+ * This procedure is invoked when the image command for an image is
+ * deleted. It deletes the image.
*
* Results:
* None.
@@ -1063,8 +1035,8 @@ ImgBmapDelete(masterData)
*/
static void
-ImgBmapCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to BitmapMaster structure for
+ImgBmapCmdDeletedProc(
+ ClientData clientData) /* Pointer to BitmapMaster structure for
* image. */
{
BitmapMaster *masterPtr = (BitmapMaster *) clientData;
@@ -1092,8 +1064,8 @@ ImgBmapCmdDeletedProc(clientData)
*/
static int
-GetByte(chan)
- Tcl_Channel chan; /* The channel we read from. */
+GetByte(
+ Tcl_Channel chan) /* The channel we read from. */
{
char buffer;
int size;
@@ -1112,29 +1084,28 @@ GetByte(chan)
*
* ImgBmapPsImagemask --
*
- * This procedure generates postscript suitable for rendering a
- * single bitmap of an image. A single bitmap image might contain both
- * a foreground and a background bitmap. This routine is called once
- * for each such bitmap in a bitmap image.
+ * This procedure generates postscript suitable for rendering a single
+ * bitmap of an image. A single bitmap image might contain both a
+ * foreground and a background bitmap. This routine is called once for
+ * each such bitmap in a bitmap image.
*
- * Prior to invoking this routine, the following setup has occurred:
+ * Prior to invoking this routine, the following setup has occurred:
*
- * 1. The postscript foreground color has been set to the color
- * used to render the bitmap.
+ * 1. The postscript foreground color has been set to the color used
+ * to render the bitmap.
*
- * 2. The origin of the postscript coordinate system is set to
- * the lower left corner of the bitmap.
+ * 2. The origin of the postscript coordinate system is set to the
+ * lower left corner of the bitmap.
*
- * 3. The postscript coordinate system has been scaled so that
- * the entire bitmap is one unit squared.
+ * 3. The postscript coordinate system has been scaled so that the
+ * entire bitmap is one unit squared.
*
- * Some postscript implementations cannot handle bitmap strings
- * longer than about 60k characters. If the bitmap data is that big
- * or bigger, then we render it by splitting it into several smaller
- * bitmaps.
+ * Some postscript implementations cannot handle bitmap strings longer
+ * than about 60k characters. If the bitmap data is that big or bigger,
+ * then we render it by splitting it into several smaller bitmaps.
*
* Results:
- * Returns TCL_OK on success. Returns TCL_ERROR and leaves and error
+ * Returns TCL_OK on success. Returns TCL_ERROR and leaves and error
* message in interp->result if there is a problem.
*
* Side effects:
@@ -1144,21 +1115,22 @@ GetByte(chan)
*/
static int
-ImgBmapPsImagemask(interp, width, height, data)
- Tcl_Interp *interp; /* Append postscript to this interpreter */
- int width, height; /* Width and height of the bitmap in pixels */
- char *data; /* Data for the bitmap */
+ImgBmapPsImagemask(
+ Tcl_Interp *interp, /* Append postscript to this interpreter */
+ int width, int height, /* Width and height of the bitmap in pixels */
+ char *data) /* Data for the bitmap */
{
int i, j, nBytePerRow;
char buffer[200];
- /*
+ /*
* The bit order of bitmaps in Tk is the opposite of the bit order that
- * postscript uses. (In Tk, the least significant bit is on the right
- * side of the bitmap and in postscript the least significant bit is shown
- * on the left.) The following array is used to reverse the order of bits
+ * postscript uses. (In Tk, the least significant bit is on the right side
+ * of the bitmap and in postscript the least significant bit is shown on
+ * the left.) The following array is used to reverse the order of bits
* within a byte so that the bits will be in the order postscript expects.
*/
+
static unsigned char bit_reverse[] = {
0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
@@ -1184,17 +1156,21 @@ ImgBmapPsImagemask(interp, width, height, data)
"larger than 60000 pixels", NULL);
return TCL_ERROR;
}
+
sprintf(buffer, "0 0 moveto %d %d true [%d 0 0 %d 0 %d] {<\n",
- width, height, width, -height, height);
+ width, height, width, -height, height);
Tcl_AppendResult(interp, buffer, NULL);
+
nBytePerRow = (width+7)/8;
for(i=0; i<height; i++){
- for(j=0; j<nBytePerRow; j++){
- sprintf(buffer, " %02x", bit_reverse[0xff & data[i*nBytePerRow + j]]);
- Tcl_AppendResult(interp, buffer, NULL);
- }
- Tcl_AppendResult(interp, "\n", NULL);
+ for(j=0; j<nBytePerRow; j++){
+ sprintf(buffer, " %02x",
+ bit_reverse[0xff & data[i*nBytePerRow + j]]);
+ Tcl_AppendResult(interp, buffer, NULL);
+ }
+ Tcl_AppendResult(interp, "\n", NULL);
}
+
Tcl_AppendResult(interp, ">} imagemask \n", NULL);
return TCL_OK;
}
@@ -1207,9 +1183,10 @@ ImgBmapPsImagemask(interp, width, height, data)
* This procedure generates postscript for rendering a bitmap image.
*
* Results:
+
* On success, this routine writes postscript code into interp->result
- * and returns TCL_OK TCL_ERROR is returned and an error
- * message is left in interp->result if anything goes wrong.
+ * and returns TCL_OK TCL_ERROR is returned and an error message is left
+ * in interp->result if anything goes wrong.
*
* Side effects:
* None.
@@ -1218,13 +1195,13 @@ ImgBmapPsImagemask(interp, width, height, data)
*/
static int
-ImgBmapPostscript(clientData, interp, tkwin, psinfo, x, y, width, height,
- prepass)
- ClientData clientData;
- Tcl_Interp *interp;
- Tk_Window tkwin;
- Tk_PostscriptInfo psinfo;
- int x, y, width, height, prepass;
+ImgBmapPostscript(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tk_PostscriptInfo psinfo,
+ int x, int y, int width, int height,
+ int prepass)
{
BitmapMaster *masterPtr = (BitmapMaster *) clientData;
char buffer[200];
@@ -1234,38 +1211,42 @@ ImgBmapPostscript(clientData, interp, tkwin, psinfo, x, y, width, height,
}
/*
- * There is nothing to do for bitmaps with zero width or height
+ * There is nothing to do for bitmaps with zero width or height.
*/
- if( width<=0 || height<=0 || masterPtr->width<=0 || masterPtr->height<=0 ){
+
+ if (width<=0 || height<=0 || masterPtr->width<=0 || masterPtr->height<= 0){
return TCL_OK;
}
/*
* Translate the origin of the coordinate system to be the lower-left
- * corner of the bitmap and adjust the scale of the coordinate system
- * so that entire bitmap covers one square unit of the page.
- * The calling function put a "gsave" into the postscript and
- * will add a "grestore" at after this routine returns, so it is safe
- * to make whatever changes are necessary here.
+ * corner of the bitmap and adjust the scale of the coordinate system so
+ * that entire bitmap covers one square unit of the page. The calling
+ * function put a "gsave" into the postscript and will add a "grestore" at
+ * after this routine returns, so it is safe to make whatever changes are
+ * necessary here.
*/
- if( x!=0 || y!=0 ){
+
+ if (x!=0 || y!=0) {
sprintf(buffer, "%d %d moveto\n", x, y);
Tcl_AppendResult(interp, buffer, NULL);
}
- if( width!=1 || height!=1 ){
+ if (width!=1 || height!=1) {
sprintf(buffer, "%d %d scale\n", width, height);
Tcl_AppendResult(interp, buffer, NULL);
}
/*
- * Color the background, if there is one. This step is skipped if the
- * background is transparent. If the background is not transparent and
+ * Color the background, if there is one. This step is skipped if the
+ * background is transparent. If the background is not transparent and
* there is no background mask, then color the complete rectangle that
- * encloses the bitmap. If there is a background mask, then only apply
+ * encloses the bitmap. If there is a background mask, then only apply
* color to the bits specified by the mask.
*/
+
if ((masterPtr->bgUid != NULL) && (masterPtr->bgUid[0] != '\000')) {
XColor color;
+
XParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->bgUid,
&color);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1273,10 +1254,10 @@ ImgBmapPostscript(clientData, interp, tkwin, psinfo, x, y, width, height,
}
if (masterPtr->maskData == NULL) {
Tcl_AppendResult(interp,
- "0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto "
- "closepath fill\n", NULL);
+ "0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto ",
+ "closepath fill\n", NULL);
} else if (ImgBmapPsImagemask(interp, masterPtr->width,
- masterPtr->height, masterPtr->maskData) != TCL_OK) {
+ masterPtr->height, masterPtr->maskData) != TCL_OK) {
return TCL_ERROR;
}
}
@@ -1284,8 +1265,10 @@ ImgBmapPostscript(clientData, interp, tkwin, psinfo, x, y, width, height,
/*
* Draw the bitmap foreground, assuming there is one.
*/
- if ( (masterPtr->fgUid != NULL) && (masterPtr->data != NULL) ) {
+
+ if ((masterPtr->fgUid != NULL) && (masterPtr->data != NULL)) {
XColor color;
+
XParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->fgUid,
&color);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1298,3 +1281,11 @@ ImgBmapPostscript(clientData, interp, tkwin, psinfo, x, y, width, height,
}
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index bbb3178..e576559 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -1,20 +1,20 @@
/*
* tkImgGIF.c --
*
- * A photo image file handler for GIF files. Reads 87a and 89a GIF
- * files. At present, there only is a file write function. GIF images
- * may be read using the -data option of the photo image. The data may be
- * given as a binary string in a Tcl_Obj or by representing
- * the data as BASE64 encoded ascii. Derived from the giftoppm code
- * found in the pbmplus package and tkImgFmtPPM.c in the tk4.0b2
- * distribution.
+ * A photo image file handler for GIF files. Reads 87a and 89a GIF files.
+ * At present, there only is a file write function. GIF images may be
+ * read using the -data option of the photo image. The data may be given
+ * as a binary string in a Tcl_Obj or by representing the data as BASE64
+ * encoded ascii. Derived from the giftoppm code found in the pbmplus
+ * package and tkImgFmtPPM.c in the tk4.0b2 distribution.
*
* Copyright (c) Reed Wade (wade@cs.utk.edu), University of Tennessee
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1997 Australian National University
+ * Copyright (c) 2005 Donal K. Fellows
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* This file also contains code from the giftoppm program, which is
* copyrighted as follows:
@@ -25,18 +25,22 @@
* | and its documentation for any purpose and without fee is hereby |
* | granted, provided that the above copyright notice appear in all |
* | copies and that both that copyright notice and this permission |
- * | notice appear in supporting documentation. This software is |
+ * | notice appear in supporting documentation. This software is |
* | provided "as is" without express or implied warranty. |
- * +-------------------------------------------------------------------+
+ * +--------------------------------------------------------------------+
+ *
+ * This file also contains code from miGIF. See lower down in file for the
+ * applicable copyright notice for that portion.
*/
+#include "tkInt.h"
+
/*
- * GIF's are represented as data in base64 format.
- * base64 strings consist of 4 6-bit characters -> 3 8 bit bytes.
- * A-Z, a-z, 0-9, + and / represent the 64 values (in order).
- * '=' is a trailing padding char when the un-encoded data is not a
- * multiple of 3 bytes. We'll ignore white space when encountered.
- * Any other invalid character is treated as an EOF
+ * GIF's are represented as data in either binary or base64 format. base64
+ * strings consist of 4 6-bit characters -> 3 8 bit bytes. A-Z, a-z, 0-9, +
+ * and / represent the 64 values (in order). '=' is a trailing padding char
+ * when the un-encoded data is not a multiple of 3 bytes. We'll ignore white
+ * space when encountered. Any other invalid character is treated as an EOF
*/
#define GIF_SPECIAL (256)
@@ -46,77 +50,86 @@
#define GIF_DONE (GIF_SPECIAL+4)
/*
- * structure to "mimic" FILE for Mread, so we can look like fread.
- * The decoder state keeps track of which byte we are about to read,
- * or EOF.
+ * structure to "mimic" FILE for Mread, so we can look like fread. The decoder
+ * state keeps track of which byte we are about to read, or EOF.
*/
typedef struct mFile {
unsigned char *data; /* mmencoded source string */
- int length; /* Length of string in bytes */
int c; /* bits left over from previous character */
int state; /* decoder state (0-4 or GIF_DONE) */
+ int length; /* Total amount of bytes in data */
} MFile;
-#include "tkInt.h"
-#include "tkPort.h"
-
/*
* Non-ASCII encoding support:
- * Most data in a GIF image is binary and is treated as such. However,
- * a few key bits are stashed in ASCII. If we try to compare those pieces
- * to the char they represent, it will fail on any non-ASCII (eg, EBCDIC)
- * system. To accomodate these systems, we test against the numeric value
- * of the ASCII characters instead of the characters themselves. This is
- * encoding independant.
+ * Most data in a GIF image is binary and is treated as such. However, a few
+ * key bits are stashed in ASCII. If we try to compare those pieces to the
+ * char they represent, it will fail on any non-ASCII (eg, EBCDIC) system. To
+ * accomodate these systems, we test against the numeric value of the ASCII
+ * characters instead of the characters themselves. This is encoding
+ * independant.
*/
-static CONST char GIF87a[] = { /* ASCII GIF87a */
+static const char GIF87a[] = { /* ASCII GIF87a */
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x00
};
-static CONST char GIF89a[] = { /* ASCII GIF89a */
+static const char GIF89a[] = { /* ASCII GIF89a */
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x00
};
-# define GIF_TERMINATOR 0x3b /* ASCII ; */
-# define GIF_EXTENSION 0x21 /* ASCII ! */
-# define GIF_START 0x2c /* ASCII , */
+#define GIF_TERMINATOR 0x3b /* ASCII ; */
+#define GIF_EXTENSION 0x21 /* ASCII ! */
+#define GIF_START 0x2c /* ASCII , */
/*
- * HACK ALERT!! HACK ALERT!! HACK ALERT!!
- * This code is hard-wired for reading from files. In order to read
- * from a data stream, we'll trick fread so we can reuse the same code.
- * 0==from file; 1==from base64 encoded data; 2==from binary data
+ * Flags used to notify that we've got inline data instead of a file to read
+ * from. Note that we need to figure out which type of inline data we've got
+ * before handing off to the GIF reading code; this is done in StringReadGIF.
*/
-typedef struct ThreadSpecificData {
- int fromData;
-} ThreadSpecificData;
-static Tcl_ThreadDataKey dataKey;
+#define INLINE_DATA_BINARY ((const char *) 0x01)
+#define INLINE_DATA_BASE64 ((const char *) 0x02)
+
+/*
+ * HACK ALERT!! HACK ALERT!! HACK ALERT!!
+ * This code is hard-wired for reading from files. In order to read from a
+ * data stream, we'll trick fread so we can reuse the same code. 0==from file;
+ * 1==from base64 encoded data; 2==from binary data
+ */
+
+typedef struct {
+ const char *fromData;
+ unsigned char workingBuffer[280];
+ struct {
+ int bytes;
+ int done;
+ unsigned int window;
+ int bitsInWindow;
+ unsigned char *c;
+ } reader;
+} GIFImageConfig;
/*
* The format record for the GIF file format:
*/
-static int FileMatchGIF _ANSI_ARGS_((Tcl_Channel chan, CONST char *fileName,
- Tcl_Obj *format, int *widthPtr, int *heightPtr,
- Tcl_Interp *interp));
-static int FileReadGIF _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format,
- Tk_PhotoHandle imageHandle, int destX, int destY,
- int width, int height, int srcX, int srcY));
-static int StringMatchGIF _ANSI_ARGS_(( Tcl_Obj *dataObj,
- Tcl_Obj *format, int *widthPtr, int *heightPtr,
- Tcl_Interp *interp));
-static int StringReadGIF _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *dataObj,
- Tcl_Obj *format, Tk_PhotoHandle imageHandle,
- int destX, int destY, int width, int height,
- int srcX, int srcY));
-static int FileWriteGIF _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *filename, Tcl_Obj *format,
- Tk_PhotoImageBlock *blockPtr));
-static int CommonWriteGIF _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel handle, Tcl_Obj *format,
- Tk_PhotoImageBlock *blockPtr));
+static int FileMatchGIF(Tcl_Channel chan, const char *fileName,
+ Tcl_Obj *format, int *widthPtr, int *heightPtr,
+ Tcl_Interp *interp);
+static int FileReadGIF(Tcl_Interp *interp, Tcl_Channel chan,
+ const char *fileName, Tcl_Obj *format,
+ Tk_PhotoHandle imageHandle, int destX, int destY,
+ int width, int height, int srcX, int srcY);
+static int StringMatchGIF(Tcl_Obj *dataObj, Tcl_Obj *format,
+ int *widthPtr, int *heightPtr, Tcl_Interp *interp);
+static int StringReadGIF(Tcl_Interp *interp, Tcl_Obj *dataObj,
+ Tcl_Obj *format, Tk_PhotoHandle imageHandle,
+ int destX, int destY, int width, int height,
+ int srcX, int srcY);
+static int FileWriteGIF(Tcl_Interp *interp, const char *filename,
+ Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr);
+static int CommonWriteGIF(Tcl_Interp *interp, Tcl_Channel handle,
+ Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr);
Tk_PhotoImageFormat tkImgFmtGIF = {
"gif", /* name */
@@ -138,54 +151,53 @@ Tk_PhotoImageFormat tkImgFmtGIF = {
#define CM_ALPHA 3
#define MAX_LWZ_BITS 12
#define LM_to_uint(a,b) (((b)<<8)|(a))
-#define ReadOK(file,buffer,len) (Fread(buffer, len, 1, file) != 0)
/*
- * Prototypes for local procedures defined in this file:
+ * Prototypes for local functions defined in this file:
*/
-static int DoExtension _ANSI_ARGS_((Tcl_Channel chan, int label,
- int *transparent));
-static int GetCode _ANSI_ARGS_((Tcl_Channel chan, int code_size,
- int flag));
-static int GetDataBlock _ANSI_ARGS_((Tcl_Channel chan,
- unsigned char *buf));
-static int ReadColorMap _ANSI_ARGS_((Tcl_Channel chan, int number,
- unsigned char buffer[MAXCOLORMAPSIZE][4]));
-static int ReadGIFHeader _ANSI_ARGS_((Tcl_Channel chan,
- int *widthPtr, int *heightPtr));
-static int ReadImage _ANSI_ARGS_((Tcl_Interp *interp,
- char *imagePtr, Tcl_Channel chan,
- int len, int rows,
- unsigned char cmap[MAXCOLORMAPSIZE][4],
- int width, int height, int srcX, int srcY,
- int interlace, int transparent));
+static int DoExtension(GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan, int label, unsigned char *buffer,
+ int *transparent);
+static int GetCode(Tcl_Channel chan, int code_size, int flag,
+ GIFImageConfig *gifConfPtr);
+static int GetDataBlock(GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan, unsigned char *buf);
+static int ReadColorMap(GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan, int number,
+ unsigned char buffer[MAXCOLORMAPSIZE][4]);
+static int ReadGIFHeader(GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan, int *widthPtr, int *heightPtr);
+static int ReadImage(GIFImageConfig *gifConfPtr,
+ Tcl_Interp *interp, unsigned char *imagePtr,
+ Tcl_Channel chan, int len, int rows,
+ unsigned char cmap[MAXCOLORMAPSIZE][4], int srcX,
+ int srcY, int interlace, int transparent);
/*
* these are for the BASE64 image reader code only
*/
-static int Fread _ANSI_ARGS_((unsigned char *dst, size_t size,
- size_t count, Tcl_Channel chan));
-static int Mread _ANSI_ARGS_((unsigned char *dst, size_t size,
- size_t count, MFile *handle));
-static int Mgetc _ANSI_ARGS_((MFile *handle));
-static int char64 _ANSI_ARGS_((int c));
-static void mInit _ANSI_ARGS_((unsigned char *string,
- int length, MFile *handle));
-
+static int Fread(GIFImageConfig *gifConfPtr, unsigned char *dst,
+ size_t size, size_t count, Tcl_Channel chan);
+static int Mread(unsigned char *dst, size_t size, size_t count,
+ MFile *handle);
+static int Mgetc(MFile *handle);
+static int char64(int c);
+static void mInit(unsigned char *string, MFile *handle,
+ int length);
/*
*----------------------------------------------------------------------
*
* FileMatchGIF --
*
- * This procedure is invoked by the photo image type to see if
- * a file contains image data in GIF format.
+ * This function is invoked by the photo image type to see if a file
+ * contains image data in GIF format.
*
* Results:
- * The return value is 1 if the first characters in file f look
- * like GIF data, and 0 otherwise.
+ * The return value is 1 if the first characters in file f look like GIF
+ * data, and 0 otherwise.
*
* Side effects:
* The access position in f may change.
@@ -194,16 +206,19 @@ static void mInit _ANSI_ARGS_((unsigned char *string,
*/
static int
-FileMatchGIF(chan, fileName, format, widthPtr, heightPtr, interp)
- Tcl_Channel chan; /* The image file, open for reading. */
- CONST char *fileName; /* The name of the image file. */
- Tcl_Obj *format; /* User-specified format object, or NULL. */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here if the file is a valid
- * raw GIF file. */
- Tcl_Interp *interp; /* not used */
+FileMatchGIF(
+ Tcl_Channel chan, /* The image file, open for reading. */
+ const char *fileName, /* The name of the image file. */
+ Tcl_Obj *format, /* User-specified format object, or NULL. */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here if the file is a valid raw GIF file. */
+ Tcl_Interp *interp) /* not used */
{
- return ReadGIFHeader(chan, widthPtr, heightPtr);
+ GIFImageConfig gifConf;
+
+ memset(&gifConf, 0, sizeof(GIFImageConfig));
+ return ReadGIFHeader(&gifConf, chan, widthPtr, heightPtr);
}
/*
@@ -211,88 +226,108 @@ FileMatchGIF(chan, fileName, format, widthPtr, heightPtr, interp)
*
* FileReadGIF --
*
- * This procedure is called by the photo image type to read
- * GIF format data from a file and write it into a given
- * photo image.
+ * This function is called by the photo image type to read GIF format
+ * data from a file and write it into a given photo image.
*
* Results:
- * A standard TCL completion code. If TCL_ERROR is returned
- * then an error message is left in the interp's result.
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
*
* Side effects:
- * The access position in file f is changed, and new data is
- * added to the image given by imageHandle.
+ * The access position in file f is changed, and new data is added to the
+ * image given by imageHandle.
*
*----------------------------------------------------------------------
*/
static int
-FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY,
- width, height, srcX, srcY)
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- Tcl_Channel chan; /* The image file, open for reading. */
- CONST char *fileName; /* The name of the image file. */
- Tcl_Obj *format; /* User-specified format object, or NULL. */
- Tk_PhotoHandle imageHandle; /* The photo image to write into. */
- int destX, destY; /* Coordinates of top-left pixel in
- * photo image to be written to. */
- int width, height; /* Dimensions of block of photo image to
- * be written to. */
- int srcX, srcY; /* Coordinates of top-left pixel to be used
- * in image being read. */
+FileReadGIF(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Channel chan, /* The image file, open for reading. */
+ const char *fileName, /* The name of the image file. */
+ Tcl_Obj *format, /* User-specified format object, or NULL. */
+ Tk_PhotoHandle imageHandle, /* The photo image to write into. */
+ int destX, int destY, /* Coordinates of top-left pixel in photo
+ * image to be written to. */
+ int width, int height, /* Dimensions of block of photo image to be
+ * written to. */
+ int srcX, int srcY) /* Coordinates of top-left pixel to be used in
+ * image being read. */
{
int fileWidth, fileHeight, imageWidth, imageHeight;
- int nBytes, index = 0, argc = 0, i;
+ int nBytes, index = 0, argc = 0, i, result = TCL_ERROR;
Tcl_Obj **objv;
- Tk_PhotoImageBlock block;
unsigned char buf[100];
unsigned char *trashBuffer = NULL;
int bitPixel;
unsigned char colorMap[MAXCOLORMAPSIZE][4];
int transparent = -1;
- static CONST char *optionStrings[] = {
- "-index", NULL
+ static const char *optionStrings[] = {
+ "-index", NULL
};
+ GIFImageConfig gifConf, *gifConfPtr = &gifConf;
+
+ /*
+ * Decode the magic used to convey when we're sourcing data from a string
+ * source and not a file.
+ */
+
+ memset(gifConfPtr, 0, sizeof(GIFImageConfig));
+ if (fileName == INLINE_DATA_BINARY || fileName == INLINE_DATA_BASE64) {
+ gifConfPtr->fromData = fileName;
+ fileName = "inline data";
+ }
+
+ /*
+ * Parse the format string to get options.
+ */
if (format && Tcl_ListObjGetElements(interp, format,
&argc, &objv) != TCL_OK) {
return TCL_ERROR;
}
for (i = 1; i < argc; i++) {
- if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option name", 0,
- &nBytes) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option name",
+ 0, &nBytes) != TCL_OK) {
return TCL_ERROR;
}
if (i == (argc-1)) {
Tcl_AppendResult(interp, "no value given for \"",
- Tcl_GetStringFromObj(objv[i], NULL),
- "\" option", (char *) NULL);
+ Tcl_GetString(objv[i]), "\" option", NULL);
return TCL_ERROR;
}
if (Tcl_GetIntFromObj(interp, objv[++i], &index) != TCL_OK) {
return TCL_ERROR;
}
}
- if (!ReadGIFHeader(chan, &fileWidth, &fileHeight)) {
- Tcl_AppendResult(interp, "couldn't read GIF header from file \"",
+
+ /*
+ * Read the GIF file header and check for some sanity.
+ */
+
+ if (!ReadGIFHeader(gifConfPtr, chan, &fileWidth, &fileHeight)) {
+ Tcl_AppendResult(interp, "couldn't read GIF header from file \"",
fileName, "\"", NULL);
return TCL_ERROR;
}
if ((fileWidth <= 0) || (fileHeight <= 0)) {
Tcl_AppendResult(interp, "GIF image file \"", fileName,
- "\" has dimension(s) <= 0", (char *) NULL);
+ "\" has dimension(s) <= 0", NULL);
return TCL_ERROR;
}
- if (Fread(buf, 1, 3, chan) != 3) {
+ /*
+ * Get the general colormap information.
+ */
+
+ if (Fread(gifConfPtr, buf, 1, 3, chan) != 3) {
return TCL_OK;
}
- bitPixel = 2<<(buf[0]&0x07);
+ bitPixel = 2 << (buf[0] & 0x07);
if (BitSet(buf[0], LOCALCOLORMAP)) { /* Global Colormap */
- if (!ReadColorMap(chan, bitPixel, colorMap)) {
- Tcl_AppendResult(interp, "error reading color map",
- (char *) NULL);
+ if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) {
+ Tcl_AppendResult(interp, "error reading color map", NULL);
return TCL_ERROR;
}
}
@@ -308,85 +343,87 @@ FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY,
return TCL_OK;
}
- Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+ /*
+ * Make sure we have enough space in the photo image to hold the data from
+ * the GIF.
+ */
+
+ if (Tk_PhotoExpand(interp, imageHandle,
+ destX + width, destY + height) != TCL_OK) {
+ return TCL_ERROR;
+ }
- block.width = width;
- block.height = height;
- block.pixelSize = 4;
- block.pitch = block.pixelSize * block.width;
- block.offset[0] = 0;
- block.offset[1] = 1;
- block.offset[2] = 2;
- block.offset[3] = 3;
- block.pixelPtr = NULL;
+ /*
+ * Search for the frame from the GIF to display.
+ */
while (1) {
- if (Fread(buf, 1, 1, chan) != 1) {
+ if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) {
/*
* Premature end of image.
*/
- Tcl_AppendResult(interp,"premature end of image data for this index",
- (char *) NULL);
+ Tcl_AppendResult(interp,
+ "premature end of image data for this index", NULL);
goto error;
}
- if (buf[0] == GIF_TERMINATOR) {
- /*
- * GIF terminator.
- */
-
- Tcl_AppendResult(interp,"no image data for this index",
- (char *) NULL);
+ switch (buf[0]) {
+ case GIF_TERMINATOR:
+ Tcl_AppendResult(interp, "no image data for this index", NULL);
goto error;
- }
- if (buf[0] == GIF_EXTENSION) {
+ case GIF_EXTENSION:
/*
* This is a GIF extension.
*/
- if (Fread(buf, 1, 1, chan) != 1) {
+ if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) {
Tcl_SetResult(interp,
"error reading extension function code in GIF image",
TCL_STATIC);
goto error;
}
- if (DoExtension(chan, buf[0], &transparent) < 0) {
+ if (DoExtension(gifConfPtr, chan, buf[0],
+ gifConfPtr->workingBuffer, &transparent) < 0) {
Tcl_SetResult(interp, "error reading extension in GIF image",
TCL_STATIC);
goto error;
}
continue;
- }
-
- if (buf[0] != GIF_START) {
+ case GIF_START:
+ if (Fread(gifConfPtr, buf, 1, 9, chan) != 9) {
+ Tcl_SetResult(interp,
+ "couldn't read left/top/width/height in GIF image",
+ TCL_STATIC);
+ goto error;
+ }
+ break;
+ default:
/*
* Not a valid start character; ignore it.
*/
- continue;
- }
- if (Fread(buf, 1, 9, chan) != 9) {
- Tcl_SetResult(interp,
- "couldn't read left/top/width/height in GIF image",
- TCL_STATIC);
- goto error;
+ continue;
}
- imageWidth = LM_to_uint(buf[4],buf[5]);
- imageHeight = LM_to_uint(buf[6],buf[7]);
+ /*
+ * We've read the header for a GIF frame. Work out what we are going
+ * to do about it.
+ */
- bitPixel = 1<<((buf[8]&0x07)+1);
+ imageWidth = LM_to_uint(buf[4], buf[5]);
+ imageHeight = LM_to_uint(buf[6], buf[7]);
+ bitPixel = 1 << ((buf[8] & 0x07) + 1);
if (index--) {
/*
- * This is not the image we want to read: skip it.
+ * This is not the GIF frame we want to read: skip it.
*/
+
if (BitSet(buf[8], LOCALCOLORMAP)) {
- if (!ReadColorMap(chan, bitPixel, colorMap)) {
- Tcl_AppendResult(interp,
- "error reading color map", (char *) NULL);
+ if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) {
+ Tcl_AppendResult(interp, "error reading color map", NULL);
goto error;
}
}
@@ -394,113 +431,126 @@ FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY,
/*
* If we've not yet allocated a trash buffer, do so now.
*/
+
if (trashBuffer == NULL) {
nBytes = fileWidth * fileHeight * 3;
- trashBuffer =
- (unsigned char *) ckalloc((unsigned int) nBytes);
+ trashBuffer = (unsigned char *) ckalloc((unsigned) nBytes);
}
/*
- * Slurp! Process the data for this image and stuff it in
- * a trash buffer.
+ * Slurp! Process the data for this image and stuff it in a trash
+ * buffer.
*
- * Yes, it might be more efficient here to *not* store the
- * data (we're just going to throw it away later).
- * However, I elected to implement it this way for good
- * reasons. First, I wanted to avoid duplicating the
- * (fairly complex) LWZ decoder in ReadImage. Fine, you
- * say, why didn't you just modify it to allow the use of
- * a NULL specifier for the output buffer? I tried that,
- * but it negatively impacted the performance of what I
- * think will be the common case: reading the first image
- * in the file. Rather than marginally improve the speed
- * of the less frequent case, I chose to maintain high
- * performance for the common case.
+ * Yes, it might be more efficient here to *not* store the data
+ * (we're just going to throw it away later). However, I elected
+ * to implement it this way for good reasons. First, I wanted to
+ * avoid duplicating the (fairly complex) LWZ decoder in
+ * ReadImage. Fine, you say, why didn't you just modify it to
+ * allow the use of a NULL specifier for the output buffer? I
+ * tried that, but it negatively impacted the performance of what
+ * I think will be the common case: reading the first image in the
+ * file. Rather than marginally improve the speed of the less
+ * frequent case, I chose to maintain high performance for the
+ * common case.
*/
- if (ReadImage(interp, (char *) trashBuffer, chan, imageWidth,
- imageHeight, colorMap, 0, 0, 0, 0, 0, -1) != TCL_OK) {
+
+ if (ReadImage(gifConfPtr, interp, trashBuffer, chan, imageWidth,
+ imageHeight, colorMap, 0, 0, 0, -1) != TCL_OK) {
goto error;
}
continue;
}
+ break;
+ }
- if (BitSet(buf[8], LOCALCOLORMAP)) {
- if (!ReadColorMap(chan, bitPixel, colorMap)) {
- Tcl_AppendResult(interp, "error reading color map",
- (char *) NULL);
- goto error;
- }
- }
+ /*
+ * Found the frame we want to read. Next, check for a local color map for
+ * this frame.
+ */
- index = LM_to_uint(buf[0],buf[1]);
- srcX -= index;
- if (srcX<0) {
- destX -= srcX; width += srcX;
- srcX = 0;
+ if (BitSet(buf[8], LOCALCOLORMAP)) {
+ if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) {
+ Tcl_AppendResult(interp, "error reading color map", NULL);
+ goto error;
}
+ }
- if (width > imageWidth) {
- width = imageWidth;
- }
+ /*
+ * Extract the location within the overall visible image to put the data
+ * in this frame, together with the size of this frame.
+ */
- index = LM_to_uint(buf[2],buf[3]);
- srcY -= index;
- if (index > srcY) {
- destY -= srcY; height += srcY;
- srcY = 0;
- }
- if (height > imageHeight) {
- height = imageHeight;
- }
+ index = LM_to_uint(buf[0], buf[1]);
+ srcX -= index;
+ if (srcX<0) {
+ destX -= srcX; width += srcX;
+ srcX = 0;
+ }
- if ((width <= 0) || (height <= 0)) {
- block.pixelPtr = 0;
- goto noerror;
- }
+ if (width > imageWidth) {
+ width = imageWidth;
+ }
+
+ index = LM_to_uint(buf[2], buf[3]);
+ srcY -= index;
+ if (index > srcY) {
+ destY -= srcY; height += srcY;
+ srcY = 0;
+ }
+ if (height > imageHeight) {
+ height = imageHeight;
+ }
+
+ if ((width > 0) && (height > 0)) {
+ Tk_PhotoImageBlock block;
+
+ /*
+ * Read the data and put it into the photo buffer for display by the
+ * general image machinery.
+ */
block.width = width;
block.height = height;
block.pixelSize = (transparent>=0) ? 4 : 3;
+ block.offset[0] = 0;
+ block.offset[1] = 1;
+ block.offset[2] = 2;
block.offset[3] = (transparent>=0) ? 3 : 0;
block.pitch = block.pixelSize * imageWidth;
nBytes = block.pitch * imageHeight;
block.pixelPtr = (unsigned char *) ckalloc((unsigned) nBytes);
- if (ReadImage(interp, (char *) block.pixelPtr, chan, imageWidth,
- imageHeight, colorMap, fileWidth, fileHeight, srcX, srcY,
- BitSet(buf[8], INTERLACE), transparent) != TCL_OK) {
+ if (ReadImage(gifConfPtr, interp, block.pixelPtr, chan, imageWidth,
+ imageHeight, colorMap, srcX, srcY, BitSet(buf[8],INTERLACE),
+ transparent) != TCL_OK) {
+ ckfree((char *) block.pixelPtr);
goto error;
}
- break;
+ if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
+ width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
+ ckfree((char *) block.pixelPtr);
+ goto error;
+ }
+ ckfree((char *) block.pixelPtr);
}
- Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, height,
- TK_PHOTO_COMPOSITE_SET);
-
- noerror:
/*
- * If a trash buffer has been allocated, free it now.
+ * We've successfully read the GIF frame (or there was nothing to read,
+ * which suits as well). We're done.
*/
- if (trashBuffer != NULL) {
- ckfree((char *)trashBuffer);
- }
- if (block.pixelPtr) {
- ckfree((char *) block.pixelPtr);
- }
- Tcl_AppendResult(interp, tkImgFmtGIF.name, (char *) NULL);
- return TCL_OK;
- error:
+ Tcl_AppendResult(interp, tkImgFmtGIF.name, NULL);
+ result = TCL_OK;
+
+ error:
/*
* If a trash buffer has been allocated, free it now.
*/
+
if (trashBuffer != NULL) {
- ckfree((char *)trashBuffer);
- }
- if (block.pixelPtr) {
- ckfree((char *) block.pixelPtr);
+ ckfree((char *) trashBuffer);
}
- return TCL_ERROR;
+ return result;
}
/*
@@ -508,26 +558,26 @@ FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY,
*
* StringMatchGIF --
*
- * This procedure is invoked by the photo image type to see if
- * an object contains image data in GIF format.
+ * This function is invoked by the photo image type to see if an object
+ * contains image data in GIF format.
*
* Results:
- * The return value is 1 if the first characters in the data are
- * like GIF data, and 0 otherwise.
+ * The return value is 1 if the first characters in the data are like GIF
+ * data, and 0 otherwise.
*
* Side effects:
- * the size of the image is placed in widthPre and heightPtr.
+ * The size of the image is placed in widthPtr and heightPtr.
*
*----------------------------------------------------------------------
*/
static int
-StringMatchGIF(dataObj, format, widthPtr, heightPtr, interp)
- Tcl_Obj *dataObj; /* the object containing the image data */
- Tcl_Obj *format; /* the image format object, or NULL */
- int *widthPtr; /* where to put the string width */
- int *heightPtr; /* where to put the string height */
- Tcl_Interp *interp; /* not used */
+StringMatchGIF(
+ Tcl_Obj *dataObj, /* the object containing the image data */
+ Tcl_Obj *format, /* the image format object, or NULL */
+ int *widthPtr, /* where to put the string width */
+ int *heightPtr, /* where to put the string height */
+ Tcl_Interp *interp) /* not used */
{
unsigned char *data, header[10];
int got, length;
@@ -538,6 +588,7 @@ StringMatchGIF(dataObj, format, widthPtr, heightPtr, interp)
/*
* Header is a minimum of 10 bytes.
*/
+
if (length < 10) {
return 0;
}
@@ -546,97 +597,99 @@ StringMatchGIF(dataObj, format, widthPtr, heightPtr, interp)
* Check whether the data is Base64 encoded.
*/
- if ((strncmp(GIF87a, (char *) data, 6) != 0) &&
+ if ((strncmp(GIF87a, (char *) data, 6) != 0) &&
(strncmp(GIF89a, (char *) data, 6) != 0)) {
/*
* Try interpreting the data as Base64 encoded
*/
- mInit((unsigned char *) data, length, &handle);
+
+ mInit((unsigned char *) data, &handle, length);
got = Mread(header, 10, 1, &handle);
- if (got != 10
- || ((strncmp(GIF87a, (char *) header, 6) != 0)
+ if (got != 10 ||
+ ((strncmp(GIF87a, (char *) header, 6) != 0)
&& (strncmp(GIF89a, (char *) header, 6) != 0))) {
return 0;
}
} else {
- memcpy((VOID *) header, (VOID *) data, 10);
+ memcpy(header, data, 10);
}
- *widthPtr = LM_to_uint(header[6],header[7]);
- *heightPtr = LM_to_uint(header[8],header[9]);
+ *widthPtr = LM_to_uint(header[6], header[7]);
+ *heightPtr = LM_to_uint(header[8], header[9]);
return 1;
}
/*
*----------------------------------------------------------------------
*
- * StringReadGif -- --
+ * StringReadGIF --
*
- * This procedure is called by the photo image type to read
- * GIF format data from an object, optionally base64 encoded,
- * and give it to the photo image.
+ * This function is called by the photo image type to read GIF format
+ * data from an object, optionally base64 encoded, and give it to the
+ * photo image.
*
* Results:
- * A standard TCL completion code. If TCL_ERROR is returned
- * then an error message is left in the interp's result.
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
*
* Side effects:
- * new data is added to the image given by imageHandle. This
- * procedure calls FileReadGif by redefining the operation of
- * fprintf temporarily.
+ * New data is added to the image given by imageHandle. This function
+ * calls FileReadGIF by redefining the operation of fprintf temporarily.
*
*----------------------------------------------------------------------
*/
static int
-StringReadGIF(interp, dataObj, format, imageHandle,
- destX, destY, width, height, srcX, srcY)
- Tcl_Interp *interp; /* interpreter for reporting errors in */
- Tcl_Obj *dataObj; /* object containing the image */
- Tcl_Obj *format; /* format object, or NULL */
- Tk_PhotoHandle imageHandle; /* the image to write this data into */
- int destX, destY; /* The rectangular region of the */
- int width, height; /* image to copy */
- int srcX, srcY;
+StringReadGIF(
+ Tcl_Interp *interp, /* interpreter for reporting errors in */
+ Tcl_Obj *dataObj, /* object containing the image */
+ Tcl_Obj *format, /* format object, or NULL */
+ Tk_PhotoHandle imageHandle, /* the image to write this data into */
+ int destX, int destY, /* The rectangular region of the */
+ int width, int height, /* image to copy */
+ int srcX, int srcY)
{
- int result, length;
- MFile handle;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- Tcl_Channel dataSrc;
- char *data;
+ MFile handle, *hdlPtr = &handle;
+ int length;
+ const char *xferFormat;
+ unsigned char *data = Tcl_GetByteArrayFromObj(dataObj, &length);
+
+ mInit(data, hdlPtr, length);
/*
- * Check whether the data is Base64 encoded
+ * Check whether the data is Base64 encoded by doing a character-by-
+ * charcter comparison with the binary-format headers; BASE64-encoded
+ * never matches (matching the other way is harder because of potential
+ * padding of the BASE64 data).
*/
- data = (char *) Tcl_GetByteArrayFromObj(dataObj, &length);
- if ((strncmp(GIF87a, data, 6) != 0) && (strncmp(GIF89a, data, 6) != 0)) {
- mInit((unsigned char *)data, length, &handle);
- tsdPtr->fromData = 1;
- dataSrc = (Tcl_Channel) &handle;
+
+ if (strncmp(GIF87a, (char *) data, 6)
+ && strncmp(GIF89a, (char *) data, 6)) {
+ xferFormat = INLINE_DATA_BASE64;
} else {
- tsdPtr->fromData = 2;
- mInit((unsigned char *)data, length, &handle);
- dataSrc = (Tcl_Channel) &handle;
+ xferFormat = INLINE_DATA_BINARY;
}
- result = FileReadGIF(interp, dataSrc, "inline data",
- format, imageHandle, destX, destY, width, height, srcX, srcY);
- tsdPtr->fromData = 0;
- return result;
-}
+ /*
+ * Fall through to the file reader now that we have a correctly-configured
+ * pseudo-channel to pull the data from.
+ */
+
+ return FileReadGIF(interp, (Tcl_Channel) hdlPtr, xferFormat, format,
+ imageHandle, destX, destY, width, height, srcX, srcY);
+}
+
/*
*----------------------------------------------------------------------
*
* ReadGIFHeader --
*
- * This procedure reads the GIF header from the beginning of a
- * GIF file and returns the dimensions of the image.
+ * This function reads the GIF header from the beginning of a GIF file
+ * and returns the dimensions of the image.
*
* Results:
- * The return value is 1 if file "f" appears to start with
- * a valid GIF header, 0 otherwise. If the header is valid,
- * then *widthPtr and *heightPtr are modified to hold the
- * dimensions of the image.
+ * The return value is 1 if file "f" appears to start with a valid GIF
+ * header, 0 otherwise. If the header is valid, then *widthPtr and
+ * *heightPtr are modified to hold the dimensions of the image.
*
* Side effects:
* The access position in f advances.
@@ -645,68 +698,70 @@ StringReadGIF(interp, dataObj, format, imageHandle,
*/
static int
-ReadGIFHeader(chan, widthPtr, heightPtr)
- Tcl_Channel chan; /* Image file to read the header from */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here. */
+ReadGIFHeader(
+ GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan, /* Image file to read the header from */
+ int *widthPtr, int *heightPtr)
+ /* The dimensions of the image are returned
+ * here. */
{
unsigned char buf[7];
- if ((Fread(buf, 1, 6, chan) != 6)
+ if ((Fread(gifConfPtr, buf, 1, 6, chan) != 6)
|| ((strncmp(GIF87a, (char *) buf, 6) != 0)
&& (strncmp(GIF89a, (char *) buf, 6) != 0))) {
return 0;
}
- if (Fread(buf, 1, 4, chan) != 4) {
+ if (Fread(gifConfPtr, buf, 1, 4, chan) != 4) {
return 0;
}
- *widthPtr = LM_to_uint(buf[0],buf[1]);
- *heightPtr = LM_to_uint(buf[2],buf[3]);
+ *widthPtr = LM_to_uint(buf[0], buf[1]);
+ *heightPtr = LM_to_uint(buf[2], buf[3]);
return 1;
}
-
+
/*
*-----------------------------------------------------------------
- * The code below is copied from the giftoppm program and modified
- * just slightly.
+ * The code below is copied from the giftoppm program and modified just
+ * slightly.
*-----------------------------------------------------------------
*/
static int
-ReadColorMap(chan, number, buffer)
- Tcl_Channel chan;
- int number;
- unsigned char buffer[MAXCOLORMAPSIZE][4];
+ReadColorMap(
+ GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan,
+ int number,
+ unsigned char buffer[MAXCOLORMAPSIZE][4])
{
int i;
unsigned char rgb[3];
for (i = 0; i < number; ++i) {
- if (! ReadOK(chan, rgb, sizeof(rgb))) {
+ if (Fread(gifConfPtr, rgb, sizeof(rgb), 1, chan) <= 0) {
return 0;
}
if (buffer) {
- buffer[i][CM_RED] = rgb[0] ;
- buffer[i][CM_GREEN] = rgb[1] ;
- buffer[i][CM_BLUE] = rgb[2] ;
- buffer[i][CM_ALPHA] = 255 ;
+ buffer[i][CM_RED] = rgb[0];
+ buffer[i][CM_GREEN] = rgb[1];
+ buffer[i][CM_BLUE] = rgb[2];
+ buffer[i][CM_ALPHA] = 255;
}
}
return 1;
}
-
-
-
+
static int
-DoExtension(chan, label, transparent)
- Tcl_Channel chan;
- int label;
- int *transparent;
+DoExtension(
+ GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan,
+ int label,
+ unsigned char *buf,
+ int *transparent)
{
- static unsigned char buf[256];
int count;
switch (label) {
@@ -718,12 +773,12 @@ DoExtension(chan, label, transparent)
case 0xfe: /* Comment Extension */
do {
- count = GetDataBlock(chan, (unsigned char*) buf);
+ count = GetDataBlock(gifConfPtr, chan, buf);
} while (count > 0);
return count;
case 0xf9: /* Graphic Control Extension */
- count = GetDataBlock(chan, (unsigned char*) buf);
+ count = GetDataBlock(gifConfPtr, chan, buf);
if (count < 0) {
return 1;
}
@@ -732,53 +787,52 @@ DoExtension(chan, label, transparent)
}
do {
- count = GetDataBlock(chan, (unsigned char*) buf);
+ count = GetDataBlock(gifConfPtr, chan, buf);
} while (count > 0);
return count;
}
do {
- count = GetDataBlock(chan, (unsigned char*) buf);
+ count = GetDataBlock(gifConfPtr, chan, buf);
} while (count > 0);
return count;
}
-
+
static int
-GetDataBlock(chan, buf)
- Tcl_Channel chan;
- unsigned char *buf;
+GetDataBlock(
+ GIFImageConfig *gifConfPtr,
+ Tcl_Channel chan,
+ unsigned char *buf)
{
unsigned char count;
- if (! ReadOK(chan, &count,1)) {
+ if (Fread(gifConfPtr, &count, 1, 1, chan) <= 0) {
return -1;
}
- if ((count != 0) && (! ReadOK(chan, buf, count))) {
+ if ((count != 0) && (Fread(gifConfPtr, buf, count, 1, chan) <= 0)) {
return -1;
}
return count;
}
-
-
/*
*----------------------------------------------------------------------
*
* ReadImage --
*
- * Process a GIF image from a given source, with a given height,
- * width, transparency, etc.
+ * Process a GIF image from a given source, with a given height, width,
+ * transparency, etc.
*
* This code is based on the code found in the ImageMagick GIF decoder,
* which is (c) 2000 ImageMagick Studio.
*
* Some thoughts on our implementation:
- * It sure would be nice if ReadImage didn't take 11 parameters! I think
+ * It sure would be nice if ReadImage didn't take 11 parameters! I think
* that if we were smarter, we could avoid doing that.
*
- * Possible further optimizations: we could pull the GetCode function
+ * Possible further optimizations: we could pull the GetCode function
* directly into ReadImage, which would improve our speed.
*
* Results:
@@ -791,37 +845,36 @@ GetDataBlock(chan, buf)
*/
static int
-ReadImage(interp, imagePtr, chan, len, rows, cmap,
- width, height, srcX, srcY, interlace, transparent)
- Tcl_Interp *interp;
- char *imagePtr;
- Tcl_Channel chan;
- int len, rows;
- unsigned char cmap[MAXCOLORMAPSIZE][4];
- int width, height;
- int srcX, srcY;
- int interlace;
- int transparent;
+ReadImage(
+ GIFImageConfig *gifConfPtr,
+ Tcl_Interp *interp,
+ unsigned char *imagePtr,
+ Tcl_Channel chan,
+ int len, int rows,
+ unsigned char cmap[MAXCOLORMAPSIZE][4],
+ int srcX, int srcY,
+ int interlace,
+ int transparent)
{
unsigned char initialCodeSize;
- int v;
int xpos = 0, ypos = 0, pass = 0, i;
- register char *pixelPtr;
- static CONST int interlaceStep[] = { 8, 8, 4, 2 };
- static CONST int interlaceStart[] = { 0, 4, 2, 1 };
+ register unsigned char *pixelPtr;
+ static const int interlaceStep[] = { 8, 8, 4, 2 };
+ static const int interlaceStart[] = { 0, 4, 2, 1 };
unsigned short prefix[(1 << MAX_LWZ_BITS)];
- unsigned char append[(1 << MAX_LWZ_BITS)];
- unsigned char stack[(1 << MAX_LWZ_BITS)*2];
+ unsigned char append[(1 << MAX_LWZ_BITS)];
+ unsigned char stack[(1 << MAX_LWZ_BITS)*2];
register unsigned char *top;
int codeSize, clearCode, inCode, endCode, oldCode, maxCode;
- int code, firstCode;
+ int code, firstCode, v;
/*
- * Initialize the decoder
+ * Initialize the decoder
*/
- if (! ReadOK(chan, &initialCodeSize, 1)) {
+
+ if (Fread(gifConfPtr, &initialCodeSize, 1, 1, chan) <= 0) {
Tcl_AppendResult(interp, "error reading GIF image: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -848,46 +901,49 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
* code size size of the next code to retrieve
* max code next available table position
*/
+
clearCode = 1 << (int) initialCodeSize;
endCode = clearCode + 1;
codeSize = (int) initialCodeSize + 1;
maxCode = clearCode + 2;
oldCode = -1;
firstCode = -1;
-
- memset((void *)prefix, 0, (1 << MAX_LWZ_BITS) * sizeof(short));
- memset((void *)append, 0, (1 << MAX_LWZ_BITS) * sizeof(char));
+
+ memset(prefix, 0, (1 << MAX_LWZ_BITS) * sizeof(short));
+ memset(append, 0, (1 << MAX_LWZ_BITS) * sizeof(char));
for (i = 0; i < clearCode; i++) {
append[i] = i;
}
top = stack;
- GetCode(chan, 0, 1);
+ GetCode(chan, 0, 1, gifConfPtr);
/*
* Read until we finish the image
*/
+
for (i = 0, ypos = 0; i < rows; i++) {
for (xpos = 0; xpos < len; ) {
-
if (top == stack) {
/*
- * Bummer -- our stack is empty. Now we have to work!
+ * Bummer - our stack is empty. Now we have to work!
*/
- code = GetCode(chan, codeSize, 0);
+
+ code = GetCode(chan, codeSize, 0, gifConfPtr);
if (code < 0) {
return TCL_OK;
}
if (code > maxCode || code == endCode) {
/*
- * If we're doing things right, we should never
- * receive a code that is greater than our current
- * maximum code. If we do, bail, because our decoder
- * does not yet have that code set up.
+ * If we're doing things right, we should never receive a
+ * code that is greater than our current maximum code. If
+ * we do, bail, because our decoder does not yet have that
+ * code set up.
*
* If the code is the magic endCode value, quit.
*/
+
return TCL_OK;
}
@@ -895,44 +951,48 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
/*
* Reset the decoder.
*/
+
codeSize = initialCodeSize + 1;
maxCode = clearCode + 2;
oldCode = -1;
continue;
}
-
+
if (oldCode == -1) {
/*
- * Last pass reset the decoder, so the first code we
- * see must be a singleton. Seed the stack with it,
- * and set up the old/first code pointers for
- * insertion into the string table. We can't just
- * roll this into the clearCode test above, because
- * at that point we have not yet read the next code.
+ * Last pass reset the decoder, so the first code we see
+ * must be a singleton. Seed the stack with it, and set up
+ * the old/first code pointers for insertion into the
+ * string table. We can't just roll this into the
+ * clearCode test above, because at that point we have not
+ * yet read the next code.
*/
+
*top++ = append[code];
oldCode = code;
firstCode = code;
continue;
}
-
+
inCode = code;
if (code == maxCode) {
/*
* maxCode is always one bigger than our highest assigned
- * code. If the code we see is equal to maxCode, then
- * we are about to add a new string to the table. ???
+ * code. If the code we see is equal to maxCode, then we
+ * are about to add a new string to the table. ???
*/
+
*top++ = firstCode;
code = oldCode;
}
while (code > clearCode) {
/*
- * Populate the stack by tracing the string in the
- * string table from its tail to its head
+ * Populate the stack by tracing the string in the string
+ * table from its tail to its head
*/
+
*top++ = append[code];
code = prefix[code];
}
@@ -942,6 +1002,7 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
* If there's no more room in our string table, quit.
* Otherwise, add a new string to the table
*/
+
if (maxCode >= (1 << MAX_LWZ_BITS)) {
return TCL_OK;
}
@@ -949,21 +1010,24 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
/*
* Push the head of the string onto the stack.
*/
+
*top++ = firstCode;
/*
* Add a new string to the string table
*/
+
prefix[maxCode] = oldCode;
append[maxCode] = firstCode;
maxCode++;
/*
- * maxCode tells us the maximum code value we can accept.
- * If we see that we need more bits to represent it than
- * we are requesting from the unpacker, we need to increase
- * the number we ask for.
+ * maxCode tells us the maximum code value we can accept. If
+ * we see that we need more bits to represent it than we are
+ * requesting from the unpacker, we need to increase the
+ * number we ask for.
*/
+
if ((maxCode >= (1 << codeSize))
&& (maxCode < (1<<MAX_LWZ_BITS))) {
codeSize++;
@@ -974,16 +1038,18 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
/*
* Pop the next color index off the stack.
*/
+
v = *(--top);
if (v < 0) {
return TCL_OK;
}
- /*
+ /*
* If pixelPtr is null, we're skipping this image (presumably
- * there are more in the file and we will be called to read
- * one of them later)
+ * there are more in the file and we will be called to read one of
+ * them later)
*/
+
*pixelPtr++ = cmap[v][CM_RED];
*pixelPtr++ = cmap[v][CM_GREEN];
*pixelPtr++ = cmap[v][CM_BLUE];
@@ -995,8 +1061,9 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
}
/*
- * If interlacing, the next ypos is not just +1
+ * If interlacing, the next ypos is not just +1.
*/
+
if (interlace) {
ypos += interlaceStep[pass];
while (ypos >= rows) {
@@ -1013,27 +1080,25 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
}
return TCL_OK;
}
-
/*
*----------------------------------------------------------------------
*
* GetCode --
*
- * Extract the next compression code from the file. In GIF's, the
- * compression codes are between 3 and 12 bits long and are then
- * packed into 8 bit bytes, left to right, for example:
+ * Extract the next compression code from the file. In GIF's, the
+ * compression codes are between 3 and 12 bits long and are then packed
+ * into 8 bit bytes, left to right, for example:
* bbbaaaaa
* dcccccbb
* eeeedddd
* ...
- * We use a byte buffer read from the file and a sliding window
- * to unpack the bytes. Thanks to ImageMagick for the sliding window
- * idea.
+ * We use a byte buffer read from the file and a sliding window to unpack
+ * the bytes. Thanks to ImageMagick for the sliding window idea.
* args: chan the channel to read from
* code_size size of the code to extract
- * flag boolean indicating whether the extractor
- * should be reset or not
+ * flag boolean indicating whether the extractor should be
+ * reset or not
*
* Results:
* code the next compression code
@@ -1045,69 +1110,72 @@ ReadImage(interp, imagePtr, chan, len, rows, cmap,
*/
static int
-GetCode(chan, code_size, flag)
- Tcl_Channel chan;
- int code_size;
- int flag;
+GetCode(
+ Tcl_Channel chan,
+ int code_size,
+ int flag,
+ GIFImageConfig *gifConfPtr)
{
- static unsigned char buf[280];
- static int bytes = 0, done;
- static unsigned char *c;
-
- static unsigned int window;
- static int bitsInWindow = 0;
int ret;
-
+
if (flag) {
/*
* Initialize the decoder.
*/
- bitsInWindow = 0;
- bytes = 0;
- window = 0;
- done = 0;
- c = NULL;
+
+ gifConfPtr->reader.bitsInWindow = 0;
+ gifConfPtr->reader.bytes = 0;
+ gifConfPtr->reader.window = 0;
+ gifConfPtr->reader.done = 0;
+ gifConfPtr->reader.c = NULL;
return 0;
}
- while (bitsInWindow < code_size) {
+ while (gifConfPtr->reader.bitsInWindow < code_size) {
/*
* Not enough bits in our window to cover the request.
*/
- if (done) {
+
+ if (gifConfPtr->reader.done) {
return -1;
}
- if (bytes == 0) {
+ if (gifConfPtr->reader.bytes == 0) {
/*
* Not enough bytes in our buffer to add to the window.
*/
- bytes = GetDataBlock(chan, buf);
- c = buf;
- if (bytes <= 0) {
- done = 1;
+
+ gifConfPtr->reader.bytes =
+ GetDataBlock(gifConfPtr, chan, gifConfPtr->workingBuffer);
+ gifConfPtr->reader.c = gifConfPtr->workingBuffer;
+ if (gifConfPtr->reader.bytes <= 0) {
+ gifConfPtr->reader.done = 1;
break;
}
}
+
/*
* Tack another byte onto the window, see if that's enough.
*/
- window += (*c) << bitsInWindow;
- c++;
- bitsInWindow += 8;
- bytes--;
- }
+ gifConfPtr->reader.window +=
+ (*gifConfPtr->reader.c) << gifConfPtr->reader.bitsInWindow;
+ gifConfPtr->reader.c++;
+ gifConfPtr->reader.bitsInWindow += 8;
+ gifConfPtr->reader.bytes--;
+ }
/*
* The next code will always be the last code_size bits of the window.
*/
- ret = window & ((1 << code_size) - 1);
-
+
+ ret = gifConfPtr->reader.window & ((1 << code_size) - 1);
+
/*
* Shift data in the window to put the next code at the end.
*/
- window >>= code_size;
- bitsInWindow -= code_size;
+
+ gifConfPtr->reader.window >>= code_size;
+ gifConfPtr->reader.bitsInWindow -= code_size;
return ret;
}
@@ -1116,27 +1184,27 @@ GetCode(chan, code_size, flag)
*
* Minit -- --
*
- * This procedure initializes a base64 decoder handle
+ * This function initializes a base64 decoder handle
*
* Results:
- * none
+ * None
*
* Side effects:
- * the base64 handle is initialized
+ * The base64 handle is initialized
*
*----------------------------------------------------------------------
*/
static void
-mInit(string, length, handle)
- unsigned char *string; /* string containing initial mmencoded data */
- int length; /* Length of string */
- MFile *handle; /* mmdecode "file" handle */
+mInit(
+ unsigned char *string, /* string containing initial mmencoded data */
+ MFile *handle, /* mmdecode "file" handle */
+ int length) /* Number of bytes in string */
{
handle->data = string;
- handle->length = length;
handle->state = 0;
handle->c = 0;
+ handle->length = length;
}
/*
@@ -1144,9 +1212,9 @@ mInit(string, length, handle)
*
* Mread --
*
- * This procedure is invoked by the GIF file reader as a
- * temporary replacement for "fread", to get GIF data out
- * of a string (using Mgetc).
+ * This function is invoked by the GIF file reader as a temporary
+ * replacement for "fread", to get GIF data out of a string (using
+ * Mgetc).
*
* Results:
* The return value is the number of characters "read"
@@ -1158,50 +1226,45 @@ mInit(string, length, handle)
*/
static int
-Mread(dst, chunkSize, numChunks, handle)
- unsigned char *dst; /* where to put the result */
- size_t chunkSize; /* size of each transfer */
- size_t numChunks; /* number of chunks */
- MFile *handle; /* mmdecode "file" handle */
+Mread(
+ unsigned char *dst, /* where to put the result */
+ size_t chunkSize, /* size of each transfer */
+ size_t numChunks, /* number of chunks */
+ MFile *handle) /* mmdecode "file" handle */
{
register int i, c;
int count = chunkSize * numChunks;
- for(i=0; i<count && (c=Mgetc(handle)) != GIF_DONE; i++) {
+ for (i=0; i<count && (c=Mgetc(handle)) != GIF_DONE; i++) {
*dst++ = c;
}
return i;
}
-
-/*
- * get the next decoded character from an mmencode handle
- * This causes at least 1 character to be "read" from the encoded string
- */
/*
*----------------------------------------------------------------------
*
* Mgetc --
*
- * This procedure decodes and returns the next byte from a base64
- * encoded string.
+ * This function gets the next decoded character from an mmencode handle.
+ * This causes at least 1 character to be "read" from the encoded string.
*
* Results:
- * The next byte (or GIF_DONE) is returned.
+ * The next byte (or GIF_DONE) is returned.
*
* Side effects:
- * The base64 handle will change state.
+ * The base64 handle will change state.
*
*----------------------------------------------------------------------
*/
static int
-Mgetc(handle)
- MFile *handle; /* Handle containing decoder data and state */
+Mgetc(
+ MFile *handle) /* Handle containing decoder data and state */
{
int c;
- int result = 0; /* Initialization needed only to prevent
- * gcc compiler warning. */
+ int result = 0; /* Initialization needed only to prevent gcc
+ * compiler warning. */
if (handle->state == GIF_DONE) {
return GIF_DONE;
@@ -1209,7 +1272,6 @@ Mgetc(handle)
do {
if (handle->length-- <= 0) {
- handle->state = GIF_DONE;
return GIF_DONE;
}
c = char64(*handle->data);
@@ -1247,21 +1309,22 @@ Mgetc(handle)
*
* char64 --
*
- * This procedure converts a base64 ascii character into its binary
- * equivalent. This code is a slightly modified version of the
- * char64 proc in N. Borenstein's metamail decoder.
+ * This function converts a base64 ascii character into its binary
+ * equivalent. This code is a slightly modified version of the char64
+ * function in N. Borenstein's metamail decoder.
*
* Results:
* The binary value, or an error code.
*
* Side effects:
* None.
+ *
*----------------------------------------------------------------------
*/
static int
-char64(c)
-int c;
+char64(
+ int c)
{
switch(c) {
case 'A': return 0; case 'B': return 1; case 'C': return 2;
@@ -1303,52 +1366,53 @@ int c;
*
* Fread --
*
- * This procedure calls either fread or Mread to read data
- * from a file or a base64 encoded string.
+ * This function calls either fread or Mread to read data from a file or
+ * a base64 encoded string.
*
- * Results: - same as fread
+ * Results: - same as POSIX fread() or Tcl Tcl_Read()
*
*----------------------------------------------------------------------
*/
static int
-Fread(dst, hunk, count, chan)
- unsigned char *dst; /* where to put the result */
- size_t hunk,count; /* how many */
- Tcl_Channel chan;
+Fread(
+ GIFImageConfig *gifConfPtr,
+ unsigned char *dst, /* where to put the result */
+ size_t hunk, size_t count, /* how many */
+ Tcl_Channel chan)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- MFile *handle;
-
- switch (tsdPtr->fromData) {
- case 1:
+ if (gifConfPtr->fromData == INLINE_DATA_BASE64) {
return Mread(dst, hunk, count, (MFile *) chan);
- case 2:
- handle = (MFile *) chan;
- if (handle->length <= 0 || (size_t)handle->length < (size_t) (hunk * count)) {
+ }
+
+ if (gifConfPtr->fromData == INLINE_DATA_BINARY) {
+ MFile *handle = (MFile *) chan;
+
+ if (handle->length <= 0 || (size_t) handle->length < hunk*count) {
return -1;
}
- memcpy((VOID *)dst, (VOID *) handle->data, (size_t) (hunk * count));
+ memcpy(dst, handle->data, (size_t) (hunk * count));
handle->data += hunk * count;
- handle->length -= hunk * count;
return (int)(hunk * count);
- default:
- return Tcl_Read(chan, (char *) dst, (int) (hunk * count));
}
-}
+ /*
+ * Otherwise we've got a real file to read.
+ */
+
+ return Tcl_Read(chan, (char *) dst, (int) (hunk * count));
+}
/*
* ChanWriteGIF - writes a image in GIF format.
*-------------------------------------------------------------------------
- * Author: Lolo
- * Engeneering Projects Area
- * Department of Mining
- * University of Oviedo
- * e-mail zz11425958@zeus.etsimo.uniovi.es
- * lolo@pcsig22.etsimo.uniovi.es
- * Date: Fri September 20 1996
+ * Author: Lolo
+ * Engeneering Projects Area
+ * Department of Mining
+ * University of Oviedo
+ * e-mail zz11425958@zeus.etsimo.uniovi.es
+ * lolo@pcsig22.etsimo.uniovi.es
+ * Date: Fri September 20 1996
*
* Modified for transparency handling (gif89a) and miGIF compression
* by Jan Nijtmans <j.nijtmans@chello.nl>
@@ -1356,60 +1420,65 @@ Fread(dst, hunk, count, chan)
*----------------------------------------------------------------------
* FileWriteGIF-
*
- * This procedure is called by the photo image type to write
- * GIF format data from a photo image into a given file
+ * This function is called by the photo image type to write GIF format
+ * data from a photo image into a given file
*
* Results:
- * A standard TCL completion code. If TCL_ERROR is returned
- * then an error message is left in interp->result.
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in interp->result.
*
*----------------------------------------------------------------------
*/
- /*
- * Types, defines and variables needed to write and compress a GIF.
- */
-
-typedef int (* ifunptr) _ANSI_ARGS_((void));
-
-#define LSB(a) ((unsigned char) (((short)(a)) & 0x00FF))
-#define MSB(a) ((unsigned char) (((short)(a)) >> 8))
-
-#define GIFBITS 12
-#define HSIZE 5003 /* 80% occupancy */
+/*
+ * Types, defines and variables needed to write and compress a GIF.
+ */
-static int ssize;
-static int csize;
-static int rsize;
-static unsigned char *pixelo;
-static int pixelSize;
-static int pixelPitch;
-static int greenOffset;
-static int blueOffset;
-static int alphaOffset;
-static int num;
-static unsigned char mapa[MAXCOLORMAPSIZE][3];
+typedef int (* ifunptr) (ClientData clientData);
+
+#define LSB(a) ((unsigned char) (((short)(a)) & 0x00FF))
+#define MSB(a) ((unsigned char) (((short)(a)) >> 8))
+
+#define GIFBITS 12
+#define HSIZE 5003 /* 80% occupancy */
+
+typedef struct {
+ int ssize;
+ int csize;
+ int rsize;
+ unsigned char *pixelo;
+ int pixelSize;
+ int pixelPitch;
+ int greenOffset;
+ int blueOffset;
+ int alphaOffset;
+ int num;
+ unsigned char mapa[MAXCOLORMAPSIZE][3];
+} GifWriterState;
/*
- * Definition of new functions to write GIFs
+ * Definition of new functions to write GIFs
*/
-static int color _ANSI_ARGS_((int red,int green, int blue,
- unsigned char mapa[MAXCOLORMAPSIZE][3]));
-static void compress _ANSI_ARGS_((int init_bits, Tcl_Channel handle,
- ifunptr readValue));
-static int nuevo _ANSI_ARGS_((int red, int green ,int blue,
- unsigned char mapa[MAXCOLORMAPSIZE][3]));
-static void savemap _ANSI_ARGS_((Tk_PhotoImageBlock *blockPtr,
- unsigned char mapa[MAXCOLORMAPSIZE][3]));
-static int ReadValue _ANSI_ARGS_((void));
-
+static int color(GifWriterState *statePtr,
+ int red, int green, int blue,
+ unsigned char mapa[MAXCOLORMAPSIZE][3]);
+static void compress(int initBits, Tcl_Channel handle,
+ ifunptr readValue, ClientData clientData);
+static int nuevo(GifWriterState *statePtr,
+ int red, int green, int blue,
+ unsigned char mapa[MAXCOLORMAPSIZE][3]);
+static void savemap(GifWriterState *statePtr,
+ Tk_PhotoImageBlock *blockPtr,
+ unsigned char mapa[MAXCOLORMAPSIZE][3]);
+static int ReadValue(ClientData clientData);
+
static int
-FileWriteGIF(interp, filename, format, blockPtr)
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- CONST char *filename;
- Tcl_Obj *format;
- Tk_PhotoImageBlock *blockPtr;
+FileWriteGIF(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ const char *filename,
+ Tcl_Obj *format,
+ Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan = NULL;
int result;
@@ -1418,167 +1487,168 @@ FileWriteGIF(interp, filename, format, blockPtr)
if (!chan) {
return TCL_ERROR;
}
- if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) {
+ if (Tcl_SetChannelOption(interp, chan, "-translation",
+ "binary") != TCL_OK) {
Tcl_Close(NULL, chan);
return TCL_ERROR;
}
result = CommonWriteGIF(interp, chan, format, blockPtr);
+
if (Tcl_Close(interp, chan) == TCL_ERROR) {
return TCL_ERROR;
}
return result;
}
-
-#define Mputc(c,handle) Tcl_Write(handle,(char *) &c,1)
-
+
static int
-CommonWriteGIF(interp, handle, format, blockPtr)
- Tcl_Interp *interp;
- Tcl_Channel handle;
- Tcl_Obj *format;
- Tk_PhotoImageBlock *blockPtr;
+CommonWriteGIF(
+ Tcl_Interp *interp,
+ Tcl_Channel handle,
+ Tcl_Obj *format,
+ Tk_PhotoImageBlock *blockPtr)
{
- int resolution;
-
- long width,height,x;
+ GifWriterState state, *statePtr = &state;
+ int resolution;
+ long width, height, x;
unsigned char c;
- unsigned int top,left;
+ unsigned int top, left;
top = 0;
left = 0;
- pixelSize = blockPtr->pixelSize;
- greenOffset = blockPtr->offset[1]-blockPtr->offset[0];
- blueOffset = blockPtr->offset[2]-blockPtr->offset[0];
- alphaOffset = blockPtr->offset[0];
- if (alphaOffset < blockPtr->offset[2]) {
- alphaOffset = blockPtr->offset[2];
+ memset(statePtr, 0, sizeof(state));
+
+ statePtr->pixelSize = blockPtr->pixelSize;
+ statePtr->greenOffset = blockPtr->offset[1]-blockPtr->offset[0];
+ statePtr->blueOffset = blockPtr->offset[2]-blockPtr->offset[0];
+ statePtr->alphaOffset = blockPtr->offset[0];
+ if (statePtr->alphaOffset < blockPtr->offset[2]) {
+ statePtr->alphaOffset = blockPtr->offset[2];
}
- if (++alphaOffset < pixelSize) {
- alphaOffset -= blockPtr->offset[0];
+ if (++statePtr->alphaOffset < statePtr->pixelSize) {
+ statePtr->alphaOffset -= blockPtr->offset[0];
} else {
- alphaOffset = 0;
+ statePtr->alphaOffset = 0;
}
- Tcl_Write(handle, (char *) (alphaOffset ? GIF89a : GIF87a), 6);
+ Tcl_Write(handle, (char *) (statePtr->alphaOffset ? GIF89a : GIF87a), 6);
for (x=0 ; x<MAXCOLORMAPSIZE ; x++) {
- mapa[x][CM_RED] = 255;
- mapa[x][CM_GREEN] = 255;
- mapa[x][CM_BLUE] = 255;
+ statePtr->mapa[x][CM_RED] = 255;
+ statePtr->mapa[x][CM_GREEN] = 255;
+ statePtr->mapa[x][CM_BLUE] = 255;
}
-
width = blockPtr->width;
height = blockPtr->height;
- pixelo = blockPtr->pixelPtr + blockPtr->offset[0];
- pixelPitch = blockPtr->pitch;
- savemap(blockPtr,mapa);
- if (num >= MAXCOLORMAPSIZE) {
- Tcl_AppendResult(interp, "too many colors", (char *) NULL);
+ statePtr->pixelo = blockPtr->pixelPtr + blockPtr->offset[0];
+ statePtr->pixelPitch = blockPtr->pitch;
+ savemap(statePtr, blockPtr, statePtr->mapa);
+ if (statePtr->num >= MAXCOLORMAPSIZE) {
+ Tcl_AppendResult(interp, "too many colors", NULL);
return TCL_ERROR;
}
- if (num<2) {
- num = 2;
+ if (statePtr->num<2) {
+ statePtr->num = 2;
}
c = LSB(width);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = MSB(width);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = LSB(height);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = MSB(height);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
resolution = 0;
- while (num >> resolution) {
+ while (statePtr->num >> resolution) {
resolution++;
}
c = 111 + resolution * 17;
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
- num = 1 << resolution;
+ statePtr->num = 1 << resolution;
/*
- * background color
+ * Background color
*/
c = 0;
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
/*
- * zero for future expansion.
+ * Zero for future expansion.
*/
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
- for (x=0 ; x<num ; x++) {
- c = mapa[x][CM_RED];
- Mputc(c,handle);
- c = mapa[x][CM_GREEN];
- Mputc(c,handle);
- c = mapa[x][CM_BLUE];
- Mputc(c,handle);
+ for (x=0 ; x<statePtr->num ; x++) {
+ c = statePtr->mapa[x][CM_RED];
+ Tcl_Write(handle, (char *) &c, 1);
+ c = statePtr->mapa[x][CM_GREEN];
+ Tcl_Write(handle, (char *) &c, 1);
+ c = statePtr->mapa[x][CM_BLUE];
+ Tcl_Write(handle, (char *) &c, 1);
}
/*
* Write out extension for transparent colour index, if necessary.
*/
- if (alphaOffset) {
+ if (statePtr->alphaOffset) {
c = GIF_EXTENSION;
- Mputc(c, handle);
+ Tcl_Write(handle, (char *) &c, 1);
Tcl_Write(handle, "\371\4\1\0\0\0", 7);
}
c = GIF_START;
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = LSB(top);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = MSB(top);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = LSB(left);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = MSB(left);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = LSB(width);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = MSB(width);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = LSB(height);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = MSB(height);
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = 0;
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
c = resolution;
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
- ssize = rsize = blockPtr->width;
- csize = blockPtr->height;
- compress(resolution+1, handle, ReadValue);
+ statePtr->ssize = statePtr->rsize = blockPtr->width;
+ statePtr->csize = blockPtr->height;
+ compress(resolution+1, handle, ReadValue, (ClientData) statePtr);
- c = 0;
- Mputc(c,handle);
+ c = 0;
+ Tcl_Write(handle, (char *) &c, 1);
c = GIF_TERMINATOR;
- Mputc(c,handle);
+ Tcl_Write(handle, (char *) &c, 1);
- return TCL_OK;
+ return TCL_OK;
}
-
+
static int
-color(red, green, blue, mapa)
- int red;
- int green;
- int blue;
- unsigned char mapa[MAXCOLORMAPSIZE][3];
+color(
+ GifWriterState *statePtr,
+ int red, int green, int blue,
+ unsigned char mapa[MAXCOLORMAPSIZE][3])
{
- int x;
- for (x=(alphaOffset != 0) ; x<=MAXCOLORMAPSIZE ; x++) {
+ int x = (statePtr->alphaOffset != 0);
+
+ for (; x<=MAXCOLORMAPSIZE ; x++) {
if ((mapa[x][CM_RED] == red) && (mapa[x][CM_GREEN] == green) &&
(mapa[x][CM_BLUE] == blue)) {
return x;
@@ -1586,15 +1656,16 @@ color(red, green, blue, mapa)
}
return -1;
}
-
static int
-nuevo(red, green, blue, mapa)
- int red,green,blue;
- unsigned char mapa[MAXCOLORMAPSIZE][3];
+nuevo(
+ GifWriterState *statePtr,
+ int red, int green, int blue,
+ unsigned char mapa[MAXCOLORMAPSIZE][3])
{
- int x = (alphaOffset != 0);
- for (; x<=num ; x++) {
+ int x = (statePtr->alphaOffset != 0);
+
+ for (; x<=statePtr->num ; x++) {
if ((mapa[x][CM_RED] == red) && (mapa[x][CM_GREEN] == green) &&
(mapa[x][CM_BLUE] == blue)) {
return 0;
@@ -1602,74 +1673,76 @@ nuevo(red, green, blue, mapa)
}
return 1;
}
-
+
static void
-savemap(blockPtr,mapa)
- Tk_PhotoImageBlock *blockPtr;
- unsigned char mapa[MAXCOLORMAPSIZE][3];
+savemap(
+ GifWriterState *statePtr,
+ Tk_PhotoImageBlock *blockPtr,
+ unsigned char mapa[MAXCOLORMAPSIZE][3])
{
unsigned char *colores;
- int x,y;
- unsigned char red,green,blue;
+ int x, y;
+ unsigned char red, green, blue;
- if (alphaOffset) {
- num = 0;
+ if (statePtr->alphaOffset) {
+ statePtr->num = 0;
mapa[0][CM_RED] = 0xd9;
mapa[0][CM_GREEN] = 0xd9;
mapa[0][CM_BLUE] = 0xd9;
} else {
- num = -1;
+ statePtr->num = -1;
}
- for(y=0 ; y<blockPtr->height ; y++) {
- colores = blockPtr->pixelPtr + blockPtr->offset[0]
- + y * blockPtr->pitch;
- for(x=0 ; x<blockPtr->width ; x++) {
- if (!alphaOffset || (colores[alphaOffset] != 0)) {
+ for (y=0 ; y<blockPtr->height ; y++) {
+ colores = blockPtr->pixelPtr + blockPtr->offset[0] + y*blockPtr->pitch;
+ for (x=0 ; x<blockPtr->width ; x++) {
+ if (!statePtr->alphaOffset || colores[statePtr->alphaOffset]!=0) {
red = colores[0];
- green = colores[greenOffset];
- blue = colores[blueOffset];
- if (nuevo(red,green,blue,mapa)) {
- num++;
- if (num >= MAXCOLORMAPSIZE) {
+ green = colores[statePtr->greenOffset];
+ blue = colores[statePtr->blueOffset];
+ if (nuevo(statePtr, red, green, blue, mapa)) {
+ statePtr->num++;
+ if (statePtr->num >= MAXCOLORMAPSIZE) {
return;
}
- mapa[num][CM_RED] = red;
- mapa[num][CM_GREEN] = green;
- mapa[num][CM_BLUE] = blue;
+ mapa[statePtr->num][CM_RED] = red;
+ mapa[statePtr->num][CM_GREEN] = green;
+ mapa[statePtr->num][CM_BLUE] = blue;
}
}
- colores += pixelSize;
+ colores += statePtr->pixelSize;
}
}
- return;
}
-
+
static int
-ReadValue()
+ReadValue(
+ ClientData clientData)
{
+ GifWriterState *statePtr = (GifWriterState *) clientData;
unsigned int col;
- if (csize == 0) {
+ if (statePtr->csize == 0) {
return EOF;
}
- if (alphaOffset && (pixelo[alphaOffset] == 0)) {
+ if (statePtr->alphaOffset && statePtr->pixelo[statePtr->alphaOffset]==0) {
col = 0;
} else {
- col = color(pixelo[0], pixelo[greenOffset], pixelo[blueOffset], mapa);
+ col = color(statePtr, statePtr->pixelo[0],
+ statePtr->pixelo[statePtr->greenOffset],
+ statePtr->pixelo[statePtr->blueOffset], statePtr->mapa);
}
- pixelo += pixelSize;
- if (--ssize <= 0) {
- ssize = rsize;
- csize--;
- pixelo += pixelPitch - (rsize * pixelSize);
+ statePtr->pixelo += statePtr->pixelSize;
+ if (--statePtr->ssize <= 0) {
+ statePtr->ssize = statePtr->rsize;
+ statePtr->csize--;
+ statePtr->pixelo += statePtr->pixelPitch
+ - (statePtr->rsize * statePtr->pixelSize);
}
return col;
}
-
-
/*
*-----------------------------------------------------------------------
*
@@ -1681,30 +1754,27 @@ ReadValue()
* http://www.hasc.com
* info@hasc.com
*
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation. This software is
- * provided "AS IS." The Hutchison Avenue Software Corporation
- * disclaims all warranties, either express or implied, including but
- * not limited to implied warranties of merchantability and fitness
- * for a particular purpose, with respect to this code and
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. This software is provided "AS IS." The Hutchison Avenue
+ * Software Corporation disclaims all warranties, either express or implied,
+ * including but not limited to implied warranties of merchantability and
+ * fitness for a particular purpose, with respect to this code and
* accompanying documentation.
- *
- * The miGIF compression routines do not, strictly speaking, generate
- * files conforming to the GIF spec, since the image data is not
- * LZW-compressed (this is the point: in order to avoid transgression
- * of the Unisys patent on the LZW algorithm.) However, miGIF
- * generates data streams that any reasonably sane LZW decompresser
- * will decompress to what we want.
- *
- * miGIF compression uses run length encoding. It compresses
- * horizontal runs of pixels of the same color. This type of
- * compression gives good results on images with many runs, for
- * example images with lines, text and solid shapes on a solid-colored
- * background. It gives little or no compression on images with few
- * runs, for example digital or scanned photos.
+ *
+ * The miGIF compression routines do not, strictly speaking, generate files
+ * conforming to the GIF spec, since the image data is not LZW-compressed
+ * (this is the point: in order to avoid transgression of the Unisys patent on
+ * the LZW algorithm.) However, miGIF generates data streams that any
+ * reasonably sane LZW decompresser will decompress to what we want.
+ *
+ * miGIF compression uses run length encoding. It compresses horizontal runs
+ * of pixels of the same color. This type of compression gives good results on
+ * images with many runs, for example images with lines, text and solid shapes
+ * on a solid-colored background. It gives little or no compression on images
+ * with few runs, for example digital or scanned photos.
*
* der Mouse
* mouse@rodents.montreal.qc.ca
@@ -1712,35 +1782,36 @@ ReadValue()
*
* ivo@hasc.com
*
- * The Graphics Interchange Format(c) is the Copyright property of
- * CompuServe Incorporated. GIF(sm) is a Service Mark property of
- * CompuServe Incorporated.
+ * The Graphics Interchange Format(c) is the Copyright property of CompuServe
+ * Incorporated. GIF(sm) is a Service Mark property of CompuServe Incorporated.
*
*-----------------------------------------------------------------------
*/
-static int rl_pixel;
-static int rl_basecode;
-static int rl_count;
-static int rl_table_pixel;
-static int rl_table_max;
-static int just_cleared;
-static int out_bits;
-static int out_bits_init;
-static int out_count;
-static int out_bump;
-static int out_bump_init;
-static int out_clear;
-static int out_clear_init;
-static int max_ocodes;
-static int code_clear;
-static int code_eof;
-static unsigned int obuf;
-static int obits;
-static Tcl_Channel ofile;
-static unsigned char oblock[256];
-static int oblen;
-
+typedef struct {
+ int runlengthPixel;
+ int runlengthBaseCode;
+ int runlengthCount;
+ int runlengthTablePixel;
+ int runlengthTableMax;
+ int justCleared;
+ int outputBits;
+ int outputBitsInit;
+ int outputCount;
+ int outputBump;
+ int outputBumpInit;
+ int outputClear;
+ int outputClearInit;
+ int maxOcodes;
+ int codeClear;
+ int codeEOF;
+ unsigned int obuf;
+ int obits;
+ Tcl_Channel ofile;
+ unsigned char oblock[256];
+ int oblen;
+} miGIFState_t;
+
/*
* Used only when debugging GIF compression code
*/
@@ -1748,23 +1819,28 @@ static int oblen;
#ifdef MIGIF_DEBUGGING_ENVARS
-static int verbose_set = 0;
+/*
+ * This debugging code is _absolutely_ not thread-safe. It's also not normally
+ * enabled either.
+ */
+
+static int verboseSet = 0;
static int verbose;
-#define MIGIF_VERBOSE (verbose_set?verbose:set_verbose())
-#define DEBUGMSG(printf_args) if (MIGIF_VERBOSE) { printf printf_args; }
+#define MIGIF_VERBOSE (verboseSet?verbose:setVerbose())
+#define DEBUGMSG(printfArgs) if (MIGIF_VERBOSE) { printf printfArgs; }
static int
-set_verbose(void)
+setVerbose(void)
{
verbose = !!getenv("MIGIF_VERBOSE");
- verbose_set = 1;
+ verboseSet = 1;
return verbose;
}
-static CONST char *
-binformat(v, nbits)
- unsigned int v;
- int nbits;
+static const char *
+binformat(
+ unsigned int v,
+ int nbits)
{
static char bufs[8][64];
static int bhand = 0;
@@ -1786,112 +1862,119 @@ binformat(v, nbits)
*bp = '\0';
return &bufs[bhand][0];
}
-
-#else
-
-#define MIGIF_VERBOSE 0
-#define DEBUGMSG(printf_args) /* do nothing */
-
+#else /* !MIGIF_DEBUGGING_ENVARS */
+#define DEBUGMSG(printfArgs) /* do nothing */
#endif
-
+
static void
-write_block()
+writeBlock(
+ miGIFState_t *statePtr)
{
- int i;
unsigned char c;
+#ifdef MIGIF_DEBUGGING_ENVARS
if (MIGIF_VERBOSE) {
- printf("write_block %d:", oblen);
- for (i=0 ; i<oblen ; i++) {
- printf(" %02x", oblock[i]);
+ int i;
+ printf("writeBlock %d:", statePtr->oblen);
+ for (i=0 ; i<statePtr->oblen ; i++) {
+ printf(" %02x", statePtr->oblock[i]);
}
printf("\n");
}
- c = oblen;
- Tcl_Write(ofile, (char *) &c, 1);
- Tcl_Write(ofile, (char *) &oblock[0], oblen);
- oblen = 0;
+#endif
+ c = statePtr->oblen;
+ Tcl_Write(statePtr->ofile, (char *) &c, 1);
+ Tcl_Write(statePtr->ofile, (char *) &statePtr->oblock[0], statePtr->oblen);
+ statePtr->oblen = 0;
}
-
+
static void
-block_out(c)
- unsigned char c;
+blockOut(
+ miGIFState_t *statePtr,
+ unsigned c)
{
- DEBUGMSG(("block_out %s\n", binformat(c, 8)));
- oblock[oblen++] = c;
- if (oblen >= 255) {
- write_block();
+ DEBUGMSG(("blockOut %s\n", binformat(c, 8)));
+ statePtr->oblock[statePtr->oblen++] = (unsigned char) c;
+ if (statePtr->oblen >= 255) {
+ writeBlock(statePtr);
}
}
-
+
static void
-block_flush()
+blockFlush(
+ miGIFState_t *statePtr)
{
- DEBUGMSG(("block_flush\n"));
- if (oblen > 0) {
- write_block();
+ DEBUGMSG(("blockFlush\n"));
+ if (statePtr->oblen > 0) {
+ writeBlock(statePtr);
}
}
-
+
static void
-output(val)
- int val;
+output(
+ miGIFState_t *statePtr,
+ int val)
{
- DEBUGMSG(("output %s [%s %d %d]\n", binformat(val, out_bits),
- binformat(obuf, obits), obits, out_bits));
- obuf |= val << obits;
- obits += out_bits;
- while (obits >= 8) {
- block_out(UCHAR(obuf&0xff));
- obuf >>= 8;
- obits -= 8;
- }
- DEBUGMSG(("output leaving [%s %d]\n", binformat(obuf, obits), obits));
+ DEBUGMSG(("output %s [%s %d %d]\n", binformat(val, statePtr->outputBits),
+ binformat(statePtr->obuf, statePtr->obits), statePtr->obits,
+ statePtr->outputBits));
+ statePtr->obuf |= val << statePtr->obits;
+ statePtr->obits += statePtr->outputBits;
+ while (statePtr->obits >= 8) {
+ blockOut(statePtr, statePtr->obuf & 0xff);
+ statePtr->obuf >>= 8;
+ statePtr->obits -= 8;
+ }
+ DEBUGMSG(("output leaving [%s %d]\n",
+ binformat(statePtr->obuf, statePtr->obits), statePtr->obits));
}
-
+
static void
-output_flush()
+outputFlush(
+ miGIFState_t *statePtr)
{
- DEBUGMSG(("output_flush\n"));
- if (obits > 0) {
- block_out(UCHAR(obuf));
+ DEBUGMSG(("outputFlush\n"));
+ if (statePtr->obits > 0) {
+ blockOut(statePtr, statePtr->obuf);
}
- block_flush();
+ blockFlush(statePtr);
}
-
+
static void
-did_clear()
+didClear(
+ miGIFState_t *statePtr)
{
- DEBUGMSG(("did_clear\n"));
- out_bits = out_bits_init;
- out_bump = out_bump_init;
- out_clear = out_clear_init;
- out_count = 0;
- rl_table_max = 0;
- just_cleared = 1;
+ DEBUGMSG(("didClear\n"));
+ statePtr->outputBits = statePtr->outputBitsInit;
+ statePtr->outputBump = statePtr->outputBumpInit;
+ statePtr->outputClear = statePtr->outputClearInit;
+ statePtr->outputCount = 0;
+ statePtr->runlengthTableMax = 0;
+ statePtr->justCleared = 1;
}
-
+
static void
-output_plain(c)
- int c;
+outputPlain(
+ miGIFState_t *statePtr,
+ int c)
{
- DEBUGMSG(("output_plain %s\n", binformat(c, out_bits)));
- just_cleared = 0;
- output(c);
- out_count++;
- if (out_count >= out_bump) {
- out_bits++;
- out_bump += 1 << (out_bits - 1);
- }
- if (out_count >= out_clear) {
- output(code_clear);
- did_clear();
+ DEBUGMSG(("outputPlain %s\n", binformat(c, statePtr->outputBits)));
+ statePtr->justCleared = 0;
+ output(statePtr, c);
+ statePtr->outputCount++;
+ if (statePtr->outputCount >= statePtr->outputBump) {
+ statePtr->outputBits++;
+ statePtr->outputBump += 1 << (statePtr->outputBits - 1);
+ }
+ if (statePtr->outputCount >= statePtr->outputClear) {
+ output(statePtr, statePtr->codeClear);
+ didClear(statePtr);
}
}
-
+
static unsigned int
-isqrt(x)
- unsigned int x;
+isqrt(
+ unsigned int x)
{
unsigned int r;
unsigned int v;
@@ -1908,11 +1991,11 @@ isqrt(x)
r = v;
}
}
-
-static unsigned int
-compute_triangle_count(count, nrepcodes)
- unsigned int count;
- unsigned int nrepcodes;
+
+static int
+computeTriangleCount(
+ unsigned int count,
+ unsigned int nrepcodes)
{
unsigned int perrep;
unsigned int cost;
@@ -1924,8 +2007,8 @@ compute_triangle_count(count, nrepcodes)
count -= perrep;
}
if (count > 0) {
- unsigned int n;
- n = isqrt(count);
+ unsigned int n = isqrt(count);
+
while (n*(n+1) >= 2*count) {
n--;
}
@@ -1934,204 +2017,233 @@ compute_triangle_count(count, nrepcodes)
}
cost += n;
}
- return cost;
+ return (int) cost + 1;
}
-
+
static void
-max_out_clear()
+maxOutputClear(
+ miGIFState_t *statePtr)
{
- out_clear = max_ocodes;
+ statePtr->outputClear = statePtr->maxOcodes;
}
-
+
static void
-reset_out_clear()
+resetOutputClear(
+ miGIFState_t *statePtr)
{
- out_clear = out_clear_init;
- if (out_count >= out_clear) {
- output(code_clear);
- did_clear();
+ statePtr->outputClear = statePtr->outputClearInit;
+ if (statePtr->outputCount >= statePtr->outputClear) {
+ output(statePtr, statePtr->codeClear);
+ didClear(statePtr);
}
}
-
+
static void
-rl_flush_fromclear(count)
- int count;
+runlengthFlushFromClear(
+ miGIFState_t *statePtr,
+ int count)
{
int n;
- DEBUGMSG(("rl_flush_fromclear %d\n", count));
- max_out_clear();
- rl_table_pixel = rl_pixel;
+ DEBUGMSG(("runlengthFlushFromClear %d\n", count));
+ maxOutputClear(statePtr);
+ statePtr->runlengthTablePixel = statePtr->runlengthPixel;
n = 1;
while (count > 0) {
if (n == 1) {
- rl_table_max = 1;
- output_plain(rl_pixel);
+ statePtr->runlengthTableMax = 1;
+ outputPlain(statePtr, statePtr->runlengthPixel);
count--;
} else if (count >= n) {
- rl_table_max = n;
- output_plain(rl_basecode+n-2);
+ statePtr->runlengthTableMax = n;
+ outputPlain(statePtr, statePtr->runlengthBaseCode+n-2);
count -= n;
} else if (count == 1) {
- rl_table_max++;
- output_plain(rl_pixel);
+ statePtr->runlengthTableMax++;
+ outputPlain(statePtr, statePtr->runlengthPixel);
count = 0;
} else {
- rl_table_max++;
- output_plain(rl_basecode+count-2);
+ statePtr->runlengthTableMax++;
+ outputPlain(statePtr, statePtr->runlengthBaseCode+count-2);
count = 0;
}
- if (out_count == 0) {
+ if (statePtr->outputCount == 0) {
n = 1;
} else {
n++;
}
}
- reset_out_clear();
- DEBUGMSG(("rl_flush_fromclear leaving table_max=%d\n", rl_table_max));
+ resetOutputClear(statePtr);
+ DEBUGMSG(("runlengthFlushFromClear leaving tableMax=%d\n",
+ statePtr->runlengthTableMax));
}
-
+
static void
-rl_flush_clearorrep(count)
- int count;
+runlengthFlushClearOrRep(
+ miGIFState_t *statePtr,
+ int count)
{
int withclr;
- DEBUGMSG(("rl_flush_clearorrep %d\n", count));
- withclr = 1 + compute_triangle_count(count, max_ocodes);
+ DEBUGMSG(("runlengthFlushClearOrRep %d\n", count));
+ withclr = computeTriangleCount((unsigned) count,
+ (unsigned) statePtr->maxOcodes);
if (withclr < count) {
- output(code_clear);
- did_clear();
- rl_flush_fromclear(count);
+ output(statePtr, statePtr->codeClear);
+ didClear(statePtr);
+ runlengthFlushFromClear(statePtr, count);
} else {
for (; count>0 ; count--) {
- output_plain(rl_pixel);
+ outputPlain(statePtr, statePtr->runlengthPixel);
}
}
}
-
+
static void
-rl_flush_withtable(count)
- int count;
+runlengthFlushWithTable(
+ miGIFState_t *statePtr,
+ int count)
{
int repmax;
int repleft;
int leftover;
- DEBUGMSG(("rl_flush_withtable %d\n", count));
- repmax = count / rl_table_max;
- leftover = count % rl_table_max;
+ DEBUGMSG(("runlengthFlushWithTable %d\n", count));
+ repmax = count / statePtr->runlengthTableMax;
+ leftover = count % statePtr->runlengthTableMax;
repleft = (leftover ? 1 : 0);
- if (out_count+repmax+repleft > max_ocodes) {
- repmax = max_ocodes - out_count;
- leftover = count - (repmax * rl_table_max);
- repleft = 1 + compute_triangle_count(leftover, max_ocodes);
+ if (statePtr->outputCount+repmax+repleft > statePtr->maxOcodes) {
+ repmax = statePtr->maxOcodes - statePtr->outputCount;
+ leftover = count - (repmax * statePtr->runlengthTableMax);
+ repleft = computeTriangleCount((unsigned) leftover,
+ (unsigned) statePtr->maxOcodes);
}
- DEBUGMSG(("rl_flush_withtable repmax=%d leftover=%d repleft=%d\n",
+ DEBUGMSG(("runlengthFlushWithTable repmax=%d leftover=%d repleft=%d\n",
repmax, leftover, repleft));
- if (1+(int)compute_triangle_count(count, max_ocodes) < repmax+repleft) {
- output(code_clear);
- did_clear();
- rl_flush_fromclear(count);
+ if (computeTriangleCount((unsigned) count, (unsigned) statePtr->maxOcodes)
+ < repmax+repleft) {
+ output(statePtr, statePtr->codeClear);
+ didClear(statePtr);
+ runlengthFlushFromClear(statePtr, count);
return;
}
- max_out_clear();
+ maxOutputClear(statePtr);
for (; repmax>0 ; repmax--) {
- output_plain(rl_basecode + rl_table_max - 2);
+ outputPlain(statePtr,
+ statePtr->runlengthBaseCode + statePtr->runlengthTableMax - 2);
}
if (leftover) {
- if (just_cleared) {
- rl_flush_fromclear(leftover);
+ if (statePtr->justCleared) {
+ runlengthFlushFromClear(statePtr, leftover);
} else if (leftover == 1) {
- output_plain(rl_pixel);
+ outputPlain(statePtr, statePtr->runlengthPixel);
} else {
- output_plain(rl_basecode + leftover - 2);
+ outputPlain(statePtr, statePtr->runlengthBaseCode + leftover - 2);
}
}
- reset_out_clear();
+ resetOutputClear(statePtr);
}
-
+
static void
-rl_flush()
+runlengthFlush(
+ miGIFState_t *statePtr)
{
- DEBUGMSG(("rl_flush [ %d %d\n", rl_count, rl_pixel));
- if (rl_count == 1) {
- output_plain(rl_pixel);
- rl_count = 0;
- DEBUGMSG(("rl_flush ]\n"));
+ DEBUGMSG(("runlengthFlush [ %d %d\n", statePtr->runlengthCount,
+ statePtr->runlengthPixel));
+ if (statePtr->runlengthCount == 1) {
+ outputPlain(statePtr, statePtr->runlengthPixel);
+ statePtr->runlengthCount = 0;
+ DEBUGMSG(("runlengthFlush ]\n"));
return;
}
- if (just_cleared) {
- rl_flush_fromclear(rl_count);
- } else if ((rl_table_max < 2) || (rl_table_pixel != rl_pixel)) {
- rl_flush_clearorrep(rl_count);
+ if (statePtr->justCleared) {
+ runlengthFlushFromClear(statePtr, statePtr->runlengthCount);
+ } else if ((statePtr->runlengthTableMax < 2)
+ || (statePtr->runlengthTablePixel != statePtr->runlengthPixel)) {
+ runlengthFlushClearOrRep(statePtr, statePtr->runlengthCount);
} else {
- rl_flush_withtable(rl_count);
+ runlengthFlushWithTable(statePtr, statePtr->runlengthCount);
}
- DEBUGMSG(("rl_flush ]\n"));
- rl_count = 0;
+ DEBUGMSG(("runlengthFlush ]\n"));
+ statePtr->runlengthCount = 0;
}
-
-
+
static void
-compress(init_bits, handle, readValue)
- int init_bits;
- Tcl_Channel handle;
- ifunptr readValue;
+compress(
+ int initBits,
+ Tcl_Channel handle,
+ ifunptr readValue,
+ ClientData clientData)
{
int c;
+ miGIFState_t state, *statePtr = &state;
+
+ memset(statePtr, 0, sizeof(state));
+
+ statePtr->ofile = handle;
+ statePtr->obuf = 0;
+ statePtr->obits = 0;
+ statePtr->oblen = 0;
+ statePtr->codeClear = 1 << (initBits - 1);
+ statePtr->codeEOF = statePtr->codeClear + 1;
+ statePtr->runlengthBaseCode = statePtr->codeEOF + 1;
+ statePtr->outputBumpInit = (1 << (initBits - 1)) - 1;
- ofile = handle;
- obuf = 0;
- obits = 0;
- oblen = 0;
- code_clear = 1 << (init_bits - 1);
- code_eof = code_clear + 1;
- rl_basecode = code_eof + 1;
- out_bump_init = (1 << (init_bits - 1)) - 1;
/*
- * For images with a lot of runs, making out_clear_init larger
- * will give better compression.
+ * For images with a lot of runs, making outputClearInit larger will give
+ * better compression.
*/
- out_clear_init = (init_bits <= 3) ? 9 : (out_bump_init-1);
+
+ statePtr->outputClearInit =
+ (initBits <= 3) ? 9 : (statePtr->outputBumpInit-1);
#ifdef MIGIF_DEBUGGING_ENVARS
{
- const char *ocienv;
- ocienv = getenv("MIGIF_OUT_CLEAR_INIT");
+ const char *ocienv = getenv("MIGIF_OUT_CLEAR_INIT");
+
if (ocienv) {
- out_clear_init = atoi(ocienv);
- DEBUGMSG(("[overriding out_clear_init to %d]\n", out_clear_init));
+ statePtr->outputClearInit = atoi(ocienv);
+ DEBUGMSG(("[overriding outputClearInit to %d]\n",
+ statePtr->outputClearInit));
}
}
#endif
- out_bits_init = init_bits;
- max_ocodes = (1 << GIFBITS) - ((1 << (out_bits_init - 1)) + 3);
- did_clear();
- output(code_clear);
- rl_count = 0;
+ statePtr->outputBitsInit = initBits;
+ statePtr->maxOcodes =
+ (1 << GIFBITS) - ((1 << (statePtr->outputBitsInit - 1)) + 3);
+ didClear(statePtr);
+ output(statePtr, statePtr->codeClear);
+ statePtr->runlengthCount = 0;
while (1) {
- c = readValue();
- if ((rl_count > 0) && (c != rl_pixel)) {
- rl_flush();
+ c = readValue(clientData);
+ if (statePtr->runlengthCount>0 && statePtr->runlengthPixel!=c) {
+ runlengthFlush(statePtr);
}
if (c == EOF) {
break;
}
- if (rl_pixel == c) {
- rl_count++;
+ if (statePtr->runlengthPixel == c) {
+ statePtr->runlengthCount++;
} else {
- rl_pixel = c;
- rl_count = 1;
+ statePtr->runlengthPixel = c;
+ statePtr->runlengthCount = 1;
}
}
- output(code_eof);
- output_flush();
+ output(statePtr, statePtr->codeEOF);
+ outputFlush(statePtr);
}
/*
*-----------------------------------------------------------------------
*
- * End of miGIF section - See copyright notice at start of section.
+ * End of miGIF section - See copyright notice at start of section.
*
*-----------------------------------------------------------------------
*/
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index ffa369d..8a46fde 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -6,20 +6,19 @@
* Copyright (c) 1994 The Australian National University.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* Author: Paul Mackerras (paulus@cs.anu.edu.au),
- * Department of Computer Science,
- * Australian National University.
+ * Department of Computer Science,
+ * Australian National University.
*/
#include "tkInt.h"
-#include "tkPort.h"
/*
- * The maximum amount of memory to allocate for data read from the
- * file. If we need more than this, we do it in pieces.
+ * The maximum amount of memory to allocate for data read from the file. If we
+ * need more than this, we do it in pieces.
*/
#define MAX_MEMORY 10000 /* don't allocate > 10KB */
@@ -35,28 +34,23 @@
* The format record for the PPM file format:
*/
-static int FileMatchPPM _ANSI_ARGS_((Tcl_Channel chan,
+static int FileMatchPPM(Tcl_Channel chan, CONST char *fileName,
+ Tcl_Obj *format, int *widthPtr, int *heightPtr,
+ Tcl_Interp *interp);
+static int FileReadPPM(Tcl_Interp *interp, Tcl_Channel chan,
CONST char *fileName, Tcl_Obj *format,
- int *widthPtr, int *heightPtr,
- Tcl_Interp *interp));
-static int FileReadPPM _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, CONST char *fileName,
+ Tk_PhotoHandle imageHandle, int destX, int destY,
+ int width, int height, int srcX, int srcY);
+static int FileWritePPM(Tcl_Interp *interp, CONST char *fileName,
+ Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr);
+static int StringWritePPM(Tcl_Interp *interp, Tcl_Obj *format,
+ Tk_PhotoImageBlock *blockPtr);
+static int StringMatchPPM(Tcl_Obj *dataObj, Tcl_Obj *format,
+ int *widthPtr, int *heightPtr, Tcl_Interp *interp);
+static int StringReadPPM(Tcl_Interp *interp, Tcl_Obj *dataObj,
Tcl_Obj *format, Tk_PhotoHandle imageHandle,
int destX, int destY, int width, int height,
- int srcX, int srcY));
-static int FileWritePPM _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *fileName, Tcl_Obj *format,
- Tk_PhotoImageBlock *blockPtr));
-static int StringWritePPM _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
-static int StringMatchPPM _ANSI_ARGS_((Tcl_Obj *dataObj,
- Tcl_Obj *format, int *widthPtr, int *heightPtr,
- Tcl_Interp *interp));
-static int StringReadPPM _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *dataObj, Tcl_Obj *format,
- Tk_PhotoHandle imageHandle, int destX, int destY,
- int width, int height, int srcX, int srcY));
-
+ int srcX, int srcY);
Tk_PhotoImageFormat tkImgFmtPPM = {
"ppm", /* name */
@@ -69,28 +63,26 @@ Tk_PhotoImageFormat tkImgFmtPPM = {
};
/*
- * Prototypes for local procedures defined in this file:
+ * Prototypes for local functions defined in this file:
*/
-static int ReadPPMFileHeader _ANSI_ARGS_((Tcl_Channel chan,
- int *widthPtr, int *heightPtr,
- int *maxIntensityPtr));
-static int ReadPPMStringHeader _ANSI_ARGS_((Tcl_Obj *dataObj,
- int *widthPtr, int *heightPtr,
- int *maxIntensityPtr,
- unsigned char **dataBufferPtr, int *dataSizePtr));
+static int ReadPPMFileHeader(Tcl_Channel chan, int *widthPtr,
+ int *heightPtr, int *maxIntensityPtr);
+static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr,
+ int *heightPtr, int *maxIntensityPtr,
+ unsigned char **dataBufferPtr, int *dataSizePtr);
/*
*----------------------------------------------------------------------
*
* FileMatchPPM --
*
- * This procedure is invoked by the photo image type to see if
- * a file contains image data in PPM format.
+ * This function is invoked by the photo image type to see if a file
+ * contains image data in PPM format.
*
* Results:
- * The return value is >0 if the first characters in file "f" look
- * like PPM data, and 0 otherwise.
+ * The return value is >0 if the first characters in file "f" look like
+ * PPM data, and 0 otherwise.
*
* Side effects:
* The access position in f may change.
@@ -99,14 +91,15 @@ static int ReadPPMStringHeader _ANSI_ARGS_((Tcl_Obj *dataObj,
*/
static int
-FileMatchPPM(chan, fileName, format, widthPtr, heightPtr, interp)
- Tcl_Channel chan; /* The image file, open for reading. */
- CONST char *fileName; /* The name of the image file. */
- Tcl_Obj *format; /* User-specified format string, or NULL. */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here if the file is a valid
- * raw PPM file. */
- Tcl_Interp *interp;
+FileMatchPPM(
+ Tcl_Channel chan, /* The image file, open for reading. */
+ CONST char *fileName, /* The name of the image file. */
+ Tcl_Obj *format, /* User-specified format string, or NULL. */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here if the file is a valid raw PPM
+ * file. */
+ Tcl_Interp *interp) /* unused */
{
int dummy;
@@ -118,35 +111,33 @@ FileMatchPPM(chan, fileName, format, widthPtr, heightPtr, interp)
*
* FileReadPPM --
*
- * This procedure is called by the photo image type to read
- * PPM format data from a file and write it into a given
- * photo image.
+ * This function is called by the photo image type to read PPM format
+ * data from a file and write it into a given photo image.
*
* Results:
- * A standard TCL completion code. If TCL_ERROR is returned
- * then an error message is left in the interp's result.
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
*
* Side effects:
- * The access position in file f is changed, and new data is
- * added to the image given by imageHandle.
+ * The access position in file f is changed, and new data is added to the
+ * image given by imageHandle.
*
*----------------------------------------------------------------------
*/
static int
-FileReadPPM(interp, chan, fileName, format, imageHandle, destX, destY,
- width, height, srcX, srcY)
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- Tcl_Channel chan; /* The image file, open for reading. */
- CONST char *fileName; /* The name of the image file. */
- Tcl_Obj *format; /* User-specified format string, or NULL. */
- Tk_PhotoHandle imageHandle; /* The photo image to write into. */
- int destX, destY; /* Coordinates of top-left pixel in
- * photo image to be written to. */
- int width, height; /* Dimensions of block of photo image to
- * be written to. */
- int srcX, srcY; /* Coordinates of top-left pixel to be used
- * in image being read. */
+FileReadPPM(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Channel chan, /* The image file, open for reading. */
+ CONST char *fileName, /* The name of the image file. */
+ Tcl_Obj *format, /* User-specified format string, or NULL. */
+ Tk_PhotoHandle imageHandle, /* The photo image to write into. */
+ int destX, int destY, /* Coordinates of top-left pixel in photo
+ * image to be written to. */
+ int width, int height, /* Dimensions of block of photo image to be
+ * written to. */
+ int srcX, int srcY) /* Coordinates of top-left pixel to be used in
+ * image being read. */
{
int fileWidth, fileHeight, maxIntensity;
int nLines, nBytes, h, type, count;
@@ -185,14 +176,13 @@ FileReadPPM(interp, chan, fileName, format, imageHandle, destX, destY,
}
if (type == PGM) {
- block.pixelSize = 1;
- block.offset[0] = 0;
+ block.pixelSize = 1;
+ block.offset[0] = 0;
block.offset[1] = 0;
block.offset[2] = 0;
- }
- else {
- block.pixelSize = 3;
- block.offset[0] = 0;
+ } else {
+ block.pixelSize = 3;
+ block.offset[0] = 0;
block.offset[1] = 1;
block.offset[2] = 2;
}
@@ -200,7 +190,10 @@ FileReadPPM(interp, chan, fileName, format, imageHandle, destX, destY,
block.width = width;
block.pitch = block.pixelSize * fileWidth;
- Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+ if (Tk_PhotoExpand(interp, imageHandle,
+ destX + width, destY + height) != TCL_OK) {
+ return TCL_ERROR;
+ }
if (srcY > 0) {
Tcl_Seek(chan, (Tcl_WideInt)(srcY * block.pitch), SEEK_CUR);
@@ -239,8 +232,11 @@ FileReadPPM(interp, chan, fileName, format, imageHandle, destX, destY,
}
}
block.height = nLines;
- Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, nLines,
- TK_PHOTO_COMPOSITE_SET);
+ if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
+ width, nLines, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
+ ckfree((char *) pixelPtr);
+ return TCL_ERROR;
+ }
destY += nLines;
}
@@ -253,12 +249,12 @@ FileReadPPM(interp, chan, fileName, format, imageHandle, destX, destY,
*
* FileWritePPM --
*
- * This procedure is invoked to write image data to a file in PPM
- * format.
+ * This function is invoked to write image data to a file in PPM format
+ * (although we can read PGM files, we never write them).
*
* Results:
- * A standard TCL completion code. If TCL_ERROR is returned
- * then an error message is left in the interp's result.
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
*
* Side effects:
* Data is written to the file given by "fileName".
@@ -267,15 +263,14 @@ FileReadPPM(interp, chan, fileName, format, imageHandle, destX, destY,
*/
static int
-FileWritePPM(interp, fileName, format, blockPtr)
- Tcl_Interp *interp;
- CONST char *fileName;
- Tcl_Obj *format;
- Tk_PhotoImageBlock *blockPtr;
+FileWritePPM(
+ Tcl_Interp *interp,
+ CONST char *fileName,
+ Tcl_Obj *format,
+ Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan;
- int w, h;
- int greenOffset, blueOffset, nBytes;
+ int w, h, greenOffset, blueOffset, nBytes;
unsigned char *pixelPtr, *pixLinePtr;
char header[16 + TCL_INTEGER_SPACE * 2];
@@ -312,9 +307,9 @@ FileWritePPM(interp, fileName, format, blockPtr)
for (h = blockPtr->height; h > 0; h--) {
pixelPtr = pixLinePtr;
for (w = blockPtr->width; w > 0; w--) {
- if ((Tcl_Write(chan, (char *) &pixelPtr[0], 1) == -1)
- || (Tcl_Write(chan, (char *) &pixelPtr[greenOffset], 1) == -1)
- || (Tcl_Write(chan, (char *) &pixelPtr[blueOffset], 1) == -1)) {
+ if ( Tcl_Write(chan,(char *)&pixelPtr[0], 1) == -1 ||
+ Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1)==-1 ||
+ Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) ==-1) {
goto writeerror;
}
pixelPtr += blockPtr->pixelSize;
@@ -328,7 +323,7 @@ FileWritePPM(interp, fileName, format, blockPtr)
}
chan = NULL;
- writeerror:
+ writeerror:
Tcl_AppendResult(interp, "error writing \"", fileName, "\": ",
Tcl_PosixError(interp), NULL);
if (chan != NULL) {
@@ -342,12 +337,12 @@ FileWritePPM(interp, fileName, format, blockPtr)
*
* StringWritePPM --
*
- * This procedure is invoked to write image data to a string in PPM
+ * This function is invoked to write image data to a string in PPM
* format.
*
* Results:
- * A standard TCL completion code. If TCL_ERROR is returned
- * then an error message is left in the interp's result.
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
*
* Side effects:
* None.
@@ -356,10 +351,10 @@ FileWritePPM(interp, fileName, format, blockPtr)
*/
static int
-StringWritePPM(interp, format, blockPtr)
- Tcl_Interp *interp;
- Tcl_Obj *format;
- Tk_PhotoImageBlock *blockPtr;
+StringWritePPM(
+ Tcl_Interp *interp,
+ Tcl_Obj *format,
+ Tk_PhotoImageBlock *blockPtr)
{
int w, h, size, greenOffset, blueOffset;
unsigned char *pixLinePtr, *byteArray;
@@ -367,10 +362,12 @@ StringWritePPM(interp, format, blockPtr)
Tcl_Obj *byteArrayObj;
sprintf(header, "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height);
+
/*
* Construct a byte array of the right size with the header and
* get a pointer to the data part of it.
*/
+
size = strlen(header);
byteArrayObj = Tcl_NewByteArrayObj((unsigned char *)header, size);
byteArray = Tcl_SetByteArrayLength(byteArrayObj,
@@ -384,6 +381,7 @@ StringWritePPM(interp, format, blockPtr)
/*
* Check if we can do the data move in single action.
*/
+
if ((greenOffset == 1) && (blueOffset == 2) && (blockPtr->pixelSize == 3)
&& (blockPtr->pitch == (blockPtr->width * 3))) {
memcpy(byteArray, pixLinePtr,
@@ -405,6 +403,7 @@ StringWritePPM(interp, format, blockPtr)
/*
* Return the object in the interpreter result.
*/
+
Tcl_SetObjResult(interp, byteArrayObj);
return TCL_OK;
}
@@ -414,12 +413,12 @@ StringWritePPM(interp, format, blockPtr)
*
* StringMatchPPM --
*
- * This procedure is invoked by the photo image type to see if
- * a string contains image data in PPM format.
+ * This function is invoked by the photo image type to see if a string
+ * contains image data in PPM format.
*
* Results:
- * The return value is >0 if the first characters in file "f" look
- * like PPM data, and 0 otherwise.
+ * The return value is >0 if the first characters in file "f" look like
+ * PPM data, and 0 otherwise.
*
* Side effects:
* The access position in f may change.
@@ -428,13 +427,14 @@ StringWritePPM(interp, format, blockPtr)
*/
static int
-StringMatchPPM(dataObj, format, widthPtr, heightPtr, interp)
- Tcl_Obj *dataObj; /* The image data. */
- Tcl_Obj *format; /* User-specified format string, or NULL. */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here if the file is a valid
- * raw PPM file. */
- Tcl_Interp *interp; /* unused */
+StringMatchPPM(
+ Tcl_Obj *dataObj, /* The image data. */
+ Tcl_Obj *format, /* User-specified format string, or NULL. */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here if the file is a valid raw PPM
+ * file. */
+ Tcl_Interp *interp) /* unused */
{
int dummy;
@@ -447,13 +447,12 @@ StringMatchPPM(dataObj, format, widthPtr, heightPtr, interp)
*
* StringReadPPM --
*
- * This procedure is called by the photo image type to read
- * PPM format data from a string and write it into a given
- * photo image.
+ * This function is called by the photo image type to read PPM format
+ * data from a string and write it into a given photo image.
*
* Results:
- * A standard TCL completion code. If TCL_ERROR is returned
- * then an error message is left in the interp's result.
+ * A standard TCL completion code. If TCL_ERROR is returned then an error
+ * message is left in the interp's result.
*
* Side effects:
* New data is added to the image given by imageHandle.
@@ -462,18 +461,17 @@ StringMatchPPM(dataObj, format, widthPtr, heightPtr, interp)
*/
static int
-StringReadPPM(interp, dataObj, format, imageHandle, destX, destY,
- width, height, srcX, srcY)
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- Tcl_Obj *dataObj; /* The image data. */
- Tcl_Obj *format; /* User-specified format string, or NULL. */
- Tk_PhotoHandle imageHandle; /* The photo image to write into. */
- int destX, destY; /* Coordinates of top-left pixel in
- * photo image to be written to. */
- int width, height; /* Dimensions of block of photo image to
- * be written to. */
- int srcX, srcY; /* Coordinates of top-left pixel to be used
- * in image being read. */
+StringReadPPM(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Obj *dataObj, /* The image data. */
+ Tcl_Obj *format, /* User-specified format string, or NULL. */
+ Tk_PhotoHandle imageHandle, /* The photo image to write into. */
+ int destX, int destY, /* Coordinates of top-left pixel in photo
+ * image to be written to. */
+ int width, int height, /* Dimensions of block of photo image to be
+ * written to. */
+ int srcX, int srcY) /* Coordinates of top-left pixel to be used in
+ * image being read. */
{
int fileWidth, fileHeight, maxIntensity;
int nLines, nBytes, h, type, count, dataSize;
@@ -514,13 +512,13 @@ StringReadPPM(interp, dataObj, format, imageHandle, destX, destY,
}
if (type == PGM) {
- block.pixelSize = 1;
- block.offset[0] = 0;
+ block.pixelSize = 1;
+ block.offset[0] = 0;
block.offset[1] = 0;
block.offset[2] = 0;
} else {
- block.pixelSize = 3;
- block.offset[0] = 0;
+ block.pixelSize = 3;
+ block.offset[0] = 0;
block.offset[1] = 1;
block.offset[2] = 2;
}
@@ -535,21 +533,23 @@ StringReadPPM(interp, dataObj, format, imageHandle, destX, destY,
if (maxIntensity == 255) {
/*
- * We have all the data in memory, so write everything in one
- * go.
+ * We have all the data in memory, so write everything in one go.
*/
+
if (block.pitch*height > dataSize) {
Tcl_AppendResult(interp, "truncated PPM data", NULL);
return TCL_ERROR;
}
block.pixelPtr = dataBuffer + srcX * block.pixelSize;
block.height = height;
- Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, height,
- TK_PHOTO_COMPOSITE_SET);
- return TCL_OK;
+ return Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
+ width, height, TK_PHOTO_COMPOSITE_SET);
}
- Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+ if (Tk_PhotoExpand(interp, imageHandle,
+ destX + width, destY + height) != TCL_OK) {
+ return TCL_ERROR;
+ }
nLines = (MAX_MEMORY + block.pitch - 1) / block.pitch;
if (nLines > height) {
@@ -579,8 +579,11 @@ StringReadPPM(interp, dataObj, format, imageHandle, destX, destY,
}
dataSize -= nBytes;
block.height = nLines;
- Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, nLines,
- TK_PHOTO_COMPOSITE_SET);
+ if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
+ width, nLines, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
+ ckfree((char *) pixelPtr);
+ return TCL_ERROR;
+ }
destY += nLines;
}
@@ -593,16 +596,15 @@ StringReadPPM(interp, dataObj, format, imageHandle, destX, destY,
*
* ReadPPMFileHeader --
*
- * This procedure reads the PPM header from the beginning of a
- * PPM file and returns information from the header.
+ * This function reads the PPM header from the beginning of a PPM file
+ * and returns information from the header.
*
* Results:
- * The return value is PGM if file "f" appears to start with
- * a valid PGM header, PPM if "f" appears to start with a valid
- * PPM header, and 0 otherwise. If the header is valid,
- * then *widthPtr and *heightPtr are modified to hold the
- * dimensions of the image and *maxIntensityPtr is modified to
- * hold the value of a "fully on" intensity value.
+ * The return value is PGM if file "f" appears to start with a valid PGM
+ * header, PPM if "f" appears to start with a valid PPM header, and 0
+ * otherwise. If the header is valid, then *widthPtr and *heightPtr are
+ * modified to hold the dimensions of the image and *maxIntensityPtr is
+ * modified to hold the value of a "fully on" intensity value.
*
* Side effects:
* The access position in f advances.
@@ -611,22 +613,21 @@ StringReadPPM(interp, dataObj, format, imageHandle, destX, destY,
*/
static int
-ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr)
- Tcl_Channel chan; /* Image file to read the header from */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here. */
- int *maxIntensityPtr; /* The maximum intensity value for
- * the image is stored here. */
+ReadPPMFileHeader(
+ Tcl_Channel chan, /* Image file to read the header from. */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here. */
+ int *maxIntensityPtr) /* The maximum intensity value for the image
+ * is stored here. */
{
#define BUFFER_SIZE 1000
- char buffer[BUFFER_SIZE];
- int i, numFields;
- int type = 0;
- char c;
+ char buffer[BUFFER_SIZE], c;
+ int i, numFields, type = 0;
/*
- * Read 4 space-separated fields from the file, ignoring
- * comments (any line that starts with "#").
+ * Read 4 space-separated fields from the file, ignoring comments (any
+ * line that starts with "#").
*/
if (Tcl_Read(chan, &c, 1) != 1) {
@@ -672,7 +673,8 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr)
i++;
}
}
- done:
+
+ done:
buffer[i] = 0;
/*
@@ -698,16 +700,16 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr)
*
* ReadPPMStringHeader --
*
- * This procedure reads the PPM header from the beginning of a
- * PPM-format string and returns information from the header.
+ * This function reads the PPM header from the beginning of a PPM-format
+ * string and returns information from the header.
*
* Results:
- * The return value is PGM if the string appears to start with
- * a valid PGM header, PPM if the string appears to start with
- * a valid PPM header, and 0 otherwise. If the header is valid,
- * then *widthPtr and *heightPtr are modified to hold the
- * dimensions of the image and *maxIntensityPtr is modified to
- * hold the value of a "fully on" intensity value.
+ * The return value is PGM if the string appears to start with a valid
+ * PGM header, PPM if the string appears to start with a valid PPM
+ * header, and 0 otherwise. If the header is valid, then *widthPtr and
+ * *heightPtr are modified to hold the dimensions of the image and
+ * *maxIntensityPtr is modified to hold the value of a "fully on"
+ * intensity value.
*
* Side effects:
* None
@@ -716,28 +718,26 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr)
*/
static int
-ReadPPMStringHeader(dataPtr, widthPtr, heightPtr, maxIntensityPtr,
- dataBufferPtr, dataSizePtr)
- Tcl_Obj *dataPtr; /* Object to read the header from. */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here. */
- int *maxIntensityPtr; /* The maximum intensity value for
- * the image is stored here. */
- unsigned char **dataBufferPtr;
- int *dataSizePtr;
+ReadPPMStringHeader(
+ Tcl_Obj *dataPtr, /* Object to read the header from. */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here. */
+ int *maxIntensityPtr, /* The maximum intensity value for the image
+ * is stored here. */
+ unsigned char **dataBufferPtr,
+ int *dataSizePtr)
{
#define BUFFER_SIZE 1000
- char buffer[BUFFER_SIZE];
- int i, numFields, dataSize;
- int type = 0;
- char c;
+ char buffer[BUFFER_SIZE], c;
+ int i, numFields, dataSize, type = 0;
unsigned char *dataBuffer;
dataBuffer = Tcl_GetByteArrayFromObj(dataPtr, &dataSize);
/*
- * Read 4 space-separated fields from the string, ignoring
- * comments (any line that starts with "#").
+ * Read 4 space-separated fields from the string, ignoring comments (any
+ * line that starts with "#").
*/
if (dataSize-- < 1) {
@@ -787,7 +787,8 @@ ReadPPMStringHeader(dataPtr, widthPtr, heightPtr, maxIntensityPtr,
i++;
}
}
- done:
+
+ done:
buffer[i] = 0;
/*
@@ -811,3 +812,11 @@ ReadPPMStringHeader(dataPtr, widthPtr, heightPtr, maxIntensityPtr,
}
return type;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 3f439de..ef907e6 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -1,17 +1,17 @@
/*
* tkImgPhoto.c --
*
- * Implements images of type "photo" for Tk. Photo images are
- * stored in full color (32 bits per pixel including alpha channel)
- * and displayed using dithering if necessary.
+ * Implements images of type "photo" for Tk. Photo images are stored in
+ * full color (32 bits per pixel including alpha channel) and displayed
+ * using dithering if necessary.
*
* Copyright (c) 1994 The Australian National University.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2002 Donal K. Fellows
+ * Copyright (c) 2002-2003 Donal K. Fellows
* Copyright (c) 2003 ActiveState Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* Author: Paul Mackerras (paulus@cs.anu.edu.au),
* Department of Computer Science,
@@ -19,8 +19,6 @@
*/
#include "tkInt.h"
-#include "tkPort.h"
-#include "tclMath.h"
#include <ctype.h>
#ifdef __WIN32__
@@ -31,12 +29,12 @@
* Declaration for internal Xlib function used here:
*/
-extern int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image));
+extern int _XInitImageFuncPtrs(XImage *image);
/*
- * A signed 8-bit integral type. If chars are unsigned and the compiler
- * isn't an ANSI one, then we have to use short instead (which wastes
- * space) to get signed behavior.
+ * A signed 8-bit integral type. If chars are unsigned and the compiler isn't
+ * an ANSI one, then we have to use short instead (which wastes space) to get
+ * signed behavior.
*/
#if defined(__STDC__) || defined(_AIX)
@@ -50,16 +48,15 @@ extern int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image));
#endif
/*
- * An unsigned 32-bit integral type, used for pixel values.
- * We use int rather than long here to accommodate those systems
- * where longs are 64 bits.
+ * An unsigned 32-bit integral type, used for pixel values. We use int rather
+ * than long here to accommodate those systems where longs are 64 bits.
*/
typedef unsigned int pixel;
/*
- * The maximum number of pixels to transmit to the server in a
- * single XPutImage call.
+ * The maximum number of pixels to transmit to the server in a single
+ * XPutImage call.
*/
#define MAX_PIXELS 65536
@@ -67,20 +64,19 @@ typedef unsigned int pixel;
/*
* The set of colors required to display a photo image in a window depends on:
* - the visual used by the window
- * - the palette, which specifies how many levels of each primary
- * color to use, and
+ * - the palette, which specifies how many levels of each primary color to
+ * use, and
* - the gamma value for the image.
*
- * Pixel values allocated for specific colors are valid only for the
- * colormap in which they were allocated. Sets of pixel values
- * allocated for displaying photos are re-used in other windows if
- * possible, that is, if the display, colormap, palette and gamma
- * values match. A hash table is used to locate these sets of pixel
- * values, using the following data structure as key:
+ * Pixel values allocated for specific colors are valid only for the colormap
+ * in which they were allocated. Sets of pixel values allocated for displaying
+ * photos are re-used in other windows if possible, that is, if the display,
+ * colormap, palette and gamma values match. A hash table is used to locate
+ * these sets of pixel values, using the following data structure as key:
*/
typedef struct {
- Display *display; /* Qualifies the colormap resource ID */
+ Display *display; /* Qualifies the colormap resource ID. */
Colormap colormap; /* Colormap that the windows are using. */
double gamma; /* Gamma exponent value for images. */
Tk_Uid palette; /* Specifies how many shades of each primary
@@ -88,33 +84,33 @@ typedef struct {
} ColorTableId;
/*
- * For a particular (display, colormap, palette, gamma) combination,
- * a data structure of the following type is used to store the allocated
- * pixel values and other information:
+ * For a particular (display, colormap, palette, gamma) combination, a data
+ * structure of the following type is used to store the allocated pixel values
+ * and other information:
*/
typedef struct ColorTable {
- ColorTableId id; /* Information used in selecting this
- * color table. */
+ ColorTableId id; /* Information used in selecting this color
+ * table. */
int flags; /* See below. */
int refCount; /* Number of instances using this map. */
- int liveRefCount; /* Number of instances which are actually
- * in use, using this map. */
+ int liveRefCount; /* Number of instances which are actually in
+ * use, using this map. */
int numColors; /* Number of colors allocated for this map. */
XVisualInfo visualInfo; /* Information about the visual for windows
* using this color table. */
- pixel redValues[256]; /* Maps 8-bit values of red intensity
- * to a pixel value or index in pixelMap. */
- pixel greenValues[256]; /* Ditto for green intensity */
- pixel blueValues[256]; /* Ditto for blue intensity */
+ pixel redValues[256]; /* Maps 8-bit values of red intensity to a
+ * pixel value or index in pixelMap. */
+ pixel greenValues[256]; /* Ditto for green intensity. */
+ pixel blueValues[256]; /* Ditto for blue intensity. */
unsigned long *pixelMap; /* Actual pixel values allocated. */
unsigned char colorQuant[3][256];
/* Maps 8-bit intensities to quantized
- * intensities. The first index is 0 for
- * red, 1 for green, 2 for blue. */
+ * intensities. The first index is 0 for red,
+ * 1 for green, 2 for blue. */
} ColorTable;
/*
@@ -123,12 +119,13 @@ typedef struct ColorTable {
* available.
* COLOR_WINDOW: 1 means a full 3-D color cube has been
* allocated.
- * DISPOSE_PENDING: 1 means a call to DisposeColorTable has
- * been scheduled as an idle handler, but it
- * hasn't been invoked yet.
- * MAP_COLORS: 1 means pixel values should be mapped
- * through pixelMap.
+ * DISPOSE_PENDING: 1 means a call to DisposeColorTable has been
+ * scheduled as an idle handler, but it hasn't
+ * been invoked yet.
+ * MAP_COLORS: 1 means pixel values should be mapped through
+ * pixelMap.
*/
+
#ifdef COLOR_WINDOW
#undef COLOR_WINDOW
#endif
@@ -143,14 +140,13 @@ typedef struct ColorTable {
*/
typedef struct PhotoMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means
- * the image is being deleted. */
- Tcl_Interp *interp; /* Interpreter associated with the
- * application using this image. */
- Tcl_Command imageCmd; /* Token for image command (used to delete
- * it when the image goes away). NULL means
- * the image command has already been
- * deleted. */
+ Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+ * image is being deleted. */
+ Tcl_Interp *interp; /* Interpreter associated with the application
+ * using this image. */
+ Tcl_Command imageCmd; /* Token for image command (used to delete it
+ * when the image goes away). NULL means the
+ * image command has already been deleted. */
int flags; /* Sundry flags, defined below. */
int width, height; /* Dimensions of image. */
int userWidth, userHeight; /* User-declared image dimensions. */
@@ -159,26 +155,27 @@ typedef struct PhotoMaster {
double gamma; /* Display gamma value to correct for. */
char *fileString; /* Name of file to read into image. */
Tcl_Obj *dataString; /* Object to use as contents of image. */
- Tcl_Obj *format; /* User-specified format of data in image
- * file or string value. */
+ Tcl_Obj *format; /* User-specified format of data in image file
+ * or string value. */
unsigned char *pix32; /* Local storage for 32-bit image. */
- int ditherX, ditherY; /* Location of first incorrectly
- * dithered pixel in image. */
- TkRegion validRegion; /* Tk region indicating which parts of
- * the image have valid image data. */
+ int ditherX, ditherY; /* Location of first incorrectly dithered
+ * pixel in image. */
+ TkRegion validRegion; /* Tk region indicating which parts of the
+ * image have valid image data. */
struct PhotoInstance *instancePtr;
- /* First in the list of instances
- * associated with this master. */
+ /* First in the list of instances associated
+ * with this master. */
} PhotoMaster;
/*
* Bit definitions for the flags field of a PhotoMaster.
* COLOR_IMAGE: 1 means that the image has different color
* components.
- * IMAGE_CHANGED: 1 means that the instances of this image
- * need to be redithered.
- * COMPLEX_ALPHA: 1 means that the instances of this image
- * have alpha values that aren't 0 or 255.
+ * IMAGE_CHANGED: 1 means that the instances of this image need
+ * to be redithered.
+ * COMPLEX_ALPHA: 1 means that the instances of this image have
+ * alpha values that aren't 0 or 255, and so need
+ * the copy-merge-replace renderer .
*/
#define COLOR_IMAGE 1
@@ -193,9 +190,8 @@ typedef struct PhotoMaster {
#define SOURCE_IS_SIMPLE_ALPHA_PHOTO 0x10000000
/*
- * The following data structure represents all of the instances of
- * a photo image in windows on a given screen that are using the
- * same colormap.
+ * The following data structure represents all of the instances of a photo
+ * image in windows on a given screen that are using the same colormap.
*/
typedef struct PhotoInstance {
@@ -204,34 +200,34 @@ typedef struct PhotoInstance {
Colormap colormap; /* The image may only be used in windows with
* this particular colormap. */
struct PhotoInstance *nextPtr;
- /* Pointer to the next instance in the list
- * of instances associated with this master. */
+ /* Pointer to the next instance in the list of
+ * instances associated with this master. */
int refCount; /* Number of instances using this structure. */
Tk_Uid palette; /* Palette for these particular instances. */
double gamma; /* Gamma value for these instances. */
- Tk_Uid defaultPalette; /* Default palette to use if a palette
- * is not specified for the master. */
+ Tk_Uid defaultPalette; /* Default palette to use if a palette is not
+ * specified for the master. */
ColorTable *colorTablePtr; /* Pointer to information about colors
- * allocated for image display in windows
- * like this one. */
+ * allocated for image display in windows like
+ * this one. */
Pixmap pixels; /* X pixmap containing dithered image. */
int width, height; /* Dimensions of the pixmap. */
schar *error; /* Error image, used in dithering. */
XImage *imagePtr; /* Image structure for converted pixels. */
XVisualInfo visualInfo; /* Information about the visual that these
* windows are using. */
- GC gc; /* Graphics context for writing images
- * to the pixmap. */
+ GC gc; /* Graphics context for writing images to the
+ * pixmap. */
} PhotoInstance;
/*
- * The following data structure is used to return information
- * from ParseSubcommandOptions:
+ * The following data structure is used to return information from
+ * ParseSubcommandOptions:
*/
struct SubcommandOptions {
- int options; /* Individual bits indicate which
- * options were specified - see below. */
+ int options; /* Individual bits indicate which options were
+ * specified - see below. */
Tcl_Obj *name; /* Name specified without an option. */
int fromX, fromY; /* Values specified for -from option. */
int fromX2, fromY2; /* Second coordinate pair for -from option. */
@@ -241,15 +237,16 @@ struct SubcommandOptions {
int subsampleX, subsampleY; /* Values specified for -subsample option. */
Tcl_Obj *format; /* Value specified for -format option. */
XColor *background; /* Value specified for -background option. */
- int compositingRule; /* Value specified for -compositingrule opt */
+ int compositingRule; /* Value specified for -compositingrule
+ * option. */
};
/*
- * Bit definitions for use with ParseSubcommandOptions:
- * Each bit is set in the allowedOptions parameter on a call to
- * ParseSubcommandOptions if that option is allowed for the current
- * photo image subcommand. On return, the bit is set in the options
- * field of the SubcommandOptions structure if that option was specified.
+ * Bit definitions for use with ParseSubcommandOptions: each bit is set in the
+ * allowedOptions parameter on a call to ParseSubcommandOptions if that option
+ * is allowed for the current photo image subcommand. On return, the bit is
+ * set in the options field of the SubcommandOptions structure if that option
+ * was specified.
*
* OPT_BACKGROUND: Set if -format option allowed/specified.
* OPT_COMPOSITE: Set if -compositingrule option allowed/spec'd.
@@ -273,8 +270,8 @@ struct SubcommandOptions {
#define OPT_ZOOM 0x100
/*
- * List of option names. The order here must match the order of
- * declarations of the OPT_* constants above.
+ * List of option names. The order here must match the order of declarations
+ * of the OPT_* constants above.
*/
static char *optionNames[] = {
@@ -287,13 +284,14 @@ static char *optionNames[] = {
"-subsample",
"-to",
"-zoom",
- (char *) NULL
+ NULL
};
/*
- * Message to generate when an attempt to resize an image fails due
- * to memory problems.
+ * Message to generate when an attempt to resize an image fails due to memory
+ * problems.
*/
+
#define TK_PHOTO_ALLOC_FAILURE_MESSAGE \
"not enough free memory for image buffer"
@@ -301,23 +299,21 @@ static char *optionNames[] = {
* Functions used in the type record for photo images.
*/
-static int ImgPhotoCreate _ANSI_ARGS_((Tcl_Interp *interp,
- char *name, int objc, Tcl_Obj *CONST objv[],
+static int ImgPhotoCreate(Tcl_Interp *interp, char *name,
+ int objc, Tcl_Obj *CONST objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *clientDataPtr));
-static ClientData ImgPhotoGet _ANSI_ARGS_((Tk_Window tkwin,
- ClientData clientData));
-static void ImgPhotoDisplay _ANSI_ARGS_((ClientData clientData,
+ ClientData *clientDataPtr);
+static ClientData ImgPhotoGet(Tk_Window tkwin, ClientData clientData);
+static void ImgPhotoDisplay(ClientData clientData,
Display *display, Drawable drawable,
int imageX, int imageY, int width, int height,
- int drawableX, int drawableY));
-static void ImgPhotoFree _ANSI_ARGS_((ClientData clientData,
- Display *display));
-static void ImgPhotoDelete _ANSI_ARGS_((ClientData clientData));
-static int ImgPhotoPostscript _ANSI_ARGS_((ClientData clientData,
+ int drawableX, int drawableY);
+static void ImgPhotoFree(ClientData clientData, Display *display);
+static void ImgPhotoDelete(ClientData clientData);
+static int ImgPhotoPostscript(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
Tk_PostscriptInfo psInfo, int x, int y, int width,
- int height, int prepass));
+ int height, int prepass);
/*
* The type record itself for photo images:
@@ -331,15 +327,18 @@ Tk_ImageType tkPhotoImageType = {
ImgPhotoFree, /* freeProc */
ImgPhotoDelete, /* deleteProc */
ImgPhotoPostscript, /* postscriptProc */
- (Tk_ImageType *) NULL /* nextPtr */
+ NULL /* nextPtr */
};
typedef struct ThreadSpecificData {
- Tk_PhotoImageFormat *formatList; /* Pointer to the first in the
- * list of known photo image formats.*/
- Tk_PhotoImageFormat *oldFormatList; /* Pointer to the first in the
- * list of known photo image formats.*/
- int initialized; /* set to 1 if we've initialized the strucuture */
+ Tk_PhotoImageFormat *formatList;
+ /* Pointer to the first in the list of known
+ * photo image formats.*/
+ Tk_PhotoImageFormat *oldFormatList;
+ /* Pointer to the first in the list of known
+ * photo image formats.*/
+ int initialized; /* Set to 1 if we've initialized the
+ * strucuture. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -355,24 +354,24 @@ static Tcl_ThreadDataKey dataKey;
/*
* Information used for parsing configuration specifications:
*/
+
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_STRING, "-file", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(PhotoMaster, fileString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_DOUBLE, "-gamma", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_STRING, "-file", NULL, NULL,
+ NULL, Tk_Offset(PhotoMaster, fileString), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL,
DEF_PHOTO_GAMMA, Tk_Offset(PhotoMaster, gamma), 0},
- {TK_CONFIG_INT, "-height", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_INT, "-height", NULL, NULL,
DEF_PHOTO_HEIGHT, Tk_Offset(PhotoMaster, userHeight), 0},
- {TK_CONFIG_UID, "-palette", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_UID, "-palette", NULL, NULL,
DEF_PHOTO_PALETTE, Tk_Offset(PhotoMaster, palette), 0},
- {TK_CONFIG_INT, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_INT, "-width", NULL, NULL,
DEF_PHOTO_WIDTH, Tk_Offset(PhotoMaster, userWidth), 0},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Hash table used to hash from (display, colormap, palette, gamma)
- * to ColorTable address.
+ * Hash table used to hash from (display, colormap, palette, gamma) to
+ * ColorTable address.
*/
static Tcl_HashTable imgPhotoColorHash;
@@ -392,61 +391,53 @@ static int imgPhotoColorHashInitialized;
* Forward declarations
*/
-static void PhotoFormatThreadExitProc _ANSI_ARGS_((
- ClientData clientData));
-static int ImgPhotoCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-static int ParseSubcommandOptions _ANSI_ARGS_((
+static void PhotoFormatThreadExitProc(ClientData clientData);
+static int ImgPhotoCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int ParseSubcommandOptions(
struct SubcommandOptions *optPtr,
Tcl_Interp *interp, int allowedOptions,
- int *indexPtr, int objc, Tcl_Obj *CONST objv[]));
-static void ImgPhotoCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static int ImgPhotoConfigureMaster _ANSI_ARGS_((
- Tcl_Interp *interp, PhotoMaster *masterPtr,
- int objc, Tcl_Obj *CONST objv[], int flags));
-static void ImgPhotoConfigureInstance _ANSI_ARGS_((
- PhotoInstance *instancePtr));
-static int ToggleComplexAlphaIfNeeded _ANSI_ARGS_((
- PhotoMaster *mPtr));
-static void ImgPhotoBlendComplexAlpha _ANSI_ARGS_((
- XImage *bgImg, PhotoInstance *iPtr,
- int xOffset, int yOffset, int width, int height));
-static int ImgPhotoSetSize _ANSI_ARGS_((PhotoMaster *masterPtr,
- int width, int height));
-static void ImgPhotoInstanceSetSize _ANSI_ARGS_((
- PhotoInstance *instancePtr));
-static int ImgStringWrite _ANSI_ARGS_((Tcl_Interp *interp,
+ int *indexPtr, int objc, Tcl_Obj *const objv[]);
+static void ImgPhotoCmdDeletedProc(ClientData clientData);
+static int ImgPhotoConfigureMaster(Tcl_Interp *interp,
+ PhotoMaster *masterPtr, int objc,
+ Tcl_Obj *const objv[], int flags);
+static void ImgPhotoConfigureInstance(PhotoInstance *instancePtr);
+static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr);
+static void ImgPhotoBlendComplexAlpha(XImage *bgImg,
+ PhotoInstance *iPtr, int xOffset, int yOffset,
+ int width, int height);
+static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width,
+ int height);
+static void ImgPhotoInstanceSetSize(PhotoInstance *instancePtr);
+static int ImgStringWrite(Tcl_Interp *interp,
Tcl_Obj *formatString,
- Tk_PhotoImageBlock *blockPtr));
-static char * ImgGetPhoto _ANSI_ARGS_((PhotoMaster *masterPtr,
+ Tk_PhotoImageBlock *blockPtr);
+static char * ImgGetPhoto(PhotoMaster *masterPtr,
Tk_PhotoImageBlock *blockPtr,
- struct SubcommandOptions *optPtr));
-static int IsValidPalette _ANSI_ARGS_((PhotoInstance *instancePtr,
- CONST char *palette));
-static int CountBits _ANSI_ARGS_((pixel mask));
-static void GetColorTable _ANSI_ARGS_((PhotoInstance *instancePtr));
-static void FreeColorTable _ANSI_ARGS_((ColorTable *colorPtr,
- int force));
-static void AllocateColors _ANSI_ARGS_((ColorTable *colorPtr));
-static void DisposeColorTable _ANSI_ARGS_((ClientData clientData));
-static void DisposeInstance _ANSI_ARGS_((ClientData clientData));
-static int ReclaimColors _ANSI_ARGS_((ColorTableId *id,
- int numColors));
-static int MatchFileFormat _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, char *fileName, Tcl_Obj *formatString,
+ struct SubcommandOptions *optPtr);
+static int IsValidPalette(PhotoInstance *instancePtr,
+ const char *palette);
+static int CountBits(pixel mask);
+static void GetColorTable(PhotoInstance *instancePtr);
+static void FreeColorTable(ColorTable *colorPtr, int force);
+static void AllocateColors(ColorTable *colorPtr);
+static void DisposeColorTable(ClientData clientData);
+static void DisposeInstance(ClientData clientData);
+static int ReclaimColors(ColorTableId *id, int numColors);
+static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan,
+ char *fileName, Tcl_Obj *formatString,
Tk_PhotoImageFormat **imageFormatPtr,
- int *widthPtr, int *heightPtr, int *oldformat));
-static int MatchStringFormat _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *data, Tcl_Obj *formatString,
+ int *widthPtr, int *heightPtr, int *oldformat);
+static int MatchStringFormat(Tcl_Interp *interp, Tcl_Obj *data,
+ Tcl_Obj *formatString,
Tk_PhotoImageFormat **imageFormatPtr,
- int *widthPtr, int *heightPtr, int *oldformat));
-static Tcl_ObjCmdProc * PhotoOptionFind _ANSI_ARGS_((Tcl_Interp * interp,
- Tcl_Obj *obj));
-static void DitherInstance _ANSI_ARGS_((PhotoInstance *instancePtr,
- int x, int y, int width, int height));
-static void PhotoOptionCleanupProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp));
+ int *widthPtr, int *heightPtr, int *oldformat);
+static Tcl_ObjCmdProc * PhotoOptionFind(Tcl_Interp *interp, Tcl_Obj *obj);
+static void DitherInstance(PhotoInstance *instancePtr, int x,
+ int y, int width, int height);
+static void PhotoOptionCleanupProc(ClientData clientData,
+ Tcl_Interp *interp);
#undef MIN
#define MIN(a, b) ((a) < (b)? (a): (b))
@@ -456,35 +447,30 @@ static void PhotoOptionCleanupProc _ANSI_ARGS_((
/*
*----------------------------------------------------------------------
*
- * Tk_CreateOldPhotoImageFormat, Tk_CreatePhotoImageFormat --
+ * PhotoFormatThreadExitProc --
*
- * This procedure is invoked by an image file handler to register
- * a new photo image format and the procedures that handle the
- * new format. The procedure is typically invoked during
- * Tcl_AppInit.
+ * Clean up the registered list of photo formats.
*
* Results:
* None.
*
* Side effects:
- * The new image file format is entered into a table used in the
- * photo image "read" and "write" subcommands.
+ * The thread's linked lists of photo image formats is deleted.
*
*----------------------------------------------------------------------
*/
static void
-PhotoFormatThreadExitProc(clientData)
- ClientData clientData; /* not used */
+PhotoFormatThreadExitProc(
+ ClientData clientData) /* not used */
{
Tk_PhotoImageFormat *freePtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
while (tsdPtr->oldFormatList != NULL) {
freePtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
- ckfree((char *) freePtr->name);
ckfree((char *) freePtr);
}
while (tsdPtr->formatList != NULL) {
@@ -500,31 +486,30 @@ PhotoFormatThreadExitProc(clientData)
*
* Tk_CreateOldPhotoImageFormat, Tk_CreatePhotoImageFormat --
*
- * This procedure is invoked by an image file handler to register
- * a new photo image format and the procedures that handle the
- * new format. The procedure is typically invoked during
- * Tcl_AppInit.
+ * This function is invoked by an image file handler to register a new
+ * photo image format and the functions that handle the new format. The
+ * function is typically invoked during Tcl_AppInit.
*
* Results:
* None.
*
* Side effects:
- * The new image file format is entered into a table used in the
- * photo image "read" and "write" subcommands.
+ * The new image file format is entered into a table used in the photo
+ * image "read" and "write" subcommands.
*
*----------------------------------------------------------------------
*/
+
void
-Tk_CreateOldPhotoImageFormat(formatPtr)
- Tk_PhotoImageFormat *formatPtr;
- /* Structure describing the format. All of
- * the fields except "nextPtr" must be filled
- * in by caller. Must not have been passed
- * to Tk_CreatePhotoImageFormat previously. */
+Tk_CreateOldPhotoImageFormat(
+ Tk_PhotoImageFormat *formatPtr)
+ /* Structure describing the format. All of the
+ * fields except "nextPtr" must be filled in
+ * by caller. */
{
Tk_PhotoImageFormat *copyPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
@@ -532,23 +517,20 @@ Tk_CreateOldPhotoImageFormat(formatPtr)
}
copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
- copyPtr->name = (char *) ckalloc((unsigned) (strlen(formatPtr->name) + 1));
- strcpy(copyPtr->name, formatPtr->name);
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
}
void
-Tk_CreatePhotoImageFormat(formatPtr)
- Tk_PhotoImageFormat *formatPtr;
- /* Structure describing the format. All of
- * the fields except "nextPtr" must be filled
- * in by caller. Must not have been passed
- * to Tk_CreatePhotoImageFormat previously. */
+Tk_CreatePhotoImageFormat(
+ Tk_PhotoImageFormat *formatPtr)
+ /* Structure describing the format. All of the
+ * fields except "nextPtr" must be filled in
+ * by caller. */
{
Tk_PhotoImageFormat *copyPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
@@ -556,12 +538,14 @@ Tk_CreatePhotoImageFormat(formatPtr)
}
copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
- copyPtr->name = (char *) ckalloc((unsigned) (strlen(formatPtr->name) + 1));
- strcpy(copyPtr->name, formatPtr->name);
if (isupper((unsigned char) *formatPtr->name)) {
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
} else {
+ /* for compatibility with aMSN: make a copy of formatPtr->name */
+ char *name = ckalloc(strlen(formatPtr->name) + 1);
+ strcpy(name, formatPtr->name);
+ copyPtr->name = name;
copyPtr->nextPtr = tsdPtr->formatList;
tsdPtr->formatList = copyPtr;
}
@@ -572,32 +556,31 @@ Tk_CreatePhotoImageFormat(formatPtr)
*
* ImgPhotoCreate --
*
- * This procedure is called by the Tk image code to create
- * a new photo image.
+ * This function is called by the Tk image code to create a new photo
+ * image.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * The data structure for a new photo image is allocated and
- * initialized.
+ * The data structure for a new photo image is allocated and initialized.
*
*----------------------------------------------------------------------
*/
static int
-ImgPhotoCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
- Tcl_Interp *interp; /* Interpreter for application containing
+ImgPhotoCreate(
+ Tcl_Interp *interp, /* Interpreter for application containing
* image. */
- char *name; /* Name to use for image. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects for options (doesn't
+ char *name, /* Name to use for image. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[], /* Argument objects for options (doesn't
* include image name or type). */
- Tk_ImageType *typePtr; /* Pointer to our type record (not used). */
- Tk_ImageMaster master; /* Token for image, to be used by us in
- * later callbacks. */
- ClientData *clientDataPtr; /* Store manager's token for image here;
- * it will be returned in later callbacks. */
+ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
+ Tk_ImageMaster master, /* Token for image, to be used by us in later
+ * callbacks. */
+ ClientData *clientDataPtr) /* Store manager's token for image here; it
+ * will be returned in later callbacks. */
{
PhotoMaster *masterPtr;
@@ -606,7 +589,7 @@ ImgPhotoCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
*/
masterPtr = (PhotoMaster *) ckalloc(sizeof(PhotoMaster));
- memset((void *) masterPtr, 0, sizeof(PhotoMaster));
+ memset(masterPtr, 0, sizeof(PhotoMaster));
masterPtr->tkMaster = master;
masterPtr->interp = interp;
masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
@@ -634,9 +617,9 @@ ImgPhotoCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
*
* ImgPhotoCmd --
*
- * This procedure is invoked to process the Tcl command that
- * corresponds to a photo image. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a photo image. See the user documentation for details on what it
+ * does.
*
* Results:
* A standard Tcl result.
@@ -648,42 +631,35 @@ ImgPhotoCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
*/
static int
-ImgPhotoCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about photo master. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+ImgPhotoCmd(
+ ClientData clientData, /* Information about photo master. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- int oldformat = 0;
- static CONST char *photoOptions[] = {
+ static const char *photoOptions[] = {
"blank", "cget", "configure", "copy", "data", "get", "put",
- "read", "redither", "transparency", "write", (char *) NULL
+ "read", "redither", "transparency", "write", NULL
};
- enum options {
+ enum PhotoOptions {
PHOTO_BLANK, PHOTO_CGET, PHOTO_CONFIGURE, PHOTO_COPY, PHOTO_DATA,
PHOTO_GET, PHOTO_PUT, PHOTO_READ, PHOTO_REDITHER, PHOTO_TRANS,
PHOTO_WRITE
};
PhotoMaster *masterPtr = (PhotoMaster *) clientData;
- int result, index;
- int x, y, width, height;
- int dataWidth, dataHeight;
+ int result, index, x, y, width, height, dataWidth, dataHeight, listObjc;
struct SubcommandOptions options;
- int listArgc;
- CONST char **listArgv;
- CONST char **srcArgv;
+ Tcl_Obj **listObjv, **srcObjv;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
Tk_Window tkwin;
- XColor color;
Tk_PhotoImageFormat *imageFormat;
- int imageWidth, imageHeight;
- int length, matched;
+ int imageWidth, imageHeight, matched, length, oldformat = 0;
Tcl_Channel chan;
Tk_PhotoHandle srcHandle;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
@@ -694,13 +670,13 @@ ImgPhotoCmd(clientData, interp, objc, objv)
&index) != TCL_OK) {
Tcl_ObjCmdProc *proc;
proc = PhotoOptionFind(interp, objv[1]);
- if (proc == (Tcl_ObjCmdProc *) NULL) {
+ if (proc == NULL) {
return TCL_ERROR;
}
return proc(clientData, interp, objc, objv);
}
- switch ((enum options) index) {
+ switch ((enum PhotoOptions) index) {
case PHOTO_BLANK:
/*
* photo blank command - just call Tk_PhotoBlank.
@@ -710,7 +686,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
Tk_PhotoBlank(masterPtr);
return TCL_OK;
} else {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
@@ -744,53 +720,51 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (objc == 2) {
Tcl_Obj *obj, *subobj;
+
result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, (char *) NULL, 0);
+ configSpecs, (char *) masterPtr, NULL, 0);
if (result != TCL_OK) {
return result;
}
obj = Tcl_NewObj();
subobj = Tcl_NewStringObj("-data {} {} {}", 14);
if (masterPtr->dataString) {
- Tcl_ListObjAppendElement(interp, subobj, masterPtr->dataString);
+ Tcl_ListObjAppendElement(NULL, subobj, masterPtr->dataString);
} else {
- Tcl_AppendStringsToObj(subobj, " {}", (char *) NULL);
+ Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewStringObj("-format {} {} {}", 16);
if (masterPtr->format) {
- Tcl_ListObjAppendElement(interp, subobj, masterPtr->format);
+ Tcl_ListObjAppendElement(NULL, subobj, masterPtr->format);
} else {
- Tcl_AppendStringsToObj(subobj, " {}", (char *) NULL);
+ Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp));
Tcl_SetObjResult(interp, obj);
return TCL_OK;
- }
- if (objc == 3) {
+
+ } else if (objc == 3) {
char *arg = Tcl_GetStringFromObj(objv[2], &length);
- if (!strncmp(arg, "-data", (unsigned) length)) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "-data {} {} {}", (char *) NULL);
+ if (length > 1 && !strncmp(arg, "-data", (unsigned) length)) {
+ Tcl_AppendResult(interp, "-data {} {} {}", NULL);
if (masterPtr->dataString) {
Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
masterPtr->dataString);
} else {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- " {}", (char *) NULL);
+ Tcl_AppendResult(interp, " {}", NULL);
}
return TCL_OK;
- } else if (!strncmp(arg, "-format", (unsigned) length)) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "-format {} {} {}", (char *) NULL);
+ } else if (length > 1 &&
+ !strncmp(arg, "-format", (unsigned) length)) {
+ Tcl_AppendResult(interp, "-format {} {} {}", NULL);
if (masterPtr->format) {
Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
masterPtr->format);
} else {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- " {}", (char *) NULL);
+ Tcl_AppendResult(interp, " {}", NULL);
}
return TCL_OK;
} else {
@@ -807,7 +781,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
*/
index = 2;
- memset((VOID *) &options, 0, sizeof(options));
+ memset(&options, 0, sizeof(options));
options.zoomX = options.zoomY = 1;
options.subsampleX = options.subsampleY = 1;
options.name = NULL;
@@ -832,7 +806,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (srcHandle == NULL) {
Tcl_AppendResult(interp, "image \"",
Tcl_GetString(options.name), "\" doesn't",
- " exist or is not a photo image", (char *) NULL);
+ " exist or is not a photo image", NULL);
return TCL_ERROR;
}
Tk_PhotoGetImage(srcHandle, &block);
@@ -840,7 +814,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
|| (options.fromX2 > block.width)
|| (options.fromY2 > block.height)) {
Tcl_AppendResult(interp, "coordinates for -from option extend ",
- "outside source image", (char *) NULL);
+ "outside source image", NULL);
return TCL_ERROR;
}
@@ -893,8 +867,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (ImgPhotoSetSize(masterPtr, options.toX2,
options.toY2) != TCL_OK) {
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- TK_PHOTO_ALLOC_FAILURE_MESSAGE, (char *) NULL);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
return TCL_ERROR;
}
}
@@ -907,12 +880,11 @@ ImgPhotoCmd(clientData, interp, objc, objv)
+ options.fromY * block.pitch;
block.width = options.fromX2 - options.fromX;
block.height = options.fromY2 - options.fromY;
- Tk_PhotoPutZoomedBlock((Tk_PhotoHandle) masterPtr, &block,
- options.toX, options.toY, options.toX2 - options.toX,
+ return Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr,
+ &block, options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY, options.zoomX, options.zoomY,
options.subsampleX, options.subsampleY,
options.compositingRule);
- return TCL_OK;
case PHOTO_DATA: {
char *data;
@@ -920,10 +892,11 @@ ImgPhotoCmd(clientData, interp, objc, objv)
/*
* photo data command - first parse and check any options given.
*/
+
Tk_ImageStringWriteProc *stringWriteProc = NULL;
index = 2;
- memset((VOID *) &options, 0, sizeof(options));
+ memset(&options, 0, sizeof(options));
options.name = NULL;
options.format = NULL;
options.fromX = 0;
@@ -942,7 +915,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
|| (options.fromX2 > masterPtr->width)
|| (options.fromY2 > masterPtr->height)) {
Tcl_AppendResult(interp, "coordinates for -from option extend ",
- "outside image", (char *) NULL);
+ "outside image", NULL);
return TCL_ERROR;
}
@@ -990,8 +963,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (stringWriteProc == NULL) {
Tcl_AppendResult(interp, "image string format \"",
Tcl_GetString(options.format), "\" is ",
- (matched ? "not supported" : "unknown"),
- (char *) NULL);
+ (matched ? "not supported" : "unknown"), NULL);
return TCL_ERROR;
}
} else {
@@ -999,8 +971,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
/*
- * Call the handler's string write procedure to write out
- * the image.
+ * Call the handler's string write function to write out the image.
*/
data = ImgGetPhoto(masterPtr, &block, &options);
@@ -1009,9 +980,9 @@ ImgPhotoCmd(clientData, interp, objc, objv)
Tcl_DString buffer;
Tcl_DStringInit(&buffer);
- result = ((int (*) _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_DString *buffer, char *formatString,
- Tk_PhotoImageBlock *blockPtr))) stringWriteProc)
+ result = ((int (*) (Tcl_Interp *interp,
+ Tcl_DString *dataPtr, char *formatString,
+ Tk_PhotoImageBlock *blockPtr)) stringWriteProc)
(interp, &buffer, Tcl_GetString(options.format), &block);
if (result == TCL_OK) {
Tcl_DStringResult(interp, &buffer);
@@ -1019,10 +990,11 @@ ImgPhotoCmd(clientData, interp, objc, objv)
Tcl_DStringFree(&buffer);
}
} else {
- result = ((int (*) _ANSI_ARGS_((Tcl_Interp *interp,
+
+ result = ((int (*) (Tcl_Interp *interp,
Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr,
- VOID *dummy))) stringWriteProc)
- (interp, options.format, &block, (VOID *) NULL);
+ void *dummy)) stringWriteProc)
+ (interp, options.format, &block, NULL);
}
if (options.background) {
Tk_FreeColor(options.background);
@@ -1051,7 +1023,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if ((x < 0) || (x >= masterPtr->width)
|| (y < 0) || (y >= masterPtr->height)) {
Tcl_AppendResult(interp, Tcl_GetString(objv[0]), " get: ",
- "coordinates out of range", (char *) NULL);
+ "coordinates out of range", NULL);
return TCL_ERROR;
}
@@ -1062,7 +1034,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
sprintf(string, "%d %d %d", pixelPtr[0], pixelPtr[1],
pixelPtr[2]);
- Tcl_AppendResult(interp, string, (char *) NULL);
+ Tcl_AppendResult(interp, string, NULL);
return TCL_OK;
}
@@ -1072,7 +1044,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
*/
index = 2;
- memset((VOID *) &options, 0, sizeof(options));
+ memset(&options, 0, sizeof(options));
options.name = NULL;
if (ParseSubcommandOptions(&options, interp, OPT_TO|OPT_FORMAT,
&index, objc, objv) != TCL_OK) {
@@ -1083,7 +1055,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
- if (MatchStringFormat(interp, options.name ? objv[2]:NULL,
+ if (MatchStringFormat(interp, options.name ? objv[2]:NULL,
options.format, &imageFormat, &imageWidth,
&imageHeight, &oldformat) == TCL_OK) {
Tcl_Obj *format, *data;
@@ -1119,8 +1091,8 @@ ImgPhotoCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
Tcl_ResetResult(interp);
- if (Tcl_SplitList(interp, Tcl_GetString(options.name),
- &dataHeight, &srcArgv) != TCL_OK) {
+ if (Tcl_ListObjGetElements(interp, options.name,
+ &dataHeight, &srcObjv) != TCL_OK) {
return TCL_ERROR;
}
tkwin = Tk_MainWindow(interp);
@@ -1128,44 +1100,80 @@ ImgPhotoCmd(clientData, interp, objc, objv)
dataWidth = 0;
pixelPtr = NULL;
for (y = 0; y < dataHeight; ++y) {
- if (Tcl_SplitList(interp, srcArgv[y], &listArgc, &listArgv)
- != TCL_OK) {
+ if (Tcl_ListObjGetElements(interp, srcObjv[y],
+ &listObjc, &listObjv) != TCL_OK) {
break;
}
+
if (y == 0) {
- if (listArgc == 0) {
+ if (listObjc == 0) {
/*
* Lines must be non-empty...
*/
+
break;
}
- dataWidth = listArgc;
+ dataWidth = listObjc;
pixelPtr = (unsigned char *)
ckalloc((unsigned) dataWidth * dataHeight * 3);
block.pixelPtr = pixelPtr;
- } else if (listArgc != dataWidth) {
+ } else if (listObjc != dataWidth) {
Tcl_AppendResult(interp, "all elements of color list must",
- " have the same number of elements", (char *) NULL);
- ckfree((char *) listArgv);
+ " have the same number of elements", NULL);
break;
}
+
for (x = 0; x < dataWidth; ++x) {
+ char *colorString = Tcl_GetString(listObjv[x]);
+ XColor color;
+ int tmpr, tmpg, tmpb;
+
+ /*
+ * We do not use Tk_GetColorFromObj() because we absolutely do
+ * not want to invoke the fallback code.
+ */
+
+ if (colorString[0] == '#') {
+ if (isxdigit(UCHAR(colorString[1])) &&
+ isxdigit(UCHAR(colorString[2])) &&
+ isxdigit(UCHAR(colorString[3]))) {
+ if (colorString[4] == '\0') {
+ /* Got #rgb */
+ sscanf(colorString+1, "%1x%1x%1x",
+ &tmpr, &tmpg, &tmpb);
+ *pixelPtr++ = tmpr * 0x11;
+ *pixelPtr++ = tmpg * 0x11;
+ *pixelPtr++ = tmpb * 0x11;
+ continue;
+ } else if (isxdigit(UCHAR(colorString[4])) &&
+ isxdigit(UCHAR(colorString[5])) &&
+ isxdigit(UCHAR(colorString[6])) &&
+ colorString[7] == '\0') {
+ /* Got #rrggbb */
+ sscanf(colorString+1, "%2x%2x%2x",
+ &tmpr, &tmpg, &tmpb);
+ *pixelPtr++ = tmpr;
+ *pixelPtr++ = tmpg;
+ *pixelPtr++ = tmpb;
+ continue;
+ }
+ }
+ }
+
if (!XParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin),
- listArgv[x], &color)) {
+ colorString, &color)) {
Tcl_AppendResult(interp, "can't parse color \"",
- listArgv[x], "\"", (char *) NULL);
+ colorString, "\"", NULL);
break;
}
*pixelPtr++ = color.red >> 8;
*pixelPtr++ = color.green >> 8;
*pixelPtr++ = color.blue >> 8;
}
- ckfree((char *) listArgv);
if (x < dataWidth) {
break;
}
}
- ckfree((char *) srcArgv);
if (y < dataHeight || dataHeight == 0 || dataWidth == 0) {
if (block.pixelPtr != NULL) {
ckfree((char *) block.pixelPtr);
@@ -1177,8 +1185,8 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
/*
- * Fill in default values for the -to option, then
- * copy the block in using Tk_PhotoPutBlock.
+ * Fill in default values for the -to option, then copy the block in
+ * using Tk_PhotoPutBlock.
*/
if (!(options.options & OPT_TO) || (options.toX2 < 0)) {
@@ -1193,11 +1201,12 @@ ImgPhotoCmd(clientData, interp, objc, objv)
block.offset[1] = 1;
block.offset[2] = 2;
block.offset[3] = 0;
- Tk_PhotoPutBlock((ClientData)masterPtr, &block,
+ result = Tk_PhotoPutBlock(interp, (ClientData)masterPtr, &block,
options.toX, options.toY, options.toX2 - options.toX,
- options.toY2 - options.toY, TK_PHOTO_COMPOSITE_SET);
+ options.toY2 - options.toY,
+ TK_PHOTO_COMPOSITE_SET);
ckfree((char *) block.pixelPtr);
- return TCL_OK;
+ return result;
case PHOTO_READ: {
Tcl_Obj *format;
@@ -1207,7 +1216,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
*/
index = 2;
- memset((VOID *) &options, 0, sizeof(options));
+ memset(&options, 0, sizeof(options));
options.name = NULL;
options.format = NULL;
if (ParseSubcommandOptions(&options, interp,
@@ -1220,16 +1229,16 @@ ImgPhotoCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
- /*
- * Prevent file system access in safe interpreters.
- */
+ /*
+ * Prevent file system access in safe interpreters.
+ */
+
+ if (Tcl_IsSafe(interp)) {
+ Tcl_AppendResult(interp, "can't get image from a file in a",
+ " safe interpreter", NULL);
+ return TCL_ERROR;
+ }
- if (Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't get image from a file in a",
- " safe interpreter", (char *) NULL);
- return TCL_ERROR;
- }
-
/*
* Open the image file and look for a handler for it.
*/
@@ -1239,17 +1248,17 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (chan == NULL) {
return TCL_ERROR;
}
- if (Tcl_SetChannelOption(interp, chan, "-translation", "binary")
+ if (Tcl_SetChannelOption(interp, chan, "-translation", "binary")
!= TCL_OK) {
Tcl_Close(NULL, chan);
- return TCL_ERROR;
- }
- if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary")
+ return TCL_ERROR;
+ }
+ if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary")
!= TCL_OK) {
Tcl_Close(NULL, chan);
- return TCL_ERROR;
- }
-
+ return TCL_ERROR;
+ }
+
if (MatchFileFormat(interp, chan,
Tcl_GetString(options.name), options.format, &imageFormat,
&imageWidth, &imageHeight, &oldformat) != TCL_OK) {
@@ -1265,7 +1274,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
|| (options.fromX2 > imageWidth)
|| (options.fromY2 > imageHeight)) {
Tcl_AppendResult(interp, "coordinates for -from option extend ",
- "outside source image", (char *) NULL);
+ "outside source image", NULL);
Tcl_Close(NULL, chan);
return TCL_ERROR;
}
@@ -1285,15 +1294,14 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (ImgPhotoSetSize(masterPtr, options.toX + width,
options.toY + height) != TCL_OK) {
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- TK_PHOTO_ALLOC_FAILURE_MESSAGE, (char *) NULL);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
return TCL_ERROR;
}
}
/*
- * Call the handler's file read procedure to read the data
- * into the image.
+ * Call the handler's file read function to read the data into the
+ * image.
*/
format = options.format;
@@ -1312,13 +1320,13 @@ ImgPhotoCmd(clientData, interp, objc, objv)
case PHOTO_REDITHER:
if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
/*
- * Call Dither if any part of the image is not correctly
- * dithered at present.
+ * Call Dither if any part of the image is not correctly dithered at
+ * present.
*/
x = masterPtr->ditherX;
@@ -1346,8 +1354,8 @@ ImgPhotoCmd(clientData, interp, objc, objv)
return TCL_OK;
case PHOTO_TRANS: {
- static CONST char *photoTransOptions[] = {
- "get", "set", (char *) NULL
+ static const char *photoTransOptions[] = {
+ "get", "set", NULL
};
enum transOptions {
PHOTO_TRANS_GET, PHOTO_TRANS_SET
@@ -1378,8 +1386,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if ((x < 0) || (x >= masterPtr->width)
|| (y < 0) || (y >= masterPtr->height)) {
Tcl_AppendResult(interp, Tcl_GetString(objv[0]),
- " transparency get: coordinates out of range",
- (char *) NULL);
+ " transparency get: coordinates out of range", NULL);
return TCL_ERROR;
}
@@ -1416,8 +1423,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if ((x < 0) || (x >= masterPtr->width)
|| (y < 0) || (y >= masterPtr->height)) {
Tcl_AppendResult(interp, Tcl_GetString(objv[0]),
- " transparency set: coordinates out of range",
- (char *) NULL);
+ " transparency set: coordinates out of range", NULL);
return TCL_ERROR;
}
@@ -1431,20 +1437,24 @@ ImgPhotoCmd(clientData, interp, objc, objv)
/*
* Make pixel transparent.
*/
+
TkRegion clearRegion = TkCreateRegion();
TkUnionRectWithRegion(&setBox, clearRegion, clearRegion);
TkSubtractRegion(masterPtr->validRegion, clearRegion,
masterPtr->validRegion);
TkDestroyRegion(clearRegion);
+
/*
* Set the alpha value correctly.
*/
+
pixelPtr[3] = 0;
} else {
/*
* Make pixel opaque.
*/
+
TkUnionRectWithRegion(&setBox, masterPtr->validRegion,
masterPtr->validRegion);
pixelPtr[3] = 255;
@@ -1460,31 +1470,31 @@ ImgPhotoCmd(clientData, interp, objc, objv)
masterPtr->flags &= ~IMAGE_CHANGED;
return TCL_OK;
}
- }
- panic("unexpected fallthrough");
+ }
+ Tcl_Panic("unexpected fallthrough");
}
case PHOTO_WRITE: {
char *data;
Tcl_Obj *format;
- /*
- * Prevent file system access in safe interpreters.
- */
+ /*
+ * Prevent file system access in safe interpreters.
+ */
+
+ if (Tcl_IsSafe(interp)) {
+ Tcl_AppendResult(interp, "can't write image to a file in a",
+ " safe interpreter", NULL);
+ return TCL_ERROR;
+ }
- if (Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't write image to a file in a",
- " safe interpreter", (char *) NULL);
- return TCL_ERROR;
- }
-
/*
* photo write command - first parse and check any options given.
*/
index = 2;
- memset((VOID *) &options, 0, sizeof(options));
+ memset(&options, 0, sizeof(options));
options.name = NULL;
options.format = NULL;
if (ParseSubcommandOptions(&options, interp,
@@ -1501,7 +1511,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
|| (options.fromX2 > masterPtr->width)
|| (options.fromY2 > masterPtr->height)) {
Tcl_AppendResult(interp, "coordinates for -from option extend ",
- "outside image", (char *) NULL);
+ "outside image", NULL);
return TCL_ERROR;
}
@@ -1515,8 +1525,8 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
/*
- * Search for an appropriate image file format handler,
- * and give an error if none is found.
+ * Search for an appropriate image file format handler, and give an
+ * error if none is found.
*/
matched = 0;
@@ -1548,23 +1558,21 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (imageFormat == NULL) {
if (options.format == NULL) {
Tcl_AppendResult(interp, "no available image file format ",
- "has file writing capability", (char *) NULL);
+ "has file writing capability", NULL);
} else if (!matched) {
Tcl_AppendResult(interp, "image file format \"",
Tcl_GetString(options.format),
- "\" is unknown", (char *) NULL);
+ "\" is unknown", NULL);
} else {
Tcl_AppendResult(interp, "image file format \"",
Tcl_GetString(options.format),
- "\" has no file writing capability",
- (char *) NULL);
+ "\" has no file writing capability", NULL);
}
return TCL_ERROR;
}
/*
- * Call the handler's file write procedure to write out
- * the image.
+ * Call the handler's file write function to write out the image.
*/
data = ImgGetPhoto(masterPtr, &block, &options);
@@ -1584,7 +1592,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
}
- panic("unexpected fallthrough");
+ Tcl_Panic("unexpected fallthrough");
return TCL_ERROR; /* NOT REACHED */
}
@@ -1593,10 +1601,9 @@ ImgPhotoCmd(clientData, interp, objc, objv)
*
* ParseSubcommandOptions --
*
- * This procedure is invoked to process one of the options
- * which may be specified for the photo image subcommands,
- * namely, -from, -to, -zoom, -subsample, -format, -shrink,
- * and -compositingrule.
+ * This function is invoked to process one of the options which may be
+ * specified for the photo image subcommands, namely, -from, -to, -zoom,
+ * -subsample, -format, -shrink, and -compositingrule.
*
* Results:
* A standard Tcl result.
@@ -1608,29 +1615,27 @@ ImgPhotoCmd(clientData, interp, objc, objv)
*/
static int
-ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
- struct SubcommandOptions *optPtr;
- /* Information about the options specified
- * and the values given is returned here. */
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- int allowedOptions; /* Indicates which options are valid for
- * the current command. */
- int *optIndexPtr; /* Points to a variable containing the
- * current index in objv; this variable is
- * updated by this procedure. */
- int objc; /* Number of arguments in objv[]. */
- Tcl_Obj *CONST objv[]; /* Arguments to be parsed. */
+ParseSubcommandOptions(
+ struct SubcommandOptions *optPtr,
+ /* Information about the options specified and
+ * the values given is returned here. */
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ int allowedOptions, /* Indicates which options are valid for the
+ * current command. */
+ int *optIndexPtr, /* Points to a variable containing the current
+ * index in objv; this variable is updated by
+ * this function. */
+ int objc, /* Number of arguments in objv[]. */
+ Tcl_Obj *const objv[]) /* Arguments to be parsed. */
{
- int index, c, bit, currentBit;
- int length;
+ int index, c, bit, currentBit, length;
+ int values[4], numValues, maxValues, argIndex;
char *option, **listPtr;
- int values[4];
- int numValues, maxValues, argIndex;
for (index = *optIndexPtr; index < objc; *optIndexPtr = ++index) {
/*
- * We can have one value specified without an option;
- * it goes into optPtr->name.
+ * We can have one value specified without an option; it goes into
+ * optPtr->name.
*/
option = Tcl_GetStringFromObj(objv[index], &length);
@@ -1662,24 +1667,24 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
}
/*
- * If this option is not recognized and allowed, put
- * an error message in the interpreter and return.
+ * If this option is not recognized and allowed, put an error message
+ * in the interpreter and return.
*/
if ((allowedOptions & bit) == 0) {
Tcl_AppendResult(interp, "unrecognized option \"",
Tcl_GetString(objv[index]),
- "\": must be ", (char *)NULL);
+ "\": must be ", NULL);
bit = 1;
for (listPtr = optionNames; *listPtr != NULL; ++listPtr) {
if ((allowedOptions & bit) != 0) {
if ((allowedOptions & (bit - 1)) != 0) {
- Tcl_AppendResult(interp, ", ", (char *) NULL);
+ Tcl_AppendResult(interp, ", ", NULL);
if ((allowedOptions & ~((bit << 1) - 1)) == 0) {
- Tcl_AppendResult(interp, "or ", (char *) NULL);
+ Tcl_AppendResult(interp, "or ", NULL);
}
}
- Tcl_AppendResult(interp, *listPtr, (char *) NULL);
+ Tcl_AppendResult(interp, *listPtr, NULL);
}
bit <<= 1;
}
@@ -1687,9 +1692,8 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
}
/*
- * For the -from, -to, -zoom and -subsample options,
- * parse the values given. Report an error if too few
- * or too many values are given.
+ * For the -from, -to, -zoom and -subsample options, parse the values
+ * given. Report an error if too few or too many values are given.
*/
if (bit == OPT_BACKGROUND) {
@@ -1706,14 +1710,13 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
}
} else {
Tcl_AppendResult(interp, "the \"-background\" option ",
- "requires a value", (char *) NULL);
+ "requires a value", NULL);
return TCL_ERROR;
}
} else if (bit == OPT_FORMAT) {
/*
- * The -format option takes a single string value. Note
- * that parsing this is outside the scope of this
- * function.
+ * The -format option takes a single string value. Note that
+ * parsing this is outside the scope of this function.
*/
if (index + 1 < objc) {
@@ -1721,13 +1724,13 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
optPtr->format = objv[index];
} else {
Tcl_AppendResult(interp, "the \"-format\" option ",
- "requires a value", (char *) NULL);
+ "requires a value", NULL);
return TCL_ERROR;
}
} else if (bit == OPT_COMPOSITE) {
/*
- * The -compositingrule option takes a single value from
- * a well-known set.
+ * The -compositingrule option takes a single value from a
+ * well-known set.
*/
if (index + 1 < objc) {
@@ -1735,9 +1738,9 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
* Note that these must match the TK_PHOTO_COMPOSITE_*
* constants.
*/
- static CONST char *compositingRules[] = {
- "overlay", "set",
- NULL
+
+ static const char *compositingRules[] = {
+ "overlay", "set", NULL
};
index++;
@@ -1749,7 +1752,7 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
*optIndexPtr = index;
} else {
Tcl_AppendResult(interp, "the \"-compositingrule\" option ",
- "requires a value", (char *) NULL);
+ "requires a value", NULL);
return TCL_ERROR;
}
} else if ((bit != OPT_SHRINK) && (bit != OPT_GRAYSCALE)) {
@@ -1760,7 +1763,7 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
if (argIndex >= objc) {
break;
}
- val = Tcl_GetString(objv[argIndex]);
+ val = Tcl_GetString(objv[argIndex]);
if ((argIndex < objc) && (isdigit(UCHAR(val[0]))
|| ((val[0] == '-') && isdigit(UCHAR(val[1]))))) {
if (Tcl_GetInt(interp, val, &values[numValues])
@@ -1776,7 +1779,7 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
if (numValues == 0) {
Tcl_AppendResult(interp, "the \"", option, "\" option ",
"requires one ", maxValues == 2? "or two": "to four",
- " integer values", (char *) NULL);
+ " integer values", NULL);
return TCL_ERROR;
}
*optIndexPtr = (index += numValues);
@@ -1793,62 +1796,62 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
}
/*
- * Check the values given and put them in the appropriate
- * field of the SubcommandOptions structure.
+ * Check the values given and put them in the appropriate field of
+ * the SubcommandOptions structure.
*/
switch (bit) {
- case OPT_FROM:
- if ((values[0] < 0) || (values[1] < 0) || ((numValues > 2)
- && ((values[2] < 0) || (values[3] < 0)))) {
- Tcl_AppendResult(interp, "value(s) for the -from",
- " option must be non-negative", (char *) NULL);
- return TCL_ERROR;
- }
- if (numValues <= 2) {
- optPtr->fromX = values[0];
- optPtr->fromY = values[1];
- optPtr->fromX2 = -1;
- optPtr->fromY2 = -1;
- } else {
- optPtr->fromX = MIN(values[0], values[2]);
- optPtr->fromY = MIN(values[1], values[3]);
- optPtr->fromX2 = MAX(values[0], values[2]);
- optPtr->fromY2 = MAX(values[1], values[3]);
- }
- break;
- case OPT_SUBSAMPLE:
- optPtr->subsampleX = values[0];
- optPtr->subsampleY = values[1];
- break;
- case OPT_TO:
- if ((values[0] < 0) || (values[1] < 0) || ((numValues > 2)
- && ((values[2] < 0) || (values[3] < 0)))) {
- Tcl_AppendResult(interp, "value(s) for the -to",
- " option must be non-negative", (char *) NULL);
- return TCL_ERROR;
- }
- if (numValues <= 2) {
- optPtr->toX = values[0];
- optPtr->toY = values[1];
- optPtr->toX2 = -1;
- optPtr->toY2 = -1;
- } else {
- optPtr->toX = MIN(values[0], values[2]);
- optPtr->toY = MIN(values[1], values[3]);
- optPtr->toX2 = MAX(values[0], values[2]);
- optPtr->toY2 = MAX(values[1], values[3]);
- }
- break;
- case OPT_ZOOM:
- if ((values[0] <= 0) || (values[1] <= 0)) {
- Tcl_AppendResult(interp, "value(s) for the -zoom",
- " option must be positive", (char *) NULL);
- return TCL_ERROR;
- }
- optPtr->zoomX = values[0];
- optPtr->zoomY = values[1];
- break;
+ case OPT_FROM:
+ if ((values[0] < 0) || (values[1] < 0) || ((numValues > 2)
+ && ((values[2] < 0) || (values[3] < 0)))) {
+ Tcl_AppendResult(interp, "value(s) for the -from",
+ " option must be non-negative", NULL);
+ return TCL_ERROR;
+ }
+ if (numValues <= 2) {
+ optPtr->fromX = values[0];
+ optPtr->fromY = values[1];
+ optPtr->fromX2 = -1;
+ optPtr->fromY2 = -1;
+ } else {
+ optPtr->fromX = MIN(values[0], values[2]);
+ optPtr->fromY = MIN(values[1], values[3]);
+ optPtr->fromX2 = MAX(values[0], values[2]);
+ optPtr->fromY2 = MAX(values[1], values[3]);
+ }
+ break;
+ case OPT_SUBSAMPLE:
+ optPtr->subsampleX = values[0];
+ optPtr->subsampleY = values[1];
+ break;
+ case OPT_TO:
+ if ((values[0] < 0) || (values[1] < 0) || ((numValues > 2)
+ && ((values[2] < 0) || (values[3] < 0)))) {
+ Tcl_AppendResult(interp, "value(s) for the -to",
+ " option must be non-negative", NULL);
+ return TCL_ERROR;
+ }
+ if (numValues <= 2) {
+ optPtr->toX = values[0];
+ optPtr->toY = values[1];
+ optPtr->toX2 = -1;
+ optPtr->toY2 = -1;
+ } else {
+ optPtr->toX = MIN(values[0], values[2]);
+ optPtr->toY = MIN(values[1], values[3]);
+ optPtr->toX2 = MAX(values[0], values[2]);
+ optPtr->toY2 = MAX(values[1], values[3]);
+ }
+ break;
+ case OPT_ZOOM:
+ if ((values[0] <= 0) || (values[1] <= 0)) {
+ Tcl_AppendResult(interp, "value(s) for the -zoom",
+ " option must be positive", NULL);
+ return TCL_ERROR;
+ }
+ optPtr->zoomX = values[0];
+ optPtr->zoomY = values[1];
+ break;
}
}
@@ -1867,45 +1870,42 @@ ParseSubcommandOptions(optPtr, interp, allowedOptions, optIndexPtr, objc, objv)
*
* ImgPhotoConfigureMaster --
*
- * This procedure is called when a photo image is created or
- * reconfigured. It processes configuration options and resets
- * any instances of the image.
+ * This function is called when a photo image is created or reconfigured.
+ * It processes configuration options and resets any instances of the
+ * image.
*
* Results:
- * A standard Tcl return value. If TCL_ERROR is returned then
- * an error message is left in the masterPtr->interp's result.
+ * A standard Tcl return value. If TCL_ERROR is returned then an error
+ * message is left in the masterPtr->interp's result.
*
* Side effects:
- * Existing instances of the image will be redisplayed to match
- * the new configuration options.
+ * Existing instances of the image will be redisplayed to match the new
+ * configuration options.
*
*----------------------------------------------------------------------
*/
static int
-ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- PhotoMaster *masterPtr; /* Pointer to data structure describing
+ImgPhotoConfigureMaster(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ PhotoMaster *masterPtr, /* Pointer to data structure describing
* overall photo image to (re)configure. */
- int objc; /* Number of entries in objv. */
- Tcl_Obj *CONST objv[]; /* Pairs of configuration options for image. */
- int flags; /* Flags to pass to Tk_ConfigureWidget,
- * such as TK_CONFIG_ARGV_ONLY. */
+ int objc, /* Number of entries in objv. */
+ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget, such
+ * as TK_CONFIG_ARGV_ONLY. */
{
PhotoInstance *instancePtr;
- CONST char *oldFileString, *oldPaletteString;
+ const char *oldFileString, *oldPaletteString;
Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL;
- int length, i, j;
+ Tcl_Obj *tempdata, *tempformat;
+ int length, i, j, result, imageWidth, imageHeight, oldformat;
double oldGamma;
- int result;
Tcl_Channel chan;
Tk_PhotoImageFormat *imageFormat;
- int imageWidth, imageHeight;
- CONST char **args;
- int oldformat;
- Tcl_Obj *tempdata, *tempformat;
+ const char **args;
- args = (CONST char **) ckalloc((objc + 1) * sizeof(char *));
+ args = (const char **) ckalloc((objc + 1) * sizeof(char *));
for (i = 0, j = 0; i < objc; i++,j++) {
args[j] = Tcl_GetStringFromObj(objv[i], &length);
if ((length > 1) && (args[j][0] == '-')) {
@@ -1916,7 +1916,7 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
j--;
} else {
Tcl_AppendResult(interp,
- "value for \"-data\" missing", (char *) NULL);
+ "value for \"-data\" missing", NULL);
return TCL_ERROR;
}
} else if ((args[j][1] == 'f') &&
@@ -1926,7 +1926,7 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
j--;
} else {
Tcl_AppendResult(interp,
- "value for \"-format\" missing", (char *) NULL);
+ "value for \"-format\" missing", NULL);
return TCL_ERROR;
}
}
@@ -1934,12 +1934,10 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
}
/*
- * Save the current values for fileString and dataString, so we
- * can tell if the user specifies them anew.
- * IMPORTANT: if the format changes we have to interpret
- * "-file" and "-data" again as well!!!!!!! It might be
- * that the format string influences how "-data" or "-file"
- * is interpreted.
+ * Save the current values for fileString and dataString, so we can tell
+ * if the user specifies them anew. IMPORTANT: if the format changes we
+ * have to interpret "-file" and "-data" again as well! It might be that
+ * the format string influences how "-data" or "-file" is interpreted.
*/
oldFileString = masterPtr->fileString;
@@ -1970,8 +1968,7 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
ckfree((char *) args);
/*
- * Regard the empty string for -file, -data or -format as the null
- * value.
+ * Regard the empty string for -file, -data or -format as the null value.
*/
if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) {
@@ -1980,9 +1977,10 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
}
if (data) {
/*
- * Force into ByteArray format, which most (all) image handlers
- * will use anyway. Empty length means ignore the -data option.
+ * Force into ByteArray format, which most (all) image handlers will
+ * use anyway. Empty length means ignore the -data option.
*/
+
(void) Tcl_GetByteArrayFromObj(data, &length);
if (length) {
Tcl_IncrRefCount(data);
@@ -1996,9 +1994,10 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
}
if (format) {
/*
- * Stringify to ignore -format "". It may come in as a list or
- * other object.
+ * Stringify to ignore -format "". It may come in as a list or other
+ * object.
*/
+
(void) Tcl_GetStringFromObj(format, &length);
if (length) {
Tcl_IncrRefCount(format);
@@ -2011,47 +2010,47 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
masterPtr->format = format;
}
/*
- * Set the image to the user-requested size, if any,
- * and make sure storage is correctly allocated for this image.
+ * Set the image to the user-requested size, if any, and make sure storage
+ * is correctly allocated for this image.
*/
if (ImgPhotoSetSize(masterPtr, masterPtr->width,
masterPtr->height) != TCL_OK) {
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- TK_PHOTO_ALLOC_FAILURE_MESSAGE, (char *) NULL);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
goto errorExit;
}
/*
- * Read in the image from the file or string if the user has
- * specified the -file or -data option.
+ * Read in the image from the file or string if the user has specified the
+ * -file or -data option.
*/
if ((masterPtr->fileString != NULL)
&& ((masterPtr->fileString != oldFileString)
|| (masterPtr->format != oldFormat))) {
- /*
- * Prevent file system access in a safe interpreter.
- */
+ /*
+ * Prevent file system access in a safe interpreter.
+ */
- if (Tcl_IsSafe(interp)) {
+ if (Tcl_IsSafe(interp)) {
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "can't get image from a file in a safe interpreter",
- (char *) NULL);
+ Tcl_AppendResult(interp,
+ "can't get image from a file in a safe interpreter", NULL);
goto errorExit;
- }
-
+ }
+
chan = Tcl_OpenFileChannel(interp, masterPtr->fileString, "r", 0);
if (chan == NULL) {
goto errorExit;
}
+
/*
* -translation binary also sets -encoding binary
*/
- if ((Tcl_SetChannelOption(interp, chan,
+
+ if ((Tcl_SetChannelOption(interp, chan,
"-translation", "binary") != TCL_OK) ||
(MatchFileFormat(interp, chan, masterPtr->fileString,
masterPtr->format, &imageFormat, &imageWidth,
@@ -2063,8 +2062,7 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
if (result != TCL_OK) {
Tcl_Close(NULL, chan);
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- TK_PHOTO_ALLOC_FAILURE_MESSAGE, (char *) NULL);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
goto errorExit;
}
tempformat = masterPtr->format;
@@ -2072,9 +2070,8 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
}
result = (*imageFormat->fileReadProc)(interp, chan,
- masterPtr->fileString, tempformat,
- (Tk_PhotoHandle) masterPtr, 0, 0,
- imageWidth, imageHeight, 0, 0);
+ masterPtr->fileString, tempformat, (Tk_PhotoHandle) masterPtr,
+ 0, 0, imageWidth, imageHeight, 0, 0);
Tcl_Close(NULL, chan);
if (result != TCL_OK) {
goto errorExit;
@@ -2095,8 +2092,7 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
}
if (ImgPhotoSetSize(masterPtr, imageWidth, imageHeight) != TCL_OK) {
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- TK_PHOTO_ALLOC_FAILURE_MESSAGE, (char *) NULL);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
goto errorExit;
}
tempformat = masterPtr->format;
@@ -2131,9 +2127,9 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
}
/*
- * Cycle through all of the instances of this image, regenerating
- * the information for each instance. Then force the image to be
- * redisplayed everywhere that it is used.
+ * Cycle through all of the instances of this image, regenerating the
+ * information for each instance. Then force the image to be redisplayed
+ * everywhere that it is used.
*/
for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
@@ -2142,8 +2138,7 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
}
/*
- * Inform the generic image code that the image
- * has (potentially) changed.
+ * Inform the generic image code that the image has (potentially) changed.
*/
Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
@@ -2176,24 +2171,24 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
*
* ImgPhotoConfigureInstance --
*
- * This procedure is called to create displaying information for
- * a photo image instance based on the configuration information
- * in the master. It is invoked both when new instances are
- * created and when the master is reconfigured.
+ * This function is called to create displaying information for a photo
+ * image instance based on the configuration information in the master.
+ * It is invoked both when new instances are created and when the master
+ * is reconfigured.
*
* Results:
* None.
*
* Side effects:
- * Generates errors via Tcl_BackgroundError if there are problems
- * in setting up the instance.
+ * Generates errors via Tcl_BackgroundError if there are problems in
+ * setting up the instance.
*
*----------------------------------------------------------------------
*/
static void
-ImgPhotoConfigureInstance(instancePtr)
- PhotoInstance *instancePtr; /* Instance to reconfigure. */
+ImgPhotoConfigureInstance(
+ PhotoInstance *instancePtr) /* Instance to reconfigure. */
{
PhotoMaster *masterPtr = instancePtr->masterPtr;
XImage *imagePtr;
@@ -2202,10 +2197,9 @@ ImgPhotoConfigureInstance(instancePtr)
XRectangle validBox;
/*
- * If the -palette configuration option has been set for the master,
- * use the value specified for our palette, but only if it is
- * a valid palette for our windows. Use the gamma value specified
- * the master.
+ * If the -palette configuration option has been set for the master, use
+ * the value specified for our palette, but only if it is a valid palette
+ * for our windows. Use the gamma value specified the master.
*/
if ((masterPtr->palette && masterPtr->palette[0])
@@ -2217,9 +2211,9 @@ ImgPhotoConfigureInstance(instancePtr)
instancePtr->gamma = masterPtr->gamma;
/*
- * If we don't currently have a color table, or if the one we
- * have no longer applies (e.g. because our palette or gamma
- * has changed), get a new one.
+ * If we don't currently have a color table, or if the one we have no
+ * longer applies (e.g. because our palette or gamma has changed), get a
+ * new one.
*/
colorTablePtr = instancePtr->colorTablePtr;
@@ -2238,8 +2232,8 @@ ImgPhotoConfigureInstance(instancePtr)
GetColorTable(instancePtr);
/*
- * Create a new XImage structure for sending data to
- * the X server, if necessary.
+ * Create a new XImage structure for sending data to the X server, if
+ * necessary.
*/
if (instancePtr->colorTablePtr->flags & BLACK_AND_WHITE) {
@@ -2255,7 +2249,7 @@ ImgPhotoConfigureInstance(instancePtr)
}
imagePtr = XCreateImage(instancePtr->display,
instancePtr->visualInfo.visual, (unsigned) bitsPerPixel,
- (bitsPerPixel > 1? ZPixmap: XYBitmap), 0, (char *) NULL,
+ (bitsPerPixel > 1? ZPixmap: XYBitmap), 0, NULL,
1, 1, 32, 0);
instancePtr->imagePtr = imagePtr;
@@ -2278,11 +2272,10 @@ ImgPhotoConfigureInstance(instancePtr)
}
/*
- * If the user has specified a width and/or height for the master
- * which is different from our current width/height, set the size
- * to the values specified by the user. If we have no pixmap, we
- * do this also, since it has the side effect of allocating a
- * pixmap for us.
+ * If the user has specified a width and/or height for the master which is
+ * different from our current width/height, set the size to the values
+ * specified by the user. If we have no pixmap, we do this also, since it
+ * has the side effect of allocating a pixmap for us.
*/
if ((instancePtr->pixels == None) || (instancePtr->error == NULL)
@@ -2310,62 +2303,60 @@ ImgPhotoConfigureInstance(instancePtr)
*
* ImgPhotoGet --
*
- * This procedure is called for each use of a photo image in a
- * widget.
+ * This function is called for each use of a photo image in a widget.
*
* Results:
- * The return value is a token for the instance, which is passed
- * back to us in calls to ImgPhotoDisplay and ImgPhotoFree.
+ * The return value is a token for the instance, which is passed back to
+ * us in calls to ImgPhotoDisplay and ImgPhotoFree.
*
* Side effects:
- * A data structure is set up for the instance (or, an existing
- * instance is re-used for the new one).
+ * A data structure is set up for the instance (or, an existing instance
+ * is re-used for the new one).
*
*----------------------------------------------------------------------
*/
static ClientData
-ImgPhotoGet(tkwin, masterData)
- Tk_Window tkwin; /* Window in which the instance will be
+ImgPhotoGet(
+ Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData; /* Pointer to our master structure for the
+ ClientData masterData) /* Pointer to our master structure for the
* image. */
{
PhotoMaster *masterPtr = (PhotoMaster *) masterData;
PhotoInstance *instancePtr;
Colormap colormap;
- int mono, nRed, nGreen, nBlue;
+ int mono, nRed, nGreen, nBlue, numVisuals;
XVisualInfo visualInfo, *visInfoPtr;
char buf[TCL_INTEGER_SPACE * 3];
- int numVisuals;
XColor *white, *black;
XGCValues gcValues;
/*
- * Table of "best" choices for palette for PseudoColor displays
- * with between 3 and 15 bits/pixel.
+ * Table of "best" choices for palette for PseudoColor displays with
+ * between 3 and 15 bits/pixel.
*/
- static int paletteChoice[13][3] = {
+ static const int paletteChoice[13][3] = {
/* #red, #green, #blue */
- {2, 2, 2, /* 3 bits, 8 colors */},
- {2, 3, 2, /* 4 bits, 12 colors */},
- {3, 4, 2, /* 5 bits, 24 colors */},
- {4, 5, 3, /* 6 bits, 60 colors */},
- {5, 6, 4, /* 7 bits, 120 colors */},
- {7, 7, 4, /* 8 bits, 198 colors */},
- {8, 10, 6, /* 9 bits, 480 colors */},
- {10, 12, 8, /* 10 bits, 960 colors */},
- {14, 15, 9, /* 11 bits, 1890 colors */},
- {16, 20, 12, /* 12 bits, 3840 colors */},
- {20, 24, 16, /* 13 bits, 7680 colors */},
- {26, 30, 20, /* 14 bits, 15600 colors */},
- {32, 32, 30, /* 15 bits, 30720 colors */}
+ {2, 2, 2, /* 3 bits, 8 colors */},
+ {2, 3, 2, /* 4 bits, 12 colors */},
+ {3, 4, 2, /* 5 bits, 24 colors */},
+ {4, 5, 3, /* 6 bits, 60 colors */},
+ {5, 6, 4, /* 7 bits, 120 colors */},
+ {7, 7, 4, /* 8 bits, 198 colors */},
+ {8, 10, 6, /* 9 bits, 480 colors */},
+ {10, 12, 8, /* 10 bits, 960 colors */},
+ {14, 15, 9, /* 11 bits, 1890 colors */},
+ {16, 20, 12, /* 12 bits, 3840 colors */},
+ {20, 24, 16, /* 13 bits, 7680 colors */},
+ {26, 30, 20, /* 14 bits, 15600 colors */},
+ {32, 32, 30, /* 15 bits, 30720 colors */}
};
/*
- * See if there is already an instance for windows using
- * the same colormap. If so then just re-use it.
+ * See if there is already an instance for windows using the same
+ * colormap. If so then just re-use it.
*/
colormap = Tk_Colormap(tkwin);
@@ -2373,7 +2364,6 @@ ImgPhotoGet(tkwin, masterData)
instancePtr = instancePtr->nextPtr) {
if ((colormap == instancePtr->colormap)
&& (Tk_Display(tkwin) == instancePtr->display)) {
-
/*
* Re-use this instance.
*/
@@ -2395,8 +2385,8 @@ ImgPhotoGet(tkwin, masterData)
}
/*
- * The image isn't already in use in a window with the same colormap.
- * Make a new instance of the image.
+ * The image isn't already in use in a window with the same colormap. Make
+ * a new instance of the image.
*/
instancePtr = (PhotoInstance *) ckalloc(sizeof(PhotoInstance));
@@ -2415,53 +2405,51 @@ ImgPhotoGet(tkwin, masterData)
masterPtr->instancePtr = instancePtr;
/*
- * Obtain information about the visual and decide on the
- * default palette.
+ * Obtain information about the visual and decide on the default palette.
*/
visualInfo.screen = Tk_ScreenNumber(tkwin);
visualInfo.visualid = XVisualIDFromVisual(Tk_Visual(tkwin));
visInfoPtr = XGetVisualInfo(Tk_Display(tkwin),
VisualScreenMask | VisualIDMask, &visualInfo, &numVisuals);
+ if (visInfoPtr == NULL) {
+ Tcl_Panic("ImgPhotoGet couldn't find visual for window");
+ }
+
nRed = 2;
nGreen = nBlue = 0;
mono = 1;
- if (visInfoPtr != NULL) {
- instancePtr->visualInfo = *visInfoPtr;
- switch (visInfoPtr->class) {
- case DirectColor:
- case TrueColor:
- nRed = 1 << CountBits(visInfoPtr->red_mask);
- nGreen = 1 << CountBits(visInfoPtr->green_mask);
- nBlue = 1 << CountBits(visInfoPtr->blue_mask);
- mono = 0;
- break;
- case PseudoColor:
- case StaticColor:
- if (visInfoPtr->depth > 15) {
- nRed = 32;
- nGreen = 32;
- nBlue = 32;
- mono = 0;
- } else if (visInfoPtr->depth >= 3) {
- int *ip = paletteChoice[visInfoPtr->depth - 3];
-
- nRed = ip[0];
- nGreen = ip[1];
- nBlue = ip[2];
- mono = 0;
- }
- break;
- case GrayScale:
- case StaticGray:
- nRed = 1 << visInfoPtr->depth;
- break;
- }
- XFree((char *) visInfoPtr);
-
- } else {
- panic("ImgPhotoGet couldn't find visual for window");
- }
+ instancePtr->visualInfo = *visInfoPtr;
+ switch (visInfoPtr->class) {
+ case DirectColor:
+ case TrueColor:
+ nRed = 1 << CountBits(visInfoPtr->red_mask);
+ nGreen = 1 << CountBits(visInfoPtr->green_mask);
+ nBlue = 1 << CountBits(visInfoPtr->blue_mask);
+ mono = 0;
+ break;
+ case PseudoColor:
+ case StaticColor:
+ if (visInfoPtr->depth > 15) {
+ nRed = 32;
+ nGreen = 32;
+ nBlue = 32;
+ mono = 0;
+ } else if (visInfoPtr->depth >= 3) {
+ const int *ip = paletteChoice[visInfoPtr->depth - 3];
+
+ nRed = ip[0];
+ nGreen = ip[1];
+ nBlue = ip[2];
+ mono = 0;
+ }
+ break;
+ case GrayScale:
+ case StaticGray:
+ nRed = 1 << visInfoPtr->depth;
+ break;
+ }
+ XFree((char *) visInfoPtr);
sprintf(buf, ((mono) ? "%d": "%d/%d/%d"), nRed, nGreen, nBlue);
instancePtr->defaultPalette = Tk_GetUid(buf);
@@ -2483,8 +2471,8 @@ ImgPhotoGet(tkwin, masterData)
GCForeground|GCBackground|GCGraphicsExposures, &gcValues);
/*
- * Set configuration options and finish the initialization of the instance.
- * This will also dither the image if necessary.
+ * Set configuration options and finish the initialization of the
+ * instance. This will also dither the image if necessary.
*/
ImgPhotoConfigureInstance(instancePtr);
@@ -2506,9 +2494,9 @@ ImgPhotoGet(tkwin, masterData)
*
* ToggleComplexAlphaIfNeeded --
*
- * This procedure is called when an image is modified to
- * check if any partially transparent pixels exist, which
- * requires blending instead of straight copy.
+ * This function is called when an image is modified to check if any
+ * partially transparent pixels exist, which requires blending instead of
+ * straight copy.
*
* Results:
* None.
@@ -2520,19 +2508,21 @@ ImgPhotoGet(tkwin, masterData)
*/
static int
-ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr)
+ToggleComplexAlphaIfNeeded(
+ PhotoMaster *mPtr)
{
size_t len = MAX(mPtr->userWidth, mPtr->width) *
- MAX(mPtr->userHeight, mPtr->height) * 4;
- unsigned char *c = mPtr->pix32;
+ MAX(mPtr->userHeight, mPtr->height) * 4;
+ unsigned char *c = mPtr->pix32;
unsigned char *end = c + len;
/*
* Set the COMPLEX_ALPHA flag if we have an image with partially
* transparent bits.
*/
+
mPtr->flags &= ~COMPLEX_ALPHA;
- c += 3; /* start at first alpha byte */
+ c += 3; /* Start at first alpha byte. */
for (; c < end; c += 4) {
if (*c && *c != 255) {
mPtr->flags |= COMPLEX_ALPHA;
@@ -2547,8 +2537,13 @@ ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr)
*
* ImgPhotoBlendComplexAlpha --
*
- * This procedure is called when an image with partially
- * transparent pixels must be drawn over another image.
+ * This function is called when an image with partially transparent
+ * pixels must be drawn over another image. It blends the photo data onto
+ * a local copy of the surface that we are drawing on, *including* the
+ * pixels drawn by everything that should be drawn underneath the image.
+ *
+ * Much of this code has hard-coded values in for speed because this
+ * routine is performance critical for complex image drawing.
*
* Results:
* None.
@@ -2556,53 +2551,61 @@ ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr)
* Side effects:
* Background image passed in gets drawn over with image data.
*
- *----------------------------------------------------------------------
- */
-
-/*
- * This should work on all platforms that set mask and shift data properly
- * from the visualInfo.
- * RGB is really only a 24+ bpp version whereas RGB15 is the correct version
- * and works for 15bpp+, but it slower, so it's only used for 15bpp+.
+ * Notes:
+ * This should work on all platforms that set mask and shift data
+ * properly from the visualInfo. RGB is really only a 24+ bpp version
+ * whereas RGB15 is the correct version and works for 15bpp+, but it
+ * slower, so it's only used for 15bpp+.
+ *
+ * Note that Win32 pre-defines those operations that we really need.
*
- * Note that Win32 pre-defines those operations that we really need.
+ *----------------------------------------------------------------------
*/
#ifndef __WIN32__
-#define GetRValue(rgb) (UCHAR((rgb & red_mask) >> red_shift))
-#define GetGValue(rgb) (UCHAR((rgb & green_mask) >> green_shift))
-#define GetBValue(rgb) (UCHAR((rgb & blue_mask) >> blue_shift))
-#define RGB(r,g,b) ((unsigned)((UCHAR(r)<<red_shift)|(UCHAR(g)<<green_shift)|(UCHAR(b)<<blue_shift)))
-#define RGB15(r,g,b) ((unsigned)(((r*red_mask/255)&red_mask)|((g*green_mask/255)&green_mask)|((b*blue_mask/255)&blue_mask)))
+#define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift))
+#define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift))
+#define GetBValue(rgb) (UCHAR(((rgb) & blue_mask) >> blue_shift))
+#define RGB(r, g, b) ((unsigned)( \
+ (UCHAR(r) << red_shift) | \
+ (UCHAR(g) << green_shift) | \
+ (UCHAR(b) << blue_shift) ))
+#define RGB15(r, g, b) ((unsigned)( \
+ (((r) * red_mask / 255) & red_mask) | \
+ (((g) * green_mask / 255) & green_mask) | \
+ (((b) * blue_mask / 255) & blue_mask) ))
#endif /* !__WIN32__ */
static void
-ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
- XImage *bgImg; /* background image to draw on */
- PhotoInstance *iPtr; /* image instance to draw */
- int xOffset, yOffset; /* X & Y offset into image instance to draw */
- int width, height; /* width & height of image to draw */
+ImgPhotoBlendComplexAlpha(
+ XImage *bgImg, /* Background image to draw on. */
+ PhotoInstance *iPtr, /* Image instance to draw. */
+ int xOffset, int yOffset, /* X & Y offset into image instance to
+ * draw. */
+ int width, int height) /* Width & height of image to draw. */
{
int x, y, line;
unsigned long pixel;
- unsigned char r, g, b, alpha, unalpha;
+ unsigned char r, g, b, alpha, unalpha, *masterPtr;
unsigned char *alphaAr = iPtr->masterPtr->pix32;
- unsigned char *masterPtr;
/*
- * This blending is an integer version of the Source-Over
- * compositing rule (see Porter&Duff, "Compositing Digital
- * Images", proceedings of SIGGRAPH 1984) that has been hard-coded
- * (for speed) to work with targetting a solid surface.
+ * This blending is an integer version of the Source-Over compositing rule
+ * (see Porter&Duff, "Compositing Digital Images", proceedings of SIGGRAPH
+ * 1984) that has been hard-coded (for speed) to work with targetting a
+ * solid surface.
+ *
+ * The 'unalpha' field must be 255-alpha; it is separated out to encourage
+ * more efficient compilation.
*/
#define ALPHA_BLEND(bgPix, imgPix, alpha, unalpha) \
((bgPix * unalpha + imgPix * alpha) / 255)
/*
- * We have to get the mask and shift info from the visual on
- * non-Win32 so that the macros Get*Value(), RGB() and RGB15()
- * work correctly. This might be cached for better performance.
+ * We have to get the mask and shift info from the visual on non-Win32 so
+ * that the macros Get*Value(), RGB() and RGB15() work correctly. This
+ * might be cached for better performance.
*/
#ifndef __WIN32__
@@ -2628,9 +2631,9 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
#endif /* !__WIN32__ */
/*
- * Only unix requires the special case for <24bpp. It varies with
- * 3 extra shifts and uses RGB15. The 24+bpp version could also
- * then be further optimized.
+ * Only UNIX requires the special case for <24bpp. It varies with 3 extra
+ * shifts and uses RGB15. The 24+bpp version could also then be further
+ * optimized.
*/
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
@@ -2645,14 +2648,17 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
for (x = 0; x < width; x++) {
masterPtr = alphaAr + ((line + x + xOffset) * 4);
alpha = masterPtr[3];
+
/*
* Ignore pixels that are fully transparent
*/
+
if (alpha) {
/*
* We could perhaps be more efficient than XGetPixel for
* 24 and 32 bit displays, but this seems "fast enough".
*/
+
r = masterPtr[0];
g = masterPtr[1];
b = masterPtr[2];
@@ -2660,13 +2666,14 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
/*
* Only blend pixels that have some transparency
*/
+
unsigned char ra, ga, ba;
pixel = XGetPixel(bgImg, x, y);
ra = GetRValue(pixel) << red_mlen;
ga = GetGValue(pixel) << green_mlen;
ba = GetBValue(pixel) << blue_mlen;
- unalpha = 255 - alpha;
+ unalpha = 255 - alpha; /* Calculate once. */
r = ALPHA_BLEND(ra, r, alpha, unalpha);
g = ALPHA_BLEND(ga, g, alpha, unalpha);
b = ALPHA_BLEND(ba, b, alpha, unalpha);
@@ -2684,14 +2691,17 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
for (x = 0; x < width; x++) {
masterPtr = alphaAr + ((line + x + xOffset) * 4);
alpha = masterPtr[3];
+
/*
* Ignore pixels that are fully transparent
*/
+
if (alpha) {
/*
- * We could perhaps be more efficient than XGetPixel for
- * 24 and 32 bit displays, but this seems "fast enough".
+ * We could perhaps be more efficient than XGetPixel for 24
+ * and 32 bit displays, but this seems "fast enough".
*/
+
r = masterPtr[0];
g = masterPtr[1];
b = masterPtr[2];
@@ -2699,13 +2709,14 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
/*
* Only blend pixels that have some transparency
*/
+
unsigned char ra, ga, ba;
pixel = XGetPixel(bgImg, x, y);
ra = GetRValue(pixel);
ga = GetGValue(pixel);
ba = GetBValue(pixel);
- unalpha = 255 - alpha;
+ unalpha = 255 - alpha; /* Calculate once. */
r = ALPHA_BLEND(ra, r, alpha, unalpha);
g = ALPHA_BLEND(ga, g, alpha, unalpha);
b = ALPHA_BLEND(ba, b, alpha, unalpha);
@@ -2714,7 +2725,6 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
}
}
}
-
#undef ALPHA_BLEND
}
@@ -2723,7 +2733,7 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
*
* ImgPhotoDisplay --
*
- * This procedure is invoked to draw a photo image.
+ * This function is invoked to draw a photo image.
*
* Results:
* None.
@@ -2735,48 +2745,31 @@ ImgPhotoBlendComplexAlpha(bgImg, iPtr, xOffset, yOffset, width, height)
*/
static void
-ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
- height, drawableX, drawableY)
- ClientData clientData; /* Pointer to PhotoInstance structure for
- * for instance to be displayed. */
- Display *display; /* Display on which to draw image. */
- Drawable drawable; /* Pixmap or window in which to draw image. */
- int imageX, imageY; /* Upper-left corner of region within image
- * to draw. */
- int width, height; /* Dimensions of region within image to draw. */
- int drawableX, drawableY; /* Coordinates within drawable that
- * correspond to imageX and imageY. */
+ImgPhotoDisplay(
+ ClientData clientData, /* Pointer to PhotoInstance structure for
+ * instance to be displayed. */
+ Display *display, /* Display on which to draw image. */
+ Drawable drawable, /* Pixmap or window in which to draw image. */
+ int imageX, int imageY, /* Upper-left corner of region within image to
+ * draw. */
+ int width, int height, /* Dimensions of region within image to
+ * draw. */
+ int drawableX,int drawableY)/* Coordinates within drawable that correspond
+ * to imageX and imageY. */
{
PhotoInstance *instancePtr = (PhotoInstance *) clientData;
XVisualInfo visInfo = instancePtr->visualInfo;
/*
- * If there's no pixmap, it means that an error occurred
- * while creating the image instance so it can't be displayed.
+ * If there's no pixmap, it means that an error occurred while creating
+ * the image instance so it can't be displayed.
*/
if (instancePtr->pixels == None) {
return;
}
- /*
- * Check for bogus widths/heights. This prevents us from calling
- * XGetImage with a zero size, which it does not like. [Bug 979239]
- */
-
- if (width < 1 || height < 1) {
- return;
- }
-
- if (
-#if defined(MAC_TCL)
- /*
- * The retrieval of bgImg is currently not functional on OS9
- * so skip attempts to alpha blend.
- */
- 0 &&
-#endif
- (instancePtr->masterPtr->flags & COMPLEX_ALPHA)
+ if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
&& (visInfo.class == DirectColor || visInfo.class == TrueColor)) {
Tk_ErrorHandler handler;
@@ -2786,11 +2779,14 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
* Create an error handler to suppress the case where the input was
* not properly constrained, which can cause an X error. [Bug 979239]
*/
- handler = Tk_CreateErrorHandler(display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+
+ handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL,
+ (ClientData) NULL);
+
/*
* Pull the current background from the display to blend with
*/
+
bgImg = XGetImage(display, drawable, drawableX, drawableY,
(unsigned int)width, (unsigned int)height, AllPlanes, ZPixmap);
if (bgImg == NULL) {
@@ -2798,13 +2794,14 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
return;
}
- ImgPhotoBlendComplexAlpha(bgImg, instancePtr,
- imageX, imageY, width, height);
+ ImgPhotoBlendComplexAlpha(bgImg, instancePtr, imageX, imageY, width,
+ height);
/*
- * Color info is unimportant as we only do this operation for
- * depth >= 15.
+ * Color info is unimportant as we only do this operation for depth >=
+ * 15.
*/
+
TkPutImage(NULL, 0, display, drawable, instancePtr->gc,
bgImg, 0, 0, drawableX, drawableY,
(unsigned int) width, (unsigned int) height);
@@ -2812,21 +2809,22 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
Tk_DeleteErrorHandler(handler);
} else {
/*
- * masterPtr->region describes which parts of the image contain
- * valid data. We set this region as the clip mask for the gc,
- * setting its origin appropriately, and use it when drawing the
- * image.
+ * masterPtr->region describes which parts of the image contain valid
+ * data. We set this region as the clip mask for the gc, setting its
+ * origin appropriately, and use it when drawing the image.
*/
- TkSetRegion(display, instancePtr->gc, instancePtr->masterPtr->validRegion);
+
+ TkSetRegion(display, instancePtr->gc,
+ instancePtr->masterPtr->validRegion);
XSetClipOrigin(display, instancePtr->gc, drawableX - imageX,
- drawableY - imageY);
+ drawableY - imageY);
XCopyArea(display, instancePtr->pixels, drawable, instancePtr->gc,
- imageX, imageY, (unsigned) width, (unsigned) height,
- drawableX, drawableY);
+ imageX, imageY, (unsigned) width, (unsigned) height,
+ drawableX, drawableY);
XSetClipMask(display, instancePtr->gc, None);
XSetClipOrigin(display, instancePtr->gc, 0, 0);
}
- XFlush (display);
+ XFlush(display);
}
/*
@@ -2834,10 +2832,9 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
*
* ImgPhotoFree --
*
- * This procedure is called when a widget ceases to use a
- * particular instance of an image. We don't actually get
- * rid of the instance until later because we may be about
- * to get this instance again.
+ * This function is called when a widget ceases to use a particular
+ * instance of an image. We don't actually get rid of the instance until
+ * later because we may be about to get this instance again.
*
* Results:
* None.
@@ -2849,10 +2846,11 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
*/
static void
-ImgPhotoFree(clientData, display)
- ClientData clientData; /* Pointer to PhotoInstance structure for
- * for instance to be displayed. */
- Display *display; /* Display containing window that used image. */
+ImgPhotoFree(
+ ClientData clientData, /* Pointer to PhotoInstance structure for
+ * instance to be displayed. */
+ Display *display) /* Display containing window that used
+ * image. */
{
PhotoInstance *instancePtr = (PhotoInstance *) clientData;
ColorTable *colorPtr;
@@ -2863,17 +2861,17 @@ ImgPhotoFree(clientData, display)
}
/*
- * There are no more uses of the image within this widget.
- * Decrement the count of live uses of its color table, so
- * that its colors can be reclaimed if necessary, and
- * set up an idle call to free the instance structure.
+ * There are no more uses of the image within this widget. Decrement the
+ * count of live uses of its color table, so that its colors can be
+ * reclaimed if necessary, and set up an idle call to free the instance
+ * structure.
*/
colorPtr = instancePtr->colorTablePtr;
if (colorPtr != NULL) {
colorPtr->liveRefCount -= 1;
}
-
+
Tcl_DoWhenIdle(DisposeInstance, (ClientData) instancePtr);
}
@@ -2882,8 +2880,8 @@ ImgPhotoFree(clientData, display)
*
* ImgPhotoDelete --
*
- * This procedure is called by the image code to delete the
- * master structure for an image.
+ * This function is called by the image code to delete the master
+ * structure for an image.
*
* Results:
* None.
@@ -2895,16 +2893,16 @@ ImgPhotoFree(clientData, display)
*/
static void
-ImgPhotoDelete(masterData)
- ClientData masterData; /* Pointer to PhotoMaster structure for
- * image. Must not have any more instances. */
+ImgPhotoDelete(
+ ClientData masterData) /* Pointer to PhotoMaster structure for image.
+ * Must not have any more instances. */
{
PhotoMaster *masterPtr = (PhotoMaster *) masterData;
PhotoInstance *instancePtr;
while ((instancePtr = masterPtr->instancePtr) != NULL) {
if (instancePtr->refCount > 0) {
- panic("tried to delete photo image when instances still exist");
+ Tcl_Panic("tried to delete photo image when instances still exist");
}
Tcl_CancelIdleCall(DisposeInstance, (ClientData) instancePtr);
DisposeInstance((ClientData) instancePtr);
@@ -2925,7 +2923,7 @@ ImgPhotoDelete(masterData)
if (masterPtr->format != NULL) {
Tcl_DecrRefCount(masterPtr->format);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, (Display *) NULL, 0);
+ Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
ckfree((char *) masterPtr);
}
@@ -2934,8 +2932,8 @@ ImgPhotoDelete(masterData)
*
* ImgPhotoCmdDeletedProc --
*
- * This procedure is invoked when the image command for an image
- * is deleted. It deletes the image.
+ * This function is invoked when the image command for an image is
+ * deleted. It deletes the image.
*
* Results:
* None.
@@ -2947,8 +2945,8 @@ ImgPhotoDelete(masterData)
*/
static void
-ImgPhotoCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to PhotoMaster structure for
+ImgPhotoCmdDeletedProc(
+ ClientData clientData) /* Pointer to PhotoMaster structure for
* image. */
{
PhotoMaster *masterPtr = (PhotoMaster *) clientData;
@@ -2964,13 +2962,13 @@ ImgPhotoCmdDeletedProc(clientData)
*
* ImgPhotoSetSize --
*
- * This procedure reallocates the image storage and instance
- * pixmaps for a photo image, as necessary, to change the
- * image's size to `width' x `height' pixels.
+ * This function reallocates the image storage and instance pixmaps for a
+ * photo image, as necessary, to change the image's size to `width' x
+ * `height' pixels.
*
* Results:
- * TCL_OK if successful, TCL_ERROR if failure occurred (currently
- * just with memory allocation.)
+ * TCL_OK if successful, TCL_ERROR if failure occurred (currently just
+ * with memory allocation.)
*
* Side effects:
* Storage gets reallocated, for the master and all its instances.
@@ -2979,9 +2977,9 @@ ImgPhotoCmdDeletedProc(clientData)
*/
static int
-ImgPhotoSetSize(masterPtr, width, height)
- PhotoMaster *masterPtr;
- int width, height;
+ImgPhotoSetSize(
+ PhotoMaster *masterPtr,
+ int width, int height)
{
unsigned char *newPix32 = NULL;
int h, offset, pitch;
@@ -3000,19 +2998,22 @@ ImgPhotoSetSize(masterPtr, width, height)
pitch = width * 4;
/*
- * Test if we're going to (re)allocate the main buffer now, so
- * that any failures will leave the photo unchanged.
+ * Test if we're going to (re)allocate the main buffer now, so that any
+ * failures will leave the photo unchanged.
*/
+
if ((width != masterPtr->width) || (height != masterPtr->height)
|| (masterPtr->pix32 == NULL)) {
/*
* Not a u-long, but should be one.
*/
+
unsigned /*long*/ newPixSize = (unsigned /*long*/) (height * pitch);
/*
* Some mallocs() really hate allocating zero bytes. [Bug 619544]
*/
+
if (newPixSize == 0) {
newPix32 = NULL;
} else {
@@ -3024,8 +3025,8 @@ ImgPhotoSetSize(masterPtr, width, height)
}
/*
- * We have to trim the valid region if it is currently
- * larger than the new image size.
+ * We have to trim the valid region if it is currently larger than the new
+ * image size.
*/
TkClipBox(masterPtr->validRegion, &validBox);
@@ -3044,36 +3045,35 @@ ImgPhotoSetSize(masterPtr, width, height)
}
/*
- * Use the reallocated storage (allocation above) for the 32-bit
- * image and copy over valid regions. Note that this test is true
- * precisely when the allocation has already been done.
+ * Use the reallocated storage (allocation above) for the 32-bit image and
+ * copy over valid regions. Note that this test is true precisely when the
+ * allocation has already been done.
*/
+
if (newPix32 != NULL) {
/*
- * Zero the new array. The dithering code shouldn't read the
- * areas outside validBox, but they might be copied to another
- * photo image or written to a file.
+ * Zero the new array. The dithering code shouldn't read the areas
+ * outside validBox, but they might be copied to another photo image
+ * or written to a file.
*/
if ((masterPtr->pix32 != NULL)
&& ((width == masterPtr->width) || (width == validBox.width))) {
if (validBox.y > 0) {
- memset((VOID *) newPix32, 0, (size_t) (validBox.y * pitch));
+ memset(newPix32, 0, (size_t) (validBox.y * pitch));
}
h = validBox.y + validBox.height;
if (h < height) {
- memset((VOID *) (newPix32 + h * pitch), 0,
- (size_t) ((height - h) * pitch));
+ memset(newPix32 + h*pitch, 0, (size_t) ((height - h) * pitch));
}
} else {
- memset((VOID *) newPix32, 0, (size_t) (height * pitch));
+ memset(newPix32, 0, (size_t) (height * pitch));
}
if (masterPtr->pix32 != NULL) {
-
/*
- * Copy the common area over to the new array array and
- * free the old array.
+ * Copy the common area over to the new array array and free the
+ * old array.
*/
if (width == masterPtr->width) {
@@ -3083,12 +3083,10 @@ ImgPhotoSetSize(masterPtr, width, height)
*/
offset = validBox.y * pitch;
- memcpy((VOID *) (newPix32 + offset),
- (VOID *) (masterPtr->pix32 + offset),
+ memcpy(newPix32 + offset, masterPtr->pix32 + offset,
(size_t) (validBox.height * pitch));
} else if ((validBox.width > 0) && (validBox.height > 0)) {
-
/*
* Area to be copied is not contiguous - copy line by line.
*/
@@ -3097,8 +3095,7 @@ ImgPhotoSetSize(masterPtr, width, height)
srcPtr = masterPtr->pix32 + (validBox.y * masterPtr->width
+ validBox.x) * 4;
for (h = validBox.height; h > 0; h--) {
- memcpy((VOID *) destPtr, (VOID *) srcPtr,
- (size_t) (validBox.width * 4));
+ memcpy(destPtr, srcPtr, (size_t) (validBox.width * 4));
destPtr += width * 4;
srcPtr += masterPtr->width * 4;
}
@@ -3112,8 +3109,8 @@ ImgPhotoSetSize(masterPtr, width, height)
masterPtr->height = height;
/*
- * Dithering will be correct up to the end of the last
- * pre-existing complete scanline.
+ * Dithering will be correct up to the end of the last pre-existing
+ * complete scanline.
*/
if ((validBox.x > 0) || (validBox.y > 0)) {
@@ -3150,9 +3147,9 @@ ImgPhotoSetSize(masterPtr, width, height)
*
* ImgPhotoInstanceSetSize --
*
- * This procedure reallocates the instance pixmap and dithering
- * error array for a photo instance, as necessary, to change the
- * image's size to `width' x `height' pixels.
+ * This function reallocates the instance pixmap and dithering error
+ * array for a photo instance, as necessary, to change the image's size
+ * to `width' x `height' pixels.
*
* Results:
* None.
@@ -3164,13 +3161,11 @@ ImgPhotoSetSize(masterPtr, width, height)
*/
static void
-ImgPhotoInstanceSetSize(instancePtr)
- PhotoInstance *instancePtr; /* Instance whose size is to be
- * changed. */
+ImgPhotoInstanceSetSize(
+ PhotoInstance *instancePtr) /* Instance whose size is to be changed. */
{
PhotoMaster *masterPtr;
- schar *newError;
- schar *errSrcPtr, *errDestPtr;
+ schar *newError, *errSrcPtr, *errDestPtr;
int h, offset;
XRectangle validBox;
Pixmap newPixmap;
@@ -3183,22 +3178,21 @@ ImgPhotoInstanceSetSize(instancePtr)
|| (instancePtr->pixels == None)) {
newPixmap = Tk_GetPixmap(instancePtr->display,
RootWindow(instancePtr->display,
- instancePtr->visualInfo.screen),
+ instancePtr->visualInfo.screen),
(masterPtr->width > 0) ? masterPtr->width: 1,
(masterPtr->height > 0) ? masterPtr->height: 1,
instancePtr->visualInfo.depth);
- if (!newPixmap) {
- panic("Fail to create pixmap with Tk_GetPixmap in ImgPhotoInstanceSetSize.\n");
- return;
- }
+ if (!newPixmap) {
+ Tcl_Panic("Fail to create pixmap with Tk_GetPixmap in ImgPhotoInstanceSetSize.\n");
+ }
/*
* The following is a gross hack needed to properly support colormaps
- * under Windows. Before the pixels can be copied to the pixmap,
- * the relevent colormap must be associated with the drawable.
- * Normally we can infer this association from the window that
- * was used to create the pixmap. However, in this case we're
- * using the root window, so we have to be more explicit.
+ * under Windows. Before the pixels can be copied to the pixmap, the
+ * relevent colormap must be associated with the drawable. Normally we
+ * can infer this association from the window that was used to create
+ * the pixmap. However, in this case we're using the root window, so
+ * we have to be more explicit.
*/
TkSetPixmapColormap(newPixmap, instancePtr->colormap);
@@ -3207,6 +3201,7 @@ ImgPhotoInstanceSetSize(instancePtr)
/*
* Copy any common pixels from the old pixmap and free it.
*/
+
XCopyArea(instancePtr->display, instancePtr->pixels, newPixmap,
instancePtr->gc, validBox.x, validBox.y,
validBox.width, validBox.height, validBox.x, validBox.y);
@@ -3224,54 +3219,51 @@ ImgPhotoInstanceSetSize(instancePtr)
masterPtr->height * masterPtr->width * 3 * sizeof(schar));
/*
- * Zero the new array so that we don't get bogus error
- * values propagating into areas we dither later.
+ * Zero the new array so that we don't get bogus error values
+ * propagating into areas we dither later.
*/
if ((instancePtr->error != NULL)
&& ((instancePtr->width == masterPtr->width)
|| (validBox.width == masterPtr->width))) {
if (validBox.y > 0) {
- memset((VOID *) newError, 0, (size_t)
+ memset(newError, 0, (size_t)
validBox.y * masterPtr->width * 3 * sizeof(schar));
}
h = validBox.y + validBox.height;
if (h < masterPtr->height) {
- memset((VOID *) (newError + h * masterPtr->width * 3), 0,
+ memset(newError + h*masterPtr->width*3, 0,
(size_t) (masterPtr->height - h)
* masterPtr->width * 3 * sizeof(schar));
}
} else {
- memset((VOID *) newError, 0, (size_t)
- masterPtr->height * masterPtr->width * 3 * sizeof(schar));
+ memset(newError, 0, (size_t)
+ masterPtr->height * masterPtr->width *3*sizeof(schar));
}
} else {
newError = NULL;
}
if (instancePtr->error != NULL) {
-
/*
- * Copy the common area over to the new array
- * and free the old array.
+ * Copy the common area over to the new array and free the old
+ * array.
*/
if (masterPtr->width == instancePtr->width) {
-
offset = validBox.y * masterPtr->width * 3;
- memcpy((VOID *) (newError + offset),
- (VOID *) (instancePtr->error + offset),
+ memcpy(newError + offset, instancePtr->error + offset,
(size_t) (validBox.height
* masterPtr->width * 3 * sizeof(schar)));
} else if (validBox.width > 0 && validBox.height > 0) {
+ errDestPtr = newError +
+ (validBox.y * masterPtr->width + validBox.x) * 3;
+ errSrcPtr = instancePtr->error +
+ (validBox.y * instancePtr->width + validBox.x) * 3;
- errDestPtr = newError
- + (validBox.y * masterPtr->width + validBox.x) * 3;
- errSrcPtr = instancePtr->error
- + (validBox.y * instancePtr->width + validBox.x) * 3;
for (h = validBox.height; h > 0; --h) {
- memcpy((VOID *) errDestPtr, (VOID *) errSrcPtr,
+ memcpy(errDestPtr, errSrcPtr,
validBox.width * 3 * sizeof(schar));
errDestPtr += masterPtr->width * 3;
errSrcPtr += instancePtr->width * 3;
@@ -3292,9 +3284,8 @@ ImgPhotoInstanceSetSize(instancePtr)
*
* IsValidPalette --
*
- * This procedure is called to check whether a value given for
- * the -palette option is valid for a particular instance
- * of a photo image.
+ * This function is called to check whether a value given for the
+ * -palette option is valid for a particular instance of a photo image.
*
* Results:
* A boolean value: 1 if the palette is acceptable, 0 otherwise.
@@ -3306,17 +3297,16 @@ ImgPhotoInstanceSetSize(instancePtr)
*/
static int
-IsValidPalette(instancePtr, palette)
- PhotoInstance *instancePtr; /* Instance to which the palette
- * specification is to be applied. */
- CONST char *palette; /* Palette specification string. */
+IsValidPalette(
+ PhotoInstance *instancePtr, /* Instance to which the palette specification
+ * is to be applied. */
+ const char *palette) /* Palette specification string. */
{
int nRed, nGreen, nBlue, mono, numColors;
char *endp;
/*
- * First parse the specification: it must be of the form
- * %d or %d/%d/%d.
+ * First parse the specification: it must be of the form %d or %d/%d/%d.
*/
nRed = strtol(palette, &endp, 10);
@@ -3345,32 +3335,30 @@ IsValidPalette(instancePtr, palette)
}
switch (instancePtr->visualInfo.class) {
- case DirectColor:
- case TrueColor:
- if ((nRed > (1 << CountBits(instancePtr->visualInfo.red_mask)))
- || (nGreen > (1
- << CountBits(instancePtr->visualInfo.green_mask)))
- || (nBlue > (1
- << CountBits(instancePtr->visualInfo.blue_mask)))) {
- return 0;
- }
- break;
- case PseudoColor:
- case StaticColor:
- numColors = nRed;
- if (!mono) {
- numColors *= nGreen*nBlue;
- }
- if (numColors > (1 << instancePtr->visualInfo.depth)) {
- return 0;
- }
- break;
- case GrayScale:
- case StaticGray:
- if (!mono || (nRed > (1 << instancePtr->visualInfo.depth))) {
- return 0;
- }
- break;
+ case DirectColor:
+ case TrueColor:
+ if ((nRed > (1 << CountBits(instancePtr->visualInfo.red_mask)))
+ || (nGreen>(1<<CountBits(instancePtr->visualInfo.green_mask)))
+ || (nBlue>(1<<CountBits(instancePtr->visualInfo.blue_mask)))) {
+ return 0;
+ }
+ break;
+ case PseudoColor:
+ case StaticColor:
+ numColors = nRed;
+ if (!mono) {
+ numColors *= nGreen*nBlue;
+ }
+ if (numColors > (1 << instancePtr->visualInfo.depth)) {
+ return 0;
+ }
+ break;
+ case GrayScale:
+ case StaticGray:
+ if (!mono || (nRed > (1 << instancePtr->visualInfo.depth))) {
+ return 0;
+ }
+ break;
}
return 1;
@@ -3381,7 +3369,7 @@ IsValidPalette(instancePtr, palette)
*
* CountBits --
*
- * This procedure counts how many bits are set to 1 in `mask'.
+ * This function counts how many bits are set to 1 in `mask'.
*
* Results:
* The integer number of bits.
@@ -3393,13 +3381,14 @@ IsValidPalette(instancePtr, palette)
*/
static int
-CountBits(mask)
- pixel mask; /* Value to count the 1 bits in. */
+CountBits(
+ pixel mask) /* Value to count the 1 bits in. */
{
int n;
- for( n = 0; mask != 0; mask &= mask - 1 )
+ for (n=0 ; mask!=0 ; mask&=mask-1) {
n++;
+ }
return n;
}
@@ -3408,28 +3397,27 @@ CountBits(mask)
*
* GetColorTable --
*
- * This procedure is called to allocate a table of colormap
- * information for an instance of a photo image. Only one such
- * table is allocated for all photo instances using the same
- * display, colormap, palette and gamma values, so that the
- * application need only request a set of colors from the X
- * server once for all such photo widgets. This procedure
- * maintains a hash table to find previously-allocated
+ * This function is called to allocate a table of colormap information
+ * for an instance of a photo image. Only one such table is allocated for
+ * all photo instances using the same display, colormap, palette and
+ * gamma values, so that the application need only request a set of
+ * colors from the X server once for all such photo widgets. This
+ * function maintains a hash table to find previously-allocated
* ColorTables.
*
* Results:
* None.
*
* Side effects:
- * A new ColorTable may be allocated and placed in the hash
- * table, and have colors allocated for it.
+ * A new ColorTable may be allocated and placed in the hash table, and
+ * have colors allocated for it.
*
*----------------------------------------------------------------------
*/
static void
-GetColorTable(instancePtr)
- PhotoInstance *instancePtr; /* Instance needing a color table. */
+GetColorTable(
+ PhotoInstance *instancePtr) /* Instance needing a color table. */
{
ColorTable *colorPtr;
Tcl_HashEntry *entry;
@@ -3440,7 +3428,7 @@ GetColorTable(instancePtr)
* Look for an existing ColorTable in the hash table.
*/
- memset((VOID *) &id, 0, sizeof(id));
+ memset(&id, 0, sizeof(id));
id.display = instancePtr->display;
id.colormap = instancePtr->colormap;
id.palette = instancePtr->palette;
@@ -3457,7 +3445,6 @@ GetColorTable(instancePtr)
*/
colorPtr = (ColorTable *) Tcl_GetHashValue(entry);
-
} else {
/*
* No color table currently available; need to make one.
@@ -3466,16 +3453,15 @@ GetColorTable(instancePtr)
colorPtr = (ColorTable *) ckalloc(sizeof(ColorTable));
/*
- * The following line of code should not normally be needed due
- * to the assignment in the following line. However, it compensates
- * for bugs in some compilers (HP, for example) where
- * sizeof(ColorTable) is 24 but the assignment only copies 20 bytes,
- * leaving 4 bytes uninitialized; these cause problems when using
- * the id for lookups in imgPhotoColorHash, and can result in
- * core dumps.
+ * The following line of code should not normally be needed due to the
+ * assignment in the following line. However, it compensates for bugs
+ * in some compilers (HP, for example) where sizeof(ColorTable) is 24
+ * but the assignment only copies 20 bytes, leaving 4 bytes
+ * uninitialized; these cause problems when using the id for lookups
+ * in imgPhotoColorHash, and can result in core dumps.
*/
- memset((VOID *) &colorPtr->id, 0, sizeof(ColorTableId));
+ memset(&colorPtr->id, 0, sizeof(ColorTableId));
colorPtr->id = id;
Tk_PreserveColormap(colorPtr->id.display, colorPtr->id.colormap);
colorPtr->flags = 0;
@@ -3510,30 +3496,30 @@ GetColorTable(instancePtr)
*
* FreeColorTable --
*
- * This procedure is called when an instance ceases using a
- * color table.
+ * This function is called when an instance ceases using a color table.
*
* Results:
* None.
*
* Side effects:
- * If no other instances are using this color table, a when-idle
- * handler is registered to free up the color table and the colors
- * allocated for it.
+ * If no other instances are using this color table, a when-idle handler
+ * is registered to free up the color table and the colors allocated for
+ * it.
*
*----------------------------------------------------------------------
*/
static void
-FreeColorTable(colorPtr, force)
- ColorTable *colorPtr; /* Pointer to the color table which is
- * no longer required by an instance. */
- int force; /* Force free to happen immediately. */
+FreeColorTable(
+ ColorTable *colorPtr, /* Pointer to the color table which is no
+ * longer required by an instance. */
+ int force) /* Force free to happen immediately. */
{
colorPtr->refCount--;
if (colorPtr->refCount > 0) {
return;
}
+
if (force) {
if ((colorPtr->flags & DISPOSE_PENDING) != 0) {
Tcl_CancelIdleCall(DisposeColorTable, (ClientData) colorPtr);
@@ -3551,24 +3537,24 @@ FreeColorTable(colorPtr, force)
*
* AllocateColors --
*
- * This procedure allocates the colors required by a color table,
- * and sets up the fields in the color table data structure which
- * are used in dithering.
+ * This function allocates the colors required by a color table, and sets
+ * up the fields in the color table data structure which are used in
+ * dithering.
*
* Results:
* None.
*
* Side effects:
- * Colors are allocated from the X server. Fields in the
- * color table data structure are updated.
+ * Colors are allocated from the X server. Fields in the color table data
+ * structure are updated.
*
*----------------------------------------------------------------------
*/
static void
-AllocateColors(colorPtr)
- ColorTable *colorPtr; /* Pointer to the color table requiring
- * colors to be allocated. */
+AllocateColors(
+ ColorTable *colorPtr) /* Pointer to the color table requiring colors
+ * to be allocated. */
{
int i, r, g, b, rMult, mono;
int numColors, nRed, nGreen, nBlue;
@@ -3576,11 +3562,13 @@ AllocateColors(colorPtr)
XColor *colors;
unsigned long *pixels;
- /* 16-bit intensity value for i/n of full intensity. */
-# define CFRAC(i, n) ((i) * 65535 / (n))
+ /*
+ * 16-bit intensity value for i/n of full intensity.
+ */
+#define CFRAC(i, n) ((i) * 65535 / (n))
/* As for CFRAC, but apply exponent of g. */
-# define CGFRAC(i, n, g) ((int)(65535 * pow((double)(i) / (n), (g))))
+#define CGFRAC(i, n, g) ((int)(65535 * pow((double)(i) / (n), (g))))
/*
* First parse the palette specification to get the required number of
@@ -3592,16 +3580,14 @@ AllocateColors(colorPtr)
igam = 1.0 / colorPtr->id.gamma;
/*
- * Each time around this loop, we reduce the number of colors we're
- * trying to allocate until we succeed in allocating all of the colors
- * we need.
+ * Each time around this loop, we reduce the number of colors we're trying
+ * to allocate until we succeed in allocating all of the colors we need.
*/
for (;;) {
/*
- * If we are using 1 bit/pixel, we don't need to allocate
- * any colors (we just use the foreground and background
- * colors in the GC).
+ * If we are using 1 bit/pixel, we don't need to allocate any colors
+ * (we just use the foreground and background colors in the GC).
*/
if (mono && (nRed <= 2)) {
@@ -3610,12 +3596,12 @@ AllocateColors(colorPtr)
}
/*
- * Calculate the RGB coordinates of the colors we want to
- * allocate and store them in *colors.
+ * Calculate the RGB coordinates of the colors we want to allocate and
+ * store them in *colors.
*/
if ((colorPtr->visualInfo.class == DirectColor)
- || (colorPtr->visualInfo.class == TrueColor)) {
+ || (colorPtr->visualInfo.class == TrueColor)) {
/*
* Direct/True Color: allocate shades of red, green, blue
@@ -3642,8 +3628,8 @@ AllocateColors(colorPtr)
}
} else {
/*
- * PseudoColor, StaticColor, GrayScale or StaticGray visual:
- * we have to allocate each color in the color cube separately.
+ * PseudoColor, StaticColor, GrayScale or StaticGray visual: we
+ * have to allocate each color in the color cube separately.
*/
numColors = (mono) ? nRed: (nRed * nGreen * nBlue);
@@ -3695,7 +3681,6 @@ AllocateColors(colorPtr)
for (i = 0; i < numColors; ++i) {
if (!XAllocColor(colorPtr->id.display, colorPtr->id.colormap,
&colors[i])) {
-
/*
* Can't get all the colors we want in the default colormap;
* first try freeing colors from other unused color tables.
@@ -3707,6 +3692,7 @@ AllocateColors(colorPtr)
/*
* Still can't allocate the color.
*/
+
break;
}
}
@@ -3714,9 +3700,8 @@ AllocateColors(colorPtr)
}
/*
- * If we didn't get all of the colors, reduce the
- * resolution of the color cube, free the ones we got,
- * and try again.
+ * If we didn't get all of the colors, reduce the resolution of the
+ * color cube, free the ones we got, and try again.
*/
if (i >= numColors) {
@@ -3735,10 +3720,10 @@ AllocateColors(colorPtr)
mono = 1;
} else {
/*
- * Reduce the number of shades of each primary to about
- * 3/4 of the previous value. This should reduce the
- * total number of colors required to about half the
- * previous value for PseudoColor displays.
+ * Reduce the number of shades of each primary to about 3/4 of
+ * the previous value. This should reduce the total number of
+ * colors required to about half the previous value for
+ * PseudoColor displays.
*/
nRed = (nRed * 3 + 2) / 4;
@@ -3753,23 +3738,22 @@ AllocateColors(colorPtr)
nRed = nRed / 2;
}
}
-
+
/*
- * We have allocated all of the necessary colors:
- * fill in various fields of the ColorTable record.
+ * We have allocated all of the necessary colors: fill in various fields
+ * of the ColorTable record.
*/
if (!mono) {
colorPtr->flags |= COLOR_WINDOW;
/*
- * The following is a hairy hack. We only want to index into
- * the pixelMap on colormap displays. However, if the display
- * is on Windows, then we actually want to store the index not
- * the value since we will be passing the color table into the
- * TkPutImage call.
+ * The following is a hairy hack. We only want to index into the
+ * pixelMap on colormap displays. However, if the display is on
+ * Windows, then we actually want to store the index not the value
+ * since we will be passing the color table into the TkPutImage call.
*/
-
+
#ifndef __WIN32__
if ((colorPtr->visualInfo.class != DirectColor)
&& (colorPtr->visualInfo.class != TrueColor)) {
@@ -3784,6 +3768,7 @@ AllocateColors(colorPtr)
/*
* Set up quantization tables for dithering.
*/
+
rMult = nGreen * nBlue;
for (i = 0; i < 256; ++i) {
r = (i * (nRed - 1) + 127) / 255;
@@ -3799,12 +3784,12 @@ AllocateColors(colorPtr)
b = (i * (nBlue - 1) + 127) / 255;
if ((colorPtr->visualInfo.class == DirectColor)
|| (colorPtr->visualInfo.class == TrueColor)) {
- colorPtr->redValues[i] = colors[r].pixel
- & colorPtr->visualInfo.red_mask;
- colorPtr->greenValues[i] = colors[g].pixel
- & colorPtr->visualInfo.green_mask;
- colorPtr->blueValues[i] = colors[b].pixel
- & colorPtr->visualInfo.blue_mask;
+ colorPtr->redValues[i] =
+ colors[r].pixel & colorPtr->visualInfo.red_mask;
+ colorPtr->greenValues[i] =
+ colors[g].pixel & colorPtr->visualInfo.green_mask;
+ colorPtr->blueValues[i] =
+ colors[b].pixel & colorPtr->visualInfo.blue_mask;
} else {
r *= rMult;
g *= nBlue;
@@ -3834,27 +3819,27 @@ AllocateColors(colorPtr)
*
* DisposeColorTable --
*
+ * Release a color table and its associated resources.
*
* Results:
* None.
*
* Side effects:
- * The colors in the argument color table are freed, as is the
- * color table structure itself. The color table is removed
- * from the hash table which is used to locate color tables.
+ * The colors in the argument color table are freed, as is the color
+ * table structure itself. The color table is removed from the hash table
+ * which is used to locate color tables.
*
*----------------------------------------------------------------------
*/
static void
-DisposeColorTable(clientData)
- ClientData clientData; /* Pointer to the ColorTable whose
+DisposeColorTable(
+ ClientData clientData) /* Pointer to the ColorTable whose
* colors are to be released. */
{
- ColorTable *colorPtr;
+ ColorTable *colorPtr = (ColorTable *) clientData;
Tcl_HashEntry *entry;
- colorPtr = (ColorTable *) clientData;
if (colorPtr->pixelMap != NULL) {
if (colorPtr->numColors > 0) {
XFreeColors(colorPtr->id.display, colorPtr->id.colormap,
@@ -3866,7 +3851,7 @@ DisposeColorTable(clientData)
entry = Tcl_FindHashEntry(&imgPhotoColorHash, (char *) &colorPtr->id);
if (entry == NULL) {
- panic("DisposeColorTable couldn't find hash entry");
+ Tcl_Panic("DisposeColorTable couldn't find hash entry");
}
Tcl_DeleteHashEntry(entry);
@@ -3878,48 +3863,46 @@ DisposeColorTable(clientData)
*
* ReclaimColors --
*
- * This procedure is called to try to free up colors in the
- * colormap used by a color table. It looks for other color
- * tables with the same colormap and with a zero live reference
- * count, and frees their colors. It only does so if there is
- * the possibility of freeing up at least `numColors' colors.
+ * This function is called to try to free up colors in the colormap used
+ * by a color table. It looks for other color tables with the same
+ * colormap and with a zero live reference count, and frees their colors.
+ * It only does so if there is the possibility of freeing up at least
+ * `numColors' colors.
*
* Results:
- * The return value is TRUE if any colors were freed, FALSE
- * otherwise.
+ * The return value is TRUE if any colors were freed, FALSE otherwise.
*
* Side effects:
- * ColorTables which are not currently in use may lose their
- * color allocations.
+ * ColorTables which are not currently in use may lose their color
+ * allocations.
*
- *---------------------------------------------------------------------- */
+ *----------------------------------------------------------------------
+ */
static int
-ReclaimColors(id, numColors)
- ColorTableId *id; /* Pointer to information identifying
+ReclaimColors(
+ ColorTableId *id, /* Pointer to information identifying
* the color table which needs more colors. */
- int numColors; /* Number of colors required. */
+ int numColors) /* Number of colors required. */
{
Tcl_HashSearch srch;
Tcl_HashEntry *entry;
ColorTable *colorPtr;
- int nAvail;
+ int nAvail = 0;
/*
- * First scan through the color hash table to get an
- * upper bound on how many colors we might be able to free.
+ * First scan through the color hash table to get an upper bound on how
+ * many colors we might be able to free.
*/
- nAvail = 0;
entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch);
while (entry != NULL) {
colorPtr = (ColorTable *) Tcl_GetHashValue(entry);
if ((colorPtr->id.display == id->display)
- && (colorPtr->id.colormap == id->colormap)
- && (colorPtr->liveRefCount == 0 )&& (colorPtr->numColors != 0)
- && ((colorPtr->id.palette != id->palette)
- || (colorPtr->id.gamma != id->gamma))) {
-
+ && (colorPtr->id.colormap == id->colormap)
+ && (colorPtr->liveRefCount == 0 )&& (colorPtr->numColors != 0)
+ && ((colorPtr->id.palette != id->palette)
+ || (colorPtr->id.gamma != id->gamma))) {
/*
* We could take this guy's colors off him.
*/
@@ -3948,8 +3931,7 @@ ReclaimColors(id, numColors)
&& (colorPtr->id.colormap == id->colormap)
&& (colorPtr->liveRefCount == 0) && (colorPtr->numColors != 0)
&& ((colorPtr->id.palette != id->palette)
- || (colorPtr->id.gamma != id->gamma))) {
-
+ || (colorPtr->id.gamma != id->gamma))) {
/*
* Free the colors that this ColorTable has.
*/
@@ -3964,7 +3946,7 @@ ReclaimColors(id, numColors)
entry = Tcl_NextHashEntry(&srch);
}
- return 1; /* we freed some colors */
+ return 1; /* We freed some colors. */
}
/*
@@ -3972,23 +3954,22 @@ ReclaimColors(id, numColors)
*
* DisposeInstance --
*
- * This procedure is called to finally free up an instance
- * of a photo image which is no longer required.
+ * This function is called to finally free up an instance of a photo
+ * image which is no longer required.
*
* Results:
* None.
*
* Side effects:
- * The instance data structure and the resources it references
- * are freed.
+ * The instance data structure and the resources it references are freed.
*
*----------------------------------------------------------------------
*/
static void
-DisposeInstance(clientData)
- ClientData clientData; /* Pointer to the instance whose resources
- * are to be released. */
+DisposeInstance(
+ ClientData clientData) /* Pointer to the instance whose resources are
+ * to be released. */
{
PhotoInstance *instancePtr = (PhotoInstance *) clientData;
PhotoInstance *prevPtr;
@@ -4014,7 +3995,7 @@ DisposeInstance(clientData)
} else {
for (prevPtr = instancePtr->masterPtr->instancePtr;
prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) {
- /* Empty loop body */
+ /* Empty loop body. */
}
prevPtr->nextPtr = instancePtr->nextPtr;
}
@@ -4027,16 +4008,16 @@ DisposeInstance(clientData)
*
* MatchFileFormat --
*
- * This procedure is called to find a photo image file format
- * handler which can parse the image data in the given file.
- * If a user-specified format string is provided, only handlers
- * whose names match a prefix of the format string are tried.
+ * This function is called to find a photo image file format handler
+ * which can parse the image data in the given file. If a user-specified
+ * format string is provided, only handlers whose names match a prefix of
+ * the format string are tried.
*
* Results:
- * A standard TCL return value. If the return value is TCL_OK, a
- * pointer to the image format record is returned in
- * *imageFormatPtr, and the width and height of the image are
- * returned in *widthPtr and *heightPtr.
+ * A standard TCL return value. If the return value is TCL_OK, a pointer
+ * to the image format record is returned in *imageFormatPtr, and the
+ * width and height of the image are returned in *widthPtr and
+ * *heightPtr.
*
* Side effects:
* None.
@@ -4045,24 +4026,23 @@ DisposeInstance(clientData)
*/
static int
-MatchFileFormat(interp, chan, fileName, formatObj, imageFormatPtr,
- widthPtr, heightPtr, oldformat)
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- Tcl_Channel chan; /* The image file, open for reading. */
- char *fileName; /* The name of the image file. */
- Tcl_Obj *formatObj; /* User-specified format string, or NULL. */
- Tk_PhotoImageFormat **imageFormatPtr;
- /* A pointer to the photo image format
- * record is returned here. */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here. */
- int *oldformat;
+MatchFileFormat(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Channel chan, /* The image file, open for reading. */
+ char *fileName, /* The name of the image file. */
+ Tcl_Obj *formatObj, /* User-specified format string, or NULL. */
+ Tk_PhotoImageFormat **imageFormatPtr,
+ /* A pointer to the photo image format record
+ * is returned here. */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here. */
+ int *oldformat) /* Returns 1 if the old image API is used. */
{
- int matched;
- int useoldformat = 0;
+ int matched = 0, useoldformat = 0;
Tk_PhotoImageFormat *formatPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
char *formatString = NULL;
if (formatObj) {
@@ -4070,13 +4050,12 @@ MatchFileFormat(interp, chan, fileName, formatObj, imageFormatPtr,
}
/*
- * Scan through the table of file format handlers to find
- * one which can handle the image.
+ * Scan through the table of file format handlers to find one which can
+ * handle the image.
*/
- matched = 0;
for (formatPtr = tsdPtr->formatList; formatPtr != NULL;
- formatPtr = formatPtr->nextPtr) {
+ formatPtr = formatPtr->nextPtr) {
if (formatObj != NULL) {
if (strncasecmp(formatString,
formatPtr->name, strlen(formatPtr->name)) != 0) {
@@ -4085,13 +4064,13 @@ MatchFileFormat(interp, chan, fileName, formatObj, imageFormatPtr,
matched = 1;
if (formatPtr->fileMatchProc == NULL) {
Tcl_AppendResult(interp, "-file option isn't supported for ",
- formatString, " images", (char *) NULL);
+ formatString, " images", NULL);
return TCL_ERROR;
}
}
if (formatPtr->fileMatchProc != NULL) {
(void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET);
-
+
if ((*formatPtr->fileMatchProc)(chan, fileName, formatObj,
widthPtr, heightPtr, interp)) {
if (*widthPtr < 1) {
@@ -4116,7 +4095,7 @@ MatchFileFormat(interp, chan, fileName, formatObj, imageFormatPtr,
matched = 1;
if (formatPtr->fileMatchProc == NULL) {
Tcl_AppendResult(interp, "-file option isn't supported",
- " for ", formatString, " images", (char *) NULL);
+ " for ", formatString, " images", NULL);
return TCL_ERROR;
}
}
@@ -4138,13 +4117,12 @@ MatchFileFormat(interp, chan, fileName, formatObj, imageFormatPtr,
if (formatPtr == NULL) {
if ((formatObj != NULL) && !matched) {
- Tcl_AppendResult(interp, "image file format \"",
- formatString,
- "\" is not supported", (char *) NULL);
+ Tcl_AppendResult(interp, "image file format \"", formatString,
+ "\" is not supported", NULL);
} else {
Tcl_AppendResult(interp,
- "couldn't recognize data in image file \"",
- fileName, "\"", (char *) NULL);
+ "couldn't recognize data in image file \"", fileName, "\"",
+ NULL);
}
return TCL_ERROR;
}
@@ -4160,16 +4138,16 @@ MatchFileFormat(interp, chan, fileName, formatObj, imageFormatPtr,
*
* MatchStringFormat --
*
- * This procedure is called to find a photo image file format
- * handler which can parse the image data in the given string.
- * If a user-specified format string is provided, only handlers
- * whose names match a prefix of the format string are tried.
+ * This function is called to find a photo image file format handler
+ * which can parse the image data in the given string. If a
+ * user-specified format string is provided, only handlers whose names
+ * match a prefix of the format string are tried.
*
* Results:
- * A standard TCL return value. If the return value is TCL_OK, a
- * pointer to the image format record is returned in
- * *imageFormatPtr, and the width and height of the image are
- * returned in *widthPtr and *heightPtr.
+ * A standard TCL return value. If the return value is TCL_OK, a pointer
+ * to the image format record is returned in *imageFormatPtr, and the
+ * width and height of the image are returned in *widthPtr and
+ * *heightPtr.
*
* Side effects:
* None.
@@ -4178,35 +4156,33 @@ MatchFileFormat(interp, chan, fileName, formatObj, imageFormatPtr,
*/
static int
-MatchStringFormat(interp, data, formatObj, imageFormatPtr,
- widthPtr, heightPtr, oldformat)
- Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- Tcl_Obj *data; /* Object containing the image data. */
- Tcl_Obj *formatObj; /* User-specified format string, or NULL. */
- Tk_PhotoImageFormat **imageFormatPtr;
- /* A pointer to the photo image format
- * record is returned here. */
- int *widthPtr, *heightPtr; /* The dimensions of the image are
- * returned here. */
- int *oldformat; /* returns 1 if the old image API is used */
+MatchStringFormat(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tcl_Obj *data, /* Object containing the image data. */
+ Tcl_Obj *formatObj, /* User-specified format string, or NULL. */
+ Tk_PhotoImageFormat **imageFormatPtr,
+ /* A pointer to the photo image format record
+ * is returned here. */
+ int *widthPtr, int *heightPtr,
+ /* The dimensions of the image are returned
+ * here. */
+ int *oldformat) /* Returns 1 if the old image API is used. */
{
- int matched;
- int useoldformat = 0;
+ int matched = 0, useoldformat = 0;
Tk_PhotoImageFormat *formatPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
char *formatString = NULL;
-
+
if (formatObj) {
formatString = Tcl_GetString(formatObj);
}
/*
- * Scan through the table of file format handlers to find
- * one which can handle the image.
+ * Scan through the table of file format handlers to find one which can
+ * handle the image.
*/
- matched = 0;
for (formatPtr = tsdPtr->formatList; formatPtr != NULL;
formatPtr = formatPtr->nextPtr) {
if (formatObj != NULL) {
@@ -4217,7 +4193,7 @@ MatchStringFormat(interp, data, formatObj, imageFormatPtr,
matched = 1;
if (formatPtr->stringMatchProc == NULL) {
Tcl_AppendResult(interp, "-data option isn't supported for ",
- formatString, " images", (char *) NULL);
+ formatString, " images", NULL);
return TCL_ERROR;
}
}
@@ -4241,7 +4217,7 @@ MatchStringFormat(interp, data, formatObj, imageFormatPtr,
matched = 1;
if (formatPtr->stringMatchProc == NULL) {
Tcl_AppendResult(interp, "-data option isn't supported",
- " for ", formatString, " images", (char *) NULL);
+ " for ", formatString, " images", NULL);
return TCL_ERROR;
}
}
@@ -4258,10 +4234,9 @@ MatchStringFormat(interp, data, formatObj, imageFormatPtr,
if (formatPtr == NULL) {
if ((formatObj != NULL) && !matched) {
Tcl_AppendResult(interp, "image format \"", formatString,
- "\" is not supported", (char *) NULL);
+ "\" is not supported", NULL);
} else {
- Tcl_AppendResult(interp, "couldn't recognize image data",
- (char *) NULL);
+ Tcl_AppendResult(interp, "couldn't recognize image data", NULL);
}
return TCL_ERROR;
}
@@ -4276,14 +4251,14 @@ MatchStringFormat(interp, data, formatObj, imageFormatPtr,
*
* Tk_FindPhoto --
*
- * This procedure is called to get an opaque handle (actually a
- * PhotoMaster *) for a given image, which can be used in
- * subsequent calls to Tk_PhotoPutBlock, etc. The `name'
- * parameter is the name of the image.
+ * This function is called to get an opaque handle (actually a
+ * PhotoMaster *) for a given image, which can be used in subsequent
+ * calls to Tk_PhotoPutBlock, etc. The `name' parameter is the name of
+ * the image.
*
* Results:
- * The handle for the photo image, or NULL if there is no
- * photo image with the name given.
+ * The handle for the photo image, or NULL if there is no photo image
+ * with the name given.
*
* Side effects:
* None.
@@ -4292,16 +4267,16 @@ MatchStringFormat(interp, data, formatObj, imageFormatPtr,
*/
Tk_PhotoHandle
-Tk_FindPhoto(interp, imageName)
- Tcl_Interp *interp; /* Interpreter (application) in which image
+Tk_FindPhoto(
+ Tcl_Interp *interp, /* Interpreter (application) in which image
* exists. */
- CONST char *imageName; /* Name of the desired photo image. */
+ CONST char *imageName) /* Name of the desired photo image. */
{
ClientData clientData;
Tk_ImageType *typePtr;
clientData = Tk_GetImageMasterData(interp, imageName, &typePtr);
- if (typePtr != &tkPhotoImageType) {
+ if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) {
return NULL;
}
return (Tk_PhotoHandle) clientData;
@@ -4312,39 +4287,40 @@ Tk_FindPhoto(interp, imageName)
*
* Tk_PhotoPutBlock --
*
- * This procedure is called to put image data into a photo image.
+ * This function is called to put image data into a photo image.
*
* Results:
- * None.
+ * A standard Tcl result code.
*
* Side effects:
- * The image data is stored. The image may be expanded.
- * The Tk image code is informed that the image has changed.
+ * The image data is stored. The image may be expanded. The Tk image code
+ * is informed that the image has changed. If the result code is
+ * TCL_ERROR, an error message will be placed in the interpreter (if
+ * non-NULL).
*
- *---------------------------------------------------------------------- */
+ *----------------------------------------------------------------------
+ */
-void
-Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
- Tk_PhotoHandle handle; /* Opaque handle for the photo image
- * to be updated. */
- register Tk_PhotoImageBlock *blockPtr;
- /* Pointer to a structure describing the
- * pixel data to be copied into the image. */
- int x, y; /* Coordinates of the top-left pixel to
- * be updated in the image. */
- int width, height; /* Dimensions of the area of the image
- * to be updated. */
- int compRule; /* Compositing rule to use when processing
+int
+Tk_PhotoPutBlock(
+ Tcl_Interp *interp, /* Interpreter for passing back error
+ * messages, or NULL. */
+ Tk_PhotoHandle handle, /* Opaque handle for the photo image to be
+ * updated. */
+ register Tk_PhotoImageBlock *blockPtr,
+ /* Pointer to a structure describing the pixel
+ * data to be copied into the image. */
+ int x, int y, /* Coordinates of the top-left pixel to be
+ * updated in the image. */
+ int width, int height, /* Dimensions of the area of the image to be
+ * updated. */
+ int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
register PhotoMaster *masterPtr;
- int xEnd, yEnd;
- int greenOffset, blueOffset, alphaOffset;
- int wLeft, hLeft;
- int wCopy, hCopy;
- unsigned char *srcPtr, *srcLinePtr;
- unsigned char *destPtr, *destLinePtr;
- int pitch;
+ int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
+ int wLeft, hLeft, wCopy, hCopy, pitch;
+ unsigned char *srcPtr, *srcLinePtr, *destPtr, *destLinePtr;
int sourceIsSimplePhoto = compRule & SOURCE_IS_SIMPLE_ALPHA_PHOTO;
XRectangle rect;
@@ -4359,16 +4335,21 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
height = masterPtr->userHeight - y;
}
if ((width <= 0) || (height <= 0)) {
- return;
+ return TCL_OK;
}
xEnd = x + width;
yEnd = y + height;
if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
int sameSrc = (blockPtr->pixelPtr == masterPtr->pix32);
+
if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
- panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ if (interp != NULL) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
+ }
+ return TCL_ERROR;
}
if (sameSrc) {
blockPtr->pixelPtr = masterPtr->pix32;
@@ -4376,12 +4357,12 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
}
}
-
if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
&& (x < masterPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
+
masterPtr->ditherX = x;
masterPtr->ditherY = y;
}
@@ -4405,111 +4386,162 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
}
/*
- * Copy the data into our local 32-bit/pixel array.
- * If we can do it with a single memcpy, we do.
+ * Copy the data into our local 32-bit/pixel array. If we can do it with a
+ * single memcpy, we do.
*/
destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
pitch = masterPtr->width * 4;
/*
- * This test is probably too restrictive. We should also be able to
- * do a memcpy if pixelSize == 3 and alphaOffset == 0. Maybe other cases
- * too.
+ * Test to see if we can do the whole write in a single copy. This test is
+ * probably too restrictive. We should also be able to do a memcpy if
+ * pixelSize == 3 and alphaOffset == 0. Maybe other cases too.
*/
+
if ((blockPtr->pixelSize == 4)
&& (greenOffset == 1) && (blueOffset == 2) && (alphaOffset == 3)
&& (width <= blockPtr->width) && (height <= blockPtr->height)
&& ((height == 1) || ((x == 0) && (width == masterPtr->width)
&& (blockPtr->pitch == pitch)))
&& (compRule == TK_PHOTO_COMPOSITE_SET)) {
- memcpy((VOID *) destLinePtr,
- (VOID *) (blockPtr->pixelPtr + blockPtr->offset[0]),
+ memcpy(destLinePtr, blockPtr->pixelPtr + blockPtr->offset[0],
(size_t) (height * width * 4));
- } else {
- int alpha;
- for (hLeft = height; hLeft > 0;) {
- srcLinePtr = blockPtr->pixelPtr + blockPtr->offset[0];
- hCopy = MIN(hLeft, blockPtr->height);
- hLeft -= hCopy;
- for (; hCopy > 0; --hCopy) {
- if ((blockPtr->pixelSize == 4) && (greenOffset == 1)
+
+ /*
+ * We know there's an alpha offset and we're setting the data, so skip
+ * directly to the point when we recompute the photo validity region.
+ */
+
+ goto recalculateValidRegion;
+ }
+
+ /*
+ * Copy and merge pixels according to the compositing rule.
+ */
+
+ for (hLeft = height; hLeft > 0;) {
+ int pixelSize = blockPtr->pixelSize;
+ int compRuleSet = (compRule == TK_PHOTO_COMPOSITE_SET);
+
+ srcLinePtr = blockPtr->pixelPtr + blockPtr->offset[0];
+ hCopy = MIN(hLeft, blockPtr->height);
+ hLeft -= hCopy;
+ for (; hCopy > 0; --hCopy) {
+ /*
+ * If the layout of the source line matches our memory layout and
+ * we're setting, we can just copy the bytes directly, which is
+ * much faster.
+ */
+
+ if ((pixelSize == 4) && (greenOffset == 1)
&& (blueOffset == 2) && (alphaOffset == 3)
&& (width <= blockPtr->width)
- && (compRule == TK_PHOTO_COMPOSITE_SET)) {
- memcpy((VOID *) destLinePtr, (VOID *) srcLinePtr,
- (size_t) (width * 4));
- } else {
- destPtr = destLinePtr;
- for (wLeft = width; wLeft > 0;) {
- wCopy = MIN(wLeft, blockPtr->width);
- wLeft -= wCopy;
- srcPtr = srcLinePtr;
- for (; wCopy > 0; --wCopy) {
- alpha = srcPtr[alphaOffset];
-
- /*
- * In the easy case, we can just copy.
- */
- if (!alphaOffset || (alpha == 255)) {
- /* new solid part of the image */
- *destPtr++ = srcPtr[0];
- *destPtr++ = srcPtr[greenOffset];
- *destPtr++ = srcPtr[blueOffset];
- *destPtr++ = 255;
- srcPtr += blockPtr->pixelSize;
- continue;
- }
+ && compRuleSet) {
+ memcpy(destLinePtr, srcLinePtr, (size_t) (width * 4));
+ srcLinePtr += blockPtr->pitch;
+ destLinePtr += pitch;
+ continue;
+ }
- /*
- * Combine according to the compositing rule.
- */
- switch (compRule) {
- case TK_PHOTO_COMPOSITE_OVERLAY:
- if (!destPtr[3]) {
- /*
- * The destination is entirely
- * blank, so set it to the source,
- * just as if we used the SET
- * compositing rule.
- */
- case TK_PHOTO_COMPOSITE_SET:
- *destPtr++ = srcPtr[0];
- *destPtr++ = srcPtr[greenOffset];
- *destPtr++ = srcPtr[blueOffset];
- *destPtr++ = alpha;
- break;
- }
+ /*
+ * Have to copy the slow way.
+ */
+
+ destPtr = destLinePtr;
+ for (wLeft = width; wLeft > 0;) {
+ wCopy = MIN(wLeft, blockPtr->width);
+ wLeft -= wCopy;
+ srcPtr = srcLinePtr;
- if (alpha) {
- int Alpha = destPtr[3];
+ /*
+ * But we might be lucky and be able to use fairly fast loops.
+ * It's worth checking...
+ */
- /*
- * This implements the Porter-Duff
- * Source-Over compositing rule.
- */
+ if (alphaOffset == 0) {
+ /*
+ * This is the non-alpha case, so can still be fairly
+ * fast. Note that in the non-alpha-source case, the
+ * compositing rule doesn't apply.
+ */
- destPtr[0] = PD_SRC_OVER(srcPtr[0],alpha,destPtr[0],Alpha);
- destPtr[1] = PD_SRC_OVER(srcPtr[greenOffset],alpha,destPtr[1],Alpha);
- destPtr[2] = PD_SRC_OVER(srcPtr[blueOffset],alpha,destPtr[2],Alpha);
- destPtr[3] = PD_SRC_OVER_ALPHA(alpha,Alpha);
- }
- /*
- * else should be empty space
- */
- destPtr += 4;
- break;
-
- default:
- panic("unknown compositing rule: %d", compRule);
- }
- srcPtr += blockPtr->pixelSize;
- }
+ for (; wCopy>0 ; --wCopy, srcPtr+=pixelSize) {
+ *destPtr++ = srcPtr[0];
+ *destPtr++ = srcPtr[greenOffset];
+ *destPtr++ = srcPtr[blueOffset];
+ *destPtr++ = 255;
+ }
+ continue;
+ } else if (compRuleSet) {
+ /*
+ * This is the SET compositing rule, which just replaces
+ * what was there before with the new data. This is
+ * another fairly fast case. No point in doing a memcpy();
+ * the order of channels is probably wrong.
+ */
+
+ for (; wCopy>0 ; --wCopy, srcPtr+=pixelSize) {
+ *destPtr++ = srcPtr[0];
+ *destPtr++ = srcPtr[greenOffset];
+ *destPtr++ = srcPtr[blueOffset];
+ *destPtr++ = srcPtr[alphaOffset];
}
+ continue;
+ }
+
+ /*
+ * Bother; need to consider the alpha value of each pixel to
+ * know what to do.
+ */
+
+ for (; wCopy>0 ; --wCopy, srcPtr+=pixelSize) {
+ int alpha = srcPtr[alphaOffset];
+
+ if (alpha == 255 || !destPtr[3]) {
+ /*
+ * Either the source is 100% opaque, or the
+ * destination is entirely blank. In all cases, we
+ * just set the destination to the source.
+ */
+
+ *destPtr++ = srcPtr[0];
+ *destPtr++ = srcPtr[greenOffset];
+ *destPtr++ = srcPtr[blueOffset];
+ *destPtr++ = alpha;
+ continue;
+ }
+
+ /*
+ * Can still skip doing work if the source is 100%
+ * transparent at this point.
+ */
+
+ if (alpha) {
+ int Alpha = destPtr[3];
+
+ /*
+ * OK, there's real work to be done. Luckily, there's
+ * a substantial literature on what to do in this
+ * case. In particular, Porter and Duff have done a
+ * taxonomy of compositing rules, and the right one is
+ * the "Source Over" rule. This code implements that.
+ */
+
+ destPtr[0] = PD_SRC_OVER(srcPtr[0], alpha, destPtr[0],
+ Alpha);
+ destPtr[1] = PD_SRC_OVER(srcPtr[greenOffset], alpha,
+ destPtr[1], Alpha);
+ destPtr[2] = PD_SRC_OVER(srcPtr[blueOffset], alpha,
+ destPtr[2], Alpha);
+ destPtr[3] = PD_SRC_OVER_ALPHA(alpha, Alpha);
+ }
+
+ destPtr += 4;
}
- srcLinePtr += blockPtr->pitch;
- destLinePtr += pitch;
}
+ srcLinePtr += blockPtr->pitch;
+ destLinePtr += pitch;
}
}
@@ -4518,34 +4550,35 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
*/
if (alphaOffset) {
- int x1, y1, end;
-
/*
- * This block is grossly inefficient. For each row in the image, it
+ * This block is grossly inefficient. For each row in the image, it
* finds each continguous string of nontransparent pixels, then marks
- * those areas as valid in the validRegion mask. This makes drawing
+ * those areas as valid in the validRegion mask. This makes drawing
* very efficient, because of the way we use X: we just say, here's
- * your mask, and here's your data. We need not worry about the
- * current background color, etc. But this costs us a lot on the
- * image setup. Still, image setup only happens once, whereas the
- * drawing happens many times, so this might be the best way to go.
+ * your mask, and here's your data. We need not worry about the
+ * current background color, etc. But this costs us a lot on the image
+ * setup. Still, image setup only happens once, whereas the drawing
+ * happens many times, so this might be the best way to go.
*
* An alternative might be to not set up this mask, and instead, at
* drawing time, for each transparent pixel, set its color to the
- * color of the background behind that pixel. This is what I suspect
- * most of programs do. However, they don't have to deal with the
+ * color of the background behind that pixel. This is what I suspect
+ * most of programs do. However, they don't have to deal with the
* canvas, which could have many different background colors.
* Determining the correct bg color for a given pixel might be
* expensive.
*/
if (compRule != TK_PHOTO_COMPOSITE_OVERLAY) {
+ TkRegion workRgn;
+
/*
- * Don't need this when using the OVERLAY compositing rule,
- * which always strictly increases the valid region.
+ * Don't need this when using the OVERLAY compositing rule, which
+ * always strictly increases the valid region.
*/
- TkRegion workRgn = TkCreateRegion();
+ recalculateValidRegion:
+ workRgn = TkCreateRegion();
rect.x = x;
rect.y = y;
rect.width = width;
@@ -4556,34 +4589,15 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
TkDestroyRegion(workRgn);
}
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3;
- for (y1 = 0; y1 < height; y1++) {
- x1 = 0;
- destPtr = destLinePtr;
- while (x1 < width) {
- /* search for first non-transparent pixel */
- while ((x1 < width) && !*destPtr) {
- x1++;
- destPtr += 4;
- }
- end = x1;
- /* search for first transparent pixel */
- while ((end < width) && *destPtr) {
- end++;
- destPtr += 4;
- }
- if (end > x1) {
- rect.x = x + x1;
- rect.y = y + y1;
- rect.width = end - x1;
- rect.height = 1;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
- }
- x1 = end;
- }
- destLinePtr += masterPtr->width * 4;
- }
+ /*
+ * Factorize out the main part of the building of the region data to
+ * allow for more efficient per-platform implementations. [Bug 919066]
+ */
+
+ TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x,
+ (unsigned) y, (unsigned) width, (unsigned) height,
+ masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3,
+ 4, (unsigned) masterPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
@@ -4603,6 +4617,7 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
* builds up large simple-alpha images by single pixels. We don't
* negate COMPLEX_ALPHA in this case. [Bug 1409140]
*/
+
if (!(masterPtr->flags & COMPLEX_ALPHA)) {
unsigned char newAlpha;
@@ -4620,6 +4635,7 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
* Toggle to only checking the changed pixels requires knowing where
* the alpha pixels are.
*/
+
ToggleComplexAlphaIfNeeded(masterPtr);
}
@@ -4633,8 +4649,9 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height,
+ masterPtr->width, masterPtr->height);
+ return TCL_OK;
}
/*
@@ -4642,60 +4659,56 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
*
* Tk_PhotoPutZoomedBlock --
*
- * This procedure is called to put image data into a photo image,
- * with possible subsampling and/or zooming of the pixels.
+ * This function is called to put image data into a photo image, with
+ * possible subsampling and/or zooming of the pixels.
*
* Results:
* None.
*
* Side effects:
- * The image data is stored. The image may be expanded.
- * The Tk image code is informed that the image has changed.
+ * The image data is stored. The image may be expanded. The Tk image code
+ * is informed that the image has changed.
*
*----------------------------------------------------------------------
*/
-void
-Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
- subsampleX, subsampleY, compRule)
- Tk_PhotoHandle handle; /* Opaque handle for the photo image
- * to be updated. */
- register Tk_PhotoImageBlock *blockPtr;
- /* Pointer to a structure describing the
- * pixel data to be copied into the image. */
- int x, y; /* Coordinates of the top-left pixel to
- * be updated in the image. */
- int width, height; /* Dimensions of the area of the image
- * to be updated. */
- int zoomX, zoomY; /* Zoom factors for the X and Y axes. */
- int subsampleX, subsampleY; /* Subsampling factors for the X and Y axes. */
- int compRule; /* Compositing rule to use when processing
+int
+Tk_PhotoPutZoomedBlock(
+ Tcl_Interp *interp, /* Interpreter for passing back error
+ * messages, or NULL. */
+ Tk_PhotoHandle handle, /* Opaque handle for the photo image to be
+ * updated. */
+ register Tk_PhotoImageBlock *blockPtr,
+ /* Pointer to a structure describing the pixel
+ * data to be copied into the image. */
+ int x, int y, /* Coordinates of the top-left pixel to be
+ * updated in the image. */
+ int width, int height, /* Dimensions of the area of the image to be
+ * updated. */
+ int zoomX, int zoomY, /* Zoom factors for the X and Y axes. */
+ int subsampleX, int subsampleY,
+ /* Subsampling factors for the X and Y
+ * axes. */
+ int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- register PhotoMaster *masterPtr;
- int xEnd, yEnd;
- int greenOffset, blueOffset, alphaOffset;
- int wLeft, hLeft;
- int wCopy, hCopy;
- int blockWid, blockHt;
- unsigned char *srcPtr, *srcLinePtr, *srcOrigPtr;
- unsigned char *destPtr, *destLinePtr;
- int pitch;
- int xRepeat, yRepeat;
- int blockXSkip, blockYSkip, sourceIsSimplePhoto;
+ register PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
+ int wLeft, hLeft, wCopy, hCopy, blockWid, blockHt;
+ unsigned char *srcPtr, *srcLinePtr, *srcOrigPtr, *destPtr, *destLinePtr;
+ int pitch, xRepeat, yRepeat, blockXSkip, blockYSkip, sourceIsSimplePhoto;
XRectangle rect;
if (zoomX==1 && zoomY==1 && subsampleX==1 && subsampleY==1) {
- Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule);
- return;
+ return Tk_PhotoPutBlock(interp, handle, blockPtr, x, y, width, height,
+ compRule);
}
sourceIsSimplePhoto = compRule & SOURCE_IS_SIMPLE_ALPHA_PHOTO;
compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
- masterPtr = (PhotoMaster *) handle;
if (zoomX <= 0 || zoomY <= 0) {
- return;
+ return TCL_OK;
}
if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
width = masterPtr->userWidth - x;
@@ -4705,7 +4718,7 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
height = masterPtr->userHeight - y;
}
if (width <= 0 || height <= 0) {
- return;
+ return TCL_OK;
}
xEnd = x + width;
@@ -4714,7 +4727,11 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
int sameSrc = (blockPtr->pixelPtr == masterPtr->pix32);
if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
- panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ if (interp != NULL) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
+ }
+ return TCL_ERROR;
}
if (sameSrc) {
blockPtr->pixelPtr = masterPtr->pix32;
@@ -4799,10 +4816,12 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
srcPtr = srcLinePtr;
for (; wCopy > 0; wCopy -= zoomX) {
for (xRepeat = MIN(wCopy, zoomX); xRepeat > 0; xRepeat--) {
- int alpha = srcPtr[alphaOffset];
+ int alpha = srcPtr[alphaOffset];/* Source alpha. */
+
/*
* Common case (solid pixels) first
*/
+
if (!alphaOffset || (alpha == 255)) {
*destPtr++ = srcPtr[0];
*destPtr++ = srcPtr[greenOffset];
@@ -4811,32 +4830,33 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
continue;
}
- switch (compRule) {
- case TK_PHOTO_COMPOSITE_OVERLAY:
- if (!destPtr[3]) {
- /*
- * The destination is entirely blank,
- * so set it to the source, just as if
- * we used the SET compositing rule.
- */
- case TK_PHOTO_COMPOSITE_SET:
- *destPtr++ = srcPtr[0];
- *destPtr++ = srcPtr[greenOffset];
- *destPtr++ = srcPtr[blueOffset];
- *destPtr++ = alpha;
- break;
- }
- if (alpha) {
- int Alpha = destPtr[3];
- destPtr[0] = PD_SRC_OVER(srcPtr[0],alpha,destPtr[0],Alpha);
- destPtr[1] = PD_SRC_OVER(srcPtr[greenOffset],alpha,destPtr[1],Alpha);
- destPtr[2] = PD_SRC_OVER(srcPtr[blueOffset],alpha,destPtr[2],Alpha);
- destPtr[3] = PD_SRC_OVER_ALPHA(alpha,Alpha);
- }
+ if (compRule==TK_PHOTO_COMPOSITE_SET || !destPtr[3]) {
+ /*
+ * Either this is the SET rule (we overwrite
+ * whatever is there) or the destination is
+ * entirely blank. In both cases, we just set the
+ * destination to the source.
+ */
+
+ *destPtr++ = srcPtr[0];
+ *destPtr++ = srcPtr[greenOffset];
+ *destPtr++ = srcPtr[blueOffset];
+ *destPtr++ = alpha;
+ } else if (alpha) {
+ int Alpha = destPtr[3]; /* Destination
+ * alpha. */
+
+ destPtr[0] = PD_SRC_OVER(srcPtr[0], alpha,
+ destPtr[0], Alpha);
+ destPtr[1] = PD_SRC_OVER(srcPtr[greenOffset],alpha,
+ destPtr[1], Alpha);
+ destPtr[2] = PD_SRC_OVER(srcPtr[blueOffset], alpha,
+ destPtr[2], Alpha);
+ destPtr[3] = PD_SRC_OVER_ALPHA(alpha, Alpha);
+
+ destPtr += 4;
+ } else {
destPtr += 4;
- break;
- default:
- panic("unknown compositing rule: %d", compRule);
}
}
srcPtr += blockXSkip;
@@ -4856,13 +4876,12 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
*/
if (alphaOffset) {
- int x1, y1, end;
-
if (compRule != TK_PHOTO_COMPOSITE_OVERLAY) {
/*
* Don't need this when using the OVERLAY compositing rule, which
* always strictly increases the valid region.
*/
+
TkRegion workRgn = TkCreateRegion();
rect.x = x;
@@ -4875,34 +4894,10 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
TkDestroyRegion(workRgn);
}
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3;
- for (y1 = 0; y1 < height; y1++) {
- x1 = 0;
- destPtr = destLinePtr;
- while (x1 < width) {
- /* search for first non-transparent pixel */
- while ((x1 < width) && !*destPtr) {
- x1++;
- destPtr += 4;
- }
- end = x1;
- /* search for first transparent pixel */
- while ((end < width) && *destPtr) {
- end++;
- destPtr += 4;
- }
- if (end > x1) {
- rect.x = x + x1;
- rect.y = y + y1;
- rect.width = end - x1;
- rect.height = 1;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
- }
- x1 = end;
- }
- destLinePtr += masterPtr->width * 4;
- }
+ TkpBuildRegionFromAlphaData(masterPtr->validRegion,
+ (unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height,
+ &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4,
+ (unsigned) masterPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
@@ -4946,7 +4941,7 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
@@ -4954,6 +4949,7 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
masterPtr->height);
+ return TCL_OK;
}
/*
@@ -4961,27 +4957,27 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
*
* Tk_DitherPhoto --
*
- * This procedure is called to update an area of each instance's
- * pixmap by dithering the corresponding area of the image master.
+ * This function is called to update an area of each instance's pixmap by
+ * dithering the corresponding area of the image master.
*
* Results:
* None.
*
* Side effects:
- * The pixmap of each instance of this image gets updated.
- * The fields in *masterPtr indicating which area of the image
- * is correctly dithered get updated.
+ * The pixmap of each instance of this image gets updated. The fields in
+ * *masterPtr indicating which area of the image is correctly dithered
+ * get updated.
*
*----------------------------------------------------------------------
*/
void
-Tk_DitherPhoto(photo, x, y, width, height)
- Tk_PhotoHandle photo; /* Image master whose instances are
- * to be updated. */
- int x, y; /* Coordinates of the top-left pixel
- * in the area to be dithered. */
- int width, height; /* Dimensions of the area to be dithered. */
+Tk_DitherPhoto(
+ Tk_PhotoHandle photo, /* Image master whose instances are to be
+ * updated. */
+ int x, int y, /* Coordinates of the top-left pixel in the
+ * area to be dithered. */
+ int width, int height) /* Dimensions of the area to be dithered. */
{
PhotoMaster *masterPtr = (PhotoMaster *) photo;
PhotoInstance *instancePtr;
@@ -4996,14 +4992,13 @@ Tk_DitherPhoto(photo, x, y, width, height)
}
/*
- * Work out whether this block will be correctly dithered
- * and whether it will extend the correctly dithered region.
+ * Work out whether this block will be correctly dithered and whether it
+ * will extend the correctly dithered region.
*/
if (((y < masterPtr->ditherY)
|| ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX)))
&& ((y + height) > (masterPtr->ditherY))) {
-
/*
* This block starts inside (or immediately after) the correctly
* dithered region, so the first scan line at least will be right.
@@ -5012,8 +5007,8 @@ Tk_DitherPhoto(photo, x, y, width, height)
if ((x == 0) && (width == masterPtr->width)) {
/*
- * We are doing the full width, therefore the dithering
- * will be correct to the end.
+ * We are doing the full width, therefore the dithering will be
+ * correct to the end.
*/
masterPtr->ditherX = 0;
@@ -5021,8 +5016,8 @@ Tk_DitherPhoto(photo, x, y, width, height)
} else {
/*
* We are doing partial scanlines, therefore the
- * correctly-dithered region will be extended by
- * at most one scan line.
+ * correctly-dithered region will be extended by at most one scan
+ * line.
*/
if (x <= masterPtr->ditherX) {
@@ -5034,16 +5029,15 @@ Tk_DitherPhoto(photo, x, y, width, height)
}
}
}
-
-}
+}
/*
*----------------------------------------------------------------------
*
* DitherInstance --
*
- * This procedure is called to update an area of an instance's
- * pixmap by dithering the corresponding area of the master.
+ * This function is called to update an area of an instance's pixmap by
+ * dithering the corresponding area of the master.
*
* Results:
* None.
@@ -5055,33 +5049,24 @@ Tk_DitherPhoto(photo, x, y, width, height)
*/
static void
-DitherInstance(instancePtr, xStart, yStart, width, height)
- PhotoInstance *instancePtr; /* The instance to be updated. */
- int xStart, yStart; /* Coordinates of the top-left pixel in the
+DitherInstance(
+ PhotoInstance *instancePtr, /* The instance to be updated. */
+ int xStart, int yStart, /* Coordinates of the top-left pixel in the
* block to be dithered. */
- int width, height; /* Dimensions of the block to be dithered. */
+ int width, int height) /* Dimensions of the block to be dithered. */
{
- PhotoMaster *masterPtr;
- ColorTable *colorPtr;
+ PhotoMaster *masterPtr = instancePtr->masterPtr;
+ ColorTable *colorPtr = instancePtr->colorTablePtr;
XImage *imagePtr;
- int nLines, bigEndian;
- int i, c, x, y;
- int xEnd, yEnd;
+ int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1;
int bitsPerPixel, bytesPerLine, lineLength;
- unsigned char *srcLinePtr, *srcPtr;
- schar *errLinePtr, *errPtr;
- unsigned char *destBytePtr, *dstLinePtr;
- pixel *destLongPtr;
+ unsigned char *srcLinePtr;
+ schar *errLinePtr;
pixel firstBit, word, mask;
- int col[3];
- int doDithering = 1;
-
- colorPtr = instancePtr->colorTablePtr;
- masterPtr = instancePtr->masterPtr;
/*
- * Turn dithering off in certain cases where it is not
- * needed (TrueColor, DirectColor with many colors).
+ * Turn dithering off in certain cases where it is not needed (TrueColor,
+ * DirectColor with many colors).
*/
if ((colorPtr->visualInfo.class == DirectColor)
@@ -5097,9 +5082,8 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
}
/*
- * First work out how many lines to do at a time,
- * then how many bytes we'll need for pixel storage,
- * and allocate it.
+ * First work out how many lines to do at a time, then how many bytes
+ * we'll need for pixel storage, and allocate it.
*/
nLines = (MAX_PIXELS + width - 1) / width;
@@ -5112,14 +5096,15 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
imagePtr = instancePtr->imagePtr;
if (imagePtr == NULL) {
- return; /* we must be really tight on memory */
+ return; /* We must be really tight on memory. */
}
bitsPerPixel = imagePtr->bits_per_pixel;
bytesPerLine = ((bitsPerPixel * width + 31) >> 3) & ~3;
imagePtr->width = width;
imagePtr->height = nLines;
imagePtr->bytes_per_line = bytesPerLine;
- imagePtr->data = (char *) ckalloc((unsigned) (imagePtr->bytes_per_line * nLines));
+ imagePtr->data = (char *)
+ ckalloc((unsigned) (imagePtr->bytes_per_line * nLines));
bigEndian = imagePtr->bitmap_bit_order == MSBFirst;
firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1;
@@ -5129,46 +5114,50 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
xEnd = xStart + width;
/*
- * Loop over the image, doing at most nLines lines before
- * updating the screen image.
+ * Loop over the image, doing at most nLines lines before updating the
+ * screen image.
*/
for (; height > 0; height -= nLines) {
+ unsigned char *dstLinePtr = (unsigned char *) imagePtr->data;
+ int yEnd;
+
if (nLines > height) {
nLines = height;
}
- dstLinePtr = (unsigned char *) imagePtr->data;
yEnd = yStart + nLines;
for (y = yStart; y < yEnd; ++y) {
- srcPtr = srcLinePtr;
- errPtr = errLinePtr;
- destBytePtr = dstLinePtr;
- destLongPtr = (pixel *) dstLinePtr;
+ unsigned char *srcPtr = srcLinePtr;
+ schar *errPtr = errLinePtr;
+ unsigned char *destBytePtr = dstLinePtr;
+ pixel *destLongPtr = (pixel *) dstLinePtr;
+
if (colorPtr->flags & COLOR_WINDOW) {
/*
- * Color window. We dither the three components
- * independently, using Floyd-Steinberg dithering,
- * which propagates errors from the quantization of
- * pixels to the pixels below and to the right.
+ * Color window. We dither the three components independently,
+ * using Floyd-Steinberg dithering, which propagates errors
+ * from the quantization of pixels to the pixels below and to
+ * the right.
*/
for (x = xStart; x < xEnd; ++x) {
+ int col[3];
+
if (doDithering) {
for (i = 0; i < 3; ++i) {
/*
* Compute the error propagated into this pixel
- * for this component.
- * If e[x,y] is the array of quantization error
- * values, we compute
+ * for this component. If e[x,y] is the array of
+ * quantization error values, we compute
* 7/16 * e[x-1,y] + 1/16 * e[x-1,y-1]
* + 5/16 * e[x,y-1] + 3/16 * e[x+1,y-1]
* and round it to an integer.
*
- * The expression ((c + 2056) >> 4) - 128
- * computes round(c / 16), and works correctly on
- * machines without a sign-extending right shift.
+ * The expression ((c + 2056) >> 4) - 128 computes
+ * round(c / 16), and works correctly on machines
+ * without a sign-extending right shift.
*/
-
+
c = (x > 0) ? errPtr[-3] * 7: 0;
if (y > 0) {
if (x > 0) {
@@ -5179,13 +5168,13 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
c += errPtr[-lineLength+3] * 3;
}
}
-
+
/*
* Add the propagated error to the value of this
* component, quantize it, and store the
* quantization error.
*/
-
+
c = ((c + 2056) >> 4) - 128 + *srcPtr++;
if (c < 0) {
c = 0;
@@ -5196,9 +5185,9 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
*errPtr++ = c - col[i];
}
} else {
- /*
- * Output is virtually continuous in this case,
- * so don't bother dithering.
+ /*
+ * Output is virtually continuous in this case, so
+ * don't bother dithering.
*/
col[0] = *srcPtr++;
@@ -5208,8 +5197,8 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
srcPtr++;
/*
- * Translate the quantized component values into
- * an X pixel value, and store it in the image.
+ * Translate the quantized component values into an X
+ * pixel value, and store it in the image.
*/
i = colorPtr->redValues[col[0]]
@@ -5219,32 +5208,34 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
i = colorPtr->pixelMap[i];
}
switch (bitsPerPixel) {
- case NBBY:
- *destBytePtr++ = i;
- break;
+ case NBBY:
+ *destBytePtr++ = i;
+ break;
#ifndef __WIN32__
-/*
- * This case is not valid for Windows because the image format is different
- * from the pixel format in Win32. Eventually we need to fix the image
- * code in Tk to use the Windows native image ordering. This would speed
- * up the image code for all of the common sizes.
- */
+ /*
+ * This case is not valid for Windows because the
+ * image format is different from the pixel format in
+ * Win32. Eventually we need to fix the image code in
+ * Tk to use the Windows native image ordering. This
+ * would speed up the image code for all of the common
+ * sizes.
+ */
- case NBBY * sizeof(pixel):
- *destLongPtr++ = i;
- break;
+ case NBBY * sizeof(pixel):
+ *destLongPtr++ = i;
+ break;
#endif
- default:
- XPutPixel(imagePtr, x - xStart, y - yStart,
- (unsigned) i);
+ default:
+ XPutPixel(imagePtr, x - xStart, y - yStart,
+ (unsigned) i);
}
}
} else if (bitsPerPixel > 1) {
/*
- * Multibit monochrome window. The operation here is similar
+ * Multibit monochrome window. The operation here is similar
* to the color window case above, except that there is only
- * one component. If the master image is in color, use the
+ * one component. If the master image is in color, use the
* luminance computed as
* 0.344 * red + 0.5 * green + 0.156 * blue.
*/
@@ -5266,7 +5257,7 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
c += srcPtr[0];
} else {
c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16
- + srcPtr[2] * 5 + 16) >> 5;
+ + srcPtr[2] * 5 + 16) >> 5;
}
srcPtr += 4;
@@ -5279,40 +5270,42 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
*errPtr++ = c - i;
i = colorPtr->redValues[i];
switch (bitsPerPixel) {
- case NBBY:
- *destBytePtr++ = i;
- break;
+ case NBBY:
+ *destBytePtr++ = i;
+ break;
#ifndef __WIN32__
-/*
- * This case is not valid for Windows because the image format is different
- * from the pixel format in Win32. Eventually we need to fix the image
- * code in Tk to use the Windows native image ordering. This would speed
- * up the image code for all of the common sizes.
- */
+ /*
+ * This case is not valid for Windows because the
+ * image format is different from the pixel format in
+ * Win32. Eventually we need to fix the image code in
+ * Tk to use the Windows native image ordering. This
+ * would speed up the image code for all of the common
+ * sizes.
+ */
- case NBBY * sizeof(pixel):
- *destLongPtr++ = i;
- break;
+ case NBBY * sizeof(pixel):
+ *destLongPtr++ = i;
+ break;
#endif
- default:
- XPutPixel(imagePtr, x - xStart, y - yStart,
- (unsigned) i);
+ default:
+ XPutPixel(imagePtr, x - xStart, y - yStart,
+ (unsigned) i);
}
}
} else {
/*
- * 1-bit monochrome window. This is similar to the
- * multibit monochrome case above, except that the
- * quantization is simpler (we only have black = 0
- * and white = 255), and we produce an XY-Bitmap.
+ * 1-bit monochrome window. This is similar to the multibit
+ * monochrome case above, except that the quantization is
+ * simpler (we only have black = 0 and white = 255), and we
+ * produce an XY-Bitmap.
*/
word = 0;
mask = firstBit;
for (x = xStart; x < xEnd; ++x) {
/*
- * If we have accumulated a whole word, store it
- * in the image and start a new word.
+ * If we have accumulated a whole word, store it in the
+ * image and start a new word.
*/
if (mask == 0) {
@@ -5337,7 +5330,7 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
c += srcPtr[0];
} else {
c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16
- + srcPtr[2] * 5 + 16) >> 5;
+ + srcPtr[2] * 5 + 16) >> 5;
}
srcPtr += 4;
@@ -5362,8 +5355,8 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
}
/*
- * Update the pixmap for this instance with the block of
- * pixels that we have just computed.
+ * Update the pixmap for this instance with the block of pixels that
+ * we have just computed.
*/
TkPutImage(colorPtr->pixelMap, colorPtr->numColors,
@@ -5371,7 +5364,6 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
instancePtr->gc, imagePtr, 0, 0, xStart, yStart,
(unsigned) width, (unsigned) nLines);
yStart = yEnd;
-
}
ckfree(imagePtr->data);
@@ -5383,26 +5375,25 @@ DitherInstance(instancePtr, xStart, yStart, width, height)
*
* Tk_PhotoBlank --
*
- * This procedure is called to clear an entire photo image.
+ * This function is called to clear an entire photo image.
*
* Results:
* None.
*
* Side effects:
- * The valid region for the image is set to the null region.
- * The generic image code is notified that the image has changed.
+ * The valid region for the image is set to the null region. The generic
+ * image code is notified that the image has changed.
*
*----------------------------------------------------------------------
*/
void
-Tk_PhotoBlank(handle)
- Tk_PhotoHandle handle; /* Handle for the image to be blanked. */
+Tk_PhotoBlank(
+ Tk_PhotoHandle handle) /* Handle for the image to be blanked. */
{
- PhotoMaster *masterPtr;
+ PhotoMaster *masterPtr = (PhotoMaster *) handle;
PhotoInstance *instancePtr;
- masterPtr = (PhotoMaster *) handle;
masterPtr->ditherX = masterPtr->ditherY = 0;
masterPtr->flags = 0;
@@ -5416,16 +5407,16 @@ Tk_PhotoBlank(handle)
masterPtr->validRegion = TkCreateRegion();
/*
- * Clear out the 32-bit pixel storage array.
- * Clear out the dithering error arrays for each instance.
+ * Clear out the 32-bit pixel storage array. Clear out the dithering error
+ * arrays for each instance.
*/
- memset((VOID *) masterPtr->pix32, 0,
+ memset(masterPtr->pix32, 0,
(size_t) (masterPtr->width * masterPtr->height * 4));
for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
if (instancePtr->error) {
- memset((VOID *) instancePtr->error, 0,
+ memset(instancePtr->error, 0,
(size_t) (masterPtr->width * masterPtr->height
* 3 * sizeof(schar)));
}
@@ -5444,30 +5435,29 @@ Tk_PhotoBlank(handle)
*
* Tk_PhotoExpand --
*
- * This procedure is called to request that a photo image be
- * expanded if necessary to be at least `width' pixels wide and
- * `height' pixels high. If the user has declared a definite
- * image size (using the -width and -height configuration
- * options) then this call has no effect.
+ * This function is called to request that a photo image be expanded if
+ * necessary to be at least `width' pixels wide and `height' pixels high.
+ * If the user has declared a definite image size (using the -width and
+ * -height configuration options) then this call has no effect.
*
* Results:
* None.
*
* Side effects:
- * The size of the photo image may change; if so the generic
- * image code is informed.
+ * The size of the photo image may change; if so the generic image code
+ * is informed.
*
*----------------------------------------------------------------------
*/
-void
-Tk_PhotoExpand(handle, width, height)
- Tk_PhotoHandle handle; /* Handle for the image to be expanded. */
- int width, height; /* Desired minimum dimensions of the image. */
+int
+Tk_PhotoExpand(
+ Tcl_Interp *interp, /* Interpreter for passing back error
+ * messages, or NULL. */
+ Tk_PhotoHandle handle, /* Handle for the image to be expanded. */
+ int width, int height) /* Desired minimum dimensions of the image. */
{
- PhotoMaster *masterPtr;
-
- masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *masterPtr = (PhotoMaster *) handle;
if (width <= masterPtr->width) {
width = masterPtr->width;
@@ -5478,11 +5468,16 @@ Tk_PhotoExpand(handle, width, height)
if ((width != masterPtr->width) || (height != masterPtr->height)) {
if (ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width),
MAX(height, masterPtr->height)) == TCL_ERROR) {
- panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ if (interp != NULL) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
+ }
+ return TCL_ERROR;
}
Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
masterPtr->height);
}
+ return TCL_OK;
}
/*
@@ -5490,12 +5485,10 @@ Tk_PhotoExpand(handle, width, height)
*
* Tk_PhotoGetSize --
*
- * This procedure is called to obtain the current size of a photo
- * image.
+ * This function is called to obtain the current size of a photo image.
*
* Results:
- * The image's width and height are returned in *widthp
- * and *heightp.
+ * The image's width and height are returned in *widthp and *heightp.
*
* Side effects:
* None.
@@ -5504,15 +5497,15 @@ Tk_PhotoExpand(handle, width, height)
*/
void
-Tk_PhotoGetSize(handle, widthPtr, heightPtr)
- Tk_PhotoHandle handle; /* Handle for the image whose dimensions
- * are requested. */
- int *widthPtr, *heightPtr; /* The dimensions of the image are returned
+Tk_PhotoGetSize(
+ Tk_PhotoHandle handle, /* Handle for the image whose dimensions are
+ * requested. */
+ int *widthPtr, int *heightPtr)
+ /* The dimensions of the image are returned
* here. */
{
- PhotoMaster *masterPtr;
+ PhotoMaster *masterPtr = (PhotoMaster *) handle;
- masterPtr = (PhotoMaster *) handle;
*widthPtr = masterPtr->width;
*heightPtr = masterPtr->height;
}
@@ -5522,38 +5515,42 @@ Tk_PhotoGetSize(handle, widthPtr, heightPtr)
*
* Tk_PhotoSetSize --
*
- * This procedure is called to set size of a photo image.
- * This call is equivalent to using the -width and -height
- * configuration options.
+ * This function is called to set size of a photo image. This call is
+ * equivalent to using the -width and -height configuration options.
*
* Results:
* None.
*
* Side effects:
- * The size of the image may change; if so the generic
- * image code is informed.
+ * The size of the image may change; if so the generic image code is
+ * informed.
*
*----------------------------------------------------------------------
*/
-void
-Tk_PhotoSetSize(handle, width, height)
- Tk_PhotoHandle handle; /* Handle for the image whose size is to
- * be set. */
- int width, height; /* New dimensions for the image. */
+int
+Tk_PhotoSetSize(
+ Tcl_Interp *interp, /* Interpreter for passing back error
+ * messages, or NULL. */
+ Tk_PhotoHandle handle, /* Handle for the image whose size is to be
+ * set. */
+ int width, int height) /* New dimensions for the image. */
{
- PhotoMaster *masterPtr;
-
- masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *masterPtr = (PhotoMaster *) handle;
masterPtr->userWidth = width;
masterPtr->userHeight = height;
if (ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width),
((height > 0) ? height: masterPtr->height)) == TCL_ERROR) {
- panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ if (interp != NULL) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, TK_PHOTO_ALLOC_FAILURE_MESSAGE, NULL);
+ }
+ return TCL_ERROR;
}
Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
masterPtr->width, masterPtr->height);
+ return TCL_OK;
}
/*
@@ -5561,14 +5558,14 @@ Tk_PhotoSetSize(handle, width, height)
*
* TkGetPhotoValidRegion --
*
- * This procedure is called to get the part of the photo where
- * there is valid data. Or, conversely, the part of the photo
- * which is transparent.
+ * This function is called to get the part of the photo where there is
+ * valid data. Or, conversely, the part of the photo which is
+ * transparent.
*
* Results:
- * A TkRegion value that indicates the current area of the photo
- * that is valid. This value should not be used after any
- * modification to the photo image.
+ * A TkRegion value that indicates the current area of the photo that is
+ * valid. This value should not be used after any modification to the
+ * photo image.
*
* Side Effects:
* None.
@@ -5577,13 +5574,12 @@ Tk_PhotoSetSize(handle, width, height)
*/
TkRegion
-TkPhotoGetValidRegion(handle)
- Tk_PhotoHandle handle; /* Handle for the image whose valid region
- * is to obtained. */
+TkPhotoGetValidRegion(
+ Tk_PhotoHandle handle) /* Handle for the image whose valid region is
+ * to obtained. */
{
- PhotoMaster *masterPtr;
+ PhotoMaster *masterPtr = (PhotoMaster *) handle;
- masterPtr = (PhotoMaster *) handle;
return masterPtr->validRegion;
}
@@ -5592,15 +5588,15 @@ TkPhotoGetValidRegion(handle)
*
* ImgGetPhoto --
*
- * This procedure is called to obtain image data from a photo
- * image. This procedure fills in the Tk_PhotoImageBlock structure
- * pointed to by `blockPtr' with details of the address and
- * layout of the image data in memory.
+ * This function is called to obtain image data from a photo image. This
+ * function fills in the Tk_PhotoImageBlock structure pointed to by
+ * `blockPtr' with details of the address and layout of the image data in
+ * memory.
*
* Results:
- * A pointer to the allocated data which should be freed later.
- * NULL if there is no need to free data because
- * blockPtr->pixelPtr points directly to the image data.
+ * A pointer to the allocated data which should be freed later. NULL if
+ * there is no need to free data because blockPtr->pixelPtr points
+ * directly to the image data.
*
* Side effects:
* None.
@@ -5609,13 +5605,13 @@ TkPhotoGetValidRegion(handle)
*/
static char *
-ImgGetPhoto(masterPtr, blockPtr, optPtr)
- PhotoMaster *masterPtr; /* Handle for the photo image from which
- * image data is desired. */
- Tk_PhotoImageBlock *blockPtr;
- /* Information about the address and layout
- * of the image data is returned here. */
- struct SubcommandOptions *optPtr;
+ImgGetPhoto(
+ PhotoMaster *masterPtr, /* Handle for the photo image from which image
+ * data is desired. */
+ Tk_PhotoImageBlock *blockPtr,
+ /* Information about the address and layout of
+ * the image data is returned here. */
+ struct SubcommandOptions *optPtr)
{
unsigned char *pixelPtr;
int x, y, greenOffset, blueOffset, alphaOffset;
@@ -5630,8 +5626,7 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
(!(optPtr->options & OPT_BACKGROUND)
|| ((optPtr->background->red == optPtr->background->green)
&& (optPtr->background->red == optPtr->background->blue)))) {
- blockPtr->offset[0] = blockPtr->offset[1] =
- blockPtr->offset[2];
+ blockPtr->offset[0] = blockPtr->offset[1] = blockPtr->offset[2];
}
alphaOffset = 0;
for (y = 0; y < blockPtr->height; y++) {
@@ -5657,13 +5652,14 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
greenOffset = blockPtr->offset[1] - blockPtr->offset[0];
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) ||
- ((optPtr->options & OPT_GRAYSCALE) && (greenOffset || blueOffset))) {
+ ((optPtr->options & OPT_GRAYSCALE) && (greenOffset||blueOffset))) {
int newPixelSize,x,y;
unsigned char *srcPtr, *destPtr;
char *data;
- newPixelSize = (!(optPtr->options & OPT_BACKGROUND) && alphaOffset) ? 2 : 1;
- if ((greenOffset || blueOffset) && !(optPtr->options & OPT_GRAYSCALE)) {
+ newPixelSize = (!(optPtr->options & OPT_BACKGROUND) && alphaOffset)
+ ? 2 : 1;
+ if ((greenOffset||blueOffset) && !(optPtr->options & OPT_GRAYSCALE)) {
newPixelSize += 2;
}
data = ckalloc((unsigned int) (newPixelSize *
@@ -5677,17 +5673,19 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
srcPtr += blockPtr->pixelSize;
destPtr += newPixelSize;
}
- srcPtr += blockPtr->pitch - (blockPtr->width * blockPtr->pixelSize);
+ srcPtr += blockPtr->pitch -
+ blockPtr->width * blockPtr->pixelSize;
}
} else if (optPtr->options & OPT_GRAYSCALE) {
for (y = blockPtr->height; y > 0; y--) {
for (x = blockPtr->width; x > 0; x--) {
- *destPtr = (unsigned char) ((srcPtr[0] * 11 + srcPtr[1] * 16
- + srcPtr[2] * 5 + 16) >> 5);
+ *destPtr = (unsigned char) ((srcPtr[0]*11 + srcPtr[1]*16
+ + srcPtr[2]*5 + 16) >> 5);
srcPtr += blockPtr->pixelSize;
destPtr += newPixelSize;
}
- srcPtr += blockPtr->pitch - (blockPtr->width * blockPtr->pixelSize);
+ srcPtr += blockPtr->pitch -
+ blockPtr->width * blockPtr->pixelSize;
}
} else {
for (y = blockPtr->height; y > 0; y--) {
@@ -5698,18 +5696,22 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
srcPtr += blockPtr->pixelSize;
destPtr += newPixelSize;
}
- srcPtr += blockPtr->pitch - (blockPtr->width * blockPtr->pixelSize);
+ srcPtr += blockPtr->pitch -
+ blockPtr->width * blockPtr->pixelSize;
}
}
srcPtr = blockPtr->pixelPtr + alphaOffset;
destPtr = (unsigned char *) data;
if (!alphaOffset) {
- /* nothing to be done */
+ /*
+ * Nothing to be done.
+ */
} else if (optPtr->options & OPT_BACKGROUND) {
if (newPixelSize > 2) {
- int red = optPtr->background->red>>8;
- int green = optPtr->background->green>>8;
- int blue = optPtr->background->blue>>8;
+ int red = optPtr->background->red>>8;
+ int green = optPtr->background->green>>8;
+ int blue = optPtr->background->blue>>8;
+
for (y = blockPtr->height; y > 0; y--) {
for (x = blockPtr->width; x > 0; x--) {
destPtr[0] += (unsigned char) (((255 - *srcPtr) *
@@ -5721,12 +5723,14 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
srcPtr += blockPtr->pixelSize;
destPtr += newPixelSize;
}
- srcPtr += blockPtr->pitch - (blockPtr->width * blockPtr->pixelSize);
+ srcPtr += blockPtr->pitch -
+ blockPtr->width * blockPtr->pixelSize;
}
} else {
int gray = (unsigned char) (((optPtr->background->red>>8) * 11
- + (optPtr->background->green>>8) * 16
- + (optPtr->background->blue>>8) * 5 + 16) >> 5);
+ + (optPtr->background->green>>8) * 16
+ + (optPtr->background->blue>>8) * 5 + 16) >> 5);
+
for (y = blockPtr->height; y > 0; y--) {
for (x = blockPtr->width; x > 0; x--) {
destPtr[0] += ((255 - *srcPtr) *
@@ -5734,7 +5738,8 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
srcPtr += blockPtr->pixelSize;
destPtr += newPixelSize;
}
- srcPtr += blockPtr->pitch - (blockPtr->width * blockPtr->pixelSize);
+ srcPtr += blockPtr->pitch -
+ blockPtr->width * blockPtr->pixelSize;
}
}
} else {
@@ -5745,7 +5750,8 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
srcPtr += blockPtr->pixelSize;
destPtr += newPixelSize;
}
- srcPtr += blockPtr->pitch - (blockPtr->width * blockPtr->pixelSize);
+ srcPtr += blockPtr->pitch -
+ blockPtr->width * blockPtr->pixelSize;
}
}
blockPtr->pixelPtr = (unsigned char *) data;
@@ -5769,8 +5775,8 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
*
* ImgStringWrite --
*
- * Default string write function. The data is formatted in
- * the default format as accepted by the "<img> put" command.
+ * Default string write function. The data is formatted in the default
+ * format as accepted by the "<img> put" command.
*
* Results:
* A standard Tcl result.
@@ -5782,12 +5788,12 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
*/
static int
-ImgStringWrite(interp, formatString, blockPtr)
- Tcl_Interp *interp;
- Tcl_Obj *formatString;
- Tk_PhotoImageBlock *blockPtr;
+ImgStringWrite(
+ Tcl_Interp *interp,
+ Tcl_Obj *formatString,
+ Tk_PhotoImageBlock *blockPtr)
{
- int row,col;
+ int row, col;
char *line, *linePtr;
unsigned char *pixelPtr;
int greenOffset, blueOffset;
@@ -5822,14 +5828,14 @@ ImgStringWrite(interp, formatString, blockPtr)
*
* Tk_PhotoGetImage --
*
- * This procedure is called to obtain image data from a photo
- * image. This procedure fills in the Tk_PhotoImageBlock structure
- * pointed to by `blockPtr' with details of the address and
- * layout of the image data in memory.
+ * This function is called to obtain image data from a photo image. This
+ * function fills in the Tk_PhotoImageBlock structure pointed to by
+ * `blockPtr' with details of the address and layout of the image data in
+ * memory.
*
* Results:
- * TRUE (1) indicating that image data is available,
- * for backwards compatibility with the old photo widget.
+ * TRUE (1) indicating that image data is available, for backwards
+ * compatibility with the old photo widget.
*
* Side effects:
* None.
@@ -5838,16 +5844,15 @@ ImgStringWrite(interp, formatString, blockPtr)
*/
int
-Tk_PhotoGetImage(handle, blockPtr)
- Tk_PhotoHandle handle; /* Handle for the photo image from which
- * image data is desired. */
- Tk_PhotoImageBlock *blockPtr;
- /* Information about the address and layout
- * of the image data is returned here. */
+Tk_PhotoGetImage(
+ Tk_PhotoHandle handle, /* Handle for the photo image from which image
+ * data is desired. */
+ Tk_PhotoImageBlock *blockPtr)
+ /* Information about the address and layout of
+ * the image data is returned here. */
{
- PhotoMaster *masterPtr;
+ PhotoMaster *masterPtr = (PhotoMaster *) handle;
- masterPtr = (PhotoMaster *) handle;
blockPtr->pixelPtr = masterPtr->pix32;
blockPtr->width = masterPtr->width;
blockPtr->height = masterPtr->height;
@@ -5859,7 +5864,7 @@ Tk_PhotoGetImage(handle, blockPtr)
blockPtr->offset[3] = 3;
return 1;
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -5877,57 +5882,56 @@ Tk_PhotoGetImage(handle, blockPtr)
*/
typedef struct OptionAssocData {
- struct OptionAssocData *nextPtr; /* pointer to next OptionAssocData */
- Tcl_ObjCmdProc *command; /* command associated with this
- * option */
- char name[1]; /* name of option (remaining chars) */
+ struct OptionAssocData *nextPtr;
+ /* Pointer to next OptionAssocData. */
+ Tcl_ObjCmdProc *command; /* Command associated with this option. */
+ char name[1]; /* Name of option (remaining chars) */
} OptionAssocData;
static Tcl_ObjCmdProc *
-PhotoOptionFind(interp, obj)
- Tcl_Interp *interp; /* Interpreter that is being deleted. */
- Tcl_Obj *obj; /* Name of option to be found. */
+PhotoOptionFind(
+ Tcl_Interp *interp, /* Interpreter that is being deleted. */
+ Tcl_Obj *obj) /* Name of option to be found. */
{
int length;
char *name = Tcl_GetStringFromObj(obj, &length);
- OptionAssocData *list;
char *prevname = NULL;
- Tcl_ObjCmdProc *proc = (Tcl_ObjCmdProc *) NULL;
+ Tcl_ObjCmdProc *proc = NULL;
+ OptionAssocData *list = (OptionAssocData *) Tcl_GetAssocData(interp,
+ "photoOption", NULL);
- list = (OptionAssocData *) Tcl_GetAssocData(interp, "photoOption",
- (Tcl_InterpDeleteProc **) NULL);
- while (list != (OptionAssocData *) NULL) {
+ while (list != NULL) {
if (strncmp(name, list->name, (unsigned) length) == 0) {
- if (proc != (Tcl_ObjCmdProc *) NULL) {
+ if (proc != NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "ambiguous option \"", name,
- "\": must be ", prevname, (char *) NULL);
- while (list->nextPtr != (OptionAssocData *) NULL) {
- Tcl_AppendResult(interp, prevname, ", ",(char *) NULL);
+ "\": must be ", prevname, NULL);
+ while (list->nextPtr != NULL) {
+ Tcl_AppendResult(interp, prevname, ", ",NULL);
list = list->nextPtr;
prevname = list->name;
}
- Tcl_AppendResult(interp, ", or", prevname, (char *) NULL);
- return (Tcl_ObjCmdProc *) NULL;
+ Tcl_AppendResult(interp, ", or", prevname, NULL);
+ return NULL;
}
proc = list->command;
prevname = list->name;
}
list = list->nextPtr;
}
- if (proc != (Tcl_ObjCmdProc *) NULL) {
+ if (proc != NULL) {
Tcl_ResetResult(interp);
}
return proc;
}
-
+
/*
*----------------------------------------------------------------------
*
* PhotoOptionCleanupProc --
*
- * This procedure is invoked whenever an interpreter is deleted
- * to cleanup the AssocData for "photoVisitor".
+ * This function is invoked whenever an interpreter is deleted to cleanup
+ * the AssocData for "photoVisitor".
*
* Results:
* None.
@@ -5939,49 +5943,47 @@ PhotoOptionFind(interp, obj)
*/
static void
-PhotoOptionCleanupProc(clientData, interp)
- ClientData clientData; /* Points to "photoVisitor" AssocData
- * for the interpreter. */
- Tcl_Interp *interp; /* Interpreter that is being deleted. */
+PhotoOptionCleanupProc(
+ ClientData clientData, /* Points to "photoVisitor" AssocData for the
+ * interpreter. */
+ Tcl_Interp *interp) /* Interpreter that is being deleted. */
{
OptionAssocData *list = (OptionAssocData *) clientData;
- OptionAssocData *ptr;
while (list != NULL) {
+ register OptionAssocData *ptr;
+
list = (ptr = list)->nextPtr;
ckfree((char *) ptr);
}
}
-
+
/*
*--------------------------------------------------------------
*
* Tk_CreatePhotoOption --
*
- * This procedure may be invoked to add a new kind of photo
- * option to the core photo command supported by Tk.
+ * This function may be invoked to add a new kind of photo option to the
+ * core photo command supported by Tk.
*
* Results:
* None.
*
* Side effects:
- * From now on, the new option will be useable by the
- * photo command.
+ * From now on, the new option will be useable by the photo command.
*
*--------------------------------------------------------------
*/
-void
-Tk_CreatePhotoOption(interp, name, proc)
- Tcl_Interp *interp; /* interpreter */
- CONST char *name; /* option name */
- Tcl_ObjCmdProc *proc; /* proc to execute command */
+MODULE_SCOPE void
+Tk_CreatePhotoOption(
+ Tcl_Interp *interp, /* Interpreter. */
+ CONST char *name, /* Option name. */
+ Tcl_ObjCmdProc *proc) /* Function to execute command. */
{
OptionAssocData *typePtr2, *prevPtr, *ptr;
- OptionAssocData *list;
-
- list = (OptionAssocData *) Tcl_GetAssocData(interp, "photoOption",
- (Tcl_InterpDeleteProc **) NULL);
+ OptionAssocData *list = (OptionAssocData *)
+ Tcl_GetAssocData(interp, "photoOption", NULL);
/*
* If there's already a photo option with the given name, remove it.
@@ -6004,7 +6006,7 @@ Tk_CreatePhotoOption(interp, name, proc)
ptr->command = proc;
ptr->nextPtr = list;
Tcl_SetAssocData(interp, "photoOption", PhotoOptionCleanupProc,
- (ClientData) ptr);
+ (ClientData) ptr);
}
/*
@@ -6012,9 +6014,8 @@ Tk_CreatePhotoOption(interp, name, proc)
*
* TkPostscriptPhoto --
*
- * This procedure is called to output the contents of a
- * photo image in Postscript by calling the Tk_PostscriptPhoto
- * function.
+ * This function is called to output the contents of a photo image in
+ * Postscript by calling the Tk_PostscriptPhoto function.
*
* Results:
* Returns a standard Tcl return value.
@@ -6024,16 +6025,16 @@ Tk_CreatePhotoOption(interp, name, proc)
*
*--------------------------------------------------------------
*/
+
static int
-ImgPhotoPostscript(clientData, interp, tkwin, psInfo,
- x, y, width, height, prepass)
- ClientData clientData; /* Handle for the photo image */
- Tcl_Interp *interp; /* Interpreter */
- Tk_Window tkwin; /* (unused) */
- Tk_PostscriptInfo psInfo; /* postscript info */
- int x, y; /* First pixel to output */
- int width, height; /* Width and height of area */
- int prepass; /* (unused) */
+ImgPhotoPostscript(
+ ClientData clientData, /* Handle for the photo image. */
+ Tcl_Interp *interp, /* Interpreter. */
+ Tk_Window tkwin, /* (unused) */
+ Tk_PostscriptInfo psInfo, /* Postscript info. */
+ int x, int y, /* First pixel to output. */
+ int width, int height, /* Width and height of area. */
+ int prepass) /* (unused) */
{
Tk_PhotoImageBlock block;
@@ -6048,29 +6049,105 @@ ImgPhotoPostscript(clientData, interp, tkwin, psInfo,
*
* Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite --
*
- * These backward-compatability functions just exist to fill slots in
- * stubs table. For the behaviour of *_NoComposite, refer to the
- * corresponding function without the extra suffix.
+ * These backward-compatability functions just exist to fill slots in stubs
+ * table. For the behaviour of *_NoComposite, refer to the corresponding
+ * function without the extra suffix, except that the compositing rule is
+ * always "overlay" and the function always panics on memory-allocation
+ * failure.
*
*----------------------------------------------------------------------
*/
+
void
-Tk_PhotoPutBlock_NoComposite(handle, blockPtr, x, y, width, height)
- Tk_PhotoHandle handle;
- Tk_PhotoImageBlock *blockPtr;
- int x, y, width, height;
+Tk_PhotoPutBlock_NoComposite(
+ Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr,
+ int x, int y, int width, int height)
{
- Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height,
- TK_PHOTO_COMPOSITE_OVERLAY);
+ if (Tk_PhotoPutBlock(NULL, handle, blockPtr, x, y, width, height,
+ TK_PHOTO_COMPOSITE_OVERLAY) != TCL_OK) {
+ Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ }
}
void
-Tk_PhotoPutZoomedBlock_NoComposite(handle, blockPtr, x, y, width, height,
- zoomX, zoomY, subsampleX, subsampleY)
- Tk_PhotoHandle handle;
- Tk_PhotoImageBlock *blockPtr;
- int x, y, width, height, zoomX, zoomY, subsampleX, subsampleY;
+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)
{
- Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height,
- zoomX, zoomY, subsampleX, subsampleY, TK_PHOTO_COMPOSITE_OVERLAY);
+ if (Tk_PhotoPutZoomedBlock(NULL, handle, blockPtr, x, y, width, height,
+ zoomX, zoomY, subsampleX, subsampleY,
+ TK_PHOTO_COMPOSITE_OVERLAY) != TCL_OK) {
+ Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ }
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic,
+ * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic
+ *
+ * Backward compatability functions for preserving the old behaviour (i.e.
+ * panic on memory allocation failure) so that extensions do not need to be
+ * significantly updated to take account of TIP #116. These call the new
+ * interface (i.e. the interface without the extra suffix), but panic if an
+ * error condition is returned.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_PhotoExpand_Panic(
+ Tk_PhotoHandle handle,
+ int width, int height)
+{
+ if (Tk_PhotoExpand(NULL, handle, width, height) != TCL_OK) {
+ Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ }
+}
+
+void
+Tk_PhotoPutBlock_Panic(
+ Tk_PhotoHandle handle,
+ Tk_PhotoImageBlock *blockPtr,
+ int x, int y, int width, int height, int compRule)
+{
+ if (Tk_PhotoPutBlock(NULL, handle, blockPtr, x, y, width, height,
+ compRule) != TCL_OK) {
+ Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ }
+}
+
+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)
+{
+ if (Tk_PhotoPutZoomedBlock(NULL, handle, blockPtr, x, y, width, height,
+ zoomX, zoomY, subsampleX, subsampleY, compRule) != TCL_OK) {
+ Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ }
+}
+
+void
+Tk_PhotoSetSize_Panic(
+ Tk_PhotoHandle handle,
+ int width, int height)
+{
+ if (Tk_PhotoSetSize(NULL, handle, width, height) != TCL_OK) {
+ Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkImgUtil.c b/generic/tkImgUtil.c
index 0bb599a..8ba6c0e 100644
--- a/generic/tkImgUtil.c
+++ b/generic/tkImgUtil.c
@@ -1,16 +1,15 @@
-/*
+/*
* tkImgUtil.c --
*
* This file contains image related utility functions.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
#include "xbytes.h"
@@ -19,12 +18,11 @@
*
* TkAlignImageData --
*
- * This function takes an image and copies the data into an
- * aligned buffer, performing any necessary bit swapping.
+ * This function takes an image and copies the data into an aligned
+ * buffer, performing any necessary bit swapping.
*
* Results:
- * Returns a newly allocated buffer that should be freed by the
- * caller.
+ * Returns a newly allocated buffer that should be freed by the caller.
*
* Side effects:
* None.
@@ -33,18 +31,19 @@
*/
char *
-TkAlignImageData(image, alignment, bitOrder)
- XImage *image; /* Image to be aligned. */
- int alignment; /* Number of bytes to which the data should
- * be aligned (e.g. 2 or 4) */
- int bitOrder; /* Desired bit order: LSBFirst or MSBFirst. */
+TkAlignImageData(
+ XImage *image, /* Image to be aligned. */
+ int alignment, /* Number of bytes to which the data should be
+ * aligned (e.g. 2 or 4) */
+ int bitOrder) /* Desired bit order: LSBFirst or MSBFirst. */
{
long dataWidth;
char *data, *srcPtr, *destPtr;
int i, j;
if (image->bits_per_pixel != 1) {
- panic("TkAlignImageData: Can't handle image depths greater than 1.");
+ Tcl_Panic(
+ "TkAlignImageData: Can't handle image depths greater than 1.");
}
/*
@@ -56,7 +55,7 @@ TkAlignImageData(image, alignment, bitOrder)
dataWidth += (alignment - (dataWidth % alignment));
}
- data = ckalloc(dataWidth * image->height);
+ data = ckalloc((unsigned) dataWidth * image->height);
destPtr = data;
for (i = 0; i < image->height; i++) {
@@ -74,3 +73,11 @@ TkAlignImageData(image, alignment, bitOrder)
}
return data;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkInitScript.h b/generic/tkInitScript.h
deleted file mode 100644
index 4997fe7..0000000
--- a/generic/tkInitScript.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * tkInitScript.h --
- *
- * This file contains Unix & Windows common init script
- * It is not used on the Mac. (the mac init script is in tkMacInit.c)
- *
- * Copyright (c) 1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-
-
-/*
- * In order to find tk.tcl during initialization, the following script
- * is invoked by Tk_Init(). It looks in several different directories:
- *
- * $tk_library - can specify a primary location, if set
- * no other locations will be checked
- *
- * $env(TK_LIBRARY) - highest priority so user can always override
- * the search path unless the application has
- * specified an exact directory above
- *
- * $tcl_library/../tk$tk_version
- * - look relative to init.tcl in an installed
- * lib directory (e.g. /usr/local)
- *
- * <executable directory>/../lib/tk$tk_version
- * - look for a lib/tk<ver> in a sibling of
- * the bin directory (e.g. /usr/local)
- *
- * <executable directory>/../library
- * - look in Tk build directory
- *
- * <executable directory>/../../tk$tk_patchLevel/library
- * - look for Tk build directory relative
- * to a parallel build directory
- *
- * The first directory on this path that contains a valid tk.tcl script
- * will be set ast the value of tk_library.
- *
- * Note that this entire search mechanism can be bypassed by defining an
- * alternate tkInit procedure before calling Tk_Init().
- */
-
-static char initScript[] = "if {[info proc tkInit]==\"\"} {\n\
- proc tkInit {} {\n\
- global tk_library tk_version tk_patchLevel\n\
- rename tkInit {}\n\
- tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\
- }\n\
-}\n\
-tkInit";
-
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 9ecfb72..45447f5 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -1,697 +1,575 @@
- # tkInt.decls --
+# tkInt.decls --
#
-# This file contains the declarations for all unsupported
-# functions that are exported by the Tk library. This file
-# is used to generate the tkIntDecls.h, tkIntPlatDecls.h,
-# tkIntStub.c, and tkPlatStub.c files.
+# This file contains the declarations for all unsupported functions that
+# are exported by the Tk library. This file is used to generate the
+# tkIntDecls.h, tkIntPlatDecls.h, tkIntStub.c, and tkPlatStub.c files.
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
library tk
+
+##############################################################################
# Define the unsupported generic interfaces.
interface tkInt
-# Declare each of the functions in the unsupported internal Tcl
-# interface. These interfaces are allowed to changed between versions.
-# Use at your own risk. Note that the position of functions should not
-# be changed between versions to avoid gratuitous incompatibilities.
+# Declare each of the functions in the unsupported internal Tcl interface.
+# These interfaces are allowed to changed between versions. Use at your own
+# risk. Note that the position of functions should not be changed between
+# versions to avoid gratuitous incompatibilities.
declare 0 generic {
- TkWindow * TkAllocWindow (TkDisplay *dispPtr, int screenNum, \
+ TkWindow *TkAllocWindow(TkDisplay *dispPtr, int screenNum,
TkWindow *parentPtr)
}
-
declare 1 generic {
- void TkBezierPoints (double control[], int numSteps, double *coordPtr)
+ void TkBezierPoints(double control[], int numSteps, double *coordPtr)
}
-
declare 2 generic {
- void TkBezierScreenPoints (Tk_Canvas canvas, double control[], \
+ void TkBezierScreenPoints(Tk_Canvas canvas, double control[],
int numSteps, XPoint *xPointPtr)
}
-
declare 3 generic {
- void TkBindDeadWindow (TkWindow *winPtr)
+ void TkBindDeadWindow(TkWindow *winPtr)
}
-
declare 4 generic {
- void TkBindEventProc (TkWindow *winPtr, XEvent *eventPtr)
+ void TkBindEventProc(TkWindow *winPtr, XEvent *eventPtr)
}
-
declare 5 generic {
- void TkBindFree (TkMainInfo *mainPtr)
+ void TkBindFree(TkMainInfo *mainPtr)
}
-
declare 6 generic {
- void TkBindInit (TkMainInfo *mainPtr)
+ void TkBindInit(TkMainInfo *mainPtr)
}
-
declare 7 generic {
- void TkChangeEventWindow (XEvent *eventPtr, TkWindow *winPtr)
+ void TkChangeEventWindow(XEvent *eventPtr, TkWindow *winPtr)
}
-
declare 8 generic {
- int TkClipInit (Tcl_Interp *interp, TkDisplay *dispPtr)
+ int TkClipInit(Tcl_Interp *interp, TkDisplay *dispPtr)
}
-
declare 9 generic {
- void TkComputeAnchor (Tk_Anchor anchor, Tk_Window tkwin, \
- int padX, int padY, int innerWidth, int innerHeight, \
- int *xPtr, int *yPtr)
+ void TkComputeAnchor(Tk_Anchor anchor, Tk_Window tkwin, int padX, int padY,
+ int innerWidth, int innerHeight, int *xPtr, int *yPtr)
}
-
declare 10 generic {
- int TkCopyAndGlobalEval (Tcl_Interp *interp, char *script)
+ int TkCopyAndGlobalEval(Tcl_Interp *interp, char *script)
}
-
declare 11 generic {
- unsigned long TkCreateBindingProcedure (Tcl_Interp *interp, \
- Tk_BindingTable bindingTable, \
- ClientData object, CONST char *eventString, \
- TkBindEvalProc *evalProc, TkBindFreeProc *freeProc, \
- ClientData clientData)
+ unsigned long TkCreateBindingProcedure(Tcl_Interp *interp,
+ Tk_BindingTable bindingTable, ClientData object,
+ CONST char *eventString, TkBindEvalProc *evalProc,
+ TkBindFreeProc *freeProc, ClientData clientData)
}
-
declare 12 generic {
- TkCursor * TkCreateCursorFromData (Tk_Window tkwin, \
- CONST char *source, CONST char *mask, int width, int height, \
+ TkCursor *TkCreateCursorFromData(Tk_Window tkwin,
+ CONST char *source, CONST char *mask, int width, int height,
int xHot, int yHot, XColor fg, XColor bg)
}
-
declare 13 generic {
- int TkCreateFrame (ClientData clientData, \
- Tcl_Interp *interp, int argc, char **argv, \
- int toplevel, char *appName)
+ int TkCreateFrame(ClientData clientData, Tcl_Interp *interp,
+ int argc, char **argv, int toplevel, char *appName)
}
-
declare 14 generic {
- Tk_Window TkCreateMainWindow (Tcl_Interp *interp, \
+ Tk_Window TkCreateMainWindow(Tcl_Interp *interp,
CONST char *screenName, char *baseName)
}
-
declare 15 generic {
- Time TkCurrentTime (TkDisplay *dispPtr)
+ Time TkCurrentTime(TkDisplay *dispPtr)
}
-
declare 16 generic {
- void TkDeleteAllImages (TkMainInfo *mainPtr)
+ void TkDeleteAllImages(TkMainInfo *mainPtr)
}
-
declare 17 generic {
- void TkDoConfigureNotify (TkWindow *winPtr)
+ void TkDoConfigureNotify(TkWindow *winPtr)
}
-
declare 18 generic {
- void TkDrawInsetFocusHighlight (Tk_Window tkwin, GC gc, int width, \
+ void TkDrawInsetFocusHighlight(Tk_Window tkwin, GC gc, int width,
Drawable drawable, int padding)
}
-
declare 19 generic {
- void TkEventDeadWindow (TkWindow *winPtr)
+ void TkEventDeadWindow(TkWindow *winPtr)
}
-
declare 20 generic {
- void TkFillPolygon (Tk_Canvas canvas, \
- double *coordPtr, int numPoints, Display *display, \
- Drawable drawable, GC gc, GC outlineGC)
+ void TkFillPolygon(Tk_Canvas canvas, double *coordPtr, int numPoints,
+ Display *display, Drawable drawable, GC gc, GC outlineGC)
}
-
declare 21 generic {
- int TkFindStateNum (Tcl_Interp *interp, \
- CONST char *option, CONST TkStateMap *mapPtr, \
- CONST char *strKey)
+ int TkFindStateNum(Tcl_Interp *interp, CONST char *option,
+ CONST TkStateMap *mapPtr, CONST char *strKey)
}
-
declare 22 generic {
- char * TkFindStateString (CONST TkStateMap *mapPtr, int numKey)
+ char *TkFindStateString(CONST TkStateMap *mapPtr, int numKey)
}
-
declare 23 generic {
- void TkFocusDeadWindow (TkWindow *winPtr)
+ void TkFocusDeadWindow(TkWindow *winPtr)
}
-
declare 24 generic {
- int TkFocusFilterEvent (TkWindow *winPtr, XEvent *eventPtr)
+ int TkFocusFilterEvent(TkWindow *winPtr, XEvent *eventPtr)
}
-
declare 25 generic {
- TkWindow * TkFocusKeyEvent (TkWindow *winPtr, XEvent *eventPtr)
+ TkWindow *TkFocusKeyEvent(TkWindow *winPtr, XEvent *eventPtr)
}
-
declare 26 generic {
- void TkFontPkgInit (TkMainInfo *mainPtr)
+ void TkFontPkgInit(TkMainInfo *mainPtr)
}
-
declare 27 generic {
- void TkFontPkgFree (TkMainInfo *mainPtr)
+ void TkFontPkgFree(TkMainInfo *mainPtr)
}
-
declare 28 generic {
- void TkFreeBindingTags (TkWindow *winPtr)
+ void TkFreeBindingTags(TkWindow *winPtr)
}
# Name change only, TkFreeCursor in Tcl 8.0.x now TkpFreeCursor
declare 29 generic {
- void TkpFreeCursor (TkCursor *cursorPtr)
+ void TkpFreeCursor(TkCursor *cursorPtr)
}
-
declare 30 generic {
- char * TkGetBitmapData (Tcl_Interp *interp, \
- char *string, char *fileName, int *widthPtr, \
- int *heightPtr, int *hotXPtr, int *hotYPtr)
+ char *TkGetBitmapData(Tcl_Interp *interp, char *string,
+ char *fileName, int *widthPtr, int *heightPtr,
+ int *hotXPtr, int *hotYPtr)
}
-
declare 31 generic {
- void TkGetButtPoints (double p1[], double p2[], \
+ void TkGetButtPoints(double p1[], double p2[],
double width, int project, double m1[], double m2[])
}
-
declare 32 generic {
- TkCursor * TkGetCursorByName (Tcl_Interp *interp, \
+ TkCursor *TkGetCursorByName(Tcl_Interp *interp,
Tk_Window tkwin, Tk_Uid string)
}
-
declare 33 generic {
- CONST84_RETURN char * TkGetDefaultScreenName (Tcl_Interp *interp, \
+ CONST84_RETURN char *TkGetDefaultScreenName(Tcl_Interp *interp,
CONST char *screenName)
}
-
declare 34 generic {
- TkDisplay * TkGetDisplay (Display *display)
+ TkDisplay *TkGetDisplay(Display *display)
}
-
declare 35 generic {
- int TkGetDisplayOf (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], \
+ int TkGetDisplayOf(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[],
Tk_Window *tkwinPtr)
}
-
declare 36 generic {
- TkWindow * TkGetFocusWin (TkWindow *winPtr)
+ TkWindow *TkGetFocusWin(TkWindow *winPtr)
}
-
declare 37 generic {
- int TkGetInterpNames (Tcl_Interp *interp, Tk_Window tkwin)
+ int TkGetInterpNames(Tcl_Interp *interp, Tk_Window tkwin)
}
-
declare 38 generic {
- int TkGetMiterPoints (double p1[], double p2[], double p3[], \
- double width, double m1[],double m2[])
+ int TkGetMiterPoints(double p1[], double p2[], double p3[],
+ double width, double m1[], double m2[])
}
-
declare 39 generic {
- void TkGetPointerCoords (Tk_Window tkwin, int *xPtr, int *yPtr)
+ void TkGetPointerCoords(Tk_Window tkwin, int *xPtr, int *yPtr)
}
-
declare 40 generic {
- void TkGetServerInfo (Tcl_Interp *interp, Tk_Window tkwin)
+ void TkGetServerInfo(Tcl_Interp *interp, Tk_Window tkwin)
}
-
declare 41 generic {
- void TkGrabDeadWindow (TkWindow *winPtr)
+ void TkGrabDeadWindow(TkWindow *winPtr)
}
-
declare 42 generic {
- int TkGrabState (TkWindow *winPtr)
+ int TkGrabState(TkWindow *winPtr)
}
-
declare 43 generic {
- void TkIncludePoint (Tk_Item *itemPtr, double *pointPtr)
+ void TkIncludePoint(Tk_Item *itemPtr, double *pointPtr)
}
-
declare 44 generic {
- void TkInOutEvents (XEvent *eventPtr, TkWindow *sourcePtr, \
- TkWindow *destPtr, int leaveType, int enterType, \
+ void TkInOutEvents(XEvent *eventPtr, TkWindow *sourcePtr,
+ TkWindow *destPtr, int leaveType, int enterType,
Tcl_QueuePosition position)
}
-
declare 45 generic {
- void TkInstallFrameMenu (Tk_Window tkwin)
+ void TkInstallFrameMenu(Tk_Window tkwin)
}
-
declare 46 generic {
- char * TkKeysymToString (KeySym keysym)
+ char *TkKeysymToString(KeySym keysym)
}
-
declare 47 generic {
- int TkLineToArea (double end1Ptr[], double end2Ptr[], double rectPtr[])
+ int TkLineToArea(double end1Ptr[], double end2Ptr[], double rectPtr[])
}
-
declare 48 generic {
- double TkLineToPoint (double end1Ptr[], \
- double end2Ptr[], double pointPtr[])
+ double TkLineToPoint(double end1Ptr[], double end2Ptr[], double pointPtr[])
}
-
declare 49 generic {
- int TkMakeBezierCurve (Tk_Canvas canvas, \
- double *pointPtr, int numPoints, int numSteps, \
- XPoint xPoints[], double dblPoints[])
+ int TkMakeBezierCurve(Tk_Canvas canvas, double *pointPtr, int numPoints,
+ int numSteps, XPoint xPoints[], double dblPoints[])
}
-
declare 50 generic {
- void TkMakeBezierPostscript (Tcl_Interp *interp, \
+ void TkMakeBezierPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, double *pointPtr, int numPoints)
}
-
declare 51 generic {
- void TkOptionClassChanged (TkWindow *winPtr)
+ void TkOptionClassChanged(TkWindow *winPtr)
}
-
declare 52 generic {
- void TkOptionDeadWindow (TkWindow *winPtr)
+ void TkOptionDeadWindow(TkWindow *winPtr)
}
-
declare 53 generic {
- int TkOvalToArea (double *ovalPtr, double *rectPtr)
+ int TkOvalToArea(double *ovalPtr, double *rectPtr)
}
-
declare 54 generic {
- double TkOvalToPoint (double ovalPtr[], \
+ double TkOvalToPoint(double ovalPtr[],
double width, int filled, double pointPtr[])
}
-
declare 55 generic {
- int TkpChangeFocus (TkWindow *winPtr, int force)
+ int TkpChangeFocus(TkWindow *winPtr, int force)
}
-
declare 56 generic {
- void TkpCloseDisplay (TkDisplay *dispPtr)
+ void TkpCloseDisplay(TkDisplay *dispPtr)
}
-
declare 57 generic {
- void TkpClaimFocus (TkWindow *topLevelPtr, int force)
+ void TkpClaimFocus(TkWindow *topLevelPtr, int force)
}
-
declare 58 generic {
- void TkpDisplayWarning (CONST char *msg, CONST char *title)
+ void TkpDisplayWarning(CONST char *msg, CONST char *title)
}
-
declare 59 generic {
- void TkpGetAppName (Tcl_Interp *interp, Tcl_DString *name)
+ void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name)
}
-
declare 60 generic {
- TkWindow * TkpGetOtherWindow (TkWindow *winPtr)
+ TkWindow *TkpGetOtherWindow(TkWindow *winPtr)
}
-
declare 61 generic {
- TkWindow * TkpGetWrapperWindow (TkWindow *winPtr)
+ TkWindow *TkpGetWrapperWindow(TkWindow *winPtr)
}
-
declare 62 generic {
- int TkpInit (Tcl_Interp *interp)
+ int TkpInit(Tcl_Interp *interp)
}
-
declare 63 generic {
- void TkpInitializeMenuBindings (Tcl_Interp *interp, \
+ void TkpInitializeMenuBindings(Tcl_Interp *interp,
Tk_BindingTable bindingTable)
}
-
declare 64 generic {
- void TkpMakeContainer (Tk_Window tkwin)
+ void TkpMakeContainer(Tk_Window tkwin)
}
-
declare 65 generic {
- void TkpMakeMenuWindow (Tk_Window tkwin, int transient)
+ void TkpMakeMenuWindow(Tk_Window tkwin, int transient)
}
-
declare 66 generic {
- Window TkpMakeWindow (TkWindow *winPtr, Window parent)
+ Window TkpMakeWindow(TkWindow *winPtr, Window parent)
}
-
declare 67 generic {
- void TkpMenuNotifyToplevelCreate (Tcl_Interp *interp1, char *menuName)
+ void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp1, char *menuName)
}
-
declare 68 generic {
- TkDisplay * TkpOpenDisplay (CONST char *display_name)
+ TkDisplay *TkpOpenDisplay(CONST char *display_name)
}
-
declare 69 generic {
- int TkPointerEvent (XEvent *eventPtr, TkWindow *winPtr)
+ int TkPointerEvent(XEvent *eventPtr, TkWindow *winPtr)
}
-
declare 70 generic {
- int TkPolygonToArea (double *polyPtr, int numPoints, double *rectPtr)
+ int TkPolygonToArea(double *polyPtr, int numPoints, double *rectPtr)
}
-
declare 71 generic {
- double TkPolygonToPoint (double *polyPtr, int numPoints, double *pointPtr)
+ double TkPolygonToPoint(double *polyPtr, int numPoints, double *pointPtr)
}
-
declare 72 generic {
- int TkPositionInTree (TkWindow *winPtr, TkWindow *treePtr)
+ int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr)
}
-
declare 73 generic {
- void TkpRedirectKeyEvent (TkWindow *winPtr, XEvent *eventPtr)
+ void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr)
}
-
declare 74 generic {
- void TkpSetMainMenubar (Tcl_Interp *interp, \
- Tk_Window tkwin, char *menuName)
+ void TkpSetMainMenubar(Tcl_Interp *interp, Tk_Window tkwin, char *menuName)
}
-
declare 75 generic {
- int TkpUseWindow (Tcl_Interp *interp, Tk_Window tkwin, CONST char *string)
+ int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, CONST char *string)
}
-
declare 76 generic {
- int TkpWindowWasRecentlyDeleted (Window win, TkDisplay *dispPtr)
+ int TkpWindowWasRecentlyDeleted(Window win, TkDisplay *dispPtr)
}
-
declare 77 generic {
- void TkQueueEventForAllChildren (TkWindow *winPtr, XEvent *eventPtr)
+ void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr)
}
-
declare 78 generic {
- 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)
+ 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)
}
-
declare 79 generic {
- int TkScrollWindow (Tk_Window tkwin, GC gc, \
- int x, int y, int width, int height, int dx, \
- int dy, TkRegion damageRgn)
+ int TkScrollWindow(Tk_Window tkwin, GC gc, int x, int y,
+ int width, int height, int dx, int dy, TkRegion damageRgn)
}
-
declare 80 generic {
- void TkSelDeadWindow (TkWindow *winPtr)
+ void TkSelDeadWindow(TkWindow *winPtr)
}
-
declare 81 generic {
- void TkSelEventProc (Tk_Window tkwin, XEvent *eventPtr)
+ void TkSelEventProc(Tk_Window tkwin, XEvent *eventPtr)
}
-
declare 82 generic {
- void TkSelInit (Tk_Window tkwin)
+ void TkSelInit(Tk_Window tkwin)
}
-
declare 83 generic {
- void TkSelPropProc (XEvent *eventPtr)
+ void TkSelPropProc(XEvent *eventPtr)
}
# Exported publically as Tk_SetClassProcs in 8.4a2
#declare 84 generic {
-# void TkSetClassProcs (Tk_Window tkwin, \
+# void TkSetClassProcs(Tk_Window tkwin,
# TkClassProcs *procs, ClientData instanceData)
#}
declare 85 generic {
- void TkSetWindowMenuBar (Tcl_Interp *interp, \
- Tk_Window tkwin, char *oldMenuName, char *menuName)
+ void TkSetWindowMenuBar(Tcl_Interp *interp, Tk_Window tkwin,
+ char *oldMenuName, char *menuName)
}
-
declare 86 generic {
- KeySym TkStringToKeysym (char *name)
+ KeySym TkStringToKeysym(char *name)
}
-
declare 87 generic {
- int TkThickPolyLineToArea (double *coordPtr, \
- int numPoints, double width, int capStyle, \
- int joinStyle, double *rectPtr)
+ int TkThickPolyLineToArea(double *coordPtr, int numPoints,
+ double width, int capStyle, int joinStyle, double *rectPtr)
}
-
declare 88 generic {
- void TkWmAddToColormapWindows (TkWindow *winPtr)
+ void TkWmAddToColormapWindows(TkWindow *winPtr)
}
-
declare 89 generic {
- void TkWmDeadWindow (TkWindow *winPtr)
+ void TkWmDeadWindow(TkWindow *winPtr)
}
-
declare 90 generic {
- TkWindow * TkWmFocusToplevel (TkWindow *winPtr)
+ TkWindow *TkWmFocusToplevel(TkWindow *winPtr)
}
-
declare 91 generic {
- void TkWmMapWindow (TkWindow *winPtr)
+ void TkWmMapWindow(TkWindow *winPtr)
}
-
declare 92 generic {
- void TkWmNewWindow (TkWindow *winPtr)
+ void TkWmNewWindow(TkWindow *winPtr)
}
-
declare 93 generic {
- void TkWmProtocolEventProc (TkWindow *winPtr, XEvent *evenvPtr)
+ void TkWmProtocolEventProc(TkWindow *winPtr, XEvent *evenvPtr)
}
-
declare 94 generic {
- void TkWmRemoveFromColormapWindows (TkWindow *winPtr)
+ void TkWmRemoveFromColormapWindows(TkWindow *winPtr)
}
-
declare 95 generic {
- void TkWmRestackToplevel (TkWindow *winPtr, int aboveBelow, \
+ void TkWmRestackToplevel(TkWindow *winPtr, int aboveBelow,
TkWindow *otherPtr)
}
-
declare 96 generic {
- void TkWmSetClass (TkWindow *winPtr)
+ void TkWmSetClass(TkWindow *winPtr)
}
-
declare 97 generic {
- void TkWmUnmapWindow (TkWindow *winPtr)
+ void TkWmUnmapWindow(TkWindow *winPtr)
}
# new for 8.1
declare 98 generic {
- Tcl_Obj * TkDebugBitmap ( Tk_Window tkwin, char *name)
+ Tcl_Obj *TkDebugBitmap(Tk_Window tkwin, char *name)
}
-
declare 99 generic {
- Tcl_Obj * TkDebugBorder ( Tk_Window tkwin, char *name)
+ Tcl_Obj *TkDebugBorder(Tk_Window tkwin, char *name)
}
-
declare 100 generic {
- Tcl_Obj * TkDebugCursor ( Tk_Window tkwin, char *name)
+ Tcl_Obj *TkDebugCursor(Tk_Window tkwin, char *name)
}
-
declare 101 generic {
- Tcl_Obj * TkDebugColor ( Tk_Window tkwin, char *name)
+ Tcl_Obj *TkDebugColor(Tk_Window tkwin, char *name)
}
-
declare 102 generic {
- Tcl_Obj * TkDebugConfig (Tcl_Interp *interp, Tk_OptionTable table)
+ Tcl_Obj *TkDebugConfig(Tcl_Interp *interp, Tk_OptionTable table)
}
-
declare 103 generic {
- Tcl_Obj * TkDebugFont ( Tk_Window tkwin, char *name)
+ Tcl_Obj *TkDebugFont(Tk_Window tkwin, char *name)
}
-
declare 104 generic {
- int TkFindStateNumObj (Tcl_Interp *interp, \
- Tcl_Obj *optionPtr, CONST TkStateMap *mapPtr, \
- Tcl_Obj *keyPtr)
+ int TkFindStateNumObj(Tcl_Interp *interp, Tcl_Obj *optionPtr,
+ CONST TkStateMap *mapPtr, Tcl_Obj *keyPtr)
}
-
declare 105 generic {
- Tcl_HashTable * TkGetBitmapPredefTable (void)
+ Tcl_HashTable *TkGetBitmapPredefTable(void)
}
-
declare 106 generic {
- TkDisplay * TkGetDisplayList (void)
+ TkDisplay *TkGetDisplayList(void)
}
-
declare 107 generic {
- TkMainInfo * TkGetMainInfoList (void)
+ TkMainInfo *TkGetMainInfoList(void)
}
-
declare 108 generic {
- int TkGetWindowFromObj (Tcl_Interp *interp, \
- Tk_Window tkwin, Tcl_Obj *objPtr, \
- Tk_Window *windowPtr)
+ int TkGetWindowFromObj(Tcl_Interp *interp, Tk_Window tkwin,
+ Tcl_Obj *objPtr, Tk_Window *windowPtr)
}
-
declare 109 generic {
- char * TkpGetString (TkWindow *winPtr, \
- XEvent *eventPtr, Tcl_DString *dsPtr)
+ char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr)
}
-
declare 110 generic {
- void TkpGetSubFonts (Tcl_Interp *interp, Tk_Font tkfont)
+ void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont)
}
-
declare 111 generic {
- Tcl_Obj * TkpGetSystemDefault (Tk_Window tkwin, \
+ Tcl_Obj *TkpGetSystemDefault(Tk_Window tkwin,
CONST char *dbName, CONST char *className)
}
-
declare 112 generic {
- void TkpMenuThreadInit (void)
+ void TkpMenuThreadInit(void)
}
-
-declare 113 {mac aqua win} {
- void TkClipBox (TkRegion rgn, XRectangle* rect_return)
+declare 113 {aqua win} {
+ void TkClipBox(TkRegion rgn, XRectangle *rect_return)
}
-
-declare 114 {mac aqua win} {
- TkRegion TkCreateRegion (void)
+declare 114 {aqua win} {
+ TkRegion TkCreateRegion(void)
}
-
-declare 115 {mac aqua win} {
- void TkDestroyRegion (TkRegion rgn)
+declare 115 {aqua win} {
+ void TkDestroyRegion(TkRegion rgn)
}
-
-declare 116 {mac aqua win} {
- void TkIntersectRegion (TkRegion sra, TkRegion srcb, TkRegion dr_return)
+declare 116 {aqua win} {
+ void TkIntersectRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
}
-
-declare 117 {mac aqua win} {
- int TkRectInRegion (TkRegion rgn, int x, int y, unsigned int width, \
+declare 117 {aqua win} {
+ int TkRectInRegion(TkRegion rgn, int x, int y, unsigned int width,
unsigned int height)
}
-
-declare 118 {mac aqua win} {
- void TkSetRegion (Display* display, GC gc, TkRegion rgn)
+declare 118 {aqua win} {
+ void TkSetRegion(Display *display, GC gc, TkRegion rgn)
}
-
-declare 119 {mac aqua win} {
- void TkUnionRectWithRegion (XRectangle* rect, \
+declare 119 {aqua win} {
+ void TkUnionRectWithRegion(XRectangle *rect,
TkRegion src, TkRegion dr_return)
}
-
-# removed duplicate from tkIntPlat table
-#declare 120 mac {
-# void TkGenerateActivateEvents (TkWindow *winPtr, int active)
-#}
-
-declare 121 {mac aqua} {
- Pixmap TkpCreateNativeBitmap (Display *display, CONST char * source)
+declare 121 aqua {
+ Pixmap TkpCreateNativeBitmap(Display *display, CONST char *source)
}
-
-declare 122 {mac aqua} {
- void TkpDefineNativeBitmaps (void)
+declare 122 aqua {
+ void TkpDefineNativeBitmaps(void)
}
-
-# removed duplicate from tkIntPlat table
-#declare 123 mac {
-# unsigned long TkpGetMS (void)
-#}
-
-declare 124 {mac aqua} {
- Pixmap TkpGetNativeAppBitmap (Display *display, \
+declare 124 aqua {
+ Pixmap TkpGetNativeAppBitmap(Display *display,
CONST char *name, int *width, int *height)
}
-
-# removed duplicates from tkIntPlat table
-#declare 125 mac {
-# void TkPointerDeadWindow (TkWindow *winPtr)
-#}
-#
-#declare 126 mac {
-# void TkpSetCapture (TkWindow *winPtr)
-#}
-#
-#declare 127 mac {
-# void TkpSetCursor (TkpCursor cursor)
-#}
-#
-#declare 128 mac {
-# void TkpWmSetState (TkWindow *winPtr, int state)
-#}
-#
-#declare 130 mac {
-# Window TkGetTransientMaster (TkWindow *winPtr)
-#}
-#
-#declare 131 mac {
-# int TkGenerateButtonEvent (int x, int y, \
-# Window window, unsigned int state)
-#}
-#
-#declare 133 mac {
-# void TkGenWMDestroyEvent (Tk_Window tkwin)
-#}
-#
-#declare 134 mac {
-# void TkGenWMConfigureEvent (Tk_Window tkwin, int x, int y, \
-# int width, int height, int flags)
-#}
-
declare 135 generic {
- void TkpDrawHighlightBorder (Tk_Window tkwin, GC fgGC, GC bgGC, \
+ void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC,
int highlightWidth, Drawable drawable)
}
-
declare 136 generic {
- void TkSetFocusWin (TkWindow *winPtr, int force)
+ void TkSetFocusWin(TkWindow *winPtr, int force)
}
-
declare 137 generic {
- void TkpSetKeycodeAndState (Tk_Window tkwin, KeySym keySym, \
+ void TkpSetKeycodeAndState(Tk_Window tkwin, KeySym keySym,
XEvent *eventPtr)
}
-
declare 138 generic {
- KeySym TkpGetKeySym (TkDisplay *dispPtr, XEvent *eventPtr)
+ KeySym TkpGetKeySym(TkDisplay *dispPtr, XEvent *eventPtr)
}
-
declare 139 generic {
- void TkpInitKeymapInfo (TkDisplay *dispPtr)
+ void TkpInitKeymapInfo(TkDisplay *dispPtr)
}
-
declare 140 generic {
- TkRegion TkPhotoGetValidRegion (Tk_PhotoHandle handle)
+ TkRegion TkPhotoGetValidRegion(Tk_PhotoHandle handle)
}
-
declare 141 generic {
- TkWindow ** TkWmStackorderToplevel(TkWindow *parentPtr)
+ TkWindow **TkWmStackorderToplevel(TkWindow *parentPtr)
}
-
declare 142 generic {
void TkFocusFree(TkMainInfo *mainPtr)
}
-
declare 143 generic {
void TkClipCleanup(TkDisplay *dispPtr)
}
-
declare 144 generic {
void TkGCCleanup(TkDisplay *dispPtr)
}
-
-declare 145 {mac win aqua} {
- void TkSubtractRegion (TkRegion sra, TkRegion srcb, TkRegion dr_return)
+declare 145 {win aqua} {
+ void TkSubtractRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
}
-
declare 146 generic {
- void TkStylePkgInit (TkMainInfo *mainPtr)
+ void TkStylePkgInit(TkMainInfo *mainPtr)
}
declare 147 generic {
- void TkStylePkgFree (TkMainInfo *mainPtr)
+ void TkStylePkgFree(TkMainInfo *mainPtr)
}
-
declare 148 generic {
Tk_Window TkToplevelWindowForCommand(Tcl_Interp *interp,
CONST char *cmdName)
}
-
declare 149 generic {
- CONST Tk_OptionSpec * TkGetOptionSpec (CONST char *name,
- Tk_OptionTable optionTable)
+ CONST Tk_OptionSpec *TkGetOptionSpec(CONST char *name,
+ Tk_OptionTable optionTable)
}
-# TIP#168 - 8.5+
-#declare 150 generic {
-# int TkMakeRawCurve (Tk_Canvas canvas,
-# double *pointPtr, int numPoints, int numSteps,
-# XPoint xPoints[], double dblPoints[])
-#}
-#declare 151 generic {
-# void TkMakeRawCurvePostscript (Tcl_Interp *interp,
-# Tk_Canvas canvas, double *pointPtr, int numPoints)
-#}
-
+# TIP#168
+declare 150 generic {
+ int TkMakeRawCurve(Tk_Canvas canvas, double *pointPtr, int numPoints,
+ int numSteps, XPoint xPoints[], double dblPoints[])
+}
+declare 151 generic {
+ void TkMakeRawCurvePostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, double *pointPtr, int numPoints)
+}
declare 152 generic {
void TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border,
- int highlightWidth, int borderWidth, int relief)
+ int highlightWidth, int borderWidth, int relief)
+}
+declare 153 generic {
+ void TkCreateThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData)
+}
+declare 154 generic {
+ void TkDeleteThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData)
}
+# entries needed only by tktest:
+declare 156 generic {
+ int TkpTestembedCmd(ClientData clientData, Tcl_Interp *interp, int argc,
+ CONST char **argv)
+}
+declare 157 generic {
+ int TkpTesttextCmd(ClientData dummy, Tcl_Interp *interp, int argc,
+ CONST char **argv)
+}
+
+# Next group of functions exposed due to [Bug 2768945]. Numbers are chosen so
+# as to match 8.6 branch/HEAD.
+declare 169 generic {
+ int TkStateParseProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
+}
+declare 170 generic {
+ char *TkStatePrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+}
+declare 171 generic {
+ int TkCanvasDashParseProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
+}
+declare 172 generic {
+ char *TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+}
+declare 173 generic {
+ int TkOffsetParseProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
+}
+declare 174 generic {
+ char *TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+}
+declare 175 generic {
+ int TkPixelParseProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
+}
+declare 176 generic {
+ char *TkPixelPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+}
+declare 177 generic {
+ int TkOrientParseProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
+}
+declare 178 generic {
+ char *TkOrientPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+}
+declare 179 generic {
+ int TkSmoothParseProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
+}
+declare 180 generic {
+ char *TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
+}
+
##############################################################################
# Define the platform specific internal Tcl interface. These functions are
@@ -699,200 +577,160 @@ declare 152 generic {
interface tkIntPlat
-#########################
+################################
# Unix specific functions
declare 0 x11 {
- void TkCreateXEventSource (void)
+ void TkCreateXEventSource(void)
}
-
declare 1 x11 {
- void TkFreeWindowId (TkDisplay *dispPtr, Window w)
+ void TkFreeWindowId(TkDisplay *dispPtr, Window w)
}
-
declare 2 x11 {
- void TkInitXId (TkDisplay *dispPtr)
+ void TkInitXId(TkDisplay *dispPtr)
}
-
declare 3 x11 {
- int TkpCmapStressed (Tk_Window tkwin, Colormap colormap)
+ int TkpCmapStressed(Tk_Window tkwin, Colormap colormap)
}
-
declare 4 x11 {
- void TkpSync (Display *display)
+ void TkpSync(Display *display)
}
-
declare 5 x11 {
- Window TkUnixContainerId (TkWindow *winPtr)
+ Window TkUnixContainerId(TkWindow *winPtr)
}
-
declare 6 x11 {
- int TkUnixDoOneXEvent (Tcl_Time *timePtr)
+ int TkUnixDoOneXEvent(Tcl_Time *timePtr)
}
-
declare 7 x11 {
- void TkUnixSetMenubar (Tk_Window tkwin, Tk_Window menubar)
+ void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar)
}
-
declare 8 x11 {
- int TkpScanWindowId (Tcl_Interp *interp, CONST char *string, Window *idPtr)
+ int TkpScanWindowId(Tcl_Interp *interp, CONST char *string, Window *idPtr)
}
-
declare 9 x11 {
- void TkWmCleanup (TkDisplay *dispPtr)
+ void TkWmCleanup(TkDisplay *dispPtr)
}
-
declare 10 x11 {
- void TkSendCleanup (TkDisplay *dispPtr)
+ void TkSendCleanup(TkDisplay *dispPtr)
}
-
declare 11 x11 {
- void TkFreeXId (TkDisplay *dispPtr)
+ void TkFreeXId(TkDisplay *dispPtr)
}
-
declare 12 x11 {
- int TkpWmSetState (TkWindow *winPtr, int state)
+ int TkpWmSetState(TkWindow *winPtr, int state)
+}
+# only needed by tktest:
+declare 13 x11 {
+ int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int argc,
+ CONST char **argv)
}
-############################
+################################
# Windows specific functions
declare 0 win {
- char * TkAlignImageData (XImage *image, int alignment, int bitOrder)
+ char *TkAlignImageData(XImage *image, int alignment, int bitOrder)
}
-
declare 2 win {
- void TkGenerateActivateEvents (TkWindow *winPtr, int active)
+ void TkGenerateActivateEvents(TkWindow *winPtr, int active)
}
-
declare 3 win {
- unsigned long TkpGetMS (void)
+ unsigned long TkpGetMS(void)
}
-
declare 4 win {
- void TkPointerDeadWindow (TkWindow *winPtr)
+ void TkPointerDeadWindow(TkWindow *winPtr)
}
-
declare 5 win {
- void TkpPrintWindowId (char *buf, Window window)
+ void TkpPrintWindowId(char *buf, Window window)
}
-
declare 6 win {
- int TkpScanWindowId (Tcl_Interp *interp, CONST char *string, Window *idPtr)
+ int TkpScanWindowId(Tcl_Interp *interp, CONST char *string, Window *idPtr)
}
-
declare 7 win {
- void TkpSetCapture (TkWindow *winPtr)
+ void TkpSetCapture(TkWindow *winPtr)
}
-
declare 8 win {
- void TkpSetCursor (TkpCursor cursor)
+ void TkpSetCursor(TkpCursor cursor)
}
-
declare 9 win {
- void TkpWmSetState (TkWindow *winPtr, int state)
+ void TkpWmSetState(TkWindow *winPtr, int state)
}
-
declare 10 win {
- void TkSetPixmapColormap (Pixmap pixmap, Colormap colormap)
+ void TkSetPixmapColormap(Pixmap pixmap, Colormap colormap)
}
-
declare 11 win {
- void TkWinCancelMouseTimer (void)
+ void TkWinCancelMouseTimer(void)
}
-
declare 12 win {
- void TkWinClipboardRender (TkDisplay *dispPtr, UINT format)
+ void TkWinClipboardRender(TkDisplay *dispPtr, UINT format)
}
-
declare 13 win {
- LRESULT TkWinEmbeddedEventProc (HWND hwnd, UINT message, \
+ LRESULT TkWinEmbeddedEventProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
}
-
declare 14 win {
- void TkWinFillRect (HDC dc, int x, int y, int width, int height, \
- int pixel)
+ void TkWinFillRect(HDC dc, int x, int y, int width, int height, int pixel)
}
-
declare 15 win {
- COLORREF TkWinGetBorderPixels (Tk_Window tkwin, Tk_3DBorder border, \
+ COLORREF TkWinGetBorderPixels(Tk_Window tkwin, Tk_3DBorder border,
int which)
}
-
declare 16 win {
- HDC TkWinGetDrawableDC (Display *display, Drawable d, TkWinDCState* state)
+ HDC TkWinGetDrawableDC(Display *display, Drawable d, TkWinDCState *state)
}
-
declare 17 win {
- int TkWinGetModifierState (void)
+ int TkWinGetModifierState(void)
}
-
declare 18 win {
- HPALETTE TkWinGetSystemPalette (void)
+ HPALETTE TkWinGetSystemPalette(void)
}
-
declare 19 win {
- HWND TkWinGetWrapperWindow (Tk_Window tkwin)
+ HWND TkWinGetWrapperWindow(Tk_Window tkwin)
}
-
declare 20 win {
- int TkWinHandleMenuEvent (HWND *phwnd, \
- UINT *pMessage, WPARAM *pwParam, LPARAM *plParam, \
- LRESULT *plResult)
+ int TkWinHandleMenuEvent(HWND *phwnd, UINT *pMessage, WPARAM *pwParam,
+ LPARAM *plParam, LRESULT *plResult)
}
-
declare 21 win {
- int TkWinIndexOfColor (XColor *colorPtr)
+ int TkWinIndexOfColor(XColor *colorPtr)
}
-
declare 22 win {
- void TkWinReleaseDrawableDC (Drawable d, HDC hdc, TkWinDCState* state)
+ void TkWinReleaseDrawableDC(Drawable d, HDC hdc, TkWinDCState *state)
}
-
declare 23 win {
- LRESULT TkWinResendEvent (WNDPROC wndproc, HWND hwnd, XEvent *eventPtr)
+ LRESULT TkWinResendEvent(WNDPROC wndproc, HWND hwnd, XEvent *eventPtr)
}
-
declare 24 win {
- HPALETTE TkWinSelectPalette (HDC dc, Colormap colormap)
+ HPALETTE TkWinSelectPalette(HDC dc, Colormap colormap)
}
-
declare 25 win {
- void TkWinSetMenu (Tk_Window tkwin, HMENU hMenu)
+ void TkWinSetMenu(Tk_Window tkwin, HMENU hMenu)
}
-
declare 26 win {
- void TkWinSetWindowPos (HWND hwnd, HWND siblingHwnd, int pos)
+ void TkWinSetWindowPos(HWND hwnd, HWND siblingHwnd, int pos)
}
-
declare 27 win {
- void TkWinWmCleanup (HINSTANCE hInstance)
+ void TkWinWmCleanup(HINSTANCE hInstance)
}
-
declare 28 win {
- void TkWinXCleanup (ClientData clientData)
+ void TkWinXCleanup(ClientData clientData)
}
-
declare 29 win {
- void TkWinXInit (HINSTANCE hInstance)
+ void TkWinXInit(HINSTANCE hInstance)
}
# new for 8.1
declare 30 win {
- void TkWinSetForegroundWindow (TkWindow *winPtr)
+ void TkWinSetForegroundWindow(TkWindow *winPtr)
}
-
declare 31 win {
- void TkWinDialogDebug (int debug)
+ void TkWinDialogDebug(int debug)
}
-
declare 32 win {
- Tcl_Obj * TkWinGetMenuSystemDefault (Tk_Window tkwin, \
+ Tcl_Obj *TkWinGetMenuSystemDefault(Tk_Window tkwin,
CONST char *dbName, CONST char *className)
}
-
declare 33 win {
int TkWinGetPlatformId(void)
}
@@ -900,475 +738,200 @@ declare 33 win {
# new for 8.4.1
declare 34 win {
- void TkWinSetHINSTANCE (HINSTANCE hInstance)
-}
-
-########################
-# Mac specific functions
-
-declare 0 mac {
- void TkGenerateActivateEvents (TkWindow *winPtr, int active)
-}
-
-# removed duplicates from tkInt table
-#declare 1 mac {
-# Pixmap TkpCreateNativeBitmap (Display *display, CONST char * source)
-#}
-#
-#declare 2 mac {
-# void TkpDefineNativeBitmaps (void)
-#}
-
-declare 3 mac {
- unsigned long TkpGetMS (void)
-}
-
-declare 5 mac {
- void TkPointerDeadWindow (TkWindow *winPtr)
-}
-
-declare 6 mac {
- void TkpSetCapture (TkWindow *winPtr)
+ void TkWinSetHINSTANCE(HINSTANCE hInstance)
}
-
-declare 7 mac {
- void TkpSetCursor (TkpCursor cursor)
-}
-
-declare 8 mac {
- void TkpWmSetState (TkWindow *winPtr, int state)
-}
-
-declare 10 mac {
- void TkAboutDlg (void)
-}
-
-declare 13 mac {
- Window TkGetTransientMaster (TkWindow *winPtr)
-}
-
-declare 14 mac {
- int TkGenerateButtonEvent (int x, int y, \
- Window window, unsigned int state)
-}
-
-declare 16 mac {
- void TkGenWMDestroyEvent (Tk_Window tkwin)
-}
-
-# removed duplicate from tkPlat table (tk.decls)
-#declare 17 mac {
-# void TkGenWMConfigureEvent (Tk_Window tkwin, int x, int y, \
-# int width, int height, int flags)
-#}
-
-declare 18 mac {
- unsigned int TkMacButtonKeyState (void)
-}
-
-declare 19 mac {
- void TkMacClearMenubarActive (void)
-}
-
-# removed duplicate from tkPlat table (tk.decls)
-#declare 20 mac {
-# int TkMacConvertEvent (EventRecord *eventPtr)
-#}
-
-declare 21 mac {
- int TkMacDispatchMenuEvent (int menuID, int index)
-}
-
-declare 22 mac {
- void TkMacInstallCursor (int resizeOverride)
-}
-
-# removed duplicate from tkPlat table (tk.decls)
-#declare 23 mac {
-# int TkMacConvertTkEvent (EventRecord *eventPtr, Window window)
-#}
-
-declare 24 mac {
- void TkMacHandleTearoffMenu (void)
-}
-
-# removed duplicate from tkPlat table (tk.decls)
-#declare 26 mac {
-# void TkMacInvalClipRgns (TkWindow *winPtr)
-#}
-
-declare 27 mac {
- void TkMacDoHLEvent (EventRecord *theEvent)
-}
-
-declare 29 mac {
- Time TkMacGenerateTime (void)
-}
-
-# removed duplicate from tkPlat table (tk.decls)
-#declare 30 mac {
-# GWorldPtr TkMacGetDrawablePort (Drawable drawable)
-#}
-
-declare 31 mac {
- TkWindow * TkMacGetScrollbarGrowWindow (TkWindow *winPtr)
-}
-
-declare 32 mac {
- Window TkMacGetXWindow (WindowRef macWinPtr)
-}
-
-declare 33 mac {
- int TkMacGrowToplevel (WindowRef whichWindow, Point start)
-}
-
-declare 34 mac {
- void TkMacHandleMenuSelect (long mResult, int optionKeyPressed)
-}
-
-# removed duplicates from tkPlat table (tk.decls)
-#declare 35 mac {
-# int TkMacHaveAppearance (void)
-#}
-#
-#declare 36 mac {
-# void TkMacInitAppleEvents (Tcl_Interp *interp)
-#}
-#
-#declare 37 mac {
-# void TkMacInitMenus (Tcl_Interp *interp)
-#}
-
-declare 38 mac {
- void TkMacInvalidateWindow (MacDrawable *macWin, int flag)
-}
-
-declare 39 mac {
- int TkMacIsCharacterMissing (Tk_Font tkfont, unsigned int searchChar)
-}
-
-declare 40 mac {
- void TkMacMakeRealWindowExist (TkWindow *winPtr)
-}
-
-declare 41 mac {
- BitMapPtr TkMacMakeStippleMap(Drawable d1, Drawable d2)
-}
-
-declare 42 mac {
- void TkMacMenuClick (void)
-}
-
-declare 43 mac {
- void TkMacRegisterOffScreenWindow (Window window, GWorldPtr portPtr)
-}
-
-declare 44 mac {
- int TkMacResizable (TkWindow *winPtr)
-}
-
-declare 46 mac {
- void TkMacSetHelpMenuItemCount (void)
-}
-
-declare 47 mac {
- void TkMacSetScrollbarGrow (TkWindow *winPtr, int flag)
-}
-
-declare 48 mac {
- void TkMacSetUpClippingRgn (Drawable drawable)
-}
-
-declare 49 mac {
- void TkMacSetUpGraphicsPort (GC gc)
-}
-
-declare 50 mac {
- void TkMacUpdateClipRgn (TkWindow *winPtr)
-}
-
-declare 51 mac {
- void TkMacUnregisterMacWindow (GWorldPtr portPtr)
-}
-
-declare 52 mac {
- int TkMacUseMenuID (short macID)
-}
-
-declare 53 mac {
- RgnHandle TkMacVisableClipRgn (TkWindow *winPtr)
-}
-
-declare 54 mac {
- void TkMacWinBounds (TkWindow *winPtr, Rect *geometry)
-}
-
-declare 55 mac {
- void TkMacWindowOffset (WindowRef wRef, int *xOffset, int *yOffset)
-}
-
-declare 57 mac {
- int TkSetMacColor (unsigned long pixel, RGBColor *macColor)
-}
-
-declare 58 mac {
- void TkSetWMName (TkWindow *winPtr, Tk_Uid titleUid)
-}
-
-declare 59 mac {
- void TkSuspendClipboard (void)
-}
-
-declare 61 mac {
- int TkMacZoomToplevel (WindowPtr whichWindow, Point where, short zoomPart)
-}
-
-declare 62 mac {
- Tk_Window Tk_TopCoordsToWindow (Tk_Window tkwin, \
- int rootX, int rootY, int *newX, int *newY)
-}
-
-declare 63 mac {
- MacDrawable * TkMacContainerId (TkWindow *winPtr)
-}
-
-declare 64 mac {
- MacDrawable * TkMacGetHostToplevel (TkWindow *winPtr)
-}
-
-declare 65 mac {
- void TkMacPreprocessMenu (void)
+declare 35 win {
+ int TkWinGetPlatformTheme(void)
}
-declare 66 mac {
- int TkpIsWindowFloating (WindowRef window)
-}
+# Exported through stub table since Tk 8.5.9
-declare 35 win {
- int TkWinGetPlatformTheme (void)
+declare 36 win {
+ LRESULT CALLBACK TkWinChildProc(HWND hwnd,
+ UINT message, WPARAM wParam, LPARAM lParam)
}
-########################
-# Mac OS X specific functions
+################################
+# Aqua specific functions
declare 0 aqua {
- void TkGenerateActivateEvents (TkWindow *winPtr, int active)
+ void TkGenerateActivateEvents(TkWindow *winPtr, int active)
}
# removed duplicates from tkInt table
#declare 1 aqua {
-# Pixmap TkpCreateNativeBitmap (Display *display, CONST char * source)
+# Pixmap TkpCreateNativeBitmap(Display *display, CONST char *source)
#}
#
#declare 2 aqua {
-# void TkpDefineNativeBitmaps (void)
+# void TkpDefineNativeBitmaps(void)
#}
declare 3 aqua {
- void TkPointerDeadWindow (TkWindow *winPtr)
+ void TkPointerDeadWindow(TkWindow *winPtr)
}
-
declare 4 aqua {
- void TkpSetCapture (TkWindow *winPtr)
+ void TkpSetCapture(TkWindow *winPtr)
}
-
declare 5 aqua {
- void TkpSetCursor (TkpCursor cursor)
+ void TkpSetCursor(TkpCursor cursor)
}
-
declare 6 aqua {
- void TkpWmSetState (TkWindow *winPtr, int state)
+ void TkpWmSetState(TkWindow *winPtr, int state)
}
-
declare 7 aqua {
- void TkAboutDlg (void)
+ void TkAboutDlg(void)
}
-
declare 8 aqua {
- unsigned int TkMacOSXButtonKeyState (void)
+ unsigned int TkMacOSXButtonKeyState(void)
}
-
declare 9 aqua {
- void TkMacOSXClearMenubarActive (void)
+ void TkMacOSXClearMenubarActive(void)
}
-
declare 10 aqua {
- int TkMacOSXDispatchMenuEvent (int menuID, int index)
+ int TkMacOSXDispatchMenuEvent(int menuID, int index)
}
-
declare 11 aqua {
- void TkMacOSXInstallCursor (int resizeOverride)
+ void TkMacOSXInstallCursor(int resizeOverride)
}
-
declare 12 aqua {
- void TkMacOSXHandleTearoffMenu (void)
+ void TkMacOSXHandleTearoffMenu(void)
}
-# removed duplicate from tkPlat table (tk.decls)
+# removed duplicate from tkPlat table(tk.decls)
#declare 13 aqua {
-# void TkMacOSXInvalClipRgns (TkWindow *winPtr)
+# void TkMacOSXInvalClipRgns(TkWindow *winPtr)
#}
declare 14 aqua {
- int TkMacOSXDoHLEvent (EventRecord *theEvent)
+ int TkMacOSXDoHLEvent(EventRecord *theEvent)
}
-# removed duplicate from tkPlat table (tk.decls)
+# removed duplicate from tkPlat table(tk.decls)
#declare 15 aqua {
-# GWorldPtr TkMacOSXGetDrawablePort (Drawable drawable)
+# GWorldPtr TkMacOSXGetDrawablePort(Drawable drawable)
#}
declare 16 aqua {
- Window TkMacOSXGetXWindow (WindowRef macWinPtr)
+ Window TkMacOSXGetXWindow(WindowRef macWinPtr)
}
-
declare 17 aqua {
- int TkMacOSXGrowToplevel (WindowRef whichWindow, Point start)
+ int TkMacOSXGrowToplevel(WindowRef whichWindow, Point start)
}
-
declare 18 aqua {
- void TkMacOSXHandleMenuSelect(MenuID theMenu, MenuItemIndex theItem, int optionKeyPressed)
+ void TkMacOSXHandleMenuSelect(MenuID theMenu, MenuItemIndex theItem,
+ int optionKeyPressed)
}
-# removed duplicates from tkPlat table (tk.decls)
+# removed duplicates from tkPlat table(tk.decls)
#declare 19 aqua {
-# void TkMacOSXInitAppleEvents (Tcl_Interp *interp)
+# void TkMacOSXInitAppleEvents(Tcl_Interp *interp)
#}
#
#declare 20 aqua {
-# void TkMacOSXInitMenus (Tcl_Interp *interp)
+# void TkMacOSXInitMenus(Tcl_Interp *interp)
#}
declare 21 aqua {
- void TkMacOSXInvalidateWindow (MacDrawable *macWin, int flag)
+ void TkMacOSXInvalidateWindow(MacDrawable *macWin, int flag)
}
-
declare 22 aqua {
- int TkMacOSXIsCharacterMissing (Tk_Font tkfont, unsigned int searchChar)
+ int TkMacOSXIsCharacterMissing(Tk_Font tkfont, unsigned int searchChar)
}
-
declare 23 aqua {
- void TkMacOSXMakeRealWindowExist (TkWindow *winPtr)
+ void TkMacOSXMakeRealWindowExist(TkWindow *winPtr)
}
-
declare 24 aqua {
BitMapPtr TkMacOSXMakeStippleMap(Drawable d1, Drawable d2)
}
-
declare 25 aqua {
- void TkMacOSXMenuClick (void)
+ void TkMacOSXMenuClick(void)
}
-
declare 26 aqua {
- void TkMacOSXRegisterOffScreenWindow (Window window, GWorldPtr portPtr)
+ void TkMacOSXRegisterOffScreenWindow(Window window, GWorldPtr portPtr)
}
-
declare 27 aqua {
- int TkMacOSXResizable (TkWindow *winPtr)
+ int TkMacOSXResizable(TkWindow *winPtr)
}
-
declare 28 aqua {
- void TkMacOSXSetHelpMenuItemCount (void)
+ void TkMacOSXSetHelpMenuItemCount(void)
}
-
declare 29 aqua {
- void TkMacOSXSetScrollbarGrow (TkWindow *winPtr, int flag)
+ void TkMacOSXSetScrollbarGrow(TkWindow *winPtr, int flag)
}
-
declare 30 aqua {
- void TkMacOSXSetUpClippingRgn (Drawable drawable)
+ void TkMacOSXSetUpClippingRgn(Drawable drawable)
}
-
declare 31 aqua {
- void TkMacOSXSetUpGraphicsPort (GC gc, GWorldPtr destPort)
+ void TkMacOSXSetUpGraphicsPort(GC gc, GWorldPtr destPort)
}
-
declare 32 aqua {
- void TkMacOSXUpdateClipRgn (TkWindow *winPtr)
+ void TkMacOSXUpdateClipRgn(TkWindow *winPtr)
}
-
declare 33 aqua {
- void TkMacOSXUnregisterMacWindow (WindowRef portPtr)
+ void TkMacOSXUnregisterMacWindow(WindowRef portPtr)
}
-
declare 34 aqua {
- int TkMacOSXUseMenuID (short macID)
+ int TkMacOSXUseMenuID(short macID)
}
-
declare 35 aqua {
- RgnHandle TkMacOSXVisableClipRgn (TkWindow *winPtr)
+ RgnHandle TkMacOSXVisableClipRgn(TkWindow *winPtr)
}
-
declare 36 aqua {
- void TkMacOSXWinBounds (TkWindow *winPtr, Rect *geometry)
+ void TkMacOSXWinBounds(TkWindow *winPtr, Rect *geometry)
}
-
declare 37 aqua {
- void TkMacOSXWindowOffset (WindowRef wRef, int *xOffset, int *yOffset)
+ void TkMacOSXWindowOffset(WindowRef wRef, int *xOffset, int *yOffset)
}
-
declare 38 aqua {
- int TkSetMacColor (unsigned long pixel, RGBColor *macColor)
+ int TkSetMacColor(unsigned long pixel, RGBColor *macColor)
}
-
declare 39 aqua {
- void TkSetWMName (TkWindow *winPtr, Tk_Uid titleUid)
+ void TkSetWMName(TkWindow *winPtr, Tk_Uid titleUid)
}
-
declare 40 aqua {
- void TkSuspendClipboard (void)
+ void TkSuspendClipboard(void)
}
-
declare 41 aqua {
- int TkMacOSXZoomToplevel (WindowPtr whichWindow, short zoomPart)
+ int TkMacOSXZoomToplevel(WindowPtr whichWindow, short zoomPart)
}
-
declare 42 aqua {
- Tk_Window Tk_TopCoordsToWindow (Tk_Window tkwin, \
- int rootX, int rootY, int *newX, int *newY)
+ Tk_Window Tk_TopCoordsToWindow(Tk_Window tkwin, int rootX, int rootY,
+ int *newX, int *newY)
}
-
declare 43 aqua {
- MacDrawable * TkMacOSXContainerId (TkWindow *winPtr)
+ MacDrawable *TkMacOSXContainerId(TkWindow *winPtr)
}
-
declare 44 aqua {
- MacDrawable * TkMacOSXGetHostToplevel (TkWindow *winPtr)
+ MacDrawable *TkMacOSXGetHostToplevel(TkWindow *winPtr)
}
-
declare 45 aqua {
- void TkMacOSXPreprocessMenu (void)
+ void TkMacOSXPreprocessMenu(void)
}
-
declare 46 aqua {
- int TkpIsWindowFloating (WindowRef window)
+ int TkpIsWindowFloating(WindowRef window)
}
-
declare 47 aqua {
- Tk_Window TkMacOSXGetCapture (void)
+ Tk_Window TkMacOSXGetCapture(void)
}
-
declare 49 aqua {
- Window TkGetTransientMaster (TkWindow *winPtr)
+ Window TkGetTransientMaster(TkWindow *winPtr)
}
-
declare 50 aqua {
- int TkGenerateButtonEvent (int x, int y, \
- Window window, unsigned int state)
+ int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state)
}
-
declare 51 aqua {
- void TkGenWMDestroyEvent (Tk_Window tkwin)
+ void TkGenWMDestroyEvent(Tk_Window tkwin)
}
# removed duplicate from tkPlat table (tk.decls)
#declare 52 aqua {
-# void TkGenWMConfigureEvent (Tk_Window tkwin, int x, int y, \
+# void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
# int width, int height, int flags)
#}
declare 53 aqua {
- unsigned long TkpGetMS (void)
+ unsigned long TkpGetMS(void)
}
##############################################################################
@@ -1378,899 +941,704 @@ declare 53 aqua {
interface tkIntXlib
+################################
# X functions for Windows
declare 0 win {
- void XSetDashes (Display* display, GC gc, int dash_offset,
- _Xconst char* dash_list, int n)
+ void XSetDashes(Display *display, GC gc, int dash_offset,
+ _Xconst char *dash_list, int n)
}
-
declare 1 win {
- XModifierKeymap* XGetModifierMapping (Display* d)
+ XModifierKeymap *XGetModifierMapping(Display *d)
}
-
declare 2 win {
- XImage * XCreateImage (Display* d, Visual* v, unsigned int ui1, int i1, \
- int i2, char* cp, unsigned int ui2, unsigned int ui3, int i3, \
+ XImage *XCreateImage(Display *d, Visual *v, unsigned int ui1, int i1,
+ int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3,
int i4)
-
}
-
declare 3 win {
- XImage *XGetImage (Display* d, Drawable dr, int i1, int i2, \
+ XImage *XGetImage(Display *d, Drawable dr, int i1, int i2,
unsigned int ui1, unsigned int ui2, unsigned long ul, int i3)
}
-
declare 4 win {
- char *XGetAtomName (Display* d,Atom a)
-
+ char *XGetAtomName(Display *d, Atom a)
}
-
declare 5 win {
- char *XKeysymToString (KeySym k)
+ char *XKeysymToString(KeySym k)
}
-
declare 6 win {
- Colormap XCreateColormap (Display* d, Window w, Visual* v, int i)
-
+ Colormap XCreateColormap(Display *d, Window w, Visual *v, int i)
}
-
declare 7 win {
- Cursor XCreatePixmapCursor (Display* d, Pixmap p1, Pixmap p2, \
- XColor* x1, XColor* x2, \
- unsigned int ui1, unsigned int ui2)
+ Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2,
+ XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2)
}
-
declare 8 win {
- Cursor XCreateGlyphCursor (Display* d, Font f1, Font f2, \
- unsigned int ui1, unsigned int ui2, XColor* x1, XColor* x2)
+ Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2,
+ unsigned int ui1, unsigned int ui2, XColor *x1, XColor *x2)
}
-
declare 9 win {
- GContext XGContextFromGC (GC g)
+ GContext XGContextFromGC(GC g)
}
-
declare 10 win {
- XHostAddress *XListHosts (Display* d, int* i, Bool* b)
+ XHostAddress *XListHosts(Display *d, int *i, Bool *b)
}
# second parameter was of type KeyCode
declare 11 win {
- KeySym XKeycodeToKeysym (Display* d, unsigned int k, int i)
+ KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i)
}
-
declare 12 win {
- KeySym XStringToKeysym (_Xconst char* c)
+ KeySym XStringToKeysym(_Xconst char *c)
}
-
declare 13 win {
- Window XRootWindow (Display* d, int i)
+ Window XRootWindow(Display *d, int i)
}
-
declare 14 win {
- XErrorHandler XSetErrorHandler (XErrorHandler x)
+ XErrorHandler XSetErrorHandler(XErrorHandler x)
}
-
declare 15 win {
- Status XIconifyWindow (Display* d, Window w, int i)
+ Status XIconifyWindow(Display *d, Window w, int i)
}
-
declare 16 win {
- Status XWithdrawWindow (Display* d, Window w, int i)
+ Status XWithdrawWindow(Display *d, Window w, int i)
}
-
declare 17 win {
- Status XGetWMColormapWindows (Display* d, Window w, Window** wpp, int* ip)
+ Status XGetWMColormapWindows(Display *d, Window w, Window **wpp, int *ip)
}
-
declare 18 win {
- Status XAllocColor (Display* d, Colormap c, XColor* xp)
+ Status XAllocColor(Display *d, Colormap c, XColor *xp)
}
-
declare 19 win {
- void XBell (Display* d, int i)
+ void XBell(Display *d, int i)
}
-
declare 20 win {
- void XChangeProperty (Display* d, Window w, Atom a1, Atom a2, int i1, \
- int i2, _Xconst unsigned char* c, int i3)
+ void XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1,
+ int i2, _Xconst unsigned char *c, int i3)
}
-
declare 21 win {
- void XChangeWindowAttributes (Display* d, Window w, unsigned long ul, \
- XSetWindowAttributes* x)
+ void XChangeWindowAttributes(Display *d, Window w, unsigned long ul,
+ XSetWindowAttributes *x)
}
-
declare 22 win {
- void XClearWindow (Display* d, Window w)
+ void XClearWindow(Display *d, Window w)
}
-
declare 23 win {
- void XConfigureWindow (Display* d, Window w, unsigned int i, \
- XWindowChanges* x)
+ void XConfigureWindow(Display *d, Window w, unsigned int i,
+ XWindowChanges *x)
}
-
declare 24 win {
- void XCopyArea (Display* d, Drawable dr1, Drawable dr2, GC g, int i1, \
- int i2, unsigned int ui1, \
- unsigned int ui2, int i3, int i4)
+ void XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-
declare 25 win {
- void XCopyPlane (Display* d, Drawable dr1, Drawable dr2, GC g, int i1, \
- int i2, unsigned int ui1, \
+ void XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1,
+ int i2, unsigned int ui1,
unsigned int ui2, int i3, int i4, unsigned long ul)
}
-
declare 26 win {
- Pixmap XCreateBitmapFromData(Display* display, Drawable d, \
- _Xconst char* data, unsigned int width,unsigned int height)
+ Pixmap XCreateBitmapFromData(Display *display, Drawable d,
+ _Xconst char *data, unsigned int width, unsigned int height)
}
-
declare 27 win {
- void XDefineCursor (Display* d, Window w, Cursor c)
+ void XDefineCursor(Display *d, Window w, Cursor c)
}
-
declare 28 win {
- void XDeleteProperty (Display* d, Window w, Atom a)
+ void XDeleteProperty(Display *d, Window w, Atom a)
}
-
declare 29 win {
- void XDestroyWindow (Display* d, Window w)
+ void XDestroyWindow(Display *d, Window w)
}
-
declare 30 win {
- void XDrawArc (Display* d, Drawable dr, GC g, int i1, int i2, \
+ void XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-
declare 31 win {
- void XDrawLines (Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2)
+ void XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)
}
-
declare 32 win {
- void XDrawRectangle (Display* d, Drawable dr, GC g, int i1, int i2,\
+ void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2)
}
-
declare 33 win {
- void XFillArc (Display* d, Drawable dr, GC g, int i1, int i2, \
+ void XFillArc(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-
declare 34 win {
- void XFillPolygon (Display* d, Drawable dr, GC g, XPoint* x, \
+ void XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x,
int i1, int i2, int i3)
}
-
declare 35 win {
- void XFillRectangles (Display* d, Drawable dr, GC g, XRectangle* x, int i)
+ void XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i)
}
-
declare 36 win {
- void XForceScreenSaver (Display* d, int i)
+ void XForceScreenSaver(Display *d, int i)
}
-
declare 37 win {
- void XFreeColormap (Display* d, Colormap c)
+ void XFreeColormap(Display *d, Colormap c)
}
-
declare 38 win {
- void XFreeColors (Display* d, Colormap c, \
- unsigned long* ulp, int i, unsigned long ul)
+ void XFreeColors(Display *d, Colormap c,
+ unsigned long *ulp, int i, unsigned long ul)
}
-
declare 39 win {
- void XFreeCursor (Display* d, Cursor c)
+ void XFreeCursor(Display *d, Cursor c)
}
-
declare 40 win {
- void XFreeModifiermap (XModifierKeymap* x)
+ void XFreeModifiermap(XModifierKeymap *x)
}
-
declare 41 win {
- Status XGetGeometry (Display* d, Drawable dr, Window* w, int* i1, \
- int* i2, unsigned int* ui1, unsigned int* ui2, unsigned int* ui3, \
- unsigned int* ui4)
+ Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1,
+ int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3,
+ unsigned int *ui4)
}
-
declare 42 win {
- void XGetInputFocus (Display* d, Window* w, int* i)
+ void XGetInputFocus(Display *d, Window *w, int *i)
}
-
declare 43 win {
- int XGetWindowProperty (Display* d, Window w, Atom a1, long l1, long l2, \
- Bool b, Atom a2, Atom* ap, int* ip, unsigned long* ulp1, \
- unsigned long* ulp2, unsigned char** cpp)
+ int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2,
+ Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1,
+ unsigned long *ulp2, unsigned char **cpp)
}
-
declare 44 win {
- Status XGetWindowAttributes (Display* d, Window w, XWindowAttributes* x)
+ Status XGetWindowAttributes(Display *d, Window w, XWindowAttributes *x)
}
-
declare 45 win {
- int XGrabKeyboard (Display* d, Window w, Bool b, int i1, int i2, Time t)
+ int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t)
}
-
declare 46 win {
- int XGrabPointer (Display* d, Window w1, Bool b, unsigned int ui, \
+ int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui,
int i1, int i2, Window w2, Cursor c, Time t)
}
-
declare 47 win {
- KeyCode XKeysymToKeycode (Display* d, KeySym k)
+ KeyCode XKeysymToKeycode(Display *d, KeySym k)
}
-
declare 48 win {
- Status XLookupColor (Display* d, Colormap c1, _Xconst char* c2, \
- XColor* x1, XColor* x2)
+ Status XLookupColor(Display *d, Colormap c1, _Xconst char *c2,
+ XColor *x1, XColor *x2)
}
-
declare 49 win {
- void XMapWindow (Display* d, Window w)
+ void XMapWindow(Display *d, Window w)
}
-
declare 50 win {
- void XMoveResizeWindow (Display* d, Window w, int i1, int i2, \
+ void XMoveResizeWindow(Display *d, Window w, int i1, int i2,
unsigned int ui1, unsigned int ui2)
}
-
declare 51 win {
- void XMoveWindow (Display* d, Window w, int i1, int i2)
+ void XMoveWindow(Display *d, Window w, int i1, int i2)
}
-
declare 52 win {
- void XNextEvent (Display* d, XEvent* x)
+ void XNextEvent(Display *d, XEvent *x)
}
-
declare 53 win {
- void XPutBackEvent (Display* d, XEvent* x)
+ void XPutBackEvent(Display *d, XEvent *x)
}
-
declare 54 win {
- void XQueryColors (Display* d, Colormap c, XColor* x, int i)
+ void XQueryColors(Display *d, Colormap c, XColor *x, int i)
}
-
declare 55 win {
- Bool XQueryPointer (Display* d, Window w1, Window* w2, Window* w3, \
- int* i1, int* i2, int* i3, int* i4, unsigned int* ui)
+ Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3,
+ int *i1, int *i2, int *i3, int *i4, unsigned int *ui)
}
-
declare 56 win {
- Status XQueryTree (Display* d, Window w1, Window* w2, Window* w3, \
- Window** w4, unsigned int* ui)
+ Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3,
+ Window **w4, unsigned int *ui)
}
-
declare 57 win {
- void XRaiseWindow (Display* d, Window w)
+ void XRaiseWindow(Display *d, Window w)
}
-
declare 58 win {
- void XRefreshKeyboardMapping (XMappingEvent* x)
+ void XRefreshKeyboardMapping(XMappingEvent *x)
}
-
declare 59 win {
- void XResizeWindow (Display* d, Window w, unsigned int ui1, \
+ void XResizeWindow(Display *d, Window w, unsigned int ui1,
unsigned int ui2)
}
-
declare 60 win {
- void XSelectInput (Display* d, Window w, long l)
+ void XSelectInput(Display *d, Window w, long l)
}
-
declare 61 win {
- Status XSendEvent (Display* d, Window w, Bool b, long l, XEvent* x)
+ Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x)
}
-
declare 62 win {
- void XSetCommand (Display* d, Window w, CONST char** c, int i)
+ void XSetCommand(Display *d, Window w, CONST char **c, int i)
}
-
declare 63 win {
- void XSetIconName (Display* d, Window w, _Xconst char* c)
+ void XSetIconName(Display *d, Window w, _Xconst char *c)
}
-
declare 64 win {
- void XSetInputFocus (Display* d, Window w, int i, Time t)
+ void XSetInputFocus(Display *d, Window w, int i, Time t)
}
-
declare 65 win {
- void XSetSelectionOwner (Display* d, Atom a, Window w, Time t)
+ void XSetSelectionOwner(Display *d, Atom a, Window w, Time t)
}
-
declare 66 win {
- void XSetWindowBackground (Display* d, Window w, unsigned long ul)
+ void XSetWindowBackground(Display *d, Window w, unsigned long ul)
}
-
declare 67 win {
- void XSetWindowBackgroundPixmap (Display* d, Window w, Pixmap p)
+ void XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p)
}
-
declare 68 win {
- void XSetWindowBorder (Display* d, Window w, unsigned long ul)
+ void XSetWindowBorder(Display *d, Window w, unsigned long ul)
}
-
declare 69 win {
- void XSetWindowBorderPixmap (Display* d, Window w, Pixmap p)
+ void XSetWindowBorderPixmap(Display *d, Window w, Pixmap p)
}
-
declare 70 win {
- void XSetWindowBorderWidth (Display* d, Window w, unsigned int ui)
+ void XSetWindowBorderWidth(Display *d, Window w, unsigned int ui)
}
-
declare 71 win {
- void XSetWindowColormap (Display* d, Window w, Colormap c)
+ void XSetWindowColormap(Display *d, Window w, Colormap c)
}
-
declare 72 win {
- Bool XTranslateCoordinates (Display* d, Window w1, Window w2, int i1,\
- int i2, int* i3, int* i4, Window* w3)
+ Bool XTranslateCoordinates(Display *d, Window w1, Window w2, int i1,
+ int i2, int *i3, int *i4, Window *w3)
}
-
declare 73 win {
- void XUngrabKeyboard (Display* d, Time t)
+ void XUngrabKeyboard(Display *d, Time t)
}
-
declare 74 win {
- void XUngrabPointer (Display* d, Time t)
+ void XUngrabPointer(Display *d, Time t)
}
-
declare 75 win {
- void XUnmapWindow (Display* d, Window w)
+ void XUnmapWindow(Display *d, Window w)
}
-
declare 76 win {
- void XWindowEvent (Display* d, Window w, long l, XEvent* x)
+ void XWindowEvent(Display *d, Window w, long l, XEvent *x)
}
-
declare 77 win {
- void XDestroyIC (XIC x)
+ void XDestroyIC(XIC x)
}
-
declare 78 win {
- Bool XFilterEvent (XEvent* x, Window w)
+ Bool XFilterEvent(XEvent *x, Window w)
}
-
declare 79 win {
- int XmbLookupString (XIC xi, XKeyPressedEvent* xk, \
- char* c, int i, KeySym* k, Status* s)
+ int XmbLookupString(XIC xi, XKeyPressedEvent *xk, char *c, int i,
+ KeySym *k, Status *s)
}
-
declare 80 win {
- void TkPutImage (unsigned long *colors, \
- int ncolors, Display* display, Drawable d, \
- GC gc, XImage* image, int src_x, int src_y, \
- int dest_x, int dest_y, unsigned int width, \
- unsigned int height)
+ void TkPutImage(unsigned long *colors, int ncolors, Display *display,
+ Drawable d, GC gc, XImage *image, int src_x, int src_y,
+ int dest_x, int dest_y, unsigned int width, unsigned int height)
}
# This slot is reserved for use by the clipping rectangle patch:
# declare 81 win {
-# XSetClipRectangles(Display *display, GC gc, int clip_x_origin, \
+# XSetClipRectangles(Display *display, GC gc, int clip_x_origin,
# int clip_y_origin, XRectangle rectangles[], int n, int ordering)
# }
declare 82 win {
- Status XParseColor (Display *display, Colormap map, \
- _Xconst char* spec, XColor *colorPtr)
+ Status XParseColor(Display *display, Colormap map,
+ _Xconst char *spec, XColor *colorPtr)
}
-
declare 83 win {
- GC XCreateGC(Display* display, Drawable d, \
- unsigned long valuemask, XGCValues* values)
+ GC XCreateGC(Display *display, Drawable d,
+ unsigned long valuemask, XGCValues *values)
}
-
declare 84 win {
- void XFreeGC(Display* display, GC gc)
+ void XFreeGC(Display *display, GC gc)
}
-
declare 85 win {
- Atom XInternAtom(Display* display,_Xconst char* atom_name, \
+ Atom XInternAtom(Display *display, _Xconst char *atom_name,
Bool only_if_exists)
}
-
declare 86 win {
- void XSetBackground(Display* display, GC gc, \
- unsigned long foreground)
+ void XSetBackground(Display *display, GC gc, unsigned long foreground)
}
-
declare 87 win {
- void XSetForeground(Display* display, GC gc, \
- unsigned long foreground)
+ void XSetForeground(Display *display, GC gc, unsigned long foreground)
}
-
declare 88 win {
- void XSetClipMask(Display* display, GC gc, Pixmap pixmap)
+ void XSetClipMask(Display *display, GC gc, Pixmap pixmap)
}
-
declare 89 win {
- void XSetClipOrigin(Display* display, GC gc, \
+ void XSetClipOrigin(Display *display, GC gc,
int clip_x_origin, int clip_y_origin)
}
-
declare 90 win {
- void XSetTSOrigin(Display* display, GC gc, \
+ void XSetTSOrigin(Display *display, GC gc,
int ts_x_origin, int ts_y_origin)
}
-
declare 91 win {
- void XChangeGC(Display * d, GC gc, unsigned long mask, XGCValues *values)
+ void XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values)
}
-
declare 92 win {
void XSetFont(Display *display, GC gc, Font font)
}
-
declare 93 win {
void XSetArcMode(Display *display, GC gc, int arc_mode)
}
-
declare 94 win {
void XSetStipple(Display *display, GC gc, Pixmap stipple)
}
-
declare 95 win {
void XSetFillRule(Display *display, GC gc, int fill_rule)
}
-
declare 96 win {
void XSetFillStyle(Display *display, GC gc, int fill_style)
}
-
declare 97 win {
void XSetFunction(Display *display, GC gc, int function)
}
-
declare 98 win {
- void XSetLineAttributes(Display *display, GC gc, \
- unsigned int line_width, int line_style, \
- int cap_style, int join_style)
+ void XSetLineAttributes(Display *display, GC gc, unsigned int line_width,
+ int line_style, int cap_style, int join_style)
}
-
declare 99 win {
int _XInitImageFuncPtrs(XImage *image)
}
-
declare 100 win {
XIC XCreateIC(void)
}
-
declare 101 win {
- XVisualInfo *XGetVisualInfo(Display* display, long vinfo_mask, \
- XVisualInfo* vinfo_template, int* nitems_return)
+ XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask,
+ XVisualInfo *vinfo_template, int *nitems_return)
}
-
declare 102 win {
- void XSetWMClientMachine(Display* display, Window w, XTextProperty* text_prop)
+ void XSetWMClientMachine(Display *display, Window w,
+ XTextProperty *text_prop)
}
-
declare 103 win {
- Status XStringListToTextProperty(char** list, int count, \
- XTextProperty* text_prop_return)
+ Status XStringListToTextProperty(char **list, int count,
+ XTextProperty *text_prop_return)
}
declare 104 win {
- void XDrawLine (Display* d, Drawable dr, GC g, int x1, int y1, \
+ void XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1,
int x2, int y2)
}
declare 106 win {
- void XFillRectangle (Display* display, Drawable d, GC gc, \
+ void XFillRectangle(Display *display, Drawable d, GC gc,
int x, int y, unsigned int width, unsigned int height)
}
declare 105 win {
- void XWarpPointer (Display* d, Window s, Window dw, int sx, int sy, \
+ void XWarpPointer(Display *d, Window s, Window dw, int sx, int sy,
unsigned int sw, unsigned int sh, int dx, int dy)
}
-# X functions for Mac and Aqua
+################################
+# X functions for Aqua
-declare 0 {mac aqua} {
- void XSetDashes (Display* display, GC gc, int dash_offset,
- _Xconst char* dash_list, int n)
+declare 0 aqua {
+ void XSetDashes(Display *display, GC gc, int dash_offset,
+ _Xconst char *dash_list, int n)
}
-
-declare 1 {mac aqua} {
- XModifierKeymap* XGetModifierMapping (Display* d)
+declare 1 aqua {
+ XModifierKeymap *XGetModifierMapping(Display *d)
}
-
-declare 2 {mac aqua} {
- XImage * XCreateImage (Display* d, Visual* v, unsigned int ui1, int i1, \
- int i2, char* cp, unsigned int ui2, unsigned int ui3, int i3, \
+declare 2 aqua {
+ XImage *XCreateImage(Display *d, Visual *v, unsigned int ui1, int i1,
+ int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3,
int i4)
-
}
-
-declare 3 {mac aqua} {
- XImage *XGetImage (Display* d, Drawable dr, int i1, int i2, \
+declare 3 aqua {
+ XImage *XGetImage(Display *d, Drawable dr, int i1, int i2,
unsigned int ui1, unsigned int ui2, unsigned long ul, int i3)
}
-
-declare 4 {mac aqua} {
- char *XGetAtomName (Display* d,Atom a)
-
+declare 4 aqua {
+ char *XGetAtomName(Display *d, Atom a)
}
-
-declare 5 {mac aqua} {
- char *XKeysymToString (KeySym k)
+declare 5 aqua {
+ char *XKeysymToString(KeySym k)
}
-
-declare 6 {mac aqua} {
- Colormap XCreateColormap (Display* d, Window w, Visual* v, int i)
-
+declare 6 aqua {
+ Colormap XCreateColormap(Display *d, Window w, Visual *v, int i)
}
-
-declare 7 {mac aqua} {
- GContext XGContextFromGC (GC g)
+declare 7 aqua {
+ GContext XGContextFromGC(GC g)
}
-
-declare 8 {mac aqua} {
- KeySym XKeycodeToKeysym (Display* d, KeyCode k, int i)
+declare 8 aqua {
+ KeySym XKeycodeToKeysym(Display *d, KeyCode k, int i)
}
-
-declare 9 {mac aqua} {
- KeySym XStringToKeysym (_Xconst char* c)
+declare 9 aqua {
+ KeySym XStringToKeysym(_Xconst char *c)
}
-
-declare 10 {mac aqua} {
- Window XRootWindow (Display* d, int i)
+declare 10 aqua {
+ Window XRootWindow(Display *d, int i)
}
-
-declare 11 {mac aqua} {
- XErrorHandler XSetErrorHandler (XErrorHandler x)
+declare 11 aqua {
+ XErrorHandler XSetErrorHandler(XErrorHandler x)
}
-
-declare 12 {mac aqua} {
- Status XAllocColor (Display* d, Colormap c, XColor* xp)
+declare 12 aqua {
+ Status XAllocColor(Display *d, Colormap c, XColor *xp)
}
-
-declare 13 {mac aqua} {
- void XBell (Display* d, int i)
+declare 13 aqua {
+ void XBell(Display *d, int i)
}
-
-declare 14 {mac aqua} {
- void XChangeProperty (Display* d, Window w, Atom a1, Atom a2, int i1, \
- int i2, _Xconst unsigned char* c, int i3)
+declare 14 aqua {
+ void XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1,
+ int i2, _Xconst unsigned char *c, int i3)
}
-
-declare 15 {mac aqua} {
- void XChangeWindowAttributes (Display* d, Window w, unsigned long ul, \
- XSetWindowAttributes* x)
+declare 15 aqua {
+ void XChangeWindowAttributes(Display *d, Window w, unsigned long ul,
+ XSetWindowAttributes *x)
}
-
-declare 16 {mac aqua} {
- void XConfigureWindow (Display* d, Window w, unsigned int i, \
- XWindowChanges* x)
+declare 16 aqua {
+ void XConfigureWindow(Display *d, Window w, unsigned int i,
+ XWindowChanges *x)
}
-
-declare 17 {mac aqua} {
- void XCopyArea (Display* d, Drawable dr1, Drawable dr2, GC g, int i1, \
- int i2, unsigned int ui1, \
- unsigned int ui2, int i3, int i4)
+declare 17 aqua {
+ void XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-
-declare 18 {mac aqua} {
- void XCopyPlane (Display* d, Drawable dr1, Drawable dr2, GC g, int i1, \
- int i2, unsigned int ui1, \
+declare 18 aqua {
+ void XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1,
+ int i2, unsigned int ui1,
unsigned int ui2, int i3, int i4, unsigned long ul)
}
-
-declare 19 {mac aqua} {
- Pixmap XCreateBitmapFromData(Display* display, Drawable d, \
- _Xconst char* data, unsigned int width,unsigned int height)
+declare 19 aqua {
+ Pixmap XCreateBitmapFromData(Display *display, Drawable d,
+ _Xconst char *data, unsigned int width, unsigned int height)
}
-
-declare 20 {mac aqua} {
- void XDefineCursor (Display* d, Window w, Cursor c)
+declare 20 aqua {
+ void XDefineCursor(Display *d, Window w, Cursor c)
}
-
-declare 21 {mac aqua} {
- void XDestroyWindow (Display* d, Window w)
+declare 21 aqua {
+ void XDestroyWindow(Display *d, Window w)
}
-
-declare 22 {mac aqua} {
- void XDrawArc (Display* d, Drawable dr, GC g, int i1, int i2, \
+declare 22 aqua {
+ void XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-
-declare 23 {mac aqua} {
- void XDrawLines (Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2)
+declare 23 aqua {
+ void XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)
}
-
-declare 24 {mac aqua} {
- void XDrawRectangle (Display* d, Drawable dr, GC g, int i1, int i2,\
+declare 24 aqua {
+ void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2)
}
-
-declare 25 {mac aqua} {
- void XFillArc (Display* d, Drawable dr, GC g, int i1, int i2, \
+declare 25 aqua {
+ void XFillArc(Display *d, Drawable dr, GC g, int i1, int i2,
unsigned int ui1, unsigned int ui2, int i3, int i4)
}
-
-declare 26 {mac aqua} {
- void XFillPolygon (Display* d, Drawable dr, GC g, XPoint* x, \
+declare 26 aqua {
+ void XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x,
int i1, int i2, int i3)
}
-
-declare 27 {mac aqua} {
- void XFillRectangles (Display* d, Drawable dr, GC g, XRectangle* x, int i)
+declare 27 aqua {
+ void XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i)
}
-
-declare 28 {mac aqua} {
- void XFreeColormap (Display* d, Colormap c)
+declare 28 aqua {
+ void XFreeColormap(Display *d, Colormap c)
}
-
-declare 29 {mac aqua} {
- void XFreeColors (Display* d, Colormap c, \
- unsigned long* ulp, int i, unsigned long ul)
+declare 29 aqua {
+ void XFreeColors(Display *d, Colormap c,
+ unsigned long *ulp, int i, unsigned long ul)
}
-
-declare 30 {mac aqua} {
- void XFreeModifiermap (XModifierKeymap* x)
+declare 30 aqua {
+ void XFreeModifiermap(XModifierKeymap *x)
}
-
-declare 31 {mac aqua} {
- Status XGetGeometry (Display* d, Drawable dr, Window* w, int* i1, \
- int* i2, unsigned int* ui1, unsigned int* ui2, unsigned int* ui3, \
- unsigned int* ui4)
+declare 31 aqua {
+ Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1,
+ int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3,
+ unsigned int *ui4)
}
-
-declare 32 {mac aqua} {
- int XGetWindowProperty (Display* d, Window w, Atom a1, long l1, long l2, \
- Bool b, Atom a2, Atom* ap, int* ip, unsigned long* ulp1, \
- unsigned long* ulp2, unsigned char** cpp)
+declare 32 aqua {
+ int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2,
+ Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1,
+ unsigned long *ulp2, unsigned char **cpp)
}
-
-declare 33 {mac aqua} {
- int XGrabKeyboard (Display* d, Window w, Bool b, int i1, int i2, Time t)
+declare 33 aqua {
+ int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t)
}
-
-declare 34 {mac aqua} {
- int XGrabPointer (Display* d, Window w1, Bool b, unsigned int ui, \
+declare 34 aqua {
+ int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui,
int i1, int i2, Window w2, Cursor c, Time t)
}
-
-declare 35 {mac aqua} {
- KeyCode XKeysymToKeycode (Display* d, KeySym k)
+declare 35 aqua {
+ KeyCode XKeysymToKeycode(Display *d, KeySym k)
}
-
-declare 36 {mac aqua} {
- void XMapWindow (Display* d, Window w)
+declare 36 aqua {
+ void XMapWindow(Display *d, Window w)
}
-
-declare 37 {mac aqua} {
- void XMoveResizeWindow (Display* d, Window w, int i1, int i2, \
+declare 37 aqua {
+ void XMoveResizeWindow(Display *d, Window w, int i1, int i2,
unsigned int ui1, unsigned int ui2)
}
-
-declare 38 {mac aqua} {
- void XMoveWindow (Display* d, Window w, int i1, int i2)
+declare 38 aqua {
+ void XMoveWindow(Display *d, Window w, int i1, int i2)
}
-
-declare 39 {mac aqua} {
- Bool XQueryPointer (Display* d, Window w1, Window* w2, Window* w3, \
- int* i1, int* i2, int* i3, int* i4, unsigned int* ui)
+declare 39 aqua {
+ Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3,
+ int *i1, int *i2, int *i3, int *i4, unsigned int *ui)
}
-
-declare 40 {mac aqua} {
- void XRaiseWindow (Display* d, Window w)
+declare 40 aqua {
+ void XRaiseWindow(Display *d, Window w)
}
-
-declare 41 {mac aqua} {
- void XRefreshKeyboardMapping (XMappingEvent* x)
+declare 41 aqua {
+ void XRefreshKeyboardMapping(XMappingEvent *x)
}
-
-declare 42 {mac aqua} {
- void XResizeWindow (Display* d, Window w, unsigned int ui1, \
+declare 42 aqua {
+ void XResizeWindow(Display *d, Window w, unsigned int ui1,
unsigned int ui2)
}
-
-declare 43 {mac aqua} {
- void XSelectInput (Display* d, Window w, long l)
+declare 43 aqua {
+ void XSelectInput(Display *d, Window w, long l)
}
-
-declare 44 {mac aqua} {
- Status XSendEvent (Display* d, Window w, Bool b, long l, XEvent* x)
+declare 44 aqua {
+ Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x)
}
-
-declare 45 {mac aqua} {
- void XSetIconName (Display* d, Window w, _Xconst char* c)
+declare 45 aqua {
+ void XSetIconName(Display *d, Window w, _Xconst char *c)
}
-
-declare 46 {mac aqua} {
- void XSetInputFocus (Display* d, Window w, int i, Time t)
+declare 46 aqua {
+ void XSetInputFocus(Display *d, Window w, int i, Time t)
}
-
-declare 47 {mac aqua} {
- void XSetSelectionOwner (Display* d, Atom a, Window w, Time t)
+declare 47 aqua {
+ void XSetSelectionOwner(Display *d, Atom a, Window w, Time t)
}
-
-declare 48 {mac aqua} {
- void XSetWindowBackground (Display* d, Window w, unsigned long ul)
+declare 48 aqua {
+ void XSetWindowBackground(Display *d, Window w, unsigned long ul)
}
-
-declare 49 {mac aqua} {
- void XSetWindowBackgroundPixmap (Display* d, Window w, Pixmap p)
+declare 49 aqua {
+ void XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p)
}
-
-declare 50 {mac aqua} {
- void XSetWindowBorder (Display* d, Window w, unsigned long ul)
+declare 50 aqua {
+ void XSetWindowBorder(Display *d, Window w, unsigned long ul)
}
-
-declare 51 {mac aqua} {
- void XSetWindowBorderPixmap (Display* d, Window w, Pixmap p)
+declare 51 aqua {
+ void XSetWindowBorderPixmap(Display *d, Window w, Pixmap p)
}
-
-declare 52 {mac aqua} {
- void XSetWindowBorderWidth (Display* d, Window w, unsigned int ui)
+declare 52 aqua {
+ void XSetWindowBorderWidth(Display *d, Window w, unsigned int ui)
}
-
-declare 53 {mac aqua} {
- void XSetWindowColormap (Display* d, Window w, Colormap c)
+declare 53 aqua {
+ void XSetWindowColormap(Display *d, Window w, Colormap c)
}
-
-declare 54 {mac aqua} {
- void XUngrabKeyboard (Display* d, Time t)
+declare 54 aqua {
+ void XUngrabKeyboard(Display *d, Time t)
}
-
-declare 55 {mac aqua} {
- void XUngrabPointer (Display* d, Time t)
+declare 55 aqua {
+ void XUngrabPointer(Display *d, Time t)
}
-
-declare 56 {mac aqua} {
- void XUnmapWindow (Display* d, Window w)
+declare 56 aqua {
+ void XUnmapWindow(Display *d, Window w)
}
-
-declare 57 {mac aqua} {
- void TkPutImage (unsigned long *colors, \
- int ncolors, Display* display, Drawable d, \
- GC gc, XImage* image, int src_x, int src_y, \
- int dest_x, int dest_y, unsigned int width, \
- unsigned int height)
-}
-declare 58 {mac aqua} {
- Status XParseColor (Display *display, Colormap map, \
- _Xconst char* spec, XColor *colorPtr)
+declare 57 aqua {
+ void TkPutImage(unsigned long *colors, int ncolors, Display *display,
+ Drawable d, GC gc, XImage *image, int src_x, int src_y,
+ int dest_x, int dest_y, unsigned int width, unsigned int height)
}
-
-declare 59 {mac aqua} {
- GC XCreateGC(Display* display, Drawable d, \
- unsigned long valuemask, XGCValues* values)
+declare 58 aqua {
+ Status XParseColor(Display *display, Colormap map,
+ _Xconst char *spec, XColor *colorPtr)
}
-
-declare 60 {mac aqua} {
- void XFreeGC(Display* display, GC gc)
+declare 59 aqua {
+ GC XCreateGC(Display *display, Drawable d,
+ unsigned long valuemask, XGCValues *values)
}
-
-declare 61 {mac aqua} {
- Atom XInternAtom(Display* display,_Xconst char* atom_name, \
+declare 60 aqua {
+ void XFreeGC(Display *display, GC gc)
+}
+declare 61 aqua {
+ Atom XInternAtom(Display *display, _Xconst char *atom_name,
Bool only_if_exists)
}
-
-declare 62 {mac aqua} {
- void XSetBackground(Display* display, GC gc, \
- unsigned long foreground)
+declare 62 aqua {
+ void XSetBackground(Display *display, GC gc, unsigned long foreground)
}
-
-declare 63 {mac aqua} {
- void XSetForeground(Display* display, GC gc, \
- unsigned long foreground)
+declare 63 aqua {
+ void XSetForeground(Display *display, GC gc, unsigned long foreground)
}
-
-declare 64 {mac aqua} {
- void XSetClipMask(Display* display, GC gc, Pixmap pixmap)
+declare 64 aqua {
+ void XSetClipMask(Display *display, GC gc, Pixmap pixmap)
}
-
-declare 65 {mac aqua} {
- void XSetClipOrigin(Display* display, GC gc, \
+declare 65 aqua {
+ void XSetClipOrigin(Display *display, GC gc,
int clip_x_origin, int clip_y_origin)
}
-
-declare 66 {mac aqua} {
- void XSetTSOrigin(Display* display, GC gc, \
+declare 66 aqua {
+ void XSetTSOrigin(Display *display, GC gc,
int ts_x_origin, int ts_y_origin)
}
-
-declare 67 {mac aqua} {
- void XChangeGC(Display * d, GC gc, unsigned long mask, XGCValues *values)
+declare 67 aqua {
+ void XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values)
}
-
-declare 68 {mac aqua} {
+declare 68 aqua {
void XSetFont(Display *display, GC gc, Font font)
}
-
-declare 69 {mac aqua} {
+declare 69 aqua {
void XSetArcMode(Display *display, GC gc, int arc_mode)
}
-
-declare 70 {mac aqua} {
+declare 70 aqua {
void XSetStipple(Display *display, GC gc, Pixmap stipple)
}
-
-declare 71 {mac aqua} {
+declare 71 aqua {
void XSetFillRule(Display *display, GC gc, int fill_rule)
}
-
-declare 72 {mac aqua} {
+declare 72 aqua {
void XSetFillStyle(Display *display, GC gc, int fill_style)
}
-
-declare 73 {mac aqua} {
+declare 73 aqua {
void XSetFunction(Display *display, GC gc, int function)
}
-
-declare 74 {mac aqua} {
- void XSetLineAttributes(Display *display, GC gc, \
- unsigned int line_width, int line_style, \
+declare 74 aqua {
+ void XSetLineAttributes(Display *display, GC gc,
+ unsigned int line_width, int line_style,
int cap_style, int join_style)
}
-
-declare 75 {mac aqua} {
+declare 75 aqua {
int _XInitImageFuncPtrs(XImage *image)
}
-
-declare 76 {mac aqua} {
+declare 76 aqua {
XIC XCreateIC(void)
}
-
-declare 77 {mac aqua} {
- XVisualInfo *XGetVisualInfo(Display* display, long vinfo_mask, \
- XVisualInfo* vinfo_template, int* nitems_return)
+declare 77 aqua {
+ XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask,
+ XVisualInfo *vinfo_template, int *nitems_return)
}
-
-declare 78 {mac aqua} {
- void XSetWMClientMachine(Display* display, Window w, \
- XTextProperty* text_prop)
+declare 78 aqua {
+ void XSetWMClientMachine(Display *display, Window w,
+ XTextProperty *text_prop)
}
-
-declare 79 {mac aqua} {
- Status XStringListToTextProperty(char** list, int count, \
- XTextProperty* text_prop_return)
+declare 79 aqua {
+ Status XStringListToTextProperty(char **list, int count,
+ XTextProperty *text_prop_return)
}
-declare 80 {mac aqua} {
- void XDrawSegments(Display *display, Drawable d, GC gc, \
- XSegment *segments, int nsegments)
+declare 80 aqua {
+ void XDrawSegments(Display *display, Drawable d, GC gc,
+ XSegment *segments, int nsegments)
}
-declare 81 {mac aqua} {
- void XForceScreenSaver(Display* display, int mode)
+declare 81 aqua {
+ void XForceScreenSaver(Display *display, int mode)
}
-declare 82 {mac aqua} {
- void XDrawLine (Display* d, Drawable dr, GC g, int x1, int y1, \
+declare 82 aqua {
+ void XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1,
int x2, int y2)
}
-declare 83 {mac aqua} {
- void XFillRectangle (Display* display, Drawable d, GC gc, \
+declare 83 aqua {
+ void XFillRectangle(Display *display, Drawable d, GC gc,
int x, int y, unsigned int width, unsigned int height)
}
-declare 84 {mac aqua} {
- void XClearWindow (Display* d, Window w)
+declare 84 aqua {
+ void XClearWindow(Display *d, Window w)
}
-
-declare 85 {mac aqua} {
- void XDrawPoint (Display* display, Drawable d, GC gc, int x, int y)
+declare 85 aqua {
+ void XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
}
-
-declare 86 {mac aqua} {
- void XDrawPoints (Display* display, Drawable d, GC gc, XPoint *points, \
+declare 86 aqua {
+ void XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
int npoints, int mode)
}
-
-declare 87 {mac aqua} {
- void XWarpPointer (Display* display, Window src_w, Window dest_w, \
- int src_x, int src_y, unsigned int src_width, \
+declare 87 aqua {
+ void XWarpPointer(Display *display, Window src_w, Window dest_w,
+ int src_x, int src_y, unsigned int src_width,
unsigned int src_height, int dest_x, int dest_y)
}
-
-declare 88 {mac aqua} {
- void XQueryColor (Display *display, Colormap colormap, XColor *def_in_out)
+declare 88 aqua {
+ void XQueryColor(Display *display, Colormap colormap, XColor *def_in_out)
}
-
-declare 89 {mac aqua} {
- void XQueryColors (Display *display, Colormap colormap, \
+declare 89 aqua {
+ void XQueryColors(Display *display, Colormap colormap,
XColor *defs_in_out, int ncolors)
}
-
-declare 90 {mac aqua} {
- Status XQueryTree (Display* d, Window w1, Window* w2, Window* w3, \
- Window** w4, unsigned int* ui)
+declare 90 aqua {
+ Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3,
+ Window **w4, unsigned int *ui)
}
-declare 91 {aqua} {
+declare 91 aqua {
int XSync(Display *display, Bool flag)
}
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 777201e..bd40a88 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1,15 +1,15 @@
/*
* tkInt.h --
*
- * Declarations for things used internally by the Tk
- * procedures but not exported outside the module.
+ * Declarations for things used internally by the Tk functions but not
+ * exported outside the module.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKINT
@@ -41,7 +41,7 @@
# ifdef BIG_ENDIAN
# if BYTE_ORDER == BIG_ENDIAN
# undef WORDS_BIGENDIAN
-# define WORDS_BIGENDIAN
+# define WORDS_BIGENDIAN 1
# endif
# endif
# ifdef LITTLE_ENDIAN
@@ -65,10 +65,36 @@
#endif
/*
+ * Macros used to cast between pointers and integers (e.g. when storing an int
+ * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
+ * to/from pointer from/to integer of different size".
+ */
+
+#if !defined(INT2PTR) && !defined(PTR2INT)
+# if defined(HAVE_INTPTR_T) || defined(intptr_t)
+# define INT2PTR(p) ((void*)(intptr_t)(p))
+# define PTR2INT(p) ((int)(intptr_t)(p))
+# else
+# define INT2PTR(p) ((void*)(p))
+# define PTR2INT(p) ((int)(p))
+# endif
+#endif
+#if !defined(UINT2PTR) && !defined(PTR2UINT)
+# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
+# define UINT2PTR(p) ((void*)(uintptr_t)(p))
+# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
+# else
+# define UINT2PTR(p) ((void*)(p))
+# define PTR2UINT(p) ((unsigned int)(p))
+# endif
+#endif
+
+/*
* Opaque type declarations:
*/
typedef struct TkColormap TkColormap;
+typedef struct TkFontAttributes TkFontAttributes;
typedef struct TkGrabEvent TkGrabEvent;
typedef struct TkpCursor_ *TkpCursor;
typedef struct TkRegion_ *TkRegion;
@@ -76,18 +102,17 @@ typedef struct TkStressedCmap TkStressedCmap;
typedef struct TkBindInfo_ *TkBindInfo;
/*
- * Procedure types.
+ * Function types.
*/
-typedef int (TkBindEvalProc) _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, XEvent *eventPtr, Tk_Window tkwin,
- KeySym keySym));
-typedef void (TkBindFreeProc) _ANSI_ARGS_((ClientData clientData));
+typedef int (TkBindEvalProc)(ClientData clientData, Tcl_Interp *interp,
+ XEvent *eventPtr, Tk_Window tkwin, KeySym keySym);
+typedef void (TkBindFreeProc)(ClientData clientData);
/*
- * One of the following structures is maintained for each cursor in
- * use in the system. This structure is used by tkCursor.c and the
- * various system specific cursor files.
+ * One of the following structures is maintained for each cursor in use in the
+ * system. This structure is used by tkCursor.c and the various system
+ * specific cursor files.
*/
typedef struct TkCursor {
@@ -96,65 +121,53 @@ typedef struct TkCursor {
* disposal and retrieval of cursors. */
int resourceRefCount; /* Number of active uses of this cursor (each
* active use corresponds to a call to
- * Tk_AllocPreserveFromObj or Tk_Preserve).
- * If this count is 0, then this structure
- * is no longer valid and it isn't present
- * in a hash table: it is being kept around
- * only because there are objects referring
- * to it. The structure is freed when
- * resourceRefCount and objRefCount are
- * both 0. */
- int objRefCount; /* Number of Tcl objects that reference
- * this structure.. */
- Tcl_HashTable *otherTable; /* Second table (other than idTable) used
- * to index this entry. */
+ * Tk_AllocPreserveFromObj or Tk_Preserve). If
+ * this count is 0, then this structure is no
+ * longer valid and it isn't present in a hash
+ * table: it is being kept around only because
+ * there are objects referring to it. The
+ * structure is freed when resourceRefCount
+ * and objRefCount are both 0. */
+ int objRefCount; /* Number of Tcl objects that reference this
+ * structure.. */
+ Tcl_HashTable *otherTable; /* Second table (other than idTable) used to
+ * index this entry. */
Tcl_HashEntry *hashPtr; /* Entry in otherTable for this structure
* (needed when deleting). */
- Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure
- * (needed when deleting). */
+ Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure (needed
+ * when deleting). */
struct TkCursor *nextPtr; /* Points to the next TkCursor structure with
- * the same name. Cursors with the same
- * name but different displays are chained
- * together off a single hash table entry. */
+ * the same name. Cursors with the same name
+ * but different displays are chained together
+ * off a single hash table entry. */
} TkCursor;
/*
- * This defines whether we should try to use XIM over-the-spot style
- * input. Allow users to override it. It is a much more elegant use
- * of XIM, but uses a bit more memory.
- */
-
-#ifndef TK_XIM_SPOT
-# define TK_XIM_SPOT 1
-#endif
-
-/*
* The following structure is kept one-per-TkDisplay to maintain information
- * about the caret (cursor location) on this display. This is used to
- * dictate global focus location (Windows Accessibility guidelines) and to
- * position the IME or XIM over-the-spot window.
+ * about the caret (cursor location) on this display. This is used to dictate
+ * global focus location (Windows Accessibility guidelines) and to position
+ * the IME or XIM over-the-spot window.
*/
typedef struct TkCaret {
- struct TkWindow *winPtr; /* the window on which we requested caret
- * placement */
- int x; /* relative x coord of the caret */
- int y; /* relative y coord of the caret */
- int height; /* specified height of the window */
+ struct TkWindow *winPtr; /* The window on which we requested caret
+ * placement. */
+ int x; /* Relative x coord of the caret. */
+ int y; /* Relative y coord of the caret. */
+ int height; /* Specified height of the window. */
} TkCaret;
/*
- * One of the following structures is maintained for each display
- * containing a window managed by Tk. In part, the structure is
- * used to store thread-specific data, since each thread will have
- * its own TkDisplay structure.
+ * One of the following structures is maintained for each display containing a
+ * window managed by Tk. In part, the structure is used to store thread-
+ * specific data, since each thread will have its own TkDisplay structure.
*/
typedef struct TkDisplay {
Display *display; /* Xlib's info about display. */
struct TkDisplay *nextPtr; /* Next in list of all displays. */
- char *name; /* Name of display (with any screen
- * identifier removed). Malloc-ed. */
+ char *name; /* Name of display (with any screen identifier
+ * removed). Malloc-ed. */
Time lastEventTime; /* Time of last event received for this
* display. */
@@ -162,16 +175,16 @@ typedef struct TkDisplay {
* Information used primarily by tk3d.c:
*/
- int borderInit; /* 0 means borderTable needs initializing. */
- Tcl_HashTable borderTable; /* Maps from color name to TkBorder
+ int borderInit; /* 0 means borderTable needs initializing. */
+ Tcl_HashTable borderTable; /* Maps from color name to TkBorder
* structure. */
/*
* Information used by tkAtom.c only:
*/
- int atomInit; /* 0 means stuff below hasn't been
- * initialized yet. */
+ int atomInit; /* 0 means stuff below hasn't been initialized
+ * yet. */
Tcl_HashTable nameTable; /* Maps from names to Atom's. */
Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
@@ -179,139 +192,137 @@ typedef struct TkDisplay {
* Information used primarily by tkBind.c:
*/
- int bindInfoStale; /* Non-zero means the variables in this
- * part of the structure are potentially
- * incorrect and should be recomputed. */
+ int bindInfoStale; /* Non-zero means the variables in this part
+ * of the structure are potentially incorrect
+ * and should be recomputed. */
unsigned int modeModMask; /* Has one bit set to indicate the modifier
- * corresponding to "mode shift". If no
- * such modifier, than this is zero. */
+ * corresponding to "mode shift". If no such
+ * modifier, than this is zero. */
unsigned int metaModMask; /* Has one bit set to indicate the modifier
- * corresponding to the "Meta" key. If no
- * such modifier, then this is zero. */
+ * corresponding to the "Meta" key. If no such
+ * modifier, then this is zero. */
unsigned int altModMask; /* Has one bit set to indicate the modifier
- * corresponding to the "Meta" key. If no
- * such modifier, then this is zero. */
+ * corresponding to the "Meta" key. If no such
+ * modifier, then this is zero. */
enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
- /* Indicates how to interpret lock modifier. */
+ /* Indicates how to interpret lock
+ * modifier. */
int numModKeyCodes; /* Number of entries in modKeyCodes array
* below. */
- KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for
- * all of the keys that have modifiers
- * associated with them. Malloc'ed, but
- * may be NULL. */
+ KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for all
+ * of the keys that have modifiers associated
+ * with them. Malloc'ed, but may be NULL. */
/*
* Information used by tkBitmap.c only:
*/
-
- int bitmapInit; /* 0 means tables above need initializing. */
- int bitmapAutoNumber; /* Used to number bitmaps. */
- Tcl_HashTable bitmapNameTable;
- /* Maps from name of bitmap to the first
+
+ int bitmapInit; /* 0 means tables above need initializing. */
+ int bitmapAutoNumber; /* Used to number bitmaps. */
+ Tcl_HashTable bitmapNameTable;
+ /* Maps from name of bitmap to the first
* TkBitmap record for that name. */
Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
* structure for the bitmap. */
- Tcl_HashTable bitmapDataTable;
- /* Used by Tk_GetBitmapFromData to map from
- * a collection of in-core data about a
- * bitmap to a reference giving an auto-
- * matically-generated name for the bitmap. */
+ Tcl_HashTable bitmapDataTable;
+ /* Used by Tk_GetBitmapFromData to map from a
+ * collection of in-core data about a bitmap
+ * to a reference giving an automatically-
+ * generated name for the bitmap. */
/*
* Information used by tkCanvas.c only:
*/
- int numIdSearches;
+ int numIdSearches;
int numSlowSearches;
/*
* Used by tkColor.c only:
*/
- int colorInit; /* 0 means color module needs initializing. */
- TkStressedCmap *stressPtr; /* First in list of colormaps that have
- * filled up, so we have to pick an
- * approximate color. */
+ int colorInit; /* 0 means color module needs initializing. */
+ TkStressedCmap *stressPtr; /* First in list of colormaps that have filled
+ * up, so we have to pick an approximate
+ * color. */
Tcl_HashTable colorNameTable;
- /* Maps from color name to TkColor structure
+ /* Maps from color name to TkColor structure
* for that color. */
Tcl_HashTable colorValueTable;
- /* Maps from integer RGB values to TkColor
+ /* Maps from integer RGB values to TkColor
* structures. */
/*
* Used by tkCursor.c only:
*/
- int cursorInit; /* 0 means cursor module need initializing. */
+ int cursorInit; /* 0 means cursor module need initializing. */
Tcl_HashTable cursorNameTable;
- /* Maps from a string name to a cursor to the
+ /* Maps from a string name to a cursor to the
* TkCursor record for the cursor. */
Tcl_HashTable cursorDataTable;
- /* Maps from a collection of in-core data
+ /* Maps from a collection of in-core data
* about a cursor to a TkCursor structure. */
Tcl_HashTable cursorIdTable;
- /* Maps from a cursor id to the TkCursor
+ /* Maps from a cursor id to the TkCursor
* structure for the cursor. */
- char cursorString[20]; /* Used to store a cursor id string. */
- Font cursorFont; /* Font to use for standard cursors.
- * None means font not loaded yet. */
+ char cursorString[20]; /* Used to store a cursor id string. */
+ Font cursorFont; /* Font to use for standard cursors. None
+ * means font not loaded yet. */
/*
* Information used by tkError.c only:
*/
struct TkErrorHandler *errorPtr;
- /* First in list of error handlers
- * for this display. NULL means
- * no handlers exist at present. */
- int deleteCount; /* Counts # of handlers deleted since
- * last time inactive handlers were
- * garbage-collected. When this number
- * gets big, handlers get cleaned up. */
+ /* First in list of error handlers for this
+ * display. NULL means no handlers exist at
+ * present. */
+ int deleteCount; /* Counts # of handlers deleted since last
+ * time inactive handlers were garbage-
+ * collected. When this number gets big,
+ * handlers get cleaned up. */
/*
* Used by tkEvent.c only:
*/
struct TkWindowEvent *delayedMotionPtr;
- /* Points to a malloc-ed motion event
- * whose processing has been delayed in
- * the hopes that another motion event
- * will come along right away and we can
- * merge the two of them together. NULL
- * means that there is no delayed motion
- * event. */
+ /* Points to a malloc-ed motion event whose
+ * processing has been delayed in the hopes
+ * that another motion event will come along
+ * right away and we can merge the two of them
+ * together. NULL means that there is no
+ * delayed motion event. */
/*
* Information used by tkFocus.c only:
*/
- int focusDebug; /* 1 means collect focus debugging
+ int focusDebug; /* 1 means collect focus debugging
* statistics. */
struct TkWindow *implicitWinPtr;
/* If the focus arrived at a toplevel window
- * implicitly via an Enter event (rather
- * than via a FocusIn event), this points
- * to the toplevel window. Otherwise it is
- * NULL. */
+ * implicitly via an Enter event (rather than
+ * via a FocusIn event), this points to the
+ * toplevel window. Otherwise it is NULL. */
struct TkWindow *focusPtr; /* Points to the window on this display that
- * should be receiving keyboard events. When
+ * should be receiving keyboard events. When
* multiple applications on the display have
- * the focus, this will refer to the
- * innermost window in the innermost
- * application. This information isn't used
- * under Unix or Windows, but it's needed on
- * the Macintosh. */
+ * the focus, this will refer to the innermost
+ * window in the innermost application. This
+ * information isn't used on Windows, but it's
+ * needed on the Mac, and also on X11 when XIM
+ * processing is being done. */
/*
* Information used by tkGC.c only:
*/
-
+
Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
* describing a GC with those values. */
- Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */
- int gcInit; /* 0 means the tables below need
+ Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */
+ int gcInit; /* 0 means the tables below need
* initializing. */
/*
@@ -319,24 +330,23 @@ typedef struct TkDisplay {
*/
Tcl_HashTable maintainHashTable;
- /* Hash table that maps from a master's
- * Tk_Window token to a list of slaves
- * managed by that master. */
- int geomInit;
+ /* Hash table that maps from a master's
+ * Tk_Window token to a list of slaves managed
+ * by that master. */
+ int geomInit;
/*
* Information used by tkGet.c only:
*/
-
- Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */
- int uidInit; /* 0 means uidTable needs initializing. */
+
+ Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */
+ int uidInit; /* 0 means uidTable needs initializing. */
/*
* Information used by tkGrab.c only:
*/
- struct TkWindow *grabWinPtr;
- /* Window in which the pointer is currently
+ struct TkWindow *grabWinPtr;/* Window in which the pointer is currently
* grabbed, or NULL if none. */
struct TkWindow *eventualGrabWinPtr;
/* Value that grabWinPtr will have once the
@@ -348,68 +358,65 @@ typedef struct TkDisplay {
* if no such press in effect. */
struct TkWindow *serverWinPtr;
/* If no application contains the pointer then
- * this is NULL. Otherwise it contains the
- * last window for which we've gotten an
- * Enter or Leave event from the server (i.e.
- * the last window known to have contained
- * the pointer). Doesn't reflect events
- * that were synthesized in tkGrab.c. */
+ * this is NULL. Otherwise it contains the
+ * last window for which we've gotten an Enter
+ * or Leave event from the server (i.e. the
+ * last window known to have contained the
+ * pointer). Doesn't reflect events that were
+ * synthesized in tkGrab.c. */
TkGrabEvent *firstGrabEventPtr;
/* First in list of enter/leave events
- * synthesized by grab code. These events
- * must be processed in order before any other
- * events are processed. NULL means no such
+ * synthesized by grab code. These events must
+ * be processed in order before any other
+ * events are processed. NULL means no such
* events. */
TkGrabEvent *lastGrabEventPtr;
/* Last in list of synthesized events, or NULL
* if list is empty. */
- int grabFlags; /* Miscellaneous flag values. See definitions
+ int grabFlags; /* Miscellaneous flag values. See definitions
* in tkGrab.c. */
/*
* Information used by tkGrid.c only:
*/
- int gridInit; /* 0 means table below needs initializing. */
- Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to
- * corresponding Grid structures. */
+ int gridInit; /* 0 means table below needs initializing. */
+ Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to corresponding
+ * Grid structures. */
/*
* Information used by tkImage.c only:
*/
- int imageId; /* Value used to number image ids. */
+ int imageId; /* Value used to number image ids. */
/*
* Information used by tkMacWinMenu.c only:
*/
- int postCommandGeneration;
+ int postCommandGeneration;
/*
* Information used by tkOption.c only.
*/
-
-
/*
* Information used by tkPack.c only.
*/
- int packInit; /* 0 means table below needs initializing. */
+ int packInit; /* 0 means table below needs initializing. */
Tcl_HashTable packerHashTable;
- /* Maps from Tk_Window tokens to
- * corresponding Packer structures. */
-
+ /* Maps from Tk_Window tokens to corresponding
+ * Packer structures. */
/*
* Information used by tkPlace.c only.
*/
- int placeInit; /* 0 means tables below need initializing. */
- Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
+ int placeInit; /* 0 means tables below need initializing. */
+ Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
* structure for the window, if it exists. */
- Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
+ Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
* structure for the window, if it exists. */
/*
@@ -418,11 +425,11 @@ typedef struct TkDisplay {
struct TkSelectionInfo *selectionInfoPtr;
/* First in list of selection information
- * records. Each entry contains information
+ * records. Each entry contains information
* about the current owner of a particular
* selection on this display. */
- Atom multipleAtom; /* Atom for MULTIPLE. None means
- * selection stuff isn't initialized. */
+ Atom multipleAtom; /* Atom for MULTIPLE. None means selection
+ * stuff isn't initialized. */
Atom incrAtom; /* Atom for INCR. */
Atom targetsAtom; /* Atom for TARGETS. */
Atom timestampAtom; /* Atom for TIMESTAMP. */
@@ -443,7 +450,7 @@ typedef struct TkDisplay {
/* Last application that owned clipboard. */
struct TkClipboardTarget *clipTargetPtr;
/* First in list of clipboard type information
- * records. Each entry contains information
+ * records. Each entry contains information
* about the buffers for a given selection
* target. */
@@ -451,13 +458,13 @@ typedef struct TkDisplay {
* Information used by tkSend.c only:
*/
- Tk_Window commTkwin; /* Window used for communication
- * between interpreters during "send"
- * commands. NULL means send info hasn't
- * been initialized yet. */
+ Tk_Window commTkwin; /* Window used for communication between
+ * interpreters during "send" commands. NULL
+ * means send info hasn't been initialized
+ * yet. */
Atom commProperty; /* X's name for comm property. */
- Atom registryProperty; /* X's name for property containing
- * registry of interpreter names. */
+ Atom registryProperty; /* X's name for property containing registry
+ * of interpreter names. */
Atom appNameProperty; /* X's name for property used to hold the
* application name on each comm window. */
@@ -469,12 +476,11 @@ typedef struct TkDisplay {
/* First in list of chunks of free resource
* identifiers, or NULL if there are no free
* resources. */
- XID (*defaultAllocProc) _ANSI_ARGS_((Display *display));
+ XID (*defaultAllocProc) (Display *display);
/* Default resource allocator for display. */
struct TkIdStack *windowStackPtr;
- /* First in list of chunks of window
- * identifers that can't be reused right
- * now. */
+ /* First in list of chunks of window ids that
+ * can't be reused right now. */
Tcl_TimerToken idCleanupScheduled;
/* If set, it means a call to WindowIdCleanup
* has already been scheduled, 0 means it
@@ -484,17 +490,16 @@ typedef struct TkDisplay {
* Information used by tkUnixWm.c and tkWinWm.c only:
*/
- struct TkWmInfo *firstWmPtr; /* Points to first top-level window. */
- struct TkWmInfo *foregroundWmPtr;
- /* Points to the foreground window. */
+ struct TkWmInfo *firstWmPtr;/* Points to first top-level window. */
+ struct TkWmInfo *foregroundWmPtr;
+ /* Points to the foreground window. */
/*
* Information maintained by tkWindow.c for use later on by tkXId.c:
*/
-
- int destroyCount; /* Number of Tk_DestroyWindow operations
- * in progress. */
+ int destroyCount; /* Number of Tk_DestroyWindow operations in
+ * progress. */
unsigned long lastDestroyRequest;
/* Id of most recent XDestroyWindow request;
* can re-use ids in windowStackPtr when
@@ -513,25 +518,25 @@ typedef struct TkDisplay {
*/
#ifdef TK_USE_INPUT_METHODS
- XIM inputMethod; /* Input method for this display */
-#if TK_XIM_SPOT
+ XIM inputMethod; /* Input method for this display. */
+ XIMStyle inputStyle; /* Input style selected for this display. */
XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */
-#endif
#endif /* TK_USE_INPUT_METHODS */
Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
int refCount; /* Reference count of how many Tk applications
- * are using this display. Used to clean up
- * the display when we no longer have any
- * Tk applications using it.
- */
+ * are using this display. Used to clean up
+ * the display when we no longer have any Tk
+ * applications using it. */
+
/*
* The following field were all added for Tk8.3
*/
- int mouseButtonState; /* current mouse button state for this
- * display */
- Window mouseButtonWindow; /* Window the button state was set in,
- * added in Tk 8.4. */
+
+ int mouseButtonState; /* Current mouse button state for this
+ * display. */
+ Window mouseButtonWindow; /* Window the button state was set in, added
+ * in Tk 8.4. */
Window warpWindow;
int warpX;
int warpY;
@@ -539,13 +544,14 @@ typedef struct TkDisplay {
/*
* The following field(s) were all added for Tk8.4
*/
- unsigned int flags; /* Various flag values: these are all
- * defined in below. */
- TkCaret caret; /* information about the caret for this
- * display. This is not a pointer. */
- int iconDataSize; /* size of default iconphoto image data */
- unsigned char *iconDataPtr; /* default iconphoto image data, if set */
+ unsigned int flags; /* Various flag values: these are all defined
+ * in below. */
+ TkCaret caret; /* Information about the caret for this
+ * display. This is not a pointer. */
+
+ int iconDataSize; /* Size of default iconphoto image data. */
+ unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
} TkDisplay;
/*
@@ -554,8 +560,6 @@ typedef struct TkDisplay {
* Indicates that we should collapse motion events on this display
* TK_DISPLAY_USE_IM: (default on, set via tk.tcl)
* Whether to use input methods for this display
- * TK_DISPLAY_XIM_SPOT: (default off)
- * Indicates that we should use over-the-spot XIM on this display
* TK_DISPLAY_WM_TRACING: (default off)
* Whether we should do wm tracing on this display.
* TK_DISPLAY_IN_WARP: (default off)
@@ -564,88 +568,75 @@ typedef struct TkDisplay {
#define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0)
#define TK_DISPLAY_USE_IM (1 << 1)
-#define TK_DISPLAY_XIM_SPOT (1 << 2)
#define TK_DISPLAY_WM_TRACING (1 << 3)
#define TK_DISPLAY_IN_WARP (1 << 4)
/*
- * One of the following structures exists for each error handler
- * created by a call to Tk_CreateErrorHandler. The structure
- * is managed by tkError.c.
+ * One of the following structures exists for each error handler created by a
+ * call to Tk_CreateErrorHandler. The structure is managed by tkError.c.
*/
typedef struct TkErrorHandler {
TkDisplay *dispPtr; /* Display to which handler applies. */
- unsigned long firstRequest; /* Only errors with serial numbers
- * >= to this are considered. */
- unsigned long lastRequest; /* Only errors with serial numbers
- * <= to this are considered. This
- * field is filled in when XUnhandle
- * is called. -1 means XUnhandle
- * hasn't been called yet. */
- int error; /* Consider only errors with this
- * error_code (-1 means consider
- * all errors). */
- int request; /* Consider only errors with this
- * major request code (-1 means
- * consider all major codes). */
- int minorCode; /* Consider only errors with this
- * minor request code (-1 means
- * consider all minor codes). */
- Tk_ErrorProc *errorProc; /* Procedure to invoke when a matching
- * error occurs. NULL means just ignore
- * errors. */
- ClientData clientData; /* Arbitrary value to pass to
- * errorProc. */
+ unsigned long firstRequest; /* Only errors with serial numbers >= to this
+ * are considered. */
+ unsigned long lastRequest; /* Only errors with serial numbers <= to this
+ * are considered. This field is filled in
+ * when XUnhandle is called. -1 means
+ * XUnhandle hasn't been called yet. */
+ int error; /* Consider only errors with this error_code
+ * (-1 means consider all errors). */
+ int request; /* Consider only errors with this major
+ * request code (-1 means consider all major
+ * codes). */
+ int minorCode; /* Consider only errors with this minor
+ * request code (-1 means consider all minor
+ * codes). */
+ Tk_ErrorProc *errorProc; /* Function to invoke when a matching error
+ * occurs. NULL means just ignore errors. */
+ ClientData clientData; /* Arbitrary value to pass to errorProc. */
struct TkErrorHandler *nextPtr;
- /* Pointer to next older handler for
- * this display, or NULL for end of
- * list. */
+ /* Pointer to next older handler for this
+ * display, or NULL for end of list. */
} TkErrorHandler;
-
/*
- * One of the following structures exists for each event handler
- * created by calling Tk_CreateEventHandler. This information
- * is used by tkEvent.c only.
+ * One of the following structures exists for each event handler created by
+ * calling Tk_CreateEventHandler. This information is used by tkEvent.c only.
*/
typedef struct TkEventHandler {
- unsigned long mask; /* Events for which to invoke
- * proc. */
- Tk_EventProc *proc; /* Procedure to invoke when an event
- * in mask occurs. */
+ unsigned long mask; /* Events for which to invoke proc. */
+ Tk_EventProc *proc; /* Function to invoke when an event in mask
+ * occurs. */
ClientData clientData; /* Argument to pass to proc. */
struct TkEventHandler *nextPtr;
- /* Next in list of handlers
- * associated with window (NULL means
- * end of list). */
+ /* Next in list of handlers associated with
+ * window (NULL means end of list). */
} TkEventHandler;
/*
- * Tk keeps one of the following data structures for each main
- * window (created by a call to TkCreateMainWindow). It stores
- * information that is shared by all of the windows associated
- * with a particular main window.
+ * Tk keeps one of the following data structures for each main window (created
+ * by a call to TkCreateMainWindow). It stores information that is shared by
+ * all of the windows associated with a particular main window.
*/
typedef struct TkMainInfo {
int refCount; /* Number of windows whose "mainPtr" fields
- * point here. When this becomes zero, can
- * free up the structure (the reference
- * count is zero because windows can get
- * deleted in almost any order; the main
- * window isn't necessarily the last one
- * deleted). */
+ * point here. When this becomes zero, can
+ * free up the structure (the reference count
+ * is zero because windows can get deleted in
+ * almost any order; the main window isn't
+ * necessarily the last one deleted). */
struct TkWindow *winPtr; /* Pointer to main window. */
Tcl_Interp *interp; /* Interpreter associated with application. */
Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow
* structs for all windows related to this
- * main window. Managed by tkWindow.c. */
- long deletionEpoch; /* Incremented by window deletions */
+ * main window. Managed by tkWindow.c. */
+ long deletionEpoch; /* Incremented by window deletions. */
Tk_BindingTable bindingTable;
- /* Used in conjunction with "bind" command
- * to bind events to Tcl commands. */
+ /* Used in conjunction with "bind" command to
+ * bind events to Tcl commands. */
TkBindInfo bindInfo; /* Information used by tkBind.c on a per
* application basis. */
struct TkFontInfo *fontInfoPtr;
@@ -659,21 +650,21 @@ typedef struct TkMainInfo {
struct TkToplevelFocusInfo *tlFocusPtr;
/* First in list of records containing focus
* information for each top-level in the
- * application. Used only by tkFocus.c. */
+ * application. Used only by tkFocus.c. */
struct TkDisplayFocusInfo *displayFocusPtr;
/* First in list of records containing focus
* information for each display that this
- * application has ever used. Used only
- * by tkFocus.c. */
+ * application has ever used. Used only by
+ * tkFocus.c. */
struct ElArray *optionRootPtr;
- /* Top level of option hierarchy for this
- * main window. NULL means uninitialized.
- * Managed by tkOption.c. */
+ /* Top level of option hierarchy for this main
+ * window. NULL means uninitialized. Managed
+ * by tkOption.c. */
Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageMaster
- * structures. Managed by tkImage.c. */
- int strictMotif; /* This is linked to the tk_strictMotif
- * global variable. */
+ * structures. Managed by tkImage.c. */
+ int strictMotif; /* This is linked to the tk_strictMotif global
+ * variable. */
int alwaysShowSelection; /* This is linked to the
* ::tk::AlwaysShowSelection variable. */
struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
@@ -681,172 +672,157 @@ typedef struct TkMainInfo {
} TkMainInfo;
/*
- * Tk keeps the following data structure for each of it's builtin
- * bitmaps. This structure is only used by tkBitmap.c and other
- * platform specific bitmap files.
+ * Tk keeps the following data structure for each of it's builtin bitmaps.
+ * This structure is only used by tkBitmap.c and other platform specific
+ * bitmap files.
*/
typedef struct {
- CONST char *source; /* Bits for bitmap. */
+ const char *source; /* Bits for bitmap. */
int width, height; /* Dimensions of bitmap. */
- int native; /* 0 means generic (X style) bitmap,
- * 1 means native style bitmap. */
+ int native; /* 0 means generic (X style) bitmap, 1 means
+ * native style bitmap. */
} TkPredefBitmap;
/*
- * Tk keeps one of the following structures for each window.
- * Some of the information (like size and location) is a shadow
- * of information managed by the X server, and some is special
- * information used here, such as event and geometry management
- * information. This information is (mostly) managed by tkWindow.c.
- * WARNING: the declaration below must be kept consistent with the
- * Tk_FakeWin structure in tk.h. If you change one, be sure to
- * change the other!!
+ * Tk keeps one of the following structures for each window. Some of the
+ * information (like size and location) is a shadow of information managed by
+ * the X server, and some is special information used here, such as event and
+ * geometry management information. This information is (mostly) managed by
+ * tkWindow.c. WARNING: the declaration below must be kept consistent with the
+ * Tk_FakeWin structure in tk.h. If you change one, be sure to change the
+ * other!
*/
typedef struct TkWindow {
-
/*
* Structural information:
*/
Display *display; /* Display containing window. */
- TkDisplay *dispPtr; /* Tk's information about display
- * for window. */
- int screenNum; /* Index of screen for window, among all
- * those for dispPtr. */
- Visual *visual; /* Visual to use for window. If not default,
+ TkDisplay *dispPtr; /* Tk's information about display for
+ * window. */
+ int screenNum; /* Index of screen for window, among all those
+ * for dispPtr. */
+ Visual *visual; /* Visual to use for window. If not default,
* MUST be set before X window is created. */
int depth; /* Number of bits/pixel. */
- Window window; /* X's id for window. NULL means window
- * hasn't actually been created yet, or it's
- * been deleted. */
- struct TkWindow *childList; /* First in list of child windows,
- * or NULL if no children. List is in
- * stacking order, lowest window first.*/
- struct TkWindow *lastChildPtr;
- /* Last in list of child windows (highest
- * in stacking order), or NULL if no
- * children. */
- struct TkWindow *parentPtr; /* Pointer to parent window (logical
- * parent, not necessarily X parent). NULL
- * means either this is the main window, or
- * the window's parent has already been
+ Window window; /* X's id for window. NULL means window hasn't
+ * actually been created yet, or it's been
* deleted. */
- struct TkWindow *nextPtr; /* Next higher sibling (in stacking order)
- * in list of children with same parent. NULL
+ struct TkWindow *childList; /* First in list of child windows, or NULL if
+ * no children. List is in stacking order,
+ * lowest window first.*/
+ struct TkWindow *lastChildPtr;
+ /* Last in list of child windows (highest in
+ * stacking order), or NULL if no children. */
+ struct TkWindow *parentPtr; /* Pointer to parent window (logical parent,
+ * not necessarily X parent). NULL means
+ * either this is the main window, or the
+ * window's parent has already been deleted. */
+ struct TkWindow *nextPtr; /* Next higher sibling (in stacking order) in
+ * list of children with same parent. NULL
* means end of list. */
TkMainInfo *mainPtr; /* Information shared by all windows
- * associated with a particular main
- * window. NULL means this window is
- * a rogue that isn't associated with
- * any application (at present, this
- * only happens for the dummy windows
- * used for "send" communication). */
+ * associated with a particular main window.
+ * NULL means this window is a rogue that is
+ * not associated with any application (at
+ * present, this only happens for the dummy
+ * windows used for "send" communication). */
/*
* Name and type information for the window:
*/
- char *pathName; /* Path name of window (concatenation
- * of all names between this window and
- * its top-level ancestor). This is a
- * pointer into an entry in
- * mainPtr->nameTable. NULL means that
- * the window hasn't been completely
- * created yet. */
+ char *pathName; /* Path name of window (concatenation of all
+ * names between this window and its top-level
+ * ancestor). This is a pointer into an entry
+ * in mainPtr->nameTable. NULL means that the
+ * window hasn't been completely created
+ * yet. */
Tk_Uid nameUid; /* Name of the window within its parent
* (unique within the parent). */
- Tk_Uid classUid; /* Class of the window. NULL means window
+ Tk_Uid classUid; /* Class of the window. NULL means window
* hasn't been given a class yet. */
/*
- * Geometry and other attributes of window. This information
- * may not be updated on the server immediately; stuff that
- * hasn't been reflected in the server yet is called "dirty".
- * At present, information can be dirty only if the window
- * hasn't yet been created.
+ * Geometry and other attributes of window. This information may not be
+ * updated on the server immediately; stuff that hasn't been reflected in
+ * the server yet is called "dirty". At present, information can be dirty
+ * only if the window hasn't yet been created.
*/
- XWindowChanges changes; /* Geometry and other info about
- * window. */
- unsigned int dirtyChanges; /* Bits indicate fields of "changes"
- * that are dirty. */
+ XWindowChanges changes; /* Geometry and other info about window. */
+ unsigned int dirtyChanges; /* Bits indicate fields of "changes" that are
+ * dirty. */
XSetWindowAttributes atts; /* Current attributes of window. */
- unsigned long dirtyAtts; /* Bits indicate fields of "atts"
- * that are dirty. */
+ unsigned long dirtyAtts; /* Bits indicate fields of "atts" that are
+ * dirty. */
- unsigned int flags; /* Various flag values: these are all
- * defined in tk.h (confusing, but they're
- * needed there for some query macros). */
+ unsigned int flags; /* Various flag values: these are all defined
+ * in tk.h (confusing, but they're needed
+ * there for some query macros). */
/*
* Information kept by the event manager (tkEvent.c):
*/
- TkEventHandler *handlerList;/* First in list of event handlers
- * declared for this window, or
- * NULL if none. */
+ TkEventHandler *handlerList;/* First in list of event handlers declared
+ * for this window, or NULL if none. */
#ifdef TK_USE_INPUT_METHODS
XIC inputContext; /* XIM input context. */
#endif /* TK_USE_INPUT_METHODS */
/*
- * Information used for event bindings (see "bind" and "bindtags"
- * commands in tkCmds.c):
+ * Information used for event bindings (see "bind" and "bindtags" commands
+ * in tkCmds.c):
*/
ClientData *tagPtr; /* Points to array of tags used for bindings
- * on this window. Each tag is a Tk_Uid.
- * Malloc'ed. NULL means no tags. */
+ * on this window. Each tag is a Tk_Uid.
+ * Malloc'ed. NULL means no tags. */
int numTags; /* Number of tags at *tagPtr. */
/*
- * Information used by tkOption.c to manage options for the
- * window.
+ * Information used by tkOption.c to manage options for the window.
*/
- int optionLevel; /* -1 means no option information is
- * currently cached for this window.
- * Otherwise this gives the level in
- * the option stack at which info is
- * cached. */
+ int optionLevel; /* -1 means no option information is currently
+ * cached for this window. Otherwise this
+ * gives the level in the option stack at
+ * which info is cached. */
/*
* Information used by tkSelect.c to manage the selection.
*/
struct TkSelHandler *selHandlerList;
- /* First in list of handlers for
- * returning the selection in various
- * forms. */
+ /* First in list of handlers for returning the
+ * selection in various forms. */
/*
* Information used by tkGeometry.c for geometry management.
*/
- Tk_GeomMgr *geomMgrPtr; /* Information about geometry manager for
- * this window. */
- ClientData geomData; /* Argument for geometry manager procedures. */
+ const Tk_GeomMgr *geomMgrPtr; /* Information about geometry manager for this
+ * window. */
+ ClientData geomData; /* Argument for geometry manager functions. */
int reqWidth, reqHeight; /* Arguments from last call to
* Tk_GeometryRequest, or 0's if
- * Tk_GeometryRequest hasn't been
- * called. */
- int internalBorderLeft; /* Width of internal border of window
- * (0 means no internal border). Geometry
- * managers should not normally place children
- * on top of the border.
- * Fields for the other three sides are found
- * below. */
+ * Tk_GeometryRequest hasn't been called. */
+ int internalBorderLeft; /* Width of internal border of window (0 means
+ * no internal border). Geometry managers
+ * should not normally place children on top
+ * of the border. Fields for the other three
+ * sides are found below. */
/*
* Information maintained by tkWm.c for window manager communication.
*/
- struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also
- * for special Unix menubar and wrapper
- * windows), points to structure with
- * wm-related info (see tkWm.c). For
- * other windows, this is NULL. */
+ struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also for special
+ * Unix menubar and wrapper windows), points
+ * to structure with wm-related info (see
+ * tkWm.c). For other windows, this is NULL. */
/*
* Information used by widget classes.
@@ -866,32 +842,50 @@ typedef struct TkWindow {
*/
/* The remaining fields of internal border. */
- int internalBorderRight;
+ int internalBorderRight;
int internalBorderTop;
int internalBorderBottom;
-
+
int minReqWidth; /* Minimum requested width. */
int minReqHeight; /* Minimum requested height. */
} TkWindow;
/*
- * The following structure is used as a two way map between integers
- * and strings, usually to map between an internal C representation
- * and the strings used in Tcl.
+ * Real definition of some events. Note that these events come from outside
+ * but have internally generated pieces added to them.
+ */
+
+typedef struct {
+ XKeyEvent keyEvent; /* The real event from X11. */
+ char *charValuePtr; /* A pointer to a string that holds the key's
+ * %A substitution text (before backslash
+ * adding), or NULL if that has not been
+ * computed yet. If non-NULL, this string was
+ * allocated with ckalloc(). */
+ int charValueLen; /* Length of string in charValuePtr when that
+ * is non-NULL. */
+ KeySym keysym; /* Key symbol computed after input methods
+ * have been invoked */
+} TkKeyEvent;
+
+/*
+ * The following structure is used as a two way map between integers and
+ * strings, usually to map between an internal C representation and the
+ * strings used in Tcl.
*/
typedef struct TkStateMap {
int numKey; /* Integer representation of a value. */
- char *strKey; /* String representation of a value. */
+ const char *strKey; /* String representation of a value. */
} TkStateMap;
/*
- * This structure is used by the Mac and Window porting layers as
- * the internal representation of a clip_mask in a GC.
+ * This structure is used by the Mac and Window porting layers as the internal
+ * representation of a clip_mask in a GC.
*/
typedef struct TkpClipMask {
- int type; /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
+ int type; /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */
union {
Pixmap pixmap;
TkRegion region;
@@ -917,311 +911,292 @@ extern TkDisplay *tkDisplayList;
#define TK_GRAB_EXCLUDED 3
/*
- * The macro below is used to modify a "char" value (e.g. by casting
- * it to an unsigned character) so that it can be used safely with
- * macros such as isspace.
+ * Additional flag for TkpMeasureCharsInContext. Coordinate with other flags
+ * for this routine, but don't make public until TkpMeasureCharsInContext is
+ * made public, too.
+ */
+
+#define TK_ISOLATE_END 32
+
+/*
+ * The macro below is used to modify a "char" value (e.g. by casting it to an
+ * unsigned character) so that it can be used safely with macros such as
+ * isspace().
*/
#define UCHAR(c) ((unsigned char) (c))
/*
- * The following symbol is used in the mode field of FocusIn events
- * generated by an embedded application to request the input focus from
- * its container.
+ * The following symbol is used in the mode field of FocusIn events generated
+ * by an embedded application to request the input focus from its container.
*/
#define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
/*
- * The following special modifier mask bits are defined, to indicate
- * logical modifiers such as Meta and Alt that may float among the
- * actual modifier bits.
+ * The following special modifier mask bits are defined, to indicate logical
+ * modifiers such as Meta and Alt that may float among the actual modifier
+ * bits.
*/
#define META_MASK (AnyModifier<<1)
#define ALT_MASK (AnyModifier<<2)
+#define EXTENDED_MASK (AnyModifier<<3)
/*
- * Object types not declared in tkObj.c need to be mentioned here so
- * they can be properly registered with Tcl:
+ * Object types not declared in tkObj.c need to be mentioned here so they can
+ * be properly registered with Tcl:
*/
-extern Tcl_ObjType tkBorderObjType;
-extern Tcl_ObjType tkBitmapObjType;
-extern Tcl_ObjType tkColorObjType;
-extern Tcl_ObjType tkCursorObjType;
-extern Tcl_ObjType tkFontObjType;
-extern Tcl_ObjType tkOptionObjType;
-extern Tcl_ObjType tkStateKeyObjType;
+MODULE_SCOPE Tcl_ObjType tkBorderObjType;
+MODULE_SCOPE Tcl_ObjType tkBitmapObjType;
+MODULE_SCOPE Tcl_ObjType tkColorObjType;
+MODULE_SCOPE Tcl_ObjType tkCursorObjType;
+MODULE_SCOPE Tcl_ObjType tkFontObjType;
+MODULE_SCOPE Tcl_ObjType tkOptionObjType;
+MODULE_SCOPE Tcl_ObjType tkStateKeyObjType;
+MODULE_SCOPE Tcl_ObjType tkTextIndexType;
/*
- * Miscellaneous variables shared among Tk modules but not exported
- * to the outside world:
+ * Miscellaneous variables shared among Tk modules but not exported to the
+ * outside world:
*/
-extern Tk_SmoothMethod tkBezierSmoothMethod;
-extern Tk_ImageType tkBitmapImageType;
-extern Tk_PhotoImageFormat tkImgFmtGIF;
-extern void (*tkHandleEventProc) _ANSI_ARGS_((
- XEvent* eventPtr));
-extern Tk_PhotoImageFormat tkImgFmtPPM;
-extern TkMainInfo *tkMainWindowList;
-extern Tk_ImageType tkPhotoImageType;
-extern Tcl_HashTable tkPredefBitmapTable;
-extern int tkSendSerial;
+MODULE_SCOPE Tk_SmoothMethod tkBezierSmoothMethod;
+MODULE_SCOPE Tk_ImageType tkBitmapImageType;
+MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF;
+MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr);
+MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM;
+MODULE_SCOPE TkMainInfo *tkMainWindowList;
+MODULE_SCOPE Tk_ImageType tkPhotoImageType;
+MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable;
#include "tkIntDecls.h"
#ifdef BUILD_tk
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLEXPORT
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
#endif
/*
- * Internal procedures shared among Tk modules but not exported
- * to the outside world:
+ * Themed widget set init function:
*/
-EXTERN int Tk_BellObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_BindObjCmd _ANSI_ARGS_((ClientData clientData,
+MODULE_SCOPE int Ttk_Init(Tcl_Interp *interp);
+
+/*
+ * Internal functions shared among Tk modules but not exported to the outside
+ * world:
+ */
+
+MODULE_SCOPE int Tk_BellObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_BindObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_BindtagsObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_BindtagsObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ButtonObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ButtonObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_CanvasObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_CanvasObjCmd(ClientData clientData,
Tcl_Interp *interp, int argc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_CheckbuttonObjCmd _ANSI_ARGS_((
- ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_CheckbuttonObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ClipboardObjCmd _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ChooseColorObjCmd _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ChooseDirectoryObjCmd _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ChooseFontObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_DestroyObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_EntryObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_EventObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ClipboardObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_FileeventCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
-EXTERN int Tk_FrameObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ChooseColorObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_FocusObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_FontObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_GetOpenFileObjCmd _ANSI_ARGS_((
- ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_GetSaveFileObjCmd _ANSI_ARGS_((
- ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_GrabObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ChooseDirectoryObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_GridObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ChooseFontObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ImageObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_LabelObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_DestroyObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_LabelframeObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_EntryObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ListboxObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_EventObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_LowerObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_FrameObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_MenubuttonObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_MessageBoxObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_MessageObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_FocusObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_PanedWindowObjCmd _ANSI_ARGS_((
- ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_FontObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_OptionObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_GetOpenFileObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_PackObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_GetSaveFileObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_PlaceObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_GrabObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_RadiobuttonObjCmd _ANSI_ARGS_((
- ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_GridObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_RaiseObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ImageObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ScaleObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ScrollbarCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int Tk_SelectionObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_LabelObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_SendCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int Tk_SendObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_SpinboxObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_TextCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int Tk_TkObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_LabelframeObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_TkwaitObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ListboxObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_ToplevelObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_LowerObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_UpdateObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_WinfoObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_MenubuttonObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-EXTERN int Tk_WmObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_MessageBoxObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-
-EXTERN void TkEventInit _ANSI_ARGS_((void));
-
-EXTERN void TkRegisterObjTypes _ANSI_ARGS_((void));
-
-EXTERN int TkCreateMenuCmd _ANSI_ARGS_((Tcl_Interp *interp));
-EXTERN int TkDeadAppCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv));
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_MessageObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_PanedWindowObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_OptionObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_PackObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_PlaceObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_RadiobuttonObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_RaiseObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ScaleObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ScrollbarCmd(ClientData clientData,
+ Tcl_Interp *interp, int argc, const char **argv);
+MODULE_SCOPE int Tk_SelectionObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_SendCmd(ClientData clientData,
+ Tcl_Interp *interp, int argc, const char **argv);
+MODULE_SCOPE int Tk_SendObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_SpinboxObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_TextObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_TkObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_TkwaitObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_ToplevelObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_UpdateObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
-EXTERN int TkpTestembedCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkCanvasGetCoordObj _ANSI_ARGS_((Tcl_Interp *interp,
+MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr,
+ double *doublePtr);
+
+MODULE_SCOPE void TkEventInit(void);
+MODULE_SCOPE void TkRegisterObjTypes(void);
+MODULE_SCOPE int TkCreateMenuCmd(Tcl_Interp *interp);
+MODULE_SCOPE int TkDeadAppCmd(ClientData clientData,
+ Tcl_Interp *interp, int argc, const char **argv);
+MODULE_SCOPE int TkCanvasGetCoordObj(Tcl_Interp *interp,
Tk_Canvas canvas, Tcl_Obj *obj,
- double *doublePtr));
-EXTERN int TkCanvasDashParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *value, char *widgRec,
- int offset));
-EXTERN char * TkCanvasDashPrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-EXTERN int TkGetDoublePixels _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *string,
- double *doublePtr));
-EXTERN int TkOffsetParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *value, char *widgRec,
- int offset));
-EXTERN char * TkOffsetPrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-EXTERN int TkOrientParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *value,
- char *widgRec, int offset));
-EXTERN char * TkOrientPrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-EXTERN int TkPixelParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *value, char *widgRec,
- int offset));
-EXTERN char * TkPixelPrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-EXTERN int TkPostscriptImage _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_PostscriptInfo psInfo,
- XImage *ximage, int x, int y, int width,
- int height));
-EXTERN int TkSmoothParseProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *recordPtr, int offset));
-EXTERN char * TkSmoothPrintProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *recordPtr, int offset,
- Tcl_FreeProc **freeProcPtr));
-EXTERN int TkStateParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *value,
- char *widgRec, int offset));
-EXTERN char * TkStatePrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-EXTERN int TkTileParseProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *value, char *widgRec,
- int offset));
-EXTERN char * TkTilePrintProc _ANSI_ARGS_((
- ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-EXTERN void TkCreateExitHandler _ANSI_ARGS_((Tcl_ExitProc *proc,
- ClientData clientData));
-EXTERN void TkDeleteExitHandler _ANSI_ARGS_((Tcl_ExitProc *proc,
- ClientData clientData));
-EXTERN Tcl_ExitProc TkFinalize;
-EXTERN void TkPrintPadAmount _ANSI_ARGS_((Tcl_Interp *interp,
- char *buffer, int pad1, int pad2));
-EXTERN int TkParsePadAmount _ANSI_ARGS_((Tcl_Interp *interp,
+ double *doublePtr);
+MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
+ const char *string, double *doublePtr);
+MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_PostscriptInfo psInfo, XImage *ximage,
+ int x, int y, int width, int height);
+MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin);
+MODULE_SCOPE XEvent * TkpGetBindingXEvent(Tcl_Interp *interp);
+MODULE_SCOPE void TkCreateExitHandler(Tcl_ExitProc *proc,
+ ClientData clientData);
+MODULE_SCOPE void TkDeleteExitHandler(Tcl_ExitProc *proc,
+ ClientData clientData);
+MODULE_SCOPE Tcl_ExitProc TkFinalize;
+MODULE_SCOPE Tcl_ExitProc TkFinalizeThread;
+MODULE_SCOPE void TkpBuildRegionFromAlphaData(TkRegion region,
+ unsigned x, unsigned y, unsigned width,
+ unsigned height, unsigned char *dataPtr,
+ unsigned pixelStride, unsigned lineStride);
+MODULE_SCOPE void TkPrintPadAmount(Tcl_Interp *interp,
+ char *buffer, int pad1, int pad2);
+MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp,
Tk_Window tkwin, Tcl_Obj *objPtr,
- int *pad1Ptr, int *pad2Ptr));
-EXTERN int TkpAlwaysShowSelection _ANSI_ARGS_((Tk_Window tkwin));
+ int *pad1Ptr, int *pad2Ptr);
+MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr);
+MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr);
+MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin);
+MODULE_SCOPE void TkpDrawCharsInContext(Display * display,
+ Drawable drawable, GC gc, Tk_Font tkfont,
+ const char *source, int numBytes, int rangeStart,
+ int rangeLength, int x, int y);
+MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont,
+ const char *source, int numBytes, int rangeStart,
+ int rangeLength, int maxLength, int flags,
+ int *lengthPtr);
+MODULE_SCOPE void TkUnderlineCharsInContext(Display *display,
+ Drawable drawable, GC gc, Tk_Font tkfont,
+ const char *string, int numBytes, int x, int y,
+ int firstByte, int lastByte);
+MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
+ Tcl_UniChar c, struct TkFontAttributes *faPtr);
/*
* Unsupported commands.
*/
-EXTERN int TkUnsupported1ObjCmd _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLIMPORT
+MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
-#endif /* _TKINT */
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLIMPORT
+
+#endif /* _TKINT */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 76d181c..531ee5f 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -32,472 +32,769 @@
* Exported function declarations:
*/
+#ifndef TkAllocWindow_TCL_DECLARED
+#define TkAllocWindow_TCL_DECLARED
/* 0 */
-EXTERN TkWindow * TkAllocWindow _ANSI_ARGS_((TkDisplay * dispPtr,
- int screenNum, TkWindow * parentPtr));
+EXTERN TkWindow * TkAllocWindow(TkDisplay *dispPtr, int screenNum,
+ TkWindow *parentPtr);
+#endif
+#ifndef TkBezierPoints_TCL_DECLARED
+#define TkBezierPoints_TCL_DECLARED
/* 1 */
-EXTERN void TkBezierPoints _ANSI_ARGS_((double control[],
- int numSteps, double * coordPtr));
+EXTERN void TkBezierPoints(double control[], int numSteps,
+ double *coordPtr);
+#endif
+#ifndef TkBezierScreenPoints_TCL_DECLARED
+#define TkBezierScreenPoints_TCL_DECLARED
/* 2 */
-EXTERN void TkBezierScreenPoints _ANSI_ARGS_((Tk_Canvas canvas,
- double control[], int numSteps,
- XPoint * xPointPtr));
+EXTERN void TkBezierScreenPoints(Tk_Canvas canvas,
+ double control[], int numSteps,
+ XPoint *xPointPtr);
+#endif
+#ifndef TkBindDeadWindow_TCL_DECLARED
+#define TkBindDeadWindow_TCL_DECLARED
/* 3 */
-EXTERN void TkBindDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkBindDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkBindEventProc_TCL_DECLARED
+#define TkBindEventProc_TCL_DECLARED
/* 4 */
-EXTERN void TkBindEventProc _ANSI_ARGS_((TkWindow * winPtr,
- XEvent * eventPtr));
+EXTERN void TkBindEventProc(TkWindow *winPtr, XEvent *eventPtr);
+#endif
+#ifndef TkBindFree_TCL_DECLARED
+#define TkBindFree_TCL_DECLARED
/* 5 */
-EXTERN void TkBindFree _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkBindFree(TkMainInfo *mainPtr);
+#endif
+#ifndef TkBindInit_TCL_DECLARED
+#define TkBindInit_TCL_DECLARED
/* 6 */
-EXTERN void TkBindInit _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkBindInit(TkMainInfo *mainPtr);
+#endif
+#ifndef TkChangeEventWindow_TCL_DECLARED
+#define TkChangeEventWindow_TCL_DECLARED
/* 7 */
-EXTERN void TkChangeEventWindow _ANSI_ARGS_((XEvent * eventPtr,
- TkWindow * winPtr));
+EXTERN void TkChangeEventWindow(XEvent *eventPtr,
+ TkWindow *winPtr);
+#endif
+#ifndef TkClipInit_TCL_DECLARED
+#define TkClipInit_TCL_DECLARED
/* 8 */
-EXTERN int TkClipInit _ANSI_ARGS_((Tcl_Interp * interp,
- TkDisplay * dispPtr));
+EXTERN int TkClipInit(Tcl_Interp *interp, TkDisplay *dispPtr);
+#endif
+#ifndef TkComputeAnchor_TCL_DECLARED
+#define TkComputeAnchor_TCL_DECLARED
/* 9 */
-EXTERN void TkComputeAnchor _ANSI_ARGS_((Tk_Anchor anchor,
- Tk_Window tkwin, int padX, int padY,
- int innerWidth, int innerHeight, int * xPtr,
- int * yPtr));
+EXTERN void TkComputeAnchor(Tk_Anchor anchor, Tk_Window tkwin,
+ int padX, int padY, int innerWidth,
+ int innerHeight, int *xPtr, int *yPtr);
+#endif
+#ifndef TkCopyAndGlobalEval_TCL_DECLARED
+#define TkCopyAndGlobalEval_TCL_DECLARED
/* 10 */
-EXTERN int TkCopyAndGlobalEval _ANSI_ARGS_((Tcl_Interp * interp,
- char * script));
+EXTERN int TkCopyAndGlobalEval(Tcl_Interp *interp, char *script);
+#endif
+#ifndef TkCreateBindingProcedure_TCL_DECLARED
+#define TkCreateBindingProcedure_TCL_DECLARED
/* 11 */
-EXTERN unsigned long TkCreateBindingProcedure _ANSI_ARGS_((
- Tcl_Interp * interp,
- Tk_BindingTable bindingTable,
- ClientData object, CONST char * eventString,
- TkBindEvalProc * evalProc,
- TkBindFreeProc * freeProc,
- ClientData clientData));
+EXTERN unsigned long TkCreateBindingProcedure(Tcl_Interp *interp,
+ Tk_BindingTable bindingTable,
+ ClientData object, CONST char *eventString,
+ TkBindEvalProc *evalProc,
+ TkBindFreeProc *freeProc,
+ ClientData clientData);
+#endif
+#ifndef TkCreateCursorFromData_TCL_DECLARED
+#define TkCreateCursorFromData_TCL_DECLARED
/* 12 */
-EXTERN TkCursor * TkCreateCursorFromData _ANSI_ARGS_((Tk_Window tkwin,
- CONST char * source, CONST char * mask,
- int width, int height, int xHot, int yHot,
- XColor fg, XColor bg));
+EXTERN TkCursor * TkCreateCursorFromData(Tk_Window tkwin,
+ CONST char *source, CONST char *mask,
+ int width, int height, int xHot, int yHot,
+ XColor fg, XColor bg);
+#endif
+#ifndef TkCreateFrame_TCL_DECLARED
+#define TkCreateFrame_TCL_DECLARED
/* 13 */
-EXTERN int TkCreateFrame _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp * interp, int argc, char ** argv,
- int toplevel, char * appName));
+EXTERN int TkCreateFrame(ClientData clientData,
+ Tcl_Interp *interp, int argc, char **argv,
+ int toplevel, char *appName);
+#endif
+#ifndef TkCreateMainWindow_TCL_DECLARED
+#define TkCreateMainWindow_TCL_DECLARED
/* 14 */
-EXTERN Tk_Window TkCreateMainWindow _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * screenName, char * baseName));
+EXTERN Tk_Window TkCreateMainWindow(Tcl_Interp *interp,
+ CONST char *screenName, char *baseName);
+#endif
+#ifndef TkCurrentTime_TCL_DECLARED
+#define TkCurrentTime_TCL_DECLARED
/* 15 */
-EXTERN Time TkCurrentTime _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN Time TkCurrentTime(TkDisplay *dispPtr);
+#endif
+#ifndef TkDeleteAllImages_TCL_DECLARED
+#define TkDeleteAllImages_TCL_DECLARED
/* 16 */
-EXTERN void TkDeleteAllImages _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkDeleteAllImages(TkMainInfo *mainPtr);
+#endif
+#ifndef TkDoConfigureNotify_TCL_DECLARED
+#define TkDoConfigureNotify_TCL_DECLARED
/* 17 */
-EXTERN void TkDoConfigureNotify _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkDoConfigureNotify(TkWindow *winPtr);
+#endif
+#ifndef TkDrawInsetFocusHighlight_TCL_DECLARED
+#define TkDrawInsetFocusHighlight_TCL_DECLARED
/* 18 */
-EXTERN void TkDrawInsetFocusHighlight _ANSI_ARGS_((
- Tk_Window tkwin, GC gc, int width,
- Drawable drawable, int padding));
+EXTERN void TkDrawInsetFocusHighlight(Tk_Window tkwin, GC gc,
+ int width, Drawable drawable, int padding);
+#endif
+#ifndef TkEventDeadWindow_TCL_DECLARED
+#define TkEventDeadWindow_TCL_DECLARED
/* 19 */
-EXTERN void TkEventDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkEventDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkFillPolygon_TCL_DECLARED
+#define TkFillPolygon_TCL_DECLARED
/* 20 */
-EXTERN void TkFillPolygon _ANSI_ARGS_((Tk_Canvas canvas,
- double * coordPtr, int numPoints,
- Display * display, Drawable drawable, GC gc,
- GC outlineGC));
+EXTERN void TkFillPolygon(Tk_Canvas canvas, double *coordPtr,
+ int numPoints, Display *display,
+ Drawable drawable, GC gc, GC outlineGC);
+#endif
+#ifndef TkFindStateNum_TCL_DECLARED
+#define TkFindStateNum_TCL_DECLARED
/* 21 */
-EXTERN int TkFindStateNum _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * option,
- CONST TkStateMap * mapPtr,
- CONST char * strKey));
+EXTERN int TkFindStateNum(Tcl_Interp *interp,
+ CONST char *option, CONST TkStateMap *mapPtr,
+ CONST char *strKey);
+#endif
+#ifndef TkFindStateString_TCL_DECLARED
+#define TkFindStateString_TCL_DECLARED
/* 22 */
-EXTERN char * TkFindStateString _ANSI_ARGS_((
- CONST TkStateMap * mapPtr, int numKey));
+EXTERN char * TkFindStateString(CONST TkStateMap *mapPtr,
+ int numKey);
+#endif
+#ifndef TkFocusDeadWindow_TCL_DECLARED
+#define TkFocusDeadWindow_TCL_DECLARED
/* 23 */
-EXTERN void TkFocusDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkFocusDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkFocusFilterEvent_TCL_DECLARED
+#define TkFocusFilterEvent_TCL_DECLARED
/* 24 */
-EXTERN int TkFocusFilterEvent _ANSI_ARGS_((TkWindow * winPtr,
- XEvent * eventPtr));
+EXTERN int TkFocusFilterEvent(TkWindow *winPtr,
+ XEvent *eventPtr);
+#endif
+#ifndef TkFocusKeyEvent_TCL_DECLARED
+#define TkFocusKeyEvent_TCL_DECLARED
/* 25 */
-EXTERN TkWindow * TkFocusKeyEvent _ANSI_ARGS_((TkWindow * winPtr,
- XEvent * eventPtr));
+EXTERN TkWindow * TkFocusKeyEvent(TkWindow *winPtr, XEvent *eventPtr);
+#endif
+#ifndef TkFontPkgInit_TCL_DECLARED
+#define TkFontPkgInit_TCL_DECLARED
/* 26 */
-EXTERN void TkFontPkgInit _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkFontPkgInit(TkMainInfo *mainPtr);
+#endif
+#ifndef TkFontPkgFree_TCL_DECLARED
+#define TkFontPkgFree_TCL_DECLARED
/* 27 */
-EXTERN void TkFontPkgFree _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkFontPkgFree(TkMainInfo *mainPtr);
+#endif
+#ifndef TkFreeBindingTags_TCL_DECLARED
+#define TkFreeBindingTags_TCL_DECLARED
/* 28 */
-EXTERN void TkFreeBindingTags _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkFreeBindingTags(TkWindow *winPtr);
+#endif
+#ifndef TkpFreeCursor_TCL_DECLARED
+#define TkpFreeCursor_TCL_DECLARED
/* 29 */
-EXTERN void TkpFreeCursor _ANSI_ARGS_((TkCursor * cursorPtr));
+EXTERN void TkpFreeCursor(TkCursor *cursorPtr);
+#endif
+#ifndef TkGetBitmapData_TCL_DECLARED
+#define TkGetBitmapData_TCL_DECLARED
/* 30 */
-EXTERN char * TkGetBitmapData _ANSI_ARGS_((Tcl_Interp * interp,
- char * string, char * fileName,
- int * widthPtr, int * heightPtr,
- int * hotXPtr, int * hotYPtr));
+EXTERN char * TkGetBitmapData(Tcl_Interp *interp, char *string,
+ char *fileName, int *widthPtr,
+ int *heightPtr, int *hotXPtr, int *hotYPtr);
+#endif
+#ifndef TkGetButtPoints_TCL_DECLARED
+#define TkGetButtPoints_TCL_DECLARED
/* 31 */
-EXTERN void TkGetButtPoints _ANSI_ARGS_((double p1[],
- double p2[], double width, int project,
- double m1[], double m2[]));
+EXTERN void TkGetButtPoints(double p1[], double p2[],
+ double width, int project, double m1[],
+ double m2[]);
+#endif
+#ifndef TkGetCursorByName_TCL_DECLARED
+#define TkGetCursorByName_TCL_DECLARED
/* 32 */
-EXTERN TkCursor * TkGetCursorByName _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tk_Uid string));
+EXTERN TkCursor * TkGetCursorByName(Tcl_Interp *interp,
+ Tk_Window tkwin, Tk_Uid string);
+#endif
+#ifndef TkGetDefaultScreenName_TCL_DECLARED
+#define TkGetDefaultScreenName_TCL_DECLARED
/* 33 */
-EXTERN CONST84_RETURN char * TkGetDefaultScreenName _ANSI_ARGS_((
- Tcl_Interp * interp, CONST char * screenName));
+EXTERN CONST84_RETURN char * TkGetDefaultScreenName(Tcl_Interp *interp,
+ CONST char *screenName);
+#endif
+#ifndef TkGetDisplay_TCL_DECLARED
+#define TkGetDisplay_TCL_DECLARED
/* 34 */
-EXTERN TkDisplay * TkGetDisplay _ANSI_ARGS_((Display * display));
+EXTERN TkDisplay * TkGetDisplay(Display *display);
+#endif
+#ifndef TkGetDisplayOf_TCL_DECLARED
+#define TkGetDisplayOf_TCL_DECLARED
/* 35 */
-EXTERN int TkGetDisplayOf _ANSI_ARGS_((Tcl_Interp * interp,
- int objc, Tcl_Obj *CONST objv[],
- Tk_Window * tkwinPtr));
+EXTERN int TkGetDisplayOf(Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[], Tk_Window *tkwinPtr);
+#endif
+#ifndef TkGetFocusWin_TCL_DECLARED
+#define TkGetFocusWin_TCL_DECLARED
/* 36 */
-EXTERN TkWindow * TkGetFocusWin _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN TkWindow * TkGetFocusWin(TkWindow *winPtr);
+#endif
+#ifndef TkGetInterpNames_TCL_DECLARED
+#define TkGetInterpNames_TCL_DECLARED
/* 37 */
-EXTERN int TkGetInterpNames _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin));
+EXTERN int TkGetInterpNames(Tcl_Interp *interp, Tk_Window tkwin);
+#endif
+#ifndef TkGetMiterPoints_TCL_DECLARED
+#define TkGetMiterPoints_TCL_DECLARED
/* 38 */
-EXTERN int TkGetMiterPoints _ANSI_ARGS_((double p1[],
- double p2[], double p3[], double width,
- double m1[], double m2[]));
+EXTERN int TkGetMiterPoints(double p1[], double p2[],
+ double p3[], double width, double m1[],
+ double m2[]);
+#endif
+#ifndef TkGetPointerCoords_TCL_DECLARED
+#define TkGetPointerCoords_TCL_DECLARED
/* 39 */
-EXTERN void TkGetPointerCoords _ANSI_ARGS_((Tk_Window tkwin,
- int * xPtr, int * yPtr));
+EXTERN void TkGetPointerCoords(Tk_Window tkwin, int *xPtr,
+ int *yPtr);
+#endif
+#ifndef TkGetServerInfo_TCL_DECLARED
+#define TkGetServerInfo_TCL_DECLARED
/* 40 */
-EXTERN void TkGetServerInfo _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin));
+EXTERN void TkGetServerInfo(Tcl_Interp *interp, Tk_Window tkwin);
+#endif
+#ifndef TkGrabDeadWindow_TCL_DECLARED
+#define TkGrabDeadWindow_TCL_DECLARED
/* 41 */
-EXTERN void TkGrabDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkGrabDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkGrabState_TCL_DECLARED
+#define TkGrabState_TCL_DECLARED
/* 42 */
-EXTERN int TkGrabState _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN int TkGrabState(TkWindow *winPtr);
+#endif
+#ifndef TkIncludePoint_TCL_DECLARED
+#define TkIncludePoint_TCL_DECLARED
/* 43 */
-EXTERN void TkIncludePoint _ANSI_ARGS_((Tk_Item * itemPtr,
- double * pointPtr));
+EXTERN void TkIncludePoint(Tk_Item *itemPtr, double *pointPtr);
+#endif
+#ifndef TkInOutEvents_TCL_DECLARED
+#define TkInOutEvents_TCL_DECLARED
/* 44 */
-EXTERN void TkInOutEvents _ANSI_ARGS_((XEvent * eventPtr,
- TkWindow * sourcePtr, TkWindow * destPtr,
- int leaveType, int enterType,
- Tcl_QueuePosition position));
+EXTERN void TkInOutEvents(XEvent *eventPtr, TkWindow *sourcePtr,
+ TkWindow *destPtr, int leaveType,
+ int enterType, Tcl_QueuePosition position);
+#endif
+#ifndef TkInstallFrameMenu_TCL_DECLARED
+#define TkInstallFrameMenu_TCL_DECLARED
/* 45 */
-EXTERN void TkInstallFrameMenu _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void TkInstallFrameMenu(Tk_Window tkwin);
+#endif
+#ifndef TkKeysymToString_TCL_DECLARED
+#define TkKeysymToString_TCL_DECLARED
/* 46 */
-EXTERN char * TkKeysymToString _ANSI_ARGS_((KeySym keysym));
+EXTERN char * TkKeysymToString(KeySym keysym);
+#endif
+#ifndef TkLineToArea_TCL_DECLARED
+#define TkLineToArea_TCL_DECLARED
/* 47 */
-EXTERN int TkLineToArea _ANSI_ARGS_((double end1Ptr[],
- double end2Ptr[], double rectPtr[]));
+EXTERN int TkLineToArea(double end1Ptr[], double end2Ptr[],
+ double rectPtr[]);
+#endif
+#ifndef TkLineToPoint_TCL_DECLARED
+#define TkLineToPoint_TCL_DECLARED
/* 48 */
-EXTERN double TkLineToPoint _ANSI_ARGS_((double end1Ptr[],
- double end2Ptr[], double pointPtr[]));
+EXTERN double TkLineToPoint(double end1Ptr[], double end2Ptr[],
+ double pointPtr[]);
+#endif
+#ifndef TkMakeBezierCurve_TCL_DECLARED
+#define TkMakeBezierCurve_TCL_DECLARED
/* 49 */
-EXTERN int TkMakeBezierCurve _ANSI_ARGS_((Tk_Canvas canvas,
- double * pointPtr, int numPoints,
- int numSteps, XPoint xPoints[],
- double dblPoints[]));
+EXTERN int TkMakeBezierCurve(Tk_Canvas canvas, double *pointPtr,
+ int numPoints, int numSteps,
+ XPoint xPoints[], double dblPoints[]);
+#endif
+#ifndef TkMakeBezierPostscript_TCL_DECLARED
+#define TkMakeBezierPostscript_TCL_DECLARED
/* 50 */
-EXTERN void TkMakeBezierPostscript _ANSI_ARGS_((
- Tcl_Interp * interp, Tk_Canvas canvas,
- double * pointPtr, int numPoints));
+EXTERN void TkMakeBezierPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, double *pointPtr,
+ int numPoints);
+#endif
+#ifndef TkOptionClassChanged_TCL_DECLARED
+#define TkOptionClassChanged_TCL_DECLARED
/* 51 */
-EXTERN void TkOptionClassChanged _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkOptionClassChanged(TkWindow *winPtr);
+#endif
+#ifndef TkOptionDeadWindow_TCL_DECLARED
+#define TkOptionDeadWindow_TCL_DECLARED
/* 52 */
-EXTERN void TkOptionDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkOptionDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkOvalToArea_TCL_DECLARED
+#define TkOvalToArea_TCL_DECLARED
/* 53 */
-EXTERN int TkOvalToArea _ANSI_ARGS_((double * ovalPtr,
- double * rectPtr));
+EXTERN int TkOvalToArea(double *ovalPtr, double *rectPtr);
+#endif
+#ifndef TkOvalToPoint_TCL_DECLARED
+#define TkOvalToPoint_TCL_DECLARED
/* 54 */
-EXTERN double TkOvalToPoint _ANSI_ARGS_((double ovalPtr[],
- double width, int filled, double pointPtr[]));
+EXTERN double TkOvalToPoint(double ovalPtr[], double width,
+ int filled, double pointPtr[]);
+#endif
+#ifndef TkpChangeFocus_TCL_DECLARED
+#define TkpChangeFocus_TCL_DECLARED
/* 55 */
-EXTERN int TkpChangeFocus _ANSI_ARGS_((TkWindow * winPtr,
- int force));
+EXTERN int TkpChangeFocus(TkWindow *winPtr, int force);
+#endif
+#ifndef TkpCloseDisplay_TCL_DECLARED
+#define TkpCloseDisplay_TCL_DECLARED
/* 56 */
-EXTERN void TkpCloseDisplay _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN void TkpCloseDisplay(TkDisplay *dispPtr);
+#endif
+#ifndef TkpClaimFocus_TCL_DECLARED
+#define TkpClaimFocus_TCL_DECLARED
/* 57 */
-EXTERN void TkpClaimFocus _ANSI_ARGS_((TkWindow * topLevelPtr,
- int force));
+EXTERN void TkpClaimFocus(TkWindow *topLevelPtr, int force);
+#endif
+#ifndef TkpDisplayWarning_TCL_DECLARED
+#define TkpDisplayWarning_TCL_DECLARED
/* 58 */
-EXTERN void TkpDisplayWarning _ANSI_ARGS_((CONST char * msg,
- CONST char * title));
+EXTERN void TkpDisplayWarning(CONST char *msg, CONST char *title);
+#endif
+#ifndef TkpGetAppName_TCL_DECLARED
+#define TkpGetAppName_TCL_DECLARED
/* 59 */
-EXTERN void TkpGetAppName _ANSI_ARGS_((Tcl_Interp * interp,
- Tcl_DString * name));
+EXTERN void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name);
+#endif
+#ifndef TkpGetOtherWindow_TCL_DECLARED
+#define TkpGetOtherWindow_TCL_DECLARED
/* 60 */
-EXTERN TkWindow * TkpGetOtherWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN TkWindow * TkpGetOtherWindow(TkWindow *winPtr);
+#endif
+#ifndef TkpGetWrapperWindow_TCL_DECLARED
+#define TkpGetWrapperWindow_TCL_DECLARED
/* 61 */
-EXTERN TkWindow * TkpGetWrapperWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN TkWindow * TkpGetWrapperWindow(TkWindow *winPtr);
+#endif
+#ifndef TkpInit_TCL_DECLARED
+#define TkpInit_TCL_DECLARED
/* 62 */
-EXTERN int TkpInit _ANSI_ARGS_((Tcl_Interp * interp));
+EXTERN int TkpInit(Tcl_Interp *interp);
+#endif
+#ifndef TkpInitializeMenuBindings_TCL_DECLARED
+#define TkpInitializeMenuBindings_TCL_DECLARED
/* 63 */
-EXTERN void TkpInitializeMenuBindings _ANSI_ARGS_((
- Tcl_Interp * interp,
- Tk_BindingTable bindingTable));
+EXTERN void TkpInitializeMenuBindings(Tcl_Interp *interp,
+ Tk_BindingTable bindingTable);
+#endif
+#ifndef TkpMakeContainer_TCL_DECLARED
+#define TkpMakeContainer_TCL_DECLARED
/* 64 */
-EXTERN void TkpMakeContainer _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void TkpMakeContainer(Tk_Window tkwin);
+#endif
+#ifndef TkpMakeMenuWindow_TCL_DECLARED
+#define TkpMakeMenuWindow_TCL_DECLARED
/* 65 */
-EXTERN void TkpMakeMenuWindow _ANSI_ARGS_((Tk_Window tkwin,
- int transient));
+EXTERN void TkpMakeMenuWindow(Tk_Window tkwin, int transient);
+#endif
+#ifndef TkpMakeWindow_TCL_DECLARED
+#define TkpMakeWindow_TCL_DECLARED
/* 66 */
-EXTERN Window TkpMakeWindow _ANSI_ARGS_((TkWindow * winPtr,
- Window parent));
+EXTERN Window TkpMakeWindow(TkWindow *winPtr, Window parent);
+#endif
+#ifndef TkpMenuNotifyToplevelCreate_TCL_DECLARED
+#define TkpMenuNotifyToplevelCreate_TCL_DECLARED
/* 67 */
-EXTERN void TkpMenuNotifyToplevelCreate _ANSI_ARGS_((
- Tcl_Interp * interp1, char * menuName));
+EXTERN void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp1,
+ char *menuName);
+#endif
+#ifndef TkpOpenDisplay_TCL_DECLARED
+#define TkpOpenDisplay_TCL_DECLARED
/* 68 */
-EXTERN TkDisplay * TkpOpenDisplay _ANSI_ARGS_((
- CONST char * display_name));
+EXTERN TkDisplay * TkpOpenDisplay(CONST char *display_name);
+#endif
+#ifndef TkPointerEvent_TCL_DECLARED
+#define TkPointerEvent_TCL_DECLARED
/* 69 */
-EXTERN int TkPointerEvent _ANSI_ARGS_((XEvent * eventPtr,
- TkWindow * winPtr));
+EXTERN int TkPointerEvent(XEvent *eventPtr, TkWindow *winPtr);
+#endif
+#ifndef TkPolygonToArea_TCL_DECLARED
+#define TkPolygonToArea_TCL_DECLARED
/* 70 */
-EXTERN int TkPolygonToArea _ANSI_ARGS_((double * polyPtr,
- int numPoints, double * rectPtr));
+EXTERN int TkPolygonToArea(double *polyPtr, int numPoints,
+ double *rectPtr);
+#endif
+#ifndef TkPolygonToPoint_TCL_DECLARED
+#define TkPolygonToPoint_TCL_DECLARED
/* 71 */
-EXTERN double TkPolygonToPoint _ANSI_ARGS_((double * polyPtr,
- int numPoints, double * pointPtr));
+EXTERN double TkPolygonToPoint(double *polyPtr, int numPoints,
+ double *pointPtr);
+#endif
+#ifndef TkPositionInTree_TCL_DECLARED
+#define TkPositionInTree_TCL_DECLARED
/* 72 */
-EXTERN int TkPositionInTree _ANSI_ARGS_((TkWindow * winPtr,
- TkWindow * treePtr));
+EXTERN int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr);
+#endif
+#ifndef TkpRedirectKeyEvent_TCL_DECLARED
+#define TkpRedirectKeyEvent_TCL_DECLARED
/* 73 */
-EXTERN void TkpRedirectKeyEvent _ANSI_ARGS_((TkWindow * winPtr,
- XEvent * eventPtr));
+EXTERN void TkpRedirectKeyEvent(TkWindow *winPtr,
+ XEvent *eventPtr);
+#endif
+#ifndef TkpSetMainMenubar_TCL_DECLARED
+#define TkpSetMainMenubar_TCL_DECLARED
/* 74 */
-EXTERN void TkpSetMainMenubar _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, char * menuName));
+EXTERN void TkpSetMainMenubar(Tcl_Interp *interp,
+ Tk_Window tkwin, char *menuName);
+#endif
+#ifndef TkpUseWindow_TCL_DECLARED
+#define TkpUseWindow_TCL_DECLARED
/* 75 */
-EXTERN int TkpUseWindow _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, CONST char * string));
+EXTERN int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *string);
+#endif
+#ifndef TkpWindowWasRecentlyDeleted_TCL_DECLARED
+#define TkpWindowWasRecentlyDeleted_TCL_DECLARED
/* 76 */
-EXTERN int TkpWindowWasRecentlyDeleted _ANSI_ARGS_((Window win,
- TkDisplay * dispPtr));
+EXTERN int TkpWindowWasRecentlyDeleted(Window win,
+ TkDisplay *dispPtr);
+#endif
+#ifndef TkQueueEventForAllChildren_TCL_DECLARED
+#define TkQueueEventForAllChildren_TCL_DECLARED
/* 77 */
-EXTERN void TkQueueEventForAllChildren _ANSI_ARGS_((
- TkWindow * winPtr, XEvent * eventPtr));
+EXTERN void TkQueueEventForAllChildren(TkWindow *winPtr,
+ XEvent *eventPtr);
+#endif
+#ifndef TkReadBitmapFile_TCL_DECLARED
+#define TkReadBitmapFile_TCL_DECLARED
/* 78 */
-EXTERN int TkReadBitmapFile _ANSI_ARGS_((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));
+EXTERN 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);
+#endif
+#ifndef TkScrollWindow_TCL_DECLARED
+#define TkScrollWindow_TCL_DECLARED
/* 79 */
-EXTERN int TkScrollWindow _ANSI_ARGS_((Tk_Window tkwin, GC gc,
- int x, int y, int width, int height, int dx,
- int dy, TkRegion damageRgn));
+EXTERN int TkScrollWindow(Tk_Window tkwin, GC gc, int x, int y,
+ int width, int height, int dx, int dy,
+ TkRegion damageRgn);
+#endif
+#ifndef TkSelDeadWindow_TCL_DECLARED
+#define TkSelDeadWindow_TCL_DECLARED
/* 80 */
-EXTERN void TkSelDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkSelDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkSelEventProc_TCL_DECLARED
+#define TkSelEventProc_TCL_DECLARED
/* 81 */
-EXTERN void TkSelEventProc _ANSI_ARGS_((Tk_Window tkwin,
- XEvent * eventPtr));
+EXTERN void TkSelEventProc(Tk_Window tkwin, XEvent *eventPtr);
+#endif
+#ifndef TkSelInit_TCL_DECLARED
+#define TkSelInit_TCL_DECLARED
/* 82 */
-EXTERN void TkSelInit _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void TkSelInit(Tk_Window tkwin);
+#endif
+#ifndef TkSelPropProc_TCL_DECLARED
+#define TkSelPropProc_TCL_DECLARED
/* 83 */
-EXTERN void TkSelPropProc _ANSI_ARGS_((XEvent * eventPtr));
+EXTERN void TkSelPropProc(XEvent *eventPtr);
+#endif
/* Slot 84 is reserved */
+#ifndef TkSetWindowMenuBar_TCL_DECLARED
+#define TkSetWindowMenuBar_TCL_DECLARED
/* 85 */
-EXTERN void TkSetWindowMenuBar _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, char * oldMenuName,
- char * menuName));
+EXTERN void TkSetWindowMenuBar(Tcl_Interp *interp,
+ Tk_Window tkwin, char *oldMenuName,
+ char *menuName);
+#endif
+#ifndef TkStringToKeysym_TCL_DECLARED
+#define TkStringToKeysym_TCL_DECLARED
/* 86 */
-EXTERN KeySym TkStringToKeysym _ANSI_ARGS_((char * name));
+EXTERN KeySym TkStringToKeysym(char *name);
+#endif
+#ifndef TkThickPolyLineToArea_TCL_DECLARED
+#define TkThickPolyLineToArea_TCL_DECLARED
/* 87 */
-EXTERN int TkThickPolyLineToArea _ANSI_ARGS_((double * coordPtr,
- int numPoints, double width, int capStyle,
- int joinStyle, double * rectPtr));
+EXTERN int TkThickPolyLineToArea(double *coordPtr,
+ int numPoints, double width, int capStyle,
+ int joinStyle, double *rectPtr);
+#endif
+#ifndef TkWmAddToColormapWindows_TCL_DECLARED
+#define TkWmAddToColormapWindows_TCL_DECLARED
/* 88 */
-EXTERN void TkWmAddToColormapWindows _ANSI_ARGS_((
- TkWindow * winPtr));
+EXTERN void TkWmAddToColormapWindows(TkWindow *winPtr);
+#endif
+#ifndef TkWmDeadWindow_TCL_DECLARED
+#define TkWmDeadWindow_TCL_DECLARED
/* 89 */
-EXTERN void TkWmDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkWmDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkWmFocusToplevel_TCL_DECLARED
+#define TkWmFocusToplevel_TCL_DECLARED
/* 90 */
-EXTERN TkWindow * TkWmFocusToplevel _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN TkWindow * TkWmFocusToplevel(TkWindow *winPtr);
+#endif
+#ifndef TkWmMapWindow_TCL_DECLARED
+#define TkWmMapWindow_TCL_DECLARED
/* 91 */
-EXTERN void TkWmMapWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkWmMapWindow(TkWindow *winPtr);
+#endif
+#ifndef TkWmNewWindow_TCL_DECLARED
+#define TkWmNewWindow_TCL_DECLARED
/* 92 */
-EXTERN void TkWmNewWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkWmNewWindow(TkWindow *winPtr);
+#endif
+#ifndef TkWmProtocolEventProc_TCL_DECLARED
+#define TkWmProtocolEventProc_TCL_DECLARED
/* 93 */
-EXTERN void TkWmProtocolEventProc _ANSI_ARGS_((TkWindow * winPtr,
- XEvent * evenvPtr));
+EXTERN void TkWmProtocolEventProc(TkWindow *winPtr,
+ XEvent *evenvPtr);
+#endif
+#ifndef TkWmRemoveFromColormapWindows_TCL_DECLARED
+#define TkWmRemoveFromColormapWindows_TCL_DECLARED
/* 94 */
-EXTERN void TkWmRemoveFromColormapWindows _ANSI_ARGS_((
- TkWindow * winPtr));
+EXTERN void TkWmRemoveFromColormapWindows(TkWindow *winPtr);
+#endif
+#ifndef TkWmRestackToplevel_TCL_DECLARED
+#define TkWmRestackToplevel_TCL_DECLARED
/* 95 */
-EXTERN void TkWmRestackToplevel _ANSI_ARGS_((TkWindow * winPtr,
- int aboveBelow, TkWindow * otherPtr));
+EXTERN void TkWmRestackToplevel(TkWindow *winPtr, int aboveBelow,
+ TkWindow *otherPtr);
+#endif
+#ifndef TkWmSetClass_TCL_DECLARED
+#define TkWmSetClass_TCL_DECLARED
/* 96 */
-EXTERN void TkWmSetClass _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkWmSetClass(TkWindow *winPtr);
+#endif
+#ifndef TkWmUnmapWindow_TCL_DECLARED
+#define TkWmUnmapWindow_TCL_DECLARED
/* 97 */
-EXTERN void TkWmUnmapWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkWmUnmapWindow(TkWindow *winPtr);
+#endif
+#ifndef TkDebugBitmap_TCL_DECLARED
+#define TkDebugBitmap_TCL_DECLARED
/* 98 */
-EXTERN Tcl_Obj * TkDebugBitmap _ANSI_ARGS_((Tk_Window tkwin,
- char * name));
+EXTERN Tcl_Obj * TkDebugBitmap(Tk_Window tkwin, char *name);
+#endif
+#ifndef TkDebugBorder_TCL_DECLARED
+#define TkDebugBorder_TCL_DECLARED
/* 99 */
-EXTERN Tcl_Obj * TkDebugBorder _ANSI_ARGS_((Tk_Window tkwin,
- char * name));
+EXTERN Tcl_Obj * TkDebugBorder(Tk_Window tkwin, char *name);
+#endif
+#ifndef TkDebugCursor_TCL_DECLARED
+#define TkDebugCursor_TCL_DECLARED
/* 100 */
-EXTERN Tcl_Obj * TkDebugCursor _ANSI_ARGS_((Tk_Window tkwin,
- char * name));
+EXTERN Tcl_Obj * TkDebugCursor(Tk_Window tkwin, char *name);
+#endif
+#ifndef TkDebugColor_TCL_DECLARED
+#define TkDebugColor_TCL_DECLARED
/* 101 */
-EXTERN Tcl_Obj * TkDebugColor _ANSI_ARGS_((Tk_Window tkwin,
- char * name));
+EXTERN Tcl_Obj * TkDebugColor(Tk_Window tkwin, char *name);
+#endif
+#ifndef TkDebugConfig_TCL_DECLARED
+#define TkDebugConfig_TCL_DECLARED
/* 102 */
-EXTERN Tcl_Obj * TkDebugConfig _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_OptionTable table));
+EXTERN Tcl_Obj * TkDebugConfig(Tcl_Interp *interp,
+ Tk_OptionTable table);
+#endif
+#ifndef TkDebugFont_TCL_DECLARED
+#define TkDebugFont_TCL_DECLARED
/* 103 */
-EXTERN Tcl_Obj * TkDebugFont _ANSI_ARGS_((Tk_Window tkwin,
- char * name));
+EXTERN Tcl_Obj * TkDebugFont(Tk_Window tkwin, char *name);
+#endif
+#ifndef TkFindStateNumObj_TCL_DECLARED
+#define TkFindStateNumObj_TCL_DECLARED
/* 104 */
-EXTERN int TkFindStateNumObj _ANSI_ARGS_((Tcl_Interp * interp,
- Tcl_Obj * optionPtr,
- CONST TkStateMap * mapPtr, Tcl_Obj * keyPtr));
+EXTERN int TkFindStateNumObj(Tcl_Interp *interp,
+ Tcl_Obj *optionPtr, CONST TkStateMap *mapPtr,
+ Tcl_Obj *keyPtr);
+#endif
+#ifndef TkGetBitmapPredefTable_TCL_DECLARED
+#define TkGetBitmapPredefTable_TCL_DECLARED
/* 105 */
-EXTERN Tcl_HashTable * TkGetBitmapPredefTable _ANSI_ARGS_((void));
+EXTERN Tcl_HashTable * TkGetBitmapPredefTable(void);
+#endif
+#ifndef TkGetDisplayList_TCL_DECLARED
+#define TkGetDisplayList_TCL_DECLARED
/* 106 */
-EXTERN TkDisplay * TkGetDisplayList _ANSI_ARGS_((void));
+EXTERN TkDisplay * TkGetDisplayList(void);
+#endif
+#ifndef TkGetMainInfoList_TCL_DECLARED
+#define TkGetMainInfoList_TCL_DECLARED
/* 107 */
-EXTERN TkMainInfo * TkGetMainInfoList _ANSI_ARGS_((void));
+EXTERN TkMainInfo * TkGetMainInfoList(void);
+#endif
+#ifndef TkGetWindowFromObj_TCL_DECLARED
+#define TkGetWindowFromObj_TCL_DECLARED
/* 108 */
-EXTERN int TkGetWindowFromObj _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, Tcl_Obj * objPtr,
- Tk_Window * windowPtr));
+EXTERN int TkGetWindowFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr,
+ Tk_Window *windowPtr);
+#endif
+#ifndef TkpGetString_TCL_DECLARED
+#define TkpGetString_TCL_DECLARED
/* 109 */
-EXTERN char * TkpGetString _ANSI_ARGS_((TkWindow * winPtr,
- XEvent * eventPtr, Tcl_DString * dsPtr));
+EXTERN char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr,
+ Tcl_DString *dsPtr);
+#endif
+#ifndef TkpGetSubFonts_TCL_DECLARED
+#define TkpGetSubFonts_TCL_DECLARED
/* 110 */
-EXTERN void TkpGetSubFonts _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Font tkfont));
+EXTERN void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont);
+#endif
+#ifndef TkpGetSystemDefault_TCL_DECLARED
+#define TkpGetSystemDefault_TCL_DECLARED
/* 111 */
-EXTERN Tcl_Obj * TkpGetSystemDefault _ANSI_ARGS_((Tk_Window tkwin,
- CONST char * dbName, CONST char * className));
+EXTERN Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin,
+ CONST char *dbName, CONST char *className);
+#endif
+#ifndef TkpMenuThreadInit_TCL_DECLARED
+#define TkpMenuThreadInit_TCL_DECLARED
/* 112 */
-EXTERN void TkpMenuThreadInit _ANSI_ARGS_((void));
-#ifdef __WIN32__
-/* 113 */
-EXTERN void TkClipBox _ANSI_ARGS_((TkRegion rgn,
- XRectangle* rect_return));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN void TkpMenuThreadInit(void);
+#endif
+#ifdef __WIN32__ /* WIN */
+#ifndef TkClipBox_TCL_DECLARED
+#define TkClipBox_TCL_DECLARED
/* 113 */
-EXTERN void TkClipBox _ANSI_ARGS_((TkRegion rgn,
- XRectangle* rect_return));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkClipBox_TCL_DECLARED
+#define TkClipBox_TCL_DECLARED
/* 113 */
-EXTERN void TkClipBox _ANSI_ARGS_((TkRegion rgn,
- XRectangle* rect_return));
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-/* 114 */
-EXTERN TkRegion TkCreateRegion _ANSI_ARGS_((void));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return);
+#endif
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
+#ifndef TkCreateRegion_TCL_DECLARED
+#define TkCreateRegion_TCL_DECLARED
/* 114 */
-EXTERN TkRegion TkCreateRegion _ANSI_ARGS_((void));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN TkRegion TkCreateRegion(void);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkCreateRegion_TCL_DECLARED
+#define TkCreateRegion_TCL_DECLARED
/* 114 */
-EXTERN TkRegion TkCreateRegion _ANSI_ARGS_((void));
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-/* 115 */
-EXTERN void TkDestroyRegion _ANSI_ARGS_((TkRegion rgn));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN TkRegion TkCreateRegion(void);
+#endif
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
+#ifndef TkDestroyRegion_TCL_DECLARED
+#define TkDestroyRegion_TCL_DECLARED
/* 115 */
-EXTERN void TkDestroyRegion _ANSI_ARGS_((TkRegion rgn));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN void TkDestroyRegion(TkRegion rgn);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkDestroyRegion_TCL_DECLARED
+#define TkDestroyRegion_TCL_DECLARED
/* 115 */
-EXTERN void TkDestroyRegion _ANSI_ARGS_((TkRegion rgn));
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-/* 116 */
-EXTERN void TkIntersectRegion _ANSI_ARGS_((TkRegion sra,
- TkRegion srcb, TkRegion dr_return));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN void TkDestroyRegion(TkRegion rgn);
+#endif
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
+#ifndef TkIntersectRegion_TCL_DECLARED
+#define TkIntersectRegion_TCL_DECLARED
/* 116 */
-EXTERN void TkIntersectRegion _ANSI_ARGS_((TkRegion sra,
- TkRegion srcb, TkRegion dr_return));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb,
+ TkRegion dr_return);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkIntersectRegion_TCL_DECLARED
+#define TkIntersectRegion_TCL_DECLARED
/* 116 */
-EXTERN void TkIntersectRegion _ANSI_ARGS_((TkRegion sra,
- TkRegion srcb, TkRegion dr_return));
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-/* 117 */
-EXTERN int TkRectInRegion _ANSI_ARGS_((TkRegion rgn, int x,
- int y, unsigned int width,
- unsigned int height));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb,
+ TkRegion dr_return);
+#endif
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
+#ifndef TkRectInRegion_TCL_DECLARED
+#define TkRectInRegion_TCL_DECLARED
/* 117 */
-EXTERN int TkRectInRegion _ANSI_ARGS_((TkRegion rgn, int x,
- int y, unsigned int width,
- unsigned int height));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN int TkRectInRegion(TkRegion rgn, int x, int y,
+ unsigned int width, unsigned int height);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkRectInRegion_TCL_DECLARED
+#define TkRectInRegion_TCL_DECLARED
/* 117 */
-EXTERN int TkRectInRegion _ANSI_ARGS_((TkRegion rgn, int x,
- int y, unsigned int width,
- unsigned int height));
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-/* 118 */
-EXTERN void TkSetRegion _ANSI_ARGS_((Display* display, GC gc,
- TkRegion rgn));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN int TkRectInRegion(TkRegion rgn, int x, int y,
+ unsigned int width, unsigned int height);
+#endif
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
+#ifndef TkSetRegion_TCL_DECLARED
+#define TkSetRegion_TCL_DECLARED
/* 118 */
-EXTERN void TkSetRegion _ANSI_ARGS_((Display* display, GC gc,
- TkRegion rgn));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkSetRegion_TCL_DECLARED
+#define TkSetRegion_TCL_DECLARED
/* 118 */
-EXTERN void TkSetRegion _ANSI_ARGS_((Display* display, GC gc,
- TkRegion rgn));
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-/* 119 */
-EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle* rect,
- TkRegion src, TkRegion dr_return));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn);
+#endif
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
+#ifndef TkUnionRectWithRegion_TCL_DECLARED
+#define TkUnionRectWithRegion_TCL_DECLARED
/* 119 */
-EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle* rect,
- TkRegion src, TkRegion dr_return));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
+ TkRegion dr_return);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkUnionRectWithRegion_TCL_DECLARED
+#define TkUnionRectWithRegion_TCL_DECLARED
/* 119 */
-EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle* rect,
- TkRegion src, TkRegion dr_return));
-#endif /* MAC_OSX_TK */
+EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
+ TkRegion dr_return);
+#endif
+#endif /* AQUA */
/* Slot 120 is reserved */
-#ifdef MAC_TCL
-/* 121 */
-EXTERN Pixmap TkpCreateNativeBitmap _ANSI_ARGS_((Display * display,
- CONST char * source));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkpCreateNativeBitmap_TCL_DECLARED
+#define TkpCreateNativeBitmap_TCL_DECLARED
/* 121 */
-EXTERN Pixmap TkpCreateNativeBitmap _ANSI_ARGS_((Display * display,
- CONST char * source));
-#endif /* MAC_OSX_TK */
-#ifdef MAC_TCL
-/* 122 */
-EXTERN void TkpDefineNativeBitmaps _ANSI_ARGS_((void));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN Pixmap TkpCreateNativeBitmap(Display *display,
+ CONST char *source);
+#endif
+#endif /* AQUA */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkpDefineNativeBitmaps_TCL_DECLARED
+#define TkpDefineNativeBitmaps_TCL_DECLARED
/* 122 */
-EXTERN void TkpDefineNativeBitmaps _ANSI_ARGS_((void));
-#endif /* MAC_OSX_TK */
+EXTERN void TkpDefineNativeBitmaps(void);
+#endif
+#endif /* AQUA */
/* Slot 123 is reserved */
-#ifdef MAC_TCL
-/* 124 */
-EXTERN Pixmap TkpGetNativeAppBitmap _ANSI_ARGS_((Display * display,
- CONST char * name, int * width, int * height));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkpGetNativeAppBitmap_TCL_DECLARED
+#define TkpGetNativeAppBitmap_TCL_DECLARED
/* 124 */
-EXTERN Pixmap TkpGetNativeAppBitmap _ANSI_ARGS_((Display * display,
- CONST char * name, int * width, int * height));
-#endif /* MAC_OSX_TK */
+EXTERN Pixmap TkpGetNativeAppBitmap(Display *display,
+ CONST char *name, int *width, int *height);
+#endif
+#endif /* AQUA */
/* Slot 125 is reserved */
/* Slot 126 is reserved */
/* Slot 127 is reserved */
@@ -508,343 +805,524 @@ EXTERN Pixmap TkpGetNativeAppBitmap _ANSI_ARGS_((Display * display,
/* Slot 132 is reserved */
/* Slot 133 is reserved */
/* Slot 134 is reserved */
+#ifndef TkpDrawHighlightBorder_TCL_DECLARED
+#define TkpDrawHighlightBorder_TCL_DECLARED
/* 135 */
-EXTERN void TkpDrawHighlightBorder _ANSI_ARGS_((Tk_Window tkwin,
- GC fgGC, GC bgGC, int highlightWidth,
- Drawable drawable));
+EXTERN void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC,
+ GC bgGC, int highlightWidth,
+ Drawable drawable);
+#endif
+#ifndef TkSetFocusWin_TCL_DECLARED
+#define TkSetFocusWin_TCL_DECLARED
/* 136 */
-EXTERN void TkSetFocusWin _ANSI_ARGS_((TkWindow * winPtr,
- int force));
+EXTERN void TkSetFocusWin(TkWindow *winPtr, int force);
+#endif
+#ifndef TkpSetKeycodeAndState_TCL_DECLARED
+#define TkpSetKeycodeAndState_TCL_DECLARED
/* 137 */
-EXTERN void TkpSetKeycodeAndState _ANSI_ARGS_((Tk_Window tkwin,
- KeySym keySym, XEvent * eventPtr));
+EXTERN void TkpSetKeycodeAndState(Tk_Window tkwin, KeySym keySym,
+ XEvent *eventPtr);
+#endif
+#ifndef TkpGetKeySym_TCL_DECLARED
+#define TkpGetKeySym_TCL_DECLARED
/* 138 */
-EXTERN KeySym TkpGetKeySym _ANSI_ARGS_((TkDisplay * dispPtr,
- XEvent * eventPtr));
+EXTERN KeySym TkpGetKeySym(TkDisplay *dispPtr, XEvent *eventPtr);
+#endif
+#ifndef TkpInitKeymapInfo_TCL_DECLARED
+#define TkpInitKeymapInfo_TCL_DECLARED
/* 139 */
-EXTERN void TkpInitKeymapInfo _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN void TkpInitKeymapInfo(TkDisplay *dispPtr);
+#endif
+#ifndef TkPhotoGetValidRegion_TCL_DECLARED
+#define TkPhotoGetValidRegion_TCL_DECLARED
/* 140 */
-EXTERN TkRegion TkPhotoGetValidRegion _ANSI_ARGS_((
- Tk_PhotoHandle handle));
+EXTERN TkRegion TkPhotoGetValidRegion(Tk_PhotoHandle handle);
+#endif
+#ifndef TkWmStackorderToplevel_TCL_DECLARED
+#define TkWmStackorderToplevel_TCL_DECLARED
/* 141 */
-EXTERN TkWindow ** TkWmStackorderToplevel _ANSI_ARGS_((
- TkWindow * parentPtr));
+EXTERN TkWindow ** TkWmStackorderToplevel(TkWindow *parentPtr);
+#endif
+#ifndef TkFocusFree_TCL_DECLARED
+#define TkFocusFree_TCL_DECLARED
/* 142 */
-EXTERN void TkFocusFree _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkFocusFree(TkMainInfo *mainPtr);
+#endif
+#ifndef TkClipCleanup_TCL_DECLARED
+#define TkClipCleanup_TCL_DECLARED
/* 143 */
-EXTERN void TkClipCleanup _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN void TkClipCleanup(TkDisplay *dispPtr);
+#endif
+#ifndef TkGCCleanup_TCL_DECLARED
+#define TkGCCleanup_TCL_DECLARED
/* 144 */
-EXTERN void TkGCCleanup _ANSI_ARGS_((TkDisplay * dispPtr));
-#ifdef __WIN32__
-/* 145 */
-EXTERN void TkSubtractRegion _ANSI_ARGS_((TkRegion sra,
- TkRegion srcb, TkRegion dr_return));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+EXTERN void TkGCCleanup(TkDisplay *dispPtr);
+#endif
+#ifdef __WIN32__ /* WIN */
+#ifndef TkSubtractRegion_TCL_DECLARED
+#define TkSubtractRegion_TCL_DECLARED
/* 145 */
-EXTERN void TkSubtractRegion _ANSI_ARGS_((TkRegion sra,
- TkRegion srcb, TkRegion dr_return));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb,
+ TkRegion dr_return);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkSubtractRegion_TCL_DECLARED
+#define TkSubtractRegion_TCL_DECLARED
/* 145 */
-EXTERN void TkSubtractRegion _ANSI_ARGS_((TkRegion sra,
- TkRegion srcb, TkRegion dr_return));
-#endif /* MAC_OSX_TK */
+EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb,
+ TkRegion dr_return);
+#endif
+#endif /* AQUA */
+#ifndef TkStylePkgInit_TCL_DECLARED
+#define TkStylePkgInit_TCL_DECLARED
/* 146 */
-EXTERN void TkStylePkgInit _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkStylePkgInit(TkMainInfo *mainPtr);
+#endif
+#ifndef TkStylePkgFree_TCL_DECLARED
+#define TkStylePkgFree_TCL_DECLARED
/* 147 */
-EXTERN void TkStylePkgFree _ANSI_ARGS_((TkMainInfo * mainPtr));
+EXTERN void TkStylePkgFree(TkMainInfo *mainPtr);
+#endif
+#ifndef TkToplevelWindowForCommand_TCL_DECLARED
+#define TkToplevelWindowForCommand_TCL_DECLARED
/* 148 */
-EXTERN Tk_Window TkToplevelWindowForCommand _ANSI_ARGS_((
- Tcl_Interp * interp, CONST char * cmdName));
+EXTERN Tk_Window TkToplevelWindowForCommand(Tcl_Interp *interp,
+ CONST char *cmdName);
+#endif
+#ifndef TkGetOptionSpec_TCL_DECLARED
+#define TkGetOptionSpec_TCL_DECLARED
/* 149 */
-EXTERN CONST Tk_OptionSpec * TkGetOptionSpec _ANSI_ARGS_((CONST char * name,
- Tk_OptionTable optionTable));
-/* Slot 150 is reserved */
-/* Slot 151 is reserved */
+EXTERN CONST Tk_OptionSpec * TkGetOptionSpec(CONST char *name,
+ Tk_OptionTable optionTable);
+#endif
+#ifndef TkMakeRawCurve_TCL_DECLARED
+#define TkMakeRawCurve_TCL_DECLARED
+/* 150 */
+EXTERN int TkMakeRawCurve(Tk_Canvas canvas, double *pointPtr,
+ int numPoints, int numSteps,
+ XPoint xPoints[], double dblPoints[]);
+#endif
+#ifndef TkMakeRawCurvePostscript_TCL_DECLARED
+#define TkMakeRawCurvePostscript_TCL_DECLARED
+/* 151 */
+EXTERN void TkMakeRawCurvePostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, double *pointPtr,
+ int numPoints);
+#endif
+#ifndef TkpDrawFrame_TCL_DECLARED
+#define TkpDrawFrame_TCL_DECLARED
/* 152 */
-EXTERN void TkpDrawFrame _ANSI_ARGS_((Tk_Window tkwin,
- Tk_3DBorder border, int highlightWidth,
- int borderWidth, int relief));
+EXTERN void TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border,
+ int highlightWidth, int borderWidth,
+ int relief);
+#endif
+#ifndef TkCreateThreadExitHandler_TCL_DECLARED
+#define TkCreateThreadExitHandler_TCL_DECLARED
+/* 153 */
+EXTERN void TkCreateThreadExitHandler(Tcl_ExitProc *proc,
+ ClientData clientData);
+#endif
+#ifndef TkDeleteThreadExitHandler_TCL_DECLARED
+#define TkDeleteThreadExitHandler_TCL_DECLARED
+/* 154 */
+EXTERN void TkDeleteThreadExitHandler(Tcl_ExitProc *proc,
+ ClientData clientData);
+#endif
+/* Slot 155 is reserved */
+#ifndef TkpTestembedCmd_TCL_DECLARED
+#define TkpTestembedCmd_TCL_DECLARED
+/* 156 */
+EXTERN int TkpTestembedCmd(ClientData clientData,
+ Tcl_Interp *interp, int argc,
+ CONST char **argv);
+#endif
+#ifndef TkpTesttextCmd_TCL_DECLARED
+#define TkpTesttextCmd_TCL_DECLARED
+/* 157 */
+EXTERN int TkpTesttextCmd(ClientData dummy, Tcl_Interp *interp,
+ int argc, CONST char **argv);
+#endif
+/* Slot 158 is reserved */
+/* Slot 159 is reserved */
+/* Slot 160 is reserved */
+/* Slot 161 is reserved */
+/* Slot 162 is reserved */
+/* Slot 163 is reserved */
+/* Slot 164 is reserved */
+/* Slot 165 is reserved */
+/* Slot 166 is reserved */
+/* Slot 167 is reserved */
+/* Slot 168 is reserved */
+#ifndef TkStateParseProc_TCL_DECLARED
+#define TkStateParseProc_TCL_DECLARED
+/* 169 */
+EXTERN int TkStateParseProc(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *value, char *widgRec, int offset);
+#endif
+#ifndef TkStatePrintProc_TCL_DECLARED
+#define TkStatePrintProc_TCL_DECLARED
+/* 170 */
+EXTERN char * TkStatePrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec, int offset,
+ Tcl_FreeProc **freeProcPtr);
+#endif
+#ifndef TkCanvasDashParseProc_TCL_DECLARED
+#define TkCanvasDashParseProc_TCL_DECLARED
+/* 171 */
+EXTERN int TkCanvasDashParseProc(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *value, char *widgRec, int offset);
+#endif
+#ifndef TkCanvasDashPrintProc_TCL_DECLARED
+#define TkCanvasDashPrintProc_TCL_DECLARED
+/* 172 */
+EXTERN char * TkCanvasDashPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec, int offset,
+ Tcl_FreeProc **freeProcPtr);
+#endif
+#ifndef TkOffsetParseProc_TCL_DECLARED
+#define TkOffsetParseProc_TCL_DECLARED
+/* 173 */
+EXTERN int TkOffsetParseProc(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *value, char *widgRec, int offset);
+#endif
+#ifndef TkOffsetPrintProc_TCL_DECLARED
+#define TkOffsetPrintProc_TCL_DECLARED
+/* 174 */
+EXTERN char * TkOffsetPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec, int offset,
+ Tcl_FreeProc **freeProcPtr);
+#endif
+#ifndef TkPixelParseProc_TCL_DECLARED
+#define TkPixelParseProc_TCL_DECLARED
+/* 175 */
+EXTERN int TkPixelParseProc(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *value, char *widgRec, int offset);
+#endif
+#ifndef TkPixelPrintProc_TCL_DECLARED
+#define TkPixelPrintProc_TCL_DECLARED
+/* 176 */
+EXTERN char * TkPixelPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec, int offset,
+ Tcl_FreeProc **freeProcPtr);
+#endif
+#ifndef TkOrientParseProc_TCL_DECLARED
+#define TkOrientParseProc_TCL_DECLARED
+/* 177 */
+EXTERN int TkOrientParseProc(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *value, char *widgRec, int offset);
+#endif
+#ifndef TkOrientPrintProc_TCL_DECLARED
+#define TkOrientPrintProc_TCL_DECLARED
+/* 178 */
+EXTERN char * TkOrientPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec, int offset,
+ Tcl_FreeProc **freeProcPtr);
+#endif
+#ifndef TkSmoothParseProc_TCL_DECLARED
+#define TkSmoothParseProc_TCL_DECLARED
+/* 179 */
+EXTERN int TkSmoothParseProc(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ CONST char *value, char *widgRec, int offset);
+#endif
+#ifndef TkSmoothPrintProc_TCL_DECLARED
+#define TkSmoothPrintProc_TCL_DECLARED
+/* 180 */
+EXTERN char * TkSmoothPrintProc(ClientData clientData,
+ Tk_Window tkwin, char *widgRec, int offset,
+ Tcl_FreeProc **freeProcPtr);
+#endif
typedef struct TkIntStubs {
int magic;
struct TkIntStubHooks *hooks;
- TkWindow * (*tkAllocWindow) _ANSI_ARGS_((TkDisplay * dispPtr, int screenNum, TkWindow * parentPtr)); /* 0 */
- void (*tkBezierPoints) _ANSI_ARGS_((double control[], int numSteps, double * coordPtr)); /* 1 */
- void (*tkBezierScreenPoints) _ANSI_ARGS_((Tk_Canvas canvas, double control[], int numSteps, XPoint * xPointPtr)); /* 2 */
- void (*tkBindDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 3 */
- void (*tkBindEventProc) _ANSI_ARGS_((TkWindow * winPtr, XEvent * eventPtr)); /* 4 */
- void (*tkBindFree) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 5 */
- void (*tkBindInit) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 6 */
- void (*tkChangeEventWindow) _ANSI_ARGS_((XEvent * eventPtr, TkWindow * winPtr)); /* 7 */
- int (*tkClipInit) _ANSI_ARGS_((Tcl_Interp * interp, TkDisplay * dispPtr)); /* 8 */
- void (*tkComputeAnchor) _ANSI_ARGS_((Tk_Anchor anchor, Tk_Window tkwin, int padX, int padY, int innerWidth, int innerHeight, int * xPtr, int * yPtr)); /* 9 */
- int (*tkCopyAndGlobalEval) _ANSI_ARGS_((Tcl_Interp * interp, char * script)); /* 10 */
- unsigned long (*tkCreateBindingProcedure) _ANSI_ARGS_((Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventString, TkBindEvalProc * evalProc, TkBindFreeProc * freeProc, ClientData clientData)); /* 11 */
- TkCursor * (*tkCreateCursorFromData) _ANSI_ARGS_((Tk_Window tkwin, CONST char * source, CONST char * mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg)); /* 12 */
- int (*tkCreateFrame) _ANSI_ARGS_((ClientData clientData, Tcl_Interp * interp, int argc, char ** argv, int toplevel, char * appName)); /* 13 */
- Tk_Window (*tkCreateMainWindow) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * screenName, char * baseName)); /* 14 */
- Time (*tkCurrentTime) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 15 */
- void (*tkDeleteAllImages) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 16 */
- void (*tkDoConfigureNotify) _ANSI_ARGS_((TkWindow * winPtr)); /* 17 */
- void (*tkDrawInsetFocusHighlight) _ANSI_ARGS_((Tk_Window tkwin, GC gc, int width, Drawable drawable, int padding)); /* 18 */
- void (*tkEventDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 19 */
- void (*tkFillPolygon) _ANSI_ARGS_((Tk_Canvas canvas, double * coordPtr, int numPoints, Display * display, Drawable drawable, GC gc, GC outlineGC)); /* 20 */
- int (*tkFindStateNum) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * option, CONST TkStateMap * mapPtr, CONST char * strKey)); /* 21 */
- char * (*tkFindStateString) _ANSI_ARGS_((CONST TkStateMap * mapPtr, int numKey)); /* 22 */
- void (*tkFocusDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 23 */
- int (*tkFocusFilterEvent) _ANSI_ARGS_((TkWindow * winPtr, XEvent * eventPtr)); /* 24 */
- TkWindow * (*tkFocusKeyEvent) _ANSI_ARGS_((TkWindow * winPtr, XEvent * eventPtr)); /* 25 */
- void (*tkFontPkgInit) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 26 */
- void (*tkFontPkgFree) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 27 */
- void (*tkFreeBindingTags) _ANSI_ARGS_((TkWindow * winPtr)); /* 28 */
- void (*tkpFreeCursor) _ANSI_ARGS_((TkCursor * cursorPtr)); /* 29 */
- char * (*tkGetBitmapData) _ANSI_ARGS_((Tcl_Interp * interp, char * string, char * fileName, int * widthPtr, int * heightPtr, int * hotXPtr, int * hotYPtr)); /* 30 */
- void (*tkGetButtPoints) _ANSI_ARGS_((double p1[], double p2[], double width, int project, double m1[], double m2[])); /* 31 */
- TkCursor * (*tkGetCursorByName) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid string)); /* 32 */
- CONST84_RETURN char * (*tkGetDefaultScreenName) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * screenName)); /* 33 */
- TkDisplay * (*tkGetDisplay) _ANSI_ARGS_((Display * display)); /* 34 */
- int (*tkGetDisplayOf) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], Tk_Window * tkwinPtr)); /* 35 */
- TkWindow * (*tkGetFocusWin) _ANSI_ARGS_((TkWindow * winPtr)); /* 36 */
- int (*tkGetInterpNames) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin)); /* 37 */
- int (*tkGetMiterPoints) _ANSI_ARGS_((double p1[], double p2[], double p3[], double width, double m1[], double m2[])); /* 38 */
- void (*tkGetPointerCoords) _ANSI_ARGS_((Tk_Window tkwin, int * xPtr, int * yPtr)); /* 39 */
- void (*tkGetServerInfo) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin)); /* 40 */
- void (*tkGrabDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 41 */
- int (*tkGrabState) _ANSI_ARGS_((TkWindow * winPtr)); /* 42 */
- void (*tkIncludePoint) _ANSI_ARGS_((Tk_Item * itemPtr, double * pointPtr)); /* 43 */
- void (*tkInOutEvents) _ANSI_ARGS_((XEvent * eventPtr, TkWindow * sourcePtr, TkWindow * destPtr, int leaveType, int enterType, Tcl_QueuePosition position)); /* 44 */
- void (*tkInstallFrameMenu) _ANSI_ARGS_((Tk_Window tkwin)); /* 45 */
- char * (*tkKeysymToString) _ANSI_ARGS_((KeySym keysym)); /* 46 */
- int (*tkLineToArea) _ANSI_ARGS_((double end1Ptr[], double end2Ptr[], double rectPtr[])); /* 47 */
- double (*tkLineToPoint) _ANSI_ARGS_((double end1Ptr[], double end2Ptr[], double pointPtr[])); /* 48 */
- int (*tkMakeBezierCurve) _ANSI_ARGS_((Tk_Canvas canvas, double * pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[])); /* 49 */
- void (*tkMakeBezierPostscript) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, double * pointPtr, int numPoints)); /* 50 */
- void (*tkOptionClassChanged) _ANSI_ARGS_((TkWindow * winPtr)); /* 51 */
- void (*tkOptionDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 52 */
- int (*tkOvalToArea) _ANSI_ARGS_((double * ovalPtr, double * rectPtr)); /* 53 */
- double (*tkOvalToPoint) _ANSI_ARGS_((double ovalPtr[], double width, int filled, double pointPtr[])); /* 54 */
- int (*tkpChangeFocus) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 55 */
- void (*tkpCloseDisplay) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 56 */
- void (*tkpClaimFocus) _ANSI_ARGS_((TkWindow * topLevelPtr, int force)); /* 57 */
- void (*tkpDisplayWarning) _ANSI_ARGS_((CONST char * msg, CONST char * title)); /* 58 */
- void (*tkpGetAppName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * name)); /* 59 */
- TkWindow * (*tkpGetOtherWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 60 */
- TkWindow * (*tkpGetWrapperWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 61 */
- int (*tkpInit) _ANSI_ARGS_((Tcl_Interp * interp)); /* 62 */
- void (*tkpInitializeMenuBindings) _ANSI_ARGS_((Tcl_Interp * interp, Tk_BindingTable bindingTable)); /* 63 */
- void (*tkpMakeContainer) _ANSI_ARGS_((Tk_Window tkwin)); /* 64 */
- void (*tkpMakeMenuWindow) _ANSI_ARGS_((Tk_Window tkwin, int transient)); /* 65 */
- Window (*tkpMakeWindow) _ANSI_ARGS_((TkWindow * winPtr, Window parent)); /* 66 */
- void (*tkpMenuNotifyToplevelCreate) _ANSI_ARGS_((Tcl_Interp * interp1, char * menuName)); /* 67 */
- TkDisplay * (*tkpOpenDisplay) _ANSI_ARGS_((CONST char * display_name)); /* 68 */
- int (*tkPointerEvent) _ANSI_ARGS_((XEvent * eventPtr, TkWindow * winPtr)); /* 69 */
- int (*tkPolygonToArea) _ANSI_ARGS_((double * polyPtr, int numPoints, double * rectPtr)); /* 70 */
- double (*tkPolygonToPoint) _ANSI_ARGS_((double * polyPtr, int numPoints, double * pointPtr)); /* 71 */
- int (*tkPositionInTree) _ANSI_ARGS_((TkWindow * winPtr, TkWindow * treePtr)); /* 72 */
- void (*tkpRedirectKeyEvent) _ANSI_ARGS_((TkWindow * winPtr, XEvent * eventPtr)); /* 73 */
- void (*tkpSetMainMenubar) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, char * menuName)); /* 74 */
- int (*tkpUseWindow) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * string)); /* 75 */
- int (*tkpWindowWasRecentlyDeleted) _ANSI_ARGS_((Window win, TkDisplay * dispPtr)); /* 76 */
- void (*tkQueueEventForAllChildren) _ANSI_ARGS_((TkWindow * winPtr, XEvent * eventPtr)); /* 77 */
- int (*tkReadBitmapFile) _ANSI_ARGS_((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 */
- int (*tkScrollWindow) _ANSI_ARGS_((Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, TkRegion damageRgn)); /* 79 */
- void (*tkSelDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 80 */
- void (*tkSelEventProc) _ANSI_ARGS_((Tk_Window tkwin, XEvent * eventPtr)); /* 81 */
- void (*tkSelInit) _ANSI_ARGS_((Tk_Window tkwin)); /* 82 */
- void (*tkSelPropProc) _ANSI_ARGS_((XEvent * eventPtr)); /* 83 */
- void *reserved84;
- void (*tkSetWindowMenuBar) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, char * oldMenuName, char * menuName)); /* 85 */
- KeySym (*tkStringToKeysym) _ANSI_ARGS_((char * name)); /* 86 */
- int (*tkThickPolyLineToArea) _ANSI_ARGS_((double * coordPtr, int numPoints, double width, int capStyle, int joinStyle, double * rectPtr)); /* 87 */
- void (*tkWmAddToColormapWindows) _ANSI_ARGS_((TkWindow * winPtr)); /* 88 */
- void (*tkWmDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 89 */
- TkWindow * (*tkWmFocusToplevel) _ANSI_ARGS_((TkWindow * winPtr)); /* 90 */
- void (*tkWmMapWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 91 */
- void (*tkWmNewWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 92 */
- void (*tkWmProtocolEventProc) _ANSI_ARGS_((TkWindow * winPtr, XEvent * evenvPtr)); /* 93 */
- void (*tkWmRemoveFromColormapWindows) _ANSI_ARGS_((TkWindow * winPtr)); /* 94 */
- void (*tkWmRestackToplevel) _ANSI_ARGS_((TkWindow * winPtr, int aboveBelow, TkWindow * otherPtr)); /* 95 */
- void (*tkWmSetClass) _ANSI_ARGS_((TkWindow * winPtr)); /* 96 */
- void (*tkWmUnmapWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 97 */
- Tcl_Obj * (*tkDebugBitmap) _ANSI_ARGS_((Tk_Window tkwin, char * name)); /* 98 */
- Tcl_Obj * (*tkDebugBorder) _ANSI_ARGS_((Tk_Window tkwin, char * name)); /* 99 */
- Tcl_Obj * (*tkDebugCursor) _ANSI_ARGS_((Tk_Window tkwin, char * name)); /* 100 */
- Tcl_Obj * (*tkDebugColor) _ANSI_ARGS_((Tk_Window tkwin, char * name)); /* 101 */
- Tcl_Obj * (*tkDebugConfig) _ANSI_ARGS_((Tcl_Interp * interp, Tk_OptionTable table)); /* 102 */
- Tcl_Obj * (*tkDebugFont) _ANSI_ARGS_((Tk_Window tkwin, char * name)); /* 103 */
- int (*tkFindStateNumObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * optionPtr, CONST TkStateMap * mapPtr, Tcl_Obj * keyPtr)); /* 104 */
- Tcl_HashTable * (*tkGetBitmapPredefTable) _ANSI_ARGS_((void)); /* 105 */
- TkDisplay * (*tkGetDisplayList) _ANSI_ARGS_((void)); /* 106 */
- TkMainInfo * (*tkGetMainInfoList) _ANSI_ARGS_((void)); /* 107 */
- int (*tkGetWindowFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, Tk_Window * windowPtr)); /* 108 */
- char * (*tkpGetString) _ANSI_ARGS_((TkWindow * winPtr, XEvent * eventPtr, Tcl_DString * dsPtr)); /* 109 */
- void (*tkpGetSubFonts) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Font tkfont)); /* 110 */
- Tcl_Obj * (*tkpGetSystemDefault) _ANSI_ARGS_((Tk_Window tkwin, CONST char * dbName, CONST char * className)); /* 111 */
- void (*tkpMenuThreadInit) _ANSI_ARGS_((void)); /* 112 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved113;
-#endif /* UNIX */
-#ifdef __WIN32__
- void (*tkClipBox) _ANSI_ARGS_((TkRegion rgn, XRectangle* rect_return)); /* 113 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkClipBox) _ANSI_ARGS_((TkRegion rgn, XRectangle* rect_return)); /* 113 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkClipBox) _ANSI_ARGS_((TkRegion rgn, XRectangle* rect_return)); /* 113 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved114;
-#endif /* UNIX */
-#ifdef __WIN32__
- TkRegion (*tkCreateRegion) _ANSI_ARGS_((void)); /* 114 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkRegion (*tkCreateRegion) _ANSI_ARGS_((void)); /* 114 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- TkRegion (*tkCreateRegion) _ANSI_ARGS_((void)); /* 114 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved115;
-#endif /* UNIX */
-#ifdef __WIN32__
- void (*tkDestroyRegion) _ANSI_ARGS_((TkRegion rgn)); /* 115 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkDestroyRegion) _ANSI_ARGS_((TkRegion rgn)); /* 115 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkDestroyRegion) _ANSI_ARGS_((TkRegion rgn)); /* 115 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved116;
-#endif /* UNIX */
-#ifdef __WIN32__
- void (*tkIntersectRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 116 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkIntersectRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 116 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkIntersectRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 116 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved117;
-#endif /* UNIX */
-#ifdef __WIN32__
- int (*tkRectInRegion) _ANSI_ARGS_((TkRegion rgn, int x, int y, unsigned int width, unsigned int height)); /* 117 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- int (*tkRectInRegion) _ANSI_ARGS_((TkRegion rgn, int x, int y, unsigned int width, unsigned int height)); /* 117 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- int (*tkRectInRegion) _ANSI_ARGS_((TkRegion rgn, int x, int y, unsigned int width, unsigned int height)); /* 117 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved118;
-#endif /* UNIX */
-#ifdef __WIN32__
- void (*tkSetRegion) _ANSI_ARGS_((Display* display, GC gc, TkRegion rgn)); /* 118 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkSetRegion) _ANSI_ARGS_((Display* display, GC gc, TkRegion rgn)); /* 118 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkSetRegion) _ANSI_ARGS_((Display* display, GC gc, TkRegion rgn)); /* 118 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved119;
-#endif /* UNIX */
-#ifdef __WIN32__
- void (*tkUnionRectWithRegion) _ANSI_ARGS_((XRectangle* rect, TkRegion src, TkRegion dr_return)); /* 119 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkUnionRectWithRegion) _ANSI_ARGS_((XRectangle* rect, TkRegion src, TkRegion dr_return)); /* 119 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkUnionRectWithRegion) _ANSI_ARGS_((XRectangle* rect, TkRegion src, TkRegion dr_return)); /* 119 */
-#endif /* MAC_OSX_TK */
- void *reserved120;
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved121;
-#endif /* UNIX */
-#ifdef __WIN32__
- void *reserved121;
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- Pixmap (*tkpCreateNativeBitmap) _ANSI_ARGS_((Display * display, CONST char * source)); /* 121 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- Pixmap (*tkpCreateNativeBitmap) _ANSI_ARGS_((Display * display, CONST char * source)); /* 121 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved122;
-#endif /* UNIX */
-#ifdef __WIN32__
- void *reserved122;
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkpDefineNativeBitmaps) _ANSI_ARGS_((void)); /* 122 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkpDefineNativeBitmaps) _ANSI_ARGS_((void)); /* 122 */
-#endif /* MAC_OSX_TK */
- void *reserved123;
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved124;
-#endif /* UNIX */
-#ifdef __WIN32__
- void *reserved124;
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- Pixmap (*tkpGetNativeAppBitmap) _ANSI_ARGS_((Display * display, CONST char * name, int * width, int * height)); /* 124 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- Pixmap (*tkpGetNativeAppBitmap) _ANSI_ARGS_((Display * display, CONST char * name, int * width, int * height)); /* 124 */
-#endif /* MAC_OSX_TK */
- void *reserved125;
- void *reserved126;
- void *reserved127;
- void *reserved128;
- void *reserved129;
- void *reserved130;
- void *reserved131;
- void *reserved132;
- void *reserved133;
- void *reserved134;
- void (*tkpDrawHighlightBorder) _ANSI_ARGS_((Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable)); /* 135 */
- void (*tkSetFocusWin) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 136 */
- void (*tkpSetKeycodeAndState) _ANSI_ARGS_((Tk_Window tkwin, KeySym keySym, XEvent * eventPtr)); /* 137 */
- KeySym (*tkpGetKeySym) _ANSI_ARGS_((TkDisplay * dispPtr, XEvent * eventPtr)); /* 138 */
- void (*tkpInitKeymapInfo) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 139 */
- TkRegion (*tkPhotoGetValidRegion) _ANSI_ARGS_((Tk_PhotoHandle handle)); /* 140 */
- TkWindow ** (*tkWmStackorderToplevel) _ANSI_ARGS_((TkWindow * parentPtr)); /* 141 */
- void (*tkFocusFree) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 142 */
- void (*tkClipCleanup) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 143 */
- void (*tkGCCleanup) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 144 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- void *reserved145;
-#endif /* UNIX */
-#ifdef __WIN32__
- void (*tkSubtractRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 145 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkSubtractRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 145 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkSubtractRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 145 */
-#endif /* MAC_OSX_TK */
- void (*tkStylePkgInit) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 146 */
- void (*tkStylePkgFree) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 147 */
- Tk_Window (*tkToplevelWindowForCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName)); /* 148 */
- CONST Tk_OptionSpec * (*tkGetOptionSpec) _ANSI_ARGS_((CONST char * name, Tk_OptionTable optionTable)); /* 149 */
- void *reserved150;
- void *reserved151;
- void (*tkpDrawFrame) _ANSI_ARGS_((Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief)); /* 152 */
+ TkWindow * (*tkAllocWindow) (TkDisplay *dispPtr, int screenNum, TkWindow *parentPtr); /* 0 */
+ void (*tkBezierPoints) (double control[], int numSteps, double *coordPtr); /* 1 */
+ void (*tkBezierScreenPoints) (Tk_Canvas canvas, double control[], int numSteps, XPoint *xPointPtr); /* 2 */
+ void (*tkBindDeadWindow) (TkWindow *winPtr); /* 3 */
+ void (*tkBindEventProc) (TkWindow *winPtr, XEvent *eventPtr); /* 4 */
+ void (*tkBindFree) (TkMainInfo *mainPtr); /* 5 */
+ void (*tkBindInit) (TkMainInfo *mainPtr); /* 6 */
+ void (*tkChangeEventWindow) (XEvent *eventPtr, TkWindow *winPtr); /* 7 */
+ int (*tkClipInit) (Tcl_Interp *interp, TkDisplay *dispPtr); /* 8 */
+ void (*tkComputeAnchor) (Tk_Anchor anchor, Tk_Window tkwin, int padX, int padY, int innerWidth, int innerHeight, int *xPtr, int *yPtr); /* 9 */
+ int (*tkCopyAndGlobalEval) (Tcl_Interp *interp, char *script); /* 10 */
+ unsigned long (*tkCreateBindingProcedure) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, CONST char *eventString, TkBindEvalProc *evalProc, TkBindFreeProc *freeProc, ClientData clientData); /* 11 */
+ TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, CONST char *source, CONST char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */
+ int (*tkCreateFrame) (ClientData clientData, Tcl_Interp *interp, int argc, char **argv, int toplevel, char *appName); /* 13 */
+ Tk_Window (*tkCreateMainWindow) (Tcl_Interp *interp, CONST char *screenName, char *baseName); /* 14 */
+ Time (*tkCurrentTime) (TkDisplay *dispPtr); /* 15 */
+ void (*tkDeleteAllImages) (TkMainInfo *mainPtr); /* 16 */
+ void (*tkDoConfigureNotify) (TkWindow *winPtr); /* 17 */
+ void (*tkDrawInsetFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable, int padding); /* 18 */
+ void (*tkEventDeadWindow) (TkWindow *winPtr); /* 19 */
+ void (*tkFillPolygon) (Tk_Canvas canvas, double *coordPtr, int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 20 */
+ int (*tkFindStateNum) (Tcl_Interp *interp, CONST char *option, CONST TkStateMap *mapPtr, CONST char *strKey); /* 21 */
+ char * (*tkFindStateString) (CONST TkStateMap *mapPtr, int numKey); /* 22 */
+ void (*tkFocusDeadWindow) (TkWindow *winPtr); /* 23 */
+ int (*tkFocusFilterEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 24 */
+ TkWindow * (*tkFocusKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 25 */
+ void (*tkFontPkgInit) (TkMainInfo *mainPtr); /* 26 */
+ void (*tkFontPkgFree) (TkMainInfo *mainPtr); /* 27 */
+ void (*tkFreeBindingTags) (TkWindow *winPtr); /* 28 */
+ void (*tkpFreeCursor) (TkCursor *cursorPtr); /* 29 */
+ char * (*tkGetBitmapData) (Tcl_Interp *interp, char *string, char *fileName, int *widthPtr, int *heightPtr, int *hotXPtr, int *hotYPtr); /* 30 */
+ void (*tkGetButtPoints) (double p1[], double p2[], double width, int project, double m1[], double m2[]); /* 31 */
+ TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid string); /* 32 */
+ CONST84_RETURN char * (*tkGetDefaultScreenName) (Tcl_Interp *interp, CONST char *screenName); /* 33 */
+ TkDisplay * (*tkGetDisplay) (Display *display); /* 34 */
+ int (*tkGetDisplayOf) (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tk_Window *tkwinPtr); /* 35 */
+ TkWindow * (*tkGetFocusWin) (TkWindow *winPtr); /* 36 */
+ int (*tkGetInterpNames) (Tcl_Interp *interp, Tk_Window tkwin); /* 37 */
+ int (*tkGetMiterPoints) (double p1[], double p2[], double p3[], double width, double m1[], double m2[]); /* 38 */
+ void (*tkGetPointerCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 39 */
+ void (*tkGetServerInfo) (Tcl_Interp *interp, Tk_Window tkwin); /* 40 */
+ void (*tkGrabDeadWindow) (TkWindow *winPtr); /* 41 */
+ int (*tkGrabState) (TkWindow *winPtr); /* 42 */
+ void (*tkIncludePoint) (Tk_Item *itemPtr, double *pointPtr); /* 43 */
+ void (*tkInOutEvents) (XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 44 */
+ void (*tkInstallFrameMenu) (Tk_Window tkwin); /* 45 */
+ char * (*tkKeysymToString) (KeySym keysym); /* 46 */
+ int (*tkLineToArea) (double end1Ptr[], double end2Ptr[], double rectPtr[]); /* 47 */
+ double (*tkLineToPoint) (double end1Ptr[], double end2Ptr[], double pointPtr[]); /* 48 */
+ int (*tkMakeBezierCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 49 */
+ void (*tkMakeBezierPostscript) (Tcl_Interp *interp, Tk_Canvas canvas, double *pointPtr, int numPoints); /* 50 */
+ void (*tkOptionClassChanged) (TkWindow *winPtr); /* 51 */
+ void (*tkOptionDeadWindow) (TkWindow *winPtr); /* 52 */
+ int (*tkOvalToArea) (double *ovalPtr, double *rectPtr); /* 53 */
+ double (*tkOvalToPoint) (double ovalPtr[], double width, int filled, double pointPtr[]); /* 54 */
+ int (*tkpChangeFocus) (TkWindow *winPtr, int force); /* 55 */
+ void (*tkpCloseDisplay) (TkDisplay *dispPtr); /* 56 */
+ void (*tkpClaimFocus) (TkWindow *topLevelPtr, int force); /* 57 */
+ void (*tkpDisplayWarning) (CONST char *msg, CONST char *title); /* 58 */
+ void (*tkpGetAppName) (Tcl_Interp *interp, Tcl_DString *name); /* 59 */
+ TkWindow * (*tkpGetOtherWindow) (TkWindow *winPtr); /* 60 */
+ TkWindow * (*tkpGetWrapperWindow) (TkWindow *winPtr); /* 61 */
+ int (*tkpInit) (Tcl_Interp *interp); /* 62 */
+ void (*tkpInitializeMenuBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable); /* 63 */
+ void (*tkpMakeContainer) (Tk_Window tkwin); /* 64 */
+ void (*tkpMakeMenuWindow) (Tk_Window tkwin, int transient); /* 65 */
+ Window (*tkpMakeWindow) (TkWindow *winPtr, Window parent); /* 66 */
+ void (*tkpMenuNotifyToplevelCreate) (Tcl_Interp *interp1, char *menuName); /* 67 */
+ TkDisplay * (*tkpOpenDisplay) (CONST char *display_name); /* 68 */
+ int (*tkPointerEvent) (XEvent *eventPtr, TkWindow *winPtr); /* 69 */
+ int (*tkPolygonToArea) (double *polyPtr, int numPoints, double *rectPtr); /* 70 */
+ double (*tkPolygonToPoint) (double *polyPtr, int numPoints, double *pointPtr); /* 71 */
+ int (*tkPositionInTree) (TkWindow *winPtr, TkWindow *treePtr); /* 72 */
+ void (*tkpRedirectKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 73 */
+ void (*tkpSetMainMenubar) (Tcl_Interp *interp, Tk_Window tkwin, char *menuName); /* 74 */
+ int (*tkpUseWindow) (Tcl_Interp *interp, Tk_Window tkwin, CONST char *string); /* 75 */
+ int (*tkpWindowWasRecentlyDeleted) (Window win, TkDisplay *dispPtr); /* 76 */
+ void (*tkQueueEventForAllChildren) (TkWindow *winPtr, XEvent *eventPtr); /* 77 */
+ 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 */
+ int (*tkScrollWindow) (Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, TkRegion damageRgn); /* 79 */
+ void (*tkSelDeadWindow) (TkWindow *winPtr); /* 80 */
+ void (*tkSelEventProc) (Tk_Window tkwin, XEvent *eventPtr); /* 81 */
+ void (*tkSelInit) (Tk_Window tkwin); /* 82 */
+ void (*tkSelPropProc) (XEvent *eventPtr); /* 83 */
+ VOID *reserved84;
+ void (*tkSetWindowMenuBar) (Tcl_Interp *interp, Tk_Window tkwin, char *oldMenuName, char *menuName); /* 85 */
+ KeySym (*tkStringToKeysym) (char *name); /* 86 */
+ int (*tkThickPolyLineToArea) (double *coordPtr, int numPoints, double width, int capStyle, int joinStyle, double *rectPtr); /* 87 */
+ void (*tkWmAddToColormapWindows) (TkWindow *winPtr); /* 88 */
+ void (*tkWmDeadWindow) (TkWindow *winPtr); /* 89 */
+ TkWindow * (*tkWmFocusToplevel) (TkWindow *winPtr); /* 90 */
+ void (*tkWmMapWindow) (TkWindow *winPtr); /* 91 */
+ void (*tkWmNewWindow) (TkWindow *winPtr); /* 92 */
+ void (*tkWmProtocolEventProc) (TkWindow *winPtr, XEvent *evenvPtr); /* 93 */
+ void (*tkWmRemoveFromColormapWindows) (TkWindow *winPtr); /* 94 */
+ void (*tkWmRestackToplevel) (TkWindow *winPtr, int aboveBelow, TkWindow *otherPtr); /* 95 */
+ void (*tkWmSetClass) (TkWindow *winPtr); /* 96 */
+ void (*tkWmUnmapWindow) (TkWindow *winPtr); /* 97 */
+ Tcl_Obj * (*tkDebugBitmap) (Tk_Window tkwin, char *name); /* 98 */
+ Tcl_Obj * (*tkDebugBorder) (Tk_Window tkwin, char *name); /* 99 */
+ Tcl_Obj * (*tkDebugCursor) (Tk_Window tkwin, char *name); /* 100 */
+ Tcl_Obj * (*tkDebugColor) (Tk_Window tkwin, char *name); /* 101 */
+ Tcl_Obj * (*tkDebugConfig) (Tcl_Interp *interp, Tk_OptionTable table); /* 102 */
+ Tcl_Obj * (*tkDebugFont) (Tk_Window tkwin, char *name); /* 103 */
+ int (*tkFindStateNumObj) (Tcl_Interp *interp, Tcl_Obj *optionPtr, CONST TkStateMap *mapPtr, Tcl_Obj *keyPtr); /* 104 */
+ Tcl_HashTable * (*tkGetBitmapPredefTable) (void); /* 105 */
+ TkDisplay * (*tkGetDisplayList) (void); /* 106 */
+ TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */
+ int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */
+ char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */
+ void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */
+ Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, CONST char *dbName, CONST char *className); /* 111 */
+ void (*tkpMenuThreadInit) (void); /* 112 */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved113;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved113; /* Dummy entry for stubs table backwards compatibility */
+ void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved114;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ TkRegion (*tkCreateRegion) (void); /* 114 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved114; /* Dummy entry for stubs table backwards compatibility */
+ TkRegion (*tkCreateRegion) (void); /* 114 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved115;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ void (*tkDestroyRegion) (TkRegion rgn); /* 115 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved115; /* Dummy entry for stubs table backwards compatibility */
+ void (*tkDestroyRegion) (TkRegion rgn); /* 115 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved116;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved116; /* Dummy entry for stubs table backwards compatibility */
+ void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved117;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved117; /* Dummy entry for stubs table backwards compatibility */
+ int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved118;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved118; /* Dummy entry for stubs table backwards compatibility */
+ void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved119;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved119; /* Dummy entry for stubs table backwards compatibility */
+ void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
+#endif /* AQUA */
+ VOID *reserved120;
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved121;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ VOID *reserved121;
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved121; /* Dummy entry for stubs table backwards compatibility */
+ Pixmap (*tkpCreateNativeBitmap) (Display *display, CONST char *source); /* 121 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved122;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ VOID *reserved122;
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved122; /* Dummy entry for stubs table backwards compatibility */
+ void (*tkpDefineNativeBitmaps) (void); /* 122 */
+#endif /* AQUA */
+ VOID *reserved123;
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved124;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ VOID *reserved124;
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved124; /* Dummy entry for stubs table backwards compatibility */
+ Pixmap (*tkpGetNativeAppBitmap) (Display *display, CONST char *name, int *width, int *height); /* 124 */
+#endif /* AQUA */
+ VOID *reserved125;
+ VOID *reserved126;
+ VOID *reserved127;
+ VOID *reserved128;
+ VOID *reserved129;
+ VOID *reserved130;
+ VOID *reserved131;
+ VOID *reserved132;
+ VOID *reserved133;
+ VOID *reserved134;
+ void (*tkpDrawHighlightBorder) (Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable); /* 135 */
+ void (*tkSetFocusWin) (TkWindow *winPtr, int force); /* 136 */
+ void (*tkpSetKeycodeAndState) (Tk_Window tkwin, KeySym keySym, XEvent *eventPtr); /* 137 */
+ KeySym (*tkpGetKeySym) (TkDisplay *dispPtr, XEvent *eventPtr); /* 138 */
+ void (*tkpInitKeymapInfo) (TkDisplay *dispPtr); /* 139 */
+ TkRegion (*tkPhotoGetValidRegion) (Tk_PhotoHandle handle); /* 140 */
+ TkWindow ** (*tkWmStackorderToplevel) (TkWindow *parentPtr); /* 141 */
+ void (*tkFocusFree) (TkMainInfo *mainPtr); /* 142 */
+ void (*tkClipCleanup) (TkDisplay *dispPtr); /* 143 */
+ void (*tkGCCleanup) (TkDisplay *dispPtr); /* 144 */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ VOID *reserved145;
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
+ void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ VOID *reserved145; /* Dummy entry for stubs table backwards compatibility */
+ void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
+#endif /* AQUA */
+ void (*tkStylePkgInit) (TkMainInfo *mainPtr); /* 146 */
+ void (*tkStylePkgFree) (TkMainInfo *mainPtr); /* 147 */
+ Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp *interp, CONST char *cmdName); /* 148 */
+ CONST Tk_OptionSpec * (*tkGetOptionSpec) (CONST char *name, Tk_OptionTable optionTable); /* 149 */
+ int (*tkMakeRawCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 150 */
+ void (*tkMakeRawCurvePostscript) (Tcl_Interp *interp, Tk_Canvas canvas, double *pointPtr, int numPoints); /* 151 */
+ void (*tkpDrawFrame) (Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); /* 152 */
+ void (*tkCreateThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 153 */
+ void (*tkDeleteThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 154 */
+ VOID *reserved155;
+ int (*tkpTestembedCmd) (ClientData clientData, Tcl_Interp *interp, int argc, CONST char **argv); /* 156 */
+ int (*tkpTesttextCmd) (ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); /* 157 */
+ VOID *reserved158;
+ VOID *reserved159;
+ VOID *reserved160;
+ VOID *reserved161;
+ VOID *reserved162;
+ VOID *reserved163;
+ VOID *reserved164;
+ VOID *reserved165;
+ VOID *reserved166;
+ VOID *reserved167;
+ VOID *reserved168;
+ int (*tkStateParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 169 */
+ char * (*tkStatePrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 170 */
+ int (*tkCanvasDashParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 171 */
+ char * (*tkCanvasDashPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 172 */
+ int (*tkOffsetParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 173 */
+ char * (*tkOffsetPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 174 */
+ int (*tkPixelParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 175 */
+ char * (*tkPixelPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 176 */
+ int (*tkOrientParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 177 */
+ char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 178 */
+ int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 179 */
+ char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 180 */
} TkIntStubs;
#ifdef __cplusplus
@@ -1310,170 +1788,110 @@ extern TkIntStubs *tkIntStubsPtr;
#define TkpMenuThreadInit \
(tkIntStubsPtr->tkpMenuThreadInit) /* 112 */
#endif
-#ifdef __WIN32__
-#ifndef TkClipBox
-#define TkClipBox \
- (tkIntStubsPtr->tkClipBox) /* 113 */
-#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#ifdef __WIN32__ /* WIN */
#ifndef TkClipBox
#define TkClipBox \
(tkIntStubsPtr->tkClipBox) /* 113 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkClipBox
#define TkClipBox \
(tkIntStubsPtr->tkClipBox) /* 113 */
#endif
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
#ifndef TkCreateRegion
#define TkCreateRegion \
(tkIntStubsPtr->tkCreateRegion) /* 114 */
#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkCreateRegion
#define TkCreateRegion \
(tkIntStubsPtr->tkCreateRegion) /* 114 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
-#ifndef TkCreateRegion
-#define TkCreateRegion \
- (tkIntStubsPtr->tkCreateRegion) /* 114 */
-#endif
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
#ifndef TkDestroyRegion
#define TkDestroyRegion \
(tkIntStubsPtr->tkDestroyRegion) /* 115 */
#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkDestroyRegion
#define TkDestroyRegion \
(tkIntStubsPtr->tkDestroyRegion) /* 115 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
-#ifndef TkDestroyRegion
-#define TkDestroyRegion \
- (tkIntStubsPtr->tkDestroyRegion) /* 115 */
-#endif
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-#ifndef TkIntersectRegion
-#define TkIntersectRegion \
- (tkIntStubsPtr->tkIntersectRegion) /* 116 */
-#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
#ifndef TkIntersectRegion
#define TkIntersectRegion \
(tkIntStubsPtr->tkIntersectRegion) /* 116 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkIntersectRegion
#define TkIntersectRegion \
(tkIntStubsPtr->tkIntersectRegion) /* 116 */
#endif
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
#ifndef TkRectInRegion
#define TkRectInRegion \
(tkIntStubsPtr->tkRectInRegion) /* 117 */
#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkRectInRegion
#define TkRectInRegion \
(tkIntStubsPtr->tkRectInRegion) /* 117 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
-#ifndef TkRectInRegion
-#define TkRectInRegion \
- (tkIntStubsPtr->tkRectInRegion) /* 117 */
-#endif
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
-#ifndef TkSetRegion
-#define TkSetRegion \
- (tkIntStubsPtr->tkSetRegion) /* 118 */
-#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
#ifndef TkSetRegion
#define TkSetRegion \
(tkIntStubsPtr->tkSetRegion) /* 118 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkSetRegion
#define TkSetRegion \
(tkIntStubsPtr->tkSetRegion) /* 118 */
#endif
-#endif /* MAC_OSX_TK */
-#ifdef __WIN32__
+#endif /* AQUA */
+#ifdef __WIN32__ /* WIN */
#ifndef TkUnionRectWithRegion
#define TkUnionRectWithRegion \
(tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkUnionRectWithRegion
#define TkUnionRectWithRegion \
(tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
-#ifndef TkUnionRectWithRegion
-#define TkUnionRectWithRegion \
- (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
-#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
/* Slot 120 is reserved */
-#ifdef MAC_TCL
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkpCreateNativeBitmap
#define TkpCreateNativeBitmap \
(tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
-#ifndef TkpCreateNativeBitmap
-#define TkpCreateNativeBitmap \
- (tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */
-#endif
-#endif /* MAC_OSX_TK */
-#ifdef MAC_TCL
+#endif /* AQUA */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkpDefineNativeBitmaps
#define TkpDefineNativeBitmaps \
(tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
-#ifndef TkpDefineNativeBitmaps
-#define TkpDefineNativeBitmaps \
- (tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 */
-#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
/* Slot 123 is reserved */
-#ifdef MAC_TCL
-#ifndef TkpGetNativeAppBitmap
-#define TkpGetNativeAppBitmap \
- (tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */
-#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkpGetNativeAppBitmap
#define TkpGetNativeAppBitmap \
(tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
/* Slot 125 is reserved */
/* Slot 126 is reserved */
/* Slot 127 is reserved */
@@ -1524,24 +1942,18 @@ extern TkIntStubs *tkIntStubsPtr;
#define TkGCCleanup \
(tkIntStubsPtr->tkGCCleanup) /* 144 */
#endif
-#ifdef __WIN32__
-#ifndef TkSubtractRegion
-#define TkSubtractRegion \
- (tkIntStubsPtr->tkSubtractRegion) /* 145 */
-#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#ifdef __WIN32__ /* WIN */
#ifndef TkSubtractRegion
#define TkSubtractRegion \
(tkIntStubsPtr->tkSubtractRegion) /* 145 */
#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkSubtractRegion
#define TkSubtractRegion \
(tkIntStubsPtr->tkSubtractRegion) /* 145 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#ifndef TkStylePkgInit
#define TkStylePkgInit \
(tkIntStubsPtr->tkStylePkgInit) /* 146 */
@@ -1558,12 +1970,94 @@ extern TkIntStubs *tkIntStubsPtr;
#define TkGetOptionSpec \
(tkIntStubsPtr->tkGetOptionSpec) /* 149 */
#endif
-/* Slot 150 is reserved */
-/* Slot 151 is reserved */
+#ifndef TkMakeRawCurve
+#define TkMakeRawCurve \
+ (tkIntStubsPtr->tkMakeRawCurve) /* 150 */
+#endif
+#ifndef TkMakeRawCurvePostscript
+#define TkMakeRawCurvePostscript \
+ (tkIntStubsPtr->tkMakeRawCurvePostscript) /* 151 */
+#endif
#ifndef TkpDrawFrame
#define TkpDrawFrame \
(tkIntStubsPtr->tkpDrawFrame) /* 152 */
#endif
+#ifndef TkCreateThreadExitHandler
+#define TkCreateThreadExitHandler \
+ (tkIntStubsPtr->tkCreateThreadExitHandler) /* 153 */
+#endif
+#ifndef TkDeleteThreadExitHandler
+#define TkDeleteThreadExitHandler \
+ (tkIntStubsPtr->tkDeleteThreadExitHandler) /* 154 */
+#endif
+/* Slot 155 is reserved */
+#ifndef TkpTestembedCmd
+#define TkpTestembedCmd \
+ (tkIntStubsPtr->tkpTestembedCmd) /* 156 */
+#endif
+#ifndef TkpTesttextCmd
+#define TkpTesttextCmd \
+ (tkIntStubsPtr->tkpTesttextCmd) /* 157 */
+#endif
+/* Slot 158 is reserved */
+/* Slot 159 is reserved */
+/* Slot 160 is reserved */
+/* Slot 161 is reserved */
+/* Slot 162 is reserved */
+/* Slot 163 is reserved */
+/* Slot 164 is reserved */
+/* Slot 165 is reserved */
+/* Slot 166 is reserved */
+/* Slot 167 is reserved */
+/* Slot 168 is reserved */
+#ifndef TkStateParseProc
+#define TkStateParseProc \
+ (tkIntStubsPtr->tkStateParseProc) /* 169 */
+#endif
+#ifndef TkStatePrintProc
+#define TkStatePrintProc \
+ (tkIntStubsPtr->tkStatePrintProc) /* 170 */
+#endif
+#ifndef TkCanvasDashParseProc
+#define TkCanvasDashParseProc \
+ (tkIntStubsPtr->tkCanvasDashParseProc) /* 171 */
+#endif
+#ifndef TkCanvasDashPrintProc
+#define TkCanvasDashPrintProc \
+ (tkIntStubsPtr->tkCanvasDashPrintProc) /* 172 */
+#endif
+#ifndef TkOffsetParseProc
+#define TkOffsetParseProc \
+ (tkIntStubsPtr->tkOffsetParseProc) /* 173 */
+#endif
+#ifndef TkOffsetPrintProc
+#define TkOffsetPrintProc \
+ (tkIntStubsPtr->tkOffsetPrintProc) /* 174 */
+#endif
+#ifndef TkPixelParseProc
+#define TkPixelParseProc \
+ (tkIntStubsPtr->tkPixelParseProc) /* 175 */
+#endif
+#ifndef TkPixelPrintProc
+#define TkPixelPrintProc \
+ (tkIntStubsPtr->tkPixelPrintProc) /* 176 */
+#endif
+#ifndef TkOrientParseProc
+#define TkOrientParseProc \
+ (tkIntStubsPtr->tkOrientParseProc) /* 177 */
+#endif
+#ifndef TkOrientPrintProc
+#define TkOrientPrintProc \
+ (tkIntStubsPtr->tkOrientPrintProc) /* 178 */
+#endif
+#ifndef TkSmoothParseProc
+#define TkSmoothParseProc \
+ (tkIntStubsPtr->tkSmoothParseProc) /* 179 */
+#endif
+#ifndef TkSmoothPrintProc
+#define TkSmoothPrintProc \
+ (tkIntStubsPtr->tkSmoothPrintProc) /* 180 */
+#endif
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index 2cd4253..8de3a71 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -30,578 +30,644 @@
* Exported function declarations:
*/
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef TkAlignImageData_TCL_DECLARED
+#define TkAlignImageData_TCL_DECLARED
/* 0 */
-EXTERN char * TkAlignImageData _ANSI_ARGS_((XImage * image,
- int alignment, int bitOrder));
+EXTERN char * TkAlignImageData(XImage *image, int alignment,
+ int bitOrder);
+#endif
/* Slot 1 is reserved */
+#ifndef TkGenerateActivateEvents_TCL_DECLARED
+#define TkGenerateActivateEvents_TCL_DECLARED
/* 2 */
-EXTERN void TkGenerateActivateEvents _ANSI_ARGS_((
- TkWindow * winPtr, int active));
+EXTERN void TkGenerateActivateEvents(TkWindow *winPtr,
+ int active);
+#endif
+#ifndef TkpGetMS_TCL_DECLARED
+#define TkpGetMS_TCL_DECLARED
/* 3 */
-EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void));
+EXTERN unsigned long TkpGetMS(void);
+#endif
+#ifndef TkPointerDeadWindow_TCL_DECLARED
+#define TkPointerDeadWindow_TCL_DECLARED
/* 4 */
-EXTERN void TkPointerDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkPointerDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkpPrintWindowId_TCL_DECLARED
+#define TkpPrintWindowId_TCL_DECLARED
/* 5 */
-EXTERN void TkpPrintWindowId _ANSI_ARGS_((char * buf,
- Window window));
+EXTERN void TkpPrintWindowId(char *buf, Window window);
+#endif
+#ifndef TkpScanWindowId_TCL_DECLARED
+#define TkpScanWindowId_TCL_DECLARED
/* 6 */
-EXTERN int TkpScanWindowId _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * string, Window * idPtr));
+EXTERN int TkpScanWindowId(Tcl_Interp *interp,
+ CONST char *string, Window *idPtr);
+#endif
+#ifndef TkpSetCapture_TCL_DECLARED
+#define TkpSetCapture_TCL_DECLARED
/* 7 */
-EXTERN void TkpSetCapture _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkpSetCapture(TkWindow *winPtr);
+#endif
+#ifndef TkpSetCursor_TCL_DECLARED
+#define TkpSetCursor_TCL_DECLARED
/* 8 */
-EXTERN void TkpSetCursor _ANSI_ARGS_((TkpCursor cursor));
+EXTERN void TkpSetCursor(TkpCursor cursor);
+#endif
+#ifndef TkpWmSetState_TCL_DECLARED
+#define TkpWmSetState_TCL_DECLARED
/* 9 */
-EXTERN void TkpWmSetState _ANSI_ARGS_((TkWindow * winPtr,
- int state));
+EXTERN void TkpWmSetState(TkWindow *winPtr, int state);
+#endif
+#ifndef TkSetPixmapColormap_TCL_DECLARED
+#define TkSetPixmapColormap_TCL_DECLARED
/* 10 */
-EXTERN void TkSetPixmapColormap _ANSI_ARGS_((Pixmap pixmap,
- Colormap colormap));
+EXTERN void TkSetPixmapColormap(Pixmap pixmap, Colormap colormap);
+#endif
+#ifndef TkWinCancelMouseTimer_TCL_DECLARED
+#define TkWinCancelMouseTimer_TCL_DECLARED
/* 11 */
-EXTERN void TkWinCancelMouseTimer _ANSI_ARGS_((void));
+EXTERN void TkWinCancelMouseTimer(void);
+#endif
+#ifndef TkWinClipboardRender_TCL_DECLARED
+#define TkWinClipboardRender_TCL_DECLARED
/* 12 */
-EXTERN void TkWinClipboardRender _ANSI_ARGS_((
- TkDisplay * dispPtr, UINT format));
+EXTERN void TkWinClipboardRender(TkDisplay *dispPtr, UINT format);
+#endif
+#ifndef TkWinEmbeddedEventProc_TCL_DECLARED
+#define TkWinEmbeddedEventProc_TCL_DECLARED
/* 13 */
-EXTERN LRESULT TkWinEmbeddedEventProc _ANSI_ARGS_((HWND hwnd,
- UINT message, WPARAM wParam, LPARAM lParam));
+EXTERN LRESULT TkWinEmbeddedEventProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+#ifndef TkWinFillRect_TCL_DECLARED
+#define TkWinFillRect_TCL_DECLARED
/* 14 */
-EXTERN void TkWinFillRect _ANSI_ARGS_((HDC dc, int x, int y,
- int width, int height, int pixel));
+EXTERN void TkWinFillRect(HDC dc, int x, int y, int width,
+ int height, int pixel);
+#endif
+#ifndef TkWinGetBorderPixels_TCL_DECLARED
+#define TkWinGetBorderPixels_TCL_DECLARED
/* 15 */
-EXTERN COLORREF TkWinGetBorderPixels _ANSI_ARGS_((Tk_Window tkwin,
- Tk_3DBorder border, int which));
+EXTERN COLORREF TkWinGetBorderPixels(Tk_Window tkwin,
+ Tk_3DBorder border, int which);
+#endif
+#ifndef TkWinGetDrawableDC_TCL_DECLARED
+#define TkWinGetDrawableDC_TCL_DECLARED
/* 16 */
-EXTERN HDC TkWinGetDrawableDC _ANSI_ARGS_((Display * display,
- Drawable d, TkWinDCState* state));
+EXTERN HDC TkWinGetDrawableDC(Display *display, Drawable d,
+ TkWinDCState *state);
+#endif
+#ifndef TkWinGetModifierState_TCL_DECLARED
+#define TkWinGetModifierState_TCL_DECLARED
/* 17 */
-EXTERN int TkWinGetModifierState _ANSI_ARGS_((void));
+EXTERN int TkWinGetModifierState(void);
+#endif
+#ifndef TkWinGetSystemPalette_TCL_DECLARED
+#define TkWinGetSystemPalette_TCL_DECLARED
/* 18 */
-EXTERN HPALETTE TkWinGetSystemPalette _ANSI_ARGS_((void));
+EXTERN HPALETTE TkWinGetSystemPalette(void);
+#endif
+#ifndef TkWinGetWrapperWindow_TCL_DECLARED
+#define TkWinGetWrapperWindow_TCL_DECLARED
/* 19 */
-EXTERN HWND TkWinGetWrapperWindow _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN HWND TkWinGetWrapperWindow(Tk_Window tkwin);
+#endif
+#ifndef TkWinHandleMenuEvent_TCL_DECLARED
+#define TkWinHandleMenuEvent_TCL_DECLARED
/* 20 */
-EXTERN int TkWinHandleMenuEvent _ANSI_ARGS_((HWND * phwnd,
- UINT * pMessage, WPARAM * pwParam,
- LPARAM * plParam, LRESULT * plResult));
+EXTERN int TkWinHandleMenuEvent(HWND *phwnd, UINT *pMessage,
+ WPARAM *pwParam, LPARAM *plParam,
+ LRESULT *plResult);
+#endif
+#ifndef TkWinIndexOfColor_TCL_DECLARED
+#define TkWinIndexOfColor_TCL_DECLARED
/* 21 */
-EXTERN int TkWinIndexOfColor _ANSI_ARGS_((XColor * colorPtr));
+EXTERN int TkWinIndexOfColor(XColor *colorPtr);
+#endif
+#ifndef TkWinReleaseDrawableDC_TCL_DECLARED
+#define TkWinReleaseDrawableDC_TCL_DECLARED
/* 22 */
-EXTERN void TkWinReleaseDrawableDC _ANSI_ARGS_((Drawable d,
- HDC hdc, TkWinDCState* state));
+EXTERN void TkWinReleaseDrawableDC(Drawable d, HDC hdc,
+ TkWinDCState *state);
+#endif
+#ifndef TkWinResendEvent_TCL_DECLARED
+#define TkWinResendEvent_TCL_DECLARED
/* 23 */
-EXTERN LRESULT TkWinResendEvent _ANSI_ARGS_((WNDPROC wndproc,
- HWND hwnd, XEvent * eventPtr));
+EXTERN LRESULT TkWinResendEvent(WNDPROC wndproc, HWND hwnd,
+ XEvent *eventPtr);
+#endif
+#ifndef TkWinSelectPalette_TCL_DECLARED
+#define TkWinSelectPalette_TCL_DECLARED
/* 24 */
-EXTERN HPALETTE TkWinSelectPalette _ANSI_ARGS_((HDC dc,
- Colormap colormap));
+EXTERN HPALETTE TkWinSelectPalette(HDC dc, Colormap colormap);
+#endif
+#ifndef TkWinSetMenu_TCL_DECLARED
+#define TkWinSetMenu_TCL_DECLARED
/* 25 */
-EXTERN void TkWinSetMenu _ANSI_ARGS_((Tk_Window tkwin,
- HMENU hMenu));
+EXTERN void TkWinSetMenu(Tk_Window tkwin, HMENU hMenu);
+#endif
+#ifndef TkWinSetWindowPos_TCL_DECLARED
+#define TkWinSetWindowPos_TCL_DECLARED
/* 26 */
-EXTERN void TkWinSetWindowPos _ANSI_ARGS_((HWND hwnd,
- HWND siblingHwnd, int pos));
+EXTERN void TkWinSetWindowPos(HWND hwnd, HWND siblingHwnd,
+ int pos);
+#endif
+#ifndef TkWinWmCleanup_TCL_DECLARED
+#define TkWinWmCleanup_TCL_DECLARED
/* 27 */
-EXTERN void TkWinWmCleanup _ANSI_ARGS_((HINSTANCE hInstance));
+EXTERN void TkWinWmCleanup(HINSTANCE hInstance);
+#endif
+#ifndef TkWinXCleanup_TCL_DECLARED
+#define TkWinXCleanup_TCL_DECLARED
/* 28 */
-EXTERN void TkWinXCleanup _ANSI_ARGS_((ClientData clientData));
+EXTERN void TkWinXCleanup(ClientData clientData);
+#endif
+#ifndef TkWinXInit_TCL_DECLARED
+#define TkWinXInit_TCL_DECLARED
/* 29 */
-EXTERN void TkWinXInit _ANSI_ARGS_((HINSTANCE hInstance));
+EXTERN void TkWinXInit(HINSTANCE hInstance);
+#endif
+#ifndef TkWinSetForegroundWindow_TCL_DECLARED
+#define TkWinSetForegroundWindow_TCL_DECLARED
/* 30 */
-EXTERN void TkWinSetForegroundWindow _ANSI_ARGS_((
- TkWindow * winPtr));
+EXTERN void TkWinSetForegroundWindow(TkWindow *winPtr);
+#endif
+#ifndef TkWinDialogDebug_TCL_DECLARED
+#define TkWinDialogDebug_TCL_DECLARED
/* 31 */
-EXTERN void TkWinDialogDebug _ANSI_ARGS_((int debug));
+EXTERN void TkWinDialogDebug(int debug);
+#endif
+#ifndef TkWinGetMenuSystemDefault_TCL_DECLARED
+#define TkWinGetMenuSystemDefault_TCL_DECLARED
/* 32 */
-EXTERN Tcl_Obj * TkWinGetMenuSystemDefault _ANSI_ARGS_((
- Tk_Window tkwin, CONST char * dbName,
- CONST char * className));
+EXTERN Tcl_Obj * TkWinGetMenuSystemDefault(Tk_Window tkwin,
+ CONST char *dbName, CONST char *className);
+#endif
+#ifndef TkWinGetPlatformId_TCL_DECLARED
+#define TkWinGetPlatformId_TCL_DECLARED
/* 33 */
-EXTERN int TkWinGetPlatformId _ANSI_ARGS_((void));
+EXTERN int TkWinGetPlatformId(void);
+#endif
+#ifndef TkWinSetHINSTANCE_TCL_DECLARED
+#define TkWinSetHINSTANCE_TCL_DECLARED
/* 34 */
-EXTERN void TkWinSetHINSTANCE _ANSI_ARGS_((HINSTANCE hInstance));
+EXTERN void TkWinSetHINSTANCE(HINSTANCE hInstance);
+#endif
+#ifndef TkWinGetPlatformTheme_TCL_DECLARED
+#define TkWinGetPlatformTheme_TCL_DECLARED
/* 35 */
-EXTERN int TkWinGetPlatformTheme _ANSI_ARGS_((void));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
-/* 0 */
-EXTERN void TkGenerateActivateEvents _ANSI_ARGS_((
- TkWindow * winPtr, int active));
-/* Slot 1 is reserved */
-/* Slot 2 is reserved */
-/* 3 */
-EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void));
-/* Slot 4 is reserved */
-/* 5 */
-EXTERN void TkPointerDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
-/* 6 */
-EXTERN void TkpSetCapture _ANSI_ARGS_((TkWindow * winPtr));
-/* 7 */
-EXTERN void TkpSetCursor _ANSI_ARGS_((TkpCursor cursor));
-/* 8 */
-EXTERN void TkpWmSetState _ANSI_ARGS_((TkWindow * winPtr,
- int state));
-/* Slot 9 is reserved */
-/* 10 */
-EXTERN void TkAboutDlg _ANSI_ARGS_((void));
-/* Slot 11 is reserved */
-/* Slot 12 is reserved */
-/* 13 */
-EXTERN Window TkGetTransientMaster _ANSI_ARGS_((TkWindow * winPtr));
-/* 14 */
-EXTERN int TkGenerateButtonEvent _ANSI_ARGS_((int x, int y,
- Window window, unsigned int state));
-/* Slot 15 is reserved */
-/* 16 */
-EXTERN void TkGenWMDestroyEvent _ANSI_ARGS_((Tk_Window tkwin));
-/* Slot 17 is reserved */
-/* 18 */
-EXTERN unsigned int TkMacButtonKeyState _ANSI_ARGS_((void));
-/* 19 */
-EXTERN void TkMacClearMenubarActive _ANSI_ARGS_((void));
-/* Slot 20 is reserved */
-/* 21 */
-EXTERN int TkMacDispatchMenuEvent _ANSI_ARGS_((int menuID,
- int index));
-/* 22 */
-EXTERN void TkMacInstallCursor _ANSI_ARGS_((int resizeOverride));
-/* Slot 23 is reserved */
-/* 24 */
-EXTERN void TkMacHandleTearoffMenu _ANSI_ARGS_((void));
-/* Slot 25 is reserved */
-/* Slot 26 is reserved */
-/* 27 */
-EXTERN void TkMacDoHLEvent _ANSI_ARGS_((EventRecord * theEvent));
-/* Slot 28 is reserved */
-/* 29 */
-EXTERN Time TkMacGenerateTime _ANSI_ARGS_((void));
-/* Slot 30 is reserved */
-/* 31 */
-EXTERN TkWindow * TkMacGetScrollbarGrowWindow _ANSI_ARGS_((
- TkWindow * winPtr));
-/* 32 */
-EXTERN Window TkMacGetXWindow _ANSI_ARGS_((WindowRef macWinPtr));
-/* 33 */
-EXTERN int TkMacGrowToplevel _ANSI_ARGS_((WindowRef whichWindow,
- Point start));
-/* 34 */
-EXTERN void TkMacHandleMenuSelect _ANSI_ARGS_((long mResult,
- int optionKeyPressed));
-/* Slot 35 is reserved */
-/* Slot 36 is reserved */
-/* Slot 37 is reserved */
-/* 38 */
-EXTERN void TkMacInvalidateWindow _ANSI_ARGS_((
- MacDrawable * macWin, int flag));
-/* 39 */
-EXTERN int TkMacIsCharacterMissing _ANSI_ARGS_((Tk_Font tkfont,
- unsigned int searchChar));
-/* 40 */
-EXTERN void TkMacMakeRealWindowExist _ANSI_ARGS_((
- TkWindow * winPtr));
-/* 41 */
-EXTERN BitMapPtr TkMacMakeStippleMap _ANSI_ARGS_((Drawable d1,
- Drawable d2));
-/* 42 */
-EXTERN void TkMacMenuClick _ANSI_ARGS_((void));
-/* 43 */
-EXTERN void TkMacRegisterOffScreenWindow _ANSI_ARGS_((
- Window window, GWorldPtr portPtr));
-/* 44 */
-EXTERN int TkMacResizable _ANSI_ARGS_((TkWindow * winPtr));
-/* Slot 45 is reserved */
-/* 46 */
-EXTERN void TkMacSetHelpMenuItemCount _ANSI_ARGS_((void));
-/* 47 */
-EXTERN void TkMacSetScrollbarGrow _ANSI_ARGS_((TkWindow * winPtr,
- int flag));
-/* 48 */
-EXTERN void TkMacSetUpClippingRgn _ANSI_ARGS_((Drawable drawable));
-/* 49 */
-EXTERN void TkMacSetUpGraphicsPort _ANSI_ARGS_((GC gc));
-/* 50 */
-EXTERN void TkMacUpdateClipRgn _ANSI_ARGS_((TkWindow * winPtr));
-/* 51 */
-EXTERN void TkMacUnregisterMacWindow _ANSI_ARGS_((
- GWorldPtr portPtr));
-/* 52 */
-EXTERN int TkMacUseMenuID _ANSI_ARGS_((short macID));
-/* 53 */
-EXTERN RgnHandle TkMacVisableClipRgn _ANSI_ARGS_((TkWindow * winPtr));
-/* 54 */
-EXTERN void TkMacWinBounds _ANSI_ARGS_((TkWindow * winPtr,
- Rect * geometry));
-/* 55 */
-EXTERN void TkMacWindowOffset _ANSI_ARGS_((WindowRef wRef,
- int * xOffset, int * yOffset));
-/* Slot 56 is reserved */
-/* 57 */
-EXTERN int TkSetMacColor _ANSI_ARGS_((unsigned long pixel,
- RGBColor * macColor));
-/* 58 */
-EXTERN void TkSetWMName _ANSI_ARGS_((TkWindow * winPtr,
- Tk_Uid titleUid));
-/* 59 */
-EXTERN void TkSuspendClipboard _ANSI_ARGS_((void));
-/* Slot 60 is reserved */
-/* 61 */
-EXTERN int TkMacZoomToplevel _ANSI_ARGS_((WindowPtr whichWindow,
- Point where, short zoomPart));
-/* 62 */
-EXTERN Tk_Window Tk_TopCoordsToWindow _ANSI_ARGS_((Tk_Window tkwin,
- int rootX, int rootY, int * newX, int * newY));
-/* 63 */
-EXTERN MacDrawable * TkMacContainerId _ANSI_ARGS_((TkWindow * winPtr));
-/* 64 */
-EXTERN MacDrawable * TkMacGetHostToplevel _ANSI_ARGS_((TkWindow * winPtr));
-/* 65 */
-EXTERN void TkMacPreprocessMenu _ANSI_ARGS_((void));
-/* 66 */
-EXTERN int TkpIsWindowFloating _ANSI_ARGS_((WindowRef window));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN int TkWinGetPlatformTheme(void);
+#endif
+#ifndef TkWinChildProc_TCL_DECLARED
+#define TkWinChildProc_TCL_DECLARED
+/* 36 */
+EXTERN LRESULT CALLBACK TkWinChildProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef TkGenerateActivateEvents_TCL_DECLARED
+#define TkGenerateActivateEvents_TCL_DECLARED
/* 0 */
-EXTERN void TkGenerateActivateEvents _ANSI_ARGS_((
- TkWindow * winPtr, int active));
+EXTERN void TkGenerateActivateEvents(TkWindow *winPtr,
+ int active);
+#endif
/* Slot 1 is reserved */
/* Slot 2 is reserved */
+#ifndef TkPointerDeadWindow_TCL_DECLARED
+#define TkPointerDeadWindow_TCL_DECLARED
/* 3 */
-EXTERN void TkPointerDeadWindow _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkPointerDeadWindow(TkWindow *winPtr);
+#endif
+#ifndef TkpSetCapture_TCL_DECLARED
+#define TkpSetCapture_TCL_DECLARED
/* 4 */
-EXTERN void TkpSetCapture _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkpSetCapture(TkWindow *winPtr);
+#endif
+#ifndef TkpSetCursor_TCL_DECLARED
+#define TkpSetCursor_TCL_DECLARED
/* 5 */
-EXTERN void TkpSetCursor _ANSI_ARGS_((TkpCursor cursor));
+EXTERN void TkpSetCursor(TkpCursor cursor);
+#endif
+#ifndef TkpWmSetState_TCL_DECLARED
+#define TkpWmSetState_TCL_DECLARED
/* 6 */
-EXTERN void TkpWmSetState _ANSI_ARGS_((TkWindow * winPtr,
- int state));
+EXTERN void TkpWmSetState(TkWindow *winPtr, int state);
+#endif
+#ifndef TkAboutDlg_TCL_DECLARED
+#define TkAboutDlg_TCL_DECLARED
/* 7 */
-EXTERN void TkAboutDlg _ANSI_ARGS_((void));
+EXTERN void TkAboutDlg(void);
+#endif
+#ifndef TkMacOSXButtonKeyState_TCL_DECLARED
+#define TkMacOSXButtonKeyState_TCL_DECLARED
/* 8 */
-EXTERN unsigned int TkMacOSXButtonKeyState _ANSI_ARGS_((void));
+EXTERN unsigned int TkMacOSXButtonKeyState(void);
+#endif
+#ifndef TkMacOSXClearMenubarActive_TCL_DECLARED
+#define TkMacOSXClearMenubarActive_TCL_DECLARED
/* 9 */
-EXTERN void TkMacOSXClearMenubarActive _ANSI_ARGS_((void));
+EXTERN void TkMacOSXClearMenubarActive(void);
+#endif
+#ifndef TkMacOSXDispatchMenuEvent_TCL_DECLARED
+#define TkMacOSXDispatchMenuEvent_TCL_DECLARED
/* 10 */
-EXTERN int TkMacOSXDispatchMenuEvent _ANSI_ARGS_((int menuID,
- int index));
+EXTERN int TkMacOSXDispatchMenuEvent(int menuID, int index);
+#endif
+#ifndef TkMacOSXInstallCursor_TCL_DECLARED
+#define TkMacOSXInstallCursor_TCL_DECLARED
/* 11 */
-EXTERN void TkMacOSXInstallCursor _ANSI_ARGS_((
- int resizeOverride));
+EXTERN void TkMacOSXInstallCursor(int resizeOverride);
+#endif
+#ifndef TkMacOSXHandleTearoffMenu_TCL_DECLARED
+#define TkMacOSXHandleTearoffMenu_TCL_DECLARED
/* 12 */
-EXTERN void TkMacOSXHandleTearoffMenu _ANSI_ARGS_((void));
+EXTERN void TkMacOSXHandleTearoffMenu(void);
+#endif
/* Slot 13 is reserved */
+#ifndef TkMacOSXDoHLEvent_TCL_DECLARED
+#define TkMacOSXDoHLEvent_TCL_DECLARED
/* 14 */
-EXTERN int TkMacOSXDoHLEvent _ANSI_ARGS_((
- EventRecord * theEvent));
+EXTERN int TkMacOSXDoHLEvent(EventRecord *theEvent);
+#endif
/* Slot 15 is reserved */
+#ifndef TkMacOSXGetXWindow_TCL_DECLARED
+#define TkMacOSXGetXWindow_TCL_DECLARED
/* 16 */
-EXTERN Window TkMacOSXGetXWindow _ANSI_ARGS_((WindowRef macWinPtr));
+EXTERN Window TkMacOSXGetXWindow(WindowRef macWinPtr);
+#endif
+#ifndef TkMacOSXGrowToplevel_TCL_DECLARED
+#define TkMacOSXGrowToplevel_TCL_DECLARED
/* 17 */
-EXTERN int TkMacOSXGrowToplevel _ANSI_ARGS_((
- WindowRef whichWindow, Point start));
+EXTERN int TkMacOSXGrowToplevel(WindowRef whichWindow,
+ Point start);
+#endif
+#ifndef TkMacOSXHandleMenuSelect_TCL_DECLARED
+#define TkMacOSXHandleMenuSelect_TCL_DECLARED
/* 18 */
-EXTERN void TkMacOSXHandleMenuSelect _ANSI_ARGS_((MenuID theMenu,
- MenuItemIndex theItem, int optionKeyPressed));
+EXTERN void TkMacOSXHandleMenuSelect(MenuID theMenu,
+ MenuItemIndex theItem, int optionKeyPressed);
+#endif
/* Slot 19 is reserved */
/* Slot 20 is reserved */
+#ifndef TkMacOSXInvalidateWindow_TCL_DECLARED
+#define TkMacOSXInvalidateWindow_TCL_DECLARED
/* 21 */
-EXTERN void TkMacOSXInvalidateWindow _ANSI_ARGS_((
- MacDrawable * macWin, int flag));
+EXTERN void TkMacOSXInvalidateWindow(MacDrawable *macWin,
+ int flag);
+#endif
+#ifndef TkMacOSXIsCharacterMissing_TCL_DECLARED
+#define TkMacOSXIsCharacterMissing_TCL_DECLARED
/* 22 */
-EXTERN int TkMacOSXIsCharacterMissing _ANSI_ARGS_((
- Tk_Font tkfont, unsigned int searchChar));
+EXTERN int TkMacOSXIsCharacterMissing(Tk_Font tkfont,
+ unsigned int searchChar);
+#endif
+#ifndef TkMacOSXMakeRealWindowExist_TCL_DECLARED
+#define TkMacOSXMakeRealWindowExist_TCL_DECLARED
/* 23 */
-EXTERN void TkMacOSXMakeRealWindowExist _ANSI_ARGS_((
- TkWindow * winPtr));
+EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr);
+#endif
+#ifndef TkMacOSXMakeStippleMap_TCL_DECLARED
+#define TkMacOSXMakeStippleMap_TCL_DECLARED
/* 24 */
-EXTERN BitMapPtr TkMacOSXMakeStippleMap _ANSI_ARGS_((Drawable d1,
- Drawable d2));
+EXTERN BitMapPtr TkMacOSXMakeStippleMap(Drawable d1, Drawable d2);
+#endif
+#ifndef TkMacOSXMenuClick_TCL_DECLARED
+#define TkMacOSXMenuClick_TCL_DECLARED
/* 25 */
-EXTERN void TkMacOSXMenuClick _ANSI_ARGS_((void));
+EXTERN void TkMacOSXMenuClick(void);
+#endif
+#ifndef TkMacOSXRegisterOffScreenWindow_TCL_DECLARED
+#define TkMacOSXRegisterOffScreenWindow_TCL_DECLARED
/* 26 */
-EXTERN void TkMacOSXRegisterOffScreenWindow _ANSI_ARGS_((
- Window window, GWorldPtr portPtr));
+EXTERN void TkMacOSXRegisterOffScreenWindow(Window window,
+ GWorldPtr portPtr);
+#endif
+#ifndef TkMacOSXResizable_TCL_DECLARED
+#define TkMacOSXResizable_TCL_DECLARED
/* 27 */
-EXTERN int TkMacOSXResizable _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN int TkMacOSXResizable(TkWindow *winPtr);
+#endif
+#ifndef TkMacOSXSetHelpMenuItemCount_TCL_DECLARED
+#define TkMacOSXSetHelpMenuItemCount_TCL_DECLARED
/* 28 */
-EXTERN void TkMacOSXSetHelpMenuItemCount _ANSI_ARGS_((void));
+EXTERN void TkMacOSXSetHelpMenuItemCount(void);
+#endif
+#ifndef TkMacOSXSetScrollbarGrow_TCL_DECLARED
+#define TkMacOSXSetScrollbarGrow_TCL_DECLARED
/* 29 */
-EXTERN void TkMacOSXSetScrollbarGrow _ANSI_ARGS_((
- TkWindow * winPtr, int flag));
+EXTERN void TkMacOSXSetScrollbarGrow(TkWindow *winPtr, int flag);
+#endif
+#ifndef TkMacOSXSetUpClippingRgn_TCL_DECLARED
+#define TkMacOSXSetUpClippingRgn_TCL_DECLARED
/* 30 */
-EXTERN void TkMacOSXSetUpClippingRgn _ANSI_ARGS_((
- Drawable drawable));
+EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable);
+#endif
+#ifndef TkMacOSXSetUpGraphicsPort_TCL_DECLARED
+#define TkMacOSXSetUpGraphicsPort_TCL_DECLARED
/* 31 */
-EXTERN void TkMacOSXSetUpGraphicsPort _ANSI_ARGS_((GC gc,
- GWorldPtr destPort));
+EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, GWorldPtr destPort);
+#endif
+#ifndef TkMacOSXUpdateClipRgn_TCL_DECLARED
+#define TkMacOSXUpdateClipRgn_TCL_DECLARED
/* 32 */
-EXTERN void TkMacOSXUpdateClipRgn _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr);
+#endif
+#ifndef TkMacOSXUnregisterMacWindow_TCL_DECLARED
+#define TkMacOSXUnregisterMacWindow_TCL_DECLARED
/* 33 */
-EXTERN void TkMacOSXUnregisterMacWindow _ANSI_ARGS_((
- WindowRef portPtr));
+EXTERN void TkMacOSXUnregisterMacWindow(WindowRef portPtr);
+#endif
+#ifndef TkMacOSXUseMenuID_TCL_DECLARED
+#define TkMacOSXUseMenuID_TCL_DECLARED
/* 34 */
-EXTERN int TkMacOSXUseMenuID _ANSI_ARGS_((short macID));
+EXTERN int TkMacOSXUseMenuID(short macID);
+#endif
+#ifndef TkMacOSXVisableClipRgn_TCL_DECLARED
+#define TkMacOSXVisableClipRgn_TCL_DECLARED
/* 35 */
-EXTERN RgnHandle TkMacOSXVisableClipRgn _ANSI_ARGS_((
- TkWindow * winPtr));
+EXTERN RgnHandle TkMacOSXVisableClipRgn(TkWindow *winPtr);
+#endif
+#ifndef TkMacOSXWinBounds_TCL_DECLARED
+#define TkMacOSXWinBounds_TCL_DECLARED
/* 36 */
-EXTERN void TkMacOSXWinBounds _ANSI_ARGS_((TkWindow * winPtr,
- Rect * geometry));
+EXTERN void TkMacOSXWinBounds(TkWindow *winPtr, Rect *geometry);
+#endif
+#ifndef TkMacOSXWindowOffset_TCL_DECLARED
+#define TkMacOSXWindowOffset_TCL_DECLARED
/* 37 */
-EXTERN void TkMacOSXWindowOffset _ANSI_ARGS_((WindowRef wRef,
- int * xOffset, int * yOffset));
+EXTERN void TkMacOSXWindowOffset(WindowRef wRef, int *xOffset,
+ int *yOffset);
+#endif
+#ifndef TkSetMacColor_TCL_DECLARED
+#define TkSetMacColor_TCL_DECLARED
/* 38 */
-EXTERN int TkSetMacColor _ANSI_ARGS_((unsigned long pixel,
- RGBColor * macColor));
+EXTERN int TkSetMacColor(unsigned long pixel,
+ RGBColor *macColor);
+#endif
+#ifndef TkSetWMName_TCL_DECLARED
+#define TkSetWMName_TCL_DECLARED
/* 39 */
-EXTERN void TkSetWMName _ANSI_ARGS_((TkWindow * winPtr,
- Tk_Uid titleUid));
+EXTERN void TkSetWMName(TkWindow *winPtr, Tk_Uid titleUid);
+#endif
+#ifndef TkSuspendClipboard_TCL_DECLARED
+#define TkSuspendClipboard_TCL_DECLARED
/* 40 */
-EXTERN void TkSuspendClipboard _ANSI_ARGS_((void));
+EXTERN void TkSuspendClipboard(void);
+#endif
+#ifndef TkMacOSXZoomToplevel_TCL_DECLARED
+#define TkMacOSXZoomToplevel_TCL_DECLARED
/* 41 */
-EXTERN int TkMacOSXZoomToplevel _ANSI_ARGS_((
- WindowPtr whichWindow, short zoomPart));
+EXTERN int TkMacOSXZoomToplevel(WindowPtr whichWindow,
+ short zoomPart);
+#endif
+#ifndef Tk_TopCoordsToWindow_TCL_DECLARED
+#define Tk_TopCoordsToWindow_TCL_DECLARED
/* 42 */
-EXTERN Tk_Window Tk_TopCoordsToWindow _ANSI_ARGS_((Tk_Window tkwin,
- int rootX, int rootY, int * newX, int * newY));
+EXTERN Tk_Window Tk_TopCoordsToWindow(Tk_Window tkwin, int rootX,
+ int rootY, int *newX, int *newY);
+#endif
+#ifndef TkMacOSXContainerId_TCL_DECLARED
+#define TkMacOSXContainerId_TCL_DECLARED
/* 43 */
-EXTERN MacDrawable * TkMacOSXContainerId _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN MacDrawable * TkMacOSXContainerId(TkWindow *winPtr);
+#endif
+#ifndef TkMacOSXGetHostToplevel_TCL_DECLARED
+#define TkMacOSXGetHostToplevel_TCL_DECLARED
/* 44 */
-EXTERN MacDrawable * TkMacOSXGetHostToplevel _ANSI_ARGS_((
- TkWindow * winPtr));
+EXTERN MacDrawable * TkMacOSXGetHostToplevel(TkWindow *winPtr);
+#endif
+#ifndef TkMacOSXPreprocessMenu_TCL_DECLARED
+#define TkMacOSXPreprocessMenu_TCL_DECLARED
/* 45 */
-EXTERN void TkMacOSXPreprocessMenu _ANSI_ARGS_((void));
+EXTERN void TkMacOSXPreprocessMenu(void);
+#endif
+#ifndef TkpIsWindowFloating_TCL_DECLARED
+#define TkpIsWindowFloating_TCL_DECLARED
/* 46 */
-EXTERN int TkpIsWindowFloating _ANSI_ARGS_((WindowRef window));
+EXTERN int TkpIsWindowFloating(WindowRef window);
+#endif
+#ifndef TkMacOSXGetCapture_TCL_DECLARED
+#define TkMacOSXGetCapture_TCL_DECLARED
/* 47 */
-EXTERN Tk_Window TkMacOSXGetCapture _ANSI_ARGS_((void));
+EXTERN Tk_Window TkMacOSXGetCapture(void);
+#endif
/* Slot 48 is reserved */
+#ifndef TkGetTransientMaster_TCL_DECLARED
+#define TkGetTransientMaster_TCL_DECLARED
/* 49 */
-EXTERN Window TkGetTransientMaster _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN Window TkGetTransientMaster(TkWindow *winPtr);
+#endif
+#ifndef TkGenerateButtonEvent_TCL_DECLARED
+#define TkGenerateButtonEvent_TCL_DECLARED
/* 50 */
-EXTERN int TkGenerateButtonEvent _ANSI_ARGS_((int x, int y,
- Window window, unsigned int state));
+EXTERN int TkGenerateButtonEvent(int x, int y, Window window,
+ unsigned int state);
+#endif
+#ifndef TkGenWMDestroyEvent_TCL_DECLARED
+#define TkGenWMDestroyEvent_TCL_DECLARED
/* 51 */
-EXTERN void TkGenWMDestroyEvent _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void TkGenWMDestroyEvent(Tk_Window tkwin);
+#endif
/* Slot 52 is reserved */
+#ifndef TkpGetMS_TCL_DECLARED
+#define TkpGetMS_TCL_DECLARED
/* 53 */
-EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void));
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
+EXTERN unsigned long TkpGetMS(void);
+#endif
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+#ifndef TkCreateXEventSource_TCL_DECLARED
+#define TkCreateXEventSource_TCL_DECLARED
/* 0 */
-EXTERN void TkCreateXEventSource _ANSI_ARGS_((void));
+EXTERN void TkCreateXEventSource(void);
+#endif
+#ifndef TkFreeWindowId_TCL_DECLARED
+#define TkFreeWindowId_TCL_DECLARED
/* 1 */
-EXTERN void TkFreeWindowId _ANSI_ARGS_((TkDisplay * dispPtr,
- Window w));
+EXTERN void TkFreeWindowId(TkDisplay *dispPtr, Window w);
+#endif
+#ifndef TkInitXId_TCL_DECLARED
+#define TkInitXId_TCL_DECLARED
/* 2 */
-EXTERN void TkInitXId _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN void TkInitXId(TkDisplay *dispPtr);
+#endif
+#ifndef TkpCmapStressed_TCL_DECLARED
+#define TkpCmapStressed_TCL_DECLARED
/* 3 */
-EXTERN int TkpCmapStressed _ANSI_ARGS_((Tk_Window tkwin,
- Colormap colormap));
+EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap);
+#endif
+#ifndef TkpSync_TCL_DECLARED
+#define TkpSync_TCL_DECLARED
/* 4 */
-EXTERN void TkpSync _ANSI_ARGS_((Display * display));
+EXTERN void TkpSync(Display *display);
+#endif
+#ifndef TkUnixContainerId_TCL_DECLARED
+#define TkUnixContainerId_TCL_DECLARED
/* 5 */
-EXTERN Window TkUnixContainerId _ANSI_ARGS_((TkWindow * winPtr));
+EXTERN Window TkUnixContainerId(TkWindow *winPtr);
+#endif
+#ifndef TkUnixDoOneXEvent_TCL_DECLARED
+#define TkUnixDoOneXEvent_TCL_DECLARED
/* 6 */
-EXTERN int TkUnixDoOneXEvent _ANSI_ARGS_((Tcl_Time * timePtr));
+EXTERN int TkUnixDoOneXEvent(Tcl_Time *timePtr);
+#endif
+#ifndef TkUnixSetMenubar_TCL_DECLARED
+#define TkUnixSetMenubar_TCL_DECLARED
/* 7 */
-EXTERN void TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin,
- Tk_Window menubar));
+EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar);
+#endif
+#ifndef TkpScanWindowId_TCL_DECLARED
+#define TkpScanWindowId_TCL_DECLARED
/* 8 */
-EXTERN int TkpScanWindowId _ANSI_ARGS_((Tcl_Interp * interp,
- CONST char * string, Window * idPtr));
+EXTERN int TkpScanWindowId(Tcl_Interp *interp,
+ CONST char *string, Window *idPtr);
+#endif
+#ifndef TkWmCleanup_TCL_DECLARED
+#define TkWmCleanup_TCL_DECLARED
/* 9 */
-EXTERN void TkWmCleanup _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN void TkWmCleanup(TkDisplay *dispPtr);
+#endif
+#ifndef TkSendCleanup_TCL_DECLARED
+#define TkSendCleanup_TCL_DECLARED
/* 10 */
-EXTERN void TkSendCleanup _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN void TkSendCleanup(TkDisplay *dispPtr);
+#endif
+#ifndef TkFreeXId_TCL_DECLARED
+#define TkFreeXId_TCL_DECLARED
/* 11 */
-EXTERN void TkFreeXId _ANSI_ARGS_((TkDisplay * dispPtr));
+EXTERN void TkFreeXId(TkDisplay *dispPtr);
+#endif
+#ifndef TkpWmSetState_TCL_DECLARED
+#define TkpWmSetState_TCL_DECLARED
/* 12 */
-EXTERN int TkpWmSetState _ANSI_ARGS_((TkWindow * winPtr,
- int state));
+EXTERN int TkpWmSetState(TkWindow *winPtr, int state);
+#endif
+#ifndef TkpTestsendCmd_TCL_DECLARED
+#define TkpTestsendCmd_TCL_DECLARED
+/* 13 */
+EXTERN int TkpTestsendCmd(ClientData clientData,
+ Tcl_Interp *interp, int argc,
+ CONST char **argv);
+#endif
#endif /* X11 */
typedef struct TkIntPlatStubs {
int magic;
struct TkIntPlatStubHooks *hooks;
-#ifdef __WIN32__
- char * (*tkAlignImageData) _ANSI_ARGS_((XImage * image, int alignment, int bitOrder)); /* 0 */
- void *reserved1;
- void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow * winPtr, int active)); /* 2 */
- unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 3 */
- void (*tkPointerDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 4 */
- void (*tkpPrintWindowId) _ANSI_ARGS_((char * buf, Window window)); /* 5 */
- int (*tkpScanWindowId) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * string, Window * idPtr)); /* 6 */
- void (*tkpSetCapture) _ANSI_ARGS_((TkWindow * winPtr)); /* 7 */
- void (*tkpSetCursor) _ANSI_ARGS_((TkpCursor cursor)); /* 8 */
- void (*tkpWmSetState) _ANSI_ARGS_((TkWindow * winPtr, int state)); /* 9 */
- void (*tkSetPixmapColormap) _ANSI_ARGS_((Pixmap pixmap, Colormap colormap)); /* 10 */
- void (*tkWinCancelMouseTimer) _ANSI_ARGS_((void)); /* 11 */
- void (*tkWinClipboardRender) _ANSI_ARGS_((TkDisplay * dispPtr, UINT format)); /* 12 */
- LRESULT (*tkWinEmbeddedEventProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 13 */
- void (*tkWinFillRect) _ANSI_ARGS_((HDC dc, int x, int y, int width, int height, int pixel)); /* 14 */
- COLORREF (*tkWinGetBorderPixels) _ANSI_ARGS_((Tk_Window tkwin, Tk_3DBorder border, int which)); /* 15 */
- HDC (*tkWinGetDrawableDC) _ANSI_ARGS_((Display * display, Drawable d, TkWinDCState* state)); /* 16 */
- int (*tkWinGetModifierState) _ANSI_ARGS_((void)); /* 17 */
- HPALETTE (*tkWinGetSystemPalette) _ANSI_ARGS_((void)); /* 18 */
- HWND (*tkWinGetWrapperWindow) _ANSI_ARGS_((Tk_Window tkwin)); /* 19 */
- int (*tkWinHandleMenuEvent) _ANSI_ARGS_((HWND * phwnd, UINT * pMessage, WPARAM * pwParam, LPARAM * plParam, LRESULT * plResult)); /* 20 */
- int (*tkWinIndexOfColor) _ANSI_ARGS_((XColor * colorPtr)); /* 21 */
- void (*tkWinReleaseDrawableDC) _ANSI_ARGS_((Drawable d, HDC hdc, TkWinDCState* state)); /* 22 */
- LRESULT (*tkWinResendEvent) _ANSI_ARGS_((WNDPROC wndproc, HWND hwnd, XEvent * eventPtr)); /* 23 */
- HPALETTE (*tkWinSelectPalette) _ANSI_ARGS_((HDC dc, Colormap colormap)); /* 24 */
- void (*tkWinSetMenu) _ANSI_ARGS_((Tk_Window tkwin, HMENU hMenu)); /* 25 */
- void (*tkWinSetWindowPos) _ANSI_ARGS_((HWND hwnd, HWND siblingHwnd, int pos)); /* 26 */
- void (*tkWinWmCleanup) _ANSI_ARGS_((HINSTANCE hInstance)); /* 27 */
- void (*tkWinXCleanup) _ANSI_ARGS_((ClientData clientData)); /* 28 */
- void (*tkWinXInit) _ANSI_ARGS_((HINSTANCE hInstance)); /* 29 */
- void (*tkWinSetForegroundWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 30 */
- void (*tkWinDialogDebug) _ANSI_ARGS_((int debug)); /* 31 */
- Tcl_Obj * (*tkWinGetMenuSystemDefault) _ANSI_ARGS_((Tk_Window tkwin, CONST char * dbName, CONST char * className)); /* 32 */
- int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */
- void (*tkWinSetHINSTANCE) _ANSI_ARGS_((HINSTANCE hInstance)); /* 34 */
- int (*tkWinGetPlatformTheme) _ANSI_ARGS_((void)); /* 35 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow * winPtr, int active)); /* 0 */
- void *reserved1;
- void *reserved2;
- unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 3 */
- void *reserved4;
- void (*tkPointerDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 5 */
- void (*tkpSetCapture) _ANSI_ARGS_((TkWindow * winPtr)); /* 6 */
- void (*tkpSetCursor) _ANSI_ARGS_((TkpCursor cursor)); /* 7 */
- void (*tkpWmSetState) _ANSI_ARGS_((TkWindow * winPtr, int state)); /* 8 */
- void *reserved9;
- void (*tkAboutDlg) _ANSI_ARGS_((void)); /* 10 */
- void *reserved11;
- void *reserved12;
- Window (*tkGetTransientMaster) _ANSI_ARGS_((TkWindow * winPtr)); /* 13 */
- int (*tkGenerateButtonEvent) _ANSI_ARGS_((int x, int y, Window window, unsigned int state)); /* 14 */
- void *reserved15;
- void (*tkGenWMDestroyEvent) _ANSI_ARGS_((Tk_Window tkwin)); /* 16 */
- void *reserved17;
- unsigned int (*tkMacButtonKeyState) _ANSI_ARGS_((void)); /* 18 */
- void (*tkMacClearMenubarActive) _ANSI_ARGS_((void)); /* 19 */
- void *reserved20;
- int (*tkMacDispatchMenuEvent) _ANSI_ARGS_((int menuID, int index)); /* 21 */
- void (*tkMacInstallCursor) _ANSI_ARGS_((int resizeOverride)); /* 22 */
- void *reserved23;
- void (*tkMacHandleTearoffMenu) _ANSI_ARGS_((void)); /* 24 */
- void *reserved25;
- void *reserved26;
- void (*tkMacDoHLEvent) _ANSI_ARGS_((EventRecord * theEvent)); /* 27 */
- void *reserved28;
- Time (*tkMacGenerateTime) _ANSI_ARGS_((void)); /* 29 */
- void *reserved30;
- TkWindow * (*tkMacGetScrollbarGrowWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 31 */
- Window (*tkMacGetXWindow) _ANSI_ARGS_((WindowRef macWinPtr)); /* 32 */
- int (*tkMacGrowToplevel) _ANSI_ARGS_((WindowRef whichWindow, Point start)); /* 33 */
- void (*tkMacHandleMenuSelect) _ANSI_ARGS_((long mResult, int optionKeyPressed)); /* 34 */
- void *reserved35;
- void *reserved36;
- void *reserved37;
- void (*tkMacInvalidateWindow) _ANSI_ARGS_((MacDrawable * macWin, int flag)); /* 38 */
- int (*tkMacIsCharacterMissing) _ANSI_ARGS_((Tk_Font tkfont, unsigned int searchChar)); /* 39 */
- void (*tkMacMakeRealWindowExist) _ANSI_ARGS_((TkWindow * winPtr)); /* 40 */
- BitMapPtr (*tkMacMakeStippleMap) _ANSI_ARGS_((Drawable d1, Drawable d2)); /* 41 */
- void (*tkMacMenuClick) _ANSI_ARGS_((void)); /* 42 */
- void (*tkMacRegisterOffScreenWindow) _ANSI_ARGS_((Window window, GWorldPtr portPtr)); /* 43 */
- int (*tkMacResizable) _ANSI_ARGS_((TkWindow * winPtr)); /* 44 */
- void *reserved45;
- void (*tkMacSetHelpMenuItemCount) _ANSI_ARGS_((void)); /* 46 */
- void (*tkMacSetScrollbarGrow) _ANSI_ARGS_((TkWindow * winPtr, int flag)); /* 47 */
- void (*tkMacSetUpClippingRgn) _ANSI_ARGS_((Drawable drawable)); /* 48 */
- void (*tkMacSetUpGraphicsPort) _ANSI_ARGS_((GC gc)); /* 49 */
- void (*tkMacUpdateClipRgn) _ANSI_ARGS_((TkWindow * winPtr)); /* 50 */
- void (*tkMacUnregisterMacWindow) _ANSI_ARGS_((GWorldPtr portPtr)); /* 51 */
- int (*tkMacUseMenuID) _ANSI_ARGS_((short macID)); /* 52 */
- RgnHandle (*tkMacVisableClipRgn) _ANSI_ARGS_((TkWindow * winPtr)); /* 53 */
- void (*tkMacWinBounds) _ANSI_ARGS_((TkWindow * winPtr, Rect * geometry)); /* 54 */
- void (*tkMacWindowOffset) _ANSI_ARGS_((WindowRef wRef, int * xOffset, int * yOffset)); /* 55 */
- void *reserved56;
- int (*tkSetMacColor) _ANSI_ARGS_((unsigned long pixel, RGBColor * macColor)); /* 57 */
- void (*tkSetWMName) _ANSI_ARGS_((TkWindow * winPtr, Tk_Uid titleUid)); /* 58 */
- void (*tkSuspendClipboard) _ANSI_ARGS_((void)); /* 59 */
- void *reserved60;
- int (*tkMacZoomToplevel) _ANSI_ARGS_((WindowPtr whichWindow, Point where, short zoomPart)); /* 61 */
- Tk_Window (*tk_TopCoordsToWindow) _ANSI_ARGS_((Tk_Window tkwin, int rootX, int rootY, int * newX, int * newY)); /* 62 */
- MacDrawable * (*tkMacContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 63 */
- MacDrawable * (*tkMacGetHostToplevel) _ANSI_ARGS_((TkWindow * winPtr)); /* 64 */
- void (*tkMacPreprocessMenu) _ANSI_ARGS_((void)); /* 65 */
- int (*tkpIsWindowFloating) _ANSI_ARGS_((WindowRef window)); /* 66 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow * winPtr, int active)); /* 0 */
- void *reserved1;
- void *reserved2;
- void (*tkPointerDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 3 */
- void (*tkpSetCapture) _ANSI_ARGS_((TkWindow * winPtr)); /* 4 */
- void (*tkpSetCursor) _ANSI_ARGS_((TkpCursor cursor)); /* 5 */
- void (*tkpWmSetState) _ANSI_ARGS_((TkWindow * winPtr, int state)); /* 6 */
- void (*tkAboutDlg) _ANSI_ARGS_((void)); /* 7 */
- unsigned int (*tkMacOSXButtonKeyState) _ANSI_ARGS_((void)); /* 8 */
- void (*tkMacOSXClearMenubarActive) _ANSI_ARGS_((void)); /* 9 */
- int (*tkMacOSXDispatchMenuEvent) _ANSI_ARGS_((int menuID, int index)); /* 10 */
- void (*tkMacOSXInstallCursor) _ANSI_ARGS_((int resizeOverride)); /* 11 */
- void (*tkMacOSXHandleTearoffMenu) _ANSI_ARGS_((void)); /* 12 */
- void *reserved13;
- int (*tkMacOSXDoHLEvent) _ANSI_ARGS_((EventRecord * theEvent)); /* 14 */
- void *reserved15;
- Window (*tkMacOSXGetXWindow) _ANSI_ARGS_((WindowRef macWinPtr)); /* 16 */
- int (*tkMacOSXGrowToplevel) _ANSI_ARGS_((WindowRef whichWindow, Point start)); /* 17 */
- void (*tkMacOSXHandleMenuSelect) _ANSI_ARGS_((MenuID theMenu, MenuItemIndex theItem, int optionKeyPressed)); /* 18 */
- void *reserved19;
- void *reserved20;
- void (*tkMacOSXInvalidateWindow) _ANSI_ARGS_((MacDrawable * macWin, int flag)); /* 21 */
- int (*tkMacOSXIsCharacterMissing) _ANSI_ARGS_((Tk_Font tkfont, unsigned int searchChar)); /* 22 */
- void (*tkMacOSXMakeRealWindowExist) _ANSI_ARGS_((TkWindow * winPtr)); /* 23 */
- BitMapPtr (*tkMacOSXMakeStippleMap) _ANSI_ARGS_((Drawable d1, Drawable d2)); /* 24 */
- void (*tkMacOSXMenuClick) _ANSI_ARGS_((void)); /* 25 */
- void (*tkMacOSXRegisterOffScreenWindow) _ANSI_ARGS_((Window window, GWorldPtr portPtr)); /* 26 */
- int (*tkMacOSXResizable) _ANSI_ARGS_((TkWindow * winPtr)); /* 27 */
- void (*tkMacOSXSetHelpMenuItemCount) _ANSI_ARGS_((void)); /* 28 */
- void (*tkMacOSXSetScrollbarGrow) _ANSI_ARGS_((TkWindow * winPtr, int flag)); /* 29 */
- void (*tkMacOSXSetUpClippingRgn) _ANSI_ARGS_((Drawable drawable)); /* 30 */
- void (*tkMacOSXSetUpGraphicsPort) _ANSI_ARGS_((GC gc, GWorldPtr destPort)); /* 31 */
- void (*tkMacOSXUpdateClipRgn) _ANSI_ARGS_((TkWindow * winPtr)); /* 32 */
- void (*tkMacOSXUnregisterMacWindow) _ANSI_ARGS_((WindowRef portPtr)); /* 33 */
- int (*tkMacOSXUseMenuID) _ANSI_ARGS_((short macID)); /* 34 */
- RgnHandle (*tkMacOSXVisableClipRgn) _ANSI_ARGS_((TkWindow * winPtr)); /* 35 */
- void (*tkMacOSXWinBounds) _ANSI_ARGS_((TkWindow * winPtr, Rect * geometry)); /* 36 */
- void (*tkMacOSXWindowOffset) _ANSI_ARGS_((WindowRef wRef, int * xOffset, int * yOffset)); /* 37 */
- int (*tkSetMacColor) _ANSI_ARGS_((unsigned long pixel, RGBColor * macColor)); /* 38 */
- void (*tkSetWMName) _ANSI_ARGS_((TkWindow * winPtr, Tk_Uid titleUid)); /* 39 */
- void (*tkSuspendClipboard) _ANSI_ARGS_((void)); /* 40 */
- int (*tkMacOSXZoomToplevel) _ANSI_ARGS_((WindowPtr whichWindow, short zoomPart)); /* 41 */
- Tk_Window (*tk_TopCoordsToWindow) _ANSI_ARGS_((Tk_Window tkwin, int rootX, int rootY, int * newX, int * newY)); /* 42 */
- MacDrawable * (*tkMacOSXContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 43 */
- MacDrawable * (*tkMacOSXGetHostToplevel) _ANSI_ARGS_((TkWindow * winPtr)); /* 44 */
- void (*tkMacOSXPreprocessMenu) _ANSI_ARGS_((void)); /* 45 */
- int (*tkpIsWindowFloating) _ANSI_ARGS_((WindowRef window)); /* 46 */
- Tk_Window (*tkMacOSXGetCapture) _ANSI_ARGS_((void)); /* 47 */
- void *reserved48;
- Window (*tkGetTransientMaster) _ANSI_ARGS_((TkWindow * winPtr)); /* 49 */
- int (*tkGenerateButtonEvent) _ANSI_ARGS_((int x, int y, Window window, unsigned int state)); /* 50 */
- void (*tkGenWMDestroyEvent) _ANSI_ARGS_((Tk_Window tkwin)); /* 51 */
- void *reserved52;
- unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 53 */
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
- void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 0 */
- void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay * dispPtr, Window w)); /* 1 */
- void (*tkInitXId) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 2 */
- int (*tkpCmapStressed) _ANSI_ARGS_((Tk_Window tkwin, Colormap colormap)); /* 3 */
- void (*tkpSync) _ANSI_ARGS_((Display * display)); /* 4 */
- Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 5 */
- int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 6 */
- void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 7 */
- int (*tkpScanWindowId) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * string, Window * idPtr)); /* 8 */
- void (*tkWmCleanup) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 9 */
- void (*tkSendCleanup) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 10 */
- void (*tkFreeXId) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 11 */
- int (*tkpWmSetState) _ANSI_ARGS_((TkWindow * winPtr, int state)); /* 12 */
+#ifdef __WIN32__ /* WIN */
+ char * (*tkAlignImageData) (XImage *image, int alignment, int bitOrder); /* 0 */
+ VOID *reserved1;
+ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */
+ unsigned long (*tkpGetMS) (void); /* 3 */
+ void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 4 */
+ void (*tkpPrintWindowId) (char *buf, Window window); /* 5 */
+ int (*tkpScanWindowId) (Tcl_Interp *interp, CONST char *string, Window *idPtr); /* 6 */
+ void (*tkpSetCapture) (TkWindow *winPtr); /* 7 */
+ void (*tkpSetCursor) (TkpCursor cursor); /* 8 */
+ void (*tkpWmSetState) (TkWindow *winPtr, int state); /* 9 */
+ void (*tkSetPixmapColormap) (Pixmap pixmap, Colormap colormap); /* 10 */
+ void (*tkWinCancelMouseTimer) (void); /* 11 */
+ void (*tkWinClipboardRender) (TkDisplay *dispPtr, UINT format); /* 12 */
+ LRESULT (*tkWinEmbeddedEventProc) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 13 */
+ void (*tkWinFillRect) (HDC dc, int x, int y, int width, int height, int pixel); /* 14 */
+ COLORREF (*tkWinGetBorderPixels) (Tk_Window tkwin, Tk_3DBorder border, int which); /* 15 */
+ HDC (*tkWinGetDrawableDC) (Display *display, Drawable d, TkWinDCState *state); /* 16 */
+ int (*tkWinGetModifierState) (void); /* 17 */
+ HPALETTE (*tkWinGetSystemPalette) (void); /* 18 */
+ HWND (*tkWinGetWrapperWindow) (Tk_Window tkwin); /* 19 */
+ int (*tkWinHandleMenuEvent) (HWND *phwnd, UINT *pMessage, WPARAM *pwParam, LPARAM *plParam, LRESULT *plResult); /* 20 */
+ int (*tkWinIndexOfColor) (XColor *colorPtr); /* 21 */
+ void (*tkWinReleaseDrawableDC) (Drawable d, HDC hdc, TkWinDCState *state); /* 22 */
+ LRESULT (*tkWinResendEvent) (WNDPROC wndproc, HWND hwnd, XEvent *eventPtr); /* 23 */
+ HPALETTE (*tkWinSelectPalette) (HDC dc, Colormap colormap); /* 24 */
+ void (*tkWinSetMenu) (Tk_Window tkwin, HMENU hMenu); /* 25 */
+ void (*tkWinSetWindowPos) (HWND hwnd, HWND siblingHwnd, int pos); /* 26 */
+ void (*tkWinWmCleanup) (HINSTANCE hInstance); /* 27 */
+ void (*tkWinXCleanup) (ClientData clientData); /* 28 */
+ void (*tkWinXInit) (HINSTANCE hInstance); /* 29 */
+ void (*tkWinSetForegroundWindow) (TkWindow *winPtr); /* 30 */
+ void (*tkWinDialogDebug) (int debug); /* 31 */
+ Tcl_Obj * (*tkWinGetMenuSystemDefault) (Tk_Window tkwin, CONST char *dbName, CONST char *className); /* 32 */
+ int (*tkWinGetPlatformId) (void); /* 33 */
+ void (*tkWinSetHINSTANCE) (HINSTANCE hInstance); /* 34 */
+ int (*tkWinGetPlatformTheme) (void); /* 35 */
+ LRESULT (CALLBACK *tkWinChildProc) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 36 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 0 */
+ VOID *reserved1;
+ VOID *reserved2;
+ void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 3 */
+ void (*tkpSetCapture) (TkWindow *winPtr); /* 4 */
+ void (*tkpSetCursor) (TkpCursor cursor); /* 5 */
+ void (*tkpWmSetState) (TkWindow *winPtr, int state); /* 6 */
+ void (*tkAboutDlg) (void); /* 7 */
+ unsigned int (*tkMacOSXButtonKeyState) (void); /* 8 */
+ void (*tkMacOSXClearMenubarActive) (void); /* 9 */
+ int (*tkMacOSXDispatchMenuEvent) (int menuID, int index); /* 10 */
+ void (*tkMacOSXInstallCursor) (int resizeOverride); /* 11 */
+ void (*tkMacOSXHandleTearoffMenu) (void); /* 12 */
+ VOID *reserved13;
+ int (*tkMacOSXDoHLEvent) (EventRecord *theEvent); /* 14 */
+ VOID *reserved15;
+ Window (*tkMacOSXGetXWindow) (WindowRef macWinPtr); /* 16 */
+ int (*tkMacOSXGrowToplevel) (WindowRef whichWindow, Point start); /* 17 */
+ void (*tkMacOSXHandleMenuSelect) (MenuID theMenu, MenuItemIndex theItem, int optionKeyPressed); /* 18 */
+ VOID *reserved19;
+ VOID *reserved20;
+ void (*tkMacOSXInvalidateWindow) (MacDrawable *macWin, int flag); /* 21 */
+ int (*tkMacOSXIsCharacterMissing) (Tk_Font tkfont, unsigned int searchChar); /* 22 */
+ void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */
+ BitMapPtr (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */
+ void (*tkMacOSXMenuClick) (void); /* 25 */
+ void (*tkMacOSXRegisterOffScreenWindow) (Window window, GWorldPtr portPtr); /* 26 */
+ int (*tkMacOSXResizable) (TkWindow *winPtr); /* 27 */
+ void (*tkMacOSXSetHelpMenuItemCount) (void); /* 28 */
+ void (*tkMacOSXSetScrollbarGrow) (TkWindow *winPtr, int flag); /* 29 */
+ void (*tkMacOSXSetUpClippingRgn) (Drawable drawable); /* 30 */
+ void (*tkMacOSXSetUpGraphicsPort) (GC gc, GWorldPtr destPort); /* 31 */
+ void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */
+ void (*tkMacOSXUnregisterMacWindow) (WindowRef portPtr); /* 33 */
+ int (*tkMacOSXUseMenuID) (short macID); /* 34 */
+ RgnHandle (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
+ void (*tkMacOSXWinBounds) (TkWindow *winPtr, Rect *geometry); /* 36 */
+ void (*tkMacOSXWindowOffset) (WindowRef wRef, int *xOffset, int *yOffset); /* 37 */
+ int (*tkSetMacColor) (unsigned long pixel, RGBColor *macColor); /* 38 */
+ void (*tkSetWMName) (TkWindow *winPtr, Tk_Uid titleUid); /* 39 */
+ void (*tkSuspendClipboard) (void); /* 40 */
+ int (*tkMacOSXZoomToplevel) (WindowPtr whichWindow, short zoomPart); /* 41 */
+ Tk_Window (*tk_TopCoordsToWindow) (Tk_Window tkwin, int rootX, int rootY, int *newX, int *newY); /* 42 */
+ MacDrawable * (*tkMacOSXContainerId) (TkWindow *winPtr); /* 43 */
+ MacDrawable * (*tkMacOSXGetHostToplevel) (TkWindow *winPtr); /* 44 */
+ void (*tkMacOSXPreprocessMenu) (void); /* 45 */
+ int (*tkpIsWindowFloating) (WindowRef window); /* 46 */
+ Tk_Window (*tkMacOSXGetCapture) (void); /* 47 */
+ VOID *reserved48;
+ Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */
+ int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */
+ void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */
+ VOID *reserved52;
+ unsigned long (*tkpGetMS) (void); /* 53 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+ void (*tkCreateXEventSource) (void); /* 0 */
+ void (*tkFreeWindowId) (TkDisplay *dispPtr, Window w); /* 1 */
+ void (*tkInitXId) (TkDisplay *dispPtr); /* 2 */
+ int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 3 */
+ void (*tkpSync) (Display *display); /* 4 */
+ Window (*tkUnixContainerId) (TkWindow *winPtr); /* 5 */
+ int (*tkUnixDoOneXEvent) (Tcl_Time *timePtr); /* 6 */
+ void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 7 */
+ int (*tkpScanWindowId) (Tcl_Interp *interp, CONST char *string, Window *idPtr); /* 8 */
+ void (*tkWmCleanup) (TkDisplay *dispPtr); /* 9 */
+ void (*tkSendCleanup) (TkDisplay *dispPtr); /* 10 */
+ void (*tkFreeXId) (TkDisplay *dispPtr); /* 11 */
+ int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 12 */
+ int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp *interp, int argc, CONST char **argv); /* 13 */
#endif /* X11 */
} TkIntPlatStubs;
@@ -619,7 +685,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
* Inline function declarations:
*/
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
#ifndef TkAlignImageData
#define TkAlignImageData \
(tkIntPlatStubsPtr->tkAlignImageData) /* 0 */
@@ -761,218 +827,12 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkWinGetPlatformTheme \
(tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */
#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
-#ifndef TkGenerateActivateEvents
-#define TkGenerateActivateEvents \
- (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 0 */
-#endif
-/* Slot 1 is reserved */
-/* Slot 2 is reserved */
-#ifndef TkpGetMS
-#define TkpGetMS \
- (tkIntPlatStubsPtr->tkpGetMS) /* 3 */
-#endif
-/* Slot 4 is reserved */
-#ifndef TkPointerDeadWindow
-#define TkPointerDeadWindow \
- (tkIntPlatStubsPtr->tkPointerDeadWindow) /* 5 */
-#endif
-#ifndef TkpSetCapture
-#define TkpSetCapture \
- (tkIntPlatStubsPtr->tkpSetCapture) /* 6 */
-#endif
-#ifndef TkpSetCursor
-#define TkpSetCursor \
- (tkIntPlatStubsPtr->tkpSetCursor) /* 7 */
-#endif
-#ifndef TkpWmSetState
-#define TkpWmSetState \
- (tkIntPlatStubsPtr->tkpWmSetState) /* 8 */
-#endif
-/* Slot 9 is reserved */
-#ifndef TkAboutDlg
-#define TkAboutDlg \
- (tkIntPlatStubsPtr->tkAboutDlg) /* 10 */
-#endif
-/* Slot 11 is reserved */
-/* Slot 12 is reserved */
-#ifndef TkGetTransientMaster
-#define TkGetTransientMaster \
- (tkIntPlatStubsPtr->tkGetTransientMaster) /* 13 */
-#endif
-#ifndef TkGenerateButtonEvent
-#define TkGenerateButtonEvent \
- (tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 14 */
-#endif
-/* Slot 15 is reserved */
-#ifndef TkGenWMDestroyEvent
-#define TkGenWMDestroyEvent \
- (tkIntPlatStubsPtr->tkGenWMDestroyEvent) /* 16 */
-#endif
-/* Slot 17 is reserved */
-#ifndef TkMacButtonKeyState
-#define TkMacButtonKeyState \
- (tkIntPlatStubsPtr->tkMacButtonKeyState) /* 18 */
-#endif
-#ifndef TkMacClearMenubarActive
-#define TkMacClearMenubarActive \
- (tkIntPlatStubsPtr->tkMacClearMenubarActive) /* 19 */
-#endif
-/* Slot 20 is reserved */
-#ifndef TkMacDispatchMenuEvent
-#define TkMacDispatchMenuEvent \
- (tkIntPlatStubsPtr->tkMacDispatchMenuEvent) /* 21 */
-#endif
-#ifndef TkMacInstallCursor
-#define TkMacInstallCursor \
- (tkIntPlatStubsPtr->tkMacInstallCursor) /* 22 */
-#endif
-/* Slot 23 is reserved */
-#ifndef TkMacHandleTearoffMenu
-#define TkMacHandleTearoffMenu \
- (tkIntPlatStubsPtr->tkMacHandleTearoffMenu) /* 24 */
-#endif
-/* Slot 25 is reserved */
-/* Slot 26 is reserved */
-#ifndef TkMacDoHLEvent
-#define TkMacDoHLEvent \
- (tkIntPlatStubsPtr->tkMacDoHLEvent) /* 27 */
-#endif
-/* Slot 28 is reserved */
-#ifndef TkMacGenerateTime
-#define TkMacGenerateTime \
- (tkIntPlatStubsPtr->tkMacGenerateTime) /* 29 */
-#endif
-/* Slot 30 is reserved */
-#ifndef TkMacGetScrollbarGrowWindow
-#define TkMacGetScrollbarGrowWindow \
- (tkIntPlatStubsPtr->tkMacGetScrollbarGrowWindow) /* 31 */
-#endif
-#ifndef TkMacGetXWindow
-#define TkMacGetXWindow \
- (tkIntPlatStubsPtr->tkMacGetXWindow) /* 32 */
-#endif
-#ifndef TkMacGrowToplevel
-#define TkMacGrowToplevel \
- (tkIntPlatStubsPtr->tkMacGrowToplevel) /* 33 */
-#endif
-#ifndef TkMacHandleMenuSelect
-#define TkMacHandleMenuSelect \
- (tkIntPlatStubsPtr->tkMacHandleMenuSelect) /* 34 */
-#endif
-/* Slot 35 is reserved */
-/* Slot 36 is reserved */
-/* Slot 37 is reserved */
-#ifndef TkMacInvalidateWindow
-#define TkMacInvalidateWindow \
- (tkIntPlatStubsPtr->tkMacInvalidateWindow) /* 38 */
-#endif
-#ifndef TkMacIsCharacterMissing
-#define TkMacIsCharacterMissing \
- (tkIntPlatStubsPtr->tkMacIsCharacterMissing) /* 39 */
-#endif
-#ifndef TkMacMakeRealWindowExist
-#define TkMacMakeRealWindowExist \
- (tkIntPlatStubsPtr->tkMacMakeRealWindowExist) /* 40 */
-#endif
-#ifndef TkMacMakeStippleMap
-#define TkMacMakeStippleMap \
- (tkIntPlatStubsPtr->tkMacMakeStippleMap) /* 41 */
-#endif
-#ifndef TkMacMenuClick
-#define TkMacMenuClick \
- (tkIntPlatStubsPtr->tkMacMenuClick) /* 42 */
-#endif
-#ifndef TkMacRegisterOffScreenWindow
-#define TkMacRegisterOffScreenWindow \
- (tkIntPlatStubsPtr->tkMacRegisterOffScreenWindow) /* 43 */
-#endif
-#ifndef TkMacResizable
-#define TkMacResizable \
- (tkIntPlatStubsPtr->tkMacResizable) /* 44 */
-#endif
-/* Slot 45 is reserved */
-#ifndef TkMacSetHelpMenuItemCount
-#define TkMacSetHelpMenuItemCount \
- (tkIntPlatStubsPtr->tkMacSetHelpMenuItemCount) /* 46 */
-#endif
-#ifndef TkMacSetScrollbarGrow
-#define TkMacSetScrollbarGrow \
- (tkIntPlatStubsPtr->tkMacSetScrollbarGrow) /* 47 */
-#endif
-#ifndef TkMacSetUpClippingRgn
-#define TkMacSetUpClippingRgn \
- (tkIntPlatStubsPtr->tkMacSetUpClippingRgn) /* 48 */
-#endif
-#ifndef TkMacSetUpGraphicsPort
-#define TkMacSetUpGraphicsPort \
- (tkIntPlatStubsPtr->tkMacSetUpGraphicsPort) /* 49 */
-#endif
-#ifndef TkMacUpdateClipRgn
-#define TkMacUpdateClipRgn \
- (tkIntPlatStubsPtr->tkMacUpdateClipRgn) /* 50 */
-#endif
-#ifndef TkMacUnregisterMacWindow
-#define TkMacUnregisterMacWindow \
- (tkIntPlatStubsPtr->tkMacUnregisterMacWindow) /* 51 */
-#endif
-#ifndef TkMacUseMenuID
-#define TkMacUseMenuID \
- (tkIntPlatStubsPtr->tkMacUseMenuID) /* 52 */
-#endif
-#ifndef TkMacVisableClipRgn
-#define TkMacVisableClipRgn \
- (tkIntPlatStubsPtr->tkMacVisableClipRgn) /* 53 */
-#endif
-#ifndef TkMacWinBounds
-#define TkMacWinBounds \
- (tkIntPlatStubsPtr->tkMacWinBounds) /* 54 */
-#endif
-#ifndef TkMacWindowOffset
-#define TkMacWindowOffset \
- (tkIntPlatStubsPtr->tkMacWindowOffset) /* 55 */
-#endif
-/* Slot 56 is reserved */
-#ifndef TkSetMacColor
-#define TkSetMacColor \
- (tkIntPlatStubsPtr->tkSetMacColor) /* 57 */
-#endif
-#ifndef TkSetWMName
-#define TkSetWMName \
- (tkIntPlatStubsPtr->tkSetWMName) /* 58 */
-#endif
-#ifndef TkSuspendClipboard
-#define TkSuspendClipboard \
- (tkIntPlatStubsPtr->tkSuspendClipboard) /* 59 */
-#endif
-/* Slot 60 is reserved */
-#ifndef TkMacZoomToplevel
-#define TkMacZoomToplevel \
- (tkIntPlatStubsPtr->tkMacZoomToplevel) /* 61 */
-#endif
-#ifndef Tk_TopCoordsToWindow
-#define Tk_TopCoordsToWindow \
- (tkIntPlatStubsPtr->tk_TopCoordsToWindow) /* 62 */
-#endif
-#ifndef TkMacContainerId
-#define TkMacContainerId \
- (tkIntPlatStubsPtr->tkMacContainerId) /* 63 */
+#ifndef TkWinChildProc
+#define TkWinChildProc \
+ (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */
#endif
-#ifndef TkMacGetHostToplevel
-#define TkMacGetHostToplevel \
- (tkIntPlatStubsPtr->tkMacGetHostToplevel) /* 64 */
-#endif
-#ifndef TkMacPreprocessMenu
-#define TkMacPreprocessMenu \
- (tkIntPlatStubsPtr->tkMacPreprocessMenu) /* 65 */
-#endif
-#ifndef TkpIsWindowFloating
-#define TkpIsWindowFloating \
- (tkIntPlatStubsPtr->tkpIsWindowFloating) /* 66 */
-#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkGenerateActivateEvents
#define TkGenerateActivateEvents \
(tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 0 */
@@ -1165,8 +1025,8 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkpGetMS \
(tkIntPlatStubsPtr->tkpGetMS) /* 53 */
#endif
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
#ifndef TkCreateXEventSource
#define TkCreateXEventSource \
(tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */
@@ -1219,6 +1079,10 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkpWmSetState \
(tkIntPlatStubsPtr->tkpWmSetState) /* 12 */
#endif
+#ifndef TkpTestsendCmd
+#define TkpTestsendCmd \
+ (tkIntPlatStubsPtr->tkpTestsendCmd) /* 13 */
+#endif
#endif /* X11 */
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 05fb35a..bf80342 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -13,11 +13,7 @@
#ifndef _TKINTXLIBDECLS
#define _TKINTXLIBDECLS
-#ifdef MAC_TCL
-#include "Xutil.h"
-#else
#include "X11/Xutil.h"
-#endif
#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
@@ -36,1217 +32,1370 @@
* Exported function declarations:
*/
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef XSetDashes_TCL_DECLARED
+#define XSetDashes_TCL_DECLARED
/* 0 */
-EXTERN void XSetDashes _ANSI_ARGS_((Display* display, GC gc,
- int dash_offset, _Xconst char* dash_list,
- int n));
+EXTERN void XSetDashes(Display *display, GC gc, int dash_offset,
+ _Xconst char *dash_list, int n);
+#endif
+#ifndef XGetModifierMapping_TCL_DECLARED
+#define XGetModifierMapping_TCL_DECLARED
/* 1 */
-EXTERN XModifierKeymap* XGetModifierMapping _ANSI_ARGS_((Display* d));
+EXTERN XModifierKeymap * XGetModifierMapping(Display *d);
+#endif
+#ifndef XCreateImage_TCL_DECLARED
+#define XCreateImage_TCL_DECLARED
/* 2 */
-EXTERN XImage * XCreateImage _ANSI_ARGS_((Display* d, Visual* v,
- unsigned int ui1, int i1, int i2, char* cp,
- unsigned int ui2, unsigned int ui3, int i3,
- int i4));
+EXTERN XImage * XCreateImage(Display *d, Visual *v, unsigned int ui1,
+ int i1, int i2, char *cp, unsigned int ui2,
+ unsigned int ui3, int i3, int i4);
+#endif
+#ifndef XGetImage_TCL_DECLARED
+#define XGetImage_TCL_DECLARED
/* 3 */
-EXTERN XImage * XGetImage _ANSI_ARGS_((Display* d, Drawable dr,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, unsigned long ul, int i3));
+EXTERN XImage * XGetImage(Display *d, Drawable dr, int i1, int i2,
+ unsigned int ui1, unsigned int ui2,
+ unsigned long ul, int i3);
+#endif
+#ifndef XGetAtomName_TCL_DECLARED
+#define XGetAtomName_TCL_DECLARED
/* 4 */
-EXTERN char * XGetAtomName _ANSI_ARGS_((Display* d, Atom a));
+EXTERN char * XGetAtomName(Display *d, Atom a);
+#endif
+#ifndef XKeysymToString_TCL_DECLARED
+#define XKeysymToString_TCL_DECLARED
/* 5 */
-EXTERN char * XKeysymToString _ANSI_ARGS_((KeySym k));
+EXTERN char * XKeysymToString(KeySym k);
+#endif
+#ifndef XCreateColormap_TCL_DECLARED
+#define XCreateColormap_TCL_DECLARED
/* 6 */
-EXTERN Colormap XCreateColormap _ANSI_ARGS_((Display* d, Window w,
- Visual* v, int i));
+EXTERN Colormap XCreateColormap(Display *d, Window w, Visual *v,
+ int i);
+#endif
+#ifndef XCreatePixmapCursor_TCL_DECLARED
+#define XCreatePixmapCursor_TCL_DECLARED
/* 7 */
-EXTERN Cursor XCreatePixmapCursor _ANSI_ARGS_((Display* d,
- Pixmap p1, Pixmap p2, XColor* x1, XColor* x2,
- unsigned int ui1, unsigned int ui2));
+EXTERN Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2,
+ XColor *x1, XColor *x2, unsigned int ui1,
+ unsigned int ui2);
+#endif
+#ifndef XCreateGlyphCursor_TCL_DECLARED
+#define XCreateGlyphCursor_TCL_DECLARED
/* 8 */
-EXTERN Cursor XCreateGlyphCursor _ANSI_ARGS_((Display* d, Font f1,
- Font f2, unsigned int ui1, unsigned int ui2,
- XColor* x1, XColor* x2));
+EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2,
+ unsigned int ui1, unsigned int ui2,
+ XColor *x1, XColor *x2);
+#endif
+#ifndef XGContextFromGC_TCL_DECLARED
+#define XGContextFromGC_TCL_DECLARED
/* 9 */
-EXTERN GContext XGContextFromGC _ANSI_ARGS_((GC g));
+EXTERN GContext XGContextFromGC(GC g);
+#endif
+#ifndef XListHosts_TCL_DECLARED
+#define XListHosts_TCL_DECLARED
/* 10 */
-EXTERN XHostAddress * XListHosts _ANSI_ARGS_((Display* d, int* i, Bool* b));
+EXTERN XHostAddress * XListHosts(Display *d, int *i, Bool *b);
+#endif
+#ifndef XKeycodeToKeysym_TCL_DECLARED
+#define XKeycodeToKeysym_TCL_DECLARED
/* 11 */
-EXTERN KeySym XKeycodeToKeysym _ANSI_ARGS_((Display* d,
- unsigned int k, int i));
+EXTERN KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i);
+#endif
+#ifndef XStringToKeysym_TCL_DECLARED
+#define XStringToKeysym_TCL_DECLARED
/* 12 */
-EXTERN KeySym XStringToKeysym _ANSI_ARGS_((_Xconst char* c));
+EXTERN KeySym XStringToKeysym(_Xconst char *c);
+#endif
+#ifndef XRootWindow_TCL_DECLARED
+#define XRootWindow_TCL_DECLARED
/* 13 */
-EXTERN Window XRootWindow _ANSI_ARGS_((Display* d, int i));
+EXTERN Window XRootWindow(Display *d, int i);
+#endif
+#ifndef XSetErrorHandler_TCL_DECLARED
+#define XSetErrorHandler_TCL_DECLARED
/* 14 */
-EXTERN XErrorHandler XSetErrorHandler _ANSI_ARGS_((XErrorHandler x));
+EXTERN XErrorHandler XSetErrorHandler(XErrorHandler x);
+#endif
+#ifndef XIconifyWindow_TCL_DECLARED
+#define XIconifyWindow_TCL_DECLARED
/* 15 */
-EXTERN Status XIconifyWindow _ANSI_ARGS_((Display* d, Window w,
- int i));
+EXTERN Status XIconifyWindow(Display *d, Window w, int i);
+#endif
+#ifndef XWithdrawWindow_TCL_DECLARED
+#define XWithdrawWindow_TCL_DECLARED
/* 16 */
-EXTERN Status XWithdrawWindow _ANSI_ARGS_((Display* d, Window w,
- int i));
+EXTERN Status XWithdrawWindow(Display *d, Window w, int i);
+#endif
+#ifndef XGetWMColormapWindows_TCL_DECLARED
+#define XGetWMColormapWindows_TCL_DECLARED
/* 17 */
-EXTERN Status XGetWMColormapWindows _ANSI_ARGS_((Display* d,
- Window w, Window** wpp, int* ip));
+EXTERN Status XGetWMColormapWindows(Display *d, Window w,
+ Window **wpp, int *ip);
+#endif
+#ifndef XAllocColor_TCL_DECLARED
+#define XAllocColor_TCL_DECLARED
/* 18 */
-EXTERN Status XAllocColor _ANSI_ARGS_((Display* d, Colormap c,
- XColor* xp));
+EXTERN Status XAllocColor(Display *d, Colormap c, XColor *xp);
+#endif
+#ifndef XBell_TCL_DECLARED
+#define XBell_TCL_DECLARED
/* 19 */
-EXTERN void XBell _ANSI_ARGS_((Display* d, int i));
+EXTERN void XBell(Display *d, int i);
+#endif
+#ifndef XChangeProperty_TCL_DECLARED
+#define XChangeProperty_TCL_DECLARED
/* 20 */
-EXTERN void XChangeProperty _ANSI_ARGS_((Display* d, Window w,
- Atom a1, Atom a2, int i1, int i2,
- _Xconst unsigned char* c, int i3));
+EXTERN void XChangeProperty(Display *d, Window w, Atom a1,
+ Atom a2, int i1, int i2,
+ _Xconst unsigned char *c, int i3);
+#endif
+#ifndef XChangeWindowAttributes_TCL_DECLARED
+#define XChangeWindowAttributes_TCL_DECLARED
/* 21 */
-EXTERN void XChangeWindowAttributes _ANSI_ARGS_((Display* d,
- Window w, unsigned long ul,
- XSetWindowAttributes* x));
+EXTERN void XChangeWindowAttributes(Display *d, Window w,
+ unsigned long ul, XSetWindowAttributes *x);
+#endif
+#ifndef XClearWindow_TCL_DECLARED
+#define XClearWindow_TCL_DECLARED
/* 22 */
-EXTERN void XClearWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XClearWindow(Display *d, Window w);
+#endif
+#ifndef XConfigureWindow_TCL_DECLARED
+#define XConfigureWindow_TCL_DECLARED
/* 23 */
-EXTERN void XConfigureWindow _ANSI_ARGS_((Display* d, Window w,
- unsigned int i, XWindowChanges* x));
+EXTERN void XConfigureWindow(Display *d, Window w,
+ unsigned int i, XWindowChanges *x);
+#endif
+#ifndef XCopyArea_TCL_DECLARED
+#define XCopyArea_TCL_DECLARED
/* 24 */
-EXTERN void XCopyArea _ANSI_ARGS_((Display* d, Drawable dr1,
- Drawable dr2, GC g, int i1, int i2,
- unsigned int ui1, unsigned int ui2, int i3,
- int i4));
+EXTERN void XCopyArea(Display *d, Drawable dr1, Drawable dr2,
+ GC g, int i1, int i2, unsigned int ui1,
+ unsigned int ui2, int i3, int i4);
+#endif
+#ifndef XCopyPlane_TCL_DECLARED
+#define XCopyPlane_TCL_DECLARED
/* 25 */
-EXTERN void XCopyPlane _ANSI_ARGS_((Display* d, Drawable dr1,
- Drawable dr2, GC g, int i1, int i2,
- unsigned int ui1, unsigned int ui2, int i3,
- int i4, unsigned long ul));
+EXTERN void XCopyPlane(Display *d, Drawable dr1, Drawable dr2,
+ GC g, int i1, int i2, unsigned int ui1,
+ unsigned int ui2, int i3, int i4,
+ unsigned long ul);
+#endif
+#ifndef XCreateBitmapFromData_TCL_DECLARED
+#define XCreateBitmapFromData_TCL_DECLARED
/* 26 */
-EXTERN Pixmap XCreateBitmapFromData _ANSI_ARGS_((Display* display,
- Drawable d, _Xconst char* data,
- unsigned int width, unsigned int height));
+EXTERN Pixmap XCreateBitmapFromData(Display *display, Drawable d,
+ _Xconst char *data, unsigned int width,
+ unsigned int height);
+#endif
+#ifndef XDefineCursor_TCL_DECLARED
+#define XDefineCursor_TCL_DECLARED
/* 27 */
-EXTERN void XDefineCursor _ANSI_ARGS_((Display* d, Window w,
- Cursor c));
+EXTERN void XDefineCursor(Display *d, Window w, Cursor c);
+#endif
+#ifndef XDeleteProperty_TCL_DECLARED
+#define XDeleteProperty_TCL_DECLARED
/* 28 */
-EXTERN void XDeleteProperty _ANSI_ARGS_((Display* d, Window w,
- Atom a));
+EXTERN void XDeleteProperty(Display *d, Window w, Atom a);
+#endif
+#ifndef XDestroyWindow_TCL_DECLARED
+#define XDestroyWindow_TCL_DECLARED
/* 29 */
-EXTERN void XDestroyWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XDestroyWindow(Display *d, Window w);
+#endif
+#ifndef XDrawArc_TCL_DECLARED
+#define XDrawArc_TCL_DECLARED
/* 30 */
-EXTERN void XDrawArc _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, int i3, int i4));
+EXTERN void XDrawArc(Display *d, Drawable dr, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2,
+ int i3, int i4);
+#endif
+#ifndef XDrawLines_TCL_DECLARED
+#define XDrawLines_TCL_DECLARED
/* 31 */
-EXTERN void XDrawLines _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XPoint* x, int i1, int i2));
+EXTERN void XDrawLines(Display *d, Drawable dr, GC g, XPoint *x,
+ int i1, int i2);
+#endif
+#ifndef XDrawRectangle_TCL_DECLARED
+#define XDrawRectangle_TCL_DECLARED
/* 32 */
-EXTERN void XDrawRectangle _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, int i1, int i2, unsigned int ui1,
- unsigned int ui2));
+EXTERN void XDrawRectangle(Display *d, Drawable dr, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2);
+#endif
+#ifndef XFillArc_TCL_DECLARED
+#define XFillArc_TCL_DECLARED
/* 33 */
-EXTERN void XFillArc _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, int i3, int i4));
+EXTERN void XFillArc(Display *d, Drawable dr, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2,
+ int i3, int i4);
+#endif
+#ifndef XFillPolygon_TCL_DECLARED
+#define XFillPolygon_TCL_DECLARED
/* 34 */
-EXTERN void XFillPolygon _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XPoint* x, int i1, int i2, int i3));
+EXTERN void XFillPolygon(Display *d, Drawable dr, GC g,
+ XPoint *x, int i1, int i2, int i3);
+#endif
+#ifndef XFillRectangles_TCL_DECLARED
+#define XFillRectangles_TCL_DECLARED
/* 35 */
-EXTERN void XFillRectangles _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XRectangle* x, int i));
+EXTERN void XFillRectangles(Display *d, Drawable dr, GC g,
+ XRectangle *x, int i);
+#endif
+#ifndef XForceScreenSaver_TCL_DECLARED
+#define XForceScreenSaver_TCL_DECLARED
/* 36 */
-EXTERN void XForceScreenSaver _ANSI_ARGS_((Display* d, int i));
+EXTERN void XForceScreenSaver(Display *d, int i);
+#endif
+#ifndef XFreeColormap_TCL_DECLARED
+#define XFreeColormap_TCL_DECLARED
/* 37 */
-EXTERN void XFreeColormap _ANSI_ARGS_((Display* d, Colormap c));
+EXTERN void XFreeColormap(Display *d, Colormap c);
+#endif
+#ifndef XFreeColors_TCL_DECLARED
+#define XFreeColors_TCL_DECLARED
/* 38 */
-EXTERN void XFreeColors _ANSI_ARGS_((Display* d, Colormap c,
- unsigned long* ulp, int i, unsigned long ul));
+EXTERN void XFreeColors(Display *d, Colormap c,
+ unsigned long *ulp, int i, unsigned long ul);
+#endif
+#ifndef XFreeCursor_TCL_DECLARED
+#define XFreeCursor_TCL_DECLARED
/* 39 */
-EXTERN void XFreeCursor _ANSI_ARGS_((Display* d, Cursor c));
+EXTERN void XFreeCursor(Display *d, Cursor c);
+#endif
+#ifndef XFreeModifiermap_TCL_DECLARED
+#define XFreeModifiermap_TCL_DECLARED
/* 40 */
-EXTERN void XFreeModifiermap _ANSI_ARGS_((XModifierKeymap* x));
+EXTERN void XFreeModifiermap(XModifierKeymap *x);
+#endif
+#ifndef XGetGeometry_TCL_DECLARED
+#define XGetGeometry_TCL_DECLARED
/* 41 */
-EXTERN Status XGetGeometry _ANSI_ARGS_((Display* d, Drawable dr,
- Window* w, int* i1, int* i2,
- unsigned int* ui1, unsigned int* ui2,
- unsigned int* ui3, unsigned int* ui4));
+EXTERN Status XGetGeometry(Display *d, Drawable dr, Window *w,
+ int *i1, int *i2, unsigned int *ui1,
+ unsigned int *ui2, unsigned int *ui3,
+ unsigned int *ui4);
+#endif
+#ifndef XGetInputFocus_TCL_DECLARED
+#define XGetInputFocus_TCL_DECLARED
/* 42 */
-EXTERN void XGetInputFocus _ANSI_ARGS_((Display* d, Window* w,
- int* i));
+EXTERN void XGetInputFocus(Display *d, Window *w, int *i);
+#endif
+#ifndef XGetWindowProperty_TCL_DECLARED
+#define XGetWindowProperty_TCL_DECLARED
/* 43 */
-EXTERN int XGetWindowProperty _ANSI_ARGS_((Display* d, Window w,
- Atom a1, long l1, long l2, Bool b, Atom a2,
- Atom* ap, int* ip, unsigned long* ulp1,
- unsigned long* ulp2, unsigned char** cpp));
+EXTERN int XGetWindowProperty(Display *d, Window w, Atom a1,
+ long l1, long l2, Bool b, Atom a2, Atom *ap,
+ int *ip, unsigned long *ulp1,
+ unsigned long *ulp2, unsigned char **cpp);
+#endif
+#ifndef XGetWindowAttributes_TCL_DECLARED
+#define XGetWindowAttributes_TCL_DECLARED
/* 44 */
-EXTERN Status XGetWindowAttributes _ANSI_ARGS_((Display* d,
- Window w, XWindowAttributes* x));
+EXTERN Status XGetWindowAttributes(Display *d, Window w,
+ XWindowAttributes *x);
+#endif
+#ifndef XGrabKeyboard_TCL_DECLARED
+#define XGrabKeyboard_TCL_DECLARED
/* 45 */
-EXTERN int XGrabKeyboard _ANSI_ARGS_((Display* d, Window w,
- Bool b, int i1, int i2, Time t));
+EXTERN int XGrabKeyboard(Display *d, Window w, Bool b, int i1,
+ int i2, Time t);
+#endif
+#ifndef XGrabPointer_TCL_DECLARED
+#define XGrabPointer_TCL_DECLARED
/* 46 */
-EXTERN int XGrabPointer _ANSI_ARGS_((Display* d, Window w1,
- Bool b, unsigned int ui, int i1, int i2,
- Window w2, Cursor c, Time t));
+EXTERN int XGrabPointer(Display *d, Window w1, Bool b,
+ unsigned int ui, int i1, int i2, Window w2,
+ Cursor c, Time t);
+#endif
+#ifndef XKeysymToKeycode_TCL_DECLARED
+#define XKeysymToKeycode_TCL_DECLARED
/* 47 */
-EXTERN KeyCode XKeysymToKeycode _ANSI_ARGS_((Display* d, KeySym k));
+EXTERN KeyCode XKeysymToKeycode(Display *d, KeySym k);
+#endif
+#ifndef XLookupColor_TCL_DECLARED
+#define XLookupColor_TCL_DECLARED
/* 48 */
-EXTERN Status XLookupColor _ANSI_ARGS_((Display* d, Colormap c1,
- _Xconst char* c2, XColor* x1, XColor* x2));
+EXTERN Status XLookupColor(Display *d, Colormap c1,
+ _Xconst char *c2, XColor *x1, XColor *x2);
+#endif
+#ifndef XMapWindow_TCL_DECLARED
+#define XMapWindow_TCL_DECLARED
/* 49 */
-EXTERN void XMapWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XMapWindow(Display *d, Window w);
+#endif
+#ifndef XMoveResizeWindow_TCL_DECLARED
+#define XMoveResizeWindow_TCL_DECLARED
/* 50 */
-EXTERN void XMoveResizeWindow _ANSI_ARGS_((Display* d, Window w,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2));
+EXTERN void XMoveResizeWindow(Display *d, Window w, int i1,
+ int i2, unsigned int ui1, unsigned int ui2);
+#endif
+#ifndef XMoveWindow_TCL_DECLARED
+#define XMoveWindow_TCL_DECLARED
/* 51 */
-EXTERN void XMoveWindow _ANSI_ARGS_((Display* d, Window w,
- int i1, int i2));
+EXTERN void XMoveWindow(Display *d, Window w, int i1, int i2);
+#endif
+#ifndef XNextEvent_TCL_DECLARED
+#define XNextEvent_TCL_DECLARED
/* 52 */
-EXTERN void XNextEvent _ANSI_ARGS_((Display* d, XEvent* x));
+EXTERN void XNextEvent(Display *d, XEvent *x);
+#endif
+#ifndef XPutBackEvent_TCL_DECLARED
+#define XPutBackEvent_TCL_DECLARED
/* 53 */
-EXTERN void XPutBackEvent _ANSI_ARGS_((Display* d, XEvent* x));
+EXTERN void XPutBackEvent(Display *d, XEvent *x);
+#endif
+#ifndef XQueryColors_TCL_DECLARED
+#define XQueryColors_TCL_DECLARED
/* 54 */
-EXTERN void XQueryColors _ANSI_ARGS_((Display* d, Colormap c,
- XColor* x, int i));
+EXTERN void XQueryColors(Display *d, Colormap c, XColor *x,
+ int i);
+#endif
+#ifndef XQueryPointer_TCL_DECLARED
+#define XQueryPointer_TCL_DECLARED
/* 55 */
-EXTERN Bool XQueryPointer _ANSI_ARGS_((Display* d, Window w1,
- Window* w2, Window* w3, int* i1, int* i2,
- int* i3, int* i4, unsigned int* ui));
+EXTERN Bool XQueryPointer(Display *d, Window w1, Window *w2,
+ Window *w3, int *i1, int *i2, int *i3,
+ int *i4, unsigned int *ui);
+#endif
+#ifndef XQueryTree_TCL_DECLARED
+#define XQueryTree_TCL_DECLARED
/* 56 */
-EXTERN Status XQueryTree _ANSI_ARGS_((Display* d, Window w1,
- Window* w2, Window* w3, Window** w4,
- unsigned int* ui));
+EXTERN Status XQueryTree(Display *d, Window w1, Window *w2,
+ Window *w3, Window **w4, unsigned int *ui);
+#endif
+#ifndef XRaiseWindow_TCL_DECLARED
+#define XRaiseWindow_TCL_DECLARED
/* 57 */
-EXTERN void XRaiseWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XRaiseWindow(Display *d, Window w);
+#endif
+#ifndef XRefreshKeyboardMapping_TCL_DECLARED
+#define XRefreshKeyboardMapping_TCL_DECLARED
/* 58 */
-EXTERN void XRefreshKeyboardMapping _ANSI_ARGS_((
- XMappingEvent* x));
+EXTERN void XRefreshKeyboardMapping(XMappingEvent *x);
+#endif
+#ifndef XResizeWindow_TCL_DECLARED
+#define XResizeWindow_TCL_DECLARED
/* 59 */
-EXTERN void XResizeWindow _ANSI_ARGS_((Display* d, Window w,
- unsigned int ui1, unsigned int ui2));
+EXTERN void XResizeWindow(Display *d, Window w, unsigned int ui1,
+ unsigned int ui2);
+#endif
+#ifndef XSelectInput_TCL_DECLARED
+#define XSelectInput_TCL_DECLARED
/* 60 */
-EXTERN void XSelectInput _ANSI_ARGS_((Display* d, Window w,
- long l));
+EXTERN void XSelectInput(Display *d, Window w, long l);
+#endif
+#ifndef XSendEvent_TCL_DECLARED
+#define XSendEvent_TCL_DECLARED
/* 61 */
-EXTERN Status XSendEvent _ANSI_ARGS_((Display* d, Window w, Bool b,
- long l, XEvent* x));
+EXTERN Status XSendEvent(Display *d, Window w, Bool b, long l,
+ XEvent *x);
+#endif
+#ifndef XSetCommand_TCL_DECLARED
+#define XSetCommand_TCL_DECLARED
/* 62 */
-EXTERN void XSetCommand _ANSI_ARGS_((Display* d, Window w,
- CONST char** c, int i));
+EXTERN void XSetCommand(Display *d, Window w, CONST char **c,
+ int i);
+#endif
+#ifndef XSetIconName_TCL_DECLARED
+#define XSetIconName_TCL_DECLARED
/* 63 */
-EXTERN void XSetIconName _ANSI_ARGS_((Display* d, Window w,
- _Xconst char* c));
+EXTERN void XSetIconName(Display *d, Window w, _Xconst char *c);
+#endif
+#ifndef XSetInputFocus_TCL_DECLARED
+#define XSetInputFocus_TCL_DECLARED
/* 64 */
-EXTERN void XSetInputFocus _ANSI_ARGS_((Display* d, Window w,
- int i, Time t));
+EXTERN void XSetInputFocus(Display *d, Window w, int i, Time t);
+#endif
+#ifndef XSetSelectionOwner_TCL_DECLARED
+#define XSetSelectionOwner_TCL_DECLARED
/* 65 */
-EXTERN void XSetSelectionOwner _ANSI_ARGS_((Display* d, Atom a,
- Window w, Time t));
+EXTERN void XSetSelectionOwner(Display *d, Atom a, Window w,
+ Time t);
+#endif
+#ifndef XSetWindowBackground_TCL_DECLARED
+#define XSetWindowBackground_TCL_DECLARED
/* 66 */
-EXTERN void XSetWindowBackground _ANSI_ARGS_((Display* d,
- Window w, unsigned long ul));
+EXTERN void XSetWindowBackground(Display *d, Window w,
+ unsigned long ul);
+#endif
+#ifndef XSetWindowBackgroundPixmap_TCL_DECLARED
+#define XSetWindowBackgroundPixmap_TCL_DECLARED
/* 67 */
-EXTERN void XSetWindowBackgroundPixmap _ANSI_ARGS_((Display* d,
- Window w, Pixmap p));
+EXTERN void XSetWindowBackgroundPixmap(Display *d, Window w,
+ Pixmap p);
+#endif
+#ifndef XSetWindowBorder_TCL_DECLARED
+#define XSetWindowBorder_TCL_DECLARED
/* 68 */
-EXTERN void XSetWindowBorder _ANSI_ARGS_((Display* d, Window w,
- unsigned long ul));
+EXTERN void XSetWindowBorder(Display *d, Window w,
+ unsigned long ul);
+#endif
+#ifndef XSetWindowBorderPixmap_TCL_DECLARED
+#define XSetWindowBorderPixmap_TCL_DECLARED
/* 69 */
-EXTERN void XSetWindowBorderPixmap _ANSI_ARGS_((Display* d,
- Window w, Pixmap p));
+EXTERN void XSetWindowBorderPixmap(Display *d, Window w,
+ Pixmap p);
+#endif
+#ifndef XSetWindowBorderWidth_TCL_DECLARED
+#define XSetWindowBorderWidth_TCL_DECLARED
/* 70 */
-EXTERN void XSetWindowBorderWidth _ANSI_ARGS_((Display* d,
- Window w, unsigned int ui));
+EXTERN void XSetWindowBorderWidth(Display *d, Window w,
+ unsigned int ui);
+#endif
+#ifndef XSetWindowColormap_TCL_DECLARED
+#define XSetWindowColormap_TCL_DECLARED
/* 71 */
-EXTERN void XSetWindowColormap _ANSI_ARGS_((Display* d, Window w,
- Colormap c));
+EXTERN void XSetWindowColormap(Display *d, Window w, Colormap c);
+#endif
+#ifndef XTranslateCoordinates_TCL_DECLARED
+#define XTranslateCoordinates_TCL_DECLARED
/* 72 */
-EXTERN Bool XTranslateCoordinates _ANSI_ARGS_((Display* d,
- Window w1, Window w2, int i1, int i2,
- int* i3, int* i4, Window* w3));
+EXTERN Bool XTranslateCoordinates(Display *d, Window w1,
+ Window w2, int i1, int i2, int *i3, int *i4,
+ Window *w3);
+#endif
+#ifndef XUngrabKeyboard_TCL_DECLARED
+#define XUngrabKeyboard_TCL_DECLARED
/* 73 */
-EXTERN void XUngrabKeyboard _ANSI_ARGS_((Display* d, Time t));
+EXTERN void XUngrabKeyboard(Display *d, Time t);
+#endif
+#ifndef XUngrabPointer_TCL_DECLARED
+#define XUngrabPointer_TCL_DECLARED
/* 74 */
-EXTERN void XUngrabPointer _ANSI_ARGS_((Display* d, Time t));
+EXTERN void XUngrabPointer(Display *d, Time t);
+#endif
+#ifndef XUnmapWindow_TCL_DECLARED
+#define XUnmapWindow_TCL_DECLARED
/* 75 */
-EXTERN void XUnmapWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XUnmapWindow(Display *d, Window w);
+#endif
+#ifndef XWindowEvent_TCL_DECLARED
+#define XWindowEvent_TCL_DECLARED
/* 76 */
-EXTERN void XWindowEvent _ANSI_ARGS_((Display* d, Window w,
- long l, XEvent* x));
+EXTERN void XWindowEvent(Display *d, Window w, long l, XEvent *x);
+#endif
+#ifndef XDestroyIC_TCL_DECLARED
+#define XDestroyIC_TCL_DECLARED
/* 77 */
-EXTERN void XDestroyIC _ANSI_ARGS_((XIC x));
+EXTERN void XDestroyIC(XIC x);
+#endif
+#ifndef XFilterEvent_TCL_DECLARED
+#define XFilterEvent_TCL_DECLARED
/* 78 */
-EXTERN Bool XFilterEvent _ANSI_ARGS_((XEvent* x, Window w));
+EXTERN Bool XFilterEvent(XEvent *x, Window w);
+#endif
+#ifndef XmbLookupString_TCL_DECLARED
+#define XmbLookupString_TCL_DECLARED
/* 79 */
-EXTERN int XmbLookupString _ANSI_ARGS_((XIC xi,
- XKeyPressedEvent* xk, char* c, int i,
- KeySym* k, Status* s));
+EXTERN int XmbLookupString(XIC xi, XKeyPressedEvent *xk,
+ char *c, int i, KeySym *k, Status *s);
+#endif
+#ifndef TkPutImage_TCL_DECLARED
+#define TkPutImage_TCL_DECLARED
/* 80 */
-EXTERN void TkPutImage _ANSI_ARGS_((unsigned long * colors,
- int ncolors, Display* display, Drawable d,
- GC gc, XImage* image, int src_x, int src_y,
- int dest_x, int dest_y, unsigned int width,
- unsigned int height));
+EXTERN void TkPutImage(unsigned long *colors, int ncolors,
+ Display *display, Drawable d, GC gc,
+ XImage *image, int src_x, int src_y,
+ int dest_x, int dest_y, unsigned int width,
+ unsigned int height);
+#endif
/* Slot 81 is reserved */
+#ifndef XParseColor_TCL_DECLARED
+#define XParseColor_TCL_DECLARED
/* 82 */
-EXTERN Status XParseColor _ANSI_ARGS_((Display * display,
- Colormap map, _Xconst char* spec,
- XColor * colorPtr));
+EXTERN Status XParseColor(Display *display, Colormap map,
+ _Xconst char *spec, XColor *colorPtr);
+#endif
+#ifndef XCreateGC_TCL_DECLARED
+#define XCreateGC_TCL_DECLARED
/* 83 */
-EXTERN GC XCreateGC _ANSI_ARGS_((Display* display, Drawable d,
- unsigned long valuemask, XGCValues* values));
+EXTERN GC XCreateGC(Display *display, Drawable d,
+ unsigned long valuemask, XGCValues *values);
+#endif
+#ifndef XFreeGC_TCL_DECLARED
+#define XFreeGC_TCL_DECLARED
/* 84 */
-EXTERN void XFreeGC _ANSI_ARGS_((Display* display, GC gc));
+EXTERN void XFreeGC(Display *display, GC gc);
+#endif
+#ifndef XInternAtom_TCL_DECLARED
+#define XInternAtom_TCL_DECLARED
/* 85 */
-EXTERN Atom XInternAtom _ANSI_ARGS_((Display* display,
- _Xconst char* atom_name, Bool only_if_exists));
+EXTERN Atom XInternAtom(Display *display,
+ _Xconst char *atom_name, Bool only_if_exists);
+#endif
+#ifndef XSetBackground_TCL_DECLARED
+#define XSetBackground_TCL_DECLARED
/* 86 */
-EXTERN void XSetBackground _ANSI_ARGS_((Display* display, GC gc,
- unsigned long foreground));
+EXTERN void XSetBackground(Display *display, GC gc,
+ unsigned long foreground);
+#endif
+#ifndef XSetForeground_TCL_DECLARED
+#define XSetForeground_TCL_DECLARED
/* 87 */
-EXTERN void XSetForeground _ANSI_ARGS_((Display* display, GC gc,
- unsigned long foreground));
+EXTERN void XSetForeground(Display *display, GC gc,
+ unsigned long foreground);
+#endif
+#ifndef XSetClipMask_TCL_DECLARED
+#define XSetClipMask_TCL_DECLARED
/* 88 */
-EXTERN void XSetClipMask _ANSI_ARGS_((Display* display, GC gc,
- Pixmap pixmap));
+EXTERN void XSetClipMask(Display *display, GC gc, Pixmap pixmap);
+#endif
+#ifndef XSetClipOrigin_TCL_DECLARED
+#define XSetClipOrigin_TCL_DECLARED
/* 89 */
-EXTERN void XSetClipOrigin _ANSI_ARGS_((Display* display, GC gc,
- int clip_x_origin, int clip_y_origin));
+EXTERN void XSetClipOrigin(Display *display, GC gc,
+ int clip_x_origin, int clip_y_origin);
+#endif
+#ifndef XSetTSOrigin_TCL_DECLARED
+#define XSetTSOrigin_TCL_DECLARED
/* 90 */
-EXTERN void XSetTSOrigin _ANSI_ARGS_((Display* display, GC gc,
- int ts_x_origin, int ts_y_origin));
+EXTERN void XSetTSOrigin(Display *display, GC gc,
+ int ts_x_origin, int ts_y_origin);
+#endif
+#ifndef XChangeGC_TCL_DECLARED
+#define XChangeGC_TCL_DECLARED
/* 91 */
-EXTERN void XChangeGC _ANSI_ARGS_((Display * d, GC gc,
- unsigned long mask, XGCValues * values));
+EXTERN void XChangeGC(Display *d, GC gc, unsigned long mask,
+ XGCValues *values);
+#endif
+#ifndef XSetFont_TCL_DECLARED
+#define XSetFont_TCL_DECLARED
/* 92 */
-EXTERN void XSetFont _ANSI_ARGS_((Display * display, GC gc,
- Font font));
+EXTERN void XSetFont(Display *display, GC gc, Font font);
+#endif
+#ifndef XSetArcMode_TCL_DECLARED
+#define XSetArcMode_TCL_DECLARED
/* 93 */
-EXTERN void XSetArcMode _ANSI_ARGS_((Display * display, GC gc,
- int arc_mode));
+EXTERN void XSetArcMode(Display *display, GC gc, int arc_mode);
+#endif
+#ifndef XSetStipple_TCL_DECLARED
+#define XSetStipple_TCL_DECLARED
/* 94 */
-EXTERN void XSetStipple _ANSI_ARGS_((Display * display, GC gc,
- Pixmap stipple));
+EXTERN void XSetStipple(Display *display, GC gc, Pixmap stipple);
+#endif
+#ifndef XSetFillRule_TCL_DECLARED
+#define XSetFillRule_TCL_DECLARED
/* 95 */
-EXTERN void XSetFillRule _ANSI_ARGS_((Display * display, GC gc,
- int fill_rule));
+EXTERN void XSetFillRule(Display *display, GC gc, int fill_rule);
+#endif
+#ifndef XSetFillStyle_TCL_DECLARED
+#define XSetFillStyle_TCL_DECLARED
/* 96 */
-EXTERN void XSetFillStyle _ANSI_ARGS_((Display * display, GC gc,
- int fill_style));
+EXTERN void XSetFillStyle(Display *display, GC gc,
+ int fill_style);
+#endif
+#ifndef XSetFunction_TCL_DECLARED
+#define XSetFunction_TCL_DECLARED
/* 97 */
-EXTERN void XSetFunction _ANSI_ARGS_((Display * display, GC gc,
- int function));
+EXTERN void XSetFunction(Display *display, GC gc, int function);
+#endif
+#ifndef XSetLineAttributes_TCL_DECLARED
+#define XSetLineAttributes_TCL_DECLARED
/* 98 */
-EXTERN void XSetLineAttributes _ANSI_ARGS_((Display * display,
- GC gc, unsigned int line_width,
- int line_style, int cap_style,
- int join_style));
+EXTERN void XSetLineAttributes(Display *display, GC gc,
+ unsigned int line_width, int line_style,
+ int cap_style, int join_style);
+#endif
+#ifndef _XInitImageFuncPtrs_TCL_DECLARED
+#define _XInitImageFuncPtrs_TCL_DECLARED
/* 99 */
-EXTERN int _XInitImageFuncPtrs _ANSI_ARGS_((XImage * image));
+EXTERN int _XInitImageFuncPtrs(XImage *image);
+#endif
+#ifndef XCreateIC_TCL_DECLARED
+#define XCreateIC_TCL_DECLARED
/* 100 */
-EXTERN XIC XCreateIC _ANSI_ARGS_((void));
+EXTERN XIC XCreateIC(void);
+#endif
+#ifndef XGetVisualInfo_TCL_DECLARED
+#define XGetVisualInfo_TCL_DECLARED
/* 101 */
-EXTERN XVisualInfo * XGetVisualInfo _ANSI_ARGS_((Display* display,
- long vinfo_mask, XVisualInfo* vinfo_template,
- int* nitems_return));
+EXTERN XVisualInfo * XGetVisualInfo(Display *display, long vinfo_mask,
+ XVisualInfo *vinfo_template,
+ int *nitems_return);
+#endif
+#ifndef XSetWMClientMachine_TCL_DECLARED
+#define XSetWMClientMachine_TCL_DECLARED
/* 102 */
-EXTERN void XSetWMClientMachine _ANSI_ARGS_((Display* display,
- Window w, XTextProperty* text_prop));
+EXTERN void XSetWMClientMachine(Display *display, Window w,
+ XTextProperty *text_prop);
+#endif
+#ifndef XStringListToTextProperty_TCL_DECLARED
+#define XStringListToTextProperty_TCL_DECLARED
/* 103 */
-EXTERN Status XStringListToTextProperty _ANSI_ARGS_((char** list,
- int count, XTextProperty* text_prop_return));
+EXTERN Status XStringListToTextProperty(char **list, int count,
+ XTextProperty *text_prop_return);
+#endif
+#ifndef XDrawLine_TCL_DECLARED
+#define XDrawLine_TCL_DECLARED
/* 104 */
-EXTERN void XDrawLine _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int x1, int y1, int x2, int y2));
+EXTERN void XDrawLine(Display *d, Drawable dr, GC g, int x1,
+ int y1, int x2, int y2);
+#endif
+#ifndef XWarpPointer_TCL_DECLARED
+#define XWarpPointer_TCL_DECLARED
/* 105 */
-EXTERN void XWarpPointer _ANSI_ARGS_((Display* d, Window s,
- Window dw, int sx, int sy, unsigned int sw,
- unsigned int sh, int dx, int dy));
+EXTERN void XWarpPointer(Display *d, Window s, Window dw, int sx,
+ int sy, unsigned int sw, unsigned int sh,
+ int dx, int dy);
+#endif
+#ifndef XFillRectangle_TCL_DECLARED
+#define XFillRectangle_TCL_DECLARED
/* 106 */
-EXTERN void XFillRectangle _ANSI_ARGS_((Display* display,
- Drawable d, GC gc, int x, int y,
- unsigned int width, unsigned int height));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
-/* 0 */
-EXTERN void XSetDashes _ANSI_ARGS_((Display* display, GC gc,
- int dash_offset, _Xconst char* dash_list,
- int n));
-/* 1 */
-EXTERN XModifierKeymap* XGetModifierMapping _ANSI_ARGS_((Display* d));
-/* 2 */
-EXTERN XImage * XCreateImage _ANSI_ARGS_((Display* d, Visual* v,
- unsigned int ui1, int i1, int i2, char* cp,
- unsigned int ui2, unsigned int ui3, int i3,
- int i4));
-/* 3 */
-EXTERN XImage * XGetImage _ANSI_ARGS_((Display* d, Drawable dr,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, unsigned long ul, int i3));
-/* 4 */
-EXTERN char * XGetAtomName _ANSI_ARGS_((Display* d, Atom a));
-/* 5 */
-EXTERN char * XKeysymToString _ANSI_ARGS_((KeySym k));
-/* 6 */
-EXTERN Colormap XCreateColormap _ANSI_ARGS_((Display* d, Window w,
- Visual* v, int i));
-/* 7 */
-EXTERN GContext XGContextFromGC _ANSI_ARGS_((GC g));
-/* 8 */
-EXTERN KeySym XKeycodeToKeysym _ANSI_ARGS_((Display* d, KeyCode k,
- int i));
-/* 9 */
-EXTERN KeySym XStringToKeysym _ANSI_ARGS_((_Xconst char* c));
-/* 10 */
-EXTERN Window XRootWindow _ANSI_ARGS_((Display* d, int i));
-/* 11 */
-EXTERN XErrorHandler XSetErrorHandler _ANSI_ARGS_((XErrorHandler x));
-/* 12 */
-EXTERN Status XAllocColor _ANSI_ARGS_((Display* d, Colormap c,
- XColor* xp));
-/* 13 */
-EXTERN void XBell _ANSI_ARGS_((Display* d, int i));
-/* 14 */
-EXTERN void XChangeProperty _ANSI_ARGS_((Display* d, Window w,
- Atom a1, Atom a2, int i1, int i2,
- _Xconst unsigned char* c, int i3));
-/* 15 */
-EXTERN void XChangeWindowAttributes _ANSI_ARGS_((Display* d,
- Window w, unsigned long ul,
- XSetWindowAttributes* x));
-/* 16 */
-EXTERN void XConfigureWindow _ANSI_ARGS_((Display* d, Window w,
- unsigned int i, XWindowChanges* x));
-/* 17 */
-EXTERN void XCopyArea _ANSI_ARGS_((Display* d, Drawable dr1,
- Drawable dr2, GC g, int i1, int i2,
- unsigned int ui1, unsigned int ui2, int i3,
- int i4));
-/* 18 */
-EXTERN void XCopyPlane _ANSI_ARGS_((Display* d, Drawable dr1,
- Drawable dr2, GC g, int i1, int i2,
- unsigned int ui1, unsigned int ui2, int i3,
- int i4, unsigned long ul));
-/* 19 */
-EXTERN Pixmap XCreateBitmapFromData _ANSI_ARGS_((Display* display,
- Drawable d, _Xconst char* data,
- unsigned int width, unsigned int height));
-/* 20 */
-EXTERN void XDefineCursor _ANSI_ARGS_((Display* d, Window w,
- Cursor c));
-/* 21 */
-EXTERN void XDestroyWindow _ANSI_ARGS_((Display* d, Window w));
-/* 22 */
-EXTERN void XDrawArc _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, int i3, int i4));
-/* 23 */
-EXTERN void XDrawLines _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XPoint* x, int i1, int i2));
-/* 24 */
-EXTERN void XDrawRectangle _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, int i1, int i2, unsigned int ui1,
- unsigned int ui2));
-/* 25 */
-EXTERN void XFillArc _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, int i3, int i4));
-/* 26 */
-EXTERN void XFillPolygon _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XPoint* x, int i1, int i2, int i3));
-/* 27 */
-EXTERN void XFillRectangles _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XRectangle* x, int i));
-/* 28 */
-EXTERN void XFreeColormap _ANSI_ARGS_((Display* d, Colormap c));
-/* 29 */
-EXTERN void XFreeColors _ANSI_ARGS_((Display* d, Colormap c,
- unsigned long* ulp, int i, unsigned long ul));
-/* 30 */
-EXTERN void XFreeModifiermap _ANSI_ARGS_((XModifierKeymap* x));
-/* 31 */
-EXTERN Status XGetGeometry _ANSI_ARGS_((Display* d, Drawable dr,
- Window* w, int* i1, int* i2,
- unsigned int* ui1, unsigned int* ui2,
- unsigned int* ui3, unsigned int* ui4));
-/* 32 */
-EXTERN int XGetWindowProperty _ANSI_ARGS_((Display* d, Window w,
- Atom a1, long l1, long l2, Bool b, Atom a2,
- Atom* ap, int* ip, unsigned long* ulp1,
- unsigned long* ulp2, unsigned char** cpp));
-/* 33 */
-EXTERN int XGrabKeyboard _ANSI_ARGS_((Display* d, Window w,
- Bool b, int i1, int i2, Time t));
-/* 34 */
-EXTERN int XGrabPointer _ANSI_ARGS_((Display* d, Window w1,
- Bool b, unsigned int ui, int i1, int i2,
- Window w2, Cursor c, Time t));
-/* 35 */
-EXTERN KeyCode XKeysymToKeycode _ANSI_ARGS_((Display* d, KeySym k));
-/* 36 */
-EXTERN void XMapWindow _ANSI_ARGS_((Display* d, Window w));
-/* 37 */
-EXTERN void XMoveResizeWindow _ANSI_ARGS_((Display* d, Window w,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2));
-/* 38 */
-EXTERN void XMoveWindow _ANSI_ARGS_((Display* d, Window w,
- int i1, int i2));
-/* 39 */
-EXTERN Bool XQueryPointer _ANSI_ARGS_((Display* d, Window w1,
- Window* w2, Window* w3, int* i1, int* i2,
- int* i3, int* i4, unsigned int* ui));
-/* 40 */
-EXTERN void XRaiseWindow _ANSI_ARGS_((Display* d, Window w));
-/* 41 */
-EXTERN void XRefreshKeyboardMapping _ANSI_ARGS_((
- XMappingEvent* x));
-/* 42 */
-EXTERN void XResizeWindow _ANSI_ARGS_((Display* d, Window w,
- unsigned int ui1, unsigned int ui2));
-/* 43 */
-EXTERN void XSelectInput _ANSI_ARGS_((Display* d, Window w,
- long l));
-/* 44 */
-EXTERN Status XSendEvent _ANSI_ARGS_((Display* d, Window w, Bool b,
- long l, XEvent* x));
-/* 45 */
-EXTERN void XSetIconName _ANSI_ARGS_((Display* d, Window w,
- _Xconst char* c));
-/* 46 */
-EXTERN void XSetInputFocus _ANSI_ARGS_((Display* d, Window w,
- int i, Time t));
-/* 47 */
-EXTERN void XSetSelectionOwner _ANSI_ARGS_((Display* d, Atom a,
- Window w, Time t));
-/* 48 */
-EXTERN void XSetWindowBackground _ANSI_ARGS_((Display* d,
- Window w, unsigned long ul));
-/* 49 */
-EXTERN void XSetWindowBackgroundPixmap _ANSI_ARGS_((Display* d,
- Window w, Pixmap p));
-/* 50 */
-EXTERN void XSetWindowBorder _ANSI_ARGS_((Display* d, Window w,
- unsigned long ul));
-/* 51 */
-EXTERN void XSetWindowBorderPixmap _ANSI_ARGS_((Display* d,
- Window w, Pixmap p));
-/* 52 */
-EXTERN void XSetWindowBorderWidth _ANSI_ARGS_((Display* d,
- Window w, unsigned int ui));
-/* 53 */
-EXTERN void XSetWindowColormap _ANSI_ARGS_((Display* d, Window w,
- Colormap c));
-/* 54 */
-EXTERN void XUngrabKeyboard _ANSI_ARGS_((Display* d, Time t));
-/* 55 */
-EXTERN void XUngrabPointer _ANSI_ARGS_((Display* d, Time t));
-/* 56 */
-EXTERN void XUnmapWindow _ANSI_ARGS_((Display* d, Window w));
-/* 57 */
-EXTERN void TkPutImage _ANSI_ARGS_((unsigned long * colors,
- int ncolors, Display* display, Drawable d,
- GC gc, XImage* image, int src_x, int src_y,
- int dest_x, int dest_y, unsigned int width,
- unsigned int height));
-/* 58 */
-EXTERN Status XParseColor _ANSI_ARGS_((Display * display,
- Colormap map, _Xconst char* spec,
- XColor * colorPtr));
-/* 59 */
-EXTERN GC XCreateGC _ANSI_ARGS_((Display* display, Drawable d,
- unsigned long valuemask, XGCValues* values));
-/* 60 */
-EXTERN void XFreeGC _ANSI_ARGS_((Display* display, GC gc));
-/* 61 */
-EXTERN Atom XInternAtom _ANSI_ARGS_((Display* display,
- _Xconst char* atom_name, Bool only_if_exists));
-/* 62 */
-EXTERN void XSetBackground _ANSI_ARGS_((Display* display, GC gc,
- unsigned long foreground));
-/* 63 */
-EXTERN void XSetForeground _ANSI_ARGS_((Display* display, GC gc,
- unsigned long foreground));
-/* 64 */
-EXTERN void XSetClipMask _ANSI_ARGS_((Display* display, GC gc,
- Pixmap pixmap));
-/* 65 */
-EXTERN void XSetClipOrigin _ANSI_ARGS_((Display* display, GC gc,
- int clip_x_origin, int clip_y_origin));
-/* 66 */
-EXTERN void XSetTSOrigin _ANSI_ARGS_((Display* display, GC gc,
- int ts_x_origin, int ts_y_origin));
-/* 67 */
-EXTERN void XChangeGC _ANSI_ARGS_((Display * d, GC gc,
- unsigned long mask, XGCValues * values));
-/* 68 */
-EXTERN void XSetFont _ANSI_ARGS_((Display * display, GC gc,
- Font font));
-/* 69 */
-EXTERN void XSetArcMode _ANSI_ARGS_((Display * display, GC gc,
- int arc_mode));
-/* 70 */
-EXTERN void XSetStipple _ANSI_ARGS_((Display * display, GC gc,
- Pixmap stipple));
-/* 71 */
-EXTERN void XSetFillRule _ANSI_ARGS_((Display * display, GC gc,
- int fill_rule));
-/* 72 */
-EXTERN void XSetFillStyle _ANSI_ARGS_((Display * display, GC gc,
- int fill_style));
-/* 73 */
-EXTERN void XSetFunction _ANSI_ARGS_((Display * display, GC gc,
- int function));
-/* 74 */
-EXTERN void XSetLineAttributes _ANSI_ARGS_((Display * display,
- GC gc, unsigned int line_width,
- int line_style, int cap_style,
- int join_style));
-/* 75 */
-EXTERN int _XInitImageFuncPtrs _ANSI_ARGS_((XImage * image));
-/* 76 */
-EXTERN XIC XCreateIC _ANSI_ARGS_((void));
-/* 77 */
-EXTERN XVisualInfo * XGetVisualInfo _ANSI_ARGS_((Display* display,
- long vinfo_mask, XVisualInfo* vinfo_template,
- int* nitems_return));
-/* 78 */
-EXTERN void XSetWMClientMachine _ANSI_ARGS_((Display* display,
- Window w, XTextProperty* text_prop));
-/* 79 */
-EXTERN Status XStringListToTextProperty _ANSI_ARGS_((char** list,
- int count, XTextProperty* text_prop_return));
-/* 80 */
-EXTERN void XDrawSegments _ANSI_ARGS_((Display * display,
- Drawable d, GC gc, XSegment * segments,
- int nsegments));
-/* 81 */
-EXTERN void XForceScreenSaver _ANSI_ARGS_((Display* display,
- int mode));
-/* 82 */
-EXTERN void XDrawLine _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int x1, int y1, int x2, int y2));
-/* 83 */
-EXTERN void XFillRectangle _ANSI_ARGS_((Display* display,
- Drawable d, GC gc, int x, int y,
- unsigned int width, unsigned int height));
-/* 84 */
-EXTERN void XClearWindow _ANSI_ARGS_((Display* d, Window w));
-/* 85 */
-EXTERN void XDrawPoint _ANSI_ARGS_((Display* display, Drawable d,
- GC gc, int x, int y));
-/* 86 */
-EXTERN void XDrawPoints _ANSI_ARGS_((Display* display,
- Drawable d, GC gc, XPoint * points,
- int npoints, int mode));
-/* 87 */
-EXTERN void XWarpPointer _ANSI_ARGS_((Display* display,
- Window src_w, Window dest_w, int src_x,
- int src_y, unsigned int src_width,
- unsigned int src_height, int dest_x,
- int dest_y));
-/* 88 */
-EXTERN void XQueryColor _ANSI_ARGS_((Display * display,
- Colormap colormap, XColor * def_in_out));
-/* 89 */
-EXTERN void XQueryColors _ANSI_ARGS_((Display * display,
- Colormap colormap, XColor * defs_in_out,
- int ncolors));
-/* 90 */
-EXTERN Status XQueryTree _ANSI_ARGS_((Display* d, Window w1,
- Window* w2, Window* w3, Window** w4,
- unsigned int* ui));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN void XFillRectangle(Display *display, Drawable d, GC gc,
+ int x, int y, unsigned int width,
+ unsigned int height);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef XSetDashes_TCL_DECLARED
+#define XSetDashes_TCL_DECLARED
/* 0 */
-EXTERN void XSetDashes _ANSI_ARGS_((Display* display, GC gc,
- int dash_offset, _Xconst char* dash_list,
- int n));
+EXTERN void XSetDashes(Display *display, GC gc, int dash_offset,
+ _Xconst char *dash_list, int n);
+#endif
+#ifndef XGetModifierMapping_TCL_DECLARED
+#define XGetModifierMapping_TCL_DECLARED
/* 1 */
-EXTERN XModifierKeymap* XGetModifierMapping _ANSI_ARGS_((Display* d));
+EXTERN XModifierKeymap * XGetModifierMapping(Display *d);
+#endif
+#ifndef XCreateImage_TCL_DECLARED
+#define XCreateImage_TCL_DECLARED
/* 2 */
-EXTERN XImage * XCreateImage _ANSI_ARGS_((Display* d, Visual* v,
- unsigned int ui1, int i1, int i2, char* cp,
- unsigned int ui2, unsigned int ui3, int i3,
- int i4));
+EXTERN XImage * XCreateImage(Display *d, Visual *v, unsigned int ui1,
+ int i1, int i2, char *cp, unsigned int ui2,
+ unsigned int ui3, int i3, int i4);
+#endif
+#ifndef XGetImage_TCL_DECLARED
+#define XGetImage_TCL_DECLARED
/* 3 */
-EXTERN XImage * XGetImage _ANSI_ARGS_((Display* d, Drawable dr,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, unsigned long ul, int i3));
+EXTERN XImage * XGetImage(Display *d, Drawable dr, int i1, int i2,
+ unsigned int ui1, unsigned int ui2,
+ unsigned long ul, int i3);
+#endif
+#ifndef XGetAtomName_TCL_DECLARED
+#define XGetAtomName_TCL_DECLARED
/* 4 */
-EXTERN char * XGetAtomName _ANSI_ARGS_((Display* d, Atom a));
+EXTERN char * XGetAtomName(Display *d, Atom a);
+#endif
+#ifndef XKeysymToString_TCL_DECLARED
+#define XKeysymToString_TCL_DECLARED
/* 5 */
-EXTERN char * XKeysymToString _ANSI_ARGS_((KeySym k));
+EXTERN char * XKeysymToString(KeySym k);
+#endif
+#ifndef XCreateColormap_TCL_DECLARED
+#define XCreateColormap_TCL_DECLARED
/* 6 */
-EXTERN Colormap XCreateColormap _ANSI_ARGS_((Display* d, Window w,
- Visual* v, int i));
+EXTERN Colormap XCreateColormap(Display *d, Window w, Visual *v,
+ int i);
+#endif
+#ifndef XGContextFromGC_TCL_DECLARED
+#define XGContextFromGC_TCL_DECLARED
/* 7 */
-EXTERN GContext XGContextFromGC _ANSI_ARGS_((GC g));
+EXTERN GContext XGContextFromGC(GC g);
+#endif
+#ifndef XKeycodeToKeysym_TCL_DECLARED
+#define XKeycodeToKeysym_TCL_DECLARED
/* 8 */
-EXTERN KeySym XKeycodeToKeysym _ANSI_ARGS_((Display* d, KeyCode k,
- int i));
+EXTERN KeySym XKeycodeToKeysym(Display *d, KeyCode k, int i);
+#endif
+#ifndef XStringToKeysym_TCL_DECLARED
+#define XStringToKeysym_TCL_DECLARED
/* 9 */
-EXTERN KeySym XStringToKeysym _ANSI_ARGS_((_Xconst char* c));
+EXTERN KeySym XStringToKeysym(_Xconst char *c);
+#endif
+#ifndef XRootWindow_TCL_DECLARED
+#define XRootWindow_TCL_DECLARED
/* 10 */
-EXTERN Window XRootWindow _ANSI_ARGS_((Display* d, int i));
+EXTERN Window XRootWindow(Display *d, int i);
+#endif
+#ifndef XSetErrorHandler_TCL_DECLARED
+#define XSetErrorHandler_TCL_DECLARED
/* 11 */
-EXTERN XErrorHandler XSetErrorHandler _ANSI_ARGS_((XErrorHandler x));
+EXTERN XErrorHandler XSetErrorHandler(XErrorHandler x);
+#endif
+#ifndef XAllocColor_TCL_DECLARED
+#define XAllocColor_TCL_DECLARED
/* 12 */
-EXTERN Status XAllocColor _ANSI_ARGS_((Display* d, Colormap c,
- XColor* xp));
+EXTERN Status XAllocColor(Display *d, Colormap c, XColor *xp);
+#endif
+#ifndef XBell_TCL_DECLARED
+#define XBell_TCL_DECLARED
/* 13 */
-EXTERN void XBell _ANSI_ARGS_((Display* d, int i));
+EXTERN void XBell(Display *d, int i);
+#endif
+#ifndef XChangeProperty_TCL_DECLARED
+#define XChangeProperty_TCL_DECLARED
/* 14 */
-EXTERN void XChangeProperty _ANSI_ARGS_((Display* d, Window w,
- Atom a1, Atom a2, int i1, int i2,
- _Xconst unsigned char* c, int i3));
+EXTERN void XChangeProperty(Display *d, Window w, Atom a1,
+ Atom a2, int i1, int i2,
+ _Xconst unsigned char *c, int i3);
+#endif
+#ifndef XChangeWindowAttributes_TCL_DECLARED
+#define XChangeWindowAttributes_TCL_DECLARED
/* 15 */
-EXTERN void XChangeWindowAttributes _ANSI_ARGS_((Display* d,
- Window w, unsigned long ul,
- XSetWindowAttributes* x));
+EXTERN void XChangeWindowAttributes(Display *d, Window w,
+ unsigned long ul, XSetWindowAttributes *x);
+#endif
+#ifndef XConfigureWindow_TCL_DECLARED
+#define XConfigureWindow_TCL_DECLARED
/* 16 */
-EXTERN void XConfigureWindow _ANSI_ARGS_((Display* d, Window w,
- unsigned int i, XWindowChanges* x));
+EXTERN void XConfigureWindow(Display *d, Window w,
+ unsigned int i, XWindowChanges *x);
+#endif
+#ifndef XCopyArea_TCL_DECLARED
+#define XCopyArea_TCL_DECLARED
/* 17 */
-EXTERN void XCopyArea _ANSI_ARGS_((Display* d, Drawable dr1,
- Drawable dr2, GC g, int i1, int i2,
- unsigned int ui1, unsigned int ui2, int i3,
- int i4));
+EXTERN void XCopyArea(Display *d, Drawable dr1, Drawable dr2,
+ GC g, int i1, int i2, unsigned int ui1,
+ unsigned int ui2, int i3, int i4);
+#endif
+#ifndef XCopyPlane_TCL_DECLARED
+#define XCopyPlane_TCL_DECLARED
/* 18 */
-EXTERN void XCopyPlane _ANSI_ARGS_((Display* d, Drawable dr1,
- Drawable dr2, GC g, int i1, int i2,
- unsigned int ui1, unsigned int ui2, int i3,
- int i4, unsigned long ul));
+EXTERN void XCopyPlane(Display *d, Drawable dr1, Drawable dr2,
+ GC g, int i1, int i2, unsigned int ui1,
+ unsigned int ui2, int i3, int i4,
+ unsigned long ul);
+#endif
+#ifndef XCreateBitmapFromData_TCL_DECLARED
+#define XCreateBitmapFromData_TCL_DECLARED
/* 19 */
-EXTERN Pixmap XCreateBitmapFromData _ANSI_ARGS_((Display* display,
- Drawable d, _Xconst char* data,
- unsigned int width, unsigned int height));
+EXTERN Pixmap XCreateBitmapFromData(Display *display, Drawable d,
+ _Xconst char *data, unsigned int width,
+ unsigned int height);
+#endif
+#ifndef XDefineCursor_TCL_DECLARED
+#define XDefineCursor_TCL_DECLARED
/* 20 */
-EXTERN void XDefineCursor _ANSI_ARGS_((Display* d, Window w,
- Cursor c));
+EXTERN void XDefineCursor(Display *d, Window w, Cursor c);
+#endif
+#ifndef XDestroyWindow_TCL_DECLARED
+#define XDestroyWindow_TCL_DECLARED
/* 21 */
-EXTERN void XDestroyWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XDestroyWindow(Display *d, Window w);
+#endif
+#ifndef XDrawArc_TCL_DECLARED
+#define XDrawArc_TCL_DECLARED
/* 22 */
-EXTERN void XDrawArc _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, int i3, int i4));
+EXTERN void XDrawArc(Display *d, Drawable dr, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2,
+ int i3, int i4);
+#endif
+#ifndef XDrawLines_TCL_DECLARED
+#define XDrawLines_TCL_DECLARED
/* 23 */
-EXTERN void XDrawLines _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XPoint* x, int i1, int i2));
+EXTERN void XDrawLines(Display *d, Drawable dr, GC g, XPoint *x,
+ int i1, int i2);
+#endif
+#ifndef XDrawRectangle_TCL_DECLARED
+#define XDrawRectangle_TCL_DECLARED
/* 24 */
-EXTERN void XDrawRectangle _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, int i1, int i2, unsigned int ui1,
- unsigned int ui2));
+EXTERN void XDrawRectangle(Display *d, Drawable dr, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2);
+#endif
+#ifndef XFillArc_TCL_DECLARED
+#define XFillArc_TCL_DECLARED
/* 25 */
-EXTERN void XFillArc _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2, int i3, int i4));
+EXTERN void XFillArc(Display *d, Drawable dr, GC g, int i1,
+ int i2, unsigned int ui1, unsigned int ui2,
+ int i3, int i4);
+#endif
+#ifndef XFillPolygon_TCL_DECLARED
+#define XFillPolygon_TCL_DECLARED
/* 26 */
-EXTERN void XFillPolygon _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XPoint* x, int i1, int i2, int i3));
+EXTERN void XFillPolygon(Display *d, Drawable dr, GC g,
+ XPoint *x, int i1, int i2, int i3);
+#endif
+#ifndef XFillRectangles_TCL_DECLARED
+#define XFillRectangles_TCL_DECLARED
/* 27 */
-EXTERN void XFillRectangles _ANSI_ARGS_((Display* d, Drawable dr,
- GC g, XRectangle* x, int i));
+EXTERN void XFillRectangles(Display *d, Drawable dr, GC g,
+ XRectangle *x, int i);
+#endif
+#ifndef XFreeColormap_TCL_DECLARED
+#define XFreeColormap_TCL_DECLARED
/* 28 */
-EXTERN void XFreeColormap _ANSI_ARGS_((Display* d, Colormap c));
+EXTERN void XFreeColormap(Display *d, Colormap c);
+#endif
+#ifndef XFreeColors_TCL_DECLARED
+#define XFreeColors_TCL_DECLARED
/* 29 */
-EXTERN void XFreeColors _ANSI_ARGS_((Display* d, Colormap c,
- unsigned long* ulp, int i, unsigned long ul));
+EXTERN void XFreeColors(Display *d, Colormap c,
+ unsigned long *ulp, int i, unsigned long ul);
+#endif
+#ifndef XFreeModifiermap_TCL_DECLARED
+#define XFreeModifiermap_TCL_DECLARED
/* 30 */
-EXTERN void XFreeModifiermap _ANSI_ARGS_((XModifierKeymap* x));
+EXTERN void XFreeModifiermap(XModifierKeymap *x);
+#endif
+#ifndef XGetGeometry_TCL_DECLARED
+#define XGetGeometry_TCL_DECLARED
/* 31 */
-EXTERN Status XGetGeometry _ANSI_ARGS_((Display* d, Drawable dr,
- Window* w, int* i1, int* i2,
- unsigned int* ui1, unsigned int* ui2,
- unsigned int* ui3, unsigned int* ui4));
+EXTERN Status XGetGeometry(Display *d, Drawable dr, Window *w,
+ int *i1, int *i2, unsigned int *ui1,
+ unsigned int *ui2, unsigned int *ui3,
+ unsigned int *ui4);
+#endif
+#ifndef XGetWindowProperty_TCL_DECLARED
+#define XGetWindowProperty_TCL_DECLARED
/* 32 */
-EXTERN int XGetWindowProperty _ANSI_ARGS_((Display* d, Window w,
- Atom a1, long l1, long l2, Bool b, Atom a2,
- Atom* ap, int* ip, unsigned long* ulp1,
- unsigned long* ulp2, unsigned char** cpp));
+EXTERN int XGetWindowProperty(Display *d, Window w, Atom a1,
+ long l1, long l2, Bool b, Atom a2, Atom *ap,
+ int *ip, unsigned long *ulp1,
+ unsigned long *ulp2, unsigned char **cpp);
+#endif
+#ifndef XGrabKeyboard_TCL_DECLARED
+#define XGrabKeyboard_TCL_DECLARED
/* 33 */
-EXTERN int XGrabKeyboard _ANSI_ARGS_((Display* d, Window w,
- Bool b, int i1, int i2, Time t));
+EXTERN int XGrabKeyboard(Display *d, Window w, Bool b, int i1,
+ int i2, Time t);
+#endif
+#ifndef XGrabPointer_TCL_DECLARED
+#define XGrabPointer_TCL_DECLARED
/* 34 */
-EXTERN int XGrabPointer _ANSI_ARGS_((Display* d, Window w1,
- Bool b, unsigned int ui, int i1, int i2,
- Window w2, Cursor c, Time t));
+EXTERN int XGrabPointer(Display *d, Window w1, Bool b,
+ unsigned int ui, int i1, int i2, Window w2,
+ Cursor c, Time t);
+#endif
+#ifndef XKeysymToKeycode_TCL_DECLARED
+#define XKeysymToKeycode_TCL_DECLARED
/* 35 */
-EXTERN KeyCode XKeysymToKeycode _ANSI_ARGS_((Display* d, KeySym k));
+EXTERN KeyCode XKeysymToKeycode(Display *d, KeySym k);
+#endif
+#ifndef XMapWindow_TCL_DECLARED
+#define XMapWindow_TCL_DECLARED
/* 36 */
-EXTERN void XMapWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XMapWindow(Display *d, Window w);
+#endif
+#ifndef XMoveResizeWindow_TCL_DECLARED
+#define XMoveResizeWindow_TCL_DECLARED
/* 37 */
-EXTERN void XMoveResizeWindow _ANSI_ARGS_((Display* d, Window w,
- int i1, int i2, unsigned int ui1,
- unsigned int ui2));
+EXTERN void XMoveResizeWindow(Display *d, Window w, int i1,
+ int i2, unsigned int ui1, unsigned int ui2);
+#endif
+#ifndef XMoveWindow_TCL_DECLARED
+#define XMoveWindow_TCL_DECLARED
/* 38 */
-EXTERN void XMoveWindow _ANSI_ARGS_((Display* d, Window w,
- int i1, int i2));
+EXTERN void XMoveWindow(Display *d, Window w, int i1, int i2);
+#endif
+#ifndef XQueryPointer_TCL_DECLARED
+#define XQueryPointer_TCL_DECLARED
/* 39 */
-EXTERN Bool XQueryPointer _ANSI_ARGS_((Display* d, Window w1,
- Window* w2, Window* w3, int* i1, int* i2,
- int* i3, int* i4, unsigned int* ui));
+EXTERN Bool XQueryPointer(Display *d, Window w1, Window *w2,
+ Window *w3, int *i1, int *i2, int *i3,
+ int *i4, unsigned int *ui);
+#endif
+#ifndef XRaiseWindow_TCL_DECLARED
+#define XRaiseWindow_TCL_DECLARED
/* 40 */
-EXTERN void XRaiseWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XRaiseWindow(Display *d, Window w);
+#endif
+#ifndef XRefreshKeyboardMapping_TCL_DECLARED
+#define XRefreshKeyboardMapping_TCL_DECLARED
/* 41 */
-EXTERN void XRefreshKeyboardMapping _ANSI_ARGS_((
- XMappingEvent* x));
+EXTERN void XRefreshKeyboardMapping(XMappingEvent *x);
+#endif
+#ifndef XResizeWindow_TCL_DECLARED
+#define XResizeWindow_TCL_DECLARED
/* 42 */
-EXTERN void XResizeWindow _ANSI_ARGS_((Display* d, Window w,
- unsigned int ui1, unsigned int ui2));
+EXTERN void XResizeWindow(Display *d, Window w, unsigned int ui1,
+ unsigned int ui2);
+#endif
+#ifndef XSelectInput_TCL_DECLARED
+#define XSelectInput_TCL_DECLARED
/* 43 */
-EXTERN void XSelectInput _ANSI_ARGS_((Display* d, Window w,
- long l));
+EXTERN void XSelectInput(Display *d, Window w, long l);
+#endif
+#ifndef XSendEvent_TCL_DECLARED
+#define XSendEvent_TCL_DECLARED
/* 44 */
-EXTERN Status XSendEvent _ANSI_ARGS_((Display* d, Window w, Bool b,
- long l, XEvent* x));
+EXTERN Status XSendEvent(Display *d, Window w, Bool b, long l,
+ XEvent *x);
+#endif
+#ifndef XSetIconName_TCL_DECLARED
+#define XSetIconName_TCL_DECLARED
/* 45 */
-EXTERN void XSetIconName _ANSI_ARGS_((Display* d, Window w,
- _Xconst char* c));
+EXTERN void XSetIconName(Display *d, Window w, _Xconst char *c);
+#endif
+#ifndef XSetInputFocus_TCL_DECLARED
+#define XSetInputFocus_TCL_DECLARED
/* 46 */
-EXTERN void XSetInputFocus _ANSI_ARGS_((Display* d, Window w,
- int i, Time t));
+EXTERN void XSetInputFocus(Display *d, Window w, int i, Time t);
+#endif
+#ifndef XSetSelectionOwner_TCL_DECLARED
+#define XSetSelectionOwner_TCL_DECLARED
/* 47 */
-EXTERN void XSetSelectionOwner _ANSI_ARGS_((Display* d, Atom a,
- Window w, Time t));
+EXTERN void XSetSelectionOwner(Display *d, Atom a, Window w,
+ Time t);
+#endif
+#ifndef XSetWindowBackground_TCL_DECLARED
+#define XSetWindowBackground_TCL_DECLARED
/* 48 */
-EXTERN void XSetWindowBackground _ANSI_ARGS_((Display* d,
- Window w, unsigned long ul));
+EXTERN void XSetWindowBackground(Display *d, Window w,
+ unsigned long ul);
+#endif
+#ifndef XSetWindowBackgroundPixmap_TCL_DECLARED
+#define XSetWindowBackgroundPixmap_TCL_DECLARED
/* 49 */
-EXTERN void XSetWindowBackgroundPixmap _ANSI_ARGS_((Display* d,
- Window w, Pixmap p));
+EXTERN void XSetWindowBackgroundPixmap(Display *d, Window w,
+ Pixmap p);
+#endif
+#ifndef XSetWindowBorder_TCL_DECLARED
+#define XSetWindowBorder_TCL_DECLARED
/* 50 */
-EXTERN void XSetWindowBorder _ANSI_ARGS_((Display* d, Window w,
- unsigned long ul));
+EXTERN void XSetWindowBorder(Display *d, Window w,
+ unsigned long ul);
+#endif
+#ifndef XSetWindowBorderPixmap_TCL_DECLARED
+#define XSetWindowBorderPixmap_TCL_DECLARED
/* 51 */
-EXTERN void XSetWindowBorderPixmap _ANSI_ARGS_((Display* d,
- Window w, Pixmap p));
+EXTERN void XSetWindowBorderPixmap(Display *d, Window w,
+ Pixmap p);
+#endif
+#ifndef XSetWindowBorderWidth_TCL_DECLARED
+#define XSetWindowBorderWidth_TCL_DECLARED
/* 52 */
-EXTERN void XSetWindowBorderWidth _ANSI_ARGS_((Display* d,
- Window w, unsigned int ui));
+EXTERN void XSetWindowBorderWidth(Display *d, Window w,
+ unsigned int ui);
+#endif
+#ifndef XSetWindowColormap_TCL_DECLARED
+#define XSetWindowColormap_TCL_DECLARED
/* 53 */
-EXTERN void XSetWindowColormap _ANSI_ARGS_((Display* d, Window w,
- Colormap c));
+EXTERN void XSetWindowColormap(Display *d, Window w, Colormap c);
+#endif
+#ifndef XUngrabKeyboard_TCL_DECLARED
+#define XUngrabKeyboard_TCL_DECLARED
/* 54 */
-EXTERN void XUngrabKeyboard _ANSI_ARGS_((Display* d, Time t));
+EXTERN void XUngrabKeyboard(Display *d, Time t);
+#endif
+#ifndef XUngrabPointer_TCL_DECLARED
+#define XUngrabPointer_TCL_DECLARED
/* 55 */
-EXTERN void XUngrabPointer _ANSI_ARGS_((Display* d, Time t));
+EXTERN void XUngrabPointer(Display *d, Time t);
+#endif
+#ifndef XUnmapWindow_TCL_DECLARED
+#define XUnmapWindow_TCL_DECLARED
/* 56 */
-EXTERN void XUnmapWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XUnmapWindow(Display *d, Window w);
+#endif
+#ifndef TkPutImage_TCL_DECLARED
+#define TkPutImage_TCL_DECLARED
/* 57 */
-EXTERN void TkPutImage _ANSI_ARGS_((unsigned long * colors,
- int ncolors, Display* display, Drawable d,
- GC gc, XImage* image, int src_x, int src_y,
- int dest_x, int dest_y, unsigned int width,
- unsigned int height));
+EXTERN void TkPutImage(unsigned long *colors, int ncolors,
+ Display *display, Drawable d, GC gc,
+ XImage *image, int src_x, int src_y,
+ int dest_x, int dest_y, unsigned int width,
+ unsigned int height);
+#endif
+#ifndef XParseColor_TCL_DECLARED
+#define XParseColor_TCL_DECLARED
/* 58 */
-EXTERN Status XParseColor _ANSI_ARGS_((Display * display,
- Colormap map, _Xconst char* spec,
- XColor * colorPtr));
+EXTERN Status XParseColor(Display *display, Colormap map,
+ _Xconst char *spec, XColor *colorPtr);
+#endif
+#ifndef XCreateGC_TCL_DECLARED
+#define XCreateGC_TCL_DECLARED
/* 59 */
-EXTERN GC XCreateGC _ANSI_ARGS_((Display* display, Drawable d,
- unsigned long valuemask, XGCValues* values));
+EXTERN GC XCreateGC(Display *display, Drawable d,
+ unsigned long valuemask, XGCValues *values);
+#endif
+#ifndef XFreeGC_TCL_DECLARED
+#define XFreeGC_TCL_DECLARED
/* 60 */
-EXTERN void XFreeGC _ANSI_ARGS_((Display* display, GC gc));
+EXTERN void XFreeGC(Display *display, GC gc);
+#endif
+#ifndef XInternAtom_TCL_DECLARED
+#define XInternAtom_TCL_DECLARED
/* 61 */
-EXTERN Atom XInternAtom _ANSI_ARGS_((Display* display,
- _Xconst char* atom_name, Bool only_if_exists));
+EXTERN Atom XInternAtom(Display *display,
+ _Xconst char *atom_name, Bool only_if_exists);
+#endif
+#ifndef XSetBackground_TCL_DECLARED
+#define XSetBackground_TCL_DECLARED
/* 62 */
-EXTERN void XSetBackground _ANSI_ARGS_((Display* display, GC gc,
- unsigned long foreground));
+EXTERN void XSetBackground(Display *display, GC gc,
+ unsigned long foreground);
+#endif
+#ifndef XSetForeground_TCL_DECLARED
+#define XSetForeground_TCL_DECLARED
/* 63 */
-EXTERN void XSetForeground _ANSI_ARGS_((Display* display, GC gc,
- unsigned long foreground));
+EXTERN void XSetForeground(Display *display, GC gc,
+ unsigned long foreground);
+#endif
+#ifndef XSetClipMask_TCL_DECLARED
+#define XSetClipMask_TCL_DECLARED
/* 64 */
-EXTERN void XSetClipMask _ANSI_ARGS_((Display* display, GC gc,
- Pixmap pixmap));
+EXTERN void XSetClipMask(Display *display, GC gc, Pixmap pixmap);
+#endif
+#ifndef XSetClipOrigin_TCL_DECLARED
+#define XSetClipOrigin_TCL_DECLARED
/* 65 */
-EXTERN void XSetClipOrigin _ANSI_ARGS_((Display* display, GC gc,
- int clip_x_origin, int clip_y_origin));
+EXTERN void XSetClipOrigin(Display *display, GC gc,
+ int clip_x_origin, int clip_y_origin);
+#endif
+#ifndef XSetTSOrigin_TCL_DECLARED
+#define XSetTSOrigin_TCL_DECLARED
/* 66 */
-EXTERN void XSetTSOrigin _ANSI_ARGS_((Display* display, GC gc,
- int ts_x_origin, int ts_y_origin));
+EXTERN void XSetTSOrigin(Display *display, GC gc,
+ int ts_x_origin, int ts_y_origin);
+#endif
+#ifndef XChangeGC_TCL_DECLARED
+#define XChangeGC_TCL_DECLARED
/* 67 */
-EXTERN void XChangeGC _ANSI_ARGS_((Display * d, GC gc,
- unsigned long mask, XGCValues * values));
+EXTERN void XChangeGC(Display *d, GC gc, unsigned long mask,
+ XGCValues *values);
+#endif
+#ifndef XSetFont_TCL_DECLARED
+#define XSetFont_TCL_DECLARED
/* 68 */
-EXTERN void XSetFont _ANSI_ARGS_((Display * display, GC gc,
- Font font));
+EXTERN void XSetFont(Display *display, GC gc, Font font);
+#endif
+#ifndef XSetArcMode_TCL_DECLARED
+#define XSetArcMode_TCL_DECLARED
/* 69 */
-EXTERN void XSetArcMode _ANSI_ARGS_((Display * display, GC gc,
- int arc_mode));
+EXTERN void XSetArcMode(Display *display, GC gc, int arc_mode);
+#endif
+#ifndef XSetStipple_TCL_DECLARED
+#define XSetStipple_TCL_DECLARED
/* 70 */
-EXTERN void XSetStipple _ANSI_ARGS_((Display * display, GC gc,
- Pixmap stipple));
+EXTERN void XSetStipple(Display *display, GC gc, Pixmap stipple);
+#endif
+#ifndef XSetFillRule_TCL_DECLARED
+#define XSetFillRule_TCL_DECLARED
/* 71 */
-EXTERN void XSetFillRule _ANSI_ARGS_((Display * display, GC gc,
- int fill_rule));
+EXTERN void XSetFillRule(Display *display, GC gc, int fill_rule);
+#endif
+#ifndef XSetFillStyle_TCL_DECLARED
+#define XSetFillStyle_TCL_DECLARED
/* 72 */
-EXTERN void XSetFillStyle _ANSI_ARGS_((Display * display, GC gc,
- int fill_style));
+EXTERN void XSetFillStyle(Display *display, GC gc,
+ int fill_style);
+#endif
+#ifndef XSetFunction_TCL_DECLARED
+#define XSetFunction_TCL_DECLARED
/* 73 */
-EXTERN void XSetFunction _ANSI_ARGS_((Display * display, GC gc,
- int function));
+EXTERN void XSetFunction(Display *display, GC gc, int function);
+#endif
+#ifndef XSetLineAttributes_TCL_DECLARED
+#define XSetLineAttributes_TCL_DECLARED
/* 74 */
-EXTERN void XSetLineAttributes _ANSI_ARGS_((Display * display,
- GC gc, unsigned int line_width,
- int line_style, int cap_style,
- int join_style));
+EXTERN void XSetLineAttributes(Display *display, GC gc,
+ unsigned int line_width, int line_style,
+ int cap_style, int join_style);
+#endif
+#ifndef _XInitImageFuncPtrs_TCL_DECLARED
+#define _XInitImageFuncPtrs_TCL_DECLARED
/* 75 */
-EXTERN int _XInitImageFuncPtrs _ANSI_ARGS_((XImage * image));
+EXTERN int _XInitImageFuncPtrs(XImage *image);
+#endif
+#ifndef XCreateIC_TCL_DECLARED
+#define XCreateIC_TCL_DECLARED
/* 76 */
-EXTERN XIC XCreateIC _ANSI_ARGS_((void));
+EXTERN XIC XCreateIC(void);
+#endif
+#ifndef XGetVisualInfo_TCL_DECLARED
+#define XGetVisualInfo_TCL_DECLARED
/* 77 */
-EXTERN XVisualInfo * XGetVisualInfo _ANSI_ARGS_((Display* display,
- long vinfo_mask, XVisualInfo* vinfo_template,
- int* nitems_return));
+EXTERN XVisualInfo * XGetVisualInfo(Display *display, long vinfo_mask,
+ XVisualInfo *vinfo_template,
+ int *nitems_return);
+#endif
+#ifndef XSetWMClientMachine_TCL_DECLARED
+#define XSetWMClientMachine_TCL_DECLARED
/* 78 */
-EXTERN void XSetWMClientMachine _ANSI_ARGS_((Display* display,
- Window w, XTextProperty* text_prop));
+EXTERN void XSetWMClientMachine(Display *display, Window w,
+ XTextProperty *text_prop);
+#endif
+#ifndef XStringListToTextProperty_TCL_DECLARED
+#define XStringListToTextProperty_TCL_DECLARED
/* 79 */
-EXTERN Status XStringListToTextProperty _ANSI_ARGS_((char** list,
- int count, XTextProperty* text_prop_return));
+EXTERN Status XStringListToTextProperty(char **list, int count,
+ XTextProperty *text_prop_return);
+#endif
+#ifndef XDrawSegments_TCL_DECLARED
+#define XDrawSegments_TCL_DECLARED
/* 80 */
-EXTERN void XDrawSegments _ANSI_ARGS_((Display * display,
- Drawable d, GC gc, XSegment * segments,
- int nsegments));
+EXTERN void XDrawSegments(Display *display, Drawable d, GC gc,
+ XSegment *segments, int nsegments);
+#endif
+#ifndef XForceScreenSaver_TCL_DECLARED
+#define XForceScreenSaver_TCL_DECLARED
/* 81 */
-EXTERN void XForceScreenSaver _ANSI_ARGS_((Display* display,
- int mode));
+EXTERN void XForceScreenSaver(Display *display, int mode);
+#endif
+#ifndef XDrawLine_TCL_DECLARED
+#define XDrawLine_TCL_DECLARED
/* 82 */
-EXTERN void XDrawLine _ANSI_ARGS_((Display* d, Drawable dr, GC g,
- int x1, int y1, int x2, int y2));
+EXTERN void XDrawLine(Display *d, Drawable dr, GC g, int x1,
+ int y1, int x2, int y2);
+#endif
+#ifndef XFillRectangle_TCL_DECLARED
+#define XFillRectangle_TCL_DECLARED
/* 83 */
-EXTERN void XFillRectangle _ANSI_ARGS_((Display* display,
- Drawable d, GC gc, int x, int y,
- unsigned int width, unsigned int height));
+EXTERN void XFillRectangle(Display *display, Drawable d, GC gc,
+ int x, int y, unsigned int width,
+ unsigned int height);
+#endif
+#ifndef XClearWindow_TCL_DECLARED
+#define XClearWindow_TCL_DECLARED
/* 84 */
-EXTERN void XClearWindow _ANSI_ARGS_((Display* d, Window w));
+EXTERN void XClearWindow(Display *d, Window w);
+#endif
+#ifndef XDrawPoint_TCL_DECLARED
+#define XDrawPoint_TCL_DECLARED
/* 85 */
-EXTERN void XDrawPoint _ANSI_ARGS_((Display* display, Drawable d,
- GC gc, int x, int y));
+EXTERN void XDrawPoint(Display *display, Drawable d, GC gc,
+ int x, int y);
+#endif
+#ifndef XDrawPoints_TCL_DECLARED
+#define XDrawPoints_TCL_DECLARED
/* 86 */
-EXTERN void XDrawPoints _ANSI_ARGS_((Display* display,
- Drawable d, GC gc, XPoint * points,
- int npoints, int mode));
+EXTERN void XDrawPoints(Display *display, Drawable d, GC gc,
+ XPoint *points, int npoints, int mode);
+#endif
+#ifndef XWarpPointer_TCL_DECLARED
+#define XWarpPointer_TCL_DECLARED
/* 87 */
-EXTERN void XWarpPointer _ANSI_ARGS_((Display* display,
- Window src_w, Window dest_w, int src_x,
- int src_y, unsigned int src_width,
- unsigned int src_height, int dest_x,
- int dest_y));
+EXTERN void XWarpPointer(Display *display, Window src_w,
+ Window dest_w, int src_x, int src_y,
+ unsigned int src_width,
+ unsigned int src_height, int dest_x,
+ int dest_y);
+#endif
+#ifndef XQueryColor_TCL_DECLARED
+#define XQueryColor_TCL_DECLARED
/* 88 */
-EXTERN void XQueryColor _ANSI_ARGS_((Display * display,
- Colormap colormap, XColor * def_in_out));
+EXTERN void XQueryColor(Display *display, Colormap colormap,
+ XColor *def_in_out);
+#endif
+#ifndef XQueryColors_TCL_DECLARED
+#define XQueryColors_TCL_DECLARED
/* 89 */
-EXTERN void XQueryColors _ANSI_ARGS_((Display * display,
- Colormap colormap, XColor * defs_in_out,
- int ncolors));
+EXTERN void XQueryColors(Display *display, Colormap colormap,
+ XColor *defs_in_out, int ncolors);
+#endif
+#ifndef XQueryTree_TCL_DECLARED
+#define XQueryTree_TCL_DECLARED
/* 90 */
-EXTERN Status XQueryTree _ANSI_ARGS_((Display* d, Window w1,
- Window* w2, Window* w3, Window** w4,
- unsigned int* ui));
+EXTERN Status XQueryTree(Display *d, Window w1, Window *w2,
+ Window *w3, Window **w4, unsigned int *ui);
+#endif
+#ifndef XSync_TCL_DECLARED
+#define XSync_TCL_DECLARED
/* 91 */
-EXTERN int XSync _ANSI_ARGS_((Display * display, Bool flag));
-#endif /* MAC_OSX_TK */
+EXTERN int XSync(Display *display, Bool flag);
+#endif
+#endif /* AQUA */
typedef struct TkIntXlibStubs {
int magic;
struct TkIntXlibStubHooks *hooks;
-#ifdef __WIN32__
- void (*xSetDashes) _ANSI_ARGS_((Display* display, GC gc, int dash_offset, _Xconst char* dash_list, int n)); /* 0 */
- XModifierKeymap* (*xGetModifierMapping) _ANSI_ARGS_((Display* d)); /* 1 */
- XImage * (*xCreateImage) _ANSI_ARGS_((Display* d, Visual* v, unsigned int ui1, int i1, int i2, char* cp, unsigned int ui2, unsigned int ui3, int i3, int i4)); /* 2 */
- XImage * (*xGetImage) _ANSI_ARGS_((Display* d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3)); /* 3 */
- char * (*xGetAtomName) _ANSI_ARGS_((Display* d, Atom a)); /* 4 */
- char * (*xKeysymToString) _ANSI_ARGS_((KeySym k)); /* 5 */
- Colormap (*xCreateColormap) _ANSI_ARGS_((Display* d, Window w, Visual* v, int i)); /* 6 */
- Cursor (*xCreatePixmapCursor) _ANSI_ARGS_((Display* d, Pixmap p1, Pixmap p2, XColor* x1, XColor* x2, unsigned int ui1, unsigned int ui2)); /* 7 */
- Cursor (*xCreateGlyphCursor) _ANSI_ARGS_((Display* d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor* x1, XColor* x2)); /* 8 */
- GContext (*xGContextFromGC) _ANSI_ARGS_((GC g)); /* 9 */
- XHostAddress * (*xListHosts) _ANSI_ARGS_((Display* d, int* i, Bool* b)); /* 10 */
- KeySym (*xKeycodeToKeysym) _ANSI_ARGS_((Display* d, unsigned int k, int i)); /* 11 */
- KeySym (*xStringToKeysym) _ANSI_ARGS_((_Xconst char* c)); /* 12 */
- Window (*xRootWindow) _ANSI_ARGS_((Display* d, int i)); /* 13 */
- XErrorHandler (*xSetErrorHandler) _ANSI_ARGS_((XErrorHandler x)); /* 14 */
- Status (*xIconifyWindow) _ANSI_ARGS_((Display* d, Window w, int i)); /* 15 */
- Status (*xWithdrawWindow) _ANSI_ARGS_((Display* d, Window w, int i)); /* 16 */
- Status (*xGetWMColormapWindows) _ANSI_ARGS_((Display* d, Window w, Window** wpp, int* ip)); /* 17 */
- Status (*xAllocColor) _ANSI_ARGS_((Display* d, Colormap c, XColor* xp)); /* 18 */
- void (*xBell) _ANSI_ARGS_((Display* d, int i)); /* 19 */
- void (*xChangeProperty) _ANSI_ARGS_((Display* d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char* c, int i3)); /* 20 */
- void (*xChangeWindowAttributes) _ANSI_ARGS_((Display* d, Window w, unsigned long ul, XSetWindowAttributes* x)); /* 21 */
- void (*xClearWindow) _ANSI_ARGS_((Display* d, Window w)); /* 22 */
- void (*xConfigureWindow) _ANSI_ARGS_((Display* d, Window w, unsigned int i, XWindowChanges* x)); /* 23 */
- void (*xCopyArea) _ANSI_ARGS_((Display* d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 24 */
- void (*xCopyPlane) _ANSI_ARGS_((Display* d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul)); /* 25 */
- Pixmap (*xCreateBitmapFromData) _ANSI_ARGS_((Display* display, Drawable d, _Xconst char* data, unsigned int width, unsigned int height)); /* 26 */
- void (*xDefineCursor) _ANSI_ARGS_((Display* d, Window w, Cursor c)); /* 27 */
- void (*xDeleteProperty) _ANSI_ARGS_((Display* d, Window w, Atom a)); /* 28 */
- void (*xDestroyWindow) _ANSI_ARGS_((Display* d, Window w)); /* 29 */
- void (*xDrawArc) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 30 */
- void (*xDrawLines) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2)); /* 31 */
- void (*xDrawRectangle) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 32 */
- void (*xFillArc) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 33 */
- void (*xFillPolygon) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2, int i3)); /* 34 */
- void (*xFillRectangles) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XRectangle* x, int i)); /* 35 */
- void (*xForceScreenSaver) _ANSI_ARGS_((Display* d, int i)); /* 36 */
- void (*xFreeColormap) _ANSI_ARGS_((Display* d, Colormap c)); /* 37 */
- void (*xFreeColors) _ANSI_ARGS_((Display* d, Colormap c, unsigned long* ulp, int i, unsigned long ul)); /* 38 */
- void (*xFreeCursor) _ANSI_ARGS_((Display* d, Cursor c)); /* 39 */
- void (*xFreeModifiermap) _ANSI_ARGS_((XModifierKeymap* x)); /* 40 */
- Status (*xGetGeometry) _ANSI_ARGS_((Display* d, Drawable dr, Window* w, int* i1, int* i2, unsigned int* ui1, unsigned int* ui2, unsigned int* ui3, unsigned int* ui4)); /* 41 */
- void (*xGetInputFocus) _ANSI_ARGS_((Display* d, Window* w, int* i)); /* 42 */
- int (*xGetWindowProperty) _ANSI_ARGS_((Display* d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom* ap, int* ip, unsigned long* ulp1, unsigned long* ulp2, unsigned char** cpp)); /* 43 */
- Status (*xGetWindowAttributes) _ANSI_ARGS_((Display* d, Window w, XWindowAttributes* x)); /* 44 */
- int (*xGrabKeyboard) _ANSI_ARGS_((Display* d, Window w, Bool b, int i1, int i2, Time t)); /* 45 */
- int (*xGrabPointer) _ANSI_ARGS_((Display* d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t)); /* 46 */
- KeyCode (*xKeysymToKeycode) _ANSI_ARGS_((Display* d, KeySym k)); /* 47 */
- Status (*xLookupColor) _ANSI_ARGS_((Display* d, Colormap c1, _Xconst char* c2, XColor* x1, XColor* x2)); /* 48 */
- void (*xMapWindow) _ANSI_ARGS_((Display* d, Window w)); /* 49 */
- void (*xMoveResizeWindow) _ANSI_ARGS_((Display* d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 50 */
- void (*xMoveWindow) _ANSI_ARGS_((Display* d, Window w, int i1, int i2)); /* 51 */
- void (*xNextEvent) _ANSI_ARGS_((Display* d, XEvent* x)); /* 52 */
- void (*xPutBackEvent) _ANSI_ARGS_((Display* d, XEvent* x)); /* 53 */
- void (*xQueryColors) _ANSI_ARGS_((Display* d, Colormap c, XColor* x, int i)); /* 54 */
- Bool (*xQueryPointer) _ANSI_ARGS_((Display* d, Window w1, Window* w2, Window* w3, int* i1, int* i2, int* i3, int* i4, unsigned int* ui)); /* 55 */
- Status (*xQueryTree) _ANSI_ARGS_((Display* d, Window w1, Window* w2, Window* w3, Window** w4, unsigned int* ui)); /* 56 */
- void (*xRaiseWindow) _ANSI_ARGS_((Display* d, Window w)); /* 57 */
- void (*xRefreshKeyboardMapping) _ANSI_ARGS_((XMappingEvent* x)); /* 58 */
- void (*xResizeWindow) _ANSI_ARGS_((Display* d, Window w, unsigned int ui1, unsigned int ui2)); /* 59 */
- void (*xSelectInput) _ANSI_ARGS_((Display* d, Window w, long l)); /* 60 */
- Status (*xSendEvent) _ANSI_ARGS_((Display* d, Window w, Bool b, long l, XEvent* x)); /* 61 */
- void (*xSetCommand) _ANSI_ARGS_((Display* d, Window w, CONST char** c, int i)); /* 62 */
- void (*xSetIconName) _ANSI_ARGS_((Display* d, Window w, _Xconst char* c)); /* 63 */
- void (*xSetInputFocus) _ANSI_ARGS_((Display* d, Window w, int i, Time t)); /* 64 */
- void (*xSetSelectionOwner) _ANSI_ARGS_((Display* d, Atom a, Window w, Time t)); /* 65 */
- void (*xSetWindowBackground) _ANSI_ARGS_((Display* d, Window w, unsigned long ul)); /* 66 */
- void (*xSetWindowBackgroundPixmap) _ANSI_ARGS_((Display* d, Window w, Pixmap p)); /* 67 */
- void (*xSetWindowBorder) _ANSI_ARGS_((Display* d, Window w, unsigned long ul)); /* 68 */
- void (*xSetWindowBorderPixmap) _ANSI_ARGS_((Display* d, Window w, Pixmap p)); /* 69 */
- void (*xSetWindowBorderWidth) _ANSI_ARGS_((Display* d, Window w, unsigned int ui)); /* 70 */
- void (*xSetWindowColormap) _ANSI_ARGS_((Display* d, Window w, Colormap c)); /* 71 */
- Bool (*xTranslateCoordinates) _ANSI_ARGS_((Display* d, Window w1, Window w2, int i1, int i2, int* i3, int* i4, Window* w3)); /* 72 */
- void (*xUngrabKeyboard) _ANSI_ARGS_((Display* d, Time t)); /* 73 */
- void (*xUngrabPointer) _ANSI_ARGS_((Display* d, Time t)); /* 74 */
- void (*xUnmapWindow) _ANSI_ARGS_((Display* d, Window w)); /* 75 */
- void (*xWindowEvent) _ANSI_ARGS_((Display* d, Window w, long l, XEvent* x)); /* 76 */
- void (*xDestroyIC) _ANSI_ARGS_((XIC x)); /* 77 */
- Bool (*xFilterEvent) _ANSI_ARGS_((XEvent* x, Window w)); /* 78 */
- int (*xmbLookupString) _ANSI_ARGS_((XIC xi, XKeyPressedEvent* xk, char* c, int i, KeySym* k, Status* s)); /* 79 */
- void (*tkPutImage) _ANSI_ARGS_((unsigned long * colors, int ncolors, Display* display, Drawable d, GC gc, XImage* image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height)); /* 80 */
- void *reserved81;
- Status (*xParseColor) _ANSI_ARGS_((Display * display, Colormap map, _Xconst char* spec, XColor * colorPtr)); /* 82 */
- GC (*xCreateGC) _ANSI_ARGS_((Display* display, Drawable d, unsigned long valuemask, XGCValues* values)); /* 83 */
- void (*xFreeGC) _ANSI_ARGS_((Display* display, GC gc)); /* 84 */
- Atom (*xInternAtom) _ANSI_ARGS_((Display* display, _Xconst char* atom_name, Bool only_if_exists)); /* 85 */
- void (*xSetBackground) _ANSI_ARGS_((Display* display, GC gc, unsigned long foreground)); /* 86 */
- void (*xSetForeground) _ANSI_ARGS_((Display* display, GC gc, unsigned long foreground)); /* 87 */
- void (*xSetClipMask) _ANSI_ARGS_((Display* display, GC gc, Pixmap pixmap)); /* 88 */
- void (*xSetClipOrigin) _ANSI_ARGS_((Display* display, GC gc, int clip_x_origin, int clip_y_origin)); /* 89 */
- void (*xSetTSOrigin) _ANSI_ARGS_((Display* display, GC gc, int ts_x_origin, int ts_y_origin)); /* 90 */
- void (*xChangeGC) _ANSI_ARGS_((Display * d, GC gc, unsigned long mask, XGCValues * values)); /* 91 */
- void (*xSetFont) _ANSI_ARGS_((Display * display, GC gc, Font font)); /* 92 */
- void (*xSetArcMode) _ANSI_ARGS_((Display * display, GC gc, int arc_mode)); /* 93 */
- void (*xSetStipple) _ANSI_ARGS_((Display * display, GC gc, Pixmap stipple)); /* 94 */
- void (*xSetFillRule) _ANSI_ARGS_((Display * display, GC gc, int fill_rule)); /* 95 */
- void (*xSetFillStyle) _ANSI_ARGS_((Display * display, GC gc, int fill_style)); /* 96 */
- void (*xSetFunction) _ANSI_ARGS_((Display * display, GC gc, int function)); /* 97 */
- void (*xSetLineAttributes) _ANSI_ARGS_((Display * display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style)); /* 98 */
- int (*_XInitImageFuncPtrs) _ANSI_ARGS_((XImage * image)); /* 99 */
- XIC (*xCreateIC) _ANSI_ARGS_((void)); /* 100 */
- XVisualInfo * (*xGetVisualInfo) _ANSI_ARGS_((Display* display, long vinfo_mask, XVisualInfo* vinfo_template, int* nitems_return)); /* 101 */
- void (*xSetWMClientMachine) _ANSI_ARGS_((Display* display, Window w, XTextProperty* text_prop)); /* 102 */
- Status (*xStringListToTextProperty) _ANSI_ARGS_((char** list, int count, XTextProperty* text_prop_return)); /* 103 */
- void (*xDrawLine) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 104 */
- void (*xWarpPointer) _ANSI_ARGS_((Display* d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy)); /* 105 */
- void (*xFillRectangle) _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 106 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*xSetDashes) _ANSI_ARGS_((Display* display, GC gc, int dash_offset, _Xconst char* dash_list, int n)); /* 0 */
- XModifierKeymap* (*xGetModifierMapping) _ANSI_ARGS_((Display* d)); /* 1 */
- XImage * (*xCreateImage) _ANSI_ARGS_((Display* d, Visual* v, unsigned int ui1, int i1, int i2, char* cp, unsigned int ui2, unsigned int ui3, int i3, int i4)); /* 2 */
- XImage * (*xGetImage) _ANSI_ARGS_((Display* d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3)); /* 3 */
- char * (*xGetAtomName) _ANSI_ARGS_((Display* d, Atom a)); /* 4 */
- char * (*xKeysymToString) _ANSI_ARGS_((KeySym k)); /* 5 */
- Colormap (*xCreateColormap) _ANSI_ARGS_((Display* d, Window w, Visual* v, int i)); /* 6 */
- GContext (*xGContextFromGC) _ANSI_ARGS_((GC g)); /* 7 */
- KeySym (*xKeycodeToKeysym) _ANSI_ARGS_((Display* d, KeyCode k, int i)); /* 8 */
- KeySym (*xStringToKeysym) _ANSI_ARGS_((_Xconst char* c)); /* 9 */
- Window (*xRootWindow) _ANSI_ARGS_((Display* d, int i)); /* 10 */
- XErrorHandler (*xSetErrorHandler) _ANSI_ARGS_((XErrorHandler x)); /* 11 */
- Status (*xAllocColor) _ANSI_ARGS_((Display* d, Colormap c, XColor* xp)); /* 12 */
- void (*xBell) _ANSI_ARGS_((Display* d, int i)); /* 13 */
- void (*xChangeProperty) _ANSI_ARGS_((Display* d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char* c, int i3)); /* 14 */
- void (*xChangeWindowAttributes) _ANSI_ARGS_((Display* d, Window w, unsigned long ul, XSetWindowAttributes* x)); /* 15 */
- void (*xConfigureWindow) _ANSI_ARGS_((Display* d, Window w, unsigned int i, XWindowChanges* x)); /* 16 */
- void (*xCopyArea) _ANSI_ARGS_((Display* d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 17 */
- void (*xCopyPlane) _ANSI_ARGS_((Display* d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul)); /* 18 */
- Pixmap (*xCreateBitmapFromData) _ANSI_ARGS_((Display* display, Drawable d, _Xconst char* data, unsigned int width, unsigned int height)); /* 19 */
- void (*xDefineCursor) _ANSI_ARGS_((Display* d, Window w, Cursor c)); /* 20 */
- void (*xDestroyWindow) _ANSI_ARGS_((Display* d, Window w)); /* 21 */
- void (*xDrawArc) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 22 */
- void (*xDrawLines) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2)); /* 23 */
- void (*xDrawRectangle) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 24 */
- void (*xFillArc) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 25 */
- void (*xFillPolygon) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2, int i3)); /* 26 */
- void (*xFillRectangles) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XRectangle* x, int i)); /* 27 */
- void (*xFreeColormap) _ANSI_ARGS_((Display* d, Colormap c)); /* 28 */
- void (*xFreeColors) _ANSI_ARGS_((Display* d, Colormap c, unsigned long* ulp, int i, unsigned long ul)); /* 29 */
- void (*xFreeModifiermap) _ANSI_ARGS_((XModifierKeymap* x)); /* 30 */
- Status (*xGetGeometry) _ANSI_ARGS_((Display* d, Drawable dr, Window* w, int* i1, int* i2, unsigned int* ui1, unsigned int* ui2, unsigned int* ui3, unsigned int* ui4)); /* 31 */
- int (*xGetWindowProperty) _ANSI_ARGS_((Display* d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom* ap, int* ip, unsigned long* ulp1, unsigned long* ulp2, unsigned char** cpp)); /* 32 */
- int (*xGrabKeyboard) _ANSI_ARGS_((Display* d, Window w, Bool b, int i1, int i2, Time t)); /* 33 */
- int (*xGrabPointer) _ANSI_ARGS_((Display* d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t)); /* 34 */
- KeyCode (*xKeysymToKeycode) _ANSI_ARGS_((Display* d, KeySym k)); /* 35 */
- void (*xMapWindow) _ANSI_ARGS_((Display* d, Window w)); /* 36 */
- void (*xMoveResizeWindow) _ANSI_ARGS_((Display* d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 37 */
- void (*xMoveWindow) _ANSI_ARGS_((Display* d, Window w, int i1, int i2)); /* 38 */
- Bool (*xQueryPointer) _ANSI_ARGS_((Display* d, Window w1, Window* w2, Window* w3, int* i1, int* i2, int* i3, int* i4, unsigned int* ui)); /* 39 */
- void (*xRaiseWindow) _ANSI_ARGS_((Display* d, Window w)); /* 40 */
- void (*xRefreshKeyboardMapping) _ANSI_ARGS_((XMappingEvent* x)); /* 41 */
- void (*xResizeWindow) _ANSI_ARGS_((Display* d, Window w, unsigned int ui1, unsigned int ui2)); /* 42 */
- void (*xSelectInput) _ANSI_ARGS_((Display* d, Window w, long l)); /* 43 */
- Status (*xSendEvent) _ANSI_ARGS_((Display* d, Window w, Bool b, long l, XEvent* x)); /* 44 */
- void (*xSetIconName) _ANSI_ARGS_((Display* d, Window w, _Xconst char* c)); /* 45 */
- void (*xSetInputFocus) _ANSI_ARGS_((Display* d, Window w, int i, Time t)); /* 46 */
- void (*xSetSelectionOwner) _ANSI_ARGS_((Display* d, Atom a, Window w, Time t)); /* 47 */
- void (*xSetWindowBackground) _ANSI_ARGS_((Display* d, Window w, unsigned long ul)); /* 48 */
- void (*xSetWindowBackgroundPixmap) _ANSI_ARGS_((Display* d, Window w, Pixmap p)); /* 49 */
- void (*xSetWindowBorder) _ANSI_ARGS_((Display* d, Window w, unsigned long ul)); /* 50 */
- void (*xSetWindowBorderPixmap) _ANSI_ARGS_((Display* d, Window w, Pixmap p)); /* 51 */
- void (*xSetWindowBorderWidth) _ANSI_ARGS_((Display* d, Window w, unsigned int ui)); /* 52 */
- void (*xSetWindowColormap) _ANSI_ARGS_((Display* d, Window w, Colormap c)); /* 53 */
- void (*xUngrabKeyboard) _ANSI_ARGS_((Display* d, Time t)); /* 54 */
- void (*xUngrabPointer) _ANSI_ARGS_((Display* d, Time t)); /* 55 */
- void (*xUnmapWindow) _ANSI_ARGS_((Display* d, Window w)); /* 56 */
- void (*tkPutImage) _ANSI_ARGS_((unsigned long * colors, int ncolors, Display* display, Drawable d, GC gc, XImage* image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height)); /* 57 */
- Status (*xParseColor) _ANSI_ARGS_((Display * display, Colormap map, _Xconst char* spec, XColor * colorPtr)); /* 58 */
- GC (*xCreateGC) _ANSI_ARGS_((Display* display, Drawable d, unsigned long valuemask, XGCValues* values)); /* 59 */
- void (*xFreeGC) _ANSI_ARGS_((Display* display, GC gc)); /* 60 */
- Atom (*xInternAtom) _ANSI_ARGS_((Display* display, _Xconst char* atom_name, Bool only_if_exists)); /* 61 */
- void (*xSetBackground) _ANSI_ARGS_((Display* display, GC gc, unsigned long foreground)); /* 62 */
- void (*xSetForeground) _ANSI_ARGS_((Display* display, GC gc, unsigned long foreground)); /* 63 */
- void (*xSetClipMask) _ANSI_ARGS_((Display* display, GC gc, Pixmap pixmap)); /* 64 */
- void (*xSetClipOrigin) _ANSI_ARGS_((Display* display, GC gc, int clip_x_origin, int clip_y_origin)); /* 65 */
- void (*xSetTSOrigin) _ANSI_ARGS_((Display* display, GC gc, int ts_x_origin, int ts_y_origin)); /* 66 */
- void (*xChangeGC) _ANSI_ARGS_((Display * d, GC gc, unsigned long mask, XGCValues * values)); /* 67 */
- void (*xSetFont) _ANSI_ARGS_((Display * display, GC gc, Font font)); /* 68 */
- void (*xSetArcMode) _ANSI_ARGS_((Display * display, GC gc, int arc_mode)); /* 69 */
- void (*xSetStipple) _ANSI_ARGS_((Display * display, GC gc, Pixmap stipple)); /* 70 */
- void (*xSetFillRule) _ANSI_ARGS_((Display * display, GC gc, int fill_rule)); /* 71 */
- void (*xSetFillStyle) _ANSI_ARGS_((Display * display, GC gc, int fill_style)); /* 72 */
- void (*xSetFunction) _ANSI_ARGS_((Display * display, GC gc, int function)); /* 73 */
- void (*xSetLineAttributes) _ANSI_ARGS_((Display * display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style)); /* 74 */
- int (*_XInitImageFuncPtrs) _ANSI_ARGS_((XImage * image)); /* 75 */
- XIC (*xCreateIC) _ANSI_ARGS_((void)); /* 76 */
- XVisualInfo * (*xGetVisualInfo) _ANSI_ARGS_((Display* display, long vinfo_mask, XVisualInfo* vinfo_template, int* nitems_return)); /* 77 */
- void (*xSetWMClientMachine) _ANSI_ARGS_((Display* display, Window w, XTextProperty* text_prop)); /* 78 */
- Status (*xStringListToTextProperty) _ANSI_ARGS_((char** list, int count, XTextProperty* text_prop_return)); /* 79 */
- void (*xDrawSegments) _ANSI_ARGS_((Display * display, Drawable d, GC gc, XSegment * segments, int nsegments)); /* 80 */
- void (*xForceScreenSaver) _ANSI_ARGS_((Display* display, int mode)); /* 81 */
- void (*xDrawLine) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 82 */
- void (*xFillRectangle) _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 83 */
- void (*xClearWindow) _ANSI_ARGS_((Display* d, Window w)); /* 84 */
- void (*xDrawPoint) _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y)); /* 85 */
- void (*xDrawPoints) _ANSI_ARGS_((Display* display, Drawable d, GC gc, XPoint * points, int npoints, int mode)); /* 86 */
- void (*xWarpPointer) _ANSI_ARGS_((Display* display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y)); /* 87 */
- void (*xQueryColor) _ANSI_ARGS_((Display * display, Colormap colormap, XColor * def_in_out)); /* 88 */
- void (*xQueryColors) _ANSI_ARGS_((Display * display, Colormap colormap, XColor * defs_in_out, int ncolors)); /* 89 */
- Status (*xQueryTree) _ANSI_ARGS_((Display* d, Window w1, Window* w2, Window* w3, Window** w4, unsigned int* ui)); /* 90 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*xSetDashes) _ANSI_ARGS_((Display* display, GC gc, int dash_offset, _Xconst char* dash_list, int n)); /* 0 */
- XModifierKeymap* (*xGetModifierMapping) _ANSI_ARGS_((Display* d)); /* 1 */
- XImage * (*xCreateImage) _ANSI_ARGS_((Display* d, Visual* v, unsigned int ui1, int i1, int i2, char* cp, unsigned int ui2, unsigned int ui3, int i3, int i4)); /* 2 */
- XImage * (*xGetImage) _ANSI_ARGS_((Display* d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3)); /* 3 */
- char * (*xGetAtomName) _ANSI_ARGS_((Display* d, Atom a)); /* 4 */
- char * (*xKeysymToString) _ANSI_ARGS_((KeySym k)); /* 5 */
- Colormap (*xCreateColormap) _ANSI_ARGS_((Display* d, Window w, Visual* v, int i)); /* 6 */
- GContext (*xGContextFromGC) _ANSI_ARGS_((GC g)); /* 7 */
- KeySym (*xKeycodeToKeysym) _ANSI_ARGS_((Display* d, KeyCode k, int i)); /* 8 */
- KeySym (*xStringToKeysym) _ANSI_ARGS_((_Xconst char* c)); /* 9 */
- Window (*xRootWindow) _ANSI_ARGS_((Display* d, int i)); /* 10 */
- XErrorHandler (*xSetErrorHandler) _ANSI_ARGS_((XErrorHandler x)); /* 11 */
- Status (*xAllocColor) _ANSI_ARGS_((Display* d, Colormap c, XColor* xp)); /* 12 */
- void (*xBell) _ANSI_ARGS_((Display* d, int i)); /* 13 */
- void (*xChangeProperty) _ANSI_ARGS_((Display* d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char* c, int i3)); /* 14 */
- void (*xChangeWindowAttributes) _ANSI_ARGS_((Display* d, Window w, unsigned long ul, XSetWindowAttributes* x)); /* 15 */
- void (*xConfigureWindow) _ANSI_ARGS_((Display* d, Window w, unsigned int i, XWindowChanges* x)); /* 16 */
- void (*xCopyArea) _ANSI_ARGS_((Display* d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 17 */
- void (*xCopyPlane) _ANSI_ARGS_((Display* d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul)); /* 18 */
- Pixmap (*xCreateBitmapFromData) _ANSI_ARGS_((Display* display, Drawable d, _Xconst char* data, unsigned int width, unsigned int height)); /* 19 */
- void (*xDefineCursor) _ANSI_ARGS_((Display* d, Window w, Cursor c)); /* 20 */
- void (*xDestroyWindow) _ANSI_ARGS_((Display* d, Window w)); /* 21 */
- void (*xDrawArc) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 22 */
- void (*xDrawLines) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2)); /* 23 */
- void (*xDrawRectangle) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 24 */
- void (*xFillArc) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 25 */
- void (*xFillPolygon) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2, int i3)); /* 26 */
- void (*xFillRectangles) _ANSI_ARGS_((Display* d, Drawable dr, GC g, XRectangle* x, int i)); /* 27 */
- void (*xFreeColormap) _ANSI_ARGS_((Display* d, Colormap c)); /* 28 */
- void (*xFreeColors) _ANSI_ARGS_((Display* d, Colormap c, unsigned long* ulp, int i, unsigned long ul)); /* 29 */
- void (*xFreeModifiermap) _ANSI_ARGS_((XModifierKeymap* x)); /* 30 */
- Status (*xGetGeometry) _ANSI_ARGS_((Display* d, Drawable dr, Window* w, int* i1, int* i2, unsigned int* ui1, unsigned int* ui2, unsigned int* ui3, unsigned int* ui4)); /* 31 */
- int (*xGetWindowProperty) _ANSI_ARGS_((Display* d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom* ap, int* ip, unsigned long* ulp1, unsigned long* ulp2, unsigned char** cpp)); /* 32 */
- int (*xGrabKeyboard) _ANSI_ARGS_((Display* d, Window w, Bool b, int i1, int i2, Time t)); /* 33 */
- int (*xGrabPointer) _ANSI_ARGS_((Display* d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t)); /* 34 */
- KeyCode (*xKeysymToKeycode) _ANSI_ARGS_((Display* d, KeySym k)); /* 35 */
- void (*xMapWindow) _ANSI_ARGS_((Display* d, Window w)); /* 36 */
- void (*xMoveResizeWindow) _ANSI_ARGS_((Display* d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 37 */
- void (*xMoveWindow) _ANSI_ARGS_((Display* d, Window w, int i1, int i2)); /* 38 */
- Bool (*xQueryPointer) _ANSI_ARGS_((Display* d, Window w1, Window* w2, Window* w3, int* i1, int* i2, int* i3, int* i4, unsigned int* ui)); /* 39 */
- void (*xRaiseWindow) _ANSI_ARGS_((Display* d, Window w)); /* 40 */
- void (*xRefreshKeyboardMapping) _ANSI_ARGS_((XMappingEvent* x)); /* 41 */
- void (*xResizeWindow) _ANSI_ARGS_((Display* d, Window w, unsigned int ui1, unsigned int ui2)); /* 42 */
- void (*xSelectInput) _ANSI_ARGS_((Display* d, Window w, long l)); /* 43 */
- Status (*xSendEvent) _ANSI_ARGS_((Display* d, Window w, Bool b, long l, XEvent* x)); /* 44 */
- void (*xSetIconName) _ANSI_ARGS_((Display* d, Window w, _Xconst char* c)); /* 45 */
- void (*xSetInputFocus) _ANSI_ARGS_((Display* d, Window w, int i, Time t)); /* 46 */
- void (*xSetSelectionOwner) _ANSI_ARGS_((Display* d, Atom a, Window w, Time t)); /* 47 */
- void (*xSetWindowBackground) _ANSI_ARGS_((Display* d, Window w, unsigned long ul)); /* 48 */
- void (*xSetWindowBackgroundPixmap) _ANSI_ARGS_((Display* d, Window w, Pixmap p)); /* 49 */
- void (*xSetWindowBorder) _ANSI_ARGS_((Display* d, Window w, unsigned long ul)); /* 50 */
- void (*xSetWindowBorderPixmap) _ANSI_ARGS_((Display* d, Window w, Pixmap p)); /* 51 */
- void (*xSetWindowBorderWidth) _ANSI_ARGS_((Display* d, Window w, unsigned int ui)); /* 52 */
- void (*xSetWindowColormap) _ANSI_ARGS_((Display* d, Window w, Colormap c)); /* 53 */
- void (*xUngrabKeyboard) _ANSI_ARGS_((Display* d, Time t)); /* 54 */
- void (*xUngrabPointer) _ANSI_ARGS_((Display* d, Time t)); /* 55 */
- void (*xUnmapWindow) _ANSI_ARGS_((Display* d, Window w)); /* 56 */
- void (*tkPutImage) _ANSI_ARGS_((unsigned long * colors, int ncolors, Display* display, Drawable d, GC gc, XImage* image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height)); /* 57 */
- Status (*xParseColor) _ANSI_ARGS_((Display * display, Colormap map, _Xconst char* spec, XColor * colorPtr)); /* 58 */
- GC (*xCreateGC) _ANSI_ARGS_((Display* display, Drawable d, unsigned long valuemask, XGCValues* values)); /* 59 */
- void (*xFreeGC) _ANSI_ARGS_((Display* display, GC gc)); /* 60 */
- Atom (*xInternAtom) _ANSI_ARGS_((Display* display, _Xconst char* atom_name, Bool only_if_exists)); /* 61 */
- void (*xSetBackground) _ANSI_ARGS_((Display* display, GC gc, unsigned long foreground)); /* 62 */
- void (*xSetForeground) _ANSI_ARGS_((Display* display, GC gc, unsigned long foreground)); /* 63 */
- void (*xSetClipMask) _ANSI_ARGS_((Display* display, GC gc, Pixmap pixmap)); /* 64 */
- void (*xSetClipOrigin) _ANSI_ARGS_((Display* display, GC gc, int clip_x_origin, int clip_y_origin)); /* 65 */
- void (*xSetTSOrigin) _ANSI_ARGS_((Display* display, GC gc, int ts_x_origin, int ts_y_origin)); /* 66 */
- void (*xChangeGC) _ANSI_ARGS_((Display * d, GC gc, unsigned long mask, XGCValues * values)); /* 67 */
- void (*xSetFont) _ANSI_ARGS_((Display * display, GC gc, Font font)); /* 68 */
- void (*xSetArcMode) _ANSI_ARGS_((Display * display, GC gc, int arc_mode)); /* 69 */
- void (*xSetStipple) _ANSI_ARGS_((Display * display, GC gc, Pixmap stipple)); /* 70 */
- void (*xSetFillRule) _ANSI_ARGS_((Display * display, GC gc, int fill_rule)); /* 71 */
- void (*xSetFillStyle) _ANSI_ARGS_((Display * display, GC gc, int fill_style)); /* 72 */
- void (*xSetFunction) _ANSI_ARGS_((Display * display, GC gc, int function)); /* 73 */
- void (*xSetLineAttributes) _ANSI_ARGS_((Display * display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style)); /* 74 */
- int (*_XInitImageFuncPtrs) _ANSI_ARGS_((XImage * image)); /* 75 */
- XIC (*xCreateIC) _ANSI_ARGS_((void)); /* 76 */
- XVisualInfo * (*xGetVisualInfo) _ANSI_ARGS_((Display* display, long vinfo_mask, XVisualInfo* vinfo_template, int* nitems_return)); /* 77 */
- void (*xSetWMClientMachine) _ANSI_ARGS_((Display* display, Window w, XTextProperty* text_prop)); /* 78 */
- Status (*xStringListToTextProperty) _ANSI_ARGS_((char** list, int count, XTextProperty* text_prop_return)); /* 79 */
- void (*xDrawSegments) _ANSI_ARGS_((Display * display, Drawable d, GC gc, XSegment * segments, int nsegments)); /* 80 */
- void (*xForceScreenSaver) _ANSI_ARGS_((Display* display, int mode)); /* 81 */
- void (*xDrawLine) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 82 */
- void (*xFillRectangle) _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 83 */
- void (*xClearWindow) _ANSI_ARGS_((Display* d, Window w)); /* 84 */
- void (*xDrawPoint) _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y)); /* 85 */
- void (*xDrawPoints) _ANSI_ARGS_((Display* display, Drawable d, GC gc, XPoint * points, int npoints, int mode)); /* 86 */
- void (*xWarpPointer) _ANSI_ARGS_((Display* display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y)); /* 87 */
- void (*xQueryColor) _ANSI_ARGS_((Display * display, Colormap colormap, XColor * def_in_out)); /* 88 */
- void (*xQueryColors) _ANSI_ARGS_((Display * display, Colormap colormap, XColor * defs_in_out, int ncolors)); /* 89 */
- Status (*xQueryTree) _ANSI_ARGS_((Display* d, Window w1, Window* w2, Window* w3, Window** w4, unsigned int* ui)); /* 90 */
- int (*xSync) _ANSI_ARGS_((Display * display, Bool flag)); /* 91 */
-#endif /* MAC_OSX_TK */
+#ifdef __WIN32__ /* WIN */
+ void (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
+ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */
+ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */
+ XImage * (*xGetImage) (Display *d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3); /* 3 */
+ char * (*xGetAtomName) (Display *d, Atom a); /* 4 */
+ char * (*xKeysymToString) (KeySym k); /* 5 */
+ Colormap (*xCreateColormap) (Display *d, Window w, Visual *v, int i); /* 6 */
+ Cursor (*xCreatePixmapCursor) (Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2); /* 7 */
+ Cursor (*xCreateGlyphCursor) (Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor *x1, XColor *x2); /* 8 */
+ GContext (*xGContextFromGC) (GC g); /* 9 */
+ XHostAddress * (*xListHosts) (Display *d, int *i, Bool *b); /* 10 */
+ KeySym (*xKeycodeToKeysym) (Display *d, unsigned int k, int i); /* 11 */
+ KeySym (*xStringToKeysym) (_Xconst char *c); /* 12 */
+ Window (*xRootWindow) (Display *d, int i); /* 13 */
+ XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 14 */
+ Status (*xIconifyWindow) (Display *d, Window w, int i); /* 15 */
+ Status (*xWithdrawWindow) (Display *d, Window w, int i); /* 16 */
+ Status (*xGetWMColormapWindows) (Display *d, Window w, Window **wpp, int *ip); /* 17 */
+ Status (*xAllocColor) (Display *d, Colormap c, XColor *xp); /* 18 */
+ void (*xBell) (Display *d, int i); /* 19 */
+ void (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 20 */
+ void (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 21 */
+ void (*xClearWindow) (Display *d, Window w); /* 22 */
+ void (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 23 */
+ void (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 24 */
+ void (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 25 */
+ Pixmap (*xCreateBitmapFromData) (Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 26 */
+ void (*xDefineCursor) (Display *d, Window w, Cursor c); /* 27 */
+ void (*xDeleteProperty) (Display *d, Window w, Atom a); /* 28 */
+ void (*xDestroyWindow) (Display *d, Window w); /* 29 */
+ void (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 30 */
+ void (*xDrawLines) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 31 */
+ void (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 32 */
+ void (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 33 */
+ void (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 34 */
+ void (*xFillRectangles) (Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 35 */
+ void (*xForceScreenSaver) (Display *d, int i); /* 36 */
+ void (*xFreeColormap) (Display *d, Colormap c); /* 37 */
+ void (*xFreeColors) (Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); /* 38 */
+ void (*xFreeCursor) (Display *d, Cursor c); /* 39 */
+ void (*xFreeModifiermap) (XModifierKeymap *x); /* 40 */
+ Status (*xGetGeometry) (Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4); /* 41 */
+ void (*xGetInputFocus) (Display *d, Window *w, int *i); /* 42 */
+ int (*xGetWindowProperty) (Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp); /* 43 */
+ Status (*xGetWindowAttributes) (Display *d, Window w, XWindowAttributes *x); /* 44 */
+ int (*xGrabKeyboard) (Display *d, Window w, Bool b, int i1, int i2, Time t); /* 45 */
+ int (*xGrabPointer) (Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 46 */
+ KeyCode (*xKeysymToKeycode) (Display *d, KeySym k); /* 47 */
+ Status (*xLookupColor) (Display *d, Colormap c1, _Xconst char *c2, XColor *x1, XColor *x2); /* 48 */
+ void (*xMapWindow) (Display *d, Window w); /* 49 */
+ void (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 50 */
+ void (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 51 */
+ void (*xNextEvent) (Display *d, XEvent *x); /* 52 */
+ void (*xPutBackEvent) (Display *d, XEvent *x); /* 53 */
+ void (*xQueryColors) (Display *d, Colormap c, XColor *x, int i); /* 54 */
+ Bool (*xQueryPointer) (Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 55 */
+ Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 56 */
+ void (*xRaiseWindow) (Display *d, Window w); /* 57 */
+ void (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 58 */
+ void (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 59 */
+ void (*xSelectInput) (Display *d, Window w, long l); /* 60 */
+ Status (*xSendEvent) (Display *d, Window w, Bool b, long l, XEvent *x); /* 61 */
+ void (*xSetCommand) (Display *d, Window w, CONST char **c, int i); /* 62 */
+ void (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 63 */
+ void (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 64 */
+ void (*xSetSelectionOwner) (Display *d, Atom a, Window w, Time t); /* 65 */
+ void (*xSetWindowBackground) (Display *d, Window w, unsigned long ul); /* 66 */
+ void (*xSetWindowBackgroundPixmap) (Display *d, Window w, Pixmap p); /* 67 */
+ void (*xSetWindowBorder) (Display *d, Window w, unsigned long ul); /* 68 */
+ void (*xSetWindowBorderPixmap) (Display *d, Window w, Pixmap p); /* 69 */
+ void (*xSetWindowBorderWidth) (Display *d, Window w, unsigned int ui); /* 70 */
+ void (*xSetWindowColormap) (Display *d, Window w, Colormap c); /* 71 */
+ Bool (*xTranslateCoordinates) (Display *d, Window w1, Window w2, int i1, int i2, int *i3, int *i4, Window *w3); /* 72 */
+ void (*xUngrabKeyboard) (Display *d, Time t); /* 73 */
+ void (*xUngrabPointer) (Display *d, Time t); /* 74 */
+ void (*xUnmapWindow) (Display *d, Window w); /* 75 */
+ void (*xWindowEvent) (Display *d, Window w, long l, XEvent *x); /* 76 */
+ void (*xDestroyIC) (XIC x); /* 77 */
+ Bool (*xFilterEvent) (XEvent *x, Window w); /* 78 */
+ int (*xmbLookupString) (XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 79 */
+ void (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 80 */
+ VOID *reserved81;
+ Status (*xParseColor) (Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 82 */
+ GC (*xCreateGC) (Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 83 */
+ void (*xFreeGC) (Display *display, GC gc); /* 84 */
+ Atom (*xInternAtom) (Display *display, _Xconst char *atom_name, Bool only_if_exists); /* 85 */
+ void (*xSetBackground) (Display *display, GC gc, unsigned long foreground); /* 86 */
+ void (*xSetForeground) (Display *display, GC gc, unsigned long foreground); /* 87 */
+ void (*xSetClipMask) (Display *display, GC gc, Pixmap pixmap); /* 88 */
+ void (*xSetClipOrigin) (Display *display, GC gc, int clip_x_origin, int clip_y_origin); /* 89 */
+ void (*xSetTSOrigin) (Display *display, GC gc, int ts_x_origin, int ts_y_origin); /* 90 */
+ void (*xChangeGC) (Display *d, GC gc, unsigned long mask, XGCValues *values); /* 91 */
+ void (*xSetFont) (Display *display, GC gc, Font font); /* 92 */
+ void (*xSetArcMode) (Display *display, GC gc, int arc_mode); /* 93 */
+ void (*xSetStipple) (Display *display, GC gc, Pixmap stipple); /* 94 */
+ void (*xSetFillRule) (Display *display, GC gc, int fill_rule); /* 95 */
+ void (*xSetFillStyle) (Display *display, GC gc, int fill_style); /* 96 */
+ void (*xSetFunction) (Display *display, GC gc, int function); /* 97 */
+ void (*xSetLineAttributes) (Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 98 */
+ int (*_XInitImageFuncPtrs) (XImage *image); /* 99 */
+ XIC (*xCreateIC) (void); /* 100 */
+ XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 101 */
+ void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 102 */
+ Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 103 */
+ void (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 104 */
+ void (*xWarpPointer) (Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy); /* 105 */
+ void (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 106 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ void (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
+ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */
+ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */
+ XImage * (*xGetImage) (Display *d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3); /* 3 */
+ char * (*xGetAtomName) (Display *d, Atom a); /* 4 */
+ char * (*xKeysymToString) (KeySym k); /* 5 */
+ Colormap (*xCreateColormap) (Display *d, Window w, Visual *v, int i); /* 6 */
+ GContext (*xGContextFromGC) (GC g); /* 7 */
+ KeySym (*xKeycodeToKeysym) (Display *d, KeyCode k, int i); /* 8 */
+ KeySym (*xStringToKeysym) (_Xconst char *c); /* 9 */
+ Window (*xRootWindow) (Display *d, int i); /* 10 */
+ XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 11 */
+ Status (*xAllocColor) (Display *d, Colormap c, XColor *xp); /* 12 */
+ void (*xBell) (Display *d, int i); /* 13 */
+ void (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 14 */
+ void (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 15 */
+ void (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 16 */
+ void (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 17 */
+ void (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 18 */
+ Pixmap (*xCreateBitmapFromData) (Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 19 */
+ void (*xDefineCursor) (Display *d, Window w, Cursor c); /* 20 */
+ void (*xDestroyWindow) (Display *d, Window w); /* 21 */
+ void (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 22 */
+ void (*xDrawLines) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 23 */
+ void (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 24 */
+ void (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 25 */
+ void (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 26 */
+ void (*xFillRectangles) (Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 27 */
+ void (*xFreeColormap) (Display *d, Colormap c); /* 28 */
+ void (*xFreeColors) (Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); /* 29 */
+ void (*xFreeModifiermap) (XModifierKeymap *x); /* 30 */
+ Status (*xGetGeometry) (Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4); /* 31 */
+ int (*xGetWindowProperty) (Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp); /* 32 */
+ int (*xGrabKeyboard) (Display *d, Window w, Bool b, int i1, int i2, Time t); /* 33 */
+ int (*xGrabPointer) (Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 34 */
+ KeyCode (*xKeysymToKeycode) (Display *d, KeySym k); /* 35 */
+ void (*xMapWindow) (Display *d, Window w); /* 36 */
+ void (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 37 */
+ void (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 38 */
+ Bool (*xQueryPointer) (Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 39 */
+ void (*xRaiseWindow) (Display *d, Window w); /* 40 */
+ void (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 41 */
+ void (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 42 */
+ void (*xSelectInput) (Display *d, Window w, long l); /* 43 */
+ Status (*xSendEvent) (Display *d, Window w, Bool b, long l, XEvent *x); /* 44 */
+ void (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 45 */
+ void (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 46 */
+ void (*xSetSelectionOwner) (Display *d, Atom a, Window w, Time t); /* 47 */
+ void (*xSetWindowBackground) (Display *d, Window w, unsigned long ul); /* 48 */
+ void (*xSetWindowBackgroundPixmap) (Display *d, Window w, Pixmap p); /* 49 */
+ void (*xSetWindowBorder) (Display *d, Window w, unsigned long ul); /* 50 */
+ void (*xSetWindowBorderPixmap) (Display *d, Window w, Pixmap p); /* 51 */
+ void (*xSetWindowBorderWidth) (Display *d, Window w, unsigned int ui); /* 52 */
+ void (*xSetWindowColormap) (Display *d, Window w, Colormap c); /* 53 */
+ void (*xUngrabKeyboard) (Display *d, Time t); /* 54 */
+ void (*xUngrabPointer) (Display *d, Time t); /* 55 */
+ void (*xUnmapWindow) (Display *d, Window w); /* 56 */
+ void (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 57 */
+ Status (*xParseColor) (Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 58 */
+ GC (*xCreateGC) (Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 59 */
+ void (*xFreeGC) (Display *display, GC gc); /* 60 */
+ Atom (*xInternAtom) (Display *display, _Xconst char *atom_name, Bool only_if_exists); /* 61 */
+ void (*xSetBackground) (Display *display, GC gc, unsigned long foreground); /* 62 */
+ void (*xSetForeground) (Display *display, GC gc, unsigned long foreground); /* 63 */
+ void (*xSetClipMask) (Display *display, GC gc, Pixmap pixmap); /* 64 */
+ void (*xSetClipOrigin) (Display *display, GC gc, int clip_x_origin, int clip_y_origin); /* 65 */
+ void (*xSetTSOrigin) (Display *display, GC gc, int ts_x_origin, int ts_y_origin); /* 66 */
+ void (*xChangeGC) (Display *d, GC gc, unsigned long mask, XGCValues *values); /* 67 */
+ void (*xSetFont) (Display *display, GC gc, Font font); /* 68 */
+ void (*xSetArcMode) (Display *display, GC gc, int arc_mode); /* 69 */
+ void (*xSetStipple) (Display *display, GC gc, Pixmap stipple); /* 70 */
+ void (*xSetFillRule) (Display *display, GC gc, int fill_rule); /* 71 */
+ void (*xSetFillStyle) (Display *display, GC gc, int fill_style); /* 72 */
+ void (*xSetFunction) (Display *display, GC gc, int function); /* 73 */
+ void (*xSetLineAttributes) (Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 74 */
+ int (*_XInitImageFuncPtrs) (XImage *image); /* 75 */
+ XIC (*xCreateIC) (void); /* 76 */
+ XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 77 */
+ void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 78 */
+ Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 79 */
+ void (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */
+ void (*xForceScreenSaver) (Display *display, int mode); /* 81 */
+ void (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 82 */
+ void (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 83 */
+ void (*xClearWindow) (Display *d, Window w); /* 84 */
+ void (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */
+ void (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */
+ void (*xWarpPointer) (Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y); /* 87 */
+ void (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */
+ void (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */
+ Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 90 */
+ int (*xSync) (Display *display, Bool flag); /* 91 */
+#endif /* AQUA */
} TkIntXlibStubs;
#ifdef __cplusplus
@@ -1263,7 +1412,7 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
* Inline function declarations:
*/
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
#ifndef XSetDashes
#define XSetDashes \
(tkIntXlibStubsPtr->xSetDashes) /* 0 */
@@ -1689,374 +1838,8 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
#define XFillRectangle \
(tkIntXlibStubsPtr->xFillRectangle) /* 106 */
#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
-#ifndef XSetDashes
-#define XSetDashes \
- (tkIntXlibStubsPtr->xSetDashes) /* 0 */
-#endif
-#ifndef XGetModifierMapping
-#define XGetModifierMapping \
- (tkIntXlibStubsPtr->xGetModifierMapping) /* 1 */
-#endif
-#ifndef XCreateImage
-#define XCreateImage \
- (tkIntXlibStubsPtr->xCreateImage) /* 2 */
-#endif
-#ifndef XGetImage
-#define XGetImage \
- (tkIntXlibStubsPtr->xGetImage) /* 3 */
-#endif
-#ifndef XGetAtomName
-#define XGetAtomName \
- (tkIntXlibStubsPtr->xGetAtomName) /* 4 */
-#endif
-#ifndef XKeysymToString
-#define XKeysymToString \
- (tkIntXlibStubsPtr->xKeysymToString) /* 5 */
-#endif
-#ifndef XCreateColormap
-#define XCreateColormap \
- (tkIntXlibStubsPtr->xCreateColormap) /* 6 */
-#endif
-#ifndef XGContextFromGC
-#define XGContextFromGC \
- (tkIntXlibStubsPtr->xGContextFromGC) /* 7 */
-#endif
-#ifndef XKeycodeToKeysym
-#define XKeycodeToKeysym \
- (tkIntXlibStubsPtr->xKeycodeToKeysym) /* 8 */
-#endif
-#ifndef XStringToKeysym
-#define XStringToKeysym \
- (tkIntXlibStubsPtr->xStringToKeysym) /* 9 */
-#endif
-#ifndef XRootWindow
-#define XRootWindow \
- (tkIntXlibStubsPtr->xRootWindow) /* 10 */
-#endif
-#ifndef XSetErrorHandler
-#define XSetErrorHandler \
- (tkIntXlibStubsPtr->xSetErrorHandler) /* 11 */
-#endif
-#ifndef XAllocColor
-#define XAllocColor \
- (tkIntXlibStubsPtr->xAllocColor) /* 12 */
-#endif
-#ifndef XBell
-#define XBell \
- (tkIntXlibStubsPtr->xBell) /* 13 */
-#endif
-#ifndef XChangeProperty
-#define XChangeProperty \
- (tkIntXlibStubsPtr->xChangeProperty) /* 14 */
-#endif
-#ifndef XChangeWindowAttributes
-#define XChangeWindowAttributes \
- (tkIntXlibStubsPtr->xChangeWindowAttributes) /* 15 */
-#endif
-#ifndef XConfigureWindow
-#define XConfigureWindow \
- (tkIntXlibStubsPtr->xConfigureWindow) /* 16 */
-#endif
-#ifndef XCopyArea
-#define XCopyArea \
- (tkIntXlibStubsPtr->xCopyArea) /* 17 */
-#endif
-#ifndef XCopyPlane
-#define XCopyPlane \
- (tkIntXlibStubsPtr->xCopyPlane) /* 18 */
-#endif
-#ifndef XCreateBitmapFromData
-#define XCreateBitmapFromData \
- (tkIntXlibStubsPtr->xCreateBitmapFromData) /* 19 */
-#endif
-#ifndef XDefineCursor
-#define XDefineCursor \
- (tkIntXlibStubsPtr->xDefineCursor) /* 20 */
-#endif
-#ifndef XDestroyWindow
-#define XDestroyWindow \
- (tkIntXlibStubsPtr->xDestroyWindow) /* 21 */
-#endif
-#ifndef XDrawArc
-#define XDrawArc \
- (tkIntXlibStubsPtr->xDrawArc) /* 22 */
-#endif
-#ifndef XDrawLines
-#define XDrawLines \
- (tkIntXlibStubsPtr->xDrawLines) /* 23 */
-#endif
-#ifndef XDrawRectangle
-#define XDrawRectangle \
- (tkIntXlibStubsPtr->xDrawRectangle) /* 24 */
-#endif
-#ifndef XFillArc
-#define XFillArc \
- (tkIntXlibStubsPtr->xFillArc) /* 25 */
-#endif
-#ifndef XFillPolygon
-#define XFillPolygon \
- (tkIntXlibStubsPtr->xFillPolygon) /* 26 */
-#endif
-#ifndef XFillRectangles
-#define XFillRectangles \
- (tkIntXlibStubsPtr->xFillRectangles) /* 27 */
-#endif
-#ifndef XFreeColormap
-#define XFreeColormap \
- (tkIntXlibStubsPtr->xFreeColormap) /* 28 */
-#endif
-#ifndef XFreeColors
-#define XFreeColors \
- (tkIntXlibStubsPtr->xFreeColors) /* 29 */
-#endif
-#ifndef XFreeModifiermap
-#define XFreeModifiermap \
- (tkIntXlibStubsPtr->xFreeModifiermap) /* 30 */
-#endif
-#ifndef XGetGeometry
-#define XGetGeometry \
- (tkIntXlibStubsPtr->xGetGeometry) /* 31 */
-#endif
-#ifndef XGetWindowProperty
-#define XGetWindowProperty \
- (tkIntXlibStubsPtr->xGetWindowProperty) /* 32 */
-#endif
-#ifndef XGrabKeyboard
-#define XGrabKeyboard \
- (tkIntXlibStubsPtr->xGrabKeyboard) /* 33 */
-#endif
-#ifndef XGrabPointer
-#define XGrabPointer \
- (tkIntXlibStubsPtr->xGrabPointer) /* 34 */
-#endif
-#ifndef XKeysymToKeycode
-#define XKeysymToKeycode \
- (tkIntXlibStubsPtr->xKeysymToKeycode) /* 35 */
-#endif
-#ifndef XMapWindow
-#define XMapWindow \
- (tkIntXlibStubsPtr->xMapWindow) /* 36 */
-#endif
-#ifndef XMoveResizeWindow
-#define XMoveResizeWindow \
- (tkIntXlibStubsPtr->xMoveResizeWindow) /* 37 */
-#endif
-#ifndef XMoveWindow
-#define XMoveWindow \
- (tkIntXlibStubsPtr->xMoveWindow) /* 38 */
-#endif
-#ifndef XQueryPointer
-#define XQueryPointer \
- (tkIntXlibStubsPtr->xQueryPointer) /* 39 */
-#endif
-#ifndef XRaiseWindow
-#define XRaiseWindow \
- (tkIntXlibStubsPtr->xRaiseWindow) /* 40 */
-#endif
-#ifndef XRefreshKeyboardMapping
-#define XRefreshKeyboardMapping \
- (tkIntXlibStubsPtr->xRefreshKeyboardMapping) /* 41 */
-#endif
-#ifndef XResizeWindow
-#define XResizeWindow \
- (tkIntXlibStubsPtr->xResizeWindow) /* 42 */
-#endif
-#ifndef XSelectInput
-#define XSelectInput \
- (tkIntXlibStubsPtr->xSelectInput) /* 43 */
-#endif
-#ifndef XSendEvent
-#define XSendEvent \
- (tkIntXlibStubsPtr->xSendEvent) /* 44 */
-#endif
-#ifndef XSetIconName
-#define XSetIconName \
- (tkIntXlibStubsPtr->xSetIconName) /* 45 */
-#endif
-#ifndef XSetInputFocus
-#define XSetInputFocus \
- (tkIntXlibStubsPtr->xSetInputFocus) /* 46 */
-#endif
-#ifndef XSetSelectionOwner
-#define XSetSelectionOwner \
- (tkIntXlibStubsPtr->xSetSelectionOwner) /* 47 */
-#endif
-#ifndef XSetWindowBackground
-#define XSetWindowBackground \
- (tkIntXlibStubsPtr->xSetWindowBackground) /* 48 */
-#endif
-#ifndef XSetWindowBackgroundPixmap
-#define XSetWindowBackgroundPixmap \
- (tkIntXlibStubsPtr->xSetWindowBackgroundPixmap) /* 49 */
-#endif
-#ifndef XSetWindowBorder
-#define XSetWindowBorder \
- (tkIntXlibStubsPtr->xSetWindowBorder) /* 50 */
-#endif
-#ifndef XSetWindowBorderPixmap
-#define XSetWindowBorderPixmap \
- (tkIntXlibStubsPtr->xSetWindowBorderPixmap) /* 51 */
-#endif
-#ifndef XSetWindowBorderWidth
-#define XSetWindowBorderWidth \
- (tkIntXlibStubsPtr->xSetWindowBorderWidth) /* 52 */
-#endif
-#ifndef XSetWindowColormap
-#define XSetWindowColormap \
- (tkIntXlibStubsPtr->xSetWindowColormap) /* 53 */
-#endif
-#ifndef XUngrabKeyboard
-#define XUngrabKeyboard \
- (tkIntXlibStubsPtr->xUngrabKeyboard) /* 54 */
-#endif
-#ifndef XUngrabPointer
-#define XUngrabPointer \
- (tkIntXlibStubsPtr->xUngrabPointer) /* 55 */
-#endif
-#ifndef XUnmapWindow
-#define XUnmapWindow \
- (tkIntXlibStubsPtr->xUnmapWindow) /* 56 */
-#endif
-#ifndef TkPutImage
-#define TkPutImage \
- (tkIntXlibStubsPtr->tkPutImage) /* 57 */
-#endif
-#ifndef XParseColor
-#define XParseColor \
- (tkIntXlibStubsPtr->xParseColor) /* 58 */
-#endif
-#ifndef XCreateGC
-#define XCreateGC \
- (tkIntXlibStubsPtr->xCreateGC) /* 59 */
-#endif
-#ifndef XFreeGC
-#define XFreeGC \
- (tkIntXlibStubsPtr->xFreeGC) /* 60 */
-#endif
-#ifndef XInternAtom
-#define XInternAtom \
- (tkIntXlibStubsPtr->xInternAtom) /* 61 */
-#endif
-#ifndef XSetBackground
-#define XSetBackground \
- (tkIntXlibStubsPtr->xSetBackground) /* 62 */
-#endif
-#ifndef XSetForeground
-#define XSetForeground \
- (tkIntXlibStubsPtr->xSetForeground) /* 63 */
-#endif
-#ifndef XSetClipMask
-#define XSetClipMask \
- (tkIntXlibStubsPtr->xSetClipMask) /* 64 */
-#endif
-#ifndef XSetClipOrigin
-#define XSetClipOrigin \
- (tkIntXlibStubsPtr->xSetClipOrigin) /* 65 */
-#endif
-#ifndef XSetTSOrigin
-#define XSetTSOrigin \
- (tkIntXlibStubsPtr->xSetTSOrigin) /* 66 */
-#endif
-#ifndef XChangeGC
-#define XChangeGC \
- (tkIntXlibStubsPtr->xChangeGC) /* 67 */
-#endif
-#ifndef XSetFont
-#define XSetFont \
- (tkIntXlibStubsPtr->xSetFont) /* 68 */
-#endif
-#ifndef XSetArcMode
-#define XSetArcMode \
- (tkIntXlibStubsPtr->xSetArcMode) /* 69 */
-#endif
-#ifndef XSetStipple
-#define XSetStipple \
- (tkIntXlibStubsPtr->xSetStipple) /* 70 */
-#endif
-#ifndef XSetFillRule
-#define XSetFillRule \
- (tkIntXlibStubsPtr->xSetFillRule) /* 71 */
-#endif
-#ifndef XSetFillStyle
-#define XSetFillStyle \
- (tkIntXlibStubsPtr->xSetFillStyle) /* 72 */
-#endif
-#ifndef XSetFunction
-#define XSetFunction \
- (tkIntXlibStubsPtr->xSetFunction) /* 73 */
-#endif
-#ifndef XSetLineAttributes
-#define XSetLineAttributes \
- (tkIntXlibStubsPtr->xSetLineAttributes) /* 74 */
-#endif
-#ifndef _XInitImageFuncPtrs
-#define _XInitImageFuncPtrs \
- (tkIntXlibStubsPtr->_XInitImageFuncPtrs) /* 75 */
-#endif
-#ifndef XCreateIC
-#define XCreateIC \
- (tkIntXlibStubsPtr->xCreateIC) /* 76 */
-#endif
-#ifndef XGetVisualInfo
-#define XGetVisualInfo \
- (tkIntXlibStubsPtr->xGetVisualInfo) /* 77 */
-#endif
-#ifndef XSetWMClientMachine
-#define XSetWMClientMachine \
- (tkIntXlibStubsPtr->xSetWMClientMachine) /* 78 */
-#endif
-#ifndef XStringListToTextProperty
-#define XStringListToTextProperty \
- (tkIntXlibStubsPtr->xStringListToTextProperty) /* 79 */
-#endif
-#ifndef XDrawSegments
-#define XDrawSegments \
- (tkIntXlibStubsPtr->xDrawSegments) /* 80 */
-#endif
-#ifndef XForceScreenSaver
-#define XForceScreenSaver \
- (tkIntXlibStubsPtr->xForceScreenSaver) /* 81 */
-#endif
-#ifndef XDrawLine
-#define XDrawLine \
- (tkIntXlibStubsPtr->xDrawLine) /* 82 */
-#endif
-#ifndef XFillRectangle
-#define XFillRectangle \
- (tkIntXlibStubsPtr->xFillRectangle) /* 83 */
-#endif
-#ifndef XClearWindow
-#define XClearWindow \
- (tkIntXlibStubsPtr->xClearWindow) /* 84 */
-#endif
-#ifndef XDrawPoint
-#define XDrawPoint \
- (tkIntXlibStubsPtr->xDrawPoint) /* 85 */
-#endif
-#ifndef XDrawPoints
-#define XDrawPoints \
- (tkIntXlibStubsPtr->xDrawPoints) /* 86 */
-#endif
-#ifndef XWarpPointer
-#define XWarpPointer \
- (tkIntXlibStubsPtr->xWarpPointer) /* 87 */
-#endif
-#ifndef XQueryColor
-#define XQueryColor \
- (tkIntXlibStubsPtr->xQueryColor) /* 88 */
-#endif
-#ifndef XQueryColors
-#define XQueryColors \
- (tkIntXlibStubsPtr->xQueryColors) /* 89 */
-#endif
-#ifndef XQueryTree
-#define XQueryTree \
- (tkIntXlibStubsPtr->xQueryTree) /* 90 */
-#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef XSetDashes
#define XSetDashes \
(tkIntXlibStubsPtr->xSetDashes) /* 0 */
@@ -2425,7 +2208,7 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
#define XSync \
(tkIntXlibStubsPtr->xSync) /* 91 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index cc73937..44421d2 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -1,18 +1,17 @@
-/*
+/*
* tkListbox.c --
*
- * This module implements listbox widgets for the Tk
- * toolkit. A listbox displays a collection of strings,
- * one per line, and provides scrolling and selection.
+ * This module implements listbox widgets for the Tk toolkit. A listbox
+ * displays a collection of strings, one per line, and provides scrolling
+ * and selection.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "default.h"
#include "tkInt.h"
@@ -21,38 +20,40 @@
#endif
typedef struct {
- Tk_OptionTable listboxOptionTable; /* Table defining configuration options
- * available for the listbox */
- Tk_OptionTable itemAttrOptionTable; /* Table definining configuration
- * options available for listbox
- * items */
+ Tk_OptionTable listboxOptionTable;
+ /* Table defining configuration options
+ * available for the listbox. */
+ Tk_OptionTable itemAttrOptionTable;
+ /* Table definining configuration options
+ * available for listbox items. */
} ListboxOptionTables;
/*
- * A data structure of the following type is kept for each listbox
- * widget managed by this file:
+ * A data structure of the following type is kept for each listbox widget
+ * managed by this file:
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the listbox. NULL
+ Tk_Window tkwin; /* Window that embodies the listbox. NULL
* means that the window has been destroyed
* but the data structures haven't yet been
- * cleaned up.*/
- Display *display; /* Display containing widget. Used, among
+ * cleaned up. */
+ Display *display; /* Display containing widget. Used, among
* other things, so that resources can be
* freed even after tkwin has gone away. */
Tcl_Interp *interp; /* Interpreter associated with listbox. */
Tcl_Command widgetCmd; /* Token for listbox's widget command. */
Tk_OptionTable optionTable; /* Table that defines configuration options
* available for this widget. */
- Tk_OptionTable itemAttrOptionTable; /* Table that defines configuration
- * options available for listbox
- * items */
- char *listVarName; /* List variable name */
- Tcl_Obj *listObj; /* Pointer to the list object being used */
- int nElements; /* Holds the current count of elements */
- Tcl_HashTable *selection; /* Tracks selection */
- Tcl_HashTable *itemAttrTable; /* Tracks item attributes */
+ Tk_OptionTable itemAttrOptionTable;
+ /* Table that defines configuration options
+ * available for listbox items. */
+ char *listVarName; /* List variable name */
+ Tcl_Obj *listObj; /* Pointer to the list object being used */
+ int nElements; /* Holds the current count of elements */
+ Tcl_HashTable *selection; /* Tracks selection */
+ Tcl_HashTable *itemAttrTable;
+ /* Tracks item attributes */
/*
* Information used when displaying widget:
@@ -62,18 +63,18 @@ typedef struct {
* window, plus used for background. */
int borderWidth; /* Width of 3-D border around window. */
int relief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * <= 0 means don't draw a highlight. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. <= 0 means
+ * don't draw a highlight. */
XColor *highlightBgColorPtr;
- /* Color for drawing traversal highlight
- * area when highlight is off. */
+ /* Color for drawing traversal highlight area
+ * when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
int inset; /* Total width of all borders, including
* traversal highlight and 3-D border.
- * Indicates how much interior stuff must
- * be offset from outside edges to leave
- * room for borders. */
+ * Indicates how much interior stuff must be
+ * offset from outside edges to leave room for
+ * borders. */
Tk_Font tkfont; /* Information about text font, or NULL. */
XColor *fgColorPtr; /* Text color in normal mode. */
XColor *dfgColorPtr; /* Text color in disabled mode. */
@@ -85,20 +86,20 @@ typedef struct {
GC selTextGC; /* For drawing selected text. */
int width; /* Desired width of window, in characters. */
int height; /* Desired height of window, in lines. */
- int lineHeight; /* Number of pixels allocated for each line
- * in display. */
+ int lineHeight; /* Number of pixels allocated for each line in
+ * display. */
int topIndex; /* Index of top-most element visible in
* window. */
int fullLines; /* Number of lines that fit are completely
- * visible in window. There may be one
+ * visible in window. There may be one
* additional line at the bottom that is
* partially visible. */
int partialLine; /* 0 means that the window holds exactly
- * fullLines lines. 1 means that there is
- * one additional line that is partially
+ * fullLines lines. 1 means that there is one
+ * additional line that is partially
* visble. */
- int setGrid; /* Non-zero means pass gridding information
- * to window manager. */
+ int setGrid; /* Non-zero means pass gridding information to
+ * window manager. */
/*
* Information to support horizontal scrolling:
@@ -110,26 +111,26 @@ typedef struct {
* horizontal scrolling (window scrolls
* horizontally in increments of this size).
* This is an average character size. */
- int xOffset; /* The left edge of each string in the
- * listbox is offset to the left by this
- * many pixels (0 means no offset, positive
- * means there is an offset). */
+ int xOffset; /* The left edge of each string in the listbox
+ * is offset to the left by this many pixels
+ * (0 means no offset, positive means there is
+ * an offset). */
/*
* Information about what's selected or active, if any.
*/
Tk_Uid selectMode; /* Selection style: single, browse, multiple,
- * or extended. This value isn't used in C
+ * or extended. This value isn't used in C
* code, but the Tcl bindings use it. */
int numSelected; /* Number of elements currently selected. */
- int selectAnchor; /* Fixed end of selection (i.e. element
- * at which selection was started.) */
- int exportSelection; /* Non-zero means tie internal listbox
- * to X selection. */
- int active; /* Index of "active" element (the one that
- * has been selected by keyboard traversal).
- * -1 means none. */
+ int selectAnchor; /* Fixed end of selection (i.e. element at
+ * which selection was started.) */
+ int exportSelection; /* Non-zero means tie internal listbox to X
+ * selection. */
+ int active; /* Index of "active" element (the one that has
+ * been selected by keyboard traversal). -1
+ * means none. */
int activeStyle; /* style in which to draw the active element.
* One of: underline, none, dotbox */
@@ -151,18 +152,18 @@ typedef struct {
*/
Tk_Cursor cursor; /* Current cursor for window, or None. */
- char *takeFocus; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
+ char *takeFocus; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
char *yScrollCmd; /* Command prefix for communicating with
- * vertical scrollbar. NULL means no command
- * to issue. Malloc'ed. */
+ * vertical scrollbar. NULL means no command
+ * to issue. Malloc'ed. */
char *xScrollCmd; /* Command prefix for communicating with
- * horizontal scrollbar. NULL means no command
- * to issue. Malloc'ed. */
+ * horizontal scrollbar. NULL means no command
+ * to issue. Malloc'ed. */
int state; /* Listbox state. */
Pixmap gray; /* Pixmap for displaying disabled text. */
- int flags; /* Various flag bits: see below for
+ int flags; /* Various flag bits: see below for
* definitions. */
} Listbox;
@@ -170,26 +171,26 @@ typedef struct {
* ItemAttr structures are used to store item configuration information for
* the items in a listbox
*/
+
typedef struct {
Tk_3DBorder border; /* Used for drawing background around text */
Tk_3DBorder selBorder; /* Used for selected text */
XColor *fgColor; /* Text color in normal mode. */
XColor *selFgColor; /* Text color in selected mode. */
-} ItemAttr;
+} ItemAttr;
/*
* Flag bits for listboxes:
*
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler
- * has already been queued to redraw
- * this window.
- * UPDATE_V_SCROLLBAR: Non-zero means vertical scrollbar needs
- * to be updated.
- * UPDATE_H_SCROLLBAR: Non-zero means horizontal scrollbar needs
- * to be updated.
- * GOT_FOCUS: Non-zero means this widget currently
- * has the input focus.
- * MAXWIDTH_IS_STALE: Stored maxWidth may be out-of-date
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
+ * already been queued to redraw this window.
+ * UPDATE_V_SCROLLBAR: Non-zero means vertical scrollbar needs to be
+ * updated.
+ * UPDATE_H_SCROLLBAR: Non-zero means horizontal scrollbar needs to
+ * be updated.
+ * GOT_FOCUS: Non-zero means this widget currently has the
+ * input focus.
+ * MAXWIDTH_IS_STALE: Stored maxWidth may be out-of-date
* LISTBOX_DELETED: This listbox has been effectively destroyed.
*/
@@ -201,9 +202,9 @@ typedef struct {
#define LISTBOX_DELETED 32
/*
- * The following enum is used to define a type for the -state option
- * of the Entry widget. These values are used as indices into the
- * string table below.
+ * The following enum is used to define a type for the -state option of the
+ * Listbox widget. These values are used as indices into the string table
+ * below.
*/
enum state {
@@ -211,7 +212,7 @@ enum state {
};
static char *stateStrings[] = {
- "disabled", "normal", (char *) NULL
+ "disabled", "normal", NULL
};
enum activeStyle {
@@ -219,24 +220,25 @@ enum activeStyle {
};
static char *activeStyleStrings[] = {
- "dotbox", "none", "underline", (char *) NULL
+ "dotbox", "none", "underline", NULL
};
/*
* The optionSpecs table defines the valid configuration options for the
- * listbox widget
+ * listbox widget.
*/
-static Tk_OptionSpec optionSpecs[] = {
+
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-activestyle", "activeStyle", "ActiveStyle",
DEF_LISTBOX_ACTIVE_STYLE, -1, Tk_Offset(Listbox, activeStyle),
- 0, (ClientData) activeStyleStrings, 0},
+ 0, (ClientData) activeStyleStrings, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_LISTBOX_BG_COLOR, -1, Tk_Offset(Listbox, normalBorder),
0, (ClientData) DEF_LISTBOX_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_LISTBOX_BORDER_WIDTH, -1, Tk_Offset(Listbox, borderWidth),
0, 0, 0},
@@ -249,8 +251,8 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
"ExportSelection", DEF_LISTBOX_EXPORT_SELECTION, -1,
Tk_Offset(Listbox, exportSelection), 0, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_LISTBOX_FONT, -1, Tk_Offset(Listbox, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
@@ -258,7 +260,7 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_INT, "-height", "height", "Height",
DEF_LISTBOX_HEIGHT, -1, Tk_Offset(Listbox, height), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
- "HighlightBackground", DEF_LISTBOX_HIGHLIGHT_BG, -1,
+ "HighlightBackground", DEF_LISTBOX_HIGHLIGHT_BG, -1,
Tk_Offset(Listbox, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
DEF_LISTBOX_HIGHLIGHT, -1, Tk_Offset(Listbox, highlightColorPtr),
@@ -283,8 +285,8 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid",
DEF_LISTBOX_SET_GRID, -1, Tk_Offset(Listbox, setGrid), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_LISTBOX_STATE, -1, Tk_Offset(Listbox, state),
- 0, (ClientData) stateStrings, 0},
+ DEF_LISTBOX_STATE, -1, Tk_Offset(Listbox, state),
+ 0, (ClientData) stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_LISTBOX_TAKE_FOCUS, -1, Tk_Offset(Listbox, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
@@ -299,50 +301,48 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING, "-listvariable", "listVariable", "Variable",
DEF_LISTBOX_LIST_VARIABLE, -1, Tk_Offset(Listbox, listVarName),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
* The itemAttrOptionSpecs table defines the valid configuration options for
* listbox items
*/
-static Tk_OptionSpec itemAttrOptionSpecs[] = {
+
+static const Tk_OptionSpec itemAttrOptionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
- (char *)NULL, -1, Tk_Offset(ItemAttr, border),
+ NULL, -1, Tk_Offset(ItemAttr, border),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT,
(ClientData) DEF_LISTBOX_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- (char *) NULL, -1, Tk_Offset(ItemAttr, fgColor),
+ NULL, -1, Tk_Offset(ItemAttr, fgColor),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
- (char *) NULL, -1, Tk_Offset(ItemAttr, selBorder),
+ NULL, -1, Tk_Offset(ItemAttr, selBorder),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT,
(ClientData) DEF_LISTBOX_SELECT_MONO, 0},
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
- (char *) NULL, -1, Tk_Offset(ItemAttr, selFgColor),
+ NULL, -1, Tk_Offset(ItemAttr, selFgColor),
TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT,
(ClientData) DEF_LISTBOX_SELECT_FG_MONO, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
- * The following tables define the listbox widget commands (and sub-
- * commands) and map the indexes into the string tables into
- * enumerated types used to dispatch the listbox widget command.
+ * The following tables define the listbox widget commands (and sub- commands)
+ * and map the indexes into the string tables into enumerated types used to
+ * dispatch the listbox widget command.
*/
-static CONST char *commandNames[] = {
+
+static const char *commandNames[] = {
"activate", "bbox", "cget", "configure", "curselection", "delete", "get",
"index", "insert", "itemcget", "itemconfigure", "nearest", "scan",
- "see", "selection", "size", "xview", "yview",
- (char *) NULL
+ "see", "selection", "size", "xview", "yview", NULL
};
-
enum command {
COMMAND_ACTIVATE, COMMAND_BBOX, COMMAND_CGET, COMMAND_CONFIGURE,
COMMAND_CURSELECTION, COMMAND_DELETE, COMMAND_GET, COMMAND_INDEX,
@@ -351,99 +351,84 @@ enum command {
COMMAND_SIZE, COMMAND_XVIEW, COMMAND_YVIEW
};
-static CONST char *selCommandNames[] = {
- "anchor", "clear", "includes", "set", (char *) NULL
+static const char *selCommandNames[] = {
+ "anchor", "clear", "includes", "set", NULL
};
-
enum selcommand {
SELECTION_ANCHOR, SELECTION_CLEAR, SELECTION_INCLUDES, SELECTION_SET
};
-static CONST char *scanCommandNames[] = {
- "mark", "dragto", (char *) NULL
+static const char *scanCommandNames[] = {
+ "mark", "dragto", NULL
};
-
enum scancommand {
SCAN_MARK, SCAN_DRAGTO
};
-static CONST char *indexNames[] = {
- "active", "anchor", "end", (char *)NULL
+static const char *indexNames[] = {
+ "active", "anchor", "end", NULL
};
-
enum indices {
INDEX_ACTIVE, INDEX_ANCHOR, INDEX_END
};
+/*
+ * Declarations for procedures defined later in this file.
+ */
-/* Declarations for procedures defined later in this file */
-static void ChangeListboxOffset _ANSI_ARGS_((Listbox *listPtr,
- int offset));
-static void ChangeListboxView _ANSI_ARGS_((Listbox *listPtr,
- int index));
-static int ConfigureListbox _ANSI_ARGS_((Tcl_Interp *interp,
- Listbox *listPtr, int objc, Tcl_Obj *CONST objv[],
- int flags));
-static int ConfigureListboxItem _ANSI_ARGS_ ((Tcl_Interp *interp,
+static void ChangeListboxOffset(Listbox *listPtr, int offset);
+static void ChangeListboxView(Listbox *listPtr, int index);
+static int ConfigureListbox(Tcl_Interp *interp, Listbox *listPtr,
+ int objc, Tcl_Obj *const objv[], int flags);
+static int ConfigureListboxItem(Tcl_Interp *interp,
Listbox *listPtr, ItemAttr *attrs, int objc,
- Tcl_Obj *CONST objv[], int index));
-static int ListboxDeleteSubCmd _ANSI_ARGS_((Listbox *listPtr,
- int first, int last));
-static void DestroyListbox _ANSI_ARGS_((char *memPtr));
-static void DestroyListboxOptionTables _ANSI_ARGS_ (
- (ClientData clientData, Tcl_Interp *interp));
-static void DisplayListbox _ANSI_ARGS_((ClientData clientData));
-static int GetListboxIndex _ANSI_ARGS_((Tcl_Interp *interp,
- Listbox *listPtr, Tcl_Obj *index, int endIsSize,
- int *indexPtr));
-static int ListboxInsertSubCmd _ANSI_ARGS_((Listbox *listPtr,
- int index, int objc, Tcl_Obj *CONST objv[]));
-static void ListboxCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void ListboxComputeGeometry _ANSI_ARGS_((Listbox *listPtr,
- int fontChanged, int maxIsStale, int updateGrid));
-static void ListboxEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int ListboxFetchSelection _ANSI_ARGS_((
- ClientData clientData, int offset, char *buffer,
- int maxBytes));
-static void ListboxLostSelection _ANSI_ARGS_((
- ClientData clientData));
-static void EventuallyRedrawRange _ANSI_ARGS_((Listbox *listPtr,
- int first, int last));
-static void ListboxScanTo _ANSI_ARGS_((Listbox *listPtr,
- int x, int y));
-static int ListboxSelect _ANSI_ARGS_((Listbox *listPtr,
- int first, int last, int select));
-static void ListboxUpdateHScrollbar _ANSI_ARGS_(
- (Listbox *listPtr));
-static void ListboxUpdateVScrollbar _ANSI_ARGS_(
- (Listbox *listPtr));
-static int ListboxWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int ListboxBboxSubCmd _ANSI_ARGS_ ((Tcl_Interp *interp,
- Listbox *listPtr, int index));
-static int ListboxSelectionSubCmd _ANSI_ARGS_ (
- (Tcl_Interp *interp, Listbox *listPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static int ListboxXviewSubCmd _ANSI_ARGS_ ((Tcl_Interp *interp,
- Listbox *listPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static int ListboxYviewSubCmd _ANSI_ARGS_ ((Tcl_Interp *interp,
- Listbox *listPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static ItemAttr * ListboxGetItemAttributes _ANSI_ARGS_ (
- (Tcl_Interp *interp, Listbox *listPtr, int index));
-static void ListboxWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static int NearestListboxElement _ANSI_ARGS_((Listbox *listPtr,
- int y));
-static char * ListboxListVarProc _ANSI_ARGS_ ((ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static void MigrateHashEntries _ANSI_ARGS_ ((Tcl_HashTable *table,
- int first, int last, int offset));
+ Tcl_Obj *const objv[], int index);
+static int ListboxDeleteSubCmd(Listbox *listPtr,
+ int first, int last);
+static void DestroyListbox(char *memPtr);
+static void DestroyListboxOptionTables(ClientData clientData,
+ Tcl_Interp *interp);
+static void DisplayListbox(ClientData clientData);
+static int GetListboxIndex(Tcl_Interp *interp, Listbox *listPtr,
+ Tcl_Obj *index, int endIsSize, int *indexPtr);
+static int ListboxInsertSubCmd(Listbox *listPtr,
+ int index, int objc, Tcl_Obj *const objv[]);
+static void ListboxCmdDeletedProc(ClientData clientData);
+static void ListboxComputeGeometry(Listbox *listPtr,
+ int fontChanged, int maxIsStale, int updateGrid);
+static void ListboxEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static int ListboxFetchSelection(ClientData clientData,
+ int offset, char *buffer, int maxBytes);
+static void ListboxLostSelection(ClientData clientData);
+static void EventuallyRedrawRange(Listbox *listPtr,
+ int first, int last);
+static void ListboxScanTo(Listbox *listPtr, int x, int y);
+static int ListboxSelect(Listbox *listPtr,
+ int first, int last, int select);
+static void ListboxUpdateHScrollbar(Listbox *listPtr);
+static void ListboxUpdateVScrollbar(Listbox *listPtr);
+static int ListboxWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int ListboxBboxSubCmd(Tcl_Interp *interp,
+ Listbox *listPtr, int index);
+static int ListboxSelectionSubCmd(Tcl_Interp *interp,
+ Listbox *listPtr, int objc, Tcl_Obj *const objv[]);
+static int ListboxXviewSubCmd(Tcl_Interp *interp,
+ Listbox *listPtr, int objc, Tcl_Obj *const objv[]);
+static int ListboxYviewSubCmd(Tcl_Interp *interp,
+ Listbox *listPtr, int objc, Tcl_Obj *const objv[]);
+static ItemAttr * ListboxGetItemAttributes(Tcl_Interp *interp,
+ Listbox *listPtr, int index);
+static void ListboxWorldChanged(ClientData instanceData);
+static int NearestListboxElement(Listbox *listPtr, int y);
+static char * ListboxListVarProc(ClientData clientData,
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
+static void MigrateHashEntries(Tcl_HashTable *table,
+ int first, int last, int offset);
+
/*
* The structure below defines button class behavior by means of procedures
* that can be invoked from generic window code.
@@ -452,17 +437,17 @@ static void MigrateHashEntries _ANSI_ARGS_ ((Tcl_HashTable *table,
static Tk_ClassProcs listboxClass = {
sizeof(Tk_ClassProcs), /* size */
ListboxWorldChanged, /* worldChangedProc */
+ NULL, /* createProc */
+ NULL /* modalProc */
};
-
/*
*--------------------------------------------------------------
*
* Tk_ListboxObjCmd --
*
- * This procedure is invoked to process the "listbox" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This procedure is invoked to process the "listbox" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -474,11 +459,11 @@ static Tk_ClassProcs listboxClass = {
*/
int
-Tk_ListboxObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_ListboxObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Listbox *listPtr;
Tk_Window tkwin;
@@ -490,7 +475,7 @@ Tk_ListboxObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -499,56 +484,64 @@ Tk_ListboxObjCmd(clientData, interp, objc, objv)
Tcl_GetAssocData(interp, "ListboxOptionTables", NULL);
if (optionTables == NULL) {
/*
- * We haven't created the option tables for this widget class yet.
- * Do it now and save the a pointer to them as the ClientData for
- * the command, so future invocations will have access to it.
+ * We haven't created the option tables for this widget class yet. Do
+ * it now and save the a pointer to them as the ClientData for the
+ * command, so future invocations will have access to it.
*/
optionTables = (ListboxOptionTables *)
- ckalloc(sizeof(ListboxOptionTables));
- /* Set up an exit handler to free the optionTables struct */
+ ckalloc(sizeof(ListboxOptionTables));
+
+ /*
+ * Set up an exit handler to free the optionTables struct.
+ */
+
Tcl_SetAssocData(interp, "ListboxOptionTables",
DestroyListboxOptionTables, (ClientData) optionTables);
- /* Create the listbox option table and the listbox item option table */
+ /*
+ * Create the listbox option table and the listbox item option table.
+ */
+
optionTables->listboxOptionTable =
- Tk_CreateOptionTable(interp, optionSpecs);
+ Tk_CreateOptionTable(interp, optionSpecs);
optionTables->itemAttrOptionTable =
- Tk_CreateOptionTable(interp, itemAttrOptionSpecs);
+ Tk_CreateOptionTable(interp, itemAttrOptionSpecs);
}
/*
- * Initialize the fields of the structure that won't be initialized
- * by ConfigureListbox, or that ConfigureListbox requires to be
- * initialized already (e.g. resource pointers).
+ * Initialize the fields of the structure that won't be initialized by
+ * ConfigureListbox, or that ConfigureListbox requires to be initialized
+ * already (e.g. resource pointers).
*/
- listPtr = (Listbox *) ckalloc(sizeof(Listbox));
- memset((void *) listPtr, 0, (sizeof(Listbox)));
- listPtr->tkwin = tkwin;
- listPtr->display = Tk_Display(tkwin);
- listPtr->interp = interp;
- listPtr->widgetCmd = Tcl_CreateObjCommand(interp,
+ listPtr = (Listbox *) ckalloc(sizeof(Listbox));
+ memset(listPtr, 0, (sizeof(Listbox)));
+
+ listPtr->tkwin = tkwin;
+ listPtr->display = Tk_Display(tkwin);
+ listPtr->interp = interp;
+ listPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(listPtr->tkwin), ListboxWidgetObjCmd,
(ClientData) listPtr, ListboxCmdDeletedProc);
- listPtr->optionTable = optionTables->listboxOptionTable;
- listPtr->itemAttrOptionTable = optionTables->itemAttrOptionTable;
- listPtr->selection =
- (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
+ listPtr->optionTable = optionTables->listboxOptionTable;
+ listPtr->itemAttrOptionTable = optionTables->itemAttrOptionTable;
+ listPtr->selection = (Tcl_HashTable *)
+ ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(listPtr->selection, TCL_ONE_WORD_KEYS);
- listPtr->itemAttrTable =
- (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
+ listPtr->itemAttrTable = (Tcl_HashTable *)
+ ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS);
- listPtr->relief = TK_RELIEF_RAISED;
- listPtr->textGC = None;
- listPtr->selFgColorPtr = None;
- listPtr->selTextGC = None;
- listPtr->fullLines = 1;
- listPtr->xScrollUnit = 1;
- listPtr->exportSelection = 1;
- listPtr->cursor = None;
- listPtr->state = STATE_NORMAL;
- listPtr->gray = None;
+ listPtr->relief = TK_RELIEF_RAISED;
+ listPtr->textGC = None;
+ listPtr->selFgColorPtr = None;
+ listPtr->selTextGC = None;
+ listPtr->fullLines = 1;
+ listPtr->xScrollUnit = 1;
+ listPtr->exportSelection = 1;
+ listPtr->cursor = None;
+ listPtr->state = STATE_NORMAL;
+ listPtr->gray = None;
/*
* Keep a hold of the associated tkwin until we destroy the listbox,
@@ -585,8 +578,8 @@ Tk_ListboxObjCmd(clientData, interp, objc, objv)
* ListboxWidgetObjCmd --
*
* This Tcl_Obj based procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module. See the user
- * documentation for details on what it does.
+ * that corresponds to a widget managed by this module. See the user
+ * documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -598,25 +591,26 @@ Tk_ListboxObjCmd(clientData, interp, objc, objv)
*/
static int
-ListboxWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about listbox widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Arguments as Tcl_Obj's. */
+ListboxWidgetObjCmd(
+ ClientData clientData, /* Information about listbox widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */
{
register Listbox *listPtr = (Listbox *) clientData;
int cmdIndex, index;
int result = TCL_OK;
-
+
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
/*
- * Parse the command by looking up the second argument in the list
- * of valid subcommand names
+ * Parse the command by looking up the second argument in the list of
+ * valid subcommand names
*/
+
result = Tcl_GetIndexFromObj(interp, objv[1], commandNames,
"option", 0, &cmdIndex);
if (result != TCL_OK) {
@@ -624,448 +618,436 @@ ListboxWidgetObjCmd(clientData, interp, objc, objv)
}
Tcl_Preserve((ClientData)listPtr);
- /* The subcommand was valid, so continue processing */
- switch (cmdIndex) {
- case COMMAND_ACTIVATE: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "index");
- result = TCL_ERROR;
- break;
- }
- result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
- if (result != TCL_OK) {
- break;
- }
- if (!(listPtr->state & STATE_NORMAL)) {
- break;
- }
+ /*
+ * The subcommand was valid, so continue processing.
+ */
- if (index >= listPtr->nElements) {
- index = listPtr->nElements-1;
- }
- if (index < 0) {
- index = 0;
- }
- listPtr->active = index;
- EventuallyRedrawRange(listPtr, listPtr->active, listPtr->active);
- result = TCL_OK;
+ switch (cmdIndex) {
+ case COMMAND_ACTIVATE:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ result = TCL_ERROR;
+ break;
+ }
+ result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
+ if (result != TCL_OK) {
break;
}
- case COMMAND_BBOX: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "index");
- result = TCL_ERROR;
- break;
- }
- result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
- if (result != TCL_OK) {
- break;
- }
-
- result = ListboxBboxSubCmd(interp, listPtr, index);
+ if (!(listPtr->state & STATE_NORMAL)) {
break;
}
- case COMMAND_CGET: {
- Tcl_Obj *objPtr;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
- result = TCL_ERROR;
- break;
- }
+ if (index >= listPtr->nElements) {
+ index = listPtr->nElements-1;
+ }
+ if (index < 0) {
+ index = 0;
+ }
+ listPtr->active = index;
+ EventuallyRedrawRange(listPtr, listPtr->active, listPtr->active);
+ result = TCL_OK;
+ break;
- objPtr = Tk_GetOptionValue(interp, (char *)listPtr,
- listPtr->optionTable, objv[2], listPtr->tkwin);
- if (objPtr == NULL) {
- result = TCL_ERROR;
- break;
- }
- Tcl_SetObjResult(interp, objPtr);
- result = TCL_OK;
+ case COMMAND_BBOX:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ result = TCL_ERROR;
break;
}
-
- case COMMAND_CONFIGURE: {
- Tcl_Obj *objPtr;
- if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) listPtr,
- listPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- listPtr->tkwin);
- if (objPtr == NULL) {
- result = TCL_ERROR;
- break;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- result = TCL_OK;
- }
- } else {
- result = ConfigureListbox(interp, listPtr, objc-2, objv+2, 0);
- }
+ result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
+ if (result != TCL_OK) {
break;
}
- case COMMAND_CURSELECTION: {
- char indexStringRep[TCL_INTEGER_SPACE];
- int i;
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, NULL);
- result = TCL_ERROR;
- break;
- }
- /*
- * Of course, it would be more efficient to use the Tcl_HashTable
- * search functions (Tcl_FirstHashEntry, Tcl_NextHashEntry), but
- * then the result wouldn't be in sorted order. So instead we
- * loop through the indices in order, adding them to the result
- * if they are selected
- */
- for (i = 0; i < listPtr->nElements; i++) {
- if (Tcl_FindHashEntry(listPtr->selection, (char *)i) != NULL) {
- sprintf(indexStringRep, "%d", i);
- Tcl_AppendElement(interp, indexStringRep);
- }
- }
- result = TCL_OK;
+ result = ListboxBboxSubCmd(interp, listPtr, index);
+ break;
+
+ case COMMAND_CGET: {
+ Tcl_Obj *objPtr;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ result = TCL_ERROR;
break;
}
-
- case COMMAND_DELETE: {
- int first, last;
- if ((objc < 3) || (objc > 4)) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "firstIndex ?lastIndex?");
- result = TCL_ERROR;
- break;
- }
- result = GetListboxIndex(interp, listPtr, objv[2], 0, &first);
- if (result != TCL_OK) {
- break;
- }
+ objPtr = Tk_GetOptionValue(interp, (char *) listPtr,
+ listPtr->optionTable, objv[2], listPtr->tkwin);
+ if (objPtr == NULL) {
+ result = TCL_ERROR;
+ break;
+ }
+ Tcl_SetObjResult(interp, objPtr);
+ result = TCL_OK;
+ break;
+ }
- if (!(listPtr->state & STATE_NORMAL)) {
- break;
- }
+ case COMMAND_CONFIGURE: {
+ Tcl_Obj *objPtr;
- if (first < listPtr->nElements) {
- /*
- * if a "last index" was given, get it now; otherwise, use the
- * first index as the last index
- */
- if (objc == 4) {
- result = GetListboxIndex(interp, listPtr,
- objv[3], 0, &last);
- if (result != TCL_OK) {
- break;
- }
- } else {
- last = first;
- }
- if (last >= listPtr->nElements) {
- last = listPtr->nElements - 1;
- }
- result = ListboxDeleteSubCmd(listPtr, first, last);
+ if (objc <= 3) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) listPtr,
+ listPtr->optionTable,
+ (objc == 3) ? objv[2] : NULL, listPtr->tkwin);
+ if (objPtr == NULL) {
+ result = TCL_ERROR;
+ break;
} else {
+ Tcl_SetObjResult(interp, objPtr);
result = TCL_OK;
}
+ } else {
+ result = ConfigureListbox(interp, listPtr, objc-2, objv+2, 0);
+ }
+ break;
+ }
+
+ case COMMAND_CURSELECTION: {
+ char indexStringRep[TCL_INTEGER_SPACE];
+ int i;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ result = TCL_ERROR;
break;
}
- case COMMAND_GET: {
- int first, last;
- Tcl_Obj **elemPtrs;
- int listLen;
- if (objc != 3 && objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
- result = TCL_ERROR;
- break;
- }
- result = GetListboxIndex(interp, listPtr, objv[2], 0, &first);
- if (result != TCL_OK) {
- break;
+ /*
+ * Of course, it would be more efficient to use the Tcl_HashTable
+ * search functions (Tcl_FirstHashEntry, Tcl_NextHashEntry), but then
+ * the result wouldn't be in sorted order. So instead we loop through
+ * the indices in order, adding them to the result if they are
+ * selected.
+ */
+
+ for (i = 0; i < listPtr->nElements; i++) {
+ if (Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i))) {
+ sprintf(indexStringRep, "%d", i);
+ Tcl_AppendElement(interp, indexStringRep);
}
- last = first;
+ }
+ result = TCL_OK;
+ break;
+ }
+
+ case COMMAND_DELETE: {
+ int first, last;
+
+ if ((objc < 3) || (objc > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
+ result = TCL_ERROR;
+ break;
+ }
+
+ result = GetListboxIndex(interp, listPtr, objv[2], 0, &first);
+ if (result != TCL_OK) {
+ break;
+ }
+
+ if (!(listPtr->state & STATE_NORMAL)) {
+ break;
+ }
+
+ if (first < listPtr->nElements) {
+ /*
+ * if a "last index" was given, get it now; otherwise, use the
+ * first index as the last index.
+ */
+
if (objc == 4) {
result = GetListboxIndex(interp, listPtr, objv[3], 0, &last);
if (result != TCL_OK) {
break;
}
- }
- if (first >= listPtr->nElements) {
- result = TCL_OK;
- break;
+ } else {
+ last = first;
}
if (last >= listPtr->nElements) {
last = listPtr->nElements - 1;
}
- if (first < 0) {
- first = 0;
- }
- if (first > last) {
- result = TCL_OK;
- break;
- }
- result = Tcl_ListObjGetElements(interp, listPtr->listObj, &listLen,
- &elemPtrs);
- if (result != TCL_OK) {
- break;
- }
- if (objc == 3) {
- /*
- * One element request - we return a string
- */
- Tcl_SetObjResult(interp, elemPtrs[first]);
- } else {
- Tcl_SetListObj(Tcl_GetObjResult(interp), (last - first + 1),
- &(elemPtrs[first]));
- }
+ result = ListboxDeleteSubCmd(listPtr, first, last);
+ } else {
result = TCL_OK;
- break;
}
+ break;
+ }
- case COMMAND_INDEX:{
- char buf[TCL_INTEGER_SPACE];
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "index");
- result = TCL_ERROR;
- break;
- }
- result = GetListboxIndex(interp, listPtr, objv[2], 1, &index);
+ case COMMAND_GET: {
+ int first, last, listLen;
+ Tcl_Obj **elemPtrs;
+
+ if (objc != 3 && objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
+ result = TCL_ERROR;
+ break;
+ }
+ result = GetListboxIndex(interp, listPtr, objv[2], 0, &first);
+ if (result != TCL_OK) {
+ break;
+ }
+ last = first;
+ if (objc == 4) {
+ result = GetListboxIndex(interp, listPtr, objv[3], 0, &last);
if (result != TCL_OK) {
break;
}
- sprintf(buf, "%d", index);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ }
+ if (first >= listPtr->nElements) {
+ result = TCL_OK;
+ break;
+ }
+ if (last >= listPtr->nElements) {
+ last = listPtr->nElements - 1;
+ }
+ if (first < 0) {
+ first = 0;
+ }
+ if (first > last) {
result = TCL_OK;
break;
}
+ result = Tcl_ListObjGetElements(interp, listPtr->listObj, &listLen,
+ &elemPtrs);
+ if (result != TCL_OK) {
+ break;
+ }
+ if (objc == 3) {
+ /*
+ * One element request - we return a string
+ */
- case COMMAND_INSERT: {
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "index ?element element ...?");
- result = TCL_ERROR;
- break;
- }
+ Tcl_SetObjResult(interp, elemPtrs[first]);
+ } else {
+ Tcl_SetListObj(Tcl_GetObjResult(interp), (last - first + 1),
+ &(elemPtrs[first]));
+ }
+ result = TCL_OK;
+ break;
+ }
- result = GetListboxIndex(interp, listPtr, objv[2], 1, &index);
- if (result != TCL_OK) {
- break;
- }
+ case COMMAND_INDEX:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ result = TCL_ERROR;
+ break;
+ }
+ result = GetListboxIndex(interp, listPtr, objv[2], 1, &index);
+ if (result != TCL_OK) {
+ break;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ result = TCL_OK;
+ break;
- if (!(listPtr->state & STATE_NORMAL)) {
- break;
- }
+ case COMMAND_INSERT:
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index ?element element ...?");
+ result = TCL_ERROR;
+ break;
+ }
- result = ListboxInsertSubCmd(listPtr, index, objc-3, objv+3);
+ result = GetListboxIndex(interp, listPtr, objv[2], 1, &index);
+ if (result != TCL_OK) {
break;
}
- case COMMAND_ITEMCGET: {
- Tcl_Obj *objPtr;
- ItemAttr *attrPtr;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "index option");
- result = TCL_ERROR;
- break;
- }
+ if (!(listPtr->state & STATE_NORMAL)) {
+ break;
+ }
- result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
- if (result != TCL_OK) {
- break;
- }
+ result = ListboxInsertSubCmd(listPtr, index, objc-3, objv+3);
+ break;
- if (index < 0 || index >= listPtr->nElements) {
- Tcl_AppendResult(interp, "item number \"",
- Tcl_GetString(objv[2]), "\" out of range",
- (char *)NULL);
- result = TCL_ERROR;
- break;
- }
-
- attrPtr = ListboxGetItemAttributes(interp, listPtr, index);
+ case COMMAND_ITEMCGET: {
+ Tcl_Obj *objPtr;
+ ItemAttr *attrPtr;
- objPtr = Tk_GetOptionValue(interp, (char *)attrPtr,
- listPtr->itemAttrOptionTable, objv[3], listPtr->tkwin);
- if (objPtr == NULL) {
- result = TCL_ERROR;
- break;
- }
- Tcl_SetObjResult(interp, objPtr);
- result = TCL_OK;
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index option");
+ result = TCL_ERROR;
break;
}
- case COMMAND_ITEMCONFIGURE: {
- Tcl_Obj *objPtr;
- ItemAttr *attrPtr;
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "index ?option? ?value? ?option value ...?");
- result = TCL_ERROR;
- break;
- }
+ result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
+ if (result != TCL_OK) {
+ break;
+ }
- result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
- if (result != TCL_OK) {
- break;
- }
-
- if (index < 0 || index >= listPtr->nElements) {
- Tcl_AppendResult(interp, "item number \"",
- Tcl_GetString(objv[2]), "\" out of range",
- (char *)NULL);
- result = TCL_ERROR;
- break;
- }
-
- attrPtr = ListboxGetItemAttributes(interp, listPtr, index);
- if (objc <= 4) {
- objPtr = Tk_GetOptionInfo(interp, (char *)attrPtr,
- listPtr->itemAttrOptionTable,
- (objc == 4) ? objv[3] : (Tcl_Obj *) NULL,
- listPtr->tkwin);
- if (objPtr == NULL) {
- result = TCL_ERROR;
- break;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- result = TCL_OK;
- }
- } else {
- result = ConfigureListboxItem(interp, listPtr, attrPtr,
- objc-3, objv+3, index);
- }
+ if (index < 0 || index >= listPtr->nElements) {
+ Tcl_AppendResult(interp, "item number \"",
+ Tcl_GetString(objv[2]), "\" out of range", NULL);
+ result = TCL_ERROR;
break;
}
-
- case COMMAND_NEAREST: {
- char buf[TCL_INTEGER_SPACE];
- int y;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "y");
- result = TCL_ERROR;
- break;
- }
-
- result = Tcl_GetIntFromObj(interp, objv[2], &y);
- if (result != TCL_OK) {
- break;
- }
- index = NearestListboxElement(listPtr, y);
- sprintf(buf, "%d", index);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- result = TCL_OK;
+
+ attrPtr = ListboxGetItemAttributes(interp, listPtr, index);
+
+ objPtr = Tk_GetOptionValue(interp, (char *) attrPtr,
+ listPtr->itemAttrOptionTable, objv[3], listPtr->tkwin);
+ if (objPtr == NULL) {
+ result = TCL_ERROR;
break;
}
-
- case COMMAND_SCAN: {
- int x, y, scanCmdIndex;
+ Tcl_SetObjResult(interp, objPtr);
+ result = TCL_OK;
+ break;
+ }
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y");
- result = TCL_ERROR;
- break;
- }
+ case COMMAND_ITEMCONFIGURE: {
+ Tcl_Obj *objPtr;
+ ItemAttr *attrPtr;
- if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK
- || Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) {
- result = TCL_ERROR;
- break;
- }
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "index ?option? ?value? ?option value ...?");
+ result = TCL_ERROR;
+ break;
+ }
- result = Tcl_GetIndexFromObj(interp, objv[2], scanCommandNames,
- "option", 0, &scanCmdIndex);
- if (result != TCL_OK) {
- break;
- }
- switch (scanCmdIndex) {
- case SCAN_MARK: {
- listPtr->scanMarkX = x;
- listPtr->scanMarkY = y;
- listPtr->scanMarkXOffset = listPtr->xOffset;
- listPtr->scanMarkYIndex = listPtr->topIndex;
- break;
- }
- case SCAN_DRAGTO: {
- ListboxScanTo(listPtr, x, y);
- break;
- }
- }
- result = TCL_OK;
+ result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
+ if (result != TCL_OK) {
+ break;
+ }
+
+ if (index < 0 || index >= listPtr->nElements) {
+ Tcl_AppendResult(interp, "item number \"", Tcl_GetString(objv[2]),
+ "\" out of range", NULL);
+ result = TCL_ERROR;
break;
}
- case COMMAND_SEE: {
- int diff;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "index");
+ attrPtr = ListboxGetItemAttributes(interp, listPtr, index);
+ if (objc <= 4) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) attrPtr,
+ listPtr->itemAttrOptionTable,
+ (objc == 4) ? objv[3] : NULL, listPtr->tkwin);
+ if (objPtr == NULL) {
result = TCL_ERROR;
break;
- }
- result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
- if (result != TCL_OK) {
- break;
- }
- if (index >= listPtr->nElements) {
- index = listPtr->nElements - 1;
- }
- if (index < 0) {
- index = 0;
- }
- diff = listPtr->topIndex - index;
- if (diff > 0) {
- if (diff <= (listPtr->fullLines/3)) {
- ChangeListboxView(listPtr, index);
- } else {
- ChangeListboxView(listPtr,
- index - (listPtr->fullLines-1)/2);
- }
} else {
- diff = index - (listPtr->topIndex + listPtr->fullLines - 1);
- if (diff > 0) {
- if (diff <= (listPtr->fullLines/3)) {
- ChangeListboxView(listPtr, listPtr->topIndex + diff);
- } else {
- ChangeListboxView(listPtr,
- index - (listPtr->fullLines-1)/2);
- }
- }
+ Tcl_SetObjResult(interp, objPtr);
+ result = TCL_OK;
}
- result = TCL_OK;
+ } else {
+ result = ConfigureListboxItem(interp, listPtr, attrPtr,
+ objc-3, objv+3, index);
+ }
+ break;
+ }
+
+ case COMMAND_NEAREST: {
+ int y;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "y");
+ result = TCL_ERROR;
break;
}
- case COMMAND_SELECTION: {
- result = ListboxSelectionSubCmd(interp, listPtr, objc, objv);
+ result = Tcl_GetIntFromObj(interp, objv[2], &y);
+ if (result != TCL_OK) {
break;
}
+ index = NearestListboxElement(listPtr, y);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ result = TCL_OK;
+ break;
+ }
- case COMMAND_SIZE: {
- char buf[TCL_INTEGER_SPACE];
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, NULL);
- result = TCL_ERROR;
- break;
- }
- sprintf(buf, "%d", listPtr->nElements);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- result = TCL_OK;
+ case COMMAND_SCAN: {
+ int x, y, scanCmdIndex;
+
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y");
+ result = TCL_ERROR;
+ break;
+ }
+
+ if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) {
+ result = TCL_ERROR;
+ break;
+ }
+
+ result = Tcl_GetIndexFromObj(interp, objv[2], scanCommandNames,
+ "option", 0, &scanCmdIndex);
+ if (result != TCL_OK) {
break;
}
+ switch (scanCmdIndex) {
+ case SCAN_MARK:
+ listPtr->scanMarkX = x;
+ listPtr->scanMarkY = y;
+ listPtr->scanMarkXOffset = listPtr->xOffset;
+ listPtr->scanMarkYIndex = listPtr->topIndex;
+ break;
+ case SCAN_DRAGTO:
+ ListboxScanTo(listPtr, x, y);
+ break;
+ }
+ result = TCL_OK;
+ break;
+ }
- case COMMAND_XVIEW: {
- result = ListboxXviewSubCmd(interp, listPtr, objc, objv);
+ case COMMAND_SEE: {
+ int diff;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ result = TCL_ERROR;
+ break;
+ }
+ result = GetListboxIndex(interp, listPtr, objv[2], 0, &index);
+ if (result != TCL_OK) {
break;
}
-
- case COMMAND_YVIEW: {
- result = ListboxYviewSubCmd(interp, listPtr, objc, objv);
+ if (index >= listPtr->nElements) {
+ index = listPtr->nElements - 1;
+ }
+ if (index < 0) {
+ index = 0;
+ }
+ diff = listPtr->topIndex - index;
+ if (diff > 0) {
+ if (diff <= (listPtr->fullLines/3)) {
+ ChangeListboxView(listPtr, index);
+ } else {
+ ChangeListboxView(listPtr, index - (listPtr->fullLines-1)/2);
+ }
+ } else {
+ diff = index - (listPtr->topIndex + listPtr->fullLines - 1);
+ if (diff > 0) {
+ if (diff <= (listPtr->fullLines/3)) {
+ ChangeListboxView(listPtr, listPtr->topIndex + diff);
+ } else {
+ ChangeListboxView(listPtr, index-(listPtr->fullLines-1)/2);
+ }
+ }
+ }
+ result = TCL_OK;
+ break;
+ }
+
+ case COMMAND_SELECTION:
+ result = ListboxSelectionSubCmd(interp, listPtr, objc, objv);
+ break;
+ case COMMAND_SIZE:
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ result = TCL_ERROR;
break;
}
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(listPtr->nElements));
+ result = TCL_OK;
+ break;
+ case COMMAND_XVIEW:
+ result = ListboxXviewSubCmd(interp, listPtr, objc, objv);
+ break;
+ case COMMAND_YVIEW:
+ result = ListboxYviewSubCmd(interp, listPtr, objc, objv);
+ break;
}
Tcl_Release((ClientData)listPtr);
return result;
@@ -1076,34 +1058,41 @@ ListboxWidgetObjCmd(clientData, interp, objc, objv)
*
* ListboxBboxSubCmd --
*
- * This procedure is invoked to process a listbox bbox request.
- * See the user documentation for more information.
+ * This procedure is invoked to process a listbox bbox request. See the
+ * user documentation for more information.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * For valid indices, places the bbox of the requested element in
- * the interpreter's result.
+ * For valid indices, places the bbox of the requested element in the
+ * interpreter's result.
*
*----------------------------------------------------------------------
*/
static int
-ListboxBboxSubCmd(interp, listPtr, index)
- Tcl_Interp *interp; /* Pointer to the calling Tcl interpreter */
- Listbox *listPtr; /* Information about the listbox */
- int index; /* Index of the element to get bbox info on */
+ListboxBboxSubCmd(
+ Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */
+ Listbox *listPtr, /* Information about the listbox */
+ int index) /* Index of the element to get bbox info on */
{
int lastVisibleIndex;
- /* Determine the index of the last visible item in the listbox */
+
+ /*
+ * Determine the index of the last visible item in the listbox.
+ */
+
lastVisibleIndex = listPtr->topIndex + listPtr->fullLines
- + listPtr->partialLine;
+ + listPtr->partialLine;
if (listPtr->nElements < lastVisibleIndex) {
lastVisibleIndex = listPtr->nElements;
}
- /* Only allow bbox requests for indices that are visible */
+ /*
+ * Only allow bbox requests for indices that are visible.
+ */
+
if ((listPtr->topIndex <= index) && (index < lastVisibleIndex)) {
char buf[TCL_INTEGER_SPACE * 4];
Tcl_Obj *el;
@@ -1111,7 +1100,10 @@ ListboxBboxSubCmd(interp, listPtr, index)
int pixelWidth, stringLen, x, y, result;
Tk_FontMetrics fm;
- /* Compute the pixel width of the requested element */
+ /*
+ * Compute the pixel width of the requested element.
+ */
+
result = Tcl_ListObjIndex(interp, listPtr->listObj, index, &el);
if (result != TCL_OK) {
return result;
@@ -1123,7 +1115,7 @@ ListboxBboxSubCmd(interp, listPtr, index)
x = listPtr->inset + listPtr->selBorderWidth - listPtr->xOffset;
y = ((index - listPtr->topIndex)*listPtr->lineHeight)
- + listPtr->inset + listPtr->selBorderWidth;
+ + listPtr->inset + listPtr->selBorderWidth;
sprintf(buf, "%d %d %d %d", x, y, pixelWidth, fm.linespace);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
@@ -1135,8 +1127,8 @@ ListboxBboxSubCmd(interp, listPtr, index)
*
* ListboxSelectionSubCmd --
*
- * This procedure is invoked to process the selection sub command
- * for listbox widgets.
+ * This procedure is invoked to process the selection sub command for
+ * listbox widgets.
*
* Results:
* Standard Tcl result.
@@ -1148,14 +1140,15 @@ ListboxBboxSubCmd(interp, listPtr, index)
*/
static int
-ListboxSelectionSubCmd(interp, listPtr, objc, objv)
- Tcl_Interp *interp; /* Pointer to the calling Tcl interpreter */
- Listbox *listPtr; /* Information about the listbox */
- int objc; /* Number of arguments in the objv array */
- Tcl_Obj *CONST objv[]; /* Array of arguments to the procedure */
+ListboxSelectionSubCmd(
+ Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */
+ Listbox *listPtr, /* Information about the listbox */
+ int objc, /* Number of arguments in the objv array */
+ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */
{
int selCmdIndex, first, last;
int result = TCL_OK;
+
if (objc != 4 && objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "option index ?index?");
return TCL_ERROR;
@@ -1187,40 +1180,36 @@ ListboxSelectionSubCmd(interp, listPtr, objc, objv)
}
switch (selCmdIndex) {
- case SELECTION_ANCHOR: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- return TCL_ERROR;
- }
- if (first >= listPtr->nElements) {
- first = listPtr->nElements - 1;
- }
- if (first < 0) {
- first = 0;
- }
- listPtr->selectAnchor = first;
- result = TCL_OK;
- break;
+ case SELECTION_ANCHOR:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
+ return TCL_ERROR;
}
- case SELECTION_CLEAR: {
- result = ListboxSelect(listPtr, first, last, 0);
- break;
+ if (first >= listPtr->nElements) {
+ first = listPtr->nElements - 1;
}
- case SELECTION_INCLUDES: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- return TCL_ERROR;
- }
- Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj((Tcl_FindHashEntry(listPtr->selection,
- (char *)first) != NULL)));
- result = TCL_OK;
- break;
+ if (first < 0) {
+ first = 0;
}
- case SELECTION_SET: {
- result = ListboxSelect(listPtr, first, last, 1);
- break;
+ listPtr->selectAnchor = first;
+ result = TCL_OK;
+ break;
+ case SELECTION_CLEAR:
+ result = ListboxSelect(listPtr, first, last, 0);
+ break;
+ case SELECTION_INCLUDES:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
+ return TCL_ERROR;
}
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj((Tcl_FindHashEntry(listPtr->selection,
+ (char *) INT2PTR(first)) != NULL)));
+ result = TCL_OK;
+ break;
+ case SELECTION_SET:
+ result = ListboxSelect(listPtr, first, last, 1);
+ break;
}
return result;
}
@@ -1242,33 +1231,35 @@ ListboxSelectionSubCmd(interp, listPtr, objc, objv)
*/
static int
-ListboxXviewSubCmd(interp, listPtr, objc, objv)
- Tcl_Interp *interp; /* Pointer to the calling Tcl interpreter */
- Listbox *listPtr; /* Information about the listbox */
- int objc; /* Number of arguments in the objv array */
- Tcl_Obj *CONST objv[]; /* Array of arguments to the procedure */
+ListboxXviewSubCmd(
+ Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */
+ Listbox *listPtr, /* Information about the listbox */
+ int objc, /* Number of arguments in the objv array */
+ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */
{
int index, count, type, windowWidth, windowUnits;
int offset = 0; /* Initialized to stop gcc warnings. */
double fraction, fraction2;
-
+
windowWidth = Tk_Width(listPtr->tkwin)
- - 2*(listPtr->inset + listPtr->selBorderWidth);
+ - 2*(listPtr->inset + listPtr->selBorderWidth);
if (objc == 2) {
if (listPtr->maxWidth == 0) {
- Tcl_SetResult(interp, "0 1", TCL_STATIC);
+ Tcl_SetResult(interp, "0.0 1.0", TCL_STATIC);
} else {
- char buf[TCL_DOUBLE_SPACE * 2];
-
+ char buf[TCL_DOUBLE_SPACE];
+
fraction = listPtr->xOffset/((double) listPtr->maxWidth);
fraction2 = (listPtr->xOffset + windowWidth)
- /((double) listPtr->maxWidth);
+ / ((double) listPtr->maxWidth);
if (fraction2 > 1.0) {
fraction2 = 1.0;
}
- sprintf(buf, "%g %g", fraction, fraction2);
+ Tcl_PrintDouble(NULL, fraction, buf);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_PrintDouble(NULL, fraction2, buf);
+ Tcl_AppendResult(interp, " ", buf, NULL);
}
} else if (objc == 3) {
if (Tcl_GetIntFromObj(interp, objv[2], &index) != TCL_OK) {
@@ -1278,23 +1269,23 @@ ListboxXviewSubCmd(interp, listPtr, objc, objv)
} else {
type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count);
switch (type) {
- case TK_SCROLL_ERROR:
- return TCL_ERROR;
- case TK_SCROLL_MOVETO:
- offset = (int) (fraction*listPtr->maxWidth + 0.5);
- break;
- case TK_SCROLL_PAGES:
- windowUnits = windowWidth/listPtr->xScrollUnit;
- if (windowUnits > 2) {
- offset = listPtr->xOffset
+ case TK_SCROLL_ERROR:
+ return TCL_ERROR;
+ case TK_SCROLL_MOVETO:
+ offset = (int) (fraction*listPtr->maxWidth + 0.5);
+ break;
+ case TK_SCROLL_PAGES:
+ windowUnits = windowWidth/listPtr->xScrollUnit;
+ if (windowUnits > 2) {
+ offset = listPtr->xOffset
+ count*listPtr->xScrollUnit*(windowUnits-2);
- } else {
- offset = listPtr->xOffset + count*listPtr->xScrollUnit;
- }
- break;
- case TK_SCROLL_UNITS:
+ } else {
offset = listPtr->xOffset + count*listPtr->xScrollUnit;
- break;
+ }
+ break;
+ case TK_SCROLL_UNITS:
+ offset = listPtr->xOffset + count*listPtr->xScrollUnit;
+ break;
}
ChangeListboxOffset(listPtr, offset);
}
@@ -1318,29 +1309,31 @@ ListboxXviewSubCmd(interp, listPtr, objc, objv)
*/
static int
-ListboxYviewSubCmd(interp, listPtr, objc, objv)
- Tcl_Interp *interp; /* Pointer to the calling Tcl interpreter */
- Listbox *listPtr; /* Information about the listbox */
- int objc; /* Number of arguments in the objv array */
- Tcl_Obj *CONST objv[]; /* Array of arguments to the procedure */
+ListboxYviewSubCmd(
+ Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */
+ Listbox *listPtr, /* Information about the listbox */
+ int objc, /* Number of arguments in the objv array */
+ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */
{
int index, count, type;
double fraction, fraction2;
-
+
if (objc == 2) {
if (listPtr->nElements == 0) {
- Tcl_SetResult(interp, "0 1", TCL_STATIC);
+ Tcl_SetResult(interp, "0.0 1.0", TCL_STATIC);
} else {
- char buf[TCL_DOUBLE_SPACE * 2];
-
+ char buf[TCL_DOUBLE_SPACE];
+
fraction = listPtr->topIndex/((double) listPtr->nElements);
fraction2 = (listPtr->topIndex+listPtr->fullLines)
- /((double) listPtr->nElements);
+ /((double) listPtr->nElements);
if (fraction2 > 1.0) {
fraction2 = 1.0;
}
- sprintf(buf, "%g %g", fraction, fraction2);
+ Tcl_PrintDouble(NULL, fraction, buf);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_PrintDouble(NULL, fraction2, buf);
+ Tcl_AppendResult(interp, " ", buf, NULL);
}
} else if (objc == 3) {
if (GetListboxIndex(interp, listPtr, objv[2], 0, &index) != TCL_OK) {
@@ -1350,22 +1343,22 @@ ListboxYviewSubCmd(interp, listPtr, objc, objv)
} else {
type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count);
switch (type) {
- case TK_SCROLL_ERROR:
- return TCL_ERROR;
- case TK_SCROLL_MOVETO:
- index = (int) (listPtr->nElements*fraction + 0.5);
- break;
- case TK_SCROLL_PAGES:
- if (listPtr->fullLines > 2) {
- index = listPtr->topIndex
- + count*(listPtr->fullLines-2);
- } else {
- index = listPtr->topIndex + count;
- }
- break;
- case TK_SCROLL_UNITS:
+ case TK_SCROLL_MOVETO:
+ index = (int) (listPtr->nElements*fraction + 0.5);
+ break;
+ case TK_SCROLL_PAGES:
+ if (listPtr->fullLines > 2) {
+ index = listPtr->topIndex + count*(listPtr->fullLines-2);
+ } else {
index = listPtr->topIndex + count;
- break;
+ }
+ break;
+ case TK_SCROLL_UNITS:
+ index = listPtr->topIndex + count;
+ break;
+ case TK_SCROLL_ERROR:
+ default:
+ return TCL_ERROR;
}
ChangeListboxView(listPtr, index);
}
@@ -1377,8 +1370,8 @@ ListboxYviewSubCmd(interp, listPtr, objc, objv)
*
* ListboxGetItemAttributes --
*
- * Returns a pointer to the ItemAttr record for a given index,
- * creating one if it does not already exist.
+ * Returns a pointer to the ItemAttr record for a given index, creating
+ * one if it does not already exist.
*
* Results:
* Pointer to an ItemAttr record.
@@ -1390,18 +1383,19 @@ ListboxYviewSubCmd(interp, listPtr, objc, objv)
*/
static ItemAttr *
-ListboxGetItemAttributes(interp, listPtr, index)
- Tcl_Interp *interp; /* Pointer to the calling Tcl interpreter */
- Listbox *listPtr; /* Information about the listbox */
- int index; /* Index of the item to retrieve attributes
- * for */
+ListboxGetItemAttributes(
+ Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */
+ Listbox *listPtr, /* Information about the listbox */
+ int index) /* Index of the item to retrieve attributes
+ * for. */
{
- int new;
+ int isNew;
Tcl_HashEntry *entry;
ItemAttr *attrs;
- entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, (char *)index, &new);
- if (new) {
+ entry = Tcl_CreateHashEntry(listPtr->itemAttrTable,
+ (char *) INT2PTR(index), &isNew);
+ if (isNew) {
attrs = (ItemAttr *) ckalloc(sizeof(ItemAttr));
attrs->border = NULL;
attrs->selBorder = NULL;
@@ -1420,9 +1414,9 @@ ListboxGetItemAttributes(interp, listPtr, index)
*
* DestroyListbox --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a listbox at a safe time
- * (when no-one is using it anymore).
+ * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
+ * clean up the internal structure of a listbox at a safe time (when
+ * no-one is using it anymore).
*
* Results:
* None.
@@ -1434,14 +1428,17 @@ ListboxGetItemAttributes(interp, listPtr, index)
*/
static void
-DestroyListbox(memPtr)
- char *memPtr; /* Info about listbox widget. */
+DestroyListbox(
+ char *memPtr) /* Info about listbox widget. */
{
register Listbox *listPtr = (Listbox *) memPtr;
Tcl_HashEntry *entry;
Tcl_HashSearch search;
- /* If we have an internal list object, free it */
+ /*
+ * If we have an internal list object, free it.
+ */
+
if (listPtr->listObj != NULL) {
Tcl_DecrRefCount(listPtr->listObj);
listPtr->listObj = NULL;
@@ -1452,23 +1449,28 @@ DestroyListbox(memPtr)
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ListboxListVarProc, (ClientData) listPtr);
}
-
- /* Free the selection hash table */
+
+ /*
+ * Free the selection hash table.
+ */
+
Tcl_DeleteHashTable(listPtr->selection);
ckfree((char *)listPtr->selection);
- /* Free the item attribute hash table */
+ /*
+ * Free the item attribute hash table.
+ */
+
for (entry = Tcl_FirstHashEntry(listPtr->itemAttrTable, &search);
- entry != NULL; entry = Tcl_NextHashEntry(&search)) {
+ entry != NULL; entry = Tcl_NextHashEntry(&search)) {
ckfree((char *)Tcl_GetHashValue(entry));
}
Tcl_DeleteHashTable(listPtr->itemAttrTable);
ckfree((char *)listPtr->itemAttrTable);
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeOptions handle all the standard option-related stuff.
*/
if (listPtr->textGC != None) {
@@ -1494,7 +1496,7 @@ DestroyListbox(memPtr)
* DestroyListboxOptionTables --
*
* This procedure is registered as an exit callback when the listbox
- * command is first called. It cleans up the OptionTables structure
+ * command is first called. It cleans up the OptionTables structure
* allocated by that command.
*
* Results:
@@ -1507,11 +1509,11 @@ DestroyListbox(memPtr)
*/
static void
-DestroyListboxOptionTables(clientData, interp)
- ClientData clientData; /* Pointer to the OptionTables struct */
- Tcl_Interp *interp; /* Pointer to the calling interp */
+DestroyListboxOptionTables(
+ ClientData clientData, /* Pointer to the OptionTables struct */
+ Tcl_Interp *interp) /* Pointer to the calling interp */
{
- ckfree((char *)clientData);
+ ckfree((char *) clientData);
return;
}
@@ -1520,30 +1522,29 @@ DestroyListboxOptionTables(clientData, interp)
*
* ConfigureListbox --
*
- * This procedure is called to process an objv/objc list, plus
- * the Tk option database, in order to configure (or reconfigure)
- * a listbox widget.
+ * This procedure is called to process an objv/objc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a listbox
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for listPtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for listPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureListbox(interp, listPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- register Listbox *listPtr; /* Information about widget; may or may
- * not already have values for some fields. */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureListbox(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register Listbox *listPtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *const objv[], /* Arguments. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
Tk_SavedOptions savedOptions;
Tcl_Obj *oldListObj = NULL;
@@ -1565,7 +1566,7 @@ ConfigureListbox(interp, listPtr, objc, objv, flags)
if (Tk_SetOptions(interp, (char *) listPtr,
listPtr->optionTable, objc, objv,
- listPtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) {
+ listPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
}
} else {
@@ -1601,29 +1602,32 @@ ConfigureListbox(interp, listPtr, objc, objv, flags)
(ClientData) listPtr);
}
- /* Verify the current status of the list var.
+ /*
+ * Verify the current status of the list var.
* PREVIOUS STATE | NEW STATE | ACTION
* ---------------+------------+----------------------------------
- * no listvar | listvar | If listvar does not exist, create
- * it and copy the internal list obj's
- * content to the new var. If it does
- * exist, toss the internal list obj.
+ * no listvar | listvar | If listvar does not exist, create it
+ * and copy the internal list obj's
+ * content to the new var. If it does
+ * exist, toss the internal list obj.
*
- * listvar | no listvar | Copy old listvar content to the
- * internal list obj
+ * listvar | no listvar | Copy old listvar content to the
+ * internal list obj
*
- * listvar | listvar | no special action
+ * listvar | listvar | no special action
*
* no listvar | no listvar | no special action
*/
+
oldListObj = listPtr->listObj;
if (listPtr->listVarName != NULL) {
Tcl_Obj *listVarObj = Tcl_GetVar2Ex(interp, listPtr->listVarName,
- (char *) NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
int dummy;
+
if (listVarObj == NULL) {
listVarObj = (oldListObj ? oldListObj : Tcl_NewObj());
- if (Tcl_SetVar2Ex(interp, listPtr->listVarName, (char *) NULL,
+ if (Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL,
listVarObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
== NULL) {
if (oldListObj == NULL) {
@@ -1632,11 +1636,15 @@ ConfigureListbox(interp, listPtr, objc, objv, flags)
continue;
}
}
- /* Make sure the object is a good list object */
+
+ /*
+ * Make sure the object is a good list object.
+ */
+
if (Tcl_ListObjLength(listPtr->interp, listVarObj, &dummy)
!= TCL_OK) {
Tcl_AppendResult(listPtr->interp,
- ": invalid -listvariable value", (char *) NULL);
+ ": invalid -listvariable value", NULL);
continue;
}
@@ -1657,11 +1665,14 @@ ConfigureListbox(interp, listPtr, objc, objv, flags)
Tk_FreeSavedOptions(&savedOptions);
}
- /* Make sure that the list length is correct */
+ /*
+ * Make sure that the list length is correct.
+ */
+
Tcl_ListObjLength(listPtr->interp, listPtr->listObj, &listPtr->nElements);
-
+
if (error) {
- Tcl_SetObjResult(interp, errorResult);
+ Tcl_SetObjResult(interp, errorResult);
Tcl_DecrRefCount(errorResult);
return TCL_ERROR;
} else {
@@ -1675,45 +1686,46 @@ ConfigureListbox(interp, listPtr, objc, objv, flags)
*
* ConfigureListboxItem --
*
- * This procedure is called to process an objv/objc list, plus
- * the Tk option database, in order to configure (or reconfigure)
- * a listbox item.
+ * This procedure is called to process an objv/objc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a listbox
+ * item.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for a listbox item; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for a listbox item; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureListboxItem(interp, listPtr, attrs, objc, objv, index)
- Tcl_Interp *interp; /* Used for error reporting. */
- register Listbox *listPtr; /* Information about widget; may or may
- * not already have values for some fields. */
- ItemAttr *attrs; /* Information about the item to configure */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
- int index; /* Index of the listbox item being configure */
+ConfigureListboxItem(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register Listbox *listPtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ ItemAttr *attrs, /* Information about the item to configure */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *const objv[], /* Arguments. */
+ int index) /* Index of the listbox item being configure */
{
Tk_SavedOptions savedOptions;
if (Tk_SetOptions(interp, (char *)attrs,
listPtr->itemAttrOptionTable, objc, objv, listPtr->tkwin,
- &savedOptions, (int *)NULL) != TCL_OK) {
+ &savedOptions, NULL) != TCL_OK) {
Tk_RestoreSavedOptions(&savedOptions);
return TCL_ERROR;
}
Tk_FreeSavedOptions(&savedOptions);
+
/*
- * Redraw this index - ListboxWorldChanged would need to be called
- * if item attributes were checked in the "world".
+ * Redraw this index - ListboxWorldChanged would need to be called if item
+ * attributes were checked in the "world".
*/
+
EventuallyRedrawRange(listPtr, index, index);
return TCL_OK;
}
@@ -1723,50 +1735,46 @@ ConfigureListboxItem(interp, listPtr, attrs, objc, objv, index)
*
* ListboxWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This procedure is called when the world has changed in some way and
+ * the widget needs to recompute all its graphics contexts and determine
+ * its new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Listbox will be relayed out and redisplayed.
+ * Listbox will be relayed out and redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
static void
-ListboxWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+ListboxWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC gc;
unsigned long mask;
- Listbox *listPtr;
-
- listPtr = (Listbox *) instanceData;
+ Listbox *listPtr = (Listbox *) instanceData;
if (listPtr->state & STATE_NORMAL) {
gcValues.foreground = listPtr->fgColorPtr->pixel;
gcValues.graphics_exposures = False;
mask = GCForeground | GCFont | GCGraphicsExposures;
+ } else if (listPtr->dfgColorPtr != NULL) {
+ gcValues.foreground = listPtr->dfgColorPtr->pixel;
+ gcValues.graphics_exposures = False;
+ mask = GCForeground | GCFont | GCGraphicsExposures;
} else {
- if (listPtr->dfgColorPtr != NULL) {
- gcValues.foreground = listPtr->dfgColorPtr->pixel;
- gcValues.graphics_exposures = False;
- mask = GCForeground | GCFont | GCGraphicsExposures;
- } else {
- gcValues.foreground = listPtr->fgColorPtr->pixel;
- mask = GCForeground | GCFont;
- if (listPtr->gray == None) {
- listPtr->gray = Tk_GetBitmap(NULL, listPtr->tkwin, "gray50");
- }
- if (listPtr->gray != None) {
- gcValues.fill_style = FillStippled;
- gcValues.stipple = listPtr->gray;
- mask |= GCFillStyle | GCStipple;
- }
+ gcValues.foreground = listPtr->fgColorPtr->pixel;
+ mask = GCForeground | GCFont;
+ if (listPtr->gray == None) {
+ listPtr->gray = Tk_GetBitmap(NULL, listPtr->tkwin, "gray50");
+ }
+ if (listPtr->gray != None) {
+ gcValues.fill_style = FillStippled;
+ gcValues.stipple = listPtr->gray;
+ mask |= GCFillStyle | GCStipple;
}
}
@@ -1789,8 +1797,8 @@ ListboxWorldChanged(instanceData)
listPtr->selTextGC = gc;
/*
- * Register the desired geometry for the window and arrange for
- * the window to be redisplayed.
+ * Register the desired geometry for the window and arrange for the window
+ * to be redisplayed.
*/
ListboxComputeGeometry(listPtr, 1, 1, 1);
@@ -1815,25 +1823,24 @@ ListboxWorldChanged(instanceData)
*/
static void
-DisplayListbox(clientData)
- ClientData clientData; /* Information about window. */
+DisplayListbox(
+ ClientData clientData) /* Information about window. */
{
register Listbox *listPtr = (Listbox *) clientData;
register Tk_Window tkwin = listPtr->tkwin;
GC gc;
- int i, limit, x, y, width = 0, prevSelected, freeGC;
+ int i, limit, x, y, prevSelected, freeGC, stringLen;
Tk_FontMetrics fm;
Tcl_Obj *curElement;
Tcl_HashEntry *entry;
char *stringRep;
- int stringLen;
ItemAttr *attrs;
Tk_3DBorder selectedBg;
XGCValues gcValues;
unsigned long mask;
- int left, right; /* Non-zero values here indicate
- * that the left or right edge of
- * the listbox is off-screen. */
+ int left, right; /* Non-zero values here indicate that the left
+ * or right edge of the listbox is
+ * off-screen. */
Pixmap pixmap;
listPtr->flags &= ~REDRAW_PENDING;
@@ -1867,11 +1874,11 @@ DisplayListbox(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Redrawing is done in a temporary pixmap that is allocated
- * here and freed at the end of the procedure. All drawing is
- * done to the pixmap, and the pixmap is copied to the screen
- * at the end of the procedure. This provides the smoothest
- * possible visual effects (no flashing on the screen).
+ * Redrawing is done in a temporary pixmap that is allocated here and
+ * freed at the end of the procedure. All drawing is done to the pixmap,
+ * and the pixmap is copied to the screen at the end of the procedure.
+ * This provides the smoothest possible visual effects (no flashing on the
+ * screen).
*/
pixmap = Tk_GetPixmap(listPtr->display, Tk_WindowId(tkwin),
@@ -1882,7 +1889,10 @@ DisplayListbox(clientData)
Tk_Fill3DRectangle(tkwin, pixmap, listPtr->normalBorder, 0, 0,
Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
- /* Display each item in the listbox */
+ /*
+ * Display each item in the listbox.
+ */
+
limit = listPtr->topIndex + listPtr->fullLines + listPtr->partialLine - 1;
if (limit >= listPtr->nElements) {
limit = listPtr->nElements-1;
@@ -1892,40 +1902,54 @@ DisplayListbox(clientData)
left = listPtr->selBorderWidth+1;
}
if ((listPtr->maxWidth - listPtr->xOffset) > (Tk_Width(listPtr->tkwin)
- - 2*(listPtr->inset + listPtr->selBorderWidth))) {
+ - 2*(listPtr->inset + listPtr->selBorderWidth))) {
right = listPtr->selBorderWidth+1;
}
prevSelected = 0;
-
+
for (i = listPtr->topIndex; i <= limit; i++) {
+ int width = Tk_Width(tkwin); /* zeroth approx to silence warning */
+
x = listPtr->inset;
- y = ((i - listPtr->topIndex) * listPtr->lineHeight)
- + listPtr->inset;
+ y = ((i - listPtr->topIndex) * listPtr->lineHeight) + listPtr->inset;
gc = listPtr->textGC;
freeGC = 0;
+
/*
* Lookup this item in the item attributes table, to see if it has
- * special foreground/background colors
+ * special foreground/background colors.
*/
- entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *)i);
+
+ entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *) INT2PTR(i));
/*
- * If the listbox is enabled, items may be drawn differently;
- * they may be drawn selected, or they may have special foreground
- * or background colors.
+ * If the listbox is enabled, items may be drawn differently; they may
+ * be drawn selected, or they may have special foreground or
+ * background colors.
*/
+
if (listPtr->state & STATE_NORMAL) {
- if (Tcl_FindHashEntry(listPtr->selection, (char *)i) != NULL) {
- /* Selected items are drawn differently. */
+ if (Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i))) {
+ /*
+ * Selected items are drawn differently.
+ */
+
gc = listPtr->selTextGC;
width = Tk_Width(tkwin) - 2*listPtr->inset;
selectedBg = listPtr->selBorder;
-
- /* If there is attribute information for this item,
- * adjust the drawing accordingly */
+
+ /*
+ * If there is attribute information for this item, adjust the
+ * drawing accordingly.
+ */
+
if (entry != NULL) {
attrs = (ItemAttr *)Tcl_GetHashValue(entry);
- /* Default GC has the values from the widget at large */
+
+ /*
+ * Default GC has the values from the widget at large.
+ */
+
if (listPtr->selFgColorPtr) {
gcValues.foreground = listPtr->selFgColorPtr->pixel;
} else {
@@ -1934,11 +1958,11 @@ DisplayListbox(clientData)
gcValues.font = Tk_FontId(listPtr->tkfont);
gcValues.graphics_exposures = False;
mask = GCForeground | GCFont | GCGraphicsExposures;
-
+
if (attrs->selBorder != NULL) {
selectedBg = attrs->selBorder;
}
-
+
if (attrs->selFgColor != NULL) {
gcValues.foreground = attrs->selFgColor->pixel;
gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues);
@@ -1988,7 +2012,7 @@ DisplayListbox(clientData)
/* Draw bottom bevel */
if (i + 1 == listPtr->nElements ||
Tcl_FindHashEntry(listPtr->selection,
- (char *)(i + 1)) == NULL ) {
+ (char *) INT2PTR(i + 1)) == NULL ) {
Tk_3DHorizontalBevel(tkwin, pixmap, selectedBg, x-left,
y + listPtr->lineHeight - listPtr->selBorderWidth,
width+left+right, listPtr->selBorderWidth, 0, 0, 0,
@@ -2000,28 +2024,29 @@ DisplayListbox(clientData)
* If there is an item attributes record for this item, draw
* the background box and set the foreground color accordingly
*/
+
if (entry != NULL) {
attrs = (ItemAttr *)Tcl_GetHashValue(entry);
gcValues.foreground = listPtr->fgColorPtr->pixel;
gcValues.font = Tk_FontId(listPtr->tkfont);
gcValues.graphics_exposures = False;
mask = GCForeground | GCFont | GCGraphicsExposures;
-
+
/*
* If the item has its own background color, draw it now.
*/
-
+
if (attrs->border != NULL) {
width = Tk_Width(tkwin) - 2*listPtr->inset;
Tk_Fill3DRectangle(tkwin, pixmap, attrs->border, x, y,
width, listPtr->lineHeight, 0, TK_RELIEF_FLAT);
}
-
+
/*
* If the item has its own foreground, use it to override
* the value in the gcValues structure.
*/
-
+
if ((listPtr->state & STATE_NORMAL)
&& attrs->fgColor != NULL) {
gcValues.foreground = attrs->fgColor->pixel;
@@ -2033,7 +2058,10 @@ DisplayListbox(clientData)
}
}
- /* Draw the actual text of this item */
+ /*
+ * Draw the actual text of this item.
+ */
+
Tk_GetFontMetrics(listPtr->tkfont, &fm);
y += fm.ascent + listPtr->selBorderWidth;
x = listPtr->inset + listPtr->selBorderWidth - listPtr->xOffset;
@@ -2042,10 +2070,16 @@ DisplayListbox(clientData)
Tk_DrawChars(listPtr->display, pixmap, gc, listPtr->tkfont,
stringRep, stringLen, x, y);
- /* If this is the active element, apply the activestyle to it. */
+ /*
+ * If this is the active element, apply the activestyle to it.
+ */
+
if ((i == listPtr->active) && (listPtr->flags & GOT_FOCUS)) {
if (listPtr->activeStyle == ACTIVE_STYLE_UNDERLINE) {
- /* Underline the text. */
+ /*
+ * Underline the text.
+ */
+
Tk_UnderlineChars(listPtr->display, pixmap, gc,
listPtr->tkfont, stringRep, x, y, 0, stringLen);
} else if (listPtr->activeStyle == ACTIVE_STYLE_DOTBOX) {
@@ -2053,52 +2087,59 @@ DisplayListbox(clientData)
/*
* This provides for exact default look and feel on Windows.
*/
+
TkWinDCState state;
HDC dc;
RECT rect;
dc = TkWinGetDrawableDC(listPtr->display, pixmap, &state);
- rect.left = listPtr->inset;
- rect.top = ((i - listPtr->topIndex) * listPtr->lineHeight)
- + listPtr->inset;
- rect.right = rect.left + width;
+ rect.left = listPtr->inset;
+ rect.top = ((i - listPtr->topIndex) * listPtr->lineHeight)
+ + listPtr->inset;
+ rect.right = rect.left + width;
rect.bottom = rect.top + listPtr->lineHeight;
DrawFocusRect(dc, &rect);
TkWinReleaseDrawableDC(pixmap, dc, &state);
-#else
+#else /* !WIN32 */
/*
* Draw a dotted box around the text.
*/
+
x = listPtr->inset;
y = ((i - listPtr->topIndex) * listPtr->lineHeight)
- + listPtr->inset;
+ + listPtr->inset;
width = Tk_Width(tkwin) - 2*listPtr->inset - 1;
- gcValues.line_style = LineOnOffDash;
- gcValues.line_width = listPtr->selBorderWidth;
+ gcValues.line_style = LineOnOffDash;
+ gcValues.line_width = listPtr->selBorderWidth;
if (gcValues.line_width <= 0) {
gcValues.line_width = 1;
}
gcValues.dash_offset = 0;
- gcValues.dashes = 1;
+ gcValues.dashes = 1;
+
/*
* You would think the XSetDashes was necessary, but it
- * appears that the default dotting for just saying we
- * want dashes appears to work correctly.
+ * appears that the default dotting for just saying we want
+ * dashes appears to work correctly.
static char dashList[] = { 1 };
- static int dashLen = sizeof(dashList);
+ static int dashLen = sizeof(dashList);
XSetDashes(listPtr->display, gc, 0, dashList, dashLen);
*/
+
mask = GCLineWidth | GCLineStyle | GCDashList | GCDashOffset;
XChangeGC(listPtr->display, gc, mask, &gcValues);
XDrawRectangle(listPtr->display, pixmap, gc, x, y,
(unsigned) width, (unsigned) listPtr->lineHeight - 1);
if (!freeGC) {
- /* Don't bother changing if it is about to be freed. */
+ /*
+ * Don't bother changing if it is about to be freed.
+ */
+
gcValues.line_style = LineSolid;
XChangeGC(listPtr->display, gc, GCLineStyle, &gcValues);
}
-#endif
+#endif /* WIN32 */
}
}
@@ -2108,8 +2149,8 @@ DisplayListbox(clientData)
}
/*
- * Redraw the border for the listbox to make sure that it's on top
- * of any of the text of the listbox entries.
+ * Redraw the border for the listbox to make sure that it's on top of any
+ * of the text of the listbox entries.
*/
Tk_Draw3DRectangle(tkwin, pixmap, listPtr->normalBorder,
@@ -2123,11 +2164,11 @@ DisplayListbox(clientData)
bgGC = Tk_GCForColor(listPtr->highlightBgColorPtr, pixmap);
if (listPtr->flags & GOT_FOCUS) {
fgGC = Tk_GCForColor(listPtr->highlightColorPtr, pixmap);
- TkpDrawHighlightBorder(tkwin, fgGC, bgGC,
- listPtr->highlightWidth, pixmap);
+ TkpDrawHighlightBorder(tkwin, fgGC, bgGC,
+ listPtr->highlightWidth, pixmap);
} else {
- TkpDrawHighlightBorder(tkwin, bgGC, bgGC,
- listPtr->highlightWidth, pixmap);
+ TkpDrawHighlightBorder(tkwin, bgGC, bgGC,
+ listPtr->highlightWidth, pixmap);
}
}
#ifndef TK_NO_DOUBLE_BUFFERING
@@ -2143,51 +2184,51 @@ DisplayListbox(clientData)
*
* ListboxComputeGeometry --
*
- * This procedure is invoked to recompute geometry information
- * such as the sizes of the elements and the overall dimensions
- * desired for the listbox.
+ * This procedure is invoked to recompute geometry information such as
+ * the sizes of the elements and the overall dimensions desired for the
+ * listbox.
*
* Results:
* None.
*
* Side effects:
- * Geometry information is updated and a new requested size is
- * registered for the widget. Internal border and gridding
- * information is also set.
+ * Geometry information is updated and a new requested size is registered
+ * for the widget. Internal border and gridding information is also set.
*
*----------------------------------------------------------------------
*/
static void
-ListboxComputeGeometry(listPtr, fontChanged, maxIsStale, updateGrid)
- Listbox *listPtr; /* Listbox whose geometry is to be
+ListboxComputeGeometry(
+ Listbox *listPtr, /* Listbox whose geometry is to be
* recomputed. */
- int fontChanged; /* Non-zero means the font may have changed
- * so per-element width information also
- * has to be computed. */
- int maxIsStale; /* Non-zero means the "maxWidth" field may
- * no longer be up-to-date and must
- * be recomputed. If fontChanged is 1 then
- * this must be 1. */
- int updateGrid; /* Non-zero means call Tk_SetGrid or
- * Tk_UnsetGrid to update gridding for
- * the window. */
+ int fontChanged, /* Non-zero means the font may have changed so
+ * per-element width information also has to
+ * be computed. */
+ int maxIsStale, /* Non-zero means the "maxWidth" field may no
+ * longer be up-to-date and must be
+ * recomputed. If fontChanged is 1 then this
+ * must be 1. */
+ int updateGrid) /* Non-zero means call Tk_SetGrid or
+ * Tk_UnsetGrid to update gridding for the
+ * window. */
{
- int width, height, pixelWidth, pixelHeight;
+ int width, height, pixelWidth, pixelHeight, textLength, i, result;
Tk_FontMetrics fm;
Tcl_Obj *element;
- int textLength;
char *text;
- int i, result;
-
- if (fontChanged || maxIsStale) {
+
+ if (fontChanged || maxIsStale) {
listPtr->xScrollUnit = Tk_TextWidth(listPtr->tkfont, "0", 1);
if (listPtr->xScrollUnit == 0) {
listPtr->xScrollUnit = 1;
}
listPtr->maxWidth = 0;
for (i = 0; i < listPtr->nElements; i++) {
- /* Compute the pixel width of the current element */
+ /*
+ * Compute the pixel width of the current element.
+ */
+
result = Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i,
&element);
if (result != TCL_OK) {
@@ -2239,87 +2280,92 @@ ListboxComputeGeometry(listPtr, fontChanged, maxIsStale, updateGrid)
*
* ListboxInsertSubCmd --
*
- * This procedure is invoked to handle the listbox "insert"
- * subcommand.
+ * This procedure is invoked to handle the listbox "insert" subcommand.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * New elements are added to the listbox pointed to by listPtr;
- * a refresh callback is registered for the listbox.
+ * New elements are added to the listbox pointed to by listPtr; a refresh
+ * callback is registered for the listbox.
*
*----------------------------------------------------------------------
*/
static int
-ListboxInsertSubCmd(listPtr, index, objc, objv)
- register Listbox *listPtr; /* Listbox that is to get the new
- * elements. */
- int index; /* Add the new elements before this
+ListboxInsertSubCmd(
+ register Listbox *listPtr, /* Listbox that is to get the new elements. */
+ int index, /* Add the new elements before this
* element. */
- int objc; /* Number of new elements to add. */
- Tcl_Obj *CONST objv[]; /* New elements (one per entry). */
+ int objc, /* Number of new elements to add. */
+ Tcl_Obj *const objv[]) /* New elements (one per entry). */
{
- int i, oldMaxWidth;
+ int i, oldMaxWidth, pixelWidth, result, length;
Tcl_Obj *newListObj;
- int pixelWidth;
- int result;
char *stringRep;
- int length;
-
+
oldMaxWidth = listPtr->maxWidth;
for (i = 0; i < objc; i++) {
/*
* Check if any of the new elements are wider than the current widest;
* if so, update our notion of "widest."
*/
+
stringRep = Tcl_GetStringFromObj(objv[i], &length);
pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length);
if (pixelWidth > listPtr->maxWidth) {
listPtr->maxWidth = pixelWidth;
}
}
-
- /* Adjust selection and attribute information for every index after
- * the first index */
+
+ /*
+ * Adjust selection and attribute information for every index after the
+ * first index.
+ */
+
MigrateHashEntries(listPtr->selection, index, listPtr->nElements-1, objc);
MigrateHashEntries(listPtr->itemAttrTable, index, listPtr->nElements-1,
objc);
-
- /* If the object is shared, duplicate it before writing to it */
+
+ /*
+ * If the object is shared, duplicate it before writing to it.
+ */
+
if (Tcl_IsShared(listPtr->listObj)) {
newListObj = Tcl_DuplicateObj(listPtr->listObj);
} else {
newListObj = listPtr->listObj;
}
- result =
- Tcl_ListObjReplace(listPtr->interp, newListObj, index, 0, objc, objv);
+ result = Tcl_ListObjReplace(listPtr->interp, newListObj, index, 0,
+ objc, objv);
if (result != TCL_OK) {
return result;
}
/*
- * Replace the current object and set attached listvar, if any.
- * This may error if listvar points to a var in a deleted namespace, but
- * we ignore those errors. If the namespace is recreated, it will
- * auto-sync with the current value. [Bug 1424513]
+ * Replace the current object and set attached listvar, if any. This may
+ * error if listvar points to a var in a deleted namespace, but we ignore
+ * those errors. If the namespace is recreated, it will auto-sync with the
+ * current value. [Bug 1424513]
*/
Tcl_IncrRefCount(newListObj);
Tcl_DecrRefCount(listPtr->listObj);
listPtr->listObj = newListObj;
if (listPtr->listVarName != NULL) {
- Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName,
- (char *) NULL, listPtr->listObj, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName, NULL,
+ listPtr->listObj, TCL_GLOBAL_ONLY);
}
- /* Get the new list length */
+ /*
+ * Get the new list length.
+ */
+
Tcl_ListObjLength(listPtr->interp, listPtr->listObj, &listPtr->nElements);
/*
- * Update the "special" indices (anchor, topIndex, active) to account
- * for the renumbering that just occurred. Then arrange for the new
+ * Update the "special" indices (anchor, topIndex, active) to account for
+ * the renumbering that just occurred. Then arrange for the new
* information to be displayed.
*/
@@ -2350,8 +2396,8 @@ ListboxInsertSubCmd(listPtr, index, objc, objv)
*
* ListboxDeleteSubCmd --
*
- * Process a listbox "delete" subcommand by removing one or more
- * elements from a listbox widget.
+ * Process a listbox "delete" subcommand by removing one or more elements
+ * from a listbox widget.
*
* Results:
* Standard Tcl result.
@@ -2363,23 +2409,19 @@ ListboxInsertSubCmd(listPtr, index, objc, objv)
*/
static int
-ListboxDeleteSubCmd(listPtr, first, last)
- register Listbox *listPtr; /* Listbox widget to modify. */
- int first; /* Index of first element to delete. */
- int last; /* Index of last element to delete. */
+ListboxDeleteSubCmd(
+ register Listbox *listPtr, /* Listbox widget to modify. */
+ int first, /* Index of first element to delete. */
+ int last) /* Index of last element to delete. */
{
- int count, i, widthChanged;
- Tcl_Obj *newListObj;
- Tcl_Obj *element;
- int length;
+ int count, i, widthChanged, length, result, pixelWidth;
+ Tcl_Obj *newListObj, *element;
char *stringRep;
- int result;
- int pixelWidth;
Tcl_HashEntry *entry;
-
+
/*
- * Adjust the range to fit within the existing elements of the
- * listbox, and make sure there's something to delete.
+ * Adjust the range to fit within the existing elements of the listbox,
+ * and make sure there's something to delete.
*/
if (first < 0) {
@@ -2395,30 +2437,36 @@ ListboxDeleteSubCmd(listPtr, first, last)
/*
* Foreach deleted index we must:
- * a) remove selection information
+ * a) remove selection information,
* b) check the width of the element; if it is equal to the max, set
* widthChanged to 1, because it may be the only element with that
- * width
+ * width.
*/
+
widthChanged = 0;
for (i = first; i <= last; i++) {
- /* Remove selection information */
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ /*
+ * Remove selection information.
+ */
+
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
listPtr->numSelected--;
Tcl_DeleteHashEntry(entry);
}
- entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *) INT2PTR(i));
if (entry != NULL) {
ckfree((char *)Tcl_GetHashValue(entry));
Tcl_DeleteHashEntry(entry);
}
-
- /* Check width of the element. We only have to check if widthChanged
+
+ /*
+ * Check width of the element. We only have to check if widthChanged
* has not already been set to 1, because we only need one maxWidth
* element to disappear for us to have to recompute the width
*/
+
if (widthChanged == 0) {
Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element);
stringRep = Tcl_GetStringFromObj(element, &length);
@@ -2429,13 +2477,19 @@ ListboxDeleteSubCmd(listPtr, first, last)
}
}
- /* Adjust selection and attribute info for indices after lastIndex */
+ /*
+ * Adjust selection and attribute info for indices after lastIndex.
+ */
+
MigrateHashEntries(listPtr->selection, last+1,
listPtr->nElements-1, count*-1);
MigrateHashEntries(listPtr->itemAttrTable, last+1,
listPtr->nElements-1, count*-1);
- /* Delete the requested elements */
+ /*
+ * Delete the requested elements.
+ */
+
if (Tcl_IsShared(listPtr->listObj)) {
newListObj = Tcl_DuplicateObj(listPtr->listObj);
} else {
@@ -2448,27 +2502,30 @@ ListboxDeleteSubCmd(listPtr, first, last)
}
/*
- * Replace the current object and set attached listvar, if any.
- * This may error if listvar points to a var in a deleted namespace, but
- * we ignore those errors. If the namespace is recreated, it will
- * auto-sync with the current value. [Bug 1424513]
+ * Replace the current object and set attached listvar, if any. This may
+ * error if listvar points to a var in a deleted namespace, but we ignore
+ * those errors. If the namespace is recreated, it will auto-sync with the
+ * current value. [Bug 1424513]
*/
Tcl_IncrRefCount(newListObj);
Tcl_DecrRefCount(listPtr->listObj);
listPtr->listObj = newListObj;
if (listPtr->listVarName != NULL) {
- Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName,
- (char *) NULL, listPtr->listObj, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName, NULL,
+ listPtr->listObj, TCL_GLOBAL_ONLY);
}
- /* Get the new list length */
+ /*
+ * Get the new list length.
+ */
+
Tcl_ListObjLength(listPtr->interp, listPtr->listObj, &listPtr->nElements);
/*
- * Update the selection and viewing information to reflect the change
- * in the element numbering, and redisplay to slide information up over
- * the elements that were deleted.
+ * Update the selection and viewing information to reflect the change in
+ * the element numbering, and redisplay to slide information up over the
+ * elements that were deleted.
*/
if (first <= listPtr->selectAnchor) {
@@ -2512,26 +2569,26 @@ ListboxDeleteSubCmd(listPtr, first, last)
*
* ListboxEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on listboxes.
+ * This procedure is invoked by the Tk dispatcher for various events on
+ * listboxes.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-ListboxEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+ListboxEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
Listbox *listPtr = (Listbox *) clientData;
-
+
if (eventPtr->type == Expose) {
EventuallyRedrawRange(listPtr,
NearestListboxElement(listPtr, eventPtr->xexpose.y),
@@ -2564,10 +2621,9 @@ ListboxEventProc(clientData, eventPtr)
ChangeListboxOffset(listPtr, listPtr->xOffset);
/*
- * Redraw the whole listbox. It's hard to tell what needs
- * to be redrawn (e.g. if the listbox has shrunk then we
- * may only need to redraw the borders), so just redraw
- * everything for safety.
+ * Redraw the whole listbox. It's hard to tell what needs to be
+ * redrawn (e.g. if the listbox has shrunk then we may only need to
+ * redraw the borders), so just redraw everything for safety.
*/
EventuallyRedrawRange(listPtr, 0, listPtr->nElements-1);
@@ -2589,9 +2645,9 @@ ListboxEventProc(clientData, eventPtr)
*
* ListboxCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This procedure is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -2603,16 +2659,16 @@ ListboxEventProc(clientData, eventPtr)
*/
static void
-ListboxCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+ListboxCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
Listbox *listPtr = (Listbox *) clientData;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This procedure could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this procedure destroys the
+ * widget.
*/
if (!(listPtr->flags & LISTBOX_DELETED)) {
@@ -2625,13 +2681,12 @@ ListboxCmdDeletedProc(clientData)
*
* GetListboxIndex --
*
- * Parse an index into a listbox and return either its value
- * or an error.
+ * Parse an index into a listbox and return either its value or an error.
*
* Results:
- * A standard Tcl result. If all went well, then *indexPtr is
- * filled in with the index (into listPtr) corresponding to
- * string. Otherwise an error message is left in the interp's result.
+ * A standard Tcl result. If all went well, then *indexPtr is filled in
+ * with the index (into listPtr) corresponding to string. Otherwise an
+ * error message is left in the interp's result.
*
* Side effects:
* None.
@@ -2640,62 +2695,62 @@ ListboxCmdDeletedProc(clientData)
*/
static int
-GetListboxIndex(interp, listPtr, indexObj, endIsSize, indexPtr)
- Tcl_Interp *interp; /* For error messages. */
- Listbox *listPtr; /* Listbox for which the index is being
+GetListboxIndex(
+ Tcl_Interp *interp, /* For error messages. */
+ Listbox *listPtr, /* Listbox for which the index is being
* specified. */
- Tcl_Obj *indexObj; /* Specifies an element in the listbox. */
- int endIsSize; /* If 1, "end" refers to the number of
- * entries in the listbox. If 0, "end"
- * refers to 1 less than the number of
- * entries. */
- int *indexPtr; /* Where to store converted index. */
+ Tcl_Obj *indexObj, /* Specifies an element in the listbox. */
+ int endIsSize, /* If 1, "end" refers to the number of entries
+ * in the listbox. If 0, "end" refers to 1
+ * less than the number of entries. */
+ int *indexPtr) /* Where to store converted index. */
{
- int result;
- int index;
+ int result, index;
char *stringRep;
-
- /* First see if the index is one of the named indices */
+
+ /*
+ * First see if the index is one of the named indices.
+ */
+
result = Tcl_GetIndexFromObj(NULL, indexObj, indexNames, "", 0, &index);
if (result == TCL_OK) {
switch (index) {
- case INDEX_ACTIVE: {
- /* "active" index */
- *indexPtr = listPtr->active;
- break;
- }
-
- case INDEX_ANCHOR: {
- /* "anchor" index */
- *indexPtr = listPtr->selectAnchor;
- break;
- }
-
- case INDEX_END: {
- /* "end" index */
- if (endIsSize) {
- *indexPtr = listPtr->nElements;
- } else {
- *indexPtr = listPtr->nElements - 1;
- }
- break;
+ case INDEX_ACTIVE:
+ /* "active" index */
+ *indexPtr = listPtr->active;
+ break;
+ case INDEX_ANCHOR:
+ /* "anchor" index */
+ *indexPtr = listPtr->selectAnchor;
+ break;
+ case INDEX_END:
+ /* "end" index */
+ if (endIsSize) {
+ *indexPtr = listPtr->nElements;
+ } else {
+ *indexPtr = listPtr->nElements - 1;
}
+ break;
}
return TCL_OK;
}
- /* The index didn't match any of the named indices; maybe it's an @x,y */
+ /*
+ * The index didn't match any of the named indices; maybe it's an @x,y
+ */
+
stringRep = Tcl_GetString(indexObj);
if (stringRep[0] == '@') {
/* @x,y index */
int y;
char *start, *end;
+
start = stringRep + 1;
- strtol(start, &end, 0);
+ y = strtol(start, &end, 0);
if ((start == end) || (*end != ',')) {
Tcl_AppendResult(interp, "bad listbox index \"", stringRep,
"\": must be active, anchor, end, @x,y, or a number",
- (char *)NULL);
+ NULL);
return TCL_ERROR;
}
start = end+1;
@@ -2703,23 +2758,29 @@ GetListboxIndex(interp, listPtr, indexObj, endIsSize, indexPtr)
if ((start == end) || (*end != '\0')) {
Tcl_AppendResult(interp, "bad listbox index \"", stringRep,
"\": must be active, anchor, end, @x,y, or a number",
- (char *)NULL);
+ NULL);
return TCL_ERROR;
}
*indexPtr = NearestListboxElement(listPtr, y);
return TCL_OK;
}
-
- /* Maybe the index is just an integer */
+
+ /*
+ * Maybe the index is just an integer.
+ */
+
if (Tcl_GetIntFromObj(interp, indexObj, indexPtr) == TCL_OK) {
return TCL_OK;
}
- /* Everything failed, nothing matched. Throw up an error message */
+ /*
+ * Everything failed, nothing matched. Throw up an error message.
+ */
+
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad listbox index \"",
Tcl_GetString(indexObj), "\": must be active, anchor, ",
- "end, @x,y, or a number", (char *) NULL);
+ "end, @x,y, or a number", NULL);
return TCL_ERROR;
}
@@ -2728,26 +2789,25 @@ GetListboxIndex(interp, listPtr, indexObj, endIsSize, indexPtr)
*
* ChangeListboxView --
*
- * Change the view on a listbox widget so that a given element
- * is displayed at the top.
+ * Change the view on a listbox widget so that a given element is
+ * displayed at the top.
*
* Results:
* None.
*
* Side effects:
- * What's displayed on the screen is changed. If there is a
- * scrollbar associated with this widget, then the scrollbar
- * is instructed to change its display too.
+ * What's displayed on the screen is changed. If there is a scrollbar
+ * associated with this widget, then the scrollbar is instructed to
+ * change its display too.
*
*----------------------------------------------------------------------
*/
static void
-ChangeListboxView(listPtr, index)
- register Listbox *listPtr; /* Information about widget. */
- int index; /* Index of element in listPtr
- * that should now appear at the
- * top of the listbox. */
+ChangeListboxView(
+ register Listbox *listPtr, /* Information about widget. */
+ int index) /* Index of element in listPtr that should now
+ * appear at the top of the listbox. */
{
if (index >= (listPtr->nElements - listPtr->fullLines)) {
index = listPtr->nElements - listPtr->fullLines;
@@ -2773,26 +2833,24 @@ ChangeListboxView(listPtr, index)
* None.
*
* Side effects:
- * The listbox may be redrawn to reflect its new horizontal
- * offset.
+ * The listbox may be redrawn to reflect its new horizontal offset.
*
*----------------------------------------------------------------------
*/
static void
-ChangeListboxOffset(listPtr, offset)
- register Listbox *listPtr; /* Information about widget. */
- int offset; /* Desired new "xOffset" for
- * listbox. */
+ChangeListboxOffset(
+ register Listbox *listPtr, /* Information about widget. */
+ int offset) /* Desired new "xOffset" for listbox. */
{
int maxOffset;
-
+
/*
- * Make sure that the new offset is within the allowable range, and
- * round it off to an even multiple of xScrollUnit.
+ * Make sure that the new offset is within the allowable range, and round
+ * it off to an even multiple of xScrollUnit.
*
- * Add half a scroll unit to do entry/text-like synchronization.
- * [Bug #225025]
+ * Add half a scroll unit to do entry/text-like synchronization. [Bug
+ * #225025]
*/
offset += listPtr->xScrollUnit / 2;
@@ -2818,8 +2876,8 @@ ChangeListboxOffset(listPtr, offset)
*
* ListboxScanTo --
*
- * Given a point (presumably of the curent mouse location)
- * drag the view in the window to implement the scan operation.
+ * Given a point (presumably of the curent mouse location) drag the view
+ * in the window to implement the scan operation.
*
* Results:
* None.
@@ -2831,29 +2889,26 @@ ChangeListboxOffset(listPtr, offset)
*/
static void
-ListboxScanTo(listPtr, x, y)
- register Listbox *listPtr; /* Information about widget. */
- int x; /* X-coordinate to use for scan
- * operation. */
- int y; /* Y-coordinate to use for scan
- * operation. */
+ListboxScanTo(
+ register Listbox *listPtr, /* Information about widget. */
+ int x, /* X-coordinate to use for scan operation. */
+ int y) /* Y-coordinate to use for scan operation. */
{
int newTopIndex, newOffset, maxIndex, maxOffset;
-
+
maxIndex = listPtr->nElements - listPtr->fullLines;
maxOffset = listPtr->maxWidth + (listPtr->xScrollUnit - 1)
- (Tk_Width(listPtr->tkwin) - 2*listPtr->inset
- 2*listPtr->selBorderWidth - listPtr->xScrollUnit);
/*
- * Compute new top line for screen by amplifying the difference
- * between the current position and the place where the scan
- * started (the "mark" position). If we run off the top or bottom
- * of the list, then reset the mark point so that the current
- * position continues to correspond to the edge of the window.
- * This means that the picture will start dragging as soon as the
- * mouse reverses direction (without this reset, might have to slide
- * mouse a long ways back before the picture starts moving again).
+ * Compute new top line for screen by amplifying the difference between
+ * the current position and the place where the scan started (the "mark"
+ * position). If we run off the top or bottom of the list, then reset the
+ * mark point so that the current position continues to correspond to the
+ * edge of the window. This means that the picture will start dragging as
+ * soon as the mouse reverses direction (without this reset, might have to
+ * slide mouse a long ways back before the picture starts moving again).
*/
newTopIndex = listPtr->scanMarkYIndex
@@ -2873,7 +2928,7 @@ ListboxScanTo(listPtr, x, y)
* scan started.
*/
- newOffset = listPtr->scanMarkXOffset - (10*(x - listPtr->scanMarkX));
+ newOffset = listPtr->scanMarkXOffset - 10*(x - listPtr->scanMarkX);
if (newOffset > maxOffset) {
newOffset = listPtr->scanMarkXOffset = maxOffset;
listPtr->scanMarkX = x;
@@ -2889,13 +2944,12 @@ ListboxScanTo(listPtr, x, y)
*
* NearestListboxElement --
*
- * Given a y-coordinate inside a listbox, compute the index of
- * the element under that y-coordinate (or closest to that
- * y-coordinate).
+ * Given a y-coordinate inside a listbox, compute the index of the
+ * element under that y-coordinate (or closest to that y-coordinate).
*
* Results:
- * The return value is an index of an element of listPtr. If
- * listPtr has no elements, then 0 is always returned.
+ * The return value is an index of an element of listPtr. If listPtr has
+ * no elements, then 0 is always returned.
*
* Side effects:
* None.
@@ -2904,9 +2958,9 @@ ListboxScanTo(listPtr, x, y)
*/
static int
-NearestListboxElement(listPtr, y)
- register Listbox *listPtr; /* Information about widget. */
- int y; /* Y-coordinate in listPtr's window. */
+NearestListboxElement(
+ register Listbox *listPtr, /* Information about widget. */
+ int y) /* Y-coordinate in listPtr's window. */
{
int index;
@@ -2935,29 +2989,28 @@ NearestListboxElement(listPtr, y)
* Standard Tcl result.
*
* Side effects:
- * All of the elements in the range between first and last are
- * marked as either selected or deselected, depending on the
- * "select" argument. Any items whose state changes are redisplayed.
- * The selection is claimed from X when the number of selected
- * elements changes from zero to non-zero.
+ * All of the elements in the range between first and last are marked as
+ * either selected or deselected, depending on the "select" argument. Any
+ * items whose state changes are redisplayed. The selection is claimed
+ * from X when the number of selected elements changes from zero to
+ * non-zero.
*
*----------------------------------------------------------------------
*/
static int
-ListboxSelect(listPtr, first, last, select)
- register Listbox *listPtr; /* Information about widget. */
- int first; /* Index of first element to
- * select or deselect. */
- int last; /* Index of last element to
- * select or deselect. */
- int select; /* 1 means select items, 0 means
- * deselect them. */
+ListboxSelect(
+ register Listbox *listPtr, /* Information about widget. */
+ int first, /* Index of first element to select or
+ * deselect. */
+ int last, /* Index of last element to select or
+ * deselect. */
+ int select) /* 1 means select items, 0 means deselect
+ * them. */
{
- int i, firstRedisplay, oldCount;
+ int i, firstRedisplay, oldCount, isNew;
Tcl_HashEntry *entry;
- int new;
-
+
if (last < first) {
i = first;
first = last;
@@ -2976,12 +3029,13 @@ ListboxSelect(listPtr, first, last, select)
firstRedisplay = -1;
/*
- * For each index in the range, find it in our selection hash table.
- * If it's not there but should be, add it. If it's there but shouldn't
- * be, remove it.
+ * For each index in the range, find it in our selection hash table. If
+ * it's not there but should be, add it. If it's there but shouldn't be,
+ * remove it.
*/
+
for (i = first; i <= last; i++) {
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
if (!select) {
Tcl_DeleteHashEntry(entry);
@@ -2993,7 +3047,7 @@ ListboxSelect(listPtr, first, last, select)
} else {
if (select) {
entry = Tcl_CreateHashEntry(listPtr->selection,
- (char *)i, &new);
+ (char *) INT2PTR(i), &isNew);
Tcl_SetHashValue(entry, (ClientData) NULL);
listPtr->numSelected++;
if (firstRedisplay < 0) {
@@ -3019,17 +3073,16 @@ ListboxSelect(listPtr, first, last, select)
*
* ListboxFetchSelection --
*
- * This procedure is called back by Tk when the selection is
- * requested by someone. It returns part or all of the selection
- * in a buffer provided by the caller.
+ * This procedure is called back by Tk when the selection is requested by
+ * someone. It returns part or all of the selection in a buffer provided
+ * by the caller.
*
* Results:
- * The return value is the number of non-NULL bytes stored
- * at buffer. Buffer is filled (or partially filled) with a
- * NULL-terminated string containing part or all of the selection,
- * as given by offset and maxBytes. The selection is returned
- * as a Tcl list with one list element for each element in the
- * listbox.
+ * The return value is the number of non-NULL bytes stored at buffer.
+ * Buffer is filled (or partially filled) with a NULL-terminated string
+ * containing part or all of the selection, as given by offset and
+ * maxBytes. The selection is returned as a Tcl list with one list
+ * element for each element in the listbox.
*
* Side effects:
* None.
@@ -3038,25 +3091,22 @@ ListboxSelect(listPtr, first, last, select)
*/
static int
-ListboxFetchSelection(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Information about listbox widget. */
- int offset; /* Offset within selection of first
- * byte to be returned. */
- char *buffer; /* Location in which to place
- * selection. */
- int maxBytes; /* Maximum number of bytes to place
- * at buffer, not including terminating
- * NULL character. */
+ListboxFetchSelection(
+ ClientData clientData, /* Information about listbox widget. */
+ int offset, /* Offset within selection of first byte to be
+ * returned. */
+ char *buffer, /* Location in which to place selection. */
+ int maxBytes) /* Maximum number of bytes to place at buffer,
+ * not including terminating NULL
+ * character. */
{
register Listbox *listPtr = (Listbox *) clientData;
Tcl_DString selection;
- int length, count, needNewline;
+ int length, count, needNewline, stringLen, i;
Tcl_Obj *curElement;
char *stringRep;
- int stringLen;
Tcl_HashEntry *entry;
- int i;
-
+
if (!listPtr->exportSelection) {
return -1;
}
@@ -3068,7 +3118,7 @@ ListboxFetchSelection(clientData, offset, buffer, maxBytes)
needNewline = 0;
Tcl_DStringInit(&selection);
for (i = 0; i < listPtr->nElements; i++) {
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
if (needNewline) {
Tcl_DStringAppend(&selection, "\n", 1);
@@ -3097,9 +3147,7 @@ ListboxFetchSelection(clientData, offset, buffer, maxBytes)
if (count > maxBytes) {
count = maxBytes;
}
- memcpy((VOID *) buffer,
- (VOID *) (Tcl_DStringValue(&selection) + offset),
- (size_t) count);
+ memcpy(buffer, Tcl_DStringValue(&selection) + offset, (size_t) count);
}
buffer[count] = '\0';
Tcl_DStringFree(&selection);
@@ -3111,25 +3159,25 @@ ListboxFetchSelection(clientData, offset, buffer, maxBytes)
*
* ListboxLostSelection --
*
- * This procedure is called back by Tk when the selection is
- * grabbed away from a listbox widget.
+ * This procedure is called back by Tk when the selection is grabbed away
+ * from a listbox widget.
*
* Results:
* None.
*
* Side effects:
- * The existing selection is unhighlighted, and the window is
- * marked as not containing a selection.
+ * The existing selection is unhighlighted, and the window is marked as
+ * not containing a selection.
*
*----------------------------------------------------------------------
*/
static void
-ListboxLostSelection(clientData)
- ClientData clientData; /* Information about listbox widget. */
+ListboxLostSelection(
+ ClientData clientData) /* Information about listbox widget. */
{
register Listbox *listPtr = (Listbox *) clientData;
-
+
if ((listPtr->exportSelection) && (listPtr->nElements > 0)) {
ListboxSelect(listPtr, 0, listPtr->nElements-1, 0);
}
@@ -3140,8 +3188,8 @@ ListboxLostSelection(clientData)
*
* EventuallyRedrawRange --
*
- * Ensure that a given range of elements is eventually redrawn on
- * the display (if those elements in fact appear on the display).
+ * Ensure that a given range of elements is eventually redrawn on the
+ * display (if those elements in fact appear on the display).
*
* Results:
* None.
@@ -3153,17 +3201,19 @@ ListboxLostSelection(clientData)
*/
static void
-EventuallyRedrawRange(listPtr, first, last)
- register Listbox *listPtr; /* Information about widget. */
- int first; /* Index of first element in list
- * that needs to be redrawn. */
- int last; /* Index of last element in list
- * that needs to be redrawn. May
- * be less than first;
- * these just bracket a range. */
+EventuallyRedrawRange(
+ register Listbox *listPtr, /* Information about widget. */
+ int first, /* Index of first element in list that needs
+ * to be redrawn. */
+ int last) /* Index of last element in list that needs to
+ * be redrawn. May be less than first; these
+ * just bracket a range. */
{
- /* We don't have to register a redraw callback if one is already pending,
- * or if the window doesn't exist, or if the window isn't mapped */
+ /*
+ * We don't have to register a redraw callback if one is already pending,
+ * or if the window doesn't exist, or if the window isn't mapped.
+ */
+
if ((listPtr->flags & REDRAW_PENDING)
|| (listPtr->flags & LISTBOX_DELETED)
|| !Tk_IsMapped(listPtr->tkwin)) {
@@ -3178,30 +3228,30 @@ EventuallyRedrawRange(listPtr, first, last)
*
* ListboxUpdateVScrollbar --
*
- * This procedure is invoked whenever information has changed in
- * a listbox in a way that would invalidate a vertical scrollbar
- * display. If there is an associated scrollbar, then this command
- * updates it by invoking a Tcl command.
+ * This procedure is invoked whenever information has changed in a
+ * listbox in a way that would invalidate a vertical scrollbar display.
+ * If there is an associated scrollbar, then this command updates it by
+ * invoking a Tcl command.
*
* Results:
* None.
*
* Side effects:
- * A Tcl command is invoked, and an additional command may be
- * invoked to process errors in the command.
+ * A Tcl command is invoked, and an additional command may be invoked to
+ * process errors in the command.
*
*----------------------------------------------------------------------
*/
static void
-ListboxUpdateVScrollbar(listPtr)
- register Listbox *listPtr; /* Information about widget. */
+ListboxUpdateVScrollbar(
+ register Listbox *listPtr) /* Information about widget. */
{
- char string[TCL_DOUBLE_SPACE * 2];
+ char firstStr[TCL_DOUBLE_SPACE+1], lastStr[TCL_DOUBLE_SPACE+1];
double first, last;
int result;
Tcl_Interp *interp;
-
+
if (listPtr->yScrollCmd == NULL) {
return;
}
@@ -3209,30 +3259,32 @@ ListboxUpdateVScrollbar(listPtr)
first = 0.0;
last = 1.0;
} else {
- first = listPtr->topIndex/((double) listPtr->nElements);
- last = (listPtr->topIndex+listPtr->fullLines)
- /((double) listPtr->nElements);
+ first = listPtr->topIndex / (double) listPtr->nElements;
+ last = (listPtr->topIndex + listPtr->fullLines)
+ / (double) listPtr->nElements;
if (last > 1.0) {
last = 1.0;
}
}
- sprintf(string, " %g %g", first, last);
+ firstStr[0] = lastStr[0] = ' ';
+ Tcl_PrintDouble(NULL, first, firstStr+1);
+ Tcl_PrintDouble(NULL, last, lastStr+1);
/*
- * We must hold onto the interpreter from the listPtr because the data
- * at listPtr might be freed as a result of the Tcl_VarEval.
+ * We must hold onto the interpreter from the listPtr because the data at
+ * listPtr might be freed as a result of the Tcl_VarEval.
*/
-
+
interp = listPtr->interp;
- Tcl_Preserve((ClientData) interp);
- result = Tcl_VarEval(interp, listPtr->yScrollCmd, string,
- (char *) NULL);
+ Tcl_Preserve(interp);
+ result = Tcl_VarEval(interp, listPtr->yScrollCmd, firstStr, lastStr,
+ NULL);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (vertical scrolling command executed by listbox)");
Tcl_BackgroundError(interp);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/*
@@ -3240,26 +3292,26 @@ ListboxUpdateVScrollbar(listPtr)
*
* ListboxUpdateHScrollbar --
*
- * This procedure is invoked whenever information has changed in
- * a listbox in a way that would invalidate a horizontal scrollbar
- * display. If there is an associated horizontal scrollbar, then
- * this command updates it by invoking a Tcl command.
+ * This procedure is invoked whenever information has changed in a
+ * listbox in a way that would invalidate a horizontal scrollbar display.
+ * If there is an associated horizontal scrollbar, then this command
+ * updates it by invoking a Tcl command.
*
* Results:
* None.
*
* Side effects:
- * A Tcl command is invoked, and an additional command may be
- * invoked to process errors in the command.
+ * A Tcl command is invoked, and an additional command may be invoked to
+ * process errors in the command.
*
*----------------------------------------------------------------------
*/
static void
-ListboxUpdateHScrollbar(listPtr)
- register Listbox *listPtr; /* Information about widget. */
+ListboxUpdateHScrollbar(
+ register Listbox *listPtr) /* Information about widget. */
{
- char string[TCL_DOUBLE_SPACE * 2];
+ char firstStr[TCL_DOUBLE_SPACE+1], lastStr[TCL_DOUBLE_SPACE+1];
int result, windowWidth;
double first, last;
Tcl_Interp *interp;
@@ -3273,30 +3325,33 @@ ListboxUpdateHScrollbar(listPtr)
first = 0;
last = 1.0;
} else {
- first = listPtr->xOffset/((double) listPtr->maxWidth);
- last = (listPtr->xOffset + windowWidth)
- /((double) listPtr->maxWidth);
+ register double maxWide = (double) listPtr->maxWidth;
+
+ first = listPtr->xOffset / maxWide;
+ last = (listPtr->xOffset + windowWidth) / maxWide;
if (last > 1.0) {
last = 1.0;
}
}
- sprintf(string, " %g %g", first, last);
+ firstStr[0] = lastStr[0] = ' ';
+ Tcl_PrintDouble(NULL, first, firstStr+1);
+ Tcl_PrintDouble(NULL, last, lastStr+1);
/*
* We must hold onto the interpreter because the data referred to at
* listPtr might be freed as a result of the call to Tcl_VarEval.
*/
-
+
interp = listPtr->interp;
- Tcl_Preserve((ClientData) interp);
- result = Tcl_VarEval(interp, listPtr->xScrollCmd, string,
- (char *) NULL);
+ Tcl_Preserve(interp);
+ result = Tcl_VarEval(interp, listPtr->xScrollCmd, firstStr, lastStr,
+ NULL);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (horizontal scrolling command executed by listbox)");
Tcl_BackgroundError(interp);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/*
@@ -3304,60 +3359,72 @@ ListboxUpdateHScrollbar(listPtr)
*
* ListboxListVarProc --
*
- * Called whenever the trace on the listbox list var fires.
+ * Called whenever the trace on the listbox list var fires.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
static char *
-ListboxListVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about button. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Not used. */
- CONST char *name2; /* Not used. */
- int flags; /* Information about what happened. */
+ListboxListVarProc(
+ ClientData clientData, /* Information about button. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ const char *name1, /* Not used. */
+ const char *name2, /* Not used. */
+ int flags) /* Information about what happened. */
{
Listbox *listPtr = (Listbox *)clientData;
Tcl_Obj *oldListObj, *varListObj;
- int oldLength;
- int i;
+ int oldLength, i;
Tcl_HashEntry *entry;
-
- /* Bwah hahahaha -- puny mortal, you can't unset a -listvar'd variable! */
+
+ /*
+ * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable!
+ */
+
if (flags & TCL_TRACE_UNSETS) {
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
- Tcl_SetVar2Ex(interp, listPtr->listVarName,
- (char *)NULL, listPtr->listObj, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL,
+ listPtr->listObj, TCL_GLOBAL_ONLY);
Tcl_TraceVar(interp, listPtr->listVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ListboxListVarProc, clientData);
- return (char *)NULL;
+ return NULL;
}
} else {
oldListObj = listPtr->listObj;
varListObj = Tcl_GetVar2Ex(listPtr->interp, listPtr->listVarName,
- (char *)NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
+
/*
- * Make sure the new value is a good list; if it's not, disallow
- * the change -- the fact that it is a listvar means that it must
- * always be a valid list -- and return an error message.
+ * Make sure the new value is a good list; if it's not, disallow the
+ * change - the fact that it is a listvar means that it must always be
+ * a valid list - and return an error message.
*/
+
if (Tcl_ListObjLength(listPtr->interp, varListObj, &i) != TCL_OK) {
- Tcl_SetVar2Ex(interp, listPtr->listVarName, (char *)NULL,
- oldListObj, TCL_GLOBAL_ONLY);
- return("invalid listvar value");
+ Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL, oldListObj,
+ TCL_GLOBAL_ONLY);
+ return (char *) "invalid listvar value";
}
-
+
listPtr->listObj = varListObj;
- /* Incr the obj ref count so it doesn't vanish if the var is unset */
+
+ /*
+ * Incr the obj ref count so it doesn't vanish if the var is unset.
+ */
+
Tcl_IncrRefCount(listPtr->listObj);
- /* Clean up the ref to our old list obj */
+
+ /*
+ * Clean up the ref to our old list obj.
+ */
+
Tcl_DecrRefCount(oldListObj);
}
@@ -3365,21 +3432,29 @@ ListboxListVarProc(clientData, interp, name1, name2, flags)
* If the list length has decreased, then we should clean up selection and
* attributes information for elements past the end of the new list
*/
+
oldLength = listPtr->nElements;
Tcl_ListObjLength(listPtr->interp, listPtr->listObj, &listPtr->nElements);
if (listPtr->nElements < oldLength) {
for (i = listPtr->nElements; i < oldLength; i++) {
- /* Clean up selection */
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ /*
+ * Clean up selection.
+ */
+
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
listPtr->numSelected--;
Tcl_DeleteHashEntry(entry);
}
- /* Clean up attributes */
- entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *)i);
+ /*
+ * Clean up attributes.
+ */
+
+ entry = Tcl_FindHashEntry(listPtr->itemAttrTable,
+ (char *) INT2PTR(i));
if (entry != NULL) {
- ckfree((char *)Tcl_GetHashValue(entry));
+ ckfree((char *) Tcl_GetHashValue(entry));
Tcl_DeleteHashEntry(entry);
}
}
@@ -3398,14 +3473,15 @@ ListboxListVarProc(clientData, interp, name1, name2, flags)
/*
* The computed maxWidth may have changed as a result of this operation.
* However, we don't want to recompute it every time this trace fires
- * (imagine the user doing 1000 lappends to the listvar). Therefore, set
+ * (imagine the user doing 1000 lappends to the listvar). Therefore, set
* the MAXWIDTH_IS_STALE flag, which will cause the width to be recomputed
* next time the list is redrawn.
*/
+
listPtr->flags |= MAXWIDTH_IS_STALE;
-
+
EventuallyRedrawRange(listPtr, 0, listPtr->nElements-1);
- return (char*)NULL;
+ return NULL;
}
/*
@@ -3413,10 +3489,10 @@ ListboxListVarProc(clientData, interp, name1, name2, flags)
*
* MigrateHashEntries --
*
- * Given a hash table with entries keyed by a single integer value,
- * move all entries in a given range by a fixed amount, so that
- * if in the original table there was an entry with key n and
- * the offset was i, in the new table that entry would have key n + i.
+ * Given a hash table with entries keyed by a single integer value, move
+ * all entries in a given range by a fixed amount, so that if in the
+ * original table there was an entry with key n and the offset was i, in
+ * the new table that entry would have key n + i.
*
* Results:
* None.
@@ -3428,39 +3504,45 @@ ListboxListVarProc(clientData, interp, name1, name2, flags)
*/
static void
-MigrateHashEntries(table, first, last, offset)
- Tcl_HashTable *table;
- int first;
- int last;
- int offset;
+MigrateHashEntries(
+ Tcl_HashTable *table,
+ int first,
+ int last,
+ int offset)
{
- int i, new;
+ int i, isNew;
Tcl_HashEntry *entry;
ClientData clientData;
if (offset == 0) {
return;
}
- /* It's more efficient to do one if/else and nest the for loops inside,
+
+ /*
+ * It's more efficient to do one if/else and nest the for loops inside,
* although we could avoid some code duplication if we nested the if/else
- * inside the for loops */
+ * inside the for loops.
+ */
+
if (offset > 0) {
for (i = last; i >= first; i--) {
- entry = Tcl_FindHashEntry(table, (char *)i);
+ entry = Tcl_FindHashEntry(table, (char *) INT2PTR(i));
if (entry != NULL) {
clientData = Tcl_GetHashValue(entry);
Tcl_DeleteHashEntry(entry);
- entry = Tcl_CreateHashEntry(table, (char *)(i + offset), &new);
+ entry = Tcl_CreateHashEntry(table,
+ (char *) INT2PTR(i + offset), &isNew);
Tcl_SetHashValue(entry, clientData);
}
}
} else {
for (i = first; i <= last; i++) {
- entry = Tcl_FindHashEntry(table, (char *)i);
+ entry = Tcl_FindHashEntry(table, (char *) INT2PTR(i));
if (entry != NULL) {
clientData = Tcl_GetHashValue(entry);
Tcl_DeleteHashEntry(entry);
- entry = Tcl_CreateHashEntry(table, (char *)(i + offset), &new);
+ entry = Tcl_CreateHashEntry(table,
+ (char *) INT2PTR(i + offset), &isNew);
Tcl_SetHashValue(entry, clientData);
}
}
@@ -3468,3 +3550,10 @@ MigrateHashEntries(table, first, last, offset)
return;
}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c
index 7138c7d..9351de1 100644
--- a/generic/tkMacWinMenu.c
+++ b/generic/tkMacWinMenu.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkMacWinMenu.c --
*
* This module implements the common elements of the Mac and Windows
@@ -6,10 +6,11 @@
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkMenu.h"
typedef struct ThreadSpecificData {
@@ -17,9 +18,7 @@ typedef struct ThreadSpecificData {
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-
-static int PreprocessMenu _ANSI_ARGS_((TkMenu *menuPtr));
-
+static int PreprocessMenu(TkMenu *menuPtr);
/*
*----------------------------------------------------------------------
@@ -29,8 +28,8 @@ static int PreprocessMenu _ANSI_ARGS_((TkMenu *menuPtr));
* The guts of the preprocessing. Recursive.
*
* Results:
- * The return value is a standard Tcl result (errors can occur
- * while the postcommands are being processed).
+ * The return value is a standard Tcl result (errors can occur while the
+ * postcommands are being processed).
*
* Side effects:
* Since commands can get executed while this routine is being executed,
@@ -40,61 +39,59 @@ static int PreprocessMenu _ANSI_ARGS_((TkMenu *menuPtr));
*/
static int
-PreprocessMenu(menuPtr)
- TkMenu *menuPtr;
+PreprocessMenu(
+ TkMenu *menuPtr)
{
int index, result, finished;
- TkMenu *cascadeMenuPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
Tcl_Preserve((ClientData) menuPtr);
-
+
/*
* First, let's process the post command on ourselves. If this command
* destroys this menu, or if there was an error, we are done.
*/
-
+
result = TkPostCommand(menuPtr);
if ((result != TCL_OK) || (menuPtr->tkwin == NULL)) {
- goto done;
+ goto done;
}
-
+
/*
- * Now, we go through structure and process all of the commands.
- * Since the structure is changing, we stop after we do one command,
- * and start over. When we get through without doing any, we are done.
+ * Now, we go through structure and process all of the commands. Since the
+ * structure is changing, we stop after we do one command, and start over.
+ * When we get through without doing any, we are done.
*/
-
-
+
do {
- finished = 1;
- for (index = 0; index < menuPtr->numEntries; index++) {
- if ((menuPtr->entries[index]->type == CASCADE_ENTRY)
- && (menuPtr->entries[index]->namePtr != NULL)) {
- if ((menuPtr->entries[index]->childMenuRefPtr != NULL)
- && (menuPtr->entries[index]->childMenuRefPtr->menuPtr
- != NULL)) {
- cascadeMenuPtr =
- menuPtr->entries[index]->childMenuRefPtr->menuPtr;
- if (cascadeMenuPtr->postCommandGeneration !=
- tsdPtr->postCommandGeneration) {
- cascadeMenuPtr->postCommandGeneration =
- tsdPtr->postCommandGeneration;
- result = PreprocessMenu(cascadeMenuPtr);
- if (result != TCL_OK) {
- goto done;
- }
- finished = 0;
- break;
- }
- }
- }
- }
+ finished = 1;
+ for (index = 0; index < menuPtr->numEntries; index++) {
+ register TkMenuEntry *entryPtr = menuPtr->entries[index];
+
+ if ((entryPtr->type == CASCADE_ENTRY)
+ && (entryPtr->namePtr != NULL)
+ && (entryPtr->childMenuRefPtr != NULL)
+ && (entryPtr->childMenuRefPtr->menuPtr != NULL)) {
+ TkMenu *cascadeMenuPtr = entryPtr->childMenuRefPtr->menuPtr;
+
+ if (cascadeMenuPtr->postCommandGeneration !=
+ tsdPtr->postCommandGeneration) {
+ cascadeMenuPtr->postCommandGeneration =
+ tsdPtr->postCommandGeneration;
+ result = PreprocessMenu(cascadeMenuPtr);
+ if (result != TCL_OK) {
+ goto done;
+ }
+ finished = 0;
+ break;
+ }
+ }
+ }
} while (!finished);
-
- done:
- Tcl_Release((ClientData)menuPtr);
+
+ done:
+ Tcl_Release((ClientData) menuPtr);
return result;
}
@@ -103,23 +100,23 @@ PreprocessMenu(menuPtr)
*
* TkPreprocessMenu --
*
- * On the Mac and on Windows, all of the postcommand processing has
- * to be done on the entire tree underneath the main window to be
- * posted. This means that we have to traverse the menu tree and
- * issue the postcommands for all of the menus that have cascades
- * attached. Since the postcommands can change the menu structure while
- * we are traversing, we have to be extremely careful. Basically, the
- * idea is to traverse the structure until we succesfully process
- * one postcommand. Then we start over, and do it again until
- * we traverse the whole structure without processing any postcommands.
+ * On the Mac and on Windows, all of the postcommand processing has to be
+ * done on the entire tree underneath the main window to be posted. This
+ * means that we have to traverse the menu tree and issue the
+ * postcommands for all of the menus that have cascades attached. Since
+ * the postcommands can change the menu structure while we are
+ * traversing, we have to be extremely careful. Basically, the idea is to
+ * traverse the structure until we succesfully process one postcommand.
+ * Then we start over, and do it again until we traverse the whole
+ * structure without processing any postcommands.
*
- * We are also going to set up the cascade back pointers in here
- * since we have to traverse the entire structure underneath the menu
- * anyway, We can clear the postcommand marks while we do that.
+ * We are also going to set up the cascade back pointers in here since we
+ * have to traverse the entire structure underneath the menu anyway. We
+ * can clear the postcommand marks while we do that.
*
* Results:
- * The return value is a standard Tcl result (errors can occur
- * while the postcommands are being processed).
+ * The return value is a standard Tcl result (errors can occur while the
+ * postcommands are being processed).
*
* Side effects:
* Since commands can get executed while this routine is being executed,
@@ -129,13 +126,21 @@ PreprocessMenu(menuPtr)
*/
int
-TkPreprocessMenu(menuPtr)
- TkMenu *menuPtr;
+TkPreprocessMenu(
+ TkMenu *menuPtr)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->postCommandGeneration++;
menuPtr->postCommandGeneration = tsdPtr->postCommandGeneration;
return PreprocessMenu(menuPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 34f9054..39465c9 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -1,31 +1,21 @@
-/*
+/*
* tkMain.c --
*
* This file contains a generic main program for Tk-based applications.
* It can be used as-is for many applications, just by supplying a
- * different appInitProc procedure for each specific application.
- * Or, it can be used as a template for creating new main programs
- * for Tk applications.
+ * different appInitProc function for each specific application. Or, it
+ * can be used as a template for creating new main programs for Tk
+ * applications.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <tcl.h>
-#include <tclInt.h>
-#include <tk.h>
+#include "tclInt.h"
#include "tkInt.h"
-#ifdef NO_STDLIB_H
-# include "../compat/stdlib.h"
-#else
-# include <stdlib.h>
-#endif
#ifdef __WIN32__
#include "tkWinInt.h"
#endif
@@ -35,42 +25,36 @@
typedef struct ThreadSpecificData {
- Tcl_Interp *interp; /* Interpreter for this thread. */
- Tcl_DString command; /* Used to assemble lines of terminal input
+ Tcl_Interp *interp; /* Interpreter for this thread. */
+ Tcl_DString command; /* Used to assemble lines of terminal input
* into Tcl commands. */
- Tcl_DString line; /* Used to read the next line from the
+ Tcl_DString line; /* Used to read the next line from the
* terminal input. */
- int tty; /* Non-zero means standard input is a
- * terminal-like device. Zero means it's
- * a file. */
+ int tty; /* Non-zero means standard input is a
+ * terminal-like device. Zero means it's a
+ * file. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Declarations for various library procedures and variables (don't want
- * to include tkInt.h or tkPort.h here, because people might copy this
- * file out of the Tk source directory to make their own modified versions).
- * Note: don't declare "exit" here even though a declaration is really
- * needed, because it will conflict with a declaration elsewhere on
- * some systems.
+ * Declarations for various library functions and variables (don't want to
+ * include tkInt.h or tkPort.h here, because people might copy this file out
+ * of the Tk source directory to make their own modified versions). Note: do
+ * not declare "exit" here even though a declaration is really needed, because
+ * it will conflict with a declaration elsewhere on some systems.
*/
#if !defined(__WIN32__) && !defined(_WIN32)
-#if !defined(MAC_TCL)
-extern int isatty _ANSI_ARGS_((int fd));
-#else
-#include <unistd.h>
-#endif
-extern char * strrchr _ANSI_ARGS_((CONST char *string, int c));
+extern int isatty(int fd);
+extern char * strrchr(CONST char *string, int c);
#endif
/*
- * Forward declarations for procedures defined later in this file.
+ * Forward declarations for functions defined later in this file.
*/
-static void Prompt _ANSI_ARGS_((Tcl_Interp *interp, int partial));
-static void StdinProc _ANSI_ARGS_((ClientData clientData,
- int mask));
+static void Prompt(Tcl_Interp *interp, int partial);
+static void StdinProc(ClientData clientData, int mask);
/*
*----------------------------------------------------------------------
@@ -80,98 +64,113 @@ static void StdinProc _ANSI_ARGS_((ClientData clientData,
* Main program for Wish and most other Tk-based applications.
*
* Results:
- * None. This procedure never returns (it exits the process when
- * it's done.
+ * None. This function never returns (it exits the process when it's
+ * done.
*
* Side effects:
- * This procedure initializes the Tk world and then starts
- * interpreting commands; almost anything could happen, depending
- * on the script being interpreted.
+ * This function initializes the Tk world and then starts interpreting
+ * commands; almost anything could happen, depending on the script being
+ * interpreted.
*
*----------------------------------------------------------------------
*/
+
void
-Tk_MainEx(argc, argv, appInitProc, interp)
- int argc; /* Number of arguments. */
- char **argv; /* Array of argument strings. */
- Tcl_AppInitProc *appInitProc; /* Application-specific initialization
- * procedure to call after most
- * initialization but before starting
- * to execute commands. */
- Tcl_Interp *interp;
+Tk_MainEx(
+ int argc, /* Number of arguments. */
+ char **argv, /* Array of argument strings. */
+ Tcl_AppInitProc *appInitProc,
+ /* Application-specific initialization
+ * function to call after most initialization
+ * but before starting to execute commands. */
+ Tcl_Interp *interp)
{
- Tcl_Obj *argvPtr;
+ Tcl_Obj *path, *argvPtr;
+ CONST char *encodingName;
int code, nullStdin = 0;
- size_t length;
Tcl_Channel inChannel, outChannel;
- Tcl_DString appName;
ThreadSpecificData *tsdPtr;
#ifdef __WIN32__
HANDLE handle;
#endif
+ Tcl_DString appName;
/*
- * Ensure that we are getting the matching version of Tcl. This is
- * really only an issue when Tk is loaded dynamically.
+ * Ensure that we are getting the matching version of Tcl. This is really
+ * only an issue when Tk is loaded dynamically.
*/
- if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+ if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
abort();
}
- tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
Tcl_FindExecutable(argv[0]);
tsdPtr->interp = interp;
Tcl_Preserve((ClientData) interp);
-#if (defined(__WIN32__) || defined(MAC_TCL))
+#if defined(__WIN32__)
Tk_InitConsoleChannels(interp);
#endif
#ifdef MAC_OSX_TK
- if (TclGetStartupScriptFileName() == NULL) {
- TkMacOSXDefaultStartupScript();
+ if (Tcl_GetStartupScript(NULL) == NULL) {
+ TkMacOSXDefaultStartupScript();
}
#endif
-
+
#ifdef TCL_MEM_DEBUG
Tcl_InitMemory(interp);
#endif
/*
- * Parse command-line arguments. A leading "-file" argument is
- * ignored (a historical relic from the distant past). If the
- * next argument doesn't start with a "-" then strip it off and
- * use it as the name of a script file to process.
+ * If the application has not already set a startup script, parse the
+ * first few command line arguments to determine the script path and
+ * encoding.
*/
- if (argc > 1) {
- length = strlen(argv[1]);
- if ((length >= 2) && (strncmp(argv[1], "-file", length) == 0)) {
- argc--;
- argv++;
- }
- }
- if (TclGetStartupScriptFileName() == NULL) {
- if ((argc > 1) && (argv[1][0] != '-')) {
- TclSetStartupScriptFileName(argv[1]);
+ if (NULL == Tcl_GetStartupScript(NULL)) {
+ size_t length;
+
+ /*
+ * Check whether first 3 args (argv[1] - argv[3]) look like
+ * -encoding ENCODING FILENAME
+ * or like
+ * FILENAME
+ * or like
+ * -file FILENAME (ancient history support only)
+ */
+
+ if ((argc > 3) && (0 == strcmp("-encoding", argv[1]))
+ && ('-' != argv[3][0])) {
+ Tcl_SetStartupScript(Tcl_NewStringObj(argv[3], -1), argv[2]);
+ argc -= 3;
+ argv += 3;
+ } else if ((argc > 1) && ('-' != argv[1][0])) {
+ Tcl_SetStartupScript(Tcl_NewStringObj(argv[1], -1), NULL);
argc--;
argv++;
+ } else if ((argc > 2) && (length = strlen(argv[1]))
+ && (length > 1) && (0 == strncmp("-file", argv[1], length))
+ && ('-' != argv[2][0])) {
+ Tcl_SetStartupScript(Tcl_NewStringObj(argv[2], -1), NULL);
+ argc -= 2;
+ argv += 2;
}
}
-
- /*
- * Make command-line arguments available in the Tcl variables "argc"
- * and "argv".
- */
- if (TclGetStartupScriptFileName() == NULL) {
+ path = Tcl_GetStartupScript(&encodingName);
+ if (NULL == path) {
Tcl_ExternalToUtfDString(NULL, argv[0], -1, &appName);
} else {
- TclSetStartupScriptFileName(Tcl_ExternalToUtfDString(NULL,
- TclGetStartupScriptFileName(), -1, &appName));
+ int numBytes;
+ CONST char *pathName = Tcl_GetStringFromObj(path, &numBytes);
+
+ Tcl_ExternalToUtfDString(NULL, pathName, numBytes, &appName);
+ path = Tcl_NewStringObj(Tcl_DStringValue(&appName), -1);
+ Tcl_SetStartupScript(path, encodingName);
}
Tcl_SetVar(interp, "argv0", Tcl_DStringValue(&appName), TCL_GLOBAL_ONLY);
Tcl_DStringFree(&appName);
@@ -183,6 +182,7 @@ Tk_MainEx(argc, argv, appInitProc, interp)
argvPtr = Tcl_NewListObj(0, NULL);
while (argc--) {
Tcl_DString ds;
+
Tcl_ExternalToUtfDString(NULL, *argv++, -1, &ds);
Tcl_ListObjAppendElement(NULL, argvPtr, Tcl_NewStringObj(
Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)));
@@ -197,18 +197,18 @@ Tk_MainEx(argc, argv, appInitProc, interp)
#ifdef __WIN32__
/*
* For now, under Windows, we assume we are not running as a console mode
- * app, so we need to use the GUI console. In order to enable this, we
- * always claim to be running on a tty. This probably isn't the right
- * way to do it.
+ * app, so we need to use the GUI console. In order to enable this, we
+ * always claim to be running on a tty. This probably isn't the right way
+ * to do it.
*/
handle = GetStdHandle(STD_INPUT_HANDLE);
- if ((handle == INVALID_HANDLE_VALUE) || (handle == 0)
+ if ((handle == INVALID_HANDLE_VALUE) || (handle == 0)
|| (GetFileType(handle) == FILE_TYPE_UNKNOWN)) {
/*
- * If it's a bad or closed handle, then it's been connected
- * to a wish console window.
+ * If it's a bad or closed handle, then it's been connected to a wish
+ * console window.
*/
tsdPtr->tty = 1;
@@ -239,8 +239,8 @@ Tk_MainEx(argc, argv, appInitProc, interp)
}
#endif
Tcl_SetVar(interp, "tcl_interactive",
- ((TclGetStartupScriptFileName() == NULL) && (tsdPtr->tty
- || nullStdin)) ? "1" : "0", TCL_GLOBAL_ONLY);
+ ((path == NULL) && (tsdPtr->tty || nullStdin)) ? "1" : "0",
+ TCL_GLOBAL_ONLY);
/*
* Invoke application-specific initialization.
@@ -252,16 +252,18 @@ Tk_MainEx(argc, argv, appInitProc, interp)
}
/*
- * Invoke the script specified on the command line, if any.
+ * Invoke the script specified on the command line, if any. Must fetch it
+ * again, as the appInitProc might have reset it.
*/
- if (TclGetStartupScriptFileName() != NULL) {
+ path = Tcl_GetStartupScript(&encodingName);
+ if (path != NULL) {
Tcl_ResetResult(interp);
- code = Tcl_EvalFile(interp, TclGetStartupScriptFileName());
+ code = Tcl_FSEvalFileEx(interp, path, encodingName);
if (code != TCL_OK) {
/*
- * The following statement guarantees that the errorInfo
- * variable is set properly.
+ * The following statement guarantees that the errorInfo variable
+ * is set properly.
*/
Tcl_AddErrorInfo(interp, "");
@@ -302,13 +304,14 @@ Tk_MainEx(argc, argv, appInitProc, interp)
Tcl_ResetResult(interp);
/*
- * Loop infinitely, waiting for commands to execute. When there
- * are no windows left, Tk_MainLoop returns and we exit.
+ * Loop infinitely, waiting for commands to execute. When there are no
+ * windows left, Tk_MainLoop returns and we exit.
*/
Tk_MainLoop();
Tcl_DeleteInterp(interp);
Tcl_Release((ClientData) interp);
+ Tcl_SetStartupScript(NULL, NULL);
Tcl_Exit(0);
}
@@ -317,69 +320,65 @@ Tk_MainEx(argc, argv, appInitProc, interp)
*
* StdinProc --
*
- * This procedure is invoked by the event dispatcher whenever
- * standard input becomes readable. It grabs the next line of
- * input characters, adds them to a command being assembled, and
- * executes the command if it's complete.
+ * This function is invoked by the event dispatcher whenever standard
+ * input becomes readable. It grabs the next line of input characters,
+ * adds them to a command being assembled, and executes the command if
+ * it's complete.
*
* Results:
* None.
*
* Side effects:
- * Could be almost arbitrary, depending on the command that's
- * typed.
+ * Could be almost arbitrary, depending on the command that's typed.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
-StdinProc(clientData, mask)
- ClientData clientData; /* Not used. */
- int mask; /* Not used. */
+StdinProc(
+ ClientData clientData, /* Not used. */
+ int mask) /* Not used. */
{
static int gotPartial = 0;
char *cmd;
int code, count;
Tcl_Channel chan = (Tcl_Channel) clientData;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *interp = tsdPtr->interp;
count = Tcl_Gets(chan, &tsdPtr->line);
- if (count < 0) {
- if (!gotPartial) {
- if (tsdPtr->tty) {
- Tcl_Exit(0);
- } else {
- Tcl_DeleteChannelHandler(chan, StdinProc, (ClientData) chan);
- }
- return;
- }
+ if (count < 0 && !gotPartial) {
+ if (tsdPtr->tty) {
+ Tcl_Exit(0);
+ } else {
+ Tcl_DeleteChannelHandler(chan, StdinProc, (ClientData) chan);
+ }
+ return;
}
(void) Tcl_DStringAppend(&tsdPtr->command, Tcl_DStringValue(
- &tsdPtr->line), -1);
+ &tsdPtr->line), -1);
cmd = Tcl_DStringAppend(&tsdPtr->command, "\n", -1);
Tcl_DStringFree(&tsdPtr->line);
if (!Tcl_CommandComplete(cmd)) {
- gotPartial = 1;
- goto prompt;
+ gotPartial = 1;
+ goto prompt;
}
gotPartial = 0;
/*
* Disable the stdin channel handler while evaluating the command;
- * otherwise if the command re-enters the event loop we might
- * process commands from stdin before the current command is
- * finished. Among other things, this will trash the text of the
- * command being evaluated.
+ * otherwise if the command re-enters the event loop we might process
+ * commands from stdin before the current command is finished. Among other
+ * things, this will trash the text of the command being evaluated.
*/
Tcl_CreateChannelHandler(chan, 0, StdinProc, (ClientData) chan);
code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL);
-
+
chan = Tcl_GetStdChannel(TCL_STDIN);
if (chan) {
Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc,
@@ -400,7 +399,7 @@ StdinProc(clientData, mask)
* Output a prompt.
*/
- prompt:
+ prompt:
if (tsdPtr->tty) {
Prompt(interp, gotPartial);
}
@@ -412,25 +411,24 @@ StdinProc(clientData, mask)
*
* Prompt --
*
- * Issue a prompt on standard output, or invoke a script
- * to issue the prompt.
+ * Issue a prompt on standard output, or invoke a script to issue the
+ * prompt.
*
* Results:
* None.
*
* Side effects:
- * A prompt gets output, and a Tcl script may be evaluated
- * in interp.
+ * A prompt gets output, and a Tcl script may be evaluated in interp.
*
*----------------------------------------------------------------------
*/
static void
-Prompt(interp, partial)
- Tcl_Interp *interp; /* Interpreter to use for prompting. */
- int partial; /* Non-zero means there already
- * exists a partial command, so use
- * the secondary prompt. */
+Prompt(
+ Tcl_Interp *interp, /* Interpreter to use for prompting. */
+ int partial) /* Non-zero means there already exists a
+ * partial command, so use the secondary
+ * prompt. */
{
Tcl_Obj *promptCmd;
int code;
@@ -439,41 +437,49 @@ Prompt(interp, partial)
promptCmd = Tcl_GetVar2Ex(interp,
partial ? "tcl_prompt2" : "tcl_prompt1", NULL, TCL_GLOBAL_ONLY);
if (promptCmd == NULL) {
-defaultPrompt:
+ defaultPrompt:
if (!partial) {
-
- /*
- * We must check that outChannel is a real channel - it
- * is possible that someone has transferred stdout out of
- * this interpreter with "interp transfer".
- */
+ /*
+ * We must check that outChannel is a real channel - it is
+ * possible that someone has transferred stdout out of this
+ * interpreter with "interp transfer".
+ */
outChannel = Tcl_GetChannel(interp, "stdout", NULL);
- if (outChannel != (Tcl_Channel) NULL) {
- Tcl_WriteChars(outChannel, "% ", 2);
- }
+ if (outChannel != (Tcl_Channel) NULL) {
+ Tcl_WriteChars(outChannel, "% ", 2);
+ }
}
} else {
code = Tcl_EvalObjEx(interp, promptCmd, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (script that generates prompt)");
- /*
- * We must check that errChannel is a real channel - it
- * is possible that someone has transferred stderr out of
- * this interpreter with "interp transfer".
- */
-
+
+ /*
+ * We must check that errChannel is a real channel - it is
+ * possible that someone has transferred stderr out of this
+ * interpreter with "interp transfer".
+ */
+
errChannel = Tcl_GetChannel(interp, "stderr", NULL);
- if (errChannel != (Tcl_Channel) NULL) {
- Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp));
- Tcl_WriteChars(errChannel, "\n", 1);
- }
+ if (errChannel != (Tcl_Channel) NULL) {
+ Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp));
+ Tcl_WriteChars(errChannel, "\n", 1);
+ }
goto defaultPrompt;
}
}
outChannel = Tcl_GetChannel(interp, "stdout", NULL);
if (outChannel != (Tcl_Channel) NULL) {
- Tcl_Flush(outChannel);
+ Tcl_Flush(outChannel);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index c996df8..15af7a2 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -1,16 +1,16 @@
-/*
+/*
* tkMenu.c --
*
* This file contains most of the code for implementing menus in Tk. It takes
- * care of all of the generic (platform-independent) parts of menus, and
- * is supplemented by platform-specific files. The geometry calculation
- * and drawing code for menus is in the file tkMenuDraw.c
+ * care of all of the generic (platform-independent) parts of menus, and is
+ * supplemented by platform-specific files. The geometry calculation and
+ * drawing code for menus is in the file tkMenuDraw.c
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/*
@@ -18,52 +18,49 @@
*
* Menus can be used in three ways:
* - as a popup menu, either as part of a menubutton or standalone.
- * - as a menubar. The menu's cascade items are arranged according to
- * the specific platform to provide the user access to the menus at all
- * times
+ * - as a menubar. The menu's cascade items are arranged according to the
+ * specific platform to provide the user access to the menus at all times
* - as a tearoff palette. This is a window with the menu's items in it.
*
- * The goal is to provide the Tk developer with a way to use a common
- * set of menus for all of these tasks.
+ * The goal is to provide the Tk developer with a way to use a common set of
+ * menus for all of these tasks.
*
* In order to make the bindings for cascade menus work properly under Unix,
- * the cascade menus' pathnames must be proper children of the menu that
- * they are cascade from. So if there is a menu .m, and it has two
- * cascades labelled "File" and "Edit", the cascade menus might have
- * the pathnames .m.file and .m.edit. Another constraint is that the menus
- * used for menubars must be children of the toplevel widget that they
- * are attached to. And on the Macintosh, the platform specific menu handle
- * for cascades attached to a menu bar must have a title that matches the
- * label for the cascade menu.
+ * the cascade menus' pathnames must be proper children of the menu that they
+ * are cascade from. So if there is a menu .m, and it has two cascades
+ * labelled "File" and "Edit", the cascade menus might have the pathnames
+ * .m.file and .m.edit. Another constraint is that the menus used for menubars
+ * must be children of the toplevel widget that they are attached to. And on
+ * the Macintosh, the platform specific menu handle for cascades attached to a
+ * menu bar must have a title that matches the label for the cascade menu.
*
* To handle all of the constraints, Tk menubars and tearoff menus are
* implemented using menu clones. Menu clones are full menus in their own
- * right; they have a Tk window and pathname associated with them; they have
- * a TkMenu structure and array of entries. However, they are linked with the
- * original menu that they were cloned from. The reflect the attributes of
- * the original, or "master", menu. So if an item is added to a menu, and
- * that menu has clones, then the item must be added to all of its clones
- * also. Menus are cloned when a menu is torn-off or when a menu is assigned
- * as a menubar using the "-menu" option of the toplevel's pathname configure
+ * right; they have a Tk window and pathname associated with them; they have a
+ * TkMenu structure and array of entries. However, they are linked with the
+ * original menu that they were cloned from. The reflect the attributes of the
+ * original, or "master", menu. So if an item is added to a menu, and that
+ * menu has clones, then the item must be added to all of its clones also.
+ * Menus are cloned when a menu is torn-off or when a menu is assigned as a
+ * menubar using the "-menu" option of the toplevel's pathname configure
* subcommand. When a clone is destroyed, only the clone is destroyed, but
* when the master menu is destroyed, all clones are also destroyed. This
- * allows the developer to just deal with one set of menus when creating
- * and destroying.
+ * allows the developer to just deal with one set of menus when creating and
+ * destroying.
*
* Clones are rather tricky when a menu with cascade entries is cloned (such
* as a menubar). Not only does the menu have to be cloned, but each cascade
* entry's corresponding menu must also be cloned. This maintains the pathname
- * parent-child hierarchy necessary for menubars and toplevels to work.
- * This leads to several special cases:
+ * parent-child hierarchy necessary for menubars and toplevels to work. This
+ * leads to several special cases:
*
* 1. When a new menu is created, and it is pointed to by cascade entries in
* cloned menus, the new menu has to be cloned to parallel the cascade
* structure.
* 2. When a cascade item is added to a menu that has been cloned, and the
* menu that the cascade item points to exists, that menu has to be cloned.
- * 3. When the menu that a cascade entry points to is changed, the old
- * cloned cascade menu has to be discarded, and the new one has to be cloned.
- *
+ * 3. When the menu that a cascade entry points to is changed, the old cloned
+ * cascade menu has to be discarded, and the new one has to be cloned.
*/
#if 0
@@ -75,22 +72,21 @@
#define __NO_OLD_CONFIG
#endif
-#include "tkPort.h"
+#include "tkInt.h"
#include "tkMenu.h"
#define MENU_HASH_KEY "tkMenus"
typedef struct ThreadSpecificData {
- int menusInitialized; /* Flag indicates whether thread-specific
- * elements of the Windows Menu module
- * have been initialized. */
+ int menusInitialized; /* Flag indicates whether thread-specific
+ * elements of the Windows Menu module have
+ * been initialized. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * The following flag indicates whether the process-wide state for
- * the Menu module has been intialized. The Mutex protects access to
- * that flag.
+ * The following flag indicates whether the process-wide state for the Menu
+ * module has been intialized. The Mutex protects access to that flag.
*/
static int menusInitialized;
@@ -101,170 +97,171 @@ TCL_DECLARE_MUTEX(menuMutex)
* to update code in TkpMenuInit that changes the font string entry.
*/
-char *tkMenuStateStrings[] = {"active", "normal", "disabled", (char *) NULL};
+char *tkMenuStateStrings[] = {"active", "normal", "disabled", NULL};
static CONST char *menuEntryTypeStrings[] = {
- "cascade", "checkbutton", "command", "radiobutton", "separator",
- (char *) NULL
+ "cascade", "checkbutton", "command", "radiobutton", "separator", NULL
};
/*
- * The following table defines the legal values for the -compound option.
- * It is used with the "enum compound" declaration in tkMenu.h
+ * The following table defines the legal values for the -compound option. It
+ * is used with the "enum compound" declaration in tkMenu.h
*/
static char *compoundStrings[] = {
- "bottom", "center", "left", "none", "right", "top", (char *) NULL
+ "bottom", "center", "left", "none", "right", "top", NULL
};
-static Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
- {TK_OPTION_BORDER, "-activebackground", (char *) NULL, (char *) NULL,
- DEF_MENU_ENTRY_ACTIVE_BG, Tk_Offset(TkMenuEntry, activeBorderPtr), -1,
+static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
+ {TK_OPTION_BORDER, "-activebackground", NULL, NULL,
+ DEF_MENU_ENTRY_ACTIVE_BG, Tk_Offset(TkMenuEntry, activeBorderPtr), -1,
TK_OPTION_NULL_OK},
- {TK_OPTION_COLOR, "-activeforeground", (char *) NULL, (char *) NULL,
+ {TK_OPTION_COLOR, "-activeforeground", NULL, NULL,
DEF_MENU_ENTRY_ACTIVE_FG,
Tk_Offset(TkMenuEntry, activeFgPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING, "-accelerator", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-accelerator", NULL, NULL,
DEF_MENU_ENTRY_ACCELERATOR,
Tk_Offset(TkMenuEntry, accelPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_BORDER, "-background", (char *) NULL, (char *) NULL,
+ {TK_OPTION_BORDER, "-background", NULL, NULL,
DEF_MENU_ENTRY_BG,
Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_BITMAP, "-bitmap", (char *) NULL, (char *) NULL,
+ {TK_OPTION_BITMAP, "-bitmap", NULL, NULL,
DEF_MENU_ENTRY_BITMAP,
Tk_Offset(TkMenuEntry, bitmapPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_BOOLEAN, "-columnbreak", (char *) NULL, (char *) NULL,
+ {TK_OPTION_BOOLEAN, "-columnbreak", NULL, NULL,
DEF_MENU_ENTRY_COLUMN_BREAK,
-1, Tk_Offset(TkMenuEntry, columnBreak)},
- {TK_OPTION_STRING, "-command", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-command", NULL, NULL,
DEF_MENU_ENTRY_COMMAND,
Tk_Offset(TkMenuEntry, commandPtr), -1, TK_OPTION_NULL_OK},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_MENU_ENTRY_COMPOUND, -1, Tk_Offset(TkMenuEntry, compound), 0,
+ DEF_MENU_ENTRY_COMPOUND, -1, Tk_Offset(TkMenuEntry, compound), 0,
(ClientData) compoundStrings, 0},
- {TK_OPTION_FONT, "-font", (char *) NULL, (char *) NULL,
+ {TK_OPTION_FONT, "-font", NULL, NULL,
DEF_MENU_ENTRY_FONT,
Tk_Offset(TkMenuEntry, fontPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_COLOR, "-foreground", (char *) NULL, (char *) NULL,
+ {TK_OPTION_COLOR, "-foreground", NULL, NULL,
DEF_MENU_ENTRY_FG,
Tk_Offset(TkMenuEntry, fgPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_BOOLEAN, "-hidemargin", (char *) NULL, (char *) NULL,
+ {TK_OPTION_BOOLEAN, "-hidemargin", NULL, NULL,
DEF_MENU_ENTRY_HIDE_MARGIN,
-1, Tk_Offset(TkMenuEntry, hideMargin)},
- {TK_OPTION_STRING, "-image", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-image", NULL, NULL,
DEF_MENU_ENTRY_IMAGE,
Tk_Offset(TkMenuEntry, imagePtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING, "-label", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-label", NULL, NULL,
DEF_MENU_ENTRY_LABEL,
Tk_Offset(TkMenuEntry, labelPtr), -1, 0},
- {TK_OPTION_STRING_TABLE, "-state", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
DEF_MENU_ENTRY_STATE,
-1, Tk_Offset(TkMenuEntry, state), 0,
(ClientData) tkMenuStateStrings},
- {TK_OPTION_INT, "-underline", (char *) NULL, (char *) NULL,
+ {TK_OPTION_INT, "-underline", NULL, NULL,
DEF_MENU_ENTRY_UNDERLINE, -1, Tk_Offset(TkMenuEntry, underline)},
{TK_OPTION_END}
};
-static Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = {
- {TK_OPTION_BORDER, "-background", (char *) NULL, (char *) NULL,
+static const Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = {
+ {TK_OPTION_BORDER, "-background", NULL, NULL,
DEF_MENU_ENTRY_BG,
Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK},
{TK_OPTION_END}
};
-static Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = {
- {TK_OPTION_BOOLEAN, "-indicatoron", (char *) NULL, (char *) NULL,
+static const Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = {
+ {TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL,
DEF_MENU_ENTRY_INDICATOR,
-1, Tk_Offset(TkMenuEntry, indicatorOn)},
- {TK_OPTION_STRING, "-offvalue", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-offvalue", NULL, NULL,
DEF_MENU_ENTRY_OFF_VALUE,
Tk_Offset(TkMenuEntry, offValuePtr), -1},
- {TK_OPTION_STRING, "-onvalue", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-onvalue", NULL, NULL,
DEF_MENU_ENTRY_ON_VALUE,
Tk_Offset(TkMenuEntry, onValuePtr), -1},
- {TK_OPTION_COLOR, "-selectcolor", (char *) NULL, (char *) NULL,
+ {TK_OPTION_COLOR, "-selectcolor", NULL, NULL,
DEF_MENU_ENTRY_SELECT,
Tk_Offset(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING, "-selectimage", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-selectimage", NULL, NULL,
DEF_MENU_ENTRY_SELECT_IMAGE,
Tk_Offset(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING, "-variable", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-variable", NULL, NULL,
DEF_MENU_ENTRY_CHECK_VARIABLE,
Tk_Offset(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs}
+ {TK_OPTION_END, NULL, NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs}
};
-static Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = {
- {TK_OPTION_BOOLEAN, "-indicatoron", (char *) NULL, (char *) NULL,
+static const Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = {
+ {TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL,
DEF_MENU_ENTRY_INDICATOR,
-1, Tk_Offset(TkMenuEntry, indicatorOn)},
- {TK_OPTION_COLOR, "-selectcolor", (char *) NULL, (char *) NULL,
+ {TK_OPTION_COLOR, "-selectcolor", NULL, NULL,
DEF_MENU_ENTRY_SELECT,
Tk_Offset(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING, "-selectimage", (char *) NULL, (char *) NULL,
- DEF_MENU_ENTRY_SELECT_IMAGE,
+ {TK_OPTION_STRING, "-selectimage", NULL, NULL,
+ DEF_MENU_ENTRY_SELECT_IMAGE,
Tk_Offset(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING, "-value", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-value", NULL, NULL,
DEF_MENU_ENTRY_VALUE,
Tk_Offset(TkMenuEntry, onValuePtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING, "-variable", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-variable", NULL, NULL,
DEF_MENU_ENTRY_RADIO_VARIABLE,
Tk_Offset(TkMenuEntry, namePtr), -1, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs}
+ {TK_OPTION_END, NULL, NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs}
};
-static Tk_OptionSpec tkCascadeEntryConfigSpecs[] = {
- {TK_OPTION_STRING, "-menu", (char *) NULL, (char *) NULL,
+static const Tk_OptionSpec tkCascadeEntryConfigSpecs[] = {
+ {TK_OPTION_STRING, "-menu", NULL, NULL,
DEF_MENU_ENTRY_MENU,
Tk_Offset(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs}
+ {TK_OPTION_END, NULL, NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs}
};
-static Tk_OptionSpec tkTearoffEntryConfigSpecs[] = {
- {TK_OPTION_BORDER, "-background", (char *) NULL, (char *) NULL,
+static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = {
+ {TK_OPTION_BORDER, "-background", NULL, NULL,
DEF_MENU_ENTRY_BG,
Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK},
- {TK_OPTION_STRING_TABLE, "-state", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
DEF_MENU_ENTRY_STATE, -1, Tk_Offset(TkMenuEntry, state), 0,
(ClientData) tkMenuStateStrings},
{TK_OPTION_END}
};
-static Tk_OptionSpec *specsArray[] = {
+static const Tk_OptionSpec *specsArray[] = {
tkCascadeEntryConfigSpecs, tkCheckButtonEntryConfigSpecs,
tkBasicMenuEntryConfigSpecs, tkRadioButtonEntryConfigSpecs,
- tkSeparatorEntryConfigSpecs, tkTearoffEntryConfigSpecs};
-
+ tkSeparatorEntryConfigSpecs, tkTearoffEntryConfigSpecs
+};
+
/*
* Menu type strings for use with Tcl_GetIndexFromObj.
*/
-static CONST char *menuTypeStrings[] = {"normal", "tearoff", "menubar",
- (char *) NULL};
+static const char *menuTypeStrings[] = {
+ "normal", "tearoff", "menubar", NULL
+};
-static Tk_OptionSpec tkMenuConfigSpecs[] = {
- {TK_OPTION_BORDER, "-activebackground", "activeBackground",
- "Foreground", DEF_MENU_ACTIVE_BG_COLOR,
+static const Tk_OptionSpec tkMenuConfigSpecs[] = {
+ {TK_OPTION_BORDER, "-activebackground", "activeBackground",
+ "Foreground", DEF_MENU_ACTIVE_BG_COLOR,
Tk_Offset(TkMenu, activeBorderPtr), -1, 0,
(ClientData) DEF_MENU_ACTIVE_BG_MONO},
{TK_OPTION_PIXELS, "-activeborderwidth", "activeBorderWidth",
- "BorderWidth", DEF_MENU_ACTIVE_BORDER_WIDTH,
- Tk_Offset(TkMenu, activeBorderWidthPtr), -1},
- {TK_OPTION_COLOR, "-activeforeground", "activeForeground",
- "Background", DEF_MENU_ACTIVE_FG_COLOR,
+ "BorderWidth", DEF_MENU_ACTIVE_BORDER_WIDTH,
+ Tk_Offset(TkMenu, activeBorderWidthPtr), -1},
+ {TK_OPTION_COLOR, "-activeforeground", "activeForeground",
+ "Background", DEF_MENU_ACTIVE_FG_COLOR,
Tk_Offset(TkMenu, activeFgPtr), -1, 0,
(ClientData) DEF_MENU_ACTIVE_FG_MONO},
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_MENU_BG_COLOR, Tk_Offset(TkMenu, borderPtr), -1, 0,
(ClientData) DEF_MENU_BG_MONO},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth"},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background"},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth"},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background"},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_MENU_BORDER_WIDTH,
Tk_Offset(TkMenu, borderWidthPtr), -1, 0},
@@ -275,14 +272,14 @@ static Tk_OptionSpec tkMenuConfigSpecs[] = {
"DisabledForeground", DEF_MENU_DISABLED_FG_COLOR,
Tk_Offset(TkMenu, disabledFgPtr), -1, TK_OPTION_NULL_OK,
(ClientData) DEF_MENU_DISABLED_FG_MONO},
- {TK_OPTION_SYNONYM, "-fg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground"},
+ {TK_OPTION_SYNONYM, "-fg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground"},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_MENU_FONT, Tk_Offset(TkMenu, fontPtr), -1},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
DEF_MENU_FG, Tk_Offset(TkMenu, fgPtr), -1},
{TK_OPTION_STRING, "-postcommand", "postCommand", "Command",
- DEF_MENU_POST_COMMAND,
+ DEF_MENU_POST_COMMAND,
Tk_Offset(TkMenu, postCommandPtr), -1, TK_OPTION_NULL_OK},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_MENU_RELIEF, Tk_Offset(TkMenu, reliefPtr), -1},
@@ -294,11 +291,11 @@ static Tk_OptionSpec tkMenuConfigSpecs[] = {
Tk_Offset(TkMenu, takeFocusPtr), -1, TK_OPTION_NULL_OK},
{TK_OPTION_BOOLEAN, "-tearoff", "tearOff", "TearOff",
DEF_MENU_TEAROFF, -1, Tk_Offset(TkMenu, tearoff)},
- {TK_OPTION_STRING, "-tearoffcommand", "tearOffCommand",
+ {TK_OPTION_STRING, "-tearoffcommand", "tearOffCommand",
"TearOffCommand", DEF_MENU_TEAROFF_CMD,
Tk_Offset(TkMenu, tearoffCommandPtr), -1, TK_OPTION_NULL_OK},
{TK_OPTION_STRING, "-title", "title", "Title",
- DEF_MENU_TITLE, Tk_Offset(TkMenu, titlePtr), -1,
+ DEF_MENU_TITLE, Tk_Offset(TkMenu, titlePtr), -1,
TK_OPTION_NULL_OK},
{TK_OPTION_STRING_TABLE, "-type", "type", "Type",
DEF_MENU_TYPE, Tk_Offset(TkMenu, menuTypePtr), -1, TK_OPTION_NULL_OK,
@@ -307,73 +304,70 @@ static Tk_OptionSpec tkMenuConfigSpecs[] = {
};
/*
- * Command line options. Put here because MenuCmd has to look at them
- * along with MenuWidgetObjCmd.
+ * Command line options. Put here because MenuCmd has to look at them along
+ * with MenuWidgetObjCmd.
*/
static CONST char *menuOptions[] = {
"activate", "add", "cget", "clone", "configure", "delete", "entrycget",
"entryconfigure", "index", "insert", "invoke", "post", "postcascade",
- "type", "unpost", "yposition", (char *) NULL
+ "type", "unpost", "xposition", "yposition", NULL
};
enum options {
MENU_ACTIVATE, MENU_ADD, MENU_CGET, MENU_CLONE, MENU_CONFIGURE,
MENU_DELETE, MENU_ENTRYCGET, MENU_ENTRYCONFIGURE, MENU_INDEX,
MENU_INSERT, MENU_INVOKE, MENU_POST, MENU_POSTCASCADE, MENU_TYPE,
- MENU_UNPOST, MENU_YPOSITION
+ MENU_UNPOST, MENU_XPOSITION, MENU_YPOSITION
};
/*
- * Prototypes for static procedures in this file:
+ * Prototypes for static functions in this file:
*/
-static int CloneMenu _ANSI_ARGS_((TkMenu *menuPtr,
- Tcl_Obj *newMenuName, Tcl_Obj *newMenuTypeString));
-static int ConfigureMenu _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuPtr, int objc, Tcl_Obj *CONST objv[]));
-static int ConfigureMenuCloneEntries _ANSI_ARGS_((
- Tcl_Interp *interp, TkMenu *menuPtr, int index,
- int objc, Tcl_Obj *CONST objv[]));
-static int ConfigureMenuEntry _ANSI_ARGS_((TkMenuEntry *mePtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void DeleteMenuCloneEntries _ANSI_ARGS_((TkMenu *menuPtr,
- int first, int last));
-static void DestroyMenuHashTable _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp));
-static void DestroyMenuInstance _ANSI_ARGS_((TkMenu *menuPtr));
-static void DestroyMenuEntry _ANSI_ARGS_((char *memPtr));
-static int GetIndexFromCoords
- _ANSI_ARGS_((Tcl_Interp *interp, TkMenu *menuPtr,
- char *string, int *indexPtr));
-static int MenuDoYPosition _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuPtr, Tcl_Obj *objPtr));
-static int MenuAddOrInsert _ANSI_ARGS_((Tcl_Interp *interp,
+static int CloneMenu(TkMenu *menuPtr, Tcl_Obj *newMenuName,
+ Tcl_Obj *newMenuTypeString);
+static int ConfigureMenu(Tcl_Interp *interp, TkMenu *menuPtr,
+ int objc, Tcl_Obj *CONST objv[]);
+static int ConfigureMenuCloneEntries(Tcl_Interp *interp,
+ TkMenu *menuPtr, int index,
+ int objc, Tcl_Obj *CONST objv[]);
+static int ConfigureMenuEntry(TkMenuEntry *mePtr,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DeleteMenuCloneEntries(TkMenu *menuPtr,
+ int first, int last);
+static void DestroyMenuHashTable(ClientData clientData,
+ Tcl_Interp *interp);
+static void DestroyMenuInstance(TkMenu *menuPtr);
+static void DestroyMenuEntry(char *memPtr);
+static int GetIndexFromCoords(Tcl_Interp *interp, TkMenu *menuPtr,
+ char *string, int *indexPtr);
+static int MenuDoYPosition(Tcl_Interp *interp,
+ TkMenu *menuPtr, Tcl_Obj *objPtr);
+static int MenuDoXPosition(Tcl_Interp *interp,
+ TkMenu *menuPtr, Tcl_Obj *objPtr);
+static int MenuAddOrInsert(Tcl_Interp *interp,
TkMenu *menuPtr, Tcl_Obj *indexPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static int MenuCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void MenuCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static TkMenuEntry * MenuNewEntry _ANSI_ARGS_((TkMenu *menuPtr, int index,
- int type));
-static char * MenuVarProc _ANSI_ARGS_((ClientData clientData,
+ Tcl_Obj *CONST objv[]);
+static int MenuCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static void MenuCmdDeletedProc(ClientData clientData);
+static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, int index, int type);
+static char * MenuVarProc(ClientData clientData,
Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static int MenuWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void MenuWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static int PostProcessEntry _ANSI_ARGS_((TkMenuEntry *mePtr));
-static void RecursivelyDeleteMenu _ANSI_ARGS_((TkMenu *menuPtr));
-static void UnhookCascadeEntry _ANSI_ARGS_((TkMenuEntry *mePtr));
-static Tcl_ExitProc TkMenuCleanup;
+ CONST char *name2, int flags);
+static int MenuWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void MenuWorldChanged(ClientData instanceData);
+static int PostProcessEntry(TkMenuEntry *mePtr);
+static void RecursivelyDeleteMenu(TkMenu *menuPtr);
+static void UnhookCascadeEntry(TkMenuEntry *mePtr);
+static void TkMenuCleanup(ClientData unused);
/*
* The structure below is a list of procs that respond to certain window
- * manager events. One of these includes a font change, which forces
- * the geometry proc to be called.
+ * manager events. One of these includes a font change, which forces the
+ * geometry proc to be called.
*/
static Tk_ClassProcs menuClass = {
@@ -386,8 +380,7 @@ static Tk_ClassProcs menuClass = {
*
* TkCreateMenuCmd --
*
- * Called by Tk at initialization time to create the menu
- * command.
+ * Called by Tk at initialization time to create the menu command.
*
* Results:
* A standard Tcl result.
@@ -407,14 +400,14 @@ FreeOptionTables(
}
int
-TkCreateMenuCmd(interp)
- Tcl_Interp *interp; /* Interpreter we are creating the
- * command in. */
+TkCreateMenuCmd(
+ Tcl_Interp *interp) /* Interpreter we are creating the command
+ * in. */
{
- TkMenuOptionTables *optionTablesPtr =
+ TkMenuOptionTables *optionTablesPtr =
(TkMenuOptionTables *) ckalloc(sizeof(TkMenuOptionTables));
- optionTablesPtr->menuOptionTable =
+ optionTablesPtr->menuOptionTable =
Tk_CreateOptionTable(interp, tkMenuConfigSpecs);
optionTablesPtr->entryOptionTables[TEAROFF_ENTRY] =
Tk_CreateOptionTable(interp, specsArray[TEAROFF_ENTRY]);
@@ -444,9 +437,8 @@ TkCreateMenuCmd(interp)
*
* MenuCmd --
*
- * This procedure is invoked to process the "menu" Tcl
- * command. See the user documentation for details on
- * what it does.
+ * This function is invoked to process the "menu" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -458,21 +450,19 @@ TkCreateMenuCmd(interp)
*/
static int
-MenuCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings. */
+MenuCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument strings. */
{
Tk_Window tkwin = Tk_MainWindow(interp);
- Tk_Window new;
+ Tk_Window newWin;
register TkMenu *menuPtr;
TkMenuReferences *menuRefPtr;
- int i, index;
- int toplevel;
+ int i, index, toplevel;
char *windowName;
- static CONST char *typeStringList[] = {"-type", (char *) NULL};
+ static CONST char *typeStringList[] = {"-type", NULL};
TkMenuOptionTables *optionTablesPtr = (TkMenuOptionTables *) clientData;
if (objc < 2) {
@@ -494,23 +484,23 @@ MenuCmd(clientData, interp, objc, objv)
}
}
- windowName = Tcl_GetStringFromObj(objv[1], NULL);
- new = Tk_CreateWindowFromPath(interp, tkwin, windowName, toplevel ? ""
- : NULL);
- if (new == NULL) {
+ windowName = Tcl_GetString(objv[1]);
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, windowName,
+ toplevel ? "" : NULL);
+ if (newWin == NULL) {
return TCL_ERROR;
}
/*
- * Initialize the data structure for the menu. Note that the
- * menuPtr is eventually freed in 'TkMenuEventProc' in tkMenuDraw.c,
- * when Tcl_EventuallyFree is called.
+ * Initialize the data structure for the menu. Note that the menuPtr is
+ * eventually freed in 'TkMenuEventProc' in tkMenuDraw.c, when
+ * Tcl_EventuallyFree is called.
*/
menuPtr = (TkMenu *) ckalloc(sizeof(TkMenu));
memset(menuPtr, 0, sizeof(TkMenu));
- menuPtr->tkwin = new;
- menuPtr->display = Tk_Display(new);
+ menuPtr->tkwin = newWin;
+ menuPtr->display = Tk_Display(newWin);
menuPtr->interp = interp;
menuPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd,
@@ -524,7 +514,8 @@ MenuCmd(clientData, interp, objc, objv)
Tk_SetClass(menuPtr->tkwin, "Menu");
Tk_SetClassProcs(menuPtr->tkwin, &menuClass, (ClientData) menuPtr);
- Tk_CreateEventHandler(new, ExposureMask|StructureNotifyMask|ActivateMask,
+ Tk_CreateEventHandler(newWin,
+ ExposureMask|StructureNotifyMask|ActivateMask,
TkMenuEventProc, (ClientData) menuPtr);
if (Tk_InitOptions(interp, (char *) menuPtr,
menuPtr->optionTablesPtr->menuOptionTable, menuPtr->tkwin)
@@ -550,38 +541,36 @@ MenuCmd(clientData, interp, objc, objv)
/*
* If a menu has a parent menu pointing to it as a cascade entry, the
- * parent menu needs to be told that this menu now exists so that
- * the platform-part of the menu is correctly updated.
+ * parent menu needs to be told that this menu now exists so that the
+ * platform-part of the menu is correctly updated.
*
* If a menu has an instance and has cascade entries, then each cascade
- * menu must also have a parallel instance. This is especially true on
- * the Mac, where each menu has to have a separate title everytime it is in
- * a menubar. For instance, say you have a menu .m1 with a cascade entry
- * for .m2, where .m2 does not exist yet. You then put .m1 into a menubar.
+ * menu must also have a parallel instance. This is especially true on the
+ * Mac, where each menu has to have a separate title everytime it is in a
+ * menubar. For instance, say you have a menu .m1 with a cascade entry for
+ * .m2, where .m2 does not exist yet. You then put .m1 into a menubar.
* This creates a menubar instance for .m1, but since .m2 is not there,
* nothing else happens. When we go to create .m2, we hook it up properly
* with .m1. However, we now need to clone .m2 and assign the clone of .m2
- * to be the cascade entry for the clone of .m1. This is special case
- * #1 listed in the introductory comment.
+ * to be the cascade entry for the clone of .m1. This is special case #1
+ * listed in the introductory comment.
*/
if (menuRefPtr->parentEntryPtr != NULL) {
- TkMenuEntry *cascadeListPtr = menuRefPtr->parentEntryPtr;
- TkMenuEntry *nextCascadePtr;
- Tcl_Obj *newMenuName;
- Tcl_Obj *newObjv[2];
-
- while (cascadeListPtr != NULL) {
+ TkMenuEntry *cascadeListPtr = menuRefPtr->parentEntryPtr;
+ TkMenuEntry *nextCascadePtr;
+ Tcl_Obj *newMenuName, *newObjv[2];
+ while (cascadeListPtr != NULL) {
nextCascadePtr = cascadeListPtr->nextCascadePtr;
/*
- * If we have a new master menu, and an existing cloned menu
- * points to this menu in a cascade entry, we have to clone
- * the new menu and point the entry to the clone instead
- * of the menu we are creating. Otherwise, ConfigureMenuEntry
- * will hook up the platform-specific cascade linkages now
- * that the menu we are creating exists.
+ * If we have a new master menu, and an existing cloned menu
+ * points to this menu in a cascade entry, we have to clone the
+ * new menu and point the entry to the clone instead of the menu
+ * we are creating. Otherwise, ConfigureMenuEntry will hook up the
+ * platform-specific cascade linkages now that the menu we are
+ * creating exists.
*/
if ((menuPtr->masterMenuPtr != menuPtr)
@@ -602,50 +591,50 @@ MenuCmd(clientData, interp, objc, objv)
Tcl_IncrRefCount(normalPtr);
Tcl_IncrRefCount(windowNamePtr);
- newMenuName = TkNewMenuName(menuPtr->interp,
+ newMenuName = TkNewMenuName(menuPtr->interp,
windowNamePtr, menuPtr);
Tcl_IncrRefCount(newMenuName);
- CloneMenu(menuPtr, newMenuName, normalPtr);
+ CloneMenu(menuPtr, newMenuName, normalPtr);
- /*
- * Now we can set the new menu instance to be the cascade entry
- * of the parent's instance.
- */
+ /*
+ * Now we can set the new menu instance to be the cascade
+ * entry of the parent's instance.
+ */
newObjv[0] = Tcl_NewStringObj("-menu", -1);
newObjv[1] = newMenuName;
Tcl_IncrRefCount(newObjv[0]);
- ConfigureMenuEntry(cascadeListPtr, 2, newObjv);
+ ConfigureMenuEntry(cascadeListPtr, 2, newObjv);
Tcl_DecrRefCount(normalPtr);
Tcl_DecrRefCount(newObjv[0]);
Tcl_DecrRefCount(newObjv[1]);
Tcl_DecrRefCount(windowNamePtr);
- }
- cascadeListPtr = nextCascadePtr;
- }
+ }
+ cascadeListPtr = nextCascadePtr;
+ }
}
/*
- * If there already exist toplevel widgets that refer to this menu,
- * find them and notify them so that they can reconfigure their
- * geometry to reflect the menu.
+ * If there already exist toplevel widgets that refer to this menu, find
+ * them and notify them so that they can reconfigure their geometry to
+ * reflect the menu.
*/
if (menuRefPtr->topLevelListPtr != NULL) {
TkMenuTopLevelList *topLevelListPtr = menuRefPtr->topLevelListPtr;
TkMenuTopLevelList *nextPtr;
Tk_Window listtkwin;
- while (topLevelListPtr != NULL) {
+ while (topLevelListPtr != NULL) {
/*
- * Need to get the next pointer first. TkSetWindowMenuBar
- * changes the list, so that the next pointer is different
- * after calling it.
+ * Need to get the next pointer first. TkSetWindowMenuBar changes
+ * the list, so that the next pointer is different after calling
+ * it.
*/
nextPtr = topLevelListPtr->nextPtr;
listtkwin = topLevelListPtr->tkwin;
- TkSetWindowMenuBar(menuPtr->interp, listtkwin,
+ TkSetWindowMenuBar(menuPtr->interp, listtkwin,
Tk_PathName(menuPtr->tkwin), Tk_PathName(menuPtr->tkwin));
topLevelListPtr = nextPtr;
}
@@ -660,9 +649,9 @@ MenuCmd(clientData, interp, objc, objv)
*
* MenuWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -674,11 +663,11 @@ MenuCmd(clientData, interp, objc, objv)
*/
static int
-MenuWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about menu widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings. */
+MenuWidgetObjCmd(
+ ClientData clientData, /* Information about menu widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument strings. */
{
register TkMenu *menuPtr = (TkMenu *) clientData;
register TkMenuEntry *mePtr;
@@ -696,335 +685,331 @@ MenuWidgetObjCmd(clientData, interp, objc, objv)
Tcl_Preserve((ClientData) menuPtr);
switch ((enum options) option) {
- case MENU_ACTIVATE: {
- int index;
+ case MENU_ACTIVATE: {
+ int index;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "activate index");
- goto error;
- }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index)
- != TCL_OK) {
- goto error;
- }
- if (menuPtr->active == index) {
- goto done;
- }
- if ((index >= 0)
- && ((menuPtr->entries[index]->type == SEPARATOR_ENTRY)
- || (menuPtr->entries[index]->state
- == ENTRY_DISABLED))) {
- index = -1;
- }
- result = TkActivateMenuEntry(menuPtr, index);
- break;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
+ }
+ if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ goto error;
+ }
+ if (menuPtr->active == index) {
+ goto done;
+ }
+ if ((index >= 0) && ((menuPtr->entries[index]->type==SEPARATOR_ENTRY)
+ || (menuPtr->entries[index]->state == ENTRY_DISABLED))) {
+ index = -1;
+ }
+ result = TkActivateMenuEntry(menuPtr, index);
+ break;
+ }
+ case MENU_ADD:
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "type ?options?");
+ goto error;
}
- case MENU_ADD:
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "add type ?options?");
- goto error;
- }
- if (MenuAddOrInsert(interp, menuPtr, (Tcl_Obj *) NULL,
- objc - 2, objv + 2) != TCL_OK) {
- goto error;
- }
- break;
- case MENU_CGET: {
- Tcl_Obj *resultPtr;
+ if (MenuAddOrInsert(interp, menuPtr, NULL, objc-2, objv+2) != TCL_OK) {
+ goto error;
+ }
+ break;
+ case MENU_CGET: {
+ Tcl_Obj *resultPtr;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "cget option");
- goto error;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ goto error;
+ }
+ resultPtr = Tk_GetOptionValue(interp, (char *) menuPtr,
+ menuPtr->optionTablesPtr->menuOptionTable, objv[2],
+ menuPtr->tkwin);
+ if (resultPtr == NULL) {
+ goto error;
+ }
+ Tcl_SetObjResult(interp, resultPtr);
+ break;
+ }
+ case MENU_CLONE:
+ if ((objc < 3) || (objc > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "newMenuName ?menuType?");
+ goto error;
+ }
+ result = CloneMenu(menuPtr, objv[2], (objc == 3) ? NULL : objv[3]);
+ break;
+ case MENU_CONFIGURE: {
+ Tcl_Obj *resultPtr;
+
+ if (objc == 2) {
+ resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr,
+ menuPtr->optionTablesPtr->menuOptionTable, NULL,
+ menuPtr->tkwin);
+ if (resultPtr == NULL) {
+ result = TCL_ERROR;
+ } else {
+ result = TCL_OK;
+ Tcl_SetObjResult(interp, resultPtr);
}
- resultPtr = Tk_GetOptionValue(interp, (char *) menuPtr,
+ } else if (objc == 3) {
+ resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr,
menuPtr->optionTablesPtr->menuOptionTable, objv[2],
menuPtr->tkwin);
if (resultPtr == NULL) {
- goto error;
- }
- Tcl_SetObjResult(interp, resultPtr);
- break;
- }
- case MENU_CLONE:
- if ((objc < 3) || (objc > 4)) {
- Tcl_WrongNumArgs(interp, 1, objv,
- "clone newMenuName ?menuType?");
- goto error;
- }
- result = CloneMenu(menuPtr, objv[2], (objc == 3) ? NULL : objv[3]);
- break;
- case MENU_CONFIGURE: {
- Tcl_Obj *resultPtr;
-
- if (objc == 2) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr,
- menuPtr->optionTablesPtr->menuOptionTable,
- (Tcl_Obj *) NULL, menuPtr->tkwin);
- if (resultPtr == NULL) {
- result = TCL_ERROR;
- } else {
- result = TCL_OK;
- Tcl_SetObjResult(interp, resultPtr);
- }
- } else if (objc == 3) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr,
- menuPtr->optionTablesPtr->menuOptionTable,
- objv[2], menuPtr->tkwin);
- if (resultPtr == NULL) {
- result = TCL_ERROR;
- } else {
- result = TCL_OK;
- Tcl_SetObjResult(interp, resultPtr);
- }
+ result = TCL_ERROR;
} else {
- result = ConfigureMenu(interp, menuPtr, objc - 2, objv + 2);
+ result = TCL_OK;
+ Tcl_SetObjResult(interp, resultPtr);
}
- if (result != TCL_OK) {
- goto error;
- }
- break;
+ } else {
+ result = ConfigureMenu(interp, menuPtr, objc - 2, objv + 2);
}
- case MENU_DELETE: {
- int first, last;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 1, objv, "delete first ?last?");
- goto error;
- }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &first)
- != TCL_OK) {
- goto error;
- }
- if (objc == 3) {
- last = first;
- } else {
- if (TkGetMenuIndex(interp, menuPtr, objv[3], 0, &last)
- != TCL_OK) {
- goto error;
- }
- }
- if (menuPtr->tearoff && (first == 0)) {
+ if (result != TCL_OK) {
+ goto error;
+ }
+ break;
+ }
+ case MENU_DELETE: {
+ int first, last;
- /*
- * Sorry, can't delete the tearoff entry; must reconfigure
- * the menu.
- */
-
- first = 1;
- }
- if ((first < 0) || (last < first)) {
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "first ?last?");
+ goto error;
+ }
+
+ /*
+ * If 'first' explicitly refers to past the end of the menu, we don't
+ * do anything. [Bug 220950]
+ */
+
+ if (isdigit(UCHAR(Tcl_GetString(objv[2])[0]))
+ && Tcl_GetIntFromObj(NULL, objv[2], &first) == TCL_OK) {
+ if (first >= menuPtr->numEntries) {
goto done;
}
- DeleteMenuCloneEntries(menuPtr, first, last);
- break;
+ } else if (TkGetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){
+ goto error;
+ }
+ if (objc == 3) {
+ last = first;
+ } else if (TkGetMenuIndex(interp,menuPtr,objv[3],0,&last) != TCL_OK) {
+ goto error;
}
- case MENU_ENTRYCGET: {
- int index;
- Tcl_Obj *resultPtr;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 1, objv, "entrycget index option");
- goto error;
- }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index)
- != TCL_OK) {
- goto error;
- }
- if (index < 0) {
- goto done;
+ if (menuPtr->tearoff && (first == 0)) {
+ /*
+ * Sorry, can't delete the tearoff entry; must reconfigure the
+ * menu.
+ */
+
+ first = 1;
+ }
+ if ((first < 0) || (last < first)) {
+ goto done;
+ }
+ DeleteMenuCloneEntries(menuPtr, first, last);
+ break;
+ }
+ case MENU_ENTRYCGET: {
+ int index;
+ Tcl_Obj *resultPtr;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index option");
+ goto error;
+ }
+ if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ goto error;
+ }
+ if (index < 0) {
+ goto done;
+ }
+ mePtr = menuPtr->entries[index];
+ Tcl_Preserve((ClientData) mePtr);
+ resultPtr = Tk_GetOptionValue(interp, (char *) mePtr,
+ mePtr->optionTable, objv[3], menuPtr->tkwin);
+ Tcl_Release((ClientData) mePtr);
+ if (resultPtr == NULL) {
+ goto error;
+ }
+ Tcl_SetObjResult(interp, resultPtr);
+ break;
+ }
+ case MENU_ENTRYCONFIGURE: {
+ int index;
+ Tcl_Obj *resultPtr;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index ?option value ...?");
+ goto error;
+ }
+ if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ goto error;
+ }
+ if (index < 0) {
+ goto done;
+ }
+ mePtr = menuPtr->entries[index];
+ Tcl_Preserve((ClientData) mePtr);
+ if (objc == 3) {
+ resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr,
+ mePtr->optionTable, NULL, menuPtr->tkwin);
+ if (resultPtr == NULL) {
+ result = TCL_ERROR;
+ } else {
+ result = TCL_OK;
+ Tcl_SetObjResult(interp, resultPtr);
}
- mePtr = menuPtr->entries[index];
- Tcl_Preserve((ClientData) mePtr);
- resultPtr = Tk_GetOptionValue(interp, (char *) mePtr,
+ } else if (objc == 4) {
+ resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr,
mePtr->optionTable, objv[3], menuPtr->tkwin);
- Tcl_Release((ClientData) mePtr);
if (resultPtr == NULL) {
- goto error;
+ result = TCL_ERROR;
+ } else {
+ result = TCL_OK;
+ Tcl_SetObjResult(interp, resultPtr);
}
- Tcl_SetObjResult(interp, resultPtr);
- break;
+ } else {
+ result = ConfigureMenuCloneEntries(interp, menuPtr, index,
+ objc-3, objv+3);
}
- case MENU_ENTRYCONFIGURE: {
- int index;
- Tcl_Obj *resultPtr;
+ Tcl_Release((ClientData) mePtr);
+ break;
+ }
+ case MENU_INDEX: {
+ int index;
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 1, objv,
- "entryconfigure index ?option value ...?");
- goto error;
- }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index)
- != TCL_OK) {
- goto error;
- }
- if (index < 0) {
- goto done;
- }
- mePtr = menuPtr->entries[index];
- Tcl_Preserve((ClientData) mePtr);
- if (objc == 3) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr,
- mePtr->optionTable, (Tcl_Obj *) NULL, menuPtr->tkwin);
- if (resultPtr == NULL) {
- result = TCL_ERROR;
- } else {
- result = TCL_OK;
- Tcl_SetObjResult(interp, resultPtr);
- }
- } else if (objc == 4) {
- resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr,
- mePtr->optionTable, objv[3], menuPtr->tkwin);
- if (resultPtr == NULL) {
- result = TCL_ERROR;
- } else {
- result = TCL_OK;
- Tcl_SetObjResult(interp, resultPtr);
- }
- } else {
- result = ConfigureMenuCloneEntries(interp, menuPtr, index,
- objc - 3, objv + 3);
- }
- Tcl_Release((ClientData) mePtr);
- break;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "string");
+ goto error;
+ }
+ if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ goto error;
}
- case MENU_INDEX: {
- int index;
+ if (index < 0) {
+ Tcl_SetResult(interp, "none", TCL_STATIC);
+ } else {
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), index);
+ }
+ break;
+ }
+ case MENU_INSERT:
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index type ?options?");
+ goto error;
+ }
+ if (MenuAddOrInsert(interp,menuPtr,objv[2],objc-3,objv+3) != TCL_OK) {
+ goto error;
+ }
+ break;
+ case MENU_INVOKE: {
+ int index;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "index string");
- goto error;
- }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index)
- != TCL_OK) {
- goto error;
- }
- if (index < 0) {
- Tcl_SetResult(interp, "none", TCL_STATIC);
- } else {
- Tcl_SetIntObj(Tcl_GetObjResult(interp), index);
- }
- break;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
}
- case MENU_INSERT:
- if (objc < 4) {
- Tcl_WrongNumArgs(interp, 1, objv,
- "insert index type ?options?");
- goto error;
- }
- if (MenuAddOrInsert(interp, menuPtr, objv[2], objc - 3,
- objv + 3) != TCL_OK) {
- goto error;
- }
- break;
- case MENU_INVOKE: {
- int index;
+ if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ goto error;
+ }
+ if (index < 0) {
+ goto done;
+ }
+ result = TkInvokeMenu(interp, menuPtr, index);
+ break;
+ }
+ case MENU_POST: {
+ int x, y;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "invoke index");
- goto error;
- }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index)
- != TCL_OK) {
- goto error;
- }
- if (index < 0) {
- goto done;
- }
- result = TkInvokeMenu(interp, menuPtr, index);
- break;
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "x y");
+ goto error;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
+ goto error;
}
- case MENU_POST: {
- int x, y;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 1, objv, "post x y");
- goto error;
- }
- if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
- goto error;
- }
+ /*
+ * Tearoff menus are posted differently on Mac and Windows than
+ * non-tearoffs. TkpPostMenu does not actually map the menu's window
+ * on those platforms, and popup menus have to be handled specially.
+ */
- /*
- * Tearoff menus are posted differently on Mac and Windows than
- * non-tearoffs. TkpPostMenu does not actually map the menu's
- * window on those platforms, and popup menus have to be
- * handled specially.
- */
-
- if (menuPtr->menuType != TEAROFF_MENU) {
- result = TkpPostMenu(interp, menuPtr, x, y);
- } else {
- result = TkPostTearoffMenu(interp, menuPtr, x, y);
- }
- break;
+ if (menuPtr->menuType != TEAROFF_MENU) {
+ result = TkpPostMenu(interp, menuPtr, x, y);
+ } else {
+ result = TkPostTearoffMenu(interp, menuPtr, x, y);
}
- case MENU_POSTCASCADE: {
- int index;
+ break;
+ }
+ case MENU_POSTCASCADE: {
+ int index;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "postcascade index");
- goto error;
- }
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
+ }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index)
- != TCL_OK) {
- goto error;
- }
- if ((index < 0) || (menuPtr->entries[index]->type
- != CASCADE_ENTRY)) {
- result = TkPostSubmenu(interp, menuPtr, (TkMenuEntry *) NULL);
- } else {
- result = TkPostSubmenu(interp, menuPtr,
- menuPtr->entries[index]);
- }
- break;
+ if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ goto error;
+ }
+ if ((index < 0) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
+ result = TkPostSubmenu(interp, menuPtr, NULL);
+ } else {
+ result = TkPostSubmenu(interp, menuPtr, menuPtr->entries[index]);
}
- case MENU_TYPE: {
- int index;
+ break;
+ }
+ case MENU_TYPE: {
+ int index;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "type index");
- goto error;
- }
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index)
- != TCL_OK) {
- goto error;
- }
- if (index < 0) {
- goto done;
- }
- if (menuPtr->entries[index]->type == TEAROFF_ENTRY) {
- Tcl_SetResult(interp, "tearoff", TCL_STATIC);
- } else {
- Tcl_SetStringObj(Tcl_GetObjResult(interp),
- menuEntryTypeStrings[menuPtr->entries[index]->type],
- -1);
- }
- break;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
}
- case MENU_UNPOST:
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "unpost");
- goto error;
- }
- Tk_UnmapWindow(menuPtr->tkwin);
- result = TkPostSubmenu(interp, menuPtr, (TkMenuEntry *) NULL);
- break;
- case MENU_YPOSITION:
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "yposition index");
- goto error;
- }
- result = MenuDoYPosition(interp, menuPtr, objv[2]);
- break;
+ if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ goto error;
+ }
+ if (index < 0) {
+ goto done;
+ }
+ if (menuPtr->entries[index]->type == TEAROFF_ENTRY) {
+ Tcl_SetResult(interp, "tearoff", TCL_STATIC);
+ } else {
+ Tcl_SetStringObj(Tcl_GetObjResult(interp),
+ menuEntryTypeStrings[menuPtr->entries[index]->type], -1);
+ }
+ break;
}
- done:
+ case MENU_UNPOST:
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ goto error;
+ }
+ Tk_UnmapWindow(menuPtr->tkwin);
+ result = TkPostSubmenu(interp, menuPtr, NULL);
+ break;
+ case MENU_XPOSITION:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
+ }
+ result = MenuDoXPosition(interp, menuPtr, objv[2]);
+ break;
+ case MENU_YPOSITION:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ goto error;
+ }
+ result = MenuDoYPosition(interp, menuPtr, objv[2]);
+ break;
+ }
+ done:
Tcl_Release((ClientData) menuPtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) menuPtr);
return TCL_ERROR;
}
@@ -1034,29 +1019,29 @@ MenuWidgetObjCmd(clientData, interp, objc, objv)
*
* TkInvokeMenu --
*
- * Given a menu and an index, takes the appropriate action for the
- * entry associated with that index.
+ * Given a menu and an index, takes the appropriate action for the entry
+ * associated with that index.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Commands may get excecuted; variables may get set; sub-menus may
- * get posted.
+ * Commands may get excecuted; variables may get set; sub-menus may get
+ * posted.
*
*----------------------------------------------------------------------
*/
int
-TkInvokeMenu(interp, menuPtr, index)
- Tcl_Interp *interp; /* The interp that the menu lives in. */
- TkMenu *menuPtr; /* The menu we are invoking. */
- int index; /* The zero based index of the item we
- * are invoking */
+TkInvokeMenu(
+ Tcl_Interp *interp, /* The interp that the menu lives in. */
+ TkMenu *menuPtr, /* The menu we are invoking. */
+ int index) /* The zero based index of the item we are
+ * invoking. */
{
int result = TCL_OK;
TkMenuEntry *mePtr;
-
+
if (index < 0) {
goto done;
}
@@ -1104,11 +1089,13 @@ TkInvokeMenu(interp, menuPtr, index)
}
Tcl_DecrRefCount(valuePtr);
}
+
/*
- * We check numEntries in addition to whether the menu entry
- * has a command because that goes to zero if the menu gets
- * deleted (e.g., during command evaluation).
+ * We check numEntries in addition to whether the menu entry has a command
+ * because that goes to zero if the menu gets deleted (e.g., during
+ * command evaluation).
*/
+
if ((menuPtr->numEntries != 0) && (result == TCL_OK)
&& (mePtr->commandPtr != NULL)) {
Tcl_Obj *commandPtr = mePtr->commandPtr;
@@ -1118,7 +1105,7 @@ TkInvokeMenu(interp, menuPtr, index)
Tcl_DecrRefCount(commandPtr);
}
Tcl_Release((ClientData) mePtr);
- done:
+ done:
return result;
}
@@ -1127,10 +1114,9 @@ TkInvokeMenu(interp, menuPtr, index)
*
* DestroyMenuInstance --
*
- * This procedure is invoked by TkDestroyMenu
- * to clean up the internal structure of a menu at a safe time
- * (when no-one is using it anymore). Only takes care of one instance
- * of the menu.
+ * This function is invoked by TkDestroyMenu to clean up the internal
+ * structure of a menu at a safe time (when no-one is using it anymore).
+ * Only takes care of one instance of the menu.
*
* Results:
* None.
@@ -1142,8 +1128,8 @@ TkInvokeMenu(interp, menuPtr, index)
*/
static void
-DestroyMenuInstance(menuPtr)
- TkMenu *menuPtr; /* Info about menu widget. */
+DestroyMenuInstance(
+ TkMenu *menuPtr) /* Info about menu widget. */
{
int i;
TkMenu *menuInstancePtr;
@@ -1151,19 +1137,19 @@ DestroyMenuInstance(menuPtr)
Tcl_Obj *newObjv[2];
TkMenu *parentMasterMenuPtr;
TkMenuEntry *parentMasterEntryPtr;
-
+
/*
* If the menu has any cascade menu entries pointing to it, the cascade
* entries need to be told that the menu is going away. We need to clear
- * the menu ptr field in the menu reference at this point in the code
- * so that everything else can forget about this menu properly. We also
- * need to reset -menu field of all entries that are not master menus
- * back to this entry name if this is a master menu pointed to by another
- * master menu. If there is a clone menu that points to this menu,
- * then this menu is itself a clone, so when this menu goes away,
- * the -menu field of the pointing entry must be set back to this
- * menu's master menu name so that later if another menu is created
- * the cascade hierarchy can be maintained.
+ * the menu ptr field in the menu reference at this point in the code so
+ * that everything else can forget about this menu properly. We also need
+ * to reset -menu field of all entries that are not master menus back to
+ * this entry name if this is a master menu pointed to by another master
+ * menu. If there is a clone menu that points to this menu, then this menu
+ * is itself a clone, so when this menu goes away, the -menu field of the
+ * pointing entry must be set back to this menu's master menu name so that
+ * later if another menu is created the cascade hierarchy can be
+ * maintained.
*/
TkpDestroyMenu(menuPtr);
@@ -1178,7 +1164,7 @@ DestroyMenuInstance(menuPtr)
for (; cascadePtr != NULL; cascadePtr = nextCascadePtr) {
nextCascadePtr = cascadePtr->nextCascadePtr;
-
+
if (menuPtr->masterMenuPtr != menuPtr) {
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
@@ -1187,10 +1173,12 @@ DestroyMenuInstance(menuPtr)
parentMasterMenuPtr->entries[cascadePtr->index];
newObjv[0] = menuNamePtr;
newObjv[1] = parentMasterEntryPtr->namePtr;
+
/*
- * It is possible that the menu info is out of sync, and
- * these things point to NULL, so verify existence [Bug: 3402]
+ * It is possible that the menu info is out of sync, and these
+ * things point to NULL, so verify existence [Bug: 3402]
*/
+
if (newObjv[0] && newObjv[1]) {
Tcl_IncrRefCount(newObjv[0]);
Tcl_IncrRefCount(newObjv[1]);
@@ -1199,38 +1187,37 @@ DestroyMenuInstance(menuPtr)
Tcl_DecrRefCount(newObjv[1]);
}
} else {
- ConfigureMenuEntry(cascadePtr, 0, (Tcl_Obj **) NULL);
+ ConfigureMenuEntry(cascadePtr, 0, NULL);
}
}
-
+
if (menuPtr->masterMenuPtr != menuPtr) {
- for (menuInstancePtr = menuPtr->masterMenuPtr;
- menuInstancePtr != NULL;
- menuInstancePtr = menuInstancePtr->nextInstancePtr) {
- if (menuInstancePtr->nextInstancePtr == menuPtr) {
- menuInstancePtr->nextInstancePtr =
- menuInstancePtr->nextInstancePtr->nextInstancePtr;
- break;
- }
- }
- } else if (menuPtr->nextInstancePtr != NULL) {
- panic("Attempting to delete master menu when there are still clones.");
- }
+ for (menuInstancePtr = menuPtr->masterMenuPtr;
+ menuInstancePtr != NULL;
+ menuInstancePtr = menuInstancePtr->nextInstancePtr) {
+ if (menuInstancePtr->nextInstancePtr == menuPtr) {
+ menuInstancePtr->nextInstancePtr =
+ menuInstancePtr->nextInstancePtr->nextInstancePtr;
+ break;
+ }
+ }
+ } else if (menuPtr->nextInstancePtr != NULL) {
+ Tcl_Panic("Attempting to delete master menu when there are still clones.");
+ }
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeConfigOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeConfigOptions handle all the standard option-related stuff.
*/
for (i = menuPtr->numEntries; --i >= 0; ) {
/*
- * As each menu entry is deleted from the end of the array of
- * entries, decrement menuPtr->numEntries. Otherwise, the act of
- * deleting menu entry i will dereference freed memory attempting
- * to queue a redraw for menu entries (i+1)...numEntries.
+ * As each menu entry is deleted from the end of the array of entries,
+ * decrement menuPtr->numEntries. Otherwise, the act of deleting menu
+ * entry i will dereference freed memory attempting to queue a redraw
+ * for menu entries (i+1)...numEntries.
*/
-
+
DestroyMenuEntry((char *) menuPtr->entries[i]);
menuPtr->numEntries = i;
}
@@ -1238,7 +1225,7 @@ DestroyMenuInstance(menuPtr)
ckfree((char *) menuPtr->entries);
}
TkMenuFreeDrawOptions(menuPtr);
- Tk_FreeConfigOptions((char *) menuPtr,
+ Tk_FreeConfigOptions((char *) menuPtr,
menuPtr->optionTablesPtr->menuOptionTable, menuPtr->tkwin);
if (menuPtr->tkwin != NULL) {
Tk_Window tkwin = menuPtr->tkwin;
@@ -1252,11 +1239,11 @@ DestroyMenuInstance(menuPtr)
*
* TkDestroyMenu --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a menu at a safe time
- * (when no-one is using it anymore). If called on a master instance,
- * destroys all of the slave instances. If called on a non-master
- * instance, just destroys that instance.
+ * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
+ * up the internal structure of a menu at a safe time (when no-one is
+ * using it anymore). If called on a master instance, destroys all of the
+ * slave instances. If called on a non-master instance, just destroys
+ * that instance.
*
* Results:
* None.
@@ -1268,8 +1255,8 @@ DestroyMenuInstance(menuPtr)
*/
void
-TkDestroyMenu(menuPtr)
- TkMenu *menuPtr; /* Info about menu widget. */
+TkDestroyMenu(
+ TkMenu *menuPtr) /* Info about menu widget. */
{
TkMenu *menuInstancePtr;
TkMenuTopLevelList *topLevelListPtr, *nextTopLevelPtr;
@@ -1279,20 +1266,21 @@ TkDestroyMenu(menuPtr)
}
Tcl_Preserve(menuPtr);
-
+
/*
- * Now destroy all non-tearoff instances of this menu if this is a
- * parent menu. Is this loop safe enough? Are there going to be
- * destroy bindings on child menus which kill the parent? If not,
- * we have to do a slightly more complex scheme.
+ * Now destroy all non-tearoff instances of this menu if this is a parent
+ * menu. Is this loop safe enough? Are there going to be destroy bindings
+ * on child menus which kill the parent? If not, we have to do a slightly
+ * more complex scheme.
*/
menuPtr->menuFlags |= MENU_DELETION_PENDING;
if (menuPtr->menuRefPtr != NULL) {
/*
- * If any toplevel widgets have this menu as their menubar,
- * the geometry of the window may have to be recalculated.
+ * If any toplevel widgets have this menu as their menubar, the
+ * geometry of the window may have to be recalculated.
*/
+
topLevelListPtr = menuPtr->menuRefPtr->topLevelListPtr;
while (topLevelListPtr != NULL) {
nextTopLevelPtr = topLevelListPtr->nextPtr;
@@ -1306,11 +1294,13 @@ TkDestroyMenu(menuPtr)
menuPtr->nextInstancePtr = menuInstancePtr->nextInstancePtr;
if (menuInstancePtr->tkwin != NULL) {
Tk_Window tkwin = menuInstancePtr->tkwin;
- /*
- * Note: it may be desirable to NULL out the tkwin
- * field of menuInstancePtr here:
+
+ /*
+ * Note: it may be desirable to NULL out the tkwin field of
+ * menuInstancePtr here:
* menuInstancePtr->tkwin = NULL;
*/
+
Tk_DestroyWindow(tkwin);
}
}
@@ -1327,12 +1317,12 @@ TkDestroyMenu(menuPtr)
* UnhookCascadeEntry --
*
* This entry is removed from the list of entries that point to the
- * cascade menu. This is done in preparation for changing the menu
- * that this entry points to.
- *
- * At the end of this function, the menu entry no longer contains
- * a reference to a 'TkMenuReferences' structure, and therefore
- * no such structure contains a reference to this menu entry either.
+ * cascade menu. This is done in preparation for changing the menu that
+ * this entry points to.
+ *
+ * At the end of this function, the menu entry no longer contains a
+ * reference to a 'TkMenuReferences' structure, and therefore no such
+ * structure contains a reference to this menu entry either.
*
* Results:
* None
@@ -1344,9 +1334,9 @@ TkDestroyMenu(menuPtr)
*/
static void
-UnhookCascadeEntry(mePtr)
- TkMenuEntry *mePtr; /* The cascade entry we are removing
- * from the cascade list. */
+UnhookCascadeEntry(
+ TkMenuEntry *mePtr) /* The cascade entry we are removing from the
+ * cascade list. */
{
TkMenuEntry *cascadeEntryPtr;
TkMenuEntry *prevCascadePtr;
@@ -1354,35 +1344,34 @@ UnhookCascadeEntry(mePtr)
menuRefPtr = mePtr->childMenuRefPtr;
if (menuRefPtr == NULL) {
- return;
+ return;
}
-
+
cascadeEntryPtr = menuRefPtr->parentEntryPtr;
if (cascadeEntryPtr == NULL) {
TkFreeMenuReferences(menuRefPtr);
mePtr->childMenuRefPtr = NULL;
return;
}
-
+
/*
- * Singularly linked list deletion. The two special cases are
- * 1. one element; 2. The first element is the one we want.
+ * Singularly linked list deletion. The two special cases are 1. one
+ * element; 2. The first element is the one we want.
*/
if (cascadeEntryPtr == mePtr) {
if (cascadeEntryPtr->nextCascadePtr == NULL) {
-
/*
- * This is the last menu entry which points to this
- * menu, so we need to clear out the list pointer in the
- * cascade itself.
+ * This is the last menu entry which points to this menu, so we
+ * need to clear out the list pointer in the cascade itself.
*/
menuRefPtr->parentEntryPtr = NULL;
- /*
- * The original field is set to zero below, after it is
- * freed.
+
+ /*
+ * The original field is set to zero below, after it is freed.
*/
+
TkFreeMenuReferences(menuRefPtr);
} else {
menuRefPtr->parentEntryPtr = cascadeEntryPtr->nextCascadePtr;
@@ -1392,15 +1381,15 @@ UnhookCascadeEntry(mePtr)
for (prevCascadePtr = cascadeEntryPtr,
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr;
cascadeEntryPtr != NULL;
- prevCascadePtr = cascadeEntryPtr,
+ prevCascadePtr = cascadeEntryPtr,
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if (cascadeEntryPtr == mePtr){
prevCascadePtr->nextCascadePtr =
- cascadeEntryPtr->nextCascadePtr;
+ cascadeEntryPtr->nextCascadePtr;
cascadeEntryPtr->nextCascadePtr = NULL;
break;
}
- }
+ }
mePtr->nextCascadePtr = NULL;
}
mePtr->childMenuRefPtr = NULL;
@@ -1411,9 +1400,9 @@ UnhookCascadeEntry(mePtr)
*
* DestroyMenuEntry --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a menu entry at a safe time
- * (when no-one is using it anymore).
+ * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
+ * up the internal structure of a menu entry at a safe time (when no-one
+ * is using it anymore).
*
* Results:
* None.
@@ -1425,56 +1414,57 @@ UnhookCascadeEntry(mePtr)
*/
static void
-DestroyMenuEntry(memPtr)
- char *memPtr; /* Pointer to entry to be freed. */
+DestroyMenuEntry(
+ char *memPtr) /* Pointer to entry to be freed. */
{
register TkMenuEntry *mePtr = (TkMenuEntry *) memPtr;
TkMenu *menuPtr = mePtr->menuPtr;
if (menuPtr->postedCascade == mePtr) {
/*
- * Ignore errors while unposting the menu, since it's possible
- * that the menu has already been deleted and the unpost will
- * generate an error.
+ * Ignore errors while unposting the menu, since it's possible that
+ * the menu has already been deleted and the unpost will generate an
+ * error.
*/
- TkPostSubmenu(menuPtr->interp, menuPtr, (TkMenuEntry *) NULL);
+ TkPostSubmenu(menuPtr->interp, menuPtr, NULL);
}
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeConfigOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeConfigOptions handle all the standard option-related stuff.
*/
if (mePtr->type == CASCADE_ENTRY) {
if (menuPtr->masterMenuPtr != menuPtr) {
TkMenu *destroyThis = NULL;
- /*
- * The menu as a whole is a clone. We must delete the clone
- * of the cascaded menu for the particular entry we are
- * destroying.
+ /*
+ * The menu as a whole is a clone. We must delete the clone of the
+ * cascaded menu for the particular entry we are destroying.
*/
+
TkMenuReferences *menuRefPtr = mePtr->childMenuRefPtr;
+
if (menuRefPtr != NULL) {
destroyThis = menuRefPtr->menuPtr;
- /*
- * But only if it is a clone. What can happen is that
- * we are in the middle of deleting a menu and this
- * menu pointer has already been reset to point to the
- * original menu. In that case we have nothing special
- * to do.
+
+ /*
+ * But only if it is a clone. What can happen is that we are
+ * in the middle of deleting a menu and this menu pointer has
+ * already been reset to point to the original menu. In that
+ * case we have nothing special to do.
*/
- if ((destroyThis != NULL)
- && (destroyThis->masterMenuPtr == destroyThis)) {
+
+ if ((destroyThis != NULL)
+ && (destroyThis->masterMenuPtr == destroyThis)) {
destroyThis = NULL;
}
}
UnhookCascadeEntry(mePtr);
if (menuRefPtr != NULL) {
- if (menuRefPtr->menuPtr == destroyThis) {
- menuRefPtr->menuPtr = NULL;
- }
+ if (menuRefPtr->menuPtr == destroyThis) {
+ menuRefPtr->menuPtr = NULL;
+ }
if (destroyThis != NULL) {
TkDestroyMenu(destroyThis);
}
@@ -1489,10 +1479,11 @@ DestroyMenuEntry(memPtr)
if (mePtr->selectImage != NULL) {
Tk_FreeImage(mePtr->selectImage);
}
- if (((mePtr->type == CHECK_BUTTON_ENTRY)
+ if (((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY))
&& (mePtr->namePtr != NULL)) {
- char *varName = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
+ char *varName = Tcl_GetString(mePtr->namePtr);
+
Tcl_UntraceVar(menuPtr->interp, varName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuVarProc, (ClientData) mePtr);
@@ -1508,22 +1499,22 @@ DestroyMenuEntry(memPtr)
*
* MenuWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way (such as the fonts in the system changing) and the widget needs
- * to recompute all its graphics contexts and determine its new geometry.
+ * This function is called when the world has changed in some way (such
+ * as the fonts in the system changing) and the widget needs to recompute
+ * all its graphics contexts and determine its new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Menu will be relayed out and redisplayed.
+ * Menu will be relayed out and redisplayed.
*
*---------------------------------------------------------------------------
*/
static void
-MenuWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+MenuWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
TkMenu *menuPtr = (TkMenu *) instanceData;
int i;
@@ -1542,40 +1533,39 @@ MenuWorldChanged(instanceData)
*
* ConfigureMenu --
*
- * This procedure is called to process an argv/argc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a menu widget.
+ * This function is called to process an argv/argc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a menu widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, font, etc. get set
- * for menuPtr; old resources get freed, if there were any.
+ * Configuration information, such as colors, font, etc. get set for
+ * menuPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureMenu(interp, menuPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- register TkMenu *menuPtr; /* Information about widget; may or may
- * not already have values for some fields. */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
+ConfigureMenu(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register TkMenu *menuPtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *CONST objv[]) /* Arguments. */
{
int i;
TkMenu *menuListPtr, *cleanupPtr;
int result;
-
+
for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
menuListPtr->errorStructPtr = (Tk_SavedOptions *)
ckalloc(sizeof(Tk_SavedOptions));
result = Tk_SetOptions(interp, (char *) menuListPtr,
- menuListPtr->optionTablesPtr->menuOptionTable, objc, objv,
- menuListPtr->tkwin, menuListPtr->errorStructPtr, (int *) NULL);
+ menuListPtr->optionTablesPtr->menuOptionTable, objc, objv,
+ menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL);
if (result != TCL_OK) {
for (cleanupPtr = menuPtr->masterMenuPtr;
cleanupPtr != menuListPtr;
@@ -1593,25 +1583,24 @@ ConfigureMenu(interp, menuPtr, objc, objv)
}
/*
- * When a menu is created, the type is in all of the arguments
- * to the menu command. Let Tk_ConfigureWidget take care of
- * parsing them, and then set the type after we can look at
- * the type string. Once set, a menu's type cannot be changed
+ * When a menu is created, the type is in all of the arguments to the
+ * menu command. Let Tk_ConfigureWidget take care of parsing them, and
+ * then set the type after we can look at the type string. Once set, a
+ * menu's type cannot be changed
*/
-
+
if (menuListPtr->menuType == UNKNOWN_TYPE) {
Tcl_GetIndexFromObj(NULL, menuListPtr->menuTypePtr,
menuTypeStrings, NULL, 0, &menuListPtr->menuType);
/*
- * Configure the new window to be either a pop-up menu
- * or a tear-off menu.
- * We don't do this for menubars since they are not toplevel
- * windows. Also, since this gets called before CloneMenu has
- * a chance to set the menuType field, we have to look at the
+ * Configure the new window to be either a pop-up menu or a
+ * tear-off menu. We don't do this for menubars since they are not
+ * toplevel windows. Also, since this gets called before CloneMenu
+ * has a chance to set the menuType field, we have to look at the
* menuTypeName field to tell that this is a menu bar.
*/
-
+
if (menuListPtr->menuType == MASTER_MENU) {
TkpMakeMenuWindow(menuListPtr->tkwin, 1);
} else if (menuListPtr->menuType == TEAROFF_MENU) {
@@ -1621,10 +1610,10 @@ ConfigureMenu(interp, menuPtr, objc, objv)
/*
- * Depending on the -tearOff option, make sure that there is or
- * isn't an initial tear-off entry at the beginning of the menu.
+ * Depending on the -tearOff option, make sure that there is or isn't
+ * an initial tear-off entry at the beginning of the menu.
*/
-
+
if (menuListPtr->tearoff) {
if ((menuListPtr->numEntries == 0)
|| (menuListPtr->entries[0]->type != TEAROFF_ENTRY)) {
@@ -1647,7 +1636,7 @@ ConfigureMenu(interp, menuPtr, objc, objv)
} else if ((menuListPtr->numEntries > 0)
&& (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) {
int i;
-
+
Tcl_EventuallyFree((ClientData) menuListPtr->entries[0],
DestroyMenuEntry);
@@ -1663,21 +1652,21 @@ ConfigureMenu(interp, menuPtr, objc, objv)
}
TkMenuConfigureDrawOptions(menuListPtr);
-
+
/*
* After reconfiguring a menu, we need to reconfigure all of the
- * entries in the menu, since some of the things in the children
- * (such as graphics contexts) may have to change to reflect changes
- * in the parent.
+ * entries in the menu, since some of the things in the children (such
+ * as graphics contexts) may have to change to reflect changes in the
+ * parent.
*/
-
+
for (i = 0; i < menuListPtr->numEntries; i++) {
TkMenuEntry *mePtr;
-
+
mePtr = menuListPtr->entries[i];
- ConfigureMenuEntry(mePtr, 0, (Tcl_Obj **) NULL);
+ ConfigureMenuEntry(mePtr, 0, NULL);
}
-
+
TkEventuallyRecomputeMenu(menuListPtr);
}
@@ -1690,7 +1679,6 @@ ConfigureMenu(interp, menuPtr, objc, objv)
return TCL_OK;
}
-
/*
*----------------------------------------------------------------------
@@ -1698,23 +1686,23 @@ ConfigureMenu(interp, menuPtr, objc, objv)
* PostProcessEntry --
*
* This is called by ConfigureMenuEntry to do all of the configuration
- * after Tk_SetOptions is called. This is separate
- * so that error handling is easier.
+ * after Tk_SetOptions is called. This is separate so that error handling
+ * is easier.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information such as label and accelerator get
- * set for mePtr; old resources get freed, if there were any.
+ * Configuration information such as label and accelerator get set for
+ * mePtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-PostProcessEntry(mePtr)
- TkMenuEntry *mePtr; /* The entry we are configuring. */
+PostProcessEntry(
+ TkMenuEntry *mePtr) /* The entry we are configuring. */
{
TkMenu *menuPtr = mePtr->menuPtr;
int index = mePtr->index;
@@ -1722,9 +1710,9 @@ PostProcessEntry(mePtr)
Tk_Image image;
/*
- * The code below handles special configuration stuff not taken
- * care of by Tk_ConfigureWidget, such as special processing for
- * defaults, sizing strings, graphics contexts, etc.
+ * The code below handles special configuration stuff not taken care of by
+ * Tk_ConfigureWidget, such as special processing for defaults, sizing
+ * strings, graphics contexts, etc.
*/
if (mePtr->labelPtr == NULL) {
@@ -1752,16 +1740,15 @@ PostProcessEntry(mePtr)
* prevent compiler warning. */
/*
- * This is a cascade entry. If the menu that the cascade entry
- * is pointing to has changed, we need to remove this entry
- * from the list of entries pointing to the old menu, and add a
- * cascade reference to the list of entries pointing to the
- * new menu.
+ * This is a cascade entry. If the menu that the cascade entry is
+ * pointing to has changed, we need to remove this entry from the list
+ * of entries pointing to the old menu, and add a cascade reference to
+ * the list of entries pointing to the new menu.
*
* BUG: We are not recloning for special case #3 yet.
*/
-
- name = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
+
+ name = Tcl_GetString(mePtr->namePtr);
if (mePtr->childMenuRefPtr != NULL) {
oldHashKey = Tcl_GetHashKey(TkGetMenuHashTable(menuPtr->interp),
mePtr->childMenuRefPtr->hashEntryPtr);
@@ -1770,7 +1757,7 @@ PostProcessEntry(mePtr)
}
}
- if ((mePtr->childMenuRefPtr == NULL)
+ if ((mePtr->childMenuRefPtr == NULL)
|| (strcmp(oldHashKey, name) != 0)) {
menuRefPtr = TkCreateMenuReferences(menuPtr->interp, name);
mePtr->childMenuRefPtr = menuRefPtr;
@@ -1788,11 +1775,11 @@ PostProcessEntry(mePtr)
break;
}
}
-
+
/*
* Put the item at the front of the list.
*/
-
+
if (!alreadyThere) {
mePtr->nextCascadePtr = menuRefPtr->parentEntryPtr;
menuRefPtr->parentEntryPtr = mePtr;
@@ -1800,23 +1787,20 @@ PostProcessEntry(mePtr)
}
}
}
-
+
if (TkMenuConfigureEntryDrawOptions(mePtr, index) != TCL_OK) {
return TCL_ERROR;
}
- if (TkpConfigureMenuEntry(mePtr) != TCL_OK) {
- return TCL_ERROR;
- }
-
/*
- * Get the images for the entry, if there are any. Allocate the
- * new images before freeing the old ones, so that the reference
- * counts don't go to zero and cause image data to be discarded.
+ * Get the images for the entry, if there are any. Allocate the new images
+ * before freeing the old ones, so that the reference counts don't go to
+ * zero and cause image data to be discarded.
*/
if (mePtr->imagePtr != NULL) {
- char *imageString = Tcl_GetStringFromObj(mePtr->imagePtr, NULL);
+ char *imageString = Tcl_GetString(mePtr->imagePtr);
+
image = Tk_GetImage(menuPtr->interp, menuPtr->tkwin, imageString,
TkMenuImageProc, (ClientData) mePtr);
if (image == NULL) {
@@ -1830,8 +1814,8 @@ PostProcessEntry(mePtr)
}
mePtr->image = image;
if (mePtr->selectImagePtr != NULL) {
- char *selectImageString = Tcl_GetStringFromObj(
- mePtr->selectImagePtr, NULL);
+ char *selectImageString = Tcl_GetString(mePtr->selectImagePtr);
+
image = Tk_GetImage(menuPtr->interp, menuPtr->tkwin, selectImageString,
TkMenuSelectImageProc, (ClientData) mePtr);
if (image == NULL) {
@@ -1868,12 +1852,11 @@ PostProcessEntry(mePtr)
}
/*
- * Select the entry if the associated variable has the
- * appropriate value, initialize the variable if it doesn't
- * exist, then set a trace on the variable to monitor future
- * changes to its value.
+ * Select the entry if the associated variable has the appropriate
+ * value, initialize the variable if it doesn't exist, then set a
+ * trace on the variable to monitor future changes to its value.
*/
-
+
if (mePtr->namePtr != NULL) {
valuePtr = Tcl_ObjGetVar2(menuPtr->interp, mePtr->namePtr, NULL,
TCL_GLOBAL_ONLY);
@@ -1883,10 +1866,8 @@ PostProcessEntry(mePtr)
mePtr->entryFlags &= ~ENTRY_SELECTED;
if (valuePtr != NULL) {
if (mePtr->onValuePtr != NULL) {
- char *value = Tcl_GetStringFromObj(valuePtr, NULL);
- char *onValue = Tcl_GetStringFromObj(mePtr->onValuePtr,
- NULL);
-
+ char *value = Tcl_GetString(valuePtr);
+ char *onValue = Tcl_GetString(mePtr->onValuePtr);
if (strcmp(value, onValue) == 0) {
mePtr->entryFlags |= ENTRY_SELECTED;
@@ -1896,19 +1877,21 @@ PostProcessEntry(mePtr)
if (mePtr->namePtr != NULL) {
Tcl_ObjSetVar2(menuPtr->interp, mePtr->namePtr, NULL,
(mePtr->type == CHECK_BUTTON_ENTRY)
- ? mePtr->offValuePtr
- : Tcl_NewObj(),
- TCL_GLOBAL_ONLY);
+ ? mePtr->offValuePtr : Tcl_NewObj(), TCL_GLOBAL_ONLY);
}
}
if (mePtr->namePtr != NULL) {
- name = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
+ name = Tcl_GetString(mePtr->namePtr);
Tcl_TraceVar(menuPtr->interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuVarProc, (ClientData) mePtr);
}
}
-
+
+ if (TkpConfigureMenuEntry(mePtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
return TCL_OK;
}
@@ -1917,41 +1900,41 @@ PostProcessEntry(mePtr)
*
* ConfigureMenuEntry --
*
- * This procedure is called to process an argv/argc list in order
- * to configure (or reconfigure) one entry in a menu.
+ * This function is called to process an argv/argc list in order to
+ * configure (or reconfigure) one entry in a menu.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information such as label and accelerator get
- * set for mePtr; old resources get freed, if there were any.
+ * Configuration information such as label and accelerator get set for
+ * mePtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureMenuEntry(mePtr, objc, objv)
- register TkMenuEntry *mePtr; /* Information about menu entry; may
- * or may not already have values for
- * some fields. */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
+ConfigureMenuEntry(
+ register TkMenuEntry *mePtr,/* Information about menu entry; may or may
+ * not already have values for some fields. */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *CONST objv[]) /* Arguments. */
{
TkMenu *menuPtr = mePtr->menuPtr;
Tk_SavedOptions errorStruct;
int result;
/*
- * If this entry is a check button or radio button, then remove
- * its old trace procedure.
+ * If this entry is a check button or radio button, then remove its old
+ * trace function.
*/
if ((mePtr->namePtr != NULL)
&& ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY))) {
- char *name = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
+ char *name = Tcl_GetString(mePtr->namePtr);
+
Tcl_UntraceVar(menuPtr->interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuVarProc, (ClientData) mePtr);
@@ -1961,7 +1944,7 @@ ConfigureMenuEntry(mePtr, objc, objv)
if (menuPtr->tkwin != NULL) {
if (Tk_SetOptions(menuPtr->interp, (char *) mePtr,
mePtr->optionTable, objc, objv, menuPtr->tkwin,
- &errorStruct, (int *) NULL) != TCL_OK) {
+ &errorStruct, NULL) != TCL_OK) {
return TCL_ERROR;
}
result = PostProcessEntry(mePtr);
@@ -1973,7 +1956,7 @@ ConfigureMenuEntry(mePtr, objc, objv)
}
TkEventuallyRecomputeMenu(menuPtr);
-
+
return result;
}
@@ -1985,39 +1968,38 @@ ConfigureMenuEntry(mePtr, objc, objv)
* Calls ConfigureMenuEntry for each menu in the clone chain.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information such as label and accelerator get
- * set for mePtr; old resources get freed, if there were any.
+ * Configuration information such as label and accelerator get set for
+ * mePtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- TkMenu *menuPtr; /* Information about whole menu. */
- int index; /* Index of mePtr within menuPtr's
- * entries. */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
+ConfigureMenuCloneEntries(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ TkMenu *menuPtr, /* Information about whole menu. */
+ int index, /* Index of mePtr within menuPtr's entries. */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *CONST objv[]) /* Arguments. */
{
TkMenuEntry *mePtr;
TkMenu *menuListPtr;
int cascadeEntryChanged = 0;
- TkMenuReferences *oldCascadeMenuRefPtr, *cascadeMenuRefPtr = NULL;
+ TkMenuReferences *oldCascadeMenuRefPtr, *cascadeMenuRefPtr = NULL;
Tcl_Obj *oldCascadePtr = NULL;
char *newCascadeName;
/*
- * Cascades are kind of tricky here. This is special case #3 in the comment
- * at the top of this file. Basically, if a menu is the master menu of a
- * clone chain, and has an entry with a cascade menu, the clones of
- * the menu will point to clones of the cascade menu. We have
- * to destroy the clones of the cascades, clone the new cascade
- * menu, and configure the entry to point to the new clone.
+ * Cascades are kind of tricky here. This is special case #3 in the
+ * comment at the top of this file. Basically, if a menu is the master
+ * menu of a clone chain, and has an entry with a cascade menu, the clones
+ * of the menu will point to clones of the cascade menu. We have to
+ * destroy the clones of the cascades, clone the new cascade menu, and
+ * configure the entry to point to the new clone.
*/
mePtr = menuPtr->masterMenuPtr->entries[index];
@@ -2036,21 +2018,20 @@ ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv)
char *oldCascadeName;
if (mePtr->namePtr != NULL) {
- newCascadeName = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
+ newCascadeName = Tcl_GetString(mePtr->namePtr);
} else {
newCascadeName = NULL;
}
-
+
if ((oldCascadePtr == NULL) && (mePtr->namePtr == NULL)) {
cascadeEntryChanged = 0;
} else if (((oldCascadePtr == NULL) && (mePtr->namePtr != NULL))
- || ((oldCascadePtr != NULL)
+ || ((oldCascadePtr != NULL)
&& (mePtr->namePtr == NULL))) {
cascadeEntryChanged = 1;
} else {
- oldCascadeName = Tcl_GetStringFromObj(oldCascadePtr,
- NULL);
- cascadeEntryChanged = (strcmp(oldCascadeName, newCascadeName)
+ oldCascadeName = Tcl_GetString(oldCascadePtr);
+ cascadeEntryChanged = (strcmp(oldCascadeName, newCascadeName)
!= 0);
}
if (oldCascadePtr != NULL) {
@@ -2060,20 +2041,20 @@ ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv)
if (cascadeEntryChanged) {
if (mePtr->namePtr != NULL) {
- newCascadeName = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
+ newCascadeName = Tcl_GetString(mePtr->namePtr);
cascadeMenuRefPtr = TkFindMenuReferences(menuPtr->interp,
newCascadeName);
}
}
- for (menuListPtr = menuPtr->masterMenuPtr->nextInstancePtr;
+ for (menuListPtr = menuPtr->masterMenuPtr->nextInstancePtr;
menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
-
+
mePtr = menuListPtr->entries[index];
if (cascadeEntryChanged && (mePtr->namePtr != NULL)) {
- oldCascadeMenuRefPtr = TkFindMenuReferencesObj(menuPtr->interp,
+ oldCascadeMenuRefPtr = TkFindMenuReferencesObj(menuPtr->interp,
mePtr->namePtr);
if ((oldCascadeMenuRefPtr != NULL)
@@ -2085,7 +2066,7 @@ ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv)
if (ConfigureMenuEntry(mePtr, objc, objv) != TCL_OK) {
return TCL_ERROR;
}
-
+
if (cascadeEntryChanged && (mePtr->namePtr != NULL)) {
if (cascadeMenuRefPtr->menuPtr != NULL) {
Tcl_Obj *newObjv[2];
@@ -2097,7 +2078,7 @@ ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv)
Tcl_IncrRefCount(pathNamePtr);
newCloneNamePtr = TkNewMenuName(menuPtr->interp,
- pathNamePtr,
+ pathNamePtr,
cascadeMenuRefPtr->menuPtr);
Tcl_IncrRefCount(newCloneNamePtr);
Tcl_IncrRefCount(normalPtr);
@@ -2123,14 +2104,14 @@ ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv)
*
* TkGetMenuIndex --
*
- * Parse a textual index into a menu and return the numerical
- * index of the indicated entry.
+ * Parse a textual index into a menu and return the numerical index of
+ * the indicated entry.
*
* Results:
- * A standard Tcl result. If all went well, then *indexPtr is
- * filled in with the entry index corresponding to string
- * (ranges from -1 to the number of entries in the menu minus
- * one). Otherwise an error message is left in the interp's result.
+ * A standard Tcl result. If all went well, then *indexPtr is filled in
+ * with the entry index corresponding to string (ranges from -1 to the
+ * number of entries in the menu minus one). Otherwise an error message
+ * is left in the interp's result.
*
* Side effects:
* None.
@@ -2139,18 +2120,18 @@ ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv)
*/
int
-TkGetMenuIndex(interp, menuPtr, objPtr, lastOK, indexPtr)
- Tcl_Interp *interp; /* For error messages. */
- TkMenu *menuPtr; /* Menu for which the index is being
+TkGetMenuIndex(
+ Tcl_Interp *interp, /* For error messages. */
+ TkMenu *menuPtr, /* Menu for which the index is being
* specified. */
- Tcl_Obj *objPtr; /* Specification of an entry in menu. See
+ Tcl_Obj *objPtr, /* Specification of an entry in menu. See
* manual entry for valid .*/
- int lastOK; /* Non-zero means its OK to return index
- * just *after* last entry. */
- int *indexPtr; /* Where to store converted index. */
+ int lastOK, /* Non-zero means its OK to return index just
+ * *after* last entry. */
+ int *indexPtr) /* Where to store converted index. */
{
int i;
- char *string = Tcl_GetStringFromObj(objPtr, NULL);
+ char *string = Tcl_GetString(objPtr);
if ((string[0] == 'a') && (strcmp(string, "active") == 0)) {
*indexPtr = menuPtr->active;
@@ -2176,7 +2157,7 @@ TkGetMenuIndex(interp, menuPtr, objPtr, lastOK, indexPtr)
}
if (isdigit(UCHAR(string[0]))) {
- if (Tcl_GetInt(interp, string, &i) == TCL_OK) {
+ if (Tcl_GetInt(interp, string, &i) == TCL_OK) {
if (i >= menuPtr->numEntries) {
if (lastOK) {
i = menuPtr->numEntries;
@@ -2189,26 +2170,23 @@ TkGetMenuIndex(interp, menuPtr, objPtr, lastOK, indexPtr)
*indexPtr = i;
goto success;
}
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
}
for (i = 0; i < menuPtr->numEntries; i++) {
Tcl_Obj *labelPtr = menuPtr->entries[i]->labelPtr;
- char *label = (labelPtr == NULL) ? NULL
- : Tcl_GetStringFromObj(labelPtr, NULL);
-
- if ((label != NULL)
- && (Tcl_StringMatch(label, string))) {
+ char *label = (labelPtr == NULL) ? NULL : Tcl_GetString(labelPtr);
+
+ if ((label != NULL) && (Tcl_StringMatch(label, string))) {
*indexPtr = i;
goto success;
}
}
- Tcl_AppendResult(interp, "bad menu entry index \"",
- string, "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "bad menu entry index \"", string, "\"", NULL);
return TCL_ERROR;
-success:
+ success:
return TCL_OK;
}
@@ -2217,9 +2195,9 @@ success:
*
* MenuCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -2231,25 +2209,26 @@ success:
*/
static void
-MenuCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+MenuCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TkMenu *menuPtr = (TkMenu *) clientData;
Tk_Window tkwin = menuPtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
if (tkwin != NULL) {
- /*
- * Note: it may be desirable to NULL out the tkwin
- * field of menuPtr here:
+ /*
+ * Note: it may be desirable to NULL out the tkwin field of menuPtr
+ * here:
* menuPtr->tkwin = NULL;
*/
+
Tk_DestroyWindow(tkwin);
}
}
@@ -2259,12 +2238,12 @@ MenuCmdDeletedProc(clientData)
*
* MenuNewEntry --
*
- * This procedure allocates and initializes a new menu entry.
+ * This function allocates and initializes a new menu entry.
*
* Results:
- * The return value is a pointer to a new menu entry structure,
- * which has been malloc-ed, initialized, and entered into the
- * entry array for the menu.
+ * The return value is a pointer to a new menu entry structure, which has
+ * been malloc-ed, initialized, and entered into the entry array for the
+ * menu.
*
* Side effects:
* Storage gets allocated.
@@ -2273,19 +2252,18 @@ MenuCmdDeletedProc(clientData)
*/
static TkMenuEntry *
-MenuNewEntry(menuPtr, index, type)
- TkMenu *menuPtr; /* Menu that will hold the new entry. */
- int index; /* Where in the menu the new entry is to
+MenuNewEntry(
+ TkMenu *menuPtr, /* Menu that will hold the new entry. */
+ int index, /* Where in the menu the new entry is to
* go. */
- int type; /* The type of the new entry. */
+ int type) /* The type of the new entry. */
{
TkMenuEntry *mePtr;
TkMenuEntry **newEntries;
int i;
/*
- * Create a new array of entries with an empty slot for the
- * new entry.
+ * Create a new array of entries with an empty slot for the new entry.
*/
newEntries = (TkMenuEntry **) ckalloc((unsigned)
@@ -2293,7 +2271,7 @@ MenuNewEntry(menuPtr, index, type)
for (i = 0; i < index; i++) {
newEntries[i] = menuPtr->entries[i];
}
- for ( ; i < menuPtr->numEntries; i++) {
+ for (; i < menuPtr->numEntries; i++) {
newEntries[i+1] = menuPtr->entries[i];
newEntries[i+1]->index = i + 1;
}
@@ -2356,8 +2334,8 @@ MenuNewEntry(menuPtr, index, type)
*
* MenuAddOrInsert --
*
- * This procedure does all of the work of the "add" and "insert"
- * widget commands, allowing the code for these to be shared.
+ * This function does all of the work of the "add" and "insert" widget
+ * commands, allowing the code for these to be shared.
*
* Results:
* A standard Tcl return value.
@@ -2369,34 +2347,29 @@ MenuNewEntry(menuPtr, index, type)
*/
static int
-MenuAddOrInsert(interp, menuPtr, indexPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- TkMenu *menuPtr; /* Widget in which to create new
- * entry. */
- Tcl_Obj *indexPtr; /* Object describing index at which
- * to insert. NULL means insert at
- * end. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments to command: first arg
- * is type of entry, others are
- * config options. */
+MenuAddOrInsert(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ TkMenu *menuPtr, /* Widget in which to create new entry. */
+ Tcl_Obj *indexPtr, /* Object describing index at which to insert.
+ * NULL means insert at end. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments to command: first arg is type of
+ * entry, others are config options. */
{
int type, index;
TkMenuEntry *mePtr;
TkMenu *menuListPtr;
if (indexPtr != NULL) {
- if (TkGetMenuIndex(interp, menuPtr, indexPtr, 1, &index)
- != TCL_OK) {
+ if (TkGetMenuIndex(interp, menuPtr, indexPtr, 1, &index) != TCL_OK) {
return TCL_ERROR;
}
} else {
index = menuPtr->numEntries;
}
if (index < 0) {
- char *indexString = Tcl_GetStringFromObj(indexPtr, NULL);
- Tcl_AppendResult(interp, "bad index \"", indexString, "\"",
- (char *) NULL);
+ char *indexString = Tcl_GetString(indexPtr);
+ Tcl_AppendResult(interp, "bad index \"", indexString, "\"", NULL);
return TCL_ERROR;
}
if (menuPtr->tearoff && (index == 0)) {
@@ -2416,9 +2389,9 @@ MenuAddOrInsert(interp, menuPtr, indexPtr, objc, objv)
* Now we have to add an entry for every instance related to this menu.
*/
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
-
+
mePtr = MenuNewEntry(menuListPtr, index, type);
if (mePtr == NULL) {
return TCL_ERROR;
@@ -2447,48 +2420,46 @@ MenuAddOrInsert(interp, menuPtr, indexPtr, objc, objv)
}
return TCL_ERROR;
}
-
+
/*
- * If a menu has cascades, then every instance of the menu has
- * to have its own parallel cascade structure. So adding an
- * entry to a menu with clones means that the menu that the
- * entry points to has to be cloned for every clone the
- * master menu has. This is special case #2 in the comment
- * at the top of this file.
+ * If a menu has cascades, then every instance of the menu has to have
+ * its own parallel cascade structure. So adding an entry to a menu
+ * with clones means that the menu that the entry points to has to be
+ * cloned for every clone the master menu has. This is special case #2
+ * in the comment at the top of this file.
*/
-
- if ((menuPtr != menuListPtr) && (type == CASCADE_ENTRY)) {
+
+ if ((menuPtr != menuListPtr) && (type == CASCADE_ENTRY)) {
if ((mePtr->namePtr != NULL)
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
- TkMenu *cascadeMenuPtr =
+ TkMenu *cascadeMenuPtr =
mePtr->childMenuRefPtr->menuPtr->masterMenuPtr;
- Tcl_Obj *newCascadePtr;
+ Tcl_Obj *newCascadePtr, *newObjv[2];
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
- Tcl_Obj *windowNamePtr =
+ Tcl_Obj *windowNamePtr =
Tcl_NewStringObj(Tk_PathName(menuListPtr->tkwin), -1);
Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", -1);
- Tcl_Obj *newObjv[2];
TkMenuReferences *menuRefPtr;
-
+
Tcl_IncrRefCount(windowNamePtr);
newCascadePtr = TkNewMenuName(menuListPtr->interp,
windowNamePtr, cascadeMenuPtr);
Tcl_IncrRefCount(newCascadePtr);
Tcl_IncrRefCount(normalPtr);
CloneMenu(cascadeMenuPtr, newCascadePtr, normalPtr);
-
+
menuRefPtr = TkFindMenuReferencesObj(menuListPtr->interp,
newCascadePtr);
if (menuRefPtr == NULL) {
- panic("CloneMenu failed inside of MenuAddOrInsert.");
+ Tcl_Panic("CloneMenu failed inside of MenuAddOrInsert.");
}
newObjv[0] = menuNamePtr;
newObjv[1] = newCascadePtr;
Tcl_IncrRefCount(menuNamePtr);
Tcl_IncrRefCount(newCascadePtr);
- ConfigureMenuEntry(mePtr, 2, newObjv);
- Tcl_DecrRefCount(newCascadePtr);
+ ConfigureMenuEntry(mePtr, 2, newObjv);
+ Tcl_DecrRefCount(newCascadePtr);
Tcl_DecrRefCount(menuNamePtr);
Tcl_DecrRefCount(windowNamePtr);
Tcl_DecrRefCount(normalPtr);
@@ -2503,10 +2474,9 @@ MenuAddOrInsert(interp, menuPtr, indexPtr, objc, objv)
*
* MenuVarProc --
*
- * This procedure is invoked when someone changes the
- * state variable associated with a radiobutton or checkbutton
- * menu entry. The entry's selected state is set to match
- * the value of the variable.
+ * This function is invoked when someone changes the state variable
+ * associated with a radiobutton or checkbutton menu entry. The entry's
+ * selected state is set to match the value of the variable.
*
* Results:
* NULL is always returned.
@@ -2518,12 +2488,12 @@ MenuAddOrInsert(interp, menuPtr, indexPtr, objc, objv)
*/
static char *
-MenuVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about menu entry. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* First part of variable's name. */
- CONST char *name2; /* Second part of variable's name. */
- int flags; /* Describes what just happened. */
+MenuVarProc(
+ ClientData clientData, /* Information about menu entry. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ CONST char *name1, /* First part of variable's name. */
+ CONST char *name2, /* Second part of variable's name. */
+ int flags) /* Describes what just happened. */
{
TkMenuEntry *mePtr = (TkMenuEntry *) clientData;
TkMenu *menuPtr;
@@ -2536,11 +2506,11 @@ MenuVarProc(clientData, interp, name1, name2, flags)
* Do nothing if the interpreter is going away.
*/
- return (char *) NULL;
+ return NULL;
}
menuPtr = mePtr->menuPtr;
- name = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
+ name = Tcl_GetString(mePtr->namePtr);
/*
* If the variable is being unset, then re-establish the trace.
@@ -2554,13 +2524,13 @@ MenuVarProc(clientData, interp, name1, name2, flags)
MenuVarProc, clientData);
}
TkpConfigureMenuEntry(mePtr);
- TkEventuallyRedrawMenu(menuPtr, (TkMenuEntry *) NULL);
- return (char *) NULL;
+ TkEventuallyRedrawMenu(menuPtr, NULL);
+ return NULL;
}
/*
- * Use the value of the variable to update the selected status of
- * the menu entry.
+ * Use the value of the variable to update the selected status of the menu
+ * entry.
*/
value = Tcl_GetVar(interp, name, TCL_GLOBAL_ONLY);
@@ -2568,23 +2538,23 @@ MenuVarProc(clientData, interp, name1, name2, flags)
value = "";
}
if (mePtr->onValuePtr != NULL) {
- onValue = Tcl_GetStringFromObj(mePtr->onValuePtr, NULL);
+ onValue = Tcl_GetString(mePtr->onValuePtr);
if (strcmp(value, onValue) == 0) {
if (mePtr->entryFlags & ENTRY_SELECTED) {
- return (char *) NULL;
+ return NULL;
}
mePtr->entryFlags |= ENTRY_SELECTED;
} else if (mePtr->entryFlags & ENTRY_SELECTED) {
mePtr->entryFlags &= ~ENTRY_SELECTED;
} else {
- return (char *) NULL;
+ return NULL;
}
} else {
- return (char *) NULL;
+ return NULL;
}
TkpConfigureMenuEntry(mePtr);
TkEventuallyRedrawMenu(menuPtr, mePtr);
- return (char *) NULL;
+ return NULL;
}
/*
@@ -2592,26 +2562,25 @@ MenuVarProc(clientData, interp, name1, name2, flags)
*
* TkActivateMenuEntry --
*
- * This procedure is invoked to make a particular menu entry
- * the active one, deactivating any other entry that might
- * currently be active.
+ * This function is invoked to make a particular menu entry the active
+ * one, deactivating any other entry that might currently be active.
*
* Results:
- * The return value is a standard Tcl result (errors can occur
- * while posting and unposting submenus).
+ * The return value is a standard Tcl result (errors can occur while
+ * posting and unposting submenus).
*
* Side effects:
- * Menu entries get redisplayed, and the active entry changes.
- * Submenus may get posted and unposted.
+ * Menu entries get redisplayed, and the active entry changes. Submenus
+ * may get posted and unposted.
*
*----------------------------------------------------------------------
*/
int
-TkActivateMenuEntry(menuPtr, index)
- register TkMenu *menuPtr; /* Menu in which to activate. */
- int index; /* Index of entry to activate, or
- * -1 to deactivate all entries. */
+TkActivateMenuEntry(
+ register TkMenu *menuPtr, /* Menu in which to activate. */
+ int index) /* Index of entry to activate, or -1 to
+ * deactivate all entries. */
{
register TkMenuEntry *mePtr;
int result = TCL_OK;
@@ -2620,8 +2589,8 @@ TkActivateMenuEntry(menuPtr, index)
mePtr = menuPtr->entries[menuPtr->active];
/*
- * Don't change the state unless it's currently active (state
- * might already have been changed to disabled).
+ * Don't change the state unless it's currently active (state might
+ * already have been changed to disabled).
*/
if (mePtr->state == ENTRY_ACTIVE) {
@@ -2646,8 +2615,8 @@ TkActivateMenuEntry(menuPtr, index)
* Execute the postcommand for the given menu.
*
* Results:
- * The return value is a standard Tcl result (errors can occur
- * while the postcommands are being processed).
+ * The return value is a standard Tcl result (errors can occur while the
+ * postcommands are being processed).
*
* Side effects:
* Since commands can get executed while this routine is being executed,
@@ -2655,17 +2624,17 @@ TkActivateMenuEntry(menuPtr, index)
*
*----------------------------------------------------------------------
*/
-
+
int
-TkPostCommand(menuPtr)
- TkMenu *menuPtr;
+TkPostCommand(
+ TkMenu *menuPtr)
{
int result;
/*
- * If there is a command for the menu, execute it. This
- * may change the size of the menu, so be sure to recompute
- * the menu's geometry if needed.
+ * If there is a command for the menu, execute it. This may change the
+ * size of the menu, so be sure to recompute the menu's geometry if
+ * needed.
*/
if (menuPtr->postCommandPtr != NULL) {
@@ -2688,37 +2657,36 @@ TkPostCommand(menuPtr)
*
* CloneMenu --
*
- * Creates a child copy of the menu. It will be inserted into
- * the menu's instance chain. All attributes and entry
- * attributes will be duplicated.
+ * Creates a child copy of the menu. It will be inserted into the menu's
+ * instance chain. All attributes and entry attributes will be
+ * duplicated.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * Allocates storage. After the menu is created, any
- * configuration done with this menu or any related one
- * will be reflected in all of them.
+ * Allocates storage. After the menu is created, any configuration done
+ * with this menu or any related one will be reflected in all of them.
*
*--------------------------------------------------------------
*/
static int
-CloneMenu(menuPtr, newMenuNamePtr, newMenuTypePtr)
- TkMenu *menuPtr; /* The menu we are going to clone */
- Tcl_Obj *newMenuNamePtr; /* The name to give the new menu */
- Tcl_Obj *newMenuTypePtr; /* What kind of menu is this, a normal menu
- * a menubar, or a tearoff? */
+CloneMenu(
+ TkMenu *menuPtr, /* The menu we are going to clone. */
+ Tcl_Obj *newMenuNamePtr, /* The name to give the new menu. */
+ Tcl_Obj *newMenuTypePtr) /* What kind of menu is this, a normal menu a
+ * menubar, or a tearoff? */
{
int returnResult;
int menuType, i;
TkMenuReferences *menuRefPtr;
Tcl_Obj *menuDupCommandArray[4];
-
+
if (newMenuTypePtr == NULL) {
- menuType = MASTER_MENU;
+ menuType = MASTER_MENU;
} else {
- if (Tcl_GetIndexFromObj(menuPtr->interp, newMenuTypePtr,
+ if (Tcl_GetIndexFromObj(menuPtr->interp, newMenuTypePtr,
menuTypeStrings, "menu type", 0, &menuType) != TCL_OK) {
return TCL_ERROR;
}
@@ -2744,12 +2712,12 @@ CloneMenu(menuPtr, newMenuNamePtr, newMenuTypePtr)
/*
* Make sure the tcl command actually created the clone.
*/
-
+
if ((returnResult == TCL_OK) &&
- ((menuRefPtr = TkFindMenuReferencesObj(menuPtr->interp,
- newMenuNamePtr)) != (TkMenuReferences *) NULL)
+ ((menuRefPtr = TkFindMenuReferencesObj(menuPtr->interp,
+ newMenuNamePtr)) != NULL)
&& (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) {
- TkMenu *newMenuPtr = menuRefPtr->menuPtr;
+ TkMenu *newMenuPtr = menuRefPtr->menuPtr;
Tcl_Obj *newObjv[3];
int i, numElements;
@@ -2763,83 +2731,85 @@ CloneMenu(menuPtr, newMenuNamePtr, newMenuTypePtr)
newMenuPtr->masterMenuPtr = menuPtr->masterMenuPtr;
} else {
TkMenu *masterMenuPtr;
-
+
masterMenuPtr = menuPtr->masterMenuPtr;
newMenuPtr->nextInstancePtr = masterMenuPtr->nextInstancePtr;
masterMenuPtr->nextInstancePtr = newMenuPtr;
newMenuPtr->masterMenuPtr = masterMenuPtr;
}
-
- /*
- * Add the master menu's window to the bind tags for this window
- * after this window's tag. This is so the user can bind to either
- * this clone (which may not be easy to do) or the entire menu
- * clone structure.
- */
-
+
+ /*
+ * Add the master menu's window to the bind tags for this window after
+ * this window's tag. This is so the user can bind to either this
+ * clone (which may not be easy to do) or the entire menu clone
+ * structure.
+ */
+
newObjv[0] = Tcl_NewStringObj("bindtags", -1);
- newObjv[1] = Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin), -1);
+ newObjv[1] = Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin), -1);
Tcl_IncrRefCount(newObjv[0]);
Tcl_IncrRefCount(newObjv[1]);
- if (Tk_BindtagsObjCmd((ClientData)newMenuPtr->tkwin,
- newMenuPtr->interp, 2, newObjv) == TCL_OK) {
- char *windowName;
- Tcl_Obj *bindingsPtr =
+ if (Tk_BindtagsObjCmd((ClientData)newMenuPtr->tkwin,
+ newMenuPtr->interp, 2, newObjv) == TCL_OK) {
+ char *windowName;
+ Tcl_Obj *bindingsPtr =
Tcl_DuplicateObj(Tcl_GetObjResult(newMenuPtr->interp));
- Tcl_Obj *elementPtr;
-
+ Tcl_Obj *elementPtr;
+
Tcl_IncrRefCount(bindingsPtr);
- Tcl_ListObjLength(newMenuPtr->interp, bindingsPtr, &numElements);
- for (i = 0; i < numElements; i++) {
- Tcl_ListObjIndex(newMenuPtr->interp, bindingsPtr, i,
+ Tcl_ListObjLength(newMenuPtr->interp, bindingsPtr, &numElements);
+ for (i = 0; i < numElements; i++) {
+ Tcl_ListObjIndex(newMenuPtr->interp, bindingsPtr, i,
&elementPtr);
- windowName = Tcl_GetStringFromObj(elementPtr, NULL);
- if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin))
- == 0) {
- Tcl_Obj *newElementPtr = Tcl_NewStringObj(
- Tk_PathName(newMenuPtr->masterMenuPtr->tkwin), -1);
- /*
+ windowName = Tcl_GetString(elementPtr);
+ if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin))
+ == 0) {
+ Tcl_Obj *newElementPtr = Tcl_NewStringObj(
+ Tk_PathName(newMenuPtr->masterMenuPtr->tkwin), -1);
+
+ /*
* The newElementPtr will have its refCount incremented
* here, so we don't need to worry about it any more.
*/
- Tcl_ListObjReplace(menuPtr->interp, bindingsPtr,
- i + 1, 0, 1, &newElementPtr);
+
+ Tcl_ListObjReplace(menuPtr->interp, bindingsPtr,
+ i + 1, 0, 1, &newElementPtr);
newObjv[2] = bindingsPtr;
Tk_BindtagsObjCmd((ClientData)newMenuPtr->tkwin,
menuPtr->interp, 3, newObjv);
- break;
- }
- }
- Tcl_DecrRefCount(bindingsPtr);
- }
+ break;
+ }
+ }
+ Tcl_DecrRefCount(bindingsPtr);
+ }
Tcl_DecrRefCount(newObjv[0]);
Tcl_DecrRefCount(newObjv[1]);
- Tcl_ResetResult(menuPtr->interp);
-
- /*
- * Clone all of the cascade menus that this menu points to.
- */
-
- for (i = 0; i < menuPtr->numEntries; i++) {
- TkMenuReferences *cascadeRefPtr;
- TkMenu *oldCascadePtr;
-
- if ((menuPtr->entries[i]->type == CASCADE_ENTRY)
+ Tcl_ResetResult(menuPtr->interp);
+
+ /*
+ * Clone all of the cascade menus that this menu points to.
+ */
+
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ TkMenuReferences *cascadeRefPtr;
+ TkMenu *oldCascadePtr;
+
+ if ((menuPtr->entries[i]->type == CASCADE_ENTRY)
&& (menuPtr->entries[i]->namePtr != NULL)) {
- cascadeRefPtr =
+ cascadeRefPtr =
TkFindMenuReferencesObj(menuPtr->interp,
menuPtr->entries[i]->namePtr);
- if ((cascadeRefPtr != NULL) && (cascadeRefPtr->menuPtr)) {
- Tcl_Obj *windowNamePtr =
+ if ((cascadeRefPtr != NULL) && (cascadeRefPtr->menuPtr)) {
+ Tcl_Obj *windowNamePtr =
Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin),
-1);
Tcl_Obj *newCascadePtr;
-
- oldCascadePtr = cascadeRefPtr->menuPtr;
+
+ oldCascadePtr = cascadeRefPtr->menuPtr;
Tcl_IncrRefCount(windowNamePtr);
- newCascadePtr = TkNewMenuName(menuPtr->interp,
- windowNamePtr, oldCascadePtr);
+ newCascadePtr = TkNewMenuName(menuPtr->interp,
+ windowNamePtr, oldCascadePtr);
Tcl_IncrRefCount(newCascadePtr);
CloneMenu(oldCascadePtr, newCascadePtr, NULL);
@@ -2850,13 +2820,13 @@ CloneMenu(menuPtr, newMenuNamePtr, newMenuTypePtr)
Tcl_DecrRefCount(newObjv[0]);
Tcl_DecrRefCount(newCascadePtr);
Tcl_DecrRefCount(windowNamePtr);
- }
- }
- }
-
- returnResult = TCL_OK;
+ }
+ }
+ }
+
+ returnResult = TCL_OK;
} else {
- returnResult = TCL_ERROR;
+ returnResult = TCL_ERROR;
}
Tcl_Release((ClientData) menuPtr);
return returnResult;
@@ -2865,6 +2835,43 @@ CloneMenu(menuPtr, newMenuNamePtr, newMenuTypePtr)
/*
*----------------------------------------------------------------------
*
+ * MenuDoXPosition --
+ *
+ * Given arguments from an option command line, returns the X position.
+ *
+ * Results:
+ * Returns TCL_OK or TCL_Error
+ *
+ * Side effects:
+ * xPosition is set to the X-position of the menu entry.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+MenuDoXPosition(
+ Tcl_Interp *interp,
+ TkMenu *menuPtr,
+ Tcl_Obj *objPtr)
+{
+ int index;
+
+ TkRecomputeMenu(menuPtr);
+ if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tcl_ResetResult(interp);
+ if (index < 0) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+ } else {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(menuPtr->entries[index]->x));
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* MenuDoYPosition --
*
* Given arguments from an option command line, returns the Y position.
@@ -2877,18 +2884,18 @@ CloneMenu(menuPtr, newMenuNamePtr, newMenuTypePtr)
*
*----------------------------------------------------------------------
*/
-
+
static int
-MenuDoYPosition(interp, menuPtr, objPtr)
- Tcl_Interp *interp;
- TkMenu *menuPtr;
- Tcl_Obj *objPtr;
+MenuDoYPosition(
+ Tcl_Interp *interp,
+ TkMenu *menuPtr,
+ Tcl_Obj *objPtr)
{
int index;
-
+
TkRecomputeMenu(menuPtr);
if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
- goto error;
+ goto error;
}
Tcl_ResetResult(interp);
if (index < 0) {
@@ -2898,8 +2905,8 @@ MenuDoYPosition(interp, menuPtr, objPtr)
}
return TCL_OK;
-
-error:
+
+ error:
return TCL_ERROR;
}
@@ -2908,36 +2915,39 @@ error:
*
* GetIndexFromCoords --
*
- * Given a string of the form "@int", return the menu item corresponding
- * to int.
+ * Given a string of the form "@integer", return the menu item
+ * corresponding to the provided y-coordinate in the menu window.
*
* Results:
- * If int is a valid number, *indexPtr will be the number of the menuentry
- * that is the correct height. If int is invaled, *indexPtr will be
- * unchanged. Returns appropriate Tcl error number.
+ * If int is a valid number, *indexPtr will be the number of the
+ * menuentry that is the correct height. If int is invalid, *indexPtr
+ * will be unchanged. Returns appropriate Tcl error number.
*
* Side effects:
- * If int is invalid, interp's result will set to NULL.
+ * If int is invalid, interp's result will be set to NULL.
*
*----------------------------------------------------------------------
*/
static int
-GetIndexFromCoords(interp, menuPtr, string, indexPtr)
- Tcl_Interp *interp; /* interp of menu */
- TkMenu *menuPtr; /* the menu we are searching */
- char *string; /* The @string we are parsing */
- int *indexPtr; /* The index of the item that matches */
+GetIndexFromCoords(
+ Tcl_Interp *interp, /* Interpreter of menu. */
+ TkMenu *menuPtr, /* The menu we are searching. */
+ char *string, /* The @string we are parsing. */
+ int *indexPtr) /* The index of the item that matches. */
{
int x, y, i;
char *p, *end;
-
+ int x2, borderwidth, max;
+
TkRecomputeMenu(menuPtr);
p = string + 1;
y = strtol(p, &end, 0);
if (end == p) {
goto error;
}
+ Tk_GetPixelsFromObj(interp, menuPtr->tkwin,
+ menuPtr->borderWidthPtr, &borderwidth);
if (*end == ',') {
x = y;
p = end + 1;
@@ -2946,27 +2956,36 @@ GetIndexFromCoords(interp, menuPtr, string, indexPtr)
goto error;
}
} else {
- Tk_GetPixelsFromObj(interp, menuPtr->tkwin,
- menuPtr->borderWidthPtr, &x);
+ x = borderwidth;
}
-
+
+ *indexPtr = -1;
+
+ /* set the width of the final column to the remainder of the window
+ * being aware of windows that may not be mapped yet.
+ */
+ max = Tk_IsMapped(menuPtr->tkwin)
+ ? Tk_Width(menuPtr->tkwin) : Tk_ReqWidth(menuPtr->tkwin);
+ max -= borderwidth;
+
for (i = 0; i < menuPtr->numEntries; i++) {
+ if (menuPtr->entries[i]->entryFlags & ENTRY_LAST_COLUMN) {
+ x2 = max;
+ } else {
+ x2 = menuPtr->entries[i]->x + menuPtr->entries[i]->width;
+ }
if ((x >= menuPtr->entries[i]->x) && (y >= menuPtr->entries[i]->y)
- && (x < (menuPtr->entries[i]->x + menuPtr->entries[i]->width))
+ && (x < x2)
&& (y < (menuPtr->entries[i]->y
+ menuPtr->entries[i]->height))) {
+ *indexPtr = i;
break;
}
}
- if (i >= menuPtr->numEntries) {
- /* i = menuPtr->numEntries - 1; */
- i = -1;
- }
- *indexPtr = i;
return TCL_OK;
- error:
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ error:
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
return TCL_ERROR;
}
@@ -2976,8 +2995,8 @@ GetIndexFromCoords(interp, menuPtr, string, indexPtr)
* RecursivelyDeleteMenu --
*
* Deletes a menu and any cascades underneath it. Used for deleting
- * instances when a menu is no longer being used as a menubar,
- * for instance.
+ * instances when a menu is no longer being used as a menubar, for
+ * instance.
*
* Results:
* None.
@@ -2989,19 +3008,19 @@ GetIndexFromCoords(interp, menuPtr, string, indexPtr)
*/
static void
-RecursivelyDeleteMenu(menuPtr)
- TkMenu *menuPtr; /* The menubar instance we are deleting */
+RecursivelyDeleteMenu(
+ TkMenu *menuPtr) /* The menubar instance we are deleting. */
{
int i;
TkMenuEntry *mePtr;
-
- /*
- * It is not 100% clear that this preserve/release pair is
- * required, but we have added them for safety in this
- * very complex code.
+
+ /*
+ * It is not 100% clear that this preserve/release pair is required, but
+ * we have added them for safety in this very complex code.
*/
+
Tcl_Preserve(menuPtr);
-
+
for (i = 0; i < menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
if ((mePtr->type == CASCADE_ENTRY)
@@ -3013,7 +3032,7 @@ RecursivelyDeleteMenu(menuPtr)
if (menuPtr->tkwin != NULL) {
Tk_DestroyWindow(menuPtr->tkwin);
}
-
+
Tcl_Release(menuPtr);
}
@@ -3022,8 +3041,7 @@ RecursivelyDeleteMenu(menuPtr)
*
* TkNewMenuName --
*
- * Makes a new unique name for a cloned menu. Will be a child
- * of oldName.
+ * Makes a new unique name for a cloned menu. Will be a child of oldName.
*
* Results:
* Returns a char * which has been allocated; caller must free.
@@ -3035,10 +3053,10 @@ RecursivelyDeleteMenu(menuPtr)
*/
Tcl_Obj *
-TkNewMenuName(interp, parentPtr, menuPtr)
- Tcl_Interp *interp; /* The interp the new name has to live in.*/
- Tcl_Obj *parentPtr; /* The prefix path of the new name. */
- TkMenu *menuPtr; /* The menu we are cloning. */
+TkNewMenuName(
+ Tcl_Interp *interp, /* The interp the new name has to live in.*/
+ Tcl_Obj *parentPtr, /* The prefix path of the new name. */
+ TkMenu *menuPtr) /* The menu we are cloning. */
{
Tcl_Obj *resultPtr = NULL; /* Initialization needed only to prevent
* compiler warning. */
@@ -3049,7 +3067,7 @@ TkNewMenuName(interp, parentPtr, menuPtr)
Tcl_CmdInfo cmdInfo;
Tcl_HashTable *nameTablePtr = NULL;
TkWindow *winPtr = (TkWindow *) menuPtr->tkwin;
- char *parentName = Tcl_GetStringFromObj(parentPtr, NULL);
+ char *parentName = Tcl_GetString(parentPtr);
if (winPtr->mainPtr != NULL) {
nameTablePtr = &(winPtr->mainPtr->nameTable);
@@ -3058,13 +3076,13 @@ TkNewMenuName(interp, parentPtr, menuPtr)
doDot = parentName[strlen(parentName) - 1] != '.';
childPtr = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin), -1);
- for (destString = Tcl_GetStringFromObj(childPtr, NULL);
+ for (destString = Tcl_GetString(childPtr);
*destString != '\0'; destString++) {
if (*destString == '.') {
*destString = '#';
}
}
-
+
for (i = 0; ; i++) {
if (i == 0) {
resultPtr = Tcl_DuplicateObj(parentPtr);
@@ -3085,7 +3103,7 @@ TkNewMenuName(interp, parentPtr, menuPtr)
Tcl_AppendObjToObj(resultPtr, intPtr);
Tcl_DecrRefCount(intPtr);
}
- destString = Tcl_GetStringFromObj(resultPtr, NULL);
+ destString = Tcl_GetString(resultPtr);
if ((Tcl_GetCommandInfo(interp, destString, &cmdInfo) == 0)
&& ((nameTablePtr == NULL)
|| (Tcl_FindHashEntry(nameTablePtr, destString) == NULL))) {
@@ -3101,76 +3119,73 @@ TkNewMenuName(interp, parentPtr, menuPtr)
*
* TkSetWindowMenuBar --
*
- * Associates a menu with a window. Called by ConfigureFrame in
- * in response to a "-menu .foo" configuration option for a top
- * level.
+ * Associates a menu with a window. Called by ConfigureFrame in in
+ * response to a "-menu .foo" configuration option for a top level.
*
* Results:
* None.
*
* Side effects:
- * The old menu clones for the menubar are thrown away, and a
- * handler is set up to allocate the new ones.
+ * The old menu clones for the menubar are thrown away, and a handler is
+ * set up to allocate the new ones.
*
*----------------------------------------------------------------------
*/
+
void
-TkSetWindowMenuBar(interp, tkwin, oldMenuName, menuName)
- Tcl_Interp *interp; /* The interpreter the toplevel lives in. */
- Tk_Window tkwin; /* The toplevel window */
- char *oldMenuName; /* The name of the menubar previously set in
- * this toplevel. NULL means no menu was
- * set previously. */
- char *menuName; /* The name of the new menubar that the
+TkSetWindowMenuBar(
+ Tcl_Interp *interp, /* The interpreter the toplevel lives in. */
+ Tk_Window tkwin, /* The toplevel window. */
+ char *oldMenuName, /* The name of the menubar previously set in
+ * this toplevel. NULL means no menu was set
+ * previously. */
+ char *menuName) /* The name of the new menubar that the
* toplevel needs to be set to. NULL means
* that their is no menu now. */
{
TkMenuTopLevelList *topLevelListPtr, *prevTopLevelPtr;
TkMenu *menuPtr;
TkMenuReferences *menuRefPtr;
-
- TkMenuInit();
/*
- * Destroy the menubar instances of the old menu. Take this window
- * out of the old menu's top level reference list.
+ * Destroy the menubar instances of the old menu. Take this window out of
+ * the old menu's top level reference list.
*/
-
- if (oldMenuName != NULL) {
- menuRefPtr = TkFindMenuReferences(interp, oldMenuName);
- if (menuRefPtr != NULL) {
+ if (oldMenuName != NULL) {
+ menuRefPtr = TkFindMenuReferences(interp, oldMenuName);
+ if (menuRefPtr != NULL) {
/*
- * Find the menubar instance that is to be removed. Destroy
- * it and all of the cascades underneath it.
+ * Find the menubar instance that is to be removed. Destroy it and
+ * all of the cascades underneath it.
*/
- if (menuRefPtr->menuPtr != NULL) {
- TkMenu *instancePtr;
-
- menuPtr = menuRefPtr->menuPtr;
-
- for (instancePtr = menuPtr->masterMenuPtr;
- instancePtr != NULL;
- instancePtr = instancePtr->nextInstancePtr) {
- if (instancePtr->menuType == MENUBAR
- && instancePtr->parentTopLevelPtr == tkwin) {
- RecursivelyDeleteMenu(instancePtr);
- break;
- }
- }
- }
-
- /*
- * Now we need to remove this toplevel from the list of toplevels
+ if (menuRefPtr->menuPtr != NULL) {
+ TkMenu *instancePtr;
+
+ menuPtr = menuRefPtr->menuPtr;
+
+ for (instancePtr = menuPtr->masterMenuPtr;
+ instancePtr != NULL;
+ instancePtr = instancePtr->nextInstancePtr) {
+ if (instancePtr->menuType == MENUBAR
+ && instancePtr->parentTopLevelPtr == tkwin) {
+ RecursivelyDeleteMenu(instancePtr);
+ break;
+ }
+ }
+ }
+
+ /*
+ * Now we need to remove this toplevel from the list of toplevels
* that reference this menu.
- */
-
+ */
+
topLevelListPtr = menuRefPtr->topLevelListPtr;
prevTopLevelPtr = NULL;
-
- while ((topLevelListPtr != NULL)
- && (topLevelListPtr->tkwin != tkwin)) {
+
+ while ((topLevelListPtr != NULL)
+ && (topLevelListPtr->tkwin != tkwin)) {
prevTopLevelPtr = topLevelListPtr;
topLevelListPtr = topLevelListPtr->nextPtr;
}
@@ -3181,54 +3196,54 @@ TkSetWindowMenuBar(interp, tkwin, oldMenuName, menuName)
*/
if (topLevelListPtr != NULL) {
- if (prevTopLevelPtr == NULL) {
+ if (prevTopLevelPtr == NULL) {
menuRefPtr->topLevelListPtr =
menuRefPtr->topLevelListPtr->nextPtr;
} else {
- prevTopLevelPtr->nextPtr = topLevelListPtr->nextPtr;
- }
- ckfree((char *) topLevelListPtr);
- TkFreeMenuReferences(menuRefPtr);
- }
- }
+ prevTopLevelPtr->nextPtr = topLevelListPtr->nextPtr;
+ }
+ ckfree((char *) topLevelListPtr);
+ TkFreeMenuReferences(menuRefPtr);
+ }
+ }
}
/*
* Now, add the clone references for the new menu.
*/
-
+
if (menuName != NULL && menuName[0] != 0) {
- TkMenu *menuBarPtr = NULL;
-
- menuRefPtr = TkCreateMenuReferences(interp, menuName);
-
- menuPtr = menuRefPtr->menuPtr;
- if (menuPtr != NULL) {
- Tcl_Obj *cloneMenuPtr;
- TkMenuReferences *cloneMenuRefPtr;
+ TkMenu *menuBarPtr = NULL;
+
+ menuRefPtr = TkCreateMenuReferences(interp, menuName);
+
+ menuPtr = menuRefPtr->menuPtr;
+ if (menuPtr != NULL) {
+ Tcl_Obj *cloneMenuPtr;
+ TkMenuReferences *cloneMenuRefPtr;
Tcl_Obj *newObjv[4];
- Tcl_Obj *windowNamePtr = Tcl_NewStringObj(Tk_PathName(tkwin),
+ Tcl_Obj *windowNamePtr = Tcl_NewStringObj(Tk_PathName(tkwin),
-1);
Tcl_Obj *menubarPtr = Tcl_NewStringObj("menubar", -1);
-
- /*
- * Clone the menu and all of the cascades underneath it.
- */
+
+ /*
+ * Clone the menu and all of the cascades underneath it.
+ */
Tcl_IncrRefCount(windowNamePtr);
- cloneMenuPtr = TkNewMenuName(interp, windowNamePtr,
- menuPtr);
+ cloneMenuPtr = TkNewMenuName(interp, windowNamePtr,
+ menuPtr);
Tcl_IncrRefCount(cloneMenuPtr);
Tcl_IncrRefCount(menubarPtr);
- CloneMenu(menuPtr, cloneMenuPtr, menubarPtr);
-
- cloneMenuRefPtr = TkFindMenuReferencesObj(interp, cloneMenuPtr);
- if ((cloneMenuRefPtr != NULL)
+ CloneMenu(menuPtr, cloneMenuPtr, menubarPtr);
+
+ cloneMenuRefPtr = TkFindMenuReferencesObj(interp, cloneMenuPtr);
+ if ((cloneMenuRefPtr != NULL)
&& (cloneMenuRefPtr->menuPtr != NULL)) {
Tcl_Obj *cursorPtr = Tcl_NewStringObj("-cursor", -1);
Tcl_Obj *nullPtr = Tcl_NewObj();
- cloneMenuRefPtr->menuPtr->parentTopLevelPtr = tkwin;
- menuBarPtr = cloneMenuRefPtr->menuPtr;
+ cloneMenuRefPtr->menuPtr->parentTopLevelPtr = tkwin;
+ menuBarPtr = cloneMenuRefPtr->menuPtr;
newObjv[0] = cursorPtr;
newObjv[1] = nullPtr;
Tcl_IncrRefCount(cursorPtr);
@@ -3237,27 +3252,26 @@ TkSetWindowMenuBar(interp, tkwin, oldMenuName, menuName)
2, newObjv);
Tcl_DecrRefCount(cursorPtr);
Tcl_DecrRefCount(nullPtr);
- }
+ }
TkpSetWindowMenuBar(tkwin, menuBarPtr);
Tcl_DecrRefCount(cloneMenuPtr);
Tcl_DecrRefCount(menubarPtr);
Tcl_DecrRefCount(windowNamePtr);
- } else {
- TkpSetWindowMenuBar(tkwin, NULL);
+ } else {
+ TkpSetWindowMenuBar(tkwin, NULL);
}
-
- /*
- * Add this window to the menu's list of windows that refer
- * to this menu.
- */
+ /*
+ * Add this window to the menu's list of windows that refer to this
+ * menu.
+ */
- topLevelListPtr = (TkMenuTopLevelList *)
+ topLevelListPtr = (TkMenuTopLevelList *)
ckalloc(sizeof(TkMenuTopLevelList));
- topLevelListPtr->tkwin = tkwin;
- topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr;
- menuRefPtr->topLevelListPtr = topLevelListPtr;
+ topLevelListPtr->tkwin = tkwin;
+ topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr;
+ menuRefPtr->topLevelListPtr = topLevelListPtr;
} else {
TkpSetWindowMenuBar(tkwin, NULL);
}
@@ -3269,8 +3283,8 @@ TkSetWindowMenuBar(interp, tkwin, oldMenuName, menuName)
*
* DestroyMenuHashTable --
*
- * Called when an interp is deleted and a menu hash table has
- * been set in it.
+ * Called when an interp is deleted and a menu hash table has been set in
+ * it.
*
* Results:
* None.
@@ -3282,9 +3296,9 @@ TkSetWindowMenuBar(interp, tkwin, oldMenuName, menuName)
*/
static void
-DestroyMenuHashTable(clientData, interp)
- ClientData clientData; /* The menu hash table we are destroying */
- Tcl_Interp *interp; /* The interpreter we are destroying */
+DestroyMenuHashTable(
+ ClientData clientData, /* The menu hash table we are destroying. */
+ Tcl_Interp *interp) /* The interpreter we are destroying. */
{
Tcl_DeleteHashTable((Tcl_HashTable *) clientData);
ckfree((char *) clientData);
@@ -3295,8 +3309,8 @@ DestroyMenuHashTable(clientData, interp)
*
* TkGetMenuHashTable --
*
- * For a given interp, give back the menu hash table that goes with
- * it. If the hash table does not exist, it is created.
+ * For a given interp, give back the menu hash table that goes with it.
+ * If the hash table does not exist, it is created.
*
* Results:
* Returns a hash table pointer.
@@ -3309,13 +3323,13 @@ DestroyMenuHashTable(clientData, interp)
*/
Tcl_HashTable *
-TkGetMenuHashTable(interp)
- Tcl_Interp *interp; /* The interp we need the hash table in.*/
+TkGetMenuHashTable(
+ Tcl_Interp *interp) /* The interp we need the hash table in.*/
{
Tcl_HashTable *menuTablePtr;
- menuTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, MENU_HASH_KEY,
- NULL);
+ menuTablePtr = (Tcl_HashTable *)
+ Tcl_GetAssocData(interp, MENU_HASH_KEY, NULL);
if (menuTablePtr == NULL) {
menuTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(menuTablePtr, TCL_STRING_KEYS);
@@ -3330,25 +3344,26 @@ TkGetMenuHashTable(interp)
*
* TkCreateMenuReferences --
*
- * Given a pathname, gives back a pointer to a TkMenuReferences structure.
- * If a reference is not already in the hash table, one is created.
+ * Given a pathname, gives back a pointer to a TkMenuReferences
+ * structure. If a reference is not already in the hash table, one is
+ * created.
*
* Results:
- * Returns a pointer to a menu reference structure. Should not
- * be freed by calller; when a field of the reference is cleared,
+ * Returns a pointer to a menu reference structure. Should not be freed
+ * by calller; when a field of the reference is cleared,
* TkFreeMenuReferences should be called.
*
* Side effects:
- * A new hash table entry is created if there were no references
- * to the menu originally.
+ * A new hash table entry is created if there were no references to the
+ * menu originally.
*
*----------------------------------------------------------------------
*/
TkMenuReferences *
-TkCreateMenuReferences(interp, pathName)
- Tcl_Interp *interp;
- char *pathName; /* The path of the menu widget */
+TkCreateMenuReferences(
+ Tcl_Interp *interp,
+ char *pathName) /* The path of the menu widget. */
{
Tcl_HashEntry *hashEntryPtr;
TkMenuReferences *menuRefPtr;
@@ -3378,8 +3393,8 @@ TkCreateMenuReferences(interp, pathName)
* structure.
*
* Results:
- * Returns a pointer to a menu reference structure. Should not
- * be freed by calller; when a field of the reference is cleared,
+ * Returns a pointer to a menu reference structure. Should not be freed
+ * by calller; when a field of the reference is cleared,
* TkFreeMenuReferences should be called. Returns NULL if no reference
* with this pathname exists.
*
@@ -3390,9 +3405,9 @@ TkCreateMenuReferences(interp, pathName)
*/
TkMenuReferences *
-TkFindMenuReferences(interp, pathName)
- Tcl_Interp *interp; /* The interp the menu is living in. */
- char *pathName; /* The path of the menu widget */
+TkFindMenuReferences(
+ Tcl_Interp *interp, /* The interp the menu is living in. */
+ char *pathName) /* The path of the menu widget. */
{
Tcl_HashEntry *hashEntryPtr;
TkMenuReferences *menuRefPtr = NULL;
@@ -3415,8 +3430,8 @@ TkFindMenuReferences(interp, pathName)
* structure.
*
* Results:
- * Returns a pointer to a menu reference structure. Should not
- * be freed by calller; when a field of the reference is cleared,
+ * Returns a pointer to a menu reference structure. Should not be freed
+ * by calller; when a field of the reference is cleared,
* TkFreeMenuReferences should be called. Returns NULL if no reference
* with this pathname exists.
*
@@ -3427,11 +3442,11 @@ TkFindMenuReferences(interp, pathName)
*/
TkMenuReferences *
-TkFindMenuReferencesObj(interp, objPtr)
- Tcl_Interp *interp; /* The interp the menu is living in. */
- Tcl_Obj *objPtr; /* The path of the menu widget */
+TkFindMenuReferencesObj(
+ Tcl_Interp *interp, /* The interp the menu is living in. */
+ Tcl_Obj *objPtr) /* The path of the menu widget. */
{
- char *pathName = Tcl_GetStringFromObj(objPtr, NULL);
+ char *pathName = Tcl_GetString(objPtr);
return TkFindMenuReferences(interp, pathName);
}
@@ -3440,26 +3455,25 @@ TkFindMenuReferencesObj(interp, objPtr)
*
* TkFreeMenuReferences --
*
- * This is called after one of the fields in a menu reference
- * is cleared. It cleans up the ref if it is now empty.
+ * This is called after one of the fields in a menu reference is cleared.
+ * It cleans up the ref if it is now empty.
*
* Results:
- * Returns 1 if the references structure was freed, and 0
- * otherwise.
+ * Returns 1 if the references structure was freed, and 0 otherwise.
*
* Side effects:
- * If this is the last field to be cleared, the menu ref is
- * taken out of the hash table.
+ * If this is the last field to be cleared, the menu ref is taken out of
+ * the hash table.
*
*----------------------------------------------------------------------
*/
int
-TkFreeMenuReferences(menuRefPtr)
- TkMenuReferences *menuRefPtr; /* The menu reference to
- * free */
+TkFreeMenuReferences(
+ TkMenuReferences *menuRefPtr)
+ /* The menu reference to free. */
{
- if ((menuRefPtr->menuPtr == NULL)
+ if ((menuRefPtr->menuPtr == NULL)
&& (menuRefPtr->parentEntryPtr == NULL)
&& (menuRefPtr->topLevelListPtr == NULL)) {
Tcl_DeleteHashEntry(menuRefPtr->hashEntryPtr);
@@ -3474,8 +3488,8 @@ TkFreeMenuReferences(menuRefPtr)
*
* DeleteMenuCloneEntries --
*
- * For every clone in this clone chain, delete the menu entries
- * given by the parameters.
+ * For every clone in this clone chain, delete the menu entries given by
+ * the parameters.
*
* Results:
* None.
@@ -3487,13 +3501,12 @@ TkFreeMenuReferences(menuRefPtr)
*/
static void
-DeleteMenuCloneEntries(menuPtr, first, last)
- TkMenu *menuPtr; /* the menu the command was issued with */
- int first; /* the zero-based first entry in the set
- * of entries to delete. */
- int last; /* the zero-based last entry */
+DeleteMenuCloneEntries(
+ TkMenu *menuPtr, /* The menu the command was issued with. */
+ int first, /* The zero-based first entry in the set of
+ * entries to delete. */
+ int last) /* The zero-based last entry. */
{
-
TkMenu *menuListPtr;
int numDeleted, i, j;
@@ -3508,13 +3521,13 @@ DeleteMenuCloneEntries(menuPtr, first, last)
j = i - numDeleted;
menuListPtr->entries[j] = menuListPtr->entries[i];
menuListPtr->entries[j]->index = j;
- }
+ }
menuListPtr->numEntries -= numDeleted;
if (menuListPtr->numEntries == 0) {
ckfree((char *) menuListPtr->entries);
menuListPtr->entries = NULL;
}
- if ((menuListPtr->active >= first)
+ if ((menuListPtr->active >= first)
&& (menuListPtr->active <= last)) {
menuListPtr->active = -1;
} else if (menuListPtr->active > last) {
@@ -3524,28 +3537,29 @@ DeleteMenuCloneEntries(menuPtr, first, last)
}
}
-/*
- *----------------------------------------------------------------------
- *
- * TkMenuCleanup --
- *
- * Resets menusInitialized to allow Tk to be finalized and reused
- * without the DLL being unloaded.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-TkMenuCleanup(ClientData unused)
-{
- menusInitialized = 0;
-}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMenuCleanup --
+ *
+ * Resets menusInitialized to allow Tk to be finalized and reused without
+ * the DLL being unloaded.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TkMenuCleanup(
+ ClientData unused)
+{
+ menusInitialized = 0;
+}
/*
*----------------------------------------------------------------------
@@ -3565,21 +3579,23 @@ TkMenuCleanup(ClientData unused)
*/
void
-TkMenuInit()
+TkMenuInit(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+
if (!menusInitialized) {
Tcl_MutexLock(&menuMutex);
if (!menusInitialized) {
TkpMenuInit();
menusInitialized = 1;
}
- /*
- * Make sure we cleanup on finalize.
- */
- TkCreateExitHandler(TkMenuCleanup, NULL);
+
+ /*
+ * Make sure we cleanup on finalize.
+ */
+
+ TkCreateExitHandler((Tcl_ExitProc *) TkMenuCleanup, NULL);
Tcl_MutexUnlock(&menuMutex);
}
if (!tsdPtr->menusInitialized) {
@@ -3587,3 +3603,11 @@ TkMenuInit()
tsdPtr->menusInitialized = 1;
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 767e3fc..24f32e7 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -1,12 +1,13 @@
/*
* tkMenu.h --
*
- * Declarations shared among all of the files that implement menu widgets.
+ * Declarations shared among all of the files that implement menu
+ * widgets.
*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKMENU
@@ -37,26 +38,41 @@ typedef struct TkMenuPlatformData_ *TkMenuPlatformData;
typedef struct TkMenuPlatformEntryData_ *TkMenuPlatformEntryData;
/*
- * Legal values for the "compound" field of TkMenuEntry and TkMenuButton records.
+ * Legal values for the "compound" field of TkMenuEntry and TkMenuButton
+ * records.
*/
enum compound {
COMPOUND_BOTTOM, COMPOUND_CENTER, COMPOUND_LEFT, COMPOUND_NONE,
- COMPOUND_RIGHT, COMPOUND_TOP
+ COMPOUND_RIGHT, COMPOUND_TOP
};
/*
- * One of the following data structures is kept for each entry of each
- * menu managed by this file:
+ * Additional menu entry drawing parameters for Windows platform.
+ * DRAW_MENU_ENTRY_ARROW makes TkpDrawMenuEntry draw the arrow
+ * itself when cascade entry is disabled.
+ * DRAW_MENU_ENTRY_NOUNDERLINE forbids underline when ODS_NOACCEL
+ * is set, thus obeying the system-wide Windows UI setting.
+ */
+
+enum drawingParameters {
+ DRAW_MENU_ENTRY_ARROW = (1<<0),
+ DRAW_MENU_ENTRY_NOUNDERLINE = (1<<1)
+};
+
+/*
+ * One of the following data structures is kept for each entry of each menu
+ * managed by this file:
*/
typedef struct TkMenuEntry {
- int type; /* Type of menu entry; see below for
- * valid types. */
- struct TkMenu *menuPtr; /* Menu with which this entry is associated. */
+ int type; /* Type of menu entry; see below for valid
+ * types. */
+ struct TkMenu *menuPtr; /* Menu with which this entry is
+ * associated. */
Tk_OptionTable optionTable; /* Option table for this menu entry. */
- Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL
- * if no label). */
+ Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if
+ * no label). */
int labelLength; /* Number of non-NULL characters in label. */
int state; /* State of button for display purposes:
* normal, active, or disabled. */
@@ -66,19 +82,18 @@ typedef struct TkMenuEntry {
Tcl_Obj *underlinePtr; /* Index of character to underline. */
Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or None.
* If not None then label is ignored. */
- Tcl_Obj *imagePtr; /* Name of image to display, or
- * NULL. If non-NULL, bitmap, text, and
- * textVarName are ignored. */
+ Tcl_Obj *imagePtr; /* Name of image to display, or NULL. If not
+ * NULL, bitmap, text, and textVarName are
+ * ignored. */
Tk_Image image; /* Image to display in menu entry, or NULL if
* none. */
- Tcl_Obj *selectImagePtr; /* Name of image to display when selected, or
+ Tcl_Obj *selectImagePtr; /* Name of image to display when selected, or
* NULL. */
- Tk_Image selectImage; /* Image to display in entry when selected,
- * or NULL if none. Ignored if image is
- * NULL. */
- Tcl_Obj *accelPtr; /* Accelerator string displayed at right
- * of menu entry. NULL means no such
- * accelerator. Malloc'ed. */
+ Tk_Image selectImage; /* Image to display in entry when selected, or
+ * NULL if none. Ignored if image is NULL. */
+ Tcl_Obj *accelPtr; /* Accelerator string displayed at right of
+ * menu entry. NULL means no such accelerator.
+ * Malloc'ed. */
int accelLength; /* Number of non-NULL characters in
* accelerator. */
int indicatorOn; /* True means draw indicator, false means
@@ -89,42 +104,43 @@ typedef struct TkMenuEntry {
*/
Tcl_Obj *borderPtr; /* Structure used to draw background for
- * entry. NULL means use overall border
- * for menu. */
- Tcl_Obj *fgPtr; /* Foreground color to use for entry. NULL
+ * entry. NULL means use overall border for
+ * menu. */
+ Tcl_Obj *fgPtr; /* Foreground color to use for entry. NULL
* means use foreground color from menu. */
Tcl_Obj *activeBorderPtr; /* Used to draw background and border when
- * element is active. NULL means use
+ * element is active. NULL means use
* activeBorder from menu. */
Tcl_Obj *activeFgPtr; /* Foreground color to use when entry is
- * active. NULL means use active foreground
+ * active. NULL means use active foreground
* from menu. */
Tcl_Obj *indicatorFgPtr; /* Color for indicators in radio and check
- * button entries. NULL means use indicatorFg
+ * button entries. NULL means use indicatorFg
* GC from menu. */
- Tcl_Obj *fontPtr; /* Text font for menu entries. NULL means
- * use overall font for menu. */
- int columnBreak; /* If this is 0, this item appears below
- * the item in front of it. If this is
- * 1, this item starts a new column. This
- * field is always 0 for tearoff and separator
+ Tcl_Obj *fontPtr; /* Text font for menu entries. NULL means use
+ * overall font for menu. */
+ int columnBreak; /* If this is 0, this item appears below the
+ * item in front of it. If this is 1, this
+ * item starts a new column. This field is
+ * always 0 for tearoff and separator
* entries. */
int hideMargin; /* If this is 0, then the item has enough
* margin to accomodate a standard check mark
* and a default right margin. If this is 1,
- * then the item has no such margins. and
+ * then the item has no such margins, and
* checkbuttons and radiobuttons with this set
- * will have a rectangle drawn in the indicator
- * around the item if the item is checked. This
- * is useful for palette menus. This field is
- * ignored for separators and tearoffs. */
+ * will have a rectangle drawn in the
+ * indicator around the item if the item is
+ * checked. This is useful for palette menus.
+ * This field is ignored for separators and
+ * tearoffs. */
int indicatorSpace; /* The width of the indicator space for this
* entry. */
int labelWidth; /* Number of pixels to allow for displaying
* labels in menu entries. */
- int compound; /* Value of -compound option; specifies whether
- * the entry should show both an image and
- * text, and, if so, how. */
+ int compound; /* Value of -compound option; specifies
+ * whether the entry should show both an image
+ * and text, and, if so, how. */
/*
* Information used to implement this entry's action:
@@ -134,78 +150,76 @@ typedef struct TkMenuEntry {
* Malloc'ed. */
Tcl_Obj *namePtr; /* Name of variable (for check buttons and
* radio buttons) or menu (for cascade
- * entries). Malloc'ed.*/
+ * entries). Malloc'ed. */
Tcl_Obj *onValuePtr; /* Value to store in variable when selected
* (only for radio and check buttons).
* Malloc'ed. */
Tcl_Obj *offValuePtr; /* Value to store in variable when not
* selected (only for check buttons).
* Malloc'ed. */
-
+
/*
* Information used for drawing this menu entry.
*/
-
+
int width; /* Number of pixels occupied by entry in
- * horizontal dimension. Not used except
- * in menubars. The width of norma menus
- * is dependent on the rest of the menu. */
- int x; /* X-coordinate of leftmost pixel in entry */
+ * horizontal dimension. Not used except in
+ * menubars. The width of norma menus is
+ * dependent on the rest of the menu. */
+ int x; /* X-coordinate of leftmost pixel in entry. */
int height; /* Number of pixels occupied by entry in
- * vertical dimension, including raised
- * border drawn around entry when active. */
+ * vertical dimension, including raised border
+ * drawn around entry when active. */
int y; /* Y-coordinate of topmost pixel in entry. */
- GC textGC; /* GC for drawing text in entry. NULL means
+ GC textGC; /* GC for drawing text in entry. NULL means
* use overall textGC for menu. */
GC activeGC; /* GC for drawing text in entry when active.
* NULL means use overall activeGC for
* menu. */
GC disabledGC; /* Used to produce disabled effect for entry.
- * NULL means use overall disabledGC from
- * menu structure. See comments for
- * disabledFg in menu structure for more
- * information. */
- GC indicatorGC; /* For drawing indicators. None means use
- * GC from menu. */
+ * NULL means use overall disabledGC from menu
+ * structure. See comments for disabledFg in
+ * menu structure for more information. */
+ GC indicatorGC; /* For drawing indicators. None means use GC
+ * from menu. */
/*
* Miscellaneous fields.
*/
-
- int entryFlags; /* Various flags. See below for
- definitions. */
- int index; /* Need to know which index we are. This
- * is zero-based. This is the top-left entry
- * of the menu. */
-
+
+ int entryFlags; /* Various flags. See below for
+ * definitions. */
+ int index; /* Need to know which index we are. This is
+ * zero-based. This is the top-left entry of
+ * the menu. */
+
/*
* Bookeeping for master menus and cascade menus.
*/
-
+
struct TkMenuReferences *childMenuRefPtr;
- /* A pointer to the hash table entry for
- * the child menu. Stored here when the menu
- * entry is configured so that a hash lookup
- * is not necessary later.*/
+ /* A pointer to the hash table entry for the
+ * child menu. Stored here when the menu entry
+ * is configured so that a hash lookup is not
+ * necessary later.*/
struct TkMenuEntry *nextCascadePtr;
/* The next cascade entry that is a parent of
- * this entry's child cascade menu. NULL
- * end of list, this is not a cascade entry,
- * or the menu that this entry point to
- * does not yet exist. */
+ * this entry's child cascade menu. NULL end
+ * of list, this is not a cascade entry, or
+ * the menu that this entry point to does not
+ * yet exist. */
TkMenuPlatformEntryData platformEntryData;
/* The data for the specific type of menu.
- * Depends on platform and menu type what
- * kind of options are in this structure.
- */
+ * Depends on platform and menu type what kind
+ * of options are in this structure. */
} TkMenuEntry;
/*
* Flag values defined for menu entries:
*
- * ENTRY_SELECTED: Non-zero means this is a radio or check
- * button and that it should be drawn in
- * the "selected" state.
+ * ENTRY_SELECTED: Non-zero means this is a radio or check button
+ * and that it should be drawn in the "selected"
+ * state.
* ENTRY_NEEDS_REDISPLAY: Non-zero means the entry should be redisplayed.
* ENTRY_LAST_COLUMN: Used by the drawing code. If the entry is in
* the last column, the space to its right needs
@@ -238,44 +252,43 @@ typedef struct TkMenuEntry {
* Menu states
*/
-EXTERN char *tkMenuStateStrings[];
+MODULE_SCOPE char *tkMenuStateStrings[];
#define ENTRY_ACTIVE 0
#define ENTRY_NORMAL 1
#define ENTRY_DISABLED 2
/*
- * A data structure of the following type is kept for each
- * menu widget:
+ * A data structure of the following type is kept for each menu widget:
*/
typedef struct TkMenu {
- Tk_Window tkwin; /* Window that embodies the pane. NULL
- * means that the window has been destroyed
- * but the data structures haven't yet been
- * cleaned up.*/
- Display *display; /* Display containing widget. Needed, among
+ Tk_Window tkwin; /* Window that embodies the pane. NULL means
+ * that the window has been destroyed but the
+ * data structures haven't yet been cleaned
+ * up. */
+ Display *display; /* Display containing widget. Needed, among
* other things, so that resources can be
* freed up even after tkwin has gone away. */
Tcl_Interp *interp; /* Interpreter associated with menu. */
Tcl_Command widgetCmd; /* Token for menu's widget command. */
- TkMenuEntry **entries; /* Array of pointers to all the entries
- * in the menu. NULL means no entries. */
+ TkMenuEntry **entries; /* Array of pointers to all the entries in the
+ * menu. NULL means no entries. */
int numEntries; /* Number of elements in entries. */
- int active; /* Index of active entry. -1 means
- * nothing active. */
- int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR.
- * See below for definitions. */
- Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin
- * is a toplevel or not. "normal", "menubar",
- * or "toplevel" */
+ int active; /* Index of active entry. -1 means nothing
+ * active. */
+ int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See
+ * below for definitions. */
+ Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a
+ * toplevel or not. "normal", "menubar", or
+ * "toplevel" */
/*
* Information used when displaying widget:
*/
- Tcl_Obj *borderPtr; /* Structure used to draw 3-D
- * border and background for menu. */
+ Tcl_Obj *borderPtr; /* Structure used to draw 3-D border and
+ * background for menu. */
Tcl_Obj *borderWidthPtr; /* Width of border around whole menu. */
Tcl_Obj *activeBorderPtr; /* Used to draw background and border for
* active element (if any). */
@@ -284,18 +297,17 @@ typedef struct TkMenu {
Tcl_Obj *reliefPtr; /* 3-d effect: TK_RELIEF_RAISED, etc. */
Tcl_Obj *fontPtr; /* Text font for menu entries. */
Tcl_Obj *fgPtr; /* Foreground color for entries. */
- Tcl_Obj *disabledFgPtr; /* Foreground color when disabled. NULL
- * means use normalFg with a 50% stipple
- * instead. */
+ Tcl_Obj *disabledFgPtr; /* Foreground color when disabled. NULL means
+ * use normalFg with a 50% stipple instead. */
Tcl_Obj *activeFgPtr; /* Foreground color for active entry. */
Tcl_Obj *indicatorFgPtr; /* Color for indicators in radio and check
* button entries. */
- Pixmap gray; /* Bitmap for drawing disabled entries in
- * a stippled fashion. None means not
- * allocated yet. */
- GC textGC; /* GC for drawing text and other features
- * of menu entries. */
- GC disabledGC; /* Used to produce disabled effect. If
+ Pixmap gray; /* Bitmap for drawing disabled entries in a
+ * stippled fashion. None means not allocated
+ * yet. */
+ GC textGC; /* GC for drawing text and other features of
+ * menu entries. */
+ GC disabledGC; /* Used to produce disabled effect. If
* disabledFg isn't NULL, this GC is used to
* draw text and icons for disabled entries.
* Otherwise text and icons are drawn with
@@ -303,52 +315,51 @@ typedef struct TkMenu {
* background across them. */
GC activeGC; /* GC for drawing active entry. */
GC indicatorGC; /* For drawing indicators. */
- GC disabledImageGC; /* Used for drawing disabled images. They
- * have to be stippled. This is created
- * when the image is about to be drawn the
- * first time. */
+ GC disabledImageGC; /* Used for drawing disabled images. They have
+ * to be stippled. This is created when the
+ * image is about to be drawn the first
+ * time. */
/*
* Information about geometry of menu.
*/
-
- int totalWidth; /* Width of entire menu */
- int totalHeight; /* Height of entire menu */
-
+
+ int totalWidth; /* Width of entire menu. */
+ int totalHeight; /* Height of entire menu. */
+
/*
* Miscellaneous information:
*/
int tearoff; /* 1 means this menu can be torn off. On some
- * platforms, the user can drag an outline
- * of the menu by just dragging outside of
- * the menu, and the tearoff is created where
- * the mouse is released. On others, an
- * indicator (such as a dashed stripe) is
- * drawn, and when the menu is selected, the
- * tearoff is created. */
+ * platforms, the user can drag an outline of
+ * the menu by just dragging outside of the
+ * menu, and the tearoff is created where the
+ * mouse is released. On others, an indicator
+ * (such as a dashed stripe) is drawn, and
+ * when the menu is selected, the tearoff is
+ * created. */
Tcl_Obj *titlePtr; /* The title to use when this menu is torn
- * off. If this is NULL, a default scheme
- * will be used to generate a title for
- * tearoff. */
- Tcl_Obj *tearoffCommandPtr; /* If non-NULL, points to a command to
- * run whenever the menu is torn-off. */
- Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
+ * off. If this is NULL, a default scheme will
+ * be used to generate a title for tearoff. */
+ Tcl_Obj *tearoffCommandPtr; /* If non-NULL, points to a command to run
+ * whenever the menu is torn-off. */
+ Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
Tcl_Obj *cursorPtr; /* Current cursor for window, or None. */
Tcl_Obj *postCommandPtr; /* Used to detect cycles in cascade hierarchy
- * trees when preprocessing postcommands
- * on some platforms. See PostMenu for
- * more details. */
+ * trees when preprocessing postcommands on
+ * some platforms. See PostMenu for more
+ * details. */
int postCommandGeneration; /* Need to do pre-invocation post command
- * traversal */
+ * traversal. */
int menuFlags; /* Flags for use by X; see below for
- definition */
+ * definition. */
TkMenuEntry *postedCascade; /* Points to menu entry for cascaded submenu
* that is currently posted or NULL if no
* submenu posted. */
- struct TkMenu *nextInstancePtr;
+ struct TkMenu *nextInstancePtr;
/* The next instance of this menu in the
* chain. */
struct TkMenu *masterMenuPtr;
@@ -356,29 +367,26 @@ typedef struct TkMenu {
* clone chain. Points back to this structure
* if this menu is a master menu. */
struct TkMenuOptionTables *optionTablesPtr;
- /* A pointer to the collection of option tables
- * that work with menus and menu entries. */
+ /* A pointer to the collection of option
+ * tables that work with menus and menu
+ * entries. */
Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the
- * toplevel that owns the menu. Only applicable
- * for menubar clones.
- */
- struct TkMenuReferences *menuRefPtr;
+ * toplevel that owns the menu. Only
+ * applicable for menubar clones. */
+ struct TkMenuReferences *menuRefPtr;
/* Each menu is hashed into a table with the
- * name of the menu's window as the key.
- * The information in this hash table includes
- * a pointer to the menu (so that cascades
- * can find this menu), a pointer to the
- * list of toplevel widgets that have this
- * menu as its menubar, and a list of menu
- * entries that have this menu specified
- * as a cascade. */
+ * name of the menu's window as the key. The
+ * information in this hash table includes a
+ * pointer to the menu (so that cascades can
+ * find this menu), a pointer to the list of
+ * toplevel widgets that have this menu as its
+ * menubar, and a list of menu entries that
+ * have this menu specified as a cascade. */
TkMenuPlatformData platformData;
/* The data for the specific type of menu.
- * Depends on platform and menu type what
- * kind of options are in this structure.
- */
- Tk_OptionSpec *extensionPtr;
- /* Needed by the configuration package for
+ * Depends on platform and menu type what kind
+ * of options are in this structure. */
+ Tk_OptionSpec *extensionPtr;/* Needed by the configuration package for
* this widget to be extended. */
Tk_SavedOptions *errorStructPtr;
/* We actually have to allocate these because
@@ -388,95 +396,94 @@ typedef struct TkMenu {
/*
* When the toplevel configure -menu command is executed, the menu may not
- * exist yet. We need to keep a linked list of windows that reference
- * a particular menu.
+ * exist yet. We need to keep a linked list of windows that reference a
+ * particular menu.
*/
typedef struct TkMenuTopLevelList {
struct TkMenuTopLevelList *nextPtr;
- /* The next window in the list */
+ /* The next window in the list. */
Tk_Window tkwin; /* The window that has this menu as its
* menubar. */
} TkMenuTopLevelList;
/*
- * The following structure is used to keep track of things which
- * reference a menu. It is created when:
+ * The following structure is used to keep track of things which reference a
+ * menu. It is created when:
* - a menu is created.
* - a cascade entry is added to a menu with a non-null name
- * - the "-menu" configuration option is used on a toplevel widget
- * with a non-null parameter.
+ * - the "-menu" configuration option is used on a toplevel widget with a
+ * non-null parameter.
*
- * One of these three fields must be non-NULL, but any of the fields may
- * be NULL. This structure makes it easy to determine whether or not
- * anything like recalculating platform data or geometry is necessary
- * when one of the three actions above is performed.
+ * One of these three fields must be non-NULL, but any of the fields may be
+ * NULL. This structure makes it easy to determine whether or not anything
+ * like recalculating platform data or geometry is necessary when one of the
+ * three actions above is performed.
*/
typedef struct TkMenuReferences {
- struct TkMenu *menuPtr; /* The menu data structure. This is NULL
- * if the menu does not exist. */
+ struct TkMenu *menuPtr; /* The menu data structure. This is NULL if
+ * the menu does not exist. */
TkMenuTopLevelList *topLevelListPtr;
- /* First in the list of all toplevels that
- * have this menu as its menubar. NULL if no
+ /* First in the list of all toplevels that
+ * have this menu as its menubar. NULL if no
* toplevel widgets have this menu as its
* menubar. */
- TkMenuEntry *parentEntryPtr;/* First in the list of all cascade menu
+ TkMenuEntry *parentEntryPtr;/* First in the list of all cascade menu
* entries that have this menu as their child.
* NULL means no cascade entries. */
Tcl_HashEntry *hashEntryPtr;/* This is needed because the pathname of the
* window (which is what we hash on) may not
- * be around when we are deleting.
- */
+ * be around when we are deleting. */
} TkMenuReferences;
/*
- * This structure contains all of the option tables that are needed
- * by menus.
+ * This structure contains all of the option tables that are needed by menus.
*/
typedef struct TkMenuOptionTables {
- Tk_OptionTable menuOptionTable; /* The option table for menus. */
- Tk_OptionTable entryOptionTables[6];/* The tables for menu entries. */
+ Tk_OptionTable menuOptionTable;
+ /* The option table for menus. */
+ Tk_OptionTable entryOptionTables[6];
+ /* The tables for menu entries. */
} TkMenuOptionTables;
/*
* Flag bits for menus:
*
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler
- * has already been queued to redraw
- * this window.
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
+ * already been queued to redraw this window.
* RESIZE_PENDING: Non-zero means a call to ComputeMenuGeometry
* has already been scheduled.
- * MENU_DELETION_PENDING Non-zero means that we are currently destroying
- * this menu's internal structures. This is useful
- * when we are in the middle of cleaning
- * this master menu's chain of menus up when
- * TkDestroyMenu was called again on this
+ * MENU_DELETION_PENDING Non-zero means that we are currently
+ * destroying this menu's internal structures.
+ * This is useful when we are in the middle of
+ * cleaning this master menu's chain of menus up
+ * when TkDestroyMenu was called again on this
* menu (via a destroy binding or somesuch).
- * MENU_WIN_DESTRUCTION_PENDING Non-zero means we are in the middle of
- * destroying this menu's Tk_Window.
+ * MENU_WIN_DESTRUCTION_PENDING Non-zero means we are in the middle of
+ * destroying this menu's Tk_Window.
* MENU_PLATFORM_FLAG1... Reserved for use by the platform-specific menu
* code.
*/
-#define REDRAW_PENDING 1
-#define RESIZE_PENDING 2
-#define MENU_DELETION_PENDING 4
+#define REDRAW_PENDING 1
+#define RESIZE_PENDING 2
+#define MENU_DELETION_PENDING 4
#define MENU_WIN_DESTRUCTION_PENDING 8
#define MENU_PLATFORM_FLAG1 (1 << 30)
#define MENU_PLATFORM_FLAG2 (1 << 29)
#define MENU_PLATFORM_FLAG3 (1 << 28)
/*
- * Each menu created by the user is a MASTER_MENU. When a menu is torn off,
- * a TEAROFF_MENU instance is created. When a menu is assigned to a toplevel
- * as a menu bar, a MENUBAR instance is created. All instances have the same
+ * Each menu created by the user is a MASTER_MENU. When a menu is torn off, a
+ * TEAROFF_MENU instance is created. When a menu is assigned to a toplevel as
+ * a menu bar, a MENUBAR instance is created. All instances have the same
* configuration information. If the master instance is deleted, all instances
* are deleted. If one of the other instances is deleted, only that instance
* is deleted.
*/
-
+
#define UNKNOWN_TYPE -1
#define MASTER_MENU 0
#define TEAROFF_MENU 1
@@ -486,101 +493,81 @@ typedef struct TkMenuOptionTables {
* Various geometry definitions:
*/
-#define CASCADE_ARROW_HEIGHT 10
-#define CASCADE_ARROW_WIDTH 8
-#define DECORATION_BORDER_WIDTH 2
+#define CASCADE_ARROW_HEIGHT 10
+#define CASCADE_ARROW_WIDTH 8
+#define DECORATION_BORDER_WIDTH 2
/*
- * Menu-related procedures that are shared among Tk modules but not exported
- * to the outside world:
+ * Menu-related functions that are shared among Tk modules but not exported to
+ * the outside world:
*/
-EXTERN int TkActivateMenuEntry _ANSI_ARGS_((TkMenu *menuPtr,
- int index));
-EXTERN void TkBindMenu _ANSI_ARGS_((
- Tk_Window tkwin, TkMenu *menuPtr));
-EXTERN TkMenuReferences *
- TkCreateMenuReferences _ANSI_ARGS_((Tcl_Interp *interp,
- char *name));
-EXTERN void TkDestroyMenu _ANSI_ARGS_((TkMenu *menuPtr));
-EXTERN void TkEventuallyRecomputeMenu _ANSI_ARGS_((
- TkMenu *menuPtr));
-EXTERN void TkEventuallyRedrawMenu _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr));
-EXTERN TkMenuReferences *
- TkFindMenuReferences _ANSI_ARGS_((Tcl_Interp *interp,
- char *name));
-EXTERN TkMenuReferences *
- TkFindMenuReferencesObj _ANSI_ARGS_((
- Tcl_Interp *interp, Tcl_Obj *namePtr));
-EXTERN int TkFreeMenuReferences _ANSI_ARGS_((
- TkMenuReferences *menuRefPtr));
-EXTERN Tcl_HashTable * TkGetMenuHashTable _ANSI_ARGS_((Tcl_Interp *interp));
-EXTERN int TkGetMenuIndex _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuPtr, Tcl_Obj *objPtr, int lastOK,
- int *indexPtr));
-EXTERN void TkMenuInitializeDrawingFields _ANSI_ARGS_((
- TkMenu *menuPtr));
-EXTERN void TkMenuInitializeEntryDrawingFields _ANSI_ARGS_((
- TkMenuEntry *mePtr));
-EXTERN int TkInvokeMenu _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuPtr, int index));
-EXTERN void TkMenuConfigureDrawOptions _ANSI_ARGS_((
- TkMenu *menuPtr));
-EXTERN int TkMenuConfigureEntryDrawOptions _ANSI_ARGS_((
- TkMenuEntry *mePtr, int index));
-EXTERN void TkMenuFreeDrawOptions _ANSI_ARGS_((TkMenu *menuPtr));
-EXTERN void TkMenuEntryFreeDrawOptions _ANSI_ARGS_((
- TkMenuEntry *mePtr));
-EXTERN void TkMenuEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-EXTERN void TkMenuImageProc _ANSI_ARGS_((
- ClientData clientData, int x, int y, int width,
- int height, int imgWidth, int imgHeight));
-EXTERN void TkMenuInit _ANSI_ARGS_((void));
-EXTERN void TkMenuSelectImageProc _ANSI_ARGS_
- ((ClientData clientData, int x, int y,
+MODULE_SCOPE int TkActivateMenuEntry(TkMenu *menuPtr, int index);
+MODULE_SCOPE void TkBindMenu(Tk_Window tkwin, TkMenu *menuPtr);
+MODULE_SCOPE TkMenuReferences*TkCreateMenuReferences(Tcl_Interp *interp,
+ char *name);
+MODULE_SCOPE void TkDestroyMenu(TkMenu *menuPtr);
+MODULE_SCOPE void TkEventuallyRecomputeMenu(TkMenu *menuPtr);
+MODULE_SCOPE void TkEventuallyRedrawMenu(TkMenu *menuPtr,
+ TkMenuEntry *mePtr);
+MODULE_SCOPE TkMenuReferences*TkFindMenuReferences(Tcl_Interp *interp, char *name);
+MODULE_SCOPE TkMenuReferences*TkFindMenuReferencesObj(Tcl_Interp *interp,
+ Tcl_Obj *namePtr);
+MODULE_SCOPE int TkFreeMenuReferences(TkMenuReferences *menuRefPtr);
+MODULE_SCOPE Tcl_HashTable *TkGetMenuHashTable(Tcl_Interp *interp);
+MODULE_SCOPE int TkGetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr,
+ Tcl_Obj *objPtr, int lastOK, int *indexPtr);
+MODULE_SCOPE void TkMenuInitializeDrawingFields(TkMenu *menuPtr);
+MODULE_SCOPE void TkMenuInitializeEntryDrawingFields(TkMenuEntry *mePtr);
+MODULE_SCOPE int TkInvokeMenu(Tcl_Interp *interp, TkMenu *menuPtr,
+ int index);
+MODULE_SCOPE void TkMenuConfigureDrawOptions(TkMenu *menuPtr);
+MODULE_SCOPE int TkMenuConfigureEntryDrawOptions(
+ TkMenuEntry *mePtr, int index);
+MODULE_SCOPE void TkMenuFreeDrawOptions(TkMenu *menuPtr);
+MODULE_SCOPE void TkMenuEntryFreeDrawOptions(TkMenuEntry *mePtr);
+MODULE_SCOPE void TkMenuEventProc(ClientData clientData,
+ XEvent *eventPtr);
+MODULE_SCOPE void TkMenuImageProc(ClientData clientData, int x, int y,
int width, int height, int imgWidth,
- int imgHeight));
-EXTERN Tcl_Obj * TkNewMenuName _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *parentNamePtr, TkMenu *menuPtr));
-EXTERN int TkPostCommand _ANSI_ARGS_((TkMenu *menuPtr));
-EXTERN int TkPostSubmenu _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuPtr, TkMenuEntry *mePtr));
-EXTERN int TkPostTearoffMenu _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuPtr, int x, int y));
-EXTERN int TkPreprocessMenu _ANSI_ARGS_((TkMenu *menuPtr));
-EXTERN void TkRecomputeMenu _ANSI_ARGS_((TkMenu *menuPtr));
+ int imgHeight);
+MODULE_SCOPE void TkMenuInit(void);
+MODULE_SCOPE void TkMenuSelectImageProc(ClientData clientData, int x,
+ int y, int width, int height, int imgWidth,
+ int imgHeight);
+MODULE_SCOPE Tcl_Obj * TkNewMenuName(Tcl_Interp *interp,
+ Tcl_Obj *parentNamePtr, TkMenu *menuPtr);
+MODULE_SCOPE int TkPostCommand(TkMenu *menuPtr);
+MODULE_SCOPE int TkPostSubmenu(Tcl_Interp *interp, TkMenu *menuPtr,
+ TkMenuEntry *mePtr);
+MODULE_SCOPE int TkPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr,
+ int x, int y);
+MODULE_SCOPE int TkPreprocessMenu(TkMenu *menuPtr);
+MODULE_SCOPE void TkRecomputeMenu(TkMenu *menuPtr);
/*
- * These routines are the platform-dependent routines called by the
- * common code.
+ * These routines are the platform-dependent routines called by the common
+ * code.
*/
-EXTERN void TkpComputeMenubarGeometry _ANSI_ARGS_((
- TkMenu *menuPtr));
-EXTERN void TkpComputeStandardMenuGeometry _ANSI_ARGS_
- ((TkMenu *menuPtr));
-EXTERN int TkpConfigureMenuEntry
- _ANSI_ARGS_((TkMenuEntry *mePtr));
-EXTERN void TkpDestroyMenu _ANSI_ARGS_((TkMenu *menuPtr));
-EXTERN void TkpDestroyMenuEntry
- _ANSI_ARGS_((TkMenuEntry *mEntryPtr));
-EXTERN void TkpDrawMenuEntry _ANSI_ARGS_((TkMenuEntry *mePtr,
- Drawable d, Tk_Font tkfont,
- CONST Tk_FontMetrics *menuMetricsPtr, int x,
+MODULE_SCOPE void TkpComputeMenubarGeometry(TkMenu *menuPtr);
+MODULE_SCOPE void TkpComputeStandardMenuGeometry(TkMenu *menuPtr);
+MODULE_SCOPE int TkpConfigureMenuEntry(TkMenuEntry *mePtr);
+MODULE_SCOPE void TkpDestroyMenu(TkMenu *menuPtr);
+MODULE_SCOPE void TkpDestroyMenuEntry(TkMenuEntry *mEntryPtr);
+MODULE_SCOPE void TkpDrawMenuEntry(TkMenuEntry *mePtr,
+ Drawable d, Tk_Font tkfont,
+ const Tk_FontMetrics *menuMetricsPtr, int x,
int y, int width, int height, int strictMotif,
- int drawArrow));
-EXTERN void TkpMenuInit _ANSI_ARGS_((void));
-EXTERN int TkpMenuNewEntry _ANSI_ARGS_((TkMenuEntry *mePtr));
-EXTERN int TkpNewMenu _ANSI_ARGS_((TkMenu *menuPtr));
-EXTERN int TkpPostMenu _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuPtr, int x, int y));
-EXTERN void TkpSetWindowMenuBar _ANSI_ARGS_((Tk_Window tkwin,
- TkMenu *menuPtr));
+ int drawingParameters);
+MODULE_SCOPE void TkpMenuInit(void);
+MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry *mePtr);
+MODULE_SCOPE int TkpNewMenu(TkMenu *menuPtr);
+MODULE_SCOPE int TkpPostMenu(Tcl_Interp *interp, TkMenu *menuPtr,
+ int x, int y);
+MODULE_SCOPE void TkpSetWindowMenuBar(Tk_Window tkwin, TkMenu *menuPtr);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
#endif /* _TKMENU */
-
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 33dadc1..d2a66d3 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -1,35 +1,34 @@
-/*
+/*
* tkMenuDraw.c --
*
- * This module implements the platform-independent drawing and
- * geometry calculations of menu widgets.
+ * This module implements the platform-independent drawing and geometry
+ * calculations of menu widgets.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkMenu.h"
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void AdjustMenuCoords _ANSI_ARGS_ ((TkMenu *menuPtr,
- TkMenuEntry *mePtr, int *xPtr, int *yPtr,
- char *string));
-static void ComputeMenuGeometry _ANSI_ARGS_((
- ClientData clientData));
-static void DisplayMenu _ANSI_ARGS_((ClientData clientData));
+static void AdjustMenuCoords(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ int *xPtr, int *yPtr);
+static void ComputeMenuGeometry(ClientData clientData);
+static void DisplayMenu(ClientData clientData);
/*
*----------------------------------------------------------------------
*
* TkMenuInitializeDrawingFields --
*
- * Fills in drawing fields of a new menu. Called when new menu is
- * created by MenuCmd.
+ * Fills in drawing fields of a new menu. Called when new menu is created
+ * by MenuCmd.
*
* Results:
* None.
@@ -41,8 +40,8 @@ static void DisplayMenu _ANSI_ARGS_((ClientData clientData));
*/
void
-TkMenuInitializeDrawingFields(menuPtr)
- TkMenu *menuPtr; /* The menu we are initializing. */
+TkMenuInitializeDrawingFields(
+ TkMenu *menuPtr) /* The menu we are initializing. */
{
menuPtr->textGC = None;
menuPtr->gray = None;
@@ -58,8 +57,8 @@ TkMenuInitializeDrawingFields(menuPtr)
*
* TkMenuInitializeEntryDrawingFields --
*
- * Fills in drawing fields of a new menu entry. Called when an
- * entry is created.
+ * Fills in drawing fields of a new menu entry. Called when an entry is
+ * created.
*
* Results:
* None.
@@ -71,8 +70,8 @@ TkMenuInitializeDrawingFields(menuPtr)
*/
void
-TkMenuInitializeEntryDrawingFields(mePtr)
- TkMenuEntry *mePtr; /* The menu we are initializing. */
+TkMenuInitializeEntryDrawingFields(
+ TkMenuEntry *mePtr) /* The menu we are initializing. */
{
mePtr->width = 0;
mePtr->height = 0;
@@ -91,8 +90,8 @@ TkMenuInitializeEntryDrawingFields(mePtr)
*
* TkMenuFreeDrawOptions --
*
- * Frees up any structures allocated for the drawing of a menu.
- * Called when menu is deleted.
+ * Frees up any structures allocated for the drawing of a menu. Called
+ * when menu is deleted.
*
* Results:
* None.
@@ -104,8 +103,8 @@ TkMenuInitializeEntryDrawingFields(mePtr)
*/
void
-TkMenuFreeDrawOptions(menuPtr)
- TkMenu *menuPtr;
+TkMenuFreeDrawOptions(
+ TkMenu *menuPtr)
{
if (menuPtr->textGC != None) {
Tk_FreeGC(menuPtr->display, menuPtr->textGC);
@@ -132,8 +131,8 @@ TkMenuFreeDrawOptions(menuPtr)
*
* TkMenuEntryFreeDrawOptions --
*
- * Frees up drawing structures for a menu entry. Called when
- * menu entry is freed.
+ * Frees up drawing structures for a menu entry. Called when menu entry
+ * is freed.
*
* RESULTS:
* None.
@@ -145,8 +144,8 @@ TkMenuFreeDrawOptions(menuPtr)
*/
void
-TkMenuEntryFreeDrawOptions(mePtr)
- TkMenuEntry *mePtr;
+TkMenuEntryFreeDrawOptions(
+ TkMenuEntry *mePtr)
{
if (mePtr->textGC != None) {
Tk_FreeGC(mePtr->menuPtr->display, mePtr->textGC);
@@ -167,8 +166,8 @@ TkMenuEntryFreeDrawOptions(mePtr)
*
* TkMenuConfigureDrawOptions --
*
- * Sets the menu's drawing attributes in preparation for drawing
- * the menu.
+ * Sets the menu's drawing attributes in preparation for drawing the
+ * menu.
*
* RESULTS:
* None.
@@ -180,8 +179,8 @@ TkMenuEntryFreeDrawOptions(mePtr)
*/
void
-TkMenuConfigureDrawOptions(menuPtr)
- TkMenu *menuPtr; /* The menu we are configuring. */
+TkMenuConfigureDrawOptions(
+ TkMenu *menuPtr) /* The menu we are configuring. */
{
XGCValues gcValues;
GC newGC;
@@ -189,11 +188,11 @@ TkMenuConfigureDrawOptions(menuPtr)
Tk_3DBorder border, activeBorder;
Tk_Font tkfont;
XColor *fg, *activeFg, *indicatorFg;
-
+
/*
- * A few options need special processing, such as setting the
- * background from a 3-D border, or filling in complicated
- * defaults that couldn't be specified to Tk_ConfigureWidget.
+ * A few options need special processing, such as setting the background
+ * from a 3-D border, or filling in complicated defaults that couldn't be
+ * specified to Tk_ConfigureWidget.
*/
border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
@@ -216,7 +215,7 @@ TkMenuConfigureDrawOptions(menuPtr)
if (menuPtr->disabledFgPtr != NULL) {
XColor *disabledFg;
- disabledFg = Tk_GetColorFromObj(menuPtr->tkwin,
+ disabledFg = Tk_GetColorFromObj(menuPtr->tkwin,
menuPtr->disabledFgPtr);
gcValues.foreground = disabledFg->pixel;
mask = GCForeground|GCBackground|GCFont;
@@ -247,7 +246,7 @@ TkMenuConfigureDrawOptions(menuPtr)
if (menuPtr->gray != None) {
gcValues.fill_style = FillStippled;
gcValues.stipple = menuPtr->gray;
- newGC = Tk_GetGC(menuPtr->tkwin,
+ newGC = Tk_GetGC(menuPtr->tkwin,
GCForeground|GCFillStyle|GCStipple, &gcValues);
}
if (menuPtr->disabledImageGC != None) {
@@ -258,7 +257,7 @@ TkMenuConfigureDrawOptions(menuPtr)
gcValues.font = Tk_FontId(tkfont);
activeFg = Tk_GetColorFromObj(menuPtr->tkwin, menuPtr->activeFgPtr);
gcValues.foreground = activeFg->pixel;
- activeBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ activeBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
menuPtr->activeBorderPtr);
gcValues.background = Tk_3DBorderColor(activeBorder)->pixel;
newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCBackground|GCFont,
@@ -268,7 +267,7 @@ TkMenuConfigureDrawOptions(menuPtr)
}
menuPtr->activeGC = newGC;
- indicatorFg = Tk_GetColorFromObj(menuPtr->tkwin,
+ indicatorFg = Tk_GetColorFromObj(menuPtr->tkwin,
menuPtr->indicatorFgPtr);
gcValues.foreground = indicatorFg->pixel;
gcValues.background = Tk_3DBorderColor(border)->pixel;
@@ -285,8 +284,7 @@ TkMenuConfigureDrawOptions(menuPtr)
*
* TkMenuConfigureEntryDrawOptions --
*
- * Calculates any entry-specific draw options for the given menu
- * entry.
+ * Calculates any entry-specific draw options for the given menu entry.
*
* Results:
* Returns a standard Tcl error.
@@ -298,11 +296,10 @@ TkMenuConfigureDrawOptions(menuPtr)
*/
int
-TkMenuConfigureEntryDrawOptions(mePtr, index)
- TkMenuEntry *mePtr;
- int index;
+TkMenuConfigureEntryDrawOptions(
+ TkMenuEntry *mePtr,
+ int index)
{
-
XGCValues gcValues;
GC newGC, newActiveGC, newDisabledGC, newIndicatorGC;
unsigned long mask;
@@ -311,7 +308,7 @@ TkMenuConfigureEntryDrawOptions(mePtr, index)
tkfont = Tk_GetFontFromObj(menuPtr->tkwin,
(mePtr->fontPtr != NULL) ? mePtr->fontPtr : menuPtr->fontPtr);
-
+
if (mePtr->state == ENTRY_ACTIVE) {
if (index != menuPtr->active) {
TkActivateMenuEntry(menuPtr, index);
@@ -330,21 +327,21 @@ TkMenuConfigureEntryDrawOptions(mePtr, index)
|| (mePtr->indicatorFgPtr != NULL)) {
XColor *fg, *indicatorFg, *activeFg;
Tk_3DBorder border, activeBorder;
-
+
fg = Tk_GetColorFromObj(menuPtr->tkwin, (mePtr->fgPtr != NULL)
? mePtr->fgPtr : menuPtr->fgPtr);
gcValues.foreground = fg->pixel;
- border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- (mePtr->borderPtr != NULL) ? mePtr->borderPtr
+ border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ (mePtr->borderPtr != NULL) ? mePtr->borderPtr
: menuPtr->borderPtr);
gcValues.background = Tk_3DBorderColor(border)->pixel;
gcValues.font = Tk_FontId(tkfont);
/*
- * Note: disable GraphicsExpose events; we know there won't be
- * obscured areas when copying from an off-screen pixmap to the
- * screen and this gets rid of unnecessary events.
+ * Note: disable GraphicsExpose events; we know there won't be
+ * obscured areas when copying from an off-screen pixmap to the screen
+ * and this gets rid of unnecessary events.
*/
gcValues.graphics_exposures = False;
@@ -352,7 +349,7 @@ TkMenuConfigureEntryDrawOptions(mePtr, index)
GCForeground|GCBackground|GCFont|GCGraphicsExposures,
&gcValues);
- indicatorFg = Tk_GetColorFromObj(menuPtr->tkwin,
+ indicatorFg = Tk_GetColorFromObj(menuPtr->tkwin,
(mePtr->indicatorFgPtr != NULL) ? mePtr->indicatorFgPtr
: menuPtr->indicatorFgPtr);
gcValues.foreground = indicatorFg->pixel;
@@ -363,7 +360,7 @@ TkMenuConfigureEntryDrawOptions(mePtr, index)
if ((menuPtr->disabledFgPtr != NULL) || (mePtr->image != NULL)) {
XColor *disabledFg;
- disabledFg = Tk_GetColorFromObj(menuPtr->tkwin,
+ disabledFg = Tk_GetColorFromObj(menuPtr->tkwin,
menuPtr->disabledFgPtr);
gcValues.foreground = disabledFg->pixel;
mask = GCForeground|GCBackground|GCFont|GCGraphicsExposures;
@@ -375,13 +372,13 @@ TkMenuConfigureEntryDrawOptions(mePtr, index)
}
newDisabledGC = Tk_GetGC(menuPtr->tkwin, mask, &gcValues);
- activeFg = Tk_GetColorFromObj(menuPtr->tkwin,
+ activeFg = Tk_GetColorFromObj(menuPtr->tkwin,
(mePtr->activeFgPtr != NULL) ? mePtr->activeFgPtr
: menuPtr->activeFgPtr);
- activeBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- (mePtr->activeBorderPtr != NULL) ? mePtr->activeBorderPtr
+ activeBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ (mePtr->activeBorderPtr != NULL) ? mePtr->activeBorderPtr
: menuPtr->activeBorderPtr);
-
+
gcValues.foreground = activeFg->pixel;
gcValues.background = Tk_3DBorderColor(activeBorder)->pixel;
newActiveGC = Tk_GetGC(menuPtr->tkwin,
@@ -394,15 +391,15 @@ TkMenuConfigureEntryDrawOptions(mePtr, index)
newIndicatorGC = None;
}
if (mePtr->textGC != None) {
- Tk_FreeGC(menuPtr->display, mePtr->textGC);
+ Tk_FreeGC(menuPtr->display, mePtr->textGC);
}
mePtr->textGC = newGC;
if (mePtr->activeGC != None) {
- Tk_FreeGC(menuPtr->display, mePtr->activeGC);
+ Tk_FreeGC(menuPtr->display, mePtr->activeGC);
}
mePtr->activeGC = newActiveGC;
if (mePtr->disabledGC != None) {
- Tk_FreeGC(menuPtr->display, mePtr->disabledGC);
+ Tk_FreeGC(menuPtr->display, mePtr->disabledGC);
}
mePtr->disabledGC = newDisabledGC;
if (mePtr->indicatorGC != None) {
@@ -430,8 +427,8 @@ TkMenuConfigureEntryDrawOptions(mePtr, index)
*/
void
-TkEventuallyRecomputeMenu(menuPtr)
- TkMenu *menuPtr;
+TkEventuallyRecomputeMenu(
+ TkMenu *menuPtr)
{
if (!(menuPtr->menuFlags & RESIZE_PENDING)) {
menuPtr->menuFlags |= RESIZE_PENDING;
@@ -444,8 +441,8 @@ TkEventuallyRecomputeMenu(menuPtr)
*
* TkRecomputeMenu --
*
- * Tells Tcl to redo the geometry because this menu has changed.
- * Does it now; removes any ComputeMenuGeometries from the idler.
+ * Tells Tcl to redo the geometry because this menu has changed. Does it
+ * now; removes any ComputeMenuGeometries from the idler.
*
* Results:
* None.
@@ -457,9 +454,9 @@ TkEventuallyRecomputeMenu(menuPtr)
*/
void
-TkRecomputeMenu(menuPtr)
- TkMenu *menuPtr;
-{
+TkRecomputeMenu(
+ TkMenu *menuPtr)
+{
if (menuPtr->menuFlags & RESIZE_PENDING) {
Tcl_CancelIdleCall(ComputeMenuGeometry, (ClientData) menuPtr);
ComputeMenuGeometry((ClientData) menuPtr);
@@ -471,27 +468,27 @@ TkRecomputeMenu(menuPtr)
*
* TkEventuallyRedrawMenu --
*
- * Arrange for an entry of a menu, or the whole menu, to be
- * redisplayed at some point in the future.
+ * Arrange for an entry of a menu, or the whole menu, to be redisplayed
+ * at some point in the future.
*
* Results:
* None.
*
* Side effects:
- * A when-idle hander is scheduled to do the redisplay, if there
- * isn't one already scheduled.
+ * A when-idle hander is scheduled to do the redisplay, if there isn't
+ * one already scheduled.
*
*----------------------------------------------------------------------
*/
void
-TkEventuallyRedrawMenu(menuPtr, mePtr)
- register TkMenu *menuPtr; /* Information about menu to redraw. */
- register TkMenuEntry *mePtr;/* Entry to redraw. NULL means redraw
- * all the entries in the menu. */
+TkEventuallyRedrawMenu(
+ register TkMenu *menuPtr, /* Information about menu to redraw. */
+ register TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the
+ * entries in the menu. */
{
int i;
-
+
if (menuPtr->tkwin == NULL) {
return;
}
@@ -515,25 +512,23 @@ TkEventuallyRedrawMenu(menuPtr, mePtr)
*
* ComputeMenuGeometry --
*
- * This procedure is invoked to recompute the size and
- * layout of a menu. It is called as a when-idle handler so
- * that it only gets done once, even if a group of changes is
- * made to the menu.
+ * This function is invoked to recompute the size and layout of a menu.
+ * It is called as a when-idle handler so that it only gets done once,
+ * even if a group of changes is made to the menu.
*
* Results:
* None.
*
* Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
*
*--------------------------------------------------------------
*/
static void
-ComputeMenuGeometry(clientData)
- ClientData clientData; /* Structure describing menu. */
+ComputeMenuGeometry(
+ ClientData clientData) /* Structure describing menu. */
{
TkMenu *menuPtr = (TkMenu *) clientData;
@@ -552,16 +547,15 @@ ComputeMenuGeometry(clientData)
Tk_GeometryRequest(menuPtr->tkwin, menuPtr->totalWidth,
menuPtr->totalHeight);
}
-
+
/*
- * Must always force a redisplay here if the window is mapped
- * (even if the size didn't change, something else might have
- * changed in the menu, such as a label or accelerator). The
- * resize will force a redisplay above.
+ * Must always force a redisplay here if the window is mapped (even if the
+ * size didn't change, something else might have changed in the menu, such
+ * as a label or accelerator). The resize will force a redisplay above.
*/
-
- TkEventuallyRedrawMenu(menuPtr, (TkMenuEntry *) NULL);
-
+
+ TkEventuallyRedrawMenu(menuPtr, NULL);
+
menuPtr->menuFlags &= ~RESIZE_PENDING;
}
@@ -570,9 +564,9 @@ ComputeMenuGeometry(clientData)
*
* TkMenuSelectImageProc --
*
- * This procedure is invoked by the image code whenever the manager
- * for an image does something that affects the size of contents
- * of an image displayed in a menu entry when it is selected.
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the size of contents of an image
+ * displayed in a menu entry when it is selected.
*
* Results:
* None.
@@ -584,20 +578,18 @@ ComputeMenuGeometry(clientData)
*/
void
-TkMenuSelectImageProc(clientData, x, y, width, height, imgWidth,
- imgHeight)
- ClientData clientData; /* Pointer to widget record. */
- int x, y; /* Upper left pixel (within image)
- * that must be redisplayed. */
- int width, height; /* Dimensions of area to redisplay
- * (may be <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+TkMenuSelectImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (may be
+ * <=0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkMenuEntry *mePtr = (TkMenuEntry *) clientData;
if ((mePtr->entryFlags & ENTRY_SELECTED)
- && !(mePtr->menuPtr->menuFlags &
- REDRAW_PENDING)) {
+ && !(mePtr->menuPtr->menuFlags & REDRAW_PENDING)) {
mePtr->menuPtr->menuFlags |= REDRAW_PENDING;
Tcl_DoWhenIdle(DisplayMenu, (ClientData) mePtr->menuPtr);
}
@@ -608,21 +600,20 @@ TkMenuSelectImageProc(clientData, x, y, width, height, imgWidth,
*
* DisplayMenu --
*
- * This procedure is invoked to display a menu widget.
+ * This function is invoked to display a menu widget.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DisplayMenu(clientData)
- ClientData clientData; /* Information about widget. */
+DisplayMenu(
+ ClientData clientData) /* Information about widget. */
{
register TkMenu *menuPtr = (TkMenu *) clientData;
register TkMenuEntry *mePtr;
@@ -649,8 +640,8 @@ DisplayMenu(clientData)
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
if (menuPtr->menuType == MENUBAR) {
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, borderWidth,
- borderWidth, Tk_Width(tkwin) - 2 * borderWidth,
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, borderWidth,
+ borderWidth, Tk_Width(tkwin) - 2 * borderWidth,
Tk_Height(tkwin) - 2 * borderWidth, 0, TK_RELIEF_FLAT);
}
@@ -688,15 +679,15 @@ DisplayMenu(clientData)
}
}
TkpDrawMenuEntry(mePtr, Tk_WindowId(menuPtr->tkwin), tkfont,
- &menuMetrics, mePtr->x, mePtr->y, width,
+ &menuMetrics, mePtr->x, mePtr->y, width,
mePtr->height, strictMotif, 1);
if ((index > 0) && (menuPtr->menuType != MENUBAR)
&& mePtr->columnBreak) {
mePtr = menuPtr->entries[index - 1];
Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border,
- mePtr->x, mePtr->y + mePtr->height,
+ mePtr->x, mePtr->y + mePtr->height,
mePtr->width,
- Tk_Height(tkwin) - mePtr->y - mePtr->height -
+ Tk_Height(tkwin) - mePtr->y - mePtr->height -
activeBorderWidth, 0,
TK_RELIEF_FLAT);
}
@@ -712,7 +703,7 @@ DisplayMenu(clientData)
} else {
mePtr = menuPtr->entries[menuPtr->numEntries - 1];
Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
- border, mePtr->x, mePtr->y + mePtr->height, mePtr->width,
+ border, mePtr->x, mePtr->y + mePtr->height, mePtr->width,
Tk_Height(tkwin) - mePtr->y - mePtr->height
- activeBorderWidth, 0,
TK_RELIEF_FLAT);
@@ -721,13 +712,13 @@ DisplayMenu(clientData)
width = Tk_Width(tkwin) - x - activeBorderWidth;
height = Tk_Height(tkwin) - y - activeBorderWidth;
}
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, x, y,
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, x, y,
width, height, 0, TK_RELIEF_FLAT);
}
Tk_GetReliefFromObj(NULL, menuPtr->reliefPtr, &relief);
Tk_Draw3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin),
- border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), borderWidth,
+ border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), borderWidth,
relief);
}
@@ -736,31 +727,31 @@ DisplayMenu(clientData)
*
* TkMenuEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on menus.
+ * This function is invoked by the Tk dispatcher for various events on
+ * menus.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
void
-TkMenuEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+TkMenuEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkMenu *menuPtr = (TkMenu *) clientData;
-
+
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
- TkEventuallyRedrawMenu(menuPtr, (TkMenuEntry *) NULL);
+ TkEventuallyRedrawMenu(menuPtr, NULL);
} else if (eventPtr->type == ConfigureNotify) {
TkEventuallyRecomputeMenu(menuPtr);
- TkEventuallyRedrawMenu(menuPtr, (TkMenuEntry *) NULL);
+ TkEventuallyRedrawMenu(menuPtr, NULL);
} else if (eventPtr->type == ActivateNotify) {
if (menuPtr->menuType == TEAROFF_MENU) {
TkpSetMainMenubar(menuPtr->interp, menuPtr->tkwin, NULL);
@@ -797,9 +788,9 @@ TkMenuEventProc(clientData, eventPtr)
*
* TkMenuImageProc --
*
- * This procedure is invoked by the image code whenever the manager
- * for an image does something that affects the size of contents
- * of an image displayed in a menu entry.
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the size of contents of an image
+ * displayed in a menu entry.
*
* Results:
* None.
@@ -811,19 +802,17 @@ TkMenuEventProc(clientData, eventPtr)
*/
void
-TkMenuImageProc(clientData, x, y, width, height, imgWidth,
- imgHeight)
- ClientData clientData; /* Pointer to widget record. */
- int x, y; /* Upper left pixel (within image)
- * that must be redisplayed. */
- int width, height; /* Dimensions of area to redisplay
- * (may be <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+TkMenuImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (may be
+ * <=0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkMenu *menuPtr = ((TkMenuEntry *)clientData)->menuPtr;
- if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags
- & RESIZE_PENDING)) {
+ if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags & RESIZE_PENDING)) {
menuPtr->menuFlags |= RESIZE_PENDING;
Tcl_DoWhenIdle(ComputeMenuGeometry, (ClientData) menuPtr);
}
@@ -834,9 +823,9 @@ TkMenuImageProc(clientData, x, y, width, height, imgWidth,
*
* TkPostTearoffMenu --
*
- * Posts a menu on the screen. Used to post tearoff menus. On Unix,
- * all menus are posted this way. Adjusts the menu's position
- * so that it fits on the screen, and maps and raises the menu.
+ * Posts a menu on the screen. Used to post tearoff menus. On Unix, all
+ * menus are posted this way. Adjusts the menu's position so that it fits
+ * on the screen, and maps and raises the menu.
*
* Results:
* Returns a standard Tcl Error.
@@ -848,13 +837,11 @@ TkMenuImageProc(clientData, x, y, width, height, imgWidth,
*/
int
-TkPostTearoffMenu(interp, menuPtr, x, y)
- Tcl_Interp *interp; /* The interpreter of the menu */
- TkMenu *menuPtr; /* The menu we are posting */
- int x; /* The root X coordinate where we
- * are posting */
- int y; /* The root Y coordinate where we
- * are posting */
+TkPostTearoffMenu(
+ Tcl_Interp *interp, /* The interpreter of the menu */
+ TkMenu *menuPtr, /* The menu we are posting */
+ int x, int y) /* The root X,Y coordinates where we are
+ * posting */
{
int vRootX, vRootY, vRootWidth, vRootHeight;
int tmp, result;
@@ -867,8 +854,8 @@ TkPostTearoffMenu(interp, menuPtr, x, y)
}
/*
- * The post commands could have deleted the menu, which means
- * we are dead and should go away.
+ * The post commands could have deleted the menu, which means we are dead
+ * and should go away.
*/
if (menuPtr->tkwin == NULL) {
@@ -876,27 +863,24 @@ TkPostTearoffMenu(interp, menuPtr, x, y)
}
/*
- * Adjust the position of the menu if necessary to keep it
- * visible on the screen. There are two special tricks to
- * make this work right:
+ * Adjust the position of the menu if necessary to keep it visible on the
+ * screen. There are two special tricks to make this work right:
*
- * 1. If a virtual root window manager is being used then
- * the coordinates are in the virtual root window of
- * menuPtr's parent; since the menu uses override-redirect
- * mode it will be in the *real* root window for the screen,
- * so we have to map the coordinates from the virtual root
- * (if any) to the real root. Can't get the virtual root
- * from the menu itself (it will never be seen by the wm)
- * so use its parent instead (it would be better to have an
- * an option that names a window to use for this...).
- * 2. The menu may not have been mapped yet, so its current size
- * might be the default 1x1. To compute how much space it
- * needs, use its requested size, not its actual size.
+ * 1. If a virtual root window manager is being used then the coordinates
+ * are in the virtual root window of menuPtr's parent; since the menu
+ * uses override-redirect mode it will be in the *real* root window for
+ * the screen, so we have to map the coordinates from the virtual root
+ * (if any) to the real root. Can't get the virtual root from the menu
+ * itself (it will never be seen by the wm) so use its parent instead
+ * (it would be better to have an an option that names a window to use
+ * for this...).
+ * 2. The menu may not have been mapped yet, so its current size might be
+ * the default 1x1. To compute how much space it needs, use its
+ * requested size, not its actual size.
*
- * Note that this code assumes square screen regions and all
- * positive coordinates. This does not work on a Mac with
- * multiple monitors. But then again, Tk has other problems
- * with this.
+ * Note that this code assumes square screen regions and all positive
+ * coordinates. This does not work on a Mac with multiple monitors. But
+ * then again, Tk has other problems with this.
*/
Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY,
@@ -932,59 +916,58 @@ TkPostTearoffMenu(interp, menuPtr, x, y)
*
* TkPostSubmenu --
*
- * This procedure arranges for a particular submenu (i.e. the
- * menu corresponding to a given cascade entry) to be
- * posted.
+ * This function arranges for a particular submenu (i.e. the menu
+ * corresponding to a given cascade entry) to be posted.
*
* Results:
- * A standard Tcl return result. Errors may occur in the
- * Tcl commands generated to post and unpost submenus.
+ * A standard Tcl return result. Errors may occur in the Tcl commands
+ * generated to post and unpost submenus.
*
* Side effects:
- * If there is already a submenu posted, it is unposted.
- * The new submenu is then posted.
+ * If there is already a submenu posted, it is unposted. The new submenu
+ * is then posted.
*
*--------------------------------------------------------------
*/
int
-TkPostSubmenu(interp, menuPtr, mePtr)
- Tcl_Interp *interp; /* Used for invoking sub-commands and
+TkPostSubmenu(
+ Tcl_Interp *interp, /* Used for invoking sub-commands and
* reporting errors. */
- register TkMenu *menuPtr; /* Information about menu as a whole. */
- register TkMenuEntry *mePtr; /* Info about submenu that is to be
- * posted. NULL means make sure that
- * no submenu is posted. */
+ register TkMenu *menuPtr, /* Information about menu as a whole. */
+ register TkMenuEntry *mePtr)/* Info about submenu that is to be posted.
+ * NULL means make sure that no submenu is
+ * posted. */
{
int result, x, y;
+ Tcl_Obj *subary[4];
if (mePtr == menuPtr->postedCascade) {
return TCL_OK;
}
if (menuPtr->postedCascade != NULL) {
- char *name = Tcl_GetStringFromObj(menuPtr->postedCascade->namePtr,
- NULL);
-
/*
- * Note: when unposting a submenu, we have to redraw the entire
- * parent menu. This is because of a combination of the following
- * things:
+ * Note: when unposting a submenu, we have to redraw the entire parent
+ * menu. This is because of a combination of the following things:
* (a) the submenu partially overlaps the parent.
- * (b) the submenu specifies "save under", which causes the X
- * server to make a copy of the information under it when it
- * is posted. When the submenu is unposted, the X server
- * copies this data back and doesn't generate any Expose
- * events for the parent.
- * (c) the parent may have redisplayed itself after the submenu
- * was posted, in which case the saved information is no
- * longer correct.
- * The simplest solution is just force a complete redisplay of
- * the parent.
+ * (b) the submenu specifies "save under", which causes the X server
+ * to make a copy of the information under it when it is posted.
+ * When the submenu is unposted, the X server copies this data
+ * back and doesn't generate any Expose events for the parent.
+ * (c) the parent may have redisplayed itself after the submenu was
+ * posted, in which case the saved information is no longer
+ * correct.
+ * The simplest solution is just force a complete redisplay of the
+ * parent.
*/
- TkEventuallyRedrawMenu(menuPtr, (TkMenuEntry *) NULL);
- result = Tcl_VarEval(interp, "{", name, "} unpost", (char *) NULL);
+ subary[0] = menuPtr->postedCascade->namePtr;
+ subary[1] = Tcl_NewStringObj("unpost", -1);
+ Tcl_IncrRefCount(subary[1]);
+ TkEventuallyRedrawMenu(menuPtr, NULL);
+ result = Tcl_EvalObjv(interp, 2, subary, 0);
+ Tcl_DecrRefCount(subary[1]);
menuPtr->postedCascade = NULL;
if (result != TCL_OK) {
return result;
@@ -994,21 +977,31 @@ TkPostSubmenu(interp, menuPtr, mePtr)
if ((mePtr != NULL) && (mePtr->namePtr != NULL)
&& Tk_IsMapped(menuPtr->tkwin)) {
/*
- * Position the cascade with its upper left corner slightly
- * below and to the left of the upper right corner of the
- * menu entry (this is an attempt to match Motif behavior).
+ * Position the cascade with its upper left corner slightly below and
+ * to the left of the upper right corner of the menu entry (this is an
+ * attempt to match Motif behavior).
*
* The menu has to redrawn so that the entry can change relief.
+ *
+ * Set postedCascade early to ensure tear-off submenus work on
+ * Windows. [Bug 873613]
*/
- char string[TCL_INTEGER_SPACE * 2];
- char *name;
-
- name = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
Tk_GetRootCoords(menuPtr->tkwin, &x, &y);
- AdjustMenuCoords(menuPtr, mePtr, &x, &y, string);
+ AdjustMenuCoords(menuPtr, mePtr, &x, &y);
+
menuPtr->postedCascade = mePtr;
- result = Tcl_VarEval(interp, "{", name, "} post ", string, (char *) NULL);
+ subary[0] = mePtr->namePtr;
+ subary[1] = Tcl_NewStringObj("post", -1);
+ subary[2] = Tcl_NewIntObj(x);
+ subary[3] = Tcl_NewIntObj(y);
+ Tcl_IncrRefCount(subary[1]);
+ Tcl_IncrRefCount(subary[2]);
+ Tcl_IncrRefCount(subary[3]);
+ result = Tcl_EvalObjv(interp, 4, subary, 0);
+ Tcl_DecrRefCount(subary[1]);
+ Tcl_DecrRefCount(subary[2]);
+ Tcl_DecrRefCount(subary[3]);
if (result != TCL_OK) {
menuPtr->postedCascade = NULL;
return result;
@@ -1023,8 +1016,7 @@ TkPostSubmenu(interp, menuPtr, mePtr)
*
* AdjustMenuCoords --
*
- * Adjusts the given coordinates down and the left to give a Motif
- * look.
+ * Adjusts the given coordinates down and the left to give a Motif look.
*
* Results:
* None.
@@ -1036,12 +1028,11 @@ TkPostSubmenu(interp, menuPtr, mePtr)
*/
static void
-AdjustMenuCoords(menuPtr, mePtr, xPtr, yPtr, string)
- TkMenu *menuPtr;
- TkMenuEntry *mePtr;
- int *xPtr;
- int *yPtr;
- char *string;
+AdjustMenuCoords(
+ TkMenu *menuPtr,
+ TkMenuEntry *mePtr,
+ int *xPtr,
+ int *yPtr)
{
if (menuPtr->menuType == MENUBAR) {
*xPtr += mePtr->x;
@@ -1051,11 +1042,18 @@ AdjustMenuCoords(menuPtr, mePtr, xPtr, yPtr, string)
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
&borderWidth);
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
- *xPtr += Tk_Width(menuPtr->tkwin) - borderWidth - activeBorderWidth
+ *xPtr += Tk_Width(menuPtr->tkwin) - borderWidth - activeBorderWidth
- 2;
*yPtr += mePtr->y + activeBorderWidth + 2;
}
- sprintf(string, "%d %d", *xPtr, *yPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 8292b32..b19c7aa 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -1,115 +1,114 @@
-/*
+/*
* tkMenubutton.c --
*
- * This module implements button-like widgets that are used
- * to invoke pull-down menus.
+ * This module implements button-like widgets that are used to invoke
+ * pull-down menus.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkMenubutton.h"
-#include "tkPort.h"
#include "default.h"
/*
- * The following table defines the legal values for the -direction
- * option. It is used together with the "enum direction" declaration
- * in tkMenubutton.h.
+ * The following table defines the legal values for the -direction option. It
+ * is used together with the "enum direction" declaration in tkMenubutton.h.
*/
static char *directionStrings[] = {
- "above", "below", "flush", "left", "right", (char *) NULL
+ "above", "below", "flush", "left", "right", NULL
};
/*
- * The following table defines the legal values for the -state option.
- * It is used together with the "enum state" declaration in tkMenubutton.h.
+ * The following table defines the legal values for the -state option. It is
+ * used together with the "enum state" declaration in tkMenubutton.h.
*/
static char *stateStrings[] = {
- "active", "disabled", "normal", (char *) NULL
+ "active", "disabled", "normal", NULL
};
/*
- * The following table defines the legal values for the -compound option.
- * It is used with the "enum compound" declaration in tkMenuButton.h
+ * The following table defines the legal values for the -compound option. It
+ * is used with the "enum compound" declaration in tkMenuButton.h
*/
static char *compoundStrings[] = {
- "bottom", "center", "left", "none", "right", "top", (char *) NULL
+ "bottom", "center", "left", "none", "right", "top", NULL
};
/*
* Information used for parsing configuration specs:
*/
-static Tk_OptionSpec optionSpecs[] = {
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
- DEF_MENUBUTTON_ACTIVE_BG_COLOR, -1,
- Tk_Offset(TkMenuButton, activeBorder), 0,
- (ClientData) DEF_MENUBUTTON_ACTIVE_BG_MONO, 0},
+ DEF_MENUBUTTON_ACTIVE_BG_COLOR, -1,
+ Tk_Offset(TkMenuButton, activeBorder), 0,
+ (ClientData) DEF_MENUBUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
- DEF_MENUBUTTON_ACTIVE_FG_COLOR, -1,
- Tk_Offset(TkMenuButton, activeFg),
- 0, (ClientData) DEF_MENUBUTTON_ACTIVE_FG_MONO, 0},
+ DEF_MENUBUTTON_ACTIVE_FG_COLOR, -1,
+ Tk_Offset(TkMenuButton, activeFg),
+ 0, (ClientData) DEF_MENUBUTTON_ACTIVE_FG_MONO, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
- DEF_MENUBUTTON_ANCHOR, -1,
- Tk_Offset(TkMenuButton, anchor), 0, 0, 0},
+ DEF_MENUBUTTON_ANCHOR, -1,
+ Tk_Offset(TkMenuButton, anchor), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_MENUBUTTON_BG_COLOR, -1, Tk_Offset(TkMenuButton, normalBorder),
- 0, (ClientData) DEF_MENUBUTTON_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ 0, (ClientData) DEF_MENUBUTTON_BG_MONO, 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
DEF_MENUBUTTON_BITMAP, -1, Tk_Offset(TkMenuButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_MENUBUTTON_BORDER_WIDTH, -1,
- Tk_Offset(TkMenuButton, borderWidth), 0, 0, 0},
+ DEF_MENUBUTTON_BORDER_WIDTH, -1,
+ Tk_Offset(TkMenuButton, borderWidth), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_MENUBUTTON_CURSOR, -1, Tk_Offset(TkMenuButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
- DEF_MENUBUTTON_DIRECTION, -1, Tk_Offset(TkMenuButton, direction),
+ DEF_MENUBUTTON_DIRECTION, -1, Tk_Offset(TkMenuButton, direction),
0, (ClientData) directionStrings, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_MENUBUTTON_DISABLED_FG_COLOR,
-1, Tk_Offset(TkMenuButton, disabledFg), TK_OPTION_NULL_OK,
(ClientData) DEF_MENUBUTTON_DISABLED_FG_MONO, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0,
+ (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_MENUBUTTON_FONT, -1, Tk_Offset(TkMenuButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
DEF_MENUBUTTON_FG, -1, Tk_Offset(TkMenuButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
- DEF_MENUBUTTON_HEIGHT, -1, Tk_Offset(TkMenuButton, heightString),
- 0, 0, 0},
+ DEF_MENUBUTTON_HEIGHT, -1, Tk_Offset(TkMenuButton, heightString),
+ 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR,
-1, Tk_Offset(TkMenuButton, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_MENUBUTTON_HIGHLIGHT, -1,
- Tk_Offset(TkMenuButton, highlightColorPtr), 0, 0, 0},
+ DEF_MENUBUTTON_HIGHLIGHT, -1,
+ Tk_Offset(TkMenuButton, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", DEF_MENUBUTTON_HIGHLIGHT_WIDTH,
-1, Tk_Offset(TkMenuButton, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-image", "image", "Image",
- DEF_MENUBUTTON_IMAGE, -1, Tk_Offset(TkMenuButton, imageString),
+ DEF_MENUBUTTON_IMAGE, -1, Tk_Offset(TkMenuButton, imageString),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn",
DEF_MENUBUTTON_INDICATOR, -1, Tk_Offset(TkMenuButton, indicatorOn),
- 0, 0, 0},
+ 0, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkMenuButton, justify), 0, 0, 0},
+ DEF_MENUBUTTON_JUSTIFY, -1, Tk_Offset(TkMenuButton, justify), 0, 0, 0},
{TK_OPTION_STRING, "-menu", "menu", "Menu",
- DEF_MENUBUTTON_MENU, -1, Tk_Offset(TkMenuButton, menuName),
+ DEF_MENUBUTTON_MENU, -1, Tk_Offset(TkMenuButton, menuName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
DEF_MENUBUTTON_PADX, -1, Tk_Offset(TkMenuButton, padX),
@@ -118,43 +117,42 @@ static Tk_OptionSpec optionSpecs[] = {
DEF_MENUBUTTON_PADY, -1, Tk_Offset(TkMenuButton, padY),
0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_MENUBUTTON_RELIEF, -1, Tk_Offset(TkMenuButton, relief),
- 0, 0, 0},
+ DEF_MENUBUTTON_RELIEF, -1, Tk_Offset(TkMenuButton, relief),
+ 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkMenuButton, compound), 0,
- (ClientData) compoundStrings, 0},
+ DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkMenuButton, compound), 0,
+ (ClientData) compoundStrings, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_MENUBUTTON_STATE, -1, Tk_Offset(TkMenuButton, state),
0, (ClientData) stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_MENUBUTTON_TAKE_FOCUS, -1,
- Tk_Offset(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0},
+ DEF_MENUBUTTON_TAKE_FOCUS, -1,
+ Tk_Offset(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-text", "text", "Text",
DEF_MENUBUTTON_TEXT, -1, Tk_Offset(TkMenuButton, text), 0, 0, 0},
{TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
- DEF_MENUBUTTON_TEXT_VARIABLE, -1,
- Tk_Offset(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0},
+ DEF_MENUBUTTON_TEXT_VARIABLE, -1,
+ Tk_Offset(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
DEF_MENUBUTTON_UNDERLINE, -1, Tk_Offset(TkMenuButton, underline),
- 0, 0, 0},
+ 0, 0, 0},
{TK_OPTION_STRING, "-width", "width", "Width",
- DEF_MENUBUTTON_WIDTH, -1, Tk_Offset(TkMenuButton, widthString),
- 0, 0, 0},
+ DEF_MENUBUTTON_WIDTH, -1, Tk_Offset(TkMenuButton, widthString),
+ 0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
DEF_MENUBUTTON_WRAP_LENGTH, -1, Tk_Offset(TkMenuButton, wrapLength),
- 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ 0, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * The following tables define the menubutton widget commands and map the
- * indexes into the string tables into a single enumerated type used
- * to dispatch the scale widget command.
+ * The following tables define the menubutton widget commands and map the
+ * indexes into the string tables into a single enumerated type used to
+ * dispatch the scale widget command.
*/
static CONST char *commandNames[] = {
- "cget", "configure", (char *) NULL
+ "cget", "configure", NULL
};
enum command {
@@ -162,35 +160,34 @@ enum command {
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void MenuButtonCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void MenuButtonEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void MenuButtonImageProc _ANSI_ARGS_((ClientData clientData,
+static void MenuButtonCmdDeletedProc(ClientData clientData);
+static void MenuButtonEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void MenuButtonImageProc(ClientData clientData,
int x, int y, int width, int height, int imgWidth,
- int imgHeight));
-static char * MenuButtonTextVarProc _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- CONST char *name1, CONST char *name2, int flags));
-static int MenuButtonWidgetObjCmd _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-static int ConfigureMenuButton _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenuButton *mbPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static void DestroyMenuButton _ANSI_ARGS_((char *memPtr));
+ int imgHeight);
+static char * MenuButtonTextVarProc(ClientData clientData,
+ Tcl_Interp *interp, CONST char *name1,
+ CONST char *name2, int flags);
+static int MenuButtonWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int ConfigureMenuButton(Tcl_Interp *interp,
+ TkMenuButton *mbPtr, int objc,
+ Tcl_Obj *CONST objv[]);
+static void DestroyMenuButton(char *memPtr);
/*
*--------------------------------------------------------------
*
* Tk_MenubuttonObjCmd --
*
- * This procedure is invoked to process the "button", "label",
- * "radiobutton", and "checkbutton" Tcl commands. See the
- * user documentation for details on what it does.
+ * This function is invoked to process the "button", "label",
+ * "radiobutton", and "checkbutton" Tcl commands. See the user
+ * documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -202,11 +199,11 @@ static void DestroyMenuButton _ANSI_ARGS_((char *memPtr));
*/
int
-Tk_MenubuttonObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_MenubuttonObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register TkMenuButton *mbPtr;
Tk_OptionTable optionTable;
@@ -222,14 +219,14 @@ Tk_MenubuttonObjCmd(clientData, interp, objc, objv)
*/
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
/*
- * Create the option table for this widget class. If it has already
- * been created, the cached pointer will be returned.
+ * Create the option table for this widget class. If it has already been
+ * created, the cached pointer will be returned.
*/
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
@@ -246,9 +243,9 @@ Tk_MenubuttonObjCmd(clientData, interp, objc, objv)
mbPtr->tkwin = tkwin;
mbPtr->display = Tk_Display (tkwin);
mbPtr->interp = interp;
- mbPtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd,
- (ClientData) mbPtr, MenuButtonCmdDeletedProc);
+ mbPtr->widgetCmd = Tcl_CreateObjCommand(interp,
+ Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd,
+ (ClientData) mbPtr, MenuButtonCmdDeletedProc);
mbPtr->optionTable = optionTable;
mbPtr->menuName = NULL;
mbPtr->text = NULL;
@@ -318,9 +315,9 @@ Tk_MenubuttonObjCmd(clientData, interp, objc, objv)
*
* MenuButtonWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -332,66 +329,62 @@ Tk_MenubuttonObjCmd(clientData, interp, objc, objv)
*/
static int
-MenuButtonWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about button widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+MenuButtonWidgetObjCmd(
+ ClientData clientData, /* Information about button widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
int result, index;
Tcl_Obj *objPtr;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
- result = Tcl_GetIndexFromObj(interp, objv[1],
- commandNames, "option", 0, &index);
+ result = Tcl_GetIndexFromObj(interp, objv[1], commandNames, "option", 0,
+ &index);
if (result != TCL_OK) {
- return result;
+ return result;
}
Tcl_Preserve((ClientData) mbPtr);
switch (index) {
- case COMMAND_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "cget option");
+ case COMMAND_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "cget option");
goto error;
- }
+ }
- objPtr = Tk_GetOptionValue(interp, (char *) mbPtr,
- mbPtr->optionTable, objv[2], mbPtr->tkwin);
- if (objPtr == NULL) {
- goto error;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- }
- break;
+ objPtr = Tk_GetOptionValue(interp, (char *) mbPtr,
+ mbPtr->optionTable, objv[2], mbPtr->tkwin);
+ if (objPtr == NULL) {
+ goto error;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
}
+ break;
- case COMMAND_CONFIGURE: {
- if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) mbPtr,
- mbPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- mbPtr->tkwin);
- if (objPtr == NULL) {
- goto error;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- }
+ case COMMAND_CONFIGURE:
+ if (objc <= 3) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) mbPtr,
+ mbPtr->optionTable, (objc == 3) ? objv[2] : NULL,
+ mbPtr->tkwin);
+ if (objPtr == NULL) {
+ goto error;
} else {
- result = ConfigureMenuButton(interp, mbPtr, objc-2,
- objv+2);
+ Tcl_SetObjResult(interp, objPtr);
}
- break;
+ } else {
+ result = ConfigureMenuButton(interp, mbPtr, objc-2, objv+2);
}
+ break;
}
Tcl_Release((ClientData) mbPtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) mbPtr);
return TCL_ERROR;
}
@@ -401,10 +394,10 @@ MenuButtonWidgetObjCmd(clientData, interp, objc, objv)
*
* DestroyMenuButton --
*
- * This procedure is invoked to recycle all of the resources
- * associated with a menubutton widget. It is invoked as a
- * when-idle handler in order to make sure that there is no
- * other use of the menubutton pending at the time of the deletion.
+ * This function is invoked to recycle all of the resources associated
+ * with a menubutton widget. It is invoked as a when-idle handler in
+ * order to make sure that there is no other use of the menubutton
+ * pending at the time of the deletion.
*
* Results:
* None.
@@ -416,20 +409,19 @@ MenuButtonWidgetObjCmd(clientData, interp, objc, objv)
*/
static void
-DestroyMenuButton(memPtr)
- char *memPtr; /* Info about button widget. */
+DestroyMenuButton(
+ char *memPtr) /* Info about button widget. */
{
register TkMenuButton *mbPtr = (TkMenuButton *) memPtr;
TkpDestroyMenuButton(mbPtr);
if (mbPtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(TkpDisplayMenuButton, (ClientData) mbPtr);
+ Tcl_CancelIdleCall(TkpDisplayMenuButton, (ClientData) mbPtr);
}
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeOptions handle all the standard option-related stuff.
*/
Tcl_DeleteCommandFromToken(mbPtr->interp, mbPtr->widgetCmd);
@@ -457,7 +449,7 @@ DestroyMenuButton(memPtr)
Tk_FreeBitmap(mbPtr->display, mbPtr->gray);
}
if (mbPtr->textLayout != NULL) {
- Tk_FreeTextLayout(mbPtr->textLayout);
+ Tk_FreeTextLayout(mbPtr->textLayout);
}
Tk_FreeConfigOptions((char *) mbPtr, mbPtr->optionTable, mbPtr->tkwin);
mbPtr->tkwin = NULL;
@@ -469,31 +461,30 @@ DestroyMenuButton(memPtr)
*
* ConfigureMenuButton --
*
- * This procedure is called to process an argv/argc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a menubutton widget.
+ * This function is called to process an argv/argc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a menubutton
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as text string, colors, font,
- * etc. get set for mbPtr; old resources get freed, if there
- * were any. The menubutton is redisplayed.
+ * Configuration information, such as text string, colors, font, etc. get
+ * set for mbPtr; old resources get freed, if there were any. The
+ * menubutton is redisplayed.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureMenuButton(interp, mbPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- register TkMenuButton *mbPtr;
- /* Information about widget; may or may
- * not already have values for some
- * fields. */
- int objc; /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
+ConfigureMenuButton(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register TkMenuButton *mbPtr,
+ /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of valid entries in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments. */
{
Tk_SavedOptions savedOptions;
Tcl_Obj *errorResult = NULL;
@@ -501,21 +492,20 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
Tk_Image image;
/*
- * Eliminate any existing trace on variables monitored by the
- * menubutton.
+ * Eliminate any existing trace on variables monitored by the menubutton.
*/
if (mbPtr->textVarName != NULL) {
- Tcl_UntraceVar(interp, mbPtr->textVarName,
+ Tcl_UntraceVar(interp, mbPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuButtonTextVarProc, (ClientData) mbPtr);
}
/*
- * The following loop is potentially executed twice. During the
- * first pass configuration options get set to their new values.
- * If there is an error in this pass, we execute a second pass
- * to restore all the options to their previous values.
+ * The following loop is potentially executed twice. During the first pass
+ * configuration options get set to their new values. If there is an error
+ * in this pass, we execute a second pass to restore all the options to
+ * their previous values.
*/
for (error = 0; error <= 1; error++) {
@@ -526,7 +516,7 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
if (Tk_SetOptions(interp, (char *) mbPtr,
mbPtr->optionTable, objc, objv,
- mbPtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) {
+ mbPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
}
} else {
@@ -541,8 +531,8 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
/*
* A few options need special processing, such as setting the
- * background from a 3-D border, or filling in complicated
- * defaults that couldn't be specified to Tk_SetOptions.
+ * background from a 3-D border, or filling in complicated defaults
+ * that couldn't be specified to Tk_SetOptions.
*/
if ((mbPtr->state == STATE_ACTIVE)
@@ -564,17 +554,17 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
}
/*
- * Get the image for the widget, if there is one. Allocate the
- * new image before freeing the old one, so that the reference
- * count doesn't go to zero and cause image data to be discarded.
+ * Get the image for the widget, if there is one. Allocate the new
+ * image before freeing the old one, so that the reference count
+ * doesn't go to zero and cause image data to be discarded.
*/
if (mbPtr->imageString != NULL) {
image = Tk_GetImage(mbPtr->interp, mbPtr->tkwin,
- mbPtr->imageString, MenuButtonImageProc,
+ mbPtr->imageString, MenuButtonImageProc,
(ClientData) mbPtr);
if (image == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
} else {
image = NULL;
@@ -590,32 +580,32 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
if ((mbPtr->bitmap != None) || (mbPtr->image != NULL)) {
if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->widthString,
- &mbPtr->width) != TCL_OK) {
- widthError:
- Tcl_AddErrorInfo(interp, "\n (processing -width option)");
+ &mbPtr->width) != TCL_OK) {
+ widthError:
+ Tcl_AddErrorInfo(interp, "\n (processing -width option)");
continue;
}
if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->heightString,
&mbPtr->height) != TCL_OK) {
- heightError:
- Tcl_AddErrorInfo(interp, "\n (processing -height option)");
+ heightError:
+ Tcl_AddErrorInfo(interp, "\n (processing -height option)");
continue;
}
} else {
if (Tcl_GetInt(interp, mbPtr->widthString, &mbPtr->width)
!= TCL_OK) {
- goto widthError;
+ goto widthError;
}
if (Tcl_GetInt(interp, mbPtr->heightString, &mbPtr->height)
!= TCL_OK) {
- goto heightError;
+ goto heightError;
}
}
break;
}
if (!error) {
- Tk_FreeSavedOptions(&savedOptions);
+ Tk_FreeSavedOptions(&savedOptions);
}
if (mbPtr->textVarName != NULL) {
@@ -646,10 +636,9 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
if (error) {
Tcl_SetObjResult(interp, errorResult);
Tcl_DecrRefCount(errorResult);
- return TCL_ERROR;
- } else {
- return TCL_OK;
+ return TCL_ERROR;
}
+ return TCL_OK;
}
/*
@@ -657,22 +646,22 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
*
* TkMenuButtonWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * TkMenuButton will be relayed out and redisplayed.
+ * TkMenuButton will be relayed out and redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
void
-TkMenuButtonWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+TkMenuButtonWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC gc;
@@ -686,9 +675,9 @@ TkMenuButtonWorldChanged(instanceData)
gcValues.background = Tk_3DBorderColor(mbPtr->normalBorder)->pixel;
/*
- * Note: GraphicsExpose events are disabled in GC's because they're
- * used to copy stuff from an off-screen pixmap onto the screen (we know
- * that there's no problem with obscured areas).
+ * Note: GraphicsExpose events are disabled in GC's because they're used
+ * to copy stuff from an off-screen pixmap onto the screen (we know that
+ * there's no problem with obscured areas).
*/
gcValues.graphics_exposures = False;
@@ -729,8 +718,8 @@ TkMenuButtonWorldChanged(instanceData)
}
/*
- * Allocate the disabled graphics context, for drawing text in
- * its disabled state.
+ * Allocate the disabled graphics context, for drawing text in its
+ * disabled state.
*/
mask = GCForeground | GCBackground | GCFont;
@@ -762,36 +751,36 @@ TkMenuButtonWorldChanged(instanceData)
*
* MenuButtonEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on buttons.
+ * This function is invoked by the Tk dispatcher for various events on
+ * buttons.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-MenuButtonEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+MenuButtonEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkMenuButton *mbPtr = (TkMenuButton *) clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
} else if (eventPtr->type == ConfigureNotify) {
/*
- * Must redraw after size changes, since layout could have changed
- * and borders will need to be redrawn.
+ * Must redraw after size changes, since layout could have changed and
+ * borders will need to be redrawn.
*/
goto redraw;
} else if (eventPtr->type == DestroyNotify) {
- DestroyMenuButton((char *) mbPtr);
+ DestroyMenuButton((char *) mbPtr);
} else if (eventPtr->type == FocusIn) {
if (eventPtr->xfocus.detail != NotifyInferior) {
mbPtr->flags |= GOT_FOCUS;
@@ -809,7 +798,7 @@ MenuButtonEventProc(clientData, eventPtr)
}
return;
- redraw:
+ redraw:
if ((mbPtr->tkwin != NULL) && !(mbPtr->flags & REDRAW_PENDING)) {
Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr);
mbPtr->flags |= REDRAW_PENDING;
@@ -821,9 +810,9 @@ MenuButtonEventProc(clientData, eventPtr)
*
* MenuButtonCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -835,17 +824,17 @@ MenuButtonEventProc(clientData, eventPtr)
*/
static void
-MenuButtonCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+MenuButtonCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TkMenuButton *mbPtr = (TkMenuButton *) clientData;
Tk_Window tkwin = mbPtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
if (tkwin != NULL) {
@@ -858,8 +847,8 @@ MenuButtonCmdDeletedProc(clientData)
*
* MenuButtonTextVarProc --
*
- * This procedure is invoked when someone changes the variable
- * whose contents are to be displayed in a menu button.
+ * This function is invoked when someone changes the variable whose
+ * contents are to be displayed in a menu button.
*
* Results:
* NULL is always returned.
@@ -873,19 +862,20 @@ MenuButtonCmdDeletedProc(clientData)
/* ARGSUSED */
static char *
-MenuButtonTextVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about button. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Name of variable. */
- CONST char *name2; /* Second part of variable name. */
- int flags; /* Information about what happened. */
+MenuButtonTextVarProc(
+ ClientData clientData, /* Information about button. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ CONST char *name1, /* Name of variable. */
+ CONST char *name2, /* Second part of variable name. */
+ int flags) /* Information about what happened. */
{
register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
CONST char *value;
+ unsigned len;
/*
- * If the variable is unset, then immediately recreate it unless
- * the whole interpreter is going away.
+ * If the variable is unset, then immediately recreate it unless the whole
+ * interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
@@ -896,7 +886,7 @@ MenuButtonTextVarProc(clientData, interp, name1, name2, flags)
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuButtonTextVarProc, clientData);
}
- return (char *) NULL;
+ return NULL;
}
value = Tcl_GetVar(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY);
@@ -906,8 +896,9 @@ MenuButtonTextVarProc(clientData, interp, name1, name2, flags)
if (mbPtr->text != NULL) {
ckfree(mbPtr->text);
}
- mbPtr->text = (char *) ckalloc((unsigned) (strlen(value) + 1));
- strcpy(mbPtr->text, value);
+ len = 1 + (unsigned) strlen(value);
+ mbPtr->text = (char *) ckalloc(len);
+ memcpy(mbPtr->text, value, len);
TkpComputeMenuButtonGeometry(mbPtr);
if ((mbPtr->tkwin != NULL) && Tk_IsMapped(mbPtr->tkwin)
@@ -915,7 +906,7 @@ MenuButtonTextVarProc(clientData, interp, name1, name2, flags)
Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr);
mbPtr->flags |= REDRAW_PENDING;
}
- return (char *) NULL;
+ return NULL;
}
/*
@@ -923,9 +914,9 @@ MenuButtonTextVarProc(clientData, interp, name1, name2, flags)
*
* MenuButtonImageProc --
*
- * This procedure is invoked by the image code whenever the manager
- * for an image does something that affects the size of contents
- * of an image displayed in a button.
+ * This function is invoked by the image code whenever the manager for an
+ * image does something that affects the size of contents of an image
+ * displayed in a button.
*
* Results:
* None.
@@ -937,13 +928,13 @@ MenuButtonTextVarProc(clientData, interp, name1, name2, flags)
*/
static void
-MenuButtonImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
- ClientData clientData; /* Pointer to widget record. */
- int x, y; /* Upper left pixel (within image)
- * that must be redisplayed. */
- int width, height; /* Dimensions of area to redisplay
- * (may be <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+MenuButtonImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (may be <=
+ * 0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
@@ -955,3 +946,11 @@ MenuButtonImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
}
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h
index 7e36fe6..41af675 100644
--- a/generic/tkMenubutton.h
+++ b/generic/tkMenubutton.h
@@ -1,13 +1,13 @@
/*
* tkMenubutton.h --
*
- * Declarations of types and functions used to implement
- * the menubutton widget.
+ * Declarations of types and functions used to implement the menubutton
+ * widget.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKMENUBUTTON
@@ -31,7 +31,7 @@
*/
enum direction {
- DIRECTION_ABOVE, DIRECTION_BELOW, DIRECTION_FLUSH,
+ DIRECTION_ABOVE, DIRECTION_BELOW, DIRECTION_FLUSH,
DIRECTION_LEFT, DIRECTION_RIGHT
};
@@ -44,16 +44,16 @@ enum state {
};
/*
- * A data structure of the following type is kept for each
- * widget managed by this file:
+ * A data structure of the following type is kept for each widget managed by
+ * this file:
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the widget. NULL
- * means that the window has been destroyed
- * but the data structures haven't yet been
- * cleaned up.*/
- Display *display; /* Display containing widget. Needed, among
+ Tk_Window tkwin; /* Window that embodies the widget. NULL means
+ * that the window has been destroyed but the
+ * data structures haven't yet been cleaned
+ * up. */
+ Display *display; /* Display containing widget. Needed, among
* other things, so that resources can bee
* freed up even after tkwin has gone away. */
Tcl_Interp *interp; /* Interpreter associated with menubutton. */
@@ -67,17 +67,17 @@ typedef struct {
* Information about what's displayed in the menu button:
*/
- char *text; /* Text to display in button (malloc'ed)
- * or NULL. */
+ char *text; /* Text to display in button (malloc'ed) or
+ * NULL. */
int underline; /* Index of character to underline. */
- char *textVarName; /* Name of variable (malloc'ed) or NULL.
- * If non-NULL, button displays the contents
- * of this variable. */
- Pixmap bitmap; /* Bitmap to display or None. If not None
- * then text and textVar and underline
- * are ignored. */
+ char *textVarName; /* Name of variable (malloc'ed) or NULL. If
+ * non-NULL, button displays the contents of
+ * this variable. */
+ Pixmap bitmap; /* Bitmap to display or None. If not None then
+ * text and textVar and underline are
+ * ignored. */
char *imageString; /* Name of image to display (malloc'ed), or
- * NULL. If non-NULL, bitmap, text, and
+ * NULL. If non-NULL, bitmap, text, and
* textVarName are ignored. */
Tk_Image image; /* Image to display in window, or NULL if
* none. */
@@ -86,115 +86,113 @@ typedef struct {
* Information used when displaying widget:
*/
- enum state state; /* State of button for display purposes:
+ enum state state; /* State of button for display purposes:
* normal, active, or disabled. */
- Tk_3DBorder normalBorder; /* Structure used to draw 3-D
- * border and background when window
- * isn't active. NULL means no such
- * border exists. */
- Tk_3DBorder activeBorder; /* Structure used to draw 3-D
- * border and background when window
- * is active. NULL means no such
- * border exists. */
+ Tk_3DBorder normalBorder; /* Structure used to draw 3-D border and
+ * background when window isn't active. NULL
+ * means no such border exists. */
+ Tk_3DBorder activeBorder; /* Structure used to draw 3-D border and
+ * background when window is active. NULL
+ * means no such border exists. */
int borderWidth; /* Width of border. */
int relief; /* 3-d effect: TK_RELIEF_RAISED, etc. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * <= 0 means don't draw a highlight. */
- XColor *highlightBgColorPtr;
- /* Color for drawing traversal highlight
- * area when highlight is off. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. <= 0 means
+ * don't draw a highlight. */
+ XColor *highlightBgColorPtr;/* Color for drawing traversal highlight area
+ * when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
int inset; /* Total width of all borders, including
* traversal highlight and 3-D border.
- * Indicates how much interior stuff must
- * be offset from outside edges to leave
- * room for borders. */
+ * Indicates how much interior stuff must be
+ * offset from outside edges to leave room for
+ * borders. */
Tk_Font tkfont; /* Information about text font, or NULL. */
XColor *normalFg; /* Foreground color in normal mode. */
- XColor *activeFg; /* Foreground color in active mode. NULL
- * means use normalFg instead. */
- XColor *disabledFg; /* Foreground color when disabled. NULL
- * means use normalFg with a 50% stipple
- * instead. */
+ XColor *activeFg; /* Foreground color in active mode. NULL means
+ * use normalFg instead. */
+ XColor *disabledFg; /* Foreground color when disabled. NULL means
+ * use normalFg with a 50% stipple instead. */
GC normalTextGC; /* GC for drawing text in normal mode. */
GC activeTextGC; /* GC for drawing text in active mode (NULL
* means use normalTextGC). */
Pixmap gray; /* Pixmap for displaying disabled text/icon if
* disabledFg is NULL. */
- GC disabledGC; /* Used to produce disabled effect for text. */
- GC stippleGC; /* Used to produce disabled stipple effect
- * for images when disabled. */
+ GC disabledGC; /* Used to produce disabled effect for
+ * text. */
+ GC stippleGC; /* Used to produce disabled stipple effect for
+ * images when disabled. */
int leftBearing; /* Distance from text origin to leftmost drawn
* pixel (positive means to right). */
- int rightBearing; /* Amount text sticks right from its origin. */
- char *widthString; /* Value of -width option. Malloc'ed. */
- char *heightString; /* Value of -height option. Malloc'ed. */
+ int rightBearing; /* Amount text sticks right from its
+ * origin. */
+ char *widthString; /* Value of -width option. Malloc'ed. */
+ char *heightString; /* Value of -height option. Malloc'ed. */
int width, height; /* If > 0, these specify dimensions to request
* for window, in characters for text and in
- * pixels for bitmaps. In this case the actual
+ * pixels for bitmaps. In this case the actual
* size of the text string or bitmap is
- * ignored in computing desired window size. */
+ * ignored in computing desired window
+ * size. */
int wrapLength; /* Line length (in pixels) at which to wrap
- * onto next line. <= 0 means don't wrap
+ * onto next line. <= 0 means don't wrap
* except at newlines. */
int padX, padY; /* Extra space around text or bitmap (pixels
* on each side). */
Tk_Anchor anchor; /* Where text/bitmap should be displayed
* inside window region. */
- Tk_Justify justify; /* Justification to use for multi-line text. */
+ Tk_Justify justify; /* Justification to use for multi-line
+ * text. */
int textWidth; /* Width needed to display text as requested,
* in pixels. */
int textHeight; /* Height needed to display text as requested,
* in pixels. */
Tk_TextLayout textLayout; /* Saved text layout information. */
- int indicatorOn; /* Non-zero means display indicator; 0 means
+ int indicatorOn; /* Non-zero means display indicator; 0 means
* don't display. */
- int indicatorHeight; /* Height of indicator in pixels. This same
+ int indicatorHeight; /* Height of indicator in pixels. This same
* amount of extra space is also left on each
- * side of the indicator. 0 if no indicator. */
+ * side of the indicator. 0 if no
+ * indicator. */
int indicatorWidth; /* Width of indicator in pixels, including
- * indicatorHeight in padding on each side.
- * 0 if no indicator. */
+ * indicatorHeight in padding on each side. 0
+ * if no indicator. */
/*
* Miscellaneous information:
*/
- int compound; /* Value of -compound option; specifies whether
- * the menubutton should show both an image and
- * text, and, if so, how. */
-
- enum direction direction; /* Direction for where to pop the menu.
- * Valid directions are "above", "below",
- * "left", "right", and "flush". "flush"
- * means that the upper left corner of the
- * menubutton is where the menu pops up.
- * "above" and "below" will attempt to pop
- * the menu compleletly above or below
- * the menu respectively.
- * "left" and "right" will pop the menu
- * left or right, and the active item
- * will be next to the button. */
+ int compound; /* Value of -compound option; specifies
+ * whether the menubutton should show both an
+ * image and text, and, if so, how. */
+ enum direction direction; /* Direction for where to pop the menu. Valid
+ * directions are "above", "below", "left",
+ * "right", and "flush". "flush" means that
+ * the upper left corner of the menubutton is
+ * where the menu pops up. "above" and "below"
+ * will attempt to pop the menu compleletly
+ * above or below the menu respectively.
+ * "left" and "right" will pop the menu left
+ * or right, and the active item will be next
+ * to the button. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
- char *takeFocus; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
- int flags; /* Various flags; see below for
+ char *takeFocus; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
+ int flags; /* Various flags; see below for
* definitions. */
} TkMenuButton;
/*
* Flag bits for buttons:
*
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler
- * has already been queued to redraw
- * this window.
- * POSTED: Non-zero means that the menu associated
- * with this button has been posted (typically
- * because of an active button press).
- * GOT_FOCUS: Non-zero means this button currently
- * has the input focus.
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
+ * already been queued to redraw this window.
+ * POSTED: Non-zero means that the menu associated with
+ * this button has been posted (typically because
+ * of an active button press).
+ * GOT_FOCUS: Non-zero means this button currently has the
+ * input focus.
*/
#define REDRAW_PENDING 1
@@ -203,7 +201,7 @@ typedef struct {
/*
* The following constants define the dimensions of the cascade indicator,
- * which is displayed if the "-indicatoron" option is true. The units for
+ * which is displayed if the "-indicatoron" option is true. The units for
* these options are 1/10 millimeters.
*/
@@ -214,22 +212,17 @@ typedef struct {
* Declaration of variables shared between the files in the button module.
*/
-extern Tk_ClassProcs tkpMenubuttonClass;
+MODULE_SCOPE Tk_ClassProcs tkpMenubuttonClass;
/*
- * Declaration of procedures used in the implementation of the button
- * widget.
+ * Declaration of procedures used in the implementation of the button widget.
*/
-EXTERN void TkpComputeMenuButtonGeometry _ANSI_ARGS_((
- TkMenuButton *mbPtr));
-EXTERN TkMenuButton * TkpCreateMenuButton _ANSI_ARGS_((Tk_Window tkwin));
-EXTERN void TkpDisplayMenuButton _ANSI_ARGS_((
- ClientData clientData));
-EXTERN void TkpDestroyMenuButton _ANSI_ARGS_((
- TkMenuButton *mbPtr));
-EXTERN void TkMenuButtonWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
+MODULE_SCOPE void TkpComputeMenuButtonGeometry(TkMenuButton *mbPtr);
+MODULE_SCOPE TkMenuButton *TkpCreateMenuButton(Tk_Window tkwin);
+MODULE_SCOPE void TkpDisplayMenuButton(ClientData clientData);
+MODULE_SCOPE void TkpDestroyMenuButton(TkMenuButton *mbPtr);
+MODULE_SCOPE void TkMenuButtonWorldChanged(ClientData instanceData);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index 8fb5c36..0fd57a9 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -1,35 +1,34 @@
-/*
+/*
* tkMessage.c --
*
- * This module implements a message widgets for the Tk
- * toolkit. A message widget displays a multi-line string
- * in a window according to a particular aspect ratio.
+ * This module implements a message widgets for the Tk toolkit. A message
+ * widget displays a multi-line string in a window according to a
+ * particular aspect ratio.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Ajuba Solutions.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "default.h"
#include "tkInt.h"
/*
- * A data structure of the following type is kept for each message
- * widget managed by this file:
+ * A data structure of the following type is kept for each message widget
+ * managed by this file:
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the message. NULL
+ Tk_Window tkwin; /* Window that embodies the message. NULL
* means that the window has been destroyed
* but the data structures haven't yet been
* cleaned up.*/
Tk_OptionTable optionTable; /* Table that defines options available for
* this widget. */
- Display *display; /* Display containing widget. Used, among
+ Display *display; /* Display containing widget. Used, among
* other things, so that resources can be
* freed even after tkwin has gone away. */
Tcl_Interp *interp; /* Interpreter associated with message. */
@@ -46,8 +45,8 @@ typedef struct {
* If non-NULL, message displays the contents
* of this variable. */
Tk_3DBorder border; /* Structure used to draw 3-D border and
- * background. NULL means a border hasn't
- * been created yet. */
+ * background. NULL means a border hasn't been
+ * created yet. */
int borderWidth; /* Width of border. */
int relief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
int highlightWidth; /* Width in pixels of highlight to draw
@@ -61,7 +60,7 @@ typedef struct {
XColor *fgColorPtr; /* Foreground color in normal mode. */
Tcl_Obj *padXPtr, *padYPtr; /* Tcl_Obj rep's of padX, padY values. */
int padX, padY; /* User-requested extra space around text. */
- int width; /* User-requested width, in pixels. 0 means
+ int width; /* User-requested width, in pixels. 0 means
* compute width using aspect ratio below. */
int aspect; /* Desired aspect ratio for window
* (100*width/height). */
@@ -82,10 +81,10 @@ typedef struct {
*/
Tk_Cursor cursor; /* Current cursor for window, or None. */
- char *takeFocus; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
- int flags; /* Various flags; see below for
+ char *takeFocus; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
+ int flags; /* Various flags; see below for
* definitions. */
} Message;
@@ -108,7 +107,7 @@ typedef struct {
* Information used for argv parsing.
*/
-static Tk_OptionSpec optionSpecs[] = {
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR,
-1, Tk_Offset(Message, anchor), 0, 0, 0},
{TK_OPTION_INT, "-aspect", "aspect", "Aspect", DEF_MESSAGE_ASPECT,
@@ -116,9 +115,9 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_MESSAGE_BG_COLOR, -1, Tk_Offset(Message, border), 0,
(ClientData) DEF_MESSAGE_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, (char *) NULL,
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL,
0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL, (char *) NULL,
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL,
0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_MESSAGE_BORDER_WIDTH, -1,
@@ -126,7 +125,7 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_MESSAGE_CURSOR, -1, Tk_Offset(Message, cursor),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", (char *) NULL, (char *) NULL, (char *) NULL,
+ {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL,
0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_MESSAGE_FONT, -1, Tk_Offset(Message, tkfont), 0, 0, 0},
@@ -161,35 +160,31 @@ static Tk_OptionSpec optionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
DEF_MESSAGE_WIDTH, -1, Tk_Offset(Message, width), 0, 0 ,0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0}
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void MessageCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void MessageEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static char * MessageTextVarProc _ANSI_ARGS_((ClientData clientData,
+static void MessageCmdDeletedProc(ClientData clientData);
+static void MessageEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static char * MessageTextVarProc(ClientData clientData,
Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static int MessageWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
+ CONST char *name2, int flags);
+static int MessageWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void MessageWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static void ComputeMessageGeometry _ANSI_ARGS_((Message *msgPtr));
-static int ConfigureMessage _ANSI_ARGS_((Tcl_Interp *interp,
- Message *msgPtr, int objc, Tcl_Obj *CONST objv[],
- int flags));
-static void DestroyMessage _ANSI_ARGS_((char *memPtr));
-static void DisplayMessage _ANSI_ARGS_((ClientData clientData));
+ Tcl_Obj *CONST objv[]);
+static void MessageWorldChanged(ClientData instanceData);
+static void ComputeMessageGeometry(Message *msgPtr);
+static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr,
+ int objc, Tcl_Obj *CONST objv[], int flags);
+static void DestroyMessage(char *memPtr);
+static void DisplayMessage(ClientData clientData);
/*
- * The structure below defines message class behavior by means of procedures
+ * The structure below defines message class behavior by means of functions
* that can be invoked from generic window code.
*/
@@ -197,16 +192,14 @@ static Tk_ClassProcs messageClass = {
sizeof(Tk_ClassProcs), /* size */
MessageWorldChanged, /* worldChangedProc */
};
-
/*
*--------------------------------------------------------------
*
* Tk_MessageObjCmd --
*
- * This procedure is invoked to process the "message" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "message" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -218,11 +211,11 @@ static Tk_ClassProcs messageClass = {
*/
int
-Tk_MessageObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings. */
+Tk_MessageObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument strings. */
{
register Message *msgPtr;
Tk_OptionTable optionTable;
@@ -234,14 +227,14 @@ Tk_MessageObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
/*
- * Create the option table for this widget class. If it has already
- * been created, the cached pointer will be returned.
+ * Create the option table for this widget class. If it has already been
+ * created, the cached pointer will be returned.
*/
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
@@ -252,19 +245,20 @@ Tk_MessageObjCmd(clientData, interp, objc, objv)
/*
* Set values for those fields that don't take a 0 or NULL value.
*/
- msgPtr->tkwin = tkwin;
- msgPtr->display = Tk_Display(tkwin);
- msgPtr->interp = interp;
- msgPtr->widgetCmd = Tcl_CreateObjCommand(interp,
+
+ msgPtr->tkwin = tkwin;
+ msgPtr->display = Tk_Display(tkwin);
+ msgPtr->interp = interp;
+ msgPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(msgPtr->tkwin), MessageWidgetObjCmd,
(ClientData) msgPtr, MessageCmdDeletedProc);
- msgPtr->optionTable = optionTable;
- msgPtr->relief = TK_RELIEF_FLAT;
- msgPtr->textGC = None;
- msgPtr->anchor = TK_ANCHOR_CENTER;
- msgPtr->aspect = 150;
- msgPtr->justify = TK_JUSTIFY_LEFT;
- msgPtr->cursor = None;
+ msgPtr->optionTable = optionTable;
+ msgPtr->relief = TK_RELIEF_FLAT;
+ msgPtr->textGC = None;
+ msgPtr->anchor = TK_ANCHOR_CENTER;
+ msgPtr->aspect = 150;
+ msgPtr->justify = TK_JUSTIFY_LEFT;
+ msgPtr->cursor = None;
Tk_SetClass(msgPtr->tkwin, "Message");
Tk_SetClassProcs(msgPtr->tkwin, &messageClass, (ClientData) msgPtr);
@@ -290,9 +284,9 @@ Tk_MessageObjCmd(clientData, interp, objc, objv)
*
* MessageWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -304,19 +298,19 @@ Tk_MessageObjCmd(clientData, interp, objc, objv)
*/
static int
-MessageWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about message widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings. */
+MessageWidgetObjCmd(
+ ClientData clientData, /* Information about message widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument strings. */
{
register Message *msgPtr = (Message *) clientData;
- static CONST char *optionStrings[] = { "cget", "configure", (char *) NULL };
+ static CONST char *optionStrings[] = { "cget", "configure", NULL };
enum options { MESSAGE_CGET, MESSAGE_CONFIGURE };
int index;
int result = TCL_OK;
Tcl_Obj *objPtr;
-
+
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
return TCL_ERROR;
@@ -328,43 +322,40 @@ MessageWidgetObjCmd(clientData, interp, objc, objv)
}
Tcl_Preserve((ClientData) msgPtr);
-
+
switch ((enum options) index) {
- case MESSAGE_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
+ case MESSAGE_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ result = TCL_ERROR;
+ } else {
+ objPtr = Tk_GetOptionValue(interp, (char *) msgPtr,
+ msgPtr->optionTable, objv[2], msgPtr->tkwin);
+ if (objPtr == NULL) {
result = TCL_ERROR;
} else {
- objPtr = Tk_GetOptionValue(interp, (char *) msgPtr,
- msgPtr->optionTable, objv[2], msgPtr->tkwin);
- if (objPtr == NULL) {
- result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- result = TCL_OK;
- }
+ Tcl_SetObjResult(interp, objPtr);
+ result = TCL_OK;
}
- break;
}
- case MESSAGE_CONFIGURE: {
- if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) msgPtr,
- msgPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- msgPtr->tkwin);
- if (objPtr == NULL) {
- result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- result = TCL_OK;
- }
+ break;
+ case MESSAGE_CONFIGURE:
+ if (objc <= 3) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) msgPtr,
+ msgPtr->optionTable, (objc == 3) ? objv[2] : NULL,
+ msgPtr->tkwin);
+ if (objPtr == NULL) {
+ result = TCL_ERROR;
} else {
- result = ConfigureMessage(interp, msgPtr, objc-2, objv+2, 0);
+ Tcl_SetObjResult(interp, objPtr);
+ result = TCL_OK;
}
- break;
+ } else {
+ result = ConfigureMessage(interp, msgPtr, objc-2, objv+2, 0);
}
+ break;
}
-
+
Tcl_Release((ClientData) msgPtr);
return result;
}
@@ -374,9 +365,9 @@ MessageWidgetObjCmd(clientData, interp, objc, objv)
*
* DestroyMessage --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a message at a safe time
- * (when no-one is using it anymore).
+ * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
+ * up the internal structure of a message at a safe time (when no-one is
+ * using it anymore).
*
* Results:
* None.
@@ -388,8 +379,8 @@ MessageWidgetObjCmd(clientData, interp, objc, objv)
*/
static void
-DestroyMessage(memPtr)
- char *memPtr; /* Info about message widget. */
+DestroyMessage(
+ char *memPtr) /* Info about message widget. */
{
register Message *msgPtr = (Message *) memPtr;
@@ -399,11 +390,10 @@ DestroyMessage(memPtr)
if (msgPtr->flags & REDRAW_PENDING) {
Tcl_CancelIdleCall(DisplayMessage, (ClientData) msgPtr);
}
-
+
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeConfigOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeConfigOptions handle all the standard option-related stuff.
*/
if (msgPtr->textGC != None) {
@@ -427,30 +417,29 @@ DestroyMessage(memPtr)
*
* ConfigureMessage --
*
- * This procedure is called to process an argv/argc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a message widget.
+ * This function is called to process an argv/argc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a message
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as text string, colors, font,
- * etc. get set for msgPtr; old resources get freed, if there
- * were any.
+ * Configuration information, such as text string, colors, font, etc. get
+ * set for msgPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureMessage(interp, msgPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- register Message *msgPtr; /* Information about widget; may or may
- * not already have values for some fields. */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Arguments. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureMessage(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register Message *msgPtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *CONST objv[], /* Arguments. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
Tk_SavedOptions savedOptions;
@@ -459,22 +448,21 @@ ConfigureMessage(interp, msgPtr, objc, objv, flags)
*/
if (msgPtr->textVarName != NULL) {
- Tcl_UntraceVar(interp, msgPtr->textVarName,
+ Tcl_UntraceVar(interp, msgPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MessageTextVarProc, (ClientData) msgPtr);
}
if (Tk_SetOptions(interp, (char *) msgPtr, msgPtr->optionTable, objc, objv,
- msgPtr->tkwin, &savedOptions, (int *)NULL) != TCL_OK) {
+ msgPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
Tk_RestoreSavedOptions(&savedOptions);
return TCL_ERROR;
}
-
-
+
/*
- * If the message is to display the value of a variable, then set up
- * a trace on the variable's value, create the variable if it doesn't
- * exist, and fetch its current value.
+ * If the message is to display the value of a variable, then set up a
+ * trace on the variable's value, create the variable if it doesn't exist,
+ * and fetch its current value.
*/
if (msgPtr->textVarName != NULL) {
@@ -496,9 +484,9 @@ ConfigureMessage(interp, msgPtr, objc, objv, flags)
}
/*
- * A few other options need special processing, such as setting
- * the background from a 3-D border or handling special defaults
- * that couldn't be specified to Tk_ConfigureWidget.
+ * A few other options need special processing, such as setting the
+ * background from a 3-D border or handling special defaults that couldn't
+ * be specified to Tk_ConfigureWidget.
*/
msgPtr->numChars = Tcl_NumUtfChars(msgPtr->string, -1);
@@ -517,22 +505,22 @@ ConfigureMessage(interp, msgPtr, objc, objv, flags)
*
* MessageWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Message will be relayed out and redisplayed.
+ * Message will be relayed out and redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
static void
-MessageWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+MessageWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC gc = None;
@@ -562,8 +550,8 @@ MessageWorldChanged(instanceData)
}
/*
- * Recompute the desired geometry for the window, and arrange for
- * the window to be redisplayed.
+ * Recompute the desired geometry for the window, and arrange for the
+ * window to be redisplayed.
*/
ComputeMessageGeometry(msgPtr);
@@ -579,23 +567,22 @@ MessageWorldChanged(instanceData)
*
* ComputeMessageGeometry --
*
- * Compute the desired geometry for a message window,
- * taking into account the desired aspect ratio for the
- * window.
+ * Compute the desired geometry for a message window, taking into account
+ * the desired aspect ratio for the window.
*
* Results:
* None.
*
* Side effects:
- * Tk_GeometryRequest is called to inform the geometry
- * manager of the desired geometry for this window.
+ * Tk_GeometryRequest is called to inform the geometry manager of the
+ * desired geometry for this window.
*
*--------------------------------------------------------------
*/
static void
-ComputeMessageGeometry(msgPtr)
- register Message *msgPtr; /* Information about window. */
+ComputeMessageGeometry(
+ register Message *msgPtr) /* Information about window. */
{
int width, inc, height;
int thisWidth, thisHeight, maxWidth;
@@ -617,12 +604,11 @@ ComputeMessageGeometry(msgPtr)
upperBound = msgPtr->aspect + aspect;
/*
- * Do the computation in multiple passes: start off with
- * a very wide window, and compute its height. Then change
- * the width and try again. Reduce the size of the change
- * and iterate until dimensions are found that approximate
- * the desired aspect ratio. Or, if the user gave an explicit
- * width then just use that.
+ * Do the computation in multiple passes: start off with a very wide
+ * window, and compute its height. Then change the width and try again.
+ * Reduce the size of the change and iterate until dimensions are found
+ * that approximate the desired aspect ratio. Or, if the user gave an
+ * explicit width then just use that.
*/
if (msgPtr->width > 0) {
@@ -665,7 +651,7 @@ ComputeMessageGeometry(msgPtr)
*
* DisplayMessage --
*
- * This procedure redraws the contents of a message window.
+ * This function redraws the contents of a message window.
*
* Results:
* None.
@@ -677,8 +663,8 @@ ComputeMessageGeometry(msgPtr)
*/
static void
-DisplayMessage(clientData)
- ClientData clientData; /* Information about window. */
+DisplayMessage(
+ ClientData clientData) /* Information about window. */
{
register Message *msgPtr = (Message *) clientData;
register Tk_Window tkwin = msgPtr->tkwin;
@@ -702,8 +688,8 @@ DisplayMessage(clientData)
0, TK_RELIEF_FLAT);
/*
- * Compute starting y-location for message based on message size
- * and anchor option.
+ * Compute starting y-location for message based on message size and
+ * anchor option.
*/
TkComputeAnchor(msgPtr->anchor, tkwin, msgPtr->padX, msgPtr->padY,
@@ -723,7 +709,7 @@ DisplayMessage(clientData)
bgGC = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin));
if (msgPtr->flags & GOT_FOCUS) {
- fgGC = Tk_GCForColor(msgPtr->highlightColorPtr, Tk_WindowId(tkwin));
+ fgGC = Tk_GCForColor(msgPtr->highlightColorPtr,Tk_WindowId(tkwin));
TkpDrawHighlightBorder(tkwin, fgGC, bgGC, msgPtr->highlightWidth,
Tk_WindowId(tkwin));
} else {
@@ -738,23 +724,23 @@ DisplayMessage(clientData)
*
* MessageEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on messages.
+ * This function is invoked by the Tk dispatcher for various events on
+ * messages.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-MessageEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+MessageEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
Message *msgPtr = (Message *) clientData;
@@ -780,7 +766,7 @@ MessageEventProc(clientData, eventPtr)
}
return;
- redraw:
+ redraw:
if ((msgPtr->tkwin != NULL) && !(msgPtr->flags & REDRAW_PENDING)) {
Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
msgPtr->flags |= REDRAW_PENDING;
@@ -792,9 +778,9 @@ MessageEventProc(clientData, eventPtr)
*
* MessageCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -806,16 +792,16 @@ MessageEventProc(clientData, eventPtr)
*/
static void
-MessageCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+MessageCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
Message *msgPtr = (Message *) clientData;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
if (!(msgPtr->flags & MESSAGE_DELETED)) {
@@ -828,34 +814,33 @@ MessageCmdDeletedProc(clientData)
*
* MessageTextVarProc --
*
- * This procedure is invoked when someone changes the variable
- * whose contents are to be displayed in a message.
+ * This function is invoked when someone changes the variable whose
+ * contents are to be displayed in a message.
*
* Results:
* NULL is always returned.
*
* Side effects:
- * The text displayed in the message will change to match the
- * variable.
+ * The text displayed in the message will change to match the variable.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static char *
-MessageTextVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about message. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Name of variable. */
- CONST char *name2; /* Second part of variable name. */
- int flags; /* Information about what happened. */
+MessageTextVarProc(
+ ClientData clientData, /* Information about message. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ CONST char *name1, /* Name of variable. */
+ CONST char *name2, /* Second part of variable name. */
+ int flags) /* Information about what happened. */
{
register Message *msgPtr = (Message *) clientData;
CONST char *value;
/*
- * If the variable is unset, then immediately recreate it unless
- * the whole interpreter is going away.
+ * If the variable is unset, then immediately recreate it unless the whole
+ * interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
@@ -866,7 +851,7 @@ MessageTextVarProc(clientData, interp, name1, name2, flags)
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MessageTextVarProc, clientData);
}
- return (char *) NULL;
+ return NULL;
}
value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY);
@@ -886,5 +871,13 @@ MessageTextVarProc(clientData, interp, name1, name2, flags)
Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
msgPtr->flags |= REDRAW_PENDING;
}
- return (char *) NULL;
+ return NULL;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 291c70d..4c8516e 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -1,13 +1,12 @@
-/*
+/*
* tkObj.c --
*
- * This file contains procedures that implement the common Tk object
- * types
+ * This file contains functions that implement the common Tk object types
*
* Copyright (c) 1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
@@ -15,7 +14,7 @@
/*
* The following structure is the internal representation for pixel objects.
*/
-
+
typedef struct PixelRep {
double value;
int units;
@@ -27,11 +26,11 @@ typedef struct PixelRep {
((objPtr)->internalRep.twoPtrValue.ptr2 == 0)
#define SET_SIMPLEPIXEL(objPtr, intval) \
- (objPtr)->internalRep.twoPtrValue.ptr1 = (VOID *) (intval); \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = INT2PTR(intval); \
(objPtr)->internalRep.twoPtrValue.ptr2 = 0
#define GET_SIMPLEPIXEL(objPtr) \
- ((int) (objPtr)->internalRep.twoPtrValue.ptr1)
+ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr1))
#define SET_COMPLEXPIXEL(objPtr, repPtr) \
(objPtr)->internalRep.twoPtrValue.ptr1 = 0; \
@@ -40,11 +39,24 @@ typedef struct PixelRep {
#define GET_COMPLEXPIXEL(objPtr) \
((PixelRep *) (objPtr)->internalRep.twoPtrValue.ptr2)
+/*
+ * One of these structures is created per thread to store thread-specific
+ * data. In this case, it is used to contain references to selected
+ * Tcl_ObjTypes that we can use as screen distances without conversion. The
+ * "dataKey" below is used to locate the ThreadSpecificData for the current
+ * thread.
+ */
+
+typedef struct ThreadSpecificData {
+ const Tcl_ObjType *doubleTypePtr;
+ const Tcl_ObjType *intTypePtr;
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* The following structure is the internal representation for mm objects.
*/
-
+
typedef struct MMRep {
double value;
int units;
@@ -54,41 +66,37 @@ typedef struct MMRep {
/*
* The following structure is the internal representation for window objects.
- * A WindowRep caches name-to-window lookups. The cache is invalid
- * if tkwin is NULL or if mainPtr->deletionEpoch does not match epoch.
+ * A WindowRep caches name-to-window lookups. The cache is invalid if tkwin is
+ * NULL or if mainPtr->deletionEpoch does not match epoch.
*/
+
typedef struct WindowRep {
- Tk_Window tkwin; /* Cached window; NULL if not found */
- TkMainInfo *mainPtr; /* MainWindow associated with tkwin */
+ Tk_Window tkwin; /* Cached window; NULL if not found. */
+ TkMainInfo *mainPtr; /* MainWindow associated with tkwin. */
long epoch; /* Value of mainPtr->deletionEpoch at last
- * successful lookup. */
+ * successful lookup. */
} WindowRep;
/*
- * Prototypes for procedures defined later in this file:
+ * Prototypes for functions defined later in this file:
*/
-static void DupMMInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr,
- Tcl_Obj *copyPtr));
-static void DupPixelInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr,
- Tcl_Obj *copyPtr));
-static void DupWindowInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr,
- Tcl_Obj *copyPtr));
-static void FreeMMInternalRep _ANSI_ARGS_((Tcl_Obj *objPtr));
-static void FreePixelInternalRep _ANSI_ARGS_((Tcl_Obj *objPtr));
-static void FreeWindowInternalRep _ANSI_ARGS_((Tcl_Obj *objPtr));
-static void UpdateStringOfMM _ANSI_ARGS_((Tcl_Obj *objPtr));
-static int SetMMFromAny _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *objPtr));
-static int SetPixelFromAny _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *objPtr));
-static int SetWindowFromAny _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *objPtr));
+static void DupMMInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
+static void DupPixelInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
+static void DupWindowInternalRep(Tcl_Obj *srcPtr,Tcl_Obj *copyPtr);
+static void FreeMMInternalRep(Tcl_Obj *objPtr);
+static void FreePixelInternalRep(Tcl_Obj *objPtr);
+static void FreeWindowInternalRep(Tcl_Obj *objPtr);
+static ThreadSpecificData *GetTypeCache(void);
+static void UpdateStringOfMM(Tcl_Obj *objPtr);
+static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
+static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
+static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
/*
- * The following structure defines the implementation of the "pixel"
- * Tcl object, used for measuring distances. The pixel object remembers
- * its initial display-independant settings.
+ * The following structure defines the implementation of the "pixel" Tcl
+ * object, used for measuring distances. The pixel object remembers its
+ * initial display-independant settings.
*/
static Tcl_ObjType pixelObjType = {
@@ -100,9 +108,9 @@ static Tcl_ObjType pixelObjType = {
};
/*
- * The following structure defines the implementation of the "pixel"
- * Tcl object, used for measuring distances. The pixel object remembers
- * its initial display-independant settings.
+ * The following structure defines the implementation of the "pixel" Tcl
+ * object, used for measuring distances. The pixel object remembers its
+ * initial display-independant settings.
*/
static Tcl_ObjType mmObjType = {
@@ -119,23 +127,46 @@ static Tcl_ObjType mmObjType = {
*/
static Tcl_ObjType windowObjType = {
- "window", /* name */
- FreeWindowInternalRep, /* freeIntRepProc */
- DupWindowInternalRep, /* dupIntRepProc */
- NULL, /* updateStringProc */
- SetWindowFromAny /* setFromAnyProc */
+ "window", /* name */
+ FreeWindowInternalRep, /* freeIntRepProc */
+ DupWindowInternalRep, /* dupIntRepProc */
+ NULL, /* updateStringProc */
+ SetWindowFromAny /* setFromAnyProc */
};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetTypeCache --
+ *
+ * Get (and build if necessary) the cache of useful Tcl object types for
+ * comparisons in the conversion functions. This allows optimized checks
+ * for standard cases.
+ *
+ *----------------------------------------------------------------------
+ */
+static ThreadSpecificData *
+GetTypeCache()
+{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ if (tsdPtr->doubleTypePtr == NULL) {
+ tsdPtr->doubleTypePtr = Tcl_GetObjType("double");
+ tsdPtr->intTypePtr = Tcl_GetObjType("int");
+ }
+ return tsdPtr;
+}
/*
*----------------------------------------------------------------------
*
- * Tk_GetPixelsFromObj --
+ * GetPixelsFromObjEx --
*
* Attempt to return a pixel value from the Tcl object "objPtr". If the
- * object is not already a pixel value, an attempt will be made to convert
- * it to one.
+ * object is not already a pixel value, an attempt will be made to
+ * convert it to one.
*
* Results:
* The return value is a standard Tcl object result. If an error occurs
@@ -143,38 +174,82 @@ static Tcl_ObjType windowObjType = {
* result unless "interp" is NULL.
*
* Side effects:
- * If the object is not already a pixel, the conversion will free
- * any old internal representation.
+ * If the object is not already a pixel, the conversion will free any old
+ * internal representation.
*
*----------------------------------------------------------------------
*/
+static
int
-Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tk_Window tkwin;
- Tcl_Obj *objPtr; /* The object from which to get pixels. */
- int *intPtr; /* Place to store resulting pixels. */
+GetPixelsFromObjEx(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr, /* The object from which to get pixels. */
+ int *intPtr,
+ double *dblPtr) /* Places to store resulting pixels. */
{
- int result;
+ int result,fresh;
double d;
PixelRep *pixelPtr;
static double bias[] = {
- 1.0, 10.0, 25.4, 25.4 / 72.0
+ 1.0, 10.0, 25.4, 0.35278 /*25.4 / 72.0*/
};
+ /*
+ * Special hacks where the type of the object is known to be something
+ * that is just numeric and cannot require distance conversion. This pokes
+ * holes in Tcl's abstractions, but they are just for optimization, not
+ * semantics.
+ */
+
+ if (objPtr->typePtr != &pixelObjType) {
+ ThreadSpecificData *tsdPtr = GetTypeCache();
+
+ if (objPtr->typePtr == tsdPtr->doubleTypePtr) {
+ (void) Tcl_GetDoubleFromObj(interp, objPtr, &d);
+ if (dblPtr != NULL) {
+ *dblPtr = d;
+ }
+ *intPtr = (int) d;
+ return TCL_OK;
+ } else if (objPtr->typePtr == tsdPtr->intTypePtr) {
+ (void) Tcl_GetIntFromObj(interp, objPtr, intPtr);
+ if (dblPtr) {
+ *dblPtr = (double) (*intPtr);
+ }
+ return TCL_OK;
+ }
+ }
+
+ retry:
if (objPtr->typePtr != &pixelObjType) {
result = SetPixelFromAny(interp, objPtr);
if (result != TCL_OK) {
return result;
}
+ fresh=1;
+ } else {
+ fresh=0;
}
if (SIMPLE_PIXELREP(objPtr)) {
*intPtr = GET_SIMPLEPIXEL(objPtr);
+ if (dblPtr) {
+ *dblPtr=(double)(*intPtr);
+ }
} else {
pixelPtr = GET_COMPLEXPIXEL(objPtr);
- if (pixelPtr->tkwin != tkwin) {
+ if ((!fresh) && (pixelPtr->tkwin != tkwin))
+ {
+ /* in case of exo-screen conversions of non-pixels
+ * we force a recomputation from the string
+ */
+
+ FreePixelInternalRep(objPtr);
+ goto retry;
+ }
+ if ((pixelPtr->tkwin != tkwin)||dblPtr) {
d = pixelPtr->value;
if (pixelPtr->units >= 0) {
d *= bias[pixelPtr->units] * WidthOfScreen(Tk_Screen(tkwin));
@@ -186,9 +261,91 @@ Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
pixelPtr->returnValue = (int) (d + 0.5);
}
pixelPtr->tkwin = tkwin;
+ if (dblPtr) {
+ *dblPtr=(double)d;
+ }
+ }
+ *intPtr = pixelPtr->returnValue;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetPixelsFromObj --
+ *
+ * Attempt to return a pixel value from the Tcl object "objPtr". If the
+ * object is not already a pixel value, an attempt will be made to
+ * convert it to one.
+ *
+ * Results:
+ * The return value is a standard Tcl object result. If an error occurs
+ * during conversion, an error message is left in the interpreter's
+ * result unless "interp" is NULL.
+ *
+ * Side effects:
+ * If the object is not already a pixel, the conversion will free any old
+ * internal representation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_GetPixelsFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr, /* The object from which to get pixels. */
+ int *intPtr) /* Place to store resulting pixels. */
+{
+ return GetPixelsFromObjEx(interp,tkwin,objPtr,intPtr,NULL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetDoublePixelsFromObj --
+ *
+ * Attempt to return a double pixel value from the Tcl object
+ * "objPtr". If the object is not already a pixel value, an attempt will
+ * be made to convert it to one, the internal unit being pixels.
+ *
+ * Results:
+ * The return value is a standard Tcl object result. If an error occurs
+ * during conversion, an error message is left in the interpreter's
+ * result unless "interp" is NULL.
+ *
+ * Side effects:
+ * If the object is not already a pixel, the conversion will free any old
+ * internal representation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_GetDoublePixelsFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr, /* The object from which to get pixels. */
+ double *doublePtr) /* Place to store resulting pixels. */
+{
+ double d;
+ int result,val;
+
+ result=GetPixelsFromObjEx(interp, tkwin, objPtr, &val, &d);
+ if (result != TCL_OK) {
+ return result;
+ }
+ if (objPtr->typePtr == &pixelObjType && !SIMPLE_PIXELREP(objPtr)) {
+ PixelRep *pixelPtr;
+ pixelPtr = GET_COMPLEXPIXEL(objPtr);
+ if (pixelPtr->units >= 0) {
+ /* internally "shimmer" to pixel units */
+ pixelPtr->units=-1;
+ pixelPtr->value=d;
}
- *intPtr = pixelPtr->returnValue;
}
+ *doublePtr = d;
return TCL_OK;
}
@@ -204,18 +361,18 @@ Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
* None.
*
* Side effects:
- * Frees objPtr's internal representation and sets objPtr's
- * internalRep to NULL.
+ * Frees objPtr's internal representation and sets objPtr's internalRep
+ * to NULL.
*
*----------------------------------------------------------------------
*/
static void
-FreePixelInternalRep(objPtr)
- Tcl_Obj *objPtr; /* Pixel object with internal rep to free. */
+FreePixelInternalRep(
+ Tcl_Obj *objPtr) /* Pixel object with internal rep to free. */
{
PixelRep *pixelPtr;
-
+
if (!SIMPLE_PIXELREP(objPtr)) {
pixelPtr = GET_COMPLEXPIXEL(objPtr);
ckfree((char *) pixelPtr);
@@ -229,26 +386,26 @@ FreePixelInternalRep(objPtr)
*
* DupPixelInternalRep --
*
- * Initialize the internal representation of a pixel Tcl_Obj to a
- * copy of the internal representation of an existing pixel object.
+ * Initialize the internal representation of a pixel Tcl_Obj to a copy of
+ * the internal representation of an existing pixel object.
*
* Results:
* None.
*
* Side effects:
- * copyPtr's internal rep is set to the pixel corresponding to
- * srcPtr's internal rep.
+ * copyPtr's internal rep is set to the pixel corresponding to srcPtr's
+ * internal rep.
*
*----------------------------------------------------------------------
*/
static void
-DupPixelInternalRep(srcPtr, copyPtr)
- register Tcl_Obj *srcPtr; /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr; /* Object with internal rep to set. */
+DupPixelInternalRep(
+ register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
PixelRep *oldPtr, *newPtr;
-
+
copyPtr->typePtr = srcPtr->typePtr;
if (SIMPLE_PIXELREP(srcPtr)) {
@@ -269,8 +426,7 @@ DupPixelInternalRep(srcPtr, copyPtr)
*
* SetPixelFromAny --
*
- * Attempt to generate a pixel internal form for the Tcl object
- * "objPtr".
+ * Attempt to generate a pixel internal form for the Tcl object "objPtr".
*
* Results:
* The return value is a standard Tcl result. If an error occurs during
@@ -278,70 +434,54 @@ DupPixelInternalRep(srcPtr, copyPtr)
* unless "interp" is NULL.
*
* Side effects:
- * If no error occurs, a pixel representation of the object is
- * stored internally and the type of "objPtr" is set to pixel.
+ * If no error occurs, a pixel representation of the object is stored
+ * internally and the type of "objPtr" is set to pixel.
*
*----------------------------------------------------------------------
*/
static int
-SetPixelFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr; /* The object to convert. */
+SetPixelFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ const Tcl_ObjType *typePtr;
char *string, *rest;
double d;
int i, units;
- PixelRep *pixelPtr;
string = Tcl_GetStringFromObj(objPtr, NULL);
d = strtod(string, &rest);
if (rest == string) {
- /*
- * Must copy string before resetting the result in case a caller
- * is trying to convert the interpreter's result to pixels.
- */
-
- char buf[100];
-
- error:
- sprintf(buf, "bad screen distance \"%.50s\"", string);
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, buf, NULL);
- return TCL_ERROR;
+ goto error;
}
while ((*rest != '\0') && isspace(UCHAR(*rest))) {
rest++;
}
- switch (*rest) {
- case '\0':
- units = -1;
- break;
-
- case 'm':
- units = 0;
- break;
- case 'c':
- units = 1;
- break;
-
- case 'i':
- units = 2;
- break;
-
- case 'p':
- units = 3;
- break;
-
- default:
- goto error;
+ switch (*rest) {
+ case '\0':
+ units = -1;
+ break;
+ case 'm':
+ units = 0;
+ break;
+ case 'c':
+ units = 1;
+ break;
+ case 'i':
+ units = 2;
+ break;
+ case 'p':
+ units = 3;
+ break;
+ default:
+ goto error;
}
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
typePtr = objPtr->typePtr;
@@ -355,7 +495,8 @@ SetPixelFromAny(interp, objPtr)
if ((units < 0) && (i == d)) {
SET_SIMPLEPIXEL(objPtr, i);
} else {
- pixelPtr = (PixelRep *) ckalloc(sizeof(PixelRep));
+ PixelRep *pixelPtr = (PixelRep *) ckalloc(sizeof(PixelRep));
+
pixelPtr->value = d;
pixelPtr->units = units;
pixelPtr->tkwin = NULL;
@@ -363,6 +504,21 @@ SetPixelFromAny(interp, objPtr)
SET_COMPLEXPIXEL(objPtr, pixelPtr);
}
return TCL_OK;
+
+ error:
+ if (interp != NULL) {
+ /*
+ * Must copy string before resetting the result in case a caller is
+ * trying to convert the interpreter's result to pixels.
+ */
+
+ char buf[100];
+
+ sprintf(buf, "bad screen distance \"%.50s\"", string);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, buf, NULL);
+ }
+ return TCL_ERROR;
}
/*
@@ -380,24 +536,24 @@ SetPixelFromAny(interp, objPtr)
* result unless "interp" is NULL.
*
* Side effects:
- * If the object is not already a pixel, the conversion will free
- * any old internal representation.
+ * If the object is not already a pixel, the conversion will free any old
+ * internal representation.
*
*----------------------------------------------------------------------
*/
int
-Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tk_Window tkwin;
- Tcl_Obj *objPtr; /* The object from which to get mms. */
- double *doublePtr; /* Place to store resulting millimeters. */
+Tk_GetMMFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr, /* The object from which to get mms. */
+ double *doublePtr) /* Place to store resulting millimeters. */
{
int result;
double d;
MMRep *mmPtr;
static double bias[] = {
- 10.0, 25.4, 1.0, 25.4 / 72.0
+ 10.0, 25.4, 1.0, 0.35278 /*25.4 / 72.0*/
};
if (objPtr->typePtr != &mmObjType) {
@@ -436,15 +592,15 @@ Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr)
* None.
*
* Side effects:
- * Frees objPtr's internal representation and sets objPtr's
- * internalRep to NULL.
+ * Frees objPtr's internal representation and sets objPtr's internalRep
+ * to NULL.
*
*----------------------------------------------------------------------
*/
static void
-FreeMMInternalRep(objPtr)
- Tcl_Obj *objPtr; /* MM object with internal rep to free. */
+FreeMMInternalRep(
+ Tcl_Obj *objPtr) /* MM object with internal rep to free. */
{
ckfree((char *) objPtr->internalRep.otherValuePtr);
objPtr->internalRep.otherValuePtr = NULL;
@@ -456,26 +612,26 @@ FreeMMInternalRep(objPtr)
*
* DupMMInternalRep --
*
- * Initialize the internal representation of a pixel Tcl_Obj to a
- * copy of the internal representation of an existing pixel object.
+ * Initialize the internal representation of a pixel Tcl_Obj to a copy of
+ * the internal representation of an existing pixel object.
*
* Results:
* None.
*
* Side effects:
- * copyPtr's internal rep is set to the pixel corresponding to
- * srcPtr's internal rep.
+ * copyPtr's internal rep is set to the pixel corresponding to srcPtr's
+ * internal rep.
*
*----------------------------------------------------------------------
*/
static void
-DupMMInternalRep(srcPtr, copyPtr)
- register Tcl_Obj *srcPtr; /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr; /* Object with internal rep to set. */
+DupMMInternalRep(
+ register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
MMRep *oldPtr, *newPtr;
-
+
copyPtr->typePtr = srcPtr->typePtr;
oldPtr = (MMRep *) srcPtr->internalRep.otherValuePtr;
newPtr = (MMRep *) ckalloc(sizeof(MMRep));
@@ -491,24 +647,23 @@ DupMMInternalRep(srcPtr, copyPtr)
*
* UpdateStringOfMM --
*
- * Update the string representation for a pixel Tcl_Obj
- * this function is only called, if the pixel Tcl_Obj has no unit,
- * because with units the string representation is created by
- * SetMMFromAny
+ * Update the string representation for a pixel Tcl_Obj this function is
+ * only called, if the pixel Tcl_Obj has no unit, because with units the
+ * string representation is created by SetMMFromAny
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The object's string is set to a valid string that results from
- * the double-to-string conversion.
+ * The object's string is set to a valid string that results from the
+ * double-to-string conversion.
*
*----------------------------------------------------------------------
*/
static void
-UpdateStringOfMM(objPtr)
- register Tcl_Obj *objPtr; /* pixel obj with string rep to update. */
+UpdateStringOfMM(
+ register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */
{
MMRep *mmPtr;
char buffer[TCL_DOUBLE_SPACE];
@@ -517,11 +672,11 @@ UpdateStringOfMM(objPtr)
mmPtr = (MMRep *) objPtr->internalRep.otherValuePtr;
/* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */
if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) {
- panic("UpdateStringOfMM: false precondition");
+ Tcl_Panic("UpdateStringOfMM: false precondition");
}
- Tcl_PrintDouble((Tcl_Interp *) NULL, mmPtr->value, buffer);
- len = strlen(buffer);
+ Tcl_PrintDouble(NULL, mmPtr->value, buffer);
+ len = (int)strlen(buffer);
objPtr->bytes = (char *) ckalloc((unsigned) len + 1);
strcpy(objPtr->bytes, buffer);
@@ -533,8 +688,7 @@ UpdateStringOfMM(objPtr)
*
* SetMMFromAny --
*
- * Attempt to generate a mm internal form for the Tcl object
- * "objPtr".
+ * Attempt to generate a mm internal form for the Tcl object "objPtr".
*
* Results:
* The return value is a standard Tcl result. If an error occurs during
@@ -542,49 +696,38 @@ UpdateStringOfMM(objPtr)
* unless "interp" is NULL.
*
* Side effects:
- * If no error occurs, a mm representation of the object is
- * stored internally and the type of "objPtr" is set to mm.
+ * If no error occurs, a mm representation of the object is stored
+ * internally and the type of "objPtr" is set to mm.
*
*----------------------------------------------------------------------
*/
static int
-SetMMFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr; /* The object to convert. */
+SetMMFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ ThreadSpecificData *tsdPtr = GetTypeCache();
+ const Tcl_ObjType *typePtr;
char *string, *rest;
double d;
int units;
MMRep *mmPtr;
- static Tcl_ObjType *tclDoubleObjType = NULL;
- static Tcl_ObjType *tclIntObjType = NULL;
-
- if (tclDoubleObjType == NULL) {
- /*
- * Cache the object types for comaprison below.
- * This allows optimized checks for standard cases.
- */
-
- tclDoubleObjType = Tcl_GetObjType("double");
- tclIntObjType = Tcl_GetObjType("int");
- }
-
- if (objPtr->typePtr == tclDoubleObjType) {
+ if (objPtr->typePtr == tsdPtr->doubleTypePtr) {
Tcl_GetDoubleFromObj(interp, objPtr, &d);
units = -1;
- } else if (objPtr->typePtr == tclIntObjType) {
+ } else if (objPtr->typePtr == tsdPtr->intTypePtr) {
Tcl_GetIntFromObj(interp, objPtr, &units);
d = (double) units;
units = -1;
/*
- * In the case of ints, we need to ensure that a valid
- * string exists in order for int-but-not-string objects
- * to be converted back to ints again from mm obj types.
+ * In the case of ints, we need to ensure that a valid string exists
+ * in order for int-but-not-string objects to be converted back to
+ * ints again from mm obj types.
*/
+
(void) Tcl_GetStringFromObj(objPtr, NULL);
} else {
/*
@@ -600,42 +743,38 @@ SetMMFromAny(interp, objPtr)
* is trying to convert the interpreter's result to mms.
*/
- error:
- Tcl_AppendResult(interp, "bad screen distance \"", string,
- "\"", (char *) NULL);
- return TCL_ERROR;
- }
- while ((*rest != '\0') && isspace(UCHAR(*rest))) {
- rest++;
- }
- switch (*rest) {
- case '\0':
- units = -1;
- break;
-
- case 'c':
- units = 0;
- break;
-
- case 'i':
- units = 1;
- break;
-
- case 'm':
- units = 2;
- break;
-
- case 'p':
- units = 3;
- break;
-
- default:
- goto error;
+ error:
+ Tcl_AppendResult(interp, "bad screen distance \"", string,
+ "\"", NULL);
+ return TCL_ERROR;
+ }
+ while ((*rest != '\0') && isspace(UCHAR(*rest))) {
+ rest++;
+ }
+
+ switch (*rest) {
+ case '\0':
+ units = -1;
+ break;
+ case 'c':
+ units = 0;
+ break;
+ case 'i':
+ units = 1;
+ break;
+ case 'm':
+ units = 2;
+ break;
+ case 'p':
+ units = 3;
+ break;
+ default:
+ goto error;
}
}
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
typePtr = objPtr->typePtr;
@@ -671,18 +810,18 @@ SetMMFromAny(interp, objPtr)
* result unless "interp" is NULL.
*
* Side effects:
- * If the object is not already a Tk_Window, the conversion will free
- * any old internal representation.
+ * If the object is not already a Tk_Window, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
int
-TkGetWindowFromObj(interp, tkwin, objPtr, windowPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tk_Window tkwin; /* A token to get the main window from. */
- Tcl_Obj *objPtr; /* The object from which to get window. */
- Tk_Window *windowPtr; /* Place to store resulting window. */
+TkGetWindowFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin, /* A token to get the main window from. */
+ Tcl_Obj *objPtr, /* The object from which to get window. */
+ Tk_Window *windowPtr) /* Place to store resulting window. */
{
TkMainInfo *mainPtr = ((TkWindow *)tkwin)->mainPtr;
register WindowRep *winPtr;
@@ -696,8 +835,8 @@ TkGetWindowFromObj(interp, tkwin, objPtr, windowPtr)
winPtr = (WindowRep *) objPtr->internalRep.otherValuePtr;
if ( winPtr->tkwin == NULL
|| winPtr->mainPtr == NULL
- || winPtr->mainPtr != mainPtr
- || winPtr->epoch != mainPtr->deletionEpoch)
+ || winPtr->mainPtr != mainPtr
+ || winPtr->epoch != mainPtr->deletionEpoch)
{
/* Cache is invalid.
*/
@@ -720,14 +859,15 @@ TkGetWindowFromObj(interp, tkwin, objPtr, windowPtr)
*----------------------------------------------------------------------
*
* SetWindowFromAny --
+ *
* Generate a windowObj internal form for the Tcl object "objPtr".
*
* Results:
- * Always returns TCL_OK.
+ * Always returns TCL_OK.
*
* Side effects:
- * Sets objPtr's internal representation to an uninitialized
- * windowObj. Frees the old internal representation, if any.
+ * Sets objPtr's internal representation to an uninitialized windowObj.
+ * Frees the old internal representation, if any.
*
* See also:
* TkGetWindowFromObj, which initializes the WindowRep cache.
@@ -736,15 +876,15 @@ TkGetWindowFromObj(interp, tkwin, objPtr, windowPtr)
*/
static int
-SetWindowFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- register Tcl_Obj *objPtr; /* The object to convert. */
+SetWindowFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ register Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
+ const Tcl_ObjType *typePtr;
WindowRep *winPtr;
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
Tcl_GetStringFromObj(objPtr, NULL);
@@ -769,23 +909,23 @@ SetWindowFromAny(interp, objPtr)
*
* DupWindowInternalRep --
*
- * Initialize the internal representation of a window Tcl_Obj to a
- * copy of the internal representation of an existing window object.
+ * Initialize the internal representation of a window Tcl_Obj to a copy
+ * of the internal representation of an existing window object.
*
* Results:
* None.
*
* Side effects:
- * copyPtr's internal rep is set to refer to the same window as
- * srcPtr's internal rep.
+ * copyPtr's internal rep is set to refer to the same window as srcPtr's
+ * internal rep.
*
*----------------------------------------------------------------------
*/
static void
-DupWindowInternalRep(srcPtr, copyPtr)
- register Tcl_Obj *srcPtr;
- register Tcl_Obj *copyPtr;
+DupWindowInternalRep(
+ register Tcl_Obj *srcPtr,
+ register Tcl_Obj *copyPtr)
{
register WindowRep *oldPtr, *newPtr;
@@ -810,15 +950,15 @@ DupWindowInternalRep(srcPtr, copyPtr)
* None.
*
* Side effects:
- * Frees objPtr's internal representation and sets objPtr's
- * internalRep to NULL.
+ * Frees objPtr's internal representation and sets objPtr's internalRep
+ * to NULL.
*
*----------------------------------------------------------------------
*/
static void
-FreeWindowInternalRep(objPtr)
- Tcl_Obj *objPtr; /* Window object with internal rep to free. */
+FreeWindowInternalRep(
+ Tcl_Obj *objPtr) /* Window object with internal rep to free. */
{
ckfree((char *) objPtr->internalRep.otherValuePtr);
objPtr->internalRep.otherValuePtr = NULL;
@@ -830,31 +970,31 @@ FreeWindowInternalRep(objPtr)
*
* TkParsePadAmount --
*
- * This procedure parses a padding specification and returns
- * the appropriate padding values. A padding specification can
- * be either a single pixel width, or a list of two pixel widths.
- * If a single pixel width, the amount specified is used for
- * padding on both sides. If two amounts are specified, then
- * they specify the left/right or top/bottom padding.
+ * This function parses a padding specification and returns the
+ * appropriate padding values. A padding specification can be either a
+ * single pixel width, or a list of two pixel widths. If a single pixel
+ * width, the amount specified is used for padding on both sides. If two
+ * amounts are specified, then they specify the left/right or top/bottom
+ * padding.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * An error message is written to the interpreter is something
- * is not right.
+ * An error message is written to the interpreter if something is not
+ * right.
*
*--------------------------------------------------------------
*/
int
-TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* A window. Needed by Tk_GetPixels() */
- Tcl_Obj *specObj; /* The argument to "-padx", "-pady", "-ipadx",
- * or "-ipady". The thing to be parsed. */
- int *halfPtr; /* Write the left/top part of padding here */
- int *allPtr; /* Write the total padding here */
+TkParsePadAmount(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* A window. Needed by Tk_GetPixels() */
+ Tcl_Obj *specObj, /* The argument to "-padx", "-pady", "-ipadx",
+ * or "-ipady". The thing to be parsed. */
+ int *halfPtr, /* Write the left/top part of padding here */
+ int *allPtr) /* Write the total padding here */
{
int firstInt, secondInt; /* The two components of the padding */
int objc; /* The length of the list (should be 1 or 2) */
@@ -870,7 +1010,7 @@ TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad pad value \"",
Tcl_GetString(specObj),
- "\": must be positive screen distance", (char *) NULL);
+ "\": must be positive screen distance", NULL);
return TCL_ERROR;
}
secondInt = firstInt;
@@ -878,8 +1018,8 @@ TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
}
/*
- * Pad specifications are a list of one or two elements, each of
- * which is a pixel specification.
+ * Pad specifications are a list of one or two elements, each of which is
+ * a pixel specification.
*/
if (Tcl_ListObjGetElements(interp, specObj, &objc, &objv) != TCL_OK) {
@@ -899,13 +1039,13 @@ TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
(firstInt < 0)) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad pad value \"", Tcl_GetString(objv[0]),
- "\": must be positive screen distance", (char *) NULL);
+ "\": must be positive screen distance", NULL);
return TCL_ERROR;
}
/*
- * Parse the second part if it exists, otherwise it is as if it
- * was the same as the first part.
+ * Parse the second part if it exists, otherwise it is as if it was the
+ * same as the first part.
*/
if (objc == 1) {
@@ -915,7 +1055,7 @@ TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad 2nd pad value \"",
Tcl_GetString(objv[1]),
- "\": must be positive screen distance", (char *) NULL);
+ "\": must be positive screen distance", NULL);
return TCL_ERROR;
}
@@ -942,14 +1082,14 @@ TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
* None
*
* Side effects:
- * All instances of Tcl_ObjType structues used in Tk are registered
- * with Tcl.
+ * All instances of Tcl_ObjType structues used in Tk are registered with
+ * Tcl.
*
*----------------------------------------------------------------------
*/
void
-TkRegisterObjTypes()
+TkRegisterObjTypes(void)
{
Tcl_RegisterObjType(&tkBorderObjType);
Tcl_RegisterObjType(&tkBitmapObjType);
@@ -961,4 +1101,13 @@ TkRegisterObjTypes()
Tcl_RegisterObjType(&pixelObjType);
Tcl_RegisterObjType(&tkStateKeyObjType);
Tcl_RegisterObjType(&windowObjType);
+ Tcl_RegisterObjType(&tkTextIndexType);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index bbb673f..97ad5cb 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -1,106 +1,101 @@
-/*
+/*
* tkOldConfig.c --
*
- * This file contains the Tk_ConfigureWidget procedure. THIS FILE
- * IS HERE FOR BACKWARD COMPATIBILITY; THE NEW CONFIGURATION
- * PACKAGE SHOULD BE USED FOR NEW PROJECTS.
+ * This file contains the Tk_ConfigureWidget function. THIS FILE IS HERE
+ * FOR BACKWARD COMPATIBILITY; THE NEW CONFIGURATION PACKAGE SHOULD BE
+ * USED FOR NEW PROJECTS.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkPort.h"
-#include "tk.h"
/*
- * Values for "flags" field of Tk_ConfigSpec structures. Be sure
- * to coordinate these values with those defined in tk.h
- * (TK_CONFIG_COLOR_ONLY, etc.). There must not be overlap!
+ * Values for "flags" field of Tk_ConfigSpec structures. Be sure to coordinate
+ * these values with those defined in tk.h (TK_CONFIG_COLOR_ONLY, etc.) There
+ * must not be overlap!
*
- * INIT - Non-zero means (char *) things have been
- * converted to Tk_Uid's.
+ * INIT - Non-zero means (char *) things have been converted to
+ * Tk_Uid's.
*/
#define INIT 0x20
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int DoConfig _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_ConfigSpec *specPtr,
- Tk_Uid value, int valueIsUid, char *widgRec));
-static Tk_ConfigSpec * FindConfigSpec _ANSI_ARGS_((Tcl_Interp *interp,
+static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_ConfigSpec *specPtr, Tk_Uid value,
+ int valueIsUid, char *widgRec);
+static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp,
Tk_ConfigSpec *specs, CONST char *argvName,
- int needFlags, int hateFlags));
-static char * FormatConfigInfo _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_ConfigSpec *specPtr,
- char *widgRec));
-static CONST char * FormatConfigValue _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_ConfigSpec *specPtr,
- char *widgRec, char *buffer,
- Tcl_FreeProc **freeProcPtr));
-static Tk_ConfigSpec * GetCachedSpecs _ANSI_ARGS_((Tcl_Interp *interp,
- const Tk_ConfigSpec *staticSpecs));
-static void DeleteSpecCacheTable _ANSI_ARGS_((
- ClientData clientData, Tcl_Interp *interp));
+ int needFlags, int hateFlags);
+static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_ConfigSpec *specPtr, char *widgRec);
+static CONST char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_ConfigSpec *specPtr, char *widgRec,
+ char *buffer, Tcl_FreeProc **freeProcPtr);
+static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp,
+ const Tk_ConfigSpec *staticSpecs);
+static void DeleteSpecCacheTable(ClientData clientData,
+ Tcl_Interp *interp);
/*
*--------------------------------------------------------------
*
* Tk_ConfigureWidget --
*
- * Process command-line options and database options to
- * fill in fields of a widget record with resources and
- * other parameters.
+ * Process command-line options and database options to fill in fields of
+ * a widget record with resources and other parameters.
*
* Results:
- * A standard Tcl return value. In case of an error,
- * the interp's result will hold an error message.
+ * A standard Tcl return value. In case of an error, the interp's result
+ * will hold an error message.
*
* Side effects:
- * The fields of widgRec get filled in with information from
- * argc/argv and the option database. Old information in
- * widgRec's fields gets recycled. A copy of the spec-table is
- * taken with (some of) the char* *fields converted into Tk_Uid
- * fields; this copy will be released when *the interpreter
- * terminates.
+ * The fields of widgRec get filled in with information from argc/argv
+ * and the option database. Old information in widgRec's fields gets
+ * recycled. A copy of the spec-table is taken with (some of) the char*
+ * fields converted into Tk_Uid fields; this copy will be released when
+ * the interpreter terminates.
*
*--------------------------------------------------------------
*/
int
-Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* Window containing widget (needed to
- * set up X resources). */
- Tk_ConfigSpec *origSpecs; /* Describes legal options. */
- int argc; /* Number of elements in argv. */
- CONST char **argv; /* Command-line options. */
- char *widgRec; /* Record whose fields are to be
- * modified. Values must be properly
- * initialized. */
- int flags; /* Used to specify additional flags
- * that must be present in config specs
- * for them to be considered. Also,
- * may have TK_CONFIG_ARGV_ONLY set. */
+Tk_ConfigureWidget(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* Window containing widget (needed to set up
+ * X resources). */
+ Tk_ConfigSpec *specs, /* Describes legal options. */
+ int argc, /* Number of elements in argv. */
+ CONST char **argv, /* Command-line options. */
+ char *widgRec, /* Record whose fields are to be modified.
+ * Values must be properly initialized. */
+ int flags) /* Used to specify additional flags that must
+ * be present in config specs for them to be
+ * considered. Also, may have
+ * TK_CONFIG_ARGV_ONLY set. */
{
- register Tk_ConfigSpec *specs, *specPtr, *origSpecPtr;
+ register Tk_ConfigSpec *specPtr;
Tk_Uid value; /* Value of option from database. */
- int needFlags; /* Specs must contain this set of flags
- * or else they are not considered. */
- int hateFlags; /* If a spec contains any bits here, it's
- * not considered. */
+ int needFlags; /* Specs must contain this set of flags or
+ * else they are not considered. */
+ int hateFlags; /* If a spec contains any bits here, it's not
+ * considered. */
if (tkwin == NULL) {
/*
* Either we're not really in Tk, or the main window was destroyed and
* we're on our way out of the application
*/
- Tcl_AppendResult(interp, "NULL main window", (char *)NULL);
+
+ Tcl_AppendResult(interp, "NULL main window", NULL);
return TCL_ERROR;
}
@@ -112,19 +107,14 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags)
}
/*
- * Get the build of the config for this interpreter and reset any
- * indication of changed options.
+ * Get the build of the config for this interpreter.
*/
- specs = GetCachedSpecs(interp, origSpecs);
-
- for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) {
- specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED;
- }
+ specs = GetCachedSpecs(interp, specs);
/*
- * Pass one: scan through all of the arguments, processing those
- * that match entries in the specs.
+ * Pass one: scan through all of the arguments, processing those that
+ * match entries in the specs.
*/
for ( ; argc > 0; argc -= 2, argv += 2) {
@@ -145,8 +135,7 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags)
*/
if (argc < 2) {
- Tcl_AppendResult(interp, "value for \"", arg,
- "\" missing", (char *) NULL);
+ Tcl_AppendResult(interp, "value for \"", arg, "\" missing", NULL);
return TCL_ERROR;
}
if (flags & TK_CONFIG_OBJS) {
@@ -162,25 +151,15 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags)
Tcl_AddErrorInfo(interp, msg);
return TCL_ERROR;
}
- specPtr->specFlags |= TK_CONFIG_OPTION_SPECIFIED;
- }
-
- /*
- * Thread Unsafe! For compatibility through 8.4.x, we set the original
- * specPtr flags to indicate changed options. This has been removed
- * from 8.5. Switch to Tcl_Obj-based options instead. [Bug 749908]
- */
-
- for (origSpecPtr = origSpecs, specPtr = specs;
- specPtr->type != TK_CONFIG_END; origSpecPtr++, specPtr++) {
- origSpecPtr->specFlags = specPtr->specFlags;
+ if (!(flags & TK_CONFIG_ARGV_ONLY)) {
+ specPtr->specFlags |= TK_CONFIG_OPTION_SPECIFIED;
+ }
}
/*
- * Pass two: scan through all of the specs again; if no
- * command-line argument matched a spec, then check for info
- * in the option database. If there was nothing in the
- * database, then use the default.
+ * Pass two: scan through all of the specs again; if no command-line
+ * argument matched a spec, then check for info in the option database.
+ * If there was nothing in the database, then use the default.
*/
if (!(flags & TK_CONFIG_ARGV_ONLY)) {
@@ -188,6 +167,7 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags)
if ((specPtr->specFlags & TK_CONFIG_OPTION_SPECIFIED)
|| (specPtr->argvName == NULL)
|| (specPtr->type == TK_CONFIG_SYNONYM)) {
+ specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED;
continue;
}
if (((specPtr->specFlags & needFlags) != needFlags)
@@ -241,13 +221,13 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags)
*
* FindConfigSpec --
*
- * Search through a table of configuration specs, looking for
- * one that matches a given argvName.
+ * Search through a table of configuration specs, looking for one that
+ * matches a given argvName.
*
* Results:
- * The return value is a pointer to the matching entry, or NULL
- * if nothing matched. In that case an error message is left
- * in the interp's result.
+ * The return value is a pointer to the matching entry, or NULL if
+ * nothing matched. In that case an error message is left in the interp's
+ * result.
*
* Side effects:
* None.
@@ -256,16 +236,16 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags)
*/
static Tk_ConfigSpec *
-FindConfigSpec(interp, specs, argvName, needFlags, hateFlags)
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_ConfigSpec *specs; /* Pointer to table of configuration
+FindConfigSpec(
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_ConfigSpec *specs, /* Pointer to table of configuration
* specifications for a widget. */
- CONST char *argvName; /* Name (suitable for use in a "config"
+ CONST char *argvName, /* Name (suitable for use in a "config"
* command) identifying particular option. */
- int needFlags; /* Flags that must be present in matching
+ int needFlags, /* Flags that must be present in matching
+ * entry. */
+ int hateFlags) /* Flags that must NOT be present in matching
* entry. */
- int hateFlags; /* Flags that must NOT be present in
- * matching entry. */
{
register Tk_ConfigSpec *specPtr;
register char c; /* First character of current argument. */
@@ -293,34 +273,32 @@ FindConfigSpec(interp, specs, argvName, needFlags, hateFlags)
}
if (matchPtr != NULL) {
Tcl_AppendResult(interp, "ambiguous option \"", argvName,
- "\"", (char *) NULL);
- return (Tk_ConfigSpec *) NULL;
+ "\"", NULL);
+ return NULL;
}
matchPtr = specPtr;
}
if (matchPtr == NULL) {
- Tcl_AppendResult(interp, "unknown option \"", argvName,
- "\"", (char *) NULL);
- return (Tk_ConfigSpec *) NULL;
+ Tcl_AppendResult(interp, "unknown option \"", argvName, "\"", NULL);
+ return NULL;
}
/*
- * Found a matching entry. If it's a synonym, then find the
- * entry that it's a synonym for.
+ * Found a matching entry. If it's a synonym, then find the entry that
+ * it's a synonym for.
*/
- gotMatch:
+ gotMatch:
specPtr = matchPtr;
if (specPtr->type == TK_CONFIG_SYNONYM) {
for (specPtr = specs; ; specPtr++) {
if (specPtr->type == TK_CONFIG_END) {
- Tcl_AppendResult(interp,
- "couldn't find synonym for option \"",
- argvName, "\"", (char *) NULL);
- return (Tk_ConfigSpec *) NULL;
+ Tcl_AppendResult(interp, "couldn't find synonym for option \"",
+ argvName, "\"", NULL);
+ return NULL;
}
- if ((specPtr->dbName == matchPtr->dbName)
+ if ((specPtr->dbName == matchPtr->dbName)
&& (specPtr->type != TK_CONFIG_SYNONYM)
&& ((specPtr->specFlags & needFlags) == needFlags)
&& !(specPtr->specFlags & hateFlags)) {
@@ -336,32 +314,30 @@ FindConfigSpec(interp, specs, argvName, needFlags, hateFlags)
*
* DoConfig --
*
- * This procedure applies a single configuration option
- * to a widget record.
+ * This function applies a single configuration option to a widget
+ * record.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * WidgRec is modified as indicated by specPtr and value.
- * The old value is recycled, if that is appropriate for
- * the value type.
+ * WidgRec is modified as indicated by specPtr and value. The old value
+ * is recycled, if that is appropriate for the value type.
*
*--------------------------------------------------------------
*/
static int
-DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* Window containing widget (needed to
- * set up X resources). */
- Tk_ConfigSpec *specPtr; /* Specifier to apply. */
- Tk_Uid value; /* Value to use to fill in widgRec. */
- int valueIsUid; /* Non-zero means value is a Tk_Uid;
- * zero means it's an ordinary string. */
- char *widgRec; /* Record whose fields are to be
- * modified. Values must be properly
- * initialized. */
+DoConfig(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* Window containing widget (needed to set up
+ * X resources). */
+ Tk_ConfigSpec *specPtr, /* Specifier to apply. */
+ Tk_Uid value, /* Value to use to fill in widgRec. */
+ int valueIsUid, /* Non-zero means value is a Tk_Uid; zero
+ * means it's an ordinary string. */
+ char *widgRec) /* Record whose fields are to be modified.
+ * Values must be properly initialized. */
{
char *ptr;
Tk_Uid uid;
@@ -375,211 +351,209 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
do {
ptr = widgRec + specPtr->offset;
switch (specPtr->type) {
- case TK_CONFIG_BOOLEAN:
- if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) {
- return TCL_ERROR;
- }
- break;
- case TK_CONFIG_INT:
- if (Tcl_GetInt(interp, value, (int *) ptr) != TCL_OK) {
- return TCL_ERROR;
- }
- break;
- case TK_CONFIG_DOUBLE:
- if (Tcl_GetDouble(interp, value, (double *) ptr) != TCL_OK) {
- return TCL_ERROR;
- }
- break;
- case TK_CONFIG_STRING: {
- char *old, *new;
-
- if (nullValue) {
- new = NULL;
- } else {
- new = (char *) ckalloc((unsigned) (strlen(value) + 1));
- strcpy(new, value);
- }
- old = *((char **) ptr);
- if (old != NULL) {
- ckfree(old);
- }
- *((char **) ptr) = new;
- break;
+ case TK_CONFIG_BOOLEAN:
+ if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) {
+ return TCL_ERROR;
}
- case TK_CONFIG_UID:
- if (nullValue) {
- *((Tk_Uid *) ptr) = NULL;
- } else {
- uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- *((Tk_Uid *) ptr) = uid;
- }
- break;
- case TK_CONFIG_COLOR: {
- XColor *newPtr, *oldPtr;
-
- if (nullValue) {
- newPtr = NULL;
- } else {
- uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- newPtr = Tk_GetColor(interp, tkwin, uid);
- if (newPtr == NULL) {
- return TCL_ERROR;
- }
- }
- oldPtr = *((XColor **) ptr);
- if (oldPtr != NULL) {
- Tk_FreeColor(oldPtr);
- }
- *((XColor **) ptr) = newPtr;
- break;
+ break;
+ case TK_CONFIG_INT:
+ if (Tcl_GetInt(interp, value, (int *) ptr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_DOUBLE:
+ if (Tcl_GetDouble(interp, value, (double *) ptr) != TCL_OK) {
+ return TCL_ERROR;
}
- case TK_CONFIG_FONT: {
- Tk_Font new;
+ break;
+ case TK_CONFIG_STRING: {
+ char *oldStr, *newStr;
- if (nullValue) {
- new = NULL;
- } else {
- new = Tk_GetFont(interp, tkwin, value);
- if (new == NULL) {
- return TCL_ERROR;
- }
- }
- Tk_FreeFont(*((Tk_Font *) ptr));
- *((Tk_Font *) ptr) = new;
- break;
+ if (nullValue) {
+ newStr = NULL;
+ } else {
+ newStr = (char *) ckalloc((unsigned) (strlen(value) + 1));
+ strcpy(newStr, value);
}
- case TK_CONFIG_BITMAP: {
- Pixmap new, old;
-
- if (nullValue) {
- new = None;
- } else {
- uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- new = Tk_GetBitmap(interp, tkwin, uid);
- if (new == None) {
- return TCL_ERROR;
- }
- }
- old = *((Pixmap *) ptr);
- if (old != None) {
- Tk_FreeBitmap(Tk_Display(tkwin), old);
- }
- *((Pixmap *) ptr) = new;
- break;
+ oldStr = *((char **) ptr);
+ if (oldStr != NULL) {
+ ckfree(oldStr);
}
- case TK_CONFIG_BORDER: {
- Tk_3DBorder new, old;
-
- if (nullValue) {
- new = NULL;
- } else {
- uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- new = Tk_Get3DBorder(interp, tkwin, uid);
- if (new == NULL) {
- return TCL_ERROR;
- }
- }
- old = *((Tk_3DBorder *) ptr);
- if (old != NULL) {
- Tk_Free3DBorder(old);
- }
- *((Tk_3DBorder *) ptr) = new;
- break;
+ *((char **) ptr) = newStr;
+ break;
+ }
+ case TK_CONFIG_UID:
+ if (nullValue) {
+ *((Tk_Uid *) ptr) = NULL;
+ } else {
+ uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
+ *((Tk_Uid *) ptr) = uid;
}
- case TK_CONFIG_RELIEF:
+ break;
+ case TK_CONFIG_COLOR: {
+ XColor *newPtr, *oldPtr;
+
+ if (nullValue) {
+ newPtr = NULL;
+ } else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetRelief(interp, uid, (int *) ptr) != TCL_OK) {
+ newPtr = Tk_GetColor(interp, tkwin, uid);
+ if (newPtr == NULL) {
return TCL_ERROR;
}
- break;
- case TK_CONFIG_CURSOR:
- case TK_CONFIG_ACTIVE_CURSOR: {
- Tk_Cursor new, old;
-
- if (nullValue) {
- new = None;
- } else {
- uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- new = Tk_GetCursor(interp, tkwin, uid);
- if (new == None) {
- return TCL_ERROR;
- }
- }
- old = *((Tk_Cursor *) ptr);
- if (old != None) {
- Tk_FreeCursor(Tk_Display(tkwin), old);
- }
- *((Tk_Cursor *) ptr) = new;
- if (specPtr->type == TK_CONFIG_ACTIVE_CURSOR) {
- Tk_DefineCursor(tkwin, new);
- }
- break;
}
- case TK_CONFIG_JUSTIFY:
- uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetJustify(interp, uid, (Tk_Justify *) ptr) != TCL_OK) {
+ oldPtr = *((XColor **) ptr);
+ if (oldPtr != NULL) {
+ Tk_FreeColor(oldPtr);
+ }
+ *((XColor **) ptr) = newPtr;
+ break;
+ }
+ case TK_CONFIG_FONT: {
+ Tk_Font newFont;
+
+ if (nullValue) {
+ newFont = NULL;
+ } else {
+ newFont = Tk_GetFont(interp, tkwin, value);
+ if (newFont == NULL) {
return TCL_ERROR;
}
- break;
- case TK_CONFIG_ANCHOR:
+ }
+ Tk_FreeFont(*((Tk_Font *) ptr));
+ *((Tk_Font *) ptr) = newFont;
+ break;
+ }
+ case TK_CONFIG_BITMAP: {
+ Pixmap newBmp, oldBmp;
+
+ if (nullValue) {
+ newBmp = None;
+ } else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetAnchor(interp, uid, (Tk_Anchor *) ptr) != TCL_OK) {
+ newBmp = Tk_GetBitmap(interp, tkwin, uid);
+ if (newBmp == None) {
return TCL_ERROR;
}
- break;
- case TK_CONFIG_CAP_STYLE:
+ }
+ oldBmp = *((Pixmap *) ptr);
+ if (oldBmp != None) {
+ Tk_FreeBitmap(Tk_Display(tkwin), oldBmp);
+ }
+ *((Pixmap *) ptr) = newBmp;
+ break;
+ }
+ case TK_CONFIG_BORDER: {
+ Tk_3DBorder newBorder, oldBorder;
+
+ if (nullValue) {
+ newBorder = NULL;
+ } else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetCapStyle(interp, uid, (int *) ptr) != TCL_OK) {
+ newBorder = Tk_Get3DBorder(interp, tkwin, uid);
+ if (newBorder == NULL) {
return TCL_ERROR;
}
- break;
- case TK_CONFIG_JOIN_STYLE:
+ }
+ oldBorder = *((Tk_3DBorder *) ptr);
+ if (oldBorder != NULL) {
+ Tk_Free3DBorder(oldBorder);
+ }
+ *((Tk_3DBorder *) ptr) = newBorder;
+ break;
+ }
+ case TK_CONFIG_RELIEF:
+ uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
+ if (Tk_GetRelief(interp, uid, (int *) ptr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_CURSOR:
+ case TK_CONFIG_ACTIVE_CURSOR: {
+ Tk_Cursor newCursor, oldCursor;
+
+ if (nullValue) {
+ newCursor = None;
+ } else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetJoinStyle(interp, uid, (int *) ptr) != TCL_OK) {
- return TCL_ERROR;
- }
- break;
- case TK_CONFIG_PIXELS:
- if (Tk_GetPixels(interp, tkwin, value, (int *) ptr)
- != TCL_OK) {
- return TCL_ERROR;
- }
- break;
- case TK_CONFIG_MM:
- if (Tk_GetScreenMM(interp, tkwin, value, (double *) ptr)
- != TCL_OK) {
+ newCursor = Tk_GetCursor(interp, tkwin, uid);
+ if (newCursor == None) {
return TCL_ERROR;
}
- break;
- case TK_CONFIG_WINDOW: {
- Tk_Window tkwin2;
-
- if (nullValue) {
- tkwin2 = NULL;
- } else {
- tkwin2 = Tk_NameToWindow(interp, value, tkwin);
- if (tkwin2 == NULL) {
- return TCL_ERROR;
- }
- }
- *((Tk_Window *) ptr) = tkwin2;
- break;
}
- case TK_CONFIG_CUSTOM:
- if ((*specPtr->customPtr->parseProc)(
- specPtr->customPtr->clientData, interp, tkwin,
- value, widgRec, specPtr->offset) != TCL_OK) {
+ oldCursor = *((Tk_Cursor *) ptr);
+ if (oldCursor != None) {
+ Tk_FreeCursor(Tk_Display(tkwin), oldCursor);
+ }
+ *((Tk_Cursor *) ptr) = newCursor;
+ if (specPtr->type == TK_CONFIG_ACTIVE_CURSOR) {
+ Tk_DefineCursor(tkwin, newCursor);
+ }
+ break;
+ }
+ case TK_CONFIG_JUSTIFY:
+ uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
+ if (Tk_GetJustify(interp, uid, (Tk_Justify *) ptr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_ANCHOR:
+ uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
+ if (Tk_GetAnchor(interp, uid, (Tk_Anchor *) ptr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_CAP_STYLE:
+ uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
+ if (Tk_GetCapStyle(interp, uid, (int *) ptr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_JOIN_STYLE:
+ uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
+ if (Tk_GetJoinStyle(interp, uid, (int *) ptr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_PIXELS:
+ if (Tk_GetPixels(interp, tkwin, value, (int *) ptr)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_MM:
+ if (Tk_GetScreenMM(interp, tkwin, value, (double*)ptr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case TK_CONFIG_WINDOW: {
+ Tk_Window tkwin2;
+
+ if (nullValue) {
+ tkwin2 = NULL;
+ } else {
+ tkwin2 = Tk_NameToWindow(interp, value, tkwin);
+ if (tkwin2 == NULL) {
return TCL_ERROR;
}
- break;
- default: {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "bad config table: unknown type %d",
- specPtr->type);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ }
+ *((Tk_Window *) ptr) = tkwin2;
+ break;
+ }
+ case TK_CONFIG_CUSTOM:
+ if ((*specPtr->customPtr->parseProc)(
+ specPtr->customPtr->clientData, interp, tkwin, value,
+ widgRec, specPtr->offset) != TCL_OK) {
return TCL_ERROR;
}
+ break;
+ default: {
+ char buf[64 + TCL_INTEGER_SPACE];
+
+ sprintf(buf, "bad config table: unknown type %d", specPtr->type);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
}
specPtr++;
} while ((specPtr->argvName == NULL) && (specPtr->type != TK_CONFIG_END));
@@ -591,24 +565,22 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
*
* Tk_ConfigureInfo --
*
- * Return information about the configuration options
- * for a window, and their current values.
+ * Return information about the configuration options for a window, and
+ * their current values.
*
* Results:
- * Always returns TCL_OK. The interp's result will be modified
- * hold a description of either a single configuration option
- * available for "widgRec" via "specs", or all the configuration
- * options available. In the "all" case, the result will
- * available for "widgRec" via "specs". The result will
- * be a list, each of whose entries describes one option.
- * Each entry will itself be a list containing the option's
- * name for use on command lines, database name, database
- * class, default value, and current value (empty string
- * if none). For options that are synonyms, the list will
- * contain only two values: name and synonym name. If the
- * "name" argument is non-NULL, then the only information
- * returned is that for the named argument (i.e. the corresponding
- * entry in the overall list is returned).
+ * Always returns TCL_OK. The interp's result will be modified hold a
+ * description of either a single configuration option available for
+ * "widgRec" via "specs", or all the configuration options available. In
+ * the "all" case, the result will available for "widgRec" via "specs".
+ * The result will be a list, each of whose entries describes one option.
+ * Each entry will itself be a list containing the option's name for use
+ * on command lines, database name, database class, default value, and
+ * current value (empty string if none). For options that are synonyms,
+ * the list will contain only two values: name and synonym name. If the
+ * "name" argument is non-NULL, then the only information returned is
+ * that for the named argument (i.e. the corresponding entry in the
+ * overall list is returned).
*
* Side effects:
* None.
@@ -617,18 +589,18 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
*/
int
-Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* Window corresponding to widgRec. */
- Tk_ConfigSpec *specs; /* Describes legal options. */
- char *widgRec; /* Record whose fields contain current
- * values for options. */
- CONST char *argvName; /* If non-NULL, indicates a single option
- * whose info is to be returned. Otherwise
+Tk_ConfigureInfo(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* Window corresponding to widgRec. */
+ Tk_ConfigSpec *specs, /* Describes legal options. */
+ char *widgRec, /* Record whose fields contain current values
+ * for options. */
+ CONST char *argvName, /* If non-NULL, indicates a single option
+ * whose info is to be returned. Otherwise
* info is returned for all options. */
- int flags; /* Used to specify additional flags
- * that must be present in config specs
- * for them to be considered. */
+ int flags) /* Used to specify additional flags that must
+ * be present in config specs for them to be
+ * considered. */
{
register Tk_ConfigSpec *specPtr;
int needFlags, hateFlags;
@@ -649,11 +621,11 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags)
specs = GetCachedSpecs(interp, specs);
/*
- * If information is only wanted for a single configuration
- * spec, then handle that one spec specially.
+ * If information is only wanted for a single configuration spec, then
+ * handle that one spec specially.
*/
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
if (argvName != NULL) {
specPtr = FindConfigSpec(interp, specs, argvName, needFlags,hateFlags);
if (specPtr == NULL) {
@@ -666,8 +638,8 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags)
}
/*
- * Loop through all the specs, creating a big list with all
- * their information.
+ * Loop through all the specs, creating a big list with all their
+ * information.
*/
for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) {
@@ -682,7 +654,7 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags)
continue;
}
list = FormatConfigInfo(interp, tkwin, specPtr, widgRec);
- Tcl_AppendResult(interp, leader, list, "}", (char *) NULL);
+ Tcl_AppendResult(interp, leader, list, "}", NULL);
ckfree(list);
leader = " {";
}
@@ -694,12 +666,12 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags)
*
* FormatConfigInfo --
*
- * Create a valid Tcl list holding the configuration information
- * for a single configuration option.
+ * Create a valid Tcl list holding the configuration information for a
+ * single configuration option.
*
* Results:
- * A Tcl list, dynamically allocated. The caller is expected to
- * arrange for this list to be freed eventually.
+ * A Tcl list, dynamically allocated. The caller is expected to arrange
+ * for this list to be freed eventually.
*
* Side effects:
* Memory is allocated.
@@ -708,19 +680,20 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags)
*/
static char *
-FormatConfigInfo(interp, tkwin, specPtr, widgRec)
- Tcl_Interp *interp; /* Interpreter to use for things
- * like floating-point precision. */
- Tk_Window tkwin; /* Window corresponding to widget. */
- register Tk_ConfigSpec *specPtr; /* Pointer to information describing
- * option. */
- char *widgRec; /* Pointer to record holding current
- * values of info for widget. */
+FormatConfigInfo(
+ Tcl_Interp *interp, /* Interpreter to use for things like
+ * floating-point precision. */
+ Tk_Window tkwin, /* Window corresponding to widget. */
+ register Tk_ConfigSpec *specPtr,
+ /* Pointer to information describing
+ * option. */
+ char *widgRec) /* Pointer to record holding current values of
+ * info for widget. */
{
CONST char *argv[6];
char *result;
char buffer[200];
- Tcl_FreeProc *freeProc = (Tcl_FreeProc *) NULL;
+ Tcl_FreeProc *freeProc = NULL;
argv[0] = specPtr->argvName;
argv[1] = specPtr->dbName;
@@ -759,16 +732,14 @@ FormatConfigInfo(interp, tkwin, specPtr, widgRec)
*
* FormatConfigValue --
*
- * This procedure formats the current value of a configuration
- * option.
+ * This function formats the current value of a configuration option.
*
* Results:
- * The return value is the formatted value of the option given
- * by specPtr and widgRec. If the value is static, so that it
- * need not be freed, *freeProcPtr will be set to NULL; otherwise
- * *freeProcPtr will be set to the address of a procedure to
- * free the result, and the caller must invoke this procedure
- * when it is finished with the result.
+ * The return value is the formatted value of the option given by specPtr
+ * and widgRec. If the value is static, so that it need not be freed,
+ * *freeProcPtr will be set to NULL; otherwise *freeProcPtr will be set
+ * to the address of a function to free the result, and the caller must
+ * invoke this function when it is finished with the result.
*
* Side effects:
* None.
@@ -777,18 +748,18 @@ FormatConfigInfo(interp, tkwin, specPtr, widgRec)
*/
static CONST char *
-FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr)
- Tcl_Interp *interp; /* Interpreter for use in real conversions. */
- Tk_Window tkwin; /* Window corresponding to widget. */
- Tk_ConfigSpec *specPtr; /* Pointer to information describing option.
+FormatConfigValue(
+ Tcl_Interp *interp, /* Interpreter for use in real conversions. */
+ Tk_Window tkwin, /* Window corresponding to widget. */
+ Tk_ConfigSpec *specPtr, /* Pointer to information describing option.
* Must not point to a synonym option. */
- char *widgRec; /* Pointer to record holding current
- * values of info for widget. */
- char *buffer; /* Static buffer to use for small values.
+ char *widgRec, /* Pointer to record holding current values of
+ * info for widget. */
+ char *buffer, /* Static buffer to use for small values.
* Must have at least 200 bytes of storage. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to word to fill in with address
- * of procedure to free the result, or NULL
- * if result is static. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to word to fill in with address of
+ * function to free the result, or NULL if
+ * result is static. */
{
CONST char *ptr, *result;
@@ -796,109 +767,115 @@ FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr)
ptr = widgRec + specPtr->offset;
result = "";
switch (specPtr->type) {
- case TK_CONFIG_BOOLEAN:
- if (*((int *) ptr) == 0) {
- result = "0";
- } else {
- result = "1";
- }
- break;
- case TK_CONFIG_INT:
- sprintf(buffer, "%d", *((int *) ptr));
- result = buffer;
- break;
- case TK_CONFIG_DOUBLE:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
- result = buffer;
- break;
- case TK_CONFIG_STRING:
- result = (*(char **) ptr);
- if (result == NULL) {
- result = "";
- }
- break;
- case TK_CONFIG_UID: {
- Tk_Uid uid = *((Tk_Uid *) ptr);
- if (uid != NULL) {
- result = uid;
- }
- break;
+ case TK_CONFIG_BOOLEAN:
+ if (*((int *) ptr) == 0) {
+ result = "0";
+ } else {
+ result = "1";
}
- case TK_CONFIG_COLOR: {
- XColor *colorPtr = *((XColor **) ptr);
- if (colorPtr != NULL) {
- result = Tk_NameOfColor(colorPtr);
- }
- break;
+ break;
+ case TK_CONFIG_INT:
+ sprintf(buffer, "%d", *((int *) ptr));
+ result = buffer;
+ break;
+ case TK_CONFIG_DOUBLE:
+ Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ result = buffer;
+ break;
+ case TK_CONFIG_STRING:
+ result = (*(char **) ptr);
+ if (result == NULL) {
+ result = "";
}
- case TK_CONFIG_FONT: {
- Tk_Font tkfont = *((Tk_Font *) ptr);
- if (tkfont != NULL) {
- result = Tk_NameOfFont(tkfont);
- }
- break;
+ break;
+ case TK_CONFIG_UID: {
+ Tk_Uid uid = *((Tk_Uid *) ptr);
+
+ if (uid != NULL) {
+ result = uid;
}
- case TK_CONFIG_BITMAP: {
- Pixmap pixmap = *((Pixmap *) ptr);
- if (pixmap != None) {
- result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap);
- }
- break;
+ break;
+ }
+ case TK_CONFIG_COLOR: {
+ XColor *colorPtr = *((XColor **) ptr);
+
+ if (colorPtr != NULL) {
+ result = Tk_NameOfColor(colorPtr);
}
- case TK_CONFIG_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) ptr);
- if (border != NULL) {
- result = Tk_NameOf3DBorder(border);
- }
- break;
+ break;
+ }
+ case TK_CONFIG_FONT: {
+ Tk_Font tkfont = *((Tk_Font *) ptr);
+
+ if (tkfont != NULL) {
+ result = Tk_NameOfFont(tkfont);
}
- case TK_CONFIG_RELIEF:
- result = Tk_NameOfRelief(*((int *) ptr));
- break;
- case TK_CONFIG_CURSOR:
- case TK_CONFIG_ACTIVE_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) ptr);
- if (cursor != None) {
- result = Tk_NameOfCursor(Tk_Display(tkwin), cursor);
- }
- break;
+ break;
+ }
+ case TK_CONFIG_BITMAP: {
+ Pixmap pixmap = *((Pixmap *) ptr);
+
+ if (pixmap != None) {
+ result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap);
}
- case TK_CONFIG_JUSTIFY:
- result = Tk_NameOfJustify(*((Tk_Justify *) ptr));
- break;
- case TK_CONFIG_ANCHOR:
- result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr));
- break;
- case TK_CONFIG_CAP_STYLE:
- result = Tk_NameOfCapStyle(*((int *) ptr));
- break;
- case TK_CONFIG_JOIN_STYLE:
- result = Tk_NameOfJoinStyle(*((int *) ptr));
- break;
- case TK_CONFIG_PIXELS:
- sprintf(buffer, "%d", *((int *) ptr));
- result = buffer;
- break;
- case TK_CONFIG_MM:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
- result = buffer;
- break;
- case TK_CONFIG_WINDOW: {
- Tk_Window tkwin;
+ break;
+ }
+ case TK_CONFIG_BORDER: {
+ Tk_3DBorder border = *((Tk_3DBorder *) ptr);
- tkwin = *((Tk_Window *) ptr);
- if (tkwin != NULL) {
- result = Tk_PathName(tkwin);
- }
- break;
+ if (border != NULL) {
+ result = Tk_NameOf3DBorder(border);
}
- case TK_CONFIG_CUSTOM:
- result = (*specPtr->customPtr->printProc)(
- specPtr->customPtr->clientData, tkwin, widgRec,
- specPtr->offset, freeProcPtr);
- break;
- default:
- result = "?? unknown type ??";
+ break;
+ }
+ case TK_CONFIG_RELIEF:
+ result = Tk_NameOfRelief(*((int *) ptr));
+ break;
+ case TK_CONFIG_CURSOR:
+ case TK_CONFIG_ACTIVE_CURSOR: {
+ Tk_Cursor cursor = *((Tk_Cursor *) ptr);
+
+ if (cursor != None) {
+ result = Tk_NameOfCursor(Tk_Display(tkwin), cursor);
+ }
+ break;
+ }
+ case TK_CONFIG_JUSTIFY:
+ result = Tk_NameOfJustify(*((Tk_Justify *) ptr));
+ break;
+ case TK_CONFIG_ANCHOR:
+ result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr));
+ break;
+ case TK_CONFIG_CAP_STYLE:
+ result = Tk_NameOfCapStyle(*((int *) ptr));
+ break;
+ case TK_CONFIG_JOIN_STYLE:
+ result = Tk_NameOfJoinStyle(*((int *) ptr));
+ break;
+ case TK_CONFIG_PIXELS:
+ sprintf(buffer, "%d", *((int *) ptr));
+ result = buffer;
+ break;
+ case TK_CONFIG_MM:
+ Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ result = buffer;
+ break;
+ case TK_CONFIG_WINDOW: {
+ Tk_Window tkwin;
+
+ tkwin = *((Tk_Window *) ptr);
+ if (tkwin != NULL) {
+ result = Tk_PathName(tkwin);
+ }
+ break;
+ }
+ case TK_CONFIG_CUSTOM:
+ result = (*specPtr->customPtr->printProc)(
+ specPtr->customPtr->clientData, tkwin, widgRec,
+ specPtr->offset, freeProcPtr);
+ break;
+ default:
+ result = "?? unknown type ??";
}
return result;
}
@@ -908,14 +885,14 @@ FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr)
*
* Tk_ConfigureValue --
*
- * This procedure returns the current value of a configuration
- * option for a widget.
+ * This function returns the current value of a configuration option for
+ * a widget.
*
* Results:
* The return value is a standard Tcl completion code (TCL_OK or
- * TCL_ERROR). The interp's result will be set to hold either the value
- * of the option given by argvName (if TCL_OK is returned) or
- * an error message (if TCL_ERROR is returned).
+ * TCL_ERROR). The interp's result will be set to hold either the value
+ * of the option given by argvName (if TCL_OK is returned) or an error
+ * message (if TCL_ERROR is returned).
*
* Side effects:
* None.
@@ -924,17 +901,17 @@ FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr)
*/
int
-Tk_ConfigureValue(interp, tkwin, specs, widgRec, argvName, flags)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* Window corresponding to widgRec. */
- Tk_ConfigSpec *specs; /* Describes legal options. */
- char *widgRec; /* Record whose fields contain current
- * values for options. */
- CONST char *argvName; /* Gives the command-line name for the
- * option whose value is to be returned. */
- int flags; /* Used to specify additional flags
- * that must be present in config specs
- * for them to be considered. */
+Tk_ConfigureValue(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* Window corresponding to widgRec. */
+ Tk_ConfigSpec *specs, /* Describes legal options. */
+ char *widgRec, /* Record whose fields contain current values
+ * for options. */
+ CONST char *argvName, /* Gives the command-line name for the option
+ * whose value is to be returned. */
+ int flags) /* Used to specify additional flags that must
+ * be present in config specs for them to be
+ * considered. */
{
Tk_ConfigSpec *specPtr;
int needFlags, hateFlags;
@@ -959,7 +936,8 @@ Tk_ConfigureValue(interp, tkwin, specs, widgRec, argvName, flags)
if (specPtr == NULL) {
return TCL_ERROR;
}
- result = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, &freeProc);
+ result = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer,
+ &freeProc);
Tcl_SetResult(interp, (char *) result, TCL_VOLATILE);
if (freeProc != NULL) {
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
@@ -982,24 +960,27 @@ Tk_ConfigureValue(interp, tkwin, specs, widgRec, argvName, flags)
* None.
*
* Side effects:
- * Any resource in widgRec that is controlled by a configuration
- * option (e.g. a Tk_3DBorder or XColor) is freed in the appropriate
- * fashion.
+ * Any resource in widgRec that is controlled by a configuration option
+ * (e.g. a Tk_3DBorder or XColor) is freed in the appropriate fashion.
+ *
+ * Notes:
+ * Since this is not looking anything up, this uses the static version of
+ * the config specs.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
void
-Tk_FreeOptions(specs, widgRec, display, needFlags)
- Tk_ConfigSpec *specs; /* Describes legal options. */
- char *widgRec; /* Record whose fields contain current
- * values for options. */
- Display *display; /* X display; needed for freeing some
+Tk_FreeOptions(
+ Tk_ConfigSpec *specs, /* Describes legal options. */
+ char *widgRec, /* Record whose fields contain current values
+ * for options. */
+ Display *display, /* X display; needed for freeing some
* resources. */
- int needFlags; /* Used to specify additional flags
- * that must be present in config specs
- * for them to be considered. */
+ int needFlags) /* Used to specify additional flags that must
+ * be present in config specs for them to be
+ * considered. */
{
register Tk_ConfigSpec *specPtr;
char *ptr;
@@ -1010,40 +991,40 @@ Tk_FreeOptions(specs, widgRec, display, needFlags)
}
ptr = widgRec + specPtr->offset;
switch (specPtr->type) {
- case TK_CONFIG_STRING:
- if (*((char **) ptr) != NULL) {
- ckfree(*((char **) ptr));
- *((char **) ptr) = NULL;
- }
- break;
- case TK_CONFIG_COLOR:
- if (*((XColor **) ptr) != NULL) {
- Tk_FreeColor(*((XColor **) ptr));
- *((XColor **) ptr) = NULL;
- }
- break;
- case TK_CONFIG_FONT:
- Tk_FreeFont(*((Tk_Font *) ptr));
- *((Tk_Font *) ptr) = NULL;
- break;
- case TK_CONFIG_BITMAP:
- if (*((Pixmap *) ptr) != None) {
- Tk_FreeBitmap(display, *((Pixmap *) ptr));
- *((Pixmap *) ptr) = None;
- }
- break;
- case TK_CONFIG_BORDER:
- if (*((Tk_3DBorder *) ptr) != NULL) {
- Tk_Free3DBorder(*((Tk_3DBorder *) ptr));
- *((Tk_3DBorder *) ptr) = NULL;
- }
- break;
- case TK_CONFIG_CURSOR:
- case TK_CONFIG_ACTIVE_CURSOR:
- if (*((Tk_Cursor *) ptr) != None) {
- Tk_FreeCursor(display, *((Tk_Cursor *) ptr));
- *((Tk_Cursor *) ptr) = None;
- }
+ case TK_CONFIG_STRING:
+ if (*((char **) ptr) != NULL) {
+ ckfree(*((char **) ptr));
+ *((char **) ptr) = NULL;
+ }
+ break;
+ case TK_CONFIG_COLOR:
+ if (*((XColor **) ptr) != NULL) {
+ Tk_FreeColor(*((XColor **) ptr));
+ *((XColor **) ptr) = NULL;
+ }
+ break;
+ case TK_CONFIG_FONT:
+ Tk_FreeFont(*((Tk_Font *) ptr));
+ *((Tk_Font *) ptr) = NULL;
+ break;
+ case TK_CONFIG_BITMAP:
+ if (*((Pixmap *) ptr) != None) {
+ Tk_FreeBitmap(display, *((Pixmap *) ptr));
+ *((Pixmap *) ptr) = None;
+ }
+ break;
+ case TK_CONFIG_BORDER:
+ if (*((Tk_3DBorder *) ptr) != NULL) {
+ Tk_Free3DBorder(*((Tk_3DBorder *) ptr));
+ *((Tk_3DBorder *) ptr) = NULL;
+ }
+ break;
+ case TK_CONFIG_CURSOR:
+ case TK_CONFIG_ACTIVE_CURSOR:
+ if (*((Tk_Cursor *) ptr) != None) {
+ Tk_FreeCursor(display, *((Tk_Cursor *) ptr));
+ *((Tk_Cursor *) ptr) = None;
+ }
}
}
}
@@ -1053,28 +1034,28 @@ Tk_FreeOptions(specs, widgRec, display, needFlags)
*
* GetCachedSpecs --
*
- *Returns a writable per-interpreter (and hence thread-local) copy of
- *the given spec-table with (some of) the char* fields converted into
- *Tk_Uid fields; this copy will be released when the interpreter
- *terminates (during AssocData cleanup).
+ * Returns a writable per-interpreter (and hence thread-local) copy of
+ * the given spec-table with (some of) the char* fields converted into
+ * Tk_Uid fields; this copy will be released when the interpreter
+ * terminates (during AssocData cleanup).
*
* Results:
- *A pointer to the copied table.
+ * A pointer to the copied table.
*
* Notes:
- *The conversion to Tk_Uid is only done the first time, when the table
- *copy is taken. After that, the table is assumed to have Tk_Uids where
- *they are needed. The time of deletion of the caches isn't very
- *important unless you've got a lot of code that uses Tk_ConfigureWidget
- *(or *Info or *Value} when the interpreter is being deleted.
+ * The conversion to Tk_Uid is only done the first time, when the table
+ * copy is taken. After that, the table is assumed to have Tk_Uids where
+ * they are needed. The time of deletion of the caches isn't very
+ * important unless you've got a lot of code that uses Tk_ConfigureWidget
+ * (or *Info or *Value} when the interpreter is being deleted.
*
*--------------------------------------------------------------
*/
static Tk_ConfigSpec *
-GetCachedSpecs(interp, staticSpecs)
- Tcl_Interp *interp; /* Interpreter in which to store the cache. */
- const Tk_ConfigSpec *staticSpecs;
+GetCachedSpecs(
+ Tcl_Interp *interp, /* Interpreter in which to store the cache. */
+ const Tk_ConfigSpec *staticSpecs)
/* Value to cache a copy of; it is also used
* as a key into the cache. */
{
@@ -1126,7 +1107,7 @@ GetCachedSpecs(interp, staticSpecs)
*/
cachedSpecs = (Tk_ConfigSpec *) ckalloc(entrySpace);
- memcpy((void *) cachedSpecs, (void *) staticSpecs, entrySpace);
+ memcpy(cachedSpecs, staticSpecs, entrySpace);
Tcl_SetHashValue(entryPtr, (ClientData) cachedSpecs);
/*
@@ -1147,6 +1128,7 @@ GetCachedSpecs(interp, staticSpecs)
specPtr->defValue = Tk_GetUid(specPtr->defValue);
}
}
+ specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED;
}
} else {
cachedSpecs = (Tk_ConfigSpec *) Tcl_GetHashValue(entryPtr);
@@ -1167,15 +1149,15 @@ GetCachedSpecs(interp, staticSpecs)
* None
*
* Side effects:
- * None
+ * None (does *not* use any Tk API).
*
*--------------------------------------------------------------
*/
static void
-DeleteSpecCacheTable(clientData, interp)
- ClientData clientData;
- Tcl_Interp *interp;
+DeleteSpecCacheTable(
+ ClientData clientData,
+ Tcl_Interp *interp)
{
Tcl_HashTable *tablePtr = (Tcl_HashTable *) clientData;
Tcl_HashEntry *entryPtr;
@@ -1192,3 +1174,11 @@ DeleteSpecCacheTable(clientData, interp)
Tcl_DeleteHashTable(tablePtr);
ckfree((char *) tablePtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
new file mode 100644
index 0000000..cfbce23
--- /dev/null
+++ b/generic/tkOldTest.c
@@ -0,0 +1,404 @@
+/*
+ * tkOldTest.c --
+ *
+ * This file contains C command functions for additional Tcl
+ * commands that are used to test Tk's support for legacy
+ * interfaces. These commands are not normally included in Tcl/Tk
+ * applications; they're only used for testing.
+ *
+ * Copyright (c) 1993-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Contributions by Don Porter, NIST, 2007. (not subject to US copyright)
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#define USE_OLD_IMAGE
+#include "tkInt.h"
+
+/*
+ * The following data structure represents the master for a test image:
+ */
+
+typedef struct TImageMaster {
+ Tk_ImageMaster master; /* Tk's token for image master. */
+ Tcl_Interp *interp; /* Interpreter for application. */
+ int width, height; /* Dimensions of image. */
+ char *imageName; /* Name of image (malloc-ed). */
+ char *varName; /* Name of variable in which to log events for
+ * image (malloc-ed). */
+} TImageMaster;
+
+/*
+ * The following data structure represents a particular use of a particular
+ * test image.
+ */
+
+typedef struct TImageInstance {
+ TImageMaster *masterPtr; /* Pointer to master for image. */
+ XColor *fg; /* Foreground color for drawing in image. */
+ GC gc; /* Graphics context for drawing in image. */
+} TImageInstance;
+
+/*
+ * The type record for test images:
+ */
+
+static int ImageCreate(Tcl_Interp *interp,
+ char *name, int argc, char **argv,
+ Tk_ImageType *typePtr, Tk_ImageMaster master,
+ ClientData *clientDataPtr);
+static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
+static void ImageDisplay(ClientData clientData,
+ Display *display, Drawable drawable,
+ int imageX, int imageY, int width,
+ int height, int drawableX,
+ int drawableY);
+static void ImageFree(ClientData clientData, Display *display);
+static void ImageDelete(ClientData clientData);
+
+static Tk_ImageType imageType = {
+ "oldtest", /* name */
+ (Tk_ImageCreateProc *) ImageCreate, /* createProc */
+ ImageGet, /* getProc */
+ ImageDisplay, /* displayProc */
+ ImageFree, /* freeProc */
+ ImageDelete, /* deleteProc */
+ NULL, /* postscriptPtr */
+ NULL /* nextPtr */
+};
+
+/*
+ * Forward declarations for functions defined later in this file:
+ */
+
+static int ImageCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkOldTestInit --
+ *
+ * This function performs intialization for the Tk test suite
+ * extensions for testing support for legacy interfaces.
+ *
+ * Results:
+ * Returns a standard Tcl completion code, and leaves an error message in
+ * the interp's result if an error occurs.
+ *
+ * Side effects:
+ * Creates several test commands.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkOldTestInit(
+ Tcl_Interp *interp)
+{
+ static int initialized = 0;
+
+ if (!initialized) {
+ initialized = 1;
+ Tk_CreateImageType(&imageType);
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageCreate --
+ *
+ * This function is called by the Tk image code to create "oldtest" images.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * The data structure for a new image is allocated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ /* ARGSUSED */
+static int
+ImageCreate(
+ Tcl_Interp *interp, /* Interpreter for application containing
+ * image. */
+ char *name, /* Name to use for image. */
+ int argc, /* Number of arguments. */
+ char **argv, /* Argument strings for options (doesn't
+ * include image name or type). */
+ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
+ Tk_ImageMaster master, /* Token for image, to be used by us in later
+ * callbacks. */
+ ClientData *clientDataPtr) /* Store manager's token for image here; it
+ * will be returned in later callbacks. */
+{
+ TImageMaster *timPtr;
+ char *varName;
+ int i;
+
+ varName = "log";
+ for (i = 0; i < argc; i += 2) {
+ if (strcmp(argv[i], "-variable") != 0) {
+ Tcl_AppendResult(interp, "bad option name \"",
+ argv[i], "\"", NULL);
+ return TCL_ERROR;
+ }
+ if ((i+1) == argc) {
+ Tcl_AppendResult(interp, "no value given for \"",
+ argv[i], "\" option", NULL);
+ return TCL_ERROR;
+ }
+ varName = argv[i+1];
+ }
+
+ timPtr = (TImageMaster *) ckalloc(sizeof(TImageMaster));
+ timPtr->master = master;
+ timPtr->interp = interp;
+ timPtr->width = 30;
+ timPtr->height = 15;
+ timPtr->imageName = (char *) ckalloc((unsigned) (strlen(name) + 1));
+ strcpy(timPtr->imageName, name);
+ timPtr->varName = (char *) ckalloc((unsigned) (strlen(varName) + 1));
+ strcpy(timPtr->varName, varName);
+ Tcl_CreateCommand(interp, name, ImageCmd, (ClientData) timPtr, NULL);
+ *clientDataPtr = (ClientData) timPtr;
+ Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageCmd --
+ *
+ * This function implements the commands corresponding to individual
+ * images.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Forces windows to be created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ /* ARGSUSED */
+static int
+ImageCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
+{
+ TImageMaster *timPtr = (TImageMaster *) clientData;
+ int x, y, width, height;
+
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "wrong # args: should be \"",
+ argv[0], "option ?arg arg ...?", NULL);
+ return TCL_ERROR;
+ }
+ if (strcmp(argv[1], "changed") == 0) {
+ if (argc != 8) {
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " changed x y width height imageWidth imageHeight", NULL);
+ return TCL_ERROR;
+ }
+ if ((Tcl_GetInt(interp, argv[2], &x) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[3], &y) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[4], &width) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[5], &height) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[6], &timPtr->width) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[7], &timPtr->height) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ timPtr->height);
+ } else {
+ Tcl_AppendResult(interp, "bad option \"", argv[1],
+ "\": must be changed", NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageGet --
+ *
+ * This function is called by Tk to set things up for using a test image
+ * in a particular widget.
+ *
+ * Results:
+ * The return value is a token for the image instance, which is used in
+ * future callbacks to ImageDisplay and ImageFree.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static ClientData
+ImageGet(
+ Tk_Window tkwin, /* Token for window in which image will be
+ * used. */
+ ClientData clientData) /* Pointer to TImageMaster for image. */
+{
+ TImageMaster *timPtr = (TImageMaster *) clientData;
+ TImageInstance *instPtr;
+ char buffer[100];
+ XGCValues gcValues;
+
+ sprintf(buffer, "%s get", timPtr->imageName);
+ Tcl_SetVar(timPtr->interp, timPtr->varName, buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+
+ instPtr = (TImageInstance *) ckalloc(sizeof(TImageInstance));
+ instPtr->masterPtr = timPtr;
+ instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
+ gcValues.foreground = instPtr->fg->pixel;
+ instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
+ return (ClientData) instPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageDisplay --
+ *
+ * This function is invoked to redisplay part or all of an image in a
+ * given drawable.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The image gets partially redrawn, as an "X" that shows the exact
+ * redraw area.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ImageDisplay(
+ ClientData clientData, /* Pointer to TImageInstance for image. */
+ Display *display, /* Display to use for drawing. */
+ Drawable drawable, /* Where to redraw image. */
+ int imageX, int imageY, /* Origin of area to redraw, relative to
+ * origin of image. */
+ int width, int height, /* Dimensions of area to redraw. */
+ int drawableX, int drawableY)
+ /* Coordinates in drawable corresponding to
+ * imageX and imageY. */
+{
+ TImageInstance *instPtr = (TImageInstance *) clientData;
+ char buffer[200 + TCL_INTEGER_SPACE * 6];
+
+ sprintf(buffer, "%s display %d %d %d %d %d %d",
+ instPtr->masterPtr->imageName, imageX, imageY, width, height,
+ drawableX, drawableY);
+ Tcl_SetVar(instPtr->masterPtr->interp, instPtr->masterPtr->varName, buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ if (width > (instPtr->masterPtr->width - imageX)) {
+ width = instPtr->masterPtr->width - imageX;
+ }
+ if (height > (instPtr->masterPtr->height - imageY)) {
+ height = instPtr->masterPtr->height - imageY;
+ }
+ XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
+ (unsigned) (width-1), (unsigned) (height-1));
+ XDrawLine(display, drawable, instPtr->gc, drawableX, drawableY,
+ (int) (drawableX + width - 1), (int) (drawableY + height - 1));
+ XDrawLine(display, drawable, instPtr->gc, drawableX,
+ (int) (drawableY + height - 1),
+ (int) (drawableX + width - 1), drawableY);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageFree --
+ *
+ * This function is called when an instance of an image is no longer
+ * used.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information related to the instance is freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ImageFree(
+ ClientData clientData, /* Pointer to TImageInstance for instance. */
+ Display *display) /* Display where image was to be drawn. */
+{
+ TImageInstance *instPtr = (TImageInstance *) clientData;
+ char buffer[200];
+
+ sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
+ Tcl_SetVar(instPtr->masterPtr->interp, instPtr->masterPtr->varName, buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ Tk_FreeColor(instPtr->fg);
+ Tk_FreeGC(display, instPtr->gc);
+ ckfree((char *) instPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageDelete --
+ *
+ * This function is called to clean up a test image when an application
+ * goes away.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information about the image is deleted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ImageDelete(
+ ClientData clientData) /* Pointer to TImageMaster for image. When
+ * this function is called, no more instances
+ * exist. */
+{
+ TImageMaster *timPtr = (TImageMaster *) clientData;
+ char buffer[100];
+
+ sprintf(buffer, "%s delete", timPtr->imageName);
+ Tcl_SetVar(timPtr->interp, timPtr->varName, buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+
+ Tcl_DeleteCommand(timPtr->interp, timPtr->imageName);
+ ckfree(timPtr->imageName);
+ ckfree(timPtr->varName);
+ ckfree((char *) timPtr);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 0df3f8d..de92627 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -1,93 +1,90 @@
-/*
+/*
* tkOption.c --
*
- * This module contains procedures to manage the option
- * database, which allows various strings to be associated
- * with windows either by name or by class or both.
+ * This module contains functions to manage the option database, which
+ * allows various strings to be associated with windows either by name or
+ * by class or both.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
- * The option database is stored as one tree for each main window.
- * Each name or class field in an option is associated with a node or
- * leaf of the tree. For example, the options "x.y.z" and "x.y*a"
- * each correspond to three nodes in the tree; they share the nodes
- * "x" and "x.y", but have different leaf nodes. One of the following
- * structures exists for each node or leaf in the option tree. It is
- * actually stored as part of the parent node, and describes a particular
- * child of the parent.
- *
- * The structure of the option db tree is a little confusing. There are
- * four different kinds of nodes in the tree:
+ * The option database is stored as one tree for each main window. Each name
+ * or class field in an option is associated with a node or leaf of the tree.
+ * For example, the options "x.y.z" and "x.y*a" each correspond to three nodes
+ * in the tree; they share the nodes "x" and "x.y", but have different leaf
+ * nodes. One of the following structures exists for each node or leaf in the
+ * option tree. It is actually stored as part of the parent node, and
+ * describes a particular child of the parent.
+ *
+ * The structure of the option db tree is a little confusing. There are four
+ * different kinds of nodes in the tree:
* interior class nodes
* interior name nodes
* leaf class nodes
* leaf name nodes
*
* All interior nodes refer to _window_ classes and names; all leaf nodes
- * refer to _option_ classes and names. When looking for a particular option,
+ * refer to _option_ classes and names. When looking for a particular option,
* therefore, you must compare interior node values to corresponding window
* values, and compare leaf node values to corresponding option values.
*
* The tree is actually stored in a collection of arrays; there is one each
- * combination of WILDCARD/EXACT and CLASS/NAME and NODE/LEAF. The NODE arrays
+ * combination of WILDCARD/EXACT and CLASS/NAME and NODE/LEAF. The NODE arrays
* contain the interior nodes of the tree; each element has a pointer to an
- * array of elements which are the leaves of the tree. The LEAF arrays, rather
+ * array of elements which are the leaves of the tree. The LEAF arrays, rather
* than holding the leaves of the tree, hold a cached subset of the option
* database, consisting of the values of all defined options for a single
* window, and some additional information about each ancestor of the window
- * (since some options may be inherited from a parent), all the way back to the
- * root window.
+ * (since some options may be inherited from a parent), all the way back to
+ * the root window.
*
* Each time a call is made to Tk_GetOption, Tk will attempt to use the cached
- * information to satisfy the lookup. If the call is for a window other than
+ * information to satisfy the lookup. If the call is for a window other than
* that for which options are currently cached, the portion of the cache that
- * contains information for common ancestors of the two windows is retained and
- * the remainder is discarded and rebuilt with new information for the new
+ * contains information for common ancestors of the two windows is retained
+ * and the remainder is discarded and rebuilt with new information for the new
* window.
*/
typedef struct Element {
- Tk_Uid nameUid; /* Name or class from one element of
- * an option spec. */
+ Tk_Uid nameUid; /* Name or class from one element of an option
+ * spec. */
union {
- struct ElArray *arrayPtr; /* If this is an intermediate node,
- * a pointer to a structure describing
- * the remaining elements of all
- * options whose prefixes are the
- * same up through this element. */
- Tk_Uid valueUid; /* For leaf nodes, this is the string
- * value of the option. */
+ struct ElArray *arrayPtr;
+ /* If this is an intermediate node, a pointer
+ * to a structure describing the remaining
+ * elements of all options whose prefixes are
+ * the same up through this element. */
+ Tk_Uid valueUid; /* For leaf nodes, this is the string value of
+ * the option. */
} child;
- int priority; /* Used to select among matching
- * options. Includes both the
- * priority level and a serial #.
- * Greater value means higher
- * priority. Irrelevant except in
- * leaf nodes. */
- int flags; /* OR-ed combination of bits. See
- * below for values. */
+ int priority; /* Used to select among matching options.
+ * Includes both the priority level and a
+ * serial #. Greater value means higher
+ * priority. Irrelevant except in leaf
+ * nodes. */
+ int flags; /* OR-ed combination of bits. See below for
+ * values. */
} Element;
/*
* Flags in Element structures:
*
- * CLASS - Non-zero means this element refers to a class,
- * Zero means this element refers to a name.
- * NODE - Zero means this is a leaf element (the child
- * field is a value, not a pointer to another node).
- * One means this is a node element.
- * WILDCARD - Non-zero means this there was a star in the
- * original specification just before this element.
- * Zero means there was a dot.
+ * CLASS - Non-zero means this element refers to a class, zero
+ * means this element refers to a name.
+ * NODE - Zero means this is a leaf element (the child field is
+ * a value, not a pointer to another node). One means
+ * this is a node element.
+ * WILDCARD - Non-zero means this there was a star in the original
+ * specification just before this element. Zero means
+ * there was a dot.
*/
#define TYPE_MASK 0x7
@@ -106,25 +103,22 @@ typedef struct Element {
#define WILDCARD_NODE_CLASS 0x7
/*
- * The following structure is used to manage a dynamic array of
- * Elements. These structures are used for two purposes: to store
- * the contents of a node in the option tree, and for the option
- * stacks described below.
+ * The following structure is used to manage a dynamic array of Elements.
+ * These structures are used for two purposes: to store the contents of a node
+ * in the option tree, and for the option stacks described below.
*/
typedef struct ElArray {
- int arraySize; /* Number of elements actually
- * allocated in the "els" array. */
- int numUsed; /* Number of elements currently in
- * use out of els. */
+ int arraySize; /* Number of elements actually allocated in
+ * the "els" array. */
+ int numUsed; /* Number of elements currently in use out of
+ * els. */
Element *nextToUse; /* Pointer to &els[numUsed]. */
- Element els[1]; /* Array of structures describing
- * children of this node. The
- * array will actually contain enough
- * elements for all of the children
- * (and even a few extras, perhaps).
- * This must be the last field in
- * the structure. */
+ Element els[1]; /* Array of structures describing children of
+ * this node. The array will actually contain
+ * enough elements for all of the children
+ * (and even a few extras, perhaps). This must
+ * be the last field in the structure. */
} ElArray;
#define EL_ARRAY_SIZE(numEls) ((unsigned) (sizeof(ElArray) \
@@ -133,114 +127,104 @@ typedef struct ElArray {
/*
* In addition to the option tree, which is a relatively static structure,
- * there are eight additional structures called "stacks", which are used
- * to speed up queries into the option database. The stack structures
- * are designed for the situation where an individual widget makes repeated
- * requests for its particular options. The requests differ only in
- * their last name/class, so during the first request we extract all
- * the options pertaining to the particular widget and save them in a
- * stack-like cache; subsequent requests for the same widget can search
- * the cache relatively quickly. In fact, the cache is a hierarchical
- * one, storing a list of relevant options for this widget and all of
- * its ancestors up to the application root; hence the name "stack".
- *
- * Each of the eight stacks consists of an array of Elements, ordered in
- * terms of levels in the window hierarchy. All the elements relevant
- * for the top-level widget appear first in the array, followed by all
- * those from the next-level widget on the path to the current widget,
- * etc. down to those for the current widget.
- *
- * Cached information is divided into eight stacks according to the
- * CLASS, NODE, and WILDCARD flags. Leaf and non-leaf information is
- * kept separate to speed up individual probes (non-leaf information is
- * only relevant when building the stacks, but isn't relevant when
- * making probes; similarly, only non-leaf information is relevant
- * when the stacks are being extended to the next widget down in the
- * widget hierarchy). Wildcard elements are handled separately from
- * "exact" elements because once they appear at a particular level in
- * the stack they remain active for all deeper levels; exact elements
- * are only relevant at a particular level. For example, when searching
- * for options relevant in a particular window, the entire wildcard
- * stacks get checked, but only the portions of the exact stacks that
- * pertain to the window's parent. Lastly, name and class stacks are
- * kept separate because different search keys are used when searching
- * them; keeping them separate speeds up the searches.
+ * there are eight additional structures called "stacks", which are used to
+ * speed up queries into the option database. The stack structures are
+ * designed for the situation where an individual widget makes repeated
+ * requests for its particular options. The requests differ only in their last
+ * name/class, so during the first request we extract all the options
+ * pertaining to the particular widget and save them in a stack-like cache;
+ * subsequent requests for the same widget can search the cache relatively
+ * quickly. In fact, the cache is a hierarchical one, storing a list of
+ * relevant options for this widget and all of its ancestors up to the
+ * application root; hence the name "stack".
+ *
+ * Each of the eight stacks consists of an array of Elements, ordered in terms
+ * of levels in the window hierarchy. All the elements relevant for the
+ * top-level widget appear first in the array, followed by all those from the
+ * next-level widget on the path to the current widget, etc. down to those for
+ * the current widget.
+ *
+ * Cached information is divided into eight stacks according to the CLASS,
+ * NODE, and WILDCARD flags. Leaf and non-leaf information is kept separate to
+ * speed up individual probes (non-leaf information is only relevant when
+ * building the stacks, but isn't relevant when making probes; similarly, only
+ * non-leaf information is relevant when the stacks are being extended to the
+ * next widget down in the widget hierarchy). Wildcard elements are handled
+ * separately from "exact" elements because once they appear at a particular
+ * level in the stack they remain active for all deeper levels; exact elements
+ * are only relevant at a particular level. For example, when searching for
+ * options relevant in a particular window, the entire wildcard stacks get
+ * checked, but only the portions of the exact stacks that pertain to the
+ * window's parent. Lastly, name and class stacks are kept separate because
+ * different search keys are used when searching them; keeping them separate
+ * speeds up the searches.
*/
#define NUM_STACKS 8
/*
- * One of the following structures is used to keep track of each
- * level in the stacks.
+ * One of the following structures is used to keep track of each level in the
+ * stacks.
*/
typedef struct StackLevel {
TkWindow *winPtr; /* Window corresponding to this stack
* level. */
- int bases[NUM_STACKS]; /* For each stack, index of first
- * element on stack corresponding to
- * this level (used to restore "numUsed"
- * fields when popping out of a level. */
+ int bases[NUM_STACKS]; /* For each stack, index of first element on
+ * stack corresponding to this level (used to
+ * restore "numUsed" fields when popping out
+ * of a level. */
} StackLevel;
typedef struct ThreadSpecificData {
- int initialized; /* 0 means the ThreadSpecific Data structure
+ int initialized; /* 0 means the ThreadSpecific Data structure
* for the current thread needs to be
* initialized. */
ElArray *stacks[NUM_STACKS];
- TkWindow *cachedWindow;
- /* Lowest-level window currently
- * loaded in stacks at present.
- * NULL means stacks have never
- * been used, or have been
- * invalidated because of a change
- * to the database. */
+ TkWindow *cachedWindow; /* Lowest-level window currently loaded in
+ * stacks at present. NULL means stacks have
+ * never been used, or have been invalidated
+ * because of a change to the database. */
/*
- * Information about all of the stack levels that are currently
- * active. This array grows dynamically to become as large as needed.
+ * Information about all of the stack levels that are currently active.
+ * This array grows dynamically to become as large as needed.
*/
- StackLevel *levels; /* Array describing current stack. */
- int numLevels; /* Total space allocated. */
- int curLevel; /* Highest level currently in use. Note:
- * curLevel is never 0! (I don't remember
- * why anymore...) */
- /*
- * The variable below is a serial number for all options entered into
- * the database so far. It increments on each addition to the option
- * database. It is used in computing option priorities, so that the
- * most recent entry wins when choosing between options at the same
- * priority level.
- */
-
- int serial;
- Element defaultMatch; /* Special "no match" Element to use as
+ StackLevel *levels; /* Array describing current stack. */
+ int numLevels; /* Total space allocated. */
+ int curLevel; /* Highest level currently in use. Note:
+ * curLevel is never 0! (I don't remember why
+ * anymore...) */
+ int serial; /* A serial number for all options entered
+ * into the database so far. It increments on
+ * each addition to the option database. It is
+ * used in computing option priorities, so
+ * that the most recent entry wins when
+ * choosing between options at the same
+ * priority level. */
+ Element defaultMatch; /* Special "no match" Element to use as
* default for searches.*/
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static int AddFromString _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, char *string, int priority));
-static void ClearOptionTree _ANSI_ARGS_((ElArray *arrayPtr));
-static ElArray * ExtendArray _ANSI_ARGS_((ElArray *arrayPtr,
- Element *elPtr));
-static void ExtendStacks _ANSI_ARGS_((ElArray *arrayPtr,
- int leaf));
-static int GetDefaultOptions _ANSI_ARGS_((Tcl_Interp *interp,
- TkWindow *winPtr));
-static ElArray * NewArray _ANSI_ARGS_((int numEls));
-static void OptionThreadExitProc _ANSI_ARGS_((
- ClientData clientData));
-static void OptionInit _ANSI_ARGS_((TkMainInfo *mainPtr));
-static int ParsePriority _ANSI_ARGS_((Tcl_Interp *interp,
- char *string));
-static int ReadOptionFile _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, char *fileName, int priority));
-static void SetupStacks _ANSI_ARGS_((TkWindow *winPtr, int leaf));
+static int AddFromString(Tcl_Interp *interp, Tk_Window tkwin,
+ char *string, int priority);
+static void ClearOptionTree(ElArray *arrayPtr);
+static ElArray * ExtendArray(ElArray *arrayPtr, Element *elPtr);
+static void ExtendStacks(ElArray *arrayPtr, int leaf);
+static int GetDefaultOptions(Tcl_Interp *interp,
+ TkWindow *winPtr);
+static ElArray * NewArray(int numEls);
+static void OptionThreadExitProc(ClientData clientData);
+static void OptionInit(TkMainInfo *mainPtr);
+static int ParsePriority(Tcl_Interp *interp, char *string);
+static int ReadOptionFile(Tcl_Interp *interp, Tk_Window tkwin,
+ char *fileName, int priority);
+static void SetupStacks(TkWindow *winPtr, int leaf);
/*
*--------------------------------------------------------------
@@ -259,15 +243,15 @@ static void SetupStacks _ANSI_ARGS_((TkWindow *winPtr, int leaf));
*/
void
-Tk_AddOption(tkwin, name, value, priority)
- Tk_Window tkwin; /* Window token; option will be associated
+Tk_AddOption(
+ Tk_Window tkwin, /* Window token; option will be associated
* with main window for this window. */
- CONST char *name; /* Multi-element name of option. */
- CONST char *value; /* String value for option. */
- int priority; /* Overall priority level to use for
- * this option, such as TK_USER_DEFAULT_PRIO
- * or TK_INTERACTIVE_PRIO. Must be between
- * 0 and TK_MAX_PRIO. */
+ CONST char *name, /* Multi-element name of option. */
+ CONST char *value, /* String value for option. */
+ int priority) /* Overall priority level to use for this
+ * option, such as TK_USER_DEFAULT_PRIO or
+ * TK_INTERACTIVE_PRIO. Must be between 0 and
+ * TK_MAX_PRIO. */
{
TkWindow *winPtr = ((TkWindow *) tkwin)->mainPtr->winPtr;
register ElArray **arrayPtrPtr;
@@ -275,21 +259,21 @@ Tk_AddOption(tkwin, name, value, priority)
Element newEl;
register CONST char *p;
CONST char *field;
- int count, firstField, length;
+ int count, firstField;
+ ptrdiff_t length;
#define TMP_SIZE 100
char tmp[TMP_SIZE+1];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->mainPtr->optionRootPtr == NULL) {
OptionInit(winPtr->mainPtr);
}
- tsdPtr->cachedWindow = NULL; /* Invalidate the cache. */
+ tsdPtr->cachedWindow = NULL;/* Invalidate the cache. */
/*
- * Compute the priority for the new element, including both the
- * overall level and the serial number (to disambiguate with the
- * level).
+ * Compute the priority for the new element, including both the overall
+ * level and the serial number (to disambiguate with the level).
*/
if (priority < 0) {
@@ -307,11 +291,10 @@ Tk_AddOption(tkwin, name, value, priority)
arrayPtrPtr = &(((TkWindow *) tkwin)->mainPtr->optionRootPtr);
p = name;
for (firstField = 1; ; firstField = 0) {
-
/*
- * Scan the next field from the name and convert it to a Tk_Uid.
- * Must copy the field before calling Tk_Uid, so that a terminating
- * NULL may be added without modifying the source string.
+ * Scan the next field from the name and convert it to a Tk_Uid. Must
+ * copy the field before calling Tk_Uid, so that a terminating NULL
+ * may be added without modifying the source string.
*/
if (*p == '*') {
@@ -336,12 +319,10 @@ Tk_AddOption(tkwin, name, value, priority)
}
if (*p != 0) {
-
/*
- * New element will be a node. If this option can't possibly
- * apply to this main window, then just skip it. Otherwise,
- * add it to the parent, if it isn't already there, and descend
- * into it.
+ * New element will be a node. If this option can't possibly apply
+ * to this main window, then just skip it. Otherwise, add it to
+ * the parent, if it isn't already there, and descend into it.
*/
newEl.flags |= NODE;
@@ -355,7 +336,8 @@ Tk_AddOption(tkwin, name, value, priority)
if (count == 0) {
newEl.child.arrayPtr = NewArray(5);
*arrayPtrPtr = ExtendArray(*arrayPtrPtr, &newEl);
- arrayPtrPtr = &((*arrayPtrPtr)->nextToUse[-1].child.arrayPtr);
+ arrayPtrPtr = &((*arrayPtrPtr)
+ ->nextToUse[-1].child.arrayPtr);
break;
}
if ((elPtr->nameUid == newEl.nameUid)
@@ -368,11 +350,10 @@ Tk_AddOption(tkwin, name, value, priority)
p++;
}
} else {
-
/*
- * New element is a leaf. Add it to the parent, if it isn't
- * already there. If it exists already, keep whichever value
- * has highest priority.
+ * New element is a leaf. Add it to the parent, if it isn't
+ * already there. If it exists already, keep whichever value has
+ * highest priority.
*/
newEl.child.valueUid = Tk_GetUid(value);
@@ -403,27 +384,26 @@ Tk_AddOption(tkwin, name, value, priority)
* Retrieve an option from the option database.
*
* Results:
- * The return value is the value specified in the option
- * database for the given name and class on the given
- * window. If there is nothing specified in the database
- * for that option, then NULL is returned.
+ * The return value is the value specified in the option database for the
+ * given name and class on the given window. If there is nothing
+ * specified in the database for that option, then NULL is returned.
*
* Side effects:
- * The internal caches used to speed up option mapping
- * may be modified, if this tkwin is different from the
- * last tkwin used for option retrieval.
+ * The internal caches used to speed up option mapping may be modified,
+ * if this tkwin is different from the last tkwin used for option
+ * retrieval.
*
*--------------------------------------------------------------
*/
Tk_Uid
-Tk_GetOption(tkwin, name, className)
- Tk_Window tkwin; /* Token for window that option is
- * associated with. */
- CONST char *name; /* Name of option. */
- CONST char *className; /* Class of option. NULL means there
- * is no class for this option: just
- * check for name. */
+Tk_GetOption(
+ Tk_Window tkwin, /* Token for window that option is associated
+ * with. */
+ CONST char *name, /* Name of option. */
+ CONST char *className) /* Class of option. NULL means there is no
+ * class for this option: just check for
+ * name. */
{
Tk_Uid nameId, classId = NULL;
char *masqName;
@@ -431,12 +411,12 @@ Tk_GetOption(tkwin, name, className)
register int count;
StackLevel *levelPtr;
int stackDepth[NUM_STACKS];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Note: no need to call OptionInit here: it will be done by
- * the SetupStacks call below (squeeze out those nanoseconds).
+ * Note: no need to call OptionInit here: it will be done by the
+ * SetupStacks call below (squeeze out those nanoseconds).
*/
if (tkwin != (Tk_Window) tsdPtr->cachedWindow) {
@@ -446,32 +426,33 @@ Tk_GetOption(tkwin, name, className)
/*
* Get a default "best" match.
*/
-
+
bestPtr = &tsdPtr->defaultMatch;
/*
* For megawidget support, we want to have some widget options masquerade
- * as options for other widgets. For example, a combobox has a button in
+ * as options for other widgets. For example, a combobox has a button in
* it; this button ought to pick up the *Button.background, etc., options.
* But because the class of the widget is Combobox, our normal search
* won't get that option.
*
* To work around this, the option name field syntax was extended to allow
* for a "." in the name; if this character occurs in the name, then it
- * indicates that this name contains a new window class and an option name,
- * ie, "Button.foreground". If we see this form in the name field, we
- * query the option database directly (since the option stacks will not
+ * indicates that this name contains a new window class and an option
+ * name, ie, "Button.foreground". If we see this form in the name field,
+ * we query the option database directly (since the option stacks will not
* have the information we need).
*/
masqName = strchr(name, (int)'.');
if (masqName != NULL) {
/*
- * This option is masquerading with a different window class.
- * Search the stack to the depth it was before the current window's
+ * This option is masquerading with a different window class. Search
+ * the stack to the depth it was before the current window's
* information was pushed (the value for which is stored in the bases
* field).
*/
+
levelPtr = &tsdPtr->levels[tsdPtr->curLevel];
nameId = Tk_GetUid(masqName+1);
for (count = 0; count < NUM_STACKS; count++) {
@@ -479,9 +460,10 @@ Tk_GetOption(tkwin, name, className)
}
} else {
/*
- * No option masquerading here. Just use the current level to get the
+ * No option masquerading here. Just use the current level to get the
* stack depths.
*/
+
nameId = Tk_GetUid(name);
for (count = 0; count < NUM_STACKS; count++) {
stackDepth[count] = tsdPtr->stacks[count]->numUsed;
@@ -528,11 +510,11 @@ Tk_GetOption(tkwin, name, className)
}
}
}
-
+
/*
- * If this option was masquerading with a different window class,
- * probe the option database now. Note that this will be inefficient
- * if the option database is densely populated, or if the widget has many
+ * If this option was masquerading with a different window class, probe
+ * the option database now. Note that this will be inefficient if the
+ * option database is densely populated, or if the widget has many
* masquerading options.
*/
@@ -541,43 +523,42 @@ Tk_GetOption(tkwin, name, className)
Tk_Uid nodeId, winClassId, winNameId;
unsigned int classNameLength;
register Element *nodePtr, *leafPtr;
- static int searchOrder[] = { EXACT_NODE_NAME,
- WILDCARD_NODE_NAME,
- EXACT_NODE_CLASS,
- WILDCARD_NODE_CLASS,
- -1 };
+ static int searchOrder[] = {
+ EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS,
+ WILDCARD_NODE_CLASS, -1
+ };
int *currentPtr, currentStack, leafCount;
-
+
/*
* Extract the masquerade class name from the name field.
*/
-
+
classNameLength = (unsigned int)(masqName - name);
- masqClass = (char *)ckalloc(classNameLength + 1);
+ masqClass = (char *) ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
-
- winClassId = Tk_GetUid(masqClass);
+
+ winClassId = Tk_GetUid(masqClass);
ckfree(masqClass);
- winNameId = ((TkWindow *)tkwin)->nameUid;
+ winNameId = ((TkWindow *)tkwin)->nameUid;
levelPtr = &tsdPtr->levels[tsdPtr->curLevel];
for (currentPtr = searchOrder; *currentPtr != -1; currentPtr++) {
currentStack = *currentPtr;
- nodePtr = tsdPtr->stacks[currentStack]->els;
- count = levelPtr->bases[currentStack];
+ nodePtr = tsdPtr->stacks[currentStack]->els;
+ count = levelPtr->bases[currentStack];
/*
- * For wildcard stacks, check all entries; for non-wildcard
+ * For wildcard stacks, check all entries; for non-wildcard
* stacks, only check things that matched in the parent.
*/
-
+
if (!(currentStack & WILDCARD)) {
nodePtr += levelPtr[-1].bases[currentStack];
count -= levelPtr[-1].bases[currentStack];
}
-
+
if (currentStack && CLASS) {
nodeId = winClassId;
} else {
@@ -586,8 +567,8 @@ Tk_GetOption(tkwin, name, className)
for ( ; count > 0; nodePtr++, count--) {
if (nodePtr->nameUid == nodeId) {
- leafPtr = nodePtr->child.arrayPtr->els;
- leafCount = nodePtr->child.arrayPtr->numUsed;
+ leafPtr = nodePtr->child.arrayPtr->els;
+ leafCount = nodePtr->child.arrayPtr->numUsed;
for ( ; leafCount > 0; leafPtr++, leafCount--) {
if (leafPtr->flags & CLASS && className != NULL) {
if (leafPtr->nameUid == classId &&
@@ -605,7 +586,7 @@ Tk_GetOption(tkwin, name, className)
}
}
}
-
+
return bestPtr->child.valueUid;
}
@@ -614,8 +595,8 @@ Tk_GetOption(tkwin, name, className)
*
* Tk_OptionObjCmd --
*
- * This procedure is invoked to process the "option" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "option" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -627,17 +608,16 @@ Tk_GetOption(tkwin, name, className)
*/
int
-Tk_OptionObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of Tcl_Obj arguments. */
- Tcl_Obj *CONST objv[]; /* Tcl_Obj arguments. */
+Tk_OptionObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of Tcl_Obj arguments. */
+ Tcl_Obj *CONST objv[]) /* Tcl_Obj arguments. */
{
Tk_Window tkwin = (Tk_Window) clientData;
int index, result;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
static CONST char *optionCmds[] = {
"add", "clear", "get", "readfile", NULL
@@ -657,85 +637,85 @@ Tk_OptionObjCmd(clientData, interp, objc, objv)
if (result != TCL_OK) {
return result;
}
-
+
result = TCL_OK;
switch ((enum optionVals) index) {
- case OPTION_ADD: {
- int priority;
- if ((objc != 4) && (objc != 5)) {
- Tcl_WrongNumArgs(interp, 2, objv, "pattern value ?priority?");
+ case OPTION_ADD: {
+ int priority;
+ if ((objc != 4) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pattern value ?priority?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 4) {
+ priority = TK_INTERACTIVE_PRIO;
+ } else {
+ priority = ParsePriority(interp, Tcl_GetString(objv[4]));
+ if (priority < 0) {
return TCL_ERROR;
}
+ }
+ Tk_AddOption(tkwin, Tcl_GetString(objv[2]), Tcl_GetString(objv[3]),
+ priority);
+ break;
+ }
- if (objc == 4) {
- priority = TK_INTERACTIVE_PRIO;
- } else {
- priority = ParsePriority(interp, Tcl_GetString(objv[4]));
- if (priority < 0) {
- return TCL_ERROR;
- }
- }
- Tk_AddOption(tkwin, Tcl_GetString(objv[2]),
- Tcl_GetString(objv[3]), priority);
- break;
+ case OPTION_CLEAR: {
+ TkMainInfo *mainPtr;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
+ return TCL_ERROR;
+ }
+ mainPtr = ((TkWindow *) tkwin)->mainPtr;
+ if (mainPtr->optionRootPtr != NULL) {
+ ClearOptionTree(mainPtr->optionRootPtr);
+ mainPtr->optionRootPtr = NULL;
}
+ tsdPtr->cachedWindow = NULL;
+ break;
+ }
- case OPTION_CLEAR: {
- TkMainInfo *mainPtr;
+ case OPTION_GET: {
+ Tk_Window window;
+ Tk_Uid value;
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, "");
- return TCL_ERROR;
- }
- mainPtr = ((TkWindow *) tkwin)->mainPtr;
- if (mainPtr->optionRootPtr != NULL) {
- ClearOptionTree(mainPtr->optionRootPtr);
- mainPtr->optionRootPtr = NULL;
- }
- tsdPtr->cachedWindow = NULL;
- break;
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window name class");
+ return TCL_ERROR;
+ }
+ window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
+ if (window == NULL) {
+ return TCL_ERROR;
}
+ value = Tk_GetOption(window, Tcl_GetString(objv[3]),
+ Tcl_GetString(objv[4]));
+ if (value != NULL) {
+ Tcl_SetResult(interp, (char *)value, TCL_STATIC);
+ }
+ break;
+ }
- case OPTION_GET: {
- Tk_Window window;
- Tk_Uid value;
-
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "window name class");
- return TCL_ERROR;
- }
- window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
- if (window == NULL) {
- return TCL_ERROR;
- }
- value = Tk_GetOption(window, Tcl_GetString(objv[3]),
- Tcl_GetString(objv[4]));
- if (value != NULL) {
- Tcl_SetResult(interp, (char *)value, TCL_STATIC);
- }
- break;
+ case OPTION_READFILE: {
+ int priority;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "fileName ?priority?");
+ return TCL_ERROR;
}
- case OPTION_READFILE: {
- int priority;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "fileName ?priority?");
+ if (objc == 4) {
+ priority = ParsePriority(interp, Tcl_GetString(objv[3]));
+ if (priority < 0) {
return TCL_ERROR;
}
-
- if (objc == 4) {
- priority = ParsePriority(interp, Tcl_GetString(objv[3]));
- if (priority < 0) {
- return TCL_ERROR;
- }
- } else {
- priority = TK_INTERACTIVE_PRIO;
- }
- result = ReadOptionFile(interp, tkwin, Tcl_GetString(objv[2]),
- priority);
- break;
+ } else {
+ priority = TK_INTERACTIVE_PRIO;
}
+ result = ReadOptionFile(interp, tkwin, Tcl_GetString(objv[2]),
+ priority);
+ break;
+ }
}
return result;
}
@@ -745,33 +725,31 @@ Tk_OptionObjCmd(clientData, interp, objc, objv)
*
* TkOptionDeadWindow --
*
- * This procedure is called whenever a window is deleted.
- * It cleans up any option-related stuff associated with
- * the window.
+ * This function is called whenever a window is deleted. It cleans up any
+ * option-related stuff associated with the window.
*
* Results:
* None.
*
* Side effects:
- * Option-related resources are freed. See code below
- * for details.
+ * Option-related resources are freed. See code below for details.
*
*--------------------------------------------------------------
*/
void
-TkOptionDeadWindow(winPtr)
- register TkWindow *winPtr; /* Window to be cleaned up. */
+TkOptionDeadWindow(
+ register TkWindow *winPtr) /* Window to be cleaned up. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* If this window is in the option stacks, then clear the stacks.
*
* XXX: OptionThreadExitProc will be invoked before DeleteWindowsExitProc
* XXX: if it is thread-specific (which it should be), invalidating the
- * XXX: tsd. Tk shutdown needs to be verified to handle this correctly.
+ * XXX: tsd. Tk shutdown needs to be verified to handle this correctly.
*/
if (tsdPtr->initialized && (winPtr->optionLevel != -1)) {
@@ -785,8 +763,7 @@ TkOptionDeadWindow(winPtr)
}
/*
- * If this window was a main window, then delete its option
- * database.
+ * If this window was a main window, then delete its option database.
*/
if ((winPtr->mainPtr != NULL) && (winPtr->mainPtr->winPtr == winPtr)
@@ -801,10 +778,9 @@ TkOptionDeadWindow(winPtr)
*
* TkOptionClassChanged --
*
- * This procedure is invoked when a window's class changes. If
- * the window is on the option cache, this procedure flushes
- * any information for the window, since the new class could change
- * what is relevant.
+ * This function is invoked when a window's class changes. If the window
+ * is on the option cache, this function flushes any information for the
+ * window, since the new class could change what is relevant.
*
* Results:
* None.
@@ -816,21 +792,21 @@ TkOptionDeadWindow(winPtr)
*/
void
-TkOptionClassChanged(winPtr)
- TkWindow *winPtr; /* Window whose class changed. */
+TkOptionClassChanged(
+ TkWindow *winPtr) /* Window whose class changed. */
{
int i, j, *basePtr;
ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->optionLevel == -1) {
return;
}
/*
- * Find the lowest stack level that refers to this window, then
- * flush all of the levels above the matching one.
+ * Find the lowest stack level that refers to this window, then flush all
+ * of the levels above the matching one.
*/
for (i = 1; i <= tsdPtr->curLevel; i++) {
@@ -863,9 +839,9 @@ TkOptionClassChanged(winPtr)
* Parse a string priority value.
*
* Results:
- * The return value is the integer priority level corresponding
- * to string, or -1 if string doesn't point to a valid priority level.
- * In this case, an error message is left in the interp's result.
+ * The return value is the integer priority level corresponding to
+ * string, or -1 if string doesn't point to a valid priority level. In
+ * this case, an error message is left in the interp's result.
*
* Side effects:
* None.
@@ -874,9 +850,9 @@ TkOptionClassChanged(winPtr)
*/
static int
-ParsePriority(interp, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- char *string; /* Describes a priority level, either
+ParsePriority(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ char *string) /* Describes a priority level, either
* symbolically or numerically. */
{
int priority, c;
@@ -902,10 +878,9 @@ ParsePriority(interp, string)
priority = strtoul(string, &end, 0);
if ((end == string) || (*end != 0) || (priority < 0)
|| (priority > 100)) {
- Tcl_AppendResult(interp, "bad priority level \"", string,
+ Tcl_AppendResult(interp, "bad priority level \"", string,
"\": must be widgetDefault, startupFile, userDefault, ",
- "interactive, or a number between 0 and 100",
- (char *) NULL);
+ "interactive, or a number between 0 and 100", NULL);
return -1;
}
}
@@ -917,17 +892,17 @@ ParsePriority(interp, string)
*
* AddFromString --
*
- * Given a string containing lines in the standard format for
- * X resources (see other documentation for details on what this
- * is), parse the resource specifications and enter them as options
- * for tkwin's main window.
+ * Given a string containing lines in the standard format for X resources
+ * (see other documentation for details on what this is), parse the
+ * resource specifications and enter them as options for tkwin's main
+ * window.
*
* Results:
- * The return value is a standard Tcl return code. In the case of
- * an error in parsing string, TCL_ERROR will be returned and an
- * error message will be left in the interp's result. The memory at
- * string is totally trashed by this procedure. If you care about
- * its contents, make a copy before calling here.
+ * The return value is a standard Tcl return code. In the case of an
+ * error in parsing string, TCL_ERROR will be returned and an error
+ * message will be left in the interp's result. The memory at string is
+ * totally trashed by this function. If you care about its contents, make
+ * a copy before calling here.
*
* Side effects:
* None.
@@ -936,15 +911,15 @@ ParsePriority(interp, string)
*/
static int
-AddFromString(interp, tkwin, string, priority)
- Tcl_Interp *interp; /* Interpreter to use for reporting results. */
- Tk_Window tkwin; /* Token for window: options are entered
- * for this window's main window. */
- char *string; /* String containing option specifiers. */
- int priority; /* Priority level to use for options in
- * this string, such as TK_USER_DEFAULT_PRIO
- * or TK_INTERACTIVE_PRIO. Must be between
- * 0 and TK_MAX_PRIO. */
+AddFromString(
+ Tcl_Interp *interp, /* Interpreter to use for reporting results. */
+ Tk_Window tkwin, /* Token for window: options are entered for
+ * this window's main window. */
+ char *string, /* String containing option specifiers. */
+ int priority) /* Priority level to use for options in this
+ * string, such as TK_USER_DEFAULT_PRIO or
+ * TK_INTERACTIVE_PRIO. Must be between 0 and
+ * TK_MAX_PRIO. */
{
register char *src, *dst;
char *name, *value;
@@ -975,7 +950,7 @@ AddFromString(interp, tkwin, string, priority)
src++;
lineNum++;
continue;
- }
+ }
if (*src == '\0') {
break;
}
@@ -989,7 +964,7 @@ AddFromString(interp, tkwin, string, priority)
while (*src != ':') {
if ((*src == '\0') || (*src == '\n')) {
char buf[32 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "missing colon on line %d", lineNum);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
@@ -1024,7 +999,7 @@ AddFromString(interp, tkwin, string, priority)
}
if (*src == '\0') {
char buf[32 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "missing value on line %d", lineNum);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
@@ -1039,7 +1014,7 @@ AddFromString(interp, tkwin, string, priority)
while (*src != '\n') {
if (*src == '\0') {
char buf[32 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "missing newline on line %d", lineNum);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
@@ -1071,13 +1046,13 @@ AddFromString(interp, tkwin, string, priority)
*
* ReadOptionFile --
*
- * Read a file of options ("resources" in the old X terminology)
- * and load them into the option database.
+ * Read a file of options ("resources" in the old X terminology) and load
+ * them into the option database.
*
* Results:
- * The return value is a standard Tcl return code. In the case of
- * an error in parsing string, TCL_ERROR will be returned and an
- * error message will be left in the interp's result.
+ * The return value is a standard Tcl return code. In the case of an
+ * error in parsing string, TCL_ERROR will be returned and an error
+ * message will be left in the interp's result.
*
* Side effects:
* None.
@@ -1086,15 +1061,15 @@ AddFromString(interp, tkwin, string, priority)
*/
static int
-ReadOptionFile(interp, tkwin, fileName, priority)
- Tcl_Interp *interp; /* Interpreter to use for reporting results. */
- Tk_Window tkwin; /* Token for window: options are entered
- * for this window's main window. */
- char *fileName; /* Name of file containing options. */
- int priority; /* Priority level to use for options in
- * this file, such as TK_USER_DEFAULT_PRIO
- * or TK_INTERACTIVE_PRIO. Must be between
- * 0 and TK_MAX_PRIO. */
+ReadOptionFile(
+ Tcl_Interp *interp, /* Interpreter to use for reporting results. */
+ Tk_Window tkwin, /* Token for window: options are entered for
+ * this window's main window. */
+ char *fileName, /* Name of file containing options. */
+ int priority) /* Priority level to use for options in this
+ * file, such as TK_USER_DEFAULT_PRIO or
+ * TK_INTERACTIVE_PRIO. Must be between 0 and
+ * TK_MAX_PRIO. */
{
CONST char *realName;
char *buffer;
@@ -1105,13 +1080,13 @@ ReadOptionFile(interp, tkwin, fileName, priority)
/*
* Prevent file system access in a safe interpreter.
*/
-
+
if (Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't read options from a file in a",
- " safe interpreter", (char *) NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(interp, "can't read options from a file in a",
+ " safe interpreter", NULL);
+ return TCL_ERROR;
}
-
+
realName = Tcl_TranslateFileName(interp, fileName, &newName);
if (realName == NULL) {
return TCL_ERROR;
@@ -1119,23 +1094,23 @@ ReadOptionFile(interp, tkwin, fileName, priority)
chan = Tcl_OpenFileChannel(interp, realName, "r", 0);
Tcl_DStringFree(&newName);
if (chan == NULL) {
- Tcl_ResetResult(interp);
+ Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't open \"", fileName,
- "\": ", Tcl_PosixError(interp), (char *) NULL);
+ "\": ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
/*
- * Compute size of file by seeking to the end of the file. This will
+ * Compute size of file by seeking to the end of the file. This will
* overallocate if we are performing CRLF translation.
*/
-
+
bufferSize = (int) Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_END);
(void) Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_SET);
if (bufferSize < 0) {
Tcl_AppendResult(interp, "error seeking to end of file \"",
- fileName, "\":", Tcl_PosixError(interp), (char *) NULL);
+ fileName, "\":", Tcl_PosixError(interp), NULL);
Tcl_Close(NULL, chan);
return TCL_ERROR;
@@ -1144,7 +1119,7 @@ ReadOptionFile(interp, tkwin, fileName, priority)
bufferSize = Tcl_Read(chan, buffer, bufferSize);
if (bufferSize < 0) {
Tcl_AppendResult(interp, "error reading file \"", fileName, "\":",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
Tcl_Close(NULL, chan);
return TCL_ERROR;
}
@@ -1163,9 +1138,8 @@ ReadOptionFile(interp, tkwin, fileName, priority)
* Create a new ElArray structure of a given size.
*
* Results:
- * The return value is a pointer to a properly initialized
- * element array with "numEls" space. The array is marked
- * as having no active elements.
+ * The return value is a pointer to a properly initialized element array
+ * with "numEls" space. The array is marked as having no active elements.
*
* Side effects:
* Memory is allocated.
@@ -1174,8 +1148,8 @@ ReadOptionFile(interp, tkwin, fileName, priority)
*/
static ElArray *
-NewArray(numEls)
- int numEls; /* How many elements of space to allocate. */
+NewArray(
+ int numEls) /* How many elements of space to allocate. */
{
register ElArray *arrayPtr;
@@ -1191,12 +1165,11 @@ NewArray(numEls)
*
* ExtendArray --
*
- * Add a new element to an array, extending the array if
- * necessary.
+ * Add a new element to an array, extending the array if necessary.
*
* Results:
- * The return value is a pointer to the new array, which
- * will be different from arrayPtr if the array got expanded.
+ * The return value is a pointer to the new array, which will be
+ * different from arrayPtr if the array got expanded.
*
* Side effects:
* Memory may be allocated or freed.
@@ -1205,9 +1178,9 @@ NewArray(numEls)
*/
static ElArray *
-ExtendArray(arrayPtr, elPtr)
- register ElArray *arrayPtr; /* Array to be extended. */
- register Element *elPtr; /* Element to be copied into array. */
+ExtendArray(
+ register ElArray *arrayPtr, /* Array to be extended. */
+ register Element *elPtr) /* Element to be copied into array. */
{
/*
* If the current array has filled up, make it bigger.
@@ -1220,8 +1193,8 @@ ExtendArray(arrayPtr, elPtr)
newPtr->arraySize = 2*arrayPtr->arraySize;
newPtr->numUsed = arrayPtr->numUsed;
newPtr->nextToUse = &newPtr->els[newPtr->numUsed];
- memcpy((VOID *) newPtr->els, (VOID *) arrayPtr->els,
- (arrayPtr->arraySize*sizeof(Element)));
+ memcpy(newPtr->els, arrayPtr->els,
+ arrayPtr->arraySize * sizeof(Element));
ckfree((char *) arrayPtr);
arrayPtr = newPtr;
}
@@ -1237,40 +1210,40 @@ ExtendArray(arrayPtr, elPtr)
*
* SetupStacks --
*
- * Arrange the stacks so that they cache all the option
- * information for a particular window.
+ * Arrange the stacks so that they cache all the option information for a
+ * particular window.
*
* Results:
* None.
*
* Side effects:
- * The stacks are modified to hold information for tkwin
- * and all its ancestors in the window hierarchy.
+ * The stacks are modified to hold information for tkwin and all its
+ * ancestors in the window hierarchy.
*
*--------------------------------------------------------------
*/
static void
-SetupStacks(winPtr, leaf)
- TkWindow *winPtr; /* Window for which information is to
- * be cached. */
- int leaf; /* Non-zero means this is the leaf
- * window being probed. Zero means this
- * is an ancestor of the desired leaf. */
+SetupStacks(
+ TkWindow *winPtr, /* Window for which information is to be
+ * cached. */
+ int leaf) /* Non-zero means this is the leaf window
+ * being probed. Zero means this is an
+ * ancestor of the desired leaf. */
{
int level, i, *iPtr;
register StackLevel *levelPtr;
register ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * The following array defines the order in which the current
- * stacks are searched to find matching entries to add to the
- * stacks. Given the current priority-based scheme, the order
- * below is no longer relevant; all that matters is that an
- * element is on the list *somewhere*. The ordering is a relic
- * of the old days when priorities were determined differently.
+ * The following array defines the order in which the current stacks are
+ * searched to find matching entries to add to the stacks. Given the
+ * current priority-based scheme, the order below is no longer relevant;
+ * all that matters is that an element is on the list *somewhere*. The
+ * ordering is a relic of the old days when priorities were determined
+ * differently.
*/
static int searchOrder[] = {WILDCARD_NODE_CLASS, WILDCARD_NODE_NAME,
@@ -1281,8 +1254,7 @@ SetupStacks(winPtr, leaf)
}
/*
- * Step 1: make sure that options are cached for this window's
- * parent.
+ * Step 1: make sure that options are cached for this window's parent.
*/
if (winPtr->parentPtr != NULL) {
@@ -1297,8 +1269,8 @@ SetupStacks(winPtr, leaf)
}
/*
- * Step 2: pop extra unneeded information off the stacks and
- * mark those windows as no longer having cached information.
+ * Step 2: pop extra unneeded information off the stacks and mark those
+ * windows as no longer having cached information.
*/
if (tsdPtr->curLevel >= level) {
@@ -1316,9 +1288,9 @@ SetupStacks(winPtr, leaf)
tsdPtr->curLevel = winPtr->optionLevel = level;
/*
- * Step 3: if the root database information isn't loaded or
- * isn't valid, initialize level 0 of the stack from the
- * database root (this only happens if winPtr is a main window).
+ * Step 3: if the root database information isn't loaded or isn't valid,
+ * initialize level 0 of the stack from the database root (this only
+ * happens if winPtr is a main window).
*/
if ((tsdPtr->curLevel == 1)
@@ -1333,19 +1305,18 @@ SetupStacks(winPtr, leaf)
}
/*
- * Step 4: create a new stack level; grow the level array if
- * we've run out of levels. Clear the stacks for EXACT_LEAF_NAME
- * and EXACT_LEAF_CLASS (anything that was there is of no use
- * any more).
+ * Step 4: create a new stack level; grow the level array if we've run out
+ * of levels. Clear the stacks for EXACT_LEAF_NAME and EXACT_LEAF_CLASS
+ * (anything that was there is of no use any more).
*/
if (tsdPtr->curLevel >= tsdPtr->numLevels) {
StackLevel *newLevels;
newLevels = (StackLevel *) ckalloc((unsigned)
- (tsdPtr->numLevels*2*sizeof(StackLevel)));
- memcpy((VOID *) newLevels, (VOID *) tsdPtr->levels,
- (tsdPtr->numLevels*sizeof(StackLevel)));
+ (tsdPtr->numLevels * 2 * sizeof(StackLevel)));
+ memcpy(newLevels, tsdPtr->levels,
+ tsdPtr->numLevels * sizeof(StackLevel));
ckfree((char *) tsdPtr->levels);
tsdPtr->numLevels *= 2;
tsdPtr->levels = newLevels;
@@ -1361,10 +1332,10 @@ SetupStacks(winPtr, leaf)
for (i = 0; i < NUM_STACKS; i++) {
levelPtr->bases[i] = tsdPtr->stacks[i]->numUsed;
}
+
/*
* Step 5: scan the current stack level looking for matches to this
- * window's name or class; where found, add new information to the
- * stacks.
+ * window's name or class; where found, add new information to the stacks.
*/
for (iPtr = searchOrder; *iPtr != -1; iPtr++) {
@@ -1382,8 +1353,8 @@ SetupStacks(winPtr, leaf)
count = levelPtr->bases[i];
/*
- * For wildcard stacks, check all entries; for non-wildcard
- * stacks, only check things that matched in the parent.
+ * For wildcard stacks, check all entries; for non-wildcard stacks,
+ * only check things that matched in the parent.
*/
if (!(i & WILDCARD)) {
@@ -1405,9 +1376,8 @@ SetupStacks(winPtr, leaf)
*
* ExtendStacks --
*
- * Given an element array, copy all the elements from the
- * array onto the system stacks (except for irrelevant leaf
- * elements).
+ * Given an element array, copy all the elements from the array onto the
+ * system stacks (except for irrelevant leaf elements).
*
* Results:
* None.
@@ -1419,23 +1389,23 @@ SetupStacks(winPtr, leaf)
*/
static void
-ExtendStacks(arrayPtr, leaf)
- ElArray *arrayPtr; /* Array of elements to copy onto stacks. */
- int leaf; /* If zero, then don't copy exact leaf
+ExtendStacks(
+ ElArray *arrayPtr, /* Array of elements to copy onto stacks. */
+ int leaf) /* If zero, then don't copy exact leaf
* elements. */
{
register int count;
register Element *elPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (elPtr = arrayPtr->els, count = arrayPtr->numUsed;
count > 0; elPtr++, count--) {
if (!(elPtr->flags & (NODE|WILDCARD)) && !leaf) {
continue;
}
- tsdPtr->stacks[elPtr->flags] = ExtendArray(
- tsdPtr->stacks[elPtr->flags], elPtr);
+ tsdPtr->stacks[elPtr->flags] =
+ ExtendArray(tsdPtr->stacks[elPtr->flags], elPtr);
}
}
@@ -1456,14 +1426,15 @@ ExtendStacks(arrayPtr, leaf)
*/
static void
-OptionThreadExitProc(clientData)
- ClientData clientData; /* not used */
+OptionThreadExitProc(
+ ClientData clientData) /* not used */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->initialized) {
int i;
+
for (i = 0; i < NUM_STACKS; i++) {
ckfree((char *) tsdPtr->stacks[i]);
}
@@ -1489,35 +1460,35 @@ OptionThreadExitProc(clientData)
*/
static void
-OptionInit(mainPtr)
- register TkMainInfo *mainPtr; /* Top-level information about
- * window that isn't initialized
- * yet. */
+OptionInit(
+ register TkMainInfo *mainPtr)
+ /* Top-level information about window that
+ * isn't initialized yet. */
{
int i;
Tcl_Interp *interp;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Element *defaultMatchPtr = &tsdPtr->defaultMatch;
/*
* First, once-only initialization.
*/
-
+
if (tsdPtr->initialized == 0) {
- tsdPtr->initialized = 1;
- tsdPtr->cachedWindow = NULL;
+ tsdPtr->initialized = 1;
+ tsdPtr->cachedWindow = NULL;
tsdPtr->numLevels = 5;
tsdPtr->curLevel = -1;
tsdPtr->serial = 0;
- tsdPtr->levels = (StackLevel *) ckalloc((unsigned)
- (5*sizeof(StackLevel)));
+ tsdPtr->levels = (StackLevel *)
+ ckalloc((unsigned) (5*sizeof(StackLevel)));
for (i = 0; i < NUM_STACKS; i++) {
tsdPtr->stacks[i] = NewArray(10);
tsdPtr->levels[0].bases[i] = 0;
}
-
+
defaultMatchPtr->nameUid = NULL;
defaultMatchPtr->child.valueUid = NULL;
defaultMatchPtr->priority = -1;
@@ -1526,7 +1497,7 @@ OptionInit(mainPtr)
}
/*
- * Then, per-main-window initialization. Create and delete dummy
+ * Then, per-main-window initialization. Create and delete dummy
* interpreter for message logging.
*/
@@ -1541,23 +1512,22 @@ OptionInit(mainPtr)
*
* ClearOptionTree --
*
- * This procedure is called to erase everything in a
- * hierarchical option database.
+ * This function is called to erase everything in a hierarchical option
+ * database.
*
* Results:
* None.
*
* Side effects:
- * All the options associated with arrayPtr are deleted,
- * along with all option subtrees. The space pointed to
- * by arrayPtr is freed.
+ * All the options associated with arrayPtr are deleted, along with all
+ * option subtrees. The space pointed to by arrayPtr is freed.
*
*--------------------------------------------------------------
*/
static void
-ClearOptionTree(arrayPtr)
- ElArray *arrayPtr; /* Array of options; delete everything
+ClearOptionTree(
+ ElArray *arrayPtr) /* Array of options; delete everything
* referred to recursively by this. */
{
register Element *elPtr;
@@ -1577,28 +1547,27 @@ ClearOptionTree(arrayPtr)
*
* GetDefaultOptions --
*
- * This procedure is invoked to load the default set of options
- * for a window.
+ * This function is invoked to load the default set of options for a
+ * window.
*
* Results:
* None.
*
* Side effects:
- * Options are added to those for winPtr's main window. If
- * there exists a RESOURCE_MANAGER proprety for winPtr's
- * display, that is used. Otherwise, the .Xdefaults file in
- * the user's home directory is used.
+ * Options are added to those for winPtr's main window. If there exists a
+ * RESOURCE_MANAGER proprety for winPtr's display, that is used.
+ * Otherwise, the .Xdefaults file in the user's home directory is used.
*
*--------------------------------------------------------------
*/
static int
-GetDefaultOptions(interp, winPtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- TkWindow *winPtr; /* Fetch option defaults for main window
+GetDefaultOptions(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ TkWindow *winPtr) /* Fetch option defaults for main window
* associated with this. */
{
- char *regProp;
+ char *regProp, **regPropPtr = &regProp;
int result, actualFormat;
unsigned long numItems, bytesAfter;
Atom actualType;
@@ -1609,10 +1578,9 @@ GetDefaultOptions(interp, winPtr)
regProp = NULL;
result = XGetWindowProperty(winPtr->display,
- RootWindow(winPtr->display, 0),
- XA_RESOURCE_MANAGER, 0, 100000,
- False, XA_STRING, &actualType, &actualFormat,
- &numItems, &bytesAfter, (unsigned char **) &regProp);
+ RootWindow(winPtr->display, 0), XA_RESOURCE_MANAGER, 0, 100000,
+ False, XA_STRING, &actualType, &actualFormat, &numItems,
+ &bytesAfter, (unsigned char **) regPropPtr);
if ((result == Success) && (actualType == XA_STRING)
&& (actualFormat == 8)) {
@@ -1623,8 +1591,7 @@ GetDefaultOptions(interp, winPtr)
}
/*
- * No luck there. Try a .Xdefaults file in the user's home
- * directory.
+ * No luck there. Try a .Xdefaults file in the user's home directory.
*/
if (regProp != NULL) {
@@ -1634,3 +1601,11 @@ GetDefaultOptions(interp, winPtr)
TK_USER_DEFAULT_PRIO);
return result;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 8498df6..47eddd6 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -1,22 +1,21 @@
-/*
+/*
* tkPack.c --
*
- * This file contains code to implement the "packer"
- * geometry manager for Tk.
+ * This file contains code to implement the "packer" geometry manager for
+ * Tk.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
static CONST char *sideNames[] = {
- "top", "bottom", "left", "right", (char *) NULL
+ "top", "bottom", "left", "right", NULL
};
/* For each window that the packer cares about (either because
@@ -26,70 +25,68 @@ static CONST char *sideNames[] = {
*/
typedef struct Packer {
- Tk_Window tkwin; /* Tk token for window. NULL means that
- * the window has been deleted, but the
- * packet hasn't had a chance to clean up
- * yet because the structure is still in
- * use. */
- struct Packer *masterPtr; /* Master window within which this window
- * is packed (NULL means this window
- * isn't managed by the packer). */
- struct Packer *nextPtr; /* Next window packed within same
- * parent. List is priority-ordered:
- * first on list gets packed first. */
- struct Packer *slavePtr; /* First in list of slaves packed
- * inside this window (NULL means
- * no packed slaves). */
- Side side; /* Side of parent against which
- * this window is packed. */
+ Tk_Window tkwin; /* Tk token for window. NULL means that the
+ * window has been deleted, but the packet
+ * hasn't had a chance to clean up yet because
+ * the structure is still in use. */
+ struct Packer *masterPtr; /* Master window within which this window is
+ * packed (NULL means this window isn't
+ * managed by the packer). */
+ struct Packer *nextPtr; /* Next window packed within same master.
+ * List is priority-ordered: first on list
+ * gets packed first. */
+ struct Packer *slavePtr; /* First in list of slaves packed inside this
+ * window (NULL means no packed slaves). */
+ Side side; /* Side of master against which this window is
+ * packed. */
Tk_Anchor anchor; /* If frame allocated for window is larger
- * than window needs, this indicates how
- * where to position window in frame. */
+ * than window needs, this indicates how where
+ * to position window in frame. */
int padX, padY; /* Total additional pixels to leave around the
- * window. Some is of this space is on each
- * side. This is space *outside* the window:
+ * window. Some is of this space is on each
+ * side. This is space *outside* the window:
* we'll allocate extra space in frame but
* won't enlarge window). */
- int padLeft, padTop; /* The part of padX or padY to use on the
- * left or top of the widget, respectively.
- * By default, this is half of padX or padY. */
+ int padLeft, padTop; /* The part of padX or padY to use on the left
+ * or top of the widget, respectively. By
+ * default, this is half of padX or padY. */
int iPadX, iPadY; /* Total extra pixels to allocate inside the
* window (half of this amount will appear on
* each side). */
- int doubleBw; /* Twice the window's last known border
- * width. If this changes, the window
- * must be repacked within its parent. */
- int *abortPtr; /* If non-NULL, it means that there is a nested
- * call to ArrangePacking already working on
- * this window. *abortPtr may be set to 1 to
- * abort that nested call. This happens, for
- * example, if tkwin or any of its slaves
- * is deleted. */
- int flags; /* Miscellaneous flags; see below
- * for definitions. */
+ int doubleBw; /* Twice the window's last known border width.
+ * If this changes, the window must be
+ * repacked within its master. */
+ int *abortPtr; /* If non-NULL, it means that there is a
+ * nested call to ArrangePacking already
+ * working on this window. *abortPtr may be
+ * set to 1 to abort that nested call. This
+ * happens, for example, if tkwin or any of
+ * its slaves is deleted. */
+ int flags; /* Miscellaneous flags; see below for
+ * definitions. */
} Packer;
/*
* Flag values for Packer structures:
*
- * REQUESTED_REPACK: 1 means a Tcl_DoWhenIdle request
- * has already been made to repack
- * all the slaves of this window.
- * FILLX: 1 means if frame allocated for window
- * is wider than window needs, expand window
- * to fill frame. 0 means don't make window
- * any larger than needed.
+ * REQUESTED_REPACK: 1 means a Tcl_DoWhenIdle request has already
+ * been made to repack all the slaves of this
+ * window.
+ * FILLX: 1 means if frame allocated for window is wider
+ * than window needs, expand window to fill
+ * frame. 0 means don't make window any larger
+ * than needed.
* FILLY: Same as FILLX, except for height.
* EXPAND: 1 means this window's frame will absorb any
- * extra space in the parent window.
- * OLD_STYLE: 1 means this window is being managed with
- * the old-style packer algorithms (before
- * Tk version 3.3). The main difference is
- * that padding and filling are done differently.
+ * extra space in the master window.
+ * OLD_STYLE: 1 means this window is being managed with the
+ * old-style packer algorithms (before Tk version
+ * 3.3). The main difference is that padding and
+ * filling are done differently.
* DONT_PROPAGATE: 1 means don't set this window's requested
- * size. 0 means if this window is a master
- * then Tk will set its requested size to fit
- * the needs of its slaves.
+ * size. 0 means if this window is a master then
+ * Tk will set its requested size to fit the
+ * needs of its slaves.
*/
#define REQUESTED_REPACK 1
@@ -100,52 +97,44 @@ typedef struct Packer {
#define DONT_PROPAGATE 32
/*
- * The following structure is the official type record for the
- * packer:
+ * The following structure is the official type record for the packer:
*/
-static void PackReqProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void PackLostSlaveProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
+static void PackReqProc(ClientData clientData, Tk_Window tkwin);
+static void PackLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
-static Tk_GeomMgr packerType = {
+static const Tk_GeomMgr packerType = {
"pack", /* name */
PackReqProc, /* requestProc */
PackLostSlaveProc, /* lostSlaveProc */
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void ArrangePacking _ANSI_ARGS_((ClientData clientData));
-static int ConfigureSlaves _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, int objc, Tcl_Obj *CONST objv[]));
-static void DestroyPacker _ANSI_ARGS_((char *memPtr));
-static Packer * GetPacker _ANSI_ARGS_((Tk_Window tkwin));
-static int PackAfter _ANSI_ARGS_((Tcl_Interp *interp,
- Packer *prevPtr, Packer *masterPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static void PackReqProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void PackStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void Unlink _ANSI_ARGS_((Packer *packPtr));
-static int XExpansion _ANSI_ARGS_((Packer *slavePtr,
- int cavityWidth));
-static int YExpansion _ANSI_ARGS_((Packer *slavePtr,
- int cavityHeight));
+static void ArrangePacking(ClientData clientData);
+static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DestroyPacker(char *memPtr);
+static Packer * GetPacker(Tk_Window tkwin);
+static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
+ Packer *masterPtr, int objc,Tcl_Obj *CONST objv[]);
+static void PackStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static void Unlink(Packer *packPtr);
+static int XExpansion(Packer *slavePtr, int cavityWidth);
+static int YExpansion(Packer *slavePtr, int cavityHeight);
/*
*--------------------------------------------------------------
*
* TkPrintPadAmount --
*
- * This procedure generates a text value that describes one
- * of the -padx, -pady, -ipadx, or -ipady configuration options.
- * The text value generated is appended to the interpreter
- * result.
+ * This function generates a text value that describes one of the -padx,
+ * -pady, -ipadx, or -ipady configuration options. The text value
+ * generated is appended to the interpreter result.
*
* Results:
* None.
@@ -155,13 +144,14 @@ static int YExpansion _ANSI_ARGS_((Packer *slavePtr,
*
*--------------------------------------------------------------
*/
-void
-TkPrintPadAmount(interp, switchName, halfSpace, allSpace)
- Tcl_Interp *interp; /* The interpreter into which the result
- * is written. */
- char *switchName; /* One of "padx", "pady", "ipadx" or "ipady" */
- int halfSpace; /* The left or top padding amount */
- int allSpace; /* The total amount of padding */
+
+void
+TkPrintPadAmount(
+ Tcl_Interp *interp, /* The interpreter into which the result is
+ * written. */
+ char *switchName, /* One of "padx", "pady", "ipadx" or "ipady" */
+ int halfSpace, /* The left or top padding amount */
+ int allSpace) /* The total amount of padding */
{
char buffer[60 + 2*TCL_INTEGER_SPACE];
if (halfSpace*2 == allSpace) {
@@ -170,17 +160,16 @@ TkPrintPadAmount(interp, switchName, halfSpace, allSpace)
sprintf(buffer, " -%.10s {%d %d}", switchName, halfSpace,
allSpace - halfSpace);
}
- Tcl_AppendResult(interp, buffer, (char *)NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
}
-
/*
*--------------------------------------------------------------
*
* Tk_PackCmd --
*
- * This procedure is invoked to process the "pack" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "pack" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -192,19 +181,18 @@ TkPrintPadAmount(interp, switchName, halfSpace, allSpace)
*/
int
-Tk_PackObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_PackObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
char *argv2;
static CONST char *optionStrings[] = {
/* after, append, before and unpack are deprecated */
"after", "append", "before", "unpack",
- "configure", "forget", "info", "propagate", "slaves", (char *) NULL };
+ "configure", "forget", "info", "propagate", "slaves", NULL };
enum options {
PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK,
PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
@@ -224,9 +212,8 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
&index) != TCL_OK) {
/*
- * Call it again without the deprecated ones to get a proper
- * error message.
- * This works well since there can't be any ambiguity between
+ * Call it again without the deprecated ones to get a proper error
+ * message. This works well since there can't be any ambiguity between
* deprecated and new options.
*/
@@ -237,7 +224,8 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
}
argv2 = Tcl_GetString(objv[2]);
- if (index == PACK_AFTER) {
+ switch ((enum options) index) {
+ case PACK_AFTER: {
Packer *prevPtr;
Tk_Window tkwin2;
@@ -247,11 +235,12 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
prevPtr = GetPacker(tkwin2);
if (prevPtr->masterPtr == NULL) {
Tcl_AppendResult(interp, "window \"", argv2,
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
return PackAfter(interp, prevPtr, prevPtr->masterPtr, objc-3, objv+3);
- } else if (index == PACK_APPEND) {
+ }
+ case PACK_APPEND: {
Packer *masterPtr;
register Packer *prevPtr;
Tk_Window tkwin2;
@@ -267,7 +256,8 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
}
}
return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
- } else if (index == PACK_BEFORE) {
+ }
+ case PACK_BEFORE: {
Packer *packPtr, *masterPtr;
register Packer *prevPtr;
Tk_Window tkwin2;
@@ -278,7 +268,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
packPtr = GetPacker(tkwin2);
if (packPtr->masterPtr == NULL) {
Tcl_AppendResult(interp, "window \"", argv2,
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
masterPtr = packPtr->masterPtr;
@@ -288,7 +278,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
} else {
for ( ; ; prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
- panic("\"pack before\" couldn't find predecessor");
+ Tcl_Panic("\"pack before\" couldn't find predecessor");
}
if (prevPtr->nextPtr == packPtr) {
break;
@@ -296,14 +286,15 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
}
}
return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
- } else if (index == PACK_CONFIGURE) {
+ }
+ case PACK_CONFIGURE:
if (argv2[0] != '.') {
Tcl_AppendResult(interp, "bad argument \"", argv2,
- "\": must be name of window", (char *) NULL);
+ "\": must be name of window", NULL);
return TCL_ERROR;
}
return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
- } else if (index == PACK_FORGET) {
+ case PACK_FORGET: {
Tk_Window slave;
Packer *slavePtr;
int i;
@@ -314,7 +305,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
}
slavePtr = GetPacker(slave);
if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
- Tk_ManageGeometry(slave, (Tk_GeomMgr *) NULL,
+ Tk_ManageGeometry(slave, NULL,
(ClientData) NULL);
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin,
@@ -324,7 +315,9 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
Tk_UnmapWindow(slavePtr->tkwin);
}
}
- } else if (index == PACK_INFO) {
+ break;
+ }
+ case PACK_INFO: {
register Packer *slavePtr;
Tk_Window slave;
@@ -338,7 +331,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
slavePtr = GetPacker(slave);
if (slavePtr->masterPtr == NULL) {
Tcl_AppendResult(interp, "window \"", argv2,
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
Tcl_AppendElement(interp, "-in");
@@ -346,29 +339,29 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
Tcl_AppendElement(interp, "-anchor");
Tcl_AppendElement(interp, Tk_NameOfAnchor(slavePtr->anchor));
Tcl_AppendResult(interp, " -expand ",
- (slavePtr->flags & EXPAND) ? "1" : "0", " -fill ",
- (char *) NULL);
+ (slavePtr->flags & EXPAND) ? "1" : "0", " -fill ", NULL);
switch (slavePtr->flags & (FILLX|FILLY)) {
- case 0:
- Tcl_AppendResult(interp, "none", (char *) NULL);
- break;
- case FILLX:
- Tcl_AppendResult(interp, "x", (char *) NULL);
- break;
- case FILLY:
- Tcl_AppendResult(interp, "y", (char *) NULL);
- break;
- case FILLX|FILLY:
- Tcl_AppendResult(interp, "both", (char *) NULL);
- break;
+ case 0:
+ Tcl_AppendResult(interp, "none", NULL);
+ break;
+ case FILLX:
+ Tcl_AppendResult(interp, "x", NULL);
+ break;
+ case FILLY:
+ Tcl_AppendResult(interp, "y", NULL);
+ break;
+ case FILLX|FILLY:
+ Tcl_AppendResult(interp, "both", NULL);
+ break;
}
- TkPrintPadAmount(interp, "ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
- TkPrintPadAmount(interp, "ipady", slavePtr->iPadY/2, slavePtr->iPadY);
- TkPrintPadAmount(interp, "padx", slavePtr->padLeft, slavePtr->padX);
- TkPrintPadAmount(interp, "pady", slavePtr->padTop, slavePtr->padY);
- Tcl_AppendResult(interp, " -side ", sideNames[slavePtr->side],
- (char *) NULL);
- } else if (index == PACK_PROPAGATE) {
+ TkPrintPadAmount(interp, "ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
+ TkPrintPadAmount(interp, "ipady", slavePtr->iPadY/2, slavePtr->iPadY);
+ TkPrintPadAmount(interp, "padx", slavePtr->padLeft, slavePtr->padX);
+ TkPrintPadAmount(interp, "pady", slavePtr->padTop, slavePtr->padY);
+ Tcl_AppendResult(interp, " -side ", sideNames[slavePtr->side], NULL);
+ break;
+ }
+ case PACK_PROPAGATE: {
Tk_Window master;
Packer *masterPtr;
int propagate;
@@ -407,7 +400,9 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
} else {
masterPtr->flags |= DONT_PROPAGATE;
}
- } else if (index == PACK_SLAVES) {
+ break;
+ }
+ case PACK_SLAVES: {
Tk_Window master;
Packer *masterPtr, *slavePtr;
@@ -423,7 +418,9 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
slavePtr = slavePtr->nextPtr) {
Tcl_AppendElement(interp, Tk_PathName(slavePtr->tkwin));
}
- } else if (index == PACK_UNPACK) {
+ break;
+ }
+ case PACK_UNPACK: {
Tk_Window tkwin2;
Packer *packPtr;
@@ -436,7 +433,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
}
packPtr = GetPacker(tkwin2);
if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) {
- Tk_ManageGeometry(tkwin2, (Tk_GeomMgr *) NULL,
+ Tk_ManageGeometry(tkwin2, NULL,
(ClientData) NULL);
if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
Tk_UnmaintainGeometry(packPtr->tkwin,
@@ -445,6 +442,8 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
Unlink(packPtr);
Tk_UnmapWindow(packPtr->tkwin);
}
+ break;
+ }
}
return TCL_OK;
@@ -455,27 +454,26 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
*
* PackReqProc --
*
- * This procedure is invoked by Tk_GeometryRequest for
- * windows managed by the packer.
+ * This function is invoked by Tk_GeometryRequest for windows managed by
+ * the packer.
*
* Results:
* None.
*
* Side effects:
- * Arranges for tkwin, and all its managed siblings, to
- * be re-packed at the next idle point.
+ * Arranges for tkwin, and all its managed siblings, to be re-packed at
+ * the next idle point.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
-PackReqProc(clientData, tkwin)
- ClientData clientData; /* Packer's information about
- * window that got new preferred
- * geometry. */
- Tk_Window tkwin; /* Other Tk-related information
- * about the window. */
+PackReqProc(
+ ClientData clientData, /* Packer's information about window that got
+ * new preferred geometry. */
+ Tk_Window tkwin) /* Other Tk-related information about the
+ * window. */
{
register Packer *packPtr = (Packer *) clientData;
@@ -491,8 +489,8 @@ PackReqProc(clientData, tkwin)
*
* PackLostSlaveProc --
*
- * This procedure is invoked by Tk whenever some other geometry
- * claims control over a slave that used to be managed by us.
+ * This function is invoked by Tk whenever some other geometry claims
+ * control over a slave that used to be managed by us.
*
* Results:
* None.
@@ -505,10 +503,10 @@ PackReqProc(clientData, tkwin)
/* ARGSUSED */
static void
-PackLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Packer structure for slave window that
- * was stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+PackLostSlaveProc(
+ ClientData clientData, /* Packer structure for slave window that was
+ * stolen away. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
register Packer *slavePtr = (Packer *) clientData;
@@ -524,38 +522,36 @@ PackLostSlaveProc(clientData, tkwin)
*
* ArrangePacking --
*
- * This procedure is invoked (using the Tcl_DoWhenIdle
- * mechanism) to re-layout a set of windows managed by
- * the packer. It is invoked at idle time so that a
- * series of packer requests can be merged into a single
- * layout operation.
+ * This function is invoked (using the Tcl_DoWhenIdle mechanism) to
+ * re-layout a set of windows managed by the packer. It is invoked at
+ * idle time so that a series of packer requests can be merged into a
+ * single layout operation.
*
* Results:
* None.
*
* Side effects:
- * The packed slaves of masterPtr may get resized or
- * moved.
+ * The packed slaves of masterPtr may get resized or moved.
*
*--------------------------------------------------------------
*/
static void
-ArrangePacking(clientData)
- ClientData clientData; /* Structure describing parent whose slaves
+ArrangePacking(
+ ClientData clientData) /* Structure describing master whose slaves
* are to be re-layed out. */
{
register Packer *masterPtr = (Packer *) clientData;
- register Packer *slavePtr;
+ register Packer *slavePtr;
int cavityX, cavityY, cavityWidth, cavityHeight;
/* These variables keep track of the
- * as-yet-unallocated space remaining in
- * the middle of the parent window. */
+ * as-yet-unallocated space remaining in the
+ * middle of the master window. */
int frameX, frameY, frameWidth, frameHeight;
/* These variables keep track of the frame
* allocated to the current window. */
- int x, y, width, height; /* These variables are used to hold the
- * actual geometry of the current window. */
+ int x, y, width, height; /* These variables are used to hold the actual
+ * geometry of the current window. */
int abort; /* May get set to non-zero to abort this
* repacking operation. */
int borderX, borderY;
@@ -566,8 +562,8 @@ ArrangePacking(clientData)
masterPtr->flags &= ~REQUESTED_REPACK;
/*
- * If the parent has no slaves anymore, then don't do anything
- * at all: just leave the parent's size as-is.
+ * If the master has no slaves anymore, then don't do anything at all:
+ * just leave the master's size as-is.
*/
if (masterPtr->slavePtr == NULL) {
@@ -575,9 +571,9 @@ ArrangePacking(clientData)
}
/*
- * Abort any nested call to ArrangePacking for this window, since
- * we'll do everything necessary here, and set up so this call
- * can be aborted if necessary.
+ * Abort any nested call to ArrangePacking for this window, since we'll do
+ * everything necessary here, and set up so this call can be aborted if
+ * necessary.
*/
if (masterPtr->abortPtr != NULL) {
@@ -588,22 +584,19 @@ ArrangePacking(clientData)
Tcl_Preserve((ClientData) masterPtr);
/*
- * Pass #1: scan all the slaves to figure out the total amount
- * of space needed. Two separate width and height values are
- * computed:
+ * Pass #1: scan all the slaves to figure out the total amount of space
+ * needed. Two separate width and height values are computed:
*
- * width - Holds the sum of the widths (plus padding) of
- * all the slaves seen so far that were packed LEFT
- * or RIGHT.
- * height - Holds the sum of the heights (plus padding) of
- * all the slaves seen so far that were packed TOP
- * or BOTTOM.
+ * width - Holds the sum of the widths (plus padding) of all the
+ * slaves seen so far that were packed LEFT or RIGHT.
+ * height - Holds the sum of the heights (plus padding) of all the
+ * slaves seen so far that were packed TOP or BOTTOM.
*
- * maxWidth - Gradually builds up the width needed by the master
- * to just barely satisfy all the slave's needs. For
- * each slave, the code computes the width needed for
- * all the slaves so far and updates maxWidth if the
- * new value is greater.
+ * maxWidth - Gradually builds up the width needed by the master to
+ * just barely satisfy all the slave's needs. For each
+ * slave, the code computes the width needed for all the
+ * slaves so far and updates maxWidth if the new value is
+ * greater.
* maxHeight - Same as maxWidth, except keeps height info.
*/
@@ -646,11 +639,10 @@ ArrangePacking(clientData)
}
/*
- * If the total amount of space needed in the parent window has
- * changed, and if we're propagating geometry information, then
- * notify the next geometry manager up and requeue ourselves to
- * start again after the parent has had a chance to
- * resize us.
+ * If the total amount of space needed in the master window has changed,
+ * and if we're propagating geometry information, then notify the next
+ * geometry manager up and requeue ourselves to start again after the
+ * master has had a chance to resize us.
*/
if (((maxWidth != Tk_ReqWidth(masterPtr->tkwin))
@@ -663,14 +655,12 @@ ArrangePacking(clientData)
}
/*
- * Pass #2: scan the slaves a second time assigning
- * new sizes. The "cavity" variables keep track of the
- * unclaimed space in the cavity of the window; this
- * shrinks inward as we allocate windows around the
- * edges. The "frame" variables keep track of the space
- * allocated to the current window and its frame. The
- * current window is then placed somewhere inside the
- * frame, depending on anchor.
+ * Pass #2: scan the slaves a second time assigning new sizes. The
+ * "cavity" variables keep track of the unclaimed space in the cavity of
+ * the window; this shrinks inward as we allocate windows around the
+ * edges. The "frame" variables keep track of the space allocated to the
+ * current window and its frame. The current window is then placed
+ * somewhere inside the frame, depending on anchor.
*/
cavityX = x = Tk_InternalBorderLeft(masterPtr->tkwin);
@@ -724,13 +714,12 @@ ArrangePacking(clientData)
}
/*
- * Now that we've got the size of the frame for the window,
- * compute the window's actual size and location using the
- * fill, padding, and frame factors. The variables "borderX"
- * and "borderY" are used to handle the differences between
- * old-style packing and the new style (in old-style, iPadX
- * and iPadY are always zero and padding is completely ignored
- * except when computing frame size).
+ * Now that we've got the size of the frame for the window, compute
+ * the window's actual size and location using the fill, padding, and
+ * frame factors. The variables "borderX" and "borderY" are used to
+ * handle the differences between old-style packing and the new style
+ * (in old-style, iPadX and iPadY are always zero and padding is
+ * completely ignored except when computing frame size).
*/
if (slavePtr->flags & OLD_STYLE) {
@@ -758,52 +747,52 @@ ArrangePacking(clientData)
height = frameHeight - borderY;
}
switch (slavePtr->anchor) {
- case TK_ANCHOR_N:
- x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
- y = frameY + borderTop;
- break;
- case TK_ANCHOR_NE:
- x = frameX + frameWidth - width - borderRight;
- y = frameY + borderTop;
- break;
- case TK_ANCHOR_E:
- x = frameX + frameWidth - width - borderRight;
- y = frameY + (borderTop + frameHeight - height - borderBtm)/2;
- break;
- case TK_ANCHOR_SE:
- x = frameX + frameWidth - width - borderRight;
- y = frameY + frameHeight - height - borderBtm;
- break;
- case TK_ANCHOR_S:
- x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
- y = frameY + frameHeight - height - borderBtm;
- break;
- case TK_ANCHOR_SW:
- x = frameX + borderLeft;
- y = frameY + frameHeight - height - borderBtm;
- break;
- case TK_ANCHOR_W:
- x = frameX + borderLeft;
- y = frameY + (borderTop + frameHeight - height - borderBtm)/2;
- break;
- case TK_ANCHOR_NW:
- x = frameX + borderLeft;
- y = frameY + borderTop;
- break;
- case TK_ANCHOR_CENTER:
- x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
- y = frameY + (borderTop + frameHeight - height - borderBtm)/2;
- break;
- default:
- panic("bad frame factor in ArrangePacking");
+ case TK_ANCHOR_N:
+ x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
+ y = frameY + borderTop;
+ break;
+ case TK_ANCHOR_NE:
+ x = frameX + frameWidth - width - borderRight;
+ y = frameY + borderTop;
+ break;
+ case TK_ANCHOR_E:
+ x = frameX + frameWidth - width - borderRight;
+ y = frameY + (borderTop + frameHeight - height - borderBtm)/2;
+ break;
+ case TK_ANCHOR_SE:
+ x = frameX + frameWidth - width - borderRight;
+ y = frameY + frameHeight - height - borderBtm;
+ break;
+ case TK_ANCHOR_S:
+ x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
+ y = frameY + frameHeight - height - borderBtm;
+ break;
+ case TK_ANCHOR_SW:
+ x = frameX + borderLeft;
+ y = frameY + frameHeight - height - borderBtm;
+ break;
+ case TK_ANCHOR_W:
+ x = frameX + borderLeft;
+ y = frameY + (borderTop + frameHeight - height - borderBtm)/2;
+ break;
+ case TK_ANCHOR_NW:
+ x = frameX + borderLeft;
+ y = frameY + borderTop;
+ break;
+ case TK_ANCHOR_CENTER:
+ x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
+ y = frameY + (borderTop + frameHeight - height - borderBtm)/2;
+ break;
+ default:
+ Tcl_Panic("bad frame factor in ArrangePacking");
}
width -= slavePtr->doubleBw;
height -= slavePtr->doubleBw;
/*
* The final step is to set the position, size, and mapped/unmapped
- * state of the slave. If the slave is a child of the master, then
- * do this here. Otherwise let Tk_MaintainGeometry do the work.
+ * state of the slave. If the slave is a child of the master, then do
+ * this here. Otherwise let Tk_MaintainGeometry do the work.
*/
if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
@@ -821,8 +810,8 @@ ArrangePacking(clientData)
}
/*
- * Don't map the slave if the master isn't mapped: wait
- * until the master gets mapped later.
+ * Don't map the slave if the master isn't mapped: wait until
+ * the master gets mapped later.
*/
if (Tk_IsMapped(masterPtr->tkwin)) {
@@ -840,9 +829,9 @@ ArrangePacking(clientData)
}
/*
- * Changes to the window's structure could cause almost anything
- * to happen, including deleting the parent or child. If this
- * happens, we'll be told to abort.
+ * Changes to the window's structure could cause almost anything to
+ * happen, including deleting the parent or child. If this happens,
+ * we'll be told to abort.
*/
if (abort) {
@@ -850,7 +839,7 @@ ArrangePacking(clientData)
}
}
- done:
+ done:
masterPtr->abortPtr = NULL;
Tcl_Release((ClientData) masterPtr);
}
@@ -860,13 +849,12 @@ ArrangePacking(clientData)
*
* XExpansion --
*
- * Given a list of packed slaves, the first of which is packed
- * on the left or right and is expandable, compute how much to
- * expand the child.
+ * Given a list of packed slaves, the first of which is packed on the
+ * left or right and is expandable, compute how much to expand the child.
*
* Results:
- * The return value is the number of additional pixels to give to
- * the child.
+ * The return value is the number of additional pixels to give to the
+ * child.
*
* Side effects:
* None.
@@ -875,24 +863,23 @@ ArrangePacking(clientData)
*/
static int
-XExpansion(slavePtr, cavityWidth)
- register Packer *slavePtr; /* First in list of remaining
- * slaves. */
- int cavityWidth; /* Horizontal space left for all
- * remaining slaves. */
+XExpansion(
+ register Packer *slavePtr, /* First in list of remaining slaves. */
+ int cavityWidth) /* Horizontal space left for all remaining
+ * slaves. */
{
int numExpand, minExpand, curExpand;
int childWidth;
/*
- * This procedure is tricky because windows packed top or bottom can
- * be interspersed among expandable windows packed left or right.
- * Scan through the list, keeping a running sum of the widths of
- * all left and right windows (actually, count the cavity space not
- * allocated) and a running count of all expandable left and right
- * windows. At each top or bottom window, and at the end of the
- * list, compute the expansion factor that seems reasonable at that
- * point. Return the smallest factor seen at any of these points.
+ * This function is tricky because windows packed top or bottom can be
+ * interspersed among expandable windows packed left or right. Scan
+ * through the list, keeping a running sum of the widths of all left and
+ * right windows (actually, count the cavity space not allocated) and a
+ * running count of all expandable left and right windows. At each top or
+ * bottom window, and at the end of the list, compute the expansion factor
+ * that seems reasonable at that point. Return the smallest factor seen at
+ * any of these points.
*/
minExpand = cavityWidth;
@@ -924,13 +911,12 @@ XExpansion(slavePtr, cavityWidth)
*
* YExpansion --
*
- * Given a list of packed slaves, the first of which is packed
- * on the top or bottom and is expandable, compute how much to
- * expand the child.
+ * Given a list of packed slaves, the first of which is packed on the top
+ * or bottom and is expandable, compute how much to expand the child.
*
* Results:
- * The return value is the number of additional pixels to give to
- * the child.
+ * The return value is the number of additional pixels to give to the
+ * child.
*
* Side effects:
* None.
@@ -939,11 +925,10 @@ XExpansion(slavePtr, cavityWidth)
*/
static int
-YExpansion(slavePtr, cavityHeight)
- register Packer *slavePtr; /* First in list of remaining
- * slaves. */
- int cavityHeight; /* Vertical space left for all
- * remaining slaves. */
+YExpansion(
+ register Packer *slavePtr, /* First in list of remaining slaves. */
+ int cavityHeight) /* Vertical space left for all remaining
+ * slaves. */
{
int numExpand, minExpand, curExpand;
int childHeight;
@@ -981,30 +966,28 @@ YExpansion(slavePtr, cavityHeight)
*
* GetPacker --
*
- * This internal procedure is used to locate a Packer
- * structure for a given window, creating one if one
- * doesn't exist already.
+ * This internal function is used to locate a Packer structure for a
+ * given window, creating one if one doesn't exist already.
*
* Results:
- * The return value is a pointer to the Packer structure
- * corresponding to tkwin.
+ * The return value is a pointer to the Packer structure corresponding to
+ * tkwin.
*
* Side effects:
- * A new packer structure may be created. If so, then
- * a callback is set up to clean things up when the
- * window is deleted.
+ * A new packer structure may be created. If so, then a callback is set
+ * up to clean things up when the window is deleted.
*
*--------------------------------------------------------------
*/
static Packer *
-GetPacker(tkwin)
- Tk_Window tkwin; /* Token for window for which
- * packer structure is desired. */
+GetPacker(
+ Tk_Window tkwin) /* Token for window for which packer structure
+ * is desired. */
{
register Packer *packPtr;
Tcl_HashEntry *hPtr;
- int new;
+ int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->packInit) {
@@ -1013,13 +996,13 @@ GetPacker(tkwin)
}
/*
- * See if there's already packer for this window. If not,
- * then create a new one.
+ * See if there's already packer for this window. If not, then create a
+ * new one.
*/
- hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin,
- &new);
- if (!new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin,
+ &isNew);
+ if (!isNew) {
return (Packer *) Tcl_GetHashValue(hPtr);
}
packPtr = (Packer *) ckalloc(sizeof(Packer));
@@ -1046,30 +1029,30 @@ GetPacker(tkwin)
*
* PackAfter --
*
- * This procedure does most of the real work of adding
- * one or more windows into the packing order for its parent.
+ * This function does most of the real work of adding one or more windows
+ * into the packing order for its master.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * The geometry of the specified windows may change, both now and
- * again in the future.
+ * The geometry of the specified windows may change, both now and again
+ * in the future.
*
*--------------------------------------------------------------
*/
static int
-PackAfter(interp, prevPtr, masterPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Packer *prevPtr; /* Pack windows in argv just after this
- * window; NULL means pack as first
- * child of masterPtr. */
- Packer *masterPtr; /* Master in which to pack windows. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Array of lists, each containing 2
- * elements: window name and side
- * against which to pack. */
+PackAfter(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Packer *prevPtr, /* Pack windows in argv just after this
+ * window; NULL means pack as first child of
+ * masterPtr. */
+ Packer *masterPtr, /* Master in which to pack windows. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of lists, each containing 2 elements:
+ * window name and side against which to
+ * pack. */
{
register Packer *packPtr;
Tk_Window tkwin, ancestor, parent;
@@ -1078,24 +1061,23 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
int index, optionCount, c;
/*
- * Iterate over all of the window specifiers, each consisting of
- * two arguments. The first argument contains the window name and
- * the additional arguments contain options such as "top" or
- * "padx 20".
+ * Iterate over all of the window specifiers, each consisting of two
+ * arguments. The first argument contains the window name and the
+ * additional arguments contain options such as "top" or "padx 20".
*/
for ( ; objc > 0; objc -= 2, objv += 2, prevPtr = packPtr) {
if (objc < 2) {
Tcl_AppendResult(interp, "wrong # args: window \"",
Tcl_GetString(objv[0]), "\" should be followed by options",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
}
/*
- * Find the packer for the window to be packed, and make sure
- * that the window in which it will be packed is either its
- * or a descendant of its parent.
+ * Find the packer for the window to be packed, and make sure that the
+ * window in which it will be packed is either its or a descendant of
+ * its parent.
*/
if (TkGetWindowFromObj(interp, masterPtr->tkwin, objv[0], &tkwin)
@@ -1109,10 +1091,9 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
break;
}
if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
- badWindow:
+ badWindow:
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[0]),
- " inside ", Tk_PathName(masterPtr->tkwin),
- (char *) NULL);
+ " inside ", Tk_PathName(masterPtr->tkwin), NULL);
return TCL_ERROR;
}
}
@@ -1146,19 +1127,19 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
c = curOpt[0];
if ((c == 't')
- && (strncmp(curOpt, "top", (unsigned) length)) == 0) {
+ && (strncmp(curOpt, "top", (size_t) length)) == 0) {
packPtr->side = TOP;
} else if ((c == 'b')
- && (strncmp(curOpt, "bottom", (unsigned) length)) == 0) {
+ && (strncmp(curOpt, "bottom", (size_t) length)) == 0) {
packPtr->side = BOTTOM;
} else if ((c == 'l')
- && (strncmp(curOpt, "left", (unsigned) length)) == 0) {
+ && (strncmp(curOpt, "left", (size_t) length)) == 0) {
packPtr->side = LEFT;
} else if ((c == 'r')
- && (strncmp(curOpt, "right", (unsigned) length)) == 0) {
+ && (strncmp(curOpt, "right", (size_t) length)) == 0) {
packPtr->side = RIGHT;
} else if ((c == 'e')
- && (strncmp(curOpt, "expand", (unsigned) length)) == 0) {
+ && (strncmp(curOpt, "expand", (size_t) length)) == 0) {
packPtr->flags |= EXPAND;
} else if ((c == 'f')
&& (strcmp(curOpt, "fill")) == 0) {
@@ -1169,10 +1150,10 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
packPtr->flags |= FILLY;
} else if ((c == 'p') && (strcmp(curOpt, "padx")) == 0) {
if (optionCount < (index+2)) {
- missingPad:
+ missingPad:
Tcl_AppendResult(interp, "wrong # args: \"", curOpt,
"\" option must be followed by screen distance",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
}
if (TkParsePadAmount(interp, tkwin, options[index+1],
@@ -1196,11 +1177,10 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
packPtr->iPadY = 0;
index++;
} else if ((c == 'f') && (length > 1)
- && (strncmp(curOpt, "frame", (unsigned) length) == 0)) {
+ && (strncmp(curOpt, "frame", (size_t) length) == 0)) {
if (optionCount < (index+2)) {
Tcl_AppendResult(interp, "wrong # args: \"frame\" ",
- "option must be followed by anchor point",
- (char *) NULL);
+ "option must be followed by anchor point", NULL);
return TCL_ERROR;
}
if (Tk_GetAnchorFromObj(interp, options[index+1],
@@ -1210,9 +1190,8 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
index++;
} else {
Tcl_AppendResult(interp, "bad option \"", curOpt,
- "\": should be top, bottom, left, right, ",
- "expand, fill, fillx, filly, padx, pady, or frame",
- (char *) NULL);
+ "\": should be top, bottom, left, right, expand, ",
+ "fill, fillx, filly, padx, pady, or frame", NULL);
return TCL_ERROR;
}
}
@@ -1232,11 +1211,10 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
}
Unlink(packPtr);
}
-
+
/*
- * Add the window in the correct place in its parent's
- * packing order, then make sure that the window is
- * managed by us.
+ * Add the window in the correct place in its master's packing
+ * order, then make sure that the window is managed by us.
*/
packPtr->masterPtr = masterPtr;
@@ -1252,8 +1230,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
}
/*
- * Arrange for the parent to be re-packed at the first
- * idle moment.
+ * Arrange for the master to be re-packed at the first idle moment.
*/
if (masterPtr->abortPtr != NULL) {
@@ -1271,20 +1248,20 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
*
* Unlink --
*
- * Remove a packer from its parent's list of slaves.
+ * Remove a packer from its master's list of slaves.
*
* Results:
* None.
*
* Side effects:
- * The parent will be scheduled for repacking.
+ * The master will be scheduled for repacking.
*
*----------------------------------------------------------------------
*/
static void
-Unlink(packPtr)
- register Packer *packPtr; /* Window to unlink. */
+Unlink(
+ register Packer *packPtr) /* Window to unlink. */
{
register Packer *masterPtr, *packPtr2;
@@ -1297,7 +1274,7 @@ Unlink(packPtr)
} else {
for (packPtr2 = masterPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) {
if (packPtr2 == NULL) {
- panic("Unlink couldn't find previous window");
+ Tcl_Panic("Unlink couldn't find previous window");
}
if (packPtr2->nextPtr == packPtr) {
packPtr2->nextPtr = packPtr->nextPtr;
@@ -1321,9 +1298,9 @@ Unlink(packPtr)
*
* DestroyPacker --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a packer at a safe time
- * (when no-one is using it anymore).
+ * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
+ * up the internal structure of a packer at a safe time (when no-one is
+ * using it anymore).
*
* Results:
* None.
@@ -1335,9 +1312,9 @@ Unlink(packPtr)
*/
static void
-DestroyPacker(memPtr)
- char *memPtr; /* Info about packed window that
- * is now dead. */
+DestroyPacker(
+ char *memPtr) /* Info about packed window that is now
+ * dead. */
{
register Packer *packPtr = (Packer *) memPtr;
ckfree((char *) packPtr);
@@ -1348,25 +1325,24 @@ DestroyPacker(memPtr)
*
* PackStructureProc --
*
- * This procedure is invoked by the Tk event dispatcher in response
- * to StructureNotify events.
+ * This function is invoked by the Tk event dispatcher in response to
+ * StructureNotify events.
*
* Results:
* None.
*
* Side effects:
* If a window was just deleted, clean up all its packer-related
- * information. If it was just resized, repack its slaves, if
- * any.
+ * information. If it was just resized, repack its slaves, if any.
*
*----------------------------------------------------------------------
*/
static void
-PackStructureProc(clientData, eventPtr)
- ClientData clientData; /* Our information about window
- * referred to by eventPtr. */
- XEvent *eventPtr; /* Describes what just happened. */
+PackStructureProc(
+ ClientData clientData, /* Our information about window referred to by
+ * eventPtr. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
register Packer *packPtr = (Packer *) clientData;
@@ -1376,9 +1352,9 @@ PackStructureProc(clientData, eventPtr)
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr);
}
- if (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width) {
- if ((packPtr->masterPtr != NULL)
- && !(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
+ if ((packPtr->masterPtr != NULL)
+ && (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
+ if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width;
packPtr->masterPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr->masterPtr);
@@ -1390,20 +1366,23 @@ PackStructureProc(clientData, eventPtr)
if (packPtr->masterPtr != NULL) {
Unlink(packPtr);
}
+
for (slavePtr = packPtr->slavePtr; slavePtr != NULL;
slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, (Tk_GeomMgr *) NULL,
+ Tk_ManageGeometry(slavePtr->tkwin, NULL,
(ClientData) NULL);
Tk_UnmapWindow(slavePtr->tkwin);
slavePtr->masterPtr = NULL;
nextPtr = slavePtr->nextPtr;
slavePtr->nextPtr = NULL;
}
+
if (packPtr->tkwin != NULL) {
TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr;
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable,
(char *) packPtr->tkwin));
}
+
if (packPtr->flags & REQUESTED_REPACK) {
Tcl_CancelIdleCall(ArrangePacking, (ClientData) packPtr);
}
@@ -1411,8 +1390,8 @@ PackStructureProc(clientData, eventPtr)
Tcl_EventuallyFree((ClientData) packPtr, DestroyPacker);
} else if (eventPtr->type == MapNotify) {
/*
- * When a master gets mapped, must redo the geometry computation
- * so that all of its slaves get remapped.
+ * When a master gets mapped, must redo the geometry computation so
+ * that all of its slaves get remapped.
*/
if ((packPtr->slavePtr != NULL)
@@ -1424,10 +1403,10 @@ PackStructureProc(clientData, eventPtr)
register Packer *packPtr2;
/*
- * Unmap all of the slaves when the master gets unmapped,
- * so that they don't bother to keep redisplaying
- * themselves.
+ * Unmap all of the slaves when the master gets unmapped, so that they
+ * don't bother to keep redisplaying themselves.
*/
+
for (packPtr2 = packPtr->slavePtr; packPtr2 != NULL;
packPtr2 = packPtr2->nextPtr) {
Tk_UnmapWindow(packPtr2->tkwin);
@@ -1440,13 +1419,13 @@ PackStructureProc(clientData, eventPtr)
*
* ConfigureSlaves --
*
- * This implements the guts of the "pack configure" command. Given
- * a list of slaves and configuration options, it arranges for the
- * packer to manage the slaves and sets the specified options.
+ * This implements the guts of the "pack configure" command. Given a list
+ * of slaves and configuration options, it arranges for the packer to
+ * manage the slaves and sets the specified options.
*
* Results:
- * TCL_OK is returned if all went well. Otherwise, TCL_ERROR is
- * returned and the interp's result is set to contain an error message.
+ * TCL_OK is returned if all went well. Otherwise, TCL_ERROR is returned
+ * and the interp's result is set to contain an error message.
*
* Side effects:
* Slave windows get taken over by the packer.
@@ -1455,16 +1434,15 @@ PackStructureProc(clientData, eventPtr)
*/
static int
-ConfigureSlaves(interp, tkwin, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* Any window in application containing
- * slaves. Used to look up slave names. */
- int objc; /* Number of elements in argv. */
- Tcl_Obj *CONST objv[]; /* Argument objects: contains one or more
- * window names followed by any number
- * of "option value" pairs. Caller must
- * make sure that there is at least one
- * window name. */
+ConfigureSlaves(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* Any window in application containing
+ * slaves. Used to look up slave names. */
+ int objc, /* Number of elements in argv. */
+ Tcl_Obj *CONST objv[]) /* Argument objects: contains one or more
+ * window names followed by any number of
+ * "option value" pairs. Caller must make sure
+ * that there is at least one window name. */
{
Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr;
Tk_Window other, slave, parent, ancestor;
@@ -1472,7 +1450,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
char *string;
static CONST char *optionStrings[] = {
"-after", "-anchor", "-before", "-expand", "-fill",
- "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", (char *) NULL };
+ "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL };
enum options {
CONF_AFTER, CONF_ANCHOR, CONF_BEFORE, CONF_EXPAND, CONF_FILL,
CONF_IN, CONF_IPADX, CONF_IPADY, CONF_PADX, CONF_PADY, CONF_SIDE };
@@ -1491,13 +1469,12 @@ ConfigureSlaves(interp, tkwin, objc, objv)
/*
* Iterate over all of the slave windows, parsing the configuration
- * options for each slave. It's a bit wasteful to re-parse the
- * options for each slave, but things get too messy if we try to
- * parse the arguments just once at the beginning. For example,
- * if a slave already is packed we want to just change a few
- * existing values without resetting everything. If there are
- * multiple windows, the -after, -before, and -in options only
- * get processed for the first window.
+ * options for each slave. It's a bit wasteful to re-parse the options for
+ * each slave, but things get too messy if we try to parse the arguments
+ * just once at the beginning. For example, if a slave already is packed
+ * we want to just change a few existing values without resetting
+ * everything. If there are multiple windows, the -after, -before, and -in
+ * options only get processed for the first window.
*/
masterPtr = NULL;
@@ -1509,16 +1486,16 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
if (Tk_TopWinHierarchy(slave)) {
Tcl_AppendResult(interp, "can't pack \"", Tcl_GetString(objv[j]),
- "\": it's a top-level window", (char *) NULL);
+ "\": it's a top-level window", NULL);
return TCL_ERROR;
}
slavePtr = GetPacker(slave);
slavePtr->flags &= ~OLD_STYLE;
/*
- * If the slave isn't currently packed, reset all of its
- * configuration information to default values (there could
- * be old values left from a previous packing).
+ * If the slave isn't currently packed, reset all of its configuration
+ * information to default values (there could be old values left from
+ * a previous packing).
*/
if (slavePtr->masterPtr == NULL) {
@@ -1534,14 +1511,16 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if ((i+2) > objc) {
Tcl_AppendResult(interp, "extra option \"",
Tcl_GetString(objv[i]),
- "\" (option with no value?)", (char *) NULL);
+ "\" (option with no value?)", NULL);
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option",
0, &index) != TCL_OK) {
return TCL_ERROR;
}
- if (index == CONF_AFTER) {
+
+ switch ((enum options) index) {
+ case CONF_AFTER:
if (j == 0) {
if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other)
!= TCL_OK) {
@@ -1549,21 +1528,23 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
prevPtr = GetPacker(other);
if (prevPtr->masterPtr == NULL) {
- notPacked:
+ notPacked:
Tcl_AppendResult(interp, "window \"",
Tcl_GetString(objv[i+1]),
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
masterPtr = prevPtr->masterPtr;
positionGiven = 1;
}
- } else if (index == CONF_ANCHOR) {
+ break;
+ case CONF_ANCHOR:
if (Tk_GetAnchorFromObj(interp, objv[i+1], &slavePtr->anchor)
!= TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_BEFORE) {
+ break;
+ case CONF_BEFORE:
if (j == 0) {
if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other)
!= TCL_OK) {
@@ -1584,7 +1565,8 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
positionGiven = 1;
}
- } else if (index == CONF_EXPAND) {
+ break;
+ case CONF_EXPAND:
if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
return TCL_ERROR;
}
@@ -1592,7 +1574,8 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (tmp) {
slavePtr->flags |= EXPAND;
}
- } else if (index == CONF_FILL) {
+ break;
+ case CONF_FILL:
string = Tcl_GetString(objv[i+1]);
if (strcmp(string, "none") == 0) {
slavePtr->flags &= ~(FILLX|FILLY);
@@ -1604,10 +1587,11 @@ ConfigureSlaves(interp, tkwin, objc, objv)
slavePtr->flags |= FILLX|FILLY;
} else {
Tcl_AppendResult(interp, "bad fill style \"", string,
- "\": must be none, x, y, or both", (char *) NULL);
+ "\": must be none, x, y, or both", NULL);
return TCL_ERROR;
}
- } else if (index == CONF_IN) {
+ break;
+ case CONF_IN:
if (j == 0) {
if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other)
!= TCL_OK) {
@@ -1622,53 +1606,57 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
positionGiven = 1;
}
- } else if (index == CONF_IPADX) {
+ break;
+ case CONF_IPADX:
if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
!= TCL_OK)
|| (tmp < 0)) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad ipadx value \"",
Tcl_GetString(objv[i+1]),
- "\": must be positive screen distance",
- (char *) NULL);
+ "\": must be positive screen distance", NULL);
return TCL_ERROR;
}
slavePtr->iPadX = tmp * 2;
- } else if (index == CONF_IPADY) {
+ break;
+ case CONF_IPADY:
if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
!= TCL_OK)
|| (tmp < 0)) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad ipady value \"",
Tcl_GetString(objv[i+1]),
- "\": must be positive screen distance",
- (char *) NULL);
+ "\": must be positive screen distance", NULL);
return TCL_ERROR;
}
slavePtr->iPadY = tmp * 2;
- } else if (index == CONF_PADX) {
+ break;
+ case CONF_PADX:
if (TkParsePadAmount(interp, slave, objv[i+1],
&slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_PADY) {
+ break;
+ case CONF_PADY:
if (TkParsePadAmount(interp, slave, objv[i+1],
&slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
return TCL_ERROR;
}
- } else if (index == CONF_SIDE) {
+ break;
+ case CONF_SIDE:
if (Tcl_GetIndexFromObj(interp, objv[i+1], sideNames, "side",
TCL_EXACT, &side) != TCL_OK) {
return TCL_ERROR;
}
slavePtr->side = (Side) side;
+ break;
}
}
/*
- * If no position in a packing list was specified and the slave
- * is already packed, then leave it in its current location in
- * its current packing list.
+ * If no position in a packing list was specified and the slave is
+ * already packed, then leave it in its current location in its
+ * current packing list.
*/
if (!positionGiven && (slavePtr->masterPtr != NULL)) {
@@ -1677,21 +1665,22 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
/*
- * If the slave is going to be put back after itself then
- * skip the whole operation, since it won't work anyway.
+ * If the slave is going to be put back after itself or the same -in
+ * window is passed in again, then just skip the whole operation,
+ * since it won't work anyway.
*/
if (prevPtr == slavePtr) {
masterPtr = slavePtr->masterPtr;
goto scheduleLayout;
}
-
+
/*
- * If none of the "-in", "-before", or "-after" options has
- * been specified, arrange for the slave to go at the end of
- * the order for its parent.
+ * If none of the "-in", "-before", or "-after" options has been
+ * specified, arrange for the slave to go at the end of the order for
+ * its parent.
*/
-
+
if (!positionGiven) {
masterPtr = GetPacker(Tk_Parent(slave));
prevPtr = masterPtr->slavePtr;
@@ -1703,11 +1692,11 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
/*
- * Make sure that the slave's parent is either the master or
- * an ancestor of the master, and that the master and slave
- * aren't the same.
+ * Make sure that the slave's parent is either the master or an
+ * ancestor of the master, and that the master and slave aren't the
+ * same.
*/
-
+
parent = Tk_Parent(slave);
for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
@@ -1715,20 +1704,19 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[j]),
- " inside ", Tk_PathName(masterPtr->tkwin),
- (char *) NULL);
+ " inside ", Tk_PathName(masterPtr->tkwin), NULL);
return TCL_ERROR;
}
}
if (slave == masterPtr->tkwin) {
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[j]),
- " inside itself", (char *) NULL);
+ " inside itself", NULL);
return TCL_ERROR;
}
/*
- * Unpack the slave if it's currently packed, then position it
- * after prevPtr.
+ * Unpack the slave if it's currently packed, then position it after
+ * prevPtr.
*/
if (slavePtr->masterPtr != NULL) {
@@ -1752,11 +1740,10 @@ ConfigureSlaves(interp, tkwin, objc, objv)
prevPtr = slavePtr;
/*
- * Arrange for the parent to be re-packed at the first
- * idle moment.
+ * Arrange for the master to be re-packed at the first idle moment.
*/
- scheduleLayout:
+ scheduleLayout:
if (masterPtr->abortPtr != NULL) {
*masterPtr->abortPtr = 1;
}
@@ -1767,3 +1754,11 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 57670ba..68d62d7 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -1,23 +1,23 @@
-/*
+/*
* tkPanedWindow.c --
*
- * This module implements "paned window" widgets that are object
- * based. A "paned window" is a widget that manages the geometry for
- * some number of other widgets, placing a movable "sash" between them,
- * which can be used to alter the relative sizes of adjacent widgets.
+ * This module implements "paned window" widgets that are object based. A
+ * "paned window" is a widget that manages the geometry for some number
+ * of other widgets, placing a movable "sash" between them, which can be
+ * used to alter the relative sizes of adjacent widgets.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
* Copyright (c) 2000 Ajuba Solutions.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "default.h"
#include "tkInt.h"
-/* Flag values for "sticky"ness The 16 combinations subsume the packer's
+/*
+ * Flag values for "sticky"ness. The 16 combinations subsume the packer's
* notion of anchor and fill.
*
* STICK_NORTH This window sticks to the top of its cavity.
@@ -30,16 +30,44 @@
#define STICK_EAST 2
#define STICK_SOUTH 4
#define STICK_WEST 8
+
/*
* The following table defines the legal values for the -orient option.
*/
static char *orientStrings[] = {
- "horizontal", "vertical", (char *) NULL
+ "horizontal", "vertical", NULL
};
enum orient { ORIENT_HORIZONTAL, ORIENT_VERTICAL };
+/*
+ * The following table defines the legal values for the -stretch option.
+ */
+
+static char *stretchStrings[] = {
+ "always", "first", "last", "middle", "never", NULL
+};
+
+enum stretch {
+ STRETCH_ALWAYS, /* Always give extra space to this pane. */
+ STRETCH_FIRST, /* Give extra space to pane if it is first. */
+ STRETCH_LAST, /* Give extra space to pane if it is last. */
+ STRETCH_MIDDLE, /* Give extra space to pane only if it is
+ * neither first nor last. */
+ STRETCH_NEVER /* Never give extra space to this pane. */
+};
+
+/*
+ * Codify the stretchiness rule in one place.
+ */
+
+#define IsStretchable(stretch,index,first,last) \
+ (((stretch) == STRETCH_ALWAYS) || \
+ ((stretch) == STRETCH_FIRST && (index) == (first)) || \
+ ((stretch) == STRETCH_LAST && (index) == (last)) || \
+ ((stretch) == STRETCH_MIDDLE && (index) != (first) && (index) != (last)))
+
typedef struct {
Tk_OptionTable pwOptions; /* Token for paned window option table. */
Tk_OptionTable slaveOpts; /* Token for slave cget option table. */
@@ -51,35 +79,38 @@ typedef struct {
*/
typedef struct Slave {
- Tk_Window tkwin; /* Window being managed. */
-
- int minSize; /* Minimum size of this pane, on the
- * relevant axis, in pixels. */
- int padx; /* Additional padding requested for
- * slave, in the x dimension. */
- int pady; /* Additional padding requested for
- * slave, in the y dimension. */
- Tcl_Obj *widthPtr, *heightPtr; /* Tcl_Obj rep's of slave width/height,
- * to allow for null values. */
- int width; /* Slave width. */
- int height; /* Slave height. */
- int sticky; /* Sticky string. */
- int x, y; /* Coordinates of the widget. */
- int paneWidth, paneHeight; /* Pane dimensions (may be different
- * from slave width/height). */
- int sashx, sashy; /* Coordinates of the sash of the
- * right or bottom of this pane. */
- int markx, marky; /* Coordinates of the last mark set
- * for the sash. */
- int handlex, handley; /* Coordinates of the sash handle. */
- struct PanedWindow *masterPtr; /* Paned window managing the window. */
- Tk_Window after; /* Placeholder for parsing options. */
- Tk_Window before; /* Placeholder for parsing options. */
+ Tk_Window tkwin; /* Window being managed. */
+ int minSize; /* Minimum size of this pane, on the relevant
+ * axis, in pixels. */
+ int padx; /* Additional padding requested for slave, in
+ * the x dimension. */
+ int pady; /* Additional padding requested for slave, in
+ * the y dimension. */
+ Tcl_Obj *widthPtr, *heightPtr;
+ /* Tcl_Obj rep's of slave width/height, to
+ * allow for null values. */
+ int width; /* Slave width. */
+ int height; /* Slave height. */
+ int sticky; /* Sticky string. */
+ int x, y; /* Coordinates of the widget. */
+ int paneWidth, paneHeight; /* Pane dimensions (may be different from
+ * slave width/height). */
+ int sashx, sashy; /* Coordinates of the sash of the right or
+ * bottom of this pane. */
+ int markx, marky; /* Coordinates of the last mark set for the
+ * sash. */
+ int handlex, handley; /* Coordinates of the sash handle. */
+ enum stretch stretch; /* Controls how slave grows/shrinks */
+ int hide; /* Controls visibility of pane */
+ struct PanedWindow *masterPtr;
+ /* Paned window managing the window. */
+ Tk_Window after; /* Placeholder for parsing options. */
+ Tk_Window before; /* Placeholder for parsing options. */
} Slave;
/*
- * A data structure of the following type is kept for each paned window
- * widget managed by this file:
+ * A data structure of the following type is kept for each paned window widget
+ * managed by this file:
*/
typedef struct PanedWindow {
@@ -101,7 +132,6 @@ typedef struct PanedWindow {
Tk_Cursor cursor; /* Current cursor for window, or None. */
int resizeOpaque; /* Boolean indicating whether resize should be
* opaque or rubberband style. */
-
int sashRelief; /* Relief used to draw sash. */
int sashWidth; /* Width of each sash, in pixels. */
Tcl_Obj *sashWidthPtr; /* Tcl_Obj rep for sash width. */
@@ -114,7 +144,6 @@ typedef struct PanedWindow {
int handlePad; /* Distance from border to draw handle. */
Tcl_Obj *handleSizePtr; /* Tcl_Obj rep for handle size. */
Tk_Cursor sashCursor; /* Cursor used when mouse is above a sash. */
-
GC gc; /* Graphics context for copying from
* off-screen pixmap onto screen. */
int proxyx, proxyy; /* Proxy x,y coordinates. */
@@ -127,11 +156,11 @@ typedef struct PanedWindow {
/*
* Flags used for paned windows:
*
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
- * been queued to redraw this window.
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has been
+ * queued to redraw this window.
*
- * WIDGET_DELETED: Non-zero means that the paned window has
- * been, or is in the process of being, deleted.
+ * WIDGET_DELETED: Non-zero means that the paned window has been,
+ * or is in the process of being, deleted.
*
* RESIZE_PENDING: Non-zero means that the window might need to
* change its size (or the size of its panes)
@@ -147,59 +176,63 @@ typedef struct PanedWindow {
#define RESIZE_PENDING 0x0020
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-int Tk_PanedWindowObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static void PanedWindowCmdDeletedProc _ANSI_ARGS_((ClientData clientData));
-static int ConfigurePanedWindow _ANSI_ARGS_((Tcl_Interp *interp,
- PanedWindow *pwPtr, int objc, Tcl_Obj *CONST objv[]));
-static void DestroyPanedWindow _ANSI_ARGS_((PanedWindow *pwPtr));
-static void DisplayPanedWindow _ANSI_ARGS_((ClientData clientData));
-static void PanedWindowEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void ProxyWindowEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void DisplayProxyWindow _ANSI_ARGS_((ClientData clientData));
-static void PanedWindowWorldChanged _ANSI_ARGS_((ClientData instanceData));
-static int PanedWindowWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]));
-static void PanedWindowLostSlaveProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void PanedWindowReqProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void ArrangePanes _ANSI_ARGS_((ClientData clientData));
-static void Unlink _ANSI_ARGS_((Slave *slavePtr));
-static Slave * GetPane _ANSI_ARGS_((PanedWindow *pwPtr, Tk_Window tkwin));
-static void SlaveStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int PanedWindowSashCommand _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static int PanedWindowProxyCommand _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static void ComputeGeometry _ANSI_ARGS_((PanedWindow *pwPtr));
-static int ConfigureSlaves _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static void DestroyOptionTables _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp));
-static int SetSticky _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin,
- Tcl_Obj **value, char *recordPtr, int internalOffset,
- char *oldInternalPtr, int flags));
-static Tcl_Obj *GetSticky _ANSI_ARGS_((ClientData clientData, Tk_Window tkwin,
- char *recordPtr, int internalOffset));
-static void RestoreSticky _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *internalPtr,
- char *oldInternalPtr));
-static void AdjustForSticky _ANSI_ARGS_((int sticky, int cavityWidth,
- int cavityHeight, int *xPtr, int *yPtr,
- int *slaveWidthPtr, int *slaveHeightPtr));
-static void MoveSash _ANSI_ARGS_((PanedWindow *pwPtr, int sash, int diff));
-static int ObjectIsEmpty _ANSI_ARGS_((Tcl_Obj *objPtr));
-static char * ComputeSlotAddress _ANSI_ARGS_((char *recordPtr, int offset));
-static int PanedWindowIdentifyCoords _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int x, int y));
+int Tk_PanedWindowObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void PanedWindowCmdDeletedProc(ClientData clientData);
+static int ConfigurePanedWindow(Tcl_Interp *interp,
+ PanedWindow *pwPtr, int objc,
+ Tcl_Obj *CONST objv[]);
+static void DestroyPanedWindow(PanedWindow *pwPtr);
+static void DisplayPanedWindow(ClientData clientData);
+static void PanedWindowEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void ProxyWindowEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void DisplayProxyWindow(ClientData clientData);
+static void PanedWindowWorldChanged(ClientData instanceData);
+static int PanedWindowWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]);
+static void PanedWindowLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
+static void PanedWindowReqProc(ClientData clientData,
+ Tk_Window tkwin);
+static void ArrangePanes(ClientData clientData);
+static void Unlink(Slave *slavePtr);
+static Slave * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
+static void SlaveStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static int PanedWindowSashCommand(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
+static int PanedWindowProxyCommand(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
+static void ComputeGeometry(PanedWindow *pwPtr);
+static int ConfigureSlaves(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
+static void DestroyOptionTables(ClientData clientData,
+ Tcl_Interp *interp);
+static int SetSticky(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj **value, char *recordPtr,
+ int internalOffset, char *oldInternalPtr,
+ int flags);
+static Tcl_Obj * GetSticky(ClientData clientData, Tk_Window tkwin,
+ char *recordPtr, int internalOffset);
+static void RestoreSticky(ClientData clientData, Tk_Window tkwin,
+ char *internalPtr, char *oldInternalPtr);
+static void AdjustForSticky(int sticky, int cavityWidth,
+ int cavityHeight, int *xPtr, int *yPtr,
+ int *slaveWidthPtr, int *slaveHeightPtr);
+static void MoveSash(PanedWindow *pwPtr, int sash, int diff);
+static int ObjectIsEmpty(Tcl_Obj *objPtr);
+static char * ComputeSlotAddress(char *recordPtr, int offset);
+static int PanedWindowIdentifyCoords(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int x, int y);
/*
* Sashes are between panes only, so there is one less sash than slaves
@@ -208,7 +241,7 @@ static int PanedWindowIdentifyCoords _ANSI_ARGS_((PanedWindow *pwPtr,
#define ValidSashIndex(pwPtr, sash) \
(((sash) >= 0) && ((sash) < ((pwPtr)->numSlaves-1)))
-static Tk_GeomMgr panedWindowMgrType = {
+static const Tk_GeomMgr panedWindowMgrType = {
"panedwindow", /* name */
PanedWindowReqProc, /* requestProc */
PanedWindowLostSlaveProc, /* lostSlaveProc */
@@ -226,31 +259,31 @@ static Tk_GeomMgr panedWindowMgrType = {
*/
static Tk_ObjCustomOption stickyOption = {
- "sticky", /* name */
- SetSticky, /* setProc */
- GetSticky, /* getProc */
- RestoreSticky, /* restoreProc */
- (Tk_CustomOptionFreeProc *)NULL, /* freeProc */
+ "sticky", /* name */
+ SetSticky, /* setProc */
+ GetSticky, /* getProc */
+ RestoreSticky, /* restoreProc */
+ NULL, /* freeProc */
0
};
-static Tk_OptionSpec optionSpecs[] = {
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_PANEDWINDOW_BG_COLOR, -1, Tk_Offset(PanedWindow, background), 0,
(ClientData) DEF_PANEDWINDOW_BG_MONO},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth"},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background"},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth"},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background"},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_PANEDWINDOW_BORDERWIDTH, -1, Tk_Offset(PanedWindow, borderWidth),
- 0, 0, GEOMETRY},
+ 0, 0, GEOMETRY},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_PANEDWINDOW_CURSOR, -1, Tk_Offset(PanedWindow, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad",
DEF_PANEDWINDOW_HANDLEPAD, -1, Tk_Offset(PanedWindow, handlePad),
- 0, 0, GEOMETRY},
+ 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize",
DEF_PANEDWINDOW_HANDLESIZE, Tk_Offset(PanedWindow, handleSizePtr),
Tk_Offset(PanedWindow, handleSize), 0, 0, GEOMETRY},
@@ -259,9 +292,9 @@ static Tk_OptionSpec optionSpecs[] = {
Tk_Offset(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize",
DEF_PANEDWINDOW_OPAQUERESIZE, -1,
- Tk_Offset(PanedWindow, resizeOpaque), 0, 0, 0},
+ Tk_Offset(PanedWindow, resizeOpaque), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
- DEF_PANEDWINDOW_ORIENT, -1, Tk_Offset(PanedWindow, orient),
+ DEF_PANEDWINDOW_ORIENT, -1, Tk_Offset(PanedWindow, orient),
0, (ClientData) orientStrings, GEOMETRY},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_PANEDWINDOW_RELIEF, -1, Tk_Offset(PanedWindow, relief), 0, 0, 0},
@@ -270,55 +303,59 @@ static Tk_OptionSpec optionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad",
DEF_PANEDWINDOW_SASHPAD, -1, Tk_Offset(PanedWindow, sashPad),
- 0, 0, GEOMETRY},
+ 0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief",
DEF_PANEDWINDOW_SASHRELIEF, -1, Tk_Offset(PanedWindow, sashRelief),
- 0, 0, 0},
+ 0, 0, 0},
{TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width",
DEF_PANEDWINDOW_SASHWIDTH, Tk_Offset(PanedWindow, sashWidthPtr),
Tk_Offset(PanedWindow, sashWidth), 0, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle",
DEF_PANEDWINDOW_SHOWHANDLE, -1, Tk_Offset(PanedWindow, showHandle),
- 0, 0, GEOMETRY},
+ 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-width", "width", "Width",
DEF_PANEDWINDOW_WIDTH, Tk_Offset(PanedWindow, widthPtr),
Tk_Offset(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_END}
};
-static Tk_OptionSpec slaveOptionSpecs[] = {
- {TK_OPTION_WINDOW, "-after", (char *) NULL, (char *) NULL,
+static const Tk_OptionSpec slaveOptionSpecs[] = {
+ {TK_OPTION_WINDOW, "-after", NULL, NULL,
DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Slave, after),
- TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_WINDOW, "-before", (char *) NULL, (char *) NULL,
- DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Slave, before),
- TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-height", (char *) NULL, (char *) NULL,
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_WINDOW, "-before", NULL, NULL,
+ DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Slave, before),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-height", NULL, NULL,
DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Slave, heightPtr),
- Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-minsize", (char *) NULL, (char *) NULL,
+ Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
+ DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Slave, hide), 0,0,GEOMETRY},
+ {TK_OPTION_PIXELS, "-minsize", NULL, NULL,
DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Slave, minSize), 0, 0, 0},
- {TK_OPTION_PIXELS, "-padx", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-padx", NULL, NULL,
DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Slave, padx), 0, 0, 0},
- {TK_OPTION_PIXELS, "-pady", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-pady", NULL, NULL,
DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Slave, pady), 0, 0, 0},
- {TK_OPTION_CUSTOM, "-sticky", (char *) NULL, (char *) NULL,
+ {TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Slave, sticky), 0,
- (ClientData) &stickyOption, 0},
- {TK_OPTION_PIXELS, "-width", (char *) NULL, (char *) NULL,
+ (ClientData) &stickyOption, 0},
+ {TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
+ DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Slave, stretch), 0,
+ (ClientData) stretchStrings, 0},
+ {TK_OPTION_PIXELS, "-width", NULL, NULL,
DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Slave, widthPtr),
- Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0},
+ Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END}
};
-
/*
*--------------------------------------------------------------
*
* Tk_PanedWindowObjCmd --
*
- * This procedure is invoked to process the "panedwindow" Tcl
- * command. It creates a new "panedwindow" widget.
+ * This function is invoked to process the "panedwindow" Tcl command. It
+ * creates a new "panedwindow" widget.
*
* Results:
* A standard Tcl result.
@@ -330,11 +367,11 @@ static Tk_OptionSpec slaveOptionSpecs[] = {
*/
int
-Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+Tk_PanedWindowObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj * CONST objv[]) /* Argument objects. */
{
PanedWindow *pwPtr;
Tk_Window tkwin, parent;
@@ -346,27 +383,35 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
- tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
+ tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
Tcl_GetStringFromObj(objv[1], NULL), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
pwOpts = (OptionTables *)
- Tcl_GetAssocData(interp, "PanedWindowOptionTables", NULL);
+ Tcl_GetAssocData(interp, "PanedWindowOptionTables", NULL);
if (pwOpts == NULL) {
/*
- * The first time this procedure is invoked, the option tables will
- * be NULL. We then create the option tables from the templates
- * and store a pointer to the tables as the command's clinical so
- * we'll have easy access to it in the future.
+ * The first time this function is invoked, the option tables will be
+ * NULL. We then create the option tables from the templates and store
+ * a pointer to the tables as the command's clinical so we'll have
+ * easy access to it in the future.
*/
+
pwOpts = (OptionTables *) ckalloc(sizeof(OptionTables));
- /* Set up an exit handler to free the optionTables struct */
+
+ /*
+ * Set up an exit handler to free the optionTables struct.
+ */
+
Tcl_SetAssocData(interp, "PanedWindowOptionTables",
DestroyOptionTables, (ClientData) pwOpts);
- /* Create the paned window option tables. */
+ /*
+ * Create the paned window option tables.
+ */
+
pwOpts->pwOptions = Tk_CreateOptionTable(interp, optionSpecs);
pwOpts->slaveOpts = Tk_CreateOptionTable(interp, slaveOptionSpecs);
}
@@ -379,18 +424,18 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
pwPtr = (PanedWindow *) ckalloc(sizeof(PanedWindow));
memset((void *)pwPtr, 0, (sizeof(PanedWindow)));
- pwPtr->tkwin = tkwin;
- pwPtr->display = Tk_Display(tkwin);
- pwPtr->interp = interp;
- pwPtr->widgetCmd = Tcl_CreateObjCommand(interp,
+ pwPtr->tkwin = tkwin;
+ pwPtr->display = Tk_Display(tkwin);
+ pwPtr->interp = interp;
+ pwPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd,
(ClientData) pwPtr, PanedWindowCmdDeletedProc);
- pwPtr->optionTable = pwOpts->pwOptions;
- pwPtr->slaveOpts = pwOpts->slaveOpts;
- pwPtr->relief = TK_RELIEF_RAISED;
- pwPtr->gc = None;
- pwPtr->cursor = None;
- pwPtr->sashCursor = None;
+ pwPtr->optionTable = pwOpts->pwOptions;
+ pwPtr->slaveOpts = pwOpts->slaveOpts;
+ pwPtr->relief = TK_RELIEF_RAISED;
+ pwPtr->gc = None;
+ pwPtr->cursor = None;
+ pwPtr->sashCursor = None;
/*
* Keep a hold of the associated tkwin until we destroy the widget,
@@ -409,10 +454,11 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
PanedWindowEventProc, (ClientData) pwPtr);
/*
- * Find the toplevel ancestor of the panedwindow, and make a proxy
- * win as a child of that window; this way the proxy can always float
- * above slaves in the panedwindow.
+ * Find the toplevel ancestor of the panedwindow, and make a proxy win as
+ * a child of that window; this way the proxy can always float above
+ * slaves in the panedwindow.
*/
+
parent = Tk_Parent(pwPtr->tkwin);
while (!(Tk_IsTopLevel(parent))) {
parent = Tk_Parent(parent);
@@ -422,15 +468,16 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
}
}
- pwPtr->proxywin = Tk_CreateAnonymousWindow(interp, parent, (char *) NULL);
+ pwPtr->proxywin = Tk_CreateAnonymousWindow(interp, parent, NULL);
+
/*
- * The proxy window has to be able to share GCs with the main
- * panedwindow despite being children of windows with potentially
- * different characteristics, and it looks better that way too.
- * [Bug 702230]
- * Also Set the X window save under attribute to avoid expose events as
- * the proxy sash is dragged across the panes. [Bug 1036963]
+ * The proxy window has to be able to share GCs with the main panedwindow
+ * despite being children of windows with potentially different
+ * characteristics, and it looks better that way too. [Bug 702230] Also
+ * set the X window save under attribute to avoid expose events as the
+ * proxy sash is dragged across the panes. [Bug 1036963]
*/
+
Tk_SetWindowVisual(pwPtr->proxywin,
Tk_Visual(tkwin), Tk_Depth(tkwin), Tk_Colormap(tkwin));
Tk_CreateEventHandler(pwPtr->proxywin, ExposureMask, ProxyWindowEventProc,
@@ -453,9 +500,9 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
*
* PanedWindowWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -467,26 +514,27 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
*/
static int
-PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about square widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+PanedWindowWidgetObjCmd(
+ ClientData clientData, /* Information about square widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj * CONST objv[]) /* Argument objects. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
int result = TCL_OK;
- static CONST char *optionStrings[] = {"add", "cget", "configure", "forget",
- "identify", "panecget",
- "paneconfigure", "panes",
- "proxy", "sash", (char *) NULL};
- enum options { PW_ADD, PW_CGET, PW_CONFIGURE, PW_FORGET, PW_IDENTIFY,
- PW_PANECGET, PW_PANECONFIGURE, PW_PANES, PW_PROXY,
- PW_SASH };
+ static CONST char *optionStrings[] = {
+ "add", "cget", "configure", "forget", "identify", "panecget",
+ "paneconfigure", "panes", "proxy", "sash", NULL
+ };
+ enum options {
+ PW_ADD, PW_CGET, PW_CONFIGURE, PW_FORGET, PW_IDENTIFY, PW_PANECGET,
+ PW_PANECONFIGURE, PW_PANES, PW_PROXY, PW_SASH
+ };
Tcl_Obj *resultObj;
int index, count, i, x, y;
Tk_Window tkwin;
Slave *slavePtr;
-
+
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
return TCL_ERROR;
@@ -498,196 +546,177 @@ PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
}
Tcl_Preserve((ClientData) pwPtr);
-
+
switch ((enum options) index) {
- case PW_ADD: {
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
- result = TCL_ERROR;
- break;
- }
-
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ case PW_ADD:
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
+ result = TCL_ERROR;
break;
}
-
- case PW_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
- result = TCL_ERROR;
- break;
- }
- resultObj = Tk_GetOptionValue(interp, (char *) pwPtr,
- pwPtr->optionTable, objv[2], pwPtr->tkwin);
+ result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ break;
+
+ case PW_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ result = TCL_ERROR;
+ break;
+ }
+ resultObj = Tk_GetOptionValue(interp, (char *) pwPtr,
+ pwPtr->optionTable, objv[2], pwPtr->tkwin);
+ if (resultObj == NULL) {
+ result = TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObj);
+ }
+ break;
+
+ case PW_CONFIGURE:
+ resultObj = NULL;
+ if (objc <= 3) {
+ resultObj = Tk_GetOptionInfo(interp, (char *) pwPtr,
+ pwPtr->optionTable,
+ (objc == 3) ? objv[2] : NULL, pwPtr->tkwin);
if (resultObj == NULL) {
result = TCL_ERROR;
} else {
Tcl_SetObjResult(interp, resultObj);
}
+ } else {
+ result = ConfigurePanedWindow(interp, pwPtr, objc - 2, objv + 2);
+ }
+ break;
+
+ case PW_FORGET: {
+ int i;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
+ result = TCL_ERROR;
break;
}
-
- case PW_CONFIGURE: {
- resultObj = NULL;
- if (objc <= 3) {
- resultObj = Tk_GetOptionInfo(interp, (char *) pwPtr,
- pwPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- pwPtr->tkwin);
- if (resultObj == NULL) {
- result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, resultObj);
- }
- } else {
- result = ConfigurePanedWindow(interp, pwPtr, objc - 2,
- objv + 2);
+
+ /*
+ * Clean up each window named in the arg list.
+ */
+ for (count = 0, i = 2; i < objc; i++) {
+ Tk_Window slave = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
+ pwPtr->tkwin);
+ if (slave == NULL) {
+ continue;
+ }
+ slavePtr = GetPane(pwPtr, slave);
+ if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
+ count++;
+ Tk_ManageGeometry(slave, NULL, (ClientData)NULL);
+ Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
+ Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
+ SlaveStructureProc, (ClientData) slavePtr);
+ Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(slavePtr);
+ }
+ if (count != 0) {
+ ComputeGeometry(pwPtr);
}
+ }
+ break;
+ }
+
+ case PW_IDENTIFY:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "x y");
+ result = TCL_ERROR;
break;
}
-
- case PW_FORGET: {
- Tk_Window slave;
- int i;
-
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
- result = TCL_ERROR;
- break;
- }
- /*
- * Clean up each window named in the arg list.
- */
- for (count = 0, i = 2; i < objc; i++) {
- slave = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
- pwPtr->tkwin);
- if (slave == NULL) {
- continue;
- }
- slavePtr = GetPane(pwPtr, slave);
- if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
- count++;
- Tk_ManageGeometry(slave, (Tk_GeomMgr *) NULL,
- (ClientData) NULL);
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, (ClientData) slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
- Unlink(slavePtr);
- }
- if (count != 0) {
- ComputeGeometry(pwPtr);
- }
- }
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
+ result = TCL_ERROR;
break;
}
+ result = PanedWindowIdentifyCoords(pwPtr, interp, x, y);
+ break;
- case PW_IDENTIFY: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "x y");
- result = TCL_ERROR;
- break;
+ case PW_PANECGET:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pane option");
+ result = TCL_ERROR;
+ break;
+ }
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), pwPtr->tkwin);
+ if (tkwin == NULL) {
+ result = TCL_ERROR;
+ break;
+ }
+ resultObj = NULL;
+ for (i = 0; i < pwPtr->numSlaves; i++) {
+ if (pwPtr->slaves[i]->tkwin == tkwin) {
+ resultObj = Tk_GetOptionValue(interp,
+ (char *) pwPtr->slaves[i], pwPtr->slaveOpts,
+ objv[3], tkwin);
}
+ }
+ if (i == pwPtr->numSlaves) {
+ Tcl_SetResult(interp, "not managed by this window", TCL_STATIC);
+ }
+ if (resultObj == NULL) {
+ result = TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObj);
+ }
+ break;
- if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
- result = TCL_ERROR;
- break;
- }
-
- result = PanedWindowIdentifyCoords(pwPtr, interp, x, y);
+ case PW_PANECONFIGURE:
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "pane ?option? ?value option value ...?");
+ result = TCL_ERROR;
break;
}
-
- case PW_PANECGET: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "pane option");
- result = TCL_ERROR;
- break;
- }
+ resultObj = NULL;
+ if (objc <= 4) {
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
pwPtr->tkwin);
- if (tkwin == NULL) {
- result = TCL_ERROR;
- break;
- }
- resultObj = NULL;
for (i = 0; i < pwPtr->numSlaves; i++) {
if (pwPtr->slaves[i]->tkwin == tkwin) {
- resultObj = Tk_GetOptionValue(interp,
+ resultObj = Tk_GetOptionInfo(interp,
(char *) pwPtr->slaves[i], pwPtr->slaveOpts,
- objv[3], tkwin);
- }
- }
- if (i == pwPtr->numSlaves) {
- Tcl_SetResult(interp, "not managed by this window",
- TCL_STATIC);
- }
- if (resultObj == NULL) {
- result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, resultObj);
- }
- break;
- }
-
- case PW_PANECONFIGURE: {
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "pane ?option? ?value option value ...?");
- result = TCL_ERROR;
- break;
- }
- resultObj = NULL;
- if (objc <= 4) {
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- pwPtr->tkwin);
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
- resultObj = Tk_GetOptionInfo(interp,
- (char *) pwPtr->slaves[i],
- pwPtr->slaveOpts,
- (objc == 4) ? objv[3] : (Tcl_Obj *) NULL,
- pwPtr->tkwin);
- if (resultObj == NULL) {
- result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, resultObj);
- }
- break;
+ (objc == 4) ? objv[3] : NULL,
+ pwPtr->tkwin);
+ if (resultObj == NULL) {
+ result = TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObj);
}
+ break;
}
- } else {
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
}
- break;
+ } else {
+ result = ConfigureSlaves(pwPtr, interp, objc, objv);
}
-
- case PW_PANES: {
- resultObj = Tcl_NewObj();
+ break;
- Tcl_IncrRefCount(resultObj);
+ case PW_PANES:
+ resultObj = Tcl_NewObj();
- for (i = 0; i < pwPtr->numSlaves; i++) {
- Tcl_ListObjAppendElement(interp, resultObj,
- Tcl_NewStringObj(Tk_PathName(pwPtr->slaves[i]->tkwin),
- -1));
- }
- Tcl_SetObjResult(interp, resultObj);
- Tcl_DecrRefCount(resultObj);
- break;
- }
+ Tcl_IncrRefCount(resultObj);
- case PW_PROXY: {
- result = PanedWindowProxyCommand(pwPtr, interp, objc, objv);
- break;
+ for (i = 0; i < pwPtr->numSlaves; i++) {
+ Tcl_ListObjAppendElement(interp, resultObj,
+ Tcl_NewStringObj(Tk_PathName(pwPtr->slaves[i]->tkwin),-1));
}
+ Tcl_SetObjResult(interp, resultObj);
+ Tcl_DecrRefCount(resultObj);
+ break;
- case PW_SASH: {
- result = PanedWindowSashCommand(pwPtr, interp, objc, objv);
- break;
- }
+ case PW_PROXY:
+ result = PanedWindowProxyCommand(pwPtr, interp, objc, objv);
+ break;
+
+ case PW_SASH:
+ result = PanedWindowSashCommand(pwPtr, interp, objc, objv);
+ break;
}
Tcl_Release((ClientData) pwPtr);
return result;
@@ -698,39 +727,38 @@ PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
*
* ConfigureSlaves --
*
- * Add or alter the configuration options of a slave in a paned
- * window.
+ * Add or alter the configuration options of a slave in a paned window.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Depends on options; may add a slave to the paned window, may
- * alter the geometry management options of a slave.
+ * Depends on options; may add a slave to the paned window, may alter the
+ * geometry management options of a slave.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(pwPtr, interp, objc, objv)
- PanedWindow *pwPtr; /* Information about paned window. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+ConfigureSlaves(
+ PanedWindow *pwPtr, /* Information about paned window. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc;
int insertIndex;
Tk_Window tkwin = NULL, ancestor, parent;
- Slave *slavePtr, **inserts, **new;
+ Slave *slavePtr, **inserts, **newSlaves;
Slave options;
char *arg;
-
+
/*
- * Find the non-window name arguments; these are the configure options
- * for the slaves. Also validate that the window names given are
- * legitimate (ie, they are real windows, they are not the panedwindow
- * itself, etc.).
+ * Find the non-window name arguments; these are the configure options for
+ * the slaves. Also validate that the window names given are legitimate
+ * (ie, they are real windows, they are not the panedwindow itself, etc.).
*/
+
for (i = 2; i < objc; i++) {
arg = Tcl_GetString(objv[i]);
if (arg[0] == '-') {
@@ -742,28 +770,32 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
* Just a plain old bad window; Tk_NameToWindow filled in an
* error message for us.
*/
+
return TCL_ERROR;
} else if (tkwin == pwPtr->tkwin) {
/*
* A panedwindow cannot manage itself.
*/
+
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "can't add ", arg, " to itself",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
} else if (Tk_IsTopLevel(tkwin)) {
/*
* A panedwindow cannot manage a toplevel.
*/
+
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "can't add toplevel ", arg, " to ",
- Tk_PathName(pwPtr->tkwin), (char *) NULL);
+ Tk_PathName(pwPtr->tkwin), NULL);
return TCL_ERROR;
} else {
/*
* Make sure the panedwindow is the parent of the slave,
* or a descendant of the slave's parent.
*/
+
parent = Tk_Parent(tkwin);
for (ancestor = pwPtr->tkwin;;ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
@@ -771,9 +803,8 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
}
if (Tk_IsTopLevel(ancestor)) {
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "can't add ", arg,
- " to ", Tk_PathName(pwPtr->tkwin),
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't add ", arg, " to ",
+ Tk_PathName(pwPtr->tkwin), NULL);
return TCL_ERROR;
}
}
@@ -784,10 +815,11 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Pre-parse the configuration options, to get the before/after specifiers
- * into an easy-to-find location (a local variable). Also, check the
+ * into an easy-to-find location (a local variable). Also, check the
* return from Tk_SetOptions once, here, so we can save a little bit of
* extra testing in the for loop below.
*/
+
memset((void *)&options, 0, sizeof(Slave));
if (Tk_SetOptions(interp, (char *) &options, pwPtr->slaveOpts,
objc - firstOptionArg, objv + firstOptionArg,
@@ -797,9 +829,10 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* If either -after or -before was given, find the numerical index that
- * corresponds to the given window. If both -after and -before are
- * given, the option precedence is: -after, then -before.
+ * corresponds to the given window. If both -after and -before are given,
+ * the option precedence is: -after, then -before.
*/
+
index = -1;
haveLoc = 0;
if (options.after != None) {
@@ -823,14 +856,14 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
}
/*
- * If a window was given for -after/-before, but it's not a window
- * managed by the panedwindow, throw an error
+ * If a window was given for -after/-before, but it's not a window managed
+ * by the panedwindow, throw an error
*/
+
if (haveLoc && index == -1) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "window \"", Tk_PathName(tkwin),
- "\" is not managed by ", Tk_PathName(pwPtr->tkwin),
- (char *) NULL);
+ "\" is not managed by ", Tk_PathName(pwPtr->tkwin), NULL);
Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts,
pwPtr->tkwin);
return TCL_ERROR;
@@ -838,23 +871,26 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Allocate an array to hold, in order, the pointers to the slave
- * structures corresponding to the windows specified. Some of those
+ * structures corresponding to the windows specified. Some of those
* structures may already have existed, some may be new.
*/
+
inserts = (Slave **)ckalloc(sizeof(Slave *) * (firstOptionArg - 2));
insertIndex = 0;
-
+
/*
* Populate the inserts array, creating new slave structures as necessary,
* applying the options to each structure as we go, and, if necessary,
- * marking the spot in the original slaves array as empty (for pre-existing
- * slave structures).
+ * marking the spot in the original slaves array as empty (for
+ * pre-existing slave structures).
*/
+
for (i = 0, numNewSlaves = 0; i < firstOptionArg - 2; i++) {
/*
* We don't check that tkwin is NULL here, because the pre-pass above
* guarantees that the input at this stage is good.
*/
+
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i + 2]),
pwPtr->tkwin);
@@ -888,8 +924,8 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Make sure this slave wasn't already put into the inserts array,
- * ie, when the user specifies the same window multiple times in
- * a single add commaned.
+ * i.e., when the user specifies the same window multiple times in a
+ * single add commaned.
*/
for (j = 0; j < insertIndex; j++) {
if (inserts[j]->tkwin == tkwin) {
@@ -900,12 +936,12 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
if (found) {
continue;
}
-
+
/*
- * Create a new slave structure and initialize it. All slaves
- * start out with their "natural" dimensions.
+ * Create a new slave structure and initialize it. All slaves start
+ * out with their "natural" dimensions.
*/
-
+
slavePtr = (Slave *) ckalloc(sizeof(Slave));
memset(slavePtr, 0, sizeof(Slave));
Tk_InitOptions(interp, (char *)slavePtr, pwPtr->slaveOpts,
@@ -913,8 +949,8 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
Tk_SetOptions(interp, (char *)slavePtr, pwPtr->slaveOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL);
- slavePtr->tkwin = tkwin;
- slavePtr->masterPtr = pwPtr;
+ slavePtr->tkwin = tkwin;
+ slavePtr->masterPtr = pwPtr;
doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
if (slavePtr->width > 0) {
slavePtr->paneWidth = slavePtr->width;
@@ -943,43 +979,44 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
}
/*
- * Allocate the new slaves array, then copy the slaves into it, in
- * order.
+ * Allocate the new slaves array, then copy the slaves into it, in order.
*/
+
i = sizeof(Slave *) * (pwPtr->numSlaves+numNewSlaves);
- new = (Slave **)ckalloc((unsigned) i);
- memset(new, 0, (size_t) i);
+ newSlaves = (Slave **)ckalloc((unsigned) i);
+ memset(newSlaves, 0, (size_t) i);
if (index == -1) {
/*
* If none of the existing slaves have to be moved, just copy the old
* and append the new.
*/
- memcpy((void *)&(new[0]), pwPtr->slaves,
+ memcpy((void *)&(newSlaves[0]), pwPtr->slaves,
sizeof(Slave *) * pwPtr->numSlaves);
- memcpy((void *)&(new[pwPtr->numSlaves]), inserts,
+ memcpy((void *)&(newSlaves[pwPtr->numSlaves]), inserts,
sizeof(Slave *) * numNewSlaves);
} else {
/*
* If some of the existing slaves were moved, the old slaves array
* will be partially populated, with some valid and some invalid
- * entries. Walk through it, copying valid entries to the new slaves
+ * entries. Walk through it, copying valid entries to the new slaves
* array as we go; when we get to the insert location for the new
* slaves, copy the inserts array over, then finish off the old slaves
* array.
*/
+
for (i = 0, j = 0; i < index; i++) {
if (pwPtr->slaves[i] != NULL) {
- new[j] = pwPtr->slaves[i];
+ newSlaves[j] = pwPtr->slaves[i];
j++;
}
}
-
- memcpy((void *)&(new[j]), inserts, sizeof(Slave *) * (insertIndex));
+
+ memcpy((void *)&(newSlaves[j]), inserts, sizeof(Slave *)*insertIndex);
j += firstOptionArg - 2;
-
+
for (i = index; i < pwPtr->numSlaves; i++) {
if (pwPtr->slaves[i] != NULL) {
- new[j] = pwPtr->slaves[i];
+ newSlaves[j] = pwPtr->slaves[i];
j++;
}
}
@@ -988,17 +1025,19 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Make the new slaves array the paned window's slave array, and clean up.
*/
+
ckfree((void *)pwPtr->slaves);
ckfree((void *)inserts);
- pwPtr->slaves = new;
+ pwPtr->slaves = newSlaves;
/*
* Set the paned window's slave count to the new value.
*/
+
pwPtr->numSlaves += numNewSlaves;
Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts, pwPtr->tkwin);
-
+
ComputeGeometry(pwPtr);
return TCL_OK;
}
@@ -1008,7 +1047,7 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
*
* PanedWindowSashCommand --
*
- * Implementation of the panedwindow sash subcommand. See the user
+ * Implementation of the panedwindow sash subcommand. See the user
* documentation for details on what it does.
*
* Results:
@@ -1021,133 +1060,132 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
*/
static int
-PanedWindowSashCommand(pwPtr, interp, objc, objv)
- PanedWindow *pwPtr; /* Pointer to paned window information. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+PanedWindowSashCommand(
+ PanedWindow *pwPtr, /* Pointer to paned window information. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- static CONST char *sashOptionStrings[] = { "coord", "dragto", "mark",
- "place", (char *) NULL };
- enum sashOptions { SASH_COORD, SASH_DRAGTO, SASH_MARK, SASH_PLACE };
+ static CONST char *sashOptionStrings[] = {
+ "coord", "dragto", "mark", "place", NULL
+ };
+ enum sashOptions {
+ SASH_COORD, SASH_DRAGTO, SASH_MARK, SASH_PLACE
+ };
int index, sash, x, y, diff;
Tcl_Obj *coords[2];
Slave *slavePtr;
-
+
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[2], sashOptionStrings,
- "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], sashOptionStrings, "option", 0,
+ &index) != TCL_OK) {
return TCL_ERROR;
}
Tcl_ResetResult(interp);
switch ((enum sashOptions) index) {
- case SASH_COORD: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- return TCL_ERROR;
- }
+ case SASH_COORD:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
+ return TCL_ERROR;
+ }
- if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) {
+ return TCL_ERROR;
+ }
- if (!ValidSashIndex(pwPtr, sash)) {
- Tcl_ResetResult(interp);
- Tcl_SetResult(interp, "invalid sash index", TCL_STATIC);
- return TCL_ERROR;
- }
- slavePtr = pwPtr->slaves[sash];
-
- coords[0] = Tcl_NewIntObj(slavePtr->sashx);
- coords[1] = Tcl_NewIntObj(slavePtr->sashy);
- Tcl_SetListObj(Tcl_GetObjResult(interp), 2, coords);
- break;
+ if (!ValidSashIndex(pwPtr, sash)) {
+ Tcl_ResetResult(interp);
+ Tcl_SetResult(interp, "invalid sash index", TCL_STATIC);
+ return TCL_ERROR;
}
+ slavePtr = pwPtr->slaves[sash];
- case SASH_MARK: {
- if (objc != 6 && objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index ?x y?");
- return TCL_ERROR;
- }
-
- if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) {
+ coords[0] = Tcl_NewIntObj(slavePtr->sashx);
+ coords[1] = Tcl_NewIntObj(slavePtr->sashy);
+ Tcl_SetListObj(Tcl_GetObjResult(interp), 2, coords);
+ break;
+
+ case SASH_MARK:
+ if (objc != 6 && objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index ?x y?");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (!ValidSashIndex(pwPtr, sash)) {
+ Tcl_ResetResult(interp);
+ Tcl_SetResult(interp, "invalid sash index", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (objc == 6) {
+ if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK) {
return TCL_ERROR;
}
- if (!ValidSashIndex(pwPtr, sash)) {
- Tcl_ResetResult(interp);
- Tcl_SetResult(interp, "invalid sash index", TCL_STATIC);
+ if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK) {
return TCL_ERROR;
}
- if (objc == 6) {
- if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK) {
- return TCL_ERROR;
- }
-
- if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK) {
- return TCL_ERROR;
- }
+ pwPtr->slaves[sash]->markx = x;
+ pwPtr->slaves[sash]->marky = y;
+ } else {
+ coords[0] = Tcl_NewIntObj(pwPtr->slaves[sash]->markx);
+ coords[1] = Tcl_NewIntObj(pwPtr->slaves[sash]->marky);
+ Tcl_SetListObj(Tcl_GetObjResult(interp), 2, coords);
+ }
+ break;
- pwPtr->slaves[sash]->markx = x;
- pwPtr->slaves[sash]->marky = y;
- } else {
- coords[0] = Tcl_NewIntObj(pwPtr->slaves[sash]->markx);
- coords[1] = Tcl_NewIntObj(pwPtr->slaves[sash]->marky);
- Tcl_SetListObj(Tcl_GetObjResult(interp), 2, coords);
- }
+ case SASH_DRAGTO:
+ case SASH_PLACE:
+ if (objc != 6) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index x y");
+ return TCL_ERROR;
+ }
- break;
+ if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) {
+ return TCL_ERROR;
}
-
- case SASH_DRAGTO:
- case SASH_PLACE: {
- if (objc != 6) {
- Tcl_WrongNumArgs(interp, 3, objv, "index x y");
- return TCL_ERROR;
- }
-
- if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) {
- return TCL_ERROR;
- }
- if (!ValidSashIndex(pwPtr, sash)) {
- Tcl_ResetResult(interp);
- Tcl_SetResult(interp, "invalid sash index", TCL_STATIC);
- return TCL_ERROR;
- }
+ if (!ValidSashIndex(pwPtr, sash)) {
+ Tcl_ResetResult(interp);
+ Tcl_SetResult(interp, "invalid sash index", TCL_STATIC);
+ return TCL_ERROR;
+ }
- if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK) {
+ return TCL_ERROR;
+ }
- if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK) {
- return TCL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ slavePtr = pwPtr->slaves[sash];
+ if (pwPtr->orient == ORIENT_HORIZONTAL) {
+ if (index == SASH_PLACE) {
+ diff = x - pwPtr->slaves[sash]->sashx;
+ } else {
+ diff = x - pwPtr->slaves[sash]->markx;
}
-
- slavePtr = pwPtr->slaves[sash];
- if (pwPtr->orient == ORIENT_HORIZONTAL) {
- if (index == SASH_PLACE) {
- diff = x - pwPtr->slaves[sash]->sashx;
- } else {
- diff = x - pwPtr->slaves[sash]->markx;
- }
+ } else {
+ if (index == SASH_PLACE) {
+ diff = y - pwPtr->slaves[sash]->sashy;
} else {
- if (index == SASH_PLACE) {
- diff = y - pwPtr->slaves[sash]->sashy;
- } else {
- diff = y - pwPtr->slaves[sash]->marky;
- }
+ diff = y - pwPtr->slaves[sash]->marky;
}
-
- MoveSash(pwPtr, sash, diff);
- ComputeGeometry(pwPtr);
}
+
+ MoveSash(pwPtr, sash, diff);
+ ComputeGeometry(pwPtr);
}
return TCL_OK;
}
@@ -1157,32 +1195,31 @@ PanedWindowSashCommand(pwPtr, interp, objc, objv)
*
* ConfigurePanedWindow --
*
- * This procedure is called to process an argv/argc list in
- * conjunction with the Tk option database to configure (or
- * reconfigure) a paned window widget.
+ * This function is called to process an argv/argc list in conjunction
+ * with the Tk option database to configure (or reconfigure) a paned
+ * window widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for pwPtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for pwPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigurePanedWindow(interp, pwPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- PanedWindow *pwPtr; /* Information about widget. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+ConfigurePanedWindow(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ PanedWindow *pwPtr, /* Information about widget. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument values. */
{
Tk_SavedOptions savedOptions;
int typemask = 0;
-
+
if (Tk_SetOptions(interp, (char *) pwPtr, pwPtr->optionTable, objc, objv,
pwPtr->tkwin, &savedOptions, &typemask) != TCL_OK) {
Tk_RestoreSavedOptions(&savedOptions);
@@ -1194,14 +1231,14 @@ ConfigurePanedWindow(interp, pwPtr, objc, objv)
PanedWindowWorldChanged((ClientData) pwPtr);
/*
- * If an option that affects geometry has changed, make a relayout
+ * If an option that affects geometry has changed, make a re-layout
* request.
*/
if (typemask & GEOMETRY) {
ComputeGeometry(pwPtr);
}
-
+
return TCL_OK;
}
@@ -1210,9 +1247,9 @@ ConfigurePanedWindow(interp, pwPtr, objc, objv)
*
* PanedWindowWorldChanged --
*
- * This procedure is invoked anytime a paned window's world has
- * changed in some way that causes the widget to have to recompute
- * graphics contexts and geometry.
+ * This function is invoked anytime a paned window's world has changed in
+ * some way that causes the widget to have to recompute graphics contexts
+ * and geometry.
*
* Results:
* None.
@@ -1224,8 +1261,8 @@ ConfigurePanedWindow(interp, pwPtr, objc, objv)
*/
static void
-PanedWindowWorldChanged(instanceData)
- ClientData instanceData; /* Information about the paned window. */
+PanedWindowWorldChanged(
+ ClientData instanceData) /* Information about the paned window. */
{
XGCValues gcValues;
GC newGC;
@@ -1235,7 +1272,7 @@ PanedWindowWorldChanged(instanceData)
* Allocated a graphics context for drawing the paned window widget
* elements (background, sashes, etc.) and set the window background.
*/
-
+
gcValues.background = Tk_3DBorderColor(pwPtr->background)->pixel;
newGC = Tk_GetGC(pwPtr->tkwin, GCBackground, &gcValues);
if (pwPtr->gc != None) {
@@ -1268,23 +1305,23 @@ PanedWindowWorldChanged(instanceData)
*
* PanedWindowEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on paned windows.
+ * This function is invoked by the Tk dispatcher for various events on
+ * paned windows.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+PanedWindowEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
@@ -1309,9 +1346,9 @@ PanedWindowEventProc(clientData, eventPtr)
*
* PanedWindowCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -1323,16 +1360,16 @@ PanedWindowEventProc(clientData, eventPtr)
*/
static void
-PanedWindowCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+PanedWindowCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted or because the command was
- * deleted, and then this procedure destroys the widget. The
- * WIDGET_DELETED flag distinguishes these cases.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted or because the command was deleted,
+ * and then this function destroys the widget. The WIDGET_DELETED flag
+ * distinguishes these cases.
*/
if (!(pwPtr->flags & WIDGET_DELETED)) {
@@ -1346,9 +1383,9 @@ PanedWindowCmdDeletedProc(clientData)
*
* DisplayPanedWindow --
*
- * This procedure redraws the contents of a paned window widget.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This function redraws the contents of a paned window widget. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
* None.
@@ -1360,8 +1397,8 @@ PanedWindowCmdDeletedProc(clientData)
*/
static void
-DisplayPanedWindow(clientData)
- ClientData clientData; /* Information about window. */
+DisplayPanedWindow(
+ ClientData clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
Slave *slavePtr;
@@ -1417,9 +1454,14 @@ DisplayPanedWindow(clientData)
for (i = 0; i < pwPtr->numSlaves - 1; i++) {
slavePtr = pwPtr->slaves[i];
- Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
- slavePtr->sashx, slavePtr->sashy,
- sashWidth, sashHeight, 1, pwPtr->sashRelief);
+ if (slavePtr->hide) {
+ continue;
+ }
+ if (sashWidth > 0 && sashHeight > 0) {
+ Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
+ slavePtr->sashx, slavePtr->sashy, sashWidth, sashHeight,
+ 1, pwPtr->sashRelief);
+ }
if (pwPtr->showHandle) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
slavePtr->handlex, slavePtr->handley,
@@ -1430,13 +1472,12 @@ DisplayPanedWindow(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
- XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc,
- 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
- 0, 0);
+ XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc, 0, 0,
+ (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0);
Tk_FreePixmap(Tk_Display(tkwin), pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
}
@@ -1446,8 +1487,8 @@ DisplayPanedWindow(clientData)
*
* DestroyPanedWindow --
*
- * This procedure is invoked by PanedWindowEventProc to free the
- * internal structure of a paned window.
+ * This function is invoked by PanedWindowEventProc to free the internal
+ * structure of a paned window.
*
* Results:
* None.
@@ -1459,23 +1500,23 @@ DisplayPanedWindow(clientData)
*/
static void
-DestroyPanedWindow(pwPtr)
- PanedWindow *pwPtr; /* Info about paned window widget. */
+DestroyPanedWindow(
+ PanedWindow *pwPtr) /* Info about paned window widget. */
{
int i;
-
+
/*
- * First mark the widget as in the process of being deleted,
- * so that any code that causes calls to other paned window procedures
- * will abort.
+ * First mark the widget as in the process of being deleted, so that any
+ * code that causes calls to other paned window functions will abort.
*/
pwPtr->flags |= WIDGET_DELETED;
/*
- * Cancel idle callbacks for redrawing the widget and for rearranging
- * the panes.
+ * Cancel idle callbacks for redrawing the widget and for rearranging the
+ * panes.
*/
+
if (pwPtr->flags & REDRAW_PENDING) {
Tcl_CancelIdleCall(DisplayPanedWindow, (ClientData) pwPtr);
}
@@ -1489,7 +1530,7 @@ DestroyPanedWindow(pwPtr)
* o Cancel geometry management for the slave.
* o Free memory for the slave
*/
-
+
for (i = 0; i < pwPtr->numSlaves; i++) {
Tk_DeleteEventHandler(pwPtr->slaves[i]->tkwin, StructureNotifyMask,
SlaveStructureProc, (ClientData) pwPtr->slaves[i]);
@@ -1525,26 +1566,25 @@ DestroyPanedWindow(pwPtr)
*
* PanedWindowReqProc --
*
- * This procedure is invoked by Tk_GeometryRequest for
- * windows managed by a paned window.
+ * This function is invoked by Tk_GeometryRequest for windows managed by
+ * a paned window.
*
* Results:
* None.
*
* Side effects:
- * Arranges for tkwin, and all its managed siblings, to
- * be re-arranged at the next idle point.
+ * Arranges for tkwin, and all its managed siblings, to be re-arranged at
+ * the next idle point.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowReqProc(clientData, tkwin)
- ClientData clientData; /* Paned window's information about
- * window that got new preferred
- * geometry. */
- Tk_Window tkwin; /* Other Tk-related information
- * about the window. */
+PanedWindowReqProc(
+ ClientData clientData, /* Paned window's information about window
+ * that got new preferred geometry. */
+ Tk_Window tkwin) /* Other Tk-related information about the
+ * window. */
{
Slave *slavePtr = (Slave *) clientData;
PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr);
@@ -1555,6 +1595,7 @@ PanedWindowReqProc(clientData, tkwin)
}
} else {
int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
+
if (slavePtr->width <= 0) {
slavePtr->paneWidth = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
}
@@ -1570,27 +1611,28 @@ PanedWindowReqProc(clientData, tkwin)
*
* PanedWindowLostSlaveProc --
*
- * This procedure is invoked by Tk whenever some other geometry
- * claims control over a slave that used to be managed by us.
+ * This function is invoked by Tk whenever some other geometry claims
+ * control over a slave that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all information about the slave. Causes geometry to
- * be recomputed for the panedwindow.
+ * Forgets all information about the slave. Causes geometry to be
+ * recomputed for the panedwindow.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Grid structure for slave window that
- * was stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+PanedWindowLostSlaveProc(
+ ClientData clientData, /* Grid structure for slave window that was
+ * stolen away. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
register Slave *slavePtr = (Slave *) clientData;
PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr);
+
if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
}
@@ -1608,11 +1650,10 @@ PanedWindowLostSlaveProc(clientData, tkwin)
*
* ArrangePanes --
*
- * This procedure is invoked (using the Tcl_DoWhenIdle
- * mechanism) to re-layout a set of windows managed by
- * a paned window. It is invoked at idle time so that a
- * series of pane requests can be merged into a single
- * layout operation.
+ * This function is invoked (using the Tcl_DoWhenIdle mechanism) to
+ * re-layout a set of windows managed by a paned window. It is invoked at
+ * idle time so that a series of pane requests can be merged into a
+ * single layout operation.
*
* Results:
* None.
@@ -1624,8 +1665,8 @@ PanedWindowLostSlaveProc(clientData, tkwin)
*/
static void
-ArrangePanes(clientData)
- ClientData clientData; /* Structure describing parent whose slaves
+ArrangePanes(
+ ClientData clientData) /* Structure describing parent whose slaves
* are to be re-layed out. */
{
register PanedWindow *pwPtr = (PanedWindow *) clientData;
@@ -1638,16 +1679,17 @@ ArrangePanes(clientData)
int sashReserve, sxReserve, syReserve;
int internalBW;
int paneDynSize, paneDynMinSize, pwHeight, pwWidth, pwSize;
+ int first, last;
int stretchReserve, stretchAmount;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING);
/*
- * If the parent has no slaves anymore, then don't do anything
- * at all: just leave the parent's size as-is. Otherwise there is
- * no way to "relinquish" control over the parent so another geometry
- * manager can take over.
+ * If the parent has no slaves anymore, then don't do anything at all:
+ * just leave the parent's size as-is. Otherwise there is no way to
+ * "relinquish" control over the parent so another geometry manager can
+ * take over.
*/
if (pwPtr->numSlaves == 0) {
@@ -1657,6 +1699,19 @@ ArrangePanes(clientData)
Tcl_Preserve((ClientData) pwPtr);
/*
+ * Find index of last visible pane.
+ */
+
+ for (i = 0, last = 0, first = -1; i < pwPtr->numSlaves; i++) {
+ if (pwPtr->slaves[i]->hide == 0) {
+ if (first < 0) {
+ first = i;
+ }
+ last = i;
+ }
+ }
+
+ /*
* First pass; compute sizes
*/
@@ -1668,8 +1723,8 @@ ArrangePanes(clientData)
stretchReserve = (horizontal ? pwWidth : pwHeight);
/*
- * Calculate the sash width, including handle and padding,
- * and the sash and handle offsets.
+ * Calculate the sash width, including handle and padding, and the sash
+ * and handle offsets.
*/
sashOffset = handleOffset = pwPtr->sashPad;
@@ -1682,14 +1737,17 @@ ArrangePanes(clientData)
handleOffset = ((pwPtr->sashWidth - pwPtr->handleSize) / 2)
+ pwPtr->sashPad;
}
- sashCount = pwPtr->numSlaves - 1;
- for (i = 0; i < pwPtr->numSlaves; i++) {
+ for (i = sashCount = 0; i < pwPtr->numSlaves; i++) {
slavePtr = pwPtr->slaves[i];
+ if (slavePtr->hide) {
+ continue;
+ }
+
/*
- * Compute the total size needed by all the slaves and the
- * left-over, or shortage of space available.
+ * Compute the total size needed by all the slaves and the left-over,
+ * or shortage of space available.
*/
if (horizontal) {
@@ -1699,11 +1757,14 @@ ArrangePanes(clientData)
paneSize = slavePtr->paneHeight;
stretchReserve -= paneSize + (2 * slavePtr->pady);
}
- if (i == sashCount) {
+ if (IsStretchable(slavePtr->stretch,i,first,last)
+ && Tk_IsMapped(pwPtr->tkwin)) {
paneDynSize += paneSize;
paneDynMinSize += slavePtr->minSize;
- } else {
+ }
+ if (i != last) {
stretchReserve -= sashWidth;
+ sashCount++;
}
}
@@ -1714,16 +1775,21 @@ ArrangePanes(clientData)
for (i = 0; i < pwPtr->numSlaves; i++) {
slavePtr = pwPtr->slaves[i];
+ if (slavePtr->hide) {
+ Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
+ Tk_UnmapWindow(slavePtr->tkwin);
+ continue;
+ }
+
/*
- * Compute the size of this slave. The algorithm (assuming a
+ * Compute the size of this slave. The algorithm (assuming a
* horizontal paned window) is:
*
- * 1. Get "base" dimensions. If a width or height is specified
- * for this slave, use those values; else use the
- * ReqWidth/ReqHeight.
+ * 1. Get "base" dimensions. If a width or height is specified for
+ * this slave, use those values; else use the ReqWidth/ReqHeight.
* 2. Using base dimensions, pane dimensions, and sticky values,
- * determine the x and y, and actual width and height of the
- * widget.
+ * determine the x and y, and actual width and height of the
+ * widget.
*/
doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
@@ -1744,37 +1810,37 @@ ArrangePanes(clientData)
paneSize = slavePtr->paneHeight;
pwSize = pwHeight;
}
- if (Tk_IsMapped(pwPtr->tkwin)) {
- if (i == pwPtr->numSlaves - 1) {
- double frac;
- if (paneDynSize > 0) {
- frac = (double)paneSize / (double)paneDynSize;
- } else {
- frac = (double)paneSize / (double)pwSize;
- }
- paneDynSize -= paneSize;
- paneDynMinSize -= slavePtr->minSize;
- stretchAmount = (int) (frac * stretchReserve);
- if (paneSize + stretchAmount >= paneMinSize) {
- stretchReserve -= stretchAmount;
- paneSize += stretchAmount;
- } else {
- stretchReserve += paneSize - paneMinSize;
- paneSize = paneMinSize;
- }
- if (stretchReserve > 0) {
- paneSize += stretchReserve;
- stretchReserve = 0;
- }
- } else if (paneDynSize - paneDynMinSize + stretchReserve < 0) {
- if (paneSize + paneDynSize - paneDynMinSize + stretchReserve
- <= paneMinSize) {
- stretchReserve += paneSize - paneMinSize;
- paneSize = paneMinSize;
- } else {
- paneSize += paneDynSize - paneDynMinSize + stretchReserve;
- stretchReserve = paneDynMinSize - paneDynSize;
- }
+ if (IsStretchable(slavePtr->stretch, i, first, last)) {
+ double frac;
+
+ if (paneDynSize > 0) {
+ frac = (double)paneSize / (double)paneDynSize;
+ } else {
+ frac = (double)paneSize / (double)pwSize;
+ }
+
+ paneDynSize -= paneSize;
+ paneDynMinSize -= slavePtr->minSize;
+ stretchAmount = (int) (frac * stretchReserve);
+ if (paneSize + stretchAmount >= paneMinSize) {
+ stretchReserve -= stretchAmount;
+ paneSize += stretchAmount;
+ } else {
+ stretchReserve += paneSize - paneMinSize;
+ paneSize = paneMinSize;
+ }
+ if (i == last && stretchReserve > 0) {
+ paneSize += stretchReserve;
+ stretchReserve = 0;
+ }
+ } else if (paneDynSize - paneDynMinSize + stretchReserve < 0) {
+ if (paneSize + paneDynSize - paneDynMinSize + stretchReserve
+ <= paneMinSize) {
+ stretchReserve += paneSize - paneMinSize;
+ paneSize = paneMinSize;
+ } else {
+ paneSize += paneDynSize - paneDynMinSize + stretchReserve;
+ stretchReserve = paneDynMinSize - paneDynSize;
}
}
if (horizontal) {
@@ -1829,8 +1895,8 @@ ArrangePanes(clientData)
if (x < internalBW) {
x = internalBW;
}
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
+ slavePtr->sashx = x + sashOffset;
+ slavePtr->sashy = y;
slavePtr->handlex = x + handleOffset;
slavePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
@@ -1839,8 +1905,8 @@ ArrangePanes(clientData)
if (y < internalBW) {
y = internalBW;
}
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
+ slavePtr->sashx = x;
+ slavePtr->sashy = y + sashOffset;
slavePtr->handlex = x + pwPtr->handlePad;
slavePtr->handley = y + handleOffset;
y += sashWidth;
@@ -1893,12 +1959,12 @@ ArrangePanes(clientData)
*/
static void
-Unlink(slavePtr)
- register Slave *slavePtr; /* Window to unlink. */
+Unlink(
+ register Slave *slavePtr) /* Window to unlink. */
{
register PanedWindow *masterPtr;
int i, j;
-
+
masterPtr = slavePtr->masterPtr;
if (masterPtr == NULL) {
return;
@@ -1921,6 +1987,7 @@ Unlink(slavePtr)
/*
* Clean out any -after or -before references to this slave
*/
+
for (i = 0; i < masterPtr->numSlaves; i++) {
if (masterPtr->slaves[i]->before == slavePtr->tkwin) {
masterPtr->slaves[i]->before = None;
@@ -1937,9 +2004,10 @@ Unlink(slavePtr)
}
/*
- * Set the slave's masterPtr to NULL, so that we can tell that the
- * slave is no longer attached to any panedwindow.
+ * Set the slave's masterPtr to NULL, so that we can tell that the slave
+ * is no longer attached to any panedwindow.
*/
+
slavePtr->masterPtr = NULL;
masterPtr->numSlaves--;
@@ -1950,12 +2018,12 @@ Unlink(slavePtr)
*
* GetPane --
*
- * Given a token to a Tk window, find the pane that corresponds to
- * that token in a given paned window.
+ * Given a token to a Tk window, find the pane that corresponds to that
+ * token in a given paned window.
*
* Results:
- * Pointer to the slave structure, or NULL if the window is not
- * managed by this paned window.
+ * Pointer to the slave structure, or NULL if the window is not managed
+ * by this paned window.
*
* Side effects:
* None.
@@ -1964,11 +2032,12 @@ Unlink(slavePtr)
*/
static Slave *
-GetPane(pwPtr, tkwin)
- PanedWindow *pwPtr; /* Pointer to the paned window info. */
- Tk_Window tkwin; /* Window to search for. */
+GetPane(
+ PanedWindow *pwPtr, /* Pointer to the paned window info. */
+ Tk_Window tkwin) /* Window to search for. */
{
int i;
+
for (i = 0; i < pwPtr->numSlaves; i++) {
if (pwPtr->slaves[i]->tkwin == tkwin) {
return pwPtr->slaves[i];
@@ -1982,10 +2051,9 @@ GetPane(pwPtr, tkwin)
*
* SlaveStructureProc --
*
- * This procedure is invoked whenever StructureNotify events
- * occur for a window that's managed by a paned window. This
- * procedure's only purpose is to clean up when windows are
- * deleted.
+ * This function is invoked whenever StructureNotify events occur for a
+ * window that's managed by a paned window. This function's only purpose
+ * is to clean up when windows are deleted.
*
* Results:
* None.
@@ -1999,13 +2067,13 @@ GetPane(pwPtr, tkwin)
*/
static void
-SlaveStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to record describing window item. */
- XEvent *eventPtr; /* Describes what just happened. */
+SlaveStructureProc(
+ ClientData clientData, /* Pointer to record describing window item. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
Slave *slavePtr = (Slave *) clientData;
PanedWindow *pwPtr = slavePtr->masterPtr;
-
+
if (eventPtr->type == DestroyNotify) {
Unlink(slavePtr);
slavePtr->tkwin = NULL;
@@ -2019,8 +2087,8 @@ SlaveStructureProc(clientData, eventPtr)
*
* ComputeGeometry --
*
- * Compute geometry for the paned window, including coordinates of
- * all slave windows and each sash.
+ * Compute geometry for the paned window, including coordinates of all
+ * slave windows and each sash.
*
* Results:
* None.
@@ -2032,8 +2100,8 @@ SlaveStructureProc(clientData, eventPtr)
*/
static void
-ComputeGeometry(pwPtr)
- PanedWindow *pwPtr; /* Pointer to the Paned Window structure. */
+ComputeGeometry(
+ PanedWindow *pwPtr) /* Pointer to the Paned Window structure. */
{
int i, x, y, doubleBw, internalBw;
int sashWidth, sashOffset, handleOffset;
@@ -2047,10 +2115,10 @@ ComputeGeometry(pwPtr)
reqWidth = reqHeight = 0;
/*
- * Sashes and handles share space on the display. To simplify
- * processing below, precompute the x and y offsets of the handles and
- * sashes within the space occupied by their combination; later, just add
- * those offsets blindly (avoiding the extra showHandle, etc, checks).
+ * Sashes and handles share space on the display. To simplify processing
+ * below, precompute the x and y offsets of the handles and sashes within
+ * the space occupied by their combination; later, just add those offsets
+ * blindly (avoiding the extra showHandle, etc, checks).
*/
sashOffset = handleOffset = pwPtr->sashPad;
@@ -2067,6 +2135,10 @@ ComputeGeometry(pwPtr)
for (i = 0; i < pwPtr->numSlaves; i++) {
slavePtr = pwPtr->slaves[i];
+ if (slavePtr->hide) {
+ continue;
+ }
+
/*
* First set the coordinates for the top left corner of the slave's
* parcel.
@@ -2076,9 +2148,9 @@ ComputeGeometry(pwPtr)
slavePtr->y = y;
/*
- * Make sure the pane's paned dimension is at least minsize.
- * This check may be redundant, since the only way to change a pane's
- * size is by moving a sash, and that code checks the minsize.
+ * Make sure the pane's paned dimension is at least minsize. This
+ * check may be redundant, since the only way to change a pane's size
+ * is by moving a sash, and that code checks the minsize.
*/
if (horizontal) {
@@ -2098,15 +2170,15 @@ ComputeGeometry(pwPtr)
if (horizontal) {
x += slavePtr->paneWidth + (2 * slavePtr->padx);
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
+ slavePtr->sashx = x + sashOffset;
+ slavePtr->sashy = y;
slavePtr->handlex = x + handleOffset;
slavePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
y += slavePtr->paneHeight + (2 * slavePtr->pady);
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
+ slavePtr->sashx = x;
+ slavePtr->sashy = y + sashOffset;
slavePtr->handlex = x + pwPtr->handlePad;
slavePtr->handley = y + handleOffset;
y += sashWidth;
@@ -2118,7 +2190,6 @@ ComputeGeometry(pwPtr)
*/
if (horizontal) {
-
/*
* If the slave has an explicit height set, use that; otherwise,
* use the slave's requested height.
@@ -2135,10 +2206,9 @@ ComputeGeometry(pwPtr)
reqHeight = dim;
}
} else {
-
/*
- * If the slave has an explicit width set use that; otherwise,
- * use the slave's requested width.
+ * If the slave has an explicit width set use that; otherwise, use
+ * the slave's requested width.
*/
if (slavePtr->width > 0) {
@@ -2155,21 +2225,21 @@ ComputeGeometry(pwPtr)
}
/*
- * The loop above should have left x (or y) equal to the sum of the
- * widths (or heights) of the widgets, plus the size of one sash and
- * the sash padding for each widget, plus the width of the left (or top)
- * border of the paned window.
+ * The loop above should have left x (or y) equal to the sum of the widths
+ * (or heights) of the widgets, plus the size of one sash and the sash
+ * padding for each widget, plus the width of the left (or top) border of
+ * the paned window.
*
* The requested width (or height) is therefore x (or y) minus the size of
- * one sash and padding, plus the width of the right (or bottom) border
- * of the paned window.
+ * one sash and padding, plus the width of the right (or bottom) border of
+ * the paned window.
*
- * The height (or width) is equal to the maximum height (or width) of
- * the slaves, plus the width of the border of the top and bottom (or left
- * and right) of the paned window.
+ * The height (or width) is equal to the maximum height (or width) of the
+ * slaves, plus the width of the border of the top and bottom (or left and
+ * right) of the paned window.
*
- * If the panedwindow has an explicit width/height set use that; otherwise,
- * use the requested width/height.
+ * If the panedwindow has an explicit width/height set use that;
+ * otherwise, use the requested width/height.
*/
if (horizontal) {
@@ -2195,8 +2265,8 @@ ComputeGeometry(pwPtr)
*
* DestroyOptionTables --
*
- * This procedure is registered as an exit callback when the paned window
- * command is first called. It cleans up the OptionTables structure
+ * This function is registered as an exit callback when the paned window
+ * command is first called. It cleans up the OptionTables structure
* allocated by that command.
*
* Results:
@@ -2209,9 +2279,9 @@ ComputeGeometry(pwPtr)
*/
static void
-DestroyOptionTables(clientData, interp)
- ClientData clientData; /* Pointer to the OptionTables struct */
- Tcl_Interp *interp; /* Pointer to the calling interp */
+DestroyOptionTables(
+ ClientData clientData, /* Pointer to the OptionTables struct */
+ Tcl_Interp *interp) /* Pointer to the calling interp */
{
ckfree((char *)clientData);
return;
@@ -2222,8 +2292,8 @@ DestroyOptionTables(clientData, interp)
*
* GetSticky -
*
- * Converts an internal boolean combination of "sticky" bits into a
- * a Tcl string obj containing zero or mor of n, s, e, or w.
+ * Converts an internal boolean combination of "sticky" bits into a Tcl
+ * string obj containing zero or more of n, s, e, or w.
*
* Results:
* Tcl_Obj containing the string representation of the sticky value.
@@ -2235,11 +2305,11 @@ DestroyOptionTables(clientData, interp)
*/
static Tcl_Obj *
-GetSticky(clientData, tkwin, recordPtr, internalOffset)
- ClientData clientData;
- Tk_Window tkwin;
- char *recordPtr; /* Pointer to widget record. */
- int internalOffset; /* Offset within *recordPtr containing the
+GetSticky(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *recordPtr, /* Pointer to widget record. */
+ int internalOffset) /* Offset within *recordPtr containing the
* sticky value. */
{
int sticky = *(int *)(recordPtr + internalOffset);
@@ -2247,16 +2317,16 @@ GetSticky(clientData, tkwin, recordPtr, internalOffset)
int count = 0;
if (sticky & STICK_NORTH) {
- buffer[count++] = 'n';
+ buffer[count++] = 'n';
}
if (sticky & STICK_EAST) {
- buffer[count++] = 'e';
+ buffer[count++] = 'e';
}
if (sticky & STICK_SOUTH) {
- buffer[count++] = 's';
+ buffer[count++] = 's';
}
if (sticky & STICK_WEST) {
- buffer[count++] = 'w';
+ buffer[count++] = 'w';
}
buffer[count] = '\0';
@@ -2268,64 +2338,70 @@ GetSticky(clientData, tkwin, recordPtr, internalOffset)
*
* SetSticky --
*
- * Converts a Tcl_Obj representing a widgets stickyness into an
- * integer value.
+ * Converts a Tcl_Obj representing a widgets stickyness into an integer
+ * value.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * May store the integer value into the internal representation
- * pointer. May change the pointer to the Tcl_Obj to NULL to indicate
- * that the specified string was empty and that is acceptable.
+ * May store the integer value into the internal representation pointer.
+ * May change the pointer to the Tcl_Obj to NULL to indicate that the
+ * specified string was empty and that is acceptable.
*
*----------------------------------------------------------------------
*/
static int
-SetSticky(clientData, interp, tkwin, value, recordPtr, internalOffset,
- oldInternalPtr, flags)
- ClientData clientData;
- Tcl_Interp *interp; /* Current interp; may be used for errors. */
- Tk_Window tkwin; /* Window for which option is being set. */
- Tcl_Obj **value; /* Pointer to the pointer to the value object.
- * We use a pointer to the pointer because
- * we may need to return a value (NULL). */
- char *recordPtr; /* Pointer to storage for the widget record. */
- int internalOffset; /* Offset within *recordPtr at which the
- internal value is to be stored. */
- char *oldInternalPtr; /* Pointer to storage for the old value. */
- int flags; /* Flags for the option, set Tk_SetOptions. */
+SetSticky(
+ ClientData clientData,
+ Tcl_Interp *interp, /* Current interp; may be used for errors. */
+ Tk_Window tkwin, /* Window for which option is being set. */
+ Tcl_Obj **value, /* Pointer to the pointer to the value object.
+ * We use a pointer to the pointer because we
+ * may need to return a value (NULL). */
+ char *recordPtr, /* Pointer to storage for the widget record. */
+ int internalOffset, /* Offset within *recordPtr at which the
+ * internal value is to be stored. */
+ char *oldInternalPtr, /* Pointer to storage for the old value. */
+ int flags) /* Flags for the option, set Tk_SetOptions. */
{
int sticky = 0;
char c, *string, *internalPtr;
internalPtr = ComputeSlotAddress(recordPtr, internalOffset);
-
+
if (flags & TK_OPTION_NULL_OK && ObjectIsEmpty(*value)) {
*value = NULL;
} else {
/*
* Convert the sticky specifier into an integer value.
*/
-
+
string = Tcl_GetString(*value);
-
+
while ((c = *string++) != '\0') {
switch (c) {
- case 'n': case 'N': sticky |= STICK_NORTH; break;
- case 'e': case 'E': sticky |= STICK_EAST; break;
- case 's': case 'S': sticky |= STICK_SOUTH; break;
- case 'w': case 'W': sticky |= STICK_WEST; break;
- case ' ': case ',': case '\t': case '\r': case '\n': break;
- default: {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad stickyness value \"",
- Tcl_GetString(*value), "\": must be a string ",
- "containing zero or more of n, e, s, and w",
- (char *)NULL);
- return TCL_ERROR;
- }
+ case 'n': case 'N':
+ sticky |= STICK_NORTH;
+ break;
+ case 'e': case 'E':
+ sticky |= STICK_EAST;
+ break;
+ case 's': case 'S':
+ sticky |= STICK_SOUTH;
+ break;
+ case 'w': case 'W':
+ sticky |= STICK_WEST;
+ break;
+ case ' ': case ',': case '\t': case '\r': case '\n':
+ break;
+ default:
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bad stickyness value \"",
+ Tcl_GetString(*value), "\": must be a string ",
+ "containing zero or more of n, e, s, and w", NULL);
+ return TCL_ERROR;
}
}
}
@@ -2335,7 +2411,7 @@ SetSticky(clientData, interp, tkwin, value, recordPtr, internalOffset,
*((int *) internalPtr) = sticky;
}
return TCL_OK;
-}
+}
/*
*----------------------------------------------------------------------
@@ -2354,11 +2430,11 @@ SetSticky(clientData, interp, tkwin, value, recordPtr, internalOffset,
*/
static void
-RestoreSticky(clientData, tkwin, internalPtr, oldInternalPtr)
- ClientData clientData;
- Tk_Window tkwin;
- char *internalPtr; /* Pointer to storage for value. */
- char *oldInternalPtr; /* Pointer to old value. */
+RestoreSticky(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *internalPtr, /* Pointer to storage for value. */
+ char *oldInternalPtr) /* Pointer to old value. */
{
*(int *)internalPtr = *(int *)oldInternalPtr;
}
@@ -2368,14 +2444,13 @@ RestoreSticky(clientData, tkwin, internalPtr, oldInternalPtr)
*
* AdjustForSticky --
*
- * Given the x,y coords of the top-left corner of a pane, the
- * dimensions of that pane, and the dimensions of a slave, compute
- * the x,y coords and actual dimensions of the slave based on the slave's
- * sticky value.
+ * Given the x,y coords of the top-left corner of a pane, the dimensions
+ * of that pane, and the dimensions of a slave, compute the x,y coords
+ * and actual dimensions of the slave based on the slave's sticky value.
*
* Results:
- * No direct return; sets the x, y, slaveWidth and slaveHeight to
- * correct values.
+ * No direct return; sets the x, y, slaveWidth and slaveHeight to correct
+ * values.
*
* Side effects:
* None.
@@ -2384,19 +2459,19 @@ RestoreSticky(clientData, tkwin, internalPtr, oldInternalPtr)
*/
static void
-AdjustForSticky(sticky, cavityWidth, cavityHeight, xPtr, yPtr,
- slaveWidthPtr, slaveHeightPtr)
- int sticky; /* Sticky value; see top of file for definition. */
- int cavityWidth; /* Width of the cavity. */
- int cavityHeight; /* Height of the cavity. */
- int *xPtr, *yPtr; /* Initially, coordinates of the top-left
+AdjustForSticky(
+ int sticky, /* Sticky value; see top of file for
+ * definition. */
+ int cavityWidth, /* Width of the cavity. */
+ int cavityHeight, /* Height of the cavity. */
+ int *xPtr, int *yPtr, /* Initially, coordinates of the top-left
* corner of cavity; also return values for
* actual x, y coords of slave. */
- int *slaveWidthPtr; /* Slave width. */
- int *slaveHeightPtr; /* Slave height. */
+ int *slaveWidthPtr, /* Slave width. */
+ int *slaveHeightPtr) /* Slave height. */
{
- int diffx=0; /* Cavity width - slave width. */
- int diffy=0; /* Cavity hight - slave height. */
+ int diffx = 0; /* Cavity width - slave width. */
+ int diffy = 0; /* Cavity hight - slave height. */
if (cavityWidth > *slaveWidthPtr) {
diffx = cavityWidth - *slaveWidthPtr;
@@ -2413,10 +2488,10 @@ AdjustForSticky(sticky, cavityWidth, cavityHeight, xPtr, yPtr,
*slaveHeightPtr += diffy;
}
if (!(sticky & STICK_WEST)) {
- *xPtr += (sticky & STICK_EAST) ? diffx : diffx/2;
+ *xPtr += (sticky & STICK_EAST) ? diffx : diffx/2;
}
if (!(sticky & STICK_NORTH)) {
- *yPtr += (sticky & STICK_SOUTH) ? diffy : diffy/2;
+ *yPtr += (sticky & STICK_SOUTH) ? diffy : diffy/2;
}
}
@@ -2437,10 +2512,10 @@ AdjustForSticky(sticky, cavityWidth, cavityHeight, xPtr, yPtr,
*/
static void
-MoveSash(pwPtr, sash, diff)
- PanedWindow *pwPtr;
- int sash;
- int diff;
+MoveSash(
+ PanedWindow *pwPtr,
+ int sash,
+ int diff)
{
int i;
int expandPane, reduceFirst, reduceLast, reduceIncr, slaveSize, sashOffset;
@@ -2464,6 +2539,9 @@ MoveSash(pwPtr, sash, diff)
}
for (i = 0; i < pwPtr->numSlaves; i++) {
slavePtr = pwPtr->slaves[i];
+ if (slavePtr->hide) {
+ continue;
+ }
if (horizontal) {
slavePtr->paneWidth = slavePtr->width = slavePtr->sashx
- sashOffset - slavePtr->x - (2 * slavePtr->padx);
@@ -2474,6 +2552,16 @@ MoveSash(pwPtr, sash, diff)
}
/*
+ * There must be a next sash since it is only possible to enter this
+ * routine when moving an actual sash which implies there exists a visible
+ * pane to either side of the sash.
+ */
+
+ while (nextSash < pwPtr->numSlaves-1 && pwPtr->slaves[nextSash]->hide) {
+ nextSash++;
+ }
+
+ /*
* Consolidate +/-diff variables to reduce duplicate code.
*/
@@ -2491,12 +2579,15 @@ MoveSash(pwPtr, sash, diff)
}
/*
- * Calculate how much room we have to stretch in
- * and adjust diff value accordingly.
+ * Calculate how much room we have to stretch in and adjust diff value
+ * accordingly.
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
slavePtr = pwPtr->slaves[i];
+ if (slavePtr->hide) {
+ continue;
+ }
if (horizontal) {
stretchReserve += slavePtr->width - slavePtr->minSize;
} else {
@@ -2527,6 +2618,9 @@ MoveSash(pwPtr, sash, diff)
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
slavePtr = pwPtr->slaves[i];
+ if (slavePtr->hide) {
+ continue;
+ }
if (horizontal) {
slaveSize = slavePtr->width;
} else {
@@ -2552,23 +2646,23 @@ MoveSash(pwPtr, sash, diff)
*
* ProxyWindowEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on paned window proxy windows.
+ * This function is invoked by the Tk dispatcher for various events on
+ * paned window proxy windows.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. Whena
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-ProxyWindowEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+ProxyWindowEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
@@ -2585,9 +2679,9 @@ ProxyWindowEventProc(clientData, eventPtr)
*
* DisplayProxyWindow --
*
- * This procedure redraws a paned window proxy window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This function redraws a paned window proxy window. It is invoked as a
+ * do-when-idle handler, so it only runs when there's nothing else for
+ * the application to do.
*
* Results:
* None.
@@ -2599,8 +2693,8 @@ ProxyWindowEventProc(clientData, eventPtr)
*/
static void
-DisplayProxyWindow(clientData)
- ClientData clientData; /* Information about window. */
+DisplayProxyWindow(
+ ClientData clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
Pixmap pixmap;
@@ -2624,6 +2718,7 @@ DisplayProxyWindow(clientData)
/*
* Redraw the widget's background and border.
*/
+
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, 0, 0,
Tk_Width(tkwin), Tk_Height(tkwin), 2, pwPtr->sashRelief);
@@ -2631,9 +2726,9 @@ DisplayProxyWindow(clientData)
/*
* Copy the pixmap to the display.
*/
- XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc,
- 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
- 0, 0);
+
+ XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc, 0, 0,
+ (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0);
Tk_FreePixmap(Tk_Display(tkwin), pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
}
@@ -2643,8 +2738,8 @@ DisplayProxyWindow(clientData)
*
* PanedWindowProxyCommand --
*
- * Handles the panedwindow proxy subcommand. See the user
- * documentation for details.
+ * Handles the panedwindow proxy subcommand. See the user documentation
+ * for details.
*
* Results:
* Standard Tcl result.
@@ -2656,18 +2751,21 @@ DisplayProxyWindow(clientData)
*/
static int
-PanedWindowProxyCommand(pwPtr, interp, objc, objv)
- PanedWindow *pwPtr; /* Pointer to paned window information. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+PanedWindowProxyCommand(
+ PanedWindow *pwPtr, /* Pointer to paned window information. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- static CONST char *optionStrings[] = { "coord", "forget", "place",
- (char *) NULL };
- enum options { PROXY_COORD, PROXY_FORGET, PROXY_PLACE };
+ static CONST char *optionStrings[] = {
+ "coord", "forget", "place", NULL
+ };
+ enum options {
+ PROXY_COORD, PROXY_FORGET, PROXY_PLACE
+ };
int index, x, y, sashWidth, sashHeight;
Tcl_Obj *coords[2];
-
+
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?");
return TCL_ERROR;
@@ -2679,85 +2777,92 @@ PanedWindowProxyCommand(pwPtr, interp, objc, objv)
}
switch ((enum options) index) {
- case PROXY_COORD:
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, NULL);
- return TCL_ERROR;
- }
+ case PROXY_COORD:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
- coords[0] = Tcl_NewIntObj(pwPtr->proxyx);
- coords[1] = Tcl_NewIntObj(pwPtr->proxyy);
- Tcl_SetListObj(Tcl_GetObjResult(interp), 2, coords);
- break;
+ coords[0] = Tcl_NewIntObj(pwPtr->proxyx);
+ coords[1] = Tcl_NewIntObj(pwPtr->proxyy);
+ Tcl_SetListObj(Tcl_GetObjResult(interp), 2, coords);
+ break;
- case PROXY_FORGET:
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, NULL);
- return TCL_ERROR;
- }
- if (Tk_IsMapped(pwPtr->proxywin)) {
- Tk_UnmapWindow(pwPtr->proxywin);
- Tk_UnmaintainGeometry(pwPtr->proxywin, pwPtr->tkwin);
- }
- break;
+ case PROXY_FORGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
+ if (Tk_IsMapped(pwPtr->proxywin)) {
+ Tk_UnmapWindow(pwPtr->proxywin);
+ Tk_UnmaintainGeometry(pwPtr->proxywin, pwPtr->tkwin);
+ }
+ break;
- case PROXY_PLACE: {
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "x y");
- return TCL_ERROR;
- }
+ case PROXY_PLACE:
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "x y");
+ return TCL_ERROR;
+ }
- if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
+ return TCL_ERROR;
+ }
- if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) {
+ return TCL_ERROR;
+ }
- if (pwPtr->orient == ORIENT_HORIZONTAL) {
- if (x < 0) {
- x = 0;
- }
- y = Tk_InternalBorderWidth(pwPtr->tkwin);
- sashWidth = pwPtr->sashWidth;
- sashHeight = Tk_Height(pwPtr->tkwin) -
- (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
- } else {
- if (y < 0) {
- y = 0;
- }
- x = Tk_InternalBorderWidth(pwPtr->tkwin);
- sashHeight = pwPtr->sashWidth;
- sashWidth = Tk_Width(pwPtr->tkwin) -
+ if (pwPtr->orient == ORIENT_HORIZONTAL) {
+ if (x < 0) {
+ x = 0;
+ }
+ y = Tk_InternalBorderWidth(pwPtr->tkwin);
+ sashWidth = pwPtr->sashWidth;
+ sashHeight = Tk_Height(pwPtr->tkwin) -
(2 * Tk_InternalBorderWidth(pwPtr->tkwin));
+ } else {
+ if (y < 0) {
+ y = 0;
}
+ x = Tk_InternalBorderWidth(pwPtr->tkwin);
+ sashHeight = pwPtr->sashWidth;
+ sashWidth = Tk_Width(pwPtr->tkwin) -
+ (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
+ }
- /*
- * Stash the proxy coordinates for future "proxy coord" calls.
- */
+ if (sashWidth < 1) {
+ sashWidth = 1;
+ }
+ if (sashHeight < 1) {
+ sashHeight = 1;
+ }
- pwPtr->proxyx = x;
- pwPtr->proxyy = y;
-
- /*
- * Make sure the proxy window is higher in the stacking order
- * than the slaves, so that it will be visible when drawn.
- * It would be more correct to push the proxy window just high
- * enough to appear above the highest slave, but it's much easier
- * to just force it all the way to the top of the stacking order.
- */
-
- Tk_RestackWindow(pwPtr->proxywin, Above, NULL);
-
- /*
- * Let Tk_MaintainGeometry take care of placing the window at
- * the right coordinates.
- */
- Tk_MaintainGeometry(pwPtr->proxywin, pwPtr->tkwin,
- x, y, sashWidth, sashHeight);
- break;
- }
+ /*
+ * Stash the proxy coordinates for future "proxy coord" calls.
+ */
+
+ pwPtr->proxyx = x;
+ pwPtr->proxyy = y;
+
+ /*
+ * Make sure the proxy window is higher in the stacking order than the
+ * slaves, so that it will be visible when drawn. It would be more
+ * correct to push the proxy window just high enough to appear above
+ * the highest slave, but it's much easier to just force it all the
+ * way to the top of the stacking order.
+ */
+
+ Tk_RestackWindow(pwPtr->proxywin, Above, NULL);
+
+ /*
+ * Let Tk_MaintainGeometry take care of placing the window at the
+ * right coordinates.
+ */
+
+ Tk_MaintainGeometry(pwPtr->proxywin, pwPtr->tkwin, x, y,
+ sashWidth, sashHeight);
+ break;
}
return TCL_OK;
@@ -2768,12 +2873,11 @@ PanedWindowProxyCommand(pwPtr, interp, objc, objv)
*
* ObjectIsEmpty --
*
- * This procedure tests whether the string value of an object is
- * empty.
+ * This function tests whether the string value of an object is empty.
*
* Results:
- * The return value is 1 if the string value of objPtr has length
- * zero, and 0 otherwise.
+ * The return value is 1 if the string value of objPtr has length zero,
+ * and 0 otherwise.
*
* Side effects:
* May cause object shimmering, since this function can force a
@@ -2783,8 +2887,8 @@ PanedWindowProxyCommand(pwPtr, interp, objc, objv)
*/
static int
-ObjectIsEmpty(objPtr)
- Tcl_Obj *objPtr; /* Object to test. May be NULL. */
+ObjectIsEmpty(
+ Tcl_Obj *objPtr) /* Object to test. May be NULL. */
{
int length;
@@ -2807,8 +2911,8 @@ ObjectIsEmpty(objPtr)
* within that record, compute the address of that slot.
*
* Results:
- * If offset is non-negative, returns the computed address; else,
- * returns NULL.
+ * If offset is non-negative, returns the computed address; else, returns
+ * NULL.
*
* Side effects:
* None.
@@ -2817,9 +2921,9 @@ ObjectIsEmpty(objPtr)
*/
static char *
-ComputeSlotAddress(recordPtr, offset)
- char *recordPtr; /* Pointer to the start of a record. */
- int offset; /* Offset of a slot within that record; may be < 0. */
+ComputeSlotAddress(
+ char *recordPtr, /* Pointer to the start of a record. */
+ int offset) /* Offset of a slot within that record; may be < 0. */
{
if (offset >= 0) {
return recordPtr + offset;
@@ -2833,25 +2937,25 @@ ComputeSlotAddress(recordPtr, offset)
*
* PanedWindowIdentifyCoords --
*
- * Given a pair of x,y coordinates, identify the panedwindow component
- * at that point, if any.
+ * Given a pair of x,y coordinates, identify the panedwindow component at
+ * that point, if any.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Modifies the interpreter's result to contain either an empty list,
- * or a two element list of the form {sash n} or {handle n} to indicate
- * that the point lies within the n'th sash or handle.
+ * Modifies the interpreter's result to contain either an empty list, or
+ * a two element list of the form {sash n} or {handle n} to indicate that
+ * the point lies within the n'th sash or handle.
*
*----------------------------------------------------------------------
*/
static int
-PanedWindowIdentifyCoords(pwPtr, interp, x, y)
- PanedWindow *pwPtr; /* Information about the widget. */
- Tcl_Interp *interp; /* Interpreter in which to store result. */
- int x, y; /* Coordinates of the point to identify. */
+PanedWindowIdentifyCoords(
+ PanedWindow *pwPtr, /* Information about the widget. */
+ Tcl_Interp *interp, /* Interpreter in which to store result. */
+ int x, int y) /* Coordinates of the point to identify. */
{
Tcl_Obj *list;
int i, sashHeight, sashWidth, thisx, thisy;
@@ -2860,45 +2964,48 @@ PanedWindowIdentifyCoords(pwPtr, interp, x, y)
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (Tk_IsMapped(pwPtr->tkwin)) {
- sashHeight = Tk_Height(pwPtr->tkwin);
+ sashHeight = Tk_Height(pwPtr->tkwin);
} else {
- sashHeight = Tk_ReqHeight(pwPtr->tkwin);
+ sashHeight = Tk_ReqHeight(pwPtr->tkwin);
}
- sashHeight -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
+ sashHeight -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
- sashWidth = pwPtr->handleSize;
- lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
- rpad = pwPtr->handleSize - lpad;
- lpad += pwPtr->sashPad;
- rpad += pwPtr->sashPad;
+ sashWidth = pwPtr->handleSize;
+ lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
+ rpad = pwPtr->handleSize - lpad;
+ lpad += pwPtr->sashPad;
+ rpad += pwPtr->sashPad;
} else {
- sashWidth = pwPtr->sashWidth;
+ sashWidth = pwPtr->sashWidth;
lpad = rpad = pwPtr->sashPad;
}
- tpad = bpad = 0;
+ tpad = bpad = 0;
} else {
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
- sashHeight = pwPtr->handleSize;
- tpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
- bpad = pwPtr->handleSize - tpad;
- tpad += pwPtr->sashPad;
- bpad += pwPtr->sashPad;
+ sashHeight = pwPtr->handleSize;
+ tpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
+ bpad = pwPtr->handleSize - tpad;
+ tpad += pwPtr->sashPad;
+ bpad += pwPtr->sashPad;
} else {
- sashHeight = pwPtr->sashWidth;
+ sashHeight = pwPtr->sashWidth;
tpad = bpad = pwPtr->sashPad;
}
if (Tk_IsMapped(pwPtr->tkwin)) {
- sashWidth = Tk_Width(pwPtr->tkwin);
+ sashWidth = Tk_Width(pwPtr->tkwin);
} else {
- sashWidth = Tk_ReqWidth(pwPtr->tkwin);
+ sashWidth = Tk_ReqWidth(pwPtr->tkwin);
}
- sashWidth -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
- lpad = rpad = 0;
+ sashWidth -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
+ lpad = rpad = 0;
}
-
+
isHandle = 0;
found = -1;
for (i = 0; i < pwPtr->numSlaves - 1; i++) {
+ if (pwPtr->slaves[i]->hide) {
+ continue;
+ }
thisx = pwPtr->slaves[i]->sashx;
thisy = pwPtr->slaves[i]->sashy;
@@ -2909,6 +3016,7 @@ PanedWindowIdentifyCoords(pwPtr, interp, x, y)
/*
* Determine if the point is over the handle or the sash.
*/
+
if (pwPtr->showHandle) {
thisx = pwPtr->slaves[i]->handlex;
thisy = pwPtr->slaves[i]->handley;
@@ -2929,17 +3037,21 @@ PanedWindowIdentifyCoords(pwPtr, interp, x, y)
/*
* Set results.
*/
+
if (found != -1) {
Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(found));
- if (isHandle) {
- Tcl_ListObjAppendElement(interp, list,
- Tcl_NewStringObj("handle", -1));
- } else {
- Tcl_ListObjAppendElement(interp, list,
- Tcl_NewStringObj("sash", -1));
- }
+ Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(
+ (isHandle ? "handle" : "sash"), -1));
}
-
+
Tcl_SetObjResult(interp, list);
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index b239947..951cd8f 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -1,85 +1,86 @@
-/*
+/*
* tkPlace.c --
*
- * This file contains code to implement a simple geometry manager
- * for Tk based on absolute placement or "rubber-sheet" placement.
+ * This file contains code to implement a simple geometry manager for Tk
+ * based on absolute placement or "rubber-sheet" placement.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
-
/*
* Border modes for relative placement:
*
- * BM_INSIDE: relative distances computed using area inside
- * all borders of master window.
- * BM_OUTSIDE: relative distances computed using outside area
- * that includes all borders of master.
- * BM_IGNORE: border issues are ignored: place relative to
- * master's actual window size.
+ * BM_INSIDE: relative distances computed using area inside all
+ * borders of master window.
+ * BM_OUTSIDE: relative distances computed using outside area that
+ * includes all borders of master.
+ * BM_IGNORE: border issues are ignored: place relative to master's
+ * actual window size.
*/
static char *borderModeStrings[] = {
- "inside", "outside", "ignore", (char *) NULL
+ "inside", "outside", "ignore", NULL
};
typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode;
/*
- * For each window whose geometry is managed by the placer there is
- * a structure of the following type:
+ * For each window whose geometry is managed by the placer there is a
+ * structure of the following type:
*/
typedef struct Slave {
Tk_Window tkwin; /* Tk's token for window. */
Tk_Window inTkwin; /* Token for the -in window. */
- struct Master *masterPtr; /* Pointer to information for window
- * relative to which tkwin is placed.
- * This isn't necessarily the logical
- * parent of tkwin. NULL means the
- * master was deleted or never assigned. */
- struct Slave *nextPtr; /* Next in list of windows placed relative
- * to same master (NULL for end of list). */
+ struct Master *masterPtr; /* Pointer to information for window relative
+ * to which tkwin is placed. This isn't
+ * necessarily the logical parent of tkwin.
+ * NULL means the master was deleted or never
+ * assigned. */
+ struct Slave *nextPtr; /* Next in list of windows placed relative to
+ * same master (NULL for end of list). */
Tk_OptionTable optionTable; /* Table that defines configuration options
* available for this command. */
/*
- * Geometry information for window; where there are both relative
- * and absolute values for the same attribute (e.g. x and relX) only
- * one of them is actually used, depending on flags.
+ * Geometry information for window; where there are both relative and
+ * absolute values for the same attribute (e.g. x and relX) only one of
+ * them is actually used, depending on flags.
*/
int x, y; /* X and Y pixel coordinates for tkwin. */
- Tcl_Obj *xPtr, *yPtr; /* Tcl_Obj rep's of x, y coords, to keep
- * pixel spec. information */
+ Tcl_Obj *xPtr, *yPtr; /* Tcl_Obj rep's of x, y coords, to keep pixel
+ * spec. information. */
double relX, relY; /* X and Y coordinates relative to size of
* master. */
int width, height; /* Absolute dimensions for tkwin. */
- Tcl_Obj *widthPtr; /* Tcl_Obj rep of width, to keep pixel spec */
- Tcl_Obj *heightPtr; /* Tcl_Obj rep of height, to keep pixel spec */
+ Tcl_Obj *widthPtr; /* Tcl_Obj rep of width, to keep pixel
+ * spec. */
+ Tcl_Obj *heightPtr; /* Tcl_Obj rep of height, to keep pixel
+ * spec. */
double relWidth, relHeight; /* Dimensions for tkwin relative to size of
* master. */
Tcl_Obj *relWidthPtr;
Tcl_Obj *relHeightPtr;
- Tk_Anchor anchor; /* Which point on tkwin is placed at the
- * given position. */
+ Tk_Anchor anchor; /* Which point on tkwin is placed at the given
+ * position. */
BorderMode borderMode; /* How to treat borders of master window. */
- int flags; /* Various flags; see below for bit
+ int flags; /* Various flags; see below for bit
* definitions. */
} Slave;
/*
* Type masks for options:
*/
+
#define IN_MASK 1
-static Tk_OptionSpec optionSpecs[] = {
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1,
Tk_Offset(Slave, anchor), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1,
@@ -104,10 +105,9 @@ static Tk_OptionSpec optionSpecs[] = {
Tk_Offset(Slave, x), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Slave, yPtr),
Tk_Offset(Slave, y), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
-
+
/*
* Flag definitions for Slave structures:
*
@@ -123,14 +123,14 @@ static Tk_OptionSpec optionSpecs[] = {
#define CHILD_REL_HEIGHT 8
/*
- * For each master window that has a slave managed by the placer there
- * is a structure of the following form:
+ * For each master window that has a slave managed by the placer there is a
+ * structure of the following form:
*/
typedef struct Master {
Tk_Window tkwin; /* Tk's token for master window. */
- struct Slave *slavePtr; /* First in linked list of slaves
- * placed relative to this master. */
+ struct Slave *slavePtr; /* First in linked list of slaves placed
+ * relative to this master. */
int *abortPtr; /* If non-NULL, it means that there is a nested
* call to RecomputePlacement already working on
* this window. *abortPtr may be set to 1 to
@@ -143,58 +143,54 @@ typedef struct Master {
/*
* Flag definitions for masters:
*
- * PARENT_RECONFIG_PENDING - 1 means that a call to RecomputePlacement
- * is already pending via a Do_When_Idle handler.
+ * PARENT_RECONFIG_PENDING - 1 means that a call to RecomputePlacement is
+ * already pending via a Do_When_Idle handler.
*/
#define PARENT_RECONFIG_PENDING 1
/*
- * The following structure is the official type record for the
- * placer:
+ * The following structure is the official type record for the placer:
*/
-static void PlaceRequestProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void PlaceLostSlaveProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
+static void PlaceRequestProc(ClientData clientData,
+ Tk_Window tkwin);
+static void PlaceLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
-static Tk_GeomMgr placerType = {
- "place", /* name */
- PlaceRequestProc, /* requestProc */
- PlaceLostSlaveProc, /* lostSlaveProc */
+static const Tk_GeomMgr placerType = {
+ "place", /* name */
+ PlaceRequestProc, /* requestProc */
+ PlaceLostSlaveProc, /* lostSlaveProc */
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void SlaveStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int ConfigureSlave _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_OptionTable table,
- int objc, Tcl_Obj *CONST objv[]));
-static int PlaceInfoCommand _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin));
-static Slave * CreateSlave _ANSI_ARGS_((Tk_Window tkwin,
- Tk_OptionTable table));
-static void FreeSlave _ANSI_ARGS_((Slave *slavePtr));
-static Slave * FindSlave _ANSI_ARGS_((Tk_Window tkwin));
-static Master * CreateMaster _ANSI_ARGS_((Tk_Window tkwin));
-static Master * FindMaster _ANSI_ARGS_((Tk_Window tkwin));
-static void MasterStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void RecomputePlacement _ANSI_ARGS_((ClientData clientData));
-static void UnlinkSlave _ANSI_ARGS_((Slave *slavePtr));
+static void SlaveStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_OptionTable table, int objc,
+ Tcl_Obj *CONST objv[]);
+static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin);
+static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table);
+static void FreeSlave(Slave *slavePtr);
+static Slave * FindSlave(Tk_Window tkwin);
+static Master * CreateMaster(Tk_Window tkwin);
+static Master * FindMaster(Tk_Window tkwin);
+static void MasterStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static void RecomputePlacement(ClientData clientData);
+static void UnlinkSlave(Slave *slavePtr);
/*
*--------------------------------------------------------------
*
* Tk_PlaceObjCmd --
*
- * This procedure is invoked to process the "place" Tcl
- * commands. See the user documentation for details on
- * what it does.
+ * This function is invoked to process the "place" Tcl commands. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -206,11 +202,11 @@ static void UnlinkSlave _ANSI_ARGS_((Slave *slavePtr));
*/
int
-Tk_PlaceObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_PlaceObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin;
Slave *slavePtr;
@@ -218,23 +214,22 @@ Tk_PlaceObjCmd(clientData, interp, objc, objv)
TkDisplay *dispPtr;
Tk_OptionTable optionTable;
static CONST char *optionStrings[] = {
- "configure", "forget", "info", "slaves", (char *) NULL
+ "configure", "forget", "info", "slaves", NULL
};
enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
int index;
-
-
+
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "option|pathName args");
return TCL_ERROR;
}
/*
- * Create the option table for this widget class. If it has already
- * been created, the cached pointer will be returned.
+ * Create the option table for this widget class. If it has already been
+ * created, the cached pointer will be returned.
*/
- optionTable = Tk_CreateOptionTable(interp, optionSpecs);
+ optionTable = Tk_CreateOptionTable(interp, optionSpecs);
/*
* Handle special shortcut where window name is first argument.
@@ -262,8 +257,8 @@ Tk_PlaceObjCmd(clientData, interp, objc, objv)
}
/*
- * Handle more general case of option followed by window name followed
- * by possible additional arguments.
+ * Handle more general case of option followed by window name followed by
+ * possible additional arguments.
*/
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
@@ -289,81 +284,74 @@ Tk_PlaceObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case PLACE_CONFIGURE: {
+ case PLACE_CONFIGURE:
+ if (objc == 3 || objc == 4) {
Tcl_Obj *objPtr;
- if (objc == 3 || objc == 4) {
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
- return TCL_OK;
- }
- objPtr = Tk_GetOptionInfo(interp, (char *) slavePtr,
- optionTable,
- (objc == 4) ? objv[3] : (Tcl_Obj *) NULL, tkwin);
- if (objPtr == NULL) {
- return TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- return TCL_OK;
- }
- } else {
- return ConfigureSlave(interp, tkwin, optionTable, objc-3,
- objv+3);
- }
- }
-
- case PLACE_FORGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "pathName");
- return TCL_ERROR;
- }
+
slavePtr = FindSlave(tkwin);
if (slavePtr == NULL) {
return TCL_OK;
}
- if ((slavePtr->masterPtr != NULL) &&
- (slavePtr->masterPtr->tkwin !=
- Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
- }
- UnlinkSlave(slavePtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- (char *) tkwin));
- Tk_DeleteEventHandler(tkwin, StructureNotifyMask,
- SlaveStructureProc, (ClientData) slavePtr);
- Tk_ManageGeometry(tkwin, (Tk_GeomMgr *) NULL, (ClientData) NULL);
- Tk_UnmapWindow(tkwin);
- FreeSlave(slavePtr);
- break;
- }
-
- case PLACE_INFO: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "pathName");
+ objPtr = Tk_GetOptionInfo(interp, (char *) slavePtr, optionTable,
+ (objc == 4) ? objv[3] : NULL, tkwin);
+ if (objPtr == NULL) {
return TCL_ERROR;
}
- return PlaceInfoCommand(interp, tkwin);
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
}
+ return ConfigureSlave(interp, tkwin, optionTable, objc-3, objv+3);
- case PLACE_SLAVES: {
- Master *masterPtr;
- Tcl_Obj *listPtr;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "pathName");
- return TCL_ERROR;
- }
- masterPtr = FindMaster(tkwin);
- if (masterPtr != NULL) {
- listPtr = Tcl_NewObj();
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- Tcl_ListObjAppendElement(interp, listPtr,
- Tcl_NewStringObj(Tk_PathName(slavePtr->tkwin),-1));
- }
- Tcl_SetObjResult(interp, listPtr);
+ case PLACE_FORGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pathName");
+ return TCL_ERROR;
+ }
+ slavePtr = FindSlave(tkwin);
+ if (slavePtr == NULL) {
+ return TCL_OK;
+ }
+ if ((slavePtr->masterPtr != NULL) &&
+ (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
+ Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ }
+ UnlinkSlave(slavePtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
+ (char *) tkwin));
+ Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
+ (ClientData) slavePtr);
+ Tk_ManageGeometry(tkwin, NULL, (ClientData) NULL);
+ Tk_UnmapWindow(tkwin);
+ FreeSlave(slavePtr);
+ break;
+
+ case PLACE_INFO:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pathName");
+ return TCL_ERROR;
+ }
+ return PlaceInfoCommand(interp, tkwin);
+
+ case PLACE_SLAVES: {
+ Master *masterPtr;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pathName");
+ return TCL_ERROR;
+ }
+ masterPtr = FindMaster(tkwin);
+ if (masterPtr != NULL) {
+ Tcl_Obj *listPtr = Tcl_NewObj();
+
+ for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
+ slavePtr = slavePtr->nextPtr) {
+ Tcl_ListObjAppendElement(interp, listPtr,
+ Tcl_NewStringObj(Tk_PathName(slavePtr->tkwin),-1));
}
- break;
+ Tcl_SetObjResult(interp, listPtr);
}
+ break;
+ }
}
return TCL_OK;
@@ -374,8 +362,8 @@ Tk_PlaceObjCmd(clientData, interp, objc, objv)
*
* CreateSlave --
*
- * Given a Tk_Window token, find the Slave structure corresponding
- * to that token, creating a new one if necessary.
+ * Given a Tk_Window token, find the Slave structure corresponding to
+ * that token, creating a new one if necessary.
*
* Results:
* Pointer to the Slave structure.
@@ -387,34 +375,37 @@ Tk_PlaceObjCmd(clientData, interp, objc, objv)
*/
static Slave *
-CreateSlave(tkwin, table)
- Tk_Window tkwin; /* Token for desired slave. */
- Tk_OptionTable table;
+CreateSlave(
+ Tk_Window tkwin, /* Token for desired slave. */
+ Tk_OptionTable table)
{
Tcl_HashEntry *hPtr;
register Slave *slavePtr;
- int new;
- TkDisplay * dispPtr = ((TkWindow *) tkwin)->dispPtr;
-
- hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &new);
- if (new) {
- slavePtr = (Slave *) ckalloc(sizeof(Slave));
- memset(slavePtr, 0, sizeof(Slave));
- slavePtr->tkwin = tkwin;
- slavePtr->inTkwin = None;
- slavePtr->anchor = TK_ANCHOR_NW;
- slavePtr->borderMode = BM_INSIDE;
- slavePtr->optionTable = table;
- Tcl_SetHashValue(hPtr, slavePtr);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- (ClientData) slavePtr);
- Tk_ManageGeometry(tkwin, &placerType, (ClientData) slavePtr);
- } else {
- slavePtr = (Slave *) Tcl_GetHashValue(hPtr);
+ int isNew;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+
+ hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew);
+ if (!isNew) {
+ return (Slave *) Tcl_GetHashValue(hPtr);
}
+
+ /*
+ * No preexisting slave structure for that window, so make a new one and
+ * populate it with some default values.
+ */
+
+ slavePtr = (Slave *) ckalloc(sizeof(Slave));
+ memset(slavePtr, 0, sizeof(Slave));
+ slavePtr->tkwin = tkwin;
+ slavePtr->inTkwin = None;
+ slavePtr->anchor = TK_ANCHOR_NW;
+ slavePtr->borderMode = BM_INSIDE;
+ slavePtr->optionTable = table;
+ Tcl_SetHashValue(hPtr, slavePtr);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
+ (ClientData) slavePtr);
return slavePtr;
}
-
/*
*----------------------------------------------------------------------
@@ -433,22 +424,22 @@ CreateSlave(tkwin, table)
*/
static void
-FreeSlave(Slave *slavePtr)
+FreeSlave(
+ Slave *slavePtr)
{
Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable,
slavePtr->tkwin);
ckfree((char *) slavePtr);
}
-
/*
*----------------------------------------------------------------------
*
* FindSlave --
*
- * Given a Tk_Window token, find the Slave structure corresponding
- * to that token. This is purely a lookup function; it will not
- * create a record if one does not yet exist.
+ * Given a Tk_Window token, find the Slave structure corresponding to
+ * that token. This is purely a lookup function; it will not create a
+ * record if one does not yet exist.
*
* Results:
* Pointer to Slave structure; NULL if none exists.
@@ -460,12 +451,12 @@ FreeSlave(Slave *slavePtr)
*/
static Slave *
-FindSlave(tkwin)
- Tk_Window tkwin; /* Token for desired slave. */
+FindSlave(
+ Tk_Window tkwin) /* Token for desired slave. */
{
Tcl_HashEntry *hPtr;
register Slave *slavePtr;
- TkDisplay * dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin);
if (hPtr == NULL) {
@@ -480,8 +471,8 @@ FindSlave(tkwin)
*
* UnlinkSlave --
*
- * This procedure removes a slave window from the chain of slaves
- * in its master.
+ * This function removes a slave window from the chain of slaves in its
+ * master.
*
* Results:
* None.
@@ -493,8 +484,8 @@ FindSlave(tkwin)
*/
static void
-UnlinkSlave(slavePtr)
- Slave *slavePtr; /* Slave structure to be unlinked. */
+UnlinkSlave(
+ Slave *slavePtr) /* Slave structure to be unlinked. */
{
register Master *masterPtr;
register Slave *prevPtr;
@@ -506,10 +497,9 @@ UnlinkSlave(slavePtr)
if (masterPtr->slavePtr == slavePtr) {
masterPtr->slavePtr = slavePtr->nextPtr;
} else {
- for (prevPtr = masterPtr->slavePtr; ;
- prevPtr = prevPtr->nextPtr) {
+ for (prevPtr = masterPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
- panic("UnlinkSlave couldn't find slave to unlink");
+ Tcl_Panic("UnlinkSlave couldn't find slave to unlink");
}
if (prevPtr->nextPtr == slavePtr) {
prevPtr->nextPtr = slavePtr->nextPtr;
@@ -529,8 +519,8 @@ UnlinkSlave(slavePtr)
*
* CreateMaster --
*
- * Given a Tk_Window token, find the Master structure corresponding
- * to that token, creating a new one if necessary.
+ * Given a Tk_Window token, find the Master structure corresponding to
+ * that token, creating a new one if necessary.
*
* Results:
* Pointer to the Master structure.
@@ -542,21 +532,21 @@ UnlinkSlave(slavePtr)
*/
static Master *
-CreateMaster(tkwin)
- Tk_Window tkwin; /* Token for desired master. */
+CreateMaster(
+ Tk_Window tkwin) /* Token for desired master. */
{
Tcl_HashEntry *hPtr;
register Master *masterPtr;
- int new;
- TkDisplay * dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ int isNew;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &new);
- if (new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew);
+ if (isNew) {
masterPtr = (Master *) ckalloc(sizeof(Master));
- masterPtr->tkwin = tkwin;
- masterPtr->slavePtr = NULL;
- masterPtr->abortPtr = NULL;
- masterPtr->flags = 0;
+ masterPtr->tkwin = tkwin;
+ masterPtr->slavePtr = NULL;
+ masterPtr->abortPtr = NULL;
+ masterPtr->flags = 0;
Tcl_SetHashValue(hPtr, masterPtr);
Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask,
MasterStructureProc, (ClientData) masterPtr);
@@ -571,13 +561,13 @@ CreateMaster(tkwin)
*
* FindMaster --
*
- * Given a Tk_Window token, find the Master structure corresponding
- * to that token. This is simply a lookup procedure; a new record
- * will not be created if one does not already exist.
+ * Given a Tk_Window token, find the Master structure corresponding to
+ * that token. This is simply a lookup function; a new record will not be
+ * created if one does not already exist.
*
* Results:
- * Pointer to the Master structure; NULL if one does not exist for
- * the given Tk_Window token.
+ * Pointer to the Master structure; NULL if one does not exist for the
+ * given Tk_Window token.
*
* Side effects:
* None.
@@ -586,12 +576,12 @@ CreateMaster(tkwin)
*/
static Master *
-FindMaster(tkwin)
- Tk_Window tkwin; /* Token for desired master. */
+FindMaster(
+ Tk_Window tkwin) /* Token for desired master. */
{
Tcl_HashEntry *hPtr;
register Master *masterPtr;
- TkDisplay * dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, (char *) tkwin);
if (hPtr == NULL) {
@@ -606,38 +596,37 @@ FindMaster(tkwin)
*
* ConfigureSlave --
*
- * This procedure is called to process an argv/argc list to
- * reconfigure the placement of a window.
+ * This function is called to process an argv/argc list to reconfigure
+ * the placement of a window.
*
* Results:
- * A standard Tcl result. If an error occurs then a message is
- * left in the interp's result.
+ * A standard Tcl result. If an error occurs then a message is left in
+ * the interp's result.
*
* Side effects:
- * Information in slavePtr may change, and slavePtr's master is
- * scheduled for reconfiguration.
+ * Information in slavePtr may change, and slavePtr's master is scheduled
+ * for reconfiguration.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlave(interp, tkwin, table, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Window tkwin; /* Token for the window to manipulate. */
- Tk_OptionTable table; /* Token for option table. */
- int objc; /* Number of config arguments. */
- Tcl_Obj *CONST objv[]; /* Object values for arguments. */
+ConfigureSlave(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Window tkwin, /* Token for the window to manipulate. */
+ Tk_OptionTable table, /* Token for option table. */
+ int objc, /* Number of config arguments. */
+ Tcl_Obj *CONST objv[]) /* Object values for arguments. */
{
register Master *masterPtr;
Tk_SavedOptions savedOptions;
int mask;
- int result = TCL_OK;
Slave *slavePtr;
-
+ Tk_Window masterWin = (Tk_Window) NULL;
+
if (Tk_TopWinHierarchy(tkwin)) {
Tcl_AppendResult(interp, "can't use placer on top-level window \"",
- Tk_PathName(tkwin), "\"; use wm command instead",
- (char *) NULL);
+ Tk_PathName(tkwin), "\"; use wm command instead", NULL);
return TCL_ERROR;
}
@@ -645,24 +634,51 @@ ConfigureSlave(interp, tkwin, table, objc, objv)
if (Tk_SetOptions(interp, (char *) slavePtr, table, objc, objv,
slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) {
- Tk_RestoreSavedOptions(&savedOptions);
- result = TCL_ERROR;
- goto done;
+ goto error;
+ }
+
+ /*
+ * Set slave flags. First clear the field, then add bits as needed.
+ */
+
+ slavePtr->flags = 0;
+ if (slavePtr->heightPtr) {
+ slavePtr->flags |= CHILD_HEIGHT;
+ }
+
+ if (slavePtr->relHeightPtr) {
+ slavePtr->flags |= CHILD_REL_HEIGHT;
+ }
+
+ if (slavePtr->relWidthPtr) {
+ slavePtr->flags |= CHILD_REL_WIDTH;
+ }
+
+ if (slavePtr->widthPtr) {
+ slavePtr->flags |= CHILD_WIDTH;
}
- if (mask & IN_MASK) {
+ if (((mask & IN_MASK) == 0) && (slavePtr->masterPtr != NULL)) {
+ /*
+ * If no -in option was passed and the slave is already placed then
+ * just recompute the placement.
+ */
+
+ masterPtr = slavePtr->masterPtr;
+ goto scheduleLayout;
+ } else if (mask & IN_MASK) {
/* -in changed */
Tk_Window tkwin;
Tk_Window ancestor;
-
+
tkwin = slavePtr->inTkwin;
-
+
/*
- * Make sure that the new master is either the logical parent
- * of the slave or a descendant of that window, and that the
- * master and slave aren't the same.
+ * Make sure that the new master is either the logical parent of the
+ * slave or a descendant of that window, and that the master and slave
+ * aren't the same.
*/
-
+
for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == Tk_Parent(slavePtr->tkwin)) {
break;
@@ -670,80 +686,72 @@ ConfigureSlave(interp, tkwin, table, objc, objv)
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_AppendResult(interp, "can't place ",
Tk_PathName(slavePtr->tkwin), " relative to ",
- Tk_PathName(tkwin), (char *) NULL);
- result = TCL_ERROR;
- Tk_RestoreSavedOptions(&savedOptions);
- goto done;
+ Tk_PathName(tkwin), NULL);
+ goto error;
}
}
if (slavePtr->tkwin == tkwin) {
Tcl_AppendResult(interp, "can't place ",
Tk_PathName(slavePtr->tkwin), " relative to itself",
- (char *) NULL);
- result = TCL_ERROR;
- Tk_RestoreSavedOptions(&savedOptions);
- goto done;
+ NULL);
+ goto error;
}
if ((slavePtr->masterPtr != NULL)
&& (slavePtr->masterPtr->tkwin == tkwin)) {
/*
- * Re-using same old master. Nothing to do.
+ * Re-using same old master. Nothing to do.
*/
- } else {
- if ((slavePtr->masterPtr != NULL)
- && (slavePtr->masterPtr->tkwin
- != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
- }
- UnlinkSlave(slavePtr);
- slavePtr->masterPtr = CreateMaster(tkwin);
- slavePtr->nextPtr = slavePtr->masterPtr->slavePtr;
- slavePtr->masterPtr->slavePtr = slavePtr;
+
+ masterPtr = slavePtr->masterPtr;
+ goto scheduleLayout;
+ }
+ if ((slavePtr->masterPtr != NULL) &&
+ (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
+ Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
}
+ UnlinkSlave(slavePtr);
+ masterWin = tkwin;
}
/*
- * Set slave flags. First clear the field, then add bits as needed.
+ * If there's no master specified for this slave, use its Tk_Parent.
*/
- slavePtr->flags = 0;
- if (slavePtr->heightPtr) {
- slavePtr->flags |= CHILD_HEIGHT;
- }
-
- if (slavePtr->relHeightPtr) {
- slavePtr->flags |= CHILD_REL_HEIGHT;
+ if (masterWin == NULL) {
+ masterWin = Tk_Parent(slavePtr->tkwin);
+ slavePtr->inTkwin = masterWin;
}
- if (slavePtr->relWidthPtr) {
- slavePtr->flags |= CHILD_REL_WIDTH;
- }
+ /*
+ * Manage the slave window in this master.
+ */
- if (slavePtr->widthPtr) {
- slavePtr->flags |= CHILD_WIDTH;
- }
+ masterPtr = CreateMaster(masterWin);
+ slavePtr->masterPtr = masterPtr;
+ slavePtr->nextPtr = masterPtr->slavePtr;
+ masterPtr->slavePtr = slavePtr;
+ Tk_ManageGeometry(slavePtr->tkwin, &placerType, (ClientData) slavePtr);
/*
- * If there's no master specified for this slave, use its Tk_Parent.
- * Then arrange for a placement recalculation in the master.
+ * Arrange for the master to be re-arranged at the first idle moment.
*/
+ scheduleLayout:
Tk_FreeSavedOptions(&savedOptions);
- done:
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
- masterPtr = CreateMaster(Tk_Parent(slavePtr->tkwin));
- slavePtr->masterPtr = masterPtr;
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
- }
- slavePtr->inTkwin = masterPtr->tkwin;
+
if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
masterPtr->flags |= PARENT_RECONFIG_PENDING;
Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr);
}
- return result;
+ return TCL_OK;
+
+ /*
+ * Error while processing some option, cleanup and return.
+ */
+
+ error:
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
}
/*
@@ -751,27 +759,27 @@ ConfigureSlave(interp, tkwin, table, objc, objv)
*
* PlaceInfoCommand --
*
- * Implementation of the [place info] subcommand. See the user
+ * Implementation of the [place info] subcommand. See the user
* documentation for information on what it does.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * If the given tkwin is managed by the placer, this function will
- * put information about that placement in the interp's result.
+ * If the given tkwin is managed by the placer, this function will put
+ * information about that placement in the interp's result.
*
*----------------------------------------------------------------------
*/
static int
-PlaceInfoCommand(interp, tkwin)
- Tcl_Interp *interp; /* Interp into which to place result. */
- Tk_Window tkwin; /* Token for the window to get info on. */
+PlaceInfoCommand(
+ Tcl_Interp *interp, /* Interp into which to place result. */
+ Tk_Window tkwin) /* Token for the window to get info on. */
{
char buffer[32 + TCL_INTEGER_SPACE];
Slave *slavePtr;
-
+
slavePtr = FindSlave(tkwin);
if (slavePtr == NULL) {
return TCL_OK;
@@ -781,38 +789,38 @@ PlaceInfoCommand(interp, tkwin)
Tcl_AppendElement(interp, Tk_PathName(slavePtr->masterPtr->tkwin));
}
sprintf(buffer, " -x %d", slavePtr->x);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
sprintf(buffer, " -relx %.4g", slavePtr->relX);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
sprintf(buffer, " -y %d", slavePtr->y);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
sprintf(buffer, " -rely %.4g", slavePtr->relY);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
if (slavePtr->flags & CHILD_WIDTH) {
sprintf(buffer, " -width %d", slavePtr->width);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
} else {
- Tcl_AppendResult(interp, " -width {}", (char *) NULL);
+ Tcl_AppendResult(interp, " -width {}", NULL);
}
if (slavePtr->flags & CHILD_REL_WIDTH) {
sprintf(buffer, " -relwidth %.4g", slavePtr->relWidth);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
} else {
- Tcl_AppendResult(interp, " -relwidth {}", (char *) NULL);
+ Tcl_AppendResult(interp, " -relwidth {}", NULL);
}
if (slavePtr->flags & CHILD_HEIGHT) {
sprintf(buffer, " -height %d", slavePtr->height);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
} else {
- Tcl_AppendResult(interp, " -height {}", (char *) NULL);
+ Tcl_AppendResult(interp, " -height {}", NULL);
}
if (slavePtr->flags & CHILD_REL_HEIGHT) {
sprintf(buffer, " -relheight %.4g", slavePtr->relHeight);
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
} else {
- Tcl_AppendResult(interp, " -relheight {}", (char *) NULL);
+ Tcl_AppendResult(interp, " -relheight {}", NULL);
}
-
+
Tcl_AppendElement(interp, "-anchor");
Tcl_AppendElement(interp, Tk_NameOfAnchor(slavePtr->anchor));
Tcl_AppendElement(interp, "-bordermode");
@@ -825,8 +833,8 @@ PlaceInfoCommand(interp, tkwin)
*
* RecomputePlacement --
*
- * This procedure is called as a when-idle handler. It recomputes
- * the geometries of all the slaves of a given master.
+ * This function is called as a when-idle handler. It recomputes the
+ * geometries of all the slaves of a given master.
*
* Results:
* None.
@@ -838,8 +846,8 @@ PlaceInfoCommand(interp, tkwin)
*/
static void
-RecomputePlacement(clientData)
- ClientData clientData; /* Pointer to Master record. */
+RecomputePlacement(
+ ClientData clientData) /* Pointer to Master record. */
{
register Master *masterPtr = (Master *) clientData;
register Slave *slavePtr;
@@ -866,18 +874,17 @@ RecomputePlacement(clientData)
Tcl_Preserve((ClientData) masterPtr);
/*
- * Iterate over all the slaves for the master. Each slave's
- * geometry can be computed independently of the other slaves.
- * Changes to the window's structure could cause almost anything
- * to happen, including deleting the parent or child. If this
- * happens, we'll be told to abort.
+ * Iterate over all the slaves for the master. Each slave's geometry can
+ * be computed independently of the other slaves. Changes to the window's
+ * structure could cause almost anything to happen, including deleting the
+ * parent or child. If this happens, we'll be told to abort.
*/
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort;
- slavePtr = slavePtr->nextPtr) {
+ slavePtr = slavePtr->nextPtr) {
/*
- * Step 1: compute size and borderwidth of master, taking into
- * account desired border mode.
+ * Step 1: compute size and borderwidth of master, taking into account
+ * desired border mode.
*/
masterX = masterY = 0;
@@ -886,18 +893,18 @@ RecomputePlacement(clientData)
if (slavePtr->borderMode == BM_INSIDE) {
masterX = Tk_InternalBorderLeft(masterPtr->tkwin);
masterY = Tk_InternalBorderTop(masterPtr->tkwin);
- masterWidth -= masterX + Tk_InternalBorderRight(masterPtr->tkwin);
- masterHeight -= masterY +
+ masterWidth -= masterX + Tk_InternalBorderRight(masterPtr->tkwin);
+ masterHeight -= masterY +
Tk_InternalBorderBottom(masterPtr->tkwin);
} else if (slavePtr->borderMode == BM_OUTSIDE) {
masterX = masterY = -Tk_Changes(masterPtr->tkwin)->border_width;
- masterWidth -= 2 * masterX;
- masterHeight -= 2 * masterY;
+ masterWidth -= 2 * masterX;
+ masterHeight -= 2 * masterY;
}
/*
- * Step 2: compute size of slave (outside dimensions including
- * border) and location of anchor point within master.
+ * Step 2: compute size of slave (outside dimensions including border)
+ * and location of anchor point within master.
*/
x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth);
@@ -911,11 +918,11 @@ RecomputePlacement(clientData)
}
if (slavePtr->flags & CHILD_REL_WIDTH) {
/*
- * The code below is a bit tricky. In order to round
- * correctly when both relX and relWidth are specified,
- * compute the location of the right edge and round that,
- * then compute width. If we compute the width and round
- * it, rounding errors in relX and relWidth accumulate.
+ * The code below is a bit tricky. In order to round correctly
+ * when both relX and relWidth are specified, compute the
+ * location of the right edge and round that, then compute
+ * width. If we compute the width and round it, rounding
+ * errors in relX and relWidth accumulate.
*/
x2 = x1 + (slavePtr->relWidth*masterWidth);
@@ -932,7 +939,7 @@ RecomputePlacement(clientData)
height += slavePtr->height;
}
if (slavePtr->flags & CHILD_REL_HEIGHT) {
- /*
+ /*
* See note above for rounding errors in width computation.
*/
@@ -946,47 +953,47 @@ RecomputePlacement(clientData)
}
/*
- * Step 3: adjust the x and y positions so that the desired
- * anchor point on the slave appears at that position. Also
- * adjust for the border mode and master's border.
+ * Step 3: adjust the x and y positions so that the desired anchor
+ * point on the slave appears at that position. Also adjust for the
+ * border mode and master's border.
*/
switch (slavePtr->anchor) {
- case TK_ANCHOR_N:
- x -= width/2;
- break;
- case TK_ANCHOR_NE:
- x -= width;
- break;
- case TK_ANCHOR_E:
- x -= width;
- y -= height/2;
- break;
- case TK_ANCHOR_SE:
- x -= width;
- y -= height;
- break;
- case TK_ANCHOR_S:
- x -= width/2;
- y -= height;
- break;
- case TK_ANCHOR_SW:
- y -= height;
- break;
- case TK_ANCHOR_W:
- y -= height/2;
- break;
- case TK_ANCHOR_NW:
- break;
- case TK_ANCHOR_CENTER:
- x -= width/2;
- y -= height/2;
- break;
+ case TK_ANCHOR_N:
+ x -= width/2;
+ break;
+ case TK_ANCHOR_NE:
+ x -= width;
+ break;
+ case TK_ANCHOR_E:
+ x -= width;
+ y -= height/2;
+ break;
+ case TK_ANCHOR_SE:
+ x -= width;
+ y -= height;
+ break;
+ case TK_ANCHOR_S:
+ x -= width/2;
+ y -= height;
+ break;
+ case TK_ANCHOR_SW:
+ y -= height;
+ break;
+ case TK_ANCHOR_W:
+ y -= height/2;
+ break;
+ case TK_ANCHOR_NW:
+ break;
+ case TK_ANCHOR_CENTER:
+ x -= width/2;
+ y -= height/2;
+ break;
}
/*
* Step 4: adjust width and height again to reflect inside dimensions
- * of window rather than outside. Also make sure that the width and
+ * of window rather than outside. Also make sure that the width and
* height aren't zero.
*/
@@ -1000,11 +1007,10 @@ RecomputePlacement(clientData)
}
/*
- * Step 5: reconfigure the window and map it if needed. If the
- * slave is a child of the master, we do this ourselves. If the
- * slave isn't a child of the master, let Tk_MaintainGeometry do
- * the work (it will re-adjust things as relevant windows map,
- * unmap, and move).
+ * Step 5: reconfigure the window and map it if needed. If the slave
+ * is a child of the master, we do this ourselves. If the slave isn't
+ * a child of the master, let Tk_MaintainGeometry do the work (it will
+ * re-adjust things as relevant windows map, unmap, and move).
*/
if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
@@ -1019,8 +1025,8 @@ RecomputePlacement(clientData)
}
/*
- * Don't map the slave unless the master is mapped: the slave
- * will get mapped later, when the master is mapped.
+ * Don't map the slave unless the master is mapped: the slave will
+ * get mapped later, when the master is mapped.
*/
if (Tk_IsMapped(masterPtr->tkwin)) {
@@ -1046,24 +1052,24 @@ RecomputePlacement(clientData)
*
* MasterStructureProc --
*
- * This procedure is invoked by the Tk event handler when
- * StructureNotify events occur for a master window.
+ * This function is invoked by the Tk event handler when StructureNotify
+ * events occur for a master window.
*
* Results:
* None.
*
* Side effects:
- * Structures get cleaned up if the window was deleted. If the
- * window was resized then slave geometries get recomputed.
+ * Structures get cleaned up if the window was deleted. If the window was
+ * resized then slave geometries get recomputed.
*
*----------------------------------------------------------------------
*/
static void
-MasterStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to Master structure for window
+MasterStructureProc(
+ ClientData clientData, /* Pointer to Master structure for window
* referred to by eventPtr. */
- XEvent *eventPtr; /* Describes what just happened. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
register Master *masterPtr = (Master *) clientData;
register Slave *slavePtr, *nextPtr;
@@ -1094,8 +1100,8 @@ MasterStructureProc(clientData, eventPtr)
Tcl_EventuallyFree((ClientData) masterPtr, TCL_DYNAMIC);
} else if (eventPtr->type == MapNotify) {
/*
- * When a master gets mapped, must redo the geometry computation
- * so that all of its slaves get remapped.
+ * When a master gets mapped, must redo the geometry computation so
+ * that all of its slaves get remapped.
*/
if ((masterPtr->slavePtr != NULL)
@@ -1105,8 +1111,8 @@ MasterStructureProc(clientData, eventPtr)
}
} else if (eventPtr->type == UnmapNotify) {
/*
- * Unmap all of the slaves when the master gets unmapped,
- * so that they don't keep redisplaying themselves.
+ * Unmap all of the slaves when the master gets unmapped, so that they
+ * don't keep redisplaying themselves.
*/
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
@@ -1121,8 +1127,8 @@ MasterStructureProc(clientData, eventPtr)
*
* SlaveStructureProc --
*
- * This procedure is invoked by the Tk event handler when
- * StructureNotify events occur for a slave window.
+ * This function is invoked by the Tk event handler when StructureNotify
+ * events occur for a slave window.
*
* Results:
* None.
@@ -1134,16 +1140,18 @@ MasterStructureProc(clientData, eventPtr)
*/
static void
-SlaveStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to Slave structure for window
+SlaveStructureProc(
+ ClientData clientData, /* Pointer to Slave structure for window
* referred to by eventPtr. */
- XEvent *eventPtr; /* Describes what just happened. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
register Slave *slavePtr = (Slave *) clientData;
- TkDisplay * dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
if (eventPtr->type == DestroyNotify) {
- UnlinkSlave(slavePtr);
+ if (slavePtr->masterPtr != NULL) {
+ UnlinkSlave(slavePtr);
+ }
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
(char *) slavePtr->tkwin));
FreeSlave(slavePtr);
@@ -1155,25 +1163,24 @@ SlaveStructureProc(clientData, eventPtr)
*
* PlaceRequestProc --
*
- * This procedure is invoked by Tk whenever a slave managed by us
- * changes its requested geometry.
+ * This function is invoked by Tk whenever a slave managed by us changes
+ * its requested geometry.
*
* Results:
* None.
*
* Side effects:
- * The window will get relayed out, if its requested size has
- * anything to do with its actual size.
+ * The window will get relayed out, if its requested size has anything to
+ * do with its actual size.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
-PlaceRequestProc(clientData, tkwin)
- ClientData clientData; /* Pointer to our record for slave. */
- Tk_Window tkwin; /* Window that changed its desired
- * size. */
+PlaceRequestProc(
+ ClientData clientData, /* Pointer to our record for slave. */
+ Tk_Window tkwin) /* Window that changed its desired size. */
{
Slave *slavePtr = (Slave *) clientData;
Master *masterPtr;
@@ -1197,8 +1204,8 @@ PlaceRequestProc(clientData, tkwin)
*
* PlaceLostSlaveProc --
*
- * This procedure is invoked by Tk whenever some other geometry
- * claims control over a slave that used to be managed by us.
+ * This function is invoked by Tk whenever some other geometry claims
+ * control over a slave that used to be managed by us.
*
* Results:
* None.
@@ -1211,22 +1218,30 @@ PlaceRequestProc(clientData, tkwin)
/* ARGSUSED */
static void
-PlaceLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Slave structure for slave window that
- * was stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+PlaceLostSlaveProc(
+ ClientData clientData, /* Slave structure for slave window that was
+ * stolen away. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
register Slave *slavePtr = (Slave *) clientData;
- TkDisplay * dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
}
Tk_UnmapWindow(tkwin);
UnlinkSlave(slavePtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- (char *) tkwin));
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
+ (char *) tkwin));
Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
(ClientData) slavePtr);
FreeSlave(slavePtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index f38f93b..5b386ee 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -29,130 +29,129 @@
* Exported function declarations:
*/
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef Tk_AttachHWND_TCL_DECLARED
+#define Tk_AttachHWND_TCL_DECLARED
/* 0 */
-EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin,
- HWND hwnd));
-/* 1 */
-EXTERN HINSTANCE Tk_GetHINSTANCE _ANSI_ARGS_((void));
-/* 2 */
-EXTERN HWND Tk_GetHWND _ANSI_ARGS_((Window window));
-/* 3 */
-EXTERN Tk_Window Tk_HWNDToWindow _ANSI_ARGS_((HWND hwnd));
-/* 4 */
-EXTERN void Tk_PointerEvent _ANSI_ARGS_((HWND hwnd, int x, int y));
-/* 5 */
-EXTERN int Tk_TranslateWinEvent _ANSI_ARGS_((HWND hwnd,
- UINT message, WPARAM wParam, LPARAM lParam,
- LRESULT * result));
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
-/* 0 */
-EXTERN void Tk_MacSetEmbedHandler _ANSI_ARGS_((
- Tk_MacEmbedRegisterWinProc * registerWinProcPtr,
- Tk_MacEmbedGetGrafPortProc * getPortProcPtr,
- Tk_MacEmbedMakeContainerExistProc * containerExistProcPtr,
- Tk_MacEmbedGetClipProc * getClipProc,
- Tk_MacEmbedGetOffsetInParentProc * getOffsetProc));
+EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd);
+#endif
+#ifndef Tk_GetHINSTANCE_TCL_DECLARED
+#define Tk_GetHINSTANCE_TCL_DECLARED
/* 1 */
-EXTERN void Tk_MacTurnOffMenus _ANSI_ARGS_((void));
+EXTERN HINSTANCE Tk_GetHINSTANCE(void);
+#endif
+#ifndef Tk_GetHWND_TCL_DECLARED
+#define Tk_GetHWND_TCL_DECLARED
/* 2 */
-EXTERN void Tk_MacTkOwnsCursor _ANSI_ARGS_((int tkOwnsIt));
+EXTERN HWND Tk_GetHWND(Window window);
+#endif
+#ifndef Tk_HWNDToWindow_TCL_DECLARED
+#define Tk_HWNDToWindow_TCL_DECLARED
/* 3 */
-EXTERN void TkMacInitMenus _ANSI_ARGS_((Tcl_Interp * interp));
+EXTERN Tk_Window Tk_HWNDToWindow(HWND hwnd);
+#endif
+#ifndef Tk_PointerEvent_TCL_DECLARED
+#define Tk_PointerEvent_TCL_DECLARED
/* 4 */
-EXTERN void TkMacInitAppleEvents _ANSI_ARGS_((
- Tcl_Interp * interp));
+EXTERN void Tk_PointerEvent(HWND hwnd, int x, int y);
+#endif
+#ifndef Tk_TranslateWinEvent_TCL_DECLARED
+#define Tk_TranslateWinEvent_TCL_DECLARED
/* 5 */
-EXTERN int TkMacConvertEvent _ANSI_ARGS_((
- EventRecord * eventPtr));
-/* 6 */
-EXTERN int TkMacConvertTkEvent _ANSI_ARGS_((
- EventRecord * eventPtr, Window window));
-/* 7 */
-EXTERN void TkGenWMConfigureEvent _ANSI_ARGS_((Tk_Window tkwin,
- int x, int y, int width, int height,
- int flags));
-/* 8 */
-EXTERN void TkMacInvalClipRgns _ANSI_ARGS_((TkWindow * winPtr));
-/* 9 */
-EXTERN int TkMacHaveAppearance _ANSI_ARGS_((void));
-/* 10 */
-EXTERN GWorldPtr TkMacGetDrawablePort _ANSI_ARGS_((Drawable drawable));
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ LRESULT *result);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+#ifndef Tk_MacOSXSetEmbedHandler_TCL_DECLARED
+#define Tk_MacOSXSetEmbedHandler_TCL_DECLARED
/* 0 */
-EXTERN void Tk_MacOSXSetEmbedHandler _ANSI_ARGS_((
- Tk_MacOSXEmbedRegisterWinProc * registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc * getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc * containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc * getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc * getOffsetProc));
+EXTERN void Tk_MacOSXSetEmbedHandler(
+ Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
+ Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
+ Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
+ Tk_MacOSXEmbedGetClipProc *getClipProc,
+ Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
+#endif
+#ifndef Tk_MacOSXTurnOffMenus_TCL_DECLARED
+#define Tk_MacOSXTurnOffMenus_TCL_DECLARED
/* 1 */
-EXTERN void Tk_MacOSXTurnOffMenus _ANSI_ARGS_((void));
+EXTERN void Tk_MacOSXTurnOffMenus(void);
+#endif
+#ifndef Tk_MacOSXTkOwnsCursor_TCL_DECLARED
+#define Tk_MacOSXTkOwnsCursor_TCL_DECLARED
/* 2 */
-EXTERN void Tk_MacOSXTkOwnsCursor _ANSI_ARGS_((int tkOwnsIt));
+EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt);
+#endif
+#ifndef TkMacOSXInitMenus_TCL_DECLARED
+#define TkMacOSXInitMenus_TCL_DECLARED
/* 3 */
-EXTERN void TkMacOSXInitMenus _ANSI_ARGS_((Tcl_Interp * interp));
+EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp);
+#endif
+#ifndef TkMacOSXInitAppleEvents_TCL_DECLARED
+#define TkMacOSXInitAppleEvents_TCL_DECLARED
/* 4 */
-EXTERN void TkMacOSXInitAppleEvents _ANSI_ARGS_((
- Tcl_Interp * interp));
+EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp);
+#endif
+#ifndef TkGenWMConfigureEvent_TCL_DECLARED
+#define TkGenWMConfigureEvent_TCL_DECLARED
/* 5 */
-EXTERN void TkGenWMConfigureEvent _ANSI_ARGS_((Tk_Window tkwin,
- int x, int y, int width, int height,
- int flags));
+EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
+ int width, int height, int flags);
+#endif
+#ifndef TkMacOSXInvalClipRgns_TCL_DECLARED
+#define TkMacOSXInvalClipRgns_TCL_DECLARED
/* 6 */
-EXTERN void TkMacOSXInvalClipRgns _ANSI_ARGS_((Tk_Window tkwin));
+EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin);
+#endif
+#ifndef TkMacOSXGetDrawablePort_TCL_DECLARED
+#define TkMacOSXGetDrawablePort_TCL_DECLARED
/* 7 */
-EXTERN GWorldPtr TkMacOSXGetDrawablePort _ANSI_ARGS_((
- Drawable drawable));
+EXTERN GWorldPtr TkMacOSXGetDrawablePort(Drawable drawable);
+#endif
+#ifndef TkMacOSXGetRootControl_TCL_DECLARED
+#define TkMacOSXGetRootControl_TCL_DECLARED
/* 8 */
-EXTERN ControlRef TkMacOSXGetRootControl _ANSI_ARGS_((
- Drawable drawable));
+EXTERN ControlRef TkMacOSXGetRootControl(Drawable drawable);
+#endif
+#ifndef Tk_MacOSXSetupTkNotifier_TCL_DECLARED
+#define Tk_MacOSXSetupTkNotifier_TCL_DECLARED
/* 9 */
-EXTERN void Tk_MacOSXSetupTkNotifier _ANSI_ARGS_((void));
+EXTERN void Tk_MacOSXSetupTkNotifier(void);
+#endif
+#ifndef Tk_MacOSXIsAppInFront_TCL_DECLARED
+#define Tk_MacOSXIsAppInFront_TCL_DECLARED
/* 10 */
-EXTERN int Tk_MacOSXIsAppInFront _ANSI_ARGS_((void));
-#endif /* MAC_OSX_TK */
+EXTERN int Tk_MacOSXIsAppInFront(void);
+#endif
+#endif /* AQUA */
typedef struct TkPlatStubs {
int magic;
struct TkPlatStubHooks *hooks;
-#ifdef __WIN32__
- Window (*tk_AttachHWND) _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); /* 0 */
- HINSTANCE (*tk_GetHINSTANCE) _ANSI_ARGS_((void)); /* 1 */
- HWND (*tk_GetHWND) _ANSI_ARGS_((Window window)); /* 2 */
- Tk_Window (*tk_HWNDToWindow) _ANSI_ARGS_((HWND hwnd)); /* 3 */
- void (*tk_PointerEvent) _ANSI_ARGS_((HWND hwnd, int x, int y)); /* 4 */
- int (*tk_TranslateWinEvent) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT * result)); /* 5 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- void (*tk_MacSetEmbedHandler) _ANSI_ARGS_((Tk_MacEmbedRegisterWinProc * registerWinProcPtr, Tk_MacEmbedGetGrafPortProc * getPortProcPtr, Tk_MacEmbedMakeContainerExistProc * containerExistProcPtr, Tk_MacEmbedGetClipProc * getClipProc, Tk_MacEmbedGetOffsetInParentProc * getOffsetProc)); /* 0 */
- void (*tk_MacTurnOffMenus) _ANSI_ARGS_((void)); /* 1 */
- void (*tk_MacTkOwnsCursor) _ANSI_ARGS_((int tkOwnsIt)); /* 2 */
- void (*tkMacInitMenus) _ANSI_ARGS_((Tcl_Interp * interp)); /* 3 */
- void (*tkMacInitAppleEvents) _ANSI_ARGS_((Tcl_Interp * interp)); /* 4 */
- int (*tkMacConvertEvent) _ANSI_ARGS_((EventRecord * eventPtr)); /* 5 */
- int (*tkMacConvertTkEvent) _ANSI_ARGS_((EventRecord * eventPtr, Window window)); /* 6 */
- void (*tkGenWMConfigureEvent) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); /* 7 */
- void (*tkMacInvalClipRgns) _ANSI_ARGS_((TkWindow * winPtr)); /* 8 */
- int (*tkMacHaveAppearance) _ANSI_ARGS_((void)); /* 9 */
- GWorldPtr (*tkMacGetDrawablePort) _ANSI_ARGS_((Drawable drawable)); /* 10 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- void (*tk_MacOSXSetEmbedHandler) _ANSI_ARGS_((Tk_MacOSXEmbedRegisterWinProc * registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc * getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc * containerExistProcPtr, Tk_MacOSXEmbedGetClipProc * getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc * getOffsetProc)); /* 0 */
- void (*tk_MacOSXTurnOffMenus) _ANSI_ARGS_((void)); /* 1 */
- void (*tk_MacOSXTkOwnsCursor) _ANSI_ARGS_((int tkOwnsIt)); /* 2 */
- void (*tkMacOSXInitMenus) _ANSI_ARGS_((Tcl_Interp * interp)); /* 3 */
- void (*tkMacOSXInitAppleEvents) _ANSI_ARGS_((Tcl_Interp * interp)); /* 4 */
- void (*tkGenWMConfigureEvent) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); /* 5 */
- void (*tkMacOSXInvalClipRgns) _ANSI_ARGS_((Tk_Window tkwin)); /* 6 */
- GWorldPtr (*tkMacOSXGetDrawablePort) _ANSI_ARGS_((Drawable drawable)); /* 7 */
- ControlRef (*tkMacOSXGetRootControl) _ANSI_ARGS_((Drawable drawable)); /* 8 */
- void (*tk_MacOSXSetupTkNotifier) _ANSI_ARGS_((void)); /* 9 */
- int (*tk_MacOSXIsAppInFront) _ANSI_ARGS_((void)); /* 10 */
-#endif /* MAC_OSX_TK */
+#ifdef __WIN32__ /* WIN */
+ Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */
+ HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */
+ HWND (*tk_GetHWND) (Window window); /* 2 */
+ Tk_Window (*tk_HWNDToWindow) (HWND hwnd); /* 3 */
+ void (*tk_PointerEvent) (HWND hwnd, int x, int y); /* 4 */
+ int (*tk_TranslateWinEvent) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); /* 5 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ void (*tk_MacOSXSetEmbedHandler) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 0 */
+ void (*tk_MacOSXTurnOffMenus) (void); /* 1 */
+ void (*tk_MacOSXTkOwnsCursor) (int tkOwnsIt); /* 2 */
+ void (*tkMacOSXInitMenus) (Tcl_Interp *interp); /* 3 */
+ void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */
+ void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
+ void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */
+ GWorldPtr (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
+ ControlRef (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
+ void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */
+ int (*tk_MacOSXIsAppInFront) (void); /* 10 */
+#endif /* AQUA */
} TkPlatStubs;
#ifdef __cplusplus
@@ -169,7 +168,7 @@ extern TkPlatStubs *tkPlatStubsPtr;
* Inline function declarations:
*/
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
#ifndef Tk_AttachHWND
#define Tk_AttachHWND \
(tkPlatStubsPtr->tk_AttachHWND) /* 0 */
@@ -194,54 +193,8 @@ extern TkPlatStubs *tkPlatStubsPtr;
#define Tk_TranslateWinEvent \
(tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#endif
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
-#ifndef Tk_MacSetEmbedHandler
-#define Tk_MacSetEmbedHandler \
- (tkPlatStubsPtr->tk_MacSetEmbedHandler) /* 0 */
-#endif
-#ifndef Tk_MacTurnOffMenus
-#define Tk_MacTurnOffMenus \
- (tkPlatStubsPtr->tk_MacTurnOffMenus) /* 1 */
-#endif
-#ifndef Tk_MacTkOwnsCursor
-#define Tk_MacTkOwnsCursor \
- (tkPlatStubsPtr->tk_MacTkOwnsCursor) /* 2 */
-#endif
-#ifndef TkMacInitMenus
-#define TkMacInitMenus \
- (tkPlatStubsPtr->tkMacInitMenus) /* 3 */
-#endif
-#ifndef TkMacInitAppleEvents
-#define TkMacInitAppleEvents \
- (tkPlatStubsPtr->tkMacInitAppleEvents) /* 4 */
-#endif
-#ifndef TkMacConvertEvent
-#define TkMacConvertEvent \
- (tkPlatStubsPtr->tkMacConvertEvent) /* 5 */
-#endif
-#ifndef TkMacConvertTkEvent
-#define TkMacConvertTkEvent \
- (tkPlatStubsPtr->tkMacConvertTkEvent) /* 6 */
-#endif
-#ifndef TkGenWMConfigureEvent
-#define TkGenWMConfigureEvent \
- (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 7 */
-#endif
-#ifndef TkMacInvalClipRgns
-#define TkMacInvalClipRgns \
- (tkPlatStubsPtr->tkMacInvalClipRgns) /* 8 */
-#endif
-#ifndef TkMacHaveAppearance
-#define TkMacHaveAppearance \
- (tkPlatStubsPtr->tkMacHaveAppearance) /* 9 */
-#endif
-#ifndef TkMacGetDrawablePort
-#define TkMacGetDrawablePort \
- (tkPlatStubsPtr->tkMacGetDrawablePort) /* 10 */
-#endif
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef Tk_MacOSXSetEmbedHandler
#define Tk_MacOSXSetEmbedHandler \
(tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */
@@ -286,7 +239,7 @@ extern TkPlatStubs *tkPlatStubsPtr;
#define Tk_MacOSXIsAppInFront \
(tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index 17c7424..4051552 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -1,15 +1,15 @@
-/*
+/*
* tkPointer.c --
*
- * This file contains functions for emulating the X server
- * pointer and grab state machine. This file is used by the
- * Mac and Windows platforms to generate appropriate enter/leave
- * events, and to update the global grab window information.
+ * This file contains functions for emulating the X server pointer and
+ * grab state machine. This file is used by the Mac and Windows platforms
+ * to generate appropriate enter/leave events, and to update the global
+ * grab window information.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
@@ -18,19 +18,14 @@
#include "tkWinInt.h"
#endif
-#if defined(MAC_TCL)
-#include "tkMacInt.h"
-#define Cursor XCursor
-#endif
-
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#define Cursor XCursor
#endif
/*
- * Mask that selects any of the state bits corresponding to buttons,
- * plus masks that select individual buttons' bits:
+ * Mask that selects any of the state bits corresponding to buttons, plus
+ * masks that select individual buttons' bits:
*/
#define ALL_BUTTONS \
@@ -41,15 +36,15 @@ static unsigned int buttonMasks[] = {
#define ButtonMask(b) (buttonMasks[(b)-Button1])
typedef struct ThreadSpecificData {
- TkWindow *grabWinPtr; /* Window that defines the top of the
- * grab tree in a global grab. */
- int lastState; /* Last known state flags. */
- XPoint lastPos; /* Last reported mouse position. */
- TkWindow *lastWinPtr; /* Last reported mouse window. */
- TkWindow *restrictWinPtr; /* Window to which all mouse events
- * will be reported. */
- TkWindow *cursorWinPtr; /* Window that is currently
- * controlling the global cursor. */
+ TkWindow *grabWinPtr; /* Window that defines the top of the grab
+ * tree in a global grab. */
+ int lastState; /* Last known state flags. */
+ XPoint lastPos; /* Last reported mouse position. */
+ TkWindow *lastWinPtr; /* Last reported mouse window. */
+ TkWindow *restrictWinPtr; /* Window to which all mouse events will be
+ * reported. */
+ TkWindow *cursorWinPtr; /* Window that is currently controlling the
+ * global cursor. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -57,12 +52,11 @@ static Tcl_ThreadDataKey dataKey;
* Forward declarations of procedures used in this file.
*/
-static int GenerateEnterLeave _ANSI_ARGS_((TkWindow *winPtr,
- int x, int y, int state));
-static void InitializeEvent _ANSI_ARGS_((XEvent* eventPtr,
- TkWindow *winPtr, int type, int x, int y,
- int state, int detail));
-static void UpdateCursor _ANSI_ARGS_((TkWindow *winPtr));
+static int GenerateEnterLeave(TkWindow *winPtr, int x, int y,
+ int state);
+static void InitializeEvent(XEvent* eventPtr, TkWindow *winPtr,
+ int type, int x, int y, int state, int detail);
+static void UpdateCursor(TkWindow *winPtr);
/*
*----------------------------------------------------------------------
@@ -81,13 +75,13 @@ static void UpdateCursor _ANSI_ARGS_((TkWindow *winPtr));
*/
static void
-InitializeEvent(eventPtr, winPtr, type, x, y, state, detail)
- XEvent* eventPtr; /* Event structure to initialize. */
- TkWindow *winPtr; /* Window to make event relative to. */
- int type; /* Message type. */
- int x, y; /* Root coords of event. */
- int state; /* State flags. */
- int detail; /* Detail value. */
+InitializeEvent(
+ XEvent *eventPtr, /* Event structure to initialize. */
+ TkWindow *winPtr, /* Window to make event relative to. */
+ int type, /* Message type. */
+ int x, int y, /* Root coords of event. */
+ int state, /* State flags. */
+ int detail) /* Detail value. */
{
eventPtr->type = type;
eventPtr->xany.serial = LastKnownRequestProcessed(winPtr->display);
@@ -100,22 +94,22 @@ InitializeEvent(eventPtr, winPtr, type, x, y, state, detail)
eventPtr->xcrossing.y_root = y;
switch (type) {
- case EnterNotify:
- case LeaveNotify:
- eventPtr->xcrossing.mode = NotifyNormal;
- eventPtr->xcrossing.state = state;
- eventPtr->xcrossing.detail = detail;
- eventPtr->xcrossing.focus = False;
- break;
- case MotionNotify:
- eventPtr->xmotion.state = state;
- eventPtr->xmotion.is_hint = detail;
- break;
- case ButtonPress:
- case ButtonRelease:
- eventPtr->xbutton.state = state;
- eventPtr->xbutton.button = detail;
- break;
+ case EnterNotify:
+ case LeaveNotify:
+ eventPtr->xcrossing.mode = NotifyNormal;
+ eventPtr->xcrossing.state = state;
+ eventPtr->xcrossing.detail = detail;
+ eventPtr->xcrossing.focus = False;
+ break;
+ case MotionNotify:
+ eventPtr->xmotion.state = state;
+ eventPtr->xmotion.is_hint = detail;
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ eventPtr->xbutton.state = state;
+ eventPtr->xbutton.button = detail;
+ break;
}
TkChangeEventWindow(eventPtr, winPtr);
}
@@ -125,8 +119,8 @@ InitializeEvent(eventPtr, winPtr, type, x, y, state, detail)
*
* GenerateEnterLeave --
*
- * Update the current mouse window and position, and generate
- * any enter/leave events that are needed.
+ * Update the current mouse window and position, and generate any
+ * enter/leave events that are needed.
*
* Results:
* Returns 1 if enter/leave events were generated.
@@ -138,14 +132,14 @@ InitializeEvent(eventPtr, winPtr, type, x, y, state, detail)
*/
static int
-GenerateEnterLeave(winPtr, x, y, state)
- TkWindow *winPtr; /* Current Tk window (or NULL). */
- int x,y; /* Current mouse position in root coords. */
- int state; /* State flags. */
+GenerateEnterLeave(
+ TkWindow *winPtr, /* Current Tk window (or NULL). */
+ int x, int y, /* Current mouse position in root coords. */
+ int state) /* State flags. */
{
int crossed = 0; /* 1 if mouse crossed a window boundary */
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
TkWindow *restrictWinPtr = tsdPtr->restrictWinPtr;
TkWindow *lastWinPtr = tsdPtr->lastWinPtr;
@@ -157,8 +151,8 @@ GenerateEnterLeave(winPtr, x, y, state)
oldPos = TkPositionInTree(lastWinPtr, restrictWinPtr);
/*
- * Check if the mouse crossed into or out of the restrict
- * window. If so, we need to generate an Enter or Leave event.
+ * Check if the mouse crossed into or out of the restrict window.
+ * If so, we need to generate an Enter or Leave event.
*/
if ((newPos != oldPos) && ((newPos == TK_GRAB_IN_TREE)
@@ -218,8 +212,8 @@ GenerateEnterLeave(winPtr, x, y, state)
*
* Tk_UpdatePointer --
*
- * This function updates the pointer state machine given an
- * the current window, position and modifier state.
+ * This function updates the pointer state machine given an the current
+ * window, position and modifier state.
*
* Results:
* None.
@@ -231,14 +225,14 @@ GenerateEnterLeave(winPtr, x, y, state)
*/
void
-Tk_UpdatePointer(tkwin, x, y, state)
- Tk_Window tkwin; /* Window to which pointer event
- * is reported. May be NULL. */
- int x, y; /* Pointer location in root coords. */
- int state; /* Modifier state mask. */
+Tk_UpdatePointer(
+ Tk_Window tkwin, /* Window to which pointer event is reported.
+ * May be NULL. */
+ int x, int y, /* Pointer location in root coords. */
+ int state) /* Modifier state mask. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
TkWindow *winPtr = (TkWindow *)tkwin;
TkWindow *targetWinPtr;
XPoint pos;
@@ -250,15 +244,15 @@ Tk_UpdatePointer(tkwin, x, y, state)
pos.y = y;
/*
- * Use the current keyboard state, but the old mouse button
- * state since we haven't generated the button events yet.
+ * Use the current keyboard state, but the old mouse button state since we
+ * haven't generated the button events yet.
*/
tsdPtr->lastState = (state & ~ALL_BUTTONS) | (tsdPtr->lastState
& ALL_BUTTONS);
/*
- * Generate Enter/Leave events. If the pointer has crossed window
+ * Generate Enter/Leave events. If the pointer has crossed window
* boundaries, update the current mouse position so we don't generate
* redundant motion events.
*/
@@ -272,20 +266,19 @@ Tk_UpdatePointer(tkwin, x, y, state)
* between the current button state and the last known button state.
*/
- for (b = Button1; b <= Button3; b++) {
+ for (b = Button1; b <= Button5; b++) {
mask = ButtonMask(b);
if (changes & mask) {
- if (state & mask) {
+ if (state & mask) {
type = ButtonPress;
- /*
+ /*
* ButtonPress - Set restrict window if we aren't grabbed, or
* if this is the first button down.
*/
if (!tsdPtr->restrictWinPtr) {
if (!tsdPtr->grabWinPtr) {
-
/*
* Mouse is not grabbed, so set a button grab.
*/
@@ -294,10 +287,9 @@ Tk_UpdatePointer(tkwin, x, y, state)
TkpSetCapture(tsdPtr->restrictWinPtr);
} else if ((tsdPtr->lastState & ALL_BUTTONS) == 0) {
-
/*
- * Mouse is in a non-button grab, so ensure
- * the button grab is inside the grab tree.
+ * Mouse is in a non-button grab, so ensure the button
+ * grab is inside the grab tree.
*/
if (TkPositionInTree(winPtr, tsdPtr->grabWinPtr)
@@ -313,7 +305,7 @@ Tk_UpdatePointer(tkwin, x, y, state)
} else {
type = ButtonRelease;
- /*
+ /*
* ButtonRelease - Release the mouse capture and clear the
* restrict window when the last button is released. If we
* are in a global grab, restore the grab window capture.
@@ -324,9 +316,9 @@ Tk_UpdatePointer(tkwin, x, y, state)
}
/*
- * If we are releasing a restrict window, then we need
- * to send the button event followed by mouse motion from
- * the restrict window to the current mouse position.
+ * If we are releasing a restrict window, then we need to send
+ * the button event followed by mouse motion from the restrict
+ * window to the current mouse position.
*/
if (tsdPtr->restrictWinPtr) {
@@ -340,14 +332,14 @@ Tk_UpdatePointer(tkwin, x, y, state)
GenerateEnterLeave(winPtr, x, y, tsdPtr->lastState);
tsdPtr->lastPos = pos;
continue;
- }
+ }
}
/*
- * If a restrict window is set, make sure the pointer event
- * is reported relative to that window. Otherwise, if a
- * global grab is in effect then events outside of windows
- * managed by Tk should be reported to the grab window.
+ * If a restrict window is set, make sure the pointer event is
+ * reported relative to that window. Otherwise, if a global grab
+ * is in effect then events outside of windows managed by Tk
+ * should be reported to the grab window.
*/
if (tsdPtr->restrictWinPtr) {
@@ -362,7 +354,7 @@ Tk_UpdatePointer(tkwin, x, y, state)
* If we still have a target window, send the event.
*/
- if (winPtr != NULL) {
+ if (targetWinPtr != NULL) {
InitializeEvent(&event, targetWinPtr, type, x, y,
tsdPtr->lastState, b);
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
@@ -373,7 +365,7 @@ Tk_UpdatePointer(tkwin, x, y, state)
*/
tsdPtr->lastState = (type == ButtonPress)
- ? (tsdPtr->lastState | mask) : (tsdPtr->lastState & ~mask);
+ ? (tsdPtr->lastState | mask) : (tsdPtr->lastState & ~mask);
tsdPtr->lastPos = pos;
}
}
@@ -393,8 +385,8 @@ Tk_UpdatePointer(tkwin, x, y, state)
UpdateCursor(targetWinPtr);
/*
- * If no other events caused the position to be updated,
- * generate a motion event.
+ * If no other events caused the position to be updated, generate a motion
+ * event.
*/
if (tsdPtr->lastPos.x != pos.x || tsdPtr->lastPos.y != pos.y) {
@@ -418,42 +410,41 @@ Tk_UpdatePointer(tkwin, x, y, state)
*
* XGrabPointer --
*
- * Capture the mouse so event are reported outside of toplevels.
- * Note that this is a very limited implementation that only
- * supports GrabModeAsync and owner_events True.
+ * Capture the mouse so event are reported outside of toplevels. Note
+ * that this is a very limited implementation that only supports
+ * GrabModeAsync and owner_events True.
*
* Results:
* Always returns GrabSuccess.
*
* Side effects:
- * Turns on mouse capture, sets the global grab pointer, and
- * clears any window restrictions.
+ * Turns on mouse capture, sets the global grab pointer, and clears any
+ * window restrictions.
*
*----------------------------------------------------------------------
*/
int
-XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode,
- keyboard_mode, confine_to, cursor, time)
- Display* display;
- Window grab_window;
- Bool owner_events;
- unsigned int event_mask;
- int pointer_mode;
- int keyboard_mode;
- Window confine_to;
- Cursor cursor;
- Time time;
+XGrabPointer(
+ Display *display,
+ Window grab_window,
+ Bool owner_events,
+ unsigned int event_mask,
+ int pointer_mode,
+ int keyboard_mode,
+ Window confine_to,
+ Cursor cursor,
+ Time time)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
display->request++;
tsdPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(display, grab_window);
tsdPtr->restrictWinPtr = NULL;
TkpSetCapture(tsdPtr->grabWinPtr);
- if (TkPositionInTree(tsdPtr->lastWinPtr, tsdPtr->grabWinPtr)
- != TK_GRAB_IN_TREE) {
+ if (TkPositionInTree(tsdPtr->lastWinPtr, tsdPtr->grabWinPtr)
+ != TK_GRAB_IN_TREE) {
UpdateCursor(tsdPtr->grabWinPtr);
}
return GrabSuccess;
@@ -476,12 +467,12 @@ XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode,
*/
void
-XUngrabPointer(display, time)
- Display* display;
- Time time;
+XUngrabPointer(
+ Display *display,
+ Time time)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
display->request++;
tsdPtr->grabWinPtr = NULL;
@@ -507,11 +498,11 @@ XUngrabPointer(display, time)
*/
void
-TkPointerDeadWindow(winPtr)
- TkWindow *winPtr;
+TkPointerDeadWindow(
+ TkWindow *winPtr)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr == tsdPtr->lastWinPtr) {
tsdPtr->lastWinPtr = NULL;
@@ -532,8 +523,8 @@ TkPointerDeadWindow(winPtr)
*
* UpdateCursor --
*
- * Set the windows global cursor to the cursor associated with
- * the given Tk window.
+ * Set the windows global cursor to the cursor associated with the given
+ * Tk window.
*
* Results:
* None.
@@ -545,17 +536,16 @@ TkPointerDeadWindow(winPtr)
*/
static void
-UpdateCursor(winPtr)
- TkWindow *winPtr;
+UpdateCursor(
+ TkWindow *winPtr)
{
Cursor cursor = None;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * A window inherits its cursor from its parent if it doesn't
- * have one of its own. Top level windows inherit the default
- * cursor.
+ * A window inherits its cursor from its parent if it doesn't have one of
+ * its own. Top level windows inherit the default cursor.
*/
tsdPtr->cursorWinPtr = winPtr;
@@ -576,10 +566,9 @@ UpdateCursor(winPtr)
*
* XDefineCursor --
*
- * This function is called to update the cursor on a window.
- * Since the mouse might be in the specified window, we need to
- * check the specified window against the current mouse position
- * and grab state.
+ * This function is called to update the cursor on a window. Since the
+ * mouse might be in the specified window, we need to check the specified
+ * window against the current mouse position and grab state.
*
* Results:
* None.
@@ -591,14 +580,14 @@ UpdateCursor(winPtr)
*/
void
-XDefineCursor(display, w, cursor)
- Display* display;
- Window w;
- Cursor cursor;
+XDefineCursor(
+ Display *display,
+ Window w,
+ Cursor cursor)
{
TkWindow *winPtr = (TkWindow *)Tk_IdToWindow(display, w);
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->cursorWinPtr == winPtr) {
UpdateCursor(winPtr);
@@ -611,10 +600,10 @@ XDefineCursor(display, w, cursor)
*
* TkGenerateActivateEvents --
*
- * This function is called by the Mac and Windows window manager
- * routines when a toplevel window is activated or deactivated.
- * Activate/Deactivate events will be sent to every subwindow of
- * the toplevel followed by a FocusIn/FocusOut message.
+ * This function is called by the Mac and Windows window manager routines
+ * when a toplevel window is activated or deactivated.
+ * Activate/Deactivate events will be sent to every subwindow of the
+ * toplevel followed by a FocusIn/FocusOut message.
*
* Results:
* None.
@@ -626,16 +615,16 @@ XDefineCursor(display, w, cursor)
*/
void
-TkGenerateActivateEvents(winPtr, active)
- TkWindow *winPtr; /* Toplevel to activate. */
- int active; /* Non-zero if the window is being
- * activated, else 0.*/
+TkGenerateActivateEvents(
+ TkWindow *winPtr, /* Toplevel to activate. */
+ int active) /* Non-zero if the window is being activated,
+ * else 0.*/
{
XEvent event;
-
- /*
- * Generate Activate and Deactivate events. This event
- * is sent to every subwindow in a toplevel window.
+
+ /*
+ * Generate Activate and Deactivate events. This event is sent to every
+ * subwindow in a toplevel window.
*/
event.xany.serial = winPtr->display->request++;
@@ -645,5 +634,12 @@ TkGenerateActivateEvents(winPtr, active)
event.xany.type = active ? ActivateNotify : DeactivateNotify;
TkQueueEventForAllChildren(winPtr, &event);
-
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkPort.h b/generic/tkPort.h
index ca592d1..00c49fd 100644
--- a/generic/tkPort.h
+++ b/generic/tkPort.h
@@ -24,9 +24,7 @@
#if defined(__WIN32__) || defined(_WIN32)
# include "tkWinPort.h"
#else
-# if defined(MAC_TCL)
-# include "tkMacPort.h"
-# elif defined(MAC_OSX_TK)
+# if defined(MAC_OSX_TK)
# include "tkMacOSXPort.h"
# else
# include "tkUnixPort.h"
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c
index b7ab331..c9cd7cb 100644
--- a/generic/tkRectOval.c
+++ b/generic/tkRectOval.c
@@ -1,20 +1,17 @@
-/*
+/*
* tkRectOval.c --
*
- * This file implements rectangle and oval items for canvas
- * widgets.
+ * This file implements rectangle and oval items for canvas widgets.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
-#include "tk.h"
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
/*
@@ -23,18 +20,22 @@
typedef struct RectOvalItem {
Tk_Item header; /* Generic stuff that's the same for all
- * types. MUST BE FIRST IN STRUCTURE. */
+ * types. MUST BE FIRST IN STRUCTURE. */
Tk_Outline outline; /* Outline structure */
double bbox[4]; /* Coordinates of bounding box for rectangle
- * or oval (x1, y1, x2, y2). Item includes
- * x1 and x2 but not y1 and y2. */
+ * or oval (x1, y1, x2, y2). Item includes x1
+ * and x2 but not y1 and y2. */
Tk_TSOffset tsoffset;
XColor *fillColor; /* Color for filling rectangle/oval. */
- XColor *activeFillColor; /* Color for filling rectangle/oval if state is active. */
- XColor *disabledFillColor; /* Color for filling rectangle/oval if state is disabled. */
+ XColor *activeFillColor; /* Color for filling rectangle/oval if state
+ * is active. */
+ XColor *disabledFillColor; /* Color for filling rectangle/oval if state
+ * is disabled. */
Pixmap fillStipple; /* Stipple bitmap for filling item. */
- Pixmap activeFillStipple; /* Stipple bitmap for filling item if state is active. */
- Pixmap disabledFillStipple; /* Stipple bitmap for filling item if state is disabled. */
+ Pixmap activeFillStipple; /* Stipple bitmap for filling item if state is
+ * active. */
+ Pixmap disabledFillStipple; /* Stipple bitmap for filling item if state is
+ * disabled. */
GC fillGC; /* Graphics context for filling item. */
} RectOvalItem;
@@ -64,160 +65,150 @@ static Tk_CustomOption pixelOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_CUSTOM, "-activedash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.activeDash),
+ {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-activefill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, activeFillColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-activeoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.activeColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activeoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.activeStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, activeFillStipple),
+ {TK_CONFIG_COLOR, "-activefill", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, activeFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.activeColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.activeStipple),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-activewidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, activeFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
"0.0", Tk_Offset(RectOvalItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_CUSTOM, "-dash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.dash),
+ {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_PIXELS, "-dashoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
"0", Tk_Offset(RectOvalItem, outline.offset),
TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-disableddash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.disabledDash),
+ {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-disabledfill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, disabledFillColor),
+ {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.disabledColor),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-disabledoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.disabledColor),
+ {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.disabledStipple),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.disabledStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, disabledFillStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_PIXELS, "-disabledwidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_PIXELS, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(RectOvalItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_COLOR, "-fill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, fillColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-offset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-fill", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, fillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
"0,0", Tk_Offset(RectOvalItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_COLOR, "-outline", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-outline", NULL, NULL,
"black", Tk_Offset(RectOvalItem, outline.color), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-outlineoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
"0,0", Tk_Offset(RectOvalItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_BITMAP, "-outlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.stipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state),TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_BITMAP, "-stipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, fillStipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_CUSTOM, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.stipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state),TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_CUSTOM, "-width", NULL, NULL,
"1.0", Tk_Offset(RectOvalItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static void ComputeRectOvalBbox _ANSI_ARGS_((Tk_Canvas canvas,
- RectOvalItem *rectOvalPtr));
-static int ConfigureRectOval _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags));
-static int CreateRectOval _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]));
-static void DeleteRectOval _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display));
-static void DisplayRectOval _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, Display *display, Drawable dst,
- int x, int y, int width, int height));
-static int OvalToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *areaPtr));
-static double OvalToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *pointPtr));
-static int RectOvalCoords _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[]));
-static int RectOvalToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
-static int RectToArea _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *areaPtr));
-static double RectToPoint _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double *pointPtr));
-static void ScaleRectOval _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double originX, double originY,
- double scaleX, double scaleY));
-static void TranslateRectOval _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *itemPtr, double deltaX, double deltaY));
+static void ComputeRectOvalBbox(Tk_Canvas canvas,
+ RectOvalItem *rectOvalPtr);
+static int ConfigureRectOval(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[],
+ int flags);
+static int CreateRectOval(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]);
+static void DeleteRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
+ Display *display);
+static void DisplayRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
+ Display *display, Drawable dst, int x, int y,
+ int width, int height);
+static int OvalToArea(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double *areaPtr);
+static double OvalToPoint(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double *pointPtr);
+static int RectOvalCoords(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]);
+static int RectOvalToPostscript(Tcl_Interp *interp,
+ Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
+static int RectToArea(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double *areaPtr);
+static double RectToPoint(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double *pointPtr);
+static void ScaleRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY,
+ double scaleX, double scaleY);
+static void TranslateRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double deltaX, double deltaY);
/*
- * The structures below defines the rectangle and oval item types
- * by means of procedures that can be invoked by generic item code.
+ * The structures below defines the rectangle and oval item types by means of
+ * functions that can be invoked by generic item code.
*/
Tk_ItemType tkRectangleType = {
- "rectangle", /* name */
- sizeof(RectOvalItem), /* itemSize */
- CreateRectOval, /* createProc */
- configSpecs, /* configSpecs */
- ConfigureRectOval, /* configureProc */
- RectOvalCoords, /* coordProc */
- DeleteRectOval, /* deleteProc */
- DisplayRectOval, /* displayProc */
- TK_CONFIG_OBJS, /* flags */
- RectToPoint, /* pointProc */
- RectToArea, /* areaProc */
- RectOvalToPostscript, /* postscriptProc */
- ScaleRectOval, /* scaleProc */
- TranslateRectOval, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* icursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ "rectangle", /* name */
+ sizeof(RectOvalItem), /* itemSize */
+ CreateRectOval, /* createProc */
+ configSpecs, /* configSpecs */
+ ConfigureRectOval, /* configureProc */
+ RectOvalCoords, /* coordProc */
+ DeleteRectOval, /* deleteProc */
+ DisplayRectOval, /* displayProc */
+ TK_CONFIG_OBJS, /* flags */
+ RectToPoint, /* pointProc */
+ RectToArea, /* areaProc */
+ RectOvalToPostscript, /* postscriptProc */
+ ScaleRectOval, /* scaleProc */
+ TranslateRectOval, /* translateProc */
+ NULL, /* indexProc */
+ NULL, /* icursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
Tk_ItemType tkOvalType = {
- "oval", /* name */
- sizeof(RectOvalItem), /* itemSize */
- CreateRectOval, /* createProc */
- configSpecs, /* configSpecs */
- ConfigureRectOval, /* configureProc */
- RectOvalCoords, /* coordProc */
- DeleteRectOval, /* deleteProc */
- DisplayRectOval, /* displayProc */
- TK_CONFIG_OBJS, /* flags */
- OvalToPoint, /* pointProc */
- OvalToArea, /* areaProc */
- RectOvalToPostscript, /* postscriptProc */
- ScaleRectOval, /* scaleProc */
- TranslateRectOval, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* cursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ "oval", /* name */
+ sizeof(RectOvalItem), /* itemSize */
+ CreateRectOval, /* createProc */
+ configSpecs, /* configSpecs */
+ ConfigureRectOval, /* configureProc */
+ RectOvalCoords, /* coordProc */
+ DeleteRectOval, /* deleteProc */
+ DisplayRectOval, /* displayProc */
+ TK_CONFIG_OBJS, /* flags */
+ OvalToPoint, /* pointProc */
+ OvalToArea, /* areaProc */
+ RectOvalToPostscript, /* postscriptProc */
+ ScaleRectOval, /* scaleProc */
+ TranslateRectOval, /* translateProc */
+ NULL, /* indexProc */
+ NULL, /* cursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
/*
@@ -225,14 +216,14 @@ Tk_ItemType tkOvalType = {
*
* CreateRectOval --
*
- * This procedure is invoked to create a new rectangle
- * or oval item in a canvas.
+ * This function is invoked to create a new rectangle or oval item in a
+ * canvas.
*
* Results:
- * A standard Tcl return value. If an error occurred in
- * creating the item, then an error message is left in
- * the interp's result; in this case itemPtr is left uninitialized,
- * so it can be safely freed by the caller.
+ * A standard Tcl return value. If an error occurred in creating the
+ * item, then an error message is left in the interp's result; in this
+ * case itemPtr is left uninitialized, so it can be safely freed by the
+ * caller.
*
* Side effects:
* A new rectangle or oval item is created.
@@ -241,24 +232,24 @@ Tk_ItemType tkOvalType = {
*/
static int
-CreateRectOval(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* For error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header
- * has been initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */
+CreateRectOval(
+ Tcl_Interp *interp, /* For error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
+ * initialized by caller. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
int i;
if (objc == 0) {
- panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords\n");
}
/*
- * Carry out initialization that is needed in order to clean
- * up after errors during the the remainder of this procedure.
+ * Carry out initialization that is needed in order to clean up after
+ * errors during the the remainder of this function.
*/
Tk_CreateOutline(&(rectOvalPtr->outline));
@@ -279,6 +270,7 @@ CreateRectOval(interp, canvas, itemPtr, objc, objv)
for (i = 1; i < objc; i++) {
char *arg = Tcl_GetString(objv[i]);
+
if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
break;
}
@@ -291,7 +283,7 @@ CreateRectOval(interp, canvas, itemPtr, objc, objv)
return TCL_OK;
}
- error:
+ error:
DeleteRectOval(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
return TCL_ERROR;
}
@@ -301,9 +293,9 @@ CreateRectOval(interp, canvas, itemPtr, objc, objv)
*
* RectOvalCoords --
*
- * This procedure is invoked to process the "coords" widget
- * command on rectangles and ovals. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "coords" widget command on
+ * rectangles and ovals. See the user documentation for details on what
+ * it does.
*
* Results:
* Returns TCL_OK or TCL_ERROR, and sets the interp's result.
@@ -315,60 +307,73 @@ CreateRectOval(interp, canvas, itemPtr, objc, objv)
*/
static int
-RectOvalCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be
- * read or modified. */
- int objc; /* Number of coordinates supplied in
- * objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1,
- * x2, y2, ... */
+RectOvalCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
+ * modified. */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1,y1,x2,y2,... */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
+ /*
+ * If no coordinates, return the current coordinates (i.e. bounding box).
+ */
+
if (objc == 0) {
Tcl_Obj *obj = Tcl_NewObj();
- Tcl_Obj *subobj = Tcl_NewDoubleObj(rectOvalPtr->bbox[0]);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(rectOvalPtr->bbox[1]);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(rectOvalPtr->bbox[2]);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(rectOvalPtr->bbox[3]);
- Tcl_ListObjAppendElement(interp, obj, subobj);
+
+ Tcl_ListObjAppendElement(NULL, obj,
+ Tcl_NewDoubleObj(rectOvalPtr->bbox[0]));
+ Tcl_ListObjAppendElement(NULL, obj,
+ Tcl_NewDoubleObj(rectOvalPtr->bbox[1]));
+ Tcl_ListObjAppendElement(NULL, obj,
+ Tcl_NewDoubleObj(rectOvalPtr->bbox[2]));
+ Tcl_ListObjAppendElement(NULL, obj,
+ Tcl_NewDoubleObj(rectOvalPtr->bbox[3]));
Tcl_SetObjResult(interp, obj);
- } else if ((objc == 1)||(objc == 4)) {
- if (objc==1) {
- if (Tcl_ListObjGetElements(interp, objv[0], &objc,
- (Tcl_Obj ***) &objv) != TCL_OK) {
- return TCL_ERROR;
- } else if (objc != 4) {
- char buf[64 + TCL_INTEGER_SPACE];
+ return TCL_OK;
+ }
- sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", objc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_ERROR;
- }
- }
- if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0],
- &rectOvalPtr->bbox[0]) != TCL_OK)
- || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1],
- &rectOvalPtr->bbox[1]) != TCL_OK)
- || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[2],
- &rectOvalPtr->bbox[2]) != TCL_OK)
- || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3],
- &rectOvalPtr->bbox[3]) != TCL_OK)) {
+ /*
+ * If one "coordinate", treat as list of coordinates.
+ */
+
+ if (objc == 1) {
+ if (Tcl_ListObjGetElements(interp, objv[0], &objc,
+ (Tcl_Obj ***) &objv) != TCL_OK) {
return TCL_ERROR;
}
- ComputeRectOvalBbox(canvas, rectOvalPtr);
- } else {
+ }
+
+ /*
+ * Better have four coordinates now. Spit out an error message otherwise.
+ */
+
+ if (objc != 4) {
char buf[64 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
}
+
+ /*
+ * Parse the coordinates and update our bounding box.
+ */
+
+ if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0],
+ &rectOvalPtr->bbox[0]) != TCL_OK)
+ || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1],
+ &rectOvalPtr->bbox[1]) != TCL_OK)
+ || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[2],
+ &rectOvalPtr->bbox[2]) != TCL_OK)
+ || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3],
+ &rectOvalPtr->bbox[3]) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ ComputeRectOvalBbox(canvas, rectOvalPtr);
return TCL_OK;
}
@@ -377,29 +382,28 @@ RectOvalCoords(interp, canvas, itemPtr, objc, objv)
*
* ConfigureRectOval --
*
- * This procedure is invoked to configure various aspects
- * of a rectangle or oval item, such as its border and
- * background colors.
+ * This function is invoked to configure various aspects of a rectangle
+ * or oval item, such as its border and background colors.
*
* Results:
- * A standard Tcl result code. If an error occurs, then
- * an error message is left in the interp's result.
+ * A standard Tcl result code. If an error occurs, then an error message
+ * is left in the interp's result.
*
* Side effects:
- * Configuration information, such as colors and stipple
- * patterns, may be set for itemPtr.
+ * Configuration information, such as colors and stipple patterns, may be
+ * set for itemPtr.
*
*--------------------------------------------------------------
*/
static int
-ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Rectangle item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureRectOval(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
XGCValues gcValues;
@@ -414,14 +418,14 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) {
+ (CONST char **)objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
state = itemPtr->state;
/*
- * A few of the options require additional processing, such as
- * graphics contexts.
+ * A few of the options require additional processing, such as graphics
+ * contexts.
*/
if (rectOvalPtr->outline.activeWidth > rectOvalPtr->outline.width ||
@@ -440,27 +444,28 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
if (flags & TK_OFFSET_LEFT) {
tsoffset->xoffset = (int) (rectOvalPtr->bbox[0] + 0.5);
} else if (flags & TK_OFFSET_CENTER) {
- tsoffset->xoffset = (int) ((rectOvalPtr->bbox[0]+rectOvalPtr->bbox[2]+1)/2);
+ tsoffset->xoffset = (int)
+ ((rectOvalPtr->bbox[0]+rectOvalPtr->bbox[2]+1)/2);
} else if (flags & TK_OFFSET_RIGHT) {
tsoffset->xoffset = (int) (rectOvalPtr->bbox[2] + 0.5);
}
if (flags & TK_OFFSET_TOP) {
tsoffset->yoffset = (int) (rectOvalPtr->bbox[1] + 0.5);
} else if (flags & TK_OFFSET_MIDDLE) {
- tsoffset->yoffset = (int) ((rectOvalPtr->bbox[1]+rectOvalPtr->bbox[3]+1)/2);
+ tsoffset->yoffset = (int)
+ ((rectOvalPtr->bbox[1]+rectOvalPtr->bbox[3]+1)/2);
} else if (flags & TK_OFFSET_BOTTOM) {
tsoffset->yoffset = (int) (rectOvalPtr->bbox[2] + 0.5);
}
/*
- * Configure the outline graphics context. If mask is non-zero,
- * the gc has changed and must be reallocated, provided that the
- * new settings specify a valid outline (non-zero width and non-NULL
- * color)
+ * Configure the outline graphics context. If mask is non-zero, the gc has
+ * changed and must be reallocated, provided that the new settings specify
+ * a valid outline (non-zero width and non-NULL color)
*/
mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr,
- &(rectOvalPtr->outline));
+ &(rectOvalPtr->outline));
if (mask && \
rectOvalPtr->outline.width != 0 && \
rectOvalPtr->outline.color != NULL) {
@@ -475,10 +480,10 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
}
rectOvalPtr->outline.gc = newGC;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
- if (state==TK_STATE_HIDDEN) {
+ if (state == TK_STATE_HIDDEN) {
ComputeRectOvalBbox(canvas, rectOvalPtr);
return TCL_OK;
}
@@ -492,7 +497,7 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
if (rectOvalPtr->activeFillStipple!=None) {
stipple = rectOvalPtr->activeFillStipple;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (rectOvalPtr->disabledFillColor!=NULL) {
color = rectOvalPtr->disabledFillColor;
}
@@ -533,14 +538,16 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
if (flags & TK_OFFSET_LEFT) {
tsoffset->xoffset = (int) (rectOvalPtr->bbox[0] + 0.5);
} else if (flags & TK_OFFSET_CENTER) {
- tsoffset->xoffset = (int) ((rectOvalPtr->bbox[0]+rectOvalPtr->bbox[2]+1)/2);
+ tsoffset->xoffset = (int)
+ ((rectOvalPtr->bbox[0]+rectOvalPtr->bbox[2]+1)/2);
} else if (flags & TK_OFFSET_RIGHT) {
tsoffset->xoffset = (int) (rectOvalPtr->bbox[2] + 0.5);
}
if (flags & TK_OFFSET_TOP) {
tsoffset->yoffset = (int) (rectOvalPtr->bbox[1] + 0.5);
} else if (flags & TK_OFFSET_MIDDLE) {
- tsoffset->yoffset = (int) ((rectOvalPtr->bbox[1]+rectOvalPtr->bbox[3]+1)/2);
+ tsoffset->yoffset = (int)
+ ((rectOvalPtr->bbox[1]+rectOvalPtr->bbox[3]+1)/2);
} else if (flags & TK_OFFSET_BOTTOM) {
tsoffset->yoffset = (int) (rectOvalPtr->bbox[3] + 0.5);
}
@@ -555,8 +562,8 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
*
* DeleteRectOval --
*
- * This procedure is called to clean up the data structure
- * associated with a rectangle or oval item.
+ * This function is called to clean up the data structure associated with
+ * a rectangle or oval item.
*
* Results:
* None.
@@ -568,11 +575,10 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteRectOval(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for
- * canvas. */
+DeleteRectOval(
+ Tk_Canvas canvas, /* Info about overall widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -605,37 +611,34 @@ DeleteRectOval(canvas, itemPtr, display)
*
* ComputeRectOvalBbox --
*
- * This procedure is invoked to compute the bounding box of
- * all the pixels that may be drawn as part of a rectangle
- * or oval.
+ * This function is invoked to compute the bounding box of all the pixels
+ * that may be drawn as part of a rectangle or oval.
*
* Results:
* None.
*
* Side effects:
- * The fields x1, y1, x2, and y2 are updated in the header
- * for itemPtr.
+ * The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
-ComputeRectOvalBbox(canvas, rectOvalPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- RectOvalItem *rectOvalPtr; /* Item whose bbox is to be
- * recomputed. */
+ComputeRectOvalBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ RectOvalItem *rectOvalPtr) /* Item whose bbox is to be recomputed. */
{
int bloat, tmp;
double dtmp, width;
Tk_State state = rectOvalPtr->header.state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
width = rectOvalPtr->outline.width;
- if (state==TK_STATE_HIDDEN) {
+ if (state == TK_STATE_HIDDEN) {
rectOvalPtr->header.x1 = rectOvalPtr->header.y1 =
rectOvalPtr->header.x2 = rectOvalPtr->header.y2 = -1;
return;
@@ -644,7 +647,7 @@ ComputeRectOvalBbox(canvas, rectOvalPtr)
if (rectOvalPtr->outline.activeWidth>width) {
width = rectOvalPtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (rectOvalPtr->outline.disabledWidth>0) {
width = rectOvalPtr->outline.disabledWidth;
}
@@ -655,24 +658,25 @@ ComputeRectOvalBbox(canvas, rectOvalPtr)
*/
if (rectOvalPtr->bbox[1] > rectOvalPtr->bbox[3]) {
- double tmp;
- tmp = rectOvalPtr->bbox[3];
+ double tmpY = rectOvalPtr->bbox[3];
+
rectOvalPtr->bbox[3] = rectOvalPtr->bbox[1];
- rectOvalPtr->bbox[1] = tmp;
+ rectOvalPtr->bbox[1] = tmpY;
}
if (rectOvalPtr->bbox[0] > rectOvalPtr->bbox[2]) {
- double tmp;
- tmp = rectOvalPtr->bbox[2];
+ double tmpX = rectOvalPtr->bbox[2];
+
rectOvalPtr->bbox[2] = rectOvalPtr->bbox[0];
- rectOvalPtr->bbox[0] = tmp;
+ rectOvalPtr->bbox[0] = tmpX;
}
if (rectOvalPtr->outline.gc == None) {
/*
- * The Win32 switch was added for 8.3 to solve a problem
- * with ovals leaving traces on bottom and right of 1 pixel.
- * This may not be the correct place to solve it, but it works.
+ * The Win32 switch was added for 8.3 to solve a problem with ovals
+ * leaving traces on bottom and right of 1 pixel. This may not be the
+ * correct place to solve it, but it works.
*/
+
#ifdef __WIN32__
bloat = 1;
#else
@@ -680,9 +684,12 @@ ComputeRectOvalBbox(canvas, rectOvalPtr)
#endif
} else {
#ifdef MAC_OSX_TK
- /* Mac OS X CoreGraphics needs correct rounding here
- * otherwise it will draw outside the bounding box.
- * Probably correct on other platforms as well? */
+ /*
+ * Mac OS X CoreGraphics needs correct rounding here otherwise it will
+ * draw outside the bounding box. Probably correct on other platforms
+ * as well?
+ */
+
bloat = (int) (width+1.5)/2;
#else
bloat = (int) (width+1)/2;
@@ -690,9 +697,9 @@ ComputeRectOvalBbox(canvas, rectOvalPtr)
}
/*
- * Special note: the rectangle is always drawn at least 1x1 in
- * size, so round up the upper coordinates to be at least 1 unit
- * greater than the lower ones.
+ * Special note: the rectangle is always drawn at least 1x1 in size, so
+ * round up the upper coordinates to be at least 1 unit greater than the
+ * lower ones.
*/
tmp = (int) ((rectOvalPtr->bbox[0] >= 0) ? rectOvalPtr->bbox[0] + .5
@@ -720,28 +727,28 @@ ComputeRectOvalBbox(canvas, rectOvalPtr)
*
* DisplayRectOval --
*
- * This procedure is invoked to draw a rectangle or oval
- * item in a given drawable.
+ * This function is invoked to draw a rectangle or oval item in a given
+ * drawable.
*
* Results:
* None.
*
* Side effects:
- * ItemPtr is drawn in drawable using the transformation
- * information in canvas.
+ * ItemPtr is drawn in drawable using the transformation information in
+ * canvas.
*
*--------------------------------------------------------------
*/
static void
-DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw
- * item. */
- int x, y, width, height; /* Describes region of canvas that
- * must be redisplayed (not used). */
+DisplayRectOval(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, int width, int height)
+ /* Describes region of canvas that must be
+ * redisplayed (not used). */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
short x1, y1, x2, y2;
@@ -749,9 +756,9 @@ DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
Tk_State state = itemPtr->state;
/*
- * Compute the screen coordinates of the bounding box for the item.
- * Make sure that the bbox is at least one pixel large, since some
- * X servers will die if it isn't.
+ * Compute the screen coordinates of the bounding box for the item. Make
+ * sure that the bbox is at least one pixel large, since some X servers
+ * will die if it isn't.
*/
Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[0], rectOvalPtr->bbox[1],
@@ -766,22 +773,21 @@ DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
}
/*
- * Display filled part first (if wanted), then outline. If we're
- * stippling, then modify the stipple offset in the GC. Be sure to
- * reset the offset when done, since the GC is supposed to be
- * read-only.
+ * Display filled part first (if wanted), then outline. If we're
+ * stippling, then modify the stipple offset in the GC. Be sure to reset
+ * the offset when done, since the GC is supposed to be read-only.
*/
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
fillStipple = rectOvalPtr->fillStipple;
if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)rectOvalPtr) {
- if (rectOvalPtr->activeFillStipple!=None) {
+ if (rectOvalPtr->activeFillStipple != None) {
fillStipple = rectOvalPtr->activeFillStipple;
}
- } else if (state==TK_STATE_DISABLED) {
- if (rectOvalPtr->disabledFillStipple!=None) {
+ } else if (state == TK_STATE_DISABLED) {
+ if (rectOvalPtr->disabledFillStipple != None) {
fillStipple = rectOvalPtr->disabledFillStipple;
}
}
@@ -789,10 +795,12 @@ DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
if (rectOvalPtr->fillGC != None) {
if (fillStipple != None) {
Tk_TSOffset *tsoffset;
- int w=0; int h=0;
+ int w = 0, h = 0;
+
tsoffset = &rectOvalPtr->tsoffset;
if (tsoffset) {
int flags = tsoffset->flags;
+
if (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE)) {
Tk_SizeOfBitmap(display, fillStipple, &w, &h);
if (flags & TK_OFFSET_CENTER) {
@@ -827,6 +835,7 @@ DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
XSetTSOrigin(display, rectOvalPtr->fillGC, 0, 0);
}
}
+
if (rectOvalPtr->outline.gc != None) {
Tk_ChangeOutlineGC(canvas, itemPtr, &(rectOvalPtr->outline));
if (rectOvalPtr->header.typePtr == &tkRectangleType) {
@@ -845,17 +854,16 @@ DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
*
* RectToPoint --
*
- * Computes the distance from a given point to a given
- * rectangle, in canvas units.
+ * Computes the distance from a given point to a given rectangle, in
+ * canvas units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are coordPtr[0] and coordPtr[1] is inside the rectangle. If the
- * point isn't inside the rectangle then the return value is the
- * distance from the point to the rectangle. If itemPtr is filled,
- * then anywhere in the interior is considered "inside"; if
- * itemPtr isn't filled, then "inside" means only the area
- * occupied by the outline.
+ * The return value is 0 if the point whose x and y coordinates are
+ * coordPtr[0] and coordPtr[1] is inside the rectangle. If the point
+ * isn't inside the rectangle then the return value is the distance from
+ * the point to the rectangle. If itemPtr is filled, then anywhere in the
+ * interior is considered "inside"; if itemPtr isn't filled, then
+ * "inside" means only the area occupied by the outline.
*
* Side effects:
* None.
@@ -865,17 +873,17 @@ DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
/* ARGSUSED */
static double
-RectToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+RectToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
RectOvalItem *rectPtr = (RectOvalItem *) itemPtr;
double xDiff, yDiff, x1, y1, x2, y2, inc, tmp;
double width;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -884,15 +892,15 @@ RectToPoint(canvas, itemPtr, pointPtr)
if (rectPtr->outline.activeWidth>width) {
width = rectPtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (rectPtr->outline.disabledWidth>0) {
width = rectPtr->outline.disabledWidth;
}
}
/*
- * Generate a new larger rectangle that includes the border
- * width, if there is one.
+ * Generate a new larger rectangle that includes the border width, if
+ * there is one.
*/
x1 = rectPtr->bbox[0];
@@ -908,14 +916,13 @@ RectToPoint(canvas, itemPtr, pointPtr)
}
/*
- * If the point is inside the rectangle, handle specially:
- * distance is 0 if rectangle is filled, otherwise compute
- * distance to nearest edge of rectangle and subtract width
- * of edge.
+ * If the point is inside the rectangle, handle specially: distance is 0
+ * if rectangle is filled, otherwise compute distance to nearest edge of
+ * rectangle and subtract width of edge.
*/
if ((pointPtr[0] >= x1) && (pointPtr[0] < x2)
- && (pointPtr[1] >= y1) && (pointPtr[1] < y2)) {
+ && (pointPtr[1] >= y1) && (pointPtr[1] < y2)) {
if ((rectPtr->fillGC != None) || (rectPtr->outline.gc == None)) {
return 0.0;
}
@@ -967,17 +974,16 @@ RectToPoint(canvas, itemPtr, pointPtr)
*
* OvalToPoint --
*
- * Computes the distance from a given point to a given
- * oval, in canvas units.
+ * Computes the distance from a given point to a given oval, in canvas
+ * units.
*
* Results:
- * The return value is 0 if the point whose x and y coordinates
- * are coordPtr[0] and coordPtr[1] is inside the oval. If the
- * point isn't inside the oval then the return value is the
- * distance from the point to the oval. If itemPtr is filled,
- * then anywhere in the interior is considered "inside"; if
- * itemPtr isn't filled, then "inside" means only the area
- * occupied by the outline.
+ * The return value is 0 if the point whose x and y coordinates are
+ * coordPtr[0] and coordPtr[1] is inside the oval. If the point isn't
+ * inside the oval then the return value is the distance from the point
+ * to the oval. If itemPtr is filled, then anywhere in the interior is
+ * considered "inside"; if itemPtr isn't filled, then "inside" means only
+ * the area occupied by the outline.
*
* Side effects:
* None.
@@ -987,17 +993,17 @@ RectToPoint(canvas, itemPtr, pointPtr)
/* ARGSUSED */
static double
-OvalToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+OvalToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
RectOvalItem *ovalPtr = (RectOvalItem *) itemPtr;
double width;
int filled;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -1006,7 +1012,7 @@ OvalToPoint(canvas, itemPtr, pointPtr)
if (ovalPtr->outline.activeWidth>width) {
width = (double) ovalPtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (ovalPtr->outline.disabledWidth>0) {
width = (double) ovalPtr->outline.disabledWidth;
}
@@ -1026,14 +1032,13 @@ OvalToPoint(canvas, itemPtr, pointPtr)
*
* RectToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangle.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangle.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -1043,19 +1048,18 @@ OvalToPoint(canvas, itemPtr, pointPtr)
/* ARGSUSED */
static int
-RectToArea(canvas, itemPtr, areaPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against rectangle. */
- double *areaPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
- * area. */
+RectToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against rectangle. */
+ double *areaPtr) /* Pointer to array of four coordinates (x1,
+ * y1, x2, y2) describing rectangular area. */
{
RectOvalItem *rectPtr = (RectOvalItem *) itemPtr;
double halfWidth;
double width;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -1064,7 +1068,7 @@ RectToArea(canvas, itemPtr, areaPtr)
if (rectPtr->outline.activeWidth>width) {
width = rectPtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (rectPtr->outline.disabledWidth>0) {
width = rectPtr->outline.disabledWidth;
}
@@ -1102,14 +1106,13 @@ RectToArea(canvas, itemPtr, areaPtr)
*
* OvalToArea --
*
- * This procedure is called to determine whether an item
- * lies entirely inside, entirely outside, or overlapping
- * a given rectangular area.
+ * This function is called to determine whether an item lies entirely
+ * inside, entirely outside, or overlapping a given rectangular area.
*
* Results:
- * -1 is returned if the item is entirely outside the area
- * given by rectPtr, 0 if it overlaps, and 1 if it is entirely
- * inside the given area.
+ * -1 is returned if the item is entirely outside the area given by
+ * rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
+ * area.
*
* Side effects:
* None.
@@ -1119,12 +1122,11 @@ RectToArea(canvas, itemPtr, areaPtr)
/* ARGSUSED */
static int
-OvalToArea(canvas, itemPtr, areaPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against oval. */
- double *areaPtr; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) describing rectangular
- * area. */
+OvalToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against oval. */
+ double *areaPtr) /* Pointer to array of four coordinates (x1,
+ * y1, x2, y2) describing rectangular area. */
{
RectOvalItem *ovalPtr = (RectOvalItem *) itemPtr;
double oval[4], halfWidth;
@@ -1132,7 +1134,7 @@ OvalToArea(canvas, itemPtr, areaPtr)
double width;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -1141,7 +1143,7 @@ OvalToArea(canvas, itemPtr, areaPtr)
if (ovalPtr->outline.activeWidth>width) {
width = ovalPtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (ovalPtr->outline.disabledWidth>0) {
width = ovalPtr->outline.disabledWidth;
}
@@ -1163,10 +1165,10 @@ OvalToArea(canvas, itemPtr, areaPtr)
result = TkOvalToArea(oval, areaPtr);
/*
- * If the rectangle appears to overlap the oval and the oval
- * isn't filled, do one more check to see if perhaps all four
- * of the rectangle's corners are totally inside the oval's
- * unfilled center, in which case we should return "outside".
+ * If the rectangle appears to overlap the oval and the oval isn't filled,
+ * do one more check to see if perhaps all four of the rectangle's corners
+ * are totally inside the oval's unfilled center, in which case we should
+ * return "outside".
*/
if ((result == 0) && (ovalPtr->outline.gc != None)
@@ -1201,16 +1203,14 @@ OvalToArea(canvas, itemPtr, areaPtr)
*
* ScaleRectOval --
*
- * This procedure is invoked to rescale a rectangle or oval
- * item.
+ * This function is invoked to rescale a rectangle or oval item.
*
* Results:
* None.
*
* Side effects:
- * The rectangle or oval referred to by itemPtr is rescaled
- * so that the following transformation is applied to all
- * point coordinates:
+ * The rectangle or oval referred to by itemPtr is rescaled so that the
+ * following transformation is applied to all point coordinates:
* x' = originX + scaleX*(x-originX)
* y' = originY + scaleY*(y-originY)
*
@@ -1218,12 +1218,13 @@ OvalToArea(canvas, itemPtr, areaPtr)
*/
static void
-ScaleRectOval(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing rectangle. */
- Tk_Item *itemPtr; /* Rectangle to be scaled. */
- double originX, originY; /* Origin about which to scale rect. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleRectOval(
+ Tk_Canvas canvas, /* Canvas containing rectangle. */
+ Tk_Item *itemPtr, /* Rectangle to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale rect. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -1239,26 +1240,25 @@ ScaleRectOval(canvas, itemPtr, originX, originY, scaleX, scaleY)
*
* TranslateRectOval --
*
- * This procedure is called to move a rectangle or oval by a
- * given amount.
+ * This function is called to move a rectangle or oval by a given amount.
*
* Results:
* None.
*
* Side effects:
- * The position of the rectangle or oval is offset by
- * (xDelta, yDelta), and the bounding box is updated in the
- * generic part of the item structure.
+ * The position of the rectangle or oval is offset by (xDelta, yDelta),
+ * and the bounding box is updated in the generic part of the item
+ * structure.
*
*--------------------------------------------------------------
*/
static void
-TranslateRectOval(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be
- * moved. */
+TranslateRectOval(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -1274,15 +1274,14 @@ TranslateRectOval(canvas, itemPtr, deltaX, deltaY)
*
* RectOvalToPostscript --
*
- * This procedure is called to generate Postscript for
- * rectangle and oval items.
+ * This function is called to generate Postscript for rectangle and oval
+ * items.
*
* Results:
- * The return value is a standard Tcl result. If an error
- * occurs in generating Postscript then an error message is
- * left in the interp's result, replacing whatever used to be there.
- * If no error occurs, then Postscript for the rectangle is
- * appended to the result.
+ * The return value is a standard Tcl result. If an error occurs in
+ * generating Postscript then an error message is left in the interp's
+ * result, replacing whatever used to be there. If no error occurs, then
+ * Postscript for the rectangle is appended to the result.
*
* Side effects:
* None.
@@ -1291,14 +1290,13 @@ TranslateRectOval(canvas, itemPtr, deltaX, deltaY)
*/
static int
-RectOvalToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is
- * wanted. */
- int prepass; /* 1 means this is a prepass to
- * collect font information; 0 means
- * final Postscript is being created. */
+RectOvalToPostscript(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
+ * information; 0 means final Postscript is
+ * being created. */
{
char pathCmd[500];
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -1312,12 +1310,10 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
y2 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[3]);
/*
- * Generate a string that creates a path for the rectangle or oval.
- * This is the only part of the procedure's code that is type-
- * specific.
+ * Generate a string that creates a path for the rectangle or oval. This
+ * is the only part of the function's code that is type-specific.
*/
-
if (rectOvalPtr->header.typePtr == &tkRectangleType) {
sprintf(pathCmd, "%.15g %.15g moveto %.15g 0 rlineto 0 %.15g rlineto %.15g 0 rlineto closepath\n",
rectOvalPtr->bbox[0], y1,
@@ -1329,7 +1325,7 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
(rectOvalPtr->bbox[2] - rectOvalPtr->bbox[0])/2, (y1 - y2)/2);
}
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
color = rectOvalPtr->outline.color;
@@ -1345,7 +1341,7 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
if (rectOvalPtr->activeFillStipple!=None) {
fillStipple = rectOvalPtr->activeFillStipple;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (rectOvalPtr->outline.disabledColor!=NULL) {
color = rectOvalPtr->outline.disabledColor;
}
@@ -1362,22 +1358,20 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
*/
if (fillColor != NULL) {
- Tcl_AppendResult(interp, pathCmd, (char *) NULL);
- if (Tk_CanvasPsColor(interp, canvas, fillColor)
- != TCL_OK) {
+ Tcl_AppendResult(interp, pathCmd, NULL);
+ if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) {
return TCL_ERROR;
}
if (fillStipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
- if (Tk_CanvasPsStipple(interp, canvas, fillStipple)
- != TCL_OK) {
+ Tcl_AppendResult(interp, "clip ", NULL);
+ if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) {
return TCL_ERROR;
}
if (color != NULL) {
- Tcl_AppendResult(interp, "grestore gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
}
@@ -1387,7 +1381,7 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
if (color != NULL) {
Tcl_AppendResult(interp, pathCmd, "0 setlinejoin 2 setlinecap\n",
- (char *) NULL);
+ NULL);
if (Tk_CanvasPsOutline(canvas, itemPtr,
&(rectOvalPtr->outline))!= TCL_OK) {
return TCL_ERROR;
@@ -1395,3 +1389,11 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
}
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 676f84b..103f39c 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -1,49 +1,45 @@
-/*
+/*
* tkScale.c --
*
- * This module implements a scale widgets for the Tk toolkit.
- * A scale displays a slider that can be adjusted to change a
- * value; it also displays numeric labels and a textual label,
- * if desired.
- *
- * The modifications to use floating-point values are based on
- * an implementation by Paul Mackerras. The -variable option
- * is due to Henning Schulzrinne. All of these are used with
- * permission.
+ * This module implements a scale widgets for the Tk toolkit. A scale
+ * displays a slider that can be adjusted to change a value; it also
+ * displays numeric labels and a textual label, if desired.
+ *
+ * The modifications to use floating-point values are based on an
+ * implementation by Paul Mackerras. The -variable option is due to
+ * Henning Schulzrinne. All of these are used with permission.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "default.h"
#include "tkInt.h"
-#include "tclMath.h"
#include "tkScale.h"
/*
- * The following table defines the legal values for the -orient option.
- * It is used together with the "enum orient" declaration in tkScale.h.
+ * The following table defines the legal values for the -orient option. It is
+ * used together with the "enum orient" declaration in tkScale.h.
*/
static char *orientStrings[] = {
- "horizontal", "vertical", (char *) NULL
+ "horizontal", "vertical", NULL
};
/*
- * The following table defines the legal values for the -state option.
- * It is used together with the "enum state" declaration in tkScale.h.
+ * The following table defines the legal values for the -state option. It is
+ * used together with the "enum state" declaration in tkScale.h.
*/
static char *stateStrings[] = {
- "active", "disabled", "normal", (char *) NULL
+ "active", "disabled", "normal", NULL
};
-static Tk_OptionSpec optionSpecs[] = {
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
DEF_SCALE_ACTIVE_BG_COLOR, -1, Tk_Offset(TkScale, activeBorder),
0, (ClientData) DEF_SCALE_ACTIVE_BG_MONO, 0},
@@ -51,42 +47,42 @@ static Tk_OptionSpec optionSpecs[] = {
DEF_SCALE_BG_COLOR, -1, Tk_Offset(TkScale, bgBorder),
0, (ClientData) DEF_SCALE_BG_MONO, 0},
{TK_OPTION_DOUBLE, "-bigincrement", "bigIncrement", "BigIncrement",
- DEF_SCALE_BIG_INCREMENT, -1, Tk_Offset(TkScale, bigIncrement),
- 0, 0, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ DEF_SCALE_BIG_INCREMENT, -1, Tk_Offset(TkScale, bigIncrement),
+ 0, 0, 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_SCALE_BORDER_WIDTH, -1, Tk_Offset(TkScale, borderWidth),
- 0, 0, 0},
+ DEF_SCALE_BORDER_WIDTH, -1, Tk_Offset(TkScale, borderWidth),
+ 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_SCALE_COMMAND, -1, Tk_Offset(TkScale, command),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_SCALE_CURSOR, -1, Tk_Offset(TkScale, cursor),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_INT, "-digits", "digits", "Digits",
- DEF_SCALE_DIGITS, -1, Tk_Offset(TkScale, digits),
- 0, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_INT, "-digits", "digits", "Digits",
+ DEF_SCALE_DIGITS, -1, Tk_Offset(TkScale, digits),
+ 0, 0, 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_SCALE_FONT, -1, Tk_Offset(TkScale, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_SCALE_FG_COLOR, -1, Tk_Offset(TkScale, textColorPtr), 0,
- (ClientData) DEF_SCALE_FG_MONO, 0},
- {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, -1,
- Tk_Offset(TkScale, fromValue), 0, 0, 0},
+ DEF_SCALE_FG_COLOR, -1, Tk_Offset(TkScale, textColorPtr), 0,
+ (ClientData) DEF_SCALE_FG_MONO, 0},
+ {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, -1,
+ Tk_Offset(TkScale, fromValue), 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_SCALE_HIGHLIGHT_BG_COLOR,
- -1, Tk_Offset(TkScale, highlightBorder),
- 0, (ClientData) DEF_SCALE_HIGHLIGHT_BG_MONO, 0},
+ -1, Tk_Offset(TkScale, highlightBorder),
+ 0, (ClientData) DEF_SCALE_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
DEF_SCALE_HIGHLIGHT, -1, Tk_Offset(TkScale, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, -1,
+ "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, -1,
Tk_Offset(TkScale, highlightWidth), 0, 0, 0},
{TK_OPTION_STRING, "-label", "label", "Label",
DEF_SCALE_LABEL, -1, Tk_Offset(TkScale, label),
@@ -94,59 +90,58 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_PIXELS, "-length", "length", "Length",
DEF_SCALE_LENGTH, -1, Tk_Offset(TkScale, length), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
- DEF_SCALE_ORIENT, -1, Tk_Offset(TkScale, orient),
- 0, (ClientData) orientStrings, 0},
+ DEF_SCALE_ORIENT, -1, Tk_Offset(TkScale, orient),
+ 0, (ClientData) orientStrings, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_SCALE_RELIEF, -1, Tk_Offset(TkScale, relief), 0, 0, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
- DEF_SCALE_REPEAT_DELAY, -1, Tk_Offset(TkScale, repeatDelay),
- 0, 0, 0},
+ DEF_SCALE_REPEAT_DELAY, -1, Tk_Offset(TkScale, repeatDelay),
+ 0, 0, 0},
{TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval",
- DEF_SCALE_REPEAT_INTERVAL, -1, Tk_Offset(TkScale, repeatInterval),
- 0, 0, 0},
+ DEF_SCALE_REPEAT_INTERVAL, -1, Tk_Offset(TkScale, repeatInterval),
+ 0, 0, 0},
{TK_OPTION_DOUBLE, "-resolution", "resolution", "Resolution",
- DEF_SCALE_RESOLUTION, -1, Tk_Offset(TkScale, resolution),
- 0, 0, 0},
+ DEF_SCALE_RESOLUTION, -1, Tk_Offset(TkScale, resolution),
+ 0, 0, 0},
{TK_OPTION_BOOLEAN, "-showvalue", "showValue", "ShowValue",
- DEF_SCALE_SHOW_VALUE, -1, Tk_Offset(TkScale, showValue),
- 0, 0, 0},
+ DEF_SCALE_SHOW_VALUE, -1, Tk_Offset(TkScale, showValue),
+ 0, 0, 0},
{TK_OPTION_PIXELS, "-sliderlength", "sliderLength", "SliderLength",
- DEF_SCALE_SLIDER_LENGTH, -1, Tk_Offset(TkScale, sliderLength),
- 0, 0, 0},
+ DEF_SCALE_SLIDER_LENGTH, -1, Tk_Offset(TkScale, sliderLength),
+ 0, 0, 0},
{TK_OPTION_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief",
- DEF_SCALE_SLIDER_RELIEF, -1, Tk_Offset(TkScale, sliderRelief),
- 0, 0, 0},
+ DEF_SCALE_SLIDER_RELIEF, -1, Tk_Offset(TkScale, sliderRelief),
+ 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
- DEF_SCALE_STATE, -1, Tk_Offset(TkScale, state),
- 0, (ClientData) stateStrings, 0},
+ DEF_SCALE_STATE, -1, Tk_Offset(TkScale, state),
+ 0, (ClientData) stateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_SCALE_TAKE_FOCUS, Tk_Offset(TkScale, takeFocusPtr), -1,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-tickinterval", "tickInterval", "TickInterval",
- DEF_SCALE_TICK_INTERVAL, -1, Tk_Offset(TkScale, tickInterval),
- 0, 0, 0},
+ DEF_SCALE_TICK_INTERVAL, -1, Tk_Offset(TkScale, tickInterval),
+ 0, 0, 0},
{TK_OPTION_DOUBLE, "-to", "to", "To",
- DEF_SCALE_TO, -1, Tk_Offset(TkScale, toValue), 0, 0, 0},
+ DEF_SCALE_TO, -1, Tk_Offset(TkScale, toValue), 0, 0, 0},
{TK_OPTION_COLOR, "-troughcolor", "troughColor", "Background",
- DEF_SCALE_TROUGH_COLOR, -1, Tk_Offset(TkScale, troughColorPtr),
- 0, (ClientData) DEF_SCALE_TROUGH_MONO, 0},
+ DEF_SCALE_TROUGH_COLOR, -1, Tk_Offset(TkScale, troughColorPtr),
+ 0, (ClientData) DEF_SCALE_TROUGH_MONO, 0},
{TK_OPTION_STRING, "-variable", "variable", "Variable",
DEF_SCALE_VARIABLE, Tk_Offset(TkScale, varNamePtr), -1,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
DEF_SCALE_WIDTH, -1, Tk_Offset(TkScale, width), 0, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
- * The following tables define the scale widget commands and map the
- * indexes into the string tables into a single enumerated type used
- * to dispatch the scale widget command.
+ * The following tables define the scale widget commands and map the indexes
+ * into the string tables into a single enumerated type used to dispatch the
+ * scale widget command.
*/
static CONST char *commandNames[] = {
- "cget", "configure", "coords", "get", "identify", "set", (char *) NULL
+ "cget", "configure", "coords", "get", "identify", "set", NULL
};
enum command {
@@ -158,25 +153,22 @@ enum command {
* Forward declarations for procedures defined later in this file:
*/
-static void ComputeFormat _ANSI_ARGS_((TkScale *scalePtr));
-static void ComputeScaleGeometry _ANSI_ARGS_((TkScale *scalePtr));
-static int ConfigureScale _ANSI_ARGS_((Tcl_Interp *interp,
- TkScale *scalePtr, int objc,
- Tcl_Obj *CONST objv[]));
-static void DestroyScale _ANSI_ARGS_((char *memPtr));
-static void ScaleCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void ScaleEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static char * ScaleVarProc _ANSI_ARGS_((ClientData clientData,
+static void ComputeFormat(TkScale *scalePtr);
+static void ComputeScaleGeometry(TkScale *scalePtr);
+static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr,
+ int objc, Tcl_Obj *CONST objv[]);
+static void DestroyScale(char *memPtr);
+static void ScaleCmdDeletedProc(ClientData clientData);
+static void ScaleEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static char * ScaleVarProc(ClientData clientData,
Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags));
-static int ScaleWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void ScaleWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static void ScaleSetVariable _ANSI_ARGS_((TkScale *scalePtr));
+ CONST char *name2, int flags);
+static int ScaleWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void ScaleWorldChanged(ClientData instanceData);
+static void ScaleSetVariable(TkScale *scalePtr);
/*
* The structure below defines scale class behavior by means of procedures
@@ -187,16 +179,14 @@ static Tk_ClassProcs scaleClass = {
sizeof(Tk_ClassProcs), /* size */
ScaleWorldChanged, /* worldChangedProc */
};
-
/*
*--------------------------------------------------------------
*
* Tk_ScaleObjCmd --
*
- * This procedure is invoked to process the "scale" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This procedure is invoked to process the "scale" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -208,11 +198,11 @@ static Tk_ClassProcs scaleClass = {
*/
int
-Tk_ScaleObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+Tk_ScaleObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument values. */
{
register TkScale *scalePtr;
Tk_OptionTable optionTable;
@@ -224,14 +214,14 @@ Tk_ScaleObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
/*
- * Create the option table for this widget class. If it has already
- * been created, the cached pointer will be returned.
+ * Create the option table for this widget class. If it has already been
+ * created, the cached pointer will be returned.
*/
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
@@ -240,9 +230,9 @@ Tk_ScaleObjCmd(clientData, interp, objc, objv)
scalePtr = TkpCreateScale(tkwin);
/*
- * Initialize fields that won't be initialized by ConfigureScale,
- * or which ConfigureScale expects to have reasonable values
- * (e.g. resource pointers).
+ * Initialize fields that won't be initialized by ConfigureScale, or which
+ * ConfigureScale expects to have reasonable values (e.g. resource
+ * pointers).
*/
scalePtr->tkwin = tkwin;
@@ -320,9 +310,9 @@ Tk_ScaleObjCmd(clientData, interp, objc, objv)
*
* ScaleWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -334,157 +324,151 @@ Tk_ScaleObjCmd(clientData, interp, objc, objv)
*/
static int
-ScaleWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about scale
- * widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings. */
+ScaleWidgetObjCmd(
+ ClientData clientData, /* Information about scale widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument strings. */
{
TkScale *scalePtr = (TkScale *) clientData;
Tcl_Obj *objPtr;
int index, result;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
result = Tcl_GetIndexFromObj(interp, objv[1], commandNames,
- "option", 0, &index);
+ "option", 0, &index);
if (result != TCL_OK) {
return result;
}
Tcl_Preserve((ClientData) scalePtr);
switch (index) {
- case COMMAND_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "cget option");
- goto error;
- }
- objPtr = Tk_GetOptionValue(interp, (char *) scalePtr,
- scalePtr->optionTable, objv[2], scalePtr->tkwin);
+ case COMMAND_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "cget option");
+ goto error;
+ }
+ objPtr = Tk_GetOptionValue(interp, (char *) scalePtr,
+ scalePtr->optionTable, objv[2], scalePtr->tkwin);
+ if (objPtr == NULL) {
+ goto error;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ }
+ break;
+ case COMMAND_CONFIGURE:
+ if (objc <= 3) {
+ objPtr = Tk_GetOptionInfo(interp, (char *) scalePtr,
+ scalePtr->optionTable,
+ (objc == 3) ? objv[2] : NULL, scalePtr->tkwin);
if (objPtr == NULL) {
- goto error;
+ goto error;
} else {
Tcl_SetObjResult(interp, objPtr);
}
- break;
+ } else {
+ result = ConfigureScale(interp, scalePtr, objc-2, objv+2);
}
- case COMMAND_CONFIGURE: {
- if (objc <= 3) {
- objPtr = Tk_GetOptionInfo(interp, (char *) scalePtr,
- scalePtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
- scalePtr->tkwin);
- if (objPtr == NULL) {
- goto error;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- }
- } else {
- result = ConfigureScale(interp, scalePtr, objc-2, objv+2);
- }
- break;
+ break;
+ case COMMAND_COORDS: {
+ int x, y ;
+ double value;
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ if ((objc != 2) && (objc != 3)) {
+ Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?");
+ goto error;
}
- case COMMAND_COORDS: {
- int x, y ;
- double value;
- char buf[TCL_INTEGER_SPACE * 2];
-
- if ((objc != 2) && (objc != 3)) {
- Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?");
- goto error;
- }
- if (objc == 3) {
- if (Tcl_GetDoubleFromObj(interp, objv[2], &value)
- != TCL_OK) {
- goto error;
- }
- } else {
- value = scalePtr->value;
- }
- if (scalePtr->orient == ORIENT_VERTICAL) {
- x = scalePtr->vertTroughX + scalePtr->width/2
- + scalePtr->borderWidth;
- y = TkScaleValueToPixel(scalePtr, value);
- } else {
- x = TkScaleValueToPixel(scalePtr, value);
- y = scalePtr->horizTroughY + scalePtr->width/2
- + scalePtr->borderWidth;
- }
- sprintf(buf, "%d %d", x, y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- break;
- }
- case COMMAND_GET: {
- double value;
- int x, y;
- char buf[TCL_DOUBLE_SPACE];
-
- if ((objc != 2) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?");
+ if (objc == 3) {
+ if (Tcl_GetDoubleFromObj(interp, objv[2], &value) != TCL_OK) {
goto error;
}
- if (objc == 2) {
- value = scalePtr->value;
- } else {
- if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[3], &y)
- != TCL_OK)) {
- goto error;
- }
- value = TkScalePixelToValue(scalePtr, x, y);
- }
- sprintf(buf, scalePtr->format, value);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- break;
- }
- case COMMAND_IDENTIFY: {
- int x, y, thing;
-
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 1, objv, "identify x y");
+ } else {
+ value = scalePtr->value;
+ }
+ if (scalePtr->orient == ORIENT_VERTICAL) {
+ x = scalePtr->vertTroughX + scalePtr->width/2
+ + scalePtr->borderWidth;
+ y = TkScaleValueToPixel(scalePtr, value);
+ } else {
+ x = TkScaleValueToPixel(scalePtr, value);
+ y = scalePtr->horizTroughY + scalePtr->width/2
+ + scalePtr->borderWidth;
+ }
+ sprintf(buf, "%d %d", x, y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ break;
+ }
+ case COMMAND_GET: {
+ double value;
+ int x, y;
+ char buf[TCL_DOUBLE_SPACE];
+
+ if ((objc != 2) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?");
+ goto error;
+ }
+ if (objc == 2) {
+ value = scalePtr->value;
+ } else {
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) ||
+ (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
goto error;
}
- if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
- goto error;
- }
- thing = TkpScaleElement(scalePtr, x,y);
- switch (thing) {
- case TROUGH1:
- Tcl_SetResult(interp, "trough1", TCL_STATIC);
- break;
- case SLIDER:
- Tcl_SetResult(interp, "slider", TCL_STATIC);
- break;
- case TROUGH2:
- Tcl_SetResult(interp, "trough2", TCL_STATIC);
- break;
- }
- break;
- }
- case COMMAND_SET: {
- double value;
+ value = TkScalePixelToValue(scalePtr, x, y);
+ }
+ sprintf(buf, scalePtr->format, value);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ break;
+ }
+ case COMMAND_IDENTIFY: {
+ int x, y, thing;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "set value");
- goto error;
- }
- if (Tcl_GetDoubleFromObj(interp, objv[2], &value) != TCL_OK) {
- goto error;
- }
- if (scalePtr->state != STATE_DISABLED) {
- TkScaleSetValue(scalePtr, value, 1, 1);
- }
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 1, objv, "identify x y");
+ goto error;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
+ goto error;
+ }
+ thing = TkpScaleElement(scalePtr, x,y);
+ switch (thing) {
+ case TROUGH1:
+ Tcl_SetResult(interp, "trough1", TCL_STATIC);
+ break;
+ case SLIDER:
+ Tcl_SetResult(interp, "slider", TCL_STATIC);
break;
- }
+ case TROUGH2:
+ Tcl_SetResult(interp, "trough2", TCL_STATIC);
+ break;
+ }
+ break;
+ }
+ case COMMAND_SET: {
+ double value;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "set value");
+ goto error;
+ }
+ if (Tcl_GetDoubleFromObj(interp, objv[2], &value) != TCL_OK) {
+ goto error;
+ }
+ if (scalePtr->state != STATE_DISABLED) {
+ TkScaleSetValue(scalePtr, value, 1, 1);
+ }
+ break;
+ }
}
Tcl_Release((ClientData) scalePtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) scalePtr);
return TCL_ERROR;
}
@@ -494,9 +478,9 @@ ScaleWidgetObjCmd(clientData, interp, objc, objv)
*
* DestroyScale --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a button at a safe time
- * (when no-one is using it anymore).
+ * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
+ * clean up the internal structure of a button at a safe time (when
+ * no-one is using it anymore).
*
* Results:
* None.
@@ -508,8 +492,8 @@ ScaleWidgetObjCmd(clientData, interp, objc, objv)
*/
static void
-DestroyScale(memPtr)
- char *memPtr; /* Info about scale widget. */
+DestroyScale(
+ char *memPtr) /* Info about scale widget. */
{
register TkScale *scalePtr = (TkScale *) memPtr;
@@ -521,9 +505,8 @@ DestroyScale(memPtr)
}
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeOptions handle all the standard option-related stuff.
*/
if (scalePtr->varNamePtr != NULL) {
@@ -551,29 +534,28 @@ DestroyScale(memPtr)
*
* ConfigureScale --
*
- * This procedure is called to process an argv/argc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a scale widget.
+ * This procedure is called to process an argv/argc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a scale
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for scalePtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for scalePtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureScale(interp, scalePtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- register TkScale *scalePtr; /* Information about widget; may or may
- * not already have values for some fields. */
- int objc; /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+ConfigureScale(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register TkScale *scalePtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of valid entries in objv. */
+ Tcl_Obj *CONST objv[]) /* Argument values. */
{
Tk_SavedOptions savedOptions;
Tcl_Obj *errorResult = NULL;
@@ -598,7 +580,7 @@ ConfigureScale(interp, scalePtr, objc, objv)
if (Tk_SetOptions(interp, (char *) scalePtr,
scalePtr->optionTable, objc, objv,
- scalePtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) {
+ scalePtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
}
} else {
@@ -612,9 +594,9 @@ ConfigureScale(interp, scalePtr, objc, objv)
}
/*
- * If the scale is tied to the value of a variable, then set
- * the scale's value from the value of the variable, if it exists
- * and it holds a valid double value.
+ * If the scale is tied to the value of a variable, then set the
+ * scale's value from the value of the variable, if it exists and it
+ * holds a valid double value.
*/
if (scalePtr->varNamePtr != NULL) {
@@ -634,11 +616,11 @@ ConfigureScale(interp, scalePtr, objc, objv)
* orientation and creating GCs.
*/
- scalePtr->fromValue = TkRoundToResolution(scalePtr,
- scalePtr->fromValue);
+ scalePtr->fromValue = TkRoundToResolution(scalePtr,
+ scalePtr->fromValue);
scalePtr->toValue = TkRoundToResolution(scalePtr, scalePtr->toValue);
scalePtr->tickInterval = TkRoundToResolution(scalePtr,
- scalePtr->tickInterval);
+ scalePtr->tickInterval);
/*
* Make sure that the tick interval has the right sign so that
@@ -646,13 +628,13 @@ ConfigureScale(interp, scalePtr, objc, objv)
*/
if ((scalePtr->tickInterval < 0)
- ^ ((scalePtr->toValue - scalePtr->fromValue) < 0)) {
- scalePtr->tickInterval = -scalePtr->tickInterval;
+ ^ ((scalePtr->toValue - scalePtr->fromValue) < 0)) {
+ scalePtr->tickInterval = -scalePtr->tickInterval;
}
ComputeFormat(scalePtr);
- scalePtr->labelLength = scalePtr->label ? strlen(scalePtr->label) : 0;
+ scalePtr->labelLength = scalePtr->label ? (int)strlen(scalePtr->label) : 0;
Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder);
@@ -663,14 +645,14 @@ ConfigureScale(interp, scalePtr, objc, objv)
break;
}
if (!error) {
- Tk_FreeSavedOptions(&savedOptions);
+ Tk_FreeSavedOptions(&savedOptions);
}
/*
- * Set the scale value to itself; all this does is to make sure
- * that the scale's value is within the new acceptable range for
- * the scale. We don't set the var here because we need to make
- * special checks for possibly changed varNamePtr.
+ * Set the scale value to itself; all this does is to make sure that the
+ * scale's value is within the new acceptable range for the scale. We
+ * don't set the var here because we need to make special checks for
+ * possibly changed varNamePtr.
*/
TkScaleSetValue(scalePtr, scalePtr->value, 0, 1);
@@ -683,36 +665,36 @@ ConfigureScale(interp, scalePtr, objc, objv)
Tcl_Obj *valuePtr;
/*
- * Set the associated variable only when the new value differs
- * from the current value, or the variable doesn't yet exist
+ * Set the associated variable only when the new value differs from
+ * the current value, or the variable doesn't yet exist.
*/
+
valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL,
TCL_GLOBAL_ONLY);
if ((valuePtr == NULL) || (Tcl_GetDoubleFromObj(NULL,
valuePtr, &varValue) != TCL_OK)) {
ScaleSetVariable(scalePtr);
} else {
- char varString[TCL_DOUBLE_SPACE];
- char scaleString[TCL_DOUBLE_SPACE];
+ char varString[TCL_DOUBLE_SPACE], scaleString[TCL_DOUBLE_SPACE];
+
sprintf(varString, scalePtr->format, varValue);
sprintf(scaleString, scalePtr->format, scalePtr->value);
if (strcmp(varString, scaleString)) {
ScaleSetVariable(scalePtr);
}
}
- Tcl_TraceVar(interp, Tcl_GetString(scalePtr->varNamePtr),
- TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- ScaleVarProc, (ClientData) scalePtr);
+ Tcl_TraceVar(interp, Tcl_GetString(scalePtr->varNamePtr),
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ ScaleVarProc, (ClientData) scalePtr);
}
ScaleWorldChanged((ClientData) scalePtr);
if (error) {
- Tcl_SetObjResult(interp, errorResult);
+ Tcl_SetObjResult(interp, errorResult);
Tcl_DecrRefCount(errorResult);
return TCL_ERROR;
- } else {
- return TCL_OK;
}
+ return TCL_OK;
}
/*
@@ -720,22 +702,22 @@ ConfigureScale(interp, scalePtr, objc, objv)
*
* ScaleWorldChanged --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This procedure is called when the world has changed in some way and
+ * the widget needs to recompute all its graphics contexts and determine
+ * its new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Scale will be relayed out and redisplayed.
+ * Scale will be relayed out and redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
static void
-ScaleWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+ScaleWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC gc;
@@ -761,13 +743,13 @@ ScaleWorldChanged(instanceData)
if (scalePtr->copyGC == None) {
gcValues.graphics_exposures = False;
scalePtr->copyGC = Tk_GetGC(scalePtr->tkwin, GCGraphicsExposures,
- &gcValues);
+ &gcValues);
}
scalePtr->inset = scalePtr->highlightWidth + scalePtr->borderWidth;
/*
- * Recompute display-related information, and let the geometry
- * manager know how much space is needed now.
+ * Recompute display-related information, and let the geometry manager
+ * know how much space is needed now.
*/
ComputeScaleGeometry(scalePtr);
@@ -780,9 +762,9 @@ ScaleWorldChanged(instanceData)
*
* ComputeFormat --
*
- * This procedure is invoked to recompute the "format" field
- * of a scale's widget record, which determines how the value
- * of the scale is converted to a string.
+ * This procedure is invoked to recompute the "format" field of a scale's
+ * widget record, which determines how the value of the scale is
+ * converted to a string.
*
* Results:
* None.
@@ -794,16 +776,16 @@ ScaleWorldChanged(instanceData)
*/
static void
-ComputeFormat(scalePtr)
- TkScale *scalePtr; /* Information about scale widget. */
+ComputeFormat(
+ TkScale *scalePtr) /* Information about scale widget. */
{
double maxValue, x;
int mostSigDigit, numDigits, leastSigDigit, afterDecimal;
int eDigits, fDigits;
/*
- * Compute the displacement from the decimal of the most significant
- * digit required for any number in the scale's range.
+ * Compute the displacement from the decimal of the most significant digit
+ * required for any number in the scale's range.
*/
maxValue = fabs(scalePtr->fromValue);
@@ -818,17 +800,16 @@ ComputeFormat(scalePtr)
/*
* If the number of significant digits wasn't specified explicitly,
- * compute it. It's the difference between the most significant
- * digit needed to represent any number on the scale and the
- * most significant digit of the smallest difference between
- * numbers on the scale. In other words, display enough digits so
- * that at least one digit will be different between any two adjacent
- * positions of the scale.
+ * compute it. It's the difference between the most significant digit
+ * needed to represent any number on the scale and the most significant
+ * digit of the smallest difference between numbers on the scale. In other
+ * words, display enough digits so that at least one digit will be
+ * different between any two adjacent positions of the scale.
*/
numDigits = scalePtr->digits;
if (numDigits <= 0) {
- if (scalePtr->resolution > 0) {
+ if (scalePtr->resolution > 0) {
/*
* A resolution was specified for the scale, so just use it.
*/
@@ -836,9 +817,9 @@ ComputeFormat(scalePtr)
leastSigDigit = (int) floor(log10(scalePtr->resolution));
} else {
/*
- * No resolution was specified, so compute the difference
- * in value between adjacent pixels and use it for the least
- * significant digit.
+ * No resolution was specified, so compute the difference in value
+ * between adjacent pixels and use it for the least significant
+ * digit.
*/
x = fabs(scalePtr->fromValue - scalePtr->toValue);
@@ -858,8 +839,8 @@ ComputeFormat(scalePtr)
}
/*
- * Compute the number of characters required using "e" format and
- * "f" format, and then choose whichever one takes fewer characters.
+ * Compute the number of characters required using "e" format and "f"
+ * format, and then choose whichever one takes fewer characters.
*/
eDigits = numDigits + 4;
@@ -889,23 +870,23 @@ ComputeFormat(scalePtr)
*
* ComputeScaleGeometry --
*
- * This procedure is called to compute various geometrical
- * information for a scale, such as where various things get
- * displayed. It's called when the window is reconfigured.
+ * This procedure is called to compute various geometrical information
+ * for a scale, such as where various things get displayed. It's called
+ * when the window is reconfigured.
*
* Results:
* None.
*
* Side effects:
- * Display-related numbers get changed in *scalePtr. The
- * geometry manager gets told about the window's preferred size.
+ * Display-related numbers get changed in *scalePtr. The geometry manager
+ * gets told about the window's preferred size.
*
*----------------------------------------------------------------------
*/
static void
-ComputeScaleGeometry(scalePtr)
- register TkScale *scalePtr; /* Information about widget. */
+ComputeScaleGeometry(
+ register TkScale *scalePtr) /* Information about widget. */
{
char valueString[PRINT_CHARS];
int tmp, valuePixels, x, y, extraSpace;
@@ -915,9 +896,9 @@ ComputeScaleGeometry(scalePtr)
scalePtr->fontHeight = fm.linespace + SPACING;
/*
- * Horizontal scales are simpler than vertical ones because
- * all sizes are the same (the height of a line of text);
- * handle them first and then quit.
+ * Horizontal scales are simpler than vertical ones because all sizes are
+ * the same (the height of a line of text); handle them first and then
+ * quit.
*/
if (scalePtr->orient == ORIENT_HORIZONTAL) {
@@ -949,9 +930,9 @@ ComputeScaleGeometry(scalePtr)
}
/*
- * Vertical scale: compute the amount of space needed to display
- * the scales value by formatting strings for the two end points;
- * use whichever length is longer.
+ * Vertical scale: compute the amount of space needed to display the
+ * scales value by formatting strings for the two end points; use
+ * whichever length is longer.
*/
sprintf(valueString, scalePtr->format, scalePtr->fromValue);
@@ -964,8 +945,8 @@ ComputeScaleGeometry(scalePtr)
}
/*
- * Assign x-locations to the elements of the scale, working from
- * left to right.
+ * Assign x-locations to the elements of the scale, working from left to
+ * right.
*/
x = scalePtr->inset;
@@ -1006,23 +987,23 @@ ComputeScaleGeometry(scalePtr)
*
* ScaleEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on scales.
+ * This procedure is invoked by the Tk dispatcher for various events on
+ * scales.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-ScaleEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+ScaleEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkScale *scalePtr = (TkScale *) clientData;
@@ -1055,9 +1036,9 @@ ScaleEventProc(clientData, eventPtr)
*
* ScaleCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This procedure is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -1069,17 +1050,17 @@ ScaleEventProc(clientData, eventPtr)
*/
static void
-ScaleCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+ScaleCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TkScale *scalePtr = (TkScale *) clientData;
Tk_Window tkwin = scalePtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This procedure could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this procedure destroys the
+ * widget.
*/
if (!(scalePtr->flags & SCALE_DELETED)) {
@@ -1093,25 +1074,25 @@ ScaleCmdDeletedProc(clientData)
*
* TkEventuallyRedrawScale --
*
- * Arrange for part or all of a scale widget to redrawn at
- * the next convenient time in the future.
+ * Arrange for part or all of a scale widget to redrawn at the next
+ * convenient time in the future.
*
* Results:
* None.
*
* Side effects:
- * If "what" is REDRAW_SLIDER then just the slider and the
- * value readout will be redrawn; if "what" is REDRAW_ALL
- * then the entire widget will be redrawn.
+ * If "what" is REDRAW_SLIDER then just the slider and the value readout
+ * will be redrawn; if "what" is REDRAW_ALL then the entire widget will
+ * be redrawn.
*
*--------------------------------------------------------------
*/
void
-TkEventuallyRedrawScale(scalePtr, what)
- register TkScale *scalePtr; /* Information about widget. */
- int what; /* What to redraw: REDRAW_SLIDER
- * or REDRAW_ALL. */
+TkEventuallyRedrawScale(
+ register TkScale *scalePtr, /* Information about widget. */
+ int what) /* What to redraw: REDRAW_SLIDER or
+ * REDRAW_ALL. */
{
if ((what == 0) || (scalePtr->tkwin == NULL)
|| !Tk_IsMapped(scalePtr->tkwin)) {
@@ -1129,8 +1110,8 @@ TkEventuallyRedrawScale(scalePtr, what)
*
* TkRoundToResolution --
*
- * Round a given floating-point value to the nearest multiple
- * of the scale's resolution.
+ * Round a given floating-point value to the nearest multiple of the
+ * scale's resolution.
*
* Results:
* The return value is the rounded result.
@@ -1142,28 +1123,28 @@ TkEventuallyRedrawScale(scalePtr, what)
*/
double
-TkRoundToResolution(scalePtr, value)
- TkScale *scalePtr; /* Information about scale widget. */
- double value; /* Value to round. */
+TkRoundToResolution(
+ TkScale *scalePtr, /* Information about scale widget. */
+ double value) /* Value to round. */
{
- double rem, new, tick;
+ double rem, rounded, tick;
if (scalePtr->resolution <= 0) {
return value;
}
tick = floor(value/scalePtr->resolution);
- new = scalePtr->resolution * tick;
- rem = value - new;
+ rounded = scalePtr->resolution * tick;
+ rem = value - rounded;
if (rem < 0) {
if (rem <= -scalePtr->resolution/2) {
- new = (tick - 1.0) * scalePtr->resolution;
+ rounded = (tick - 1.0) * scalePtr->resolution;
}
} else {
if (rem >= scalePtr->resolution/2) {
- new = (tick + 1.0) * scalePtr->resolution;
+ rounded = (tick + 1.0) * scalePtr->resolution;
}
}
- return new;
+ return rounded;
}
/*
@@ -1171,28 +1152,28 @@ TkRoundToResolution(scalePtr, value)
*
* ScaleVarProc --
*
- * This procedure is invoked by Tcl whenever someone modifies a
- * variable associated with a scale widget.
+ * This procedure is invoked by Tcl whenever someone modifies a variable
+ * associated with a scale widget.
*
* Results:
* NULL is always returned.
*
* Side effects:
- * The value displayed in the scale will change to match the
- * variable's new value. If the variable has a bogus value then
- * it is reset to the value of the scale.
+ * The value displayed in the scale will change to match the variable's
+ * new value. If the variable has a bogus value then it is reset to the
+ * value of the scale.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static char *
-ScaleVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about button. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Name of variable. */
- CONST char *name2; /* Second part of variable name. */
- int flags; /* Information about what happened. */
+ScaleVarProc(
+ ClientData clientData, /* Information about button. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ CONST char *name1, /* Name of variable. */
+ CONST char *name2, /* Second part of variable name. */
+ int flags) /* Information about what happened. */
{
register TkScale *scalePtr = (TkScale *) clientData;
char *resultStr;
@@ -1201,8 +1182,8 @@ ScaleVarProc(clientData, interp, name1, name2, flags)
int result;
/*
- * If the variable is unset, then immediately recreate it unless
- * the whole interpreter is going away.
+ * If the variable is unset, then immediately recreate it unless the whole
+ * interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
@@ -1213,34 +1194,33 @@ ScaleVarProc(clientData, interp, name1, name2, flags)
scalePtr->flags |= NEVER_SET;
TkScaleSetValue(scalePtr, scalePtr->value, 1, 0);
}
- return (char *) NULL;
+ return NULL;
}
/*
* If we came here because we updated the variable (in TkScaleSetValue),
- * then ignore the trace. Otherwise update the scale with the value
- * of the variable.
+ * then ignore the trace. Otherwise update the scale with the value of the
+ * variable.
*/
if (scalePtr->flags & SETTING_VAR) {
- return (char *) NULL;
+ return NULL;
}
resultStr = NULL;
- valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL,
- TCL_GLOBAL_ONLY);
+ valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL,
+ TCL_GLOBAL_ONLY);
result = Tcl_GetDoubleFromObj(interp, valuePtr, &value);
if (result != TCL_OK) {
- resultStr = "can't assign non-numeric value to scale variable";
+ resultStr = "can't assign non-numeric value to scale variable";
ScaleSetVariable(scalePtr);
} else {
scalePtr->value = TkRoundToResolution(scalePtr, value);
/*
* This code is a bit tricky because it sets the scale's value before
- * calling TkScaleSetValue. This way, TkScaleSetValue won't bother
- * to set the variable again or to invoke the -command. However, it
- * also won't redisplay the scale, so we have to ask for that
- * explicitly.
+ * calling TkScaleSetValue. This way, TkScaleSetValue won't bother to
+ * set the variable again or to invoke the -command. However, it also
+ * won't redisplay the scale, so we have to ask for that explicitly.
*/
TkScaleSetValue(scalePtr, scalePtr->value, 1, 0);
@@ -1255,28 +1235,28 @@ ScaleVarProc(clientData, interp, name1, name2, flags)
*
* TkScaleSetValue --
*
- * This procedure changes the value of a scale and invokes
- * a Tcl command to reflect the current position of a scale
+ * This procedure changes the value of a scale and invokes a Tcl command
+ * to reflect the current position of a scale
*
* Results:
* None.
*
* Side effects:
- * A Tcl command is invoked, and an additional error-processing
- * command may also be invoked. The scale's slider is redrawn.
+ * A Tcl command is invoked, and an additional error-processing command
+ * may also be invoked. The scale's slider is redrawn.
*
*--------------------------------------------------------------
*/
void
-TkScaleSetValue(scalePtr, value, setVar, invokeCommand)
- register TkScale *scalePtr; /* Info about widget. */
- double value; /* New value for scale. Gets adjusted
- * if it's off the scale. */
- int setVar; /* Non-zero means reflect new value through
- * to associated variable, if any. */
- int invokeCommand; /* Non-zero means invoked -command option
- * to notify of new value, 0 means don't. */
+TkScaleSetValue(
+ register TkScale *scalePtr, /* Info about widget. */
+ double value, /* New value for scale. Gets adjusted if it's
+ * off the scale. */
+ int setVar, /* Non-zero means reflect new value through to
+ * associated variable, if any. */
+ int invokeCommand) /* Non-zero means invoked -command option to
+ * notify of new value, 0 means don't. */
{
value = TkRoundToResolution(scalePtr, value);
if ((value < scalePtr->fromValue)
@@ -1320,11 +1300,12 @@ TkScaleSetValue(scalePtr, value, setVar, invokeCommand)
*/
static void
-ScaleSetVariable(scalePtr)
- register TkScale *scalePtr; /* Info about widget. */
+ScaleSetVariable(
+ register TkScale *scalePtr) /* Info about widget. */
{
if (scalePtr->varNamePtr != NULL) {
char string[PRINT_CHARS];
+
sprintf(string, scalePtr->format, scalePtr->value);
scalePtr->flags |= SETTING_VAR;
Tcl_ObjSetVar2(scalePtr->interp, scalePtr->varNamePtr, NULL,
@@ -1338,13 +1319,12 @@ ScaleSetVariable(scalePtr)
*
* TkScalePixelToValue --
*
- * Given a pixel within a scale window, return the scale
- * reading corresponding to that pixel.
+ * Given a pixel within a scale window, return the scale reading
+ * corresponding to that pixel.
*
* Results:
- * A double-precision scale reading. If the value is outside
- * the legal range for the scale then it's rounded to the nearest
- * end of the scale.
+ * A double-precision scale reading. If the value is outside the legal
+ * range for the scale then it's rounded to the nearest end of the scale.
*
* Side effects:
* None.
@@ -1353,10 +1333,9 @@ ScaleSetVariable(scalePtr)
*/
double
-TkScalePixelToValue(scalePtr, x, y)
- register TkScale *scalePtr; /* Information about widget. */
- int x, y; /* Coordinates of point within
- * window. */
+TkScalePixelToValue(
+ register TkScale *scalePtr, /* Information about widget. */
+ int x, int y) /* Coordinates of point within window. */
{
double value, pixelRange;
@@ -1372,14 +1351,14 @@ TkScalePixelToValue(scalePtr, x, y)
if (pixelRange <= 0) {
/*
- * Not enough room for the slider to actually slide: just return
- * the scale's current value.
+ * Not enough room for the slider to actually slide: just return the
+ * scale's current value.
*/
return scalePtr->value;
}
value -= scalePtr->sliderLength/2 + scalePtr->inset
- + scalePtr->borderWidth;
+ + scalePtr->borderWidth;
value /= pixelRange;
if (value < 0) {
value = 0;
@@ -1397,14 +1376,13 @@ TkScalePixelToValue(scalePtr, x, y)
*
* TkScaleValueToPixel --
*
- * Given a reading of the scale, return the x-coordinate or
- * y-coordinate corresponding to that reading, depending on
- * whether the scale is vertical or horizontal, respectively.
+ * Given a reading of the scale, return the x-coordinate or y-coordinate
+ * corresponding to that reading, depending on whether the scale is
+ * vertical or horizontal, respectively.
*
* Results:
- * An integer value giving the pixel location corresponding
- * to reading. The value is restricted to lie within the
- * defined range for the scale.
+ * An integer value giving the pixel location corresponding to reading.
+ * The value is restricted to lie within the defined range for the scale.
*
* Side effects:
* None.
@@ -1413,9 +1391,9 @@ TkScalePixelToValue(scalePtr, x, y)
*/
int
-TkScaleValueToPixel(scalePtr, value)
- register TkScale *scalePtr; /* Information about widget. */
- double value; /* Reading of the widget. */
+TkScaleValueToPixel(
+ register TkScale *scalePtr, /* Information about widget. */
+ double value) /* Reading of the widget. */
{
int y, pixelRange;
double valueRange;
@@ -1428,7 +1406,7 @@ TkScaleValueToPixel(scalePtr, value)
y = 0;
} else {
y = (int) ((value - scalePtr->fromValue) * pixelRange
- / valueRange + 0.5);
+ / valueRange + 0.5);
if (y < 0) {
y = 0;
} else if (y > pixelRange) {
@@ -1438,3 +1416,11 @@ TkScaleValueToPixel(scalePtr, value)
y += scalePtr->sliderLength/2 + scalePtr->inset + scalePtr->borderWidth;
return y;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkScale.h b/generic/tkScale.h
index 71d5d53..f406bf6 100644
--- a/generic/tkScale.h
+++ b/generic/tkScale.h
@@ -1,21 +1,21 @@
/*
* tkScale.h --
*
- * Declarations of types and functions used to implement
- * the scale widget.
+ * Declarations of types and functions used to implement the scale
+ * widget.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* Copyright (c) 1999-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKSCALE
#define _TKSCALE
-#ifndef _TK
-#include "tk.h"
+#ifndef _TKINT
+#include "tkInt.h"
#endif
#ifdef BUILD_tk
@@ -40,16 +40,16 @@ enum state {
};
/*
- * A data structure of the following type is kept for each scale
- * widget managed by this file:
+ * A data structure of the following type is kept for each scale widget
+ * managed by this file:
*/
typedef struct TkScale {
- Tk_Window tkwin; /* Window that embodies the scale. NULL
- * means that the window has been destroyed
- * but the data structures haven't yet been
- * cleaned up.*/
- Display *display; /* Display containing widget. Used, among
+ Tk_Window tkwin; /* Window that embodies the scale. NULL means
+ * that the window has been destroyed but the
+ * data structures haven't yet been cleaned
+ * up.*/
+ Display *display; /* Display containing widget. Used, among
* other things, so that resources can be
* freed even after tkwin has gone away. */
Tcl_Interp *interp; /* Interpreter associated with scale. */
@@ -58,42 +58,41 @@ typedef struct TkScale {
* available for this widget. */
enum orient orient; /* Orientation for window (vertical or
* horizontal). */
- int width; /* Desired narrow dimension of scale,
- * in pixels. */
- int length; /* Desired long dimension of scale,
- * in pixels. */
+ int width; /* Desired narrow dimension of scale, in
+ * pixels. */
+ int length; /* Desired long dimension of scale, in
+ * pixels. */
double value; /* Current value of scale. */
- Tcl_Obj *varNamePtr; /* Name of variable or NULL.
- * If non-NULL, scale's value tracks
- * the contents of this variable and
- * vice versa. */
+ Tcl_Obj *varNamePtr; /* Name of variable or NULL. If non-NULL,
+ * scale's value tracks the contents of this
+ * variable and vice versa. */
double fromValue; /* Value corresponding to left or top of
* scale. */
- double toValue; /* Value corresponding to right or bottom
- * of scale. */
- double tickInterval; /* Distance between tick marks;
- * 0 means don't display any tick marks. */
- double resolution; /* If > 0, all values are rounded to an
- * even multiple of this value. */
- int digits; /* Number of significant digits to print
- * in values. 0 means we get to choose the
- * number based on resolution and/or the
- * range of the scale. */
+ double toValue; /* Value corresponding to right or bottom of
+ * scale. */
+ double tickInterval; /* Distance between tick marks; 0 means don't
+ * display any tick marks. */
+ double resolution; /* If > 0, all values are rounded to an even
+ * multiple of this value. */
+ int digits; /* Number of significant digits to print in
+ * values. 0 means we get to choose the number
+ * based on resolution and/or the range of the
+ * scale. */
char format[10]; /* Sprintf conversion specifier computed from
* digits and other information. */
- double bigIncrement; /* Amount to use for large increments to
- * scale value. (0 means we pick a value). */
+ double bigIncrement; /* Amount to use for large increments to scale
+ * value. (0 means we pick a value). */
char *command; /* Command prefix to use when invoking Tcl
* commands because the scale value changed.
* NULL means don't invoke commands. */
- int repeatDelay; /* How long to wait before auto-repeating
- * on scrolling actions (in ms). */
+ int repeatDelay; /* How long to wait before auto-repeating on
+ * scrolling actions (in ms). */
int repeatInterval; /* Interval between autorepeats (in ms). */
char *label; /* Label to display above or to right of
- * scale; NULL means don't display a label. */
+ * scale; NULL means don't display a label. */
int labelLength; /* Number of non-NULL chars. in label. */
enum state state; /* Values are active, normal, or disabled.
- * Value of scale cannot be changed when
+ * Value of scale cannot be changed when
* disabled. */
/*
@@ -104,19 +103,19 @@ typedef struct TkScale {
Tk_3DBorder bgBorder; /* Used for drawing slider and other
* background areas. */
Tk_3DBorder activeBorder; /* For drawing the slider when active. */
- int sliderRelief; /* Is slider to be drawn raised, sunken,
+ int sliderRelief; /* Is slider to be drawn raised, sunken,
* etc. */
XColor *troughColorPtr; /* Color for drawing trough. */
GC troughGC; /* For drawing trough. */
- GC copyGC; /* Used for copying from pixmap onto screen. */
+ GC copyGC; /* Used for copying from pixmap onto screen */
Tk_Font tkfont; /* Information about text font, or NULL. */
XColor *textColorPtr; /* Color for drawing text. */
GC textGC; /* GC for drawing text in normal mode. */
int relief; /* Indicates whether window as a whole is
* raised, sunken, or flat. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * <= 0 means don't draw a highlight. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. <= 0 means
+ * don't draw a highlight. */
Tk_3DBorder highlightBorder;/* Value of -highlightbackground option:
* specifies background with which to draw 3-D
* default ring and focus highlight area when
@@ -124,18 +123,18 @@ typedef struct TkScale {
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
int inset; /* Total width of all borders, including
* traversal highlight and 3-D border.
- * Indicates how much interior stuff must
- * be offset from outside edges to leave
- * room for borders. */
+ * Indicates how much interior stuff must be
+ * offset from outside edges to leave room for
+ * borders. */
int sliderLength; /* Length of slider, measured in pixels along
* long dimension of scale. */
int showValue; /* Non-zero means to display the scale value
- * below or to the left of the slider; zero
+ * below or to the left of the slider; zero
* means don't display the value. */
/*
- * Layout information for horizontal scales, assuming that window
- * gets the size it requested:
+ * Layout information for horizontal scales, assuming that window gets the
+ * size it requested:
*/
int horizLabelY; /* Y-coord at which to draw label. */
@@ -143,8 +142,8 @@ typedef struct TkScale {
int horizTroughY; /* Y-coord of top of slider trough. */
int horizTickY; /* Y-coord at which to draw tick text. */
/*
- * Layout information for vertical scales, assuming that window
- * gets the size it requested:
+ * Layout information for vertical scales, assuming that window gets the
+ * size it requested:
*/
int vertTickRightX; /* X-location of right side of tick-marks. */
@@ -158,37 +157,37 @@ typedef struct TkScale {
int fontHeight; /* Height of scale font. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
- Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. May be NULL. */
- int flags; /* Various flags; see below for
+ Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. May be NULL. */
+ int flags; /* Various flags; see below for
* definitions. */
} TkScale;
/*
* Flag bits for scales:
*
- * REDRAW_SLIDER - 1 means slider (and numerical readout) need
- * to be redrawn.
+ * REDRAW_SLIDER - 1 means slider (and numerical readout) need to
+ * be redrawn.
* REDRAW_OTHER - 1 means other stuff besides slider and value
* need to be redrawn.
* REDRAW_ALL - 1 means the entire widget needs to be redrawn.
* REDRAW_PENDING - 1 means any sort of redraw is pending
- * ACTIVE - 1 means the widget is active (the mouse is
- * in its window).
+ * ACTIVE - 1 means the widget is active (the mouse is in
+ * its window).
* INVOKE_COMMAND - 1 means the scale's command needs to be
- * invoked during the next redisplay (the
- * value of the scale has changed since the
- * last time the command was invoked).
- * SETTING_VAR - 1 means that the associated variable is
- * being set by us, so there's no need for
- * ScaleVarProc to do anything.
- * NEVER_SET - 1 means that the scale's value has never
- * been set before (so must invoke -command and
- * set associated variable even if the value
- * doesn't appear to have changed).
- * GOT_FOCUS - 1 means that the focus is currently in
- * this widget.
+ * invoked during the next redisplay (the value
+ * of the scale has changed since the last time
+ * the command was invoked).
+ * SETTING_VAR - 1 means that the associated variable is being
+ * set by us, so there's no need for ScaleVarProc
+ * to do anything.
+ * NEVER_SET - 1 means that the scale's value has never been
+ * set before (so must invoke -command and set
+ * associated variable even if the value doesn't
+ * appear to have changed).
+ * GOT_FOCUS - 1 means that the focus is currently in this
+ * widget.
* SCALE_DELETED - 1 means the scale widget is being deleted
*/
@@ -204,8 +203,8 @@ typedef struct TkScale {
#define SCALE_DELETED (1<<8)
/*
- * Symbolic values for the active parts of a slider. These are
- * the values that may be returned by the ScaleElement procedure.
+ * Symbolic values for the active parts of a slider. These are the values that
+ * may be returned by the ScaleElement procedure.
*/
#define OTHER 0
@@ -214,39 +213,32 @@ typedef struct TkScale {
#define TROUGH2 3
/*
- * Space to leave between scale area and text, and between text and
- * edge of window.
+ * Space to leave between scale area and text, and between text and edge of
+ * window.
*/
#define SPACING 2
/*
- * How many characters of space to provide when formatting the
- * scale's value:
+ * How many characters of space to provide when formatting the scale's value:
*/
#define PRINT_CHARS 150
/*
- * Declaration of procedures used in the implementation of the scale
- * widget.
+ * Declaration of procedures used in the implementation of the scale widget.
*/
-EXTERN void TkEventuallyRedrawScale _ANSI_ARGS_((TkScale *scalePtr,
- int what));
-EXTERN double TkRoundToResolution _ANSI_ARGS_((TkScale *scalePtr,
- double value));
-EXTERN TkScale * TkpCreateScale _ANSI_ARGS_((Tk_Window tkwin));
-EXTERN void TkpDestroyScale _ANSI_ARGS_((TkScale *scalePtr));
-EXTERN void TkpDisplayScale _ANSI_ARGS_((ClientData clientData));
-EXTERN int TkpScaleElement _ANSI_ARGS_((TkScale *scalePtr,
- int x, int y));
-EXTERN void TkScaleSetValue _ANSI_ARGS_((TkScale *scalePtr,
- double value, int setVar, int invokeCommand));
-EXTERN double TkScalePixelToValue _ANSI_ARGS_((TkScale *scalePtr,
- int x, int y));
-EXTERN int TkScaleValueToPixel _ANSI_ARGS_((TkScale *scalePtr,
- double value));
+MODULE_SCOPE void TkEventuallyRedrawScale(TkScale *scalePtr, int what);
+MODULE_SCOPE double TkRoundToResolution(TkScale *scalePtr, double value);
+MODULE_SCOPE TkScale * TkpCreateScale(Tk_Window tkwin);
+MODULE_SCOPE void TkpDestroyScale(TkScale *scalePtr);
+MODULE_SCOPE void TkpDisplayScale(ClientData clientData);
+MODULE_SCOPE int TkpScaleElement(TkScale *scalePtr, int x, int y);
+MODULE_SCOPE void TkScaleSetValue(TkScale *scalePtr, double value,
+ int setVar, int invokeCommand);
+MODULE_SCOPE double TkScalePixelToValue(TkScale *scalePtr, int x, int y);
+MODULE_SCOPE int TkScaleValueToPixel(TkScale *scalePtr, double value);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index d4f3d88..f19671c 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -1,19 +1,18 @@
-/*
+/*
* tkScrollbar.c --
*
- * This module implements a scrollbar widgets for the Tk
- * toolkit. A scrollbar displays a slider and two arrows;
- * mouse clicks on features within the scrollbar cause
- * scrolling commands to be invoked.
+ * This module implements a scrollbar widgets for the Tk toolkit. A
+ * scrollbar displays a slider and two arrows; mouse clicks on features
+ * within the scrollbar cause scrolling commands to be invoked.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
+#include "tkInt.h"
#include "tkScrollbar.h"
#include "default.h"
@@ -46,10 +45,8 @@ Tk_ConfigSpec tkpScrollbarConfigSpecs[] = {
{TK_CONFIG_BORDER, "-background", "background", "Background",
DEF_SCROLLBAR_BG_MONO, Tk_Offset(TkScrollbar, bgBorder),
TK_CONFIG_MONO_ONLY},
- {TK_CONFIG_SYNONYM, "-bd", "borderWidth", (char *) NULL,
- (char *) NULL, 0, 0},
- {TK_CONFIG_SYNONYM, "-bg", "background", (char *) NULL,
- (char *) NULL, 0, 0},
+ {TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0},
+ {TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0},
{TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_SCROLLBAR_BORDER_WIDTH, Tk_Offset(TkScrollbar, borderWidth), 0},
{TK_CONFIG_STRING, "-command", "command", "Command",
@@ -91,30 +88,27 @@ Tk_ConfigSpec tkpScrollbarConfigSpecs[] = {
TK_CONFIG_MONO_ONLY},
{TK_CONFIG_PIXELS, "-width", "width", "Width",
DEF_SCROLLBAR_WIDTH, Tk_Offset(TkScrollbar, width), 0},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int ConfigureScrollbar _ANSI_ARGS_((Tcl_Interp *interp,
- TkScrollbar *scrollPtr, int argc, CONST char **argv,
- int flags));
-static void ScrollbarCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static int ScrollbarWidgetCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *, int argc, CONST char **argv));
+static int ConfigureScrollbar(Tcl_Interp *interp,
+ TkScrollbar *scrollPtr, int argc,
+ CONST char **argv, int flags);
+static void ScrollbarCmdDeletedProc(ClientData clientData);
+static int ScrollbarWidgetCmd(ClientData clientData,
+ Tcl_Interp *, int argc, CONST char **argv);
/*
*--------------------------------------------------------------
*
* Tk_ScrollbarCmd --
*
- * This procedure is invoked to process the "scrollbar" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "scrollbar" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -126,41 +120,40 @@ static int ScrollbarWidgetCmd _ANSI_ARGS_((ClientData clientData,
*/
int
-Tk_ScrollbarCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+Tk_ScrollbarCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
Tk_Window tkwin = (Tk_Window) clientData;
register TkScrollbar *scrollPtr;
- Tk_Window new;
+ Tk_Window newWin;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " pathName ?options?\"", (char *) NULL);
+ argv[0], " pathName ?options?\"", NULL);
return TCL_ERROR;
}
- new = Tk_CreateWindowFromPath(interp, tkwin, argv[1], (char *) NULL);
- if (new == NULL) {
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, argv[1], NULL);
+ if (newWin == NULL) {
return TCL_ERROR;
}
- Tk_SetClass(new, "Scrollbar");
- scrollPtr = TkpCreateScrollbar(new);
+ Tk_SetClass(newWin, "Scrollbar");
+ scrollPtr = TkpCreateScrollbar(newWin);
- Tk_SetClassProcs(new, &tkpScrollbarProcs, (ClientData) scrollPtr);
+ Tk_SetClassProcs(newWin, &tkpScrollbarProcs, (ClientData) scrollPtr);
/*
- * Initialize fields that won't be initialized by ConfigureScrollbar,
- * or which ConfigureScrollbar expects to have reasonable values
- * (e.g. resource pointers).
+ * Initialize fields that won't be initialized by ConfigureScrollbar, or
+ * which ConfigureScrollbar expects to have reasonable values (e.g.
+ * resource pointers).
*/
- scrollPtr->tkwin = new;
- scrollPtr->display = Tk_Display(new);
+ scrollPtr->tkwin = newWin;
+ scrollPtr->display = Tk_Display(newWin);
scrollPtr->interp = interp;
scrollPtr->widgetCmd = Tcl_CreateCommand(interp,
Tk_PathName(scrollPtr->tkwin), ScrollbarWidgetCmd,
@@ -210,9 +203,9 @@ Tk_ScrollbarCmd(clientData, interp, argc, argv)
*
* ScrollbarWidgetCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -224,12 +217,11 @@ Tk_ScrollbarCmd(clientData, interp, argc, argv)
*/
static int
-ScrollbarWidgetCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Information about scrollbar
- * widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+ScrollbarWidgetCmd(
+ ClientData clientData, /* Information about scrollbar widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
register TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
int result = TCL_OK;
@@ -238,7 +230,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " option ?arg arg ...?\"", (char *) NULL);
+ argv[0], " option ?arg arg ...?\"", NULL);
return TCL_ERROR;
}
Tcl_Preserve((ClientData) scrollPtr);
@@ -248,21 +240,21 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
int oldActiveField;
if (argc == 2) {
switch (scrollPtr->activeField) {
- case TOP_ARROW:
- Tcl_SetResult(interp, "arrow1", TCL_STATIC);
- break;
- case SLIDER:
- Tcl_SetResult(interp, "slider", TCL_STATIC);
- break;
- case BOTTOM_ARROW:
- Tcl_SetResult(interp, "arrow2", TCL_STATIC);
- break;
+ case TOP_ARROW:
+ Tcl_SetResult(interp, "arrow1", TCL_STATIC);
+ break;
+ case SLIDER:
+ Tcl_SetResult(interp, "slider", TCL_STATIC);
+ break;
+ case BOTTOM_ARROW:
+ Tcl_SetResult(interp, "arrow2", TCL_STATIC);
+ break;
}
goto done;
}
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " activate element\"", (char *) NULL);
+ argv[0], " activate element\"", NULL);
goto error;
}
c = argv[2][0];
@@ -285,7 +277,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " cget option\"",
- (char *) NULL);
+ NULL);
goto error;
}
result = Tk_ConfigureValue(interp, scrollPtr->tkwin,
@@ -294,8 +286,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
&& (length >= 2)) {
if (argc == 2) {
result = Tk_ConfigureInfo(interp, scrollPtr->tkwin,
- tkpScrollbarConfigSpecs, (char *) scrollPtr,
- (char *) NULL, 0);
+ tkpScrollbarConfigSpecs, (char *) scrollPtr, NULL, 0);
} else if (argc == 3) {
result = Tk_ConfigureInfo(interp, scrollPtr->tkwin,
tkpScrollbarConfigSpecs, (char *) scrollPtr, argv[2], 0);
@@ -310,7 +301,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
if (argc != 4) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " delta xDelta yDelta\"", (char *) NULL);
+ argv[0], " delta xDelta yDelta\"", NULL);
goto error;
}
if ((Tcl_GetInt(interp, argv[2], &xDelta) != TCL_OK)
@@ -331,7 +322,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
} else {
fraction = ((double) pixels / (double) length);
}
- sprintf(buf, "%g", fraction);
+ Tcl_PrintDouble(NULL, fraction, buf);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
} else if ((c == 'f') && (strncmp(argv[1], "fraction", length) == 0)) {
int x, y, pos, length;
@@ -340,7 +331,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
if (argc != 4) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " fraction x y\"", (char *) NULL);
+ argv[0], " fraction x y\"", NULL);
goto error;
}
if ((Tcl_GetInt(interp, argv[2], &x) != TCL_OK)
@@ -366,12 +357,12 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
} else if (fraction > 1.0) {
fraction = 1.0;
}
- sprintf(buf, "%g", fraction);
+ Tcl_PrintDouble(NULL, fraction, buf);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
} else if ((c == 'g') && (strncmp(argv[1], "get", length) == 0)) {
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " get\"", (char *) NULL);
+ argv[0], " get\"", NULL);
goto error;
}
if (scrollPtr->flags & NEW_STYLE_COMMANDS) {
@@ -379,7 +370,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
Tcl_PrintDouble(interp, scrollPtr->firstFraction, first);
Tcl_PrintDouble(interp, scrollPtr->lastFraction, last);
- Tcl_AppendResult(interp, first, " ", last, (char *) NULL);
+ Tcl_AppendResult(interp, first, " ", last, NULL);
} else {
char buf[TCL_INTEGER_SPACE * 4];
@@ -393,7 +384,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
if (argc != 4) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " identify x y\"", (char *) NULL);
+ argv[0], " identify x y\"", NULL);
goto error;
}
if ((Tcl_GetInt(interp, argv[2], &x) != TCL_OK)
@@ -402,21 +393,21 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
}
thing = TkpScrollbarPosition(scrollPtr, x,y);
switch (thing) {
- case TOP_ARROW:
- Tcl_SetResult(interp, "arrow1", TCL_STATIC);
- break;
- case TOP_GAP:
- Tcl_SetResult(interp, "trough1", TCL_STATIC);
- break;
- case SLIDER:
- Tcl_SetResult(interp, "slider", TCL_STATIC);
- break;
- case BOTTOM_GAP:
- Tcl_SetResult(interp, "trough2", TCL_STATIC);
- break;
- case BOTTOM_ARROW:
- Tcl_SetResult(interp, "arrow2", TCL_STATIC);
- break;
+ case TOP_ARROW:
+ Tcl_SetResult(interp, "arrow1", TCL_STATIC);
+ break;
+ case TOP_GAP:
+ Tcl_SetResult(interp, "trough1", TCL_STATIC);
+ break;
+ case SLIDER:
+ Tcl_SetResult(interp, "slider", TCL_STATIC);
+ break;
+ case BOTTOM_GAP:
+ Tcl_SetResult(interp, "trough2", TCL_STATIC);
+ break;
+ case BOTTOM_ARROW:
+ Tcl_SetResult(interp, "arrow2", TCL_STATIC);
+ break;
}
} else if ((c == 's') && (strncmp(argv[1], "set", length) == 0)) {
int totalUnits, windowUnits, firstUnit, lastUnit;
@@ -487,8 +478,7 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " set firstFraction lastFraction\" or \"",
argv[0],
- " set totalUnits windowUnits firstUnit lastUnit\"",
- (char *) NULL);
+ " set totalUnits windowUnits firstUnit lastUnit\"", NULL);
goto error;
}
TkpComputeScrollbarGeometry(scrollPtr);
@@ -496,14 +486,15 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
"\": must be activate, cget, configure, delta, fraction, ",
- "get, identify, or set", (char *) NULL);
+ "get, identify, or set", NULL);
goto error;
}
- done:
+
+ done:
Tcl_Release((ClientData) scrollPtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) scrollPtr);
return TCL_ERROR;
}
@@ -513,32 +504,30 @@ ScrollbarWidgetCmd(clientData, interp, argc, argv)
*
* ConfigureScrollbar --
*
- * This procedure is called to process an argv/argc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a scrollbar widget.
+ * This function is called to process an argv/argc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a scrollbar
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for scrollPtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for scrollPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureScrollbar(interp, scrollPtr, argc, argv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- register TkScrollbar *scrollPtr; /* Information about widget; may or
- * may not already have values for
- * some fields. */
- int argc; /* Number of valid entries in argv. */
- CONST char **argv; /* Arguments. */
- int flags; /* Flags to pass to
- * Tk_ConfigureWidget. */
+ConfigureScrollbar(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register TkScrollbar *scrollPtr,
+ /* Information about widget; may or may not
+ * already have values for some fields. */
+ int argc, /* Number of valid entries in argv. */
+ CONST char **argv, /* Arguments. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, tkpScrollbarConfigSpecs,
argc, argv, (char *) scrollPtr, flags) != TCL_OK) {
@@ -546,12 +535,12 @@ ConfigureScrollbar(interp, scrollPtr, argc, argv, flags)
}
/*
- * A few options need special processing, such as setting the
- * background from a 3-D border.
+ * A few options need special processing, such as setting the background
+ * from a 3-D border.
*/
if (scrollPtr->command != NULL) {
- scrollPtr->commandSize = strlen(scrollPtr->command);
+ scrollPtr->commandSize = (int)strlen(scrollPtr->command);
} else {
scrollPtr->commandSize = 0;
}
@@ -563,10 +552,9 @@ ConfigureScrollbar(interp, scrollPtr, argc, argv, flags)
TkpConfigureScrollbar(scrollPtr);
/*
- * Register the desired geometry for the window (leave enough space
- * for the two arrows plus a minimum-size slider, plus border around
- * the whole window, if any). Then arrange for the window to be
- * redisplayed.
+ * Register the desired geometry for the window (leave enough space for
+ * the two arrows plus a minimum-size slider, plus border around the whole
+ * window, if any). Then arrange for the window to be redisplayed.
*/
TkpComputeScrollbarGeometry(scrollPtr);
@@ -579,23 +567,23 @@ ConfigureScrollbar(interp, scrollPtr, argc, argv, flags)
*
* TkScrollbarEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on scrollbars.
+ * This function is invoked by the Tk dispatcher for various events on
+ * scrollbars.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
void
-TkScrollbarEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+TkScrollbarEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
@@ -606,17 +594,16 @@ TkScrollbarEventProc(clientData, eventPtr)
if (scrollPtr->tkwin != NULL) {
scrollPtr->tkwin = NULL;
Tcl_DeleteCommandFromToken(scrollPtr->interp,
- scrollPtr->widgetCmd);
+ scrollPtr->widgetCmd);
}
if (scrollPtr->flags & REDRAW_PENDING) {
Tcl_CancelIdleCall(TkpDisplayScrollbar, (ClientData) scrollPtr);
}
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeOptions handle all the standard option-related
- * stuff.
+ * Free up all the stuff that requires special handling, then let
+ * Tk_FreeOptions handle all the standard option-related stuff.
*/
-
+
Tk_FreeOptions(tkpScrollbarConfigSpecs, (char *) scrollPtr,
scrollPtr->display, 0);
Tcl_EventuallyFree((ClientData) scrollPtr, TCL_DYNAMIC);
@@ -645,9 +632,9 @@ TkScrollbarEventProc(clientData, eventPtr)
*
* ScrollbarCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -659,17 +646,17 @@ TkScrollbarEventProc(clientData, eventPtr)
*/
static void
-ScrollbarCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+ScrollbarCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
Tk_Window tkwin = scrollPtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
if (tkwin != NULL) {
@@ -683,8 +670,7 @@ ScrollbarCmdDeletedProc(clientData)
*
* TkScrollbarEventuallyRedraw --
*
- * Arrange for one or more of the fields of a scrollbar
- * to be redrawn.
+ * Arrange for one or more of the fields of a scrollbar to be redrawn.
*
* Results:
* None.
@@ -696,8 +682,8 @@ ScrollbarCmdDeletedProc(clientData)
*/
void
-TkScrollbarEventuallyRedraw(scrollPtr)
- register TkScrollbar *scrollPtr; /* Information about widget. */
+TkScrollbarEventuallyRedraw(
+ TkScrollbar *scrollPtr) /* Information about widget. */
{
if ((scrollPtr->tkwin == NULL) || (!Tk_IsMapped(scrollPtr->tkwin))) {
return;
@@ -707,3 +693,11 @@ TkScrollbarEventuallyRedraw(scrollPtr)
scrollPtr->flags |= REDRAW_PENDING;
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h
index 6b7f2dc..e2890f4 100644
--- a/generic/tkScrollbar.h
+++ b/generic/tkScrollbar.h
@@ -1,13 +1,13 @@
/*
* tkScrollbar.h --
*
- * Declarations of types and functions used to implement
- * the scrollbar widget.
+ * Declarations of types and functions used to implement the scrollbar
+ * widget.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKSCROLLBAR
@@ -23,30 +23,29 @@
#endif
/*
- * A data structure of the following type is kept for each scrollbar
- * widget.
+ * A data structure of the following type is kept for each scrollbar widget.
*/
typedef struct TkScrollbar {
- Tk_Window tkwin; /* Window that embodies the scrollbar. NULL
+ Tk_Window tkwin; /* Window that embodies the scrollbar. NULL
* means that the window has been destroyed
* but the data structures haven't yet been
* cleaned up.*/
- Display *display; /* Display containing widget. Used, among
+ Display *display; /* Display containing widget. Used, among
* other things, so that resources can be
* freed even after tkwin has gone away. */
Tcl_Interp *interp; /* Interpreter associated with scrollbar. */
Tcl_Command widgetCmd; /* Token for scrollbar's widget command. */
int vertical; /* Non-zero means vertical orientation
* requested, zero means horizontal. */
- int width; /* Desired narrow dimension of scrollbar,
- * in pixels. */
+ int width; /* Desired narrow dimension of scrollbar, in
+ * pixels. */
char *command; /* Command prefix to use when invoking
- * scrolling commands. NULL means don't
- * invoke commands. Malloc'ed. */
+ * scrolling commands. NULL means don't invoke
+ * commands. Malloc'ed. */
int commandSize; /* Number of non-NULL bytes in command. */
- int repeatDelay; /* How long to wait before auto-repeating
- * on scrolling actions (in ms). */
+ int repeatDelay; /* How long to wait before auto-repeating on
+ * scrolling actions (in ms). */
int repeatInterval; /* Interval between autorepeats (in ms). */
int jump; /* Value of -jump option. */
@@ -62,60 +61,58 @@ typedef struct TkScrollbar {
XColor *troughColorPtr; /* Color for drawing trough. */
int relief; /* Indicates whether window as a whole is
* raised, sunken, or flat. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * <= 0 means don't draw a highlight. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. <= 0 means
+ * don't draw a highlight. */
XColor *highlightBgColorPtr;
- /* Color for drawing traversal highlight
- * area when highlight is off. */
+ /* Color for drawing traversal highlight area
+ * when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
int inset; /* Total width of all borders, including
* traversal highlight and 3-D border.
- * Indicates how much interior stuff must
- * be offset from outside edges to leave
- * room for borders. */
+ * Indicates how much interior stuff must be
+ * offset from outside edges to leave room for
+ * borders. */
int elementBorderWidth; /* Width of border to draw around elements
- * inside scrollbar (arrows and slider).
- * -1 means use borderWidth. */
+ * inside scrollbar (arrows and slider). -1
+ * means use borderWidth. */
int arrowLength; /* Length of arrows along long dimension of
* scrollbar, including space for a small gap
* between the arrow and the slider.
* Recomputed on window size changes. */
- int sliderFirst; /* Pixel coordinate of top or left edge
- * of slider area, including border. */
- int sliderLast; /* Coordinate of pixel just after bottom
- * or right edge of slider area, including
+ int sliderFirst; /* Pixel coordinate of top or left edge of
+ * slider area, including border. */
+ int sliderLast; /* Coordinate of pixel just after bottom or
+ * right edge of slider area, including
* border. */
int activeField; /* Names field to be displayed in active
- * colors, such as TOP_ARROW, or 0 for
- * no field. */
- int activeRelief; /* Value of -activeRelief option: relief
- * to use for active element. */
+ * colors, such as TOP_ARROW, or 0 for no
+ * field. */
+ int activeRelief; /* Value of -activeRelief option: relief to
+ * use for active element. */
/*
- * Information describing the application related to the scrollbar.
- * This information is provided by the application by invoking the
- * "set" widget command. This information can now be provided in
- * two ways: the "old" form (totalUnits, windowUnits, firstUnit,
- * and lastUnit), or the "new" form (firstFraction and lastFraction).
- * FirstFraction and lastFraction will always be valid, but
- * the old-style information is only valid if the NEW_STYLE_COMMANDS
- * flag is 0.
+ * Information describing the application related to the scrollbar. This
+ * information is provided by the application by invoking the "set" widget
+ * command. This information can now be provided in two ways: the "old"
+ * form (totalUnits, windowUnits, firstUnit, and lastUnit), or the "new"
+ * form (firstFraction and lastFraction). FirstFraction and lastFraction
+ * will always be valid, but the old-style information is only valid if
+ * the NEW_STYLE_COMMANDS flag is 0.
*/
- int totalUnits; /* Total dimension of application, in
- * units. Valid only if the NEW_STYLE_COMMANDS
- * flag isn't set. */
+ int totalUnits; /* Total dimension of application, in units.
+ * Valid only if the NEW_STYLE_COMMANDS flag
+ * isn't set. */
int windowUnits; /* Maximum number of units that can be
- * displayed in the window at once. Valid
- * only if the NEW_STYLE_COMMANDS flag isn't
- * set. */
+ * displayed in the window at once. Valid only
+ * if the NEW_STYLE_COMMANDS flag isn't set. */
int firstUnit; /* Number of last unit visible in
- * application's window. Valid only if the
+ * application's window. Valid only if the
* NEW_STYLE_COMMANDS flag isn't set. */
int lastUnit; /* Index of last unit visible in window.
- * Valid only if the NEW_STYLE_COMMANDS
- * flag isn't set. */
+ * Valid only if the NEW_STYLE_COMMANDS flag
+ * isn't set. */
double firstFraction; /* Position of first visible thing in window,
* specified as a fraction between 0 and
* 1.0. */
@@ -128,16 +125,16 @@ typedef struct TkScrollbar {
*/
Tk_Cursor cursor; /* Current cursor for window, or None. */
- char *takeFocus; /* Value of -takefocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
- int flags; /* Various flags; see below for
+ char *takeFocus; /* Value of -takefocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
+ int flags; /* Various flags; see below for
* definitions. */
} TkScrollbar;
/*
- * Legal values for "activeField" field of Scrollbar structures. These
- * are also the return values from the ScrollbarPosition procedure.
+ * Legal values for "activeField" field of Scrollbar structures. These are
+ * also the return values from the ScrollbarPosition function.
*/
#define OUTSIDE 0
@@ -149,14 +146,13 @@ typedef struct TkScrollbar {
/*
* Flag bits for scrollbars:
- *
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler
- * has already been queued to redraw
- * this window.
+ *
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
+ * already been queued to redraw this window.
* NEW_STYLE_COMMANDS: Non-zero means the new style of commands
- * should be used to communicate with the
- * widget: ".t yview scroll 2 lines", instead
- * of ".t yview 40", for example.
+ * should be used to communicate with the widget:
+ * ".t yview scroll 2 lines", instead of
+ * ".t yview 40", for example.
* GOT_FOCUS: Non-zero means this window has the input
* focus.
*/
@@ -166,37 +162,32 @@ typedef struct TkScrollbar {
#define GOT_FOCUS 4
/*
- * Declaration of scrollbar class procedures structure.
+ * Declaration of scrollbar class functions structure.
*/
-extern Tk_ClassProcs tkpScrollbarProcs;
+MODULE_SCOPE Tk_ClassProcs tkpScrollbarProcs;
/*
* Declaration of scrollbar configuration options.
*/
-extern Tk_ConfigSpec tkpScrollbarConfigSpecs[];
+MODULE_SCOPE Tk_ConfigSpec tkpScrollbarConfigSpecs[];
/*
- * Declaration of procedures used in the implementation of the scrollbar
- * widget.
+ * Declaration of functions used in the implementation of the scrollbar
+ * widget.
*/
-EXTERN void TkScrollbarEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-EXTERN void TkScrollbarEventuallyRedraw _ANSI_ARGS_((
- TkScrollbar *scrollPtr));
-EXTERN void TkpComputeScrollbarGeometry _ANSI_ARGS_((
- TkScrollbar *scrollPtr));
-EXTERN TkScrollbar * TkpCreateScrollbar _ANSI_ARGS_((Tk_Window tkwin));
-EXTERN void TkpDestroyScrollbar _ANSI_ARGS_((
- TkScrollbar *scrollPtr));
-EXTERN void TkpDisplayScrollbar _ANSI_ARGS_((
- ClientData clientData));
-EXTERN void TkpConfigureScrollbar _ANSI_ARGS_((
- TkScrollbar *scrollPtr));
-EXTERN int TkpScrollbarPosition _ANSI_ARGS_((
- TkScrollbar *scrollPtr, int x, int y));
+MODULE_SCOPE void TkScrollbarEventProc(ClientData clientData,
+ XEvent *eventPtr);
+MODULE_SCOPE void TkScrollbarEventuallyRedraw(TkScrollbar *scrollPtr);
+MODULE_SCOPE void TkpComputeScrollbarGeometry(TkScrollbar *scrollPtr);
+MODULE_SCOPE TkScrollbar *TkpCreateScrollbar(Tk_Window tkwin);
+MODULE_SCOPE void TkpDestroyScrollbar(TkScrollbar *scrollPtr);
+MODULE_SCOPE void TkpDisplayScrollbar(ClientData clientData);
+MODULE_SCOPE void TkpConfigureScrollbar(TkScrollbar *scrollPtr);
+MODULE_SCOPE int TkpScrollbarPosition(TkScrollbar *scrollPtr,
+ int x, int y);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 2ac3424..7c96b94 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -1,24 +1,23 @@
-/*
+/*
* tkSelect.c --
*
- * This file manages the selection for the Tk toolkit,
- * translating between the standard X ICCCM conventions
- * and Tcl commands.
+ * This file manages the selection for the Tk toolkit, translating
+ * between the standard X ICCCM conventions and Tcl commands.
*
* Copyright (c) 1990-1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
#include "tkSelect.h"
/*
- * When a selection handler is set up by invoking "selection handle",
- * one of the following data structures is set up to hold information
- * about the command to invoke and its interpreter.
+ * When a selection handler is set up by invoking "selection handle", one of
+ * the following data structures is set up to hold information about the
+ * command to invoke and its interpreter.
*/
typedef struct {
@@ -28,109 +27,105 @@ typedef struct {
int byteOffset; /* The expected byte offset of the next
* chunk. */
char buffer[TCL_UTF_MAX]; /* A buffer to hold part of a UTF character
- * that is split across chunks.*/
- char command[4]; /* Command to invoke. Actual space is
- * allocated as large as necessary. This
- * must be the last entry in the structure. */
+ * that is split across chunks. */
+ char command[4]; /* Command to invoke. Actual space is
+ * allocated as large as necessary. This must
+ * be the last entry in the structure. */
} CommandInfo;
/*
* When selection ownership is claimed with the "selection own" Tcl command,
- * one of the following structures is created to record the Tcl command
- * to be executed when the selection is lost again.
+ * one of the following structures is created to record the Tcl command to be
+ * executed when the selection is lost again.
*/
typedef struct LostCommand {
Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[4]; /* Command to invoke. Actual space is
- * allocated as large as necessary. This
- * must be the last entry in the structure. */
+ char command[4]; /* Command to invoke. Actual space is
+ * allocated as large as necessary. This must
+ * be the last entry in the structure. */
} LostCommand;
/*
- * The structure below is used to keep each thread's pending list
- * separate.
+ * The structure below is used to keep each thread's pending list separate.
*/
typedef struct ThreadSpecificData {
TkSelInProgress *pendingPtr;
- /* Topmost search in progress, or
- * NULL if none. */
+ /* Topmost search in progress, or NULL if
+ * none. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static int HandleTclCommand _ANSI_ARGS_((ClientData clientData,
- int offset, char *buffer, int maxBytes));
-static void LostSelection _ANSI_ARGS_((ClientData clientData));
-static int SelGetProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, char *portion));
+static int HandleTclCommand(ClientData clientData,
+ int offset, char *buffer, int maxBytes);
+static void LostSelection(ClientData clientData);
+static int SelGetProc(ClientData clientData,
+ Tcl_Interp *interp, char *portion);
/*
*--------------------------------------------------------------
*
* Tk_CreateSelHandler --
*
- * This procedure is called to register a procedure
- * as the handler for selection requests of a particular
- * target type on a particular window for a particular
- * selection.
+ * This function is called to register a function as the handler for
+ * selection requests of a particular target type on a particular window
+ * for a particular selection.
*
* Results:
* None.
*
* Side effects:
- * In the future, whenever the selection is in tkwin's
- * window and someone requests the selection in the
- * form given by target, proc will be invoked to provide
- * part or all of the selection in the given form. If
- * there was already a handler declared for the given
- * window, target and selection type, then it is replaced.
- * Proc should have the following form:
+
+ * In the future, whenever the selection is in tkwin's window and someone
+ * requests the selection in the form given by target, proc will be
+ * invoked to provide part or all of the selection in the given form. If
+ * there was already a handler declared for the given window, target and
+ * selection type, then it is replaced. Proc should have the following
+ * form:
*
* int
- * proc(clientData, offset, buffer, maxBytes)
- * ClientData clientData;
- * int offset;
- * char *buffer;
- * int maxBytes;
+ * proc(
+ * ClientData clientData,
+ * int offset,
+ * char *buffer,
+ * int maxBytes)
* {
* }
*
- * The clientData argument to proc will be the same as
- * the clientData argument to this procedure. The offset
- * argument indicates which portion of the selection to
- * return: skip the first offset bytes. Buffer is a
- * pointer to an area in which to place the converted
- * selection, and maxBytes gives the number of bytes
- * available at buffer. Proc should place the selection
- * in buffer as a string, and return a count of the number
- * of bytes of selection actually placed in buffer (not
- * including the terminating NULL character). If the
- * return value equals maxBytes, this is a sign that there
- * is probably still more selection information available.
+ * The clientData argument to proc will be the same as the clientData
+ * argument to this function. The offset argument indicates which portion
+ * of the selection to return: skip the first offset bytes. Buffer is a
+ * pointer to an area in which to place the converted selection, and
+ * maxBytes gives the number of bytes available at buffer. Proc should
+ * place the selection in buffer as a string, and return a count of the
+ * number of bytes of selection actually placed in buffer (not including
+ * the terminating NULL character). If the return value equals maxBytes,
+ * this is a sign that there is probably still more selection information
+ * available.
*
*--------------------------------------------------------------
*/
void
-Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
- Tk_Window tkwin; /* Token for window. */
- Atom selection; /* Selection to be handled. */
- Atom target; /* The kind of selection conversions
- * that can be handled by proc,
- * e.g. TARGETS or STRING. */
- Tk_SelectionProc *proc; /* Procedure to invoke to convert
- * selection to type "target". */
- ClientData clientData; /* Value to pass to proc. */
- Atom format; /* Format in which the selection
- * information should be returned to
- * the requestor. XA_STRING is best by
- * far, but anything listed in the ICCCM
- * will be tolerated (blech). */
+Tk_CreateSelHandler(
+ Tk_Window tkwin, /* Token for window. */
+ Atom selection, /* Selection to be handled. */
+ Atom target, /* The kind of selection conversions that can
+ * be handled by proc, e.g. TARGETS or
+ * STRING. */
+ Tk_SelectionProc *proc, /* Function to invoke to convert selection to
+ * type "target". */
+ ClientData clientData, /* Value to pass to proc. */
+ Atom format) /* Format in which the selection information
+ * should be returned to the requestor.
+ * XA_STRING is best by far, but anything
+ * listed in the ICCCM will be tolerated
+ * (blech). */
{
register TkSelHandler *selPtr;
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -140,8 +135,8 @@ Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
}
/*
- * See if there's already a handler for this target and selection on
- * this window. If so, re-use it. If not, create a new one.
+ * See if there's already a handler for this target and selection on this
+ * window. If so, re-use it. If not, create a new one.
*/
for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
@@ -152,11 +147,10 @@ Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
break;
}
if ((selPtr->selection == selection) && (selPtr->target == target)) {
-
/*
- * Special case: when replacing handler created by
- * "selection handle", free up memory. Should there be a
- * callback to allow other clients to do this too?
+ * Special case: when replacing handler created by "selection
+ * handle", free up memory. Should there be a callback to allow
+ * other clients to do this too?
*/
if (selPtr->proc == HandleTclCommand) {
@@ -176,15 +170,14 @@ Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
selPtr->size = 32;
}
- if ((target == XA_STRING) && (winPtr->dispPtr->utf8Atom != (Atom) NULL)) {
+ if ((target == XA_STRING) && (winPtr->dispPtr->utf8Atom != (Atom) 0)) {
/*
* If the user asked for a STRING handler and we understand
* UTF8_STRING, we implicitly create a UTF8_STRING handler for them.
*/
target = winPtr->dispPtr->utf8Atom;
- for (selPtr = winPtr->selHandlerList; ;
- selPtr = selPtr->nextPtr) {
+ for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
selPtr = (TkSelHandler *) ckalloc(sizeof(TkSelHandler));
selPtr->nextPtr = winPtr->selHandlerList;
@@ -195,11 +188,13 @@ Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
selPtr->proc = proc;
if (selPtr->proc == HandleTclCommand) {
/*
- * The clientData is selection controlled memory, so
- * we should make a copy for this selPtr.
+ * The clientData is selection controlled memory, so we
+ * should make a copy for this selPtr.
*/
- unsigned cmdInfoLen = sizeof(CommandInfo) +
+
+ unsigned cmdInfoLen = sizeof(CommandInfo) +
((CommandInfo*)clientData)->cmdLength - 3;
+
selPtr->clientData = (ClientData)ckalloc(cmdInfoLen);
memcpy(selPtr->clientData, clientData, cmdInfoLen);
} else {
@@ -208,10 +203,9 @@ Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
selPtr->size = 8;
break;
}
- if ((selPtr->selection == selection)
- && (selPtr->target == target)) {
+ if (selPtr->selection==selection && selPtr->target==target) {
/*
- * Looks like we had a utf-8 target already. Leave it alone.
+ * Looks like we had a utf-8 target already. Leave it alone.
*/
break;
@@ -232,30 +226,30 @@ Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
* None.
*
* Side effects:
- * The selection handler for tkwin and target is removed. If there
- * is no such handler then nothing happens.
+ * The selection handler for tkwin and target is removed. If there is no
+ * such handler then nothing happens.
*
*----------------------------------------------------------------------
*/
void
-Tk_DeleteSelHandler(tkwin, selection, target)
- Tk_Window tkwin; /* Token for window. */
- Atom selection; /* The selection whose handler
- * is to be removed. */
- Atom target; /* The target whose selection
- * handler is to be removed. */
+Tk_DeleteSelHandler(
+ Tk_Window tkwin, /* Token for window. */
+ Atom selection, /* The selection whose handler is to be
+ * removed. */
+ Atom target) /* The target whose selection handler is to be
+ * removed. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
register TkSelHandler *selPtr, *prevPtr;
register TkSelInProgress *ipPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Find the selection handler to be deleted, or return if it doesn't
* exist.
- */
+ */
for (selPtr = winPtr->selHandlerList, prevPtr = NULL; ;
prevPtr = selPtr, selPtr = selPtr->nextPtr) {
@@ -272,8 +266,8 @@ Tk_DeleteSelHandler(tkwin, selection, target)
* handler is dead.
*/
- for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL;
- ipPtr = ipPtr->nextPtr) {
+ for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL;
+ ipPtr = ipPtr->nextPtr) {
if (ipPtr->selPtr == selPtr) {
ipPtr->selPtr = NULL;
}
@@ -289,17 +283,18 @@ Tk_DeleteSelHandler(tkwin, selection, target)
prevPtr->nextPtr = selPtr->nextPtr;
}
- if ((target == XA_STRING) && (winPtr->dispPtr->utf8Atom != (Atom) NULL)) {
+ if ((target == XA_STRING) && (winPtr->dispPtr->utf8Atom != (Atom) 0)) {
/*
* If the user asked for a STRING handler and we understand
* UTF8_STRING, we may have implicitly created a UTF8_STRING handler
- * for them. Look for it and delete it as necessary.
+ * for them. Look for it and delete it as necessary.
*/
+
TkSelHandler *utf8selPtr;
target = winPtr->dispPtr->utf8Atom;
for (utf8selPtr = winPtr->selHandlerList; utf8selPtr != NULL;
- utf8selPtr = utf8selPtr->nextPtr) {
+ utf8selPtr = utf8selPtr->nextPtr) {
if ((utf8selPtr->selection == selection)
&& (utf8selPtr->target == target)) {
break;
@@ -310,9 +305,10 @@ Tk_DeleteSelHandler(tkwin, selection, target)
&& (utf8selPtr->proc == selPtr->proc)
&& (utf8selPtr->size == selPtr->size)) {
/*
- * This recursive call is OK, because we've
- * changed the value of 'target'
+ * This recursive call is OK, because we've changed the value
+ * of 'target'.
*/
+
Tk_DeleteSelHandler(tkwin, selection, target);
}
}
@@ -340,49 +336,45 @@ Tk_DeleteSelHandler(tkwin, selection, target)
* None.
*
* Side effects:
- * From now on, requests for the selection will be directed
- * to procedures associated with tkwin (they must have been
- * declared with calls to Tk_CreateSelHandler). When the
- * selection is lost by this window, proc will be invoked
- * (see the manual entry for details). This procedure may
- * invoke callbacks, including Tcl scripts, so any calling
- * function should be reentrant at the point where
- * Tk_OwnSelection is invoked.
+ * From now on, requests for the selection will be directed to functions
+ * associated with tkwin (they must have been declared with calls to
+ * Tk_CreateSelHandler). When the selection is lost by this window, proc
+ * will be invoked (see the manual entry for details). This function may
+ * invoke callbacks, including Tcl scripts, so any calling function
+ * should be reentrant at the point where Tk_OwnSelection is invoked.
*
*--------------------------------------------------------------
*/
void
-Tk_OwnSelection(tkwin, selection, proc, clientData)
- Tk_Window tkwin; /* Window to become new selection
- * owner. */
- Atom selection; /* Selection that window should own. */
- Tk_LostSelProc *proc; /* Procedure to call when selection
- * is taken away from tkwin. */
- ClientData clientData; /* Arbitrary one-word argument to
- * pass to proc. */
+Tk_OwnSelection(
+ Tk_Window tkwin, /* Window to become new selection owner. */
+ Atom selection, /* Selection that window should own. */
+ Tk_LostSelProc *proc, /* Function to call when selection is taken
+ * away from tkwin. */
+ ClientData clientData) /* Arbitrary one-word argument to pass to
+ * proc. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
Tk_LostSelProc *clearProc = NULL;
- ClientData clearData = NULL; /* Initialization needed only to
- * prevent compiler warning. */
-
-
+ ClientData clearData = NULL;/* Initialization needed only to prevent
+ * compiler warning. */
+
if (dispPtr->multipleAtom == None) {
TkSelInit(tkwin);
}
Tk_MakeWindowExist(tkwin);
/*
- * This code is somewhat tricky. First, we find the specified selection
- * on the selection list. If the previous owner is in this process, and
- * is a different window, then we need to invoke the clearProc. However,
- * it's dangerous to call the clearProc right now, because it could
- * invoke a Tcl script that wrecks the current state (e.g. it could
- * delete the window). To be safe, defer the call until the end of the
- * procedure when we no longer care about the state.
+ * This code is somewhat tricky. First, we find the specified selection on
+ * the selection list. If the previous owner is in this process, and is a
+ * different window, then we need to invoke the clearProc. However, it's
+ * dangerous to call the clearProc right now, because it could invoke a
+ * Tcl script that wrecks the current state (e.g. it could delete the
+ * window). To be safe, defer the call until the end of the function when
+ * we no longer care about the state.
*/
for (infoPtr = dispPtr->selectionInfoPtr; infoPtr != NULL;
@@ -402,9 +394,9 @@ Tk_OwnSelection(tkwin, selection, proc, clientData)
clearData = infoPtr->clearData;
} else if (infoPtr->clearProc == LostSelection) {
/*
- * If the selection handler is one created by "selection own",
- * be sure to free the record for it; otherwise there will be
- * a memory leak.
+ * If the selection handler is one created by "selection own", be
+ * sure to free the record for it; otherwise there will be a
+ * memory leak.
*/
ckfree((char *) infoPtr->clearData);
@@ -417,10 +409,10 @@ Tk_OwnSelection(tkwin, selection, proc, clientData)
infoPtr->clearData = clientData;
/*
- * Note that we are using CurrentTime, even though ICCCM recommends against
- * this practice (the problem is that we don't necessarily have a valid
- * time to use). We will not be able to retrieve a useful timestamp for
- * the TIMESTAMP target later.
+ * Note that we are using CurrentTime, even though ICCCM recommends
+ * against this practice (the problem is that we don't necessarily have a
+ * valid time to use). We will not be able to retrieve a useful timestamp
+ * for the TIMESTAMP target later.
*/
infoPtr->time = CurrentTime;
@@ -456,18 +448,19 @@ Tk_OwnSelection(tkwin, selection, proc, clientData)
* None.
*
* Side effects:
- * The specified selection is cleared, so that future requests to retrieve
- * it will fail until some application owns it again. This procedure
- * invokes callbacks, possibly including Tcl scripts, so any calling
- * function should be reentrant at the point Tk_ClearSelection is invoked.
+ * The specified selection is cleared, so that future requests to
+ * retrieve it will fail until some application owns it again. This
+ * function invokes callbacks, possibly including Tcl scripts, so any
+ * calling function should be reentrant at the point Tk_ClearSelection is
+ * invoked.
*
*----------------------------------------------------------------------
*/
void
-Tk_ClearSelection(tkwin, selection)
- Tk_Window tkwin; /* Window that selects a display. */
- Atom selection; /* Selection to be cancelled. */
+Tk_ClearSelection(
+ Tk_Window tkwin, /* Window that selects a display. */
+ Atom selection) /* Selection to be cancelled. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -475,15 +468,15 @@ Tk_ClearSelection(tkwin, selection)
TkSelectionInfo *prevPtr;
TkSelectionInfo *nextPtr;
Tk_LostSelProc *clearProc = NULL;
- ClientData clearData = NULL; /* Initialization needed only to
- * prevent compiler warning. */
+ ClientData clearData = NULL;/* Initialization needed only to prevent
+ * compiler warning. */
if (dispPtr->multipleAtom == None) {
TkSelInit(tkwin);
}
for (infoPtr = dispPtr->selectionInfoPtr, prevPtr = NULL;
- infoPtr != NULL; infoPtr = nextPtr) {
+ infoPtr != NULL; infoPtr = nextPtr) {
nextPtr = infoPtr->nextPtr;
if (infoPtr->selection == selection) {
if (prevPtr == NULL) {
@@ -495,7 +488,7 @@ Tk_ClearSelection(tkwin, selection)
}
prevPtr = infoPtr;
}
-
+
if (infoPtr != NULL) {
clearProc = infoPtr->clearProc;
clearData = infoPtr->clearData;
@@ -513,80 +506,77 @@ Tk_ClearSelection(tkwin, selection)
*
* Tk_GetSelection --
*
- * Retrieve the value of a selection and pass it off (in
- * pieces, possibly) to a given procedure.
+ * Retrieve the value of a selection and pass it off (in pieces,
+ * possibly) to a given function.
*
* Results:
- * The return value is a standard Tcl return value.
- * If an error occurs (such as no selection exists)
- * then an error message is left in the interp's result.
+ * The return value is a standard Tcl return value. If an error occurs
+ * (such as no selection exists) then an error message is left in the
+ * interp's result.
*
* Side effects:
- * The standard X11 protocols are used to retrieve the
- * selection. When it arrives, it is passed to proc. If
- * the selection is very large, it will be passed to proc
- * in several pieces. Proc should have the following
+ * The standard X11 protocols are used to retrieve the selection. When it
+ * arrives, it is passed to proc. If the selection is very large, it will
+ * be passed to proc in several pieces. Proc should have the following
* structure:
*
* int
- * proc(clientData, interp, portion)
- * ClientData clientData;
- * Tcl_Interp *interp;
- * char *portion;
+ * proc(
+ * ClientData clientData,
+ * Tcl_Interp *interp,
+ * char *portion)
* {
* }
*
- * The interp and clientData arguments to proc will be the
- * same as the corresponding arguments to Tk_GetSelection.
- * The portion argument points to a character string
- * containing part of the selection, and numBytes indicates
- * the length of the portion, not including the terminating
- * NULL character. If the selection arrives in several pieces,
- * the "portion" arguments in separate calls will contain
- * successive parts of the selection. Proc should normally
- * return TCL_OK. If it detects an error then it should return
- * TCL_ERROR and leave an error message in the interp's result; the
- * remainder of the selection retrieval will be aborted.
+ * The interp and clientData arguments to proc will be the same as the
+ * corresponding arguments to Tk_GetSelection. The portion argument
+ * points to a character string containing part of the selection, and
+ * numBytes indicates the length of the portion, not including the
+ * terminating NULL character. If the selection arrives in several
+ * pieces, the "portion" arguments in separate calls will contain
+ * successive parts of the selection. Proc should normally return TCL_OK.
+ * If it detects an error then it should return TCL_ERROR and leave an
+ * error message in the interp's result; the remainder of the selection
+ * retrieval will be aborted.
*
*--------------------------------------------------------------
*/
int
-Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
- Tcl_Interp *interp; /* Interpreter to use for reporting
- * errors. */
- Tk_Window tkwin; /* Window on whose behalf to retrieve
- * the selection (determines display
- * from which to retrieve). */
- Atom selection; /* Selection to retrieve. */
- Atom target; /* Desired form in which selection
- * is to be returned. */
- Tk_GetSelProc *proc; /* Procedure to call to process the
- * selection, once it has been retrieved. */
- ClientData clientData; /* Arbitrary value to pass to proc. */
+Tk_GetSelection(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tk_Window tkwin, /* Window on whose behalf to retrieve the
+ * selection (determines display from which to
+ * retrieve). */
+ Atom selection, /* Selection to retrieve. */
+ Atom target, /* Desired form in which selection is to be
+ * returned. */
+ Tk_GetSelProc *proc, /* Function to call to process the selection,
+ * once it has been retrieved. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (dispPtr->multipleAtom == None) {
TkSelInit(tkwin);
}
/*
- * If the selection is owned by a window managed by this
- * process, then call the retrieval procedure directly,
- * rather than going through the X server (it's dangerous
- * to go through the X server in this case because it could
- * result in deadlock if an INCR-style selection results).
+ * If the selection is owned by a window managed by this process, then
+ * call the retrieval function directly, rather than going through the X
+ * server (it's dangerous to go through the X server in this case because
+ * it could result in deadlock if an INCR-style selection results).
*/
for (infoPtr = dispPtr->selectionInfoPtr; infoPtr != NULL;
infoPtr = infoPtr->nextPtr) {
- if (infoPtr->selection == selection)
+ if (infoPtr->selection == selection) {
break;
+ }
}
if (infoPtr != NULL) {
register TkSelHandler *selPtr;
@@ -595,9 +585,8 @@ Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
TkSelInProgress ip;
for (selPtr = ((TkWindow *) infoPtr->owner)->selHandlerList;
- selPtr != NULL; selPtr = selPtr->nextPtr) {
- if ((selPtr->target == target)
- && (selPtr->selection == selection)) {
+ selPtr != NULL; selPtr = selPtr->nextPtr) {
+ if (selPtr->target==target && selPtr->selection==selection) {
break;
}
}
@@ -607,7 +596,7 @@ Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
count = TkSelDefaultSelection(infoPtr, target, buffer,
TK_SEL_BYTES_AT_ONCE, &type);
if (count > TK_SEL_BYTES_AT_ONCE) {
- panic("selection handler returned too many bytes");
+ Tcl_Panic("selection handler returned too many bytes");
}
if (count < 0) {
goto cantget;
@@ -628,7 +617,7 @@ Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
goto cantget;
}
if (count > TK_SEL_BYTES_AT_ONCE) {
- panic("selection handler returned too many bytes");
+ Tcl_Panic("selection handler returned too many bytes");
}
buffer[count] = '\0';
result = (*proc)(clientData, interp, buffer);
@@ -650,10 +639,10 @@ Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
return TkSelGetSelection(interp, tkwin, selection, target, proc,
clientData);
- cantget:
+ cantget:
Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
- " selection doesn't exist or form \"", Tk_GetAtomName(tkwin, target),
- "\" not defined", (char *) NULL);
+ " selection doesn't exist or form \"",
+ Tk_GetAtomName(tkwin, target), "\" not defined", NULL);
return TCL_ERROR;
}
@@ -662,9 +651,8 @@ Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
*
* Tk_SelectionObjCmd --
*
- * This procedure is invoked to process the "selection" Tcl
- * command. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "selection" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -676,12 +664,12 @@ Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
*/
int
-Tk_SelectionObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
+Tk_SelectionObjCmd(
+ ClientData clientData, /* Main window associated with
* interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
char *path = NULL;
@@ -690,11 +678,12 @@ Tk_SelectionObjCmd(clientData, interp, objc, objv)
int count, index;
Tcl_Obj **objs;
static CONST char *optionStrings[] = {
- "clear", "get", "handle", "own", (char *) NULL
+ "clear", "get", "handle", "own", NULL
};
- enum options { SELECTION_CLEAR, SELECTION_GET, SELECTION_HANDLE,
- SELECTION_OWN };
-
+ enum options {
+ SELECTION_CLEAR, SELECTION_GET, SELECTION_HANDLE, SELECTION_OWN
+ };
+
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
return TCL_ERROR;
@@ -706,319 +695,323 @@ Tk_SelectionObjCmd(clientData, interp, objc, objv)
}
switch ((enum options) index) {
- case SELECTION_CLEAR: {
- static CONST char *clearOptionStrings[] = {
- "-displayof", "-selection", (char *) NULL
- };
- enum clearOptions { CLEAR_DISPLAYOF, CLEAR_SELECTION };
- int clearIndex;
-
- for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count > 0;
- count-=2, objs+=2) {
- string = Tcl_GetString(objs[0]);
- if (string[0] != '-') {
- break;
- }
- if (count < 2) {
- Tcl_AppendResult(interp, "value for \"", string,
- "\" missing", (char *) NULL);
- return TCL_ERROR;
- }
-
- if (Tcl_GetIndexFromObj(interp, objs[0], clearOptionStrings,
- "option", 0, &clearIndex) != TCL_OK) {
- return TCL_ERROR;
- }
- switch ((enum clearOptions) clearIndex) {
- case CLEAR_DISPLAYOF:
- path = Tcl_GetString(objs[1]);
- break;
- case CLEAR_SELECTION:
- selName = Tcl_GetString(objs[1]);
- break;
- }
+ case SELECTION_CLEAR: {
+ static CONST char *clearOptionStrings[] = {
+ "-displayof", "-selection", NULL
+ };
+ enum clearOptions { CLEAR_DISPLAYOF, CLEAR_SELECTION };
+ int clearIndex;
+
+ for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count > 0;
+ count-=2, objs+=2) {
+ string = Tcl_GetString(objs[0]);
+ if (string[0] != '-') {
+ break;
}
- if (count == 1) {
- path = Tcl_GetString(objs[0]);
- } else if (count > 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "?options?");
+ if (count < 2) {
+ Tcl_AppendResult(interp, "value for \"", string,
+ "\" missing", NULL);
return TCL_ERROR;
}
- if (path != NULL) {
- tkwin = Tk_NameToWindow(interp, path, tkwin);
- }
- if (tkwin == NULL) {
+
+ if (Tcl_GetIndexFromObj(interp, objs[0], clearOptionStrings,
+ "option", 0, &clearIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (selName != NULL) {
- selection = Tk_InternAtom(tkwin, selName);
- } else {
- selection = XA_PRIMARY;
+ switch ((enum clearOptions) clearIndex) {
+ case CLEAR_DISPLAYOF:
+ path = Tcl_GetString(objs[1]);
+ break;
+ case CLEAR_SELECTION:
+ selName = Tcl_GetString(objs[1]);
+ break;
}
-
- Tk_ClearSelection(tkwin, selection);
- break;
}
- case SELECTION_GET: {
- Atom target;
- char *targetName = NULL;
- Tcl_DString selBytes;
- int result;
- static CONST char *getOptionStrings[] = {
- "-displayof", "-selection", "-type", (char *) NULL
- };
- enum getOptions { GET_DISPLAYOF, GET_SELECTION, GET_TYPE };
- int getIndex;
-
- for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count>0;
- count-=2, objs+=2) {
- string = Tcl_GetString(objs[0]);
- if (string[0] != '-') {
- break;
- }
- if (count < 2) {
- Tcl_AppendResult(interp, "value for \"", string,
- "\" missing", (char *) NULL);
- return TCL_ERROR;
- }
-
- if (Tcl_GetIndexFromObj(interp, objs[0], getOptionStrings,
- "option", 0, &getIndex) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (count == 1) {
+ path = Tcl_GetString(objs[0]);
+ } else if (count > 1) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?options?");
+ return TCL_ERROR;
+ }
+ if (path != NULL) {
+ tkwin = Tk_NameToWindow(interp, path, tkwin);
+ }
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ if (selName != NULL) {
+ selection = Tk_InternAtom(tkwin, selName);
+ } else {
+ selection = XA_PRIMARY;
+ }
- switch ((enum getOptions) getIndex) {
- case GET_DISPLAYOF:
- path = Tcl_GetString(objs[1]);
- break;
- case GET_SELECTION:
- selName = Tcl_GetString(objs[1]);
- break;
- case GET_TYPE:
- targetName = Tcl_GetString(objs[1]);
- break;
- }
- }
- if (path != NULL) {
- tkwin = Tk_NameToWindow(interp, path, tkwin);
+ Tk_ClearSelection(tkwin, selection);
+ break;
+ }
+
+ case SELECTION_GET: {
+ Atom target;
+ char *targetName = NULL;
+ Tcl_DString selBytes;
+ int result;
+ static CONST char *getOptionStrings[] = {
+ "-displayof", "-selection", "-type", NULL
+ };
+ enum getOptions { GET_DISPLAYOF, GET_SELECTION, GET_TYPE };
+ int getIndex;
+
+ for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count>0;
+ count-=2, objs+=2) {
+ string = Tcl_GetString(objs[0]);
+ if (string[0] != '-') {
+ break;
}
- if (tkwin == NULL) {
+ if (count < 2) {
+ Tcl_AppendResult(interp, "value for \"", string,
+ "\" missing", NULL);
return TCL_ERROR;
}
- if (selName != NULL) {
- selection = Tk_InternAtom(tkwin, selName);
- } else {
- selection = XA_PRIMARY;
- }
- if (count > 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "?options?");
+
+ if (Tcl_GetIndexFromObj(interp, objs[0], getOptionStrings,
+ "option", 0, &getIndex) != TCL_OK) {
return TCL_ERROR;
- } else if (count == 1) {
- target = Tk_InternAtom(tkwin, Tcl_GetString(objs[0]));
- } else if (targetName != NULL) {
- target = Tk_InternAtom(tkwin, targetName);
- } else {
- target = XA_STRING;
}
- Tcl_DStringInit(&selBytes);
- result = Tk_GetSelection(interp, tkwin, selection, target,
- SelGetProc, (ClientData) &selBytes);
- if (result == TCL_OK) {
- Tcl_DStringResult(interp, &selBytes);
- } else {
- Tcl_DStringFree(&selBytes);
+ switch ((enum getOptions) getIndex) {
+ case GET_DISPLAYOF:
+ path = Tcl_GetString(objs[1]);
+ break;
+ case GET_SELECTION:
+ selName = Tcl_GetString(objs[1]);
+ break;
+ case GET_TYPE:
+ targetName = Tcl_GetString(objs[1]);
+ break;
}
- return result;
}
- case SELECTION_HANDLE: {
- Atom target, format;
- char *targetName = NULL;
- char *formatName = NULL;
- register CommandInfo *cmdInfoPtr;
- int cmdLength;
- static CONST char *handleOptionStrings[] = {
- "-format", "-selection", "-type", (char *) NULL
- };
- enum handleOptions { HANDLE_FORMAT, HANDLE_SELECTION,
- HANDLE_TYPE };
- int handleIndex;
-
- for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count > 0;
- count-=2, objs+=2) {
- string = Tcl_GetString(objs[0]);
- if (string[0] != '-') {
- break;
- }
- if (count < 2) {
- Tcl_AppendResult(interp, "value for \"", string,
- "\" missing", (char *) NULL);
- return TCL_ERROR;
- }
+ if (path != NULL) {
+ tkwin = Tk_NameToWindow(interp, path, tkwin);
+ }
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ if (selName != NULL) {
+ selection = Tk_InternAtom(tkwin, selName);
+ } else {
+ selection = XA_PRIMARY;
+ }
+ if (count > 1) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?options?");
+ return TCL_ERROR;
+ } else if (count == 1) {
+ target = Tk_InternAtom(tkwin, Tcl_GetString(objs[0]));
+ } else if (targetName != NULL) {
+ target = Tk_InternAtom(tkwin, targetName);
+ } else {
+ target = XA_STRING;
+ }
- if (Tcl_GetIndexFromObj(interp, objs[0],handleOptionStrings,
- "option", 0, &handleIndex) != TCL_OK) {
- return TCL_ERROR;
- }
+ Tcl_DStringInit(&selBytes);
+ result = Tk_GetSelection(interp, tkwin, selection, target,
+ SelGetProc, (ClientData) &selBytes);
+ if (result == TCL_OK) {
+ Tcl_DStringResult(interp, &selBytes);
+ } else {
+ Tcl_DStringFree(&selBytes);
+ }
+ return result;
+ }
- switch ((enum handleOptions) handleIndex) {
- case HANDLE_FORMAT:
- formatName = Tcl_GetString(objs[1]);
- break;
- case HANDLE_SELECTION:
- selName = Tcl_GetString(objs[1]);
- break;
- case HANDLE_TYPE:
- targetName = Tcl_GetString(objs[1]);
- break;
- }
+ case SELECTION_HANDLE: {
+ Atom target, format;
+ char *targetName = NULL;
+ char *formatName = NULL;
+ register CommandInfo *cmdInfoPtr;
+ int cmdLength;
+ static CONST char *handleOptionStrings[] = {
+ "-format", "-selection", "-type", NULL
+ };
+ enum handleOptions {
+ HANDLE_FORMAT, HANDLE_SELECTION, HANDLE_TYPE
+ };
+ int handleIndex;
+
+ for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count > 0;
+ count-=2, objs+=2) {
+ string = Tcl_GetString(objs[0]);
+ if (string[0] != '-') {
+ break;
}
-
- if ((count < 2) || (count > 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "?options? window command");
+ if (count < 2) {
+ Tcl_AppendResult(interp, "value for \"", string,
+ "\" missing", NULL);
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objs[0]), tkwin);
- if (tkwin == NULL) {
+
+ if (Tcl_GetIndexFromObj(interp, objs[0],handleOptionStrings,
+ "option", 0, &handleIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (selName != NULL) {
- selection = Tk_InternAtom(tkwin, selName);
- } else {
- selection = XA_PRIMARY;
- }
-
- if (count > 2) {
- target = Tk_InternAtom(tkwin, Tcl_GetString(objs[2]));
- } else if (targetName != NULL) {
- target = Tk_InternAtom(tkwin, targetName);
- } else {
- target = XA_STRING;
- }
- if (count > 3) {
- format = Tk_InternAtom(tkwin, Tcl_GetString(objs[3]));
- } else if (formatName != NULL) {
- format = Tk_InternAtom(tkwin, formatName);
- } else {
- format = XA_STRING;
- }
- string = Tcl_GetStringFromObj(objs[1], &cmdLength);
- if (cmdLength == 0) {
- Tk_DeleteSelHandler(tkwin, selection, target);
- } else {
- cmdInfoPtr = (CommandInfo *) ckalloc((unsigned) (
- sizeof(CommandInfo) - 3 + cmdLength));
- cmdInfoPtr->interp = interp;
- cmdInfoPtr->charOffset = 0;
- cmdInfoPtr->byteOffset = 0;
- cmdInfoPtr->buffer[0] = '\0';
- cmdInfoPtr->cmdLength = cmdLength;
- memcpy(cmdInfoPtr->command, string, cmdLength + 1);
- Tk_CreateSelHandler(tkwin, selection, target, HandleTclCommand,
- (ClientData) cmdInfoPtr, format);
+
+ switch ((enum handleOptions) handleIndex) {
+ case HANDLE_FORMAT:
+ formatName = Tcl_GetString(objs[1]);
+ break;
+ case HANDLE_SELECTION:
+ selName = Tcl_GetString(objs[1]);
+ break;
+ case HANDLE_TYPE:
+ targetName = Tcl_GetString(objs[1]);
+ break;
}
- return TCL_OK;
}
-
- case SELECTION_OWN: {
- register LostCommand *lostPtr;
- char *script = NULL;
- int cmdLength;
- static CONST char *ownOptionStrings[] = {
- "-command", "-displayof", "-selection", (char *) NULL
- };
- enum ownOptions { OWN_COMMAND, OWN_DISPLAYOF, OWN_SELECTION };
- int ownIndex;
-
- for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count > 0;
- count-=2, objs+=2) {
- string = Tcl_GetString(objs[0]);
- if (string[0] != '-') {
- break;
- }
- if (count < 2) {
- Tcl_AppendResult(interp, "value for \"", string,
- "\" missing", (char *) NULL);
- return TCL_ERROR;
- }
- if (Tcl_GetIndexFromObj(interp, objs[0], ownOptionStrings,
- "option", 0, &ownIndex) != TCL_OK) {
- return TCL_ERROR;
- }
+ if ((count < 2) || (count > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?options? window command");
+ return TCL_ERROR;
+ }
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objs[0]), tkwin);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ if (selName != NULL) {
+ selection = Tk_InternAtom(tkwin, selName);
+ } else {
+ selection = XA_PRIMARY;
+ }
- switch ((enum ownOptions) ownIndex) {
- case OWN_COMMAND:
- script = Tcl_GetString(objs[1]);
- break;
- case OWN_DISPLAYOF:
- path = Tcl_GetString(objs[1]);
- break;
- case OWN_SELECTION:
- selName = Tcl_GetString(objs[1]);
- break;
- }
+ if (count > 2) {
+ target = Tk_InternAtom(tkwin, Tcl_GetString(objs[2]));
+ } else if (targetName != NULL) {
+ target = Tk_InternAtom(tkwin, targetName);
+ } else {
+ target = XA_STRING;
+ }
+ if (count > 3) {
+ format = Tk_InternAtom(tkwin, Tcl_GetString(objs[3]));
+ } else if (formatName != NULL) {
+ format = Tk_InternAtom(tkwin, formatName);
+ } else {
+ format = XA_STRING;
+ }
+ string = Tcl_GetStringFromObj(objs[1], &cmdLength);
+ if (cmdLength == 0) {
+ Tk_DeleteSelHandler(tkwin, selection, target);
+ } else {
+ cmdInfoPtr = (CommandInfo *) ckalloc((unsigned) (
+ sizeof(CommandInfo) - 3 + cmdLength));
+ cmdInfoPtr->interp = interp;
+ cmdInfoPtr->charOffset = 0;
+ cmdInfoPtr->byteOffset = 0;
+ cmdInfoPtr->buffer[0] = '\0';
+ cmdInfoPtr->cmdLength = cmdLength;
+ memcpy(cmdInfoPtr->command, string, cmdLength + 1);
+ Tk_CreateSelHandler(tkwin, selection, target, HandleTclCommand,
+ (ClientData) cmdInfoPtr, format);
+ }
+ return TCL_OK;
+ }
+
+ case SELECTION_OWN: {
+ register LostCommand *lostPtr;
+ char *script = NULL;
+ int cmdLength;
+ static CONST char *ownOptionStrings[] = {
+ "-command", "-displayof", "-selection", NULL
+ };
+ enum ownOptions { OWN_COMMAND, OWN_DISPLAYOF, OWN_SELECTION };
+ int ownIndex;
+
+ for (count = objc-2, objs = ((Tcl_Obj **)objv)+2; count > 0;
+ count-=2, objs+=2) {
+ string = Tcl_GetString(objs[0]);
+ if (string[0] != '-') {
+ break;
}
-
- if (count > 2) {
- Tcl_WrongNumArgs(interp, 2, objv, "?options? ?window?");
+ if (count < 2) {
+ Tcl_AppendResult(interp, "value for \"", string,
+ "\" missing", NULL);
return TCL_ERROR;
}
- if (selName != NULL) {
- selection = Tk_InternAtom(tkwin, selName);
- } else {
- selection = XA_PRIMARY;
+
+ if (Tcl_GetIndexFromObj(interp, objs[0], ownOptionStrings,
+ "option", 0, &ownIndex) != TCL_OK) {
+ return TCL_ERROR;
}
- if (count == 0) {
- TkSelectionInfo *infoPtr;
- TkWindow *winPtr;
- if (path != NULL) {
- tkwin = Tk_NameToWindow(interp, path, tkwin);
- }
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- winPtr = (TkWindow *)tkwin;
- for (infoPtr = winPtr->dispPtr->selectionInfoPtr;
- infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
- if (infoPtr->selection == selection)
- break;
- }
-
- /*
- * Ignore the internal clipboard window.
- */
-
- if ((infoPtr != NULL)
- && (infoPtr->owner != winPtr->dispPtr->clipWindow)) {
- Tcl_SetResult(interp, Tk_PathName(infoPtr->owner),
- TCL_STATIC);
- }
- return TCL_OK;
+
+ switch ((enum ownOptions) ownIndex) {
+ case OWN_COMMAND:
+ script = Tcl_GetString(objs[1]);
+ break;
+ case OWN_DISPLAYOF:
+ path = Tcl_GetString(objs[1]);
+ break;
+ case OWN_SELECTION:
+ selName = Tcl_GetString(objs[1]);
+ break;
+ }
+ }
+
+ if (count > 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?options? ?window?");
+ return TCL_ERROR;
+ }
+ if (selName != NULL) {
+ selection = Tk_InternAtom(tkwin, selName);
+ } else {
+ selection = XA_PRIMARY;
+ }
+
+ if (count == 0) {
+ TkSelectionInfo *infoPtr;
+ TkWindow *winPtr;
+
+ if (path != NULL) {
+ tkwin = Tk_NameToWindow(interp, path, tkwin);
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objs[0]), tkwin);
if (tkwin == NULL) {
return TCL_ERROR;
}
- if (count == 2) {
- script = Tcl_GetString(objs[1]);
+ winPtr = (TkWindow *)tkwin;
+ for (infoPtr = winPtr->dispPtr->selectionInfoPtr;
+ infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
+ if (infoPtr->selection == selection) {
+ break;
+ }
}
- if (script == NULL) {
- Tk_OwnSelection(tkwin, selection, (Tk_LostSelProc *) NULL,
- (ClientData) NULL);
- return TCL_OK;
+
+ /*
+ * Ignore the internal clipboard window.
+ */
+
+ if ((infoPtr != NULL)
+ && (infoPtr->owner != winPtr->dispPtr->clipWindow)) {
+ Tcl_SetResult(interp, Tk_PathName(infoPtr->owner), TCL_STATIC);
}
- cmdLength = strlen(script);
- lostPtr = (LostCommand *) ckalloc((unsigned) (sizeof(LostCommand)
- -3 + cmdLength));
- lostPtr->interp = interp;
- memcpy(lostPtr->command, script, cmdLength + 1);
- Tk_OwnSelection(tkwin, selection, LostSelection,
- (ClientData) lostPtr);
return TCL_OK;
}
+
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objs[0]), tkwin);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ if (count == 2) {
+ script = Tcl_GetString(objs[1]);
+ }
+ if (script == NULL) {
+ Tk_OwnSelection(tkwin, selection, NULL, (ClientData) NULL);
+ return TCL_OK;
+ }
+ cmdLength = strlen(script);
+ lostPtr = (LostCommand *) ckalloc((unsigned) (sizeof(LostCommand)
+ -3 + cmdLength));
+ lostPtr->interp = interp;
+ strcpy(lostPtr->command, script);
+ Tk_OwnSelection(tkwin, selection, LostSelection, (ClientData) lostPtr);
+ return TCL_OK;
+ }
}
return TCL_OK;
}
@@ -1028,12 +1021,12 @@ Tk_SelectionObjCmd(clientData, interp, objc, objv)
*
* TkSelGetInProgress --
*
- * This procedure returns a pointer to the thread-local
- * list of pending searches.
+ * This function returns a pointer to the thread-local list of pending
+ * searches.
*
* Results:
- * The return value is a pointer to the first search in progress,
- * or NULL if there are none.
+ * The return value is a pointer to the first search in progress, or NULL
+ * if there are none.
*
* Side effects:
* None.
@@ -1042,10 +1035,10 @@ Tk_SelectionObjCmd(clientData, interp, objc, objv)
*/
TkSelInProgress *
-TkSelGetInProgress _ANSI_ARGS_((void))
+TkSelGetInProgress(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->pendingPtr;
}
@@ -1055,9 +1048,9 @@ TkSelGetInProgress _ANSI_ARGS_((void))
*
* TkSelSetInProgress --
*
- * This procedure is used to set the thread-local list of pending
- * searches. It is required because the pending list is kept
- * in thread local storage.
+ * This function is used to set the thread-local list of pending
+ * searches. It is required because the pending list is kept in thread
+ * local storage.
*
* Results:
* None.
@@ -1068,13 +1061,13 @@ TkSelGetInProgress _ANSI_ARGS_((void))
*----------------------------------------------------------------------
*/
void
-TkSelSetInProgress(pendingPtr)
- TkSelInProgress *pendingPtr;
+TkSelSetInProgress(
+ TkSelInProgress *pendingPtr)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- tsdPtr->pendingPtr = pendingPtr;
+ tsdPtr->pendingPtr = pendingPtr;
}
/*
@@ -1082,8 +1075,8 @@ TkSelSetInProgress(pendingPtr)
*
* TkSelDeadWindow --
*
- * This procedure is invoked just before a TkWindow is deleted.
- * It performs selection-related cleanup.
+ * This function is invoked just before a TkWindow is deleted. It
+ * performs selection-related cleanup.
*
* Results:
* None.
@@ -1095,14 +1088,14 @@ TkSelSetInProgress(pendingPtr)
*/
void
-TkSelDeadWindow(winPtr)
- register TkWindow *winPtr; /* Window that's being deleted. */
+TkSelDeadWindow(
+ register TkWindow *winPtr) /* Window that's being deleted. */
{
register TkSelHandler *selPtr;
register TkSelInProgress *ipPtr;
TkSelectionInfo *infoPtr, *prevPtr, *nextPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* While deleting all the handlers, be careful to check whether
@@ -1113,8 +1106,8 @@ TkSelDeadWindow(winPtr)
while (winPtr->selHandlerList != NULL) {
selPtr = winPtr->selHandlerList;
winPtr->selHandlerList = selPtr->nextPtr;
- for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL;
- ipPtr = ipPtr->nextPtr) {
+ for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL;
+ ipPtr = ipPtr->nextPtr) {
if (ipPtr->selPtr == selPtr) {
ipPtr->selPtr = NULL;
}
@@ -1135,7 +1128,7 @@ TkSelDeadWindow(winPtr)
*/
for (infoPtr = winPtr->dispPtr->selectionInfoPtr, prevPtr = NULL;
- infoPtr != NULL; infoPtr = nextPtr) {
+ infoPtr != NULL; infoPtr = nextPtr) {
nextPtr = infoPtr->nextPtr;
if (infoPtr->owner == (Tk_Window) winPtr) {
if (infoPtr->clearProc == LostSelection) {
@@ -1170,9 +1163,9 @@ TkSelDeadWindow(winPtr)
*/
void
-TkSelInit(tkwin)
- Tk_Window tkwin; /* Window token (used to find
- * display to initialize). */
+TkSelInit(
+ Tk_Window tkwin) /* Window token (used to find display to
+ * initialize). */
{
register TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -1191,17 +1184,16 @@ TkSelInit(tkwin)
dispPtr->clipboardAtom = Tk_InternAtom(tkwin, "CLIPBOARD");
/*
- * Using UTF8_STRING instead of the XA_UTF8_STRING macro allows us
- * to support older X servers that didn't have UTF8_STRING yet.
- * This is necessary on Unix systems.
- * For more information, see:
- * http://www.cl.cam.ac.uk/~mgk25/unicode.html#x11
+ * Using UTF8_STRING instead of the XA_UTF8_STRING macro allows us to
+ * support older X servers that didn't have UTF8_STRING yet. This is
+ * necessary on Unix systems. For more information, see:
+ * http://www.cl.cam.ac.uk/~mgk25/unicode.html#x11
*/
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
dispPtr->utf8Atom = Tk_InternAtom(tkwin, "UTF8_STRING");
#else
- dispPtr->utf8Atom = (Atom) NULL;
+ dispPtr->utf8Atom = (Atom) 0;
#endif
}
@@ -1210,22 +1202,22 @@ TkSelInit(tkwin)
*
* TkSelClearSelection --
*
- * This procedure is invoked to process a SelectionClear event.
+ * This function is invoked to process a SelectionClear event.
*
* Results:
* None.
*
* Side effects:
- * Invokes the clear procedure for the window which lost the
+ * Invokes the clear function for the window which lost the
* selection.
*
*----------------------------------------------------------------------
*/
void
-TkSelClearSelection(tkwin, eventPtr)
- Tk_Window tkwin; /* Window for which event was targeted. */
- register XEvent *eventPtr; /* X SelectionClear event. */
+TkSelClearSelection(
+ Tk_Window tkwin, /* Window for which event was targeted. */
+ register XEvent *eventPtr) /* X SelectionClear event. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -1233,24 +1225,24 @@ TkSelClearSelection(tkwin, eventPtr)
TkSelectionInfo *prevPtr;
/*
- * Invoke clear procedure for window that just lost the selection. This
+ * Invoke clear function for window that just lost the selection. This
* code is a bit tricky, because any callbacks due to selection changes
- * between windows managed by the process have already been made. Thus,
+ * between windows managed by the process have already been made. Thus,
* ignore the event unless it refers to the window that's currently the
* selection owner and the event was generated after the server saw the
* SetSelectionOwner request.
*/
for (infoPtr = dispPtr->selectionInfoPtr, prevPtr = NULL;
- infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
+ infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
if (infoPtr->selection == eventPtr->xselectionclear.selection) {
break;
}
prevPtr = infoPtr;
}
- if (infoPtr != NULL && (infoPtr->owner == tkwin)
- && (eventPtr->xselectionclear.serial >= (unsigned) infoPtr->serial)) {
+ if (infoPtr != NULL && (infoPtr->owner == tkwin) &&
+ (eventPtr->xselectionclear.serial >= (unsigned) infoPtr->serial)) {
if (prevPtr == NULL) {
dispPtr->selectionInfoPtr = infoPtr->nextPtr;
} else {
@@ -1259,9 +1251,9 @@ TkSelClearSelection(tkwin, eventPtr)
/*
* Because of reentrancy problems, calling clearProc must be done
- * after the infoPtr has been removed from the selectionInfoPtr
- * list (clearProc could modify the list, e.g. by creating
- * a new selection).
+ * after the infoPtr has been removed from the selectionInfoPtr list
+ * (clearProc could modify the list, e.g. by creating a new
+ * selection).
*/
if (infoPtr->clearProc != NULL) {
@@ -1276,27 +1268,27 @@ TkSelClearSelection(tkwin, eventPtr)
*
* SelGetProc --
*
- * This procedure is invoked to process pieces of the selection
- * as they arrive during "selection get" commands.
+ * This function is invoked to process pieces of the selection as they
+ * arrive during "selection get" commands.
*
* Results:
* Always returns TCL_OK.
*
* Side effects:
- * Bytes get appended to the dynamic string pointed to by the
- * clientData argument.
+ * Bytes get appended to the dynamic string pointed to by the clientData
+ * argument.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
-SelGetProc(clientData, interp, portion)
- ClientData clientData; /* Dynamic string holding partially
- * assembled selection. */
- Tcl_Interp *interp; /* Interpreter used for error
- * reporting (not used). */
- char *portion; /* New information to be appended. */
+SelGetProc(
+ ClientData clientData, /* Dynamic string holding partially assembled
+ * selection. */
+ Tcl_Interp *interp, /* Interpreter used for error reporting (not
+ * used). */
+ char *portion) /* New information to be appended. */
{
Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1);
return TCL_OK;
@@ -1307,14 +1299,14 @@ SelGetProc(clientData, interp, portion)
*
* HandleTclCommand --
*
- * This procedure acts as selection handler for handlers created
- * by the "selection handle" command. It invokes a Tcl command to
- * retrieve the selection.
+ * This function acts as selection handler for handlers created by the
+ * "selection handle" command. It invokes a Tcl command to retrieve the
+ * selection.
*
* Results:
- * The return value is a count of the number of bytes actually
- * stored at buffer, or -1 if an error occurs while executing
- * the Tcl command to retrieve the selection.
+ * The return value is a count of the number of bytes actually stored at
+ * buffer, or -1 if an error occurs while executing the Tcl command to
+ * retrieve the selection.
*
* Side effects:
* None except for things done by the Tcl command.
@@ -1323,12 +1315,12 @@ SelGetProc(clientData, interp, portion)
*/
static int
-HandleTclCommand(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Information about command to execute. */
- int offset; /* Return selection bytes starting at this
+HandleTclCommand(
+ ClientData clientData, /* Information about command to execute. */
+ int offset, /* Return selection bytes starting at this
* offset. */
- char *buffer; /* Place to store converted selection. */
- int maxBytes; /* Maximum # of bytes to store at buffer. */
+ char *buffer, /* Place to store converted selection. */
+ int maxBytes) /* Maximum # of bytes to store at buffer. */
{
CommandInfo *cmdInfoPtr = (CommandInfo *) clientData;
int spaceNeeded, length;
@@ -1342,16 +1334,16 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
CONST char *p;
/*
- * We must also protect the interpreter and the command from being
- * deleted too soon.
+ * We must also protect the interpreter and the command from being deleted
+ * too soon.
*/
Tcl_Preserve(clientData);
Tcl_Preserve((ClientData) interp);
/*
- * Compute the proper byte offset in the case where the last chunk
- * split a character.
+ * Compute the proper byte offset in the case where the last chunk split a
+ * character.
*/
if (offset == cmdInfoPtr->byteOffset) {
@@ -1370,8 +1362,8 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
}
/*
- * First, generate a command by taking the command string
- * and appending the offset and maximum # of bytes.
+ * First, generate a command by taking the command string and appending
+ * the offset and maximum # of bytes.
*/
spaceNeeded = cmdInfoPtr->cmdLength + 30;
@@ -1383,8 +1375,8 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
sprintf(command, "%s %d %d", cmdInfoPtr->command, charOffset, maxBytes);
/*
- * Execute the command. Be sure to restore the state of the
- * interpreter after executing the command.
+ * Execute the command. Be sure to restore the state of the interpreter
+ * after executing the command.
*/
Tcl_DStringInit(&oldResult);
@@ -1393,12 +1385,12 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
objPtr = Tcl_GetObjResult(interp);
string = Tcl_GetStringFromObj(objPtr, &length);
count = (length > maxBytes) ? maxBytes : length;
- memcpy((VOID *) buffer, (VOID *) string, (size_t) count);
+ memcpy(buffer, string, (size_t) count);
buffer[count] = '\0';
/*
- * Update the partial character information for the next
- * retrieval if the command has not been deleted.
+ * Update the partial character information for the next retrieval if
+ * the command has not been deleted.
*/
if (cmdInfoPtr->interp != NULL) {
@@ -1419,7 +1411,7 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
strncpy(cmdInfoPtr->buffer, string, (size_t) length);
}
cmdInfoPtr->buffer[length] = '\0';
- }
+ }
cmdInfoPtr->byteOffset += count + extraBytes;
}
count += extraBytes;
@@ -1432,7 +1424,6 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
ckfree(command);
}
-
Tcl_Release(clientData);
Tcl_Release((ClientData) interp);
return count;
@@ -1443,20 +1434,18 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
*
* TkSelDefaultSelection --
*
- * This procedure is called to generate selection information
- * for a few standard targets such as TIMESTAMP and TARGETS.
- * It is invoked only if no handler has been declared by the
- * application.
+ * This function is called to generate selection information for a few
+ * standard targets such as TIMESTAMP and TARGETS. It is invoked only if
+ * no handler has been declared by the application.
*
* Results:
- * If "target" is a standard target understood by this procedure,
- * the selection is converted to that form and stored as a
- * character string in buffer. The type of the selection (e.g.
- * STRING or ATOM) is stored in *typePtr, and the return value is
- * a count of the # of non-NULL bytes at buffer. If the target
- * wasn't understood, or if there isn't enough space at buffer
- * to hold the entire selection (no INCR-mode transfers for this
- * stuff!), then -1 is returned.
+ * If "target" is a standard target understood by this function, the
+ * selection is converted to that form and stored as a character string
+ * in buffer. The type of the selection (e.g. STRING or ATOM) is stored
+ * in *typePtr, and the return value is a count of the # of non-NULL
+ * bytes at buffer. If the target wasn't understood, or if there isn't
+ * enough space at buffer to hold the entire selection (no INCR-mode
+ * transfers for this stuff!), then -1 is returned.
*
* Side effects:
* None.
@@ -1465,13 +1454,13 @@ HandleTclCommand(clientData, offset, buffer, maxBytes)
*/
int
-TkSelDefaultSelection(infoPtr, target, buffer, maxBytes, typePtr)
- TkSelectionInfo *infoPtr; /* Info about selection being retrieved. */
- Atom target; /* Desired form of selection. */
- char *buffer; /* Place to put selection characters. */
- int maxBytes; /* Maximum # of bytes to store at buffer. */
- Atom *typePtr; /* Store here the type of the selection,
- * for use in converting to proper X format. */
+TkSelDefaultSelection(
+ TkSelectionInfo *infoPtr, /* Info about selection being retrieved. */
+ Atom target, /* Desired form of selection. */
+ char *buffer, /* Place to put selection characters. */
+ int maxBytes, /* Maximum # of bytes to store at buffer. */
+ Atom *typePtr) /* Store here the type of the selection, for
+ * use in converting to proper X format. */
{
register TkWindow *winPtr = (TkWindow *) infoPtr->owner;
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -1551,22 +1540,22 @@ TkSelDefaultSelection(infoPtr, target, buffer, maxBytes, typePtr)
*
* LostSelection --
*
- * This procedure is invoked when a window has lost ownership of
- * the selection and the ownership was claimed with the command
- * "selection own".
+ * This function is invoked when a window has lost ownership of the
+ * selection and the ownership was claimed with the command "selection
+ * own".
*
* Results:
* None.
*
* Side effects:
- * A Tcl script is executed; it can do almost anything.
+ * A Tcl script is executed; it can do almost anything.
*
*----------------------------------------------------------------------
*/
static void
-LostSelection(clientData)
- ClientData clientData; /* Pointer to LostCommand structure. */
+LostSelection(
+ ClientData clientData) /* Pointer to LostCommand structure. */
{
LostCommand *lostPtr = (LostCommand *) clientData;
Tcl_Obj *objPtr;
@@ -1574,10 +1563,10 @@ LostSelection(clientData)
interp = lostPtr->interp;
Tcl_Preserve((ClientData) interp);
-
+
/*
- * Execute the command. Save the interpreter's result, if any, and
- * restore it after executing the command.
+ * Execute the command. Save the interpreter's result, if any, and restore
+ * it after executing the command.
*/
objPtr = Tcl_GetObjResult(interp);
@@ -1592,10 +1581,18 @@ LostSelection(clientData)
Tcl_DecrRefCount(objPtr);
Tcl_Release((ClientData) interp);
-
+
/*
* Free the storage for the command, since we're done with it now.
*/
ckfree((char *) lostPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkSelect.h b/generic/tkSelect.h
index 4d1c9d0..b9d7d2d 100644
--- a/generic/tkSelect.h
+++ b/generic/tkSelect.h
@@ -1,13 +1,13 @@
/*
* tkSelect.h --
*
- * Declarations of types shared among the files that implement
- * selection support.
+ * Declarations of types shared among the files that implement selection
+ * support.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKSELECT
@@ -16,142 +16,134 @@
/*
* When a selection is owned by a window on a given display, one of the
* following structures is present on a list of current selections in the
- * display structure. The structure is used to record the current owner of
- * a selection for use in later retrieval requests. There is a list of
- * such structures because a display can have multiple different selections
- * active at the same time.
+ * display structure. The structure is used to record the current owner of a
+ * selection for use in later retrieval requests. There is a list of such
+ * structures because a display can have multiple different selections active
+ * at the same time.
*/
typedef struct TkSelectionInfo {
Atom selection; /* Selection name, e.g. XA_PRIMARY. */
Tk_Window owner; /* Current owner of this selection. */
int serial; /* Serial number of last XSelectionSetOwner
- * request made to server for this
- * selection (used to filter out redundant
+ * request made to server for this selection
+ * (used to filter out redundant
* SelectionClear events). */
Time time; /* Timestamp used to acquire selection. */
Tk_LostSelProc *clearProc; /* Procedure to call when owner loses
* selection. */
ClientData clearData; /* Info to pass to clearProc. */
struct TkSelectionInfo *nextPtr;
- /* Next in list of current selections on
- * this display. NULL means end of list */
+ /* Next in list of current selections on this
+ * display. NULL means end of list. */
} TkSelectionInfo;
/*
- * One of the following structures exists for each selection handler
- * created for a window by calling Tk_CreateSelHandler. The handlers
- * are linked in a list rooted in the TkWindow structure.
+ * One of the following structures exists for each selection handler created
+ * for a window by calling Tk_CreateSelHandler. The handlers are linked in a
+ * list rooted in the TkWindow structure.
*/
typedef struct TkSelHandler {
- Atom selection; /* Selection name, e.g. XA_PRIMARY */
- Atom target; /* Target type for selection
- * conversion, such as TARGETS or
- * STRING. */
- Atom format; /* Format in which selection
- * info will be returned, such
- * as STRING or ATOM. */
- Tk_SelectionProc *proc; /* Procedure to generate selection
- * in this format. */
+ Atom selection; /* Selection name, e.g. XA_PRIMARY. */
+ Atom target; /* Target type for selection conversion, such
+ * as TARGETS or STRING. */
+ Atom format; /* Format in which selection info will be
+ * returned, such as STRING or ATOM. */
+ Tk_SelectionProc *proc; /* Procedure to generate selection in this
+ * format. */
ClientData clientData; /* Argument to pass to proc. */
- int size; /* Size of units returned by proc
- * (8 for STRING, 32 for almost
- * anything else). */
+ int size; /* Size of units returned by proc (8 for
+ * STRING, 32 for almost anything else). */
struct TkSelHandler *nextPtr;
- /* Next selection handler associated
- * with same window (NULL for end of
- * list). */
+ /* Next selection handler associated with same
+ * window (NULL for end of list). */
} TkSelHandler;
/*
- * When the selection is being retrieved, one of the following
- * structures is present on a list of pending selection retrievals.
- * The structure is used to communicate between the background
- * procedure that requests the selection and the foreground
- * event handler that processes the events in which the selection
- * is returned. There is a list of such structures so that there
- * can be multiple simultaneous selection retrievals (e.g. on
- * different displays).
+ * When the selection is being retrieved, one of the following structures is
+ * present on a list of pending selection retrievals. The structure is used to
+ * communicate between the background procedure that requests the selection
+ * and the foreground event handler that processes the events in which the
+ * selection is returned. There is a list of such structures so that there can
+ * be multiple simultaneous selection retrievals (e.g. on different displays).
*/
typedef struct TkSelRetrievalInfo {
Tcl_Interp *interp; /* Interpreter for error reporting. */
- TkWindow *winPtr; /* Window used as requestor for
- * selection. */
+ TkWindow *winPtr; /* Window used as requestor for selection. */
Atom selection; /* Selection being requested. */
Atom property; /* Property where selection will appear. */
Atom target; /* Desired form for selection. */
int (*proc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp,
- char *portion)); /* Procedure to call to handle pieces
- * of selection. */
+ char *portion)); /* Procedure to call to handle pieces of
+ * selection. */
ClientData clientData; /* Argument for proc. */
- int result; /* Initially -1. Set to a Tcl
- * return value once the selection
- * has been retrieved. */
+ int result; /* Initially -1. Set to a Tcl return value
+ * once the selection has been retrieved. */
Tcl_TimerToken timeout; /* Token for current timeout procedure. */
- int idleTime; /* Number of seconds that have gone by
- * without hearing anything from the
- * selection owner. */
+ int idleTime; /* Number of seconds that have gone by without
+ * hearing anything from the selection
+ * owner. */
Tcl_EncodingState encState; /* Holds intermediate state during translations
* of data that cross buffer boundaries. */
int encFlags; /* Encoding translation state flags. */
Tcl_DString buf; /* Buffer to hold translation data. */
struct TkSelRetrievalInfo *nextPtr;
- /* Next in list of all pending
- * selection retrievals. NULL means
- * end of list. */
+ /* Next in list of all pending selection
+ * retrievals. NULL means end of list. */
} TkSelRetrievalInfo;
/*
- * The clipboard contains a list of buffers of various types and formats.
- * All of the buffers of a given type will be returned in sequence when the
- * CLIPBOARD selection is retrieved. All buffers of a given type on the
- * same clipboard must have the same format. The TkClipboardTarget structure
- * is used to record the information about a chain of buffers of the same
- * type.
+ * The clipboard contains a list of buffers of various types and formats. All
+ * of the buffers of a given type will be returned in sequence when the
+ * CLIPBOARD selection is retrieved. All buffers of a given type on the same
+ * clipboard must have the same format. The TkClipboardTarget structure is
+ * used to record the information about a chain of buffers of the same type.
*/
typedef struct TkClipboardBuffer {
- char *buffer; /* Null terminated data buffer. */
- long length; /* Length of string in buffer. */
- struct TkClipboardBuffer *nextPtr; /* Next in list of buffers. NULL
- * means end of list . */
+ char *buffer; /* Null terminated data buffer. */
+ long length; /* Length of string in buffer. */
+ struct TkClipboardBuffer *nextPtr;
+ /* Next in list of buffers. NULL means end of
+ * list . */
} TkClipboardBuffer;
typedef struct TkClipboardTarget {
- Atom type; /* Type conversion supported. */
- Atom format; /* Representation used for data. */
- TkClipboardBuffer *firstBufferPtr; /* First in list of data buffers. */
- TkClipboardBuffer *lastBufferPtr; /* Last in list of clipboard buffers.
- * Used to speed up appends. */
- struct TkClipboardTarget *nextPtr; /* Next in list of targets on
- * clipboard. NULL means end of
- * list. */
+ Atom type; /* Type conversion supported. */
+ Atom format; /* Representation used for data. */
+ TkClipboardBuffer *firstBufferPtr;
+ /* First in list of data buffers. */
+ TkClipboardBuffer *lastBufferPtr;
+ /* Last in list of clipboard buffers. Used to
+ * speed up appends. */
+ struct TkClipboardTarget *nextPtr;
+ /* Next in list of targets on clipboard. NULL
+ * means end of list. */
} TkClipboardTarget;
/*
* It is possible for a Tk_SelectionProc to delete the handler that it
- * represents. If this happens, the code that is retrieving the selection
- * needs to know about it so it doesn't use the now-defunct handler
- * structure. One structure of the following form is created for each
- * retrieval in progress, so that the retriever can find out if its
- * handler is deleted. All of the pending retrievals (if there are more
- * than one) are linked into a list.
+ * represents. If this happens, the code that is retrieving the selection
+ * needs to know about it so it doesn't use the now-defunct handler structure.
+ * One structure of the following form is created for each retrieval in
+ * progress, so that the retriever can find out if its handler is deleted. All
+ * of the pending retrievals (if there are more than one) are linked into a
+ * list.
*/
typedef struct TkSelInProgress {
- TkSelHandler *selPtr; /* Handler being executed. If this handler
- * is deleted, the field is set to NULL. */
+ TkSelHandler *selPtr; /* Handler being executed. If this handler is
+ * deleted, the field is set to NULL. */
struct TkSelInProgress *nextPtr;
/* Next higher nested search. */
} TkSelInProgress;
/*
- * Chunk size for retrieving selection. It's defined both in
- * words and in bytes; the word size is used to allocate
- * buffer space that's guaranteed to be word-aligned and that
- * has an extra character for the terminating NULL.
+ * Chunk size for retrieving selection. It's defined both in words and in
+ * bytes; the word size is used to allocate buffer space that's guaranteed to
+ * be word-aligned and that has an extra character for the terminating NULL.
*/
#define TK_SEL_BYTES_AT_ONCE 4000
@@ -162,22 +154,18 @@ typedef struct TkSelInProgress {
* but shouldn't be used anywhere else in Tk (or by Tk clients):
*/
-extern TkSelInProgress *
- TkSelGetInProgress _ANSI_ARGS_((void));
-extern void TkSelSetInProgress _ANSI_ARGS_((
- TkSelInProgress *pendingPtr));
-
-extern void TkSelClearSelection _ANSI_ARGS_((Tk_Window tkwin,
- XEvent *eventPtr));
-extern int TkSelDefaultSelection _ANSI_ARGS_((
- TkSelectionInfo *infoPtr, Atom target,
- char *buffer, int maxBytes, Atom *typePtr));
-extern int TkSelGetSelection _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Atom selection, Atom target,
- Tk_GetSelProc *proc, ClientData clientData));
+MODULE_SCOPE TkSelInProgress *TkSelGetInProgress(void);
+MODULE_SCOPE void TkSelSetInProgress(TkSelInProgress *pendingPtr);
+MODULE_SCOPE void TkSelClearSelection(Tk_Window tkwin, XEvent *eventPtr);
+MODULE_SCOPE int TkSelDefaultSelection(TkSelectionInfo *infoPtr,
+ Atom target, char *buffer, int maxBytes,
+ Atom *typePtr);
+MODULE_SCOPE int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin,
+ Atom selection, Atom target, Tk_GetSelProc *proc,
+ ClientData clientData);
#ifndef TkSelUpdateClipboard
-extern void TkSelUpdateClipboard _ANSI_ARGS_((TkWindow *winPtr,
- TkClipboardTarget *targetPtr));
+MODULE_SCOPE void TkSelUpdateClipboard(TkWindow *winPtr,
+ TkClipboardTarget *targetPtr);
#endif
#endif /* _TKSELECT */
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 435b841..a35832a 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -1,32 +1,32 @@
-/*
+/*
* tkSquare.c --
*
- * This module implements "square" widgets that are object
- * based. A "square" is a widget that displays a single square that can
- * be moved around and resized. This file is intended as an example
- * of how to build a widget; it isn't included in the
- * normal wish, but it is included in "tktest".
+ * This module implements "square" widgets that are object based. A
+ * "square" is a widget that displays a single square that can be moved
+ * around and resized. This file is intended as an example of how to
+ * build a widget; it isn't included in the normal wish, but it is
+ * included in "tktest".
*
* Copyright (c) 1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
+#if 0
#define __NO_OLD_CONFIG
-#include "tk.h"
+#endif
#include "tkInt.h"
/*
- * A data structure of the following type is kept for each square
- * widget managed by this file:
+ * A data structure of the following type is kept for each square widget
+ * managed by this file:
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the square. NULL
- * means window has been deleted but
- * widget record hasn't been cleaned up yet. */
+ Tk_Window tkwin; /* Window that embodies the square. NULL means
+ * window has been deleted but widget record
+ * hasn't been cleaned up yet. */
Display *display; /* X's token for the window's display. */
Tcl_Interp *interp; /* Interpreter associated with widget. */
Tcl_Command widgetCmd; /* Token for square's widget command. */
@@ -47,31 +47,31 @@ typedef struct {
Tcl_Obj *reliefPtr;
GC gc; /* Graphics context for copying from
* off-screen pixmap onto screen. */
- Tcl_Obj *doubleBufferPtr; /* Non-zero means double-buffer redisplay
- * with pixmap; zero means draw straight
- * onto the display. */
- int updatePending; /* Non-zero means a call to SquareDisplay
- * has already been scheduled. */
+ Tcl_Obj *doubleBufferPtr; /* Non-zero means double-buffer redisplay with
+ * pixmap; zero means draw straight onto the
+ * display. */
+ int updatePending; /* Non-zero means a call to SquareDisplay has
+ * already been scheduled. */
} Square;
/*
* Information used for argv parsing.
*/
-static Tk_OptionSpec optionSpecs[] = {
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
"#d9d9d9", Tk_Offset(Square, bgBorderPtr), -1, 0,
(ClientData) "white"},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth"},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background"},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-borderwidth"},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-background"},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
"2", Tk_Offset(Square, borderWidthPtr), -1},
{TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer",
"1", Tk_Offset(Square, doubleBufferPtr), -1},
- {TK_OPTION_SYNONYM, "-fg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground"},
+ {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-foreground"},
{TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
"#b03060", Tk_Offset(Square, fgBorderPtr), -1, 0,
(ClientData) "black"},
@@ -90,28 +90,26 @@ static Tk_OptionSpec optionSpecs[] = {
* Forward declarations for procedures defined later in this file:
*/
-int SquareObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static void SquareDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static int SquareConfigure _ANSI_ARGS_((Tcl_Interp *interp,
- Square *squarePtr));
-static void SquareDestroy _ANSI_ARGS_((char *memPtr));
-static void SquareDisplay _ANSI_ARGS_((ClientData clientData));
-static void KeepInWindow _ANSI_ARGS_((Square *squarePtr));
-static void SquareObjEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int SquareWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]));
+int SquareObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
+static void SquareDeletedProc(ClientData clientData);
+static int SquareConfigure(Tcl_Interp *interp, Square *squarePtr);
+static void SquareDestroy(char *memPtr);
+static void SquareDisplay(ClientData clientData);
+static void KeepInWindow(Square *squarePtr);
+static void SquareObjEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static int SquareWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]);
/*
*--------------------------------------------------------------
*
* SquareCmd --
*
- * This procedure is invoked to process the "square" Tcl
- * command. It creates a new "square" widget.
+ * This procedure is invoked to process the "square" Tcl command. It
+ * creates a new "square" widget.
*
* Results:
* A standard Tcl result.
@@ -123,11 +121,11 @@ static int SquareWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
*/
int
-SquareObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+SquareObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Square *squarePtr;
Tk_Window tkwin;
@@ -138,39 +136,38 @@ SquareObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
- tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL);
+ tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
Tk_SetClass(tkwin, "Square");
/*
- * Create the option table for this widget class. If it has
- * already been created, the refcount will get bumped and just
- * the pointer will be returned. The refcount getting bumped
- * does not concern us, because Tk will ensure the table is
- * deleted when the interpreter is destroyed.
+ * Create the option table for this widget class. If it has already been
+ * created, the refcount will get bumped and just the pointer will be
+ * returned. The refcount getting bumped does not concern us, because Tk
+ * will ensure the table is deleted when the interpreter is destroyed.
*/
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
/*
- * Allocate and initialize the widget record. The memset allows
- * us to set just the non-NULL/0 items.
+ * Allocate and initialize the widget record. The memset allows us to set
+ * just the non-NULL/0 items.
*/
- squarePtr = (Square *) ckalloc(sizeof(Square));
+ squarePtr = (Square *) ckalloc(sizeof(Square));
memset((void *) squarePtr, 0, (sizeof(Square)));
- squarePtr->tkwin = tkwin;
- squarePtr->display = Tk_Display(tkwin);
- squarePtr->interp = interp;
- squarePtr->widgetCmd = Tcl_CreateObjCommand(interp,
+ squarePtr->tkwin = tkwin;
+ squarePtr->display = Tk_Display(tkwin);
+ squarePtr->interp = interp;
+ squarePtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd,
(ClientData) squarePtr, SquareDeletedProc);
- squarePtr->gc = None;
- squarePtr->optionTable = optionTable;
+ squarePtr->gc = None;
+ squarePtr->optionTable = optionTable;
if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin)
!= TCL_OK) {
@@ -182,7 +179,7 @@ SquareObjCmd(clientData, interp, objc, objv)
Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask,
SquareObjEventProc, (ClientData) squarePtr);
if (Tk_SetOptions(interp, (char *) squarePtr, optionTable, objc - 2,
- objv + 2, tkwin, NULL, (int *) NULL) != TCL_OK) {
+ objv + 2, tkwin, NULL, NULL) != TCL_OK) {
goto error;
}
if (SquareConfigure(interp, squarePtr) != TCL_OK) {
@@ -193,7 +190,7 @@ SquareObjCmd(clientData, interp, objc, objv)
Tcl_NewStringObj(Tk_PathName(squarePtr->tkwin), -1));
return TCL_OK;
-error:
+ error:
Tk_DestroyWindow(squarePtr->tkwin);
return TCL_ERROR;
}
@@ -203,9 +200,9 @@ error:
*
* SquareWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -217,15 +214,15 @@ error:
*/
static int
-SquareWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about square widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+SquareWidgetObjCmd(
+ ClientData clientData, /* Information about square widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj * CONST objv[]) /* Argument objects. */
{
Square *squarePtr = (Square *) clientData;
int result = TCL_OK;
- static CONST char *squareOptions[] = {"cget", "configure", (char *) NULL};
+ static CONST char *squareOptions[] = {"cget", "configure", NULL};
enum {
SQUARE_CGET, SQUARE_CONFIGURE
};
@@ -243,58 +240,55 @@ SquareWidgetObjCmd(clientData, interp, objc, objv)
}
Tcl_Preserve((ClientData) squarePtr);
-
+
switch (index) {
- case SQUARE_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
- goto error;
+ case SQUARE_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ goto error;
+ }
+ resultObjPtr = Tk_GetOptionValue(interp, (char *) squarePtr,
+ squarePtr->optionTable, objv[2], squarePtr->tkwin);
+ if (resultObjPtr == NULL) {
+ result = TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObjPtr);
+ }
+ break;
+ case SQUARE_CONFIGURE:
+ resultObjPtr = NULL;
+ if (objc == 2) {
+ resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
+ squarePtr->optionTable, NULL, squarePtr->tkwin);
+ if (resultObjPtr == NULL) {
+ result = TCL_ERROR;
}
- resultObjPtr = Tk_GetOptionValue(interp, (char *) squarePtr,
+ } else if (objc == 3) {
+ resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
squarePtr->optionTable, objv[2], squarePtr->tkwin);
if (resultObjPtr == NULL) {
result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, resultObjPtr);
}
- break;
- }
- case SQUARE_CONFIGURE: {
- resultObjPtr = NULL;
- if (objc == 2) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
- squarePtr->optionTable, (Tcl_Obj *) NULL,
- squarePtr->tkwin);
- if (resultObjPtr == NULL) {
- result = TCL_ERROR;
- }
- } else if (objc == 3) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
- squarePtr->optionTable, objv[2], squarePtr->tkwin);
- if (resultObjPtr == NULL) {
- result = TCL_ERROR;
- }
- } else {
- result = Tk_SetOptions(interp, (char *) squarePtr,
- squarePtr->optionTable, objc - 2, objv + 2,
- squarePtr->tkwin, NULL, (int *) NULL);
- if (result == TCL_OK) {
- result = SquareConfigure(interp, squarePtr);
- }
- if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
- squarePtr->updatePending = 1;
- }
+ } else {
+ result = Tk_SetOptions(interp, (char *) squarePtr,
+ squarePtr->optionTable, objc - 2, objv + 2,
+ squarePtr->tkwin, NULL, NULL);
+ if (result == TCL_OK) {
+ result = SquareConfigure(interp, squarePtr);
}
- if (resultObjPtr != NULL) {
- Tcl_SetObjResult(interp, resultObjPtr);
+ if (!squarePtr->updatePending) {
+ Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ squarePtr->updatePending = 1;
}
}
+ if (resultObjPtr != NULL) {
+ Tcl_SetObjResult(interp, resultObjPtr);
+ }
}
Tcl_Release((ClientData) squarePtr);
return result;
- error:
+ error:
Tcl_Release((ClientData) squarePtr);
return TCL_ERROR;
}
@@ -304,37 +298,36 @@ SquareWidgetObjCmd(clientData, interp, objc, objv)
*
* SquareConfigure --
*
- * This procedure is called to process an argv/argc list in
- * conjunction with the Tk option database to configure (or
- * reconfigure) a square widget.
+ * This procedure is called to process an argv/argc list in conjunction
+ * with the Tk option database to configure (or reconfigure) a square
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for squarePtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for squarePtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-SquareConfigure(interp, squarePtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Square *squarePtr; /* Information about widget. */
+SquareConfigure(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Square *squarePtr) /* Information about widget. */
{
int borderWidth;
Tk_3DBorder bgBorder;
int doubleBuffer;
/*
- * Set the background for the window and create a graphics context
- * for use during redisplay.
+ * Set the background for the window and create a graphics context for use
+ * during redisplay.
*/
- bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
+ bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
squarePtr->bgBorderPtr);
Tk_SetWindowBackground(squarePtr->tkwin,
Tk_3DBorderColor(bgBorder)->pixel);
@@ -348,8 +341,8 @@ SquareConfigure(interp, squarePtr)
}
/*
- * Register the desired geometry for the window. Then arrange for
- * the window to be redisplayed.
+ * Register the desired geometry for the window. Then arrange for the
+ * window to be redisplayed.
*/
Tk_GeometryRequest(squarePtr->tkwin, 200, 150);
@@ -369,23 +362,23 @@ SquareConfigure(interp, squarePtr)
*
* SquareObjEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on squares.
+ * This procedure is invoked by the Tk dispatcher for various events on
+ * squares.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-SquareObjEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+SquareObjEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
Square *squarePtr = (Square *) clientData;
@@ -423,9 +416,9 @@ SquareObjEventProc(clientData, eventPtr)
*
* SquareDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This procedure is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -437,17 +430,17 @@ SquareObjEventProc(clientData, eventPtr)
*/
static void
-SquareDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+SquareDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
Square *squarePtr = (Square *) clientData;
Tk_Window tkwin = squarePtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This procedure could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this procedure destroys the
+ * widget.
*/
if (tkwin != NULL) {
@@ -460,9 +453,9 @@ SquareDeletedProc(clientData)
*
* SquareDisplay --
*
- * This procedure redraws the contents of a square window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This procedure redraws the contents of a square window. It is invoked
+ * as a do-when-idle handler, so it only runs when there's nothing else
+ * for the application to do.
*
* Results:
* None.
@@ -474,8 +467,8 @@ SquareDeletedProc(clientData)
*/
static void
-SquareDisplay(clientData)
- ClientData clientData; /* Information about window. */
+SquareDisplay(
+ ClientData clientData) /* Information about window. */
{
Square *squarePtr = (Square *) clientData;
Tk_Window tkwin = squarePtr->tkwin;
@@ -510,7 +503,7 @@ SquareDisplay(clientData)
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr,
&borderWidth);
- bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
+ bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
squarePtr->bgBorderPtr);
Tk_GetReliefFromObj(NULL, squarePtr->reliefPtr, &relief);
Tk_Fill3DRectangle(tkwin, d, bgBorder, 0, 0, Tk_Width(tkwin),
@@ -521,9 +514,9 @@ SquareDisplay(clientData)
*/
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->sizeObjPtr, &size);
- fgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
+ fgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
squarePtr->fgBorderPtr);
- Tk_Fill3DRectangle(tkwin, d, fgBorder, squarePtr->x, squarePtr->y, size,
+ Tk_Fill3DRectangle(tkwin, d, fgBorder, squarePtr->x, squarePtr->y, size,
size, borderWidth, TK_RELIEF_RAISED);
/*
@@ -543,9 +536,9 @@ SquareDisplay(clientData)
*
* SquareDestroy --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a square at a safe time
- * (when no-one is using it anymore).
+ * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
+ * clean up the internal structure of a square at a safe time (when
+ * no-one is using it anymore).
*
* Results:
* None.
@@ -557,11 +550,11 @@ SquareDisplay(clientData)
*/
static void
-SquareDestroy(memPtr)
- char *memPtr; /* Info about square widget. */
+SquareDestroy(
+ char *memPtr) /* Info about square widget. */
{
Square *squarePtr = (Square *) memPtr;
-
+
ckfree((char *) squarePtr);
}
@@ -570,31 +563,31 @@ SquareDestroy(memPtr)
*
* KeepInWindow --
*
- * Adjust the position of the square if necessary to keep it in
- * the widget's window.
+ * Adjust the position of the square if necessary to keep it in the
+ * widget's window.
*
* Results:
* None.
*
* Side effects:
- * The x and y position of the square are adjusted if necessary
- * to keep the square in the window.
+ * The x and y position of the square are adjusted if necessary to keep
+ * the square in the window.
*
*----------------------------------------------------------------------
*/
static void
-KeepInWindow(squarePtr)
- register Square *squarePtr; /* Pointer to widget record. */
+KeepInWindow(
+ register Square *squarePtr) /* Pointer to widget record. */
{
int i, bd, relief;
int borderWidth, size;
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr,
&borderWidth);
- Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->xPtr,
+ Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->xPtr,
&squarePtr->x);
- Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->yPtr,
+ Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->yPtr,
&squarePtr->y);
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->sizeObjPtr, &size);
Tk_GetReliefFromObj(NULL, squarePtr->reliefPtr, &relief);
@@ -617,3 +610,11 @@ KeepInWindow(squarePtr)
squarePtr->y = bd;
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkStubImg.c b/generic/tkStubImg.c
deleted file mode 100644
index 608d627..0000000
--- a/generic/tkStubImg.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * tkStubImg.c --
- *
- * Stub object that will be statically linked into extensions that wish
- * to access Tk.
- *
- * Copyright (c) 1999 Jan Nijtmans.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tcl.h"
-
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_InitImageArgs --
- *
- * Performs the necessary conversion from Tcl_Obj's to strings
- * in the createProc for Tcl_CreateImageType. If running under
- * Tk 8.2 or earlier without the Img-patch, this function has
- * no effect.
- *
- * Results:
- * argvPtr will point to an argument list which is guaranteed to
- * contain strings, no matter what Tk version is running.
- *
- * Side effects:
- * None
- *
- *----------------------------------------------------------------------
- */
-
-#ifdef Tk_InitImageArgs
-#undef Tk_InitImageArgs
-#endif
-
-void
-Tk_InitImageArgs(interp, argc, argvPtr)
- Tcl_Interp *interp;
- int argc;
- char ***argvPtr;
-{
- static int useNewImage = -1;
- static char **argv = NULL;
-
- if (argv) {
- tclStubsPtr->tcl_Free((char *) argv);
- argv = NULL;
- }
-
- if (useNewImage < 0) {
- Tcl_CmdInfo cmdInfo;
- if (!tclStubsPtr->tcl_GetCommandInfo(interp,"image", &cmdInfo)) {
- tclStubsPtr->tcl_Panic("cannot find the \"image\" command");
- }
- if (cmdInfo.isNativeObjectProc == 1) {
- useNewImage = 1; /* Tk uses the new image interface */
- } else {
- useNewImage = 0; /* Tk uses old image interface */
- }
- }
- if (useNewImage && (argc > 0)) {
- int i;
- argv = (char **) tclStubsPtr->tcl_Alloc(argc * sizeof(char *));
- for (i = 0; i < argc; i++) {
- argv[i] = tclStubsPtr->tcl_GetString((Tcl_Obj *)(*argvPtr)[i]);
- }
- *argvPtr = (char **) argv;
- }
-}
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 6df1f2d..9c154e8 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -1,50 +1,49 @@
-/*
+/*
* tkStubInit.c --
*
* This file contains the initializers for the Tk stub vectors.
*
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
-#if !(defined(__WIN32__) && defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
/* UNIX */
#define UNIX_TK
+#include "tkUnixInt.h"
#endif
#ifdef __WIN32__
#include "tkWinInt.h"
#endif
-#if defined(MAC_TCL)
-/* set this locally .. we could have used _TKMACINT */
-#define MAC_TK
-#include "tkMacInt.h"
-#endif
#if defined(MAC_OSX_TK)
-/* set this locally .. we could have used _TKMACINT */
+/* we could have used _TKMACINT */
#include "tkMacOSXInt.h"
#endif
-#include "tkDecls.h"
+/* TODO: These ought to come in some other way */
#include "tkPlatDecls.h"
-#include "tkIntDecls.h"
-#include "tkIntPlatDecls.h"
#include "tkIntXlibDecls.h"
/*
* Remove macros that will interfere with the definitions below.
*/
-#define Tk_CreateCanvasVisitor ((void (*) _ANSI_ARGS_((Tcl_Interp * interp, \
- VOID * typePtr))) NULL)
-#define Tk_GetCanvasVisitor ((VOID * (*) _ANSI_ARGS_((Tcl_Interp * interp, \
- CONST char * name))) NULL)
+#define Tk_CreateCanvasVisitor \
+ ((void (*)(Tcl_Interp * interp, VOID * typePtr)) NULL)
+#define Tk_GetCanvasVisitor \
+ ((VOID * (*)(Tcl_Interp * interp, CONST char * name)) NULL)
+
+MODULE_SCOPE TkIntStubs tkIntStubs;
+MODULE_SCOPE TkIntPlatStubs tkIntPlatStubs;
+MODULE_SCOPE TkIntXlibStubs tkIntXlibStubs;
+MODULE_SCOPE TkPlatStubs tkPlatStubs;
+MODULE_SCOPE TkStubs tkStubs;
/*
* WARNING: The contents of this file is automatically generated by the
@@ -170,128 +169,108 @@ TkIntStubs tkIntStubs = {
TkpGetSubFonts, /* 110 */
TkpGetSystemDefault, /* 111 */
TkpMenuThreadInit, /* 112 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 113 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkClipBox, /* 113 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkClipBox, /* 113 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 113 */ /* Dummy entry for stubs table backwards compatibility */
TkClipBox, /* 113 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 114 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkCreateRegion, /* 114 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkCreateRegion, /* 114 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 114 */ /* Dummy entry for stubs table backwards compatibility */
TkCreateRegion, /* 114 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 115 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkDestroyRegion, /* 115 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkDestroyRegion, /* 115 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 115 */ /* Dummy entry for stubs table backwards compatibility */
TkDestroyRegion, /* 115 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 116 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkIntersectRegion, /* 116 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkIntersectRegion, /* 116 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 116 */ /* Dummy entry for stubs table backwards compatibility */
TkIntersectRegion, /* 116 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 117 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkRectInRegion, /* 117 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkRectInRegion, /* 117 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 117 */ /* Dummy entry for stubs table backwards compatibility */
TkRectInRegion, /* 117 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 118 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkSetRegion, /* 118 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkSetRegion, /* 118 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 118 */ /* Dummy entry for stubs table backwards compatibility */
TkSetRegion, /* 118 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 119 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkUnionRectWithRegion, /* 119 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkUnionRectWithRegion, /* 119 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 119 */ /* Dummy entry for stubs table backwards compatibility */
TkUnionRectWithRegion, /* 119 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
NULL, /* 120 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 121 */
-#endif /* UNIX */
-#ifdef __WIN32__
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
NULL, /* 121 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 121 */ /* Dummy entry for stubs table backwards compatibility */
TkpCreateNativeBitmap, /* 121 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- TkpCreateNativeBitmap, /* 121 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 122 */
-#endif /* UNIX */
-#ifdef __WIN32__
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
NULL, /* 122 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkpDefineNativeBitmaps, /* 122 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 122 */ /* Dummy entry for stubs table backwards compatibility */
TkpDefineNativeBitmaps, /* 122 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
NULL, /* 123 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 124 */
-#endif /* UNIX */
-#ifdef __WIN32__
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
NULL, /* 124 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 124 */ /* Dummy entry for stubs table backwards compatibility */
TkpGetNativeAppBitmap, /* 124 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- TkpGetNativeAppBitmap, /* 124 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
NULL, /* 125 */
NULL, /* 126 */
NULL, /* 127 */
@@ -312,31 +291,57 @@ TkIntStubs tkIntStubs = {
TkFocusFree, /* 142 */
TkClipCleanup, /* 143 */
TkGCCleanup, /* 144 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
NULL, /* 145 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkSubtractRegion, /* 145 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
+#endif /* X11 */
+#ifdef __WIN32__ /* WIN */
TkSubtractRegion, /* 145 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
+ NULL, /* 145 */ /* Dummy entry for stubs table backwards compatibility */
TkSubtractRegion, /* 145 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
TkStylePkgInit, /* 146 */
TkStylePkgFree, /* 147 */
TkToplevelWindowForCommand, /* 148 */
TkGetOptionSpec, /* 149 */
- NULL, /* 150 */
- NULL, /* 151 */
+ TkMakeRawCurve, /* 150 */
+ TkMakeRawCurvePostscript, /* 151 */
TkpDrawFrame, /* 152 */
+ TkCreateThreadExitHandler, /* 153 */
+ TkDeleteThreadExitHandler, /* 154 */
+ NULL, /* 155 */
+ TkpTestembedCmd, /* 156 */
+ TkpTesttextCmd, /* 157 */
+ NULL, /* 158 */
+ NULL, /* 159 */
+ NULL, /* 160 */
+ NULL, /* 161 */
+ NULL, /* 162 */
+ NULL, /* 163 */
+ NULL, /* 164 */
+ NULL, /* 165 */
+ NULL, /* 166 */
+ NULL, /* 167 */
+ NULL, /* 168 */
+ TkStateParseProc, /* 169 */
+ TkStatePrintProc, /* 170 */
+ TkCanvasDashParseProc, /* 171 */
+ TkCanvasDashPrintProc, /* 172 */
+ TkOffsetParseProc, /* 173 */
+ TkOffsetPrintProc, /* 174 */
+ TkPixelParseProc, /* 175 */
+ TkPixelPrintProc, /* 176 */
+ TkOrientParseProc, /* 177 */
+ TkOrientPrintProc, /* 178 */
+ TkSmoothParseProc, /* 179 */
+ TkSmoothPrintProc, /* 180 */
};
TkIntPlatStubs tkIntPlatStubs = {
TCL_STUB_MAGIC,
NULL,
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
TkAlignImageData, /* 0 */
NULL, /* 1 */
TkGenerateActivateEvents, /* 2 */
@@ -373,77 +378,9 @@ TkIntPlatStubs tkIntPlatStubs = {
TkWinGetPlatformId, /* 33 */
TkWinSetHINSTANCE, /* 34 */
TkWinGetPlatformTheme, /* 35 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkGenerateActivateEvents, /* 0 */
- NULL, /* 1 */
- NULL, /* 2 */
- TkpGetMS, /* 3 */
- NULL, /* 4 */
- TkPointerDeadWindow, /* 5 */
- TkpSetCapture, /* 6 */
- TkpSetCursor, /* 7 */
- TkpWmSetState, /* 8 */
- NULL, /* 9 */
- TkAboutDlg, /* 10 */
- NULL, /* 11 */
- NULL, /* 12 */
- TkGetTransientMaster, /* 13 */
- TkGenerateButtonEvent, /* 14 */
- NULL, /* 15 */
- TkGenWMDestroyEvent, /* 16 */
- NULL, /* 17 */
- TkMacButtonKeyState, /* 18 */
- TkMacClearMenubarActive, /* 19 */
- NULL, /* 20 */
- TkMacDispatchMenuEvent, /* 21 */
- TkMacInstallCursor, /* 22 */
- NULL, /* 23 */
- TkMacHandleTearoffMenu, /* 24 */
- NULL, /* 25 */
- NULL, /* 26 */
- TkMacDoHLEvent, /* 27 */
- NULL, /* 28 */
- TkMacGenerateTime, /* 29 */
- NULL, /* 30 */
- TkMacGetScrollbarGrowWindow, /* 31 */
- TkMacGetXWindow, /* 32 */
- TkMacGrowToplevel, /* 33 */
- TkMacHandleMenuSelect, /* 34 */
- NULL, /* 35 */
- NULL, /* 36 */
- NULL, /* 37 */
- TkMacInvalidateWindow, /* 38 */
- TkMacIsCharacterMissing, /* 39 */
- TkMacMakeRealWindowExist, /* 40 */
- TkMacMakeStippleMap, /* 41 */
- TkMacMenuClick, /* 42 */
- TkMacRegisterOffScreenWindow, /* 43 */
- TkMacResizable, /* 44 */
- NULL, /* 45 */
- TkMacSetHelpMenuItemCount, /* 46 */
- TkMacSetScrollbarGrow, /* 47 */
- TkMacSetUpClippingRgn, /* 48 */
- TkMacSetUpGraphicsPort, /* 49 */
- TkMacUpdateClipRgn, /* 50 */
- TkMacUnregisterMacWindow, /* 51 */
- TkMacUseMenuID, /* 52 */
- TkMacVisableClipRgn, /* 53 */
- TkMacWinBounds, /* 54 */
- TkMacWindowOffset, /* 55 */
- NULL, /* 56 */
- TkSetMacColor, /* 57 */
- TkSetWMName, /* 58 */
- TkSuspendClipboard, /* 59 */
- NULL, /* 60 */
- TkMacZoomToplevel, /* 61 */
- Tk_TopCoordsToWindow, /* 62 */
- TkMacContainerId, /* 63 */
- TkMacGetHostToplevel, /* 64 */
- TkMacPreprocessMenu, /* 65 */
- TkpIsWindowFloating, /* 66 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+ TkWinChildProc, /* 36 */
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
TkGenerateActivateEvents, /* 0 */
NULL, /* 1 */
NULL, /* 2 */
@@ -498,8 +435,8 @@ TkIntPlatStubs tkIntPlatStubs = {
TkGenWMDestroyEvent, /* 51 */
NULL, /* 52 */
TkpGetMS, /* 53 */
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
TkCreateXEventSource, /* 0 */
TkFreeWindowId, /* 1 */
TkInitXId, /* 2 */
@@ -513,13 +450,14 @@ TkIntPlatStubs tkIntPlatStubs = {
TkSendCleanup, /* 10 */
TkFreeXId, /* 11 */
TkpWmSetState, /* 12 */
+ TkpTestsendCmd, /* 13 */
#endif /* X11 */
};
TkIntXlibStubs tkIntXlibStubs = {
TCL_STUB_MAGIC,
NULL,
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
XSetDashes, /* 0 */
XGetModifierMapping, /* 1 */
XCreateImage, /* 2 */
@@ -627,101 +565,8 @@ TkIntXlibStubs tkIntXlibStubs = {
XDrawLine, /* 104 */
XWarpPointer, /* 105 */
XFillRectangle, /* 106 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- XSetDashes, /* 0 */
- XGetModifierMapping, /* 1 */
- XCreateImage, /* 2 */
- XGetImage, /* 3 */
- XGetAtomName, /* 4 */
- XKeysymToString, /* 5 */
- XCreateColormap, /* 6 */
- XGContextFromGC, /* 7 */
- XKeycodeToKeysym, /* 8 */
- XStringToKeysym, /* 9 */
- XRootWindow, /* 10 */
- XSetErrorHandler, /* 11 */
- XAllocColor, /* 12 */
- XBell, /* 13 */
- XChangeProperty, /* 14 */
- XChangeWindowAttributes, /* 15 */
- XConfigureWindow, /* 16 */
- XCopyArea, /* 17 */
- XCopyPlane, /* 18 */
- XCreateBitmapFromData, /* 19 */
- XDefineCursor, /* 20 */
- XDestroyWindow, /* 21 */
- XDrawArc, /* 22 */
- XDrawLines, /* 23 */
- XDrawRectangle, /* 24 */
- XFillArc, /* 25 */
- XFillPolygon, /* 26 */
- XFillRectangles, /* 27 */
- XFreeColormap, /* 28 */
- XFreeColors, /* 29 */
- XFreeModifiermap, /* 30 */
- XGetGeometry, /* 31 */
- XGetWindowProperty, /* 32 */
- XGrabKeyboard, /* 33 */
- XGrabPointer, /* 34 */
- XKeysymToKeycode, /* 35 */
- XMapWindow, /* 36 */
- XMoveResizeWindow, /* 37 */
- XMoveWindow, /* 38 */
- XQueryPointer, /* 39 */
- XRaiseWindow, /* 40 */
- XRefreshKeyboardMapping, /* 41 */
- XResizeWindow, /* 42 */
- XSelectInput, /* 43 */
- XSendEvent, /* 44 */
- XSetIconName, /* 45 */
- XSetInputFocus, /* 46 */
- XSetSelectionOwner, /* 47 */
- XSetWindowBackground, /* 48 */
- XSetWindowBackgroundPixmap, /* 49 */
- XSetWindowBorder, /* 50 */
- XSetWindowBorderPixmap, /* 51 */
- XSetWindowBorderWidth, /* 52 */
- XSetWindowColormap, /* 53 */
- XUngrabKeyboard, /* 54 */
- XUngrabPointer, /* 55 */
- XUnmapWindow, /* 56 */
- TkPutImage, /* 57 */
- XParseColor, /* 58 */
- XCreateGC, /* 59 */
- XFreeGC, /* 60 */
- XInternAtom, /* 61 */
- XSetBackground, /* 62 */
- XSetForeground, /* 63 */
- XSetClipMask, /* 64 */
- XSetClipOrigin, /* 65 */
- XSetTSOrigin, /* 66 */
- XChangeGC, /* 67 */
- XSetFont, /* 68 */
- XSetArcMode, /* 69 */
- XSetStipple, /* 70 */
- XSetFillRule, /* 71 */
- XSetFillStyle, /* 72 */
- XSetFunction, /* 73 */
- XSetLineAttributes, /* 74 */
- _XInitImageFuncPtrs, /* 75 */
- XCreateIC, /* 76 */
- XGetVisualInfo, /* 77 */
- XSetWMClientMachine, /* 78 */
- XStringListToTextProperty, /* 79 */
- XDrawSegments, /* 80 */
- XForceScreenSaver, /* 81 */
- XDrawLine, /* 82 */
- XFillRectangle, /* 83 */
- XClearWindow, /* 84 */
- XDrawPoint, /* 85 */
- XDrawPoints, /* 86 */
- XWarpPointer, /* 87 */
- XQueryColor, /* 88 */
- XQueryColors, /* 89 */
- XQueryTree, /* 90 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
XSetDashes, /* 0 */
XGetModifierMapping, /* 1 */
XCreateImage, /* 2 */
@@ -814,34 +659,21 @@ TkIntXlibStubs tkIntXlibStubs = {
XQueryColors, /* 89 */
XQueryTree, /* 90 */
XSync, /* 91 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
};
TkPlatStubs tkPlatStubs = {
TCL_STUB_MAGIC,
NULL,
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
Tk_AttachHWND, /* 0 */
Tk_GetHINSTANCE, /* 1 */
Tk_GetHWND, /* 2 */
Tk_HWNDToWindow, /* 3 */
Tk_PointerEvent, /* 4 */
Tk_TranslateWinEvent, /* 5 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- Tk_MacSetEmbedHandler, /* 0 */
- Tk_MacTurnOffMenus, /* 1 */
- Tk_MacTkOwnsCursor, /* 2 */
- TkMacInitMenus, /* 3 */
- TkMacInitAppleEvents, /* 4 */
- TkMacConvertEvent, /* 5 */
- TkMacConvertTkEvent, /* 6 */
- TkGenWMConfigureEvent, /* 7 */
- TkMacInvalClipRgns, /* 8 */
- TkMacHaveAppearance, /* 9 */
- TkMacGetDrawablePort, /* 10 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#endif /* WIN */
+#ifdef MAC_OSX_TK /* AQUA */
Tk_MacOSXSetEmbedHandler, /* 0 */
Tk_MacOSXTurnOffMenus, /* 1 */
Tk_MacOSXTkOwnsCursor, /* 2 */
@@ -853,7 +685,7 @@ TkPlatStubs tkPlatStubs = {
TkMacOSXGetRootControl, /* 8 */
Tk_MacOSXSetupTkNotifier, /* 9 */
Tk_MacOSXIsAppInFront, /* 10 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
};
static TkStubHooks tkStubHooks = {
@@ -1014,9 +846,9 @@ TkStubs tkStubs = {
Tk_PhotoPutZoomedBlock_NoComposite, /* 145 */
Tk_PhotoGetImage, /* 146 */
Tk_PhotoBlank, /* 147 */
- Tk_PhotoExpand, /* 148 */
+ Tk_PhotoExpand_Panic, /* 148 */
Tk_PhotoGetSize, /* 149 */
- Tk_PhotoSetSize, /* 150 */
+ Tk_PhotoSetSize_Panic, /* 150 */
Tk_PointToChar, /* 151 */
Tk_PostscriptFontName, /* 152 */
Tk_PreserveColormap, /* 153 */
@@ -1112,8 +944,8 @@ TkStubs tkStubs = {
Tk_SetInternalBorderEx, /* 243 */
Tk_SetMinimumRequestSize, /* 244 */
Tk_SetCaretPos, /* 245 */
- Tk_PhotoPutBlock, /* 246 */
- Tk_PhotoPutZoomedBlock, /* 247 */
+ Tk_PhotoPutBlock_Panic, /* 246 */
+ Tk_PhotoPutZoomedBlock_Panic, /* 247 */
Tk_CollapseMotionEvents, /* 248 */
Tk_RegisterStyleEngine, /* 249 */
Tk_GetStyleEngine, /* 250 */
@@ -1131,10 +963,18 @@ TkStubs tkStubs = {
Tk_GetElementBox, /* 262 */
Tk_GetElementBorderWidth, /* 263 */
Tk_DrawElement, /* 264 */
+ Tk_PhotoExpand, /* 265 */
+ Tk_PhotoPutBlock, /* 266 */
+ Tk_PhotoPutZoomedBlock, /* 267 */
+ Tk_PhotoSetSize, /* 268 */
+ Tk_GetUserInactiveTime, /* 269 */
+ Tk_ResetUserInactiveTime, /* 270 */
+ Tk_Interp, /* 271 */
+ Tk_CreateOldImageType, /* 272 */
+ Tk_CreateOldPhotoImageFormat, /* 273 */
};
/* !END!: Do not edit above this line. */
#undef UNIX_TK
-#undef MAC_TK
#undef MAC_OSX_TK
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c
index 29c4851..5349a0b 100644
--- a/generic/tkStubLib.c
+++ b/generic/tkStubLib.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkStubLib.c --
*
* Stub object that will be statically linked into extensions that wish
@@ -7,15 +7,14 @@
* Copyright (c) 1998 Paul Duffin.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-
/*
- * We need to ensure that we use the stub macros so that this file contains
- * no references to any of the stub functions. This will make it possible
- * to build an extension that references Tk_InitStubs but doesn't end up
+ * We need to ensure that we use the stub macros so that this file contains no
+ * references to any of the stub functions. This will make it possible to
+ * build an extension that references Tk_InitStubs but doesn't end up
* including the rest of the stub functions.
*/
@@ -29,53 +28,50 @@
#endif
#undef USE_TK_STUB_PROCS
-#include "tkPort.h"
#include "tkInt.h"
#ifdef __WIN32__
#include "tkWinInt.h"
#endif
-#ifdef MAC_TCL
-#include "tkMacInt.h"
-#endif
-
#ifdef MAC_OSX_TK
#include "tkMacOSXInt.h"
#endif
-#include "tkDecls.h"
-#include "tkIntDecls.h"
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
+#include "tkUnixInt.h"
+#endif
+
+/* TODO: These ought to come in some other way */
#include "tkPlatDecls.h"
-#include "tkIntPlatDecls.h"
#include "tkIntXlibDecls.h"
+TkStubs *tkStubsPtr = NULL;
+TkPlatStubs *tkPlatStubsPtr = NULL;
+TkIntStubs *tkIntStubsPtr = NULL;
+TkIntPlatStubs *tkIntPlatStubsPtr = NULL;
+TkIntXlibStubs *tkIntXlibStubsPtr = NULL;
+
/*
- * Ensure that Tk_InitStubs is built as an exported symbol. The other stub
- * functions should be built as non-exported symbols.
+ * Use our own isdigit to avoid linking to libc on windows
*/
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLEXPORT
-
-TkStubs *tkStubsPtr;
-TkPlatStubs *tkPlatStubsPtr;
-TkIntStubs *tkIntStubsPtr;
-TkIntPlatStubs *tkIntPlatStubsPtr;
-TkIntXlibStubs *tkIntXlibStubsPtr;
-
+static int isDigit(const int c)
+{
+ return (c >= '0' && c <= '9');
+}
/*
*----------------------------------------------------------------------
*
* Tk_InitStubs --
*
- * Checks that the correct version of Tk is loaded and that it
- * supports stubs. It then initialises the stub table pointers.
+ * Checks that the correct version of Tk is loaded and that it supports
+ * stubs. It then initialises the stub table pointers.
*
* Results:
- * The actual version of Tk that satisfies the request, or
- * NULL to indicate that an error occurred.
+ * The actual version of Tk that satisfies the request, or NULL to
+ * indicate that an error occurred.
*
* Side effects:
* Sets the stub table pointers.
@@ -88,18 +84,46 @@ TkIntXlibStubs *tkIntXlibStubsPtr;
#endif
CONST char *
-Tk_InitStubs(interp, version, exact)
- Tcl_Interp *interp;
- char *version;
- int exact;
+Tk_InitStubs(
+ Tcl_Interp *interp,
+ CONST char *version,
+ int exact)
{
CONST char *actualVersion;
+ TkStubs **stubsPtrPtr = &tkStubsPtr; /* squelch warning */
- actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, exact,
- (ClientData *) &tkStubsPtr);
+ actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0,
+ (ClientData *) stubsPtrPtr);
if (!actualVersion) {
return NULL;
}
+ if (exact) {
+ CONST char *p = version;
+ int count = 0;
+
+ while (*p) {
+ count += !isDigit(*p++);
+ }
+ if (count == 1) {
+ CONST char *q = actualVersion;
+
+ p = version;
+ while (*p && (*p == *q)) {
+ p++; q++;
+ }
+ if (*p) {
+ /* Construct error message */
+ Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL);
+ return NULL;
+
+ }
+ } else {
+ actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL);
+ if (actualVersion == NULL) {
+ return NULL;
+ }
+ }
+ }
if (!tkStubsPtr) {
Tcl_SetResult(interp,
@@ -107,11 +131,19 @@ Tk_InitStubs(interp, version, exact)
TCL_STATIC);
return NULL;
}
-
+
tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs;
tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs;
tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs;
tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs;
-
+
return actualVersion;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index e802dde..80d4e59 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkStyle.c --
*
* This file implements the widget styles and themes support.
@@ -6,96 +6,91 @@
* Copyright (c) 1990-1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
/*
- * The following structure is used to cache widget option specs matching an
+ * The following structure is used to cache widget option specs matching an
* element's required options defined by Tk_ElementOptionSpecs. It also holds
* information behind Tk_StyledElement opaque tokens.
*/
typedef struct StyledWidgetSpec {
- struct StyledElement *elementPtr; /* Pointer to the element holding this
- * structure. */
- Tk_OptionTable optionTable; /* Option table for the widget class
- * using the element. */
- CONST Tk_OptionSpec **optionsPtr; /* Table of option spec pointers,
- * matching the option list provided
- * during element registration.
- * Malloc'd. */
+ struct StyledElement *elementPtr;
+ /* Pointer to the element holding this
+ * structure. */
+ Tk_OptionTable optionTable; /* Option table for the widget class using the
+ * element. */
+ CONST Tk_OptionSpec **optionsPtr;
+ /* Table of option spec pointers, matching the
+ * option list provided during element
+ * registration. Malloc'd. */
} StyledWidgetSpec;
/*
- * Elements are declared using static templates. But static
- * information must be completed by dynamic information only
- * accessible at runtime. For each registered element, an instance of
- * the following structure is stored in each style engine and used to
- * cache information about the widget types (identified by their
- * optionTable) that use the given element.
+ * Elements are declared using static templates. But static information must
+ * be completed by dynamic information only accessible at runtime. For each
+ * registered element, an instance of the following structure is stored in
+ * each style engine and used to cache information about the widget types
+ * (identified by their optionTable) that use the given element.
*/
typedef struct StyledElement {
- struct Tk_ElementSpec *specPtr;
- /* Filled with template provided during
- * registration. NULL means no implementation
- * is available for the current engine. */
- int nbWidgetSpecs; /* Size of the array below. Number of distinct
- * widget classes (actually, distinct option
+ struct Tk_ElementSpec *specPtr;
+ /* Filled with template provided during
+ * registration. NULL means no implementation
+ * is available for the current engine. */
+ int nbWidgetSpecs; /* Size of the array below. Number of distinct
+ * widget classes (actually, distinct option
* tables) that used the element so far. */
- StyledWidgetSpec *widgetSpecs;
+ StyledWidgetSpec *widgetSpecs;
/* See above for the structure definition.
- * Table grows dynamically as new widgets
- * use the element. Malloc'd. */
+ * Table grows dynamically as new widgets use
+ * the element. Malloc'd. */
} StyledElement;
/*
- * The following structure holds information behind Tk_StyleEngine opaque
+ * The following structure holds information behind Tk_StyleEngine opaque
* tokens.
*/
typedef struct StyleEngine {
CONST char *name; /* Name of engine. Points to a hash key. */
- StyledElement *elements; /* Table of widget element descriptors. Each
- * element is indexed by a unique system-wide
- * ID. Table grows dynamically as new elements
+ StyledElement *elements; /* Table of widget element descriptors. Each
+ * element is indexed by a unique system-wide
+ * ID. Table grows dynamically as new elements
* are registered. Malloc'd*/
- struct StyleEngine *parentPtr;
- /* Parent engine. Engines may be layered to form
- * a fallback chain, terminated by the default
- * system engine. */
+ struct StyleEngine *parentPtr;
+ /* Parent engine. Engines may be layered to
+ * form a fallback chain, terminated by the
+ * default system engine. */
} StyleEngine;
/*
- * Styles are instances of style engines. The following structure holds
+ * Styles are instances of style engines. The following structure holds
* information behind Tk_Style opaque tokens.
*/
typedef struct Style {
- int refCount; /* Number of active uses of this style.
- * If this count is 0, then this Style
- * structure is no longer valid. */
- Tcl_HashEntry *hashPtr; /* Entry in style table for this structure,
- * used when deleting it. */
CONST char *name; /* Name of style. Points to a hash key. */
- StyleEngine *enginePtr; /* Style engine of which the style is an
+ StyleEngine *enginePtr; /* Style engine of which the style is an
* instance. */
ClientData clientData; /* Data provided during registration. */
} Style;
/*
- * Each registered element uses an instance of the following structure.
+ * Each registered element uses an instance of the following structure.
*/
typedef struct Element {
CONST char *name; /* Name of element. Points to a hash key. */
int id; /* Id of element. */
int genericId; /* Id of generic element. */
- int created; /* Boolean, whether the element was created
- * explicitly (was registered) or implicitly
+ int created; /* Boolean, whether the element was created
+ * explicitly (was registered) or implicitly
* (by a derived element). */
} Element;
@@ -105,66 +100,54 @@ typedef struct Element {
typedef struct ThreadSpecificData {
int nbInit; /* Number of calls to the init proc. */
- Tcl_HashTable engineTable; /* Map a name to a style engine. Keys are
- * strings, values are Tk_StyleEngine
+ Tcl_HashTable engineTable; /* Map a name to a style engine. Keys are
+ * strings, values are Tk_StyleEngine
* pointers. */
- StyleEngine *defaultEnginePtr;
- /* Default, core-defined style engine. Global
+ StyleEngine *defaultEnginePtr;
+ /* Default, core-defined style engine. Global
* fallback for all engines. */
- Tcl_HashTable styleTable; /* Map a name to a style. Keys are strings,
+ Tcl_HashTable styleTable; /* Map a name to a style. Keys are strings,
* values are Tk_Style pointers.*/
int nbElements; /* Size of the below tables. */
- Tcl_HashTable elementTable; /* Map a name to an element Id. Keys are
+ Tcl_HashTable elementTable; /* Map a name to an element Id. Keys are
* strings, values are integer element IDs. */
- Element *elements; /* Array of Elements. */
+ Element *elements; /* Array of Elements. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-/* TODO: sort alpha. */
-static int CreateElement _ANSI_ARGS_((CONST char *name,
- int create));
-static void DupStyleObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr,
- Tcl_Obj *dupObjPtr));
-static void FreeElement _ANSI_ARGS_((Element *elementPtr));
-static void FreeStyle _ANSI_ARGS_((Style *stylePtr));
-static void FreeStyledElement _ANSI_ARGS_((
- StyledElement *elementPtr));
-static void FreeStyleEngine _ANSI_ARGS_((
- StyleEngine *enginePtr));
-static void FreeStyleObjProc _ANSI_ARGS_((Tcl_Obj *objPtr));
-static void FreeWidgetSpec _ANSI_ARGS_((
- StyledWidgetSpec *widgetSpecPtr));
-static StyledElement * GetStyledElement _ANSI_ARGS_((
- StyleEngine *enginePtr, int elementId));
-static StyledWidgetSpec * GetWidgetSpec _ANSI_ARGS_((StyledElement *elementPtr,
- Tk_OptionTable optionTable));
-static void InitElement _ANSI_ARGS_((Element *elementPtr,
- CONST char *name, int id, int genericId,
- int created));
-static void InitStyle _ANSI_ARGS_((Style *stylePtr,
- Tcl_HashEntry *hashPtr, CONST char *name,
- StyleEngine *enginePtr, ClientData clientData));
-static void InitStyledElement _ANSI_ARGS_((
- StyledElement *elementPtr));
-static void InitStyleEngine _ANSI_ARGS_((StyleEngine *enginePtr,
- CONST char *name, StyleEngine *parentPtr));
-static void InitWidgetSpec _ANSI_ARGS_((
- StyledWidgetSpec *widgetSpecPtr,
- StyledElement *elementPtr,
- Tk_OptionTable optionTable));
-static int SetStyleFromAny _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Obj *objPtr));
+static int CreateElement(CONST char *name, int create);
+static void DupStyleObjProc(Tcl_Obj *srcObjPtr,
+ Tcl_Obj *dupObjPtr);
+static void FreeElement(Element *elementPtr);
+static void FreeStyledElement(StyledElement *elementPtr);
+static void FreeStyleEngine(StyleEngine *enginePtr);
+static void FreeStyleObjProc(Tcl_Obj *objPtr);
+static void FreeWidgetSpec(StyledWidgetSpec *widgetSpecPtr);
+static StyledElement * GetStyledElement(StyleEngine *enginePtr,
+ int elementId);
+static StyledWidgetSpec*GetWidgetSpec(StyledElement *elementPtr,
+ Tk_OptionTable optionTable);
+static void InitElement(Element *elementPtr, CONST char *name,
+ int id, int genericId, int created);
+static void InitStyle(Style *stylePtr, CONST char *name,
+ StyleEngine *enginePtr, ClientData clientData);
+static void InitStyledElement(StyledElement *elementPtr);
+static void InitStyleEngine(StyleEngine *enginePtr,
+ CONST char *name, StyleEngine *parentPtr);
+static void InitWidgetSpec(StyledWidgetSpec *widgetSpecPtr,
+ StyledElement *elementPtr,
+ Tk_OptionTable optionTable);
+static int SetStyleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
/*
* The following structure defines the implementation of the "style" Tcl
- * object, used for drawing. The internalRep.otherValuePtr field of
- * each style object points to the Style structure for the stylefont, or
- * NULL.
+ * object, used for drawing. The internalRep.otherValuePtr field of each style
+ * object points to the Style structure for the stylefont, or NULL.
*/
static Tcl_ObjType styleObjType = {
@@ -180,9 +163,9 @@ static Tcl_ObjType styleObjType = {
*
* TkStylePkgInit --
*
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the style
- * package on a per application basis.
+ * This function is called when an application is created. It initializes
+ * all the structures that are used by the style package on a per
+ * application basis.
*
* Results:
* Stores data in thread-local storage.
@@ -194,13 +177,15 @@ static Tcl_ObjType styleObjType = {
*/
void
-TkStylePkgInit(mainPtr)
- TkMainInfo *mainPtr; /* The application being created. */
+TkStylePkgInit(
+ TkMainInfo *mainPtr) /* The application being created. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- if (tsdPtr->nbInit != 0) return;
+ if (tsdPtr->nbInit != 0) {
+ return;
+ }
/*
* Initialize tables.
@@ -215,15 +200,15 @@ TkStylePkgInit(mainPtr)
/*
* Create the default system engine.
*/
-
- tsdPtr->defaultEnginePtr =
- (StyleEngine *) Tk_RegisterStyleEngine(NULL, NULL);
+
+ tsdPtr->defaultEnginePtr = (StyleEngine *)
+ Tk_RegisterStyleEngine(NULL, NULL);
/*
* Create the default system style.
*/
- Tk_CreateStyle(NULL, (Tk_StyleEngine) tsdPtr->defaultEnginePtr,
+ Tk_CreateStyle(NULL, (Tk_StyleEngine) tsdPtr->defaultEnginePtr,
(ClientData) 0);
tsdPtr->nbInit++;
@@ -234,9 +219,9 @@ TkStylePkgInit(mainPtr)
*
* TkStylePkgFree --
*
- * This procedure is called when an application is deleted. It
- * deletes all the structures that were used by the style package
- * for this application.
+ * This function is called when an application is deleted. It deletes all
+ * the structures that were used by the style package for this
+ * application.
*
* Results:
* None.
@@ -248,18 +233,20 @@ TkStylePkgInit(mainPtr)
*/
void
-TkStylePkgFree(mainPtr)
- TkMainInfo *mainPtr; /* The application being deleted. */
+TkStylePkgFree(
+ TkMainInfo *mainPtr) /* The application being deleted. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
StyleEngine *enginePtr;
int i;
tsdPtr->nbInit--;
- if (tsdPtr->nbInit != 0) return;
+ if (tsdPtr->nbInit != 0) {
+ return;
+ }
/*
* Free styles.
@@ -301,11 +288,12 @@ TkStylePkgFree(mainPtr)
*
* Tk_RegisterStyleEngine --
*
- * This procedure is called to register a new style engine. Style engines
+ * This function is called to register a new style engine. Style engines
* are stored in thread-local space.
*
* Results:
- * The newly allocated engine.
+ * The newly allocated engine, or NULL if an engine with the same name
+ * exists.
*
* Side effects:
* Memory allocated. Data added to thread-local table.
@@ -314,24 +302,24 @@ TkStylePkgFree(mainPtr)
*/
Tk_StyleEngine
-Tk_RegisterStyleEngine(name, parent)
- CONST char *name; /* Name of the engine to create. NULL or empty
+Tk_RegisterStyleEngine(
+ CONST char *name, /* Name of the engine to create. NULL or empty
* means the default system engine. */
- Tk_StyleEngine parent; /* The engine's parent. NULL means the default
+ Tk_StyleEngine parent) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
StyleEngine *enginePtr;
/*
- * Attempt to create a new entry in the engine table.
+ * Attempt to create a new entry in the engine table.
*/
- entryPtr = Tcl_CreateHashEntry(&tsdPtr->engineTable, (name?name:""),
- &newEntry);
+ entryPtr = Tcl_CreateHashEntry(&tsdPtr->engineTable,
+ (name != NULL ? name : ""), &newEntry);
if (!newEntry) {
/*
* An engine was already registered by that name.
@@ -369,16 +357,16 @@ Tk_RegisterStyleEngine(name, parent)
*/
static void
-InitStyleEngine(enginePtr, name, parentPtr)
- StyleEngine *enginePtr; /* Points to an uninitialized engine. */
- CONST char *name; /* Name of the registered engine. NULL or empty
+InitStyleEngine(
+ StyleEngine *enginePtr, /* Points to an uninitialized engine. */
+ CONST char *name, /* Name of the registered engine. NULL or empty
* means the default system engine. Usually
* points to the hash key. */
- StyleEngine *parentPtr; /* The engine's parent. NULL means the default
+ StyleEngine *parentPtr) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
if (name == NULL || *name == '\0') {
@@ -399,8 +387,8 @@ InitStyleEngine(enginePtr, name, parentPtr)
enginePtr->parentPtr = parentPtr;
}
- /*
- * Allocate and initialize elements array.
+ /*
+ * Allocate and initialize elements array.
*/
if (tsdPtr->nbElements > 0) {
@@ -431,11 +419,11 @@ InitStyleEngine(enginePtr, name, parentPtr)
*/
static void
-FreeStyleEngine(enginePtr)
- StyleEngine *enginePtr; /* The style engine to free. */
+FreeStyleEngine(
+ StyleEngine *enginePtr) /* The style engine to free. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
/*
@@ -465,19 +453,19 @@ FreeStyleEngine(enginePtr)
*/
Tk_StyleEngine
-Tk_GetStyleEngine(name)
- CONST char *name; /* Name of the engine to retrieve. NULL or
+Tk_GetStyleEngine(
+ CONST char *name) /* Name of the engine to retrieve. NULL or
* empty means the default system engine. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
if (name == NULL) {
return (Tk_StyleEngine) tsdPtr->defaultEnginePtr;
}
- entryPtr = Tcl_FindHashEntry(&tsdPtr->engineTable, (name?name:""));
+ entryPtr = Tcl_FindHashEntry(&tsdPtr->engineTable, (name!=NULL?name:""));
if (!entryPtr) {
return NULL;
}
@@ -502,14 +490,14 @@ Tk_GetStyleEngine(name)
*/
static void
-InitElement(elementPtr, name, id, genericId, created)
- Element *elementPtr; /* Points to an uninitialized element.*/
- CONST char *name; /* Name of the registered element. Usually
+InitElement(
+ Element *elementPtr, /* Points to an uninitialized element.*/
+ CONST char *name, /* Name of the registered element. Usually
* points to the hash key. */
- int id; /* Unique element ID. */
- int genericId; /* ID of generic element. -1 means none. */
- int created; /* Boolean, whether the element was created
- * explicitly (was registered) or implicitly
+ int id, /* Unique element ID. */
+ int genericId, /* ID of generic element. -1 means none. */
+ int created) /* Boolean, whether the element was created
+ * explicitly (was registered) or implicitly
* (by a derived element). */
{
elementPtr->name = name;
@@ -535,8 +523,8 @@ InitElement(elementPtr, name, id, genericId, created)
*/
static void
-FreeElement(elementPtr)
- Element *elementPtr; /* The element to free. */
+FreeElement(
+ Element *elementPtr) /* The element to free. */
{
/* Nothing to do. */
}
@@ -558,8 +546,8 @@ FreeElement(elementPtr)
*/
static void
-InitStyledElement(elementPtr)
- StyledElement *elementPtr; /* Points to an uninitialized element.*/
+InitStyledElement(
+ StyledElement *elementPtr) /* Points to an uninitialized element.*/
{
memset(elementPtr, 0, sizeof(StyledElement));
}
@@ -581,8 +569,8 @@ InitStyledElement(elementPtr)
*/
static void
-FreeStyledElement(elementPtr)
- StyledElement *elementPtr; /* The styled element to free. */
+FreeStyledElement(
+ StyledElement *elementPtr) /* The styled element to free. */
{
int i;
@@ -613,14 +601,14 @@ FreeStyledElement(elementPtr)
*/
static int
-CreateElement(name, create)
- CONST char *name; /* Name of the element. */
- int create; /* Boolean, whether the element is being created
- * explicitly (being registered) or implicitly (by a
+CreateElement(
+ CONST char *name, /* Name of the element. */
+ int create) /* Boolean, whether the element is being created
+ * explicitly (being registered) or implicitly (by a
* derived element). */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr, *engineEntryPtr;
Tcl_HashSearch search;
int newEntry;
@@ -634,7 +622,7 @@ CreateElement(name, create)
entryPtr = Tcl_CreateHashEntry(&tsdPtr->elementTable, name, &newEntry);
if (!newEntry) {
- elementId = (int) Tcl_GetHashValue(entryPtr);
+ elementId = PTR2INT(Tcl_GetHashValue(entryPtr));
if (create) {
tsdPtr->elements[elementId].created = 1;
}
@@ -642,8 +630,8 @@ CreateElement(name, create)
}
/*
- * The element didn't exist. If it's a derived element, find or
- * create its generic element ID.
+ * The element didn't exist. If it's a derived element, find or create its
+ * generic element ID.
*/
dot = strchr(name, '.');
@@ -652,15 +640,15 @@ CreateElement(name, create)
}
elementId = tsdPtr->nbElements++;
- Tcl_SetHashValue(entryPtr, (ClientData) elementId);
+ Tcl_SetHashValue(entryPtr, (ClientData) INT2PTR(elementId));
/*
* Reallocate element table.
*/
- tsdPtr->elements = (Element *) ckrealloc((char *) tsdPtr->elements,
+ tsdPtr->elements = (Element *) ckrealloc((char *) tsdPtr->elements,
sizeof(Element) * tsdPtr->nbElements);
- InitElement(tsdPtr->elements+elementId,
+ InitElement(tsdPtr->elements+elementId,
Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId,
genericId, create);
@@ -673,7 +661,7 @@ CreateElement(name, create)
enginePtr = (StyleEngine *) Tcl_GetHashValue(engineEntryPtr);
enginePtr->elements = (StyledElement *) ckrealloc(
- (char *) enginePtr->elements,
+ (char *) enginePtr->elements,
sizeof(StyledElement) * tsdPtr->nbElements);
InitStyledElement(enginePtr->elements+elementId);
@@ -700,11 +688,11 @@ CreateElement(name, create)
*/
int
-Tk_GetElementId(name)
- CONST char *name; /* Name of the element. */
+Tk_GetElementId(
+ CONST char *name) /* Name of the element. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int genericId = -1;
char *dot;
@@ -715,11 +703,11 @@ Tk_GetElementId(name)
entryPtr = Tcl_FindHashEntry(&tsdPtr->elementTable, name);
if (entryPtr) {
- return (int) Tcl_GetHashValue(entryPtr);
+ return PTR2INT(Tcl_GetHashValue(entryPtr));
}
/*
- * Element not found. If the given name was derived, then first search for
+ * Element not found. If the given name was derived, then first search for
* the generic element. If found, create the new derived element.
*/
@@ -732,7 +720,7 @@ Tk_GetElementId(name)
return -1;
}
if (!tsdPtr->elements[genericId].created) {
- /*
+ /*
* The generic element was created implicitly and thus has no real
* existence.
*/
@@ -753,8 +741,8 @@ Tk_GetElementId(name)
*
* Tk_RegisterStyledElement --
*
- * Register an implementation of a new or existing element for the
- * given style engine.
+ * Register an implementation of a new or existing element for the given
+ * style engine.
*
* Results:
* The unique ID for the created or found element.
@@ -766,11 +754,11 @@ Tk_GetElementId(name)
*/
int
-Tk_RegisterStyledElement(engine, templatePtr)
- Tk_StyleEngine engine; /* Style engine providing the
- * implementation. */
- Tk_ElementSpec *templatePtr; /* Static template information about
- * the element. */
+Tk_RegisterStyledElement(
+ Tk_StyleEngine engine, /* Style engine providing the
+ * implementation. */
+ Tk_ElementSpec *templatePtr)/* Static template information about the
+ * element. */
{
int elementId;
StyledElement *elementPtr;
@@ -791,7 +779,7 @@ Tk_RegisterStyledElement(engine, templatePtr)
}
/*
- * Register the element, allocating storage in the various engines if
+ * Register the element, allocating storage in the various engines if
* necessary.
*/
@@ -809,13 +797,13 @@ Tk_RegisterStyledElement(engine, templatePtr)
strcpy(specPtr->name, templatePtr->name);
nbOptions = 0;
for (nbOptions = 0, srcOptions = templatePtr->options;
- srcOptions->name != NULL;
- nbOptions++, srcOptions++);
- specPtr->options = (Tk_ElementOptionSpec *) ckalloc(
- sizeof(Tk_ElementOptionSpec) * (nbOptions+1));
+ srcOptions->name != NULL; nbOptions++, srcOptions++) {
+ /* empty body */
+ }
+ specPtr->options = (Tk_ElementOptionSpec *)
+ ckalloc(sizeof(Tk_ElementOptionSpec) * (nbOptions+1));
for (srcOptions = templatePtr->options, dstOptions = specPtr->options;
- /* End condition within loop */;
- srcOptions++, dstOptions++) {
+ /* End condition within loop */; srcOptions++, dstOptions++) {
if (srcOptions->name == NULL) {
dstOptions->name = NULL;
break;
@@ -842,8 +830,8 @@ Tk_RegisterStyledElement(engine, templatePtr)
*
* GetStyledElement --
*
- * Get a registered implementation of an existing element for the
- * given style engine.
+ * Get a registered implementation of an existing element for the given
+ * style engine.
*
* Results:
* The styled element descriptor, or NULL if not found.
@@ -855,12 +843,13 @@ Tk_RegisterStyledElement(engine, templatePtr)
*/
static StyledElement *
-GetStyledElement(enginePtr, elementId)
- StyleEngine *enginePtr; /* Style engine providing the implementation.
+GetStyledElement(
+ StyleEngine *enginePtr, /* Style engine providing the implementation.
* NULL means the default system engine. */
- int elementId; /* Unique element ID */{
+ int elementId) /* Unique element ID */
+{
StyledElement *elementPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
StyleEngine *enginePtr2;
@@ -913,11 +902,11 @@ GetStyledElement(enginePtr, elementId)
*/
static void
-InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable)
- StyledWidgetSpec *widgetSpecPtr; /* Points to an uninitialized widget
- * spec. */
- StyledElement *elementPtr; /* Styled element descriptor. */
- Tk_OptionTable optionTable; /* The widget's option table. */
+InitWidgetSpec(
+ StyledWidgetSpec *widgetSpecPtr,
+ /* Points to an uninitialized widget spec. */
+ StyledElement *elementPtr, /* Styled element descriptor. */
+ Tk_OptionTable optionTable) /* The widget's option table. */
{
int i, nbOptions;
Tk_ElementOptionSpec *elementOptionPtr;
@@ -925,33 +914,32 @@ InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable)
widgetSpecPtr->elementPtr = elementPtr;
widgetSpecPtr->optionTable = optionTable;
-
+
/*
* Count the number of options.
*/
- for (nbOptions = 0, elementOptionPtr = elementPtr->specPtr->options;
- elementOptionPtr->name != NULL;
- nbOptions++, elementOptionPtr++) {
+ for (nbOptions = 0, elementOptionPtr = elementPtr->specPtr->options;
+ elementOptionPtr->name != NULL; nbOptions++, elementOptionPtr++) {
+ /* empty body */
}
/*
* Build the widget option list.
*/
- widgetSpecPtr->optionsPtr = (CONST Tk_OptionSpec **) ckalloc(
- sizeof(Tk_OptionSpec *) * nbOptions);
- for (i = 0, elementOptionPtr = elementPtr->specPtr->options;
- i < nbOptions;
- i++, elementOptionPtr++) {
+ widgetSpecPtr->optionsPtr = (CONST Tk_OptionSpec **)
+ ckalloc(sizeof(Tk_OptionSpec *) * nbOptions);
+ for (i = 0, elementOptionPtr = elementPtr->specPtr->options;
+ i < nbOptions; i++, elementOptionPtr++) {
widgetOptionPtr = TkGetOptionSpec(elementOptionPtr->name, optionTable);
/*
- * Check that the widget option type is compatible with one of the
+ * Check that the widget option type is compatible with one of the
* element's required types.
*/
- if ( elementOptionPtr->type == TK_OPTION_END
+ if (elementOptionPtr->type == TK_OPTION_END
|| elementOptionPtr->type == widgetOptionPtr->type) {
widgetSpecPtr->optionsPtr[i] = widgetOptionPtr;
} else {
@@ -977,8 +965,9 @@ InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable)
*/
static void
-FreeWidgetSpec(widgetSpecPtr)
- StyledWidgetSpec *widgetSpecPtr; /* The widget spec to free. */
+FreeWidgetSpec(
+ StyledWidgetSpec *widgetSpecPtr)
+ /* The widget spec to free. */
{
ckfree((char *) widgetSpecPtr->optionsPtr);
}
@@ -988,8 +977,8 @@ FreeWidgetSpec(widgetSpecPtr)
*
* GetWidgetSpec --
*
- * Return a new or existing widget spec for the given element and
- * widget type (identified by its option table).
+ * Return a new or existing widget spec for the given element and widget
+ * type (identified by its option table).
*
* Results:
* A pointer to the matching widget spec.
@@ -1001,9 +990,9 @@ FreeWidgetSpec(widgetSpecPtr)
*/
static StyledWidgetSpec *
-GetWidgetSpec(elementPtr, optionTable)
- StyledElement *elementPtr; /* Styled element descriptor. */
- Tk_OptionTable optionTable; /* The widget's option table. */
+GetWidgetSpec(
+ StyledElement *elementPtr, /* Styled element descriptor. */
+ Tk_OptionTable optionTable) /* The widget's option table. */
{
StyledWidgetSpec *widgetSpecPtr;
int i;
@@ -1025,7 +1014,7 @@ GetWidgetSpec(elementPtr, optionTable)
i = elementPtr->nbWidgetSpecs++;
elementPtr->widgetSpecs = (StyledWidgetSpec *) ckrealloc(
- (char *) elementPtr->widgetSpecs,
+ (char *) elementPtr->widgetSpecs,
sizeof(StyledWidgetSpec) * elementPtr->nbWidgetSpecs);
widgetSpecPtr = elementPtr->widgetSpecs+i;
InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable);
@@ -1038,7 +1027,7 @@ GetWidgetSpec(elementPtr, optionTable)
*
* Tk_GetStyledElement --
*
- * This procedure returns a styled instance of the given element.
+ * This function returns a styled instance of the given element.
*
* Results:
* None.
@@ -1050,10 +1039,10 @@ GetWidgetSpec(elementPtr, optionTable)
*/
Tk_StyledElement
-Tk_GetStyledElement(style, elementId, optionTable)
- Tk_Style style; /* The widget style. */
- int elementId; /* Unique element ID. */
- Tk_OptionTable optionTable; /* Option table for the widget. */
+Tk_GetStyledElement(
+ Tk_Style style, /* The widget style. */
+ int elementId, /* Unique element ID. */
+ Tk_OptionTable optionTable) /* Option table for the widget. */
{
Style *stylePtr = (Style *) style;
StyledElement *elementPtr;
@@ -1062,7 +1051,7 @@ Tk_GetStyledElement(style, elementId, optionTable)
* Get an element implementation and call corresponding hook.
*/
- elementPtr = GetStyledElement((stylePtr?stylePtr->enginePtr:NULL),
+ elementPtr = GetStyledElement((stylePtr?stylePtr->enginePtr:NULL),
elementId);
if (!elementPtr) {
return NULL;
@@ -1076,7 +1065,7 @@ Tk_GetStyledElement(style, elementId, optionTable)
*
* Tk_GetElementSize --
*
- * This procedure computes the size of the given widget element according
+ * This function computes the size of the given widget element according
* to its style.
*
* Results:
@@ -1089,26 +1078,25 @@ Tk_GetStyledElement(style, elementId, optionTable)
*/
void
-Tk_GetElementSize(style, element, recordPtr, tkwin, width, height, inner, widthPtr,
- heightPtr)
- Tk_Style style; /* The widget style. */
- Tk_StyledElement element; /* The styled element, previously
- * returned by Tk_GetStyledElement. */
- char *recordPtr; /* The widget record. */
- Tk_Window tkwin; /* The widget window. */
- int width, height; /* Requested size. */
- int inner; /* Boolean. If TRUE, compute the outer
- * size according to the requested
- * minimum inner size. If FALSE, compute
- * the inner size according to the
- * requested maximum outer size. */
- int *widthPtr, *heightPtr; /* Returned size. */
+Tk_GetElementSize(
+ Tk_Style style, /* The widget style. */
+ Tk_StyledElement element, /* The styled element, previously returned by
+ * Tk_GetStyledElement. */
+ char *recordPtr, /* The widget record. */
+ Tk_Window tkwin, /* The widget window. */
+ int width, int height, /* Requested size. */
+ int inner, /* If TRUE, compute the outer size according
+ * to the requested minimum inner size. If
+ * FALSE, compute the inner size according to
+ * the requested maximum outer size. */
+ int *widthPtr, int *heightPtr)
+ /* Returned size. */
{
Style *stylePtr = (Style *) style;
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
- widgetSpecPtr->elementPtr->specPtr->getSize(stylePtr->clientData,
- recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner,
+ widgetSpecPtr->elementPtr->specPtr->getSize(stylePtr->clientData,
+ recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner,
widthPtr, heightPtr);
}
@@ -1117,9 +1105,9 @@ Tk_GetElementSize(style, element, recordPtr, tkwin, width, height, inner, widthP
*
* Tk_GetElementBox --
*
- * This procedure computes the bounding or inscribed box coordinates
- * of the given widget element according to its style and within the
- * given limits.
+ * This function computes the bounding or inscribed box coordinates of
+ * the given widget element according to its style and within the given
+ * limits.
*
* Results:
* None.
@@ -1131,29 +1119,27 @@ Tk_GetElementSize(style, element, recordPtr, tkwin, width, height, inner, widthP
*/
void
-Tk_GetElementBox(style, element, recordPtr, tkwin, x, y, width, height, inner,
- xPtr, yPtr, widthPtr, heightPtr)
- Tk_Style style; /* The widget style. */
- Tk_StyledElement element; /* The styled element, previously
- * returned by Tk_GetStyledElement. */
- char *recordPtr; /* The widget record. */
- Tk_Window tkwin; /* The widget window. */
- int x, y; /* Top left corner of available area. */
- int width, height; /* Size of available area. */
- int inner; /* Boolean. If TRUE, compute the
- * bounding box according to the
- * requested inscribed box size. If
- * FALSE, compute the inscribed box
- * according to the requested bounding
- * box. */
- int *xPtr, *yPtr; /* Returned top left corner. */
- int *widthPtr, *heightPtr; /* Returned size. */
+Tk_GetElementBox(
+ Tk_Style style, /* The widget style. */
+ Tk_StyledElement element, /* The styled element, previously returned by
+ * Tk_GetStyledElement. */
+ char *recordPtr, /* The widget record. */
+ Tk_Window tkwin, /* The widget window. */
+ int x, int y, /* Top left corner of available area. */
+ int width, int height, /* Size of available area. */
+ int inner, /* Boolean. If TRUE, compute the bounding box
+ * according to the requested inscribed box
+ * size. If FALSE, compute the inscribed box
+ * according to the requested bounding box. */
+ int *xPtr, int *yPtr, /* Returned top left corner. */
+ int *widthPtr, int *heightPtr)
+ /* Returned size. */
{
Style *stylePtr = (Style *) style;
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
- widgetSpecPtr->elementPtr->specPtr->getBox(stylePtr->clientData,
- recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height,
+ widgetSpecPtr->elementPtr->specPtr->getBox(stylePtr->clientData,
+ recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height,
inner, xPtr, yPtr, widthPtr, heightPtr);
}
@@ -1162,7 +1148,7 @@ Tk_GetElementBox(style, element, recordPtr, tkwin, x, y, width, height, inner,
*
* Tk_GetElementBorderWidth --
*
- * This procedure computes the border widthof the given widget element
+ * This function computes the border widthof the given widget element
* according to its style and within the given limits.
*
* Results:
@@ -1175,12 +1161,12 @@ Tk_GetElementBox(style, element, recordPtr, tkwin, x, y, width, height, inner,
*/
int
-Tk_GetElementBorderWidth(style, element, recordPtr, tkwin)
- Tk_Style style; /* The widget style. */
- Tk_StyledElement element; /* The styled element, previously
- * returned by Tk_GetStyledElement. */
- char *recordPtr; /* The widget record. */
- Tk_Window tkwin; /* The widget window. */
+Tk_GetElementBorderWidth(
+ Tk_Style style, /* The widget style. */
+ Tk_StyledElement element, /* The styled element, previously returned by
+ * Tk_GetStyledElement. */
+ char *recordPtr, /* The widget record. */
+ Tk_Window tkwin) /* The widget window. */
{
Style *stylePtr = (Style *) style;
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
@@ -1194,7 +1180,7 @@ Tk_GetElementBorderWidth(style, element, recordPtr, tkwin)
*
* Tk_DrawElement --
*
- * This procedure draw the given widget element in a given drawable area.
+ * This function draw the given widget element in a given drawable area.
*
* Results:
* None
@@ -1206,22 +1192,22 @@ Tk_GetElementBorderWidth(style, element, recordPtr, tkwin)
*/
void
-Tk_DrawElement(style, element, recordPtr, tkwin, d, x, y, width, height, state)
- Tk_Style style; /* The widget style. */
- Tk_StyledElement element; /* The styled element, previously
- * returned by Tk_GetStyledElement. */
- char *recordPtr; /* The widget record. */
- Tk_Window tkwin; /* The widget window. */
- Drawable d; /* Where to draw element. */
- int x, y; /* Top left corner of element. */
- int width, height; /* Size of element. */
- int state; /* Drawing state flags. */
+Tk_DrawElement(
+ Tk_Style style, /* The widget style. */
+ Tk_StyledElement element, /* The styled element, previously returned by
+ * Tk_GetStyledElement. */
+ char *recordPtr, /* The widget record. */
+ Tk_Window tkwin, /* The widget window. */
+ Drawable d, /* Where to draw element. */
+ int x, int y, /* Top left corner of element. */
+ int width, int height, /* Size of element. */
+ int state) /* Drawing state flags. */
{
Style *stylePtr = (Style *) style;
StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element;
- widgetSpecPtr->elementPtr->specPtr->draw(stylePtr->clientData,
- recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width,
+ widgetSpecPtr->elementPtr->specPtr->draw(stylePtr->clientData,
+ recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width,
height, state);
}
@@ -1230,37 +1216,36 @@ Tk_DrawElement(style, element, recordPtr, tkwin, d, x, y, width, height, state)
*
* Tk_CreateStyle --
*
- * This procedure is called to create a new style as an instance of the
+ * This function is called to create a new style as an instance of the
* given engine. Styles are stored in thread-local space.
*
* Results:
- * The newly allocated style.
+ * The newly allocated style, or NULL if the style already exists.
*
* Side effects:
- * Memory allocated. Data added to thread-local table. The style's
- * refCount is incremented.
+ * Memory allocated. Data added to thread-local table.
*
*---------------------------------------------------------------------------
*/
Tk_Style
-Tk_CreateStyle(name, engine, clientData)
- CONST char *name; /* Name of the style to create. NULL or empty
+Tk_CreateStyle(
+ CONST char *name, /* Name of the style to create. NULL or empty
* means the default system style. */
- Tk_StyleEngine engine; /* The style engine. */
- ClientData clientData; /* Private data passed as is to engine code. */
+ Tk_StyleEngine engine, /* The style engine. */
+ ClientData clientData) /* Private data passed as is to engine code. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
Style *stylePtr;
/*
- * Attempt to create a new entry in the style table.
+ * Attempt to create a new entry in the style table.
*/
- entryPtr = Tcl_CreateHashEntry(&tsdPtr->styleTable, (name?name:""),
+ entryPtr = Tcl_CreateHashEntry(&tsdPtr->styleTable, (name?name:""),
&newEntry);
if (!newEntry) {
/*
@@ -1275,10 +1260,11 @@ Tk_CreateStyle(name, engine, clientData)
*/
stylePtr = (Style *) ckalloc(sizeof(Style));
- InitStyle(stylePtr, entryPtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
- (engine?(StyleEngine *) engine:tsdPtr->defaultEnginePtr), clientData);
+ InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
+ (engine != NULL ? (StyleEngine *) engine :
+ tsdPtr->defaultEnginePtr),
+ clientData);
Tcl_SetHashValue(entryPtr, (ClientData) stylePtr);
- stylePtr->refCount++;
return (Tk_Style) stylePtr;
}
@@ -1291,9 +1277,9 @@ Tk_CreateStyle(name, engine, clientData)
* Given a style, return its registered name.
*
* Results:
- * The return value is the name that was passed to Tk_CreateStyle() to
- * create the style. The storage for the returned string is private
- * (it points to the corresponding hash key) The caller should not modify
+ * The return value is the name that was passed to Tk_CreateStyle() to
+ * create the style. The storage for the returned string is private (it
+ * points to the corresponding hash key) The caller should not modify
* this string.
*
* Side effects:
@@ -1303,8 +1289,8 @@ Tk_CreateStyle(name, engine, clientData)
*/
CONST char *
-Tk_NameOfStyle(style)
- Tk_Style style; /* Style whose name is desired. */
+Tk_NameOfStyle(
+ Tk_Style style) /* Style whose name is desired. */
{
Style *stylePtr = (Style *) style;
@@ -1328,17 +1314,14 @@ Tk_NameOfStyle(style)
*/
static void
-InitStyle(stylePtr, hashPtr, name, enginePtr, clientData)
- Style *stylePtr; /* Points to an uninitialized style. */
- Tcl_HashEntry *hashPtr; /* Hash entry for the registered style. */
- CONST char *name; /* Name of the registered style. NULL or empty
+InitStyle(
+ Style *stylePtr, /* Points to an uninitialized style. */
+ CONST char *name, /* Name of the registered style. NULL or empty
* means the default system style. Usually
* points to the hash key. */
- StyleEngine *enginePtr; /* The style engine. */
- ClientData clientData; /* Private data passed as is to engine code. */
+ StyleEngine *enginePtr, /* The style engine. */
+ ClientData clientData) /* Private data passed as is to engine code. */
{
- stylePtr->refCount = 0;
- stylePtr->hashPtr = hashPtr;
stylePtr->name = name;
stylePtr->enginePtr = enginePtr;
stylePtr->clientData = clientData;
@@ -1347,36 +1330,13 @@ InitStyle(stylePtr, hashPtr, name, enginePtr, clientData)
/*
*---------------------------------------------------------------------------
*
- * FreeStyle --
- *
- * Free a style and its associated data.
- *
- * Results:
- * None
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-static void
-FreeStyle(stylePtr)
- Style *stylePtr; /* The style to free. */
-{
- /* Nothing to do. */
-}
-
-/*
- *---------------------------------------------------------------------------
- *
* Tk_GetStyle --
*
* Retrieve a registered style by its name.
*
* Results:
- * A pointer to the style engine, or NULL if none found. In the latter
- * case and if the interp is not NULL, an error message is left in the
+ * A pointer to the style engine, or NULL if none found. In the latter
+ * case and if the interp is not NULL, an error message is left in the
* interp's result.
*
* Side effects:
@@ -1386,29 +1346,29 @@ FreeStyle(stylePtr)
*/
Tk_Style
-Tk_GetStyle(interp, name)
- Tcl_Interp *interp; /* Interp for error return. */
- CONST char *name; /* Name of the style to retrieve. NULL or empty
+Tk_GetStyle(
+ Tcl_Interp *interp, /* Interp for error return. */
+ CONST char *name) /* Name of the style to retrieve. NULL or empty
* means the default system style. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
Style *stylePtr;
/*
- * Search for a corresponding entry in the style table.
+ * Search for a corresponding entry in the style table.
*/
- entryPtr = Tcl_FindHashEntry(&tsdPtr->styleTable, (name?name:""));
+ entryPtr = Tcl_FindHashEntry(&tsdPtr->styleTable, (name!=NULL?name:""));
if (entryPtr == NULL) {
if (interp != NULL) {
- Tcl_AppendResult(interp, "style \"", name, "\" doesn't exist", NULL);
+ Tcl_AppendResult(interp, "style \"", name, "\" doesn't exist",
+ NULL);
}
return (Tk_Style) NULL;
}
stylePtr = (Style *) Tcl_GetHashValue(entryPtr);
- stylePtr->refCount++;
return (Tk_Style) stylePtr;
}
@@ -1418,72 +1378,37 @@ Tk_GetStyle(interp, name)
*
* Tk_FreeStyle --
*
- * Free a style previously created by Tk_CreateStyle.
- *
- * Results:
- * None
- *
- * Side effects:
- * The style's refCount is decremented. If it reaches zero, the style
- * is freed.
+ * No-op. Present only for stubs compatibility.
*
*---------------------------------------------------------------------------
*/
-void
-Tk_FreeStyle(style)
- Tk_Style style; /* The style to free. */
+void
+Tk_FreeStyle(
+ Tk_Style style)
{
- Style *stylePtr = (Style *) style;
-
- if (stylePtr == NULL) {
- return;
- }
- stylePtr->refCount--;
- if (stylePtr->refCount > 0) {
- return;
- }
-
- /*
- * Keep the default style alive.
- */
-
- if (*stylePtr->name == '\0') {
- stylePtr->refCount = 1;
- return;
- }
-
- Tcl_DeleteHashEntry(stylePtr->hashPtr);
- FreeStyle(stylePtr);
- ckfree((char *) stylePtr);
}
/*
*---------------------------------------------------------------------------
*
- * Tk_AllocStyleFromObj --
+ * Tk_AllocStyleFromObj --
*
- * Map the string name of a style to a corresponding Tk_Style. The style
+ * Map the string name of a style to a corresponding Tk_Style. The style
* must have already been created by Tk_CreateStyle.
*
* Results:
- * The return value is a token for the style that matches objPtr, or
- * NULL if none found. If NULL is returned, an error message will be
- * left in interp's result object.
- *
- * Side effects:
- * The style's reference count is incremented. For each call to this
- * procedure, there should eventually be a call to Tk_FreeStyle() or
- * Tk_FreeStyleFromObj() so that the database is cleaned up when styles
- * aren't in use anymore.
+ * The return value is a token for the style that matches objPtr, or NULL
+ * if none found. If NULL is returned, an error message will be left in
+ * interp's result object.
*
*---------------------------------------------------------------------------
*/
Tk_Style
-Tk_AllocStyleFromObj(interp, objPtr)
- Tcl_Interp *interp; /* Interp for error return. */
- Tcl_Obj *objPtr; /* Object containing name of the style to
+Tk_AllocStyleFromObj(
+ Tcl_Interp *interp, /* Interp for error return. */
+ Tcl_Obj *objPtr) /* Object containing name of the style to
* retrieve. */
{
Style *stylePtr;
@@ -1493,7 +1418,6 @@ Tk_AllocStyleFromObj(interp, objPtr)
stylePtr = (Style *) objPtr->internalRep.otherValuePtr;
} else {
stylePtr = (Style *) objPtr->internalRep.otherValuePtr;
- stylePtr->refCount++;
}
return (Tk_Style) stylePtr;
@@ -1504,26 +1428,26 @@ Tk_AllocStyleFromObj(interp, objPtr)
*
* Tk_GetStyleFromObj --
*
- * Find the style that corresponds to a given object. The style must
- * have already been created by Tk_CreateStyle.
+ * Find the style that corresponds to a given object. The style must have
+ * already been created by Tk_CreateStyle.
*
* Results:
- * The return value is a token for the style that matches objPtr, or
- * NULL if none found.
+ * The return value is a token for the style that matches objPtr, or NULL
+ * if none found.
*
* Side effects:
- * If the object is not already a style ref, the conversion will free
- * any old internal representation.
+ * If the object is not already a style ref, the conversion will free any
+ * old internal representation.
*
*----------------------------------------------------------------------
*/
Tk_Style
-Tk_GetStyleFromObj(objPtr)
- Tcl_Obj *objPtr; /* The object from which to get the style. */
+Tk_GetStyleFromObj(
+ Tcl_Obj *objPtr) /* The object from which to get the style. */
{
if (objPtr->typePtr != &styleObjType) {
- SetStyleFromAny((Tcl_Interp *) NULL, objPtr);
+ SetStyleFromAny(NULL, objPtr);
}
return (Tk_Style) objPtr->internalRep.otherValuePtr;
@@ -1532,27 +1456,16 @@ Tk_GetStyleFromObj(objPtr)
/*
*---------------------------------------------------------------------------
*
- * Tk_FreeStyleFromObj --
+ * Tk_FreeStyleFromObj --
*
- * Called to release a style inside a Tcl_Obj *.
- *
- * Results:
- * None.
- *
- * Side effects:
- * If the object is a style ref, the conversion will free its
- * internal representation.
+ * No-op. Present only for stubs compatibility.
*
*---------------------------------------------------------------------------
*/
-
void
-Tk_FreeStyleFromObj(objPtr)
- Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */
+Tk_FreeStyleFromObj(
+ Tcl_Obj *objPtr)
{
- if (objPtr->typePtr == &styleObjType) {
- FreeStyleObjProc(objPtr);
- }
}
/*
@@ -1560,31 +1473,29 @@ Tk_FreeStyleFromObj(objPtr)
*
* SetStyleFromAny --
*
- * Convert the internal representation of a Tcl object to the
- * style internal form.
+ * Convert the internal representation of a Tcl object to the style
+ * internal form.
*
* Results:
- * Always returns TCL_OK. If an error occurs is returned (e.g. the
- * style doesn't exist), an error message will be left in interp's
- * result.
+ * Always returns TCL_OK. If an error occurs is returned (e.g. the style
+ * doesn't exist), an error message will be left in interp's result.
*
* Side effects:
* The object is left with its typePtr pointing to styleObjType.
- * The reference count is incremented (in Tk_GetStyle()).
*
*----------------------------------------------------------------------
*/
static int
-SetStyleFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr; /* The object to convert. */
+SetStyleFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
- Tcl_ObjType *typePtr;
- char *name;
+ const Tcl_ObjType *typePtr;
+ const char *name;
/*
- * Free the old internalRep before setting the new one.
+ * Free the old internalRep before setting the new one.
*/
name = Tcl_GetString(objPtr);
@@ -1602,61 +1513,49 @@ SetStyleFromAny(interp, objPtr)
/*
*---------------------------------------------------------------------------
*
- * FreeStyleObjProc --
+ * FreeStyleObjProc --
*
- * This proc is called to release an object reference to a style.
- * Called when the object's internal rep is released.
+ * This proc is called to release an object reference to a style. Called
+ * when the object's internal rep is released.
*
* Results:
* None.
*
- * Side effects:
- * The reference count is decremented (in Tk_FreeStyle()).
- *
*---------------------------------------------------------------------------
*/
static void
-FreeStyleObjProc(objPtr)
- Tcl_Obj *objPtr; /* The object we are releasing. */
+FreeStyleObjProc(
+ Tcl_Obj *objPtr) /* The object we are releasing. */
{
- Style *stylePtr = (Style *) objPtr->internalRep.otherValuePtr;
-
- if (stylePtr != NULL) {
- Tk_FreeStyle((Tk_Style) stylePtr);
- objPtr->internalRep.otherValuePtr = NULL;
- }
+ objPtr->internalRep.otherValuePtr = NULL;
+ objPtr->typePtr = NULL;
}
/*
*---------------------------------------------------------------------------
*
- * DupStyleObjProc --
+ * DupStyleObjProc --
*
- * When a cached style object is duplicated, this is called to
- * update the internal reps.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The style's refCount is incremented and the internal rep of the copy
- * is set to point to it.
+ * When a cached style object is duplicated, this is called to update the
+ * internal reps.
*
*---------------------------------------------------------------------------
*/
static void
-DupStyleObjProc(srcObjPtr, dupObjPtr)
- Tcl_Obj *srcObjPtr; /* The object we are copying from. */
- Tcl_Obj *dupObjPtr; /* The object we are copying to. */
+DupStyleObjProc(
+ Tcl_Obj *srcObjPtr, /* The object we are copying from. */
+ Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- Style *stylePtr = (Style *) srcObjPtr->internalRep.otherValuePtr;
-
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.otherValuePtr = (VOID *) stylePtr;
-
- if (stylePtr != NULL) {
- stylePtr->refCount++;
- }
+ dupObjPtr->internalRep.otherValuePtr=srcObjPtr->internalRep.otherValuePtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 0d6657a..639ed8d 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -1,28 +1,28 @@
-/*
+/*
* tkTest.c --
*
- * This file contains C command procedures for a bunch of additional
- * Tcl commands that are used for testing out Tcl's C interfaces.
- * These commands are not normally included in Tcl applications;
- * they're only used for testing.
+ * This file contains C command functions for a bunch of additional Tcl
+ * commands that are used for testing out Tcl's C interfaces. These
+ * commands are not normally included in Tcl applications; they're only
+ * used for testing.
*
* Copyright (c) 1993-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
#include "tkText.h"
#ifdef __WIN32__
#include "tkWinInt.h"
#endif
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
+#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
#endif
@@ -31,8 +31,7 @@
#endif
/*
- * The following data structure represents the master for a test
- * image:
+ * The following data structure represents the master for a test image:
*/
typedef struct TImageMaster {
@@ -40,13 +39,13 @@ typedef struct TImageMaster {
Tcl_Interp *interp; /* Interpreter for application. */
int width, height; /* Dimensions of image. */
char *imageName; /* Name of image (malloc-ed). */
- char *varName; /* Name of variable in which to log
- * events for image (malloc-ed). */
+ char *varName; /* Name of variable in which to log events for
+ * image (malloc-ed). */
} TImageMaster;
/*
- * The following data structure represents a particular use of a
- * particular test image.
+ * The following data structure represents a particular use of a particular
+ * test image.
*/
typedef struct TImageInstance {
@@ -59,43 +58,34 @@ typedef struct TImageInstance {
* The type record for test images:
*/
-#ifdef USE_OLD_IMAGE
-static int ImageCreate _ANSI_ARGS_((Tcl_Interp *interp,
- char *name, int argc, char **argv,
- Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *clientDataPtr));
-#else
-static int ImageCreate _ANSI_ARGS_((Tcl_Interp *interp,
+static int ImageCreate(Tcl_Interp *interp,
char *name, int argc, Tcl_Obj *CONST objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *clientDataPtr));
-#endif
-static ClientData ImageGet _ANSI_ARGS_((Tk_Window tkwin,
- ClientData clientData));
-static void ImageDisplay _ANSI_ARGS_((ClientData clientData,
- Display *display, Drawable drawable,
+ ClientData *clientDataPtr);
+static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
+static void ImageDisplay(ClientData clientData,
+ Display *display, Drawable drawable,
int imageX, int imageY, int width,
int height, int drawableX,
- int drawableY));
-static void ImageFree _ANSI_ARGS_((ClientData clientData,
- Display *display));
-static void ImageDelete _ANSI_ARGS_((ClientData clientData));
+ int drawableY);
+static void ImageFree(ClientData clientData, Display *display);
+static void ImageDelete(ClientData clientData);
static Tk_ImageType imageType = {
"test", /* name */
- (Tk_ImageCreateProc *) ImageCreate, /* createProc */
+ ImageCreate, /* createProc */
ImageGet, /* getProc */
ImageDisplay, /* displayProc */
ImageFree, /* freeProc */
ImageDelete, /* deleteProc */
- (Tk_ImagePostscriptProc *) NULL,/* postscriptPtr */
- (Tk_ImageType *) NULL /* nextPtr */
+ NULL, /* postscriptPtr */
+ NULL /* nextPtr */
};
/*
- * One of the following structures describes each of the interpreters
- * created by the "testnewapp" command. This information is used by
- * the "testdeleteinterps" command to destroy all of those interpreters.
+ * One of the following structures describes each of the interpreters created
+ * by the "testnewapp" command. This information is used by the
+ * "testdeleteinterps" command to destroy all of those interpreters.
*/
typedef struct NewApp {
@@ -103,15 +93,15 @@ typedef struct NewApp {
struct NewApp *nextPtr; /* Next in list of new interpreters. */
} NewApp;
-static NewApp *newAppPtr = NULL;
- /* First in list of all new interpreters. */
+static NewApp *newAppPtr = NULL;/* First in list of all new interpreters. */
/*
- * Declaration for the square widget's class command procedure:
+ * Declaration for the square widget's class command function:
*/
-extern int SquareObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+extern int SquareObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
typedef struct CBinding {
Tcl_Interp *interp;
@@ -128,118 +118,114 @@ typedef struct CBinding {
enum {
NONE,
- ODD_TYPE,
+ ODD_TYPE,
EVEN_TYPE
};
typedef struct TrivialCommandHeader {
- Tcl_Interp *interp; /* The interp that this command
- * lives in. */
- Tk_OptionTable optionTable; /* The option table that go with
- * this command. */
- Tk_Window tkwin; /* For widgets, the window associated
- * with this widget. */
- Tcl_Command widgetCmd; /* For widgets, the command associated
- * with this widget. */
+ Tcl_Interp *interp; /* The interp that this command lives in. */
+ Tk_OptionTable optionTable; /* The option table that go with this
+ * command. */
+ Tk_Window tkwin; /* For widgets, the window associated with
+ * this widget. */
+ Tcl_Command widgetCmd; /* For widgets, the command associated with
+ * this widget. */
} TrivialCommandHeader;
-
-
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int CBindingEvalProc _ANSI_ARGS_((ClientData clientData,
+static int CBindingEvalProc(ClientData clientData,
Tcl_Interp *interp, XEvent *eventPtr,
- Tk_Window tkwin, KeySym keySym));
-static void CBindingFreeProc _ANSI_ARGS_((ClientData clientData));
-int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
-static int ImageCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestcbindCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestbitmapObjCmd _ANSI_ARGS_((ClientData dummy,
+ Tk_Window tkwin, KeySym keySym);
+static void CBindingFreeProc(ClientData clientData);
+int Tktest_Init(Tcl_Interp *interp);
+static int ImageCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestcbindCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestbitmapObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static int TestborderObjCmd _ANSI_ARGS_((ClientData dummy,
+ Tcl_Obj * CONST objv[]);
+static int TestborderObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static int TestcolorObjCmd _ANSI_ARGS_((ClientData dummy,
+ Tcl_Obj * CONST objv[]);
+static int TestcolorObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static int TestcursorObjCmd _ANSI_ARGS_((ClientData dummy,
+ Tcl_Obj * CONST objv[]);
+static int TestcursorObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static int TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestfontObjCmd _ANSI_ARGS_((ClientData dummy,
+ Tcl_Obj * CONST objv[]);
+static int TestdeleteappsCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestfontObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int TestmakeexistCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
-static int TestmenubarCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
+ Tcl_Obj *CONST objv[]);
+static int TestmakeexistCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
+static int TestmenubarCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
#endif
-#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
-static int TestmetricsCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
+#if defined(__WIN32__) || defined(MAC_OSX_TK)
+static int TestmetricsCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
#endif
-static int TestobjconfigObjCmd _ANSI_ARGS_((ClientData dummy,
+static int TestobjconfigObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static int CustomOptionSet _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin,
- Tcl_Obj **value, char *recordPtr, int internalOffset,
- char *saveInternalPtr, int flags));
-static Tcl_Obj *CustomOptionGet _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *recordPtr, int internalOffset));
-static void CustomOptionRestore _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *internalPtr,
- char *saveInternalPtr));
-static void CustomOptionFree _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *internalPtr));
-static int TestpropCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
-static int TestsendCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-#endif
-static int TesttextCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
-static int TestwrapperCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
+ Tcl_Obj * CONST objv[]);
+static int CustomOptionSet(ClientData clientData,
+ Tcl_Interp *interp, Tk_Window tkwin,
+ Tcl_Obj **value, char *recordPtr,
+ int internalOffset, char *saveInternalPtr,
+ int flags);
+static Tcl_Obj * CustomOptionGet(ClientData clientData,
+ Tk_Window tkwin, char *recordPtr,
+ int internalOffset);
+static void CustomOptionRestore(ClientData clientData,
+ Tk_Window tkwin, char *internalPtr,
+ char *saveInternalPtr);
+static void CustomOptionFree(ClientData clientData,
+ Tk_Window tkwin, char *internalPtr);
+static int TestpropCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
+static int TestwrapperCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
#endif
-static void TrivialCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static int TrivialConfigObjCmd _ANSI_ARGS_((ClientData dummy,
+static void TrivialCmdDeletedProc(ClientData clientData);
+static int TrivialConfigObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static void TrivialEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
+ Tcl_Obj * CONST objv[]);
+static void TrivialEventProc(ClientData clientData,
+ XEvent *eventPtr);
/*
* External (platform specific) initialization routine:
*/
-extern int TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
-
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
#define TkplatformtestInit(x) TCL_OK
+#else
+MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
#endif
+
+/*
+ * External legacy testing initialization routine:
+ */
+MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp);
/*
*----------------------------------------------------------------------
*
* Tktest_Init --
*
- * This procedure performs intialization for the Tk test
- * suite exensions.
+ * This function performs intialization for the Tk test suite exensions.
*
* Results:
- * Returns a standard Tcl completion code, and leaves an error
- * message in the interp's result if an error occurs.
+ * Returns a standard Tcl completion code, and leaves an error message in
+ * the interp's result if an error occurs.
*
* Side effects:
* Creates several test commands.
@@ -248,8 +234,8 @@ extern int TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
*/
int
-Tktest_Init(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
+Tktest_Init(
+ Tcl_Interp *interp) /* Interpreter for application. */
{
static int initialized = 0;
@@ -262,47 +248,43 @@ Tktest_Init(interp)
}
Tcl_CreateObjCommand(interp, "square", SquareObjCmd,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) NULL, NULL);
Tcl_CreateCommand(interp, "testcbind", TestcbindCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testborder", TestborderObjCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testcolor", TestcolorObjCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testcursor", TestcursorObjCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, "testdeleteapps", TestdeleteappsCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, "testembed", TkpTestembedCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testobjconfig", TestobjconfigObjCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testfont", TestfontObjCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, "testmakeexist", TestmakeexistCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
- Tcl_CreateCommand(interp, "testmenubar", TestmenubarCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-#endif
-#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
- Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-#endif
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, "testprop", TestpropCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
- Tcl_CreateCommand(interp, "testsend", TestsendCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-#endif
- Tcl_CreateCommand(interp, "testtext", TesttextCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+ (ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateCommand(interp, "testtext", TkpTesttextCmd,
+ (ClientData) Tk_MainWindow(interp), NULL);
+
+#if defined(__WIN32__) || defined(MAC_OSX_TK)
+ Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
+ (ClientData) Tk_MainWindow(interp), NULL);
+#else
+ Tcl_CreateCommand(interp, "testmenubar", TestmenubarCmd,
+ (ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateCommand(interp, "testsend", TkpTestsendCmd,
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, "testwrapper", TestwrapperCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-#endif
+ (ClientData) Tk_MainWindow(interp), NULL);
+#endif /* __WIN32__ || MAC_OSX_TK */
/*
* Create test image type.
@@ -314,9 +296,17 @@ Tktest_Init(interp)
}
/*
+ * Enable testing of legacy interfaces.
+ */
+
+ if (TkOldTestInit(interp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /*
* And finally add any platform specific test commands.
*/
-
+
return TkplatformtestInit(interp);
}
@@ -325,34 +315,34 @@ Tktest_Init(interp)
*
* TestcbindCmd --
*
- * This procedure implements the "testcbinding" command. It provides
- * a set of functions for testing C bindings in tkBind.c.
+ * This function implements the "testcbinding" command. It provides a set
+ * of functions for testing C bindings in tkBind.c.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * Depends on option; see below.
+ * Depends on option; see below.
*
*----------------------------------------------------------------------
*/
static int
-TestcbindCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestcbindCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
TkWindow *winPtr;
Tk_Window tkwin;
ClientData object;
CBinding *cbindPtr;
-
-
+
+
if (argc < 4 || argc > 5) {
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " bindtag pattern command ?deletecommand?", (char *) NULL);
+ " bindtag pattern command ?deletecommand?", NULL);
return TCL_ERROR;
}
@@ -399,26 +389,26 @@ TestcbindCmd(clientData, interp, argc, argv)
}
static int
-CBindingEvalProc(clientData, interp, eventPtr, tkwin, keySym)
- ClientData clientData;
- Tcl_Interp *interp;
- XEvent *eventPtr;
- Tk_Window tkwin;
- KeySym keySym;
+CBindingEvalProc(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ XEvent *eventPtr,
+ Tk_Window tkwin,
+ KeySym keySym)
{
CBinding *cbindPtr;
cbindPtr = (CBinding *) clientData;
-
+
return Tcl_GlobalEval(interp, cbindPtr->command);
}
static void
-CBindingFreeProc(clientData)
- ClientData clientData;
+CBindingFreeProc(
+ ClientData clientData)
{
CBinding *cbindPtr = (CBinding *) clientData;
-
+
if (cbindPtr->delete != NULL) {
Tcl_GlobalEval(cbindPtr->interp, cbindPtr->delete);
ckfree((char *) cbindPtr->delete);
@@ -432,8 +422,8 @@ CBindingFreeProc(clientData)
*
* TestbitmapObjCmd --
*
- * This procedure implements the "testbitmap" command, which is used
- * to test color resource handling in tkBitmap tmp.c.
+ * This function implements the "testbitmap" command, which is used to
+ * test color resource handling in tkBitmap tmp.c.
*
* Results:
* A standard Tcl result.
@@ -446,11 +436,11 @@ CBindingFreeProc(clientData)
/* ARGSUSED */
static int
-TestbitmapObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TestbitmapObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
if (objc < 2) {
@@ -467,8 +457,8 @@ TestbitmapObjCmd(clientData, interp, objc, objv)
*
* TestborderObjCmd --
*
- * This procedure implements the "testborder" command, which is used
- * to test color resource handling in tkBorder.c.
+ * This function implements the "testborder" command, which is used to
+ * test color resource handling in tkBorder.c.
*
* Results:
* A standard Tcl result.
@@ -481,11 +471,11 @@ TestbitmapObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
static int
-TestborderObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TestborderObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
if (objc < 2) {
@@ -502,8 +492,8 @@ TestborderObjCmd(clientData, interp, objc, objv)
*
* TestcolorObjCmd --
*
- * This procedure implements the "testcolor" command, which is used
- * to test color resource handling in tkColor.c.
+ * This function implements the "testcolor" command, which is used to
+ * test color resource handling in tkColor.c.
*
* Results:
* A standard Tcl result.
@@ -516,13 +506,12 @@ TestborderObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
static int
-TestcolorObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TestcolorObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "color");
return TCL_ERROR;
@@ -537,8 +526,8 @@ TestcolorObjCmd(clientData, interp, objc, objv)
*
* TestcursorObjCmd --
*
- * This procedure implements the "testcursor" command, which is used
- * to test color resource handling in tkCursor.c.
+ * This function implements the "testcursor" command, which is used to
+ * test color resource handling in tkCursor.c.
*
* Results:
* A standard Tcl result.
@@ -551,13 +540,12 @@ TestcolorObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
static int
-TestcursorObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TestcursorObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cursor");
return TCL_ERROR;
@@ -572,26 +560,26 @@ TestcursorObjCmd(clientData, interp, objc, objv)
*
* TestdeleteappsCmd --
*
- * This procedure implements the "testdeleteapps" command. It cleans
- * up all the interpreters left behind by the "testnewapp" command.
+ * This function implements the "testdeleteapps" command. It cleans up
+ * all the interpreters left behind by the "testnewapp" command.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * All the intepreters created by previous calls to "testnewapp"
- * get deleted.
+ * All the intepreters created by previous calls to "testnewapp" get
+ * deleted.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
-TestdeleteappsCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestdeleteappsCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
NewApp *nextPtr;
@@ -610,8 +598,8 @@ TestdeleteappsCmd(clientData, interp, argc, argv)
*
* TestobjconfigObjCmd --
*
- * This procedure implements the "testobjconfig" command,
- * which is used to test the procedures in tkConfig.c.
+ * This function implements the "testobjconfig" command, which is used to
+ * test the functions in tkConfig.c.
*
* Results:
* A standard Tcl result.
@@ -624,46 +612,40 @@ TestdeleteappsCmd(clientData, interp, argc, argv)
/* ARGSUSED */
static int
-TestobjconfigObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TestobjconfigObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- static CONST char *options[] = {"alltypes", "chain1", "chain2",
- "configerror", "delete", "info", "internal", "new",
- "notenoughparams", "twowindows", (char *) NULL};
+ static CONST char *options[] = {
+ "alltypes", "chain1", "chain2", "configerror", "delete", "info",
+ "internal", "new", "notenoughparams", "twowindows", NULL
+ };
enum {
- ALL_TYPES,
- CHAIN1,
- CHAIN2,
- CONFIG_ERROR,
+ ALL_TYPES, CHAIN1, CHAIN2, CONFIG_ERROR,
DEL, /* Can't use DELETE: VC++ compiler barfs. */
- INFO,
- INTERNAL,
- NEW,
- NOT_ENOUGH_PARAMS,
- TWO_WINDOWS
+ INFO, INTERNAL, NEW, NOT_ENOUGH_PARAMS, TWO_WINDOWS
};
- static Tk_OptionTable tables[11]; /* Holds pointers to option tables
- * created by commands below; indexed
- * with same values as "options"
- * array. */
+ static Tk_OptionTable tables[11];
+ /* Holds pointers to option tables created by
+ * commands below; indexed with same values as
+ * "options" array. */
static Tk_ObjCustomOption CustomOption = {
"custom option",
- CustomOptionSet,
- CustomOptionGet,
- CustomOptionRestore,
- CustomOptionFree,
- (ClientData) 1
+ CustomOptionSet,
+ CustomOptionGet,
+ CustomOptionRestore,
+ CustomOptionFree,
+ (ClientData) 1
};
Tk_Window mainWin = (Tk_Window) clientData;
Tk_Window tkwin;
int index, result = TCL_OK;
/*
- * Structures used by the "chain1" subcommand and also shared by
- * the "chain2" subcommand:
+ * Structures used by the "chain1" subcommand and also shared by the
+ * "chain2" subcommand:
*/
typedef struct ExtensionWidgetRecord {
@@ -674,12 +656,10 @@ TestobjconfigObjCmd(clientData, interp, objc, objv)
Tcl_Obj *extension4ObjPtr;
Tcl_Obj *extension5ObjPtr;
} ExtensionWidgetRecord;
- static Tk_OptionSpec baseSpecs[] = {
- {TK_OPTION_STRING,
- "-one", "one", "One", "one",
+ static const Tk_OptionSpec baseSpecs[] = {
+ {TK_OPTION_STRING, "-one", "one", "One", "one",
Tk_Offset(ExtensionWidgetRecord, base1ObjPtr), -1},
- {TK_OPTION_STRING,
- "-two", "two", "Two", "two",
+ {TK_OPTION_STRING, "-two", "two", "Two", "two",
Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1},
{TK_OPTION_END}
};
@@ -695,634 +675,551 @@ TestobjconfigObjCmd(clientData, interp, objc, objv)
}
switch (index) {
- case ALL_TYPES: {
- typedef struct TypesRecord {
- TrivialCommandHeader header;
- Tcl_Obj *booleanPtr;
- Tcl_Obj *integerPtr;
- Tcl_Obj *doublePtr;
- Tcl_Obj *stringPtr;
- Tcl_Obj *stringTablePtr;
- Tcl_Obj *colorPtr;
- Tcl_Obj *fontPtr;
- Tcl_Obj *bitmapPtr;
- Tcl_Obj *borderPtr;
- Tcl_Obj *reliefPtr;
- Tcl_Obj *cursorPtr;
- Tcl_Obj *activeCursorPtr;
- Tcl_Obj *justifyPtr;
- Tcl_Obj *anchorPtr;
- Tcl_Obj *pixelPtr;
- Tcl_Obj *mmPtr;
- Tcl_Obj *customPtr;
- } TypesRecord;
- TypesRecord *recordPtr;
- static char *stringTable[] = {"one", "two", "three", "four",
- (char *) NULL};
- static Tk_OptionSpec typesSpecs[] = {
- {TK_OPTION_BOOLEAN,
- "-boolean", "boolean", "Boolean",
- "1", Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1},
- {TK_OPTION_INT,
- "-integer", "integer", "Integer",
- "7", Tk_Offset(TypesRecord, integerPtr), -1, 0, 0, 0x2},
- {TK_OPTION_DOUBLE,
- "-double", "double", "Double",
- "3.14159", Tk_Offset(TypesRecord, doublePtr), -1, 0, 0,
- 0x4},
- {TK_OPTION_STRING,
- "-string", "string", "String",
- "foo", Tk_Offset(TypesRecord, stringPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x8},
- {TK_OPTION_STRING_TABLE,
- "-stringtable", "StringTable", "stringTable",
- "one", Tk_Offset(TypesRecord, stringTablePtr), -1,
- TK_CONFIG_NULL_OK, (ClientData) stringTable, 0x10},
- {TK_OPTION_COLOR,
- "-color", "color", "Color",
- "red", Tk_Offset(TypesRecord, colorPtr), -1,
- TK_CONFIG_NULL_OK, (ClientData) "black", 0x20},
- {TK_OPTION_FONT,
- "-font", "font", "Font",
- "Helvetica 12",
- Tk_Offset(TypesRecord, fontPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x40},
- {TK_OPTION_BITMAP,
- "-bitmap", "bitmap", "Bitmap",
- "gray50",
- Tk_Offset(TypesRecord, bitmapPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x80},
- {TK_OPTION_BORDER,
- "-border", "border", "Border",
- "blue", Tk_Offset(TypesRecord, borderPtr), -1,
- TK_CONFIG_NULL_OK, (ClientData) "white", 0x100},
- {TK_OPTION_RELIEF,
- "-relief", "relief", "Relief",
- "raised",
- Tk_Offset(TypesRecord, reliefPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x200},
- {TK_OPTION_CURSOR,
- "-cursor", "cursor", "Cursor",
- "xterm",
- Tk_Offset(TypesRecord, cursorPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x400},
- {TK_OPTION_JUSTIFY,
- "-justify", (char *) NULL, (char *) NULL,
- "left",
- Tk_Offset(TypesRecord, justifyPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x800},
- {TK_OPTION_ANCHOR,
- "-anchor", "anchor", "Anchor",
- (char *) NULL,
- Tk_Offset(TypesRecord, anchorPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x1000},
- {TK_OPTION_PIXELS,
- "-pixel", "pixel", "Pixel",
- "1", Tk_Offset(TypesRecord, pixelPtr), -1,
- TK_CONFIG_NULL_OK, 0, 0x2000},
- {TK_OPTION_CUSTOM,
- "-custom", (char *) NULL, (char *) NULL,
- "", Tk_Offset(TypesRecord, customPtr), -1,
- TK_CONFIG_NULL_OK, (ClientData)&CustomOption, 0x4000},
- {TK_OPTION_SYNONYM,
- "-synonym", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-color",
- 0x8000},
- {TK_OPTION_END}
- };
- Tk_OptionTable optionTable;
- Tk_Window tkwin;
- optionTable = Tk_CreateOptionTable(interp,
- typesSpecs);
- tables[index] = optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
- Tcl_GetStringFromObj(objv[2], NULL), (char *) NULL);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- Tk_SetClass(tkwin, "Test");
-
- recordPtr = (TypesRecord *) ckalloc(sizeof(TypesRecord));
- recordPtr->header.interp = interp;
- recordPtr->header.optionTable = optionTable;
- recordPtr->header.tkwin = tkwin;
- recordPtr->booleanPtr = NULL;
- recordPtr->integerPtr = NULL;
- recordPtr->doublePtr = NULL;
- recordPtr->stringPtr = NULL;
- recordPtr->colorPtr = NULL;
- recordPtr->fontPtr = NULL;
- recordPtr->bitmapPtr = NULL;
- recordPtr->borderPtr = NULL;
- recordPtr->reliefPtr = NULL;
- recordPtr->cursorPtr = NULL;
- recordPtr->justifyPtr = NULL;
- recordPtr->anchorPtr = NULL;
- recordPtr->pixelPtr = NULL;
- recordPtr->mmPtr = NULL;
- recordPtr->stringTablePtr = NULL;
- recordPtr->customPtr = NULL;
- result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
- tkwin);
- if (result == TCL_OK) {
- recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
- Tcl_GetStringFromObj(objv[2], NULL),
- TrivialConfigObjCmd, (ClientData) recordPtr,
- TrivialCmdDeletedProc);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
- result = Tk_SetOptions(interp, (char *) recordPtr,
- optionTable, objc - 3, objv + 3, tkwin,
- (Tk_SavedOptions *) NULL, (int *) NULL);
- if (result != TCL_OK) {
- Tk_DestroyWindow(tkwin);
- }
- } else {
+ case ALL_TYPES: {
+ typedef struct TypesRecord {
+ TrivialCommandHeader header;
+ Tcl_Obj *booleanPtr;
+ Tcl_Obj *integerPtr;
+ Tcl_Obj *doublePtr;
+ Tcl_Obj *stringPtr;
+ Tcl_Obj *stringTablePtr;
+ Tcl_Obj *colorPtr;
+ Tcl_Obj *fontPtr;
+ Tcl_Obj *bitmapPtr;
+ Tcl_Obj *borderPtr;
+ Tcl_Obj *reliefPtr;
+ Tcl_Obj *cursorPtr;
+ Tcl_Obj *activeCursorPtr;
+ Tcl_Obj *justifyPtr;
+ Tcl_Obj *anchorPtr;
+ Tcl_Obj *pixelPtr;
+ Tcl_Obj *mmPtr;
+ Tcl_Obj *customPtr;
+ } TypesRecord;
+ TypesRecord *recordPtr;
+ static char *stringTable[] = {
+ "one", "two", "three", "four", NULL
+ };
+ static const Tk_OptionSpec typesSpecs[] = {
+ {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1",
+ Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1},
+ {TK_OPTION_INT, "-integer", "integer", "Integer", "7",
+ Tk_Offset(TypesRecord, integerPtr), -1, 0, 0, 0x2},
+ {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159",
+ Tk_Offset(TypesRecord, doublePtr), -1, 0, 0, 0x4},
+ {TK_OPTION_STRING, "-string", "string", "String",
+ "foo", Tk_Offset(TypesRecord, stringPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x8},
+ {TK_OPTION_STRING_TABLE,
+ "-stringtable", "StringTable", "stringTable",
+ "one", Tk_Offset(TypesRecord, stringTablePtr), -1,
+ TK_CONFIG_NULL_OK, (ClientData) stringTable, 0x10},
+ {TK_OPTION_COLOR, "-color", "color", "Color",
+ "red", Tk_Offset(TypesRecord, colorPtr), -1,
+ TK_CONFIG_NULL_OK, (ClientData) "black", 0x20},
+ {TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12",
+ Tk_Offset(TypesRecord, fontPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x40},
+ {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50",
+ Tk_Offset(TypesRecord, bitmapPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x80},
+ {TK_OPTION_BORDER, "-border", "border", "Border",
+ "blue", Tk_Offset(TypesRecord, borderPtr), -1,
+ TK_CONFIG_NULL_OK, (ClientData) "white", 0x100},
+ {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised",
+ Tk_Offset(TypesRecord, reliefPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x200},
+ {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm",
+ Tk_Offset(TypesRecord, cursorPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x400},
+ {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left",
+ Tk_Offset(TypesRecord, justifyPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x800},
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL,
+ Tk_Offset(TypesRecord, anchorPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x1000},
+ {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel",
+ "1", Tk_Offset(TypesRecord, pixelPtr), -1,
+ TK_CONFIG_NULL_OK, 0, 0x2000},
+ {TK_OPTION_CUSTOM, "-custom", NULL, NULL,
+ "", Tk_Offset(TypesRecord, customPtr), -1,
+ TK_CONFIG_NULL_OK, (ClientData)&CustomOption, 0x4000},
+ {TK_OPTION_SYNONYM, "-synonym", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-color", 0x8000},
+ {TK_OPTION_END}
+ };
+ Tk_OptionTable optionTable;
+ Tk_Window tkwin;
+
+ optionTable = Tk_CreateOptionTable(interp, typesSpecs);
+ tables[index] = optionTable;
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ Tcl_GetString(objv[2]), NULL);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ Tk_SetClass(tkwin, "Test");
+
+ recordPtr = (TypesRecord *) ckalloc(sizeof(TypesRecord));
+ recordPtr->header.interp = interp;
+ recordPtr->header.optionTable = optionTable;
+ recordPtr->header.tkwin = tkwin;
+ recordPtr->booleanPtr = NULL;
+ recordPtr->integerPtr = NULL;
+ recordPtr->doublePtr = NULL;
+ recordPtr->stringPtr = NULL;
+ recordPtr->colorPtr = NULL;
+ recordPtr->fontPtr = NULL;
+ recordPtr->bitmapPtr = NULL;
+ recordPtr->borderPtr = NULL;
+ recordPtr->reliefPtr = NULL;
+ recordPtr->cursorPtr = NULL;
+ recordPtr->justifyPtr = NULL;
+ recordPtr->anchorPtr = NULL;
+ recordPtr->pixelPtr = NULL;
+ recordPtr->mmPtr = NULL;
+ recordPtr->stringTablePtr = NULL;
+ recordPtr->customPtr = NULL;
+ result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
+ tkwin);
+ if (result == TCL_OK) {
+ recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
+ Tcl_GetString(objv[2]), TrivialConfigObjCmd,
+ (ClientData) recordPtr, TrivialCmdDeletedProc);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask,
+ TrivialEventProc, (ClientData) recordPtr);
+ result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ objc-3, objv+3, tkwin, NULL, NULL);
+ if (result != TCL_OK) {
Tk_DestroyWindow(tkwin);
- ckfree((char *) recordPtr);
- }
- if (result == TCL_OK) {
- Tcl_SetObjResult(interp, objv[2]);
}
- break;
+ } else {
+ Tk_DestroyWindow(tkwin);
+ ckfree((char *) recordPtr);
}
+ if (result == TCL_OK) {
+ Tcl_SetObjResult(interp, objv[2]);
+ }
+ break;
+ }
- case CHAIN1: {
- ExtensionWidgetRecord *recordPtr;
- Tk_Window tkwin;
- Tk_OptionTable optionTable;
+ case CHAIN1: {
+ ExtensionWidgetRecord *recordPtr;
+ Tk_Window tkwin;
+ Tk_OptionTable optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
- Tcl_GetStringFromObj(objv[2], NULL), (char *) NULL);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- Tk_SetClass(tkwin, "Test");
- optionTable = Tk_CreateOptionTable(interp, baseSpecs);
- tables[index] = optionTable;
-
- recordPtr = (ExtensionWidgetRecord *) ckalloc(
- sizeof(ExtensionWidgetRecord));
- recordPtr->header.interp = interp;
- recordPtr->header.optionTable = optionTable;
- recordPtr->header.tkwin = tkwin;
- recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL;
- recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL;
- result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
- tkwin);
- if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
- objc - 3, objv + 3, tkwin, (Tk_SavedOptions *) NULL,
- (int *) NULL);
- if (result != TCL_OK) {
- Tk_FreeConfigOptions((char *) recordPtr, optionTable,
- tkwin);
- }
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ Tcl_GetString(objv[2]), NULL);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ Tk_SetClass(tkwin, "Test");
+ optionTable = Tk_CreateOptionTable(interp, baseSpecs);
+ tables[index] = optionTable;
+
+ recordPtr = (ExtensionWidgetRecord *)
+ ckalloc(sizeof(ExtensionWidgetRecord));
+ recordPtr->header.interp = interp;
+ recordPtr->header.optionTable = optionTable;
+ recordPtr->header.tkwin = tkwin;
+ recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL;
+ recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL;
+ result = Tk_InitOptions(interp, (char *)recordPtr, optionTable, tkwin);
+ if (result == TCL_OK) {
+ result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ objc-3, objv+3, tkwin, NULL, NULL);
+ if (result != TCL_OK) {
+ Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin);
}
- if (result == TCL_OK) {
- recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
- Tcl_GetStringFromObj(objv[2], NULL),
- TrivialConfigObjCmd, (ClientData) recordPtr,
- TrivialCmdDeletedProc);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
- Tcl_SetObjResult(interp, objv[2]);
+ }
+ if (result == TCL_OK) {
+ recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
+ Tcl_GetString(objv[2]), TrivialConfigObjCmd,
+ (ClientData) recordPtr, TrivialCmdDeletedProc);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask,
+ TrivialEventProc, (ClientData) recordPtr);
+ Tcl_SetObjResult(interp, objv[2]);
+ }
+ break;
+ }
+
+ case CHAIN2: {
+ ExtensionWidgetRecord *recordPtr;
+ static const Tk_OptionSpec extensionSpecs[] = {
+ {TK_OPTION_STRING, "-three", "three", "Three", "three",
+ Tk_Offset(ExtensionWidgetRecord, extension3ObjPtr), -1},
+ {TK_OPTION_STRING, "-four", "four", "Four", "four",
+ Tk_Offset(ExtensionWidgetRecord, extension4ObjPtr), -1},
+ {TK_OPTION_STRING, "-two", "two", "Two", "two and a half",
+ Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1},
+ {TK_OPTION_STRING,
+ "-oneAgain", "oneAgain", "OneAgain", "one again",
+ Tk_Offset(ExtensionWidgetRecord, extension5ObjPtr), -1},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) baseSpecs}
+ };
+ Tk_Window tkwin;
+ Tk_OptionTable optionTable;
+
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ Tcl_GetString(objv[2]), NULL);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ Tk_SetClass(tkwin, "Test");
+ optionTable = Tk_CreateOptionTable(interp, extensionSpecs);
+ tables[index] = optionTable;
+
+ recordPtr = (ExtensionWidgetRecord *) ckalloc(
+ sizeof(ExtensionWidgetRecord));
+ recordPtr->header.interp = interp;
+ recordPtr->header.optionTable = optionTable;
+ recordPtr->header.tkwin = tkwin;
+ recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL;
+ recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL;
+ recordPtr->extension5ObjPtr = NULL;
+ result = Tk_InitOptions(interp, (char *)recordPtr, optionTable, tkwin);
+ if (result == TCL_OK) {
+ result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ objc-3, objv+3, tkwin, NULL, NULL);
+ if (result != TCL_OK) {
+ Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin);
}
- break;
}
+ if (result == TCL_OK) {
+ recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
+ Tcl_GetString(objv[2]), TrivialConfigObjCmd,
+ (ClientData) recordPtr, TrivialCmdDeletedProc);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask,
+ TrivialEventProc, (ClientData) recordPtr);
+ Tcl_SetObjResult(interp, objv[2]);
+ }
+ break;
+ }
- case CHAIN2: {
- ExtensionWidgetRecord *recordPtr;
- static Tk_OptionSpec extensionSpecs[] = {
- {TK_OPTION_STRING,
- "-three", "three", "Three", "three",
- Tk_Offset(ExtensionWidgetRecord, extension3ObjPtr),
- -1},
- {TK_OPTION_STRING,
- "-four", "four", "Four", "four",
- Tk_Offset(ExtensionWidgetRecord, extension4ObjPtr),
- -1},
- {TK_OPTION_STRING,
- "-two", "two", "Two", "two and a half",
- Tk_Offset(ExtensionWidgetRecord, base2ObjPtr),
- -1},
- {TK_OPTION_STRING,
- "-oneAgain", "oneAgain", "OneAgain", "one again",
- Tk_Offset(ExtensionWidgetRecord, extension5ObjPtr),
- -1},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) baseSpecs}
- };
- Tk_Window tkwin;
- Tk_OptionTable optionTable;
+ case CONFIG_ERROR: {
+ typedef struct ErrorWidgetRecord {
+ Tcl_Obj *intPtr;
+ } ErrorWidgetRecord;
+ ErrorWidgetRecord widgetRecord;
+ static const Tk_OptionSpec errorSpecs[] = {
+ {TK_OPTION_INT, "-int", "integer", "Integer", "bogus",
+ Tk_Offset(ErrorWidgetRecord, intPtr)},
+ {TK_OPTION_END}
+ };
+ Tk_OptionTable optionTable;
+
+ widgetRecord.intPtr = NULL;
+ optionTable = Tk_CreateOptionTable(interp, errorSpecs);
+ tables[index] = optionTable;
+ return Tk_InitOptions(interp, (char *) &widgetRecord, optionTable,
+ (Tk_Window) NULL);
+ }
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
- Tcl_GetStringFromObj(objv[2], NULL), (char *) NULL);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- Tk_SetClass(tkwin, "Test");
- optionTable = Tk_CreateOptionTable(interp, extensionSpecs);
- tables[index] = optionTable;
-
- recordPtr = (ExtensionWidgetRecord *) ckalloc(
- sizeof(ExtensionWidgetRecord));
- recordPtr->header.interp = interp;
- recordPtr->header.optionTable = optionTable;
- recordPtr->header.tkwin = tkwin;
- recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL;
- recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL;
- recordPtr->extension5ObjPtr = NULL;
- result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
- tkwin);
- if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
- objc - 3, objv + 3, tkwin, (Tk_SavedOptions *) NULL,
- (int *) NULL);
- if (result != TCL_OK) {
- Tk_FreeConfigOptions((char *) recordPtr, optionTable,
- tkwin);
- }
- }
- if (result == TCL_OK) {
- recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
- Tcl_GetStringFromObj(objv[2], NULL),
- TrivialConfigObjCmd, (ClientData) recordPtr,
- TrivialCmdDeletedProc);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
- Tcl_SetObjResult(interp, objv[2]);
- }
- break;
+ case DEL:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "tableName");
+ return TCL_ERROR;
}
+ if (Tcl_GetIndexFromObj(interp, objv[2], options, "table", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (tables[index] != NULL) {
+ Tk_DeleteOptionTable(tables[index]);
+ }
+ break;
- case CONFIG_ERROR: {
- typedef struct ErrorWidgetRecord {
- Tcl_Obj *intPtr;
- } ErrorWidgetRecord;
- ErrorWidgetRecord widgetRecord;
- static Tk_OptionSpec errorSpecs[] = {
- {TK_OPTION_INT,
- "-int", "integer", "Integer",
- "bogus", Tk_Offset(ErrorWidgetRecord, intPtr)},
- {TK_OPTION_END}
- };
- Tk_OptionTable optionTable;
-
- widgetRecord.intPtr = NULL;
- optionTable = Tk_CreateOptionTable(interp, errorSpecs);
- tables[index] = optionTable;
- return Tk_InitOptions(interp, (char *) &widgetRecord, optionTable,
- (Tk_Window) NULL);
+ case INFO:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "tableName");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[2], options, "table", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
}
+ Tcl_SetObjResult(interp, TkDebugConfig(interp, tables[index]));
+ break;
- case DEL: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "tableName");
- return TCL_ERROR;
- }
- if (Tcl_GetIndexFromObj(interp, objv[2], options, "table", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (tables[index] != NULL) {
- Tk_DeleteOptionTable(tables[index]);
+ case INTERNAL: {
+ /*
+ * This command is similar to the "alltypes" command except that it
+ * stores all the configuration options as internal forms instead of
+ * objects.
+ */
+
+ typedef struct InternalRecord {
+ TrivialCommandHeader header;
+ int boolean;
+ int integer;
+ double doubleValue;
+ char *string;
+ int index;
+ XColor *colorPtr;
+ Tk_Font tkfont;
+ Pixmap bitmap;
+ Tk_3DBorder border;
+ int relief;
+ Tk_Cursor cursor;
+ Tk_Justify justify;
+ Tk_Anchor anchor;
+ int pixels;
+ double mm;
+ Tk_Window tkwin;
+ char *custom;
+ } InternalRecord;
+ InternalRecord *recordPtr;
+ static char *internalStringTable[] = {
+ "one", "two", "three", "four", NULL
+ };
+ static const Tk_OptionSpec internalSpecs[] = {
+ {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1",
+ -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1},
+ {TK_OPTION_INT, "-integer", "integer", "Integer", "148962237",
+ -1, Tk_Offset(InternalRecord, integer), 0, 0, 0x2},
+ {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159",
+ -1, Tk_Offset(InternalRecord, doubleValue), 0, 0, 0x4},
+ {TK_OPTION_STRING, "-string", "string", "String", "foo",
+ -1, Tk_Offset(InternalRecord, string),
+ TK_CONFIG_NULL_OK, 0, 0x8},
+ {TK_OPTION_STRING_TABLE,
+ "-stringtable", "StringTable", "stringTable", "one",
+ -1, Tk_Offset(InternalRecord, index),
+ TK_CONFIG_NULL_OK, (ClientData) internalStringTable, 0x10},
+ {TK_OPTION_COLOR, "-color", "color", "Color", "red",
+ -1, Tk_Offset(InternalRecord, colorPtr),
+ TK_CONFIG_NULL_OK, (ClientData) "black", 0x20},
+ {TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12",
+ -1, Tk_Offset(InternalRecord, tkfont),
+ TK_CONFIG_NULL_OK, 0, 0x40},
+ {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50",
+ -1, Tk_Offset(InternalRecord, bitmap),
+ TK_CONFIG_NULL_OK, 0, 0x80},
+ {TK_OPTION_BORDER, "-border", "border", "Border", "blue",
+ -1, Tk_Offset(InternalRecord, border),
+ TK_CONFIG_NULL_OK, (ClientData) "white", 0x100},
+ {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised",
+ -1, Tk_Offset(InternalRecord, relief),
+ TK_CONFIG_NULL_OK, 0, 0x200},
+ {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm",
+ -1, Tk_Offset(InternalRecord, cursor),
+ TK_CONFIG_NULL_OK, 0, 0x400},
+ {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left",
+ -1, Tk_Offset(InternalRecord, justify),
+ TK_CONFIG_NULL_OK, 0, 0x800},
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL,
+ -1, Tk_Offset(InternalRecord, anchor),
+ TK_CONFIG_NULL_OK, 0, 0x1000},
+ {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1",
+ -1, Tk_Offset(InternalRecord, pixels),
+ TK_CONFIG_NULL_OK, 0, 0x2000},
+ {TK_OPTION_WINDOW, "-window", "window", "Window", NULL,
+ -1, Tk_Offset(InternalRecord, tkwin),
+ TK_CONFIG_NULL_OK, 0, 0},
+ {TK_OPTION_CUSTOM, "-custom", NULL, NULL, "",
+ -1, Tk_Offset(InternalRecord, custom),
+ TK_CONFIG_NULL_OK, (ClientData)&CustomOption, 0x4000},
+ {TK_OPTION_SYNONYM, "-synonym", NULL, NULL,
+ NULL, -1, -1, 0, (ClientData) "-color", 0x8000},
+ {TK_OPTION_END}
+ };
+ Tk_OptionTable optionTable;
+ Tk_Window tkwin;
+
+ optionTable = Tk_CreateOptionTable(interp, internalSpecs);
+ tables[index] = optionTable;
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
+ Tcl_GetString(objv[2]), NULL);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ Tk_SetClass(tkwin, "Test");
+
+ recordPtr = (InternalRecord *) ckalloc(sizeof(InternalRecord));
+ recordPtr->header.interp = interp;
+ recordPtr->header.optionTable = optionTable;
+ recordPtr->header.tkwin = tkwin;
+ recordPtr->boolean = 0;
+ recordPtr->integer = 0;
+ recordPtr->doubleValue = 0.0;
+ recordPtr->string = NULL;
+ recordPtr->index = 0;
+ recordPtr->colorPtr = NULL;
+ recordPtr->tkfont = NULL;
+ recordPtr->bitmap = None;
+ recordPtr->border = NULL;
+ recordPtr->relief = TK_RELIEF_FLAT;
+ recordPtr->cursor = NULL;
+ recordPtr->justify = TK_JUSTIFY_LEFT;
+ recordPtr->anchor = TK_ANCHOR_N;
+ recordPtr->pixels = 0;
+ recordPtr->mm = 0.0;
+ recordPtr->tkwin = NULL;
+ recordPtr->custom = NULL;
+ result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
+ tkwin);
+ if (result == TCL_OK) {
+ recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
+ Tcl_GetString(objv[2]), TrivialConfigObjCmd,
+ (ClientData) recordPtr, TrivialCmdDeletedProc);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask,
+ TrivialEventProc, (ClientData) recordPtr);
+ result = Tk_SetOptions(interp, (char *) recordPtr, optionTable,
+ objc - 3, objv + 3, tkwin, NULL, NULL);
+ if (result != TCL_OK) {
+ Tk_DestroyWindow(tkwin);
}
- break;
+ } else {
+ Tk_DestroyWindow(tkwin);
+ ckfree((char *) recordPtr);
+ }
+ if (result == TCL_OK) {
+ Tcl_SetObjResult(interp, objv[2]);
}
+ break;
+ }
- case INFO: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "tableName");
- return TCL_ERROR;
- }
- if (Tcl_GetIndexFromObj(interp, objv[2], options, "table", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- Tcl_SetObjResult(interp, TkDebugConfig(interp, tables[index]));
- break;
+ case NEW: {
+ typedef struct FiveRecord {
+ TrivialCommandHeader header;
+ Tcl_Obj *one;
+ Tcl_Obj *two;
+ Tcl_Obj *three;
+ Tcl_Obj *four;
+ Tcl_Obj *five;
+ } FiveRecord;
+ FiveRecord *recordPtr;
+ static const Tk_OptionSpec smallSpecs[] = {
+ {TK_OPTION_INT, "-one", "one", "One", "1",
+ Tk_Offset(FiveRecord, one), -1},
+ {TK_OPTION_INT, "-two", "two", "Two", "2",
+ Tk_Offset(FiveRecord, two), -1},
+ {TK_OPTION_INT, "-three", "three", "Three", "3",
+ Tk_Offset(FiveRecord, three), -1},
+ {TK_OPTION_INT, "-four", "four", "Four", "4",
+ Tk_Offset(FiveRecord, four), -1},
+ {TK_OPTION_STRING, "-five", NULL, NULL, NULL,
+ Tk_Offset(FiveRecord, five), -1},
+ {TK_OPTION_END}
+ };
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "new name ?options?");
+ return TCL_ERROR;
}
- case INTERNAL: {
- /*
- * This command is similar to the "alltypes" command except
- * that it stores all the configuration options as internal
- * forms instead of objects.
- */
-
- typedef struct InternalRecord {
- TrivialCommandHeader header;
- int boolean;
- int integer;
- double doubleValue;
- char *string;
- int index;
- XColor *colorPtr;
- Tk_Font tkfont;
- Pixmap bitmap;
- Tk_3DBorder border;
- int relief;
- Tk_Cursor cursor;
- Tk_Justify justify;
- Tk_Anchor anchor;
- int pixels;
- double mm;
- Tk_Window tkwin;
- char *custom;
- } InternalRecord;
- InternalRecord *recordPtr;
- static char *internalStringTable[] = {
- "one", "two", "three", "four", (char *) NULL
- };
- static Tk_OptionSpec internalSpecs[] = {
- {TK_OPTION_BOOLEAN,
- "-boolean", "boolean", "Boolean",
- "1", -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1},
- {TK_OPTION_INT,
- "-integer", "integer", "Integer",
- "148962237", -1, Tk_Offset(InternalRecord, integer),
- 0, 0, 0x2},
- {TK_OPTION_DOUBLE,
- "-double", "double", "Double",
- "3.14159", -1, Tk_Offset(InternalRecord, doubleValue),
- 0, 0, 0x4},
- {TK_OPTION_STRING,
- "-string", "string", "String",
- "foo", -1, Tk_Offset(InternalRecord, string),
- TK_CONFIG_NULL_OK, 0, 0x8},
- {TK_OPTION_STRING_TABLE,
- "-stringtable", "StringTable", "stringTable",
- "one", -1, Tk_Offset(InternalRecord, index),
- TK_CONFIG_NULL_OK, (ClientData) internalStringTable,
- 0x10},
- {TK_OPTION_COLOR,
- "-color", "color", "Color",
- "red", -1, Tk_Offset(InternalRecord, colorPtr),
- TK_CONFIG_NULL_OK, (ClientData) "black", 0x20},
- {TK_OPTION_FONT,
- "-font", "font", "Font",
- "Helvetica 12", -1, Tk_Offset(InternalRecord, tkfont),
- TK_CONFIG_NULL_OK, 0, 0x40},
- {TK_OPTION_BITMAP,
- "-bitmap", "bitmap", "Bitmap",
- "gray50", -1, Tk_Offset(InternalRecord, bitmap),
- TK_CONFIG_NULL_OK, 0, 0x80},
- {TK_OPTION_BORDER,
- "-border", "border", "Border",
- "blue", -1, Tk_Offset(InternalRecord, border),
- TK_CONFIG_NULL_OK, (ClientData) "white", 0x100},
- {TK_OPTION_RELIEF,
- "-relief", "relief", "Relief",
- "raised", -1, Tk_Offset(InternalRecord, relief),
- TK_CONFIG_NULL_OK, 0, 0x200},
- {TK_OPTION_CURSOR,
- "-cursor", "cursor", "Cursor",
- "xterm", -1, Tk_Offset(InternalRecord, cursor),
- TK_CONFIG_NULL_OK, 0, 0x400},
- {TK_OPTION_JUSTIFY,
- "-justify", (char *) NULL, (char *) NULL,
- "left", -1, Tk_Offset(InternalRecord, justify),
- TK_CONFIG_NULL_OK, 0, 0x800},
- {TK_OPTION_ANCHOR,
- "-anchor", "anchor", "Anchor",
- (char *) NULL, -1, Tk_Offset(InternalRecord, anchor),
- TK_CONFIG_NULL_OK, 0, 0x1000},
- {TK_OPTION_PIXELS,
- "-pixel", "pixel", "Pixel",
- "1", -1, Tk_Offset(InternalRecord, pixels),
- TK_CONFIG_NULL_OK, 0, 0x2000},
- {TK_OPTION_WINDOW,
- "-window", "window", "Window",
- (char *) NULL, -1, Tk_Offset(InternalRecord, tkwin),
- TK_CONFIG_NULL_OK, 0, 0},
- {TK_OPTION_CUSTOM,
- "-custom", (char *) NULL, (char *) NULL,
- "", -1, Tk_Offset(InternalRecord, custom),
- TK_CONFIG_NULL_OK, (ClientData)&CustomOption, 0x4000},
- {TK_OPTION_SYNONYM,
- "-synonym", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, -1, 0, (ClientData) "-color",
- 0x8000},
- {TK_OPTION_END}
- };
- Tk_OptionTable optionTable;
- Tk_Window tkwin;
- optionTable = Tk_CreateOptionTable(interp, internalSpecs);
- tables[index] = optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
- Tcl_GetStringFromObj(objv[2], NULL), (char *) NULL);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- Tk_SetClass(tkwin, "Test");
-
- recordPtr = (InternalRecord *) ckalloc(sizeof(InternalRecord));
- recordPtr->header.interp = interp;
- recordPtr->header.optionTable = optionTable;
- recordPtr->header.tkwin = tkwin;
- recordPtr->boolean = 0;
- recordPtr->integer = 0;
- recordPtr->doubleValue = 0.0;
- recordPtr->string = NULL;
- recordPtr->index = 0;
- recordPtr->colorPtr = NULL;
- recordPtr->tkfont = NULL;
- recordPtr->bitmap = None;
- recordPtr->border = NULL;
- recordPtr->relief = TK_RELIEF_FLAT;
- recordPtr->cursor = NULL;
- recordPtr->justify = TK_JUSTIFY_LEFT;
- recordPtr->anchor = TK_ANCHOR_N;
- recordPtr->pixels = 0;
- recordPtr->mm = 0.0;
- recordPtr->tkwin = NULL;
- recordPtr->custom = NULL;
- result = Tk_InitOptions(interp, (char *) recordPtr, optionTable,
- tkwin);
+ recordPtr = (FiveRecord *) ckalloc(sizeof(FiveRecord));
+ recordPtr->header.interp = interp;
+ recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
+ smallSpecs);
+ tables[index] = recordPtr->header.optionTable;
+ recordPtr->header.tkwin = NULL;
+ recordPtr->one = recordPtr->two = recordPtr->three = NULL;
+ recordPtr->four = recordPtr->five = NULL;
+ Tcl_SetObjResult(interp, objv[2]);
+ result = Tk_InitOptions(interp, (char *) recordPtr,
+ recordPtr->header.optionTable, (Tk_Window) NULL);
+ if (result == TCL_OK) {
+ result = Tk_SetOptions(interp, (char *) recordPtr,
+ recordPtr->header.optionTable, objc - 3, objv + 3,
+ (Tk_Window) NULL, NULL, NULL);
if (result == TCL_OK) {
recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
- Tcl_GetStringFromObj(objv[2], NULL),
- TrivialConfigObjCmd, (ClientData) recordPtr,
- TrivialCmdDeletedProc);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
- result = Tk_SetOptions(interp, (char *) recordPtr,
- optionTable, objc - 3, objv + 3, tkwin,
- (Tk_SavedOptions *) NULL, (int *) NULL);
- if (result != TCL_OK) {
- Tk_DestroyWindow(tkwin);
- }
+ Tcl_GetString(objv[2]), TrivialConfigObjCmd,
+ (ClientData) recordPtr, TrivialCmdDeletedProc);
} else {
- Tk_DestroyWindow(tkwin);
- ckfree((char *) recordPtr);
+ Tk_FreeConfigOptions((char *) recordPtr,
+ recordPtr->header.optionTable, (Tk_Window) NULL);
}
- if (result == TCL_OK) {
- Tcl_SetObjResult(interp, objv[2]);
- }
- break;
+ }
+ if (result != TCL_OK) {
+ ckfree((char *) recordPtr);
}
- case NEW: {
- typedef struct FiveRecord {
- TrivialCommandHeader header;
- Tcl_Obj *one;
- Tcl_Obj *two;
- Tcl_Obj *three;
- Tcl_Obj *four;
- Tcl_Obj *five;
- } FiveRecord;
- FiveRecord *recordPtr;
- static Tk_OptionSpec smallSpecs[] = {
- {TK_OPTION_INT,
- "-one", "one", "One",
- "1",
- Tk_Offset(FiveRecord, one), -1},
- {TK_OPTION_INT,
- "-two", "two", "Two",
- "2",
- Tk_Offset(FiveRecord, two), -1},
- {TK_OPTION_INT,
- "-three", "three", "Three",
- "3",
- Tk_Offset(FiveRecord, three), -1},
- {TK_OPTION_INT,
- "-four", "four", "Four",
- "4",
- Tk_Offset(FiveRecord, four), -1},
- {TK_OPTION_STRING,
- "-five", NULL, NULL,
- NULL,
- Tk_Offset(FiveRecord, five), -1},
- {TK_OPTION_END}
- };
-
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "new name ?options?");
- return TCL_ERROR;
- }
+ break;
+ }
+ case NOT_ENOUGH_PARAMS: {
+ typedef struct NotEnoughRecord {
+ Tcl_Obj *fooObjPtr;
+ } NotEnoughRecord;
+ NotEnoughRecord record;
+ static const Tk_OptionSpec errorSpecs[] = {
+ {TK_OPTION_INT, "-foo", "foo", "Foo", "0",
+ Tk_Offset(NotEnoughRecord, fooObjPtr)},
+ {TK_OPTION_END}
+ };
+ Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", -1);
+ Tk_OptionTable optionTable;
+
+ record.fooObjPtr = NULL;
+
+ tkwin = Tk_CreateWindowFromPath(interp, mainWin, ".config", NULL);
+ Tk_SetClass(tkwin, "Config");
+ optionTable = Tk_CreateOptionTable(interp, errorSpecs);
+ tables[index] = optionTable;
+ Tk_InitOptions(interp, (char *) &record, optionTable, tkwin);
+ if (Tk_SetOptions(interp, (char *) &record, optionTable, 1,
+ &newObjPtr, tkwin, NULL, NULL) != TCL_OK) {
+ result = TCL_ERROR;
+ }
+ Tcl_DecrRefCount(newObjPtr);
+ Tk_FreeConfigOptions( (char *) &record, optionTable, tkwin);
+ Tk_DestroyWindow(tkwin);
+ return result;
+ }
- recordPtr = (FiveRecord *) ckalloc(sizeof(FiveRecord));
- recordPtr->header.interp = interp;
- recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
- smallSpecs);
- tables[index] = recordPtr->header.optionTable;
- recordPtr->header.tkwin = NULL;
- recordPtr->one = recordPtr->two = recordPtr->three = NULL;
- recordPtr->four = recordPtr->five = NULL;
- Tcl_SetObjResult(interp, objv[2]);
- result = Tk_InitOptions(interp, (char *) recordPtr,
- recordPtr->header.optionTable, (Tk_Window) NULL);
- if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr,
- recordPtr->header.optionTable, objc - 3, objv + 3,
- (Tk_Window) NULL, (Tk_SavedOptions *) NULL,
- (int *) NULL);
- if (result == TCL_OK) {
- recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
- Tcl_GetStringFromObj(objv[2], NULL),
- TrivialConfigObjCmd, (ClientData) recordPtr,
- TrivialCmdDeletedProc);
- } else {
- Tk_FreeConfigOptions((char *) recordPtr,
- recordPtr->header.optionTable, (Tk_Window) NULL);
- }
- }
- if (result != TCL_OK) {
- ckfree((char *) recordPtr);
- }
+ case TWO_WINDOWS: {
+ typedef struct SlaveRecord {
+ TrivialCommandHeader header;
+ Tcl_Obj *windowPtr;
+ } SlaveRecord;
+ SlaveRecord *recordPtr;
+ static const Tk_OptionSpec slaveSpecs[] = {
+ {TK_OPTION_WINDOW, "-window", "window", "Window", ".bar",
+ Tk_Offset(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK},
+ {TK_OPTION_END}
+ };
+ Tk_Window tkwin = Tk_CreateWindowFromPath(interp,
+ (Tk_Window) clientData, Tcl_GetString(objv[2]), NULL);
- break;
- }
- case NOT_ENOUGH_PARAMS: {
- typedef struct NotEnoughRecord {
- Tcl_Obj *fooObjPtr;
- } NotEnoughRecord;
- NotEnoughRecord record;
- static Tk_OptionSpec errorSpecs[] = {
- {TK_OPTION_INT,
- "-foo", "foo", "Foo",
- "0", Tk_Offset(NotEnoughRecord, fooObjPtr)},
- {TK_OPTION_END}
- };
- Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", -1);
- Tk_OptionTable optionTable;
-
- record.fooObjPtr = NULL;
-
- tkwin = Tk_CreateWindowFromPath(interp, mainWin,
- ".config", (char *) NULL);
- Tk_SetClass(tkwin, "Config");
- optionTable = Tk_CreateOptionTable(interp, errorSpecs);
- tables[index] = optionTable;
- Tk_InitOptions(interp, (char *) &record, optionTable, tkwin);
- if (Tk_SetOptions(interp, (char *) &record, optionTable,
- 1, &newObjPtr, tkwin, (Tk_SavedOptions *) NULL,
- (int *) NULL)
- != TCL_OK) {
- result = TCL_ERROR;
- }
- Tcl_DecrRefCount(newObjPtr);
- Tk_FreeConfigOptions( (char *) &record, optionTable, tkwin);
- Tk_DestroyWindow(tkwin);
- return result;
+ if (tkwin == NULL) {
+ return TCL_ERROR;
}
-
- case TWO_WINDOWS: {
- typedef struct SlaveRecord {
- TrivialCommandHeader header;
- Tcl_Obj *windowPtr;
- } SlaveRecord;
- SlaveRecord *recordPtr;
- static Tk_OptionSpec slaveSpecs[] = {
- {TK_OPTION_WINDOW,
- "-window", "window", "Window",
- ".bar", Tk_Offset(SlaveRecord, windowPtr), -1,
- TK_CONFIG_NULL_OK},
- {TK_OPTION_END}
- };
- Tk_Window tkwin = Tk_CreateWindowFromPath(interp,
- (Tk_Window) clientData,
- Tcl_GetStringFromObj(objv[2], NULL), (char *) NULL);
- if (tkwin == NULL) {
- return TCL_ERROR;
- }
- Tk_SetClass(tkwin, "Test");
-
- recordPtr = (SlaveRecord *) ckalloc(sizeof(SlaveRecord));
- recordPtr->header.interp = interp;
- recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
- slaveSpecs);
- tables[index] = recordPtr->header.optionTable;
- recordPtr->header.tkwin = tkwin;
- recordPtr->windowPtr = NULL;
-
- result = Tk_InitOptions(interp, (char *) recordPtr,
- recordPtr->header.optionTable, tkwin);
+ Tk_SetClass(tkwin, "Test");
+
+ recordPtr = (SlaveRecord *) ckalloc(sizeof(SlaveRecord));
+ recordPtr->header.interp = interp;
+ recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
+ slaveSpecs);
+ tables[index] = recordPtr->header.optionTable;
+ recordPtr->header.tkwin = tkwin;
+ recordPtr->windowPtr = NULL;
+
+ result = Tk_InitOptions(interp, (char *) recordPtr,
+ recordPtr->header.optionTable, tkwin);
+ if (result == TCL_OK) {
+ result = Tk_SetOptions(interp, (char *) recordPtr,
+ recordPtr->header.optionTable, objc - 3, objv + 3,
+ tkwin, NULL, NULL);
if (result == TCL_OK) {
- result = Tk_SetOptions(interp, (char *) recordPtr,
- recordPtr->header.optionTable, objc - 3, objv + 3,
- tkwin, (Tk_SavedOptions *) NULL, (int *) NULL);
- if (result == TCL_OK) {
- recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
- Tcl_GetStringFromObj(objv[2], NULL),
- TrivialConfigObjCmd, (ClientData) recordPtr,
- TrivialCmdDeletedProc);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
- Tcl_SetObjResult(interp, objv[2]);
- } else {
- Tk_FreeConfigOptions((char *) recordPtr,
- recordPtr->header.optionTable, tkwin);
- }
- }
- if (result != TCL_OK) {
- Tk_DestroyWindow(tkwin);
- ckfree((char *) recordPtr);
+ recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
+ Tcl_GetString(objv[2]), TrivialConfigObjCmd,
+ (ClientData) recordPtr, TrivialCmdDeletedProc);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask,
+ TrivialEventProc, (ClientData) recordPtr);
+ Tcl_SetObjResult(interp, objv[2]);
+ } else {
+ Tk_FreeConfigOptions((char *) recordPtr,
+ recordPtr->header.optionTable, tkwin);
}
-
+ }
+ if (result != TCL_OK) {
+ Tk_DestroyWindow(tkwin);
+ ckfree((char *) recordPtr);
}
}
+ }
return result;
}
@@ -1346,15 +1243,15 @@ TestobjconfigObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
static int
-TrivialConfigObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TrivialConfigObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int result = TCL_OK;
static CONST char *options[] = {
- "cget", "configure", "csave", (char *) NULL
+ "cget", "configure", "csave", NULL
};
enum {
CGET, CONFIGURE, CSAVE
@@ -1370,69 +1267,66 @@ TrivialConfigObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[1], options, "command",
- 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], options, "command", 0,
+ &index) != TCL_OK) {
return TCL_ERROR;
}
Tcl_Preserve(clientData);
-
+
switch (index) {
- case CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
+ case CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ result = TCL_ERROR;
+ goto done;
+ }
+ resultObjPtr = Tk_GetOptionValue(interp, (char *) clientData,
+ headerPtr->optionTable, objv[2], tkwin);
+ if (resultObjPtr != NULL) {
+ Tcl_SetObjResult(interp, resultObjPtr);
+ result = TCL_OK;
+ } else {
+ result = TCL_ERROR;
+ }
+ break;
+ case CONFIGURE:
+ if (objc == 2) {
+ resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData,
+ headerPtr->optionTable, NULL, tkwin);
+ if (resultObjPtr == NULL) {
result = TCL_ERROR;
- goto done;
+ } else {
+ Tcl_SetObjResult(interp, resultObjPtr);
}
- resultObjPtr = Tk_GetOptionValue(interp, (char *) clientData,
+ } else if (objc == 3) {
+ resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData,
headerPtr->optionTable, objv[2], tkwin);
- if (resultObjPtr != NULL) {
- Tcl_SetObjResult(interp, resultObjPtr);
- result = TCL_OK;
- } else {
+ if (resultObjPtr == NULL) {
result = TCL_ERROR;
- }
- break;
- }
- case CONFIGURE: {
- if (objc == 2) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData,
- headerPtr->optionTable, (Tcl_Obj *) NULL, tkwin);
- if (resultObjPtr == NULL) {
- result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, resultObjPtr);
- }
- } else if (objc == 3) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData,
- headerPtr->optionTable, objv[2], tkwin);
- if (resultObjPtr == NULL) {
- result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, resultObjPtr);
- }
} else {
- result = Tk_SetOptions(interp, (char *) clientData,
- headerPtr->optionTable, objc - 2, objv + 2,
- tkwin, (Tk_SavedOptions *) NULL, &mask);
- if (result == TCL_OK) {
- Tcl_SetIntObj(Tcl_GetObjResult(interp), mask);
- }
+ Tcl_SetObjResult(interp, resultObjPtr);
}
- break;
- }
- case CSAVE: {
+ } else {
result = Tk_SetOptions(interp, (char *) clientData,
- headerPtr->optionTable, objc - 2, objv + 2,
- tkwin, &saved, &mask);
- Tk_FreeSavedOptions(&saved);
+ headerPtr->optionTable, objc - 2, objv + 2,
+ tkwin, NULL, &mask);
if (result == TCL_OK) {
Tcl_SetIntObj(Tcl_GetObjResult(interp), mask);
}
- break;
}
+ break;
+ case CSAVE:
+ result = Tk_SetOptions(interp, (char *) clientData,
+ headerPtr->optionTable, objc - 2, objv + 2,
+ tkwin, &saved, &mask);
+ Tk_FreeSavedOptions(&saved);
+ if (result == TCL_OK) {
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), mask);
+ }
+ break;
}
-done:
+ done:
Tcl_Release(clientData);
return result;
}
@@ -1442,9 +1336,9 @@ done:
*
* TrivialCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -1456,8 +1350,8 @@ done:
*/
static void
-TrivialCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+TrivialCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData;
Tk_Window tkwin = headerPtr->tkwin;
@@ -1466,9 +1360,9 @@ TrivialCmdDeletedProc(clientData)
Tk_DestroyWindow(tkwin);
} else if (headerPtr->optionTable != NULL) {
/*
- * This is a "new" object, which doesn't have a window, so
- * we can't depend on cleaning up in the event procedure.
- * Free its resources here.
+ * This is a "new" object, which doesn't have a window, so we can't
+ * depend on cleaning up in the event function. Free its resources
+ * here.
*/
Tk_FreeConfigOptions((char *) clientData,
@@ -1488,16 +1382,15 @@ TrivialCmdDeletedProc(clientData)
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up.
+ * When the window gets deleted, internal structures get cleaned up.
*
*--------------------------------------------------------------
*/
static void
-TrivialEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+TrivialEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData;
@@ -1519,8 +1412,8 @@ TrivialEventProc(clientData, eventPtr)
*
* TestfontObjCmd --
*
- * This procedure implements the "testfont" command, which is used
- * to test TkFont objects.
+ * This function implements the "testfont" command, which is used to test
+ * TkFont objects.
*
* Results:
* A standard Tcl result.
@@ -1533,18 +1426,18 @@ TrivialEventProc(clientData, eventPtr)
/* ARGSUSED */
static int
-TestfontObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+TestfontObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- static CONST char *options[] = {"counts", "subfonts", (char *) NULL};
+ static CONST char *options[] = {"counts", "subfonts", NULL};
enum option {COUNTS, SUBFONTS};
int index;
Tk_Window tkwin;
Tk_Font tkfont;
-
+
tkwin = (Tk_Window) clientData;
if (objc < 3) {
@@ -1558,20 +1451,18 @@ TestfontObjCmd(clientData, interp, objc, objv)
}
switch ((enum option) index) {
- case COUNTS: {
- Tcl_SetObjResult(interp, TkDebugFont(Tk_MainWindow(interp),
- Tcl_GetString(objv[2])));
- break;
- }
- case SUBFONTS: {
- tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
- if (tkfont == NULL) {
- return TCL_ERROR;
- }
- TkpGetSubFonts(interp, tkfont);
- Tk_FreeFont(tkfont);
- break;
+ case COUNTS:
+ Tcl_SetObjResult(interp,
+ TkDebugFont(Tk_MainWindow(interp), Tcl_GetString(objv[2])));
+ break;
+ case SUBFONTS:
+ tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
+ if (tkfont == NULL) {
+ return TCL_ERROR;
}
+ TkpGetSubFonts(interp, tkfont);
+ Tk_FreeFont(tkfont);
+ break;
}
return TCL_OK;
@@ -1582,8 +1473,7 @@ TestfontObjCmd(clientData, interp, objc, objv)
*
* ImageCreate --
*
- * This procedure is called by the Tk image code to create "test"
- * images.
+ * This function is called by the Tk image code to create "test" images.
*
* Results:
* A standard Tcl result.
@@ -1595,54 +1485,19 @@ TestfontObjCmd(clientData, interp, objc, objv)
*/
/* ARGSUSED */
-#ifdef USE_OLD_IMAGE
-static int
-ImageCreate(interp, name, argc, argv, typePtr, master, clientDataPtr)
- Tcl_Interp *interp; /* Interpreter for application containing
- * image. */
- char *name; /* Name to use for image. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings for options (doesn't
- * include image name or type). */
- Tk_ImageType *typePtr; /* Pointer to our type record (not used). */
- Tk_ImageMaster master; /* Token for image, to be used by us in
- * later callbacks. */
- ClientData *clientDataPtr; /* Store manager's token for image here;
- * it will be returned in later callbacks. */
-{
- TImageMaster *timPtr;
- char *varName;
- int i;
-
- Tk_InitImageArgs(interp, argc, &argv);
- varName = "log";
- for (i = 0; i < argc; i += 2) {
- if (strcmp(argv[i], "-variable") != 0) {
- Tcl_AppendResult(interp, "bad option name \"",
- argv[i], "\"", (char *) NULL);
- return TCL_ERROR;
- }
- if ((i+1) == argc) {
- Tcl_AppendResult(interp, "no value given for \"",
- argv[i], "\" option", (char *) NULL);
- return TCL_ERROR;
- }
- varName = argv[i+1];
- }
-#else
static int
-ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
- Tcl_Interp *interp; /* Interpreter for application containing
+ImageCreate(
+ Tcl_Interp *interp, /* Interpreter for application containing
* image. */
- char *name; /* Name to use for image. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument strings for options (doesn't
+ char *name, /* Name to use for image. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[], /* Argument strings for options (doesn't
* include image name or type). */
- Tk_ImageType *typePtr; /* Pointer to our type record (not used). */
- Tk_ImageMaster master; /* Token for image, to be used by us in
- * later callbacks. */
- ClientData *clientDataPtr; /* Store manager's token for image here;
- * it will be returned in later callbacks. */
+ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
+ Tk_ImageMaster master, /* Token for image, to be used by us in later
+ * callbacks. */
+ ClientData *clientDataPtr) /* Store manager's token for image here; it
+ * will be returned in later callbacks. */
{
TImageMaster *timPtr;
char *varName;
@@ -1652,17 +1507,17 @@ ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
for (i = 0; i < objc; i += 2) {
if (strcmp(Tcl_GetString(objv[i]), "-variable") != 0) {
Tcl_AppendResult(interp, "bad option name \"",
- Tcl_GetString(objv[i]), "\"", (char *) NULL);
+ Tcl_GetString(objv[i]), "\"", NULL);
return TCL_ERROR;
}
if ((i+1) == objc) {
Tcl_AppendResult(interp, "no value given for \"",
- Tcl_GetString(objv[i]), "\" option", (char *) NULL);
+ Tcl_GetString(objv[i]), "\" option", NULL);
return TCL_ERROR;
}
varName = Tcl_GetString(objv[i+1]);
}
-#endif
+
timPtr = (TImageMaster *) ckalloc(sizeof(TImageMaster));
timPtr->master = master;
timPtr->interp = interp;
@@ -1672,8 +1527,7 @@ ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
strcpy(timPtr->imageName, name);
timPtr->varName = (char *) ckalloc((unsigned) (strlen(varName) + 1));
strcpy(timPtr->varName, varName);
- Tcl_CreateCommand(interp, name, ImageCmd, (ClientData) timPtr,
- (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateCommand(interp, name, ImageCmd, (ClientData) timPtr, NULL);
*clientDataPtr = (ClientData) timPtr;
Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
return TCL_OK;
@@ -1684,8 +1538,8 @@ ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
*
* ImageCmd --
*
- * This procedure implements the commands corresponding to individual
- * images.
+ * This function implements the commands corresponding to individual
+ * images.
*
* Results:
* A standard Tcl result.
@@ -1698,26 +1552,24 @@ ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
/* ARGSUSED */
static int
-ImageCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+ImageCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
TImageMaster *timPtr = (TImageMaster *) clientData;
int x, y, width, height;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], "option ?arg arg ...?", (char *) NULL);
+ argv[0], "option ?arg arg ...?", NULL);
return TCL_ERROR;
}
if (strcmp(argv[1], "changed") == 0) {
if (argc != 8) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0],
- " changed x y width height imageWidth imageHeight",
- (char *) NULL);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " changed x y width height imageWidth imageHeight", NULL);
return TCL_ERROR;
}
if ((Tcl_GetInt(interp, argv[2], &x) != TCL_OK)
@@ -1732,7 +1584,7 @@ ImageCmd(clientData, interp, argc, argv)
timPtr->height);
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be changed", (char *) NULL);
+ "\": must be changed", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1743,12 +1595,12 @@ ImageCmd(clientData, interp, argc, argv)
*
* ImageGet --
*
- * This procedure is called by Tk to set things up for using a
- * test image in a particular widget.
+ * This function is called by Tk to set things up for using a test image
+ * in a particular widget.
*
* Results:
- * The return value is a token for the image instance, which is
- * used in future callbacks to ImageDisplay and ImageFree.
+ * The return value is a token for the image instance, which is used in
+ * future callbacks to ImageDisplay and ImageFree.
*
* Side effects:
* None.
@@ -1757,10 +1609,10 @@ ImageCmd(clientData, interp, argc, argv)
*/
static ClientData
-ImageGet(tkwin, clientData)
- Tk_Window tkwin; /* Token for window in which image will
- * be used. */
- ClientData clientData; /* Pointer to TImageMaster for image. */
+ImageGet(
+ Tk_Window tkwin, /* Token for window in which image will be
+ * used. */
+ ClientData clientData) /* Pointer to TImageMaster for image. */
{
TImageMaster *timPtr = (TImageMaster *) clientData;
TImageInstance *instPtr;
@@ -1784,29 +1636,29 @@ ImageGet(tkwin, clientData)
*
* ImageDisplay --
*
- * This procedure is invoked to redisplay part or all of an
- * image in a given drawable.
+ * This function is invoked to redisplay part or all of an image in a
+ * given drawable.
*
* Results:
* None.
*
* Side effects:
- * The image gets partially redrawn, as an "X" that shows the
- * exact redraw area.
+ * The image gets partially redrawn, as an "X" that shows the exact
+ * redraw area.
*
*----------------------------------------------------------------------
*/
static void
-ImageDisplay(clientData, display, drawable, imageX, imageY, width, height,
- drawableX, drawableY)
- ClientData clientData; /* Pointer to TImageInstance for image. */
- Display *display; /* Display to use for drawing. */
- Drawable drawable; /* Where to redraw image. */
- int imageX, imageY; /* Origin of area to redraw, relative to
+ImageDisplay(
+ ClientData clientData, /* Pointer to TImageInstance for image. */
+ Display *display, /* Display to use for drawing. */
+ Drawable drawable, /* Where to redraw image. */
+ int imageX, int imageY, /* Origin of area to redraw, relative to
* origin of image. */
- int width, height; /* Dimensions of area to redraw. */
- int drawableX, drawableY; /* Coordinates in drawable corresponding to
+ int width, int height, /* Dimensions of area to redraw. */
+ int drawableX, int drawableY)
+ /* Coordinates in drawable corresponding to
* imageX and imageY. */
{
TImageInstance *instPtr = (TImageInstance *) clientData;
@@ -1837,8 +1689,8 @@ ImageDisplay(clientData, display, drawable, imageX, imageY, width, height,
*
* ImageFree --
*
- * This procedure is called when an instance of an image is
- * no longer used.
+ * This function is called when an instance of an image is no longer
+ * used.
*
* Results:
* None.
@@ -1850,9 +1702,9 @@ ImageDisplay(clientData, display, drawable, imageX, imageY, width, height,
*/
static void
-ImageFree(clientData, display)
- ClientData clientData; /* Pointer to TImageInstance for instance. */
- Display *display; /* Display where image was to be drawn. */
+ImageFree(
+ ClientData clientData, /* Pointer to TImageInstance for instance. */
+ Display *display) /* Display where image was to be drawn. */
{
TImageInstance *instPtr = (TImageInstance *) clientData;
char buffer[200];
@@ -1870,8 +1722,8 @@ ImageFree(clientData, display)
*
* ImageDelete --
*
- * This procedure is called to clean up a test image when
- * an application goes away.
+ * This function is called to clean up a test image when an application
+ * goes away.
*
* Results:
* None.
@@ -1883,10 +1735,10 @@ ImageFree(clientData, display)
*/
static void
-ImageDelete(clientData)
- ClientData clientData; /* Pointer to TImageMaster for image. When
- * this procedure is called, no more
- * instances exist. */
+ImageDelete(
+ ClientData clientData) /* Pointer to TImageMaster for image. When
+ * this function is called, no more instances
+ * exist. */
{
TImageMaster *timPtr = (TImageMaster *) clientData;
char buffer[100];
@@ -1906,9 +1758,9 @@ ImageDelete(clientData)
*
* TestmakeexistCmd --
*
- * This procedure implements the "testmakeexist" command. It calls
- * Tk_MakeWindowExist on each of its arguments to force the windows
- * to be created.
+ * This function implements the "testmakeexist" command. It calls
+ * Tk_MakeWindowExist on each of its arguments to force the windows to be
+ * created.
*
* Results:
* A standard Tcl result.
@@ -1921,11 +1773,11 @@ ImageDelete(clientData)
/* ARGSUSED */
static int
-TestmakeexistCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestmakeexistCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
Tk_Window mainWin = (Tk_Window) clientData;
int i;
@@ -1947,9 +1799,9 @@ TestmakeexistCmd(clientData, interp, argc, argv)
*
* TestmenubarCmd --
*
- * This procedure implements the "testmenubar" command. It is used
- * to test the Unix facilities for creating space above a toplevel
- * window for a menubar.
+ * This function implements the "testmenubar" command. It is used to test
+ * the Unix facilities for creating space above a toplevel window for a
+ * menubar.
*
* Results:
* A standard Tcl result.
@@ -1961,13 +1813,13 @@ TestmakeexistCmd(clientData, interp, argc, argv)
*/
/* ARGSUSED */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int
-TestmenubarCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestmenubarCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
#ifdef __UNIX__
Tk_Window mainWin = (Tk_Window) clientData;
@@ -1975,14 +1827,14 @@ TestmenubarCmd(clientData, interp, argc, argv)
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- " option ?arg ...?\"", (char *) NULL);
+ " option ?arg ...?\"", NULL);
return TCL_ERROR;
}
if (strcmp(argv[1], "window") == 0) {
if (argc != 4) {
Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- "window toplevel menubar\"", (char *) NULL);
+ "window toplevel menubar\"", NULL);
return TCL_ERROR;
}
tkwin = Tk_NameToWindow(interp, argv[2], mainWin);
@@ -2000,7 +1852,7 @@ TestmenubarCmd(clientData, interp, argc, argv)
}
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be window", (char *) NULL);
+ "\": must be window", NULL);
return TCL_ERROR;
}
@@ -2018,8 +1870,8 @@ TestmenubarCmd(clientData, interp, argc, argv)
*
* TestmetricsCmd --
*
- * This procedure implements the testmetrics command. It provides
- * a way to determine the size of various widget components.
+ * This function implements the testmetrics command. It provides a way to
+ * determine the size of various widget components.
*
* Results:
* A standard Tcl result.
@@ -2030,13 +1882,13 @@ TestmenubarCmd(clientData, interp, argc, argv)
*----------------------------------------------------------------------
*/
-#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(__WIN32__) || defined(MAC_OSX_TK)
static int
-TestmetricsCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestmetricsCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
char buf[TCL_INTEGER_SPACE];
int val;
@@ -2044,7 +1896,7 @@ TestmetricsCmd(clientData, interp, argc, argv)
#ifdef __WIN32__
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- " option ?arg ...?\"", (char *) NULL);
+ " option ?arg ...?\"", NULL);
return TCL_ERROR;
}
#else
@@ -2053,7 +1905,7 @@ TestmetricsCmd(clientData, interp, argc, argv)
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- " option window\"", (char *) NULL);
+ " option window\"", NULL);
return TCL_ERROR;
}
@@ -2077,11 +1929,11 @@ TestmetricsCmd(clientData, interp, argc, argv)
#endif
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be cxhscroll or cyvscroll", (char *) NULL);
+ "\": must be cxhscroll or cyvscroll", NULL);
return TCL_ERROR;
}
sprintf(buf, "%d", val);
- Tcl_AppendResult(interp, buf, (char *) NULL);
+ Tcl_AppendResult(interp, buf, NULL);
return TCL_OK;
}
#endif
@@ -2091,8 +1943,8 @@ TestmetricsCmd(clientData, interp, argc, argv)
*
* TestpropCmd --
*
- * This procedure implements the "testprop" command. It fetches
- * and prints the value of a property on a window.
+ * This function implements the "testprop" command. It fetches and prints
+ * the value of a property on a window.
*
* Results:
* A standard Tcl result.
@@ -2105,23 +1957,24 @@ TestmetricsCmd(clientData, interp, argc, argv)
/* ARGSUSED */
static int
-TestpropCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestpropCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
Tk_Window mainWin = (Tk_Window) clientData;
int result, actualFormat;
unsigned long bytesAfter, length, value;
Atom actualType, propName;
- char *property, *p, *end;
+ unsigned char *property, *p;
+ char *end;
Window w;
char buffer[30];
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- " window property\"", (char *) NULL);
+ " window property\"", NULL);
return TCL_ERROR;
}
@@ -2131,7 +1984,7 @@ TestpropCmd(clientData, interp, argc, argv)
result = XGetWindowProperty(Tk_Display(mainWin),
w, propName, 0, 100000, False, AnyPropertyType,
&actualType, &actualFormat, &length,
- &bytesAfter, (unsigned char **) &property);
+ &bytesAfter, &property);
if ((result == Success) && (actualType != None)) {
if ((actualFormat == 8) && (actualType == XA_STRING)) {
for (p = property; ((unsigned long)(p-property)) < length; p++) {
@@ -2139,7 +1992,7 @@ TestpropCmd(clientData, interp, argc, argv)
*p = '\n';
}
}
- Tcl_SetResult(interp, property, TCL_VOLATILE);
+ Tcl_SetResult(interp, (/*!unsigned*/char*)property, TCL_VOLATILE);
} else {
for (p = property; length > 0; length--) {
if (actualFormat == 32) {
@@ -2163,209 +2016,15 @@ TestpropCmd(clientData, interp, argc, argv)
return TCL_OK;
}
-/*
- *----------------------------------------------------------------------
- *
- * TestsendCmd --
- *
- * This procedure implements the "testsend" command. It provides
- * a set of functions for testing the "send" command and support
- * procedure in tkSend.c.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * Depends on option; see below.
- *
- *----------------------------------------------------------------------
- */
-
- /* ARGSUSED */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
-static int
-TestsendCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
-{
- TkWindow *winPtr = (TkWindow *) clientData;
-
- if (argc < 2) {
- Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- " option ?arg ...?\"", (char *) NULL);
- return TCL_ERROR;
- }
-
- if (strcmp(argv[1], "bogus") == 0) {
- XChangeProperty(winPtr->dispPtr->display,
- RootWindow(winPtr->dispPtr->display, 0),
- winPtr->dispPtr->registryProperty, XA_INTEGER, 32,
- PropModeReplace,
- (unsigned char *) "This is bogus information", 6);
- } else if (strcmp(argv[1], "prop") == 0) {
- int result, actualFormat;
- unsigned long length, bytesAfter;
- Atom actualType, propName;
- char *property, *p, *end;
- Window w;
-
- if ((argc != 4) && (argc != 5)) {
- Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- " prop window name ?value ?\"", (char *) NULL);
- return TCL_ERROR;
- }
- if (strcmp(argv[2], "root") == 0) {
- w = RootWindow(winPtr->dispPtr->display, 0);
- } else if (strcmp(argv[2], "comm") == 0) {
- w = Tk_WindowId(winPtr->dispPtr->commTkwin);
- } else {
- w = strtoul(argv[2], &end, 0);
- }
- propName = Tk_InternAtom((Tk_Window) winPtr, argv[3]);
- if (argc == 4) {
- property = NULL;
- result = XGetWindowProperty(winPtr->dispPtr->display,
- w, propName, 0, 100000, False, XA_STRING,
- &actualType, &actualFormat, &length,
- &bytesAfter, (unsigned char **) &property);
- if ((result == Success) && (actualType != None)
- && (actualFormat == 8) && (actualType == XA_STRING)) {
- for (p = property; (p-property) < length; p++) {
- if (*p == 0) {
- *p = '\n';
- }
- }
- Tcl_SetResult(interp, property, TCL_VOLATILE);
- }
- if (property != NULL) {
- XFree(property);
- }
- } else {
- if (argv[4][0] == 0) {
- XDeleteProperty(winPtr->dispPtr->display, w, propName);
- } else {
- Tcl_DString tmp;
-
- Tcl_DStringInit(&tmp);
- for (p = Tcl_DStringAppend(&tmp, argv[4],
- (int) strlen(argv[4]));
- *p != 0; p++) {
- if (*p == '\n') {
- *p = 0;
- }
- }
-
- XChangeProperty(winPtr->dispPtr->display,
- w, propName, XA_STRING, 8, PropModeReplace,
- (unsigned char *) Tcl_DStringValue(&tmp),
- p-Tcl_DStringValue(&tmp));
- Tcl_DStringFree(&tmp);
- }
- }
- } else if (strcmp(argv[1], "serial") == 0) {
- char buf[TCL_INTEGER_SPACE];
-
- sprintf(buf, "%d", tkSendSerial+1);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- } else {
- Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be bogus, prop, or serial", (char *) NULL);
- return TCL_ERROR;
- }
- return TCL_OK;
-}
-#endif
-
-/*
- *----------------------------------------------------------------------
- *
- * TesttextCmd --
- *
- * This procedure implements the "testtext" command. It provides
- * a set of functions for testing text widgets and the associated
- * functions in tkText*.c.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * Depends on option; see below.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-TesttextCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
-{
- TkText *textPtr;
- size_t len;
- int lineIndex, byteIndex, byteOffset;
- TkTextIndex index;
- char buf[64];
- Tcl_CmdInfo info;
-
- if (argc < 3) {
- return TCL_ERROR;
- }
-
- if (Tcl_GetCommandInfo(interp, argv[1], &info) == 0) {
- return TCL_ERROR;
- }
- textPtr = (TkText *) info.clientData;
- len = strlen(argv[2]);
- if (strncmp(argv[2], "byteindex", len) == 0) {
- if (argc != 5) {
- return TCL_ERROR;
- }
- lineIndex = atoi(argv[3]) - 1;
- byteIndex = atoi(argv[4]);
-
- TkTextMakeByteIndex(textPtr->tree, lineIndex, byteIndex, &index);
- } else if (strncmp(argv[2], "forwbytes", len) == 0) {
- if (argc != 5) {
- return TCL_ERROR;
- }
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
- return TCL_ERROR;
- }
- byteOffset = atoi(argv[4]);
- TkTextIndexForwBytes(&index, byteOffset, &index);
- } else if (strncmp(argv[2], "backbytes", len) == 0) {
- if (argc != 5) {
- return TCL_ERROR;
- }
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
- return TCL_ERROR;
- }
- byteOffset = atoi(argv[4]);
- TkTextIndexBackBytes(&index, byteOffset, &index);
- } else {
- return TCL_ERROR;
- }
-
- TkTextSetMark(textPtr, "insert", &index);
- TkTextPrintIndex(&index, buf);
- sprintf(buf + strlen(buf), " %d", index.byteIndex);
- Tcl_AppendResult(interp, buf, NULL);
-
- return TCL_OK;
-}
-
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
/*
*----------------------------------------------------------------------
*
* TestwrapperCmd --
*
- * This procedure implements the "testwrapper" command. It
- * provides a way from Tcl to determine the extra window Tk adds
- * in between the toplevel window and the window decorations.
+ * This function implements the "testwrapper" command. It provides a way
+ * from Tcl to determine the extra window Tk adds in between the toplevel
+ * window and the window decorations.
*
* Results:
* A standard Tcl result.
@@ -2378,21 +2037,21 @@ TesttextCmd(clientData, interp, argc, argv)
/* ARGSUSED */
static int
-TestwrapperCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestwrapperCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
TkWindow *winPtr, *wrapperPtr;
Tk_Window tkwin;
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
- " window\"", (char *) NULL);
+ " window\"", NULL);
return TCL_ERROR;
}
-
+
tkwin = (Tk_Window) clientData;
winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[1], tkwin);
if (winPtr == NULL) {
@@ -2415,7 +2074,7 @@ TestwrapperCmd(clientData, interp, argc, argv)
*
* CustomOptionSet, CustomOptionGet, CustomOptionRestore, CustomOptionFree --
*
- * Handlers for object-based custom configuration options. See
+ * Handlers for object-based custom configuration options. See
* Testobjconfigcommand.
*
* Results:
@@ -2437,20 +2096,19 @@ TestwrapperCmd(clientData, interp, argc, argv)
*/
static int
-CustomOptionSet(clientData,interp, tkwin, value, recordPtr, internalOffset,
- saveInternalPtr, flags)
- ClientData clientData;
- Tcl_Interp *interp;
- Tk_Window tkwin;
- Tcl_Obj **value;
- char *recordPtr;
- int internalOffset;
- char *saveInternalPtr;
- int flags;
+CustomOptionSet(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj **value,
+ char *recordPtr,
+ int internalOffset,
+ char *saveInternalPtr,
+ int flags)
{
int objEmpty, length;
- char *new, *string, *internalPtr;
-
+ char *newStr, *string, *internalPtr;
+
objEmpty = 0;
if (internalOffset >= 0) {
@@ -2458,21 +2116,20 @@ CustomOptionSet(clientData,interp, tkwin, value, recordPtr, internalOffset,
} else {
internalPtr = NULL;
}
-
+
/*
* See if the object is empty.
*/
+
if (value == NULL) {
objEmpty = 1;
+ } else if ((*value)->bytes != NULL) {
+ objEmpty = ((*value)->length == 0);
} else {
- if ((*value)->bytes != NULL) {
- objEmpty = ((*value)->length == 0);
- } else {
- Tcl_GetStringFromObj((*value), &length);
- objEmpty = (length == 0);
- }
+ Tcl_GetStringFromObj((*value), &length);
+ objEmpty = (length == 0);
}
-
+
if ((flags & TK_OPTION_NULL_OK) && objEmpty) {
*value = NULL;
} else {
@@ -2487,47 +2144,54 @@ CustomOptionSet(clientData,interp, tkwin, value, recordPtr, internalOffset,
if (internalPtr != NULL) {
if ((*value) != NULL) {
string = Tcl_GetStringFromObj((*value), &length);
- new = ckalloc((size_t) (length + 1));
- strcpy(new, string);
+ newStr = ckalloc((size_t) (length + 1));
+ strcpy(newStr, string);
} else {
- new = NULL;
+ newStr = NULL;
}
*((char **) saveInternalPtr) = *((char **) internalPtr);
- *((char **) internalPtr) = new;
+ *((char **) internalPtr) = newStr;
}
return TCL_OK;
}
static Tcl_Obj *
-CustomOptionGet(clientData, tkwin, recordPtr, internalOffset)
- ClientData clientData;
- Tk_Window tkwin;
- char *recordPtr;
- int internalOffset;
+CustomOptionGet(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *recordPtr,
+ int internalOffset)
{
return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1));
}
static void
-CustomOptionRestore(clientData, tkwin, internalPtr, saveInternalPtr)
- ClientData clientData;
- Tk_Window tkwin;
- char *internalPtr;
- char *saveInternalPtr;
+CustomOptionRestore(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *internalPtr,
+ char *saveInternalPtr)
{
*(char **)internalPtr = *(char **)saveInternalPtr;
return;
}
static void
-CustomOptionFree(clientData, tkwin, internalPtr)
- ClientData clientData;
- Tk_Window tkwin;
- char *internalPtr;
+CustomOptionFree(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *internalPtr)
{
if (*(char **)internalPtr != NULL) {
ckfree(*(char **)internalPtr);
}
}
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkText.c b/generic/tkText.c
index 54f148d..187be65 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -1,347 +1,431 @@
-/*
+/*
* tkText.c --
*
- * This module provides a big chunk of the implementation of
- * multi-line editable text widgets for Tk. Among other things,
- * it provides the Tcl command interfaces to text widgets and
- * the display code. The B-tree representation of text is
- * implemented elsewhere.
+ * This module provides a big chunk of the implementation of multi-line
+ * editable text widgets for Tk. Among other things, it provides the Tcl
+ * command interfaces to text widgets. The B-tree representation of text
+ * and its actual display are implemented elsewhere.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
* Copyright (c) 1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "default.h"
-#include "tkPort.h"
#include "tkInt.h"
#include "tkUndo.h"
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
#define Style TkStyle
#define DInfo TkDInfo
#endif
+/*
+ * For compatibility with Tk 4.0 through 8.4.x, we allow tabs to be
+ * mis-specified with non-increasing values. These are converted into tabs
+ * which are the equivalent of at least a character width apart.
+ */
+
+#if (TK_MAJOR_VERSION < 9)
+#define _TK_ALLOW_DECREASING_TABS
+#endif
+
#include "tkText.h"
/*
- * Custom options for handling "-state"
+ * Used to avoid having to allocate and deallocate arrays on the fly for
+ * commonly used functions. Must be > 0.
+ */
+
+#define PIXEL_CLIENTS 5
+
+/*
+ * The 'TkTextState' enum in tkText.h is used to define a type for the -state
+ * option of the Text widget. These values are used as indices into the string
+ * table below.
*/
-static Tk_CustomOption stateOption = {
- (Tk_OptionParseProc *) TkStateParseProc,
- TkStatePrintProc, (ClientData) NULL /* only "normal" and "disabled" */
+static char *stateStrings[] = {
+ "disabled", "normal", NULL
};
/*
- * Information used to parse text configuration options:
+ * The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap
+ * option of the Text widget. These values are used as indices into the string
+ * table below.
*/
-static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_BOOLEAN, "-autoseparators", "autoSeparators",
- "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS,
- Tk_Offset(TkText, autoSeparators), 0},
- {TK_CONFIG_BORDER, "-background", "background", "Background",
- DEF_TEXT_BG_COLOR, Tk_Offset(TkText, border), TK_CONFIG_COLOR_ONLY},
- {TK_CONFIG_BORDER, "-background", "background", "Background",
- DEF_TEXT_BG_MONO, Tk_Offset(TkText, border), TK_CONFIG_MONO_ONLY},
- {TK_CONFIG_SYNONYM, "-bd", "borderWidth", (char *) NULL,
- (char *) NULL, 0, 0},
- {TK_CONFIG_SYNONYM, "-bg", "background", (char *) NULL,
- (char *) NULL, 0, 0},
- {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_TEXT_BORDER_WIDTH, Tk_Offset(TkText, borderWidth), 0},
- {TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_TEXT_CURSOR, Tk_Offset(TkText, cursor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_BOOLEAN, "-exportselection", "exportSelection",
- "ExportSelection", DEF_TEXT_EXPORT_SELECTION,
- Tk_Offset(TkText, exportSelection), 0},
- {TK_CONFIG_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, 0},
- {TK_CONFIG_FONT, "-font", "font", "Font",
- DEF_TEXT_FONT, Tk_Offset(TkText, tkfont), 0},
- {TK_CONFIG_COLOR, "-foreground", "foreground", "Foreground",
- DEF_TEXT_FG, Tk_Offset(TkText, fgColor), 0},
- {TK_CONFIG_PIXELS, "-height", "height", "Height",
- DEF_TEXT_HEIGHT, Tk_Offset(TkText, height), 0},
- {TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground",
- "HighlightBackground", DEF_TEXT_HIGHLIGHT_BG,
- Tk_Offset(TkText, highlightBgColorPtr), 0},
- {TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_TEXT_HIGHLIGHT, Tk_Offset(TkText, highlightColorPtr), 0},
- {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness",
- DEF_TEXT_HIGHLIGHT_WIDTH, Tk_Offset(TkText, highlightWidth), 0},
- {TK_CONFIG_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_TEXT_INSERT_BG, Tk_Offset(TkText, insertBorder), 0},
- {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth",
- DEF_TEXT_INSERT_BD_COLOR, Tk_Offset(TkText, insertBorderWidth),
- TK_CONFIG_COLOR_ONLY},
- {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth",
- DEF_TEXT_INSERT_BD_MONO, Tk_Offset(TkText, insertBorderWidth),
- TK_CONFIG_MONO_ONLY},
- {TK_CONFIG_INT, "-insertofftime", "insertOffTime", "OffTime",
- DEF_TEXT_INSERT_OFF_TIME, Tk_Offset(TkText, insertOffTime), 0},
- {TK_CONFIG_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_TEXT_INSERT_ON_TIME, Tk_Offset(TkText, insertOnTime), 0},
- {TK_CONFIG_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_TEXT_INSERT_WIDTH, Tk_Offset(TkText, insertWidth), 0},
- {TK_CONFIG_INT, "-maxundo", "maxUndo", "MaxUndo",
- DEF_TEXT_MAX_UNDO, Tk_Offset(TkText, maxUndo), 0},
- {TK_CONFIG_PIXELS, "-padx", "padX", "Pad",
- DEF_TEXT_PADX, Tk_Offset(TkText, padX), 0},
- {TK_CONFIG_PIXELS, "-pady", "padY", "Pad",
- DEF_TEXT_PADY, Tk_Offset(TkText, padY), 0},
- {TK_CONFIG_RELIEF, "-relief", "relief", "Relief",
- DEF_TEXT_RELIEF, Tk_Offset(TkText, relief), 0},
- {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_TEXT_SELECT_COLOR, Tk_Offset(TkText, selBorder),
- TK_CONFIG_COLOR_ONLY},
- {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground",
- DEF_TEXT_SELECT_MONO, Tk_Offset(TkText, selBorder),
- TK_CONFIG_MONO_ONLY},
- {TK_CONFIG_STRING, "-selectborderwidth", "selectBorderWidth", "BorderWidth",
- DEF_TEXT_SELECT_BD_COLOR, Tk_Offset(TkText, selBdString),
- TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-selectborderwidth", "selectBorderWidth", "BorderWidth",
- DEF_TEXT_SELECT_BD_MONO, Tk_Offset(TkText, selBdString),
- TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_TEXT_SELECT_FG_COLOR, Tk_Offset(TkText, selFgColorPtr),
- TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background",
- DEF_TEXT_SELECT_FG_MONO, Tk_Offset(TkText, selFgColorPtr),
- TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK},
- {TK_CONFIG_BOOLEAN, "-setgrid", "setGrid", "SetGrid",
- DEF_TEXT_SET_GRID, Tk_Offset(TkText, setGrid), 0},
- {TK_CONFIG_PIXELS, "-spacing1", "spacing1", "Spacing",
- DEF_TEXT_SPACING1, Tk_Offset(TkText, spacing1),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_PIXELS, "-spacing2", "spacing2", "Spacing",
- DEF_TEXT_SPACING2, Tk_Offset(TkText, spacing2),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_PIXELS, "-spacing3", "spacing3", "Spacing",
- DEF_TEXT_SPACING3, Tk_Offset(TkText, spacing3),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-state", "state", "State",
- DEF_TEXT_STATE, Tk_Offset(TkText, state), 0, &stateOption},
- {TK_CONFIG_STRING, "-tabs", "tabs", "Tabs",
- DEF_TEXT_TABS, Tk_Offset(TkText, tabOptionString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus",
- DEF_TEXT_TAKE_FOCUS, Tk_Offset(TkText, takeFocus),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BOOLEAN, "-undo", "undo", "Undo",
- DEF_TEXT_UNDO, Tk_Offset(TkText, undo), 0},
- {TK_CONFIG_INT, "-width", "width", "Width",
- DEF_TEXT_WIDTH, Tk_Offset(TkText, width), 0},
- {TK_CONFIG_CUSTOM, "-wrap", "wrap", "Wrap",
- DEF_TEXT_WRAP, Tk_Offset(TkText, wrapMode), 0, &TkTextWrapModeOption},
- {TK_CONFIG_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
- DEF_TEXT_XSCROLL_COMMAND, Tk_Offset(TkText, xScrollCmd),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
- DEF_TEXT_YSCROLL_COMMAND, Tk_Offset(TkText, yScrollCmd),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+static char *wrapStrings[] = {
+ "char", "none", "word", NULL
};
/*
- * Boolean variable indicating whether or not special debugging code
- * should be executed.
+ * The 'TkTextTabStyle' enum in tkText.h is used to define a type for the
+ * -tabstyle option of the Text widget. These values are used as indices into
+ * the string table below.
*/
-int tkTextDebug = 0;
+static char *tabStyleStrings[] = {
+ "tabular", "wordprocessor", NULL
+};
/*
- * Custom options for handling "-wrap":
+ * The following functions and custom option type are used to define the
+ * "line" option type, and thereby handle the text widget '-startline',
+ * '-endline' configuration options which are of that type.
+ *
+ * We do not need a 'freeProc' because all changes to these two options are
+ * handled through the TK_TEXT_LINE_RANGE flag in the optionSpecs list, and
+ * the internal storage is just a pointer, which therefore doesn't need
+ * freeing.
*/
-static int WrapModeParseProc _ANSI_ARGS_((ClientData clientData,
+static int SetLineStartEnd(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *widgRec, int offset));
-static char * WrapModePrintProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-
-Tk_CustomOption TkTextWrapModeOption = {
- WrapModeParseProc,
- WrapModePrintProc,
- (ClientData) NULL
+ Tcl_Obj **value, char *recordPtr,
+ int internalOffset, char *oldInternalPtr,
+ int flags);
+static Tcl_Obj * GetLineStartEnd(ClientData clientData,
+ Tk_Window tkwin, char *recordPtr,
+ int internalOffset);
+static void RestoreLineStartEnd(ClientData clientData,
+ Tk_Window tkwin, char *internalPtr,
+ char *oldInternalPtr);
+static int ObjectIsEmpty(Tcl_Obj *objPtr);
+
+static Tk_ObjCustomOption lineOption = {
+ "line", /* name */
+ SetLineStartEnd, /* setProc */
+ GetLineStartEnd, /* getProc */
+ RestoreLineStartEnd, /* restoreProc */
+ NULL, /* freeProc */
+ 0
};
/*
- *--------------------------------------------------------------
- *
- * WrapModeParseProc --
- *
- * This procedure is invoked during option processing to handle
- * "-wrap" options for text widgets.
- *
- * Results:
- * A standard Tcl return value.
- *
- * Side effects:
- * The wrap mode for a given item gets replaced by the wrap mode
- * indicated in the value argument.
- *
- *--------------------------------------------------------------
+ * Information used to parse text configuration options:
*/
-static int
-WrapModeParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* some flags.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option (list of tag
- * names). */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
-{
- int c;
- size_t length;
+static const Tk_OptionSpec optionSpecs[] = {
+ {TK_OPTION_BOOLEAN, "-autoseparators", "autoSeparators",
+ "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, -1,
+ Tk_Offset(TkText, autoSeparators), 0, 0, 0},
+ {TK_OPTION_BORDER, "-background", "background", "Background",
+ DEF_TEXT_BG_COLOR, -1, Tk_Offset(TkText, border),
+ 0, (ClientData) DEF_TEXT_BG_MONO, 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth",
+ TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_BOOLEAN, "-blockcursor", "blockCursor",
+ "BlockCursor", DEF_TEXT_BLOCK_CURSOR, -1,
+ Tk_Offset(TkText, insertCursorType), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
+ DEF_TEXT_BORDER_WIDTH, -1, Tk_Offset(TkText, borderWidth),
+ 0, 0, TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
+ DEF_TEXT_CURSOR, -1, Tk_Offset(TkText, cursor),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_CUSTOM, "-endline", NULL, NULL,
+ NULL, -1, Tk_Offset(TkText, end), TK_OPTION_NULL_OK,
+ (ClientData) &lineOption, TK_TEXT_LINE_RANGE},
+ {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
+ "ExportSelection", DEF_TEXT_EXPORT_SELECTION, -1,
+ Tk_Offset(TkText, exportSelection), 0, 0, 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_FONT, "-font", "font", "Font",
+ DEF_TEXT_FONT, -1, Tk_Offset(TkText, tkfont), 0, 0,
+ TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
+ DEF_TEXT_FG, -1, Tk_Offset(TkText, fgColor), 0,
+ 0, 0},
+ {TK_OPTION_PIXELS, "-height", "height", "Height",
+ DEF_TEXT_HEIGHT, -1, Tk_Offset(TkText, height), 0, 0, 0},
+ {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
+ "HighlightBackground", DEF_TEXT_HIGHLIGHT_BG,
+ -1, Tk_Offset(TkText, highlightBgColorPtr),
+ 0, 0, 0},
+ {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
+ DEF_TEXT_HIGHLIGHT, -1, Tk_Offset(TkText, highlightColorPtr),
+ 0, 0, 0},
+ {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
+ "HighlightThickness", DEF_TEXT_HIGHLIGHT_WIDTH, -1,
+ Tk_Offset(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_BORDER, "-inactiveselectbackground","inactiveSelectBackground",
+ "Foreground",
+ DEF_TEXT_INACTIVE_SELECT_COLOR,
+ -1, Tk_Offset(TkText, inactiveSelBorder),
+ TK_OPTION_NULL_OK, (ClientData) DEF_TEXT_SELECT_MONO, 0},
+ {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
+ DEF_TEXT_INSERT_BG,
+ -1, Tk_Offset(TkText, insertBorder),
+ 0, 0, 0},
+ {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
+ "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, -1,
+ Tk_Offset(TkText, insertBorderWidth), 0,
+ (ClientData) DEF_TEXT_INSERT_BD_MONO, 0},
+ {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
+ DEF_TEXT_INSERT_OFF_TIME, -1, Tk_Offset(TkText, insertOffTime),
+ 0, 0, 0},
+ {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
+ DEF_TEXT_INSERT_ON_TIME, -1, Tk_Offset(TkText, insertOnTime),
+ 0, 0, 0},
+ {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
+ DEF_TEXT_INSERT_WIDTH, -1, Tk_Offset(TkText, insertWidth),
+ 0, 0, 0},
+ {TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo",
+ DEF_TEXT_MAX_UNDO, -1, Tk_Offset(TkText, maxUndo), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-padx", "padX", "Pad",
+ DEF_TEXT_PADX, -1, Tk_Offset(TkText, padX), 0, 0,
+ TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_PIXELS, "-pady", "padY", "Pad",
+ DEF_TEXT_PADY, -1, Tk_Offset(TkText, padY), 0, 0, 0},
+ {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
+ DEF_TEXT_RELIEF, -1, Tk_Offset(TkText, relief), 0, 0, 0},
+ {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
+ DEF_TEXT_SELECT_COLOR, -1, Tk_Offset(TkText, selBorder),
+ 0, (ClientData) DEF_TEXT_SELECT_MONO, 0},
+ {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth",
+ "BorderWidth", DEF_TEXT_SELECT_BD_COLOR,
+ Tk_Offset(TkText, selBorderWidthPtr),
+ Tk_Offset(TkText, selBorderWidth),
+ TK_OPTION_NULL_OK, (ClientData) DEF_TEXT_SELECT_BD_MONO, 0},
+ {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
+ DEF_TEXT_SELECT_FG_COLOR, -1, Tk_Offset(TkText, selFgColorPtr),
+ TK_CONFIG_NULL_OK, (ClientData) DEF_TEXT_SELECT_FG_MONO, 0},
+ {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid",
+ DEF_TEXT_SET_GRID, -1, Tk_Offset(TkText, setGrid), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-spacing1", "spacing1", "Spacing",
+ DEF_TEXT_SPACING1, -1, Tk_Offset(TkText, spacing1),
+ TK_OPTION_DONT_SET_DEFAULT, 0 , TK_TEXT_LINE_GEOMETRY },
+ {TK_OPTION_PIXELS, "-spacing2", "spacing2", "Spacing",
+ DEF_TEXT_SPACING2, -1, Tk_Offset(TkText, spacing2),
+ TK_OPTION_DONT_SET_DEFAULT, 0 , TK_TEXT_LINE_GEOMETRY },
+ {TK_OPTION_PIXELS, "-spacing3", "spacing3", "Spacing",
+ DEF_TEXT_SPACING3, -1, Tk_Offset(TkText, spacing3),
+ TK_OPTION_DONT_SET_DEFAULT, 0 , TK_TEXT_LINE_GEOMETRY },
+ {TK_OPTION_CUSTOM, "-startline", NULL, NULL,
+ NULL, -1, Tk_Offset(TkText, start), TK_OPTION_NULL_OK,
+ (ClientData) &lineOption, TK_TEXT_LINE_RANGE},
+ {TK_OPTION_STRING_TABLE, "-state", "state", "State",
+ DEF_TEXT_STATE, -1, Tk_Offset(TkText, state),
+ 0, (ClientData) stateStrings, 0},
+ {TK_OPTION_STRING, "-tabs", "tabs", "Tabs",
+ DEF_TEXT_TABS, Tk_Offset(TkText, tabOptionPtr), -1,
+ TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_STRING_TABLE, "-tabstyle", "tabStyle", "TabStyle",
+ DEF_TEXT_TABSTYLE, -1, Tk_Offset(TkText, tabStyle),
+ 0, (ClientData) tabStyleStrings, TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
+ DEF_TEXT_TAKE_FOCUS, -1, Tk_Offset(TkText, takeFocus),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_BOOLEAN, "-undo", "undo", "Undo",
+ DEF_TEXT_UNDO, -1, Tk_Offset(TkText, undo), 0, 0 , 0},
+ {TK_OPTION_INT, "-width", "width", "Width",
+ DEF_TEXT_WIDTH, -1, Tk_Offset(TkText, width), 0, 0,
+ TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_STRING_TABLE, "-wrap", "wrap", "Wrap",
+ DEF_TEXT_WRAP, -1, Tk_Offset(TkText, wrapMode),
+ 0, (ClientData) wrapStrings, TK_TEXT_LINE_GEOMETRY},
+ {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
+ DEF_TEXT_XSCROLL_COMMAND, -1, Tk_Offset(TkText, xScrollCmd),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
+ DEF_TEXT_YSCROLL_COMMAND, -1, Tk_Offset(TkText, yScrollCmd),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0}
+};
- register TkWrapMode *wrapPtr = (TkWrapMode *) (widgRec + offset);
+/*
+ * These three typedefs, the structure and the SearchPerform, SearchCore
+ * functions below are used for line-based searches of the text widget, and,
+ * in particular, to handle multi-line matching even though the text widget is
+ * a single-line based data structure. They are completely abstracted away
+ * from the Text widget internals, however, so could easily be re-used with
+ * any line-based entity to provide multi-line matching.
+ *
+ * We have abstracted this code away from the text widget to try to keep Tk as
+ * modular as possible.
+ */
- if(value == NULL || *value == 0) {
- *wrapPtr = TEXT_WRAPMODE_NULL;
- return TCL_OK;
- }
+struct SearchSpec; /* Forward declaration. */
+
+typedef ClientData SearchAddLineProc(int lineNum,
+ struct SearchSpec *searchSpecPtr,
+ Tcl_Obj *theLine, int *lenPtr,
+ int *extraLinesPtr);
+typedef int SearchMatchProc(int lineNum,
+ struct SearchSpec *searchSpecPtr,
+ ClientData clientData, Tcl_Obj *theLine,
+ int matchOffset, int matchLength);
+typedef int SearchLineIndexProc(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, struct SearchSpec *searchSpecPtr,
+ int *linePosPtr, int *offsetPosPtr);
+
+typedef struct SearchSpec {
+ int exact; /* Whether search is exact or regexp. */
+ int noCase; /* Case-insenstivive? */
+ int noLineStop; /* If not set, a regexp search will use the
+ * TCL_REG_NLSTOP flag. */
+ int overlap; /* If set, results from multiple searches
+ * (-all) are allowed to overlap each
+ * other. */
+ int strictLimits; /* If set, matches must be completely inside
+ * the from,to range. Otherwise the limits
+ * only apply to the start of each match. */
+ int all; /* Whether all or the first match should be
+ * reported. */
+ int startLine; /* First line to examine. */
+ int startOffset; /* Index in first line to start at. */
+ int stopLine; /* Last line to examine, or -1 when we search
+ * all available text. */
+ int stopOffset; /* Index to stop at, provided stopLine is not
+ * -1. */
+ int numLines; /* Total lines which are available. */
+ int backwards; /* Searching forwards or backwards. */
+ Tcl_Obj *varPtr; /* If non-NULL, store length(s) of match(es)
+ * in this variable. */
+ Tcl_Obj *countPtr; /* Keeps track of currently found lengths. */
+ Tcl_Obj *resPtr; /* Keeps track of currently found locations */
+ int searchElide; /* Search in hidden text as well. */
+ SearchAddLineProc *addLineProc;
+ /* Function to call when we need to add
+ * another line to the search string so far */
+ SearchMatchProc *foundMatchProc;
+ /* Function to call when we have found a
+ * match. */
+ SearchLineIndexProc *lineIndexProc;
+ /* Function to call when we have found a
+ * match. */
+ ClientData clientData; /* Information about structure being searched,
+ * in this case a text widget. */
+} SearchSpec;
- c = value[0];
- length = strlen(value);
+/*
+ * The text-widget-independent functions which actually perform the search,
+ * handling both regexp and exact searches.
+ */
- if ((c == 'c') && (strncmp(value, "char", length) == 0)) {
- *wrapPtr = TEXT_WRAPMODE_CHAR;
- return TCL_OK;
- }
- if ((c == 'n') && (strncmp(value, "none", length) == 0)) {
- *wrapPtr = TEXT_WRAPMODE_NONE;
- return TCL_OK;
- }
- if ((c == 'w') && (strncmp(value, "word", length) == 0)) {
- *wrapPtr = TEXT_WRAPMODE_WORD;
- return TCL_OK;
- }
- Tcl_AppendResult(interp, "bad wrap mode \"", value,
- "\": must be char, none, or word",
- (char *) NULL);
- *wrapPtr = TEXT_WRAPMODE_CHAR;
- return TCL_ERROR;
-}
+static int SearchCore(Tcl_Interp *interp,
+ SearchSpec *searchSpecPtr, Tcl_Obj *patObj);
+static int SearchPerform(Tcl_Interp *interp,
+ SearchSpec *searchSpecPtr, Tcl_Obj *patObj,
+ Tcl_Obj *fromPtr, Tcl_Obj *toPtr);
/*
- *--------------------------------------------------------------
- *
- * WrapModePrintProc --
- *
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-wrap" configuration
- * option for canvas items.
- *
- * Results:
- * The return value is a string describing the state for
- * the item referred to by "widgRec". In addition, *freeProcPtr
- * is filled in with the address of a procedure to call to free
- * the result string when it's no longer needed (or NULL to
- * indicate that the string doesn't need to be freed).
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
+ * Boolean variable indicating whether or not special debugging code should be
+ * executed.
*/
-static char *
-WrapModePrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Ignored. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
-{
- register TkWrapMode *wrapPtr = (TkWrapMode *) (widgRec + offset);
-
- if (*wrapPtr==TEXT_WRAPMODE_CHAR) {
- return "char";
- } else if (*wrapPtr==TEXT_WRAPMODE_NONE) {
- return "none";
- } else if (*wrapPtr==TEXT_WRAPMODE_WORD) {
- return "word";
- } else {
- return "";
- }
-}
+int tkTextDebug = 0;
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int ConfigureText _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, int argc, CONST char **argv,
- int flags));
-static int DeleteChars _ANSI_ARGS_((TkText *textPtr,
- CONST char *index1String, CONST char *index2String,
- TkTextIndex *indexPtr1, TkTextIndex *indexPtr2));
-static void DestroyText _ANSI_ARGS_((char *memPtr));
-static void InsertChars _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr, CONST char *string));
-static void TextBlinkProc _ANSI_ARGS_((ClientData clientData));
-static void TextCmdDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static void TextEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int TextFetchSelection _ANSI_ARGS_((ClientData clientData,
- int offset, char *buffer, int maxBytes));
-static int TextIndexSortProc _ANSI_ARGS_((CONST VOID *first,
- CONST VOID *second));
-static int TextSearchCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TextEditCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TextWidgetCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static void TextWorldChanged _ANSI_ARGS_((
- ClientData instanceData));
-static int TextDumpCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static void DumpLine _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, int what, TkTextLine *linePtr,
- int start, int end, int lineno,
- CONST char *command));
-static int DumpSegment _ANSI_ARGS_((Tcl_Interp *interp, char *key,
- char *value, CONST char * command,
- TkTextIndex *index, int what));
-static int TextEditUndo _ANSI_ARGS_((TkText *textPtr));
-static int TextEditRedo _ANSI_ARGS_((TkText *textPtr));
-static void TextGetText _ANSI_ARGS_((TkTextIndex * index1,
- TkTextIndex * index2, Tcl_DString *dsPtr));
+static int ConfigureText(Tcl_Interp *interp,
+ TkText *textPtr, int objc, Tcl_Obj *CONST objv[]);
+static int DeleteIndexRange(TkSharedText *sharedPtr,
+ TkText *textPtr, CONST TkTextIndex *indexPtr1,
+ CONST TkTextIndex *indexPtr2, int viewUpdate);
+static int CountIndices(CONST TkText *textPtr,
+ CONST TkTextIndex *indexPtr1,
+ CONST TkTextIndex *indexPtr2,
+ TkTextCountType type);
+static void DestroyText(TkText *textPtr);
+static int InsertChars(TkSharedText *sharedTextPtr,
+ TkText *textPtr, TkTextIndex *indexPtr,
+ Tcl_Obj *stringPtr, int viewUpdate);
+static void TextBlinkProc(ClientData clientData);
+static void TextCmdDeletedProc(ClientData clientData);
+static int CreateWidget(TkSharedText *sharedPtr, Tk_Window tkwin,
+ Tcl_Interp *interp, CONST TkText *parent,
+ int objc, Tcl_Obj *CONST objv[]);
+static void TextEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static int TextFetchSelection(ClientData clientData, int offset,
+ char *buffer, int maxBytes);
+static int TextIndexSortProc(CONST void *first,
+ CONST void *second);
+static int TextInsertCmd(TkSharedText *sharedTextPtr,
+ TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[],
+ CONST TkTextIndex *indexPtr, int viewUpdate);
+static int TextReplaceCmd(TkText *textPtr, Tcl_Interp *interp,
+ CONST TkTextIndex *indexFromPtr,
+ CONST TkTextIndex *indexToPtr,
+ int objc, Tcl_Obj *CONST objv[], int viewUpdate);
+static int TextSearchCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int TextEditCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int TextWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int SharedTextObjCmd(ClientData clientData,
+ Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static void TextWorldChangedCallback(ClientData instanceData);
+static void TextWorldChanged(TkText *textPtr, int mask);
+static int TextDumpCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static int DumpLine(Tcl_Interp *interp, TkText *textPtr,
+ int what, TkTextLine *linePtr, int start, int end,
+ int lineno, Tcl_Obj *command);
+static int DumpSegment(TkText *textPtr, Tcl_Interp *interp,
+ CONST char *key, CONST char *value,
+ Tcl_Obj *command, CONST TkTextIndex *index,
+ int what);
+static int TextEditUndo(TkText *textPtr);
+static int TextEditRedo(TkText *textPtr);
+static Tcl_Obj * TextGetText(CONST TkText *textPtr,
+ CONST TkTextIndex *index1,
+ CONST TkTextIndex *index2, int visibleOnly);
static void GenerateModifiedEvent(TkText *textPtr);
-static void updateDirtyFlag _ANSI_ARGS_((TkText *textPtr));
+static void UpdateDirtyFlag(TkSharedText *sharedPtr);
+static void TextPushUndoAction(TkText *textPtr,
+ Tcl_Obj *undoString, int insert,
+ CONST TkTextIndex *index1Ptr,
+ CONST TkTextIndex *index2Ptr);
+static int TextSearchIndexInLine(CONST SearchSpec *searchSpecPtr,
+ TkTextLine *linePtr, int byteIndex);
+static int TextPeerCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[]);
+static TkUndoProc TextUndoRedoCallback;
+
+/*
+ * Declarations of the three search procs required by the multi-line search
+ * routines.
+ */
+
+static SearchMatchProc TextSearchFoundMatch;
+static SearchAddLineProc TextSearchAddNextLine;
+static SearchLineIndexProc TextSearchGetLineIndex;
/*
- * The structure below defines text class behavior by means of procedures
- * that can be invoked from generic window code.
+ * The structure below defines text class behavior by means of functions that
+ * can be invoked from generic window code.
*/
static Tk_ClassProcs textClass = {
sizeof(Tk_ClassProcs), /* size */
- TextWorldChanged, /* worldChangedProc */
+ TextWorldChangedCallback, /* worldChangedProc */
+ NULL, /* createProc */
+ NULL /* modalProc */
};
-
/*
*--------------------------------------------------------------
*
- * Tk_TextCmd --
+ * Tk_TextObjCmd --
*
- * This procedure is invoked to process the "text" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "text" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -353,85 +437,201 @@ static Tk_ClassProcs textClass = {
*/
int
-Tk_TextCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+Tk_TextObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
- Tk_Window new;
- register TkText *textPtr;
- TkTextIndex startIndex;
- if (argc < 2) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " pathName ?options?\"", (char *) NULL);
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
return TCL_ERROR;
}
+ return CreateWidget(NULL, tkwin, interp, NULL, objc, objv);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * CreateWidget --
+ *
+ * This function is invoked to process the "text" Tcl command, (when
+ * called by Tk_TextObjCmd) and the "$text peer create" text widget
+ * sub-command (called from TextPeerCmd).
+ *
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result, places the name of the widget created into the
+ * interp's result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+CreateWidget(
+ TkSharedText *sharedPtr, /* Shared widget info, or NULL. */
+ Tk_Window tkwin, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ CONST TkText *parent, /* If non-NULL then take default start, end
+ * from this parent. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
+ register TkText *textPtr;
+ Tk_OptionTable optionTable;
+ TkTextIndex startIndex;
+ Tk_Window newWin;
+
/*
* Create the window.
*/
- new = Tk_CreateWindowFromPath(interp, tkwin, argv[1], (char *) NULL);
- if (new == NULL) {
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]),
+ NULL);
+ if (newWin == NULL) {
return TCL_ERROR;
}
/*
- * Create the text widget and initialize everything to zero,
- * then set the necessary initial (non-NULL) values.
+ * Create the text widget and initialize everything to zero, then set the
+ * necessary initial (non-NULL) values. It is important that the 'set' tag
+ * and 'insert', 'current' mark pointers are all NULL to start.
*/
textPtr = (TkText *) ckalloc(sizeof(TkText));
- memset((VOID *) textPtr, 0, sizeof(TkText));
+ memset(textPtr, 0, sizeof(TkText));
- textPtr->tkwin = new;
- textPtr->display = Tk_Display(new);
+ textPtr->tkwin = newWin;
+ textPtr->display = Tk_Display(newWin);
textPtr->interp = interp;
- textPtr->widgetCmd = Tcl_CreateCommand(interp,
- Tk_PathName(textPtr->tkwin), TextWidgetCmd,
+ textPtr->widgetCmd = Tcl_CreateObjCommand(interp,
+ Tk_PathName(textPtr->tkwin), TextWidgetObjCmd,
(ClientData) textPtr, TextCmdDeletedProc);
- textPtr->tree = TkBTreeCreate(textPtr);
- Tcl_InitHashTable(&textPtr->tagTable, TCL_STRING_KEYS);
- Tcl_InitHashTable(&textPtr->markTable, TCL_STRING_KEYS);
- Tcl_InitHashTable(&textPtr->windowTable, TCL_STRING_KEYS);
- Tcl_InitHashTable(&textPtr->imageTable, TCL_STRING_KEYS);
- textPtr->state = TK_STATE_NORMAL;
+
+ if (sharedPtr == NULL) {
+ sharedPtr = (TkSharedText *) ckalloc(sizeof(TkSharedText));
+ memset(sharedPtr, 0, sizeof(TkSharedText));
+
+ sharedPtr->refCount = 0;
+ sharedPtr->peers = NULL;
+ sharedPtr->tree = TkBTreeCreate(sharedPtr);
+
+ Tcl_InitHashTable(&sharedPtr->tagTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&sharedPtr->markTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&sharedPtr->windowTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&sharedPtr->imageTable, TCL_STRING_KEYS);
+ sharedPtr->undoStack = TkUndoInitStack(interp,0);
+ sharedPtr->undo = 1;
+ sharedPtr->isDirty = 0;
+ sharedPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
+ sharedPtr->autoSeparators = 1;
+ sharedPtr->lastEditMode = TK_TEXT_EDIT_OTHER;
+ sharedPtr->stateEpoch = 0;
+ }
+
+ /*
+ * Add the new widget to the shared list.
+ */
+
+ textPtr->sharedTextPtr = sharedPtr;
+ sharedPtr->refCount++;
+ textPtr->next = sharedPtr->peers;
+ sharedPtr->peers = textPtr;
+
+ /*
+ * This refCount will be held until DestroyText is called. Note also that
+ * the later call to 'TkTextCreateDInfo' will add more refCounts.
+ */
+
+ textPtr->refCount = 1;
+
+ /*
+ * Specify start and end lines in the B-tree. The default is the same as
+ * the parent, but this can be adjusted to display more or less if the
+ * start, end where given as configuration options.
+ */
+
+ if (parent != NULL) {
+ textPtr->start = parent->start;
+ textPtr->end = parent->end;
+ } else {
+ textPtr->start = NULL;
+ textPtr->end = NULL;
+ }
+
+ /*
+ * Register with the B-tree. In some sense it would be best if we could do
+ * this later (after configuration options), so that any changes to
+ * start,end do not require a total recalculation.
+ */
+
+ TkBTreeAddClient(sharedPtr->tree, textPtr, textPtr->charHeight);
+
+ textPtr->state = TK_TEXT_STATE_NORMAL;
textPtr->relief = TK_RELIEF_FLAT;
textPtr->cursor = None;
textPtr->charWidth = 1;
+ textPtr->charHeight = 10;
textPtr->wrapMode = TEXT_WRAPMODE_CHAR;
- textPtr->prevWidth = Tk_Width(new);
- textPtr->prevHeight = Tk_Height(new);
+ textPtr->prevWidth = Tk_Width(newWin);
+ textPtr->prevHeight = Tk_Height(newWin);
+
+ /*
+ * This will add refCounts to textPtr.
+ */
+
TkTextCreateDInfo(textPtr);
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &startIndex);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0,
+ &startIndex);
TkTextSetYView(textPtr, &startIndex, 0);
textPtr->exportSelection = 1;
textPtr->pickEvent.type = LeaveNotify;
- textPtr->undoStack = TkUndoInitStack(interp,0);
- textPtr->undo = 1;
- textPtr->isDirty = 0;
- textPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
- textPtr->autoSeparators = 1;
- textPtr->lastEditMode = TK_TEXT_EDIT_OTHER;
+ textPtr->undo = textPtr->sharedTextPtr->undo;
+ textPtr->maxUndo = textPtr->sharedTextPtr->maxUndo;
+ textPtr->autoSeparators = textPtr->sharedTextPtr->autoSeparators;
+ textPtr->tabOptionPtr = NULL;
/*
* Create the "sel" tag and the "current" and "insert" marks.
*/
- textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel");
- textPtr->selTagPtr->reliefString =
- (char *) ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF));
+ textPtr->selBorder = NULL;
+ textPtr->inactiveSelBorder = NULL;
+ textPtr->selBorderWidth = 0;
+ textPtr->selBorderWidthPtr = NULL;
+ textPtr->selFgColorPtr = NULL;
+
+ /*
+ * Note: it is important that textPtr->selTagPtr is NULL before this
+ * initial call.
+ */
+
+ textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL);
+ textPtr->selTagPtr->reliefString = (char *)
+ ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF));
strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF);
- Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &(textPtr->selTagPtr->relief));
+ Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief);
textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &startIndex);
textPtr->insertMarkPtr = TkTextSetMark(textPtr, "insert", &startIndex);
+ /*
+ * Create the option table for this widget class. If it has already been
+ * created, the cached pointer will be returned.
+ */
+
+ optionTable = Tk_CreateOptionTable(interp, optionSpecs);
+
Tk_SetClass(textPtr->tkwin, "Text");
Tk_SetClassProcs(textPtr->tkwin, &textClass, (ClientData) textPtr);
+ textPtr->optionTable = optionTable;
+
Tk_CreateEventHandler(textPtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
TextEventProc, (ClientData) textPtr);
@@ -441,23 +641,30 @@ Tk_TextCmd(clientData, interp, argc, argv)
TkTextBindProc, (ClientData) textPtr);
Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING,
TextFetchSelection, (ClientData) textPtr, XA_STRING);
- if (ConfigureText(interp, textPtr, argc-2, argv+2, 0) != TCL_OK) {
+
+ if (Tk_InitOptions(interp, (char *) textPtr, optionTable, textPtr->tkwin)
+ != TCL_OK) {
+ Tk_DestroyWindow(textPtr->tkwin);
+ return TCL_ERROR;
+ }
+ if (ConfigureText(interp, textPtr, objc-2, objv+2) != TCL_OK) {
Tk_DestroyWindow(textPtr->tkwin);
return TCL_ERROR;
}
- Tcl_SetResult(interp, Tk_PathName(textPtr->tkwin), TCL_STATIC);
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(Tk_PathName(textPtr->tkwin),-1));
return TCL_OK;
}
/*
*--------------------------------------------------------------
*
- * TextWidgetCmd --
+ * TextWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a text widget. See the user
- * documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a text widget. See the user documentation for details on what it
+ * does.
*
* Results:
* A standard Tcl result.
@@ -469,88 +676,118 @@ Tk_TextCmd(clientData, interp, argc, argv)
*/
static int
-TextWidgetCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TextWidgetObjCmd(
+ ClientData clientData, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register TkText *textPtr = (TkText *) clientData;
- int c, result = TCL_OK;
- size_t length;
- TkTextIndex index1, index2;
+ int result = TCL_OK;
+ int index;
+
+ static CONST char *optionStrings[] = {
+ "bbox", "cget", "compare", "configure", "count", "debug", "delete",
+ "dlineinfo", "dump", "edit", "get", "image", "index", "insert",
+ "mark", "peer", "replace", "scan", "search", "see", "tag", "window",
+ "xview", "yview", NULL
+ };
+ enum options {
+ TEXT_BBOX, TEXT_CGET, TEXT_COMPARE, TEXT_CONFIGURE, TEXT_COUNT,
+ TEXT_DEBUG, TEXT_DELETE, TEXT_DLINEINFO, TEXT_DUMP, TEXT_EDIT,
+ TEXT_GET, TEXT_IMAGE, TEXT_INDEX, TEXT_INSERT, TEXT_MARK,
+ TEXT_PEER, TEXT_REPLACE, TEXT_SCAN, TEXT_SEARCH, TEXT_SEE,
+ TEXT_TAG, TEXT_WINDOW, TEXT_XVIEW, TEXT_YVIEW
+ };
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
+ return TCL_ERROR;
+ }
- if (argc < 2) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " option ?arg arg ...?\"", (char *) NULL);
+ if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
+ &index) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) textPtr);
- c = argv[1][0];
- length = strlen(argv[1]);
- if ((c == 'b') && (strncmp(argv[1], "bbox", length) == 0)) {
+ textPtr->refCount++;
+
+ switch ((enum options) index) {
+ case TEXT_BBOX: {
int x, y, width, height;
+ CONST TkTextIndex *indexPtr;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " bbox index\"", (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
result = TCL_ERROR;
goto done;
}
- if (TkTextGetIndex(interp, textPtr, argv[2], &index1) != TCL_OK) {
+ indexPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]);
+ if (indexPtr == NULL) {
result = TCL_ERROR;
goto done;
}
- if (TkTextCharBbox(textPtr, &index1, &x, &y, &width, &height) == 0) {
- char buf[TCL_INTEGER_SPACE * 4];
-
- sprintf(buf, "%d %d %d %d", x, y, width, height);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- }
- } else if ((c == 'c') && (strncmp(argv[1], "cget", length) == 0)
- && (length >= 2)) {
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " cget option\"",
- (char *) NULL);
+ if (TkTextIndexBbox(textPtr, indexPtr, &x, &y, &width, &height,
+ NULL) == 0) {
+ Tcl_Obj *listObj = Tcl_NewListObj(0, NULL);
+
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(x));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(y));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(width));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(height));
+
+ Tcl_SetObjResult(interp, listObj);
+ }
+ break;
+ }
+ case TEXT_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
result = TCL_ERROR;
goto done;
+ } else {
+ Tcl_Obj *objPtr = Tk_GetOptionValue(interp, (char *) textPtr,
+ textPtr->optionTable, objv[2], textPtr->tkwin);
+ if (objPtr == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ result = TCL_OK;
+ }
}
- result = Tk_ConfigureValue(interp, textPtr->tkwin, configSpecs,
- (char *) textPtr, argv[2], 0);
- } else if ((c == 'c') && (strncmp(argv[1], "compare", length) == 0)
- && (length >= 3)) {
+ break;
+ case TEXT_COMPARE: {
int relation, value;
CONST char *p;
+ CONST TkTextIndex *index1Ptr, *index2Ptr;
- if (argc != 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " compare index1 op index2\"", (char *) NULL);
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index1 op index2");
result = TCL_ERROR;
goto done;
}
- if ((TkTextGetIndex(interp, textPtr, argv[2], &index1) != TCL_OK)
- || (TkTextGetIndex(interp, textPtr, argv[4], &index2)
- != TCL_OK)) {
+ index1Ptr = TkTextGetIndexFromObj(interp, textPtr, objv[2]);
+ index2Ptr = TkTextGetIndexFromObj(interp, textPtr, objv[4]);
+ if (index1Ptr == NULL || index2Ptr == NULL) {
result = TCL_ERROR;
goto done;
}
- relation = TkTextIndexCmp(&index1, &index2);
- p = argv[3];
+ relation = TkTextIndexCmp(index1Ptr, index2Ptr);
+ p = Tcl_GetString(objv[3]);
if (p[0] == '<') {
- value = (relation < 0);
+ value = (relation < 0);
if ((p[1] == '=') && (p[2] == 0)) {
value = (relation <= 0);
} else if (p[1] != 0) {
- compareError:
+ compareError:
Tcl_AppendResult(interp, "bad comparison operator \"",
- argv[3], "\": must be <, <=, ==, >=, >, or !=",
- (char *) NULL);
+ Tcl_GetString(objv[3]),
+ "\": must be <, <=, ==, >=, >, or !=", NULL);
result = TCL_ERROR;
goto done;
}
} else if (p[0] == '>') {
- value = (relation > 0);
+ value = (relation > 0);
if ((p[1] == '=') && (p[2] == 0)) {
value = (relation >= 0);
} else if (p[1] != 0) {
@@ -563,104 +800,355 @@ TextWidgetCmd(clientData, interp, argc, argv)
} else {
goto compareError;
}
- Tcl_SetResult(interp, ((value) ? "1" : "0"), TCL_STATIC);
- } else if ((c == 'c') && (strncmp(argv[1], "configure", length) == 0)
- && (length >= 3)) {
- if (argc == 2) {
- result = Tk_ConfigureInfo(interp, textPtr->tkwin, configSpecs,
- (char *) textPtr, (char *) NULL, 0);
- } else if (argc == 3) {
- result = Tk_ConfigureInfo(interp, textPtr->tkwin, configSpecs,
- (char *) textPtr, argv[2], 0);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
+ break;
+ }
+ case TEXT_CONFIGURE:
+ if (objc <= 3) {
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) textPtr,
+ textPtr->optionTable, ((objc == 3) ? objv[2] : NULL),
+ textPtr->tkwin);
+ if (objPtr == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ }
} else {
- result = ConfigureText(interp, textPtr, argc-2, argv+2,
- TK_CONFIG_ARGV_ONLY);
- }
- } else if ((c == 'd') && (strncmp(argv[1], "debug", length) == 0)
- && (length >= 3)) {
- if (argc > 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " debug boolean\"", (char *) NULL);
+ result = ConfigureText(interp, textPtr, objc-2, objv+2);
+ }
+ break;
+ case TEXT_COUNT: {
+ CONST TkTextIndex *indexFromPtr, *indexToPtr;
+ int i, found = 0, update = 0;
+ Tcl_Obj *objPtr = NULL;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?options? index1 index2");
result = TCL_ERROR;
goto done;
}
- if (argc == 2) {
- Tcl_SetResult(interp, ((tkBTreeDebug) ? "1" : "0"), TCL_STATIC);
+
+ indexFromPtr = TkTextGetIndexFromObj(interp, textPtr, objv[objc-2]);
+ if (indexFromPtr == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ indexToPtr = TkTextGetIndexFromObj(interp, textPtr, objv[objc-1]);
+ if (indexToPtr == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ }
+
+ for (i = 2; i < objc-2; i++) {
+ int value, length;
+ CONST char *option = Tcl_GetStringFromObj(objv[i], &length);
+ char c;
+
+ if (length < 2 || option[0] != '-') {
+ badOption:
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bad option \"",
+ Tcl_GetString(objv[i]),
+ "\" must be -chars, -displaychars, -displayindices, ",
+ "-displaylines, -indices, -lines, -update, ",
+ "-xpixels, or -ypixels", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+ c = option[1];
+ if (c == 'c' && !strncmp("-chars", option, (unsigned) length)) {
+ value = CountIndices(textPtr, indexFromPtr, indexToPtr,
+ COUNT_CHARS);
+ } else if (c == 'd' && (length > 8)
+ && !strncmp("-displaychars", option, (unsigned) length)) {
+ value = CountIndices(textPtr, indexFromPtr, indexToPtr,
+ COUNT_DISPLAY_CHARS);
+ } else if (c == 'd' && (length > 8)
+ && !strncmp("-displayindices", option,(unsigned)length)) {
+ value = CountIndices(textPtr, indexFromPtr, indexToPtr,
+ COUNT_DISPLAY_INDICES);
+ } else if (c == 'd' && (length > 8)
+ && !strncmp("-displaylines", option, (unsigned) length)) {
+ TkTextLine *fromPtr, *lastPtr;
+ TkTextIndex index;
+
+ int compare = TkTextIndexCmp(indexFromPtr, indexToPtr);
+ value = 0;
+
+ if (compare == 0) {
+ goto countDone;
+ }
+
+ if (compare > 0) {
+ CONST TkTextIndex *tmpPtr = indexFromPtr;
+
+ indexFromPtr = indexToPtr;
+ indexToPtr = tmpPtr;
+ }
+
+ lastPtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree,textPtr));
+ fromPtr = indexFromPtr->linePtr;
+ if (fromPtr == lastPtr) {
+ goto countDone;
+ }
+
+ /*
+ * Caution: we must NEVER call TkTextUpdateOneLine with the
+ * last artificial line in the widget.
+ */
+
+ index = *indexFromPtr;
+ index.byteIndex = 0;
+
+ /*
+ * We're going to count up all display lines in the logical
+ * line of 'indexFromPtr' up to, but not including the logical
+ * line of 'indexToPtr', and then subtract off what we didn't
+ * what from 'from' and add on what we didn't count from 'to.
+ */
+
+ while (index.linePtr != indexToPtr->linePtr) {
+ value += TkTextUpdateOneLine(textPtr, fromPtr,0,&index,0);
+
+ /*
+ * We might have skipped past indexToPtr, if we have
+ * multiple logical lines in a single display line.
+ * Therefore we iterate through each intermediate logical
+ * line, just to check. Another approach would be just to
+ * use TkTextIndexCmp on every while() iteration, but that
+ * would be less efficient.
+ */
+
+ while (fromPtr != index.linePtr) {
+ fromPtr = TkBTreeNextLine(textPtr, fromPtr);
+ if (fromPtr == indexToPtr->linePtr) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * Now we need to adjust the count to add on the number of
+ * display lines in the last logical line, and subtract off
+ * the number of display lines overcounted in the first
+ * logical line. This logic is still ok if both indices are in
+ * the same logical line.
+ */
+
+ index.linePtr = indexFromPtr->linePtr;
+ index.byteIndex = 0;
+ while (1) {
+ TkTextFindDisplayLineEnd(textPtr, &index, 1, NULL);
+ if (index.byteIndex >= indexFromPtr->byteIndex) {
+ break;
+ }
+ TkTextIndexForwBytes(textPtr, &index, 1, &index);
+ value--;
+
+ }
+ if (indexToPtr->linePtr != lastPtr) {
+ index.linePtr = indexToPtr->linePtr;
+ index.byteIndex = 0;
+ while (1) {
+ TkTextFindDisplayLineEnd(textPtr, &index, 1, NULL);
+ if (index.byteIndex >= indexToPtr->byteIndex) {
+ break;
+ }
+ TkTextIndexForwBytes(textPtr, &index, 1, &index);
+ value++;
+ }
+ }
+
+ if (compare > 0) {
+ value = -value;
+ }
+ } else if (c == 'i'
+ && !strncmp("-indices", option, (unsigned) length)) {
+ value = CountIndices(textPtr, indexFromPtr, indexToPtr,
+ COUNT_INDICES);
+ } else if (c == 'l'
+ && !strncmp("-lines", option, (unsigned) length)) {
+ value = TkBTreeLinesTo(textPtr, indexToPtr->linePtr)
+ - TkBTreeLinesTo(textPtr, indexFromPtr->linePtr);
+ } else if (c == 'u'
+ && !strncmp("-update", option, (unsigned) length)) {
+ update = 1;
+ continue;
+ } else if (c == 'x'
+ && !strncmp("-xpixels", option, (unsigned) length)) {
+ int x1, x2;
+ TkTextIndex index;
+
+ index = *indexFromPtr;
+ TkTextFindDisplayLineEnd(textPtr, &index, 0, &x1);
+ index = *indexToPtr;
+ TkTextFindDisplayLineEnd(textPtr, &index, 0, &x2);
+ value = x2 - x1;
+ } else if (c == 'y'
+ && !strncmp("-ypixels", option, (unsigned) length)) {
+ if (update) {
+ TkTextUpdateLineMetrics(textPtr,
+ TkBTreeLinesTo(textPtr, indexFromPtr->linePtr),
+ TkBTreeLinesTo(textPtr, indexToPtr->linePtr), -1);
+ }
+ value = TkTextIndexYPixels(textPtr, indexToPtr)
+ - TkTextIndexYPixels(textPtr, indexFromPtr);
+ } else {
+ goto badOption;
+ }
+
+ countDone:
+ found++;
+ if (found == 1) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
+ } else {
+ if (found == 2) {
+ /*
+ * Move the first item we put into the result into the
+ * first element of the list object.
+ */
+
+ objPtr = Tcl_NewObj();
+ Tcl_ListObjAppendElement(NULL, objPtr,
+ Tcl_GetObjResult(interp));
+ }
+ Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewIntObj(value));
+ }
+ }
+
+ if (found == 0) {
+ /*
+ * Use the default '-indices'.
+ */
+
+ int value = CountIndices(textPtr, indexFromPtr, indexToPtr,
+ COUNT_INDICES);
+
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
+ } else if (found > 1) {
+ Tcl_SetObjResult(interp, objPtr);
+ }
+ break;
+ }
+ case TEXT_DEBUG:
+ if (objc > 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "boolean");
+ result = TCL_ERROR;
+ goto done;
+ }
+ if (objc == 2) {
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(tkBTreeDebug));
} else {
- if (Tcl_GetBoolean(interp, argv[2], &tkBTreeDebug) != TCL_OK) {
+ if (Tcl_GetBooleanFromObj(interp, objv[2],
+ &tkBTreeDebug) != TCL_OK) {
result = TCL_ERROR;
goto done;
}
tkTextDebug = tkBTreeDebug;
}
- } else if ((c == 'd') && (strncmp(argv[1], "delete", length) == 0)
- && (length >= 3)) {
- int i;
-
- if (argc < 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " delete index1 ?index2 ...?\"", (char *) NULL);
+ break;
+ case TEXT_DELETE:
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index1 ?index2 ...?");
result = TCL_ERROR;
goto done;
}
- if (textPtr->state == TK_STATE_NORMAL) {
- if (argc < 5) {
+ if (textPtr->state == TK_TEXT_STATE_NORMAL) {
+ if (objc < 5) {
/*
* Simple case requires no predetermination of indices.
*/
- result = DeleteChars(textPtr, argv[2],
- (argc == 4) ? argv[3] : NULL, NULL, NULL);
+
+ CONST TkTextIndex *indexPtr1, *indexPtr2;
+
+ /*
+ * Parse the starting and stopping indices.
+ */
+
+ indexPtr1 = TkTextGetIndexFromObj(textPtr->interp, textPtr,
+ objv[2]);
+ if (indexPtr1 == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ if (objc == 4) {
+ indexPtr2 = TkTextGetIndexFromObj(textPtr->interp,
+ textPtr, objv[3]);
+ if (indexPtr2 == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ } else {
+ indexPtr2 = NULL;
+ }
+ DeleteIndexRange(NULL, textPtr, indexPtr1, indexPtr2, 1);
} else {
/*
* Multi-index pair case requires that we prevalidate the
- * indices and sort from last to first so that deletes
- * occur in the exact (unshifted) text. It also needs to
- * handle partial and fully overlapping ranges. We have to
- * do this with multiple passes.
+ * indices and sort from last to first so that deletes occur
+ * in the exact (unshifted) text. It also needs to handle
+ * partial and fully overlapping ranges. We have to do this
+ * with multiple passes.
*/
+
TkTextIndex *indices, *ixStart, *ixEnd, *lastStart;
char *useIdx;
+ int i;
- argc -= 2;
- argv += 2;
+ objc -= 2;
+ objv += 2;
indices = (TkTextIndex *)
- ckalloc((argc + 1) * sizeof(TkTextIndex));
+ ckalloc((objc + 1) * sizeof(TkTextIndex));
/*
* First pass verifies that all indices are valid.
*/
- for (i = 0; i < argc; i++) {
- if (TkTextGetIndex(interp, textPtr, argv[i],
- &indices[i]) != TCL_OK) {
+
+ for (i = 0; i < objc; i++) {
+ CONST TkTextIndex *indexPtr =
+ TkTextGetIndexFromObj(interp, textPtr, objv[i]);
+
+ if (indexPtr == NULL) {
result = TCL_ERROR;
ckfree((char *) indices);
goto done;
}
+ indices[i] = *indexPtr;
}
+
/*
* Pad out the pairs evenly to make later code easier.
*/
- if (argc & 1) {
+
+ if (objc & 1) {
indices[i] = indices[i-1];
- TkTextIndexForwChars(&indices[i], 1, &indices[i]);
- argc++;
+ TkTextIndexForwChars(NULL, &indices[i], 1, &indices[i],
+ COUNT_INDICES);
+ objc++;
}
- useIdx = (char *) ckalloc((unsigned) argc);
- memset(useIdx, 0, (unsigned) argc);
+ useIdx = (char *) ckalloc((unsigned) objc);
+ memset(useIdx, 0, (unsigned) objc);
+
/*
- * Do a decreasing order sort so that we delete the end
- * ranges first to maintain index consistency.
+ * Do a decreasing order sort so that we delete the end ranges
+ * first to maintain index consistency.
*/
- qsort((VOID *) indices, (unsigned) (argc / 2),
+
+ qsort(indices, (unsigned) objc / 2,
2 * sizeof(TkTextIndex), TextIndexSortProc);
lastStart = NULL;
+
/*
* Second pass will handle bogus ranges (end < start) and
* overlapping ranges.
*/
- for (i = 0; i < argc; i += 2) {
+
+ for (i = 0; i < objc; i += 2) {
ixStart = &indices[i];
- ixEnd = &indices[i+1];
+ ixEnd = &indices[i+1];
if (TkTextIndexCmp(ixEnd, ixStart) <= 0) {
continue;
}
@@ -670,13 +1158,15 @@ TextWidgetCmd(clientData, interp, argc, argv)
* Start indices were equal, and the sort placed
* the longest range first, so skip this one.
*/
+
continue;
} else if (TkTextIndexCmp(lastStart, ixEnd) < 0) {
/*
* The next pair has a start range before the end
- * point of the last range. Constrain the delete
+ * point of the last range. Constrain the delete
* range, but use the pointer values.
*/
+
*ixEnd = *lastStart;
if (TkTextIndexCmp(ixEnd, ixStart) <= 0) {
continue;
@@ -684,200 +1174,589 @@ TextWidgetCmd(clientData, interp, argc, argv)
}
}
lastStart = ixStart;
- useIdx[i] = 1;
+ useIdx[i] = 1;
}
+
/*
- * Final pass take the input from the previous and deletes
- * the ranges which are flagged to be deleted.
+ * Final pass take the input from the previous and deletes the
+ * ranges which are flagged to be deleted.
*/
- for (i = 0; i < argc; i += 2) {
+
+ for (i = 0; i < objc; i += 2) {
if (useIdx[i]) {
/*
* We don't need to check the return value because all
* indices are preparsed above.
*/
- DeleteChars(textPtr, NULL, NULL,
- &indices[i], &indices[i+1]);
+
+ DeleteIndexRange(NULL, textPtr, &indices[i],
+ &indices[i+1], 1);
}
}
ckfree((char *) indices);
}
}
- } else if ((c == 'd') && (strncmp(argv[1], "dlineinfo", length) == 0)
- && (length >= 2)) {
+ break;
+ case TEXT_DLINEINFO: {
int x, y, width, height, base;
+ CONST TkTextIndex *indexPtr;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " dlineinfo index\"", (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
result = TCL_ERROR;
goto done;
}
- if (TkTextGetIndex(interp, textPtr, argv[2], &index1) != TCL_OK) {
+ indexPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]);
+ if (indexPtr == NULL) {
result = TCL_ERROR;
goto done;
}
- if (TkTextDLineInfo(textPtr, &index1, &x, &y, &width, &height, &base)
- == 0) {
- char buf[TCL_INTEGER_SPACE * 5];
-
- sprintf(buf, "%d %d %d %d %d", x, y, width, height, base);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ if (TkTextDLineInfo(textPtr, indexPtr, &x, &y, &width, &height,
+ &base) == 0) {
+ Tcl_Obj *listObj = Tcl_NewListObj(0, NULL);
+
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(x));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(y));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(width));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(height));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(base));
+
+ Tcl_SetObjResult(interp, listObj);
}
- } else if ((c == 'e') && (strncmp(argv[1], "edit", length) == 0)) {
- result = TextEditCmd(textPtr, interp, argc, argv);
- } else if ((c == 'g') && (strncmp(argv[1], "get", length) == 0)) {
+ break;
+ }
+ case TEXT_DUMP:
+ result = TextDumpCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_EDIT:
+ result = TextEditCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_GET: {
Tcl_Obj *objPtr = NULL;
- Tcl_DString ds;
- int i, found = 0;
+ int i, found = 0, visible = 0;
+ CONST char *name;
+ int length;
- if (argc < 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " get index1 ?index2 ...?\"", (char *) NULL);
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "?-displaychars? ?--? index1 ?index2 ...?");
result = TCL_ERROR;
goto done;
}
- for (i = 2; i < argc; i += 2) {
- if (TkTextGetIndex(interp, textPtr, argv[i], &index1) != TCL_OK) {
- result = TCL_ERROR;
- goto done;
+
+ /*
+ * Simple, restrictive argument parsing. The only options are -- and
+ * -displaychars (or any unique prefix).
+ */
+
+ i = 2;
+ if (objc > 3) {
+ name = Tcl_GetStringFromObj(objv[i], &length);
+ if (length > 1 && name[0] == '-') {
+ if (strncmp("-displaychars", name, (unsigned)length)==0) {
+ i++;
+ visible = 1;
+ name = Tcl_GetStringFromObj(objv[i], &length);
+ }
+ if ((i < objc-1) && (length == 2) && !strcmp("--", name)) {
+ i++;
+ }
}
- if (i+1 == argc) {
- index2 = index1;
- TkTextIndexForwChars(&index2, 1, &index2);
- } else if (TkTextGetIndex(interp, textPtr, argv[i+1], &index2)
- != TCL_OK) {
+ }
+
+ for (; i < objc; i += 2) {
+ CONST TkTextIndex *index1Ptr, *index2Ptr;
+ TkTextIndex index2;
+
+ index1Ptr = TkTextGetIndexFromObj(interp, textPtr, objv[i]);
+ if (index1Ptr == NULL) {
if (objPtr) {
Tcl_DecrRefCount(objPtr);
}
result = TCL_ERROR;
goto done;
}
- if (TkTextIndexCmp(&index1, &index2) < 0) {
- /*
- * Place the text in a DString and move it to the result.
- * Since this could in principle be a megabyte or more, we
- * want to do it efficiently!
+
+ if (i+1 == objc) {
+ TkTextIndexForwChars(NULL, index1Ptr, 1, &index2,
+ COUNT_INDICES);
+ index2Ptr = &index2;
+ } else {
+ index2Ptr = TkTextGetIndexFromObj(interp, textPtr, objv[i+1]);
+ if (index2Ptr == NULL) {
+ if (objPtr) {
+ Tcl_DecrRefCount(objPtr);
+ }
+ result = TCL_ERROR;
+ goto done;
+ }
+ }
+
+ if (TkTextIndexCmp(index1Ptr, index2Ptr) < 0) {
+ /*
+ * We want to move the text we get from the window into the
+ * result, but since this could in principle be a megabyte or
+ * more, we want to do it efficiently!
*/
- TextGetText(&index1, &index2, &ds);
+
+ Tcl_Obj *get = TextGetText(textPtr, index1Ptr, index2Ptr,
+ visible);
+
found++;
if (found == 1) {
- Tcl_DStringResult(interp, &ds);
+ Tcl_SetObjResult(interp, get);
} else {
if (found == 2) {
/*
- * Move the first item we put into the result into
- * the first element of the list object.
+ * Move the first item we put into the result into the
+ * first element of the list object.
*/
+
objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_GetObjResult(interp));
}
- Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj(Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds)));
+ Tcl_ListObjAppendElement(NULL, objPtr, get);
}
- Tcl_DStringFree(&ds);
}
}
if (found > 1) {
Tcl_SetObjResult(interp, objPtr);
}
- } else if ((c == 'i') && (strncmp(argv[1], "index", length) == 0)
- && (length >= 3)) {
- char buf[200];
+ break;
+ }
+ case TEXT_IMAGE:
+ result = TkTextImageCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_INDEX: {
+ CONST TkTextIndex *indexPtr;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " index index\"",
- (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
result = TCL_ERROR;
goto done;
}
- if (TkTextGetIndex(interp, textPtr, argv[2], &index1) != TCL_OK) {
+
+ indexPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]);
+ if (indexPtr == NULL) {
result = TCL_ERROR;
goto done;
}
- TkTextPrintIndex(&index1, buf);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- } else if ((c == 'i') && (strncmp(argv[1], "insert", length) == 0)
- && (length >= 3)) {
- int i, j, numTags;
- CONST char **tagNames;
- TkTextTag **oldTagArrayPtr;
-
- if (argc < 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0],
- " insert index chars ?tagList chars tagList ...?\"",
- (char *) NULL);
+ Tcl_SetObjResult(interp, TkTextNewIndexObj(textPtr, indexPtr));
+ break;
+ }
+ case TEXT_INSERT: {
+ CONST TkTextIndex *indexPtr;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "index chars ?tagList chars tagList ...?");
result = TCL_ERROR;
goto done;
}
- if (TkTextGetIndex(interp, textPtr, argv[2], &index1) != TCL_OK) {
+ indexPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]);
+ if (indexPtr == NULL) {
result = TCL_ERROR;
goto done;
}
- if (textPtr->state == TK_STATE_NORMAL) {
- for (j = 3; j < argc; j += 2) {
- InsertChars(textPtr, &index1, argv[j]);
- if (argc > (j+1)) {
- TkTextIndexForwBytes(&index1, (int) strlen(argv[j]),
- &index2);
- oldTagArrayPtr = TkBTreeGetTags(&index1, &numTags);
- if (oldTagArrayPtr != NULL) {
- for (i = 0; i < numTags; i++) {
- TkBTreeTag(&index1, &index2, oldTagArrayPtr[i], 0);
- }
- ckfree((char *) oldTagArrayPtr);
- }
- if (Tcl_SplitList(interp, argv[j+1], &numTags, &tagNames)
- != TCL_OK) {
- result = TCL_ERROR;
- goto done;
- }
- for (i = 0; i < numTags; i++) {
- TkBTreeTag(&index1, &index2,
- TkTextCreateTag(textPtr, tagNames[i]), 1);
- }
- ckfree((char *) tagNames);
- index1 = index2;
+ if (textPtr->state == TK_TEXT_STATE_NORMAL) {
+ result = TextInsertCmd(NULL, textPtr, interp, objc-3, objv+3,
+ indexPtr, 1);
+ }
+ break;
+ }
+ case TEXT_MARK:
+ result = TkTextMarkCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_PEER:
+ result = TextPeerCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_REPLACE: {
+ CONST TkTextIndex *indexFromPtr, *indexToPtr;
+
+ if (objc < 5) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "index1 index2 chars ?tagList chars tagList ...?");
+ result = TCL_ERROR;
+ goto done;
+ }
+ indexFromPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]);
+ if (indexFromPtr == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ indexToPtr = TkTextGetIndexFromObj(interp, textPtr, objv[3]);
+ if (indexToPtr == NULL) {
+ result = TCL_ERROR;
+ goto done;
+ }
+ if (TkTextIndexCmp(indexFromPtr, indexToPtr) > 0) {
+ Tcl_AppendResult(interp, "Index \"", Tcl_GetString(objv[3]),
+ "\" before \"", Tcl_GetString(objv[2]),
+ "\" in the text", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+ if (textPtr->state == TK_TEXT_STATE_NORMAL) {
+ int lineNum, byteIndex;
+ TkTextIndex index;
+
+ /*
+ * The 'replace' operation is quite complex to do correctly,
+ * because we want a number of criteria to hold:
+ *
+ * 1. The insertion point shouldn't move, unless it is within the
+ * deleted range. In this case it should end up after the new
+ * text.
+ *
+ * 2. The window should not change the text it shows - should not
+ * scroll vertically - unless the result of the replace is
+ * that the insertion position which used to be on-screen is
+ * now off-screen.
+ */
+
+ byteIndex = textPtr->topIndex.byteIndex;
+ lineNum = TkBTreeLinesTo(textPtr, textPtr->topIndex.linePtr);
+
+ TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
+ if ((TkTextIndexCmp(indexFromPtr, &index) < 0)
+ && (TkTextIndexCmp(indexToPtr, &index) > 0)) {
+ /*
+ * The insertion point is inside the range to be replaced, so
+ * we have to do some calculations to ensure it doesn't move
+ * unnecessarily.
+ */
+
+ int deleteInsertOffset, insertLength, j;
+
+ insertLength = 0;
+ for (j = 4; j < objc; j += 2) {
+ insertLength += Tcl_GetCharLength(objv[j]);
}
+
+ /*
+ * Calculate 'deleteInsertOffset' as an offset we will apply
+ * to the insertion point after this operation.
+ */
+
+ deleteInsertOffset = CountIndices(textPtr, indexFromPtr,
+ &index, COUNT_CHARS);
+ if (deleteInsertOffset > insertLength) {
+ deleteInsertOffset = insertLength;
+ }
+
+ result = TextReplaceCmd(textPtr, interp, indexFromPtr,
+ indexToPtr, objc, objv, 0);
+
+ if (result == TCL_OK) {
+ /*
+ * Move the insertion position to the correct place.
+ */
+
+ TkTextIndexForwChars(NULL, indexFromPtr,
+ deleteInsertOffset, &index, COUNT_INDICES);
+ TkBTreeUnlinkSegment(textPtr->insertMarkPtr,
+ textPtr->insertMarkPtr->body.mark.linePtr);
+ TkBTreeLinkSegment(textPtr->insertMarkPtr, &index);
+ }
+ } else {
+ result = TextReplaceCmd(textPtr, interp, indexFromPtr,
+ indexToPtr, objc, objv, 1);
+ }
+ if (result == TCL_OK) {
+ /*
+ * Now ensure the top-line is in the right place.
+ */
+
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineNum, byteIndex, &index);
+ TkTextSetYView(textPtr, &index, TK_TEXT_NOPIXELADJUST);
}
}
- } else if ((c == 'd') && (strncmp(argv[1], "dump", length) == 0)) {
- result = TextDumpCmd(textPtr, interp, argc, argv);
- } else if ((c == 'i') && (strncmp(argv[1], "image", length) == 0)) {
- result = TkTextImageCmd(textPtr, interp, argc, argv);
- } else if ((c == 'm') && (strncmp(argv[1], "mark", length) == 0)) {
- result = TkTextMarkCmd(textPtr, interp, argc, argv);
- } else if ((c == 's') && (strcmp(argv[1], "scan") == 0) && (length >= 2)) {
- result = TkTextScanCmd(textPtr, interp, argc, argv);
- } else if ((c == 's') && (strcmp(argv[1], "search") == 0)
- && (length >= 3)) {
- result = TextSearchCmd(textPtr, interp, argc, argv);
- } else if ((c == 's') && (strcmp(argv[1], "see") == 0) && (length >= 3)) {
- result = TkTextSeeCmd(textPtr, interp, argc, argv);
- } else if ((c == 't') && (strcmp(argv[1], "tag") == 0)) {
- result = TkTextTagCmd(textPtr, interp, argc, argv);
- } else if ((c == 'w') && (strncmp(argv[1], "window", length) == 0)) {
- result = TkTextWindowCmd(textPtr, interp, argc, argv);
- } else if ((c == 'x') && (strncmp(argv[1], "xview", length) == 0)) {
- result = TkTextXviewCmd(textPtr, interp, argc, argv);
- } else if ((c == 'y') && (strncmp(argv[1], "yview", length) == 0)
- && (length >= 2)) {
- result = TkTextYviewCmd(textPtr, interp, argc, argv);
- } else {
- Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be bbox, cget, compare, configure, debug, delete, ",
- "dlineinfo, dump, edit, get, image, index, insert, mark, ",
- "scan, search, see, tag, window, xview, or yview",
- (char *) NULL);
- result = TCL_ERROR;
+ break;
+ }
+ case TEXT_SCAN:
+ result = TkTextScanCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_SEARCH:
+ result = TextSearchCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_SEE:
+ result = TkTextSeeCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_TAG:
+ result = TkTextTagCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_WINDOW:
+ result = TkTextWindowCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_XVIEW:
+ result = TkTextXviewCmd(textPtr, interp, objc, objv);
+ break;
+ case TEXT_YVIEW:
+ result = TkTextYviewCmd(textPtr, interp, objc, objv);
+ break;
+ }
+
+ done:
+ textPtr->refCount--;
+ if (textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
+ }
+ return result;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * SharedTextObjCmd --
+ *
+ * This function is invoked to process commands on the shared portion of
+ * a text widget. Currently it is not actually exported as a Tcl command,
+ * and is only used internally to process parts of undo/redo scripts.
+ * See the user documentation for 'text' for details on what it does -
+ * the only subcommands it currently supports are 'insert' and 'delete'.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation for "text".
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+SharedTextObjCmd(
+ ClientData clientData, /* Information about shared test B-tree. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
+ register TkSharedText *sharedPtr = (TkSharedText *) clientData;
+ int result = TCL_OK;
+ int index;
+
+ static CONST char *optionStrings[] = {
+ "delete", "insert", NULL
+ };
+ enum options {
+ TEXT_DELETE, TEXT_INSERT
+ };
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ switch ((enum options) index) {
+ case TEXT_DELETE:
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index1 ?index2 ...?");
+ return TCL_ERROR;
+ }
+ if (objc < 5) {
+ /*
+ * Simple case requires no predetermination of indices.
+ */
+
+ TkTextIndex index1;
+
+ /*
+ * Parse the starting and stopping indices.
+ */
+
+ result = TkTextSharedGetObjIndex(interp, sharedPtr, objv[2],
+ &index1);
+ if (result != TCL_OK) {
+ return result;
+ }
+ if (objc == 4) {
+ TkTextIndex index2;
+
+ result = TkTextSharedGetObjIndex(interp, sharedPtr, objv[3],
+ &index2);
+ if (result != TCL_OK) {
+ return result;
+ }
+ DeleteIndexRange(sharedPtr, NULL, &index1, &index2, 1);
+ } else {
+ DeleteIndexRange(sharedPtr, NULL, &index1, NULL, 1);
+ }
+ return TCL_OK;
+ } else {
+ /* Too many arguments */
+ return TCL_ERROR;
+ }
+ break;
+ case TEXT_INSERT: {
+ TkTextIndex index1;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "index chars ?tagList chars tagList ...?");
+ return TCL_ERROR;
+ }
+ result = TkTextSharedGetObjIndex(interp, sharedPtr, objv[2],
+ &index1);
+ if (result != TCL_OK) {
+ return result;
+ }
+ return TextInsertCmd(sharedPtr, NULL, interp, objc-3, objv+3, &index1,
+ 1);
+ }
+ default:
+ return TCL_OK;
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TextPeerCmd --
+ *
+ * This function is invoked to process the "text peer" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+TextPeerCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
+ Tk_Window tkwin = textPtr->tkwin;
+ int index;
+
+ static CONST char *peerOptionStrings[] = {
+ "create", "names", NULL
+ };
+ enum peerOptions {
+ PEER_CREATE, PEER_NAMES
+ };
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[2], peerOptionStrings,
+ "peer option", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ switch ((enum peerOptions)index) {
+ case PEER_CREATE:
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "pathName ?options?");
+ return TCL_ERROR;
+ }
+ return CreateWidget(textPtr->sharedTextPtr, tkwin, interp, textPtr,
+ objc-2, objv+2);
+ case PEER_NAMES: {
+ TkText *tPtr = textPtr->sharedTextPtr->peers;
+
+ if (objc > 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
+ while (tPtr != NULL) {
+ if (tPtr != textPtr) {
+ Tcl_AppendElement(interp, Tk_PathName(tPtr->tkwin));
+ }
+ tPtr = tPtr->next;
+ }
+ }
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextReplaceCmd --
+ *
+ * This function is invoked to process part of the "replace" widget
+ * command for text widgets.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ * If 'viewUpdate' is false, then textPtr->topIndex may no longer be a
+ * valid index after this function returns. The caller is responsible for
+ * ensuring a correct index is in place.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TextReplaceCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ CONST TkTextIndex *indexFromPtr,
+ /* Index from which to replace. */
+ CONST TkTextIndex *indexToPtr,
+ /* Index to which to replace. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ int viewUpdate) /* Update vertical view if set. */
+{
+ /*
+ * Perform the deletion and insertion, but ensure no undo-separator is
+ * placed between the two operations. Since we are using the helper
+ * functions 'DeleteIndexRange' and 'TextInsertCmd' we have to pretend
+ * that the autoSeparators setting is off, so that we don't get an
+ * undo-separator between the delete and insert.
+ */
+
+ int origAutoSep = textPtr->sharedTextPtr->autoSeparators;
+ int result, lineNumber;
+ TkTextIndex indexTmp;
+
+ if (textPtr->sharedTextPtr->undo) {
+ textPtr->sharedTextPtr->autoSeparators = 0;
+ if (origAutoSep &&
+ textPtr->sharedTextPtr->lastEditMode!=TK_TEXT_EDIT_REPLACE) {
+ TkUndoInsertUndoSeparator(textPtr->sharedTextPtr->undoStack);
+ }
+ }
+
+ /*
+ * Must save and restore line in indexFromPtr based on line number; can't
+ * keep the line itself as that might be eliminated/invalidated when
+ * deleting the range. [Bug 1602537]
+ */
+
+ indexTmp = *indexFromPtr;
+ lineNumber = TkBTreeLinesTo(textPtr, indexFromPtr->linePtr);
+ DeleteIndexRange(NULL, textPtr, indexFromPtr, indexToPtr, viewUpdate);
+ indexTmp.linePtr = TkBTreeFindLine(indexTmp.tree, textPtr, lineNumber);
+ result = TextInsertCmd(NULL, textPtr, interp, objc-4, objv+4,
+ &indexTmp, viewUpdate);
+
+ if (textPtr->sharedTextPtr->undo) {
+ textPtr->sharedTextPtr->lastEditMode = TK_TEXT_EDIT_REPLACE;
+ textPtr->sharedTextPtr->autoSeparators = origAutoSep;
}
- done:
- Tcl_Release((ClientData) textPtr);
return result;
}
@@ -886,13 +1765,13 @@ TextWidgetCmd(clientData, interp, argc, argv)
*
* TextIndexSortProc --
*
- * This procedure is called by qsort when sorting an array of
- * indices in *decreasing* order (last to first).
+ * This function is called by qsort when sorting an array of indices in
+ * *decreasing* order (last to first).
*
* Results:
- * The return value is -1 if the first argument should be before
- * the second element, 0 if it's equivalent, and 1 if it should be
- * after the second element.
+ * The return value is -1 if the first argument should be before the
+ * second element, 0 if it's equivalent, and 1 if it should be after the
+ * second element.
*
* Side effects:
* None.
@@ -901,8 +1780,9 @@ TextWidgetCmd(clientData, interp, argc, argv)
*/
static int
-TextIndexSortProc(first, second)
- CONST VOID *first, *second; /* Elements to be compared. */
+TextIndexSortProc(
+ CONST void *first, /* Elements to be compared. */
+ CONST void *second)
{
TkTextIndex *pair1 = (TkTextIndex *) first;
TkTextIndex *pair2 = (TkTextIndex *) second;
@@ -911,9 +1791,10 @@ TextIndexSortProc(first, second)
if (cmp == 0) {
/*
* If the first indices were equal, we want the second index of the
- * pair also to be the greater. Use pointer magic to access the
- * second index pair.
+ * pair also to be the greater. Use pointer magic to access the second
+ * index pair.
*/
+
cmp = TkTextIndexCmp(&pair1[0], &pair2[0]);
}
if (cmp > 0) {
@@ -929,71 +1810,168 @@ TextIndexSortProc(first, second)
*
* DestroyText --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a text at a safe time
- * (when no-one is using it anymore).
+ * This function is invoked when we receive a destroy event to clean up
+ * the internal structure of a text widget. We will free up most of the
+ * internal structure and delete the associated Tcl command. If there are
+ * no outstanding references to the widget, we also free up the textPtr
+ * itself.
+ *
+ * The widget has already been flagged as deleted.
*
* Results:
* None.
*
* Side effects:
- * Everything associated with the text is freed up.
+ * Either everything or almost everything associated with the text is
+ * freed up.
*
*----------------------------------------------------------------------
*/
static void
-DestroyText(memPtr)
- char *memPtr; /* Info about text widget. */
+DestroyText(
+ TkText *textPtr) /* Info about text widget. */
{
- register TkText *textPtr = (TkText *) memPtr;
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
TkTextTag *tagPtr;
+ TkSharedText *sharedTextPtr = textPtr->sharedTextPtr;
/*
- * Free up all the stuff that requires special handling, then
- * let Tk_FreeOptions handle all the standard option-related
- * stuff. Special note: free up display-related information
- * before deleting the B-tree, since display-related stuff
- * may refer to stuff in the B-tree.
+ * Free up all the stuff that requires special handling. We have already
+ * called let Tk_FreeConfigOptions to handle all the standard
+ * option-related stuff (and so none of that exists when we are called).
+ * Special note: free up display-related information before deleting the
+ * B-tree, since display-related stuff may refer to stuff in the B-tree.
*/
TkTextFreeDInfo(textPtr);
- TkBTreeDestroy(textPtr->tree);
- for (hPtr = Tcl_FirstHashEntry(&textPtr->tagTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
- TkTextFreeTag(textPtr, tagPtr);
- }
- Tcl_DeleteHashTable(&textPtr->tagTable);
- for (hPtr = Tcl_FirstHashEntry(&textPtr->markTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- ckfree((char *) Tcl_GetHashValue(hPtr));
- }
- Tcl_DeleteHashTable(&textPtr->markTable);
+ textPtr->dInfoPtr = NULL;
+
+ /*
+ * Remove ourselves from the peer list.
+ */
+
+ if (sharedTextPtr->peers == textPtr) {
+ sharedTextPtr->peers = textPtr->next;
+ } else {
+ TkText *nextPtr = sharedTextPtr->peers;
+ while (nextPtr != NULL) {
+ if (nextPtr->next == textPtr) {
+ nextPtr->next = textPtr->next;
+ break;
+ }
+ nextPtr = nextPtr->next;
+ }
+ }
+
+ /*
+ * Always clean up the widget-specific tags first. Common tags (i.e. most)
+ * will only be cleaned up when the shared structure is cleaned up.
+ *
+ * We also need to clean up widget-specific marks ('insert', 'current'),
+ * since otherwise marks will never disappear from the B-tree.
+ */
+
+ TkTextDeleteTag(textPtr, textPtr->selTagPtr);
+ TkBTreeUnlinkSegment(textPtr->insertMarkPtr,
+ textPtr->insertMarkPtr->body.mark.linePtr);
+ ckfree((char *) textPtr->insertMarkPtr);
+ TkBTreeUnlinkSegment(textPtr->currentMarkPtr,
+ textPtr->currentMarkPtr->body.mark.linePtr);
+ ckfree((char *) textPtr->currentMarkPtr);
+
+ /*
+ * Now we've cleaned up everything of relevance to us in the B-tree, so we
+ * disassociate outselves from it.
+ *
+ * When the refCount reaches zero, it's time to clean up the shared
+ * portion of the text widget.
+ */
+
+ sharedTextPtr->refCount--;
+
+ if (sharedTextPtr->refCount > 0) {
+ TkBTreeRemoveClient(sharedTextPtr->tree, textPtr);
+
+ /*
+ * Free up any embedded windows which belong to this widget.
+ */
+
+ for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->windowTable, &search);
+ hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ TkTextEmbWindowClient *loop;
+ TkTextSegment *ewPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+
+ loop = ewPtr->body.ew.clients;
+ if (loop->textPtr == textPtr) {
+ ewPtr->body.ew.clients = loop->next;
+ TkTextWinFreeClient(hPtr, loop);
+ } else {
+ TkTextEmbWindowClient *client = ewPtr->body.ew.clients;
+
+ client = loop->next;
+ while (client != NULL) {
+ if (client->textPtr == textPtr) {
+ loop->next = client->next;
+ TkTextWinFreeClient(hPtr, client);
+ break;
+ } else {
+ loop = loop->next;
+ }
+ client = loop->next;
+ }
+ }
+ }
+ } else {
+ /*
+ * No need to call 'TkBTreeRemoveClient' first, since this will do
+ * everything in one go, more quickly.
+ */
+
+ TkBTreeDestroy(sharedTextPtr->tree);
+
+ for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
+ hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
+
+ /*
+ * No need to use 'TkTextDeleteTag' since we've already removed
+ * the B-tree completely.
+ */
+
+ TkTextFreeTag(textPtr, tagPtr);
+ }
+ Tcl_DeleteHashTable(&sharedTextPtr->tagTable);
+ for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->markTable, &search);
+ hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ ckfree((char *) Tcl_GetHashValue(hPtr));
+ }
+ Tcl_DeleteHashTable(&sharedTextPtr->markTable);
+ TkUndoFreeStack(sharedTextPtr->undoStack);
+
+ Tcl_DeleteHashTable(&sharedTextPtr->windowTable);
+ Tcl_DeleteHashTable(&sharedTextPtr->imageTable);
+
+ if (sharedTextPtr->bindingTable != NULL) {
+ Tk_DeleteBindingTable(sharedTextPtr->bindingTable);
+ }
+ ckfree((char *) sharedTextPtr);
+ }
+
if (textPtr->tabArrayPtr != NULL) {
ckfree((char *) textPtr->tabArrayPtr);
}
if (textPtr->insertBlinkHandler != NULL) {
Tcl_DeleteTimerHandler(textPtr->insertBlinkHandler);
}
- if (textPtr->bindingTable != NULL) {
- Tk_DeleteBindingTable(textPtr->bindingTable);
- }
- TkUndoFreeStack(textPtr->undoStack);
- /*
- * NOTE: do NOT free up selBorder, selBdString, or selFgColorPtr:
- * they are duplicates of information in the "sel" tag, which was
- * freed up as part of deleting the tags above.
- */
-
- textPtr->selBorder = NULL;
- textPtr->selBdString = NULL;
- textPtr->selFgColorPtr = NULL;
- Tk_FreeOptions(configSpecs, (char *) textPtr, textPtr->display, 0);
- ckfree((char *) textPtr);
+ textPtr->tkwin = NULL;
+ textPtr->refCount--;
+ Tcl_DeleteCommandFromToken(textPtr->interp, textPtr->widgetCmd);
+ if (textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
+ }
}
/*
@@ -1001,47 +1979,135 @@ DestroyText(memPtr)
*
* ConfigureText --
*
- * This procedure is called to process an argv/argc list, plus
- * the Tk option database, in order to configure (or
- * reconfigure) a text widget.
+ * This function is called to process an objv/objc list, plus the Tk
+ * option database, in order to configure (or reconfigure) a text widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as text string, colors, font,
- * etc. get set for textPtr; old resources get freed, if there
- * were any.
+ * Configuration information, such as text string, colors, font, etc. get
+ * set for textPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureText(interp, textPtr, argc, argv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- register TkText *textPtr; /* Information about widget; may or may
- * not already have values for some fields. */
- int argc; /* Number of valid entries in argv. */
- CONST char **argv; /* Arguments. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureText(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ register TkText *textPtr, /* Information about widget; may or may not
+ * already have values for some fields. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
+ Tk_SavedOptions savedOptions;
int oldExport = textPtr->exportSelection;
+ int mask = 0;
- if (Tk_ConfigureWidget(interp, textPtr->tkwin, configSpecs,
- argc, argv, (char *) textPtr, flags) != TCL_OK) {
+ if (Tk_SetOptions(interp, (char *) textPtr, textPtr->optionTable,
+ objc, objv, textPtr->tkwin, &savedOptions, &mask) != TCL_OK) {
return TCL_ERROR;
}
- TkUndoSetDepth(textPtr->undoStack, textPtr->maxUndo);
+ /*
+ * Copy down shared flags.
+ */
+
+ textPtr->sharedTextPtr->undo = textPtr->undo;
+ textPtr->sharedTextPtr->maxUndo = textPtr->maxUndo;
+ textPtr->sharedTextPtr->autoSeparators = textPtr->autoSeparators;
+
+ TkUndoSetDepth(textPtr->sharedTextPtr->undoStack,
+ textPtr->sharedTextPtr->maxUndo);
/*
- * A few other options also need special processing, such as parsing
- * the geometry and setting the background from a 3-D border.
+ * A few other options also need special processing, such as parsing the
+ * geometry and setting the background from a 3-D border.
*/
Tk_SetBackgroundFromBorder(textPtr->tkwin, textPtr->border);
+ if (mask & TK_TEXT_LINE_RANGE) {
+ int start, end, current;
+
+ /*
+ * Line start and/or end have been adjusted. We need to validate the
+ * first displayed line and arrange for re-layout.
+ */
+
+ TkBTreeClientRangeChanged(textPtr, textPtr->charHeight);
+
+ if (textPtr->start != NULL) {
+ start = TkBTreeLinesTo(NULL, textPtr->start);
+ } else {
+ start = 0;
+ }
+ if (textPtr->end != NULL) {
+ end = TkBTreeLinesTo(NULL, textPtr->end);
+ } else {
+ end = TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL);
+ }
+ if (start > end) {
+ Tcl_AppendResult(interp,
+ "-startline must be less than or equal to -endline",
+ NULL);
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
+ }
+ current = TkBTreeLinesTo(NULL, textPtr->topIndex.linePtr);
+ if (current < start || current > end) {
+ TkTextSearch search;
+ TkTextIndex index1, first, last;
+ int selChanged = 0;
+
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0,
+ &index1);
+ TkTextSetYView(textPtr, &index1, 0);
+
+ /*
+ * We may need to adjust the selection. So we have to check
+ * whether the "sel" tag was applied to anything outside the
+ * current start,end.
+ */
+
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, 0, 0,
+ &first);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL),
+ 0, &last);
+ TkBTreeStartSearch(&first, &last, textPtr->selTagPtr, &search);
+ if (!TkBTreeCharTagged(&first, textPtr->selTagPtr)
+ && !TkBTreeNextTag(&search)) {
+ /* Nothing tagged with "sel" */
+ } else {
+ int line = TkBTreeLinesTo(NULL, search.curIndex.linePtr);
+ if (line < start) {
+ selChanged = 1;
+ } else {
+ TkTextLine *linePtr = search.curIndex.linePtr;
+
+ while (TkBTreeNextTag(&search)) {
+ linePtr = search.curIndex.linePtr;
+ }
+ line = TkBTreeLinesTo(NULL, linePtr);
+ if (line >= end) {
+ selChanged = 1;
+ }
+ }
+ }
+ if (selChanged) {
+ /*
+ * Send an event that the selection has changed, and abort any
+ * partial-selections in progress.
+ */
+
+ TkTextSelectionEvent(textPtr);
+ textPtr->abortSelections = 1;
+ }
+ }
+ }
+
/*
* Don't allow negative spacings.
*/
@@ -1064,62 +2130,56 @@ ConfigureText(interp, textPtr, argc, argv, flags)
ckfree((char *) textPtr->tabArrayPtr);
textPtr->tabArrayPtr = NULL;
}
- if (textPtr->tabOptionString != NULL) {
- textPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr->tkwin,
- textPtr->tabOptionString);
+ if (textPtr->tabOptionPtr != NULL) {
+ textPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr,
+ textPtr->tabOptionPtr);
if (textPtr->tabArrayPtr == NULL) {
Tcl_AddErrorInfo(interp,"\n (while processing -tabs option)");
+ Tk_RestoreSavedOptions(&savedOptions);
return TCL_ERROR;
}
}
/*
- * Make sure that configuration options are properly mirrored
- * between the widget record and the "sel" tags. NOTE: we don't
- * have to free up information during the mirroring; old
- * information was freed when it was replaced in the widget
- * record.
+ * Make sure that configuration options are properly mirrored between the
+ * widget record and the "sel" tags. NOTE: we don't have to free up
+ * information during the mirroring; old information was freed when it was
+ * replaced in the widget record.
*/
textPtr->selTagPtr->border = textPtr->selBorder;
- if (textPtr->selTagPtr->bdString != textPtr->selBdString) {
- textPtr->selTagPtr->bdString = textPtr->selBdString;
- if (textPtr->selBdString != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin, textPtr->selBdString,
- &textPtr->selTagPtr->borderWidth) != TCL_OK) {
- return TCL_ERROR;
- }
- if (textPtr->selTagPtr->borderWidth < 0) {
- textPtr->selTagPtr->borderWidth = 0;
- }
- }
+ if (textPtr->selTagPtr->borderWidthPtr != textPtr->selBorderWidthPtr) {
+ textPtr->selTagPtr->borderWidthPtr = textPtr->selBorderWidthPtr;
+ textPtr->selTagPtr->borderWidth = textPtr->selBorderWidth;
}
textPtr->selTagPtr->fgColor = textPtr->selFgColorPtr;
textPtr->selTagPtr->affectsDisplay = 0;
- if ((textPtr->selTagPtr->border != NULL)
- || (textPtr->selTagPtr->bdString != NULL)
- || (textPtr->selTagPtr->reliefString != NULL)
- || (textPtr->selTagPtr->bgStipple != None)
- || (textPtr->selTagPtr->fgColor != NULL)
+ textPtr->selTagPtr->affectsDisplayGeometry = 0;
+ if ((textPtr->selTagPtr->elideString != NULL)
|| (textPtr->selTagPtr->tkfont != None)
- || (textPtr->selTagPtr->fgStipple != None)
|| (textPtr->selTagPtr->justifyString != NULL)
|| (textPtr->selTagPtr->lMargin1String != NULL)
|| (textPtr->selTagPtr->lMargin2String != NULL)
|| (textPtr->selTagPtr->offsetString != NULL)
- || (textPtr->selTagPtr->overstrikeString != NULL)
|| (textPtr->selTagPtr->rMarginString != NULL)
|| (textPtr->selTagPtr->spacing1String != NULL)
|| (textPtr->selTagPtr->spacing2String != NULL)
|| (textPtr->selTagPtr->spacing3String != NULL)
- || (textPtr->selTagPtr->tabString != NULL)
- || (textPtr->selTagPtr->underlineString != NULL)
- || (textPtr->selTagPtr->elideString != NULL)
+ || (textPtr->selTagPtr->tabStringPtr != NULL)
|| (textPtr->selTagPtr->wrapMode != TEXT_WRAPMODE_NULL)) {
textPtr->selTagPtr->affectsDisplay = 1;
+ textPtr->selTagPtr->affectsDisplayGeometry = 1;
}
- TkTextRedrawTag(textPtr, (TkTextIndex *) NULL, (TkTextIndex *) NULL,
- textPtr->selTagPtr, 1);
+ if ((textPtr->selTagPtr->border != NULL)
+ || (textPtr->selTagPtr->reliefString != NULL)
+ || (textPtr->selTagPtr->bgStipple != None)
+ || (textPtr->selTagPtr->fgColor != NULL)
+ || (textPtr->selTagPtr->fgStipple != None)
+ || (textPtr->selTagPtr->overstrikeString != NULL)
+ || (textPtr->selTagPtr->underlineString != NULL)) {
+ textPtr->selTagPtr->affectsDisplay = 1;
+ }
+ TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1);
/*
* Claim the selection if we've suddenly started exporting it and there
@@ -1130,9 +2190,11 @@ ConfigureText(interp, textPtr, argc, argv, flags)
TkTextSearch search;
TkTextIndex first, last;
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &first);
- TkTextMakeByteIndex(textPtr->tree,
- TkBTreeNumLines(textPtr->tree), 0, &last);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0,
+ &first);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr),
+ 0, &last);
TkBTreeStartSearch(&first, &last, textPtr->selTagPtr, &search);
if (TkBTreeCharTagged(&first, textPtr->selTagPtr)
|| TkBTreeNextTag(&search)) {
@@ -1153,8 +2215,8 @@ ConfigureText(interp, textPtr, argc, argv, flags)
}
/*
- * Register the desired geometry for the window, and arrange for
- * the window to be redisplayed.
+ * Register the desired geometry for the window, and arrange for the
+ * window to be redisplayed.
*/
if (textPtr->width <= 0) {
@@ -1163,60 +2225,97 @@ ConfigureText(interp, textPtr, argc, argv, flags)
if (textPtr->height <= 0) {
textPtr->height = 1;
}
- TextWorldChanged((ClientData) textPtr);
+ Tk_FreeSavedOptions(&savedOptions);
+ TextWorldChanged(textPtr, mask);
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
- * TextWorldChanged --
+ * TextWorldChangedCallback --
*
- * This procedure is called when the world has changed in some
- * way and the widget needs to recompute all its graphics contexts
- * and determine its new geometry.
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Configures all tags in the Text with a empty argc/argv, for
- * the side effect of causing all the items to recompute their
- * geometry and to be redisplayed.
+ * Configures all tags in the Text with a empty objc/objv, for the side
+ * effect of causing all the items to recompute their geometry and to be
+ * redisplayed.
*
*---------------------------------------------------------------------------
*/
-
+
static void
-TextWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+TextWorldChangedCallback(
+ ClientData instanceData) /* Information about widget. */
{
TkText *textPtr;
- Tk_FontMetrics fm;
textPtr = (TkText *) instanceData;
+ TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TextWorldChanged --
+ *
+ * This function is called when the world has changed in some way and the
+ * widget needs to recompute all its graphics contexts and determine its
+ * new geometry.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Configures all tags in the Text with a empty objc/objv, for the side
+ * effect of causing all the items to recompute their geometry and to be
+ * redisplayed.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+TextWorldChanged(
+ TkText *textPtr, /* Information about widget. */
+ int mask) /* OR'd collection of bits showing what has
+ * changed. */
+{
+ Tk_FontMetrics fm;
+ int border;
textPtr->charWidth = Tk_TextWidth(textPtr->tkfont, "0", 1);
if (textPtr->charWidth <= 0) {
textPtr->charWidth = 1;
}
Tk_GetFontMetrics(textPtr->tkfont, &fm);
+
+ textPtr->charHeight = fm.linespace;
+ if (textPtr->charHeight <= 0) {
+ textPtr->charHeight = 1;
+ }
+ border = textPtr->borderWidth + textPtr->highlightWidth;
Tk_GeometryRequest(textPtr->tkwin,
- textPtr->width * textPtr->charWidth + 2*textPtr->borderWidth
- + 2*textPtr->padX + 2*textPtr->highlightWidth,
- textPtr->height * (fm.linespace + textPtr->spacing1
- + textPtr->spacing3) + 2*textPtr->borderWidth
- + 2*textPtr->padY + 2*textPtr->highlightWidth);
- Tk_SetInternalBorder(textPtr->tkwin,
- textPtr->borderWidth + textPtr->highlightWidth);
+ textPtr->width * textPtr->charWidth + 2*textPtr->padX + 2*border,
+ textPtr->height*(fm.linespace+textPtr->spacing1+textPtr->spacing3)
+ + 2*textPtr->padY + 2*border);
+
+ Tk_SetInternalBorderEx(textPtr->tkwin,
+ border + textPtr->padX, border + textPtr->padX,
+ border + textPtr->padY, border + textPtr->padY);
if (textPtr->setGrid) {
Tk_SetGrid(textPtr->tkwin, textPtr->width, textPtr->height,
- textPtr->charWidth, fm.linespace);
+ textPtr->charWidth, textPtr->charHeight);
} else {
Tk_UnsetGrid(textPtr->tkwin);
}
- TkTextRelayoutWindow(textPtr);
+ TkTextRelayoutWindow(textPtr, mask);
}
/*
@@ -1224,24 +2323,24 @@ TextWorldChanged(instanceData)
*
* TextEventProc --
*
- * This procedure is invoked by the Tk dispatcher on
- * structure changes to a text. For texts with 3D
- * borders, this procedure is also invoked for exposures.
+ * This function is invoked by the Tk dispatcher on structure changes to
+ * a text. For texts with 3D borders, this function is also invoked for
+ * exposures.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up.
+ * When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-TextEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- register XEvent *eventPtr; /* Information about event. */
+TextEventProc(
+ ClientData clientData, /* Information about window. */
+ register XEvent *eventPtr) /* Information about event. */
{
register TkText *textPtr = (TkText *) clientData;
TkTextIndex index, index2;
@@ -1253,22 +2352,51 @@ TextEventProc(clientData, eventPtr)
} else if (eventPtr->type == ConfigureNotify) {
if ((textPtr->prevWidth != Tk_Width(textPtr->tkwin))
|| (textPtr->prevHeight != Tk_Height(textPtr->tkwin))) {
- TkTextRelayoutWindow(textPtr);
+ int mask = 0;
+
+ if (textPtr->prevWidth != Tk_Width(textPtr->tkwin)) {
+ mask = TK_TEXT_LINE_GEOMETRY;
+ }
+ TkTextRelayoutWindow(textPtr, mask);
textPtr->prevWidth = Tk_Width(textPtr->tkwin);
textPtr->prevHeight = Tk_Height(textPtr->tkwin);
}
} else if (eventPtr->type == DestroyNotify) {
- if (textPtr->tkwin != NULL) {
- if (textPtr->setGrid) {
- Tk_UnsetGrid(textPtr->tkwin);
- }
- textPtr->tkwin = NULL;
- Tcl_DeleteCommandFromToken(textPtr->interp,
- textPtr->widgetCmd);
+ /*
+ * NOTE: we must zero out selBorder, selBorderWidthPtr and
+ * selFgColorPtr: they are duplicates of information in the "sel" tag,
+ * which will be freed up when we delete all tags. Hence we don't want
+ * the automatic config options freeing process to delete them as
+ * well.
+ */
+
+ textPtr->selBorder = NULL;
+ textPtr->selBorderWidthPtr = NULL;
+ textPtr->selBorderWidth = 0;
+ textPtr->selFgColorPtr = NULL;
+ if (textPtr->setGrid) {
+ Tk_UnsetGrid(textPtr->tkwin);
+ textPtr->setGrid = 0;
}
- Tcl_EventuallyFree((ClientData) textPtr, DestroyText);
+ if (!(textPtr->flags & OPTIONS_FREED)) {
+ Tk_FreeConfigOptions((char *) textPtr, textPtr->optionTable,
+ textPtr->tkwin);
+ textPtr->flags |= OPTIONS_FREED;
+ }
+ textPtr->flags |= DESTROYED;
+
+ /*
+ * Call 'DestroyTest' to handle the deletion for us. The actual
+ * textPtr may still exist after this, if there are some outstanding
+ * references. But we have flagged it as DESTROYED just above, so
+ * nothing will try to make use of it very extensively.
+ */
+
+ DestroyText(textPtr);
} else if ((eventPtr->type == FocusIn) || (eventPtr->type == FocusOut)) {
- if (eventPtr->xfocus.detail != NotifyInferior) {
+ if (eventPtr->xfocus.detail == NotifyInferior
+ || eventPtr->xfocus.detail == NotifyAncestor
+ || eventPtr->xfocus.detail == NotifyNonlinear) {
Tcl_DeleteTimerHandler(textPtr->insertBlinkHandler);
if (eventPtr->type == FocusIn) {
textPtr->flags |= GOT_FOCUS | INSERT_ON;
@@ -1281,19 +2409,19 @@ TextEventProc(clientData, eventPtr)
textPtr->flags &= ~(GOT_FOCUS | INSERT_ON);
textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
}
- if (
-#ifndef MAC_OSX_TK
- !TkpAlwaysShowSelection(textPtr->tkwin)
-#else
- /* Don't show inactive selection in disabled widgets. */
- textPtr->state != TK_STATE_DISABLED
-#endif
- ) {
- TkTextRedrawTag(textPtr, NULL, NULL, textPtr->selTagPtr, 1);
+ if (textPtr->inactiveSelBorder != textPtr->selBorder) {
+ TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr,
+ 1);
}
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
- TkTextIndexForwChars(&index, 1, &index2);
- TkTextChanged(textPtr, &index, &index2);
+ TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES);
+
+ /*
+ * While we wish to redisplay, no heights have changed, so no need
+ * to call TkTextInvalidateLineMetrics.
+ */
+
+ TkTextChanged(NULL, textPtr, &index, &index2);
if (textPtr->highlightWidth > 0) {
TkTextRedrawRegion(textPtr, 0, 0, textPtr->highlightWidth,
textPtr->highlightWidth);
@@ -1307,9 +2435,9 @@ TextEventProc(clientData, eventPtr)
*
* TextCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -1321,24 +2449,25 @@ TextEventProc(clientData, eventPtr)
*/
static void
-TextCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+TextCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
TkText *textPtr = (TkText *) clientData;
Tk_Window tkwin = textPtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted (in which this flag is already set) or
+ * because the command was deleted, and then this function destroys the
+ * widget.
*/
- if (tkwin != NULL) {
+ if (!(textPtr->flags & DESTROYED)) {
if (textPtr->setGrid) {
Tk_UnsetGrid(textPtr->tkwin);
+ textPtr->setGrid = 0;
}
- textPtr->tkwin = NULL;
+ textPtr->flags |= DESTROYED;
Tk_DestroyWindow(tkwin);
}
}
@@ -1348,205 +2477,483 @@ TextCmdDeletedProc(clientData)
*
* InsertChars --
*
- * This procedure implements most of the functionality of the
- * "insert" widget command.
+ * This function implements most of the functionality of the "insert"
+ * widget command.
*
* Results:
- * None.
+ * The length of the inserted string.
*
* Side effects:
- * The characters in "string" get added to the text just before
- * the character indicated by "indexPtr".
+ * The characters in "stringPtr" get added to the text just before the
+ * character indicated by "indexPtr".
+ *
+ * If 'viewUpdate' is true, we may adjust the window contents'
+ * y-position, and scrollbar setting.
*
*----------------------------------------------------------------------
*/
-static void
-InsertChars(textPtr, indexPtr, string)
- TkText *textPtr; /* Overall information about text widget. */
- TkTextIndex *indexPtr; /* Where to insert new characters. May be
- * modified and/or invalidated. */
- CONST char *string; /* Null-terminated string containing new
+static int
+InsertChars(
+ TkSharedText *sharedTextPtr,
+ TkText *textPtr, /* Overall information about text widget. */
+ TkTextIndex *indexPtr, /* Where to insert new characters. May be
+ * modified if the index is not valid for
+ * insertion (e.g. if at "end"). */
+ Tcl_Obj *stringPtr, /* Null-terminated string containing new
* information to add to text. */
+ int viewUpdate) /* Update the view if set. */
{
- int lineIndex, resetView, offset;
- TkTextIndex newTop;
- char indexBuffer[TK_POS_CHARS];
+ int lineIndex, length;
+ TkText *tPtr;
+ int *lineAndByteIndex;
+ int resetViewCount;
+ int pixels[2*PIXEL_CLIENTS];
- /*
- * Don't do anything for an empty string [Bug 1275237]
- */
+ CONST char *string = Tcl_GetStringFromObj(stringPtr, &length);
- if (*string == '\0') {
- return;
+ if (sharedTextPtr == NULL) {
+ sharedTextPtr = textPtr->sharedTextPtr;
}
/*
- * Don't allow insertions on the last (dummy) line of the text.
+ * Don't allow insertions on the last (dummy) line of the text. This is
+ * the only place in this function where the indexPtr is modified.
*/
- lineIndex = TkBTreeLineIndex(indexPtr->linePtr);
- if (lineIndex == TkBTreeNumLines(textPtr->tree)) {
+ lineIndex = TkBTreeLinesTo(textPtr, indexPtr->linePtr);
+ if (lineIndex == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) {
lineIndex--;
- TkTextMakeByteIndex(textPtr->tree, lineIndex, 1000000, indexPtr);
+ TkTextMakeByteIndex(sharedTextPtr->tree, textPtr, lineIndex, 1000000,
+ indexPtr);
}
/*
- * Notify the display module that lines are about to change, then do
- * the insertion. If the insertion occurs on the top line of the
- * widget (textPtr->topIndex), then we have to recompute topIndex
- * after the insertion, since the insertion could invalidate it.
+ * Notify the display module that lines are about to change, then do the
+ * insertion. If the insertion occurs on the top line of the widget
+ * (textPtr->topIndex), then we have to recompute topIndex after the
+ * insertion, since the insertion could invalidate it.
*/
- resetView = offset = 0;
- if (indexPtr->linePtr == textPtr->topIndex.linePtr) {
- resetView = 1;
- offset = textPtr->topIndex.byteIndex;
- if (offset > indexPtr->byteIndex) {
- offset += strlen(string);
+ resetViewCount = 0;
+ if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
+ lineAndByteIndex = (int *)
+ ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ } else {
+ lineAndByteIndex = pixels;
+ }
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {
+ lineAndByteIndex[resetViewCount] = -1;
+ if (indexPtr->linePtr == tPtr->topIndex.linePtr) {
+ lineAndByteIndex[resetViewCount] =
+ TkBTreeLinesTo(tPtr, indexPtr->linePtr);
+ lineAndByteIndex[resetViewCount+1] = tPtr->topIndex.byteIndex;
+ if (lineAndByteIndex[resetViewCount+1] > indexPtr->byteIndex) {
+ lineAndByteIndex[resetViewCount+1] += length;
+ }
}
+ resetViewCount += 2;
}
- TkTextChanged(textPtr, indexPtr, indexPtr);
- TkBTreeInsertChars(indexPtr, string);
+
+ TkTextChanged(sharedTextPtr, NULL, indexPtr, indexPtr);
+
+ sharedTextPtr->stateEpoch++;
+
+ TkBTreeInsertChars(sharedTextPtr->tree, indexPtr, string);
/*
- * Push the insertion on the undo stack
+ * Push the insertion on the undo stack, and update the modified status of
+ * the widget.
*/
- if (textPtr->undo) {
- CONST char *cmdName;
- TkTextIndex toIndex;
+ if (length > 0) {
+ if (sharedTextPtr->undo) {
+ TkTextIndex toIndex;
+
+ if (sharedTextPtr->autoSeparators &&
+ sharedTextPtr->lastEditMode != TK_TEXT_EDIT_INSERT) {
+ TkUndoInsertUndoSeparator(sharedTextPtr->undoStack);
+ }
+
+ sharedTextPtr->lastEditMode = TK_TEXT_EDIT_INSERT;
- Tcl_DString actionCommand;
- Tcl_DString revertCommand;
+ TkTextIndexForwBytes(textPtr, indexPtr, length, &toIndex);
+ TextPushUndoAction(textPtr, stringPtr, 1, indexPtr, &toIndex);
+ }
+
+ UpdateDirtyFlag(sharedTextPtr);
+ }
- if (textPtr->autoSeparators &&
- textPtr->lastEditMode != TK_TEXT_EDIT_INSERT) {
- TkUndoInsertUndoSeparator(textPtr->undoStack);
+ resetViewCount = 0;
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {
+ if (lineAndByteIndex[resetViewCount] != -1) {
+ if ((tPtr != textPtr) || viewUpdate) {
+ TkTextIndex newTop;
+
+ TkTextMakeByteIndex(sharedTextPtr->tree, tPtr,
+ lineAndByteIndex[resetViewCount], 0, &newTop);
+ TkTextIndexForwBytes(tPtr, &newTop,
+ lineAndByteIndex[resetViewCount+1], &newTop);
+ TkTextSetYView(tPtr, &newTop, 0);
+ }
}
+ resetViewCount += 2;
+ }
+ if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
+ ckfree((char *) lineAndByteIndex);
+ }
+
+ /*
+ * Invalidate any selection retrievals in progress.
+ */
+
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {
+ tPtr->abortSelections = 1;
+ }
- textPtr->lastEditMode = TK_TEXT_EDIT_INSERT;
- cmdName = Tcl_GetCommandName(textPtr->interp, textPtr->widgetCmd);
+ /*
+ * For convenience, return the length of the string.
+ */
- Tcl_DStringInit(&actionCommand);
- Tcl_DStringInit(&revertCommand);
+ return length;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextPushUndoAction --
+ *
+ * Shared by insert and delete actions. Stores the appropriate scripts
+ * into our undo stack. We will add a single refCount to the 'undoString'
+ * object, so, if it previously had a refCount of zero, the caller should
+ * not free it.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Items pushed onto stack.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TextPushUndoAction(
+ TkText *textPtr, /* Overall information about text widget. */
+ Tcl_Obj *undoString, /* New text. */
+ int insert, /* 1 if insert, else delete. */
+ CONST TkTextIndex *index1Ptr,
+ /* Index describing first location. */
+ CONST TkTextIndex *index2Ptr)
+ /* Index describing second location. */
+{
+ TkUndoSubAtom *iAtom, *dAtom;
- Tcl_DStringAppendElement(&actionCommand, cmdName);
- Tcl_DStringAppend(&actionCommand, " insert ", -1);
- TkTextPrintIndex(indexPtr,indexBuffer);
- Tcl_DStringAppend(&actionCommand, indexBuffer, -1);
- Tcl_DStringAppend(&actionCommand, " ", -1);
- Tcl_DStringAppendElement(&actionCommand, string);
- Tcl_DStringAppend(&actionCommand, ";", -1);
- Tcl_DStringAppendElement(&actionCommand, cmdName);
- Tcl_DStringAppend(&actionCommand, " mark set insert ", -1);
- TkTextIndexForwBytes(indexPtr, (int) strlen(string), &toIndex);
- TkTextPrintIndex(&toIndex, indexBuffer);
- Tcl_DStringAppend(&actionCommand, indexBuffer,-1);
- Tcl_DStringAppend(&actionCommand, "; ", -1);
- Tcl_DStringAppendElement(&actionCommand, cmdName);
- Tcl_DStringAppend(&actionCommand, " see insert", -1);
+ /*
+ * Create the helpers.
+ */
- Tcl_DStringAppendElement(&revertCommand, cmdName);
- Tcl_DStringAppend(&revertCommand, " delete ", -1);
- TkTextPrintIndex(indexPtr, indexBuffer);
- Tcl_DStringAppend(&revertCommand, indexBuffer, -1);
- Tcl_DStringAppend(&revertCommand, " ", -1);
- TkTextPrintIndex(&toIndex, indexBuffer);
- Tcl_DStringAppend(&revertCommand, indexBuffer, -1);
- Tcl_DStringAppend(&revertCommand, " ;", -1);
- Tcl_DStringAppendElement(&revertCommand, cmdName);
- Tcl_DStringAppend(&revertCommand, " mark set insert ", -1);
- TkTextPrintIndex(indexPtr,indexBuffer);
- Tcl_DStringAppend(&revertCommand, indexBuffer, -1);
- Tcl_DStringAppend(&revertCommand, "; ", -1);
- Tcl_DStringAppendElement(&revertCommand, cmdName);
- Tcl_DStringAppend(&revertCommand," see insert", -1);
+ Tcl_Obj *seeInsertObj = Tcl_NewObj();
+ Tcl_Obj *markSet1InsertObj = Tcl_NewObj();
+ Tcl_Obj *markSet2InsertObj = NULL;
+ Tcl_Obj *insertCmdObj = Tcl_NewObj();
+ Tcl_Obj *deleteCmdObj = Tcl_NewObj();
- TkUndoPushAction(textPtr->undoStack, &actionCommand, &revertCommand);
+ /*
+ * Get the index positions.
+ */
- Tcl_DStringFree(&actionCommand);
- Tcl_DStringFree(&revertCommand);
+ Tcl_Obj *index1Obj = TkTextNewIndexObj(NULL, index1Ptr);
+ Tcl_Obj *index2Obj = TkTextNewIndexObj(NULL, index2Ptr);
+
+ /*
+ * These need refCounts, because they are used more than once below.
+ */
+
+ Tcl_IncrRefCount(seeInsertObj);
+ Tcl_IncrRefCount(index1Obj);
+ Tcl_IncrRefCount(index2Obj);
+
+ Tcl_ListObjAppendElement(NULL, seeInsertObj,
+ Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1));
+ Tcl_ListObjAppendElement(NULL, seeInsertObj, Tcl_NewStringObj("see", 3));
+ Tcl_ListObjAppendElement(NULL, seeInsertObj,
+ Tcl_NewStringObj("insert", 6));
+
+ Tcl_ListObjAppendElement(NULL, markSet1InsertObj,
+ Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1));
+ Tcl_ListObjAppendElement(NULL, markSet1InsertObj,
+ Tcl_NewStringObj("mark", 4));
+ Tcl_ListObjAppendElement(NULL, markSet1InsertObj,
+ Tcl_NewStringObj("set", 3));
+ Tcl_ListObjAppendElement(NULL, markSet1InsertObj,
+ Tcl_NewStringObj("insert", 6));
+ markSet2InsertObj = Tcl_DuplicateObj(markSet1InsertObj);
+ Tcl_ListObjAppendElement(NULL, markSet1InsertObj, index1Obj);
+ Tcl_ListObjAppendElement(NULL, markSet2InsertObj, index2Obj);
+
+ Tcl_ListObjAppendElement(NULL, insertCmdObj,
+ Tcl_NewStringObj("insert", 6));
+ Tcl_ListObjAppendElement(NULL, insertCmdObj, index1Obj);
+
+ /*
+ * Only use of 'undoString' is here.
+ */
+
+ Tcl_ListObjAppendElement(NULL, insertCmdObj, undoString);
+
+ Tcl_ListObjAppendElement(NULL, deleteCmdObj,
+ Tcl_NewStringObj("delete", 6));
+ Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj);
+ Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj);
+
+ /*
+ * Note: we don't wish to use textPtr->widgetCmd in these callbacks
+ * because if we delete the textPtr, but peers still exist, we will then
+ * have references to a non-existent Tcl_Command in the undo stack, which
+ * will lead to crashes later. Also, the behaviour of the widget w.r.t.
+ * bindings (%W substitutions) always uses the widget path name, so there
+ * is no good reason the undo stack should do otherwise.
+ *
+ * For the 'insert' and 'delete' actions, we have to register a functional
+ * callback, because these actions are defined to operate on the
+ * underlying data shared by all peers.
+ */
+
+ iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback,
+ (ClientData)textPtr->sharedTextPtr, insertCmdObj, NULL);
+ TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom);
+
+ dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback,
+ (ClientData)textPtr->sharedTextPtr, deleteCmdObj, NULL);
+ TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom);
+
+ Tcl_DecrRefCount(seeInsertObj);
+ Tcl_DecrRefCount(index1Obj);
+ Tcl_DecrRefCount(index2Obj);
+
+ /*
+ * Depending whether the action is to insert or delete, we provide the
+ * appropriate second and third arguments to TkUndoPushAction. (The first
+ * is the 'actionCommand', and the second the 'revertCommand').
+ */
+
+ if (insert) {
+ TkUndoPushAction(textPtr->sharedTextPtr->undoStack, iAtom, dAtom);
+ } else {
+ TkUndoPushAction(textPtr->sharedTextPtr->undoStack, dAtom, iAtom);
}
- updateDirtyFlag(textPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextUndoRedoCallback --
+ *
+ * This function is registered with the generic undo/redo code to handle
+ * 'insert' and 'delete' actions on all text widgets. We cannot perform
+ * those actions on any particular text widget, because that text widget
+ * might have been deleted by the time we get here.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Will insert or delete text, depending on the first word contained in
+ * objPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TextUndoRedoCallback(
+ Tcl_Interp *interp, /* Current interpreter. */
+ ClientData clientData, /* Passed from undo code, but contains our
+ * shared text data structure. */
+ Tcl_Obj *objPtr) /* Arguments of a command to be handled by the
+ * shared text data structure. */
+{
+ TkSharedText *sharedPtr = (TkSharedText *) clientData;
+ int res, objc;
+ Tcl_Obj **objv;
+ TkText *textPtr;
- if (resetView) {
- TkTextMakeByteIndex(textPtr->tree, lineIndex, 0, &newTop);
- TkTextIndexForwBytes(&newTop, offset, &newTop);
- TkTextSetYView(textPtr, &newTop, 0);
+ res = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv);
+ if (res != TCL_OK) {
+ return res;
}
/*
- * Invalidate any selection retrievals in progress.
+ * If possible, use a real text widget to perform the undo/redo action
+ * (i.e. insertion or deletion of text). This provides maximum
+ * compatibility with older versions of Tk, in which the user may rename
+ * the text widget to allow capture of undo or redo actions.
+ *
+ * In particular, this sorting of capture is useful in text editors based
+ * on the Tk text widget, which need to know which new text needs
+ * re-coloring.
+ *
+ * It would be better if the text widget provided some other mechanism to
+ * allow capture of this information ("What has just changed in the text
+ * widget?"). What we have here is not entirely satisfactory under all
+ * circumstances.
*/
- textPtr->abortSelections = 1;
+ textPtr = sharedPtr->peers;
+ while (textPtr != NULL) {
+ if (textPtr->start == NULL && textPtr->end == NULL) {
+ Tcl_Obj *cmdNameObj, *evalObj;
+
+ evalObj = Tcl_NewObj();
+ Tcl_IncrRefCount(evalObj);
+
+ /*
+ * We might wish to use the real, current command-name for the
+ * widget, but this will break any code that has over-ridden the
+ * widget, and is expecting to observe the insert/delete actions
+ * which are caused by undo/redo operations.
+ *
+ * cmdNameObj = Tcl_NewObj();
+ * Tcl_GetCommandFullName(interp, textPtr->widgetCmd, cmdNameObj);
+ *
+ * While such interception is not explicitly documented as
+ * supported, it does occur, and so until we can provide some
+ * alternative mechanism for such code to do what it needs, we
+ * allow it to take place here.
+ */
+
+ cmdNameObj = Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1);
+ Tcl_ListObjAppendElement(NULL, evalObj, cmdNameObj);
+ Tcl_ListObjAppendList(NULL, evalObj, objPtr);
+ res = Tcl_EvalObjEx(interp, evalObj, TCL_EVAL_GLOBAL);
+ Tcl_DecrRefCount(evalObj);
+ return res;
+ }
+ textPtr = textPtr->next;
+ }
+
+ /*
+ * If there's no current text widget which shows everything, then we fall
+ * back on acting directly. This means there is no way to intercept from
+ * the Tcl level.
+ */
+
+ return SharedTextObjCmd((ClientData)sharedPtr, interp, objc+1, objv-1);
}
/*
*----------------------------------------------------------------------
*
- * DeleteChars --
+ * CountIndices --
+ *
+ * This function implements most of the functionality of the "count"
+ * widget command.
*
- * This procedure implements most of the functionality of the
- * "delete" widget command.
+ * Note that 'textPtr' is only used if we need to check for elided
+ * attributes, i.e. if type is COUNT_DISPLAY_INDICES or
+ * COUNT_DISPLAY_CHARS
*
* Results:
- * Returns a standard Tcl result, and leaves an error message
- * in textPtr->interp if there is an error.
+ * Returns the number of characters in the range.
*
* Side effects:
- * Characters get deleted from the text.
+ * None.
*
*----------------------------------------------------------------------
*/
static int
-DeleteChars(textPtr, index1String, index2String, indexPtr1, indexPtr2)
- TkText *textPtr; /* Overall information about text widget. */
- CONST char *index1String; /* String describing location of first
- * character to delete. */
- CONST char *index2String; /* String describing location of last
- * character to delete. NULL means just
- * delete the one character given by
- * index1String. */
- TkTextIndex *indexPtr1; /* index describing location of first
+CountIndices(
+ CONST TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *indexPtr1,
+ /* Index describing location of first
* character to delete. */
- TkTextIndex *indexPtr2; /* index describing location of last
- * character to delete. NULL means just
- * delete the one character given by
- * indexPtr1. */
+ CONST TkTextIndex *indexPtr2,
+ /* Index describing location of last character
+ * to delete. NULL means just delete the one
+ * character given by indexPtr1. */
+ TkTextCountType type) /* The kind of indices to count. */
+{
+ /*
+ * Order the starting and stopping indices.
+ */
+
+ int compare = TkTextIndexCmp(indexPtr1, indexPtr2);
+
+ if (compare == 0) {
+ return 0;
+ } else if (compare > 0) {
+ return -TkTextIndexCount(textPtr, indexPtr2, indexPtr1, type);
+ } else {
+ return TkTextIndexCount(textPtr, indexPtr1, indexPtr2, type);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DeleteIndexRange --
+ *
+ * This function implements most of the functionality of the "delete"
+ * widget command.
+ *
+ * Results:
+ * Returns a standard Tcl result, currently always TCL_OK.
+ *
+ * Side effects:
+ * Characters and other entities (windows, images) get deleted from the
+ * text.
+ *
+ * If 'viewUpdate' is true, we may adjust the window contents'
+ * y-position, and scrollbar setting.
+ *
+ * If 'viewUpdate' is false, true we can guarantee that textPtr->topIndex
+ * points to a valid TkTextLine after this function returns. However, if
+ * 'viewUpdate' is false, then there is no such guarantee (since
+ * topIndex.linePtr can be garbage). The caller is expected to take
+ * actions to ensure the topIndex is validated before laying out the
+ * window again.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+DeleteIndexRange(
+ TkSharedText *sharedTextPtr,/* Shared portion of peer widgets. */
+ TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *indexPtr1,
+ /* Index describing location of first
+ * character (or other entity) to delete. */
+ CONST TkTextIndex *indexPtr2,
+ /* Index describing location of last
+ * character (or other entity) to delete.
+ * NULL means just delete the one character
+ * given by indexPtr1. */
+ int viewUpdate) /* Update vertical view if set. */
{
- int line1, line2, line, byteIndex, resetView;
+ int line1, line2;
TkTextIndex index1, index2;
- char indexBuffer[TK_POS_CHARS];
+ TkText *tPtr;
+ int *lineAndByteIndex;
+ int resetViewCount;
+ int pixels[2*PIXEL_CLIENTS];
+
+ if (sharedTextPtr == NULL) {
+ sharedTextPtr = textPtr->sharedTextPtr;
+ }
/*
- * Parse the starting and stopping indices.
+ * Prepare the starting and stopping indices.
*/
- if (index1String != NULL) {
- if (TkTextGetIndex(textPtr->interp, textPtr, index1String, &index1)
- != TCL_OK) {
- return TCL_ERROR;
- }
- if (index2String != NULL) {
- if (TkTextGetIndex(textPtr->interp, textPtr, index2String, &index2)
- != TCL_OK) {
- return TCL_ERROR;
- }
- } else {
- index2 = index1;
- TkTextIndexForwChars(&index2, 1, &index2);
- }
+ index1 = *indexPtr1;
+ if (indexPtr2 != NULL) {
+ index2 = *indexPtr2;
} else {
- index1 = *indexPtr1;
- if (indexPtr2 != NULL) {
- index2 = *indexPtr2;
- } else {
- index2 = index1;
- TkTextIndexForwChars(&index2, 1, &index2);
- }
+ index2 = index1;
+ TkTextIndexForwChars(NULL, &index2, 1, &index2, COUNT_INDICES);
}
/*
@@ -1558,32 +2965,33 @@ DeleteChars(textPtr, index1String, index2String, indexPtr1, indexPtr2)
}
/*
- * The code below is ugly, but it's needed to make sure there
- * is always a dummy empty line at the end of the text. If the
- * final newline of the file (just before the dummy line) is being
- * deleted, then back up index to just before the newline. If
- * there is a newline just before the first character being deleted,
- * then back up the first index too, so that an even number of lines
- * gets deleted. Furthermore, remove any tags that are present on
- * the newline that isn't going to be deleted after all (this simulates
- * deleting the newline and then adding a "clean" one back again).
+ * The code below is ugly, but it's needed to make sure there is always a
+ * dummy empty line at the end of the text. If the final newline of the
+ * file (just before the dummy line) is being deleted, then back up index
+ * to just before the newline. If there is a newline just before the first
+ * character being deleted, then back up the first index too, so that an
+ * even number of lines gets deleted. Furthermore, remove any tags that
+ * are present on the newline that isn't going to be deleted after all
+ * (this simulates deleting the newline and then adding a "clean" one back
+ * again). Note that index1 and index2 might now be equal again which
+ * means that no text will be deleted but tags might be removed.
*/
- line1 = TkBTreeLineIndex(index1.linePtr);
- line2 = TkBTreeLineIndex(index2.linePtr);
- if (line2 == TkBTreeNumLines(textPtr->tree)) {
+ line1 = TkBTreeLinesTo(textPtr, index1.linePtr);
+ line2 = TkBTreeLinesTo(textPtr, index2.linePtr);
+ if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) {
TkTextTag **arrayPtr;
int arraySize, i;
TkTextIndex oldIndex2;
oldIndex2 = index2;
- TkTextIndexBackChars(&oldIndex2, 1, &index2);
+ TkTextIndexBackChars(NULL, &oldIndex2, 1, &index2, COUNT_INDICES);
line2--;
if ((index1.byteIndex == 0) && (line1 != 0)) {
- TkTextIndexBackChars(&index1, 1, &index1);
+ TkTextIndexBackChars(NULL, &index1, 1, &index1, COUNT_INDICES);
line1--;
}
- arrayPtr = TkBTreeGetTags(&index2, &arraySize);
+ arrayPtr = TkBTreeGetTags(&index2, NULL, &arraySize);
if (arrayPtr != NULL) {
for (i = 0; i < arraySize; i++) {
TkBTreeTag(&index2, &oldIndex2, arrayPtr[i], 0);
@@ -1597,144 +3005,167 @@ DeleteChars(textPtr, index1String, index2String, indexPtr1, indexPtr2)
* We are deleting more than one line. For speed, we remove all tags
* from the range first. If we don't do this, the code below can (when
* there are many tags) grow non-linearly in execution time.
- * [Bug 1456342]
*/
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
+ int i;
- for (hPtr=Tcl_FirstHashEntry(&textPtr->tagTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
+ hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
TkTextTag *tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
TkBTreeTag(&index1, &index2, tagPtr, 0);
}
+
+ /*
+ * Special case for the sel tag which is not in the hash table. We
+ * need to do this once for each peer text widget.
+ */
+
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ;
+ tPtr = tPtr->next) {
+ if (TkBTreeTag(&index1, &index2, tPtr->selTagPtr, 0)) {
+ /*
+ * Send an event that the selection changed. This is
+ * equivalent to:
+ * event generate $textWidget <<Selection>>
+ */
+
+ TkTextSelectionEvent(textPtr);
+ tPtr->abortSelections = 1;
+ }
+ }
}
/*
- * Tell the display what's about to happen so it can discard
- * obsolete display information, then do the deletion. Also,
- * if the deletion involves the top line on the screen, then
- * we have to reset the view (the deletion will invalidate
- * textPtr->topIndex). Compute what the new first character
- * will be, then do the deletion, then reset the view.
+ * Tell the display what's about to happen so it can discard obsolete
+ * display information, then do the deletion. Also, if the deletion
+ * involves the top line on the screen, then we have to reset the view
+ * (the deletion will invalidate textPtr->topIndex). Compute what the new
+ * first character will be, then do the deletion, then reset the view.
*/
- TkTextChanged(textPtr, &index1, &index2);
- resetView = 0;
- line = 0;
- byteIndex = 0;
- if (TkTextIndexCmp(&index2, &textPtr->topIndex) >= 0) {
- if (TkTextIndexCmp(&index1, &textPtr->topIndex) <= 0) {
- /*
- * Deletion range straddles topIndex: use the beginning
- * of the range as the new topIndex.
- */
+ TkTextChanged(sharedTextPtr, NULL, &index1, &index2);
- resetView = 1;
- line = line1;
- byteIndex = index1.byteIndex;
- } else if (index1.linePtr == textPtr->topIndex.linePtr) {
+ resetViewCount = 0;
+ if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
+ lineAndByteIndex = (int *)
+ ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ } else {
+ lineAndByteIndex = pixels;
+ }
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {
+ int line = 0;
+ int byteIndex = 0;
+ int resetView = 0;
+
+ if (TkTextIndexCmp(&index2, &tPtr->topIndex) >= 0) {
+ if (TkTextIndexCmp(&index1, &tPtr->topIndex) <= 0) {
+ /*
+ * Deletion range straddles topIndex: use the beginning of the
+ * range as the new topIndex.
+ */
+
+ resetView = 1;
+ line = line1;
+ byteIndex = index1.byteIndex;
+ } else if (index1.linePtr == tPtr->topIndex.linePtr) {
+ /*
+ * Deletion range starts on top line but after topIndex. Use
+ * the current topIndex as the new one.
+ */
+
+ resetView = 1;
+ line = line1;
+ byteIndex = tPtr->topIndex.byteIndex;
+ }
+ } else if (index2.linePtr == tPtr->topIndex.linePtr) {
/*
- * Deletion range starts on top line but after topIndex.
- * Use the current topIndex as the new one.
+ * Deletion range ends on top line but before topIndex. Figure out
+ * what will be the new character index for the character
+ * currently pointed to by topIndex.
*/
resetView = 1;
- line = line1;
- byteIndex = textPtr->topIndex.byteIndex;
+ line = line2;
+ byteIndex = tPtr->topIndex.byteIndex;
+ if (index1.linePtr != index2.linePtr) {
+ byteIndex -= index2.byteIndex;
+ } else {
+ byteIndex -= (index2.byteIndex - index1.byteIndex);
+ }
}
- } else if (index2.linePtr == textPtr->topIndex.linePtr) {
- /*
- * Deletion range ends on top line but before topIndex.
- * Figure out what will be the new character index for
- * the character currently pointed to by topIndex.
- */
-
- resetView = 1;
- line = line2;
- byteIndex = textPtr->topIndex.byteIndex;
- if (index1.linePtr != index2.linePtr) {
- byteIndex -= index2.byteIndex;
+ if (resetView) {
+ lineAndByteIndex[resetViewCount] = line;
+ lineAndByteIndex[resetViewCount+1] = byteIndex;
} else {
- byteIndex -= (index2.byteIndex - index1.byteIndex);
+ lineAndByteIndex[resetViewCount] = -1;
}
+ resetViewCount+=2;
}
/*
- * Push the deletion on the undo stack
+ * Push the deletion on the undo stack if something was actually deleted.
*/
- if (textPtr->undo) {
- CONST char *cmdName;
- Tcl_DString ds;
- Tcl_DString actionCommand;
- Tcl_DString revertCommand;
-
- if (textPtr->autoSeparators
- && (textPtr->lastEditMode != TK_TEXT_EDIT_DELETE)) {
- TkUndoInsertUndoSeparator(textPtr->undoStack);
- }
+ if (TkTextIndexCmp(&index1, &index2) < 0) {
+ if (sharedTextPtr->undo) {
+ Tcl_Obj *get;
- textPtr->lastEditMode = TK_TEXT_EDIT_DELETE;
- cmdName = Tcl_GetCommandName(textPtr->interp, textPtr->widgetCmd);
+ if (sharedTextPtr->autoSeparators
+ && (sharedTextPtr->lastEditMode != TK_TEXT_EDIT_DELETE)) {
+ TkUndoInsertUndoSeparator(sharedTextPtr->undoStack);
+ }
- Tcl_DStringInit(&actionCommand);
- Tcl_DStringInit(&revertCommand);
+ sharedTextPtr->lastEditMode = TK_TEXT_EDIT_DELETE;
- Tcl_DStringAppendElement(&actionCommand, cmdName);
- Tcl_DStringAppend(&actionCommand, " delete ", -1);
- TkTextPrintIndex(&index1, indexBuffer);
- Tcl_DStringAppend(&actionCommand, indexBuffer, -1);
- Tcl_DStringAppend(&actionCommand, " ", -1);
- TkTextPrintIndex(&index2, indexBuffer);
- Tcl_DStringAppend(&actionCommand, indexBuffer, -1);
- Tcl_DStringAppend(&actionCommand, "; ", -1);
- Tcl_DStringAppendElement(&actionCommand, cmdName);
- Tcl_DStringAppend(&actionCommand, " mark set insert ", -1);
- TkTextPrintIndex(&index1, indexBuffer);
- Tcl_DStringAppend(&actionCommand,indexBuffer, -1);
+ get = TextGetText(textPtr, &index1, &index2, 0);
+ TextPushUndoAction(textPtr, get, 0, &index1, &index2);
+ }
+ sharedTextPtr->stateEpoch++;
- Tcl_DStringAppend(&actionCommand, "; ", -1);
- Tcl_DStringAppendElement(&actionCommand, cmdName);
- Tcl_DStringAppend(&actionCommand, " see insert", -1);
+ TkBTreeDeleteIndexRange(sharedTextPtr->tree, &index1, &index2);
- TextGetText(&index1, &index2, &ds);
+ UpdateDirtyFlag(sharedTextPtr);
+ }
- Tcl_DStringAppendElement(&revertCommand, cmdName);
- Tcl_DStringAppend(&revertCommand, " insert ", -1);
- TkTextPrintIndex(&index1, indexBuffer);
- Tcl_DStringAppend(&revertCommand, indexBuffer, -1);
- Tcl_DStringAppend(&revertCommand, " ", -1);
- Tcl_DStringAppendElement(&revertCommand, Tcl_DStringValue(&ds));
- Tcl_DStringAppend(&revertCommand, "; ", -1);
- Tcl_DStringAppendElement(&revertCommand, cmdName);
- Tcl_DStringAppend(&revertCommand, " mark set insert ", -1);
- TkTextPrintIndex(&index2, indexBuffer);
- Tcl_DStringAppend(&revertCommand, indexBuffer, -1);
- Tcl_DStringAppend(&revertCommand, "; ", -1);
- Tcl_DStringAppendElement(&revertCommand, cmdName);
- Tcl_DStringAppend(&revertCommand, " see insert", -1);
+ resetViewCount = 0;
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {
+ int line = lineAndByteIndex[resetViewCount];
- TkUndoPushAction(textPtr->undoStack, &actionCommand, &revertCommand);
+ if (line != -1) {
+ int byteIndex = lineAndByteIndex[resetViewCount+1];
+ TkTextIndex indexTmp;
- Tcl_DStringFree(&actionCommand);
- Tcl_DStringFree(&revertCommand);
+ if (tPtr == textPtr) {
+ if (viewUpdate) {
+ TkTextMakeByteIndex(sharedTextPtr->tree, textPtr, line,
+ byteIndex, &indexTmp);
+ TkTextSetYView(tPtr, &indexTmp, 0);
+ }
+ } else {
+ TkTextMakeByteIndex(sharedTextPtr->tree, NULL, line,
+ byteIndex, &indexTmp);
+ TkTextSetYView(tPtr, &indexTmp, 0);
+ }
+ }
+ resetViewCount += 2;
}
- TkBTreeDeleteChars(&index1, &index2);
-
- updateDirtyFlag(textPtr);
-
- if (resetView) {
- TkTextMakeByteIndex(textPtr->tree, line, byteIndex, &index1);
- TkTextSetYView(textPtr, &index1, 0);
+ if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
+ ckfree((char *) lineAndByteIndex);
}
- /*
- * Invalidate any selection retrievals in progress.
- */
+ if (line1 >= line2) {
+ /*
+ * Invalidate any selection retrievals in progress, assuming we didn't
+ * check for this case above.
+ */
- textPtr->abortSelections = 1;
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {
+ tPtr->abortSelections = 1;
+ }
+ }
return TCL_OK;
}
@@ -1744,15 +3175,15 @@ DeleteChars(textPtr, index1String, index2String, indexPtr1, indexPtr2)
*
* TextFetchSelection --
*
- * This procedure is called back by Tk when the selection is
- * requested by someone. It returns part or all of the selection
- * in a buffer provided by the caller.
+ * This function is called back by Tk when the selection is requested by
+ * someone. It returns part or all of the selection in a buffer provided
+ * by the caller.
*
* Results:
- * The return value is the number of non-NULL bytes stored
- * at buffer. Buffer is filled (or partially filled) with a
- * NULL-terminated string containing part or all of the selection,
- * as given by offset and maxBytes.
+ * The return value is the number of non-NULL bytes stored at buffer.
+ * Buffer is filled (or partially filled) with a NULL-terminated string
+ * containing part or all of the selection, as given by offset and
+ * maxBytes.
*
* Side effects:
* None.
@@ -1761,15 +3192,14 @@ DeleteChars(textPtr, index1String, index2String, indexPtr1, indexPtr2)
*/
static int
-TextFetchSelection(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Information about text widget. */
- int offset; /* Offset within selection of first
- * character to be returned. */
- char *buffer; /* Location in which to place
- * selection. */
- int maxBytes; /* Maximum number of bytes to place
- * at buffer, not including terminating
- * NULL character. */
+TextFetchSelection(
+ ClientData clientData, /* Information about text widget. */
+ int offset, /* Offset within selection of first character
+ * to be returned. */
+ char *buffer, /* Location in which to place selection. */
+ int maxBytes) /* Maximum number of bytes to place at buffer,
+ * not including terminating NULL
+ * character. */
{
register TkText *textPtr = (TkText *) clientData;
TkTextIndex eof;
@@ -1782,20 +3212,21 @@ TextFetchSelection(clientData, offset, buffer, maxBytes)
}
/*
- * Find the beginning of the next range of selected text. Note: if
- * the selection is being retrieved in multiple pieces (offset != 0)
- * and some modification has been made to the text that affects the
- * selection then reject the selection request (make 'em start over
- * again).
+ * Find the beginning of the next range of selected text. Note: if the
+ * selection is being retrieved in multiple pieces (offset != 0) and some
+ * modification has been made to the text that affects the selection then
+ * reject the selection request (make 'em start over again).
*/
if (offset == 0) {
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &textPtr->selIndex);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0,
+ &textPtr->selIndex);
textPtr->abortSelections = 0;
} else if (textPtr->abortSelections) {
return 0;
}
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree), 0, &eof);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr), 0, &eof);
TkBTreeStartSearch(&textPtr->selIndex, &eof, textPtr->selTagPtr, &search);
if (!TkBTreeCharTagged(&textPtr->selIndex, textPtr->selTagPtr)) {
if (!TkBTreeNextTag(&search)) {
@@ -1810,8 +3241,8 @@ TextFetchSelection(clientData, offset, buffer, maxBytes)
/*
* Each iteration through the outer loop below scans one selected range.
- * Each iteration through the inner loop scans one segment in the
- * selected range.
+ * Each iteration through the inner loop scans one segment in the selected
+ * range.
*/
count = 0;
@@ -1821,18 +3252,18 @@ TextFetchSelection(clientData, offset, buffer, maxBytes)
*/
if (!TkBTreeNextTag(&search)) {
- panic("TextFetchSelection couldn't find end of range");
+ Tcl_Panic("TextFetchSelection couldn't find end of range");
}
/*
- * Copy information from character segments into the buffer
- * until either we run out of space in the buffer or we get
- * to the end of this range of text.
+ * Copy information from character segments into the buffer until
+ * either we run out of space in the buffer or we get to the end of
+ * this range of text.
*/
while (1) {
if (maxBytes == 0) {
- goto done;
+ goto fetchDone;
}
segPtr = TkTextIndexToSeg(&textPtr->selIndex, &offsetInSeg);
chunkSize = segPtr->size - offsetInSeg;
@@ -1852,14 +3283,14 @@ TextFetchSelection(clientData, offset, buffer, maxBytes)
}
}
if ((segPtr->typePtr == &tkTextCharType)
- && !TkTextIsElided(textPtr, &textPtr->selIndex)) {
- memcpy((VOID *) buffer, (VOID *) (segPtr->body.chars
- + offsetInSeg), (size_t) chunkSize);
+ && !TkTextIsElided(textPtr, &textPtr->selIndex, NULL)) {
+ memcpy(buffer, segPtr->body.chars + offsetInSeg,
+ (size_t) chunkSize);
buffer += chunkSize;
maxBytes -= chunkSize;
count += chunkSize;
}
- TkTextIndexForwBytes(&textPtr->selIndex, chunkSize,
+ TkTextIndexForwBytes(textPtr, &textPtr->selIndex, chunkSize,
&textPtr->selIndex);
}
@@ -1873,7 +3304,7 @@ TextFetchSelection(clientData, offset, buffer, maxBytes)
textPtr->selIndex = search.curIndex;
}
- done:
+ fetchDone:
*buffer = 0;
return count;
}
@@ -1883,11 +3314,10 @@ TextFetchSelection(clientData, offset, buffer, maxBytes)
*
* TkTextLostSelection --
*
- * This procedure is called back by Tk when the selection is
- * grabbed away from a text widget. On Windows and Mac systems, we
- * want to remember the selection for the next time the focus
- * enters the window. On Unix, just remove the "sel" tag from
- * everything in the widget.
+ * This function is called back by Tk when the selection is grabbed away
+ * from a text widget. On Windows and Mac systems, we want to remember
+ * the selection for the next time the focus enters the window. On Unix,
+ * just remove the "sel" tag from everything in the widget.
*
* Results:
* None.
@@ -1899,11 +3329,10 @@ TextFetchSelection(clientData, offset, buffer, maxBytes)
*/
void
-TkTextLostSelection(clientData)
- ClientData clientData; /* Information about text widget. */
+TkTextLostSelection(
+ ClientData clientData) /* Information about text widget. */
{
register TkText *textPtr = (TkText *) clientData;
- XEvent event;
if (TkpAlwaysShowSelection(textPtr->tkwin)) {
TkTextIndex start, end;
@@ -1913,30 +3342,26 @@ TkTextLostSelection(clientData)
}
/*
- * On Windows and Mac systems, we want to remember the selection
- * for the next time the focus enters the window. On Unix,
- * just remove the "sel" tag from everything in the widget.
+ * On Windows and Mac systems, we want to remember the selection for
+ * the next time the focus enters the window. On Unix, just remove the
+ * "sel" tag from everything in the widget.
*/
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &start);
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree), 0, &end);
- TkTextRedrawTag(textPtr, &start, &end, textPtr->selTagPtr, 1);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ 0, 0, &start);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr),
+ 0, &end);
+ TkTextRedrawTag(NULL, textPtr, &start, &end, textPtr->selTagPtr, 1);
TkBTreeTag(&start, &end, textPtr->selTagPtr, 0);
}
/*
- * Send an event that the selection changed. This is equivalent to
- * "event generate $textWidget <<Selection>>"
+ * Send an event that the selection changed. This is equivalent to:
+ * event generate $textWidget <<Selection>>
*/
- memset((VOID *) &event, 0, sizeof(event));
- event.xany.type = VirtualEvent;
- event.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
- event.xany.send_event = False;
- event.xany.window = Tk_WindowId(textPtr->tkwin);
- event.xany.display = Tk_Display(textPtr->tkwin);
- ((XVirtualEvent *) &event)->name = Tk_GetUid("Selection");
- Tk_HandleEvent(&event);
+ TkTextSelectionEvent(textPtr);
textPtr->flags &= ~GOT_SELECTION;
}
@@ -1944,31 +3369,78 @@ TkTextLostSelection(clientData)
/*
*----------------------------------------------------------------------
*
+ * TkTextSelectionEvent --
+ *
+ * When anything relevant to the "sel" tag has been changed, call this
+ * function to generate a <<Selection>> event.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * If <<Selection>> bindings are present, they will trigger.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkTextSelectionEvent(
+ TkText *textPtr)
+{
+ /*
+ * Send an event that the selection changed. This is equivalent to:
+ * event generate $textWidget <<Selection>>
+ */
+
+ union {XEvent general; XVirtualEvent virtual;} event;
+
+ memset(&event, 0, sizeof(event));
+ event.general.xany.type = VirtualEvent;
+ event.general.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
+ event.general.xany.send_event = False;
+ event.general.xany.window = Tk_WindowId(textPtr->tkwin);
+ event.general.xany.display = Tk_Display(textPtr->tkwin);
+ event.virtual.name = Tk_GetUid("Selection");
+ Tk_HandleEvent(&event.general);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TextBlinkProc --
*
- * This procedure is called as a timer handler to blink the
- * insertion cursor off and on.
+ * This function is called as a timer handler to blink the insertion
+ * cursor off and on.
*
* Results:
* None.
*
* Side effects:
- * The cursor gets turned on or off, redisplay gets invoked,
- * and this procedure reschedules itself.
+ * The cursor gets turned on or off, redisplay gets invoked, and this
+ * function reschedules itself.
*
*----------------------------------------------------------------------
*/
static void
-TextBlinkProc(clientData)
- ClientData clientData; /* Pointer to record describing text. */
+TextBlinkProc(
+ ClientData clientData) /* Pointer to record describing text. */
{
register TkText *textPtr = (TkText *) clientData;
TkTextIndex index;
- int x, y, w, h;
+ int x, y, w, h, charWidth;
- if ((textPtr->state == TK_STATE_DISABLED) ||
+ if ((textPtr->state == TK_TEXT_STATE_DISABLED) ||
!(textPtr->flags & GOT_FOCUS) || (textPtr->insertOffTime == 0)) {
+ if ((textPtr->insertOffTime == 0) && !(textPtr->flags & INSERT_ON)) {
+ /*
+ * The widget was configured to have zero offtime while the
+ * insertion point was not displayed. We have to display it once.
+ */
+
+ textPtr->flags |= INSERT_ON;
+ goto redrawInsert;
+ }
return;
}
if (textPtr->flags & INSERT_ON) {
@@ -1980,11 +3452,102 @@ TextBlinkProc(clientData)
textPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
textPtr->insertOnTime, TextBlinkProc, (ClientData) textPtr);
}
+ redrawInsert:
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
- if (TkTextCharBbox(textPtr, &index, &x, &y, &w, &h) == 0) {
- TkTextRedrawRegion(textPtr, x - textPtr->insertWidth / 2, y,
- textPtr->insertWidth, h);
+ if (TkTextIndexBbox(textPtr, &index, &x, &y, &w, &h, &charWidth) == 0) {
+ if (textPtr->insertCursorType) {
+ /* Block cursor */
+ TkTextRedrawRegion(textPtr, x - textPtr->width / 2, y,
+ charWidth + textPtr->insertWidth / 2, h);
+ } else {
+ /* I-beam cursor */
+ TkTextRedrawRegion(textPtr, x - textPtr->insertWidth / 2, y,
+ textPtr->insertWidth, h);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextInsertCmd --
+ *
+ * This function is invoked to process the "insert" and "replace" widget
+ * commands for text widgets.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ * If 'viewUpdate' is true, we may adjust the window contents'
+ * y-position, and scrollbar setting.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TextInsertCmd(
+ TkSharedText *sharedTextPtr,/* Shared portion of peer widgets. */
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ CONST TkTextIndex *indexPtr,/* Index at which to insert. */
+ int viewUpdate) /* Update the view if set. */
+{
+ TkTextIndex index1, index2;
+ int j;
+
+ if (sharedTextPtr == NULL) {
+ sharedTextPtr = textPtr->sharedTextPtr;
+ }
+
+ index1 = *indexPtr;
+ for (j = 0; j < objc; j += 2) {
+ /*
+ * Here we rely on this call to modify index1 if it is outside the
+ * acceptable range. In particular, if index1 is "end", it must be set
+ * to the last allowable index for insertion, otherwise subsequent tag
+ * insertions will fail.
+ */
+
+ int length = InsertChars(sharedTextPtr, textPtr, &index1, objv[j],
+ viewUpdate);
+
+ if (objc > (j+1)) {
+ Tcl_Obj **tagNamePtrs;
+ TkTextTag **oldTagArrayPtr;
+ int numTags;
+
+ TkTextIndexForwBytes(textPtr, &index1, length, &index2);
+ oldTagArrayPtr = TkBTreeGetTags(&index1, NULL, &numTags);
+ if (oldTagArrayPtr != NULL) {
+ int i;
+
+ for (i = 0; i < numTags; i++) {
+ TkBTreeTag(&index1, &index2, oldTagArrayPtr[i], 0);
+ }
+ ckfree((char *) oldTagArrayPtr);
+ }
+ if (Tcl_ListObjGetElements(interp, objv[j+1], &numTags,
+ &tagNamePtrs) != TCL_OK) {
+ return TCL_ERROR;
+ } else {
+ int i;
+
+ for (i = 0; i < numTags; i++) {
+ CONST char *strTag = Tcl_GetString(tagNamePtrs[i]);
+
+ TkBTreeTag(&index1, &index2,
+ TkTextCreateTag(textPtr, strTag, NULL), 1);
+ }
+ index1 = index2;
+ }
+ }
}
+ return TCL_OK;
}
/*
@@ -1992,9 +3555,8 @@ TextBlinkProc(clientData)
*
* TextSearchCmd --
*
- * This procedure is invoked to process the "search" widget command
- * for text widgets. See the user documentation for details on what
- * it does.
+ * This function is invoked to process the "search" widget command for
+ * text widgets. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2006,393 +3568,680 @@ TextBlinkProc(clientData)
*/
static int
-TextSearchCmd(textPtr, interp, argc, argv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TextSearchCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- int backwards, exact, searchElide, c, i, argsLeft, noCase, leftToScan;
- size_t length;
- int numLines, startingLine, startingByte, lineNum, firstByte, lastByte;
- int code, matchLength, matchByte, passes, stopLine, searchWholeText;
- int patLength;
- CONST char *arg, *pattern, *varName, *p, *startOfLine;
- char buffer[20];
- TkTextIndex index, stopIndex;
- Tcl_DString line, patDString;
- TkTextSegment *segPtr;
- TkTextLine *linePtr;
- TkTextIndex curIndex;
- Tcl_Obj *patObj = NULL;
- Tcl_RegExp regexp = NULL; /* Initialization needed only to
- * prevent compiler warning. */
+ int i, argsLeft, code;
+ SearchSpec searchSpec;
+
+ static CONST char *switchStrings[] = {
+ "--", "-all", "-backwards", "-count", "-elide", "-exact", "-forwards",
+ "-hidden", "-nocase", "-nolinestop", "-overlap", "-regexp",
+ "-strictlimits", NULL
+ };
+ enum SearchSwitches {
+ SEARCH_END, SEARCH_ALL, SEARCH_BACK, SEARCH_COUNT, SEARCH_ELIDE,
+ SEARCH_EXACT, SEARCH_FWD, SEARCH_HIDDEN, SEARCH_NOCASE,
+ SEARCH_NOLINESTOP, SEARCH_OVERLAP, SEARCH_REGEXP, SEARCH_STRICTLIMITS
+ };
+
+ /*
+ * Set up the search specification, including the last 4 fields which are
+ * text widget specific.
+ */
+
+ searchSpec.exact = 1;
+ searchSpec.noCase = 0;
+ searchSpec.all = 0;
+ searchSpec.backwards = 0;
+ searchSpec.varPtr = NULL;
+ searchSpec.countPtr = NULL;
+ searchSpec.resPtr = NULL;
+ searchSpec.searchElide = 0;
+ searchSpec.noLineStop = 0;
+ searchSpec.overlap = 0;
+ searchSpec.strictLimits = 0;
+ searchSpec.numLines =
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
+ searchSpec.clientData = (ClientData)textPtr;
+ searchSpec.addLineProc = &TextSearchAddNextLine;
+ searchSpec.foundMatchProc = &TextSearchFoundMatch;
+ searchSpec.lineIndexProc = &TextSearchGetLineIndex;
/*
* Parse switches and other arguments.
*/
- exact = 1;
- searchElide = 0;
- curIndex.tree = textPtr->tree;
- backwards = 0;
- noCase = 0;
- varName = NULL;
- for (i = 2; i < argc; i++) {
- arg = argv[i];
- if (arg[0] != '-') {
+ for (i=2 ; i<objc ; i++) {
+ int index;
+ if (Tcl_GetString(objv[i])[0] != '-') {
break;
}
- length = strlen(arg);
- if (length < 2) {
- badSwitch:
- Tcl_AppendResult(interp, "bad switch \"", arg,
- "\": must be --, -backward, -count, -elide, -exact, ",
- "-forward, -nocase, or -regexp", (char *) NULL);
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], switchStrings, "switch", 0,
+ &index) != TCL_OK) {
+ /*
+ * Hide the -hidden option.
+ */
+
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bad switch \"", Tcl_GetString(objv[i]),
+ "\": must be --, -all, -backward, -count, -elide, ",
+ "-exact, -forward, -nocase, -nolinestop, -overlap, ",
+ "-regexp, or -strictlimits", NULL);
return TCL_ERROR;
}
- c = arg[1];
- if ((c == 'b') && (strncmp(argv[i], "-backwards", length) == 0)) {
- backwards = 1;
- } else if ((c == 'c') && (strncmp(argv[i], "-count", length) == 0)) {
- if (i >= (argc-1)) {
+
+ switch ((enum SearchSwitches) index) {
+ case SEARCH_END:
+ i++;
+ goto endOfSwitchProcessing;
+ case SEARCH_ALL:
+ searchSpec.all = 1;
+ break;
+ case SEARCH_BACK:
+ searchSpec.backwards = 1;
+ break;
+ case SEARCH_COUNT:
+ if (i >= objc-1) {
Tcl_SetResult(interp, "no value given for \"-count\" option",
TCL_STATIC);
return TCL_ERROR;
}
i++;
- varName = argv[i];
- } else if ((c == 'e') && (length > 2)
- && (strncmp(argv[i], "-exact", length) == 0)) {
- exact = 1;
- } else if ((c == 'e') && (length > 2)
- && (strncmp(argv[i], "-elide", length) == 0)) {
- searchElide = 1;
- } else if ((c == 'h') && (strncmp(argv[i], "-hidden", length) == 0)) {
+
/*
- * -hidden is kept around for backwards compatibility with
- * the dash patch, but -elide is the official option
+ * Assumption objv[i] isn't going to disappear on us during this
+ * function, which is fair.
*/
- searchElide = 1;
- } else if ((c == 'f') && (strncmp(argv[i], "-forwards", length) == 0)) {
- backwards = 0;
- } else if ((c == 'n') && (strncmp(argv[i], "-nocase", length) == 0)) {
- noCase = 1;
- } else if ((c == 'r') && (strncmp(argv[i], "-regexp", length) == 0)) {
- exact = 0;
- } else if ((c == '-') && (strncmp(argv[i], "--", length) == 0)) {
- i++;
+
+ searchSpec.varPtr = objv[i];
break;
- } else {
- goto badSwitch;
+ case SEARCH_ELIDE:
+ case SEARCH_HIDDEN:
+ searchSpec.searchElide = 1;
+ break;
+ case SEARCH_EXACT:
+ searchSpec.exact = 1;
+ break;
+ case SEARCH_FWD:
+ searchSpec.backwards = 0;
+ break;
+ case SEARCH_NOCASE:
+ searchSpec.noCase = 1;
+ break;
+ case SEARCH_NOLINESTOP:
+ searchSpec.noLineStop = 1;
+ break;
+ case SEARCH_OVERLAP:
+ searchSpec.overlap = 1;
+ break;
+ case SEARCH_STRICTLIMITS:
+ searchSpec.strictLimits = 1;
+ break;
+ case SEARCH_REGEXP:
+ searchSpec.exact = 0;
+ break;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
}
}
- argsLeft = argc - (i+2);
+ endOfSwitchProcessing:
+
+ argsLeft = objc - (i+2);
if ((argsLeft != 0) && (argsLeft != 1)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " search ?switches? pattern index ?stopIndex?\"",
- (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "?switches? pattern index ?stopIndex?");
+ return TCL_ERROR;
+ }
+
+ if (searchSpec.noLineStop && searchSpec.exact) {
+ Tcl_SetResult(interp, "the \"-nolinestop\" option requires the "
+ "\"-regexp\" option to be present", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (searchSpec.overlap && !searchSpec.all) {
+ Tcl_SetResult(interp, "the \"-overlap\" option requires the "
+ "\"-all\" option to be present", TCL_STATIC);
return TCL_ERROR;
}
- pattern = argv[i];
/*
- * Convert the pattern to lower-case if we're supposed to ignore case.
+ * Scan through all of the lines of the text circularly, starting at the
+ * given index. 'objv[i]' is the pattern which may be an exact string or a
+ * regexp pattern depending on the flags set above.
*/
- if (noCase && exact) {
- Tcl_DStringInit(&patDString);
- Tcl_DStringAppend(&patDString, pattern, -1);
- Tcl_UtfToLower(Tcl_DStringValue(&patDString));
- pattern = Tcl_DStringValue(&patDString);
+ code = SearchPerform(interp, &searchSpec, objv[i], objv[i+1],
+ (argsLeft == 1 ? objv[i+2] : NULL));
+ if (code != TCL_OK) {
+ goto cleanup;
}
- Tcl_DStringInit(&line);
- if (TkTextGetIndex(interp, textPtr, argv[i+1], &index) != TCL_OK) {
- code = TCL_ERROR;
- goto done;
- }
- numLines = TkBTreeNumLines(textPtr->tree);
- startingLine = TkBTreeLineIndex(index.linePtr);
- startingByte = index.byteIndex;
- if (startingLine >= numLines) {
- if (backwards) {
- startingLine = TkBTreeNumLines(textPtr->tree) - 1;
- startingByte = TkBTreeBytesInLine(TkBTreeFindLine(textPtr->tree,
- startingLine));
- } else {
- startingLine = 0;
- startingByte = 0;
- }
- }
- if (argsLeft == 1) {
- if (TkTextGetIndex(interp, textPtr, argv[i+2], &stopIndex) != TCL_OK) {
+ /*
+ * Set the '-count' variable, if given.
+ */
+
+ if (searchSpec.varPtr != NULL && searchSpec.countPtr != NULL) {
+ Tcl_IncrRefCount(searchSpec.countPtr);
+ if (Tcl_ObjSetVar2(interp, searchSpec.varPtr, NULL,
+ searchSpec.countPtr, TCL_LEAVE_ERR_MSG) == NULL) {
code = TCL_ERROR;
- goto done;
- }
- stopLine = TkBTreeLineIndex(stopIndex.linePtr);
- if (!backwards && (stopLine == numLines)) {
- stopLine = numLines-1;
+ goto cleanup;
}
- searchWholeText = 0;
- } else {
- stopLine = 0;
- searchWholeText = 1;
}
/*
- * Scan through all of the lines of the text circularly, starting
- * at the given index.
+ * Set the result.
*/
- matchLength = patLength = 0; /* Only needed to prevent compiler
- * warnings. */
- if (exact) {
- patLength = strlen(pattern);
- } else {
- patObj = Tcl_NewStringObj(pattern, -1);
- Tcl_IncrRefCount(patObj);
- regexp = Tcl_GetRegExpFromObj(interp, patObj,
- (noCase ? TCL_REG_NOCASE : 0) | TCL_REG_ADVANCED);
- if (regexp == NULL) {
- code = TCL_ERROR;
- goto done;
- }
+ if (searchSpec.resPtr != NULL) {
+ Tcl_SetObjResult(interp, searchSpec.resPtr);
+ searchSpec.resPtr = NULL;
}
- lineNum = startingLine;
- code = TCL_OK;
- for (passes = 0; passes < 2; ) {
- if (lineNum >= numLines) {
- /*
- * Don't search the dummy last line of the text.
- */
- goto nextLine;
- }
+ cleanup:
+ if (searchSpec.countPtr != NULL) {
+ Tcl_DecrRefCount(searchSpec.countPtr);
+ }
+ if (searchSpec.resPtr != NULL) {
+ Tcl_DecrRefCount(searchSpec.resPtr);
+ }
+ return code;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextSearchGetLineIndex --
+ *
+ * Extract a row, text offset index position from an objPtr
+ *
+ * This means we ignore any embedded windows/images and elidden text
+ * (unless we are searching that).
+ *
+ * Results:
+ * Standard Tcl error code (with a message in the interpreter on error
+ * conditions).
+ *
+ * The offset placed in offsetPosPtr is a utf-8 char* byte index for
+ * exact searches, and a Unicode character index for regexp searches.
+ *
+ * The line number should start at zero (searches which wrap around
+ * assume the first line is numbered 0).
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TextSearchGetLineIndex(
+ Tcl_Interp *interp, /* For error messages. */
+ Tcl_Obj *objPtr, /* Contains a textual index like "1.2" */
+ SearchSpec *searchSpecPtr, /* Contains other search parameters. */
+ int *linePosPtr, /* For returning the line number. */
+ int *offsetPosPtr) /* For returning the text offset in the
+ * line. */
+{
+ CONST TkTextIndex *indexPtr;
+ int line;
+ TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+
+ indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr);
+ if (indexPtr == NULL) {
+ return TCL_ERROR;
+ }
+
+ line = TkBTreeLinesTo(textPtr, indexPtr->linePtr);
+ if (line >= searchSpecPtr->numLines) {
+ TkTextLine *linePtr;
+ int count = 0;
+ TkTextSegment *segPtr;
+
+ line = searchSpecPtr->numLines-1;
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr, line);
/*
- * Extract the text from the line. If we're doing regular
- * expression matching, drop the newline from the line, so
- * that "$" can be used to match the end of the line.
+ * Count the number of bytes in this line.
*/
- linePtr = TkBTreeFindLine(textPtr->tree, lineNum);
- curIndex.linePtr = linePtr; curIndex.byteIndex = 0;
- for (segPtr = linePtr->segPtr; segPtr != NULL;
+ for (segPtr=linePtr->segPtr ; segPtr!=NULL ; segPtr=segPtr->nextPtr) {
+ count += segPtr->size;
+ }
+ *offsetPosPtr = TextSearchIndexInLine(searchSpecPtr, linePtr, count);
+ } else {
+ *offsetPosPtr = TextSearchIndexInLine(searchSpecPtr,
+ indexPtr->linePtr, indexPtr->byteIndex);
+ }
+
+ *linePosPtr = line;
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextSearchIndexInLine --
+ *
+ * Find textual index of 'byteIndex' in the searchable characters of
+ * 'linePtr'.
+ *
+ * This means we ignore any embedded windows/images and elidden text
+ * (unless we are searching that).
+ *
+ * Results:
+ * The returned index is a utf-8 char* byte index for exact searches, and
+ * a Unicode character index for regexp searches.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TextSearchIndexInLine(
+ CONST SearchSpec *searchSpecPtr,
+ /* Search parameters. */
+ TkTextLine *linePtr, /* The line we're looking at. */
+ int byteIndex) /* Index into the line. */
+{
+ TkTextSegment *segPtr;
+ TkTextIndex curIndex;
+ int index, leftToScan;
+ TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+
+ index = 0;
+ curIndex.tree = textPtr->sharedTextPtr->tree;
+ curIndex.linePtr = linePtr; curIndex.byteIndex = 0;
+ for (segPtr = linePtr->segPtr, leftToScan = byteIndex;
+ leftToScan > 0;
+ curIndex.byteIndex += segPtr->size, segPtr = segPtr->nextPtr) {
+ if ((segPtr->typePtr == &tkTextCharType) &&
+ (searchSpecPtr->searchElide
+ || !TkTextIsElided(textPtr, &curIndex, NULL))) {
+ if (leftToScan < segPtr->size) {
+ if (searchSpecPtr->exact) {
+ index += leftToScan;
+ } else {
+ index += Tcl_NumUtfChars(segPtr->body.chars, leftToScan);
+ }
+ } else if (searchSpecPtr->exact) {
+ index += segPtr->size;
+ } else {
+ index += Tcl_NumUtfChars(segPtr->body.chars, -1);
+ }
+ }
+ leftToScan -= segPtr->size;
+ }
+ return index;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextSearchAddNextLine --
+ *
+ * Adds a line from the text widget to the object 'theLine'.
+ *
+ * Results:
+ * A pointer to the TkTextLine corresponding to the given line, or NULL
+ * if there was no available line.
+ *
+ * Also 'lenPtr' (if non-NULL) is filled in with the total length of
+ * 'theLine' (not just what we added to it, but the length including what
+ * was already in there). This is in bytes for an exact search and in
+ * chars for a regexp search.
+ *
+ * Also 'extraLinesPtr' (if non-NULL) will have its value incremented by
+ * 1 for each additional logical line we have added because a newline is
+ * elided (this will only ever happen if we have chosen not to search
+ * elided text, of course).
+ *
+ * Side effects:
+ * Memory may be allocated or re-allocated for theLine's string
+ * representation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static ClientData
+TextSearchAddNextLine(
+ int lineNum, /* Line we must add. */
+ SearchSpec *searchSpecPtr, /* Search parameters. */
+ Tcl_Obj *theLine, /* Object to append to. */
+ int *lenPtr, /* For returning the total length. */
+ int *extraLinesPtr) /* If non-NULL, will have its value
+ * incremented by the number of additional
+ * logical lines which are merged into this
+ * one by newlines being elided. */
+{
+ TkTextLine *linePtr, *thisLinePtr;
+ TkTextIndex curIndex;
+ TkTextSegment *segPtr;
+ TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+ int nothingYet = 1;
+
+ /*
+ * Extract the text from the line.
+ */
+
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr, lineNum);
+ if (linePtr == NULL) {
+ return NULL;
+ }
+ curIndex.tree = textPtr->sharedTextPtr->tree;
+ thisLinePtr = linePtr;
+
+ while (thisLinePtr != NULL) {
+ int elideWraps = 0;
+
+ curIndex.linePtr = thisLinePtr;
+ curIndex.byteIndex = 0;
+ for (segPtr = thisLinePtr->segPtr; segPtr != NULL;
curIndex.byteIndex += segPtr->size, segPtr = segPtr->nextPtr) {
- if ((segPtr->typePtr != &tkTextCharType)
- || (!searchElide && TkTextIsElided(textPtr, &curIndex))) {
+ if (!searchSpecPtr->searchElide
+ && TkTextIsElided(textPtr, &curIndex, NULL)) {
+ /*
+ * If we reach the end of the logical line, and if we have at
+ * least one character in the string, then we continue
+ * wrapping to the next logical line. If there are no
+ * characters yet, then the entire line of characters is
+ * elided and there's no need to complicate matters by
+ * wrapping - we'll look at the next line in due course.
+ */
+
+ if (segPtr->nextPtr == NULL && !nothingYet) {
+ elideWraps = 1;
+ }
+ continue;
+ }
+ if (segPtr->typePtr != &tkTextCharType) {
continue;
}
- Tcl_DStringAppend(&line, segPtr->body.chars, segPtr->size);
+ Tcl_AppendToObj(theLine, segPtr->body.chars, segPtr->size);
+ nothingYet = 0;
+ }
+ if (!elideWraps) {
+ break;
}
- if (!exact) {
- Tcl_DStringSetLength(&line, Tcl_DStringLength(&line)-1);
+ lineNum++;
+ if (lineNum >= searchSpecPtr->numLines) {
+ break;
}
- startOfLine = Tcl_DStringValue(&line);
+ thisLinePtr = TkBTreeNextLine(textPtr, thisLinePtr);
+ if (thisLinePtr != NULL && extraLinesPtr != NULL) {
+ /*
+ * Tell our caller we have an extra line merged in.
+ */
- /*
- * If we're ignoring case, convert the line to lower case.
- */
+ *extraLinesPtr = (*extraLinesPtr) + 1;
+ }
+ }
- if (noCase) {
- Tcl_DStringSetLength(&line,
- Tcl_UtfToLower(Tcl_DStringValue(&line)));
+ /*
+ * If we're ignoring case, convert the line to lower case. There is no
+ * need to do this for regexp searches, since they handle a flag for this
+ * purpose.
+ */
+
+ if (searchSpecPtr->exact && searchSpecPtr->noCase) {
+ Tcl_SetObjLength(theLine, Tcl_UtfToLower(Tcl_GetString(theLine)));
+ }
+
+ if (lenPtr != NULL) {
+ if (searchSpecPtr->exact) {
+ Tcl_GetStringFromObj(theLine, lenPtr);
+ } else {
+ *lenPtr = Tcl_GetCharLength(theLine);
}
+ }
+ return (ClientData)linePtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextSearchFoundMatch --
+ *
+ * Stores information from a successful search.
+ *
+ * Results:
+ * 1 if the information was stored, 0 if the position at which the match
+ * was found actually falls outside the allowable search region (and
+ * therefore the search is actually complete).
+ *
+ * Side effects:
+ * Memory may be allocated in the 'countPtr' and 'resPtr' fields of
+ * 'searchSpecPtr'. Each of those objects will have refCount zero and
+ * must eventually be freed or stored elsewhere as appropriate.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TextSearchFoundMatch(
+ int lineNum, /* Line on which match was found. */
+ SearchSpec *searchSpecPtr, /* Search parameters. */
+ ClientData clientData, /* Token returned by the 'addNextLineProc',
+ * TextSearchAddNextLine. May be NULL, in
+ * which we case we must generate it (from
+ * lineNum). */
+ Tcl_Obj *theLine, /* Text from current line, only accessed for
+ * exact searches, and is allowed to be NULL
+ * for regexp searches. */
+ int matchOffset, /* Offset of found item in utf-8 bytes for
+ * exact search, Unicode chars for regexp. */
+ int matchLength) /* Length also in bytes/chars as per search
+ * type. */
+{
+ int numChars;
+ int leftToScan;
+ TkTextIndex curIndex, foundIndex;
+ TkTextSegment *segPtr;
+ TkTextLine *linePtr;
+ TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+ if (lineNum == searchSpecPtr->stopLine) {
/*
- * Check for matches within the current line. If so, and if we're
- * searching backwards, repeat the search to find the last match
- * in the line. (Note: The lastByte should include the NULL char
- * so we can handle searching for end of line easier.)
+ * If the current index is on the wrong side of the stopIndex, then
+ * the item we just found is actually outside the acceptable range,
+ * and the search is over.
*/
- matchByte = -1;
- firstByte = 0;
- lastByte = Tcl_DStringLength(&line) + 1;
- if (lineNum == startingLine) {
- int indexInDString;
+ if (searchSpecPtr->backwards ^
+ (matchOffset >= searchSpecPtr->stopOffset)) {
+ return 0;
+ }
+ }
- /*
- * The starting line is tricky: the first time we see it
- * we check one part of the line, and the second pass through
- * we check the other part of the line. We have to be very
- * careful here because there could be embedded windows or
- * other things that are not in the extracted line. Rescan
- * the original line to compute the index in it of the first
- * character.
- */
+ /*
+ * Calculate the character count, which may need augmenting if there are
+ * embedded windows or elidden text.
+ */
+
+ if (searchSpecPtr->exact) {
+ CONST char *startOfLine = Tcl_GetString(theLine);
+
+ numChars = Tcl_NumUtfChars(startOfLine + matchOffset, matchLength);
+ } else {
+ numChars = matchLength;
+ }
- indexInDString = startingByte;
- for (segPtr = linePtr->segPtr, leftToScan = startingByte;
- leftToScan > 0; segPtr = segPtr->nextPtr) {
- if (segPtr->typePtr != &tkTextCharType) {
- indexInDString -= segPtr->size;
+ /*
+ * If we're using strict limits checking, ensure that the match with its
+ * full length fits inside the given range.
+ */
+
+ if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) {
+ if (searchSpecPtr->backwards ^
+ ((matchOffset + numChars) > searchSpecPtr->stopOffset)) {
+ return 0;
+ }
+ }
+
+ /*
+ * The index information returned by the regular expression parser only
+ * considers textual information: it doesn't account for embedded windows,
+ * elided text (when we are not searching elided text) or any other
+ * non-textual info. Scan through the line's segments again to adjust both
+ * matchChar and matchCount.
+ *
+ * We will walk through the segments of this line until we have either
+ * reached the end of the match or we have reached the end of the line.
+ */
+
+ linePtr = (TkTextLine *)clientData;
+ if (linePtr == NULL) {
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
+ lineNum);
+ }
+
+ curIndex.tree = textPtr->sharedTextPtr->tree;
+
+ /*
+ * Find the starting point.
+ */
+
+ leftToScan = matchOffset;
+ while (1) {
+ curIndex.linePtr = linePtr;
+ curIndex.byteIndex = 0;
+
+ /*
+ * Note that we allow leftToScan to be zero because we want to skip
+ * over any preceding non-textual items.
+ */
+
+ for (segPtr = linePtr->segPtr; leftToScan >= 0 && segPtr;
+ segPtr = segPtr->nextPtr) {
+ if (segPtr->typePtr != &tkTextCharType) {
+ matchOffset += segPtr->size;
+ } else if (!searchSpecPtr->searchElide
+ && TkTextIsElided(textPtr, &curIndex, NULL)) {
+ if (searchSpecPtr->exact) {
+ matchOffset += segPtr->size;
+ } else {
+ matchOffset += Tcl_NumUtfChars(segPtr->body.chars, -1);
}
+ } else {
leftToScan -= segPtr->size;
}
+ curIndex.byteIndex += segPtr->size;
+ }
+ if (segPtr == NULL && leftToScan >= 0) {
+ /*
+ * This will only happen if we are eliding newlines.
+ */
- passes++;
- if ((passes == 1) ^ backwards) {
+ linePtr = TkBTreeNextLine(textPtr, linePtr);
+ if (linePtr == NULL) {
/*
- * Only use the last part of the line.
+ * If we reach the end of the text, we have a serious problem,
+ * unless there's actually nothing left to look for.
*/
- firstByte = indexInDString;
- if ((firstByte >= Tcl_DStringLength(&line))
- && !((Tcl_DStringLength(&line) == 0) && !exact)) {
- goto nextLine;
+ if (leftToScan == 0) {
+ break;
+ } else {
+ Tcl_Panic("Reached end of text in a match");
}
- } else {
- /*
- * Use only the first part of the line.
- */
-
- lastByte = indexInDString;
}
+
+ /*
+ * We've wrapped to the beginning of the next logical line, which
+ * has been merged with the previous one whose newline was elided.
+ */
+
+ lineNum++;
+ matchOffset = 0;
+ } else {
+ break;
}
- do {
- int thisLength;
- Tcl_UniChar ch;
+ }
- if (exact) {
- p = strstr(startOfLine + firstByte, /* INTL: Native. */
- pattern);
- if (p == NULL) {
- break;
- }
- i = p - startOfLine;
- thisLength = patLength;
- } else {
- CONST char *start, *end;
- int match;
+ /*
+ * Calculate and store the found index in the result.
+ */
- match = Tcl_RegExpExec(interp, regexp,
- startOfLine + firstByte, startOfLine);
- if (match < 0) {
- code = TCL_ERROR;
- goto done;
- }
- if (!match) {
- break;
- }
- Tcl_RegExpRange(regexp, 0, &start, &end);
- i = start - startOfLine;
- thisLength = end - start;
- }
- if (i >= lastByte) {
- break;
- }
- matchByte = i;
- matchLength = thisLength;
- firstByte = i + Tcl_UtfToUniChar(startOfLine + matchByte, &ch);
- } while (backwards);
+ if (searchSpecPtr->exact) {
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, lineNum,
+ matchOffset, &foundIndex);
+ } else {
+ TkTextMakeCharIndex(textPtr->sharedTextPtr->tree, textPtr, lineNum,
+ matchOffset, &foundIndex);
+ }
- /*
- * If we found a match then we're done. Make sure that
- * the match occurred before the stopping index, if one was
- * specified.
- */
+ if (searchSpecPtr->all) {
+ if (searchSpecPtr->resPtr == NULL) {
+ searchSpecPtr->resPtr = Tcl_NewObj();
+ }
+ Tcl_ListObjAppendElement(NULL, searchSpecPtr->resPtr,
+ TkTextNewIndexObj(textPtr, &foundIndex));
+ } else {
+ searchSpecPtr->resPtr = TkTextNewIndexObj(textPtr, &foundIndex);
+ }
- if (matchByte >= 0) {
- int numChars;
+ /*
+ * Find the end point. Here 'leftToScan' could be negative already as a
+ * result of the above loop if the segment we reached spanned the start of
+ * the string. When we add matchLength it will become non-negative.
+ */
+ for (leftToScan += matchLength; leftToScan > 0;
+ curIndex.byteIndex += segPtr->size, segPtr = segPtr->nextPtr) {
+ if (segPtr == NULL) {
/*
- * Convert the byte length to a character count.
+ * We are on the next line - this of course should only ever
+ * happen with searches which have matched across multiple lines.
*/
- numChars = Tcl_NumUtfChars(startOfLine + matchByte,
- matchLength);
-
+ linePtr = TkBTreeNextLine(textPtr, linePtr);
+ segPtr = linePtr->segPtr;
+ curIndex.linePtr = linePtr; curIndex.byteIndex = 0;
+ }
+ if (segPtr->typePtr != &tkTextCharType) {
/*
- * The index information returned by the regular expression
- * parser only considers textual information: it doesn't
- * account for embedded windows, elided text (when we are not
- * searching elided text) or any other non-textual info.
- * Scan through the line's segments again to adjust both
- * matchChar and matchCount.
- *
- * We will walk through the segments of this line until we have
- * either reached the end of the match or we have reached the end
- * of the line.
+ * Anything we didn't count in the search needs adding.
*/
- curIndex.linePtr = linePtr; curIndex.byteIndex = 0;
- for (segPtr = linePtr->segPtr, leftToScan = matchByte;
- leftToScan >= 0 && segPtr; segPtr = segPtr->nextPtr) {
- if (segPtr->typePtr != &tkTextCharType || \
- (!searchElide && TkTextIsElided(textPtr, &curIndex))) {
- matchByte += segPtr->size;
- } else {
- leftToScan -= segPtr->size;
- }
- curIndex.byteIndex += segPtr->size;
- }
- for (leftToScan += matchLength; leftToScan > 0;
- segPtr = segPtr->nextPtr) {
- if (segPtr->typePtr != &tkTextCharType) {
- numChars += segPtr->size;
- continue;
- }
- leftToScan -= segPtr->size;
- }
- TkTextMakeByteIndex(textPtr->tree, lineNum, matchByte, &index);
- if (!searchWholeText) {
- if (!backwards && (TkTextIndexCmp(&index, &stopIndex) >= 0)) {
- goto done;
- }
- if (backwards && (TkTextIndexCmp(&index, &stopIndex) < 0)) {
- goto done;
- }
- }
- if (varName != NULL) {
- sprintf(buffer, "%d", numChars);
- if (Tcl_SetVar(interp, varName, buffer, TCL_LEAVE_ERR_MSG)
- == NULL) {
- code = TCL_ERROR;
- goto done;
- }
- }
- TkTextPrintIndex(&index, buffer);
- Tcl_SetResult(interp, buffer, TCL_VOLATILE);
- goto done;
+ numChars += segPtr->size;
+ continue;
+ } else if (!searchSpecPtr->searchElide
+ && TkTextIsElided(textPtr, &curIndex, NULL)) {
+ numChars += Tcl_NumUtfChars(segPtr->body.chars, -1);
+ continue;
+ }
+ if (searchSpecPtr->exact) {
+ leftToScan -= segPtr->size;
+ } else {
+ leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1);
}
+ }
- /*
- * Go to the next (or previous) line;
- */
+ /*
+ * Now store the count result, if it is wanted.
+ */
- nextLine:
- if (backwards) {
- lineNum--;
- if (!searchWholeText) {
- if (lineNum < stopLine) {
- break;
- }
- } else if (lineNum < 0) {
- lineNum = numLines-1;
+ if (searchSpecPtr->varPtr != NULL) {
+ Tcl_Obj *tmpPtr = Tcl_NewIntObj(numChars);
+ if (searchSpecPtr->all) {
+ if (searchSpecPtr->countPtr == NULL) {
+ searchSpecPtr->countPtr = Tcl_NewObj();
}
+ Tcl_ListObjAppendElement(NULL, searchSpecPtr->countPtr, tmpPtr);
} else {
- lineNum++;
- if (!searchWholeText) {
- if (lineNum > stopLine) {
- break;
- }
- } else if (lineNum >= numLines) {
- lineNum = 0;
- }
+ searchSpecPtr->countPtr = tmpPtr;
}
- Tcl_DStringSetLength(&line, 0);
- }
- done:
- Tcl_DStringFree(&line);
- if (noCase && exact) {
- Tcl_DStringFree(&patDString);
}
- if (patObj != NULL) {
- Tcl_DecrRefCount(patObj);
- }
- return code;
+ return 1;
}
/*
@@ -2403,105 +4252,158 @@ TextSearchCmd(textPtr, interp, argc, argv)
* Parses a string description of a set of tab stops.
*
* Results:
- * The return value is a pointer to a malloc'ed structure holding
- * parsed information about the tab stops. If an error occurred
- * then the return value is NULL and an error message is left in
- * the interp's result.
+ * The return value is a pointer to a malloc'ed structure holding parsed
+ * information about the tab stops. If an error occurred then the return
+ * value is NULL and an error message is left in the interp's result.
*
* Side effects:
- * Memory is allocated for the structure that is returned. It is
- * up to the caller to free this structure when it is no longer
- * needed.
+ * Memory is allocated for the structure that is returned. It is up to
+ * the caller to free this structure when it is no longer needed.
*
*----------------------------------------------------------------------
*/
TkTextTabArray *
-TkTextGetTabs(interp, tkwin, string)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Window tkwin; /* Window in which the tabs will be
- * used. */
- char *string; /* Description of the tab stops. See
- * the text manual entry for details. */
+TkTextGetTabs(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ TkText *textPtr, /* Information about the text widget. */
+ Tcl_Obj *stringPtr) /* Description of the tab stops. See the text
+ * manual entry for details. */
{
- int argc, i, count, c;
- CONST char **argv;
+ int objc, i, count;
+ Tcl_Obj **objv;
TkTextTabArray *tabArrayPtr;
TkTextTab *tabPtr;
Tcl_UniChar ch;
+ double prevStop, lastStop;
+ /*
+ * Map these strings to TkTextTabAlign values.
+ */
+ static CONST char *tabOptionStrings[] = {
+ "left", "right", "center", "numeric", NULL
+ };
- if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
+ if (Tcl_ListObjGetElements(interp, stringPtr, &objc, &objv) != TCL_OK) {
return NULL;
}
/*
- * First find out how many entries we need to allocate in the
- * tab array.
+ * First find out how many entries we need to allocate in the tab array.
*/
count = 0;
- for (i = 0; i < argc; i++) {
- c = argv[i][0];
+ for (i = 0; i < objc; i++) {
+ char c = Tcl_GetString(objv[i])[0];
if ((c != 'l') && (c != 'r') && (c != 'c') && (c != 'n')) {
count++;
}
}
/*
- * Parse the elements of the list one at a time to fill in the
- * array.
+ * Parse the elements of the list one at a time to fill in the array.
*/
tabArrayPtr = (TkTextTabArray *) ckalloc((unsigned)
(sizeof(TkTextTabArray) + (count-1)*sizeof(TkTextTab)));
tabArrayPtr->numTabs = 0;
- for (i = 0, tabPtr = &tabArrayPtr->tabs[0]; i < argc; i++, tabPtr++) {
- if (Tk_GetPixels(interp, tkwin, argv[i], &tabPtr->location)
- != TCL_OK) {
+ prevStop = 0.0;
+ lastStop = 0.0;
+ for (i = 0, tabPtr = &tabArrayPtr->tabs[0]; i < objc; i++, tabPtr++) {
+ int index;
+
+ /*
+ * This will round fractional pixels above 0.5 upwards, and otherwise
+ * downwards, to find the right integer pixel position.
+ */
+
+ if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[i],
+ &tabPtr->location) != TCL_OK) {
goto error;
}
+
+ if (tabPtr->location <= 0) {
+ Tcl_AppendResult(interp, "tab stop \"", Tcl_GetString(objv[i]),
+ "\" is not at a positive distance", NULL);
+ goto error;
+ }
+
+ prevStop = lastStop;
+ if (Tk_GetDoublePixelsFromObj (interp, textPtr->tkwin, objv[i],
+ &lastStop) != TCL_OK) {
+ goto error;
+ }
+
+ if (i > 0 && (tabPtr->location <= (tabPtr-1)->location)) {
+ /*
+ * This tab is actually to the left of the previous one, which is
+ * illegal.
+ */
+
+#ifdef _TK_ALLOW_DECREASING_TABS
+ /*
+ * Force the tab to be a typical character width to the right of
+ * the previous one, and update the 'lastStop' with the changed
+ * position.
+ */
+
+ if (textPtr->charWidth > 0) {
+ tabPtr->location = (tabPtr-1)->location + textPtr->charWidth;
+ } else {
+ tabPtr->location = (tabPtr-1)->location + 8;
+ }
+ lastStop = tabPtr->location;
+#else
+ Tcl_AppendResult(interp,
+ "tabs must be monotonically increasing, but \"",
+ Tcl_GetString(objv[i]),
+ "\" is smaller than or equal to the previous tab",
+ NULL);
+ goto error;
+#endif /* _TK_ALLOW_DECREASING_TABS */
+ }
+
tabArrayPtr->numTabs++;
/*
- * See if there is an explicit alignment in the next list
- * element. Otherwise just use "left".
+ * See if there is an explicit alignment in the next list element.
+ * Otherwise just use "left".
*/
tabPtr->alignment = LEFT;
- if ((i+1) == argc) {
+ if ((i+1) == objc) {
continue;
}
- Tcl_UtfToUniChar(argv[i+1], &ch);
+
+ /*
+ * There may be a more efficient way of getting this.
+ */
+
+ Tcl_UtfToUniChar(Tcl_GetString(objv[i+1]), &ch);
if (!Tcl_UniCharIsAlpha(ch)) {
continue;
}
i += 1;
- c = argv[i][0];
- if ((c == 'l') && (strncmp(argv[i], "left",
- strlen(argv[i])) == 0)) {
- tabPtr->alignment = LEFT;
- } else if ((c == 'r') && (strncmp(argv[i], "right",
- strlen(argv[i])) == 0)) {
- tabPtr->alignment = RIGHT;
- } else if ((c == 'c') && (strncmp(argv[i], "center",
- strlen(argv[i])) == 0)) {
- tabPtr->alignment = CENTER;
- } else if ((c == 'n') && (strncmp(argv[i],
- "numeric", strlen(argv[i])) == 0)) {
- tabPtr->alignment = NUMERIC;
- } else {
- Tcl_AppendResult(interp, "bad tab alignment \"",
- argv[i], "\": must be left, right, center, or numeric",
- (char *) NULL);
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], tabOptionStrings,
+ "tab alignment", 0, &index) != TCL_OK) {
goto error;
}
+ tabPtr->alignment = ((TkTextTabAlign)index);
}
- ckfree((char *) argv);
+
+ /*
+ * For when we need to interpolate tab stops, store these two so we know
+ * the tab stop size to very high precision. With the above checks, we can
+ * guarantee that tabIncrement is strictly positive here.
+ */
+
+ tabArrayPtr->lastTab = lastStop;
+ tabArrayPtr->tabIncrement = lastStop - prevStop;
+
return tabArrayPtr;
- error:
+ error:
ckfree((char *) tabArrayPtr);
- ckfree((char *) argv);
return NULL;
}
@@ -2511,8 +4413,8 @@ TkTextGetTabs(interp, tkwin, string)
* TextDumpCmd --
*
* Return information about the text, tags, marks, and embedded windows
- * and images in a text widget. See the man page for the description
- * of the text dump operation for all the details.
+ * and images in a text widget. See the man page for the description of
+ * the text dump operation for all the details.
*
* Results:
* A standard Tcl result.
@@ -2525,21 +4427,21 @@ TkTextGetTabs(interp, tkwin, string)
*/
static int
-TextDumpCmd(textPtr, interp, argc, argv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TextDumpCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "dump". */
+ * objv[1] is "dump". */
{
TkTextIndex index1, index2;
int arg;
- int lineno; /* Current line number */
- int what = 0; /* bitfield to select segment types */
- int atEnd; /* True if dumping up to logical end */
+ int lineno; /* Current line number. */
+ int what = 0; /* bitfield to select segment types. */
+ int atEnd; /* True if dumping up to logical end. */
TkTextLine *linePtr;
- CONST char *command = NULL; /* Script callback to apply to segments */
+ Tcl_Obj *command = NULL; /* Script callback to apply to segments. */
#define TK_DUMP_TEXT 0x1
#define TK_DUMP_MARK 0x2
#define TK_DUMP_TAG 0x4
@@ -2547,116 +4449,189 @@ TextDumpCmd(textPtr, interp, argc, argv)
#define TK_DUMP_IMG 0x10
#define TK_DUMP_ALL (TK_DUMP_TEXT|TK_DUMP_MARK|TK_DUMP_TAG| \
TK_DUMP_WIN|TK_DUMP_IMG)
-
- for (arg=2 ; argv[arg] != (char *) NULL ; arg++) {
- size_t len;
- if (argv[arg][0] != '-') {
+ static CONST char *optStrings[] = {
+ "-all", "-command", "-image", "-mark", "-tag", "-text", "-window",
+ NULL
+ };
+ enum opts {
+ DUMP_ALL, DUMP_CMD, DUMP_IMG, DUMP_MARK, DUMP_TAG, DUMP_TXT, DUMP_WIN
+ };
+
+ for (arg=2 ; arg < objc ; arg++) {
+ int index;
+ if (Tcl_GetString(objv[arg])[0] != '-') {
break;
}
- len = strlen(argv[arg]);
- if (strncmp("-all", argv[arg], len) == 0) {
+ if (Tcl_GetIndexFromObj(interp, objv[arg], optStrings, "option", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch ((enum opts) index) {
+ case DUMP_ALL:
what = TK_DUMP_ALL;
- } else if (strncmp("-text", argv[arg], len) == 0) {
+ break;
+ case DUMP_TXT:
what |= TK_DUMP_TEXT;
- } else if (strncmp("-tag", argv[arg], len) == 0) {
+ break;
+ case DUMP_TAG:
what |= TK_DUMP_TAG;
- } else if (strncmp("-mark", argv[arg], len) == 0) {
+ break;
+ case DUMP_MARK:
what |= TK_DUMP_MARK;
- } else if (strncmp("-image", argv[arg], len) == 0) {
+ break;
+ case DUMP_IMG:
what |= TK_DUMP_IMG;
- } else if (strncmp("-window", argv[arg], len) == 0) {
+ break;
+ case DUMP_WIN:
what |= TK_DUMP_WIN;
- } else if (strncmp("-command", argv[arg], len) == 0) {
+ break;
+ case DUMP_CMD:
arg++;
- if (arg >= argc) {
- Tcl_AppendResult(interp, "Usage: ", argv[0], " dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?", NULL);
+ if (arg >= objc) {
+ Tcl_AppendResult(interp, "Usage: ", Tcl_GetString(objv[0]),
+ " dump ?-all -image -text -mark -tag -window? ",
+ "?-command script? index ?index2?", NULL);
return TCL_ERROR;
}
- command = argv[arg];
- } else {
- Tcl_AppendResult(interp, "Usage: ", argv[0], " dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?", NULL);
- return TCL_ERROR;
+ command = objv[arg];
+ break;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
}
}
- if (arg >= argc) {
- Tcl_AppendResult(interp, "Usage: ", argv[0], " dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?", NULL);
+ if (arg >= objc || arg+2 < objc) {
+ Tcl_AppendResult(interp, "Usage: ", Tcl_GetString(objv[0]),
+ " dump ?-all -image -text -mark -tag -window? ",
+ "?-command script? index ?index2?", NULL);
return TCL_ERROR;
}
if (what == 0) {
what = TK_DUMP_ALL;
}
- if (TkTextGetIndex(interp, textPtr, argv[arg], &index1) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index1) != TCL_OK) {
return TCL_ERROR;
}
- lineno = TkBTreeLineIndex(index1.linePtr);
arg++;
atEnd = 0;
- if (argc == arg) {
- TkTextIndexForwChars(&index1, 1, &index2);
+ if (objc == arg) {
+ TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES);
} else {
- if (TkTextGetIndex(interp, textPtr, argv[arg], &index2) != TCL_OK) {
+ int length;
+ char *str;
+
+ if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
return TCL_ERROR;
}
- if (strncmp(argv[arg], "end", strlen(argv[arg])) == 0) {
+ str = Tcl_GetStringFromObj(objv[arg], &length);
+ if (strncmp(str, "end", (unsigned)length) == 0) {
atEnd = 1;
}
}
if (TkTextIndexCmp(&index1, &index2) >= 0) {
return TCL_OK;
}
+ lineno = TkBTreeLinesTo(textPtr, index1.linePtr);
if (index1.linePtr == index2.linePtr) {
DumpLine(interp, textPtr, what, index1.linePtr,
- index1.byteIndex, index2.byteIndex, lineno, command);
+ index1.byteIndex, index2.byteIndex, lineno, command);
} else {
- DumpLine(interp, textPtr, what, index1.linePtr,
+ int textChanged;
+ int lineend = TkBTreeLinesTo(textPtr, index2.linePtr);
+ int endByteIndex = index2.byteIndex;
+
+ textChanged = DumpLine(interp, textPtr, what, index1.linePtr,
index1.byteIndex, 32000000, lineno, command);
- linePtr = index1.linePtr;
- while ((linePtr = TkBTreeNextLine(linePtr)) != (TkTextLine *)NULL) {
+ if (textChanged) {
+ if (textPtr->flags & DESTROYED) {
+ return TCL_OK;
+ }
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ textPtr, lineno);
+ textChanged = 0;
+ } else {
+ linePtr = index1.linePtr;
+ }
+ while ((linePtr = TkBTreeNextLine(textPtr, linePtr)) != NULL) {
lineno++;
- if (linePtr == index2.linePtr) {
+ if (lineno == lineend) {
break;
}
- DumpLine(interp, textPtr, what, linePtr, 0, 32000000,
+ textChanged = DumpLine(interp, textPtr, what, linePtr, 0, 32000000,
lineno, command);
+ if (textChanged) {
+ if (textPtr->flags & DESTROYED) {
+ return TCL_OK;
+ }
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ textPtr, lineno);
+ textChanged = 0;
+ }
+ }
+ if (linePtr != NULL) {
+ DumpLine(interp, textPtr, what, linePtr, 0, endByteIndex, lineno,
+ command);
+ if (textPtr->flags & DESTROYED) {
+ return TCL_OK;
+ }
}
- DumpLine(interp, textPtr, what, index2.linePtr, 0,
- index2.byteIndex, lineno, command);
}
+
/*
* Special case to get the leftovers hiding at the end mark.
*/
+
if (atEnd) {
- DumpLine(interp, textPtr, what & ~TK_DUMP_TEXT, index2.linePtr,
- 0, 1, lineno, command);
+ if (textPtr->flags & DESTROYED) {
+ return TCL_OK;
+ }
+
+ /*
+ * Re-get the end index, in case it has changed.
+ */
+ if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ DumpLine(interp, textPtr, what & ~TK_DUMP_TEXT, index2.linePtr,
+ 0, 1, lineno, command);
}
return TCL_OK;
}
/*
+ *----------------------------------------------------------------------
+ *
* DumpLine
- * Return information about a given text line from character
- * position "start" up to, but not including, "end".
+ *
+ * Return information about a given text line from character position
+ * "start" up to, but not including, "end".
*
* Results:
- * A standard Tcl result.
+ * Returns 1 if the command callback made any changes to the text widget
+ * which will have invalidated internal structures such as TkTextSegment,
+ * TkTextIndex, pointers. Our caller can then take action to recompute
+ * such entities. Returns 0 otherwise.
*
* Side effects:
- * None, but see DumpSegment.
+ * None, but see DumpSegment which can have arbitrary side-effects
+ *
+ *----------------------------------------------------------------------
*/
-static void
-DumpLine(interp, textPtr, what, linePtr, startByte, endByte, lineno, command)
- Tcl_Interp *interp;
- TkText *textPtr;
- int what; /* bit flags to select segment types */
- TkTextLine *linePtr; /* The current line */
- int startByte, endByte; /* Byte range to dump */
- int lineno; /* Line number for indices dump */
- CONST char *command; /* Script to apply to the segment */
+
+static int
+DumpLine(
+ Tcl_Interp *interp,
+ TkText *textPtr,
+ int what, /* Bit flags to select segment types. */
+ TkTextLine *linePtr, /* The current line. */
+ int startByte, int endByte, /* Byte range to dump. */
+ int lineno, /* Line number for indices dump. */
+ Tcl_Obj *command) /* Script to apply to the segment. */
{
- int offset;
- TkTextSegment *segPtr, *nextPtr;
+ TkTextSegment *segPtr;
TkTextIndex index;
+ int offset = 0, textChanged = 0;
+
/*
* Must loop through line looking at its segments.
* character
@@ -2666,335 +4641,485 @@ DumpLine(interp, textPtr, what, linePtr, startByte, endByte, lineno, command)
* window
*/
- for (offset = 0, segPtr = linePtr->segPtr ;
- (offset < endByte) && (segPtr != (TkTextSegment *)NULL) ;
- offset += segPtr->size, segPtr = nextPtr) {
- nextPtr = segPtr->nextPtr;
+ segPtr = linePtr->segPtr;
+ while ((offset < endByte) && (segPtr != NULL)) {
+ int lineChanged = 0;
+ int currentSize = segPtr->size;
+
if ((what & TK_DUMP_TEXT) && (segPtr->typePtr == &tkTextCharType) &&
- (offset + segPtr->size > startByte)) {
- char savedChar; /* Last char used in the seg */
- int last = segPtr->size; /* Index of savedChar */
- int first = 0; /* Index of first char in seg */
- if (offset + segPtr->size > endByte) {
+ (offset + currentSize > startByte)) {
+ int last = currentSize; /* Index of last char in seg. */
+ int first = 0; /* Index of first char in seg. */
+
+ if (offset + currentSize > endByte) {
last = endByte - offset;
}
if (startByte > offset) {
first = startByte - offset;
}
- savedChar = segPtr->body.chars[last];
- segPtr->body.chars[last] = '\0';
-
- TkTextMakeByteIndex(textPtr->tree, lineno, offset + first, &index);
- DumpSegment(interp, "text", segPtr->body.chars + first,
- command, &index, what);
- segPtr->body.chars[last] = savedChar;
+ if (last != currentSize) {
+ /*
+ * To avoid modifying the string in place we copy over just
+ * the segment that we want. Since DumpSegment can modify the
+ * text, we could not confidently revert the modification
+ * here.
+ */
+
+ int length = last - first;
+ char *range = ckalloc((length + 1) * sizeof(char));
+
+ memcpy(range, segPtr->body.chars + first,
+ length * sizeof(char));
+ range[length] = '\0';
+
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineno, offset + first, &index);
+ lineChanged = DumpSegment(textPtr, interp, "text", range,
+ command, &index, what);
+ ckfree(range);
+ } else {
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineno, offset + first, &index);
+ lineChanged = DumpSegment(textPtr, interp, "text",
+ segPtr->body.chars + first, command, &index, what);
+ }
} else if ((offset >= startByte)) {
if ((what & TK_DUMP_MARK) && (segPtr->typePtr->name[0] == 'm')) {
- TkTextMark *markPtr = (TkTextMark *)&segPtr->body;
- char *name = Tcl_GetHashKey(&textPtr->markTable, markPtr->hPtr);
-
- TkTextMakeByteIndex(textPtr->tree, lineno, offset, &index);
- DumpSegment(interp, "mark", name, command, &index, what);
+ char *name;
+ TkTextMark *markPtr = (TkTextMark *) &segPtr->body;
+
+ if (segPtr == textPtr->insertMarkPtr) {
+ name = "insert";
+ } else if (segPtr == textPtr->currentMarkPtr) {
+ name = "current";
+ } else if (markPtr->hPtr == NULL) {
+ name = NULL;
+ lineChanged = 0;
+ } else {
+ name = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ markPtr->hPtr);
+ }
+ if (name != NULL) {
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineno, offset, &index);
+ lineChanged = DumpSegment(textPtr, interp, "mark", name,
+ command, &index, what);
+ }
} else if ((what & TK_DUMP_TAG) &&
- (segPtr->typePtr == &tkTextToggleOnType)) {
- TkTextMakeByteIndex(textPtr->tree, lineno, offset, &index);
- DumpSegment(interp, "tagon",
- segPtr->body.toggle.tagPtr->name,
- command, &index, what);
- } else if ((what & TK_DUMP_TAG) &&
- (segPtr->typePtr == &tkTextToggleOffType)) {
- TkTextMakeByteIndex(textPtr->tree, lineno, offset, &index);
- DumpSegment(interp, "tagoff",
- segPtr->body.toggle.tagPtr->name,
- command, &index, what);
- } else if ((what & TK_DUMP_IMG) &&
- (segPtr->typePtr->name[0] == 'i')) {
+ (segPtr->typePtr == &tkTextToggleOnType)) {
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineno, offset, &index);
+ lineChanged = DumpSegment(textPtr, interp, "tagon",
+ segPtr->body.toggle.tagPtr->name, command, &index,
+ what);
+ } else if ((what & TK_DUMP_TAG) &&
+ (segPtr->typePtr == &tkTextToggleOffType)) {
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineno, offset, &index);
+ lineChanged = DumpSegment(textPtr, interp, "tagoff",
+ segPtr->body.toggle.tagPtr->name, command, &index,
+ what);
+ } else if ((what & TK_DUMP_IMG) &&
+ (segPtr->typePtr->name[0] == 'i')) {
TkTextEmbImage *eiPtr = (TkTextEmbImage *)&segPtr->body;
- char *name = (eiPtr->name == NULL) ? "" : eiPtr->name;
- TkTextMakeByteIndex(textPtr->tree, lineno, offset, &index);
- DumpSegment(interp, "image", name,
+ char *name = (eiPtr->name == NULL) ? "" : eiPtr->name;
+
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineno, offset, &index);
+ lineChanged = DumpSegment(textPtr, interp, "image", name,
command, &index, what);
- } else if ((what & TK_DUMP_WIN) &&
- (segPtr->typePtr->name[0] == 'w')) {
+ } else if ((what & TK_DUMP_WIN) &&
+ (segPtr->typePtr->name[0] == 'w')) {
TkTextEmbWindow *ewPtr = (TkTextEmbWindow *)&segPtr->body;
char *pathname;
+
if (ewPtr->tkwin == (Tk_Window) NULL) {
pathname = "";
} else {
pathname = Tk_PathName(ewPtr->tkwin);
}
- TkTextMakeByteIndex(textPtr->tree, lineno, offset, &index);
- DumpSegment(interp, "window", pathname,
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineno, offset, &index);
+ lineChanged = DumpSegment(textPtr, interp, "window", pathname,
command, &index, what);
}
}
- if (nextPtr != segPtr->nextPtr) {
+ offset += currentSize;
+ if (lineChanged) {
+ TkTextSegment *newSegPtr;
+ int newOffset = 0;
+
+ textChanged = 1;
+
/*
- * Someone modified the text widget while we were dumping.
- * Just stop dumping. [Bug 1414171]
+ * Our indices are no longer valid.
*/
- break;
+
+ if (textPtr->flags & DESTROYED) {
+ return textChanged;
+ }
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ textPtr, lineno);
+ newSegPtr = linePtr->segPtr;
+ if (segPtr == newSegPtr) {
+ segPtr = segPtr->nextPtr;
+ } else {
+ while ((newOffset < endByte) && (newOffset < offset)
+ && (newSegPtr != NULL)) {
+ newOffset += currentSize;
+ newSegPtr = newSegPtr->nextPtr;
+ if (segPtr == newSegPtr) {
+ break;
+ }
+ }
+ if (segPtr != newSegPtr && newOffset == offset
+ && currentSize == 0) {
+ TkTextSegment *searchPtr = newSegPtr;
+
+ while (searchPtr != NULL && searchPtr->size == 0) {
+ if (searchPtr == segPtr) {
+ newSegPtr = searchPtr;
+ break;
+ }
+ searchPtr = searchPtr->nextPtr;
+ }
+ }
+ segPtr = newSegPtr;
+ if (segPtr != NULL) {
+ segPtr = segPtr->nextPtr;
+ }
+ }
+ } else {
+ segPtr = segPtr->nextPtr;
}
}
+ return textChanged;
}
/*
+ *----------------------------------------------------------------------
+ *
* DumpSegment
- * Either append information about the current segment to the result,
- * or make a script callback with that information as arguments.
+ *
+ * Either append information about the current segment to the result, or
+ * make a script callback with that information as arguments.
*
* Results:
- * None
+ * Returns 1 if the command callback made any changes to the text widget
+ * which will have invalidated internal structures such as TkTextSegment,
+ * TkTextIndex, pointers. Our caller can then take action to recompute
+ * such entities. Returns 0 otherwise.
*
* Side effects:
* Either evals the callback or appends elements to the result string.
+ * The callback can have arbitrary side-effects.
+ *
+ *----------------------------------------------------------------------
*/
+
static int
-DumpSegment(interp, key, value, command, index, what)
- Tcl_Interp *interp;
- char *key; /* Segment type key */
- char *value; /* Segment value */
- CONST char *command; /* Script callback */
- TkTextIndex *index; /* index with line/byte position info */
- int what; /* Look for TK_DUMP_INDEX bit */
+DumpSegment(
+ TkText *textPtr,
+ Tcl_Interp *interp,
+ CONST char *key, /* Segment type key. */
+ CONST char *value, /* Segment value. */
+ Tcl_Obj *command, /* Script callback. */
+ CONST TkTextIndex *index, /* index with line/byte position info. */
+ int what) /* Look for TK_DUMP_INDEX bit. */
{
- char buffer[TCL_INTEGER_SPACE*2];
- TkTextPrintIndex(index, buffer);
+ char buffer[TK_POS_CHARS];
+
+ TkTextPrintIndex(textPtr, index, buffer);
if (command == NULL) {
Tcl_AppendElement(interp, key);
Tcl_AppendElement(interp, value);
Tcl_AppendElement(interp, buffer);
- return TCL_OK;
+ return 0;
} else {
CONST char *argv[4];
char *list;
- int result;
+ int oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree);
+
argv[0] = key;
argv[1] = value;
argv[2] = buffer;
argv[3] = NULL;
list = Tcl_Merge(3, argv);
- result = Tcl_VarEval(interp, command, " ", list, (char *) NULL);
+ Tcl_VarEval(interp, Tcl_GetString(command), " ", list, NULL);
ckfree(list);
- return result;
+ if ((textPtr->flags & DESTROYED) ||
+ TkBTreeEpoch(textPtr->sharedTextPtr->tree) != oldStateEpoch) {
+ return 1;
+ } else {
+ return 0;
+ }
}
}
/*
+ *----------------------------------------------------------------------
+ *
* TextEditUndo --
- * undo the last change.
+ *
+ * Undo the last change.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * Apart from manipulating the undo and redo stacks, the state of the
+ * rest of the widget may also change (due to whatever is being undone).
+ *
+ *----------------------------------------------------------------------
*/
static int
-TextEditUndo(textPtr)
- TkText *textPtr; /* Overall information about text widget. */
+TextEditUndo(
+ TkText *textPtr) /* Overall information about text widget. */
{
int status;
- if (!textPtr->undo) {
+ if (!textPtr->sharedTextPtr->undo) {
return TCL_OK;
}
- /* Turn off the undo feature */
- textPtr->undo = 0;
+ /*
+ * Turn off the undo feature while we revert a compound action, setting
+ * the dirty handling mode to undo for the duration (unless it is
+ * 'fixed').
+ */
- /* Set dirty mode to undo, unless it is fixed */
- if (textPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
- textPtr->dirtyMode = TK_TEXT_DIRTY_UNDO;
+ textPtr->sharedTextPtr->undo = 0;
+ if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
+ textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_UNDO;
}
- /* revert one compound action */
- status = TkUndoRevert(textPtr->undoStack);
+ status = TkUndoRevert(textPtr->sharedTextPtr->undoStack);
- /* Restore dirty mode */
- if (textPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
- textPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
+ if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
+ textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
}
-
- /* Turn back on the undo feature */
- textPtr->undo = 1;
+ textPtr->sharedTextPtr->undo = 1;
return status;
}
/*
+ *----------------------------------------------------------------------
+ *
* TextEditRedo --
- * redo the last undone change.
+ *
+ * Redo the last undone change.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * Apart from manipulating the undo and redo stacks, the state of the
+ * rest of the widget may also change (due to whatever is being redone).
+ *
+ *----------------------------------------------------------------------
*/
static int
-TextEditRedo(textPtr)
- TkText *textPtr; /* Overall information about text widget. */
+TextEditRedo(
+ TkText *textPtr) /* Overall information about text widget. */
{
int status;
- if (!textPtr->undo) {
+ if (!textPtr->sharedTextPtr->undo) {
return TCL_OK;
}
- /* Turn off the undo feature temporarily */
- textPtr->undo = 0;
+ /*
+ * Turn off the undo feature temporarily while we revert a previously
+ * undone compound action, setting the dirty handling mode to redo for the
+ * duration (unless it is 'fixed').
+ */
- /* Set dirty mode to redo, unless it is fixed */
- if (textPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
- textPtr->dirtyMode = TK_TEXT_DIRTY_REDO;
+ textPtr->sharedTextPtr->undo = 0;
+ if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
+ textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_REDO;
}
- /* reapply one compound action */
- status = TkUndoApply(textPtr->undoStack);
+ status = TkUndoApply(textPtr->sharedTextPtr->undoStack);
- /* Restore dirty mode */
- if (textPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
- textPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
+ if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) {
+ textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
}
-
- /* Turn back on the undo feature */
- textPtr->undo = 1;
-
+ textPtr->sharedTextPtr->undo = 1;
return status;
}
/*
+ *----------------------------------------------------------------------
+ *
* TextEditCmd --
*
- * Handle the subcommands to "$text edit ...".
- * See documentation for details.
+ * Handle the subcommands to "$text edit ...". See documentation for
+ * details.
*
* Results:
- * None
+ * None
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
static int
-TextEditCmd(textPtr, interp, argc, argv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TextEditCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- int c;
- size_t length;
+ int index;
- if (argc < 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " edit option ?arg arg ...?\"", (char *) NULL);
+ static CONST char *editOptionStrings[] = {
+ "modified", "redo", "reset", "separator", "undo", NULL
+ };
+ enum editOptions {
+ EDIT_MODIFIED, EDIT_REDO, EDIT_RESET, EDIT_SEPARATOR, EDIT_UNDO
+ };
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
- c = argv[2][0];
- length = strlen(argv[2]);
- if ((c == 'm') && (strncmp(argv[2], "modified", length) == 0)) {
- if (argc == 3) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(textPtr->isDirty));
- } else if (argc != 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " edit modified ?boolean?\"", (char *) NULL);
+
+ if (Tcl_GetIndexFromObj(interp, objv[2], editOptionStrings,
+ "edit option", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ switch ((enum editOptions) index) {
+ case EDIT_MODIFIED:
+ if (objc == 3) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj(textPtr->sharedTextPtr->isDirty));
+ } else if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "?boolean?");
return TCL_ERROR;
} else {
- int setModified, wasModified = textPtr->isDirty;
+ int setModified, oldModified;
- if (Tcl_GetBoolean(interp, argv[3], &setModified) != TCL_OK) {
+ if (Tcl_GetBooleanFromObj(interp, objv[3],
+ &setModified) != TCL_OK) {
return TCL_ERROR;
}
/*
- * Set or reset the dirty info, and trigger a Modified event (.
+ * Set or reset the dirty info, and trigger a Modified event.
*/
setModified = setModified ? 1 : 0;
- textPtr->isDirty = setModified;
+ oldModified = textPtr->sharedTextPtr->isDirty;
+ textPtr->sharedTextPtr->isDirty = setModified;
if (setModified) {
- textPtr->dirtyMode = TK_TEXT_DIRTY_FIXED;
+ textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_FIXED;
} else {
- textPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
+ textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
}
- if ((!wasModified) != (!setModified)) {
+
+ /*
+ * Only issue the <<Modified>> event if the flag actually changed.
+ * However, degree of modified-ness doesn't matter. [Bug 1799782]
+ */
+
+ if ((!oldModified) != (!setModified)) {
GenerateModifiedEvent(textPtr);
}
- }
- } else if ((c == 'r') && (strncmp(argv[2], "redo", length) == 0)
- && (length >= 3)) {
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " edit redo\"", (char *) NULL);
+ }
+ break;
+ case EDIT_REDO:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- if ( TextEditRedo(textPtr) ) {
- Tcl_AppendResult(interp, "nothing to redo", (char *) NULL);
+ if (TextEditRedo(textPtr)) {
+ Tcl_AppendResult(interp, "nothing to redo", NULL);
return TCL_ERROR;
- }
- } else if ((c == 'r') && (strncmp(argv[2], "reset", length) == 0)
- && (length >= 3)) {
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " edit reset\"", (char *) NULL);
+ }
+ break;
+ case EDIT_RESET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- TkUndoClearStacks(textPtr->undoStack);
- } else if ((c == 's') && (strncmp(argv[2], "separator", length) == 0)) {
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " edit separator\"", (char *) NULL);
+ TkUndoClearStacks(textPtr->sharedTextPtr->undoStack);
+ break;
+ case EDIT_SEPARATOR:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- TkUndoInsertUndoSeparator(textPtr->undoStack);
- } else if ((c == 'u') && (strncmp(argv[2], "undo", length) == 0)) {
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " edit undo\"", (char *) NULL);
+ TkUndoInsertUndoSeparator(textPtr->sharedTextPtr->undoStack);
+ break;
+ case EDIT_UNDO:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- if ( TextEditUndo(textPtr) ) {
- Tcl_AppendResult(interp, "nothing to undo",
- (char *) NULL);
+ if (TextEditUndo(textPtr)) {
+ Tcl_AppendResult(interp, "nothing to undo", NULL);
return TCL_ERROR;
- }
- } else {
- Tcl_AppendResult(interp, "bad edit option \"", argv[2],
- "\": must be modified, redo, reset, separator or undo",
- (char *) NULL);
- return TCL_ERROR;
+ }
+ break;
}
-
return TCL_OK;
}
/*
+ *----------------------------------------------------------------------
+ *
* TextGetText --
- * Returns the text from indexPtr1 to indexPtr2, placing that text
- * in the Tcl_DString given. That DString should be free or uninitialized.
+ *
+ * Returns the text from indexPtr1 to indexPtr2, placing that text in a
+ * string object which is returned with a refCount of zero.
+ *
+ * Since the amount of text may potentially be several megabytes (e.g.
+ * in text editors built on the text widget), efficiency is very
+ * important. We may want to investigate the efficiency of the
+ * Tcl_AppendToObj more carefully (e.g. if we know we are going to be
+ * appending several thousand lines, we could attempt to pre-allocate a
+ * larger space).
+ *
+ * Also the result is built up as a utf-8 string, but, if we knew we
+ * wanted it as Unicode, we could potentially save a huge conversion by
+ * building it up as Unicode directly. This could be as simple as
+ * replacing Tcl_NewObj by Tcl_NewUnicodeObj.
*
* Results:
- * None.
+ * Tcl_Obj of string type containing the specified text. If the
+ * visibleOnly flag is set to 1, then only those characters which are not
+ * elided will be returned. Otherwise (flag is 0) all characters in the
+ * given range are returned.
*
* Side effects:
- * Memory will be allocated for the DString. Remember to free it.
+ * Memory will be allocated for the new object. Remember to free it if it
+ * isn't going to be stored appropriately.
+ *
+ *----------------------------------------------------------------------
*/
-static void
-TextGetText(indexPtr1,indexPtr2, dsPtr)
- TkTextIndex *indexPtr1;
- TkTextIndex *indexPtr2;
- Tcl_DString *dsPtr;
+static Tcl_Obj *
+TextGetText(
+ CONST TkText *textPtr, /* Information about text widget. */
+ CONST TkTextIndex *indexPtr1,
+ /* Get text from this index... */
+ CONST TkTextIndex *indexPtr2,
+ /* ...to this index. */
+ int visibleOnly) /* If non-zero, then only return non-elided
+ * characters. */
{
TkTextIndex tmpIndex;
- Tcl_DStringInit(dsPtr);
-
- TkTextMakeByteIndex(indexPtr1->tree, TkBTreeLineIndex(indexPtr1->linePtr),
+ Tcl_Obj *resultPtr = Tcl_NewObj();
+
+ TkTextMakeByteIndex(indexPtr1->tree, textPtr,
+ TkBTreeLinesTo(textPtr, indexPtr1->linePtr),
indexPtr1->byteIndex, &tmpIndex);
if (TkTextIndexCmp(indexPtr1, indexPtr2) < 0) {
@@ -3005,26 +5130,38 @@ TextGetText(indexPtr1,indexPtr2, dsPtr)
segPtr = TkTextIndexToSeg(&tmpIndex, &offset);
last = segPtr->size;
if (tmpIndex.linePtr == indexPtr2->linePtr) {
- int last2;
+ /*
+ * The last line that was requested must be handled carefully,
+ * because we may need to break out of this loop in the middle
+ * of the line.
+ */
if (indexPtr2->byteIndex == tmpIndex.byteIndex) {
break;
- }
- last2 = indexPtr2->byteIndex - tmpIndex.byteIndex + offset;
- if (last2 < last) {
- last = last2;
+ } else {
+ int last2 = indexPtr2->byteIndex - tmpIndex.byteIndex
+ + offset;
+
+ if (last2 < last) {
+ last = last2;
+ }
}
}
if (segPtr->typePtr == &tkTextCharType) {
- Tcl_DStringAppend(dsPtr, segPtr->body.chars + offset,
- last - offset);
+ if (!visibleOnly || !TkTextIsElided(textPtr,&tmpIndex,NULL)) {
+ Tcl_AppendToObj(resultPtr, segPtr->body.chars + offset,
+ last - offset);
+ }
}
- TkTextIndexForwBytes(&tmpIndex, last-offset, &tmpIndex);
+ TkTextIndexForwBytes(textPtr, &tmpIndex, last-offset, &tmpIndex);
}
}
+ return resultPtr;
}
/*
+ *----------------------------------------------------------------------
+ *
* GenerateModifiedEvent --
*
* Send an event that the text was modified. This is equivalent to
@@ -3035,68 +5172,1464 @@ TextGetText(indexPtr1,indexPtr2, dsPtr)
*
* Side effects:
* May force the text window into existence.
+ *
+ *----------------------------------------------------------------------
*/
static void
GenerateModifiedEvent(
TkText *textPtr) /* Information about text widget. */
{
- XEvent event;
+ union {XEvent general; XVirtualEvent virtual;} event;
Tk_MakeWindowExist(textPtr->tkwin);
memset(&event, 0, sizeof(event));
- event.xany.type = VirtualEvent;
- event.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
- event.xany.send_event = False;
- event.xany.window = Tk_WindowId(textPtr->tkwin);
- event.xany.display = Tk_Display(textPtr->tkwin);
- ((XVirtualEvent *) &event)->name = Tk_GetUid("Modified");
- Tk_HandleEvent(&event);
+ event.general.xany.type = VirtualEvent;
+ event.general.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
+ event.general.xany.send_event = False;
+ event.general.xany.window = Tk_WindowId(textPtr->tkwin);
+ event.general.xany.display = Tk_Display(textPtr->tkwin);
+ event.virtual.name = Tk_GetUid("Modified");
+ Tk_HandleEvent(&event.general);
}
/*
- * updateDirtyFlag --
- * updates the dirtyness of the text widget
+ *----------------------------------------------------------------------
+ *
+ * UpdateDirtyFlag --
+ *
+ * Updates the dirtyness of the text widget
*
* Results:
- * None
+ * None
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
static void
-updateDirtyFlag(textPtr)
- TkText *textPtr; /* Information about text widget. */
+UpdateDirtyFlag(
+ TkSharedText *sharedTextPtr)/* Information about text widget. */
{
int oldDirtyFlag;
+ TkText *textPtr;
+
+ /*
+ * If we've been forced to be dirty, we stay dirty (until explicitly
+ * reset, of course).
+ */
+
+ if (sharedTextPtr->dirtyMode == TK_TEXT_DIRTY_FIXED) {
+ return;
+ }
+
+ if (sharedTextPtr->isDirty < 0
+ && sharedTextPtr->dirtyMode == TK_TEXT_DIRTY_NORMAL) {
+ /*
+ * If dirty flag is negative, only redo operations can make it zero
+ * again. If we do a normal operation, it can never become zero any
+ * more (other than by explicit reset).
+ */
- if (textPtr->dirtyMode == TK_TEXT_DIRTY_FIXED) {
+ sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_FIXED;
return;
}
+ oldDirtyFlag = sharedTextPtr->isDirty;
+ if (sharedTextPtr->dirtyMode == TK_TEXT_DIRTY_UNDO) {
+ sharedTextPtr->isDirty--;
+ } else {
+ sharedTextPtr->isDirty++;
+ }
+
+ if (sharedTextPtr->isDirty == 0 || oldDirtyFlag == 0) {
+ for (textPtr = sharedTextPtr->peers; textPtr != NULL;
+ textPtr = textPtr->next) {
+ GenerateModifiedEvent(textPtr);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SearchPerform --
+ *
+ * Overall control of search process. Is given a pattern, a starting
+ * index and an ending index, and attempts to perform a search. This
+ * function is actually completely independent of Tk, and could in the
+ * future be split off.
+ *
+ * Results:
+ * Standard Tcl result code. In particular, if fromPtr or toPtr are not
+ * considered valid by the 'lineIndexProc', an error will be thrown and
+ * no search performed.
+ *
+ * Side effects:
+ * See 'SearchCore'.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+SearchPerform(
+ Tcl_Interp *interp, /* For error messages. */
+ SearchSpec *searchSpecPtr, /* Search parameters. */
+ Tcl_Obj *patObj, /* Contains an exact string or a regexp
+ * pattern. Must have a refCount > 0. */
+ Tcl_Obj *fromPtr, /* Contains information describing the first
+ * index. */
+ Tcl_Obj *toPtr) /* NULL or information describing the last
+ * index. */
+{
/*
- * If dirty flag is negative, only redo operations can make it zero again.
- * If we do a normal operation, it can never become zero anymore.
+ * Find the starting line and starting offset (measured in Unicode chars
+ * for regexp search, utf-8 bytes for exact search).
*/
- if (textPtr->isDirty < 0 && textPtr->dirtyMode == TK_TEXT_DIRTY_NORMAL) {
- textPtr->dirtyMode = TK_TEXT_DIRTY_FIXED;
- return;
+
+ if ((*searchSpecPtr->lineIndexProc)(interp, fromPtr, searchSpecPtr,
+ &searchSpecPtr->startLine,
+ &searchSpecPtr->startOffset) != TCL_OK) {
+ return TCL_ERROR;
}
- oldDirtyFlag = textPtr->isDirty;
+ /*
+ * Find the optional end location, similarly.
+ */
- switch (textPtr->dirtyMode) {
- case TK_TEXT_DIRTY_UNDO:
- textPtr->isDirty--;
- break;
- default:
- textPtr->isDirty++;
- break;
+ if (toPtr != NULL) {
+ CONST TkTextIndex *indexToPtr, *indexFromPtr;
+ TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+
+ indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr);
+ if (indexToPtr == NULL) {
+ return TCL_ERROR;
+ }
+ indexFromPtr = TkTextGetIndexFromObj(interp, textPtr, fromPtr);
+
+ /*
+ * Check for any empty search range here. It might be better in the
+ * future to embed that in SearchCore (whose default behaviour is to
+ * wrap when given a negative search range).
+ */
+
+ if (searchSpecPtr->backwards) {
+ if (TkTextIndexCmp(indexFromPtr, indexToPtr) == -1) {
+ return TCL_OK;
+ }
+ } else {
+ if (TkTextIndexCmp(indexFromPtr, indexToPtr) == 1) {
+ return TCL_OK;
+ }
+ }
+
+ if ((*searchSpecPtr->lineIndexProc)(interp, toPtr, searchSpecPtr,
+ &searchSpecPtr->stopLine,
+ &searchSpecPtr->stopOffset) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ } else {
+ searchSpecPtr->stopLine = -1;
}
- if (textPtr->isDirty == 0 || oldDirtyFlag == 0) {
- GenerateModifiedEvent(textPtr);
+ /*
+ * Scan through all of the lines of the text circularly, starting at the
+ * given index. 'patObj' is the pattern which may be an exact string or a
+ * regexp pattern depending on the flags in searchSpecPtr.
+ */
+
+ return SearchCore(interp, searchSpecPtr, patObj);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SearchCore --
+ *
+ * The core of the search function. This function is actually completely
+ * independent of Tk, and could in the future be split off.
+ *
+ * The function assumes regexp-based searches operate on Unicode strings,
+ * and exact searches on utf-8 strings. Therefore the 'foundMatchProc'
+ * and 'addLineProc' need to be aware of this distinction.
+ *
+ * Results:
+ * Standard Tcl result code.
+ *
+ * Side effects:
+ * Only those of the 'searchSpecPtr->foundMatchProc' which is called
+ * whenever a match is found.
+ *
+ * Note that the way matching across multiple lines is implemented, we
+ * start afresh with each line we have available, even though we may
+ * already have examined the contents of that line (and further ones) if
+ * we were attempting a multi-line match using the previous line. This
+ * means there may be ways to speed this up a lot by not throwing away
+ * all the multi-line information one has accumulated. Profiling should
+ * be done to see where the bottlenecks lie before attempting this,
+ * however. We would also need to be very careful such optimisation keep
+ * within the specified search bounds.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+SearchCore(
+ Tcl_Interp *interp, /* For error messages. */
+ SearchSpec *searchSpecPtr, /* Search parameters. */
+ Tcl_Obj *patObj) /* Contains an exact string or a regexp
+ * pattern. Must have a refCount > 0. */
+{
+ /*
+ * For exact searches these are utf-8 char* offsets, for regexp searches
+ * they are Unicode char offsets.
+ */
+
+ int firstOffset, lastOffset, matchOffset, matchLength;
+ int passes;
+ int lineNum = searchSpecPtr->startLine;
+ int code = TCL_OK;
+ Tcl_Obj *theLine;
+ int alreadySearchOffset = -1;
+
+ CONST char *pattern = NULL; /* For exact searches only. */
+ int firstNewLine = -1; /* For exact searches only. */
+ Tcl_RegExp regexp = NULL; /* For regexp searches only. */
+
+ /*
+ * These items are for backward regexp searches only. They are for two
+ * purposes: to allow us to report backwards matches in the correct order,
+ * even though the implementation uses repeated forward searches; and to
+ * provide for overlap checking between backwards matches on different
+ * text lines.
+ */
+
+#define LOTS_OF_MATCHES 20
+ int matchNum = LOTS_OF_MATCHES;
+ int smArray[2 * LOTS_OF_MATCHES];
+ int *storeMatch = smArray;
+ int *storeLength = smArray + LOTS_OF_MATCHES;
+ int lastBackwardsLineMatch = -1;
+ int lastBackwardsMatchOffset = -1;
+
+ if (searchSpecPtr->exact) {
+ /*
+ * Convert the pattern to lower-case if we're supposed to ignore case.
+ */
+
+ if (searchSpecPtr->noCase) {
+ patObj = Tcl_DuplicateObj(patObj);
+
+ /*
+ * This can change the length of the string behind the object's
+ * back, so ensure it is correctly synchronised.
+ */
+
+ Tcl_SetObjLength(patObj, Tcl_UtfToLower(Tcl_GetString(patObj)));
+ }
+ } else {
+ /*
+ * Compile the regular expression. We want '^$' to match after and
+ * before \n respectively, so use the TCL_REG_NLANCH flag.
+ */
+
+ regexp = Tcl_GetRegExpFromObj(interp, patObj,
+ (searchSpecPtr->noCase ? TCL_REG_NOCASE : 0)
+ | (searchSpecPtr->noLineStop ? 0 : TCL_REG_NLSTOP)
+ | TCL_REG_ADVANCED | TCL_REG_CANMATCH | TCL_REG_NLANCH);
+ if (regexp == NULL) {
+ return TCL_ERROR;
+ }
}
+
+ /*
+ * For exact strings, we want to know where the first newline is, and we
+ * will also use this as a flag to test whether it is even possible to
+ * match the pattern on a single line. If not we will have to search
+ * across multiple lines.
+ */
+
+ if (searchSpecPtr->exact) {
+ CONST char *nl;
+
+ /*
+ * We only need to set the matchLength once for exact searches, and we
+ * do it here. It is also used below as the actual pattern length, so
+ * it has dual purpose.
+ */
+
+ pattern = Tcl_GetStringFromObj(patObj, &matchLength);
+ nl = strchr(pattern, '\n');
+
+ /*
+ * If there is no newline, or it is the very end of the string, then
+ * we don't need any special treatment, since single-line matching
+ * will work fine.
+ */
+
+ if (nl != NULL && nl[1] != '\0') {
+ firstNewLine = (nl - pattern);
+ }
+ } else {
+ matchLength = 0; /* Only needed to prevent compiler warnings. */
+ }
+
+ /*
+ * Keep a reference here, so that we can be sure the object doesn't
+ * disappear behind our backs and invalidate its contents which we are
+ * using.
+ */
+
+ Tcl_IncrRefCount(patObj);
+
+ /*
+ * For building up the current line being checked.
+ */
+
+ theLine = Tcl_NewObj();
+ Tcl_IncrRefCount(theLine);
+
+ for (passes = 0; passes < 2; ) {
+ ClientData lineInfo;
+ int linesSearched = 1;
+ int extraLinesSearched = 0;
+
+ if (lineNum >= searchSpecPtr->numLines) {
+ /*
+ * Don't search the dummy last line of the text.
+ */
+
+ goto nextLine;
+ }
+
+ /*
+ * Extract the text from the line, storing its length in 'lastOffset'
+ * (in bytes if exact, chars if regexp), since obviously the length is
+ * the maximum offset at which it is possible to find something on
+ * this line, which is what 'lastOffset' represents.
+ */
+
+ lineInfo = (*searchSpecPtr->addLineProc)(lineNum, searchSpecPtr,
+ theLine, &lastOffset, &linesSearched);
+
+ if (lineInfo == NULL) {
+ /*
+ * This should not happen, since 'lineNum' should be valid in the
+ * call above. However, let's try to be flexible and not cause a
+ * crash below.
+ */
+
+ goto nextLine;
+ }
+
+ if (lineNum == searchSpecPtr->stopLine && searchSpecPtr->backwards) {
+ firstOffset = searchSpecPtr->stopOffset;
+ } else {
+ firstOffset = 0;
+ }
+
+ if (alreadySearchOffset != -1) {
+ if (searchSpecPtr->backwards) {
+ if (alreadySearchOffset < lastOffset) {
+ lastOffset = alreadySearchOffset;
+ }
+ } else {
+ if (alreadySearchOffset > firstOffset) {
+ firstOffset = alreadySearchOffset;
+ }
+ }
+ alreadySearchOffset = -1;
+ }
+
+ if (lineNum == searchSpecPtr->startLine) {
+ /*
+ * The starting line is tricky: the first time we see it we check
+ * one part of the line, and the second pass through we check the
+ * other part of the line.
+ */
+
+ passes++;
+ if ((passes == 1) ^ searchSpecPtr->backwards) {
+ /*
+ * Forward search and first pass, or backward search and
+ * second pass.
+ *
+ * Only use the last part of the line.
+ */
+
+ if (searchSpecPtr->startOffset > firstOffset) {
+ firstOffset = searchSpecPtr->startOffset;
+ }
+ if ((firstOffset >= lastOffset)
+ && ((lastOffset != 0) || searchSpecPtr->exact)) {
+ goto nextLine;
+ }
+ } else {
+ /*
+ * Use only the first part of the line.
+ */
+
+ if (searchSpecPtr->startOffset < lastOffset) {
+ lastOffset = searchSpecPtr->startOffset;
+ }
+ }
+ }
+
+ /*
+ * Check for matches within the current line 'lineNum'. If so, and if
+ * we're searching backwards or for all matches, repeat the search
+ * until we find the last match in the line. The 'lastOffset' is one
+ * beyond the last position in the line at which a match is allowed to
+ * begin.
+ */
+
+ matchOffset = -1;
+
+ if (searchSpecPtr->exact) {
+ int maxExtraLines = 0;
+ CONST char *startOfLine = Tcl_GetString(theLine);
+
+ do {
+ Tcl_UniChar ch;
+ CONST char *p;
+ int lastFullLine = lastOffset;
+
+ if (firstNewLine == -1) {
+ if (searchSpecPtr->strictLimits
+ && (firstOffset + matchLength > lastOffset)) {
+ /*
+ * Not enough characters to match.
+ */
+
+ break;
+ }
+
+ /*
+ * Single line matching. We want to scan forwards or
+ * backwards as appropriate.
+ */
+
+ if (searchSpecPtr->backwards) {
+ /*
+ * Search back either from the previous match or from
+ * 'startOfLine + lastOffset - 1' until we find a
+ * match.
+ */
+
+ CONST char c = pattern[0];
+
+ if (alreadySearchOffset != -1) {
+ p = startOfLine + alreadySearchOffset;
+ alreadySearchOffset = -1;
+ } else {
+ p = startOfLine + lastOffset -1;
+ }
+ while (p >= startOfLine + firstOffset) {
+ if (p[0] == c && !strncmp(p, pattern,
+ (unsigned)matchLength)) {
+ goto backwardsMatch;
+ }
+ p--;
+ }
+ break;
+ } else {
+ p = strstr(startOfLine + firstOffset, pattern);
+ }
+ if (p == NULL) {
+ /*
+ * Single line match failed.
+ */
+
+ break;
+ }
+ } else if (firstNewLine >= (lastOffset - firstOffset)) {
+ /*
+ * Multi-line match, but not enough characters to match.
+ */
+
+ break;
+ } else {
+ /*
+ * Multi-line match has only one possible match position,
+ * because we know where the '\n' is.
+ */
+
+ p = startOfLine + lastOffset - firstNewLine - 1;
+ if (strncmp(p, pattern, (unsigned)(firstNewLine + 1))) {
+ /*
+ * No match.
+ */
+
+ break;
+ } else {
+ int extraLines = 1;
+
+ /*
+ * If we find a match that overlaps more than one
+ * line, we will use this value to determine the first
+ * allowed starting offset for the following search
+ * (to avoid overlapping results).
+ */
+
+ int lastTotal = lastOffset;
+ int skipFirst = lastOffset - firstNewLine -1;
+
+ /*
+ * We may be able to match if given more text. The
+ * following 'while' block handles multi-line exact
+ * searches.
+ */
+
+ while (1) {
+ lastFullLine = lastTotal;
+
+ if (lineNum+extraLines>=searchSpecPtr->numLines) {
+ p = NULL;
+ break;
+ }
+
+ /*
+ * Only add the line if we haven't already done so
+ * already.
+ */
+
+ if (extraLines > maxExtraLines) {
+ if ((*searchSpecPtr->addLineProc)(lineNum
+ + extraLines, searchSpecPtr, theLine,
+ &lastTotal, &extraLines) == NULL) {
+ p = NULL;
+ if (!searchSpecPtr->backwards) {
+ extraLinesSearched = extraLines;
+ }
+ break;
+ }
+ maxExtraLines = extraLines;
+ }
+
+ startOfLine = Tcl_GetString(theLine);
+ p = startOfLine + skipFirst;
+
+ /*
+ * Use the fact that 'matchLength = patLength' for
+ * exact searches.
+ */
+
+ if ((lastTotal - skipFirst) >= matchLength) {
+ /*
+ * We now have enough text to match, so we
+ * make a final test and break whatever the
+ * result.
+ */
+
+ if (strncmp(p,pattern,(unsigned)matchLength)) {
+ p = NULL;
+ }
+ break;
+ } else {
+ /*
+ * Not enough text yet, but check the prefix.
+ */
+
+ if (strncmp(p, pattern,
+ (unsigned)(lastTotal - skipFirst))) {
+ p = NULL;
+ break;
+ }
+
+ /*
+ * The prefix matches, so keep looking.
+ */
+ }
+ extraLines++;
+ }
+ /*
+ * If we reach here, with p != NULL, we've found a
+ * multi-line match, else we started a multi-match but
+ * didn't finish it off, so we go to the next line.
+ */
+
+ if (p == NULL) {
+ break;
+ }
+
+ /*
+ * We've found a multi-line match.
+ */
+
+ if (extraLines > 0) {
+ extraLinesSearched = extraLines - 1;
+ }
+ }
+ }
+
+ backwardsMatch:
+ if ((p - startOfLine) >= lastOffset) {
+ break;
+ }
+
+ /*
+ * Remember the match.
+ */
+
+ matchOffset = p - startOfLine;
+
+ if (searchSpecPtr->all &&
+ !(*searchSpecPtr->foundMatchProc)(lineNum,
+ searchSpecPtr, lineInfo, theLine, matchOffset,
+ matchLength)) {
+ /*
+ * We reached the end of the search.
+ */
+
+ goto searchDone;
+ }
+
+ if (!searchSpecPtr->overlap) {
+ if (searchSpecPtr->backwards) {
+ alreadySearchOffset = p - startOfLine;
+ if (firstNewLine != -1) {
+ break;
+ } else {
+ alreadySearchOffset -= matchLength;
+ }
+ } else {
+ firstOffset = p - startOfLine + matchLength;
+ if (firstOffset >= lastOffset) {
+ /*
+ * Now, we have to be careful not to find
+ * overlapping matches either on the same or
+ * following lines. Assume that if we did find
+ * something, it goes until the last extra line we
+ * added.
+ *
+ * We can break out of the loop, since we know no
+ * more will be found.
+ */
+
+ if (!searchSpecPtr->backwards) {
+ alreadySearchOffset =
+ firstOffset - lastFullLine;
+ break;
+ }
+ }
+ }
+ } else {
+ if (searchSpecPtr->backwards) {
+ alreadySearchOffset = p - startOfLine - 1;
+ if (alreadySearchOffset < 0) {
+ break;
+ }
+ } else {
+ firstOffset = p - startOfLine +
+ Tcl_UtfToUniChar(startOfLine+matchOffset,&ch);
+ }
+ }
+ } while (searchSpecPtr->all);
+ } else {
+ int maxExtraLines = 0;
+ int matches = 0;
+ int lastNonOverlap = -1;
+
+ do {
+ Tcl_RegExpInfo info;
+ int match;
+ int lastFullLine = lastOffset;
+
+ match = Tcl_RegExpExecObj(interp, regexp, theLine,
+ firstOffset, 1, (firstOffset>0 ? TCL_REG_NOTBOL : 0));
+ if (match < 0) {
+ code = TCL_ERROR;
+ goto searchDone;
+ }
+ Tcl_RegExpGetInfo(regexp, &info);
+
+ /*
+ * If we don't have a match, or if we do, but it extends to
+ * the end of the line, we must try to add more lines to get a
+ * full greedy match.
+ */
+
+ if (!match ||
+ ((info.extendStart == info.matches[0].start)
+ && (info.matches[0].end == lastOffset-firstOffset))) {
+ int extraLines = 0;
+ int prevFullLine;
+
+ /*
+ * If we find a match that overlaps more than one line, we
+ * will use this value to determine the first allowed
+ * starting offset for the following search (to avoid
+ * overlapping results).
+ */
+
+ int lastTotal = lastOffset;
+
+ if ((lastBackwardsLineMatch != -1)
+ && (lastBackwardsLineMatch == (lineNum + 1))) {
+ lastNonOverlap = lastTotal;
+ }
+
+ if (info.extendStart < 0) {
+ /*
+ * No multi-line match is possible.
+ */
+
+ break;
+ }
+
+ /*
+ * We may be able to match if given more text. The
+ * following 'while' block handles multi-line regexp
+ * searches.
+ */
+
+ while (1) {
+ prevFullLine = lastTotal;
+
+ /*
+ * Move firstOffset to first possible start.
+ */
+
+ if (!match) {
+ firstOffset += info.extendStart;
+ }
+ if (firstOffset >= lastOffset) {
+ /*
+ * We're being told that the only possible new
+ * match is starting after the end of the line.
+ * But, that is the next line which we will handle
+ * when we look at that line.
+ */
+
+ if (!match && !searchSpecPtr->backwards
+ && (firstOffset == 0)) {
+ extraLinesSearched = extraLines;
+ }
+ break;
+ }
+
+ if (lineNum + extraLines >= searchSpecPtr->numLines) {
+ break;
+ }
+
+ /*
+ * Add next line, provided we haven't already done so.
+ */
+
+ if (extraLines > maxExtraLines) {
+ if ((*searchSpecPtr->addLineProc)(lineNum
+ + extraLines, searchSpecPtr, theLine,
+ &lastTotal, &extraLines) == NULL) {
+ /*
+ * There are no more acceptable lines, so we
+ * can say we have searched all of these.
+ */
+
+ if (!match && !searchSpecPtr->backwards) {
+ extraLinesSearched = extraLines;
+ }
+ break;
+ }
+
+ maxExtraLines = extraLines;
+ if ((lastBackwardsLineMatch != -1)
+ && (lastBackwardsLineMatch
+ == (lineNum + extraLines + 1))) {
+ lastNonOverlap = lastTotal;
+ }
+ }
+
+ match = Tcl_RegExpExecObj(interp, regexp, theLine,
+ firstOffset, 1,
+ ((firstOffset > 0) ? TCL_REG_NOTBOL : 0));
+ if (match < 0) {
+ code = TCL_ERROR;
+ goto searchDone;
+ }
+ Tcl_RegExpGetInfo(regexp, &info);
+
+ /*
+ * Unfortunately there are bugs in Tcl's regexp
+ * library, which tells us that info.extendStart is
+ * zero when it should not be (should be -1), which
+ * makes our task a bit more complicated here. We
+ * check if there was a match, and the end of the
+ * match leaves an entire extra line unmatched, then
+ * we stop searching. Clearly it still might sometimes
+ * be possible to add more text and match again, but
+ * Tcl's regexp library doesn't tell us that.
+ *
+ * This means we often add and search one more line
+ * than might be necessary if Tcl were able to give us
+ * a correct value of info.extendStart under all
+ * circumstances.
+ */
+
+ if ((match &&
+ firstOffset+info.matches[0].end != lastTotal &&
+ firstOffset+info.matches[0].end < prevFullLine)
+ || info.extendStart < 0) {
+ break;
+ }
+
+ /*
+ * If there is a match, but that match starts after
+ * the end of the first line, then we'll handle that
+ * next time around, when we're actually looking at
+ * that line.
+ */
+
+ if (match && (info.matches[0].start >= lastOffset)) {
+ break;
+ }
+ if (match && ((firstOffset + info.matches[0].end)
+ >= prevFullLine)) {
+ if (extraLines > 0) {
+ extraLinesSearched = extraLines - 1;
+ }
+ lastFullLine = prevFullLine;
+ }
+
+ /*
+ * The prefix matches, so keep looking.
+ */
+
+ extraLines++;
+ }
+
+ /*
+ * If we reach here with 'match == 1', we've found a
+ * multi-line match, which we will record in the code
+ * which follows directly else we started a multi-line
+ * match but didn't finish it off, so we go to the next
+ * line.
+ */
+
+ if (!match) {
+ /*
+ * Here is where we could perform an optimisation,
+ * since we have already retrieved the contents of the
+ * next line (perhaps many more), so we shouldn't
+ * really throw it all away and start again. This
+ * could be particularly important for complex regexp
+ * searches.
+ *
+ * This 'break' will take us to just before the
+ * 'nextLine:' below.
+ */
+
+ break;
+ }
+
+ if (lastBackwardsLineMatch != -1) {
+ if ((lineNum + linesSearched + extraLinesSearched)
+ == lastBackwardsLineMatch) {
+ /*
+ * Possible overlap or inclusion.
+ */
+
+ int thisOffset = firstOffset + info.matches[0].end
+ - info.matches[0].start;
+
+ if (lastNonOverlap != -1) {
+ /*
+ * Possible overlap or enclosure.
+ */
+
+ if (thisOffset-lastNonOverlap >=
+ lastBackwardsMatchOffset+matchLength){
+ /*
+ * Totally encloses previous match, so
+ * forget the previous match.
+ */
+
+ lastBackwardsLineMatch = -1;
+ } else if ((thisOffset - lastNonOverlap)
+ > lastBackwardsMatchOffset) {
+ /*
+ * Overlap. Previous match is ok, and the
+ * current match is only ok if we are
+ * searching with -overlap.
+ */
+
+ if (searchSpecPtr->overlap) {
+ goto recordBackwardsMatch;
+ } else {
+ match = 0;
+ break;
+ }
+ } else {
+ /*
+ * No overlap, although the same line was
+ * reached.
+ */
+
+ goto recordBackwardsMatch;
+ }
+ } else {
+ /*
+ * No overlap.
+ */
+
+ goto recordBackwardsMatch;
+ }
+ } else if (lineNum+linesSearched+extraLinesSearched
+ < lastBackwardsLineMatch) {
+ /*
+ * No overlap.
+ */
+
+ goto recordBackwardsMatch;
+ } else {
+ /*
+ * Totally enclosed.
+ */
+
+ lastBackwardsLineMatch = -1;
+ }
+ }
+
+ } else {
+ /*
+ * Matched in a single line.
+ */
+
+ if (lastBackwardsLineMatch != -1) {
+ recordBackwardsMatch:
+ (*searchSpecPtr->foundMatchProc)(
+ lastBackwardsLineMatch, searchSpecPtr, NULL,
+ NULL, lastBackwardsMatchOffset, matchLength);
+ lastBackwardsLineMatch = -1;
+ if (!searchSpecPtr->all) {
+ goto searchDone;
+ }
+ }
+ }
+
+ firstOffset += info.matches[0].start;
+ if (firstOffset >= lastOffset) {
+ break;
+ }
+
+ /*
+ * Update our local variables with the match, if we haven't
+ * yet found anything, or if we're doing '-all' or
+ * '-backwards' _and_ this match isn't fully enclosed in the
+ * previous match.
+ */
+
+ if (matchOffset == -1 ||
+ ((searchSpecPtr->all || searchSpecPtr->backwards)
+ && ((firstOffset < matchOffset)
+ || ((firstOffset + info.matches[0].end
+ - info.matches[0].start)
+ > (matchOffset + matchLength))))) {
+
+ matchOffset = firstOffset;
+ matchLength = info.matches[0].end - info.matches[0].start;
+
+ if (searchSpecPtr->backwards) {
+ /*
+ * To get backwards searches in the correct order, we
+ * must store them away here.
+ */
+
+ if (matches == matchNum) {
+ /*
+ * We've run out of space in our normal store, so
+ * we must allocate space for these backwards
+ * matches on the heap.
+ */
+
+ int *newArray = (int *)
+ ckalloc(4 * matchNum * sizeof(int));
+ memcpy(newArray, storeMatch, matchNum*sizeof(int));
+ memcpy(newArray + 2*matchNum, storeLength,
+ matchNum * sizeof(int));
+ if (storeMatch != smArray) {
+ ckfree((char *) storeMatch);
+ }
+ matchNum *= 2;
+ storeMatch = newArray;
+ storeLength = newArray + matchNum;
+ }
+ storeMatch[matches] = matchOffset;
+ storeLength[matches] = matchLength;
+ matches++;
+ } else {
+ /*
+ * Now actually record the match, but only if we are
+ * doing an '-all' search.
+ */
+
+ if (searchSpecPtr->all &&
+ !(*searchSpecPtr->foundMatchProc)(lineNum,
+ searchSpecPtr, lineInfo, theLine, matchOffset,
+ matchLength)) {
+ /*
+ * We reached the end of the search.
+ */
+
+ goto searchDone;
+ }
+ }
+
+ /*
+ * For forward matches, unless we allow overlaps, we move
+ * this on by the length of the current match so that we
+ * explicitly disallow overlapping matches.
+ */
+
+ if (matchLength > 0 && !searchSpecPtr->overlap
+ && !searchSpecPtr->backwards) {
+ firstOffset += matchLength;
+ if (firstOffset >= lastOffset) {
+ /*
+ * Now, we have to be careful not to find
+ * overlapping matches either on the same or
+ * following lines. Assume that if we did find
+ * something, it goes until the last extra line we
+ * added.
+ *
+ * We can break out of the loop, since we know no
+ * more will be found.
+ */
+
+ alreadySearchOffset = firstOffset - lastFullLine;
+ break;
+ }
+
+ /*
+ * We'll add this on again just below.
+ */
+
+ firstOffset --;
+ }
+ }
+
+ /*
+ * Move the starting point on, in case we are doing repeated
+ * or backwards searches (for the latter, we actually do
+ * repeated forward searches).
+ */
+
+ firstOffset++;
+ } while (searchSpecPtr->backwards || searchSpecPtr->all);
+
+ if (matches > 0) {
+ /*
+ * Now we have all the matches in our array, but not stored
+ * with 'foundMatchProc' yet.
+ */
+
+ matches--;
+ matchOffset = storeMatch[matches];
+ matchLength = storeLength[matches];
+ while (--matches >= 0) {
+ if (lineNum == searchSpecPtr->stopLine) {
+ /*
+ * It appears as if a condition like:
+ *
+ * if (storeMatch[matches]<searchSpecPtr->stopOffset)
+ * break;
+ *
+ * might be needed here, but no test case has been
+ * found which would exercise such a problem.
+ */
+ }
+ if (storeMatch[matches] + storeLength[matches]
+ >= matchOffset + matchLength) {
+ /*
+ * The new match totally encloses the previous one, so
+ * we overwrite the previous one.
+ */
+
+ matchOffset = storeMatch[matches];
+ matchLength = storeLength[matches];
+ continue;
+ }
+ if (!searchSpecPtr->overlap) {
+ if (storeMatch[matches] + storeLength[matches]
+ > matchOffset) {
+ continue;
+ }
+ }
+ (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr,
+ lineInfo, theLine, matchOffset, matchLength);
+ if (!searchSpecPtr->all) {
+ goto searchDone;
+ }
+ matchOffset = storeMatch[matches];
+ matchLength = storeLength[matches];
+ }
+ if (searchSpecPtr->all && matches > 0) {
+ /*
+ * We only need to do this for the '-all' case, because
+ * just below we will call the foundMatchProc for the
+ * non-all case.
+ */
+
+ (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr,
+ lineInfo, theLine, matchOffset, matchLength);
+ } else {
+ lastBackwardsLineMatch = lineNum;
+ lastBackwardsMatchOffset = matchOffset;
+ }
+ }
+ }
+
+ /*
+ * If the 'all' flag is set, we will already have stored all matches,
+ * so we just proceed to the next line.
+ *
+ * If not, and there is a match we need to store that information and
+ * we are done.
+ */
+
+ if ((lastBackwardsLineMatch == -1) && (matchOffset >= 0)
+ && !searchSpecPtr->all) {
+ (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr, lineInfo,
+ theLine, matchOffset, matchLength);
+ goto searchDone;
+ }
+
+ /*
+ * Go to the next (or previous) line;
+ */
+
+ nextLine:
+ linesSearched += extraLinesSearched;
+
+ while (linesSearched-- > 0) {
+ /*
+ * If we have just completed the 'stopLine', we are done.
+ */
+
+ if (lineNum == searchSpecPtr->stopLine) {
+ goto searchDone;
+ }
+
+ if (searchSpecPtr->backwards) {
+ lineNum--;
+
+ if (lastBackwardsLineMatch != -1
+ && ((lineNum < 0)
+ || (lineNum + 2 < lastBackwardsLineMatch))) {
+ (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch,
+ searchSpecPtr, NULL, NULL,
+ lastBackwardsMatchOffset, matchLength);
+ lastBackwardsLineMatch = -1;
+ if (!searchSpecPtr->all) {
+ goto searchDone;
+ }
+ }
+
+ if (lineNum < 0) {
+ lineNum = searchSpecPtr->numLines-1;
+ }
+ if (!searchSpecPtr->exact) {
+ /*
+ * The 'exact' search loops above are designed to give us
+ * an accurate picture of the number of lines which we can
+ * skip here. For 'regexp' searches, on the other hand,
+ * which can match potentially variable lengths, we cannot
+ * skip multiple lines when searching backwards. Therefore
+ * we only allow one line to be skipped here.
+ */
+
+ break;
+ }
+ } else {
+ lineNum++;
+ if (lineNum >= searchSpecPtr->numLines) {
+ lineNum = 0;
+ }
+ }
+ if (lineNum == searchSpecPtr->startLine && linesSearched > 0) {
+ /*
+ * We've just searched all the way round and have gone right
+ * through the start line without finding anything in the last
+ * attempt.
+ */
+
+ break;
+ }
+ }
+
+ Tcl_SetObjLength(theLine, 0);
+ }
+ searchDone:
+
+ if (lastBackwardsLineMatch != -1) {
+ (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch, searchSpecPtr,
+ NULL, NULL, lastBackwardsMatchOffset, matchLength);
+ }
+
+ /*
+ * Free up the cached line and pattern.
+ */
+
+ Tcl_DecrRefCount(theLine);
+ Tcl_DecrRefCount(patObj);
+
+ /*
+ * Free up any extra space we allocated.
+ */
+
+ if (storeMatch != smArray) {
+ ckfree((char *) storeMatch);
+ }
+
+ return code;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetLineStartEnd -
+ *
+ * Converts an internal TkTextLine ptr into a Tcl string obj containing
+ * the line number. (Handler for the 'line' configuration option type.)
+ *
+ * Results:
+ * Tcl_Obj containing the string representation of the line value.
+ *
+ * Side effects:
+ * Creates a new Tcl_Obj.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Tcl_Obj *
+GetLineStartEnd(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *recordPtr, /* Pointer to widget record. */
+ int internalOffset) /* Offset within *recordPtr containing the
+ * line value. */
+{
+ TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset);
+
+ if (linePtr == NULL) {
+ return Tcl_NewObj();
+ } else {
+ return Tcl_NewIntObj(1+TkBTreeLinesTo(NULL, linePtr));
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SetLineStartEnd --
+ *
+ * Converts a Tcl_Obj representing a widget's (start or end) line into a
+ * TkTextLine* value. (Handler for the 'line' configuration option type.)
+ *
+ * Results:
+ * Standard Tcl result.
+ *
+ * Side effects:
+ * May store the TkTextLine* value into the internal representation
+ * pointer. May change the pointer to the Tcl_Obj to NULL to indicate
+ * that the specified string was empty and that is acceptable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+SetLineStartEnd(
+ ClientData clientData,
+ Tcl_Interp *interp, /* Current interp; may be used for errors. */
+ Tk_Window tkwin, /* Window for which option is being set. */
+ Tcl_Obj **value, /* Pointer to the pointer to the value object.
+ * We use a pointer to the pointer because we
+ * may need to return a value (NULL). */
+ char *recordPtr, /* Pointer to storage for the widget record. */
+ int internalOffset, /* Offset within *recordPtr at which the
+ * internal value is to be stored. */
+ char *oldInternalPtr, /* Pointer to storage for the old value. */
+ int flags) /* Flags for the option, set Tk_SetOptions. */
+{
+ TkTextLine *linePtr = NULL;
+ char *internalPtr;
+ TkText *textPtr = (TkText *) recordPtr;
+
+ if (internalOffset >= 0) {
+ internalPtr = recordPtr + internalOffset;
+ } else {
+ internalPtr = NULL;
+ }
+
+ if (flags & TK_OPTION_NULL_OK && ObjectIsEmpty(*value)) {
+ *value = NULL;
+ } else {
+ int line;
+
+ if (Tcl_GetIntFromObj(interp, *value, &line) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, NULL, line-1);
+ }
+
+ if (internalPtr != NULL) {
+ *((TkTextLine **) oldInternalPtr) = *((TkTextLine **) internalPtr);
+ *((TkTextLine **) internalPtr) = linePtr;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RestoreLineStartEnd --
+ *
+ * Restore a line option value from a saved value. (Handler for the
+ * 'line' configuration option type.)
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Restores the old value.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RestoreLineStartEnd(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *internalPtr, /* Pointer to storage for value. */
+ char *oldInternalPtr) /* Pointer to old value. */
+{
+ *(TkTextLine **)internalPtr = *(TkTextLine **)oldInternalPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ObjectIsEmpty --
+ *
+ * This function tests whether the string value of an object is empty.
+ *
+ * Results:
+ * The return value is 1 if the string value of objPtr has length zero,
+ * and 0 otherwise.
+ *
+ * Side effects:
+ * May cause object shimmering, since this function can force a
+ * conversion to a string object.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+ObjectIsEmpty(
+ Tcl_Obj *objPtr) /* Object to test. May be NULL. */
+{
+ int length;
+
+ if (objPtr == NULL) {
+ return 1;
+ }
+ if (objPtr->bytes != NULL) {
+ return (objPtr->length == 0);
+ }
+ Tcl_GetStringFromObj(objPtr, &length);
+ return (length == 0);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpTesttextCmd --
+ *
+ * This function implements the "testtext" command. It provides a set of
+ * functions for testing text widgets and the associated functions in
+ * tkText*.c.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Depends on option; see below.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpTesttextCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
+{
+ TkText *textPtr;
+ size_t len;
+ int lineIndex, byteIndex, byteOffset;
+ TkTextIndex index;
+ char buf[64];
+ Tcl_CmdInfo info;
+
+ if (argc < 3) {
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetCommandInfo(interp, argv[1], &info) == 0) {
+ return TCL_ERROR;
+ }
+ if (info.isNativeObjectProc) {
+ textPtr = (TkText *) info.objClientData;
+ } else {
+ textPtr = (TkText *) info.clientData;
+ }
+ len = strlen(argv[2]);
+ if (strncmp(argv[2], "byteindex", len) == 0) {
+ if (argc != 5) {
+ return TCL_ERROR;
+ }
+ lineIndex = atoi(argv[3]) - 1;
+ byteIndex = atoi(argv[4]);
+
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, lineIndex,
+ byteIndex, &index);
+ } else if (strncmp(argv[2], "forwbytes", len) == 0) {
+ if (argc != 5) {
+ return TCL_ERROR;
+ }
+ if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ byteOffset = atoi(argv[4]);
+ TkTextIndexForwBytes(textPtr, &index, byteOffset, &index);
+ } else if (strncmp(argv[2], "backbytes", len) == 0) {
+ if (argc != 5) {
+ return TCL_ERROR;
+ }
+ if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ byteOffset = atoi(argv[4]);
+ TkTextIndexBackBytes(textPtr, &index, byteOffset, &index);
+ } else {
+ return TCL_ERROR;
+ }
+
+ TkTextSetMark(textPtr, "insert", &index);
+ TkTextPrintIndex(textPtr, &index, buf);
+ sprintf(buf + strlen(buf), " %d", index.byteIndex);
+ Tcl_AppendResult(interp, buf, NULL);
+
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkText.h b/generic/tkText.h
index 6331735..289e64b 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -1,14 +1,13 @@
/*
* tkText.h --
*
- * Declarations shared among the files that implement text
- * widgets.
+ * Declarations shared among the files that implement text widgets.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKTEXT
@@ -28,122 +27,142 @@
#endif
/*
- * Opaque types for structures whose guts are only needed by a single
- * file:
+ * Opaque types for structures whose guts are only needed by a single file.
*/
typedef struct TkTextBTree_ *TkTextBTree;
/*
- * The data structure below defines a single line of text (from newline
- * to newline, not necessarily what appears on one line of the screen).
+ * The data structure below defines a single logical line of text (from
+ * newline to newline, not necessarily what appears on one display line of the
+ * screen).
*/
typedef struct TkTextLine {
- struct Node *parentPtr; /* Pointer to parent node containing
- * line. */
- struct TkTextLine *nextPtr; /* Next in linked list of lines with
- * same parent node in B-tree. NULL
- * means end of list. */
- struct TkTextSegment *segPtr; /* First in ordered list of segments
- * that make up the line. */
+ struct Node *parentPtr; /* Pointer to parent node containing line. */
+ struct TkTextLine *nextPtr; /* Next in linked list of lines with same
+ * parent node in B-tree. NULL means end of
+ * list. */
+ struct TkTextSegment *segPtr;
+ /* First in ordered list of segments that make
+ * up the line. */
+ int *pixels; /* Array containing two integers for each
+ * referring text widget. The first of these
+ * is the number of vertical pixels taken up
+ * by this line, whether currently displayed
+ * or not. This number is only updated
+ * asychronously. The second of these is the
+ * last epoch at which the pixel height was
+ * recalculated. */
} TkTextLine;
/*
* -----------------------------------------------------------------------
* Segments: each line is divided into one or more segments, where each
- * segment is one of several things, such as a group of characters, a
- * tag toggle, a mark, or an embedded widget. Each segment starts with
- * a standard header followed by a body that varies from type to type.
+ * segment is one of several things, such as a group of characters, a tag
+ * toggle, a mark, or an embedded widget. Each segment starts with a standard
+ * header followed by a body that varies from type to type.
* -----------------------------------------------------------------------
*/
/*
- * The data structure below defines the body of a segment that represents
- * a tag toggle. There is one of these structures at both the beginning
- * and end of each tagged range.
+ * The data structure below defines the body of a segment that represents a
+ * tag toggle. There is one of these structures at both the beginning and end
+ * of each tagged range.
*/
typedef struct TkTextToggle {
- struct TkTextTag *tagPtr; /* Tag that starts or ends here. */
- int inNodeCounts; /* 1 means this toggle has been
- * accounted for in node toggle
- * counts; 0 means it hasn't, yet. */
+ struct TkTextTag *tagPtr; /* Tag that starts or ends here. */
+ int inNodeCounts; /* 1 means this toggle has been accounted for
+ * in node toggle counts; 0 means it hasn't,
+ * yet. */
} TkTextToggle;
/*
- * The data structure below defines line segments that represent
- * marks. There is one of these for each mark in the text.
+ * The data structure below defines line segments that represent marks. There
+ * is one of these for each mark in the text.
*/
typedef struct TkTextMark {
- struct TkText *textPtr; /* Overall information about text
- * widget. */
- TkTextLine *linePtr; /* Line structure that contains the
- * segment. */
- Tcl_HashEntry *hPtr; /* Pointer to hash table entry for mark
- * (in textPtr->markTable). */
+ struct TkText *textPtr; /* Overall information about text widget. */
+ TkTextLine *linePtr; /* Line structure that contains the
+ * segment. */
+ Tcl_HashEntry *hPtr; /* Pointer to hash table entry for mark (in
+ * sharedTextPtr->markTable). */
} TkTextMark;
/*
* A structure of the following type holds information for each window
- * embedded in a text widget. This information is only used by the
- * file tkTextWind.c
+ * embedded in a text widget. This information is only used by the file
+ * tkTextWind.c
*/
+typedef struct TkTextEmbWindowClient {
+ struct TkText *textPtr; /* Information about the overall text
+ * widget. */
+ Tk_Window tkwin; /* Window for this segment. NULL means that
+ * the window hasn't been created yet. */
+ int chunkCount; /* Number of display chunks that refer to this
+ * window. */
+ int displayed; /* Non-zero means that the window has been
+ * displayed on the screen recently. */
+ struct TkTextSegment *parent;
+ struct TkTextEmbWindowClient *next;
+} TkTextEmbWindowClient;
+
typedef struct TkTextEmbWindow {
- struct TkText *textPtr; /* Information about the overall text
- * widget. */
- TkTextLine *linePtr; /* Line structure that contains this
- * window. */
- Tk_Window tkwin; /* Window for this segment. NULL
- * means that the window hasn't
- * been created yet. */
- char *create; /* Script to create window on-demand.
- * NULL means no such script.
- * Malloc-ed. */
- int align; /* How to align window in vertical
- * space. See definitions in
- * tkTextWind.c. */
- int padX, padY; /* Padding to leave around each side
- * of window, in pixels. */
- int stretch; /* Should window stretch to fill
- * vertical space of line (except for
- * pady)? 0 or 1. */
- int chunkCount; /* Number of display chunks that
- * refer to this window. */
- int displayed; /* Non-zero means that the window
- * has been displayed on the screen
- * recently. */
+ struct TkSharedText *sharedTextPtr;
+ /* Information about the shared portion of the
+ * text widget. */
+ Tk_Window tkwin; /* Window for this segment. This is just a
+ * temporary value, copied from 'clients', to
+ * make option table updating easier. NULL
+ * means that the window hasn't been created
+ * yet. */
+ TkTextLine *linePtr; /* Line structure that contains this
+ * window. */
+ char *create; /* Script to create window on-demand. NULL
+ * means no such script. Malloc-ed. */
+ int align; /* How to align window in vertical space. See
+ * definitions in tkTextWind.c. */
+ int padX, padY; /* Padding to leave around each side of
+ * window, in pixels. */
+ int stretch; /* Should window stretch to fill vertical
+ * space of line (except for pady)? 0 or 1. */
+ Tk_OptionTable optionTable; /* Token representing the configuration
+ * specifications. */
+ TkTextEmbWindowClient *clients;
+ /* Linked list of peer-widget specific
+ * information for this embedded window. */
} TkTextEmbWindow;
/*
- * A structure of the following type holds information for each image
- * embedded in a text widget. This information is only used by the
- * file tkTextImage.c
+ * A structure of the following type holds information for each image embedded
+ * in a text widget. This information is only used by the file tkTextImage.c
*/
typedef struct TkTextEmbImage {
- struct TkText *textPtr; /* Information about the overall text
- * widget. */
- TkTextLine *linePtr; /* Line structure that contains this
- * image. */
- char *imageString; /* Name of the image for this segment */
- char *imageName; /* Name used by text widget to identify
- * this image. May be unique-ified */
- char *name; /* Name used in the hash table.
- * used by "image names" to identify
- * this instance of the image */
- Tk_Image image; /* Image for this segment. NULL
- * means that the image hasn't
- * been created yet. */
- int align; /* How to align image in vertical
- * space. See definitions in
- * tkTextImage.c. */
- int padX, padY; /* Padding to leave around each side
- * of image, in pixels. */
- int chunkCount; /* Number of display chunks that
- * refer to this image. */
+ struct TkSharedText *sharedTextPtr;
+ /* Information about the shared portion of the
+ * text widget. This is used when the image
+ * changes or is deleted. */
+ TkTextLine *linePtr; /* Line structure that contains this image. */
+ char *imageString; /* Name of the image for this segment. */
+ char *imageName; /* Name used by text widget to identify this
+ * image. May be unique-ified. */
+ char *name; /* Name used in the hash table. Used by
+ * "image names" to identify this instance of
+ * the image. */
+ Tk_Image image; /* Image for this segment. NULL means that the
+ * image hasn't been created yet. */
+ int align; /* How to align image in vertical space. See
+ * definitions in tkTextImage.c. */
+ int padX, padY; /* Padding to leave around each side of image,
+ * in pixels. */
+ int chunkCount; /* Number of display chunks that refer to this
+ * image. */
+ Tk_OptionTable optionTable; /* Token representing the configuration
+ * specifications. */
} TkTextEmbImage;
/*
@@ -151,40 +170,43 @@ typedef struct TkTextEmbImage {
*/
typedef struct TkTextSegment {
- struct Tk_SegType *typePtr; /* Pointer to record describing
- * segment's type. */
- struct TkTextSegment *nextPtr; /* Next in list of segments for this
- * line, or NULL for end of list. */
- int size; /* Size of this segment (# of bytes
- * of index space it occupies). */
+ const struct Tk_SegType *typePtr;
+ /* Pointer to record describing segment's
+ * type. */
+ struct TkTextSegment *nextPtr;
+ /* Next in list of segments for this line, or
+ * NULL for end of list. */
+ int size; /* Size of this segment (# of bytes of index
+ * space it occupies). */
union {
- char chars[4]; /* Characters that make up character
- * info. Actual length varies to
- * hold as many characters as needed.*/
- TkTextToggle toggle; /* Information about tag toggle. */
- TkTextMark mark; /* Information about mark. */
- TkTextEmbWindow ew; /* Information about embedded
- * window. */
- TkTextEmbImage ei; /* Information about embedded
- * image. */
+ char chars[4]; /* Characters that make up character info.
+ * Actual length varies to hold as many
+ * characters as needed.*/
+ TkTextToggle toggle; /* Information about tag toggle. */
+ TkTextMark mark; /* Information about mark. */
+ TkTextEmbWindow ew; /* Information about embedded window. */
+ TkTextEmbImage ei; /* Information about embedded image. */
} body;
} TkTextSegment;
/*
- * Data structures of the type defined below are used during the
- * execution of Tcl commands to keep track of various interesting
- * places in a text. An index is only valid up until the next
- * modification to the character structure of the b-tree so they
- * can't be retained across Tcl commands. However, mods to marks
- * or tags don't invalidate indices.
+ * Data structures of the type defined below are used during the execution of
+ * Tcl commands to keep track of various interesting places in a text. An
+ * index is only valid up until the next modification to the character
+ * structure of the b-tree so they can't be retained across Tcl commands.
+ * However, mods to marks or tags don't invalidate indices.
*/
typedef struct TkTextIndex {
- TkTextBTree tree; /* Tree containing desired position. */
- TkTextLine *linePtr; /* Pointer to line containing position
- * of interest. */
- int byteIndex; /* Index within line of desired
- * character (0 means first one). */
+ TkTextBTree tree; /* Tree containing desired position. */
+ TkTextLine *linePtr; /* Pointer to line containing position of
+ * interest. */
+ int byteIndex; /* Index within line of desired character (0
+ * means first one). */
+ struct TkText *textPtr; /* May be NULL, but otherwise the text widget
+ * with which this index is associated. If not
+ * NULL, then we have a refCount on the
+ * widget. */
} TkTextIndex;
/*
@@ -193,204 +215,209 @@ typedef struct TkTextIndex {
typedef struct TkTextDispChunk TkTextDispChunk;
-typedef void Tk_ChunkDisplayProc _ANSI_ARGS_((
+typedef void Tk_ChunkDisplayProc(struct TkText *textPtr,
TkTextDispChunk *chunkPtr, int x, int y,
int height, int baseline, Display *display,
- Drawable dst, int screenY));
-typedef void Tk_ChunkUndisplayProc _ANSI_ARGS_((
- struct TkText *textPtr,
- TkTextDispChunk *chunkPtr));
-typedef int Tk_ChunkMeasureProc _ANSI_ARGS_((
- TkTextDispChunk *chunkPtr, int x));
-typedef void Tk_ChunkBboxProc _ANSI_ARGS_((
+ Drawable dst, int screenY);
+typedef void Tk_ChunkUndisplayProc(struct TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
+typedef int Tk_ChunkMeasureProc(TkTextDispChunk *chunkPtr, int x);
+typedef void Tk_ChunkBboxProc(struct TkText *textPtr,
TkTextDispChunk *chunkPtr, int index, int y,
int lineHeight, int baseline, int *xPtr,
- int *yPtr, int *widthPtr, int *heightPtr));
+ int *yPtr, int *widthPtr, int *heightPtr);
/*
- * The structure below represents a chunk of stuff that is displayed
- * together on the screen. This structure is allocated and freed by
- * generic display code but most of its fields are filled in by
- * segment-type-specific code.
+ * The structure below represents a chunk of stuff that is displayed together
+ * on the screen. This structure is allocated and freed by generic display
+ * code but most of its fields are filled in by segment-type-specific code.
*/
struct TkTextDispChunk {
/*
- * The fields below are set by the type-independent code before
- * calling the segment-type-specific layoutProc. They should not
- * be modified by segment-type-specific code.
+ * The fields below are set by the type-independent code before calling
+ * the segment-type-specific layoutProc. They should not be modified by
+ * segment-type-specific code.
*/
- int x; /* X position of chunk, in pixels.
- * This position is measured from the
- * left edge of the logical line,
- * not from the left edge of the
- * window (i.e. it doesn't change
- * under horizontal scrolling). */
- struct TkTextDispChunk *nextPtr; /* Next chunk in the display line
- * or NULL for the end of the list. */
- struct TextStyle *stylePtr; /* Display information, known only
- * to tkTextDisp.c. */
+ int x; /* X position of chunk, in pixels. This
+ * position is measured from the left edge of
+ * the logical line, not from the left edge of
+ * the window (i.e. it doesn't change under
+ * horizontal scrolling). */
+ struct TkTextDispChunk *nextPtr;
+ /* Next chunk in the display line or NULL for
+ * the end of the list. */
+ struct TextStyle *stylePtr; /* Display information, known only to
+ * tkTextDisp.c. */
/*
- * The fields below are set by the layoutProc that creates the
- * chunk.
+ * The fields below are set by the layoutProc that creates the chunk.
*/
- Tk_ChunkDisplayProc *displayProc; /* Procedure to invoke to draw this
- * chunk on the display or an
- * off-screen pixmap. */
+ Tk_ChunkDisplayProc *displayProc;
+ /* Procedure to invoke to draw this chunk on
+ * the display or an off-screen pixmap. */
Tk_ChunkUndisplayProc *undisplayProc;
- /* Procedure to invoke when segment
- * ceases to be displayed on screen
- * anymore. */
- Tk_ChunkMeasureProc *measureProc; /* Procedure to find character under
- * a given x-location. */
- Tk_ChunkBboxProc *bboxProc; /* Procedure to find bounding box
- * of character in chunk. */
- int numBytes; /* Number of bytes that will be
- * displayed in the chunk. */
- int minAscent; /* Minimum space above the baseline
- * needed by this chunk. */
- int minDescent; /* Minimum space below the baseline
- * needed by this chunk. */
- int minHeight; /* Minimum total line height needed
- * by this chunk. */
- int width; /* Width of this chunk, in pixels.
- * Initially set by chunk-specific
- * code, but may be increased to
- * include tab or extra space at end
- * of line. */
- int breakIndex; /* Index within chunk of last
- * acceptable position for a line
- * (break just before this byte index).
- * <= 0 means don't break during or
- * immediately after this chunk. */
- ClientData clientData; /* Additional information for use
- * of displayProc and undisplayProc. */
+ /* Procedure to invoke when segment ceases to
+ * be displayed on screen anymore. */
+ Tk_ChunkMeasureProc *measureProc;
+ /* Procedure to find character under a given
+ * x-location. */
+ Tk_ChunkBboxProc *bboxProc; /* Procedure to find bounding box of character
+ * in chunk. */
+ int numBytes; /* Number of bytes that will be displayed in
+ * the chunk. */
+ int minAscent; /* Minimum space above the baseline needed by
+ * this chunk. */
+ int minDescent; /* Minimum space below the baseline needed by
+ * this chunk. */
+ int minHeight; /* Minimum total line height needed by this
+ * chunk. */
+ int width; /* Width of this chunk, in pixels. Initially
+ * set by chunk-specific code, but may be
+ * increased to include tab or extra space at
+ * end of line. */
+ int breakIndex; /* Index within chunk of last acceptable
+ * position for a line (break just before this
+ * byte index). <= 0 means don't break during
+ * or immediately after this chunk. */
+ ClientData clientData; /* Additional information for use of
+ * displayProc and undisplayProc. */
};
/*
- * One data structure of the following type is used for each tag in a
- * text widget. These structures are kept in textPtr->tagTable and
- * referred to in other structures.
+ * One data structure of the following type is used for each tag in a text
+ * widget. These structures are kept in sharedTextPtr->tagTable and referred
+ * to in other structures.
*/
-typedef enum { TEXT_WRAPMODE_NULL, TEXT_WRAPMODE_NONE,
- TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_WORD
+typedef enum {
+ TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD,
+ TEXT_WRAPMODE_NULL
} TkWrapMode;
-EXTERN Tk_CustomOption TkTextWrapModeOption;
-
typedef struct TkTextTag {
- char *name; /* Name of this tag. This field is actually
- * a pointer to the key from the entry in
- * textPtr->tagTable, so it needn't be freed
- * explicitly. */
- int priority; /* Priority of this tag within widget. 0
- * means lowest priority. Exactly one tag
- * has each integer value between 0 and
- * numTags-1. */
- struct Node *tagRootPtr; /* Pointer into the B-Tree at the lowest
- * node that completely dominates the ranges
- * of text occupied by the tag. At this
- * node there is no information about the
- * tag. One or more children of the node
- * do contain information about the tag. */
- int toggleCount; /* Total number of tag toggles */
+ const char *name; /* Name of this tag. This field is actually a
+ * pointer to the key from the entry in
+ * sharedTextPtr->tagTable, so it needn't be
+ * freed explicitly. For 'sel' tags this is
+ * just a static string, so again need not be
+ * freed. */
+ const struct TkText *textPtr;
+ /* If non-NULL, then this tag only applies to
+ * the given text widget (when there are peer
+ * widgets). */
+ int priority; /* Priority of this tag within widget. 0 means
+ * lowest priority. Exactly one tag has each
+ * integer value between 0 and numTags-1. */
+ struct Node *tagRootPtr; /* Pointer into the B-Tree at the lowest node
+ * that completely dominates the ranges of
+ * text occupied by the tag. At this node
+ * there is no information about the tag. One
+ * or more children of the node do contain
+ * information about the tag. */
+ int toggleCount; /* Total number of tag toggles. */
/*
- * Information for displaying text with this tag. The information
- * belows acts as an override on information specified by lower-priority
- * tags. If no value is specified, then the next-lower-priority tag
- * on the text determins the value. The text widget itself provides
- * defaults if no tag specifies an override.
+ * Information for displaying text with this tag. The information belows
+ * acts as an override on information specified by lower-priority tags.
+ * If no value is specified, then the next-lower-priority tag on the text
+ * determins the value. The text widget itself provides defaults if no tag
+ * specifies an override.
*/
- Tk_3DBorder border; /* Used for drawing background. NULL means
- * no value specified here. */
- char *bdString; /* -borderwidth option string (malloc-ed).
- * NULL means option not specified. */
+ Tk_3DBorder border; /* Used for drawing background. NULL means no
+ * value specified here. */
int borderWidth; /* Width of 3-D border for background. */
- char *reliefString; /* -relief option string (malloc-ed).
- * NULL means option not specified. */
+ Tcl_Obj *borderWidthPtr; /* Width of 3-D border for background. */
+ char *reliefString; /* -relief option string (malloc-ed). NULL
+ * means option not specified. */
int relief; /* 3-D relief for background. */
- Pixmap bgStipple; /* Stipple bitmap for background. None
- * means no value specified here. */
- XColor *fgColor; /* Foreground color for text. NULL means
- * no value specified here. */
- Tk_Font tkfont; /* Font for displaying text. NULL means
+ Pixmap bgStipple; /* Stipple bitmap for background. None means
* no value specified here. */
+ XColor *fgColor; /* Foreground color for text. NULL means no
+ * value specified here. */
+ Tk_Font tkfont; /* Font for displaying text. NULL means no
+ * value specified here. */
Pixmap fgStipple; /* Stipple bitmap for text and other
- * foreground stuff. None means no value
+ * foreground stuff. None means no value
* specified here.*/
- char *justifyString; /* -justify option string (malloc-ed).
- * NULL means option not specified. */
+ char *justifyString; /* -justify option string (malloc-ed). NULL
+ * means option not specified. */
Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT,
* TK_JUSTIFY_RIGHT, or TK_JUSTIFY_CENTER.
* Only valid if justifyString is non-NULL. */
- char *lMargin1String; /* -lmargin1 option string (malloc-ed).
- * NULL means option not specified. */
- int lMargin1; /* Left margin for first display line of
- * each text line, in pixels. Only valid
- * if lMargin1String is non-NULL. */
- char *lMargin2String; /* -lmargin2 option string (malloc-ed).
- * NULL means option not specified. */
+ char *lMargin1String; /* -lmargin1 option string (malloc-ed). NULL
+ * means option not specified. */
+ int lMargin1; /* Left margin for first display line of each
+ * text line, in pixels. Only valid if
+ * lMargin1String is non-NULL. */
+ char *lMargin2String; /* -lmargin2 option string (malloc-ed). NULL
+ * means option not specified. */
int lMargin2; /* Left margin for second and later display
- * lines of each text line, in pixels. Only
+ * lines of each text line, in pixels. Only
* valid if lMargin2String is non-NULL. */
- char *offsetString; /* -offset option string (malloc-ed).
- * NULL means option not specified. */
+ char *offsetString; /* -offset option string (malloc-ed). NULL
+ * means option not specified. */
int offset; /* Vertical offset of text's baseline from
- * baseline of line. Used for superscripts
- * and subscripts. Only valid if
- * offsetString is non-NULL. */
- char *overstrikeString; /* -overstrike option string (malloc-ed).
- * NULL means option not specified. */
+ * baseline of line. Used for superscripts and
+ * subscripts. Only valid if offsetString is
+ * non-NULL. */
+ char *overstrikeString; /* -overstrike option string (malloc-ed). NULL
+ * means option not specified. */
int overstrike; /* Non-zero means draw horizontal line through
- * middle of text. Only valid if
+ * middle of text. Only valid if
* overstrikeString is non-NULL. */
- char *rMarginString; /* -rmargin option string (malloc-ed).
- * NULL means option not specified. */
- int rMargin; /* Right margin for text, in pixels. Only
+ char *rMarginString; /* -rmargin option string (malloc-ed). NULL
+ * means option not specified. */
+ int rMargin; /* Right margin for text, in pixels. Only
* valid if rMarginString is non-NULL. */
- char *spacing1String; /* -spacing1 option string (malloc-ed).
- * NULL means option not specified. */
- int spacing1; /* Extra spacing above first display
- * line for text line. Only valid if
- * spacing1String is non-NULL. */
- char *spacing2String; /* -spacing2 option string (malloc-ed).
- * NULL means option not specified. */
- int spacing2; /* Extra spacing between display
- * lines for the same text line. Only valid
- * if spacing2String is non-NULL. */
- char *spacing3String; /* -spacing2 option string (malloc-ed).
- * NULL means option not specified. */
- int spacing3; /* Extra spacing below last display
- * line for text line. Only valid if
- * spacing3String is non-NULL. */
- char *tabString; /* -tabs option string (malloc-ed).
- * NULL means option not specified. */
+ char *spacing1String; /* -spacing1 option string (malloc-ed). NULL
+ * means option not specified. */
+ int spacing1; /* Extra spacing above first display line for
+ * text line. Only valid if spacing1String is
+ * non-NULL. */
+ char *spacing2String; /* -spacing2 option string (malloc-ed). NULL
+ * means option not specified. */
+ int spacing2; /* Extra spacing between display lines for the
+ * same text line. Only valid if
+ * spacing2String is non-NULL. */
+ char *spacing3String; /* -spacing2 option string (malloc-ed). NULL
+ * means option not specified. */
+ int spacing3; /* Extra spacing below last display line for
+ * text line. Only valid if spacing3String is
+ * non-NULL. */
+ Tcl_Obj *tabStringPtr; /* -tabs option string. NULL means option not
+ * specified. */
struct TkTextTabArray *tabArrayPtr;
- /* Info about tabs for tag (malloc-ed)
- * or NULL. Corresponds to tabString. */
- char *underlineString; /* -underline option string (malloc-ed).
- * NULL means option not specified. */
+ /* Info about tabs for tag (malloc-ed) or
+ * NULL. Corresponds to tabString. */
+ int tabStyle; /* One of TABULAR or WORDPROCESSOR or NONE (if
+ * not specified). */
+ char *underlineString; /* -underline option string (malloc-ed). NULL
+ * means option not specified. */
int underline; /* Non-zero means draw underline underneath
- * text. Only valid if underlineString is
+ * text. Only valid if underlineString is
* non-NULL. */
TkWrapMode wrapMode; /* How to handle wrap-around for this tag.
* Must be TEXT_WRAPMODE_CHAR,
- * TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD,
- * or TEXT_WRAPMODE_NULL to use wrapmode for
+ * TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD, or
+ * TEXT_WRAPMODE_NULL to use wrapmode for
* whole widget. */
- char *elideString; /* -elide option string (malloc-ed).
- * NULL means option not specified. */
+ char *elideString; /* -elide option string (malloc-ed). NULL
+ * means option not specified. */
int elide; /* Non-zero means that data under this tag
* should not be displayed. */
int affectsDisplay; /* Non-zero means that this tag affects the
* way information is displayed on the screen
* (so need to redisplay if tag changes). */
+ Tk_OptionTable optionTable; /* Token representing the configuration
+ * specifications. */
+ int affectsDisplayGeometry; /* Non-zero means that this tag affects the
+ * size with which information is displayed on
+ * the screen (so need to recalculate line
+ * dimensions if tag changes). */
} TkTextTag;
#define TK_TAG_AFFECTS_DISPLAY 0x1
@@ -399,66 +426,81 @@ typedef struct TkTextTag {
#define TK_TAG_OFFSET 0x10
/*
- * The data structure below is used for searching a B-tree for transitions
- * on a single tag (or for all tag transitions). No code outside of
- * tkTextBTree.c should ever modify any of the fields in these structures,
- * but it's OK to use them for read-only information.
+ * The data structure below is used for searching a B-tree for transitions on
+ * a single tag (or for all tag transitions). No code outside of tkTextBTree.c
+ * should ever modify any of the fields in these structures, but it's OK to
+ * use them for read-only information.
*/
typedef struct TkTextSearch {
- TkTextIndex curIndex; /* Position of last tag transition
- * returned by TkBTreeNextTag, or
- * index of start of segment
- * containing starting position for
- * search if TkBTreeNextTag hasn't
- * been called yet, or same as
- * stopIndex if search is over. */
- TkTextSegment *segPtr; /* Actual tag segment returned by last
- * call to TkBTreeNextTag, or NULL if
- * TkBTreeNextTag hasn't returned
- * anything yet. */
- TkTextSegment *nextPtr; /* Where to resume search in next
- * call to TkBTreeNextTag. */
- TkTextSegment *lastPtr; /* Stop search before just before
- * considering this segment. */
- TkTextTag *tagPtr; /* Tag to search for (or tag found, if
- * allTags is non-zero). */
- int linesLeft; /* Lines left to search (including
- * curIndex and stopIndex). When
- * this becomes <= 0 the search is
- * over. */
- int allTags; /* Non-zero means ignore tag check:
- * search for transitions on all
- * tags. */
+ TkTextIndex curIndex; /* Position of last tag transition returned by
+ * TkBTreeNextTag, or index of start of
+ * segment containing starting position for
+ * search if TkBTreeNextTag hasn't been called
+ * yet, or same as stopIndex if search is
+ * over. */
+ TkTextSegment *segPtr; /* Actual tag segment returned by last call to
+ * TkBTreeNextTag, or NULL if TkBTreeNextTag
+ * hasn't returned anything yet. */
+ TkTextSegment *nextPtr; /* Where to resume search in next call to
+ * TkBTreeNextTag. */
+ TkTextSegment *lastPtr; /* Stop search before just before considering
+ * this segment. */
+ TkTextTag *tagPtr; /* Tag to search for (or tag found, if allTags
+ * is non-zero). */
+ int linesLeft; /* Lines left to search (including curIndex
+ * and stopIndex). When this becomes <= 0 the
+ * search is over. */
+ int allTags; /* Non-zero means ignore tag check: search for
+ * transitions on all tags. */
} TkTextSearch;
/*
- * The following data structure describes a single tab stop.
+ * The following data structure describes a single tab stop. It must be kept
+ * in sync with the 'tabOptionStrings' array in the function 'TkTextGetTabs'
*/
typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign;
+/*
+ * The following are the supported styles of tabbing, used for the -tabstyle
+ * option of the text widget. The last element is only used for tag options.
+ */
+
+typedef enum {
+ TK_TEXT_TABSTYLE_TABULAR,
+ TK_TEXT_TABSTYLE_WORDPROCESSOR,
+ TK_TEXT_TABSTYLE_NONE
+} TkTextTabStyle;
+
typedef struct TkTextTab {
- int location; /* Offset in pixels of this tab stop
- * from the left margin (lmargin2) of
- * the text. */
- TkTextTabAlign alignment; /* Where the tab stop appears relative
- * to the text. */
+ int location; /* Offset in pixels of this tab stop from the
+ * left margin (lmargin2) of the text. */
+ TkTextTabAlign alignment; /* Where the tab stop appears relative to the
+ * text. */
} TkTextTab;
typedef struct TkTextTabArray {
- int numTabs; /* Number of tab stops. */
- TkTextTab tabs[1]; /* Array of tabs. The actual size
- * will be numTabs. THIS FIELD MUST
- * BE THE LAST IN THE STRUCTURE. */
+ int numTabs; /* Number of tab stops. */
+ double lastTab; /* The accurate fractional pixel position of
+ * the last tab. */
+ double tabIncrement; /* The accurate fractional pixel increment
+ * between interpolated tabs we have to create
+ * when we exceed numTabs. */
+ TkTextTab tabs[1]; /* Array of tabs. The actual size will be
+ * numTabs. THIS FIELD MUST BE THE LAST IN THE
+ * STRUCTURE. */
} TkTextTabArray;
-/* enum definining the edit modes of */
+/*
+ * Enumeration definining the edit modes of the widget.
+ */
typedef enum {
- TK_TEXT_EDIT_INSERT, /* insert mode */
- TK_TEXT_EDIT_DELETE, /* delete mode */
- TK_TEXT_EDIT_OTHER /* none of the above */
+ TK_TEXT_EDIT_INSERT, /* insert mode */
+ TK_TEXT_EDIT_DELETE, /* delete mode */
+ TK_TEXT_EDIT_REPLACE, /* replace mode */
+ TK_TEXT_EDIT_OTHER /* none of the above */
} TkTextEditMode;
/*
@@ -475,46 +517,126 @@ typedef enum {
} TkTextDirtyMode;
/*
- * A data structure of the following type is kept for each text widget that
- * currently exists for this process:
+ * The following enum is used to define a type for the -state option of the
+ * Text widget.
*/
-typedef struct TkText {
- Tk_Window tkwin; /* Window that embodies the text. NULL
- * means that the window has been destroyed
- * but the data structures haven't yet been
- * cleaned up.*/
- Display *display; /* Display for widget. Needed, among other
- * things, to allow resources to be freed
- * even after tkwin has gone away. */
- Tcl_Interp *interp; /* Interpreter associated with widget. Used
- * to delete widget command. */
- Tcl_Command widgetCmd; /* Token for text's widget command. */
+typedef enum {
+ TK_TEXT_STATE_DISABLED, TK_TEXT_STATE_NORMAL
+} TkTextState;
+
+/*
+ * A data structure of the following type is shared between each text widget
+ * that are peers.
+ */
+
+typedef struct TkSharedText {
+ int refCount; /* Reference count this shared object. */
TkTextBTree tree; /* B-tree representation of text and tags for
* widget. */
Tcl_HashTable tagTable; /* Hash table that maps from tag names to
- * pointers to TkTextTag structures. */
+ * pointers to TkTextTag structures. The "sel"
+ * tag does not feature in this table, since
+ * there's one of those for each text peer. */
int numTags; /* Number of tags currently defined for
- * widget; needed to keep track of
+ * widget; needed to keep track of
* priorities. */
Tcl_HashTable markTable; /* Hash table that maps from mark names to
- * pointers to mark segments. */
- Tcl_HashTable windowTable; /* Hash table that maps from window names
- * to pointers to window segments. If a
- * window segment doesn't yet have an
- * associated window, there is no entry for
- * it here. */
- Tcl_HashTable imageTable; /* Hash table that maps from image names
- * to pointers to image segments. If an
- * image segment doesn't yet have an
- * associated image, there is no entry for
- * it here. */
+ * pointers to mark segments. The special
+ * "insert" and "current" marks are not stored
+ * in this table, but directly accessed as
+ * fields of textPtr. */
+ Tcl_HashTable windowTable; /* Hash table that maps from window names to
+ * pointers to window segments. If a window
+ * segment doesn't yet have an associated
+ * window, there is no entry for it here. */
+ Tcl_HashTable imageTable; /* Hash table that maps from image names to
+ * pointers to image segments. If an image
+ * segment doesn't yet have an associated
+ * image, there is no entry for it here. */
+ Tk_BindingTable bindingTable;
+ /* Table of all bindings currently defined for
+ * this widget. NULL means that no bindings
+ * exist, so the table hasn't been created.
+ * Each "object" used for this table is the
+ * name of a tag. */
+ int stateEpoch; /* This is incremented each time the B-tree's
+ * contents change structurally, and means
+ * that any cached TkTextIndex objects are no
+ * longer valid. */
+
+ /*
+ * Information related to the undo/redo functionality.
+ */
+
+ TkUndoRedoStack *undoStack; /* The undo/redo stack. */
+ int undo; /* Non-zero means the undo/redo behaviour is
+ * enabled. */
+ int maxUndo; /* The maximum depth of the undo stack
+ * expressed as the maximum number of compound
+ * statements. */
+ int autoSeparators; /* Non-zero means the separators will be
+ * inserted automatically. */
+ int isDirty; /* Flag indicating the 'dirtyness' of the
+ * text widget. If the flag is not zero,
+ * unsaved modifications have been applied to
+ * the text widget. */
+ TkTextDirtyMode dirtyMode; /* The nature of the dirtyness characterized
+ * by the isDirty flag. */
+ TkTextEditMode lastEditMode;/* Keeps track of what the last edit mode
+ * was. */
+
+ /*
+ * Keep track of all the peers
+ */
+
+ struct TkText *peers;
+} TkSharedText;
+
+/*
+ * A data structure of the following type is kept for each text widget that
+ * currently exists for this process:
+ */
+
+typedef struct TkText {
+ /*
+ * Information related to and accessed by widget peers and the
+ * TkSharedText handling routines.
+ */
+
+ TkSharedText *sharedTextPtr;/* Shared section of all peers. */
+ struct TkText *next; /* Next in list of linked peers. */
+ TkTextLine *start; /* First B-tree line to show, or NULL to start
+ * at the beginning. */
+ TkTextLine *end; /* Last B-tree line to show, or NULL for up to
+ * the end. */
+ int pixelReference; /* Counter into the current tree reference
+ * index corresponding to this widget. */
+ int abortSelections; /* Set to 1 whenever the text is modified in a
+ * way that interferes with selection
+ * retrieval: used to abort incremental
+ * selection retrievals. */
+
+ /*
+ * Standard Tk widget information and text-widget specific items
+ */
+
+ Tk_Window tkwin; /* Window that embodies the text. NULL means
+ * that the window has been destroyed but the
+ * data structures haven't yet been cleaned
+ * up.*/
+ Display *display; /* Display for widget. Needed, among other
+ * things, to allow resources to be freed even
+ * after tkwin has gone away. */
+ Tcl_Interp *interp; /* Interpreter associated with widget. Used to
+ * delete widget command. */
+ Tcl_Command widgetCmd; /* Token for text's widget command. */
int state; /* Either STATE_NORMAL or STATE_DISABLED. A
* text widget is read-only when disabled. */
/*
- * Default information for displaying (may be overridden by tags
- * applied to ranges of characters).
+ * Default information for displaying (may be overridden by tags applied
+ * to ranges of characters).
*/
Tk_3DBorder border; /* Structure used to draw 3-D border and
@@ -522,44 +644,47 @@ typedef struct TkText {
int borderWidth; /* Width of 3-D border to draw around entire
* widget. */
int padX, padY; /* Padding between text and window border. */
- int relief; /* 3-d effect for border around entire
- * widget: TK_RELIEF_RAISED etc. */
- int highlightWidth; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * <= 0 means don't draw a highlight. */
+ int relief; /* 3-d effect for border around entire widget:
+ * TK_RELIEF_RAISED etc. */
+ int highlightWidth; /* Width in pixels of highlight to draw around
+ * widget when it has the focus. <= 0 means
+ * don't draw a highlight. */
XColor *highlightBgColorPtr;
- /* Color for drawing traversal highlight
- * area when highlight is off. */
+ /* Color for drawing traversal highlight area
+ * when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
XColor *fgColor; /* Default foreground color for text. */
Tk_Font tkfont; /* Default font for displaying text. */
int charWidth; /* Width of average character in default
* font. */
+ int charHeight; /* Height of average character in default
+ * font, including line spacing. */
int spacing1; /* Default extra spacing above first display
* line for each text line. */
int spacing2; /* Default extra spacing between display lines
* for the same text line. */
int spacing3; /* Default extra spacing below last display
* line for each text line. */
- char *tabOptionString; /* Value of -tabs option string (malloc'ed). */
+ Tcl_Obj *tabOptionPtr; /* Value of -tabs option string. */
TkTextTabArray *tabArrayPtr;
/* Information about tab stops (malloc'ed).
* NULL means perform default tabbing
* behavior. */
+ int tabStyle; /* One of TABULAR or WORDPROCESSOR. */
/*
* Additional information used for displaying:
*/
- TkWrapMode wrapMode; /* How to handle wrap-around. Must be
+ TkWrapMode wrapMode; /* How to handle wrap-around. Must be
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- int width, height; /* Desired dimensions for window, measured
- * in characters. */
- int setGrid; /* Non-zero means pass gridding information
- * to window manager. */
- int prevWidth, prevHeight; /* Last known dimensions of window; used to
+ int width, height; /* Desired dimensions for window, measured in
+ * characters. */
+ int setGrid; /* Non-zero means pass gridding information to
+ * window manager. */
+ int prevWidth, prevHeight; /* Last known dimensions of window; used to
* detect changes in size. */
TkTextIndex topIndex; /* Identifies first character in top display
* line of window. */
@@ -569,31 +694,27 @@ typedef struct TkText {
* Information related to selection.
*/
- TkTextTag *selTagPtr; /* Pointer to "sel" tag. Used to tell when
- * a new selection has been made. */
+ TkTextTag *selTagPtr; /* Pointer to "sel" tag. Used to tell when a
+ * new selection has been made. */
Tk_3DBorder selBorder; /* Border and background for selected
- * characters. This is a copy of information
- * in *cursorTagPtr, so it shouldn't be
- * explicitly freed. */
- char *selBdString; /* Value of -selectborderwidth option, or NULL
- * if not specified (malloc'ed). */
- XColor *selFgColorPtr; /* Foreground color for selected text.
- * This is a copy of information in
- * *cursorTagPtr, so it shouldn't be
+ * characters. This is a copy of information
+ * in *selTagPtr, so it shouldn't be
* explicitly freed. */
+ Tk_3DBorder inactiveSelBorder;
+ /* Border and background for selected
+ * characters when they don't have the
+ * focus. */
+ int selBorderWidth; /* Width of border around selection. */
+ Tcl_Obj *selBorderWidthPtr; /* Width of border around selection. */
+ XColor *selFgColorPtr; /* Foreground color for selected text. This is
+ * a copy of information in *selTagPtr, so it
+ * shouldn't be explicitly freed. */
int exportSelection; /* Non-zero means tie "sel" tag to X
* selection. */
- TkTextIndex selIndex; /* Used during multi-pass selection retrievals.
- * This index identifies the next character
- * to be returned from the selection. */
- int abortSelections; /* Set to 1 whenever the text is modified
- * in a way that interferes with selection
- * retrieval: used to abort incremental
- * selection retrievals. */
- int selOffset; /* Offset in selection corresponding to
- * selLine and selCh. -1 means neither
- * this information nor selIndex is of any
- * use. */
+ TkTextIndex selIndex; /* Used during multi-pass selection
+ * retrievals. This index identifies the next
+ * character to be returned from the
+ * selection. */
/*
* Information related to insertion cursor:
@@ -617,58 +738,49 @@ typedef struct TkText {
* Information used for event bindings associated with tags:
*/
- Tk_BindingTable bindingTable;
- /* Table of all bindings currently defined
- * for this widget. NULL means that no
- * bindings exist, so the table hasn't been
- * created. Each "object" used for this
- * table is the address of a tag. */
TkTextSegment *currentMarkPtr;
- /* Pointer to segment for "current" mark,
- * or NULL if none. */
+ /* Pointer to segment for "current" mark, or
+ * NULL if none. */
XEvent pickEvent; /* The event from which the current character
- * was chosen. Must be saved so that we
- * can repick after modifications to the
- * text. */
- int numCurTags; /* Number of tags associated with character
- * at current mark. */
- TkTextTag **curTagArrayPtr; /* Pointer to array of tags for current
- * mark, or NULL if none. */
+ * was chosen. Must be saved so that we can
+ * repick after modifications to the text. */
+ int numCurTags; /* Number of tags associated with character at
+ * current mark. */
+ TkTextTag **curTagArrayPtr; /* Pointer to array of tags for current mark,
+ * or NULL if none. */
/*
* Miscellaneous additional information:
*/
- char *takeFocus; /* Value of -takeFocus option; not used in
- * the C code, but used by keyboard traversal
- * scripts. Malloc'ed, but may be NULL. */
+ char *takeFocus; /* Value of -takeFocus option; not used in the
+ * C code, but used by keyboard traversal
+ * scripts. Malloc'ed, but may be NULL. */
char *xScrollCmd; /* Prefix of command to issue to update
* horizontal scrollbar when view changes. */
char *yScrollCmd; /* Prefix of command to issue to update
* vertical scrollbar when view changes. */
- int flags; /* Miscellaneous flags; see below for
+ int flags; /* Miscellaneous flags; see below for
* definitions. */
+ Tk_OptionTable optionTable; /* Token representing the configuration
+ * specifications. */
+ int refCount; /* Number of cached TkTextIndex objects
+ * refering to us. */
+ int insertCursorType; /* 0 = standard insertion cursor, 1 = block
+ * cursor. */
/*
- * Information related to the undo/redo funcitonality
+ * Copies of information from the shared section relating to the undo/redo
+ * functonality
*/
-
- TkUndoRedoStack *undoStack; /* The undo/redo stack. */
- int undo; /* non zero means the undo/redo behaviour is
+
+ int undo; /* Non-zero means the undo/redo behaviour is
* enabled. */
int maxUndo; /* The maximum depth of the undo stack
* expressed as the maximum number of compound
* statements. */
- int autoSeparators; /* non zero means the separatorss will be
+ int autoSeparators; /* Non-zero means the separators will be
* inserted automatically. */
- int isDirty; /* Flag indicating the 'dirtynesss' of the
- * text widget. If the flag is not zero,
- * unsaved modifications have been applied to
- * the text widget. */
- TkTextDirtyMode dirtyMode; /* The nature of the dirtyness characterized
- * by the isDirty flag. */
- TkTextEditMode lastEditMode;/* Keeps track of what the last edit mode
- * was. */
} TkText;
/*
@@ -680,11 +792,15 @@ typedef struct TkText {
* displayed on screen.
* GOT_FOCUS: Non-zero means this window has the input
* focus.
- * BUTTON_DOWN: 1 means that a mouse button is currently
- * down; this is used to implement grabs
- * for the duration of button presses.
+ * BUTTON_DOWN: 1 means that a mouse button is currently down;
+ * this is used to implement grabs for the
+ * duration of button presses.
* UPDATE_SCROLLBARS: Non-zero means scrollbar(s) should be updated
* during next redisplay operation.
+ * NEED_REPICK This appears unused and should probably be
+ * ignored.
+ * OPTIONS_FREED The widget's options have been freed.
+ * DESTROYED The widget is going away.
*/
#define GOT_SELECTION 1
@@ -693,230 +809,367 @@ typedef struct TkText {
#define BUTTON_DOWN 8
#define UPDATE_SCROLLBARS 0x10
#define NEED_REPICK 0x20
+#define OPTIONS_FREED 0x40
+#define DESTROYED 0x80
/*
- * Records of the following type define segment types in terms of
- * a collection of procedures that may be called to manipulate
- * segments of that type.
- */
-
-typedef TkTextSegment * Tk_SegSplitProc _ANSI_ARGS_((
- struct TkTextSegment *segPtr, int index));
-typedef int Tk_SegDeleteProc _ANSI_ARGS_((
- struct TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-typedef TkTextSegment * Tk_SegCleanupProc _ANSI_ARGS_((
- struct TkTextSegment *segPtr, TkTextLine *linePtr));
-typedef void Tk_SegLineChangeProc _ANSI_ARGS_((
- struct TkTextSegment *segPtr, TkTextLine *linePtr));
-typedef int Tk_SegLayoutProc _ANSI_ARGS_((struct TkText *textPtr,
- struct TkTextIndex *indexPtr, TkTextSegment *segPtr,
- int offset, int maxX, int maxChars,
- int noCharsYet, TkWrapMode wrapMode,
- struct TkTextDispChunk *chunkPtr));
-typedef void Tk_SegCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
+ * Records of the following type define segment types in terms of a collection
+ * of procedures that may be called to manipulate segments of that type.
+ */
+
+typedef TkTextSegment * Tk_SegSplitProc(struct TkTextSegment *segPtr,
+ int index);
+typedef int Tk_SegDeleteProc(struct TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+typedef TkTextSegment * Tk_SegCleanupProc(struct TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+typedef void Tk_SegLineChangeProc(struct TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+typedef int Tk_SegLayoutProc(struct TkText *textPtr,
+ struct TkTextIndex *indexPtr,
+ TkTextSegment *segPtr, int offset, int maxX,
+ int maxChars, int noCharsYet, TkWrapMode wrapMode,
+ struct TkTextDispChunk *chunkPtr);
+typedef void Tk_SegCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
typedef struct Tk_SegType {
- char *name; /* Name of this kind of segment. */
- int leftGravity; /* If a segment has zero size (e.g. a
- * mark or tag toggle), does it
- * attach to character to its left
- * or right? 1 means left, 0 means
- * right. */
- Tk_SegSplitProc *splitProc; /* Procedure to split large segment
- * into two smaller ones. */
- Tk_SegDeleteProc *deleteProc; /* Procedure to call to delete
- * segment. */
- Tk_SegCleanupProc *cleanupProc; /* After any change to a line, this
- * procedure is invoked for all
- * segments left in the line to
- * perform any cleanup they wish
- * (e.g. joining neighboring
- * segments). */
+ const char *name; /* Name of this kind of segment. */
+ int leftGravity; /* If a segment has zero size (e.g. a mark or
+ * tag toggle), does it attach to character to
+ * its left or right? 1 means left, 0 means
+ * right. */
+ Tk_SegSplitProc *splitProc; /* Procedure to split large segment into two
+ * smaller ones. */
+ Tk_SegDeleteProc *deleteProc;
+ /* Procedure to call to delete segment. */
+ Tk_SegCleanupProc *cleanupProc;
+ /* After any change to a line, this procedure
+ * is invoked for all segments left in the
+ * line to perform any cleanup they wish
+ * (e.g. joining neighboring segments). */
Tk_SegLineChangeProc *lineChangeProc;
- /* Invoked when a segment is about
- * to be moved from its current line
- * to an earlier line because of
- * a deletion. The linePtr is that
- * for the segment's old line.
- * CleanupProc will be invoked after
- * the deletion is finished. */
- Tk_SegLayoutProc *layoutProc; /* Returns size information when
- * figuring out what to display in
- * window. */
- Tk_SegCheckProc *checkProc; /* Called during consistency checks
- * to check internal consistency of
- * segment. */
+ /* Invoked when a segment is about to be moved
+ * from its current line to an earlier line
+ * because of a deletion. The linePtr is that
+ * for the segment's old line. CleanupProc
+ * will be invoked after the deletion is
+ * finished. */
+ Tk_SegLayoutProc *layoutProc;
+ /* Returns size information when figuring out
+ * what to display in window. */
+ Tk_SegCheckProc *checkProc; /* Called during consistency checks to check
+ * internal consistency of segment. */
} Tk_SegType;
/*
- * The constant below is used to specify a line when what is really
- * wanted is the entire text. For now, just use a very big number.
+ * The following type and items describe different flags for text widget items
+ * to count. They are used in both tkText.c and tkTextIndex.c, in
+ * 'CountIndices', 'TkTextIndexBackChars', 'TkTextIndexForwChars', and
+ * 'TkTextIndexCount'.
+ */
+
+typedef int TkTextCountType;
+
+#define COUNT_CHARS 0
+#define COUNT_INDICES 1
+#define COUNT_DISPLAY 2
+#define COUNT_DISPLAY_CHARS (COUNT_CHARS | COUNT_DISPLAY)
+#define COUNT_DISPLAY_INDICES (COUNT_INDICES | COUNT_DISPLAY)
+
+/*
+ * The following structure is used to keep track of elided text taking account
+ * of different tag priorities, it is need for quick calculations of whether a
+ * single index is elided, and to start at a given index and maintain a
+ * correct elide state as we move or count forwards or backwards.
+ */
+
+#define LOTSA_TAGS 1000
+typedef struct TkTextElideInfo {
+ int numTags; /* Total tags in widget. */
+ int elide; /* Is the state currently elided. */
+ int elidePriority; /* Tag priority controlling elide state. */
+ TkTextSegment *segPtr; /* Segment to look at next. */
+ int segOffset; /* Offset of segment within line. */
+ int deftagCnts[LOTSA_TAGS];
+ TkTextTag *deftagPtrs[LOTSA_TAGS];
+ int *tagCnts; /* 0 or 1 depending if the tag with that
+ * priority is on or off. */
+ TkTextTag **tagPtrs; /* Only filled with a tagPtr if the
+ * corresponding tagCnt is 1. */
+} TkTextElideInfo;
+
+/*
+ * The constant below is used to specify a line when what is really wanted is
+ * the entire text. For now, just use a very big number.
*/
-#define TK_END_OF_TEXT 1000000
+#define TK_END_OF_TEXT 1000000
/*
- * The following definition specifies the maximum number of characters
- * needed in a string to hold a position specifier.
+ * The following definition specifies the maximum number of characters needed
+ * in a string to hold a position specifier.
*/
-#define TK_POS_CHARS 30
+#define TK_POS_CHARS 30
+
+/*
+ * Mask used for those options which may impact the pixel height calculations
+ * of individual lines displayed in the widget.
+ */
+
+#define TK_TEXT_LINE_GEOMETRY 1
+
+/*
+ * Mask used for those options which may impact the start and end lines used
+ * in the widget.
+ */
+
+#define TK_TEXT_LINE_RANGE 2
+
+/*
+ * Used as 'action' values in calls to TkTextInvalidateLineMetrics
+ */
+
+#define TK_TEXT_INVALIDATE_ONLY 0
+#define TK_TEXT_INVALIDATE_INSERT 1
+#define TK_TEXT_INVALIDATE_DELETE 2
+
+/*
+ * Used as special 'pickPlace' values in calls to TkTextSetYView. Zero or
+ * positive values indicate a number of pixels.
+ */
+
+#define TK_TEXT_PICKPLACE -1
+#define TK_TEXT_NOPIXELADJUST -2
/*
* Declarations for variables shared among the text-related files:
*/
-EXTERN int tkBTreeDebug;
-EXTERN int tkTextDebug;
-EXTERN Tk_SegType tkTextCharType;
-EXTERN Tk_SegType tkTextLeftMarkType;
-EXTERN Tk_SegType tkTextRightMarkType;
-EXTERN Tk_SegType tkTextToggleOnType;
-EXTERN Tk_SegType tkTextToggleOffType;
-
-/*
- * Declarations for procedures that are used by the text-related files
- * but shouldn't be used anywhere else in Tk (or by Tk clients):
- */
-
-EXTERN int TkBTreeCharTagged _ANSI_ARGS_((TkTextIndex *indexPtr,
- TkTextTag *tagPtr));
-EXTERN void TkBTreeCheck _ANSI_ARGS_((TkTextBTree tree));
-EXTERN int TkBTreeCharsInLine _ANSI_ARGS_((TkTextLine *linePtr));
-EXTERN int TkBTreeBytesInLine _ANSI_ARGS_((TkTextLine *linePtr));
-EXTERN TkTextBTree TkBTreeCreate _ANSI_ARGS_((TkText *textPtr));
-EXTERN void TkBTreeDestroy _ANSI_ARGS_((TkTextBTree tree));
-EXTERN void TkBTreeDeleteChars _ANSI_ARGS_((TkTextIndex *index1Ptr,
- TkTextIndex *index2Ptr));
-EXTERN TkTextLine * TkBTreeFindLine _ANSI_ARGS_((TkTextBTree tree,
- int line));
-EXTERN TkTextTag ** TkBTreeGetTags _ANSI_ARGS_((TkTextIndex *indexPtr,
- int *numTagsPtr));
-EXTERN void TkBTreeInsertChars _ANSI_ARGS_((TkTextIndex *indexPtr,
- CONST char *string));
-EXTERN int TkBTreeLineIndex _ANSI_ARGS_((TkTextLine *linePtr));
-EXTERN void TkBTreeLinkSegment _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextIndex *indexPtr));
-EXTERN TkTextLine * TkBTreeNextLine _ANSI_ARGS_((TkTextLine *linePtr));
-EXTERN int TkBTreeNextTag _ANSI_ARGS_((TkTextSearch *searchPtr));
-EXTERN int TkBTreeNumLines _ANSI_ARGS_((TkTextBTree tree));
-EXTERN TkTextLine * TkBTreePreviousLine _ANSI_ARGS_((TkTextLine *linePtr));
-EXTERN int TkBTreePrevTag _ANSI_ARGS_((TkTextSearch *searchPtr));
-EXTERN void TkBTreeStartSearch _ANSI_ARGS_((TkTextIndex *index1Ptr,
+MODULE_SCOPE int tkBTreeDebug;
+MODULE_SCOPE int tkTextDebug;
+MODULE_SCOPE const Tk_SegType tkTextCharType;
+MODULE_SCOPE const Tk_SegType tkTextLeftMarkType;
+MODULE_SCOPE const Tk_SegType tkTextRightMarkType;
+MODULE_SCOPE const Tk_SegType tkTextToggleOnType;
+MODULE_SCOPE const Tk_SegType tkTextToggleOffType;
+
+/*
+ * Convenience macros for use by B-tree clients which want to access pixel
+ * information on each line. Currently only used by TkTextDisp.c
+ */
+
+#define TkBTreeLinePixelCount(text, line) \
+ (line)->pixels[2*(text)->pixelReference]
+#define TkBTreeLinePixelEpoch(text, line) \
+ (line)->pixels[1+2*(text)->pixelReference]
+
+/*
+ * Declarations for procedures that are used by the text-related files but
+ * shouldn't be used anywhere else in Tk (or by Tk clients):
+ */
+
+MODULE_SCOPE int TkBTreeAdjustPixelHeight(const TkText *textPtr,
+ TkTextLine *linePtr, int newPixelHeight,
+ int mergedLogicalLines);
+MODULE_SCOPE int TkBTreeCharTagged(const TkTextIndex *indexPtr,
+ TkTextTag *tagPtr);
+MODULE_SCOPE void TkBTreeCheck(TkTextBTree tree);
+MODULE_SCOPE TkTextBTree TkBTreeCreate(TkSharedText *sharedTextPtr);
+MODULE_SCOPE void TkBTreeAddClient(TkTextBTree tree, TkText *textPtr,
+ int defaultHeight);
+MODULE_SCOPE void TkBTreeClientRangeChanged(TkText *textPtr,
+ int defaultHeight);
+MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree,
+ TkText *textPtr);
+MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree);
+MODULE_SCOPE void TkBTreeDeleteIndexRange(TkTextBTree tree,
+ TkTextIndex *index1Ptr, TkTextIndex *index2Ptr);
+MODULE_SCOPE int TkBTreeEpoch(TkTextBTree tree);
+MODULE_SCOPE TkTextLine *TkBTreeFindLine(TkTextBTree tree,
+ const TkText *textPtr, int line);
+MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree,
+ const TkText *textPtr, int pixels,
+ int *pixelOffset);
+MODULE_SCOPE TkTextTag **TkBTreeGetTags(const TkTextIndex *indexPtr,
+ const TkText *textPtr, int *numTagsPtr);
+MODULE_SCOPE void TkBTreeInsertChars(TkTextBTree tree,
+ TkTextIndex *indexPtr, const char *string);
+MODULE_SCOPE int TkBTreeLinesTo(const TkText *textPtr,
+ TkTextLine *linePtr);
+MODULE_SCOPE int TkBTreePixelsTo(const TkText *textPtr,
+ TkTextLine *linePtr);
+MODULE_SCOPE void TkBTreeLinkSegment(TkTextSegment *segPtr,
+ TkTextIndex *indexPtr);
+MODULE_SCOPE TkTextLine *TkBTreeNextLine(const TkText *textPtr,
+ TkTextLine *linePtr);
+MODULE_SCOPE int TkBTreeNextTag(TkTextSearch *searchPtr);
+MODULE_SCOPE int TkBTreeNumLines(TkTextBTree tree,
+ const TkText *textPtr);
+MODULE_SCOPE int TkBTreeNumPixels(TkTextBTree tree,
+ const TkText *textPtr);
+MODULE_SCOPE TkTextLine *TkBTreePreviousLine(TkText *textPtr,
+ TkTextLine *linePtr);
+MODULE_SCOPE int TkBTreePrevTag(TkTextSearch *searchPtr);
+MODULE_SCOPE void TkBTreeStartSearch(TkTextIndex *index1Ptr,
TkTextIndex *index2Ptr, TkTextTag *tagPtr,
- TkTextSearch *searchPtr));
-EXTERN void TkBTreeStartSearchBack _ANSI_ARGS_((TkTextIndex *index1Ptr,
+ TkTextSearch *searchPtr);
+MODULE_SCOPE void TkBTreeStartSearchBack(TkTextIndex *index1Ptr,
TkTextIndex *index2Ptr, TkTextTag *tagPtr,
- TkTextSearch *searchPtr));
-EXTERN void TkBTreeTag _ANSI_ARGS_((TkTextIndex *index1Ptr,
+ TkTextSearch *searchPtr);
+MODULE_SCOPE int TkBTreeTag(TkTextIndex *index1Ptr,
TkTextIndex *index2Ptr, TkTextTag *tagPtr,
- int add));
-EXTERN void TkBTreeUnlinkSegment _ANSI_ARGS_((TkTextBTree tree,
- TkTextSegment *segPtr, TkTextLine *linePtr));
-EXTERN void TkTextBindProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-EXTERN void TkTextChanged _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *index1Ptr, TkTextIndex *index2Ptr));
-EXTERN int TkTextCharBbox _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr, int *xPtr, int *yPtr,
- int *widthPtr, int *heightPtr));
-EXTERN int TkTextCharLayoutProc _ANSI_ARGS_((TkText *textPtr,
+ int add);
+MODULE_SCOPE void TkBTreeUnlinkSegment(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+MODULE_SCOPE void TkTextBindProc(ClientData clientData,
+ XEvent *eventPtr);
+MODULE_SCOPE void TkTextSelectionEvent(TkText *textPtr);
+MODULE_SCOPE void TkTextChanged(TkSharedText *sharedTextPtr,
+ TkText *textPtr, const TkTextIndex *index1Ptr,
+ const TkTextIndex *index2Ptr);
+MODULE_SCOPE int TkTextIndexBbox(TkText *textPtr,
+ const TkTextIndex *indexPtr, int *xPtr, int *yPtr,
+ int *widthPtr, int *heightPtr, int *charWidthPtr);
+MODULE_SCOPE int TkTextCharLayoutProc(TkText *textPtr,
TkTextIndex *indexPtr, TkTextSegment *segPtr,
int offset, int maxX, int maxChars, int noBreakYet,
- TkWrapMode wrapMode, TkTextDispChunk *chunkPtr));
-EXTERN void TkTextCreateDInfo _ANSI_ARGS_((TkText *textPtr));
-EXTERN int TkTextDLineInfo _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr, int *xPtr, int *yPtr,
- int *widthPtr, int *heightPtr, int *basePtr));
-EXTERN TkTextTag * TkTextCreateTag _ANSI_ARGS_((TkText *textPtr,
- CONST char *tagName));
-EXTERN void TkTextFreeDInfo _ANSI_ARGS_((TkText *textPtr));
-EXTERN void TkTextFreeTag _ANSI_ARGS_((TkText *textPtr,
- TkTextTag *tagPtr));
-EXTERN int TkTextGetIndex _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, CONST char *string,
- TkTextIndex *indexPtr));
-EXTERN TkTextTabArray * TkTextGetTabs _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, char *string));
-EXTERN void TkTextIndexBackBytes _ANSI_ARGS_((
- CONST TkTextIndex *srcPtr, int count,
- TkTextIndex *dstPtr));
-EXTERN void TkTextIndexBackChars _ANSI_ARGS_((
- CONST TkTextIndex *srcPtr, int count,
- TkTextIndex *dstPtr));
-EXTERN int TkTextIndexCmp _ANSI_ARGS_((
- CONST TkTextIndex *index1Ptr,
- CONST TkTextIndex *index2Ptr));
-EXTERN void TkTextIndexForwBytes _ANSI_ARGS_((
- CONST TkTextIndex *srcPtr, int count,
- TkTextIndex *dstPtr));
-EXTERN void TkTextIndexForwChars _ANSI_ARGS_((
- CONST TkTextIndex *srcPtr, int count,
- TkTextIndex *dstPtr));
-EXTERN TkTextSegment * TkTextIndexToSeg _ANSI_ARGS_((
- CONST TkTextIndex *indexPtr, int *offsetPtr));
-EXTERN void TkTextInsertDisplayProc _ANSI_ARGS_((
- TkTextDispChunk *chunkPtr, int x, int y, int height,
- int baseline, Display *display, Drawable dst,
- int screenY));
-EXTERN void TkTextLostSelection _ANSI_ARGS_((
- ClientData clientData));
-EXTERN TkTextIndex * TkTextMakeCharIndex _ANSI_ARGS_((TkTextBTree tree,
+ TkWrapMode wrapMode, TkTextDispChunk *chunkPtr);
+MODULE_SCOPE void TkTextCreateDInfo(TkText *textPtr);
+MODULE_SCOPE int TkTextDLineInfo(TkText *textPtr,
+ const TkTextIndex *indexPtr, int *xPtr, int *yPtr,
+ int *widthPtr, int *heightPtr, int *basePtr);
+MODULE_SCOPE void TkTextEmbWinDisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr, int x, int y,
+ int lineHeight, int baseline, Display *display,
+ Drawable dst, int screenY);
+MODULE_SCOPE TkTextTag *TkTextCreateTag(TkText *textPtr,
+ const char *tagName, int *newTag);
+MODULE_SCOPE void TkTextFreeDInfo(TkText *textPtr);
+MODULE_SCOPE void TkTextDeleteTag(TkText *textPtr, TkTextTag *tagPtr);
+MODULE_SCOPE void TkTextFreeTag(TkText *textPtr, TkTextTag *tagPtr);
+MODULE_SCOPE int TkTextGetIndex(Tcl_Interp *interp, TkText *textPtr,
+ const char *string, TkTextIndex *indexPtr);
+MODULE_SCOPE int TkTextGetObjIndex(Tcl_Interp *interp, TkText *textPtr,
+ Tcl_Obj *idxPtr, TkTextIndex *indexPtr);
+MODULE_SCOPE int TkTextSharedGetObjIndex(Tcl_Interp *interp,
+ TkSharedText *sharedTextPtr, Tcl_Obj *idxPtr,
+ TkTextIndex *indexPtr);
+MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp,
+ TkText *textPtr, Tcl_Obj *objPtr);
+MODULE_SCOPE TkTextTabArray *TkTextGetTabs(Tcl_Interp *interp,
+ TkText *textPtr, Tcl_Obj *stringPtr);
+MODULE_SCOPE void TkTextFindDisplayLineEnd(TkText *textPtr,
+ TkTextIndex *indexPtr, int end, int *xOffset);
+MODULE_SCOPE int TkTextIndexBackBytes(const TkText *textPtr,
+ const TkTextIndex *srcPtr, int count,
+ TkTextIndex *dstPtr);
+MODULE_SCOPE void TkTextIndexBackChars(const TkText *textPtr,
+ const TkTextIndex *srcPtr, int count,
+ TkTextIndex *dstPtr, TkTextCountType type);
+MODULE_SCOPE int TkTextIndexCmp(const TkTextIndex *index1Ptr,
+ const TkTextIndex *index2Ptr);
+MODULE_SCOPE int TkTextIndexCount(const TkText *textPtr,
+ const TkTextIndex *index1Ptr,
+ const TkTextIndex *index2Ptr,
+ TkTextCountType type);
+MODULE_SCOPE int TkTextIndexForwBytes(const TkText *textPtr,
+ const TkTextIndex *srcPtr, int count,
+ TkTextIndex *dstPtr);
+MODULE_SCOPE void TkTextIndexForwChars(const TkText *textPtr,
+ const TkTextIndex *srcPtr, int count,
+ TkTextIndex *dstPtr, TkTextCountType type);
+MODULE_SCOPE void TkTextIndexOfX(TkText *textPtr, int x,
+ TkTextIndex *indexPtr);
+MODULE_SCOPE int TkTextIndexYPixels(TkText *textPtr,
+ const TkTextIndex *indexPtr);
+MODULE_SCOPE TkTextSegment *TkTextIndexToSeg(const TkTextIndex *indexPtr,
+ int *offsetPtr);
+MODULE_SCOPE void TkTextInsertDisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr, int x, int y,
+ int height, int baseline, Display *display,
+ Drawable dst, int screenY);
+MODULE_SCOPE void TkTextLostSelection(ClientData clientData);
+MODULE_SCOPE TkTextIndex *TkTextMakeCharIndex(TkTextBTree tree, TkText *textPtr,
int lineIndex, int charIndex,
- TkTextIndex *indexPtr));
-EXTERN int TkTextIsElided _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr));
-EXTERN TkTextIndex * TkTextMakeByteIndex _ANSI_ARGS_((TkTextBTree tree,
- int lineIndex, int byteIndex,
- TkTextIndex *indexPtr));
-EXTERN int TkTextMarkCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkTextMarkNameToIndex _ANSI_ARGS_((TkText *textPtr,
- CONST char *name, TkTextIndex *indexPtr));
-EXTERN void TkTextMarkSegToIndex _ANSI_ARGS_((TkText *textPtr,
- TkTextSegment *markPtr, TkTextIndex *indexPtr));
-EXTERN void TkTextEventuallyRepick _ANSI_ARGS_((TkText *textPtr));
-EXTERN void TkTextPickCurrent _ANSI_ARGS_((TkText *textPtr,
- XEvent *eventPtr));
-EXTERN void TkTextPixelIndex _ANSI_ARGS_((TkText *textPtr,
- int x, int y, TkTextIndex *indexPtr));
-EXTERN void TkTextPrintIndex _ANSI_ARGS_((
- CONST TkTextIndex *indexPtr, char *string));
-EXTERN void TkTextRedrawRegion _ANSI_ARGS_((TkText *textPtr,
- int x, int y, int width, int height));
-EXTERN void TkTextRedrawTag _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *index1Ptr, TkTextIndex *index2Ptr,
- TkTextTag *tagPtr, int withTag));
-EXTERN void TkTextRelayoutWindow _ANSI_ARGS_((TkText *textPtr));
-EXTERN int TkTextScanCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkTextSeeCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkTextSegToOffset _ANSI_ARGS_((
- CONST TkTextSegment *segPtr,
- CONST TkTextLine *linePtr));
-EXTERN TkTextSegment * TkTextSetMark _ANSI_ARGS_((TkText *textPtr,
- CONST char *name, TkTextIndex *indexPtr));
-EXTERN void TkTextSetYView _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr, int pickPlace));
-EXTERN int TkTextTagCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkTextImageCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkTextImageIndex _ANSI_ARGS_((TkText *textPtr,
- CONST char *name, TkTextIndex *indexPtr));
-EXTERN int TkTextWindowCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkTextWindowIndex _ANSI_ARGS_((TkText *textPtr,
- CONST char *name, TkTextIndex *indexPtr));
-EXTERN int TkTextXviewCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
-EXTERN int TkTextYviewCmd _ANSI_ARGS_((TkText *textPtr,
- Tcl_Interp *interp, int argc, CONST char **argv));
+ TkTextIndex *indexPtr);
+MODULE_SCOPE int TkTextMeasureDown(TkText *textPtr,
+ TkTextIndex *srcPtr, int distance);
+MODULE_SCOPE void TkTextFreeElideInfo(TkTextElideInfo *infoPtr);
+MODULE_SCOPE int TkTextIsElided(const TkText *textPtr,
+ const TkTextIndex *indexPtr,
+ TkTextElideInfo *infoPtr);
+MODULE_SCOPE TkTextIndex *TkTextMakeByteIndex(TkTextBTree tree,
+ const TkText *textPtr, int lineIndex,
+ int byteIndex, TkTextIndex *indexPtr);
+MODULE_SCOPE int TkTextMakePixelIndex(TkText *textPtr,
+ int pixelIndex, TkTextIndex *indexPtr);
+MODULE_SCOPE void TkTextInvalidateLineMetrics(
+ TkSharedText *sharedTextPtr, TkText *textPtr,
+ TkTextLine *linePtr, int lineCount, int action);
+MODULE_SCOPE int TkTextUpdateLineMetrics(TkText *textPtr, int lineNum,
+ int endLine, int doThisMuch);
+MODULE_SCOPE int TkTextUpdateOneLine(TkText *textPtr,
+ TkTextLine *linePtr, int pixelHeight,
+ TkTextIndex *indexPtr, int partialCalc);
+MODULE_SCOPE int TkTextMarkCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkTextMarkNameToIndex(TkText *textPtr,
+ const char *name, TkTextIndex *indexPtr);
+MODULE_SCOPE void TkTextMarkSegToIndex(TkText *textPtr,
+ TkTextSegment *markPtr, TkTextIndex *indexPtr);
+MODULE_SCOPE void TkTextEventuallyRepick(TkText *textPtr);
+MODULE_SCOPE void TkTextPickCurrent(TkText *textPtr, XEvent *eventPtr);
+MODULE_SCOPE void TkTextPixelIndex(TkText *textPtr, int x, int y,
+ TkTextIndex *indexPtr, int *nearest);
+MODULE_SCOPE int TkTextPrintIndex(const TkText *textPtr,
+ const TkTextIndex *indexPtr, char *string);
+MODULE_SCOPE Tcl_Obj * TkTextNewIndexObj(TkText *textPtr,
+ const TkTextIndex *indexPtr);
+MODULE_SCOPE void TkTextRedrawRegion(TkText *textPtr, int x, int y,
+ int width, int height);
+MODULE_SCOPE void TkTextRedrawTag(TkSharedText *sharedTextPtr,
+ TkText *textPtr, TkTextIndex *index1Ptr,
+ TkTextIndex *index2Ptr, TkTextTag *tagPtr,
+ int withTag);
+MODULE_SCOPE void TkTextRelayoutWindow(TkText *textPtr, int mask);
+MODULE_SCOPE int TkTextScanCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkTextSeeCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkTextSegToOffset(const TkTextSegment *segPtr,
+ const TkTextLine *linePtr);
+MODULE_SCOPE TkTextSegment *TkTextSetMark(TkText *textPtr,
+ const char *name, TkTextIndex *indexPtr);
+MODULE_SCOPE void TkTextSetYView(TkText *textPtr,
+ TkTextIndex *indexPtr, int pickPlace);
+MODULE_SCOPE int TkTextTagCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkTextImageCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkTextImageIndex(TkText *textPtr,
+ const char *name, TkTextIndex *indexPtr);
+MODULE_SCOPE int TkTextWindowCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkTextWindowIndex(TkText *textPtr, const char *name,
+ TkTextIndex *indexPtr);
+MODULE_SCOPE int TkTextXviewCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr,
+ TkTextEmbWindowClient *client);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
#endif /* _TKTEXT */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index 5a5a9b5..0038e64 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -1,33 +1,54 @@
-/*
+/*
* tkTextBTree.c --
*
- * This file contains code that manages the B-tree representation
- * of text for Tk's text widget and implements character and
- * toggle segment types.
+ * This file contains code that manages the B-tree representation of text
+ * for Tk's text widget and implements character and toggle segment
+ * types.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
#include "tkText.h"
/*
- * The data structure below keeps summary information about one tag as part
- * of the tag information in a node.
+ * Implementation notes:
+ *
+ * Most of this file is independent of the text widget implementation and
+ * representation now. Without much effort this could be developed further
+ * into a new Tcl object type of which the Tk text widget is one example of a
+ * client.
+ *
+ * The B-tree is set up with a dummy last line of text which must not be
+ * displayed, and must _never_ have a non-zero pixel count. This dummy line is
+ * a historical convenience to avoid other code having to deal with NULL
+ * TkTextLines. Since Tk 8.5, with pixel line height calculations and peer
+ * widgets, this dummy line is becoming somewhat of a liability, and special
+ * case code has been required to deal with it. It is probably a good idea to
+ * investigate removing the dummy line completely. This could result in an
+ * overall simplification (although it would require new special case code to
+ * deal with the fact that '.text index end' would then not really point to a
+ * valid line, rather it would point to the beginning of a non-existent line
+ * one beyond all current lines - we could perhaps define that as a
+ * TkTextIndex with a NULL TkTextLine ptr).
+ */
+
+/*
+ * The data structure below keeps summary information about one tag as part of
+ * the tag information in a node.
*/
typedef struct Summary {
- TkTextTag *tagPtr; /* Handle for tag. */
- int toggleCount; /* Number of transitions into or
- * out of this tag that occur in
- * the subtree rooted at this node. */
- struct Summary *nextPtr; /* Next in list of all tags for same
- * node, or NULL if at end of list. */
+ TkTextTag *tagPtr; /* Handle for tag. */
+ int toggleCount; /* Number of transitions into or out of this
+ * tag that occur in the subtree rooted at
+ * this node. */
+ struct Summary *nextPtr; /* Next in list of all tags for same node, or
+ * NULL if at end of list. */
} Summary;
/*
@@ -35,43 +56,63 @@ typedef struct Summary {
*/
typedef struct Node {
- struct Node *parentPtr; /* Pointer to parent node, or NULL if
- * this is the root. */
- struct Node *nextPtr; /* Next in list of siblings with the
- * same parent node, or NULL for end
- * of list. */
- Summary *summaryPtr; /* First in malloc-ed list of info
- * about tags in this subtree (NULL if
- * no tag info in the subtree). */
- int level; /* Level of this node in the B-tree.
- * 0 refers to the bottom of the tree
- * (children are lines, not nodes). */
- union { /* First in linked list of children. */
- struct Node *nodePtr; /* Used if level > 0. */
- TkTextLine *linePtr; /* Used if level == 0. */
+ struct Node *parentPtr; /* Pointer to parent node, or NULL if this is
+ * the root. */
+ struct Node *nextPtr; /* Next in list of siblings with the same
+ * parent node, or NULL for end of list. */
+ Summary *summaryPtr; /* First in malloc-ed list of info about tags
+ * in this subtree (NULL if no tag info in the
+ * subtree). */
+ int level; /* Level of this node in the B-tree. 0 refers
+ * to the bottom of the tree (children are
+ * lines, not nodes). */
+ union { /* First in linked list of children. */
+ struct Node *nodePtr; /* Used if level > 0. */
+ TkTextLine *linePtr; /* Used if level == 0. */
} children;
- int numChildren; /* Number of children of this node. */
- int numLines; /* Total number of lines (leaves) in
- * the subtree rooted here. */
+ int numChildren; /* Number of children of this node. */
+ int numLines; /* Total number of lines (leaves) in the
+ * subtree rooted here. */
+ int *numPixels; /* Array containing total number of vertical
+ * display pixels in the subtree rooted here,
+ * one entry for each peer widget. */
} Node;
/*
- * Upper and lower bounds on how many children a node may have:
- * rebalance when either of these limits is exceeded. MAX_CHILDREN
- * should be twice MIN_CHILDREN and MIN_CHILDREN must be >= 2.
+ * Used to avoid having to allocate and deallocate arrays on the fly for
+ * commonly used functions. Must be > 0.
+ */
+
+#define PIXEL_CLIENTS 5
+
+/*
+ * Upper and lower bounds on how many children a node may have: rebalance when
+ * either of these limits is exceeded. MAX_CHILDREN should be twice
+ * MIN_CHILDREN and MIN_CHILDREN must be >= 2.
*/
#define MAX_CHILDREN 12
#define MIN_CHILDREN 6
/*
- * The data structure below defines an entire B-tree.
+ * The data structure below defines an entire B-tree. Since text widgets are
+ * the only current B-tree clients, 'clients' and 'pixelReferences' are
+ * identical.
*/
typedef struct BTree {
- Node *rootPtr; /* Pointer to root of B-tree. */
- TkText *textPtr; /* Used to find tagTable in consistency
- * checking code */
+ Node *rootPtr; /* Pointer to root of B-tree. */
+ int clients; /* Number of clients of this B-tree. */
+ int pixelReferences; /* Number of clients of this B-tree which care
+ * about pixel heights. */
+ int stateEpoch; /* Updated each time any aspect of the B-tree
+ * changes. */
+ TkSharedText *sharedTextPtr;/* Used to find tagTable in consistency
+ * checking code, and to access list of all
+ * B-tree clients. */
+ int startEndCount;
+ TkTextLine **startEnd;
+ TkText **startEndRef;
} BTree;
/*
@@ -80,20 +121,17 @@ typedef struct BTree {
*/
typedef struct TagInfo {
- int numTags; /* Number of tags for which there
- * is currently information in
- * tags and counts. */
- int arraySize; /* Number of entries allocated for
- * tags and counts. */
- TkTextTag **tagPtrs; /* Array of tags seen so far.
- * Malloc-ed. */
- int *counts; /* Toggle count (so far) for each
- * entry in tags. Malloc-ed. */
+ int numTags; /* Number of tags for which there is currently
+ * information in tags and counts. */
+ int arraySize; /* Number of entries allocated for tags and
+ * counts. */
+ TkTextTag **tagPtrs; /* Array of tags seen so far. Malloc-ed. */
+ int *counts; /* Toggle count (so far) for each entry in
+ * tags. Malloc-ed. */
} TagInfo;
/*
- * Variable that indicates whether to enable consistency checks for
- * debugging.
+ * Variable that indicates whether to enable consistency checks for debugging.
*/
int tkBTreeDebug = 0;
@@ -108,86 +146,98 @@ int tkBTreeDebug = 0;
+ sizeof(TkTextToggle)))
/*
- * Forward declarations for procedures defined in this file:
- */
-
-static void ChangeNodeToggleCount _ANSI_ARGS_((Node *nodePtr,
- TkTextTag *tagPtr, int delta));
-static void CharCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static int CharDeleteProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-static TkTextSegment * CharCleanupProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static TkTextSegment * CharSplitProc _ANSI_ARGS_((TkTextSegment *segPtr,
- int index));
-static void CheckNodeConsistency _ANSI_ARGS_((Node *nodePtr));
-static void CleanupLine _ANSI_ARGS_((TkTextLine *linePtr));
-static void DeleteSummaries _ANSI_ARGS_((Summary *tagPtr));
-static void DestroyNode _ANSI_ARGS_((Node *nodePtr));
-static TkTextSegment * FindTagEnd _ANSI_ARGS_((TkTextBTree tree,
- TkTextTag *tagPtr, TkTextIndex *indexPtr));
-static void IncCount _ANSI_ARGS_((TkTextTag *tagPtr, int inc,
- TagInfo *tagInfoPtr));
-static void Rebalance _ANSI_ARGS_((BTree *treePtr, Node *nodePtr));
-static void RecomputeNodeCounts _ANSI_ARGS_((Node *nodePtr));
-static TkTextSegment * SplitSeg _ANSI_ARGS_((TkTextIndex *indexPtr));
-static void ToggleCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static TkTextSegment * ToggleCleanupProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static int ToggleDeleteProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-static void ToggleLineChangeProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static TkTextSegment * FindTagStart _ANSI_ARGS_((TkTextBTree tree,
- TkTextTag *tagPtr, TkTextIndex *indexPtr));
+ * Forward declarations for functions defined in this file:
+ */
+
+static int AdjustPixelClient(BTree *treePtr, int defaultHeight,
+ Node *nodePtr, TkTextLine *start, TkTextLine *end,
+ int useReference, int newPixelReferences,
+ int *counting);
+static void ChangeNodeToggleCount(Node *nodePtr,
+ TkTextTag *tagPtr, int delta);
+static void CharCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static int CharDeleteProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+static TkTextSegment * CharCleanupProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static TkTextSegment * CharSplitProc(TkTextSegment *segPtr, int index);
+static void CheckNodeConsistency(Node *nodePtr, int references);
+static void CleanupLine(TkTextLine *linePtr);
+static void DeleteSummaries(Summary *tagPtr);
+static void DestroyNode(Node *nodePtr);
+static TkTextSegment * FindTagEnd(TkTextBTree tree, TkTextTag *tagPtr,
+ TkTextIndex *indexPtr);
+static void IncCount(TkTextTag *tagPtr, int inc,
+ TagInfo *tagInfoPtr);
+static void Rebalance(BTree *treePtr, Node *nodePtr);
+static void RecomputeNodeCounts(BTree *treePtr, Node *nodePtr);
+static void RemovePixelClient(BTree *treePtr, Node *nodePtr,
+ int overwriteWithLast);
+static TkTextSegment * SplitSeg(TkTextIndex *indexPtr);
+static void ToggleCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static TkTextSegment * ToggleCleanupProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static int ToggleDeleteProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+static void ToggleLineChangeProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static TkTextSegment * FindTagStart(TkTextBTree tree, TkTextTag *tagPtr,
+ TkTextIndex *indexPtr);
+static void AdjustStartEndRefs(BTree *treePtr, TkText *textPtr,
+ int action);
+
+/*
+ * Actions for use by AdjustStartEndRefs
+ */
+
+#define TEXT_ADD_REFS 1
+#define TEXT_REMOVE_REFS 2
/*
* Type record for character segments:
*/
-Tk_SegType tkTextCharType = {
- "character", /* name */
- 0, /* leftGravity */
- CharSplitProc, /* splitProc */
- CharDeleteProc, /* deleteProc */
- CharCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- TkTextCharLayoutProc, /* layoutProc */
- CharCheckProc /* checkProc */
+const Tk_SegType tkTextCharType = {
+ "character", /* name */
+ 0, /* leftGravity */
+ CharSplitProc, /* splitProc */
+ CharDeleteProc, /* deleteProc */
+ CharCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ TkTextCharLayoutProc, /* layoutProc */
+ CharCheckProc /* checkProc */
};
/*
- * Type record for segments marking the beginning of a tagged
- * range:
+ * Type record for segments marking the beginning of a tagged range:
*/
-Tk_SegType tkTextToggleOnType = {
- "toggleOn", /* name */
- 0, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- ToggleDeleteProc, /* deleteProc */
- ToggleCleanupProc, /* cleanupProc */
- ToggleLineChangeProc, /* lineChangeProc */
- (Tk_SegLayoutProc *) NULL, /* layoutProc */
- ToggleCheckProc /* checkProc */
+const Tk_SegType tkTextToggleOnType = {
+ "toggleOn", /* name */
+ 0, /* leftGravity */
+ NULL, /* splitProc */
+ ToggleDeleteProc, /* deleteProc */
+ ToggleCleanupProc, /* cleanupProc */
+ ToggleLineChangeProc, /* lineChangeProc */
+ NULL, /* layoutProc */
+ ToggleCheckProc /* checkProc */
};
/*
- * Type record for segments marking the end of a tagged
- * range:
+ * Type record for segments marking the end of a tagged range:
*/
-Tk_SegType tkTextToggleOffType = {
- "toggleOff", /* name */
- 1, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- ToggleDeleteProc, /* deleteProc */
- ToggleCleanupProc, /* cleanupProc */
- ToggleLineChangeProc, /* lineChangeProc */
- (Tk_SegLayoutProc *) NULL, /* layoutProc */
- ToggleCheckProc /* checkProc */
+const Tk_SegType tkTextToggleOffType = {
+ "toggleOff", /* name */
+ 1, /* leftGravity */
+ NULL, /* splitProc */
+ ToggleDeleteProc, /* deleteProc */
+ ToggleCleanupProc, /* cleanupProc */
+ ToggleLineChangeProc, /* lineChangeProc */
+ NULL, /* layoutProc */
+ ToggleCheckProc /* checkProc */
};
/*
@@ -195,11 +245,11 @@ Tk_SegType tkTextToggleOffType = {
*
* TkBTreeCreate --
*
- * This procedure is called to create a new text B-tree.
+ * This function is called to create a new text B-tree.
*
* Results:
- * The return value is a pointer to a new B-tree containing
- * one line with nothing but a newline character.
+ * The return value is a pointer to a new B-tree containing one line with
+ * nothing but a newline character.
*
* Side effects:
* Memory is allocated and initialized.
@@ -208,8 +258,8 @@ Tk_SegType tkTextToggleOffType = {
*/
TkTextBTree
-TkBTreeCreate(textPtr)
- TkText *textPtr;
+TkBTreeCreate(
+ TkSharedText *sharedTextPtr)
{
register BTree *treePtr;
register Node *rootPtr;
@@ -217,15 +267,16 @@ TkBTreeCreate(textPtr)
register TkTextSegment *segPtr;
/*
- * The tree will initially have two empty lines. The second line
- * isn't actually part of the tree's contents, but its presence
- * makes several operations easier. The tree will have one node,
- * which is also the root of the tree.
+ * The tree will initially have two empty lines. The second line isn't
+ * actually part of the tree's contents, but its presence makes several
+ * operations easier. The tree will have one node, which is also the root
+ * of the tree.
*/
rootPtr = (Node *) ckalloc(sizeof(Node));
linePtr = (TkTextLine *) ckalloc(sizeof(TkTextLine));
linePtr2 = (TkTextLine *) ckalloc(sizeof(TkTextLine));
+
rootPtr->parentPtr = NULL;
rootPtr->nextPtr = NULL;
rootPtr->summaryPtr = NULL;
@@ -234,6 +285,15 @@ TkBTreeCreate(textPtr)
rootPtr->numChildren = 2;
rootPtr->numLines = 2;
+ /*
+ * The tree currently has no registered clients, so all pixel count
+ * pointers are simply NULL.
+ */
+
+ rootPtr->numPixels = NULL;
+ linePtr->pixels = NULL;
+ linePtr2->pixels = NULL;
+
linePtr->parentPtr = rootPtr;
linePtr->nextPtr = linePtr2;
segPtr = (TkTextSegment *) ckalloc(CSEG_SIZE(1));
@@ -255,8 +315,14 @@ TkBTreeCreate(textPtr)
segPtr->body.chars[1] = 0;
treePtr = (BTree *) ckalloc(sizeof(BTree));
+ treePtr->sharedTextPtr = sharedTextPtr;
treePtr->rootPtr = rootPtr;
- treePtr->textPtr = textPtr;
+ treePtr->clients = 0;
+ treePtr->stateEpoch = 0;
+ treePtr->pixelReferences = 0;
+ treePtr->startEndCount = 0;
+ treePtr->startEnd = NULL;
+ treePtr->startEndRef = NULL;
return (TkTextBTree) treePtr;
}
@@ -264,13 +330,133 @@ TkBTreeCreate(textPtr)
/*
*----------------------------------------------------------------------
*
+ * TkBTreeAddClient --
+ *
+ * This function is called to provide a client with access to a given
+ * B-tree. If the client wishes to make use of the B-tree's pixel height
+ * storage, caching and calculation mechanisms, then a non-negative
+ * 'defaultHeight' must be provided. In this case the return value is a
+ * pixel tree reference which must be provided in all of the B-tree API
+ * which refers to or modifies pixel heights:
+ *
+ * TkBTreeAdjustPixelHeight,
+ * TkBTreeFindPixelLine,
+ * TkBTreeNumPixels,
+ * TkBTreePixelsTo,
+ * (and two private functions AdjustPixelClient, RemovePixelClient).
+ *
+ * If this is not provided, then the above functions must never be called
+ * for this client.
+ *
+ * Results:
+ * The return value is the pixelReference used by the B-tree to refer to
+ * pixel counts for the new client. It should be stored by the caller. If
+ * defaultHeight was negative, then the return value will be -1.
+ *
+ * Side effects:
+ * Memory may be allocated and initialized.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkBTreeAddClient(
+ TkTextBTree tree, /* B-tree to add a client to. */
+ TkText *textPtr, /* Client to add. */
+ int defaultHeight) /* Default line height for the new client, or
+ * -1 if no pixel heights are to be kept. */
+{
+ register BTree *treePtr = (BTree *) tree;
+
+ if (treePtr == NULL) {
+ Tcl_Panic("NULL treePtr in TkBTreeAddClient");
+ }
+
+ if (textPtr->start != NULL || textPtr->end != NULL) {
+ AdjustStartEndRefs(treePtr, textPtr, TEXT_ADD_REFS);
+ }
+
+ if (defaultHeight >= 0) {
+ TkTextLine *end;
+ int counting = (textPtr->start == NULL ? 1 : 0);
+ int useReference = treePtr->pixelReferences;
+
+ /*
+ * We must set the 'end' value in AdjustPixelClient so that the last
+ * dummy line in the B-tree doesn't contain a pixel height.
+ */
+
+ end = textPtr->end;
+ if (end == NULL) {
+ end = TkBTreeFindLine(tree, NULL, TkBTreeNumLines(tree, NULL));
+ }
+ AdjustPixelClient(treePtr, defaultHeight, treePtr->rootPtr,
+ textPtr->start, end, useReference, useReference+1, &counting);
+
+ textPtr->pixelReference = useReference;
+ treePtr->pixelReferences++;
+ } else {
+ textPtr->pixelReference = -1;
+ }
+ treePtr->clients++;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkBTreeClientRangeChanged --
+ *
+ * Called when the -startline or -endline options of a text widget client
+ * of the B-tree have changed.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Lots of processing of the B-tree is done, with potential for memory to
+ * be allocated and initialized for the pixel heights of the widget.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkBTreeClientRangeChanged(
+ TkText *textPtr, /* Client whose start, end have changed. */
+ int defaultHeight) /* Default line height for the new client, or
+ * -1 if no pixel heights are to be kept. */
+{
+ TkTextLine *end;
+ BTree *treePtr = (BTree *) textPtr->sharedTextPtr->tree;
+
+ int counting = (textPtr->start == NULL ? 1 : 0);
+ int useReference = textPtr->pixelReference;
+
+ AdjustStartEndRefs(treePtr, textPtr, TEXT_ADD_REFS | TEXT_REMOVE_REFS);
+
+ /*
+ * We must set the 'end' value in AdjustPixelClient so that the last dummy
+ * line in the B-tree doesn't contain a pixel height.
+ */
+
+ end = textPtr->end;
+ if (end == NULL) {
+ end = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ NULL, TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL));
+ }
+ AdjustPixelClient(treePtr, defaultHeight, treePtr->rootPtr,
+ textPtr->start, end, useReference, treePtr->pixelReferences,
+ &counting);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkBTreeDestroy --
*
* Delete a B-tree, recycling all of the storage it contains.
*
* Results:
- * The tree given by treePtr is deleted. TreePtr should never
- * again be used.
+ * The tree is deleted, so 'tree' should never again be used.
*
* Side effects:
* Memory is freed.
@@ -279,22 +465,382 @@ TkBTreeCreate(textPtr)
*/
void
-TkBTreeDestroy(tree)
- TkTextBTree tree; /* Pointer to tree to delete. */
+TkBTreeDestroy(
+ TkTextBTree tree) /* Tree to clean up. */
{
BTree *treePtr = (BTree *) tree;
+ /*
+ * There's no need to loop over each client of the tree, calling
+ * 'TkBTreeRemoveClient', since the 'DestroyNode' will clean everything up
+ * itself.
+ */
+
DestroyNode(treePtr->rootPtr);
+ if (treePtr->startEnd != NULL) {
+ ckfree((char *) treePtr->startEnd);
+ ckfree((char *) treePtr->startEndRef);
+ }
ckfree((char *) treePtr);
}
/*
*----------------------------------------------------------------------
*
+ * TkBTreeEpoch --
+ *
+ * Return the epoch for the B-tree. This number is incremented any time
+ * anything changes in the tree.
+ *
+ * Results:
+ * The epoch number.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkBTreeEpoch(
+ TkTextBTree tree) /* Tree to get epoch for. */
+{
+ BTree *treePtr = (BTree *) tree;
+ return treePtr->stateEpoch;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkBTreeRemoveClient --
+ *
+ * Remove a client widget from its B-tree, cleaning up the pixel arrays
+ * which it uses if necessary. If this is the last such widget, we also
+ * destroy the whole tree.
+ *
+ * Results:
+ * All tree-specific aspects of the given client are deleted. If no more
+ * references exist, then the given tree is also deleted (in which case
+ * 'tree' must not be used again).
+ *
+ * Side effects:
+ * Memory may be freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkBTreeRemoveClient(
+ TkTextBTree tree, /* Tree to remove client from. */
+ TkText *textPtr) /* Client to remove. */
+{
+ BTree *treePtr = (BTree *) tree;
+ int pixelReference = textPtr->pixelReference;
+
+ if (treePtr->clients == 1) {
+ /*
+ * The last reference to the tree.
+ */
+
+ DestroyNode(treePtr->rootPtr);
+ ckfree((char *) treePtr);
+ return;
+ } else if (pixelReference == -1) {
+ /*
+ * A client which doesn't care about pixels.
+ */
+
+ treePtr->clients--;
+ } else {
+ /*
+ * Clean up pixel data for the given reference.
+ */
+
+ if (pixelReference == (treePtr->pixelReferences-1)) {
+ /*
+ * The widget we're removing has the last index, so deletion is
+ * easier.
+ */
+
+ RemovePixelClient(treePtr, treePtr->rootPtr, -1);
+ } else {
+ TkText *adjustPtr;
+
+ RemovePixelClient(treePtr, treePtr->rootPtr, pixelReference);
+
+ /*
+ * Now we need to adjust the 'pixelReference' of the peer widget
+ * whose storage we've just moved.
+ */
+
+ adjustPtr = treePtr->sharedTextPtr->peers;
+ while (adjustPtr != NULL) {
+ if (adjustPtr->pixelReference == treePtr->pixelReferences-1) {
+ adjustPtr->pixelReference = pixelReference;
+ break;
+ }
+ adjustPtr = adjustPtr->next;
+ }
+ if (adjustPtr == NULL) {
+ Tcl_Panic("Couldn't find text widget with correct reference");
+ }
+ }
+ treePtr->pixelReferences--;
+ treePtr->clients--;
+ }
+
+ if (textPtr->start != NULL || textPtr->end != NULL) {
+ AdjustStartEndRefs(treePtr, textPtr, TEXT_REMOVE_REFS);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AdjustStartEndRefs --
+ *
+ * Modify B-tree's cache of start, end lines for the given text widget.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The number of cached items may change (treePtr->startEndCount).
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+AdjustStartEndRefs(
+ BTree *treePtr, /* The entire B-tree. */
+ TkText *textPtr, /* The text widget for which we want to adjust
+ * it's start and end cache. */
+ int action) /* Action to perform. */
+{
+ if (action & TEXT_REMOVE_REFS) {
+ int i = 0;
+ int count = 0;
+
+ while (i < treePtr->startEndCount) {
+ if (i != count) {
+ treePtr->startEnd[count] = treePtr->startEnd[i];
+ treePtr->startEndRef[count] = treePtr->startEndRef[i];
+ }
+ if (treePtr->startEndRef[i] != textPtr) {
+ count++;
+ }
+ i++;
+ }
+ treePtr->startEndCount = count;
+ treePtr->startEnd = (TkTextLine **)
+ ckrealloc((char *) treePtr->startEnd,
+ sizeof(TkTextLine *) * count);
+ treePtr->startEndRef = (TkText **)
+ ckrealloc((char *) treePtr->startEndRef,
+ sizeof(TkText *) * count);
+ }
+ if ((action & TEXT_ADD_REFS)
+ && (textPtr->start != NULL || textPtr->end != NULL)) {
+ int count;
+
+ if (textPtr->start != NULL) {
+ treePtr->startEndCount++;
+ }
+ if (textPtr->end != NULL) {
+ treePtr->startEndCount++;
+ }
+
+ count = treePtr->startEndCount;
+
+ treePtr->startEnd = (TkTextLine **)
+ ckrealloc((char *) treePtr->startEnd,
+ sizeof(TkTextLine *) * count);
+ treePtr->startEndRef = (TkText **)
+ ckrealloc((char *) treePtr->startEndRef,
+ sizeof(TkText *) * count);
+
+ if (textPtr->start != NULL) {
+ count--;
+ treePtr->startEnd[count] = textPtr->start;
+ treePtr->startEndRef[count] = treePtr->sharedTextPtr->peers;
+ }
+ if (textPtr->end != NULL) {
+ count--;
+ treePtr->startEnd[count] = textPtr->end;
+ treePtr->startEndRef[count] = treePtr->sharedTextPtr->peers;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AdjustPixelClient --
+ *
+ * Utility function used to update all data structures for the existence
+ * of a new peer widget based on this B-tree, or for the modification of
+ * the start, end lines of an existing peer widget.
+ *
+ * Immediately _after_ calling this, treePtr->pixelReferences and
+ * treePtr->clients should be adjusted if needed (i.e. if this is a new
+ * peer).
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * All the storage for Nodes and TkTextLines in the tree may be adjusted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+AdjustPixelClient(
+ BTree *treePtr, /* Pointer to tree. */
+ int defaultHeight, /* Default pixel line height, which can be
+ * zero. */
+ Node *nodePtr, /* Adjust from this node downwards. */
+ TkTextLine *start, /* First line for this pixel client. */
+ TkTextLine *end, /* Last line for this pixel client. */
+ int useReference, /* pixel reference for the client we are
+ * adding or changing. */
+ int newPixelReferences, /* New number of pixel references to this
+ * B-tree. */
+ int *counting) /* References an integer which is zero if
+ * we're outside the relevant range for this
+ * client, and 1 if we're inside. */
+{
+ int pixelCount = 0;
+
+ /*
+ * Traverse entire tree down from nodePtr, reallocating pixel structures
+ * for each Node and TkTextLine, adding room for the new peer's pixel
+ * information (1 extra int per Node, 2 extra ints per TkTextLine). Also
+ * copy the information from the last peer into the new space (so it
+ * contains something sensible).
+ */
+
+ if (nodePtr->level != 0) {
+ Node *loopPtr = nodePtr->children.nodePtr;
+
+ while (loopPtr != NULL) {
+ pixelCount += AdjustPixelClient(treePtr, defaultHeight, loopPtr,
+ start, end, useReference, newPixelReferences, counting);
+ loopPtr = loopPtr->nextPtr;
+ }
+ } else {
+ register TkTextLine *linePtr = nodePtr->children.linePtr;
+
+ while (linePtr != NULL) {
+ if (!*counting && (linePtr == start)) {
+ *counting = 1;
+ }
+ if (*counting && (linePtr == end)) {
+ *counting = 0;
+ }
+ if (newPixelReferences != treePtr->pixelReferences) {
+ linePtr->pixels = (int *) ckrealloc((char *) linePtr->pixels,
+ sizeof(int) * 2 * newPixelReferences);
+ }
+
+ /*
+ * Notice that for the very last line, we are never counting and
+ * therefore this always has a height of 0 and an epoch of 1.
+ */
+
+ linePtr->pixels[2*useReference] = (*counting ? defaultHeight : 0);
+ linePtr->pixels[2*useReference+1] = (*counting ? 0 : 1);
+ pixelCount += linePtr->pixels[2*useReference];
+
+ linePtr = linePtr->nextPtr;
+ }
+ }
+ if (newPixelReferences != treePtr->pixelReferences) {
+ nodePtr->numPixels = (int *) ckrealloc((char *) nodePtr->numPixels,
+ sizeof(int) * newPixelReferences);
+ }
+ nodePtr->numPixels[useReference] = pixelCount;
+ return pixelCount;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RemovePixelClient --
+ *
+ * Utility function used to update all data structures for the removal of
+ * a peer widget which used to be based on this B-tree.
+ *
+ * Immediately _after_ calling this, treePtr->clients should be
+ * decremented.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * All the storage for Nodes and TkTextLines in the tree may be adjusted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RemovePixelClient(
+ BTree *treePtr, /* Pointer to tree. */
+ Node *nodePtr, /* Adjust from this node downwards. */
+ int overwriteWithLast) /* Over-write this peer widget's information
+ * with the last one. */
+{
+ /*
+ * Traverse entire tree down from nodePtr, reallocating pixel structures
+ * for each Node and TkTextLine, removing space allocated for one peer. If
+ * 'overwriteWithLast' is not -1, then copy the information which was in
+ * the last slot on top of one of the others (i.e. it's not the last one
+ * we're deleting).
+ */
+
+ if (overwriteWithLast != -1) {
+ nodePtr->numPixels[overwriteWithLast] =
+ nodePtr->numPixels[treePtr->pixelReferences-1];
+ }
+ if (treePtr->pixelReferences == 1) {
+ nodePtr->numPixels = NULL;
+ } else {
+ nodePtr->numPixels = (int *) ckrealloc((char *) nodePtr->numPixels,
+ sizeof(int) * (treePtr->pixelReferences - 1));
+ }
+ if (nodePtr->level != 0) {
+ nodePtr = nodePtr->children.nodePtr;
+ while (nodePtr != NULL) {
+ RemovePixelClient(treePtr, nodePtr, overwriteWithLast);
+ nodePtr = nodePtr->nextPtr;
+ }
+ } else {
+ register TkTextLine *linePtr = nodePtr->children.linePtr;
+ while (linePtr != NULL) {
+ if (overwriteWithLast != -1) {
+ linePtr->pixels[2*overwriteWithLast] =
+ linePtr->pixels[2*(treePtr->pixelReferences-1)];
+ linePtr->pixels[1+2*overwriteWithLast] =
+ linePtr->pixels[1+2*(treePtr->pixelReferences-1)];
+ }
+ if (treePtr->pixelReferences == 1) {
+ linePtr->pixels = NULL;
+ } else {
+ linePtr->pixels = (int *) ckrealloc((char *) linePtr->pixels,
+ sizeof(int) * 2 * (treePtr->pixelReferences-1));
+ }
+ linePtr = linePtr->nextPtr;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* DestroyNode --
*
- * This is a recursive utility procedure used during the deletion
- * of a B-tree.
+ * This is a recursive utility function used during the deletion of a
+ * B-tree.
*
* Results:
* None.
@@ -306,8 +852,8 @@ TkBTreeDestroy(tree)
*/
static void
-DestroyNode(nodePtr)
- register Node *nodePtr;
+DestroyNode(
+ register Node *nodePtr) /* Destroy from this node downwards. */
{
if (nodePtr->level == 0) {
TkTextLine *linePtr;
@@ -321,6 +867,7 @@ DestroyNode(nodePtr)
linePtr->segPtr = segPtr->nextPtr;
(*segPtr->typePtr->deleteProc)(segPtr, linePtr, 1);
}
+ ckfree((char *) linePtr->pixels);
ckfree((char *) linePtr);
}
} else {
@@ -333,6 +880,7 @@ DestroyNode(nodePtr)
}
}
DeleteSummaries(nodePtr->summaryPtr);
+ ckfree((char *) nodePtr->numPixels);
ckfree((char *) nodePtr);
}
@@ -341,8 +889,8 @@ DestroyNode(nodePtr)
*
* DeleteSummaries --
*
- * Free up all of the memory in a list of tag summaries associated
- * with a node.
+ * Free up all of the memory in a list of tag summaries associated with a
+ * node.
*
* Results:
* None.
@@ -354,11 +902,12 @@ DestroyNode(nodePtr)
*/
static void
-DeleteSummaries(summaryPtr)
- register Summary *summaryPtr; /* First in list of node's tag
- * summaries. */
+DeleteSummaries(
+ register Summary *summaryPtr)
+ /* First in list of node's tag summaries. */
{
register Summary *nextPtr;
+
while (summaryPtr != NULL) {
nextPtr = summaryPtr->nextPtr;
ckfree((char *) summaryPtr);
@@ -369,6 +918,74 @@ DeleteSummaries(summaryPtr)
/*
*----------------------------------------------------------------------
*
+ * TkBTreeAdjustPixelHeight --
+ *
+ * Adjust the pixel height of a given logical line to the specified
+ * value.
+ *
+ * Results:
+ * Total number of valid pixels currently known in the tree.
+ *
+ * Side effects:
+ * Updates overall data structures so pixel height count is consistent.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkBTreeAdjustPixelHeight(
+ const TkText *textPtr, /* Client of the B-tree. */
+ register TkTextLine *linePtr,
+ /* The logical line to update. */
+ int newPixelHeight, /* The line's known height in pixels. */
+ int mergedLogicalLines) /* The number of extra logical lines which
+ * have been merged with this one (due to
+ * elided eols). They will have their pixel
+ * height set to zero, and the total pixel
+ * height associated with the given
+ * linePtr. */
+{
+ register Node *nodePtr;
+ int changeToPixelCount; /* Counts change to total number of pixels in
+ * file. */
+ int pixelReference = textPtr->pixelReference;
+
+ changeToPixelCount = newPixelHeight - linePtr->pixels[2 * pixelReference];
+
+ /*
+ * Increment the pixel counts in all the parent nodes of the current line,
+ * then rebalance the tree if necessary.
+ */
+
+ nodePtr = linePtr->parentPtr;
+ nodePtr->numPixels[pixelReference] += changeToPixelCount;
+
+ while (nodePtr->parentPtr != NULL) {
+ nodePtr = nodePtr->parentPtr;
+ nodePtr->numPixels[pixelReference] += changeToPixelCount;
+ }
+
+ linePtr->pixels[2 * pixelReference] = newPixelHeight;
+
+ /*
+ * Any merged logical lines must have their height set to zero.
+ */
+
+ while (mergedLogicalLines-- > 0) {
+ linePtr = TkBTreeNextLine(textPtr, linePtr);
+ TkBTreeAdjustPixelHeight(textPtr, linePtr, 0, 0);
+ }
+
+ /*
+ * Return total number of pixels in the tree.
+ */
+
+ return nodePtr->numPixels[pixelReference];
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkBTreeInsertChars --
*
* Insert characters at a given position in a B-tree.
@@ -377,53 +994,68 @@ DeleteSummaries(summaryPtr)
* None.
*
* Side effects:
- * Characters are added to the B-tree at the given position.
- * If the string contains newlines, new lines will be added,
- * which could cause the structure of the B-tree to change.
+ * Characters are added to the B-tree at the given position. If the
+ * string contains newlines, new lines will be added, which could cause
+ * the structure of the B-tree to change.
*
*----------------------------------------------------------------------
*/
void
-TkBTreeInsertChars(indexPtr, string)
- register TkTextIndex *indexPtr; /* Indicates where to insert text.
- * When the procedure returns, this
- * index is no longer valid because
- * of changes to the segment
- * structure. */
- CONST char *string; /* Pointer to bytes to insert (may
- * contain newlines, must be null-
- * terminated). */
+TkBTreeInsertChars(
+ TkTextBTree tree, /* Tree to insert into. */
+ register TkTextIndex *indexPtr,
+ /* Indicates where to insert text. When the
+ * function returns, this index is no longer
+ * valid because of changes to the segment
+ * structure. */
+ const char *string) /* Pointer to bytes to insert (may contain
+ * newlines, must be null-terminated). */
{
register Node *nodePtr;
- register TkTextSegment *prevPtr; /* The segment just before the first
- * new segment (NULL means new segment
- * is at beginning of line). */
- TkTextSegment *curPtr; /* Current segment; new characters
- * are inserted just after this one.
- * NULL means insert at beginning of
- * line. */
- TkTextLine *linePtr; /* Current line (new segments are
- * added to this line). */
+ register TkTextSegment *prevPtr;
+ /* The segment just before the first new
+ * segment (NULL means new segment is at
+ * beginning of line). */
+ TkTextSegment *curPtr; /* Current segment; new characters are
+ * inserted just after this one. NULL means
+ * insert at beginning of line. */
+ TkTextLine *linePtr; /* Current line (new segments are added to
+ * this line). */
register TkTextSegment *segPtr;
TkTextLine *newLinePtr;
- int chunkSize; /* # characters in current chunk. */
- register CONST char *eol; /* Pointer to character just after last
- * one in current chunk. */
- int changeToLineCount; /* Counts change to total number of
- * lines in file. */
+ int chunkSize; /* # characters in current chunk. */
+ register const char *eol; /* Pointer to character just after last one in
+ * current chunk. */
+ int changeToLineCount; /* Counts change to total number of lines in
+ * file. */
+ int *changeToPixelCount; /* Counts change to total number of pixels in
+ * file. */
+ int ref;
+ int pixels[PIXEL_CLIENTS];
+ BTree *treePtr = (BTree *) tree;
+ treePtr->stateEpoch++;
prevPtr = SplitSeg(indexPtr);
linePtr = indexPtr->linePtr;
curPtr = prevPtr;
/*
- * Chop the string up into lines and create a new segment for
- * each line, plus a new line for the leftovers from the
- * previous line.
+ * Chop the string up into lines and create a new segment for each line,
+ * plus a new line for the leftovers from the previous line.
*/
changeToLineCount = 0;
+ if (treePtr->pixelReferences > PIXEL_CLIENTS) {
+ changeToPixelCount = (int *)
+ ckalloc(sizeof(int) * treePtr->pixelReferences);
+ } else {
+ changeToPixelCount = pixels;
+ }
+ for (ref = 0; ref < treePtr->pixelReferences; ref++) {
+ changeToPixelCount[ref] = 0;
+ }
+
while (*string != 0) {
for (eol = string; *eol != 0; eol++) {
if (*eol == '\n') {
@@ -450,15 +1082,30 @@ TkBTreeInsertChars(indexPtr, string)
}
/*
- * The chunk ended with a newline, so create a new TkTextLine
- * and move the remainder of the old line to it.
+ * The chunk ended with a newline, so create a new TkTextLine and move
+ * the remainder of the old line to it.
*/
newLinePtr = (TkTextLine *) ckalloc(sizeof(TkTextLine));
+ newLinePtr->pixels = (int *)
+ ckalloc(sizeof(int) * 2 * treePtr->pixelReferences);
+
newLinePtr->parentPtr = linePtr->parentPtr;
newLinePtr->nextPtr = linePtr->nextPtr;
linePtr->nextPtr = newLinePtr;
newLinePtr->segPtr = segPtr->nextPtr;
+
+ /*
+ * Set up a starting default height, which will be re-adjusted later.
+ * We need to do this for each referenced widget.
+ */
+
+ for (ref = 0; ref < treePtr->pixelReferences; ref++) {
+ newLinePtr->pixels[2 * ref] = linePtr->pixels[2 * ref];
+ newLinePtr->pixels[2 * ref + 1] = 0;
+ changeToPixelCount[ref] += newLinePtr->pixels[2 * ref];
+ }
+
segPtr->nextPtr = NULL;
linePtr = newLinePtr;
curPtr = NULL;
@@ -468,8 +1115,18 @@ TkBTreeInsertChars(indexPtr, string)
}
/*
- * Cleanup the starting line for the insertion, plus the ending
- * line if it's different.
+ * I don't believe it's possible for either of the two lines passed to
+ * this function to be the last line of text, but the function is robust
+ * to that case anyway. (We must never re-calculated the line height of
+ * the last line).
+ */
+
+ TkTextInvalidateLineMetrics(treePtr->sharedTextPtr, NULL,
+ indexPtr->linePtr, changeToLineCount, TK_TEXT_INVALIDATE_INSERT);
+
+ /*
+ * Cleanup the starting line for the insertion, plus the ending line if
+ * it's different.
*/
CleanupLine(indexPtr->linePtr);
@@ -478,18 +1135,25 @@ TkBTreeInsertChars(indexPtr, string)
}
/*
- * Increment the line counts in all the parent nodes of the insertion
- * point, then rebalance the tree if necessary.
+ * Increment the line and pixel counts in all the parent nodes of the
+ * insertion point, then rebalance the tree if necessary.
*/
for (nodePtr = linePtr->parentPtr ; nodePtr != NULL;
nodePtr = nodePtr->parentPtr) {
nodePtr->numLines += changeToLineCount;
+ for (ref = 0; ref < treePtr->pixelReferences; ref++) {
+ nodePtr->numPixels[ref] += changeToPixelCount[ref];
+ }
+ }
+ if (treePtr->pixelReferences > PIXEL_CLIENTS) {
+ ckfree((char *) changeToPixelCount);
}
+
nodePtr = linePtr->parentPtr;
nodePtr->numChildren += changeToLineCount;
if (nodePtr->numChildren > MAX_CHILDREN) {
- Rebalance((BTree *) indexPtr->tree, nodePtr);
+ Rebalance(treePtr, nodePtr);
}
if (tkBTreeDebug) {
@@ -502,40 +1166,41 @@ TkBTreeInsertChars(indexPtr, string)
*
* SplitSeg --
*
- * This procedure is called before adding or deleting
- * segments. It does three things: (a) it finds the segment
- * containing indexPtr; (b) if there are several such
- * segments (because some segments have zero length) then
- * it picks the first segment that does not have left
- * gravity; (c) if the index refers to the middle of
- * a segment then it splits the segment so that the
- * index now refers to the beginning of a segment.
+ * This function is called before adding or deleting segments. It does
+ * three things: (a) it finds the segment containing indexPtr; (b) if
+ * there are several such segments (because some segments have zero
+ * length) then it picks the first segment that does not have left
+ * gravity; (c) if the index refers to the middle of a segment then it
+ * splits the segment so that the index now refers to the beginning of a
+ * segment.
*
* Results:
- * The return value is a pointer to the segment just
- * before the segment corresponding to indexPtr (as
- * described above). If the segment corresponding to
- * indexPtr is the first in its line then the return
+ * The return value is a pointer to the segment just before the segment
+ * corresponding to indexPtr (as described above). If the segment
+ * corresponding to indexPtr is the first in its line then the return
* value is NULL.
*
* Side effects:
- * The segment referred to by indexPtr is split unless
- * indexPtr refers to its first character.
+ * The segment referred to by indexPtr is split unless indexPtr refers to
+ * its first character.
*
*--------------------------------------------------------------
*/
static TkTextSegment *
-SplitSeg(indexPtr)
- TkTextIndex *indexPtr; /* Index identifying position
- * at which to split a segment. */
+SplitSeg(
+ TkTextIndex *indexPtr) /* Index identifying position at which to
+ * split a segment. */
{
TkTextSegment *prevPtr, *segPtr;
- int count;
+ TkTextLine *linePtr;
+ int count = indexPtr->byteIndex;
- for (count = indexPtr->byteIndex, prevPtr = NULL,
- segPtr = indexPtr->linePtr->segPtr; segPtr != NULL;
- count -= segPtr->size, prevPtr = segPtr, segPtr = segPtr->nextPtr) {
+ linePtr = indexPtr->linePtr;
+ prevPtr = NULL;
+ segPtr = linePtr->segPtr;
+
+ while (segPtr != NULL) {
if (segPtr->size > count) {
if (count == 0) {
return prevPtr;
@@ -551,8 +1216,26 @@ SplitSeg(indexPtr)
&& !segPtr->typePtr->leftGravity) {
return prevPtr;
}
+
+ count -= segPtr->size;
+ prevPtr = segPtr;
+ segPtr = segPtr->nextPtr;
+ if (segPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through eliding
+ * of a newline.
+ */
+
+ linePtr = TkBTreeNextLine(NULL, linePtr);
+ if (linePtr == NULL) {
+ /*
+ * Reached end of the text.
+ */
+ }
+ segPtr = linePtr->segPtr;
+ }
}
- panic("SplitSeg reached end of line!");
+ Tcl_Panic("SplitSeg reached end of line!");
return NULL;
}
@@ -561,36 +1244,34 @@ SplitSeg(indexPtr)
*
* CleanupLine --
*
- * This procedure is called after modifications have been
- * made to a line. It scans over all of the segments in
- * the line, giving each a chance to clean itself up, e.g.
- * by merging with the following segments, updating internal
- * information, etc.
+ * This function is called after modifications have been made to a line.
+ * It scans over all of the segments in the line, giving each a chance to
+ * clean itself up, e.g. by merging with the following segments, updating
+ * internal information, etc.
*
* Results:
* None.
*
* Side effects:
- * Depends on what the segment-specific cleanup procedures do.
+ * Depends on what the segment-specific cleanup functions do.
*
*--------------------------------------------------------------
*/
static void
-CleanupLine(linePtr)
- TkTextLine *linePtr; /* Line to be cleaned up. */
+CleanupLine(
+ TkTextLine *linePtr) /* Line to be cleaned up. */
{
TkTextSegment *segPtr, **prevPtrPtr;
int anyChanges;
/*
- * Make a pass over all of the segments in the line, giving each
- * a chance to clean itself up. This could potentially change
- * the structure of the line, e.g. by merging two segments
- * together or having two segments cancel themselves; if so,
- * then repeat the whole process again, since the first structure
- * change might make other structure changes possible. Repeat
- * until eventually there are no changes.
+ * Make a pass over all of the segments in the line, giving each a chance
+ * to clean itself up. This could potentially change the structure of the
+ * line, e.g. by merging two segments together or having two segments
+ * cancel themselves; if so, then repeat the whole process again, since
+ * the first structure change might make other structure changes possible.
+ * Repeat until eventually there are no changes.
*/
while (1) {
@@ -614,49 +1295,55 @@ CleanupLine(linePtr)
/*
*----------------------------------------------------------------------
*
- * TkBTreeDeleteChars --
+ * TkBTreeDeleteIndexRange --
*
- * Delete a range of characters from a B-tree. The caller
- * must make sure that the final newline of the B-tree is
- * never deleted.
+ * Delete a range of characters from a B-tree. The caller must make sure
+ * that the final newline of the B-tree is never deleted.
*
* Results:
* None.
*
* Side effects:
- * Information is deleted from the B-tree. This can cause the
- * internal structure of the B-tree to change. Note: because
- * of changes to the B-tree structure, the indices pointed
- * to by index1Ptr and index2Ptr should not be used after this
- * procedure returns.
+ * Information is deleted from the B-tree. This can cause the internal
+ * structure of the B-tree to change. Note: because of changes to the
+ * B-tree structure, the indices pointed to by index1Ptr and index2Ptr
+ * should not be used after this function returns.
*
*----------------------------------------------------------------------
*/
void
-TkBTreeDeleteChars(index1Ptr, index2Ptr)
- register TkTextIndex *index1Ptr; /* Indicates first character that is
- * to be deleted. */
- register TkTextIndex *index2Ptr; /* Indicates character just after the
- * last one that is to be deleted. */
+TkBTreeDeleteIndexRange(
+ TkTextBTree tree, /* Tree to delete from. */
+ register TkTextIndex *index1Ptr,
+ /* Indicates first character that is to be
+ * deleted. */
+ register TkTextIndex *index2Ptr)
+ /* Indicates character just after the last one
+ * that is to be deleted. */
{
- TkTextSegment *prevPtr; /* The segment just before the start
- * of the deletion range. */
- TkTextSegment *lastPtr; /* The segment just after the end
- * of the deletion range. */
+ TkTextSegment *prevPtr; /* The segment just before the start of the
+ * deletion range. */
+ TkTextSegment *lastPtr; /* The segment just after the end of the
+ * deletion range. */
TkTextSegment *segPtr, *nextPtr;
TkTextLine *curLinePtr;
Node *curNodePtr, *nodePtr;
+ int changeToLineCount = 0;
+ int ref;
+ BTree *treePtr = (BTree *) tree;
+
+ treePtr->stateEpoch++;
/*
- * Tricky point: split at index2Ptr first; otherwise the split
- * at index2Ptr may invalidate segPtr and/or prevPtr.
+ * Tricky point: split at index2Ptr first; otherwise the split at
+ * index2Ptr may invalidate segPtr and/or prevPtr.
*/
lastPtr = SplitSeg(index2Ptr);
if (lastPtr != NULL) {
lastPtr = lastPtr->nextPtr;
- } else {
+ } else {
lastPtr = index2Ptr->linePtr->segPtr;
}
prevPtr = SplitSeg(index1Ptr);
@@ -673,18 +1360,19 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
*/
curLinePtr = index1Ptr->linePtr;
+
curNodePtr = curLinePtr->parentPtr;
while (segPtr != lastPtr) {
if (segPtr == NULL) {
TkTextLine *nextLinePtr;
/*
- * We just ran off the end of a line. First find the
- * next line, then go back to the old line and delete it
- * (unless it's the starting line for the range).
+ * We just ran off the end of a line. First find the next line,
+ * then go back to the old line and delete it (unless it's the
+ * starting line for the range).
*/
- nextLinePtr = TkBTreeNextLine(curLinePtr);
+ nextLinePtr = TkBTreeNextLine(NULL, curLinePtr);
if (curLinePtr != index1Ptr->linePtr) {
if (curNodePtr == index1Ptr->linePtr->parentPtr) {
index1Ptr->linePtr->nextPtr = curLinePtr->nextPtr;
@@ -694,16 +1382,50 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
for (nodePtr = curNodePtr; nodePtr != NULL;
nodePtr = nodePtr->parentPtr) {
nodePtr->numLines--;
+ for (ref = 0; ref < treePtr->pixelReferences; ref++) {
+ nodePtr->numPixels[ref] -= curLinePtr->pixels[2*ref];
+ }
}
+ changeToLineCount++;
curNodePtr->numChildren--;
+
+ /*
+ * Check if we need to adjust any partial clients.
+ */
+
+ if (treePtr->startEnd != NULL) {
+ int checkCount = 0;
+
+ while (checkCount < treePtr->startEndCount) {
+ if (treePtr->startEnd[checkCount] == curLinePtr) {
+ TkText *peer = treePtr->startEndRef[checkCount];
+
+ /*
+ * We're deleting a line which is the start or end
+ * of a current client. This means we need to
+ * adjust that client.
+ */
+
+ treePtr->startEnd[checkCount] = nextLinePtr;
+ if (peer->start == curLinePtr) {
+ peer->start = nextLinePtr;
+ }
+ if (peer->end == curLinePtr) {
+ peer->end = nextLinePtr;
+ }
+ }
+ checkCount++;
+ }
+ }
+ ckfree((char *) curLinePtr->pixels);
ckfree((char *) curLinePtr);
}
curLinePtr = nextLinePtr;
segPtr = curLinePtr->segPtr;
/*
- * If the node is empty then delete it and its parents,
- * recursively upwards until a non-empty node is found.
+ * If the node is empty then delete it and its parents recursively
+ * upwards until a non-empty node is found.
*/
while (curNodePtr->numChildren == 0) {
@@ -730,8 +1452,8 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
nextPtr = segPtr->nextPtr;
if ((*segPtr->typePtr->deleteProc)(segPtr, curLinePtr, 0) != 0) {
/*
- * This segment refuses to die. Move it to prevPtr and
- * advance prevPtr if the segment has left gravity.
+ * This segment refuses to die. Move it to prevPtr and advance
+ * prevPtr if the segment has left gravity.
*/
if (prevPtr == NULL) {
@@ -749,8 +1471,8 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
}
/*
- * If the beginning and end of the deletion range are in different
- * lines, join the two lines together and discard the ending line.
+ * If the beginning and end of the deletion range are in different lines,
+ * join the two lines together and discard the ending line.
*/
if (index1Ptr->linePtr != index2Ptr->linePtr) {
@@ -766,7 +1488,11 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
for (nodePtr = curNodePtr; nodePtr != NULL;
nodePtr = nodePtr->parentPtr) {
nodePtr->numLines--;
+ for (ref = 0; ref < treePtr->pixelReferences; ref++) {
+ nodePtr->numPixels[ref] -= index2Ptr->linePtr->pixels[2*ref];
+ }
}
+ changeToLineCount++;
curNodePtr->numChildren--;
prevLinePtr = curNodePtr->children.linePtr;
if (prevLinePtr == index2Ptr->linePtr) {
@@ -777,7 +1503,43 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
}
prevLinePtr->nextPtr = index2Ptr->linePtr->nextPtr;
}
+
+ /*
+ * Check if we need to adjust any partial clients. In this case if
+ * we're deleting the line, we actually move back to the previous line
+ * for our (start,end) storage. We do this because we still want the
+ * portion of the second line that still exists to be in the start,end
+ * range.
+ */
+
+ if (treePtr->startEnd != NULL) {
+ int checkCount = 0;
+
+ while (checkCount < treePtr->startEndCount &&
+ treePtr->startEnd[checkCount] != NULL) {
+ if (treePtr->startEnd[checkCount] == index2Ptr->linePtr) {
+ TkText *peer = treePtr->startEndRef[checkCount];
+
+ /*
+ * We're deleting a line which is the start or end of a
+ * current client. This means we need to adjust that
+ * client.
+ */
+
+ treePtr->startEnd[checkCount] = index1Ptr->linePtr;
+ if (peer->start == index2Ptr->linePtr) {
+ peer->start = index1Ptr->linePtr;
+ }
+ if (peer->end == index2Ptr->linePtr) {
+ peer->end = index1Ptr->linePtr;
+ }
+ }
+ checkCount++;
+ }
+ }
+ ckfree((char *) index2Ptr->linePtr->pixels);
ckfree((char *) index2Ptr->linePtr);
+
Rebalance((BTree *) index2Ptr->tree, curNodePtr);
}
@@ -788,6 +1550,19 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
CleanupLine(index1Ptr->linePtr);
/*
+ * This line now needs to have its height recalculated. For safety, ensure
+ * we don't call this function with the last artificial line of text. I
+ * _believe_ that it isn't possible to get this far with the last line,
+ * but it is good to be safe.
+ */
+
+ if (TkBTreeNextLine(NULL, index1Ptr->linePtr) != NULL) {
+ TkTextInvalidateLineMetrics(treePtr->sharedTextPtr, NULL,
+ index1Ptr->linePtr, changeToLineCount,
+ TK_TEXT_INVALIDATE_DELETE);
+ }
+
+ /*
* Lastly, rebalance the first node of the range.
*/
@@ -805,8 +1580,8 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
* Find a particular line in a B-tree based on its line number.
*
* Results:
- * The return value is a pointer to the line structure for the
- * line whose index is "line", or NULL if no such line exists.
+ * The return value is a pointer to the line structure for the line whose
+ * index is "line", or NULL if no such line exists.
*
* Side effects:
* None.
@@ -815,34 +1590,54 @@ TkBTreeDeleteChars(index1Ptr, index2Ptr)
*/
TkTextLine *
-TkBTreeFindLine(tree, line)
- TkTextBTree tree; /* B-tree in which to find line. */
- int line; /* Index of desired line. */
+TkBTreeFindLine(
+ TkTextBTree tree, /* B-tree in which to find line. */
+ const TkText *textPtr, /* Relative to this client of the B-tree. */
+ int line) /* Index of desired line. */
{
BTree *treePtr = (BTree *) tree;
register Node *nodePtr;
register TkTextLine *linePtr;
- int linesLeft;
+
+ if (treePtr == NULL) {
+ treePtr = (BTree *) textPtr->sharedTextPtr->tree;
+ }
nodePtr = treePtr->rootPtr;
- linesLeft = line;
if ((line < 0) || (line >= nodePtr->numLines)) {
return NULL;
}
/*
- * Work down through levels of the tree until a node is found at
- * level 0.
+ * Check for the any start/end offset for this text widget.
+ */
+
+ if (textPtr != NULL) {
+ if (textPtr->start != NULL) {
+ line += TkBTreeLinesTo(NULL, textPtr->start);
+ if (line >= nodePtr->numLines) {
+ return NULL;
+ }
+ }
+ if (textPtr->end != NULL) {
+ if (line > TkBTreeLinesTo(NULL, textPtr->end)) {
+ return NULL;
+ }
+ }
+ }
+
+ /*
+ * Work down through levels of the tree until a node is found at level 0.
*/
while (nodePtr->level != 0) {
for (nodePtr = nodePtr->children.nodePtr;
- nodePtr->numLines <= linesLeft;
+ nodePtr->numLines <= line;
nodePtr = nodePtr->nextPtr) {
if (nodePtr == NULL) {
- panic("TkBTreeFindLine ran out of nodes");
+ Tcl_Panic("TkBTreeFindLine ran out of nodes");
}
- linesLeft -= nodePtr->numLines;
+ line -= nodePtr->numLines;
}
}
@@ -850,12 +1645,90 @@ TkBTreeFindLine(tree, line)
* Work through the lines attached to the level-0 node.
*/
- for (linePtr = nodePtr->children.linePtr; linesLeft > 0;
+ for (linePtr = nodePtr->children.linePtr; line > 0;
linePtr = linePtr->nextPtr) {
if (linePtr == NULL) {
- panic("TkBTreeFindLine ran out of lines");
+ Tcl_Panic("TkBTreeFindLine ran out of lines");
}
- linesLeft -= 1;
+ line -= 1;
+ }
+ return linePtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkBTreeFindPixelLine --
+ *
+ * Find a particular line in a B-tree based on its pixel count.
+ *
+ * Results:
+ * The return value is a pointer to the line structure for the line which
+ * contains the pixel "pixels", or NULL if no such line exists. If the
+ * first line is of height 20, then pixels 0-19 will return it, and
+ * pixels = 20 will return the next line.
+ *
+ * If pixelOffset is non-NULL, it is set to the amount by which 'pixels'
+ * exceeds the first pixel located on the returned line. This should
+ * always be non-negative.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkTextLine *
+TkBTreeFindPixelLine(
+ TkTextBTree tree, /* B-tree to use. */
+ const TkText *textPtr, /* Relative to this client of the B-tree. */
+ int pixels, /* Pixel index of desired line. */
+ int *pixelOffset) /* Used to return offset. */
+{
+ BTree *treePtr = (BTree *) tree;
+ register Node *nodePtr;
+ register TkTextLine *linePtr;
+ int pixelReference = textPtr->pixelReference;
+
+ nodePtr = treePtr->rootPtr;
+
+ if ((pixels < 0) || (pixels > nodePtr->numPixels[pixelReference])) {
+ return NULL;
+ }
+
+ if (nodePtr->numPixels[pixelReference] == 0) {
+ Tcl_Panic("TkBTreeFindPixelLine called with empty window");
+ }
+
+ /*
+ * Work down through levels of the tree until a node is found at level 0.
+ */
+
+ while (nodePtr->level != 0) {
+ for (nodePtr = nodePtr->children.nodePtr;
+ nodePtr->numPixels[pixelReference] <= pixels;
+ nodePtr = nodePtr->nextPtr) {
+ if (nodePtr == NULL) {
+ Tcl_Panic("TkBTreeFindPixelLine ran out of nodes");
+ }
+ pixels -= nodePtr->numPixels[pixelReference];
+ }
+ }
+
+ /*
+ * Work through the lines attached to the level-0 node.
+ */
+
+ for (linePtr = nodePtr->children.linePtr;
+ linePtr->pixels[2 * pixelReference] < pixels;
+ linePtr = linePtr->nextPtr) {
+ if (linePtr == NULL) {
+ Tcl_Panic("TkBTreeFindPixelLine ran out of lines");
+ }
+ pixels -= linePtr->pixels[2 * pixelReference];
+ }
+ if (pixelOffset != NULL && linePtr != NULL) {
+ *pixelOffset = pixels;
}
return linePtr;
}
@@ -865,13 +1738,13 @@ TkBTreeFindLine(tree, line)
*
* TkBTreeNextLine --
*
- * Given an existing line in a B-tree, this procedure locates the
- * next line in the B-tree. This procedure is used for scanning
- * through the B-tree.
+ * Given an existing line in a B-tree, this function locates the next
+ * line in the B-tree. This function is used for scanning through the
+ * B-tree.
*
* Results:
- * The return value is a pointer to the line that immediately
- * follows linePtr, or NULL if there is no such line.
+ * The return value is a pointer to the line that immediately follows
+ * linePtr, or NULL if there is no such line.
*
* Side effects:
* None.
@@ -880,20 +1753,25 @@ TkBTreeFindLine(tree, line)
*/
TkTextLine *
-TkBTreeNextLine(linePtr)
- register TkTextLine *linePtr; /* Pointer to existing line in
- * B-tree. */
+TkBTreeNextLine(
+ const TkText *textPtr, /* Next line in the context of this client. */
+ register TkTextLine *linePtr)
+ /* Pointer to existing line in B-tree. */
{
register Node *nodePtr;
if (linePtr->nextPtr != NULL) {
- return linePtr->nextPtr;
+ if (textPtr != NULL && (linePtr == textPtr->end)) {
+ return NULL;
+ } else {
+ return linePtr->nextPtr;
+ }
}
/*
* This was the last line associated with the particular parent node.
- * Search up the tree for the next node, then search down from that
- * node to find the first line.
+ * Search up the tree for the next node, then search down from that node
+ * to find the first line.
*/
for (nodePtr = linePtr->parentPtr; ; nodePtr = nodePtr->parentPtr) {
@@ -902,7 +1780,7 @@ TkBTreeNextLine(linePtr)
break;
}
if (nodePtr->parentPtr == NULL) {
- return (TkTextLine *) NULL;
+ return NULL;
}
}
while (nodePtr->level > 0) {
@@ -916,13 +1794,13 @@ TkBTreeNextLine(linePtr)
*
* TkBTreePreviousLine --
*
- * Given an existing line in a B-tree, this procedure locates the
- * previous line in the B-tree. This procedure is used for scanning
- * through the B-tree in the reverse direction.
+ * Given an existing line in a B-tree, this function locates the previous
+ * line in the B-tree. This function is used for scanning through the
+ * B-tree in the reverse direction.
*
* Results:
- * The return value is a pointer to the line that immediately
- * preceeds linePtr, or NULL if there is no such line.
+ * The return value is a pointer to the line that immediately preceeds
+ * linePtr, or NULL if there is no such line.
*
* Side effects:
* None.
@@ -931,25 +1809,31 @@ TkBTreeNextLine(linePtr)
*/
TkTextLine *
-TkBTreePreviousLine(linePtr)
- register TkTextLine *linePtr; /* Pointer to existing line in
- * B-tree. */
+TkBTreePreviousLine(
+ TkText *textPtr, /* Relative to this client of the B-tree. */
+ register TkTextLine *linePtr)
+ /* Pointer to existing line in B-tree. */
{
register Node *nodePtr;
register Node *node2Ptr;
register TkTextLine *prevPtr;
+ if (textPtr != NULL && textPtr->start == linePtr) {
+ return NULL;
+ }
+
/*
* Find the line under this node just before the starting line.
*/
- prevPtr = linePtr->parentPtr->children.linePtr; /* First line at leaf */
+
+ prevPtr = linePtr->parentPtr->children.linePtr; /* First line at leaf. */
while (prevPtr != linePtr) {
if (prevPtr->nextPtr == linePtr) {
return prevPtr;
}
prevPtr = prevPtr->nextPtr;
- if (prevPtr == (TkTextLine *) NULL) {
- panic("TkBTreePreviousLine ran out of lines");
+ if (prevPtr == NULL) {
+ Tcl_Panic("TkBTreePreviousLine ran out of lines");
}
}
@@ -958,15 +1842,16 @@ TkBTreePreviousLine(linePtr)
* Search up the tree for the previous node, then search down from that
* node to find its last line.
*/
+
for (nodePtr = linePtr->parentPtr; ; nodePtr = nodePtr->parentPtr) {
- if (nodePtr == (Node *) NULL || nodePtr->parentPtr == (Node *) NULL) {
- return (TkTextLine *) NULL;
+ if (nodePtr == NULL || nodePtr->parentPtr == NULL) {
+ return NULL;
}
if (nodePtr != nodePtr->parentPtr->children.nodePtr) {
break;
}
}
- for (node2Ptr = nodePtr->parentPtr->children.nodePtr; ;
+ for (node2Ptr = nodePtr->parentPtr->children.nodePtr; ;
node2Ptr = node2Ptr->children.nodePtr) {
while (node2Ptr->nextPtr != nodePtr) {
node2Ptr = node2Ptr->nextPtr;
@@ -974,10 +1859,10 @@ TkBTreePreviousLine(linePtr)
if (node2Ptr->level == 0) {
break;
}
- nodePtr = (Node *)NULL;
+ nodePtr = NULL;
}
for (prevPtr = node2Ptr->children.linePtr ; ; prevPtr = prevPtr->nextPtr) {
- if (prevPtr->nextPtr == (TkTextLine *) NULL) {
+ if (prevPtr->nextPtr == NULL) {
return prevPtr;
}
}
@@ -986,10 +1871,15 @@ TkBTreePreviousLine(linePtr)
/*
*----------------------------------------------------------------------
*
- * TkBTreeLineIndex --
+ * TkBTreePixelsTo --
+ *
+ * Given a pointer to a line in a B-tree, return the numerical pixel
+ * index of the top of that line (i.e. the result does not include the
+ * height of the given line).
*
- * Given a pointer to a line in a B-tree, return the numerical
- * index of that line.
+ * Since the last line of text (the artificial one) has zero height by
+ * defintion, calling this with the last line will return the total
+ * number of pixels in the widget.
*
* Results:
* The result is the index of linePtr within the tree, where 0
@@ -1002,17 +1892,78 @@ TkBTreePreviousLine(linePtr)
*/
int
-TkBTreeLineIndex(linePtr)
- TkTextLine *linePtr; /* Pointer to existing line in
- * B-tree. */
+TkBTreePixelsTo(
+ const TkText *textPtr, /* Relative to this client of the B-tree. */
+ TkTextLine *linePtr) /* Pointer to existing line in B-tree. */
+{
+ register TkTextLine *linePtr2;
+ register Node *nodePtr, *parentPtr;
+ int index;
+ int pixelReference = textPtr->pixelReference;
+
+ /*
+ * First count how many pixels precede this line in its level-0 node.
+ */
+
+ nodePtr = linePtr->parentPtr;
+ index = 0;
+ for (linePtr2 = nodePtr->children.linePtr; linePtr2 != linePtr;
+ linePtr2 = linePtr2->nextPtr) {
+ if (linePtr2 == NULL) {
+ Tcl_Panic("TkBTreePixelsTo couldn't find line");
+ }
+ index += linePtr2->pixels[2 * pixelReference];
+ }
+
+ /*
+ * Now work up through the levels of the tree one at a time, counting how
+ * many pixels are in nodes preceding the current node.
+ */
+
+ for (parentPtr = nodePtr->parentPtr ; parentPtr != NULL;
+ nodePtr = parentPtr, parentPtr = parentPtr->parentPtr) {
+ register Node *nodePtr2;
+
+ for (nodePtr2 = parentPtr->children.nodePtr; nodePtr2 != nodePtr;
+ nodePtr2 = nodePtr2->nextPtr) {
+ if (nodePtr2 == NULL) {
+ Tcl_Panic("TkBTreePixelsTo couldn't find node");
+ }
+ index += nodePtr2->numPixels[pixelReference];
+ }
+ }
+ return index;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkBTreeLinesTo --
+ *
+ * Given a pointer to a line in a B-tree, return the numerical index of
+ * that line.
+ *
+ * Results:
+ * The result is the index of linePtr within the tree, where 0
+ * corresponds to the first line in the tree.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkBTreeLinesTo(
+ const TkText *textPtr, /* Relative to this client of the B-tree. */
+ TkTextLine *linePtr) /* Pointer to existing line in B-tree. */
{
register TkTextLine *linePtr2;
register Node *nodePtr, *parentPtr, *nodePtr2;
int index;
/*
- * First count how many lines precede this one in its level-0
- * node.
+ * First count how many lines precede this one in its level-0 node.
*/
nodePtr = linePtr->parentPtr;
@@ -1020,15 +1971,14 @@ TkBTreeLineIndex(linePtr)
for (linePtr2 = nodePtr->children.linePtr; linePtr2 != linePtr;
linePtr2 = linePtr2->nextPtr) {
if (linePtr2 == NULL) {
- panic("TkBTreeLineIndex couldn't find line");
+ Tcl_Panic("TkBTreeLinesTo couldn't find line");
}
index += 1;
}
/*
- * Now work up through the levels of the tree one at a time,
- * counting how many lines are in nodes preceding the current
- * node.
+ * Now work up through the levels of the tree one at a time, counting how
+ * many lines are in nodes preceding the current node.
*/
for (parentPtr = nodePtr->parentPtr ; parentPtr != NULL;
@@ -1036,11 +1986,14 @@ TkBTreeLineIndex(linePtr)
for (nodePtr2 = parentPtr->children.nodePtr; nodePtr2 != nodePtr;
nodePtr2 = nodePtr2->nextPtr) {
if (nodePtr2 == NULL) {
- panic("TkBTreeLineIndex couldn't find node");
+ Tcl_Panic("TkBTreeLinesTo couldn't find node");
}
index += nodePtr2->numLines;
}
}
+ if (textPtr != NULL && textPtr->start != NULL) {
+ index -= TkBTreeLinesTo(NULL, textPtr->start);
+ }
return index;
}
@@ -1049,8 +2002,7 @@ TkBTreeLineIndex(linePtr)
*
* TkBTreeLinkSegment --
*
- * This procedure adds a new segment to a B-tree at a given
- * location.
+ * This function adds a new segment to a B-tree at a given location.
*
* Results:
* None.
@@ -1063,13 +2015,12 @@ TkBTreeLineIndex(linePtr)
/* ARGSUSED */
void
-TkBTreeLinkSegment(segPtr, indexPtr)
- TkTextSegment *segPtr; /* Pointer to new segment to be added to
- * B-tree. Should be completely initialized
- * by caller except for nextPtr field. */
- TkTextIndex *indexPtr; /* Where to add segment: it gets linked
- * in just before the segment indicated
- * here. */
+TkBTreeLinkSegment(
+ TkTextSegment *segPtr, /* Pointer to new segment to be added to
+ * B-tree. Should be completely initialized by
+ * caller except for nextPtr field. */
+ TkTextIndex *indexPtr) /* Where to add segment: it gets linked in
+ * just before the segment indicated here. */
{
register TkTextSegment *prevPtr;
@@ -1085,6 +2036,7 @@ TkBTreeLinkSegment(segPtr, indexPtr)
if (tkBTreeDebug) {
TkBTreeCheck(indexPtr->tree);
}
+ ((BTree *)indexPtr->tree)->stateEpoch++;
}
/*
@@ -1092,34 +2044,42 @@ TkBTreeLinkSegment(segPtr, indexPtr)
*
* TkBTreeUnlinkSegment --
*
- * This procedure unlinks a segment from its line in a B-tree.
+ * This function unlinks a segment from its line in a B-tree.
*
* Results:
* None.
*
* Side effects:
- * SegPtr will be unlinked from linePtr. The segment itself
- * isn't modified by this procedure.
+ * SegPtr will be unlinked from linePtr. The segment itself isn't
+ * modified by this function.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
void
-TkBTreeUnlinkSegment(tree, segPtr, linePtr)
- TkTextBTree tree; /* Tree containing segment. */
- TkTextSegment *segPtr; /* Segment to be unlinked. */
- TkTextLine *linePtr; /* Line that currently contains
- * segment. */
+TkBTreeUnlinkSegment(
+ TkTextSegment *segPtr, /* Segment to be unlinked. */
+ TkTextLine *linePtr) /* Line that currently contains segment. */
{
register TkTextSegment *prevPtr;
if (linePtr->segPtr == segPtr) {
linePtr->segPtr = segPtr->nextPtr;
} else {
- for (prevPtr = linePtr->segPtr; prevPtr->nextPtr != segPtr;
- prevPtr = prevPtr->nextPtr) {
- /* Empty loop body. */
+ prevPtr = linePtr->segPtr;
+ while (prevPtr->nextPtr != segPtr) {
+ prevPtr = prevPtr->nextPtr;
+
+ if (prevPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through
+ * eliding of a newline.
+ */
+
+ linePtr = TkBTreeNextLine(NULL, linePtr);
+ prevPtr = linePtr->segPtr;
+ }
}
prevPtr->nextPtr = segPtr->nextPtr;
}
@@ -1131,44 +2091,44 @@ TkBTreeUnlinkSegment(tree, segPtr, linePtr)
*
* TkBTreeTag --
*
- * Turn a given tag on or off for a given range of characters in
- * a B-tree of text.
+ * Turn a given tag on or off for a given range of characters in a B-tree
+ * of text.
*
* Results:
- * None.
+ * 1 if the tags on any characters in the range were changed, and zero
+ * otherwise (i.e. if the tag was already absent (add = 0) or present
+ * (add = 1) on the index range in question).
*
* Side effects:
- * The given tag is added to the given range of characters
- * in the tree or removed from all those characters, depending
- * on the "add" argument. The structure of the btree is modified
- * enough that index1Ptr and index2Ptr are no longer valid after
- * this procedure returns, and the indexes may be modified by
- * this procedure.
+ * The given tag is added to the given range of characters in the tree or
+ * removed from all those characters, depending on the "add" argument.
+ * The structure of the btree is modified enough that index1Ptr and
+ * index2Ptr are no longer valid after this function returns, and the
+ * indexes may be modified by this function.
*
*----------------------------------------------------------------------
*/
-void
-TkBTreeTag(index1Ptr, index2Ptr, tagPtr, add)
- register TkTextIndex *index1Ptr; /* Indicates first character in
- * range. */
- register TkTextIndex *index2Ptr; /* Indicates character just after the
- * last one in range. */
- TkTextTag *tagPtr; /* Tag to add or remove. */
- int add; /* One means add tag to the given
- * range of characters; zero means
- * remove the tag from the range. */
+int
+TkBTreeTag(
+ register TkTextIndex *index1Ptr,
+ /* Indicates first character in range. */
+ register TkTextIndex *index2Ptr,
+ /* Indicates character just after the last one
+ * in range. */
+ TkTextTag *tagPtr, /* Tag to add or remove. */
+ int add) /* One means add tag to the given range of
+ * characters; zero means remove the tag from
+ * the range. */
{
TkTextSegment *segPtr, *prevPtr;
TkTextSearch search;
TkTextLine *cleanupLinePtr;
- int oldState;
- int changed;
+ int oldState, changed, anyChanges = 0;
/*
- * See whether the tag is present at the start of the range. If
- * the state doesn't already match what we want then add a toggle
- * there.
+ * See whether the tag is present at the start of the range. If the state
+ * doesn't already match what we want then add a toggle there.
*/
oldState = TkBTreeCharTagged(index1Ptr, tagPtr);
@@ -1186,17 +2146,19 @@ TkBTreeTag(index1Ptr, index2Ptr, tagPtr, add)
segPtr->size = 0;
segPtr->body.toggle.tagPtr = tagPtr;
segPtr->body.toggle.inNodeCounts = 0;
+ anyChanges = 1;
}
/*
- * Scan the range of characters and delete any internal tag
- * transitions. Keep track of what the old state was at the end
- * of the range, and add a toggle there if it's needed.
+ * Scan the range of characters and delete any internal tag transitions.
+ * Keep track of what the old state was at the end of the range, and add a
+ * toggle there if it's needed.
*/
TkBTreeStartSearch(index1Ptr, index2Ptr, tagPtr, &search);
cleanupLinePtr = index1Ptr->linePtr;
while (TkBTreeNextTag(&search)) {
+ anyChanges = 1;
oldState ^= 1;
segPtr = search.segPtr;
prevPtr = search.curIndex.linePtr->segPtr;
@@ -1219,24 +2181,24 @@ TkBTreeTag(index1Ptr, index2Ptr, tagPtr, add)
ckfree((char *) segPtr);
/*
- * The code below is a bit tricky. After deleting a toggle
- * we eventually have to call CleanupLine, in order to allow
- * character segments to be merged together. To do this, we
- * remember in cleanupLinePtr a line that needs to be
- * cleaned up, but we don't clean it up until we've moved
- * on to a different line. That way the cleanup process
- * won't goof up segPtr.
+ * The code below is a bit tricky. After deleting a toggle we
+ * eventually have to call CleanupLine, in order to allow character
+ * segments to be merged together. To do this, we remember in
+ * cleanupLinePtr a line that needs to be cleaned up, but we don't
+ * clean it up until we've moved on to a different line. That way the
+ * cleanup process won't goof up segPtr.
*/
if (cleanupLinePtr != search.curIndex.linePtr) {
CleanupLine(cleanupLinePtr);
cleanupLinePtr = search.curIndex.linePtr;
}
+
/*
- * Quick hack. ChangeNodeToggleCount may move the tag's root
- * location around and leave the search in the void. This resets
- * the search.
+ * Quick hack. ChangeNodeToggleCount may move the tag's root location
+ * around and leave the search in the void. This resets the search.
*/
+
if (changed) {
TkBTreeStartSearch(index1Ptr, index2Ptr, tagPtr, &search);
}
@@ -1255,21 +2217,26 @@ TkBTreeTag(index1Ptr, index2Ptr, tagPtr, add)
segPtr->size = 0;
segPtr->body.toggle.tagPtr = tagPtr;
segPtr->body.toggle.inNodeCounts = 0;
+ anyChanges = 1;
}
/*
- * Cleanup cleanupLinePtr and the last line of the range, if
- * these are different.
+ * Cleanup cleanupLinePtr and the last line of the range, if these are
+ * different.
*/
- CleanupLine(cleanupLinePtr);
- if (cleanupLinePtr != index2Ptr->linePtr) {
- CleanupLine(index2Ptr->linePtr);
+ if (anyChanges) {
+ CleanupLine(cleanupLinePtr);
+ if (cleanupLinePtr != index2Ptr->linePtr) {
+ CleanupLine(index2Ptr->linePtr);
+ }
+ ((BTree *)index1Ptr->tree)->stateEpoch++;
}
if (tkBTreeDebug) {
TkBTreeCheck(index1Ptr->tree);
}
+ return anyChanges;
}
/*
@@ -1277,42 +2244,42 @@ TkBTreeTag(index1Ptr, index2Ptr, tagPtr, add)
*
* ChangeNodeToggleCount --
*
- * This procedure increments or decrements the toggle count for
- * a particular tag in a particular node and all its ancestors
- * up to the per-tag root node.
+ * This function increments or decrements the toggle count for a
+ * particular tag in a particular node and all its ancestors up to the
+ * per-tag root node.
*
* Results:
* None.
*
* Side effects:
- * The toggle count for tag is adjusted up or down by "delta" in
- * nodePtr. This routine maintains the tagRootPtr that identifies
- * the root node for the tag, moving it up or down the tree as needed.
+ * The toggle count for tag is adjusted up or down by "delta" in nodePtr.
+ * This routine maintains the tagRootPtr that identifies the root node
+ * for the tag, moving it up or down the tree as needed.
*
*----------------------------------------------------------------------
*/
static void
-ChangeNodeToggleCount(nodePtr, tagPtr, delta)
- register Node *nodePtr; /* Node whose toggle count for a tag
- * must be changed. */
- TkTextTag *tagPtr; /* Information about tag. */
- int delta; /* Amount to add to current toggle
- * count for tag (may be negative). */
+ChangeNodeToggleCount(
+ register Node *nodePtr, /* Node whose toggle count for a tag must be
+ * changed. */
+ TkTextTag *tagPtr, /* Information about tag. */
+ int delta) /* Amount to add to current toggle count for
+ * tag (may be negative). */
{
register Summary *summaryPtr, *prevPtr;
register Node *node2Ptr;
- int rootLevel; /* Level of original tag root */
+ int rootLevel; /* Level of original tag root. */
tagPtr->toggleCount += delta;
- if (tagPtr->tagRootPtr == (Node *) NULL) {
+ if (tagPtr->tagRootPtr == NULL) {
tagPtr->tagRootPtr = nodePtr;
return;
}
/*
- * Note the level of the existing root for the tag so we can detect
- * if it needs to be moved because of the toggle count change.
+ * Note the level of the existing root for the tag so we can detect if it
+ * needs to be moved because of the toggle count change.
*/
rootLevel = tagPtr->tagRootPtr->level;
@@ -1325,10 +2292,10 @@ ChangeNodeToggleCount(nodePtr, tagPtr, delta)
for ( ; nodePtr != tagPtr->tagRootPtr; nodePtr = nodePtr->parentPtr) {
/*
- * See if there's already an entry for this tag for this node. If so,
+ * See if there's already an entry for this tag for this node. If so,
* perhaps all we have to do is adjust its count.
*/
-
+
for (prevPtr = NULL, summaryPtr = nodePtr->summaryPtr;
summaryPtr != NULL;
prevPtr = summaryPtr, summaryPtr = summaryPtr->nextPtr) {
@@ -1349,12 +2316,12 @@ ChangeNodeToggleCount(nodePtr, tagPtr, delta)
* first place).
*/
- panic("ChangeNodeToggleCount: bad toggle count (%d) max (%d)",
+ Tcl_Panic("ChangeNodeToggleCount: bad toggle count (%d) max (%d)",
summaryPtr->toggleCount, tagPtr->toggleCount);
}
-
+
/*
- * Zero toggle count; must remove this tag from the list.
+ * Zero toggle count; must remove this tag from the list.
*/
if (prevPtr == NULL) {
@@ -1367,21 +2334,20 @@ ChangeNodeToggleCount(nodePtr, tagPtr, delta)
/*
* This tag isn't currently in the summary information list.
*/
-
+
if (rootLevel == nodePtr->level) {
-
/*
* The old tag root is at the same level in the tree as this
- * node, but it isn't at this node. Move the tag root up
- * a level, in the hopes that it will now cover this node
- * as well as the old root (if not, we'll move it up again
- * the next time through the loop). To push it up one level
- * we copy the original toggle count into the summary
- * information at the old root and change the root to its
- * parent node.
+ * node, but it isn't at this node. Move the tag root up a
+ * level, in the hopes that it will now cover this node as
+ * well as the old root (if not, we'll move it up again the
+ * next time through the loop). To push it up one level we
+ * copy the original toggle count into the summary information
+ * at the old root and change the root to its parent node.
*/
-
+
Node *rootNodePtr = tagPtr->tagRootPtr;
+
summaryPtr = (Summary *) ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = tagPtr->toggleCount - delta;
@@ -1400,26 +2366,26 @@ ChangeNodeToggleCount(nodePtr, tagPtr, delta)
}
/*
- * If we've decremented the toggle count, then it may be necessary
- * to push the tag root down one or more levels.
+ * If we've decremented the toggle count, then it may be necessary to push
+ * the tag root down one or more levels.
*/
if (delta >= 0) {
return;
}
if (tagPtr->toggleCount == 0) {
- tagPtr->tagRootPtr = (Node *) NULL;
+ tagPtr->tagRootPtr = NULL;
return;
}
nodePtr = tagPtr->tagRootPtr;
while (nodePtr->level > 0) {
/*
- * See if a single child node accounts for all of the tag's
- * toggles. If so, push the root down one level.
+ * See if a single child node accounts for all of the tag's toggles.
+ * If so, push the root down one level.
*/
for (node2Ptr = nodePtr->children.nodePtr;
- node2Ptr != (Node *)NULL ;
+ node2Ptr != NULL ;
node2Ptr = node2Ptr->nextPtr) {
for (prevPtr = NULL, summaryPtr = node2Ptr->summaryPtr;
summaryPtr != NULL;
@@ -1464,10 +2430,10 @@ ChangeNodeToggleCount(nodePtr, tagPtr, delta)
* Find the start of the first range of a tag.
*
* Results:
- * The return value is a pointer to the first tag toggle segment
- * for the tag. This can be either a tagon or tagoff segments because
- * of the way TkBTreeAdd removes a tag.
- * Sets *indexPtr to be the index of the tag toggle.
+ * The return value is a pointer to the first tag toggle segment for the
+ * tag. This can be either a tagon or tagoff segments because of the way
+ * TkBTreeAdd removes a tag. Sets *indexPtr to be the index of the tag
+ * toggle.
*
* Side effects:
* None.
@@ -1476,10 +2442,10 @@ ChangeNodeToggleCount(nodePtr, tagPtr, delta)
*/
static TkTextSegment *
-FindTagStart(tree, tagPtr, indexPtr)
- TkTextBTree tree; /* Tree to search within */
- TkTextTag *tagPtr; /* Tag to search for. */
- TkTextIndex *indexPtr; /* Return - index information */
+FindTagStart(
+ TkTextBTree tree, /* Tree to search within. */
+ TkTextTag *tagPtr, /* Tag to search for. */
+ TkTextIndex *indexPtr) /* Return - index information. */
{
register Node *nodePtr;
register TkTextLine *linePtr;
@@ -1488,17 +2454,17 @@ FindTagStart(tree, tagPtr, indexPtr)
int offset;
nodePtr = tagPtr->tagRootPtr;
- if (nodePtr == (Node *) NULL) {
+ if (nodePtr == NULL) {
return NULL;
}
/*
- * Search from the root of the subtree that contains the tag down
- * to the level 0 node.
+ * Search from the root of the subtree that contains the tag down to the
+ * level 0 node.
*/
while (nodePtr->level > 0) {
- for (nodePtr = nodePtr->children.nodePtr ; nodePtr != (Node *) NULL;
+ for (nodePtr = nodePtr->children.nodePtr ; nodePtr != NULL;
nodePtr = nodePtr->nextPtr) {
for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL;
summaryPtr = summaryPtr->nextPtr) {
@@ -1507,7 +2473,7 @@ FindTagStart(tree, tagPtr, indexPtr)
}
}
}
- gotNodeWithTag:
+ gotNodeWithTag:
continue;
}
@@ -1515,7 +2481,7 @@ FindTagStart(tree, tagPtr, indexPtr)
* Work through the lines attached to the level-0 node.
*/
- for (linePtr = nodePtr->children.linePtr; linePtr != (TkTextLine *) NULL;
+ for (linePtr = nodePtr->children.linePtr; linePtr != NULL;
linePtr = linePtr->nextPtr) {
for (offset = 0, segPtr = linePtr->segPtr ; segPtr != NULL;
offset += segPtr->size, segPtr = segPtr->nextPtr) {
@@ -1523,9 +2489,10 @@ FindTagStart(tree, tagPtr, indexPtr)
|| (segPtr->typePtr == &tkTextToggleOffType))
&& (segPtr->body.toggle.tagPtr == tagPtr)) {
/*
- * It is possible that this is a tagoff tag, but that
- * gets cleaned up later.
+ * It is possible that this is a tagoff tag, but that gets
+ * cleaned up later.
*/
+
indexPtr->tree = tree;
indexPtr->linePtr = linePtr;
indexPtr->byteIndex = offset;
@@ -1544,10 +2511,10 @@ FindTagStart(tree, tagPtr, indexPtr)
* Find the end of the last range of a tag.
*
* Results:
- * The return value is a pointer to the last tag toggle segment
- * for the tag. This can be either a tagon or tagoff segments because
- * of the way TkBTreeAdd removes a tag.
- * Sets *indexPtr to be the index of the tag toggle.
+ * The return value is a pointer to the last tag toggle segment for the
+ * tag. This can be either a tagon or tagoff segments because of the way
+ * TkBTreeAdd removes a tag. Sets *indexPtr to be the index of the tag
+ * toggle.
*
* Side effects:
* None.
@@ -1556,10 +2523,10 @@ FindTagStart(tree, tagPtr, indexPtr)
*/
static TkTextSegment *
-FindTagEnd(tree, tagPtr, indexPtr)
- TkTextBTree tree; /* Tree to search within */
- TkTextTag *tagPtr; /* Tag to search for. */
- TkTextIndex *indexPtr; /* Return - index information */
+FindTagEnd(
+ TkTextBTree tree, /* Tree to search within. */
+ TkTextTag *tagPtr, /* Tag to search for. */
+ TkTextIndex *indexPtr) /* Return - index information. */
{
register Node *nodePtr, *lastNodePtr;
register TkTextLine *linePtr ,*lastLinePtr;
@@ -1568,18 +2535,18 @@ FindTagEnd(tree, tagPtr, indexPtr)
int lastoffset, lastoffset2, offset;
nodePtr = tagPtr->tagRootPtr;
- if (nodePtr == (Node *) NULL) {
+ if (nodePtr == NULL) {
return NULL;
}
/*
- * Search from the root of the subtree that contains the tag down
- * to the level 0 node.
+ * Search from the root of the subtree that contains the tag down to the
+ * level 0 node.
*/
while (nodePtr->level > 0) {
for (lastNodePtr = NULL, nodePtr = nodePtr->children.nodePtr ;
- nodePtr != (Node *) NULL; nodePtr = nodePtr->nextPtr) {
+ nodePtr != NULL; nodePtr = nodePtr->nextPtr) {
for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr->tagPtr == tagPtr) {
@@ -1594,13 +2561,14 @@ FindTagEnd(tree, tagPtr, indexPtr)
/*
* Work through the lines attached to the level-0 node.
*/
+
last2SegPtr = NULL;
lastoffset2 = 0;
lastoffset = 0;
for (lastLinePtr = NULL, linePtr = nodePtr->children.linePtr;
- linePtr != (TkTextLine *) NULL; linePtr = linePtr->nextPtr) {
+ linePtr != NULL; linePtr = linePtr->nextPtr) {
for (offset = 0, lastSegPtr = NULL, segPtr = linePtr->segPtr ;
- segPtr != NULL;
+ segPtr != NULL;
offset += segPtr->size, segPtr = segPtr->nextPtr) {
if (((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType))
@@ -1626,51 +2594,50 @@ FindTagEnd(tree, tagPtr, indexPtr)
*
* TkBTreeStartSearch --
*
- * This procedure sets up a search for tag transitions involving
- * a given tag (or all tags) in a given range of the text.
+ * This function sets up a search for tag transitions involving a given
+ * tag (or all tags) in a given range of the text.
*
* Results:
* None.
*
* Side effects:
- * The information at *searchPtr is set up so that subsequent calls
- * to TkBTreeNextTag or TkBTreePrevTag will return information about the
- * locations of tag transitions. Note that TkBTreeNextTag or
- * TkBTreePrevTag must be called to get the first transition.
- * Note: unlike TkBTreeNextTag and TkBTreePrevTag, this routine does not
- * guarantee that searchPtr->curIndex is equal to *index1Ptr. It may be
+ * The information at *searchPtr is set up so that subsequent calls to
+ * TkBTreeNextTag or TkBTreePrevTag will return information about the
+ * locations of tag transitions. Note that TkBTreeNextTag or
+ * TkBTreePrevTag must be called to get the first transition. Note:
+ * unlike TkBTreeNextTag and TkBTreePrevTag, this routine does not
+ * guarantee that searchPtr->curIndex is equal to *index1Ptr. It may be
* greater than that if *index1Ptr is less than the first tag transition.
*
*----------------------------------------------------------------------
*/
void
-TkBTreeStartSearch(index1Ptr, index2Ptr, tagPtr, searchPtr)
- TkTextIndex *index1Ptr; /* Search starts here. Tag toggles
- * at this position will not be
- * returned. */
- TkTextIndex *index2Ptr; /* Search stops here. Tag toggles
- * at this position *will* be
- * returned. */
- TkTextTag *tagPtr; /* Tag to search for. NULL means
- * search for any tag. */
- register TkTextSearch *searchPtr; /* Where to store information about
- * search's progress. */
+TkBTreeStartSearch(
+ TkTextIndex *index1Ptr, /* Search starts here. Tag toggles at this
+ * position will not be returned. */
+ TkTextIndex *index2Ptr, /* Search stops here. Tag toggles at this
+ * position *will* be returned. */
+ TkTextTag *tagPtr, /* Tag to search for. NULL means search for
+ * any tag. */
+ register TkTextSearch *searchPtr)
+ /* Where to store information about search's
+ * progress. */
{
int offset;
- TkTextIndex index0; /* First index of the tag */
- TkTextSegment *seg0Ptr; /* First segment of the tag */
+ TkTextIndex index0; /* First index of the tag. */
+ TkTextSegment *seg0Ptr; /* First segment of the tag. */
/*
- * Find the segment that contains the first toggle for the tag. This
- * may become the starting point in the search.
+ * Find the segment that contains the first toggle for the tag. This may
+ * become the starting point in the search.
*/
seg0Ptr = FindTagStart(index1Ptr->tree, tagPtr, &index0);
- if (seg0Ptr == (TkTextSegment *) NULL) {
+ if (seg0Ptr == NULL) {
/*
- * Even though there are no toggles, the display code still
- * uses the search curIndex, so initialize that anyway.
+ * Even though there are no toggles, the display code still uses the
+ * search curIndex, so initialize that anyway.
*/
searchPtr->linesLeft = 0;
@@ -1681,12 +2648,12 @@ TkBTreeStartSearch(index1Ptr, index2Ptr, tagPtr, searchPtr)
}
if (TkTextIndexCmp(index1Ptr, &index0) < 0) {
/*
- * Adjust start of search up to the first range of the tag
+ * Adjust start of search up to the first range of the tag.
*/
searchPtr->curIndex = index0;
searchPtr->segPtr = NULL;
- searchPtr->nextPtr = seg0Ptr; /* Will be returned by NextTag */
+ searchPtr->nextPtr = seg0Ptr; /* Will be returned by NextTag. */
index1Ptr = &index0;
} else {
searchPtr->curIndex = *index1Ptr;
@@ -1694,23 +2661,24 @@ TkBTreeStartSearch(index1Ptr, index2Ptr, tagPtr, searchPtr)
searchPtr->nextPtr = TkTextIndexToSeg(index1Ptr, &offset);
searchPtr->curIndex.byteIndex -= offset;
}
- searchPtr->lastPtr = TkTextIndexToSeg(index2Ptr, (int *) NULL);
+ searchPtr->lastPtr = TkTextIndexToSeg(index2Ptr, NULL);
searchPtr->tagPtr = tagPtr;
- searchPtr->linesLeft = TkBTreeLineIndex(index2Ptr->linePtr) + 1
- - TkBTreeLineIndex(index1Ptr->linePtr);
+ searchPtr->linesLeft = TkBTreeLinesTo(NULL, index2Ptr->linePtr) + 1
+ - TkBTreeLinesTo(NULL, index1Ptr->linePtr);
searchPtr->allTags = (tagPtr == NULL);
if (searchPtr->linesLeft == 1) {
/*
* Starting and stopping segments are in the same line; mark the
* search as over immediately if the second segment is before the
- * first. A search does not return a toggle at the very start of
- * the range, unless the range is artificially moved up to index0.
+ * first. A search does not return a toggle at the very start of the
+ * range, unless the range is artificially moved up to index0.
*/
- if (((index1Ptr == &index0) &&
+
+ if (((index1Ptr == &index0) &&
(index1Ptr->byteIndex > index2Ptr->byteIndex)) ||
- ((index1Ptr != &index0) &&
+ ((index1Ptr != &index0) &&
(index1Ptr->byteIndex >= index2Ptr->byteIndex))) {
- searchPtr->linesLeft = 0;
+ searchPtr->linesLeft = 0;
}
}
}
@@ -1720,55 +2688,53 @@ TkBTreeStartSearch(index1Ptr, index2Ptr, tagPtr, searchPtr)
*
* TkBTreeStartSearchBack --
*
- * This procedure sets up a search backwards for tag transitions involving
- * a given tag (or all tags) in a given range of the text. In the
- * normal case the first index (*index1Ptr) is beyond the second
- * index (*index2Ptr).
- *
+ * This function sets up a search backwards for tag transitions involving
+ * a given tag (or all tags) in a given range of the text. In the normal
+ * case the first index (*index1Ptr) is beyond the second index
+ * (*index2Ptr).
*
* Results:
* None.
*
* Side effects:
- * The information at *searchPtr is set up so that subsequent calls
- * to TkBTreePrevTag will return information about the
- * locations of tag transitions. Note that TkBTreePrevTag must be called
- * to get the first transition.
- * Note: unlike TkBTreeNextTag and TkBTreePrevTag, this routine does not
- * guarantee that searchPtr->curIndex is equal to *index1Ptr. It may be
- * less than that if *index1Ptr is greater than the last tag transition.
+ * The information at *searchPtr is set up so that subsequent calls to
+ * TkBTreePrevTag will return information about the locations of tag
+ * transitions. Note that TkBTreePrevTag must be called to get the first
+ * transition. Note: unlike TkBTreeNextTag and TkBTreePrevTag, this
+ * routine does not guarantee that searchPtr->curIndex is equal to
+ * *index1Ptr. It may be less than that if *index1Ptr is greater than the
+ * last tag transition.
*
*----------------------------------------------------------------------
*/
void
-TkBTreeStartSearchBack(index1Ptr, index2Ptr, tagPtr, searchPtr)
- TkTextIndex *index1Ptr; /* Search starts here. Tag toggles
- * at this position will not be
- * returned. */
- TkTextIndex *index2Ptr; /* Search stops here. Tag toggles
- * at this position *will* be
- * returned. */
- TkTextTag *tagPtr; /* Tag to search for. NULL means
- * search for any tag. */
- register TkTextSearch *searchPtr; /* Where to store information about
- * search's progress. */
+TkBTreeStartSearchBack(
+ TkTextIndex *index1Ptr, /* Search starts here. Tag toggles at this
+ * position will not be returned. */
+ TkTextIndex *index2Ptr, /* Search stops here. Tag toggles at this
+ * position *will* be returned. */
+ TkTextTag *tagPtr, /* Tag to search for. NULL means search for
+ * any tag. */
+ register TkTextSearch *searchPtr)
+ /* Where to store information about search's
+ * progress. */
{
int offset;
- TkTextIndex index0; /* Last index of the tag */
- TkTextIndex backOne; /* One character before starting index */
- TkTextSegment *seg0Ptr; /* Last segment of the tag */
+ TkTextIndex index0; /* Last index of the tag. */
+ TkTextIndex backOne; /* One character before starting index. */
+ TkTextSegment *seg0Ptr; /* Last segment of the tag. */
/*
- * Find the segment that contains the last toggle for the tag. This
- * may become the starting point in the search.
+ * Find the segment that contains the last toggle for the tag. This may
+ * become the starting point in the search.
*/
seg0Ptr = FindTagEnd(index1Ptr->tree, tagPtr, &index0);
- if (seg0Ptr == (TkTextSegment *) NULL) {
+ if (seg0Ptr == NULL) {
/*
- * Even though there are no toggles, the display code still
- * uses the search curIndex, so initialize that anyway.
+ * Even though there are no toggles, the display code still uses the
+ * search curIndex, so initialize that anyway.
*/
searchPtr->linesLeft = 0;
@@ -1787,28 +2753,29 @@ TkBTreeStartSearchBack(index1Ptr, index2Ptr, tagPtr, searchPtr)
searchPtr->curIndex = index0;
index1Ptr = &index0;
} else {
- TkTextIndexBackChars(index1Ptr, 1, &searchPtr->curIndex);
+ TkTextIndexBackChars(NULL, index1Ptr, 1, &searchPtr->curIndex,
+ COUNT_INDICES);
}
searchPtr->segPtr = NULL;
searchPtr->nextPtr = TkTextIndexToSeg(&searchPtr->curIndex, &offset);
searchPtr->curIndex.byteIndex -= offset;
/*
- * Adjust the end of the search so it does find toggles that are right
- * at the second index specified by the user.
+ * Adjust the end of the search so it does find toggles that are right at
+ * the second index specified by the user.
*/
- if ((TkBTreeLineIndex(index2Ptr->linePtr) == 0) &&
+ if ((TkBTreeLinesTo(NULL, index2Ptr->linePtr) == 0) &&
(index2Ptr->byteIndex == 0)) {
backOne = *index2Ptr;
- searchPtr->lastPtr = NULL; /* Signals special case for 1.0 */
+ searchPtr->lastPtr = NULL; /* Signals special case for 1.0. */
} else {
- TkTextIndexBackChars(index2Ptr, 1, &backOne);
- searchPtr->lastPtr = TkTextIndexToSeg(&backOne, (int *) NULL);
+ TkTextIndexBackChars(NULL, index2Ptr, 1, &backOne, COUNT_INDICES);
+ searchPtr->lastPtr = TkTextIndexToSeg(&backOne, NULL);
}
searchPtr->tagPtr = tagPtr;
- searchPtr->linesLeft = TkBTreeLineIndex(index1Ptr->linePtr) + 1
- - TkBTreeLineIndex(backOne.linePtr);
+ searchPtr->linesLeft = TkBTreeLinesTo(NULL, index1Ptr->linePtr) + 1
+ - TkBTreeLinesTo(NULL, backOne.linePtr);
searchPtr->allTags = (tagPtr == NULL);
if (searchPtr->linesLeft == 1) {
/*
@@ -1828,18 +2795,18 @@ TkBTreeStartSearchBack(index1Ptr, index2Ptr, tagPtr, searchPtr)
*
* TkBTreeNextTag --
*
- * Once a tag search has begun, successive calls to this procedure
- * return successive tag toggles. Note: it is NOT SAFE to call this
- * procedure if characters have been inserted into or deleted from
- * the B-tree since the call to TkBTreeStartSearch.
+ * Once a tag search has begun, successive calls to this function return
+ * successive tag toggles. Note: it is NOT SAFE to call this function if
+ * characters have been inserted into or deleted from the B-tree since
+ * the call to TkBTreeStartSearch.
*
* Results:
* The return value is 1 if another toggle was found that met the
- * criteria specified in the call to TkBTreeStartSearch; in this
- * case searchPtr->curIndex gives the toggle's position and
- * searchPtr->curTagPtr points to its segment. 0 is returned if
- * no more matching tag transitions were found; in this case
- * searchPtr->curIndex is the same as searchPtr->stopIndex.
+ * criteria specified in the call to TkBTreeStartSearch; in this case
+ * searchPtr->curIndex gives the toggle's position and
+ * searchPtr->curTagPtr points to its segment. 0 is returned if no more
+ * matching tag transitions were found; in this case searchPtr->curIndex
+ * is the same as searchPtr->stopIndex.
*
* Side effects:
* Information in *searchPtr is modified to update the state of the
@@ -1849,10 +2816,11 @@ TkBTreeStartSearchBack(index1Ptr, index2Ptr, tagPtr, searchPtr)
*/
int
-TkBTreeNextTag(searchPtr)
- register TkTextSearch *searchPtr; /* Information about search in
- * progress; must have been set up by
- * call to TkBTreeStartSearch. */
+TkBTreeNextTag(
+ register TkTextSearch *searchPtr)
+ /* Information about search in progress; must
+ * have been set up by call to
+ * TkBTreeStartSearch. */
{
register TkTextSegment *segPtr;
register Node *nodePtr;
@@ -1863,9 +2831,9 @@ TkBTreeNextTag(searchPtr)
}
/*
- * The outermost loop iterates over lines that may potentially contain
- * a relevant tag transition, starting from the current segment in
- * the current line.
+ * The outermost loop iterates over lines that may potentially contain a
+ * relevant tag transition, starting from the current segment in the
+ * current line.
*/
segPtr = searchPtr->nextPtr;
@@ -1889,11 +2857,10 @@ TkBTreeNextTag(searchPtr)
}
searchPtr->curIndex.byteIndex += segPtr->size;
}
-
+
/*
* See if there are more lines associated with the current parent
- * node. If so, go back to the top of the loop to search the next
- * one.
+ * node. If so, go back to the top of the loop to search the next one.
*/
nodePtr = searchPtr->curIndex.linePtr->parentPtr;
@@ -1910,14 +2877,14 @@ TkBTreeNextTag(searchPtr)
if (nodePtr == searchPtr->tagPtr->tagRootPtr) {
goto searchOver;
}
-
+
/*
* Search across and up through the B-tree's node hierarchy looking
* for the next node that has a relevant tag transition somewhere in
- * its subtree. Be sure to update linesLeft as we skip over large
+ * its subtree. Be sure to update linesLeft as we skip over large
* chunks of lines.
*/
-
+
while (1) {
while (nodePtr->nextPtr == NULL) {
if (nodePtr->parentPtr == NULL ||
@@ -1936,14 +2903,14 @@ TkBTreeNextTag(searchPtr)
}
searchPtr->linesLeft -= nodePtr->numLines;
}
-
+
/*
* At this point we've found a subtree that has a relevant tag
- * transition. Now search down (and across) through that subtree
- * to find the first level-0 node that has a relevant tag transition.
+ * transition. Now search down (and across) through that subtree to
+ * find the first level-0 node that has a relevant tag transition.
*/
-
- gotNodeWithTag:
+
+ gotNodeWithTag:
while (nodePtr->level > 0) {
for (nodePtr = nodePtr->children.nodePtr; ;
nodePtr = nodePtr->nextPtr) {
@@ -1951,21 +2918,25 @@ TkBTreeNextTag(searchPtr)
summaryPtr = summaryPtr->nextPtr) {
if ((searchPtr->allTags)
|| (summaryPtr->tagPtr == searchPtr->tagPtr)) {
+ /*
+ * Would really like a multi-level continue here...
+ */
+
goto nextChild;
}
}
searchPtr->linesLeft -= nodePtr->numLines;
if (nodePtr->nextPtr == NULL) {
- panic("TkBTreeNextTag found incorrect tag summary info.");
+ Tcl_Panic("TkBTreeNextTag found incorrect tag summary info.");
}
}
- nextChild:
+ nextChild:
continue;
}
-
+
/*
* Now we're down to a level-0 node that contains a line that contains
- * a relevant tag transition. Set up line information and go back to
+ * a relevant tag transition. Set up line information and go back to
* the beginning of the loop to search through lines.
*/
@@ -1978,7 +2949,7 @@ TkBTreeNextTag(searchPtr)
continue;
}
- searchOver:
+ searchOver:
searchPtr->linesLeft = 0;
searchPtr->segPtr = NULL;
return 0;
@@ -1989,19 +2960,18 @@ TkBTreeNextTag(searchPtr)
*
* TkBTreePrevTag --
*
- * Once a tag search has begun, successive calls to this procedure
- * return successive tag toggles in the reverse direction.
- * Note: it is NOT SAFE to call this
- * procedure if characters have been inserted into or deleted from
- * the B-tree since the call to TkBTreeStartSearch.
+ * Once a tag search has begun, successive calls to this function return
+ * successive tag toggles in the reverse direction. Note: it is NOT SAFE
+ * to call this function if characters have been inserted into or deleted
+ * from the B-tree since the call to TkBTreeStartSearch.
*
* Results:
* The return value is 1 if another toggle was found that met the
- * criteria specified in the call to TkBTreeStartSearch; in this
- * case searchPtr->curIndex gives the toggle's position and
- * searchPtr->curTagPtr points to its segment. 0 is returned if
- * no more matching tag transitions were found; in this case
- * searchPtr->curIndex is the same as searchPtr->stopIndex.
+ * criteria specified in the call to TkBTreeStartSearch; in this case
+ * searchPtr->curIndex gives the toggle's position and
+ * searchPtr->curTagPtr points to its segment. 0 is returned if no more
+ * matching tag transitions were found; in this case searchPtr->curIndex
+ * is the same as searchPtr->stopIndex.
*
* Side effects:
* Information in *searchPtr is modified to update the state of the
@@ -2011,43 +2981,46 @@ TkBTreeNextTag(searchPtr)
*/
int
-TkBTreePrevTag(searchPtr)
- register TkTextSearch *searchPtr; /* Information about search in
- * progress; must have been set up by
- * call to TkBTreeStartSearch. */
+TkBTreePrevTag(
+ register TkTextSearch *searchPtr)
+ /* Information about search in progress; must
+ * have been set up by call to
+ * TkBTreeStartSearch. */
{
register TkTextSegment *segPtr, *prevPtr;
register TkTextLine *linePtr, *prevLinePtr;
register Node *nodePtr, *node2Ptr, *prevNodePtr;
register Summary *summaryPtr;
- int byteIndex;
- int pastLast; /* Saw last marker during scan */
- int linesSkipped;
+ int byteIndex, linesSkipped;
+ int pastLast; /* Saw last marker during scan. */
if (searchPtr->linesLeft <= 0) {
goto searchOver;
}
/*
- * The outermost loop iterates over lines that may potentially contain
- * a relevant tag transition, starting from the current segment in
- * the current line. "nextPtr" is maintained as the last segment in
- * a line that we can look at.
+ * The outermost loop iterates over lines that may potentially contain a
+ * relevant tag transition, starting from the current segment in the
+ * current line. "nextPtr" is maintained as the last segment in a line
+ * that we can look at.
*/
while (1) {
/*
* Check for the last toggle before the current segment on this line.
*/
+
byteIndex = 0;
if (searchPtr->lastPtr == NULL) {
- /*
+ /*
* Search back to the very beginning, so pastLast is irrelevent.
*/
- pastLast = 1;
+
+ pastLast = 1;
} else {
pastLast = 0;
}
+
for (prevPtr = NULL, segPtr = searchPtr->curIndex.linePtr->segPtr ;
segPtr != NULL && segPtr != searchPtr->nextPtr;
segPtr = segPtr->nextPtr) {
@@ -2059,7 +3032,8 @@ TkBTreePrevTag(searchPtr)
searchPtr->curIndex.byteIndex = byteIndex;
}
if (segPtr == searchPtr->lastPtr) {
- prevPtr = NULL; /* Segments earlier than last don't count */
+ prevPtr = NULL; /* Segments earlier than last don't
+ * count. */
pastLast = 1;
}
byteIndex += segPtr->size;
@@ -2067,9 +3041,10 @@ TkBTreePrevTag(searchPtr)
if (prevPtr != NULL) {
if (searchPtr->linesLeft == 1 && !pastLast) {
/*
- * We found a segment that is before the stopping index.
- * Note that it is OK if prevPtr == lastPtr.
+ * We found a segment that is before the stopping index. Note
+ * that it is OK if prevPtr == lastPtr.
*/
+
goto searchOver;
}
searchPtr->segPtr = prevPtr;
@@ -2077,7 +3052,7 @@ TkBTreePrevTag(searchPtr)
searchPtr->tagPtr = prevPtr->body.toggle.tagPtr;
return 1;
}
-
+
searchPtr->linesLeft--;
if (searchPtr->linesLeft <= 0) {
goto searchOver;
@@ -2085,7 +3060,7 @@ TkBTreePrevTag(searchPtr)
/*
* See if there are more lines associated with the current parent
- * node. If so, go back to the top of the loop to search the previous
+ * node. If so, go back to the top of the loop to search the previous
* one.
*/
@@ -2103,17 +3078,17 @@ TkBTreePrevTag(searchPtr)
if (nodePtr == searchPtr->tagPtr->tagRootPtr) {
goto searchOver;
}
-
+
/*
* Search across and up through the B-tree's node hierarchy looking
- * for the previous node that has a relevant tag transition somewhere in
- * its subtree. The search and line counting is trickier with/out
- * back pointers. We'll scan all the nodes under a parent up to
- * the current node, searching all of them for tag state. The last
- * one we find, if any, is recorded in prevNodePtr, and any nodes
- * past prevNodePtr that don't have tag state increment linesSkipped.
+ * for the previous node that has a relevant tag transition somewhere
+ * in its subtree. The search and line counting is trickier with/out
+ * back pointers. We'll scan all the nodes under a parent up to the
+ * current node, searching all of them for tag state. The last one we
+ * find, if any, is recorded in prevNodePtr, and any nodes past
+ * prevNodePtr that don't have tag state increment linesSkipped.
*/
-
+
while (1) {
for (prevNodePtr = NULL, linesSkipped = 0,
node2Ptr = nodePtr->parentPtr->children.nodePtr ;
@@ -2129,7 +3104,7 @@ TkBTreePrevTag(searchPtr)
}
linesSkipped += node2Ptr->numLines;
- keepLooking:
+ keepLooking:
continue;
}
if (prevNodePtr != NULL) {
@@ -2143,14 +3118,14 @@ TkBTreePrevTag(searchPtr)
goto searchOver;
}
}
-
+
/*
* At this point we've found a subtree that has a relevant tag
- * transition. Now search down (and across) through that subtree
- * to find the last level-0 node that has a relevant tag transition.
+ * transition. Now search down (and across) through that subtree to
+ * find the last level-0 node that has a relevant tag transition.
*/
-
- gotNodeWithTag:
+
+ gotNodeWithTag:
while (nodePtr->level > 0) {
for (linesSkipped = 0, prevNodePtr = NULL,
nodePtr = nodePtr->children.nodePtr; nodePtr != NULL ;
@@ -2166,20 +3141,20 @@ TkBTreePrevTag(searchPtr)
}
linesSkipped += nodePtr->numLines;
- keepLooking2:
+ keepLooking2:
continue;
}
if (prevNodePtr == NULL) {
- panic("TkBTreePrevTag found incorrect tag summary info.");
+ Tcl_Panic("TkBTreePrevTag found incorrect tag summary info.");
}
searchPtr->linesLeft -= linesSkipped;
nodePtr = prevNodePtr;
}
-
+
/*
* Now we're down to a level-0 node that contains a line that contains
- * a relevant tag transition. Set up line information and go back to
- * the beginning of the loop to search through lines. We start with
+ * a relevant tag transition. Set up line information and go back to
+ * the beginning of the loop to search through lines. We start with
* the last line below the node.
*/
@@ -2196,7 +3171,7 @@ TkBTreePrevTag(searchPtr)
continue;
}
- searchOver:
+ searchOver:
searchPtr->linesLeft = 0;
searchPtr->segPtr = NULL;
return 0;
@@ -2210,8 +3185,8 @@ TkBTreePrevTag(searchPtr)
* Determine whether a particular character has a particular tag.
*
* Results:
- * The return value is 1 if the given tag is in effect at the
- * character given by linePtr and ch, and 0 otherwise.
+ * The return value is 1 if the given tag is in effect at the character
+ * given by linePtr and ch, and 0 otherwise.
*
* Side effects:
* None.
@@ -2220,10 +3195,10 @@ TkBTreePrevTag(searchPtr)
*/
int
-TkBTreeCharTagged(indexPtr, tagPtr)
- TkTextIndex *indexPtr; /* Indicates a character position at
- * which to check for a tag. */
- TkTextTag *tagPtr; /* Tag of interest. */
+TkBTreeCharTagged(
+ const TkTextIndex *indexPtr,/* Indicates a character position at which to
+ * check for a tag. */
+ TkTextTag *tagPtr) /* Tag of interest. */
{
register Node *nodePtr;
register TkTextLine *siblingLinePtr;
@@ -2231,10 +3206,10 @@ TkBTreeCharTagged(indexPtr, tagPtr)
TkTextSegment *toggleSegPtr;
int toggles, index;
- /*
- * Check for toggles for the tag in indexPtr's line but before
- * indexPtr. If there is one, its type indicates whether or
- * not the character is tagged.
+ /*
+ * Check for toggles for the tag in indexPtr's line but before indexPtr.
+ * If there is one, its type indicates whether or not the character is
+ * tagged.
*/
toggleSegPtr = NULL;
@@ -2252,9 +3227,8 @@ TkBTreeCharTagged(indexPtr, tagPtr)
}
/*
- * No toggle in this line. Look for toggles for the tag in lines
- * that are predecessors of indexPtr->linePtr but under the same
- * level-0 node.
+ * No toggle in this line. Look for toggles for the tag in lines that are
+ * predecessors of indexPtr->linePtr but under the same level-0 node.
*/
for (siblingLinePtr = indexPtr->linePtr->parentPtr->children.linePtr;
@@ -2274,9 +3248,9 @@ TkBTreeCharTagged(indexPtr, tagPtr)
}
/*
- * No toggle in this node. Scan upwards through the ancestors of
- * this node, counting the number of toggles of the given tag in
- * siblings that precede that node.
+ * No toggle in this node. Scan upwards through the ancestors of this
+ * node, counting the number of toggles of the given tag in siblings that
+ * precede that node.
*/
toggles = 0;
@@ -2285,7 +3259,7 @@ TkBTreeCharTagged(indexPtr, tagPtr)
register Node *siblingPtr;
register Summary *summaryPtr;
- for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
+ for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
for (summaryPtr = siblingPtr->summaryPtr; summaryPtr != NULL;
summaryPtr = summaryPtr->nextPtr) {
@@ -2300,8 +3274,8 @@ TkBTreeCharTagged(indexPtr, tagPtr)
}
/*
- * An odd number of toggles means that the tag is present at the
- * given point.
+ * An odd number of toggles means that the tag is present at the given
+ * point.
*/
return toggles & 1;
@@ -2312,17 +3286,17 @@ TkBTreeCharTagged(indexPtr, tagPtr)
*
* TkBTreeGetTags --
*
- * Return information about all of the tags that are associated
- * with a particular character in a B-tree of text.
+ * Return information about all of the tags that are associated with a
+ * particular character in a B-tree of text.
*
* Results:
* The return value is a malloc-ed array containing pointers to
- * information for each of the tags that is associated with
- * the character at the position given by linePtr and ch. The
- * word at *numTagsPtr is filled in with the number of pointers
- * in the array. It is up to the caller to free the array by
- * passing it to free. If there are no tags at the given character
- * then a NULL pointer is returned and *numTagsPtr will be set to 0.
+ * information for each of the tags that is associated with the character
+ * at the position given by linePtr and ch. The word at *numTagsPtr is
+ * filled in with the number of pointers in the array. It is up to the
+ * caller to free the array by passing it to free. If there are no tags
+ * at the given character then a NULL pointer is returned and *numTagsPtr
+ * will be set to 0.
*
* Side effects:
* None.
@@ -2332,38 +3306,54 @@ TkBTreeCharTagged(indexPtr, tagPtr)
/* ARGSUSED */
TkTextTag **
-TkBTreeGetTags(indexPtr, numTagsPtr)
- TkTextIndex *indexPtr; /* Indicates a particular position in
- * the B-tree. */
- int *numTagsPtr; /* Store number of tags found at this
+TkBTreeGetTags(
+ const TkTextIndex *indexPtr,/* Indicates a particular position in the
+ * B-tree. */
+ const TkText *textPtr, /* If non-NULL, then only return tags for this
+ * text widget (when there are peer
+ * widgets). */
+ int *numTagsPtr) /* Store number of tags found at this
* location. */
{
register Node *nodePtr;
register TkTextLine *siblingLinePtr;
register TkTextSegment *segPtr;
+ TkTextLine *linePtr;
int src, dst, index;
TagInfo tagInfo;
#define NUM_TAG_INFOS 10
tagInfo.numTags = 0;
tagInfo.arraySize = NUM_TAG_INFOS;
- tagInfo.tagPtrs = (TkTextTag **) ckalloc((unsigned)
- NUM_TAG_INFOS*sizeof(TkTextTag *));
- tagInfo.counts = (int *) ckalloc((unsigned)
- NUM_TAG_INFOS*sizeof(int));
+ tagInfo.tagPtrs = (TkTextTag **)
+ ckalloc((unsigned) NUM_TAG_INFOS * sizeof(TkTextTag *));
+ tagInfo.counts = (int *)
+ ckalloc((unsigned) NUM_TAG_INFOS * sizeof(int));
/*
- * Record tag toggles within the line of indexPtr but preceding
- * indexPtr.
+ * Record tag toggles within the line of indexPtr but preceding indexPtr.
*/
- for (index = 0, segPtr = indexPtr->linePtr->segPtr;
- (index + segPtr->size) <= indexPtr->byteIndex;
- index += segPtr->size, segPtr = segPtr->nextPtr) {
+ linePtr = indexPtr->linePtr;
+ index = 0;
+ segPtr = linePtr->segPtr;
+ while ((index + segPtr->size) <= indexPtr->byteIndex) {
if ((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType)) {
IncCount(segPtr->body.toggle.tagPtr, 1, &tagInfo);
}
+ index += segPtr->size;
+ segPtr = segPtr->nextPtr;
+
+ if (segPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through eliding
+ * of a newline.
+ */
+
+ linePtr = TkBTreeNextLine(NULL, linePtr);
+ segPtr = linePtr->segPtr;
+ }
}
/*
@@ -2384,8 +3374,8 @@ TkBTreeGetTags(indexPtr, numTagsPtr)
}
/*
- * For each node in the ancestry of this line, record tag toggles
- * for all siblings that precede that node.
+ * For each node in the ancestry of this line, record tag toggles for all
+ * siblings that precede that node.
*/
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
@@ -2393,7 +3383,7 @@ TkBTreeGetTags(indexPtr, numTagsPtr)
register Node *siblingPtr;
register Summary *summaryPtr;
- for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
+ for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
for (summaryPtr = siblingPtr->summaryPtr; summaryPtr != NULL;
summaryPtr = summaryPtr->nextPtr) {
@@ -2406,15 +3396,20 @@ TkBTreeGetTags(indexPtr, numTagsPtr)
}
/*
- * Go through the tag information and squash out all of the tags
- * that have even toggle counts (these tags exist before the point
- * of interest, but not at the desired character itself).
+ * Go through the tag information and squash out all of the tags that have
+ * even toggle counts (these tags exist before the point of interest, but
+ * not at the desired character itself). Also squash out all tags that
+ * don't belong to the requested widget.
*/
for (src = 0, dst = 0; src < tagInfo.numTags; src++) {
if (tagInfo.counts[src] & 1) {
- tagInfo.tagPtrs[dst] = tagInfo.tagPtrs[src];
- dst++;
+ const TkText *tagTextPtr = tagInfo.tagPtrs[src]->textPtr;
+
+ if (tagTextPtr==NULL || textPtr==NULL || tagTextPtr==textPtr) {
+ tagInfo.tagPtrs[dst] = tagInfo.tagPtrs[src];
+ dst++;
+ }
}
}
*numTagsPtr = dst;
@@ -2432,14 +3427,25 @@ TkBTreeGetTags(indexPtr, numTagsPtr)
* TkTextIsElided --
*
* Special case to just return information about elided attribute.
- * Specialized from TkBTreeGetTags(indexPtr, numTagsPtr)
- * and GetStyle(textPtr, indexPtr).
- * Just need to keep track of invisibility settings for each priority,
- * pick highest one active at end
+ * Specialized from TkBTreeGetTags(indexPtr, textPtr, numTagsPtr) and
+ * GetStyle(textPtr, indexPtr). Just need to keep track of invisibility
+ * settings for each priority, pick highest one active at end.
+ *
+ * Note that this returns all elide information up to and including the
+ * given index (quite obviously). However, this does mean that if
+ * indexPtr is a line-start and one then iterates from the beginning of
+ * that line forwards, one will actually revisit the segPtrs of size zero
+ * (for tag toggling, for example) which have already been seen here.
+ *
+ * For this reason we fill in the fields 'segPtr' and 'segOffset' of
+ * elideInfo, enabling our caller easily to calculate incremental changes
+ * from where we left off.
*
* Results:
* Returns whether this text should be elided or not.
*
+ * Optionally returns more detailed information in elideInfo.
+ *
* Side effects:
* None.
*
@@ -2448,93 +3454,129 @@ TkBTreeGetTags(indexPtr, numTagsPtr)
/* ARGSUSED */
int
-TkTextIsElided(textPtr, indexPtr)
- TkText *textPtr; /* Overall information about text widget. */
- TkTextIndex *indexPtr; /* The character in the text for which
- * display information is wanted. */
+TkTextIsElided(
+ const TkText *textPtr, /* Overall information about text widget. */
+ const TkTextIndex *indexPtr,/* The character in the text for which display
+ * information is wanted. */
+ TkTextElideInfo *elideInfo) /* NULL or a pointer to a structure in which
+ * indexPtr's elide state will be stored and
+ * returned. */
{
-#define LOTSA_TAGS 1000
- int elide = 0; /* if nobody says otherwise, it's visible */
-
- int deftagCnts[LOTSA_TAGS];
- int *tagCnts = deftagCnts;
- TkTextTag *deftagPtrs[LOTSA_TAGS];
- TkTextTag **tagPtrs = deftagPtrs;
- int numTags = textPtr->numTags;
register Node *nodePtr;
register TkTextLine *siblingLinePtr;
register TkTextSegment *segPtr;
- register TkTextTag *tagPtr = NULL; /* silence gcc 4 warning */
+ register TkTextTag *tagPtr = NULL;
register int i, index;
+ register TkTextElideInfo *infoPtr;
+ TkTextLine *linePtr;
+ int elide;
- /* almost always avoid malloc, so stay out of system calls */
- if (LOTSA_TAGS < numTags) {
- tagCnts = (int *)ckalloc((unsigned)sizeof(int) * numTags);
- tagPtrs = (TkTextTag **)ckalloc((unsigned)sizeof(TkTextTag *) * numTags);
+ if (elideInfo == NULL) {
+ infoPtr = (TkTextElideInfo *)
+ ckalloc((unsigned) sizeof(TkTextElideInfo));
+ } else {
+ infoPtr = elideInfo;
}
-
- for (i=0; i<numTags; i++) {
- tagCnts[i] = 0;
+
+ infoPtr->elide = 0; /* If nobody says otherwise, it's visible. */
+ infoPtr->tagCnts = infoPtr->deftagCnts;
+ infoPtr->tagPtrs = infoPtr->deftagPtrs;
+ infoPtr->numTags = textPtr->sharedTextPtr->numTags;
+
+ /*
+ * Almost always avoid malloc, so stay out of system calls.
+ */
+
+ if (LOTSA_TAGS < infoPtr->numTags) {
+ infoPtr->tagCnts = (int *)
+ ckalloc((unsigned) sizeof(int) * infoPtr->numTags);
+ infoPtr->tagPtrs = (TkTextTag **)
+ ckalloc((unsigned) sizeof(TkTextTag *) * infoPtr->numTags);
+ }
+
+ for (i=0; i<infoPtr->numTags; i++) {
+ infoPtr->tagCnts[i] = 0;
}
/*
- * Record tag toggles within the line of indexPtr but preceding
- * indexPtr.
+ * Record tag toggles within the line of indexPtr but preceding indexPtr.
*/
- for (index = 0, segPtr = indexPtr->linePtr->segPtr;
- (index + segPtr->size) <= indexPtr->byteIndex;
- index += segPtr->size, segPtr = segPtr->nextPtr) {
+ index = 0;
+ linePtr = indexPtr->linePtr;
+ segPtr = linePtr->segPtr;
+ while ((index + segPtr->size) <= indexPtr->byteIndex) {
if ((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType)) {
tagPtr = segPtr->body.toggle.tagPtr;
if (tagPtr->elideString != NULL) {
- tagPtrs[tagPtr->priority] = tagPtr;
- tagCnts[tagPtr->priority]++;
+ infoPtr->tagPtrs[tagPtr->priority] = tagPtr;
+ infoPtr->tagCnts[tagPtr->priority]++;
}
}
+
+ index += segPtr->size;
+ segPtr = segPtr->nextPtr;
+ if (segPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through eliding
+ * of a newline.
+ */
+
+ linePtr = TkBTreeNextLine(NULL, linePtr);
+ segPtr = linePtr->segPtr;
+ }
}
/*
+ * Store the first segPtr we haven't examined completely so that our
+ * caller knows where to start.
+ */
+
+ infoPtr->segPtr = segPtr;
+ infoPtr->segOffset = index;
+
+ /*
* Record toggles for tags in lines that are predecessors of
* indexPtr->linePtr but under the same level-0 node.
*/
for (siblingLinePtr = indexPtr->linePtr->parentPtr->children.linePtr;
- siblingLinePtr != indexPtr->linePtr;
- siblingLinePtr = siblingLinePtr->nextPtr) {
+ siblingLinePtr != indexPtr->linePtr;
+ siblingLinePtr = siblingLinePtr->nextPtr) {
for (segPtr = siblingLinePtr->segPtr; segPtr != NULL;
- segPtr = segPtr->nextPtr) {
+ segPtr = segPtr->nextPtr) {
if ((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType)) {
tagPtr = segPtr->body.toggle.tagPtr;
if (tagPtr->elideString != NULL) {
- tagPtrs[tagPtr->priority] = tagPtr;
- tagCnts[tagPtr->priority]++;
+ infoPtr->tagPtrs[tagPtr->priority] = tagPtr;
+ infoPtr->tagCnts[tagPtr->priority]++;
}
}
}
}
/*
- * For each node in the ancestry of this line, record tag toggles
- * for all siblings that precede that node.
+ * For each node in the ancestry of this line, record tag toggles for all
+ * siblings that precede that node.
*/
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
- nodePtr = nodePtr->parentPtr) {
+ nodePtr = nodePtr->parentPtr) {
register Node *siblingPtr;
register Summary *summaryPtr;
- for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
- siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
+ for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
+ siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
for (summaryPtr = siblingPtr->summaryPtr; summaryPtr != NULL;
- summaryPtr = summaryPtr->nextPtr) {
+ summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr->toggleCount & 1) {
tagPtr = summaryPtr->tagPtr;
if (tagPtr->elideString != NULL) {
- tagPtrs[tagPtr->priority] = tagPtr;
- tagCnts[tagPtr->priority] += summaryPtr->toggleCount;
+ infoPtr->tagPtrs[tagPtr->priority] = tagPtr;
+ infoPtr->tagCnts[tagPtr->priority] +=
+ summaryPtr->toggleCount;
}
}
}
@@ -2542,32 +3584,47 @@ TkTextIsElided(textPtr, indexPtr)
}
/*
- * Now traverse from highest priority to lowest,
- * take elided value from first odd count (= on)
+ * Now traverse from highest priority to lowest, take elided value from
+ * first odd count (= on).
*/
- for (i = numTags-1; i >=0; i--) {
- if (tagCnts[i] & 1) {
- /* who would make the selection elided? */
- if (
-#ifndef MAC_OSX_TK
- !TkpAlwaysShowSelection(textPtr->tkwin)
-#else
+ infoPtr->elidePriority = -1;
+ for (i = infoPtr->numTags-1; i >=0; i--) {
+ if (infoPtr->tagCnts[i] & 1) {
+ /*
+ * Who would make the selection elided?
+ */
+
+ if ((tagPtr == textPtr->selTagPtr)
+ && !(textPtr->flags & GOT_FOCUS)
+ && (textPtr->inactiveSelBorder == NULL
+#ifdef MAC_OSX_TK
/* Don't show inactive selection in disabled widgets. */
- textPtr->state == TK_STATE_DISABLED
+ || textPtr->state == TK_TEXT_STATE_DISABLED
#endif
- && (tagPtr == textPtr->selTagPtr)
- && !(textPtr->flags & GOT_FOCUS)) {
+ )) {
continue;
}
- elide = tagPtrs[i]->elide;
+ infoPtr->elide = infoPtr->tagPtrs[i]->elide;
+
+ /*
+ * Note: i == infoPtr->tagPtrs[i]->priority
+ */
+
+ infoPtr->elidePriority = i;
break;
}
}
- if (LOTSA_TAGS < numTags) {
- ckfree((char *) tagCnts);
- ckfree((char *) tagPtrs);
+ elide = infoPtr->elide;
+
+ if (elideInfo == NULL) {
+ if (LOTSA_TAGS < infoPtr->numTags) {
+ ckfree((char *) infoPtr->tagCnts);
+ ckfree((char *) infoPtr->tagPtrs);
+ }
+
+ ckfree((char *) infoPtr);
}
return elide;
@@ -2576,27 +3633,55 @@ TkTextIsElided(textPtr, indexPtr)
/*
*----------------------------------------------------------------------
*
+ * TkTextFreeElideInfo --
+ *
+ * This is a utility function used to free up any memory allocated by the
+ * TkTextIsElided function above.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Memory may be freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkTextFreeElideInfo(
+ TkTextElideInfo *elideInfo) /* Free any allocated memory in this
+ * structure. */
+{
+ if (LOTSA_TAGS < elideInfo->numTags) {
+ ckfree((char *) elideInfo->tagCnts);
+ ckfree((char *) elideInfo->tagPtrs);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* IncCount --
*
- * This is a utility procedure used by TkBTreeGetTags. It
- * increments the count for a particular tag, adding a new
- * entry for that tag if there wasn't one previously.
+ * This is a utility function used by TkBTreeGetTags. It increments the
+ * count for a particular tag, adding a new entry for that tag if there
+ * wasn't one previously.
*
* Results:
* None.
*
* Side effects:
- * The information at *tagInfoPtr may be modified, and the arrays
- * may be reallocated to make them larger.
+ * The information at *tagInfoPtr may be modified, and the arrays may be
+ * reallocated to make them larger.
*
*----------------------------------------------------------------------
*/
static void
-IncCount(tagPtr, inc, tagInfoPtr)
- TkTextTag *tagPtr; /* Handle for tag. */
- int inc; /* Amount by which to increment tag count. */
- TagInfo *tagInfoPtr; /* Holds cumulative information about tags;
+IncCount(
+ TkTextTag *tagPtr, /* Handle for tag. */
+ int inc, /* Amount by which to increment tag count. */
+ TagInfo *tagInfoPtr) /* Holds cumulative information about tags;
* increment count here. */
{
register TkTextTag **tagPtrPtr;
@@ -2611,24 +3696,23 @@ IncCount(tagPtr, inc, tagInfoPtr)
}
/*
- * There isn't currently an entry for this tag, so we have to
- * make a new one. If the arrays are full, then enlarge the
- * arrays first.
+ * There isn't currently an entry for this tag, so we have to make a new
+ * one. If the arrays are full, then enlarge the arrays first.
*/
if (tagInfoPtr->numTags == tagInfoPtr->arraySize) {
TkTextTag **newTags;
int *newCounts, newSize;
- newSize = 2*tagInfoPtr->arraySize;
- newTags = (TkTextTag **) ckalloc((unsigned)
- (newSize*sizeof(TkTextTag *)));
- memcpy((VOID *) newTags, (VOID *) tagInfoPtr->tagPtrs,
+ newSize = 2 * tagInfoPtr->arraySize;
+ newTags = (TkTextTag **)
+ ckalloc((unsigned) newSize * sizeof(TkTextTag *));
+ memcpy(newTags, tagInfoPtr->tagPtrs,
tagInfoPtr->arraySize * sizeof(TkTextTag *));
ckfree((char *) tagInfoPtr->tagPtrs);
tagInfoPtr->tagPtrs = newTags;
- newCounts = (int *) ckalloc((unsigned) (newSize*sizeof(int)));
- memcpy((VOID *) newCounts, (VOID *) tagInfoPtr->counts,
+ newCounts = (int *) ckalloc((unsigned) newSize * sizeof(int));
+ memcpy(newCounts, tagInfoPtr->counts,
tagInfoPtr->arraySize * sizeof(int));
ckfree((char *) tagInfoPtr->counts);
tagInfoPtr->counts = newCounts;
@@ -2645,22 +3729,22 @@ IncCount(tagPtr, inc, tagInfoPtr)
*
* TkBTreeCheck --
*
- * This procedure runs a set of consistency checks over a B-tree
- * and panics if any inconsistencies are found.
+ * This function runs a set of consistency checks over a B-tree and
+ * panics if any inconsistencies are found.
*
* Results:
* None.
*
* Side effects:
- * If a structural defect is found, the procedure panics with an
- * error message.
+ * If a structural defect is found, the function panics with an error
+ * message.
*
*----------------------------------------------------------------------
*/
void
-TkBTreeCheck(tree)
- TkTextBTree tree; /* Tree to check. */
+TkBTreeCheck(
+ TkTextBTree tree) /* Tree to check. */
{
BTree *treePtr = (BTree *) tree;
register Summary *summaryPtr;
@@ -2675,27 +3759,28 @@ TkBTreeCheck(tree)
/*
* Make sure that the tag toggle counts and the tag root pointers are OK.
*/
- for (entryPtr = Tcl_FirstHashEntry(&treePtr->textPtr->tagTable, &search);
+
+ for (entryPtr=Tcl_FirstHashEntry(&treePtr->sharedTextPtr->tagTable,&search);
entryPtr != NULL ; entryPtr = Tcl_NextHashEntry(&search)) {
tagPtr = (TkTextTag *) Tcl_GetHashValue(entryPtr);
nodePtr = tagPtr->tagRootPtr;
- if (nodePtr == (Node *) NULL) {
+ if (nodePtr == NULL) {
if (tagPtr->toggleCount != 0) {
- panic("TkBTreeCheck found \"%s\" with toggles (%d) but no root",
- tagPtr->name, tagPtr->toggleCount);
+ Tcl_Panic("TkBTreeCheck found \"%s\" with toggles (%d) but no root",
+ tagPtr->name, tagPtr->toggleCount);
}
- continue; /* no ranges for the tag */
+ continue; /* No ranges for the tag. */
} else if (tagPtr->toggleCount == 0) {
- panic("TkBTreeCheck found root for \"%s\" with no toggles",
+ Tcl_Panic("TkBTreeCheck found root for \"%s\" with no toggles",
tagPtr->name);
} else if (tagPtr->toggleCount & 1) {
- panic("TkBTreeCheck found odd toggle count for \"%s\" (%d)",
+ Tcl_Panic("TkBTreeCheck found odd toggle count for \"%s\" (%d)",
tagPtr->name, tagPtr->toggleCount);
}
for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr->tagPtr == tagPtr) {
- panic("TkBTreeCheck found root node with summary info");
+ Tcl_Panic("TkBTreeCheck found root node with summary info");
}
}
count = 0;
@@ -2723,25 +3808,25 @@ TkBTreeCheck(tree)
}
}
if (count != tagPtr->toggleCount) {
- panic("TkBTreeCheck toggleCount (%d) wrong for \"%s\" should be (%d)",
- tagPtr->toggleCount, tagPtr->name, count);
+ Tcl_Panic("TkBTreeCheck toggleCount (%d) wrong for \"%s\" should be (%d)",
+ tagPtr->toggleCount, tagPtr->name, count);
}
}
/*
- * Call a recursive procedure to do the main body of checks.
+ * Call a recursive function to do the main body of checks.
*/
nodePtr = treePtr->rootPtr;
- CheckNodeConsistency(treePtr->rootPtr);
+ CheckNodeConsistency(treePtr->rootPtr, treePtr->pixelReferences);
/*
- * Make sure that there are at least two lines in the text and
- * that the last line has no characters except a newline.
+ * Make sure that there are at least two lines in the text and that the
+ * last line has no characters except a newline.
*/
if (nodePtr->numLines < 2) {
- panic("TkBTreeCheck: less than 2 lines in tree");
+ Tcl_Panic("TkBTreeCheck: less than 2 lines in tree");
}
while (nodePtr->level > 0) {
nodePtr = nodePtr->children.nodePtr;
@@ -2758,25 +3843,24 @@ TkBTreeCheck(tree)
|| (segPtr->typePtr == &tkTextRightMarkType)
|| (segPtr->typePtr == &tkTextLeftMarkType)) {
/*
- * It's OK to toggle a tag off in the last line, but
- * not to start a new range. It's also OK to have marks
- * in the last line.
+ * It's OK to toggle a tag off in the last line, but not to start a
+ * new range. It's also OK to have marks in the last line.
*/
segPtr = segPtr->nextPtr;
}
if (segPtr->typePtr != &tkTextCharType) {
- panic("TkBTreeCheck: last line has bogus segment type");
+ Tcl_Panic("TkBTreeCheck: last line has bogus segment type");
}
if (segPtr->nextPtr != NULL) {
- panic("TkBTreeCheck: last line has too many segments");
+ Tcl_Panic("TkBTreeCheck: last line has too many segments");
}
if (segPtr->size != 1) {
- panic("TkBTreeCheck: last line has wrong # characters: %d",
+ Tcl_Panic("TkBTreeCheck: last line has wrong # characters: %d",
segPtr->size);
}
if ((segPtr->body.chars[0] != '\n') || (segPtr->body.chars[1] != 0)) {
- panic("TkBTreeCheck: last line had bad value: %s",
+ Tcl_Panic("TkBTreeCheck: last line had bad value: %s",
segPtr->body.chars);
}
}
@@ -2786,54 +3870,66 @@ TkBTreeCheck(tree)
*
* CheckNodeConsistency --
*
- * This procedure is called as part of consistency checking for
- * B-trees: it checks several aspects of a node and also runs
- * checks recursively on the node's children.
+ * This function is called as part of consistency checking for B-trees:
+ * it checks several aspects of a node and also runs checks recursively
+ * on the node's children.
*
* Results:
* None.
*
* Side effects:
- * If anything suspicious is found in the tree structure, the
- * procedure panics.
+ * If anything suspicious is found in the tree structure, the function
+ * panics.
*
*----------------------------------------------------------------------
*/
static void
-CheckNodeConsistency(nodePtr)
- register Node *nodePtr; /* Node whose subtree should be
- * checked. */
+CheckNodeConsistency(
+ register Node *nodePtr, /* Node whose subtree should be checked. */
+ int references) /* Number of referring widgets which have
+ * pixel counts. */
{
register Node *childNodePtr;
register Summary *summaryPtr, *summaryPtr2;
register TkTextLine *linePtr;
register TkTextSegment *segPtr;
- int numChildren, numLines, toggleCount, minChildren;
+ int numChildren, numLines, toggleCount, minChildren, i;
+ int *numPixels;
+ int pixels[PIXEL_CLIENTS];
if (nodePtr->parentPtr != NULL) {
minChildren = MIN_CHILDREN;
} else if (nodePtr->level > 0) {
minChildren = 2;
- } else {
+ } else {
minChildren = 1;
}
if ((nodePtr->numChildren < minChildren)
|| (nodePtr->numChildren > MAX_CHILDREN)) {
- panic("CheckNodeConsistency: bad child count (%d)",
+ Tcl_Panic("CheckNodeConsistency: bad child count (%d)",
nodePtr->numChildren);
}
numChildren = 0;
numLines = 0;
+ if (references > PIXEL_CLIENTS) {
+ numPixels = (int *) ckalloc(sizeof(int) * references);
+ } else {
+ numPixels = pixels;
+ }
+ for (i = 0; i<references; i++) {
+ numPixels[i] = 0;
+ }
+
if (nodePtr->level == 0) {
for (linePtr = nodePtr->children.linePtr; linePtr != NULL;
linePtr = linePtr->nextPtr) {
if (linePtr->parentPtr != nodePtr) {
- panic("CheckNodeConsistency: line doesn't point to parent");
+ Tcl_Panic("CheckNodeConsistency: line doesn't point to parent");
}
if (linePtr->segPtr == NULL) {
- panic("CheckNodeConsistency: line has no segments");
+ Tcl_Panic("CheckNodeConsistency: line has no segments");
}
for (segPtr = linePtr->segPtr; segPtr != NULL;
segPtr = segPtr->nextPtr) {
@@ -2844,27 +3940,30 @@ CheckNodeConsistency(nodePtr)
&& (segPtr->nextPtr != NULL)
&& (segPtr->nextPtr->size == 0)
&& (segPtr->nextPtr->typePtr->leftGravity)) {
- panic("CheckNodeConsistency: wrong segment order for gravity");
+ Tcl_Panic("CheckNodeConsistency: wrong segment order for gravity");
}
if ((segPtr->nextPtr == NULL)
&& (segPtr->typePtr != &tkTextCharType)) {
- panic("CheckNodeConsistency: line ended with wrong type");
+ Tcl_Panic("CheckNodeConsistency: line ended with wrong type");
}
}
numChildren++;
numLines++;
+ for (i = 0; i<references; i++) {
+ numPixels[i] += linePtr->pixels[2 * i];
+ }
}
} else {
for (childNodePtr = nodePtr->children.nodePtr; childNodePtr != NULL;
childNodePtr = childNodePtr->nextPtr) {
if (childNodePtr->parentPtr != nodePtr) {
- panic("CheckNodeConsistency: node doesn't point to parent");
+ Tcl_Panic("CheckNodeConsistency: node doesn't point to parent");
}
if (childNodePtr->level != (nodePtr->level-1)) {
- panic("CheckNodeConsistency: level mismatch (%d %d)",
+ Tcl_Panic("CheckNodeConsistency: level mismatch (%d %d)",
nodePtr->level, childNodePtr->level);
}
- CheckNodeConsistency(childNodePtr);
+ CheckNodeConsistency(childNodePtr, references);
for (summaryPtr = childNodePtr->summaryPtr; summaryPtr != NULL;
summaryPtr = summaryPtr->nextPtr) {
for (summaryPtr2 = nodePtr->summaryPtr; ;
@@ -2873,7 +3972,7 @@ CheckNodeConsistency(nodePtr)
if (summaryPtr->tagPtr->tagRootPtr == nodePtr) {
break;
}
- panic("CheckNodeConsistency: node tag \"%s\" not %s",
+ Tcl_Panic("CheckNodeConsistency: node tag \"%s\" not %s",
summaryPtr->tagPtr->name,
"present in parent summaries");
}
@@ -2884,22 +3983,34 @@ CheckNodeConsistency(nodePtr)
}
numChildren++;
numLines += childNodePtr->numLines;
+ for (i = 0; i<references; i++) {
+ numPixels[i] += childNodePtr->numPixels[i];
+ }
}
}
if (numChildren != nodePtr->numChildren) {
- panic("CheckNodeConsistency: mismatch in numChildren (%d %d)",
+ Tcl_Panic("CheckNodeConsistency: mismatch in numChildren (%d %d)",
numChildren, nodePtr->numChildren);
}
if (numLines != nodePtr->numLines) {
- panic("CheckNodeConsistency: mismatch in numLines (%d %d)",
+ Tcl_Panic("CheckNodeConsistency: mismatch in numLines (%d %d)",
numLines, nodePtr->numLines);
}
+ for (i = 0; i<references; i++) {
+ if (numPixels[i] != nodePtr->numPixels[i]) {
+ Tcl_Panic("CheckNodeConsistency: mismatch in numPixels (%d %d) for widget (%d)",
+ numPixels[i], nodePtr->numPixels[i], i);
+ }
+ }
+ if (references > PIXEL_CLIENTS) {
+ ckfree((char *) numPixels);
+ }
for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr->tagPtr->toggleCount == summaryPtr->toggleCount) {
- panic("CheckNodeConsistency: found unpruned root for \"%s\"",
- summaryPtr->tagPtr->name);
+ Tcl_Panic("CheckNodeConsistency: found unpruned root for \"%s\"",
+ summaryPtr->tagPtr->name);
}
toggleCount = 0;
if (nodePtr->level == 0) {
@@ -2912,7 +4023,7 @@ CheckNodeConsistency(nodePtr)
continue;
}
if (segPtr->body.toggle.tagPtr == summaryPtr->tagPtr) {
- toggleCount ++;
+ toggleCount++;
}
}
}
@@ -2930,13 +4041,13 @@ CheckNodeConsistency(nodePtr)
}
}
if (toggleCount != summaryPtr->toggleCount) {
- panic("CheckNodeConsistency: mismatch in toggleCount (%d %d)",
+ Tcl_Panic("CheckNodeConsistency: mismatch in toggleCount (%d %d)",
toggleCount, summaryPtr->toggleCount);
}
for (summaryPtr2 = summaryPtr->nextPtr; summaryPtr2 != NULL;
summaryPtr2 = summaryPtr2->nextPtr) {
if (summaryPtr2->tagPtr == summaryPtr->tagPtr) {
- panic("CheckNodeConsistency: duplicated node tag: %s",
+ Tcl_Panic("CheckNodeConsistency: duplicated node tag: %s",
summaryPtr->tagPtr->name);
}
}
@@ -2948,9 +4059,9 @@ CheckNodeConsistency(nodePtr)
*
* Rebalance --
*
- * This procedure is called when a node of a B-tree appears to be
- * out of balance (too many children, or too few). It rebalances
- * that node and all of its ancestors in the tree.
+ * This function is called when a node of a B-tree appears to be out of
+ * balance (too many children, or too few). It rebalances that node and
+ * all of its ancestors in the tree.
*
* Results:
* None.
@@ -2962,14 +4073,13 @@ CheckNodeConsistency(nodePtr)
*/
static void
-Rebalance(treePtr, nodePtr)
- BTree *treePtr; /* Tree that is being rebalanced. */
- register Node *nodePtr; /* Node that may be out of balance. */
+Rebalance(
+ BTree *treePtr, /* Tree that is being rebalanced. */
+ register Node *nodePtr) /* Node that may be out of balance. */
{
/*
- * Loop over the entire ancestral chain of the node, working up
- * through the tree one node at a time until the root node has
- * been processed.
+ * Loop over the entire ancestral chain of the node, working up through
+ * the tree one node at a time until the root node has been processed.
*/
for ( ; nodePtr != NULL; nodePtr = nodePtr->parentPtr) {
@@ -2978,19 +4088,19 @@ Rebalance(treePtr, nodePtr)
int i;
/*
- * Check to see if the node has too many children. If it does,
- * then split off all but the first MIN_CHILDREN into a separate
- * node following the original one. Then repeat until the
- * node has a decent size.
+ * Check to see if the node has too many children. If it does, then
+ * split off all but the first MIN_CHILDREN into a separate node
+ * following the original one. Then repeat until the node has a decent
+ * size.
*/
if (nodePtr->numChildren > MAX_CHILDREN) {
while (1) {
/*
- * If the node being split is the root node, then make a
- * new root node above it first.
+ * If the node being split is the root node, then make a new
+ * root node above it first.
*/
-
+
if (nodePtr->parentPtr == NULL) {
newPtr = (Node *) ckalloc(sizeof(Node));
newPtr->parentPtr = NULL;
@@ -3000,10 +4110,20 @@ Rebalance(treePtr, nodePtr)
newPtr->children.nodePtr = nodePtr;
newPtr->numChildren = 1;
newPtr->numLines = nodePtr->numLines;
- RecomputeNodeCounts(newPtr);
+ newPtr->numPixels = (int *)
+ ckalloc(sizeof(int) * treePtr->pixelReferences);
+ for (i=0; i<treePtr->pixelReferences; i++) {
+ newPtr->numPixels[i] = nodePtr->numPixels[i];
+ }
+ RecomputeNodeCounts(treePtr, newPtr);
treePtr->rootPtr = newPtr;
}
newPtr = (Node *) ckalloc(sizeof(Node));
+ newPtr->numPixels = (int *)
+ ckalloc(sizeof(int) * treePtr->pixelReferences);
+ for (i=0; i<treePtr->pixelReferences; i++) {
+ newPtr->numPixels[i] = 0;
+ }
newPtr->parentPtr = nodePtr->parentPtr;
newPtr->nextPtr = nodePtr->nextPtr;
nodePtr->nextPtr = newPtr;
@@ -3027,11 +4147,11 @@ Rebalance(treePtr, nodePtr)
newPtr->children.nodePtr = childPtr->nextPtr;
childPtr->nextPtr = NULL;
}
- RecomputeNodeCounts(nodePtr);
+ RecomputeNodeCounts(treePtr, nodePtr);
nodePtr->parentPtr->numChildren++;
nodePtr = newPtr;
if (nodePtr->numChildren <= MAX_CHILDREN) {
- RecomputeNodeCounts(nodePtr);
+ RecomputeNodeCounts(treePtr, nodePtr);
break;
}
}
@@ -3039,16 +4159,16 @@ Rebalance(treePtr, nodePtr)
while (nodePtr->numChildren < MIN_CHILDREN) {
register Node *otherPtr;
- Node *halfwayNodePtr = NULL; /* Initialization needed only */
- TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */
+ Node *halfwayNodePtr = NULL; /* Initialization needed only */
+ TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */
int totalChildren, firstChildren, i;
/*
- * Too few children for this node. If this is the root then,
- * it's OK for it to have less than MIN_CHILDREN children
- * as long as it's got at least two. If it has only one
- * (and isn't at level 0), then chop the root node out of
- * the tree and use its child as the new root.
+ * Too few children for this node. If this is the root then, it's
+ * OK for it to have less than MIN_CHILDREN children as long as
+ * it's got at least two. If it has only one (and isn't at level
+ * 0), then chop the root node out of the tree and use its child
+ * as the new root.
*/
if (nodePtr->parentPtr == NULL) {
@@ -3062,8 +4182,8 @@ Rebalance(treePtr, nodePtr)
}
/*
- * Not the root. Make sure that there are siblings to
- * balance with.
+ * Not the root. Make sure that there are siblings to balance
+ * with.
*/
if (nodePtr->parentPtr->numChildren < 2) {
@@ -3072,8 +4192,8 @@ Rebalance(treePtr, nodePtr)
}
/*
- * Find a sibling neighbor to borrow from, and arrange for
- * nodePtr to be the earlier of the pair.
+ * Find a sibling neighbor to borrow from, and arrange for nodePtr
+ * to be the earlier of the pair.
*/
if (nodePtr->nextPtr == NULL) {
@@ -3087,11 +4207,10 @@ Rebalance(treePtr, nodePtr)
otherPtr = nodePtr->nextPtr;
/*
- * We're going to either merge the two siblings together
- * into one node or redivide the children among them to
- * balance their loads. As preparation, join their two
- * child lists into a single list and remember the half-way
- * point in the list.
+ * We're going to either merge the two siblings together into one
+ * node or redivide the children among them to balance their
+ * loads. As preparation, join their two child lists into a single
+ * list and remember the half-way point in the list.
*/
totalChildren = nodePtr->numChildren + otherPtr->numChildren;
@@ -3142,7 +4261,7 @@ Rebalance(treePtr, nodePtr)
*/
if (totalChildren <= MAX_CHILDREN) {
- RecomputeNodeCounts(nodePtr);
+ RecomputeNodeCounts(treePtr, nodePtr);
nodePtr->nextPtr = otherPtr->nextPtr;
nodePtr->parentPtr->numChildren--;
DeleteSummaries(otherPtr->summaryPtr);
@@ -3151,8 +4270,8 @@ Rebalance(treePtr, nodePtr)
}
/*
- * The siblings can't be merged, so just divide their
- * children evenly between them.
+ * The siblings can't be merged, so just divide their children
+ * evenly between them.
*/
if (nodePtr->level == 0) {
@@ -3162,8 +4281,8 @@ Rebalance(treePtr, nodePtr)
otherPtr->children.nodePtr = halfwayNodePtr->nextPtr;
halfwayNodePtr->nextPtr = NULL;
}
- RecomputeNodeCounts(nodePtr);
- RecomputeNodeCounts(otherPtr);
+ RecomputeNodeCounts(treePtr, nodePtr);
+ RecomputeNodeCounts(treePtr, otherPtr);
}
}
}
@@ -3173,37 +4292,38 @@ Rebalance(treePtr, nodePtr)
*
* RecomputeNodeCounts --
*
- * This procedure is called to recompute all the counts in a node
- * (tags, child information, etc.) by scanning the information in
- * its descendants. This procedure is called during rebalancing
- * when a node's child structure has changed.
+ * This function is called to recompute all the counts in a node (tags,
+ * child information, etc.) by scanning the information in its
+ * descendants. This function is called during rebalancing when a node's
+ * child structure has changed.
*
* Results:
* None.
*
* Side effects:
- * The tag counts for nodePtr are modified to reflect its current
- * child structure, as are its numChildren and numLines fields.
- * Also, all of the childrens' parentPtr fields are made to point
- * to nodePtr.
+ * The tag counts for nodePtr are modified to reflect its current child
+ * structure, as are its numChildren and numLines fields. Also, all of
+ * the childrens' parentPtr fields are made to point to nodePtr.
*
*----------------------------------------------------------------------
*/
static void
-RecomputeNodeCounts(nodePtr)
- register Node *nodePtr; /* Node whose tag summary information
- * must be recomputed. */
+RecomputeNodeCounts(
+ register BTree *treePtr, /* The whole B-tree. */
+ register Node *nodePtr) /* Node whose tag summary information must be
+ * recomputed. */
{
register Summary *summaryPtr, *summaryPtr2;
register Node *childPtr;
register TkTextLine *linePtr;
register TkTextSegment *segPtr;
TkTextTag *tagPtr;
+ int ref;
/*
- * Zero out all the existing counts for the node, but don't delete
- * the existing Summary records (most of them will probably be reused).
+ * Zero out all the existing counts for the node, but don't delete the
+ * existing Summary records (most of them will probably be reused).
*/
for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
@@ -3212,11 +4332,13 @@ RecomputeNodeCounts(nodePtr)
}
nodePtr->numChildren = 0;
nodePtr->numLines = 0;
+ for (ref = 0; ref<treePtr->pixelReferences; ref++) {
+ nodePtr->numPixels[ref] = 0;
+ }
/*
- * Scan through the children, adding the childrens' tag counts into
- * the node's tag counts and adding new Summary structures if
- * necessary.
+ * Scan through the children, adding the childrens' tag counts into the
+ * node's tag counts and adding new Summary structures if necessary.
*/
if (nodePtr->level == 0) {
@@ -3224,6 +4346,9 @@ RecomputeNodeCounts(nodePtr)
linePtr = linePtr->nextPtr) {
nodePtr->numChildren++;
nodePtr->numLines++;
+ for (ref = 0; ref<treePtr->pixelReferences; ref++) {
+ nodePtr->numPixels[ref] += linePtr->pixels[2 * ref];
+ }
linePtr->parentPtr = nodePtr;
for (segPtr = linePtr->segPtr; segPtr != NULL;
segPtr = segPtr->nextPtr) {
@@ -3255,6 +4380,9 @@ RecomputeNodeCounts(nodePtr)
childPtr = childPtr->nextPtr) {
nodePtr->numChildren++;
nodePtr->numLines += childPtr->numLines;
+ for (ref = 0; ref<treePtr->pixelReferences; ref++) {
+ nodePtr->numPixels[ref] += childPtr->numPixels[ref];
+ }
childPtr->parentPtr = nodePtr;
for (summaryPtr2 = childPtr->summaryPtr; summaryPtr2 != NULL;
summaryPtr2 = summaryPtr2->nextPtr) {
@@ -3280,19 +4408,20 @@ RecomputeNodeCounts(nodePtr)
/*
* Scan through the node's tag records again and delete any Summary
* records that still have a zero count, or that have all the toggles.
- * The node with the children that account for all the tags toggles
- * have no summary information, and they become the tagRootPtr for the tag.
+ * The node with the children that account for all the tags toggles have
+ * no summary information, and they become the tagRootPtr for the tag.
*/
summaryPtr2 = NULL;
for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL; ) {
- if (summaryPtr->toggleCount > 0 &&
+ if (summaryPtr->toggleCount > 0 &&
summaryPtr->toggleCount < summaryPtr->tagPtr->toggleCount) {
if (nodePtr->level == summaryPtr->tagPtr->tagRootPtr->level) {
/*
- * The tag's root node split and some toggles left.
- * The tag root must move up a level.
+ * The tag's root node split and some toggles left. The tag
+ * root must move up a level.
*/
+
summaryPtr->tagPtr->tagRootPtr = nodePtr->parentPtr;
}
summaryPtr2 = summaryPtr;
@@ -3301,9 +4430,10 @@ RecomputeNodeCounts(nodePtr)
}
if (summaryPtr->toggleCount == summaryPtr->tagPtr->toggleCount) {
/*
- * A node merge has collected all the toggles under one node.
- * Push the root down to this level.
+ * A node merge has collected all the toggles under one node. Push
+ * the root down to this level.
*/
+
summaryPtr->tagPtr->tagRootPtr = nodePtr;
}
if (summaryPtr2 != NULL) {
@@ -3323,13 +4453,54 @@ RecomputeNodeCounts(nodePtr)
*
* TkBTreeNumLines --
*
- * This procedure returns a count of the number of lines of
- * text present in a given B-tree.
+ * This function returns a count of the number of logical lines of text
+ * present in a given B-tree.
+ *
+ * Results:
+ * The return value is a count of the number of usable lines in tree
+ * (i.e. it doesn't include the dummy line that is just used to mark the
+ * end of the tree).
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkBTreeNumLines(
+ TkTextBTree tree, /* Information about tree. */
+ const TkText *textPtr) /* Relative to this client of the B-tree. */
+{
+ BTree *treePtr = (BTree *) tree;
+ int count;
+
+ if (textPtr != NULL && textPtr->end != NULL) {
+ count = TkBTreeLinesTo(NULL, textPtr->end);
+ } else {
+ count = treePtr->rootPtr->numLines - 1;
+ }
+ if (textPtr != NULL && textPtr->start != NULL) {
+ count -= TkBTreeLinesTo(NULL, textPtr->start);
+ }
+
+ return count;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkBTreeNumPixels --
+ *
+ * This function returns a count of the number of pixels of text present
+ * in a given widget's B-tree representation.
*
* Results:
- * The return value is a count of the number of usable lines
- * in tree (i.e. it doesn't include the dummy line that is just
- * used to mark the end of the tree).
+ * The return value is a count of the number of usable pixels in tree
+ * (since the dummy line used to mark the end of the B-tree is maintained
+ * with zero height, as are any lines that are before or after the
+ * '-start -end' range of the text widget in question, the number stored
+ * at the root is the number we want).
*
* Side effects:
* None.
@@ -3338,11 +4509,12 @@ RecomputeNodeCounts(nodePtr)
*/
int
-TkBTreeNumLines(tree)
- TkTextBTree tree; /* Information about tree. */
+TkBTreeNumPixels(
+ TkTextBTree tree, /* The B-tree. */
+ const TkText *textPtr) /* Relative to this client of the B-tree. */
{
BTree *treePtr = (BTree *) tree;
- return treePtr->rootPtr->numLines - 1;
+ return treePtr->rootPtr->numPixels[textPtr->pixelReference];
}
/*
@@ -3350,12 +4522,11 @@ TkBTreeNumLines(tree)
*
* CharSplitProc --
*
- * This procedure implements splitting for character segments.
+ * This function implements splitting for character segments.
*
* Results:
- * The return value is a pointer to a chain of two segments
- * that have the same characters as segPtr except split
- * among the two segments.
+ * The return value is a pointer to a chain of two segments that have the
+ * same characters as segPtr except split among the two segments.
*
* Side effects:
* Storage for segPtr is freed.
@@ -3364,10 +4535,10 @@ TkBTreeNumLines(tree)
*/
static TkTextSegment *
-CharSplitProc(segPtr, index)
- TkTextSegment *segPtr; /* Pointer to segment to split. */
- int index; /* Position within segment at which
- * to split. */
+CharSplitProc(
+ TkTextSegment *segPtr, /* Pointer to segment to split. */
+ int index) /* Position within segment at which to
+ * split. */
{
TkTextSegment *newPtr1, *newPtr2;
@@ -3384,7 +4555,7 @@ CharSplitProc(segPtr, index)
newPtr2->size = segPtr->size - index;
memcpy(newPtr2->body.chars, segPtr->body.chars + index, newPtr2->size);
newPtr2->body.chars[newPtr2->size] = 0;
- ckfree((char*) segPtr);
+ ckfree((char *) segPtr);
return newPtr1;
}
@@ -3393,12 +4564,12 @@ CharSplitProc(segPtr, index)
*
* CharCleanupProc --
*
- * This procedure merges adjacent character segments into
- * a single character segment, if possible.
+ * This function merges adjacent character segments into a single
+ * character segment, if possible.
*
* Results:
- * The return value is a pointer to the first segment in
- * the (new) list of segments that used to start with segPtr.
+ * The return value is a pointer to the first segment in the (new) list
+ * of segments that used to start with segPtr.
*
* Side effects:
* Storage for the segments may be allocated and freed.
@@ -3408,11 +4579,10 @@ CharSplitProc(segPtr, index)
/* ARGSUSED */
static TkTextSegment *
-CharCleanupProc(segPtr, linePtr)
- TkTextSegment *segPtr; /* Pointer to first of two adjacent
- * segments to join. */
- TkTextLine *linePtr; /* Line containing segments (not
- * used). */
+CharCleanupProc(
+ TkTextSegment *segPtr, /* Pointer to first of two adjacent segments
+ * to join. */
+ TkTextLine *linePtr) /* Line containing segments (not used). */
{
TkTextSegment *segPtr2, *newPtr;
@@ -3428,8 +4598,8 @@ CharCleanupProc(segPtr, linePtr)
memcpy(newPtr->body.chars, segPtr->body.chars, segPtr->size);
memcpy(newPtr->body.chars + segPtr->size, segPtr2->body.chars, segPtr2->size);
newPtr->body.chars[newPtr->size] = 0;
- ckfree((char*) segPtr);
- ckfree((char*) segPtr2);
+ ckfree((char *) segPtr);
+ ckfree((char *) segPtr2);
return newPtr;
}
@@ -3438,7 +4608,7 @@ CharCleanupProc(segPtr, linePtr)
*
* CharDeleteProc --
*
- * This procedure is invoked to delete a character segment.
+ * This function is invoked to delete a character segment.
*
* Results:
* Always returns 0 to indicate that the segment was deleted.
@@ -3451,14 +4621,14 @@ CharCleanupProc(segPtr, linePtr)
/* ARGSUSED */
static int
-CharDeleteProc(segPtr, linePtr, treeGone)
- TkTextSegment *segPtr; /* Segment to delete. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is
- * being deleted, so everything must
- * get cleaned up. */
+CharDeleteProc(
+ TkTextSegment *segPtr, /* Segment to delete. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
+ * deleted, so everything must get cleaned
+ * up. */
{
- ckfree((char*) segPtr);
+ ckfree((char *) segPtr);
return 0;
}
@@ -3467,47 +4637,43 @@ CharDeleteProc(segPtr, linePtr, treeGone)
*
* CharCheckProc --
*
- * This procedure is invoked to perform consistency checks
- * on character segments.
+ * This function is invoked to perform consistency checks on character
+ * segments.
*
* Results:
* None.
*
* Side effects:
- * If the segment isn't inconsistent then the procedure
- * panics.
+ * If the segment isn't inconsistent then the function panics.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
-CharCheckProc(segPtr, linePtr)
- TkTextSegment *segPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+CharCheckProc(
+ TkTextSegment *segPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
/*
- * Make sure that the segment contains the number of
- * characters indicated by its header, and that the last
- * segment in a line ends in a newline. Also make sure
- * that there aren't ever two character segments adjacent
- * to each other: they should be merged together.
+ * Make sure that the segment contains the number of characters indicated
+ * by its header, and that the last segment in a line ends in a newline.
+ * Also make sure that there aren't ever two character segments adjacent
+ * to each other: they should be merged together.
*/
if (segPtr->size <= 0) {
- panic("CharCheckProc: segment has size <= 0");
+ Tcl_Panic("CharCheckProc: segment has size <= 0");
}
if (strlen(segPtr->body.chars) != (size_t) segPtr->size) {
- panic("CharCheckProc: segment has wrong size");
+ Tcl_Panic("CharCheckProc: segment has wrong size");
}
if (segPtr->nextPtr == NULL) {
if (segPtr->body.chars[segPtr->size-1] != '\n') {
- panic("CharCheckProc: line doesn't end with newline");
- }
- } else {
- if (segPtr->nextPtr->typePtr == &tkTextCharType) {
- panic("CharCheckProc: adjacent character segments weren't merged");
+ Tcl_Panic("CharCheckProc: line doesn't end with newline");
}
+ } else if (segPtr->nextPtr->typePtr == &tkTextCharType) {
+ Tcl_Panic("CharCheckProc: adjacent character segments weren't merged");
}
}
@@ -3516,27 +4682,26 @@ CharCheckProc(segPtr, linePtr)
*
* ToggleDeleteProc --
*
- * This procedure is invoked to delete toggle segments.
+ * This function is invoked to delete toggle segments.
*
* Results:
- * Returns 1 to indicate that the segment may not be deleted,
- * unless the entire B-tree is going away.
+ * Returns 1 to indicate that the segment may not be deleted, unless the
+ * entire B-tree is going away.
*
* Side effects:
- * If the tree is going away then the toggle's memory is
- * freed; otherwise the toggle counts in nodes above the
- * segment get updated.
+ * If the tree is going away then the toggle's memory is freed; otherwise
+ * the toggle counts in nodes above the segment get updated.
*
*--------------------------------------------------------------
*/
static int
-ToggleDeleteProc(segPtr, linePtr, treeGone)
- TkTextSegment *segPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is
- * being deleted, so everything must
- * get cleaned up. */
+ToggleDeleteProc(
+ TkTextSegment *segPtr, /* Segment to check. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
+ * deleted, so everything must get cleaned
+ * up. */
{
if (treeGone) {
ckfree((char *) segPtr);
@@ -3544,11 +4709,11 @@ ToggleDeleteProc(segPtr, linePtr, treeGone)
}
/*
- * This toggle is in the middle of a range of characters that's
- * being deleted. Refuse to die. We'll be moved to the end of
- * the deleted range and our cleanup procedure will be called
- * later. Decrement node toggle counts here, and set a flag
- * so we'll re-increment them in the cleanup procedure.
+ * This toggle is in the middle of a range of characters that's being
+ * deleted. Refuse to die. We'll be moved to the end of the deleted range
+ * and our cleanup function will be called later. Decrement node toggle
+ * counts here, and set a flag so we'll re-increment them in the cleanup
+ * function.
*/
if (segPtr->body.toggle.inNodeCounts) {
@@ -3564,37 +4729,36 @@ ToggleDeleteProc(segPtr, linePtr, treeGone)
*
* ToggleCleanupProc --
*
- * This procedure is called when a toggle is part of a line that's
- * been modified in some way. It's invoked after the
- * modifications are complete.
+ * This function is called when a toggle is part of a line that's been
+ * modified in some way. It's invoked after the modifications are
+ * complete.
*
* Results:
- * The return value is the head segment in a new list
- * that is to replace the tail of the line that used to
- * start at segPtr. This allows the procedure to delete
- * or modify segPtr.
+ * The return value is the head segment in a new list that is to replace
+ * the tail of the line that used to start at segPtr. This allows the
+ * function to delete or modify segPtr.
*
* Side effects:
- * Toggle counts in the nodes above the new line will be
- * updated if they're not already. Toggles may be collapsed
- * if there are duplicate toggles at the same position.
+ * Toggle counts in the nodes above the new line will be updated if
+ * they're not already. Toggles may be collapsed if there are duplicate
+ * toggles at the same position.
*
*--------------------------------------------------------------
*/
static TkTextSegment *
-ToggleCleanupProc(segPtr, linePtr)
- TkTextSegment *segPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line that now contains segment. */
+ToggleCleanupProc(
+ TkTextSegment *segPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line that now contains segment. */
{
TkTextSegment *segPtr2, *prevPtr;
int counts;
/*
- * If this is a toggle-off segment, look ahead through the next
- * segments to see if there's a toggle-on segment for the same tag
- * before any segments with non-zero size. If so then the two
- * toggles cancel each other; remove them both.
+ * If this is a toggle-off segment, look ahead through the next segments
+ * to see if there's a toggle-on segment for the same tag before any
+ * segments with non-zero size. If so then the two toggles cancel each
+ * other; remove them both.
*/
if (segPtr->typePtr == &tkTextToggleOffType) {
@@ -3634,8 +4798,8 @@ ToggleCleanupProc(segPtr, linePtr)
*
* ToggleLineChangeProc --
*
- * This procedure is invoked when a toggle segment is about
- * to move from one line to another.
+ * This function is invoked when a toggle segment is about to move from
+ * one line to another.
*
* Results:
* None.
@@ -3647,9 +4811,9 @@ ToggleCleanupProc(segPtr, linePtr)
*/
static void
-ToggleLineChangeProc(segPtr, linePtr)
- TkTextSegment *segPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line that used to contain segment. */
+ToggleLineChangeProc(
+ TkTextSegment *segPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line that used to contain segment. */
{
if (segPtr->body.toggle.inNodeCounts) {
ChangeNodeToggleCount(linePtr->parentPtr,
@@ -3663,45 +4827,45 @@ ToggleLineChangeProc(segPtr, linePtr)
*
* ToggleCheckProc --
*
- * This procedure is invoked to perform consistency checks
- * on toggle segments.
+ * This function is invoked to perform consistency checks on toggle
+ * segments.
*
* Results:
* None.
*
* Side effects:
- * If a consistency problem is found the procedure panics.
+ * If a consistency problem is found the function panics.
*
*--------------------------------------------------------------
*/
static void
-ToggleCheckProc(segPtr, linePtr)
- TkTextSegment *segPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+ToggleCheckProc(
+ TkTextSegment *segPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
register Summary *summaryPtr;
int needSummary;
if (segPtr->size != 0) {
- panic("ToggleCheckProc: segment had non-zero size");
+ Tcl_Panic("ToggleCheckProc: segment had non-zero size");
}
if (!segPtr->body.toggle.inNodeCounts) {
- panic("ToggleCheckProc: toggle counts not updated in nodes");
+ Tcl_Panic("ToggleCheckProc: toggle counts not updated in nodes");
}
- needSummary = (segPtr->body.toggle.tagPtr->tagRootPtr != linePtr->parentPtr);
+ needSummary = (segPtr->body.toggle.tagPtr->tagRootPtr!=linePtr->parentPtr);
for (summaryPtr = linePtr->parentPtr->summaryPtr; ;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr == NULL) {
if (needSummary) {
- panic("ToggleCheckProc: tag not present in node");
+ Tcl_Panic("ToggleCheckProc: tag not present in node");
} else {
break;
}
}
if (summaryPtr->tagPtr == segPtr->body.toggle.tagPtr) {
if (!needSummary) {
- panic("ToggleCheckProc: tag present in root node summary");
+ Tcl_Panic("ToggleCheckProc: tag present in root node summary");
}
break;
}
@@ -3709,52 +4873,9 @@ ToggleCheckProc(segPtr, linePtr)
}
/*
- *----------------------------------------------------------------------
- *
- * TkBTreeCharsInLine --
- *
- * This procedure returns a count of the number of characters
- * in a given line.
- *
- * Results:
- * The return value is the character count for linePtr.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
*/
-
-int
-TkBTreeCharsInLine(linePtr)
- TkTextLine *linePtr; /* Line whose characters should be
- * counted. */
-{
- TkTextSegment *segPtr;
- int count;
-
- count = 0;
- for (segPtr = linePtr->segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) {
- if (segPtr->typePtr == &tkTextCharType) {
- count += Tcl_NumUtfChars(segPtr->body.chars, segPtr->size);
- } else {
- count += segPtr->size;
- }
- }
- return count;
-}
-
-int
-TkBTreeBytesInLine(linePtr)
- TkTextLine *linePtr; /* Line whose characters should be
- * counted. */
-{
- TkTextSegment *segPtr;
- int count;
-
- count = 0;
- for (segPtr = linePtr->segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) {
- count += segPtr->size;
- }
- return count;
-}
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 1e7ca88..144bca9 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -1,18 +1,18 @@
-/*
+/*
* tkTextDisp.c --
*
- * This module provides facilities to display text widgets. It is
- * the only place where information is kept about the screen layout
- * of text widgets.
+ * This module provides facilities to display text widgets. It is the
+ * only place where information is kept about the screen layout of text
+ * widgets. (Well, strictly, each TkTextLine and B-tree node caches its
+ * last observed pixel height, but that information originates here).
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
#include "tkText.h"
@@ -20,18 +20,102 @@
#include "tkWinInt.h"
#endif
-#ifdef TK_NO_DOUBLE_BUFFERING
#ifdef MAC_OSX_TK
#include "tkMacOSXInt.h"
#endif
-#endif /* TK_NO_DOUBLE_BUFFERING */
+
+/*
+ * "Calculations of line pixel heights and the size of the vertical
+ * scrollbar."
+ *
+ * Given that tag, font and elide changes can happen to large numbers of
+ * diverse chunks in a text widget containing megabytes of text, it is not
+ * possible to recalculate all affected height information immediately any
+ * such change takes place and maintain a responsive user-experience. Yet, for
+ * an accurate vertical scrollbar to be drawn, we must know the total number
+ * of vertical pixels shown on display versus the number available to be
+ * displayed.
+ *
+ * The way the text widget solves this problem is by maintaining cached line
+ * pixel heights (in the BTree for each logical line), and having asynchronous
+ * timer callbacks (i) to iterate through the logical lines recalculating
+ * their heights, and (ii) to recalculate the vertical scrollbar's position
+ * and size.
+ *
+ * Typically this works well but there are some situations where the overall
+ * functional design of this file causes some problems. These problems can
+ * only arise because the calculations used to display lines on screen are not
+ * connected to those in the iterating-line- recalculation-process.
+ *
+ * The reason for this disconnect is that the display calculations operate in
+ * display lines, and the iteration and cache operates in logical lines.
+ * Given that the display calculations both need not contain complete logical
+ * lines (at top or bottom of display), and that they do not actually keep
+ * track of logical lines (for simplicity of code and historical design), this
+ * means a line may be known and drawn with a different pixel height to that
+ * which is cached in the BTree, and this might cause some temporary
+ * undesirable mismatch between display and the vertical scrollbar.
+ *
+ * All such mismatches should be temporary, however, since the asynchronous
+ * height calculations will always catch up eventually.
+ *
+ * For further details see the comments before and within the following
+ * functions below: LayoutDLine, AsyncUpdateLineMetrics, GetYView,
+ * GetYPixelCount, TkTextUpdateOneLine, TkTextUpdateLineMetrics.
+ *
+ * For details of the way in which the BTree keeps track of pixel heights, see
+ * tkTextBTree.c. Basically the BTree maintains two pieces of information: the
+ * logical line indices and the pixel height cache.
+ */
+
+/*
+ * TK_LAYOUT_WITH_BASE_CHUNKS:
+ *
+ * With this macro set, collect all char chunks that have no holes
+ * between them, that are on the same line and use the same font and font
+ * size. Allocate the chars of all these chunks, the so-called "stretch",
+ * in a DString in the first chunk, the so-called "base chunk". Use the
+ * base chunk string for measuring and drawing, so that these actions are
+ * always performed with maximum context.
+ *
+ * This is necessary for text rendering engines that provide ligatures
+ * and sub-pixel layout, like ATSU on Mac. If we don't do this, the
+ * measuring will change all the time, leading to an ugly "tremble and
+ * shiver" effect. This is because of the continuous splitting and
+ * re-merging of chunks that goes on in a text widget, when the cursor or
+ * the selection move.
+ *
+ * Side effects:
+ *
+ * Memory management changes. Instead of attaching the character data to
+ * the clientData structures of the char chunks, an additional DString is
+ * used. The collection process will even lead to resizing this DString
+ * for large stretches (> TCL_DSTRING_STATIC_SIZE == 200). We could
+ * reduce the overall memory footprint by copying the result to a plain
+ * char array after the line breaking process, but that would complicate
+ * the code and make performance even worse speedwise. See also TODOs.
+ *
+ * TODOs:
+ *
+ * - Move the character collection process from the LayoutProc into
+ * LayoutDLine(), so that the collection can be done before actual
+ * layout. In this way measuring can look at the following text, too,
+ * right from the beginning. Memory handling can also be improved with
+ * this. Problem: We don't easily know which chunks are adjacent until
+ * all the other chunks have calculated their width. Apparently marks
+ * would return width==0. A separate char collection loop would have to
+ * know these things.
+ *
+ * - Use a new context parameter to pass the context from LayoutDLine() to
+ * the LayoutProc instead of using a global variable like now. Not
+ * pressing until the previous point gets implemented.
+ */
/*
* The following structure describes how to display a range of characters.
- * The information is generated by scanning all of the tags associated
- * with the characters and combining that with default information for
- * the overall widget. These structures form the hash keys for
- * dInfoPtr->styleTable.
+ * The information is generated by scanning all of the tags associated with
+ * the characters and combining that with default information for the overall
+ * widget. These structures form the hash keys for dInfoPtr->styleTable.
*/
typedef struct StyleValues {
@@ -39,13 +123,12 @@ typedef struct StyleValues {
* NULL means use widget background. */
int borderWidth; /* Width of 3-D border for background. */
int relief; /* 3-D relief for background. */
- Pixmap bgStipple; /* Stipple bitmap for background. None
- * means draw solid. */
+ Pixmap bgStipple; /* Stipple bitmap for background. None means
+ * draw solid. */
XColor *fgColor; /* Foreground color for text. */
Tk_Font tkfont; /* Font for displaying text. */
Pixmap fgStipple; /* Stipple bitmap for text and other
- * foreground stuff. None means draw
- * solid.*/
+ * foreground stuff. None means draw solid.*/
int justify; /* Justification style for text. */
int lMargin1; /* Left margin, in pixels, for first display
* line of each text line. */
@@ -59,11 +142,12 @@ typedef struct StyleValues {
int spacing1; /* Spacing above first dline in text line. */
int spacing2; /* Spacing between lines of dline. */
int spacing3; /* Spacing below last dline in text line. */
- TkTextTabArray *tabArrayPtr;/* Locations and types of tab stops (may
- * be NULL). */
+ TkTextTabArray *tabArrayPtr;/* Locations and types of tab stops (may be
+ * NULL). */
+ int tabStyle; /* One of TABULAR or WORDPROCESSOR. */
int underline; /* Non-zero means draw underline underneath
* text. */
- int elide; /* Non-zero means draw text */
+ int elide; /* Zero means draw text, otherwise not. */
TkWrapMode wrapMode; /* How to handle wrap-around for this tag.
* One of TEXT_WRAPMODE_CHAR,
* TEXT_WRAPMODE_NONE or TEXT_WRAPMODE_WORD.*/
@@ -71,128 +155,146 @@ typedef struct StyleValues {
/*
* The following structure extends the StyleValues structure above with
- * graphics contexts used to actually draw the characters. The entries
- * in dInfoPtr->styleTable point to structures of this type.
+ * graphics contexts used to actually draw the characters. The entries in
+ * dInfoPtr->styleTable point to structures of this type.
*/
typedef struct TextStyle {
int refCount; /* Number of times this structure is
* referenced in Chunks. */
- GC bgGC; /* Graphics context for background. None
- * means use widget background. */
+ GC bgGC; /* Graphics context for background. None means
+ * use widget background. */
GC fgGC; /* Graphics context for foreground. */
StyleValues *sValuePtr; /* Raw information from which GCs were
* derived. */
- Tcl_HashEntry *hPtr; /* Pointer to entry in styleTable. Used
- * to delete entry. */
+ Tcl_HashEntry *hPtr; /* Pointer to entry in styleTable. Used to
+ * delete entry. */
} TextStyle;
/*
- * The following macro determines whether two styles have the same
- * background so that, for example, no beveled border should be drawn
- * between them.
+ * The following macro determines whether two styles have the same background
+ * so that, for example, no beveled border should be drawn between them.
*/
#define SAME_BACKGROUND(s1, s2) \
(((s1)->sValuePtr->border == (s2)->sValuePtr->border) \
- && ((s1)->sValuePtr->borderWidth == (s2)->sValuePtr->borderWidth) \
- && ((s1)->sValuePtr->relief == (s2)->sValuePtr->relief) \
- && ((s1)->sValuePtr->bgStipple == (s2)->sValuePtr->bgStipple))
+ && ((s1)->sValuePtr->borderWidth == (s2)->sValuePtr->borderWidth) \
+ && ((s1)->sValuePtr->relief == (s2)->sValuePtr->relief) \
+ && ((s1)->sValuePtr->bgStipple == (s2)->sValuePtr->bgStipple))
/*
- * The following macro is used to compare two floating-point numbers
- * to within a certain degree of scale. Direct comparison fails on
- * processors where the processor and memory representations of FP
- * numbers of a particular precision is different (e.g. Intel)
+ * The following macro is used to compare two floating-point numbers to within
+ * a certain degree of scale. Direct comparison fails on processors where the
+ * processor and memory representations of FP numbers of a particular
+ * precision is different (e.g. Intel)
*/
#define FP_EQUAL_SCALE(double1, double2, scaleFactor) \
(fabs((double1)-(double2))*((scaleFactor)+1.0) < 0.3)
/*
- * The following structure describes one line of the display, which may
- * be either part or all of one line of the text.
+ * Macro to make debugging/testing logging a little easier.
+ */
+
+#define LOG(toVar,what) \
+ Tcl_SetVar2(textPtr->interp, toVar, NULL, (what), \
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT)
+
+/*
+ * The following structure describes one line of the display, which may be
+ * either part or all of one line of the text.
*/
typedef struct DLine {
- TkTextIndex index; /* Identifies first character in text
- * that is displayed on this line. */
+ TkTextIndex index; /* Identifies first character in text that is
+ * displayed on this line. */
int byteCount; /* Number of bytes accounted for by this
- * display line, including a trailing space
- * or newline that isn't actually displayed. */
- int y; /* Y-position at which line is supposed to
- * be drawn (topmost pixel of rectangular
- * area occupied by line). */
- int oldY; /* Y-position at which line currently
- * appears on display. -1 means line isn't
- * currently visible on display and must be
- * redrawn. This is used to move lines by
- * scrolling rather than re-drawing. */
+ * display line, including a trailing space or
+ * newline that isn't actually displayed. */
+ int logicalLinesMerged; /* Number of extra logical lines merged into
+ * this one due to elided newlines. */
+ int y; /* Y-position at which line is supposed to be
+ * drawn (topmost pixel of rectangular area
+ * occupied by line). */
+ int oldY; /* Y-position at which line currently appears
+ * on display. This is used to move lines by
+ * scrolling rather than re-drawing. If
+ * 'flags' have the OLD_Y_INVALID bit set,
+ * then we will never examine this field
+ * (which means line isn't currently visible
+ * on display and must be redrawn). */
int height; /* Height of line, in pixels. */
int baseline; /* Offset of text baseline from y, in
* pixels. */
- int spaceAbove; /* How much extra space was added to the
- * top of the line because of spacing
- * options. This is included in height
- * and baseline. */
+ int spaceAbove; /* How much extra space was added to the top
+ * of the line because of spacing options.
+ * This is included in height and baseline. */
int spaceBelow; /* How much extra space was added to the
* bottom of the line because of spacing
- * options. This is included in height. */
+ * options. This is included in height. */
int length; /* Total length of line, in pixels. */
- TkTextDispChunk *chunkPtr; /* Pointer to first chunk in list of all
- * of those that are displayed on this
- * line of the screen. */
- struct DLine *nextPtr; /* Next in list of all display lines for
- * this window. The list is sorted in
- * order from top to bottom. Note: the
- * next DLine doesn't always correspond
- * to the next line of text: (a) can have
- * multiple DLines for one text line, and
- * (b) can have gaps where DLine's have been
- * deleted because they're out of date. */
- int flags; /* Various flag bits: see below for values. */
+ TkTextDispChunk *chunkPtr; /* Pointer to first chunk in list of all of
+ * those that are displayed on this line of
+ * the screen. */
+ struct DLine *nextPtr; /* Next in list of all display lines for this
+ * window. The list is sorted in order from
+ * top to bottom. Note: the next DLine doesn't
+ * always correspond to the next line of text:
+ * (a) can have multiple DLines for one text
+ * line, and (b) can have gaps where DLine's
+ * have been deleted because they're out of
+ * date. */
+ int flags; /* Various flag bits: see below for values. */
} DLine;
/*
* Flag bits for DLine structures:
*
- * HAS_3D_BORDER - Non-zero means that at least one of the
- * chunks in this line has a 3D border, so
- * it potentially interacts with 3D borders
- * in neighboring lines (see
- * DisplayLineBackground).
+ * HAS_3D_BORDER - Non-zero means that at least one of the chunks
+ * in this line has a 3D border, so it
+ * potentially interacts with 3D borders in
+ * neighboring lines (see DisplayLineBackground).
* NEW_LAYOUT - Non-zero means that the line has been
- * re-layed out since the last time the
- * display was updated.
- * TOP_LINE - Non-zero means that this was the top line
+ * re-layed out since the last time the display
+ * was updated.
+ * TOP_LINE - Non-zero means that this was the top line in
* in the window the last time that the window
- * was laid out. This is important because
- * a line may be displayed differently if its
- * at the top or bottom than if it's in the
- * middle (e.g. beveled edges aren't displayed
- * for middle lines if the adjacent line has
- * a similar background).
+ * was laid out. This is important because a line
+ * may be displayed differently if its at the top
+ * or bottom than if it's in the middle
+ * (e.g. beveled edges aren't displayed for
+ * middle lines if the adjacent line has a
+ * similar background).
* BOTTOM_LINE - Non-zero means that this was the bottom line
* in the window the last time that the window
* was laid out.
- * IS_DISABLED - This Dline cannot be edited.
+ * OLD_Y_INVALID - The value of oldY in the structure is not
+ * valid or useful and should not be examined.
+ * 'oldY' is only useful when the DLine is
+ * currently displayed at a different position
+ * and we wish to re-display it via scrolling, so
+ * this means the DLine needs redrawing.
*/
#define HAS_3D_BORDER 1
#define NEW_LAYOUT 2
#define TOP_LINE 4
#define BOTTOM_LINE 8
-#define IS_DISABLED 16
+#define OLD_Y_INVALID 16
/*
* Overall display information for a text widget:
*/
typedef struct TextDInfo {
- Tcl_HashTable styleTable; /* Hash table that maps from StyleValues
- * to TextStyles for this widget. */
- DLine *dLinePtr; /* First in list of all display lines for
- * this widget, in order from top to bottom. */
+ Tcl_HashTable styleTable; /* Hash table that maps from StyleValues to
+ * TextStyles for this widget. */
+ DLine *dLinePtr; /* First in list of all display lines for this
+ * widget, in order from top to bottom. */
+ int topPixelOffset; /* Identifies first pixel in top display line
+ * to display in window. */
+ int newTopPixelOffset; /* Desired first pixel in top display line to
+ * display in window. */
GC copyGC; /* Graphics context for copying from off-
* screen pixmaps onto screen. */
GC scrollGC; /* Graphics context for copying from one place
@@ -207,12 +309,12 @@ typedef struct TextDInfo {
* Leaves space for border, etc. */
int maxX; /* First x-coordinate to right of available
* space for displaying lines. */
- int maxY; /* First y-coordinate below available
- * space for displaying lines. */
+ int maxY; /* First y-coordinate below available space
+ * for displaying lines. */
int topOfEof; /* Top-most pixel (lowest y-value) that has
* been drawn in the appropriate fashion for
* the portion of the window after the last
- * line of the text. This field is used to
+ * line of the text. This field is used to
* figure out when to redraw part or all of
* the eof field. */
@@ -220,34 +322,32 @@ typedef struct TextDInfo {
* Information used for scrolling:
*/
- int newByteOffset; /* Desired x scroll position, measured as the
- * number of average-size characters off-screen
- * to the left for a line with no left
- * margin. */
- int curPixelOffset; /* Actual x scroll position, measured as the
+ int newXPixelOffset; /* Desired x scroll position, measured as the
+ * number of pixels off-screen to the left for
+ * a line with no left margin. */
+ int curXPixelOffset; /* Actual x scroll position, measured as the
* number of pixels off-screen to the left. */
int maxLength; /* Length in pixels of longest line that's
* visible in window (length may exceed window
- * size). If there's no wrapping, this will
- * be zero. */
+ * size). If there's no wrapping, this will be
+ * zero. */
double xScrollFirst, xScrollLast;
/* Most recent values reported to horizontal
- * scrollbar; used to eliminate unnecessary
+ * scrollbar; used to eliminate unnecessary
* reports. */
double yScrollFirst, yScrollLast;
/* Most recent values reported to vertical
- * scrollbar; used to eliminate unnecessary
+ * scrollbar; used to eliminate unnecessary
* reports. */
/*
* The following information is used to implement scanning:
*/
- int scanMarkIndex; /* Byte index of character that was at the
- * left edge of the window when the scan
- * started. */
+ int scanMarkXPixel; /* Pixel index of left edge of the window when
+ * the scan started. */
int scanMarkX; /* X-position of mouse at time scan started. */
- int scanTotalScroll; /* Total scrolling (in screen lines) that has
+ int scanTotalYScroll; /* Total scrolling (in screen pixels) that has
* occurred since scanMarkY was set. */
int scanMarkY; /* Y-position of mouse at time scan started. */
@@ -257,47 +357,112 @@ typedef struct TextDInfo {
int dLinesInvalidated; /* This value is set to 1 whenever something
* happens that invalidates information in
- * DLine structures; if a redisplay
- * is in progress, it will see this and
- * abort the redisplay. This is needed
- * because, for example, an embedded window
- * could change its size when it is first
- * displayed, invalidating the DLine that
- * is currently being displayed. If redisplay
- * continues, it will use freed memory and
- * could dump core. */
- int flags; /* Various flag values: see below for
+ * DLine structures; if a redisplay is in
+ * progress, it will see this and abort the
+ * redisplay. This is needed because, for
+ * example, an embedded window could change
+ * its size when it is first displayed,
+ * invalidating the DLine that is currently
+ * being displayed. If redisplay continues, it
+ * will use freed memory and could dump
+ * core. */
+ int flags; /* Various flag values: see below for
* definitions. */
+ /*
+ * Information used to handle the asynchronous updating of the y-scrollbar
+ * and the vertical height calculations:
+ */
+
+ int lineMetricUpdateEpoch; /* Stores a number which is incremented each
+ * time the text widget changes in a
+ * significant way (e.g. resizing or
+ * geometry-influencing tag changes). */
+ int currentMetricUpdateLine;/* Stores a counter which is used to iterate
+ * over the logical lines contained in the
+ * widget and update their geometry
+ * calculations, if they are out of date. */
+ TkTextIndex metricIndex; /* If the current metric update line wraps
+ * into very many display lines, then this is
+ * used to keep track of what index we've got
+ * to so far... */
+ int metricPixelHeight; /* ...and this is for the height calculation
+ * so far...*/
+ int metricEpoch; /* ...and this for the epoch of the partial
+ * calculation so it can be cancelled if
+ * things change once more. This field will be
+ * -1 if there is no long-line calculation in
+ * progress, and take a non-negative value if
+ * there is such a calculation in progress. */
+ int lastMetricUpdateLine; /* When the current update line reaches this
+ * line, we are done and should stop the
+ * asychronous callback mechanism. */
+ Tcl_TimerToken lineUpdateTimer;
+ /* A token pointing to the current line metric
+ * update callback. */
+ Tcl_TimerToken scrollbarTimer;
+ /* A token pointing to the current scrollbar
+ * update callback. */
} TextDInfo;
/*
- * In TkTextDispChunk structures for character segments, the clientData
- * field points to one of the following structures:
+ * In TkTextDispChunk structures for character segments, the clientData field
+ * points to one of the following structures:
*/
+#if !TK_LAYOUT_WITH_BASE_CHUNKS
+
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
- char chars[4]; /* UTF characters to display. Actual size
- * will be numBytes, not 4. THIS MUST BE
- * THE LAST FIELD IN THE STRUCTURE. */
+ char chars[4]; /* UTF characters to display. Actual size will
+ * be numBytes, not 4. THIS MUST BE THE LAST
+ * FIELD IN THE STRUCTURE. */
+} CharInfo;
+
+#else /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
+typedef struct CharInfo {
+ TkTextDispChunk *baseChunkPtr;
+ int baseOffset; /* Starting offset in base chunk
+ * baseChars. */
+ int numBytes; /* Number of bytes that belong to this
+ * chunk. */
+ const char *chars; /* UTF characters to display. Actually points
+ * into the baseChars of the base chunk. Only
+ * valid after FinalizeBaseChunk(). */
} CharInfo;
/*
+ * The BaseCharInfo is a CharInfo with some additional data added.
+ */
+
+typedef struct BaseCharInfo {
+ CharInfo ci;
+ Tcl_DString baseChars; /* Actual characters for the stretch of text
+ * represented by this base chunk. */
+ int width; /* Width in pixels of the whole string, if
+ * known, else -1. Valid during
+ * LayoutDLine(). */
+} BaseCharInfo;
+
+static TkTextDispChunk *baseCharChunkPtr = NULL;
+
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
+/*
* Flag values for TextDInfo structures:
*
- * DINFO_OUT_OF_DATE: Non-zero means that the DLine structures
- * for this window are partially or completely
- * out of date and need to be recomputed.
+ * DINFO_OUT_OF_DATE: Non-zero means that the DLine structures for
+ * this window are partially or completely out of
+ * date and need to be recomputed.
* REDRAW_PENDING: Means that a when-idle handler has been
* scheduled to update the display.
* REDRAW_BORDERS: Means window border or pad area has
* potentially been damaged and must be redrawn.
- * REPICK_NEEDED: 1 means that the widget has been modified
- * in a way that could change the current
- * character (a different character might be
- * under the mouse cursor now). Need to
- * recompute the current character before
- * the next redisplay.
+ * REPICK_NEEDED: 1 means that the widget has been modified in a
+ * way that could change the current character (a
+ * different character might be under the mouse
+ * cursor now). Need to recompute the current
+ * character before the next redisplay.
*/
#define DINFO_OUT_OF_DATE 1
@@ -306,92 +471,140 @@ typedef struct CharInfo {
#define REPICK_NEEDED 8
/*
- * The following counters keep statistics about redisplay that can be
- * checked to see how clever this code is at reducing redisplays.
+ * Action values for FreeDLines:
+ *
+ * DLINE_FREE: Free the lines, but no need to unlink them from the
+ * current list of actual display lines.
+ * DLINE_UNLINK: Free and unlink from current display.
+ * DLINE_FREE_TEMP: Free, but don't unlink, and also don't set
+ * 'dLinesInvalidated'.
+ */
+
+#define DLINE_FREE 0
+#define DLINE_UNLINK 1
+#define DLINE_FREE_TEMP 2
+
+/*
+ * The following counters keep statistics about redisplay that can be checked
+ * to see how clever this code is at reducing redisplays.
*/
static int numRedisplays; /* Number of calls to DisplayText. */
static int linesRedrawn; /* Number of calls to DisplayDLine. */
static int numCopies; /* Number of calls to XCopyArea to copy part
* of the screen. */
-
+static int lineHeightsRecalculated;
+ /* Number of line layouts purely for height
+ * calculation purposes.*/
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void AdjustForTab _ANSI_ARGS_((TkText *textPtr,
+static void AdjustForTab(TkText *textPtr,
TkTextTabArray *tabArrayPtr, int index,
- TkTextDispChunk *chunkPtr));
-static void CharBboxProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int index, int y, int lineHeight, int baseline,
- int *xPtr, int *yPtr, int *widthPtr,
- int *heightPtr));
-static void CharDisplayProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int x, int y, int height, int baseline,
- Display *display, Drawable dst, int screenY));
-static int CharMeasureProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int x));
-static void CharUndisplayProc _ANSI_ARGS_((TkText *textPtr,
- TkTextDispChunk *chunkPtr));
+ TkTextDispChunk *chunkPtr);
+static void CharBboxProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr, int index, int y,
+ int lineHeight, int baseline, int *xPtr,
+ int *yPtr, int *widthPtr, int *heightPtr);
+static int CharChunkMeasureChars(TkTextDispChunk *chunkPtr,
+ const char *chars, int charsLen,
+ int start, int end, int startX, int maxX,
+ int flags, int *nextX);
+static void CharDisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr, int x, int y,
+ int height, int baseline, Display *display,
+ Drawable dst, int screenY);
+static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x);
+static void CharUndisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr);
+static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr);
+static int IsSameFGStyle(TextStyle *style1, TextStyle *style2);
+static void RemoveFromBaseChunk(TkTextDispChunk *chunkPtr);
+#endif
+/*
+ * Definitions of elided procs. Compiler can't inline these since we use
+ * pointers to these functions. ElideDisplayProc and ElideUndisplayProc are
+ * special-cased for speed, as potentially many elided DLine chunks if large,
+ * tag toggle-filled elided region.
+ */
+static void ElideBboxProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr, int index, int y,
+ int lineHeight, int baseline, int *xPtr,
+ int *yPtr, int *widthPtr, int *heightPtr);
+static int ElideMeasureProc(TkTextDispChunk *chunkPtr, int x);
+static void DisplayDLine(TkText *textPtr, DLine *dlPtr,
+ DLine *prevPtr, Pixmap pixmap);
+static void DisplayLineBackground(TkText *textPtr, DLine *dlPtr,
+ DLine *prevPtr, Pixmap pixmap);
+static void DisplayText(ClientData clientData);
+static DLine * FindDLine(DLine *dlPtr, CONST TkTextIndex *indexPtr);
+static void FreeDLines(TkText *textPtr, DLine *firstPtr,
+ DLine *lastPtr, int action);
+static void FreeStyle(TkText *textPtr, TextStyle *stylePtr);
+static TextStyle * GetStyle(TkText *textPtr, CONST TkTextIndex *indexPtr);
+static void GetXView(Tcl_Interp *interp, TkText *textPtr,
+ int report);
+static void GetYView(Tcl_Interp *interp, TkText *textPtr,
+ int report);
+static int GetYPixelCount(TkText *textPtr, DLine *dlPtr);
+static DLine * LayoutDLine(TkText *textPtr,
+ CONST TkTextIndex *indexPtr);
+static int MeasureChars(Tk_Font tkfont, CONST char *source,
+ int maxBytes, int rangeStart, int rangeLength,
+ int startX, int maxX, int flags, int *nextXPtr);
+static void MeasureUp(TkText *textPtr,
+ CONST TkTextIndex *srcPtr, int distance,
+ TkTextIndex *dstPtr, int *overlap);
+static int NextTabStop(Tk_Font tkfont, int x, int tabOrigin);
+static void UpdateDisplayInfo(TkText *textPtr);
+static void YScrollByLines(TkText *textPtr, int offset);
+static void YScrollByPixels(TkText *textPtr, int offset);
+static int SizeOfTab(TkText *textPtr, int tabStyle,
+ TkTextTabArray *tabArrayPtr, int *indexPtr, int x,
+ int maxX);
+static void TextChanged(TkText *textPtr,
+ CONST TkTextIndex *index1Ptr,
+ CONST TkTextIndex *index2Ptr);
+static void TextInvalidateRegion(TkText *textPtr, TkRegion region);
+static void TextRedrawTag(TkText *textPtr,
+ TkTextIndex *index1Ptr, TkTextIndex *index2Ptr,
+ TkTextTag *tagPtr, int withTag);
+static void TextInvalidateLineMetrics(TkText *textPtr,
+ TkTextLine *linePtr, int lineCount, int action);
+static int CalculateDisplayLineHeight(TkText *textPtr,
+ CONST TkTextIndex *indexPtr, int *byteCountPtr,
+ int *mergedLinePtr);
+static void DlineIndexOfX(TkText *textPtr,
+ DLine *dlPtr, int x, TkTextIndex *indexPtr);
+static int DlineXOfIndex(TkText *textPtr,
+ DLine *dlPtr, int byteIndex);
+static int TextGetScrollInfoObj(Tcl_Interp *interp,
+ TkText *textPtr, int objc,
+ Tcl_Obj *CONST objv[], double *dblPtr,
+ int *intPtr);
+static void AsyncUpdateLineMetrics(ClientData clientData);
+static void AsyncUpdateYScrollbar(ClientData clientData);
/*
- Definitions of elided procs.
- Compiler can't inline these since we use pointers to these functions.
- ElideDisplayProc, ElideUndisplayProc special-cased for speed,
- as potentially many elided DLine chunks if large, tag toggle-filled
- elided region.
-*/
-static void ElideBboxProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int index, int y, int lineHeight, int baseline,
- int *xPtr, int *yPtr, int *widthPtr,
- int *heightPtr));
-static int ElideMeasureProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int x));
-
-static void DisplayDLine _ANSI_ARGS_((TkText *textPtr,
- DLine *dlPtr, DLine *prevPtr, Pixmap pixmap));
-static void DisplayLineBackground _ANSI_ARGS_((TkText *textPtr,
- DLine *dlPtr, DLine *prevPtr, Pixmap pixmap));
-static void DisplayText _ANSI_ARGS_((ClientData clientData));
-static DLine * FindDLine _ANSI_ARGS_((DLine *dlPtr,
- TkTextIndex *indexPtr));
-static void FreeDLines _ANSI_ARGS_((TkText *textPtr,
- DLine *firstPtr, DLine *lastPtr, int unlink));
-static void FreeStyle _ANSI_ARGS_((TkText *textPtr,
- TextStyle *stylePtr));
-static TextStyle * GetStyle _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr));
-static void GetXView _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, int report));
-static void GetYView _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, int report));
-static DLine * LayoutDLine _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr));
-static int MeasureChars _ANSI_ARGS_((Tk_Font tkfont,
- CONST char *source, int maxBytes, int startX,
- int maxX, int tabOrigin, int *nextXPtr));
-static void MeasureUp _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *srcPtr, int distance,
- TkTextIndex *dstPtr));
-static int NextTabStop _ANSI_ARGS_((Tk_Font tkfont, int x,
- int tabOrigin));
-static void UpdateDisplayInfo _ANSI_ARGS_((TkText *textPtr));
-static void ScrollByLines _ANSI_ARGS_((TkText *textPtr,
- int offset));
-static int SizeOfTab _ANSI_ARGS_((TkText *textPtr,
- TkTextTabArray *tabArrayPtr, int index, int x,
- int maxX));
-static void TextInvalidateRegion _ANSI_ARGS_((TkText *textPtr,
- TkRegion region));
+ * Result values returned by TextGetScrollInfoObj:
+ */
+#define TKTEXT_SCROLL_MOVETO 1
+#define TKTEXT_SCROLL_PAGES 2
+#define TKTEXT_SCROLL_UNITS 3
+#define TKTEXT_SCROLL_ERROR 4
+#define TKTEXT_SCROLL_PIXELS 5
/*
*----------------------------------------------------------------------
*
* TkTextCreateDInfo --
*
- * This procedure is called when a new text widget is created.
- * Its job is to set up display-related information for the widget.
+ * This function is called when a new text widget is created. Its job is
+ * to set up display-related information for the widget.
*
* Results:
* None.
@@ -404,8 +617,8 @@ static void TextInvalidateRegion _ANSI_ARGS_((TkText *textPtr,
*/
void
-TkTextCreateDInfo(textPtr)
- TkText *textPtr; /* Overall information for text widget. */
+TkTextCreateDInfo(
+ TkText *textPtr) /* Overall information for text widget. */
{
register TextDInfo *dInfoPtr;
XGCValues gcValues;
@@ -418,19 +631,39 @@ TkTextCreateDInfo(textPtr)
dInfoPtr->scrollGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures,
&gcValues);
dInfoPtr->topOfEof = 0;
- dInfoPtr->newByteOffset = 0;
- dInfoPtr->curPixelOffset = 0;
+ dInfoPtr->newXPixelOffset = 0;
+ dInfoPtr->curXPixelOffset = 0;
dInfoPtr->maxLength = 0;
dInfoPtr->xScrollFirst = -1;
dInfoPtr->xScrollLast = -1;
dInfoPtr->yScrollFirst = -1;
dInfoPtr->yScrollLast = -1;
- dInfoPtr->scanMarkIndex = 0;
+ dInfoPtr->scanMarkXPixel = 0;
dInfoPtr->scanMarkX = 0;
- dInfoPtr->scanTotalScroll = 0;
+ dInfoPtr->scanTotalYScroll = 0;
dInfoPtr->scanMarkY = 0;
dInfoPtr->dLinesInvalidated = 0;
dInfoPtr->flags = DINFO_OUT_OF_DATE;
+ dInfoPtr->topPixelOffset = 0;
+ dInfoPtr->newTopPixelOffset = 0;
+ dInfoPtr->currentMetricUpdateLine = -1;
+ dInfoPtr->lastMetricUpdateLine = -1;
+ dInfoPtr->lineMetricUpdateEpoch = 1;
+ dInfoPtr->metricEpoch = -1;
+ dInfoPtr->metricIndex.textPtr = NULL;
+ dInfoPtr->metricIndex.linePtr = NULL;
+
+ /*
+ * Add a refCount for each of the idle call-backs.
+ */
+
+ textPtr->refCount++;
+ dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(0,
+ AsyncUpdateLineMetrics, (ClientData) textPtr);
+ textPtr->refCount++;
+ dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200,
+ AsyncUpdateYScrollbar, (ClientData) textPtr);
+
textPtr->dInfoPtr = dInfoPtr;
}
@@ -439,7 +672,7 @@ TkTextCreateDInfo(textPtr)
*
* TkTextFreeDInfo --
*
- * This procedure is called to free up all of the private display
+ * This function is called to free up all of the private display
* information kept by this file for a text widget.
*
* Results:
@@ -452,19 +685,19 @@ TkTextCreateDInfo(textPtr)
*/
void
-TkTextFreeDInfo(textPtr)
- TkText *textPtr; /* Overall information for text widget. */
+TkTextFreeDInfo(
+ TkText *textPtr) /* Overall information for text widget. */
{
register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
/*
- * Be careful to free up styleTable *after* freeing up all the
- * DLines, so that the hash table is still intact to free up the
- * style-related information from the lines. Once the lines are
- * all free then styleTable will be empty.
+ * Be careful to free up styleTable *after* freeing up all the DLines, so
+ * that the hash table is still intact to free up the style-related
+ * information from the lines. Once the lines are all free then styleTable
+ * will be empty.
*/
- FreeDLines(textPtr, dInfoPtr->dLinePtr, (DLine *) NULL, 1);
+ FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK);
Tcl_DeleteHashTable(&dInfoPtr->styleTable);
if (dInfoPtr->copyGC != None) {
Tk_FreeGC(textPtr->display, dInfoPtr->copyGC);
@@ -473,6 +706,16 @@ TkTextFreeDInfo(textPtr)
if (dInfoPtr->flags & REDRAW_PENDING) {
Tcl_CancelIdleCall(DisplayText, (ClientData) textPtr);
}
+ if (dInfoPtr->lineUpdateTimer != NULL) {
+ Tcl_DeleteTimerHandler(dInfoPtr->lineUpdateTimer);
+ textPtr->refCount--;
+ dInfoPtr->lineUpdateTimer = NULL;
+ }
+ if (dInfoPtr->scrollbarTimer != NULL) {
+ Tcl_DeleteTimerHandler(dInfoPtr->scrollbarTimer);
+ textPtr->refCount--;
+ dInfoPtr->scrollbarTimer = NULL;
+ }
ckfree((char *) dInfoPtr);
}
@@ -481,8 +724,8 @@ TkTextFreeDInfo(textPtr)
*
* GetStyle --
*
- * This procedure creates all the information needed to display
- * text at a particular location.
+ * This function creates all the information needed to display text at a
+ * particular location.
*
* Results:
* The return value is a pointer to a TextStyle structure that
@@ -495,47 +738,44 @@ TkTextFreeDInfo(textPtr)
*/
static TextStyle *
-GetStyle(textPtr, indexPtr)
- TkText *textPtr; /* Overall information about text widget. */
- TkTextIndex *indexPtr; /* The character in the text for which
- * display information is wanted. */
+GetStyle(
+ TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *indexPtr)/* The character in the text for which display
+ * information is wanted. */
{
TkTextTag **tagPtrs;
register TkTextTag *tagPtr;
StyleValues styleValues;
TextStyle *stylePtr;
Tcl_HashEntry *hPtr;
- int numTags, new, i;
+ int numTags, isNew, i;
XGCValues gcValues;
unsigned long mask;
-
/*
* The variables below keep track of the highest-priority specification
* that has occurred for each of the various fields of the StyleValues.
*/
-
int borderPrio, borderWidthPrio, reliefPrio, bgStipplePrio;
int fgPrio, fontPrio, fgStipplePrio;
int underlinePrio, elidePrio, justifyPrio, offsetPrio;
int lMargin1Prio, lMargin2Prio, rMarginPrio;
int spacing1Prio, spacing2Prio, spacing3Prio;
- int overstrikePrio, tabPrio, wrapPrio;
+ int overstrikePrio, tabPrio, tabStylePrio, wrapPrio;
/*
- * Find out what tags are present for the character, then compute
- * a StyleValues structure corresponding to those tags (scan
- * through all of the tags, saving information for the highest-
- * priority tag).
+ * Find out what tags are present for the character, then compute a
+ * StyleValues structure corresponding to those tags (scan through all of
+ * the tags, saving information for the highest-priority tag).
*/
- tagPtrs = TkBTreeGetTags(indexPtr, &numTags);
+ tagPtrs = TkBTreeGetTags(indexPtr, textPtr, &numTags);
borderPrio = borderWidthPrio = reliefPrio = bgStipplePrio = -1;
fgPrio = fontPrio = fgStipplePrio = -1;
underlinePrio = elidePrio = justifyPrio = offsetPrio = -1;
lMargin1Prio = lMargin2Prio = rMarginPrio = -1;
spacing1Prio = spacing2Prio = spacing3Prio = -1;
- overstrikePrio = tabPrio = wrapPrio = -1;
- memset((VOID *) &styleValues, 0, sizeof(StyleValues));
+ overstrikePrio = tabPrio = tabStylePrio = wrapPrio = -1;
+ memset(&styleValues, 0, sizeof(StyleValues));
styleValues.relief = TK_RELIEF_FLAT;
styleValues.fgColor = textPtr->fgColor;
styleValues.tkfont = textPtr->tkfont;
@@ -544,33 +784,40 @@ GetStyle(textPtr, indexPtr)
styleValues.spacing2 = textPtr->spacing2;
styleValues.spacing3 = textPtr->spacing3;
styleValues.tabArrayPtr = textPtr->tabArrayPtr;
+ styleValues.tabStyle = textPtr->tabStyle;
styleValues.wrapMode = textPtr->wrapMode;
styleValues.elide = 0;
+
for (i = 0 ; i < numTags; i++) {
+ Tk_3DBorder border;
+
tagPtr = tagPtrs[i];
+ border = tagPtr->border;
/*
- * Skip the selection tag if we don't have focus,
- * unless we always want to show the selection.
+ * If this is the selection tag, and inactiveSelBorder is NULL (the
+ * default on Windows), then we need to skip it if we don't have the
+ * focus.
*/
- if (
-#ifndef MAC_OSX_TK
- !TkpAlwaysShowSelection(textPtr->tkwin)
-#else
- /* Don't show inactive selection in disabled widgets. */
- textPtr->state == TK_STATE_DISABLED
+ if ((tagPtr == textPtr->selTagPtr) && !(textPtr->flags & GOT_FOCUS)) {
+ if (textPtr->inactiveSelBorder == NULL
+#ifdef MAC_OSX_TK
+ /* Don't show inactive selection in disabled widgets. */
+ || textPtr->state == TK_TEXT_STATE_DISABLED
#endif
- && (tagPtr == textPtr->selTagPtr)
- && !(textPtr->flags & GOT_FOCUS)) {
- continue;
+ ) {
+ continue;
+ }
+ border = textPtr->inactiveSelBorder;
}
- if ((tagPtr->border != NULL) && (tagPtr->priority > borderPrio)) {
- styleValues.border = tagPtr->border;
+ if ((border != NULL) && (tagPtr->priority > borderPrio)) {
+ styleValues.border = border;
borderPrio = tagPtr->priority;
}
- if ((tagPtr->bdString != NULL)
+ if ((tagPtr->borderWidthPtr != NULL)
+ && (Tcl_GetString(tagPtr->borderWidthPtr)[0] != '\0')
&& (tagPtr->priority > borderWidthPrio)) {
styleValues.borderWidth = tagPtr->borderWidth;
borderWidthPrio = tagPtr->priority;
@@ -646,11 +893,16 @@ GetStyle(textPtr, indexPtr)
styleValues.spacing3 = tagPtr->spacing3;
spacing3Prio = tagPtr->priority;
}
- if ((tagPtr->tabString != NULL)
+ if ((tagPtr->tabStringPtr != NULL)
&& (tagPtr->priority > tabPrio)) {
styleValues.tabArrayPtr = tagPtr->tabArrayPtr;
tabPrio = tagPtr->priority;
}
+ if ((tagPtr->tabStyle != TK_TEXT_TABSTYLE_NONE)
+ && (tagPtr->priority > tabStylePrio)) {
+ styleValues.tabStyle = tagPtr->tabStyle;
+ tabStylePrio = tagPtr->priority;
+ }
if ((tagPtr->underlineString != NULL)
&& (tagPtr->priority > underlinePrio)) {
styleValues.underline = tagPtr->underline;
@@ -676,15 +928,15 @@ GetStyle(textPtr, indexPtr)
*/
hPtr = Tcl_CreateHashEntry(&textPtr->dInfoPtr->styleTable,
- (char *) &styleValues, &new);
- if (!new) {
+ (char *) &styleValues, &isNew);
+ if (!isNew) {
stylePtr = (TextStyle *) Tcl_GetHashValue(hPtr);
stylePtr->refCount++;
return stylePtr;
}
/*
- * No existing style matched. Make a new one.
+ * No existing style matched. Make a new one.
*/
stylePtr = (TextStyle *) ckalloc(sizeof(TextStyle));
@@ -723,25 +975,25 @@ GetStyle(textPtr, indexPtr)
*
* FreeStyle --
*
- * This procedure is called when a TextStyle structure is no longer
- * needed. It decrements the reference count and frees up the
- * space for the style structure if the reference count is 0.
+ * This function is called when a TextStyle structure is no longer
+ * needed. It decrements the reference count and frees up the space for
+ * the style structure if the reference count is 0.
*
* Results:
* None.
*
* Side effects:
- * The storage and other resources associated with the style
- * are freed up if no-one's still using it.
+ * The storage and other resources associated with the style are freed up
+ * if no-one's still using it.
*
*----------------------------------------------------------------------
*/
static void
-FreeStyle(textPtr, stylePtr)
- TkText *textPtr; /* Information about overall widget. */
- register TextStyle *stylePtr; /* Information about style to free. */
-
+FreeStyle(
+ TkText *textPtr, /* Information about overall widget. */
+ register TextStyle *stylePtr)
+ /* Information about style to free. */
{
stylePtr->refCount--;
if (stylePtr->refCount == 0) {
@@ -761,70 +1013,91 @@ FreeStyle(textPtr, stylePtr)
*
* LayoutDLine --
*
- * This procedure generates a single DLine structure for a display
- * line whose leftmost character is given by indexPtr.
- *
+ * This function generates a single DLine structure for a display line
+ * whose leftmost character is given by indexPtr.
+ *
* Results:
* The return value is a pointer to a DLine structure desribing the
- * display line. All fields are filled in and correct except for
- * y and nextPtr.
+ * display line. All fields are filled in and correct except for y and
+ * nextPtr.
*
* Side effects:
* Storage is allocated for the new DLine.
*
+ * See the comments in 'GetYView' for some thoughts on what the side-
+ * effects of this call (or its callers) should be; the synchronisation
+ * of TkTextLine->pixelHeight with the sum of the results of this
+ * function operating on all display lines within each logical line.
+ * Ideally the code should be refactored to ensure the cached pixel
+ * height is never behind what is known when this function is called
+ * elsewhere.
+ *
+ * Unfortunately, this function is currently called from many different
+ * places, not just to layout a display line for actual display, but also
+ * simply to calculate some metric or other of one or more display lines
+ * (typically the height). It would be a good idea to do some profiling
+ * of typical text widget usage and the way in which this is called and
+ * see if some optimization could or should be done.
+ *
*----------------------------------------------------------------------
*/
static DLine *
-LayoutDLine(textPtr, indexPtr)
- TkText *textPtr; /* Overall information about text widget. */
- TkTextIndex *indexPtr; /* Beginning of display line. May not
- * necessarily point to a character segment. */
+LayoutDLine(
+ TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *indexPtr)/* Beginning of display line. May not
+ * necessarily point to a character
+ * segment. */
{
- register DLine *dlPtr; /* New display line. */
- TkTextSegment *segPtr; /* Current segment in text. */
- TkTextDispChunk *lastChunkPtr; /* Last chunk allocated so far
- * for line. */
- TkTextDispChunk *chunkPtr; /* Current chunk. */
+ register DLine *dlPtr; /* New display line. */
+ TkTextSegment *segPtr; /* Current segment in text. */
+ TkTextDispChunk *lastChunkPtr;
+ /* Last chunk allocated so far for line. */
+ TkTextDispChunk *chunkPtr; /* Current chunk. */
TkTextIndex curIndex;
- TkTextDispChunk *breakChunkPtr; /* Chunk containing best word break
- * point, if any. */
- TkTextIndex breakIndex; /* Index of first character in
- * breakChunkPtr. */
- int breakByteOffset; /* Byte offset of character within
- * breakChunkPtr just to right of best
- * break point. */
- int noCharsYet; /* Non-zero means that no characters
- * have been placed on the line yet. */
- int justify; /* How to justify line: taken from
- * style for the first character in
- * line. */
- int jIndent; /* Additional indentation (beyond
- * margins) due to justification. */
- int rMargin; /* Right margin width for line. */
- TkWrapMode wrapMode; /* Wrap mode to use for this line. */
- int x = 0, maxX = 0; /* Initializations needed only to
- * stop compiler warnings. */
- int wholeLine; /* Non-zero means this display line
- * runs to the end of the text line. */
- int tabIndex; /* Index of the current tab stop. */
- int gotTab; /* Non-zero means the current chunk
- * contains a tab. */
- TkTextDispChunk *tabChunkPtr; /* Pointer to the chunk containing
- * the previous tab stop. */
- int maxBytes; /* Maximum number of bytes to
- * include in this chunk. */
- TkTextTabArray *tabArrayPtr; /* Tab stops for line; taken from
- * style for the first character on
- * line. */
- int tabSize; /* Number of pixels consumed by current
- * tab stop. */
- TkTextDispChunk *lastCharChunkPtr; /* Pointer to last chunk in display
- * lines with numBytes > 0. Used to
- * drop 0-sized chunks from the end
- * of the line. */
+ TkTextDispChunk *breakChunkPtr;
+ /* Chunk containing best word break point, if
+ * any. */
+ TkTextIndex breakIndex; /* Index of first character in
+ * breakChunkPtr. */
+ int breakByteOffset; /* Byte offset of character within
+ * breakChunkPtr just to right of best break
+ * point. */
+ int noCharsYet; /* Non-zero means that no characters have been
+ * placed on the line yet. */
+ int paragraphStart; /* Non-zero means that we are on the first
+ * line of a paragraph (used to choose between
+ * lmargin1, lmargin2). */
+ int justify; /* How to justify line: taken from style for
+ * the first character in line. */
+ int jIndent; /* Additional indentation (beyond margins) due
+ * to justification. */
+ int rMargin; /* Right margin width for line. */
+ TkWrapMode wrapMode; /* Wrap mode to use for this line. */
+ int x = 0, maxX = 0; /* Initializations needed only to stop
+ * compiler warnings. */
+ int wholeLine; /* Non-zero means this display line runs to
+ * the end of the text line. */
+ int tabIndex; /* Index of the current tab stop. */
+ int gotTab; /* Non-zero means the current chunk contains a
+ * tab. */
+ TkTextDispChunk *tabChunkPtr;
+ /* Pointer to the chunk containing the
+ * previous tab stop. */
+ int maxBytes; /* Maximum number of bytes to include in this
+ * chunk. */
+ TkTextTabArray *tabArrayPtr;/* Tab stops for line; taken from style for
+ * the first character on line. */
+ int tabStyle; /* One of TABULAR or WORDPROCESSOR. */
+ int tabSize; /* Number of pixels consumed by current tab
+ * stop. */
+ TkTextDispChunk *lastCharChunkPtr;
+ /* Pointer to last chunk in display lines with
+ * numBytes > 0. Used to drop 0-sized chunks
+ * from the end of the line. */
int byteOffset, ascent, descent, code, elide, elidesize;
StyleValues *sValuePtr;
+ TkTextElideInfo info; /* Keep track of elide state. */
/*
* Create and initialize a new DLine structure.
@@ -834,33 +1107,91 @@ LayoutDLine(textPtr, indexPtr)
dlPtr->index = *indexPtr;
dlPtr->byteCount = 0;
dlPtr->y = 0;
- dlPtr->oldY = -1;
+ dlPtr->oldY = 0; /* Only set to avoid compiler warnings. */
dlPtr->height = 0;
dlPtr->baseline = 0;
dlPtr->chunkPtr = NULL;
dlPtr->nextPtr = NULL;
- dlPtr->flags = NEW_LAYOUT;
+ dlPtr->flags = NEW_LAYOUT | OLD_Y_INVALID;
+ dlPtr->logicalLinesMerged = 0;
/*
- * Special case entirely elide line as there may be 1000s or more
+ * This is not necessarily totally correct, where we have merged logical
+ * lines. Fixing this would require a quite significant overhaul, though,
+ * so currently we make do with this.
*/
- elide = TkTextIsElided(textPtr, indexPtr); /* save a malloc */
- if (elide && indexPtr->byteIndex==0) {
+
+ paragraphStart = (indexPtr->byteIndex == 0);
+
+ /*
+ * Special case entirely elide line as there may be 1000s or more.
+ */
+
+ elide = TkTextIsElided(textPtr, indexPtr, &info);
+ if (elide && indexPtr->byteIndex == 0) {
maxBytes = 0;
- for (segPtr = indexPtr->linePtr->segPtr;
- elide && (segPtr != NULL);
- segPtr = segPtr->nextPtr) {
- if ((elidesize = segPtr->size) > 0) {
- maxBytes += elidesize;
+ for (segPtr = info.segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) {
+ if (segPtr->size > 0) {
+ if (elide == 0) {
+ /*
+ * We toggled a tag and the elide state changed to
+ * visible, and we have something of non-zero size.
+ * Therefore we must bail out.
+ */
+
+ break;
+ }
+ maxBytes += segPtr->size;
+
/*
- * If have we have a tag toggle, there is a chance
- * that invisibility state changed, so bail out
+ * Reset tag elide priority, since we're on a new character.
*/
+
} else if ((segPtr->typePtr == &tkTextToggleOffType)
|| (segPtr->typePtr == &tkTextToggleOnType)) {
- if (segPtr->body.toggle.tagPtr->elideString != NULL) {
- elide = (segPtr->typePtr == &tkTextToggleOffType)
- ^ segPtr->body.toggle.tagPtr->elide;
+ TkTextTag *tagPtr = segPtr->body.toggle.tagPtr;
+
+ /*
+ * The elide state only changes if this tag is either the
+ * current highest priority tag (and is therefore being
+ * toggled off), or it's a new tag with higher priority.
+ */
+
+ if (tagPtr->elideString != NULL) {
+ info.tagCnts[tagPtr->priority]++;
+ if (info.tagCnts[tagPtr->priority] & 1) {
+ info.tagPtrs[tagPtr->priority] = tagPtr;
+ }
+ if (tagPtr->priority >= info.elidePriority) {
+ if (segPtr->typePtr == &tkTextToggleOffType) {
+ /*
+ * If it is being toggled off, and it has an elide
+ * string, it must actually be the current highest
+ * priority tag, so this check is redundant:
+ */
+
+ if (tagPtr->priority != info.elidePriority) {
+ Tcl_Panic("Bad tag priority being toggled off");
+ }
+
+ /*
+ * Find previous elide tag, if any (if not then
+ * elide will be zero, of course).
+ */
+
+ elide = 0;
+ while (--info.elidePriority > 0) {
+ if (info.tagCnts[info.elidePriority] & 1) {
+ elide = info.tagPtrs[info.elidePriority]
+ ->elide;
+ break;
+ }
+ }
+ } else {
+ elide = tagPtr->elide;
+ info.elidePriority = tagPtr->priority;
+ }
+ }
}
}
}
@@ -868,15 +1199,31 @@ LayoutDLine(textPtr, indexPtr)
if (elide) {
dlPtr->byteCount = maxBytes;
dlPtr->spaceAbove = dlPtr->spaceBelow = dlPtr->length = 0;
+ if (dlPtr->index.byteIndex == 0) {
+ /*
+ * Elided state goes from beginning to end of an entire
+ * logical line. This means we can update the line's pixel
+ * height, and bring its pixel calculation up to date.
+ */
+
+ TkBTreeLinePixelEpoch(textPtr, dlPtr->index.linePtr)
+ = textPtr->dInfoPtr->lineMetricUpdateEpoch;
+
+ if (TkBTreeLinePixelCount(textPtr,dlPtr->index.linePtr) != 0) {
+ TkBTreeAdjustPixelHeight(textPtr,
+ dlPtr->index.linePtr, 0, 0);
+ }
+ }
+ TkTextFreeElideInfo(&info);
return dlPtr;
}
}
+ TkTextFreeElideInfo(&info);
/*
- * Each iteration of the loop below creates one TkTextDispChunk for
- * the new display line. The line will always have at least one
- * chunk (for the newline character at the end, if there's nothing
- * else available).
+ * Each iteration of the loop below creates one TkTextDispChunk for the
+ * new display line. The line will always have at least one chunk (for the
+ * newline character at the end, if there's nothing else available).
*/
curIndex = *indexPtr;
@@ -890,53 +1237,108 @@ LayoutDLine(textPtr, indexPtr)
tabIndex = -1;
tabChunkPtr = NULL;
tabArrayPtr = NULL;
+ tabStyle = TK_TEXT_TABSTYLE_TABULAR;
rMargin = 0;
wrapMode = TEXT_WRAPMODE_CHAR;
tabSize = 0;
lastCharChunkPtr = NULL;
/*
- * Find the first segment to consider for the line. Can't call
- * TkTextIndexToSeg for this because it won't return a segment
- * with zero size (such as the insertion cursor's mark).
+ * Find the first segment to consider for the line. Can't call
+ * TkTextIndexToSeg for this because it won't return a segment with zero
+ * size (such as the insertion cursor's mark).
*/
- for (byteOffset = curIndex.byteIndex, segPtr = curIndex.linePtr->segPtr;
- (byteOffset > 0) && (byteOffset >= segPtr->size);
- byteOffset -= segPtr->size, segPtr = segPtr->nextPtr) {
- /* Empty loop body. */
+ connectNextLogicalLine:
+ byteOffset = curIndex.byteIndex;
+ segPtr = curIndex.linePtr->segPtr;
+ while ((byteOffset > 0) && (byteOffset >= segPtr->size)) {
+ byteOffset -= segPtr->size;
+ segPtr = segPtr->nextPtr;
+
+ if (segPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through eliding
+ * of a newline.
+ */
+
+ TkTextLine *linePtr = TkBTreeNextLine(NULL, curIndex.linePtr);
+ if (linePtr != NULL) {
+ dlPtr->logicalLinesMerged++;
+ curIndex.byteIndex = 0;
+ curIndex.linePtr = linePtr;
+ segPtr = curIndex.linePtr->segPtr;
+ } else {
+ break;
+ }
+ }
}
while (segPtr != NULL) {
/*
- * Every line still gets at least one chunk due to expectations
- * in the rest of the code, but we are able to skip elided portions
- * of the line quickly.
- * If current chunk is elided and last chunk was too, coalese
+ * Every logical line still gets at least one chunk due to
+ * expectations in the rest of the code, but we are able to skip
+ * elided portions of the line quickly.
+ *
+ * If current chunk is elided and last chunk was too, coalese.
+ *
+ * This also means that each logical line which is entirely elided
+ * still gets laid out into a DLine, but with zero height. This isn't
+ * particularly a problem, but it does seem somewhat unnecessary. We
+ * may wish to redesign the code to remove these zero height DLines in
+ * the future.
*/
+
if (elide && (lastChunkPtr != NULL)
&& (lastChunkPtr->displayProc == NULL /*ElideDisplayProc*/)) {
- if ((elidesize = segPtr->size - byteOffset) > 0) {
+ elidesize = segPtr->size - byteOffset;
+ if (elidesize > 0) {
curIndex.byteIndex += elidesize;
lastChunkPtr->numBytes += elidesize;
- breakByteOffset = lastChunkPtr->breakIndex = lastChunkPtr->numBytes;
+ breakByteOffset = lastChunkPtr->breakIndex
+ = lastChunkPtr->numBytes;
+
/*
- * If have we have a tag toggle, there is a chance
- * that invisibility state changed, so bail out
+ * If have we have a tag toggle, there is a chance that
+ * invisibility state changed, so bail out.
*/
} else if ((segPtr->typePtr == &tkTextToggleOffType)
|| (segPtr->typePtr == &tkTextToggleOnType)) {
if (segPtr->body.toggle.tagPtr->elideString != NULL) {
elide = (segPtr->typePtr == &tkTextToggleOffType)
- ^ segPtr->body.toggle.tagPtr->elide;
+ ^ segPtr->body.toggle.tagPtr->elide;
}
}
byteOffset = 0;
segPtr = segPtr->nextPtr;
+
+ if (segPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through
+ * eliding of a newline.
+ */
+
+ TkTextLine *linePtr = TkBTreeNextLine(NULL, curIndex.linePtr);
+
+ if (linePtr != NULL) {
+ dlPtr->logicalLinesMerged++;
+ curIndex.byteIndex = 0;
+ curIndex.linePtr = linePtr;
+ goto connectNextLogicalLine;
+ }
+ }
+
+ /*
+ * Code no longer needed, now that we allow logical lines to merge
+ * into a single display line.
+ *
if (segPtr == NULL && chunkPtr != NULL) {
ckfree((char *) chunkPtr);
+ chunkPtr = NULL;
}
+ */
+
continue;
}
@@ -948,24 +1350,44 @@ LayoutDLine(textPtr, indexPtr)
if (chunkPtr == NULL) {
chunkPtr = (TkTextDispChunk *) ckalloc(sizeof(TkTextDispChunk));
chunkPtr->nextPtr = NULL;
+ chunkPtr->clientData = NULL;
}
chunkPtr->stylePtr = GetStyle(textPtr, &curIndex);
elide = chunkPtr->stylePtr->sValuePtr->elide;
/*
- * Save style information such as justification and indentation,
- * up until the first character is encountered, then retain that
+ * Save style information such as justification and indentation, up
+ * until the first character is encountered, then retain that
* information for the rest of the line.
*/
- if (noCharsYet) {
+ if (!elide && noCharsYet) {
tabArrayPtr = chunkPtr->stylePtr->sValuePtr->tabArrayPtr;
+ tabStyle = chunkPtr->stylePtr->sValuePtr->tabStyle;
justify = chunkPtr->stylePtr->sValuePtr->justify;
rMargin = chunkPtr->stylePtr->sValuePtr->rMargin;
wrapMode = chunkPtr->stylePtr->sValuePtr->wrapMode;
- x = ((curIndex.byteIndex == 0)
- ? chunkPtr->stylePtr->sValuePtr->lMargin1
- : chunkPtr->stylePtr->sValuePtr->lMargin2);
+
+ /*
+ * See above - this test may not be entirely correct where we have
+ * partially elided lines (and therefore merged logical lines).
+ * In such a case a byteIndex of zero doesn't necessarily mean the
+ * beginning of a logical line.
+ */
+
+ if (paragraphStart) {
+ /*
+ * Beginning of logical line.
+ */
+
+ x = chunkPtr->stylePtr->sValuePtr->lMargin1;
+ } else {
+ /*
+ * Beginning of display line.
+ */
+
+ x = chunkPtr->stylePtr->sValuePtr->lMargin2;
+ }
if (wrapMode == TEXT_WRAPMODE_NONE) {
maxX = -1;
} else {
@@ -977,18 +1399,19 @@ LayoutDLine(textPtr, indexPtr)
}
}
- /*
- * See if there is a tab in the current chunk; if so, only
- * layout characters up to (and including) the tab.
- */
-
gotTab = 0;
maxBytes = segPtr->size - byteOffset;
- if (!elide && justify == TK_JUSTIFY_LEFT) {
- if (segPtr->typePtr == &tkTextCharType) {
+ if (segPtr->typePtr == &tkTextCharType) {
+
+ /*
+ * See if there is a tab in the current chunk; if so, only layout
+ * characters up to (and including) the tab.
+ */
+
+ if (!elide && justify == TK_JUSTIFY_LEFT) {
char *p;
- for (p = segPtr->body.chars + byteOffset; *p != 0; p++) {
+ for (p = segPtr->body.chars + byteOffset; *p != 0; p++) {
if (*p == '\t') {
maxBytes = (p + 1 - segPtr->body.chars) - byteOffset;
gotTab = 1;
@@ -996,25 +1419,48 @@ LayoutDLine(textPtr, indexPtr)
}
}
}
+
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ if (baseCharChunkPtr != NULL) {
+ int expectedX =
+ ((BaseCharInfo *) baseCharChunkPtr->clientData)->width
+ + baseCharChunkPtr->x;
+
+ if ((expectedX != x) || !IsSameFGStyle(
+ baseCharChunkPtr->stylePtr, chunkPtr->stylePtr)) {
+ FinalizeBaseChunk(NULL);
+ }
+ }
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
chunkPtr->x = x;
- if (elide && maxBytes) {
- /* don't free style here, as other code expects to be able to do that */
- /*breakByteOffset =*/ chunkPtr->breakIndex = chunkPtr->numBytes = maxBytes;
+ if (elide /*&& maxBytes*/) {
+ /*
+ * Don't free style here, as other code expects to be able to do
+ * that.
+ */
+
+ /* breakByteOffset =*/
+ chunkPtr->breakIndex = chunkPtr->numBytes = maxBytes;
chunkPtr->width = 0;
- chunkPtr->minAscent = chunkPtr->minDescent = chunkPtr->minHeight = 0;
+ chunkPtr->minAscent = chunkPtr->minDescent
+ = chunkPtr->minHeight = 0;
- /* would just like to point to canonical empty chunk */
- chunkPtr->displayProc = (Tk_ChunkDisplayProc *) NULL;
- chunkPtr->undisplayProc = (Tk_ChunkUndisplayProc *) NULL;
+ /*
+ * Would just like to point to canonical empty chunk.
+ */
+
+ chunkPtr->displayProc = NULL;
+ chunkPtr->undisplayProc = NULL;
chunkPtr->measureProc = ElideMeasureProc;
chunkPtr->bboxProc = ElideBboxProc;
code = 1;
- } else
- code = (*segPtr->typePtr->layoutProc)(textPtr, &curIndex, segPtr,
- byteOffset, maxX-tabSize, maxBytes, noCharsYet, wrapMode,
- chunkPtr);
+ } else {
+ code = (*segPtr->typePtr->layoutProc)(textPtr, &curIndex, segPtr,
+ byteOffset, maxX-tabSize, maxBytes, noCharsYet, wrapMode,
+ chunkPtr);
+ }
if (code <= 0) {
FreeStyle(textPtr, chunkPtr->stylePtr);
if (code < 0) {
@@ -1029,8 +1475,8 @@ LayoutDLine(textPtr, indexPtr)
}
/*
- * No characters from this segment fit in the window: this
- * means we're at the end of the display line.
+ * No characters from this segment fit in the window: this means
+ * we're at the end of the display line.
*/
if (chunkPtr != NULL) {
@@ -1038,7 +1484,19 @@ LayoutDLine(textPtr, indexPtr)
}
break;
}
- if (chunkPtr->numBytes > 0) {
+
+ /*
+ * We currently say we have some characters (and therefore something
+ * from which to examine tag values for the first character of the
+ * line) even if those characters are actually elided. This behaviour
+ * is not well documented, and it might be more consistent to
+ * completely ignore such elided characters and their tags. To do so
+ * change this to:
+ *
+ * if (!elide && chunkPtr->numBytes > 0).
+ */
+
+ if (!elide && chunkPtr->numBytes > 0) {
noCharsYet = 0;
lastCharChunkPtr = chunkPtr;
}
@@ -1060,9 +1518,9 @@ LayoutDLine(textPtr, indexPtr)
/*
* If we're at a new tab, adjust the layout for all the chunks
- * pertaining to the previous tab. Also adjust the amount of
- * space left in the line to account for space that will be eaten
- * up by the tab.
+ * pertaining to the previous tab. Also adjust the amount of space
+ * left in the line to account for space that will be eaten up by the
+ * tab.
*/
if (gotTab) {
@@ -1070,9 +1528,9 @@ LayoutDLine(textPtr, indexPtr)
AdjustForTab(textPtr, tabArrayPtr, tabIndex, tabChunkPtr);
x = chunkPtr->x + chunkPtr->width;
}
- tabIndex++;
tabChunkPtr = chunkPtr;
- tabSize = SizeOfTab(textPtr, tabArrayPtr, tabIndex, x, maxX);
+ tabSize = SizeOfTab(textPtr, tabStyle, tabArrayPtr, &tabIndex, x,
+ maxX);
if ((maxX >= 0) && (tabSize >= maxX - x)) {
break;
}
@@ -1082,28 +1540,60 @@ LayoutDLine(textPtr, indexPtr)
if (byteOffset >= segPtr->size) {
byteOffset = 0;
segPtr = segPtr->nextPtr;
+ if (elide && segPtr == NULL) {
+ /*
+ * An elided section started on this line, and carries on
+ * until the newline. Hence the newline is actually elided,
+ * and we want to merge the display of the next logical line
+ * with this one.
+ */
+
+ TkTextLine *linePtr = TkBTreeNextLine(NULL, curIndex.linePtr);
+
+ if (linePtr != NULL) {
+ dlPtr->logicalLinesMerged++;
+ curIndex.byteIndex = 0;
+ curIndex.linePtr = linePtr;
+ chunkPtr = NULL;
+ goto connectNextLogicalLine;
+ }
+ }
}
chunkPtr = NULL;
}
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ FinalizeBaseChunk(NULL);
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
if (noCharsYet) {
- panic("LayoutDLine couldn't place any characters on a line");
+ dlPtr->spaceAbove = 0;
+ dlPtr->spaceBelow = 0;
+ dlPtr->length = 0;
+
+ /*
+ * We used to Tcl_Panic here, saying that LayoutDLine couldn't place
+ * any characters on a line, but I believe a more appropriate response
+ * is to return a DLine with zero height. With elided lines, tag
+ * transitions and asynchronous line height calculations, it is hard
+ * to avoid this situation ever arising with the current code design.
+ */
+
+ return dlPtr;
}
wholeLine = (segPtr == NULL);
/*
- * We're at the end of the display line. Throw away everything
- * after the most recent word break, if there is one; this may
- * potentially require the last chunk to be layed out again.
+ * We're at the end of the display line. Throw away everything after the
+ * most recent word break, if there is one; this may potentially require
+ * the last chunk to be layed out again.
*/
if (breakChunkPtr == NULL) {
/*
- * This code makes sure that we don't accidentally display
- * chunks with no characters at the end of the line (such as
- * the insertion cursor). These chunks belong on the next
- * line. So, throw away everything after the last chunk that
- * has characters in it.
+ * This code makes sure that we don't accidentally display chunks with
+ * no characters at the end of the line (such as the insertion
+ * cursor). These chunks belong on the next line. So, throw away
+ * everything after the last chunk that has characters in it.
*/
breakChunkPtr = lastCharChunkPtr;
@@ -1118,21 +1608,27 @@ LayoutDLine(textPtr, indexPtr)
}
FreeStyle(textPtr, chunkPtr->stylePtr);
breakChunkPtr->nextPtr = chunkPtr->nextPtr;
- (*chunkPtr->undisplayProc)(textPtr, chunkPtr);
+ if (chunkPtr->undisplayProc != NULL) {
+ (*chunkPtr->undisplayProc)(textPtr, chunkPtr);
+ }
ckfree((char *) chunkPtr);
}
if (breakByteOffset != breakChunkPtr->numBytes) {
- (*breakChunkPtr->undisplayProc)(textPtr, breakChunkPtr);
+ if (breakChunkPtr->undisplayProc != NULL) {
+ (*breakChunkPtr->undisplayProc)(textPtr, breakChunkPtr);
+ }
segPtr = TkTextIndexToSeg(&breakIndex, &byteOffset);
(*segPtr->typePtr->layoutProc)(textPtr, &breakIndex,
- segPtr, byteOffset, maxX, breakByteOffset, 0,
+ segPtr, byteOffset, maxX, breakByteOffset, 0,
wrapMode, breakChunkPtr);
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ FinalizeBaseChunk(NULL);
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
lastChunkPtr = breakChunkPtr;
wholeLine = 0;
}
-
/*
* Make tab adjustments for the last tab stop, if there is one.
*/
@@ -1142,16 +1638,15 @@ LayoutDLine(textPtr, indexPtr)
}
/*
- * Make one more pass over the line to recompute various things
- * like its height, length, and total number of bytes. Also
- * modify the x-locations of chunks to reflect justification.
- * If we're not wrapping, I'm not sure what is the best way to
- * handle left and center justification: should the total length,
- * for purposes of justification, be (a) the window width, (b)
- * the length of the longest line in the window, or (c) the length
- * of the longest line in the text? (c) isn't available, (b) seems
- * weird, since it can change with vertical scrolling, so (a) is
- * what is implemented below.
+ * Make one more pass over the line to recompute various things like its
+ * height, length, and total number of bytes. Also modify the x-locations
+ * of chunks to reflect justification. If we're not wrapping, I'm not sure
+ * what is the best way to handle left and center justification: should
+ * the total length, for purposes of justification, be (a) the window
+ * width, (b) the length of the longest line in the window, or (c) the
+ * length of the longest line in the text? (c) isn't available, (b) seems
+ * weird, since it can change with vertical scrolling, so (a) is what is
+ * implemented below.
*/
if (wrapMode == TEXT_WRAPMODE_NONE) {
@@ -1206,10 +1701,11 @@ LayoutDLine(textPtr, indexPtr)
dlPtr->baseline += dlPtr->spaceAbove;
/*
- * Recompute line length: may have changed because of justification.
+ * Recompute line length: may have changed because of justification.
*/
dlPtr->length = lastChunkPtr->x + lastChunkPtr->width;
+
return dlPtr;
}
@@ -1218,38 +1714,37 @@ LayoutDLine(textPtr, indexPtr)
*
* UpdateDisplayInfo --
*
- * This procedure is invoked to recompute some or all of the
- * DLine structures for a text widget. At the time it is called
- * the DLine structures still left in the widget are guaranteed
- * to be correct except that (a) the y-coordinates aren't
- * necessarily correct, (b) there may be missing structures
- * (the DLine structures get removed as soon as they are potentially
- * out-of-date), and (c) DLine structures that don't start at the
- * beginning of a line may be incorrect if previous information in
- * the same line changed size in a way that moved a line boundary
- * (DLines for any info that changed will have been deleted, but
- * not DLines for unchanged info in the same text line).
+ * This function is invoked to recompute some or all of the DLine
+ * structures for a text widget. At the time it is called the DLine
+ * structures still left in the widget are guaranteed to be correct
+ * except that (a) the y-coordinates aren't necessarily correct, (b)
+ * there may be missing structures (the DLine structures get removed as
+ * soon as they are potentially out-of-date), and (c) DLine structures
+ * that don't start at the beginning of a line may be incorrect if
+ * previous information in the same line changed size in a way that moved
+ * a line boundary (DLines for any info that changed will have been
+ * deleted, but not DLines for unchanged info in the same text line).
*
* Results:
* None.
*
* Side effects:
- * Upon return, the DLine information for textPtr correctly reflects
- * the positions where characters will be displayed. However, this
- * procedure doesn't actually bring the display up-to-date.
+ * Upon return, the DLine information for textPtr correctly reflects the
+ * positions where characters will be displayed. However, this function
+ * doesn't actually bring the display up-to-date.
*
*----------------------------------------------------------------------
*/
static void
-UpdateDisplayInfo(textPtr)
- TkText *textPtr; /* Text widget to update. */
+UpdateDisplayInfo(
+ TkText *textPtr) /* Text widget to update. */
{
register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
register DLine *dlPtr, *prevPtr;
TkTextIndex index;
TkTextLine *lastLinePtr;
- int y, maxY, pixelOffset, maxOffset;
+ int y, maxY, xPixelOffset, maxOffset, lineHeight;
if (!(dInfoPtr->flags & DINFO_OUT_OF_DATE)) {
return;
@@ -1263,21 +1758,24 @@ UpdateDisplayInfo(textPtr)
index = textPtr->topIndex;
dlPtr = FindDLine(dInfoPtr->dLinePtr, &index);
if ((dlPtr != NULL) && (dlPtr != dInfoPtr->dLinePtr)) {
- FreeDLines(textPtr, dInfoPtr->dLinePtr, dlPtr, 1);
+ FreeDLines(textPtr, dInfoPtr->dLinePtr, dlPtr, DLINE_UNLINK);
+ }
+ if (index.byteIndex == 0) {
+ lineHeight = 0;
+ } else {
+ lineHeight = -1;
}
/*
- *--------------------------------------------------------------
- * Scan through the contents of the window from top to bottom,
- * recomputing information for lines that are missing.
- *--------------------------------------------------------------
+ * Scan through the contents of the window from top to bottom, recomputing
+ * information for lines that are missing.
*/
- lastLinePtr = TkBTreeFindLine(textPtr->tree,
- TkBTreeNumLines(textPtr->tree));
+ lastLinePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr));
dlPtr = dInfoPtr->dLinePtr;
prevPtr = NULL;
- y = dInfoPtr->y;
+ y = dInfoPtr->y - dInfoPtr->newTopPixelOffset;
maxY = dInfoPtr->maxY;
while (1) {
register DLine *newPtr;
@@ -1290,22 +1788,20 @@ UpdateDisplayInfo(textPtr)
* There are three possibilities right now:
* (a) the next DLine (dlPtr) corresponds exactly to the next
* information we want to display: just use it as-is.
- * (b) the next DLine corresponds to a different line, or to
- * a segment that will be coming later in the same line:
- * leave this DLine alone in the hopes that we'll be able
- * to use it later, then create a new DLine in front of
- * it.
- * (c) the next DLine corresponds to a segment in the line we
- * want, but it's a segment that has already been processed
- * or will never be processed. Delete the DLine and try
- * again.
+ * (b) the next DLine corresponds to a different line, or to a segment
+ * that will be coming later in the same line: leave this DLine
+ * alone in the hopes that we'll be able to use it later, then
+ * create a new DLine in front of it.
+ * (c) the next DLine corresponds to a segment in the line we want,
+ * but it's a segment that has already been processed or will
+ * never be processed. Delete the DLine and try again.
*
- * One other twist on all this. It's possible for 3D borders
- * to interact between lines (see DisplayLineBackground) so if
- * a line is relayed out and has styles with 3D borders, its
- * neighbors have to be redrawn if they have 3D borders too,
- * since the interactions could have changed (the neighbors
- * don't have to be relayed out, just redrawn).
+ * One other twist on all this. It's possible for 3D borders to
+ * interact between lines (see DisplayLineBackground) so if a line is
+ * relayed out and has styles with 3D borders, its neighbors have to
+ * be redrawn if they have 3D borders too, since the interactions
+ * could have changed (the neighbors don't have to be relayed out,
+ * just redrawn).
*/
if ((dlPtr == NULL) || (dlPtr->index.linePtr != index.linePtr)) {
@@ -1313,20 +1809,17 @@ UpdateDisplayInfo(textPtr)
* Case (b) -- must make new DLine.
*/
- makeNewDLine:
+ makeNewDLine:
if (tkTextDebug) {
char string[TK_POS_CHARS];
/*
- * Debugging is enabled, so keep a log of all the lines
- * that were re-layed out. The test suite uses this
- * information.
+ * Debugging is enabled, so keep a log of all the lines that
+ * were re-layed out. The test suite uses this information.
*/
- TkTextPrintIndex(&index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textRelayout", (char *) NULL,
- string,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ TkTextPrintIndex(textPtr, &index, string);
+ LOG("tk_textRelayout", string);
}
newPtr = LayoutDLine(textPtr, &index);
if (prevPtr == NULL) {
@@ -1334,25 +1827,25 @@ UpdateDisplayInfo(textPtr)
} else {
prevPtr->nextPtr = newPtr;
if (prevPtr->flags & HAS_3D_BORDER) {
- prevPtr->oldY = -1;
+ prevPtr->flags |= OLD_Y_INVALID;
}
}
newPtr->nextPtr = dlPtr;
dlPtr = newPtr;
} else {
/*
- * DlPtr refers to the line we want. Next check the
- * index within the line.
+ * DlPtr refers to the line we want. Next check the index within
+ * the line.
*/
if (index.byteIndex == dlPtr->index.byteIndex) {
/*
- * Case (a) -- can use existing display line as-is.
+ * Case (a) - can use existing display line as-is.
*/
if ((dlPtr->flags & HAS_3D_BORDER) && (prevPtr != NULL)
&& (prevPtr->flags & (NEW_LAYOUT))) {
- dlPtr->oldY = -1;
+ dlPtr->flags |= OLD_Y_INVALID;
}
goto lineOK;
}
@@ -1361,12 +1854,12 @@ UpdateDisplayInfo(textPtr)
}
/*
- * Case (c) -- dlPtr is useless. Discard it and start
- * again with the next display line.
+ * Case (c) - dlPtr is useless. Discard it and start again with
+ * the next display line.
*/
newPtr = dlPtr->nextPtr;
- FreeDLines(textPtr, dlPtr, newPtr, 0);
+ FreeDLines(textPtr, dlPtr, newPtr, DLINE_FREE);
dlPtr = newPtr;
if (prevPtr != NULL) {
prevPtr->nextPtr = newPtr;
@@ -1380,16 +1873,19 @@ UpdateDisplayInfo(textPtr)
* Advance to the start of the next line.
*/
- lineOK:
+ lineOK:
dlPtr->y = y;
y += dlPtr->height;
- TkTextIndexForwBytes(&index, dlPtr->byteCount, &index);
+ if (lineHeight != -1) {
+ lineHeight += dlPtr->height;
+ }
+ TkTextIndexForwBytes(textPtr, &index, dlPtr->byteCount, &index);
prevPtr = dlPtr;
dlPtr = dlPtr->nextPtr;
/*
- * If we switched text lines, delete any DLines left for the
- * old text line.
+ * If we switched text lines, delete any DLines left for the old text
+ * line.
*/
if (index.linePtr != prevPtr->index.linePtr) {
@@ -1401,17 +1897,46 @@ UpdateDisplayInfo(textPtr)
nextPtr = nextPtr->nextPtr;
}
if (nextPtr != dlPtr) {
- FreeDLines(textPtr, dlPtr, nextPtr, 0);
+ FreeDLines(textPtr, dlPtr, nextPtr, DLINE_FREE);
prevPtr->nextPtr = nextPtr;
dlPtr = nextPtr;
}
+
+ if ((lineHeight != -1) && (TkBTreeLinePixelCount(textPtr,
+ prevPtr->index.linePtr) != lineHeight)) {
+ /*
+ * The logical line height we just calculated is actually
+ * differnt to the currently cached height of the text line.
+ * That is fine (the text line heights are only calculated
+ * asynchronously), but we must update the cached height so
+ * that any counts made with DLine pointers are the same as
+ * counts made through the BTree. This helps to ensure that
+ * the scrollbar size corresponds accurately to that displayed
+ * contents, even as the window is re-sized.
+ */
+
+ TkBTreeAdjustPixelHeight(textPtr, prevPtr->index.linePtr,
+ lineHeight, 0);
+
+ /*
+ * I believe we can be 100% sure that we started at the
+ * beginning of the logical line, so we can also adjust the
+ * 'pixelCalculationEpoch' to mark it as being up to date.
+ * There is a slight concern that we might not have got this
+ * right for the first line in the re-display.
+ */
+
+ TkBTreeLinePixelEpoch(textPtr, prevPtr->index.linePtr) =
+ dInfoPtr->lineMetricUpdateEpoch;
+ }
+ lineHeight = 0;
}
/*
- * It's important to have the following check here rather than in
- * the while statement for the loop, so that there's always at least
- * one DLine generated, regardless of how small the window is. This
- * keeps a lot of other code from breaking.
+ * It's important to have the following check here rather than in the
+ * while statement for the loop, so that there's always at least one
+ * DLine generated, regardless of how small the window is. This keeps
+ * a lot of other code from breaking.
*/
if (y >= maxY) {
@@ -1423,133 +1948,239 @@ UpdateDisplayInfo(textPtr)
* Delete any DLine structures that don't fit on the screen.
*/
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, 1);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_UNLINK);
/*
- *--------------------------------------------------------------
- * If there is extra space at the bottom of the window (because
- * we've hit the end of the text), then bring in more lines at
- * the top of the window, if there are any, to fill in the view.
- *--------------------------------------------------------------
+ * If there is extra space at the bottom of the window (because we've hit
+ * the end of the text), then bring in more lines at the top of the
+ * window, if there are any, to fill in the view.
+ *
+ * Since the top line may only be partially visible, we try first to
+ * simply show more pixels from that line (newTopPixelOffset). If that
+ * isn't enough, we have to layout more lines.
*/
if (y < maxY) {
- int lineNum, spaceLeft, bytesToCount;
- DLine *lowestPtr;
-
/*
- * Layout an entire text line (potentially > 1 display line),
- * then link in as many display lines as fit without moving
- * the bottom line out of the window. Repeat this until
- * all the extra space has been used up or we've reached the
- * beginning of the text.
+ * This counts how many vertical pixels we have left to fill by
+ * pulling in more display pixels either from the first currently
+ * displayed, or the lines above it.
*/
- spaceLeft = maxY - y;
- lineNum = TkBTreeLineIndex(dInfoPtr->dLinePtr->index.linePtr);
- bytesToCount = dInfoPtr->dLinePtr->index.byteIndex;
- if (bytesToCount == 0) {
- bytesToCount = INT_MAX;
- lineNum--;
- }
- for ( ; (lineNum >= 0) && (spaceLeft > 0); lineNum--) {
- index.linePtr = TkBTreeFindLine(textPtr->tree, lineNum);
- index.byteIndex = 0;
- lowestPtr = NULL;
+ int spaceLeft = maxY - y;
- do {
- dlPtr = LayoutDLine(textPtr, &index);
- dlPtr->nextPtr = lowestPtr;
- lowestPtr = dlPtr;
- if (dlPtr->length == 0 && dlPtr->height == 0) { bytesToCount--; break; } /* elide */
- TkTextIndexForwBytes(&index, dlPtr->byteCount, &index);
- bytesToCount -= dlPtr->byteCount;
- } while ((bytesToCount > 0)
- && (index.linePtr == lowestPtr->index.linePtr));
+ if (spaceLeft <= dInfoPtr->newTopPixelOffset) {
+ /*
+ * We can full up all the needed space just by showing more of the
+ * current top line.
+ */
+
+ dInfoPtr->newTopPixelOffset -= spaceLeft;
+ y += spaceLeft;
+ spaceLeft = 0;
+ } else {
+ int lineNum, bytesToCount;
+ DLine *lowestPtr;
/*
- * Scan through the display lines from the bottom one up to
- * the top one.
+ * Add in all of the current top line, which won't be enough to
+ * bring y up to maxY (if it was we would be in the 'if' block
+ * above).
*/
- while (lowestPtr != NULL) {
- dlPtr = lowestPtr;
- spaceLeft -= dlPtr->height;
- if (spaceLeft < 0) {
- break;
+ y += dInfoPtr->newTopPixelOffset;
+ dInfoPtr->newTopPixelOffset = 0;
+
+ /*
+ * Layout an entire text line (potentially > 1 display line), then
+ * link in as many display lines as fit without moving the bottom
+ * line out of the window. Repeat this until all the extra space
+ * has been used up or we've reached the beginning of the text.
+ */
+
+ spaceLeft = maxY - y;
+ if (dInfoPtr->dLinePtr == NULL) {
+ /*
+ * No lines have been laid out. This must be an empty peer
+ * widget.
+ */
+
+ lineNum = -1;
+ bytesToCount = 0; /* Stop compiler warning. */
+ } else {
+ lineNum = TkBTreeLinesTo(textPtr,
+ dInfoPtr->dLinePtr->index.linePtr);
+ bytesToCount = dInfoPtr->dLinePtr->index.byteIndex;
+ if (bytesToCount == 0) {
+ bytesToCount = INT_MAX;
+ lineNum--;
+ }
+ }
+ for ( ; (lineNum >= 0) && (spaceLeft > 0); lineNum--) {
+ int pixelHeight = 0;
+
+ index.linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ textPtr, lineNum);
+ index.byteIndex = 0;
+ lowestPtr = NULL;
+
+ do {
+ dlPtr = LayoutDLine(textPtr, &index);
+ pixelHeight += dlPtr->height;
+ dlPtr->nextPtr = lowestPtr;
+ lowestPtr = dlPtr;
+ if (dlPtr->length == 0 && dlPtr->height == 0) {
+ bytesToCount--;
+ break;
+ } /* elide */
+ TkTextIndexForwBytes(textPtr, &index, dlPtr->byteCount,
+ &index);
+ bytesToCount -= dlPtr->byteCount;
+ } while ((bytesToCount > 0)
+ && (index.linePtr == lowestPtr->index.linePtr));
+
+ /*
+ * We may not have examined the entire line (depending on the
+ * value of 'bytesToCount', so we only want to set this if it
+ * is genuinely bigger).
+ */
+
+ if (pixelHeight > TkBTreeLinePixelCount(textPtr,
+ lowestPtr->index.linePtr)) {
+ TkBTreeAdjustPixelHeight(textPtr,
+ lowestPtr->index.linePtr, pixelHeight, 0);
+ if (index.linePtr != lowestPtr->index.linePtr) {
+ /*
+ * We examined the entire line, so can update the
+ * epoch.
+ */
+
+ TkBTreeLinePixelEpoch(textPtr,
+ lowestPtr->index.linePtr) =
+ dInfoPtr->lineMetricUpdateEpoch;
+ }
}
- lowestPtr = dlPtr->nextPtr;
- dlPtr->nextPtr = dInfoPtr->dLinePtr;
- dInfoPtr->dLinePtr = dlPtr;
- if (tkTextDebug) {
- char string[TK_POS_CHARS];
- TkTextPrintIndex(&dlPtr->index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textRelayout",
- (char *) NULL, string,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ /*
+ * Scan through the display lines from the bottom one up to
+ * the top one.
+ */
+
+ while (lowestPtr != NULL) {
+ dlPtr = lowestPtr;
+ spaceLeft -= dlPtr->height;
+ lowestPtr = dlPtr->nextPtr;
+ dlPtr->nextPtr = dInfoPtr->dLinePtr;
+ dInfoPtr->dLinePtr = dlPtr;
+ if (tkTextDebug) {
+ char string[TK_POS_CHARS];
+
+ TkTextPrintIndex(textPtr, &dlPtr->index, string);
+ LOG("tk_textRelayout", string);
+ }
+ if (spaceLeft <= 0) {
+ break;
+ }
+ }
+ FreeDLines(textPtr, lowestPtr, NULL, DLINE_FREE);
+ bytesToCount = INT_MAX;
+ }
+
+ /*
+ * We've either filled in the space we wanted to or we've run out
+ * of display lines at the top of the text. Note that we already
+ * set dInfoPtr->newTopPixelOffset to zero above.
+ */
+
+ if (spaceLeft < 0) {
+ /*
+ * We've laid out a few too many vertical pixels at or above
+ * the first line. Therefore we only want to show part of the
+ * first displayed line, so that the last displayed line just
+ * fits in the window.
+ */
+
+ dInfoPtr->newTopPixelOffset = -spaceLeft;
+ if (dInfoPtr->newTopPixelOffset>=dInfoPtr->dLinePtr->height) {
+ /*
+ * Somehow the entire first line we laid out is shorter
+ * than the new offset. This should not occur and would
+ * indicate a bad problem in the logic above.
+ */
+
+ Tcl_Panic("Error in pixel height consistency while filling in spacesLeft");
}
}
- FreeDLines(textPtr, lowestPtr, (DLine *) NULL, 0);
- bytesToCount = INT_MAX;
}
/*
- * Now we're all done except that the y-coordinates in all the
- * DLines are wrong and the top index for the text is wrong.
- * Update them.
+ * Now we're all done except that the y-coordinates in all the DLines
+ * are wrong and the top index for the text is wrong. Update them.
*/
- textPtr->topIndex = dInfoPtr->dLinePtr->index;
- y = dInfoPtr->y;
- for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL;
- dlPtr = dlPtr->nextPtr) {
- if (y > dInfoPtr->maxY) {
- panic("Added too many new lines in UpdateDisplayInfo");
+ if (dInfoPtr->dLinePtr != NULL) {
+ textPtr->topIndex = dInfoPtr->dLinePtr->index;
+ y = dInfoPtr->y - dInfoPtr->newTopPixelOffset;
+ for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL;
+ dlPtr = dlPtr->nextPtr) {
+ if (y > dInfoPtr->maxY) {
+ Tcl_Panic("Added too many new lines in UpdateDisplayInfo");
+ }
+ dlPtr->y = y;
+ y += dlPtr->height;
}
- dlPtr->y = y;
- y += dlPtr->height;
}
}
/*
- *--------------------------------------------------------------
- * If the old top or bottom line has scrolled elsewhere on the
- * screen, we may not be able to re-use its old contents by
- * copying bits (e.g., a beveled edge that was drawn when it was
- * at the top or bottom won't be drawn when the line is in the
- * middle and its neighbor has a matching background). Similarly,
- * if the new top or bottom line came from somewhere else on the
- * screen, we may not be able to copy the old bits.
- *--------------------------------------------------------------
+ * If the old top or bottom line has scrolled elsewhere on the screen, we
+ * may not be able to re-use its old contents by copying bits (e.g., a
+ * beveled edge that was drawn when it was at the top or bottom won't be
+ * drawn when the line is in the middle and its neighbor has a matching
+ * background). Similarly, if the new top or bottom line came from
+ * somewhere else on the screen, we may not be able to copy the old bits.
*/
dlPtr = dInfoPtr->dLinePtr;
- if ((dlPtr->flags & HAS_3D_BORDER) && !(dlPtr->flags & TOP_LINE)) {
- dlPtr->oldY = -1;
- }
- while (1) {
- if ((dlPtr->flags & TOP_LINE) && (dlPtr != dInfoPtr->dLinePtr)
- && (dlPtr->flags & HAS_3D_BORDER)) {
- dlPtr->oldY = -1;
- }
- if ((dlPtr->flags & BOTTOM_LINE) && (dlPtr->nextPtr != NULL)
- && (dlPtr->flags & HAS_3D_BORDER)) {
- dlPtr->oldY = -1;
+ if (dlPtr != NULL) {
+ if ((dlPtr->flags & HAS_3D_BORDER) && !(dlPtr->flags & TOP_LINE)) {
+ dlPtr->flags |= OLD_Y_INVALID;
}
- if (dlPtr->nextPtr == NULL) {
- if ((dlPtr->flags & HAS_3D_BORDER)
- && !(dlPtr->flags & BOTTOM_LINE)) {
- dlPtr->oldY = -1;
+ while (1) {
+ if ((dlPtr->flags & TOP_LINE) && (dlPtr != dInfoPtr->dLinePtr)
+ && (dlPtr->flags & HAS_3D_BORDER)) {
+ dlPtr->flags |= OLD_Y_INVALID;
}
- dlPtr->flags &= ~TOP_LINE;
- dlPtr->flags |= BOTTOM_LINE;
- break;
+
+ /*
+ * If the old top-line was not completely showing (i.e. the
+ * pixelOffset is non-zero) and is no longer the top-line, then we
+ * must re-draw it.
+ */
+
+ if ((dlPtr->flags & TOP_LINE) &&
+ dInfoPtr->topPixelOffset!=0 && dlPtr!=dInfoPtr->dLinePtr) {
+ dlPtr->flags |= OLD_Y_INVALID;
+ }
+ if ((dlPtr->flags & BOTTOM_LINE) && (dlPtr->nextPtr != NULL)
+ && (dlPtr->flags & HAS_3D_BORDER)) {
+ dlPtr->flags |= OLD_Y_INVALID;
+ }
+ if (dlPtr->nextPtr == NULL) {
+ if ((dlPtr->flags & HAS_3D_BORDER)
+ && !(dlPtr->flags & BOTTOM_LINE)) {
+ dlPtr->flags |= OLD_Y_INVALID;
+ }
+ dlPtr->flags &= ~TOP_LINE;
+ dlPtr->flags |= BOTTOM_LINE;
+ break;
+ }
+ dlPtr->flags &= ~(TOP_LINE|BOTTOM_LINE);
+ dlPtr = dlPtr->nextPtr;
}
- dlPtr->flags &= ~(TOP_LINE|BOTTOM_LINE);
- dlPtr = dlPtr->nextPtr;
+ dInfoPtr->dLinePtr->flags |= TOP_LINE;
+ dInfoPtr->topPixelOffset = dInfoPtr->newTopPixelOffset;
}
- dInfoPtr->dLinePtr->flags |= TOP_LINE;
/*
* Arrange for scrollbars to be updated.
@@ -1558,15 +2189,12 @@ UpdateDisplayInfo(textPtr)
textPtr->flags |= UPDATE_SCROLLBARS;
/*
- *--------------------------------------------------------------
* Deal with horizontal scrolling:
- * 1. If there's empty space to the right of the longest line,
- * shift the screen to the right to fill in the empty space.
- * 2. If the desired horizontal scroll position has changed,
- * force a full redisplay of all the lines in the widget.
- * 3. If the wrap mode isn't "none" then re-scroll to the base
- * position.
- *--------------------------------------------------------------
+ * 1. If there's empty space to the right of the longest line, shift the
+ * screen to the right to fill in the empty space.
+ * 2. If the desired horizontal scroll position has changed, force a full
+ * redisplay of all the lines in the widget.
+ * 3. If the wrap mode isn't "none" then re-scroll to the base position.
*/
dInfoPtr->maxLength = 0;
@@ -1576,20 +2204,35 @@ UpdateDisplayInfo(textPtr)
dInfoPtr->maxLength = dlPtr->length;
}
}
- maxOffset = (dInfoPtr->maxLength - (dInfoPtr->maxX - dInfoPtr->x)
- + textPtr->charWidth - 1)/textPtr->charWidth;
- if (dInfoPtr->newByteOffset > maxOffset) {
- dInfoPtr->newByteOffset = maxOffset;
+ maxOffset = dInfoPtr->maxLength - (dInfoPtr->maxX - dInfoPtr->x);
+
+ xPixelOffset = dInfoPtr->newXPixelOffset;
+ if (xPixelOffset > maxOffset) {
+ xPixelOffset = maxOffset;
}
- if (dInfoPtr->newByteOffset < 0) {
- dInfoPtr->newByteOffset = 0;
+ if (xPixelOffset < 0) {
+ xPixelOffset = 0;
}
- pixelOffset = dInfoPtr->newByteOffset * textPtr->charWidth;
- if (pixelOffset != dInfoPtr->curPixelOffset) {
- dInfoPtr->curPixelOffset = pixelOffset;
+
+ /*
+ * Here's a problem: see the tests textDisp-29.2.1-4
+ *
+ * If the widget is being created, but has not yet been configured it will
+ * have a maxY of 1 above, and we we won't have examined all the lines
+ * (just the first line, in fact), and so maxOffset will not be a true
+ * reflection of the widget's lines. Therefore we must not overwrite the
+ * original newXPixelOffset in this case.
+ */
+
+ if (!(((Tk_FakeWin *) (textPtr->tkwin))->flags & TK_NEED_CONFIG_NOTIFY)) {
+ dInfoPtr->newXPixelOffset = xPixelOffset;
+ }
+
+ if (xPixelOffset != dInfoPtr->curXPixelOffset) {
+ dInfoPtr->curXPixelOffset = xPixelOffset;
for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL;
dlPtr = dlPtr->nextPtr) {
- dlPtr->oldY = -1;
+ dlPtr->flags |= OLD_Y_INVALID;
}
}
}
@@ -1599,8 +2242,8 @@ UpdateDisplayInfo(textPtr)
*
* FreeDLines --
*
- * This procedure is called to free up all of the resources
- * associated with one or more DLine structures.
+ * This function is called to free up all of the resources associated
+ * with one or more DLine structures.
*
* Results:
* None.
@@ -1612,27 +2255,43 @@ UpdateDisplayInfo(textPtr)
*/
static void
-FreeDLines(textPtr, firstPtr, lastPtr, unlink)
- TkText *textPtr; /* Information about overall text
- * widget. */
- register DLine *firstPtr; /* Pointer to first DLine to free up. */
- DLine *lastPtr; /* Pointer to DLine just after last
- * one to free (NULL means everything
- * starting with firstPtr). */
- int unlink; /* 1 means DLines are currently linked
- * into the list rooted at
- * textPtr->dInfoPtr->dLinePtr and
- * they have to be unlinked. 0 means
- * just free without unlinking. */
+FreeDLines(
+ TkText *textPtr, /* Information about overall text widget. */
+ register DLine *firstPtr, /* Pointer to first DLine to free up. */
+ DLine *lastPtr, /* Pointer to DLine just after last one to
+ * free (NULL means everything starting with
+ * firstPtr). */
+ int action) /* DLINE_UNLINK means DLines are currently
+ * linked into the list rooted at
+ * textPtr->dInfoPtr->dLinePtr and they have
+ * to be unlinked. DLINE_FREE means just free
+ * without unlinking. DLINE_FREE_TEMP means
+ * the DLine given is just a temporary one and
+ * we shouldn't invalidate anything for the
+ * overall widget. */
{
register TkTextDispChunk *chunkPtr, *nextChunkPtr;
register DLine *nextDLinePtr;
- if (unlink) {
+ if (action == DLINE_FREE_TEMP) {
+ lineHeightsRecalculated++;
+ if (tkTextDebug) {
+ char string[TK_POS_CHARS];
+
+ /*
+ * Debugging is enabled, so keep a log of all the lines whose
+ * height was recalculated. The test suite uses this information.
+ */
+
+ TkTextPrintIndex(textPtr, &firstPtr->index, string);
+ LOG("tk_textHeightCalc", string);
+ }
+ } else if (action == DLINE_UNLINK) {
if (textPtr->dInfoPtr->dLinePtr == firstPtr) {
textPtr->dInfoPtr->dLinePtr = lastPtr;
} else {
register DLine *prevPtr;
+
for (prevPtr = textPtr->dInfoPtr->dLinePtr;
prevPtr->nextPtr != firstPtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body. */
@@ -1654,7 +2313,9 @@ FreeDLines(textPtr, firstPtr, lastPtr, unlink)
ckfree((char *) firstPtr);
firstPtr = nextDLinePtr;
}
- textPtr->dInfoPtr->dLinesInvalidated = 1;
+ if (action != DLINE_FREE_TEMP) {
+ textPtr->dInfoPtr->dLinesInvalidated = 1;
+ }
}
/*
@@ -1662,34 +2323,32 @@ FreeDLines(textPtr, firstPtr, lastPtr, unlink)
*
* DisplayDLine --
*
- * This procedure is invoked to draw a single line on the
- * screen.
+ * This function is invoked to draw a single line on the screen.
*
* Results:
* None.
*
* Side effects:
- * The line given by dlPtr is drawn at its correct position in
- * textPtr's window. Note that this is one *display* line, not
- * one *text* line.
+ * The line given by dlPtr is drawn at its correct position in textPtr's
+ * window. Note that this is one *display* line, not one *text* line.
*
*----------------------------------------------------------------------
*/
static void
-DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
- TkText *textPtr; /* Text widget in which to draw line. */
- register DLine *dlPtr; /* Information about line to draw. */
- DLine *prevPtr; /* Line just before one to draw, or NULL
- * if dlPtr is the top line. */
- Pixmap pixmap; /* Pixmap to use for double-buffering.
- * Caller must make sure it's large enough
- * to hold line. */
+DisplayDLine(
+ TkText *textPtr, /* Text widget in which to draw line. */
+ register DLine *dlPtr, /* Information about line to draw. */
+ DLine *prevPtr, /* Line just before one to draw, or NULL if
+ * dlPtr is the top line. */
+ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
+ * must make sure it's large enough to hold
+ * line. */
{
register TkTextDispChunk *chunkPtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
Display *display;
- int height, x;
+ int height, y_off;
#ifndef TK_NO_DOUBLE_BUFFERING
const int y = 0;
#else
@@ -1704,15 +2363,21 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
if ((height + dlPtr->y) > dInfoPtr->maxY) {
height = dInfoPtr->maxY - dlPtr->y;
}
+ if (dlPtr->y < dInfoPtr->y) {
+ y_off = dInfoPtr->y - dlPtr->y;
+ height -= y_off;
+ } else {
+ y_off = 0;
+ }
#ifdef TK_NO_DOUBLE_BUFFERING
- TkpClipDrawableToRect(display, pixmap, dInfoPtr->x, y,
+ TkpClipDrawableToRect(display, pixmap, dInfoPtr->x, y + y_off,
dInfoPtr->maxX - dInfoPtr->x, height);
#endif /* TK_NO_DOUBLE_BUFFERING */
/*
- * First, clear the area of the line to the background color for the
- * text widget.
+ * First, clear the area of the line to the background color for the text
+ * widget.
*/
Tk_Fill3DRectangle(textPtr->tkwin, pixmap, textPtr->border, 0, y,
@@ -1725,19 +2390,20 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap);
/*
- * Make another pass through all of the chunks to redraw the
- * insertion cursor, if it is visible on this line. Must do
- * it here rather than in the foreground pass below because
- * otherwise a wide insertion cursor will obscure the character
- * to its left.
+ * Make another pass through all of the chunks to redraw the insertion
+ * cursor, if it is visible on this line. Must do it here rather than in
+ * the foreground pass below because otherwise a wide insertion cursor
+ * will obscure the character to its left.
*/
- if (textPtr->state == TK_STATE_NORMAL) {
+ if (textPtr->state == TK_TEXT_STATE_NORMAL) {
for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL);
chunkPtr = chunkPtr->nextPtr) {
- x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curPixelOffset;
if (chunkPtr->displayProc == TkTextInsertDisplayProc) {
- (*chunkPtr->displayProc)(chunkPtr, x, y + dlPtr->spaceAbove,
+ int x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset;
+
+ (*chunkPtr->displayProc)(textPtr, chunkPtr, x,
+ y + dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, display, pixmap,
dlPtr->y + dlPtr->spaceAbove);
@@ -1747,49 +2413,49 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
/*
* Make yet another pass through all of the chunks to redraw all of
- * foreground information. Note: we have to call the displayProc
- * even for chunks that are off-screen. This is needed, for
- * example, so that embedded windows can be unmapped in this case.
- * Conve
+ * foreground information. Note: we have to call the displayProc even for
+ * chunks that are off-screen. This is needed, for example, so that
+ * embedded windows can be unmapped in this case.
*/
for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL);
chunkPtr = chunkPtr->nextPtr) {
if (chunkPtr->displayProc == TkTextInsertDisplayProc) {
/*
- * Already displayed the insertion cursor above. Don't
- * do it again here.
+ * Already displayed the insertion cursor above. Don't do it again
+ * here.
*/
continue;
}
- x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curPixelOffset;
- if ((x + chunkPtr->width <= 0) || (x >= dInfoPtr->maxX)) {
- /*
- * Note: we have to call the displayProc even for chunks
- * that are off-screen. This is needed, for example, so
- * that embedded windows can be unmapped in this case.
- * Display the chunk at a coordinate that can be clearly
- * identified by the displayProc as being off-screen to
- * the left (the displayProc may not be able to tell if
- * something is off to the right).
- */
- if (chunkPtr->displayProc != NULL)
- (*chunkPtr->displayProc)(chunkPtr, -chunkPtr->width,
- y + dlPtr->spaceAbove,
- dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
- dlPtr->baseline - dlPtr->spaceAbove, display, pixmap,
- dlPtr->y + dlPtr->spaceAbove);
- } else {
- /* don't call if elide. This tax ok since not very many visible DLine's in
- an area, but potentially many elide ones */
- if (chunkPtr->displayProc != NULL)
- (*chunkPtr->displayProc)(chunkPtr, x, y + dlPtr->spaceAbove,
- dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
- dlPtr->baseline - dlPtr->spaceAbove, display, pixmap,
- dlPtr->y + dlPtr->spaceAbove);
+ /*
+ * Don't call if elide. This tax OK since not very many visible DLines
+ * in an area, but potentially many elide ones.
+ */
+
+ if (chunkPtr->displayProc != NULL) {
+ int x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset;
+
+ if ((x + chunkPtr->width <= 0) || (x >= dInfoPtr->maxX)) {
+ /*
+ * Note: we have to call the displayProc even for chunks that
+ * are off-screen. This is needed, for example, so that
+ * embedded windows can be unmapped in this case. Display the
+ * chunk at a coordinate that can be clearly identified by the
+ * displayProc as being off-screen to the left (the
+ * displayProc may not be able to tell if something is off to
+ * the right).
+ */
+
+ x = -chunkPtr->width;
+ }
+ (*chunkPtr->displayProc)(textPtr, chunkPtr, x,
+ y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove -
+ dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove,
+ display, pixmap, dlPtr->y + dlPtr->spaceAbove);
}
+
if (dInfoPtr->dLinesInvalidated) {
return;
}
@@ -1797,17 +2463,17 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Copy the pixmap onto the screen. If this is the last line on
- * the screen then copy a piece of the line, so that it doesn't
- * overflow into the border area. Another special trick: copy the
- * padding area to the left of the line; this is because the
- * insertion cursor sometimes overflows onto that area and we want
- * to get as much of the cursor as possible.
+ * Copy the pixmap onto the screen. If this is the first or last line on
+ * the screen then copy a piece of the line, so that it doesn't overflow
+ * into the border area. Another special trick: copy the padding area to
+ * the left of the line; this is because the insertion cursor sometimes
+ * overflows onto that area and we want to get as much of the cursor as
+ * possible.
*/
XCopyArea(display, pixmap, Tk_WindowId(textPtr->tkwin), dInfoPtr->copyGC,
- dInfoPtr->x, y, (unsigned) (dInfoPtr->maxX - dInfoPtr->x),
- (unsigned) height, dInfoPtr->x, dlPtr->y);
+ dInfoPtr->x, y + y_off, (unsigned) (dInfoPtr->maxX - dInfoPtr->x),
+ (unsigned) height, dInfoPtr->x, dlPtr->y + y_off);
#else
TkpClipDrawableToRect(display, pixmap, 0, 0, -1, -1);
#endif /* TK_NO_DOUBLE_BUFFERING */
@@ -1819,14 +2485,13 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
*
* DisplayLineBackground --
*
- * This procedure is called to fill in the background for
- * a display line. It draws 3D borders cleverly so that
- * adjacent chunks with the same style (whether on the same
- * line or different lines) have a single 3D border around
- * the whole region.
+ * This function is called to fill in the background for a display line.
+ * It draws 3D borders cleverly so that adjacent chunks with the same
+ * style (whether on the same line or different lines) have a single 3D
+ * border around the whole region.
*
* Results:
- * There is no return value. Pixmap is filled in with background
+ * There is no return value. Pixmap is filled in with background
* information for dlPtr.
*
* Side effects:
@@ -1836,39 +2501,38 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
*/
static void
-DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
- TkText *textPtr; /* Text widget containing line. */
- register DLine *dlPtr; /* Information about line to draw. */
- DLine *prevPtr; /* Line just above dlPtr, or NULL if dlPtr
- * is the top-most line in the window. */
- Pixmap pixmap; /* Pixmap to use for double-buffering.
- * Caller must make sure it's large enough
- * to hold line. Caller must also have
- * filled it with the background color for
- * the widget. */
+DisplayLineBackground(
+ TkText *textPtr, /* Text widget containing line. */
+ register DLine *dlPtr, /* Information about line to draw. */
+ DLine *prevPtr, /* Line just above dlPtr, or NULL if dlPtr is
+ * the top-most line in the window. */
+ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
+ * must make sure it's large enough to hold
+ * line. Caller must also have filled it with
+ * the background color for the widget. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- TkTextDispChunk *chunkPtr; /* Pointer to chunk in the current line. */
- TkTextDispChunk *chunkPtr2; /* Pointer to chunk in the line above or
- * below the current one. NULL if we're to
- * the left of or to the right of the chunks
- * in the line. */
+ TkTextDispChunk *chunkPtr; /* Pointer to chunk in the current line. */
+ TkTextDispChunk *chunkPtr2; /* Pointer to chunk in the line above or below
+ * the current one. NULL if we're to the left
+ * of or to the right of the chunks in the
+ * line. */
TkTextDispChunk *nextPtr2; /* Next chunk after chunkPtr2 (it's not the
* same as chunkPtr2->nextPtr in the case
- * where chunkPtr2 is NULL because the line
- * is indented). */
- int leftX; /* The left edge of the region we're
- * currently working on. */
+ * where chunkPtr2 is NULL because the line is
+ * indented). */
+ int leftX; /* The left edge of the region we're currently
+ * working on. */
int leftXIn; /* 1 means beveled edge at leftX slopes right
- * as it goes down, 0 means it slopes left
- * as it goes down. */
+ * as it goes down, 0 means it slopes left as
+ * it goes down. */
int rightX; /* Right edge of chunkPtr. */
int rightX2; /* Right edge of chunkPtr2. */
- int matchLeft; /* Does the style of this line match that
- * of its neighbor just to the left of
- * the current x coordinate? */
- int matchRight; /* Does line's style match its neighbor
- * just to the right of the current x-coord? */
+ int matchLeft; /* Does the style of this line match that of
+ * its neighbor just to the left of the
+ * current x coordinate? */
+ int matchRight; /* Does line's style match its neighbor just
+ * to the right of the current x-coord? */
int minX, maxX, xOffset;
StyleValues *sValuePtr;
Display *display;
@@ -1879,32 +2543,29 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
#endif /* TK_NO_DOUBLE_BUFFERING */
/*
- * Pass 1: scan through dlPtr from left to right. For each range of
- * chunks with the same style, draw the main background for the style
- * plus the vertical parts of the 3D borders (the left and right
- * edges).
+ * Pass 1: scan through dlPtr from left to right. For each range of chunks
+ * with the same style, draw the main background for the style plus the
+ * vertical parts of the 3D borders (the left and right edges).
*/
display = Tk_Display(textPtr->tkwin);
- minX = dInfoPtr->curPixelOffset;
+ minX = dInfoPtr->curXPixelOffset;
xOffset = dInfoPtr->x - minX;
maxX = minX + dInfoPtr->maxX - dInfoPtr->x;
chunkPtr = dlPtr->chunkPtr;
/*
- * Note A: in the following statement, and a few others later in
- * this file marked with "See Note A above", the right side of the
- * assignment was replaced with 0 on 6/18/97. This has the effect
- * of highlighting the empty space to the left of a line whenever
- * the leftmost character of the line is highlighted. This way,
- * multi-line highlights always line up along their left edges.
- * However, this may look funny in the case where a single word is
- * highlighted. To undo the change, replace "leftX = 0" with "leftX
- * = chunkPtr->x" and "rightX2 = 0" with "rightX2 = nextPtr2->x"
- * here and at all the marked points below. This restores the old
- * behavior where empty space to the left of a line is not
- * highlighted, leaving a ragged left edge for multi-line
- * highlights.
+ * Note A: in the following statement, and a few others later in this file
+ * marked with "See Note A above", the right side of the assignment was
+ * replaced with 0 on 6/18/97. This has the effect of highlighting the
+ * empty space to the left of a line whenever the leftmost character of
+ * the line is highlighted. This way, multi-line highlights always line up
+ * along their left edges. However, this may look funny in the case where
+ * a single word is highlighted. To undo the change, replace "leftX = 0"
+ * with "leftX = chunkPtr->x" and "rightX2 = 0" with "rightX2 =
+ * nextPtr2->x" here and at all the marked points below. This restores the
+ * old behavior where empty space to the left of a line is not
+ * highlighted, leaving a ragged left edge for multi-line highlights.
*/
leftX = 0;
@@ -1920,9 +2581,12 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
rightX = maxX;
}
if (chunkPtr->stylePtr->bgGC != None) {
- /* Not visible - bail out now */
+ /*
+ * Not visible - bail out now.
+ */
+
if (rightX + xOffset <= 0) {
- leftX = rightX;
+ leftX = rightX;
continue;
}
@@ -1932,11 +2596,12 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
* -32768 (or less) to +something simply does not display
* correctly. [Patch #541999]
*/
+
if ((leftX + xOffset) < -(sValuePtr->borderWidth)) {
- leftX = -sValuePtr->borderWidth - xOffset;
+ leftX = -sValuePtr->borderWidth - xOffset;
}
if ((rightX - leftX) > 32767) {
- rightX = leftX + 32767;
+ rightX = leftX + 32767;
}
XFillRectangle(display, pixmap, chunkPtr->stylePtr->bgGC,
@@ -1956,9 +2621,9 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
}
/*
- * Pass 2: draw the horizontal bevels along the top of the line. To
- * do this, scan through dlPtr from left to right while simultaneously
- * scanning through the line just above dlPtr. ChunkPtr2 and nextPtr2
+ * Pass 2: draw the horizontal bevels along the top of the line. To do
+ * this, scan through dlPtr from left to right while simultaneously
+ * scanning through the line just above dlPtr. ChunkPtr2 and nextPtr2
* refer to two adjacent chunks in the line above.
*/
@@ -1999,8 +2664,8 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
sValuePtr = chunkPtr->stylePtr->sValuePtr;
if (rightX <= rightX2) {
/*
- * The chunk in our line is about to end. If its style
- * changes then draw the bevel for the current style.
+ * The chunk in our line is about to end. If its style changes
+ * then draw the bevel for the current style.
*/
if ((chunkPtr->nextPtr == NULL)
@@ -2016,9 +2681,8 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
leftXIn = 1;
/*
- * If the chunk in the line above is also ending at
- * the same point then advance to the next chunk in
- * that line.
+ * If the chunk in the line above is also ending at the same
+ * point then advance to the next chunk in that line.
*/
if ((rightX == rightX2) && (chunkPtr2 != NULL)) {
@@ -2037,11 +2701,10 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
}
/*
- * The chunk in the line above is ending at an x-position where
- * there is no change in the style of the current line. If the
- * style above matches the current line on one side of the change
- * but not on the other, we have to draw an L-shaped piece of
- * bevel.
+ * The chunk in the line above is ending at an x-position where there
+ * is no change in the style of the current line. If the style above
+ * matches the current line on one side of the change but not on the
+ * other, we have to draw an L-shaped piece of bevel.
*/
matchRight = (nextPtr2 != NULL)
@@ -2061,12 +2724,12 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
rightX2 + xOffset, y, sValuePtr->borderWidth,
sValuePtr->borderWidth, 1, sValuePtr->relief);
Tk_3DHorizontalBevel(textPtr->tkwin, pixmap, sValuePtr->border,
- leftX + xOffset, y, rightX2 + sValuePtr->borderWidth -
+ leftX + xOffset, y, rightX2 + sValuePtr->borderWidth -
leftX, sValuePtr->borderWidth, leftXIn, 0, 1,
sValuePtr->relief);
}
- nextChunk2:
+ nextChunk2:
chunkPtr2 = nextPtr2;
if (chunkPtr2 == NULL) {
rightX2 = INT_MAX;
@@ -2078,9 +2741,10 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
}
}
}
+
/*
- * Pass 3: draw the horizontal bevels along the bottom of the line.
- * This uses the same approach as pass 2.
+ * Pass 3: draw the horizontal bevels along the bottom of the line. This
+ * uses the same approach as pass 2.
*/
chunkPtr = dlPtr->chunkPtr;
@@ -2171,7 +2835,7 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
sValuePtr->relief);
}
- nextChunk2b:
+ nextChunk2b:
chunkPtr2 = nextPtr2;
if (chunkPtr2 == NULL) {
rightX2 = INT_MAX;
@@ -2188,11 +2852,1025 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
/*
*----------------------------------------------------------------------
*
+ * AsyncUpdateLineMetrics --
+ *
+ * This function is invoked as a background handler to update the pixel-
+ * height calculations of individual lines in an asychronous manner.
+ *
+ * Currently a timer-handler is used for this purpose, which continuously
+ * reschedules itself. It may well be better to use some other approach
+ * (e.g., a background thread). We can't use an idle-callback because of
+ * a known bug in Tcl/Tk in which idle callbacks are not allowed to
+ * re-schedule themselves. This just causes an effective infinite loop.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Line heights may be recalculated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+AsyncUpdateLineMetrics(
+ ClientData clientData) /* Information about widget. */
+{
+ register TkText *textPtr = (TkText *) clientData;
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+ int lineNum;
+
+ dInfoPtr->lineUpdateTimer = NULL;
+
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
+ /*
+ * The widget has been deleted. Don't do anything.
+ */
+
+ if (--textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
+ }
+ return;
+ }
+
+ if (dInfoPtr->flags & REDRAW_PENDING) {
+ dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
+ AsyncUpdateLineMetrics, clientData);
+ return;
+ }
+
+ lineNum = dInfoPtr->currentMetricUpdateLine;
+ if (dInfoPtr->lastMetricUpdateLine == -1) {
+ dInfoPtr->lastMetricUpdateLine =
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
+ }
+
+ /*
+ * Update the lines in blocks of about 24 recalculations, or 250+ lines
+ * examined, so we pass in 256 for 'doThisMuch'.
+ */
+
+ lineNum = TkTextUpdateLineMetrics(textPtr, lineNum,
+ dInfoPtr->lastMetricUpdateLine, 256);
+
+ if (tkTextDebug) {
+ char buffer[2 * TCL_INTEGER_SPACE + 1];
+
+ sprintf(buffer, "%d %d", lineNum, dInfoPtr->lastMetricUpdateLine);
+ LOG("tk_textInvalidateLine", buffer);
+ }
+
+ /*
+ * If we're not in the middle of a long-line calculation (metricEpoch==-1)
+ * and we've reached the last line, then we're done.
+ */
+
+ if (dInfoPtr->metricEpoch == -1
+ && lineNum == dInfoPtr->lastMetricUpdateLine) {
+ /*
+ * We have looped over all lines, so we're done. We must release our
+ * refCount on the widget (the timer token was already set to NULL
+ * above).
+ */
+
+ textPtr->refCount--;
+ if (textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
+ }
+ return;
+ }
+ dInfoPtr->currentMetricUpdateLine = lineNum;
+
+ /*
+ * Re-arm the timer. We already have a refCount on the text widget so no
+ * need to adjust that.
+ */
+
+ dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
+ AsyncUpdateLineMetrics, (ClientData) textPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkTextUpdateLineMetrics --
+ *
+ * This function updates the pixel height calculations of a range of
+ * lines in the widget. The range is from lineNum to endLine, but, if
+ * doThisMuch is positive, then the function may return earlier, once a
+ * certain number of lines has been examined. The line counts are from 0.
+ *
+ * If doThisMuch is -1, then all lines in the range will be updated. This
+ * will potentially take quite some time for a large text widget.
+ *
+ * Note: with bad input for lineNum and endLine, this function can loop
+ * indefinitely.
+ *
+ * Results:
+ * The index of the last line examined (or -1 if we are about to wrap
+ * around from end to beginning of the widget, and the next line will be
+ * the first line).
+ *
+ * Side effects:
+ * Line heights may be recalculated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkTextUpdateLineMetrics(
+ TkText *textPtr, /* Information about widget. */
+ int lineNum, /* Start at this line. */
+ int endLine, /* Go no further than this line. */
+ int doThisMuch) /* How many lines to check, or how many 10s of
+ * lines to recalculate. If '-1' then do
+ * everything in the range (which may take a
+ * while). */
+{
+ TkTextLine *linePtr = NULL;
+ int count = 0;
+ int totalLines = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
+
+ if (totalLines == 0) {
+ /*
+ * Empty peer widget.
+ */
+
+ return endLine;
+ }
+
+ while (1) {
+ /*
+ * Get a suitable line.
+ */
+
+ if (lineNum == -1 && linePtr == NULL) {
+ lineNum = 0;
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
+ lineNum);
+ } else {
+ if (lineNum == -1 || linePtr == NULL) {
+ if (lineNum == -1) {
+ lineNum = 0;
+ }
+ linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ textPtr, lineNum);
+ } else {
+ lineNum++;
+ linePtr = TkBTreeNextLine(textPtr, linePtr);
+ }
+
+ /*
+ * If we're in the middle of a partial-line height calculation,
+ * then we can't be done.
+ */
+
+ if (textPtr->dInfoPtr->metricEpoch == -1 && lineNum == endLine) {
+ /*
+ * We have looped over all lines, so we're done.
+ */
+
+ break;
+ }
+ }
+
+ if (lineNum < totalLines) {
+ if (tkTextDebug) {
+ char buffer[4 * TCL_INTEGER_SPACE + 3];
+
+ sprintf(buffer, "%d %d %d %d",
+ lineNum, endLine, totalLines, count);
+ LOG("tk_textInvalidateLine", buffer);
+ }
+
+ /*
+ * Now update the line's metrics if necessary.
+ */
+
+ if (TkBTreeLinePixelEpoch(textPtr, linePtr)
+ != textPtr->dInfoPtr->lineMetricUpdateEpoch) {
+ if (doThisMuch == -1) {
+ count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,
+ NULL, 0);
+ } else {
+ TkTextIndex index;
+ TkTextIndex *indexPtr;
+ int pixelHeight;
+
+ /*
+ * If the metric epoch is the same as the widget's epoch,
+ * then we know that indexPtrs are still valid, and if the
+ * cached metricIndex (if any) is for the same line as we
+ * wish to examine, then we are looking at a long line
+ * wrapped many times, which we will examine in pieces.
+ */
+
+ if (textPtr->dInfoPtr->metricEpoch ==
+ textPtr->sharedTextPtr->stateEpoch &&
+ textPtr->dInfoPtr->metricIndex.linePtr==linePtr) {
+ indexPtr = &textPtr->dInfoPtr->metricIndex;
+ pixelHeight = textPtr->dInfoPtr->metricPixelHeight;
+ } else {
+ /*
+ * We must reset the partial line height calculation
+ * data here, so we don't use it when it is out of
+ * date.
+ */
+
+ textPtr->dInfoPtr->metricEpoch = -1;
+ index.tree = textPtr->sharedTextPtr->tree;
+ index.linePtr = linePtr;
+ index.byteIndex = 0;
+ index.textPtr = NULL;
+ indexPtr = &index;
+ pixelHeight = 0;
+ }
+
+ /*
+ * Update the line and update the counter, counting 8 for
+ * each display line we actually re-layout.
+ */
+
+ count += 8 * TkTextUpdateOneLine(textPtr, linePtr,
+ pixelHeight, indexPtr, 1);
+
+ if (indexPtr->linePtr == linePtr) {
+ /*
+ * We didn't complete the logical line, because it
+ * produced very many display lines - it must be a
+ * long line wrapped many times. So we must cache as
+ * far as we got for next time around.
+ */
+
+ if (pixelHeight == 0) {
+ /*
+ * These have already been stored, unless we just
+ * started the new line.
+ */
+
+ textPtr->dInfoPtr->metricIndex = index;
+ textPtr->dInfoPtr->metricEpoch =
+ textPtr->sharedTextPtr->stateEpoch;
+ }
+ textPtr->dInfoPtr->metricPixelHeight =
+ TkBTreeLinePixelCount(textPtr, linePtr);
+ break;
+ } else {
+ /*
+ * We're done with this long line.
+ */
+
+ textPtr->dInfoPtr->metricEpoch = -1;
+ }
+ }
+ } else {
+ /*
+ * This line is already up to date. That means there's nothing
+ * to do here.
+ */
+ }
+ } else {
+ /*
+ * We must never recalculate the height of the last artificial
+ * line. It must stay at zero, and if we recalculate it, it will
+ * change.
+ */
+
+ if (endLine >= totalLines) {
+ lineNum = endLine;
+ break;
+ }
+
+ /*
+ * Set things up for the next loop through.
+ */
+
+ lineNum = -1;
+ }
+ count++;
+
+ if (doThisMuch != -1 && count >= doThisMuch) {
+ break;
+ }
+ }
+ if (doThisMuch == -1) {
+ /*
+ * If we were requested to provide a full update, then also update the
+ * scrollbar.
+ */
+
+ GetYView(textPtr->interp, textPtr, 1);
+ }
+ return lineNum;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkTextInvalidateLineMetrics, TextInvalidateLineMetrics --
+ *
+ * Mark a number of text lines as having invalid line metric
+ * calculations. Never call this with linePtr as the last (artificial)
+ * line in the text. Depending on 'action' which indicates whether the
+ * given lines are simply invalid or have been inserted or deleted, the
+ * pre-existing asynchronous line update range may need to be adjusted.
+ *
+ * If linePtr is NULL then 'lineCount' and 'action' are ignored and all
+ * lines are invalidated.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May schedule an asychronous callback.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkTextInvalidateLineMetrics(
+ TkSharedText *sharedTextPtr,/* Shared widget section for all peers, or
+ * NULL. */
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextLine *linePtr, /* Invalidation starts from this line. */
+ int lineCount, /* And includes this many following lines. */
+ int action) /* Indicates what type of invalidation
+ * occurred (insert, delete, or simple). */
+{
+ if (sharedTextPtr == NULL) {
+ TextInvalidateLineMetrics(textPtr, linePtr, lineCount, action);
+ } else {
+ textPtr = sharedTextPtr->peers;
+ while (textPtr != NULL) {
+ TextInvalidateLineMetrics(textPtr, linePtr, lineCount, action);
+ textPtr = textPtr->next;
+ }
+ }
+}
+
+static void
+TextInvalidateLineMetrics(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextLine *linePtr, /* Invalidation starts from this line. */
+ int lineCount, /* And includes this many following lines. */
+ int action) /* Indicates what type of invalidation
+ * occurred (insert, delete, or simple). */
+{
+ int fromLine;
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+
+ if (linePtr != NULL) {
+ int counter = lineCount;
+
+ fromLine = TkBTreeLinesTo(textPtr, linePtr);
+
+ /*
+ * Invalidate the height calculations of each line in the given range.
+ */
+
+ TkBTreeLinePixelEpoch(textPtr, linePtr) = 0;
+ while (counter > 0 && linePtr != 0) {
+ linePtr = TkBTreeNextLine(textPtr, linePtr);
+ if (linePtr != NULL) {
+ TkBTreeLinePixelEpoch(textPtr, linePtr) = 0;
+ }
+ counter--;
+ }
+
+ /*
+ * Now schedule an examination of each line in the union of the old
+ * and new update ranges, including the (possibly empty) range in
+ * between. If that between range is not-empty, then we are examining
+ * more lines than is strictly necessary (but the examination of the
+ * extra lines should be quick, since their pixelCalculationEpoch will
+ * be up to date). However, to keep track of that would require more
+ * complex record-keeping that what we have.
+ */
+
+ if (dInfoPtr->lineUpdateTimer == NULL) {
+ dInfoPtr->currentMetricUpdateLine = fromLine;
+ if (action == TK_TEXT_INVALIDATE_DELETE) {
+ lineCount = 0;
+ }
+ dInfoPtr->lastMetricUpdateLine = fromLine + lineCount + 1;
+ } else {
+ int toLine = fromLine + lineCount + 1;
+
+ if (action == TK_TEXT_INVALIDATE_DELETE) {
+ if (toLine <= dInfoPtr->currentMetricUpdateLine) {
+ dInfoPtr->currentMetricUpdateLine = fromLine;
+ if (dInfoPtr->lastMetricUpdateLine != -1) {
+ dInfoPtr->lastMetricUpdateLine -= lineCount;
+ }
+ } else if (fromLine <= dInfoPtr->currentMetricUpdateLine) {
+ dInfoPtr->currentMetricUpdateLine = fromLine;
+ if (toLine <= dInfoPtr->lastMetricUpdateLine) {
+ dInfoPtr->lastMetricUpdateLine -= lineCount;
+ }
+ } else {
+ if (dInfoPtr->lastMetricUpdateLine != -1) {
+ dInfoPtr->lastMetricUpdateLine = toLine;
+ }
+ }
+ } else if (action == TK_TEXT_INVALIDATE_INSERT) {
+ if (toLine <= dInfoPtr->currentMetricUpdateLine) {
+ dInfoPtr->currentMetricUpdateLine = fromLine;
+ if (dInfoPtr->lastMetricUpdateLine != -1) {
+ dInfoPtr->lastMetricUpdateLine += lineCount;
+ }
+ } else if (fromLine <= dInfoPtr->currentMetricUpdateLine) {
+ dInfoPtr->currentMetricUpdateLine = fromLine;
+ if (toLine <= dInfoPtr->lastMetricUpdateLine) {
+ dInfoPtr->lastMetricUpdateLine += lineCount;
+ }
+ if (toLine > dInfoPtr->lastMetricUpdateLine) {
+ dInfoPtr->lastMetricUpdateLine = toLine;
+ }
+ } else {
+ if (dInfoPtr->lastMetricUpdateLine != -1) {
+ dInfoPtr->lastMetricUpdateLine = toLine;
+ }
+ }
+ } else {
+ if (fromLine < dInfoPtr->currentMetricUpdateLine) {
+ dInfoPtr->currentMetricUpdateLine = fromLine;
+ }
+ if (dInfoPtr->lastMetricUpdateLine != -1
+ && toLine > dInfoPtr->lastMetricUpdateLine) {
+ dInfoPtr->lastMetricUpdateLine = toLine;
+ }
+ }
+ }
+ } else {
+ /*
+ * This invalidates the height of all lines in the widget.
+ */
+
+ if ((++dInfoPtr->lineMetricUpdateEpoch) == 0) {
+ dInfoPtr->lineMetricUpdateEpoch++;
+ }
+
+ /*
+ * This has the effect of forcing an entire new loop of update checks
+ * on all lines in the widget.
+ */
+
+ if (dInfoPtr->lineUpdateTimer == NULL) {
+ dInfoPtr->currentMetricUpdateLine = -1;
+ }
+ dInfoPtr->lastMetricUpdateLine = dInfoPtr->currentMetricUpdateLine;
+ }
+
+ /*
+ * Now re-set the current update calculations.
+ */
+
+ if (dInfoPtr->lineUpdateTimer == NULL) {
+ textPtr->refCount++;
+ dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
+ AsyncUpdateLineMetrics, (ClientData) textPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkTextFindDisplayLineEnd --
+ *
+ * This function is invoked to find the index of the beginning or end of
+ * the particular display line on which the given index sits, whether
+ * that line is displayed or not.
+ *
+ * If 'end' is zero, we look for the start, and if 'end' is one we look
+ * for the end.
+ *
+ * If the beginning of the current display line is elided, and we are
+ * looking for the start of the line, then the returned index will be the
+ * first elided index on the display line.
+ *
+ * Similarly if the end of the current display line is elided and we are
+ * looking for the end, then the returned index will be the last elided
+ * index on the display line.
+ *
+ * Results:
+ * Modifies indexPtr to point to the given end.
+ *
+ * If xOffset is non-NULL, it is set to the x-pixel offset of the given
+ * original index within the given display line.
+ *
+ * Side effects:
+ * The combination of 'LayoutDLine' and 'FreeDLines' seems like a rather
+ * time-consuming way of gathering the information we need, so this would
+ * be a good place to look to speed up the calculations. In particular
+ * these calls will map and unmap embedded windows respectively, which I
+ * would hope isn't exactly necessary!
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkTextFindDisplayLineEnd(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *indexPtr, /* Index we will adjust to the display line
+ * start or end. */
+ int end, /* 0 = start, 1 = end. */
+ int *xOffset) /* NULL, or used to store the x-pixel offset
+ * of the original index within its display
+ * line. */
+{
+ if (!end && indexPtr->byteIndex == 0) {
+ /*
+ * Nothing to do.
+ */
+
+ if (xOffset != NULL) {
+ *xOffset = 0;
+ }
+ return;
+ } else {
+ TkTextIndex index = *indexPtr;
+
+ index.byteIndex = 0;
+ index.textPtr = NULL;
+
+ while (1) {
+ TkTextIndex endOfLastLine;
+
+ if (TkTextIndexBackBytes(textPtr, &index, 1, &endOfLastLine)) {
+ /*
+ * Reached beginning of text.
+ */
+
+ break;
+ }
+
+ if (!TkTextIsElided(textPtr, &endOfLastLine, NULL)) {
+ /*
+ * The eol is not elided, so 'index' points to the start of a
+ * display line (as well as logical line).
+ */
+
+ break;
+ }
+
+ /*
+ * indexPtr's logical line is actually merged with the previous
+ * logical line whose eol is elided. Continue searching back to
+ * get a real line start.
+ */
+
+ index = endOfLastLine;
+ index.byteIndex = 0;
+ }
+
+ while (1) {
+ DLine *dlPtr;
+ int byteCount;
+ TkTextIndex nextLineStart;
+
+ dlPtr = LayoutDLine(textPtr, &index);
+ byteCount = dlPtr->byteCount;
+
+ TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart);
+
+ /*
+ * 'byteCount' goes up to the beginning of the next display line,
+ * so equality here says we need one more line. We try to perform
+ * a quick comparison which is valid for the case where the
+ * logical line is the same, but otherwise fall back on a full
+ * TkTextIndexCmp.
+ */
+
+ if (((index.linePtr == indexPtr->linePtr)
+ && (index.byteIndex + byteCount > indexPtr->byteIndex))
+ || (dlPtr->logicalLinesMerged > 0
+ && TkTextIndexCmp(&nextLineStart, indexPtr) > 0)) {
+ /*
+ * It's on this display line.
+ */
+
+ if (xOffset != NULL) {
+ /*
+ * This call takes a byte index relative to the start of
+ * the current _display_ line, not logical line. We are
+ * about to overwrite indexPtr->byteIndex, so we must do
+ * this now.
+ */
+
+ *xOffset = DlineXOfIndex(textPtr, dlPtr,
+ indexPtr->byteIndex - dlPtr->index.byteIndex);
+ }
+ if (end) {
+ /*
+ * The index we want is one less than the number of bytes
+ * in the display line.
+ */
+
+ TkTextIndexBackBytes(textPtr, &nextLineStart, 1, indexPtr);
+ } else {
+ *indexPtr = index;
+ }
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ return;
+ }
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ index = nextLineStart;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CalculateDisplayLineHeight --
+ *
+ * This function is invoked to recalculate the height of the particular
+ * display line which starts with the given index, whether that line is
+ * displayed or not.
+ *
+ * This function does not, in itself, update any cached information about
+ * line heights. That should be done, where necessary, by its callers.
+ *
+ * The behaviour of this function is _undefined_ if indexPtr is not
+ * currently at the beginning of a display line.
+ *
+ * Results:
+ * The number of vertical pixels used by the display line.
+ *
+ * If 'byteCountPtr' is non-NULL, then returns in that pointer the number
+ * of byte indices on the given display line (which can be used to update
+ * indexPtr in a loop).
+ *
+ * If 'mergedLinePtr' is non-NULL, then returns in that pointer the
+ * number of extra logical lines merged into the given display line.
+ *
+ * Side effects:
+ * The combination of 'LayoutDLine' and 'FreeDLines' seems like a rather
+ * time-consuming way of gathering the information we need, so this would
+ * be a good place to look to speed up the calculations. In particular
+ * these calls will map and unmap embedded windows respectively, which I
+ * would hope isn't exactly necessary!
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+CalculateDisplayLineHeight(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr,/* The index at the beginning of the display
+ * line of interest. */
+ int *byteCountPtr, /* NULL or used to return the number of byte
+ * indices on the given display line. */
+ int *mergedLinePtr) /* NULL or used to return if the given display
+ * line merges with a following logical line
+ * (because the eol is elided). */
+{
+ DLine *dlPtr;
+ int pixelHeight;
+
+ /*
+ * Special case for artificial last line. May be better to move this
+ * inside LayoutDLine.
+ */
+
+ if (indexPtr->byteIndex == 0
+ && TkBTreeNextLine(textPtr, indexPtr->linePtr) == NULL) {
+ if (byteCountPtr != NULL) {
+ *byteCountPtr = 0;
+ }
+ if (mergedLinePtr != NULL) {
+ *mergedLinePtr = 0;
+ }
+ return 0;
+ }
+
+ /*
+ * Layout, find the information we need and then free the display-line we
+ * laid-out. We must use 'FreeDLines' because it will actually call the
+ * relevant code to unmap any embedded windows which were mapped in the
+ * LayoutDLine call!
+ */
+
+ dlPtr = LayoutDLine(textPtr, indexPtr);
+ pixelHeight = dlPtr->height;
+ if (byteCountPtr != NULL) {
+ *byteCountPtr = dlPtr->byteCount;
+ }
+ if (mergedLinePtr != NULL) {
+ *mergedLinePtr = dlPtr->logicalLinesMerged;
+ }
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+
+ return pixelHeight;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkTextIndexYPixels --
+ *
+ * This function is invoked to calculate the number of vertical pixels
+ * between the first index of the text widget and the given index. The
+ * range from first logical line to given logical line is determined
+ * using the cached values, and the range inside the given logical line
+ * is calculated on the fly.
+ *
+ * Results:
+ * The pixel distance between first pixel in the widget and the
+ * top of the index's current display line (could be zero).
+ *
+ * Side effects:
+ * Just those of 'CalculateDisplayLineHeight'.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkTextIndexYPixels(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr)/* The index of which we want the pixel
+ * distance from top of logical line to top of
+ * index. */
+{
+ int pixelHeight;
+ TkTextIndex index;
+
+ pixelHeight = TkBTreePixelsTo(textPtr, indexPtr->linePtr);
+
+ /*
+ * Iterate through all display-lines corresponding to the single logical
+ * line belonging to indexPtr, adding up the pixel height of each such
+ * display line as we go along, until we go past 'indexPtr'.
+ */
+
+ if (indexPtr->byteIndex == 0) {
+ return pixelHeight;
+ }
+
+ index.tree = textPtr->sharedTextPtr->tree;
+ index.linePtr = indexPtr->linePtr;
+ index.byteIndex = 0;
+ index.textPtr = NULL;
+
+ while (1) {
+ int bytes, height;
+
+ /*
+ * Currently this call doesn't have many side-effects. However, if in
+ * the future we change the code so there are side-effects (such as
+ * adjusting linePtr->pixelHeight), then the code might not quite work
+ * as intended, specifically the 'linePtr->pixelHeight == pixelHeight'
+ * test below this while loop.
+ */
+
+ height = CalculateDisplayLineHeight(textPtr, &index, &bytes, NULL);
+
+ index.byteIndex += bytes;
+
+ if (index.byteIndex > indexPtr->byteIndex) {
+ return pixelHeight;
+ }
+
+ if (height > 0) {
+ pixelHeight += height;
+ }
+
+ if (index.byteIndex == indexPtr->byteIndex) {
+ return pixelHeight;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkTextUpdateOneLine --
+ *
+ * This function is invoked to recalculate the height of a particular
+ * logical line, whether that line is displayed or not.
+ *
+ * It must NEVER be called for the artificial last TkTextLine which is
+ * used internally for administrative purposes only. That line must
+ * retain its initial height of 0 otherwise the pixel height calculation
+ * maintained by the B-tree will be wrong.
+ *
+ * Results:
+ * The number of display lines in the logical line. This could be zero if
+ * the line is totally elided.
+ *
+ * Side effects:
+ * Line heights may be recalculated, and a timer to update the scrollbar
+ * may be installed. Also see the called function
+ * CalculateDisplayLineHeight for its side effects.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkTextUpdateOneLine(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextLine *linePtr, /* The line of which to calculate the
+ * height. */
+ int pixelHeight, /* If indexPtr is non-NULL, then this is the
+ * number of pixels in the logical line
+ * linePtr, up to the index which has been
+ * given. */
+ TkTextIndex *indexPtr, /* Either NULL or an index at the start of a
+ * display line belonging to linePtr, at which
+ * we wish to start (e.g. up to which we have
+ * already calculated). On return this will be
+ * set to the first index on the next line. */
+ int partialCalc) /* Set to 1 if we are allowed to do partial
+ * height calculations of long-lines. In this
+ * case we'll only return what we know so
+ * far. */
+{
+ TkTextIndex index;
+ int displayLines;
+ int mergedLines;
+
+ if (indexPtr == NULL) {
+ index.tree = textPtr->sharedTextPtr->tree;
+ index.linePtr = linePtr;
+ index.byteIndex = 0;
+ index.textPtr = NULL;
+ indexPtr = &index;
+ pixelHeight = 0;
+ }
+
+ /*
+ * Iterate through all display-lines corresponding to the single logical
+ * line 'linePtr', adding up the pixel height of each such display line as
+ * we go along. The final total is, therefore, the height of the logical
+ * line.
+ */
+
+ displayLines = 0;
+ mergedLines = 0;
+
+ while (1) {
+ int bytes, height, logicalLines;
+
+ /*
+ * Currently this call doesn't have many side-effects. However, if in
+ * the future we change the code so there are side-effects (such as
+ * adjusting linePtr->pixelHeight), then the code might not quite work
+ * as intended, specifically the 'linePtr->pixelHeight == pixelHeight'
+ * test below this while loop.
+ */
+
+ height = CalculateDisplayLineHeight(textPtr, indexPtr, &bytes,
+ &logicalLines);
+
+ if (height > 0) {
+ pixelHeight += height;
+ displayLines++;
+ }
+
+ mergedLines += logicalLines;
+
+ if (TkTextIndexForwBytes(textPtr, indexPtr, bytes, indexPtr)) {
+ break;
+ }
+
+ if (logicalLines == 0) {
+ if (indexPtr->linePtr != linePtr) {
+ /*
+ * If we reached the end of the logical line, then either way
+ * we don't have a partial calculation.
+ */
+
+ partialCalc = 0;
+ break;
+ }
+ } else if (indexPtr->byteIndex != 0) {
+ /*
+ * We must still be on the same wrapped line.
+ */
+ } else {
+ /*
+ * Must check if indexPtr is really a new logical line which is
+ * not merged with the previous line. The only code that would
+ * really know this is LayoutDLine, which doesn't pass the
+ * information on, so we have to check manually here.
+ */
+
+ TkTextIndex idx;
+
+ TkTextIndexBackChars(textPtr, indexPtr, 1, &idx, COUNT_INDICES);
+ if (!TkTextIsElided(textPtr, &idx, NULL)) {
+ /*
+ * We've ended a logical line.
+ */
+
+ partialCalc = 0;
+ break;
+ }
+
+ /*
+ * We must still be on the same wrapped line.
+ */
+ }
+ if (partialCalc && displayLines > 50 && mergedLines == 0) {
+ /*
+ * Only calculate 50 display lines at a time, to avoid huge
+ * delays. In any case it is very rare that a single line wraps 50
+ * times!
+ *
+ * If we have any merged lines, we must complete the full logical
+ * line layout here and now, because the partial-calculation code
+ * isn't designed to handle merged logical lines. Hence the
+ * 'mergedLines == 0' check.
+ */
+
+ break;
+ }
+ }
+
+ if (!partialCalc) {
+ int changed = 0;
+
+ /*
+ * Cancel any partial line height calculation state.
+ */
+
+ textPtr->dInfoPtr->metricEpoch = -1;
+
+ /*
+ * Mark the logical line as being up to date (caution: it isn't yet up
+ * to date, that will happen in TkBTreeAdjustPixelHeight just below).
+ */
+
+ TkBTreeLinePixelEpoch(textPtr, linePtr)
+ = textPtr->dInfoPtr->lineMetricUpdateEpoch;
+ if (TkBTreeLinePixelCount(textPtr, linePtr) != pixelHeight) {
+ changed = 1;
+ }
+
+ if (mergedLines > 0) {
+ int i = mergedLines;
+ TkTextLine *mergedLinePtr;
+
+ /*
+ * Loop over all merged logical lines, marking them up to date
+ * (again, the pixel count setting will actually happen in
+ * TkBTreeAdjustPixelHeight).
+ */
+
+ mergedLinePtr = linePtr;
+ while (i-- > 0) {
+ mergedLinePtr = TkBTreeNextLine(textPtr, mergedLinePtr);
+ TkBTreeLinePixelEpoch(textPtr, mergedLinePtr)
+ = textPtr->dInfoPtr->lineMetricUpdateEpoch;
+ if (TkBTreeLinePixelCount(textPtr, mergedLinePtr) != 0) {
+ changed = 1;
+ }
+ }
+ }
+
+ if (!changed) {
+ /*
+ * If there's nothing to change, then we can already return.
+ */
+
+ return displayLines;
+ }
+ }
+
+ /*
+ * We set the line's height, but the return value is now the height of the
+ * entire widget, which may be used just below for reporting/debugging
+ * purposes.
+ */
+
+ pixelHeight = TkBTreeAdjustPixelHeight(textPtr, linePtr, pixelHeight,
+ mergedLines);
+
+ if (tkTextDebug) {
+ char buffer[2 * TCL_INTEGER_SPACE + 1];
+
+ if (TkBTreeNextLine(textPtr, linePtr) == NULL) {
+ Tcl_Panic("Mustn't ever update line height of last artificial line");
+ }
+
+ sprintf(buffer, "%d %d", TkBTreeLinesTo(textPtr,linePtr), pixelHeight);
+ LOG("tk_textNumPixels", buffer);
+ }
+ if (textPtr->dInfoPtr->scrollbarTimer == NULL) {
+ textPtr->refCount++;
+ textPtr->dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200,
+ AsyncUpdateYScrollbar, (ClientData) textPtr);
+ }
+ return displayLines;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* DisplayText --
*
- * This procedure is invoked as a when-idle handler to update the
- * display. It only redisplays the parts of the text widget that
- * are out of date.
+ * This function is invoked as a when-idle handler to update the display.
+ * It only redisplays the parts of the text widget that are out of date.
*
* Results:
* None.
@@ -2204,24 +3882,22 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
*/
static void
-DisplayText(clientData)
- ClientData clientData; /* Information about widget. */
+DisplayText(
+ ClientData clientData) /* Information about widget. */
{
register TkText *textPtr = (TkText *) clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- Tk_Window tkwin;
register DLine *dlPtr;
DLine *prevPtr;
Pixmap pixmap;
int maxHeight, borders;
- int bottomY = 0; /* Initialization needed only to stop
- * compiler warnings. */
+ int bottomY = 0; /* Initialization needed only to stop compiler
+ * warnings. */
Tcl_Interp *interp;
- if (textPtr->tkwin == NULL) {
-
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
- * The widget has been deleted. Don't do anything.
+ * The widget has been deleted. Don't do anything.
*/
return;
@@ -2231,17 +3907,15 @@ DisplayText(clientData)
Tcl_Preserve((ClientData) interp);
if (tkTextDebug) {
- Tcl_SetVar2(interp, "tk_textRelayout", (char *) NULL, "",
- TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tk_textRelayout", NULL, "", TCL_GLOBAL_ONLY);
}
- if (textPtr->tkwin == NULL) {
-
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
- * The widget has been deleted. Don't do anything.
+ * The widget has been deleted. Don't do anything.
*/
- goto end;
+ goto end;
}
if (!Tk_IsMapped(textPtr->tkwin) || (dInfoPtr->maxX <= dInfoPtr->x)
@@ -2252,34 +3926,34 @@ DisplayText(clientData)
}
numRedisplays++;
if (tkTextDebug) {
- Tcl_SetVar2(interp, "tk_textRedraw", (char *) NULL, "",
- TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tk_textRedraw", NULL, "", TCL_GLOBAL_ONLY);
}
- if (textPtr->tkwin == NULL) {
-
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
- * The widget has been deleted. Don't do anything.
+ * The widget has been deleted. Don't do anything.
*/
goto end;
}
/*
- * Choose a new current item if that is needed (this could cause
- * event handlers to be invoked, hence the preserve/release calls
- * and the loop, since the handlers could conceivably necessitate
- * yet another current item calculation). The tkwin check is because
- * the whole window could go away in the Tcl_Release call.
+ * Choose a new current item if that is needed (this could cause event
+ * handlers to be invoked, hence the preserve/release calls and the loop,
+ * since the handlers could conceivably necessitate yet another current
+ * item calculation). The tkwin check is because the whole window could go
+ * away in the Tcl_Release call.
*/
while (dInfoPtr->flags & REPICK_NEEDED) {
- Tcl_Preserve((ClientData) textPtr);
+ textPtr->refCount++;
dInfoPtr->flags &= ~REPICK_NEEDED;
TkTextPickCurrent(textPtr, &textPtr->pickEvent);
- tkwin = textPtr->tkwin;
- Tcl_Release((ClientData) textPtr);
- if (tkwin == NULL) {
+ if (--textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
+ goto end;
+ }
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
goto end;
}
}
@@ -2292,8 +3966,11 @@ DisplayText(clientData)
dInfoPtr->dLinesInvalidated = 0;
/*
- * See if it's possible to bring some parts of the screen up-to-date
- * by scrolling (copying from other parts of the screen).
+ * See if it's possible to bring some parts of the screen up-to-date by
+ * scrolling (copying from other parts of the screen). We have to be
+ * particularly careful with the top and bottom lines of the display,
+ * since these may only be partially visible and therefore not helpful for
+ * some scrolling purposes.
*/
for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) {
@@ -2301,15 +3978,37 @@ DisplayText(clientData)
int offset, height, y, oldY;
TkRegion damageRgn;
- if ((dlPtr->oldY == -1) || (dlPtr->y == dlPtr->oldY)
- || ((dlPtr->oldY + dlPtr->height) > dInfoPtr->maxY)) {
+ /*
+ * These tests are, in order:
+ *
+ * 1. If the line is already marked as invalid
+ * 2. If the line hasn't moved
+ * 3. If the line overlaps the bottom of the window and we are
+ * scrolling up.
+ * 4. If the line overlaps the top of the window and we are scrolling
+ * down.
+ *
+ * If any of these tests are true, then we can't scroll this line's
+ * part of the display.
+ *
+ * Note that even if tests 3 or 4 aren't true, we may be able to
+ * scroll the line, but we still need to be sure to call embedded
+ * window display procs on top and bottom lines if they have any
+ * portion non-visible (see below).
+ */
+
+ if ((dlPtr->flags & OLD_Y_INVALID)
+ || (dlPtr->y == dlPtr->oldY)
+ || (((dlPtr->oldY + dlPtr->height) > dInfoPtr->maxY)
+ && (dlPtr->y < dlPtr->oldY))
+ || ((dlPtr->oldY < dInfoPtr->y) && (dlPtr->y > dlPtr->oldY))) {
continue;
}
/*
- * This line is already drawn somewhere in the window so it only
- * needs to be copied to its new location. See if there's a group
- * of lines that can all be copied together.
+ * This line is already drawn somewhere in the window so it only needs
+ * to be copied to its new location. See if there's a group of lines
+ * that can all be copied together.
*/
offset = dlPtr->y - dlPtr->oldY;
@@ -2317,7 +4016,7 @@ DisplayText(clientData)
y = dlPtr->y;
for (dlPtr2 = dlPtr->nextPtr; dlPtr2 != NULL;
dlPtr2 = dlPtr2->nextPtr) {
- if ((dlPtr2->oldY == -1)
+ if ((dlPtr2->flags & OLD_Y_INVALID)
|| ((dlPtr2->oldY + offset) != dlPtr2->y)
|| ((dlPtr2->oldY + dlPtr2->height) > dInfoPtr->maxY)) {
break;
@@ -2326,21 +4025,36 @@ DisplayText(clientData)
}
/*
- * Reduce the height of the area being copied if necessary to
- * avoid overwriting the border area.
+ * Reduce the height of the area being copied if necessary to avoid
+ * overwriting the border area.
*/
if ((y + height) > dInfoPtr->maxY) {
height = dInfoPtr->maxY -y;
}
oldY = dlPtr->oldY;
+ if (y < dInfoPtr->y) {
+ /*
+ * Adjust if the area being copied is going to overwrite the top
+ * border of the window (so the top line is only half onscreen).
+ */
+
+ int y_off = dInfoPtr->y - dlPtr->y;
+ height -= y_off;
+ oldY += y_off;
+ y = dInfoPtr->y;
+ }
/*
- * Update the lines we are going to scroll to show that they
- * have been copied.
+ * Update the lines we are going to scroll to show that they have been
+ * copied.
*/
while (1) {
+ /*
+ * The DLine already has OLD_Y_INVALID cleared.
+ */
+
dlPtr->oldY = dlPtr->y;
if (dlPtr->nextPtr == dlPtr2) {
break;
@@ -2349,30 +4063,28 @@ DisplayText(clientData)
}
/*
- * Scan through the lines following the copied ones to see if
- * we are going to overwrite them with the copy operation.
- * If so, mark them for redisplay.
+ * Scan through the lines following the copied ones to see if we are
+ * going to overwrite them with the copy operation. If so, mark them
+ * for redisplay.
*/
for ( ; dlPtr2 != NULL; dlPtr2 = dlPtr2->nextPtr) {
- if ((dlPtr2->oldY != -1)
+ if ((!(dlPtr2->flags & OLD_Y_INVALID))
&& ((dlPtr2->oldY + dlPtr2->height) > y)
&& (dlPtr2->oldY < (y + height))) {
- dlPtr2->oldY = -1;
+ dlPtr2->flags |= OLD_Y_INVALID;
}
}
/*
- * Now scroll the lines. This may generate damage which we
- * handle by calling TextInvalidateRegion to mark the display
- * blocks as stale.
+ * Now scroll the lines. This may generate damage which we handle by
+ * calling TextInvalidateRegion to mark the display blocks as stale.
*/
damageRgn = TkCreateRegion();
- if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC,
- dInfoPtr->x, oldY,
- (dInfoPtr->maxX - dInfoPtr->x), height,
- 0, y - oldY, damageRgn)) {
+ if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x,
+ oldY, dInfoPtr->maxX-dInfoPtr->x, height, 0, y-oldY,
+ damageRgn)) {
TextInvalidateRegion(textPtr, damageRgn);
}
numCopies++;
@@ -2380,14 +4092,13 @@ DisplayText(clientData)
}
/*
- * Clear the REDRAW_PENDING flag here. This is actually pretty
- * tricky. We want to wait until *after* doing the scrolling,
- * since that could generate more areas to redraw and don't
- * want to reschedule a redisplay for them. On the other hand,
- * we can't wait until after all the redisplaying, because the
- * act of redisplaying could actually generate more redisplays
- * (e.g. in the case of a nested window with event bindings triggered
- * by redisplay).
+ * Clear the REDRAW_PENDING flag here. This is actually pretty tricky. We
+ * want to wait until *after* doing the scrolling, since that could
+ * generate more areas to redraw and don't want to reschedule a redisplay
+ * for them. On the other hand, we can't wait until after all the
+ * redisplaying, because the act of redisplaying could actually generate
+ * more redisplays (e.g. in the case of a nested window with event
+ * bindings triggered by redisplay).
*/
dInfoPtr->flags &= ~REDRAW_PENDING;
@@ -2398,18 +4109,16 @@ DisplayText(clientData)
if (dInfoPtr->flags & REDRAW_BORDERS) {
if (tkTextDebug) {
- Tcl_SetVar2(interp, "tk_textRedraw", (char *) NULL, "borders",
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textRedraw", "borders");
}
- if (textPtr->tkwin == NULL) {
-
+ if (textPtr->tkwin == NULL) {
/*
- * The widget has been deleted. Don't do anything.
- */
+ * The widget has been deleted. Don't do anything.
+ */
- goto end;
- }
+ goto end;
+ }
Tk_Draw3DRectangle(textPtr->tkwin, Tk_WindowId(textPtr->tkwin),
textPtr->border, textPtr->highlightWidth,
@@ -2419,17 +4128,17 @@ DisplayText(clientData)
textPtr->borderWidth, textPtr->relief);
if (textPtr->highlightWidth != 0) {
GC fgGC, bgGC;
-
+
bgGC = Tk_GCForColor(textPtr->highlightBgColorPtr,
- Tk_WindowId(textPtr->tkwin));
+ Tk_WindowId(textPtr->tkwin));
if (textPtr->flags & GOT_FOCUS) {
fgGC = Tk_GCForColor(textPtr->highlightColorPtr,
Tk_WindowId(textPtr->tkwin));
- TkpDrawHighlightBorder(textPtr->tkwin, fgGC, bgGC,
- textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin));
+ TkpDrawHighlightBorder(textPtr->tkwin, fgGC, bgGC,
+ textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin));
} else {
- TkpDrawHighlightBorder(textPtr->tkwin, bgGC, bgGC,
- textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin));
+ TkpDrawHighlightBorder(textPtr->tkwin, bgGC, bgGC,
+ textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin));
}
}
borders = textPtr->borderWidth + textPtr->highlightWidth;
@@ -2461,23 +4170,33 @@ DisplayText(clientData)
}
/*
- * Now we have to redraw the lines that couldn't be updated by
- * scrolling. First, compute the height of the largest line and
- * allocate an off-screen pixmap to use for double-buffered
- * displays.
+ * Now we have to redraw the lines that couldn't be updated by scrolling.
+ * First, compute the height of the largest line and allocate an off-
+ * screen pixmap to use for double-buffered displays.
*/
maxHeight = -1;
for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL;
dlPtr = dlPtr->nextPtr) {
- if ((dlPtr->height > maxHeight) && (dlPtr->oldY != dlPtr->y)) {
+ if ((dlPtr->height > maxHeight) &&
+ ((dlPtr->flags&OLD_Y_INVALID) || (dlPtr->oldY != dlPtr->y))) {
maxHeight = dlPtr->height;
}
bottomY = dlPtr->y + dlPtr->height;
}
- if (maxHeight > dInfoPtr->maxY) {
- maxHeight = dInfoPtr->maxY;
+
+ /*
+ * There used to be a line here which restricted 'maxHeight' to be no
+ * larger than 'dInfoPtr->maxY', but this is incorrect for the case where
+ * individual lines may be taller than the widget _and_ we have smooth
+ * scrolling. What we can do is restrict maxHeight to be no larger than
+ * 'dInfoPtr->maxY + dInfoPtr->topPixelOffset'.
+ */
+
+ if (maxHeight > (dInfoPtr->maxY + dInfoPtr->topPixelOffset)) {
+ maxHeight = (dInfoPtr->maxY + dInfoPtr->topPixelOffset);
}
+
if (maxHeight > 0) {
#ifndef TK_NO_DOUBLE_BUFFERING
pixmap = Tk_GetPixmap(Tk_Display(textPtr->tkwin),
@@ -2489,14 +4208,15 @@ DisplayText(clientData)
for (prevPtr = NULL, dlPtr = textPtr->dInfoPtr->dLinePtr;
(dlPtr != NULL) && (dlPtr->y < dInfoPtr->maxY);
prevPtr = dlPtr, dlPtr = dlPtr->nextPtr) {
- if (dlPtr->chunkPtr == NULL) continue;
- if (dlPtr->oldY != dlPtr->y) {
+ if (dlPtr->chunkPtr == NULL) {
+ continue;
+ }
+ if ((dlPtr->flags & OLD_Y_INVALID) || dlPtr->oldY != dlPtr->y) {
if (tkTextDebug) {
char string[TK_POS_CHARS];
- TkTextPrintIndex(&dlPtr->index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textRedraw",
- (char *) NULL, string,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+
+ TkTextPrintIndex(textPtr, &dlPtr->index, string);
+ LOG("tk_textRedraw", string);
}
DisplayDLine(textPtr, dlPtr, prevPtr, pixmap);
if (dInfoPtr->dLinesInvalidated) {
@@ -2506,9 +4226,55 @@ DisplayText(clientData)
return;
}
dlPtr->oldY = dlPtr->y;
- dlPtr->flags &= ~NEW_LAYOUT;
+ dlPtr->flags &= ~(NEW_LAYOUT | OLD_Y_INVALID);
+ } else if (dlPtr->chunkPtr != NULL && ((dlPtr->y < 0)
+ || (dlPtr->y + dlPtr->height > dInfoPtr->maxY))) {
+ register TkTextDispChunk *chunkPtr;
+
+ /*
+ * It's the first or last DLine which are also overlapping the
+ * top or bottom of the window, but we decided above it wasn't
+ * necessary to display them (we were able to update them by
+ * scrolling). This is fine, except that if the lines contain
+ * any embedded windows, we must still call the display proc
+ * on them because they might need to be unmapped or they
+ * might need to be moved to reflect their new position.
+ * Otherwise, everything else moves, but the embedded window
+ * doesn't!
+ *
+ * So, we loop through all the chunks, calling the display
+ * proc of embedded windows only.
+ */
+
+ for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL);
+ chunkPtr = chunkPtr->nextPtr) {
+ int x;
+ if (chunkPtr->displayProc != TkTextEmbWinDisplayProc) {
+ continue;
+ }
+ x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset;
+ if ((x + chunkPtr->width <= 0) || (x >= dInfoPtr->maxX)) {
+ /*
+ * Note: we have to call the displayProc even for
+ * chunks that are off-screen. This is needed, for
+ * example, so that embedded windows can be unmapped
+ * in this case. Display the chunk at a coordinate
+ * that can be clearly identified by the displayProc
+ * as being off-screen to the left (the displayProc
+ * may not be able to tell if something is off to the
+ * right).
+ */
+
+ x = -chunkPtr->width;
+ }
+ TkTextEmbWinDisplayProc(textPtr, chunkPtr, x,
+ dlPtr->spaceAbove,
+ dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow,
+ dlPtr->baseline - dlPtr->spaceAbove, NULL,
+ (Drawable) None, dlPtr->y + dlPtr->spaceAbove);
+ }
+
}
- /*prevPtr = dlPtr;*/
}
#ifndef TK_NO_DOUBLE_BUFFERING
Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap);
@@ -2516,10 +4282,10 @@ DisplayText(clientData)
}
/*
- * See if we need to refresh the part of the window below the
- * last line of text (if there is any such area). Refresh the
- * padding area on the left too, since the insertion cursor might
- * have been displayed there previously).
+ * See if we need to refresh the part of the window below the last line of
+ * text (if there is any such area). Refresh the padding area on the left
+ * too, since the insertion cursor might have been displayed there
+ * previously).
*/
if (dInfoPtr->topOfEof > dInfoPtr->maxY) {
@@ -2527,19 +4293,16 @@ DisplayText(clientData)
}
if (bottomY < dInfoPtr->topOfEof) {
if (tkTextDebug) {
- Tcl_SetVar2(textPtr->interp, "tk_textRedraw",
- (char *) NULL, "eof",
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textRedraw", "eof");
}
- if (textPtr->tkwin == NULL) {
-
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
- * The widget has been deleted. Don't do anything.
- */
+ * The widget has been deleted. Don't do anything.
+ */
- goto end;
- }
+ goto end;
+ }
Tk_Fill3DRectangle(textPtr->tkwin, Tk_WindowId(textPtr->tkwin),
textPtr->border, dInfoPtr->x - textPtr->padX, bottomY,
@@ -2548,28 +4311,26 @@ DisplayText(clientData)
}
dInfoPtr->topOfEof = bottomY;
- doScrollbars:
-
/*
- * Update the vertical scrollbar, if there is one. Note: it's
- * important to clear REDRAW_PENDING here, just in case the
- * scroll procedure does something that requires redisplay.
+ * Update the vertical scrollbar, if there is one. Note: it's important to
+ * clear REDRAW_PENDING here, just in case the scroll function does
+ * something that requires redisplay.
*/
-
+
+ doScrollbars:
if (textPtr->flags & UPDATE_SCROLLBARS) {
textPtr->flags &= ~UPDATE_SCROLLBARS;
if (textPtr->yScrollCmd != NULL) {
GetYView(textPtr->interp, textPtr, 1);
}
- if (textPtr->tkwin == NULL) {
-
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
- * The widget has been deleted. Don't do anything.
- */
+ * The widget has been deleted. Don't do anything.
+ */
- goto end;
- }
+ goto end;
+ }
/*
* Update the horizontal scrollbar, if any.
@@ -2580,7 +4341,7 @@ DisplayText(clientData)
}
}
-end:
+ end:
Tcl_Release((ClientData) interp);
}
@@ -2589,9 +4350,8 @@ end:
*
* TkTextEventuallyRepick --
*
- * This procedure is invoked whenever something happens that
- * could change the current character or the tags associated
- * with it.
+ * This function is invoked whenever something happens that could change
+ * the current character or the tags associated with it.
*
* Results:
* None.
@@ -2602,10 +4362,9 @@ end:
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
-TkTextEventuallyRepick(textPtr)
- TkText *textPtr; /* Widget record for text widget. */
+TkTextEventuallyRepick(
+ TkText *textPtr) /* Widget record for text widget. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -2621,9 +4380,9 @@ TkTextEventuallyRepick(textPtr)
*
* TkTextRedrawRegion --
*
- * This procedure is invoked to schedule a redisplay for a given
- * region of a text widget. The redisplay itself may not occur
- * immediately: it's scheduled as a when-idle handler.
+ * This function is invoked to schedule a redisplay for a given region of
+ * a text widget. The redisplay itself may not occur immediately: it's
+ * scheduled as a when-idle handler.
*
* Results:
* None.
@@ -2634,14 +4393,13 @@ TkTextEventuallyRepick(textPtr)
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
-TkTextRedrawRegion(textPtr, x, y, width, height)
- TkText *textPtr; /* Widget record for text widget. */
- int x, y; /* Coordinates of upper-left corner of area
- * to be redrawn, in pixels relative to
- * textPtr's window. */
- int width, height; /* Width and height of area to be redrawn. */
+TkTextRedrawRegion(
+ TkText *textPtr, /* Widget record for text widget. */
+ int x, int y, /* Coordinates of upper-left corner of area to
+ * be redrawn, in pixels relative to textPtr's
+ * window. */
+ int width, int height) /* Width and height of area to be redrawn. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
TkRegion damageRgn = TkCreateRegion();
@@ -2679,9 +4437,9 @@ TkTextRedrawRegion(textPtr, x, y, width, height)
*/
static void
-TextInvalidateRegion(textPtr, region)
- TkText *textPtr; /* Widget record for text widget. */
- TkRegion region; /* Region of area to redraw. */
+TextInvalidateRegion(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkRegion region) /* Region of area to redraw. */
{
register DLine *dlPtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -2697,9 +4455,10 @@ TextInvalidateRegion(textPtr, region)
maxY = rect.y + rect.height;
for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL;
dlPtr = dlPtr->nextPtr) {
- if ((dlPtr->oldY != -1) && (TkRectInRegion(region, rect.x, dlPtr->y,
+ if ((!(dlPtr->flags & OLD_Y_INVALID))
+ && (TkRectInRegion(region, rect.x, dlPtr->y,
rect.width, (unsigned int) dlPtr->height) != RectangleOut)) {
- dlPtr->oldY = -1;
+ dlPtr->flags |= OLD_Y_INVALID;
}
}
if (dInfoPtr->topOfEof < maxY) {
@@ -2707,8 +4466,7 @@ TextInvalidateRegion(textPtr, region)
}
/*
- * Schedule the redisplay operation if there isn't one already
- * scheduled.
+ * Schedule the redisplay operation if there isn't one already scheduled.
*/
inset = textPtr->borderWidth + textPtr->highlightWidth;
@@ -2724,32 +4482,54 @@ TextInvalidateRegion(textPtr, region)
/*
*----------------------------------------------------------------------
*
- * TkTextChanged --
+ * TkTextChanged, TextChanged --
*
- * This procedure is invoked when info in a text widget is about
- * to be modified in a way that changes how it is displayed (e.g.
- * characters were inserted or deleted, or tag information was
- * changed). This procedure must be called *before* a change is
- * made, so that indexes in the display information are still
- * valid.
+ * This function is invoked when info in a text widget is about to be
+ * modified in a way that changes how it is displayed (e.g. characters
+ * were inserted or deleted, or tag information was changed). This
+ * function must be called *before* a change is made, so that indexes in
+ * the display information are still valid.
+ *
+ * Note: if the range of indices may change geometry as well as simply
+ * requiring redisplay, then the caller should also call
+ * TkTextInvalidateLineMetrics.
*
* Results:
* None.
*
* Side effects:
- * The range of character between index1Ptr (inclusive) and
- * index2Ptr (exclusive) will be redisplayed at some point in the
- * future (the actual redisplay is scheduled as a when-idle handler).
+ * The range of character between index1Ptr (inclusive) and index2Ptr
+ * (exclusive) will be redisplayed at some point in the future (the
+ * actual redisplay is scheduled as a when-idle handler).
*
*----------------------------------------------------------------------
*/
void
-TkTextChanged(textPtr, index1Ptr, index2Ptr)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *index1Ptr; /* Index of first character to redisplay. */
- TkTextIndex *index2Ptr; /* Index of character just after last one
- * to redisplay. */
+TkTextChanged(
+ TkSharedText *sharedTextPtr,/* Shared widget section, or NULL. */
+ TkText *textPtr, /* Widget record for text widget, or NULL. */
+ CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
+ CONST TkTextIndex*index2Ptr)/* Index of character just after last one to
+ * redisplay. */
+{
+ if (sharedTextPtr == NULL) {
+ TextChanged(textPtr, index1Ptr, index2Ptr);
+ } else {
+ textPtr = sharedTextPtr->peers;
+ while (textPtr != NULL) {
+ TextChanged(textPtr, index1Ptr, index2Ptr);
+ textPtr = textPtr->next;
+ }
+ }
+}
+
+static void
+TextChanged(
+ TkText *textPtr, /* Widget record for text widget, or NULL. */
+ CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
+ CONST TkTextIndex*index2Ptr)/* Index of character just after last one to
+ * redisplay. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *firstPtr, *lastPtr;
@@ -2757,18 +4537,18 @@ TkTextChanged(textPtr, index1Ptr, index2Ptr)
/*
* Schedule both a redisplay and a recomputation of display information.
- * It's done here rather than the end of the procedure for two reasons:
+ * It's done here rather than the end of the function for two reasons:
*
* 1. If there are no display lines to update we'll want to return
- * immediately, well before the end of the procedure.
+ * immediately, well before the end of the function.
* 2. It's important to arrange for the redisplay BEFORE calling
- * FreeDLines. The reason for this is subtle and has to do with
- * embedded windows. The chunk delete procedure for an embedded
- * window will schedule an idle handler to unmap the window.
- * However, we want the idle handler for redisplay to be called
- * first, so that it can put the embedded window back on the screen
- * again (if appropriate). This will prevent the window from ever
- * being unmapped, and thereby avoid flashing.
+ * FreeDLines. The reason for this is subtle and has to do with
+ * embedded windows. The chunk delete function for an embedded window
+ * will schedule an idle handler to unmap the window. However, we want
+ * the idle handler for redisplay to be called first, so that it can
+ * put the embedded window back on the screen again (if appropriate).
+ * This will prevent the window from ever being unmapped, and thereby
+ * avoid flashing.
*/
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
@@ -2777,13 +4557,13 @@ TkTextChanged(textPtr, index1Ptr, index2Ptr)
dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
/*
- * Find the DLines corresponding to index1Ptr and index2Ptr. There
- * is one tricky thing here, which is that we have to relayout in
- * units of whole text lines: round index1Ptr back to the beginning
- * of its text line, and include all the display lines after index2,
- * up to the end of its text line. This is necessary because the
- * indices stored in the display lines will no longer be valid. It's
- * also needed because any edit could change the way lines wrap.
+ * Find the DLines corresponding to index1Ptr and index2Ptr. There is one
+ * tricky thing here, which is that we have to relayout in units of whole
+ * text lines: round index1Ptr back to the beginning of its text line, and
+ * include all the display lines after index2, up to the end of its text
+ * line. This is necessary because the indices stored in the display lines
+ * will no longer be valid. It's also needed because any edit could change
+ * the way lines wrap.
*/
rounded = *index1Ptr;
@@ -2802,39 +4582,64 @@ TkTextChanged(textPtr, index1Ptr, index2Ptr)
* Delete all the DLines from firstPtr up to but not including lastPtr.
*/
- FreeDLines(textPtr, firstPtr, lastPtr, 1);
+ FreeDLines(textPtr, firstPtr, lastPtr, DLINE_UNLINK);
}
/*
*----------------------------------------------------------------------
*
- * TkTextRedrawTag --
+ * TkTextRedrawTag, TextRedrawTag --
*
- * This procedure is invoked to request a redraw of all characters
- * in a given range that have a particular tag on or off. It's
- * called, for example, when tag options change.
+ * This function is invoked to request a redraw of all characters in a
+ * given range that have a particular tag on or off. It's called, for
+ * example, when tag options change.
*
* Results:
* None.
*
* Side effects:
- * Information on the screen may be redrawn, and the layout of
- * the screen may change.
+ * Information on the screen may be redrawn, and the layout of the screen
+ * may change.
*
*----------------------------------------------------------------------
*/
void
-TkTextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *index1Ptr; /* First character in range to consider
- * for redisplay. NULL means start at
- * beginning of text. */
- TkTextIndex *index2Ptr; /* Character just after last one to consider
- * for redisplay. NULL means process all
- * the characters in the text. */
- TkTextTag *tagPtr; /* Information about tag. */
- int withTag; /* 1 means redraw characters that have the
+TkTextRedrawTag(
+ TkSharedText *sharedTextPtr,/* Shared widget section, or NULL. */
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *index1Ptr, /* First character in range to consider for
+ * redisplay. NULL means start at beginning of
+ * text. */
+ TkTextIndex *index2Ptr, /* Character just after last one to consider
+ * for redisplay. NULL means process all the
+ * characters in the text. */
+ TkTextTag *tagPtr, /* Information about tag. */
+ int withTag) /* 1 means redraw characters that have the
+ * tag, 0 means redraw those without. */
+{
+ if (sharedTextPtr == NULL) {
+ TextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag);
+ } else {
+ textPtr = sharedTextPtr->peers;
+ while (textPtr != NULL) {
+ TextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag);
+ textPtr = textPtr->next;
+ }
+ }
+}
+
+static void
+TextRedrawTag(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *index1Ptr, /* First character in range to consider for
+ * redisplay. NULL means start at beginning of
+ * text. */
+ TkTextIndex *index2Ptr, /* Character just after last one to consider
+ * for redisplay. NULL means process all the
+ * characters in the text. */
+ TkTextTag *tagPtr, /* Information about tag. */
+ int withTag) /* 1 means redraw characters that have the
* tag, 0 means redraw those without. */
{
register DLine *dlPtr;
@@ -2846,15 +4651,45 @@ TkTextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
TkTextIndex endOfText, *endIndexPtr;
/*
- * Round up the starting position if it's before the first line
- * visible on the screen (we only care about what's on the screen).
+ * Invalidate the pixel calculation of all lines in the given range. This
+ * may be a bit over-aggressive, so we could consider more subtle
+ * techniques here in the future. In particular, when we create a tag for
+ * the first time with '.t tag configure foo -font "Arial 20"', say, even
+ * though that obviously can't apply to anything at all (the tag didn't
+ * exist a moment ago), we invalidate every single line in the widget.
+ */
+
+ if (tagPtr->affectsDisplayGeometry) {
+ TkTextLine *startLine, *endLine;
+ int lineCount;
+
+ if (index2Ptr == NULL) {
+ endLine = NULL;
+ lineCount = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
+ } else {
+ endLine = index2Ptr->linePtr;
+ lineCount = TkBTreeLinesTo(textPtr, endLine);
+ }
+ if (index1Ptr == NULL) {
+ startLine = NULL;
+ } else {
+ startLine = index1Ptr->linePtr;
+ lineCount -= TkBTreeLinesTo(textPtr, startLine);
+ }
+ TkTextInvalidateLineMetrics(NULL, textPtr, startLine, lineCount,
+ TK_TEXT_INVALIDATE_ONLY);
+ }
+
+ /*
+ * Round up the starting position if it's before the first line visible on
+ * the screen (we only care about what's on the screen).
*/
dlPtr = dInfoPtr->dLinePtr;
if (dlPtr == NULL) {
return;
}
- if ((index1Ptr == NULL) || (TkTextIndexCmp(&dlPtr->index, index1Ptr) > 0)) {
+ if ((index1Ptr == NULL) || (TkTextIndexCmp(&dlPtr->index, index1Ptr)>0)) {
index1Ptr = &dlPtr->index;
}
@@ -2863,22 +4698,26 @@ TkTextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
*/
if (index2Ptr == NULL) {
- index2Ptr = TkTextMakeByteIndex(textPtr->tree,
- TkBTreeNumLines(textPtr->tree), 0, &endOfText);
+ int lastLine = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
+
+ index2Ptr = TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lastLine, 0, &endOfText);
}
- /*
- * Initialize a search through all transitions on the tag, starting
- * with the first transition where the tag's current state is different
- * from what it will eventually be.
+ /*
+ * Initialize a search through all transitions on the tag, starting with
+ * the first transition where the tag's current state is different from
+ * what it will eventually be.
*/
TkBTreeStartSearch(index1Ptr, index2Ptr, tagPtr, &search);
+
/*
- * Make our own curIndex because at this point search.curIndex
- * may not equal index1Ptr->curIndex in the case the first tag toggle
- * comes after index1Ptr (See the use of FindTagStart in TkBTreeStartSearch)
+ * Make our own curIndex because at this point search.curIndex may not
+ * equal index1Ptr->curIndex in the case the first tag toggle comes after
+ * index1Ptr (See the use of FindTagStart in TkBTreeStartSearch).
*/
+
curIndexPtr = index1Ptr;
tagOn = TkBTreeCharTagged(index1Ptr, tagPtr);
if (tagOn != withTag) {
@@ -2889,9 +4728,9 @@ TkTextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
}
/*
- * Schedule a redisplay and layout recalculation if they aren't
- * already pending. This has to be done before calling FreeDLines,
- * for the reason given in TkTextChanged.
+ * Schedule a redisplay and layout recalculation if they aren't already
+ * pending. This has to be done before calling FreeDLines, for the reason
+ * given in TkTextChanged.
*/
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
@@ -2900,21 +4739,20 @@ TkTextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
/*
- * Each loop through the loop below is for one range of characters
- * where the tag's current state is different than its eventual
- * state. At the top of the loop, search contains information about
- * the first character in the range.
+ * Each loop through the loop below is for one range of characters where
+ * the tag's current state is different than its eventual state. At the
+ * top of the loop, search contains information about the first character
+ * in the range.
*/
while (1) {
/*
- * Find the first DLine structure in the range. Note: if the
- * desired character isn't the first in its text line, then look
- * for the character just before it instead. This is needed to
- * handle the case where the first character of a wrapped
- * display line just got smaller, so that it now fits on the
- * line before: need to relayout the line containing the
- * previous character.
+ * Find the first DLine structure in the range. Note: if the desired
+ * character isn't the first in its text line, then look for the
+ * character just before it instead. This is needed to handle the case
+ * where the first character of a wrapped display line just got
+ * smaller, so that it now fits on the line before: need to relayout
+ * the line containing the previous character.
*/
if (curIndexPtr->byteIndex == 0) {
@@ -2947,11 +4785,11 @@ TkTextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
}
/*
- * Delete all of the display lines in the range, so that they'll
- * be re-layed out and redrawn.
+ * Delete all of the display lines in the range, so that they'll be
+ * re-layed out and redrawn.
*/
- FreeDLines(textPtr, dlPtr, endPtr, 1);
+ FreeDLines(textPtr, dlPtr, endPtr, DLINE_UNLINK);
dlPtr = endPtr;
/*
@@ -2969,33 +4807,35 @@ TkTextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
*
* TkTextRelayoutWindow --
*
- * This procedure is called when something has happened that
- * invalidates the whole layout of characters on the screen, such
- * as a change in a configuration option for the overall text
- * widget or a change in the window size. It causes all display
- * information to be recomputed and the window to be redrawn.
+ * This function is called when something has happened that invalidates
+ * the whole layout of characters on the screen, such as a change in a
+ * configuration option for the overall text widget or a change in the
+ * window size. It causes all display information to be recomputed and
+ * the window to be redrawn.
*
* Results:
* None.
*
* Side effects:
- * All the display information will be recomputed for the window
- * and the window will be redrawn.
+ * All the display information will be recomputed for the window and the
+ * window will be redrawn.
*
*----------------------------------------------------------------------
*/
void
-TkTextRelayoutWindow(textPtr)
- TkText *textPtr; /* Widget record for text widget. */
+TkTextRelayoutWindow(
+ TkText *textPtr, /* Widget record for text widget. */
+ int mask) /* OR'd collection of bits showing what has
+ * changed. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- GC new;
+ GC newGC;
XGCValues gcValues;
/*
- * Schedule the window redisplay. See TkTextChanged for the
- * reason why this has to be done before any calls to FreeDLines.
+ * Schedule the window redisplay. See TkTextChanged for the reason why
+ * this has to be done before any calls to FreeDLines.
*/
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
@@ -3005,28 +4845,27 @@ TkTextRelayoutWindow(textPtr)
|REPICK_NEEDED;
/*
- * (Re-)create the graphics context for drawing the traversal
- * highlight.
+ * (Re-)create the graphics context for drawing the traversal highlight.
*/
gcValues.graphics_exposures = False;
- new = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues);
+ newGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues);
if (dInfoPtr->copyGC != None) {
Tk_FreeGC(textPtr->display, dInfoPtr->copyGC);
}
- dInfoPtr->copyGC = new;
+ dInfoPtr->copyGC = newGC;
/*
* Throw away all the current layout information.
*/
- FreeDLines(textPtr, dInfoPtr->dLinePtr, (DLine *) NULL, 1);
+ FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK);
dInfoPtr->dLinePtr = NULL;
/*
- * Recompute some overall things for the layout. Even if the
- * window gets very small, pretend that there's at least one
- * pixel of drawing space in it.
+ * Recompute some overall things for the layout. Even if the window gets
+ * very small, pretend that there's at least one pixel of drawing space in
+ * it.
*/
if (textPtr->highlightWidth < 0) {
@@ -3041,6 +4880,11 @@ TkTextRelayoutWindow(textPtr)
if (dInfoPtr->maxX <= dInfoPtr->x) {
dInfoPtr->maxX = dInfoPtr->x + 1;
}
+
+ /*
+ * This is the only place where dInfoPtr->maxY is set.
+ */
+
dInfoPtr->maxY = Tk_Height(textPtr->tkwin) - textPtr->highlightWidth
- textPtr->borderWidth - textPtr->padY;
if (dInfoPtr->maxY <= dInfoPtr->y) {
@@ -3049,22 +4893,50 @@ TkTextRelayoutWindow(textPtr)
dInfoPtr->topOfEof = dInfoPtr->maxY;
/*
- * If the upper-left character isn't the first in a line, recompute
- * it. This is necessary because a change in the window's size
- * or options could change the way lines wrap.
+ * If the upper-left character isn't the first in a line, recompute it.
+ * This is necessary because a change in the window's size or options
+ * could change the way lines wrap.
*/
if (textPtr->topIndex.byteIndex != 0) {
- MeasureUp(textPtr, &textPtr->topIndex, 0, &textPtr->topIndex);
+ TkTextFindDisplayLineEnd(textPtr, &textPtr->topIndex, 0, NULL);
}
/*
- * Invalidate cached scrollbar positions, so that scrollbars
- * sliders will be udpated.
+ * Invalidate cached scrollbar positions, so that scrollbars sliders will
+ * be udpated.
*/
dInfoPtr->xScrollFirst = dInfoPtr->xScrollLast = -1;
dInfoPtr->yScrollFirst = dInfoPtr->yScrollLast = -1;
+
+ if (mask & TK_TEXT_LINE_GEOMETRY) {
+ /*
+ * Set up line metric recalculation.
+ *
+ * Avoid the special zero value, since that is used to mark individual
+ * lines as being out of date.
+ */
+
+ if ((++dInfoPtr->lineMetricUpdateEpoch) == 0) {
+ dInfoPtr->lineMetricUpdateEpoch++;
+ }
+
+ dInfoPtr->currentMetricUpdateLine = -1;
+
+ /*
+ * Also cancel any partial line-height calculations (for long-wrapped
+ * lines) in progress.
+ */
+
+ dInfoPtr->metricEpoch = -1;
+
+ if (dInfoPtr->lineUpdateTimer == NULL) {
+ textPtr->refCount++;
+ dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
+ AsyncUpdateLineMetrics, (ClientData) textPtr);
+ }
+ }
}
/*
@@ -3072,68 +4944,84 @@ TkTextRelayoutWindow(textPtr)
*
* TkTextSetYView --
*
- * This procedure is called to specify what lines are to be
- * displayed in a text widget.
+ * This function is called to specify what lines are to be displayed in a
+ * text widget.
*
* Results:
* None.
*
* Side effects:
- * The display will (eventually) be updated so that the position
- * given by "indexPtr" is visible on the screen at the position
- * determined by "pickPlace".
+ * The display will (eventually) be updated so that the position given by
+ * "indexPtr" is visible on the screen at the position determined by
+ * "pickPlace".
*
*----------------------------------------------------------------------
*/
void
-TkTextSetYView(textPtr, indexPtr, pickPlace)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *indexPtr; /* Position that is to appear somewhere
- * in the view. */
- int pickPlace; /* 0 means topLine must appear at top of
- * screen. 1 means we get to pick where it
- * appears: minimize screen motion or else
- * display line at center of screen. */
+TkTextSetYView(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *indexPtr, /* Position that is to appear somewhere in the
+ * view. */
+ int pickPlace) /* 0 means the given index must appear exactly
+ * at the top of the screen. TK_TEXT_PICKPLACE
+ * (-1) means we get to pick where it appears:
+ * minimize screen motion or else display line
+ * at center of screen. TK_TEXT_NOPIXELADJUST
+ * (-2) indicates to make the given index the
+ * top line, but if it is already the top
+ * line, don't nudge it up or down by a few
+ * pixels just to make sure it is entirely
+ * displayed. Positive numbers indicate the
+ * number of pixels of the index's line which
+ * are to be off the top of the screen. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
register DLine *dlPtr;
int bottomY, close, lineIndex;
TkTextIndex tmpIndex, rounded;
- Tk_FontMetrics fm;
+ int lineHeight;
/*
- * If the specified position is the extra line at the end of the
- * text, round it back to the last real line.
+ * If the specified position is the extra line at the end of the text,
+ * round it back to the last real line.
*/
- lineIndex = TkBTreeLineIndex(indexPtr->linePtr);
- if (lineIndex == TkBTreeNumLines(indexPtr->tree)) {
- TkTextIndexBackChars(indexPtr, 1, &rounded);
+ lineIndex = TkBTreeLinesTo(textPtr, indexPtr->linePtr);
+ if (lineIndex == TkBTreeNumLines(indexPtr->tree, textPtr)) {
+ TkTextIndexBackChars(textPtr, indexPtr, 1, &rounded, COUNT_INDICES);
indexPtr = &rounded;
}
- if (!pickPlace) {
+ if (pickPlace == TK_TEXT_NOPIXELADJUST) {
+ if (textPtr->topIndex.linePtr == indexPtr->linePtr
+ && textPtr->topIndex.byteIndex == indexPtr->byteIndex) {
+ pickPlace = dInfoPtr->topPixelOffset;
+ } else {
+ pickPlace = 0;
+ }
+ }
+
+ if (pickPlace != TK_TEXT_PICKPLACE) {
/*
- * The specified position must go at the top of the screen.
- * Just leave all the DLine's alone: we may be able to reuse
- * some of the information that's currently on the screen
- * without redisplaying it all.
+ * The specified position must go at the top of the screen. Just leave
+ * all the DLine's alone: we may be able to reuse some of the
+ * information that's currently on the screen without redisplaying it
+ * all.
*/
- if (indexPtr->byteIndex == 0) {
- textPtr->topIndex = *indexPtr;
- } else {
- MeasureUp(textPtr, indexPtr, 0, &textPtr->topIndex);
+ textPtr->topIndex = *indexPtr;
+ if (indexPtr->byteIndex != 0) {
+ TkTextFindDisplayLineEnd(textPtr, &textPtr->topIndex, 0, NULL);
}
+ dInfoPtr->newTopPixelOffset = pickPlace;
goto scheduleUpdate;
}
/*
- * We have to pick where to display the index. First, bring
- * the display information up to date and see if the index will be
- * completely visible in the current screen configuration. If so
- * then there's nothing to do.
+ * We have to pick where to display the index. First, bring the display
+ * information up to date and see if the index will be completely visible
+ * in the current screen configuration. If so then there's nothing to do.
*/
if (dInfoPtr->flags & DINFO_OUT_OF_DATE) {
@@ -3143,68 +5031,92 @@ TkTextSetYView(textPtr, indexPtr, pickPlace)
if (dlPtr != NULL) {
if ((dlPtr->y + dlPtr->height) > dInfoPtr->maxY) {
/*
- * Part of the line hangs off the bottom of the screen;
- * pretend the whole line is off-screen.
+ * Part of the line hangs off the bottom of the screen; pretend
+ * the whole line is off-screen.
*/
dlPtr = NULL;
} else if ((dlPtr->index.linePtr == indexPtr->linePtr)
&& (dlPtr->index.byteIndex <= indexPtr->byteIndex)) {
+ if (dInfoPtr->dLinePtr == dlPtr && dInfoPtr->topPixelOffset != 0) {
+ /*
+ * It is on the top line, but that line is hanging off the top
+ * of the screen. Change the top overlap to zero and update.
+ */
+
+ dInfoPtr->newTopPixelOffset = 0;
+ goto scheduleUpdate;
+ }
return;
}
}
/*
- * The desired line isn't already on-screen. Figure out what
- * it means to be "close" to the top or bottom of the screen.
- * Close means within 1/3 of the screen height or within three
- * lines, whichever is greater. Add one extra line also, to
- * account for the way MeasureUp rounds.
+ * The desired line isn't already on-screen. Figure out what it means to
+ * be "close" to the top or bottom of the screen. Close means within 1/3
+ * of the screen height or within three lines, whichever is greater.
+ *
+ * If the line is not close, place it in the center of the window.
+ */
+
+ lineHeight = CalculateDisplayLineHeight(textPtr, indexPtr, NULL, NULL);
+
+ /*
+ * It would be better if 'bottomY' were calculated using the actual height
+ * of the given line, not 'textPtr->charHeight'.
*/
- Tk_GetFontMetrics(textPtr->tkfont, &fm);
- bottomY = (dInfoPtr->y + dInfoPtr->maxY + fm.linespace)/2;
+ bottomY = (dInfoPtr->y + dInfoPtr->maxY + lineHeight)/2;
close = (dInfoPtr->maxY - dInfoPtr->y)/3;
- if (close < 3*fm.linespace) {
- close = 3*fm.linespace;
+ if (close < 3*textPtr->charHeight) {
+ close = 3*textPtr->charHeight;
}
- close += fm.linespace;
if (dlPtr != NULL) {
+ int overlap;
+
/*
- * The desired line is above the top of screen. If it is
- * "close" to the top of the window then make it the top
- * line on the screen.
+ * The desired line is above the top of screen. If it is "close" to
+ * the top of the window then make it the top line on the screen.
+ * MeasureUp counts from the bottom of the given index upwards, so we
+ * add an extra half line to be sure we count far enough.
*/
- MeasureUp(textPtr, &textPtr->topIndex, close, &tmpIndex);
+ MeasureUp(textPtr, &textPtr->topIndex, close + textPtr->charHeight/2,
+ &tmpIndex, &overlap);
if (TkTextIndexCmp(&tmpIndex, indexPtr) <= 0) {
- MeasureUp(textPtr, indexPtr, 0, &textPtr->topIndex);
+ textPtr->topIndex = *indexPtr;
+ TkTextFindDisplayLineEnd(textPtr, &textPtr->topIndex, 0, NULL);
+ dInfoPtr->newTopPixelOffset = 0;
goto scheduleUpdate;
}
} else {
+ int overlap;
+
/*
- * The desired line is below the bottom of the screen. If it is
- * "close" to the bottom of the screen then position it at the
- * bottom of the screen.
+ * The desired line is below the bottom of the screen. If it is
+ * "close" to the bottom of the screen then position it at the bottom
+ * of the screen.
*/
- MeasureUp(textPtr, indexPtr, close, &tmpIndex);
+ MeasureUp(textPtr, indexPtr, close + lineHeight
+ - textPtr->charHeight/2, &tmpIndex, &overlap);
if (FindDLine(dInfoPtr->dLinePtr, &tmpIndex) != NULL) {
bottomY = dInfoPtr->maxY - dInfoPtr->y;
}
}
/*
- * Our job now is to arrange the display so that indexPtr appears
- * as low on the screen as possible but with its bottom no lower
- * than bottomY. BottomY is the bottom of the window if the
- * desired line is just below the current screen, otherwise it
- * is a half-line lower than the center of the window.
+ * Our job now is to arrange the display so that indexPtr appears as low
+ * on the screen as possible but with its bottom no lower than bottomY.
+ * BottomY is the bottom of the window if the desired line is just below
+ * the current screen, otherwise it is a half-line lower than the center
+ * of the window.
*/
- MeasureUp(textPtr, indexPtr, bottomY, &textPtr->topIndex);
+ MeasureUp(textPtr, indexPtr, bottomY, &textPtr->topIndex,
+ &dInfoPtr->newTopPixelOffset);
- scheduleUpdate:
+ scheduleUpdate:
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
}
@@ -3214,21 +5126,78 @@ TkTextSetYView(textPtr, indexPtr, pickPlace)
/*
*--------------------------------------------------------------
*
+ * TkTextMeasureDown --
+ *
+ * Given one index, find the index of the first character on the highest
+ * display line that would be displayed no more than "distance" pixels
+ * below the top of the given index.
+ *
+ * Results:
+ * The srcPtr is manipulated in place to reflect the new position. We
+ * return the number of pixels by which 'distance' overlaps the srcPtr.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+TkTextMeasureDown(
+ TkText *textPtr, /* Text widget in which to measure. */
+ TkTextIndex *srcPtr, /* Index of character from which to start
+ * measuring. */
+ int distance) /* Vertical distance in pixels measured from
+ * the top pixel in srcPtr's logical line. */
+{
+ TkTextLine *lastLinePtr;
+ DLine *dlPtr;
+ TkTextIndex loop;
+
+ lastLinePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr));
+
+ do {
+ dlPtr = LayoutDLine(textPtr, srcPtr);
+ dlPtr->nextPtr = NULL;
+
+ if (distance < dlPtr->height) {
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ break;
+ }
+ distance -= dlPtr->height;
+ TkTextIndexForwBytes(textPtr, srcPtr, dlPtr->byteCount, &loop);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ if (loop.linePtr == lastLinePtr) {
+ break;
+ }
+ *srcPtr = loop;
+ } while (distance > 0);
+
+ return distance;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* MeasureUp --
*
- * Given one index, find the index of the first character
- * on the highest display line that would be displayed no more
- * than "distance" pixels above the given index.
+ * Given one index, find the index of the first character on the highest
+ * display line that would be displayed no more than "distance" pixels
+ * above the given index.
+ *
+ * If this function is called with distance=0, it simply finds the first
+ * index on the same display line as srcPtr. However, there is a another
+ * function TkTextFindDisplayLineEnd designed just for that task which is
+ * probably better to use.
*
* Results:
- * *dstPtr is filled in with the index of the first character
- * on a display line. The display line is found by measuring
- * up "distance" pixels above the pixel just below an imaginary
- * display line that contains srcPtr. If the display line
- * that covers this coordinate actually extends above the
- * coordinate, then return the index of the next lower line
- * instead (i.e. the returned index will be completely visible
- * at or below the given y-coordinate).
+ * *dstPtr is filled in with the index of the first character on a
+ * display line. The display line is found by measuring up "distance"
+ * pixels above the pixel just below an imaginary display line that
+ * contains srcPtr. If the display line that covers this coordinate
+ * actually extends above the coordinate, then return any excess pixels
+ * in *overlap, if that is non-NULL.
*
* Side effects:
* None.
@@ -3237,83 +5206,87 @@ TkTextSetYView(textPtr, indexPtr, pickPlace)
*/
static void
-MeasureUp(textPtr, srcPtr, distance, dstPtr)
- TkText *textPtr; /* Text widget in which to measure. */
- TkTextIndex *srcPtr; /* Index of character from which to start
+MeasureUp(
+ TkText *textPtr, /* Text widget in which to measure. */
+ CONST TkTextIndex *srcPtr, /* Index of character from which to start
* measuring. */
- int distance; /* Vertical distance in pixels measured
- * from the pixel just below the lowest
- * one in srcPtr's line. */
- TkTextIndex *dstPtr; /* Index to fill in with result. */
+ int distance, /* Vertical distance in pixels measured from
+ * the pixel just below the lowest one in
+ * srcPtr's line. */
+ TkTextIndex *dstPtr, /* Index to fill in with result. */
+ int *overlap) /* Used to store how much of the final index
+ * returned was not covered by 'distance'. */
{
int lineNum; /* Number of current line. */
int bytesToCount; /* Maximum number of bytes to measure in
* current line. */
- TkTextIndex bestIndex = {NULL, NULL, 0}; /* Best candidate seen so far for
- * result. Silence gcc 4 warning */
TkTextIndex index;
DLine *dlPtr, *lowestPtr;
- int noBestYet; /* 1 means bestIndex hasn't been set. */
- noBestYet = 1;
bytesToCount = srcPtr->byteIndex + 1;
index.tree = srcPtr->tree;
- for (lineNum = TkBTreeLineIndex(srcPtr->linePtr); lineNum >= 0;
+ for (lineNum = TkBTreeLinesTo(textPtr, srcPtr->linePtr); lineNum >= 0;
lineNum--) {
/*
* Layout an entire text line (potentially > 1 display line).
- * For the first line, which contains srcPtr, only layout the
- * part up through srcPtr (bytesToCount is non-infinite to
- * accomplish this). Make a list of all the display lines
- * in backwards order (the lowest DLine on the screen is first
- * in the list).
+ *
+ * For the first line, which contains srcPtr, only layout the part up
+ * through srcPtr (bytesToCount is non-infinite to accomplish this).
+ * Make a list of all the display lines in backwards order (the lowest
+ * DLine on the screen is first in the list).
*/
- index.linePtr = TkBTreeFindLine(srcPtr->tree, lineNum);
+ index.linePtr = TkBTreeFindLine(srcPtr->tree, textPtr, lineNum);
index.byteIndex = 0;
lowestPtr = NULL;
do {
dlPtr = LayoutDLine(textPtr, &index);
dlPtr->nextPtr = lowestPtr;
lowestPtr = dlPtr;
- TkTextIndexForwBytes(&index, dlPtr->byteCount, &index);
+ TkTextIndexForwBytes(textPtr, &index, dlPtr->byteCount, &index);
bytesToCount -= dlPtr->byteCount;
- } while ((bytesToCount > 0) && (index.linePtr == dlPtr->index.linePtr));
+ } while (bytesToCount>0 && index.linePtr==dlPtr->index.linePtr);
/*
* Scan through the display lines to see if we've covered enough
- * vertical distance. If so, save the starting index for the
- * line at the desired location.
+ * vertical distance. If so, save the starting index for the line at
+ * the desired location. If distance was zero to start with then we
+ * simply get the first index on the same display line as the original
+ * index.
*/
for (dlPtr = lowestPtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) {
distance -= dlPtr->height;
- if (distance < 0) {
- *dstPtr = (noBestYet) ? dlPtr->index : bestIndex;
+ if (distance <= 0) {
+ *dstPtr = dlPtr->index;
+ if (overlap != NULL) {
+ *overlap = -distance;
+ }
break;
}
- bestIndex = dlPtr->index;
- noBestYet = 0;
}
/*
- * Discard the display lines, then either return or prepare
- * for the next display line to lay out.
+ * Discard the display lines, then either return or prepare for the
+ * next display line to lay out.
*/
- FreeDLines(textPtr, lowestPtr, (DLine *) NULL, 0);
- if (distance < 0) {
+ FreeDLines(textPtr, lowestPtr, NULL, DLINE_FREE);
+ if (distance <= 0) {
return;
}
bytesToCount = INT_MAX; /* Consider all chars. in next line. */
}
/*
- * Ran off the beginning of the text. Return the first character
- * in the text.
+ * Ran off the beginning of the text. Return the first character in the
+ * text.
*/
- TkTextMakeByteIndex(textPtr->tree, 0, 0, dstPtr);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0, dstPtr);
+ if (overlap != NULL) {
+ *overlap = 0;
+ }
}
/*
@@ -3321,9 +5294,9 @@ MeasureUp(textPtr, srcPtr, distance, dstPtr)
*
* TkTextSeeCmd --
*
- * This procedure is invoked to process the "see" option for
- * the widget command for text widgets. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "see" option for the widget
+ * command for text widgets. See the user documentation for details on
+ * what it does.
*
* Results:
* A standard Tcl result.
@@ -3335,13 +5308,13 @@ MeasureUp(textPtr, srcPtr, distance, dstPtr)
*/
int
-TkTextSeeCmd(textPtr, interp, argc, argv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextSeeCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "see". */
+ * objv[1] is "see". */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
TkTextIndex index;
@@ -3349,29 +5322,29 @@ TkTextSeeCmd(textPtr, interp, argc, argv)
DLine *dlPtr;
TkTextDispChunk *chunkPtr;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " see index\"", (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[2], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[2], &index) != TCL_OK) {
return TCL_ERROR;
}
/*
- * If the specified position is the extra line at the end of the
- * text, round it back to the last real line.
+ * If the specified position is the extra line at the end of the text,
+ * round it back to the last real line.
*/
- if (TkBTreeLineIndex(index.linePtr) == TkBTreeNumLines(index.tree)) {
- TkTextIndexBackChars(&index, 1, &index);
+ if (TkBTreeLinesTo(textPtr, index.linePtr)
+ == TkBTreeNumLines(index.tree, textPtr)) {
+ TkTextIndexBackChars(textPtr, &index, 1, &index, COUNT_INDICES);
}
/*
* First get the desired position into the vertical range of the window.
*/
- TkTextSetYView(textPtr, &index, 1);
+ TkTextSetYView(textPtr, &index, TK_TEXT_PICKPLACE);
/*
* Now make sure that the character is in view horizontally.
@@ -3386,8 +5359,8 @@ TkTextSeeCmd(textPtr, interp, argc, argv)
}
/*
- * Find the chunk that contains the desired index.
- * dlPtr may be NULL if the widget is not mapped. [Bug #641778]
+ * Find the chunk that contains the desired index. dlPtr may be NULL if
+ * the widget is not mapped. [Bug #641778]
*/
dlPtr = FindDLine(dInfoPtr->dLinePtr, &index);
@@ -3397,7 +5370,7 @@ TkTextSeeCmd(textPtr, interp, argc, argv)
byteCount = index.byteIndex - dlPtr->index.byteIndex;
for (chunkPtr = dlPtr->chunkPtr; chunkPtr != NULL ;
- chunkPtr = chunkPtr->nextPtr) {
+ chunkPtr = chunkPtr->nextPtr) {
if (byteCount < chunkPtr->numBytes) {
break;
}
@@ -3405,36 +5378,32 @@ TkTextSeeCmd(textPtr, interp, argc, argv)
}
/*
- * Call a chunk-specific procedure to find the horizontal range of
- * the character within the chunk.
- * chunkPtr is NULL if trying to see in elided region.
+ * Call a chunk-specific function to find the horizontal range of the
+ * character within the chunk. chunkPtr is NULL if trying to see in elided
+ * region.
*/
if (chunkPtr != NULL) {
- (*chunkPtr->bboxProc)(chunkPtr, byteCount,
+ (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteCount,
dlPtr->y + dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
&height);
- delta = x - dInfoPtr->curPixelOffset;
+ delta = x - dInfoPtr->curXPixelOffset;
oneThird = lineWidth/3;
if (delta < 0) {
if (delta < -oneThird) {
- dInfoPtr->newByteOffset = (x - lineWidth/2)
- / textPtr->charWidth;
+ dInfoPtr->newXPixelOffset = (x - lineWidth/2);
} else {
- dInfoPtr->newByteOffset -= ((-delta) + textPtr->charWidth - 1)
- / textPtr->charWidth;
+ dInfoPtr->newXPixelOffset -= ((-delta) );
}
} else {
delta -= (lineWidth - width);
if (delta > 0) {
if (delta > oneThird) {
- dInfoPtr->newByteOffset = (x - lineWidth/2)
- / textPtr->charWidth;
+ dInfoPtr->newXPixelOffset = (x - lineWidth/2);
} else {
- dInfoPtr->newByteOffset += (delta + textPtr->charWidth - 1)
- / textPtr->charWidth;
+ dInfoPtr->newXPixelOffset += (delta );
}
} else {
return TCL_OK;
@@ -3454,9 +5423,9 @@ TkTextSeeCmd(textPtr, interp, argc, argv)
*
* TkTextXviewCmd --
*
- * This procedure is invoked to process the "xview" option for
- * the widget command for text widgets. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "xview" option for the widget
+ * command for text widgets. See the user documentation for details on
+ * what it does.
*
* Results:
* A standard Tcl result.
@@ -3468,56 +5437,60 @@ TkTextSeeCmd(textPtr, interp, argc, argv)
*/
int
-TkTextXviewCmd(textPtr, interp, argc, argv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextXviewCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "xview". */
+ * objv[1] is "xview". */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- int type, charsPerPage, count, newOffset;
+ int type, count;
double fraction;
if (dInfoPtr->flags & DINFO_OUT_OF_DATE) {
UpdateDisplayInfo(textPtr);
}
- if (argc == 2) {
+ if (objc == 2) {
GetXView(interp, textPtr, 0);
return TCL_OK;
}
- newOffset = dInfoPtr->newByteOffset;
- type = Tk_GetScrollInfo(interp, argc, argv, &fraction, &count);
+ type = TextGetScrollInfoObj(interp, textPtr, objc, objv,
+ &fraction, &count);
switch (type) {
- case TK_SCROLL_ERROR:
- return TCL_ERROR;
- case TK_SCROLL_MOVETO:
- if (fraction > 1.0) {
- fraction = 1.0;
- }
- if (fraction < 0) {
- fraction = 0;
- }
- newOffset = (int) (((fraction * dInfoPtr->maxLength) / textPtr->charWidth)
- + 0.5);
- break;
- case TK_SCROLL_PAGES:
- charsPerPage = ((dInfoPtr->maxX - dInfoPtr->x) / textPtr->charWidth)
- - 2;
- if (charsPerPage < 1) {
- charsPerPage = 1;
- }
- newOffset += charsPerPage * count;
- break;
- case TK_SCROLL_UNITS:
- newOffset += count;
- break;
+ case TKTEXT_SCROLL_ERROR:
+ return TCL_ERROR;
+ case TKTEXT_SCROLL_MOVETO:
+ if (fraction > 1.0) {
+ fraction = 1.0;
+ }
+ if (fraction < 0) {
+ fraction = 0;
+ }
+ dInfoPtr->newXPixelOffset = (int)
+ (fraction * dInfoPtr->maxLength + 0.5);
+ break;
+ case TKTEXT_SCROLL_PAGES: {
+ int pixelsPerPage;
+
+ pixelsPerPage = (dInfoPtr->maxX-dInfoPtr->x) - 2*textPtr->charWidth;
+ if (pixelsPerPage < 1) {
+ pixelsPerPage = 1;
+ }
+ dInfoPtr->newXPixelOffset += pixelsPerPage * count;
+ break;
+ }
+ case TKTEXT_SCROLL_UNITS:
+ dInfoPtr->newXPixelOffset += count * textPtr->charWidth;
+ break;
+ case TKTEXT_SCROLL_PIXELS:
+ dInfoPtr->newXPixelOffset += count;
+ break;
}
- dInfoPtr->newByteOffset = newOffset;
dInfoPtr->flags |= DINFO_OUT_OF_DATE;
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
dInfoPtr->flags |= REDRAW_PENDING;
@@ -3529,56 +5502,141 @@ TkTextXviewCmd(textPtr, interp, argc, argv)
/*
*----------------------------------------------------------------------
*
- * ScrollByLines --
+ * YScrollByPixels --
+ *
+ * This function is called to scroll a text widget up or down by a given
+ * number of pixels.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The view in textPtr's window changes to reflect the value of "offset".
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+YScrollByPixels(
+ TkText *textPtr, /* Widget to scroll. */
+ int offset) /* Amount by which to scroll, in pixels.
+ * Positive means that information later in
+ * text becomes visible, negative means that
+ * information earlier in the text becomes
+ * visible. */
+{
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+
+ if (offset < 0) {
+ /*
+ * Now we want to measure up this number of pixels from the top of the
+ * screen. But the top line may not be totally visible. Note that
+ * 'count' is negative here.
+ */
+
+ offset -= CalculateDisplayLineHeight(textPtr,
+ &textPtr->topIndex, NULL, NULL) - dInfoPtr->topPixelOffset;
+ MeasureUp(textPtr, &textPtr->topIndex, -offset,
+ &textPtr->topIndex, &dInfoPtr->newTopPixelOffset);
+ } else if (offset > 0) {
+ DLine *dlPtr;
+ TkTextLine *lastLinePtr;
+ TkTextIndex newIdx;
+
+ /*
+ * Scrolling down by pixels. Layout lines starting at the top index
+ * and count through the desired vertical distance.
+ */
+
+ lastLinePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr));
+ offset += dInfoPtr->topPixelOffset;
+ dInfoPtr->newTopPixelOffset = 0;
+ while (offset > 0) {
+ dlPtr = LayoutDLine(textPtr, &textPtr->topIndex);
+ dlPtr->nextPtr = NULL;
+ TkTextIndexForwBytes(textPtr, &textPtr->topIndex,
+ dlPtr->byteCount, &newIdx);
+ if (offset <= dlPtr->height) {
+ /*
+ * Adjust the top overlap accordingly.
+ */
+
+ dInfoPtr->newTopPixelOffset = offset;
+ }
+ offset -= dlPtr->height;
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ if (newIdx.linePtr == lastLinePtr || offset <= 0) {
+ break;
+ }
+ textPtr->topIndex = newIdx;
+ }
+ } else {
+ /*
+ * offset = 0, so no scrolling required.
+ */
+
+ return;
+ }
+ if (!(dInfoPtr->flags & REDRAW_PENDING)) {
+ Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ }
+ dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * YScrollByLines --
*
- * This procedure is called to scroll a text widget up or down
- * by a given number of lines.
+ * This function is called to scroll a text widget up or down by a given
+ * number of lines.
*
* Results:
* None.
*
* Side effects:
- * The view in textPtr's window changes to reflect the value
- * of "offset".
+ * The view in textPtr's window changes to reflect the value of "offset".
*
*----------------------------------------------------------------------
*/
static void
-ScrollByLines(textPtr, offset)
- TkText *textPtr; /* Widget to scroll. */
- int offset; /* Amount by which to scroll, in *screen*
- * lines. Positive means that information
+YScrollByLines(
+ TkText *textPtr, /* Widget to scroll. */
+ int offset) /* Amount by which to scroll, in display
+ * lines. Positive means that information
* later in text becomes visible, negative
- * means that information earlier in the
- * text becomes visible. */
+ * means that information earlier in the text
+ * becomes visible. */
{
int i, bytesToCount, lineNum;
- TkTextIndex new, index;
+ TkTextIndex newIdx, index;
TkTextLine *lastLinePtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *dlPtr, *lowestPtr;
if (offset < 0) {
/*
- * Must scroll up (to show earlier information in the text).
- * The code below is similar to that in MeasureUp, except that
- * it counts lines instead of pixels.
+ * Must scroll up (to show earlier information in the text). The code
+ * below is similar to that in MeasureUp, except that it counts lines
+ * instead of pixels.
*/
bytesToCount = textPtr->topIndex.byteIndex + 1;
- index.tree = textPtr->tree;
- offset--; /* Skip line containing topIndex. */
- for (lineNum = TkBTreeLineIndex(textPtr->topIndex.linePtr);
+ index.tree = textPtr->sharedTextPtr->tree;
+ offset--; /* Skip line containing topIndex. */
+ for (lineNum = TkBTreeLinesTo(textPtr, textPtr->topIndex.linePtr);
lineNum >= 0; lineNum--) {
- index.linePtr = TkBTreeFindLine(textPtr->tree, lineNum);
+ index.linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree,
+ textPtr, lineNum);
index.byteIndex = 0;
lowestPtr = NULL;
do {
dlPtr = LayoutDLine(textPtr, &index);
dlPtr->nextPtr = lowestPtr;
lowestPtr = dlPtr;
- TkTextIndexForwBytes(&index, dlPtr->byteCount, &index);
+ TkTextIndexForwBytes(textPtr, &index, dlPtr->byteCount,&index);
bytesToCount -= dlPtr->byteCount;
} while ((bytesToCount > 0)
&& (index.linePtr == dlPtr->index.linePtr));
@@ -3592,45 +5650,51 @@ ScrollByLines(textPtr, offset)
}
/*
- * Discard the display lines, then either return or prepare
- * for the next display line to lay out.
+ * Discard the display lines, then either return or prepare for
+ * the next display line to lay out.
*/
-
- FreeDLines(textPtr, lowestPtr, (DLine *) NULL, 0);
+
+ FreeDLines(textPtr, lowestPtr, NULL, DLINE_FREE);
if (offset >= 0) {
goto scheduleUpdate;
}
bytesToCount = INT_MAX;
}
-
+
/*
- * Ran off the beginning of the text. Return the first character
- * in the text.
+ * Ran off the beginning of the text. Return the first character in
+ * the text, and make sure we haven't left anything overlapping the
+ * top window border.
*/
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &textPtr->topIndex);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0,
+ &textPtr->topIndex);
+ dInfoPtr->newTopPixelOffset = 0;
} else {
/*
- * Scrolling down, to show later information in the text.
- * Just count lines from the current top of the window.
+ * Scrolling down, to show later information in the text. Just count
+ * lines from the current top of the window.
*/
- lastLinePtr = TkBTreeFindLine(textPtr->tree,
- TkBTreeNumLines(textPtr->tree));
+ lastLinePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr));
for (i = 0; i < offset; i++) {
dlPtr = LayoutDLine(textPtr, &textPtr->topIndex);
- if (dlPtr->length == 0 && dlPtr->height == 0) offset++;
+ if (dlPtr->length == 0 && dlPtr->height == 0) {
+ offset++;
+ }
dlPtr->nextPtr = NULL;
- TkTextIndexForwBytes(&textPtr->topIndex, dlPtr->byteCount, &new);
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, 0);
- if (new.linePtr == lastLinePtr) {
+ TkTextIndexForwBytes(textPtr, &textPtr->topIndex,
+ dlPtr->byteCount, &newIdx);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE);
+ if (newIdx.linePtr == lastLinePtr) {
break;
}
- textPtr->topIndex = new;
+ textPtr->topIndex = newIdx;
}
}
- scheduleUpdate:
+ scheduleUpdate:
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
}
@@ -3642,9 +5706,9 @@ ScrollByLines(textPtr, offset)
*
* TkTextYviewCmd --
*
- * This procedure is invoked to process the "yview" option for
- * the widget command for text widgets. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "yview" option for the widget
+ * command for text widgets. See the user documentation for details on
+ * what it does.
*
* Results:
* A standard Tcl result.
@@ -3656,29 +5720,26 @@ ScrollByLines(textPtr, offset)
*/
int
-TkTextYviewCmd(textPtr, interp, argc, argv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextYviewCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "yview". */
+ * objv[1] is "yview". */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- int pickPlace, lineNum, type, bytesInLine;
- Tk_FontMetrics fm;
+ int pickPlace, type;
int pixels, count;
- size_t switchLength;
+ int switchLength;
double fraction;
- TkTextIndex index, new;
- TkTextLine *lastLinePtr;
- DLine *dlPtr;
+ TkTextIndex index;
if (dInfoPtr->flags & DINFO_OUT_OF_DATE) {
UpdateDisplayInfo(textPtr);
}
- if (argc == 2) {
+ if (objc == 2) {
GetYView(interp, textPtr, 0);
return TCL_OK;
}
@@ -3688,117 +5749,135 @@ TkTextYviewCmd(textPtr, interp, argc, argv)
*/
pickPlace = 0;
- if (argv[2][0] == '-') {
- switchLength = strlen(argv[2]);
- if ((switchLength >= 2)
- && (strncmp(argv[2], "-pickplace", switchLength) == 0)) {
+ if (Tcl_GetString(objv[2])[0] == '-') {
+ register CONST char *switchStr =
+ Tcl_GetStringFromObj(objv[2], &switchLength);
+
+ if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace",
+ (unsigned) switchLength) == 0)) {
pickPlace = 1;
- if (argc != 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " yview -pickplace lineNum|index\"",
- (char *) NULL);
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "lineNum|index");
return TCL_ERROR;
}
}
}
- if ((argc == 3) || pickPlace) {
- if (Tcl_GetInt(interp, argv[2+pickPlace], &lineNum) == TCL_OK) {
- TkTextMakeByteIndex(textPtr->tree, lineNum, 0, &index);
+ if ((objc == 3) || pickPlace) {
+ int lineNum;
+
+ if (Tcl_GetIntFromObj(interp, objv[2+pickPlace], &lineNum) == TCL_OK) {
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineNum, 0, &index);
TkTextSetYView(textPtr, &index, 0);
return TCL_OK;
}
-
+
/*
* The argument must be a regular text index.
*/
-
+
Tcl_ResetResult(interp);
- if (TkTextGetIndex(interp, textPtr, argv[2+pickPlace],
+ if (TkTextGetObjIndex(interp, textPtr, objv[2+pickPlace],
&index) != TCL_OK) {
return TCL_ERROR;
}
- TkTextSetYView(textPtr, &index, pickPlace);
+ TkTextSetYView(textPtr, &index, (pickPlace ? TK_TEXT_PICKPLACE : 0));
return TCL_OK;
}
/*
- * New syntax: dispatch based on argv[2].
+ * New syntax: dispatch based on objv[2].
*/
- type = Tk_GetScrollInfo(interp, argc, argv, &fraction, &count);
+ type = TextGetScrollInfoObj(interp, textPtr, objc,objv, &fraction, &count);
switch (type) {
- case TK_SCROLL_ERROR:
- return TCL_ERROR;
- case TK_SCROLL_MOVETO:
- if (fraction > 1.0) {
- fraction = 1.0;
- }
- if (fraction < 0) {
- fraction = 0;
- }
- fraction *= TkBTreeNumLines(textPtr->tree);
- lineNum = (int) fraction;
- TkTextMakeByteIndex(textPtr->tree, lineNum, 0, &index);
- bytesInLine = TkBTreeBytesInLine(index.linePtr);
- index.byteIndex = (int)((bytesInLine * (fraction-lineNum)) + 0.5);
- if (index.byteIndex >= bytesInLine) {
- TkTextMakeByteIndex(textPtr->tree, lineNum + 1, 0, &index);
- }
- TkTextSetYView(textPtr, &index, 0);
- break;
- case TK_SCROLL_PAGES:
+ case TKTEXT_SCROLL_ERROR:
+ return TCL_ERROR;
+ case TKTEXT_SCROLL_MOVETO: {
+ int numPixels = TkBTreeNumPixels(textPtr->sharedTextPtr->tree,
+ textPtr);
+ int topMostPixel;
+
+ if (numPixels == 0) {
/*
- * Scroll up or down by screenfuls. Actually, use the
- * window height minus two lines, so that there's some
- * overlap between adjacent pages.
+ * If the window is totally empty no scrolling is needed, and the
+ * TkTextMakePixelIndex call below will fail.
*/
- Tk_GetFontMetrics(textPtr->tkfont, &fm);
- if (count < 0) {
- pixels = (dInfoPtr->maxY - 2*fm.linespace - dInfoPtr->y)*(-count)
- + fm.linespace;
- MeasureUp(textPtr, &textPtr->topIndex, pixels, &new);
- if (TkTextIndexCmp(&textPtr->topIndex, &new) == 0) {
- /*
- * A page of scrolling ended up being less than one line.
- * Scroll one line anyway.
- */
+ break;
+ }
+ if (fraction > 1.0) {
+ fraction = 1.0;
+ }
+ if (fraction < 0) {
+ fraction = 0;
+ }
- count = -1;
- goto scrollByLines;
- }
- textPtr->topIndex = new;
- } else {
+ /*
+ * Calculate the pixel count for the new topmost pixel in the topmost
+ * line of the window. Note that the interpretation of 'fraction' is
+ * that it counts from 0 (top pixel in buffer) to 1.0 (one pixel past
+ * the last pixel in buffer).
+ */
+
+ topMostPixel = (int) (0.5 + fraction * numPixels);
+ if (topMostPixel >= numPixels) {
+ topMostPixel = numPixels -1;
+ }
+
+ /*
+ * This function returns the number of pixels by which the given line
+ * should overlap the top of the visible screen.
+ *
+ * This is then used to provide smooth scrolling.
+ */
+
+ pixels = TkTextMakePixelIndex(textPtr, topMostPixel, &index);
+ TkTextSetYView(textPtr, &index, pixels);
+ break;
+ }
+ case TKTEXT_SCROLL_PAGES: {
+ /*
+ * Scroll up or down by screenfuls. Actually, use the window height
+ * minus two lines, so that there's some overlap between adjacent
+ * pages.
+ */
+
+ int height = dInfoPtr->maxY - dInfoPtr->y;
+
+ if (textPtr->charHeight * 4 >= height) {
+ /*
+ * A single line is more than a quarter of the display. We choose
+ * to scroll by 3/4 of the height instead.
+ */
+
+ pixels = 3*height/4;
+ if (pixels < textPtr->charHeight) {
/*
- * Scrolling down by pages. Layout lines starting at the
- * top index and count through the desired vertical distance.
+ * But, if 3/4 of the height is actually less than a single
+ * typical character height, then scroll by the minimum of the
+ * linespace or the total height.
*/
- pixels = (dInfoPtr->maxY - 2*fm.linespace - dInfoPtr->y)*count;
- lastLinePtr = TkBTreeFindLine(textPtr->tree,
- TkBTreeNumLines(textPtr->tree));
- do {
- dlPtr = LayoutDLine(textPtr, &textPtr->topIndex);
- dlPtr->nextPtr = NULL;
- TkTextIndexForwBytes(&textPtr->topIndex, dlPtr->byteCount,
- &new);
- pixels -= dlPtr->height;
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, 0);
- if (new.linePtr == lastLinePtr) {
- break;
- }
- textPtr->topIndex = new;
- } while (pixels > 0);
- }
- if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ if (textPtr->charHeight < height) {
+ pixels = textPtr->charHeight;
+ } else {
+ pixels = height;
+ }
}
- dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
- break;
- case TK_SCROLL_UNITS:
- scrollByLines:
- ScrollByLines(textPtr, count);
- break;
+ pixels *= count;
+ } else {
+ pixels = (height - 2*textPtr->charHeight)*count;
+ }
+ YScrollByPixels(textPtr, pixels);
+ break;
+ }
+ case TKTEXT_SCROLL_PIXELS:
+ YScrollByPixels(textPtr, count);
+ break;
+ case TKTEXT_SCROLL_UNITS:
+ YScrollByLines(textPtr, count);
+ break;
}
return TCL_OK;
}
@@ -3808,9 +5887,9 @@ TkTextYviewCmd(textPtr, interp, argc, argv)
*
* TkTextScanCmd --
*
- * This procedure is invoked to process the "scan" option for
- * the widget command for text widgets. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "scan" option for the widget
+ * command for text widgets. See the user documentation for details on
+ * what it does.
*
* Results:
* A standard Tcl result.
@@ -3822,91 +5901,93 @@ TkTextYviewCmd(textPtr, interp, argc, argv)
*/
int
-TkTextScanCmd(textPtr, interp, argc, argv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextScanCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "scan". */
+ * objv[1] is "scan". */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
TkTextIndex index;
- int c, x, y, totalScroll, newByte, maxByte, gain=10;
- Tk_FontMetrics fm;
+ int c, x, y, totalScroll, gain=10;
size_t length;
- if ((argc != 5) && (argc != 6)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " scan mark x y\" or \"",
- argv[0], " scan dragto x y ?gain?\"", (char *) NULL);
+ if ((objc != 5) && (objc != 6)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "mark x y");
+ Tcl_AppendResult(interp, " or \"", Tcl_GetString(objv[0]),
+ " scan dragto x y ?gain?\"", NULL);
+ /*
+ * Ought to be:
+ * Tcl_WrongNumArgs(interp, 2, objc, "dragto x y ?gain?");
+ */
return TCL_ERROR;
}
- if (Tcl_GetInt(interp, argv[3], &x) != TCL_OK) {
+ if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
return TCL_ERROR;
}
- if (Tcl_GetInt(interp, argv[4], &y) != TCL_OK) {
+ if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) {
return TCL_ERROR;
}
- if ((argc == 6) && (Tcl_GetInt(interp, argv[5], &gain) != TCL_OK))
+ if ((objc == 6) && (Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) {
return TCL_ERROR;
- c = argv[2][0];
- length = strlen(argv[2]);
- if ((c == 'd') && (strncmp(argv[2], "dragto", length) == 0)) {
+ }
+ c = Tcl_GetString(objv[2])[0];
+ length = strlen(Tcl_GetString(objv[2]));
+ if (c=='d' && strncmp(Tcl_GetString(objv[2]), "dragto", length)==0) {
+ int newX, maxX;
+
/*
- * Amplify the difference between the current position and the
- * mark position to compute how much the view should shift, then
- * update the mark position to correspond to the new view. If we
- * run off the edge of the text, reset the mark point so that the
- * current position continues to correspond to the edge of the
- * window. This means that the picture will start dragging as
- * soon as the mouse reverses direction (without this reset, might
- * have to slide mouse a long ways back before the picture starts
- * moving again).
+ * Amplify the difference between the current position and the mark
+ * position to compute how much the view should shift, then update the
+ * mark position to correspond to the new view. If we run off the edge
+ * of the text, reset the mark point so that the current position
+ * continues to correspond to the edge of the window. This means that
+ * the picture will start dragging as soon as the mouse reverses
+ * direction (without this reset, might have to slide mouse a long
+ * ways back before the picture starts moving again).
*/
- newByte = dInfoPtr->scanMarkIndex + (gain*(dInfoPtr->scanMarkX - x))
- / (textPtr->charWidth);
- maxByte = 1 + (dInfoPtr->maxLength - (dInfoPtr->maxX - dInfoPtr->x)
- + textPtr->charWidth - 1)/textPtr->charWidth;
- if (newByte < 0) {
- newByte = 0;
- dInfoPtr->scanMarkIndex = 0;
+ newX = dInfoPtr->scanMarkXPixel + gain*(dInfoPtr->scanMarkX - x);
+ maxX = 1 + dInfoPtr->maxLength - (dInfoPtr->maxX - dInfoPtr->x);
+ if (newX < 0) {
+ newX = 0;
+ dInfoPtr->scanMarkXPixel = 0;
dInfoPtr->scanMarkX = x;
- } else if (newByte > maxByte) {
- newByte = maxByte;
- dInfoPtr->scanMarkIndex = maxByte;
+ } else if (newX > maxX) {
+ newX = maxX;
+ dInfoPtr->scanMarkXPixel = maxX;
dInfoPtr->scanMarkX = x;
}
- dInfoPtr->newByteOffset = newByte;
+ dInfoPtr->newXPixelOffset = newX;
- Tk_GetFontMetrics(textPtr->tkfont, &fm);
- totalScroll = (gain*(dInfoPtr->scanMarkY - y)) / fm.linespace;
- if (totalScroll != dInfoPtr->scanTotalScroll) {
+ totalScroll = gain*(dInfoPtr->scanMarkY - y);
+ if (totalScroll != dInfoPtr->scanTotalYScroll) {
index = textPtr->topIndex;
- ScrollByLines(textPtr, totalScroll-dInfoPtr->scanTotalScroll);
- dInfoPtr->scanTotalScroll = totalScroll;
+ YScrollByPixels(textPtr, totalScroll-dInfoPtr->scanTotalYScroll);
+ dInfoPtr->scanTotalYScroll = totalScroll;
if ((index.linePtr == textPtr->topIndex.linePtr) &&
(index.byteIndex == textPtr->topIndex.byteIndex)) {
- dInfoPtr->scanTotalScroll = 0;
+ dInfoPtr->scanTotalYScroll = 0;
dInfoPtr->scanMarkY = y;
}
}
- } else if ((c == 'm') && (strncmp(argv[2], "mark", length) == 0)) {
- dInfoPtr->scanMarkIndex = dInfoPtr->newByteOffset;
+ dInfoPtr->flags |= DINFO_OUT_OF_DATE;
+ if (!(dInfoPtr->flags & REDRAW_PENDING)) {
+ dInfoPtr->flags |= REDRAW_PENDING;
+ Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ }
+ } else if (c=='m' && strncmp(Tcl_GetString(objv[2]), "mark", length)==0) {
+ dInfoPtr->scanMarkXPixel = dInfoPtr->newXPixelOffset;
dInfoPtr->scanMarkX = x;
- dInfoPtr->scanTotalScroll = 0;
+ dInfoPtr->scanTotalYScroll = 0;
dInfoPtr->scanMarkY = y;
} else {
- Tcl_AppendResult(interp, "bad scan option \"", argv[2],
- "\": must be mark or dragto", (char *) NULL);
+ Tcl_AppendResult(interp, "bad scan option \"", Tcl_GetString(objv[2]),
+ "\": must be mark or dragto", NULL);
return TCL_ERROR;
}
- dInfoPtr->flags |= DINFO_OUT_OF_DATE;
- if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- dInfoPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
- }
return TCL_OK;
}
@@ -3915,19 +5996,19 @@ TkTextScanCmd(textPtr, interp, argc, argv)
*
* GetXView --
*
- * This procedure computes the fractions that indicate what's
- * visible in a text window and, optionally, evaluates a
- * Tcl script to report them to the text's associated scrollbar.
+ * This function computes the fractions that indicate what's visible in a
+ * text window and, optionally, evaluates a Tcl script to report them to
+ * the text's associated scrollbar.
*
* Results:
- * If report is zero, then the interp's result is filled in with
- * two real numbers separated by a space, giving the position of
- * the left and right edges of the window as fractions from 0 to
- * 1, where 0 means the left edge of the text and 1 means the right
- * edge. If report is non-zero, then the interp's result isn't modified
- * directly, but instead a script is evaluated in interp to report
- * the new horizontal scroll position to the scrollbar (if the scroll
- * position hasn't changed then no script is invoked).
+ * If report is zero, then the interp's result is filled in with two real
+ * numbers separated by a space, giving the position of the left and
+ * right edges of the window as fractions from 0 to 1, where 0 means the
+ * left edge of the text and 1 means the right edge. If report is
+ * non-zero, then the interp's result isn't modified directly, but
+ * instead a script is evaluated in interp to report the new horizontal
+ * scroll position to the scrollbar (if the scroll position hasn't
+ * changed then no script is invoked).
*
* Side effects:
* None.
@@ -3936,24 +6017,24 @@ TkTextScanCmd(textPtr, interp, argc, argv)
*/
static void
-GetXView(interp, textPtr, report)
- Tcl_Interp *interp; /* If "report" is FALSE, string
- * describing visible range gets
- * stored in the interp's result. */
- TkText *textPtr; /* Information about text widget. */
- int report; /* Non-zero means report info to
- * scrollbar if it has changed. */
+GetXView(
+ Tcl_Interp *interp, /* If "report" is FALSE, string describing
+ * visible range gets stored in the interp's
+ * result. */
+ TkText *textPtr, /* Information about text widget. */
+ int report) /* Non-zero means report info to scrollbar if
+ * it has changed. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- char buffer[TCL_DOUBLE_SPACE * 2 + 1];
double first, last;
int code;
+ Tcl_Obj *listObj;
if (dInfoPtr->maxLength > 0) {
- first = ((double) dInfoPtr->curPixelOffset)
- / dInfoPtr->maxLength;
- last = first + ((double) (dInfoPtr->maxX - dInfoPtr->x))
+ first = ((double) dInfoPtr->curXPixelOffset)
/ dInfoPtr->maxLength;
+ last = ((double) (dInfoPtr->curXPixelOffset + dInfoPtr->maxX
+ - dInfoPtr->x))/dInfoPtr->maxLength;
if (last > 1.0) {
last = 1.0;
}
@@ -3962,44 +6043,177 @@ GetXView(interp, textPtr, report)
last = 1.0;
}
if (!report) {
- sprintf(buffer, "%g %g", first, last);
- Tcl_SetResult(interp, buffer, TCL_VOLATILE);
+ listObj = Tcl_NewListObj(0, NULL);
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewDoubleObj(first));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewDoubleObj(last));
+ Tcl_SetObjResult(interp, listObj);
return;
}
if (FP_EQUAL_SCALE(first, dInfoPtr->xScrollFirst, dInfoPtr->maxLength) &&
- FP_EQUAL_SCALE(last, dInfoPtr->xScrollLast, dInfoPtr->maxLength)) {
+ FP_EQUAL_SCALE(last, dInfoPtr->xScrollLast, dInfoPtr->maxLength)) {
return;
}
dInfoPtr->xScrollFirst = first;
dInfoPtr->xScrollLast = last;
- sprintf(buffer, " %g %g", first, last);
- code = Tcl_VarEval(interp, textPtr->xScrollCmd,
- buffer, (char *) NULL);
- if (code != TCL_OK) {
- Tcl_AddErrorInfo(interp,
- "\n (horizontal scrolling command executed by text)");
- Tcl_BackgroundError(interp);
+ if (textPtr->xScrollCmd != NULL) {
+ char buf1[TCL_DOUBLE_SPACE+1];
+ char buf2[TCL_DOUBLE_SPACE+1];
+
+ buf1[0] = ' ';
+ buf2[0] = ' ';
+ Tcl_PrintDouble(NULL, first, buf1+1);
+ Tcl_PrintDouble(NULL, last, buf2+1);
+ code = Tcl_VarEval(interp, textPtr->xScrollCmd, buf1, buf2, NULL);
+ if (code != TCL_OK) {
+ Tcl_AddErrorInfo(interp,
+ "\n (horizontal scrolling command executed by text)");
+ Tcl_BackgroundError(interp);
+ }
}
}
/*
*----------------------------------------------------------------------
*
+ * GetYPixelCount --
+ *
+ * How many pixels are there between the absolute top of the widget and
+ * the top of the given DLine.
+ *
+ * While this function will work for any valid DLine, it is only ever
+ * called when dlPtr is the first display line in the widget (by
+ * 'GetYView'). This means that usually this function is a very quick
+ * calculation, since it can use the pre-calculated linked-list of DLines
+ * for height information.
+ *
+ * The only situation where this breaks down is if dlPtr's logical line
+ * wraps enough times to fill the text widget's current view - in this
+ * case we won't have enough dlPtrs in the linked list to be able to
+ * subtract off what we want.
+ *
+ * Results:
+ * The number of pixels.
+ *
+ * This value has a valid range between '0' (the very top of the widget)
+ * and the number of pixels in the total widget minus the pixel-height of
+ * the last line.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetYPixelCount(
+ TkText *textPtr, /* Information about text widget. */
+ DLine *dlPtr) /* Information about the layout of a given
+ * index. */
+{
+ TkTextLine *linePtr = dlPtr->index.linePtr;
+ int count;
+
+ /*
+ * Get the pixel count to the top of dlPtr's logical line. The rest of the
+ * function is then concerned with updating 'count' for any difference
+ * between the top of the logical line and the display line.
+ */
+
+ count = TkBTreePixelsTo(textPtr, linePtr);
+
+ /*
+ * For the common case where this dlPtr is also the start of the logical
+ * line, we can return right away. Note the implicit assumption here that
+ * the start of a logical line is always the start of a display line (if
+ * the 'elide won't elide first newline' bug is fixed, this will no longer
+ * necessarily be true).
+ */
+
+ if (dlPtr->index.byteIndex == 0) {
+ return count;
+ }
+
+ /*
+ * Add on the logical line's height to reach one pixel beyond the bottom
+ * of the logical line. And then subtract off the heights of all the
+ * display lines from dlPtr to the end of its logical line.
+ *
+ * A different approach would be to lay things out from the start of the
+ * logical line until we reach dlPtr, but since none of those are
+ * pre-calculated, it'll usually take a lot longer. (But there are cases
+ * where it would be more efficient: say if we're on the second of 1000
+ * wrapped lines all from a single logical line - but that sort of
+ * optimization is left for the future).
+ */
+
+ count += TkBTreeLinePixelCount(textPtr, linePtr);
+
+ do {
+ count -= dlPtr->height;
+ if (dlPtr->nextPtr == NULL) {
+ /*
+ * We've run out of pre-calculated display lines, so we have to
+ * lay them out ourselves until the end of the logical line. Here
+ * is where we could be clever and ask: what's faster, to layout
+ * all lines from here to line-end, or all lines from the original
+ * dlPtr to the line-start? We just assume the former.
+ */
+
+ TkTextIndex index;
+ int notFirst = 0;
+
+ while (1) {
+ TkTextIndexForwBytes(textPtr, &dlPtr->index,
+ dlPtr->byteCount, &index);
+ if (notFirst) {
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ }
+ if (index.linePtr != linePtr) {
+ break;
+ }
+ dlPtr = LayoutDLine(textPtr, &index);
+
+ if (tkTextDebug) {
+ char string[TK_POS_CHARS];
+
+ /*
+ * Debugging is enabled, so keep a log of all the lines
+ * whose height was recalculated. The test suite uses this
+ * information.
+ */
+
+ TkTextPrintIndex(textPtr, &index, string);
+ LOG("tk_textHeightCalc", string);
+ }
+ count -= dlPtr->height;
+ notFirst = 1;
+ }
+ break;
+ } else {
+ dlPtr = dlPtr->nextPtr;
+ }
+ } while (dlPtr->index.linePtr == linePtr);
+
+ return count;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* GetYView --
*
- * This procedure computes the fractions that indicate what's
- * visible in a text window and, optionally, evaluates a
- * Tcl script to report them to the text's associated scrollbar.
+ * This function computes the fractions that indicate what's visible in a
+ * text window and, optionally, evaluates a Tcl script to report them to
+ * the text's associated scrollbar.
*
* Results:
- * If report is zero, then the interp's result is filled in with
- * two real numbers separated by a space, giving the position of
- * the top and bottom of the window as fractions from 0 to 1, where
- * 0 means the beginning of the text and 1 means the end. If
- * report is non-zero, then the interp's result isn't modified directly,
- * but a script is evaluated in interp to report the new scroll
- * position to the scrollbar (if the scroll position hasn't changed
- * then no script is invoked).
+ * If report is zero, then the interp's result is filled in with two real
+ * numbers separated by a space, giving the position of the top and
+ * bottom of the window as fractions from 0 to 1, where 0 means the
+ * beginning of the text and 1 means the end. If report is non-zero, then
+ * the interp's result isn't modified directly, but a script is evaluated
+ * in interp to report the new scroll position to the scrollbar (if the
+ * scroll position hasn't changed then no script is invoked).
*
* Side effects:
* None.
@@ -4008,62 +6222,171 @@ GetXView(interp, textPtr, report)
*/
static void
-GetYView(interp, textPtr, report)
- Tcl_Interp *interp; /* If "report" is FALSE, string
- * describing visible range gets
- * stored in the interp's result. */
- TkText *textPtr; /* Information about text widget. */
- int report; /* Non-zero means report info to
- * scrollbar if it has changed. */
+GetYView(
+ Tcl_Interp *interp, /* If "report" is FALSE, string describing
+ * visible range gets stored in the interp's
+ * result. */
+ TkText *textPtr, /* Information about text widget. */
+ int report) /* Non-zero means report info to scrollbar if
+ * it has changed. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- char buffer[TCL_DOUBLE_SPACE * 2 + 1];
double first, last;
DLine *dlPtr;
- int totalLines, code, count;
+ int totalPixels, code, count;
+ Tcl_Obj *listObj;
dlPtr = dInfoPtr->dLinePtr;
- totalLines = TkBTreeNumLines(textPtr->tree);
- first = (double) TkBTreeLineIndex(dlPtr->index.linePtr)
- + (double) dlPtr->index.byteIndex
- / TkBTreeBytesInLine(dlPtr->index.linePtr);
- first /= totalLines;
- while (1) {
- if ((dlPtr->y + dlPtr->height) > dInfoPtr->maxY) {
+
+ if (dlPtr == NULL) {
+ return;
+ }
+
+ totalPixels = TkBTreeNumPixels(textPtr->sharedTextPtr->tree, textPtr);
+
+ if (totalPixels == 0) {
+ first = 0.0;
+ last = 1.0;
+ } else {
+ /*
+ * Get the pixel count for the first visible pixel of the first
+ * visible line. If the first visible line is only partially visible,
+ * then we use 'topPixelOffset' to get the difference.
+ */
+
+ count = GetYPixelCount(textPtr, dlPtr);
+ first = (count + dInfoPtr->topPixelOffset) / (double) totalPixels;
+
+ /*
+ * Add on the total number of visible pixels to get the count to one
+ * pixel _past_ the last visible pixel. This is how the 'yview'
+ * command is documented, and also explains why we are dividing by
+ * 'totalPixels' and not 'totalPixels-1'.
+ */
+
+ while (1) {
+ int extra;
+
+ count += dlPtr->height;
+ extra = dlPtr->y + dlPtr->height - dInfoPtr->maxY;
+ if (extra > 0) {
+ /*
+ * This much of the last line is not visible, so don't count
+ * these pixels. Since we've reached the bottom of the window,
+ * we break out of the loop.
+ */
+
+ count -= extra;
+ break;
+ }
+ if (dlPtr->nextPtr == NULL) {
+ break;
+ }
+ dlPtr = dlPtr->nextPtr;
+ }
+
+ if (count > totalPixels) {
/*
- * The last line is only partially visible, so don't
- * count its characters in what's visible.
+ * It can be possible, if we do not update each line's pixelHeight
+ * cache when we lay out individual DLines that the count
+ * generated here is more up-to-date than that maintained by the
+ * BTree. In such a case, the best we can do here is to fix up
+ * 'count' and continue, which might result in small, temporary
+ * perturbations to the size of the scrollbar. This is basically
+ * harmless, but in a perfect world we would not have this
+ * problem.
+ *
+ * For debugging purposes, if anyone wishes to improve the text
+ * widget further, the following 'panic' can be activated. In
+ * principle it should be possible to ensure the BTree is always
+ * at least as up to date as the display, so in the future we
+ * might be able to leave the 'panic' in permanently when we
+ * believe we have resolved the cache synchronisation issue.
+ *
+ * However, to achieve that goal would, I think, require a fairly
+ * substantial refactorisation of the code in this file so that
+ * there is much more obvious and explicit coordination between
+ * calls to LayoutDLine and updating of each TkTextLine's
+ * pixelHeight. The complicated bit is that LayoutDLine deals with
+ * individual display lines, but pixelHeight is for a logical
+ * line.
*/
- count = 0;
- break;
- }
- if (dlPtr->nextPtr == NULL) {
- count = dlPtr->byteCount;
- break;
+
+#if 0
+ Tcl_Panic("Counted more pixels (%d) than expected (%d) total "
+ "pixels in text widget scroll bar calculation.", count,
+ totalPixels);
+#endif
+ count = totalPixels;
}
- dlPtr = dlPtr->nextPtr;
+
+ last = ((double) count)/((double)totalPixels);
}
- last = ((double) TkBTreeLineIndex(dlPtr->index.linePtr))
- + ((double) (dlPtr->index.byteIndex + count))
- / (TkBTreeBytesInLine(dlPtr->index.linePtr));
- last /= totalLines;
+
if (!report) {
- sprintf(buffer, "%g %g", first, last);
- Tcl_SetResult(interp, buffer, TCL_VOLATILE);
+ listObj = Tcl_NewListObj(0,NULL);
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewDoubleObj(first));
+ Tcl_ListObjAppendElement(interp, listObj, Tcl_NewDoubleObj(last));
+ Tcl_SetObjResult(interp, listObj);
return;
}
- if (FP_EQUAL_SCALE(first, dInfoPtr->yScrollFirst, totalLines) &&
- FP_EQUAL_SCALE(last, dInfoPtr->yScrollLast, totalLines)) {
+
+ if (FP_EQUAL_SCALE(first, dInfoPtr->yScrollFirst, totalPixels) &&
+ FP_EQUAL_SCALE(last, dInfoPtr->yScrollLast, totalPixels)) {
return;
}
+
dInfoPtr->yScrollFirst = first;
dInfoPtr->yScrollLast = last;
- sprintf(buffer, " %g %g", first, last);
- code = Tcl_VarEval(interp, textPtr->yScrollCmd, buffer, (char *) NULL);
- if (code != TCL_OK) {
- Tcl_AddErrorInfo(interp,
- "\n (vertical scrolling command executed by text)");
- Tcl_BackgroundError(interp);
+ if (textPtr->yScrollCmd != NULL) {
+ char buf1[TCL_DOUBLE_SPACE+1];
+ char buf2[TCL_DOUBLE_SPACE+1];
+
+ buf1[0] = ' ';
+ buf2[0] = ' ';
+ Tcl_PrintDouble(NULL, first, buf1+1);
+ Tcl_PrintDouble(NULL, last, buf2+1);
+ code = Tcl_VarEval(interp, textPtr->yScrollCmd, buf1, buf2, NULL);
+ if (code != TCL_OK) {
+ Tcl_AddErrorInfo(interp,
+ "\n (vertical scrolling command executed by text)");
+ Tcl_BackgroundError(interp);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AsyncUpdateYScrollbar --
+ *
+ * This function is called to update the vertical scrollbar asychronously
+ * as the pixel height calculations progress for lines in the widget.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * See 'GetYView'. In particular the scrollbar position and size may be
+ * changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+AsyncUpdateYScrollbar(
+ ClientData clientData) /* Information about widget. */
+{
+ register TkText *textPtr = (TkText *) clientData;
+
+ textPtr->dInfoPtr->scrollbarTimer = NULL;
+
+ if (!(textPtr->flags & DESTROYED)) {
+ GetYView(textPtr->interp, textPtr, 1);
+ }
+
+ if (--textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
}
}
@@ -4072,14 +6395,13 @@ GetYView(interp, textPtr, report)
*
* FindDLine --
*
- * This procedure is called to find the DLine corresponding to a
- * given text index.
+ * This function is called to find the DLine corresponding to a given
+ * text index.
*
* Results:
- * The return value is a pointer to the first DLine found in the
- * list headed by dlPtr that displays information at or after the
- * specified position. If there is no such line in the list then
- * NULL is returned.
+ * The return value is a pointer to the first DLine found in the list
+ * headed by dlPtr that displays information at or after the specified
+ * position. If there is no such line in the list then NULL is returned.
*
* Side effects:
* None.
@@ -4088,21 +6410,22 @@ GetYView(interp, textPtr, report)
*/
static DLine *
-FindDLine(dlPtr, indexPtr)
- register DLine *dlPtr; /* Pointer to first in list of DLines
- * to search. */
- TkTextIndex *indexPtr; /* Index of desired character. */
+FindDLine(
+ register DLine *dlPtr, /* Pointer to first in list of DLines to
+ * search. */
+ CONST TkTextIndex *indexPtr)/* Index of desired character. */
{
TkTextLine *linePtr;
if (dlPtr == NULL) {
return NULL;
}
- if (TkBTreeLineIndex(indexPtr->linePtr)
- < TkBTreeLineIndex(dlPtr->index.linePtr)) {
+ if (TkBTreeLinesTo(NULL, indexPtr->linePtr)
+ < TkBTreeLinesTo(NULL, dlPtr->index.linePtr)) {
/*
* The first display line is already past the desired line.
*/
+
return dlPtr;
}
@@ -4118,9 +6441,15 @@ FindDLine(dlPtr, indexPtr)
return NULL;
}
}
- linePtr = TkBTreeNextLine(linePtr);
+
+ /*
+ * VMD: some concern here as to whether this logic, or the caller's
+ * logic will work well with partial peer widgets.
+ */
+
+ linePtr = TkBTreeNextLine(NULL, linePtr);
if (linePtr == NULL) {
- panic("FindDLine reached end of text");
+ Tcl_Panic("FindDLine reached end of text");
}
}
if (indexPtr->linePtr != dlPtr->index.linePtr) {
@@ -4131,7 +6460,7 @@ FindDLine(dlPtr, indexPtr)
* Now get to the right position within the text line.
*/
- while (indexPtr->byteIndex >= (dlPtr->index.byteIndex + dlPtr->byteCount)) {
+ while (indexPtr->byteIndex >= (dlPtr->index.byteIndex+dlPtr->byteCount)) {
dlPtr = dlPtr->nextPtr;
if ((dlPtr == NULL) || (dlPtr->index.linePtr != indexPtr->linePtr)) {
break;
@@ -4145,12 +6474,12 @@ FindDLine(dlPtr, indexPtr)
*
* TkTextPixelIndex --
*
- * Given an (x,y) coordinate on the screen, find the location of
- * the character closest to that location.
+ * Given an (x,y) coordinate on the screen, find the location of the
+ * character closest to that location.
*
* Results:
- * The index at *indexPtr is modified to refer to the character
- * on the display that is closest to (x,y).
+ * The index at *indexPtr is modified to refer to the character on the
+ * display that is closest to (x,y).
*
* Side effects:
* None.
@@ -4159,20 +6488,24 @@ FindDLine(dlPtr, indexPtr)
*/
void
-TkTextPixelIndex(textPtr, x, y, indexPtr)
- TkText *textPtr; /* Widget record for text widget. */
- int x, y; /* Pixel coordinates of point in widget's
+TkTextPixelIndex(
+ TkText *textPtr, /* Widget record for text widget. */
+ int x, int y, /* Pixel coordinates of point in widget's
* window. */
- TkTextIndex *indexPtr; /* This index gets filled in with the
- * index of the character nearest to (x,y). */
+ TkTextIndex *indexPtr, /* This index gets filled in with the index of
+ * the character nearest to (x,y). */
+ int *nearest) /* If non-NULL then gets set to 0 if (x,y) is
+ * actually over the returned index, and 1 if
+ * it is just nearby (e.g. if x,y is on the
+ * border of the widget). */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr, *validdlPtr;
- register TkTextDispChunk *chunkPtr;
+ register DLine *dlPtr, *validDlPtr;
+ int nearby = 0;
/*
- * Make sure that all of the layout information about what's
- * displayed where on the screen is up-to-date.
+ * Make sure that all of the layout information about what's displayed
+ * where on the screen is up-to-date.
*/
if (dInfoPtr->flags & DINFO_OUT_OF_DATE) {
@@ -4180,72 +6513,143 @@ TkTextPixelIndex(textPtr, x, y, indexPtr)
}
/*
- * If the coordinates are above the top of the window, then adjust
- * them to refer to the upper-right corner of the window. If they're
- * off to one side or the other, then adjust to the closest side.
+ * If the coordinates are above the top of the window, then adjust them to
+ * refer to the upper-right corner of the window. If they're off to one
+ * side or the other, then adjust to the closest side.
*/
if (y < dInfoPtr->y) {
y = dInfoPtr->y;
x = dInfoPtr->x;
+ nearby = 1;
}
if (x >= dInfoPtr->maxX) {
x = dInfoPtr->maxX - 1;
+ nearby = 1;
}
if (x < dInfoPtr->x) {
x = dInfoPtr->x;
+ nearby = 1;
}
/*
* Find the display line containing the desired y-coordinate.
*/
- for (dlPtr = validdlPtr = dInfoPtr->dLinePtr; y >= (dlPtr->y + dlPtr->height);
- dlPtr = dlPtr->nextPtr) {
- if (dlPtr->chunkPtr !=NULL) validdlPtr = dlPtr;
- if (dlPtr->nextPtr == NULL) {
- /*
- * Y-coordinate is off the bottom of the displayed text.
- * Use the last character on the last line.
- */
+ if (dInfoPtr->dLinePtr == NULL) {
+ if (nearest != NULL) {
+ *nearest = 1;
+ }
+ *indexPtr = textPtr->topIndex;
+ return;
+ } else {
+ for (dlPtr = validDlPtr = dInfoPtr->dLinePtr;
+ y >= (dlPtr->y + dlPtr->height);
+ dlPtr = dlPtr->nextPtr) {
+ if (dlPtr->chunkPtr != NULL) {
+ validDlPtr = dlPtr;
+ }
+ if (dlPtr->nextPtr == NULL) {
+ /*
+ * Y-coordinate is off the bottom of the displayed text. Use
+ * the last character on the last line.
+ */
- x = dInfoPtr->maxX - 1;
- break;
+ x = dInfoPtr->maxX - 1;
+ nearby = 1;
+ break;
+ }
}
+ if (dlPtr->chunkPtr == NULL) dlPtr = validDlPtr;
}
- if (dlPtr->chunkPtr == NULL) dlPtr = validdlPtr;
- *indexPtr = dlPtr->index;
+ if (nearest != NULL) {
+ *nearest = nearby;
+ }
+
+ DlineIndexOfX(textPtr, dlPtr, x, indexPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DlineIndexOfX --
+ *
+ * Given an x coordinate in a display line, find the index of the
+ * character closest to that location.
+ *
+ * This is effectively the opposite of DlineXOfIndex.
+ *
+ * Results:
+ * The index at *indexPtr is modified to refer to the character on the
+ * display line that is closest to x.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+DlineIndexOfX(
+ TkText *textPtr, /* Widget record for text widget. */
+ DLine *dlPtr, /* Display information for this display
+ * line. */
+ int x, /* Pixel x coordinate of point in widget's
+ * window. */
+ TkTextIndex *indexPtr) /* This index gets filled in with the index of
+ * the character nearest to x. */
+{
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+ register TkTextDispChunk *chunkPtr;
/*
- * If it is still empty, we have nothing to access. [Bug 1442102]
+ * Scan through the line's chunks to find the one that contains the
+ * desired x-coordinate. Before doing this, translate the x-coordinate
+ * from the coordinate system of the window to the coordinate system of
+ * the line (to take account of x-scrolling).
*/
- if (dlPtr->chunkPtr == NULL) {
+ *indexPtr = dlPtr->index;
+ x = x - dInfoPtr->x + dInfoPtr->curXPixelOffset;
+ chunkPtr = dlPtr->chunkPtr;
+
+ if (chunkPtr == NULL || x == 0) {
+ /*
+ * This may occur if everything is elided, or if we're simply already
+ * at the beginning of the line.
+ */
+
return;
}
- /*
- * Scan through the line's chunks to find the one that contains
- * the desired x-coordinate. Before doing this, translate the
- * x-coordinate from the coordinate system of the window to the
- * coordinate system of the line (to take account of x-scrolling).
- */
+ while (x >= (chunkPtr->x + chunkPtr->width)) {
+ /*
+ * Note that this forward then backward movement of the index can be
+ * problematic at the end of the buffer (we can't move forward, and
+ * then when we move backward, we do, leading to the wrong position).
+ * Hence when x == 0 we take special action above.
+ */
- x = x - dInfoPtr->x + dInfoPtr->curPixelOffset;
- for (chunkPtr = dlPtr->chunkPtr; x >= (chunkPtr->x + chunkPtr->width);
- indexPtr->byteIndex += chunkPtr->numBytes,
- chunkPtr = chunkPtr->nextPtr) {
+ if (TkTextIndexForwBytes(NULL,indexPtr,chunkPtr->numBytes,indexPtr)) {
+ /*
+ * We've reached the end of the text.
+ */
+
+ return;
+ }
if (chunkPtr->nextPtr == NULL) {
- indexPtr->byteIndex += chunkPtr->numBytes;
- TkTextIndexBackChars(indexPtr, 1, indexPtr);
+ TkTextIndexBackChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES);
return;
}
+ chunkPtr = chunkPtr->nextPtr;
}
/*
- * If the chunk has more than one byte in it, ask it which
- * character is at the desired location.
+ * If the chunk has more than one byte in it, ask it which character is at
+ * the desired location. In this case we can manipulate
+ * 'indexPtr->byteIndex' directly, because we know we're staying inside a
+ * single logical line.
*/
if (chunkPtr->numBytes > 1) {
@@ -4256,17 +6660,119 @@ TkTextPixelIndex(textPtr, x, y, indexPtr)
/*
*----------------------------------------------------------------------
*
- * TkTextCharBbox --
+ * TkTextIndexOfX --
*
- * Given an index, find the bounding box of the screen area
- * occupied by that character.
+ * Given a logical x coordinate (i.e. distance in pixels from the
+ * beginning of the display line, not taking into account any information
+ * about the window, scrolling etc.) on the display line starting with
+ * the given index, adjust that index to refer to the object under the x
+ * coordinate.
*
* Results:
- * Zero is returned if the character is on the screen. -1
- * means the character isn't on the screen. If the return value
- * is 0, then the bounding box of the part of the character that's
- * visible on the screen is returned to *xPtr, *yPtr, *widthPtr,
- * and *heightPtr.
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkTextIndexOfX(
+ TkText *textPtr, /* Widget record for text widget. */
+ int x, /* The x coordinate for which we want the
+ * index. */
+ TkTextIndex *indexPtr) /* Index of display line start, which will be
+ * adjusted to the index under the given x
+ * coordinate. */
+{
+ DLine *dlPtr = LayoutDLine(textPtr, indexPtr);
+ DlineIndexOfX(textPtr, dlPtr, x + textPtr->dInfoPtr->x
+ - textPtr->dInfoPtr->curXPixelOffset, indexPtr);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DlineXOfIndex --
+ *
+ * Given a relative byte index on a given display line (i.e. the number
+ * of byte indices from the beginning of the given display line), find
+ * the x coordinate of that index within the abstract display line,
+ * without adjusting for the x-scroll state of the line.
+ *
+ * This is effectively the opposite of DlineIndexOfX.
+ *
+ * NB. The 'byteIndex' is relative to the display line, NOT the logical
+ * line.
+ *
+ * Results:
+ * The x coordinate.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+DlineXOfIndex(
+ TkText *textPtr, /* Widget record for text widget. */
+ DLine *dlPtr, /* Display information for this display
+ * line. */
+ int byteIndex) /* The byte index for which we want the
+ * coordinate. */
+{
+ register TkTextDispChunk *chunkPtr = dlPtr->chunkPtr;
+ int x;
+
+ if (byteIndex == 0 || chunkPtr == NULL) {
+ return 0;
+ }
+
+ /*
+ * Scan through the line's chunks to find the one that contains the
+ * desired byte index.
+ */
+
+ chunkPtr = dlPtr->chunkPtr;
+ while (byteIndex > 0) {
+ if (byteIndex < chunkPtr->numBytes) {
+ int y, width, height;
+
+ (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex,
+ dlPtr->y + dlPtr->spaceAbove,
+ dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
+ dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
+ &height);
+ break;
+ } else {
+ byteIndex -= chunkPtr->numBytes;
+ }
+ if (chunkPtr->nextPtr == NULL || byteIndex == 0) {
+ x = chunkPtr->x + chunkPtr->width;
+ break;
+ }
+ chunkPtr = chunkPtr->nextPtr;
+ }
+
+ return x;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkTextIndexBbox --
+ *
+ * Given an index, find the bounding box of the screen area occupied by
+ * the entity (character, window, image) at that index.
+ *
+ * Results:
+ * Zero is returned if the index is on the screen. -1 means the index is
+ * not on the screen. If the return value is 0, then the bounding box of
+ * the part of the index that's visible on the screen is returned to
+ * *xPtr, *yPtr, *widthPtr, and *heightPtr.
*
* Side effects:
* None.
@@ -4275,13 +6781,17 @@ TkTextPixelIndex(textPtr, x, y, indexPtr)
*/
int
-TkTextCharBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *indexPtr; /* Index of character whose bounding
- * box is desired. */
- int *xPtr, *yPtr; /* Filled with character's upper-left
+TkTextIndexBbox(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr,/* Index whose bounding box is desired. */
+ int *xPtr, int *yPtr, /* Filled with index's upper-left
* coordinate. */
- int *widthPtr, *heightPtr; /* Filled in with character's dimensions. */
+ int *widthPtr, int *heightPtr,
+ /* Filled in with index's dimensions. */
+ int *charWidthPtr) /* If the 'index' is at the end of a display
+ * line and therefore takes up a very large
+ * width, this is used to return the smaller
+ * width actually desired by the index. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *dlPtr;
@@ -4306,8 +6816,7 @@ TkTextCharBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr)
}
/*
- * Find the chunk within the line that contains the desired
- * index.
+ * Find the chunk within the line that contains the desired index.
*/
byteIndex = indexPtr->byteIndex - dlPtr->index.byteIndex;
@@ -4322,31 +6831,49 @@ TkTextCharBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr)
}
/*
- * Call a chunk-specific procedure to find the horizontal range of
- * the character within the chunk, then fill in the vertical range.
- * The x-coordinate returned by bboxProc is a coordinate within a
- * line, not a coordinate on the screen. Translate it to reflect
- * horizontal scrolling.
+ * Call a chunk-specific function to find the horizontal range of the
+ * character within the chunk, then fill in the vertical range. The
+ * x-coordinate returned by bboxProc is a coordinate within a line, not a
+ * coordinate on the screen. Translate it to reflect horizontal scrolling.
*/
- (*chunkPtr->bboxProc)(chunkPtr, byteIndex, dlPtr->y + dlPtr->spaceAbove,
+ (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex,
+ dlPtr->y + dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, xPtr, yPtr, widthPtr,
heightPtr);
- *xPtr = *xPtr + dInfoPtr->x - dInfoPtr->curPixelOffset;
- if ((byteIndex == (chunkPtr->numBytes - 1)) && (chunkPtr->nextPtr == NULL)) {
+ *xPtr = *xPtr + dInfoPtr->x - dInfoPtr->curXPixelOffset;
+ if ((byteIndex == chunkPtr->numBytes-1) && (chunkPtr->nextPtr == NULL)) {
/*
- * Last character in display line. Give it all the space up to
- * the line.
+ * Last character in display line. Give it all the space up to the
+ * line.
*/
+ if (charWidthPtr != NULL) {
+ *charWidthPtr = dInfoPtr->maxX - *xPtr;
+ }
if (*xPtr > dInfoPtr->maxX) {
*xPtr = dInfoPtr->maxX;
}
*widthPtr = dInfoPtr->maxX - *xPtr;
+ } else {
+ if (charWidthPtr != NULL) {
+ *charWidthPtr = *widthPtr;
+ }
}
- if ((*xPtr + *widthPtr) <= dInfoPtr->x) {
- return -1;
+ if (*widthPtr == 0) {
+ /*
+ * With zero width (e.g. elided text) we just need to make sure it is
+ * onscreen, where the '=' case here is ok.
+ */
+
+ if (*xPtr < dInfoPtr->x) {
+ return -1;
+ }
+ } else {
+ if ((*xPtr + *widthPtr) <= dInfoPtr->x) {
+ return -1;
+ }
}
if ((*xPtr + *widthPtr) > dInfoPtr->maxX) {
*widthPtr = dInfoPtr->maxX - *xPtr;
@@ -4368,14 +6895,14 @@ TkTextCharBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr)
*
* TkTextDLineInfo --
*
- * Given an index, return information about the display line
- * containing that character.
+ * Given an index, return information about the display line containing
+ * that character.
*
* Results:
- * Zero is returned if the character is on the screen. -1
- * means the character isn't on the screen. If the return value
- * is 0, then information is returned in the variables pointed
- * to by xPtr, yPtr, widthPtr, heightPtr, and basePtr.
+ * Zero is returned if the character is on the screen. -1 means the
+ * character isn't on the screen. If the return value is 0, then
+ * information is returned in the variables pointed to by xPtr, yPtr,
+ * widthPtr, heightPtr, and basePtr.
*
* Side effects:
* None.
@@ -4384,14 +6911,15 @@ TkTextCharBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr)
*/
int
-TkTextDLineInfo(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, basePtr)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *indexPtr; /* Index of character whose bounding
- * box is desired. */
- int *xPtr, *yPtr; /* Filled with line's upper-left
+TkTextDLineInfo(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr,/* Index of character whose bounding box is
+ * desired. */
+ int *xPtr, int *yPtr, /* Filled with line's upper-left
* coordinate. */
- int *widthPtr, *heightPtr; /* Filled in with line's dimensions. */
- int *basePtr; /* Filled in with the baseline position,
+ int *widthPtr, int *heightPtr,
+ /* Filled in with line's dimensions. */
+ int *basePtr) /* Filled in with the baseline position,
* measured as an offset down from *yPtr. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -4416,7 +6944,7 @@ TkTextDLineInfo(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, basePtr)
}
dlx = (dlPtr->chunkPtr != NULL? dlPtr->chunkPtr->x: 0);
- *xPtr = dInfoPtr->x - dInfoPtr->curPixelOffset + dlx;
+ *xPtr = dInfoPtr->x - dInfoPtr->curXPixelOffset + dlx;
*widthPtr = dlPtr->length - dlx;
*yPtr = dlPtr->y;
if ((dlPtr->y + dlPtr->height) > dInfoPtr->maxY) {
@@ -4428,37 +6956,43 @@ TkTextDLineInfo(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, basePtr)
return 0;
}
+/*
+ * Get bounding-box information about an elided chunk.
+ */
+
static void
-ElideBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int index; /* Index of desired character within
- * the chunk. */
- int y; /* Topmost pixel in area allocated
- * for this line. */
- int lineHeight; /* Height of line, in pixels. */
- int baseline; /* Location of line's baseline, in
- * pixels measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of
- * character's upper-left pixel.
- * X-coord is in same coordinate
- * system as chunkPtr->x. */
- int *widthPtr; /* Gets filled in with width of
- * character, in pixels. */
- int *heightPtr; /* Gets filled in with height of
- * character, in pixels. */
+ElideBboxProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int index, /* Index of desired character within the
+ * chunk. */
+ int y, /* Topmost pixel in area allocated for this
+ * line. */
+ int lineHeight, /* Height of line, in pixels. */
+ int baseline, /* Location of line's baseline, in pixels
+ * measured down from y. */
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
+ * upper-left pixel. X-coord is in same
+ * coordinate system as chunkPtr->x. */
+ int *widthPtr, /* Gets filled in with width of character, in
+ * pixels. */
+ int *heightPtr) /* Gets filled in with height of character, in
+ * pixels. */
{
*xPtr = chunkPtr->x;
*yPtr = y;
*widthPtr = *heightPtr = 0;
}
-
+
+/*
+ * Measure an elided chunk.
+ */
static int
-ElideMeasureProc(chunkPtr, x)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired coord. */
- int x; /* X-coordinate, in same coordinate
- * system as chunkPtr->x. */
+ElideMeasureProc(
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
+ int x) /* X-coordinate, in same coordinate system as
+ * chunkPtr->x. */
{
return 0 /*chunkPtr->numBytes - 1*/;
}
@@ -4468,45 +7002,43 @@ ElideMeasureProc(chunkPtr, x)
*
* TkTextCharLayoutProc --
*
- * This procedure is the "layoutProc" for character segments.
+ * This function is the "layoutProc" for character segments.
*
* Results:
- * If there is something to display for the chunk then a
- * non-zero value is returned and the fields of chunkPtr
- * will be filled in (see the declaration of TkTextDispChunk
- * in tkText.h for details). If zero is returned it means
- * that no characters from this chunk fit in the window.
- * If -1 is returned it means that this segment just doesn't
- * need to be displayed (never happens for text).
+ * If there is something to display for the chunk then a non-zero value
+ * is returned and the fields of chunkPtr will be filled in (see the
+ * declaration of TkTextDispChunk in tkText.h for details). If zero is
+ * returned it means that no characters from this chunk fit in the
+ * window. If -1 is returned it means that this segment just doesn't need
+ * to be displayed (never happens for text).
*
* Side effects:
- * Memory is allocated to hold additional information about
- * the chunk.
+ * Memory is allocated to hold additional information about the chunk.
*
*--------------------------------------------------------------
*/
int
-TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Index of first character to lay out
+TkTextCharLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Index of first character to lay out
* (corresponds to segPtr and offset). */
- TkTextSegment *segPtr; /* Segment being layed out. */
- int byteOffset; /* Byte offset within segment of first
+ TkTextSegment *segPtr, /* Segment being layed out. */
+ int byteOffset, /* Byte offset within segment of first
* character to consider. */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxBytes; /* Chunk must not include more than this
- * many characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int maxBytes, /* Chunk must not include more than this many
+ * characters. */
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this display line yet. */
- TkWrapMode wrapMode; /* How to handle line wrapping: TEXT_WRAPMODE_CHAR,
- * TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr;
- /* Structure to fill in with information
- * about this chunk. The x field has already
- * been set by the caller. */
+ TkWrapMode wrapMode, /* How to handle line wrapping:
+ * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
+ * TEXT_WRAPMODE_WORD. */
+ register TkTextDispChunk *chunkPtr)
+ /* Structure to fill in with information about
+ * this chunk. The x field has already been
+ * set by the caller. */
{
Tk_Font tkfont;
int nextX, bytesThatFit, count;
@@ -4514,36 +7046,80 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
char *p;
TkTextSegment *nextPtr;
Tk_FontMetrics fm;
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ const char *line;
+ int lineOffset;
+ BaseCharInfo *bciPtr;
+ Tcl_DString *baseString;
+#endif
/*
- * Figure out how many characters will fit in the space we've got.
- * Include the next character, even though it won't fit completely,
- * if any of the following is true:
- * (a) the chunk contains no characters and the display line contains
- * no characters yet (i.e. the line isn't wide enough to hold
- * even a single character).
- * (b) at least one pixel of the character is visible, we haven't
- * already exceeded the character limit, and the next character
- * is a white space character.
+ * Figure out how many characters will fit in the space we've got. Include
+ * the next character, even though it won't fit completely, if any of the
+ * following is true:
+ * (a) the chunk contains no characters and the display line contains no
+ * characters yet (i.e. the line isn't wide enough to hold even a
+ * single character).
+ * (b) at least one pixel of the character is visible, we have not
+ * already exceeded the character limit, and the next character is a
+ * white space character.
*/
p = segPtr->body.chars + byteOffset;
tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
- bytesThatFit = MeasureChars(tkfont, p, maxBytes, chunkPtr->x, maxX, 0,
- &nextX);
+
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ if (baseCharChunkPtr == NULL) {
+ baseCharChunkPtr = chunkPtr;
+ bciPtr = (BaseCharInfo *) ckalloc(sizeof(BaseCharInfo));
+ baseString = &bciPtr->baseChars;
+ Tcl_DStringInit(baseString);
+ bciPtr->width = 0;
+
+ ciPtr = &bciPtr->ci;
+ } else {
+ bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData;
+ ciPtr = (CharInfo *) ckalloc(sizeof(CharInfo));
+ baseString = &bciPtr->baseChars;
+ }
+
+ lineOffset = Tcl_DStringLength(baseString);
+ line = Tcl_DStringAppend(baseString,p,maxBytes);
+
+ chunkPtr->clientData = (ClientData) ciPtr;
+ ciPtr->baseChunkPtr = baseCharChunkPtr;
+ ciPtr->baseOffset = lineOffset;
+ ciPtr->chars = NULL;
+ ciPtr->numBytes = 0;
+
+ bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
+ lineOffset + maxBytes, lineOffset, -1, chunkPtr->x, maxX,
+ TK_ISOLATE_END, &nextX);
+#else /* !TK_LAYOUT_WITH_BASE_CHUNKS */
+ bytesThatFit = CharChunkMeasureChars(chunkPtr, p, maxBytes, 0, -1,
+ chunkPtr->x, maxX, TK_ISOLATE_END, &nextX);
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
if (bytesThatFit < maxBytes) {
if ((bytesThatFit == 0) && noCharsYet) {
Tcl_UniChar ch;
-
- bytesThatFit = MeasureChars(tkfont, p, Tcl_UtfToUniChar(p, &ch),
+ int chLen = Tcl_UtfToUniChar(p, &ch);
+
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
+ lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
+ &nextX);
+#else /* !TK_LAYOUT_WITH_BASE_CHUNKS */
+ bytesThatFit = CharChunkMeasureChars(chunkPtr, p, chLen, 0, -1,
chunkPtr->x, -1, 0, &nextX);
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
if ((nextX < maxX) && ((p[bytesThatFit] == ' ')
|| (p[bytesThatFit] == '\t'))) {
/*
- * Space characters are funny, in that they are considered
- * to fit if there is at least one pixel of space left on the
- * line. Just give the space character whatever space is left.
+ * Space characters are funny, in that they are considered to fit
+ * if there is at least one pixel of space left on the line. Just
+ * give the space character whatever space is left.
*/
nextX = maxX;
@@ -4558,16 +7134,26 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
bytesThatFit++;
}
if (bytesThatFit == 0) {
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ chunkPtr->clientData = NULL;
+ if (chunkPtr == baseCharChunkPtr) {
+ baseCharChunkPtr = NULL;
+ Tcl_DStringFree(baseString);
+ } else {
+ Tcl_DStringSetLength(baseString,lineOffset);
+ }
+ ckfree((char *) ciPtr);
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
return 0;
}
}
-
+
Tk_GetFontMetrics(tkfont, &fm);
/*
- * Fill in the chunk structure and allocate and initialize a
- * CharInfo structure. If the last character is a newline
- * then don't bother to display it.
+ * Fill in the chunk structure and allocate and initialize a CharInfo
+ * structure. If the last character is a newline then don't bother to
+ * display it.
*/
chunkPtr->displayProc = CharDisplayProc;
@@ -4580,20 +7166,41 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
chunkPtr->minHeight = 0;
chunkPtr->width = nextX - chunkPtr->x;
chunkPtr->breakIndex = -1;
- ciPtr = (CharInfo *) ckalloc((unsigned)
- (sizeof(CharInfo) - 3 + bytesThatFit));
+
+#if !TK_LAYOUT_WITH_BASE_CHUNKS
+ ciPtr = (CharInfo *)
+ ckalloc((unsigned) bytesThatFit + Tk_Offset(CharInfo, chars) + 1);
chunkPtr->clientData = (ClientData) ciPtr;
+ memcpy(ciPtr->chars, p, (unsigned) bytesThatFit);
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
ciPtr->numBytes = bytesThatFit;
- memcpy(ciPtr->chars, p, (size_t) bytesThatFit);
if (p[bytesThatFit - 1] == '\n') {
ciPtr->numBytes--;
}
+#if TK_LAYOUT_WITH_BASE_CHUNKS
/*
- * Compute a break location. If we're in word wrap mode, a
- * break can occur after any space character, or at the end of
- * the chunk if the next segment (ignoring those with zero size)
- * is not a character segment.
+ * Final update for the current base chunk data.
+ */
+
+ Tcl_DStringSetLength(baseString,lineOffset+ciPtr->numBytes);
+ bciPtr->width = nextX - baseCharChunkPtr->x;
+
+ /*
+ * Finalize the base chunk if this chunk ends in a tab, which definitly
+ * breaks the context and needs to be handled on a higher level.
+ */
+
+ if (ciPtr->numBytes > 0 && p[ciPtr->numBytes - 1] == '\t') {
+ FinalizeBaseChunk(chunkPtr);
+ }
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
+ /*
+ * Compute a break location. If we're in word wrap mode, a break can occur
+ * after any space character, or at the end of the chunk if the next
+ * segment (ignoring those with zero size) is not a character segment.
*/
if (wrapMode != TEXT_WRAPMODE_WORD) {
@@ -4601,7 +7208,7 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
} else {
for (count = bytesThatFit, p += bytesThatFit - 1; count > 0;
count--, p--) {
- if (isspace(UCHAR(*p))) {
+ if (UCHAR(*p) < 0x80 && isspace(UCHAR(*p))) {
chunkPtr->breakIndex = count;
break;
}
@@ -4622,12 +7229,112 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
}
/*
+ *---------------------------------------------------------------------------
+ *
+ * CharChunkMeasureChars --
+ *
+ * Determine the number of characters from a char chunk that will fit in
+ * the given horizontal span.
+ *
+ * This is the same as MeasureChars (which see), but in the context of a
+ * char chunk, i.e. on a higher level of abstraction. Use this function
+ * whereever possible instead of plain MeasureChars, so that the right
+ * context is used automatically.
+ *
+ * Results:
+ * The return value is the number of bytes from the range of start to end
+ * in source that fit in the span given by startX and maxX. *nextXPtr is
+ * filled in with the x-coordinate at which the first character that
+ * didn't fit would be drawn, if it were to be drawn.
+ *
+ * Side effects:
+ * None.
+ *--------------------------------------------------------------
+ */
+
+static int
+CharChunkMeasureChars(
+ TkTextDispChunk *chunkPtr, /* Chunk from which to measure. */
+ const char *chars, /* Chars to use, instead of the chunk's own.
+ * Used by the layoutproc during chunk setup.
+ * All other callers use NULL. Not
+ * NUL-terminated. */
+ int charsLen, /* Length of the "chars" parameter. */
+ int start, int end, /* The range of chars to measure inside the
+ * chunk (or inside the additional chars). */
+ int startX, /* Starting x coordinate where the measured
+ * span will begin. */
+ int maxX, /* Maximum pixel width of the span. May be -1
+ * for unlimited. */
+ int flags, /* Flags to pass to MeasureChars. */
+ int *nextXPtr) /* The function puts the newly calculated
+ * right border x-position of the span
+ * here. */
+{
+ Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
+ CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
+
+#if !TK_LAYOUT_WITH_BASE_CHUNKS
+ if (chars == NULL) {
+ chars = ciPtr->chars;
+ charsLen = ciPtr->numBytes;
+ }
+ if (end == -1) {
+ end = charsLen;
+ }
+
+ return MeasureChars(tkfont, chars, charsLen, start, end-start,
+ startX, maxX, flags, nextXPtr);
+#else
+ {
+ int xDisplacement;
+ int fit, bstart = start, bend = end;
+
+ if (chars == NULL) {
+ Tcl_DString *baseChars = &((BaseCharInfo *)
+ ciPtr->baseChunkPtr->clientData)->baseChars;
+
+ chars = Tcl_DStringValue(baseChars);
+ charsLen = Tcl_DStringLength(baseChars);
+ bstart += ciPtr->baseOffset;
+ if (bend == -1) {
+ bend = ciPtr->baseOffset + ciPtr->numBytes;
+ } else {
+ bend += ciPtr->baseOffset;
+ }
+ } else if (bend == -1) {
+ bend = charsLen;
+ }
+
+ if (bstart == ciPtr->baseOffset) {
+ xDisplacement = startX - chunkPtr->x;
+ } else {
+ int widthUntilStart = 0;
+
+ MeasureChars(tkfont, chars, charsLen, 0, bstart,
+ 0, -1, 0, &widthUntilStart);
+ xDisplacement = startX - widthUntilStart - chunkPtr->x;
+ }
+
+ fit = MeasureChars(tkfont, chars, charsLen, 0, bend,
+ ciPtr->baseChunkPtr->x + xDisplacement, maxX, flags, nextXPtr);
+
+ if (fit < bstart) {
+ return 0;
+ } else {
+ return fit - bstart;
+ }
+ }
+#endif
+}
+
+/*
*--------------------------------------------------------------
*
* CharDisplayProc --
*
- * This procedure is called to display a character chunk on
- * the screen or in an off-screen pixmap.
+ * This function is called to display a character chunk on the screen or
+ * in an off-screen pixmap.
*
* Results:
* None.
@@ -4639,26 +7346,29 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
*/
static void
-CharDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to
- * draw this chunk (may differ from
- * the x-position in the chunk because
- * of scrolling). */
- int y; /* Y-position at which to draw this
- * chunk in dst. */
- int height; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing. */
- Drawable dst; /* Pixmap or window in which to draw
- * chunk. */
- int screenY; /* Y-coordinate in text window that
- * corresponds to y. */
+CharDisplayProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
+ * chunk (may differ from the x-position in
+ * the chunk because of scrolling). */
+ int y, /* Y-position at which to draw this chunk in
+ * dst. */
+ int height, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing. */
+ Drawable dst, /* Pixmap or window in which to draw chunk. */
+ int screenY) /* Y-coordinate in text window that
+ * corresponds to y. */
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
+ const char *string;
TextStyle *stylePtr;
StyleValues *sValuePtr;
- int offsetBytes, offsetX;
+ int numBytes, offsetBytes, offsetX;
+#if TK_DRAW_IN_CONTEXT
+ BaseCharInfo *bciPtr;
+#endif /* TK_DRAW_IN_CONTEXT */
if ((x + chunkPtr->width) <= 0) {
/*
@@ -4668,31 +7378,90 @@ CharDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
return;
}
+#if TK_DRAW_IN_CONTEXT
+ bciPtr = (BaseCharInfo *) ciPtr->baseChunkPtr->clientData;
+ numBytes = Tcl_DStringLength(&bciPtr->baseChars);
+ string = Tcl_DStringValue(&bciPtr->baseChars);
+
+#elif TK_LAYOUT_WITH_BASE_CHUNKS
+ if (ciPtr->baseChunkPtr != chunkPtr) {
+ /*
+ * Without context drawing only base chunks display their foreground.
+ */
+
+ return;
+ }
+
+ numBytes = Tcl_DStringLength(&((BaseCharInfo *) ciPtr)->baseChars);
+ string = ciPtr->chars;
+
+#else /* !TK_LAYOUT_WITH_BASE_CHUNKS */
+ numBytes = ciPtr->numBytes;
+ string = ciPtr->chars;
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
stylePtr = chunkPtr->stylePtr;
sValuePtr = stylePtr->sValuePtr;
/*
- * If the text sticks out way to the left of the window, skip
- * over the characters that aren't in the visible part of the
- * window. This is essential if x is very negative (such as
- * less than 32K); otherwise overflow problems will occur
- * in servers that use 16-bit arithmetic, like X.
+ * If the text sticks out way to the left of the window, skip over the
+ * characters that aren't in the visible part of the window. This is
+ * essential if x is very negative (such as less than 32K); otherwise
+ * overflow problems will occur in servers that use 16-bit arithmetic,
+ * like X.
*/
offsetX = x;
offsetBytes = 0;
if (x < 0) {
- offsetBytes = MeasureChars(sValuePtr->tkfont, ciPtr->chars,
- ciPtr->numBytes, x, 0, x - chunkPtr->x, &offsetX);
+ offsetBytes = CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1,
+ x, 0, 0, &offsetX);
}
/*
* Draw the text, underline, and overstrike for this chunk.
*/
- if (!sValuePtr->elide && (ciPtr->numBytes > offsetBytes) && (stylePtr->fgGC != None)) {
- int numBytes = ciPtr->numBytes - offsetBytes;
- char *string = ciPtr->chars + offsetBytes;
+ if (!sValuePtr->elide && (numBytes > offsetBytes)
+ && (stylePtr->fgGC != None)) {
+#if TK_DRAW_IN_CONTEXT
+ int start = ciPtr->baseOffset + offsetBytes;
+ int len = ciPtr->numBytes - offsetBytes;
+ int xDisplacement = x - chunkPtr->x;
+
+ if ((len > 0) && (string[start + len - 1] == '\t')) {
+ len--;
+ }
+ if (len <= 0) {
+ return;
+ }
+
+ TkpDrawCharsInContext(display, dst, stylePtr->fgGC, sValuePtr->tkfont,
+ string, numBytes, start, len,
+ ciPtr->baseChunkPtr->x + xDisplacement,
+ y + baseline - sValuePtr->offset);
+
+ if (sValuePtr->underline) {
+ TkUnderlineCharsInContext(display, dst, stylePtr->fgGC,
+ sValuePtr->tkfont, string, numBytes,
+ ciPtr->baseChunkPtr->x + xDisplacement,
+ y + baseline - sValuePtr->offset,
+ start, start+len);
+ }
+ if (sValuePtr->overstrike) {
+ Tk_FontMetrics fm;
+
+ Tk_GetFontMetrics(sValuePtr->tkfont, &fm);
+ TkUnderlineCharsInContext(display, dst, stylePtr->fgGC,
+ sValuePtr->tkfont, string, numBytes,
+ ciPtr->baseChunkPtr->x + xDisplacement,
+ y + baseline - sValuePtr->offset
+ - fm.descent - (fm.ascent * 3) / 10,
+ start, start+len);
+ }
+#else /* !TK_DRAW_IN_CONTEXT */
+ string += offsetBytes;
+ numBytes -= offsetBytes;
if ((numBytes > 0) && (string[numBytes - 1] == '\t')) {
numBytes--;
@@ -4701,20 +7470,22 @@ CharDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
numBytes, offsetX, y + baseline - sValuePtr->offset);
if (sValuePtr->underline) {
Tk_UnderlineChars(display, dst, stylePtr->fgGC, sValuePtr->tkfont,
- ciPtr->chars + offsetBytes, offsetX,
- y + baseline - sValuePtr->offset, 0, numBytes);
+ string, offsetX,
+ y + baseline - sValuePtr->offset,
+ 0, numBytes);
}
if (sValuePtr->overstrike) {
Tk_FontMetrics fm;
-
+
Tk_GetFontMetrics(sValuePtr->tkfont, &fm);
Tk_UnderlineChars(display, dst, stylePtr->fgGC, sValuePtr->tkfont,
- ciPtr->chars + offsetBytes, offsetX,
+ string, offsetX,
y + baseline - sValuePtr->offset
- fm.descent - (fm.ascent * 3) / 10,
0, numBytes);
}
+#endif /* TK_DRAW_IN_CONTEXT */
}
}
@@ -4723,9 +7494,9 @@ CharDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
*
* CharUndisplayProc --
*
- * This procedure is called when a character chunk is no
- * longer going to be displayed. It frees up resources
- * that were allocated to display the chunk.
+ * This function is called when a character chunk is no longer going to
+ * be displayed. It frees up resources that were allocated to display the
+ * chunk.
*
* Results:
* None.
@@ -4737,14 +7508,40 @@ CharDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
*/
static void
-CharUndisplayProc(textPtr, chunkPtr)
- TkText *textPtr; /* Overall information about text
- * widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is about to be freed. */
+CharUndisplayProc(
+ TkText *textPtr, /* Overall information about text widget. */
+ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
- ckfree((char *) ciPtr);
+ if (ciPtr) {
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+ if (chunkPtr == ciPtr->baseChunkPtr) {
+ /*
+ * Basechunks are undisplayed first, when DLines are freed or
+ * partially freed, so this makes sure we don't access their data
+ * any more.
+ */
+
+ FreeBaseChunk(chunkPtr);
+ } else if (ciPtr->baseChunkPtr != NULL) {
+ /*
+ * When other char chunks are undisplayed, drop their characters
+ * from the base chunk. This usually happens, when they are last
+ * in a line and need to be re-layed out.
+ */
+
+ RemoveFromBaseChunk(chunkPtr);
+ }
+
+ ciPtr->baseChunkPtr = NULL;
+ ciPtr->chars = NULL;
+ ciPtr->numBytes = 0;
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
+ ckfree((char *) ciPtr);
+ chunkPtr->clientData = NULL;
+ }
}
/*
@@ -4752,12 +7549,12 @@ CharUndisplayProc(textPtr, chunkPtr)
*
* CharMeasureProc --
*
- * This procedure is called to determine which character in
- * a character chunk lies over a given x-coordinate.
+ * This function is called to determine which character in a character
+ * chunk lies over a given x-coordinate.
*
* Results:
- * The return value is the index *within the chunk* of the
- * character that covers the position given by "x".
+ * The return value is the index *within the chunk* of the character that
+ * covers the position given by "x".
*
* Side effects:
* None.
@@ -4766,17 +7563,15 @@ CharUndisplayProc(textPtr, chunkPtr)
*/
static int
-CharMeasureProc(chunkPtr, x)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired coord. */
- int x; /* X-coordinate, in same coordinate
- * system as chunkPtr->x. */
+CharMeasureProc(
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
+ int x) /* X-coordinate, in same coordinate system as
+ * chunkPtr->x. */
{
- CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
int endX;
- return MeasureChars(chunkPtr->stylePtr->sValuePtr->tkfont, ciPtr->chars,
- chunkPtr->numBytes - 1, chunkPtr->x, x, 0, &endX);
- /* CHAR OFFSET */
+ return CharChunkMeasureChars(chunkPtr, NULL, 0, 0, chunkPtr->numBytes-1,
+ chunkPtr->x, x, 0, &endX); /* CHAR OFFSET */
}
/*
@@ -4784,17 +7579,16 @@ CharMeasureProc(chunkPtr, x)
*
* CharBboxProc --
*
- * This procedure is called to compute the bounding box of
- * the area occupied by a single character.
+ * This function is called to compute the bounding box of the area
+ * occupied by a single character.
*
* Results:
- * There is no return value. *xPtr and *yPtr are filled in
- * with the coordinates of the upper left corner of the
- * character, and *widthPtr and *heightPtr are filled in with
- * the dimensions of the character in pixels. Note: not all
- * of the returned bbox is necessarily visible on the screen
- * (the rightmost part might be off-screen to the right,
- * and the bottommost part might be off-screen to the bottom).
+ * There is no return value. *xPtr and *yPtr are filled in with the
+ * coordinates of the upper left corner of the character, and *widthPtr
+ * and *heightPtr are filled in with the dimensions of the character in
+ * pixels. Note: not all of the returned bbox is necessarily visible on
+ * the screen (the rightmost part might be off-screen to the right, and
+ * the bottommost part might be off-screen to the bottom).
*
* Side effects:
* None.
@@ -4803,51 +7597,50 @@ CharMeasureProc(chunkPtr, x)
*/
static void
-CharBboxProc(chunkPtr, byteIndex, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int byteIndex; /* Byte offset of desired character
- * within the chunk. */
- int y; /* Topmost pixel in area allocated
- * for this line. */
- int lineHeight; /* Height of line, in pixels. */
- int baseline; /* Location of line's baseline, in
- * pixels measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of
- * character's upper-left pixel.
- * X-coord is in same coordinate
- * system as chunkPtr->x. */
- int *widthPtr; /* Gets filled in with width of
- * character, in pixels. */
- int *heightPtr; /* Gets filled in with height of
- * character, in pixels. */
+CharBboxProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int byteIndex, /* Byte offset of desired character within the
+ * chunk. */
+ int y, /* Topmost pixel in area allocated for this
+ * line. */
+ int lineHeight, /* Height of line, in pixels. */
+ int baseline, /* Location of line's baseline, in pixels
+ * measured down from y. */
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
+ * upper-left pixel. X-coord is in same
+ * coordinate system as chunkPtr->x. */
+ int *widthPtr, /* Gets filled in with width of character, in
+ * pixels. */
+ int *heightPtr) /* Gets filled in with height of character, in
+ * pixels. */
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
int maxX;
maxX = chunkPtr->width + chunkPtr->x;
- MeasureChars(chunkPtr->stylePtr->sValuePtr->tkfont, ciPtr->chars,
- byteIndex, chunkPtr->x, -1, 0, xPtr);
+ CharChunkMeasureChars(chunkPtr, NULL, 0, 0, byteIndex,
+ chunkPtr->x, -1, 0, xPtr);
if (byteIndex == ciPtr->numBytes) {
/*
- * This situation only happens if the last character in a line
- * is a space character, in which case it absorbs all of the
- * extra space in the line (see TkTextCharLayoutProc).
+ * This situation only happens if the last character in a line is a
+ * space character, in which case it absorbs all of the extra space in
+ * the line (see TkTextCharLayoutProc).
*/
*widthPtr = maxX - *xPtr;
} else if ((ciPtr->chars[byteIndex] == '\t')
&& (byteIndex == ciPtr->numBytes - 1)) {
/*
- * The desired character is a tab character that terminates a
- * chunk; give it all the space left in the chunk.
+ * The desired character is a tab character that terminates a chunk;
+ * give it all the space left in the chunk.
*/
*widthPtr = maxX - *xPtr;
} else {
- MeasureChars(chunkPtr->stylePtr->sValuePtr->tkfont,
- ciPtr->chars + byteIndex, 1, *xPtr, -1, 0, widthPtr);
+ CharChunkMeasureChars(chunkPtr, NULL, 0, byteIndex, byteIndex+1,
+ *xPtr, -1, 0, widthPtr);
if (*widthPtr > maxX) {
*widthPtr = maxX - *xPtr;
} else {
@@ -4863,64 +7656,73 @@ CharBboxProc(chunkPtr, byteIndex, y, lineHeight, baseline, xPtr, yPtr,
*
* AdjustForTab --
*
- * This procedure is called to move a series of chunks right
- * in order to align them with a tab stop.
+ * This function is called to move a series of chunks right in order to
+ * align them with a tab stop.
*
* Results:
* None.
*
* Side effects:
- * The width of chunkPtr gets adjusted so that it absorbs the
- * extra space due to the tab. The x locations in all the chunks
- * after chunkPtr are adjusted rightward to align with the tab
- * stop given by tabArrayPtr and index.
+ * The width of chunkPtr gets adjusted so that it absorbs the extra space
+ * due to the tab. The x locations in all the chunks after chunkPtr are
+ * adjusted rightward to align with the tab stop given by tabArrayPtr and
+ * index.
*
*----------------------------------------------------------------------
*/
static void
-AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
- TkText *textPtr; /* Information about the text widget as
- * a whole. */
- TkTextTabArray *tabArrayPtr; /* Information about the tab stops
- * that apply to this line. May be
- * NULL to indicate default tabbing
- * (every 8 chars). */
- int index; /* Index of current tab stop. */
- TkTextDispChunk *chunkPtr; /* Chunk whose last character is
- * the tab; the following chunks
- * contain information to be shifted
- * right. */
-
+AdjustForTab(
+ TkText *textPtr, /* Information about the text widget as a
+ * whole. */
+ TkTextTabArray *tabArrayPtr,/* Information about the tab stops that apply
+ * to this line. May be NULL to indicate
+ * default tabbing (every 8 chars). */
+ int index, /* Index of current tab stop. */
+ TkTextDispChunk *chunkPtr) /* Chunk whose last character is the tab; the
+ * following chunks contain information to be
+ * shifted right. */
{
int x, desired, delta, width, decimal, i, gotDigit;
TkTextDispChunk *chunkPtr2, *decimalChunkPtr;
CharInfo *ciPtr;
- int tabX, prev, spaceWidth;
- char *p;
+ int tabX, spaceWidth;
+ const char *p;
TkTextTabAlign alignment;
if (chunkPtr->nextPtr == NULL) {
/*
- * Nothing after the actual tab; just return.
+ * Nothing after the actual tab; just return.
*/
return;
}
+ x = chunkPtr->nextPtr->x;
+
/*
- * If no tab information has been given, do the usual thing:
- * round up to the next boundary of 8 average-sized characters.
+ * If no tab information has been given, assuming tab stops are at 8
+ * average-sized characters. Still ensure we respect the tabular versus
+ * wordprocessor tab style.
*/
- x = chunkPtr->nextPtr->x;
if ((tabArrayPtr == NULL) || (tabArrayPtr->numTabs == 0)) {
/*
* No tab information has been given, so use the default
* interpretation of tabs.
*/
- desired = NextTabStop(textPtr->tkfont, x, 0);
+ if (textPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) {
+ int tabWidth = Tk_TextWidth(textPtr->tkfont, "0", 1) * 8;
+ if (tabWidth == 0) {
+ tabWidth = 1;
+ }
+
+ desired = tabWidth * (index + 1);
+ } else {
+ desired = NextTabStop(textPtr->tkfont, x, 0);
+ }
+
goto update;
}
@@ -4929,19 +7731,14 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
tabX = tabArrayPtr->tabs[index].location;
} else {
/*
- * Ran out of tab stops; compute a tab position by extrapolating
- * from the last two tab positions.
+ * Ran out of tab stops; compute a tab position by extrapolating from
+ * the last two tab positions.
*/
- if (tabArrayPtr->numTabs > 1) {
- prev = tabArrayPtr->tabs[tabArrayPtr->numTabs-2].location;
- } else {
- prev = 0;
- }
+ tabX = (int) (tabArrayPtr->lastTab +
+ (index + 1 - tabArrayPtr->numTabs)*tabArrayPtr->tabIncrement +
+ 0.5);
alignment = tabArrayPtr->tabs[tabArrayPtr->numTabs-1].alignment;
- tabX = tabArrayPtr->tabs[tabArrayPtr->numTabs-1].location
- + (index + 1 - tabArrayPtr->numTabs)
- * (tabArrayPtr->tabs[tabArrayPtr->numTabs-1].location - prev);
}
if (alignment == LEFT) {
@@ -4951,8 +7748,8 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
if ((alignment == CENTER) || (alignment == RIGHT)) {
/*
- * Compute the width of all the information in the tab group,
- * then use it to pick a desired location.
+ * Compute the width of all the information in the tab group, then use
+ * it to pick a desired location.
*/
width = 0;
@@ -4969,9 +7766,9 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
}
/*
- * Must be numeric alignment. Search through the text to be
- * tabbed, looking for the last , or . before the first character
- * that isn't a number, comma, period, or sign.
+ * Must be numeric alignment. Search through the text to be tabbed,
+ * looking for the last , or . before the first character that isn't a
+ * number, comma, period, or sign.
*/
decimalChunkPtr = NULL;
@@ -4997,20 +7794,21 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
}
}
}
- endOfNumber:
+
+ endOfNumber:
if (decimalChunkPtr != NULL) {
int curX;
ciPtr = (CharInfo *) decimalChunkPtr->clientData;
- MeasureChars(decimalChunkPtr->stylePtr->sValuePtr->tkfont,
- ciPtr->chars, decimal, decimalChunkPtr->x, -1, 0, &curX);
+ CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal,
+ decimalChunkPtr->x, -1, 0, &curX);
desired = tabX - (curX - x);
goto update;
} else {
/*
- * There wasn't a decimal point. Right justify the text.
+ * There wasn't a decimal point. Right justify the text.
*/
-
+
width = 0;
for (chunkPtr2 = chunkPtr->nextPtr; chunkPtr2 != NULL;
chunkPtr2 = chunkPtr2->nextPtr) {
@@ -5020,15 +7818,14 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
}
/*
- * Shift all of the chunks to the right so that the left edge is
- * at the desired location, then expand the chunk containing the
- * tab. Be sure that the tab occupies at least the width of a
- * space character.
+ * Shift all of the chunks to the right so that the left edge is at the
+ * desired location, then expand the chunk containing the tab. Be sure
+ * that the tab occupies at least the width of a space character.
*/
- update:
+ update:
delta = desired - x;
- MeasureChars(textPtr->tkfont, " ", 1, 0, -1, 0, &spaceWidth);
+ MeasureChars(textPtr->tkfont, " ", 1, 0, 1, 0, -1, 0, &spaceWidth);
if (delta < spaceWidth) {
delta = spaceWidth;
}
@@ -5044,15 +7841,18 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
*
* SizeOfTab --
*
- * This returns an estimate of the amount of white space that will
- * be consumed by a tab.
+ * This returns an estimate of the amount of white space that will be
+ * consumed by a tab.
*
* Results:
- * The return value is the minimum number of pixels that will
- * be occupied by the index'th tab of tabArrayPtr, assuming that
- * the current position on the line is x and the end of the
- * line is maxX. For numeric tabs, this is a conservative
- * estimate. The return value is always >= 0.
+ * The return value is the minimum number of pixels that will be occupied
+ * by the next tab of tabArrayPtr, assuming that the current position on
+ * the line is x and the end of the line is maxX. The 'next tab' is
+ * determined by a combination of the current position (x) which it must
+ * be equal to or beyond, and the tab count in indexPtr.
+ *
+ * For numeric tabs, this is a conservative estimate. The return value is
+ * always >= 0.
*
* Side effects:
* None.
@@ -5061,50 +7861,88 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
*/
static int
-SizeOfTab(textPtr, tabArrayPtr, index, x, maxX)
- TkText *textPtr; /* Information about the text widget as
- * a whole. */
- TkTextTabArray *tabArrayPtr; /* Information about the tab stops
- * that apply to this line. NULL
- * means use default tabbing (every
- * 8 chars.) */
- int index; /* Index of current tab stop. */
- int x; /* Current x-location in line. Only
- * used if tabArrayPtr == NULL. */
- int maxX; /* X-location of pixel just past the
- * right edge of the line. */
+SizeOfTab(
+ TkText *textPtr, /* Information about the text widget as a
+ * whole. */
+ int tabStyle, /* One of TK_TEXT_TABSTYLE_TABULAR
+ * or TK_TEXT_TABSTYLE_WORDPROCESSOR. */
+ TkTextTabArray *tabArrayPtr,/* Information about the tab stops that apply
+ * to this line. NULL means use default
+ * tabbing (every 8 chars.) */
+ int *indexPtr, /* Contains index of previous tab stop, will
+ * be updated to reflect the number of stops
+ * used. */
+ int x, /* Current x-location in line. */
+ int maxX) /* X-location of pixel just past the right
+ * edge of the line. */
{
- int tabX, prev, result, spaceWidth;
+ int tabX, result, index, spaceWidth, tabWidth;
TkTextTabAlign alignment;
+ index = *indexPtr;
+
if ((tabArrayPtr == NULL) || (tabArrayPtr->numTabs == 0)) {
- tabX = NextTabStop(textPtr->tkfont, x, 0);
- return tabX - x;
- }
- if (index < tabArrayPtr->numTabs) {
- tabX = tabArrayPtr->tabs[index].location;
- alignment = tabArrayPtr->tabs[index].alignment;
+ /*
+ * We're using a default tab spacing of 8 characters.
+ */
+
+ tabWidth = Tk_TextWidth(textPtr->tkfont, "0", 1) * 8;
+ if (tabWidth == 0) {
+ tabWidth = 1;
+ }
} else {
+ tabWidth = 0; /* Avoid compiler error. */
+ }
+
+ do {
/*
- * Ran out of tab stops; compute a tab position by extrapolating
- * from the last two tab positions.
+ * We were given the count before this tab, so increment it first.
*/
- if (tabArrayPtr->numTabs > 1) {
- prev = tabArrayPtr->tabs[tabArrayPtr->numTabs-2].location;
+ index++;
+
+ if ((tabArrayPtr == NULL) || (tabArrayPtr->numTabs == 0)) {
+ /*
+ * We're using a default tab spacing calculated above.
+ */
+
+ tabX = tabWidth * (index + 1);
+ alignment = LEFT;
+ } else if (index < tabArrayPtr->numTabs) {
+ tabX = tabArrayPtr->tabs[index].location;
+ alignment = tabArrayPtr->tabs[index].alignment;
} else {
- prev = 0;
+ /*
+ * Ran out of tab stops; compute a tab position by extrapolating.
+ */
+
+ tabX = (int) (tabArrayPtr->lastTab
+ + (index + 1 - tabArrayPtr->numTabs)
+ * tabArrayPtr->tabIncrement + 0.5);
+ alignment = tabArrayPtr->tabs[tabArrayPtr->numTabs-1].alignment;
}
- tabX = tabArrayPtr->tabs[tabArrayPtr->numTabs-1].location
- + (index + 1 - tabArrayPtr->numTabs)
- * (tabArrayPtr->tabs[tabArrayPtr->numTabs-1].location - prev);
- alignment = tabArrayPtr->tabs[tabArrayPtr->numTabs-1].alignment;
- }
+
+ /*
+ * If this tab stop is before the current x position, then we have two
+ * cases:
+ *
+ * With 'wordprocessor' style tabs, we must obviously continue until
+ * we reach the text tab stop.
+ *
+ * With 'tabular' style tabs, we always use the index'th tab stop.
+ */
+ } while (tabX <= x && (tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR));
+
+ /*
+ * Inform our caller of how many tab stops we've used up.
+ */
+
+ *indexPtr = index;
+
if (alignment == CENTER) {
/*
- * Be very careful in the arithmetic below, because maxX may
- * be the largest positive number: watch out for integer
- * overflow.
+ * Be very careful in the arithmetic below, because maxX may be the
+ * largest positive number: watch out for integer overflow.
*/
if ((maxX-tabX) < (tabX - x)) {
@@ -5120,10 +7958,9 @@ SizeOfTab(textPtr, tabArrayPtr, index, x, maxX)
}
/*
- * Note: this treats NUMERIC alignment the same as LEFT
- * alignment, which is somewhat conservative. However, it's
- * pretty tricky at this point to figure out exactly where
- * the damn decimal point will be.
+ * Note: this treats NUMERIC alignment the same as LEFT alignment, which
+ * is somewhat conservative. However, it's pretty tricky at this point to
+ * figure out exactly where the damn decimal point will be.
*/
if (tabX > x) {
@@ -5132,8 +7969,8 @@ SizeOfTab(textPtr, tabArrayPtr, index, x, maxX)
result = 0;
}
- done:
- MeasureChars(textPtr->tkfont, " ", 1, 0, -1, 0, &spaceWidth);
+ done:
+ MeasureChars(textPtr->tkfont, " ", 1, 0, 1, 0, -1, 0, &spaceWidth);
if (result < spaceWidth) {
result = spaceWidth;
}
@@ -5145,10 +7982,10 @@ SizeOfTab(textPtr, tabArrayPtr, index, x, maxX)
*
* NextTabStop --
*
- * Given the current position, determine where the next default
- * tab stop would be located. This procedure is called when the
- * current chunk in the text has no tabs defined and so the default
- * tab spacing for the font should be used.
+ * Given the current position, determine where the next default tab stop
+ * would be located. This function is called when the current chunk in
+ * the text has no tabs defined and so the default tab spacing for the
+ * font should be used, provided we are using wordprocessor style tabs.
*
* Results:
* The location in pixels of the next tab stop.
@@ -5160,17 +7997,17 @@ SizeOfTab(textPtr, tabArrayPtr, index, x, maxX)
*/
static int
-NextTabStop(tkfont, x, tabOrigin)
- Tk_Font tkfont; /* Font in which chunk that contains tab
- * stop will be drawn. */
- int x; /* X-position in pixels where last
- * character was drawn. The next tab stop
- * occurs somewhere after this location. */
- int tabOrigin; /* The origin for tab stops. May be
- * non-zero if text has been scrolled. */
+NextTabStop(
+ Tk_Font tkfont, /* Font in which chunk that contains tab stop
+ * will be drawn. */
+ int x, /* X-position in pixels where last character
+ * was drawn. The next tab stop occurs
+ * somewhere after this location. */
+ int tabOrigin) /* The origin for tab stops. May be non-zero
+ * if text has been scrolled. */
{
int tabWidth, rem;
-
+
tabWidth = Tk_TextWidth(tkfont, "0", 1) * 8;
if (tabWidth == 0) {
tabWidth = 1;
@@ -5188,26 +8025,24 @@ NextTabStop(tkfont, x, tabOrigin)
/*
*---------------------------------------------------------------------------
*
- * MeasureChars --
+ * MeasureChars --
*
- * Determine the number of characters from the string that will fit
- * in the given horizontal span. The measurement is done under the
- * assumption that Tk_DrawTextLayout will be used to actually display
- * the characters.
+ * Determine the number of characters from the string that will fit in
+ * the given horizontal span. The measurement is done under the
+ * assumption that Tk_DrawChars will be used to actually display the
+ * characters.
*
- * If tabs are encountered in the string, they will be expanded
- * to the next tab stop, unless the TK_IGNORE_TABS flag is specified.
+ * If tabs are encountered in the string, they will be ignored (they
+ * should only occur as last character of the string anyway).
*
- * If a newline is encountered in the string, the line will be
- * broken at that point, unless the TK_NEWSLINES_NOT_SPECIAL flag
- * is specified.
+ * If a newline is encountered in the string, the line will be broken at
+ * that point.
*
* Results:
- * The return value is the number of bytes from source
- * that fit in the span given by startX and maxX. *nextXPtr
- * is filled in with the x-coordinate at which the first
- * character that didn't fit would be drawn, if it were to
- * be drawn.
+ * The return value is the number of bytes from the range of start to end
+ * in source that fit in the span given by startX and maxX. *nextXPtr is
+ * filled in with the x-coordinate at which the first character that
+ * didn't fit would be drawn, if it were to be drawn.
*
* Side effects:
* None.
@@ -5216,29 +8051,31 @@ NextTabStop(tkfont, x, tabOrigin)
*/
static int
-MeasureChars(tkfont, source, maxBytes, startX, maxX, tabOrigin, nextXPtr)
- Tk_Font tkfont; /* Font in which to draw characters. */
- CONST char *source; /* Characters to be displayed. Need not
- * be NULL-terminated. */
- int maxBytes; /* Maximum # of bytes to consider from
+MeasureChars(
+ Tk_Font tkfont, /* Font in which to draw characters. */
+ CONST char *source, /* Characters to be displayed. Need not be
+ * NULL-terminated. */
+ int maxBytes, /* Maximum # of bytes to consider from
* source. */
- int startX; /* X-position at which first character will
- * be drawn. */
- int maxX; /* Don't consider any character that would
+ int rangeStart, int rangeLength,
+ /* Range of bytes to consider in source.*/
+ int startX, /* X-position at which first character will be
+ * drawn. */
+ int maxX, /* Don't consider any character that would
* cross this x-position. */
- int tabOrigin; /* X-location that serves as "origin" for
- * tab stops. */
- int *nextXPtr; /* Return x-position of terminating
- * character here. */
+ int flags, /* Flags to pass to Tk_MeasureChars. */
+ int *nextXPtr) /* Return x-position of terminating character
+ * here. */
{
int curX, width, ch;
CONST char *special, *end, *start;
ch = 0; /* lint. */
curX = startX;
- special = source;
- end = source + maxBytes;
- for (start = source; start < end; ) {
+ start = source + rangeStart;
+ end = start + rangeLength;
+ special = start;
+ while (start < end) {
if (start >= special) {
/*
* Find the next special character in the string.
@@ -5254,14 +8091,21 @@ MeasureChars(tkfont, source, maxBytes, startX, maxX, tabOrigin, nextXPtr)
/*
* Special points at the next special character (or the end of the
- * string). Process characters between start and special.
+ * string). Process characters between start and special.
*/
if ((maxX >= 0) && (curX >= maxX)) {
break;
}
- start += Tk_MeasureChars(tkfont, start, special - start, maxX - curX,
- 0, &width);
+#if TK_DRAW_IN_CONTEXT
+ start += TkpMeasureCharsInContext(tkfont, source, maxBytes,
+ start - source, special - start,
+ maxX >= 0 ? maxX - curX : -1, flags, &width);
+#else
+ (void) maxBytes;
+ start += Tk_MeasureChars(tkfont, start, special - start,
+ maxX >= 0 ? maxX - curX : -1, flags, &width);
+#endif /* TK_DRAW_IN_CONTEXT */
curX += width;
if (start < special) {
/*
@@ -5280,5 +8124,378 @@ MeasureChars(tkfont, source, maxBytes, startX, maxX, tabOrigin, nextXPtr)
}
*nextXPtr = curX;
- return start - source;
+ return start - (source+rangeStart);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TextGetScrollInfoObj --
+ *
+ * This function is invoked to parse "xview" and "yview" scrolling
+ * commands for text widgets using the new scrolling command syntax
+ * ("moveto" or "scroll" options). It extends the public
+ * Tk_GetScrollInfoObj function with the addition of "pixels" as a valid
+ * unit alongside "pages" and "units". It is a shame the core API isn't
+ * more flexible in this regard.
+ *
+ * Results:
+ * The return value is either TKTEXT_SCROLL_MOVETO, TKTEXT_SCROLL_PAGES,
+ * TKTEXT_SCROLL_UNITS, TKTEXT_SCROLL_PIXELS or TKTEXT_SCROLL_ERROR. This
+ * indicates whether the command was successfully parsed and what form
+ * the command took. If TKTEXT_SCROLL_MOVETO, *dblPtr is filled in with
+ * the desired position; if TKTEXT_SCROLL_PAGES, TKTEXT_SCROLL_PIXELS or
+ * TKTEXT_SCROLL_UNITS, *intPtr is filled in with the number of
+ * pages/pixels/lines to move (may be negative); if TKTEXT_SCROLL_ERROR,
+ * the interp's result contains an error message.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TextGetScrollInfoObj(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ TkText *textPtr, /* Information about the text widget. */
+ int objc, /* # arguments for command. */
+ Tcl_Obj *CONST objv[], /* Arguments for command. */
+ double *dblPtr, /* Filled in with argument "moveto" option, if
+ * any. */
+ int *intPtr) /* Filled in with number of pages or lines or
+ * pixels to scroll, if any. */
+{
+ static CONST char *subcommands[] = {
+ "moveto", "scroll", NULL
+ };
+ enum viewSubcmds {
+ VIEW_MOVETO, VIEW_SCROLL
+ };
+ static CONST char *units[] = {
+ "units", "pages", "pixels", NULL
+ };
+ enum viewUnits {
+ VIEW_SCROLL_UNITS, VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS
+ };
+ int index;
+
+ if (Tcl_GetIndexFromObj(interp, objv[2], subcommands, "option", 0,
+ &index) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
+ }
+
+ switch ((enum viewSubcmds) index) {
+ case VIEW_MOVETO:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "fraction");
+ return TKTEXT_SCROLL_ERROR;
+ }
+ if (Tcl_GetDoubleFromObj(interp, objv[3], dblPtr) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
+ }
+ return TKTEXT_SCROLL_MOVETO;
+ case VIEW_SCROLL:
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "number units|pages|pixels");
+ return TKTEXT_SCROLL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[4], units, "argument", 0,
+ &index) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
+ }
+ switch ((enum viewUnits) index) {
+ case VIEW_SCROLL_PAGES:
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
+ }
+ return TKTEXT_SCROLL_PAGES;
+ case VIEW_SCROLL_PIXELS:
+ if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
+ intPtr) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
+ }
+ return TKTEXT_SCROLL_PIXELS;
+ case VIEW_SCROLL_UNITS:
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
+ }
+ return TKTEXT_SCROLL_UNITS;
+ }
+ }
+ Tcl_Panic("unexpected switch fallthrough");
+ return TKTEXT_SCROLL_ERROR;
+}
+
+#if TK_LAYOUT_WITH_BASE_CHUNKS
+/*
+ *----------------------------------------------------------------------
+ *
+ * FinalizeBaseChunk --
+ *
+ * This procedure makes sure that all the chunks of the stretch are
+ * up-to-date. It is invoked when the LayoutProc has been called for all
+ * chunks and the base chunk is stable.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The CharInfo.chars of all dependent chunks point into
+ * BaseCharInfo.baseChars for easy access (and compatibility).
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FinalizeBaseChunk(
+ TkTextDispChunk *addChunkPtr)
+ /* An additional chunk to add to the stretch,
+ * even though it may not be in the linked
+ * list yet. Used by the LayoutProc, otherwise
+ * NULL. */
+{
+ const char *baseChars;
+ TkTextDispChunk *chunkPtr;
+ CharInfo *ciPtr;
+#if TK_DRAW_IN_CONTEXT
+ int widthAdjust = 0;
+ int newwidth;
+#endif /* TK_DRAW_IN_CONTEXT */
+
+ if (baseCharChunkPtr == NULL) {
+ return;
+ }
+
+ baseChars = Tcl_DStringValue(
+ &((BaseCharInfo *) baseCharChunkPtr->clientData)->baseChars);
+
+ for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL;
+ chunkPtr = chunkPtr->nextPtr) {
+#if TK_DRAW_IN_CONTEXT
+ chunkPtr->x += widthAdjust;
+#endif /* TK_DRAW_IN_CONTEXT */
+
+ if (chunkPtr->displayProc != CharDisplayProc) {
+ continue;
+ }
+ ciPtr = (CharInfo *)chunkPtr->clientData;
+ if (ciPtr->baseChunkPtr != baseCharChunkPtr) {
+ break;
+ }
+ ciPtr->chars = baseChars + ciPtr->baseOffset;
+
+#if TK_DRAW_IN_CONTEXT
+ newwidth = 0;
+ CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
+ if (newwidth != chunkPtr->width) {
+ widthAdjust += newwidth - chunkPtr->width;
+ chunkPtr->width = newwidth;
+ }
+#endif /* TK_DRAW_IN_CONTEXT */
+ }
+
+ if (addChunkPtr != NULL) {
+ ciPtr = (CharInfo *)addChunkPtr->clientData;
+ ciPtr->chars = baseChars + ciPtr->baseOffset;
+
+#if TK_DRAW_IN_CONTEXT
+ addChunkPtr->x += widthAdjust;
+ CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0,
+ &addChunkPtr->width);
+#endif /* TK_DRAW_IN_CONTEXT */
+ }
+
+ baseCharChunkPtr = NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FreeBaseChunk --
+ *
+ * This procedure makes sure that all the chunks of the stretch are
+ * disconnected from the base chunk and the base chunk specific data is
+ * freed. It is invoked from the UndisplayProc. The procedure doesn't
+ * ckfree the base chunk clientData itself, that's up to the main
+ * UndisplayProc.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The CharInfo.chars of all dependent chunks are set to NULL. Memory
+ * that belongs specifically to the base chunk is freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FreeBaseChunk(
+ TkTextDispChunk *baseChunkPtr)
+ /* The base chunk of the stretch and head of
+ * the linked list. */
+{
+ TkTextDispChunk *chunkPtr;
+ CharInfo *ciPtr;
+
+ if (baseCharChunkPtr == baseChunkPtr) {
+ baseCharChunkPtr = NULL;
+ }
+
+ for (chunkPtr=baseChunkPtr; chunkPtr!=NULL; chunkPtr=chunkPtr->nextPtr) {
+ if (chunkPtr->undisplayProc != CharUndisplayProc) {
+ continue;
+ }
+ ciPtr = (CharInfo *) chunkPtr->clientData;
+ if (ciPtr->baseChunkPtr != baseChunkPtr) {
+ break;
+ }
+
+ ciPtr->baseChunkPtr = NULL;
+ ciPtr->chars = NULL;
+ }
+
+ Tcl_DStringFree(&((BaseCharInfo *) baseChunkPtr->clientData)->baseChars);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * IsSameFGStyle --
+ *
+ * Compare the foreground attributes of two styles. Specifically must
+ * consider: foreground color, font, font style and font decorations,
+ * elide, "offset" and foreground stipple. Do *not* consider: background
+ * color, border, relief or background stipple.
+ *
+ * If we use TkpDrawCharsInContext(), we also don't need to check
+ * foreground color, font decorations, elide, offset and foreground
+ * stipple, so all that is left is font (including font size and font
+ * style) and "offset".
+ *
+ * Results:
+ * 1 if the two styles match, 0 otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+IsSameFGStyle(
+ TextStyle *style1,
+ TextStyle *style2)
+{
+ StyleValues *sv1;
+ StyleValues *sv2;
+
+ if (style1 == style2) {
+ return 1;
+ }
+
+#if !TK_DRAW_IN_CONTEXT
+ if (
+#ifdef MAC_OSX_TK
+ !TkMacOSXCompareColors(style1->fgGC->foreground,
+ style2->fgGC->foreground)
+#else
+ style1->fgGC->foreground != style2->fgGC->foreground
+#endif
+ ) {
+ return 0;
+ }
+#endif /* !TK_DRAW_IN_CONTEXT */
+
+ sv1 = style1->sValuePtr;
+ sv2 = style2->sValuePtr;
+
+#if TK_DRAW_IN_CONTEXT
+ return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset;
+#else
+ return sv1->tkfont == sv2->tkfont
+ && sv1->underline == sv2->underline
+ && sv1->overstrike == sv2->overstrike
+ && sv1->elide == sv2->elide
+ && sv1->offset == sv2->offset
+ && sv1->fgStipple == sv1->fgStipple;
+#endif /* TK_DRAW_IN_CONTEXT */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RemoveFromBaseChunk --
+ *
+ * This procedure removes a chunk from the stretch as a result of
+ * UndisplayProc. The chunk in question should be the last in a stretch.
+ * This happens during re-layouting of the break position.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The characters that belong to this chunk are removed from the base
+ * chunk. It is assumed that LayoutProc and FinalizeBaseChunk are called
+ * next to repair any damage that this causes to the integrity of the
+ * stretch and the other chunks. For that reason the base chunk is also
+ * put into baseCharChunkPtr automatically, so that LayoutProc can resume
+ * correctly.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RemoveFromBaseChunk(
+ TkTextDispChunk *chunkPtr) /* The chunk to remove from the end of the
+ * stretch. */
+{
+ CharInfo *ciPtr;
+ BaseCharInfo *bciPtr;
+
+ if (chunkPtr->displayProc != CharDisplayProc) {
+#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS
+ fprintf(stderr,"RemoveFromBaseChunk called with wrong chunk type\n");
+#endif
+ return;
+ }
+
+ /*
+ * Reinstitute this base chunk for re-layout.
+ */
+
+ ciPtr = (CharInfo *) chunkPtr->clientData;
+ baseCharChunkPtr = ciPtr->baseChunkPtr;
+
+ /*
+ * Remove the chunk data from the base chunk data.
+ */
+
+ bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData;
+
+ if ((ciPtr->baseOffset + ciPtr->numBytes)
+ != Tcl_DStringLength(&bciPtr->baseChars)) {
+#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS
+ fprintf(stderr,"RemoveFromBaseChunk called with wrong chunk "
+ "(not last)\n");
+#endif
+ }
+
+ Tcl_DStringSetLength(&bciPtr->baseChars, ciPtr->baseOffset);
+
+ /*
+ * Invalidate the stored pixel width of the base chunk.
+ */
+
+ bciPtr->width = -1;
+}
+#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 57d444f..5d77c13 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -1,120 +1,111 @@
-/*
+/*
* tkImage.c --
*
- * This file contains code that allows images to be
- * nested inside text widgets. It also implements the "image"
- * widget command for texts.
+ * This file contains code that allows images to be nested inside text
+ * widgets. It also implements the "image" widget command for texts.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tk.h"
-#include "tkText.h"
#include "tkPort.h"
-
-/*
- * Definitions for alignment values:
- */
-
-#define ALIGN_BOTTOM 0
-#define ALIGN_CENTER 1
-#define ALIGN_TOP 2
-#define ALIGN_BASELINE 3
+#include "tkText.h"
/*
* Macro that determines the size of an embedded image segment:
*/
-#define EI_SEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
- + sizeof(TkTextEmbImage)))
+#define EI_SEG_SIZE \
+ ((unsigned) (Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)))
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static int AlignParseProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *widgRec, int offset));
-static char * AlignPrintProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-static TkTextSegment * EmbImageCleanupProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void EmbImageCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void EmbImageBboxProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int index, int y, int lineHeight, int baseline,
- int *xPtr, int *yPtr, int *widthPtr,
- int *heightPtr));
-static int EmbImageConfigure _ANSI_ARGS_((TkText *textPtr,
- TkTextSegment *eiPtr, int argc, CONST char **argv));
-static int EmbImageDeleteProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-static void EmbImageDisplayProc _ANSI_ARGS_((
+static TkTextSegment * EmbImageCleanupProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void EmbImageCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void EmbImageBboxProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr, int index, int y,
+ int lineHeight, int baseline, int *xPtr, int *yPtr,
+ int *widthPtr, int *heightPtr);
+static int EmbImageConfigure(TkText *textPtr,
+ TkTextSegment *eiPtr, int objc,
+ Tcl_Obj *const objv[]);
+static int EmbImageDeleteProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+static void EmbImageDisplayProc(TkText *textPtr,
TkTextDispChunk *chunkPtr, int x, int y,
int lineHeight, int baseline, Display *display,
- Drawable dst, int screenY));
-static int EmbImageLayoutProc _ANSI_ARGS_((TkText *textPtr,
+ Drawable dst, int screenY);
+static int EmbImageLayoutProc(TkText *textPtr,
TkTextIndex *indexPtr, TkTextSegment *segPtr,
int offset, int maxX, int maxChars,
int noCharsYet, TkWrapMode wrapMode,
- TkTextDispChunk *chunkPtr));
-static void EmbImageProc _ANSI_ARGS_((ClientData clientData,
- int x, int y, int width, int height,
- int imageWidth, int imageHeight));
+ TkTextDispChunk *chunkPtr);
+static void EmbImageProc(ClientData clientData, int x, int y,
+ int width, int height, int imageWidth,
+ int imageHeight);
/*
* The following structure declares the "embedded image" segment type.
*/
-static Tk_SegType tkTextEmbImageType = {
- "image", /* name */
- 0, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- EmbImageDeleteProc, /* deleteProc */
- EmbImageCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- EmbImageLayoutProc, /* layoutProc */
- EmbImageCheckProc /* checkProc */
+static const Tk_SegType tkTextEmbImageType = {
+ "image", /* name */
+ 0, /* leftGravity */
+ NULL, /* splitProc */
+ EmbImageDeleteProc, /* deleteProc */
+ EmbImageCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ EmbImageLayoutProc, /* layoutProc */
+ EmbImageCheckProc /* checkProc */
+};
+
+/*
+ * Definitions for alignment values:
+ */
+
+static char *alignStrings[] = {
+ "baseline", "bottom", "center", "top", NULL
};
+typedef enum {
+ ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_TOP
+} alignMode;
+
/*
* Information used for parsing image configuration options:
*/
-static Tk_CustomOption alignOption = {AlignParseProc, AlignPrintProc,
- (ClientData) NULL};
-
-static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_CUSTOM, "-align", (char *) NULL, (char *) NULL,
- "center", 0, TK_CONFIG_DONT_SET_DEFAULT, &alignOption},
- {TK_CONFIG_PIXELS, "-padx", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(TkTextEmbImage, padX),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_PIXELS, "-pady", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(TkTextEmbImage, padY),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_STRING, "-image", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextEmbImage, imageString),
- TK_CONFIG_DONT_SET_DEFAULT|TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-name", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextEmbImage, imageName),
- TK_CONFIG_DONT_SET_DEFAULT|TK_CONFIG_NULL_OK},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+static const Tk_OptionSpec optionSpecs[] = {
+ {TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
+ "center", -1, Tk_Offset(TkTextEmbImage, align),
+ 0, (ClientData) alignStrings, 0},
+ {TK_OPTION_PIXELS, "-padx", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbImage, padX), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-pady", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbImage, padY), 0, 0, 0},
+ {TK_OPTION_STRING, "-image", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbImage, imageString),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-name", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbImage, imageName),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_END}
};
+
/*
*--------------------------------------------------------------
*
* TkTextImageCmd --
*
- * This procedure implements the "image" widget command
- * for text widgets. See the user documentation for details
- * on what it does.
+ * This function implements the "image" widget command for text widgets.
+ * See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result or error.
@@ -126,100 +117,121 @@ static Tk_ConfigSpec configSpecs[] = {
*/
int
-TkTextImageCmd(textPtr, interp, argc, argv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextImageCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "image". */
+ * objv[1] is "image". */
{
- size_t length;
+ int idx;
register TkTextSegment *eiPtr;
-
- if (argc < 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " image option ?arg arg ...?\"", (char *) NULL);
+ TkTextIndex index;
+ static const char *optionStrings[] = {
+ "cget", "configure", "create", "names", NULL
+ };
+ enum opts {
+ CMD_CGET, CMD_CONF, CMD_CREATE, CMD_NAMES
+ };
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
- length = strlen(argv[2]);
- if ((strncmp(argv[2], "cget", length) == 0) && (length >= 2)) {
- TkTextIndex index;
- TkTextSegment *eiPtr;
-
- if (argc != 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " image cget index option\"",
- (char *) NULL);
+ if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings, "option", 0,
+ &idx) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch ((enum opts) idx) {
+ case CMD_CGET: {
+ Tcl_Obj *objPtr;
+
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index option");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
- eiPtr = TkTextIndexToSeg(&index, (int *) NULL);
+ eiPtr = TkTextIndexToSeg(&index, NULL);
if (eiPtr->typePtr != &tkTextEmbImageType) {
Tcl_AppendResult(interp, "no embedded image at index \"",
- argv[3], "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
return TCL_ERROR;
}
- return Tk_ConfigureValue(interp, textPtr->tkwin, configSpecs,
- (char *) &eiPtr->body.ei, argv[4], 0);
- } else if ((strncmp(argv[2], "configure", length) == 0) && (length >= 2)) {
- TkTextIndex index;
- TkTextSegment *eiPtr;
-
- if (argc < 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " image configure index ?option value ...?\"",
- (char *) NULL);
+ objPtr = Tk_GetOptionValue(interp, (char *) &eiPtr->body.ei,
+ eiPtr->body.ei.optionTable, objv[4], textPtr->tkwin);
+ if (objPtr == NULL) {
+ return TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
+ }
+ }
+ case CMD_CONF:
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
- eiPtr = TkTextIndexToSeg(&index, (int *) NULL);
+ eiPtr = TkTextIndexToSeg(&index, NULL);
if (eiPtr->typePtr != &tkTextEmbImageType) {
Tcl_AppendResult(interp, "no embedded image at index \"",
- argv[3], "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
return TCL_ERROR;
}
- if (argc == 4) {
- return Tk_ConfigureInfo(interp, textPtr->tkwin, configSpecs,
- (char *) &eiPtr->body.ei, (char *) NULL, 0);
- } else if (argc == 5) {
- return Tk_ConfigureInfo(interp, textPtr->tkwin, configSpecs,
- (char *) &eiPtr->body.ei, argv[4], 0);
+ if (objc <= 5) {
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp,
+ (char *) &eiPtr->body.ei, eiPtr->body.ei.optionTable,
+ (objc == 5) ? objv[4] : NULL, textPtr->tkwin);
+ if (objPtr == NULL) {
+ return TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
+ }
} else {
- TkTextChanged(textPtr, &index, &index);
- return EmbImageConfigure(textPtr, eiPtr, argc-4, argv+4);
+ TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
+
+ /*
+ * It's probably not true that all window configuration can change
+ * the line height, so we could be more efficient here and only
+ * call this when necessary.
+ */
+
+ TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ return EmbImageConfigure(textPtr, eiPtr, objc-4, objv+4);
}
- } else if ((strncmp(argv[2], "create", length) == 0) && (length >= 2)) {
- TkTextIndex index;
+ case CMD_CREATE: {
int lineIndex;
/*
- * Add a new image. Find where to put the new image, and
- * mark that position for redisplay.
+ * Add a new image. Find where to put the new image, and mark that
+ * position for redisplay.
*/
- if (argc < 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " image create index ?option value ...?\"",
- (char *) NULL);
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
/*
* Don't allow insertions on the last (dummy) line of the text.
*/
-
- lineIndex = TkBTreeLineIndex(index.linePtr);
- if (lineIndex == TkBTreeNumLines(textPtr->tree)) {
+
+ lineIndex = TkBTreeLinesTo(textPtr, index.linePtr);
+ if (lineIndex == TkBTreeNumLines(textPtr->sharedTextPtr->tree,
+ textPtr)) {
lineIndex--;
- TkTextMakeByteIndex(textPtr->tree, lineIndex, 1000000, &index);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineIndex, 1000000, &index);
}
/*
@@ -229,7 +241,7 @@ TkTextImageCmd(textPtr, interp, argc, argv)
eiPtr = (TkTextSegment *) ckalloc(EI_SEG_SIZE);
eiPtr->typePtr = &tkTextEmbImageType;
eiPtr->size = 1;
- eiPtr->body.ei.textPtr = textPtr;
+ eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr;
eiPtr->body.ei.linePtr = NULL;
eiPtr->body.ei.imageName = NULL;
eiPtr->body.ei.imageString = NULL;
@@ -238,42 +250,45 @@ TkTextImageCmd(textPtr, interp, argc, argv)
eiPtr->body.ei.align = ALIGN_CENTER;
eiPtr->body.ei.padX = eiPtr->body.ei.padY = 0;
eiPtr->body.ei.chunkCount = 0;
+ eiPtr->body.ei.optionTable = Tk_CreateOptionTable(interp, optionSpecs);
/*
- * Link the segment into the text widget, then configure it (delete
- * it again if the configuration fails).
+ * Link the segment into the text widget, then configure it (delete it
+ * again if the configuration fails).
*/
- TkTextChanged(textPtr, &index, &index);
+ TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
TkBTreeLinkSegment(eiPtr, &index);
- if (EmbImageConfigure(textPtr, eiPtr, argc-4, argv+4) != TCL_OK) {
+ if (EmbImageConfigure(textPtr, eiPtr, objc-4, objv+4) != TCL_OK) {
TkTextIndex index2;
- TkTextIndexForwChars(&index, 1, &index2);
- TkBTreeDeleteChars(&index, &index2);
+ TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES);
+ TkBTreeDeleteIndexRange(textPtr->sharedTextPtr->tree, &index, &index2);
return TCL_ERROR;
}
- } else if (strncmp(argv[2], "names", length) == 0) {
+ TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ return TCL_OK;
+ }
+ case CMD_NAMES: {
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " image names\"", (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- for (hPtr = Tcl_FirstHashEntry(&textPtr->imageTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_AppendElement(interp,
- Tcl_GetHashKey(&textPtr->markTable, hPtr));
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr));
}
- } else {
- Tcl_AppendResult(interp, "bad image option \"", argv[2],
- "\": must be cget, configure, create, or names",
- (char *) NULL);
- return TCL_ERROR;
+ return TCL_OK;
}
- return TCL_OK;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
+ }
+ return TCL_ERROR;
}
/*
@@ -281,55 +296,54 @@ TkTextImageCmd(textPtr, interp, argc, argv)
*
* EmbImageConfigure --
*
- * This procedure is called to handle configuration options
- * for an embedded image, using an argc/argv list.
+ * This function is called to handle configuration options for an
+ * embedded image, using an objc/objv list.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message..
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message..
*
* Side effects:
- * Configuration information for the embedded image changes,
- * such as alignment, or name of the image.
+ * Configuration information for the embedded image changes, such as
+ * alignment, or name of the image.
*
*--------------------------------------------------------------
*/
static int
-EmbImageConfigure(textPtr, eiPtr, argc, argv)
- TkText *textPtr; /* Information about text widget that
- * contains embedded image. */
- TkTextSegment *eiPtr; /* Embedded image to be configured. */
- int argc; /* Number of strings in argv. */
- CONST char **argv; /* Array of strings describing configuration
+EmbImageConfigure(
+ TkText *textPtr, /* Information about text widget that contains
+ * embedded image. */
+ TkTextSegment *eiPtr, /* Embedded image to be configured. */
+ int objc, /* Number of strings in objv. */
+ Tcl_Obj *const objv[]) /* Array of strings describing configuration
* options. */
{
Tk_Image image;
Tcl_DString newName;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
- int new;
char *name;
int count = 0; /* The counter for picking a unique name */
int conflict = 0; /* True if we have a name conflict */
- unsigned int len; /* length of image name */
+ size_t len; /* length of image name */
- if (Tk_ConfigureWidget(textPtr->interp, textPtr->tkwin, configSpecs,
- argc, argv, (char *) &eiPtr->body.ei,TK_CONFIG_ARGV_ONLY)
- != TCL_OK) {
+ if (Tk_SetOptions(textPtr->interp, (char*)&eiPtr->body.ei,
+ eiPtr->body.ei.optionTable,
+ objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
}
/*
- * Create the image. Save the old image around and don't free it
- * until after the new one is allocated. This keeps the reference
- * count from going to zero so the image doesn't have to be recreated
- * if it hasn't changed.
+ * Create the image. Save the old image around and don't free it until
+ * after the new one is allocated. This keeps the reference count from
+ * going to zero so the image doesn't have to be recreated if it hasn't
+ * changed.
*/
if (eiPtr->body.ei.imageString != NULL) {
- image = Tk_GetImage(textPtr->interp, textPtr->tkwin, eiPtr->body.ei.imageString,
- EmbImageProc, (ClientData) eiPtr);
+ image = Tk_GetImage(textPtr->interp, textPtr->tkwin,
+ eiPtr->body.ei.imageString, EmbImageProc, (ClientData) eiPtr);
if (image == NULL) {
return TCL_ERROR;
}
@@ -345,9 +359,9 @@ EmbImageConfigure(textPtr, eiPtr, argc, argv)
return TCL_OK;
}
- /*
- * Find a unique name for this image. Use imageName (or imageString)
- * if available, otherwise tack on a #nn and use it. If a name is already
+ /*
+ * Find a unique name for this image. Use imageName (or imageString) if
+ * available, otherwise tack on a #nn and use it. If a name is already
* associated with this image, delete the name.
*/
@@ -356,42 +370,50 @@ EmbImageConfigure(textPtr, eiPtr, argc, argv)
name = eiPtr->body.ei.imageString;
}
if (name == NULL) {
- Tcl_AppendResult(textPtr->interp,"Either a \"-name\" ",
+ Tcl_AppendResult(textPtr->interp, "Either a \"-name\" ",
"or a \"-image\" argument must be provided ",
- "to the \"image create\" subcommand.",
- (char *) NULL);
+ "to the \"image create\" subcommand.", NULL);
return TCL_ERROR;
}
len = strlen(name);
- for (hPtr = Tcl_FirstHashEntry(&textPtr->imageTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- char *haveName = Tcl_GetHashKey(&textPtr->imageTable, hPtr);
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ char *haveName =
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->imageTable, hPtr);
+
if (strncmp(name, haveName, len) == 0) {
- new = 0;
- sscanf(haveName+len,"#%d",&new);
- if (new > count) {
- count = new;
+ int newVal = 0;
+
+ sscanf(haveName+len, "#%d", &newVal);
+ if (newVal > count) {
+ count = newVal;
}
- if (len == (int) strlen(haveName)) {
+ if (len == strlen(haveName)) {
conflict = 1;
}
}
}
Tcl_DStringInit(&newName);
- Tcl_DStringAppend(&newName,name, -1);
+ Tcl_DStringAppend(&newName, name, -1);
if (conflict) {
char buf[4 + TCL_INTEGER_SPACE];
- sprintf(buf, "#%d",count+1);
- Tcl_DStringAppend(&newName,buf, -1);
+
+ sprintf(buf, "#%d", count+1);
+ Tcl_DStringAppend(&newName, buf, -1);
}
name = Tcl_DStringValue(&newName);
- hPtr = Tcl_CreateHashEntry(&textPtr->imageTable, name, &new);
+ {
+ int dummy;
+
+ hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->imageTable, name,
+ &dummy);
+ }
Tcl_SetHashValue(hPtr, eiPtr);
- Tcl_AppendResult(textPtr->interp, name , (char *) NULL);
+ Tcl_AppendResult(textPtr->interp, name, NULL);
eiPtr->body.ei.name = ckalloc((unsigned) Tcl_DStringLength(&newName)+1);
- strcpy(eiPtr->body.ei.name,name);
+ strcpy(eiPtr->body.ei.name, name);
Tcl_DStringFree(&newName);
return TCL_OK;
@@ -400,103 +422,10 @@ EmbImageConfigure(textPtr, eiPtr, argc, argv)
/*
*--------------------------------------------------------------
*
- * AlignParseProc --
- *
- * This procedure is invoked by Tk_ConfigureWidget during
- * option processing to handle "-align" options for embedded
- * images.
- *
- * Results:
- * A standard Tcl return value.
- *
- * Side effects:
- * The alignment for the embedded image may change.
- *
- *--------------------------------------------------------------
- */
-
- /* ARGSUSED */
-static int
-AlignParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* Not used.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window for text widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to TkTextEmbWindow
- * structure. */
- int offset; /* Offset into item (ignored). */
-{
- register TkTextEmbImage *embPtr = (TkTextEmbImage *) widgRec;
-
- if (strcmp(value, "baseline") == 0) {
- embPtr->align = ALIGN_BASELINE;
- } else if (strcmp(value, "bottom") == 0) {
- embPtr->align = ALIGN_BOTTOM;
- } else if (strcmp(value, "center") == 0) {
- embPtr->align = ALIGN_CENTER;
- } else if (strcmp(value, "top") == 0) {
- embPtr->align = ALIGN_TOP;
- } else {
- Tcl_AppendResult(interp, "bad alignment \"", value,
- "\": must be baseline, bottom, center, or top",
- (char *) NULL);
- return TCL_ERROR;
- }
- return TCL_OK;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * AlignPrintProc --
- *
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-align" configuration
- * option for embedded images.
- *
- * Results:
- * The return value is a string describing the embedded
- * images's current alignment.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
- /* ARGSUSED */
-static char *
-AlignPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window for text widget. */
- char *widgRec; /* Pointer to TkTextEmbImage
- * structure. */
- int offset; /* Ignored. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
-{
- switch (((TkTextEmbImage *) widgRec)->align) {
- case ALIGN_BASELINE:
- return "baseline";
- case ALIGN_BOTTOM:
- return "bottom";
- case ALIGN_CENTER:
- return "center";
- case ALIGN_TOP:
- return "top";
- default:
- return "??";
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
* EmbImageDeleteProc --
*
- * This procedure is invoked by the text B-tree code whenever
- * an embedded image lies in a range of characters being deleted.
+ * This function is invoked by the text B-tree code whenever an embedded
+ * image lies in a range of characters being deleted.
*
* Results:
* Returns 0 to indicate that the deletion has been accepted.
@@ -510,17 +439,17 @@ AlignPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
/* ARGSUSED */
static int
-EmbImageDeleteProc(eiPtr, linePtr, treeGone)
- TkTextSegment *eiPtr; /* Segment being deleted. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is
- * being deleted, so everything must
- * get cleaned up. */
+EmbImageDeleteProc(
+ TkTextSegment *eiPtr, /* Segment being deleted. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
+ * deleted, so everything must get cleaned
+ * up. */
{
Tcl_HashEntry *hPtr;
if (eiPtr->body.ei.image != NULL) {
- hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.textPtr->imageTable,
+ hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.sharedTextPtr->imageTable,
eiPtr->body.ei.name);
if (hPtr != NULL) {
/*
@@ -533,9 +462,15 @@ EmbImageDeleteProc(eiPtr, linePtr, treeGone)
}
Tk_FreeImage(eiPtr->body.ei.image);
}
- Tk_FreeOptions(configSpecs, (char *) &eiPtr->body.ei,
- eiPtr->body.ei.textPtr->display, 0);
- if (eiPtr->body.ei.name != NULL) {
+
+ /*
+ * No need to supply a tkwin argument, since we have no window-specific
+ * options.
+ */
+
+ Tk_FreeConfigOptions((char *) &eiPtr->body.ei, eiPtr->body.ei.optionTable,
+ NULL);
+ if (eiPtr->body.ei.name) {
ckfree(eiPtr->body.ei.name);
}
ckfree((char *) eiPtr);
@@ -547,9 +482,8 @@ EmbImageDeleteProc(eiPtr, linePtr, treeGone)
*
* EmbImageCleanupProc --
*
- * This procedure is invoked by the B-tree code whenever a
- * segment containing an embedded image is moved from one
- * line to another.
+ * This function is invoked by the B-tree code whenever a segment
+ * containing an embedded image is moved from one line to another.
*
* Results:
* None.
@@ -561,9 +495,9 @@ EmbImageDeleteProc(eiPtr, linePtr, treeGone)
*/
static TkTextSegment *
-EmbImageCleanupProc(eiPtr, linePtr)
- TkTextSegment *eiPtr; /* Mark segment that's being moved. */
- TkTextLine *linePtr; /* Line that now contains segment. */
+EmbImageCleanupProc(
+ TkTextSegment *eiPtr, /* Mark segment that's being moved. */
+ TkTextLine *linePtr) /* Line that now contains segment. */
{
eiPtr->body.ei.linePtr = linePtr;
return eiPtr;
@@ -574,12 +508,11 @@ EmbImageCleanupProc(eiPtr, linePtr)
*
* EmbImageLayoutProc --
*
- * This procedure is the "layoutProc" for embedded image
- * segments.
+ * This function is the "layoutProc" for embedded image segments.
*
* Results:
- * 1 is returned to indicate that the segment should be
- * displayed. The chunkPtr structure is filled in.
+ * 1 is returned to indicate that the segment should be displayed. The
+ * chunkPtr structure is filled in.
*
* Side effects:
* None, except for filling in chunkPtr.
@@ -589,30 +522,30 @@ EmbImageCleanupProc(eiPtr, linePtr)
/*ARGSUSED*/
static int
-EmbImageLayoutProc(textPtr, indexPtr, eiPtr, offset, maxX, maxChars,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Identifies first character in chunk. */
- TkTextSegment *eiPtr; /* Segment corresponding to indexPtr. */
- int offset; /* Offset within segPtr corresponding to
+EmbImageLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */
+ int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars; /* Chunk must not include more than this
- * many characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int maxChars, /* Chunk must not include more than this many
+ * characters. */
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode; /* Wrap mode to use for line: TEXT_WRAPMODE_CHAR,
- * TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr;
- /* Structure to fill in with information
- * about this chunk. The x field has already
- * been set by the caller. */
+ TkWrapMode wrapMode, /* Wrap mode to use for line:
+ * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
+ * TEXT_WRAPMODE_WORD. */
+ register TkTextDispChunk *chunkPtr)
+ /* Structure to fill in with information about
+ * this chunk. The x field has already been
+ * set by the caller. */
{
int width, height;
if (offset != 0) {
- panic("Non-zero offset in EmbImageLayoutProc");
+ Tcl_Panic("Non-zero offset in EmbImageLayoutProc");
}
/*
@@ -637,8 +570,8 @@ EmbImageLayoutProc(textPtr, indexPtr, eiPtr, offset, maxX, maxChars,
*/
chunkPtr->displayProc = EmbImageDisplayProc;
- chunkPtr->undisplayProc = (Tk_ChunkUndisplayProc *) NULL;
- chunkPtr->measureProc = (Tk_ChunkMeasureProc *) NULL;
+ chunkPtr->undisplayProc = NULL;
+ chunkPtr->measureProc = NULL;
chunkPtr->bboxProc = EmbImageBboxProc;
chunkPtr->numBytes = 1;
if (eiPtr->body.ei.align == ALIGN_BASELINE) {
@@ -663,29 +596,30 @@ EmbImageLayoutProc(textPtr, indexPtr, eiPtr, offset, maxX, maxChars,
*
* EmbImageCheckProc --
*
- * This procedure is invoked by the B-tree code to perform
- * consistency checks on embedded images.
+ * This function is invoked by the B-tree code to perform consistency
+ * checks on embedded images.
*
* Results:
* None.
*
* Side effects:
- * The procedure panics if it detects anything wrong with
- * the embedded image.
+ * The function panics if it detects anything wrong with the embedded
+ * image.
*
*--------------------------------------------------------------
*/
static void
-EmbImageCheckProc(eiPtr, linePtr)
- TkTextSegment *eiPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+EmbImageCheckProc(
+ TkTextSegment *eiPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
if (eiPtr->nextPtr == NULL) {
- panic("EmbImageCheckProc: embedded image is last segment in line");
+ Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line");
}
if (eiPtr->size != 1) {
- panic("EmbImageCheckProc: embedded image has size %d", eiPtr->size);
+ Tcl_Panic("EmbImageCheckProc: embedded image has size %d",
+ eiPtr->size);
}
}
@@ -694,37 +628,35 @@ EmbImageCheckProc(eiPtr, linePtr)
*
* EmbImageDisplayProc --
*
- * This procedure is invoked by the text displaying code
- * when it is time to actually draw an embedded image
- * chunk on the screen.
+ * This function is invoked by the text displaying code when it is time
+ * to actually draw an embedded image chunk on the screen.
*
* Results:
* None.
*
* Side effects:
- * The embedded image gets moved to the correct location
- * and drawn onto the display.
+ * The embedded image gets moved to the correct location and drawn onto
+ * the display.
*
*--------------------------------------------------------------
*/
static void
-EmbImageDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to
- * draw this chunk (differs from
- * the x-position in the chunk because
- * of scrolling). */
- int y; /* Top of rectangular bounding box
- * for line: tells where to draw this
- * chunk in dst (x-position is in
- * the chunk itself). */
- int lineHeight; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing. */
- Drawable dst; /* Pixmap or window in which to draw */
- int screenY; /* Y-coordinate in text window that
- * corresponds to y. */
+EmbImageDisplayProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
+ * chunk (differs from the x-position in the
+ * chunk because of scrolling). */
+ int y, /* Top of rectangular bounding box for line:
+ * tells where to draw this chunk in dst
+ * (x-position is in the chunk itself). */
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing. */
+ Drawable dst, /* Pixmap or window in which to draw */
+ int screenY) /* Y-coordinate in text window that
+ * corresponds to y. */
{
TkTextSegment *eiPtr = (TkTextSegment *) chunkPtr->clientData;
int lineX, imageX, imageY, width, height;
@@ -739,16 +671,15 @@ EmbImageDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
}
/*
- * Compute the image's location and size in the text widget, taking
- * into account the align value for the image.
+ * Compute the image's location and size in the text widget, taking into
+ * account the align value for the image.
*/
- EmbImageBboxProc(chunkPtr, 0, y, lineHeight, baseline, &lineX,
+ EmbImageBboxProc(textPtr, chunkPtr, 0, y, lineHeight, baseline, &lineX,
&imageY, &width, &height);
imageX = lineX - chunkPtr->x + x;
- Tk_RedrawImage(image, 0, 0, width, height, dst,
- imageX, imageY);
+ Tk_RedrawImage(image, 0, 0, width, height, dst, imageX, imageY);
}
/*
@@ -756,17 +687,16 @@ EmbImageDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
*
* EmbImageBboxProc --
*
- * This procedure is called to compute the bounding box of
- * the area occupied by an embedded image.
+ * This function is called to compute the bounding box of the area
+ * occupied by an embedded image.
*
* Results:
- * There is no return value. *xPtr and *yPtr are filled in
- * with the coordinates of the upper left corner of the
- * image, and *widthPtr and *heightPtr are filled in with
- * the dimensions of the image in pixels. Note: not all
- * of the returned bbox is necessarily visible on the screen
- * (the rightmost part might be off-screen to the right,
- * and the bottommost part might be off-screen to the bottom).
+ * There is no return value. *xPtr and *yPtr are filled in with the
+ * coordinates of the upper left corner of the image, and *widthPtr and
+ * *heightPtr are filled in with the dimensions of the image in pixels.
+ * Note: not all of the returned bbox is necessarily visible on the
+ * screen (the rightmost part might be off-screen to the right, and the
+ * bottommost part might be off-screen to the bottom).
*
* Side effects:
* None.
@@ -775,22 +705,22 @@ EmbImageDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
*/
static void
-EmbImageBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int index; /* Index of desired character within
- * the chunk. */
- int y; /* Topmost pixel in area allocated
- * for this line. */
- int lineHeight; /* Total height of line. */
- int baseline; /* Location of line's baseline, in
- * pixels measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of
- * character's upper-left pixel. */
- int *widthPtr; /* Gets filled in with width of
- * character, in pixels. */
- int *heightPtr; /* Gets filled in with height of
- * character, in pixels. */
+EmbImageBboxProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int index, /* Index of desired character within the
+ * chunk. */
+ int y, /* Topmost pixel in area allocated for this
+ * line. */
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Location of line's baseline, in pixels
+ * measured down from y. */
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
+ * upper-left pixel. */
+ int *widthPtr, /* Gets filled in with width of image, in
+ * pixels. */
+ int *heightPtr) /* Gets filled in with height of image, in
+ * pixels. */
{
TkTextSegment *eiPtr = (TkTextSegment *) chunkPtr->clientData;
Tk_Image image;
@@ -802,20 +732,22 @@ EmbImageBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
*widthPtr = 0;
*heightPtr = 0;
}
+
*xPtr = chunkPtr->x + eiPtr->body.ei.padX;
+
switch (eiPtr->body.ei.align) {
- case ALIGN_BOTTOM:
- *yPtr = y + (lineHeight - *heightPtr - eiPtr->body.ei.padY);
- break;
- case ALIGN_CENTER:
- *yPtr = y + (lineHeight - *heightPtr)/2;
- break;
- case ALIGN_TOP:
- *yPtr = y + eiPtr->body.ei.padY;
- break;
- case ALIGN_BASELINE:
- *yPtr = y + (baseline - *heightPtr);
- break;
+ case ALIGN_BOTTOM:
+ *yPtr = y + (lineHeight - *heightPtr - eiPtr->body.ei.padY);
+ break;
+ case ALIGN_CENTER:
+ *yPtr = y + (lineHeight - *heightPtr)/2;
+ break;
+ case ALIGN_TOP:
+ *yPtr = y + eiPtr->body.ei.padY;
+ break;
+ case ALIGN_BASELINE:
+ *yPtr = y + (baseline - *heightPtr);
+ break;
}
}
@@ -824,14 +756,13 @@ EmbImageBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
*
* TkTextImageIndex --
*
- * Given the name of an embedded image within a text widget,
- * returns an index corresponding to the image's position
- * in the text.
+ * Given the name of an embedded image within a text widget, returns an
+ * index corresponding to the image's position in the text.
*
* Results:
- * The return value is 1 if there is an embedded image by
- * the given name in the text widget, 0 otherwise. If the
- * image exists, *indexPtr is filled in with its index.
+ * The return value is 1 if there is an embedded image by the given name
+ * in the text widget, 0 otherwise. If the image exists, *indexPtr is
+ * filled in with its index.
*
* Side effects:
* None.
@@ -840,20 +771,20 @@ EmbImageBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
*/
int
-TkTextImageIndex(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget containing image. */
- CONST char *name; /* Name of image. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextImageIndex(
+ TkText *textPtr, /* Text widget containing image. */
+ const char *name, /* Name of image. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
Tcl_HashEntry *hPtr;
TkTextSegment *eiPtr;
- hPtr = Tcl_FindHashEntry(&textPtr->imageTable, name);
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name);
if (hPtr == NULL) {
return 0;
}
eiPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
- indexPtr->tree = textPtr->tree;
+ indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = eiPtr->body.ei.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr);
return 1;
@@ -864,8 +795,8 @@ TkTextImageIndex(textPtr, name, indexPtr)
*
* EmbImageProc --
*
- * This procedure is called by the image code whenever an
- * image or its contents changes.
+ * This function is called by the image code whenever an image or its
+ * contents changes.
*
* Results:
* None.
@@ -877,20 +808,37 @@ TkTextImageIndex(textPtr, name, indexPtr)
*/
static void
-EmbImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
- ClientData clientData; /* Pointer to widget record. */
- int x, y; /* Upper left pixel (within image)
- * that must be redisplayed. */
- int width, height; /* Dimensions of area to redisplay
- * (may be <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+EmbImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
+ * be redisplayed. */
+ int width, int height, /* Dimensions of area to redisplay (may be
+ * <= 0). */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
TkTextSegment *eiPtr = (TkTextSegment *) clientData;
TkTextIndex index;
- index.tree = eiPtr->body.ei.textPtr->tree;
+ index.tree = eiPtr->body.ei.sharedTextPtr->tree;
index.linePtr = eiPtr->body.ei.linePtr;
index.byteIndex = TkTextSegToOffset(eiPtr, eiPtr->body.ei.linePtr);
- TkTextChanged(eiPtr->body.ei.textPtr, &index, &index);
+ TkTextChanged(eiPtr->body.ei.sharedTextPtr, NULL, &index, &index);
+
+ /*
+ * It's probably not true that all image changes can change the line
+ * height, so we could be more efficient here and only call this when
+ * necessary.
+ */
+
+ TkTextInvalidateLineMetrics(eiPtr->body.ei.sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 7cfeaea..a9b0bed 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -1,18 +1,17 @@
-/*
+/*
* tkTextIndex.c --
*
- * This module provides procedures that manipulate indices for
- * text widgets.
+ * This module provides functions that manipulate indices for text
+ * widgets.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "default.h"
-#include "tkPort.h"
#include "tkInt.h"
#include "tkText.h"
@@ -23,21 +22,354 @@
#define LAST_CHAR 1000000
/*
- * Forward declarations for procedures defined later in this file:
+ * Modifiers for index parsing: 'display', 'any' or nothing.
+ */
+
+#define TKINDEX_NONE 0
+#define TKINDEX_DISPLAY 1
+#define TKINDEX_ANY 2
+
+/*
+ * Forward declarations for functions defined later in this file:
+ */
+
+static CONST char * ForwBack(TkText *textPtr, CONST char *string,
+ TkTextIndex *indexPtr);
+static CONST char * StartEnd(TkText *textPtr, CONST char *string,
+ TkTextIndex *indexPtr);
+static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr,
+ TkText *textPtr, CONST char *string,
+ TkTextIndex *indexPtr, int *canCachePtr);
+
+/*
+ * The "textindex" Tcl_Obj definition:
+ */
+
+static void DupTextIndexInternalRep(Tcl_Obj *srcPtr,
+ Tcl_Obj *copyPtr);
+static void FreeTextIndexInternalRep(Tcl_Obj *listPtr);
+static int SetTextIndexFromAny(Tcl_Interp *interp,
+ Tcl_Obj *objPtr);
+static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
+
+/*
+ * Accessor macros for the "textindex" type.
+ */
+
+#define GET_TEXTINDEX(objPtr) \
+ ((TkTextIndex *) (objPtr)->internalRep.twoPtrValue.ptr1)
+#define GET_INDEXEPOCH(objPtr) \
+ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2))
+#define SET_TEXTINDEX(objPtr, indexPtr) \
+ ((objPtr)->internalRep.twoPtrValue.ptr1 = (VOID *) (indexPtr))
+#define SET_INDEXEPOCH(objPtr, epoch) \
+ ((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch))
+
+/*
+ * Define the 'textindex' object type, which Tk uses to represent indices in
+ * text widgets internally.
+ */
+
+Tcl_ObjType tkTextIndexType = {
+ "textindex", /* name */
+ FreeTextIndexInternalRep, /* freeIntRepProc */
+ DupTextIndexInternalRep, /* dupIntRepProc */
+ NULL, /* updateStringProc */
+ SetTextIndexFromAny /* setFromAnyProc */
+};
+
+static void
+FreeTextIndexInternalRep(
+ Tcl_Obj *indexObjPtr) /* TextIndex object with internal rep to
+ * free. */
+{
+ TkTextIndex *indexPtr = GET_TEXTINDEX(indexObjPtr);
+ if (indexPtr->textPtr != NULL) {
+ if (--indexPtr->textPtr->refCount == 0) {
+ /*
+ * The text widget has been deleted and we need to free it now.
+ */
+
+ ckfree((char *) (indexPtr->textPtr));
+ }
+ }
+ ckfree((char *) indexPtr);
+}
+
+static void
+DupTextIndexInternalRep(
+ Tcl_Obj *srcPtr, /* TextIndex obj with internal rep to copy. */
+ Tcl_Obj *copyPtr) /* TextIndex obj with internal rep to set. */
+{
+ int epoch;
+ TkTextIndex *dupIndexPtr, *indexPtr;
+
+ dupIndexPtr = (TkTextIndex *) ckalloc(sizeof(TkTextIndex));
+ indexPtr = GET_TEXTINDEX(srcPtr);
+ epoch = GET_INDEXEPOCH(srcPtr);
+
+ dupIndexPtr->tree = indexPtr->tree;
+ dupIndexPtr->linePtr = indexPtr->linePtr;
+ dupIndexPtr->byteIndex = indexPtr->byteIndex;
+ dupIndexPtr->textPtr = indexPtr->textPtr;
+ if (dupIndexPtr->textPtr != NULL) {
+ dupIndexPtr->textPtr->refCount++;
+ }
+ SET_TEXTINDEX(copyPtr, dupIndexPtr);
+ SET_INDEXEPOCH(copyPtr, epoch);
+ copyPtr->typePtr = &tkTextIndexType;
+}
+
+/*
+ * This will not be called except by TkTextNewIndexObj below. This is because
+ * if a TkTextIndex is no longer valid, it is not possible to regenerate the
+ * string representation.
*/
-static CONST char * ForwBack _ANSI_ARGS_((CONST char *string,
- TkTextIndex *indexPtr));
-static CONST char * StartEnd _ANSI_ARGS_((CONST char *string,
- TkTextIndex *indexPtr));
+static void
+UpdateStringOfTextIndex(
+ Tcl_Obj *objPtr)
+{
+ char buffer[TK_POS_CHARS];
+ register int len;
+
+ CONST TkTextIndex *indexPtr = GET_TEXTINDEX(objPtr);
+
+ len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer);
+
+ objPtr->bytes = ckalloc((unsigned) len + 1);
+ strcpy(objPtr->bytes, buffer);
+ objPtr->length = len;
+}
+
+static int
+SetTextIndexFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
+{
+ Tcl_AppendToObj(Tcl_GetObjResult(interp),
+ "can't convert value to textindex except via TkTextGetIndexFromObj API",
+ -1);
+ return TCL_ERROR;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * MakeObjIndex --
+ *
+ * This function generates a Tcl_Obj description of an index, suitable
+ * for reading in again later. If the 'textPtr' is NULL then we still
+ * generate an index object, but it's internal description is deemed
+ * non-cacheable, and therefore effectively useless (apart from as a
+ * temporary memory storage). This is used for indices whose meaning is
+ * very temporary (like @0,0 or the name of a mark or tag). The mapping
+ * from such strings/objects to actual TkTextIndex pointers is not stable
+ * to minor text widget changes which we do not track (we track
+ * insertions and deletions).
+ *
+ * Results:
+ * A pointer to an allocated TkTextIndex which will be freed
+ * automatically when the Tcl_Obj is used for other purposes.
+ *
+ * Side effects:
+ * A small amount of memory is allocated.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static TkTextIndex *
+MakeObjIndex(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Obj *objPtr, /* Object containing description of
+ * position. */
+ CONST TkTextIndex *origPtr) /* Pointer to index. */
+{
+ TkTextIndex *indexPtr = (TkTextIndex *) ckalloc(sizeof(TkTextIndex));
+
+ indexPtr->tree = origPtr->tree;
+ indexPtr->linePtr = origPtr->linePtr;
+ indexPtr->byteIndex = origPtr->byteIndex;
+ SET_TEXTINDEX(objPtr, indexPtr);
+ objPtr->typePtr = &tkTextIndexType;
+ indexPtr->textPtr = textPtr;
+
+ if (textPtr != NULL) {
+ textPtr->refCount++;
+ SET_INDEXEPOCH(objPtr, textPtr->sharedTextPtr->stateEpoch);
+ } else {
+ SET_INDEXEPOCH(objPtr, 0);
+ }
+ return indexPtr;
+}
+
+CONST TkTextIndex *
+TkTextGetIndexFromObj(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Obj *objPtr) /* Object containing description of
+ * position. */
+{
+ TkTextIndex index;
+ TkTextIndex *indexPtr = NULL;
+ int cache;
+
+ if (objPtr->typePtr == &tkTextIndexType) {
+ int epoch;
+
+ indexPtr = GET_TEXTINDEX(objPtr);
+ epoch = GET_INDEXEPOCH(objPtr);
+
+ if (epoch == textPtr->sharedTextPtr->stateEpoch) {
+ if (indexPtr->textPtr == textPtr) {
+ return indexPtr;
+ }
+ }
+ }
+
+ /*
+ * The object is either not an index type or referred to a different text
+ * widget, or referred to the correct widget, but it is out of date (text
+ * has been added/deleted since).
+ */
+
+ if (GetIndex(interp, NULL, textPtr, Tcl_GetString(objPtr), &index,
+ &cache) != TCL_OK) {
+ return NULL;
+ }
+
+ if (objPtr->typePtr != NULL) {
+ if (objPtr->bytes == NULL) {
+ objPtr->typePtr->updateStringProc(objPtr);
+ }
+ if ((objPtr->typePtr->freeIntRepProc) != NULL) {
+ (*objPtr->typePtr->freeIntRepProc)(objPtr);
+ }
+ }
+
+ return MakeObjIndex((cache ? textPtr : NULL), objPtr, &index);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkTextNewIndexObj --
+ *
+ * This function generates a Tcl_Obj description of an index, suitable
+ * for reading in again later. The index generated is effectively stable
+ * to all except insertion/deletion operations on the widget.
+ *
+ * Results:
+ * A new Tcl_Obj with refCount zero.
+ *
+ * Side effects:
+ * A small amount of memory is allocated.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+Tcl_Obj *
+TkTextNewIndexObj(
+ TkText *textPtr, /* Text widget for this index */
+ CONST TkTextIndex *indexPtr)/* Pointer to index. */
+{
+ Tcl_Obj *retVal;
+
+ retVal = Tcl_NewObj();
+ retVal->bytes = NULL;
+
+ /*
+ * Assumption that the above call returns an object with:
+ * retVal->typePtr == NULL
+ */
+
+ MakeObjIndex(textPtr, retVal, indexPtr);
+
+ /*
+ * Unfortunately, it isn't possible for us to regenerate the string
+ * representation so we have to create it here, while we can be sure the
+ * contents of the index are still valid.
+ */
+
+ UpdateStringOfTextIndex(retVal);
+ return retVal;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkTextMakePixelIndex --
+ *
+ * Given a pixel index and a byte index, look things up in the B-tree and
+ * fill in a TkTextIndex structure.
+ *
+ * The valid input range for pixelIndex is from 0 to the number of pixels
+ * in the widget-1. Anything outside that range will be rounded to the
+ * closest acceptable value.
+ *
+ * Results:
+ *
+ * The structure at *indexPtr is filled in with information about the
+ * character at pixelIndex (or the closest existing character, if the
+ * specified one doesn't exist), and the number of excess pixels is
+ * returned as a result. This means if the given pixel index is exactly
+ * correct for the top-edge of the indexPtr, then zero will be returned,
+ * and otherwise we will return the calculation 'desired pixelIndex' -
+ * 'actual pixel index of indexPtr'.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkTextMakePixelIndex(
+ TkText *textPtr, /* The Text Widget */
+ int pixelIndex, /* Pixel-index of desired line (0 means first
+ * pixel of first line of text). */
+ TkTextIndex *indexPtr) /* Structure to fill in. */
+{
+ int pixelOffset = 0;
+
+ indexPtr->tree = textPtr->sharedTextPtr->tree;
+ indexPtr->textPtr = textPtr;
+
+ if (pixelIndex < 0) {
+ pixelIndex = 0;
+ }
+ indexPtr->linePtr = TkBTreeFindPixelLine(textPtr->sharedTextPtr->tree,
+ textPtr, pixelIndex, &pixelOffset);
+
+ /*
+ * 'pixelIndex' was too large, so we try again, just to find the last
+ * pixel in the window.
+ */
+
+ if (indexPtr->linePtr == NULL) {
+ int lastMinusOne = TkBTreeNumPixels(textPtr->sharedTextPtr->tree,
+ textPtr)-1;
+
+ indexPtr->linePtr = TkBTreeFindPixelLine(textPtr->sharedTextPtr->tree,
+ textPtr, lastMinusOne, &pixelOffset);
+ indexPtr->byteIndex = 0;
+ return pixelOffset;
+ }
+ indexPtr->byteIndex = 0;
+
+ if (pixelOffset <= 0) {
+ return 0;
+ }
+ return TkTextMeasureDown(textPtr, indexPtr, pixelOffset);
+}
/*
*---------------------------------------------------------------------------
*
* TkTextMakeByteIndex --
*
- * Given a line index and a byte index, look things up in the B-tree
- * and fill in a TkTextIndex structure.
+ * Given a line index and a byte index, look things up in the B-tree and
+ * fill in a TkTextIndex structure.
*
* Results:
* The structure at *indexPtr is filled in with information about the
@@ -52,13 +384,14 @@ static CONST char * StartEnd _ANSI_ARGS_((CONST char *string,
*/
TkTextIndex *
-TkTextMakeByteIndex(tree, lineIndex, byteIndex, indexPtr)
- TkTextBTree tree; /* Tree that lineIndex and charIndex refer
+TkTextMakeByteIndex(
+ TkTextBTree tree, /* Tree that lineIndex and byteIndex refer
* to. */
- int lineIndex; /* Index of desired line (0 means first
- * line of text). */
- int byteIndex; /* Byte index of desired character. */
- TkTextIndex *indexPtr; /* Structure to fill in. */
+ CONST TkText *textPtr,
+ int lineIndex, /* Index of desired line (0 means first line
+ * of text). */
+ int byteIndex, /* Byte index of desired character. */
+ TkTextIndex *indexPtr) /* Structure to fill in. */
{
TkTextSegment *segPtr;
int index;
@@ -73,9 +406,10 @@ TkTextMakeByteIndex(tree, lineIndex, byteIndex, indexPtr)
if (byteIndex < 0) {
byteIndex = 0;
}
- indexPtr->linePtr = TkBTreeFindLine(tree, lineIndex);
+ indexPtr->linePtr = TkBTreeFindLine(tree, textPtr, lineIndex);
if (indexPtr->linePtr == NULL) {
- indexPtr->linePtr = TkBTreeFindLine(tree, TkBTreeNumLines(tree));
+ indexPtr->linePtr = TkBTreeFindLine(tree, textPtr,
+ TkBTreeNumLines(tree, textPtr));
byteIndex = 0;
}
if (byteIndex == 0) {
@@ -84,19 +418,19 @@ TkTextMakeByteIndex(tree, lineIndex, byteIndex, indexPtr)
}
/*
- * Verify that the index is within the range of the line and points
- * to a valid character boundary.
+ * Verify that the index is within the range of the line and points to a
+ * valid character boundary.
*/
index = 0;
for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) {
if (segPtr == NULL) {
/*
- * Use the index of the last character in the line. Since
- * the last character on the line is guaranteed to be a '\n',
- * we can back up a constant sizeof(char) bytes.
+ * Use the index of the last character in the line. Since the last
+ * character on the line is guaranteed to be a '\n', we can back
+ * up a constant sizeof(char) bytes.
*/
-
+
indexPtr->byteIndex = index - sizeof(char);
break;
}
@@ -105,7 +439,7 @@ TkTextMakeByteIndex(tree, lineIndex, byteIndex, indexPtr)
if ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) {
/*
* Prevent UTF-8 character from being split up by ensuring
- * that byteIndex falls on a character boundary. If index
+ * that byteIndex falls on a character boundary. If index
* falls in the middle of a UTF-8 character, it will be
* adjusted to the end of that UTF-8 character.
*/
@@ -127,8 +461,8 @@ TkTextMakeByteIndex(tree, lineIndex, byteIndex, indexPtr)
*
* TkTextMakeCharIndex --
*
- * Given a line index and a character index, look things up in the
- * B-tree and fill in a TkTextIndex structure.
+ * Given a line index and a character index, look things up in the B-tree
+ * and fill in a TkTextIndex structure.
*
* Results:
* The structure at *indexPtr is filled in with information about the
@@ -143,13 +477,14 @@ TkTextMakeByteIndex(tree, lineIndex, byteIndex, indexPtr)
*/
TkTextIndex *
-TkTextMakeCharIndex(tree, lineIndex, charIndex, indexPtr)
- TkTextBTree tree; /* Tree that lineIndex and charIndex refer
+TkTextMakeCharIndex(
+ TkTextBTree tree, /* Tree that lineIndex and charIndex refer
* to. */
- int lineIndex; /* Index of desired line (0 means first
- * line of text). */
- int charIndex; /* Index of desired character. */
- TkTextIndex *indexPtr; /* Structure to fill in. */
+ TkText *textPtr,
+ int lineIndex, /* Index of desired line (0 means first line
+ * of text). */
+ int charIndex, /* Index of desired character. */
+ TkTextIndex *indexPtr) /* Structure to fill in. */
{
register TkTextSegment *segPtr;
char *p, *start, *end;
@@ -164,26 +499,27 @@ TkTextMakeCharIndex(tree, lineIndex, charIndex, indexPtr)
if (charIndex < 0) {
charIndex = 0;
}
- indexPtr->linePtr = TkBTreeFindLine(tree, lineIndex);
+ indexPtr->linePtr = TkBTreeFindLine(tree, textPtr, lineIndex);
if (indexPtr->linePtr == NULL) {
- indexPtr->linePtr = TkBTreeFindLine(tree, TkBTreeNumLines(tree));
+ indexPtr->linePtr = TkBTreeFindLine(tree, textPtr,
+ TkBTreeNumLines(tree, textPtr));
charIndex = 0;
}
/*
- * Verify that the index is within the range of the line.
- * If not, just use the index of the last character in the line.
+ * Verify that the index is within the range of the line. If not, just use
+ * the index of the last character in the line.
*/
index = 0;
for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) {
if (segPtr == NULL) {
/*
- * Use the index of the last character in the line. Since
- * the last character on the line is guaranteed to be a '\n',
- * we can back up a constant sizeof(char) bytes.
+ * Use the index of the last character in the line. Since the last
+ * character on the line is guaranteed to be a '\n', we can back
+ * up a constant sizeof(char) bytes.
*/
-
+
indexPtr->byteIndex = index - sizeof(char);
break;
}
@@ -220,14 +556,14 @@ TkTextMakeCharIndex(tree, lineIndex, charIndex, indexPtr)
*
* TkTextIndexToSeg --
*
- * Given an index, this procedure returns the segment and offset
- * within segment for the index.
+ * Given an index, this function returns the segment and offset within
+ * segment for the index.
*
* Results:
- * The return value is a pointer to the segment referred to by
- * indexPtr; this will always be a segment with non-zero size. The
- * variable at *offsetPtr is set to hold the integer offset within
- * the segment of the character given by indexPtr.
+ * The return value is a pointer to the segment referred to by indexPtr;
+ * this will always be a segment with non-zero size. The variable at
+ * *offsetPtr is set to hold the integer offset within the segment of the
+ * character given by indexPtr.
*
* Side effects:
* None.
@@ -236,9 +572,9 @@ TkTextMakeCharIndex(tree, lineIndex, charIndex, indexPtr)
*/
TkTextSegment *
-TkTextIndexToSeg(indexPtr, offsetPtr)
- CONST TkTextIndex *indexPtr;/* Text index. */
- int *offsetPtr; /* Where to store offset within segment, or
+TkTextIndexToSeg(
+ CONST TkTextIndex *indexPtr,/* Text index. */
+ int *offsetPtr) /* Where to store offset within segment, or
* NULL if offset isn't wanted. */
{
TkTextSegment *segPtr;
@@ -260,7 +596,7 @@ TkTextIndexToSeg(indexPtr, offsetPtr)
*
* TkTextSegToOffset --
*
- * Given a segment pointer and the line containing it, this procedure
+ * Given a segment pointer and the line containing it, this function
* returns the offset of the segment within its line.
*
* Results:
@@ -274,14 +610,13 @@ TkTextIndexToSeg(indexPtr, offsetPtr)
*/
int
-TkTextSegToOffset(segPtr, linePtr)
- CONST TkTextSegment *segPtr;/* Segment whose offset is desired. */
- CONST TkTextLine *linePtr; /* Line containing segPtr. */
+TkTextSegToOffset(
+ CONST TkTextSegment *segPtr,/* Segment whose offset is desired. */
+ CONST TkTextLine *linePtr) /* Line containing segPtr. */
{
CONST TkTextSegment *segPtr2;
- int offset;
+ int offset = 0;
- offset = 0;
for (segPtr2 = linePtr->segPtr; segPtr2 != segPtr;
segPtr2 = segPtr2->nextPtr) {
offset += segPtr2->size;
@@ -292,15 +627,73 @@ TkTextSegToOffset(segPtr, linePtr)
/*
*---------------------------------------------------------------------------
*
+ * TkTextGetObjIndex --
+ *
+ * Simpler wrapper around the string based function, but could be
+ * enhanced with a new object type in the future.
+ *
+ * Results:
+ * see TkTextGetIndex
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkTextGetObjIndex(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Obj *idxObj, /* Object containing textual description of
+ * position. */
+ TkTextIndex *indexPtr) /* Index structure to fill in. */
+{
+ return GetIndex(interp, NULL, textPtr, Tcl_GetString(idxObj), indexPtr,
+ NULL);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkTextSharedGetObjIndex --
+ *
+ * Simpler wrapper around the string based function, but could be
+ * enhanced with a new object type in the future.
+ *
+ * Results:
+ * see TkTextGetIndex
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkTextSharedGetObjIndex(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ TkSharedText *sharedTextPtr,/* Information about text widget. */
+ Tcl_Obj *idxObj, /* Object containing textual description of
+ * position. */
+ TkTextIndex *indexPtr) /* Index structure to fill in. */
+{
+ return GetIndex(interp, sharedTextPtr, NULL, Tcl_GetString(idxObj),
+ indexPtr, NULL);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* TkTextGetIndex --
*
* Given a string, return the index that is described.
*
* Results:
- * The return value is a standard Tcl return result. If TCL_OK is
+ * The return value is a standard Tcl return result. If TCL_OK is
* returned, then everything went well and the index at *indexPtr is
- * filled in; otherwise TCL_ERROR is returned and an error message
- * is left in the interp's result.
+ * filled in; otherwise TCL_ERROR is returned and an error message is
+ * left in the interp's result.
*
* Side effects:
* None.
@@ -309,33 +702,70 @@ TkTextSegToOffset(segPtr, linePtr)
*/
int
-TkTextGetIndex(interp, textPtr, string, indexPtr)
- Tcl_Interp *interp; /* Use this for error reporting. */
- TkText *textPtr; /* Information about text widget. */
- CONST char *string; /* Textual description of position. */
- TkTextIndex *indexPtr; /* Index structure to fill in. */
+TkTextGetIndex(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ TkText *textPtr, /* Information about text widget. */
+ CONST char *string, /* Textual description of position. */
+ TkTextIndex *indexPtr) /* Index structure to fill in. */
+{
+ return GetIndex(interp, NULL, textPtr, string, indexPtr, NULL);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetIndex --
+ *
+ * Given a string, return the index that is described.
+ *
+ * Results:
+ * The return value is a standard Tcl return result. If TCL_OK is
+ * returned, then everything went well and the index at *indexPtr is
+ * filled in; otherwise TCL_ERROR is returned and an error message is
+ * left in the interp's result.
+ *
+ * If *canCachePtr is non-NULL, and everything went well, the integer it
+ * points to is set to 1 if the indexPtr is something which can be
+ * cached, and zero otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static int
+GetIndex(
+ Tcl_Interp *interp, /* Use this for error reporting. */
+ TkSharedText *sharedPtr,
+ TkText *textPtr, /* Information about text widget. */
+ CONST char *string, /* Textual description of position. */
+ TkTextIndex *indexPtr, /* Index structure to fill in. */
+ int *canCachePtr) /* Pointer to integer to store whether we can
+ * cache the index (or NULL). */
{
char *p, *end, *endOfBase;
- Tcl_HashEntry *hPtr;
- TkTextTag *tagPtr;
- TkTextSearch search;
TkTextIndex first, last;
int wantLast, result;
char c;
CONST char *cp;
Tcl_DString copy;
+ int canCache = 0;
+
+ if (sharedPtr == NULL) {
+ sharedPtr = textPtr->sharedTextPtr;
+ }
/*
*---------------------------------------------------------------------
- * Stage 1: check to see if the index consists of nothing but a mark
- * name. We do this check now even though it's also done later, in
- * order to allow mark names that include funny characters such as
- * spaces or "+1c".
+ * Stage 1: check to see if the index consists of nothing but a mark name.
+ * We do this check now even though it's also done later, in order to
+ * allow mark names that include funny characters such as spaces or "+1c".
*---------------------------------------------------------------------
*/
if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) {
- return TCL_OK;
+ goto done;
}
/*
@@ -344,19 +774,24 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
*------------------------------------------------
*/
- indexPtr->tree = textPtr->tree;
+ indexPtr->tree = sharedPtr->tree;
/*
- * First look for the form "tag.first" or "tag.last" where "tag"
- * is the name of a valid tag. Try to use up as much as possible
- * of the string in this check (strrchr instead of strchr below).
- * Doing the check now, and in this way, allows tag names to include
- * funny characters like "@" or "+1c".
+ * First look for the form "tag.first" or "tag.last" where "tag" is the
+ * name of a valid tag. Try to use up as much as possible of the string in
+ * this check (strrchr instead of strchr below). Doing the check now, and
+ * in this way, allows tag names to include funny characters like "@" or
+ * "+1c".
*/
Tcl_DStringInit(&copy);
p = strrchr(Tcl_DStringAppend(&copy, string, -1), '.');
if (p != NULL) {
+ TkTextSearch search;
+ TkTextTag *tagPtr;
+ Tcl_HashEntry *hPtr = NULL;
+ CONST char *tagName;
+
if ((p[1] == 'f') && (strncmp(p+1, "first", 5) == 0)) {
wantLast = 0;
endOfBase = p+6;
@@ -366,23 +801,42 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
} else {
goto tryxy;
}
- *p = 0;
- hPtr = Tcl_FindHashEntry(&textPtr->tagTable, Tcl_DStringValue(&copy));
- *p = '.';
- if (hPtr == NULL) {
+
+ tagPtr = NULL;
+ tagName = Tcl_DStringValue(&copy);
+ if (((p - tagName) == 3) && !strncmp(tagName, "sel", 3)) {
+ /*
+ * Special case for sel tag which is not stored in the hash table.
+ */
+
+ tagPtr = textPtr->selTagPtr;
+ } else {
+ *p = 0;
+ hPtr = Tcl_FindHashEntry(&sharedPtr->tagTable, tagName);
+ *p = '.';
+ if (hPtr != NULL) {
+ tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
+ }
+ }
+
+ if (tagPtr == NULL) {
goto tryxy;
}
- tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &first);
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree), 0,
- &last);
+
+ TkTextMakeByteIndex(sharedPtr->tree, textPtr, 0, 0, &first);
+ TkTextMakeByteIndex(sharedPtr->tree, textPtr,
+ TkBTreeNumLines(sharedPtr->tree, textPtr), 0, &last);
TkBTreeStartSearch(&first, &last, tagPtr, &search);
if (!TkBTreeCharTagged(&first, tagPtr) && !TkBTreeNextTag(&search)) {
+ if (tagPtr == textPtr->selTagPtr) {
+ tagName = "sel";
+ } else {
+ tagName = Tcl_GetHashKey(&sharedPtr->tagTable, hPtr);
+ }
Tcl_ResetResult(interp);
Tcl_AppendResult(interp,
"text doesn't contain any characters tagged with \"",
- Tcl_GetHashKey(&textPtr->tagTable, hPtr), "\"",
- (char *) NULL);
+ tagName, "\"", NULL);
Tcl_DStringFree(&copy);
return TCL_ERROR;
}
@@ -395,7 +849,7 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
goto gotBase;
}
- tryxy:
+ tryxy:
if (string[0] == '@') {
/*
* Find character at a given x,y location in the window.
@@ -413,9 +867,9 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
if (end == cp) {
goto error;
}
- TkTextPixelIndex(textPtr, x, y, indexPtr);
+ TkTextPixelIndex(textPtr, x, y, indexPtr, NULL);
endOfBase = end;
- goto gotBase;
+ goto gotBase;
}
if (isdigit(UCHAR(string[0])) || (string[0] == '-')) {
@@ -440,7 +894,9 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
}
endOfBase = end;
}
- TkTextMakeCharIndex(textPtr->tree, lineIndex, charIndex, indexPtr);
+ TkTextMakeCharIndex(sharedPtr->tree, textPtr, lineIndex, charIndex,
+ indexPtr);
+ canCache = 1;
goto gotBase;
}
@@ -470,8 +926,9 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
* Base position is end of text.
*/
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree),
- 0, indexPtr);
+ TkTextMakeByteIndex(sharedPtr->tree, textPtr,
+ TkBTreeNumLines(sharedPtr->tree, textPtr), 0, indexPtr);
+ canCache = 1;
goto gotBase;
} else {
/*
@@ -488,7 +945,7 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
}
/*
- * See if the base position is the name of an embedded image
+ * See if the base position is the name of an embedded image.
*/
c = *endOfBase;
@@ -503,14 +960,14 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
/*
*-------------------------------------------------------------------
- * Stage 3: process zero or more modifiers. Each modifier is either
- * a keyword like "wordend" or "linestart", or it has the form
- * "op count units" where op is + or -, count is a number, and units
- * is "chars" or "lines".
+ * Stage 3: process zero or more modifiers. Each modifier is either a
+ * keyword like "wordend" or "linestart", or it has the form "op count
+ * units" where op is + or -, count is a number, and units is "chars" or
+ * "lines".
*-------------------------------------------------------------------
*/
- gotBase:
+ gotBase:
cp = endOfBase;
while (1) {
while (isspace(UCHAR(*cp))) {
@@ -519,24 +976,31 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
if (*cp == 0) {
break;
}
-
+
if ((*cp == '+') || (*cp == '-')) {
- cp = ForwBack(cp, indexPtr);
+ cp = ForwBack(textPtr, cp, indexPtr);
} else {
- cp = StartEnd(cp, indexPtr);
+ cp = StartEnd(textPtr, cp, indexPtr);
}
if (cp == NULL) {
goto error;
}
}
Tcl_DStringFree(&copy);
+
+ done:
+ if (canCachePtr != NULL) {
+ *canCachePtr = canCache;
+ }
+ if (indexPtr->linePtr == NULL) {
+ Tcl_Panic("Bad index created");
+ }
return TCL_OK;
- error:
+ error:
Tcl_DStringFree(&copy);
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad text index \"", string, "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad text index \"", string, "\"", NULL);
return TCL_ERROR;
}
@@ -544,12 +1008,13 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
*---------------------------------------------------------------------------
*
* TkTextPrintIndex --
- *
- * This procedure generates a string description of an index, suitable
- * for reading in again later.
+ *
+ * This function generates a string description of an index, suitable for
+ * reading in again later.
*
* Results:
- * The characters pointed to by string are modified.
+ * The characters pointed to by string are modified. Returns the number
+ * of characters in the string.
*
* Side effects:
* None.
@@ -557,18 +1022,31 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
*---------------------------------------------------------------------------
*/
-void
-TkTextPrintIndex(indexPtr, string)
- CONST TkTextIndex *indexPtr;/* Pointer to index. */
- char *string; /* Place to store the position. Must have
- * at least TK_POS_CHARS characters. */
+int
+TkTextPrintIndex(
+ CONST TkText *textPtr,
+ CONST TkTextIndex *indexPtr,/* Pointer to index. */
+ char *string) /* Place to store the position. Must have at
+ * least TK_POS_CHARS characters. */
{
TkTextSegment *segPtr;
+ TkTextLine *linePtr;
int numBytes, charIndex;
numBytes = indexPtr->byteIndex;
charIndex = 0;
- for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) {
+ linePtr = indexPtr->linePtr;
+
+ for (segPtr = linePtr->segPtr; ; segPtr = segPtr->nextPtr) {
+ if (segPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through eliding
+ * of a newline.
+ */
+
+ linePtr = TkBTreeNextLine(NULL, linePtr);
+ segPtr = linePtr->segPtr;
+ }
if (numBytes <= segPtr->size) {
break;
}
@@ -579,13 +1057,15 @@ TkTextPrintIndex(indexPtr, string)
}
numBytes -= segPtr->size;
}
+
if (segPtr->typePtr == &tkTextCharType) {
charIndex += Tcl_NumUtfChars(segPtr->body.chars, numBytes);
} else {
charIndex += numBytes;
}
- sprintf(string, "%d.%d", TkBTreeLineIndex(indexPtr->linePtr) + 1,
- charIndex);
+
+ return sprintf(string, "%d.%d",
+ TkBTreeLinesTo(textPtr, indexPtr->linePtr) + 1, charIndex);
}
/*
@@ -607,9 +1087,9 @@ TkTextPrintIndex(indexPtr, string)
*/
int
-TkTextIndexCmp(index1Ptr, index2Ptr)
- CONST TkTextIndex *index1Ptr; /* First index. */
- CONST TkTextIndex *index2Ptr; /* Second index. */
+TkTextIndexCmp(
+ CONST TkTextIndex*index1Ptr,/* First index. */
+ CONST TkTextIndex*index2Ptr)/* Second index. */
{
int line1, line2;
@@ -622,8 +1102,16 @@ TkTextIndexCmp(index1Ptr, index2Ptr)
return 0;
}
}
- line1 = TkBTreeLineIndex(index1Ptr->linePtr);
- line2 = TkBTreeLineIndex(index2Ptr->linePtr);
+
+ /*
+ * Assumption here that it is ok for comparisons to reflect the full
+ * B-tree and not just the portion that is available to any client. This
+ * should be true because the only indexPtr's we should be given are ones
+ * which are valid for the current client.
+ */
+
+ line1 = TkBTreeLinesTo(NULL, index1Ptr->linePtr);
+ line2 = TkBTreeLinesTo(NULL, index2Ptr->linePtr);
if (line1 < line2) {
return -1;
}
@@ -638,14 +1126,14 @@ TkTextIndexCmp(index1Ptr, index2Ptr)
*
* ForwBack --
*
- * This procedure handles +/- modifiers for indices to adjust the
- * index forwards or backwards.
+ * This function handles +/- modifiers for indices to adjust the index
+ * forwards or backwards.
*
* Results:
- * If the modifier in string is successfully parsed then the return
- * value is the address of the first character after the modifier,
- * and *indexPtr is updated to reflect the modifier. If there is a
- * syntax error in the modifier then NULL is returned.
+ * If the modifier in string is successfully parsed then the return value
+ * is the address of the first character after the modifier, and
+ * *indexPtr is updated to reflect the modifier. If there is a syntax
+ * error in the modifier then NULL is returned.
*
* Side effects:
* None.
@@ -654,16 +1142,16 @@ TkTextIndexCmp(index1Ptr, index2Ptr)
*/
static CONST char *
-ForwBack(string, indexPtr)
- CONST char *string; /* String to parse for additional info
- * about modifier (count and units).
- * Points to "+" or "-" that starts
- * modifier. */
- TkTextIndex *indexPtr; /* Index to update as specified in string. */
+ForwBack(
+ TkText *textPtr, /* Information about text widget. */
+ CONST char *string, /* String to parse for additional info about
+ * modifier (count and units). Points to "+"
+ * or "-" that starts modifier. */
+ TkTextIndex *indexPtr) /* Index to update as specified in string. */
{
register CONST char *p, *units;
char *end;
- int count, lineIndex;
+ int count, lineIndex, modifier;
size_t length;
/*
@@ -684,53 +1172,193 @@ ForwBack(string, indexPtr)
}
/*
- * Find the end of this modifier (next space or + or - character),
- * then parse the unit specifier and update the position
- * accordingly.
+ * Find the end of this modifier (next space or + or - character), then
+ * check if there is a textual 'display' or 'any' modifier. These
+ * modifiers can be their own word (in which case they can be abbreviated)
+ * or they can follow on to the actual unit in a single word (in which
+ * case no abbreviation is allowed). So, 'display lines', 'd lines',
+ * 'displaylin' are all ok, but 'dline' is not.
*/
- units = p;
+ units = p;
while ((*p != '\0') && !isspace(UCHAR(*p)) && (*p != '+') && (*p != '-')) {
p++;
}
length = p - units;
+ if ((*units == 'd') &&
+ (strncmp(units, "display", (length > 7 ? 7 : length)) == 0)) {
+ modifier = TKINDEX_DISPLAY;
+ if (length > 7) {
+ p -= (length - 7);
+ }
+ } else if ((*units == 'a') &&
+ (strncmp(units, "any", (length > 3 ? 3 : length)) == 0)) {
+ modifier = TKINDEX_ANY;
+ if (length > 3) {
+ p -= (length - 3);
+ }
+ } else {
+ modifier = TKINDEX_NONE;
+ }
+
+ /*
+ * If we had a modifier, which we interpreted ok, so now forward to the
+ * actual units.
+ */
+
+ if (modifier != TKINDEX_NONE) {
+ while (isspace(UCHAR(*p))) {
+ p++;
+ }
+ units = p;
+ while (*p!='\0' && !isspace(UCHAR(*p)) && *p!='+' && *p!='-') {
+ p++;
+ }
+ length = p - units;
+ }
+
+ /*
+ * Finally parse the units.
+ */
+
if ((*units == 'c') && (strncmp(units, "chars", length) == 0)) {
+ TkTextCountType type;
+
+ if (modifier == TKINDEX_NONE) {
+ type = COUNT_INDICES;
+ } else if (modifier == TKINDEX_ANY) {
+ type = COUNT_CHARS;
+ } else {
+ type = COUNT_DISPLAY_CHARS;
+ }
+
if (*string == '+') {
- TkTextIndexForwChars(indexPtr, count, indexPtr);
+ TkTextIndexForwChars(textPtr, indexPtr, count, indexPtr, type);
} else {
- TkTextIndexBackChars(indexPtr, count, indexPtr);
+ TkTextIndexBackChars(textPtr, indexPtr, count, indexPtr, type);
}
- } else if ((*units == 'l') && (strncmp(units, "lines", length) == 0)) {
- lineIndex = TkBTreeLineIndex(indexPtr->linePtr);
+ } else if ((*units == 'i') && (strncmp(units, "indices", length) == 0)) {
+ TkTextCountType type;
+
+ if (modifier == TKINDEX_DISPLAY) {
+ type = COUNT_DISPLAY_INDICES;
+ } else {
+ type = COUNT_INDICES;
+ }
+
if (*string == '+') {
- lineIndex += count;
+ TkTextIndexForwChars(textPtr, indexPtr, count, indexPtr, type);
} else {
- lineIndex -= count;
+ TkTextIndexBackChars(textPtr, indexPtr, count, indexPtr, type);
+ }
+ } else if ((*units == 'l') && (strncmp(units, "lines", length) == 0)) {
+ if (modifier == TKINDEX_DISPLAY) {
+ /*
+ * Find the appropriate pixel offset of the current position
+ * within its display line. This also has the side-effect of
+ * moving indexPtr, but that doesn't matter since we will do it
+ * again below.
+ *
+ * Then find the right display line, and finally calculated the
+ * index we want in that display line, based on the original pixel
+ * offset.
+ */
+
+ int xOffset, forward;
+
+ if (TkTextIsElided(textPtr, indexPtr, NULL)) {
+ /*
+ * Go forward to the first non-elided index.
+ */
+
+ TkTextIndexForwChars(textPtr, indexPtr, 0, indexPtr,
+ COUNT_DISPLAY_INDICES);
+ }
/*
- * The check below retains the character position, even
- * if the line runs off the start of the file. Without
- * it, the character position will get reset to 0 by
- * TkTextMakeIndex.
+ * Unlike the Forw/BackChars code, the display line code is
+ * sensitive to whether we are genuinely going forwards or
+ * backwards. So, we need to determine that. This is important in
+ * the case where we have "+ -3 displaylines", for example.
*/
- if (lineIndex < 0) {
- lineIndex = 0;
+ if ((count < 0) ^ (*string == '-')) {
+ forward = 0;
+ } else {
+ forward = 1;
}
- }
- /*
- * This doesn't work quite right if using a proportional font or
- * UTF-8 characters with varying numbers of bytes. The cursor will
- * bop around, keeping a constant number of bytes (not characters)
- * from the left edge (but making sure not to split any UTF-8
- * characters), regardless of the x-position the index corresponds
- * to. The proper way to do this is to get the x-position of the
- * index and then pick the character at the same x-position in the
- * new line.
- */
- TkTextMakeByteIndex(indexPtr->tree, lineIndex, indexPtr->byteIndex,
- indexPtr);
+ count = abs(count);
+ if (count == 0) {
+ return p;
+ }
+
+ if (forward) {
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 1, &xOffset);
+ while (count-- > 0) {
+ /*
+ * Go to the end of the line, then forward one char/byte
+ * to get to the beginning of the next line.
+ */
+
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 1, NULL);
+ TkTextIndexForwChars(textPtr, indexPtr, 1, indexPtr,
+ COUNT_DISPLAY_INDICES);
+ }
+ } else {
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, &xOffset);
+ while (count-- > 0) {
+ /*
+ * Go to the beginning of the line, then backward one
+ * char/byte to get to the end of the previous line.
+ */
+
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL);
+ TkTextIndexBackChars(textPtr, indexPtr, 1, indexPtr,
+ COUNT_DISPLAY_INDICES);
+ }
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL);
+ }
+
+ /*
+ * This call assumes indexPtr is the beginning of a display line
+ * and moves it to the 'xOffset' position of that line, which is
+ * just what we want.
+ */
+
+ TkTextIndexOfX(textPtr, xOffset, indexPtr);
+ } else {
+ lineIndex = TkBTreeLinesTo(textPtr, indexPtr->linePtr);
+ if (*string == '+') {
+ lineIndex += count;
+ } else {
+ lineIndex -= count;
+
+ /*
+ * The check below retains the character position, even if the
+ * line runs off the start of the file. Without it, the
+ * character position will get reset to 0 by TkTextMakeIndex.
+ */
+
+ if (lineIndex < 0) {
+ lineIndex = 0;
+ }
+ }
+
+ /*
+ * This doesn't work quite right if using a proportional font or
+ * UTF-8 characters with varying numbers of bytes, or if there are
+ * embedded windows, images, etc. The cursor will bop around,
+ * keeping a constant number of bytes (not characters) from the
+ * left edge (but making sure not to split any UTF-8 characters),
+ * regardless of the x-position the index corresponds to. The
+ * proper way to do this is to get the x-position of the index and
+ * then pick the character at the same x-position in the new line.
+ */
+
+ TkTextMakeByteIndex(indexPtr->tree, textPtr, lineIndex,
+ indexPtr->byteIndex, indexPtr);
+ }
} else {
return NULL;
}
@@ -742,13 +1370,16 @@ ForwBack(string, indexPtr)
*
* TkTextIndexForwBytes --
*
- * Given an index for a text widget, this procedure creates a new
- * index that points "count" bytes ahead of the source index.
+ * Given an index for a text widget, this function creates a new index
+ * that points "count" bytes ahead of the source index.
*
* Results:
* *dstPtr is modified to refer to the character "count" bytes after
- * srcPtr, or to the last character in the TkText if there aren't
- * "count" bytes left.
+ * srcPtr, or to the last character in the TkText if there aren't "count"
+ * bytes left.
+ *
+ * In this latter case, the function returns '1' to indicate that not all
+ * of 'byteCount' could be used.
*
* Side effects:
* None.
@@ -756,20 +1387,21 @@ ForwBack(string, indexPtr)
*---------------------------------------------------------------------------
*/
-void
-TkTextIndexForwBytes(srcPtr, byteCount, dstPtr)
- CONST TkTextIndex *srcPtr; /* Source index. */
- int byteCount; /* How many bytes forward to move. May be
+int
+TkTextIndexForwBytes(
+ CONST TkText *textPtr,
+ CONST TkTextIndex *srcPtr, /* Source index. */
+ int byteCount, /* How many bytes forward to move. May be
* negative. */
- TkTextIndex *dstPtr; /* Destination index: gets modified. */
+ TkTextIndex *dstPtr) /* Destination index: gets modified. */
{
TkTextLine *linePtr;
TkTextSegment *segPtr;
int lineLength;
if (byteCount < 0) {
- TkTextIndexBackBytes(srcPtr, -byteCount, dstPtr);
- return;
+ TkTextIndexBackBytes(textPtr, srcPtr, -byteCount, dstPtr);
+ return 0;
}
*dstPtr = *srcPtr;
@@ -786,18 +1418,18 @@ TkTextIndexForwBytes(srcPtr, byteCount, dstPtr)
}
/*
- * If the new index is in the same line then we're done.
- * Otherwise go on to the next line.
+ * If the new index is in the same line then we're done. Otherwise go
+ * on to the next line.
*/
if (dstPtr->byteIndex < lineLength) {
- return;
+ return 0;
}
dstPtr->byteIndex -= lineLength;
- linePtr = TkBTreeNextLine(dstPtr->linePtr);
+ linePtr = TkBTreeNextLine(textPtr, dstPtr->linePtr);
if (linePtr == NULL) {
dstPtr->byteIndex = lineLength - 1;
- return;
+ return 1;
}
dstPtr->linePtr = linePtr;
}
@@ -808,13 +1440,18 @@ TkTextIndexForwBytes(srcPtr, byteCount, dstPtr)
*
* TkTextIndexForwChars --
*
- * Given an index for a text widget, this procedure creates a new
- * index that points "count" characters ahead of the source index.
+ * Given an index for a text widget, this function creates a new index
+ * that points "count" items of type given by "type" ahead of the source
+ * index. "count" can be zero, which is useful in the case where one
+ * wishes to move forward by display (non-elided) chars or indices or one
+ * wishes to move forward by chars, skipping any intervening indices. In
+ * this case dstPtr will point to the first acceptable index which is
+ * encountered.
*
* Results:
- * *dstPtr is modified to refer to the character "count" characters
- * after srcPtr, or to the last character in the TkText if there
- * aren't "count" characters left in the file.
+ * *dstPtr is modified to refer to the character "count" items after
+ * srcPtr, or to the last character in the TkText if there aren't
+ * sufficient items left in the widget.
*
* Side effects:
* None.
@@ -823,31 +1460,52 @@ TkTextIndexForwBytes(srcPtr, byteCount, dstPtr)
*/
void
-TkTextIndexForwChars(srcPtr, charCount, dstPtr)
- CONST TkTextIndex *srcPtr; /* Source index. */
- int charCount; /* How many characters forward to move.
- * May be negative. */
- TkTextIndex *dstPtr; /* Destination index: gets modified. */
+TkTextIndexForwChars(
+ CONST TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *srcPtr, /* Source index. */
+ int charCount, /* How many characters forward to move. May
+ * be negative. */
+ TkTextIndex *dstPtr, /* Destination index: gets modified. */
+ TkTextCountType type) /* The type of item to count */
{
TkTextLine *linePtr;
TkTextSegment *segPtr;
+ TkTextElideInfo *infoPtr = NULL;
int byteOffset;
char *start, *end, *p;
Tcl_UniChar ch;
+ int elide = 0;
+ int checkElided = (type & COUNT_DISPLAY);
if (charCount < 0) {
- TkTextIndexBackChars(srcPtr, -charCount, dstPtr);
+ TkTextIndexBackChars(textPtr, srcPtr, -charCount, dstPtr, type);
return;
}
+ if (checkElided) {
+ infoPtr = (TkTextElideInfo *)
+ ckalloc((unsigned) sizeof(TkTextElideInfo));
+ elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
+ }
*dstPtr = *srcPtr;
/*
- * Find seg that contains src byteIndex.
- * Move forward specified number of chars.
+ * Find seg that contains src byteIndex. Move forward specified number of
+ * chars.
*/
- segPtr = TkTextIndexToSeg(dstPtr, &byteOffset);
+ if (checkElided) {
+ /*
+ * In this case we have already calculated the information we need, so
+ * no need to use TkTextIndexToSeg()
+ */
+
+ segPtr = infoPtr->segPtr;
+ byteOffset = dstPtr->byteIndex - infoPtr->segOffset;
+ } else {
+ segPtr = TkTextIndexToSeg(dstPtr, &byteOffset);
+ }
+
while (1) {
/*
* Go through each segment in line looking for specified character
@@ -855,76 +1513,341 @@ TkTextIndexForwChars(srcPtr, charCount, dstPtr)
*/
for ( ; segPtr != NULL; segPtr = segPtr->nextPtr) {
- if (segPtr->typePtr == &tkTextCharType) {
- start = segPtr->body.chars + byteOffset;
- end = segPtr->body.chars + segPtr->size;
- for (p = start; p < end; p += Tcl_UtfToUniChar(p, &ch)) {
- if (charCount == 0) {
- dstPtr->byteIndex += (p - start);
- return;
+ /*
+ * If we do need to pay attention to the visibility of
+ * characters/indices, check that first. If the current segment
+ * isn't visible, then we simply continue the loop.
+ */
+
+ if (checkElided && ((segPtr->typePtr == &tkTextToggleOffType)
+ || (segPtr->typePtr == &tkTextToggleOnType))) {
+ TkTextTag *tagPtr = segPtr->body.toggle.tagPtr;
+
+ /*
+ * The elide state only changes if this tag is either the
+ * current highest priority tag (and is therefore being
+ * toggled off), or it's a new tag with higher priority.
+ */
+
+ if (tagPtr->elideString != NULL) {
+ infoPtr->tagCnts[tagPtr->priority]++;
+ if (infoPtr->tagCnts[tagPtr->priority] & 1) {
+ infoPtr->tagPtrs[tagPtr->priority] = tagPtr;
+ }
+
+ if (tagPtr->priority >= infoPtr->elidePriority) {
+ if (segPtr->typePtr == &tkTextToggleOffType) {
+ /*
+ * If it is being toggled off, and it has an elide
+ * string, it must actually be the current highest
+ * priority tag, so this check is redundant:
+ */
+
+ if (tagPtr->priority != infoPtr->elidePriority) {
+ Tcl_Panic("Bad tag priority being toggled off");
+ }
+
+ /*
+ * Find previous elide tag, if any (if not then
+ * elide will be zero, of course).
+ */
+
+ elide = 0;
+ while (--infoPtr->elidePriority > 0) {
+ if (infoPtr->tagCnts[infoPtr->elidePriority]
+ & 1) {
+ elide = infoPtr->tagPtrs
+ [infoPtr->elidePriority]->elide;
+ break;
+ }
+ }
+ } else {
+ elide = tagPtr->elide;
+ infoPtr->elidePriority = tagPtr->priority;
+ }
}
- charCount--;
}
- } else {
- if (charCount < segPtr->size - byteOffset) {
- dstPtr->byteIndex += charCount;
- return;
+ }
+
+ if (!elide) {
+ if (segPtr->typePtr == &tkTextCharType) {
+ start = segPtr->body.chars + byteOffset;
+ end = segPtr->body.chars + segPtr->size;
+ for (p = start; p < end; p += Tcl_UtfToUniChar(p, &ch)) {
+ if (charCount == 0) {
+ dstPtr->byteIndex += (p - start);
+ goto forwardCharDone;
+ }
+ charCount--;
+ }
+ } else if (type & COUNT_INDICES) {
+ if (charCount < segPtr->size - byteOffset) {
+ dstPtr->byteIndex += charCount;
+ goto forwardCharDone;
+ }
+ charCount -= segPtr->size - byteOffset;
}
- charCount -= segPtr->size - byteOffset;
}
+
dstPtr->byteIndex += segPtr->size - byteOffset;
byteOffset = 0;
}
/*
- * Go to the next line. If we are at the end of the text item,
- * back up one byte (for the terminal '\n' character) and return
- * that index.
+ * Go to the next line. If we are at the end of the text item, back up
+ * one byte (for the terminal '\n' character) and return that index.
*/
-
- linePtr = TkBTreeNextLine(dstPtr->linePtr);
+
+ linePtr = TkBTreeNextLine(textPtr, dstPtr->linePtr);
if (linePtr == NULL) {
dstPtr->byteIndex -= sizeof(char);
- return;
+ goto forwardCharDone;
}
dstPtr->linePtr = linePtr;
dstPtr->byteIndex = 0;
segPtr = dstPtr->linePtr->segPtr;
}
+
+ forwardCharDone:
+ if (infoPtr != NULL) {
+ TkTextFreeElideInfo(infoPtr);
+ ckfree((char *) infoPtr);
+ }
}
/*
*---------------------------------------------------------------------------
*
+ * TkTextIndexCount --
+ *
+ * Given an ordered pair of indices in a text widget, this function
+ * counts how many characters (not bytes) are between the two indices.
+ *
+ * It is illegal to call this function with unordered indices.
+ *
+ * Note that 'textPtr' is only used if we need to check for elided
+ * attributes, i.e. if type is COUNT_DISPLAY_INDICES or
+ * COUNT_DISPLAY_CHARS.
+ *
+ * Results:
+ * The number of characters in the given range, which meet the
+ * appropriate 'type' attributes.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkTextIndexCount(
+ CONST TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *indexPtr1,
+ /* Index describing location of character from
+ * which to count. */
+ CONST TkTextIndex *indexPtr2,
+ /* Index describing location of last character
+ * at which to stop the count. */
+ TkTextCountType type) /* The kind of indices to count. */
+{
+ TkTextLine *linePtr1;
+ TkTextSegment *segPtr, *seg2Ptr = NULL;
+ TkTextElideInfo *infoPtr = NULL;
+ int byteOffset, maxBytes, count = 0, elide = 0;
+ int checkElided = (type & COUNT_DISPLAY);
+
+ /*
+ * Find seg that contains src index, and remember how many bytes not to
+ * count in the given segment.
+ */
+
+ segPtr = TkTextIndexToSeg(indexPtr1, &byteOffset);
+ linePtr1 = indexPtr1->linePtr;
+
+ seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes);
+
+ if (checkElided) {
+ infoPtr = (TkTextElideInfo *)
+ ckalloc((unsigned) sizeof(TkTextElideInfo));
+ elide = TkTextIsElided(textPtr, indexPtr1, infoPtr);
+ }
+
+ while (1) {
+ /*
+ * Go through each segment in line adding up the number of characters.
+ */
+
+ for ( ; segPtr != NULL; segPtr = segPtr->nextPtr) {
+ /*
+ * If we do need to pay attention to the visibility of
+ * characters/indices, check that first. If the current segment
+ * isn't visible, then we simply continue the loop.
+ */
+
+ if (checkElided) {
+ if ((segPtr->typePtr == &tkTextToggleOffType)
+ || (segPtr->typePtr == &tkTextToggleOnType)) {
+ TkTextTag *tagPtr = segPtr->body.toggle.tagPtr;
+
+ /*
+ * The elide state only changes if this tag is either the
+ * current highest priority tag (and is therefore being
+ * toggled off), or it's a new tag with higher priority.
+ */
+
+ if (tagPtr->elideString != NULL) {
+ infoPtr->tagCnts[tagPtr->priority]++;
+ if (infoPtr->tagCnts[tagPtr->priority] & 1) {
+ infoPtr->tagPtrs[tagPtr->priority] = tagPtr;
+ }
+ if (tagPtr->priority >= infoPtr->elidePriority) {
+ if (segPtr->typePtr == &tkTextToggleOffType) {
+ /*
+ * If it is being toggled off, and it has an
+ * elide string, it must actually be the
+ * current highest priority tag, so this check
+ * is redundant:
+ */
+
+ if (tagPtr->priority!=infoPtr->elidePriority) {
+ Tcl_Panic("Bad tag priority being toggled off");
+ }
+
+ /*
+ * Find previous elide tag, if any (if not
+ * then elide will be zero, of course).
+ */
+
+ elide = 0;
+ while (--infoPtr->elidePriority > 0) {
+ if (infoPtr->tagCnts[
+ infoPtr->elidePriority] & 1) {
+ elide = infoPtr->tagPtrs[
+ infoPtr->elidePriority]->elide;
+ break;
+ }
+ }
+ } else {
+ elide = tagPtr->elide;
+ infoPtr->elidePriority = tagPtr->priority;
+ }
+ }
+ }
+ }
+ if (elide) {
+ if (segPtr == seg2Ptr) {
+ goto countDone;
+ }
+ byteOffset = 0;
+ continue;
+ }
+ }
+
+ if (segPtr->typePtr == &tkTextCharType) {
+ int byteLen = segPtr->size - byteOffset;
+ register unsigned char *str = (unsigned char *)
+ segPtr->body.chars + byteOffset;
+ register int i;
+
+ if (segPtr == seg2Ptr) {
+ if (byteLen > (maxBytes - byteOffset)) {
+ byteLen = maxBytes - byteOffset;
+ }
+ }
+ i = byteLen;
+
+ /*
+ * This is a speed sensitive function, so run specially over
+ * the string to count continuous ascii characters before
+ * resorting to the Tcl_NumUtfChars call. This is a long form
+ * of:
+ *
+ * stringPtr->numChars =
+ * Tcl_NumUtfChars(objPtr->bytes, objPtr->length);
+ */
+
+ while (i && (*str < 0xC0)) {
+ i--;
+ str++;
+ }
+ count += byteLen - i;
+ if (i) {
+ count += Tcl_NumUtfChars(segPtr->body.chars + byteOffset
+ + (byteLen - i), i);
+ }
+ } else {
+ if (type & COUNT_INDICES) {
+ int byteLen = segPtr->size - byteOffset;
+
+ if (segPtr == seg2Ptr) {
+ if (byteLen > (maxBytes - byteOffset)) {
+ byteLen = maxBytes - byteOffset;
+ }
+ }
+ count += byteLen;
+ }
+ }
+ if (segPtr == seg2Ptr) {
+ goto countDone;
+ }
+ byteOffset = 0;
+ }
+
+ /*
+ * Go to the next line. If we are at the end of the text item, back up
+ * one byte (for the terminal '\n' character) and return that index.
+ */
+
+ linePtr1 = TkBTreeNextLine(textPtr, linePtr1);
+ if (linePtr1 == NULL) {
+ Tcl_Panic("Reached end of text widget when counting characters");
+ }
+ segPtr = linePtr1->segPtr;
+ }
+
+ countDone:
+ if (infoPtr != NULL) {
+ TkTextFreeElideInfo(infoPtr);
+ ckfree((char *) infoPtr);
+ }
+ return count;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* TkTextIndexBackBytes --
*
- * Given an index for a text widget, this procedure creates a new
- * index that points "count" bytes earlier than the source index.
+ * Given an index for a text widget, this function creates a new index
+ * that points "count" bytes earlier than the source index.
*
* Results:
* *dstPtr is modified to refer to the character "count" bytes before
* srcPtr, or to the first character in the TkText if there aren't
* "count" bytes earlier than srcPtr.
*
+ * Returns 1 if we couldn't use all of 'byteCount' because we have run
+ * into the beginning or end of the text, and zero otherwise.
+ *
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
-void
-TkTextIndexBackBytes(srcPtr, byteCount, dstPtr)
- CONST TkTextIndex *srcPtr; /* Source index. */
- int byteCount; /* How many bytes backward to move. May be
+int
+TkTextIndexBackBytes(
+ CONST TkText *textPtr,
+ CONST TkTextIndex *srcPtr, /* Source index. */
+ int byteCount, /* How many bytes backward to move. May be
* negative. */
- TkTextIndex *dstPtr; /* Destination index: gets modified. */
+ TkTextIndex *dstPtr) /* Destination index: gets modified. */
{
TkTextSegment *segPtr;
int lineIndex;
if (byteCount < 0) {
- TkTextIndexForwBytes(srcPtr, -byteCount, dstPtr);
- return;
+ return TkTextIndexForwBytes(textPtr, srcPtr, -byteCount, dstPtr);
}
*dstPtr = *srcPtr;
@@ -932,19 +1855,19 @@ TkTextIndexBackBytes(srcPtr, byteCount, dstPtr)
lineIndex = -1;
while (dstPtr->byteIndex < 0) {
/*
- * Move back one line in the text. If we run off the beginning
- * of the file then just return the first character in the text.
+ * Move back one line in the text. If we run off the beginning of the
+ * file then just return the first character in the text.
*/
if (lineIndex < 0) {
- lineIndex = TkBTreeLineIndex(dstPtr->linePtr);
+ lineIndex = TkBTreeLinesTo(textPtr, dstPtr->linePtr);
}
if (lineIndex == 0) {
dstPtr->byteIndex = 0;
- return;
+ return 1;
}
lineIndex--;
- dstPtr->linePtr = TkBTreeFindLine(dstPtr->tree, lineIndex);
+ dstPtr->linePtr = TkBTreeFindLine(dstPtr->tree, textPtr, lineIndex);
/*
* Compute the length of the line and add that to dstPtr->charIndex.
@@ -955,6 +1878,7 @@ TkTextIndexBackBytes(srcPtr, byteCount, dstPtr)
dstPtr->byteIndex += segPtr->size;
}
}
+ return 0;
}
/*
@@ -962,13 +1886,18 @@ TkTextIndexBackBytes(srcPtr, byteCount, dstPtr)
*
* TkTextIndexBackChars --
*
- * Given an index for a text widget, this procedure creates a new
- * index that points "count" characters earlier than the source index.
+ * Given an index for a text widget, this function creates a new index
+ * that points "count" items of type given by "type" earlier than the
+ * source index. "count" can be zero, which is useful in the case where
+ * one wishes to move backward by display (non-elided) chars or indices
+ * or one wishes to move backward by chars, skipping any intervening
+ * indices. In this case the returned index *dstPtr will point just
+ * _after_ the first acceptable index which is encountered.
*
* Results:
- * *dstPtr is modified to refer to the character "count" characters
- * before srcPtr, or to the first character in the file if there
- * aren't "count" characters earlier than srcPtr.
+ * *dstPtr is modified to refer to the character "count" items before
+ * srcPtr, or to the first index in the window if there aren't sufficient
+ * items earlier than srcPtr.
*
* Side effects:
* None.
@@ -977,57 +1906,145 @@ TkTextIndexBackBytes(srcPtr, byteCount, dstPtr)
*/
void
-TkTextIndexBackChars(srcPtr, charCount, dstPtr)
- CONST TkTextIndex *srcPtr; /* Source index. */
- int charCount; /* How many characters backward to move.
- * May be negative. */
- TkTextIndex *dstPtr; /* Destination index: gets modified. */
+TkTextIndexBackChars(
+ CONST TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *srcPtr, /* Source index. */
+ int charCount, /* How many characters backward to move. May
+ * be negative. */
+ TkTextIndex *dstPtr, /* Destination index: gets modified. */
+ TkTextCountType type) /* The type of item to count */
{
TkTextSegment *segPtr, *oldPtr;
+ TkTextElideInfo *infoPtr = NULL;
int lineIndex, segSize;
CONST char *p, *start, *end;
+ int elide = 0;
+ int checkElided = (type & COUNT_DISPLAY);
- if (charCount <= 0) {
- TkTextIndexForwChars(srcPtr, -charCount, dstPtr);
+ if (charCount < 0) {
+ TkTextIndexForwChars(textPtr, srcPtr, -charCount, dstPtr, type);
return;
}
+ if (checkElided) {
+ infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo));
+ elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
+ }
*dstPtr = *srcPtr;
/*
- * Find offset within seg that contains byteIndex.
- * Move backward specified number of chars.
+ * Find offset within seg that contains byteIndex. Move backward specified
+ * number of chars.
*/
lineIndex = -1;
-
+
segSize = dstPtr->byteIndex;
- for (segPtr = dstPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) {
- if (segSize <= segPtr->size) {
- break;
+
+ if (checkElided) {
+ segPtr = infoPtr->segPtr;
+ segSize -= infoPtr->segOffset;
+ } else {
+ TkTextLine *linePtr = dstPtr->linePtr;
+ for (segPtr = linePtr->segPtr; ; segPtr = segPtr->nextPtr) {
+ if (segPtr == NULL) {
+ /*
+ * Two logical lines merged into one display line through
+ * eliding of a newline.
+ */
+
+ linePtr = TkBTreeNextLine(NULL, linePtr);
+ segPtr = linePtr->segPtr;
+ }
+ if (segSize <= segPtr->size) {
+ break;
+ }
+ segSize -= segPtr->size;
}
- segSize -= segPtr->size;
}
+
+ /*
+ * Now segPtr points to the segment containing the starting index.
+ */
+
while (1) {
- if (segPtr->typePtr == &tkTextCharType) {
- start = segPtr->body.chars;
- end = segPtr->body.chars + segSize;
- for (p = end; ; p = Tcl_UtfPrev(p, start)) {
- if (charCount == 0) {
- dstPtr->byteIndex -= (end - p);
- return;
+ /*
+ * If we do need to pay attention to the visibility of
+ * characters/indices, check that first. If the current segment isn't
+ * visible, then we simply continue the loop.
+ */
+
+ if (checkElided && ((segPtr->typePtr == &tkTextToggleOffType)
+ || (segPtr->typePtr == &tkTextToggleOnType))) {
+ TkTextTag *tagPtr = segPtr->body.toggle.tagPtr;
+
+ /*
+ * The elide state only changes if this tag is either the current
+ * highest priority tag (and is therefore being toggled off), or
+ * it's a new tag with higher priority.
+ */
+
+ if (tagPtr->elideString != NULL) {
+ infoPtr->tagCnts[tagPtr->priority]++;
+ if (infoPtr->tagCnts[tagPtr->priority] & 1) {
+ infoPtr->tagPtrs[tagPtr->priority] = tagPtr;
}
- if (p == start) {
- break;
+ if (tagPtr->priority >= infoPtr->elidePriority) {
+ if (segPtr->typePtr == &tkTextToggleOnType) {
+ /*
+ * If it is being toggled on, and it has an elide
+ * string, it must actually be the current highest
+ * priority tag, so this check is redundant:
+ */
+
+ if (tagPtr->priority != infoPtr->elidePriority) {
+ Tcl_Panic("Bad tag priority being toggled on");
+ }
+
+ /*
+ * Find previous elide tag, if any (if not then elide
+ * will be zero, of course).
+ */
+
+ elide = 0;
+ while (--infoPtr->elidePriority > 0) {
+ if (infoPtr->tagCnts[infoPtr->elidePriority] & 1) {
+ elide = infoPtr->tagPtrs[
+ infoPtr->elidePriority]->elide;
+ break;
+ }
+ }
+ } else {
+ elide = tagPtr->elide;
+ infoPtr->elidePriority = tagPtr->priority;
+ }
}
- charCount--;
}
- } else {
- if (charCount <= segSize) {
- dstPtr->byteIndex -= charCount;
- return;
+ }
+
+ if (!elide) {
+ if (segPtr->typePtr == &tkTextCharType) {
+ start = segPtr->body.chars;
+ end = segPtr->body.chars + segSize;
+ for (p = end; ; p = Tcl_UtfPrev(p, start)) {
+ if (charCount == 0) {
+ dstPtr->byteIndex -= (end - p);
+ goto backwardCharDone;
+ }
+ if (p == start) {
+ break;
+ }
+ charCount--;
+ }
+ } else {
+ if (type & COUNT_INDICES) {
+ if (charCount <= segSize) {
+ dstPtr->byteIndex -= charCount;
+ goto backwardCharDone;
+ }
+ charCount -= segSize;
+ }
}
- charCount -= segSize;
}
dstPtr->byteIndex -= segSize;
@@ -1050,14 +2067,14 @@ TkTextIndexBackChars(srcPtr, charCount, dstPtr)
*/
if (lineIndex < 0) {
- lineIndex = TkBTreeLineIndex(dstPtr->linePtr);
+ lineIndex = TkBTreeLinesTo(textPtr, dstPtr->linePtr);
}
if (lineIndex == 0) {
dstPtr->byteIndex = 0;
- return;
+ goto backwardCharDone;
}
lineIndex--;
- dstPtr->linePtr = TkBTreeFindLine(dstPtr->tree, lineIndex);
+ dstPtr->linePtr = TkBTreeFindLine(dstPtr->tree, textPtr, lineIndex);
/*
* Compute the length of the line and add that to dstPtr->byteIndex.
@@ -1071,6 +2088,12 @@ TkTextIndexBackChars(srcPtr, charCount, dstPtr)
segPtr = oldPtr;
segSize = segPtr->size;
}
+
+ backwardCharDone:
+ if (infoPtr != NULL) {
+ TkTextFreeElideInfo(infoPtr);
+ ckfree((char *) infoPtr);
+ }
}
/*
@@ -1078,14 +2101,14 @@ TkTextIndexBackChars(srcPtr, charCount, dstPtr)
*
* StartEnd --
*
- * This procedure handles modifiers like "wordstart" and "lineend"
- * to adjust indices forwards or backwards.
+ * This function handles modifiers like "wordstart" and "lineend" to
+ * adjust indices forwards or backwards.
*
* Results:
- * If the modifier is successfully parsed then the return value
- * is the address of the first character after the modifier, and
- * *indexPtr is updated to reflect the modifier. If there is a
- * syntax error in the modifier then NULL is returned.
+ * If the modifier is successfully parsed then the return value is the
+ * address of the first character after the modifier, and *indexPtr is
+ * updated to reflect the modifier. If there is a syntax error in the
+ * modifier then NULL is returned.
*
* Side effects:
* None.
@@ -1094,17 +2117,17 @@ TkTextIndexBackChars(srcPtr, charCount, dstPtr)
*/
static CONST char *
-StartEnd(string, indexPtr)
- CONST char *string; /* String to parse for additional info
- * about modifier (count and units).
- * Points to first character of modifer
- * word. */
- TkTextIndex *indexPtr; /* Index to mdoify based on string. */
+StartEnd(
+ TkText *textPtr, /* Information about text widget. */
+ CONST char *string, /* String to parse for additional info about
+ * modifier (count and units). Points to first
+ * character of modifer word. */
+ TkTextIndex *indexPtr) /* Index to modify based on string. */
{
CONST char *p;
- int c, offset;
size_t length;
register TkTextSegment *segPtr;
+ int modifier;
/*
* Find the end of the modifier word.
@@ -1113,68 +2136,144 @@ StartEnd(string, indexPtr)
for (p = string; isalnum(UCHAR(*p)); p++) {
/* Empty loop body. */
}
+
length = p-string;
+ if ((*string == 'd') &&
+ (strncmp(string, "display", (length > 7 ? 7 : length)) == 0)) {
+ modifier = TKINDEX_DISPLAY;
+ if (length > 7) {
+ p -= (length - 7);
+ }
+ } else if ((*string == 'a') &&
+ (strncmp(string, "any", (length > 3 ? 3 : length)) == 0)) {
+ modifier = TKINDEX_ANY;
+ if (length > 3) {
+ p -= (length - 3);
+ }
+ } else {
+ modifier = TKINDEX_NONE;
+ }
+
+ /*
+ * If we had a modifier, which we interpreted ok, so now forward to the
+ * actual units.
+ */
+
+ if (modifier != TKINDEX_NONE) {
+ while (isspace(UCHAR(*p))) {
+ p++;
+ }
+ string = p;
+ while ((*p!='\0') && !isspace(UCHAR(*p)) && (*p!='+') && (*p!='-')) {
+ p++;
+ }
+ length = p - string;
+ }
+
if ((*string == 'l') && (strncmp(string, "lineend", length) == 0)
&& (length >= 5)) {
- indexPtr->byteIndex = 0;
- for (segPtr = indexPtr->linePtr->segPtr; segPtr != NULL;
- segPtr = segPtr->nextPtr) {
- indexPtr->byteIndex += segPtr->size;
+ if (modifier == TKINDEX_DISPLAY) {
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 1, NULL);
+ } else {
+ indexPtr->byteIndex = 0;
+ for (segPtr = indexPtr->linePtr->segPtr; segPtr != NULL;
+ segPtr = segPtr->nextPtr) {
+ indexPtr->byteIndex += segPtr->size;
+ }
+
+ /*
+ * We know '\n' is encoded with a single byte index.
+ */
+
+ indexPtr->byteIndex -= sizeof(char);
}
- indexPtr->byteIndex -= sizeof(char);
} else if ((*string == 'l') && (strncmp(string, "linestart", length) == 0)
&& (length >= 5)) {
- indexPtr->byteIndex = 0;
+ if (modifier == TKINDEX_DISPLAY) {
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL);
+ } else {
+ indexPtr->byteIndex = 0;
+ }
} else if ((*string == 'w') && (strncmp(string, "wordend", length) == 0)
&& (length >= 5)) {
int firstChar = 1;
+ int offset;
/*
* If the current character isn't part of a word then just move
- * forward one character. Otherwise move forward until finding
- * a character that isn't part of a word and stop there.
+ * forward one character. Otherwise move forward until finding a
+ * character that isn't part of a word and stop there.
*/
+ if (modifier == TKINDEX_DISPLAY) {
+ TkTextIndexForwChars(textPtr, indexPtr, 0, indexPtr,
+ COUNT_DISPLAY_INDICES);
+ }
segPtr = TkTextIndexToSeg(indexPtr, &offset);
while (1) {
+ int chSize = 1;
+
if (segPtr->typePtr == &tkTextCharType) {
- c = segPtr->body.chars[offset];
- if (!isalnum(UCHAR(c)) && (c != '_')) {
+ Tcl_UniChar ch;
+
+ chSize = Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch);
+ if (!Tcl_UniCharIsWordChar(ch)) {
break;
}
firstChar = 0;
}
- offset += 1;
- indexPtr->byteIndex += sizeof(char);
+ offset += chSize;
+ indexPtr->byteIndex += chSize;
if (offset >= segPtr->size) {
segPtr = TkTextIndexToSeg(indexPtr, &offset);
}
}
if (firstChar) {
- TkTextIndexForwChars(indexPtr, 1, indexPtr);
+ if (modifier == TKINDEX_DISPLAY) {
+ TkTextIndexForwChars(textPtr, indexPtr, 1, indexPtr,
+ COUNT_DISPLAY_INDICES);
+ } else {
+ TkTextIndexForwChars(NULL, indexPtr, 1, indexPtr,
+ COUNT_INDICES);
+ }
}
} else if ((*string == 'w') && (strncmp(string, "wordstart", length) == 0)
&& (length >= 5)) {
int firstChar = 1;
+ int offset;
+
+ if (modifier == TKINDEX_DISPLAY) {
+ TkTextIndexForwChars(NULL, indexPtr, 0, indexPtr,
+ COUNT_DISPLAY_INDICES);
+ }
/*
- * Starting with the current character, look for one that's not
- * part of a word and keep moving backward until you find one.
- * Then if the character found wasn't the first one, move forward
- * again one position.
+ * Starting with the current character, look for one that's not part
+ * of a word and keep moving backward until you find one. Then if the
+ * character found wasn't the first one, move forward again one
+ * position.
*/
segPtr = TkTextIndexToSeg(indexPtr, &offset);
while (1) {
+ int chSize = 1;
+
if (segPtr->typePtr == &tkTextCharType) {
- c = segPtr->body.chars[offset];
- if (!isalnum(UCHAR(c)) && (c != '_')) {
+ Tcl_UniChar ch;
+
+ Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch);
+ if (!Tcl_UniCharIsWordChar(ch)) {
break;
}
+ if (offset > 0) {
+ chSize = (segPtr->body.chars + offset
+ - Tcl_UtfPrev(segPtr->body.chars + offset,
+ segPtr->body.chars));
+ }
firstChar = 0;
}
- offset -= 1;
- indexPtr->byteIndex -= sizeof(char);
+ offset -= chSize;
+ indexPtr->byteIndex -= chSize;
if (offset < 0) {
if (indexPtr->byteIndex < 0) {
indexPtr->byteIndex = 0;
@@ -1183,12 +2282,28 @@ StartEnd(string, indexPtr)
segPtr = TkTextIndexToSeg(indexPtr, &offset);
}
}
+
if (!firstChar) {
- TkTextIndexForwChars(indexPtr, 1, indexPtr);
+ if (modifier == TKINDEX_DISPLAY) {
+ TkTextIndexForwChars(textPtr, indexPtr, 1, indexPtr,
+ COUNT_DISPLAY_INDICES);
+ } else {
+ TkTextIndexForwChars(NULL, indexPtr, 1, indexPtr,
+ COUNT_INDICES);
+ }
}
} else {
return NULL;
}
- done:
+
+ done:
return p;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index c84bc9c..281baf1 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -1,19 +1,18 @@
-/*
+/*
* tkTextMark.c --
*
- * This file contains the procedure that implement marks for
- * text widgets.
+ * This file contains the functions that implement marks for text
+ * widgets.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
#include "tkText.h"
-#include "tkPort.h"
/*
* Macro that determines the size of a mark segment:
@@ -23,55 +22,53 @@
+ sizeof(TkTextMark)))
/*
- * Forward references for procedures defined in this file:
+ * Forward references for functions defined in this file:
*/
-static void InsertUndisplayProc _ANSI_ARGS_((TkText *textPtr,
- TkTextDispChunk *chunkPtr));
-static int MarkDeleteProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-static TkTextSegment * MarkCleanupProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void MarkCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static int MarkLayoutProc _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr, TkTextSegment *segPtr,
- int offset, int maxX, int maxChars,
- int noCharsYet, TkWrapMode wrapMode,
- TkTextDispChunk *chunkPtr));
-static int MarkFindNext _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, CONST char *markName));
-static int MarkFindPrev _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, CONST char *markName));
+static void InsertUndisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
+static int MarkDeleteProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+static TkTextSegment * MarkCleanupProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void MarkCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static int MarkLayoutProc(TkText *textPtr, TkTextIndex *indexPtr,
+ TkTextSegment *segPtr, int offset, int maxX,
+ int maxChars, int noCharsYet, TkWrapMode wrapMode,
+ TkTextDispChunk *chunkPtr);
+static int MarkFindNext(Tcl_Interp *interp,
+ TkText *textPtr, const char *markName);
+static int MarkFindPrev(Tcl_Interp *interp,
+ TkText *textPtr, const char *markName);
/*
- * The following structures declare the "mark" segment types.
- * There are actually two types for marks, one with left gravity
- * and one with right gravity. They are identical except for
- * their gravity property.
+ * The following structures declare the "mark" segment types. There are
+ * actually two types for marks, one with left gravity and one with right
+ * gravity. They are identical except for their gravity property.
*/
-Tk_SegType tkTextRightMarkType = {
- "mark", /* name */
- 0, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- MarkDeleteProc, /* deleteProc */
- MarkCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- MarkLayoutProc, /* layoutProc */
- MarkCheckProc /* checkProc */
+const Tk_SegType tkTextRightMarkType = {
+ "mark", /* name */
+ 0, /* leftGravity */
+ NULL, /* splitProc */
+ MarkDeleteProc, /* deleteProc */
+ MarkCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ MarkLayoutProc, /* layoutProc */
+ MarkCheckProc /* checkProc */
};
-Tk_SegType tkTextLeftMarkType = {
- "mark", /* name */
- 1, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- MarkDeleteProc, /* deleteProc */
- MarkCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- MarkLayoutProc, /* layoutProc */
- MarkCheckProc /* checkProc */
+const Tk_SegType tkTextLeftMarkType = {
+ "mark", /* name */
+ 1, /* leftGravity */
+ NULL, /* splitProc */
+ MarkDeleteProc, /* deleteProc */
+ MarkCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ MarkLayoutProc, /* layoutProc */
+ MarkCheckProc /* checkProc */
};
/*
@@ -79,9 +76,9 @@ Tk_SegType tkTextLeftMarkType = {
*
* TkTextMarkCmd --
*
- * This procedure is invoked to process the "mark" options of
- * the widget command for text widgets. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "mark" options of the widget
+ * command for text widgets. See the user documentation for details on
+ * what it does.
*
* Results:
* A standard Tcl result.
@@ -93,44 +90,62 @@ Tk_SegType tkTextLeftMarkType = {
*/
int
-TkTextMarkCmd(textPtr, interp, argc, argv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextMarkCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "mark". */
+ * objv[1] is "mark". */
{
- int c, i;
- size_t length;
Tcl_HashEntry *hPtr;
TkTextSegment *markPtr;
Tcl_HashSearch search;
TkTextIndex index;
- Tk_SegType *newTypePtr;
-
- if (argc < 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " mark option ?arg arg ...?\"", (char *) NULL);
+ const Tk_SegType *newTypePtr;
+ int optionIndex;
+ static const char *markOptionStrings[] = {
+ "gravity", "names", "next", "previous", "set", "unset", NULL
+ };
+ enum markOptions {
+ MARK_GRAVITY, MARK_NAMES, MARK_NEXT, MARK_PREVIOUS, MARK_SET,
+ MARK_UNSET
+ };
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[2], markOptionStrings, "mark option",
+ 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- c = argv[2][0];
- length = strlen(argv[2]);
- if ((c == 'g') && (strncmp(argv[2], "gravity", length) == 0)) {
- if (argc < 4 || argc > 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " mark gravity markName ?gravity?\"",
- (char *) NULL);
+
+ switch ((enum markOptions) optionIndex) {
+ case MARK_GRAVITY: {
+ char c;
+ int length;
+ char *str;
+
+ if (objc < 4 || objc > 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?");
return TCL_ERROR;
}
- hPtr = Tcl_FindHashEntry(&textPtr->markTable, argv[3]);
- if (hPtr == NULL) {
- Tcl_AppendResult(interp, "there is no mark named \"",
- argv[3], "\"", (char *) NULL);
- return TCL_ERROR;
+ str = Tcl_GetStringFromObj(objv[3],&length);
+ if (length == 6 && !strcmp(str, "insert")) {
+ markPtr = textPtr->insertMarkPtr;
+ } else if (length == 7 && !strcmp(str, "current")) {
+ markPtr = textPtr->currentMarkPtr;
+ } else {
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, str);
+ if (hPtr == NULL) {
+ Tcl_AppendResult(interp, "there is no mark named \"",
+ Tcl_GetString(objv[3]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
}
- markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
- if (argc == 4) {
+ if (objc == 4) {
if (markPtr->typePtr == &tkTextRightMarkType) {
Tcl_SetResult(interp, "right", TCL_STATIC);
} else {
@@ -138,77 +153,83 @@ TkTextMarkCmd(textPtr, interp, argc, argv)
}
return TCL_OK;
}
- length = strlen(argv[4]);
- c = argv[4][0];
- if ((c == 'l') && (strncmp(argv[4], "left", length) == 0)) {
+ str = Tcl_GetStringFromObj(objv[4],&length);
+ c = str[0];
+ if ((c == 'l') && (strncmp(str, "left", (unsigned)length) == 0)) {
newTypePtr = &tkTextLeftMarkType;
- } else if ((c == 'r') && (strncmp(argv[4], "right", length) == 0)) {
+ } else if ((c == 'r') &&
+ (strncmp(str, "right", (unsigned)length) == 0)) {
newTypePtr = &tkTextRightMarkType;
} else {
- Tcl_AppendResult(interp, "bad mark gravity \"",
- argv[4], "\": must be left or right", (char *) NULL);
+ Tcl_AppendResult(interp, "bad mark gravity \"", str,
+ "\": must be left or right", NULL);
return TCL_ERROR;
}
TkTextMarkSegToIndex(textPtr, markPtr, &index);
- TkBTreeUnlinkSegment(textPtr->tree, markPtr,
- markPtr->body.mark.linePtr);
+ TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
markPtr->typePtr = newTypePtr;
TkBTreeLinkSegment(markPtr, &index);
- } else if ((c == 'n') && (strncmp(argv[2], "names", length) == 0)) {
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " mark names\"", (char *) NULL);
+ break;
+ }
+ case MARK_NAMES:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- for (hPtr = Tcl_FirstHashEntry(&textPtr->markTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_AppendElement(interp, "insert");
+ Tcl_AppendElement(interp, "current");
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_AppendElement(interp,
- Tcl_GetHashKey(&textPtr->markTable, hPtr));
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr));
}
- } else if ((c == 'n') && (strncmp(argv[2], "next", length) == 0)) {
- if (argc != 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " mark next index\"", (char *) NULL);
+ break;
+ case MARK_NEXT:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
return TCL_ERROR;
}
- return MarkFindNext(interp, textPtr, argv[3]);
- } else if ((c == 'p') && (strncmp(argv[2], "previous", length) == 0)) {
- if (argc != 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " mark previous index\"", (char *) NULL);
+ return MarkFindNext(interp, textPtr, Tcl_GetString(objv[3]));
+ case MARK_PREVIOUS:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
return TCL_ERROR;
}
- return MarkFindPrev(interp, textPtr, argv[3]);
- } else if ((c == 's') && (strncmp(argv[2], "set", length) == 0)) {
- if (argc != 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " mark set markName index\"", (char *) NULL);
+ return MarkFindPrev(interp, textPtr, Tcl_GetString(objv[3]));
+ case MARK_SET:
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "markName index");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[4], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[4], &index) != TCL_OK) {
return TCL_ERROR;
}
- TkTextSetMark(textPtr, argv[3], &index);
- } else if ((c == 'u') && (strncmp(argv[2], "unset", length) == 0)) {
- for (i = 3; i < argc; i++) {
- hPtr = Tcl_FindHashEntry(&textPtr->markTable, argv[i]);
+ TkTextSetMark(textPtr, Tcl_GetString(objv[3]), &index);
+ return TCL_OK;
+ case MARK_UNSET: {
+ int i;
+
+ for (i = 3; i < objc; i++) {
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable,
+ Tcl_GetString(objv[i]));
if (hPtr != NULL) {
markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+
+ /*
+ * Special case not needed with peer widgets.
+ */
+
if ((markPtr == textPtr->insertMarkPtr)
|| (markPtr == textPtr->currentMarkPtr)) {
continue;
}
- TkBTreeUnlinkSegment(textPtr->tree, markPtr,
- markPtr->body.mark.linePtr);
+ TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
Tcl_DeleteHashEntry(hPtr);
ckfree((char *) markPtr);
}
}
- } else {
- Tcl_AppendResult(interp, "bad mark option \"", argv[2],
- "\": must be gravity, names, next, previous, set, or unset",
- (char *) NULL);
- return TCL_ERROR;
+ break;
+ }
}
return TCL_OK;
}
@@ -218,8 +239,8 @@ TkTextMarkCmd(textPtr, interp, argc, argv)
*
* TkTextSetMark --
*
- * Set a mark to a particular position, creating a new mark if
- * one doesn't already exist.
+ * Set a mark to a particular position, creating a new mark if one
+ * doesn't already exist.
*
* Results:
* The return value is a pointer to the mark that was just set.
@@ -231,39 +252,57 @@ TkTextMarkCmd(textPtr, interp, argc, argv)
*/
TkTextSegment *
-TkTextSetMark(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget in which to create mark. */
- CONST char *name; /* Name of mark to set. */
- TkTextIndex *indexPtr; /* Where to set mark. */
+TkTextSetMark(
+ TkText *textPtr, /* Text widget in which to create mark. */
+ const char *name, /* Name of mark to set. */
+ TkTextIndex *indexPtr) /* Where to set mark. */
{
- Tcl_HashEntry *hPtr;
+ Tcl_HashEntry *hPtr = NULL;
TkTextSegment *markPtr;
TkTextIndex insertIndex;
- int new;
-
- hPtr = Tcl_CreateHashEntry(&textPtr->markTable, name, &new);
- markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
- if (!new) {
+ int isNew, widgetSpecific;
+
+ if (!strcmp(name, "insert")) {
+ widgetSpecific = 1;
+ markPtr = textPtr->insertMarkPtr;
+ isNew = (markPtr == NULL ? 1 : 0);
+ } else if (!strcmp(name, "current")) {
+ widgetSpecific = 2;
+ markPtr = textPtr->currentMarkPtr;
+ isNew = (markPtr == NULL ? 1 : 0);
+ } else {
+ widgetSpecific = 0;
+ hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name,
+ &isNew);
+ markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+ }
+ if (!isNew) {
/*
- * If this is the insertion point that's being moved, be sure
- * to force a display update at the old position. Also, don't
- * let the insertion cursor be after the final newline of the
- * file.
+ * If this is the insertion point that's being moved, be sure to force
+ * a display update at the old position. Also, don't let the insertion
+ * cursor be after the final newline of the file.
*/
if (markPtr == textPtr->insertMarkPtr) {
TkTextIndex index, index2;
+
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
- TkTextIndexForwChars(&index, 1, &index2);
- TkTextChanged(textPtr, &index, &index2);
- if (TkBTreeLineIndex(indexPtr->linePtr)
- == TkBTreeNumLines(textPtr->tree)) {
- TkTextIndexBackChars(indexPtr, 1, &insertIndex);
+ TkTextIndexForwChars(NULL,&index, 1, &index2, COUNT_INDICES);
+
+ /*
+ * While we wish to redisplay, no heights have changed, so no need
+ * to call TkTextInvalidateLineMetrics.
+ */
+
+ TkTextChanged(NULL, textPtr, &index, &index2);
+ if (TkBTreeLinesTo(textPtr, indexPtr->linePtr) ==
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) {
+ TkTextIndexBackChars(NULL,indexPtr, 1, &insertIndex,
+ COUNT_INDICES);
indexPtr = &insertIndex;
}
}
- TkBTreeUnlinkSegment(textPtr->tree, markPtr,
- markPtr->body.mark.linePtr);
+ TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
} else {
markPtr = (TkTextSegment *) ckalloc(MSEG_SIZE);
markPtr->typePtr = &tkTextRightMarkType;
@@ -271,7 +310,13 @@ TkTextSetMark(textPtr, name, indexPtr)
markPtr->body.mark.textPtr = textPtr;
markPtr->body.mark.linePtr = indexPtr->linePtr;
markPtr->body.mark.hPtr = hPtr;
- Tcl_SetHashValue(hPtr, markPtr);
+ if (widgetSpecific == 0) {
+ Tcl_SetHashValue(hPtr, markPtr);
+ } else if (widgetSpecific == 1) {
+ textPtr->insertMarkPtr = markPtr;
+ } else {
+ textPtr->currentMarkPtr = markPtr;
+ }
}
TkBTreeLinkSegment(markPtr, indexPtr);
@@ -283,8 +328,14 @@ TkTextSetMark(textPtr, name, indexPtr)
if (markPtr == textPtr->insertMarkPtr) {
TkTextIndex index2;
- TkTextIndexForwChars(indexPtr, 1, &index2);
- TkTextChanged(textPtr, indexPtr, &index2);
+ TkTextIndexForwChars(NULL,indexPtr, 1, &index2, COUNT_INDICES);
+
+ /*
+ * While we wish to redisplay, no heights have changed, so no need to
+ * call TkTextInvalidateLineMetrics
+ */
+
+ TkTextChanged(NULL, textPtr, indexPtr, &index2);
}
return markPtr;
}
@@ -294,9 +345,9 @@ TkTextSetMark(textPtr, name, indexPtr)
*
* TkTextMarkSegToIndex --
*
- * Given a segment that is a mark, create an index that
- * refers to the next text character (or other text segment
- * with non-zero size) after the mark.
+ * Given a segment that is a mark, create an index that refers to the
+ * next text character (or other text segment with non-zero size) after
+ * the mark.
*
* Results:
* *IndexPtr is filled in with index information.
@@ -308,14 +359,14 @@ TkTextSetMark(textPtr, name, indexPtr)
*/
void
-TkTextMarkSegToIndex(textPtr, markPtr, indexPtr)
- TkText *textPtr; /* Text widget containing mark. */
- TkTextSegment *markPtr; /* Mark segment. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextMarkSegToIndex(
+ TkText *textPtr, /* Text widget containing mark. */
+ TkTextSegment *markPtr, /* Mark segment. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
TkTextSegment *segPtr;
- indexPtr->tree = textPtr->tree;
+ indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = markPtr->body.mark.linePtr;
indexPtr->byteIndex = 0;
for (segPtr = indexPtr->linePtr->segPtr; segPtr != markPtr;
@@ -329,15 +380,14 @@ TkTextMarkSegToIndex(textPtr, markPtr, indexPtr)
*
* TkTextMarkNameToIndex --
*
- * Given the name of a mark, return an index corresponding
- * to the mark name.
+ * Given the name of a mark, return an index corresponding to the mark
+ * name.
*
* Results:
- * The return value is TCL_OK if "name" exists as a mark in
- * the text widget. In this case *indexPtr is filled in with
- * the next segment whose after the mark whose size is
- * non-zero. TCL_ERROR is returned if the mark doesn't exist
- * in the text widget.
+ * The return value is TCL_OK if "name" exists as a mark in the text
+ * widget. In this case *indexPtr is filled in with the next segment
+ * whose after the mark whose size is non-zero. TCL_ERROR is returned if
+ * the mark doesn't exist in the text widget.
*
* Side effects:
* None.
@@ -346,19 +396,30 @@ TkTextMarkSegToIndex(textPtr, markPtr, indexPtr)
*/
int
-TkTextMarkNameToIndex(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget containing mark. */
- CONST char *name; /* Name of mark. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextMarkNameToIndex(
+ TkText *textPtr, /* Text widget containing mark. */
+ const char *name, /* Name of mark. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
- Tcl_HashEntry *hPtr;
+ TkTextSegment *segPtr;
- hPtr = Tcl_FindHashEntry(&textPtr->markTable, name);
- if (hPtr == NULL) {
- return TCL_ERROR;
+ if (textPtr == NULL) {
+ return TCL_ERROR;
+ }
+
+ if (!strcmp(name, "insert")) {
+ segPtr = textPtr->insertMarkPtr;
+ } else if (!strcmp(name, "current")) {
+ segPtr = textPtr->currentMarkPtr;
+ } else {
+ Tcl_HashEntry *hPtr;
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, name);
+ if (hPtr == NULL) {
+ return TCL_ERROR;
+ }
+ segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
}
- TkTextMarkSegToIndex(textPtr, (TkTextSegment *) Tcl_GetHashValue(hPtr),
- indexPtr);
+ TkTextMarkSegToIndex(textPtr, segPtr, indexPtr);
return TCL_OK;
}
@@ -367,27 +428,27 @@ TkTextMarkNameToIndex(textPtr, name, indexPtr)
*
* MarkDeleteProc --
*
- * This procedure is invoked by the text B-tree code whenever
- * a mark lies in a range of characters being deleted.
+ * This function is invoked by the text B-tree code whenever a mark lies
+ * in a range of characters being deleted.
*
* Results:
* Returns 1 to indicate that deletion has been rejected.
*
* Side effects:
- * None (even if the whole tree is being deleted we don't
- * free up the mark; it will be done elsewhere).
+ * None (even if the whole tree is being deleted we don't free up the
+ * mark; it will be done elsewhere).
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
-MarkDeleteProc(segPtr, linePtr, treeGone)
- TkTextSegment *segPtr; /* Segment being deleted. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is
- * being deleted, so everything must
- * get cleaned up. */
+MarkDeleteProc(
+ TkTextSegment *segPtr, /* Segment being deleted. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
+ * deleted, so everything must get cleaned
+ * up. */
{
return 1;
}
@@ -397,8 +458,8 @@ MarkDeleteProc(segPtr, linePtr, treeGone)
*
* MarkCleanupProc --
*
- * This procedure is invoked by the B-tree code whenever a
- * mark segment is moved from one line to another.
+ * This function is invoked by the B-tree code whenever a mark segment is
+ * moved from one line to another.
*
* Results:
* None.
@@ -410,9 +471,9 @@ MarkDeleteProc(segPtr, linePtr, treeGone)
*/
static TkTextSegment *
-MarkCleanupProc(markPtr, linePtr)
- TkTextSegment *markPtr; /* Mark segment that's being moved. */
- TkTextLine *linePtr; /* Line that now contains segment. */
+MarkCleanupProc(
+ TkTextSegment *markPtr, /* Mark segment that's being moved. */
+ TkTextLine *linePtr) /* Line that now contains segment. */
{
markPtr->body.mark.linePtr = linePtr;
return markPtr;
@@ -423,13 +484,13 @@ MarkCleanupProc(markPtr, linePtr)
*
* MarkLayoutProc --
*
- * This procedure is the "layoutProc" for mark segments.
+ * This function is the "layoutProc" for mark segments.
*
* Results:
- * If the mark isn't the insertion cursor then the return
- * value is -1 to indicate that this segment shouldn't be
- * displayed. If the mark is the insertion character then
- * 1 is returned and the chunkPtr structure is filled in.
+ * If the mark isn't the insertion cursor then the return value is -1 to
+ * indicate that this segment shouldn't be displayed. If the mark is the
+ * insertion character then 1 is returned and the chunkPtr structure is
+ * filled in.
*
* Side effects:
* None, except for filling in chunkPtr.
@@ -437,26 +498,24 @@ MarkCleanupProc(markPtr, linePtr)
*--------------------------------------------------------------
*/
- /*ARGSUSED*/
static int
-MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Identifies first character in chunk. */
- TkTextSegment *segPtr; /* Segment corresponding to indexPtr. */
- int offset; /* Offset within segPtr corresponding to
+MarkLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
+ int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars; /* Chunk must not include more than this
- * many characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int maxChars, /* Chunk must not include more than this many
+ * characters. */
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode; /* Not used. */
- register TkTextDispChunk *chunkPtr;
- /* Structure to fill in with information
- * about this chunk. The x field has already
- * been set by the caller. */
+ TkWrapMode wrapMode, /* Not used. */
+ register TkTextDispChunk *chunkPtr)
+ /* Structure to fill in with information about
+ * this chunk. The x field has already been
+ * set by the caller. */
{
if (segPtr != textPtr->insertMarkPtr) {
return -1;
@@ -464,8 +523,8 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
chunkPtr->displayProc = TkTextInsertDisplayProc;
chunkPtr->undisplayProc = InsertUndisplayProc;
- chunkPtr->measureProc = (Tk_ChunkMeasureProc *) NULL;
- chunkPtr->bboxProc = (Tk_ChunkBboxProc *) NULL;
+ chunkPtr->measureProc = NULL;
+ chunkPtr->bboxProc = NULL;
chunkPtr->numBytes = 0;
chunkPtr->minAscent = 0;
chunkPtr->minDescent = 0;
@@ -473,9 +532,8 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
chunkPtr->width = 0;
/*
- * Note: can't break a line after the insertion cursor: this
- * prevents the insertion cursor from being stranded at the end
- * of a line.
+ * Note: can't break a line after the insertion cursor: this prevents the
+ * insertion cursor from being stranded at the end of a line.
*/
chunkPtr->breakIndex = -1;
@@ -488,8 +546,7 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
*
* TkTextInsertDisplayProc --
*
- * This procedure is called to display the insertion
- * cursor.
+ * This function is called to display the insertion cursor.
*
* Results:
* None.
@@ -502,30 +559,43 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
/* ARGSUSED */
void
-TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to
- * draw this chunk (may differ from
- * the x-position in the chunk because
- * of scrolling). */
- int y; /* Y-position at which to draw this
- * chunk in dst (x-position is in
- * the chunk itself). */
- int height; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing. */
- Drawable dst; /* Pixmap or window in which to draw
- * chunk. */
- int screenY; /* Y-coordinate in text window that
- * corresponds to y. */
+TkTextInsertDisplayProc(
+ TkText *textPtr, /* The current text widget. */
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
+ * chunk (may differ from the x-position in
+ * the chunk because of scrolling). */
+ int y, /* Y-position at which to draw this chunk in
+ * dst (x-position is in the chunk itself). */
+ int height, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing. */
+ Drawable dst, /* Pixmap or window in which to draw chunk. */
+ int screenY) /* Y-coordinate in text window that
+ * corresponds to y. */
{
- TkText *textPtr = (TkText *) chunkPtr->clientData;
+ /*
+ * We have no need for the clientData.
+ */
+
+ /* TkText *textPtr = (TkText *) chunkPtr->clientData; */
+ TkTextIndex index;
int halfWidth = textPtr->insertWidth/2;
+ int rightSideWidth;
+ int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0;
+
+ if(textPtr->insertCursorType) {
+ TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
+ TkTextIndexBbox(textPtr, &index, &ix, &iy, &iw, &ih, &charWidth);
+ rightSideWidth = charWidth + halfWidth;
+ } else {
+ rightSideWidth = halfWidth;
+ }
- if ((x + halfWidth) < 0) {
+ if ((x + rightSideWidth) < 0) {
/*
- * The insertion cursor is off-screen.
- * Indicate caret at 0,0 and return.
+ * The insertion cursor is off-screen. Indicate caret at 0,0 and
+ * return.
*/
Tk_SetCaretPos(textPtr->tkwin, 0, 0, height);
@@ -535,20 +605,20 @@ TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
Tk_SetCaretPos(textPtr->tkwin, x - halfWidth, screenY, height);
/*
- * As a special hack to keep the cursor visible on mono displays
- * (or anywhere else that the selection and insertion cursors
- * have the same color) write the default background in the cursor
- * area (instead of nothing) when the cursor isn't on. Otherwise
- * the selection might hide the cursor.
+ * As a special hack to keep the cursor visible on mono displays (or
+ * anywhere else that the selection and insertion cursors have the same
+ * color) write the default background in the cursor area (instead of
+ * nothing) when the cursor isn't on. Otherwise the selection might hide
+ * the cursor.
*/
if (textPtr->flags & INSERT_ON) {
Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder,
- x - halfWidth, y, textPtr->insertWidth, height,
+ x - halfWidth, y, charWidth + textPtr->insertWidth, height,
textPtr->insertBorderWidth, TK_RELIEF_RAISED);
} else if (textPtr->selBorder == textPtr->insertBorder) {
Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->border,
- x - halfWidth, y, textPtr->insertWidth, height,
+ x - halfWidth, y, charWidth + textPtr->insertWidth, height,
0, TK_RELIEF_FLAT);
}
}
@@ -558,9 +628,8 @@ TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
*
* InsertUndisplayProc --
*
- * This procedure is called when the insertion cursor is no
- * longer at a visible point on the display. It does nothing
- * right now.
+ * This function is called when the insertion cursor is no longer at a
+ * visible point on the display. It does nothing right now.
*
* Results:
* None.
@@ -573,10 +642,9 @@ TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY)
/* ARGSUSED */
static void
-InsertUndisplayProc(textPtr, chunkPtr)
- TkText *textPtr; /* Overall information about text
- * widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is about to be freed. */
+InsertUndisplayProc(
+ TkText *textPtr, /* Overall information about text widget. */
+ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
return;
}
@@ -586,41 +654,52 @@ InsertUndisplayProc(textPtr, chunkPtr)
*
* MarkCheckProc --
*
- * This procedure is invoked by the B-tree code to perform
- * consistency checks on mark segments.
+ * This function is invoked by the B-tree code to perform consistency
+ * checks on mark segments.
*
* Results:
* None.
*
* Side effects:
- * The procedure panics if it detects anything wrong with
+ * The function panics if it detects anything wrong with
* the mark.
*
*--------------------------------------------------------------
*/
static void
-MarkCheckProc(markPtr, linePtr)
- TkTextSegment *markPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+MarkCheckProc(
+ TkTextSegment *markPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
if (markPtr->body.mark.linePtr != linePtr) {
- panic("MarkCheckProc: markPtr->body.mark.linePtr bogus");
+ Tcl_Panic("MarkCheckProc: markPtr->body.mark.linePtr bogus");
}
/*
- * Make sure that the mark is still present in the text's mark
- * hash table.
+ * These two marks are not in the hash table
*/
- for (hPtr = Tcl_FirstHashEntry(&markPtr->body.mark.textPtr->markTable,
+ if (markPtr->body.mark.textPtr->insertMarkPtr == markPtr) {
+ return;
+ }
+ if (markPtr->body.mark.textPtr->currentMarkPtr == markPtr) {
+ return;
+ }
+
+ /*
+ * Make sure that the mark is still present in the text's mark hash table.
+ */
+
+ for (hPtr = Tcl_FirstHashEntry(
+ &markPtr->body.mark.textPtr->sharedTextPtr->markTable,
&search); hPtr != markPtr->body.mark.hPtr;
hPtr = Tcl_NextHashEntry(&search)) {
if (hPtr == NULL) {
- panic("MarkCheckProc couldn't find hash table entry for mark");
+ Tcl_Panic("MarkCheckProc couldn't find hash table entry for mark");
}
}
}
@@ -630,7 +709,7 @@ MarkCheckProc(markPtr, linePtr)
*
* MarkFindNext --
*
- * This procedure searches forward for the next mark.
+ * This function searches forward for the next mark.
*
* Results:
* A standard Tcl result, which is a mark name or an empty string.
@@ -642,56 +721,82 @@ MarkCheckProc(markPtr, linePtr)
*/
static int
-MarkFindNext(interp, textPtr, string)
- Tcl_Interp *interp; /* For error reporting */
- TkText *textPtr; /* The widget */
- CONST char *string; /* The starting index or mark name */
+MarkFindNext(
+ Tcl_Interp *interp, /* For error reporting */
+ TkText *textPtr, /* The widget */
+ const char *string) /* The starting index or mark name */
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
register TkTextSegment *segPtr;
int offset;
-
- hPtr = Tcl_FindHashEntry(&textPtr->markTable, string);
- if (hPtr != NULL) {
- /*
- * If given a mark name, return the next mark in the list of
- * segments, even if it happens to be at the same character position.
- */
- segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+ if (!strcmp(string, "insert")) {
+ segPtr = textPtr->insertMarkPtr;
+ TkTextMarkSegToIndex(textPtr, segPtr, &index);
+ segPtr = segPtr->nextPtr;
+ } else if (!strcmp(string, "current")) {
+ segPtr = textPtr->currentMarkPtr;
TkTextMarkSegToIndex(textPtr, segPtr, &index);
segPtr = segPtr->nextPtr;
} else {
- /*
- * For non-mark name indices we want to return any marks that
- * are right at the index.
- */
- if (TkTextGetIndex(interp, textPtr, string, &index) != TCL_OK) {
- return TCL_ERROR;
- }
- for (offset = 0, segPtr = index.linePtr->segPtr;
- segPtr != NULL && offset < index.byteIndex;
- offset += segPtr->size, segPtr = segPtr->nextPtr) {
- /* Empty loop body */ ;
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, string);
+ if (hPtr != NULL) {
+ /*
+ * If given a mark name, return the next mark in the list of
+ * segments, even if it happens to be at the same character
+ * position.
+ */
+
+ segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+ TkTextMarkSegToIndex(textPtr, segPtr, &index);
+ segPtr = segPtr->nextPtr;
+ } else {
+ /*
+ * For non-mark name indices we want to return any marks that are
+ * right at the index.
+ */
+
+ if (TkTextGetIndex(interp, textPtr, string, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ for (offset = 0, segPtr = index.linePtr->segPtr;
+ segPtr != NULL && offset < index.byteIndex;
+ offset += segPtr->size, segPtr = segPtr->nextPtr) {
+ /* Empty loop body */ ;
+ }
}
}
+
while (1) {
/*
- * segPtr points at the first possible candidate,
- * or NULL if we ran off the end of the line.
+ * segPtr points at the first possible candidate, or NULL if we ran
+ * off the end of the line.
*/
+
for ( ; segPtr != NULL ; segPtr = segPtr->nextPtr) {
if (segPtr->typePtr == &tkTextRightMarkType ||
segPtr->typePtr == &tkTextLeftMarkType) {
- Tcl_SetResult(interp,
- Tcl_GetHashKey(&textPtr->markTable, segPtr->body.mark.hPtr),
- TCL_STATIC);
+ if (segPtr == textPtr->currentMarkPtr) {
+ Tcl_SetResult(interp, "current", TCL_STATIC);
+ } else if (segPtr == textPtr->insertMarkPtr) {
+ Tcl_SetResult(interp, "insert", TCL_STATIC);
+ } else if (segPtr->body.mark.textPtr != textPtr) {
+ /*
+ * Ignore widget-specific marks for the other widgets.
+ */
+
+ continue;
+ } else {
+ Tcl_SetResult(interp,
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ segPtr->body.mark.hPtr), TCL_STATIC);
+ }
return TCL_OK;
}
}
- index.linePtr = TkBTreeNextLine(index.linePtr);
- if (index.linePtr == (TkTextLine *) NULL) {
+ index.linePtr = TkBTreeNextLine(textPtr, index.linePtr);
+ if (index.linePtr == NULL) {
return TCL_OK;
}
index.byteIndex = 0;
@@ -704,7 +809,7 @@ MarkFindNext(interp, textPtr, string)
*
* MarkFindPrev --
*
- * This procedure searches backwards for the previous mark.
+ * This function searches backwards for the previous mark.
*
* Results:
* A standard Tcl result, which is a mark name or an empty string.
@@ -716,45 +821,57 @@ MarkFindNext(interp, textPtr, string)
*/
static int
-MarkFindPrev(interp, textPtr, string)
- Tcl_Interp *interp; /* For error reporting */
- TkText *textPtr; /* The widget */
- CONST char *string; /* The starting index or mark name */
+MarkFindPrev(
+ Tcl_Interp *interp, /* For error reporting */
+ TkText *textPtr, /* The widget */
+ const char *string) /* The starting index or mark name */
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
register TkTextSegment *segPtr, *seg2Ptr, *prevPtr;
int offset;
-
- hPtr = Tcl_FindHashEntry(&textPtr->markTable, string);
- if (hPtr != NULL) {
- /*
- * If given a mark name, return the previous mark in the list of
- * segments, even if it happens to be at the same character position.
- */
- segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+ if (!strcmp(string, "insert")) {
+ segPtr = textPtr->insertMarkPtr;
+ TkTextMarkSegToIndex(textPtr, segPtr, &index);
+ } else if (!strcmp(string, "current")) {
+ segPtr = textPtr->currentMarkPtr;
TkTextMarkSegToIndex(textPtr, segPtr, &index);
} else {
- /*
- * For non-mark name indices we do not return any marks that
- * are right at the index.
- */
- if (TkTextGetIndex(interp, textPtr, string, &index) != TCL_OK) {
- return TCL_ERROR;
- }
- for (offset = 0, segPtr = index.linePtr->segPtr;
- segPtr != NULL && offset < index.byteIndex;
- offset += segPtr->size, segPtr = segPtr->nextPtr) {
- /* Empty loop body */ ;
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, string);
+ if (hPtr != NULL) {
+ /*
+ * If given a mark name, return the previous mark in the list of
+ * segments, even if it happens to be at the same character
+ * position.
+ */
+
+ segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+ TkTextMarkSegToIndex(textPtr, segPtr, &index);
+ } else {
+ /*
+ * For non-mark name indices we do not return any marks that are
+ * right at the index.
+ */
+
+ if (TkTextGetIndex(interp, textPtr, string, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ for (offset = 0, segPtr = index.linePtr->segPtr;
+ segPtr != NULL && offset < index.byteIndex;
+ offset += segPtr->size, segPtr = segPtr->nextPtr) {
+ /* Empty loop body */
+ }
}
}
+
while (1) {
/*
- * segPtr points just past the first possible candidate,
- * or at the begining of the line.
+ * segPtr points just past the first possible candidate, or at the
+ * begining of the line.
*/
- for (prevPtr = NULL, seg2Ptr = index.linePtr->segPtr;
+
+ for (prevPtr = NULL, seg2Ptr = index.linePtr->segPtr;
seg2Ptr != NULL && seg2Ptr != segPtr;
seg2Ptr = seg2Ptr->nextPtr) {
if (seg2Ptr->typePtr == &tkTextRightMarkType ||
@@ -763,15 +880,35 @@ MarkFindPrev(interp, textPtr, string)
}
}
if (prevPtr != NULL) {
- Tcl_SetResult(interp,
- Tcl_GetHashKey(&textPtr->markTable, prevPtr->body.mark.hPtr),
- TCL_STATIC);
+ if (prevPtr == textPtr->currentMarkPtr) {
+ Tcl_SetResult(interp, "current", TCL_STATIC);
+ } else if (prevPtr == textPtr->insertMarkPtr) {
+ Tcl_SetResult(interp, "insert", TCL_STATIC);
+ } else if (prevPtr->body.mark.textPtr != textPtr) {
+ /*
+ * Ignore widget-specific marks for the other widgets.
+ */
+
+ continue;
+ } else {
+ Tcl_SetResult(interp,
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ prevPtr->body.mark.hPtr), TCL_STATIC);
+ }
return TCL_OK;
}
- index.linePtr = TkBTreePreviousLine(index.linePtr);
- if (index.linePtr == (TkTextLine *) NULL) {
+ index.linePtr = TkBTreePreviousLine(textPtr, index.linePtr);
+ if (index.linePtr == NULL) {
return TCL_OK;
}
segPtr = NULL;
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index b05eb8f..b0d33ce 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -1,93 +1,116 @@
-/*
+/*
* tkTextTag.c --
*
- * This module implements the "tag" subcommand of the widget command
- * for text widgets, plus most of the other high-level functions
- * related to tags.
+ * This module implements the "tag" subcommand of the widget command for
+ * text widgets, plus most of the other high-level functions related to
+ * tags.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "default.h"
-#include "tkPort.h"
#include "tkInt.h"
#include "tkText.h"
-static Tk_ConfigSpec tagConfigSpecs[] = {
- {TK_CONFIG_BORDER, "-background", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, border), TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-bgstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, bgStipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-borderwidth", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(TkTextTag, bdString),
- TK_CONFIG_DONT_SET_DEFAULT|TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-elide", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(TkTextTag, elideString),
- TK_CONFIG_DONT_SET_DEFAULT|TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-fgstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, fgStipple), TK_CONFIG_NULL_OK},
- {TK_CONFIG_FONT, "-font", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, tkfont), TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-foreground", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, fgColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-justify", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, justifyString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-lmargin1", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, lMargin1String), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-lmargin2", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, lMargin2String), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-offset", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, offsetString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-overstrike", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, overstrikeString),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-relief", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, reliefString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-rmargin", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, rMarginString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-spacing1", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, spacing1String), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-spacing2", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, spacing2String), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-spacing3", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, spacing3String), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-tabs", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, tabString), TK_CONFIG_NULL_OK},
- {TK_CONFIG_STRING, "-underline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, underlineString),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-wrap", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextTag, wrapMode),
- TK_CONFIG_NULL_OK, &TkTextWrapModeOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+/*
+ * The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap
+ * option of tags in a Text widget. These values are used as indices into the
+ * string table below. Tags are allowed an empty wrap value, but the widget as
+ * a whole is not.
+ */
+
+static char *wrapStrings[] = {
+ "char", "none", "word", "", NULL
};
/*
- * Forward declarations for procedures defined later in this file:
+ * The 'TkTextTabStyle' enum in tkText.h is used to define a type for the
+ * -tabstyle option of the Text widget. These values are used as indices into
+ * the string table below. Tags are allowed an empty wrap value, but the
+ * widget as a whole is not.
*/
-static void ChangeTagPriority _ANSI_ARGS_((TkText *textPtr,
- TkTextTag *tagPtr, int prio));
-static TkTextTag * FindTag _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, CONST char *tagName));
-static void SortTags _ANSI_ARGS_((int numTags,
- TkTextTag **tagArrayPtr));
-static int TagSortProc _ANSI_ARGS_((CONST VOID *first,
- CONST VOID *second));
+static char *tabStyleStrings[] = {
+ "tabular", "wordprocessor", "", NULL
+};
+
+static const Tk_OptionSpec tagOptionSpecs[] = {
+ {TK_OPTION_BORDER, "-background", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL,
+ "0", Tk_Offset(TkTextTag, borderWidthPtr), Tk_Offset(TkTextTag, borderWidth),
+ TK_OPTION_DONT_SET_DEFAULT|TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-elide", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextTag, elideString),
+ TK_OPTION_DONT_SET_DEFAULT|TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_BITMAP, "-fgstipple", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_FONT, "-font", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_COLOR, "-foreground", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-justify", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0},
+ {TK_OPTION_STRING, "-lmargin1", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_STRING, "-lmargin2", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_STRING, "-offset", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-overstrike", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, overstrikeString),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-relief", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-rmargin", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0},
+ {TK_OPTION_STRING, "-spacing1", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_STRING, "-spacing2", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_STRING, "-spacing3", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_STRING, "-tabs", NULL, NULL,
+ NULL, Tk_Offset(TkTextTag, tabStringPtr), -1, TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, tabStyle),
+ TK_OPTION_NULL_OK, (ClientData) tabStyleStrings, 0},
+ {TK_OPTION_STRING, "-underline", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, underlineString),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, wrapMode),
+ TK_OPTION_NULL_OK, (ClientData) wrapStrings, 0},
+ {TK_OPTION_END}
+};
+
+/*
+ * Forward declarations for functions defined later in this file:
+ */
+
+static void ChangeTagPriority(TkText *textPtr, TkTextTag *tagPtr,
+ int prio);
+static TkTextTag * FindTag(Tcl_Interp *interp, TkText *textPtr,
+ Tcl_Obj *tagName);
+static void SortTags(int numTags, TkTextTag **tagArrayPtr);
+static int TagSortProc(CONST VOID *first, CONST VOID *second);
+static void TagBindEvent(TkText *textPtr, XEvent *eventPtr,
+ int numTags, TkTextTag **tagArrayPtr);
/*
*--------------------------------------------------------------
*
* TkTextTagCmd --
*
- * This procedure is invoked to process the "tag" options of
- * the widget command for text widgets. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "tag" options of the widget
+ * command for text widgets. See the user documentation for details on
+ * what it does.
*
* Results:
* A standard Tcl result.
@@ -99,47 +122,61 @@ static int TagSortProc _ANSI_ARGS_((CONST VOID *first,
*/
int
-TkTextTagCmd(textPtr, interp, argc, argv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextTagCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "tag". */
+ * objv[1] is "tag". */
{
- int c, i, addTag;
- size_t length;
- char *fullOption;
+ static CONST char *tagOptionStrings[] = {
+ "add", "bind", "cget", "configure", "delete", "lower", "names",
+ "nextrange", "prevrange", "raise", "ranges", "remove", NULL
+ };
+ enum tagOptions {
+ TAG_ADD, TAG_BIND, TAG_CGET, TAG_CONFIGURE, TAG_DELETE, TAG_LOWER,
+ TAG_NAMES, TAG_NEXTRANGE, TAG_PREVRANGE, TAG_RAISE, TAG_RANGES,
+ TAG_REMOVE
+ };
+ int optionIndex, i;
register TkTextTag *tagPtr;
- TkTextIndex first, last, index1, index2;
+ TkTextIndex index1, index2;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
+ return TCL_ERROR;
+ }
- if (argc < 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag option ?arg arg ...?\"", (char *) NULL);
+ if (Tcl_GetIndexFromObj(interp, objv[2], tagOptionStrings,
+ "tag option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- c = argv[2][0];
- length = strlen(argv[2]);
- if ((c == 'a') && (strncmp(argv[2], "add", length) == 0)) {
- fullOption = "add";
- addTag = 1;
-
- addAndRemove:
- if (argc < 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag ", fullOption,
- " tagName index1 ?index2 index1 index2 ...?\"",
- (char *) NULL);
+
+ switch ((enum tagOptions)optionIndex) {
+ case TAG_ADD:
+ case TAG_REMOVE: {
+ int addTag;
+
+ if (((enum tagOptions)optionIndex) == TAG_ADD) {
+ addTag = 1;
+ } else {
+ addTag = 0;
+ }
+ if (objc < 5) {
+ Tcl_WrongNumArgs(interp, 3, objv,
+ "tagName index1 ?index2 index1 index2 ...?");
return TCL_ERROR;
}
- tagPtr = TkTextCreateTag(textPtr, argv[3]);
- for (i = 4; i < argc; i += 2) {
- if (TkTextGetIndex(interp, textPtr, argv[i], &index1) != TCL_OK) {
+ tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), NULL);
+ for (i = 4; i < objc; i += 2) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[i],
+ &index1) != TCL_OK) {
return TCL_ERROR;
}
- if (argc > (i+1)) {
- if (TkTextGetIndex(interp, textPtr, argv[i+1], &index2)
- != TCL_OK) {
+ if (objc > (i+1)) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[i+1],
+ &index2) != TCL_OK) {
return TCL_ERROR;
}
if (TkTextIndexCmp(&index1, &index2) >= 0) {
@@ -147,85 +184,88 @@ TkTextTagCmd(textPtr, interp, argc, argv)
}
} else {
index2 = index1;
- TkTextIndexForwChars(&index2, 1, &index2);
+ TkTextIndexForwChars(NULL,&index2, 1, &index2, COUNT_INDICES);
}
if (tagPtr->affectsDisplay) {
- TkTextRedrawTag(textPtr, &index1, &index2, tagPtr, !addTag);
+ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, &index1, &index2,
+ tagPtr, !addTag);
} else {
/*
- * Still need to trigger enter/leave events on tags that
- * have changed.
+ * Still need to trigger enter/leave events on tags that have
+ * changed.
*/
TkTextEventuallyRepick(textPtr);
}
- TkBTreeTag(&index1, &index2, tagPtr, addTag);
-
- /*
- * If the tag is "sel" then grab the selection if we're supposed
- * to export it and don't already have it. Also, invalidate
- * partially-completed selection retrievals.
- */
-
- if (tagPtr == textPtr->selTagPtr) {
- XEvent event;
+ if (TkBTreeTag(&index1, &index2, tagPtr, addTag)) {
/*
- * Send an event that the selection changed.
- * This is equivalent to
- * "event generate $textWidget <<Selection>>"
+ * If the tag is "sel", and we actually adjusted something
+ * then grab the selection if we're supposed to export it and
+ * don't already have it.
+ *
+ * Also, invalidate partially-completed selection retrievals.
+ * We only need to check whether the tag is "sel" for this
+ * textPtr (not for other peer widget's "sel" tags) because we
+ * cannot reach this code path with a different widget's "sel"
+ * tag.
*/
- memset((VOID *) &event, 0, sizeof(event));
- event.xany.type = VirtualEvent;
- event.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
- event.xany.send_event = False;
- event.xany.window = Tk_WindowId(textPtr->tkwin);
- event.xany.display = Tk_Display(textPtr->tkwin);
- ((XVirtualEvent *) &event)->name = Tk_GetUid("Selection");
- Tk_HandleEvent(&event);
-
- if (addTag && textPtr->exportSelection
- && !(textPtr->flags & GOT_SELECTION)) {
- Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY,
- TkTextLostSelection, (ClientData) textPtr);
- textPtr->flags |= GOT_SELECTION;
+ if (tagPtr == textPtr->selTagPtr) {
+ /*
+ * Send an event that the selection changed. This is
+ * equivalent to:
+ * event generate $textWidget <<Selection>>
+ */
+
+ TkTextSelectionEvent(textPtr);
+
+ if (addTag && textPtr->exportSelection
+ && !(textPtr->flags & GOT_SELECTION)) {
+ Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY,
+ TkTextLostSelection, (ClientData) textPtr);
+ textPtr->flags |= GOT_SELECTION;
+ }
+ textPtr->abortSelections = 1;
}
- textPtr->abortSelections = 1;
}
}
- } else if ((c == 'b') && (strncmp(argv[2], "bind", length) == 0)) {
- if ((argc < 4) || (argc > 6)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag bind tagName ?sequence? ?command?\"",
- (char *) NULL);
+ break;
+ }
+ case TAG_BIND:
+ if ((objc < 4) || (objc > 6)) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName ?sequence? ?command?");
return TCL_ERROR;
}
- tagPtr = TkTextCreateTag(textPtr, argv[3]);
+ tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), NULL);
/*
- * Make a binding table if the widget doesn't already have
- * one.
+ * Make a binding table if the widget doesn't already have one.
*/
- if (textPtr->bindingTable == NULL) {
- textPtr->bindingTable = Tk_CreateBindingTable(interp);
+ if (textPtr->sharedTextPtr->bindingTable == NULL) {
+ textPtr->sharedTextPtr->bindingTable =
+ Tk_CreateBindingTable(interp);
}
- if (argc == 6) {
+ if (objc == 6) {
int append = 0;
unsigned long mask;
+ char *fifth = Tcl_GetString(objv[5]);
- if (argv[5][0] == 0) {
- return Tk_DeleteBinding(interp, textPtr->bindingTable,
- (ClientData) tagPtr, argv[4]);
+ if (fifth[0] == 0) {
+ return Tk_DeleteBinding(interp,
+ textPtr->sharedTextPtr->bindingTable,
+ (ClientData) tagPtr->name, Tcl_GetString(objv[4]));
}
- if (argv[5][0] == '+') {
- argv[5]++;
+ if (fifth[0] == '+') {
+ fifth++;
append = 1;
}
- mask = Tk_CreateBinding(interp, textPtr->bindingTable,
- (ClientData) tagPtr, argv[4], argv[5], append);
+ mask = Tk_CreateBinding(interp,
+ textPtr->sharedTextPtr->bindingTable,
+ (ClientData) tagPtr->name, Tcl_GetString(objv[4]), fifth,
+ append);
if (mask == 0) {
return TCL_ERROR;
}
@@ -234,89 +274,97 @@ TkTextTagCmd(textPtr, interp, argc, argv)
|Button5MotionMask|ButtonPressMask|ButtonReleaseMask
|EnterWindowMask|LeaveWindowMask|KeyPressMask
|KeyReleaseMask|PointerMotionMask|VirtualEventMask)) {
- Tk_DeleteBinding(interp, textPtr->bindingTable,
- (ClientData) tagPtr, argv[4]);
+ Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable,
+ (ClientData) tagPtr->name, Tcl_GetString(objv[4]));
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "requested illegal events; ",
"only key, button, motion, enter, leave, and virtual ",
- "events may be used", (char *) NULL);
+ "events may be used", NULL);
return TCL_ERROR;
}
- } else if (argc == 5) {
+ } else if (objc == 5) {
CONST char *command;
-
- command = Tk_GetBinding(interp, textPtr->bindingTable,
- (ClientData) tagPtr, argv[4]);
+
+ command = Tk_GetBinding(interp,
+ textPtr->sharedTextPtr->bindingTable,
+ (ClientData) tagPtr->name, Tcl_GetString(objv[4]));
if (command == NULL) {
- CONST char *string = Tcl_GetStringResult(interp);
+ CONST char *string = Tcl_GetStringResult(interp);
/*
- * Ignore missing binding errors. This is a special hack
- * that relies on the error message returned by FindSequence
- * in tkBind.c.
+ * Ignore missing binding errors. This is a special hack that
+ * relies on the error message returned by FindSequence in
+ * tkBind.c.
*/
if (string[0] != '\0') {
return TCL_ERROR;
- } else {
- Tcl_ResetResult(interp);
}
+ Tcl_ResetResult(interp);
} else {
Tcl_SetResult(interp, (char *) command, TCL_STATIC);
}
} else {
- Tk_GetAllBindings(interp, textPtr->bindingTable,
- (ClientData) tagPtr);
- }
- } else if ((c == 'c') && (strncmp(argv[2], "cget", length) == 0)
- && (length >= 2)) {
- if (argc != 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag cget tagName option\"",
- (char *) NULL);
- return TCL_ERROR;
+ Tk_GetAllBindings(interp, textPtr->sharedTextPtr->bindingTable,
+ (ClientData) tagPtr->name);
}
- tagPtr = FindTag(interp, textPtr, argv[3]);
- if (tagPtr == NULL) {
+ break;
+ case TAG_CGET:
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 1, objv, "tag cget tagName option");
return TCL_ERROR;
+ } else {
+ Tcl_Obj *objPtr;
+
+ tagPtr = FindTag(interp, textPtr, objv[3]);
+ if (tagPtr == NULL) {
+ return TCL_ERROR;
+ }
+ objPtr = Tk_GetOptionValue(interp, (char *) tagPtr,
+ tagPtr->optionTable, objv[4], textPtr->tkwin);
+ if (objPtr == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
}
- return Tk_ConfigureValue(interp, textPtr->tkwin, tagConfigSpecs,
- (char *) tagPtr, argv[4], 0);
- } else if ((c == 'c') && (strncmp(argv[2], "configure", length) == 0)
- && (length >= 2)) {
- if (argc < 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag configure tagName ?option? ?value? ",
- "?option value ...?\"", (char *) NULL);
+ break;
+ case TAG_CONFIGURE: {
+ int newTag;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv,
+ "tagName ?option? ?value? ?option value ...?");
return TCL_ERROR;
}
- tagPtr = TkTextCreateTag(textPtr, argv[3]);
- if (argc == 4) {
- return Tk_ConfigureInfo(interp, textPtr->tkwin, tagConfigSpecs,
- (char *) tagPtr, (char *) NULL, 0);
- } else if (argc == 5) {
- return Tk_ConfigureInfo(interp, textPtr->tkwin, tagConfigSpecs,
- (char *) tagPtr, argv[4], 0);
+ tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag);
+ if (objc <= 5) {
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) tagPtr,
+ tagPtr->optionTable,
+ (objc == 5) ? objv[4] : NULL, textPtr->tkwin);
+
+ if (objPtr == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
} else {
- int result;
+ int result = TCL_OK;
+
+ if (Tk_SetOptions(interp, (char*)tagPtr, tagPtr->optionTable,
+ objc-4, objv+4, textPtr->tkwin, NULL, NULL) != TCL_OK) {
+ return TCL_ERROR;
+ }
- result = Tk_ConfigureWidget(interp, textPtr->tkwin, tagConfigSpecs,
- argc-4, argv+4, (char *) tagPtr, 0);
/*
- * Some of the configuration options, like -underline
- * and -justify, require additional translation (this is
- * needed because we need to distinguish a particular value
- * of an option from "unspecified").
+ * Some of the configuration options, like -underline and
+ * -justify, require additional translation (this is needed
+ * because we need to distinguish a particular value of an option
+ * from "unspecified").
*/
- if (tagPtr->bdString != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin, tagPtr->bdString,
- &tagPtr->borderWidth) != TCL_OK) {
- return TCL_ERROR;
- }
- if (tagPtr->borderWidth < 0) {
- tagPtr->borderWidth = 0;
- }
+ if (tagPtr->borderWidth < 0) {
+ tagPtr->borderWidth = 0;
}
if (tagPtr->reliefString != NULL) {
if (Tk_GetRelief(interp, tagPtr->reliefString,
@@ -391,9 +439,9 @@ TkTextTagCmd(textPtr, interp, argc, argv)
ckfree((char *) tagPtr->tabArrayPtr);
tagPtr->tabArrayPtr = NULL;
}
- if (tagPtr->tabString != NULL) {
- tagPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr->tkwin,
- tagPtr->tabString);
+ if (tagPtr->tabStringPtr != NULL) {
+ tagPtr->tabArrayPtr =
+ TkTextGetTabs(interp, textPtr, tagPtr->tabStringPtr);
if (tagPtr->tabArrayPtr == NULL) {
return TCL_ERROR;
}
@@ -413,55 +461,82 @@ TkTextTagCmd(textPtr, interp, argc, argv)
/*
* If the "sel" tag was changed, be sure to mirror information
- * from the tag back into the text widget record. NOTE: we
- * don't have to free up information in the widget record
- * before overwriting it, because it was mirrored in the tag
- * and hence freed when the tag field was overwritten.
+ * from the tag back into the text widget record. NOTE: we don't
+ * have to free up information in the widget record before
+ * overwriting it, because it was mirrored in the tag and hence
+ * freed when the tag field was overwritten.
*/
if (tagPtr == textPtr->selTagPtr) {
textPtr->selBorder = tagPtr->border;
- textPtr->selBdString = tagPtr->bdString;
+ textPtr->selBorderWidth = tagPtr->borderWidth;
+ textPtr->selBorderWidthPtr = tagPtr->borderWidthPtr;
textPtr->selFgColorPtr = tagPtr->fgColor;
}
+
tagPtr->affectsDisplay = 0;
- if ((tagPtr->border != NULL)
- || (tagPtr->bdString != NULL)
- || (tagPtr->reliefString != NULL)
- || (tagPtr->bgStipple != None)
- || (tagPtr->fgColor != NULL) || (tagPtr->tkfont != None)
- || (tagPtr->fgStipple != None)
+ tagPtr->affectsDisplayGeometry = 0;
+ if ((tagPtr->elideString != NULL)
+ || (tagPtr->tkfont != None)
|| (tagPtr->justifyString != NULL)
|| (tagPtr->lMargin1String != NULL)
|| (tagPtr->lMargin2String != NULL)
|| (tagPtr->offsetString != NULL)
- || (tagPtr->overstrikeString != NULL)
|| (tagPtr->rMarginString != NULL)
|| (tagPtr->spacing1String != NULL)
|| (tagPtr->spacing2String != NULL)
|| (tagPtr->spacing3String != NULL)
- || (tagPtr->tabString != NULL)
- || (tagPtr->underlineString != NULL)
- || (tagPtr->elideString != NULL)
+ || (tagPtr->tabStringPtr != NULL)
+ || (tagPtr->tabStyle != TK_TEXT_TABSTYLE_NONE)
|| (tagPtr->wrapMode != TEXT_WRAPMODE_NULL)) {
tagPtr->affectsDisplay = 1;
+ tagPtr->affectsDisplayGeometry = 1;
+ }
+ if ((tagPtr->border != NULL)
+ || (tagPtr->reliefString != NULL)
+ || (tagPtr->bgStipple != None)
+ || (tagPtr->fgColor != NULL)
+ || (tagPtr->fgStipple != None)
+ || (tagPtr->overstrikeString != NULL)
+ || (tagPtr->underlineString != NULL)) {
+ tagPtr->affectsDisplay = 1;
+ }
+ if (!newTag) {
+ /*
+ * This line is not necessary if this is a new tag, since it
+ * can't possibly have been applied to anything yet.
+ */
+
+ /*
+ * VMD: If this is the 'sel' tag, then we don't need to call
+ * this for all peers, unless we actually want to synchronize
+ * sel-style changes across the peers.
+ */
+
+ TkTextRedrawTag(textPtr->sharedTextPtr, NULL,
+ NULL, NULL, tagPtr, 1);
}
- TkTextRedrawTag(textPtr, (TkTextIndex *) NULL,
- (TkTextIndex *) NULL, tagPtr, 1);
return result;
}
- } else if ((c == 'd') && (strncmp(argv[2], "delete", length) == 0)) {
+ break;
+ }
+ case TAG_DELETE: {
Tcl_HashEntry *hPtr;
- if (argc < 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag delete tagName tagName ...\"",
- (char *) NULL);
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName ?tagName ...?");
return TCL_ERROR;
}
- for (i = 3; i < argc; i++) {
- hPtr = Tcl_FindHashEntry(&textPtr->tagTable, argv[i]);
+ for (i = 3; i < objc; i++) {
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable,
+ Tcl_GetString(objv[i]));
if (hPtr == NULL) {
+ /*
+ * Either this tag doesn't exist or it's the 'sel' tag (which
+ * is not in the hash table). Either way we don't want to
+ * delete it.
+ */
+
continue;
}
tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
@@ -469,62 +544,28 @@ TkTextTagCmd(textPtr, interp, argc, argv)
continue;
}
if (tagPtr->affectsDisplay) {
- TkTextRedrawTag(textPtr, (TkTextIndex *) NULL,
- (TkTextIndex *) NULL, tagPtr, 1);
+ TkTextRedrawTag(textPtr->sharedTextPtr, NULL,
+ NULL, NULL, tagPtr, 1);
}
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &first);
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree),
- 0, &last),
- TkBTreeTag(&first, &last, tagPtr, 0);
-
- if (tagPtr == textPtr->selTagPtr) {
- XEvent event;
- /*
- * Send an event that the selection changed.
- * This is equivalent to
- * "event generate $textWidget <<Selection>>"
- */
-
- memset((VOID *) &event, 0, sizeof(event));
- event.xany.type = VirtualEvent;
- event.xany.serial = NextRequest(Tk_Display(textPtr->tkwin));
- event.xany.send_event = False;
- event.xany.window = Tk_WindowId(textPtr->tkwin);
- event.xany.display = Tk_Display(textPtr->tkwin);
- ((XVirtualEvent *) &event)->name = Tk_GetUid("Selection");
- Tk_HandleEvent(&event);
- }
-
+ TkTextDeleteTag(textPtr, tagPtr);
Tcl_DeleteHashEntry(hPtr);
- if (textPtr->bindingTable != NULL) {
- Tk_DeleteAllBindings(textPtr->bindingTable,
- (ClientData) tagPtr);
- }
-
- /*
- * Update the tag priorities to reflect the deletion of this tag.
- */
-
- ChangeTagPriority(textPtr, tagPtr, textPtr->numTags-1);
- textPtr->numTags -= 1;
- TkTextFreeTag(textPtr, tagPtr);
}
- } else if ((c == 'l') && (strncmp(argv[2], "lower", length) == 0)) {
+ break;
+ }
+ case TAG_LOWER: {
TkTextTag *tagPtr2;
int prio;
- if ((argc != 4) && (argc != 5)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag lower tagName ?belowThis?\"",
- (char *) NULL);
+ if ((objc != 4) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName ?belowThis?");
return TCL_ERROR;
}
- tagPtr = FindTag(interp, textPtr, argv[3]);
+ tagPtr = FindTag(interp, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_ERROR;
}
- if (argc == 5) {
- tagPtr2 = FindTag(interp, textPtr, argv[4]);
+ if (objc == 5) {
+ tagPtr2 = FindTag(interp, textPtr, objv[4]);
if (tagPtr2 == NULL) {
return TCL_ERROR;
}
@@ -537,81 +578,99 @@ TkTextTagCmd(textPtr, interp, argc, argv)
prio = 0;
}
ChangeTagPriority(textPtr, tagPtr, prio);
- TkTextRedrawTag(textPtr, (TkTextIndex *) NULL, (TkTextIndex *) NULL,
- tagPtr, 1);
- } else if ((c == 'n') && (strncmp(argv[2], "names", length) == 0)
- && (length >= 2)) {
+
+ /*
+ * If this is the 'sel' tag, then we don't actually need to call this
+ * for all peers.
+ */
+
+ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL, NULL, tagPtr, 1);
+ break;
+ }
+ case TAG_NAMES: {
TkTextTag **arrayPtr;
int arraySize;
+ Tcl_Obj *listObj;
- if ((argc != 3) && (argc != 4)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag names ?index?\"",
- (char *) NULL);
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 3, objv, "?index?");
return TCL_ERROR;
}
- if (argc == 3) {
+ if (objc == 3) {
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
arrayPtr = (TkTextTag **) ckalloc((unsigned)
- (textPtr->numTags * sizeof(TkTextTag *)));
- for (i = 0, hPtr = Tcl_FirstHashEntry(&textPtr->tagTable, &search);
+ (textPtr->sharedTextPtr->numTags * sizeof(TkTextTag *)));
+ for (i=0, hPtr = Tcl_FirstHashEntry(
+ &textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
arrayPtr[i] = (TkTextTag *) Tcl_GetHashValue(hPtr);
}
- arraySize = textPtr->numTags;
+
+ /*
+ * The 'sel' tag is not in the hash table.
+ */
+
+ arrayPtr[i] = textPtr->selTagPtr;
+ arraySize = ++i;
} else {
- if (TkTextGetIndex(interp, textPtr, argv[3], &index1)
- != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[3],
+ &index1) != TCL_OK) {
return TCL_ERROR;
}
- arrayPtr = TkBTreeGetTags(&index1, &arraySize);
+ arrayPtr = TkBTreeGetTags(&index1, textPtr, &arraySize);
if (arrayPtr == NULL) {
return TCL_OK;
}
}
+
SortTags(arraySize, arrayPtr);
+ listObj = Tcl_NewListObj(0, NULL);
+
for (i = 0; i < arraySize; i++) {
tagPtr = arrayPtr[i];
- Tcl_AppendElement(interp, tagPtr->name);
+ Tcl_ListObjAppendElement(interp, listObj,
+ Tcl_NewStringObj(tagPtr->name,-1));
}
+ Tcl_SetObjResult(interp, listObj);
ckfree((char *) arrayPtr);
- } else if ((c == 'n') && (strncmp(argv[2], "nextrange", length) == 0)
- && (length >= 2)) {
+ break;
+ }
+ case TAG_NEXTRANGE: {
+ TkTextIndex last;
TkTextSearch tSearch;
char position[TK_POS_CHARS];
- if ((argc != 5) && (argc != 6)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag nextrange tagName index1 ?index2?\"",
- (char *) NULL);
+ if ((objc != 5) && (objc != 6)) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName index1 ?index2?");
return TCL_ERROR;
}
- tagPtr = FindTag((Tcl_Interp *) NULL, textPtr, argv[3]);
+ tagPtr = FindTag(NULL, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_OK;
}
- if (TkTextGetIndex(interp, textPtr, argv[4], &index1) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[4], &index1) != TCL_OK) {
return TCL_ERROR;
}
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree),
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr),
0, &last);
- if (argc == 5) {
+ if (objc == 5) {
index2 = last;
- } else if (TkTextGetIndex(interp, textPtr, argv[5], &index2)
- != TCL_OK) {
+ } else if (TkTextGetObjIndex(interp, textPtr, objv[5],
+ &index2) != TCL_OK) {
return TCL_ERROR;
}
/*
- * The search below is a bit tricky. Rather than use the B-tree
- * facilities to stop the search at index2, let it search up
- * until the end of the file but check for a position past index2
- * ourselves. The reason for doing it this way is that we only
- * care whether the *start* of the range is before index2; once
- * we find the start, we don't want TkBTreeNextTag to abort the
- * search because the end of the range is after index2.
+ * The search below is a bit tricky. Rather than use the B-tree
+ * facilities to stop the search at index2, let it search up until the
+ * end of the file but check for a position past index2 ourselves.
+ * The reason for doing it this way is that we only care whether the
+ * *start* of the range is before index2; once we find the start, we
+ * don't want TkBTreeNextTag to abort the search because the end of
+ * the range is after index2.
*/
TkBTreeStartSearch(&index1, &last, tagPtr, &tSearch);
@@ -620,12 +679,12 @@ TkTextTagCmd(textPtr, interp, argc, argv)
int offset;
/*
- * The first character is tagged. See if there is an
- * on-toggle just before the character. If not, then
- * skip to the end of this tagged range.
+ * The first character is tagged. See if there is an on-toggle
+ * just before the character. If not, then skip to the end of this
+ * tagged range.
*/
- for (segPtr = index1.linePtr->segPtr, offset = index1.byteIndex;
+ for (segPtr = index1.linePtr->segPtr, offset = index1.byteIndex;
offset >= 0;
offset -= segPtr->size, segPtr = segPtr->nextPtr) {
if ((offset == 0) && (segPtr->typePtr == &tkTextToggleOnType)
@@ -634,7 +693,7 @@ TkTextTagCmd(textPtr, interp, argc, argv)
}
}
if (!TkBTreeNextTag(&tSearch)) {
- return TCL_OK;
+ return TCL_OK;
}
}
@@ -645,87 +704,139 @@ TkTextTagCmd(textPtr, interp, argc, argv)
if (!TkBTreeNextTag(&tSearch)) {
return TCL_OK;
}
- gotStart:
+
+ gotStart:
if (TkTextIndexCmp(&tSearch.curIndex, &index2) >= 0) {
return TCL_OK;
}
- TkTextPrintIndex(&tSearch.curIndex, position);
+ TkTextPrintIndex(textPtr, &tSearch.curIndex, position);
Tcl_AppendElement(interp, position);
TkBTreeNextTag(&tSearch);
- TkTextPrintIndex(&tSearch.curIndex, position);
+ TkTextPrintIndex(textPtr, &tSearch.curIndex, position);
Tcl_AppendElement(interp, position);
- } else if ((c == 'p') && (strncmp(argv[2], "prevrange", length) == 0)
- && (length >= 2)) {
+ break;
+ }
+ case TAG_PREVRANGE: {
+ TkTextIndex last;
TkTextSearch tSearch;
char position1[TK_POS_CHARS];
char position2[TK_POS_CHARS];
- if ((argc != 5) && (argc != 6)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag prevrange tagName index1 ?index2?\"",
- (char *) NULL);
+ if ((objc != 5) && (objc != 6)) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName index1 ?index2?");
return TCL_ERROR;
}
- tagPtr = FindTag((Tcl_Interp *) NULL, textPtr, argv[3]);
+ tagPtr = FindTag(NULL, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_OK;
}
- if (TkTextGetIndex(interp, textPtr, argv[4], &index1) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[4], &index1) != TCL_OK) {
return TCL_ERROR;
}
- if (argc == 5) {
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &index2);
- } else if (TkTextGetIndex(interp, textPtr, argv[5], &index2)
- != TCL_OK) {
+ if (objc == 5) {
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0,
+ &index2);
+ } else if (TkTextGetObjIndex(interp, textPtr, objv[5],
+ &index2) != TCL_OK) {
return TCL_ERROR;
}
/*
- * The search below is a bit weird. The previous toggle can be
- * either an on or off toggle. If it is an on toggle, then we
- * need to turn around and search forward for the end toggle.
- * Otherwise we keep searching backwards.
+ * The search below is a bit weird. The previous toggle can be either
+ * an on or off toggle. If it is an on toggle, then we need to turn
+ * around and search forward for the end toggle. Otherwise we keep
+ * searching backwards.
*/
TkBTreeStartSearchBack(&index1, &index2, tagPtr, &tSearch);
if (!TkBTreePrevTag(&tSearch)) {
+ /*
+ * Special case, there may be a tag off toggle at index1, and a
+ * tag on toggle before the start of a partial peer widget. In
+ * this case we missed it.
+ */
+
+ if (textPtr->start != NULL && (textPtr->start == index2.linePtr)
+ && (index2.byteIndex == 0)
+ && TkBTreeCharTagged(&index2, tagPtr)
+ && (TkTextIndexCmp(&index2, &index1) < 0)) {
+ /*
+ * The first character is tagged, so just add the range from
+ * the first char to the start of the range.
+ */
+
+ TkTextPrintIndex(textPtr, &index2, position1);
+ TkTextPrintIndex(textPtr, &index1, position2);
+ Tcl_AppendElement(interp, position1);
+ Tcl_AppendElement(interp, position2);
+ }
return TCL_OK;
}
+
if (tSearch.segPtr->typePtr == &tkTextToggleOnType) {
- TkTextPrintIndex(&tSearch.curIndex, position1);
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree),
+ TkTextPrintIndex(textPtr, &tSearch.curIndex, position1);
+ if (textPtr->start != NULL) {
+ /*
+ * Make sure the first index is not before the first allowed
+ * text index in this widget.
+ */
+
+ TkTextIndex firstIndex;
+
+ firstIndex.linePtr = textPtr->start;
+ firstIndex.byteIndex = 0;
+ firstIndex.textPtr = NULL;
+ if (TkTextIndexCmp(&tSearch.curIndex, &firstIndex) < 0) {
+ if (TkTextIndexCmp(&firstIndex, &index1) >= 0) {
+ /*
+ * But now the new first index is actually too far
+ * along in the text, so nothing is returned.
+ */
+
+ return TCL_OK;
+ }
+ TkTextPrintIndex(textPtr, &firstIndex, position1);
+ }
+ }
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr),
0, &last);
TkBTreeStartSearch(&tSearch.curIndex, &last, tagPtr, &tSearch);
TkBTreeNextTag(&tSearch);
- TkTextPrintIndex(&tSearch.curIndex, position2);
+ TkTextPrintIndex(textPtr, &tSearch.curIndex, position2);
} else {
- TkTextPrintIndex(&tSearch.curIndex, position2);
+ TkTextPrintIndex(textPtr, &tSearch.curIndex, position2);
TkBTreePrevTag(&tSearch);
+ TkTextPrintIndex(textPtr, &tSearch.curIndex, position1);
if (TkTextIndexCmp(&tSearch.curIndex, &index2) < 0) {
- return TCL_OK;
+ if (textPtr->start != NULL && index2.linePtr == textPtr->start
+ && index2.byteIndex == 0) {
+ /* It's ok */
+ TkTextPrintIndex(textPtr, &index2, position1);
+ } else {
+ return TCL_OK;
+ }
}
- TkTextPrintIndex(&tSearch.curIndex, position1);
}
Tcl_AppendElement(interp, position1);
Tcl_AppendElement(interp, position2);
- } else if ((c == 'r') && (strncmp(argv[2], "raise", length) == 0)
- && (length >= 3)) {
+ break;
+ }
+ case TAG_RAISE: {
TkTextTag *tagPtr2;
int prio;
- if ((argc != 4) && (argc != 5)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag raise tagName ?aboveThis?\"",
- (char *) NULL);
+ if ((objc != 4) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName ?aboveThis?");
return TCL_ERROR;
}
- tagPtr = FindTag(interp, textPtr, argv[3]);
+ tagPtr = FindTag(interp, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_ERROR;
}
- if (argc == 5) {
- tagPtr2 = FindTag(interp, textPtr, argv[4]);
+ if (objc == 5) {
+ tagPtr2 = FindTag(interp, textPtr, objv[4]);
if (tagPtr2 == NULL) {
return TCL_ERROR;
}
@@ -735,48 +846,61 @@ TkTextTagCmd(textPtr, interp, argc, argv)
prio = tagPtr2->priority + 1;
}
} else {
- prio = textPtr->numTags-1;
+ prio = textPtr->sharedTextPtr->numTags-1;
}
ChangeTagPriority(textPtr, tagPtr, prio);
- TkTextRedrawTag(textPtr, (TkTextIndex *) NULL, (TkTextIndex *) NULL,
- tagPtr, 1);
- } else if ((c == 'r') && (strncmp(argv[2], "ranges", length) == 0)
- && (length >= 3)) {
+
+ /*
+ * If this is the 'sel' tag, then we don't actually need to call this
+ * for all peers.
+ */
+
+ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL, NULL, tagPtr, 1);
+ break;
+ }
+ case TAG_RANGES: {
+ TkTextIndex first, last;
TkTextSearch tSearch;
- char position[TK_POS_CHARS];
+ Tcl_Obj *listObj = Tcl_NewListObj(0, NULL);
+ int count = 0;
- if (argc != 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " tag ranges tagName\"", (char *) NULL);
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName");
return TCL_ERROR;
}
- tagPtr = FindTag((Tcl_Interp *) NULL, textPtr, argv[3]);
+ tagPtr = FindTag(NULL, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_OK;
}
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &first);
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree),
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0,
+ &first);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr),
0, &last);
TkBTreeStartSearch(&first, &last, tagPtr, &tSearch);
if (TkBTreeCharTagged(&first, tagPtr)) {
- TkTextPrintIndex(&first, position);
- Tcl_AppendElement(interp, position);
+ Tcl_ListObjAppendElement(interp, listObj,
+ TkTextNewIndexObj(textPtr, &first));
+ count++;
}
while (TkBTreeNextTag(&tSearch)) {
- TkTextPrintIndex(&tSearch.curIndex, position);
- Tcl_AppendElement(interp, position);
+ Tcl_ListObjAppendElement(interp, listObj,
+ TkTextNewIndexObj(textPtr, &tSearch.curIndex));
+ count++;
}
- } else if ((c == 'r') && (strncmp(argv[2], "remove", length) == 0)
- && (length >= 2)) {
- fullOption = "remove";
- addTag = 0;
- goto addAndRemove;
- } else {
- Tcl_AppendResult(interp, "bad tag option \"", argv[2],
- "\": must be add, bind, cget, configure, delete, lower, ",
- "names, nextrange, raise, ranges, or remove",
- (char *) NULL);
- return TCL_ERROR;
+ if (count % 2 == 1) {
+ /*
+ * If a text widget uses '-end', it won't necessarily run to the
+ * end of the B-tree, and therefore the tag range might not be
+ * closed. In this case we add the end of the range.
+ */
+
+ Tcl_ListObjAppendElement(interp, listObj,
+ TkTextNewIndexObj(textPtr, &last));
+ }
+ Tcl_SetObjResult(interp, listObj);
+ break;
+ }
}
return TCL_OK;
}
@@ -786,46 +910,68 @@ TkTextTagCmd(textPtr, interp, argc, argv)
*
* TkTextCreateTag --
*
- * Find the record describing a tag within a given text widget,
- * creating a new record if one doesn't already exist.
+ * Find the record describing a tag within a given text widget, creating
+ * a new record if one doesn't already exist.
*
* Results:
* The return value is a pointer to the TkTextTag record for tagName.
*
* Side effects:
- * A new tag record is created if there isn't one already defined
- * for tagName.
+ * A new tag record is created if there isn't one already defined for
+ * tagName.
*
*----------------------------------------------------------------------
*/
TkTextTag *
-TkTextCreateTag(textPtr, tagName)
- TkText *textPtr; /* Widget in which tag is being used. */
- CONST char *tagName; /* Name of desired tag. */
+TkTextCreateTag(
+ TkText *textPtr, /* Widget in which tag is being used. */
+ CONST char *tagName, /* Name of desired tag. */
+ int *newTag) /* If non-NULL, then return 1 if new, or 0 if
+ * already exists. */
{
register TkTextTag *tagPtr;
- Tcl_HashEntry *hPtr;
- int new;
-
- hPtr = Tcl_CreateHashEntry(&textPtr->tagTable, tagName, &new);
- if (!new) {
- return (TkTextTag *) Tcl_GetHashValue(hPtr);
+ Tcl_HashEntry *hPtr = NULL;
+ int isNew;
+ CONST char *name;
+
+ if (!strcmp(tagName, "sel")) {
+ if (textPtr->selTagPtr != NULL) {
+ if (newTag != NULL) {
+ *newTag = 0;
+ }
+ return textPtr->selTagPtr;
+ }
+ if (newTag != NULL) {
+ *newTag = 1;
+ }
+ name = "sel";
+ } else {
+ hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->tagTable,
+ tagName, &isNew);
+ if (newTag != NULL) {
+ *newTag = isNew;
+ }
+ if (!isNew) {
+ return (TkTextTag *) Tcl_GetHashValue(hPtr);
+ }
+ name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr);
}
/*
- * No existing entry. Create a new one, initialize it, and add a
- * pointer to it to the hash table entry.
+ * No existing entry. Create a new one, initialize it, and add a pointer
+ * to it to the hash table entry.
*/
tagPtr = (TkTextTag *) ckalloc(sizeof(TkTextTag));
- tagPtr->name = Tcl_GetHashKey(&textPtr->tagTable, hPtr);
+ tagPtr->name = name;
+ tagPtr->textPtr = NULL;
tagPtr->toggleCount = 0;
tagPtr->tagRootPtr = NULL;
- tagPtr->priority = textPtr->numTags;
+ tagPtr->priority = textPtr->sharedTextPtr->numTags;
tagPtr->border = NULL;
- tagPtr->bdString = NULL;
tagPtr->borderWidth = 0;
+ tagPtr->borderWidthPtr = NULL;
tagPtr->reliefString = NULL;
tagPtr->relief = TK_RELIEF_FLAT;
tagPtr->bgStipple = None;
@@ -850,16 +996,25 @@ TkTextCreateTag(textPtr, tagName)
tagPtr->spacing2 = 0;
tagPtr->spacing3String = NULL;
tagPtr->spacing3 = 0;
- tagPtr->tabString = NULL;
+ tagPtr->tabStringPtr = NULL;
tagPtr->tabArrayPtr = NULL;
+ tagPtr->tabStyle = TK_TEXT_TABSTYLE_NONE;
tagPtr->underlineString = NULL;
tagPtr->underline = 0;
tagPtr->elideString = NULL;
tagPtr->elide = 0;
tagPtr->wrapMode = TEXT_WRAPMODE_NULL;
tagPtr->affectsDisplay = 0;
- textPtr->numTags++;
- Tcl_SetHashValue(hPtr, tagPtr);
+ tagPtr->affectsDisplayGeometry = 0;
+ textPtr->sharedTextPtr->numTags++;
+ if (!strcmp(tagName, "sel")) {
+ tagPtr->textPtr = textPtr;
+ textPtr->refCount++;
+ } else {
+ Tcl_SetHashValue(hPtr, tagPtr);
+ }
+ tagPtr->optionTable =
+ Tk_CreateOptionTable(textPtr->interp, tagOptionSpecs);
return tagPtr;
}
@@ -871,10 +1026,9 @@ TkTextCreateTag(textPtr, tagName)
* See if tag is defined for a given widget.
*
* Results:
- * If tagName is defined in textPtr, a pointer to its TkTextTag
- * structure is returned. Otherwise NULL is returned and an
- * error message is recorded in the interp's result unless interp
- * is NULL.
+ * If tagName is defined in textPtr, a pointer to its TkTextTag structure
+ * is returned. Otherwise NULL is returned and an error message is
+ * recorded in the interp's result unless interp is NULL.
*
* Side effects:
* None.
@@ -883,22 +1037,29 @@ TkTextCreateTag(textPtr, tagName)
*/
static TkTextTag *
-FindTag(interp, textPtr, tagName)
- Tcl_Interp *interp; /* Interpreter to use for error message;
- * if NULL, then don't record an error
+FindTag(
+ Tcl_Interp *interp, /* Interpreter to use for error message; if
+ * NULL, then don't record an error
* message. */
- TkText *textPtr; /* Widget in which tag is being used. */
- CONST char *tagName; /* Name of desired tag. */
+ TkText *textPtr, /* Widget in which tag is being used. */
+ Tcl_Obj *tagName) /* Name of desired tag. */
{
Tcl_HashEntry *hPtr;
+ int len;
+ CONST char *str;
- hPtr = Tcl_FindHashEntry(&textPtr->tagTable, tagName);
+ str = Tcl_GetStringFromObj(tagName, &len);
+ if (len == 3 && !strcmp(str,"sel")) {
+ return textPtr->selTagPtr;
+ }
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable,
+ Tcl_GetString(tagName));
if (hPtr != NULL) {
return (TkTextTag *) Tcl_GetHashValue(hPtr);
}
if (interp != NULL) {
- Tcl_AppendResult(interp, "tag \"", tagName,
- "\" isn't defined in text widget", (char *) NULL);
+ Tcl_AppendResult(interp, "tag \"", Tcl_GetString(tagName),
+ "\" isn't defined in text widget", NULL);
}
return NULL;
}
@@ -906,10 +1067,76 @@ FindTag(interp, textPtr, tagName)
/*
*----------------------------------------------------------------------
*
+ * TkTextDeleteTag --
+ *
+ * This function is called to carry out most actions associated with the
+ * 'tag delete' sub-command. It will remove all evidence of the tag from
+ * the B-tree, and then call TkTextFreeTag to clean up the tag structure
+ * itself.
+ *
+ * The only actions this doesn't carry out it to check if the deletion of
+ * the tag requires something to be re-displayed, and to remove the tag
+ * from the tagTable (hash table) if that is necessary (i.e. if it's not
+ * the 'sel' tag). It is expected that the caller carry out both of these
+ * actions.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Memory and other resources are freed, the B-tree is manipulated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkTextDeleteTag(
+ TkText *textPtr, /* Info about overall widget. */
+ register TkTextTag *tagPtr) /* Tag being deleted. */
+{
+ TkTextIndex first, last;
+
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0, &first);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr), 0, &last),
+ TkBTreeTag(&first, &last, tagPtr, 0);
+
+ if (tagPtr == textPtr->selTagPtr) {
+ /*
+ * Send an event that the selection changed. This is equivalent to:
+ * event generate $textWidget <<Selection>>
+ */
+
+ TkTextSelectionEvent(textPtr);
+ } else {
+ /*
+ * Since all peer widgets have an independent "sel" tag, we
+ * don't want removal of one sel tag to remove bindings which
+ * are still valid in other peer widgets.
+ */
+
+ if (textPtr->sharedTextPtr->bindingTable != NULL) {
+ Tk_DeleteAllBindings(textPtr->sharedTextPtr->bindingTable,
+ (ClientData) tagPtr->name);
+ }
+ }
+
+ /*
+ * Update the tag priorities to reflect the deletion of this tag.
+ */
+
+ ChangeTagPriority(textPtr, tagPtr, textPtr->sharedTextPtr->numTags-1);
+ textPtr->sharedTextPtr->numTags -= 1;
+ TkTextFreeTag(textPtr, tagPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkTextFreeTag --
*
- * This procedure is called when a tag is deleted to free up the
- * memory and other resources associated with the tag.
+ * This function is called when a tag is deleted to free up the memory
+ * and other resources associated with the tag.
*
* Results:
* None.
@@ -921,65 +1148,62 @@ FindTag(interp, textPtr, tagName)
*/
void
-TkTextFreeTag(textPtr, tagPtr)
- TkText *textPtr; /* Info about overall widget. */
- register TkTextTag *tagPtr; /* Tag being deleted. */
+TkTextFreeTag(
+ TkText *textPtr, /* Info about overall widget. */
+ register TkTextTag *tagPtr) /* Tag being deleted. */
{
- if (tagPtr->border != None) {
- Tk_Free3DBorder(tagPtr->border);
- }
- if (tagPtr->bdString != NULL) {
- ckfree(tagPtr->bdString);
- }
- if (tagPtr->reliefString != NULL) {
- ckfree(tagPtr->reliefString);
- }
- if (tagPtr->bgStipple != None) {
- Tk_FreeBitmap(textPtr->display, tagPtr->bgStipple);
- }
- if (tagPtr->fgColor != None) {
- Tk_FreeColor(tagPtr->fgColor);
- }
- Tk_FreeFont(tagPtr->tkfont);
- if (tagPtr->fgStipple != None) {
- Tk_FreeBitmap(textPtr->display, tagPtr->fgStipple);
- }
- if (tagPtr->justifyString != NULL) {
- ckfree(tagPtr->justifyString);
- }
- if (tagPtr->lMargin1String != NULL) {
- ckfree(tagPtr->lMargin1String);
- }
- if (tagPtr->lMargin2String != NULL) {
- ckfree(tagPtr->lMargin2String);
- }
- if (tagPtr->offsetString != NULL) {
- ckfree(tagPtr->offsetString);
- }
- if (tagPtr->overstrikeString != NULL) {
- ckfree(tagPtr->overstrikeString);
- }
- if (tagPtr->rMarginString != NULL) {
- ckfree(tagPtr->rMarginString);
- }
- if (tagPtr->spacing1String != NULL) {
- ckfree(tagPtr->spacing1String);
- }
- if (tagPtr->spacing2String != NULL) {
- ckfree(tagPtr->spacing2String);
- }
- if (tagPtr->spacing3String != NULL) {
- ckfree(tagPtr->spacing3String);
- }
- if (tagPtr->tabString != NULL) {
- ckfree(tagPtr->tabString);
- }
+ int i;
+
+ /*
+ * Let Tk do most of the hard work for us.
+ */
+
+ Tk_FreeConfigOptions((char *) tagPtr, tagPtr->optionTable,
+ textPtr->tkwin);
+
+ /*
+ * This associated information is managed by us.
+ */
+
if (tagPtr->tabArrayPtr != NULL) {
ckfree((char *) tagPtr->tabArrayPtr);
}
- if (tagPtr->underlineString != NULL) {
- ckfree(tagPtr->underlineString);
+
+ /*
+ * Make sure this tag isn't referenced from the 'current' tag array.
+ */
+
+ for (i = 0; i < textPtr->numCurTags; i++) {
+ if (textPtr->curTagArrayPtr[i] == tagPtr) {
+ for (; i < textPtr->numCurTags-1; i++) {
+ textPtr->curTagArrayPtr[i] = textPtr->curTagArrayPtr[i+1];
+ }
+ textPtr->curTagArrayPtr[textPtr->numCurTags-1] = NULL;
+ textPtr->numCurTags--;
+ break;
+ }
+ }
+
+ /*
+ * If this tag is widget-specific (peer widgets) then clean up the
+ * refCount it holds.
+ */
+
+ if (tagPtr->textPtr != NULL) {
+ if (textPtr != tagPtr->textPtr) {
+ Tcl_Panic("Tag being deleted from wrong widget");
+ }
+ textPtr->refCount--;
+ if (textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
+ }
+ tagPtr->textPtr = NULL;
}
+
+ /*
+ * Finally free the tag's memory.
+ */
+
ckfree((char *) tagPtr);
}
@@ -988,9 +1212,8 @@ TkTextFreeTag(textPtr, tagPtr)
*
* SortTags --
*
- * This procedure sorts an array of tag pointers in increasing
- * order of priority, optimizing for the common case where the
- * array is small.
+ * This function sorts an array of tag pointers in increasing order of
+ * priority, optimizing for the common case where the array is small.
*
* Results:
* None.
@@ -1002,9 +1225,9 @@ TkTextFreeTag(textPtr, tagPtr)
*/
static void
-SortTags(numTags, tagArrayPtr)
- int numTags; /* Number of tag pointers at *tagArrayPtr. */
- TkTextTag **tagArrayPtr; /* Pointer to array of pointers. */
+SortTags(
+ int numTags, /* Number of tag pointers at *tagArrayPtr. */
+ TkTextTag **tagArrayPtr) /* Pointer to array of pointers. */
{
int i, j, prio;
register TkTextTag **tagPtrPtr;
@@ -1028,8 +1251,7 @@ SortTags(numTags, tagArrayPtr)
*tagArrayPtr = tmp;
}
} else {
- qsort((VOID *) tagArrayPtr, (unsigned) numTags, sizeof (TkTextTag *),
- TagSortProc);
+ qsort(tagArrayPtr,(unsigned)numTags,sizeof(TkTextTag *),TagSortProc);
}
}
@@ -1038,14 +1260,14 @@ SortTags(numTags, tagArrayPtr)
*
* TagSortProc --
*
- * This procedure is called by qsort when sorting an array of
- * tags in priority order.
+ * This function is called by qsort() when sorting an array of tags in
+ * priority order.
*
* Results:
- * The return value is -1 if the first argument should be before
- * the second element (i.e. it has lower priority), 0 if it's
- * equivalent (this should never happen!), and 1 if it should be
- * after the second element.
+ * The return value is -1 if the first argument should be before the
+ * second element (i.e. it has lower priority), 0 if it's equivalent
+ * (this should never happen!), and 1 if it should be after the second
+ * element.
*
* Side effects:
* None.
@@ -1054,8 +1276,9 @@ SortTags(numTags, tagArrayPtr)
*/
static int
-TagSortProc(first, second)
- CONST VOID *first, *second; /* Elements to be compared. */
+TagSortProc(
+ CONST void *first,
+ CONST void *second) /* Elements to be compared. */
{
TkTextTag *tagPtr1, *tagPtr2;
@@ -1069,28 +1292,26 @@ TagSortProc(first, second)
*
* ChangeTagPriority --
*
- * This procedure changes the priority of a tag by modifying
- * its priority and the priorities of other tags that are affected
- * by the change.
+ * This function changes the priority of a tag by modifying its priority
+ * and the priorities of other tags that are affected by the change.
*
* Results:
* None.
*
* Side effects:
- * Priorities may be changed for some or all of the tags in
- * textPtr. The tags will be arranged so that there is exactly
- * one tag at each priority level between 0 and textPtr->numTags-1,
- * with tagPtr at priority "prio".
+ * Priorities may be changed for some or all of the tags in textPtr. The
+ * tags will be arranged so that there is exactly one tag at each
+ * priority level between 0 and textPtr->sharedTextPtr->numTags-1, with
+ * tagPtr at priority "prio".
*
*----------------------------------------------------------------------
*/
static void
-ChangeTagPriority(textPtr, tagPtr, prio)
- TkText *textPtr; /* Information about text widget. */
- TkTextTag *tagPtr; /* Tag whose priority is to be
- * changed. */
- int prio; /* New priority for tag. */
+ChangeTagPriority(
+ TkText *textPtr, /* Information about text widget. */
+ TkTextTag *tagPtr, /* Tag whose priority is to be changed. */
+ int prio) /* New priority for tag. */
{
int low, high, delta;
register TkTextTag *tagPtr2;
@@ -1100,12 +1321,13 @@ ChangeTagPriority(textPtr, tagPtr, prio)
if (prio < 0) {
prio = 0;
}
- if (prio >= textPtr->numTags) {
- prio = textPtr->numTags-1;
+ if (prio >= textPtr->sharedTextPtr->numTags) {
+ prio = textPtr->sharedTextPtr->numTags-1;
}
if (prio == tagPtr->priority) {
return;
- } else if (prio < tagPtr->priority) {
+ }
+ if (prio < tagPtr->priority) {
low = prio;
high = tagPtr->priority-1;
delta = 1;
@@ -1114,7 +1336,16 @@ ChangeTagPriority(textPtr, tagPtr, prio)
high = prio;
delta = -1;
}
- for (hPtr = Tcl_FirstHashEntry(&textPtr->tagTable, &search);
+
+ /*
+ * Adjust first the 'sel' tag, then all others from the hash table
+ */
+
+ if ((textPtr->selTagPtr->priority >= low)
+ && (textPtr->selTagPtr->priority <= high)) {
+ textPtr->selTagPtr->priority += delta;
+ }
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
tagPtr2 = (TkTextTag *) Tcl_GetHashValue(hPtr);
if ((tagPtr2->priority >= low) && (tagPtr2->priority <= high)) {
@@ -1129,37 +1360,36 @@ ChangeTagPriority(textPtr, tagPtr, prio)
*
* TkTextBindProc --
*
- * This procedure is invoked by the Tk dispatcher to handle
- * events associated with bindings on items.
+ * This function is invoked by the Tk dispatcher to handle events
+ * associated with bindings on items.
*
* Results:
* None.
*
* Side effects:
- * Depends on the command invoked as part of the binding
- * (if there was any).
+ * Depends on the command invoked as part of the binding (if there was
+ * any).
*
*--------------------------------------------------------------
*/
void
-TkTextBindProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to canvas structure. */
- XEvent *eventPtr; /* Pointer to X event that just
- * happened. */
+TkTextBindProc(
+ ClientData clientData, /* Pointer to canvas structure. */
+ XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkText *textPtr = (TkText *) clientData;
int repick = 0;
-# define AnyButtonMask (Button1Mask|Button2Mask|Button3Mask\
- |Button4Mask|Button5Mask)
+# define AnyButtonMask \
+ (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
- Tcl_Preserve((ClientData) textPtr);
+ textPtr->refCount++;
/*
- * This code simulates grabs for mouse buttons by keeping track
- * of whether a button is pressed and refusing to pick a new current
- * character while a button is pressed.
+ * This code simulates grabs for mouse buttons by keeping track of whether
+ * a button is pressed and refusing to pick a new current character while
+ * a button is pressed.
*/
if (eventPtr->type == ButtonPress) {
@@ -1168,24 +1398,24 @@ TkTextBindProc(clientData, eventPtr)
int mask;
switch (eventPtr->xbutton.button) {
- case Button1:
- mask = Button1Mask;
- break;
- case Button2:
- mask = Button2Mask;
- break;
- case Button3:
- mask = Button3Mask;
- break;
- case Button4:
- mask = Button4Mask;
- break;
- case Button5:
- mask = Button5Mask;
- break;
- default:
- mask = 0;
- break;
+ case Button1:
+ mask = Button1Mask;
+ break;
+ case Button2:
+ mask = Button2Mask;
+ break;
+ case Button3:
+ mask = Button3Mask;
+ break;
+ case Button4:
+ mask = Button4Mask;
+ break;
+ case Button5:
+ mask = Button5Mask;
+ break;
+ default:
+ mask = 0;
+ break;
}
if ((eventPtr->xbutton.state & AnyButtonMask) == (unsigned) mask) {
textPtr->flags &= ~BUTTON_DOWN;
@@ -1208,10 +1438,11 @@ TkTextBindProc(clientData, eventPtr)
}
TkTextPickCurrent(textPtr, eventPtr);
}
- if ((textPtr->numCurTags > 0) && (textPtr->bindingTable != NULL)
- && (textPtr->tkwin != NULL)) {
- Tk_BindEvent(textPtr->bindingTable, eventPtr, textPtr->tkwin,
- textPtr->numCurTags, (ClientData *) textPtr->curTagArrayPtr);
+ if ((textPtr->numCurTags > 0)
+ && (textPtr->sharedTextPtr->bindingTable != NULL)
+ && (textPtr->tkwin != NULL) && !(textPtr->flags & DESTROYED)) {
+ TagBindEvent(textPtr, eventPtr, textPtr->numCurTags,
+ textPtr->curTagArrayPtr);
}
if (repick) {
unsigned int oldState;
@@ -1219,12 +1450,16 @@ TkTextBindProc(clientData, eventPtr)
oldState = eventPtr->xbutton.state;
eventPtr->xbutton.state &= ~(Button1Mask|Button2Mask
|Button3Mask|Button4Mask|Button5Mask);
- TkTextPickCurrent(textPtr, eventPtr);
+ if (!(textPtr->flags & DESTROYED)) {
+ TkTextPickCurrent(textPtr, eventPtr);
+ }
eventPtr->xbutton.state = oldState;
}
- done:
- Tcl_Release((ClientData) textPtr);
+ done:
+ if (--textPtr->refCount == 0) {
+ ckfree((char *) textPtr);
+ }
}
/*
@@ -1232,57 +1467,55 @@ TkTextBindProc(clientData, eventPtr)
*
* TkTextPickCurrent --
*
- * Find the character containing the coordinates in an event
- * and place the "current" mark on that character. If the
- * "current" mark has moved then generate a fake leave event
- * on the old current character and a fake enter event on the new
- * current character.
+ * Find the character containing the coordinates in an event and place
+ * the "current" mark on that character. If the "current" mark has moved
+ * then generate a fake leave event on the old current character and a
+ * fake enter event on the new current character.
*
* Results:
* None.
*
* Side effects:
- * The current mark for textPtr may change. If it does,
- * then the commands associated with character entry and leave
- * could do just about anything. For example, the text widget
- * might be deleted. It is up to the caller to protect itself
- * with calls to Tcl_Preserve and Tcl_Release.
+ * The current mark for textPtr may change. If it does, then the commands
+ * associated with character entry and leave could do just about
+ * anything. For example, the text widget might be deleted. It is up to
+ * the caller to protect itself by incrementing the refCount of the text
+ * widget.
*
*--------------------------------------------------------------
*/
void
-TkTextPickCurrent(textPtr, eventPtr)
- register TkText *textPtr; /* Text widget in which to select
- * current character. */
- XEvent *eventPtr; /* Event describing location of
- * mouse cursor. Must be EnterWindow,
- * LeaveWindow, ButtonRelease, or
- * MotionNotify. */
+TkTextPickCurrent(
+ register TkText *textPtr, /* Text widget in which to select current
+ * character. */
+ XEvent *eventPtr) /* Event describing location of mouse cursor.
+ * Must be EnterWindow, LeaveWindow,
+ * ButtonRelease, or MotionNotify. */
{
TkTextIndex index;
TkTextTag **oldArrayPtr, **newArrayPtr;
- TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent
- * compiler warning. */
-
- int numOldTags, numNewTags, i, j, size;
+ TkTextTag **copyArrayPtr = NULL;
+ /* Initialization needed to prevent compiler
+ * warning. */
+ int numOldTags, numNewTags, i, j, size, nearby;
XEvent event;
/*
- * If a button is down, then don't do anything at all; we'll be
- * called again when all buttons are up, and we can repick then.
- * This implements a form of mouse grabbing.
+ * If a button is down, then don't do anything at all; we'll be called
+ * again when all buttons are up, and we can repick then. This implements
+ * a form of mouse grabbing.
*/
if (textPtr->flags & BUTTON_DOWN) {
- if (((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify))
+ if (((eventPtr->type == EnterNotify)
+ || (eventPtr->type == LeaveNotify))
&& ((eventPtr->xcrossing.mode == NotifyGrab)
|| (eventPtr->xcrossing.mode == NotifyUngrab))) {
/*
- * Special case: the window is being entered or left because
- * of a grab or ungrab. In this case, repick after all.
- * Furthermore, clear BUTTON_DOWN to release the simulated
- * grab.
+ * Special case: the window is being entered or left because of a
+ * grab or ungrab. In this case, repick after all. Furthermore,
+ * clear BUTTON_DOWN to release the simulated grab.
*/
textPtr->flags &= ~BUTTON_DOWN;
@@ -1292,12 +1525,12 @@ TkTextPickCurrent(textPtr, eventPtr)
}
/*
- * Save information about this event in the widget in case we have
- * to synthesize more enter and leave events later (e.g. because a
- * character was deleted, causing a new character to be underneath
- * the mouse cursor). Also translate MotionNotify events into
- * EnterNotify events, since that's what gets reported to event
- * handlers when the current character changes.
+ * Save information about this event in the widget in case we have to
+ * synthesize more enter and leave events later (e.g. because a character
+ * was deleted, causing a new character to be underneath the mouse
+ * cursor). Also translate MotionNotify events into EnterNotify events,
+ * since that's what gets reported to event handlers when the current
+ * character changes.
*/
if (eventPtr != &textPtr->pickEvent) {
@@ -1328,33 +1561,37 @@ TkTextPickCurrent(textPtr, eventPtr)
}
/*
- * Find the new current character, then find and sort all of the
- * tags associated with it.
+ * Find the new current character, then find and sort all of the tags
+ * associated with it.
*/
if (textPtr->pickEvent.type != LeaveNotify) {
TkTextPixelIndex(textPtr, textPtr->pickEvent.xcrossing.x,
- textPtr->pickEvent.xcrossing.y, &index);
- newArrayPtr = TkBTreeGetTags(&index, &numNewTags);
- SortTags(numNewTags, newArrayPtr);
+ textPtr->pickEvent.xcrossing.y, &index, &nearby);
+ if (nearby) {
+ newArrayPtr = NULL;
+ numNewTags = 0;
+ } else {
+ newArrayPtr = TkBTreeGetTags(&index, textPtr, &numNewTags);
+ SortTags(numNewTags, newArrayPtr);
+ }
} else {
newArrayPtr = NULL;
numNewTags = 0;
}
/*
- * Resort the tags associated with the previous marked character
- * (the priorities might have changed), then make a copy of the
- * new tags, and compare the old tags to the copy, nullifying
- * any tags that are present in both groups (i.e. the tags that
- * haven't changed).
+ * Resort the tags associated with the previous marked character (the
+ * priorities might have changed), then make a copy of the new tags, and
+ * compare the old tags to the copy, nullifying any tags that are present
+ * in both groups (i.e. the tags that haven't changed).
*/
SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr);
if (numNewTags > 0) {
size = numNewTags * sizeof(TkTextTag *);
copyArrayPtr = (TkTextTag **) ckalloc((unsigned) size);
- memcpy((VOID *) copyArrayPtr, (VOID *) newArrayPtr, (size_t) size);
+ memcpy(copyArrayPtr, newArrayPtr, (size_t) size);
for (i = 0; i < textPtr->numCurTags; i++) {
for (j = 0; j < numNewTags; j++) {
if (textPtr->curTagArrayPtr[i] == copyArrayPtr[j]) {
@@ -1367,13 +1604,12 @@ TkTextPickCurrent(textPtr, eventPtr)
}
/*
- * Invoke the binding system with a LeaveNotify event for all of
- * the tags that have gone away. We have to be careful here,
- * because it's possible that the binding could do something
- * (like calling tkwait) that eventually modifies
- * textPtr->curTagArrayPtr. To avoid problems in situations like
- * this, update curTagArrayPtr to its new value before invoking
- * any bindings, and don't use it any more here.
+ * Invoke the binding system with a LeaveNotify event for all of the tags
+ * that have gone away. We have to be careful here, because it's possible
+ * that the binding could do something (like calling tkwait) that
+ * eventually modifies textPtr->curTagArrayPtr. To avoid problems in
+ * situations like this, update curTagArrayPtr to its new value before
+ * invoking any bindings, and don't use it any more here.
*/
numOldTags = textPtr->numCurTags;
@@ -1381,41 +1617,120 @@ TkTextPickCurrent(textPtr, eventPtr)
oldArrayPtr = textPtr->curTagArrayPtr;
textPtr->curTagArrayPtr = newArrayPtr;
if (numOldTags != 0) {
- if ((textPtr->bindingTable != NULL) && (textPtr->tkwin != NULL)) {
+ if ((textPtr->sharedTextPtr->bindingTable != NULL)
+ && (textPtr->tkwin != NULL)
+ && !(textPtr->flags & DESTROYED)) {
event = textPtr->pickEvent;
event.type = LeaveNotify;
/*
- * Always use a detail of NotifyAncestor. Besides being
- * consistent, this avoids problems where the binding code
- * will discard NotifyInferior events.
+ * Always use a detail of NotifyAncestor. Besides being
+ * consistent, this avoids problems where the binding code will
+ * discard NotifyInferior events.
*/
event.xcrossing.detail = NotifyAncestor;
- Tk_BindEvent(textPtr->bindingTable, &event, textPtr->tkwin,
- numOldTags, (ClientData *) oldArrayPtr);
+ TagBindEvent(textPtr, &event, numOldTags, oldArrayPtr);
}
ckfree((char *) oldArrayPtr);
}
/*
- * Reset the "current" mark (be careful to recompute its location,
- * since it might have changed during an event binding). Then
- * invoke the binding system with an EnterNotify event for all of
- * the tags that have just appeared.
+ * Reset the "current" mark (be careful to recompute its location, since
+ * it might have changed during an event binding). Then invoke the binding
+ * system with an EnterNotify event for all of the tags that have just
+ * appeared.
*/
TkTextPixelIndex(textPtr, textPtr->pickEvent.xcrossing.x,
- textPtr->pickEvent.xcrossing.y, &index);
+ textPtr->pickEvent.xcrossing.y, &index, &nearby);
TkTextSetMark(textPtr, "current", &index);
if (numNewTags != 0) {
- if ((textPtr->bindingTable != NULL) && (textPtr->tkwin != NULL)) {
+ if ((textPtr->sharedTextPtr->bindingTable != NULL)
+ && (textPtr->tkwin != NULL)
+ && !(textPtr->flags & DESTROYED) && !nearby) {
event = textPtr->pickEvent;
event.type = EnterNotify;
event.xcrossing.detail = NotifyAncestor;
- Tk_BindEvent(textPtr->bindingTable, &event, textPtr->tkwin,
- numNewTags, (ClientData *) copyArrayPtr);
+ TagBindEvent(textPtr, &event, numNewTags, copyArrayPtr);
}
ckfree((char *) copyArrayPtr);
}
}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TagBindEvent --
+ *
+ * Trigger given events for all tags that match the relevant bindings.
+ * To handle the "sel" tag correctly in all peer widgets, we must use the
+ * name of the tags as the binding table element.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Almost anything can be triggered by tag bindings, including deletion
+ * of the text widget.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+TagBindEvent(
+ TkText *textPtr, /* Text widget to fire bindings in. */
+ XEvent *eventPtr, /* What actually happened. */
+ int numTags, /* Number of relevant tags. */
+ TkTextTag **tagArrayPtr) /* Array of relevant tags. */
+{
+ #define NUM_BIND_TAGS 10
+ CONST char *nameArray[NUM_BIND_TAGS];
+ CONST char **nameArrPtr;
+ int i;
+
+ /*
+ * Try to avoid allocation unless there are lots of tags.
+ */
+
+ if (numTags > NUM_BIND_TAGS) {
+ nameArrPtr = (CONST char **) ckalloc(numTags * sizeof(CONST char *));
+ } else {
+ nameArrPtr = nameArray;
+ }
+
+ /*
+ * We use tag names as keys in the hash table. We do this instead of using
+ * the actual tagPtr objects because we want one "sel" tag binding for all
+ * peer widgets, despite the fact that each has its own tagPtr object.
+ */
+
+ for (i = 0; i < numTags; i++) {
+ TkTextTag *tagPtr = tagArrayPtr[i];
+ if (tagPtr != NULL) {
+ nameArrPtr[i] = tagPtr->name;
+ } else {
+ /*
+ * Tag has been deleted elsewhere, and therefore nulled out in
+ * this array. Tk_BindEvent is clever enough to cope with NULLs
+ * being thrown at it.
+ */
+
+ nameArrPtr[i] = NULL;
+ }
+ }
+ Tk_BindEvent(textPtr->sharedTextPtr->bindingTable, eventPtr,
+ textPtr->tkwin, numTags, (ClientData *) nameArrPtr);
+
+ if (numTags > NUM_BIND_TAGS) {
+ ckfree((char *) nameArrPtr);
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 9f2582e..1758964 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1,47 +1,37 @@
-/*
+/*
* tkTextWind.c --
*
- * This file contains code that allows arbitrary windows to be
- * nested inside text widgets. It also implements the "window"
- * widget command for texts.
+ * This file contains code that allows arbitrary windows to be nested
+ * inside text widgets. It also implements the "window" widget command
+ * for texts.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tk.h"
-#include "tkText.h"
#include "tkPort.h"
+#include "tkText.h"
/*
- * The following structure is the official type record for the
- * embedded window geometry manager:
+ * The following structure is the official type record for the embedded window
+ * geometry manager:
*/
-static void EmbWinRequestProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void EmbWinLostSlaveProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
+static void EmbWinRequestProc(ClientData clientData,
+ Tk_Window tkwin);
+static void EmbWinLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
-static Tk_GeomMgr textGeomType = {
+static const Tk_GeomMgr textGeomType = {
"text", /* name */
EmbWinRequestProc, /* requestProc */
EmbWinLostSlaveProc, /* lostSlaveProc */
};
/*
- * Definitions for alignment values:
- */
-
-#define ALIGN_BOTTOM 0
-#define ALIGN_CENTER 1
-#define ALIGN_TOP 2
-#define ALIGN_BASELINE 3
-
-/*
* Macro that determines the size of an embedded window segment:
*/
@@ -49,85 +39,79 @@ static Tk_GeomMgr textGeomType = {
+ sizeof(TkTextEmbWindow)))
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static int AlignParseProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *widgRec, int offset));
-static char * AlignPrintProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset,
- Tcl_FreeProc **freeProcPtr));
-static TkTextSegment * EmbWinCleanupProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void EmbWinCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void EmbWinBboxProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int index, int y, int lineHeight, int baseline,
- int *xPtr, int *yPtr, int *widthPtr,
- int *heightPtr));
-static int EmbWinConfigure _ANSI_ARGS_((TkText *textPtr,
- TkTextSegment *ewPtr, int argc, CONST char **argv));
-static void EmbWinDelayedUnmap _ANSI_ARGS_((
- ClientData clientData));
-static int EmbWinDeleteProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-static void EmbWinDisplayProc _ANSI_ARGS_((
- TkTextDispChunk *chunkPtr, int x, int y,
- int lineHeight, int baseline, Display *display,
- Drawable dst, int screenY));
-static int EmbWinLayoutProc _ANSI_ARGS_((TkText *textPtr,
+static TkTextSegment * EmbWinCleanupProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void EmbWinCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void EmbWinBboxProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr, int index, int y,
+ int lineHeight, int baseline, int *xPtr,int *yPtr,
+ int *widthPtr, int *heightPtr);
+static int EmbWinConfigure(TkText *textPtr, TkTextSegment *ewPtr,
+ int objc, Tcl_Obj *const objv[]);
+static void EmbWinDelayedUnmap(ClientData clientData);
+static int EmbWinDeleteProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+static int EmbWinLayoutProc(TkText *textPtr,
TkTextIndex *indexPtr, TkTextSegment *segPtr,
- int offset, int maxX, int maxChars,
- int noCharsYet, TkWrapMode wrapMode,
- TkTextDispChunk *chunkPtr));
-static void EmbWinStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbWinUndisplayProc _ANSI_ARGS_((TkText *textPtr,
- TkTextDispChunk *chunkPtr));
+ int offset, int maxX, int maxChars,int noCharsYet,
+ TkWrapMode wrapMode, TkTextDispChunk *chunkPtr);
+static void EmbWinStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbWinUndisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
+static TkTextEmbWindowClient* EmbWinGetClient(const TkText *textPtr,
+ TkTextSegment *ewPtr);
/*
* The following structure declares the "embedded window" segment type.
*/
-static Tk_SegType tkTextEmbWindowType = {
- "window", /* name */
- 0, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- EmbWinDeleteProc, /* deleteProc */
- EmbWinCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- EmbWinLayoutProc, /* layoutProc */
- EmbWinCheckProc /* checkProc */
+static const Tk_SegType tkTextEmbWindowType = {
+ "window", /* name */
+ 0, /* leftGravity */
+ NULL, /* splitProc */
+ EmbWinDeleteProc, /* deleteProc */
+ EmbWinCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ EmbWinLayoutProc, /* layoutProc */
+ EmbWinCheckProc /* checkProc */
+};
+
+/*
+ * Definitions for alignment values:
+ */
+
+static char *alignStrings[] = {
+ "baseline", "bottom", "center", "top", NULL
};
+typedef enum {
+ ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_TOP
+} alignMode;
+
/*
* Information used for parsing window configuration options:
*/
-static Tk_CustomOption alignOption = {AlignParseProc, AlignPrintProc,
- (ClientData) NULL};
-
-static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_CUSTOM, "-align", (char *) NULL, (char *) NULL,
- "center", 0, TK_CONFIG_DONT_SET_DEFAULT, &alignOption},
- {TK_CONFIG_STRING, "-create", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextEmbWindow, create),
- TK_CONFIG_DONT_SET_DEFAULT|TK_CONFIG_NULL_OK},
- {TK_CONFIG_INT, "-padx", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(TkTextEmbWindow, padX),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_INT, "-pady", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(TkTextEmbWindow, padY),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_BOOLEAN, "-stretch", (char *) NULL, (char *) NULL,
- "0", Tk_Offset(TkTextEmbWindow, stretch),
- TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_WINDOW, "-window", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(TkTextEmbWindow, tkwin),
- TK_CONFIG_DONT_SET_DEFAULT|TK_CONFIG_NULL_OK},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+static const Tk_OptionSpec optionSpecs[] = {
+ {TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
+ "center", -1, Tk_Offset(TkTextEmbWindow, align),
+ 0, (ClientData) alignStrings, 0},
+ {TK_OPTION_STRING, "-create", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-padx", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbWindow, padX), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-pady", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbWindow, padY), 0, 0, 0},
+ {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbWindow, stretch), 0, 0, 0},
+ {TK_OPTION_WINDOW, "-window", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_END}
};
/*
@@ -135,9 +119,8 @@ static Tk_ConfigSpec configSpecs[] = {
*
* TkTextWindowCmd --
*
- * This procedure implements the "window" widget command
- * for text widgets. See the user documentation for details
- * on what it does.
+ * This function implements the "window" widget command for text widgets.
+ * See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result or error.
@@ -149,100 +132,154 @@ static Tk_ConfigSpec configSpecs[] = {
*/
int
-TkTextWindowCmd(textPtr, interp, argc, argv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. Someone else has already
+TkTextWindowCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
- * argv[1] is "window". */
+ * objv[1] is "window". */
{
- size_t length;
+ int optionIndex;
+ static const char *windOptionStrings[] = {
+ "cget", "configure", "create", "names", NULL
+ };
+ enum windOptions {
+ WIND_CGET, WIND_CONFIGURE, WIND_CREATE, WIND_NAMES
+ };
register TkTextSegment *ewPtr;
- if (argc < 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " window option ?arg arg ...?\"", (char *) NULL);
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[2], windOptionStrings,
+ "window option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- length = strlen(argv[2]);
- if ((strncmp(argv[2], "cget", length) == 0) && (length >= 2)) {
+ switch ((enum windOptions) optionIndex) {
+ case WIND_CGET: {
TkTextIndex index;
TkTextSegment *ewPtr;
+ Tcl_Obj *objPtr;
+ TkTextEmbWindowClient *client;
- if (argc != 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " window cget index option\"",
- (char *) NULL);
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index option");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
- ewPtr = TkTextIndexToSeg(&index, (int *) NULL);
+ ewPtr = TkTextIndexToSeg(&index, NULL);
if (ewPtr->typePtr != &tkTextEmbWindowType) {
Tcl_AppendResult(interp, "no embedded window at index \"",
- argv[3], "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Copy over client specific value before querying.
+ */
+
+ client = EmbWinGetClient(textPtr, ewPtr);
+ if (client != NULL) {
+ ewPtr->body.ew.tkwin = client->tkwin;
+ } else {
+ ewPtr->body.ew.tkwin = NULL;
+ }
+
+ objPtr = Tk_GetOptionValue(interp, (char *) &ewPtr->body.ew,
+ ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin);
+ if (objPtr == NULL) {
return TCL_ERROR;
}
- return Tk_ConfigureValue(interp, textPtr->tkwin, configSpecs,
- (char *) &ewPtr->body.ew, argv[4], 0);
- } else if ((strncmp(argv[2], "configure", length) == 0) && (length >= 2)) {
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
+ }
+ case WIND_CONFIGURE: {
TkTextIndex index;
TkTextSegment *ewPtr;
- if (argc < 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " window configure index ?option value ...?\"",
- (char *) NULL);
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
- ewPtr = TkTextIndexToSeg(&index, (int *) NULL);
+ ewPtr = TkTextIndexToSeg(&index, NULL);
if (ewPtr->typePtr != &tkTextEmbWindowType) {
Tcl_AppendResult(interp, "no embedded window at index \"",
- argv[3], "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
return TCL_ERROR;
}
- if (argc == 4) {
- return Tk_ConfigureInfo(interp, textPtr->tkwin, configSpecs,
- (char *) &ewPtr->body.ew, (char *) NULL, 0);
- } else if (argc == 5) {
- return Tk_ConfigureInfo(interp, textPtr->tkwin, configSpecs,
- (char *) &ewPtr->body.ew, argv[4], 0);
+ if (objc <= 5) {
+ TkTextEmbWindowClient *client;
+ Tcl_Obj* objPtr;
+
+ /*
+ * Copy over client specific value before querying.
+ */
+
+ client = EmbWinGetClient(textPtr, ewPtr);
+ if (client != NULL) {
+ ewPtr->body.ew.tkwin = client->tkwin;
+ } else {
+ ewPtr->body.ew.tkwin = NULL;
+ }
+
+ objPtr = Tk_GetOptionInfo(interp, (char *) &ewPtr->body.ew,
+ ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL,
+ textPtr->tkwin);
+ if (objPtr == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
} else {
- TkTextChanged(textPtr, &index, &index);
- return EmbWinConfigure(textPtr, ewPtr, argc-4, argv+4);
+ TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
+
+ /*
+ * It's probably not true that all window configuration can change
+ * the line height, so we could be more efficient here and only
+ * call this when necessary.
+ */
+
+ TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ return EmbWinConfigure(textPtr, ewPtr, objc-4, objv+4);
}
- } else if ((strncmp(argv[2], "create", length) == 0) && (length >= 2)) {
+ }
+ case WIND_CREATE: {
TkTextIndex index;
int lineIndex;
+ TkTextEmbWindowClient *client;
+ int res;
/*
- * Add a new window. Find where to put the new window, and
- * mark that position for redisplay.
+ * Add a new window. Find where to put the new window, and mark that
+ * position for redisplay.
*/
- if (argc < 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " window create index ?option value ...?\"",
- (char *) NULL);
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
return TCL_ERROR;
}
- if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) {
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
/*
* Don't allow insertions on the last (dummy) line of the text.
*/
-
- lineIndex = TkBTreeLineIndex(index.linePtr);
- if (lineIndex == TkBTreeNumLines(textPtr->tree)) {
+
+ lineIndex = TkBTreeLinesTo(textPtr, index.linePtr);
+ if (lineIndex == TkBTreeNumLines(textPtr->sharedTextPtr->tree,
+ textPtr)) {
lineIndex--;
- TkTextMakeByteIndex(textPtr->tree, lineIndex, 1000000, &index);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineIndex, 1000000, &index);
}
/*
@@ -252,49 +289,61 @@ TkTextWindowCmd(textPtr, interp, argc, argv)
ewPtr = (TkTextSegment *) ckalloc(EW_SEG_SIZE);
ewPtr->typePtr = &tkTextEmbWindowType;
ewPtr->size = 1;
- ewPtr->body.ew.textPtr = textPtr;
+ ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr;
ewPtr->body.ew.linePtr = NULL;
ewPtr->body.ew.tkwin = NULL;
ewPtr->body.ew.create = NULL;
ewPtr->body.ew.align = ALIGN_CENTER;
ewPtr->body.ew.padX = ewPtr->body.ew.padY = 0;
ewPtr->body.ew.stretch = 0;
- ewPtr->body.ew.chunkCount = 0;
- ewPtr->body.ew.displayed = 0;
+ ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs);
+
+ client = (TkTextEmbWindowClient *)
+ ckalloc(sizeof(TkTextEmbWindowClient));
+ client->next = NULL;
+ client->textPtr = textPtr;
+ client->tkwin = NULL;
+ client->chunkCount = 0;
+ client->displayed = 0;
+ client->parent = ewPtr;
+ ewPtr->body.ew.clients = client;
/*
- * Link the segment into the text widget, then configure it (delete
- * it again if the configuration fails).
+ * Link the segment into the text widget, then configure it (delete it
+ * again if the configuration fails).
*/
- TkTextChanged(textPtr, &index, &index);
+ TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
TkBTreeLinkSegment(ewPtr, &index);
- if (EmbWinConfigure(textPtr, ewPtr, argc-4, argv+4) != TCL_OK) {
+ res = EmbWinConfigure(textPtr, ewPtr, objc-4, objv+4);
+ client->tkwin = ewPtr->body.ew.tkwin;
+ if (res != TCL_OK) {
TkTextIndex index2;
- TkTextIndexForwChars(&index, 1, &index2);
- TkBTreeDeleteChars(&index, &index2);
+ TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES);
+ TkBTreeDeleteIndexRange(textPtr->sharedTextPtr->tree, &index,
+ &index2);
return TCL_ERROR;
}
- } else if (strncmp(argv[2], "names", length) == 0) {
+ TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ break;
+ }
+ case WIND_NAMES: {
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " window names\"", (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- for (hPtr = Tcl_FirstHashEntry(&textPtr->windowTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_AppendElement(interp,
- Tcl_GetHashKey(&textPtr->markTable, hPtr));
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr));
}
- } else {
- Tcl_AppendResult(interp, "bad window option \"", argv[2],
- "\": must be cget, configure, create, or names",
- (char *) NULL);
- return TCL_ERROR;
+ break;
+ }
}
return TCL_OK;
}
@@ -304,76 +353,97 @@ TkTextWindowCmd(textPtr, interp, argc, argv)
*
* EmbWinConfigure --
*
- * This procedure is called to handle configuration options
- * for an embedded window, using an argc/argv list.
+ * This function is called to handle configuration options for an
+ * embedded window, using an objc/objv list.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message..
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message..
*
* Side effects:
- * Configuration information for the embedded window changes,
- * such as alignment, stretching, or name of the embedded
- * window.
+ * Configuration information for the embedded window changes, such as
+ * alignment, stretching, or name of the embedded window.
+ *
+ * Note that this function may leave widget specific client information
+ * with a NULL tkwin attached to ewPtr. While we could choose to clean up
+ * the client data structure here, there is no need to do so, and it is
+ * likely that the user is going to adjust the tkwin again soon.
*
*--------------------------------------------------------------
*/
static int
-EmbWinConfigure(textPtr, ewPtr, argc, argv)
- TkText *textPtr; /* Information about text widget that
- * contains embedded window. */
- TkTextSegment *ewPtr; /* Embedded window to be configured. */
- int argc; /* Number of strings in argv. */
- CONST char **argv; /* Array of strings describing configuration
+EmbWinConfigure(
+ TkText *textPtr, /* Information about text widget that contains
+ * embedded window. */
+ TkTextSegment *ewPtr, /* Embedded window to be configured. */
+ int objc, /* Number of strings in objv. */
+ Tcl_Obj *const objv[]) /* Array of objects describing configuration
* options. */
{
Tk_Window oldWindow;
- Tcl_HashEntry *hPtr;
- int new;
+ TkTextEmbWindowClient *client;
+
+ /*
+ * Copy over client specific value before querying or setting.
+ */
+
+ client = EmbWinGetClient(textPtr, ewPtr);
+ if (client != NULL) {
+ ewPtr->body.ew.tkwin = client->tkwin;
+ } else {
+ ewPtr->body.ew.tkwin = NULL;
+ }
oldWindow = ewPtr->body.ew.tkwin;
- if (Tk_ConfigureWidget(textPtr->interp, textPtr->tkwin, configSpecs,
- argc, argv, (char *) &ewPtr->body.ew, TK_CONFIG_ARGV_ONLY)
- != TCL_OK) {
+ if (Tk_SetOptions(textPtr->interp, (char *) &ewPtr->body.ew,
+ ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL,
+ NULL) != TCL_OK) {
return TCL_ERROR;
}
+
if (oldWindow != ewPtr->body.ew.tkwin) {
if (oldWindow != NULL) {
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&textPtr->windowTable,
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(
+ &textPtr->sharedTextPtr->windowTable,
Tk_PathName(oldWindow)));
Tk_DeleteEventHandler(oldWindow, StructureNotifyMask,
- EmbWinStructureProc, (ClientData) ewPtr);
- Tk_ManageGeometry(oldWindow, (Tk_GeomMgr *) NULL,
- (ClientData) NULL);
+ EmbWinStructureProc, (ClientData) client);
+ Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL);
if (textPtr->tkwin != Tk_Parent(oldWindow)) {
Tk_UnmaintainGeometry(oldWindow, textPtr->tkwin);
} else {
Tk_UnmapWindow(oldWindow);
}
}
+ if (client != NULL) {
+ client->tkwin = NULL;
+ }
if (ewPtr->body.ew.tkwin != NULL) {
Tk_Window ancestor, parent;
+ Tcl_HashEntry *hPtr;
+ int isNew;
/*
- * Make sure that the text is either the parent of the
- * embedded window or a descendant of that parent. Also,
- * don't allow a top-level window to be managed inside
- * a text.
+ * Make sure that the text is either the parent of the embedded
+ * window or a descendant of that parent. Also, don't allow a
+ * top-level window to be managed inside a text.
*/
parent = Tk_Parent(ewPtr->body.ew.tkwin);
- for (ancestor = textPtr->tkwin; ;
- ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = textPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- badMaster:
+ badMaster:
Tcl_AppendResult(textPtr->interp, "can't embed ",
Tk_PathName(ewPtr->body.ew.tkwin), " in ",
- Tk_PathName(textPtr->tkwin), (char *) NULL);
+ Tk_PathName(textPtr->tkwin), NULL);
ewPtr->body.ew.tkwin = NULL;
+ if (client != NULL) {
+ client->tkwin = NULL;
+ }
return TCL_ERROR;
}
}
@@ -382,28 +452,43 @@ EmbWinConfigure(textPtr, ewPtr, argc, argv)
goto badMaster;
}
+ if (client == NULL) {
+ /*
+ * Have to make the new client.
+ */
+
+ client = (TkTextEmbWindowClient *)
+ ckalloc(sizeof(TkTextEmbWindowClient));
+ client->next = ewPtr->body.ew.clients;
+ client->textPtr = textPtr;
+ client->tkwin = NULL;
+ client->chunkCount = 0;
+ client->displayed = 0;
+ client->parent = ewPtr;
+ ewPtr->body.ew.clients = client;
+ }
+ client->tkwin = ewPtr->body.ew.tkwin;
+
/*
- * Take over geometry management for the window, plus create
- * an event handler to find out when it is deleted.
+ * Take over geometry management for the window, plus create an
+ * event handler to find out when it is deleted.
*/
Tk_ManageGeometry(ewPtr->body.ew.tkwin, &textGeomType,
- (ClientData) ewPtr);
+ (ClientData) client);
Tk_CreateEventHandler(ewPtr->body.ew.tkwin, StructureNotifyMask,
- EmbWinStructureProc, (ClientData) ewPtr);
+ EmbWinStructureProc, (ClientData) client);
/*
- * Special trick! Must enter into the hash table *after*
- * calling Tk_ManageGeometry: if the window was already managed
- * elsewhere in this text, the Tk_ManageGeometry call will cause
- * the entry to be removed, which could potentially lose the new
- * entry.
+ * Special trick! Must enter into the hash table *after* calling
+ * Tk_ManageGeometry: if the window was already managed elsewhere
+ * in this text, the Tk_ManageGeometry call will cause the entry
+ * to be removed, which could potentially lose the new entry.
*/
- hPtr = Tcl_CreateHashEntry(&textPtr->windowTable,
- Tk_PathName(ewPtr->body.ew.tkwin), &new);
+ hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->windowTable,
+ Tk_PathName(ewPtr->body.ew.tkwin), &isNew);
Tcl_SetHashValue(hPtr, ewPtr);
-
}
}
return TCL_OK;
@@ -412,135 +497,54 @@ EmbWinConfigure(textPtr, ewPtr, argc, argv)
/*
*--------------------------------------------------------------
*
- * AlignParseProc --
- *
- * This procedure is invoked by Tk_ConfigureWidget during
- * option processing to handle "-align" options for embedded
- * windows.
- *
- * Results:
- * A standard Tcl return value.
- *
- * Side effects:
- * The alignment for the embedded window may change.
- *
- *--------------------------------------------------------------
- */
-
- /* ARGSUSED */
-static int
-AlignParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* Not used.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window for text widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to TkTextEmbWindow
- * structure. */
- int offset; /* Offset into item (ignored). */
-{
- register TkTextEmbWindow *embPtr = (TkTextEmbWindow *) widgRec;
-
- if (strcmp(value, "baseline") == 0) {
- embPtr->align = ALIGN_BASELINE;
- } else if (strcmp(value, "bottom") == 0) {
- embPtr->align = ALIGN_BOTTOM;
- } else if (strcmp(value, "center") == 0) {
- embPtr->align = ALIGN_CENTER;
- } else if (strcmp(value, "top") == 0) {
- embPtr->align = ALIGN_TOP;
- } else {
- Tcl_AppendResult(interp, "bad alignment \"", value,
- "\": must be baseline, bottom, center, or top",
- (char *) NULL);
- return TCL_ERROR;
- }
- return TCL_OK;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * AlignPrintProc --
- *
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-align" configuration
- * option for embedded windows.
- *
- * Results:
- * The return value is a string describing the embedded
- * window's current alignment.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
- /* ARGSUSED */
-static char *
-AlignPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window for text widget. */
- char *widgRec; /* Pointer to TkTextEmbWindow
- * structure. */
- int offset; /* Ignored. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
-{
- switch (((TkTextEmbWindow *) widgRec)->align) {
- case ALIGN_BASELINE:
- return "baseline";
- case ALIGN_BOTTOM:
- return "bottom";
- case ALIGN_CENTER:
- return "center";
- case ALIGN_TOP:
- return "top";
- default:
- return "??";
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
* EmbWinStructureProc --
*
- * This procedure is invoked by the Tk event loop whenever
- * StructureNotify events occur for a window that's embedded
- * in a text widget. This procedure's only purpose is to
- * clean up when windows are deleted.
+ * This function is invoked by the Tk event loop whenever StructureNotify
+ * events occur for a window that's embedded in a text widget. This
+ * function's only purpose is to clean up when windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * The window is disassociated from the window segment, and
- * the portion of the text is redisplayed.
+ * The window is disassociated from the window segment, and the portion
+ * of the text is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-EmbWinStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to record describing window item. */
- XEvent *eventPtr; /* Describes what just happened. */
+EmbWinStructureProc(
+ ClientData clientData, /* Pointer to record describing window item. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
- register TkTextSegment *ewPtr = (TkTextSegment *) clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData;
+ TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
+ Tcl_HashEntry *hPtr;
if (eventPtr->type != DestroyNotify) {
return;
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&ewPtr->body.ew.textPtr->windowTable,
- Tk_PathName(ewPtr->body.ew.tkwin)));
+ hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.sharedTextPtr->windowTable,
+ Tk_PathName(client->tkwin));
+ if (hPtr != NULL) {
+ /*
+ * This may not exist if the entire widget is being deleted.
+ */
+
+ Tcl_DeleteHashEntry(hPtr);
+ }
+
ewPtr->body.ew.tkwin = NULL;
- index.tree = ewPtr->body.ew.textPtr->tree;
+ client->tkwin = NULL;
+ index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
index.byteIndex = TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr);
- TkTextChanged(ewPtr->body.ew.textPtr, &index, &index);
+ TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index);
+ TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
/*
@@ -548,8 +552,8 @@ EmbWinStructureProc(clientData, eventPtr)
*
* EmbWinRequestProc --
*
- * This procedure is invoked whenever a window that's associated
- * with a window canvas item changes its requested dimensions.
+ * This function is invoked whenever a window that's associated with a
+ * window canvas item changes its requested dimensions.
*
* Results:
* None.
@@ -563,18 +567,20 @@ EmbWinStructureProc(clientData, eventPtr)
/* ARGSUSED */
static void
-EmbWinRequestProc(clientData, tkwin)
- ClientData clientData; /* Pointer to record for window item. */
- Tk_Window tkwin; /* Window that changed its desired
- * size. */
+EmbWinRequestProc(
+ ClientData clientData, /* Pointer to record for window item. */
+ Tk_Window tkwin) /* Window that changed its desired size. */
{
- TkTextSegment *ewPtr = (TkTextSegment *) clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData;
+ TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
- index.tree = ewPtr->body.ew.textPtr->tree;
+ index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
index.byteIndex = TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr);
- TkTextChanged(ewPtr->body.ew.textPtr, &index, &index);
+ TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index);
+ TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
/*
@@ -582,44 +588,126 @@ EmbWinRequestProc(clientData, tkwin)
*
* EmbWinLostSlaveProc --
*
- * This procedure is invoked by the Tk geometry manager when
- * a slave window managed by a text widget is claimed away
- * by another geometry manager.
+ * This function is invoked by the Tk geometry manager when a slave
+ * window managed by a text widget is claimed away by another geometry
+ * manager.
*
* Results:
* None.
*
* Side effects:
- * The window is disassociated from the window segment, and
- * the portion of the text is redisplayed.
+ * The window is disassociated from the window segment, and the portion
+ * of the text is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-EmbWinLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Pointer to record describing window item. */
- Tk_Window tkwin; /* Window that was claimed away by another
+EmbWinLostSlaveProc(
+ ClientData clientData, /* Pointer to record describing window item. */
+ Tk_Window tkwin) /* Window that was claimed away by another
* geometry manager. */
{
- register TkTextSegment *ewPtr = (TkTextSegment *) clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData;
+ TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
+ Tcl_HashEntry *hPtr;
+ TkTextEmbWindowClient *loop;
- Tk_DeleteEventHandler(ewPtr->body.ew.tkwin, StructureNotifyMask,
- EmbWinStructureProc, (ClientData) ewPtr);
- Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) ewPtr);
- if (ewPtr->body.ew.textPtr->tkwin != Tk_Parent(tkwin)) {
- Tk_UnmaintainGeometry(tkwin, ewPtr->body.ew.textPtr->tkwin);
+ Tk_DeleteEventHandler(client->tkwin, StructureNotifyMask,
+ EmbWinStructureProc, (ClientData) client);
+ Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) client);
+ if (client->textPtr->tkwin != Tk_Parent(tkwin)) {
+ Tk_UnmaintainGeometry(tkwin, client->textPtr->tkwin);
} else {
Tk_UnmapWindow(tkwin);
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&ewPtr->body.ew.textPtr->windowTable,
- Tk_PathName(ewPtr->body.ew.tkwin)));
+ hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.sharedTextPtr->windowTable,
+ Tk_PathName(client->tkwin));
+ Tcl_DeleteHashEntry(hPtr);
+ client->tkwin = NULL;
ewPtr->body.ew.tkwin = NULL;
- index.tree = ewPtr->body.ew.textPtr->tree;
+
+ /*
+ * Free up the memory allocation for this client.
+ */
+
+ loop = ewPtr->body.ew.clients;
+ if (loop == client) {
+ ewPtr->body.ew.clients = client->next;
+ } else {
+ while (loop->next != client) {
+ loop = loop->next;
+ }
+ loop->next = client->next;
+ }
+ ckfree((char *) client);
+
+ index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
index.byteIndex = TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr);
- TkTextChanged(ewPtr->body.ew.textPtr, &index, &index);
+ TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index);
+ TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkTextWinFreeClient --
+ *
+ * Free up the hash entry and client information for a given embedded
+ * window.
+ *
+ * It is assumed the caller will manage the linked list of clients
+ * associated with the relevant TkTextSegment.
+ *
+ * Results:
+ * Nothing.
+ *
+ * Side effects:
+ * The embedded window information for a single client is deleted, if it
+ * exists, and any resources associated with it are released.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkTextWinFreeClient(
+ Tcl_HashEntry *hPtr, /* Hash entry corresponding to this client, or
+ * NULL */
+ TkTextEmbWindowClient *client)
+ /* Client data structure, with the 'tkwin'
+ * field to be cleaned up. */
+{
+ if (hPtr != NULL) {
+ /*
+ * (It's possible for there to be no hash table entry for this window,
+ * if an error occurred while creating the window segment but before
+ * the window got added to the table)
+ */
+
+ Tcl_DeleteHashEntry(hPtr);
+ }
+
+ /*
+ * Delete the event handler for the window before destroying the window,
+ * so that EmbWinStructureProc doesn't get called (we'll already do
+ * everything that it would have done, and it will just get confused).
+ */
+
+ if (client->tkwin != NULL) {
+ Tk_DeleteEventHandler(client->tkwin, StructureNotifyMask,
+ EmbWinStructureProc, (ClientData) client);
+ Tk_DestroyWindow(client->tkwin);
+ }
+ Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) client);
+
+ /*
+ * Free up this client.
+ */
+
+ ckfree((char *) client);
}
/*
@@ -627,8 +715,8 @@ EmbWinLostSlaveProc(clientData, tkwin)
*
* EmbWinDeleteProc --
*
- * This procedure is invoked by the text B-tree code whenever
- * an embedded window lies in a range of characters being deleted.
+ * This function is invoked by the text B-tree code whenever an embedded
+ * window lies in a range of characters being deleted.
*
* Results:
* Returns 0 to indicate that the deletion has been accepted.
@@ -642,42 +730,37 @@ EmbWinLostSlaveProc(clientData, tkwin)
/* ARGSUSED */
static int
-EmbWinDeleteProc(ewPtr, linePtr, treeGone)
- TkTextSegment *ewPtr; /* Segment being deleted. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is
- * being deleted, so everything must
- * get cleaned up. */
+EmbWinDeleteProc(
+ TkTextSegment *ewPtr, /* Segment being deleted. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
+ * deleted, so everything must get cleaned
+ * up. */
{
- Tcl_HashEntry *hPtr;
+ TkTextEmbWindowClient *client;
+ client = ewPtr->body.ew.clients;
- if (ewPtr->body.ew.tkwin != NULL) {
- hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.textPtr->windowTable,
- Tk_PathName(ewPtr->body.ew.tkwin));
- if (hPtr != NULL) {
- /*
- * (It's possible for there to be no hash table entry for this
- * window, if an error occurred while creating the window segment
- * but before the window got added to the table)
- */
+ while (client != NULL) {
+ TkTextEmbWindowClient *next = client->next;
+ Tcl_HashEntry *hPtr = NULL;
- Tcl_DeleteHashEntry(hPtr);
+ if (client->tkwin != NULL) {
+ hPtr = Tcl_FindHashEntry(
+ &ewPtr->body.ew.sharedTextPtr->windowTable,
+ Tk_PathName(client->tkwin));
}
+ TkTextWinFreeClient(hPtr, client);
+ client = next;
+ }
+ ewPtr->body.ew.clients = NULL;
- /*
- * Delete the event handler for the window before destroying
- * the window, so that EmbWinStructureProc doesn't get called
- * (we'll already do everything that it would have done, and
- * it will just get confused).
- */
+ Tk_FreeConfigOptions((char *) &ewPtr->body.ew, ewPtr->body.ew.optionTable,
+ NULL);
+
+ /*
+ * Free up all memory allocated.
+ */
- Tk_DeleteEventHandler(ewPtr->body.ew.tkwin, StructureNotifyMask,
- EmbWinStructureProc, (ClientData) ewPtr);
- Tk_DestroyWindow(ewPtr->body.ew.tkwin);
- }
- Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) ewPtr);
- Tk_FreeOptions(configSpecs, (char *) &ewPtr->body.ew,
- ewPtr->body.ew.textPtr->display, 0);
ckfree((char *) ewPtr);
return 0;
}
@@ -687,9 +770,8 @@ EmbWinDeleteProc(ewPtr, linePtr, treeGone)
*
* EmbWinCleanupProc --
*
- * This procedure is invoked by the B-tree code whenever a
- * segment containing an embedded window is moved from one
- * line to another.
+ * This function is invoked by the B-tree code whenever a segment
+ * containing an embedded window is moved from one line to another.
*
* Results:
* None.
@@ -701,9 +783,9 @@ EmbWinDeleteProc(ewPtr, linePtr, treeGone)
*/
static TkTextSegment *
-EmbWinCleanupProc(ewPtr, linePtr)
- TkTextSegment *ewPtr; /* Mark segment that's being moved. */
- TkTextLine *linePtr; /* Line that now contains segment. */
+EmbWinCleanupProc(
+ TkTextSegment *ewPtr, /* Mark segment that's being moved. */
+ TkTextLine *linePtr) /* Line that now contains segment. */
{
ewPtr->body.ew.linePtr = linePtr;
return ewPtr;
@@ -714,12 +796,11 @@ EmbWinCleanupProc(ewPtr, linePtr)
*
* EmbWinLayoutProc --
*
- * This procedure is the "layoutProc" for embedded window
- * segments.
+ * This function is the "layoutProc" for embedded window segments.
*
* Results:
- * 1 is returned to indicate that the segment should be
- * displayed. The chunkPtr structure is filled in.
+ * 1 is returned to indicate that the segment should be displayed. The
+ * chunkPtr structure is filled in.
*
* Side effects:
* None, except for filling in chunkPtr.
@@ -729,49 +810,105 @@ EmbWinCleanupProc(ewPtr, linePtr)
/*ARGSUSED*/
static int
-EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Identifies first character in chunk. */
- TkTextSegment *ewPtr; /* Segment corresponding to indexPtr. */
- int offset; /* Offset within segPtr corresponding to
+EmbWinLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */
+ int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars; /* Chunk must not include more than this
- * many characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int maxChars, /* Chunk must not include more than this many
+ * characters. */
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode; /* Wrap mode to use for line: TEXT_WRAPMODE_CHAR,
- * TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr;
- /* Structure to fill in with information
- * about this chunk. The x field has already
- * been set by the caller. */
+ TkWrapMode wrapMode, /* Wrap mode to use for line:
+ * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
+ * TEXT_WRAPMODE_WORD. */
+ register TkTextDispChunk *chunkPtr)
+ /* Structure to fill in with information about
+ * this chunk. The x field has already been
+ * set by the caller. */
{
int width, height;
+ TkTextEmbWindowClient *client;
if (offset != 0) {
- panic("Non-zero offset in EmbWinLayoutProc");
+ Tcl_Panic("Non-zero offset in EmbWinLayoutProc");
+ }
+
+ client = EmbWinGetClient(textPtr, ewPtr);
+ if (client == NULL) {
+ ewPtr->body.ew.tkwin = NULL;
+ } else {
+ ewPtr->body.ew.tkwin = client->tkwin;
}
if ((ewPtr->body.ew.tkwin == NULL) && (ewPtr->body.ew.create != NULL)) {
- int code, new;
- Tcl_DString name;
+ int code, isNew;
Tk_Window ancestor;
Tcl_HashEntry *hPtr;
+ const char *before, *string;
+ Tcl_DString name, buf, *dsPtr = NULL;
+
+ before = ewPtr->body.ew.create;
/*
- * The window doesn't currently exist. Create it by evaluating
- * the creation script. The script must return the window's
- * path name: look up that name to get back to the window
- * token. Then register ourselves as the geometry manager for
- * the window.
+ * Find everything up to the next % character and append it to the
+ * result string.
*/
- code = Tcl_GlobalEval(textPtr->interp, ewPtr->body.ew.create);
+ string = before;
+ while (*string != 0) {
+ if ((*string == '%') && (string[1] == '%' || string[1] == 'W')) {
+ if (dsPtr == NULL) {
+ Tcl_DStringInit(&buf);
+ dsPtr = &buf;
+ }
+ if (string != before) {
+ Tcl_DStringAppend(dsPtr, before, (int) (string-before));
+ before = string;
+ }
+ if (string[1] == '%') {
+ Tcl_DStringAppend(dsPtr, "%", 1);
+ } else {
+ /*
+ * Substitute string as proper Tcl list element.
+ */
+
+ int spaceNeeded, cvtFlags, length;
+ const char *str = Tk_PathName(textPtr->tkwin);
+
+ spaceNeeded = Tcl_ScanElement(str, &cvtFlags);
+ length = Tcl_DStringLength(dsPtr);
+ Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
+ spaceNeeded = Tcl_ConvertElement(str,
+ Tcl_DStringValue(dsPtr) + length,
+ cvtFlags | TCL_DONT_USE_BRACES);
+ Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
+ }
+ before += 2;
+ string++;
+ }
+ string++;
+ }
+
+ /*
+ * The window doesn't currently exist. Create it by evaluating the
+ * creation script. The script must return the window's path name:
+ * look up that name to get back to the window token. Then register
+ * ourselves as the geometry manager for the window.
+ */
+
+ if (dsPtr != NULL) {
+ Tcl_DStringAppend(dsPtr, before, (int) (string-before));
+ code = Tcl_GlobalEval(textPtr->interp, Tcl_DStringValue(dsPtr));
+ Tcl_DStringFree(dsPtr);
+ } else {
+ code = Tcl_GlobalEval(textPtr->interp, ewPtr->body.ew.create);
+ }
if (code != TCL_OK) {
- createError:
+ createError:
Tcl_BackgroundError(textPtr->interp);
goto gotWindow;
}
@@ -780,19 +917,19 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
Tcl_ResetResult(textPtr->interp);
ewPtr->body.ew.tkwin = Tk_NameToWindow(textPtr->interp,
Tcl_DStringValue(&name), textPtr->tkwin);
+ Tcl_DStringFree(&name);
if (ewPtr->body.ew.tkwin == NULL) {
goto createError;
}
- for (ancestor = textPtr->tkwin; ;
- ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = textPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == Tk_Parent(ewPtr->body.ew.tkwin)) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- badMaster:
+ badMaster:
Tcl_AppendResult(textPtr->interp, "can't embed ",
Tk_PathName(ewPtr->body.ew.tkwin), " relative to ",
- Tk_PathName(textPtr->tkwin), (char *) NULL);
+ Tk_PathName(textPtr->tkwin), NULL);
Tcl_BackgroundError(textPtr->interp);
ewPtr->body.ew.tkwin = NULL;
goto gotWindow;
@@ -802,21 +939,39 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
|| (textPtr->tkwin == ewPtr->body.ew.tkwin)) {
goto badMaster;
}
- Tk_ManageGeometry(ewPtr->body.ew.tkwin, &textGeomType,
- (ClientData) ewPtr);
- Tk_CreateEventHandler(ewPtr->body.ew.tkwin, StructureNotifyMask,
- EmbWinStructureProc, (ClientData) ewPtr);
+
+ if (client == NULL) {
+ /*
+ * We just used a '-create' script to make a new window, which we
+ * now need to add to our client list.
+ */
+
+ client = (TkTextEmbWindowClient *)
+ ckalloc(sizeof(TkTextEmbWindowClient));
+ client->next = ewPtr->body.ew.clients;
+ client->textPtr = textPtr;
+ client->tkwin = NULL;
+ client->chunkCount = 0;
+ client->displayed = 0;
+ client->parent = ewPtr;
+ ewPtr->body.ew.clients = client;
+ }
+
+ client->tkwin = ewPtr->body.ew.tkwin;
+ Tk_ManageGeometry(client->tkwin, &textGeomType,
+ (ClientData) client);
+ Tk_CreateEventHandler(client->tkwin, StructureNotifyMask,
+ EmbWinStructureProc, (ClientData) client);
/*
- * Special trick! Must enter into the hash table *after*
- * calling Tk_ManageGeometry: if the window was already managed
- * elsewhere in this text, the Tk_ManageGeometry call will cause
- * the entry to be removed, which could potentially lose the new
- * entry.
+ * Special trick! Must enter into the hash table *after* calling
+ * Tk_ManageGeometry: if the window was already managed elsewhere in
+ * this text, the Tk_ManageGeometry call will cause the entry to be
+ * removed, which could potentially lose the new entry.
*/
- hPtr = Tcl_CreateHashEntry(&textPtr->windowTable,
- Tk_PathName(ewPtr->body.ew.tkwin), &new);
+ hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->windowTable,
+ Tk_PathName(client->tkwin), &isNew);
Tcl_SetHashValue(hPtr, ewPtr);
}
@@ -824,7 +979,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
* See if there's room for this window on this line.
*/
- gotWindow:
+ gotWindow:
if (ewPtr->body.ew.tkwin == NULL) {
width = 0;
height = 0;
@@ -841,9 +996,9 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
* Fill in the chunk structure.
*/
- chunkPtr->displayProc = EmbWinDisplayProc;
+ chunkPtr->displayProc = TkTextEmbWinDisplayProc;
chunkPtr->undisplayProc = EmbWinUndisplayProc;
- chunkPtr->measureProc = (Tk_ChunkMeasureProc *) NULL;
+ chunkPtr->measureProc = NULL;
chunkPtr->bboxProc = EmbWinBboxProc;
chunkPtr->numBytes = 1;
if (ewPtr->body.ew.align == ALIGN_BASELINE) {
@@ -859,7 +1014,9 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
chunkPtr->breakIndex = -1;
chunkPtr->breakIndex = 1;
chunkPtr->clientData = (ClientData) ewPtr;
- ewPtr->body.ew.chunkCount += 1;
+ if (client != NULL) {
+ client->chunkCount += 1;
+ }
return 1;
}
@@ -868,84 +1025,89 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
*
* EmbWinCheckProc --
*
- * This procedure is invoked by the B-tree code to perform
- * consistency checks on embedded windows.
+ * This function is invoked by the B-tree code to perform consistency
+ * checks on embedded windows.
*
* Results:
* None.
*
* Side effects:
- * The procedure panics if it detects anything wrong with
- * the embedded window.
+ * The function panics if it detects anything wrong with the embedded
+ * window.
*
*--------------------------------------------------------------
*/
static void
-EmbWinCheckProc(ewPtr, linePtr)
- TkTextSegment *ewPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+EmbWinCheckProc(
+ TkTextSegment *ewPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
if (ewPtr->nextPtr == NULL) {
- panic("EmbWinCheckProc: embedded window is last segment in line");
+ Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
}
if (ewPtr->size != 1) {
- panic("EmbWinCheckProc: embedded window has size %d", ewPtr->size);
+ Tcl_Panic("EmbWinCheckProc: embedded window has size %d", ewPtr->size);
}
}
/*
*--------------------------------------------------------------
*
- * EmbWinDisplayProc --
+ * TkTextEmbWinDisplayProc --
*
- * This procedure is invoked by the text displaying code
- * when it is time to actually draw an embedded window
- * chunk on the screen.
+ * This function is invoked by the text displaying code when it is time
+ * to actually draw an embedded window chunk on the screen.
*
* Results:
* None.
*
* Side effects:
- * The embedded window gets moved to the correct location
- * and mapped onto the screen.
+ * The embedded window gets moved to the correct location and mapped onto
+ * the screen.
*
*--------------------------------------------------------------
*/
-static void
-EmbWinDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to
- * draw this chunk (differs from
- * the x-position in the chunk because
- * of scrolling). */
- int y; /* Top of rectangular bounding box
- * for line: tells where to draw this
- * chunk in dst (x-position is in
- * the chunk itself). */
- int lineHeight; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing. */
- Drawable dst; /* Pixmap or window in which to draw */
- int screenY; /* Y-coordinate in text window that
- * corresponds to y. */
+void
+TkTextEmbWinDisplayProc(
+ TkText *textPtr, /* Information about text widget. */
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
+ * chunk (differs from the x-position in the
+ * chunk because of scrolling). */
+ int y, /* Top of rectangular bounding box for line:
+ * tells where to draw this chunk in dst
+ * (x-position is in the chunk itself). */
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing (unused). */
+ Drawable dst, /* Pixmap or window in which to draw
+ * (unused). */
+ int screenY) /* Y-coordinate in text window that
+ * corresponds to y. */
{
- TkTextSegment *ewPtr = (TkTextSegment *) chunkPtr->clientData;
int lineX, windowX, windowY, width, height;
Tk_Window tkwin;
+ TkTextSegment *ewPtr = (TkTextSegment*) chunkPtr->clientData;
+ TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
+
+ if (client == NULL) {
+ return;
+ }
- tkwin = ewPtr->body.ew.tkwin;
+ tkwin = client->tkwin;
if (tkwin == NULL) {
return;
}
+
if ((x + chunkPtr->width) <= 0) {
/*
- * The window is off-screen; just unmap it.
+ * The window is off-screen; just unmap it.
*/
- if (ewPtr->body.ew.textPtr->tkwin != Tk_Parent(tkwin)) {
- Tk_UnmaintainGeometry(tkwin, ewPtr->body.ew.textPtr->tkwin);
+ if (textPtr->tkwin != Tk_Parent(tkwin)) {
+ Tk_UnmaintainGeometry(tkwin, textPtr->tkwin);
} else {
Tk_UnmapWindow(tkwin);
}
@@ -953,15 +1115,15 @@ EmbWinDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
}
/*
- * Compute the window's location and size in the text widget, taking
- * into account the align and stretch values for the window.
+ * Compute the window's location and size in the text widget, taking into
+ * account the align and stretch values for the window.
*/
- EmbWinBboxProc(chunkPtr, 0, screenY, lineHeight, baseline, &lineX,
- &windowY, &width, &height);
+ EmbWinBboxProc(textPtr, chunkPtr, 0, screenY, lineHeight, baseline,
+ &lineX, &windowY, &width, &height);
windowX = lineX - chunkPtr->x + x;
- if (ewPtr->body.ew.textPtr->tkwin == Tk_Parent(tkwin)) {
+ if (textPtr->tkwin == Tk_Parent(tkwin)) {
if ((windowX != Tk_X(tkwin)) || (windowY != Tk_Y(tkwin))
|| (Tk_ReqWidth(tkwin) != Tk_Width(tkwin))
|| (height != Tk_Height(tkwin))) {
@@ -969,15 +1131,15 @@ EmbWinDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
}
Tk_MapWindow(tkwin);
} else {
- Tk_MaintainGeometry(tkwin, ewPtr->body.ew.textPtr->tkwin,
- windowX, windowY, width, height);
+ Tk_MaintainGeometry(tkwin, textPtr->tkwin, windowX, windowY,
+ width, height);
}
/*
* Mark the window as displayed so that it won't get unmapped.
*/
- ewPtr->body.ew.displayed = 1;
+ client->displayed = 1;
}
/*
@@ -985,9 +1147,9 @@ EmbWinDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
*
* EmbWinUndisplayProc --
*
- * This procedure is called when the chunk for an embedded
- * window is no longer going to be displayed. It arranges
- * for the window associated with the chunk to be unmapped.
+ * This function is called when the chunk for an embedded window is no
+ * longer going to be displayed. It arranges for the window associated
+ * with the chunk to be unmapped.
*
* Results:
* None.
@@ -999,25 +1161,29 @@ EmbWinDisplayProc(chunkPtr, x, y, lineHeight, baseline, display, dst, screenY)
*/
static void
-EmbWinUndisplayProc(textPtr, chunkPtr)
- TkText *textPtr; /* Overall information about text
- * widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is about to be freed. */
+EmbWinUndisplayProc(
+ TkText *textPtr, /* Overall information about text widget. */
+ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
- TkTextSegment *ewPtr = (TkTextSegment *) chunkPtr->clientData;
+ TkTextSegment *ewPtr = (TkTextSegment*) chunkPtr->clientData;
+ TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
+
+ if (client == NULL) {
+ return;
+ }
- ewPtr->body.ew.chunkCount--;
- if (ewPtr->body.ew.chunkCount == 0) {
+ client->chunkCount--;
+ if (client->chunkCount == 0) {
/*
* Don't unmap the window immediately, since there's a good chance
- * that it will immediately be redisplayed, perhaps even in the
- * same place. Instead, schedule the window to be unmapped later;
- * the call to EmbWinDelayedUnmap will be cancelled in the likely
- * event that the unmap becomes unnecessary.
+ * that it will immediately be redisplayed, perhaps even in the same
+ * place. Instead, schedule the window to be unmapped later; the call
+ * to EmbWinDelayedUnmap will be cancelled in the likely event that
+ * the unmap becomes unnecessary.
*/
- ewPtr->body.ew.displayed = 0;
- Tcl_DoWhenIdle(EmbWinDelayedUnmap, (ClientData) ewPtr);
+ client->displayed = 0;
+ Tcl_DoWhenIdle(EmbWinDelayedUnmap, (ClientData) client);
}
}
@@ -1026,17 +1192,16 @@ EmbWinUndisplayProc(textPtr, chunkPtr)
*
* EmbWinBboxProc --
*
- * This procedure is called to compute the bounding box of
- * the area occupied by an embedded window.
+ * This function is called to compute the bounding box of the area
+ * occupied by an embedded window.
*
* Results:
- * There is no return value. *xPtr and *yPtr are filled in
- * with the coordinates of the upper left corner of the
- * window, and *widthPtr and *heightPtr are filled in with
- * the dimensions of the window in pixels. Note: not all
- * of the returned bbox is necessarily visible on the screen
- * (the rightmost part might be off-screen to the right,
- * and the bottommost part might be off-screen to the bottom).
+ * There is no return value. *xPtr and *yPtr are filled in with the
+ * coordinates of the upper left corner of the window, and *widthPtr and
+ * *heightPtr are filled in with the dimensions of the window in pixels.
+ * Note: not all of the returned bbox is necessarily visible on the
+ * screen (the rightmost part might be off-screen to the right, and the
+ * bottommost part might be off-screen to the bottom).
*
* Side effects:
* None.
@@ -1045,27 +1210,32 @@ EmbWinUndisplayProc(textPtr, chunkPtr)
*/
static void
-EmbWinBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int index; /* Index of desired character within
- * the chunk. */
- int y; /* Topmost pixel in area allocated
- * for this line. */
- int lineHeight; /* Total height of line. */
- int baseline; /* Location of line's baseline, in
- * pixels measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of
- * character's upper-left pixel. */
- int *widthPtr; /* Gets filled in with width of
- * character, in pixels. */
- int *heightPtr; /* Gets filled in with height of
- * character, in pixels. */
+EmbWinBboxProc(
+ TkText *textPtr, /* Information about text widget. */
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int index, /* Index of desired character within the
+ * chunk. */
+ int y, /* Topmost pixel in area allocated for this
+ * line. */
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Location of line's baseline, in pixels
+ * measured down from y. */
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
+ * upper-left pixel. */
+ int *widthPtr, /* Gets filled in with width of window, in
+ * pixels. */
+ int *heightPtr) /* Gets filled in with height of window, in
+ * pixels. */
{
- TkTextSegment *ewPtr = (TkTextSegment *) chunkPtr->clientData;
Tk_Window tkwin;
+ TkTextSegment *ewPtr = (TkTextSegment *) chunkPtr->clientData;
+ TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
- tkwin = ewPtr->body.ew.tkwin;
+ if (client == NULL) {
+ tkwin = NULL;
+ } else {
+ tkwin = client->tkwin;
+ }
if (tkwin != NULL) {
*widthPtr = Tk_ReqWidth(tkwin);
*heightPtr = Tk_ReqHeight(tkwin);
@@ -1082,18 +1252,18 @@ EmbWinBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
}
}
switch (ewPtr->body.ew.align) {
- case ALIGN_BOTTOM:
- *yPtr = y + (lineHeight - *heightPtr - ewPtr->body.ew.padY);
- break;
- case ALIGN_CENTER:
- *yPtr = y + (lineHeight - *heightPtr)/2;
- break;
- case ALIGN_TOP:
- *yPtr = y + ewPtr->body.ew.padY;
- break;
- case ALIGN_BASELINE:
- *yPtr = y + (baseline - *heightPtr);
- break;
+ case ALIGN_BOTTOM:
+ *yPtr = y + (lineHeight - *heightPtr - ewPtr->body.ew.padY);
+ break;
+ case ALIGN_CENTER:
+ *yPtr = y + (lineHeight - *heightPtr)/2;
+ break;
+ case ALIGN_TOP:
+ *yPtr = y + ewPtr->body.ew.padY;
+ break;
+ case ALIGN_BASELINE:
+ *yPtr = y + (baseline - *heightPtr);
+ break;
}
}
@@ -1102,33 +1272,31 @@ EmbWinBboxProc(chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
*
* EmbWinDelayedUnmap --
*
- * This procedure is an idle handler that does the actual
- * work of unmapping an embedded window. See the comment
- * in EmbWinUndisplayProc for details.
+ * This function is an idle handler that does the actual work of
+ * unmapping an embedded window. See the comment in EmbWinUndisplayProc
+ * for details.
*
* Results:
* None.
*
* Side effects:
- * The window gets unmapped, unless its chunk reference count
- * has become non-zero again.
+ * The window gets unmapped, unless its chunk reference count has become
+ * non-zero again.
*
*--------------------------------------------------------------
*/
static void
-EmbWinDelayedUnmap(clientData)
- ClientData clientData; /* Token for the window to
- * be unmapped. */
+EmbWinDelayedUnmap(
+ ClientData clientData) /* Token for the window to be unmapped. */
{
- TkTextSegment *ewPtr = (TkTextSegment *) clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient*) clientData;
- if (!ewPtr->body.ew.displayed && (ewPtr->body.ew.tkwin != NULL)) {
- if (ewPtr->body.ew.textPtr->tkwin != Tk_Parent(ewPtr->body.ew.tkwin)) {
- Tk_UnmaintainGeometry(ewPtr->body.ew.tkwin,
- ewPtr->body.ew.textPtr->tkwin);
+ if (!client->displayed && (client->tkwin != NULL)) {
+ if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) {
+ Tk_UnmaintainGeometry(client->tkwin, client->textPtr->tkwin);
} else {
- Tk_UnmapWindow(ewPtr->body.ew.tkwin);
+ Tk_UnmapWindow(client->tkwin);
}
}
}
@@ -1138,14 +1306,13 @@ EmbWinDelayedUnmap(clientData)
*
* TkTextWindowIndex --
*
- * Given the name of an embedded window within a text widget,
- * returns an index corresponding to the window's position
- * in the text.
+ * Given the name of an embedded window within a text widget, returns an
+ * index corresponding to the window's position in the text.
*
* Results:
- * The return value is 1 if there is an embedded window by
- * the given name in the text widget, 0 otherwise. If the
- * window exists, *indexPtr is filled in with its index.
+ * The return value is 1 if there is an embedded window by the given name
+ * in the text widget, 0 otherwise. If the window exists, *indexPtr is
+ * filled in with its index.
*
* Side effects:
* None.
@@ -1154,21 +1321,70 @@ EmbWinDelayedUnmap(clientData)
*/
int
-TkTextWindowIndex(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget containing window. */
- CONST char *name; /* Name of window. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextWindowIndex(
+ TkText *textPtr, /* Text widget containing window. */
+ const char *name, /* Name of window. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
Tcl_HashEntry *hPtr;
TkTextSegment *ewPtr;
- hPtr = Tcl_FindHashEntry(&textPtr->windowTable, name);
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name);
if (hPtr == NULL) {
return 0;
}
+
ewPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
- indexPtr->tree = textPtr->tree;
+ indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = ewPtr->body.ew.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr);
return 1;
}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * EmbWinGetClient --
+ *
+ * Given a text widget and a segment which contains an embedded window,
+ * find the text-widget specific information about the embedded window,
+ * if any.
+ *
+ * This function performs a completely linear lookup for a matching data
+ * structure. If we envisage using this code with dozens of peer widgets,
+ * then performance could become an issue and a more sophisticated lookup
+ * mechanism might be desirable.
+ *
+ * Results:
+ * NULL if no widget-specific info exists, otherwise the structure is
+ * returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+static TkTextEmbWindowClient*
+EmbWinGetClient(
+ const TkText *textPtr, /* Information about text widget. */
+ TkTextSegment *ewPtr) /* Segment containing embedded window. */
+{
+ TkTextEmbWindowClient *client = ewPtr->body.ew.clients;
+
+ while (client != NULL) {
+ if (client->textPtr == textPtr) {
+ return client;
+ }
+ client = client->next;
+ }
+ return NULL;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTrig.c b/generic/tkTrig.c
index 1e90cf3..d7439b3 100644
--- a/generic/tkTrig.c
+++ b/generic/tkTrig.c
@@ -1,21 +1,19 @@
-/*
+/*
* tkTrig.c --
*
- * This file contains a collection of trigonometry utility
- * routines that are used by Tk and in particular by the
- * canvas code. It also has miscellaneous geometry functions
- * used by canvases.
+ * This file contains a collection of trigonometry utility routines that
+ * are used by Tk and in particular by the canvas code. It also has
+ * miscellaneous geometry functions used by canvases.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdio.h>
#include "tkInt.h"
-#include "tkPort.h"
#include "tkCanvas.h"
#undef MIN
@@ -34,9 +32,8 @@
* Compute the distance from a point to a finite line segment.
*
* Results:
- * The return value is the distance from the line segment
- * whose end-points are *end1Ptr and *end2Ptr to the point
- * given by *pointPtr.
+ * The return value is the distance from the line segment whose
+ * end-points are *end1Ptr and *end2Ptr to the point given by *pointPtr.
*
* Side effects:
* None.
@@ -45,17 +42,17 @@
*/
double
-TkLineToPoint(end1Ptr, end2Ptr, pointPtr)
- double end1Ptr[2]; /* Coordinates of first end-point of line. */
- double end2Ptr[2]; /* Coordinates of second end-point of line. */
- double pointPtr[2]; /* Points to coords for point. */
+TkLineToPoint(
+ double end1Ptr[2], /* Coordinates of first end-point of line. */
+ double end2Ptr[2], /* Coordinates of second end-point of line. */
+ double pointPtr[2]) /* Points to coords for point. */
{
double x, y;
/*
- * Compute the point on the line that is closest to the
- * point. This must be done separately for vertical edges,
- * horizontal edges, and other edges.
+ * Compute the point on the line that is closest to the point. This must
+ * be done separately for vertical edges, horizontal edges, and other
+ * edges.
*/
if (end1Ptr[0] == end2Ptr[0]) {
@@ -90,10 +87,10 @@ TkLineToPoint(end1Ptr, end2Ptr, pointPtr)
double m1, b1, m2, b2;
/*
- * The edge is neither horizontal nor vertical. Convert the
- * edge to a line equation of the form y = m1*x + b1. Then
- * compute a line perpendicular to this edge but passing
- * through the point, also in the form y = m2*x + b2.
+ * The edge is neither horizontal nor vertical. Convert the edge to a
+ * line equation of the form y = m1*x + b1. Then compute a line
+ * perpendicular to this edge but passing through the point, also in
+ * the form y = m2*x + b2.
*/
m1 = (end2Ptr[1] - end1Ptr[1])/(end2Ptr[0] - end1Ptr[0]);
@@ -133,14 +130,14 @@ TkLineToPoint(end1Ptr, end2Ptr, pointPtr)
*
* TkLineToArea --
*
- * Determine whether a line lies entirely inside, entirely
- * outside, or overlapping a given rectangular area.
+ * Determine whether a line lies entirely inside, entirely outside, or
+ * overlapping a given rectangular area.
*
* Results:
- * -1 is returned if the line given by end1Ptr and end2Ptr
- * is entirely outside the rectangle given by rectPtr. 0 is
- * returned if the polygon overlaps the rectangle, and 1 is
- * returned if the polygon is entirely inside the rectangle.
+ * -1 is returned if the line given by end1Ptr and end2Ptr is entirely
+ * outside the rectangle given by rectPtr. 0 is returned if the polygon
+ * overlaps the rectangle, and 1 is returned if the polygon is entirely
+ * inside the rectangle.
*
* Side effects:
* None.
@@ -149,20 +146,20 @@ TkLineToPoint(end1Ptr, end2Ptr, pointPtr)
*/
int
-TkLineToArea(end1Ptr, end2Ptr, rectPtr)
- double end1Ptr[2]; /* X and y coordinates for one endpoint
- * of line. */
- double end2Ptr[2]; /* X and y coordinates for other endpoint
- * of line. */
- double rectPtr[4]; /* Points to coords for rectangle, in the
- * order x1, y1, x2, y2. X1 must be no
- * larger than x2, and y1 no larger than y2. */
+TkLineToArea(
+ double end1Ptr[2], /* X and y coordinates for one endpoint of
+ * line. */
+ double end2Ptr[2], /* X and y coordinates for other endpoint of
+ * line. */
+ double rectPtr[4]) /* Points to coords for rectangle, in the
+ * order x1, y1, x2, y2. X1 must be no larger
+ * than x2, and y1 no larger than y2. */
{
int inside1, inside2;
/*
- * First check the two points individually to see whether they
- * are inside the rectangle or not.
+ * First check the two points individually to see whether they are inside
+ * the rectangle or not.
*/
inside1 = (end1Ptr[0] >= rectPtr[0]) && (end1Ptr[0] <= rectPtr[2])
@@ -177,17 +174,16 @@ TkLineToArea(end1Ptr, end2Ptr, rectPtr)
}
/*
- * Both points are outside the rectangle, but still need to check
- * for intersections between the line and the rectangle. Horizontal
- * and vertical lines are particularly easy, so handle them
- * separately.
+ * Both points are outside the rectangle, but still need to check for
+ * intersections between the line and the rectangle. Horizontal and
+ * vertical lines are particularly easy, so handle them separately.
*/
if (end1Ptr[0] == end2Ptr[0]) {
/*
* Vertical line.
*/
-
+
if (((end1Ptr[1] >= rectPtr[1]) ^ (end2Ptr[1] >= rectPtr[1]))
&& (end1Ptr[0] >= rectPtr[0])
&& (end1Ptr[0] <= rectPtr[2])) {
@@ -197,7 +193,7 @@ TkLineToArea(end1Ptr, end2Ptr, rectPtr)
/*
* Horizontal line.
*/
-
+
if (((end1Ptr[0] >= rectPtr[0]) ^ (end2Ptr[0] >= rectPtr[0]))
&& (end1Ptr[1] >= rectPtr[1])
&& (end1Ptr[1] <= rectPtr[3])) {
@@ -205,59 +201,63 @@ TkLineToArea(end1Ptr, end2Ptr, rectPtr)
}
} else {
double m, x, y, low, high;
-
+
/*
- * Diagonal line. Compute slope of line and use
- * for intersection checks against each of the
- * sides of the rectangle: left, right, bottom, top.
+ * Diagonal line. Compute slope of line and use for intersection
+ * checks against each of the sides of the rectangle: left, right,
+ * bottom, top.
*/
-
+
m = (end2Ptr[1] - end1Ptr[1])/(end2Ptr[0] - end1Ptr[0]);
if (end1Ptr[0] < end2Ptr[0]) {
- low = end1Ptr[0]; high = end2Ptr[0];
+ low = end1Ptr[0];
+ high = end2Ptr[0];
} else {
- low = end2Ptr[0]; high = end1Ptr[0];
+ low = end2Ptr[0];
+ high = end1Ptr[0];
}
-
+
/*
* Left edge.
*/
-
+
y = end1Ptr[1] + (rectPtr[0] - end1Ptr[0])*m;
if ((rectPtr[0] >= low) && (rectPtr[0] <= high)
&& (y >= rectPtr[1]) && (y <= rectPtr[3])) {
return 0;
}
-
+
/*
* Right edge.
*/
-
+
y += (rectPtr[2] - rectPtr[0])*m;
if ((y >= rectPtr[1]) && (y <= rectPtr[3])
&& (rectPtr[2] >= low) && (rectPtr[2] <= high)) {
return 0;
}
-
+
/*
* Bottom edge.
*/
-
+
if (end1Ptr[1] < end2Ptr[1]) {
- low = end1Ptr[1]; high = end2Ptr[1];
+ low = end1Ptr[1];
+ high = end2Ptr[1];
} else {
- low = end2Ptr[1]; high = end1Ptr[1];
+ low = end2Ptr[1];
+ high = end1Ptr[1];
}
x = end1Ptr[0] + (rectPtr[1] - end1Ptr[1])/m;
if ((x >= rectPtr[0]) && (x <= rectPtr[2])
&& (rectPtr[1] >= low) && (rectPtr[1] <= high)) {
return 0;
}
-
+
/*
* Top edge.
*/
-
+
x += (rectPtr[3] - rectPtr[1])/m;
if ((x >= rectPtr[0]) && (x <= rectPtr[2])
&& (rectPtr[3] >= low) && (rectPtr[3] <= high)) {
@@ -272,14 +272,13 @@ TkLineToArea(end1Ptr, end2Ptr, rectPtr)
*
* TkThickPolyLineToArea --
*
- * This procedure is called to determine whether a connected
- * series of line segments lies entirely inside, entirely
- * outside, or overlapping a given rectangular area.
+ * This function is called to determine whether a connected series of
+ * line segments lies entirely inside, entirely outside, or overlapping a
+ * given rectangular area.
*
* Results:
- * -1 is returned if the lines are entirely outside the area,
- * 0 if they overlap, and 1 if they are entirely inside the
- * given area.
+ * -1 is returned if the lines are entirely outside the area, 0 if they
+ * overlap, and 1 if they are entirely inside the given area.
*
* Side effects:
* None.
@@ -289,28 +288,27 @@ TkLineToArea(end1Ptr, end2Ptr, rectPtr)
/* ARGSUSED */
int
-TkThickPolyLineToArea(coordPtr, numPoints, width, capStyle, joinStyle, rectPtr)
- double *coordPtr; /* Points to an array of coordinates for
- * the polyline: x0, y0, x1, y1, ... */
- int numPoints; /* Total number of points at *coordPtr. */
- double width; /* Width of each line segment. */
- int capStyle; /* How are end-points of polyline drawn?
+TkThickPolyLineToArea(
+ double *coordPtr, /* Points to an array of coordinates for the
+ * polyline: x0, y0, x1, y1, ... */
+ int numPoints, /* Total number of points at *coordPtr. */
+ double width, /* Width of each line segment. */
+ int capStyle, /* How are end-points of polyline drawn?
* CapRound, CapButt, or CapProjecting. */
- int joinStyle; /* How are joints in polyline drawn?
+ int joinStyle, /* How are joints in polyline drawn?
* JoinMiter, JoinRound, or JoinBevel. */
- double *rectPtr; /* Rectangular area to check against. */
+ double *rectPtr) /* Rectangular area to check against. */
{
double radius, poly[10];
int count;
- int changedMiterToBevel; /* Non-zero means that a mitered corner
- * had to be treated as beveled after all
- * because the angle was < 11 degrees. */
- int inside; /* Tentative guess about what to return,
- * based on all points seen so far: one
- * means everything seen so far was
- * inside the area; -1 means everything
- * was outside the area. 0 means overlap
- * has been found. */
+ int changedMiterToBevel; /* Non-zero means that a mitered corner had to
+ * be treated as beveled after all because the
+ * angle was < 11 degrees. */
+ int inside; /* Tentative guess about what to return, based
+ * on all points seen so far: one means
+ * everything seen so far was inside the area;
+ * -1 means everything was outside the area.
+ * 0 means overlap has been found. */
radius = width/2.0;
inside = -1;
@@ -321,19 +319,16 @@ TkThickPolyLineToArea(coordPtr, numPoints, width, capStyle, joinStyle, rectPtr)
}
/*
- * Iterate through all of the edges of the line, computing a polygon
- * for each edge and testing the area against that polygon. In
- * addition, there are additional tests to deal with rounded joints
- * and caps.
+ * Iterate through all of the edges of the line, computing a polygon for
+ * each edge and testing the area against that polygon. In addition, there
+ * are additional tests to deal with rounded joints and caps.
*/
changedMiterToBevel = 0;
for (count = numPoints; count >= 2; count--, coordPtr += 2) {
-
/*
- * If rounding is done around the first point of the edge
- * then test a circular region around the point with the
- * area.
+ * If rounding is done around the first point of the edge then test a
+ * circular region around the point with the area.
*/
if (((capStyle == CapRound) && (count == numPoints))
@@ -348,9 +343,9 @@ TkThickPolyLineToArea(coordPtr, numPoints, width, capStyle, joinStyle, rectPtr)
}
/*
- * Compute the polygonal shape corresponding to this edge,
- * consisting of two points for the first point of the edge
- * and two points for the last point of the edge.
+ * Compute the polygonal shape corresponding to this edge, consisting
+ * of two points for the first point of the edge and two points for
+ * the last point of the edge.
*/
if (count == numPoints) {
@@ -365,10 +360,10 @@ TkThickPolyLineToArea(coordPtr, numPoints, width, capStyle, joinStyle, rectPtr)
TkGetButtPoints(coordPtr+2, coordPtr, width, 0, poly, poly+2);
/*
- * If the last joint was beveled, then also check a
- * polygon comprising the last two points of the previous
- * polygon and the first two from this polygon; this checks
- * the wedges that fill the beveled joint.
+ * If the last joint was beveled, then also check a polygon
+ * comprising the last two points of the previous polygon and the
+ * first two from this polygon; this checks the wedges that fill
+ * the beveled joint.
*/
if ((joinStyle == JoinBevel) || changedMiterToBevel) {
@@ -401,8 +396,7 @@ TkThickPolyLineToArea(coordPtr, numPoints, width, capStyle, joinStyle, rectPtr)
}
/*
- * If caps are rounded, check the cap around the final point
- * of the line.
+ * If caps are rounded, check the cap around the final point of the line.
*/
if (capStyle == CapRound) {
@@ -426,10 +420,9 @@ TkThickPolyLineToArea(coordPtr, numPoints, width, capStyle, joinStyle, rectPtr)
* Compute the distance from a point to a polygon.
*
* Results:
- * The return value is 0.0 if the point referred to by
- * pointPtr is within the polygon referred to by polyPtr
- * and numPoints. Otherwise the return value is the
- * distance of the point from the polygon.
+ * The return value is 0.0 if the point referred to by pointPtr is within
+ * the polygon referred to by polyPtr and numPoints. Otherwise the return
+ * value is the distance of the point from the polygon.
*
* Side effects:
* None.
@@ -438,15 +431,15 @@ TkThickPolyLineToArea(coordPtr, numPoints, width, capStyle, joinStyle, rectPtr)
*/
double
-TkPolygonToPoint(polyPtr, numPoints, pointPtr)
- double *polyPtr; /* Points to an array coordinates for
- * closed polygon: x0, y0, x1, y1, ...
- * The polygon may be self-intersecting. */
- int numPoints; /* Total number of points at *polyPtr. */
- double *pointPtr; /* Points to coords for point. */
+TkPolygonToPoint(
+ double *polyPtr, /* Points to an array coordinates for closed
+ * polygon: x0, y0, x1, y1, ... The polygon
+ * may be self-intersecting. */
+ int numPoints, /* Total number of points at *polyPtr. */
+ double *pointPtr) /* Points to coords for point. */
{
- double bestDist; /* Closest distance between point and
- * any edge in polygon. */
+ double bestDist; /* Closest distance between point and any edge
+ * in polygon. */
int intersections; /* Number of edges in the polygon that
* intersect a ray extending vertically
* upwards from the point to infinity. */
@@ -454,13 +447,12 @@ TkPolygonToPoint(polyPtr, numPoints, pointPtr)
register double *pPtr;
/*
- * Iterate through all of the edges in the polygon, updating
- * bestDist and intersections.
+ * Iterate through all of the edges in the polygon, updating bestDist and
+ * intersections.
*
- * TRICKY POINT: when computing intersections, include left
- * x-coordinate of line within its range, but not y-coordinate.
- * Otherwise if the point lies exactly below a vertex we'll
- * count it as two intersections.
+ * TRICKY POINT: when computing intersections, include left x-coordinate
+ * of line within its range, but not y-coordinate. Otherwise if the point
+ * lies exactly below a vertex we'll count it as two intersections.
*/
bestDist = 1.0e36;
@@ -470,10 +462,9 @@ TkPolygonToPoint(polyPtr, numPoints, pointPtr)
double x, y, dist;
/*
- * Compute the point on the current edge closest to the point
- * and update the intersection count. This must be done
- * separately for vertical edges, horizontal edges, and
- * other edges.
+ * Compute the point on the current edge closest to the point and
+ * update the intersection count. This must be done separately for
+ * vertical edges, horizontal edges, and other edges.
*/
if (pPtr[2] == pPtr[0]) {
@@ -514,13 +505,13 @@ TkPolygonToPoint(polyPtr, numPoints, pointPtr)
}
} else {
double m1, b1, m2, b2;
- int lower; /* Non-zero means point below line. */
+ int lower; /* Non-zero means point below line. */
/*
- * The edge is neither horizontal nor vertical. Convert the
- * edge to a line equation of the form y = m1*x + b1. Then
- * compute a line perpendicular to this edge but passing
- * through the point, also in the form y = m2*x + b2.
+ * The edge is neither horizontal nor vertical. Convert the edge
+ * to a line equation of the form y = m1*x + b1. Then compute a
+ * line perpendicular to this edge but passing through the point,
+ * also in the form y = m2*x + b2.
*/
m1 = (pPtr[3] - pPtr[1])/(pPtr[2] - pPtr[0]);
@@ -554,8 +545,8 @@ TkPolygonToPoint(polyPtr, numPoints, pointPtr)
}
/*
- * Compute the distance to the closest point, and see if that
- * is the best distance seen so far.
+ * Compute the distance to the closest point, and see if that is the
+ * best distance seen so far.
*/
dist = hypot(pointPtr[0] - x, pointPtr[1] - y);
@@ -565,8 +556,8 @@ TkPolygonToPoint(polyPtr, numPoints, pointPtr)
}
/*
- * We've processed all of the points. If the number of intersections
- * is odd, the point is inside the polygon.
+ * We've processed all of the points. If the number of intersections is
+ * odd, the point is inside the polygon.
*/
if (intersections & 0x1) {
@@ -580,14 +571,14 @@ TkPolygonToPoint(polyPtr, numPoints, pointPtr)
*
* TkPolygonToArea --
*
- * Determine whether a polygon lies entirely inside, entirely
- * outside, or overlapping a given rectangular area.
+ * Determine whether a polygon lies entirely inside, entirely outside, or
+ * overlapping a given rectangular area.
*
* Results:
- * -1 is returned if the polygon given by polyPtr and numPoints
- * is entirely outside the rectangle given by rectPtr. 0 is
- * returned if the polygon overlaps the rectangle, and 1 is
- * returned if the polygon is entirely inside the rectangle.
+ * -1 is returned if the polygon given by polyPtr and numPoints is
+ * entirely outside the rectangle given by rectPtr. 0 is returned if the
+ * polygon overlaps the rectangle, and 1 is returned if the polygon is
+ * entirely inside the rectangle.
*
* Side effects:
* None.
@@ -596,14 +587,14 @@ TkPolygonToPoint(polyPtr, numPoints, pointPtr)
*/
int
-TkPolygonToArea(polyPtr, numPoints, rectPtr)
- double *polyPtr; /* Points to an array coordinates for
- * closed polygon: x0, y0, x1, y1, ...
- * The polygon may be self-intersecting. */
- int numPoints; /* Total number of points at *polyPtr. */
- register double *rectPtr; /* Points to coords for rectangle, in the
- * order x1, y1, x2, y2. X1 and y1 must
- * be lower-left corner. */
+TkPolygonToArea(
+ double *polyPtr, /* Points to an array coordinates for closed
+ * polygon: x0, y0, x1, y1, ... The polygon
+ * may be self-intersecting. */
+ int numPoints, /* Total number of points at *polyPtr. */
+ register double *rectPtr) /* Points to coords for rectangle, in the
+ * order x1, y1, x2, y2. X1 and y1 must be
+ * lower-left corner. */
{
int state; /* State of all edges seen so far (-1 means
* outside, 1 means inside, won't ever be
@@ -612,9 +603,8 @@ TkPolygonToArea(polyPtr, numPoints, rectPtr)
register double *pPtr;
/*
- * Iterate over all of the edges of the polygon and test them
- * against the rectangle. Can quit as soon as the state becomes
- * "intersecting".
+ * Iterate over all of the edges of the polygon and test them against the
+ * rectangle. Can quit as soon as the state becomes "intersecting".
*/
state = TkLineToArea(polyPtr, polyPtr+2, rectPtr);
@@ -629,10 +619,10 @@ TkPolygonToArea(polyPtr, numPoints, rectPtr)
}
/*
- * If all of the edges were inside the rectangle we're done.
- * If all of the edges were outside, then the rectangle could
- * still intersect the polygon (if it's entirely enclosed).
- * Call TkPolygonToPoint to figure this out.
+ * If all of the edges were inside the rectangle we're done. If all of the
+ * edges were outside, then the rectangle could still intersect the
+ * polygon (if it's entirely enclosed). Call TkPolygonToPoint to figure
+ * this out.
*/
if (state == 1) {
@@ -649,17 +639,16 @@ TkPolygonToArea(polyPtr, numPoints, rectPtr)
*
* TkOvalToPoint --
*
- * Computes the distance from a given point to a given
- * oval, in canvas units.
+ * Computes the distance from a given point to a given oval, in canvas
+ * units.
*
* Results:
- * The return value is 0 if the point given by *pointPtr is
- * inside the oval. If the point isn't inside the
- * oval then the return value is approximately the distance
- * from the point to the oval. If the oval is filled, then
- * anywhere in the interior is considered "inside"; if
- * the oval isn't filled, then "inside" means only the area
- * occupied by the outline.
+ * The return value is 0 if the point given by *pointPtr is inside the
+ * oval. If the point isn't inside the oval then the return value is
+ * approximately the distance from the point to the oval. If the oval is
+ * filled, then anywhere in the interior is considered "inside"; if the
+ * oval isn't filled, then "inside" means only the area occupied by the
+ * outline.
*
* Side effects:
* None.
@@ -669,22 +658,23 @@ TkPolygonToArea(polyPtr, numPoints, rectPtr)
/* ARGSUSED */
double
-TkOvalToPoint(ovalPtr, width, filled, pointPtr)
- double ovalPtr[4]; /* Pointer to array of four coordinates
- * (x1, y1, x2, y2) defining oval's bounding
+TkOvalToPoint(
+ double ovalPtr[4], /* Pointer to array of four coordinates (x1,
+ * y1, x2, y2) defining oval's bounding
* box. */
- double width; /* Width of outline for oval. */
- int filled; /* Non-zero means oval should be treated as
- * filled; zero means only consider outline. */
- double pointPtr[2]; /* Coordinates of point. */
+ double width, /* Width of outline for oval. */
+ int filled, /* Non-zero means oval should be treated as
+ * filled; zero means only consider
+ * outline. */
+ double pointPtr[2]) /* Coordinates of point. */
{
double xDelta, yDelta, scaledDistance, distToOutline, distToCenter;
double xDiam, yDiam;
/*
- * Compute the distance between the center of the oval and the
- * point in question, using a coordinate system where the oval
- * has been transformed to a circle with unit radius.
+ * Compute the distance between the center of the oval and the point in
+ * question, using a coordinate system where the oval has been transformed
+ * to a circle with unit radius.
*/
xDelta = (pointPtr[0] - (ovalPtr[0] + ovalPtr[2])/2.0);
@@ -693,16 +683,14 @@ TkOvalToPoint(ovalPtr, width, filled, pointPtr)
scaledDistance = hypot(xDelta / ((ovalPtr[2] + width - ovalPtr[0])/2.0),
yDelta / ((ovalPtr[3] + width - ovalPtr[1])/2.0));
-
/*
- * If the scaled distance is greater than 1 then it means no
- * hit. Compute the distance from the point to the edge of
- * the circle, then scale this distance back to the original
- * coordinate system.
+ * If the scaled distance is greater than 1 then it means no hit. Compute
+ * the distance from the point to the edge of the circle, then scale this
+ * distance back to the original coordinate system.
*
- * Note: this distance isn't completely accurate. It's only
- * an approximation, and it can overestimate the correct
- * distance when the oval is eccentric.
+ * Note: this distance isn't completely accurate. It's only an
+ * approximation, and it can overestimate the correct distance when the
+ * oval is eccentric.
*/
if (scaledDistance > 1.0) {
@@ -710,11 +698,11 @@ TkOvalToPoint(ovalPtr, width, filled, pointPtr)
}
/*
- * Scaled distance less than 1 means the point is inside the
- * outer edge of the oval. If this is a filled oval, then we
- * have a hit. Otherwise, do the same computation as above
- * (scale back to original coordinate system), but also check
- * to see if the point is within the width of the outline.
+ * Scaled distance less than 1 means the point is inside the outer edge of
+ * the oval. If this is a filled oval, then we have a hit. Otherwise, do
+ * the same computation as above (scale back to original coordinate
+ * system), but also check to see if the point is within the width of the
+ * outline.
*/
if (filled) {
@@ -725,9 +713,9 @@ TkOvalToPoint(ovalPtr, width, filled, pointPtr)
- width;
} else {
/*
- * Avoid dividing by a very small number (it could cause an
- * arithmetic overflow). This problem occurs if the point is
- * very close to the center of the oval.
+ * Avoid dividing by a very small number (it could cause an arithmetic
+ * overflow). This problem occurs if the point is very close to the
+ * center of the oval.
*/
xDiam = ovalPtr[2] - ovalPtr[0];
@@ -750,14 +738,14 @@ TkOvalToPoint(ovalPtr, width, filled, pointPtr)
*
* TkOvalToArea --
*
- * Determine whether an oval lies entirely inside, entirely
- * outside, or overlapping a given rectangular area.
+ * Determine whether an oval lies entirely inside, entirely outside, or
+ * overlapping a given rectangular area.
*
* Results:
- * -1 is returned if the oval described by ovalPtr is entirely
- * outside the rectangle given by rectPtr. 0 is returned if the
- * oval overlaps the rectangle, and 1 is returned if the oval
- * is entirely inside the rectangle.
+ * -1 is returned if the oval described by ovalPtr is entirely outside
+ * the rectangle given by rectPtr. 0 is returned if the oval overlaps the
+ * rectangle, and 1 is returned if the oval is entirely inside the
+ * rectangle.
*
* Side effects:
* None.
@@ -766,20 +754,20 @@ TkOvalToPoint(ovalPtr, width, filled, pointPtr)
*/
int
-TkOvalToArea(ovalPtr, rectPtr)
- register double *ovalPtr; /* Points to coordinates definining the
+TkOvalToArea(
+ register double *ovalPtr, /* Points to coordinates definining the
* bounding rectangle for the oval: x1, y1,
- * x2, y2. X1 must be less than x2 and y1
- * less than y2. */
- register double *rectPtr; /* Points to coords for rectangle, in the
- * order x1, y1, x2, y2. X1 and y1 must
- * be lower-left corner. */
+ * x2, y2. X1 must be less than x2 and y1 less
+ * than y2. */
+ register double *rectPtr) /* Points to coords for rectangle, in the
+ * order x1, y1, x2, y2. X1 and y1 must be
+ * lower-left corner. */
{
double centerX, centerY, radX, radY, deltaX, deltaY;
/*
- * First, see if oval is entirely inside rectangle or entirely
- * outside rectangle.
+ * First, see if oval is entirely inside rectangle or entirely outside
+ * rectangle.
*/
if ((rectPtr[0] <= ovalPtr[0]) && (rectPtr[2] >= ovalPtr[2])
@@ -792,11 +780,10 @@ TkOvalToArea(ovalPtr, rectPtr)
}
/*
- * Next, go through the rectangle side by side. For each side
- * of the rectangle, find the point on the side that is closest
- * to the oval's center, and see if that point is inside the
- * oval. If at least one such point is inside the oval, then
- * the rectangle intersects the oval.
+ * Next, go through the rectangle side by side. For each side of the
+ * rectangle, find the point on the side that is closest to the oval's
+ * center, and see if that point is inside the oval. If at least one such
+ * point is inside the oval, then the rectangle intersects the oval.
*/
centerX = (ovalPtr[0] + ovalPtr[2])/2;
@@ -872,8 +859,8 @@ TkOvalToArea(ovalPtr, rectPtr)
*
* TkIncludePoint --
*
- * Given a point and a generic canvas item header, expand
- * the item's bounding box if needed to include the point.
+ * Given a point and a generic canvas item header, expand the item's
+ * bounding box if needed to include the point.
*
* Results:
* None.
@@ -886,11 +873,11 @@ TkOvalToArea(ovalPtr, rectPtr)
/* ARGSUSED */
void
-TkIncludePoint(itemPtr, pointPtr)
- register Tk_Item *itemPtr; /* Item whose bounding box is
- * being calculated. */
- double *pointPtr; /* Address of two doubles giving
- * x and y coordinates of point. */
+TkIncludePoint(
+ register Tk_Item *itemPtr, /* Item whose bounding box is being
+ * calculated. */
+ double *pointPtr) /* Address of two doubles giving x and y
+ * coordinates of point. */
{
int tmp;
@@ -915,15 +902,14 @@ TkIncludePoint(itemPtr, pointPtr)
*
* TkBezierScreenPoints --
*
- * Given four control points, create a larger set of XPoints
- * for a Bezier spline based on the points.
+ * Given four control points, create a larger set of XPoints for a Bezier
+ * curve based on the points.
*
* Results:
* The array at *xPointPtr gets filled in with numSteps XPoints
- * corresponding to the Bezier spline defined by the four
- * control points. Note: no output point is generated for the
- * first input point, but an output point *is* generated for
- * the last input point.
+ * corresponding to the Bezier spline defined by the four control points.
+ * Note: no output point is generated for the first input point, but an
+ * output point *is* generated for the last input point.
*
* Side effects:
* None.
@@ -932,15 +918,12 @@ TkIncludePoint(itemPtr, pointPtr)
*/
void
-TkBezierScreenPoints(canvas, control, numSteps, xPointPtr)
- Tk_Canvas canvas; /* Canvas in which curve is to be
- * drawn. */
- double control[]; /* Array of coordinates for four
- * control points: x0, y0, x1, y1,
- * ... x3 y3. */
- int numSteps; /* Number of curve points to
- * generate. */
- register XPoint *xPointPtr; /* Where to put new points. */
+TkBezierScreenPoints(
+ Tk_Canvas canvas, /* Canvas in which curve is to be drawn. */
+ double control[], /* Array of coordinates for four control
+ * points: x0, y0, x1, y1, ... x3 y3. */
+ int numSteps, /* Number of curve points to generate. */
+ register XPoint *xPointPtr) /* Where to put new points. */
{
int i;
double u, u2, u3, t, t2, t3;
@@ -966,15 +949,14 @@ TkBezierScreenPoints(canvas, control, numSteps, xPointPtr)
*
* TkBezierPoints --
*
- * Given four control points, create a larger set of points
- * for a Bezier spline based on the points.
+ * Given four control points, create a larger set of points for a Bezier
+ * curve based on the points.
*
* Results:
- * The array at *coordPtr gets filled in with 2*numSteps
- * coordinates, which correspond to the Bezier spline defined
- * by the four control points. Note: no output point is
- * generated for the first input point, but an output point
- * *is* generated for the last input point.
+ * The array at *coordPtr gets filled in with 2*numSteps coordinates,
+ * which correspond to the Bezier spline defined by the four control
+ * points. Note: no output point is generated for the first input point,
+ * but an output point *is* generated for the last input point.
*
* Side effects:
* None.
@@ -983,13 +965,11 @@ TkBezierScreenPoints(canvas, control, numSteps, xPointPtr)
*/
void
-TkBezierPoints(control, numSteps, coordPtr)
- double control[]; /* Array of coordinates for four
- * control points: x0, y0, x1, y1,
- * ... x3 y3. */
- int numSteps; /* Number of curve points to
- * generate. */
- register double *coordPtr; /* Where to put new points. */
+TkBezierPoints(
+ double control[], /* Array of coordinates for four control
+ * points: x0, y0, x1, y1, ... x3 y3. */
+ int numSteps, /* Number of curve points to generate. */
+ register double *coordPtr) /* Where to put new points. */
{
int i;
double u, u2, u3, t, t2, t3;
@@ -1013,20 +993,21 @@ TkBezierPoints(control, numSteps, coordPtr)
*
* TkMakeBezierCurve --
*
- * Given a set of points, create a new set of points that fit
- * parabolic splines to the line segments connecting the original
- * points. Produces output points in either of two forms.
+ * Given a set of points, create a new set of points that fit parabolic
+ * splines to the line segments connecting the original points. Produces
+ * output points in either of two forms.
*
- * Note: in spite of this procedure's name, it does *not* generate
- * Bezier curves. Since only three control points are used for
- * each curve segment, not four, the curves are actually just
- * parabolic.
+ * Note: the name of this function should *not* be taken to mean that it
+ * interprets the input points as directly defining Bezier curves.
+ * Rather, it internally computes a Bezier curve representation of each
+ * parabolic spline segment. (These Bezier curves are then flattened to
+ * produce the points filled into the output arrays.)
*
* Results:
- * Either or both of the xPoints or dblPoints arrays are filled
- * in. The return value is the number of points placed in the
- * arrays. Note: if the first and last points are the same, then
- * a closed curve is generated.
+ * Either or both of the xPoints or dblPoints arrays are filled in. The
+ * return value is the number of points placed in the arrays. Note: if
+ * the first and last points are the same, then a closed curve is
+ * generated.
*
* Side effects:
* None.
@@ -1035,40 +1016,40 @@ TkBezierPoints(control, numSteps, coordPtr)
*/
int
-TkMakeBezierCurve(canvas, pointPtr, numPoints, numSteps, xPoints, dblPoints)
- Tk_Canvas canvas; /* Canvas in which curve is to be
- * drawn. */
- double *pointPtr; /* Array of input coordinates: x0,
- * y0, x1, y1, etc.. */
- int numPoints; /* Number of points at pointPtr. */
- int numSteps; /* Number of steps to use for each
- * spline segments (determines
- * smoothness of curve). */
- XPoint xPoints[]; /* Array of XPoints to fill in (e.g.
- * for display. NULL means don't
- * fill in any XPoints. */
- double dblPoints[]; /* Array of points to fill in as
- * doubles, in the form x0, y0,
- * x1, y1, .... NULL means don't
- * fill in anything in this form.
- * Caller must make sure that this
- * array has enough space. */
+TkMakeBezierCurve(
+ Tk_Canvas canvas, /* Canvas in which curve is to be drawn. */
+ double *pointPtr, /* Array of input coordinates: x0, y0, x1, y1,
+ * etc.. */
+ int numPoints, /* Number of points at pointPtr. */
+ int numSteps, /* Number of steps to use for each spline
+ * segments (determines smoothness of
+ * curve). */
+ XPoint xPoints[], /* Array of XPoints to fill in (e.g. for
+ * display). NULL means don't fill in any
+ * XPoints. */
+ double dblPoints[]) /* Array of points to fill in as doubles, in
+ * the form x0, y0, x1, y1, .... NULL means
+ * don't fill in anything in this form. Caller
+ * must make sure that this array has enough
+ * space. */
{
int closed, outputPoints, i;
int numCoords = numPoints*2;
double control[8];
/*
- * If the curve is a closed one then generate a special spline
- * that spans the last points and the first ones. Otherwise
- * just put the first point into the output.
+ * If the curve is a closed one then generate a special spline that spans
+ * the last points and the first ones. Otherwise just put the first point
+ * into the output.
*/
if (!pointPtr) {
- /* Of pointPtr == NULL, this function returns an upper limit.
- * of the array size to store the coordinates. This can be
- * used to allocate storage, before the actual coordinates
- * are calculated. */
+ /*
+ * Of pointPtr == NULL, this function returns an upper limit of the
+ * array size to store the coordinates. This can be used to allocate
+ * storage, before the actual coordinates are calculated.
+ */
+
return 1 + numPoints * numSteps;
}
@@ -1114,9 +1095,8 @@ TkMakeBezierCurve(canvas, pointPtr, numPoints, numSteps, xPoints, dblPoints)
for (i = 2; i < numPoints; i++, pointPtr += 2) {
/*
- * Set up the first two control points. This is done
- * differently for the first spline of an open curve
- * than for other cases.
+ * Set up the first two control points. This is done differently for
+ * the first spline of an open curve than for other cases.
*/
if ((i == 2) && !closed) {
@@ -1132,9 +1112,8 @@ TkMakeBezierCurve(canvas, pointPtr, numPoints, numSteps, xPoints, dblPoints)
}
/*
- * Set up the last two control points. This is done
- * differently for the last spline of an open curve
- * than for other cases.
+ * Set up the last two control points. This is done differently for
+ * the last spline of an open curve than for other cases.
*/
if ((i == (numPoints-1)) && !closed) {
@@ -1150,10 +1129,9 @@ TkMakeBezierCurve(canvas, pointPtr, numPoints, numSteps, xPoints, dblPoints)
}
/*
- * If the first two points coincide, or if the last
- * two points coincide, then generate a single
- * straight-line segment by outputting the last control
- * point.
+ * If the first two points coincide, or if the last two points
+ * coincide, then generate a single straight-line segment by
+ * outputting the last control point.
*/
if (((pointPtr[0] == pointPtr[2]) && (pointPtr[1] == pointPtr[3]))
@@ -1194,14 +1172,193 @@ TkMakeBezierCurve(canvas, pointPtr, numPoints, numSteps, xPoints, dblPoints)
/*
*--------------------------------------------------------------
*
+ * TkMakeRawCurve --
+ *
+ * Interpret the given set of points as the raw knots and control points
+ * defining a sequence of cubic Bezier curves. Create a new set of points
+ * that fit these Bezier curves. Output points are produced in either of
+ * two forms.
+ *
+ * Results:
+ * Either or both of the xPoints or dblPoints arrays are filled in. The
+ * return value is the number of points placed in the arrays.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+TkMakeRawCurve(
+ Tk_Canvas canvas, /* Canvas in which curve is to be drawn. */
+ double *pointPtr, /* Array of input coordinates: x0, y0, x1, y1,
+ * etc.. */
+ int numPoints, /* Number of points at pointPtr. */
+ int numSteps, /* Number of steps to use for each curve
+ * segment (determines smoothness of
+ * curve). */
+ XPoint xPoints[], /* Array of XPoints to fill in (e.g. for
+ * display). NULL means don't fill in any
+ * XPoints. */
+ double dblPoints[]) /* Array of points to fill in as doubles, in
+ * the form x0, y0, x1, y1, .... NULL means
+ * don't fill in anything in this form.
+ * Caller must make sure that this array has
+ * enough space. */
+{
+ int outputPoints, i;
+ int numSegments = (numPoints+1)/3;
+ double *segPtr;
+
+ /*
+ * The input describes a curve with s Bezier curve segments if there are
+ * 3s+1, 3s, or 3s-1 input points. In the last two cases, 1 or 2 initial
+ * points from the first curve segment are reused as defining points also
+ * for the last curve segment. In the case of 3s input points, this will
+ * automatically close the curve.
+ */
+
+ if (!pointPtr) {
+ /*
+ * If pointPtr == NULL, this function returns an upper limit of the
+ * array size to store the coordinates. This can be used to allocate
+ * storage, before the actual coordinates are calculated.
+ */
+
+ return 1 + numSegments * numSteps;
+ }
+
+ outputPoints = 0;
+ if (xPoints != NULL) {
+ Tk_CanvasDrawableCoords(canvas, pointPtr[0], pointPtr[1],
+ &xPoints->x, &xPoints->y);
+ xPoints += 1;
+ }
+ if (dblPoints != NULL) {
+ dblPoints[0] = pointPtr[0];
+ dblPoints[1] = pointPtr[1];
+ dblPoints += 2;
+ }
+ outputPoints += 1;
+
+ /*
+ * The next loop handles all curve segments except one that overlaps the
+ * end of the list of coordinates.
+ */
+
+ for (i=numPoints,segPtr=pointPtr ; i>=4 ; i-=3,segPtr+=6) {
+ if (segPtr[0]==segPtr[2] && segPtr[1]==segPtr[3] &&
+ segPtr[4]==segPtr[6] && segPtr[5]==segPtr[7]) {
+ /*
+ * The control points on this segment are equal to their
+ * neighbouring knots, so this segment is just a straight line. A
+ * single point is sufficient.
+ */
+
+ if (xPoints != NULL) {
+ Tk_CanvasDrawableCoords(canvas, segPtr[6], segPtr[7],
+ &xPoints->x, &xPoints->y);
+ xPoints += 1;
+ }
+ if (dblPoints != NULL) {
+ dblPoints[0] = segPtr[6];
+ dblPoints[1] = segPtr[7];
+ dblPoints += 2;
+ }
+ outputPoints += 1;
+ } else {
+ /*
+ * This is a generic Bezier curve segment.
+ */
+
+ if (xPoints != NULL) {
+ TkBezierScreenPoints(canvas, segPtr, numSteps, xPoints);
+ xPoints += numSteps;
+ }
+ if (dblPoints != NULL) {
+ TkBezierPoints(segPtr, numSteps, dblPoints);
+ dblPoints += 2*numSteps;
+ }
+ outputPoints += numSteps;
+ }
+ }
+
+ /*
+ * If at this point i>1, then there is some point which has not yet been
+ * used. Make another curve segment.
+ */
+
+ if (i > 1) {
+ int j;
+ double control[8];
+
+ /*
+ * Copy the relevant coordinates to control[], so that it can be
+ * passed as a unit to e.g. TkBezierPoints.
+ */
+
+ for (j=0; j<2*i; j++) {
+ control[j] = segPtr[j];
+ }
+ for (; j<8; j++) {
+ control[j] = pointPtr[j-2*i];
+ }
+
+ /*
+ * Then we just do the same things as above.
+ */
+
+ if (control[0]==control[2] && control[1]==control[3] &&
+ control[4]==control[6] && control[5]==control[7]) {
+ /*
+ * The control points on this segment are equal to their
+ * neighbouring knots, so this segment is just a straight line. A
+ * single point is sufficient.
+ */
+
+ if (xPoints != NULL) {
+ Tk_CanvasDrawableCoords(canvas, control[6], control[7],
+ &xPoints->x, &xPoints->y);
+ xPoints += 1;
+ }
+ if (dblPoints != NULL) {
+ dblPoints[0] = control[6];
+ dblPoints[1] = control[7];
+ dblPoints += 2;
+ }
+ outputPoints += 1;
+ } else {
+ /*
+ * This is a generic Bezier curve segment.
+ */
+
+ if (xPoints != NULL) {
+ TkBezierScreenPoints(canvas, control, numSteps, xPoints);
+ xPoints += numSteps;
+ }
+ if (dblPoints != NULL) {
+ TkBezierPoints(control, numSteps, dblPoints);
+ dblPoints += 2*numSteps;
+ }
+ outputPoints += numSteps;
+ }
+ }
+
+ return outputPoints;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* TkMakeBezierPostscript --
*
- * This procedure generates Postscript commands that create
- * a path corresponding to a given Bezier curve.
+ * This function generates Postscript commands that create a path
+ * corresponding to a given Bezier curve.
*
* Results:
- * None. Postscript commands to generate the path are appended
- * to the interp's result.
+ * None. Postscript commands to generate the path are appended to the
+ * interp's result.
*
* Side effects:
* None.
@@ -1210,14 +1367,14 @@ TkMakeBezierCurve(canvas, pointPtr, numPoints, numSteps, xPoints, dblPoints)
*/
void
-TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints)
- Tcl_Interp *interp; /* Interpreter in whose result the
- * Postscript is to be stored. */
- Tk_Canvas canvas; /* Canvas widget for which the
- * Postscript is being generated. */
- double *pointPtr; /* Array of input coordinates: x0,
- * y0, x1, y1, etc.. */
- int numPoints; /* Number of points at pointPtr. */
+TkMakeBezierPostscript(
+ Tcl_Interp *interp, /* Interpreter in whose result the Postscript
+ * is to be stored. */
+ Tk_Canvas canvas, /* Canvas widget for which the Postscript is
+ * being generated. */
+ double *pointPtr, /* Array of input coordinates: x0, y0, x1, y1,
+ * etc.. */
+ int numPoints) /* Number of points at pointPtr. */
{
int closed, i;
int numCoords = numPoints*2;
@@ -1225,9 +1382,9 @@ TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints)
char buffer[200];
/*
- * If the curve is a closed one then generate a special spline
- * that spans the last points and the first ones. Otherwise
- * just put the first point into the path.
+ * If the curve is a closed one then generate a special spline that spans
+ * the last points and the first ones. Otherwise just put the first point
+ * into the path.
*/
if ((pointPtr[0] == pointPtr[numCoords-2])
@@ -1253,11 +1410,11 @@ TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints)
sprintf(buffer, "%.15g %.15g moveto\n",
control[6], Tk_CanvasPsY(canvas, control[7]));
}
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
/*
- * Cycle through all the remaining points in the curve, generating
- * a curve section for each vertex in the linear path.
+ * Cycle through all the remaining points in the curve, generating a curve
+ * section for each vertex in the linear path.
*/
for (i = numPoints-2, pointPtr += 2; i > 0; i--, pointPtr += 2) {
@@ -1265,9 +1422,8 @@ TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints)
control[3] = 0.333*control[7] + 0.667*pointPtr[1];
/*
- * Set up the last two control points. This is done
- * differently for the last spline of an open curve
- * than for other cases.
+ * Set up the last two control points. This is done differently for
+ * the last spline of an open curve than for other cases.
*/
if ((i == 1) && !closed) {
@@ -1284,7 +1440,115 @@ TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints)
control[2], Tk_CanvasPsY(canvas, control[3]),
control[4], Tk_CanvasPsY(canvas, control[5]),
control[6], Tk_CanvasPsY(canvas, control[7]));
- Tcl_AppendResult(interp, buffer, (char *) NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkMakeRawCurvePostscript --
+ *
+ * This function interprets the input points as the raw knot and control
+ * points for a curve composed of Bezier curve segments, just like
+ * TkMakeRawCurve. It generates Postscript commands that create a path
+ * corresponding to this given curve.
+ *
+ * Results:
+ * None. Postscript commands to generate the path are appended to the
+ * interp's result.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkMakeRawCurvePostscript(
+ Tcl_Interp *interp, /* Interpreter in whose result the Postscript
+ * is to be stored. */
+ Tk_Canvas canvas, /* Canvas widget for which the Postscript is
+ * being generated. */
+ double *pointPtr, /* Array of input coordinates: x0, y0, x1, y1,
+ * etc.. */
+ int numPoints) /* Number of points at pointPtr. */
+{
+ int i;
+ double *segPtr;
+ char buffer[200];
+
+ /*
+ * Put the first point into the path.
+ */
+
+ sprintf(buffer, "%.15g %.15g moveto\n",
+ pointPtr[0], Tk_CanvasPsY(canvas, pointPtr[1]));
+ Tcl_AppendResult(interp, buffer, NULL);
+
+ /*
+ * Loop through all the remaining points in the curve, generating a
+ * straight line or curve section for every three of them.
+ */
+
+ for (i=numPoints-1,segPtr=pointPtr ; i>=3 ; i-=3,segPtr+=6) {
+ if (segPtr[0]==segPtr[2] && segPtr[1]==segPtr[3] &&
+ segPtr[4]==segPtr[6] && segPtr[5]==segPtr[7]) {
+ /*
+ * The control points on this segment are equal to their
+ * neighbouring knots, so this segment is just a straight line.
+ */
+
+ sprintf(buffer, "%.15g %.15g lineto\n",
+ segPtr[6], Tk_CanvasPsY(canvas, segPtr[7]));
+ } else {
+ /*
+ * This is a generic Bezier curve segment.
+ */
+
+ sprintf(buffer, "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
+ segPtr[2], Tk_CanvasPsY(canvas, segPtr[3]),
+ segPtr[4], Tk_CanvasPsY(canvas, segPtr[5]),
+ segPtr[6], Tk_CanvasPsY(canvas, segPtr[7]));
+ }
+ Tcl_AppendResult(interp, buffer, NULL);
+ }
+
+ /*
+ * If there are any points left that haven't been used, then build the
+ * last segment and generate Postscript in the same way for that.
+ */
+
+ if (i > 0) {
+ int j;
+ double control[8];
+
+ for (j=0; j<2*i+2; j++) {
+ control[j] = segPtr[j];
+ }
+ for (; j<8; j++) {
+ control[j] = pointPtr[j-2*i-2];
+ }
+
+ if (control[0]==control[2] && control[1]==control[3] &&
+ control[4]==control[6] && control[5]==control[7]) {
+ /*
+ * Straight line.
+ */
+
+ sprintf(buffer, "%.15g %.15g lineto\n",
+ control[6], Tk_CanvasPsY(canvas, control[7]));
+ } else {
+ /*
+ * Bezier curve segment.
+ */
+
+ sprintf(buffer, "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
+ control[2], Tk_CanvasPsY(canvas, control[3]),
+ control[4], Tk_CanvasPsY(canvas, control[5]),
+ control[6], Tk_CanvasPsY(canvas, control[7]));
+ }
+ Tcl_AppendResult(interp, buffer, NULL);
}
}
@@ -1293,16 +1557,14 @@ TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints)
*
* TkGetMiterPoints --
*
- * Given three points forming an angle, compute the
- * coordinates of the inside and outside points of
- * the mitered corner formed by a line of a given
- * width at that angle.
+ * Given three points forming an angle, compute the coordinates of the
+ * inside and outside points of the mitered corner formed by a line of a
+ * given width at that angle.
*
* Results:
- * If the angle formed by the three points is less than
- * 11 degrees then 0 is returned and m1 and m2 aren't
- * modified. Otherwise 1 is returned and the points at
- * m1 and m2 are filled in with the positions of the points
+ * If the angle formed by the three points is less than 11 degrees then 0
+ * is returned and m1 and m2 aren't modified. Otherwise 1 is returned and
+ * the points at m1 and m2 are filled in with the positions of the points
* of the mitered corner.
*
* Side effects:
@@ -1312,36 +1574,39 @@ TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints)
*/
int
-TkGetMiterPoints(p1, p2, p3, width, m1, m2)
- double p1[]; /* Points to x- and y-coordinates of point
+TkGetMiterPoints(
+ double p1[], /* Points to x- and y-coordinates of point
* before vertex. */
- double p2[]; /* Points to x- and y-coordinates of vertex
+ double p2[], /* Points to x- and y-coordinates of vertex
* for mitered joint. */
- double p3[]; /* Points to x- and y-coordinates of point
+ double p3[], /* Points to x- and y-coordinates of point
* after vertex. */
- double width; /* Width of line. */
- double m1[]; /* Points to place to put "left" vertex
- * point (see as you face from p1 to p2). */
- double m2[]; /* Points to place to put "right" vertex
+ double width, /* Width of line. */
+ double m1[], /* Points to place to put "left" vertex point
+ * (see as you face from p1 to p2). */
+ double m2[]) /* Points to place to put "right" vertex
* point. */
{
double theta1; /* Angle of segment p2-p1. */
double theta2; /* Angle of segment p2-p3. */
- double theta; /* Angle between line segments (angle
- * of joint). */
- double theta3; /* Angle that bisects theta1 and
- * theta2 and points to m1. */
+ double theta; /* Angle between line segments (angle of
+ * joint). */
+ double theta3; /* Angle that bisects theta1 and theta2 and
+ * points to m1. */
double dist; /* Distance of miter points from p2. */
- double deltaX, deltaY; /* X and y offsets cooresponding to
- * dist (fudge factors for bounding
- * box). */
+ double deltaX, deltaY; /* X and y offsets cooresponding to dist
+ * (fudge factors for bounding box). */
double p1x, p1y, p2x, p2y, p3x, p3y;
- static double elevenDegrees = (11.0*2.0*PI)/360.0;
+#ifndef _MSC_VER
+ static const double elevenDegrees = (11.0*2.0*PI)/360.0;
+#else /* msvc8 with -fp:strict requires it this way */
+ static const double elevenDegrees = 0.19198621771937624;
+#endif
/*
- * Round the coordinates to integers to mimic what happens when the
- * line segments are displayed; without this code, the bounding box
- * of a mitered line can be miscomputed greatly.
+ * Round the coordinates to integers to mimic what happens when the line
+ * segments are displayed; without this code, the bounding box of a
+ * mitered line can be miscomputed greatly.
*/
p1x = floor(p1[0]+0.5);
@@ -1358,6 +1623,7 @@ TkGetMiterPoints(p1, p2, p3, width, m1, m2)
} else {
theta1 = atan2(p1y - p2y, p1x - p2x);
}
+
if (p3y == p2y) {
theta2 = (p3x > p2x) ? 0 : PI;
} else if (p3x == p2x) {
@@ -1365,23 +1631,26 @@ TkGetMiterPoints(p1, p2, p3, width, m1, m2)
} else {
theta2 = atan2(p3y - p2y, p3x - p2x);
}
+
theta = theta1 - theta2;
if (theta > PI) {
theta -= 2*PI;
} else if (theta < -PI) {
theta += 2*PI;
}
+
if ((theta < elevenDegrees) && (theta > -elevenDegrees)) {
return 0;
}
+
dist = 0.5*width/sin(0.5*theta);
if (dist < 0.0) {
dist = -dist;
}
/*
- * Compute theta3 (make sure that it points to the left when
- * looking from p1 to p2).
+ * Compute theta3 (make sure that it points to the left when looking from
+ * p1 to p2).
*/
theta3 = (theta1 + theta2)/2.0;
@@ -1394,6 +1663,7 @@ TkGetMiterPoints(p1, p2, p3, width, m1, m2)
deltaY = dist*sin(theta3);
m1[1] = p2y + deltaY;
m2[1] = p2y - deltaY;
+
return 1;
}
@@ -1402,13 +1672,13 @@ TkGetMiterPoints(p1, p2, p3, width, m1, m2)
*
* TkGetButtPoints --
*
- * Given two points forming a line segment, compute the
- * coordinates of two endpoints of a rectangle formed by
- * bloating the line segment until it is width units wide.
+ * Given two points forming a line segment, compute the coordinates of
+ * two endpoints of a rectangle formed by bloating the line segment until
+ * it is width units wide.
*
* Results:
- * There is no return value. M1 and m2 are filled in to
- * correspond to m1 and m2 in the diagram below:
+ * There is no return value. M1 and m2 are filled in to correspond to m1
+ * and m2 in the diagram below:
*
* ----------------* m1
* |
@@ -1416,9 +1686,9 @@ TkGetMiterPoints(p1, p2, p3, width, m1, m2)
* |
* ----------------* m2
*
- * M1 and m2 will be W units apart, with p2 centered between
- * them and m1-m2 perpendicular to p1-p2. However, if
- * "project" is true then m1 and m2 will be as follows:
+ * M1 and m2 will be W units apart, with p2 centered between them and
+ * m1-m2 perpendicular to p1-p2. However, if "project" is true then m1
+ * and m2 will be as follows:
*
* -------------------* m1
* p2 |
@@ -1435,17 +1705,17 @@ TkGetMiterPoints(p1, p2, p3, width, m1, m2)
*/
void
-TkGetButtPoints(p1, p2, width, project, m1, m2)
- double p1[]; /* Points to x- and y-coordinates of point
+TkGetButtPoints(
+ double p1[], /* Points to x- and y-coordinates of point
* before vertex. */
- double p2[]; /* Points to x- and y-coordinates of vertex
+ double p2[], /* Points to x- and y-coordinates of vertex
* for mitered joint. */
- double width; /* Width of line. */
- int project; /* Non-zero means project p2 by an additional
+ double width, /* Width of line. */
+ int project, /* Non-zero means project p2 by an additional
* width/2 before computing m1 and m2. */
- double m1[]; /* Points to place to put "left" result
- * point, as you face from p1 to p2. */
- double m2[]; /* Points to place to put "right" result
+ double m1[], /* Points to place to put "left" result point,
+ * as you face from p1 to p2. */
+ double m2[]) /* Points to place to put "right" result
* point. */
{
double length; /* Length of p1-p2 segment. */
@@ -1471,3 +1741,11 @@ TkGetButtPoints(p1, p2, width, project, m1, m2)
}
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index 81c8648..bf2ed7c 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -1,378 +1,689 @@
-/*
+/*
* tkUndo.c --
*
* This module provides the implementation of an undo stack.
*
* Copyright (c) 2002 by Ludwig Callewaert.
+ * Copyright (c) 2003-2004 by Vincent Darley.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkUndo.h"
+static int EvaluateActionList(Tcl_Interp *interp,
+ TkUndoSubAtom *action);
/*
- * TkUndoPushStack
- * Push elem on the stack identified by stack.
+ *----------------------------------------------------------------------
+ *
+ * TkUndoPushStack --
+ *
+ * Push elem on the stack identified by stack.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-void TkUndoPushStack ( stack, elem )
- TkUndoAtom ** stack;
- TkUndoAtom * elem;
-{
+
+void
+TkUndoPushStack(
+ TkUndoAtom **stack,
+ TkUndoAtom *elem)
+{
elem->next = *stack;
*stack = elem;
}
/*
+ *----------------------------------------------------------------------
+ *
* TkUndoPopStack --
- * Remove and return the top element from the stack identified by
- * stack.
+ *
+ * Remove and return the top element from the stack identified by stack.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-TkUndoAtom * TkUndoPopStack ( stack )
- TkUndoAtom ** stack ;
-{
- TkUndoAtom * elem = NULL;
- if (*stack != NULL ) {
- elem = *stack;
- *stack = elem->next;
+
+TkUndoAtom *
+TkUndoPopStack(
+ TkUndoAtom **stack)
+{
+ TkUndoAtom *elem = NULL;
+
+ if (*stack != NULL) {
+ elem = *stack;
+ *stack = elem->next;
}
return elem;
}
/*
+ *----------------------------------------------------------------------
+ *
* TkUndoInsertSeparator --
- * insert a separator on the stack, indicating a border for
- * an undo/redo chunk.
+ *
+ * Insert a separator on the stack, indicating a border for an undo/redo
+ * chunk.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-int TkUndoInsertSeparator ( stack )
- TkUndoAtom ** stack;
+
+int
+TkUndoInsertSeparator(
+ TkUndoAtom **stack)
{
- TkUndoAtom * separator;
-
- if ( *stack != NULL && (*stack)->type != TK_UNDO_SEPARATOR ) {
- separator = (TkUndoAtom *) ckalloc(sizeof(TkUndoAtom));
- separator->type = TK_UNDO_SEPARATOR;
- TkUndoPushStack(stack,separator);
- return 1;
- } else {
- return 0;
+ TkUndoAtom *separator;
+
+ if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) {
+ separator = (TkUndoAtom *) ckalloc(sizeof(TkUndoAtom));
+ separator->type = TK_UNDO_SEPARATOR;
+ TkUndoPushStack(stack,separator);
+ return 1;
}
+ return 0;
}
/*
+ *----------------------------------------------------------------------
+ *
* TkUndoClearStack --
- * Clear an entire undo or redo stack and destroy all elements in it.
+ *
+ * Clear an entire undo or redo stack and destroy all elements in it.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-void TkUndoClearStack ( stack )
- TkUndoAtom ** stack; /* An Undo or Redo stack */
+void
+TkUndoClearStack(
+ TkUndoAtom **stack) /* An Undo or Redo stack */
{
- TkUndoAtom * elem;
-
- while ( (elem = TkUndoPopStack(stack)) ) {
- if ( elem->type != TK_UNDO_SEPARATOR ) {
- Tcl_DecrRefCount(elem->apply);
- Tcl_DecrRefCount(elem->revert);
- }
- ckfree((char *)elem);
+ TkUndoAtom *elem;
+
+ while ((elem = TkUndoPopStack(stack)) != NULL) {
+ if (elem->type != TK_UNDO_SEPARATOR) {
+ TkUndoSubAtom *sub;
+
+ sub = elem->apply;
+ while (sub != NULL) {
+ TkUndoSubAtom *next = sub->next;
+
+ if (sub->action != NULL) {
+ Tcl_DecrRefCount(sub->action);
+ }
+ ckfree((char *)sub);
+ sub = next;
+ }
+
+ sub = elem->revert;
+ while (sub != NULL) {
+ TkUndoSubAtom *next = sub->next;
+
+ if (sub->action != NULL) {
+ Tcl_DecrRefCount(sub->action);
+ }
+ ckfree((char *)sub);
+ sub = next;
+ }
+ }
+ ckfree((char *)elem);
}
*stack = NULL;
}
/*
- * TkUndoPushAction
- * Push a new elem on the stack identified by stack.
- * action and revert are given through Tcl_DStrings
+ *----------------------------------------------------------------------
+ *
+ * TkUndoPushAction --
+ *
+ * Push a new elem on the stack identified by stack. Action and revert
+ * are given through Tcl_Obj's to which we will retain a reference. (So
+ * they can be passed in with a zero refCount if desired).
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-void TkUndoPushAction ( stack, actionScript, revertScript )
- TkUndoRedoStack * stack; /* An Undo or Redo stack */
- Tcl_DString * actionScript; /* The script to get the action (redo) */
- Tcl_DString * revertScript; /* The script to revert the action (undo) */
-{
- TkUndoAtom * atom;
+
+void
+TkUndoPushAction(
+ TkUndoRedoStack *stack, /* An Undo or Redo stack */
+ TkUndoSubAtom *apply,
+ TkUndoSubAtom *revert)
+{
+ TkUndoAtom *atom;
atom = (TkUndoAtom *) ckalloc(sizeof(TkUndoAtom));
atom->type = TK_UNDO_ACTION;
+ atom->apply = apply;
+ atom->revert = revert;
- atom->apply = Tcl_NewStringObj(Tcl_DStringValue(actionScript),Tcl_DStringLength(actionScript));
- Tcl_IncrRefCount(atom->apply);
+ TkUndoPushStack(&stack->undoStack, atom);
+ TkUndoClearStack(&stack->redoStack);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkUndoMakeCmdSubAtom --
+ *
+ * Create a new undo/redo step which must later be place into an undo
+ * stack with TkUndoPushAction. This sub-atom, if evaluated, will take
+ * the given command (if non-NULL), find its full Tcl command string, and
+ * then evaluate that command with the list elements of 'actionScript'
+ * appended.
+ *
+ * If 'subAtomList' is non-NULL, the newly created sub-atom is added onto
+ * the end of the linked list of which 'subAtomList' is a part. This
+ * makes it easy to build up a sequence of actions which will be pushed
+ * in one step.
+ *
+ * Note: if the undo stack can persist for longer than the Tcl_Command
+ * provided, the stack will cause crashes when actions are evaluated. In
+ * this case the 'command' argument should not be used. This is the case
+ * with peer text widgets, for example.
+ *
+ * Results:
+ * The newly created subAtom is returned. It must be passed to
+ * TkUndoPushAction otherwise a memory leak will result.
+ *
+ * Side effects:
+ * A refCount is retained on 'actionScript'.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkUndoSubAtom *
+TkUndoMakeCmdSubAtom(
+ Tcl_Command command, /* Tcl command token for actions, may be NULL
+ * if not needed. */
+ Tcl_Obj *actionScript, /* The script to append to the command to
+ * perform the action (may be NULL if the
+ * command is not-null). */
+ TkUndoSubAtom *subAtomList) /* Add to the end of this list of actions if
+ * non-NULL */
+{
+ TkUndoSubAtom *atom;
- atom->revert = Tcl_NewStringObj(Tcl_DStringValue(revertScript),Tcl_DStringLength(revertScript));
- Tcl_IncrRefCount(atom->revert);
+ if (command == NULL && actionScript == NULL) {
+ Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom");
+ }
- TkUndoPushStack(&(stack->undoStack), atom);
- TkUndoClearStack(&(stack->redoStack));
+ atom = (TkUndoSubAtom *) ckalloc(sizeof(TkUndoSubAtom));
+ atom->command = command;
+ atom->funcPtr = NULL;
+ atom->clientData = NULL;
+ atom->next = NULL;
+ atom->action = actionScript;
+ if (atom->action != NULL) {
+ Tcl_IncrRefCount(atom->action);
+ }
+
+ if (subAtomList != NULL) {
+ while (subAtomList->next != NULL) {
+ subAtomList = subAtomList->next;
+ }
+ subAtomList->next = atom;
+ }
+ return atom;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkUndoMakeSubAtom --
+ *
+ * Create a new undo/redo step which must later be place into an undo
+ * stack with TkUndoPushAction. This sub-atom, if evaluated, will take
+ * the given C-funcPtr (which must be non-NULL), and call it with three
+ * arguments: the undo stack's 'interp', the 'clientData' given and the
+ * 'actionScript'. The callback should return a standard Tcl return code
+ * (TCL_OK on success).
+ *
+ * If 'subAtomList' is non-NULL, the newly created sub-atom is added onto
+ * the end of the linked list of which 'subAtomList' is a part. This
+ * makes it easy to build up a sequence of actions which will be pushed
+ * in one step.
+ *
+ * Results:
+ * The newly created subAtom is returned. It must be passed to
+ * TkUndoPushAction otherwise a memory leak will result.
+ *
+ * Side effects:
+ * A refCount is retained on 'actionScript'.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkUndoSubAtom *
+TkUndoMakeSubAtom(
+ TkUndoProc *funcPtr, /* Callback function to perform the
+ * undo/redo. */
+ ClientData clientData, /* Data to pass to the callback function. */
+ Tcl_Obj *actionScript, /* Additional Tcl data to pass to the callback
+ * function (may be NULL). */
+ TkUndoSubAtom *subAtomList) /* Add to the end of this list of actions if
+ * non-NULL */
+{
+ TkUndoSubAtom *atom;
+ if (funcPtr == NULL) {
+ Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom");
+ }
+
+ atom = (TkUndoSubAtom *) ckalloc(sizeof(TkUndoSubAtom));
+ atom->command = NULL;
+ atom->funcPtr = funcPtr;
+ atom->clientData = clientData;
+ atom->next = NULL;
+ atom->action = actionScript;
+ if (atom->action != NULL) {
+ Tcl_IncrRefCount(atom->action);
+ }
+
+ if (subAtomList != NULL) {
+ while (subAtomList->next != NULL) {
+ subAtomList = subAtomList->next;
+ }
+ subAtomList->next = atom;
+ }
+ return atom;
+}
/*
- * TkUndoInitStack
- * Initialize a new undo/redo stack
+ *----------------------------------------------------------------------
+ *
+ * TkUndoInitStack --
+ *
+ * Initialize a new undo/redo stack.
*
* Results:
- * un Undo/Redo stack pointer
+ * An Undo/Redo stack pointer.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-TkUndoRedoStack * TkUndoInitStack ( interp, maxdepth )
- Tcl_Interp * interp; /* The interpreter */
- int maxdepth; /* The maximum stack depth */
-{
- TkUndoRedoStack * stack; /* An Undo/Redo stack */
+
+TkUndoRedoStack *
+TkUndoInitStack(
+ Tcl_Interp *interp, /* The interpreter */
+ int maxdepth) /* The maximum stack depth */
+{
+ TkUndoRedoStack *stack; /* An Undo/Redo stack */
+
stack = (TkUndoRedoStack *) ckalloc(sizeof(TkUndoRedoStack));
stack->undoStack = NULL;
stack->redoStack = NULL;
- stack->interp = interp;
- stack->maxdepth = maxdepth;
- stack->depth = 0;
+ stack->interp = interp;
+ stack->maxdepth = maxdepth;
+ stack->depth = 0;
return stack;
}
-
/*
- * TkUndoInitStack
- * Initialize a new undo/redo stack
+ *----------------------------------------------------------------------
+ *
+ * TkUndoSetDepth --
+ *
+ * Set the maximum depth of stack.
*
* Results:
- * un Undo/Redo stack pointer
+ * None.
*
* Side effects:
- * None.
+ * May delete elements from the stack if the new maximum depth is smaller
+ * than the number of elements previously in the stack.
+ *
+ *----------------------------------------------------------------------
*/
-
-void TkUndoSetDepth ( stack, maxdepth )
- TkUndoRedoStack * stack; /* An Undo/Redo stack */
- int maxdepth; /* The maximum stack depth */
+
+void
+TkUndoSetDepth(
+ TkUndoRedoStack *stack, /* An Undo/Redo stack */
+ int maxdepth) /* The maximum stack depth */
{
- TkUndoAtom * elem;
- TkUndoAtom * prevelem;
- int sepNumber = 0;
-
stack->maxdepth = maxdepth;
- if ((stack->maxdepth > 0) && (stack->depth > stack->maxdepth)) {
- /*
+ if (stack->maxdepth>0 && stack->depth>stack->maxdepth) {
+ TkUndoAtom *elem, *prevelem;
+ int sepNumber = 0;
+
+ /*
* Maximum stack depth exceeded. We have to remove the last compound
* elements on the stack.
*/
- elem = stack->undoStack;
- prevelem = NULL;
- while (elem && (sepNumber <= stack->maxdepth)) {
- if (elem->type == TK_UNDO_SEPARATOR) {
- sepNumber++;
- }
- prevelem = elem;
- elem = elem->next;
- }
- prevelem->next = NULL;
- while ( elem ) {
- prevelem = elem;
- elem = elem->next;
- ckfree((char *) prevelem);
- }
- stack->depth = stack->maxdepth;
+ elem = stack->undoStack;
+ prevelem = NULL;
+ while ((elem != NULL) && (sepNumber <= stack->maxdepth)) {
+ if (elem->type == TK_UNDO_SEPARATOR) {
+ sepNumber++;
+ }
+ prevelem = elem;
+ elem = elem->next;
+ }
+ prevelem->next = NULL;
+ while (elem != NULL) {
+ prevelem = elem;
+ if (elem->type != TK_UNDO_SEPARATOR) {
+ TkUndoSubAtom *sub = elem->apply;
+ while (sub != NULL) {
+ TkUndoSubAtom *next = sub->next;
+
+ if (sub->action != NULL) {
+ Tcl_DecrRefCount(sub->action);
+ }
+ ckfree((char *)sub);
+ sub = next;
+ }
+ sub = elem->revert;
+ while (sub != NULL) {
+ TkUndoSubAtom *next = sub->next;
+
+ if (sub->action != NULL) {
+ Tcl_DecrRefCount(sub->action);
+ }
+ ckfree((char *)sub);
+ sub = next;
+ }
+ }
+ elem = elem->next;
+ ckfree((char *) prevelem);
+ }
+ stack->depth = stack->maxdepth;
}
}
-
/*
- * TkUndoClearStacks
- * Clear both the undo and redo stack
+ *----------------------------------------------------------------------
+ *
+ * TkUndoClearStacks --
+ *
+ * Clear both the undo and redo stack.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-void TkUndoClearStacks ( stack )
- TkUndoRedoStack * stack; /* An Undo/Redo stack */
-{
- TkUndoClearStack(&(stack->undoStack));
- TkUndoClearStack(&(stack->redoStack));
+
+void
+TkUndoClearStacks(
+ TkUndoRedoStack *stack) /* An Undo/Redo stack */
+{
+ TkUndoClearStack(&stack->undoStack);
+ TkUndoClearStack(&stack->redoStack);
stack->depth = 0;
}
-
/*
+ *----------------------------------------------------------------------
+ *
* TkUndoFreeStack
- * Clear both the undo and redo stack
- * also free the memory allocated to the u/r stack pointer
+ *
+ * Clear both the undo and redo stack and free the memory allocated to
+ * the u/r stack pointer.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-void TkUndoFreeStack ( stack )
- TkUndoRedoStack * stack; /* An Undo/Redo stack */
-{
- TkUndoClearStacks(stack);
-/* ckfree((TkUndoRedoStack *) stack); */
- ckfree((char *) stack);
-}
+void
+TkUndoFreeStack(
+ TkUndoRedoStack *stack) /* An Undo/Redo stack */
+{
+ TkUndoClearStacks(stack);
+ ckfree((char *) stack);
+}
/*
+ *----------------------------------------------------------------------
+ *
* TkUndoInsertUndoSeparator --
- * insert a separator on the undo stack, indicating a border for
- * an undo/redo chunk.
+ *
+ * Insert a separator on the undo stack, indicating a border for an
+ * undo/redo chunk.
*
* Results:
- * None
+ * None.
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-void TkUndoInsertUndoSeparator ( stack )
- TkUndoRedoStack * stack;
+
+void
+TkUndoInsertUndoSeparator(
+ TkUndoRedoStack *stack)
{
- if ( TkUndoInsertSeparator(&(stack->undoStack)) ) {
- ++(stack->depth);
- TkUndoSetDepth(stack,stack->maxdepth);
+ if (TkUndoInsertSeparator(&stack->undoStack)) {
+ stack->depth++;
+ TkUndoSetDepth(stack, stack->maxdepth);
}
}
-
/*
+ *----------------------------------------------------------------------
+ *
* TkUndoRevert --
- * Undo a compound action on the stack.
+ *
+ * Undo a compound action on the stack.
*
* Results:
- * A TCL status code
+ * A Tcl status code
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-int TkUndoRevert ( stack )
- TkUndoRedoStack * stack;
+
+int
+TkUndoRevert(
+ TkUndoRedoStack *stack)
{
- TkUndoAtom * elem;
+ TkUndoAtom *elem;
- /* insert a separator on the undo and the redo stack */
+ /*
+ * Insert a separator on the undo and the redo stack.
+ */
TkUndoInsertUndoSeparator(stack);
- TkUndoInsertSeparator(&(stack->redoStack));
-
- /* Pop and skip the first separator if there is one*/
+ TkUndoInsertSeparator(&stack->redoStack);
- elem = TkUndoPopStack(&(stack->undoStack));
+ /*
+ * Pop and skip the first separator if there is one.
+ */
- if ( elem == NULL ) {
- return TCL_ERROR;
+ elem = TkUndoPopStack(&stack->undoStack);
+ if (elem == NULL) {
+ return TCL_ERROR;
}
- if ( ( elem != NULL ) && ( elem->type == TK_UNDO_SEPARATOR ) ) {
- ckfree((char *) elem);
- elem = TkUndoPopStack(&(stack->undoStack));
+ if (elem->type == TK_UNDO_SEPARATOR) {
+ ckfree((char *) elem);
+ elem = TkUndoPopStack(&stack->undoStack);
}
-
- while ( elem && (elem->type != TK_UNDO_SEPARATOR) ) {
- Tcl_EvalObjEx(stack->interp,elem->revert,TCL_EVAL_GLOBAL);
-
- TkUndoPushStack(&(stack->redoStack),elem);
- elem = TkUndoPopStack(&(stack->undoStack));
+
+ while (elem != NULL && elem->type != TK_UNDO_SEPARATOR) {
+ /*
+ * Note that we currently ignore errors thrown here.
+ */
+
+ EvaluateActionList(stack->interp, elem->revert);
+
+ TkUndoPushStack(&stack->redoStack, elem);
+ elem = TkUndoPopStack(&stack->undoStack);
}
-
- /* insert a separator on the redo stack */
-
- TkUndoInsertSeparator(&(stack->redoStack));
-
- --(stack->depth);
-
+
+ /*
+ * Insert a separator on the redo stack.
+ */
+
+ TkUndoInsertSeparator(&stack->redoStack);
+ stack->depth--;
return TCL_OK;
}
-
/*
+ *----------------------------------------------------------------------
+ *
* TkUndoApply --
- * Redo a compound action on the stack.
+ *
+ * Redo a compound action on the stack.
*
* Results:
- * A TCL status code
+ * A Tcl status code
*
* Side effects:
- * None.
+ * None.
+ *
+ *----------------------------------------------------------------------
*/
-
-int TkUndoApply ( stack )
- TkUndoRedoStack * stack;
+
+int
+TkUndoApply(
+ TkUndoRedoStack *stack)
{
TkUndoAtom *elem;
- /* insert a separator on the undo stack */
+ /*
+ * Insert a separator on the undo stack.
+ */
- TkUndoInsertSeparator(&(stack->undoStack));
+ TkUndoInsertSeparator(&stack->undoStack);
- /* Pop and skip the first separator if there is one*/
+ /*
+ * Pop and skip the first separator if there is one.
+ */
- elem = TkUndoPopStack(&(stack->redoStack));
-
- if ( elem == NULL ) {
- return TCL_ERROR;
+ elem = TkUndoPopStack(&stack->redoStack);
+ if (elem == NULL) {
+ return TCL_ERROR;
}
- if ( ( elem != NULL ) && ( elem->type == TK_UNDO_SEPARATOR ) ) {
- ckfree((char *) elem);
- elem = TkUndoPopStack(&(stack->redoStack));
+ if (elem->type == TK_UNDO_SEPARATOR) {
+ ckfree((char *) elem);
+ elem = TkUndoPopStack(&stack->redoStack);
}
- while ( elem && (elem->type != TK_UNDO_SEPARATOR) ) {
- Tcl_EvalObjEx(stack->interp,elem->apply,TCL_EVAL_GLOBAL);
-
- TkUndoPushStack(&(stack->undoStack), elem);
- elem = TkUndoPopStack(&(stack->redoStack));
+ while (elem != NULL && elem->type != TK_UNDO_SEPARATOR) {
+ /*
+ * Note that we currently ignore errors thrown here.
+ */
+
+ EvaluateActionList(stack->interp, elem->apply);
+
+ TkUndoPushStack(&stack->undoStack, elem);
+ elem = TkUndoPopStack(&stack->redoStack);
}
- /* insert a separator on the undo stack */
-
- TkUndoInsertSeparator(&(stack->undoStack));
+ /*
+ * Insert a separator on the undo stack.
+ */
- ++(stack->depth);
-
+ TkUndoInsertSeparator(&stack->undoStack);
+ stack->depth++;
return TCL_OK;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EvaluateActionList --
+ *
+ * Execute a linked list of undo/redo sub-atoms. If any sub-atom returns
+ * a non TCL_OK value, execution of subsequent sub-atoms is cancelled and
+ * the error returned immediately.
+ *
+ * Results:
+ * A Tcl status code
+ *
+ * Side effects:
+ * The undo/redo subAtoms can perform arbitrary actions.
+ *
+ *----------------------------------------------------------------------
+ */
+static int
+EvaluateActionList(
+ Tcl_Interp *interp, /* Interpreter to evaluate the action in. */
+ TkUndoSubAtom *action) /* Head of linked list of action steps to
+ * perform. */
+{
+ int result = TCL_OK;
+
+ while (action != NULL) {
+ if (action->funcPtr != NULL) {
+ result = (*action->funcPtr)(interp, action->clientData,
+ action->action);
+ } else if (action->command != NULL) {
+ Tcl_Obj *cmdNameObj, *evalObj;
+
+ cmdNameObj = Tcl_NewObj();
+ evalObj = Tcl_NewObj();
+ Tcl_IncrRefCount(evalObj);
+ Tcl_GetCommandFullName(interp, action->command, cmdNameObj);
+ Tcl_ListObjAppendElement(NULL, evalObj, cmdNameObj);
+ if (action->action != NULL) {
+ Tcl_ListObjAppendList(NULL, evalObj, action->action);
+ }
+ result = Tcl_EvalObjEx(interp, evalObj, TCL_EVAL_GLOBAL);
+ Tcl_DecrRefCount(evalObj);
+ } else {
+ result = Tcl_EvalObjEx(interp, action->action, TCL_EVAL_GLOBAL);
+ }
+ if (result != TCL_OK) {
+ return result;
+ }
+ action = action->next;
+ }
+ return result;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkUndo.h b/generic/tkUndo.h
index 8f0411c..b0e2db0 100644
--- a/generic/tkUndo.h
+++ b/generic/tkUndo.h
@@ -1,20 +1,19 @@
/*
* tkUndo.h --
*
- * Declarations shared among the files that implement an undo
- * stack.
+ * Declarations shared among the files that implement an undo stack.
*
* Copyright (c) 2002 Ludwig Callewaert.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKUNDO
#define _TKUNDO
-#ifndef _TK
-#include "tk.h"
+#ifndef _TKINT
+#include "tkInt.h"
#endif
#ifdef BUILD_tk
@@ -22,65 +21,99 @@
# define TCL_STORAGE_CLASS DLLEXPORT
#endif
-/* enum definining the types used in an undo stack */
+/*
+ * Enum definining the types used in an undo stack.
+ */
typedef enum {
- TK_UNDO_SEPARATOR, /* Marker */
- TK_UNDO_ACTION /* Command */
+ TK_UNDO_SEPARATOR, /* Marker */
+ TK_UNDO_ACTION /* Command */
} TkUndoAtomType;
-/* struct defining the basic undo/redo stack element */
-
-typedef struct TkUndoAtom {
- TkUndoAtomType type; /* The type that will trigger the
- * required action*/
- Tcl_Obj * apply; /* Command to apply the action that was taken */
- Tcl_Obj * revert; /* The command to undo the action */
- struct TkUndoAtom * next; /* Pointer to the next element in the
- * stack */
-} TkUndoAtom;
-
-/* struct defining the basic undo/redo stack element */
-
-typedef struct TkUndoRedoStack {
- TkUndoAtom * undoStack; /* The undo stack */
- TkUndoAtom * redoStack; /* The redo stack */
- Tcl_Interp * interp ; /* The interpreter in which to execute the revert and apply scripts */
- int maxdepth;
- int depth;
-} TkUndoRedoStack;
-
-/* basic functions */
+/*
+ * Callback proc type to carry out an undo or redo action via C code. (Actions
+ * can also be defined by Tcl scripts).
+ */
-EXTERN void TkUndoPushStack _ANSI_ARGS_((TkUndoAtom ** stack,
- TkUndoAtom * elem));
+typedef int (TkUndoProc)(Tcl_Interp *interp, ClientData clientData,
+ Tcl_Obj *objPtr);
-EXTERN TkUndoAtom * TkUndoPopStack _ANSI_ARGS_((TkUndoAtom ** stack));
-
-EXTERN int TkUndoInsertSeparator _ANSI_ARGS_((TkUndoAtom ** stack));
+/*
+ * Struct defining a single action, one or more of which may be defined (and
+ * stored in a linked list) separately for each undo and redo action of an
+ * undo atom.
+ */
-EXTERN void TkUndoClearStack _ANSI_ARGS_((TkUndoAtom ** stack));
+typedef struct TkUndoSubAtom {
+ Tcl_Command command; /* Tcl token used to get the current Tcl
+ * command name which will be used to execute
+ * apply/revert scripts. If NULL then it is
+ * assumed the apply/revert scripts already
+ * contain everything. */
+ TkUndoProc *funcPtr; /* Function pointer for callback to perform
+ * undo/redo actions. */
+ ClientData clientData; /* Data for 'funcPtr'. */
+ Tcl_Obj *action; /* Command to apply the action that was
+ * taken. */
+ struct TkUndoSubAtom *next; /* Pointer to the next element in the linked
+ * list. */
+} TkUndoSubAtom;
-/* functions working on an undo/redo stack */
+/*
+ * Struct representing a single undo+redo atom to be placed in the stack.
+ */
-EXTERN TkUndoRedoStack * TkUndoInitStack _ANSI_ARGS_((Tcl_Interp * interp,
- int maxdepth));
+typedef struct TkUndoAtom {
+ TkUndoAtomType type; /* The type that will trigger the required
+ * action. */
+ TkUndoSubAtom *apply; /* Linked list of 'apply' actions to perform
+ * for this operation. */
+ TkUndoSubAtom *revert; /* Linked list of 'revert' actions to perform
+ * for this operation. */
+ struct TkUndoAtom *next; /* Pointer to the next element in the
+ * stack. */
+} TkUndoAtom;
-EXTERN void TkUndoSetDepth _ANSI_ARGS_((TkUndoRedoStack * stack,
- int maxdepth));
+/*
+ * Struct defining a single undo+redo stack.
+ */
-EXTERN void TkUndoClearStacks _ANSI_ARGS_((TkUndoRedoStack * stack));
+typedef struct TkUndoRedoStack {
+ TkUndoAtom *undoStack; /* The undo stack. */
+ TkUndoAtom *redoStack; /* The redo stack. */
+ Tcl_Interp *interp; /* The interpreter in which to execute the
+ * revert and apply scripts. */
+ int maxdepth;
+ int depth;
+} TkUndoRedoStack;
-EXTERN void TkUndoFreeStack _ANSI_ARGS_((TkUndoRedoStack * stack));
+/*
+ * Basic functions.
+ */
-EXTERN void TkUndoInsertUndoSeparator _ANSI_ARGS_((TkUndoRedoStack * stack));
+MODULE_SCOPE void TkUndoPushStack(TkUndoAtom **stack, TkUndoAtom *elem);
+MODULE_SCOPE TkUndoAtom *TkUndoPopStack(TkUndoAtom **stack);
+MODULE_SCOPE int TkUndoInsertSeparator(TkUndoAtom **stack);
+MODULE_SCOPE void TkUndoClearStack(TkUndoAtom **stack);
-EXTERN void TkUndoPushAction _ANSI_ARGS_((TkUndoRedoStack * stack,
- Tcl_DString * actionScript, Tcl_DString * revertScript));
+/*
+ * Functions for working on an undo/redo stack.
+ */
-EXTERN int TkUndoRevert _ANSI_ARGS_((TkUndoRedoStack * stack));
-
-EXTERN int TkUndoApply _ANSI_ARGS_((TkUndoRedoStack * stack));
+MODULE_SCOPE TkUndoRedoStack *TkUndoInitStack(Tcl_Interp *interp, int maxdepth);
+MODULE_SCOPE void TkUndoSetDepth(TkUndoRedoStack *stack, int maxdepth);
+MODULE_SCOPE void TkUndoClearStacks(TkUndoRedoStack *stack);
+MODULE_SCOPE void TkUndoFreeStack(TkUndoRedoStack *stack);
+MODULE_SCOPE void TkUndoInsertUndoSeparator(TkUndoRedoStack *stack);
+MODULE_SCOPE TkUndoSubAtom *TkUndoMakeCmdSubAtom(Tcl_Command command,
+ Tcl_Obj *actionScript, TkUndoSubAtom *subAtomList);
+MODULE_SCOPE TkUndoSubAtom *TkUndoMakeSubAtom(TkUndoProc *funcPtr,
+ ClientData clientData, Tcl_Obj *actionScript,
+ TkUndoSubAtom *subAtomList);
+MODULE_SCOPE void TkUndoPushAction(TkUndoRedoStack *stack,
+ TkUndoSubAtom *apply, TkUndoSubAtom *revert);
+MODULE_SCOPE int TkUndoRevert(TkUndoRedoStack *stack);
+MODULE_SCOPE int TkUndoApply(TkUndoRedoStack *stack);
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 3d04657..bfa5d5c 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1,63 +1,60 @@
-/*
+/*
* tkUtil.c --
*
- * This file contains miscellaneous utility procedures that
- * are used by the rest of Tk, such as a procedure for drawing
- * a focus highlight.
+ * This file contains miscellaneous utility functions that are used by
+ * the rest of Tk, such as a function for drawing a focus highlight.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
/*
- * The structure below defines the implementation of the "statekey"
- * Tcl object, used for quickly finding a mapping in a TkStateMap.
+ * The structure below defines the implementation of the "statekey" Tcl
+ * object, used for quickly finding a mapping in a TkStateMap.
*/
Tcl_ObjType tkStateKeyObjType = {
- "statekey", /* name */
- (Tcl_FreeInternalRepProc *) NULL, /* freeIntRepProc */
- (Tcl_DupInternalRepProc *) NULL, /* dupIntRepProc */
- (Tcl_UpdateStringProc *) NULL, /* updateStringProc */
- (Tcl_SetFromAnyProc *) NULL /* setFromAnyProc */
+ "statekey", /* name */
+ NULL, /* freeIntRepProc */
+ NULL, /* dupIntRepProc */
+ NULL, /* updateStringProc */
+ NULL /* setFromAnyProc */
};
-
/*
*--------------------------------------------------------------
*
* TkStateParseProc --
*
- * This procedure is invoked during option processing to handle
- * the "-state" and "-default" options.
+ * This function is invoked during option processing to handle the
+ * "-state" and "-default" options.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * The state for a given item gets replaced by the state
- * indicated in the value argument.
+ * The state for a given item gets replaced by the state indicated in the
+ * value argument.
*
*--------------------------------------------------------------
*/
int
-TkStateParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* some flags.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
+TkStateParseProc(
+ ClientData clientData, /* some flags.*/
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ const char *value, /* Value of option. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset) /* Offset into item. */
{
int c;
- int flags = (int)clientData;
+ int flags = PTR2INT(clientData);
size_t length;
register Tk_State *statePtr = (Tk_State *) (widgRec + offset);
@@ -88,18 +85,17 @@ TkStateParseProc(clientData, interp, tkwin, value, widgRec, offset)
}
Tcl_AppendResult(interp, "bad ", (flags&4)?"-default" : "state",
- " value \"", value, "\": must be normal",
- (char *) NULL);
+ " value \"", value, "\": must be normal", NULL);
if (flags&1) {
- Tcl_AppendResult(interp, ", active",(char *) NULL);
+ Tcl_AppendResult(interp, ", active", NULL);
}
if (flags&2) {
- Tcl_AppendResult(interp, ", hidden",(char *) NULL);
+ Tcl_AppendResult(interp, ", hidden", NULL);
}
if (flags&3) {
- Tcl_AppendResult(interp, ",",(char *) NULL);
+ Tcl_AppendResult(interp, ",", NULL);
}
- Tcl_AppendResult(interp, " or disabled",(char *) NULL);
+ Tcl_AppendResult(interp, " or disabled", NULL);
*statePtr = TK_STATE_NORMAL;
return TCL_ERROR;
}
@@ -109,16 +105,15 @@ TkStateParseProc(clientData, interp, tkwin, value, widgRec, offset)
*
* TkStatePrintProc --
*
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-state"
- * configuration option.
+ * This function is invoked by the Tk configuration code to produce a
+ * printable string for the "-state" configuration option.
*
* Results:
- * The return value is a string describing the state for
- * the item referred to by "widgRec". In addition, *freeProcPtr
- * is filled in with the address of a procedure to call to free
- * the result string when it's no longer needed (or NULL to
- * indicate that the string doesn't need to be freed).
+ * The return value is a string describing the state for the item
+ * referred to by "widgRec". In addition, *freeProcPtr is filled in with
+ * the address of a function to call to free the result string when it's
+ * no longer needed (or NULL to indicate that the string doesn't need to
+ * be freed).
*
* Side effects:
* None.
@@ -127,26 +122,27 @@ TkStateParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
char *
-TkStatePrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
+TkStatePrintProc(
+ ClientData clientData, /* Ignored. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset, /* Offset into item. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ * information about how to reclaim storage
+ * for return string. */
{
register Tk_State *statePtr = (Tk_State *) (widgRec + offset);
- if (*statePtr==TK_STATE_NORMAL) {
+ switch (*statePtr) {
+ case TK_STATE_NORMAL:
return "normal";
- } else if (*statePtr==TK_STATE_DISABLED) {
+ case TK_STATE_DISABLED:
return "disabled";
- } else if (*statePtr==TK_STATE_HIDDEN) {
+ case TK_STATE_HIDDEN:
return "hidden";
- } else if (*statePtr==TK_STATE_ACTIVE) {
+ case TK_STATE_ACTIVE:
return "active";
- } else {
+ default:
return "";
}
}
@@ -156,8 +152,8 @@ TkStatePrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*
* TkOrientParseProc --
*
- * This procedure is invoked during option processing to handle
- * the "-orient" option.
+ * This function is invoked during option processing to handle the
+ * "-orient" option.
*
* Results:
* A standard Tcl return value.
@@ -170,13 +166,13 @@ TkStatePrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*/
int
-TkOrientParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* some flags.*/
- Tcl_Interp *interp; /* Used for reporting errors. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- CONST char *value; /* Value of option. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
+TkOrientParseProc(
+ ClientData clientData, /* some flags.*/
+ Tcl_Interp *interp, /* Used for reporting errors. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ const char *value, /* Value of option. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset) /* Offset into item. */
{
int c;
size_t length;
@@ -200,8 +196,7 @@ TkOrientParseProc(clientData, interp, tkwin, value, widgRec, offset)
return TCL_OK;
}
Tcl_AppendResult(interp, "bad orientation \"", value,
- "\": must be vertical or horizontal",
- (char *) NULL);
+ "\": must be vertical or horizontal", NULL);
*orientPtr = 0;
return TCL_ERROR;
}
@@ -211,16 +206,15 @@ TkOrientParseProc(clientData, interp, tkwin, value, widgRec, offset)
*
* TkOrientPrintProc --
*
- * This procedure is invoked by the Tk configuration code
- * to produce a printable string for the "-orient"
- * configuration option.
+ * This function is invoked by the Tk configuration code to produce a
+ * printable string for the "-orient" configuration option.
*
* Results:
- * The return value is a string describing the orientation for
- * the item referred to by "widgRec". In addition, *freeProcPtr
- * is filled in with the address of a procedure to call to free
- * the result string when it's no longer needed (or NULL to
- * indicate that the string doesn't need to be freed).
+ * The return value is a string describing the orientation for the item
+ * referred to by "widgRec". In addition, *freeProcPtr is filled in with
+ * the address of a function to call to free the result string when it's
+ * no longer needed (or NULL to indicate that the string doesn't need to
+ * be freed).
*
* Side effects:
* None.
@@ -229,14 +223,14 @@ TkOrientParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
char *
-TkOrientPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* Ignored. */
- Tk_Window tkwin; /* Window containing canvas widget. */
- char *widgRec; /* Pointer to record for item. */
- int offset; /* Offset into item. */
- Tcl_FreeProc **freeProcPtr; /* Pointer to variable to fill in with
- * information about how to reclaim
- * storage for return string. */
+TkOrientPrintProc(
+ ClientData clientData, /* Ignored. */
+ Tk_Window tkwin, /* Window containing canvas widget. */
+ char *widgRec, /* Pointer to record for item. */
+ int offset, /* Offset into item. */
+ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ * information about how to reclaim storage
+ * for return string. */
{
register int *statePtr = (int *) (widgRec + offset);
@@ -252,23 +246,24 @@ TkOrientPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*
* TkOffsetParseProc --
*
- * Converts the offset of a stipple or tile into the Tk_TSOffset structure.
+ * Converts the offset of a stipple or tile into the Tk_TSOffset
+ * structure.
*
*----------------------------------------------------------------------
*/
int
-TkOffsetParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* not used */
- Tcl_Interp *interp; /* Interpreter to send results back to */
- Tk_Window tkwin; /* Window on same display as tile */
- CONST char *value; /* Name of image */
- char *widgRec; /* Widget structure record */
- int offset; /* Offset of tile in record */
+TkOffsetParseProc(
+ ClientData clientData, /* not used */
+ Tcl_Interp *interp, /* Interpreter to send results back to */
+ Tk_Window tkwin, /* Window on same display as tile */
+ const char *value, /* Name of image */
+ char *widgRec, /* Widget structure record */
+ int offset) /* Offset of tile in record */
{
- Tk_TSOffset *offsetPtr = (Tk_TSOffset *)(widgRec + offset);
+ Tk_TSOffset *offsetPtr = (Tk_TSOffset *) (widgRec + offset);
Tk_TSOffset tsoffset;
- CONST char *q, *p;
+ const char *q, *p;
int result;
if ((value == NULL) || (*value == 0)) {
@@ -279,61 +274,70 @@ TkOffsetParseProc(clientData, interp, tkwin, value, widgRec, offset)
p = value;
switch(value[0]) {
- case '#':
- if (((int)clientData) & TK_OFFSET_RELATIVE) {
- tsoffset.flags = TK_OFFSET_RELATIVE;
- p++; break;
- }
- goto badTSOffset;
- case 'e':
- switch(value[1]) {
- case '\0':
- tsoffset.flags = TK_OFFSET_RIGHT|TK_OFFSET_MIDDLE;
- goto goodTSOffset;
- case 'n':
- if (value[2]!='d' || value[3]!='\0') {goto badTSOffset;}
- tsoffset.flags = INT_MAX;
- goto goodTSOffset;
- }
- case 'w':
- if (value[1] != '\0') {goto badTSOffset;}
- tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_MIDDLE;
+ case '#':
+ if (PTR2INT(clientData) & TK_OFFSET_RELATIVE) {
+ tsoffset.flags = TK_OFFSET_RELATIVE;
+ p++;
+ break;
+ }
+ goto badTSOffset;
+ case 'e':
+ switch(value[1]) {
+ case '\0':
+ tsoffset.flags = TK_OFFSET_RIGHT|TK_OFFSET_MIDDLE;
goto goodTSOffset;
case 'n':
- if ((value[1] != '\0') && (value[2] != '\0')) {
+ if (value[2]!='d' || value[3]!='\0') {
goto badTSOffset;
}
- switch(value[1]) {
- case '\0': tsoffset.flags = TK_OFFSET_CENTER|TK_OFFSET_TOP;
- goto goodTSOffset;
- case 'w': tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_TOP;
- goto goodTSOffset;
- case 'e': tsoffset.flags = TK_OFFSET_RIGHT|TK_OFFSET_TOP;
- goto goodTSOffset;
- }
+ tsoffset.flags = INT_MAX;
+ goto goodTSOffset;
+ }
+ case 'w':
+ if (value[1] != '\0') {goto badTSOffset;}
+ tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_MIDDLE;
+ goto goodTSOffset;
+ case 'n':
+ if ((value[1] != '\0') && (value[2] != '\0')) {
goto badTSOffset;
- case 's':
- if ((value[1] != '\0') && (value[2] != '\0')) {
- goto badTSOffset;
- }
- switch(value[1]) {
- case '\0': tsoffset.flags = TK_OFFSET_CENTER|TK_OFFSET_BOTTOM;
- goto goodTSOffset;
- case 'w': tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_BOTTOM;
- goto goodTSOffset;
- case 'e': tsoffset.flags = TK_OFFSET_RIGHT|TK_OFFSET_BOTTOM;
- goto goodTSOffset;
- }
+ }
+ switch(value[1]) {
+ case '\0':
+ tsoffset.flags = TK_OFFSET_CENTER|TK_OFFSET_TOP;
+ goto goodTSOffset;
+ case 'w':
+ tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_TOP;
+ goto goodTSOffset;
+ case 'e':
+ tsoffset.flags = TK_OFFSET_RIGHT|TK_OFFSET_TOP;
+ goto goodTSOffset;
+ }
+ goto badTSOffset;
+ case 's':
+ if ((value[1] != '\0') && (value[2] != '\0')) {
goto badTSOffset;
- case 'c':
- if (strncmp(value, "center", strlen(value)) != 0) {
- goto badTSOffset;
- }
- tsoffset.flags = TK_OFFSET_CENTER|TK_OFFSET_MIDDLE;
+ }
+ switch(value[1]) {
+ case '\0':
+ tsoffset.flags = TK_OFFSET_CENTER|TK_OFFSET_BOTTOM;
goto goodTSOffset;
+ case 'w':
+ tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_BOTTOM;
+ goto goodTSOffset;
+ case 'e':
+ tsoffset.flags = TK_OFFSET_RIGHT|TK_OFFSET_BOTTOM;
+ goto goodTSOffset;
+ }
+ goto badTSOffset;
+ case 'c':
+ if (strncmp(value, "center", strlen(value)) != 0) {
+ goto badTSOffset;
+ }
+ tsoffset.flags = TK_OFFSET_CENTER|TK_OFFSET_MIDDLE;
+ goto goodTSOffset;
}
if ((q = strchr(p,',')) == NULL) {
- if (((int)clientData) & TK_OFFSET_INDEX) {
+ if (PTR2INT(clientData) & TK_OFFSET_INDEX) {
if (Tcl_GetInt(interp, (char *) p, &tsoffset.flags) != TCL_OK) {
Tcl_ResetResult(interp);
goto badTSOffset;
@@ -349,33 +353,31 @@ TkOffsetParseProc(clientData, interp, tkwin, value, widgRec, offset)
if (result != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_GetPixels(interp, tkwin, (char *) q+1, &tsoffset.yoffset) != TCL_OK) {
+ if (Tk_GetPixels(interp, tkwin, (char*)q+1, &tsoffset.yoffset) != TCL_OK) {
return TCL_ERROR;
}
-
-goodTSOffset:
- /* below is a hack to allow the stipple/tile offset to be stored
- * in the internal tile structure. Most of the times, offsetPtr
- * is a pointer to an already existing tile structure. However
- * if this structure is not already created, we must do it
- * with Tk_GetTile()!!!!;
+ goodTSOffset:
+ /*
+ * Below is a hack to allow the stipple/tile offset to be stored in the
+ * internal tile structure. Most of the times, offsetPtr is a pointer to
+ * an already existing tile structure. However if this structure is not
+ * already created, we must do it with Tk_GetTile()!!!!;
*/
- memcpy(offsetPtr,&tsoffset, sizeof(Tk_TSOffset));
+ memcpy(offsetPtr, &tsoffset, sizeof(Tk_TSOffset));
return TCL_OK;
-badTSOffset:
+ badTSOffset:
Tcl_AppendResult(interp, "bad offset \"", value,
- "\": expected \"x,y\"", (char *) NULL);
- if (((int) clientData) & TK_OFFSET_RELATIVE) {
- Tcl_AppendResult(interp, ", \"#x,y\"", (char *) NULL);
+ "\": expected \"x,y\"", NULL);
+ if (PTR2INT(clientData) & TK_OFFSET_RELATIVE) {
+ Tcl_AppendResult(interp, ", \"#x,y\"", NULL);
}
- if (((int) clientData) & TK_OFFSET_INDEX) {
- Tcl_AppendResult(interp, ", <index>", (char *) NULL);
+ if (PTR2INT(clientData) & TK_OFFSET_INDEX) {
+ Tcl_AppendResult(interp, ", <index>", NULL);
}
- Tcl_AppendResult(interp, ", n, ne, e, se, s, sw, w, nw, or center",
- (char *) NULL);
+ Tcl_AppendResult(interp, ", n, ne, e, se, s, sw, w, nw, or center", NULL);
return TCL_ERROR;
}
@@ -393,60 +395,59 @@ badTSOffset:
*/
char *
-TkOffsetPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* not used */
- Tk_Window tkwin; /* not used */
- char *widgRec; /* Widget structure record */
- int offset; /* Offset of tile in record */
- Tcl_FreeProc **freeProcPtr; /* not used */
+TkOffsetPrintProc(
+ ClientData clientData, /* not used */
+ Tk_Window tkwin, /* not used */
+ char *widgRec, /* Widget structure record */
+ int offset, /* Offset of tile in record */
+ Tcl_FreeProc **freeProcPtr) /* not used */
{
- Tk_TSOffset *offsetPtr = (Tk_TSOffset *)(widgRec + offset);
+ Tk_TSOffset *offsetPtr = (Tk_TSOffset *) (widgRec + offset);
char *p, *q;
- if ((offsetPtr->flags) & TK_OFFSET_INDEX) {
- if ((offsetPtr->flags) >= INT_MAX) {
+ if (offsetPtr->flags & TK_OFFSET_INDEX) {
+ if (offsetPtr->flags >= INT_MAX) {
return "end";
}
p = (char *) ckalloc(32);
- sprintf(p, "%d",(offsetPtr->flags & (~TK_OFFSET_INDEX)));
+ sprintf(p, "%d", offsetPtr->flags & ~TK_OFFSET_INDEX);
*freeProcPtr = TCL_DYNAMIC;
return p;
}
- if ((offsetPtr->flags) & TK_OFFSET_TOP) {
- if ((offsetPtr->flags) & TK_OFFSET_LEFT) {
+ if (offsetPtr->flags & TK_OFFSET_TOP) {
+ if (offsetPtr->flags & TK_OFFSET_LEFT) {
return "nw";
- } else if ((offsetPtr->flags) & TK_OFFSET_CENTER) {
+ } else if (offsetPtr->flags & TK_OFFSET_CENTER) {
return "n";
- } else if ((offsetPtr->flags) & TK_OFFSET_RIGHT) {
+ } else if (offsetPtr->flags & TK_OFFSET_RIGHT) {
return "ne";
}
- } else if ((offsetPtr->flags) & TK_OFFSET_MIDDLE) {
- if ((offsetPtr->flags) & TK_OFFSET_LEFT) {
+ } else if (offsetPtr->flags & TK_OFFSET_MIDDLE) {
+ if (offsetPtr->flags & TK_OFFSET_LEFT) {
return "w";
- } else if ((offsetPtr->flags) & TK_OFFSET_CENTER) {
+ } else if (offsetPtr->flags & TK_OFFSET_CENTER) {
return "center";
- } else if ((offsetPtr->flags) & TK_OFFSET_RIGHT) {
+ } else if (offsetPtr->flags & TK_OFFSET_RIGHT) {
return "e";
}
- } else if ((offsetPtr->flags) & TK_OFFSET_BOTTOM) {
- if ((offsetPtr->flags) & TK_OFFSET_LEFT) {
+ } else if (offsetPtr->flags & TK_OFFSET_BOTTOM) {
+ if (offsetPtr->flags & TK_OFFSET_LEFT) {
return "sw";
- } else if ((offsetPtr->flags) & TK_OFFSET_CENTER) {
+ } else if (offsetPtr->flags & TK_OFFSET_CENTER) {
return "s";
- } else if ((offsetPtr->flags) & TK_OFFSET_RIGHT) {
+ } else if (offsetPtr->flags & TK_OFFSET_RIGHT) {
return "se";
}
- }
+ }
q = p = (char *) ckalloc(32);
- if ((offsetPtr->flags) & TK_OFFSET_RELATIVE) {
+ if (offsetPtr->flags & TK_OFFSET_RELATIVE) {
*q++ = '#';
}
- sprintf(q, "%d,%d",offsetPtr->xoffset, offsetPtr->yoffset);
+ sprintf(q, "%d,%d", offsetPtr->xoffset, offsetPtr->yoffset);
*freeProcPtr = TCL_DYNAMIC;
return p;
}
-
/*
*----------------------------------------------------------------------
*
@@ -458,23 +459,22 @@ TkOffsetPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*/
int
-TkPixelParseProc(clientData, interp, tkwin, value, widgRec, offset)
- ClientData clientData; /* if non-NULL, negative values are
- * allowed as well */
- Tcl_Interp *interp; /* Interpreter to send results back to */
- Tk_Window tkwin; /* Window on same display as tile */
- CONST char *value; /* Name of image */
- char *widgRec; /* Widget structure record */
- int offset; /* Offset of tile in record */
+TkPixelParseProc(
+ ClientData clientData, /* If non-NULL, negative values are allowed as
+ * well */
+ Tcl_Interp *interp, /* Interpreter to send results back to */
+ Tk_Window tkwin, /* Window on same display as tile */
+ const char *value, /* Name of image */
+ char *widgRec, /* Widget structure record */
+ int offset) /* Offset of tile in record */
{
- double *doublePtr = (double *)(widgRec + offset);
+ double *doublePtr = (double *) (widgRec + offset);
int result;
result = TkGetDoublePixels(interp, tkwin, value, doublePtr);
if ((result == TCL_OK) && (clientData == NULL) && (*doublePtr < 0.0)) {
- Tcl_AppendResult(interp, "bad screen distance \"", value,
- "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "bad screen distance \"", value, "\"", NULL);
return TCL_ERROR;
}
return result;
@@ -494,18 +494,17 @@ TkPixelParseProc(clientData, interp, tkwin, value, widgRec, offset)
*/
char *
-TkPixelPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
- ClientData clientData; /* not used */
- Tk_Window tkwin; /* not used */
- char *widgRec; /* Widget structure record */
- int offset; /* Offset of tile in record */
- Tcl_FreeProc **freeProcPtr; /* not used */
+TkPixelPrintProc(
+ ClientData clientData, /* not used */
+ Tk_Window tkwin, /* not used */
+ char *widgRec, /* Widget structure record */
+ int offset, /* Offset of tile in record */
+ Tcl_FreeProc **freeProcPtr) /* not used */
{
- double *doublePtr = (double *)(widgRec + offset);
- char *p;
+ double *doublePtr = (double *) (widgRec + offset);
+ char *p = (char *) ckalloc(24);
- p = (char *) ckalloc(24);
- Tcl_PrintDouble((Tcl_Interp *) NULL, *doublePtr, p);
+ Tcl_PrintDouble(NULL, *doublePtr, p);
*freeProcPtr = TCL_DYNAMIC;
return p;
}
@@ -515,31 +514,31 @@ TkPixelPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
*
* TkDrawInsetFocusHighlight --
*
- * This procedure draws a rectangular ring around the outside of
- * a widget to indicate that it has received the input focus. It
- * takes an additional padding argument that specifies how much
- * padding is present outside th widget.
+ * This function draws a rectangular ring around the outside of a widget
+ * to indicate that it has received the input focus. It takes an
+ * additional padding argument that specifies how much padding is present
+ * outside the widget.
*
* Results:
* None.
*
* Side effects:
- * A rectangle "width" pixels wide is drawn in "drawable",
- * corresponding to the outer area of "tkwin".
+ * A rectangle "width" pixels wide is drawn in "drawable", corresponding
+ * to the outer area of "tkwin".
*
*----------------------------------------------------------------------
*/
void
-TkDrawInsetFocusHighlight(tkwin, gc, width, drawable, padding)
- Tk_Window tkwin; /* Window whose focus highlight ring is
- * to be drawn. */
- GC gc; /* Graphics context to use for drawing
- * the highlight ring. */
- int width; /* Width of the highlight ring, in pixels. */
- Drawable drawable; /* Where to draw the ring (typically a
- * pixmap for double buffering). */
- int padding; /* Width of padding outside of widget. */
+TkDrawInsetFocusHighlight(
+ Tk_Window tkwin, /* Window whose focus highlight ring is to be
+ * drawn. */
+ GC gc, /* Graphics context to use for drawing the
+ * highlight ring. */
+ int width, /* Width of the highlight ring, in pixels. */
+ Drawable drawable, /* Where to draw the ring (typically a pixmap
+ * for double buffering). */
+ int padding) /* Width of padding outside of widget. */
{
XRectangle rects[4];
@@ -567,34 +566,34 @@ TkDrawInsetFocusHighlight(tkwin, gc, width, drawable, padding)
*
* Tk_DrawFocusHighlight --
*
- * This procedure draws a rectangular ring around the outside of
- * a widget to indicate that it has received the input focus.
+ * This function draws a rectangular ring around the outside of a widget
+ * to indicate that it has received the input focus.
*
- * This function is now deprecated. Use TkpDrawHighlightBorder instead,
- * since this function does not handle drawing the Focus ring properly
- * on the Macintosh - you need to know the background GC as well
- * as the foreground since the Mac focus ring separated from the widget
- * by a 1 pixel border.
+ * This function is now deprecated. Use TkpDrawHighlightBorder instead,
+ * since this function does not handle drawing the Focus ring properly on
+ * the Macintosh - you need to know the background GC as well as the
+ * foreground since the Mac focus ring separated from the widget by a 1
+ * pixel border.
*
* Results:
* None.
*
* Side effects:
- * A rectangle "width" pixels wide is drawn in "drawable",
- * corresponding to the outer area of "tkwin".
+ * A rectangle "width" pixels wide is drawn in "drawable", corresponding
+ * to the outer area of "tkwin".
*
*----------------------------------------------------------------------
*/
void
-Tk_DrawFocusHighlight(tkwin, gc, width, drawable)
- Tk_Window tkwin; /* Window whose focus highlight ring is
- * to be drawn. */
- GC gc; /* Graphics context to use for drawing
- * the highlight ring. */
- int width; /* Width of the highlight ring, in pixels. */
- Drawable drawable; /* Where to draw the ring (typically a
- * pixmap for double buffering). */
+Tk_DrawFocusHighlight(
+ Tk_Window tkwin, /* Window whose focus highlight ring is to be
+ * drawn. */
+ GC gc, /* Graphics context to use for drawing the
+ * highlight ring. */
+ int width, /* Width of the highlight ring, in pixels. */
+ Drawable drawable) /* Where to draw the ring (typically a pixmap
+ * for double buffering). */
{
TkDrawInsetFocusHighlight(tkwin, gc, width, drawable, 0);
}
@@ -604,19 +603,18 @@ Tk_DrawFocusHighlight(tkwin, gc, width, drawable)
*
* Tk_GetScrollInfo --
*
- * This procedure is invoked to parse "xview" and "yview"
- * scrolling commands for widgets using the new scrolling
- * command syntax ("moveto" or "scroll" options).
+ * This function is invoked to parse "xview" and "yview" scrolling
+ * commands for widgets using the new scrolling command syntax ("moveto"
+ * or "scroll" options).
*
* Results:
* The return value is either TK_SCROLL_MOVETO, TK_SCROLL_PAGES,
- * TK_SCROLL_UNITS, or TK_SCROLL_ERROR. This indicates whether
- * the command was successfully parsed and what form the command
- * took. If TK_SCROLL_MOVETO, *dblPtr is filled in with the
- * desired position; if TK_SCROLL_PAGES or TK_SCROLL_UNITS,
- * *intPtr is filled in with the number of lines to move (may be
- * negative); if TK_SCROLL_ERROR, the interp's result contains an
- * error message.
+ * TK_SCROLL_UNITS, or TK_SCROLL_ERROR. This indicates whether the
+ * command was successfully parsed and what form the command took. If
+ * TK_SCROLL_MOVETO, *dblPtr is filled in with the desired position; if
+ * TK_SCROLL_PAGES or TK_SCROLL_UNITS, *intPtr is filled in with the
+ * number of lines to move (may be negative); if TK_SCROLL_ERROR, the
+ * interp's result contains an error message.
*
* Side effects:
* None.
@@ -625,25 +623,22 @@ Tk_DrawFocusHighlight(tkwin, gc, width, drawable)
*/
int
-Tk_GetScrollInfo(interp, argc, argv, dblPtr, intPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- int argc; /* # arguments for command. */
- CONST char **argv; /* Arguments for command. */
- double *dblPtr; /* Filled in with argument "moveto"
- * option, if any. */
- int *intPtr; /* Filled in with number of pages
- * or lines to scroll, if any. */
+Tk_GetScrollInfo(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ int argc, /* # arguments for command. */
+ const char **argv, /* Arguments for command. */
+ double *dblPtr, /* Filled in with argument "moveto" option, if
+ * any. */
+ int *intPtr) /* Filled in with number of pages or lines to
+ * scroll, if any. */
{
- int c;
- size_t length;
+ int c = argv[2][0];
+ size_t length = strlen(argv[2]);
- length = strlen(argv[2]);
- c = argv[2][0];
if ((c == 'm') && (strncmp(argv[2], "moveto", length) == 0)) {
if (argc != 4) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " ", argv[1], " moveto fraction\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " ", argv[1], " moveto fraction\"", NULL);
return TK_SCROLL_ERROR;
}
if (Tcl_GetDouble(interp, argv[3], dblPtr) != TCL_OK) {
@@ -653,9 +648,8 @@ Tk_GetScrollInfo(interp, argc, argv, dblPtr, intPtr)
} else if ((c == 's')
&& (strncmp(argv[2], "scroll", length) == 0)) {
if (argc != 5) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " ", argv[1], " scroll number units|pages\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " ", argv[1], " scroll number units|pages\"", NULL);
return TK_SCROLL_ERROR;
}
if (Tcl_GetInt(interp, argv[3], intPtr) != TCL_OK) {
@@ -665,17 +659,16 @@ Tk_GetScrollInfo(interp, argc, argv, dblPtr, intPtr)
c = argv[4][0];
if ((c == 'p') && (strncmp(argv[4], "pages", length) == 0)) {
return TK_SCROLL_PAGES;
- } else if ((c == 'u')
- && (strncmp(argv[4], "units", length) == 0)) {
+ } else if ((c == 'u') && (strncmp(argv[4], "units", length) == 0)) {
return TK_SCROLL_UNITS;
- } else {
- Tcl_AppendResult(interp, "bad argument \"", argv[4],
- "\": must be units or pages", (char *) NULL);
- return TK_SCROLL_ERROR;
}
+
+ Tcl_AppendResult(interp, "bad argument \"", argv[4],
+ "\": must be units or pages", NULL);
+ return TK_SCROLL_ERROR;
}
Tcl_AppendResult(interp, "unknown option \"", argv[2],
- "\": must be moveto or scroll", (char *) NULL);
+ "\": must be moveto or scroll", NULL);
return TK_SCROLL_ERROR;
}
@@ -684,19 +677,18 @@ Tk_GetScrollInfo(interp, argc, argv, dblPtr, intPtr)
*
* Tk_GetScrollInfoObj --
*
- * This procedure is invoked to parse "xview" and "yview"
- * scrolling commands for widgets using the new scrolling
- * command syntax ("moveto" or "scroll" options).
+ * This function is invoked to parse "xview" and "yview" scrolling
+ * commands for widgets using the new scrolling command syntax ("moveto"
+ * or "scroll" options).
*
* Results:
* The return value is either TK_SCROLL_MOVETO, TK_SCROLL_PAGES,
- * TK_SCROLL_UNITS, or TK_SCROLL_ERROR. This indicates whether
- * the command was successfully parsed and what form the command
- * took. If TK_SCROLL_MOVETO, *dblPtr is filled in with the
- * desired position; if TK_SCROLL_PAGES or TK_SCROLL_UNITS,
- * *intPtr is filled in with the number of lines to move (may be
- * negative); if TK_SCROLL_ERROR, the interp's result contains an
- * error message.
+ * TK_SCROLL_UNITS, or TK_SCROLL_ERROR. This indicates whether the
+ * command was successfully parsed and what form the command took. If
+ * TK_SCROLL_MOVETO, *dblPtr is filled in with the desired position; if
+ * TK_SCROLL_PAGES or TK_SCROLL_UNITS, *intPtr is filled in with the
+ * number of lines to move (may be negative); if TK_SCROLL_ERROR, the
+ * interp's result contains an error message.
*
* Side effects:
* None.
@@ -705,23 +697,23 @@ Tk_GetScrollInfo(interp, argc, argv, dblPtr, intPtr)
*/
int
-Tk_GetScrollInfoObj(interp, objc, objv, dblPtr, intPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- int objc; /* # arguments for command. */
- Tcl_Obj *CONST objv[]; /* Arguments for command. */
- double *dblPtr; /* Filled in with argument "moveto"
- * option, if any. */
- int *intPtr; /* Filled in with number of pages
- * or lines to scroll, if any. */
+Tk_GetScrollInfoObj(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ int objc, /* # arguments for command. */
+ Tcl_Obj *const objv[], /* Arguments for command. */
+ double *dblPtr, /* Filled in with argument "moveto" option, if
+ * any. */
+ int *intPtr) /* Filled in with number of pages or lines to
+ * scroll, if any. */
{
- int c;
- size_t length;
- char *arg2, *arg4;
+ int length;
+ const char *arg;
+
+ arg = Tcl_GetStringFromObj(objv[2], &length);
- arg2 = Tcl_GetString(objv[2]);
- length = strlen(arg2);
- c = arg2[0];
- if ((c == 'm') && (strncmp(arg2, "moveto", length) == 0)) {
+#define ArgPfxEq(str) ((arg[0]==str[0])&&!strncmp(arg,str,(unsigned)length))
+
+ if (ArgPfxEq("moveto")) {
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "moveto fraction");
return TK_SCROLL_ERROR;
@@ -730,8 +722,7 @@ Tk_GetScrollInfoObj(interp, objc, objv, dblPtr, intPtr)
return TK_SCROLL_ERROR;
}
return TK_SCROLL_MOVETO;
- } else if ((c == 's')
- && (strncmp(arg2, "scroll", length) == 0)) {
+ } else if (ArgPfxEq("scroll")) {
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "scroll number units|pages");
return TK_SCROLL_ERROR;
@@ -739,22 +730,20 @@ Tk_GetScrollInfoObj(interp, objc, objv, dblPtr, intPtr)
if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
return TK_SCROLL_ERROR;
}
- arg4 = Tcl_GetString(objv[4]);
- length = (strlen(arg4));
- c = arg4[0];
- if ((c == 'p') && (strncmp(arg4, "pages", length) == 0)) {
+
+ arg = Tcl_GetStringFromObj(objv[4], &length);
+ if (ArgPfxEq("pages")) {
return TK_SCROLL_PAGES;
- } else if ((c == 'u')
- && (strncmp(arg4, "units", length) == 0)) {
+ } else if (ArgPfxEq("units")) {
return TK_SCROLL_UNITS;
- } else {
- Tcl_AppendResult(interp, "bad argument \"", arg4,
- "\": must be units or pages", (char *) NULL);
- return TK_SCROLL_ERROR;
}
+
+ Tcl_AppendResult(interp, "bad argument \"", arg,
+ "\": must be units or pages", NULL);
+ return TK_SCROLL_ERROR;
}
- Tcl_AppendResult(interp, "unknown option \"", arg2,
- "\": must be moveto or scroll", (char *) NULL);
+ Tcl_AppendResult(interp, "unknown option \"", arg,
+ "\": must be moveto or scroll", NULL);
return TK_SCROLL_ERROR;
}
@@ -764,66 +753,80 @@ Tk_GetScrollInfoObj(interp, objc, objv, dblPtr, intPtr)
* TkComputeAnchor --
*
* Determine where to place a rectangle so that it will be properly
- * anchored with respect to the given window. Used by widgets
- * to align a box of text inside a window. When anchoring with
- * respect to one of the sides, the rectangle be placed inside of
- * the internal border of the window.
+ * anchored with respect to the given window. Used by widgets to align a
+ * box of text inside a window. When anchoring with respect to one of the
+ * sides, the rectangle be placed inside of the internal border of the
+ * window.
*
* Results:
- * *xPtr and *yPtr set to the upper-left corner of the rectangle
- * anchored in the window.
+ * *xPtr and *yPtr set to the upper-left corner of the rectangle anchored
+ * in the window.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
+
void
-TkComputeAnchor(anchor, tkwin, padX, padY, innerWidth, innerHeight, xPtr, yPtr)
- Tk_Anchor anchor; /* Desired anchor. */
- Tk_Window tkwin; /* Anchored with respect to this window. */
- int padX, padY; /* Use this extra padding inside window, in
+TkComputeAnchor(
+ Tk_Anchor anchor, /* Desired anchor. */
+ Tk_Window tkwin, /* Anchored with respect to this window. */
+ int padX, int padY, /* Use this extra padding inside window, in
* addition to the internal border. */
- int innerWidth, innerHeight;/* Size of rectangle to anchor in window. */
- int *xPtr, *yPtr; /* Returns upper-left corner of anchored
+ int innerWidth, int innerHeight,
+ /* Size of rectangle to anchor in window. */
+ int *xPtr, int *yPtr) /* Returns upper-left corner of anchored
* rectangle. */
{
- switch (anchor) {
- case TK_ANCHOR_NW:
- case TK_ANCHOR_W:
- case TK_ANCHOR_SW:
- *xPtr = Tk_InternalBorderLeft(tkwin) + padX;
- break;
-
- case TK_ANCHOR_N:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_S:
- *xPtr = (Tk_Width(tkwin) - innerWidth) / 2;
- break;
-
- default:
- *xPtr = Tk_Width(tkwin) - (Tk_InternalBorderRight(tkwin) + padX)
- - innerWidth;
- break;
- }
+ /*
+ * Handle the horizontal parts.
+ */
switch (anchor) {
- case TK_ANCHOR_NW:
- case TK_ANCHOR_N:
- case TK_ANCHOR_NE:
- *yPtr = Tk_InternalBorderTop(tkwin) + padY;
- break;
-
- case TK_ANCHOR_W:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_E:
- *yPtr = (Tk_Height(tkwin) - innerHeight) / 2;
- break;
+ case TK_ANCHOR_NW:
+ case TK_ANCHOR_W:
+ case TK_ANCHOR_SW:
+ *xPtr = Tk_InternalBorderLeft(tkwin) + padX;
+ break;
+
+ case TK_ANCHOR_N:
+ case TK_ANCHOR_CENTER:
+ case TK_ANCHOR_S:
+ *xPtr = (Tk_Width(tkwin) - innerWidth - Tk_InternalBorderLeft(tkwin) -
+ Tk_InternalBorderRight(tkwin)) / 2 +
+ Tk_InternalBorderLeft(tkwin);
+ break;
+
+ default:
+ *xPtr = Tk_Width(tkwin) - Tk_InternalBorderRight(tkwin) - padX
+ - innerWidth;
+ break;
+ }
+
+ /*
+ * Handle the vertical parts.
+ */
- default:
- *yPtr = Tk_Height(tkwin) - Tk_InternalBorderBottom(tkwin) - padY
- - innerHeight;
- break;
+ switch (anchor) {
+ case TK_ANCHOR_NW:
+ case TK_ANCHOR_N:
+ case TK_ANCHOR_NE:
+ *yPtr = Tk_InternalBorderTop(tkwin) + padY;
+ break;
+
+ case TK_ANCHOR_W:
+ case TK_ANCHOR_CENTER:
+ case TK_ANCHOR_E:
+ *yPtr = (Tk_Height(tkwin) - innerHeight- Tk_InternalBorderTop(tkwin) -
+ Tk_InternalBorderBottom(tkwin)) / 2 +
+ Tk_InternalBorderTop(tkwin);
+ break;
+
+ default:
+ *yPtr = Tk_Height(tkwin) - Tk_InternalBorderBottom(tkwin) - padY
+ - innerHeight;
+ break;
}
}
@@ -835,10 +838,9 @@ TkComputeAnchor(anchor, tkwin, padX, padY, innerWidth, innerHeight, xPtr, yPtr)
* Given a lookup table, map a number to a string in the table.
*
* Results:
- * If numKey was equal to the numeric key of one of the elements
- * in the table, returns the string key of that element.
- * Returns NULL if numKey was not equal to any of the numeric keys
- * in the table.
+ * If numKey was equal to the numeric key of one of the elements in the
+ * table, returns the string key of that element. Returns NULL if numKey
+ * was not equal to any of the numeric keys in the table.
*
* Side effects.
* None.
@@ -847,13 +849,13 @@ TkComputeAnchor(anchor, tkwin, padX, padY, innerWidth, innerHeight, xPtr, yPtr)
*/
char *
-TkFindStateString(mapPtr, numKey)
- CONST TkStateMap *mapPtr; /* The state table. */
- int numKey; /* The key to try to find in the table. */
+TkFindStateString(
+ const TkStateMap *mapPtr, /* The state table. */
+ int numKey) /* The key to try to find in the table. */
{
- for ( ; mapPtr->strKey != NULL; mapPtr++) {
+ for (; mapPtr->strKey!=NULL ; mapPtr++) {
if (numKey == mapPtr->numKey) {
- return mapPtr->strKey;
+ return (char *) mapPtr->strKey;
}
}
return NULL;
@@ -862,17 +864,17 @@ TkFindStateString(mapPtr, numKey)
/*
*---------------------------------------------------------------------------
*
- * TkFindStateNum --
+ * TkFindStateNum, TkFindStateNumObj --
*
* Given a lookup table, map a string to a number in the table.
*
* Results:
- * If strKey was equal to the string keys of one of the elements
- * in the table, returns the numeric key of that element.
- * Returns the numKey associated with the last element (the NULL
- * string one) in the table if strKey was not equal to any of the
- * string keys in the table. In that case, an error message is
- * also left in the interp's result (if interp is not NULL).
+ * If strKey was equal to the string keys of one of the elements in the
+ * table, returns the numeric key of that element. Returns the numKey
+ * associated with the last element (the NULL string one) in the table if
+ * strKey was not equal to any of the string keys in the table. In that
+ * case, an error message is also left in the interp's result (if interp
+ * is not NULL).
*
* Side effects.
* None.
@@ -881,48 +883,66 @@ TkFindStateString(mapPtr, numKey)
*/
int
-TkFindStateNum(interp, option, mapPtr, strKey)
- Tcl_Interp *interp; /* Interp for error reporting. */
- CONST char *option; /* String to use when constructing error. */
- CONST TkStateMap *mapPtr; /* Lookup table. */
- CONST char *strKey; /* String to try to find in lookup table. */
+TkFindStateNum(
+ Tcl_Interp *interp, /* Interp for error reporting. */
+ const char *option, /* String to use when constructing error. */
+ const TkStateMap *mapPtr, /* Lookup table. */
+ const char *strKey) /* String to try to find in lookup table. */
{
- CONST TkStateMap *mPtr;
+ const TkStateMap *mPtr;
+
+ /*
+ * See if the value is in the state map.
+ */
for (mPtr = mapPtr; mPtr->strKey != NULL; mPtr++) {
if (strcmp(strKey, mPtr->strKey) == 0) {
return mPtr->numKey;
}
}
+
+ /*
+ * Not there. Generate an error message (if we can) and return the
+ * default.
+ */
+
if (interp != NULL) {
mPtr = mapPtr;
Tcl_AppendResult(interp, "bad ", option, " value \"", strKey,
- "\": must be ", mPtr->strKey, (char *) NULL);
+ "\": must be ", mPtr->strKey, NULL);
for (mPtr++; mPtr->strKey != NULL; mPtr++) {
- Tcl_AppendResult(interp,
- ((mPtr[1].strKey != NULL) ? ", " : ", or "),
- mPtr->strKey, (char *) NULL);
+ Tcl_AppendResult(interp,
+ ((mPtr[1].strKey != NULL) ? ", " : ", or "),
+ mPtr->strKey, NULL);
}
}
return mPtr->numKey;
}
int
-TkFindStateNumObj(interp, optionPtr, mapPtr, keyPtr)
- Tcl_Interp *interp; /* Interp for error reporting. */
- Tcl_Obj *optionPtr; /* String to use when constructing error. */
- CONST TkStateMap *mapPtr; /* Lookup table. */
- Tcl_Obj *keyPtr; /* String key to find in lookup table. */
+TkFindStateNumObj(
+ Tcl_Interp *interp, /* Interp for error reporting. */
+ Tcl_Obj *optionPtr, /* String to use when constructing error. */
+ const TkStateMap *mapPtr, /* Lookup table. */
+ Tcl_Obj *keyPtr) /* String key to find in lookup table. */
{
- CONST TkStateMap *mPtr;
- CONST char *key;
- CONST Tcl_ObjType *typePtr;
+ const TkStateMap *mPtr;
+ const char *key;
+ const Tcl_ObjType *typePtr;
+
+ /*
+ * See if the value is in the object cache.
+ */
if ((keyPtr->typePtr == &tkStateKeyObjType)
- && (keyPtr->internalRep.twoPtrValue.ptr1 == (VOID *) mapPtr)) {
- return (int) keyPtr->internalRep.twoPtrValue.ptr2;
+ && (keyPtr->internalRep.twoPtrValue.ptr1 == mapPtr)) {
+ return PTR2INT(keyPtr->internalRep.twoPtrValue.ptr2);
}
+ /*
+ * Not there. Look in the state map.
+ */
+
key = Tcl_GetStringFromObj(keyPtr, NULL);
for (mPtr = mapPtr; mPtr->strKey != NULL; mPtr++) {
if (strcmp(key, mPtr->strKey) == 0) {
@@ -930,168 +950,35 @@ TkFindStateNumObj(interp, optionPtr, mapPtr, keyPtr)
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
(*typePtr->freeIntRepProc)(keyPtr);
}
- keyPtr->internalRep.twoPtrValue.ptr1 = (VOID *) mapPtr;
- keyPtr->internalRep.twoPtrValue.ptr2 = (VOID *) mPtr->numKey;
- keyPtr->typePtr = &tkStateKeyObjType;
+ keyPtr->internalRep.twoPtrValue.ptr1 = (void *) mapPtr;
+ keyPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(mPtr->numKey);
+ keyPtr->typePtr = &tkStateKeyObjType;
return mPtr->numKey;
}
}
+
+ /*
+ * Not there either. Generate an error message (if we can) and return the
+ * default.
+ */
+
if (interp != NULL) {
mPtr = mapPtr;
- Tcl_AppendResult(interp, "bad ",
- Tcl_GetStringFromObj(optionPtr, NULL), " value \"", key,
- "\": must be ", mPtr->strKey, (char *) NULL);
+ Tcl_AppendResult(interp, "bad ", Tcl_GetString(optionPtr),
+ " value \"", key, "\": must be ", mPtr->strKey, NULL);
for (mPtr++; mPtr->strKey != NULL; mPtr++) {
- Tcl_AppendResult(interp,
- ((mPtr[1].strKey != NULL) ? ", " : ", or "),
- mPtr->strKey, (char *) NULL);
+ Tcl_AppendResult(interp,
+ ((mPtr[1].strKey != NULL) ? ", " : ", or "),
+ mPtr->strKey, NULL);
}
}
return mPtr->numKey;
}
-
-/*
- * For each exit handler created with a call to TkCreateExitHandler
- * there is a structure of the following type:
- */
-
-typedef struct ExitHandler {
- Tcl_ExitProc *proc; /* Procedure to call when process exits. */
- ClientData clientData; /* One word of information to pass to proc. */
- struct ExitHandler *nextPtr;/* Next in list of all exit handlers for
- * this application, or NULL for end of list. */
-} ExitHandler;
-
-/*
- * There is both per-process and per-thread exit handlers.
- * The first list is controlled by a mutex. The other is in
- * thread local storage.
- */
-
-static ExitHandler *firstExitPtr = NULL;
- /* First in list of all exit handlers for
- * application. */
-TCL_DECLARE_MUTEX(exitMutex)
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkCreateExitHandler --
- *
- * Same as Tcl_CreateExitHandler, but private to Tk.
- *
- * Results:
- * None.
- *
- * Side effects.
- * Sets a handler with Tcl_CreateExitHandler if this is the first call.
- *
- *---------------------------------------------------------------------------
- */
-
-void
-TkCreateExitHandler (proc, clientData)
- Tcl_ExitProc *proc; /* Procedure to invoke. */
- ClientData clientData; /* Arbitrary value to pass to proc. */
-{
- ExitHandler *exitPtr;
-
- exitPtr = (ExitHandler *) ckalloc(sizeof(ExitHandler));
- exitPtr->proc = proc;
- exitPtr->clientData = clientData;
- Tcl_MutexLock(&exitMutex);
- if (firstExitPtr == NULL) {
- Tcl_CreateExitHandler(TkFinalize, NULL);
- }
- exitPtr->nextPtr = firstExitPtr;
- firstExitPtr = exitPtr;
- Tcl_MutexUnlock(&exitMutex);
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkDeleteExitHandler --
- *
- * Same as Tcl_DeleteExitHandler, but private to Tk.
- *
- * Results:
- * None.
- *
- * Side effects.
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-void
-TkDeleteExitHandler (proc, clientData)
- Tcl_ExitProc *proc; /* Procedure that was previously registered. */
- ClientData clientData; /* Arbitrary value to pass to proc. */
-{
- ExitHandler *exitPtr, *prevPtr;
-
- Tcl_MutexLock(&exitMutex);
- for (prevPtr = NULL, exitPtr = firstExitPtr; exitPtr != NULL;
- prevPtr = exitPtr, exitPtr = exitPtr->nextPtr) {
- if ((exitPtr->proc == proc)
- && (exitPtr->clientData == clientData)) {
- if (prevPtr == NULL) {
- firstExitPtr = exitPtr->nextPtr;
- } else {
- prevPtr->nextPtr = exitPtr->nextPtr;
- }
- ckfree((char *) exitPtr);
- break;
- }
- }
- Tcl_MutexUnlock(&exitMutex);
- return;
-}
-
+
/*
- *---------------------------------------------------------------------------
- *
- * TkFinalize --
- *
- * Runs our private exit handlers and removes itself from Tcl. This is
- * benificial should we want to protect from dangling pointers should
- * the Tk shared library be unloaded prior to Tcl which can happen on
- * windows should the process be forcefully exiting from an exception
- * handler.
- *
- * Results:
- * None.
- *
- * Side effects.
- * None.
- *
- *---------------------------------------------------------------------------
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
*/
-
-void
-TkFinalize (clientData)
- ClientData clientData; /* Arbitrary value to pass to proc. */
-{
- ExitHandler *exitPtr;
-
- Tcl_DeleteExitHandler(TkFinalize, NULL);
-
- Tcl_MutexLock(&exitMutex);
- for (exitPtr = firstExitPtr; exitPtr != NULL; exitPtr = firstExitPtr) {
- /*
- * Be careful to remove the handler from the list before
- * invoking its callback. This protects us against
- * double-freeing if the callback should call
- * Tcl_DeleteExitHandler on itself.
- */
-
- firstExitPtr = exitPtr->nextPtr;
- Tcl_MutexUnlock(&exitMutex);
- (*exitPtr->proc)(exitPtr->clientData);
- ckfree((char *) exitPtr);
- Tcl_MutexLock(&exitMutex);
- }
- firstExitPtr = NULL;
- Tcl_MutexUnlock(&exitMutex);
-}
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 41d2060..ec8be11 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -1,29 +1,28 @@
-/*
+/*
* tkVisual.c --
*
- * This file contains library procedures for allocating and
- * freeing visuals and colormaps. This code is based on a
- * prototype implementation by Paul Mackerras.
+ * This file contains library procedures for allocating and freeing
+ * visuals and colormaps. This code is based on a prototype
+ * implementation by Paul Mackerras.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-#include "tkPort.h"
/*
- * The table below maps from symbolic names for visual classes
- * to the associated X class symbols.
+ * The table below maps from symbolic names for visual classes to the
+ * associated X class symbols.
*/
typedef struct VisualDictionary {
char *name; /* Textual name of class. */
- int minLength; /* Minimum # characters that must be
- * specified for an unambiguous match. */
+ int minLength; /* Minimum # characters that must be specified
+ * for an unambiguous match. */
int class; /* X symbol for class. */
} VisualDictionary;
static VisualDictionary visualNames[] = {
@@ -46,17 +45,16 @@ static VisualDictionary visualNames[] = {
struct TkColormap {
Colormap colormap; /* X's identifier for the colormap. */
- Visual *visual; /* Visual for which colormap was
- * allocated. */
+ Visual *visual; /* Visual for which colormap was allocated. */
int refCount; /* How many uses of the colormap are still
- * outstanding (calls to Tk_GetColormap
- * minus calls to Tk_FreeColormap). */
- int shareable; /* 0 means this colormap was allocated by
- * a call to Tk_GetColormap with "new",
- * implying that the window wants it all
- * for itself. 1 means that the colormap
- * was allocated as a default for a particular
- * visual, so it can be shared. */
+ * outstanding (calls to Tk_GetColormap minus
+ * calls to Tk_FreeColormap). */
+ int shareable; /* 0 means this colormap was allocated by a
+ * call to Tk_GetColormap with "new", implying
+ * that the window wants it all for itself. 1
+ * means that the colormap was allocated as a
+ * default for a particular visual, so it can
+ * be shared. */
struct TkColormap *nextPtr; /* Next in list of colormaps for this display,
* or NULL for end of list. */
};
@@ -66,17 +64,17 @@ struct TkColormap {
*
* Tk_GetVisual --
*
- * Given a string identifying a particular kind of visual, this
- * procedure returns a visual and depth that matches the specification.
+ * Given a string identifying a particular kind of visual, this procedure
+ * returns a visual and depth that matches the specification.
*
* Results:
- * The return value is normally a pointer to a visual. If an
- * error occurred in looking up the visual, NULL is returned and
- * an error message is left in the interp's result. The depth of the
- * visual is returned to *depthPtr under normal returns. If
- * colormapPtr is non-NULL, then this procedure also finds a
- * suitable colormap for use with the visual in tkwin, and it
- * returns that colormap in *colormapPtr unless an error occurs.
+ * The return value is normally a pointer to a visual. If an error
+ * occurred in looking up the visual, NULL is returned and an error
+ * message is left in the interp's result. The depth of the visual is
+ * returned to *depthPtr under normal returns. If colormapPtr is
+ * non-NULL, then this procedure also finds a suitable colormap for use
+ * with the visual in tkwin, and it returns that colormap in *colormapPtr
+ * unless an error occurs.
*
* Side effects:
* A new colormap may be allocated.
@@ -85,42 +83,40 @@ struct TkColormap {
*/
Visual *
-Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
- Tcl_Interp *interp; /* Interpreter to use for error
- * reporting. */
- Tk_Window tkwin; /* Window in which visual will be
- * used. */
- CONST char *string; /* String describing visual. See
- * manual entry for details. */
- int *depthPtr; /* The depth of the returned visual
- * is stored here. */
- Colormap *colormapPtr; /* If non-NULL, then a suitable
- * colormap for visual is placed here.
- * This colormap must eventually be
- * freed by calling Tk_FreeColormap. */
+Tk_GetVisual(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which visual will be used. */
+ CONST char *string, /* String describing visual. See manual entry
+ * for details. */
+ int *depthPtr, /* The depth of the returned visual is stored
+ * here. */
+ Colormap *colormapPtr) /* If non-NULL, then a suitable colormap for
+ * visual is placed here. This colormap must
+ * eventually be freed by calling
+ * Tk_FreeColormap. */
{
Tk_Window tkwin2;
XVisualInfo template, *visInfoList, *bestPtr;
long mask;
Visual *visual;
- int length, c, numVisuals, prio, bestPrio, i;
+ ptrdiff_t length;
+ int c, numVisuals, prio, bestPrio, i;
CONST char *p;
VisualDictionary *dictPtr;
TkColormap *cmapPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
/*
- * Parse string and set up a template for use in searching for
- * an appropriate visual.
+ * Parse string and set up a template for use in searching for an
+ * appropriate visual.
*/
c = string[0];
if (c == '.') {
/*
- * The string must be a window name. If the window is on the
- * same screen as tkwin, then just use its visual. Otherwise
- * use the information about the visual as a template for the
- * search.
+ * The string must be a window name. If the window is on the same
+ * screen as tkwin, then just use its visual. Otherwise use the
+ * information about the visual as a template for the search.
*/
tkwin2 = Tk_NameToWindow(interp, string, tkwin);
@@ -132,8 +128,8 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
*depthPtr = Tk_Depth(tkwin2);
if (colormapPtr != NULL) {
/*
- * Use the colormap from the other window too (but be sure
- * to increment its reference count if it's one of the ones
+ * Use the colormap from the other window too (but be sure to
+ * increment its reference count if it's one of the ones
* allocated here).
*/
@@ -173,21 +169,21 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
int visualId;
/*
- * This is a visual ID.
- */
+ * This is a visual ID.
+ */
if (Tcl_GetInt(interp, string, &visualId) == TCL_ERROR) {
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad X identifier for visual: ",
- string, "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "bad X identifier for visual: \"",
+ string, "\"", NULL);
return NULL;
}
template.visualid = visualId;
mask = VisualIDMask;
} else {
/*
- * Parse the string into a class name (or "best") optionally
- * followed by whitespace and a depth.
+ * Parse the string into a class name (or "best") optionally followed
+ * by whitespace and a depth.
*/
for (p = string; *p != 0; p++) {
@@ -207,11 +203,11 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
}
if (template.class == -1) {
Tcl_AppendResult(interp, "unknown or ambiguous visual name \"",
- string, "\": class must be ", (char *) NULL);
+ string, "\": class must be ", NULL);
for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) {
- Tcl_AppendResult(interp, dictPtr->name, ", ", (char *) NULL);
+ Tcl_AppendResult(interp, dictPtr->name, ", ", NULL);
}
- Tcl_AppendResult(interp, "or default", (char *) NULL);
+ Tcl_AppendResult(interp, "or default", NULL);
return NULL;
}
while (isspace(UCHAR(*p))) {
@@ -232,8 +228,8 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
}
/*
- * Find all visuals that match the template we've just created,
- * and return an error if there are none that match.
+ * Find all visuals that match the template we've just created, and return
+ * an error if there are none that match.
*/
template.screen = Tk_ScreenNumber(tkwin);
@@ -247,31 +243,37 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
}
/*
- * Search through the visuals that were returned to find the best
- * one. The choice is based on the following criteria, in decreasing
- * order of importance:
+ * Search through the visuals that were returned to find the best one.
+ * The choice is based on the following criteria, in decreasing order of
+ * importance:
*
- * 1. Depth: choose a visual with exactly the desired depth,
- * else one with more bits than requested but as few bits
- * as possible, else one with fewer bits but as many as
- * possible.
- * 2. Class: some visual classes are more desirable than others;
- * pick the visual with the most desirable class.
- * 3. Default: the default visual for the screen gets preference
- * over other visuals, all else being equal.
+ * 1. Depth: choose a visual with exactly the desired depth, else one with
+ * more bits than requested but as few bits as possible, else one with
+ * fewer bits but as many as possible.
+ * 2. Class: some visual classes are more desirable than others; pick the
+ * visual with the most desirable class.
+ * 3. Default: the default visual for the screen gets preference over
+ * other visuals, all else being equal.
*/
bestPrio = 0;
bestPtr = NULL;
for (i = 0; i < numVisuals; i++) {
switch (visInfoList[i].class) {
- case DirectColor: prio = 5; break;
- case GrayScale: prio = 1; break;
- case PseudoColor: prio = 7; break;
- case StaticColor: prio = 3; break;
- case StaticGray: prio = 1; break;
- case TrueColor: prio = 5; break;
- default: prio = 0; break;
+ case DirectColor:
+ prio = 5; break;
+ case GrayScale:
+ prio = 1; break;
+ case PseudoColor:
+ prio = 7; break;
+ case StaticColor:
+ prio = 3; break;
+ case StaticGray:
+ prio = 1; break;
+ case TrueColor:
+ prio = 5; break;
+ default:
+ prio = 0; break;
}
if (visInfoList[i].visual
== DefaultVisualOfScreen(Tk_Screen(tkwin))) {
@@ -295,7 +297,7 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
}
continue;
- newBest:
+ newBest:
bestPtr = &visInfoList[i];
bestPrio = prio;
}
@@ -304,11 +306,10 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
XFree((char *) visInfoList);
/*
- * If we need to find a colormap for this visual, do it now.
- * If the visual is the default visual for the screen, then
- * use the default colormap. Otherwise search for an existing
- * colormap that's shareable. If all else fails, create a new
- * colormap.
+ * If we need to find a colormap for this visual, do it now. If the visual
+ * is the default visual for the screen, then use the default colormap.
+ * Otherwise search for an existing colormap that's shareable. If all else
+ * fails, create a new colormap.
*/
if (colormapPtr != NULL) {
@@ -336,7 +337,7 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
}
}
- done:
+ done:
return visual;
}
@@ -345,31 +346,28 @@ Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
*
* Tk_GetColormap --
*
- * Given a string identifying a colormap, this procedure finds
- * an appropriate colormap.
+ * Given a string identifying a colormap, this procedure finds an
+ * appropriate colormap.
*
* Results:
* The return value is normally the X resource identifier for the
- * colormap. If an error occurs, None is returned and an error
- * message is placed in the interp's result.
+ * colormap. If an error occurs, None is returned and an error message is
+ * placed in the interp's result.
*
* Side effects:
- * A reference count is incremented for the colormap, so
- * Tk_FreeColormap must eventually be called exactly once for
- * each call to Tk_GetColormap.
+ * A reference count is incremented for the colormap, so Tk_FreeColormap
+ * must eventually be called exactly once for each call to
+ * Tk_GetColormap.
*
*----------------------------------------------------------------------
*/
Colormap
-Tk_GetColormap(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error
- * reporting. */
- Tk_Window tkwin; /* Window where colormap will be
- * used. */
- CONST char *string; /* String that identifies colormap:
- * either "new" or the name of
- * another window. */
+Tk_GetColormap(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window where colormap will be used. */
+ CONST char *string) /* String that identifies colormap: either
+ * "new" or the name of another window. */
{
Colormap colormap;
TkColormap *cmapPtr;
@@ -394,9 +392,9 @@ Tk_GetColormap(interp, tkwin, string)
}
/*
- * Use a colormap from an existing window. It must have the same
- * visual as tkwin (which means, among other things, that the
- * other window must be on the same screen).
+ * Use a colormap from an existing window. It must have the same visual as
+ * tkwin (which means, among other things, that the other window must be
+ * on the same screen).
*/
other = Tk_NameToWindow(interp, string, tkwin);
@@ -405,12 +403,12 @@ Tk_GetColormap(interp, tkwin, string)
}
if (Tk_Screen(other) != Tk_Screen(tkwin)) {
Tcl_AppendResult(interp, "can't use colormap for ", string,
- ": not on same screen", (char *) NULL);
+ ": not on same screen", NULL);
return None;
}
if (Tk_Visual(other) != Tk_Visual(tkwin)) {
Tcl_AppendResult(interp, "can't use colormap for ", string,
- ": incompatible visuals", (char *) NULL);
+ ": incompatible visuals", NULL);
return None;
}
colormap = Tk_Colormap(other);
@@ -434,41 +432,40 @@ Tk_GetColormap(interp, tkwin, string)
*
* Tk_FreeColormap --
*
- * This procedure is called to release a colormap that was
- * previously allocated by Tk_GetColormap.
+ * This procedure is called to release a colormap that was previously
+ * allocated by Tk_GetColormap.
*
* Results:
* None.
*
* Side effects:
- * The colormap's reference count is decremented. If this was the
- * last reference to the colormap, then the colormap is freed.
+ * The colormap's reference count is decremented. If this was the last
+ * reference to the colormap, then the colormap is freed.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreeColormap(display, colormap)
- Display *display; /* Display for which colormap was
- * allocated. */
- Colormap colormap; /* Colormap that is no longer needed.
- * Must have been returned by previous
- * call to Tk_GetColormap, or
- * preserved by a previous call to
- * Tk_PreserveColormap. */
+Tk_FreeColormap(
+ Display *display, /* Display for which colormap was
+ * allocated. */
+ Colormap colormap) /* Colormap that is no longer needed. Must
+ * have been returned by previous call to
+ * Tk_GetColormap, or preserved by a previous
+ * call to Tk_PreserveColormap. */
{
TkDisplay *dispPtr;
TkColormap *cmapPtr, *prevPtr;
/*
- * Find Tk's information about the display, then see if this
- * colormap is a non-default one (if it's a default one, there
- * won't be an entry for it in the display's list).
+ * Find Tk's information about the display, then see if this colormap is a
+ * non-default one (if it's a default one, there won't be an entry for it
+ * in the display's list).
*/
dispPtr = TkGetDisplay(display);
if (dispPtr == NULL) {
- panic("unknown display passed to Tk_FreeColormap");
+ Tcl_Panic("unknown display passed to Tk_FreeColormap");
}
for (prevPtr = NULL, cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
prevPtr = cmapPtr, cmapPtr = cmapPtr->nextPtr) {
@@ -485,7 +482,7 @@ Tk_FreeColormap(display, colormap)
}
return;
}
- }
+ }
}
/*
@@ -493,41 +490,40 @@ Tk_FreeColormap(display, colormap)
*
* Tk_PreserveColormap --
*
- * This procedure is called to indicate to Tk that the specified
- * colormap is being referenced from another location and should
- * not be freed until all extra references are eliminated. The
- * colormap must have been returned by Tk_GetColormap.
+ * This procedure is called to indicate to Tk that the specified colormap
+ * is being referenced from another location and should not be freed
+ * until all extra references are eliminated. The colormap must have been
+ * returned by Tk_GetColormap.
*
* Results:
* None.
*
* Side effects:
- * The colormap's reference count is incremented, so
- * Tk_FreeColormap must eventually be called exactly once for
- * each call to Tk_PreserveColormap.
+ * The colormap's reference count is incremented, so Tk_FreeColormap must
+ * eventually be called exactly once for each call to
+ * Tk_PreserveColormap.
*
*----------------------------------------------------------------------
*/
void
-Tk_PreserveColormap(display, colormap)
- Display *display; /* Display for which colormap was
- * allocated. */
- Colormap colormap; /* Colormap that should be
- * preserved. */
+Tk_PreserveColormap(
+ Display *display, /* Display for which colormap was
+ * allocated. */
+ Colormap colormap) /* Colormap that should be preserved. */
{
TkDisplay *dispPtr;
TkColormap *cmapPtr;
/*
- * Find Tk's information about the display, then see if this
- * colormap is a non-default one (if it's a default one, there
- * won't be an entry for it in the display's list).
+ * Find Tk's information about the display, then see if this colormap is a
+ * non-default one (if it's a default one, there won't be an entry for it
+ * in the display's list).
*/
dispPtr = TkGetDisplay(display);
if (dispPtr == NULL) {
- panic("unknown display passed to Tk_PreserveColormap");
+ Tcl_Panic("unknown display passed to Tk_PreserveColormap");
}
for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
cmapPtr = cmapPtr->nextPtr) {
@@ -535,5 +531,13 @@ Tk_PreserveColormap(display, colormap)
cmapPtr->refCount += 1;
return;
}
- }
+ }
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 422b27e..1ffdd56 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -1,30 +1,26 @@
-/*
+/*
* tkWindow.c --
*
- * This file provides basic window-manipulation procedures,
- * which are equivalent to procedures in Xlib (and even
- * invoke them) but also maintain the local Tk_Window
- * structure.
+ * This file provides basic window-manipulation functions, which are
+ * equivalent to functions in Xlib (and even invoke them) but also
+ * maintain the local Tk_Window structure.
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
-#if !( defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !( defined(__WIN32__) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif
-#include "tclInt.h" /* for Tcl_CreateNamespace() */
-
-/*
- * Type used to keep track of Window objects that were
- * only partically deallocated by Tk_DestroyWindow.
+/*
+ * Type used to keep track of Window objects that were only partially
+ * deallocated by Tk_DestroyWindow.
*/
#define HD_CLEANUP 1
@@ -39,34 +35,32 @@ typedef struct TkHalfdeadWindow {
struct TkHalfdeadWindow *nextPtr;
} TkHalfdeadWindow;
-
typedef struct ThreadSpecificData {
- int numMainWindows; /* Count of numver of main windows currently
- * open in this thread. */
+ int numMainWindows; /* Count of numver of main windows currently
+ * open in this thread. */
TkMainInfo *mainWindowList;
- /* First in list of all main windows managed
- * by this thread. */
+ /* First in list of all main windows managed
+ * by this thread. */
TkHalfdeadWindow *halfdeadWindowList;
- /* First in list of partially deallocated
- * windows. */
- TkDisplay *displayList;
- /* List of all displays currently in use by
- * the current thread. */
- int initialized; /* 0 means the structures above need
- * initializing. */
+ /* First in list of partially deallocated
+ * windows. */
+ TkDisplay *displayList; /* List of all displays currently in use by
+ * the current thread. */
+ int initialized; /* 0 means the structures above need
+ * initializing. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-/*
- * The Mutex below is used to lock access to the Tk_Uid structs above.
+/*
+ * The Mutex below is used to lock access to the Tk_Uid structs above.
*/
TCL_DECLARE_MUTEX(windowMutex)
/*
- * Default values for "changes" and "atts" fields of TkWindows. Note
- * that Tk always requests all events for all windows, except StructureNotify
- * events on internal windows: these events are generated internally.
+ * Default values for "changes" and "atts" fields of TkWindows. Note that Tk
+ * always requests all events for all windows, except StructureNotify events
+ * on internal windows: these events are generated internally.
*/
static XWindowChanges defChanges = {
@@ -95,21 +89,20 @@ static XSetWindowAttributes defAtts= {
};
/*
- * The following structure defines all of the commands supported by
- * Tk, and the C procedures that execute them.
+ * The following structure defines all of the commands supported by Tk, and
+ * the C functions that execute them.
*/
typedef struct {
char *name; /* Name of command. */
- Tcl_CmdProc *cmdProc; /* Command's string-based procedure. */
- Tcl_ObjCmdProc *objProc; /* Command's object-based procedure. */
- int isSafe; /* If !0, this command will be exposed in
- * a safe interpreter. Otherwise it will be
- * hidden in a safe interpreter. */
- int passMainWindow; /* 0 means provide NULL clientData to
- * command procedure; 1 means pass main
- * window as clientData to command
- * procedure. */
+ Tcl_CmdProc *cmdProc; /* Command's string-based function. */
+ Tcl_ObjCmdProc *objProc; /* Command's object-based function. */
+ int isSafe; /* If !0, this command will be exposed in a
+ * safe interpreter. Otherwise it will be
+ * hidden in a safe interpreter. */
+ int passMainWindow; /* 0 means provide NULL clientData to command
+ * function; 1 means pass main window as
+ * clientData to command function. */
} TkCmd;
static TkCmd commands[] = {
@@ -136,55 +129,81 @@ static TkCmd commands[] = {
{"selection", NULL, Tk_SelectionObjCmd, 0, 1},
{"tk", NULL, Tk_TkObjCmd, 1, 1},
{"tkwait", NULL, Tk_TkwaitObjCmd, 1, 1},
-#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
- {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, 0, 1},
- {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd, 0, 1},
- {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, 0, 1},
- {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, 0, 1},
-#endif
-#if defined(__WIN32__) || defined(MAC_OSX_TK)
- {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, 0, 1},
-#endif
{"update", NULL, Tk_UpdateObjCmd, 1, 1},
{"winfo", NULL, Tk_WinfoObjCmd, 1, 1},
{"wm", NULL, Tk_WmObjCmd, 0, 1},
/*
- * Widget class commands.
+ * Default widget class commands.
*/
{"button", NULL, Tk_ButtonObjCmd, 1, 0},
{"canvas", NULL, Tk_CanvasObjCmd, 1, 1},
{"checkbutton", NULL, Tk_CheckbuttonObjCmd, 1, 0},
- {"entry", NULL, Tk_EntryObjCmd, 1, 0},
+ {"entry", NULL, Tk_EntryObjCmd, 1, 0},
{"frame", NULL, Tk_FrameObjCmd, 1, 0},
{"label", NULL, Tk_LabelObjCmd, 1, 0},
{"labelframe", NULL, Tk_LabelframeObjCmd, 1, 0},
{"listbox", NULL, Tk_ListboxObjCmd, 1, 0},
- {"menubutton", NULL, Tk_MenubuttonObjCmd, 1, 0},
+ {"menubutton", NULL, Tk_MenubuttonObjCmd, 1, 0},
{"message", NULL, Tk_MessageObjCmd, 1, 0},
{"panedwindow", NULL, Tk_PanedWindowObjCmd, 1, 0},
{"radiobutton", NULL, Tk_RadiobuttonObjCmd, 1, 0},
- {"scale", NULL, Tk_ScaleObjCmd, 1, 0},
+ {"scale", NULL, Tk_ScaleObjCmd, 1, 0},
{"scrollbar", Tk_ScrollbarCmd, NULL, 1, 1},
- {"spinbox", NULL, Tk_SpinboxObjCmd, 1, 0},
- {"text", Tk_TextCmd, NULL, 1, 1},
+ {"spinbox", NULL, Tk_SpinboxObjCmd, 1, 0},
+ {"text", NULL, Tk_TextObjCmd, 1, 1},
{"toplevel", NULL, Tk_ToplevelObjCmd, 0, 0},
/*
+ * Classic widget class commands.
+ */
+
+ {"::tk::button", NULL, Tk_ButtonObjCmd, 1, 0},
+ {"::tk::canvas", NULL, Tk_CanvasObjCmd, 1, 1},
+ {"::tk::checkbutton",NULL, Tk_CheckbuttonObjCmd, 1, 0},
+ {"::tk::entry", NULL, Tk_EntryObjCmd, 1, 0},
+ {"::tk::frame", NULL, Tk_FrameObjCmd, 1, 0},
+ {"::tk::label", NULL, Tk_LabelObjCmd, 1, 0},
+ {"::tk::labelframe",NULL, Tk_LabelframeObjCmd, 1, 0},
+ {"::tk::listbox", NULL, Tk_ListboxObjCmd, 1, 0},
+ {"::tk::menubutton",NULL, Tk_MenubuttonObjCmd, 1, 0},
+ {"::tk::message", NULL, Tk_MessageObjCmd, 1, 0},
+ {"::tk::panedwindow",NULL, Tk_PanedWindowObjCmd, 1, 0},
+ {"::tk::radiobutton",NULL, Tk_RadiobuttonObjCmd, 1, 0},
+ {"::tk::scale", NULL, Tk_ScaleObjCmd, 1, 0},
+ {"::tk::scrollbar", Tk_ScrollbarCmd, NULL, 1, 1},
+ {"::tk::spinbox", NULL, Tk_SpinboxObjCmd, 1, 0},
+ {"::tk::text", NULL, Tk_TextObjCmd, 1, 1},
+ {"::tk::toplevel", NULL, Tk_ToplevelObjCmd, 0, 0},
+
+ /*
+ * Standard dialog support. Note that the Unix/X11 platform implements
+ * these commands differently (via the script library).
+ */
+
+#if defined(__WIN32__) || defined(MAC_OSX_TK)
+ {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, 0, 1},
+ {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd,0,1},
+ {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, 0, 1},
+ {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, 0, 1},
+ {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, 0, 1},
+#endif
+
+ /*
* Misc.
*/
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
{"::tk::unsupported::MacWindowStyle",
- NULL, TkUnsupported1ObjCmd, 1, 1},
+ NULL, TkUnsupported1ObjCmd, 1, 1},
#endif
- {(char *) NULL, (int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, CONST char **))) NULL, NULL, 0}
+ {NULL, NULL, NULL, 0, 0}
};
/*
- * The variables and table below are used to parse arguments from
- * the "argv" variable in Tk_Init.
+ * The variables and table below are used to parse arguments from the "argv"
+ * variable in Tk_Init.
*/
static int synchronize = 0;
@@ -197,62 +216,62 @@ static char *visual = NULL;
static int rest = 0;
static Tk_ArgvInfo argTable[] = {
- {"-colormap", TK_ARGV_STRING, (char *) NULL, (char *) &colormap,
+ {"-colormap", TK_ARGV_STRING, NULL, (char *) &colormap,
"Colormap for main window"},
- {"-display", TK_ARGV_STRING, (char *) NULL, (char *) &display,
+ {"-display", TK_ARGV_STRING, NULL, (char *) &display,
"Display to use"},
- {"-geometry", TK_ARGV_STRING, (char *) NULL, (char *) &geometry,
+ {"-geometry", TK_ARGV_STRING, NULL, (char *) &geometry,
"Initial geometry for window"},
- {"-name", TK_ARGV_STRING, (char *) NULL, (char *) &name,
+ {"-name", TK_ARGV_STRING, NULL, (char *) &name,
"Name to use for application"},
{"-sync", TK_ARGV_CONSTANT, (char *) 1, (char *) &synchronize,
"Use synchronous mode for display server"},
- {"-visual", TK_ARGV_STRING, (char *) NULL, (char *) &visual,
+ {"-visual", TK_ARGV_STRING, NULL, (char *) &visual,
"Visual for main window"},
- {"-use", TK_ARGV_STRING, (char *) NULL, (char *) &use,
+ {"-use", TK_ARGV_STRING, NULL, (char *) &use,
"Id of window in which to embed application"},
{"--", TK_ARGV_REST, (char *) 1, (char *) &rest,
"Pass all remaining arguments through to script"},
- {(char *) NULL, TK_ARGV_END, (char *) NULL, (char *) NULL,
- (char *) NULL}
+ {NULL, TK_ARGV_END, NULL, NULL, NULL}
};
/*
- * Forward declarations to procedures defined later in this file:
+ * Forward declarations to functions defined later in this file:
*/
-static Tk_Window CreateTopLevelWindow _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window parent, CONST char *name,
- CONST char *screenName, unsigned int flags));
-static void DeleteWindowsExitProc _ANSI_ARGS_((
- ClientData clientData));
-static TkDisplay * GetScreen _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *screenName, int *screenPtr));
-static int Initialize _ANSI_ARGS_((Tcl_Interp *interp));
-static int NameWindow _ANSI_ARGS_((Tcl_Interp *interp,
- TkWindow *winPtr, TkWindow *parentPtr,
- CONST char *name));
-static void UnlinkWindow _ANSI_ARGS_((TkWindow *winPtr));
+static Tk_Window CreateTopLevelWindow(Tcl_Interp *interp,
+ Tk_Window parent, CONST char *name,
+ CONST char *screenName, unsigned int flags);
+static void DeleteWindowsExitProc(ClientData clientData);
+static TkDisplay * GetScreen(Tcl_Interp *interp, CONST char *screenName,
+ int *screenPtr);
+static int Initialize(Tcl_Interp *interp);
+static int NameWindow(Tcl_Interp *interp, TkWindow *winPtr,
+ TkWindow *parentPtr, CONST char *name);
+static void UnlinkWindow(TkWindow *winPtr);
/*
*----------------------------------------------------------------------
*
* TkCloseDisplay --
- * Closing the display can lead to order of deletion problems.
- * We defer it until exit handling for Mac/Win, but since Unix can
- * use many displays, try and clean it up as best as possible.
+ *
+ * Closing the display can lead to order of deletion problems. We defer
+ * it until exit handling for Mac/Win, but since Unix can use many
+ * displays, try and clean it up as best as possible.
*
* Results:
* None.
*
* Side effects:
- * Resources associated with the display will be free.
- * The display may not be referenced at all after this.
+ * Resources associated with the display will be free. The display may
+ * not be referenced at all after this.
+ *
*----------------------------------------------------------------------
*/
static void
-TkCloseDisplay(TkDisplay *dispPtr)
+TkCloseDisplay(
+ TkDisplay *dispPtr)
{
TkClipCleanup(dispPtr);
@@ -269,8 +288,8 @@ TkCloseDisplay(TkDisplay *dispPtr)
if (dispPtr->errorPtr != NULL) {
TkErrorHandler *errorPtr;
for (errorPtr = dispPtr->errorPtr;
- errorPtr != NULL;
- errorPtr = dispPtr->errorPtr) {
+ errorPtr != NULL;
+ errorPtr = dispPtr->errorPtr) {
dispPtr->errorPtr = errorPtr->nextPtr;
ckfree((char *) errorPtr);
}
@@ -281,8 +300,8 @@ TkCloseDisplay(TkDisplay *dispPtr)
TkpCloseDisplay(dispPtr);
/*
- * Delete winTable after TkpCloseDisplay since special windows
- * may need call Tk_DestroyWindow and it checks the winTable.
+ * Delete winTable after TkpCloseDisplay since special windows may need
+ * call Tk_DestroyWindow and it checks the winTable.
*/
Tcl_DeleteHashTable(&dispPtr->winTable);
@@ -299,44 +318,42 @@ TkCloseDisplay(TkDisplay *dispPtr)
*
* CreateTopLevelWindow --
*
- * Make a new window that will be at top-level (its parent will
- * be the root window of a screen).
+ * Make a new window that will be at top-level (its parent will be the
+ * root window of a screen).
*
* Results:
- * The return value is a token for the new window, or NULL if
- * an error prevented the new window from being created. If
- * NULL is returned, an error message will be left in
- * the interp's result.
+ * The return value is a token for the new window, or NULL if an error
+ * prevented the new window from being created. If NULL is returned, an
+ * error message will be left in the interp's result.
*
* Side effects:
- * A new window structure is allocated locally. An X
- * window is NOT initially created, but will be created
- * the first time the window is mapped.
+ * A new window structure is allocated locally. An X window is NOT
+ * initially created, but will be created the first time the window is
+ * mapped.
*
*----------------------------------------------------------------------
*/
static Tk_Window
-CreateTopLevelWindow(interp, parent, name, screenName, flags)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window parent; /* Token for logical parent of new window
- * (used for naming, options, etc.). May
- * be NULL. */
- CONST char *name; /* Name for new window; if parent is
- * non-NULL, must be unique among parent's
- * children. */
- CONST char *screenName; /* Name of screen on which to create
- * window. NULL means use DISPLAY environment
- * variable to determine. Empty string means
- * use parent's screen, or DISPLAY if no
+CreateTopLevelWindow(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window parent, /* Token for logical parent of new window
+ * (used for naming, options, etc.). May be
+ * NULL. */
+ CONST char *name, /* Name for new window; if parent is non-NULL,
+ * must be unique among parent's children. */
+ CONST char *screenName, /* Name of screen on which to create window.
+ * NULL means use DISPLAY environment variable
+ * to determine. Empty string means use
+ * parent's screen, or DISPLAY if no
* parent. */
- unsigned int flags; /* Additional flags to set on the window. */
+ unsigned int flags) /* Additional flags to set on the window. */
{
register TkWindow *winPtr;
register TkDisplay *dispPtr;
int screenId;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
@@ -354,16 +371,6 @@ CreateTopLevelWindow(interp, parent, name, screenName, flags)
Tk_CreatePhotoImageFormat(&tkImgFmtGIF);
Tk_CreatePhotoImageFormat(&tkImgFmtPPM);
-
- /*
- * Create exit handler to delete all windows when the application
- * exits. This must be a thread exit handler, but there may be
- * ordering issues with other exit handlers
- * (i.e. OptionThreadExitProc).
- */
-
- Tcl_CreateThreadExitHandler(DeleteWindowsExitProc,
- (ClientData) tsdPtr);
}
if ((parent != NULL) && (screenName != NULL) && (screenName[0] == '\0')) {
@@ -381,28 +388,29 @@ CreateTopLevelWindow(interp, parent, name, screenName, flags)
/*
* Set the flags specified in the call.
*/
+
winPtr->flags |= flags;
-
+
/*
- * Force the window to use a border pixel instead of border pixmap.
- * This is needed for the case where the window doesn't use the
- * default visual. In this case, the default border is a pixmap
- * inherited from the root window, which won't work because it will
- * have the wrong visual.
+ * Force the window to use a border pixel instead of border pixmap. This
+ * is needed for the case where the window doesn't use the default visual.
+ * In this case, the default border is a pixmap inherited from the root
+ * window, which won't work because it will have the wrong visual.
*/
winPtr->dirtyAtts |= CWBorderPixel;
/*
- * (Need to set the TK_TOP_HIERARCHY flag immediately here; otherwise
- * Tk_DestroyWindow will core dump if it is called before the flag
- * has been set.)
+ * (Need to set the TK_TOP_HIERARCHY flag immediately here; otherwise
+ * Tk_DestroyWindow will core dump if it is called before the flag has
+ * been set.)
*/
- winPtr->flags |= TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
+ winPtr->flags |=
+ TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
if (parent != NULL) {
- if (NameWindow(interp, winPtr, (TkWindow *) parent, name) != TCL_OK) {
+ if (NameWindow(interp, winPtr, (TkWindow *) parent, name) != TCL_OK) {
Tk_DestroyWindow((Tk_Window) winPtr);
return (Tk_Window) NULL;
}
@@ -417,44 +425,40 @@ CreateTopLevelWindow(interp, parent, name, screenName, flags)
*
* GetScreen --
*
- * Given a string name for a display-plus-screen, find the
- * TkDisplay structure for the display and return the screen
- * number too.
+ * Given a string name for a display-plus-screen, find the TkDisplay
+ * structure for the display and return the screen number too.
*
* Results:
- * The return value is a pointer to information about the display,
- * or NULL if the display couldn't be opened. In this case, an
- * error message is left in the interp's result. The location at
- * *screenPtr is overwritten with the screen number parsed from
- * screenName.
+ * The return value is a pointer to information about the display, or
+ * NULL if the display couldn't be opened. In this case, an error message
+ * is left in the interp's result. The location at *screenPtr is
+ * overwritten with the screen number parsed from screenName.
*
* Side effects:
- * A new connection is opened to the display if there is no
- * connection already. A new TkDisplay data structure is also
- * setup, if necessary.
+ * A new connection is opened to the display if there is no connection
+ * already. A new TkDisplay data structure is also setup, if necessary.
*
*----------------------------------------------------------------------
*/
static TkDisplay *
-GetScreen(interp, screenName, screenPtr)
- Tcl_Interp *interp; /* Place to leave error message. */
- CONST char *screenName; /* Name for screen. NULL or empty means
- * use DISPLAY envariable. */
- int *screenPtr; /* Where to store screen number. */
+GetScreen(
+ Tcl_Interp *interp, /* Place to leave error message. */
+ CONST char *screenName, /* Name for screen. NULL or empty means use
+ * DISPLAY envariable. */
+ int *screenPtr) /* Where to store screen number. */
{
register TkDisplay *dispPtr;
CONST char *p;
int screenId;
size_t length;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Separate the screen number from the rest of the display
- * name. ScreenName is assumed to have the syntax
- * <display>.<screen> with the dot and the screen being
- * optional.
+ * Separate the screen number from the rest of the display name.
+ * ScreenName is assumed to have the syntax <display>.<screen> with the
+ * dot and the screen being optional.
*/
screenName = TkGetDefaultScreenName(interp, screenName);
@@ -462,7 +466,7 @@ GetScreen(interp, screenName, screenPtr)
Tcl_SetResult(interp,
"no display name and no $DISPLAY environment variable",
TCL_STATIC);
- return (TkDisplay *) NULL;
+ return NULL;
}
length = strlen(screenName);
screenId = 0;
@@ -472,26 +476,27 @@ GetScreen(interp, screenName, screenPtr)
}
if ((*p == '.') && (p[1] != '\0')) {
length = p - screenName;
- screenId = strtoul(p+1, (char **) NULL, 10);
+ screenId = strtoul(p+1, NULL, 10);
}
/*
- * See if we already have a connection to this display. If not,
- * then open a new connection.
+ * See if we already have a connection to this display. If not, then open
+ * a new connection.
*/
for (dispPtr = tsdPtr->displayList; ; dispPtr = dispPtr->nextPtr) {
if (dispPtr == NULL) {
/*
- * The private function zeros out dispPtr when it is created,
- * so we only need to initialize the non-zero items.
+ * The private function zeros out dispPtr when it is created, so
+ * we only need to initialize the non-zero items.
*/
+
dispPtr = TkpOpenDisplay(screenName);
if (dispPtr == NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't connect to display \"",
- screenName, "\"", (char *) NULL);
- return (TkDisplay *) NULL;
+ screenName, "\"", NULL);
+ return NULL;
}
dispPtr->nextPtr = tsdPtr->displayList; /* TkGetDisplayList(); */
tsdPtr->displayList = dispPtr;
@@ -501,10 +506,12 @@ GetScreen(interp, screenName, screenPtr)
dispPtr->cursorFont = None;
dispPtr->warpWindow = None;
dispPtr->multipleAtom = None;
+
/*
* By default we do want to collapse motion events in
* Tk_QueueWindowEvent.
*/
+
dispPtr->flags |= TK_DISPLAY_COLLAPSE_MOTION_EVENTS;
Tcl_InitHashTable(&dispPtr->winTable, TCL_ONE_WORD_KEYS);
@@ -523,10 +530,10 @@ GetScreen(interp, screenName, screenPtr)
}
if (screenId >= ScreenCount(dispPtr->display)) {
char buf[32 + TCL_INTEGER_SPACE];
-
+
sprintf(buf, "bad screen number \"%d\"", screenId);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return (TkDisplay *) NULL;
+ return NULL;
}
*screenPtr = screenId;
return dispPtr;
@@ -537,26 +544,26 @@ GetScreen(interp, screenName, screenPtr)
*
* TkGetDisplay --
*
- * Given an X display, TkGetDisplay returns the TkDisplay
- * structure for the display.
+ * Given an X display, TkGetDisplay returns the TkDisplay structure for
+ * the display.
*
* Results:
- * The return value is a pointer to information about the display,
- * or NULL if the display did not have a TkDisplay structure.
+ * The return value is a pointer to information about the display, or
+ * NULL if the display did not have a TkDisplay structure.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
TkDisplay *
-TkGetDisplay(display)
- Display *display; /* X's display pointer */
+TkGetDisplay(
+ Display *display) /* X's display pointer */
{
TkDisplay *dispPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (dispPtr = tsdPtr->displayList; dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
@@ -572,24 +579,25 @@ TkGetDisplay(display)
*
* TkGetDisplayList --
*
- * This procedure returns a pointer to the thread-local
- * list of TkDisplays corresponding to the open displays.
+ * This function returns a pointer to the thread-local list of TkDisplays
+ * corresponding to the open displays.
*
* Results:
- * The return value is a pointer to the first TkDisplay
- * structure in thread-local-storage.
+ * The return value is a pointer to the first TkDisplay structure in
+ * thread-local-storage.
*
* Side effects:
- * None.
+ * None.
*
*--------------------------------------------------------------
*/
+
TkDisplay *
-TkGetDisplayList()
+TkGetDisplayList(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
return tsdPtr->displayList;
}
@@ -598,25 +606,25 @@ TkGetDisplayList()
*
* TkGetMainInfoList --
*
- * This procedure returns a pointer to the list of structures
- * containing information about all main windows for the
- * current thread.
+ * This function returns a pointer to the list of structures containing
+ * information about all main windows for the current thread.
*
* Results:
- * The return value is a pointer to the first TkMainInfo
- * structure in thread local storage.
+ * The return value is a pointer to the first TkMainInfo structure in
+ * thread local storage.
*
* Side effects:
- * None.
+ * None.
*
*--------------------------------------------------------------
*/
+
TkMainInfo *
-TkGetMainInfoList()
+TkGetMainInfoList(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
return tsdPtr->mainWindowList;
}
/*
@@ -624,7 +632,7 @@ TkGetMainInfoList()
*
* TkAllocWindow --
*
- * This procedure creates and initializes a TkWindow structure.
+ * This function creates and initializes a TkWindow structure.
*
* Results:
* The return value is a pointer to the new window.
@@ -637,13 +645,12 @@ TkGetMainInfoList()
*/
TkWindow *
-TkAllocWindow(dispPtr, screenNum, parentPtr)
- TkDisplay *dispPtr; /* Display associated with new window. */
- int screenNum; /* Index of screen for new window. */
- TkWindow *parentPtr; /* Parent from which this window should
- * inherit visual information. NULL means
- * use screen defaults instead of
- * inheriting. */
+TkAllocWindow(
+ TkDisplay *dispPtr, /* Display associated with new window. */
+ int screenNum, /* Index of screen for new window. */
+ TkWindow *parentPtr) /* Parent from which this window should
+ * inherit visual information. NULL means use
+ * screen defaults instead of inheriting. */
{
register TkWindow *winPtr;
@@ -709,41 +716,41 @@ TkAllocWindow(dispPtr, screenNum, parentPtr)
*
* NameWindow --
*
- * This procedure is invoked to give a window a name and insert
- * the window into the hierarchy associated with a particular
- * application.
+ * This function is invoked to give a window a name and insert the window
+ * into the hierarchy associated with a particular application.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
- * See above.
+ * See above.
*
*----------------------------------------------------------------------
*/
static int
-NameWindow(interp, winPtr, parentPtr, name)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- register TkWindow *winPtr; /* Window that is to be named and inserted. */
- TkWindow *parentPtr; /* Pointer to logical parent for winPtr
- * (used for naming, options, etc.). */
- CONST char *name; /* Name for winPtr; must be unique among
+NameWindow(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ register TkWindow *winPtr, /* Window that is to be named and inserted. */
+ TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used
+ * for naming, options, etc.). */
+ CONST char *name) /* Name for winPtr; must be unique among
* parentPtr's children. */
{
#define FIXED_SIZE 200
char staticSpace[FIXED_SIZE];
char *pathName;
- int new;
+ int isNew;
Tcl_HashEntry *hPtr;
- int length1, length2;
+ size_t length1, length2;
/*
* Setup all the stuff except name right away, then do the name stuff
- * last. This is so that if the name stuff fails, everything else
- * will be properly initialized (needed to destroy the window cleanly
- * after the naming failure).
+ * last. This is so that if the name stuff fails, everything else will be
+ * properly initialized (needed to destroy the window cleanly after the
+ * naming failure).
*/
+
winPtr->parentPtr = parentPtr;
winPtr->nextPtr = NULL;
if (parentPtr->childList == NULL) {
@@ -759,6 +766,7 @@ NameWindow(interp, winPtr, parentPtr, name)
* If this is an anonymous window (ie, it has no name), just return OK
* now.
*/
+
if (winPtr->flags & TK_ANONYMOUS_WINDOW) {
return TCL_OK;
}
@@ -770,22 +778,21 @@ NameWindow(interp, winPtr, parentPtr, name)
winPtr->nameUid = Tk_GetUid(name);
/*
- * Don't permit names that start with an upper-case letter: this
- * will just cause confusion with class names in the option database.
+ * Don't permit names that start with an upper-case letter: this will just
+ * cause confusion with class names in the option database.
*/
if (isupper(UCHAR(name[0]))) {
Tcl_AppendResult(interp,
"window name starts with an upper-case letter: \"",
- name, "\"", (char *) NULL);
+ name, "\"", NULL);
return TCL_ERROR;
}
/*
- * To permit names of arbitrary length, must be prepared to malloc
- * a buffer to hold the new path name. To run fast in the common
- * case where names are short, use a fixed-size buffer on the
- * stack.
+ * To permit names of arbitrary length, must be prepared to malloc a
+ * buffer to hold the new path name. To run fast in the common case where
+ * names are short, use a fixed-size buffer on the stack.
*/
length1 = strlen(parentPtr->pathName);
@@ -803,13 +810,14 @@ NameWindow(interp, winPtr, parentPtr, name)
pathName[length1] = '.';
strcpy(pathName+length1+1, name);
}
- hPtr = Tcl_CreateHashEntry(&parentPtr->mainPtr->nameTable, pathName, &new);
+ hPtr = Tcl_CreateHashEntry(&parentPtr->mainPtr->nameTable, pathName,
+ &isNew);
if (pathName != staticSpace) {
ckfree(pathName);
}
- if (!new) {
+ if (!isNew) {
Tcl_AppendResult(interp, "window name \"", name,
- "\" already exists in parent", (char *) NULL);
+ "\" already exists in parent", NULL);
return TCL_ERROR;
}
Tcl_SetHashValue(hPtr, winPtr);
@@ -822,53 +830,50 @@ NameWindow(interp, winPtr, parentPtr, name)
*
* TkCreateMainWindow --
*
- * Make a new main window. A main window is a special kind of
- * top-level window used as the outermost window in an
- * application.
+ * Make a new main window. A main window is a special kind of top-level
+ * window used as the outermost window in an application.
*
* Results:
- * The return value is a token for the new window, or NULL if
- * an error prevented the new window from being created. If
- * NULL is returned, an error message will be left in
- * the interp's result.
+ * The return value is a token for the new window, or NULL if an error
+ * prevented the new window from being created. If NULL is returned, an
+ * error message will be left in the interp's result.
*
* Side effects:
- * A new window structure is allocated locally; "interp" is
- * associated with the window and registered for "send" commands
- * under "baseName". BaseName may be extended with an instance
- * number in the form "#2" if necessary to make it globally
- * unique. Tk-related commands are bound into interp.
+ * A new window structure is allocated locally; "interp" is associated
+ * with the window and registered for "send" commands under "baseName".
+ * BaseName may be extended with an instance number in the form "#2" if
+ * necessary to make it globally unique. Tk-related commands are bound
+ * into interp.
*
*----------------------------------------------------------------------
*/
Tk_Window
-TkCreateMainWindow(interp, screenName, baseName)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- CONST char *screenName; /* Name of screen on which to create
- * window. Empty or NULL string means
- * use DISPLAY environment variable. */
- char *baseName; /* Base name for application; usually of the
+TkCreateMainWindow(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ CONST char *screenName, /* Name of screen on which to create window.
+ * Empty or NULL string means use DISPLAY
+ * environment variable. */
+ char *baseName) /* Base name for application; usually of the
* form "prog instance". */
{
Tk_Window tkwin;
- int dummy;
- int isSafe;
+ int dummy, isSafe;
Tcl_HashEntry *hPtr;
register TkMainInfo *mainPtr;
register TkWindow *winPtr;
register TkCmd *cmdPtr;
ClientData clientData;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
/*
- * Panic if someone updated the TkWindow structure without
- * also updating the Tk_FakeWin structure (or vice versa).
+ * Panic if someone updated the TkWindow structure without also updating
+ * the Tk_FakeWin structure (or vice versa).
*/
if (sizeof(TkWindow) != sizeof(Tk_FakeWin)) {
- panic("TkWindow and Tk_FakeWin are not the same size");
+ Tcl_Panic("TkWindow and Tk_FakeWin are not the same size");
}
/*
@@ -880,10 +885,10 @@ TkCreateMainWindow(interp, screenName, baseName)
if (tkwin == NULL) {
return NULL;
}
-
+
/*
- * Create the TkMainInfo structure for this application, and set
- * up name-related information for the new window.
+ * Create the TkMainInfo structure for this application, and set up
+ * name-related information for the new window.
*/
winPtr = (TkWindow *) tkwin;
@@ -911,8 +916,8 @@ TkCreateMainWindow(interp, screenName, baseName)
Tcl_ResetResult(interp);
}
if (Tcl_LinkVar(interp, "::tk::AlwaysShowSelection",
- (char *) &mainPtr->alwaysShowSelection,
- TCL_LINK_BOOLEAN) != TCL_OK) {
+ (char *) &mainPtr->alwaysShowSelection,
+ TCL_LINK_BOOLEAN) != TCL_OK) {
Tcl_ResetResult(interp);
}
mainPtr->nextPtr = tsdPtr->mainWindowList;
@@ -923,8 +928,8 @@ TkCreateMainWindow(interp, screenName, baseName)
winPtr->pathName = Tcl_GetHashKey(&mainPtr->nameTable, hPtr);
/*
- * We have just created another Tk application; increment the refcount
- * on the display pointer.
+ * We have just created another Tk application; increment the refcount on
+ * the display pointer.
*/
winPtr->dispPtr->refCount++;
@@ -942,7 +947,7 @@ TkCreateMainWindow(interp, screenName, baseName)
isSafe = Tcl_IsSafe(interp);
for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) {
- panic("TkCreateMainWindow: builtin command with NULL string and object procs");
+ Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
if (cmdPtr->passMainWindow) {
clientData = (ClientData) tkwin;
@@ -956,11 +961,11 @@ TkCreateMainWindow(interp, screenName, baseName)
Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
clientData, NULL);
}
- if (isSafe) {
- if (!(cmdPtr->isSafe)) {
- Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
- }
- }
+ if (isSafe) {
+ if (!(cmdPtr->isSafe)) {
+ Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
+ }
+ }
}
TkCreateMenuCmd(interp);
@@ -981,36 +986,35 @@ TkCreateMainWindow(interp, screenName, baseName)
*
* Tk_CreateWindow --
*
- * Create a new internal or top-level window as a child of an
- * existing window.
+ * Create a new internal or top-level window as a child of an existing
+ * window.
*
* Results:
- * The return value is a token for the new window. This
- * is not the same as X's token for the window. If an error
- * occurred in creating the window (e.g. no such display or
- * screen), then an error message is left in the interp's result and
- * NULL is returned.
+ * The return value is a token for the new window. This is not the same
+ * as X's token for the window. If an error occurred in creating the
+ * window (e.g. no such display or screen), then an error message is left
+ * in the interp's result and NULL is returned.
*
* Side effects:
- * A new window structure is allocated locally. An X
- * window is not initially created, but will be created
- * the first time the window is mapped.
+ * A new window structure is allocated locally. An X window is not
+ * initially created, but will be created the first time the window is
+ * mapped.
*
*--------------------------------------------------------------
*/
Tk_Window
-Tk_CreateWindow(interp, parent, name, screenName)
- Tcl_Interp *interp; /* Interpreter to use for error reporting.
+Tk_CreateWindow(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting.
* the interp's result is assumed to be
* initialized by the caller. */
- Tk_Window parent; /* Token for parent of new window. */
- CONST char *name; /* Name for new window. Must be unique
- * among parent's children. */
- CONST char *screenName; /* If NULL, new window will be internal on
- * same screen as its parent. If non-NULL,
- * gives name of screen on which to create
- * new window; window will be a top-level
+ Tk_Window parent, /* Token for parent of new window. */
+ CONST char *name, /* Name for new window. Must be unique among
+ * parent's children. */
+ CONST char *screenName) /* If NULL, new window will be internal on
+ * same screen as its parent. If non-NULL,
+ * gives name of screen on which to create new
+ * window; window will be a top-level
* window. */
{
TkWindow *parentPtr = (TkWindow *) parent;
@@ -1018,29 +1022,26 @@ Tk_CreateWindow(interp, parent, name, screenName)
if ((parentPtr != NULL) && (parentPtr->flags & TK_ALREADY_DEAD)) {
Tcl_AppendResult(interp,
- "can't create window: parent has been destroyed",
- (char *) NULL);
+ "can't create window: parent has been destroyed", NULL);
return NULL;
} else if ((parentPtr != NULL) &&
(parentPtr->flags & TK_CONTAINER)) {
Tcl_AppendResult(interp,
- "can't create window: its parent has -container = yes",
- (char *) NULL);
+ "can't create window: its parent has -container = yes", NULL);
return NULL;
}
+
if (screenName == NULL) {
winPtr = TkAllocWindow(parentPtr->dispPtr, parentPtr->screenNum,
parentPtr);
if (NameWindow(interp, winPtr, parentPtr, name) != TCL_OK) {
Tk_DestroyWindow((Tk_Window) winPtr);
return NULL;
- } else {
- return (Tk_Window) winPtr;
}
- } else {
- return CreateTopLevelWindow(interp, parent, name, screenName,
- /* flags */ 0);
+ return (Tk_Window) winPtr;
}
+ return CreateTopLevelWindow(interp, parent, name, screenName,
+ /* flags */ 0);
}
/*
@@ -1048,35 +1049,34 @@ Tk_CreateWindow(interp, parent, name, screenName)
*
* Tk_CreateAnonymousWindow --
*
- * Create a new internal or top-level window as a child of an
- * existing window; this window will be anonymous (unnamed), so
- * it will not be visible at the Tcl level.
+ * Create a new internal or top-level window as a child of an existing
+ * window; this window will be anonymous (unnamed), so it will not be
+ * visible at the Tcl level.
*
* Results:
- * The return value is a token for the new window. This
- * is not the same as X's token for the window. If an error
- * occurred in creating the window (e.g. no such display or
- * screen), then an error message is left in the interp's result and
- * NULL is returned.
+ * The return value is a token for the new window. This is not the same
+ * as X's token for the window. If an error occurred in creating the
+ * window (e.g. no such display or screen), then an error message is left
+ * in the interp's result and NULL is returned.
*
* Side effects:
- * A new window structure is allocated locally. An X
- * window is not initially created, but will be created
- * the first time the window is mapped.
+ * A new window structure is allocated locally. An X window is not
+ * initially created, but will be created the first time the window is
+ * mapped.
*
*--------------------------------------------------------------
*/
Tk_Window
-Tk_CreateAnonymousWindow(interp, parent, screenName)
- Tcl_Interp *interp; /* Interpreter to use for error reporting.
+Tk_CreateAnonymousWindow(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting.
* the interp's result is assumed to be
* initialized by the caller. */
- Tk_Window parent; /* Token for parent of new window. */
- CONST char *screenName; /* If NULL, new window will be internal on
- * same screen as its parent. If non-NULL,
- * gives name of screen on which to create
- * new window; window will be a top-level
+ Tk_Window parent, /* Token for parent of new window. */
+ CONST char *screenName) /* If NULL, new window will be internal on
+ * same screen as its parent. If non-NULL,
+ * gives name of screen on which to create new
+ * window; window will be a top-level
* window. */
{
TkWindow *parentPtr = (TkWindow *) parent;
@@ -1084,14 +1084,12 @@ Tk_CreateAnonymousWindow(interp, parent, screenName)
if ((parentPtr != NULL) && (parentPtr->flags & TK_ALREADY_DEAD)) {
Tcl_AppendResult(interp,
- "can't create window: parent has been destroyed",
- (char *) NULL);
+ "can't create window: parent has been destroyed", NULL);
return NULL;
} else if ((parentPtr != NULL) &&
(parentPtr->flags & TK_CONTAINER)) {
Tcl_AppendResult(interp,
- "can't create window: its parent has -container = yes",
- (char *) NULL);
+ "can't create window: its parent has -container = yes", NULL);
return NULL;
}
if (screenName == NULL) {
@@ -1103,15 +1101,14 @@ Tk_CreateAnonymousWindow(interp, parent, screenName)
*/
winPtr->flags |= TK_ANONYMOUS_WINDOW;
- if (NameWindow(interp, winPtr, parentPtr, (char *)NULL) != TCL_OK) {
+ if (NameWindow(interp, winPtr, parentPtr, NULL) != TCL_OK) {
Tk_DestroyWindow((Tk_Window) winPtr);
return NULL;
}
return (Tk_Window) winPtr;
- } else {
- return CreateTopLevelWindow(interp, parent, (char *)NULL, screenName,
- TK_ANONYMOUS_WINDOW);
}
+ return CreateTopLevelWindow(interp, parent, NULL, screenName,
+ TK_ANONYMOUS_WINDOW);
}
/*
@@ -1119,41 +1116,38 @@ Tk_CreateAnonymousWindow(interp, parent, screenName)
*
* Tk_CreateWindowFromPath --
*
- * This procedure is similar to Tk_CreateWindow except that
- * it uses a path name to create the window, rather than a
- * parent and a child name.
+ * This function is similar to Tk_CreateWindow except that it uses a path
+ * name to create the window, rather than a parent and a child name.
*
* Results:
- * The return value is a token for the new window. This
- * is not the same as X's token for the window. If an error
- * occurred in creating the window (e.g. no such display or
- * screen), then an error message is left in the interp's result and
- * NULL is returned.
+ * The return value is a token for the new window. This is not the same
+ * as X's token for the window. If an error occurred in creating the
+ * window (e.g. no such display or screen), then an error message is left
+ * in the interp's result and NULL is returned.
*
* Side effects:
- * A new window structure is allocated locally. An X
- * window is not initially created, but will be created
- * the first time the window is mapped.
+ * A new window structure is allocated locally. An X window is not
+ * initially created, but will be created the first time the window is
+ * mapped.
*
*----------------------------------------------------------------------
*/
Tk_Window
-Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName)
- Tcl_Interp *interp; /* Interpreter to use for error reporting.
+Tk_CreateWindowFromPath(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting.
* the interp's result is assumed to be
* initialized by the caller. */
- Tk_Window tkwin; /* Token for any window in application
- * that is to contain new window. */
- CONST char *pathName; /* Path name for new window within the
- * application of tkwin. The parent of
- * this window must already exist, but
- * the window itself must not exist. */
- CONST char *screenName; /* If NULL, new window will be on same
- * screen as its parent. If non-NULL,
- * gives name of screen on which to create
- * new window; window will be a top-level
- * window. */
+ Tk_Window tkwin, /* Token for any window in application that is
+ * to contain new window. */
+ CONST char *pathName, /* Path name for new window within the
+ * application of tkwin. The parent of this
+ * window must already exist, but the window
+ * itself must not exist. */
+ CONST char *screenName) /* If NULL, new window will be on same screen
+ * as its parent. If non-NULL, gives name of
+ * screen on which to create new window;
+ * window will be a top-level window. */
{
#define FIXED_SPACE 5
char fixedSpace[FIXED_SPACE+1];
@@ -1162,18 +1156,17 @@ Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName)
int numChars;
/*
- * Strip the parent's name out of pathName (it's everything up
- * to the last dot). There are two tricky parts: (a) must
- * copy the parent's name somewhere else to avoid modifying
- * the pathName string (for large names, space for the copy
- * will have to be malloc'ed); (b) must special-case the
- * situation where the parent is ".".
+ * Strip the parent's name out of pathName (it's everything up to the last
+ * dot). There are two tricky parts: (a) must copy the parent's name
+ * somewhere else to avoid modifying the pathName string (for large names,
+ * space for the copy will have to be malloc'ed); (b) must special-case
+ * the situation where the parent is ".".
*/
p = strrchr(pathName, '.');
if (p == NULL) {
Tcl_AppendResult(interp, "bad window path name \"", pathName,
- "\"", (char *) NULL);
+ "\"", NULL);
return NULL;
}
numChars = (int) (p-pathName);
@@ -1196,19 +1189,19 @@ Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName)
parent = Tk_NameToWindow(interp, p, tkwin);
if (p != fixedSpace) {
- ckfree(p);
+ ckfree(p);
}
if (parent == NULL) {
return NULL;
}
if (((TkWindow *) parent)->flags & TK_ALREADY_DEAD) {
- Tcl_AppendResult(interp,
- "can't create window: parent has been destroyed", (char *) NULL);
+ Tcl_AppendResult(interp,
+ "can't create window: parent has been destroyed", NULL);
return NULL;
- } else if (((TkWindow *) parent)->flags & TK_CONTAINER) {
- Tcl_AppendResult(interp,
- "can't create window: its parent has -container = yes",
- (char *) NULL);
+ }
+ if (((TkWindow *) parent)->flags & TK_CONTAINER) {
+ Tcl_AppendResult(interp,
+ "can't create window: its parent has -container = yes", NULL);
return NULL;
}
@@ -1226,13 +1219,12 @@ Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName)
!= TCL_OK) {
Tk_DestroyWindow((Tk_Window) winPtr);
return NULL;
- } else {
- return (Tk_Window) winPtr;
}
- } else {
- return CreateTopLevelWindow(interp, parent, pathName+numChars+1,
- screenName, /* flags */ 0);
+ return (Tk_Window) winPtr;
}
+
+ return CreateTopLevelWindow(interp, parent, pathName+numChars+1,
+ screenName, /* flags */ 0);
}
/*
@@ -1240,36 +1232,36 @@ Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName)
*
* Tk_DestroyWindow --
*
- * Destroy an existing window. After this call, the caller
- * should never again use the token. Note that this function
- * can be reentered to destroy a window that was only
- * partially destroyed before a call to exit.
+ * Destroy an existing window. After this call, the caller should never
+ * again use the token. Note that this function can be reentered to
+ * destroy a window that was only partially destroyed before a call to
+ * exit.
*
* Results:
* None.
*
* Side effects:
- * The window is deleted, along with all of its children.
- * Relevant callback procedures are invoked.
+ * The window is deleted, along with all of its children. Relevant
+ * callback functions are invoked.
*
*--------------------------------------------------------------
*/
void
-Tk_DestroyWindow(tkwin)
- Tk_Window tkwin; /* Window to destroy. */
+Tk_DestroyWindow(
+ Tk_Window tkwin) /* Window to destroy. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
XEvent event;
TkHalfdeadWindow *halfdeadPtr, *prev_halfdeadPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_ALREADY_DEAD) {
/*
- * A destroy event binding caused the window to be destroyed
- * again. Ignore the request.
+ * A destroy event binding caused the window to be destroyed again.
+ * Ignore the request.
*/
return;
@@ -1277,9 +1269,8 @@ Tk_DestroyWindow(tkwin)
winPtr->flags |= TK_ALREADY_DEAD;
/*
- * Unless we are cleaning up a half dead
- * window from DeleteWindowsExitProc,
- * add this window to the half dead list.
+ * Unless we are cleaning up a half dead window from
+ * DeleteWindowsExitProc, add this window to the half dead list.
*/
if (tsdPtr->halfdeadWindowList &&
@@ -1295,12 +1286,12 @@ Tk_DestroyWindow(tkwin)
}
/*
- * Some cleanup needs to be done immediately, rather than later,
- * because it needs information that will be destoyed before we
- * get to the main cleanup point. For example, TkFocusDeadWindow
- * needs to access the parentPtr field from a window, but if
- * a Destroy event handler deletes the window's parent this
- * field will be NULL before the main cleanup point is reached.
+ * Some cleanup needs to be done immediately, rather than later, because
+ * it needs information that will be destoyed before we get to the main
+ * cleanup point. For example, TkFocusDeadWindow needs to access the
+ * parentPtr field from a window, but if a Destroy event handler deletes
+ * the window's parent this field will be NULL before the main cleanup
+ * point is reached.
*/
if (!(halfdeadPtr->flags & HD_FOCUS)) {
@@ -1309,23 +1300,23 @@ Tk_DestroyWindow(tkwin)
}
/*
- * If this is a main window, remove it from the list of main
- * windows. This needs to be done now (rather than later with
- * all the other main window cleanup) to handle situations where
- * a destroy binding for a window calls "exit". In this case
- * the child window cleanup isn't complete when exit is called.
- * This situation is dealt with using the half dead window
- * list. Windows that are half dead gets cleaned up during exit.
+ * If this is a main window, remove it from the list of main windows.
+ * This needs to be done now (rather than later with all the other main
+ * window cleanup) to handle situations where a destroy binding for a
+ * window calls "exit". In this case the child window cleanup isn't
+ * complete when exit is called. This situation is dealt with using the
+ * half dead window list. Windows that are half dead gets cleaned up
+ * during exit.
*
- * Also decrement the display refcount so that if this is the
- * last Tk application in this process on this display, the display
- * can be closed and its data structures deleted.
+ * Also decrement the display refcount so that if this is the last Tk
+ * application in this process on this display, the display can be closed
+ * and its data structures deleted.
*/
if (!(halfdeadPtr->flags & HD_MAIN_WIN) &&
winPtr->mainPtr != NULL && winPtr->mainPtr->winPtr == winPtr) {
halfdeadPtr->flags |= HD_MAIN_WIN;
- dispPtr->refCount--;
+ dispPtr->refCount--;
if (tsdPtr->mainWindowList == winPtr->mainPtr) {
tsdPtr->mainWindowList = winPtr->mainPtr->nextPtr;
} else {
@@ -1342,10 +1333,9 @@ Tk_DestroyWindow(tkwin)
}
/*
- * Recursively destroy children. Note that this child
- * window block may need to be run multiple times
- * in the case where a child window has a Destroy
- * binding that calls exit.
+ * Recursively destroy children. Note that this child window block may
+ * need to be run multiple times in the case where a child window has a
+ * Destroy binding that calls exit.
*/
if (!(halfdeadPtr->flags & HD_DESTROY_COUNT)) {
@@ -1360,10 +1350,10 @@ Tk_DestroyWindow(tkwin)
Tk_DestroyWindow((Tk_Window) childPtr);
if (winPtr->childList == childPtr) {
/*
- * The child didn't remove itself from the child list, so
- * let's remove it here. This can happen in some strange
- * conditions, such as when a Destroy event handler for a
- * window destroys the window's parent.
+ * The child didn't remove itself from the child list, so let's
+ * remove it here. This can happen in some strange conditions,
+ * such as when a Destroy event handler for a window destroys the
+ * window's parent.
*/
winPtr->childList = childPtr->nextPtr;
@@ -1373,14 +1363,13 @@ Tk_DestroyWindow(tkwin)
if ((winPtr->flags & (TK_CONTAINER|TK_BOTH_HALVES))
== (TK_CONTAINER|TK_BOTH_HALVES)) {
/*
- * This is the container for an embedded application, and
- * the embedded application is also in this process. Delete
- * the embedded window in-line here, for the same reasons we
- * delete children in-line (otherwise, for example, the Tk
- * window may appear to exist even though its X window is
- * gone; this could cause errors). Special note: it's possible
- * that the embedded window has already been deleted, in which
- * case TkpGetOtherWindow will return NULL.
+ * This is the container for an embedded application, and the embedded
+ * application is also in this process. Delete the embedded window
+ * in-line here, for the same reasons we delete children in-line
+ * (otherwise, for example, the Tk window may appear to exist even
+ * though its X window is gone; this could cause errors). Special
+ * note: it's possible that the embedded window has already been
+ * deleted, in which case TkpGetOtherWindow will return NULL.
*/
TkWindow *childPtr;
@@ -1392,11 +1381,10 @@ Tk_DestroyWindow(tkwin)
}
/*
- * Generate a DestroyNotify event. In order for the DestroyNotify
- * event to be processed correctly, need to make sure the window
- * exists. This is a bit of a kludge, and may be unnecessarily
- * expensive, but without it no event handlers will get called for
- * windows that don't exist yet.
+ * Generate a DestroyNotify event. In order for the DestroyNotify event to
+ * be processed correctly, need to make sure the window exists. This is a
+ * bit of a kludge, and may be unnecessarily expensive, but without it no
+ * event handlers will get called for windows that don't exist yet.
*
* Note: if the window's pathName is NULL and the window is not an
* anonymous window, it means that the window was not successfully
@@ -1422,28 +1410,28 @@ Tk_DestroyWindow(tkwin)
}
/*
- * No additional bindings that could call exit
- * should be invoked from this point on,
- * so it is safe to remove this window
- * from the half dead list.
+ * No additional bindings that could call exit should be invoked from this
+ * point on, so it is safe to remove this window from the half dead list.
*/
for (prev_halfdeadPtr = NULL,
halfdeadPtr = tsdPtr->halfdeadWindowList;
halfdeadPtr != NULL; ) {
if (halfdeadPtr->winPtr == winPtr) {
- if (prev_halfdeadPtr == NULL)
- tsdPtr->halfdeadWindowList = halfdeadPtr->nextPtr;
- else
- prev_halfdeadPtr->nextPtr = halfdeadPtr->nextPtr;
+ if (prev_halfdeadPtr == NULL) {
+ tsdPtr->halfdeadWindowList = halfdeadPtr->nextPtr;
+ } else {
+ prev_halfdeadPtr->nextPtr = halfdeadPtr->nextPtr;
+ }
ckfree((char *) halfdeadPtr);
break;
}
prev_halfdeadPtr = halfdeadPtr;
halfdeadPtr = halfdeadPtr->nextPtr;
}
- if (halfdeadPtr == NULL)
- panic("window not found on half dead list");
+ if (halfdeadPtr == NULL) {
+ Tcl_Panic("window not found on half dead list");
+ }
/*
* Cleanup the data structures associated with this window.
@@ -1455,17 +1443,16 @@ Tk_DestroyWindow(tkwin)
TkWmRemoveFromColormapWindows(winPtr);
}
if (winPtr->window != None) {
-#if defined(MAC_TCL) || defined(MAC_OSX_TK) || defined(__WIN32__)
+#if defined(MAC_OSX_TK) || defined(__WIN32__)
XDestroyWindow(winPtr->display, winPtr->window);
#else
if ((winPtr->flags & TK_TOP_HIERARCHY)
|| !(winPtr->flags & TK_DONT_DESTROY_WINDOW)) {
/*
- * The parent has already been destroyed and this isn't
- * a top-level window, so this window will be destroyed
- * implicitly when the parent's X window is destroyed;
- * it's much faster not to do an explicit destroy of this
- * X window.
+ * The parent has already been destroyed and this isn't a
+ * top-level window, so this window will be destroyed implicitly
+ * when the parent's X window is destroyed; it's much faster not
+ * to do an explicit destroy of this X window.
*/
dispPtr->lastDestroyRequest = NextRequest(winPtr->display);
@@ -1499,17 +1486,20 @@ Tk_DestroyWindow(tkwin)
(ClientData) winPtr->pathName);
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&winPtr->mainPtr->nameTable,
winPtr->pathName));
- /*
- * The memory pointed to by pathName has been deallocated.
- * Keep users from accessing it after the window has been
- * destroyed by setting it to NULL.
- */
- winPtr->pathName = NULL;
/*
- * Invalidate all objects referring to windows
- * with the same main window
+ * The memory pointed to by pathName has been deallocated. Keep
+ * users from accessing it after the window has been destroyed by
+ * setting it to NULL.
+ */
+
+ winPtr->pathName = NULL;
+
+ /*
+ * Invalidate all objects referring to windows with the same main
+ * window.
*/
+
winPtr->mainPtr->deletionEpoch++;
}
winPtr->mainPtr->refCount--;
@@ -1517,30 +1507,29 @@ Tk_DestroyWindow(tkwin)
register TkCmd *cmdPtr;
/*
- * We just deleted the last window in the application. Delete
- * the TkMainInfo structure too and replace all of Tk's commands
- * with dummy commands that return errors. Also delete the
- * "send" command to unregister the interpreter.
+ * We just deleted the last window in the application. Delete the
+ * TkMainInfo structure too and replace all of Tk's commands with
+ * dummy commands that return errors. Also delete the "send"
+ * command to unregister the interpreter.
*
- * NOTE: Only replace the commands it if the interpreter is
- * not being deleted. If it *is*, the interpreter cleanup will
- * do all the needed work.
+ * NOTE: Only replace the commands it if the interpreter is not
+ * being deleted. If it *is*, the interpreter cleanup will do all
+ * the needed work.
*/
- if ((winPtr->mainPtr->interp != NULL) &&
- (!Tcl_InterpDeleted(winPtr->mainPtr->interp))) {
- for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
- Tcl_CreateCommand(winPtr->mainPtr->interp, cmdPtr->name,
- TkDeadAppCmd, (ClientData) NULL,
- (void (*) _ANSI_ARGS_((ClientData))) NULL);
- }
- Tcl_CreateCommand(winPtr->mainPtr->interp, "send",
- TkDeadAppCmd, (ClientData) NULL,
- (void (*) _ANSI_ARGS_((ClientData))) NULL);
- Tcl_UnlinkVar(winPtr->mainPtr->interp, "tk_strictMotif");
- Tcl_UnlinkVar(winPtr->mainPtr->interp, "::tk::AlwaysShowSelection");
- }
-
+ if ((winPtr->mainPtr->interp != NULL) &&
+ (!Tcl_InterpDeleted(winPtr->mainPtr->interp))) {
+ for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
+ Tcl_CreateCommand(winPtr->mainPtr->interp, cmdPtr->name,
+ TkDeadAppCmd, NULL, NULL);
+ }
+ Tcl_CreateCommand(winPtr->mainPtr->interp, "send",
+ TkDeadAppCmd, NULL, NULL);
+ Tcl_UnlinkVar(winPtr->mainPtr->interp, "tk_strictMotif");
+ Tcl_UnlinkVar(winPtr->mainPtr->interp,
+ "::tk::AlwaysShowSelection");
+ }
+
Tcl_DeleteHashTable(&winPtr->mainPtr->nameTable);
TkBindFree(winPtr->mainPtr);
TkDeleteAllImages(winPtr->mainPtr);
@@ -1548,72 +1537,71 @@ Tk_DestroyWindow(tkwin)
TkFocusFree(winPtr->mainPtr);
TkStylePkgFree(winPtr->mainPtr);
- /*
- * When embedding Tk into other applications, make sure
- * that all destroy events reach the server. Otherwise
- * the embedding application may also attempt to destroy
- * the windows, resulting in an X error
- */
+ /*
+ * When embedding Tk into other applications, make sure that all
+ * destroy events reach the server. Otherwise the embedding
+ * application may also attempt to destroy the windows, resulting
+ * in an X error
+ */
- if (winPtr->flags & TK_EMBEDDED) {
- XSync(winPtr->display, False);
- }
+ if (winPtr->flags & TK_EMBEDDED) {
+ XSync(winPtr->display, False);
+ }
ckfree((char *) winPtr->mainPtr);
- /*
- * If no other applications are using the display, close the
- * display now and relinquish its data structures.
- */
-
-#if !defined(WIN32) && !defined(MAC_TCL) && defined(NOT_YET)
- if (dispPtr->refCount <= 0) {
- /*
- * I have disabled this code because on Windows there are
- * still order dependencies in close-down. All displays
- * and resources will get closed down properly anyway at
- * exit, through the exit handler. -- jyl
- */
+ /*
+ * If no other applications are using the display, close the
+ * display now and relinquish its data structures.
+ */
+
+#if !defined(WIN32) && defined(NOT_YET)
+ if (dispPtr->refCount <= 0) {
/*
+ * I have disabled this code because on Windows there are
+ * still order dependencies in close-down. All displays and
+ * resources will get closed down properly anyway at exit,
+ * through the exit handler. -- jyl
+ *
* Ideally this should be enabled, as unix Tk can use multiple
- * displays. However, there are order issues still, as well
- * as the handling of queued events and such that must be
- * addressed before this can be enabled. The current cleanup
+ * displays. However, there are order issues still, as well as
+ * the handling of queued events and such that must be
+ * addressed before this can be enabled. The current cleanup
* works except for send event issues. -- hobbs 04/2002
*/
-
- TkDisplay *theDispPtr, *backDispPtr;
-
- /*
- * Splice this display out of the list of displays.
- */
-
- for (theDispPtr = tsdPtr->displayList, backDispPtr = NULL;
- (theDispPtr != winPtr->dispPtr) &&
- (theDispPtr != NULL);
- theDispPtr = theDispPtr->nextPtr) {
- backDispPtr = theDispPtr;
- }
- if (theDispPtr == NULL) {
- panic("could not find display to close!");
- }
- if (backDispPtr == NULL) {
- tsdPtr->displayList = theDispPtr->nextPtr;
- } else {
- backDispPtr->nextPtr = theDispPtr->nextPtr;
- }
-
- /*
+
+ TkDisplay *theDispPtr, *backDispPtr;
+
+ /*
+ * Splice this display out of the list of displays.
+ */
+
+ for (theDispPtr = tsdPtr->displayList, backDispPtr = NULL;
+ (theDispPtr!=winPtr->dispPtr) && (theDispPtr!=NULL);
+ theDispPtr = theDispPtr->nextPtr) {
+ backDispPtr = theDispPtr;
+ }
+ if (theDispPtr == NULL) {
+ Tcl_Panic("could not find display to close!");
+ }
+ if (backDispPtr == NULL) {
+ tsdPtr->displayList = theDispPtr->nextPtr;
+ } else {
+ backDispPtr->nextPtr = theDispPtr->nextPtr;
+ }
+
+ /*
* Calling XSync creates X server traffic, but addresses a
* focus issue on close (but not the send issue). -- hobbs
- XSync(dispPtr->display, True);
+ *
+ * XSync(dispPtr->display, True);
*/
- /*
- * Found and spliced it out, now actually do the cleanup.
- */
+ /*
+ * Found and spliced it out, now actually do the cleanup.
+ */
TkCloseDisplay(dispPtr);
- }
+ }
#endif
}
}
@@ -1625,22 +1613,21 @@ Tk_DestroyWindow(tkwin)
*
* Tk_MapWindow --
*
- * Map a window within its parent. This may require the
- * window and/or its parents to actually be created.
+ * Map a window within its parent. This may require the window and/or its
+ * parents to actually be created.
*
* Results:
* None.
*
* Side effects:
- * The given window will be mapped. Windows may also
- * be created.
+ * The given window will be mapped. Windows may also be created.
*
*--------------------------------------------------------------
*/
void
-Tk_MapWindow(tkwin)
- Tk_Window tkwin; /* Token for window to map. */
+Tk_MapWindow(
+ Tk_Window tkwin) /* Token for window to map. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
XEvent event;
@@ -1660,8 +1647,8 @@ Tk_MapWindow(tkwin)
}
if (winPtr->flags & TK_WIN_MANAGED) {
/*
- * Lots of special processing has to be done for top-level
- * windows. Let tkWm.c handle everything itself.
+ * Lots of special processing has to be done for top-level windows.
+ * Let tkWm.c handle everything itself.
*/
TkWmMapWindow(winPtr);
@@ -1684,32 +1671,31 @@ Tk_MapWindow(tkwin)
*
* Tk_MakeWindowExist --
*
- * Ensure that a particular window actually exists. This
- * procedure shouldn't normally need to be invoked from
- * outside the Tk package, but may be needed if someone
- * wants to manipulate a window before mapping it.
+ * Ensure that a particular window actually exists. This function should
+ * not normally need to be invoked from outside the Tk package, but may
+ * be needed if someone wants to manipulate a window before mapping it.
*
* Results:
* None.
*
* Side effects:
- * When the procedure returns, the X window associated with
- * tkwin is guaranteed to exist. This may require the
- * window's ancestors to be created also.
+ * When the function returns, the X window associated with tkwin is
+ * guaranteed to exist. This may require the window's ancestors to be
+ * created also.
*
*--------------------------------------------------------------
*/
void
-Tk_MakeWindowExist(tkwin)
- Tk_Window tkwin; /* Token for window. */
+Tk_MakeWindowExist(
+ Tk_Window tkwin) /* Token for window. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *winPtr2;
Window parent;
Tcl_HashEntry *hPtr;
Tk_ClassCreateProc *createProc;
- int new;
+ int isNew;
if (winPtr->window != None) {
return;
@@ -1725,28 +1711,28 @@ Tk_MakeWindowExist(tkwin)
}
createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc);
- if (createProc != NULL) {
+ if (createProc != NULL && parent != None) {
winPtr->window = (*createProc)(tkwin, parent, winPtr->instanceData);
} else {
winPtr->window = TkpMakeWindow(winPtr, parent);
}
hPtr = Tcl_CreateHashEntry(&winPtr->dispPtr->winTable,
- (char *) winPtr->window, &new);
+ (char *) winPtr->window, &isNew);
Tcl_SetHashValue(hPtr, winPtr);
winPtr->dirtyAtts = 0;
winPtr->dirtyChanges = 0;
if (!(winPtr->flags & TK_TOP_HIERARCHY)) {
/*
- * If any siblings higher up in the stacking order have already
- * been created then move this window to its rightful position
- * in the stacking order.
+ * If any siblings higher up in the stacking order have already been
+ * created then move this window to its rightful position in the
+ * stacking order.
*
- * NOTE: this code ignores any changes anyone might have made
- * to the sibling and stack_mode field of the window's attributes,
- * so it really isn't safe for these to be manipulated except
- * by calling Tk_RestackWindow.
+ * NOTE: this code ignores any changes anyone might have made to the
+ * sibling and stack_mode field of the window's attributes, so it
+ * really isn't safe for these to be manipulated except by calling
+ * Tk_RestackWindow.
*/
for (winPtr2 = winPtr->nextPtr; winPtr2 != NULL;
@@ -1763,8 +1749,8 @@ Tk_MakeWindowExist(tkwin)
}
/*
- * If this window has a different colormap than its parent, add
- * the window to the WM_COLORMAP_WINDOWS property for its top-level.
+ * If this window has a different colormap than its parent, add the
+ * window to the WM_COLORMAP_WINDOWS property for its top-level.
*/
if ((winPtr->parentPtr != NULL) &&
@@ -1776,9 +1762,9 @@ Tk_MakeWindowExist(tkwin)
/*
* Issue a ConfigureNotify event if there were deferred configuration
- * changes (but skip it if the window is being deleted; the
- * ConfigureNotify event could cause problems if we're being called
- * from Tk_DestroyWindow under some conditions).
+ * changes (but skip it if the window is being deleted; the
+ * ConfigureNotify event could cause problems if we're being called from
+ * Tk_DestroyWindow under some conditions).
*/
if ((winPtr->flags & TK_NEED_CONFIG_NOTIFY)
@@ -1793,12 +1779,11 @@ Tk_MakeWindowExist(tkwin)
*
* Tk_UnmapWindow, etc. --
*
- * There are several procedures under here, each of which
- * mirrors an existing X procedure. In addition to performing
- * the functions of the corresponding procedure, each
- * procedure also updates the local window structure and
- * synthesizes an X event (if the window's structure is being
- * managed internally).
+ * There are several functions under here, each of which mirrors an
+ * existing X function. In addition to performing the functions of the
+ * corresponding function, each function also updates the local window
+ * structure and synthesizes an X event (if the window's structure is
+ * being managed internally).
*
* Results:
* See the manual entries.
@@ -1810,8 +1795,8 @@ Tk_MakeWindowExist(tkwin)
*/
void
-Tk_UnmapWindow(tkwin)
- Tk_Window tkwin; /* Token for window to unmap. */
+Tk_UnmapWindow(
+ Tk_Window tkwin) /* Token for window to unmap. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -1820,8 +1805,8 @@ Tk_UnmapWindow(tkwin)
}
if (winPtr->flags & TK_WIN_MANAGED) {
/*
- * Special processing has to be done for top-level windows. Let
- * tkWm.c handle everything itself.
+ * Special processing has to be done for top-level windows. Let tkWm.c
+ * handle everything itself.
*/
TkWmUnmapWindow(winPtr);
@@ -1844,11 +1829,11 @@ Tk_UnmapWindow(tkwin)
}
void
-Tk_ConfigureWindow(tkwin, valueMask, valuePtr)
- Tk_Window tkwin; /* Window to re-configure. */
- unsigned int valueMask; /* Mask indicating which parts of
- * *valuePtr are to be used. */
- XWindowChanges *valuePtr; /* New values. */
+Tk_ConfigureWindow(
+ Tk_Window tkwin, /* Window to re-configure. */
+ unsigned int valueMask, /* Mask indicating which parts of *valuePtr
+ * are to be used. */
+ XWindowChanges *valuePtr) /* New values. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -1868,13 +1853,13 @@ Tk_ConfigureWindow(tkwin, valueMask, valuePtr)
winPtr->changes.border_width = valuePtr->border_width;
}
if (valueMask & (CWSibling|CWStackMode)) {
- panic("Can't set sibling or stack mode from Tk_ConfigureWindow.");
+ Tcl_Panic("Can't set sibling or stack mode from Tk_ConfigureWindow.");
}
if (winPtr->window != None) {
XConfigureWindow(winPtr->display, winPtr->window,
valueMask, valuePtr);
- TkDoConfigureNotify(winPtr);
+ TkDoConfigureNotify(winPtr);
} else {
winPtr->dirtyChanges |= valueMask;
winPtr->flags |= TK_NEED_CONFIG_NOTIFY;
@@ -1882,10 +1867,9 @@ Tk_ConfigureWindow(tkwin, valueMask, valuePtr)
}
void
-Tk_MoveWindow(tkwin, x, y)
- Tk_Window tkwin; /* Window to move. */
- int x, y; /* New location for window (within
- * parent). */
+Tk_MoveWindow(
+ Tk_Window tkwin, /* Window to move. */
+ int x, int y) /* New location for window (within parent). */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -1893,7 +1877,7 @@ Tk_MoveWindow(tkwin, x, y)
winPtr->changes.y = y;
if (winPtr->window != None) {
XMoveWindow(winPtr->display, winPtr->window, x, y);
- TkDoConfigureNotify(winPtr);
+ TkDoConfigureNotify(winPtr);
} else {
winPtr->dirtyChanges |= CWX|CWY;
winPtr->flags |= TK_NEED_CONFIG_NOTIFY;
@@ -1901,9 +1885,9 @@ Tk_MoveWindow(tkwin, x, y)
}
void
-Tk_ResizeWindow(tkwin, width, height)
- Tk_Window tkwin; /* Window to resize. */
- int width, height; /* New dimensions for window. */
+Tk_ResizeWindow(
+ Tk_Window tkwin, /* Window to resize. */
+ int width, int height) /* New dimensions for window. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -1912,7 +1896,7 @@ Tk_ResizeWindow(tkwin, width, height)
if (winPtr->window != None) {
XResizeWindow(winPtr->display, winPtr->window, (unsigned) width,
(unsigned) height);
- TkDoConfigureNotify(winPtr);
+ TkDoConfigureNotify(winPtr);
} else {
winPtr->dirtyChanges |= CWWidth|CWHeight;
winPtr->flags |= TK_NEED_CONFIG_NOTIFY;
@@ -1920,11 +1904,10 @@ Tk_ResizeWindow(tkwin, width, height)
}
void
-Tk_MoveResizeWindow(tkwin, x, y, width, height)
- Tk_Window tkwin; /* Window to move and resize. */
- int x, y; /* New location for window (within
- * parent). */
- int width, height; /* New dimensions for window. */
+Tk_MoveResizeWindow(
+ Tk_Window tkwin, /* Window to move and resize. */
+ int x, int y, /* New location for window (within parent). */
+ int width, int height) /* New dimensions for window. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -1935,7 +1918,7 @@ Tk_MoveResizeWindow(tkwin, x, y, width, height)
if (winPtr->window != None) {
XMoveResizeWindow(winPtr->display, winPtr->window, x, y,
(unsigned) width, (unsigned) height);
- TkDoConfigureNotify(winPtr);
+ TkDoConfigureNotify(winPtr);
} else {
winPtr->dirtyChanges |= CWX|CWY|CWWidth|CWHeight;
winPtr->flags |= TK_NEED_CONFIG_NOTIFY;
@@ -1943,9 +1926,9 @@ Tk_MoveResizeWindow(tkwin, x, y, width, height)
}
void
-Tk_SetWindowBorderWidth(tkwin, width)
- Tk_Window tkwin; /* Window to modify. */
- int width; /* New border width for window. */
+Tk_SetWindowBorderWidth(
+ Tk_Window tkwin, /* Window to modify. */
+ int width) /* New border width for window. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -1953,7 +1936,7 @@ Tk_SetWindowBorderWidth(tkwin, width)
if (winPtr->window != None) {
XSetWindowBorderWidth(winPtr->display, winPtr->window,
(unsigned) width);
- TkDoConfigureNotify(winPtr);
+ TkDoConfigureNotify(winPtr);
} else {
winPtr->dirtyChanges |= CWBorderWidth;
winPtr->flags |= TK_NEED_CONFIG_NOTIFY;
@@ -1961,12 +1944,11 @@ Tk_SetWindowBorderWidth(tkwin, width)
}
void
-Tk_ChangeWindowAttributes(tkwin, valueMask, attsPtr)
- Tk_Window tkwin; /* Window to manipulate. */
- unsigned long valueMask; /* OR'ed combination of bits,
- * indicating which fields of
- * *attsPtr are to be used. */
- register XSetWindowAttributes *attsPtr;
+Tk_ChangeWindowAttributes(
+ Tk_Window tkwin, /* Window to manipulate. */
+ unsigned long valueMask, /* OR'ed combination of bits, indicating which
+ * fields of *attsPtr are to be used. */
+ register XSetWindowAttributes *attsPtr)
/* New values for some attributes. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2027,10 +2009,10 @@ Tk_ChangeWindowAttributes(tkwin, valueMask, attsPtr)
}
void
-Tk_SetWindowBackground(tkwin, pixel)
- Tk_Window tkwin; /* Window to manipulate. */
- unsigned long pixel; /* Pixel value to use for
- * window's background. */
+Tk_SetWindowBackground(
+ Tk_Window tkwin, /* Window to manipulate. */
+ unsigned long pixel) /* Pixel value to use for window's
+ * background. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2045,10 +2027,9 @@ Tk_SetWindowBackground(tkwin, pixel)
}
void
-Tk_SetWindowBackgroundPixmap(tkwin, pixmap)
- Tk_Window tkwin; /* Window to manipulate. */
- Pixmap pixmap; /* Pixmap to use for window's
- * background. */
+Tk_SetWindowBackgroundPixmap(
+ Tk_Window tkwin, /* Window to manipulate. */
+ Pixmap pixmap) /* Pixmap to use for window's background. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2064,10 +2045,9 @@ Tk_SetWindowBackgroundPixmap(tkwin, pixmap)
}
void
-Tk_SetWindowBorder(tkwin, pixel)
- Tk_Window tkwin; /* Window to manipulate. */
- unsigned long pixel; /* Pixel value to use for
- * window's border. */
+Tk_SetWindowBorder(
+ Tk_Window tkwin, /* Window to manipulate. */
+ unsigned long pixel) /* Pixel value to use for window's border. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2082,10 +2062,9 @@ Tk_SetWindowBorder(tkwin, pixel)
}
void
-Tk_SetWindowBorderPixmap(tkwin, pixmap)
- Tk_Window tkwin; /* Window to manipulate. */
- Pixmap pixmap; /* Pixmap to use for window's
- * border. */
+Tk_SetWindowBorderPixmap(
+ Tk_Window tkwin, /* Window to manipulate. */
+ Pixmap pixmap) /* Pixmap to use for window's border. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2101,18 +2080,18 @@ Tk_SetWindowBorderPixmap(tkwin, pixmap)
}
void
-Tk_DefineCursor(tkwin, cursor)
- Tk_Window tkwin; /* Window to manipulate. */
- Tk_Cursor cursor; /* Cursor to use for window (may be None). */
+Tk_DefineCursor(
+ Tk_Window tkwin, /* Window to manipulate. */
+ Tk_Cursor cursor) /* Cursor to use for window (may be None). */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
winPtr->atts.cursor = (XCursor) cursor;
#else
winPtr->atts.cursor = (Cursor) cursor;
#endif
-
+
if (winPtr->window != None) {
XDefineCursor(winPtr->display, winPtr->window, winPtr->atts.cursor);
} else {
@@ -2121,16 +2100,16 @@ Tk_DefineCursor(tkwin, cursor)
}
void
-Tk_UndefineCursor(tkwin)
- Tk_Window tkwin; /* Window to manipulate. */
+Tk_UndefineCursor(
+ Tk_Window tkwin) /* Window to manipulate. */
{
Tk_DefineCursor(tkwin, None);
}
void
-Tk_SetWindowColormap(tkwin, colormap)
- Tk_Window tkwin; /* Window to manipulate. */
- Colormap colormap; /* Colormap to use for window. */
+Tk_SetWindowColormap(
+ Tk_Window tkwin, /* Window to manipulate. */
+ Colormap colormap) /* Colormap to use for window. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2152,14 +2131,14 @@ Tk_SetWindowColormap(tkwin, colormap)
*
* Tk_SetWindowVisual --
*
- * This procedure is called to specify a visual to be used
- * for a Tk window when it is created. This procedure, if
- * called at all, must be called before the X window is created
- * (i.e. before Tk_MakeWindowExist is called).
+ * This function is called to specify a visual to be used for a Tk window
+ * when it is created. This function, if called at all, must be called
+ * before the X window is created (i.e. before Tk_MakeWindowExist is
+ * called).
*
* Results:
- * The return value is 1 if successful, or 0 if the X window has
- * been already created.
+ * The return value is 1 if successful, or 0 if the X window has been
+ * already created.
*
* Side effects:
* The information given is stored for when the window is created.
@@ -2168,15 +2147,15 @@ Tk_SetWindowColormap(tkwin, colormap)
*/
int
-Tk_SetWindowVisual(tkwin, visual, depth, colormap)
- Tk_Window tkwin; /* Window to manipulate. */
- Visual *visual; /* New visual for window. */
- int depth; /* New depth for window. */
- Colormap colormap; /* An appropriate colormap for the visual. */
+Tk_SetWindowVisual(
+ Tk_Window tkwin, /* Window to manipulate. */
+ Visual *visual, /* New visual for window. */
+ int depth, /* New depth for window. */
+ Colormap colormap) /* An appropriate colormap for the visual. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
- if( winPtr->window != None ){
+ if (winPtr->window != None) {
/* Too late! */
return 0;
}
@@ -2203,8 +2182,8 @@ Tk_SetWindowVisual(tkwin, visual, depth, colormap)
*
* TkDoConfigureNotify --
*
- * Generate a ConfigureNotify event describing the current
- * configuration of a window.
+ * Generate a ConfigureNotify event describing the current configuration
+ * of a window.
*
* Results:
* None.
@@ -2216,9 +2195,9 @@ Tk_SetWindowVisual(tkwin, visual, depth, colormap)
*/
void
-TkDoConfigureNotify(winPtr)
- register TkWindow *winPtr; /* Window whose configuration
- * was just changed. */
+TkDoConfigureNotify(
+ register TkWindow *winPtr) /* Window whose configuration was just
+ * changed. */
{
XEvent event;
@@ -2247,22 +2226,21 @@ TkDoConfigureNotify(winPtr)
*
* Tk_SetClass --
*
- * This procedure is used to give a window a class.
+ * This function is used to give a window a class.
*
* Results:
* None.
*
* Side effects:
- * A new class is stored for tkwin, replacing any existing
- * class for it.
+ * A new class is stored for tkwin, replacing any existing class for it.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetClass(tkwin, className)
- Tk_Window tkwin; /* Token for window to assign class. */
- CONST char *className; /* New class for tkwin. */
+Tk_SetClass(
+ Tk_Window tkwin, /* Token for window to assign class. */
+ CONST char *className) /* New class for tkwin. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2278,24 +2256,24 @@ Tk_SetClass(tkwin, className)
*
* Tk_SetClassProcs --
*
- * This procedure is used to set the class procedures and
- * instance data for a window.
+ * This function is used to set the class functions and instance data for
+ * a window.
*
* Results:
* None.
*
* Side effects:
- * A new set of class procedures and instance data is stored
- * for tkwin, replacing any existing values.
+ * A new set of class functions and instance data is stored for tkwin,
+ * replacing any existing values.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetClassProcs(tkwin, procs, instanceData)
- Tk_Window tkwin; /* Token for window to modify. */
- Tk_ClassProcs *procs; /* Class procs structure. */
- ClientData instanceData; /* Data to be passed to class procedures. */
+Tk_SetClassProcs(
+ Tk_Window tkwin, /* Token for window to modify. */
+ Tk_ClassProcs *procs, /* Class procs structure. */
+ ClientData instanceData) /* Data to be passed to class functions. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2308,14 +2286,14 @@ Tk_SetClassProcs(tkwin, procs, instanceData)
*
* Tk_NameToWindow --
*
- * Given a string name for a window, this procedure
- * returns the token for the window, if there exists a
- * window corresponding to the given name.
+ * Given a string name for a window, this function returns the token for
+ * the window, if there exists a window corresponding to the given name.
*
* Results:
- * The return result is either a token for the window corresponding
- * to "name", or else NULL to indicate that there is no such
- * window. In this case, an error message is left in the interp's result.
+ * The return result is either a token for the window corresponding to
+ * "name", or else NULL to indicate that there is no such window. In this
+ * case, an error message is left in the interp's result, unless interp
+ * is NULL.
*
* Side effects:
* None.
@@ -2324,28 +2302,33 @@ Tk_SetClassProcs(tkwin, procs, instanceData)
*/
Tk_Window
-Tk_NameToWindow(interp, pathName, tkwin)
- Tcl_Interp *interp; /* Where to report errors. */
- CONST char *pathName; /* Path name of window. */
- Tk_Window tkwin; /* Token for window: name is assumed to
- * belong to the same main window as tkwin. */
+Tk_NameToWindow(
+ Tcl_Interp *interp, /* Where to report errors. */
+ CONST char *pathName, /* Path name of window. */
+ Tk_Window tkwin) /* Token for window: name is assumed to belong
+ * to the same main window as tkwin. */
{
Tcl_HashEntry *hPtr;
if (tkwin == NULL) {
/*
* Either we're not really in Tk, or the main window was destroyed and
- * we're on our way out of the application
+ * we're on our way out of the application.
*/
- Tcl_AppendResult(interp, "NULL main window", (char *)NULL);
+
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "NULL main window", NULL);
+ }
return NULL;
}
-
+
hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->nameTable,
pathName);
if (hPtr == NULL) {
- Tcl_AppendResult(interp, "bad window path name \"",
- pathName, "\"", (char *) NULL);
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "bad window path name \"",
+ pathName, "\"", NULL);
+ }
return NULL;
}
return (Tk_Window) Tcl_GetHashValue(hPtr);
@@ -2356,14 +2339,13 @@ Tk_NameToWindow(interp, pathName, tkwin)
*
* Tk_IdToWindow --
*
- * Given an X display and window ID, this procedure returns the
- * Tk token for the window, if there exists a Tk window corresponding
- * to the given ID.
+ * Given an X display and window ID, this function returns the Tk token
+ * for the window, if there exists a Tk window corresponding to the given
+ * ID.
*
* Results:
- * The return result is either a token for the window corresponding
- * to the given X id, or else NULL to indicate that there is no such
- * window.
+ * The return result is either a token for the window corresponding to
+ * the given X id, or else NULL to indicate that there is no such window.
*
* Side effects:
* None.
@@ -2372,9 +2354,9 @@ Tk_NameToWindow(interp, pathName, tkwin)
*/
Tk_Window
-Tk_IdToWindow(display, window)
- Display *display; /* X display containing the window. */
- Window window; /* X window window id. */
+Tk_IdToWindow(
+ Display *display, /* X display containing the window. */
+ Window window) /* X window window id. */
{
TkDisplay *dispPtr;
Tcl_HashEntry *hPtr;
@@ -2403,8 +2385,8 @@ Tk_IdToWindow(display, window)
* Return the textual name of a window's display.
*
* Results:
- * The return value is the string name of the display associated
- * with tkwin.
+ * The return value is the string name of the display associated with
+ * tkwin.
*
* Side effects:
* None.
@@ -2413,8 +2395,8 @@ Tk_IdToWindow(display, window)
*/
CONST char *
-Tk_DisplayName(tkwin)
- Tk_Window tkwin; /* Window whose display name is desired. */
+Tk_DisplayName(
+ Tk_Window tkwin) /* Window whose display name is desired. */
{
return ((TkWindow *) tkwin)->dispPtr->name;
}
@@ -2422,10 +2404,35 @@ Tk_DisplayName(tkwin)
/*
*----------------------------------------------------------------------
*
+ * Tk_Interp --
+ *
+ * Get the Tcl interpreter from a Tk window.
+ *
+ * Results:
+ * A pointer to the interpreter or NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tcl_Interp *
+Tk_Interp(
+ Tk_Window tkwin)
+{
+ if (tkwin != NULL && ((TkWindow *)tkwin)->mainPtr != NULL) {
+ return ((TkWindow *)tkwin)->mainPtr->interp;
+ }
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* UnlinkWindow --
*
- * This procedure removes a window from the childList of its
- * parent.
+ * This function removes a window from the childList of its parent.
*
* Results:
* None.
@@ -2437,8 +2444,8 @@ Tk_DisplayName(tkwin)
*/
static void
-UnlinkWindow(winPtr)
- TkWindow *winPtr; /* Child window to be unlinked. */
+UnlinkWindow(
+ TkWindow *winPtr) /* Child window to be unlinked. */
{
TkWindow *prevPtr;
@@ -2455,7 +2462,7 @@ UnlinkWindow(winPtr)
while (prevPtr->nextPtr != winPtr) {
prevPtr = prevPtr->nextPtr;
if (prevPtr == NULL) {
- panic("UnlinkWindow couldn't find child in parent");
+ Tcl_Panic("UnlinkWindow couldn't find child in parent");
}
}
prevPtr->nextPtr = winPtr->nextPtr;
@@ -2473,9 +2480,8 @@ UnlinkWindow(winPtr)
* Change a window's position in the stacking order.
*
* Results:
- * TCL_OK is normally returned. If other is not a descendant
- * of tkwin's parent then TCL_ERROR is returned and tkwin is
- * not repositioned.
+ * TCL_OK is normally returned. If other is not a descendant of tkwin's
+ * parent then TCL_ERROR is returned and tkwin is not repositioned.
*
* Side effects:
* Tkwin is repositioned in the stacking order.
@@ -2484,23 +2490,23 @@ UnlinkWindow(winPtr)
*/
int
-Tk_RestackWindow(tkwin, aboveBelow, other)
- Tk_Window tkwin; /* Token for window whose position in
- * the stacking order is to change. */
- int aboveBelow; /* Indicates new position of tkwin relative
- * to other; must be Above or Below. */
- Tk_Window other; /* Tkwin will be moved to a position that
- * puts it just above or below this window.
- * If NULL then tkwin goes above or below
- * all windows in the same parent. */
+Tk_RestackWindow(
+ Tk_Window tkwin, /* Token for window whose position in the
+ * stacking order is to change. */
+ int aboveBelow, /* Indicates new position of tkwin relative to
+ * other; must be Above or Below. */
+ Tk_Window other) /* Tkwin will be moved to a position that puts
+ * it just above or below this window. If NULL
+ * then tkwin goes above or below all windows
+ * in the same parent. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *otherPtr = (TkWindow *) other;
/*
- * Special case: if winPtr is a top-level window then just find
- * the top-level ancestor of otherPtr and restack winPtr above
- * otherPtr without changing any of Tk's childLists.
+ * Special case: if winPtr is a top-level window then just find the
+ * top-level ancestor of otherPtr and restack winPtr above otherPtr
+ * without changing any of Tk's childLists.
*/
if (winPtr->flags & TK_WIN_MANAGED) {
@@ -2517,7 +2523,7 @@ Tk_RestackWindow(tkwin, aboveBelow, other)
if (winPtr->parentPtr == NULL) {
/*
- * Window is going to be deleted shortly; don't do anything.
+ * Window is going to be deleted shortly; don't do anything.
*/
return TCL_OK;
@@ -2567,10 +2573,9 @@ Tk_RestackWindow(tkwin, aboveBelow, other)
}
/*
- * Notify the X server of the change. If winPtr hasn't yet been
- * created then there's no need to tell the X server now, since
- * the stacking order will be handled properly when the window
- * is finally created.
+ * Notify the X server of the change. If winPtr hasn't yet been created
+ * then there's no need to tell the X server now, since the stacking order
+ * will be handled properly when the window is finally created.
*/
if (winPtr->window != None) {
@@ -2602,9 +2607,9 @@ Tk_RestackWindow(tkwin, aboveBelow, other)
* Returns the main window for an application.
*
* Results:
- * If interp has a Tk application associated with it, the main
- * window for the application is returned. Otherwise NULL is
- * returned and an error message is left in the interp's result.
+ * If interp has a Tk application associated with it, the main window for
+ * the application is returned. Otherwise NULL is returned and an error
+ * message is left in the interp's result.
*
* Side effects:
* None.
@@ -2613,10 +2618,9 @@ Tk_RestackWindow(tkwin, aboveBelow, other)
*/
Tk_Window
-Tk_MainWindow(interp)
- Tcl_Interp *interp; /* Interpreter that embodies the
- * application. Used for error
- * reporting also. */
+Tk_MainWindow(
+ Tcl_Interp *interp) /* Interpreter that embodies the application.
+ * Used for error reporting also. */
{
TkMainInfo *mainPtr;
ThreadSpecificData *tsdPtr;
@@ -2629,7 +2633,7 @@ Tk_MainWindow(interp)
return NULL;
}
#endif
- tsdPtr = (ThreadSpecificData *)
+ tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL;
@@ -2647,14 +2651,14 @@ Tk_MainWindow(interp)
*
* Tk_StrictMotif --
*
- * Indicates whether strict Motif compliance has been specified
- * for the given window.
+ * Indicates whether strict Motif compliance has been specified for the
+ * given window.
*
* Results:
- * The return value is 1 if strict Motif compliance has been
- * requested for tkwin's application by setting the tk_strictMotif
- * variable in its interpreter to a true value. 0 is returned
- * if tk_strictMotif has a false value.
+ * The return value is 1 if strict Motif compliance has been requested
+ * for tkwin's application by setting the tk_strictMotif variable in its
+ * interpreter to a true value. 0 is returned if tk_strictMotif has a
+ * false value.
*
* Side effects:
* None.
@@ -2663,9 +2667,9 @@ Tk_MainWindow(interp)
*/
int
-Tk_StrictMotif(tkwin)
- Tk_Window tkwin; /* Window whose application is
- * to be checked. */
+Tk_StrictMotif(
+ Tk_Window tkwin) /* Window whose application is to be
+ * checked. */
{
return ((TkWindow *) tkwin)->mainPtr->strictMotif;
}
@@ -2675,8 +2679,8 @@ Tk_StrictMotif(tkwin)
*
* Tk_GetNumMainWindows --
*
- * This procedure returns the number of main windows currently
- * open in this process.
+ * This function returns the number of main windows currently open in
+ * this process.
*
* Results:
* The number of main windows open in this process.
@@ -2688,7 +2692,7 @@ Tk_StrictMotif(tkwin)
*/
int
-Tk_GetNumMainWindows()
+Tk_GetNumMainWindows(void)
{
ThreadSpecificData *tsdPtr;
@@ -2698,8 +2702,8 @@ Tk_GetNumMainWindows()
}
#endif
- tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->numMainWindows;
}
@@ -2725,9 +2729,9 @@ Tk_GetNumMainWindows()
*/
int
-TkpAlwaysShowSelection(tkwin)
- Tk_Window tkwin; /* Window whose application is
- * to be checked. */
+TkpAlwaysShowSelection(
+ Tk_Window tkwin) /* Window whose application is to be
+ * checked. */
{
return ((TkWindow *) tkwin)->mainPtr->alwaysShowSelection;
}
@@ -2737,11 +2741,10 @@ TkpAlwaysShowSelection(tkwin)
*
* DeleteWindowsExitProc --
*
- * This procedure is invoked as an exit handler. It deletes all
- * of the main windows in the current thread. We really should
- * be using a thread local exit handler to delete windows and a
- * process exit handler to close the display but Tcl does
- * not provide support for this usage.
+ * This function is invoked as an exit handler. It deletes all of the
+ * main windows in the current thread. We really should be using a thread
+ * local exit handler to delete windows and a process exit handler to
+ * close the display but Tcl does not provide support for this usage.
*
* Results:
* None.
@@ -2753,67 +2756,67 @@ TkpAlwaysShowSelection(tkwin)
*/
static void
-DeleteWindowsExitProc(clientData)
- ClientData clientData; /* tsdPtr when handler was created. */
+DeleteWindowsExitProc(
+ ClientData clientData) /* tsdPtr when handler was created. */
{
TkDisplay *dispPtr, *nextPtr;
Tcl_Interp *interp;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
+ if (tsdPtr == NULL) {
+ return;
+ }
+
/*
- * Finish destroying any windows that are in a
- * half-dead state. We must protect the interpreter
- * while destroying the window, because of <Destroy>
- * bindings which could destroy the interpreter
- * while the window is being deleted. This would
- * leave frames on the call stack pointing at
+ * Finish destroying any windows that are in a half-dead state. We must
+ * protect the interpreter while destroying the window, because of
+ * <Destroy> bindings which could destroy the interpreter while the window
+ * is being deleted. This would leave frames on the call stack pointing at
* deleted memory, causing core dumps.
*/
while (tsdPtr->halfdeadWindowList != NULL) {
- interp = tsdPtr->halfdeadWindowList->winPtr->mainPtr->interp;
- Tcl_Preserve((ClientData) interp);
- tsdPtr->halfdeadWindowList->flags |= HD_CLEANUP;
- tsdPtr->halfdeadWindowList->winPtr->flags &= ~TK_ALREADY_DEAD;
- Tk_DestroyWindow((Tk_Window) tsdPtr->halfdeadWindowList->winPtr);
- Tcl_Release((ClientData) interp);
+ interp = tsdPtr->halfdeadWindowList->winPtr->mainPtr->interp;
+ Tcl_Preserve((ClientData) interp);
+ tsdPtr->halfdeadWindowList->flags |= HD_CLEANUP;
+ tsdPtr->halfdeadWindowList->winPtr->flags &= ~TK_ALREADY_DEAD;
+ Tk_DestroyWindow((Tk_Window) tsdPtr->halfdeadWindowList->winPtr);
+ Tcl_Release((ClientData) interp);
}
/*
* Destroy any remaining main windows.
*/
- while (tsdPtr->mainWindowList != NULL) {
- interp = tsdPtr->mainWindowList->interp;
- Tcl_Preserve((ClientData) interp);
- Tk_DestroyWindow((Tk_Window) tsdPtr->mainWindowList->winPtr);
- Tcl_Release((ClientData) interp);
+ while (tsdPtr->mainWindowList != NULL) {
+ interp = tsdPtr->mainWindowList->interp;
+ Tcl_Preserve((ClientData) interp);
+ Tk_DestroyWindow((Tk_Window) tsdPtr->mainWindowList->winPtr);
+ Tcl_Release((ClientData) interp);
}
/*
- * Iterate destroying the displays until no more displays remain.
- * It is possible for displays to get recreated during exit by any
- * code that calls GetScreen, so we must destroy these new displays
- * as well as the old ones.
+ * Iterate destroying the displays until no more displays remain. It is
+ * possible for displays to get recreated during exit by any code that
+ * calls GetScreen, so we must destroy these new displays as well as the
+ * old ones.
*/
- for (dispPtr = tsdPtr->displayList;
- dispPtr != NULL;
- dispPtr = tsdPtr->displayList) {
- /*
- * Now iterate over the current list of open displays, and first
- * set the global pointer to NULL so we will be able to notice if
- * any new displays got created during deletion of the current set.
- * We must also do this to ensure that Tk_IdToWindow does not find
- * the old display as it is being destroyed, when it wants to see
- * if it needs to dispatch a message.
- */
-
- for (tsdPtr->displayList = NULL; dispPtr != NULL;
- dispPtr = nextPtr) {
- nextPtr = dispPtr->nextPtr;
- TkCloseDisplay(dispPtr);
- }
+ for (dispPtr = tsdPtr->displayList; dispPtr != NULL;
+ dispPtr = tsdPtr->displayList) {
+ /*
+ * Now iterate over the current list of open displays, and first set
+ * the global pointer to NULL so we will be able to notice if any new
+ * displays got created during deletion of the current set. We must
+ * also do this to ensure that Tk_IdToWindow does not find the old
+ * display as it is being destroyed, when it wants to see if it needs
+ * to dispatch a message.
+ */
+
+ for (tsdPtr->displayList = NULL; dispPtr != NULL; dispPtr = nextPtr) {
+ nextPtr = dispPtr->nextPtr;
+ TkCloseDisplay(dispPtr);
+ }
}
tsdPtr->numMainWindows = 0;
@@ -2826,18 +2829,17 @@ DeleteWindowsExitProc(clientData)
*
* Tk_Init --
*
- * This procedure is invoked to add Tk to an interpreter. It
- * incorporates all of Tk's commands into the interpreter and
- * creates the main window for a new Tk application. If the
- * interpreter contains a variable "argv", this procedure
- * extracts several arguments from that variable, uses them
- * to configure the main window, and modifies argv to exclude
- * the arguments (see the "wish" documentation for a list of
- * the arguments that are extracted).
+ * This function is invoked to add Tk to an interpreter. It incorporates
+ * all of Tk's commands into the interpreter and creates the main window
+ * for a new Tk application. If the interpreter contains a variable
+ * "argv", this function extracts several arguments from that variable,
+ * uses them to configure the main window, and modifies argv to exclude
+ * the arguments (see the "wish" documentation for a list of the
+ * arguments that are extracted).
*
* Results:
- * Returns a standard Tcl completion code and sets the interp's result
- * if there is an error.
+ * Returns a standard Tcl completion code and sets the interp's result if
+ * there is an error.
*
* Side effects:
* Depends on various initialization scripts that get invoked.
@@ -2846,8 +2848,8 @@ DeleteWindowsExitProc(clientData)
*/
int
-Tk_Init(interp)
- Tcl_Interp *interp; /* Interpreter to initialize. */
+Tk_Init(
+ Tcl_Interp *interp) /* Interpreter to initialize. */
{
return Initialize(interp);
}
@@ -2857,12 +2859,12 @@ Tk_Init(interp)
*
* Tk_SafeInit --
*
- * This procedure is invoked to add Tk to a safe interpreter. It
- * invokes the internal procedure that does the real work.
+ * This function is invoked to add Tk to a safe interpreter. It invokes
+ * the internal function that does the real work.
*
* Results:
- * Returns a standard Tcl completion code and sets the interp's result
- * if there is an error.
+ * Returns a standard Tcl completion code and sets the interp's result if
+ * there is an error.
*
* Side effects:
* Depends on various initialization scripts that are invoked.
@@ -2871,50 +2873,50 @@ Tk_Init(interp)
*/
int
-Tk_SafeInit(interp)
- Tcl_Interp *interp; /* Interpreter to initialize. */
+Tk_SafeInit(
+ Tcl_Interp *interp) /* Interpreter to initialize. */
{
/*
- * Initialize the interpreter with Tk, safely. This removes
- * all the Tk commands that are unsafe.
+ * Initialize the interpreter with Tk, safely. This removes all the Tk
+ * commands that are unsafe.
*
* Rationale:
*
- * - Toplevel and menu are unsafe because they can be used to cover
- * the entire screen and to steal input from the user.
+ * - Toplevel and menu are unsafe because they can be used to cover the
+ * entire screen and to steal input from the user.
* - Continuous ringing of the bell is a nuisance.
- * - Cannot allow access to the clipboard because a malicious script
- * can replace the contents with the string "rm -r *" and lead to
- * surprises when the contents of the clipboard are pasted. Similarly,
- * the selection command is blocked.
- * - Cannot allow send because it can be used to cause unsafe
- * interpreters to execute commands. The tk command recreates the
- * send command, so that too must be hidden.
- * - Focus can be used to grab the focus away from another window,
- * in effect stealing user input. Cannot allow that.
- * NOTE: We currently do *not* hide focus as it would make it
- * impossible to provide keyboard input to Tk in a safe interpreter.
- * - Grab can be used to block the user from using any other apps
- * on the screen.
+ * - Cannot allow access to the clipboard because a malicious script can
+ * replace the contents with the string "rm -r *" and lead to surprises
+ * when the contents of the clipboard are pasted. Similarly, the
+ * selection command is blocked.
+ * - Cannot allow send because it can be used to cause unsafe interpreters
+ * to execute commands. The tk command recreates the send command, so
+ * that too must be hidden.
+ * - Focus can be used to grab the focus away from another window, in
+ * effect stealing user input. Cannot allow that.
+ * NOTE: We currently do *not* hide focus as it would make it impossible
+ * to provide keyboard input to Tk in a safe interpreter.
+ * - Grab can be used to block the user from using any other apps on the
+ * screen.
* - Tkwait can block the containing process forever. Use bindings,
* fileevents and split the protocol into before-the-wait and
* after-the-wait parts. More work but necessary.
- * - Wm is unsafe because (if toplevels are allowed, in the future)
- * it can be used to remove decorations, move windows around, cover
- * the entire screen etc etc.
+ * - Wm is unsafe because (if toplevels are allowed, in the future) it can
+ * be used to remove decorations, move windows around, cover the entire
+ * screen etc etc.
*
* Current risks:
*
* - No CPU time limit, no memory allocation limits, no color limits.
+ * CPU time limits can be imposed by an unsafe master interpreter.
*
- * The actual code called is the same as Tk_Init but Tcl_IsSafe()
- * is checked at several places to differentiate the two initialisations.
+ * The actual code called is the same as Tk_Init but Tcl_IsSafe() is
+ * checked at several places to differentiate the two initialisations.
*/
return Initialize(interp);
}
-
extern TkStubs tkStubs;
/*
@@ -2922,6 +2924,7 @@ extern TkStubs tkStubs;
*
* Initialize --
*
+ * ???TODO???
*
* Results:
* A standard Tcl result. Also leaves an error message in the interp's
@@ -2934,33 +2937,34 @@ extern TkStubs tkStubs;
*/
static int
-Initialize(interp)
- Tcl_Interp *interp; /* Interpreter to initialize. */
+Initialize(
+ Tcl_Interp *interp) /* Interpreter to initialize. */
{
char *p;
int argc, code;
- CONST char **argv;
+ CONST char **argv;
char *args[20];
CONST char *argString = NULL;
Tcl_DString class;
ThreadSpecificData *tsdPtr;
-
+
/*
- * Ensure that we are getting the matching version of Tcl. This is
- * really only an issue when Tk is loaded dynamically.
+ * Ensure that we are getting the matching version of Tcl. This is really
+ * only an issue when Tk is loaded dynamically.
*/
- if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
- return TCL_ERROR;
+ if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+ return TCL_ERROR;
}
/*
* Ensure that our obj-types are registered with the Tcl runtime.
*/
+
TkRegisterObjTypes();
- tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Start by initializing all the static variables to default acceptable
@@ -2982,27 +2986,30 @@ Initialize(interp)
/*
* We start by resetting the result because it might not be clean
*/
+
Tcl_ResetResult(interp);
if (Tcl_IsSafe(interp)) {
/*
- * Get the clearance to start Tk and the "argv" parameters
- * from the master.
+ * Get the clearance to start Tk and the "argv" parameters from the
+ * master.
*/
+
Tcl_DString ds;
/*
- * Step 1 : find the master and construct the interp name
- * (could be a function if new APIs were ok).
- * We could also construct the path while walking, but there
- * is no API to get the name of an interp either.
+ * Step 1 : find the master and construct the interp name (could be a
+ * function if new APIs were ok). We could also construct the path
+ * while walking, but there is no API to get the name of an interp
+ * either.
*/
+
Tcl_Interp *master = interp;
while (1) {
master = Tcl_GetMaster(master);
if (master == NULL) {
- Tcl_AppendResult(interp, "NULL master", (char *) NULL);
+ Tcl_AppendResult(interp, "NULL master", NULL);
code = TCL_ERROR;
goto done;
}
@@ -3011,59 +3018,65 @@ Initialize(interp)
break;
}
}
+
/*
* Construct the name (rewalk...)
*/
- if ((code = Tcl_GetInterpPath(master, interp)) != TCL_OK) {
- Tcl_AppendResult(interp, "error in Tcl_GetInterpPath",
- (char *) NULL);
+
+ code = Tcl_GetInterpPath(master, interp);
+ if (code != TCL_OK) {
+ Tcl_AppendResult(interp, "error in Tcl_GetInterpPath", NULL);
goto done;
}
+
/*
* Build the string to eval.
*/
+
Tcl_DStringInit(&ds);
Tcl_DStringAppendElement(&ds, "::safe::TkInit");
Tcl_DStringAppendElement(&ds, Tcl_GetStringResult(master));
/*
- * Step 2 : Eval in the master. The argument is the *reversed*
- * interp path of the slave.
+ * Step 2 : Eval in the master. The argument is the *reversed* interp
+ * path of the slave.
*/
- if ((code = Tcl_Eval(master, Tcl_DStringValue(&ds))) != TCL_OK) {
+ code = Tcl_Eval(master, Tcl_DStringValue(&ds));
+ if (code != TCL_OK) {
/*
- * We might want to transfer the error message or not.
- * We don't. (no API to do it and maybe security reasons).
+ * We might want to transfer the error message or not. We don't.
+ * (No API to do it and maybe security reasons).
*/
+
Tcl_DStringFree(&ds);
- Tcl_AppendResult(interp,
- "not allowed to start Tk by master's safe::TkInit",
- (char *) NULL);
+ Tcl_AppendResult(interp,
+ "not allowed to start Tk by master's safe::TkInit", NULL);
goto done;
}
Tcl_DStringFree(&ds);
- /*
- * Use the master's result as argv.
- * Note: We don't use the Obj interfaces to avoid dealing with
- * cross interp refcounting and changing the code below.
+
+ /*
+ * Use the master's result as argv. Note: We don't use the Obj
+ * interfaces to avoid dealing with cross interp refcounting and
+ * changing the code below.
*/
argString = Tcl_GetStringResult(master);
} else {
/*
- * If there is an "argv" variable, get its value, extract out
- * relevant arguments from it, and rewrite the variable without
- * the arguments that we used.
+ * If there is an "argv" variable, get its value, extract out relevant
+ * arguments from it, and rewrite the variable without the arguments
+ * that we used.
*/
- argString = Tcl_GetVar2(interp, "argv", (char *) NULL, TCL_GLOBAL_ONLY);
+ argString = Tcl_GetVar2(interp, "argv", NULL, TCL_GLOBAL_ONLY);
}
if (argString != NULL) {
char buffer[TCL_INTEGER_SPACE];
if (Tcl_SplitList(interp, argString, &argc, &argv) != TCL_OK) {
- argError:
+ argError:
Tcl_AddErrorInfo(interp,
"\n (processing arguments in argv variable)");
code = TCL_ERROR;
@@ -3075,9 +3088,9 @@ Initialize(interp)
goto argError;
}
p = Tcl_Merge(argc, argv);
- Tcl_SetVar2(interp, "argv", (char *) NULL, p, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "argv", NULL, p, TCL_GLOBAL_ONLY);
sprintf(buffer, "%d", argc);
- Tcl_SetVar2(interp, "argc", (char *) NULL, buffer, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "argc", NULL, buffer, TCL_GLOBAL_ONLY);
ckfree(p);
}
@@ -3088,6 +3101,7 @@ Initialize(interp)
Tcl_DStringInit(&class);
if (name == NULL) {
int offset;
+
TkpGetAppName(interp, &class);
offset = Tcl_DStringLength(&class)+1;
Tcl_DStringSetLength(&class, offset);
@@ -3103,8 +3117,8 @@ Initialize(interp)
}
/*
- * Create an argument list for creating the top-level window,
- * using the information parsed from argv, if any.
+ * Create an argument list for creating the top-level window, using the
+ * information parsed from argv, if any.
*/
args[0] = "toplevel";
@@ -3118,9 +3132,9 @@ Initialize(interp)
argc += 2;
/*
- * If this is the first application for this process, save
- * the display name in the DISPLAY environment variable so
- * that it will be available to subprocesses created by us.
+ * If this is the first application for this process, save the display
+ * name in the DISPLAY environment variable so that it will be
+ * available to subprocesses created by us.
*/
if (tsdPtr->numMainWindows == 0) {
@@ -3131,19 +3145,19 @@ Initialize(interp)
args[argc] = "-colormap";
args[argc+1] = colormap;
argc += 2;
- colormap = NULL;
+ colormap = NULL;
}
if (use != NULL) {
args[argc] = "-use";
args[argc+1] = use;
argc += 2;
- use = NULL;
+ use = NULL;
}
if (visual != NULL) {
args[argc] = "-visual";
args[argc+1] = visual;
argc += 2;
- visual = NULL;
+ visual = NULL;
}
args[argc] = NULL;
code = TkCreateFrame((ClientData) NULL, interp, argc, args, 1, name);
@@ -3158,20 +3172,20 @@ Initialize(interp)
}
/*
- * Set the geometry of the main window, if requested. Put the
- * requested geometry into the "geometry" variable.
+ * Set the geometry of the main window, if requested. Put the requested
+ * geometry into the "geometry" variable.
*/
if (geometry != NULL) {
Tcl_SetVar(interp, "geometry", geometry, TCL_GLOBAL_ONLY);
- code = Tcl_VarEval(interp, "wm geometry . ", geometry, (char *) NULL);
+ code = Tcl_VarEval(interp, "wm geometry . ", geometry, NULL);
if (code != TCL_OK) {
goto done;
}
- geometry = NULL;
+ geometry = NULL;
}
- if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 1) == NULL) {
+ if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) {
code = TCL_ERROR;
goto done;
}
@@ -3180,21 +3194,21 @@ Initialize(interp)
* Provide Tk and its stub table.
*/
- code = Tcl_PkgProvideEx(interp, "Tk", TK_VERSION, (ClientData) &tkStubs);
+ code = Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL,
+ (ClientData) &tkStubs);
if (code != TCL_OK) {
goto done;
- } else {
- /*
- * If we were able to provide ourselves as a package, then set
- * the main loop procedure in Tcl to our main loop proc. This
- * will cause tclsh to be event-aware when Tk is dynamically
- * loaded. This will have no effect in wish, which already is
- * prepared to run the event loop.
- */
-
- Tcl_SetMainLoop(Tk_MainLoop);
}
+ /*
+ * If we were able to provide ourselves as a package, then set the main
+ * loop function in Tcl to our main loop proc. This will cause tclsh to be
+ * event-aware when Tk is dynamically loaded. This will have no effect in
+ * wish, which already is prepared to run the event loop.
+ */
+
+ Tcl_SetMainLoop(Tk_MainLoop);
+
#ifdef Tk_InitStubs
#undef Tk_InitStubs
#endif
@@ -3202,21 +3216,116 @@ Initialize(interp)
Tk_InitStubs(interp, TK_VERSION, 1);
/*
- * Invoke platform-specific initialization.
- * Unlock mutex before entering TkpInit, as that may run through the
- * Tk_Init routine again for the console window interpreter.
+ * Initialized the themed widget set
+ */
+
+ code = Ttk_Init(interp);
+ if (code != TCL_OK) {
+ goto done;
+ }
+
+ /*
+ * Invoke platform-specific initialization. Unlock mutex before entering
+ * TkpInit, as that may run through the Tk_Init routine again for the
+ * console window interpreter.
*/
Tcl_MutexUnlock(&windowMutex);
if (argv != NULL) {
ckfree((char *) argv);
}
- return TkpInit(interp);
+ code = TkpInit(interp);
+ if (code == TCL_OK) {
- done:
+ /*
+ * In order to find tk.tcl during initialization, we evaluate the
+ * following script. It calls on the Tcl command [tcl_findLibrary]
+ * to perform the search. See the docs for that command for details
+ * on where it looks.
+ *
+ * Note that this entire search mechanism can be bypassed by defining
+ * an alternate [tkInit] command before calling Tk_Init().
+ */
+
+ code = Tcl_Eval(interp,
+"if {[namespace which -command tkInit] eq \"\"} {\n\
+ proc tkInit {} {\n\
+ global tk_library tk_version tk_patchLevel\n\
+ rename tkInit {}\n\
+ tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\
+ }\n\
+}\n\
+tkInit");
+ }
+ if (code == TCL_OK) {
+ /*
+ * Create exit handlers to delete all windows when the application or
+ * thread exits. The handler need to be invoked before other platform
+ * specific cleanups take place to avoid panics in finalization.
+ */
+
+ TkCreateThreadExitHandler(DeleteWindowsExitProc, (ClientData) tsdPtr);
+ }
+ return code;
+
+ done:
Tcl_MutexUnlock(&windowMutex);
if (argv != NULL) {
ckfree((char *) argv);
}
return code;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_PkgInitStubsCheck --
+ *
+ * This is a replacement routine for Tk_InitStubs() that is called
+ * from code where -DUSE_TK_STUBS has not been enabled.
+ *
+ * Results:
+ * Returns the version of a conforming Tk stubs table, or NULL, if
+ * the table version doesn't satisfy the requested requirements,
+ * according to historical practice.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+CONST char *
+Tk_PkgInitStubsCheck(
+ Tcl_Interp *interp,
+ CONST char * version,
+ int exact)
+{
+ CONST char *actualVersion = Tcl_PkgRequire(interp, "Tk", version, 0);
+
+ if (exact && actualVersion) {
+ CONST char *p = version;
+ int count = 0;
+
+ while (*p) {
+ count += !isdigit(UCHAR(*p++));
+ }
+ if (count == 1) {
+ if (0 != strncmp(version, actualVersion, strlen(version))) {
+ /* Construct error message */
+ Tcl_PkgPresent(interp, "Tk", version, 1);
+ return NULL;
+ }
+ } else {
+ return Tcl_PkgPresent(interp, "Tk", version, 1);
+ }
+ }
+ return actualVersion;
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/ttk/ttk.decls b/generic/ttk/ttk.decls
new file mode 100644
index 0000000..8b2b50b
--- /dev/null
+++ b/generic/ttk/ttk.decls
@@ -0,0 +1,150 @@
+library ttk
+interface ttk
+epoch 0
+scspec TTKAPI
+
+declare 0 current {
+ Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *name);
+}
+declare 1 current {
+ Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp);
+}
+declare 2 current {
+ Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp);
+}
+declare 3 current {
+ Ttk_Theme Ttk_CreateTheme(
+ Tcl_Interp *interp, const char *name, Ttk_Theme parent);
+}
+declare 4 current {
+ void Ttk_RegisterCleanup(
+ Tcl_Interp *interp, void *deleteData, Ttk_CleanupProc *cleanupProc);
+}
+
+declare 5 current {
+ int Ttk_RegisterElementSpec(
+ Ttk_Theme theme,
+ const char *elementName,
+ Ttk_ElementSpec *elementSpec,
+ void *clientData);
+}
+
+declare 6 current {
+ Ttk_ElementClass *Ttk_RegisterElement(
+ Tcl_Interp *interp,
+ Ttk_Theme theme,
+ const char *elementName,
+ Ttk_ElementSpec *elementSpec,
+ void *clientData);
+}
+
+declare 7 current {
+ int Ttk_RegisterElementFactory(
+ Tcl_Interp *interp,
+ const char *name,
+ Ttk_ElementFactory factoryProc,
+ void *clientData);
+}
+
+declare 8 current {
+ void Ttk_RegisterLayout(
+ Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec);
+}
+
+#
+# State maps.
+#
+declare 10 current {
+ int Ttk_GetStateSpecFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec_rtn);
+}
+declare 11 current {
+ Tcl_Obj *Ttk_NewStateSpecObj(
+ unsigned int onbits, unsigned int offbits);
+}
+declare 12 current {
+ Ttk_StateMap Ttk_GetStateMapFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr);
+}
+declare 13 current {
+ Tcl_Obj *Ttk_StateMapLookup(
+ Tcl_Interp *interp, Ttk_StateMap map, Ttk_State state);
+}
+declare 14 current {
+ int Ttk_StateTableLookup(
+ Ttk_StateTable map[], Ttk_State state);
+}
+
+
+#
+# Low-level geometry utilities.
+#
+declare 20 current {
+ int Ttk_GetPaddingFromObj(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr,
+ Ttk_Padding *pad_rtn);
+}
+declare 21 current {
+ int Ttk_GetBorderFromObj(
+ Tcl_Interp *interp,
+ Tcl_Obj *objPtr,
+ Ttk_Padding *pad_rtn);
+}
+declare 22 current {
+ int Ttk_GetStickyFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Sticky *sticky_rtn);
+}
+declare 23 current {
+ Ttk_Padding Ttk_MakePadding(
+ short l, short t, short r, short b);
+}
+declare 24 current {
+ Ttk_Padding Ttk_UniformPadding(
+ short borderWidth);
+}
+declare 25 current {
+ Ttk_Padding Ttk_AddPadding(Ttk_Padding pad1, Ttk_Padding pad2);
+}
+declare 26 current {
+ Ttk_Padding Ttk_RelievePadding(
+ Ttk_Padding padding, int relief, int n);
+}
+declare 27 current {
+ Ttk_Box Ttk_MakeBox(int x, int y, int width, int height);
+}
+declare 28 current {
+ int Ttk_BoxContains(Ttk_Box box, int x, int y);
+}
+declare 29 current {
+ Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int w, int h, Ttk_Side side);
+}
+declare 30 current {
+ Ttk_Box Ttk_StickBox(Ttk_Box parcel, int w, int h, Ttk_Sticky sticky);
+}
+declare 31 current {
+ Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h, Tk_Anchor anchor);
+}
+declare 32 current {
+ Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p);
+}
+declare 33 current {
+ Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p);
+}
+declare 34 current {
+ Ttk_Box Ttk_PlaceBox(
+ Ttk_Box *cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky);
+}
+declare 35 current {
+ Tcl_Obj *Ttk_NewBoxObj(Ttk_Box box);
+}
+
+#
+# Utilities.
+#
+declare 40 current {
+ int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient);
+}
+
+
diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c
new file mode 100644
index 0000000..7e46fac
--- /dev/null
+++ b/generic/ttk/ttkBlink.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2004, Joe English.
+ *
+ * Usage:
+ * TtkBlinkCursor(corePtr), usually called in a widget's Init hook,
+ * arranges to periodically toggle the corePtr->flags CURSOR_ON bit
+ * on and off (and schedule a redisplay) whenever the widget has focus.
+ *
+ * Note: Widgets may have additional logic to decide whether
+ * to display the cursor or not (e.g., readonly or disabled states);
+ * TtkBlinkCursor() does not account for this.
+ *
+ * TODO:
+ * Add script-level access to configure application-wide blink rate.
+ */
+
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+#define DEF_CURSOR_ON_TIME 600 /* milliseconds */
+#define DEF_CURSOR_OFF_TIME 300 /* milliseconds */
+
+/* Interp-specific data for tracking cursors:
+ */
+typedef struct
+{
+ WidgetCore *owner; /* Widget that currently has cursor */
+ Tcl_TimerToken timer; /* Blink timer */
+ int onTime; /* #milliseconds to blink cursor on */
+ int offTime; /* #milliseconds to blink cursor off */
+} CursorManager;
+
+/* CursorManagerDeleteProc --
+ * InterpDeleteProc for cursor manager.
+ */
+static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp)
+{
+ CursorManager *cm = (CursorManager*)clientData;
+ if (cm->timer) {
+ Tcl_DeleteTimerHandler(cm->timer);
+ }
+ ckfree(clientData);
+}
+
+/* GetCursorManager --
+ * Look up and create if necessary the interp's cursor manager.
+ */
+static CursorManager *GetCursorManager(Tcl_Interp *interp)
+{
+ static const char *cm_key = "ttk::CursorManager";
+ CursorManager *cm = (CursorManager *) Tcl_GetAssocData(interp, cm_key,0);
+
+ if (!cm) {
+ cm = (CursorManager*)ckalloc(sizeof(*cm));
+ cm->timer = 0;
+ cm->owner = 0;
+ cm->onTime = DEF_CURSOR_ON_TIME;
+ cm->offTime = DEF_CURSOR_OFF_TIME;
+ Tcl_SetAssocData(interp,cm_key,CursorManagerDeleteProc,(ClientData)cm);
+ }
+ return cm;
+}
+
+/* CursorBlinkProc --
+ * Timer handler to blink the insert cursor on and off.
+ */
+static void
+CursorBlinkProc(ClientData clientData)
+{
+ CursorManager *cm = (CursorManager*)clientData;
+ int blinkTime;
+
+ if (cm->owner->flags & CURSOR_ON) {
+ cm->owner->flags &= ~CURSOR_ON;
+ blinkTime = cm->offTime;
+ } else {
+ cm->owner->flags |= CURSOR_ON;
+ blinkTime = cm->onTime;
+ }
+ cm->timer = Tcl_CreateTimerHandler(blinkTime, CursorBlinkProc, clientData);
+ TtkRedisplayWidget(cm->owner);
+}
+
+/* LoseCursor --
+ * Turn cursor off, disable blink timer.
+ */
+static void LoseCursor(CursorManager *cm, WidgetCore *corePtr)
+{
+ if (corePtr->flags & CURSOR_ON) {
+ corePtr->flags &= ~CURSOR_ON;
+ TtkRedisplayWidget(corePtr);
+ }
+ if (cm->owner == corePtr) {
+ cm->owner = NULL;
+ }
+ if (cm->timer) {
+ Tcl_DeleteTimerHandler(cm->timer);
+ cm->timer = 0;
+ }
+}
+
+/* ClaimCursor --
+ * Claim ownership of the insert cursor and blink on.
+ */
+static void ClaimCursor(CursorManager *cm, WidgetCore *corePtr)
+{
+ if (cm->owner == corePtr)
+ return;
+ if (cm->owner)
+ LoseCursor(cm, cm->owner);
+
+ corePtr->flags |= CURSOR_ON;
+ TtkRedisplayWidget(corePtr);
+
+ cm->owner = corePtr;
+ cm->timer = Tcl_CreateTimerHandler(cm->onTime, CursorBlinkProc, cm);
+}
+
+/*
+ * CursorEventProc --
+ * Event handler for FocusIn and FocusOut events;
+ * claim/lose ownership of the insert cursor when the widget
+ * acquires/loses keyboard focus.
+ */
+
+#define CursorEventMask (FocusChangeMask|StructureNotifyMask)
+#define RealFocusEvent(d) \
+ (d == NotifyInferior || d == NotifyAncestor || d == NotifyNonlinear)
+
+static void
+CursorEventProc(ClientData clientData, XEvent *eventPtr)
+{
+ WidgetCore *corePtr = (WidgetCore *)clientData;
+ CursorManager *cm = GetCursorManager(corePtr->interp);
+
+ switch (eventPtr->type) {
+ case DestroyNotify:
+ if (cm->owner == corePtr)
+ LoseCursor(cm, corePtr);
+ Tk_DeleteEventHandler(
+ corePtr->tkwin, CursorEventMask, CursorEventProc, clientData);
+ break;
+ case FocusIn:
+ if (RealFocusEvent(eventPtr->xfocus.detail))
+ ClaimCursor(cm, corePtr);
+ break;
+ case FocusOut:
+ if (RealFocusEvent(eventPtr->xfocus.detail))
+ LoseCursor(cm, corePtr);
+ break;
+ }
+}
+
+/*
+ * TtkBlinkCursor (main routine) --
+ * Arrange to blink the cursor on and off whenever the
+ * widget has focus.
+ */
+void TtkBlinkCursor(WidgetCore *corePtr)
+{
+ Tk_CreateEventHandler(
+ corePtr->tkwin, CursorEventMask, CursorEventProc, corePtr);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
new file mode 100644
index 0000000..2954184
--- /dev/null
+++ b/generic/ttk/ttkButton.c
@@ -0,0 +1,853 @@
+/*
+ * Copyright (c) 2003, Joe English
+ *
+ * label, button, checkbutton, radiobutton, and menubutton widgets.
+ */
+
+#include <string.h>
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/* Bit fields for OptionSpec mask field:
+ */
+#define STATE_CHANGED (0x100) /* -state option changed */
+#define DEFAULTSTATE_CHANGED (0x200) /* -default option changed */
+
+/*------------------------------------------------------------------------
+ * +++ Base resources for labels, buttons, checkbuttons, etc:
+ */
+typedef struct
+{
+ /*
+ * Text element resources:
+ */
+ Tcl_Obj *textObj;
+ Tcl_Obj *textVariableObj;
+ Tcl_Obj *underlineObj;
+ Tcl_Obj *widthObj;
+
+ Ttk_TraceHandle *textVariableTrace;
+ Ttk_ImageSpec *imageSpec;
+
+ /*
+ * Image element resources:
+ */
+ Tcl_Obj *imageObj;
+
+ /*
+ * Compound label/image resources:
+ */
+ Tcl_Obj *compoundObj;
+ Tcl_Obj *paddingObj;
+
+ /*
+ * Compatibility/legacy options:
+ */
+ Tcl_Obj *stateObj;
+
+} BasePart;
+
+typedef struct
+{
+ WidgetCore core;
+ BasePart base;
+} Base;
+
+static Tk_OptionSpec BaseOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-text", "text", "Text", "",
+ Tk_Offset(Base,base.textObj), -1,
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "",
+ Tk_Offset(Base,base.textVariableObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_INT, "-underline", "underline", "Underline",
+ "-1", Tk_Offset(Base,base.underlineObj), -1,
+ 0,0,0 },
+ /* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */
+ {TK_OPTION_STRING, "-width", "width", "Width",
+ NULL, Tk_Offset(Base,base.widthObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+
+ /*
+ * Image options
+ */
+ {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
+ Tk_Offset(Base,base.imageObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+
+ /*
+ * Compound base/image options
+ */
+ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
+ "none", Tk_Offset(Base,base.compoundObj), -1,
+ 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED },
+ {TK_OPTION_STRING, "-padding", "padding", "Pad",
+ NULL, Tk_Offset(Base,base.paddingObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED},
+
+ /*
+ * Compatibility/legacy options
+ */
+ {TK_OPTION_STRING, "-state", "state", "State",
+ "normal", Tk_Offset(Base,base.stateObj), -1,
+ 0,0,STATE_CHANGED },
+
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*
+ * Variable trace procedure for -textvariable option:
+ */
+static void TextVariableChanged(void *clientData, const char *value)
+{
+ Base *basePtr = clientData;
+ Tcl_Obj *newText;
+
+ if (WidgetDestroyed(&basePtr->core)) {
+ return;
+ }
+
+ newText = value ? Tcl_NewStringObj(value, -1) : Tcl_NewStringObj("", 0);
+
+ Tcl_IncrRefCount(newText);
+ Tcl_DecrRefCount(basePtr->base.textObj);
+ basePtr->base.textObj = newText;
+
+ TtkResizeWidget(&basePtr->core);
+}
+
+static void
+BaseInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Base *basePtr = recordPtr;
+ basePtr->base.textVariableTrace = 0;
+ basePtr->base.imageSpec = NULL;
+}
+
+static void
+BaseCleanup(void *recordPtr)
+{
+ Base *basePtr = recordPtr;
+ if (basePtr->base.textVariableTrace)
+ Ttk_UntraceVariable(basePtr->base.textVariableTrace);
+ if (basePtr->base.imageSpec)
+ TtkFreeImageSpec(basePtr->base.imageSpec);
+}
+
+static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Base *basePtr = recordPtr;
+ Tcl_Obj *textVarName = basePtr->base.textVariableObj;
+ Ttk_TraceHandle *vt = 0;
+ Ttk_ImageSpec *imageSpec = NULL;
+
+ if (textVarName != NULL && *Tcl_GetString(textVarName) != '\0') {
+ vt = Ttk_TraceVariable(interp,textVarName,TextVariableChanged,basePtr);
+ if (!vt) return TCL_ERROR;
+ }
+
+ if (basePtr->base.imageObj) {
+ imageSpec = TtkGetImageSpec(
+ interp, basePtr->core.tkwin, basePtr->base.imageObj);
+ if (!imageSpec) {
+ goto error;
+ }
+ }
+
+ if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) {
+error:
+ if (imageSpec) TtkFreeImageSpec(imageSpec);
+ if (vt) Ttk_UntraceVariable(vt);
+ return TCL_ERROR;
+ }
+
+ if (basePtr->base.textVariableTrace) {
+ Ttk_UntraceVariable(basePtr->base.textVariableTrace);
+ }
+ basePtr->base.textVariableTrace = vt;
+
+ if (basePtr->base.imageSpec) {
+ TtkFreeImageSpec(basePtr->base.imageSpec);
+ }
+ basePtr->base.imageSpec = imageSpec;
+
+ if (mask & STATE_CHANGED) {
+ TtkCheckStateOption(&basePtr->core, basePtr->base.stateObj);
+ }
+
+ return TCL_OK;
+}
+
+static int
+BasePostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Base *basePtr = recordPtr;
+ int status = TCL_OK;
+
+ if (basePtr->base.textVariableTrace) {
+ status = Ttk_FireTrace(basePtr->base.textVariableTrace);
+ }
+
+ return status;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Label widget.
+ * Just a base widget that adds a few appearance-related options
+ */
+
+typedef struct
+{
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *fontObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *anchorObj;
+ Tcl_Obj *justifyObj;
+ Tcl_Obj *wrapLengthObj;
+} LabelPart;
+
+typedef struct
+{
+ WidgetCore core;
+ BasePart base;
+ LabelPart label;
+} Label;
+
+static Tk_OptionSpec LabelOptionSpecs[] =
+{
+ {TK_OPTION_BORDER, "-background", "frameColor", "FrameColor",
+ NULL, Tk_Offset(Label,label.backgroundObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
+ NULL, Tk_Offset(Label,label.foregroundObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_FONT, "-font", "font", "Font",
+ NULL, Tk_Offset(Label,label.fontObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
+ NULL, Tk_Offset(Label,label.borderWidthObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
+ NULL, Tk_Offset(Label,label.reliefObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
+ NULL, Tk_Offset(Label,label.anchorObj), -1,
+ TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED},
+ {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
+ NULL, Tk_Offset(Label, label.justifyObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
+ NULL, Tk_Offset(Label, label.wrapLengthObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED /*SB: SIZE_CHANGED*/ },
+
+ WIDGET_TAKEFOCUS_FALSE,
+ WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
+};
+
+static const Ttk_Ensemble LabelCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { 0,0,0 }
+};
+
+static WidgetSpec LabelWidgetSpec =
+{
+ "TLabel", /* className */
+ sizeof(Label), /* recordSize */
+ LabelOptionSpecs, /* optionSpecs */
+ LabelCommands, /* subcommands */
+ BaseInitialize, /* initializeProc */
+ BaseCleanup, /* cleanupProc */
+ BaseConfigure, /* configureProc */
+ BasePostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(LabelLayout)
+ TTK_GROUP("Label.border", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Label.padding", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_NODE("Label.label", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Button widget.
+ * Adds a new subcommand "invoke", and options "-command" and "-default"
+ */
+
+typedef struct
+{
+ Tcl_Obj *commandObj;
+ Tcl_Obj *defaultStateObj;
+} ButtonPart;
+
+typedef struct
+{
+ WidgetCore core;
+ BasePart base;
+ ButtonPart button;
+} Button;
+
+/*
+ * Option specifications:
+ */
+static Tk_OptionSpec ButtonOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-command", "command", "Command",
+ "", Tk_Offset(Button, button.commandObj), -1, 0,0,0},
+ {TK_OPTION_STRING_TABLE, "-default", "default", "Default",
+ "normal", Tk_Offset(Button, button.defaultStateObj), -1,
+ 0, (ClientData) ttkDefaultStrings, DEFAULTSTATE_CHANGED},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
+};
+
+static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Button *buttonPtr = recordPtr;
+
+ if (BaseConfigure(interp, recordPtr, mask) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /* Handle "-default" option:
+ */
+ if (mask & DEFAULTSTATE_CHANGED) {
+ int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_GetButtonDefaultStateFromObj(
+ NULL, buttonPtr->button.defaultStateObj, &defaultState);
+ if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) {
+ TtkWidgetChangeState(&buttonPtr->core, TTK_STATE_ALTERNATE, 0);
+ } else {
+ TtkWidgetChangeState(&buttonPtr->core, 0, TTK_STATE_ALTERNATE);
+ }
+ }
+ return TCL_OK;
+}
+
+/* $button invoke --
+ * Evaluate the button's -command.
+ */
+static int
+ButtonInvokeCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Button *buttonPtr = recordPtr;
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "invoke");
+ return TCL_ERROR;
+ }
+ if (buttonPtr->core.state & TTK_STATE_DISABLED) {
+ return TCL_OK;
+ }
+ return Tcl_EvalObjEx(interp, buttonPtr->button.commandObj, TCL_EVAL_GLOBAL);
+}
+
+static const Ttk_Ensemble ButtonCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "invoke", ButtonInvokeCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { 0,0,0 }
+};
+
+static WidgetSpec ButtonWidgetSpec =
+{
+ "TButton", /* className */
+ sizeof(Button), /* recordSize */
+ ButtonOptionSpecs, /* optionSpecs */
+ ButtonCommands, /* subcommands */
+ BaseInitialize, /* initializeProc */
+ BaseCleanup, /* cleanupProc */
+ ButtonConfigure, /* configureProc */
+ BasePostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(ButtonLayout)
+ TTK_GROUP("Button.border", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Button.focus", TTK_FILL_BOTH,
+ TTK_GROUP("Button.padding", TTK_FILL_BOTH,
+ TTK_NODE("Button.label", TTK_FILL_BOTH))))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Checkbutton widget.
+ */
+typedef struct
+{
+ Tcl_Obj *variableObj;
+ Tcl_Obj *onValueObj;
+ Tcl_Obj *offValueObj;
+ Tcl_Obj *commandObj;
+
+ Ttk_TraceHandle *variableTrace;
+
+} CheckbuttonPart;
+
+typedef struct
+{
+ WidgetCore core;
+ BasePart base;
+ CheckbuttonPart checkbutton;
+} Checkbutton;
+
+/*
+ * Option specifications:
+ */
+static Tk_OptionSpec CheckbuttonOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-variable", "variable", "Variable",
+ "", Tk_Offset(Checkbutton, checkbutton.variableObj), -1,
+ TK_OPTION_DONT_SET_DEFAULT,0,0},
+ {TK_OPTION_STRING, "-onvalue", "onValue", "OnValue",
+ "1", Tk_Offset(Checkbutton, checkbutton.onValueObj), -1,
+ 0,0,0},
+ {TK_OPTION_STRING, "-offvalue", "offValue", "OffValue",
+ "0", Tk_Offset(Checkbutton, checkbutton.offValueObj), -1,
+ 0,0,0},
+ {TK_OPTION_STRING, "-command", "command", "Command",
+ "", Tk_Offset(Checkbutton, checkbutton.commandObj), -1,
+ 0,0,0},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
+};
+
+/*
+ * Variable trace procedure for checkbutton -variable option
+ */
+static void CheckbuttonVariableChanged(void *clientData, const char *value)
+{
+ Checkbutton *checkPtr = clientData;
+
+ if (WidgetDestroyed(&checkPtr->core)) {
+ return;
+ }
+
+ if (!value) {
+ TtkWidgetChangeState(&checkPtr->core, TTK_STATE_ALTERNATE, 0);
+ return;
+ }
+ /* else */
+ TtkWidgetChangeState(&checkPtr->core, 0, TTK_STATE_ALTERNATE);
+ if (!strcmp(value, Tcl_GetString(checkPtr->checkbutton.onValueObj))) {
+ TtkWidgetChangeState(&checkPtr->core, TTK_STATE_SELECTED, 0);
+ } else {
+ TtkWidgetChangeState(&checkPtr->core, 0, TTK_STATE_SELECTED);
+ }
+}
+
+static void
+CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Checkbutton *checkPtr = recordPtr;
+ Tcl_Obj *variableObj;
+
+ /* default -variable is the widget name:
+ */
+ variableObj = Tcl_NewStringObj(Tk_PathName(checkPtr->core.tkwin), -1);
+ Tcl_IncrRefCount(variableObj);
+ checkPtr->checkbutton.variableObj = variableObj;
+ BaseInitialize(interp, recordPtr);
+}
+
+static void
+CheckbuttonCleanup(void *recordPtr)
+{
+ Checkbutton *checkPtr = recordPtr;
+ Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace);
+ checkPtr->checkbutton.variableTrace = 0;
+ BaseCleanup(recordPtr);
+}
+
+static int
+CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Checkbutton *checkPtr = recordPtr;
+ Ttk_TraceHandle *vt = Ttk_TraceVariable(
+ interp, checkPtr->checkbutton.variableObj,
+ CheckbuttonVariableChanged, checkPtr);
+
+ if (!vt) {
+ return TCL_ERROR;
+ }
+
+ if (BaseConfigure(interp, recordPtr, mask) != TCL_OK){
+ Ttk_UntraceVariable(vt);
+ return TCL_ERROR;
+ }
+
+ Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace);
+ checkPtr->checkbutton.variableTrace = vt;
+
+ return TCL_OK;
+}
+
+static int
+CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Checkbutton *checkPtr = recordPtr;
+ int status = TCL_OK;
+
+ if (checkPtr->checkbutton.variableTrace)
+ status = Ttk_FireTrace(checkPtr->checkbutton.variableTrace);
+ if (status == TCL_OK && !WidgetDestroyed(&checkPtr->core))
+ status = BasePostConfigure(interp, recordPtr, mask);
+ return status;
+}
+
+/*
+ * Checkbutton 'invoke' subcommand:
+ * Toggles the checkbutton state.
+ */
+static int
+CheckbuttonInvokeCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Checkbutton *checkPtr = recordPtr;
+ WidgetCore *corePtr = &checkPtr->core;
+ Tcl_Obj *newValue;
+
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "invoke");
+ return TCL_ERROR;
+ }
+ if (corePtr->state & TTK_STATE_DISABLED)
+ return TCL_OK;
+
+ /*
+ * Toggle the selected state.
+ */
+ if (corePtr->state & TTK_STATE_SELECTED)
+ newValue = checkPtr->checkbutton.offValueObj;
+ else
+ newValue = checkPtr->checkbutton.onValueObj;
+
+ if (Tcl_ObjSetVar2(interp,
+ checkPtr->checkbutton.variableObj, NULL, newValue,
+ TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
+ == NULL)
+ return TCL_ERROR;
+
+ if (WidgetDestroyed(corePtr))
+ return TCL_ERROR;
+
+ return Tcl_EvalObjEx(interp,
+ checkPtr->checkbutton.commandObj, TCL_EVAL_GLOBAL);
+}
+
+static const Ttk_Ensemble CheckbuttonCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "invoke", CheckbuttonInvokeCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ /* MISSING: select, deselect, toggle */
+ { 0,0,0 }
+};
+
+static WidgetSpec CheckbuttonWidgetSpec =
+{
+ "TCheckbutton", /* className */
+ sizeof(Checkbutton), /* recordSize */
+ CheckbuttonOptionSpecs, /* optionSpecs */
+ CheckbuttonCommands, /* subcommands */
+ CheckbuttonInitialize, /* initializeProc */
+ CheckbuttonCleanup, /* cleanupProc */
+ CheckbuttonConfigure, /* configureProc */
+ CheckbuttonPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(CheckbuttonLayout)
+ TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Checkbutton.indicator", TTK_PACK_LEFT)
+ TTK_GROUP("Checkbutton.focus", TTK_PACK_LEFT | TTK_STICK_W,
+ TTK_NODE("Checkbutton.label", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Radiobutton widget.
+ */
+
+typedef struct
+{
+ Tcl_Obj *variableObj;
+ Tcl_Obj *valueObj;
+ Tcl_Obj *commandObj;
+
+ Ttk_TraceHandle *variableTrace;
+
+} RadiobuttonPart;
+
+typedef struct
+{
+ WidgetCore core;
+ BasePart base;
+ RadiobuttonPart radiobutton;
+} Radiobutton;
+
+/*
+ * Option specifications:
+ */
+static Tk_OptionSpec RadiobuttonOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-variable", "variable", "Variable",
+ "::selectedButton", Tk_Offset(Radiobutton, radiobutton.variableObj),-1,
+ 0,0,0},
+ {TK_OPTION_STRING, "-value", "Value", "Value",
+ "1", Tk_Offset(Radiobutton, radiobutton.valueObj), -1,
+ 0,0,0},
+ {TK_OPTION_STRING, "-command", "command", "Command",
+ "", Tk_Offset(Radiobutton, radiobutton.commandObj), -1,
+ 0,0,0},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
+};
+
+/*
+ * Variable trace procedure for radiobuttons.
+ */
+static void
+RadiobuttonVariableChanged(void *clientData, const char *value)
+{
+ Radiobutton *radioPtr = clientData;
+
+ if (WidgetDestroyed(&radioPtr->core)) {
+ return;
+ }
+
+ if (!value) {
+ TtkWidgetChangeState(&radioPtr->core, TTK_STATE_ALTERNATE, 0);
+ return;
+ }
+ /* else */
+ TtkWidgetChangeState(&radioPtr->core, 0, TTK_STATE_ALTERNATE);
+ if (!strcmp(value, Tcl_GetString(radioPtr->radiobutton.valueObj))) {
+ TtkWidgetChangeState(&radioPtr->core, TTK_STATE_SELECTED, 0);
+ } else {
+ TtkWidgetChangeState(&radioPtr->core, 0, TTK_STATE_SELECTED);
+ }
+}
+
+static void
+RadiobuttonCleanup(void *recordPtr)
+{
+ Radiobutton *radioPtr = recordPtr;
+ Ttk_UntraceVariable(radioPtr->radiobutton.variableTrace);
+ radioPtr->radiobutton.variableTrace = 0;
+ BaseCleanup(recordPtr);
+}
+
+static int
+RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Radiobutton *radioPtr = recordPtr;
+ Ttk_TraceHandle *vt = Ttk_TraceVariable(
+ interp, radioPtr->radiobutton.variableObj,
+ RadiobuttonVariableChanged, radioPtr);
+
+ if (!vt) {
+ return TCL_ERROR;
+ }
+
+ if (BaseConfigure(interp, recordPtr, mask) != TCL_OK) {
+ Ttk_UntraceVariable(vt);
+ return TCL_ERROR;
+ }
+
+ Ttk_UntraceVariable(radioPtr->radiobutton.variableTrace);
+ radioPtr->radiobutton.variableTrace = vt;
+
+ return TCL_OK;
+}
+
+static int
+RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Radiobutton *radioPtr = recordPtr;
+ int status = TCL_OK;
+
+ if (radioPtr->radiobutton.variableTrace)
+ status = Ttk_FireTrace(radioPtr->radiobutton.variableTrace);
+ if (status == TCL_OK && !WidgetDestroyed(&radioPtr->core))
+ status = BasePostConfigure(interp, recordPtr, mask);
+ return status;
+}
+
+/*
+ * Radiobutton 'invoke' subcommand:
+ * Sets the radiobutton -variable to the -value, evaluates the -command.
+ */
+static int
+RadiobuttonInvokeCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Radiobutton *radioPtr = recordPtr;
+ WidgetCore *corePtr = &radioPtr->core;
+
+ if (objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "invoke");
+ return TCL_ERROR;
+ }
+ if (corePtr->state & TTK_STATE_DISABLED)
+ return TCL_OK;
+
+ if (Tcl_ObjSetVar2(interp,
+ radioPtr->radiobutton.variableObj, NULL,
+ radioPtr->radiobutton.valueObj,
+ TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
+ == NULL)
+ return TCL_ERROR;
+
+ if (WidgetDestroyed(corePtr))
+ return TCL_ERROR;
+
+ return Tcl_EvalObjEx(interp,
+ radioPtr->radiobutton.commandObj, TCL_EVAL_GLOBAL);
+}
+
+static const Ttk_Ensemble RadiobuttonCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "invoke", RadiobuttonInvokeCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ /* MISSING: select, deselect */
+ { 0,0,0 }
+};
+
+static WidgetSpec RadiobuttonWidgetSpec =
+{
+ "TRadiobutton", /* className */
+ sizeof(Radiobutton), /* recordSize */
+ RadiobuttonOptionSpecs, /* optionSpecs */
+ RadiobuttonCommands, /* subcommands */
+ BaseInitialize, /* initializeProc */
+ RadiobuttonCleanup, /* cleanupProc */
+ RadiobuttonConfigure, /* configureProc */
+ RadiobuttonPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(RadiobuttonLayout)
+ TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Radiobutton.indicator", TTK_PACK_LEFT)
+ TTK_GROUP("Radiobutton.focus", TTK_PACK_LEFT,
+ TTK_NODE("Radiobutton.label", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Menubutton widget.
+ */
+
+typedef struct
+{
+ Tcl_Obj *menuObj;
+ Tcl_Obj *directionObj;
+} MenubuttonPart;
+
+typedef struct
+{
+ WidgetCore core;
+ BasePart base;
+ MenubuttonPart menubutton;
+} Menubutton;
+
+/*
+ * Option specifications:
+ */
+static const char *const directionStrings[] = {
+ "above", "below", "left", "right", "flush", NULL
+};
+static Tk_OptionSpec MenubuttonOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-menu", "menu", "Menu",
+ "", Tk_Offset(Menubutton, menubutton.menuObj), -1, 0,0,0},
+ {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
+ "below", Tk_Offset(Menubutton, menubutton.directionObj), -1,
+ 0,(ClientData)directionStrings,GEOMETRY_CHANGED},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
+};
+
+static const Ttk_Ensemble MenubuttonCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { 0,0,0 }
+};
+
+static WidgetSpec MenubuttonWidgetSpec =
+{
+ "TMenubutton", /* className */
+ sizeof(Menubutton), /* recordSize */
+ MenubuttonOptionSpecs, /* optionSpecs */
+ MenubuttonCommands, /* subcommands */
+ BaseInitialize, /* initializeProc */
+ BaseCleanup, /* cleanupProc */
+ BaseConfigure, /* configureProc */
+ BasePostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(MenubuttonLayout)
+ TTK_GROUP("Menubutton.border", TTK_FILL_BOTH,
+ TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH,
+ TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT)
+ TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkButton_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(theme, "TLabel", LabelLayout);
+ Ttk_RegisterLayout(theme, "TButton", ButtonLayout);
+ Ttk_RegisterLayout(theme, "TCheckbutton", CheckbuttonLayout);
+ Ttk_RegisterLayout(theme, "TRadiobutton", RadiobuttonLayout);
+ Ttk_RegisterLayout(theme, "TMenubutton", MenubuttonLayout);
+
+ RegisterWidget(interp, "ttk::label", &LabelWidgetSpec);
+ RegisterWidget(interp, "ttk::button", &ButtonWidgetSpec);
+ RegisterWidget(interp, "ttk::checkbutton", &CheckbuttonWidgetSpec);
+ RegisterWidget(interp, "ttk::radiobutton", &RadiobuttonWidgetSpec);
+ RegisterWidget(interp, "ttk::menubutton", &MenubuttonWidgetSpec);
+}
diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c
new file mode 100644
index 0000000..e3aeaba
--- /dev/null
+++ b/generic/ttk/ttkCache.c
@@ -0,0 +1,350 @@
+/*
+ * Theme engine resource cache.
+ *
+ * Copyright (c) 2004, Joe English
+ *
+ * The problem:
+ *
+ * Tk maintains reference counts for fonts, colors, and images,
+ * and deallocates them when the reference count goes to zero.
+ * With the theme engine, resources are allocated right before
+ * drawing an element and released immediately after.
+ * This causes a severe performance penalty, and on PseudoColor
+ * visuals it causes colormap cycling as colormap entries are
+ * released and reused.
+ *
+ * Solution: Acquire fonts, colors, and objects from a
+ * resource cache instead of directly from Tk; the cache
+ * holds a semipermanent reference to the resource to keep
+ * it from being deallocated.
+ *
+ * The plumbing and control flow here is quite contorted;
+ * it would be better to address this problem in the core instead.
+ *
+ * @@@ BUGS/TODO: Need distinct caches for each combination
+ * of display, visual, and colormap.
+ *
+ * @@@ Colormap flashing on PseudoColor visuals is still possible,
+ * but this will be a transient effect.
+ */
+
+#include <stdio.h> /* for sprintf */
+#include <tk.h>
+#include "ttkTheme.h"
+
+struct Ttk_ResourceCache_ {
+ Tcl_Interp *interp; /* Interpreter for error reporting */
+ Tk_Window tkwin; /* Cache window. */
+ Tcl_HashTable fontTable; /* Entries: Tcl_Obj* holding FontObjs */
+ Tcl_HashTable colorTable; /* Entries: Tcl_Obj* holding ColorObjs */
+ Tcl_HashTable borderTable; /* Entries: Tcl_Obj* holding BorderObjs */
+ Tcl_HashTable imageTable; /* Entries: Tk_Images */
+
+ Tcl_HashTable namedColors; /* Entries: RGB values as Tcl_StringObjs */
+};
+
+/*
+ * Ttk_CreateResourceCache --
+ * Initialize a new resource cache.
+ */
+Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *interp)
+{
+ Ttk_ResourceCache cache = (Ttk_ResourceCache)ckalloc(sizeof(*cache));
+
+ cache->tkwin = NULL; /* initialized later */
+ cache->interp = interp;
+ Tcl_InitHashTable(&cache->fontTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&cache->colorTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&cache->borderTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&cache->imageTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&cache->namedColors, TCL_STRING_KEYS);
+
+ return cache;
+}
+
+/*
+ * Ttk_ClearCache --
+ * Release references to all cached resources.
+ */
+static void Ttk_ClearCache(Ttk_ResourceCache cache)
+{
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr;
+
+ /*
+ * Free fonts:
+ */
+ entryPtr = Tcl_FirstHashEntry(&cache->fontTable, &search);
+ while (entryPtr != NULL) {
+ Tcl_Obj *fontObj = Tcl_GetHashValue(entryPtr);
+ if (fontObj) {
+ Tk_FreeFontFromObj(cache->tkwin, fontObj);
+ Tcl_DecrRefCount(fontObj);
+ }
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&cache->fontTable);
+ Tcl_InitHashTable(&cache->fontTable, TCL_STRING_KEYS);
+
+ /*
+ * Free colors:
+ */
+ entryPtr = Tcl_FirstHashEntry(&cache->colorTable, &search);
+ while (entryPtr != NULL) {
+ Tcl_Obj *colorObj = Tcl_GetHashValue(entryPtr);
+ if (colorObj) {
+ Tk_FreeColorFromObj(cache->tkwin, colorObj);
+ Tcl_DecrRefCount(colorObj);
+ }
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&cache->colorTable);
+ Tcl_InitHashTable(&cache->colorTable, TCL_STRING_KEYS);
+
+ /*
+ * Free borders:
+ */
+ entryPtr = Tcl_FirstHashEntry(&cache->borderTable, &search);
+ while (entryPtr != NULL) {
+ Tcl_Obj *borderObj = Tcl_GetHashValue(entryPtr);
+ if (borderObj) {
+ Tk_Free3DBorderFromObj(cache->tkwin, borderObj);
+ Tcl_DecrRefCount(borderObj);
+ }
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&cache->borderTable);
+ Tcl_InitHashTable(&cache->borderTable, TCL_STRING_KEYS);
+
+ /*
+ * Free images:
+ */
+ entryPtr = Tcl_FirstHashEntry(&cache->imageTable, &search);
+ while (entryPtr != NULL) {
+ Tk_Image image = Tcl_GetHashValue(entryPtr);
+ if (image) {
+ Tk_FreeImage(image);
+ }
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&cache->imageTable);
+ Tcl_InitHashTable(&cache->imageTable, TCL_STRING_KEYS);
+
+ return;
+}
+
+/*
+ * Ttk_FreeResourceCache --
+ * Release references to all cached resources, delete the cache.
+ */
+
+void Ttk_FreeResourceCache(Ttk_ResourceCache cache)
+{
+ Tcl_HashEntry *entryPtr;
+ Tcl_HashSearch search;
+
+ Ttk_ClearCache(cache);
+
+ Tcl_DeleteHashTable(&cache->colorTable);
+ Tcl_DeleteHashTable(&cache->fontTable);
+ Tcl_DeleteHashTable(&cache->imageTable);
+
+ /*
+ * Free named colors:
+ */
+ entryPtr = Tcl_FirstHashEntry(&cache->namedColors, &search);
+ while (entryPtr != NULL) {
+ Tcl_Obj *colorNameObj = Tcl_GetHashValue(entryPtr);
+ Tcl_DecrRefCount(colorNameObj);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&cache->namedColors);
+
+ ckfree((ClientData)cache);
+}
+
+/*
+ * CacheWinEventHandler --
+ * Detect when the cache window is destroyed, clear cache.
+ */
+static void CacheWinEventHandler(ClientData clientData, XEvent *eventPtr)
+{
+ Ttk_ResourceCache cache = clientData;
+
+ if (eventPtr->type != DestroyNotify) {
+ return;
+ }
+ Tk_DeleteEventHandler(cache->tkwin, StructureNotifyMask,
+ CacheWinEventHandler, clientData);
+ Ttk_ClearCache(cache);
+ cache->tkwin = NULL;
+}
+
+/*
+ * InitCacheWindow --
+ * Specify the cache window if not already set.
+ * @@@ SHOULD: use separate caches for each combination
+ * @@@ of display, visual, and colormap.
+ */
+static void InitCacheWindow(Ttk_ResourceCache cache, Tk_Window tkwin)
+{
+ if (cache->tkwin == NULL) {
+ cache->tkwin = tkwin;
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask,
+ CacheWinEventHandler, cache);
+ }
+}
+
+/*
+ * Ttk_RegisterNamedColor --
+ * Specify an RGB triplet as a named color.
+ * Overrides any previous named color specification.
+ */
+void Ttk_RegisterNamedColor(
+ Ttk_ResourceCache cache,
+ const char *colorName,
+ XColor *colorPtr)
+{
+ int newEntry;
+ Tcl_HashEntry *entryPtr;
+ char nameBuf[14];
+ Tcl_Obj *colorNameObj;
+
+ sprintf(nameBuf, "#%04X%04X%04X",
+ colorPtr->red, colorPtr->green, colorPtr->blue);
+ colorNameObj = Tcl_NewStringObj(nameBuf, -1);
+ Tcl_IncrRefCount(colorNameObj);
+
+ entryPtr = Tcl_CreateHashEntry(&cache->namedColors, colorName, &newEntry);
+ if (!newEntry) {
+ Tcl_Obj *oldColor = Tcl_GetHashValue(entryPtr);
+ Tcl_DecrRefCount(oldColor);
+ }
+
+ Tcl_SetHashValue(entryPtr, colorNameObj);
+}
+
+/*
+ * CheckNamedColor(objPtr) --
+ * If objPtr is a registered color name, return a Tcl_Obj *
+ * containing the registered color value specification.
+ * Otherwise, return the input argument.
+ */
+static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr)
+{
+ Tcl_HashEntry *entryPtr =
+ Tcl_FindHashEntry(&cache->namedColors, Tcl_GetString(objPtr));
+ if (entryPtr) { /* Use named color instead */
+ objPtr = Tcl_GetHashValue(entryPtr);
+ }
+ return objPtr;
+}
+
+/*
+ * Template for allocation routines:
+ */
+typedef void *(*Allocator)(Tcl_Interp *, Tk_Window, Tcl_Obj *);
+
+static Tcl_Obj *Ttk_Use(
+ Tcl_Interp *interp,
+ Tcl_HashTable *table,
+ Allocator allocate,
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr)
+{
+ int newEntry;
+ Tcl_HashEntry *entryPtr =
+ Tcl_CreateHashEntry(table,Tcl_GetString(objPtr),&newEntry);
+ Tcl_Obj *cacheObj;
+
+ if (!newEntry) {
+ return Tcl_GetHashValue(entryPtr);
+ }
+
+ cacheObj = Tcl_DuplicateObj(objPtr);
+ Tcl_IncrRefCount(cacheObj);
+
+ if (allocate(interp, tkwin, cacheObj)) {
+ Tcl_SetHashValue(entryPtr, cacheObj);
+ return cacheObj;
+ } else {
+ Tcl_DecrRefCount(cacheObj);
+ Tcl_SetHashValue(entryPtr, NULL);
+ Tcl_BackgroundError(interp);
+ return NULL;
+ }
+}
+
+/*
+ * Ttk_UseFont --
+ * Acquire a font from the cache.
+ */
+Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
+{
+ InitCacheWindow(cache, tkwin);
+ return Ttk_Use(cache->interp,
+ &cache->fontTable,(Allocator)Tk_AllocFontFromObj, tkwin, objPtr);
+}
+
+/*
+ * Ttk_UseColor --
+ * Acquire a color from the cache.
+ */
+Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
+{
+ objPtr = CheckNamedColor(cache, objPtr);
+ InitCacheWindow(cache, tkwin);
+ return Ttk_Use(cache->interp,
+ &cache->colorTable,(Allocator)Tk_AllocColorFromObj, tkwin, objPtr);
+}
+
+/*
+ * Ttk_UseBorder --
+ * Acquire a Tk_3DBorder from the cache.
+ */
+Tcl_Obj *Ttk_UseBorder(
+ Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
+{
+ objPtr = CheckNamedColor(cache, objPtr);
+ InitCacheWindow(cache, tkwin);
+ return Ttk_Use(cache->interp,
+ &cache->borderTable,(Allocator)Tk_Alloc3DBorderFromObj, tkwin, objPtr);
+}
+
+/* NullImageChanged --
+ * Tk_ImageChangedProc for Ttk_UseImage
+ */
+
+static void NullImageChanged(ClientData clientData,
+ int x, int y, int width, int height, int imageWidth, int imageHeight)
+{ /* No-op */ }
+
+/*
+ * Ttk_UseImage --
+ * Acquire a Tk_Image from the cache.
+ */
+Tk_Image Ttk_UseImage(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
+{
+ const char *imageName = Tcl_GetString(objPtr);
+ int newEntry;
+ Tcl_HashEntry *entryPtr =
+ Tcl_CreateHashEntry(&cache->imageTable,imageName,&newEntry);
+ Tk_Image image;
+
+ InitCacheWindow(cache, tkwin);
+
+ if (!newEntry) {
+ return Tcl_GetHashValue(entryPtr);
+ }
+
+ image = Tk_GetImage(cache->interp, tkwin, imageName, NullImageChanged,0);
+ Tcl_SetHashValue(entryPtr, image);
+
+ if (!image) {
+ Tcl_BackgroundError(cache->interp);
+ }
+
+ return image;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c
new file mode 100644
index 0000000..572f630
--- /dev/null
+++ b/generic/ttk/ttkClamTheme.c
@@ -0,0 +1,971 @@
+/*
+ * Copyright (C) 2004 Joe English
+ *
+ * "clam" theme; inspired by the XFCE family of Gnome themes.
+ */
+
+#include <tk.h>
+#include "ttkTheme.h"
+
+/*
+ * Under windows, the Tk-provided XDrawLine and XDrawArc have an
+ * off-by-one error in the end point. This is especially apparent with this
+ * theme. Defining this macro as true handles this case.
+ */
+#if defined(WIN32) && !defined(WIN32_XDRAWLINE_HACK)
+# define WIN32_XDRAWLINE_HACK 1
+#else
+# define WIN32_XDRAWLINE_HACK 0
+#endif
+
+#define STR(x) StR(x)
+#define StR(x) #x
+
+#define SCROLLBAR_THICKNESS 14
+
+#define FRAME_COLOR "#dcdad5"
+#define LIGHT_COLOR "#ffffff"
+#define DARK_COLOR "#cfcdc8"
+#define DARKER_COLOR "#bab5ab"
+#define DARKEST_COLOR "#9e9a91"
+
+/*------------------------------------------------------------------------
+ * +++ Utilities.
+ */
+
+static GC Ttk_GCForColor(Tk_Window tkwin, Tcl_Obj* colorObj, Drawable d)
+{
+ GC gc = Tk_GCForColor(Tk_GetColorFromObj(tkwin, colorObj), d);
+
+#ifdef MAC_OSX_TK
+ /*
+ * Workaround for Tk bug under Aqua where the default line width is 0.
+ */
+ Display *display = Tk_Display(tkwin);
+ unsigned long mask = 0ul;
+ XGCValues gcValues;
+
+ gcValues.line_width = 1;
+ mask = GCLineWidth;
+
+ XChangeGC(display, gc, mask, &gcValues);
+#endif
+
+ return gc;
+}
+
+static void DrawSmoothBorder(
+ Tk_Window tkwin, Drawable d, Ttk_Box b,
+ Tcl_Obj *outerColorObj, Tcl_Obj *upperColorObj, Tcl_Obj *lowerColorObj)
+{
+ Display *display = Tk_Display(tkwin);
+ int x1 = b.x, x2 = b.x + b.width - 1;
+ int y1 = b.y, y2 = b.y + b.height - 1;
+ const int w = WIN32_XDRAWLINE_HACK;
+ GC gc;
+
+ if ( outerColorObj
+ && (gc=Ttk_GCForColor(tkwin,outerColorObj,d)))
+ {
+ XDrawLine(display,d,gc, x1+1,y1, x2-1+w,y1); /* N */
+ XDrawLine(display,d,gc, x1+1,y2, x2-1+w,y2); /* S */
+ XDrawLine(display,d,gc, x1,y1+1, x1,y2-1+w); /* E */
+ XDrawLine(display,d,gc, x2,y1+1, x2,y2-1+w); /* W */
+ }
+
+ if ( upperColorObj
+ && (gc=Ttk_GCForColor(tkwin,upperColorObj,d)))
+ {
+ XDrawLine(display,d,gc, x1+1,y1+1, x2-1+w,y1+1); /* N */
+ XDrawLine(display,d,gc, x1+1,y1+1, x1+1,y2-1); /* E */
+ }
+
+ if ( lowerColorObj
+ && (gc=Ttk_GCForColor(tkwin,lowerColorObj,d)))
+ {
+ XDrawLine(display,d,gc, x2-1,y2-1, x1+1-w,y2-1); /* S */
+ XDrawLine(display,d,gc, x2-1,y2-1, x2-1,y1+1-w); /* W */
+ }
+}
+
+static GC BackgroundGC(Tk_Window tkwin, Tcl_Obj *backgroundObj)
+{
+ Tk_3DBorder bd = Tk_Get3DBorderFromObj(tkwin, backgroundObj);
+ return Tk_3DBorderGC(tkwin, bd, TK_3D_FLAT_GC);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Border element.
+ */
+
+typedef struct {
+ Tcl_Obj *borderColorObj;
+ Tcl_Obj *lightColorObj;
+ Tcl_Obj *darkColorObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *borderWidthObj; /* See <<NOTE-BORDERWIDTH>> */
+} BorderElement;
+
+static Ttk_ElementOptionSpec BorderElementOptions[] = {
+ { "-bordercolor", TK_OPTION_COLOR,
+ Tk_Offset(BorderElement,borderColorObj), DARKEST_COLOR },
+ { "-lightcolor", TK_OPTION_COLOR,
+ Tk_Offset(BorderElement,lightColorObj), LIGHT_COLOR },
+ { "-darkcolor", TK_OPTION_COLOR,
+ Tk_Offset(BorderElement,darkColorObj), DARK_COLOR },
+ { "-relief", TK_OPTION_RELIEF,
+ Tk_Offset(BorderElement,reliefObj), "flat" },
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(BorderElement,borderWidthObj), "2" },
+ { NULL, 0, 0, NULL }
+};
+
+/*
+ * <<NOTE-BORDERWIDTH>>: -borderwidth is only partially supported:
+ * in this theme, borders are always exactly 2 pixels thick.
+ * With -borderwidth 0, border is not drawn at all;
+ * otherwise a 2-pixel border is used. For -borderwidth > 2,
+ * the excess is used as padding.
+ */
+
+static void BorderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ BorderElement *border = (BorderElement*)elementRecord;
+ int borderWidth = 2;
+ Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth);
+ if (borderWidth == 1) ++borderWidth;
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+static void BorderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ BorderElement *border = elementRecord;
+ int relief = TK_RELIEF_FLAT;
+ int borderWidth = 2;
+ Tcl_Obj *outer = 0, *upper = 0, *lower = 0;
+
+ Tk_GetReliefFromObj(NULL, border->reliefObj, &relief);
+ Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth);
+
+ if (borderWidth == 0) return;
+
+ switch (relief) {
+ case TK_RELIEF_GROOVE :
+ case TK_RELIEF_RIDGE :
+ case TK_RELIEF_RAISED :
+ outer = border->borderColorObj;
+ upper = border->lightColorObj;
+ lower = border->darkColorObj;
+ break;
+ case TK_RELIEF_SUNKEN :
+ outer = border->borderColorObj;
+ upper = border->darkColorObj;
+ lower = border->lightColorObj;
+ break;
+ case TK_RELIEF_FLAT :
+ outer = upper = lower = 0;
+ break;
+ case TK_RELIEF_SOLID :
+ outer = upper = lower = border->borderColorObj;
+ break;
+ }
+
+ DrawSmoothBorder(tkwin, d, b, outer, upper, lower);
+}
+
+static Ttk_ElementSpec BorderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(BorderElement),
+ BorderElementOptions,
+ BorderElementSize,
+ BorderElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Field element.
+ */
+
+typedef struct {
+ Tcl_Obj *borderColorObj;
+ Tcl_Obj *lightColorObj;
+ Tcl_Obj *darkColorObj;
+ Tcl_Obj *backgroundObj;
+} FieldElement;
+
+static Ttk_ElementOptionSpec FieldElementOptions[] = {
+ { "-bordercolor", TK_OPTION_COLOR,
+ Tk_Offset(FieldElement,borderColorObj), DARKEST_COLOR },
+ { "-lightcolor", TK_OPTION_COLOR,
+ Tk_Offset(FieldElement,lightColorObj), LIGHT_COLOR },
+ { "-darkcolor", TK_OPTION_COLOR,
+ Tk_Offset(FieldElement,darkColorObj), DARK_COLOR },
+ { "-fieldbackground", TK_OPTION_BORDER,
+ Tk_Offset(FieldElement,backgroundObj), "white" },
+ { NULL, 0, 0, NULL }
+};
+
+static void FieldElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *paddingPtr = Ttk_UniformPadding(2);
+}
+
+static void FieldElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ FieldElement *field = elementRecord;
+ Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj);
+ Ttk_Box f = Ttk_PadBox(b, Ttk_UniformPadding(2));
+ Tcl_Obj *outer = field->borderColorObj,
+ *inner = field->lightColorObj;
+
+ DrawSmoothBorder(tkwin, d, b, outer, inner, inner);
+ Tk_Fill3DRectangle(
+ tkwin, d, bg, f.x, f.y, f.width, f.height, 0, TK_RELIEF_SUNKEN);
+}
+
+static Ttk_ElementSpec FieldElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(FieldElement),
+ FieldElementOptions,
+ FieldElementSize,
+ FieldElementDraw
+};
+
+/*
+ * Modified field element for comboboxes:
+ * Right edge is expanded to overlap the dropdown button.
+ */
+static void ComboboxFieldElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ FieldElement *field = elementRecord;
+ GC gc = Ttk_GCForColor(tkwin,field->borderColorObj,d);
+
+ ++b.width;
+ FieldElementDraw(clientData, elementRecord, tkwin, d, b, state);
+
+ XDrawLine(Tk_Display(tkwin), d, gc,
+ b.x + b.width - 1, b.y,
+ b.x + b.width - 1, b.y + b.height - 1 + WIN32_XDRAWLINE_HACK);
+}
+
+static Ttk_ElementSpec ComboboxFieldElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(FieldElement),
+ FieldElementOptions,
+ FieldElementSize,
+ ComboboxFieldElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Indicator elements for check and radio buttons.
+ */
+
+typedef struct {
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *marginObj;
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *upperColorObj;
+ Tcl_Obj *lowerColorObj;
+} IndicatorElement;
+
+static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
+ { "-indicatorsize", TK_OPTION_PIXELS,
+ Tk_Offset(IndicatorElement,sizeObj), "10" },
+ { "-indicatormargin", TK_OPTION_STRING,
+ Tk_Offset(IndicatorElement,marginObj), "1" },
+ { "-indicatorbackground", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,backgroundObj), "white" },
+ { "-indicatorforeground", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,foregroundObj), "black" },
+ { "-upperbordercolor", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,upperColorObj), DARKEST_COLOR },
+ { "-lowerbordercolor", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,lowerColorObj), DARK_COLOR },
+ { NULL, 0, 0, NULL }
+};
+
+static void IndicatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ IndicatorElement *indicator = elementRecord;
+ Ttk_Padding margins;
+ int size = 10;
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
+ Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
+ *widthPtr = size + Ttk_PaddingWidth(margins);
+ *heightPtr = size + Ttk_PaddingHeight(margins);
+}
+
+static void RadioIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ IndicatorElement *indicator = elementRecord;
+ GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d);
+ GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d);
+ GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d);
+ GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d);
+ Ttk_Padding padding;
+
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding);
+ b = Ttk_PadBox(b, padding);
+
+ XFillArc(Tk_Display(tkwin),d,gcb, b.x,b.y,b.width,b.height, 0,360*64);
+ XDrawArc(Tk_Display(tkwin),d,gcl, b.x,b.y,b.width,b.height, 225*64,180*64);
+ XDrawArc(Tk_Display(tkwin),d,gcu, b.x,b.y,b.width,b.height, 45*64,180*64);
+
+ if (state & TTK_STATE_SELECTED) {
+ b = Ttk_PadBox(b,Ttk_UniformPadding(3));
+ XFillArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64);
+ XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64);
+#if WIN32_XDRAWLINE_HACK
+ XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 300*64,360*64);
+#endif
+ }
+}
+
+static void CheckIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ Display *display = Tk_Display(tkwin);
+ IndicatorElement *indicator = elementRecord;
+ GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d);
+ GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d);
+ GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d);
+ GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d);
+ Ttk_Padding padding;
+ const int w = WIN32_XDRAWLINE_HACK;
+
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding);
+ b = Ttk_PadBox(b, padding);
+
+ XFillRectangle(display,d,gcb, b.x,b.y,b.width,b.height);
+ XDrawLine(display,d,gcl,b.x,b.y+b.height,b.x+b.width+w,b.y+b.height);/*S*/
+ XDrawLine(display,d,gcl,b.x+b.width,b.y,b.x+b.width,b.y+b.height+w); /*E*/
+ XDrawLine(display,d,gcu,b.x,b.y, b.x,b.y+b.height+w); /*W*/
+ XDrawLine(display,d,gcu,b.x,b.y, b.x+b.width+w,b.y); /*N*/
+
+ if (state & TTK_STATE_SELECTED) {
+ int p,q,r,s;
+
+ b = Ttk_PadBox(b,Ttk_UniformPadding(2));
+ p = b.x, q = b.y, r = b.x+b.width, s = b.y+b.height;
+
+ r+=w, s+=w;
+ XDrawLine(display, d, gcf, p, q, r, s);
+ XDrawLine(display, d, gcf, p+1, q, r, s-1);
+ XDrawLine(display, d, gcf, p, q+1, r-1, s);
+
+ s-=w, q-=w;
+ XDrawLine(display, d, gcf, p, s, r, q);
+ XDrawLine(display, d, gcf, p+1, s, r, q+1);
+ XDrawLine(display, d, gcf, p, s-1, r-1, q);
+ }
+}
+
+static Ttk_ElementSpec RadioIndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(IndicatorElement),
+ IndicatorElementOptions,
+ IndicatorElementSize,
+ RadioIndicatorElementDraw
+};
+
+static Ttk_ElementSpec CheckIndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(IndicatorElement),
+ IndicatorElementOptions,
+ IndicatorElementSize,
+ CheckIndicatorElementDraw
+};
+
+#define MENUBUTTON_ARROW_SIZE 5
+
+typedef struct {
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *colorObj;
+ Tcl_Obj *paddingObj;
+} MenuIndicatorElement;
+
+static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] =
+{
+ { "-arrowsize", TK_OPTION_PIXELS,
+ Tk_Offset(MenuIndicatorElement,sizeObj),
+ STR(MENUBUTTON_ARROW_SIZE)},
+ { "-arrowcolor",TK_OPTION_COLOR,
+ Tk_Offset(MenuIndicatorElement,colorObj),
+ "black" },
+ { "-arrowpadding",TK_OPTION_STRING,
+ Tk_Offset(MenuIndicatorElement,paddingObj),
+ "3" },
+ { NULL, 0, 0, NULL }
+};
+
+static void MenuIndicatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ MenuIndicatorElement *indicator = elementRecord;
+ Ttk_Padding margins;
+ int size = MENUBUTTON_ARROW_SIZE;
+ Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->paddingObj, &margins);
+ TtkArrowSize(size, ARROW_DOWN, widthPtr, heightPtr);
+ *widthPtr += Ttk_PaddingWidth(margins);
+ *heightPtr += Ttk_PaddingHeight(margins);
+}
+
+static void MenuIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ MenuIndicatorElement *indicator = elementRecord;
+ XColor *arrowColor = Tk_GetColorFromObj(tkwin, indicator->colorObj);
+ GC gc = Tk_GCForColor(arrowColor, d);
+ int size = MENUBUTTON_ARROW_SIZE;
+ int width, height;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
+
+ TtkArrowSize(size, ARROW_DOWN, &width, &height);
+ b = Ttk_StickBox(b, width, height, 0);
+ TtkFillArrow(Tk_Display(tkwin), d, gc, b, ARROW_DOWN);
+}
+
+static Ttk_ElementSpec MenuIndicatorElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(MenuIndicatorElement),
+ MenuIndicatorElementOptions,
+ MenuIndicatorElementSize,
+ MenuIndicatorElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Grips.
+ *
+ * TODO: factor this with ThumbElementDraw
+ */
+
+static Ttk_Orient GripClientData[] = {
+ TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL
+};
+
+typedef struct {
+ Tcl_Obj *lightColorObj;
+ Tcl_Obj *borderColorObj;
+ Tcl_Obj *gripCountObj;
+} GripElement;
+
+static Ttk_ElementOptionSpec GripElementOptions[] = {
+ { "-lightcolor", TK_OPTION_COLOR,
+ Tk_Offset(GripElement,lightColorObj), LIGHT_COLOR },
+ { "-bordercolor", TK_OPTION_COLOR,
+ Tk_Offset(GripElement,borderColorObj), DARKEST_COLOR },
+ { "-gripcount", TK_OPTION_INT,
+ Tk_Offset(GripElement,gripCountObj), "5" },
+ { NULL, 0, 0, NULL }
+};
+
+static void GripElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ GripElement *grip = elementRecord;
+ int gripCount = 0;
+
+ Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount);
+ if (horizontal) {
+ *widthPtr = 2*gripCount;
+ } else {
+ *heightPtr = 2*gripCount;
+ }
+}
+
+static void GripElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ const int w = WIN32_XDRAWLINE_HACK;
+ int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ GripElement *grip = elementRecord;
+ GC lightGC = Ttk_GCForColor(tkwin,grip->lightColorObj,d);
+ GC darkGC = Ttk_GCForColor(tkwin,grip->borderColorObj,d);
+ int gripPad = 1, gripCount = 0;
+ int i;
+
+ Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount);
+
+ if (horizontal) {
+ int x = b.x + b.width / 2 - gripCount;
+ int y1 = b.y + gripPad, y2 = b.y + b.height - gripPad - 1 + w;
+ for (i=0; i<gripCount; ++i) {
+ XDrawLine(Tk_Display(tkwin), d, darkGC, x,y1, x,y2); ++x;
+ XDrawLine(Tk_Display(tkwin), d, lightGC, x,y1, x,y2); ++x;
+ }
+ } else {
+ int y = b.y + b.height / 2 - gripCount;
+ int x1 = b.x + gripPad, x2 = b.x + b.width - gripPad - 1 + w;
+ for (i=0; i<gripCount; ++i) {
+ XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y, x2,y); ++y;
+ XDrawLine(Tk_Display(tkwin), d, lightGC, x1,y, x2,y); ++y;
+ }
+ }
+}
+
+static Ttk_ElementSpec GripElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(GripElement),
+ GripElementOptions,
+ GripElementSize,
+ GripElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Scrollbar elements: trough, arrows, thumb.
+ *
+ * Notice that the trough element has 0 internal padding;
+ * that way the thumb and arrow borders overlap the trough.
+ */
+
+typedef struct { /* Common element record for scrollbar elements */
+ Tcl_Obj *orientObj;
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *borderColorObj;
+ Tcl_Obj *troughColorObj;
+ Tcl_Obj *lightColorObj;
+ Tcl_Obj *darkColorObj;
+ Tcl_Obj *arrowColorObj;
+ Tcl_Obj *arrowSizeObj;
+ Tcl_Obj *gripCountObj;
+ Tcl_Obj *sliderlengthObj;
+} ScrollbarElement;
+
+static Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
+ { "-orient", TK_OPTION_ANY,
+ Tk_Offset(ScrollbarElement, orientObj), "horizontal" },
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(ScrollbarElement,backgroundObj), FRAME_COLOR },
+ { "-bordercolor", TK_OPTION_COLOR,
+ Tk_Offset(ScrollbarElement,borderColorObj), DARKEST_COLOR },
+ { "-troughcolor", TK_OPTION_COLOR,
+ Tk_Offset(ScrollbarElement,troughColorObj), DARKER_COLOR },
+ { "-lightcolor", TK_OPTION_COLOR,
+ Tk_Offset(ScrollbarElement,lightColorObj), LIGHT_COLOR },
+ { "-darkcolor", TK_OPTION_COLOR,
+ Tk_Offset(ScrollbarElement,darkColorObj), DARK_COLOR },
+ { "-arrowcolor", TK_OPTION_COLOR,
+ Tk_Offset(ScrollbarElement,arrowColorObj), "#000000" },
+ { "-arrowsize", TK_OPTION_PIXELS,
+ Tk_Offset(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) },
+ { "-gripcount", TK_OPTION_INT,
+ Tk_Offset(ScrollbarElement,gripCountObj), "5" },
+ { "-sliderlength", TK_OPTION_INT,
+ Tk_Offset(ScrollbarElement,sliderlengthObj), "30" },
+ { NULL, 0, 0, NULL }
+};
+
+static void TroughElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ ScrollbarElement *sb = elementRecord;
+ GC gcb = Ttk_GCForColor(tkwin,sb->borderColorObj,d);
+ GC gct = Ttk_GCForColor(tkwin,sb->troughColorObj,d);
+ XFillRectangle(Tk_Display(tkwin), d, gct, b.x, b.y, b.width-1, b.height-1);
+ XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, b.width-1, b.height-1);
+}
+
+static Ttk_ElementSpec TroughElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ScrollbarElement),
+ ScrollbarElementOptions,
+ TtkNullElementSize,
+ TroughElementDraw
+};
+
+static void ThumbElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ScrollbarElement *sb = elementRecord;
+ int size = SCROLLBAR_THICKNESS;
+ Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size);
+ *widthPtr = *heightPtr = size;
+}
+
+static void ThumbElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ ScrollbarElement *sb = elementRecord;
+ int gripCount = 0, orient = TTK_ORIENT_HORIZONTAL;
+ GC lightGC, darkGC;
+ int x1, y1, x2, y2, dx, dy, i;
+ const int w = WIN32_XDRAWLINE_HACK;
+
+ DrawSmoothBorder(tkwin, d, b,
+ sb->borderColorObj, sb->lightColorObj, sb->darkColorObj);
+ XFillRectangle(
+ Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj),
+ b.x+2, b.y+2, b.width-4, b.height-4);
+
+ /*
+ * Draw grip:
+ */
+ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient);
+ Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount);
+ lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d);
+ darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d);
+
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ dx = 1; dy = 0;
+ x1 = x2 = b.x + b.width / 2 - gripCount;
+ y1 = b.y + 2;
+ y2 = b.y + b.height - 3 + w;
+ } else {
+ dx = 0; dy = 1;
+ y1 = y2 = b.y + b.height / 2 - gripCount;
+ x1 = b.x + 2;
+ x2 = b.x + b.width - 3 + w;
+ }
+
+ for (i=0; i<gripCount; ++i) {
+ XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2);
+ x1 += dx; x2 += dx; y1 += dy; y2 += dy;
+ XDrawLine(Tk_Display(tkwin), d, lightGC, x1,y1, x2,y2);
+ x1 += dx; x2 += dx; y1 += dy; y2 += dy;
+ }
+}
+
+static Ttk_ElementSpec ThumbElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ScrollbarElement),
+ ScrollbarElementOptions,
+ ThumbElementSize,
+ ThumbElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Slider element.
+ */
+static void SliderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ScrollbarElement *sb = elementRecord;
+ int length, thickness, orient;
+
+ length = thickness = SCROLLBAR_THICKNESS;
+ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient);
+ Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &thickness);
+ Tk_GetPixelsFromObj(NULL, tkwin, sb->sliderlengthObj, &length);
+ if (orient == TTK_ORIENT_VERTICAL) {
+ *heightPtr = length;
+ *widthPtr = thickness;
+ } else {
+ *heightPtr = thickness;
+ *widthPtr = length;
+ }
+
+}
+
+static Ttk_ElementSpec SliderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ScrollbarElement),
+ ScrollbarElementOptions,
+ SliderElementSize,
+ ThumbElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Progress bar element
+ */
+static void PbarElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SliderElementSize(clientData, elementRecord, tkwin,
+ widthPtr, heightPtr, paddingPtr);
+ *paddingPtr = Ttk_UniformPadding(2);
+ *widthPtr += 4;
+ *heightPtr += 4;
+}
+
+static void PbarElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ ScrollbarElement *sb = elementRecord;
+
+ b = Ttk_PadBox(b, Ttk_UniformPadding(2));
+ if (b.width > 4 && b.height > 4) {
+ DrawSmoothBorder(tkwin, d, b,
+ sb->borderColorObj, sb->lightColorObj, sb->darkColorObj);
+ XFillRectangle(Tk_Display(tkwin), d,
+ BackgroundGC(tkwin, sb->backgroundObj),
+ b.x+2, b.y+2, b.width-4, b.height-4);
+ }
+}
+
+static Ttk_ElementSpec PbarElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ScrollbarElement),
+ ScrollbarElementOptions,
+ PbarElementSize,
+ PbarElementDraw
+};
+
+
+/*------------------------------------------------------------------------
+ * +++ Scrollbar arrows.
+ */
+static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
+
+static void ArrowElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ScrollbarElement *sb = elementRecord;
+ int size = SCROLLBAR_THICKNESS;
+ Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size);
+ *widthPtr = *heightPtr = size;
+}
+
+static void ArrowElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned state)
+{
+ ArrowDirection dir = *(ArrowDirection*)clientData;
+ ScrollbarElement *sb = elementRecord;
+ GC gc = Ttk_GCForColor(tkwin,sb->arrowColorObj, d);
+ int h, cx, cy;
+
+ DrawSmoothBorder(tkwin, d, b,
+ sb->borderColorObj, sb->lightColorObj, sb->darkColorObj);
+
+ XFillRectangle(
+ Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj),
+ b.x+2, b.y+2, b.width-4, b.height-4);
+
+ b = Ttk_PadBox(b, Ttk_UniformPadding(3));
+ h = b.width < b.height ? b.width : b.height;
+ TtkArrowSize(h/2, dir, &cx, &cy);
+ b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER);
+
+ TtkFillArrow(Tk_Display(tkwin), d, gc, b, dir);
+}
+
+static Ttk_ElementSpec ArrowElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ScrollbarElement),
+ ScrollbarElementOptions,
+ ArrowElementSize,
+ ArrowElementDraw
+};
+
+
+/*------------------------------------------------------------------------
+ * +++ Notebook elements.
+ *
+ * Note: Tabs, except for the rightmost, overlap the neighbor to
+ * their right by one pixel.
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *borderColorObj;
+ Tcl_Obj *lightColorObj;
+ Tcl_Obj *darkColorObj;
+} NotebookElement;
+
+static Ttk_ElementOptionSpec NotebookElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(NotebookElement,backgroundObj), FRAME_COLOR },
+ { "-bordercolor", TK_OPTION_COLOR,
+ Tk_Offset(NotebookElement,borderColorObj), DARKEST_COLOR },
+ { "-lightcolor", TK_OPTION_COLOR,
+ Tk_Offset(NotebookElement,lightColorObj), LIGHT_COLOR },
+ { "-darkcolor", TK_OPTION_COLOR,
+ Tk_Offset(NotebookElement,darkColorObj), DARK_COLOR },
+ { NULL, 0, 0, NULL }
+};
+
+static void TabElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ int borderWidth = 2;
+ paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth;
+ paddingPtr->bottom = 0;
+}
+
+static void TabElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ NotebookElement *tab = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
+ Display *display = Tk_Display(tkwin);
+ int borderWidth = 2, dh = 0;
+ int x1,y1,x2,y2;
+ GC gc;
+ const int w = WIN32_XDRAWLINE_HACK;
+
+ if (state & TTK_STATE_SELECTED) {
+ dh = borderWidth;
+ }
+
+ if (state & TTK_STATE_USER2) { /* Rightmost tab */
+ --b.width;
+ }
+
+ Tk_Fill3DRectangle(tkwin, d, border,
+ b.x+2, b.y+2, b.width-1, b.height-2+dh, borderWidth, TK_RELIEF_FLAT);
+
+ x1 = b.x, x2 = b.x + b.width;
+ y1 = b.y, y2 = b.y + b.height;
+
+
+ gc=Ttk_GCForColor(tkwin,tab->borderColorObj,d);
+ XDrawLine(display,d,gc, x1,y1+1, x1,y2+w);
+ XDrawLine(display,d,gc, x2,y1+1, x2,y2+w);
+ XDrawLine(display,d,gc, x1+1,y1, x2-1+w,y1);
+
+ gc=Ttk_GCForColor(tkwin,tab->lightColorObj,d);
+ XDrawLine(display,d,gc, x1+1,y1+1, x1+1,y2-1+dh+w);
+ XDrawLine(display,d,gc, x1+1,y1+1, x2-1+w,y1+1);
+}
+
+static Ttk_ElementSpec TabElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NotebookElement),
+ NotebookElementOptions,
+ TabElementSize,
+ TabElementDraw
+};
+
+static void ClientElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ int borderWidth = 2;
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+static void ClientElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ NotebookElement *ce = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj);
+ int borderWidth = 2;
+
+ Tk_Fill3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_FLAT);
+ DrawSmoothBorder(tkwin, d, b,
+ ce->borderColorObj, ce->lightColorObj, ce->darkColorObj);
+}
+
+static Ttk_ElementSpec ClientElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NotebookElement),
+ NotebookElementOptions,
+ ClientElementSize,
+ ClientElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Modified widget layouts.
+ */
+
+TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
+
+TTK_LAYOUT("TCombobox",
+ TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
+ TTK_GROUP("Combobox.field", TTK_PACK_LEFT|TTK_FILL_BOTH|TTK_EXPAND,
+ TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
+ TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))
+
+TTK_LAYOUT("Horizontal.Sash",
+ TTK_GROUP("Sash.hsash", TTK_FILL_BOTH,
+ TTK_NODE("Sash.hgrip", TTK_FILL_BOTH)))
+
+TTK_LAYOUT("Vertical.Sash",
+ TTK_GROUP("Sash.vsash", TTK_FILL_BOTH,
+ TTK_NODE("Sash.vgrip", TTK_FILL_BOTH)))
+
+TTK_END_LAYOUT_TABLE
+
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE int
+TtkClamTheme_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_CreateTheme(interp, "clam", 0);
+
+ if (!theme) {
+ return TCL_ERROR;
+ }
+
+ Ttk_RegisterElement(interp,
+ theme, "border", &BorderElementSpec, NULL);
+ Ttk_RegisterElement(interp,
+ theme, "field", &FieldElementSpec, NULL);
+ Ttk_RegisterElement(interp,
+ theme, "Combobox.field", &ComboboxFieldElementSpec, NULL);
+ Ttk_RegisterElement(interp,
+ theme, "trough", &TroughElementSpec, NULL);
+ Ttk_RegisterElement(interp,
+ theme, "thumb", &ThumbElementSpec, NULL);
+ Ttk_RegisterElement(interp,
+ theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]);
+ Ttk_RegisterElement(interp,
+ theme, "downarrow", &ArrowElementSpec, &ArrowElements[1]);
+ Ttk_RegisterElement(interp,
+ theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]);
+ Ttk_RegisterElement(interp,
+ theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]);
+
+ Ttk_RegisterElement(interp,
+ theme, "Radiobutton.indicator", &RadioIndicatorElementSpec, NULL);
+ Ttk_RegisterElement(interp,
+ theme, "Checkbutton.indicator", &CheckIndicatorElementSpec, NULL);
+ Ttk_RegisterElement(interp,
+ theme, "Menubutton.indicator", &MenuIndicatorElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "tab", &TabElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "client", &ClientElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "bar", &PbarElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "hgrip",
+ &GripElementSpec, &GripClientData[0]);
+ Ttk_RegisterElement(interp, theme, "vgrip",
+ &GripElementSpec, &GripClientData[1]);
+
+ Ttk_RegisterLayouts(theme, LayoutTable);
+
+ Tcl_PkgProvide(interp, "ttk::theme::clam", TTK_VERSION);
+
+ return TCL_OK;
+}
diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c
new file mode 100644
index 0000000..2fbcd76
--- /dev/null
+++ b/generic/ttk/ttkClassicTheme.c
@@ -0,0 +1,513 @@
+/*
+ * Copyright (c) 2004, Joe English
+ *
+ * "classic" theme; implements the classic Motif-like Tk look.
+ *
+ */
+
+#include <tk.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include "ttkTheme.h"
+
+#define DEFAULT_BORDERWIDTH "2"
+#define DEFAULT_ARROW_SIZE "15"
+
+/*----------------------------------------------------------------------
+ * +++ Highlight element implementation.
+ * Draw a solid highlight border to indicate focus.
+ */
+
+typedef struct {
+ Tcl_Obj *highlightColorObj;
+ Tcl_Obj *highlightThicknessObj;
+} HighlightElement;
+
+static Ttk_ElementOptionSpec HighlightElementOptions[] = {
+ { "-highlightcolor",TK_OPTION_COLOR,
+ Tk_Offset(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND },
+ { "-highlightthickness",TK_OPTION_PIXELS,
+ Tk_Offset(HighlightElement,highlightThicknessObj), "0" },
+ { NULL, 0, 0, NULL }
+};
+
+static void HighlightElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ HighlightElement *hl = elementRecord;
+ int highlightThickness = 0;
+
+ Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness);
+ *paddingPtr = Ttk_UniformPadding((short)highlightThickness);
+}
+
+static void HighlightElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ HighlightElement *hl = elementRecord;
+ int highlightThickness = 0;
+ XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj);
+
+ Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness);
+ if (highlightColor && highlightThickness > 0) {
+ GC gc = Tk_GCForColor(highlightColor, d);
+ Tk_DrawFocusHighlight(tkwin, gc, highlightThickness, d);
+ }
+}
+
+static Ttk_ElementSpec HighlightElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(HighlightElement),
+ HighlightElementOptions,
+ HighlightElementSize,
+ HighlightElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Button Border element:
+ *
+ * The Motif-style button border on X11 consists of (from outside-in):
+ *
+ * + focus indicator (controlled by -highlightcolor and -highlightthickness),
+ * + default ring (if -default active; blank if -default normal)
+ * + shaded border (controlled by -background, -borderwidth, and -relief)
+ */
+
+typedef struct {
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *defaultStateObj;
+} ButtonBorderElement;
+
+static Ttk_ElementOptionSpec ButtonBorderElementOptions[] =
+{
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND },
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { "-relief", TK_OPTION_RELIEF,
+ Tk_Offset(ButtonBorderElement,reliefObj), "flat" },
+ { "-default", TK_OPTION_ANY,
+ Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" },
+ { NULL, 0, 0, NULL }
+};
+
+static void ButtonBorderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ButtonBorderElement *bd = elementRecord;
+ int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ int borderWidth = 0;
+
+ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
+ Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
+
+ if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) {
+ borderWidth += 5;
+ }
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+/*
+ * (@@@ Note: ButtonBorderElement still still still buggy:
+ * padding for default ring is drawn in the wrong color
+ * when the button is active.)
+ */
+static void ButtonBorderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ButtonBorderElement *bd = elementRecord;
+ Tk_3DBorder border = NULL;
+ int borderWidth = 1, relief = TK_RELIEF_FLAT;
+ int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ int inset = 0;
+
+ /*
+ * Get option values.
+ */
+ border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj);
+ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
+ Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
+
+ /*
+ * Default ring:
+ */
+ switch (defaultState)
+ {
+ case TTK_BUTTON_DEFAULT_DISABLED :
+ break;
+ case TTK_BUTTON_DEFAULT_NORMAL :
+ inset += 5;
+ break;
+ case TTK_BUTTON_DEFAULT_ACTIVE :
+ Tk_Draw3DRectangle(tkwin, d, border,
+ b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset,
+ 2, TK_RELIEF_FLAT);
+ inset += 2;
+ Tk_Draw3DRectangle(tkwin, d, border,
+ b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset,
+ 1, TK_RELIEF_SUNKEN);
+ ++inset;
+ Tk_Draw3DRectangle(tkwin, d, border,
+ b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset,
+ 2, TK_RELIEF_FLAT);
+ inset += 2;
+ break;
+ }
+
+ /*
+ * 3-D border:
+ */
+ if (border && borderWidth > 0) {
+ Tk_Draw3DRectangle(tkwin, d, border,
+ b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset,
+ borderWidth,relief);
+ }
+}
+
+static Ttk_ElementSpec ButtonBorderElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(ButtonBorderElement),
+ ButtonBorderElementOptions,
+ ButtonBorderElementSize,
+ ButtonBorderElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Arrow element(s).
+ *
+ * Draws a 3-D shaded triangle.
+ * clientData is an enum ArrowDirection pointer.
+ */
+
+static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
+typedef struct
+{
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+} ArrowElement;
+
+static Ttk_ElementOptionSpec ArrowElementOptions[] =
+{
+ { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,sizeObj),
+ DEFAULT_ARROW_SIZE },
+ { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj),
+ DEFAULT_BACKGROUND },
+ { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,borderWidthObj),
+ DEFAULT_BORDERWIDTH },
+ { "-relief", TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised" },
+ { NULL, 0, 0, NULL }
+};
+
+static void ArrowElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ArrowElement *arrow = elementRecord;
+ int size = 12;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size);
+ *widthPtr = *heightPtr = size;
+}
+
+static void ArrowElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ int direction = *(int *)clientData;
+ ArrowElement *arrow = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
+ int borderWidth = 2;
+ int relief = TK_RELIEF_RAISED;
+ int size = b.width < b.height ? b.width : b.height;
+ XPoint points[3];
+
+ Tk_GetPixelsFromObj(NULL, tkwin, arrow->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief);
+
+
+ /*
+ * @@@ There are off-by-one pixel errors in the way these are drawn;
+ * @@@ need to take a look at Tk_Fill3DPolygon and X11 to find the
+ * @@@ exact rules.
+ */
+ switch (direction)
+ {
+ case ARROW_UP:
+ points[2].x = b.x; points[2].y = b.y + size;
+ points[1].x = b.x + size/2; points[1].y = b.y;
+ points[0].x = b.x + size; points[0].y = b.y + size;
+ break;
+ case ARROW_DOWN:
+ points[0].x = b.x; points[0].y = b.y;
+ points[1].x = b.x + size/2; points[1].y = b.y + size;
+ points[2].x = b.x + size; points[2].y = b.y;
+ break;
+ case ARROW_LEFT:
+ points[0].x = b.x; points[0].y = b.y + size / 2;
+ points[1].x = b.x + size; points[1].y = b.y + size;
+ points[2].x = b.x + size; points[2].y = b.y;
+ break;
+ case ARROW_RIGHT:
+ points[0].x = b.x + size; points[0].y = b.y + size / 2;
+ points[1].x = b.x; points[1].y = b.y;
+ points[2].x = b.x; points[2].y = b.y + size;
+ break;
+ }
+
+ Tk_Fill3DPolygon(tkwin, d, border, points, 3, borderWidth, relief);
+}
+
+static Ttk_ElementSpec ArrowElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(ArrowElement),
+ ArrowElementOptions,
+ ArrowElementSize,
+ ArrowElementDraw
+};
+
+
+/*------------------------------------------------------------------------
+ * +++ Sash element (for ttk::panedwindow)
+ *
+ * NOTES:
+ *
+ * panedwindows with -orient horizontal use vertical sashes, and vice versa.
+ *
+ * Interpretation of -sashrelief 'groove' and 'ridge' are
+ * swapped wrt. the core panedwindow, which (I think) has them backwards.
+ *
+ * Default -sashrelief is sunken; the core panedwindow has default
+ * -sashrelief raised, but that looks wrong to me.
+ */
+
+static Ttk_Orient SashClientData[] = {
+ TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL
+};
+
+typedef struct {
+ Tcl_Obj *borderObj; /* background color */
+ Tcl_Obj *sashReliefObj; /* sash relief */
+ Tcl_Obj *sashThicknessObj; /* overall thickness of sash */
+ Tcl_Obj *sashPadObj; /* padding on either side of handle */
+ Tcl_Obj *handleSizeObj; /* handle width and height */
+ Tcl_Obj *handlePadObj; /* handle's distance from edge */
+} SashElement;
+
+static Ttk_ElementOptionSpec SashOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(SashElement,borderObj), DEFAULT_BACKGROUND },
+ { "-sashrelief", TK_OPTION_RELIEF,
+ Tk_Offset(SashElement,sashReliefObj), "sunken" },
+ { "-sashthickness", TK_OPTION_PIXELS,
+ Tk_Offset(SashElement,sashThicknessObj), "6" },
+ { "-sashpad", TK_OPTION_PIXELS,
+ Tk_Offset(SashElement,sashPadObj), "2" },
+ { "-handlesize", TK_OPTION_PIXELS,
+ Tk_Offset(SashElement,handleSizeObj), "8" },
+ { "-handlepad", TK_OPTION_PIXELS,
+ Tk_Offset(SashElement,handlePadObj), "8" },
+ { NULL, 0, 0, NULL }
+};
+
+static void SashElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SashElement *sash = elementRecord;
+ int sashPad = 2, sashThickness = 6, handleSize = 8;
+ int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, sash->sashThicknessObj, &sashThickness);
+ Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize);
+ Tk_GetPixelsFromObj(NULL, tkwin, sash->sashPadObj, &sashPad);
+
+ if (sashThickness < handleSize + 2*sashPad)
+ sashThickness = handleSize + 2*sashPad;
+
+ if (horizontal)
+ *heightPtr = sashThickness;
+ else
+ *widthPtr = sashThickness;
+}
+
+static void SashElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ SashElement *sash = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, sash->borderObj);
+ GC gc1,gc2;
+ int relief = TK_RELIEF_RAISED;
+ int handleSize = 8, handlePad = 8;
+ int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ Ttk_Box hb;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize);
+ Tk_GetPixelsFromObj(NULL, tkwin, sash->handlePadObj, &handlePad);
+ Tk_GetReliefFromObj(NULL, sash->sashReliefObj, &relief);
+
+ switch (relief) {
+ case TK_RELIEF_RAISED: case TK_RELIEF_RIDGE:
+ gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
+ gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+ break;
+ case TK_RELIEF_SUNKEN: case TK_RELIEF_GROOVE:
+ gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+ gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
+ break;
+ case TK_RELIEF_SOLID:
+ gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+ break;
+ case TK_RELIEF_FLAT:
+ default:
+ gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC);
+ break;
+ }
+
+ /* Draw sash line:
+ */
+ if (horizontal) {
+ int y = b.y + b.height/2 - 1;
+ XDrawLine(Tk_Display(tkwin), d, gc1, b.x, y, b.x+b.width, y); ++y;
+ XDrawLine(Tk_Display(tkwin), d, gc2, b.x, y, b.x+b.width, y);
+ } else {
+ int x = b.x + b.width/2 - 1;
+ XDrawLine(Tk_Display(tkwin), d, gc1, x, b.y, x, b.y+b.height); ++x;
+ XDrawLine(Tk_Display(tkwin), d, gc2, x, b.y, x, b.y+b.height);
+ }
+
+ /* Draw handle:
+ */
+ if (handleSize >= 0) {
+ if (horizontal) {
+ hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_W);
+ hb.x += handlePad;
+ } else {
+ hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N);
+ hb.y += handlePad;
+ }
+ Tk_Fill3DRectangle(tkwin, d, border,
+ hb.x, hb.y, hb.width, hb.height, 1, TK_RELIEF_RAISED);
+ }
+}
+
+static Ttk_ElementSpec SashElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SashElement),
+ SashOptions,
+ SashElementSize,
+ SashElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget layouts.
+ */
+
+TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
+
+TTK_LAYOUT("TButton",
+ TTK_GROUP("Button.highlight", TTK_FILL_BOTH,
+ TTK_GROUP("Button.border", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Button.padding", TTK_FILL_BOTH,
+ TTK_NODE("Button.label", TTK_FILL_BOTH)))))
+
+TTK_LAYOUT("TCheckbutton",
+ TTK_GROUP("Checkbutton.highlight", TTK_FILL_BOTH,
+ TTK_GROUP("Checkbutton.border", TTK_FILL_BOTH,
+ TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Checkbutton.indicator", TTK_PACK_LEFT)
+ TTK_NODE("Checkbutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH)))))
+
+TTK_LAYOUT("TRadiobutton",
+ TTK_GROUP("Radiobutton.highlight", TTK_FILL_BOTH,
+ TTK_GROUP("Radiobutton.border", TTK_FILL_BOTH,
+ TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Radiobutton.indicator", TTK_PACK_LEFT)
+ TTK_NODE("Radiobutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH)))))
+
+TTK_LAYOUT("TMenubutton",
+ TTK_GROUP("Menubutton.highlight", TTK_FILL_BOTH,
+ TTK_GROUP("Menubutton.border", TTK_FILL_BOTH,
+ TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT)
+ TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_NODE("Menubutton.label", 0)))))
+
+/* "classic" entry, includes highlight border */
+TTK_LAYOUT("TEntry",
+ TTK_GROUP("Entry.highlight", TTK_FILL_BOTH,
+ TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
+ TTK_NODE("Entry.textarea", TTK_FILL_BOTH)))))
+
+/* Notebook tabs -- omit focus ring */
+TTK_LAYOUT("Tab",
+ TTK_GROUP("Notebook.tab", TTK_FILL_BOTH,
+ TTK_GROUP("Notebook.padding", TTK_FILL_BOTH,
+ TTK_NODE("Notebook.label", TTK_FILL_BOTH))))
+
+TTK_END_LAYOUT_TABLE
+
+/* POSSIBLY: include Scale layouts w/focus border
+ */
+
+/*------------------------------------------------------------------------
+ * TtkClassicTheme_Init --
+ * Install classic theme.
+ */
+
+MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_CreateTheme(interp, "classic", NULL);
+
+ if (!theme) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Register elements:
+ */
+ Ttk_RegisterElement(interp, theme, "highlight",
+ &HighlightElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "Button.border",
+ &ButtonBorderElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "uparrow",
+ &ArrowElementSpec, &ArrowElements[0]);
+ Ttk_RegisterElement(interp, theme, "downarrow",
+ &ArrowElementSpec, &ArrowElements[1]);
+ Ttk_RegisterElement(interp, theme, "leftarrow",
+ &ArrowElementSpec, &ArrowElements[2]);
+ Ttk_RegisterElement(interp, theme, "rightarrow",
+ &ArrowElementSpec, &ArrowElements[3]);
+ Ttk_RegisterElement(interp, theme, "arrow",
+ &ArrowElementSpec, &ArrowElements[0]);
+
+ Ttk_RegisterElement(interp, theme, "hsash",
+ &SashElementSpec, &SashClientData[0]);
+ Ttk_RegisterElement(interp, theme, "vsash",
+ &SashElementSpec, &SashClientData[1]);
+
+ /*
+ * Register layouts:
+ */
+ Ttk_RegisterLayouts(theme, LayoutTable);
+
+ Tcl_PkgProvide(interp, "ttk::theme::classic", TTK_VERSION);
+
+ return TCL_OK;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h
new file mode 100644
index 0000000..ee679b7
--- /dev/null
+++ b/generic/ttk/ttkDecls.h
@@ -0,0 +1,272 @@
+/*
+ * This file is (mostly) automatically generated from ttk.decls.
+ */
+
+#ifndef _TTKDECLS
+#define _TTKDECLS
+
+#if defined(USE_TTK_STUBS)
+
+extern const char *TtkInitializeStubs(
+ Tcl_Interp *, const char *version, int epoch, int revision);
+#define Ttk_InitStubs(interp) TtkInitializeStubs( \
+ interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION)
+#else
+
+#define Ttk_InitStubs(interp) Tcl_PkgRequire(interp, "Ttk", TTK_VERSION, 0)
+
+#endif
+
+
+/* !BEGIN!: Do not edit below this line. */
+
+#define TTK_STUBS_EPOCH 0
+#define TTK_STUBS_REVISION 31
+
+/*
+ * Exported function declarations:
+ */
+
+/* 0 */
+TTKAPI Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, CONST char *name);
+/* 1 */
+TTKAPI Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp);
+/* 2 */
+TTKAPI Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp);
+/* 3 */
+TTKAPI Ttk_Theme Ttk_CreateTheme(Tcl_Interp *interp, CONST char *name,
+ Ttk_Theme parent);
+/* 4 */
+TTKAPI void Ttk_RegisterCleanup(Tcl_Interp *interp,
+ VOID *deleteData,
+ Ttk_CleanupProc *cleanupProc);
+/* 5 */
+TTKAPI int Ttk_RegisterElementSpec(Ttk_Theme theme,
+ CONST char *elementName,
+ Ttk_ElementSpec *elementSpec,
+ VOID *clientData);
+/* 6 */
+TTKAPI Ttk_ElementClass * Ttk_RegisterElement(Tcl_Interp *interp,
+ Ttk_Theme theme, CONST char *elementName,
+ Ttk_ElementSpec *elementSpec,
+ VOID *clientData);
+/* 7 */
+TTKAPI int Ttk_RegisterElementFactory(Tcl_Interp *interp,
+ CONST char *name,
+ Ttk_ElementFactory factoryProc,
+ VOID *clientData);
+/* 8 */
+TTKAPI void Ttk_RegisterLayout(Ttk_Theme theme,
+ CONST char *className,
+ Ttk_LayoutSpec layoutSpec);
+/* Slot 9 is reserved */
+/* 10 */
+TTKAPI int Ttk_GetStateSpecFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Ttk_StateSpec *spec_rtn);
+/* 11 */
+TTKAPI Tcl_Obj * Ttk_NewStateSpecObj(unsigned int onbits,
+ unsigned int offbits);
+/* 12 */
+TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr);
+/* 13 */
+TTKAPI Tcl_Obj * Ttk_StateMapLookup(Tcl_Interp *interp,
+ Ttk_StateMap map, Ttk_State state);
+/* 14 */
+TTKAPI int Ttk_StateTableLookup(Ttk_StateTable map[],
+ Ttk_State state);
+/* Slot 15 is reserved */
+/* Slot 16 is reserved */
+/* Slot 17 is reserved */
+/* Slot 18 is reserved */
+/* Slot 19 is reserved */
+/* 20 */
+TTKAPI int Ttk_GetPaddingFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr,
+ Ttk_Padding *pad_rtn);
+/* 21 */
+TTKAPI int Ttk_GetBorderFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Ttk_Padding *pad_rtn);
+/* 22 */
+TTKAPI int Ttk_GetStickyFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Ttk_Sticky *sticky_rtn);
+/* 23 */
+TTKAPI Ttk_Padding Ttk_MakePadding(short l, short t, short r, short b);
+/* 24 */
+TTKAPI Ttk_Padding Ttk_UniformPadding(short borderWidth);
+/* 25 */
+TTKAPI Ttk_Padding Ttk_AddPadding(Ttk_Padding pad1, Ttk_Padding pad2);
+/* 26 */
+TTKAPI Ttk_Padding Ttk_RelievePadding(Ttk_Padding padding, int relief,
+ int n);
+/* 27 */
+TTKAPI Ttk_Box Ttk_MakeBox(int x, int y, int width, int height);
+/* 28 */
+TTKAPI int Ttk_BoxContains(Ttk_Box box, int x, int y);
+/* 29 */
+TTKAPI Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int w, int h,
+ Ttk_Side side);
+/* 30 */
+TTKAPI Ttk_Box Ttk_StickBox(Ttk_Box parcel, int w, int h,
+ Ttk_Sticky sticky);
+/* 31 */
+TTKAPI Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h,
+ Tk_Anchor anchor);
+/* 32 */
+TTKAPI Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p);
+/* 33 */
+TTKAPI Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p);
+/* 34 */
+TTKAPI Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int w, int h,
+ Ttk_Side side, Ttk_Sticky sticky);
+/* 35 */
+TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box);
+/* Slot 36 is reserved */
+/* Slot 37 is reserved */
+/* Slot 38 is reserved */
+/* Slot 39 is reserved */
+/* 40 */
+TTKAPI int Ttk_GetOrientFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, int *orient);
+
+typedef struct TtkStubs {
+ int magic;
+ int epoch;
+ int revision;
+ const struct TtkStubHooks *hooks;
+
+ Ttk_Theme (*ttk_GetTheme) (Tcl_Interp *interp, CONST char *name); /* 0 */
+ Ttk_Theme (*ttk_GetDefaultTheme) (Tcl_Interp *interp); /* 1 */
+ Ttk_Theme (*ttk_GetCurrentTheme) (Tcl_Interp *interp); /* 2 */
+ Ttk_Theme (*ttk_CreateTheme) (Tcl_Interp *interp, CONST char *name, Ttk_Theme parent); /* 3 */
+ void (*ttk_RegisterCleanup) (Tcl_Interp *interp, VOID *deleteData, Ttk_CleanupProc *cleanupProc); /* 4 */
+ int (*ttk_RegisterElementSpec) (Ttk_Theme theme, CONST char *elementName, Ttk_ElementSpec *elementSpec, VOID *clientData); /* 5 */
+ Ttk_ElementClass * (*ttk_RegisterElement) (Tcl_Interp *interp, Ttk_Theme theme, CONST char *elementName, Ttk_ElementSpec *elementSpec, VOID *clientData); /* 6 */
+ int (*ttk_RegisterElementFactory) (Tcl_Interp *interp, CONST char *name, Ttk_ElementFactory factoryProc, VOID *clientData); /* 7 */
+ void (*ttk_RegisterLayout) (Ttk_Theme theme, CONST char *className, Ttk_LayoutSpec layoutSpec); /* 8 */
+ void (*reserved9)(void);
+ int (*ttk_GetStateSpecFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec_rtn); /* 10 */
+ Tcl_Obj * (*ttk_NewStateSpecObj) (unsigned int onbits, unsigned int offbits); /* 11 */
+ Ttk_StateMap (*ttk_GetStateMapFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 12 */
+ Tcl_Obj * (*ttk_StateMapLookup) (Tcl_Interp *interp, Ttk_StateMap map, Ttk_State state); /* 13 */
+ int (*ttk_StateTableLookup) (Ttk_StateTable map[], Ttk_State state); /* 14 */
+ void (*reserved15)(void);
+ void (*reserved16)(void);
+ void (*reserved17)(void);
+ void (*reserved18)(void);
+ void (*reserved19)(void);
+ int (*ttk_GetPaddingFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Ttk_Padding *pad_rtn); /* 20 */
+ int (*ttk_GetBorderFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *pad_rtn); /* 21 */
+ int (*ttk_GetStickyFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Sticky *sticky_rtn); /* 22 */
+ Ttk_Padding (*ttk_MakePadding) (short l, short t, short r, short b); /* 23 */
+ Ttk_Padding (*ttk_UniformPadding) (short borderWidth); /* 24 */
+ Ttk_Padding (*ttk_AddPadding) (Ttk_Padding pad1, Ttk_Padding pad2); /* 25 */
+ Ttk_Padding (*ttk_RelievePadding) (Ttk_Padding padding, int relief, int n); /* 26 */
+ Ttk_Box (*ttk_MakeBox) (int x, int y, int width, int height); /* 27 */
+ int (*ttk_BoxContains) (Ttk_Box box, int x, int y); /* 28 */
+ Ttk_Box (*ttk_PackBox) (Ttk_Box *cavity, int w, int h, Ttk_Side side); /* 29 */
+ Ttk_Box (*ttk_StickBox) (Ttk_Box parcel, int w, int h, Ttk_Sticky sticky); /* 30 */
+ Ttk_Box (*ttk_AnchorBox) (Ttk_Box parcel, int w, int h, Tk_Anchor anchor); /* 31 */
+ Ttk_Box (*ttk_PadBox) (Ttk_Box b, Ttk_Padding p); /* 32 */
+ Ttk_Box (*ttk_ExpandBox) (Ttk_Box b, Ttk_Padding p); /* 33 */
+ Ttk_Box (*ttk_PlaceBox) (Ttk_Box *cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); /* 34 */
+ Tcl_Obj * (*ttk_NewBoxObj) (Ttk_Box box); /* 35 */
+ void (*reserved36)(void);
+ void (*reserved37)(void);
+ void (*reserved38)(void);
+ void (*reserved39)(void);
+ int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */
+} TtkStubs;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern const TtkStubs *ttkStubsPtr;
+#ifdef __cplusplus
+}
+#endif
+
+#if defined(USE_TTK_STUBS)
+
+/*
+ * Inline function declarations:
+ */
+
+#define Ttk_GetTheme \
+ (ttkStubsPtr->ttk_GetTheme) /* 0 */
+#define Ttk_GetDefaultTheme \
+ (ttkStubsPtr->ttk_GetDefaultTheme) /* 1 */
+#define Ttk_GetCurrentTheme \
+ (ttkStubsPtr->ttk_GetCurrentTheme) /* 2 */
+#define Ttk_CreateTheme \
+ (ttkStubsPtr->ttk_CreateTheme) /* 3 */
+#define Ttk_RegisterCleanup \
+ (ttkStubsPtr->ttk_RegisterCleanup) /* 4 */
+#define Ttk_RegisterElementSpec \
+ (ttkStubsPtr->ttk_RegisterElementSpec) /* 5 */
+#define Ttk_RegisterElement \
+ (ttkStubsPtr->ttk_RegisterElement) /* 6 */
+#define Ttk_RegisterElementFactory \
+ (ttkStubsPtr->ttk_RegisterElementFactory) /* 7 */
+#define Ttk_RegisterLayout \
+ (ttkStubsPtr->ttk_RegisterLayout) /* 8 */
+/* Slot 9 is reserved */
+#define Ttk_GetStateSpecFromObj \
+ (ttkStubsPtr->ttk_GetStateSpecFromObj) /* 10 */
+#define Ttk_NewStateSpecObj \
+ (ttkStubsPtr->ttk_NewStateSpecObj) /* 11 */
+#define Ttk_GetStateMapFromObj \
+ (ttkStubsPtr->ttk_GetStateMapFromObj) /* 12 */
+#define Ttk_StateMapLookup \
+ (ttkStubsPtr->ttk_StateMapLookup) /* 13 */
+#define Ttk_StateTableLookup \
+ (ttkStubsPtr->ttk_StateTableLookup) /* 14 */
+/* Slot 15 is reserved */
+/* Slot 16 is reserved */
+/* Slot 17 is reserved */
+/* Slot 18 is reserved */
+/* Slot 19 is reserved */
+#define Ttk_GetPaddingFromObj \
+ (ttkStubsPtr->ttk_GetPaddingFromObj) /* 20 */
+#define Ttk_GetBorderFromObj \
+ (ttkStubsPtr->ttk_GetBorderFromObj) /* 21 */
+#define Ttk_GetStickyFromObj \
+ (ttkStubsPtr->ttk_GetStickyFromObj) /* 22 */
+#define Ttk_MakePadding \
+ (ttkStubsPtr->ttk_MakePadding) /* 23 */
+#define Ttk_UniformPadding \
+ (ttkStubsPtr->ttk_UniformPadding) /* 24 */
+#define Ttk_AddPadding \
+ (ttkStubsPtr->ttk_AddPadding) /* 25 */
+#define Ttk_RelievePadding \
+ (ttkStubsPtr->ttk_RelievePadding) /* 26 */
+#define Ttk_MakeBox \
+ (ttkStubsPtr->ttk_MakeBox) /* 27 */
+#define Ttk_BoxContains \
+ (ttkStubsPtr->ttk_BoxContains) /* 28 */
+#define Ttk_PackBox \
+ (ttkStubsPtr->ttk_PackBox) /* 29 */
+#define Ttk_StickBox \
+ (ttkStubsPtr->ttk_StickBox) /* 30 */
+#define Ttk_AnchorBox \
+ (ttkStubsPtr->ttk_AnchorBox) /* 31 */
+#define Ttk_PadBox \
+ (ttkStubsPtr->ttk_PadBox) /* 32 */
+#define Ttk_ExpandBox \
+ (ttkStubsPtr->ttk_ExpandBox) /* 33 */
+#define Ttk_PlaceBox \
+ (ttkStubsPtr->ttk_PlaceBox) /* 34 */
+#define Ttk_NewBoxObj \
+ (ttkStubsPtr->ttk_NewBoxObj) /* 35 */
+/* Slot 36 is reserved */
+/* Slot 37 is reserved */
+/* Slot 38 is reserved */
+/* Slot 39 is reserved */
+#define Ttk_GetOrientFromObj \
+ (ttkStubsPtr->ttk_GetOrientFromObj) /* 40 */
+
+#endif /* defined(USE_TTK_STUBS) */
+
+/* !END!: Do not edit above this line. */
+
+#endif /* _TTKDECLS */
diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c
new file mode 100644
index 0000000..d2deee8
--- /dev/null
+++ b/generic/ttk/ttkDefaultTheme.c
@@ -0,0 +1,1130 @@
+/*
+ * Copyright (c) 2003, Joe English
+ *
+ * Tk alternate theme, intended to match the MSUE and Gtk's (old) default theme
+ */
+
+#include <math.h>
+#include <string.h>
+
+#include <tkInt.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include "ttkTheme.h"
+
+#if defined(WIN32)
+static const int WIN32_XDRAWLINE_HACK = 1;
+#else
+static const int WIN32_XDRAWLINE_HACK = 0;
+#endif
+
+#define BORDERWIDTH 2
+#define SCROLLBAR_WIDTH 14
+#define MIN_THUMB_SIZE 8
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Helper routines for border drawing:
+ *
+ * NOTE: MSUE specifies a slightly different arrangement
+ * for button borders than for other elements; "shadowColors"
+ * is for button borders.
+ *
+ * Please excuse the gross misspelling "LITE" for "LIGHT",
+ * but it makes things line up nicer.
+ */
+
+enum BorderColor { FLAT = 1, LITE = 2, DARK = 3, BRDR = 4 };
+
+/* top-left outer, top-left inner, bottom-right inner, bottom-right outer */
+static int const shadowColors[6][4] = {
+ { FLAT, FLAT, FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/
+ { DARK, LITE, DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/
+ { LITE, FLAT, DARK, BRDR }, /* TK_RELIEF_RAISED = 2*/
+ { LITE, DARK, LITE, DARK }, /* TK_RELIEF_RIDGE = 3*/
+ { BRDR, BRDR, BRDR, BRDR }, /* TK_RELIEF_SOLID = 4*/
+ { BRDR, DARK, FLAT, LITE } /* TK_RELIEF_SUNKEN = 5*/
+};
+
+/* top-left, bottom-right */
+static int const thinShadowColors[6][4] = {
+ { FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/
+ { DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/
+ { LITE, DARK }, /* TK_RELIEF_RAISED = 2*/
+ { LITE, DARK }, /* TK_RELIEF_RIDGE = 3*/
+ { BRDR, BRDR }, /* TK_RELIEF_SOLID = 4*/
+ { DARK, LITE } /* TK_RELIEF_SUNKEN = 5*/
+};
+
+static void DrawCorner(
+ Tk_Window tkwin,
+ Drawable d,
+ Tk_3DBorder border, /* get most GCs from here... */
+ GC borderGC, /* "window border" color GC */
+ int x,int y, int width,int height, /* where to draw */
+ int corner, /* 0 => top left; 1 => bottom right */
+ enum BorderColor color)
+{
+ XPoint points[3];
+ GC gc;
+
+ --width; --height;
+ points[0].x = x; points[0].y = y+height;
+ points[1].x = x+width*corner; points[1].y = y+height*corner;
+ points[2].x = x+width; points[2].y = y;
+
+ if (color == BRDR)
+ gc = borderGC;
+ else
+ gc = Tk_3DBorderGC(tkwin, border, (int)color);
+
+ XDrawLines(Tk_Display(tkwin), d, gc, points, 3, CoordModeOrigin);
+}
+
+static void DrawBorder(
+ Tk_Window tkwin, Drawable d, Tk_3DBorder border, XColor *borderColor,
+ Ttk_Box b, int borderWidth, int relief)
+{
+ GC borderGC = Tk_GCForColor(borderColor, d);
+
+ switch (borderWidth) {
+ case 2: /* "thick" border */
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x, b.y, b.width, b.height, 0,shadowColors[relief][0]);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x+1, b.y+1, b.width-2, b.height-2, 0,shadowColors[relief][1]);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x+1, b.y+1, b.width-2, b.height-2, 1,shadowColors[relief][2]);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x, b.y, b.width, b.height, 1,shadowColors[relief][3]);
+ break;
+ case 1: /* "thin" border */
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x, b.y, b.width, b.height, 0, thinShadowColors[relief][0]);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x, b.y, b.width, b.height, 1, thinShadowColors[relief][1]);
+ break;
+ case 0: /* no border -- do nothing */
+ break;
+ default: /* Fall back to Motif-style borders: */
+ Tk_Draw3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height, borderWidth,relief);
+ break;
+ }
+}
+
+/* Alternate shadow colors for entry fields:
+ * NOTE: FLAT color is normally white, and the LITE color is a darker shade.
+ */
+static int fieldShadowColors[4] = { DARK, BRDR, LITE, FLAT };
+
+static void DrawFieldBorder(
+ Tk_Window tkwin, Drawable d, Tk_3DBorder border, XColor *borderColor,
+ Ttk_Box b)
+{
+ GC borderGC = Tk_GCForColor(borderColor, d);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x, b.y, b.width, b.height, 0,fieldShadowColors[0]);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x+1, b.y+1, b.width-2, b.height-2, 0,fieldShadowColors[1]);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x+1, b.y+1, b.width-2, b.height-2, 1,fieldShadowColors[2]);
+ DrawCorner(tkwin, d, border, borderGC,
+ b.x, b.y, b.width, b.height, 1,fieldShadowColors[3]);
+ return;
+}
+
+/*
+ * ArrowPoints --
+ * Compute points of arrow polygon.
+ */
+static void ArrowPoints(Ttk_Box b, ArrowDirection dir, XPoint points[4])
+{
+ int cx, cy, h;
+
+ switch (dir) {
+ case ARROW_UP:
+ h = (b.width - 1)/2;
+ cx = b.x + h;
+ cy = b.y;
+ if (b.height <= h) h = b.height - 1;
+ points[0].x = cx; points[0].y = cy;
+ points[1].x = cx - h; points[1].y = cy + h;
+ points[2].x = cx + h; points[2].y = cy + h;
+ break;
+ case ARROW_DOWN:
+ h = (b.width - 1)/2;
+ cx = b.x + h;
+ cy = b.y + b.height - 1;
+ if (b.height <= h) h = b.height - 1;
+ points[0].x = cx; points[0].y = cy;
+ points[1].x = cx - h; points[1].y = cy - h;
+ points[2].x = cx + h; points[2].y = cy - h;
+ break;
+ case ARROW_LEFT:
+ h = (b.height - 1)/2;
+ cx = b.x;
+ cy = b.y + h;
+ if (b.width <= h) h = b.width - 1;
+ points[0].x = cx; points[0].y = cy;
+ points[1].x = cx + h; points[1].y = cy - h;
+ points[2].x = cx + h; points[2].y = cy + h;
+ break;
+ case ARROW_RIGHT:
+ h = (b.height - 1)/2;
+ cx = b.x + b.width - 1;
+ cy = b.y + h;
+ if (b.width <= h) h = b.width - 1;
+ points[0].x = cx; points[0].y = cy;
+ points[1].x = cx - h; points[1].y = cy - h;
+ points[2].x = cx - h; points[2].y = cy + h;
+ break;
+ }
+
+ points[3].x = points[0].x;
+ points[3].y = points[0].y;
+}
+
+/*public*/
+void TtkArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr)
+{
+ switch (dir) {
+ case ARROW_UP:
+ case ARROW_DOWN: *widthPtr = 2*h+1; *heightPtr = h+1; break;
+ case ARROW_LEFT:
+ case ARROW_RIGHT: *widthPtr = h+1; *heightPtr = 2*h+1;
+ }
+}
+
+/*
+ * TtkDrawArrow, TtkFillArrow --
+ * Draw an arrow in the indicated direction inside the specified box.
+ */
+/*public*/
+void TtkFillArrow(
+ Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir)
+{
+ XPoint points[4];
+ ArrowPoints(b, dir, points);
+ XFillPolygon(display, d, gc, points, 3, Convex, CoordModeOrigin);
+ XDrawLines(display, d, gc, points, 4, CoordModeOrigin);
+}
+
+/*public*/
+void TtkDrawArrow(
+ Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir)
+{
+ XPoint points[4];
+ ArrowPoints(b, dir, points);
+ XDrawLines(display, d, gc, points, 4, CoordModeOrigin);
+}
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Border element implementation.
+ *
+ * This border consists of (from outside-in):
+ *
+ * + a 1-pixel thick default indicator (defaultable widgets only)
+ * + 1- or 2- pixel shaded border (controlled by -background and -relief)
+ * + 1 pixel padding (???)
+ */
+
+typedef struct {
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderColorObj; /* Extra border color */
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *defaultStateObj; /* for buttons */
+} BorderElement;
+
+static Ttk_ElementOptionSpec BorderElementOptions[] = {
+ { "-background", TK_OPTION_BORDER, Tk_Offset(BorderElement,borderObj),
+ DEFAULT_BACKGROUND },
+ { "-bordercolor",TK_OPTION_COLOR,
+ Tk_Offset(BorderElement,borderColorObj), "black" },
+ { "-default", TK_OPTION_ANY, Tk_Offset(BorderElement,defaultStateObj),
+ "disabled" },
+ { "-borderwidth",TK_OPTION_PIXELS,Tk_Offset(BorderElement,borderWidthObj),
+ STRINGIFY(BORDERWIDTH) },
+ { "-relief", TK_OPTION_RELIEF, Tk_Offset(BorderElement,reliefObj),
+ "flat" },
+ { NULL, 0, 0, NULL }
+};
+
+static void BorderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ BorderElement *bd = elementRecord;
+ int borderWidth = 0;
+ int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+
+ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
+ Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
+
+ if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) {
+ ++borderWidth;
+ }
+
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+static void BorderElementDraw(
+ void *clientData, void *elementRecord,
+ Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state)
+{
+ BorderElement *bd = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj);
+ XColor *borderColor = Tk_GetColorFromObj(tkwin, bd->borderColorObj);
+ int borderWidth = 2;
+ int relief = TK_RELIEF_FLAT;
+ int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+
+ /*
+ * Get option values.
+ */
+ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
+ Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
+
+ if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) {
+ GC gc = Tk_GCForColor(borderColor, d);
+ XDrawRectangle(Tk_Display(tkwin), d, gc,
+ b.x, b.y, b.width-1, b.height-1);
+ }
+ if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) {
+ /* Space for default ring: */
+ b = Ttk_PadBox(b, Ttk_UniformPadding(1));
+ }
+
+ DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief);
+}
+
+static Ttk_ElementSpec BorderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(BorderElement),
+ BorderElementOptions,
+ BorderElementSize,
+ BorderElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Field element:
+ * Used for editable fields.
+ */
+typedef struct {
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderColorObj; /* Extra border color */
+} FieldElement;
+
+static Ttk_ElementOptionSpec FieldElementOptions[] = {
+ { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,borderObj),
+ "white" },
+ { "-bordercolor",TK_OPTION_COLOR, Tk_Offset(FieldElement,borderColorObj),
+ "black" },
+ { NULL, 0, 0, NULL }
+};
+
+static void FieldElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *paddingPtr = Ttk_UniformPadding(2);
+}
+
+static void FieldElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FieldElement *field = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj);
+ XColor *borderColor = Tk_GetColorFromObj(tkwin, field->borderColorObj);
+
+ Tk_Fill3DRectangle(
+ tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_SUNKEN);
+ DrawFieldBorder(tkwin, d, border, borderColor, b);
+}
+
+static Ttk_ElementSpec FieldElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(FieldElement),
+ FieldElementOptions,
+ FieldElementSize,
+ FieldElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * Indicators --
+ *
+ * Code derived (probably incorrectly) from TIP 109 implementation,
+ * unix/tkUnixButton.c r 1.15.
+ */
+
+/*
+ * Indicator bitmap descriptor:
+ */
+typedef struct {
+ int width; /* Width of each image */
+ int height; /* Height of each image */
+ int nimages; /* #images / row */
+ const char *const *pixels; /* array[height] of char[width*nimage] */
+ Ttk_StateTable *map;/* used to look up image index by state */
+} IndicatorSpec;
+
+#if 0
+/*XPM*/
+static const char *const button_images[] = {
+ /* width height ncolors chars_per_pixel */
+ "52 13 8 1",
+ /* colors */
+ "A c #808000000000 s shadow",
+ "B c #000080800000 s highlight",
+ "C c #808080800000 s 3dlight",
+ "D c #000000008080 s window",
+ "E c #808000008080 s 3ddark",
+ "F c #000080808080 s frame",
+ "G c #000000000000 s foreground",
+ "H c #000080800000 s disabledfg",
+};
+#endif
+
+static Ttk_StateTable checkbutton_states[] = {
+ { 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED },
+ { 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED },
+ { 2, TTK_STATE_DISABLED, TTK_STATE_SELECTED },
+ { 3, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 },
+ { 0, 0, 0 }
+};
+
+static const char *const checkbutton_pixels[] = {
+ "AAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAAB",
+ "AEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECB",
+ "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB",
+ "AEDDDDDDDDDCBAEDDDDDDDGDCBAEFFFFFFFFFCBAEFFFFFFFHFCB",
+ "AEDDDDDDDDDCBAEDDDDDDGGDCBAEFFFFFFFFFCBAEFFFFFFHHFCB",
+ "AEDDDDDDDDDCBAEDGDDDGGGDCBAEFFFFFFFFFCBAEFHFFFHHHFCB",
+ "AEDDDDDDDDDCBAEDGGDGGGDDCBAEFFFFFFFFFCBAEFHHFHHHFFCB",
+ "AEDDDDDDDDDCBAEDGGGGGDDDCBAEFFFFFFFFFCBAEFHHHHHFFFCB",
+ "AEDDDDDDDDDCBAEDDGGGDDDDCBAEFFFFFFFFFCBAEFFHHHFFFFCB",
+ "AEDDDDDDDDDCBAEDDDGDDDDDCBAEFFFFFFFFFCBAEFFFHFFFFFCB",
+ "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB",
+ "ACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCB",
+ "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
+};
+
+static IndicatorSpec checkbutton_spec = {
+ 13, 13, 4, /* width, height, nimages */
+ checkbutton_pixels,
+ checkbutton_states
+};
+
+static Ttk_StateTable radiobutton_states[] = {
+ { 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED },
+ { 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED },
+ { 2, TTK_STATE_DISABLED, TTK_STATE_SELECTED },
+ { 3, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 },
+ { 0, 0, 0 }
+};
+
+static const char *const radiobutton_pixels[] = {
+ "FFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFF",
+ "FFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFF",
+ "FAEEDDDDEEBFFFAEEDDDDEEBFFFAEEFFFFEEBFFFAEEFFFFEEBFF",
+ "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF",
+ "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF",
+ "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF",
+ "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF",
+ "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF",
+ "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF",
+ "FACCDDDDCCBFFFACCDDDDCCBFFFACCFFFFCCBFFFACCFFFFCCBFF",
+ "FFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFF",
+ "FFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFF",
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
+};
+
+static IndicatorSpec radiobutton_spec = {
+ 13, 13, 4, /* width, height, nimages */
+ radiobutton_pixels,
+ radiobutton_states
+};
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *colorObj;
+ Tcl_Obj *lightColorObj;
+ Tcl_Obj *shadeColorObj;
+ Tcl_Obj *borderColorObj;
+ Tcl_Obj *marginObj;
+} IndicatorElement;
+
+static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
+ { "-background", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
+ { "-foreground", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,foregroundObj), DEFAULT_FOREGROUND },
+ { "-indicatorcolor", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,colorObj), "#FFFFFF" },
+ { "-lightcolor", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,lightColorObj), "#DDDDDD" },
+ { "-shadecolor", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,shadeColorObj), "#888888" },
+ { "-bordercolor", TK_OPTION_COLOR,
+ Tk_Offset(IndicatorElement,borderColorObj), "black" },
+ { "-indicatormargin", TK_OPTION_STRING,
+ Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" },
+ { NULL, 0, 0, NULL }
+};
+
+static void IndicatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ IndicatorSpec *spec = clientData;
+ IndicatorElement *indicator = elementRecord;
+ Ttk_Padding margins;
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
+ *widthPtr = spec->width + Ttk_PaddingWidth(margins);
+ *heightPtr = spec->height + Ttk_PaddingHeight(margins);
+}
+
+static void IndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ IndicatorSpec *spec = clientData;
+ IndicatorElement *indicator = elementRecord;
+ Display *display = Tk_Display(tkwin);
+ Ttk_Padding padding;
+ XColor *fgColor, *frameColor, *shadeColor, *indicatorColor, *borderColor;
+
+ int index, ix, iy;
+ XGCValues gcValues;
+ GC copyGC;
+ unsigned long imgColors[8];
+ XImage *img;
+
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding);
+ b = Ttk_PadBox(b, padding);
+
+ if ( b.x < 0
+ || b.y < 0
+ || Tk_Width(tkwin) < b.x + spec->width
+ || Tk_Height(tkwin) < b.y + spec->height)
+ {
+ /* Oops! not enough room to display the image.
+ * Don't draw anything.
+ */
+ return;
+ }
+
+ /*
+ * Fill in imgColors palette:
+ *
+ * (SHOULD: take light and shade colors from the border object,
+ * but Tk doesn't provide easy access to these in the public API.)
+ */
+ fgColor = Tk_GetColorFromObj(tkwin, indicator->foregroundObj);
+ frameColor = Tk_GetColorFromObj(tkwin, indicator->backgroundObj);
+ shadeColor = Tk_GetColorFromObj(tkwin, indicator->shadeColorObj);
+ indicatorColor = Tk_GetColorFromObj(tkwin, indicator->colorObj);
+ borderColor = Tk_GetColorFromObj(tkwin, indicator->borderColorObj);
+
+ imgColors[0 /*A*/] = shadeColor->pixel;
+ imgColors[1 /*B*/] = indicatorColor->pixel;
+ imgColors[2 /*C*/] = frameColor->pixel;
+ imgColors[3 /*D*/] = indicatorColor->pixel;
+ imgColors[4 /*E*/] = borderColor->pixel;
+ imgColors[5 /*F*/] = frameColor->pixel;
+ imgColors[6 /*G*/] = fgColor->pixel;
+ imgColors[7 /*H*/] = fgColor->pixel;
+
+ /*
+ * Create a scratch buffer to store the image:
+ */
+ img = XGetImage(display,d, 0, 0,
+ (unsigned int)spec->width, (unsigned int)spec->height,
+ AllPlanes, ZPixmap);
+ if (img == NULL)
+ return;
+
+ /*
+ * Create the image, painting it into an XImage one pixel at a time.
+ */
+ index = Ttk_StateTableLookup(spec->map, state);
+ for (iy=0 ; iy<spec->height ; iy++) {
+ for (ix=0 ; ix<spec->width ; ix++) {
+ XPutPixel(img, ix, iy,
+ imgColors[spec->pixels[iy][index*spec->width+ix] - 'A'] );
+ }
+ }
+
+ /*
+ * Copy onto our target drawable surface.
+ */
+ memset(&gcValues, 0, sizeof(gcValues));
+ copyGC = Tk_GetGC(tkwin, 0, &gcValues);
+
+ TkPutImage(NULL, 0, display, d, copyGC, img, 0, 0, b.x, b.y,
+ spec->width, spec->height);
+
+ /*
+ * Tidy up.
+ */
+ Tk_FreeGC(display, copyGC);
+ XDestroyImage(img);
+}
+
+static Ttk_ElementSpec IndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(IndicatorElement),
+ IndicatorElementOptions,
+ IndicatorElementSize,
+ IndicatorElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Arrow element(s).
+ *
+ * Draws a solid triangle, inside a box.
+ * clientData is an enum ArrowDirection pointer.
+ */
+
+static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
+typedef struct {
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderColorObj; /* Extra color for borders */
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *colorObj; /* Arrow color */
+} ArrowElement;
+
+static Ttk_ElementOptionSpec ArrowElementOptions[] = {
+ { "-arrowsize", TK_OPTION_PIXELS,
+ Tk_Offset(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) },
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND },
+ { "-bordercolor", TK_OPTION_COLOR,
+ Tk_Offset(ArrowElement,borderColorObj), "black" },
+ { "-relief", TK_OPTION_RELIEF,
+ Tk_Offset(ArrowElement,reliefObj),"raised"},
+ { "-arrowcolor", TK_OPTION_COLOR,
+ Tk_Offset(ArrowElement,colorObj),"black"},
+ { NULL, 0, 0, NULL }
+};
+
+/*
+ * Note asymmetric padding:
+ * top/left padding is 1 less than bottom/right,
+ * since in this theme 2-pixel borders are asymmetric.
+ */
+static Ttk_Padding ArrowPadding = { 3,3,4,4 };
+
+static void ArrowElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ArrowElement *arrow = elementRecord;
+ int direction = *(int *)clientData;
+ int width = SCROLLBAR_WIDTH;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width);
+ width -= Ttk_PaddingWidth(ArrowPadding);
+ TtkArrowSize(width/2, direction, widthPtr, heightPtr);
+ *widthPtr += Ttk_PaddingWidth(ArrowPadding);
+ *heightPtr += Ttk_PaddingHeight(ArrowPadding);
+}
+
+static void ArrowElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ int direction = *(int *)clientData;
+ ArrowElement *arrow = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
+ XColor *borderColor = Tk_GetColorFromObj(tkwin, arrow->borderColorObj);
+ XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj);
+ int relief = TK_RELIEF_RAISED;
+ int borderWidth = 2;
+
+ Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief);
+
+ Tk_Fill3DRectangle(
+ tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT);
+ DrawBorder(tkwin,d,border,borderColor,b,borderWidth,relief);
+
+ TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d),
+ Ttk_PadBox(b, ArrowPadding), direction);
+}
+
+static Ttk_ElementSpec ArrowElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ArrowElement),
+ ArrowElementOptions,
+ ArrowElementSize,
+ ArrowElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Menubutton indicator:
+ * Draw an arrow in the direction where the menu will be posted.
+ */
+
+#define MENUBUTTON_ARROW_SIZE 5
+
+typedef struct {
+ Tcl_Obj *directionObj;
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *colorObj;
+} MenubuttonArrowElement;
+
+static const char *directionStrings[] = { /* See also: button.c */
+ "above", "below", "left", "right", "flush", NULL
+};
+enum { POST_ABOVE, POST_BELOW, POST_LEFT, POST_RIGHT, POST_FLUSH };
+
+static Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = {
+ { "-direction", TK_OPTION_STRING,
+ Tk_Offset(MenubuttonArrowElement,directionObj), "below" },
+ { "-arrowsize", TK_OPTION_PIXELS,
+ Tk_Offset(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)},
+ { "-arrowcolor",TK_OPTION_COLOR,
+ Tk_Offset(MenubuttonArrowElement,colorObj), "black"},
+ { NULL, 0, 0, NULL }
+};
+
+static Ttk_Padding MenubuttonArrowPadding = { 3, 0, 3, 0 };
+
+static void MenubuttonArrowElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ MenubuttonArrowElement *arrow = elementRecord;
+ int size = MENUBUTTON_ARROW_SIZE;
+ Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size);
+ *widthPtr = *heightPtr = 2 * size + 1;
+ *widthPtr += Ttk_PaddingWidth(MenubuttonArrowPadding);
+ *heightPtr += Ttk_PaddingHeight(MenubuttonArrowPadding);
+}
+
+static void MenubuttonArrowElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ MenubuttonArrowElement *arrow = elementRecord;
+ XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj);
+ GC gc = Tk_GCForColor(arrowColor, d);
+ int size = MENUBUTTON_ARROW_SIZE;
+ int postDirection = POST_BELOW;
+ ArrowDirection arrowDirection = ARROW_DOWN;
+ int width = 0, height = 0;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size);
+ Tcl_GetIndexFromObj(NULL, arrow->directionObj, directionStrings,
+ ""/*message*/, 0/*flags*/, &postDirection);
+
+ /* ... this might not be such a great idea ... */
+ switch (postDirection) {
+ case POST_ABOVE: arrowDirection = ARROW_UP; break;
+ case POST_BELOW: arrowDirection = ARROW_DOWN; break;
+ case POST_LEFT: arrowDirection = ARROW_LEFT; break;
+ case POST_RIGHT: arrowDirection = ARROW_RIGHT; break;
+ case POST_FLUSH: arrowDirection = ARROW_DOWN; break;
+ }
+
+ TtkArrowSize(size, arrowDirection, &width, &height);
+ b = Ttk_PadBox(b, MenubuttonArrowPadding);
+ b = Ttk_AnchorBox(b, width, height, TK_ANCHOR_CENTER);
+ TtkFillArrow(Tk_Display(tkwin), d, gc, b, arrowDirection);
+}
+
+static Ttk_ElementSpec MenubuttonArrowElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(MenubuttonArrowElement),
+ MenubuttonArrowElementOptions,
+ MenubuttonArrowElementSize,
+ MenubuttonArrowElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Trough element
+ *
+ * Used in scrollbars and the scale.
+ *
+ * The -groovewidth option can be used to set the size of the short axis
+ * for the drawn area. This will not affect the geometry, but can be used
+ * to draw a thin centered trough inside the packet alloted. This is used
+ * to show a win32-style scale widget. Use -1 or a large number to use the
+ * full area (default).
+ *
+ */
+
+typedef struct {
+ Tcl_Obj *colorObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *grooveWidthObj;
+ Tcl_Obj *orientObj;
+} TroughElement;
+
+static Ttk_ElementOptionSpec TroughElementOptions[] = {
+ { "-orient", TK_OPTION_ANY,
+ Tk_Offset(TroughElement, orientObj), "horizontal" },
+ { "-troughborderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(TroughElement,borderWidthObj), "1" },
+ { "-troughcolor", TK_OPTION_BORDER,
+ Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND },
+ { "-troughrelief",TK_OPTION_RELIEF,
+ Tk_Offset(TroughElement,reliefObj), "sunken" },
+ { "-groovewidth", TK_OPTION_PIXELS,
+ Tk_Offset(TroughElement,grooveWidthObj), "-1" },
+ { NULL, 0, 0, NULL }
+};
+
+static void TroughElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TroughElement *troughPtr = elementRecord;
+ int borderWidth = 2, grooveWidth = 0;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth);
+
+ if (grooveWidth <= 0) {
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+ }
+}
+
+static void TroughElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ TroughElement *troughPtr = elementRecord;
+ Tk_3DBorder border = NULL;
+ int borderWidth = 2, relief = TK_RELIEF_SUNKEN, groove = -1, orient;
+
+ border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj);
+ Ttk_GetOrientFromObj(NULL, troughPtr->orientObj, &orient);
+ Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief);
+ Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &groove);
+
+ if (groove != -1 && groove < b.height && groove < b.width) {
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ b.y = b.y + b.height/2 - groove/2;
+ b.height = groove;
+ } else {
+ b.x = b.x + b.width/2 - groove/2;
+ b.width = groove;
+ }
+ }
+
+ Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height,
+ borderWidth, relief);
+}
+
+static Ttk_ElementSpec TroughElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TroughElement),
+ TroughElementOptions,
+ TroughElementSize,
+ TroughElementDraw
+};
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Thumb element.
+ */
+
+typedef struct {
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *firstObj;
+ Tcl_Obj *lastObj;
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderColorObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *orientObj;
+} ThumbElement;
+
+static Ttk_ElementOptionSpec ThumbElementOptions[] = {
+ { "-width", TK_OPTION_PIXELS, Tk_Offset(ThumbElement,sizeObj),
+ STRINGIFY(SCROLLBAR_WIDTH) },
+ { "-background", TK_OPTION_BORDER, Tk_Offset(ThumbElement,borderObj),
+ DEFAULT_BACKGROUND },
+ { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj),
+ "black" },
+ { "-relief", TK_OPTION_RELIEF,Tk_Offset(ThumbElement,reliefObj),"raised" },
+ { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"},
+ { NULL, 0, 0, NULL }
+};
+
+static void ThumbElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ThumbElement *thumb = elementRecord;
+ int orient, size;
+ Tk_GetPixelsFromObj(NULL, tkwin, thumb->sizeObj, &size);
+ Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient);
+
+ if (orient == TTK_ORIENT_VERTICAL) {
+ *widthPtr = size;
+ *heightPtr = MIN_THUMB_SIZE;
+ } else {
+ *widthPtr = MIN_THUMB_SIZE;
+ *heightPtr = size;
+ }
+}
+
+static void ThumbElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ThumbElement *thumb = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj);
+ XColor *borderColor = Tk_GetColorFromObj(tkwin, thumb->borderColorObj);
+ int relief = TK_RELIEF_RAISED;
+ int borderWidth = 2;
+
+ /*
+ * Don't draw the thumb if we are disabled.
+ * This makes it behave like Windows ... if that's what we want.
+ if (state & TTK_STATE_DISABLED)
+ return;
+ */
+
+ Tk_GetReliefFromObj(NULL, thumb->reliefObj, &relief);
+
+ Tk_Fill3DRectangle(
+ tkwin, d, border, b.x,b.y,b.width,b.height, 0, TK_RELIEF_FLAT);
+ DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief);
+}
+
+static Ttk_ElementSpec ThumbElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ThumbElement),
+ ThumbElementOptions,
+ ThumbElementSize,
+ ThumbElementDraw
+};
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Slider element.
+ *
+ * This is the moving part of the scale widget.
+ *
+ * The slider element is the thumb in the scale widget. This is drawn
+ * as an arrow-type element that can point up, down, left or right.
+ *
+ */
+
+typedef struct {
+ Tcl_Obj *lengthObj; /* Long axis dimension */
+ Tcl_Obj *thicknessObj; /* Short axis dimension */
+ Tcl_Obj *reliefObj; /* Relief for this object */
+ Tcl_Obj *borderObj; /* Border / background color */
+ Tcl_Obj *borderColorObj; /* Additional border color */
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *orientObj; /* Orientation of overall slider */
+} SliderElement;
+
+static Ttk_ElementOptionSpec SliderElementOptions[] = {
+ { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj),
+ "15" },
+ { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj),
+ "15" },
+ { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj),
+ "raised" },
+ { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj),
+ STRINGIFY(BORDERWIDTH) },
+ { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj),
+ DEFAULT_BACKGROUND },
+ { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj),
+ "black" },
+ { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
+ "horizontal" },
+ { NULL, 0, 0, NULL }
+};
+
+static void SliderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SliderElement *slider = elementRecord;
+ int orient, length, thickness, borderWidth;
+
+ Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length);
+ Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness);
+
+ switch (orient) {
+ case TTK_ORIENT_VERTICAL:
+ *widthPtr = thickness + (borderWidth *2);
+ *heightPtr = *widthPtr/2;
+ break;
+
+ case TTK_ORIENT_HORIZONTAL:
+ *heightPtr = thickness + (borderWidth *2);
+ *widthPtr = *heightPtr/2;
+ break;
+ }
+}
+
+static void SliderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ SliderElement *slider = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj);
+ XColor *borderColor = Tk_GetColorFromObj(tkwin, slider->borderColorObj);
+ int relief = TK_RELIEF_RAISED, borderWidth = 2;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief);
+
+ Tk_Fill3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height,
+ borderWidth, TK_RELIEF_FLAT);
+ DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief);
+}
+
+static Ttk_ElementSpec SliderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SliderElement),
+ SliderElementOptions,
+ SliderElementSize,
+ SliderElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Tree indicator element.
+ */
+
+#define TTK_STATE_OPEN TTK_STATE_USER1 /* XREF: treeview.c */
+#define TTK_STATE_LEAF TTK_STATE_USER2
+
+typedef struct {
+ Tcl_Obj *colorObj;
+ Tcl_Obj *marginObj;
+ Tcl_Obj *diameterObj;
+} TreeitemIndicator;
+
+static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = {
+ { "-foreground", TK_OPTION_COLOR,
+ Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND },
+ { "-diameter", TK_OPTION_PIXELS,
+ Tk_Offset(TreeitemIndicator,diameterObj), "9" },
+ { "-indicatormargins", TK_OPTION_STRING,
+ Tk_Offset(TreeitemIndicator,marginObj), "2 2 4 2" },
+ { NULL, 0, 0, NULL }
+};
+
+static void TreeitemIndicatorSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TreeitemIndicator *indicator = elementRecord;
+ int diameter = 0;
+ Ttk_Padding margins;
+
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
+ Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter);
+ *widthPtr = diameter + Ttk_PaddingWidth(margins);
+ *heightPtr = diameter + Ttk_PaddingHeight(margins);
+}
+
+static void TreeitemIndicatorDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ TreeitemIndicator *indicator = elementRecord;
+ XColor *color = Tk_GetColorFromObj(tkwin, indicator->colorObj);
+ GC gc = Tk_GCForColor(color, d);
+ Ttk_Padding padding = Ttk_UniformPadding(0);
+ int w = WIN32_XDRAWLINE_HACK;
+ int cx, cy;
+
+ if (state & TTK_STATE_LEAF) {
+ /* don't draw anything ... */
+ return;
+ }
+
+ Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding);
+ b = Ttk_PadBox(b, padding);
+
+ XDrawRectangle(Tk_Display(tkwin), d, gc,
+ b.x, b.y, b.width - 1, b.height - 1);
+
+ cx = b.x + (b.width - 1) / 2;
+ cy = b.y + (b.height - 1) / 2;
+ XDrawLine(Tk_Display(tkwin), d, gc, b.x+2, cy, b.x+b.width-3+w, cy);
+
+ if (!(state & TTK_STATE_OPEN)) {
+ /* turn '-' into a '+' */
+ XDrawLine(Tk_Display(tkwin), d, gc, cx, b.y+2, cx, b.y+b.height-3+w);
+ }
+}
+
+static Ttk_ElementSpec TreeitemIndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TreeitemIndicator),
+ TreeitemIndicatorOptions,
+ TreeitemIndicatorSize,
+ TreeitemIndicatorDraw
+};
+
+/*------------------------------------------------------------------------
+ * TtkAltTheme_Init --
+ * Install alternate theme.
+ */
+MODULE_SCOPE int TtkAltTheme_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_CreateTheme(interp, "alt", NULL);
+
+ if (!theme) {
+ return TCL_ERROR;
+ }
+
+ Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "Checkbutton.indicator",
+ &IndicatorElementSpec, &checkbutton_spec);
+ Ttk_RegisterElement(interp, theme, "Radiobutton.indicator",
+ &IndicatorElementSpec, &radiobutton_spec);
+ Ttk_RegisterElement(interp, theme, "Menubutton.indicator",
+ &MenubuttonArrowElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "uparrow",
+ &ArrowElementSpec, &ArrowElements[0]);
+ Ttk_RegisterElement(interp, theme, "downarrow",
+ &ArrowElementSpec, &ArrowElements[1]);
+ Ttk_RegisterElement(interp, theme, "leftarrow",
+ &ArrowElementSpec, &ArrowElements[2]);
+ Ttk_RegisterElement(interp, theme, "rightarrow",
+ &ArrowElementSpec, &ArrowElements[3]);
+ Ttk_RegisterElement(interp, theme, "arrow",
+ &ArrowElementSpec, &ArrowElements[0]);
+
+ Ttk_RegisterElement(interp, theme, "arrow",
+ &ArrowElementSpec, &ArrowElements[0]);
+
+ Ttk_RegisterElement(interp, theme, "Treeitem.indicator",
+ &TreeitemIndicatorElementSpec, 0);
+
+ Tcl_PkgProvide(interp, "ttk::theme::alt", TTK_VERSION);
+
+ return TCL_OK;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
new file mode 100644
index 0000000..22af1d6
--- /dev/null
+++ b/generic/ttk/ttkElements.c
@@ -0,0 +1,1281 @@
+/*
+ * Copyright (c) 2003, Joe English
+ *
+ * Default implementation for themed elements.
+ *
+ */
+
+#include <tcl.h>
+#include <tk.h>
+#include <string.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+#define DEFAULT_BORDERWIDTH "2"
+#define DEFAULT_ARROW_SIZE "15"
+#define MIN_THUMB_SIZE 10
+
+/*----------------------------------------------------------------------
+ * +++ Null element. Does nothing; used as a stub.
+ * Null element methods, option table and element spec are public,
+ * and may be used in other engines.
+ */
+
+/* public */ Ttk_ElementOptionSpec TtkNullElementOptions[] = { { NULL, 0, 0, NULL } };
+
+/* public */ void
+TtkNullElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+}
+
+/* public */ void
+TtkNullElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+}
+
+/* public */ Ttk_ElementSpec ttkNullElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ TtkNullElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Background and fill elements.
+ *
+ * The fill element fills its parcel with the background color.
+ * The background element ignores the parcel, and fills the entire window.
+ *
+ * Ttk_GetLayout() automatically includes a background element.
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+} BackgroundElement;
+
+static Ttk_ElementOptionSpec BackgroundElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND },
+ { NULL, 0, 0, NULL }
+};
+
+static void FillElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ BackgroundElement *bg = elementRecord;
+ Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,bg->backgroundObj);
+
+ XFillRectangle(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
+ b.x, b.y, b.width, b.height);
+}
+
+static void BackgroundElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FillElementDraw(
+ clientData, elementRecord, tkwin,
+ d, Ttk_WinBox(tkwin), state);
+}
+
+static Ttk_ElementSpec FillElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(BackgroundElement),
+ BackgroundElementOptions,
+ TtkNullElementSize,
+ FillElementDraw
+};
+
+static Ttk_ElementSpec BackgroundElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(BackgroundElement),
+ BackgroundElementOptions,
+ TtkNullElementSize,
+ BackgroundElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Border element.
+ */
+
+typedef struct {
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+} BorderElement;
+
+static Ttk_ElementOptionSpec BorderElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(BorderElement,borderObj), DEFAULT_BACKGROUND },
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { "-relief", TK_OPTION_RELIEF,
+ Tk_Offset(BorderElement,reliefObj), "flat" },
+ { NULL, 0, 0, NULL }
+};
+
+static void BorderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ BorderElement *bd = elementRecord;
+ int borderWidth = 0;
+ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+static void BorderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ BorderElement *bd = elementRecord;
+ Tk_3DBorder border = NULL;
+ int borderWidth = 1, relief = TK_RELIEF_FLAT;
+
+ border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj);
+ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
+
+ if (border && borderWidth > 0 && relief != TK_RELIEF_FLAT) {
+ Tk_Draw3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height, borderWidth,relief);
+ }
+}
+
+static Ttk_ElementSpec BorderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(BorderElement),
+ BorderElementOptions,
+ BorderElementSize,
+ BorderElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Field element.
+ * Used for editable fields.
+ */
+typedef struct {
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderWidthObj;
+} FieldElement;
+
+static Ttk_ElementOptionSpec FieldElementOptions[] = {
+ { "-fieldbackground", TK_OPTION_BORDER,
+ Tk_Offset(FieldElement,borderObj), "white" },
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(FieldElement,borderWidthObj), "2" },
+ { NULL, 0, 0, NULL }
+};
+
+static void FieldElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ FieldElement *field = elementRecord;
+ int borderWidth = 2;
+ Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth);
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+static void FieldElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FieldElement *field = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj);
+ int borderWidth = 2;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth);
+ Tk_Fill3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN);
+}
+
+static Ttk_ElementSpec FieldElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(FieldElement),
+ FieldElementOptions,
+ FieldElementSize,
+ FieldElementDraw
+};
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Padding element.
+ *
+ * This element has no visual representation, only geometry.
+ * It adds a (possibly non-uniform) internal border.
+ * In addition, if "-shiftrelief" is specified,
+ * adds additional pixels to shift child elements "in" or "out"
+ * depending on the -relief.
+ */
+
+typedef struct {
+ Tcl_Obj *paddingObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *shiftreliefObj;
+} PaddingElement;
+
+static Ttk_ElementOptionSpec PaddingElementOptions[] = {
+ { "-padding", TK_OPTION_STRING,
+ Tk_Offset(PaddingElement,paddingObj), "0" },
+ { "-relief", TK_OPTION_RELIEF,
+ Tk_Offset(PaddingElement,reliefObj), "flat" },
+ { "-shiftrelief", TK_OPTION_INT,
+ Tk_Offset(PaddingElement,shiftreliefObj), "0" },
+ { NULL, 0, 0, NULL }
+};
+
+static void PaddingElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ PaddingElement *padding = elementRecord;
+ int shiftRelief = 0;
+ int relief = TK_RELIEF_FLAT;
+ Ttk_Padding pad;
+
+ Tk_GetReliefFromObj(NULL, padding->reliefObj, &relief);
+ Tcl_GetIntFromObj(NULL, padding->shiftreliefObj, &shiftRelief);
+ Ttk_GetPaddingFromObj(NULL,tkwin,padding->paddingObj,&pad);
+ *paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief);
+}
+
+static Ttk_ElementSpec PaddingElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(PaddingElement),
+ PaddingElementOptions,
+ PaddingElementSize,
+ TtkNullElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Focus ring element.
+ * Draws a dashed focus ring, if the widget has keyboard focus.
+ */
+typedef struct {
+ Tcl_Obj *focusColorObj;
+ Tcl_Obj *focusThicknessObj;
+} FocusElement;
+
+/*
+ * DrawFocusRing --
+ * Draw a dotted rectangle to indicate focus.
+ */
+static void DrawFocusRing(
+ Tk_Window tkwin, Drawable d, Tcl_Obj *colorObj, Ttk_Box b)
+{
+ XColor *color = Tk_GetColorFromObj(tkwin, colorObj);
+ unsigned long mask = 0UL;
+ XGCValues gcvalues;
+ GC gc;
+
+ gcvalues.foreground = color->pixel;
+ gcvalues.line_style = LineOnOffDash;
+ gcvalues.line_width = 1;
+ gcvalues.dashes = 1;
+ gcvalues.dash_offset = 1;
+ mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth;
+
+ gc = Tk_GetGC(tkwin, mask, &gcvalues);
+ XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+}
+
+static Ttk_ElementOptionSpec FocusElementOptions[] = {
+ { "-focuscolor",TK_OPTION_COLOR,
+ Tk_Offset(FocusElement,focusColorObj), "black" },
+ { "-focusthickness",TK_OPTION_PIXELS,
+ Tk_Offset(FocusElement,focusThicknessObj), "1" },
+ { NULL, 0, 0, NULL }
+};
+
+static void FocusElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ FocusElement *focus = elementRecord;
+ int focusThickness = 0;
+
+ Tcl_GetIntFromObj(NULL, focus->focusThicknessObj, &focusThickness);
+ *paddingPtr = Ttk_UniformPadding((short)focusThickness);
+}
+
+static void FocusElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FocusElement *focus = elementRecord;
+ int focusThickness = 0;
+
+ if (state & TTK_STATE_FOCUS) {
+ Tcl_GetIntFromObj(NULL,focus->focusThicknessObj,&focusThickness);
+ DrawFocusRing(tkwin, d, focus->focusColorObj, b);
+ }
+}
+
+static Ttk_ElementSpec FocusElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(FocusElement),
+ FocusElementOptions,
+ FocusElementSize,
+ FocusElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Separator element.
+ * Just draws a horizontal or vertical bar.
+ * Three elements are defined: horizontal, vertical, and general;
+ * the general separator checks the "-orient" option.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj;
+ Tcl_Obj *borderObj;
+} SeparatorElement;
+
+static Ttk_ElementOptionSpec SeparatorElementOptions[] = {
+ { "-orient", TK_OPTION_ANY,
+ Tk_Offset(SeparatorElement, orientObj), "horizontal" },
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(SeparatorElement,borderObj), DEFAULT_BACKGROUND },
+ { NULL, 0, 0, NULL }
+};
+
+static void SeparatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *widthPtr = *heightPtr = 2;
+}
+
+static void HorizontalSeparatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ SeparatorElement *separator = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj);
+ GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
+ GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+
+ XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x + b.width, b.y);
+ XDrawLine(Tk_Display(tkwin), d, lightGC, b.x, b.y+1, b.x + b.width, b.y+1);
+}
+
+static void VerticalSeparatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ SeparatorElement *separator = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj);
+ GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
+ GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+
+ XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x, b.y + b.height);
+ XDrawLine(Tk_Display(tkwin), d, lightGC, b.x+1, b.y, b.x+1, b.y+b.height);
+}
+
+static void GeneralSeparatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ SeparatorElement *separator = elementRecord;
+ int orient;
+ Ttk_GetOrientFromObj(NULL, separator->orientObj, &orient);
+ switch (orient) {
+ case TTK_ORIENT_HORIZONTAL:
+ HorizontalSeparatorElementDraw(
+ clientData, elementRecord, tkwin, d, b, state);
+ break;
+ case TTK_ORIENT_VERTICAL:
+ VerticalSeparatorElementDraw(
+ clientData, elementRecord, tkwin, d, b, state);
+ break;
+ }
+}
+
+static Ttk_ElementSpec HorizontalSeparatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SeparatorElement),
+ SeparatorElementOptions,
+ SeparatorElementSize,
+ HorizontalSeparatorElementDraw
+};
+
+static Ttk_ElementSpec VerticalSeparatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SeparatorElement),
+ SeparatorElementOptions,
+ SeparatorElementSize,
+ HorizontalSeparatorElementDraw
+};
+
+static Ttk_ElementSpec SeparatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SeparatorElement),
+ SeparatorElementOptions,
+ SeparatorElementSize,
+ GeneralSeparatorElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Sizegrip: lower-right corner grip handle for resizing window.
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+} SizegripElement;
+
+static Ttk_ElementOptionSpec SizegripOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(SizegripElement,backgroundObj), DEFAULT_BACKGROUND },
+ {0,0,0,0}
+};
+
+static void SizegripSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ int gripCount = 3, gripSpace = 2, gripThickness = 3;
+ *widthPtr = *heightPtr = gripCount * (gripSpace + gripThickness);
+}
+
+static void SizegripDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ SizegripElement *grip = elementRecord;
+ int gripCount = 3, gripSpace = 2;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, grip->backgroundObj);
+ GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
+ GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
+ int x1 = b.x + b.width-1, y1 = b.y + b.height-1, x2 = x1, y2 = y1;
+
+ while (gripCount--) {
+ x1 -= gripSpace; y2 -= gripSpace;
+ XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2); --x1; --y2;
+ XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2); --x1; --y2;
+ XDrawLine(Tk_Display(tkwin), d, lightGC, x1,y1, x2,y2); --x1; --y2;
+ }
+}
+
+static Ttk_ElementSpec SizegripElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SizegripElement),
+ SizegripOptions,
+ SizegripSize,
+ SizegripDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Indicator element.
+ *
+ * Draws the on/off indicator for checkbuttons and radiobuttons.
+ *
+ * Draws a 3-D square (or diamond), raised if off, sunken if on.
+ *
+ * This is actually a regression from Tk 8.5 back to the ugly old Motif
+ * style; use "altTheme" for the newer, nicer version.
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *colorObj;
+ Tcl_Obj *diameterObj;
+ Tcl_Obj *marginObj;
+ Tcl_Obj *borderWidthObj;
+} IndicatorElement;
+
+static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
+ { "-indicatorcolor", TK_OPTION_BORDER,
+ Tk_Offset(IndicatorElement,colorObj), DEFAULT_BACKGROUND },
+ { "-indicatorrelief", TK_OPTION_RELIEF,
+ Tk_Offset(IndicatorElement,reliefObj), "raised" },
+ { "-indicatordiameter", TK_OPTION_PIXELS,
+ Tk_Offset(IndicatorElement,diameterObj), "12" },
+ { "-indicatormargin", TK_OPTION_STRING,
+ Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" },
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { NULL, 0, 0, NULL }
+};
+
+/*
+ * Checkbutton indicators (default): 3-D square.
+ */
+static void SquareIndicatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ IndicatorElement *indicator = elementRecord;
+ Ttk_Padding margins;
+ int diameter = 0;
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
+ Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter);
+ *widthPtr = diameter + Ttk_PaddingWidth(margins);
+ *heightPtr = diameter + Ttk_PaddingHeight(margins);
+}
+
+static void SquareIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ IndicatorElement *indicator = elementRecord;
+ Tk_3DBorder border = 0, interior = 0;
+ int relief = TK_RELIEF_RAISED;
+ Ttk_Padding padding;
+ int borderWidth = 2;
+ int diameter;
+
+ interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj);
+ border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj);
+ Tcl_GetIntFromObj(NULL,indicator->borderWidthObj,&borderWidth);
+ Tk_GetReliefFromObj(NULL,indicator->reliefObj,&relief);
+ Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding);
+
+ b = Ttk_PadBox(b, padding);
+
+ diameter = b.width < b.height ? b.width : b.height;
+ Tk_Fill3DRectangle(tkwin, d, interior, b.x, b.y,
+ diameter, diameter,borderWidth, TK_RELIEF_FLAT);
+ Tk_Draw3DRectangle(tkwin, d, border, b.x, b.y,
+ diameter, diameter, borderWidth, relief);
+}
+
+/*
+ * Radiobutton indicators: 3-D diamond.
+ */
+static void DiamondIndicatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ IndicatorElement *indicator = elementRecord;
+ Ttk_Padding margins;
+ int diameter = 0;
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
+ Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter);
+ *widthPtr = diameter + 3 + Ttk_PaddingWidth(margins);
+ *heightPtr = diameter + 3 + Ttk_PaddingHeight(margins);
+}
+
+static void DiamondIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ IndicatorElement *indicator = elementRecord;
+ Tk_3DBorder border = 0, interior = 0;
+ int borderWidth = 2;
+ int relief = TK_RELIEF_RAISED;
+ int diameter, radius;
+ XPoint points[4];
+ Ttk_Padding padding;
+
+ interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj);
+ border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj);
+ Tcl_GetIntFromObj(NULL,indicator->borderWidthObj,&borderWidth);
+ Tk_GetReliefFromObj(NULL,indicator->reliefObj,&relief);
+ Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding);
+
+ b = Ttk_PadBox(b, padding);
+
+ diameter = b.width < b.height ? b.width : b.height;
+ radius = diameter / 2;
+
+ points[0].x = b.x;
+ points[0].y = b.y + radius;
+ points[1].x = b.x + radius;
+ points[1].y = b.y + 2*radius;
+ points[2].x = b.x + 2*radius;
+ points[2].y = b.y + radius;
+ points[3].x = b.x + radius;
+ points[3].y = b.y;
+
+ Tk_Fill3DPolygon(tkwin,d,interior,points,4,borderWidth,TK_RELIEF_FLAT);
+ Tk_Draw3DPolygon(tkwin,d,border,points,4,borderWidth,relief);
+}
+
+static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(IndicatorElement),
+ IndicatorElementOptions,
+ SquareIndicatorElementSize,
+ SquareIndicatorElementDraw
+};
+
+static Ttk_ElementSpec RadiobuttonIndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(IndicatorElement),
+ IndicatorElementOptions,
+ DiamondIndicatorElementSize,
+ DiamondIndicatorElementDraw
+};
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Menubutton indicators.
+ *
+ * These aren't functional like radio/check indicators,
+ * they're just affordability indicators.
+ *
+ * Standard Tk sets the indicator size to 4.0 mm by 1.7 mm.
+ * I have no idea where these numbers came from.
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *widthObj;
+ Tcl_Obj *heightObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *marginObj;
+} MenuIndicatorElement;
+
+static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
+ { "-indicatorwidth", TK_OPTION_PIXELS,
+ Tk_Offset(MenuIndicatorElement,widthObj), "4.0m" },
+ { "-indicatorheight", TK_OPTION_PIXELS,
+ Tk_Offset(MenuIndicatorElement,heightObj), "1.7m" },
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { "-indicatorrelief", TK_OPTION_RELIEF,
+ Tk_Offset(MenuIndicatorElement,reliefObj),"raised" },
+ { "-indicatormargin", TK_OPTION_STRING,
+ Tk_Offset(MenuIndicatorElement,marginObj), "5 0" },
+ { NULL, 0, 0, NULL }
+};
+
+static void MenuIndicatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ MenuIndicatorElement *mi = elementRecord;
+ Ttk_Padding margins;
+ Tk_GetPixelsFromObj(NULL, tkwin, mi->widthObj, widthPtr);
+ Tk_GetPixelsFromObj(NULL, tkwin, mi->heightObj, heightPtr);
+ Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj, &margins);
+ *widthPtr += Ttk_PaddingWidth(margins);
+ *heightPtr += Ttk_PaddingHeight(margins);
+}
+
+static void MenuIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ MenuIndicatorElement *mi = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, mi->backgroundObj);
+ Ttk_Padding margins;
+ int borderWidth = 2;
+
+ Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj,&margins);
+ b = Ttk_PadBox(b, margins);
+ Tk_GetPixelsFromObj(NULL, tkwin, mi->borderWidthObj, &borderWidth);
+ Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height,
+ borderWidth, TK_RELIEF_RAISED);
+}
+
+static Ttk_ElementSpec MenuIndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(MenuIndicatorElement),
+ MenuIndicatorElementOptions,
+ MenuIndicatorElementSize,
+ MenuIndicatorElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Arrow elements.
+ *
+ * Draws a solid triangle inside a box.
+ * clientData is an enum ArrowDirection pointer.
+ */
+
+static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
+typedef struct {
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *colorObj;
+} ArrowElement;
+
+static Ttk_ElementOptionSpec ArrowElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND },
+ { "-relief",TK_OPTION_RELIEF,
+ Tk_Offset(ArrowElement,reliefObj),"raised"},
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(ArrowElement,borderWidthObj), "1" },
+ { "-arrowcolor",TK_OPTION_COLOR,
+ Tk_Offset(ArrowElement,colorObj),"black"},
+ { "-arrowsize", TK_OPTION_PIXELS,
+ Tk_Offset(ArrowElement,sizeObj), "14" },
+ { NULL, 0, 0, NULL }
+};
+
+static Ttk_Padding ArrowMargins = { 3,3,3,3 };
+
+static void ArrowElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ArrowElement *arrow = elementRecord;
+ int direction = *(int *)clientData;
+ int width = 14;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width);
+ width -= Ttk_PaddingWidth(ArrowMargins);
+ TtkArrowSize(width/2, direction, widthPtr, heightPtr);
+ *widthPtr += Ttk_PaddingWidth(ArrowMargins);
+ *heightPtr += Ttk_PaddingWidth(ArrowMargins);
+}
+
+static void ArrowElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ int direction = *(int *)clientData;
+ ArrowElement *arrow = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
+ XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj);
+ int relief = TK_RELIEF_RAISED;
+ int borderWidth = 1;
+
+ Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief);
+
+ Tk_Fill3DRectangle(
+ tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief);
+
+ TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d),
+ Ttk_PadBox(b, ArrowMargins), direction);
+}
+
+static Ttk_ElementSpec ArrowElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ArrowElement),
+ ArrowElementOptions,
+ ArrowElementSize,
+ ArrowElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Trough element.
+ *
+ * Used in scrollbars and scales in place of "border".
+ */
+
+typedef struct {
+ Tcl_Obj *colorObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+} TroughElement;
+
+static Ttk_ElementOptionSpec TroughElementOptions[] = {
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { "-troughcolor", TK_OPTION_BORDER,
+ Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND },
+ { "-troughrelief",TK_OPTION_RELIEF,
+ Tk_Offset(TroughElement,reliefObj), "sunken" },
+ { NULL, 0, 0, NULL }
+};
+
+static void TroughElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TroughElement *troughPtr = elementRecord;
+ int borderWidth = 2;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth);
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+static void TroughElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ TroughElement *troughPtr = elementRecord;
+ Tk_3DBorder border = NULL;
+ int borderWidth = 2, relief = TK_RELIEF_SUNKEN;
+
+ border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj);
+ Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief);
+ Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth);
+
+ Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height,
+ borderWidth, relief);
+}
+
+static Ttk_ElementSpec TroughElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TroughElement),
+ TroughElementOptions,
+ TroughElementSize,
+ TroughElementDraw
+};
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Thumb element.
+ *
+ * Used in scrollbars.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj;
+ Tcl_Obj *thicknessObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *borderObj;
+ Tcl_Obj *borderWidthObj;
+} ThumbElement;
+
+static Ttk_ElementOptionSpec ThumbElementOptions[] = {
+ { "-orient", TK_OPTION_ANY,
+ Tk_Offset(ThumbElement, orientObj), "horizontal" },
+ { "-width", TK_OPTION_PIXELS,
+ Tk_Offset(ThumbElement,thicknessObj), DEFAULT_ARROW_SIZE },
+ { "-relief", TK_OPTION_RELIEF,
+ Tk_Offset(ThumbElement,reliefObj), "raised" },
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(ThumbElement,borderObj), DEFAULT_BACKGROUND },
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH },
+ { NULL, 0, 0, NULL }
+};
+
+static void ThumbElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ThumbElement *thumb = elementRecord;
+ int orient, thickness;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, thumb->thicknessObj, &thickness);
+ Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient);
+
+ if (orient == TTK_ORIENT_VERTICAL) {
+ *widthPtr = thickness;
+ *heightPtr = MIN_THUMB_SIZE;
+ } else {
+ *widthPtr = MIN_THUMB_SIZE;
+ *heightPtr = thickness;
+ }
+}
+
+static void ThumbElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ThumbElement *thumb = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj);
+ int borderWidth = 2, relief = TK_RELIEF_RAISED;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, thumb->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, thumb->reliefObj, &relief);
+ Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height,
+ borderWidth, relief);
+}
+
+static Ttk_ElementSpec ThumbElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ThumbElement),
+ ThumbElementOptions,
+ ThumbElementSize,
+ ThumbElementDraw
+};
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Slider element.
+ *
+ * This is the moving part of the scale widget. Drawn as a raised box.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj; /* orientation of overall slider */
+ Tcl_Obj *lengthObj; /* slider length */
+ Tcl_Obj *thicknessObj; /* slider thickness */
+ Tcl_Obj *reliefObj; /* the relief for this object */
+ Tcl_Obj *borderObj; /* the background color */
+ Tcl_Obj *borderWidthObj; /* the size of the border */
+} SliderElement;
+
+static Ttk_ElementOptionSpec SliderElementOptions[] = {
+ { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj),
+ "30" },
+ { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj),
+ "15" },
+ { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj),
+ "raised" },
+ { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj),
+ DEFAULT_BORDERWIDTH },
+ { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj),
+ DEFAULT_BACKGROUND },
+ { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
+ "horizontal" },
+ { NULL, 0, 0, NULL }
+};
+
+static void SliderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SliderElement *slider = elementRecord;
+ int orient, length, thickness;
+
+ Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length);
+ Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness);
+
+ switch (orient) {
+ case TTK_ORIENT_VERTICAL:
+ *widthPtr = thickness;
+ *heightPtr = length;
+ break;
+
+ case TTK_ORIENT_HORIZONTAL:
+ *widthPtr = length;
+ *heightPtr = thickness;
+ break;
+ }
+}
+
+static void SliderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ SliderElement *slider = elementRecord;
+ Tk_3DBorder border = NULL;
+ int relief = TK_RELIEF_RAISED, borderWidth = 2, orient;
+
+ border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj);
+ Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief);
+
+ Tk_Fill3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height,
+ borderWidth, relief);
+
+ if (relief != TK_RELIEF_FLAT) {
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ if (b.width > 4) {
+ b.x += b.width/2;
+ XDrawLine(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC),
+ b.x-1, b.y+borderWidth, b.x-1, b.y+b.height-borderWidth);
+ XDrawLine(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC),
+ b.x, b.y+borderWidth, b.x, b.y+b.height-borderWidth);
+ }
+ } else {
+ if (b.height > 4) {
+ b.y += b.height/2;
+ XDrawLine(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC),
+ b.x+borderWidth, b.y-1, b.x+b.width-borderWidth, b.y-1);
+ XDrawLine(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC),
+ b.x+borderWidth, b.y, b.x+b.width-borderWidth, b.y);
+ }
+ }
+ }
+}
+
+static Ttk_ElementSpec SliderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SliderElement),
+ SliderElementOptions,
+ SliderElementSize,
+ SliderElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Progress bar element:
+ * Draws the moving part of the progress bar.
+ *
+ * -thickness specifies the size along the short axis of the bar.
+ * -length specifies the default size along the long axis;
+ * the bar will be this long in indeterminate mode.
+ */
+
+#define DEFAULT_PBAR_THICKNESS "15"
+#define DEFAULT_PBAR_LENGTH "30"
+
+typedef struct {
+ Tcl_Obj *orientObj; /* widget orientation */
+ Tcl_Obj *thicknessObj; /* the height/width of the bar */
+ Tcl_Obj *lengthObj; /* default width/height of the bar */
+ Tcl_Obj *reliefObj; /* border relief for this object */
+ Tcl_Obj *borderObj; /* background color */
+ Tcl_Obj *borderWidthObj; /* thickness of the border */
+} PbarElement;
+
+static Ttk_ElementOptionSpec PbarElementOptions[] = {
+ { "-orient", TK_OPTION_ANY, Tk_Offset(PbarElement,orientObj),
+ "horizontal" },
+ { "-thickness", TK_OPTION_PIXELS, Tk_Offset(PbarElement,thicknessObj),
+ DEFAULT_PBAR_THICKNESS },
+ { "-barsize", TK_OPTION_PIXELS, Tk_Offset(PbarElement,lengthObj),
+ DEFAULT_PBAR_LENGTH },
+ { "-pbarrelief", TK_OPTION_RELIEF, Tk_Offset(PbarElement,reliefObj),
+ "raised" },
+ { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(PbarElement,borderWidthObj),
+ DEFAULT_BORDERWIDTH },
+ { "-background", TK_OPTION_BORDER, Tk_Offset(PbarElement,borderObj),
+ DEFAULT_BACKGROUND },
+ { NULL, 0, 0, NULL }
+};
+
+static void PbarElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ PbarElement *pbar = elementRecord;
+ int orient, thickness = 15, length = 30, borderWidth = 2;
+
+ Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orient);
+ Tk_GetPixelsFromObj(NULL, tkwin, pbar->thicknessObj, &thickness);
+ Tk_GetPixelsFromObj(NULL, tkwin, pbar->lengthObj, &length);
+ Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth);
+
+ switch (orient) {
+ case TTK_ORIENT_HORIZONTAL:
+ *widthPtr = length + 2 * borderWidth;
+ *heightPtr = thickness + 2 * borderWidth;
+ break;
+ case TTK_ORIENT_VERTICAL:
+ *widthPtr = thickness + 2 * borderWidth;
+ *heightPtr = length + 2 * borderWidth;
+ break;
+ }
+}
+
+static void PbarElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ PbarElement *pbar = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, pbar->borderObj);
+ int relief = TK_RELIEF_RAISED, borderWidth = 2;
+
+ Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, pbar->reliefObj, &relief);
+
+ Tk_Fill3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height,
+ borderWidth, relief);
+}
+
+static Ttk_ElementSpec PbarElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(PbarElement),
+ PbarElementOptions,
+ PbarElementSize,
+ PbarElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Notebook tabs and client area.
+ */
+
+typedef struct {
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *backgroundObj;
+} TabElement;
+
+static Ttk_ElementOptionSpec TabElementOptions[] = {
+ { "-borderwidth", TK_OPTION_PIXELS,
+ Tk_Offset(TabElement,borderWidthObj),"1" },
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(TabElement,backgroundObj), DEFAULT_BACKGROUND },
+ {0,0,0,0}
+};
+
+static void TabElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TabElement *tab = elementRecord;
+ int borderWidth = 1;
+ Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth);
+ paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth;
+ paddingPtr->bottom = 0;
+}
+
+static void TabElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ TabElement *tab = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
+ int borderWidth = 1;
+ int cut = 2;
+ XPoint pts[6];
+ int n = 0;
+
+ Tcl_GetIntFromObj(NULL, tab->borderWidthObj, &borderWidth);
+
+ if (state & TTK_STATE_SELECTED) {
+ /*
+ * Draw slightly outside of the allocated parcel,
+ * to overwrite the client area border.
+ */
+ b.height += borderWidth;
+ }
+
+ pts[n].x = b.x; pts[n].y = b.y + b.height - 1; ++n;
+ pts[n].x = b.x; pts[n].y = b.y + cut; ++n;
+ pts[n].x = b.x + cut; pts[n].y = b.y; ++n;
+ pts[n].x = b.x + b.width-1-cut; pts[n].y = b.y; ++n;
+ pts[n].x = b.x + b.width-1; pts[n].y = b.y + cut; ++n;
+ pts[n].x = b.x + b.width-1; pts[n].y = b.y + b.height; ++n;
+
+ XFillPolygon(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC),
+ pts, 6, Convex, CoordModeOrigin);
+
+#ifndef WIN32
+ /*
+ * Account for whether XDrawLines draws endpoints by platform
+ */
+ --pts[5].y;
+#endif
+
+ while (borderWidth--) {
+ XDrawLines(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC),
+ pts, 4, CoordModeOrigin);
+ XDrawLines(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC),
+ pts+3, 3, CoordModeOrigin);
+ ++pts[0].x; ++pts[1].x; ++pts[2].x; --pts[4].x; --pts[5].x;
+ ++pts[2].y; ++pts[3].y;
+ }
+
+}
+
+static Ttk_ElementSpec TabElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TabElement),
+ TabElementOptions,
+ TabElementSize,
+ TabElementDraw
+};
+
+/*
+ * Client area element:
+ * Uses same resources as tab element.
+ */
+typedef TabElement ClientElement;
+#define ClientElementOptions TabElementOptions
+
+static void ClientElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ClientElement *ce = elementRecord;
+ Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj);
+ int borderWidth = 1;
+
+ Tcl_GetIntFromObj(NULL, ce->borderWidthObj, &borderWidth);
+
+ Tk_Fill3DRectangle(tkwin, d, border,
+ b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_RAISED);
+}
+
+static void ClientElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ClientElement *ce = elementRecord;
+ int borderWidth = 1;
+ Tk_GetPixelsFromObj(0, tkwin, ce->borderWidthObj, &borderWidth);
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+}
+
+static Ttk_ElementSpec ClientElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ClientElement),
+ ClientElementOptions,
+ ClientElementSize,
+ ClientElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * TtkElements_Init --
+ * Register default element implementations.
+ */
+
+MODULE_SCOPE
+void TtkElements_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ /*
+ * Elements:
+ */
+ Ttk_RegisterElement(interp, theme, "background",
+ &BackgroundElementSpec,NULL);
+
+ Ttk_RegisterElement(interp, theme, "fill", &FillElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "padding", &PaddingElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "Checkbutton.indicator",
+ &CheckbuttonIndicatorElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "Radiobutton.indicator",
+ &RadiobuttonIndicatorElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "Menubutton.indicator",
+ &MenuIndicatorElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "indicator", &ttkNullElementSpec,NULL);
+
+ Ttk_RegisterElement(interp, theme, "uparrow",
+ &ArrowElementSpec, &ArrowElements[0]);
+ Ttk_RegisterElement(interp, theme, "downarrow",
+ &ArrowElementSpec, &ArrowElements[1]);
+ Ttk_RegisterElement(interp, theme, "leftarrow",
+ &ArrowElementSpec, &ArrowElements[2]);
+ Ttk_RegisterElement(interp, theme, "rightarrow",
+ &ArrowElementSpec, &ArrowElements[3]);
+ Ttk_RegisterElement(interp, theme, "arrow",
+ &ArrowElementSpec, &ArrowElements[0]);
+
+ Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "separator",
+ &SeparatorElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "hseparator",
+ &HorizontalSeparatorElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "vseparator",
+ &VerticalSeparatorElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "sizegrip", &SizegripElementSpec, NULL);
+
+ Ttk_RegisterElement(interp, theme, "tab", &TabElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "client", &ClientElementSpec, NULL);
+
+ /*
+ * Register "default" as a user-loadable theme (for now):
+ */
+ Tcl_PkgProvide(interp, "ttk::theme::default", TTK_VERSION);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
new file mode 100644
index 0000000..c4b1b6a
--- /dev/null
+++ b/generic/ttk/ttkEntry.c
@@ -0,0 +1,2014 @@
+/*
+ * DERIVED FROM: tk/generic/tkEntry.c r1.35.
+ *
+ * Copyright (c) 1990-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright (c) 2000 Ajuba Solutions.
+ * Copyright (c) 2002 ActiveState Corporation.
+ * Copyright (c) 2004 Joe English
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <tk.h>
+#include <X11/Xatom.h>
+
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/*
+ * Extra bits for core.flags:
+ */
+#define GOT_SELECTION (WIDGET_USER_FLAG<<1)
+#define SYNCING_VARIABLE (WIDGET_USER_FLAG<<2)
+#define VALIDATING (WIDGET_USER_FLAG<<3)
+#define VALIDATION_SET_VALUE (WIDGET_USER_FLAG<<4)
+
+/*
+ * Definitions for -validate option values:
+ */
+typedef enum validateMode {
+ VMODE_ALL, VMODE_KEY, VMODE_FOCUS, VMODE_FOCUSIN, VMODE_FOCUSOUT, VMODE_NONE
+} VMODE;
+
+static const char *const validateStrings[] = {
+ "all", "key", "focus", "focusin", "focusout", "none", NULL
+};
+
+/*
+ * Validation reasons:
+ */
+typedef enum validateReason {
+ VALIDATE_INSERT, VALIDATE_DELETE,
+ VALIDATE_FOCUSIN, VALIDATE_FOCUSOUT,
+ VALIDATE_FORCED
+} VREASON;
+
+static const char *const validateReasonStrings[] = {
+ "key", "key", "focusin", "focusout", "forced", NULL
+};
+
+/*------------------------------------------------------------------------
+ * +++ Entry widget record.
+ *
+ * Dependencies:
+ *
+ * textVariableTrace : textVariableObj
+ *
+ * numBytes,numChars : string
+ * displayString : numChars, showChar
+ * layoutHeight,
+ * layoutWidth,
+ * textLayout : fontObj, displayString
+ * layoutX, layoutY : textLayout, justify, xscroll.first
+ *
+ * Invariants:
+ *
+ * 0 <= insertPos <= numChars
+ * 0 <= selectFirst < selectLast <= numChars || selectFirst == selectLast == -1
+ * displayString points to string if showChar == NULL,
+ * or to malloc'ed storage if showChar != NULL.
+ */
+
+/* Style parameters:
+ */
+typedef struct {
+ Tcl_Obj *foregroundObj; /* Foreground color for normal text */
+ Tcl_Obj *backgroundObj; /* Entry widget background color */
+ Tcl_Obj *selBorderObj; /* Border and background for selection */
+ Tcl_Obj *selBorderWidthObj; /* Width of selection border */
+ Tcl_Obj *selForegroundObj; /* Foreground color for selected text */
+ Tcl_Obj *insertColorObj; /* Color of insertion cursor */
+ Tcl_Obj *insertWidthObj; /* Insert cursor width */
+} EntryStyleData;
+
+typedef struct {
+ /*
+ * Internal state:
+ */
+ char *string; /* Storage for string (malloced) */
+ int numBytes; /* Length of string in bytes. */
+ int numChars; /* Length of string in characters. */
+
+ int insertPos; /* Insert index */
+ int selectFirst; /* Index of start of selection, or -1 */
+ int selectLast; /* Index of end of selection, or -1 */
+
+ Scrollable xscroll; /* Current scroll position */
+ ScrollHandle xscrollHandle;
+
+ /*
+ * Options managed by Tk_SetOptions:
+ */
+ Tcl_Obj *textVariableObj; /* Name of linked variable */
+ int exportSelection; /* Tie internal selection to X selection? */
+
+ VMODE validate; /* Validation mode */
+ char *validateCmd; /* Validation script template */
+ char *invalidCmd; /* Invalid callback script template */
+
+ char *showChar; /* Used to derive displayString */
+
+ Tcl_Obj *fontObj; /* Text font to use */
+ Tcl_Obj *widthObj; /* Desired width of window (in avgchars) */
+ Tk_Justify justify; /* Text justification */
+
+ EntryStyleData styleData; /* Display style data (widget options) */
+ EntryStyleData styleDefaults;/* Style defaults (fallback values) */
+
+ Tcl_Obj *stateObj; /* Compatibility option -- see CheckStateObj */
+
+ /*
+ * Derived resources:
+ */
+ Ttk_TraceHandle *textVariableTrace;
+
+ char *displayString; /* String to use when displaying */
+ Tk_TextLayout textLayout; /* Cached text layout information. */
+ int layoutWidth; /* textLayout width */
+ int layoutHeight; /* textLayout height */
+
+ int layoutX, layoutY; /* Origin for text layout. */
+
+} EntryPart;
+
+typedef struct {
+ WidgetCore core;
+ EntryPart entry;
+} Entry;
+
+/*
+ * Extra mask bits for Tk_SetOptions()
+ */
+#define STATE_CHANGED (0x100) /* -state option changed */
+#define TEXTVAR_CHANGED (0x200) /* -textvariable option changed */
+#define SCROLLCMD_CHANGED (0x400) /* -xscrollcommand option changed */
+
+/*
+ * Default option values:
+ */
+#define DEF_SELECT_BG "#000000"
+#define DEF_SELECT_FG "#ffffff"
+#define DEF_INSERT_BG "black"
+#define DEF_ENTRY_WIDTH "20"
+#define DEF_ENTRY_FONT "TkTextFont"
+#define DEF_LIST_HEIGHT "10"
+
+static Tk_OptionSpec EntryOptionSpecs[] = {
+ {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
+ "ExportSelection", "1", -1, Tk_Offset(Entry, entry.exportSelection),
+ 0,0,0 },
+ {TK_OPTION_FONT, "-font", "font", "Font",
+ DEF_ENTRY_FONT, Tk_Offset(Entry, entry.fontObj),-1,
+ 0,0,GEOMETRY_CHANGED},
+ {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
+ NULL, -1, Tk_Offset(Entry, entry.invalidCmd),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
+ "left", -1, Tk_Offset(Entry, entry.justify),
+ 0, 0, GEOMETRY_CHANGED},
+ {TK_OPTION_STRING, "-show", "show", "Show",
+ NULL, -1, Tk_Offset(Entry, entry.showChar),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-state", "state", "State",
+ "normal", Tk_Offset(Entry, entry.stateObj), -1,
+ 0,0,STATE_CHANGED},
+ {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable",
+ NULL, Tk_Offset(Entry, entry.textVariableObj), -1,
+ TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED},
+ {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
+ "none", -1, Tk_Offset(Entry, entry.validate),
+ 0, (ClientData) validateStrings, 0},
+ {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
+ NULL, -1, Tk_Offset(Entry, entry.validateCmd),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_INT, "-width", "width", "Width",
+ DEF_ENTRY_WIDTH, Tk_Offset(Entry, entry.widthObj), -1,
+ 0,0,GEOMETRY_CHANGED},
+ {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
+ NULL, -1, Tk_Offset(Entry, entry.xscroll.scrollCmd),
+ TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED},
+
+ /* EntryStyleData options:
+ */
+ {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
+ NULL, Tk_Offset(Entry, entry.styleData.foregroundObj), -1,
+ TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor",
+ NULL, Tk_Offset(Entry, entry.styleData.backgroundObj), -1,
+ TK_OPTION_NULL_OK,0,0},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*------------------------------------------------------------------------
+ * +++ EntryStyleData management.
+ * This is still more awkward than it should be;
+ * it should be able to use the Element API instead.
+ */
+
+/* EntryInitStyleDefaults --
+ * Initialize EntryStyleData record to fallback values.
+ */
+static void EntryInitStyleDefaults(EntryStyleData *es)
+{
+#define INIT(member, value) \
+ es->member = Tcl_NewStringObj(value, -1); \
+ Tcl_IncrRefCount(es->member);
+ INIT(foregroundObj, DEFAULT_FOREGROUND)
+ INIT(selBorderObj, DEF_SELECT_BG)
+ INIT(selForegroundObj, DEF_SELECT_FG)
+ INIT(insertColorObj, DEFAULT_FOREGROUND)
+ INIT(selBorderWidthObj, "0")
+ INIT(insertWidthObj, "1")
+#undef INIT
+}
+
+static void EntryFreeStyleDefaults(EntryStyleData *es)
+{
+ Tcl_DecrRefCount(es->foregroundObj);
+ Tcl_DecrRefCount(es->selBorderObj);
+ Tcl_DecrRefCount(es->selForegroundObj);
+ Tcl_DecrRefCount(es->insertColorObj);
+ Tcl_DecrRefCount(es->selBorderWidthObj);
+ Tcl_DecrRefCount(es->insertWidthObj);
+}
+
+/*
+ * EntryInitStyleData --
+ * Look up style-specific data for an entry widget.
+ */
+static void EntryInitStyleData(Entry *entryPtr, EntryStyleData *es)
+{
+ Ttk_State state = entryPtr->core.state;
+ Ttk_ResourceCache cache = Ttk_GetResourceCache(entryPtr->core.interp);
+ Tk_Window tkwin = entryPtr->core.tkwin;
+ Tcl_Obj *tmp;
+
+ /* Initialize to fallback values:
+ */
+ *es = entryPtr->entry.styleDefaults;
+
+# define INIT(member, name) \
+ if ((tmp=Ttk_QueryOption(entryPtr->core.layout,name,state))) \
+ es->member=tmp;
+ INIT(foregroundObj, "-foreground");
+ INIT(selBorderObj, "-selectbackground")
+ INIT(selBorderWidthObj, "-selectborderwidth")
+ INIT(selForegroundObj, "-selectforeground")
+ INIT(insertColorObj, "-insertcolor")
+ INIT(insertWidthObj, "-insertwidth")
+#undef INIT
+
+ /* Reacquire color & border resources from resource cache.
+ */
+ es->foregroundObj = Ttk_UseColor(cache, tkwin, es->foregroundObj);
+ es->selForegroundObj = Ttk_UseColor(cache, tkwin, es->selForegroundObj);
+ es->insertColorObj = Ttk_UseColor(cache, tkwin, es->insertColorObj);
+ es->selBorderObj = Ttk_UseBorder(cache, tkwin, es->selBorderObj);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Resource management.
+ */
+
+/* EntryDisplayString --
+ * Return a malloc'ed string consisting of 'numChars' copies
+ * of (the first character in the string) 'showChar'.
+ * Used to compute the displayString if -show is non-NULL.
+ */
+static char *EntryDisplayString(const char *showChar, int numChars)
+{
+ char *displayString, *p;
+ int size;
+ Tcl_UniChar ch;
+ char buf[TCL_UTF_MAX];
+
+ Tcl_UtfToUniChar(showChar, &ch);
+ size = Tcl_UniCharToUtf(ch, buf);
+ p = displayString = ckalloc(numChars * size + 1);
+
+ while (numChars--) {
+ p += Tcl_UniCharToUtf(ch, p);
+ }
+ *p = '\0';
+
+ return displayString;
+}
+
+/* EntryUpdateTextLayout --
+ * Recompute textLayout, layoutWidth, and layoutHeight
+ * from displayString and fontObj.
+ */
+static void EntryUpdateTextLayout(Entry *entryPtr)
+{
+ Tk_FreeTextLayout(entryPtr->entry.textLayout);
+ entryPtr->entry.textLayout = Tk_ComputeTextLayout(
+ Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj),
+ entryPtr->entry.displayString, entryPtr->entry.numChars,
+ 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES,
+ &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight);
+}
+
+/* EntryEditable --
+ * Returns 1 if the entry widget accepts user changes, 0 otherwise
+ */
+static int
+EntryEditable(Entry *entryPtr)
+{
+ return !(entryPtr->core.state & (TTK_STATE_DISABLED|TTK_STATE_READONLY));
+}
+
+/*------------------------------------------------------------------------
+ * +++ Selection management.
+ */
+
+/* EntryFetchSelection --
+ * Selection handler for entry widgets.
+ */
+static int
+EntryFetchSelection(
+ ClientData clientData, int offset, char *buffer, int maxBytes)
+{
+ Entry *entryPtr = (Entry *) clientData;
+ size_t byteCount;
+ const char *string;
+ const char *selStart, *selEnd;
+
+ if (entryPtr->entry.selectFirst < 0 || !entryPtr->entry.exportSelection) {
+ return -1;
+ }
+ string = entryPtr->entry.displayString;
+
+ selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst);
+ selEnd = Tcl_UtfAtIndex(selStart,
+ entryPtr->entry.selectLast - entryPtr->entry.selectFirst);
+ byteCount = selEnd - selStart - offset;
+ if (byteCount > (size_t)maxBytes) {
+ /* @@@POSSIBLE BUG: Can transfer partial UTF-8 sequences. Is this OK? */
+ byteCount = maxBytes;
+ }
+ if (byteCount <= 0) {
+ return 0;
+ }
+ memcpy(buffer, selStart + offset, byteCount);
+ buffer[byteCount] = '\0';
+ return byteCount;
+}
+
+/* EntryLostSelection --
+ * Tk_LostSelProc for Entry widgets; called when an entry
+ * loses ownership of the selection.
+ */
+static void EntryLostSelection(ClientData clientData)
+{
+ Entry *entryPtr = (Entry *) clientData;
+ entryPtr->core.flags &= ~GOT_SELECTION;
+ entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1;
+ TtkRedisplayWidget(&entryPtr->core);
+}
+
+/* EntryOwnSelection --
+ * Assert ownership of the PRIMARY selection,
+ * if -exportselection set and selection is present.
+ */
+static void EntryOwnSelection(Entry *entryPtr)
+{
+ if (entryPtr->entry.exportSelection
+ && !(entryPtr->core.flags & GOT_SELECTION)) {
+ Tk_OwnSelection(entryPtr->core.tkwin, XA_PRIMARY, EntryLostSelection,
+ (ClientData) entryPtr);
+ entryPtr->core.flags |= GOT_SELECTION;
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Validation.
+ */
+
+/* ExpandPercents --
+ * Expand an entry validation script template (-validatecommand
+ * or -invalidcommand).
+ */
+static void
+ExpandPercents(
+ Entry *entryPtr, /* Entry that needs validation. */
+ const char *template, /* Script template */
+ const char *new, /* Potential new value of entry string */
+ int index, /* index of insert/delete */
+ int count, /* #changed characters */
+ VREASON reason, /* Reason for change */
+ Tcl_DString *dsPtr) /* Result of %-substitutions */
+{
+ int spaceNeeded, cvtFlags;
+ int number, length;
+ const char *string;
+ int stringLength;
+ Tcl_UniChar ch;
+ char numStorage[2*TCL_INTEGER_SPACE];
+
+ while (*template) {
+ /* Find everything up to the next % character and append it
+ * to the result string.
+ */
+ string = Tcl_UtfFindFirst(template, '%');
+ if (string == NULL) {
+ /* No more %-sequences to expand.
+ * Copy the rest of the template.
+ */
+ Tcl_DStringAppend(dsPtr, template, -1);
+ return;
+ }
+ if (string != template) {
+ Tcl_DStringAppend(dsPtr, template, string - template);
+ template = string;
+ }
+
+ /* There's a percent sequence here. Process it.
+ */
+ ++template; /* skip over % */
+ if (*template != '\0') {
+ template += Tcl_UtfToUniChar(template, &ch);
+ } else {
+ ch = '%';
+ }
+
+ stringLength = -1;
+ switch (ch) {
+ case 'd': /* Type of call that caused validation */
+ if (reason == VALIDATE_INSERT) {
+ number = 1;
+ } else if (reason == VALIDATE_DELETE) {
+ number = 0;
+ } else {
+ number = -1;
+ }
+ sprintf(numStorage, "%d", number);
+ string = numStorage;
+ break;
+ case 'i': /* index of insert/delete */
+ sprintf(numStorage, "%d", index);
+ string = numStorage;
+ break;
+ case 'P': /* 'Peeked' new value of the string */
+ string = new;
+ break;
+ case 's': /* Current string value */
+ string = entryPtr->entry.string;
+ break;
+ case 'S': /* string to be inserted/deleted, if any */
+ if (reason == VALIDATE_INSERT) {
+ string = Tcl_UtfAtIndex(new, index);
+ stringLength = Tcl_UtfAtIndex(string, count) - string;
+ } else if (reason == VALIDATE_DELETE) {
+ string = Tcl_UtfAtIndex(entryPtr->entry.string, index);
+ stringLength = Tcl_UtfAtIndex(string, count) - string;
+ } else {
+ string = "";
+ stringLength = 0;
+ }
+ break;
+ case 'v': /* type of validation currently set */
+ string = validateStrings[entryPtr->entry.validate];
+ break;
+ case 'V': /* type of validation in effect */
+ string = validateReasonStrings[reason];
+ break;
+ case 'W': /* widget name */
+ string = Tk_PathName(entryPtr->core.tkwin);
+ break;
+ default:
+ length = Tcl_UniCharToUtf(ch, numStorage);
+ numStorage[length] = '\0';
+ string = numStorage;
+ break;
+ }
+
+ spaceNeeded = Tcl_ScanCountedElement(string, stringLength, &cvtFlags);
+ length = Tcl_DStringLength(dsPtr);
+ Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
+ spaceNeeded = Tcl_ConvertCountedElement(string, stringLength,
+ Tcl_DStringValue(dsPtr) + length,
+ cvtFlags | TCL_DONT_USE_BRACES);
+ Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
+ }
+}
+
+/* RunValidationScript --
+ * Build and evaluate an entry validation script.
+ * If the script raises an error, disable validation
+ * by setting '-validate none'
+ */
+static int RunValidationScript(
+ Tcl_Interp *interp, /* Interpreter to use */
+ Entry *entryPtr, /* Entry being validated */
+ const char *template, /* Script template */
+ const char *optionName, /* "-validatecommand", "-invalidcommand" */
+ const char *new, /* Potential new value of entry string */
+ int index, /* index of insert/delete */
+ int count, /* #changed characters */
+ VREASON reason) /* Reason for change */
+{
+ Tcl_DString script;
+ int code;
+
+ Tcl_DStringInit(&script);
+ ExpandPercents(entryPtr, template, new, index, count, reason, &script);
+ code = Tcl_EvalEx(interp,
+ Tcl_DStringValue(&script), Tcl_DStringLength(&script),
+ TCL_EVAL_GLOBAL);
+ Tcl_DStringFree(&script);
+ if (WidgetDestroyed(&entryPtr->core))
+ return TCL_ERROR;
+
+ if (code != TCL_OK && code != TCL_RETURN) {
+ Tcl_AddErrorInfo(interp, "\n\t(in ");
+ Tcl_AddErrorInfo(interp, optionName);
+ Tcl_AddErrorInfo(interp, " validation command executed by ");
+ Tcl_AddErrorInfo(interp, Tk_PathName(entryPtr->core.tkwin));
+ Tcl_AddErrorInfo(interp, ")");
+ entryPtr->entry.validate = VMODE_NONE;
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/* EntryNeedsValidation --
+ * Determine whether the specified VREASON should trigger validation
+ * in the current VMODE.
+ */
+static int EntryNeedsValidation(VMODE vmode, VREASON reason)
+{
+ return (reason == VALIDATE_FORCED)
+ || (vmode == VMODE_ALL)
+ || (reason == VALIDATE_FOCUSIN
+ && (vmode == VMODE_FOCUSIN || vmode == VMODE_FOCUS))
+ || (reason == VALIDATE_FOCUSOUT
+ && (vmode == VMODE_FOCUSOUT || vmode == VMODE_FOCUS))
+ || (reason == VALIDATE_INSERT && vmode == VMODE_KEY)
+ || (reason == VALIDATE_DELETE && vmode == VMODE_KEY)
+ ;
+}
+
+/* EntryValidateChange --
+ * Validate a proposed change to the entry widget's value if required.
+ * Call the -invalidcommand if validation fails.
+ *
+ * Returns:
+ * TCL_OK if the change is accepted
+ * TCL_BREAK if the change is rejected
+ * TCL_ERROR if any errors occured
+ *
+ * The change will be rejected if -validatecommand returns 0,
+ * or if -validatecommand or -invalidcommand modifies the value.
+ */
+static int
+EntryValidateChange(
+ Entry *entryPtr, /* Entry that needs validation. */
+ const char *newValue, /* Potential new value of entry string */
+ int index, /* index of insert/delete, -1 otherwise */
+ int count, /* #changed characters */
+ VREASON reason) /* Reason for change */
+{
+ Tcl_Interp *interp = entryPtr->core.interp;
+ VMODE vmode = entryPtr->entry.validate;
+ int code, change_ok;
+
+ if ( (entryPtr->entry.validateCmd == NULL)
+ || (entryPtr->core.flags & VALIDATING)
+ || !EntryNeedsValidation(vmode, reason) )
+ {
+ return TCL_OK;
+ }
+
+ entryPtr->core.flags |= VALIDATING;
+
+ /* Run -validatecommand and check return value:
+ */
+ code = RunValidationScript(interp, entryPtr,
+ entryPtr->entry.validateCmd, "-validatecommand",
+ newValue, index, count, reason);
+ if (code != TCL_OK) {
+ goto done;
+ }
+
+ code = Tcl_GetBooleanFromObj(interp,Tcl_GetObjResult(interp), &change_ok);
+ if (code != TCL_OK) {
+ entryPtr->entry.validate = VMODE_NONE; /* Disable validation */
+ Tcl_AddErrorInfo(interp,
+ "\n(validation command did not return valid boolean)");
+ goto done;
+ }
+
+ /* Run the -invalidcommand if validation failed:
+ */
+ if (!change_ok && entryPtr->entry.invalidCmd != NULL) {
+ code = RunValidationScript(interp, entryPtr,
+ entryPtr->entry.invalidCmd, "-invalidcommand",
+ newValue, index, count, reason);
+ if (code != TCL_OK) {
+ goto done;
+ }
+ }
+
+ /* Reject the pending change if validation failed
+ * or if a validation script changed the value.
+ */
+ if (!change_ok || (entryPtr->core.flags & VALIDATION_SET_VALUE)) {
+ code = TCL_BREAK;
+ }
+
+done:
+ entryPtr->core.flags &= ~(VALIDATING|VALIDATION_SET_VALUE);
+ return code;
+}
+
+/* EntryRevalidate --
+ * Revalidate the current value of an entry widget,
+ * update the TTK_STATE_INVALID bit.
+ *
+ * Returns:
+ * TCL_OK if valid, TCL_BREAK if invalid, TCL_ERROR on error.
+ */
+static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason)
+{
+ int code = EntryValidateChange(
+ entryPtr, entryPtr->entry.string, -1,0, reason);
+
+ if (code == TCL_BREAK) {
+ TtkWidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0);
+ } else if (code == TCL_OK) {
+ TtkWidgetChangeState(&entryPtr->core, 0, TTK_STATE_INVALID);
+ }
+
+ return code;
+}
+
+/* EntryRevalidateBG --
+ * Revalidate in the background (called from event handler).
+ */
+static void EntryRevalidateBG(Entry *entryPtr, VREASON reason)
+{
+ Tcl_Interp *interp = entryPtr->core.interp;
+ if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) {
+ Tcl_BackgroundError(interp);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Entry widget modification.
+ */
+
+/* AdjustIndex --
+ * Adjust index to account for insertion (nChars > 0)
+ * or deletion (nChars < 0) at specified index.
+ */
+static int AdjustIndex(int i0, int index, int nChars)
+{
+ if (i0 >= index) {
+ i0 += nChars;
+ if (i0 < index) { /* index was inside deleted range */
+ i0 = index;
+ }
+ }
+ return i0;
+}
+
+/* AdjustIndices --
+ * Adjust all internal entry indexes to account for change.
+ * Note that insertPos, and selectFirst have "right gravity",
+ * while leftIndex (=xscroll.first) and selectLast have "left gravity".
+ */
+static void AdjustIndices(Entry *entryPtr, int index, int nChars)
+{
+ EntryPart *e = &entryPtr->entry;
+ int g = nChars > 0; /* left gravity adjustment */
+
+ e->insertPos = AdjustIndex(e->insertPos, index, nChars);
+ e->selectFirst = AdjustIndex(e->selectFirst, index, nChars);
+ e->selectLast = AdjustIndex(e->selectLast, index+g, nChars);
+ e->xscroll.first= AdjustIndex(e->xscroll.first, index+g, nChars);
+
+ if (e->selectLast <= e->selectFirst)
+ e->selectFirst = e->selectLast = -1;
+}
+
+/* EntryStoreValue --
+ * Replace the contents of a text entry with a given value,
+ * recompute dependent resources, and schedule a redisplay.
+ *
+ * See also: EntrySetValue().
+ */
+static void
+EntryStoreValue(Entry *entryPtr, const char *value)
+{
+ size_t numBytes = strlen(value);
+ int numChars = Tcl_NumUtfChars(value, numBytes);
+
+ if (entryPtr->core.flags & VALIDATING)
+ entryPtr->core.flags |= VALIDATION_SET_VALUE;
+
+ /* Make sure all indices remain in bounds:
+ */
+ if (numChars < entryPtr->entry.numChars)
+ AdjustIndices(entryPtr, numChars, numChars - entryPtr->entry.numChars);
+
+ /* Free old value:
+ */
+ if (entryPtr->entry.displayString != entryPtr->entry.string)
+ ckfree(entryPtr->entry.displayString);
+ ckfree(entryPtr->entry.string);
+
+ /* Store new value:
+ */
+ entryPtr->entry.string = ckalloc(numBytes + 1);
+ strcpy(entryPtr->entry.string, value);
+ entryPtr->entry.numBytes = numBytes;
+ entryPtr->entry.numChars = numChars;
+
+ entryPtr->entry.displayString
+ = entryPtr->entry.showChar
+ ? EntryDisplayString(entryPtr->entry.showChar, numChars)
+ : entryPtr->entry.string
+ ;
+
+ /* Update layout, schedule redisplay:
+ */
+ EntryUpdateTextLayout(entryPtr);
+ TtkRedisplayWidget(&entryPtr->core);
+}
+
+/* EntrySetValue --
+ * Stores a new value in the entry widget and updates the
+ * linked -textvariable, if any. The write trace on the
+ * text variable is temporarily disabled; however, other
+ * write traces may change the value of the variable.
+ * If so, the widget is updated again with the new value.
+ *
+ * Returns:
+ * TCL_OK if successful, TCL_ERROR otherwise.
+ */
+static int EntrySetValue(Entry *entryPtr, const char *value)
+{
+ EntryStoreValue(entryPtr, value);
+
+ if (entryPtr->entry.textVariableObj) {
+ const char *textVarName =
+ Tcl_GetString(entryPtr->entry.textVariableObj);
+ if (textVarName && *textVarName) {
+ entryPtr->core.flags |= SYNCING_VARIABLE;
+ value = Tcl_SetVar(entryPtr->core.interp, textVarName,
+ value, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
+ entryPtr->core.flags &= ~SYNCING_VARIABLE;
+ if (!value || WidgetDestroyed(&entryPtr->core)) {
+ return TCL_ERROR;
+ } else if (strcmp(value, entryPtr->entry.string) != 0) {
+ /* Some write trace has changed the variable value.
+ */
+ EntryStoreValue(entryPtr, value);
+ }
+ }
+ }
+
+ return TCL_OK;
+}
+
+/* EntryTextVariableTrace --
+ * Variable trace procedure for entry -textvariable
+ */
+static void EntryTextVariableTrace(void *recordPtr, const char *value)
+{
+ Entry *entryPtr = recordPtr;
+
+ if (WidgetDestroyed(&entryPtr->core)) {
+ return;
+ }
+
+ if (entryPtr->core.flags & SYNCING_VARIABLE) {
+ /* Trace was fired due to Tcl_SetVar call in EntrySetValue.
+ * Don't do anything.
+ */
+ return;
+ }
+
+ EntryStoreValue(entryPtr, value ? value : "");
+}
+
+/*------------------------------------------------------------------------
+ * +++ Insertion and deletion.
+ */
+
+/* InsertChars --
+ * Add new characters to an entry widget.
+ */
+static int
+InsertChars(
+ Entry *entryPtr, /* Entry that is to get the new elements. */
+ int index, /* Insert before this index */
+ const char *value) /* New characters to add */
+{
+ char *string = entryPtr->entry.string;
+ size_t byteIndex = Tcl_UtfAtIndex(string, index) - string;
+ size_t byteCount = strlen(value);
+ int charsAdded = Tcl_NumUtfChars(value, byteCount);
+ size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1;
+ char *new;
+ int code;
+
+ if (byteCount == 0) {
+ return TCL_OK;
+ }
+
+ new = ckalloc(newByteCount);
+ memcpy(new, string, byteIndex);
+ strcpy(new + byteIndex, value);
+ strcpy(new + byteIndex + byteCount, string + byteIndex);
+
+ code = EntryValidateChange(
+ entryPtr, new, index, charsAdded, VALIDATE_INSERT);
+
+ if (code == TCL_OK) {
+ AdjustIndices(entryPtr, index, charsAdded);
+ code = EntrySetValue(entryPtr, new);
+ } else if (code == TCL_BREAK) {
+ code = TCL_OK;
+ }
+
+ ckfree(new);
+ return code;
+}
+
+/* DeleteChars --
+ * Remove one or more characters from an entry widget.
+ */
+static int
+DeleteChars(
+ Entry *entryPtr, /* Entry widget to modify. */
+ int index, /* Index of first character to delete. */
+ int count) /* How many characters to delete. */
+{
+ char *string = entryPtr->entry.string;
+ size_t byteIndex, byteCount, newByteCount;
+ char *new;
+ int code;
+
+ if (index < 0) {
+ index = 0;
+ }
+ if (count > entryPtr->entry.numChars - index) {
+ count = entryPtr->entry.numChars - index;
+ }
+ if (count <= 0) {
+ return TCL_OK;
+ }
+
+ byteIndex = Tcl_UtfAtIndex(string, index) - string;
+ byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex);
+
+ newByteCount = entryPtr->entry.numBytes + 1 - byteCount;
+ new = ckalloc(newByteCount);
+ memcpy(new, string, byteIndex);
+ strcpy(new + byteIndex, string + byteIndex + byteCount);
+
+ code = EntryValidateChange(
+ entryPtr, new, index, count, VALIDATE_DELETE);
+
+ if (code == TCL_OK) {
+ AdjustIndices(entryPtr, index, -count);
+ code = EntrySetValue(entryPtr, new);
+ } else if (code == TCL_BREAK) {
+ code = TCL_OK;
+ }
+ ckfree(new);
+
+ return code;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Event handler.
+ */
+
+/* EntryEventProc --
+ * Extra event handling for entry widgets:
+ * Triggers validation on FocusIn and FocusOut events.
+ */
+#define EntryEventMask (FocusChangeMask)
+static void
+EntryEventProc(ClientData clientData, XEvent *eventPtr)
+{
+ Entry *entryPtr = (Entry *) clientData;
+
+ Tcl_Preserve(clientData);
+ switch (eventPtr->type) {
+ case DestroyNotify:
+ Tk_DeleteEventHandler(entryPtr->core.tkwin,
+ EntryEventMask, EntryEventProc, clientData);
+ break;
+ case FocusIn:
+ EntryRevalidateBG(entryPtr, VALIDATE_FOCUSIN);
+ break;
+ case FocusOut:
+ EntryRevalidateBG(entryPtr, VALIDATE_FOCUSOUT);
+ break;
+ }
+ Tcl_Release(clientData);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Initialization and cleanup.
+ */
+
+static void
+EntryInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Entry *entryPtr = recordPtr;
+
+ Tk_CreateEventHandler(
+ entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr);
+ Tk_CreateSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING,
+ EntryFetchSelection, (ClientData) entryPtr, XA_STRING);
+ TtkBlinkCursor(&entryPtr->core);
+
+ entryPtr->entry.string = ckalloc(1);
+ *entryPtr->entry.string = '\0';
+ entryPtr->entry.displayString = entryPtr->entry.string;
+ entryPtr->entry.textVariableTrace = 0;
+ entryPtr->entry.numBytes = entryPtr->entry.numChars = 0;
+
+ EntryInitStyleDefaults(&entryPtr->entry.styleDefaults);
+
+ entryPtr->entry.xscrollHandle =
+ TtkCreateScrollHandle(&entryPtr->core, &entryPtr->entry.xscroll);
+
+ entryPtr->entry.insertPos = 0;
+ entryPtr->entry.selectFirst = -1;
+ entryPtr->entry.selectLast = -1;
+}
+
+static void
+EntryCleanup(void *recordPtr)
+{
+ Entry *entryPtr = recordPtr;
+
+ if (entryPtr->entry.textVariableTrace)
+ Ttk_UntraceVariable(entryPtr->entry.textVariableTrace);
+
+ TtkFreeScrollHandle(entryPtr->entry.xscrollHandle);
+
+ EntryFreeStyleDefaults(&entryPtr->entry.styleDefaults);
+
+ Tk_DeleteSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING);
+
+ Tk_FreeTextLayout(entryPtr->entry.textLayout);
+ if (entryPtr->entry.displayString != entryPtr->entry.string)
+ ckfree(entryPtr->entry.displayString);
+ ckfree(entryPtr->entry.string);
+}
+
+/* EntryConfigure --
+ * Configure hook for Entry widgets.
+ */
+static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Entry *entryPtr = recordPtr;
+ Tcl_Obj *textVarName = entryPtr->entry.textVariableObj;
+ Ttk_TraceHandle *vt = 0;
+
+ if (mask & TEXTVAR_CHANGED) {
+ if (textVarName && *Tcl_GetString(textVarName)) {
+ vt = Ttk_TraceVariable(interp,
+ textVarName,EntryTextVariableTrace,entryPtr);
+ if (!vt) return TCL_ERROR;
+ }
+ }
+
+ if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) {
+ if (vt) Ttk_UntraceVariable(vt);
+ return TCL_ERROR;
+ }
+
+ /* Update derived resources:
+ */
+ if (mask & TEXTVAR_CHANGED) {
+ if (entryPtr->entry.textVariableTrace)
+ Ttk_UntraceVariable(entryPtr->entry.textVariableTrace);
+ entryPtr->entry.textVariableTrace = vt;
+ }
+
+ /* Claim the selection, in case we've suddenly started exporting it.
+ */
+ if (entryPtr->entry.exportSelection && entryPtr->entry.selectFirst != -1) {
+ EntryOwnSelection(entryPtr);
+ }
+
+ /* Handle -state compatibility option:
+ */
+ if (mask & STATE_CHANGED) {
+ TtkCheckStateOption(&entryPtr->core, entryPtr->entry.stateObj);
+ }
+
+ /* Force scrollbar update if needed:
+ */
+ if (mask & SCROLLCMD_CHANGED) {
+ TtkScrollbarUpdateRequired(entryPtr->entry.xscrollHandle);
+ }
+
+ /* Recompute the displayString, in case showChar changed:
+ */
+ if (entryPtr->entry.displayString != entryPtr->entry.string)
+ ckfree(entryPtr->entry.displayString);
+
+ entryPtr->entry.displayString
+ = entryPtr->entry.showChar
+ ? EntryDisplayString(entryPtr->entry.showChar, entryPtr->entry.numChars)
+ : entryPtr->entry.string
+ ;
+
+ /* Update textLayout:
+ */
+ EntryUpdateTextLayout(entryPtr);
+ return TCL_OK;
+}
+
+/* EntryPostConfigure --
+ * Post-configuration hook for entry widgets.
+ */
+static int EntryPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Entry *entryPtr = recordPtr;
+ int status = TCL_OK;
+
+ if ((mask & TEXTVAR_CHANGED) && entryPtr->entry.textVariableTrace != NULL) {
+ status = Ttk_FireTrace(entryPtr->entry.textVariableTrace);
+ }
+
+ return status;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Layout and display.
+ */
+
+/* EntryCharPosition --
+ * Return the X coordinate of the specified character index.
+ * Precondition: textLayout and layoutX up-to-date.
+ */
+static int
+EntryCharPosition(Entry *entryPtr, int index)
+{
+ int xPos;
+ Tk_CharBbox(entryPtr->entry.textLayout, index, &xPos, NULL, NULL, NULL);
+ return xPos + entryPtr->entry.layoutX;
+}
+
+/* EntryDoLayout --
+ * Layout hook for entry widgets.
+ *
+ * Determine position of textLayout based on xscroll.first, justify,
+ * and display area.
+ *
+ * Recalculates layoutX, layoutY, and rightIndex,
+ * and updates xscroll accordingly.
+ * May adjust xscroll.first to ensure the maximum #characters are onscreen.
+ */
+static void
+EntryDoLayout(void *recordPtr)
+{
+ Entry *entryPtr = recordPtr;
+ WidgetCore *corePtr = &entryPtr->core;
+ Tk_TextLayout textLayout = entryPtr->entry.textLayout;
+ int leftIndex = entryPtr->entry.xscroll.first;
+ int rightIndex;
+ Ttk_Box textarea;
+
+ Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
+ textarea = Ttk_ClientRegion(corePtr->layout, "textarea");
+
+ /* Center the text vertically within the available parcel:
+ */
+ entryPtr->entry.layoutY = textarea.y +
+ (textarea.height - entryPtr->entry.layoutHeight)/2;
+
+ /* Recompute where the leftmost character on the display will
+ * be drawn (layoutX) and adjust leftIndex if necessary.
+ */
+ if (entryPtr->entry.layoutWidth <= textarea.width) {
+ /* Everything fits. Set leftIndex to zero (no need to scroll),
+ * and compute layoutX based on -justify.
+ */
+ int extraSpace = textarea.width - entryPtr->entry.layoutWidth;
+ leftIndex = 0;
+ rightIndex = entryPtr->entry.numChars;
+ entryPtr->entry.layoutX = textarea.x;
+ if (entryPtr->entry.justify == TK_JUSTIFY_RIGHT) {
+ entryPtr->entry.layoutX += extraSpace;
+ } else if (entryPtr->entry.justify == TK_JUSTIFY_CENTER) {
+ entryPtr->entry.layoutX += extraSpace / 2;
+ }
+ } else {
+ /* The whole string doesn't fit in the window.
+ * Limit leftIndex to leave at most one character's worth
+ * of empty space on the right.
+ */
+ int overflow = entryPtr->entry.layoutWidth - textarea.width;
+ int maxLeftIndex = 1 + Tk_PointToChar(textLayout, overflow, 0);
+ int leftX;
+
+ if (leftIndex > maxLeftIndex) {
+ leftIndex = maxLeftIndex;
+ }
+
+ /* Compute layoutX and rightIndex.
+ * rightIndex is set to one past the last fully-visible character.
+ */
+ Tk_CharBbox(textLayout, leftIndex, &leftX, NULL, NULL, NULL);
+ rightIndex = Tk_PointToChar(textLayout, leftX + textarea.width, 0);
+ entryPtr->entry.layoutX = textarea.x - leftX;
+ }
+
+ TtkScrolled(entryPtr->entry.xscrollHandle,
+ leftIndex, rightIndex, entryPtr->entry.numChars);
+}
+
+/* EntryGetGC -- Helper routine.
+ * Get a GC using the specified foreground color and the entry's font.
+ * Result must be freed with Tk_FreeGC().
+ */
+static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj)
+{
+ Tk_Window tkwin = entryPtr->core.tkwin;
+ Tk_Font font = Tk_GetFontFromObj(tkwin, entryPtr->entry.fontObj);
+ XColor *colorPtr;
+ unsigned long mask = 0ul;
+ XGCValues gcValues;
+
+ gcValues.line_width = 1; mask |= GCLineWidth;
+ gcValues.font = Tk_FontId(font); mask |= GCFont;
+ if (colorObj != 0 && (colorPtr=Tk_GetColorFromObj(tkwin,colorObj)) != 0) {
+ gcValues.foreground = colorPtr->pixel;
+ mask |= GCForeground;
+ }
+ return Tk_GetGC(entryPtr->core.tkwin, mask, &gcValues);
+}
+
+/* EntryDisplay --
+ * Redraws the contents of an entry window.
+ */
+static void EntryDisplay(void *clientData, Drawable d)
+{
+ Entry *entryPtr = clientData;
+ Tk_Window tkwin = entryPtr->core.tkwin;
+ int leftIndex = entryPtr->entry.xscroll.first,
+ rightIndex = entryPtr->entry.xscroll.last,
+ selFirst = entryPtr->entry.selectFirst,
+ selLast = entryPtr->entry.selectLast;
+ EntryStyleData es;
+ GC gc;
+ int showSelection, showCursor;
+
+ EntryInitStyleData(entryPtr, &es);
+
+ showCursor =
+ (entryPtr->core.flags & CURSOR_ON) != 0
+ && EntryEditable(entryPtr)
+ && entryPtr->entry.insertPos >= leftIndex
+ && entryPtr->entry.insertPos <= rightIndex
+ ;
+ showSelection =
+ (entryPtr->core.state & TTK_STATE_DISABLED) == 0
+ && selFirst > -1
+ && selLast > leftIndex
+ && selFirst <= rightIndex
+ ;
+
+ /* Adjust selection range to keep in display bounds.
+ */
+ if (showSelection) {
+ if (selFirst < leftIndex)
+ selFirst = leftIndex;
+ if (selLast > rightIndex)
+ selLast = rightIndex;
+ }
+
+ /* Draw widget background & border
+ */
+ Ttk_DrawLayout(entryPtr->core.layout, entryPtr->core.state, d);
+
+ /* Draw selection background
+ */
+ if (showSelection && es.selBorderObj) {
+ Tk_3DBorder selBorder = Tk_Get3DBorderFromObj(tkwin, es.selBorderObj);
+ int selStartX = EntryCharPosition(entryPtr, selFirst);
+ int selEndX = EntryCharPosition(entryPtr, selLast);
+ int borderWidth = 1;
+
+ Tcl_GetIntFromObj(NULL, es.selBorderWidthObj, &borderWidth);
+
+ if (selBorder) {
+ Tk_Fill3DRectangle(tkwin, d, selBorder,
+ selStartX - borderWidth, entryPtr->entry.layoutY - borderWidth,
+ selEndX - selStartX + 2*borderWidth,
+ entryPtr->entry.layoutHeight + 2*borderWidth,
+ borderWidth, TK_RELIEF_RAISED);
+ }
+ }
+
+ /* Draw cursor:
+ */
+ if (showCursor) {
+ int cursorX = EntryCharPosition(entryPtr, entryPtr->entry.insertPos),
+ cursorY = entryPtr->entry.layoutY,
+ cursorHeight = entryPtr->entry.layoutHeight,
+ cursorWidth = 1;
+
+ Tcl_GetIntFromObj(NULL,es.insertWidthObj,&cursorWidth);
+ if (cursorWidth <= 0) {
+ cursorWidth = 1;
+ }
+
+ /* @@@ should: maybe: SetCaretPos even when blinked off */
+ Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight);
+
+ gc = EntryGetGC(entryPtr, es.insertColorObj);
+ XFillRectangle(Tk_Display(tkwin), d, gc,
+ cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+ }
+
+ /* Draw the text:
+ */
+ gc = EntryGetGC(entryPtr, es.foregroundObj);
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ leftIndex, rightIndex);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+
+ /* Overwrite the selected portion (if any) in the -selectforeground color:
+ */
+ if (showSelection) {
+ gc = EntryGetGC(entryPtr, es.selForegroundObj);
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ selFirst, selLast);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands.
+ */
+
+/* EntryIndex --
+ * Parse an index into an entry and return either its value
+ * or an error.
+ *
+ * Results:
+ * A standard Tcl result. If all went well, then *indexPtr is
+ * filled in with the character index (into entryPtr) corresponding to
+ * string. The index value is guaranteed to lie between 0 and
+ * the number of characters in the string, inclusive. If an
+ * error occurs then an error message is left in the interp's result.
+ */
+static int
+EntryIndex(
+ Tcl_Interp *interp, /* For error messages. */
+ Entry *entryPtr, /* Entry widget to query */
+ Tcl_Obj *indexObj, /* Symbolic index name */
+ int *indexPtr) /* Return value */
+{
+# define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */
+ int length;
+ const char *string = Tcl_GetStringFromObj(indexObj, &length);
+
+ if (strncmp(string, "end", length) == 0) {
+ *indexPtr = entryPtr->entry.numChars;
+ } else if (strncmp(string, "insert", length) == 0) {
+ *indexPtr = entryPtr->entry.insertPos;
+ } else if (strncmp(string, "left", length) == 0) { /* for debugging */
+ *indexPtr = entryPtr->entry.xscroll.first;
+ } else if (strncmp(string, "right", length) == 0) { /* for debugging */
+ *indexPtr = entryPtr->entry.xscroll.last;
+ } else if (strncmp(string, "sel.", 4) == 0) {
+ if (entryPtr->entry.selectFirst < 0) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "selection isn't in widget ",
+ Tk_PathName(entryPtr->core.tkwin), NULL);
+ return TCL_ERROR;
+ }
+ if (strncmp(string, "sel.first", length) == 0) {
+ *indexPtr = entryPtr->entry.selectFirst;
+ } else if (strncmp(string, "sel.last", length) == 0) {
+ *indexPtr = entryPtr->entry.selectLast;
+ } else {
+ goto badIndex;
+ }
+ } else if (string[0] == '@') {
+ int roundUp = 0;
+ int maxWidth = EntryWidth(entryPtr);
+ int x;
+
+ if (Tcl_GetInt(interp, string + 1, &x) != TCL_OK) {
+ goto badIndex;
+ }
+ if (x > maxWidth) {
+ x = maxWidth;
+ roundUp = 1;
+ }
+ *indexPtr = Tk_PointToChar(entryPtr->entry.textLayout,
+ x - entryPtr->entry.layoutX, 0);
+
+ if (*indexPtr < entryPtr->entry.xscroll.first) {
+ *indexPtr = entryPtr->entry.xscroll.first;
+ }
+
+ /*
+ * Special trick: if the x-position was off-screen to the right,
+ * round the index up to refer to the character just after the
+ * last visible one on the screen. This is needed to enable the
+ * last character to be selected, for example.
+ */
+
+ if (roundUp && (*indexPtr < entryPtr->entry.numChars)) {
+ *indexPtr += 1;
+ }
+ } else {
+ if (Tcl_GetInt(interp, string, indexPtr) != TCL_OK) {
+ goto badIndex;
+ }
+ if (*indexPtr < 0) {
+ *indexPtr = 0;
+ } else if (*indexPtr > entryPtr->entry.numChars) {
+ *indexPtr = entryPtr->entry.numChars;
+ }
+ }
+ return TCL_OK;
+
+badIndex:
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bad entry index \"", string, "\"", NULL);
+ return TCL_ERROR;
+}
+
+/* $entry bbox $index --
+ * Return the bounding box of the character at the specified index.
+ */
+static int
+EntryBBoxCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ Ttk_Box b;
+ int index;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index");
+ return TCL_ERROR;
+ }
+ if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if ((index == entryPtr->entry.numChars) && (index > 0)) {
+ index--;
+ }
+ Tk_CharBbox(entryPtr->entry.textLayout, index,
+ &b.x, &b.y, &b.width, &b.height);
+ b.x += entryPtr->entry.layoutX;
+ b.y += entryPtr->entry.layoutY;
+ Tcl_SetObjResult(interp, Ttk_NewBoxObj(b));
+ return TCL_OK;
+}
+
+/* $entry delete $from ?$to? --
+ * Delete the characters in the range [$from,$to).
+ * $to defaults to $from+1 if not specified.
+ */
+static int
+EntryDeleteCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ int first, last;
+
+ if ((objc < 3) || (objc > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
+ return TCL_ERROR;
+ }
+ if (EntryIndex(interp, entryPtr, objv[2], &first) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ last = first + 1;
+ } else if (EntryIndex(interp, entryPtr, objv[3], &last) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (last >= first && EntryEditable(entryPtr)) {
+ return DeleteChars(entryPtr, first, last - first);
+ }
+ return TCL_OK;
+}
+
+/* $entry get --
+ * Return the current value of the entry widget.
+ */
+static int
+EntryGetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ return TCL_ERROR;
+ }
+ Tcl_SetResult(interp, entryPtr->entry.string, TCL_VOLATILE);
+ return TCL_OK;
+}
+
+/* $entry icursor $index --
+ * Set the insert cursor position.
+ */
+static int
+EntryICursorCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "pos");
+ return TCL_ERROR;
+ }
+ if (EntryIndex(interp, entryPtr, objv[2],
+ &entryPtr->entry.insertPos) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ TtkRedisplayWidget(&entryPtr->core);
+ return TCL_OK;
+}
+
+/* $entry index $index --
+ * Return numeric value (0..numChars) of the specified index.
+ */
+static int
+EntryIndexCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ int index;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "string");
+ return TCL_ERROR;
+ }
+ if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ return TCL_OK;
+}
+
+/* $entry insert $index $text --
+ * Insert $text after position $index.
+ * Silent no-op if the entry is disabled or read-only.
+ */
+static int
+EntryInsertCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ int index;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "index text");
+ return TCL_ERROR;
+ }
+ if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (EntryEditable(entryPtr)) {
+ return InsertChars(entryPtr, index, Tcl_GetString(objv[3]));
+ }
+ return TCL_OK;
+}
+
+/* $entry selection clear --
+ * Clear selection.
+ */
+static int EntrySelectionClearCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
+ entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1;
+ TtkRedisplayWidget(&entryPtr->core);
+ return TCL_OK;
+}
+
+/* $entry selection present --
+ * Returns 1 if any characters are selected, 0 otherwise.
+ */
+static int EntrySelectionPresentCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj(entryPtr->entry.selectFirst >= 0));
+ return TCL_OK;
+}
+
+/* $entry selection range $start $end --
+ * Explicitly set the selection range.
+ */
+static int EntrySelectionRangeCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ int start, end;
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "start end");
+ return TCL_ERROR;
+ }
+ if ( EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK
+ || EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (entryPtr->core.state & TTK_STATE_DISABLED) {
+ return TCL_OK;
+ }
+
+ if (start >= end) {
+ entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1;
+ } else {
+ entryPtr->entry.selectFirst = start;
+ entryPtr->entry.selectLast = end;
+ EntryOwnSelection(entryPtr);
+ }
+ TtkRedisplayWidget(&entryPtr->core);
+ return TCL_OK;
+}
+
+static const Ttk_Ensemble EntrySelectionCommands[] = {
+ { "clear", EntrySelectionClearCommand,0 },
+ { "present", EntrySelectionPresentCommand,0 },
+ { "range", EntrySelectionRangeCommand,0 },
+ { 0,0,0 }
+};
+
+/* $entry set $value
+ * Sets the value of an entry widget.
+ */
+static int EntrySetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "value");
+ return TCL_ERROR;
+ }
+ EntrySetValue(entryPtr, Tcl_GetString(objv[2]));
+ return TCL_OK;
+}
+
+/* $entry validate --
+ * Trigger forced validation. Returns 1/0 if validation succeeds/fails
+ * or error status from -validatecommand / -invalidcommand.
+ */
+static int EntryValidateCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ int code;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ return TCL_ERROR;
+ }
+
+ code = EntryRevalidate(interp, entryPtr, VALIDATE_FORCED);
+
+ if (code == TCL_ERROR)
+ return code;
+
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK));
+ return TCL_OK;
+}
+
+/* $entry xview -- horizontal scrolling interface
+ */
+static int EntryXViewCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Entry *entryPtr = recordPtr;
+ return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle);
+}
+
+static const Ttk_Ensemble EntryCommands[] = {
+ { "bbox", EntryBBoxCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "delete", EntryDeleteCommand,0 },
+ { "get", EntryGetCommand,0 },
+ { "icursor", EntryICursorCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "index", EntryIndexCommand,0 },
+ { "insert", EntryInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "selection", 0,EntrySelectionCommands },
+ { "state", TtkWidgetStateCommand,0 },
+ { "validate", EntryValidateCommand,0 },
+ { "xview", EntryXViewCommand,0 },
+ { 0,0,0 }
+};
+
+/*------------------------------------------------------------------------
+ * +++ Entry widget definition.
+ */
+
+static WidgetSpec EntryWidgetSpec = {
+ "TEntry", /* className */
+ sizeof(Entry), /* recordSize */
+ EntryOptionSpecs, /* optionSpecs */
+ EntryCommands, /* subcommands */
+ EntryInitialize, /* initializeProc */
+ EntryCleanup, /* cleanupProc */
+ EntryConfigure, /* configureProc */
+ EntryPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ EntryDoLayout, /* layoutProc */
+ EntryDisplay /* displayProc */
+};
+
+/*------------------------------------------------------------------------
+ * +++ Combobox widget record.
+ */
+
+typedef struct {
+ Tcl_Obj *postCommandObj;
+ Tcl_Obj *valuesObj;
+ Tcl_Obj *heightObj;
+ int currentIndex;
+} ComboboxPart;
+
+typedef struct {
+ WidgetCore core;
+ EntryPart entry;
+ ComboboxPart combobox;
+} Combobox;
+
+static Tk_OptionSpec ComboboxOptionSpecs[] = {
+ {TK_OPTION_STRING, "-height", "height", "Height",
+ DEF_LIST_HEIGHT, Tk_Offset(Combobox, combobox.heightObj), -1,
+ 0,0,0 },
+ {TK_OPTION_STRING, "-postcommand", "postCommand", "PostCommand",
+ "", Tk_Offset(Combobox, combobox.postCommandObj), -1,
+ 0,0,0 },
+ {TK_OPTION_STRING, "-values", "values", "Values",
+ "", Tk_Offset(Combobox, combobox.valuesObj), -1,
+ 0,0,0 },
+ WIDGET_INHERIT_OPTIONS(EntryOptionSpecs)
+};
+
+/* ComboboxInitialize --
+ * Initialization hook for combobox widgets.
+ */
+static void
+ComboboxInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Combobox *cb = recordPtr;
+
+ cb->combobox.currentIndex = -1;
+ TtkTrackElementState(&cb->core);
+ EntryInitialize(interp, recordPtr);
+}
+
+/* ComboboxConfigure --
+ * Configuration hook for combobox widgets.
+ */
+static int
+ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Combobox *cbPtr = recordPtr;
+ int unused;
+
+ /* Make sure -values is a valid list:
+ */
+ if (Tcl_ListObjLength(interp,cbPtr->combobox.valuesObj,&unused) != TCL_OK)
+ return TCL_ERROR;
+
+ return EntryConfigure(interp, recordPtr, mask);
+}
+
+/* $cb current ?newIndex? -- get or set current index.
+ * Setting the current index updates the combobox value,
+ * but the value and -values may be changed independently
+ * of the index. Instead of trying to keep currentIndex
+ * in sync at all times, [$cb current] double-checks
+ */
+static int ComboboxCurrentCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Combobox *cbPtr = recordPtr;
+ int currentIndex = cbPtr->combobox.currentIndex;
+ const char *currentValue = cbPtr->entry.string;
+ int nValues;
+ Tcl_Obj **values;
+
+ Tcl_ListObjGetElements(interp,cbPtr->combobox.valuesObj,&nValues,&values);
+
+ if (objc == 2) {
+ /* Check if currentIndex still valid:
+ */
+ if ( currentIndex < 0
+ || currentIndex >= nValues
+ || strcmp(currentValue,Tcl_GetString(values[currentIndex]))
+ )
+ {
+ /* Not valid. Check current value against each element in -values:
+ */
+ for (currentIndex = 0; currentIndex < nValues; ++currentIndex) {
+ if (!strcmp(currentValue,Tcl_GetString(values[currentIndex]))) {
+ break;
+ }
+ }
+ if (currentIndex >= nValues) {
+ /* Not found */
+ currentIndex = -1;
+ }
+ }
+ cbPtr->combobox.currentIndex = currentIndex;
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(currentIndex));
+ return TCL_OK;
+ } else if (objc == 3) {
+ if (Tcl_GetIntFromObj(interp, objv[2], &currentIndex) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (currentIndex < 0 || currentIndex >= nValues) {
+ Tcl_AppendResult(interp,
+ "Index ", Tcl_GetString(objv[2]), " out of range",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ cbPtr->combobox.currentIndex = currentIndex;
+
+ return EntrySetValue(recordPtr, Tcl_GetString(values[currentIndex]));
+ } else {
+ Tcl_WrongNumArgs(interp, 2, objv, "?newIndex?");
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Combobox widget definition.
+ */
+static const Ttk_Ensemble ComboboxCommands[] = {
+ { "bbox", EntryBBoxCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "current", ComboboxCurrentCommand,0 },
+ { "delete", EntryDeleteCommand,0 },
+ { "get", EntryGetCommand,0 },
+ { "icursor", EntryICursorCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "index", EntryIndexCommand,0 },
+ { "insert", EntryInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "selection", 0,EntrySelectionCommands },
+ { "state", TtkWidgetStateCommand,0 },
+ { "set", EntrySetCommand,0 },
+ { "validate", EntryValidateCommand,0 },
+ { "xview", EntryXViewCommand,0 },
+ { 0,0,0 }
+};
+
+static WidgetSpec ComboboxWidgetSpec = {
+ "TCombobox", /* className */
+ sizeof(Combobox), /* recordSize */
+ ComboboxOptionSpecs, /* optionSpecs */
+ ComboboxCommands, /* subcommands */
+ ComboboxInitialize, /* initializeProc */
+ EntryCleanup, /* cleanupProc */
+ ComboboxConfigure, /* configureProc */
+ EntryPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ EntryDoLayout, /* layoutProc */
+ EntryDisplay /* displayProc */
+};
+
+/*------------------------------------------------------------------------
+ * +++ Spinbox widget.
+ */
+
+typedef struct {
+ Tcl_Obj *valuesObj;
+
+ Tcl_Obj *fromObj;
+ Tcl_Obj *toObj;
+ Tcl_Obj *incrementObj;
+ Tcl_Obj *formatObj;
+
+ Tcl_Obj *wrapObj;
+ Tcl_Obj *commandObj;
+} SpinboxPart;
+
+typedef struct {
+ WidgetCore core;
+ EntryPart entry;
+ SpinboxPart spinbox;
+} Spinbox;
+
+static Tk_OptionSpec SpinboxOptionSpecs[] = {
+ {TK_OPTION_STRING, "-values", "values", "Values",
+ "", Tk_Offset(Spinbox, spinbox.valuesObj), -1,
+ 0,0,0 },
+
+ {TK_OPTION_DOUBLE, "-from", "from", "From",
+ "0", Tk_Offset(Spinbox,spinbox.fromObj), -1,
+ 0,0,0 },
+ {TK_OPTION_DOUBLE, "-to", "to", "To",
+ "0", Tk_Offset(Spinbox,spinbox.toObj), -1,
+ 0,0,0 },
+ {TK_OPTION_DOUBLE, "-increment", "increment", "Increment",
+ "1", Tk_Offset(Spinbox,spinbox.incrementObj), -1,
+ 0,0,0 },
+ {TK_OPTION_STRING, "-format", "format", "Format",
+ "", Tk_Offset(Spinbox, spinbox.formatObj), -1,
+ 0,0,0 },
+
+ {TK_OPTION_STRING, "-command", "command", "Command",
+ "", Tk_Offset(Spinbox, spinbox.commandObj), -1,
+ 0,0,0 },
+ {TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap",
+ "0", Tk_Offset(Spinbox,spinbox.wrapObj), -1,
+ 0,0,0 },
+
+ WIDGET_INHERIT_OPTIONS(EntryOptionSpecs)
+};
+
+/* SpinboxInitialize --
+ * Initialization hook for spinbox widgets.
+ */
+static void
+SpinboxInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Spinbox *sb = recordPtr;
+ TtkTrackElementState(&sb->core);
+ EntryInitialize(interp, recordPtr);
+}
+
+/* SpinboxConfigure --
+ * Configuration hook for spinbox widgets.
+ */
+static int
+SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Spinbox *sb = recordPtr;
+ int unused;
+
+ /* Make sure -values is a valid list:
+ */
+ if (Tcl_ListObjLength(interp,sb->spinbox.valuesObj,&unused) != TCL_OK)
+ return TCL_ERROR;
+
+ return EntryConfigure(interp, recordPtr, mask);
+}
+
+static const Ttk_Ensemble SpinboxCommands[] = {
+ { "bbox", EntryBBoxCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "delete", EntryDeleteCommand,0 },
+ { "get", EntryGetCommand,0 },
+ { "icursor", EntryICursorCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "index", EntryIndexCommand,0 },
+ { "insert", EntryInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "selection", 0,EntrySelectionCommands },
+ { "state", TtkWidgetStateCommand,0 },
+ { "set", EntrySetCommand,0 },
+ { "validate", EntryValidateCommand,0 },
+ { "xview", EntryXViewCommand,0 },
+ { 0,0,0 }
+};
+
+static WidgetSpec SpinboxWidgetSpec = {
+ "TSpinbox", /* className */
+ sizeof(Spinbox), /* recordSize */
+ SpinboxOptionSpecs, /* optionSpecs */
+ SpinboxCommands, /* subcommands */
+ SpinboxInitialize, /* initializeProc */
+ EntryCleanup, /* cleanupProc */
+ SpinboxConfigure, /* configureProc */
+ EntryPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ EntryDoLayout, /* layoutProc */
+ EntryDisplay /* displayProc */
+};
+
+/*------------------------------------------------------------------------
+ * +++ Textarea element.
+ *
+ * Text display area for Entry widgets.
+ * Just computes requested size; display is handled by the widget itself.
+ */
+
+typedef struct {
+ Tcl_Obj *fontObj;
+ Tcl_Obj *widthObj;
+} TextareaElement;
+
+static Ttk_ElementOptionSpec TextareaElementOptions[] = {
+ { "-font", TK_OPTION_FONT,
+ Tk_Offset(TextareaElement,fontObj), DEF_ENTRY_FONT },
+ { "-width", TK_OPTION_INT,
+ Tk_Offset(TextareaElement,widthObj), "20" },
+ { NULL, 0, 0, NULL }
+};
+
+static void TextareaElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TextareaElement *textarea = elementRecord;
+ Tk_Font font = Tk_GetFontFromObj(tkwin, textarea->fontObj);
+ int avgWidth = Tk_TextWidth(font, "0", 1);
+ Tk_FontMetrics fm;
+ int prefWidth = 1;
+
+ Tk_GetFontMetrics(font, &fm);
+ Tcl_GetIntFromObj(NULL, textarea->widthObj, &prefWidth);
+ if (prefWidth <= 0)
+ prefWidth = 1;
+
+ *heightPtr = fm.linespace;
+ *widthPtr = prefWidth * avgWidth;
+}
+
+static Ttk_ElementSpec TextareaElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TextareaElement),
+ TextareaElementOptions,
+ TextareaElementSize,
+ TtkNullElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget layouts.
+ */
+
+TTK_BEGIN_LAYOUT(EntryLayout)
+ TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
+ TTK_NODE("Entry.textarea", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(ComboboxLayout)
+ TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
+ TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
+ TTK_GROUP("Combobox.padding", TTK_FILL_BOTH|TTK_PACK_LEFT|TTK_EXPAND,
+ TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(SpinboxLayout)
+ TTK_GROUP("Spinbox.field", TTK_PACK_TOP|TTK_FILL_X,
+ TTK_GROUP("null", TTK_PACK_RIGHT,
+ TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E)
+ TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E))
+ TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH,
+ TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+MODULE_SCOPE
+void TtkEntry_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterElement(interp, themePtr, "textarea", &TextareaElementSpec, 0);
+
+ Ttk_RegisterLayout(themePtr, "TEntry", EntryLayout);
+ Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout);
+ Ttk_RegisterLayout(themePtr, "TSpinbox", SpinboxLayout);
+
+ RegisterWidget(interp, "ttk::entry", &EntryWidgetSpec);
+ RegisterWidget(interp, "ttk::combobox", &ComboboxWidgetSpec);
+ RegisterWidget(interp, "ttk::spinbox", &SpinboxWidgetSpec);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
new file mode 100644
index 0000000..7860024
--- /dev/null
+++ b/generic/ttk/ttkFrame.c
@@ -0,0 +1,654 @@
+/*
+ * Copyright (c) 2004, Joe English
+ *
+ * ttk::frame and ttk::labelframe widgets.
+ */
+
+#include <tk.h>
+
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+#include "ttkManager.h"
+
+/* ======================================================================
+ * +++ Frame widget:
+ */
+
+typedef struct {
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *paddingObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *widthObj;
+ Tcl_Obj *heightObj;
+} FramePart;
+
+typedef struct {
+ WidgetCore core;
+ FramePart frame;
+} Frame;
+
+static Tk_OptionSpec FrameOptionSpecs[] = {
+ {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL,
+ Tk_Offset(Frame,frame.borderWidthObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL,
+ Tk_Offset(Frame,frame.paddingObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL,
+ Tk_Offset(Frame,frame.reliefObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_PIXELS, "-width", "width", "Width", "0",
+ Tk_Offset(Frame,frame.widthObj), -1,
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_PIXELS, "-height", "height", "Height", "0",
+ Tk_Offset(Frame,frame.heightObj), -1,
+ 0,0,GEOMETRY_CHANGED },
+
+ WIDGET_TAKEFOCUS_FALSE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+static const Ttk_Ensemble FrameCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { 0,0,0 }
+};
+
+/*
+ * FrameMargins --
+ * Compute internal margins for a frame widget.
+ * This includes the -borderWidth, plus any additional -padding.
+ */
+static Ttk_Padding FrameMargins(Frame *framePtr)
+{
+ Ttk_Padding margins = Ttk_UniformPadding(0);
+
+ /* Check -padding:
+ */
+ if (framePtr->frame.paddingObj) {
+ Ttk_GetPaddingFromObj(NULL,
+ framePtr->core.tkwin, framePtr->frame.paddingObj, &margins);
+ }
+
+ /* Add padding for border:
+ */
+ if (framePtr->frame.borderWidthObj) {
+ int border = 0;
+ Tk_GetPixelsFromObj(NULL,
+ framePtr->core.tkwin, framePtr->frame.borderWidthObj, &border);
+ margins = Ttk_AddPadding(margins, Ttk_UniformPadding((short)border));
+ }
+
+ return margins;
+}
+
+/* FrameSize procedure --
+ * The frame doesn't request a size of its own by default,
+ * but it does have an internal border. See also <<NOTE-SIZE>>
+ */
+static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr)
+{
+ Frame *framePtr = recordPtr;
+ Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr));
+ return 0;
+}
+
+/*
+ * FrameConfigure -- configure hook.
+ * <<NOTE-SIZE>> Usually the size of a frame is controlled by
+ * a geometry manager (pack, grid); the -width and -height
+ * options are only effective if geometry propagation is turned
+ * off or if the [place] GM is used for child widgets.
+ *
+ * To avoid geometry blinking, we issue a geometry request
+ * in the Configure hook instead of the Size hook, and only
+ * if -width and/or -height is nonzero and one of them
+ * or the other size-related options (-borderwidth, -padding)
+ * has been changed.
+ */
+
+static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Frame *framePtr = recordPtr;
+ int width, height;
+
+ /*
+ * Make sure -padding resource, if present, is correct:
+ */
+ if (framePtr->frame.paddingObj) {
+ Ttk_Padding unused;
+ if (Ttk_GetPaddingFromObj(interp,
+ framePtr->core.tkwin,
+ framePtr->frame.paddingObj,
+ &unused) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+
+ /* See <<NOTE-SIZE>>
+ */
+ if ( TCL_OK != Tk_GetPixelsFromObj(
+ interp,framePtr->core.tkwin,framePtr->frame.widthObj,&width)
+ || TCL_OK != Tk_GetPixelsFromObj(
+ interp,framePtr->core.tkwin,framePtr->frame.heightObj,&height)
+ )
+ {
+ return TCL_ERROR;
+ }
+
+ if ((width > 0 || height > 0) && (mask & GEOMETRY_CHANGED)) {
+ Tk_GeometryRequest(framePtr->core.tkwin, width, height);
+ }
+
+ return TtkCoreConfigure(interp, recordPtr, mask);
+}
+
+static WidgetSpec FrameWidgetSpec = {
+ "TFrame", /* className */
+ sizeof(Frame), /* recordSize */
+ FrameOptionSpecs, /* optionSpecs */
+ FrameCommands, /* subcommands */
+ TtkNullInitialize, /* initializeProc */
+ TtkNullCleanup, /* cleanupProc */
+ FrameConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ FrameSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(FrameLayout)
+ TTK_NODE("Frame.border", TTK_FILL_BOTH)
+TTK_END_LAYOUT
+
+/* ======================================================================
+ * +++ Labelframe widget:
+ */
+
+#define DEFAULT_LABELINSET 8
+#define DEFAULT_BORDERWIDTH 2
+
+int TtkGetLabelAnchorFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_PositionSpec *anchorPtr)
+{
+ const char *string = Tcl_GetString(objPtr);
+ char c = *string++;
+ Ttk_PositionSpec flags = 0;
+
+ /* First character determines side:
+ */
+ switch (c) {
+ case 'w' : flags = TTK_PACK_LEFT; break;
+ case 'e' : flags = TTK_PACK_RIGHT; break;
+ case 'n' : flags = TTK_PACK_TOP; break;
+ case 's' : flags = TTK_PACK_BOTTOM; break;
+ default : goto error;
+ }
+
+ /* Remaining characters are as per -sticky:
+ */
+ while ((c = *string++) != '\0') {
+ switch (c) {
+ case 'w' : flags |= TTK_STICK_W; break;
+ case 'e' : flags |= TTK_STICK_E; break;
+ case 'n' : flags |= TTK_STICK_N; break;
+ case 's' : flags |= TTK_STICK_S; break;
+ default : goto error;
+ }
+ }
+
+ *anchorPtr = flags;
+ return TCL_OK;
+
+error:
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Bad label anchor specification ", Tcl_GetString(objPtr),
+ NULL);
+ }
+ return TCL_ERROR;
+}
+
+/* LabelAnchorSide --
+ * Returns the side corresponding to a LabelAnchor value.
+ */
+static Ttk_Side LabelAnchorSide(Ttk_PositionSpec flags)
+{
+ if (flags & TTK_PACK_LEFT) return TTK_SIDE_LEFT;
+ else if (flags & TTK_PACK_RIGHT) return TTK_SIDE_RIGHT;
+ else if (flags & TTK_PACK_TOP) return TTK_SIDE_TOP;
+ else if (flags & TTK_PACK_BOTTOM) return TTK_SIDE_BOTTOM;
+ /*NOTREACHED*/
+ return TTK_SIDE_TOP;
+}
+
+/*
+ * Labelframe widget record:
+ */
+typedef struct {
+ Tcl_Obj *labelAnchorObj;
+ Tcl_Obj *textObj;
+ Tcl_Obj *underlineObj;
+ Tk_Window labelWidget;
+
+ Ttk_Manager *mgr;
+ Ttk_Layout labelLayout; /* Sublayout for label */
+ Ttk_Box labelParcel; /* Set in layoutProc */
+} LabelframePart;
+
+typedef struct {
+ WidgetCore core;
+ FramePart frame;
+ LabelframePart label;
+} Labelframe;
+
+#define LABELWIDGET_CHANGED 0x100
+
+static Tk_OptionSpec LabelframeOptionSpecs[] = {
+ {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor",
+ "nw", Tk_Offset(Labelframe, label.labelAnchorObj),-1,
+ 0,0,GEOMETRY_CHANGED},
+ {TK_OPTION_STRING, "-text", "text", "Text", "",
+ Tk_Offset(Labelframe,label.textObj), -1,
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_INT, "-underline", "underline", "Underline",
+ "-1", Tk_Offset(Labelframe,label.underlineObj), -1,
+ 0,0,0 },
+ {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL,
+ -1, Tk_Offset(Labelframe,label.labelWidget),
+ TK_OPTION_NULL_OK,0,LABELWIDGET_CHANGED|GEOMETRY_CHANGED },
+
+ WIDGET_INHERIT_OPTIONS(FrameOptionSpecs)
+};
+
+/*
+ * Labelframe style parameters:
+ */
+typedef struct {
+ int borderWidth; /* border width */
+ Ttk_Padding padding; /* internal padding */
+ Ttk_PositionSpec labelAnchor; /* corner/side to place label */
+ Ttk_Padding labelMargins; /* extra space around label */
+ int labelOutside; /* true=>place label outside border */
+} LabelframeStyle;
+
+static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style)
+{
+ Ttk_Layout layout = lf->core.layout;
+ Tcl_Obj *objPtr;
+
+ style->borderWidth = DEFAULT_BORDERWIDTH;
+ style->padding = Ttk_UniformPadding(0);
+ style->labelAnchor = TTK_PACK_TOP | TTK_STICK_W;
+ style->labelOutside = 0;
+
+ if ((objPtr = Ttk_QueryOption(layout, "-borderwidth", 0)) != NULL) {
+ Tk_GetPixelsFromObj(NULL, lf->core.tkwin, objPtr, &style->borderWidth);
+ }
+ if ((objPtr = Ttk_QueryOption(layout, "-padding", 0)) != NULL) {
+ Ttk_GetPaddingFromObj(NULL, lf->core.tkwin, objPtr, &style->padding);
+ }
+ if ((objPtr = Ttk_QueryOption(layout,"-labelanchor", 0)) != NULL) {
+ TtkGetLabelAnchorFromObj(NULL, objPtr, &style->labelAnchor);
+ }
+ if ((objPtr = Ttk_QueryOption(layout,"-labelmargins", 0)) != NULL) {
+ Ttk_GetBorderFromObj(NULL, objPtr, &style->labelMargins);
+ } else {
+ if (style->labelAnchor & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) {
+ style->labelMargins =
+ Ttk_MakePadding(DEFAULT_LABELINSET,0,DEFAULT_LABELINSET,0);
+ } else {
+ style->labelMargins =
+ Ttk_MakePadding(0,DEFAULT_LABELINSET,0,DEFAULT_LABELINSET);
+ }
+ }
+ if ((objPtr = Ttk_QueryOption(layout,"-labeloutside", 0)) != NULL) {
+ Tcl_GetBooleanFromObj(NULL, objPtr, &style->labelOutside);
+ }
+
+ return;
+}
+
+/* LabelframeLabelSize --
+ * Extract the requested width and height of the labelframe's label:
+ * taken from the label widget if specified, otherwise the text label.
+ */
+static void
+LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr)
+{
+ Tk_Window labelWidget = lframePtr->label.labelWidget;
+ Ttk_Layout labelLayout = lframePtr->label.labelLayout;
+
+ if (labelWidget) {
+ *widthPtr = Tk_ReqWidth(labelWidget);
+ *heightPtr = Tk_ReqHeight(labelWidget);
+ } else if (labelLayout) {
+ Ttk_LayoutSize(labelLayout, 0, widthPtr, heightPtr);
+ } else {
+ *widthPtr = *heightPtr = 0;
+ }
+}
+
+/*
+ * LabelframeSize --
+ * Like the frame, this doesn't request a size of its own
+ * but it does have internal padding and a minimum size.
+ */
+static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr)
+{
+ Labelframe *lframePtr = recordPtr;
+ WidgetCore *corePtr = &lframePtr->core;
+ Ttk_Padding margins;
+ LabelframeStyle style;
+ int labelWidth, labelHeight;
+
+ LabelframeStyleOptions(lframePtr, &style);
+
+ /* Compute base margins (See also: FrameMargins)
+ */
+ margins = Ttk_AddPadding(
+ style.padding, Ttk_UniformPadding((short)style.borderWidth));
+
+ /* Adjust margins based on label size and position:
+ */
+ LabelframeLabelSize(lframePtr, &labelWidth, &labelHeight);
+ labelWidth += Ttk_PaddingWidth(style.labelMargins);
+ labelHeight += Ttk_PaddingHeight(style.labelMargins);
+
+ switch (LabelAnchorSide(style.labelAnchor)) {
+ case TTK_SIDE_LEFT: margins.left += labelWidth; break;
+ case TTK_SIDE_RIGHT: margins.right += labelWidth; break;
+ case TTK_SIDE_TOP: margins.top += labelHeight; break;
+ case TTK_SIDE_BOTTOM: margins.bottom += labelHeight; break;
+ }
+
+ Ttk_SetMargins(corePtr->tkwin,margins);
+
+ /* Request minimum size based on border width and label size:
+ */
+ Tk_SetMinimumRequestSize(corePtr->tkwin,
+ labelWidth + 2*style.borderWidth,
+ labelHeight + 2*style.borderWidth);
+
+ return 0;
+}
+
+/*
+ * LabelframeGetLayout --
+ * Getlayout widget hook.
+ */
+
+static Ttk_Layout LabelframeGetLayout(
+ Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
+{
+ Labelframe *lf = recordPtr;
+ Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr);
+ Ttk_Layout labelLayout;
+
+ if (!frameLayout) {
+ return NULL;
+ }
+
+ labelLayout = Ttk_CreateSublayout(
+ interp, theme, frameLayout, ".Label", lf->core.optionTable);
+
+ if (labelLayout) {
+ if (lf->label.labelLayout) {
+ Ttk_FreeLayout(lf->label.labelLayout);
+ }
+ Ttk_RebindSublayout(labelLayout, recordPtr);
+ lf->label.labelLayout = labelLayout;
+ }
+
+ return frameLayout;
+}
+
+/*
+ * LabelframeDoLayout --
+ * Labelframe layout hook.
+ *
+ * Side effects: Computes labelParcel.
+ */
+
+static void LabelframeDoLayout(void *recordPtr)
+{
+ Labelframe *lframePtr = recordPtr;
+ WidgetCore *corePtr = &lframePtr->core;
+ int lw, lh; /* Label width and height */
+ LabelframeStyle style;
+ Ttk_Box borderParcel = Ttk_WinBox(lframePtr->core.tkwin);
+ Ttk_Box labelParcel;
+
+ /*
+ * Compute label parcel:
+ */
+ LabelframeStyleOptions(lframePtr, &style);
+ LabelframeLabelSize(lframePtr, &lw, &lh);
+ lw += Ttk_PaddingWidth(style.labelMargins);
+ lh += Ttk_PaddingHeight(style.labelMargins);
+
+ labelParcel = Ttk_PadBox(
+ Ttk_PositionBox(&borderParcel, lw, lh, style.labelAnchor),
+ style.labelMargins);
+
+ if (!style.labelOutside) {
+ /* Move border edge so it's over label:
+ */
+ switch (LabelAnchorSide(style.labelAnchor)) {
+ case TTK_SIDE_LEFT: borderParcel.x -= lw / 2;
+ case TTK_SIDE_RIGHT: borderParcel.width += lw/2; break;
+ case TTK_SIDE_TOP: borderParcel.y -= lh / 2;
+ case TTK_SIDE_BOTTOM: borderParcel.height += lh / 2; break;
+ }
+ }
+
+ /*
+ * Place border and label:
+ */
+ Ttk_PlaceLayout(corePtr->layout, corePtr->state, borderParcel);
+ if (lframePtr->label.labelLayout) {
+ Ttk_PlaceLayout(
+ lframePtr->label.labelLayout, corePtr->state, labelParcel);
+ }
+ /* labelWidget placed in LabelframePlaceSlaves GM hook */
+ lframePtr->label.labelParcel = labelParcel;
+}
+
+static void LabelframeDisplay(void *recordPtr, Drawable d)
+{
+ Labelframe *lframePtr = recordPtr;
+ Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d);
+ if (lframePtr->label.labelLayout) {
+ Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d);
+ }
+}
+
+/* +++ Labelframe geometry manager hooks.
+ */
+
+/* LabelframePlaceSlaves --
+ * Sets the position and size of the labelwidget.
+ */
+static void LabelframePlaceSlaves(void *recordPtr)
+{
+ Labelframe *lframe = recordPtr;
+
+ if (Ttk_NumberSlaves(lframe->label.mgr) == 1) {
+ Ttk_Box b;
+ LabelframeDoLayout(recordPtr);
+ b = lframe->label.labelParcel;
+ /* ASSERT: slave #0 is lframe->label.labelWidget */
+ Ttk_PlaceSlave(lframe->label.mgr, 0, b.x,b.y,b.width,b.height);
+ }
+}
+
+static int LabelRequest(void *managerData, int index, int width, int height)
+{
+ return 1;
+}
+
+/* LabelRemoved --
+ * Unset the -labelwidget option.
+ *
+ * <<NOTE-LABELREMOVED>>:
+ * This routine is also called when the widget voluntarily forgets
+ * the slave in LabelframeConfigure.
+ */
+static void LabelRemoved(void *managerData, int slaveIndex)
+{
+ Labelframe *lframe = managerData;
+ lframe->label.labelWidget = 0;
+}
+
+static Ttk_ManagerSpec LabelframeManagerSpec = {
+ { "labelframe", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ LabelframeSize,
+ LabelframePlaceSlaves,
+ LabelRequest,
+ LabelRemoved
+};
+
+/* LabelframeInitialize --
+ * Initialization hook.
+ */
+static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Labelframe *lframe = recordPtr;
+
+ lframe->label.mgr = Ttk_CreateManager(
+ &LabelframeManagerSpec, lframe, lframe->core.tkwin);
+ lframe->label.labelWidget = 0;
+ lframe->label.labelLayout = 0;
+ lframe->label.labelParcel = Ttk_MakeBox(-1,-1,-1,-1);
+}
+
+/* LabelframeCleanup --
+ * Cleanup hook.
+ */
+static void LabelframeCleanup(void *recordPtr)
+{
+ Labelframe *lframe = recordPtr;
+ Ttk_DeleteManager(lframe->label.mgr);
+ if (lframe->label.labelLayout) {
+ Ttk_FreeLayout(lframe->label.labelLayout);
+ }
+}
+
+/* RaiseLabelWidget --
+ * Raise the -labelwidget to ensure that the labelframe doesn't
+ * obscure it (if it's not a direct child), or bring it to
+ * the top of the stacking order (if it is).
+ */
+static void RaiseLabelWidget(Labelframe *lframe)
+{
+ Tk_Window parent = Tk_Parent(lframe->label.labelWidget);
+ Tk_Window sibling = NULL;
+ Tk_Window w = lframe->core.tkwin;
+
+ while (w && w != parent) {
+ sibling = w;
+ w = Tk_Parent(w);
+ }
+
+ Tk_RestackWindow(lframe->label.labelWidget, Above, sibling);
+}
+
+/* LabelframeConfigure --
+ * Configuration hook.
+ */
+static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask)
+{
+ Labelframe *lframePtr = recordPtr;
+ Tk_Window labelWidget = lframePtr->label.labelWidget;
+ Ttk_PositionSpec unused;
+
+ /* Validate options:
+ */
+ if (mask & LABELWIDGET_CHANGED && labelWidget != NULL) {
+ if (!Ttk_Maintainable(interp, labelWidget, lframePtr->core.tkwin)) {
+ return TCL_ERROR;
+ }
+ }
+
+ if (TtkGetLabelAnchorFromObj(
+ interp, lframePtr->label.labelAnchorObj, &unused) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ /* Base class configuration:
+ */
+ if (FrameConfigure(interp, recordPtr, mask) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /* Update -labelwidget changes, if any:
+ */
+ if (mask & LABELWIDGET_CHANGED) {
+ if (Ttk_NumberSlaves(lframePtr->label.mgr) == 1) {
+ Ttk_ForgetSlave(lframePtr->label.mgr, 0);
+ /* Restore labelWidget field (see <<NOTE-LABELREMOVED>>)
+ */
+ lframePtr->label.labelWidget = labelWidget;
+ }
+
+ if (labelWidget) {
+ Ttk_InsertSlave(lframePtr->label.mgr, 0, labelWidget, NULL);
+ RaiseLabelWidget(lframePtr);
+ }
+ }
+
+ if (mask & GEOMETRY_CHANGED) {
+ Ttk_ManagerSizeChanged(lframePtr->label.mgr);
+ Ttk_ManagerLayoutChanged(lframePtr->label.mgr);
+ }
+
+ return TCL_OK;
+}
+
+static WidgetSpec LabelframeWidgetSpec = {
+ "TLabelframe", /* className */
+ sizeof(Labelframe), /* recordSize */
+ LabelframeOptionSpecs, /* optionSpecs */
+ FrameCommands, /* subcommands */
+ LabelframeInitialize, /* initializeProc */
+ LabelframeCleanup, /* cleanupProc */
+ LabelframeConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ LabelframeGetLayout, /* getLayoutProc */
+ LabelframeSize, /* sizeProc */
+ LabelframeDoLayout, /* layoutProc */
+ LabelframeDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(LabelframeLayout)
+ TTK_NODE("Labelframe.border", TTK_FILL_BOTH)
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(LabelSublayout)
+ TTK_GROUP("Label.fill", TTK_FILL_BOTH,
+ TTK_NODE("Label.text", TTK_FILL_BOTH))
+TTK_END_LAYOUT
+
+/* ======================================================================
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkFrame_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(theme, "TFrame", FrameLayout);
+ Ttk_RegisterLayout(theme, "TLabelframe", LabelframeLayout);
+ Ttk_RegisterLayout(theme, "Label", LabelSublayout);
+
+ RegisterWidget(interp, "ttk::frame", &FrameWidgetSpec);
+ RegisterWidget(interp, "ttk::labelframe", &LabelframeWidgetSpec);
+}
+
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
new file mode 100644
index 0000000..fb9c018
--- /dev/null
+++ b/generic/ttk/ttkGenStubs.tcl
@@ -0,0 +1,920 @@
+# ttkGenStubs.tcl --
+#
+# This script generates a set of stub files for a given
+# interface.
+#
+#
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# SOURCE: tcl/tools/genStubs.tcl, revision 1.20
+#
+# CHANGES:
+# + Remove xxx_TCL_DECLARED #ifdeffery
+# + Use application-defined storage class specifier instead of "EXTERN"
+# + Add "epoch" and "revision" fields to stubs table record
+# + Remove dead code related to USE_*_STUB_PROCS (emitStubs, makeStub)
+# + Second argument to "declare" is used as a status guard
+# instead of a platform guard.
+# + Use void (*reserved$i)(void) = 0 instead of void *reserved$i = NULL
+# for unused stub entries, in case pointer-to-function and
+# pointer-to-object are different sizes.
+# + Allow trailing semicolon in function declarations
+# + stubs table is const-qualified
+#
+
+package require Tcl 8
+
+namespace eval genStubs {
+ # libraryName --
+ #
+ # The name of the entire library. This value is used to compute
+ # the USE_*_STUBS macro and the name of the init file.
+
+ variable libraryName "UNKNOWN"
+
+ # interfaces --
+ #
+ # An array indexed by interface name that is used to maintain
+ # the set of valid interfaces. The value is empty.
+
+ array set interfaces {}
+
+ # curName --
+ #
+ # The name of the interface currently being defined.
+
+ variable curName "UNKNOWN"
+
+ # scspec --
+ #
+ # Storage class specifier for external function declarations.
+ # Normally "extern", may be set to something like XYZAPI
+ #
+ variable scspec "extern"
+
+ # epoch, revision --
+ #
+ # The epoch and revision numbers of the interface currently being defined.
+ # (@@@TODO: should be an array mapping interface names -> numbers)
+ #
+
+ variable epoch 0
+ variable revision 0
+
+ # hooks --
+ #
+ # An array indexed by interface name that contains the set of
+ # subinterfaces that should be defined for a given interface.
+
+ array set hooks {}
+
+ # stubs --
+ #
+ # This three dimensional array is indexed first by interface name,
+ # second by field name, and third by a numeric offset or the
+ # constant "lastNum". The lastNum entry contains the largest
+ # numeric offset used for a given interface.
+ #
+ # Field "decl,$i" contains the C function specification that
+ # should be used for the given entry in the stub table. The spec
+ # consists of a list in the form returned by parseDecl.
+ # Other fields TBD later.
+
+ array set stubs {}
+
+ # outDir --
+ #
+ # The directory where the generated files should be placed.
+
+ variable outDir .
+}
+
+# genStubs::library --
+#
+# This function is used in the declarations file to set the name
+# of the library that the interfaces are associated with (e.g. "tcl").
+# This value will be used to define the inline conditional macro.
+#
+# Arguments:
+# name The library name.
+#
+# Results:
+# None.
+
+proc genStubs::library {name} {
+ variable libraryName $name
+}
+
+# genStubs::interface --
+#
+# This function is used in the declarations file to set the name
+# of the interface currently being defined.
+#
+# Arguments:
+# name The name of the interface.
+#
+# Results:
+# None.
+
+proc genStubs::interface {name} {
+ variable curName $name
+ variable interfaces
+ variable stubs
+
+ set interfaces($name) {}
+ set stubs($name,lastNum) 0
+ return
+}
+
+# genStubs::scspec --
+#
+# Define the storage class macro used for external function declarations.
+# Typically, this will be a macro like XYZAPI or EXTERN that
+# expands to either DLLIMPORT or DLLEXPORT, depending on whether
+# -DBUILD_XYZ has been set.
+#
+proc genStubs::scspec {value} {
+ variable scspec $value
+}
+
+# genStubs::epoch --
+#
+# Define the epoch number for this library. The epoch
+# should be incrememented when a release is made that
+# contains incompatible changes to the public API.
+#
+proc genStubs::epoch {value} {
+ variable epoch $value
+}
+
+# genStubs::hooks --
+#
+# This function defines the subinterface hooks for the current
+# interface.
+#
+# Arguments:
+# names The ordered list of interfaces that are reachable through the
+# hook vector.
+#
+# Results:
+# None.
+
+proc genStubs::hooks {names} {
+ variable curName
+ variable hooks
+
+ set hooks($curName) $names
+ return
+}
+
+# genStubs::declare --
+#
+# This function is used in the declarations file to declare a new
+# interface entry.
+#
+# Arguments:
+# index The index number of the interface.
+# status Status of the interface: one of "current",
+# "deprecated", or "obsolete".
+# decl The C function declaration, or {} for an undefined
+# entry.
+#
+proc genStubs::declare {args} {
+ variable stubs
+ variable curName
+ variable revision
+
+ incr revision
+
+ if {[llength $args] == 2} {
+ lassign $args index decl
+ set status current
+ } elseif {[llength $args] == 3} {
+ lassign $args index status decl
+ } else {
+ puts stderr "wrong # args: declare $args"
+ return
+ }
+
+ # Check for duplicate declarations, then add the declaration and
+ # bump the lastNum counter if necessary.
+
+ if {[info exists stubs($curName,decl,$index)]} {
+ puts stderr "Duplicate entry: $index"
+ }
+ regsub -all const $decl CONST decl
+ regsub -all "\[ \t\n\]+" [string trim $decl] " " decl
+ set decl [parseDecl $decl]
+
+ set stubs($curName,status,$index) $status
+ set stubs($curName,decl,$index) $decl
+
+ if {$index > $stubs($curName,lastNum)} {
+ set stubs($curName,lastNum) $index
+ }
+
+ return
+}
+
+# genStubs::rewriteFile --
+#
+# This function replaces the machine generated portion of the
+# specified file with new contents. It looks for the !BEGIN! and
+# !END! comments to determine where to place the new text.
+#
+# Arguments:
+# file The name of the file to modify.
+# text The new text to place in the file.
+#
+# Results:
+# None.
+
+proc genStubs::rewriteFile {file text} {
+ if {![file exists $file]} {
+ puts stderr "Cannot find file: $file"
+ return
+ }
+ set in [open ${file} r]
+ set out [open ${file}.new w]
+
+ while {![eof $in]} {
+ set line [gets $in]
+ if {[string match "*!BEGIN!*" $line]} {
+ break
+ }
+ puts $out $line
+ }
+ puts $out "/* !BEGIN!: Do not edit below this line. */"
+ puts $out $text
+ while {![eof $in]} {
+ set line [gets $in]
+ if {[string match "*!END!*" $line]} {
+ break
+ }
+ }
+ puts $out "/* !END!: Do not edit above this line. */"
+ puts -nonewline $out [read $in]
+ close $in
+ close $out
+ file rename -force ${file}.new ${file}
+ return
+}
+
+# genStubs::addPlatformGuard --
+#
+# Wrap a string inside a platform #ifdef.
+#
+# Arguments:
+# plat Platform to test.
+#
+# Results:
+# Returns the original text inside an appropriate #ifdef.
+
+proc genStubs::addPlatformGuard {plat text} {
+ switch $plat {
+ win {
+ return "#ifdef __WIN32__\n${text}#endif /* __WIN32__ */\n"
+ }
+ unix {
+ return "#if !defined(__WIN32__) /* UNIX */\n${text}#endif /* UNIX */\n"
+ }
+ macosx {
+ return "#ifdef MAC_OSX_TCL\n${text}#endif /* MAC_OSX_TCL */\n"
+ }
+ aqua {
+ return "#ifdef MAC_OSX_TK\n${text}#endif /* MAC_OSX_TK */\n"
+ }
+ x11 {
+ return "#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */\n${text}#endif /* X11 */\n"
+ }
+ }
+ return $text
+}
+
+# genStubs::emitSlots --
+#
+# Generate the stub table slots for the given interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+# textVar The variable to use for output.
+#
+# Results:
+# None.
+
+proc genStubs::emitSlots {name textVar} {
+ upvar $textVar text
+ forAllStubs $name makeSlot noGuard text {" void (*reserved$i)(void);\n"}
+ return
+}
+
+# genStubs::parseDecl --
+#
+# Parse a C function declaration into its component parts.
+#
+# Arguments:
+# decl The function declaration.
+#
+# Results:
+# Returns a list of the form {returnType name args}. The args
+# element consists of a list of type/name pairs, or a single
+# element "void". If the function declaration is malformed
+# then an error is displayed and the return value is {}.
+
+proc genStubs::parseDecl {decl} {
+ if {![regexp {^(.*)\((.*)\);?$} $decl all prefix args]} {
+ set prefix $decl
+ set args {}
+ }
+ set prefix [string trim $prefix]
+ if {![regexp {^(.+[ ][*]*)([^ *]+)$} $prefix all rtype fname]} {
+ puts stderr "Bad return type: $decl"
+ return
+ }
+ set rtype [string trim $rtype]
+ if {$args == ""} {
+ return [list $rtype $fname {}]
+ }
+ foreach arg [split $args ,] {
+ lappend argList [string trim $arg]
+ }
+ if {![string compare [lindex $argList end] "..."]} {
+ set args TCL_VARARGS
+ foreach arg [lrange $argList 0 end-1] {
+ set argInfo [parseArg $arg]
+ if {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
+ lappend args $argInfo
+ } else {
+ puts stderr "Bad argument: '$arg' in '$decl'"
+ return
+ }
+ }
+ } else {
+ set args {}
+ foreach arg $argList {
+ set argInfo [parseArg $arg]
+ if {![string compare $argInfo "void"]} {
+ lappend args "void"
+ break
+ } elseif {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
+ lappend args $argInfo
+ } else {
+ puts stderr "Bad argument: '$arg' in '$decl'"
+ return
+ }
+ }
+ }
+ return [list $rtype $fname $args]
+}
+
+# genStubs::parseArg --
+#
+# This function parses a function argument into a type and name.
+#
+# Arguments:
+# arg The argument to parse.
+#
+# Results:
+# Returns a list of type and name with an optional third array
+# indicator. If the argument is malformed, returns "".
+
+proc genStubs::parseArg {arg} {
+ if {![regexp {^(.+[ ][*]*)([^][ *]+)(\[\])?$} $arg all type name array]} {
+ if {$arg == "void"} {
+ return $arg
+ } else {
+ return
+ }
+ }
+ set result [list [string trim $type] $name]
+ if {$array != ""} {
+ lappend result $array
+ }
+ return $result
+}
+
+# genStubs::makeDecl --
+#
+# Generate the prototype for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted declaration string.
+
+proc genStubs::makeDecl {name decl index} {
+ variable scspec
+
+ lassign $decl rtype fname args
+
+ append text "/* $index */\n"
+ if {$rtype != "void"} {
+ regsub -all void $rtype VOID rtype
+ }
+ set line "$scspec $rtype"
+ set count [expr {2 - ([string length $line] / 8)}]
+ append line [string range "\t\t\t" 0 $count]
+ set pad [expr {24 - [string length $line]}]
+ if {$pad <= 0} {
+ append line " "
+ set pad 0
+ }
+ if {$args == ""} {
+ append line $fname
+ append text $line
+ append text ";\n"
+ return $text
+ }
+ append line $fname
+
+ regsub -all void $args VOID args
+ set arg1 [lindex $args 0]
+ switch -exact $arg1 {
+ VOID {
+ append line "(void)"
+ }
+ TCL_VARARGS {
+ set sep "("
+ foreach arg [lrange $args 1 end] {
+ append line $sep
+ set next {}
+ append next [lindex $arg 0]
+ if {[string index $next end] ne "*"} {
+ append next " "
+ }
+ append next [lindex $arg 1] [lindex $arg 2]
+ if {[string length $line] + [string length $next] \
+ + $pad > 76} {
+ append text [string trimright $line] \n
+ set line "\t\t\t\t"
+ set pad 28
+ }
+ append line $next
+ set sep ", "
+ }
+ append line ", ...)"
+ }
+ default {
+ set sep "("
+ foreach arg $args {
+ append line $sep
+ set next {}
+ append next [lindex $arg 0]
+ if {[string index $next end] ne "*"} {
+ append next " "
+ }
+ append next [lindex $arg 1] [lindex $arg 2]
+ if {[string length $line] + [string length $next] \
+ + $pad > 76} {
+ append text [string trimright $line] \n
+ set line "\t\t\t\t"
+ set pad 28
+ }
+ append line $next
+ set sep ", "
+ }
+ append line ")"
+ }
+ }
+ return "$text$line;\n"
+}
+
+# genStubs::makeMacro --
+#
+# Generate the inline macro for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted macro definition.
+
+proc genStubs::makeMacro {name decl index} {
+ lassign $decl rtype fname args
+
+ set lfname [string tolower [string index $fname 0]]
+ append lfname [string range $fname 1 end]
+
+ set text "#define $fname \\\n\t("
+ if {$args == ""} {
+ append text "*"
+ }
+ append text "${name}StubsPtr->$lfname)"
+ append text " /* $index */\n"
+ return $text
+}
+
+# genStubs::makeSlot --
+#
+# Generate the stub table entry for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted table entry.
+
+proc genStubs::makeSlot {name decl index} {
+ lassign $decl rtype fname args
+
+ set lfname [string tolower [string index $fname 0]]
+ append lfname [string range $fname 1 end]
+
+ set text " "
+ if {$rtype != "void"} {
+ regsub -all void $rtype VOID rtype
+ }
+ if {$args == ""} {
+ append text $rtype " *" $lfname "; /* $index */\n"
+ return $text
+ }
+ append text $rtype " (*" $lfname ") "
+
+ regsub -all void $args VOID args
+ set arg1 [lindex $args 0]
+ switch -exact $arg1 {
+ VOID {
+ append text "(void)"
+ }
+ TCL_VARARGS {
+ set sep "("
+ foreach arg [lrange $args 1 end] {
+ append text $sep [lindex $arg 0]
+ if {[string index $text end] ne "*"} {
+ append text " "
+ }
+ append text [lindex $arg 1] [lindex $arg 2]
+ set sep ", "
+ }
+ append text ", ...)"
+ }
+ default {
+ set sep "("
+ foreach arg $args {
+ append text $sep [lindex $arg 0]
+ if {[string index $text end] ne "*"} {
+ append text " "
+ }
+ append text [lindex $arg 1] [lindex $arg 2]
+ set sep ", "
+ }
+ append text ")"
+ }
+ }
+
+ append text "; /* $index */\n"
+ return $text
+}
+
+# genStubs::makeInit --
+#
+# Generate the prototype for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted declaration string.
+
+proc genStubs::makeInit {name decl index} {
+ if {[lindex $decl 2] == ""} {
+ append text " &" [lindex $decl 1] ", /* " $index " */\n"
+ } else {
+ append text " " [lindex $decl 1] ", /* " $index " */\n"
+ }
+ return $text
+}
+
+# genStubs::forAllStubs --
+#
+# This function iterates over all of the slots and invokes
+# a callback for each slot. The result of the callback is then
+# placed inside appropriate guards.
+#
+# Arguments:
+# name The interface name.
+# slotProc The proc to invoke to handle the slot. It will
+# have the interface name, the declaration, and
+# the index appended.
+# guardProc The proc to invoke to add guards. It will have
+# the slot status and text appended.
+# textVar The variable to use for output.
+# skipString The string to emit if a slot is skipped. This
+# string will be subst'ed in the loop so "$i" can
+# be used to substitute the index value.
+#
+# Results:
+# None.
+
+proc genStubs::forAllStubs {name slotProc guardProc textVar
+ {skipString {"/* Slot $i is reserved */\n"}}} {
+ variable stubs
+ upvar $textVar text
+
+ set lastNum $stubs($name,lastNum)
+
+ for {set i 0} {$i <= $lastNum} {incr i} {
+ if {[info exists stubs($name,decl,$i)]} {
+ append text [$guardProc $stubs($name,status,$i) \
+ [$slotProc $name $stubs($name,decl,$i) $i]]
+ } else {
+ eval {append text} $skipString
+ }
+ }
+}
+
+proc genStubs::noGuard {status text} { return $text }
+
+proc genStubs::addGuard {status text} {
+ variable libraryName
+ set upName [string toupper $libraryName]
+
+ switch -- $status {
+ current {
+ # No change
+ }
+ deprecated {
+ set text [ifdeffed "${upName}_DEPRECATED" $text]
+ }
+ obsolete {
+ set text ""
+ }
+ default {
+ puts stderr "Unrecognized status code $status"
+ }
+ }
+ return $text
+}
+
+proc genStubs::ifdeffed {macro text} {
+ join [list "#ifdef $macro" $text "#endif" ""] \n
+}
+
+# genStubs::emitDeclarations --
+#
+# This function emits the function declarations for this interface.
+#
+# Arguments:
+# name The interface name.
+# textVar The variable to use for output.
+#
+# Results:
+# None.
+
+proc genStubs::emitDeclarations {name textVar} {
+ upvar $textVar text
+
+ append text "\n/*\n * Exported function declarations:\n */\n\n"
+ forAllStubs $name makeDecl noGuard text
+ return
+}
+
+# genStubs::emitMacros --
+#
+# This function emits the inline macros for an interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+# textVar The variable to use for output.
+#
+# Results:
+# None.
+
+proc genStubs::emitMacros {name textVar} {
+ variable libraryName
+ upvar $textVar text
+
+ set upName [string toupper $libraryName]
+ append text "\n#if defined(USE_${upName}_STUBS)\n"
+ append text "\n/*\n * Inline function declarations:\n */\n\n"
+
+ forAllStubs $name makeMacro addGuard text
+
+ append text "\n#endif /* defined(USE_${upName}_STUBS) */\n"
+ return
+}
+
+# genStubs::emitHeader --
+#
+# This function emits the body of the <name>Decls.h file for
+# the specified interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+#
+# Results:
+# None.
+
+proc genStubs::emitHeader {name} {
+ variable outDir
+ variable hooks
+ variable epoch
+ variable revision
+
+ set capName [string toupper [string index $name 0]]
+ append capName [string range $name 1 end]
+
+ set CAPName [string toupper $name]
+ append text "\n"
+ append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
+ append text "#define ${CAPName}_STUBS_REVISION $revision\n"
+
+ emitDeclarations $name text
+
+ if {[info exists hooks($name)]} {
+ append text "\ntypedef struct ${capName}StubHooks {\n"
+ foreach hook $hooks($name) {
+ set capHook [string toupper [string index $hook 0]]
+ append capHook [string range $hook 1 end]
+ append text " const struct ${capHook}Stubs *${hook}Stubs;\n"
+ }
+ append text "} ${capName}StubHooks;\n"
+ }
+ append text "\ntypedef struct ${capName}Stubs {\n"
+ append text " int magic;\n"
+ append text " int epoch;\n"
+ append text " int revision;\n"
+ append text " const struct ${capName}StubHooks *hooks;\n\n"
+
+ emitSlots $name text
+
+ append text "} ${capName}Stubs;\n\n"
+
+ append text "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
+ append text "extern const ${capName}Stubs *${name}StubsPtr;\n"
+ append text "#ifdef __cplusplus\n}\n#endif\n"
+
+ emitMacros $name text
+
+ rewriteFile [file join $outDir ${name}Decls.h] $text
+ return
+}
+
+# genStubs::emitInit --
+#
+# Generate the table initializers for an interface.
+#
+# Arguments:
+# name The name of the interface to initialize.
+# textVar The variable to use for output.
+#
+# Results:
+# Returns the formatted output.
+
+proc genStubs::emitInit {name textVar} {
+ variable hooks
+ variable interfaces
+ variable epoch
+ variable revision
+
+ upvar $textVar text
+ set root 1
+
+ set capName [string toupper [string index $name 0]]
+ append capName [string range $name 1 end]
+ set CAPName [string toupper $name]
+
+ if {[info exists hooks($name)]} {
+ append text "\nstatic const ${capName}StubHooks ${name}StubHooks = \{\n"
+ set sep " "
+ foreach sub $hooks($name) {
+ append text $sep "&${sub}Stubs"
+ set sep ",\n "
+ }
+ append text "\n\};\n"
+ }
+ foreach intf [array names interfaces] {
+ if {[info exists hooks($intf)]} {
+ if {0<=[lsearch -exact $hooks($intf) $name]} {
+ set root 0
+ break;
+ }
+ }
+ }
+
+ if {$root} {
+ append text "\nconst ${capName}Stubs ${name}Stubs = \{\n"
+ } else {
+ append text "\nstatic const ${capName}Stubs ${name}Stubs = \{\n"
+ }
+ append text " TCL_STUB_MAGIC,\n"
+ append text " ${CAPName}_STUBS_EPOCH,\n"
+ append text " ${CAPName}_STUBS_REVISION,\n"
+ if {[info exists hooks($name)]} {
+ append text " &${name}StubHooks,\n"
+ } else {
+ append text " 0,\n"
+ }
+
+ forAllStubs $name makeInit noGuard text {" 0, /* $i */\n"}
+
+ append text "\};\n"
+ return
+}
+
+# genStubs::emitInits --
+#
+# This function emits the body of the <name>StubInit.c file for
+# the specified interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+#
+# Results:
+# None.
+
+proc genStubs::emitInits {} {
+ variable hooks
+ variable outDir
+ variable libraryName
+ variable interfaces
+
+ # Assuming that dependencies only go one level deep, we need to emit
+ # all of the leaves first to avoid needing forward declarations.
+
+ set leaves {}
+ set roots {}
+ foreach name [lsort [array names interfaces]] {
+ if {[info exists hooks($name)]} {
+ lappend roots $name
+ } else {
+ lappend leaves $name
+ }
+ }
+ foreach name $leaves {
+ emitInit $name text
+ }
+ foreach name $roots {
+ emitInit $name text
+ }
+
+ rewriteFile [file join $outDir ${libraryName}StubInit.c] $text
+}
+
+# genStubs::init --
+#
+# This is the main entry point.
+#
+# Arguments:
+# None.
+#
+# Results:
+# None.
+
+proc genStubs::init {} {
+ global argv argv0
+ variable outDir
+ variable interfaces
+
+ if {[llength $argv] < 2} {
+ puts stderr "usage: $argv0 outDir declFile ?declFile...?"
+ exit 1
+ }
+
+ set outDir [lindex $argv 0]
+
+ foreach file [lrange $argv 1 end] {
+ source $file
+ }
+
+ foreach name [lsort [array names interfaces]] {
+ puts "Emitting $name"
+ emitHeader $name
+ }
+
+ emitInits
+}
+
+# lassign --
+#
+# This function emulates the TclX lassign command.
+#
+# Arguments:
+# valueList A list containing the values to be assigned.
+# args The list of variables to be assigned.
+#
+# Results:
+# Returns any values that were not assigned to variables.
+
+if {[string length [namespace which lassign]] == 0} {
+ proc lassign {valueList args} {
+ if {[llength $args] == 0} {
+ error "wrong # args: should be \"lassign list varName ?varName ...?\""
+ }
+ uplevel [list foreach $args $valueList {break}]
+ return [lrange $valueList [llength $args] end]
+ }
+}
+
+genStubs::init
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
new file mode 100644
index 0000000..c3b55e9
--- /dev/null
+++ b/generic/ttk/ttkImage.c
@@ -0,0 +1,415 @@
+/*
+ * Image specifications and image element factory.
+ *
+ * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
+ * Copyright (C) 2004 Joe English
+ *
+ * An imageSpec is a multi-element list; the first element
+ * is the name of the default image to use, the remainder of the
+ * list is a sequence of statespec/imagename options as per
+ * [style map].
+ */
+
+#include <string.h>
+#include <tk.h>
+#include "ttkTheme.h"
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+/*------------------------------------------------------------------------
+ * +++ ImageSpec management.
+ */
+
+struct TtkImageSpec {
+ Tk_Image baseImage; /* Base image to use */
+ int mapCount; /* #state-specific overrides */
+ Ttk_StateSpec *states; /* array[mapCount] of states ... */
+ Tk_Image *images; /* ... per-state images to use */
+};
+
+/* NullImageChanged --
+ * Do-nothing Tk_ImageChangedProc.
+ */
+static void NullImageChanged(ClientData clientData,
+ int x, int y, int width, int height, int imageWidth, int imageHeight)
+{ /* No-op */ }
+
+/* TtkGetImageSpec --
+ * Constructs a Ttk_ImageSpec * from a Tcl_Obj *.
+ * Result must be released using TtkFreeImageSpec.
+ *
+ * TODO: Need a variant of this that takes a user-specified ImageChanged proc
+ */
+Ttk_ImageSpec *
+TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr)
+{
+ Ttk_ImageSpec *imageSpec = 0;
+ int i = 0, n = 0, objc;
+ Tcl_Obj **objv;
+
+ imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec));
+ imageSpec->baseImage = 0;
+ imageSpec->mapCount = 0;
+ imageSpec->states = 0;
+ imageSpec->images = 0;
+
+ if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
+ goto error;
+ }
+
+ if ((objc % 2) != 1) {
+ if (interp) {
+ Tcl_SetResult(interp,
+ "image specification must contain an odd number of elements",
+ TCL_STATIC);
+ }
+ goto error;
+ }
+
+ n = (objc - 1) / 2;
+ imageSpec->states = (Ttk_StateSpec*)ckalloc(n * sizeof(Ttk_StateSpec));
+ imageSpec->images = (Tk_Image*)ckalloc(n * sizeof(Tk_Image *));
+
+ /* Get base image:
+ */
+ imageSpec->baseImage = Tk_GetImage(
+ interp, tkwin, Tcl_GetString(objv[0]), NullImageChanged, NULL);
+ if (!imageSpec->baseImage) {
+ goto error;
+ }
+
+ /* Extract state and image specifications:
+ */
+ for (i = 0; i < n; ++i) {
+ Tcl_Obj *stateSpec = objv[2*i + 1];
+ const char *imageName = Tcl_GetString(objv[2*i + 2]);
+ Ttk_StateSpec state;
+
+ if (Ttk_GetStateSpecFromObj(interp, stateSpec, &state) != TCL_OK) {
+ goto error;
+ }
+ imageSpec->states[i] = state;
+
+ imageSpec->images[i] = Tk_GetImage(
+ interp, tkwin, imageName, NullImageChanged, NULL);
+ if (imageSpec->images[i] == NULL) {
+ goto error;
+ }
+ imageSpec->mapCount = i+1;
+ }
+
+ return imageSpec;
+
+error:
+ TtkFreeImageSpec(imageSpec);
+ return NULL;
+}
+
+/* TtkFreeImageSpec --
+ * Dispose of an image specification.
+ */
+void TtkFreeImageSpec(Ttk_ImageSpec *imageSpec)
+{
+ int i;
+
+ for (i=0; i < imageSpec->mapCount; ++i) {
+ Tk_FreeImage(imageSpec->images[i]);
+ }
+
+ if (imageSpec->baseImage) { Tk_FreeImage(imageSpec->baseImage); }
+ if (imageSpec->states) { ckfree((ClientData)imageSpec->states); }
+ if (imageSpec->images) { ckfree((ClientData)imageSpec->images); }
+
+ ckfree((ClientData)imageSpec);
+}
+
+/* TtkSelectImage --
+ * Return a state-specific image from an ImageSpec
+ */
+Tk_Image TtkSelectImage(Ttk_ImageSpec *imageSpec, Ttk_State state)
+{
+ int i;
+ for (i = 0; i < imageSpec->mapCount; ++i) {
+ if (Ttk_StateMatches(state, imageSpec->states+i)) {
+ return imageSpec->images[i];
+ }
+ }
+ return imageSpec->baseImage;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Drawing utilities.
+ */
+
+/* LPadding, CPadding, RPadding --
+ * Split a box+padding pair into left, center, and right boxes.
+ */
+static Ttk_Box LPadding(Ttk_Box b, Ttk_Padding p)
+ { return Ttk_MakeBox(b.x, b.y, p.left, b.height); }
+
+static Ttk_Box CPadding(Ttk_Box b, Ttk_Padding p)
+ { return Ttk_MakeBox(b.x+p.left, b.y, b.width-p.left-p.right, b.height); }
+
+static Ttk_Box RPadding(Ttk_Box b, Ttk_Padding p)
+ { return Ttk_MakeBox(b.x+b.width-p.right, b.y, p.right, b.height); }
+
+/* TPadding, MPadding, BPadding --
+ * Split a box+padding pair into top, middle, and bottom parts.
+ */
+static Ttk_Box TPadding(Ttk_Box b, Ttk_Padding p)
+ { return Ttk_MakeBox(b.x, b.y, b.width, p.top); }
+
+static Ttk_Box MPadding(Ttk_Box b, Ttk_Padding p)
+ { return Ttk_MakeBox(b.x, b.y+p.top, b.width, b.height-p.top-p.bottom); }
+
+static Ttk_Box BPadding(Ttk_Box b, Ttk_Padding p)
+ { return Ttk_MakeBox(b.x, b.y+b.height-p.bottom, b.width, p.bottom); }
+
+/* Ttk_Fill --
+ * Fill the destination area of the drawable by replicating
+ * the source area of the image.
+ */
+static void Ttk_Fill(
+ Tk_Window tkwin, Drawable d, Tk_Image image, Ttk_Box src, Ttk_Box dst)
+{
+ int dr = dst.x + dst.width;
+ int db = dst.y + dst.height;
+ int x,y;
+
+ if (!(src.width && src.height && dst.width && dst.height))
+ return;
+
+ for (x = dst.x; x < dr; x += src.width) {
+ int cw = MIN(src.width, dr - x);
+ for (y = dst.y; y <= db; y += src.height) {
+ int ch = MIN(src.height, db - y);
+ Tk_RedrawImage(image, src.x, src.y, cw, ch, d, x, y);
+ }
+ }
+}
+
+/* Ttk_Stripe --
+ * Fill a horizontal stripe of the destination drawable.
+ */
+static void Ttk_Stripe(
+ Tk_Window tkwin, Drawable d, Tk_Image image,
+ Ttk_Box src, Ttk_Box dst, Ttk_Padding p)
+{
+ Ttk_Fill(tkwin, d, image, LPadding(src,p), LPadding(dst,p));
+ Ttk_Fill(tkwin, d, image, CPadding(src,p), CPadding(dst,p));
+ Ttk_Fill(tkwin, d, image, RPadding(src,p), RPadding(dst,p));
+}
+
+/* Ttk_Tile --
+ * Fill successive horizontal stripes of the destination drawable.
+ */
+static void Ttk_Tile(
+ Tk_Window tkwin, Drawable d, Tk_Image image,
+ Ttk_Box src, Ttk_Box dst, Ttk_Padding p)
+{
+ Ttk_Stripe(tkwin, d, image, TPadding(src,p), TPadding(dst,p), p);
+ Ttk_Stripe(tkwin, d, image, MPadding(src,p), MPadding(dst,p), p);
+ Ttk_Stripe(tkwin, d, image, BPadding(src,p), BPadding(dst,p), p);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Image element definition.
+ */
+
+typedef struct { /* ClientData for image elements */
+ Ttk_ImageSpec *imageSpec; /* Image(s) to use */
+ int minWidth; /* Minimum width; overrides image width */
+ int minHeight; /* Minimum width; overrides image width */
+ Ttk_Sticky sticky; /* -stickiness specification */
+ Ttk_Padding border; /* Fixed border region */
+ Ttk_Padding padding; /* Internal padding */
+
+#if TILE_07_COMPAT
+ Ttk_ResourceCache cache; /* Resource cache for images */
+ Ttk_StateMap imageMap; /* State-based lookup table for images */
+#endif
+} ImageData;
+
+static void FreeImageData(void *clientData)
+{
+ ImageData *imageData = clientData;
+ if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); }
+#if TILE_07_COMPAT
+ if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); }
+#endif
+ ckfree(clientData);
+}
+
+static void ImageElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ImageData *imageData = clientData;
+ Tk_Image image = imageData->imageSpec->baseImage;
+
+ if (image) {
+ Tk_SizeOfImage(image, widthPtr, heightPtr);
+ }
+ if (imageData->minWidth >= 0) {
+ *widthPtr = imageData->minWidth;
+ }
+ if (imageData->minHeight >= 0) {
+ *heightPtr = imageData->minHeight;
+ }
+
+ *paddingPtr = imageData->padding;
+}
+
+static void ImageElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ImageData *imageData = clientData;
+ Tk_Image image = 0;
+ int imgWidth, imgHeight;
+ Ttk_Box src, dst;
+
+#if TILE_07_COMPAT
+ if (imageData->imageMap) {
+ Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state);
+ if (imageObj) {
+ image = Ttk_UseImage(imageData->cache, tkwin, imageObj);
+ }
+ }
+ if (!image) {
+ image = TtkSelectImage(imageData->imageSpec, state);
+ }
+#else
+ image = TtkSelectImage(imageData->imageSpec, state);
+#endif
+
+ if (!image) {
+ return;
+ }
+
+ Tk_SizeOfImage(image, &imgWidth, &imgHeight);
+ src = Ttk_MakeBox(0, 0, imgWidth, imgHeight);
+ dst = Ttk_StickBox(b, imgWidth, imgHeight, imageData->sticky);
+
+ Ttk_Tile(tkwin, d, image, src, dst, imageData->border);
+}
+
+static Ttk_ElementSpec ImageElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ImageElementSize,
+ ImageElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Image element factory.
+ */
+static int
+Ttk_CreateImageElement(
+ Tcl_Interp *interp,
+ void *clientData,
+ Ttk_Theme theme,
+ const char *elementName,
+ int objc, Tcl_Obj *const objv[])
+{
+ const char *optionStrings[] =
+ { "-border","-height","-padding","-sticky","-width",NULL };
+ enum { O_BORDER, O_HEIGHT, O_PADDING, O_STICKY, O_WIDTH };
+
+ Ttk_ImageSpec *imageSpec = 0;
+ ImageData *imageData = 0;
+ int padding_specified = 0;
+ int i;
+
+ if (objc <= 0) {
+ Tcl_AppendResult(interp, "Must supply a base image", NULL);
+ return TCL_ERROR;
+ }
+
+ imageSpec = TtkGetImageSpec(interp, Tk_MainWindow(interp), objv[0]);
+ if (!imageSpec) {
+ return TCL_ERROR;
+ }
+
+ imageData = (ImageData*)ckalloc(sizeof(*imageData));
+ imageData->imageSpec = imageSpec;
+ imageData->minWidth = imageData->minHeight = -1;
+ imageData->sticky = TTK_FILL_BOTH;
+ imageData->border = imageData->padding = Ttk_UniformPadding(0);
+#if TILE_07_COMPAT
+ imageData->cache = Ttk_GetResourceCache(interp);
+ imageData->imageMap = 0;
+#endif
+
+ for (i = 1; i < objc; i += 2) {
+ int option;
+
+ if (i == objc - 1) {
+ Tcl_AppendResult(interp,
+ "Value for ", Tcl_GetString(objv[i]), " missing",
+ NULL);
+ goto error;
+ }
+
+#if TILE_07_COMPAT
+ if (!strcmp("-map", Tcl_GetString(objv[i]))) {
+ imageData->imageMap = objv[i+1];
+ Tcl_IncrRefCount(imageData->imageMap);
+ continue;
+ }
+#endif
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
+ "option", 0, &option) != TCL_OK) { goto error; }
+
+ switch (option) {
+ case O_BORDER:
+ if (Ttk_GetBorderFromObj(interp, objv[i+1], &imageData->border)
+ != TCL_OK) { goto error; }
+ if (!padding_specified) {
+ imageData->padding = imageData->border;
+ }
+ break;
+ case O_PADDING:
+ if (Ttk_GetBorderFromObj(interp, objv[i+1], &imageData->padding)
+ != TCL_OK) { goto error; }
+ padding_specified = 1;
+ break;
+ case O_WIDTH:
+ if (Tcl_GetIntFromObj(interp, objv[i+1], &imageData->minWidth)
+ != TCL_OK) { goto error; }
+ break;
+ case O_HEIGHT:
+ if (Tcl_GetIntFromObj(interp, objv[i+1], &imageData->minHeight)
+ != TCL_OK) { goto error; }
+ break;
+ case O_STICKY:
+ if (Ttk_GetStickyFromObj(interp, objv[i+1], &imageData->sticky)
+ != TCL_OK) { goto error; }
+ }
+ }
+
+ if (!Ttk_RegisterElement(interp, theme, elementName, &ImageElementSpec,
+ imageData))
+ {
+ goto error;
+ }
+
+ Ttk_RegisterCleanup(interp, imageData, FreeImageData);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1));
+ return TCL_OK;
+
+error:
+ FreeImageData(imageData);
+ return TCL_ERROR;
+}
+
+MODULE_SCOPE
+void TtkImage_Init(Tcl_Interp *interp)
+{
+ Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
new file mode 100644
index 0000000..78676c6
--- /dev/null
+++ b/generic/ttk/ttkInit.c
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2003, Joe English
+ *
+ * Ttk package: initialization routine and miscellaneous utilities.
+ */
+
+#include <string.h>
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/*
+ * Legal values for the button -default option.
+ * See also: enum Ttk_ButtonDefaultState.
+ */
+const char *ttkDefaultStrings[] = {
+ "normal", "active", "disabled", NULL
+};
+
+int Ttk_GetButtonDefaultStateFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr)
+{
+ *statePtr = TTK_BUTTON_DEFAULT_DISABLED;
+ return Tcl_GetIndexFromObj(interp, objPtr,
+ ttkDefaultStrings, "default state", 0, statePtr);
+}
+
+/*
+ * Legal values for the -compound option.
+ * See also: enum Ttk_Compound.
+ */
+const char *ttkCompoundStrings[] = {
+ "none", "text", "image", "center",
+ "top", "bottom", "left", "right", NULL
+};
+
+int Ttk_GetCompoundFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr)
+{
+ *statePtr = TTK_COMPOUND_NONE;
+ return Tcl_GetIndexFromObj(interp, objPtr,
+ ttkCompoundStrings, "compound layout", 0, statePtr);
+}
+
+/*
+ * Legal values for the -orient option.
+ * See also: enum Ttk_Orient.
+ */
+const char *ttkOrientStrings[] = {
+ "horizontal", "vertical", NULL
+};
+
+int Ttk_GetOrientFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr)
+{
+ *resultPtr = TTK_ORIENT_HORIZONTAL;
+ return Tcl_GetIndexFromObj(interp, objPtr,
+ ttkOrientStrings, "orientation", 0, resultPtr);
+}
+
+/*
+ * Recognized values for the -state compatibility option.
+ * Other options are accepted and interpreted as synonyms for "normal".
+ */
+static const char *ttkStateStrings[] = {
+ "normal", "readonly", "disabled", "active", NULL
+};
+enum {
+ TTK_COMPAT_STATE_NORMAL,
+ TTK_COMPAT_STATE_READONLY,
+ TTK_COMPAT_STATE_DISABLED,
+ TTK_COMPAT_STATE_ACTIVE
+};
+
+/* TtkCheckStateOption --
+ * Handle -state compatibility option.
+ *
+ * NOTE: setting -state disabled / -state enabled affects the
+ * widget state, but the internal widget state does *not* affect
+ * the value of the -state option.
+ * This option is present for compatibility only.
+ */
+void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr)
+{
+ int stateOption = TTK_COMPAT_STATE_NORMAL;
+ unsigned all = TTK_STATE_DISABLED|TTK_STATE_READONLY|TTK_STATE_ACTIVE;
+# define SETFLAGS(f) TtkWidgetChangeState(corePtr, f, all^f)
+
+ (void)Tcl_GetIndexFromObj(NULL,objPtr,ttkStateStrings,"",0,&stateOption);
+ switch (stateOption) {
+ case TTK_COMPAT_STATE_NORMAL:
+ default:
+ SETFLAGS(0);
+ break;
+ case TTK_COMPAT_STATE_READONLY:
+ SETFLAGS(TTK_STATE_READONLY);
+ break;
+ case TTK_COMPAT_STATE_DISABLED:
+ SETFLAGS(TTK_STATE_DISABLED);
+ break;
+ case TTK_COMPAT_STATE_ACTIVE:
+ SETFLAGS(TTK_STATE_ACTIVE);
+ break;
+ }
+# undef SETFLAGS
+}
+
+/* TtkSendVirtualEvent --
+ * Send a virtual event notification to the specified target window.
+ * Equivalent to "event generate $tgtWindow <<$eventName>>"
+ *
+ * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent,
+ * so this routine does not reenter the interpreter.
+ */
+void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName)
+{
+ union {XEvent general; XVirtualEvent virtual;} event;
+
+ memset(&event, 0, sizeof(event));
+ event.general.xany.type = VirtualEvent;
+ event.general.xany.serial = NextRequest(Tk_Display(tgtWin));
+ event.general.xany.send_event = False;
+ event.general.xany.window = Tk_WindowId(tgtWin);
+ event.general.xany.display = Tk_Display(tgtWin);
+ event.virtual.name = Tk_GetUid(eventName);
+
+ Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
+}
+
+/* TtkEnumerateOptions, TtkGetOptionValue --
+ * Common factors for data accessor commands.
+ */
+int TtkEnumerateOptions(
+ Tcl_Interp *interp, void *recordPtr, const Tk_OptionSpec *specPtr,
+ Tk_OptionTable optionTable, Tk_Window tkwin)
+{
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+ while (specPtr->type != TK_OPTION_END)
+ {
+ Tcl_Obj *optionName = Tcl_NewStringObj(specPtr->optionName, -1);
+ Tcl_Obj *optionValue =
+ Tk_GetOptionValue(interp,recordPtr,optionTable,optionName,tkwin);
+ if (optionValue) {
+ Tcl_ListObjAppendElement(interp, result, optionName);
+ Tcl_ListObjAppendElement(interp, result, optionValue);
+ }
+ ++specPtr;
+
+ if (specPtr->type == TK_OPTION_END && specPtr->clientData != NULL) {
+ /* Chain to next option spec array: */
+ specPtr = specPtr->clientData;
+ }
+ }
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+}
+
+int TtkGetOptionValue(
+ Tcl_Interp *interp, void *recordPtr, Tcl_Obj *optionName,
+ Tk_OptionTable optionTable, Tk_Window tkwin)
+{
+ Tcl_Obj *result =
+ Tk_GetOptionValue(interp,recordPtr,optionTable,optionName,tkwin);
+ if (result) {
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ }
+ return TCL_ERROR;
+}
+
+
+/*------------------------------------------------------------------------
+ * Core Option specifications:
+ * type name dbName dbClass default objOffset intOffset flags clientData mask
+ */
+
+/* public */
+Tk_OptionSpec ttkCoreOptionSpecs[] =
+{
+ {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", NULL,
+ Tk_Offset(WidgetCore, cursorObj), -1, TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_STRING, "-style", "style", "Style", "",
+ Tk_Offset(WidgetCore,styleObj), -1, 0,0,STYLE_CHANGED},
+ {TK_OPTION_STRING, "-class", "", "", NULL,
+ Tk_Offset(WidgetCore,classObj), -1, 0,0,READONLY_OPTION},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
+};
+
+/*------------------------------------------------------------------------
+ * +++ Initialization: elements and element factories.
+ */
+
+extern void TtkElements_Init(Tcl_Interp *);
+extern void TtkLabel_Init(Tcl_Interp *);
+extern void TtkImage_Init(Tcl_Interp *);
+
+static void RegisterElements(Tcl_Interp *interp)
+{
+ TtkElements_Init(interp);
+ TtkLabel_Init(interp);
+ TtkImage_Init(interp);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Initialization: Widget definitions.
+ */
+
+extern void TtkButton_Init(Tcl_Interp *);
+extern void TtkEntry_Init(Tcl_Interp *);
+extern void TtkFrame_Init(Tcl_Interp *);
+extern void TtkNotebook_Init(Tcl_Interp *);
+extern void TtkPanedwindow_Init(Tcl_Interp *);
+extern void TtkProgressbar_Init(Tcl_Interp *);
+extern void TtkScale_Init(Tcl_Interp *);
+extern void TtkScrollbar_Init(Tcl_Interp *);
+extern void TtkSeparator_Init(Tcl_Interp *);
+extern void TtkTreeview_Init(Tcl_Interp *);
+
+#ifdef TTK_SQUARE_WIDGET
+extern int TtkSquareWidget_Init(Tcl_Interp *);
+#endif
+
+static void RegisterWidgets(Tcl_Interp *interp)
+{
+ TtkButton_Init(interp);
+ TtkEntry_Init(interp);
+ TtkFrame_Init(interp);
+ TtkNotebook_Init(interp);
+ TtkPanedwindow_Init(interp);
+ TtkProgressbar_Init(interp);
+ TtkScale_Init(interp);
+ TtkScrollbar_Init(interp);
+ TtkSeparator_Init(interp);
+ TtkTreeview_Init(interp);
+#ifdef TTK_SQUARE_WIDGET
+ TtkSquareWidget_Init(interp);
+#endif
+}
+
+/*------------------------------------------------------------------------
+ * +++ Initialization: Built-in themes.
+ */
+
+extern int TtkAltTheme_Init(Tcl_Interp *);
+extern int TtkClassicTheme_Init(Tcl_Interp *);
+extern int TtkClamTheme_Init(Tcl_Interp *);
+
+static void RegisterThemes(Tcl_Interp *interp)
+{
+
+ TtkAltTheme_Init(interp);
+ TtkClassicTheme_Init(interp);
+ TtkClamTheme_Init(interp);
+}
+
+/*
+ * Ttk initialization.
+ */
+
+extern const TtkStubs ttkStubs;
+
+MODULE_SCOPE int
+Ttk_Init(Tcl_Interp *interp)
+{
+ /*
+ * This will be run for both safe and regular interp init.
+ * Use Tcl_IsSafe if necessary to not initialize unsafe bits.
+ */
+ Ttk_StylePkgInit(interp);
+
+ RegisterElements(interp);
+ RegisterWidgets(interp);
+ RegisterThemes(interp);
+
+ Ttk_PlatformInit(interp);
+
+ Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (ClientData)&ttkStubs);
+
+ return TCL_OK;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
new file mode 100644
index 0000000..0f773e7
--- /dev/null
+++ b/generic/ttk/ttkLabel.c
@@ -0,0 +1,670 @@
+/*
+ * text, image, and label elements.
+ *
+ * The label element combines text and image elements,
+ * with layout determined by the "-compound" option.
+ *
+ */
+
+#include <tcl.h>
+#include <tk.h>
+#include "ttkTheme.h"
+
+/*----------------------------------------------------------------------
+ * +++ Text element.
+ *
+ * This element displays a textual label in the foreground color.
+ *
+ * Optionally underlines the mnemonic character if the -underline resource
+ * is present and >= 0.
+ */
+
+typedef struct {
+ /*
+ * Element options:
+ */
+ Tcl_Obj *textObj;
+ Tcl_Obj *fontObj;
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *underlineObj;
+ Tcl_Obj *widthObj;
+ Tcl_Obj *anchorObj;
+ Tcl_Obj *justifyObj;
+ Tcl_Obj *wrapLengthObj;
+ Tcl_Obj *embossedObj;
+
+ /*
+ * Computed resources:
+ */
+ Tk_Font tkfont;
+ Tk_TextLayout textLayout;
+ int width;
+ int height;
+ int embossed;
+
+} TextElement;
+
+/* Text element options table.
+ * NB: Keep in sync with label element option table.
+ */
+static Ttk_ElementOptionSpec TextElementOptions[] = {
+ { "-text", TK_OPTION_STRING,
+ Tk_Offset(TextElement,textObj), "" },
+ { "-font", TK_OPTION_FONT,
+ Tk_Offset(TextElement,fontObj), DEFAULT_FONT },
+ { "-foreground", TK_OPTION_COLOR,
+ Tk_Offset(TextElement,foregroundObj), "black" },
+ { "-underline", TK_OPTION_INT,
+ Tk_Offset(TextElement,underlineObj), "-1"},
+ { "-width", TK_OPTION_INT,
+ Tk_Offset(TextElement,widthObj), "-1"},
+ { "-anchor", TK_OPTION_ANCHOR,
+ Tk_Offset(TextElement,anchorObj), "w"},
+ { "-justify", TK_OPTION_JUSTIFY,
+ Tk_Offset(TextElement,justifyObj), "left" },
+ { "-wraplength", TK_OPTION_PIXELS,
+ Tk_Offset(TextElement,wrapLengthObj), "0" },
+ { "-embossed", TK_OPTION_INT,
+ Tk_Offset(TextElement,embossedObj), "0"},
+ { NULL, 0, 0, NULL }
+};
+
+static int TextSetup(TextElement *text, Tk_Window tkwin)
+{
+ const char *string = Tcl_GetString(text->textObj);
+ Tk_Justify justify = TK_JUSTIFY_LEFT;
+ int wrapLength = 0;
+
+ text->tkfont = Tk_GetFontFromObj(tkwin, text->fontObj);
+ Tk_GetJustifyFromObj(NULL, text->justifyObj, &justify);
+ Tk_GetPixelsFromObj(NULL, tkwin, text->wrapLengthObj, &wrapLength);
+ Tcl_GetBooleanFromObj(NULL, text->embossedObj, &text->embossed);
+
+ text->textLayout = Tk_ComputeTextLayout(
+ text->tkfont, string, -1/*numChars*/, wrapLength, justify,
+ 0/*flags*/, &text->width, &text->height);
+
+ return 1;
+}
+
+/*
+ * TextReqWidth -- compute the requested width of a text element.
+ *
+ * If -width is positive, use that as the width
+ * If -width is negative, use that as the minimum width
+ * If not specified or empty, use the natural size of the text
+ */
+
+static int TextReqWidth(TextElement *text)
+{
+ int reqWidth;
+
+ if ( text->widthObj
+ && Tcl_GetIntFromObj(NULL, text->widthObj, &reqWidth) == TCL_OK)
+ {
+ int avgWidth = Tk_TextWidth(text->tkfont, "0", 1);
+ if (reqWidth <= 0) {
+ int specWidth = avgWidth * -reqWidth;
+ if (specWidth > text->width)
+ return specWidth;
+ } else {
+ return avgWidth * reqWidth;
+ }
+ }
+ return text->width;
+}
+
+static void TextCleanup(TextElement *text)
+{
+ Tk_FreeTextLayout(text->textLayout);
+}
+
+/*
+ * TextDraw --
+ * Draw a text element.
+ * Called by TextElementDraw() and LabelElementDraw().
+ */
+static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b)
+{
+ XColor *color = Tk_GetColorFromObj(tkwin, text->foregroundObj);
+ int underline = -1;
+ int lastChar = -1;
+ XGCValues gcValues;
+ GC gc1, gc2;
+ Tk_Anchor anchor = TK_ANCHOR_CENTER;
+
+ gcValues.font = Tk_FontId(text->tkfont);
+ gcValues.foreground = color->pixel;
+ gc1 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues);
+ gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin));
+ gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues);
+
+ /*
+ * Place text according to -anchor:
+ */
+ Tk_GetAnchorFromObj(NULL, text->anchorObj, &anchor);
+ b = Ttk_AnchorBox(b, text->width, text->height, anchor);
+
+ /*
+ * Clip text if it's too wide:
+ * @@@ BUG: This will overclip multi-line text.
+ */
+ if (b.width < text->width) {
+ lastChar = Tk_PointToChar(text->textLayout, b.width, 1) + 1;
+ }
+
+ if (text->embossed) {
+ Tk_DrawTextLayout(Tk_Display(tkwin), d, gc2,
+ text->textLayout, b.x+1, b.y+1, 0/*firstChar*/, lastChar);
+ }
+ Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1,
+ text->textLayout, b.x, b.y, 0/*firstChar*/, lastChar);
+
+ Tcl_GetIntFromObj(NULL, text->underlineObj, &underline);
+ if (underline >= 0 && (lastChar == -1 || underline <= lastChar)) {
+ if (text->embossed) {
+ Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc2,
+ text->textLayout, b.x+1, b.y+1, underline);
+ }
+ Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc1,
+ text->textLayout, b.x, b.y, underline);
+ }
+
+ Tk_FreeGC(Tk_Display(tkwin), gc1);
+ Tk_FreeGC(Tk_Display(tkwin), gc2);
+}
+
+static void TextElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TextElement *text = elementRecord;
+
+ if (!TextSetup(text, tkwin))
+ return;
+
+ *heightPtr = text->height;
+ *widthPtr = TextReqWidth(text);
+
+ TextCleanup(text);
+
+ return;
+}
+
+static void TextElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ TextElement *text = elementRecord;
+ if (TextSetup(text, tkwin)) {
+ TextDraw(text, tkwin, d, b);
+ TextCleanup(text);
+ }
+}
+
+static Ttk_ElementSpec TextElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TextElement),
+ TextElementOptions,
+ TextElementSize,
+ TextElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Image element.
+ * Draws an image.
+ */
+
+typedef struct {
+ Tcl_Obj *imageObj;
+ Tcl_Obj *stippleObj; /* For TTK_STATE_DISABLED */
+ Tcl_Obj *backgroundObj; /* " " */
+
+ Ttk_ImageSpec *imageSpec;
+ Tk_Image tkimg;
+ int width;
+ int height;
+} ImageElement;
+
+/* ===> NB: Keep in sync with label element option table. <===
+ */
+static Ttk_ElementOptionSpec ImageElementOptions[] = {
+ { "-image", TK_OPTION_STRING,
+ Tk_Offset(ImageElement,imageObj), "" },
+ { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */
+ Tk_Offset(ImageElement,stippleObj), "gray50" },
+ { "-background", TK_OPTION_COLOR,
+ Tk_Offset(ImageElement,backgroundObj), DEFAULT_BACKGROUND },
+ { NULL, 0, 0, NULL }
+};
+
+/*
+ * ImageSetup() --
+ * Look up the Tk_Image from the image element's imageObj resource.
+ * Caller must release the image with ImageCleanup().
+ *
+ * Returns:
+ * 1 if successful, 0 if there was an error (unreported)
+ * or the image resource was not specified.
+ */
+
+static int ImageSetup(
+ ImageElement *image, Tk_Window tkwin, Ttk_State state)
+{
+
+ if (!image->imageObj) {
+ return 0;
+ }
+ image->imageSpec = TtkGetImageSpec(NULL, tkwin, image->imageObj);
+ if (!image->imageSpec) {
+ return 0;
+ }
+ image->tkimg = TtkSelectImage(image->imageSpec, state);
+ if (!image->tkimg) {
+ TtkFreeImageSpec(image->imageSpec);
+ return 0;
+ }
+ Tk_SizeOfImage(image->tkimg, &image->width, &image->height);
+
+ return 1;
+}
+
+static void ImageCleanup(ImageElement *image)
+{
+ TtkFreeImageSpec(image->imageSpec);
+}
+
+/*
+ * StippleOver --
+ * Draw a stipple over the image area, to make it look "grayed-out"
+ * when TTK_STATE_DISABLED is set.
+ */
+static void StippleOver(
+ ImageElement *image, Tk_Window tkwin, Drawable d, int x, int y)
+{
+ Pixmap stipple = Tk_AllocBitmapFromObj(NULL, tkwin, image->stippleObj);
+ XColor *color = Tk_GetColorFromObj(tkwin, image->backgroundObj);
+
+ if (stipple != None) {
+ unsigned long mask = GCFillStyle | GCStipple | GCForeground;
+ XGCValues gcvalues;
+ GC gc;
+ gcvalues.foreground = color->pixel;
+ gcvalues.fill_style = FillStippled;
+ gcvalues.stipple = stipple;
+ gc = Tk_GetGC(tkwin, mask, &gcvalues);
+ XFillRectangle(Tk_Display(tkwin),d,gc,x,y,image->width,image->height);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+ Tk_FreeBitmapFromObj(tkwin, image->stippleObj);
+ }
+}
+
+static void ImageDraw(
+ ImageElement *image, Tk_Window tkwin,Drawable d,Ttk_Box b,Ttk_State state)
+{
+ int width = image->width, height = image->height;
+
+ /* Clip width and height to remain within window bounds:
+ */
+ if (b.x + width > Tk_Width(tkwin)) {
+ width = Tk_Width(tkwin) - b.x;
+ }
+ if (b.y + height > Tk_Height(tkwin)) {
+ height = Tk_Height(tkwin) - b.y;
+ }
+
+ if (height <= 0 || width <= 0) {
+ /* Completely clipped - bail out.
+ */
+ return;
+ }
+
+ Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y);
+
+ /* If we're disabled there's no state-specific 'disabled' image,
+ * stipple the image.
+ * @@@ Possibly: Don't do disabled-stippling at all;
+ * @@@ it's ugly and out of fashion.
+ */
+ if (state & TTK_STATE_DISABLED) {
+ if (TtkSelectImage(image->imageSpec, 0ul) == image->tkimg) {
+ StippleOver(image, tkwin, d, b.x,b.y);
+ }
+ }
+}
+
+static void ImageElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ImageElement *image = elementRecord;
+
+ if (ImageSetup(image, tkwin, 0)) {
+ *widthPtr = image->width;
+ *heightPtr = image->height;
+ ImageCleanup(image);
+ }
+}
+
+static void ImageElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ImageElement *image = elementRecord;
+
+ if (ImageSetup(image, tkwin, state)) {
+ ImageDraw(image, tkwin, d, b, state);
+ ImageCleanup(image);
+ }
+}
+
+static Ttk_ElementSpec ImageElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ImageElement),
+ ImageElementOptions,
+ ImageElementSize,
+ ImageElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Label element.
+ *
+ * Displays an image and/or text, as determined by the -compound option.
+ *
+ * Differences from Tk 8.4 compound elements:
+ *
+ * This adds two new values for the -compound option, "text"
+ * and "image". (This is useful for configuring toolbars to
+ * display icons, text and icons, or text only, as found in
+ * many browsers.)
+ *
+ * "-compound none" is supported, but I'd like to get rid of it;
+ * it makes the logic more complex, and the only benefit is
+ * backwards compatibility with Tk < 8.3.0 scripts.
+ *
+ * This adds a new resource, -space, for determining how much
+ * space to leave between the text and image; Tk 8.4 reuses the
+ * -padx or -pady option for this purpose.
+ *
+ * -width always specifies the length in characters of the text part;
+ * in Tk 8.4 it's either characters or pixels, depending on the
+ * value of -compound.
+ *
+ * Negative values of -width are interpreted as a minimum width
+ * on all platforms, not just on Windows.
+ *
+ * Tk 8.4 ignores -padx and -pady if -compound is set to "none".
+ * Here, padding is handled by a different element.
+ */
+
+typedef struct {
+ /*
+ * Element options:
+ */
+ Tcl_Obj *compoundObj;
+ Tcl_Obj *spaceObj;
+ TextElement text;
+ ImageElement image;
+
+ /*
+ * Computed values (see LabelSetup)
+ */
+ Ttk_Compound compound;
+ int space;
+ int totalWidth, totalHeight;
+} LabelElement;
+
+static Ttk_ElementOptionSpec LabelElementOptions[] = {
+ { "-compound", TK_OPTION_ANY,
+ Tk_Offset(LabelElement,compoundObj), "none" },
+ { "-space", TK_OPTION_PIXELS,
+ Tk_Offset(LabelElement,spaceObj), "4" },
+
+ /* Text element part:
+ * NB: Keep in sync with TextElementOptions.
+ */
+ { "-text", TK_OPTION_STRING,
+ Tk_Offset(LabelElement,text.textObj), "" },
+ { "-font", TK_OPTION_FONT,
+ Tk_Offset(LabelElement,text.fontObj), DEFAULT_FONT },
+ { "-foreground", TK_OPTION_COLOR,
+ Tk_Offset(LabelElement,text.foregroundObj), "black" },
+ { "-underline", TK_OPTION_INT,
+ Tk_Offset(LabelElement,text.underlineObj), "-1"},
+ { "-width", TK_OPTION_INT,
+ Tk_Offset(LabelElement,text.widthObj), ""},
+ { "-anchor", TK_OPTION_ANCHOR,
+ Tk_Offset(LabelElement,text.anchorObj), "w"},
+ { "-justify", TK_OPTION_JUSTIFY,
+ Tk_Offset(LabelElement,text.justifyObj), "left" },
+ { "-wraplength", TK_OPTION_PIXELS,
+ Tk_Offset(LabelElement,text.wrapLengthObj), "0" },
+ { "-embossed", TK_OPTION_INT,
+ Tk_Offset(LabelElement,text.embossedObj), "0"},
+
+ /* Image element part:
+ * NB: Keep in sync with ImageElementOptions.
+ */
+ { "-image", TK_OPTION_STRING,
+ Tk_Offset(LabelElement,image.imageObj), "" },
+ { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */
+ Tk_Offset(LabelElement,image.stippleObj), "gray50" },
+ { "-background", TK_OPTION_COLOR,
+ Tk_Offset(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND },
+ { NULL, 0, 0, NULL }
+};
+
+/*
+ * LabelSetup --
+ * Fills in computed fields of the label element.
+ *
+ * Calculate the text, image, and total width and height.
+ */
+
+#define MAX(a,b) ((a) > (b) ? a : b);
+static void LabelSetup(
+ LabelElement *c, Tk_Window tkwin, Ttk_State state)
+{
+ Ttk_Compound *compoundPtr = &c->compound;
+
+ Tk_GetPixelsFromObj(NULL,tkwin,c->spaceObj,&c->space);
+ Ttk_GetCompoundFromObj(NULL,c->compoundObj,(int*)compoundPtr);
+
+ /*
+ * Deal with TTK_COMPOUND_NONE.
+ */
+ if (c->compound == TTK_COMPOUND_NONE) {
+ if (ImageSetup(&c->image, tkwin, state)) {
+ c->compound = TTK_COMPOUND_IMAGE;
+ } else {
+ c->compound = TTK_COMPOUND_TEXT;
+ }
+ } else if (c->compound != TTK_COMPOUND_TEXT) {
+ if (!ImageSetup(&c->image, tkwin, state)) {
+ c->compound = TTK_COMPOUND_TEXT;
+ }
+ }
+ if (c->compound != TTK_COMPOUND_IMAGE)
+ TextSetup(&c->text, tkwin);
+
+ /*
+ * ASSERT:
+ * if c->compound != IMAGE, then TextSetup() has been called
+ * if c->compound != TEXT, then ImageSetup() has returned successfully
+ * c->compound != COMPOUND_NONE.
+ */
+
+ switch (c->compound)
+ {
+ case TTK_COMPOUND_NONE:
+ /* Can't happen */
+ break;
+ case TTK_COMPOUND_TEXT:
+ c->totalWidth = c->text.width;
+ c->totalHeight = c->text.height;
+ break;
+ case TTK_COMPOUND_IMAGE:
+ c->totalWidth = c->image.width;
+ c->totalHeight = c->image.height;
+ break;
+ case TTK_COMPOUND_CENTER:
+ c->totalWidth = MAX(c->image.width, c->text.width);
+ c->totalHeight = MAX(c->image.height, c->text.height);
+ break;
+ case TTK_COMPOUND_TOP:
+ case TTK_COMPOUND_BOTTOM:
+ c->totalWidth = MAX(c->image.width, c->text.width);
+ c->totalHeight = c->image.height + c->text.height + c->space;
+ break;
+
+ case TTK_COMPOUND_LEFT:
+ case TTK_COMPOUND_RIGHT:
+ c->totalWidth = c->image.width + c->text.width + c->space;
+ c->totalHeight = MAX(c->image.height, c->text.height);
+ break;
+ }
+}
+
+static void LabelCleanup(LabelElement *c)
+{
+ if (c->compound != TTK_COMPOUND_TEXT)
+ ImageCleanup(&c->image);
+ if (c->compound != TTK_COMPOUND_IMAGE)
+ TextCleanup(&c->text);
+}
+
+static void LabelElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ LabelElement *label = elementRecord;
+ int textReqWidth = 0;
+
+ LabelSetup(label, tkwin, 0);
+
+ *heightPtr = label->totalHeight;
+
+ /* Requested width based on -width option, not actual text width:
+ */
+ if (label->compound != TTK_COMPOUND_IMAGE)
+ textReqWidth = TextReqWidth(&label->text);
+
+ switch (label->compound)
+ {
+ case TTK_COMPOUND_TEXT:
+ *widthPtr = textReqWidth;
+ break;
+ case TTK_COMPOUND_IMAGE:
+ *widthPtr = label->image.width;
+ break;
+ case TTK_COMPOUND_TOP:
+ case TTK_COMPOUND_BOTTOM:
+ case TTK_COMPOUND_CENTER:
+ *widthPtr = MAX(label->image.width, textReqWidth);
+ break;
+ case TTK_COMPOUND_LEFT:
+ case TTK_COMPOUND_RIGHT:
+ *widthPtr = label->image.width + textReqWidth + label->space;
+ break;
+ case TTK_COMPOUND_NONE:
+ break; /* Can't happen */
+ }
+
+ LabelCleanup(label);
+}
+
+/*
+ * DrawCompound --
+ * Helper routine for LabelElementDraw;
+ * Handles layout for -compound {left,right,top,bottom}
+ */
+static void DrawCompound(
+ LabelElement *l, Ttk_Box b, Tk_Window tkwin, Drawable d, Ttk_State state,
+ int imageSide, int textSide)
+{
+ Ttk_Box imageBox =
+ Ttk_PlaceBox(&b, l->image.width, l->image.height, imageSide, 0);
+ Ttk_Box textBox =
+ Ttk_PlaceBox(&b, l->text.width, l->text.height, textSide, 0);
+ ImageDraw(&l->image,tkwin,d,imageBox,state);
+ TextDraw(&l->text,tkwin,d,textBox);
+}
+
+static void LabelElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ LabelElement *l = elementRecord;
+ Tk_Anchor anchor = TK_ANCHOR_CENTER;
+
+ LabelSetup(l, tkwin, state);
+
+ /*
+ * Adjust overall parcel based on -anchor:
+ */
+ Tk_GetAnchorFromObj(NULL, l->text.anchorObj, &anchor);
+ b = Ttk_AnchorBox(b, l->totalWidth, l->totalHeight, anchor);
+
+ /*
+ * Draw text and/or image parts based on -compound:
+ */
+ switch (l->compound)
+ {
+ case TTK_COMPOUND_NONE:
+ /* Can't happen */
+ break;
+ case TTK_COMPOUND_TEXT:
+ TextDraw(&l->text,tkwin,d,b);
+ break;
+ case TTK_COMPOUND_IMAGE:
+ ImageDraw(&l->image,tkwin,d,b,state);
+ break;
+ case TTK_COMPOUND_CENTER:
+ {
+ Ttk_Box pb = Ttk_AnchorBox(
+ b, l->image.width, l->image.height, TK_ANCHOR_CENTER);
+ ImageDraw(&l->image, tkwin, d, pb, state);
+ pb = Ttk_AnchorBox(
+ b, l->text.width, l->text.height, TK_ANCHOR_CENTER);
+ TextDraw(&l->text, tkwin, d, pb);
+ break;
+ }
+ case TTK_COMPOUND_TOP:
+ DrawCompound(l, b, tkwin, d, state, TTK_SIDE_TOP, TTK_SIDE_BOTTOM);
+ break;
+ case TTK_COMPOUND_BOTTOM:
+ DrawCompound(l, b, tkwin, d, state, TTK_SIDE_BOTTOM, TTK_SIDE_TOP);
+ break;
+ case TTK_COMPOUND_LEFT:
+ DrawCompound(l, b, tkwin, d, state, TTK_SIDE_LEFT, TTK_SIDE_RIGHT);
+ break;
+ case TTK_COMPOUND_RIGHT:
+ DrawCompound(l, b, tkwin, d, state, TTK_SIDE_RIGHT, TTK_SIDE_LEFT);
+ break;
+ }
+
+ LabelCleanup(l);
+}
+
+static Ttk_ElementSpec LabelElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(LabelElement),
+ LabelElementOptions,
+ LabelElementSize,
+ LabelElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkLabel_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterElement(interp, theme, "text", &TextElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "image", &ImageElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "label", &LabelElementSpec, NULL);
+}
+
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
new file mode 100644
index 0000000..58c99eb
--- /dev/null
+++ b/generic/ttk/ttkLayout.c
@@ -0,0 +1,1252 @@
+/*
+ * ttkLayout.c --
+ *
+ * Generic layout processing.
+ *
+ * Copyright (c) 2003 Joe English. Freely redistributable.
+ */
+
+#include <string.h>
+#include <tk.h>
+#include "ttkThemeInt.h"
+
+#define MAX(a,b) (a > b ? a : b)
+#define MIN(a,b) (a < b ? a : b)
+
+/*------------------------------------------------------------------------
+ * +++ Ttk_Box and Ttk_Padding utilities:
+ */
+
+Ttk_Box
+Ttk_MakeBox(int x, int y, int width, int height)
+{
+ Ttk_Box b;
+ b.x = x; b.y = y; b.width = width; b.height = height;
+ return b;
+}
+
+int
+Ttk_BoxContains(Ttk_Box box, int x, int y)
+{
+ return box.x <= x && x < box.x + box.width
+ && box.y <= y && y < box.y + box.height;
+}
+
+Tcl_Obj *
+Ttk_NewBoxObj(Ttk_Box box)
+{
+ Tcl_Obj *result[4];
+
+ result[0] = Tcl_NewIntObj(box.x);
+ result[1] = Tcl_NewIntObj(box.y);
+ result[2] = Tcl_NewIntObj(box.width);
+ result[3] = Tcl_NewIntObj(box.height);
+
+ return Tcl_NewListObj(4, result);
+}
+
+/*
+ * packTop, packBottom, packLeft, packRight --
+ * Carve out a parcel of the specified height (resp width)
+ * from the specified cavity.
+ *
+ * Returns:
+ * The new parcel.
+ *
+ * Side effects:
+ * Adjust the cavity.
+ */
+
+static Ttk_Box packTop(Ttk_Box *cavity, int height)
+{
+ Ttk_Box parcel;
+ height = MIN(height, cavity->height);
+ parcel = Ttk_MakeBox(cavity->x, cavity->y, cavity->width, height);
+ cavity->y += height;
+ cavity->height -= height;
+ return parcel;
+}
+
+static Ttk_Box packBottom(Ttk_Box *cavity, int height)
+{
+ height = MIN(height, cavity->height);
+ cavity->height -= height;
+ return Ttk_MakeBox(
+ cavity->x, cavity->y + cavity->height,
+ cavity->width, height);
+}
+
+static Ttk_Box packLeft(Ttk_Box *cavity, int width)
+{
+ Ttk_Box parcel;
+ width = MIN(width, cavity->width);
+ parcel = Ttk_MakeBox(cavity->x, cavity->y, width,cavity->height);
+ cavity->x += width;
+ cavity->width -= width;
+ return parcel;
+}
+
+static Ttk_Box packRight(Ttk_Box *cavity, int width)
+{
+ width = MIN(width, cavity->width);
+ cavity->width -= width;
+ return Ttk_MakeBox(cavity->x + cavity->width,
+ cavity->y, width, cavity->height);
+}
+
+/*
+ * Ttk_PackBox --
+ * Carve out a parcel of the specified size on the specified side
+ * in the specified cavity.
+ *
+ * Returns:
+ * The new parcel.
+ *
+ * Side effects:
+ * Adjust the cavity.
+ */
+
+Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int width, int height, Ttk_Side side)
+{
+ switch (side) {
+ default:
+ case TTK_SIDE_TOP: return packTop(cavity, height);
+ case TTK_SIDE_BOTTOM: return packBottom(cavity, height);
+ case TTK_SIDE_LEFT: return packLeft(cavity, width);
+ case TTK_SIDE_RIGHT: return packRight(cavity, width);
+ }
+}
+
+/*
+ * Ttk_PadBox --
+ * Shrink a box by the specified padding amount.
+ */
+Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p)
+{
+ b.x += p.left;
+ b.y += p.top;
+ b.width -= (p.left + p.right);
+ b.height -= (p.top + p.bottom);
+ if (b.width <= 0) b.width = 1;
+ if (b.height <= 0) b.height = 1;
+ return b;
+}
+
+/*
+ * Ttk_ExpandBox --
+ * Grow a box by the specified padding amount.
+ */
+Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p)
+{
+ b.x -= p.left;
+ b.y -= p.top;
+ b.width += (p.left + p.right);
+ b.height += (p.top + p.bottom);
+ return b;
+}
+
+/*
+ * Ttk_StickBox --
+ * Place a box of size w * h in the specified parcel,
+ * according to the specified sticky bits.
+ */
+Ttk_Box Ttk_StickBox(Ttk_Box parcel, int width, int height, unsigned sticky)
+{
+ int dx, dy;
+
+ if (width > parcel.width) width = parcel.width;
+ if (height > parcel.height) height = parcel.height;
+
+ dx = parcel.width - width;
+ dy = parcel.height - height;
+
+ /*
+ * X coordinate adjustment:
+ */
+ switch (sticky & (TTK_STICK_W | TTK_STICK_E))
+ {
+ case TTK_STICK_W | TTK_STICK_E:
+ /* no-op -- use entire parcel width */
+ break;
+ case TTK_STICK_W:
+ parcel.width = width;
+ break;
+ case TTK_STICK_E:
+ parcel.x += dx;
+ parcel.width = width;
+ break;
+ default :
+ parcel.x += dx / 2;
+ parcel.width = width;
+ break;
+ }
+
+ /*
+ * Y coordinate adjustment:
+ */
+ switch (sticky & (TTK_STICK_N | TTK_STICK_S))
+ {
+ case TTK_STICK_N | TTK_STICK_S:
+ /* use entire parcel height */
+ break;
+ case TTK_STICK_N:
+ parcel.height = height;
+ break;
+ case TTK_STICK_S:
+ parcel.y += dy;
+ parcel.height = height;
+ break;
+ default :
+ parcel.y += dy / 2;
+ parcel.height = height;
+ break;
+ }
+
+ return parcel;
+}
+
+/*
+ * AnchorToSticky --
+ * Convert a Tk_Anchor enum to a TTK_STICKY bitmask.
+ */
+static Ttk_Sticky AnchorToSticky(Tk_Anchor anchor)
+{
+ switch (anchor)
+ {
+ case TK_ANCHOR_N: return TTK_STICK_N;
+ case TK_ANCHOR_NE: return TTK_STICK_N | TTK_STICK_E;
+ case TK_ANCHOR_E: return TTK_STICK_E;
+ case TK_ANCHOR_SE: return TTK_STICK_S | TTK_STICK_E;
+ case TK_ANCHOR_S: return TTK_STICK_S;
+ case TK_ANCHOR_SW: return TTK_STICK_S | TTK_STICK_W;
+ case TK_ANCHOR_W: return TTK_STICK_W;
+ case TK_ANCHOR_NW: return TTK_STICK_N | TTK_STICK_W;
+ default:
+ case TK_ANCHOR_CENTER: return 0;
+ }
+}
+
+/*
+ * Ttk_AnchorBox --
+ * Place a box of size w * h in the specified parcel,
+ * according to the specified anchor.
+ */
+Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int width, int height, Tk_Anchor anchor)
+{
+ return Ttk_StickBox(parcel, width, height, AnchorToSticky(anchor));
+}
+
+/*
+ * Ttk_PlaceBox --
+ * Combine Ttk_PackBox() and Ttk_StickBox().
+ */
+Ttk_Box Ttk_PlaceBox(
+ Ttk_Box *cavity, int width, int height, Ttk_Side side, unsigned sticky)
+{
+ return Ttk_StickBox(
+ Ttk_PackBox(cavity, width, height, side), width, height, sticky);
+}
+
+/*
+ * Ttk_PositionBox --
+ * Pack and stick a box according to PositionSpec flags.
+ */
+MODULE_SCOPE Ttk_Box
+Ttk_PositionBox(Ttk_Box *cavity, int width, int height, Ttk_PositionSpec flags)
+{
+ Ttk_Box parcel;
+
+ if (flags & TTK_EXPAND) parcel = *cavity;
+ else if (flags & TTK_PACK_TOP) parcel = packTop(cavity, height);
+ else if (flags & TTK_PACK_LEFT) parcel = packLeft(cavity, width);
+ else if (flags & TTK_PACK_BOTTOM) parcel = packBottom(cavity, height);
+ else if (flags & TTK_PACK_RIGHT) parcel = packRight(cavity, width);
+ else parcel = *cavity;
+
+ return Ttk_StickBox(parcel, width, height, flags);
+}
+
+/*
+ * TTKInitPadding --
+ * Common factor of Ttk_GetPaddingFromObj and Ttk_GetBorderFromObj.
+ * Initializes Ttk_Padding record, supplying default values
+ * for missing entries.
+ */
+static void TTKInitPadding(int padc, int pixels[4], Ttk_Padding *pad)
+{
+ switch (padc)
+ {
+ case 0: pixels[0] = 0; /*FALLTHRU*/
+ case 1: pixels[1] = pixels[0]; /*FALLTHRU*/
+ case 2: pixels[2] = pixels[0]; /*FALLTHRU*/
+ case 3: pixels[3] = pixels[1]; /*FALLTHRU*/
+ }
+
+ pad->left = (short)pixels[0];
+ pad->top = (short)pixels[1];
+ pad->right = (short)pixels[2];
+ pad->bottom = (short)pixels[3];
+}
+
+/*
+ * Ttk_GetPaddingFromObj --
+ *
+ * Extract a padding specification from a Tcl_Obj * scaled
+ * to work with a particular Tk_Window.
+ *
+ * The string representation of a Ttk_Padding is a list
+ * of one to four Tk_Pixel specifications, corresponding
+ * to the left, top, right, and bottom padding.
+ *
+ * If the 'bottom' (fourth) element is missing, it defaults to 'top'.
+ * If the 'right' (third) element is missing, it defaults to 'left'.
+ * If the 'top' (second) element is missing, it defaults to 'left'.
+ *
+ * The internal representation is a Tcl_ListObj containing
+ * one to four Tk_PixelObj objects.
+ *
+ * Returns:
+ * TCL_OK or TCL_ERROR. In the latter case an error message is
+ * left in 'interp' and '*paddingPtr' is set to all-zeros.
+ * Otherwise, *paddingPtr is filled in with the padding specification.
+ *
+ */
+int Ttk_GetPaddingFromObj(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr,
+ Ttk_Padding *pad)
+{
+ Tcl_Obj **padv;
+ int i, padc, pixels[4];
+
+ if (TCL_OK != Tcl_ListObjGetElements(interp, objPtr, &padc, &padv)) {
+ goto error;
+ }
+
+ if (padc > 4) {
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Wrong #elements in padding spec", NULL);
+ }
+ goto error;
+ }
+
+ for (i=0; i < padc; ++i) {
+ if (Tk_GetPixelsFromObj(interp, tkwin, padv[i], &pixels[i]) != TCL_OK) {
+ goto error;
+ }
+ }
+
+ TTKInitPadding(padc, pixels, pad);
+ return TCL_OK;
+
+error:
+ pad->left = pad->top = pad->right = pad->bottom = 0;
+ return TCL_ERROR;
+}
+
+/* Ttk_GetBorderFromObj --
+ * Same as Ttk_GetPaddingFromObj, except padding is a list of integers
+ * instead of Tk_Pixel specifications. Does not require a Tk_Window
+ * parameter.
+ *
+ */
+int Ttk_GetBorderFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *pad)
+{
+ Tcl_Obj **padv;
+ int i, padc, pixels[4];
+
+ if (TCL_OK != Tcl_ListObjGetElements(interp, objPtr, &padc, &padv)) {
+ goto error;
+ }
+
+ if (padc > 4) {
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Wrong #elements in border spec", NULL);
+ }
+ goto error;
+ }
+
+ for (i=0; i < padc; ++i) {
+ if (Tcl_GetIntFromObj(interp, padv[i], &pixels[i]) != TCL_OK) {
+ goto error;
+ }
+ }
+
+ TTKInitPadding(padc, pixels, pad);
+ return TCL_OK;
+
+error:
+ pad->left = pad->top = pad->right = pad->bottom = 0;
+ return TCL_ERROR;
+}
+
+/*
+ * Ttk_MakePadding --
+ * Return an initialized Ttk_Padding structure.
+ */
+Ttk_Padding Ttk_MakePadding(short left, short top, short right, short bottom)
+{
+ Ttk_Padding pad;
+ pad.left = left;
+ pad.top = top;
+ pad.right = right;
+ pad.bottom = bottom;
+ return pad;
+}
+
+/*
+ * Ttk_UniformPadding --
+ * Returns a uniform Ttk_Padding structure, with the same
+ * border width on all sides.
+ */
+Ttk_Padding Ttk_UniformPadding(short borderWidth)
+{
+ Ttk_Padding pad;
+ pad.left = pad.top = pad.right = pad.bottom = borderWidth;
+ return pad;
+}
+
+/*
+ * Ttk_AddPadding --
+ * Combine two padding records.
+ */
+Ttk_Padding Ttk_AddPadding(Ttk_Padding p1, Ttk_Padding p2)
+{
+ p1.left += p2.left;
+ p1.top += p2.top;
+ p1.right += p2.right;
+ p1.bottom += p2.bottom;
+ return p1;
+}
+
+/* Ttk_RelievePadding --
+ * Add an extra n pixels of padding according to specified relief.
+ * This may be used in element geometry procedures to simulate
+ * a "pressed-in" look for pushbuttons.
+ */
+Ttk_Padding Ttk_RelievePadding(Ttk_Padding padding, int relief, int n)
+{
+ switch (relief)
+ {
+ case TK_RELIEF_RAISED:
+ padding.right += n;
+ padding.bottom += n;
+ break;
+ case TK_RELIEF_SUNKEN: /* shift */
+ padding.left += n;
+ padding.top += n;
+ break;
+ default:
+ {
+ int h1 = n/2, h2 = h1 + n % 2;
+ padding.left += h1;
+ padding.top += h1;
+ padding.right += h2;
+ padding.bottom += h2;
+ break;
+ }
+ }
+ return padding;
+}
+
+/*
+ * Ttk_GetStickyFromObj --
+ * Returns a stickiness specification from the specified Tcl_Obj*,
+ * consisting of any combination of n, s, e, and w.
+ *
+ * Returns: TCL_OK if objPtr holds a valid stickiness specification,
+ * otherwise TCL_ERROR. interp is used for error reporting if non-NULL.
+ *
+ */
+int Ttk_GetStickyFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Sticky *result)
+{
+ const char *string = Tcl_GetString(objPtr);
+ Ttk_Sticky sticky = 0;
+ char c;
+
+ while ((c = *string++) != '\0') {
+ switch (c) {
+ case 'w': case 'W': sticky |= TTK_STICK_W; break;
+ case 'e': case 'E': sticky |= TTK_STICK_E; break;
+ case 'n': case 'N': sticky |= TTK_STICK_N; break;
+ case 's': case 'S': sticky |= TTK_STICK_S; break;
+ default:
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Bad -sticky specification ",
+ Tcl_GetString(objPtr),
+ NULL);
+ }
+ return TCL_ERROR;
+ }
+ }
+
+ *result = sticky;
+ return TCL_OK;
+}
+
+/* Ttk_NewStickyObj --
+ * Construct a new Tcl_Obj * containing a stickiness specification.
+ */
+Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky sticky)
+{
+ char buf[5];
+ char *p = buf;
+
+ if (sticky & TTK_STICK_N) *p++ = 'n';
+ if (sticky & TTK_STICK_S) *p++ = 's';
+ if (sticky & TTK_STICK_W) *p++ = 'w';
+ if (sticky & TTK_STICK_E) *p++ = 'e';
+
+ *p = '\0';
+ return Tcl_NewStringObj(buf, p - buf);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Layout nodes.
+ */
+
+typedef struct Ttk_LayoutNode_ Ttk_LayoutNode;
+struct Ttk_LayoutNode_
+{
+ unsigned flags; /* Packing and sticky flags */
+ Ttk_ElementClass *eclass; /* Class record */
+ Ttk_State state; /* Current state */
+ Ttk_Box parcel; /* allocated parcel */
+ Ttk_LayoutNode *next, *child;
+};
+
+static Ttk_LayoutNode *Ttk_NewLayoutNode(
+ unsigned flags, Ttk_ElementClass *elementClass)
+{
+ Ttk_LayoutNode *node = (Ttk_LayoutNode*)ckalloc(sizeof(*node));
+
+ node->flags = flags;
+ node->eclass = elementClass;
+ node->state = 0u;
+ node->next = node->child = 0;
+ node->parcel = Ttk_MakeBox(0,0,0,0);
+
+ return node;
+}
+
+static void Ttk_FreeLayoutNode(Ttk_LayoutNode *node)
+{
+ while (node) {
+ Ttk_LayoutNode *next = node->next;
+ Ttk_FreeLayoutNode(node->child);
+ ckfree((ClientData)node);
+ node = next;
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Layout templates.
+ */
+
+struct Ttk_TemplateNode_ {
+ char *name;
+ unsigned flags;
+ struct Ttk_TemplateNode_ *next, *child;
+};
+
+static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags)
+{
+ Ttk_TemplateNode *op = (Ttk_TemplateNode*)ckalloc(sizeof(*op));
+ op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name);
+ op->flags = flags;
+ op->next = op->child = 0;
+ return op;
+}
+
+void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate op)
+{
+ while (op) {
+ Ttk_LayoutTemplate next = op->next;
+ Ttk_FreeLayoutTemplate(op->child);
+ ckfree(op->name);
+ ckfree((ClientData)op);
+ op = next;
+ }
+}
+
+/* InstantiateLayout --
+ * Create a layout tree from a template.
+ */
+static Ttk_LayoutNode *
+Ttk_InstantiateLayout(Ttk_Theme theme, Ttk_TemplateNode *op)
+{
+ Ttk_ElementClass *elementClass = Ttk_GetElement(theme, op->name);
+ Ttk_LayoutNode *node = Ttk_NewLayoutNode(op->flags, elementClass);
+
+ if (op->next) {
+ node->next = Ttk_InstantiateLayout(theme,op->next);
+ }
+ if (op->child) {
+ node->child = Ttk_InstantiateLayout(theme,op->child);
+ }
+
+ return node;
+}
+
+/*
+ * Ttk_ParseLayoutTemplate --
+ * Convert a Tcl list into a layout template.
+ *
+ * Syntax:
+ * layoutSpec ::= { elementName ?-option value ...? }+
+ */
+
+/* NB: This must match bit definitions TTK_PACK_LEFT etc. */
+static const char *packSideStrings[] =
+ { "left", "right", "top", "bottom", NULL };
+
+Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr)
+{
+ enum { OP_SIDE, OP_STICKY, OP_EXPAND, OP_BORDER, OP_UNIT, OP_CHILDREN };
+ static const char *optStrings[] = {
+ "-side", "-sticky", "-expand", "-border", "-unit", "-children", 0 };
+
+ int i = 0, objc;
+ Tcl_Obj **objv;
+ Ttk_TemplateNode *head = 0, *tail = 0;
+
+ if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK)
+ return 0;
+
+ while (i < objc) {
+ const char *elementName = Tcl_GetString(objv[i]);
+ unsigned flags = 0x0, sticky = TTK_FILL_BOTH;
+ Tcl_Obj *childSpec = 0;
+
+ /*
+ * Parse options:
+ */
+ ++i;
+ while (i < objc) {
+ const char *optName = Tcl_GetString(objv[i]);
+ int option, value;
+
+ if (optName[0] != '-')
+ break;
+
+ if (Tcl_GetIndexFromObj(
+ interp, objv[i], optStrings, "option", 0, &option)
+ != TCL_OK)
+ {
+ goto error;
+ }
+
+ if (++i >= objc) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Missing value for option ",Tcl_GetString(objv[i-1]),
+ NULL);
+ goto error;
+ }
+
+ switch (option) {
+ case OP_SIDE: /* <<NOTE-PACKSIDE>> */
+ if (Tcl_GetIndexFromObj(interp, objv[i], packSideStrings,
+ "side", 0, &value) != TCL_OK)
+ {
+ goto error;
+ }
+ flags |= (TTK_PACK_LEFT << value);
+
+ break;
+ case OP_STICKY:
+ if (Ttk_GetStickyFromObj(interp,objv[i],&sticky) != TCL_OK)
+ goto error;
+ break;
+ case OP_EXPAND:
+ if (Tcl_GetBooleanFromObj(interp,objv[i],&value) != TCL_OK)
+ goto error;
+ if (value)
+ flags |= TTK_EXPAND;
+ break;
+ case OP_BORDER:
+ if (Tcl_GetBooleanFromObj(interp,objv[i],&value) != TCL_OK)
+ goto error;
+ if (value)
+ flags |= TTK_BORDER;
+ break;
+ case OP_UNIT:
+ if (Tcl_GetBooleanFromObj(interp,objv[i],&value) != TCL_OK)
+ goto error;
+ if (value)
+ flags |= TTK_UNIT;
+ break;
+ case OP_CHILDREN:
+ childSpec = objv[i];
+ break;
+ }
+ ++i;
+ }
+
+ /*
+ * Build new node:
+ */
+ if (tail) {
+ tail->next = Ttk_NewTemplateNode(elementName, flags | sticky);
+ tail = tail->next;
+ } else {
+ head = tail = Ttk_NewTemplateNode(elementName, flags | sticky);
+ }
+ if (childSpec) {
+ tail->child = Ttk_ParseLayoutTemplate(interp, childSpec);
+ if (!tail->child) {
+ goto error;
+ }
+ }
+ }
+
+ return head;
+
+error:
+ Ttk_FreeLayoutTemplate(head);
+ return 0;
+}
+
+/* Ttk_BuildLayoutTemplate --
+ * Build a layout template tree from a statically defined
+ * Ttk_LayoutSpec array.
+ */
+Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec spec)
+{
+ Ttk_TemplateNode *first = 0, *last = 0;
+
+ for ( ; !(spec->opcode & _TTK_LAYOUT_END) ; ++spec) {
+ if (spec->elementName) {
+ Ttk_TemplateNode *node =
+ Ttk_NewTemplateNode(spec->elementName, spec->opcode);
+
+ if (last) {
+ last->next = node;
+ } else {
+ first = node;
+ }
+ last = node;
+ }
+
+ if (spec->opcode & _TTK_CHILDREN && last) {
+ int depth = 1;
+ last->child = Ttk_BuildLayoutTemplate(spec+1);
+
+ /* Skip to end of group:
+ */
+ while (depth) {
+ ++spec;
+ if (spec->opcode & _TTK_CHILDREN) {
+ ++depth;
+ }
+ if (spec->opcode & _TTK_LAYOUT_END) {
+ --depth;
+ }
+ }
+ }
+
+ } /* for */
+
+ return first;
+}
+
+void Ttk_RegisterLayouts(Ttk_Theme theme, Ttk_LayoutSpec spec)
+{
+ while (!(spec->opcode & _TTK_LAYOUT_END)) {
+ Ttk_LayoutTemplate layoutTemplate = Ttk_BuildLayoutTemplate(spec+1);
+ Ttk_RegisterLayoutTemplate(theme, spec->elementName, layoutTemplate);
+ do {
+ ++spec;
+ } while (!(spec->opcode & _TTK_LAYOUT));
+ }
+}
+
+Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node)
+{
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+
+# define APPENDOBJ(obj) Tcl_ListObjAppendElement(NULL, result, obj)
+# define APPENDSTR(str) APPENDOBJ(Tcl_NewStringObj(str,-1))
+
+ while (node) {
+ unsigned flags = node->flags;
+
+ APPENDSTR(node->name);
+
+ /* Back-compute -side. <<NOTE-PACKSIDE>>
+ * @@@ NOTES: Ick.
+ */
+ if (flags & TTK_EXPAND) {
+ APPENDSTR("-expand");
+ APPENDSTR("1");
+ } else {
+ if (flags & _TTK_MASK_PACK) {
+ int side = 0;
+ unsigned sideFlags = flags & _TTK_MASK_PACK;
+
+ while ((sideFlags & TTK_PACK_LEFT) == 0) {
+ ++side;
+ sideFlags >>= 1;
+ }
+ APPENDSTR("-side");
+ APPENDSTR(packSideStrings[side]);
+ }
+ }
+
+ /* In Ttk_ParseLayoutTemplate, default -sticky is "nsew",
+ * so always include this even if no sticky bits are set.
+ */
+ APPENDSTR("-sticky");
+ APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK));
+
+ /* @@@ Check again: are these necessary? */
+ if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); }
+ if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); }
+
+ if (node->child) {
+ APPENDSTR("-children");
+ APPENDOBJ(Ttk_UnparseLayoutTemplate(node->child));
+ }
+ node = node->next;
+ }
+
+# undef APPENDOBJ
+# undef APPENDSTR
+
+ return result;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Layouts.
+ */
+struct Ttk_Layout_
+{
+ Ttk_Style style;
+ void *recordPtr;
+ Tk_OptionTable optionTable;
+ Tk_Window tkwin;
+ Ttk_LayoutNode *root;
+};
+
+static Ttk_Layout TTKNewLayout(
+ Ttk_Style style,
+ void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin,
+ Ttk_LayoutNode *root)
+{
+ Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout));
+ layout->style = style;
+ layout->recordPtr = recordPtr;
+ layout->optionTable = optionTable;
+ layout->tkwin = tkwin;
+ layout->root = root;
+ return layout;
+}
+
+void Ttk_FreeLayout(Ttk_Layout layout)
+{
+ Ttk_FreeLayoutNode(layout->root);
+ ckfree((ClientData)layout);
+}
+
+/*
+ * Ttk_CreateLayout --
+ * Create a layout from the specified theme and style name.
+ * Returns: New layout, 0 on error.
+ * Leaves an error message in interp's result if there is an error.
+ */
+Ttk_Layout Ttk_CreateLayout(
+ Tcl_Interp *interp, /* where to leave error messages */
+ Ttk_Theme themePtr,
+ const char *styleName,
+ void *recordPtr,
+ Tk_OptionTable optionTable,
+ Tk_Window tkwin)
+{
+ Ttk_Style style = Ttk_GetStyle(themePtr, styleName);
+ Ttk_LayoutTemplate layoutTemplate =
+ Ttk_FindLayoutTemplate(themePtr,styleName);
+ Ttk_ElementClass *bgelement = Ttk_GetElement(themePtr, "background");
+ Ttk_LayoutNode *bgnode;
+
+ if (!layoutTemplate) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Layout ", styleName, " not found", NULL);
+ return 0;
+ }
+
+ bgnode = Ttk_NewLayoutNode(TTK_FILL_BOTH, bgelement);
+ bgnode->next = Ttk_InstantiateLayout(themePtr, layoutTemplate);
+
+ return TTKNewLayout(style, recordPtr, optionTable, tkwin, bgnode);
+}
+
+/* Ttk_CreateSublayout --
+ * Creates a new sublayout.
+ *
+ * Sublayouts are used to draw subparts of a compound widget.
+ * They use the same Tk_Window, but a different option table
+ * and data record.
+ */
+Ttk_Layout
+Ttk_CreateSublayout(
+ Tcl_Interp *interp,
+ Ttk_Theme themePtr,
+ Ttk_Layout parentLayout,
+ const char *baseName,
+ Tk_OptionTable optionTable)
+{
+ Tcl_DString buf;
+ const char *styleName;
+ Ttk_Style style;
+ Ttk_LayoutTemplate layoutTemplate;
+
+ Tcl_DStringInit(&buf);
+ Tcl_DStringAppend(&buf, Ttk_StyleName(parentLayout->style), -1);
+ Tcl_DStringAppend(&buf, baseName, -1);
+ styleName = Tcl_DStringValue(&buf);
+
+ style = Ttk_GetStyle(themePtr, styleName);
+ layoutTemplate = Ttk_FindLayoutTemplate(themePtr, styleName);
+
+ if (!layoutTemplate) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Layout ", styleName, " not found", NULL);
+ return 0;
+ }
+
+ Tcl_DStringFree(&buf);
+
+ return TTKNewLayout(
+ style, 0, optionTable, parentLayout->tkwin,
+ Ttk_InstantiateLayout(themePtr, layoutTemplate));
+}
+
+/* Ttk_RebindSublayout --
+ * Bind sublayout to new data source.
+ */
+void Ttk_RebindSublayout(Ttk_Layout layout, void *recordPtr)
+{
+ layout->recordPtr = recordPtr;
+}
+
+/*
+ * Ttk_QueryOption --
+ * Look up an option from a layout's associated option.
+ */
+Tcl_Obj *Ttk_QueryOption(
+ Ttk_Layout layout, const char *optionName, Ttk_State state)
+{
+ return Ttk_QueryStyle(
+ layout->style,layout->recordPtr,layout->optionTable,optionName,state);
+}
+
+/*
+ * Ttk_LayoutStyle --
+ * Extract Ttk_Style from Ttk_Layout.
+ */
+Ttk_Style Ttk_LayoutStyle(Ttk_Layout layout)
+{
+ return layout->style;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Size computation.
+ */
+static void Ttk_NodeListSize(
+ Ttk_Layout layout, Ttk_LayoutNode *node,
+ Ttk_State state, int *widthPtr, int *heightPtr); /* Forward */
+
+static void Ttk_NodeSize(
+ Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_State state,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ int elementWidth, elementHeight, subWidth, subHeight;
+ Ttk_Padding elementPadding;
+
+ Ttk_ElementSize(node->eclass,
+ layout->style, layout->recordPtr,layout->optionTable, layout->tkwin,
+ state|node->state,
+ &elementWidth, &elementHeight, &elementPadding);
+
+ Ttk_NodeListSize(layout,node->child,state,&subWidth,&subHeight);
+ subWidth += Ttk_PaddingWidth(elementPadding);
+ subHeight += Ttk_PaddingHeight(elementPadding);
+
+ *widthPtr = MAX(elementWidth, subWidth);
+ *heightPtr = MAX(elementHeight, subHeight);
+ *paddingPtr = elementPadding;
+}
+
+static void Ttk_NodeListSize(
+ Ttk_Layout layout, Ttk_LayoutNode *node,
+ Ttk_State state, int *widthPtr, int *heightPtr)
+{
+ if (!node) {
+ *widthPtr = *heightPtr = 0;
+ } else {
+ int width, height, restWidth, restHeight;
+ Ttk_Padding unused;
+
+ Ttk_NodeSize(layout, node, state, &width, &height, &unused);
+ Ttk_NodeListSize(layout, node->next, state, &restWidth, &restHeight);
+
+ if (node->flags & (TTK_PACK_LEFT|TTK_PACK_RIGHT)) {
+ *widthPtr = width + restWidth;
+ } else {
+ *widthPtr = MAX(width, restWidth);
+ }
+
+ if (node->flags & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) {
+ *heightPtr = height + restHeight;
+ } else {
+ *heightPtr = MAX(height, restHeight);
+ }
+ }
+}
+
+/*
+ * Ttk_LayoutNodeInternalPadding --
+ * Returns the internal padding of a layout node.
+ */
+Ttk_Padding Ttk_LayoutNodeInternalPadding(
+ Ttk_Layout layout, Ttk_LayoutNode *node)
+{
+ int unused;
+ Ttk_Padding padding;
+ Ttk_ElementSize(node->eclass,
+ layout->style, layout->recordPtr, layout->optionTable, layout->tkwin,
+ 0/*state*/, &unused, &unused, &padding);
+ return padding;
+}
+
+/*
+ * Ttk_LayoutNodeInternalParcel --
+ * Returns the inner area of a specified layout node,
+ * based on current parcel and element's internal padding.
+ */
+Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout layout, Ttk_LayoutNode *node)
+{
+ Ttk_Padding padding = Ttk_LayoutNodeInternalPadding(layout, node);
+ return Ttk_PadBox(node->parcel, padding);
+}
+
+/* Ttk_LayoutSize --
+ * Compute requested size of a layout.
+ */
+void Ttk_LayoutSize(
+ Ttk_Layout layout, Ttk_State state, int *widthPtr, int *heightPtr)
+{
+ Ttk_NodeListSize(layout, layout->root, state, widthPtr, heightPtr);
+}
+
+void Ttk_LayoutNodeReqSize( /* @@@ Rename this */
+ Ttk_Layout layout, Ttk_LayoutNode *node, int *widthPtr, int *heightPtr)
+{
+ Ttk_Padding unused;
+ Ttk_NodeSize(layout, node, 0/*state*/, widthPtr, heightPtr, &unused);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Layout placement.
+ */
+
+/* Ttk_PlaceNodeList --
+ * Compute parcel for each node in a layout tree
+ * according to position specification and overall size.
+ */
+static void Ttk_PlaceNodeList(
+ Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_State state, Ttk_Box cavity)
+{
+ for (; node; node = node->next)
+ {
+ int width, height;
+ Ttk_Padding padding;
+
+ /* Compute node size: (@@@ cache this instead?)
+ */
+ Ttk_NodeSize(layout, node, state, &width, &height, &padding);
+
+ /* Compute parcel:
+ */
+ node->parcel = Ttk_PositionBox(&cavity, width, height, node->flags);
+
+ /* Place child nodes:
+ */
+ if (node->child) {
+ Ttk_Box childBox = Ttk_PadBox(node->parcel, padding);
+ Ttk_PlaceNodeList(layout,node->child, state, childBox);
+ }
+ }
+}
+
+void Ttk_PlaceLayout(Ttk_Layout layout, Ttk_State state, Ttk_Box b)
+{
+ Ttk_PlaceNodeList(layout, layout->root, state, b);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Layout drawing.
+ */
+
+/*
+ * Ttk_DrawLayout --
+ * Draw a layout tree.
+ */
+static void Ttk_DrawNodeList(
+ Ttk_Layout layout, Ttk_State state, Ttk_LayoutNode *node, Drawable d)
+{
+ for (; node; node = node->next)
+ {
+ int border = node->flags & TTK_BORDER;
+ int substate = state;
+
+ if (node->flags & TTK_UNIT)
+ substate |= node->state;
+
+ if (node->child && border)
+ Ttk_DrawNodeList(layout, substate, node->child, d);
+
+ Ttk_DrawElement(
+ node->eclass,
+ layout->style,layout->recordPtr,layout->optionTable,layout->tkwin,
+ d, node->parcel, state | node->state);
+
+ if (node->child && !border)
+ Ttk_DrawNodeList(layout, substate, node->child, d);
+ }
+}
+
+void Ttk_DrawLayout(Ttk_Layout layout, Ttk_State state, Drawable d)
+{
+ Ttk_DrawNodeList(layout, state, layout->root, d);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Inquiry and modification.
+ */
+
+/*
+ * Ttk_IdentifyElement --
+ * Find the element at the specified x,y coordinate.
+ */
+static Ttk_Element IdentifyNode(Ttk_Element node, int x, int y)
+{
+ Ttk_Element closest = NULL;
+
+ for (; node; node = node->next) {
+ if (Ttk_BoxContains(node->parcel, x, y)) {
+ closest = node;
+ if (node->child && !(node->flags & TTK_UNIT)) {
+ Ttk_Element childNode = IdentifyNode(node->child, x,y);
+ if (childNode) {
+ closest = childNode;
+ }
+ }
+ }
+ }
+ return closest;
+}
+
+Ttk_Element Ttk_IdentifyElement(Ttk_Layout layout, int x, int y)
+{
+ return IdentifyNode(layout->root, x, y);
+}
+
+/*
+ * tail --
+ * Return the last component of an element name, e.g.,
+ * "Scrollbar.thumb" => "thumb"
+ */
+static const char *tail(const char *elementName)
+{
+ const char *dot;
+ while ((dot=strchr(elementName,'.')) != NULL)
+ elementName = dot + 1;
+ return elementName;
+}
+
+/*
+ * Ttk_FindElement --
+ * Look up an element by name
+ */
+static Ttk_Element
+FindNode(Ttk_Element node, const char *nodeName)
+{
+ for (; node ; node = node->next) {
+ if (!strcmp(tail(Ttk_ElementName(node)), nodeName))
+ return node;
+
+ if (node->child) {
+ Ttk_Element childNode = FindNode(node->child, nodeName);
+ if (childNode)
+ return childNode;
+ }
+ }
+ return 0;
+}
+
+Ttk_Element Ttk_FindElement(Ttk_Layout layout, const char *nodeName)
+{
+ return FindNode(layout->root, nodeName);
+}
+
+/*
+ * Ttk_ClientRegion --
+ * Find the internal parcel of a named element within a given layout.
+ * If the element is not present, use the entire window.
+ */
+Ttk_Box Ttk_ClientRegion(Ttk_Layout layout, const char *elementName)
+{
+ Ttk_Element element = Ttk_FindElement(layout, elementName);
+ return element
+ ? Ttk_LayoutNodeInternalParcel(layout, element)
+ : Ttk_WinBox(layout->tkwin)
+ ;
+}
+
+/*
+ * Ttk_ElementName --
+ * Return the name (class name) of the element.
+ */
+const char *Ttk_ElementName(Ttk_Element node)
+{
+ return Ttk_ElementClassName(node->eclass);
+}
+
+/*
+ * Ttk_ElementParcel --
+ * Return the element's current parcel.
+ */
+Ttk_Box Ttk_ElementParcel(Ttk_Element node)
+{
+ return node->parcel;
+}
+
+/*
+ * Ttk_PlaceElement --
+ * Explicitly specify an element's parcel.
+ */
+void Ttk_PlaceElement(Ttk_Layout layout, Ttk_Element node, Ttk_Box b)
+{
+ node->parcel = b;
+ if (node->child) {
+ Ttk_PlaceNodeList(layout, node->child, 0,
+ Ttk_PadBox(b, Ttk_LayoutNodeInternalPadding(layout, node)));
+ }
+}
+
+/*
+ * Ttk_ChangeElementState --
+ */
+void Ttk_ChangeElementState(Ttk_LayoutNode *node,unsigned set,unsigned clr)
+{
+ node->state = (node->state | set) & ~clr;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
new file mode 100644
index 0000000..ba9e5c0
--- /dev/null
+++ b/generic/ttk/ttkManager.c
@@ -0,0 +1,552 @@
+/*
+ * Copyright 2005, Joe English. Freely redistributable.
+ *
+ * Support routines for geometry managers.
+ */
+
+#include <string.h>
+#include <tk.h>
+#include "ttkManager.h"
+
+/*------------------------------------------------------------------------
+ * +++ The Geometry Propagation Dance.
+ *
+ * When a slave window requests a new size or some other parameter changes,
+ * the manager recomputes the required size for the master window and calls
+ * Tk_GeometryRequest(). This is scheduled as an idle handler so multiple
+ * updates can be processed as a single batch.
+ *
+ * If all goes well, the master's manager will process the request
+ * (and so on up the chain to the toplevel window), and the master
+ * window will eventually receive a <Configure> event. At this point
+ * it recomputes the size and position of all slaves and places them.
+ *
+ * If all does not go well, however, the master's request may be ignored
+ * (typically because the top-level window has a fixed, user-specified size).
+ * Tk doesn't provide any notification when this happens; to account for this,
+ * we also schedule an idle handler to call the layout procedure
+ * after making a geometry request.
+ *
+ * +++ Slave removal <<NOTE-LOSTSLAVE>>.
+ *
+ * There are three conditions under which a slave is removed:
+ *
+ * (1) Another GM claims control
+ * (2) Manager voluntarily relinquishes control
+ * (3) Slave is destroyed
+ *
+ * In case (1), Tk calls the manager's lostSlaveProc.
+ * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0);
+ * in this case Tk does _not_ call the LostSlaveProc (documented behavior).
+ * Tk doesn't handle case (3) either; to account for that we
+ * register an event handler on the slave widget to track <Destroy> events.
+ */
+
+/* ++ Data structures.
+ */
+typedef struct
+{
+ Tk_Window slaveWindow;
+ Ttk_Manager *manager;
+ void *slaveData;
+ unsigned flags;
+} Ttk_Slave;
+
+/* slave->flags bits:
+ */
+#define SLAVE_MAPPED 0x1 /* slave to be mapped when master is */
+
+struct TtkManager_
+{
+ Ttk_ManagerSpec *managerSpec;
+ void *managerData;
+ Tk_Window masterWindow;
+ unsigned flags;
+ int nSlaves;
+ Ttk_Slave **slaves;
+};
+
+/* manager->flags bits:
+ */
+#define MGR_UPDATE_PENDING 0x1
+#define MGR_RESIZE_REQUIRED 0x2
+#define MGR_RELAYOUT_REQUIRED 0x4
+
+static void ManagerIdleProc(void *); /* forward */
+
+/* ++ ScheduleUpdate --
+ * Schedule a call to recompute the size and/or layout,
+ * depending on flags.
+ */
+static void ScheduleUpdate(Ttk_Manager *mgr, unsigned flags)
+{
+ if (!(mgr->flags & MGR_UPDATE_PENDING)) {
+ Tcl_DoWhenIdle(ManagerIdleProc, mgr);
+ mgr->flags |= MGR_UPDATE_PENDING;
+ }
+ mgr->flags |= flags;
+}
+
+/* ++ RecomputeSize --
+ * Recomputes the required size of the master window,
+ * makes geometry request.
+ */
+static void RecomputeSize(Ttk_Manager *mgr)
+{
+ int width = 1, height = 1;
+
+ if (mgr->managerSpec->RequestedSize(mgr->managerData, &width, &height)) {
+ Tk_GeometryRequest(mgr->masterWindow, width, height);
+ ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED);
+ }
+ mgr->flags &= ~MGR_RESIZE_REQUIRED;
+}
+
+/* ++ RecomputeLayout --
+ * Recompute geometry of all slaves.
+ */
+static void RecomputeLayout(Ttk_Manager *mgr)
+{
+ mgr->managerSpec->PlaceSlaves(mgr->managerData);
+ mgr->flags &= ~MGR_RELAYOUT_REQUIRED;
+}
+
+/* ++ ManagerIdleProc --
+ * DoWhenIdle procedure for deferred updates.
+ */
+static void ManagerIdleProc(ClientData clientData)
+{
+ Ttk_Manager *mgr = clientData;
+ mgr->flags &= ~MGR_UPDATE_PENDING;
+
+ if (mgr->flags & MGR_RESIZE_REQUIRED) {
+ RecomputeSize(mgr);
+ }
+ if (mgr->flags & MGR_RELAYOUT_REQUIRED) {
+ if (mgr->flags & MGR_UPDATE_PENDING) {
+ /* RecomputeSize has scheduled another update; relayout later */
+ return;
+ }
+ RecomputeLayout(mgr);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Event handlers.
+ */
+
+/* ++ ManagerEventHandler --
+ * Recompute slave layout when master widget is resized.
+ * Keep the slave's map state in sync with the master's.
+ */
+static const int ManagerEventMask = StructureNotifyMask;
+static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
+{
+ Ttk_Manager *mgr = clientData;
+ int i;
+
+ switch (eventPtr->type)
+ {
+ case ConfigureNotify:
+ RecomputeLayout(mgr);
+ break;
+ case MapNotify:
+ for (i = 0; i < mgr->nSlaves; ++i) {
+ Ttk_Slave *slave = mgr->slaves[i];
+ if (slave->flags & SLAVE_MAPPED) {
+ Tk_MapWindow(slave->slaveWindow);
+ }
+ }
+ break;
+ case UnmapNotify:
+ for (i = 0; i < mgr->nSlaves; ++i) {
+ Ttk_Slave *slave = mgr->slaves[i];
+ Tk_UnmapWindow(slave->slaveWindow);
+ }
+ break;
+ }
+}
+
+/* ++ SlaveEventHandler --
+ * Notifies manager when a slave is destroyed
+ * (see <<NOTE-LOSTSLAVE>>).
+ */
+static const unsigned SlaveEventMask = StructureNotifyMask;
+static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr)
+{
+ Ttk_Slave *slave = clientData;
+ if (eventPtr->type == DestroyNotify) {
+ slave->manager->managerSpec->tkGeomMgr.lostSlaveProc(
+ slave->manager, slave->slaveWindow);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Slave initialization and cleanup.
+ */
+
+static Ttk_Slave *NewSlave(
+ Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData)
+{
+ Ttk_Slave *slave = (Ttk_Slave*)ckalloc(sizeof(*slave));
+
+ slave->slaveWindow = slaveWindow;
+ slave->manager = mgr;
+ slave->flags = 0;
+ slave->slaveData = slaveData;
+
+ return slave;
+}
+
+static void DeleteSlave(Ttk_Slave *slave)
+{
+ ckfree((ClientData)slave);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Manager initialization and cleanup.
+ */
+
+Ttk_Manager *Ttk_CreateManager(
+ Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow)
+{
+ Ttk_Manager *mgr = (Ttk_Manager*)ckalloc(sizeof(*mgr));
+
+ mgr->managerSpec = managerSpec;
+ mgr->managerData = managerData;
+ mgr->masterWindow = masterWindow;
+ mgr->nSlaves = 0;
+ mgr->slaves = NULL;
+ mgr->flags = 0;
+
+ Tk_CreateEventHandler(
+ mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+
+ return mgr;
+}
+
+void Ttk_DeleteManager(Ttk_Manager *mgr)
+{
+ Tk_DeleteEventHandler(
+ mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+
+ while (mgr->nSlaves > 0) {
+ Ttk_ForgetSlave(mgr, mgr->nSlaves - 1);
+ }
+ if (mgr->slaves) {
+ ckfree((ClientData)mgr->slaves);
+ }
+
+ Tk_CancelIdleCall(ManagerIdleProc, mgr);
+
+ ckfree((ClientData)mgr);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Slave management.
+ */
+
+/* ++ InsertSlave --
+ * Adds slave to the list of managed windows.
+ */
+static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index)
+{
+ int endIndex = mgr->nSlaves++;
+ mgr->slaves = (Ttk_Slave**)ckrealloc(
+ (ClientData)mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *));
+
+ while (endIndex > index) {
+ mgr->slaves[endIndex] = mgr->slaves[endIndex - 1];
+ --endIndex;
+ }
+
+ mgr->slaves[index] = slave;
+
+ Tk_ManageGeometry(slave->slaveWindow,
+ &mgr->managerSpec->tkGeomMgr, (ClientData)mgr);
+
+ Tk_CreateEventHandler(slave->slaveWindow,
+ SlaveEventMask, SlaveEventHandler, (ClientData)slave);
+
+ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
+}
+
+/* RemoveSlave --
+ * Unmanage and delete the slave.
+ *
+ * NOTES/ASSUMPTIONS:
+ *
+ * [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this
+ * routine is called from the slave's DestroyNotify event handler.
+ */
+static void RemoveSlave(Ttk_Manager *mgr, int index)
+{
+ Ttk_Slave *slave = mgr->slaves[index];
+ int i;
+
+ /* Notify manager:
+ */
+ mgr->managerSpec->SlaveRemoved(mgr->managerData, index);
+
+ /* Remove from array:
+ */
+ --mgr->nSlaves;
+ for (i = index ; i < mgr->nSlaves; ++i) {
+ mgr->slaves[i] = mgr->slaves[i+1];
+ }
+
+ /* Clean up:
+ */
+ Tk_DeleteEventHandler(
+ slave->slaveWindow, SlaveEventMask, SlaveEventHandler, slave);
+
+ /* Note [1] */
+ Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
+ Tk_UnmapWindow(slave->slaveWindow);
+
+ DeleteSlave(slave);
+
+ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Tk_GeomMgr hooks.
+ */
+
+void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow)
+{
+ Ttk_Manager *mgr = clientData;
+ int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow);
+ int reqWidth = Tk_ReqWidth(slaveWindow);
+ int reqHeight= Tk_ReqHeight(slaveWindow);
+
+ if (mgr->managerSpec->SlaveRequest(
+ mgr->managerData, slaveIndex, reqWidth, reqHeight))
+ {
+ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
+ }
+}
+
+void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow)
+{
+ Ttk_Manager *mgr = clientData;
+ int index = Ttk_SlaveIndex(mgr, slaveWindow);
+
+ /* ASSERT: index >= 0 */
+ RemoveSlave(mgr, index);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Public API.
+ */
+
+/* ++ Ttk_InsertSlave --
+ * Add a new slave window at the specified index.
+ */
+void Ttk_InsertSlave(
+ Ttk_Manager *mgr, int index, Tk_Window tkwin, void *slaveData)
+{
+ Ttk_Slave *slave = NewSlave(mgr, tkwin, slaveData);
+ InsertSlave(mgr, slave, index);
+}
+
+/* ++ Ttk_ForgetSlave --
+ * Unmanage the specified slave.
+ */
+void Ttk_ForgetSlave(Ttk_Manager *mgr, int slaveIndex)
+{
+ Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow;
+ RemoveSlave(mgr, slaveIndex);
+ Tk_ManageGeometry(slaveWindow, NULL, 0);
+}
+
+/* ++ Ttk_PlaceSlave --
+ * Set the position and size of the specified slave window.
+ *
+ * NOTES:
+ * Contrary to documentation, Tk_MaintainGeometry doesn't always
+ * map the slave.
+ */
+void Ttk_PlaceSlave(
+ Ttk_Manager *mgr, int slaveIndex, int x, int y, int width, int height)
+{
+ Ttk_Slave *slave = mgr->slaves[slaveIndex];
+ Tk_MaintainGeometry(slave->slaveWindow,mgr->masterWindow,x,y,width,height);
+ slave->flags |= SLAVE_MAPPED;
+ if (Tk_IsMapped(mgr->masterWindow)) {
+ Tk_MapWindow(slave->slaveWindow);
+ }
+}
+
+/* ++ Ttk_UnmapSlave --
+ * Unmap the specified slave, but leave it managed.
+ */
+void Ttk_UnmapSlave(Ttk_Manager *mgr, int slaveIndex)
+{
+ Ttk_Slave *slave = mgr->slaves[slaveIndex];
+ Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
+ slave->flags &= ~SLAVE_MAPPED;
+ /* Contrary to documentation, Tk_UnmaintainGeometry doesn't always
+ * unmap the slave:
+ */
+ Tk_UnmapWindow(slave->slaveWindow);
+}
+
+/* LayoutChanged, SizeChanged --
+ * Schedule a relayout, resp. resize request.
+ */
+void Ttk_ManagerLayoutChanged(Ttk_Manager *mgr)
+{
+ ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED);
+}
+
+void Ttk_ManagerSizeChanged(Ttk_Manager *mgr)
+{
+ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
+}
+
+/* +++ Accessors.
+ */
+int Ttk_NumberSlaves(Ttk_Manager *mgr)
+{
+ return mgr->nSlaves;
+}
+void *Ttk_SlaveData(Ttk_Manager *mgr, int slaveIndex)
+{
+ return mgr->slaves[slaveIndex]->slaveData;
+}
+Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, int slaveIndex)
+{
+ return mgr->slaves[slaveIndex]->slaveWindow;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Utility routines.
+ */
+
+/* ++ Ttk_SlaveIndex --
+ * Returns the index of specified slave window, -1 if not found.
+ */
+int Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow)
+{
+ int index;
+ for (index = 0; index < mgr->nSlaves; ++index)
+ if (mgr->slaves[index]->slaveWindow == slaveWindow)
+ return index;
+ return -1;
+}
+
+/* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) --
+ * Return the index of the slave specified by objPtr.
+ * Slaves may be specified as an integer index or
+ * as the name of the managed window.
+ *
+ * Returns:
+ * Standard Tcl completion code. Leaves an error message in case of error.
+ */
+
+int Ttk_GetSlaveIndexFromObj(
+ Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, int *indexPtr)
+{
+ const char *string = Tcl_GetString(objPtr);
+ int slaveIndex = 0;
+ Tk_Window tkwin;
+
+ /* Try interpreting as an integer first:
+ */
+ if (Tcl_GetIntFromObj(NULL, objPtr, &slaveIndex) == TCL_OK) {
+ if (slaveIndex < 0 || slaveIndex >= mgr->nSlaves) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Slave index ", Tcl_GetString(objPtr), " out of bounds",
+ NULL);
+ return TCL_ERROR;
+ }
+ *indexPtr = slaveIndex;
+ return TCL_OK;
+ }
+
+ /* Try interpreting as a slave window name;
+ */
+ if ( (*string == '.')
+ && (tkwin = Tk_NameToWindow(interp, string, mgr->masterWindow)))
+ {
+ slaveIndex = Ttk_SlaveIndex(mgr, tkwin);
+ if (slaveIndex < 0) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ string, " is not managed by ", Tk_PathName(mgr->masterWindow),
+ NULL);
+ return TCL_ERROR;
+ }
+ *indexPtr = slaveIndex;
+ return TCL_OK;
+ }
+
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Invalid slave specification ", string, NULL);
+ return TCL_ERROR;
+}
+
+/* ++ Ttk_ReorderSlave(mgr, fromIndex, toIndex) --
+ * Change slave order.
+ */
+void Ttk_ReorderSlave(Ttk_Manager *mgr, int fromIndex, int toIndex)
+{
+ Ttk_Slave *moved = mgr->slaves[fromIndex];
+
+ /* Shuffle down: */
+ while (fromIndex > toIndex) {
+ mgr->slaves[fromIndex] = mgr->slaves[fromIndex - 1];
+ --fromIndex;
+ }
+ /* Or, shuffle up: */
+ while (fromIndex < toIndex) {
+ mgr->slaves[fromIndex] = mgr->slaves[fromIndex + 1];
+ ++fromIndex;
+ }
+ /* ASSERT: fromIndex == toIndex */
+ mgr->slaves[fromIndex] = moved;
+
+ /* Schedule a relayout. In general, rearranging slaves
+ * may also change the size:
+ */
+ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
+}
+
+/* ++ Ttk_Maintainable(interp, slave, master) --
+ * Utility routine. Verifies that 'master' may be used to maintain
+ * the geometry of 'slave' via Tk_MaintainGeometry:
+ *
+ * + 'master' is either 'slave's parent -OR-
+ * + 'master is a descendant of 'slave's parent.
+ * + 'slave' is not a toplevel window
+ * + 'slave' belongs to the same toplevel as 'master'
+ *
+ * Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'.
+ */
+int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
+{
+ Tk_Window ancestor = master, parent = Tk_Parent(slave);
+
+ if (Tk_IsTopLevel(slave) || slave == master) {
+ goto badWindow;
+ }
+
+ while (ancestor != parent) {
+ if (Tk_IsTopLevel(ancestor)) {
+ goto badWindow;
+ }
+ ancestor = Tk_Parent(ancestor);
+ }
+
+ return 1;
+
+badWindow:
+ Tcl_AppendResult(interp,
+ "can't add ", Tk_PathName(slave),
+ " as slave of ", Tk_PathName(master),
+ NULL);
+ return 0;
+}
+
diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h
new file mode 100644
index 0000000..d22ff98
--- /dev/null
+++ b/generic/ttk/ttkManager.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2005, Joe English. Freely redistributable.
+ *
+ * Geometry manager utilities.
+ */
+
+#ifndef _TTKMANAGER
+#define _TTKMANAGER
+
+#include "ttkTheme.h"
+
+typedef struct TtkManager_ Ttk_Manager;
+
+/*
+ * Geometry manager specification record:
+ *
+ * RequestedSize computes the requested size of the master window.
+ *
+ * PlaceSlaves sets the position and size of all managed slaves
+ * by calling Ttk_PlaceSlave().
+ *
+ * SlaveRemoved() is called immediately before a slave is removed.
+ * NB: the associated slave window may have been destroyed when this
+ * routine is called.
+ *
+ * SlaveRequest() is called when a slave requests a size change.
+ * It should return 1 if the request should propagate, 0 otherwise.
+ */
+typedef struct { /* Manager hooks */
+ Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */
+
+ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr);
+ void (*PlaceSlaves)(void *managerData);
+ int (*SlaveRequest)(void *managerData, int slaveIndex, int w, int h);
+ void (*SlaveRemoved)(void *managerData, int slaveIndex);
+} Ttk_ManagerSpec;
+
+/*
+ * Default implementations for Tk_GeomMgr hooks:
+ */
+MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave);
+MODULE_SCOPE void Ttk_LostSlaveProc(ClientData, Tk_Window slave);
+
+/*
+ * Public API:
+ */
+MODULE_SCOPE Ttk_Manager *Ttk_CreateManager(
+ Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow);
+MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *);
+
+MODULE_SCOPE void Ttk_InsertSlave(
+ Ttk_Manager *, int position, Tk_Window, void *slaveData);
+
+MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex);
+
+MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex);
+ /* Rearrange slave positions */
+
+MODULE_SCOPE void Ttk_PlaceSlave(
+ Ttk_Manager *, int slaveIndex, int x, int y, int width, int height);
+ /* Position and map the slave */
+
+MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex);
+ /* Unmap the slave */
+
+MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *);
+MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
+ /* Notify manager that size (resp. layout) needs to be recomputed */
+
+/* Utilities:
+ */
+MODULE_SCOPE int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window);
+ /* Returns: index in slave array of specified window, -1 if not found */
+
+MODULE_SCOPE int Ttk_GetSlaveIndexFromObj(
+ Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, int *indexPtr);
+
+/* Accessor functions:
+ */
+MODULE_SCOPE int Ttk_NumberSlaves(Ttk_Manager *);
+ /* Returns: number of managed slaves */
+
+MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex);
+ /* Returns: client data associated with slave */
+
+MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, int slaveIndex);
+ /* Returns: slave window */
+
+MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master);
+ /* Returns: 1 if master can manage slave; 0 otherwise leaving error msg */
+
+#endif /* _TTKMANAGER */
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
new file mode 100644
index 0000000..551f4a6
--- /dev/null
+++ b/generic/ttk/ttkNotebook.c
@@ -0,0 +1,1413 @@
+/*
+ * Copyright (c) 2004, Joe English
+ */
+
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <tk.h>
+
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+#include "ttkManager.h"
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+/*------------------------------------------------------------------------
+ * +++ Tab resources.
+ */
+
+#define DEFAULT_MIN_TAB_WIDTH 24
+
+static const char *const TabStateStrings[] = { "normal", "disabled", "hidden", 0 };
+typedef enum {
+ TAB_STATE_NORMAL, TAB_STATE_DISABLED, TAB_STATE_HIDDEN
+} TAB_STATE;
+
+typedef struct
+{
+ /* Internal data:
+ */
+ int width, height; /* Requested size of tab */
+ Ttk_Box parcel; /* Tab position */
+
+ /* Tab options:
+ */
+ TAB_STATE state;
+
+ /* Child window options:
+ */
+ Tcl_Obj *paddingObj; /* Padding inside pane */
+ Ttk_Padding padding;
+ Tcl_Obj *stickyObj;
+ Ttk_Sticky sticky;
+
+ /* Label options:
+ */
+ Tcl_Obj *textObj;
+ Tcl_Obj *imageObj;
+ Tcl_Obj *compoundObj;
+ Tcl_Obj *underlineObj;
+
+} Tab;
+
+/* Two different option tables are used for tabs:
+ * TabOptionSpecs is used to draw the tab, and only includes resources
+ * relevant to the tab.
+ *
+ * PaneOptionSpecs includes additional options for child window placement
+ * and is used to configure the slave.
+ */
+static Tk_OptionSpec TabOptionSpecs[] =
+{
+ {TK_OPTION_STRING_TABLE, "-state", "", "",
+ "normal", -1,Tk_Offset(Tab,state),
+ 0,(ClientData)TabStateStrings,0 },
+ {TK_OPTION_STRING, "-text", "text", "Text", "",
+ Tk_Offset(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
+ Tk_Offset(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
+ "none", Tk_Offset(Tab,compoundObj), -1,
+ 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED },
+ {TK_OPTION_INT, "-underline", "underline", "Underline", "-1",
+ Tk_Offset(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 }
+};
+
+static Tk_OptionSpec PaneOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-padding", "padding", "Padding", "0",
+ Tk_Offset(Tab,paddingObj), -1, 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_STRING, "-sticky", "sticky", "Sticky", "nsew",
+ Tk_Offset(Tab,stickyObj), -1, 0,0,GEOMETRY_CHANGED },
+
+ WIDGET_INHERIT_OPTIONS(TabOptionSpecs)
+};
+
+/*------------------------------------------------------------------------
+ * +++ Notebook resources.
+ */
+typedef struct
+{
+ Tcl_Obj *widthObj; /* Default width */
+ Tcl_Obj *heightObj; /* Default height */
+ Tcl_Obj *paddingObj; /* Padding around notebook */
+
+ Ttk_Manager *mgr; /* Geometry manager */
+ Tk_OptionTable tabOptionTable; /* Tab options */
+ Tk_OptionTable paneOptionTable; /* Tab+pane options */
+ int currentIndex; /* index of currently selected tab */
+ int activeIndex; /* index of currently active tab */
+ Ttk_Layout tabLayout; /* Sublayout for tabs */
+
+ Ttk_Box clientArea; /* Where to pack slave widgets */
+} NotebookPart;
+
+typedef struct
+{
+ WidgetCore core;
+ NotebookPart notebook;
+} Notebook;
+
+static Tk_OptionSpec NotebookOptionSpecs[] =
+{
+ {TK_OPTION_INT, "-width", "width", "Width", "0",
+ Tk_Offset(Notebook,notebook.widthObj),-1,
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_INT, "-height", "height", "Height", "0",
+ Tk_Offset(Notebook,notebook.heightObj),-1,
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_STRING, "-padding", "padding", "Padding", NULL,
+ Tk_Offset(Notebook,notebook.paddingObj),-1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/* Notebook style options:
+ */
+typedef struct
+{
+ Ttk_PositionSpec tabPosition; /* Where to place tabs */
+ Ttk_Padding tabMargins; /* Margins around tab row */
+ Ttk_PositionSpec tabPlacement; /* How to pack tabs within tab row */
+ Ttk_Orient tabOrient; /* ... */
+ int minTabWidth; /* Minimum tab width */
+ Ttk_Padding padding; /* External padding */
+} NotebookStyle;
+
+static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle)
+{
+ Tcl_Obj *objPtr;
+
+ nbstyle->tabPosition = TTK_PACK_TOP | TTK_STICK_W;
+ if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabposition", 0)) != 0) {
+ TtkGetLabelAnchorFromObj(NULL, objPtr, &nbstyle->tabPosition);
+ }
+
+ /* Guess default tabPlacement as function of tabPosition:
+ */
+ if (nbstyle->tabPosition & TTK_PACK_LEFT) {
+ nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_E;
+ } else if (nbstyle->tabPosition & TTK_PACK_RIGHT) {
+ nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_W;
+ } else if (nbstyle->tabPosition & TTK_PACK_BOTTOM) {
+ nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_N;
+ } else { /* Assume TTK_PACK_TOP */
+ nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_S;
+ }
+ if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabplacement", 0)) != 0) {
+ TtkGetLabelAnchorFromObj(NULL, objPtr, &nbstyle->tabPlacement);
+ }
+
+ /* Compute tabOrient as function of tabPlacement:
+ */
+ if (nbstyle->tabPlacement & (TTK_PACK_LEFT|TTK_PACK_RIGHT)) {
+ nbstyle->tabOrient = TTK_ORIENT_HORIZONTAL;
+ } else {
+ nbstyle->tabOrient = TTK_ORIENT_VERTICAL;
+ }
+
+ nbstyle->tabMargins = Ttk_UniformPadding(0);
+ if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabmargins", 0)) != 0) {
+ Ttk_GetBorderFromObj(NULL, objPtr, &nbstyle->tabMargins);
+ }
+
+ nbstyle->padding = Ttk_UniformPadding(0);
+ if ((objPtr = Ttk_QueryOption(nb->core.layout, "-padding", 0)) != 0) {
+ Ttk_GetPaddingFromObj(NULL,nb->core.tkwin,objPtr,&nbstyle->padding);
+ }
+
+ nbstyle->minTabWidth = DEFAULT_MIN_TAB_WIDTH;
+ if ((objPtr = Ttk_QueryOption(nb->core.layout, "-mintabwidth", 0)) != 0) {
+ Tcl_GetIntFromObj(NULL, objPtr, &nbstyle->minTabWidth);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Tab management.
+ */
+
+static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow)
+{
+ Tk_OptionTable optionTable = nb->notebook.paneOptionTable;
+ void *record = ckalloc(sizeof(Tab));
+ memset(record, 0, sizeof(Tab));
+
+ if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ ckfree(record);
+ return NULL;
+ }
+
+ return record;
+}
+
+static void DestroyTab(Notebook *nb, Tab *tab)
+{
+ void *record = tab;
+ Tk_FreeConfigOptions(record, nb->notebook.paneOptionTable, nb->core.tkwin);
+ ckfree(record);
+}
+
+static int ConfigureTab(
+ Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow,
+ int objc, Tcl_Obj *const objv[])
+{
+ Ttk_Sticky sticky = tab->sticky;
+ Ttk_Padding padding = tab->padding;
+ Tk_SavedOptions savedOptions;
+ int mask = 0;
+
+ if (Tk_SetOptions(interp, (ClientData)tab, nb->notebook.paneOptionTable,
+ objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ /* Check options:
+ * @@@ TODO: validate -image option.
+ */
+ if (Ttk_GetStickyFromObj(interp, tab->stickyObj, &sticky) != TCL_OK)
+ {
+ goto error;
+ }
+ if (Ttk_GetPaddingFromObj(interp, slaveWindow, tab->paddingObj, &padding)
+ != TCL_OK)
+ {
+ goto error;
+ }
+
+ tab->sticky = sticky;
+ tab->padding = padding;
+
+ Tk_FreeSavedOptions(&savedOptions);
+ Ttk_ManagerSizeChanged(nb->notebook.mgr);
+ TtkRedisplayWidget(&nb->core);
+
+ return TCL_OK;
+error:
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
+}
+
+/*
+ * IdentifyTab --
+ * Return the index of the tab at point x,y,
+ * or -1 if no tab at that point.
+ */
+static int IdentifyTab(Notebook *nb, int x, int y)
+{
+ int index;
+ for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index);
+ if ( tab->state != TAB_STATE_HIDDEN
+ && Ttk_BoxContains(tab->parcel, x,y))
+ {
+ return index;
+ }
+ }
+ return -1;
+}
+
+/*
+ * ActivateTab --
+ * Set the active tab index, redisplay if necessary.
+ */
+static void ActivateTab(Notebook *nb, int index)
+{
+ if (index != nb->notebook.activeIndex) {
+ nb->notebook.activeIndex = index;
+ TtkRedisplayWidget(&nb->core);
+ }
+}
+
+/*
+ * TabState --
+ * Return the state of the specified tab, based on
+ * notebook state, currentIndex, activeIndex, and user-specified tab state.
+ * The USER1 bit is set for the leftmost tab, and USER2
+ * is set for the rightmost tab.
+ */
+static Ttk_State TabState(Notebook *nb, int index)
+{
+ Ttk_State state = nb->core.state;
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index);
+
+ if (index == nb->notebook.currentIndex) {
+ state |= TTK_STATE_SELECTED;
+ } else {
+ state &= ~TTK_STATE_FOCUS;
+ }
+
+ if (index == nb->notebook.activeIndex) {
+ state |= TTK_STATE_ACTIVE;
+ }
+ if (index == 0) {
+ state |= TTK_STATE_USER1;
+ }
+ if (index == Ttk_NumberSlaves(nb->notebook.mgr) - 1) {
+ state |= TTK_STATE_USER2;
+ }
+ if (tab->state == TAB_STATE_DISABLED) {
+ state |= TTK_STATE_DISABLED;
+ }
+
+ return state;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Geometry management - size computation.
+ */
+
+/* TabrowSize --
+ * Compute max height and total width of all tabs (horizontal layouts)
+ * or total height and max width (vertical layouts).
+ *
+ * Side effects:
+ * Sets width and height fields for all tabs.
+ *
+ * Notes:
+ * Hidden tabs are included in the perpendicular computation
+ * (max height/width) but not parallel (total width/height).
+ */
+static void TabrowSize(
+ Notebook *nb, Ttk_Orient orient, int *widthPtr, int *heightPtr)
+{
+ Ttk_Layout tabLayout = nb->notebook.tabLayout;
+ int tabrowWidth = 0, tabrowHeight = 0;
+ int i;
+
+ for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ Ttk_State tabState = TabState(nb,i);
+
+ Ttk_RebindSublayout(tabLayout, tab);
+ Ttk_LayoutSize(tabLayout,tabState,&tab->width,&tab->height);
+
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ tabrowHeight = MAX(tabrowHeight, tab->height);
+ if (tab->state != TAB_STATE_HIDDEN) { tabrowWidth += tab->width; }
+ } else {
+ tabrowWidth = MAX(tabrowWidth, tab->width);
+ if (tab->state != TAB_STATE_HIDDEN) { tabrowHeight += tab->height; }
+ }
+ }
+
+ *widthPtr = tabrowWidth;
+ *heightPtr = tabrowHeight;
+}
+
+/* NotebookSize -- GM and widget size hook.
+ *
+ * Total height is tab height + client area height + pane internal padding
+ * Total width is max(client width, tab width) + pane internal padding
+ * Client area size determined by max size of slaves,
+ * overridden by -width and/or -height if nonzero.
+ */
+
+static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
+{
+ Notebook *nb = clientData;
+ NotebookStyle nbstyle;
+ Ttk_Padding padding;
+ Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client");
+ int clientWidth = 0, clientHeight = 0,
+ reqWidth = 0, reqHeight = 0,
+ tabrowWidth = 0, tabrowHeight = 0;
+ int i;
+
+ NotebookStyleOptions(nb, &nbstyle);
+
+ /* Compute max requested size of all slaves:
+ */
+ for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
+ Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i);
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ int slaveWidth
+ = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding);
+ int slaveHeight
+ = Tk_ReqHeight(slaveWindow) + Ttk_PaddingHeight(tab->padding);
+
+ clientWidth = MAX(clientWidth, slaveWidth);
+ clientHeight = MAX(clientHeight, slaveHeight);
+ }
+
+ /* Client width/height overridable by widget options:
+ */
+ Tcl_GetIntFromObj(NULL, nb->notebook.widthObj,&reqWidth);
+ Tcl_GetIntFromObj(NULL, nb->notebook.heightObj,&reqHeight);
+ if (reqWidth > 0)
+ clientWidth = reqWidth;
+ if (reqHeight > 0)
+ clientHeight = reqHeight;
+
+ /* Tab row:
+ */
+ TabrowSize(nb, nbstyle.tabOrient, &tabrowWidth, &tabrowHeight);
+ tabrowHeight += Ttk_PaddingHeight(nbstyle.tabMargins);
+ tabrowWidth += Ttk_PaddingWidth(nbstyle.tabMargins);
+
+ /* Account for exterior and interior padding:
+ */
+ padding = nbstyle.padding;
+ if (clientNode) {
+ Ttk_Padding ipad =
+ Ttk_LayoutNodeInternalPadding(nb->core.layout, clientNode);
+ padding = Ttk_AddPadding(padding, ipad);
+ }
+
+ if (nbstyle.tabPosition & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) {
+ *widthPtr = MAX(tabrowWidth, clientWidth) + Ttk_PaddingWidth(padding);
+ *heightPtr = tabrowHeight + clientHeight + Ttk_PaddingHeight(padding);
+ } else {
+ *widthPtr = tabrowWidth + clientWidth + Ttk_PaddingWidth(padding);
+ *heightPtr = MAX(tabrowHeight,clientHeight) + Ttk_PaddingHeight(padding);
+ }
+
+ return 1;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Geometry management - layout.
+ */
+
+/* SqueezeTabs --
+ * Squeeze or stretch tabs to fit within the tab area parcel.
+ *
+ * All tabs are adjusted by an equal amount, but will not be made
+ * smaller than the minimum width. (If all the tabs still do
+ * not fit in the available space, the rightmost ones will
+ * be further squozen by PlaceTabs()).
+ *
+ * The algorithm does not always yield an optimal layout, but does
+ * have the important property that decreasing the available width
+ * by one pixel will cause at most one tab to shrink by one pixel;
+ * this means that tabs resize "smoothly" when the window shrinks
+ * and grows.
+ *
+ * @@@ <<NOTE-TABPOSITION>> bug: only works for horizontal orientations
+ * @@@ <<NOTE-SQUEEZE-HIDDEN>> does not account for hidden tabs.
+ */
+
+static void SqueezeTabs(
+ Notebook *nb, int needed, int available, int minTabWidth)
+{
+ int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+
+ if (nTabs > 0) {
+ int difference = available - needed,
+ delta = difference / nTabs,
+ remainder = difference % nTabs,
+ slack = 0;
+ int i;
+
+ if (remainder < 0) { remainder += nTabs; --delta; }
+
+ for (i = 0; i < nTabs; ++i) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i);
+ int adj = delta + (i < remainder) + slack;
+
+ if (tab->width + adj >= minTabWidth) {
+ tab->width += adj;
+ slack = 0;
+ } else {
+ slack = adj - (minTabWidth - tab->width);
+ tab->width = minTabWidth;
+ }
+ }
+ }
+}
+
+/* PlaceTabs --
+ * Compute all tab parcels.
+ */
+static void PlaceTabs(
+ Notebook *nb, Ttk_Box tabrowBox, Ttk_PositionSpec tabPlacement)
+{
+ Ttk_Layout tabLayout = nb->notebook.tabLayout;
+ int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int i;
+
+ for (i = 0; i < nTabs; ++i) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ Ttk_State tabState = TabState(nb, i);
+
+ if (tab->state != TAB_STATE_HIDDEN) {
+ Ttk_Padding expand = Ttk_UniformPadding(0);
+ Tcl_Obj *expandObj = Ttk_QueryOption(tabLayout,"-expand",tabState);
+
+ if (expandObj) {
+ Ttk_GetBorderFromObj(NULL, expandObj, &expand);
+ }
+
+ tab->parcel =
+ Ttk_ExpandBox(
+ Ttk_PositionBox(&tabrowBox,
+ tab->width, tab->height, tabPlacement),
+ expand);
+ }
+ }
+}
+
+/* NotebookDoLayout --
+ * Computes notebook layout and places tabs.
+ *
+ * Side effects:
+ * Sets clientArea, used to place slave panes.
+ */
+static void NotebookDoLayout(void *recordPtr)
+{
+ Notebook *nb = recordPtr;
+ Tk_Window nbwin = nb->core.tkwin;
+ Ttk_Box cavity = Ttk_WinBox(nbwin);
+ int tabrowWidth = 0, tabrowHeight = 0;
+ Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client");
+ Ttk_Box tabrowBox;
+ NotebookStyle nbstyle;
+
+ NotebookStyleOptions(nb, &nbstyle);
+
+ /* Notebook internal padding:
+ */
+ cavity = Ttk_PadBox(cavity, nbstyle.padding);
+
+ /* Layout for notebook background (base layout):
+ */
+ Ttk_PlaceLayout(nb->core.layout, nb->core.state, Ttk_WinBox(nbwin));
+
+ /* Place tabs:
+ */
+ TabrowSize(nb, nbstyle.tabOrient, &tabrowWidth, &tabrowHeight);
+ tabrowBox = Ttk_PadBox(
+ Ttk_PositionBox(&cavity,
+ tabrowWidth + Ttk_PaddingWidth(nbstyle.tabMargins),
+ tabrowHeight + Ttk_PaddingHeight(nbstyle.tabMargins),
+ nbstyle.tabPosition),
+ nbstyle.tabMargins);
+
+ SqueezeTabs(nb, tabrowWidth, tabrowBox.width, nbstyle.minTabWidth);
+ PlaceTabs(nb, tabrowBox, nbstyle.tabPlacement);
+
+ /* Layout for client area frame:
+ */
+ if (clientNode) {
+ Ttk_PlaceElement(nb->core.layout, clientNode, cavity);
+ cavity = Ttk_LayoutNodeInternalParcel(nb->core.layout, clientNode);
+ }
+
+ if (cavity.height <= 0) cavity.height = 1;
+ if (cavity.width <= 0) cavity.width = 1;
+
+ nb->notebook.clientArea = cavity;
+}
+
+/*
+ * NotebookPlaceSlave --
+ * Set the position and size of a child widget
+ * based on the current client area and slave options:
+ */
+static void NotebookPlaceSlave(Notebook *nb, int slaveIndex)
+{
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
+ Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex);
+ Ttk_Box slaveBox =
+ Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding),
+ Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky);
+
+ Ttk_PlaceSlave(nb->notebook.mgr, slaveIndex,
+ slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height);
+}
+
+/* NotebookPlaceSlaves --
+ * Geometry manager hook.
+ */
+static void NotebookPlaceSlaves(void *recordPtr)
+{
+ Notebook *nb = recordPtr;
+ int currentIndex = nb->notebook.currentIndex;
+ if (currentIndex >= 0) {
+ NotebookDoLayout(nb);
+ NotebookPlaceSlave(nb, currentIndex);
+ }
+}
+
+/*
+ * SelectTab(nb, index) --
+ * Change the currently-selected tab.
+ */
+static void SelectTab(Notebook *nb, int index)
+{
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index);
+ int currentIndex = nb->notebook.currentIndex;
+
+ if (index == currentIndex) {
+ return;
+ }
+
+ if (TabState(nb, index) & TTK_STATE_DISABLED) {
+ return;
+ }
+
+ /* Unhide the tab if it is currently hidden and being selected.
+ */
+ if (tab->state == TAB_STATE_HIDDEN) {
+ tab->state = TAB_STATE_NORMAL;
+ }
+
+ if (currentIndex >= 0) {
+ Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ }
+
+ NotebookPlaceSlave(nb, index);
+
+ nb->notebook.currentIndex = index;
+ TtkRedisplayWidget(&nb->core);
+
+ TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+}
+
+/* NextTab --
+ * Returns the index of the next tab after the specified tab
+ * in the normal state (e.g., not hidden or disabled),
+ * or -1 if all tabs are disabled or hidden.
+ */
+static int NextTab(Notebook *nb, int index)
+{
+ int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nextIndex;
+
+ /* Scan forward for following usable tab:
+ */
+ for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ if (tab->state == TAB_STATE_NORMAL) {
+ return nextIndex;
+ }
+ }
+
+ /* Not found -- scan backwards.
+ */
+ for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ if (tab->state == TAB_STATE_NORMAL) {
+ return nextIndex;
+ }
+ }
+
+ /* Still nothing. Give up.
+ */
+ return -1;
+}
+
+/* SelectNearestTab --
+ * Handles the case where the current tab is forgotten, hidden,
+ * or destroyed.
+ *
+ * Unmap the current tab and schedule the next available one
+ * to be mapped at the next GM update.
+ */
+static void SelectNearestTab(Notebook *nb)
+{
+ int currentIndex = nb->notebook.currentIndex;
+ int nextIndex = NextTab(nb, currentIndex);
+
+ if (currentIndex >= 0) {
+ Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ }
+ if (currentIndex != nextIndex) {
+ TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+ }
+
+ nb->notebook.currentIndex = nextIndex;
+ Ttk_ManagerLayoutChanged(nb->notebook.mgr);
+ TtkRedisplayWidget(&nb->core);
+}
+
+/* TabRemoved -- GM SlaveRemoved hook.
+ * Select the next tab if the current one is being removed.
+ * Adjust currentIndex to account for removed slave.
+ */
+static void TabRemoved(void *managerData, int index)
+{
+ Notebook *nb = managerData;
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index);
+
+ if (index == nb->notebook.currentIndex) {
+ SelectNearestTab(nb);
+ }
+
+ if (index < nb->notebook.currentIndex) {
+ --nb->notebook.currentIndex;
+ }
+
+ DestroyTab(nb, tab);
+
+ TtkRedisplayWidget(&nb->core);
+}
+
+static int TabRequest(void *managerData, int index, int width, int height)
+{
+ return 1;
+}
+
+/* AddTab --
+ * Add new tab at specified index.
+ */
+static int AddTab(
+ Tcl_Interp *interp, Notebook *nb,
+ int destIndex, Tk_Window slaveWindow,
+ int objc, Tcl_Obj *const objv[])
+{
+ Tab *tab;
+ if (!Ttk_Maintainable(interp, slaveWindow, nb->core.tkwin)) {
+ return TCL_ERROR;
+ }
+#if 0 /* can't happen */
+ if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) >= 0) {
+ Tcl_AppendResult(interp,
+ Tk_PathName(slaveWindow), " already added",
+ NULL);
+ return TCL_ERROR;
+ }
+#endif
+
+ /* Create and insert tab.
+ */
+ tab = CreateTab(interp, nb, slaveWindow);
+ if (!tab) {
+ return TCL_ERROR;
+ }
+ if (ConfigureTab(interp, nb, tab, slaveWindow, objc, objv) != TCL_OK) {
+ DestroyTab(nb, tab);
+ return TCL_ERROR;
+ }
+
+ Ttk_InsertSlave(nb->notebook.mgr, destIndex, slaveWindow, tab);
+
+ /* Adjust indices and/or autoselect first tab:
+ */
+ if (nb->notebook.currentIndex < 0) {
+ SelectTab(nb, destIndex);
+ } else if (nb->notebook.currentIndex >= destIndex) {
+ ++nb->notebook.currentIndex;
+ }
+
+ return TCL_OK;
+}
+
+static Ttk_ManagerSpec NotebookManagerSpec = {
+ { "notebook", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ NotebookSize,
+ NotebookPlaceSlaves,
+ TabRequest,
+ TabRemoved
+};
+
+/*------------------------------------------------------------------------
+ * +++ Event handlers.
+ */
+
+/* NotebookEventHandler --
+ * Tracks the active tab.
+ */
+static const int NotebookEventMask
+ = StructureNotifyMask
+ | PointerMotionMask
+ | LeaveWindowMask
+ ;
+static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
+{
+ Notebook *nb = clientData;
+
+ if (eventPtr->type == DestroyNotify) { /* Remove self */
+ Tk_DeleteEventHandler(nb->core.tkwin,
+ NotebookEventMask, NotebookEventHandler, clientData);
+ } else if (eventPtr->type == MotionNotify) {
+ int index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y);
+ ActivateTab(nb, index);
+ } else if (eventPtr->type == LeaveNotify) {
+ ActivateTab(nb, -1);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Utilities.
+ */
+
+/* FindTabIndex --
+ * Find the index of the specified tab.
+ * Tab identifiers are one of:
+ *
+ * + positional specifications @x,y,
+ * + "current",
+ * + numeric indices [0..nTabs],
+ * + slave window names
+ *
+ * Stores index of specified tab in *index_rtn, -1 if not found.
+ *
+ * Returns TCL_ERROR and leaves an error message in interp->result
+ * if the tab identifier was incorrect.
+ *
+ * See also: GetTabIndex.
+ */
+static int FindTabIndex(
+ Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, int *index_rtn)
+{
+ const char *string = Tcl_GetString(objPtr);
+ int x, y;
+
+ *index_rtn = -1;
+
+ /* Check for @x,y ...
+ */
+ if (string[0] == '@' && sscanf(string, "@%d,%d",&x,&y) == 2) {
+ *index_rtn = IdentifyTab(nb, x, y);
+ return TCL_OK;
+ }
+
+ /* ... or "current" ...
+ */
+ if (!strcmp(string, "current")) {
+ *index_rtn = nb->notebook.currentIndex;
+ return TCL_OK;
+ }
+
+ /* ... or integer index or slave window name:
+ */
+ if (Ttk_GetSlaveIndexFromObj(
+ interp, nb->notebook.mgr, objPtr, index_rtn) == TCL_OK)
+ {
+ return TCL_OK;
+ }
+
+ /* Nothing matched; Ttk_GetSlaveIndexFromObj will have left error message.
+ */
+ return TCL_ERROR;
+}
+
+/* GetTabIndex --
+ * Get the index of an existing tab.
+ * Tab identifiers are as per FindTabIndex.
+ * Returns TCL_ERROR if the tab does not exist.
+ */
+static int GetTabIndex(
+ Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, int *index_rtn)
+{
+ int status = FindTabIndex(interp, nb, objPtr, index_rtn);
+
+ if (status == TCL_OK && *index_rtn < 0) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "tab '", Tcl_GetString(objPtr), "' not found",
+ NULL);
+ status = TCL_ERROR;
+ }
+ return status;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget command routines.
+ */
+
+/* $nb add window ?options ... ?
+ */
+static int NotebookAddCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+ int index = Ttk_NumberSlaves(nb->notebook.mgr);
+ Tk_Window slaveWindow;
+ int slaveIndex;
+ Tab *tab;
+
+ if (objc <= 2 || objc % 2 != 1) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
+ return TCL_ERROR;
+ }
+
+ slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin);
+ if (!slaveWindow) {
+ return TCL_ERROR;
+ }
+ slaveIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
+
+ if (slaveIndex < 0) { /* New tab */
+ return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3);
+ }
+
+ tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
+ if (tab->state == TAB_STATE_HIDDEN) {
+ tab->state = TAB_STATE_NORMAL;
+ }
+ if (ConfigureTab(interp, nb, tab, slaveWindow, objc-4,objv+4) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ TtkRedisplayWidget(&nb->core);
+
+ return TCL_OK;
+}
+
+/* $nb insert $index $tab ?-option value ...?
+ * Insert new tab, or move existing one.
+ */
+static int NotebookInsertCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+ int current = nb->notebook.currentIndex;
+ int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ int srcIndex, destIndex;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ return TCL_ERROR;
+ }
+
+ if (!strcmp(Tcl_GetString(objv[2]), "end")) {
+ destIndex = Ttk_NumberSlaves(nb->notebook.mgr);
+ } else if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ interp, nb->notebook.mgr, objv[2], &destIndex)) {
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetString(objv[3])[0] == '.') {
+ /* Window name -- could be new or existing slave.
+ */
+ Tk_Window slaveWindow =
+ Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin);
+
+ if (!slaveWindow) {
+ return TCL_ERROR;
+ }
+
+ srcIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
+ if (srcIndex < 0) { /* New slave */
+ return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4);
+ }
+ } else if (Ttk_GetSlaveIndexFromObj(
+ interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ /* Move existing slave:
+ */
+ if (ConfigureTab(interp, nb,
+ Ttk_SlaveData(nb->notebook.mgr,srcIndex),
+ Ttk_SlaveWindow(nb->notebook.mgr,srcIndex),
+ objc-4,objv+4) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ if (destIndex >= nSlaves) {
+ destIndex = nSlaves - 1;
+ }
+ Ttk_ReorderSlave(nb->notebook.mgr, srcIndex, destIndex);
+
+ /* Adjust internal indexes:
+ */
+ nb->notebook.activeIndex = -1;
+ if (current == srcIndex) {
+ nb->notebook.currentIndex = destIndex;
+ } else if (destIndex <= current && current < srcIndex) {
+ ++nb->notebook.currentIndex;
+ } else if (srcIndex < current && current <= destIndex) {
+ --nb->notebook.currentIndex;
+ }
+
+ TtkRedisplayWidget(&nb->core);
+
+ return TCL_OK;
+}
+
+/* $nb forget $tab --
+ * Removes the specified tab.
+ */
+static int NotebookForgetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+ int index;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "tab");
+ return TCL_ERROR;
+ }
+
+ if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ Ttk_ForgetSlave(nb->notebook.mgr, index);
+ TtkRedisplayWidget(&nb->core);
+
+ return TCL_OK;
+}
+
+/* $nb hide $tab --
+ * Hides the specified tab.
+ */
+static int NotebookHideCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+ int index;
+ Tab *tab;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "tab");
+ return TCL_ERROR;
+ }
+
+ if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ tab = Ttk_SlaveData(nb->notebook.mgr, index);
+ tab->state = TAB_STATE_HIDDEN;
+ if (index == nb->notebook.currentIndex) {
+ SelectNearestTab(nb);
+ }
+
+ TtkRedisplayWidget(&nb->core);
+
+ return TCL_OK;
+}
+
+/* $nb identify $x $y --
+ * Returns name of tab element at $x,$y; empty string if none.
+ */
+static int NotebookIdentifyCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ static const char *whatTable[] = { "element", "tab", NULL };
+ enum { IDENTIFY_ELEMENT, IDENTIFY_TAB };
+ int what = IDENTIFY_ELEMENT;
+ Notebook *nb = recordPtr;
+ Ttk_Element element = NULL;
+ int x, y, tabIndex;
+
+ if (objc < 4 || objc > 5) {
+ Tcl_WrongNumArgs(interp, 2,objv, "?what? x y");
+ return TCL_ERROR;
+ }
+
+ if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
+ || (objc == 5 &&
+ Tcl_GetIndexFromObj(interp, objv[2], whatTable, "option", 0, &what)
+ != TCL_OK)
+ ) {
+ return TCL_ERROR;
+ }
+
+ tabIndex = IdentifyTab(nb, x, y);
+ if (tabIndex >= 0) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, tabIndex);
+ Ttk_State state = TabState(nb, tabIndex);
+ Ttk_Layout tabLayout = nb->notebook.tabLayout;
+
+ Ttk_RebindSublayout(tabLayout, tab);
+ Ttk_PlaceLayout(tabLayout, state, tab->parcel);
+
+ element = Ttk_IdentifyElement(tabLayout, x, y);
+ }
+
+ switch (what) {
+ case IDENTIFY_ELEMENT:
+ if (element) {
+ const char *elementName = Ttk_ElementName(element);
+ Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1));
+ }
+ break;
+ case IDENTIFY_TAB:
+ if (tabIndex >= 0) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(tabIndex));
+ }
+ break;
+ }
+ return TCL_OK;
+}
+
+/* $nb index $item --
+ * Returns the integer index of the tab specified by $item,
+ * the empty string if $item does not identify a tab.
+ * See above for valid item formats.
+ */
+static int NotebookIndexCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+ int index, status;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "tab");
+ return TCL_ERROR;
+ }
+
+ /*
+ * Special-case for "end":
+ */
+ if (!strcmp("end", Tcl_GetString(objv[2]))) {
+ int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(nSlaves));
+ return TCL_OK;
+ }
+
+ status = FindTabIndex(interp, nb, objv[2], &index);
+ if (status == TCL_OK && index >= 0) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ }
+
+ return status;
+}
+
+/* $nb select ?$item? --
+ * Select the specified tab, or return the widget path of
+ * the currently-selected pane.
+ */
+static int NotebookSelectCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+
+ if (objc == 2) {
+ if (nb->notebook.currentIndex >= 0) {
+ Tk_Window pane = Ttk_SlaveWindow(
+ nb->notebook.mgr, nb->notebook.currentIndex);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1));
+ }
+ return TCL_OK;
+ } else if (objc == 3) {
+ int index, status = GetTabIndex(interp, nb, objv[2], &index);
+ if (status == TCL_OK) {
+ SelectTab(nb, index);
+ }
+ return status;
+ } /*else*/
+ Tcl_WrongNumArgs(interp, 2, objv, "?tab?");
+ return TCL_ERROR;
+}
+
+/* $nb tabs --
+ * Return list of tabs.
+ */
+static int NotebookTabsCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+ Ttk_Manager *mgr = nb->notebook.mgr;
+ Tcl_Obj *result;
+ int i;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
+ return TCL_ERROR;
+ }
+
+ result = Tcl_NewListObj(0, NULL);
+ for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(pathName,-1));
+ }
+ Tcl_SetObjResult(interp, result);
+
+ return TCL_OK;
+}
+
+/* $nb tab $tab ?-option ?value -option value...??
+ */
+static int NotebookTabCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Notebook *nb = recordPtr;
+ Ttk_Manager *mgr = nb->notebook.mgr;
+ int index;
+ Tk_Window slaveWindow;
+ Tab *tab;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "tab ?-option ?value??...");
+ return TCL_ERROR;
+ }
+
+ if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ tab = Ttk_SlaveData(mgr, index);
+ slaveWindow = Ttk_SlaveWindow(mgr, index);
+
+ if (objc == 3) {
+ return TtkEnumerateOptions(interp, tab,
+ PaneOptionSpecs, nb->notebook.paneOptionTable, slaveWindow);
+ } else if (objc == 4) {
+ return TtkGetOptionValue(interp, tab, objv[3],
+ nb->notebook.paneOptionTable, slaveWindow);
+ } /* else */
+
+ if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /* If the current tab has become disabled or hidden,
+ * select the next nondisabled, unhidden one:
+ */
+ if (index == nb->notebook.currentIndex && tab->state != TAB_STATE_NORMAL) {
+ SelectNearestTab(nb);
+ }
+
+ return TCL_OK;
+}
+
+/* Subcommand table:
+ */
+static const Ttk_Ensemble NotebookCommands[] = {
+ { "add", NotebookAddCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "forget", NotebookForgetCommand,0 },
+ { "hide", NotebookHideCommand,0 },
+ { "identify", NotebookIdentifyCommand,0 },
+ { "index", NotebookIndexCommand,0 },
+ { "insert", NotebookInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "select", NotebookSelectCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "tab", NotebookTabCommand,0 },
+ { "tabs", NotebookTabsCommand,0 },
+ { 0,0,0 }
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget class hooks.
+ */
+
+static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Notebook *nb = recordPtr;
+
+ nb->notebook.mgr = Ttk_CreateManager(
+ &NotebookManagerSpec, recordPtr, nb->core.tkwin);
+
+ nb->notebook.tabOptionTable = Tk_CreateOptionTable(interp,TabOptionSpecs);
+ nb->notebook.paneOptionTable = Tk_CreateOptionTable(interp,PaneOptionSpecs);
+
+ nb->notebook.currentIndex = -1;
+ nb->notebook.activeIndex = -1;
+ nb->notebook.tabLayout = 0;
+
+ nb->notebook.clientArea = Ttk_MakeBox(0,0,1,1);
+
+ Tk_CreateEventHandler(
+ nb->core.tkwin, NotebookEventMask, NotebookEventHandler, recordPtr);
+}
+
+static void NotebookCleanup(void *recordPtr)
+{
+ Notebook *nb = recordPtr;
+
+ Ttk_DeleteManager(nb->notebook.mgr);
+ if (nb->notebook.tabLayout)
+ Ttk_FreeLayout(nb->notebook.tabLayout);
+}
+
+static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask)
+{
+ Notebook *nb = clientData;
+
+ /*
+ * Error-checks:
+ */
+ if (nb->notebook.paddingObj) {
+ /* Check for valid -padding: */
+ Ttk_Padding unused;
+ if (Ttk_GetPaddingFromObj(
+ interp, nb->core.tkwin, nb->notebook.paddingObj, &unused)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+
+ return TtkCoreConfigure(interp, clientData, mask);
+}
+
+/* NotebookGetLayout --
+ * GetLayout widget hook.
+ */
+static Ttk_Layout NotebookGetLayout(
+ Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
+{
+ Notebook *nb = recordPtr;
+ Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr);
+ Ttk_Layout tabLayout;
+
+ if (!notebookLayout) {
+ return NULL;
+ }
+
+ tabLayout = Ttk_CreateSublayout(
+ interp, theme, notebookLayout, ".Tab", nb->notebook.tabOptionTable);
+
+ if (tabLayout) {
+ if (nb->notebook.tabLayout) {
+ Ttk_FreeLayout(nb->notebook.tabLayout);
+ }
+ nb->notebook.tabLayout = tabLayout;
+ }
+
+ return notebookLayout;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Display routines.
+ */
+
+static void DisplayTab(Notebook *nb, int index, Drawable d)
+{
+ Ttk_Layout tabLayout = nb->notebook.tabLayout;
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index);
+ Ttk_State state = TabState(nb, index);
+
+ if (tab->state != TAB_STATE_HIDDEN) {
+ Ttk_RebindSublayout(tabLayout, tab);
+ Ttk_PlaceLayout(tabLayout, state, tab->parcel);
+ Ttk_DrawLayout(tabLayout, state, d);
+ }
+}
+
+static void NotebookDisplay(void *clientData, Drawable d)
+{
+ Notebook *nb = clientData;
+ int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ int index;
+
+ /* Draw notebook background (base layout):
+ */
+ Ttk_DrawLayout(nb->core.layout, nb->core.state, d);
+
+ /* Draw tabs from left to right, but draw the current tab last
+ * so it will overwrite its neighbors.
+ */
+ for (index = 0; index < nSlaves; ++index) {
+ if (index != nb->notebook.currentIndex) {
+ DisplayTab(nb, index, d);
+ }
+ }
+ if (nb->notebook.currentIndex >= 0) {
+ DisplayTab(nb, nb->notebook.currentIndex, d);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget specification and layout definitions.
+ */
+
+static WidgetSpec NotebookWidgetSpec =
+{
+ "TNotebook", /* className */
+ sizeof(Notebook), /* recordSize */
+ NotebookOptionSpecs, /* optionSpecs */
+ NotebookCommands, /* subcommands */
+ NotebookInitialize, /* initializeProc */
+ NotebookCleanup, /* cleanupProc */
+ NotebookConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ NotebookGetLayout, /* getLayoutProc */
+ NotebookSize, /* geometryProc */
+ NotebookDoLayout, /* layoutProc */
+ NotebookDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(NotebookLayout)
+ TTK_NODE("Notebook.client", TTK_FILL_BOTH)
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(TabLayout)
+ TTK_GROUP("Notebook.tab", TTK_FILL_BOTH,
+ TTK_GROUP("Notebook.padding", TTK_PACK_TOP|TTK_FILL_BOTH,
+ TTK_GROUP("Notebook.focus", TTK_PACK_TOP|TTK_FILL_BOTH,
+ TTK_NODE("Notebook.label", TTK_PACK_TOP))))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkNotebook_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(themePtr, "Tab", TabLayout);
+ Ttk_RegisterLayout(themePtr, "TNotebook", NotebookLayout);
+
+ RegisterWidget(interp, "ttk::notebook", &NotebookWidgetSpec);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
new file mode 100644
index 0000000..065774e
--- /dev/null
+++ b/generic/ttk/ttkPanedwindow.c
@@ -0,0 +1,975 @@
+/*
+ * Copyright (c) 2005, Joe English. Freely redistributable.
+ *
+ * ttk::panedwindow widget implementation.
+ *
+ * TODO: track active/pressed sash.
+ */
+
+#include <string.h>
+#include <tk.h>
+#include "ttkManager.h"
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/*------------------------------------------------------------------------
+ * +++ Layout algorithm.
+ *
+ * (pos=x/y, size=width/height, depending on -orient=horizontal/vertical)
+ *
+ * Each pane carries two pieces of state: the request size and the
+ * position of the following sash. (The final pane has no sash,
+ * its sash position is used as a sentinel value).
+ *
+ * Pane geometry is determined by the sash positions.
+ * When resizing, sash positions are computed from the request sizes,
+ * the available space, and pane weights (see PlaceSashes()).
+ * This ensures continuous resize behavior (that is: changing
+ * the size by X pixels then changing the size by Y pixels
+ * gives the same result as changing the size by X+Y pixels
+ * in one step).
+ *
+ * The request size is initially set to the slave window's requested size.
+ * When the user drags a sash, each pane's request size is set to its
+ * actual size. This ensures that panes "stay put" on the next resize.
+ *
+ * If reqSize == 0, use 0 for the weight as well. This ensures that
+ * "collapsed" panes stay collapsed during a resize, regardless of
+ * their nominal -weight.
+ *
+ * +++ Invariants.
+ *
+ * #sash = #pane - 1
+ * pos(pane[0]) = 0
+ * pos(sash[i]) = pos(pane[i]) + size(pane[i]), 0 <= i <= #sash
+ * pos(pane[i+1]) = pos(sash[i]) + size(sash[i]), 0 <= i < #sash
+ * pos(sash[#sash]) = size(pw) // sentinel value, constraint
+ *
+ * size(pw) = sum(size(pane(0..#pane))) + sum(size(sash(0..#sash)))
+ * size(pane[i]) >= 0, for 0 <= i < #pane
+ * size(sash[i]) >= 0, for 0 <= i < #sash
+ * ==> pos(pane[i]) <= pos(sash[i]) <= pos(pane[i+1]), for 0 <= i < #sash
+ *
+ * Assumption: all sashes are the same size.
+ */
+
+/*------------------------------------------------------------------------
+ * +++ Widget record.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj;
+ int orient;
+ int width;
+ int height;
+ Ttk_Manager *mgr;
+ Tk_OptionTable paneOptionTable;
+ Ttk_Layout sashLayout;
+ int sashThickness;
+} PanedPart;
+
+typedef struct {
+ WidgetCore core;
+ PanedPart paned;
+} Paned;
+
+/* @@@ NOTE: -orient is readonly 'cause dynamic oriention changes NYI
+ */
+static Tk_OptionSpec PanedOptionSpecs[] = {
+ {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
+ Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient),
+ 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED },
+ {TK_OPTION_INT, "-width", "width", "Width", "0",
+ -1,Tk_Offset(Paned,paned.width),
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_INT, "-height", "height", "Height", "0",
+ -1,Tk_Offset(Paned,paned.height),
+ 0,0,GEOMETRY_CHANGED },
+
+ WIDGET_TAKEFOCUS_FALSE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*------------------------------------------------------------------------
+ * +++ Slave pane record.
+ */
+typedef struct {
+ int reqSize; /* Pane request size */
+ int sashPos; /* Folowing sash position */
+ int weight; /* Pane -weight, for resizing */
+} Pane;
+
+static Tk_OptionSpec PaneOptionSpecs[] = {
+ {TK_OPTION_INT, "-weight", "weight", "Weight", "0",
+ -1,Tk_Offset(Pane,weight), 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+};
+
+/* CreatePane --
+ * Create a new pane record.
+ */
+static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow)
+{
+ Tk_OptionTable optionTable = pw->paned.paneOptionTable;
+ void *record = ckalloc(sizeof(Pane));
+ Pane *pane = record;
+
+ memset(record, 0, sizeof(Pane));
+ if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ ckfree(record);
+ return NULL;
+ }
+
+ pane->reqSize
+ = pw->paned.orient == TTK_ORIENT_HORIZONTAL
+ ? Tk_ReqWidth(slaveWindow) : Tk_ReqHeight(slaveWindow);
+
+ return pane;
+}
+
+/* DestroyPane --
+ * Free pane record.
+ */
+static void DestroyPane(Paned *pw, Pane *pane)
+{
+ void *record = pane;
+ Tk_FreeConfigOptions(record, pw->paned.paneOptionTable, pw->core.tkwin);
+ ckfree(record);
+}
+
+/* ConfigurePane --
+ * Set pane options.
+ */
+static int ConfigurePane(
+ Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow,
+ int objc, Tcl_Obj *const objv[])
+{
+ Ttk_Manager *mgr = pw->paned.mgr;
+ Tk_SavedOptions savedOptions;
+ int mask = 0;
+
+ if (Tk_SetOptions(interp, (void*)pane, pw->paned.paneOptionTable,
+ objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ /* Sanity-check:
+ */
+ if (pane->weight < 0) {
+ Tcl_AppendResult(interp, "-weight must be nonnegative", NULL);
+ goto error;
+ }
+
+ /* Done.
+ */
+ Tk_FreeSavedOptions(&savedOptions);
+ Ttk_ManagerSizeChanged(mgr);
+ return TCL_OK;
+
+error:
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
+}
+
+
+/*------------------------------------------------------------------------
+ * +++ Sash adjustment.
+ */
+
+/* ShoveUp --
+ * Place sash i at specified position, recursively shoving
+ * previous sashes upwards as needed, until hitting the top
+ * of the window. If that happens, shove back down.
+ *
+ * Returns: final position of sash i.
+ */
+
+static int ShoveUp(Paned *pw, int i, int pos)
+{
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, i);
+ int sashThickness = pw->paned.sashThickness;
+
+ if (i == 0) {
+ if (pos < 0)
+ pos = 0;
+ } else {
+ Pane *prevPane = Ttk_SlaveData(pw->paned.mgr, i-1);
+ if (pos < prevPane->sashPos + sashThickness)
+ pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness;
+ }
+ return pane->sashPos = pos;
+}
+
+/* ShoveDown --
+ * Same as ShoveUp, but going in the opposite direction
+ * and stopping at the sentinel sash.
+ */
+static int ShoveDown(Paned *pw, int i, int pos)
+{
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr,i);
+ int sashThickness = pw->paned.sashThickness;
+
+ if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) {
+ pos = pane->sashPos; /* Sentinel value == master window size */
+ } else {
+ Pane *nextPane = Ttk_SlaveData(pw->paned.mgr,i+1);
+ if (pos + sashThickness > nextPane->sashPos)
+ pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness;
+ }
+ return pane->sashPos = pos;
+}
+
+/* PanedSize --
+ * Compute the requested size of the paned widget
+ * from the individual pane request sizes.
+ *
+ * Used as the WidgetSpec sizeProc and the ManagerSpec sizeProc.
+ */
+static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr)
+{
+ Paned *pw = recordPtr;
+ int nPanes = Ttk_NumberSlaves(pw->paned.mgr);
+ int nSashes = nPanes - 1;
+ int sashThickness = pw->paned.sashThickness;
+ int width = 0, height = 0;
+ int index;
+
+ if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) {
+ for (index = 0; index < nPanes; ++index) {
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+
+ if (height < Tk_ReqHeight(slaveWindow))
+ height = Tk_ReqHeight(slaveWindow);
+ width += pane->reqSize;
+ }
+ width += nSashes * sashThickness;
+ } else {
+ for (index = 0; index < nPanes; ++index) {
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+
+ if (width < Tk_ReqWidth(slaveWindow))
+ width = Tk_ReqWidth(slaveWindow);
+ height += pane->reqSize;
+ }
+ height += nSashes * sashThickness;
+ }
+
+ *widthPtr = pw->paned.width > 0 ? pw->paned.width : width;
+ *heightPtr = pw->paned.height > 0 ? pw->paned.height : height;
+ return 1;
+}
+
+/* AdjustPanes --
+ * Set pane request sizes from sash positions.
+ *
+ * NOTE:
+ * AdjustPanes followed by PlaceSashes (called during relayout)
+ * will leave the sashes in the same place, as long as available size
+ * remains contant.
+ */
+static void AdjustPanes(Paned *pw)
+{
+ int sashThickness = pw->paned.sashThickness;
+ int pos = 0;
+ int index;
+
+ for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ int size = pane->sashPos - pos;
+ pane->reqSize = size >= 0 ? size : 0;
+ pos = pane->sashPos + sashThickness;
+ }
+}
+
+/* PlaceSashes --
+ * Set sash positions from pane request sizes and available space.
+ * The sentinel sash position is set to the available space.
+ *
+ * Allocate pane->reqSize pixels to each pane, and distribute
+ * the difference = available size - requested size according
+ * to pane->weight.
+ *
+ * If there's still some left over, squeeze panes from the bottom up
+ * (This can happen if all weights are zero, or if one or more panes
+ * are too small to absorb the required shrinkage).
+ *
+ * Notes:
+ * This doesn't distribute the remainder pixels as evenly as it could
+ * when more than one pane has weight > 1.
+ */
+static void PlaceSashes(Paned *pw, int width, int height)
+{
+ Ttk_Manager *mgr = pw->paned.mgr;
+ int nPanes = Ttk_NumberSlaves(mgr);
+ int sashThickness = pw->paned.sashThickness;
+ int available = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? width : height;
+ int reqSize = 0, totalWeight = 0;
+ int difference, delta, remainder, pos, i;
+
+ if (nPanes == 0)
+ return;
+
+ /* Compute total required size and total available weight:
+ */
+ for (i = 0; i < nPanes; ++i) {
+ Pane *pane = Ttk_SlaveData(mgr, i);
+ reqSize += pane->reqSize;
+ totalWeight += pane->weight * (pane->reqSize != 0);
+ }
+
+ /* Compute difference to be redistributed:
+ */
+ difference = available - reqSize - sashThickness*(nPanes-1);
+ if (totalWeight != 0) {
+ delta = difference / totalWeight;
+ remainder = difference % totalWeight;
+ if (remainder < 0) {
+ --delta;
+ remainder += totalWeight;
+ }
+ } else {
+ delta = remainder = 0;
+ }
+ /* ASSERT: 0 <= remainder < totalWeight */
+
+ /* Place sashes:
+ */
+ pos = 0;
+ for (i = 0; i < nPanes; ++i) {
+ Pane *pane = Ttk_SlaveData(mgr, i);
+ int weight = pane->weight * (pane->reqSize != 0);
+ int size = pane->reqSize + delta * weight;
+
+ if (weight > remainder)
+ weight = remainder;
+ remainder -= weight;
+ size += weight;
+
+ if (size < 0)
+ size = 0;
+
+ pane->sashPos = (pos += size);
+ pos += sashThickness;
+ }
+
+ /* Handle emergency shrink/emergency stretch:
+ * Set sentinel sash position to end of widget,
+ * shove preceding sashes up.
+ */
+ ShoveUp(pw, nPanes - 1, available);
+}
+
+/* PlacePanes --
+ * Places slave panes based on sash positions.
+ */
+static void PlacePanes(Paned *pw)
+{
+ int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
+ int width = Tk_Width(pw->core.tkwin), height = Tk_Height(pw->core.tkwin);
+ int sashThickness = pw->paned.sashThickness;
+ int pos = 0;
+ int index;
+
+ for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ int size = pane->sashPos - pos;
+
+ if (size > 0) {
+ if (horizontal) {
+ Ttk_PlaceSlave(pw->paned.mgr, index, pos, 0, size, height);
+ } else {
+ Ttk_PlaceSlave(pw->paned.mgr, index, 0, pos, width, size);
+ }
+ } else {
+ Ttk_UnmapSlave(pw->paned.mgr, index);
+ }
+
+ pos = pane->sashPos + sashThickness;
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Manager specification.
+ */
+
+static void PanedPlaceSlaves(void *managerData)
+{
+ Paned *pw = managerData;
+ PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin));
+ PlacePanes(pw);
+}
+
+static void PaneRemoved(void *managerData, int index)
+{
+ Paned *pw = managerData;
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ DestroyPane(pw, pane);
+}
+
+static int AddPane(
+ Tcl_Interp *interp, Paned *pw,
+ int destIndex, Tk_Window slaveWindow,
+ int objc, Tcl_Obj *const objv[])
+{
+ Pane *pane;
+ if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) {
+ return TCL_ERROR;
+ }
+ if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) >= 0) {
+ Tcl_AppendResult(interp,
+ Tk_PathName(slaveWindow), " already added",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ pane = CreatePane(interp, pw, slaveWindow);
+ if (!pane) {
+ return TCL_ERROR;
+ }
+ if (ConfigurePane(interp, pw, pane, slaveWindow, objc, objv) != TCL_OK) {
+ DestroyPane(pw, pane);
+ return TCL_ERROR;
+ }
+
+ Ttk_InsertSlave(pw->paned.mgr, destIndex, slaveWindow, pane);
+ return TCL_OK;
+}
+
+/* PaneRequest --
+ * Only update pane request size if slave is currently unmapped.
+ * Geometry requests from mapped slaves are not directly honored
+ * in order to avoid unexpected pane resizes (esp. while the
+ * user is dragging a sash [#1325286]).
+ */
+static int PaneRequest(void *managerData, int index, int width, int height)
+{
+ Paned *pw = managerData;
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
+
+ if (!Tk_IsMapped(slaveWindow)) {
+ pane->reqSize = horizontal ? width : height;
+ }
+ return 1;
+}
+
+static Ttk_ManagerSpec PanedManagerSpec = {
+ { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ PanedSize,
+ PanedPlaceSlaves,
+ PaneRequest,
+ PaneRemoved
+};
+
+/*------------------------------------------------------------------------
+ * +++ Event handler.
+ *
+ * <<NOTE-PW-LEAVE-NOTIFYINFERIOR>>
+ * Tk does not execute binding scripts for <Leave> events when
+ * the pointer crosses from a parent to a child. This widget
+ * needs to know when that happens, though, so it can reset
+ * the cursor.
+ *
+ * This event handler generates an <<EnteredChild>> virtual event
+ * on LeaveNotify/NotifyInferior.
+ */
+
+static const unsigned PanedEventMask = LeaveWindowMask;
+static void PanedEventProc(ClientData clientData, XEvent *eventPtr)
+{
+ WidgetCore *corePtr = clientData;
+ if ( eventPtr->type == LeaveNotify
+ && eventPtr->xcrossing.detail == NotifyInferior)
+ {
+ TtkSendVirtualEvent(corePtr->tkwin, "EnteredChild");
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Initialization and cleanup hooks.
+ */
+
+static void PanedInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Paned *pw = recordPtr;
+
+ Tk_CreateEventHandler(pw->core.tkwin,
+ PanedEventMask, PanedEventProc, recordPtr);
+ pw->paned.mgr = Ttk_CreateManager(&PanedManagerSpec, pw, pw->core.tkwin);
+ pw->paned.paneOptionTable = Tk_CreateOptionTable(interp,PaneOptionSpecs);
+ pw->paned.sashLayout = 0;
+ pw->paned.sashThickness = 1;
+}
+
+static void PanedCleanup(void *recordPtr)
+{
+ Paned *pw = recordPtr;
+
+ if (pw->paned.sashLayout)
+ Ttk_FreeLayout(pw->paned.sashLayout);
+ Tk_DeleteEventHandler(pw->core.tkwin,
+ PanedEventMask, PanedEventProc, recordPtr);
+ Ttk_DeleteManager(pw->paned.mgr);
+}
+
+/* Post-configuration hook.
+ */
+static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
+{
+ Paned *pw = clientData;
+
+ if (mask & GEOMETRY_CHANGED) {
+ /* User has changed -width or -height.
+ * Recalculate sash positions based on requested size.
+ */
+ Tk_Window tkwin = pw->core.tkwin;
+ PlaceSashes(pw,
+ pw->paned.width > 0 ? pw->paned.width : Tk_Width(tkwin),
+ pw->paned.height > 0 ? pw->paned.height : Tk_Height(tkwin));
+ }
+
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Layout management hooks.
+ */
+static Ttk_Layout PanedGetLayout(
+ Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
+{
+ Paned *pw = recordPtr;
+ Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr);
+
+ if (panedLayout) {
+ int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
+ const char *layoutName =
+ horizontal ? ".Vertical.Sash" : ".Horizontal.Sash";
+ Ttk_Layout sashLayout = Ttk_CreateSublayout(
+ interp, themePtr, panedLayout, layoutName, pw->core.optionTable);
+
+ if (sashLayout) {
+ int sashWidth, sashHeight;
+
+ Ttk_LayoutSize(sashLayout, 0, &sashWidth, &sashHeight);
+ pw->paned.sashThickness = horizontal ? sashWidth : sashHeight;
+
+ if (pw->paned.sashLayout)
+ Ttk_FreeLayout(pw->paned.sashLayout);
+ pw->paned.sashLayout = sashLayout;
+ } else {
+ Ttk_FreeLayout(panedLayout);
+ return 0;
+ }
+ }
+
+ return panedLayout;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Drawing routines.
+ */
+
+/* SashLayout --
+ * Place the sash sublayout after the specified pane,
+ * in preparation for drawing.
+ */
+static Ttk_Layout SashLayout(Paned *pw, int index)
+{
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ int thickness = pw->paned.sashThickness,
+ height = Tk_Height(pw->core.tkwin),
+ width = Tk_Width(pw->core.tkwin),
+ sashPos = pane->sashPos;
+
+ Ttk_PlaceLayout(
+ pw->paned.sashLayout, pw->core.state,
+ pw->paned.orient == TTK_ORIENT_HORIZONTAL
+ ? Ttk_MakeBox(sashPos, 0, thickness, height)
+ : Ttk_MakeBox(0, sashPos, width, thickness));
+
+ return pw->paned.sashLayout;
+}
+
+static void DrawSash(Paned *pw, int index, Drawable d)
+{
+ Ttk_DrawLayout(SashLayout(pw, index), pw->core.state, d);
+}
+
+static void PanedDisplay(void *recordPtr, Drawable d)
+{
+ Paned *pw = recordPtr;
+ int i, nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+
+ TtkWidgetDisplay(recordPtr, d);
+ for (i = 0; i < nSashes; ++i) {
+ DrawSash(pw, i, d);
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands.
+ */
+
+/* $pw add window [ options ... ]
+ */
+static int PanedAddCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Paned *pw = recordPtr;
+ Tk_Window slaveWindow;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window");
+ return TCL_ERROR;
+ }
+
+ slaveWindow = Tk_NameToWindow(
+ interp, Tcl_GetString(objv[2]), pw->core.tkwin);
+
+ if (!slaveWindow) {
+ return TCL_ERROR;
+ }
+
+ return AddPane(interp, pw, Ttk_NumberSlaves(pw->paned.mgr), slaveWindow,
+ objc - 3, objv + 3);
+}
+
+/* $pw insert $index $slave ?-option value ...?
+ * Insert new slave, or move existing one.
+ */
+static int PanedInsertCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Paned *pw = recordPtr;
+ int nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
+ int srcIndex, destIndex;
+ Tk_Window slaveWindow;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ return TCL_ERROR;
+ }
+
+ slaveWindow = Tk_NameToWindow(
+ interp, Tcl_GetString(objv[3]), pw->core.tkwin);
+ if (!slaveWindow) {
+ return TCL_ERROR;
+ }
+
+ if (!strcmp(Tcl_GetString(objv[2]), "end")) {
+ destIndex = Ttk_NumberSlaves(pw->paned.mgr);
+ } else if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ interp,pw->paned.mgr,objv[2],&destIndex))
+ {
+ return TCL_ERROR;
+ }
+
+ srcIndex = Ttk_SlaveIndex(pw->paned.mgr, slaveWindow);
+ if (srcIndex < 0) { /* New slave: */
+ return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4);
+ } /* else -- move existing slave: */
+
+ if (destIndex >= nSlaves)
+ destIndex = nSlaves - 1;
+ Ttk_ReorderSlave(pw->paned.mgr, srcIndex, destIndex);
+
+ return objc == 4 ? TCL_OK :
+ ConfigurePane(interp, pw,
+ Ttk_SlaveData(pw->paned.mgr, destIndex),
+ Ttk_SlaveWindow(pw->paned.mgr, destIndex),
+ objc-4,objv+4);
+}
+
+/* $pw forget $pane
+ */
+static int PanedForgetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Paned *pw = recordPtr;
+ int paneIndex;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2,objv, "pane");
+ return TCL_ERROR;
+ }
+
+ if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ interp, pw->paned.mgr, objv[2], &paneIndex))
+ {
+ return TCL_ERROR;
+ }
+ Ttk_ForgetSlave(pw->paned.mgr, paneIndex);
+
+ return TCL_OK;
+}
+
+/* $pw identify ?what? $x $y --
+ * Return index of sash at $x,$y
+ */
+static int PanedIdentifyCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ const char *whatTable[] = { "element", "sash", NULL };
+ enum { IDENTIFY_ELEMENT, IDENTIFY_SASH };
+ int what = IDENTIFY_SASH;
+ Paned *pw = recordPtr;
+ int sashThickness = pw->paned.sashThickness;
+ int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ int x, y, pos;
+ int index;
+
+ if (objc < 4 || objc > 5) {
+ Tcl_WrongNumArgs(interp, 2,objv, "?what? x y");
+ return TCL_ERROR;
+ }
+
+ if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
+ || (objc == 5 &&
+ Tcl_GetIndexFromObj(interp, objv[2], whatTable, "option", 0, &what)
+ != TCL_OK)
+ ) {
+ return TCL_ERROR;
+ }
+
+ pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y;
+ for (index = 0; index < nSashes; ++index) {
+ Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) {
+ /* Found it. */
+ switch (what) {
+ case IDENTIFY_SASH:
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ return TCL_OK;
+ case IDENTIFY_ELEMENT:
+ {
+ Ttk_Element element =
+ Ttk_IdentifyElement(SashLayout(pw, index), x, y);
+ if (element) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(Ttk_ElementName(element), -1));
+ }
+ return TCL_OK;
+ }
+ }
+ }
+ }
+
+ return TCL_OK; /* nothing found - return empty string */
+}
+
+/* $pw pane $pane ?-option ?value -option value ...??
+ * Query/modify pane options.
+ */
+static int PanedPaneCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Paned *pw = recordPtr;
+ int paneIndex;
+ Tk_Window slaveWindow;
+ Pane *pane;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2,objv, "pane ?-option value ...?");
+ return TCL_ERROR;
+ }
+
+ if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ interp,pw->paned.mgr,objv[2],&paneIndex))
+ {
+ return TCL_ERROR;
+ }
+
+ pane = Ttk_SlaveData(pw->paned.mgr, paneIndex);
+ slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex);
+
+ switch (objc) {
+ case 3:
+ return TtkEnumerateOptions(interp, pane, PaneOptionSpecs,
+ pw->paned.paneOptionTable, slaveWindow);
+ case 4:
+ return TtkGetOptionValue(interp, pane, objv[3],
+ pw->paned.paneOptionTable, slaveWindow);
+ default:
+ return ConfigurePane(interp, pw, pane, slaveWindow, objc-3,objv+3);
+ }
+}
+
+/* $pw panes --
+ * Return list of managed panes.
+ */
+static int PanedPanesCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Paned *pw = recordPtr;
+ Ttk_Manager *mgr = pw->paned.mgr;
+ Tcl_Obj *panes;
+ int i;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
+ return TCL_ERROR;
+ }
+
+ panes = Tcl_NewListObj(0, NULL);
+ for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ Tcl_ListObjAppendElement(interp, panes, Tcl_NewStringObj(pathName,-1));
+ }
+ Tcl_SetObjResult(interp, panes);
+
+ return TCL_OK;
+}
+
+
+/* $pw sashpos $index ?$newpos?
+ * Query or modify sash position.
+ */
+static int PanedSashposCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Paned *pw = recordPtr;
+ int sashIndex, position = -1;
+ Pane *pane;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 2,objv, "index ?newpos?");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (sashIndex < 0 || sashIndex >= Ttk_NumberSlaves(pw->paned.mgr) - 1) {
+ Tcl_AppendResult(interp,
+ "sash index ", Tcl_GetString(objv[2]), " out of range",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ pane = Ttk_SlaveData(pw->paned.mgr, sashIndex);
+
+ if (objc == 3) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos));
+ return TCL_OK;
+ }
+ /* else -- set new sash position */
+
+ if (Tcl_GetIntFromObj(interp, objv[3], &position) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (position < pane->sashPos) {
+ ShoveUp(pw, sashIndex, position);
+ } else {
+ ShoveDown(pw, sashIndex, position);
+ }
+
+ AdjustPanes(pw);
+ Ttk_ManagerLayoutChanged(pw->paned.mgr);
+
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos));
+ return TCL_OK;
+}
+
+static const Ttk_Ensemble PanedCommands[] = {
+ { "add", PanedAddCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "forget", PanedForgetCommand,0 },
+ { "identify", PanedIdentifyCommand,0 },
+ { "insert", PanedInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "pane", PanedPaneCommand,0 },
+ { "panes", PanedPanesCommand,0 },
+ { "sashpos", PanedSashposCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { 0,0,0 }
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget specification.
+ */
+
+static WidgetSpec PanedWidgetSpec =
+{
+ "TPanedwindow", /* className */
+ sizeof(Paned), /* recordSize */
+ PanedOptionSpecs, /* optionSpecs */
+ PanedCommands, /* subcommands */
+ PanedInitialize, /* initializeProc */
+ PanedCleanup, /* cleanupProc */
+ TtkCoreConfigure, /* configureProc */
+ PanedPostConfigure, /* postConfigureProc */
+ PanedGetLayout, /* getLayoutProc */
+ PanedSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ PanedDisplay /* displayProc */
+};
+
+/*------------------------------------------------------------------------
+ * +++ Elements and layouts.
+ */
+
+static const int DEFAULT_SASH_THICKNESS = 5;
+
+typedef struct {
+ Tcl_Obj *thicknessObj;
+} SashElement;
+
+static Ttk_ElementOptionSpec SashElementOptions[] = {
+ { "-sashthickness", TK_OPTION_INT,
+ Tk_Offset(SashElement,thicknessObj), "5" },
+ { NULL, 0, 0, NULL }
+};
+
+static void SashElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SashElement *sash = elementRecord;
+ int thickness = DEFAULT_SASH_THICKNESS;
+ Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness);
+ *widthPtr = *heightPtr = thickness;
+}
+
+static Ttk_ElementSpec SashElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SashElement),
+ SashElementOptions,
+ SashElementSize,
+ TtkNullElementDraw
+};
+
+TTK_BEGIN_LAYOUT(PanedLayout)
+ TTK_NODE("Panedwindow.background", 0)/* @@@ BUG: empty layouts don't work */
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(HorizontalSashLayout)
+ TTK_NODE("Sash.hsash", TTK_FILL_X)
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(VerticalSashLayout)
+ TTK_NODE("Sash.vsash", TTK_FILL_Y)
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Registration routine.
+ */
+MODULE_SCOPE
+void TtkPanedwindow_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
+ RegisterWidget(interp, "ttk::panedwindow", &PanedWidgetSpec);
+
+ Ttk_RegisterElement(interp, themePtr, "hsash", &SashElementSpec, 0);
+ Ttk_RegisterElement(interp, themePtr, "vsash", &SashElementSpec, 0);
+
+ Ttk_RegisterLayout(themePtr, "TPanedwindow", PanedLayout);
+ Ttk_RegisterLayout(themePtr, "Horizontal.Sash", HorizontalSashLayout);
+ Ttk_RegisterLayout(themePtr, "Vertical.Sash", VerticalSashLayout);
+}
+
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
new file mode 100644
index 0000000..4dc50a2
--- /dev/null
+++ b/generic/ttk/ttkProgress.c
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham
+ *
+ * ttk::progressbar widget.
+ */
+
+#include <math.h>
+#include <tk.h>
+
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/*------------------------------------------------------------------------
+ * +++ Widget record:
+ */
+
+#define DEF_PROGRESSBAR_LENGTH "100"
+enum {
+ TTK_PROGRESSBAR_DETERMINATE, TTK_PROGRESSBAR_INDETERMINATE
+};
+static const char *const ProgressbarModeStrings[] = {
+ "determinate", "indeterminate", NULL
+};
+
+typedef struct {
+ Tcl_Obj *orientObj;
+ Tcl_Obj *lengthObj;
+ Tcl_Obj *modeObj;
+ Tcl_Obj *variableObj;
+ Tcl_Obj *maximumObj;
+ Tcl_Obj *valueObj;
+ Tcl_Obj *phaseObj;
+
+ int mode;
+ Ttk_TraceHandle *variableTrace; /* Trace handle for -variable option */
+ int period; /* Animation period */
+ int maxPhase; /* Max animation phase */
+ Tcl_TimerToken timer; /* Animation timer */
+
+} ProgressbarPart;
+
+typedef struct {
+ WidgetCore core;
+ ProgressbarPart progress;
+} Progressbar;
+
+static Tk_OptionSpec ProgressbarOptionSpecs[] =
+{
+ {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
+ "horizontal", Tk_Offset(Progressbar,progress.orientObj), -1,
+ 0, (ClientData)ttkOrientStrings, STYLE_CHANGED },
+ {TK_OPTION_PIXELS, "-length", "length", "Length",
+ DEF_PROGRESSBAR_LENGTH, Tk_Offset(Progressbar,progress.lengthObj), -1,
+ 0, 0, GEOMETRY_CHANGED },
+ {TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate",
+ Tk_Offset(Progressbar,progress.modeObj),
+ Tk_Offset(Progressbar,progress.mode),
+ 0, (ClientData)ProgressbarModeStrings, 0 },
+ {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum",
+ "100", Tk_Offset(Progressbar,progress.maximumObj), -1,
+ 0, 0, 0 },
+ {TK_OPTION_STRING, "-variable", "variable", "Variable",
+ NULL, Tk_Offset(Progressbar,progress.variableObj), -1,
+ TK_OPTION_NULL_OK, 0, 0 },
+ {TK_OPTION_DOUBLE, "-value", "value", "Value",
+ "0.0", Tk_Offset(Progressbar,progress.valueObj), -1,
+ 0, 0, 0 },
+ {TK_OPTION_INT, "-phase", "phase", "Phase",
+ "0", Tk_Offset(Progressbar,progress.phaseObj), -1,
+ 0, 0, 0 },
+
+ WIDGET_TAKEFOCUS_FALSE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*------------------------------------------------------------------------
+ * +++ Animation procedures:
+ */
+
+/* AnimationEnabled --
+ * Returns 1 if animation should be active, 0 otherwise.
+ */
+static int AnimationEnabled(Progressbar *pb)
+{
+ double maximum = 100, value = 0;
+
+ Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum);
+ Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value);
+
+ return pb->progress.period > 0
+ && value > 0.0
+ && ( value < maximum
+ || pb->progress.mode == TTK_PROGRESSBAR_INDETERMINATE);
+}
+
+/* AnimateProgressProc --
+ * Timer callback for progress bar animation.
+ * Increments the -phase option, redisplays the widget,
+ * and reschedules itself if animation still enabled.
+ */
+static void AnimateProgressProc(ClientData clientData)
+{
+ Progressbar *pb = clientData;
+
+ pb->progress.timer = 0;
+
+ if (AnimationEnabled(pb)) {
+ int phase = 0;
+ Tcl_GetIntFromObj(NULL, pb->progress.phaseObj, &phase);
+
+ /*
+ * Update -phase:
+ */
+ ++phase;
+ if (pb->progress.maxPhase)
+ phase %= pb->progress.maxPhase;
+ Tcl_DecrRefCount(pb->progress.phaseObj);
+ pb->progress.phaseObj = Tcl_NewIntObj(phase);
+ Tcl_IncrRefCount(pb->progress.phaseObj);
+
+ /*
+ * Reschedule:
+ */
+ pb->progress.timer = Tcl_CreateTimerHandler(
+ pb->progress.period, AnimateProgressProc, clientData);
+
+ TtkRedisplayWidget(&pb->core);
+ }
+}
+
+/* CheckAnimation --
+ * If animation is enabled and not scheduled, schedule it.
+ * If animation is disabled but scheduled, cancel it.
+ */
+static void CheckAnimation(Progressbar *pb)
+{
+ if (AnimationEnabled(pb)) {
+ if (pb->progress.timer == 0) {
+ pb->progress.timer = Tcl_CreateTimerHandler(
+ pb->progress.period, AnimateProgressProc, (ClientData)pb);
+ }
+ } else {
+ if (pb->progress.timer != 0) {
+ Tcl_DeleteTimerHandler(pb->progress.timer);
+ pb->progress.timer = 0;
+ }
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Trace hook for progressbar -variable option:
+ */
+
+static void VariableChanged(void *recordPtr, const char *value)
+{
+ Progressbar *pb = recordPtr;
+ Tcl_Obj *newValue;
+ double scratch;
+
+ if (WidgetDestroyed(&pb->core)) {
+ return;
+ }
+
+ if (!value) {
+ /* Linked variable is unset -- disable widget */
+ TtkWidgetChangeState(&pb->core, TTK_STATE_DISABLED, 0);
+ return;
+ }
+ TtkWidgetChangeState(&pb->core, 0, TTK_STATE_DISABLED);
+
+ newValue = Tcl_NewStringObj(value, -1);
+ Tcl_IncrRefCount(newValue);
+ if (Tcl_GetDoubleFromObj(NULL, newValue, &scratch) != TCL_OK) {
+ TtkWidgetChangeState(&pb->core, TTK_STATE_INVALID, 0);
+ return;
+ }
+ TtkWidgetChangeState(&pb->core, 0, TTK_STATE_INVALID);
+ Tcl_DecrRefCount(pb->progress.valueObj);
+ pb->progress.valueObj = newValue;
+
+ CheckAnimation(pb);
+ TtkRedisplayWidget(&pb->core);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget class methods:
+ */
+
+static void ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Progressbar *pb = recordPtr;
+ pb->progress.variableTrace = 0;
+ pb->progress.timer = 0;
+}
+
+static void ProgressbarCleanup(void *recordPtr)
+{
+ Progressbar *pb = recordPtr;
+ if (pb->progress.variableTrace)
+ Ttk_UntraceVariable(pb->progress.variableTrace);
+ if (pb->progress.timer)
+ Tcl_DeleteTimerHandler(pb->progress.timer);
+}
+
+/*
+ * Configure hook:
+ *
+ * @@@ TODO: deal with [$pb configure -value ... -variable ...]
+ */
+static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Progressbar *pb = recordPtr;
+ Tcl_Obj *varName = pb->progress.variableObj;
+ Ttk_TraceHandle *vt = 0;
+
+ if (varName != NULL && *Tcl_GetString(varName) != '\0') {
+ vt = Ttk_TraceVariable(interp, varName, VariableChanged, recordPtr);
+ if (!vt) return TCL_ERROR;
+ }
+
+ if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) {
+ if (vt) Ttk_UntraceVariable(vt);
+ return TCL_ERROR;
+ }
+
+ if (pb->progress.variableTrace) {
+ Ttk_UntraceVariable(pb->progress.variableTrace);
+ }
+ pb->progress.variableTrace = vt;
+
+ return TCL_OK;
+}
+
+/*
+ * Post-configuration hook:
+ */
+static int ProgressbarPostConfigure(
+ Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Progressbar *pb = recordPtr;
+ int status = TCL_OK;
+
+ if (pb->progress.variableTrace) {
+ status = Ttk_FireTrace(pb->progress.variableTrace);
+ if (WidgetDestroyed(&pb->core)) {
+ return TCL_ERROR;
+ }
+ if (status != TCL_OK) {
+ /* Unset -variable: */
+ Ttk_UntraceVariable(pb->progress.variableTrace);
+ Tcl_DecrRefCount(pb->progress.variableObj);
+ pb->progress.variableTrace = 0;
+ pb->progress.variableObj = NULL;
+ return TCL_ERROR;
+ }
+ }
+
+ CheckAnimation(pb);
+
+ return status;
+}
+
+/*
+ * Size hook:
+ * Compute base layout size, overrid
+ */
+static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr)
+{
+ Progressbar *pb = recordPtr;
+ int length = 100, orient = TTK_ORIENT_HORIZONTAL;
+
+ TtkWidgetSize(recordPtr, widthPtr, heightPtr);
+
+ /* Override requested width (height) based on -length and -orient
+ */
+ Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length);
+ Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient);
+
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ *widthPtr = length;
+ } else {
+ *heightPtr = length;
+ }
+
+ return 1;
+}
+
+/*
+ * Layout hook:
+ * Adjust size and position of pbar element, if present.
+ */
+
+static void ProgressbarDeterminateLayout(
+ Progressbar *pb,
+ Ttk_Element pbar,
+ Ttk_Box parcel,
+ double fraction,
+ Ttk_Orient orient)
+{
+ if (fraction < 0.0) fraction = 0.0;
+ if (fraction > 1.0) fraction = 1.0;
+
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ parcel.width = (int)(parcel.width * fraction);
+ } else {
+ int newHeight = (int)(parcel.height * fraction);
+ parcel.y += (parcel.height - newHeight);
+ parcel.height = newHeight;
+ }
+ Ttk_PlaceElement(pb->core.layout, pbar, parcel);
+}
+
+static void ProgressbarIndeterminateLayout(
+ Progressbar *pb,
+ Ttk_Element pbar,
+ Ttk_Box parcel,
+ double fraction,
+ Ttk_Orient orient)
+{
+ Ttk_Box pbarBox = Ttk_ElementParcel(pbar);
+
+ fraction = fmod(fabs(fraction), 2.0);
+ if (fraction > 1.0) {
+ fraction = 2.0 - fraction;
+ }
+
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ pbarBox.x = parcel.x + (int)(fraction * (parcel.width-pbarBox.width));
+ } else {
+ pbarBox.y = parcel.y + (int)(fraction * (parcel.height-pbarBox.height));
+ }
+ Ttk_PlaceElement(pb->core.layout, pbar, pbarBox);
+}
+
+static void ProgressbarDoLayout(void *recordPtr)
+{
+ Progressbar *pb = recordPtr;
+ WidgetCore *corePtr = &pb->core;
+ Ttk_Element pbar = Ttk_FindElement(corePtr->layout, "pbar");
+ double value = 0.0, maximum = 100.0;
+ int orient = TTK_ORIENT_HORIZONTAL;
+
+ Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
+
+ /* Adjust the bar size:
+ */
+
+ Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value);
+ Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum);
+ Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient);
+
+ if (pbar) {
+ double fraction = value / maximum;
+ Ttk_Box parcel = Ttk_ClientRegion(corePtr->layout, "trough");
+
+ if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) {
+ ProgressbarDeterminateLayout(
+ pb, pbar, parcel, fraction, orient);
+ } else {
+ ProgressbarIndeterminateLayout(
+ pb, pbar, parcel, fraction, orient);
+ }
+ }
+}
+
+static Ttk_Layout ProgressbarGetLayout(
+ Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
+{
+ Progressbar *pb = recordPtr;
+ Ttk_Layout layout = TtkWidgetGetOrientedLayout(
+ interp, theme, recordPtr, pb->progress.orientObj);
+
+ /*
+ * Check if the style supports animation:
+ */
+ pb->progress.period = 0;
+ pb->progress.maxPhase = 0;
+ if (layout) {
+ Tcl_Obj *periodObj = Ttk_QueryOption(layout,"-period", 0);
+ Tcl_Obj *maxPhaseObj = Ttk_QueryOption(layout,"-maxphase", 0);
+ if (periodObj)
+ Tcl_GetIntFromObj(NULL, periodObj, &pb->progress.period);
+ if (maxPhaseObj)
+ Tcl_GetIntFromObj(NULL, maxPhaseObj, &pb->progress.maxPhase);
+ }
+
+ return layout;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands:
+ */
+
+/* $sb step ?amount?
+ */
+static int ProgressbarStepCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Progressbar *pb = recordPtr;
+ double value = 0.0, stepAmount = 1.0;
+ Tcl_Obj *newValueObj;
+
+ if (objc == 3) {
+ if (Tcl_GetDoubleFromObj(interp, objv[2], &stepAmount) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ } else if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2,objv, "?stepAmount?");
+ return TCL_ERROR;
+ }
+
+ (void)Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value);
+ value += stepAmount;
+
+ /* In determinate mode, wrap around if value exceeds maximum:
+ */
+ if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) {
+ double maximum = 100.0;
+ (void)Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum);
+ value = fmod(value, maximum);
+ }
+
+ newValueObj = Tcl_NewDoubleObj(value);
+
+ TtkRedisplayWidget(&pb->core);
+
+ /* Update value by setting the linked -variable, if there is one:
+ */
+ if (pb->progress.variableTrace) {
+ return Tcl_ObjSetVar2(
+ interp, pb->progress.variableObj, 0, newValueObj,
+ TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)
+ ? TCL_OK : TCL_ERROR;
+ }
+
+ /* Otherwise, change the -value directly:
+ */
+ Tcl_IncrRefCount(newValueObj);
+ Tcl_DecrRefCount(pb->progress.valueObj);
+ pb->progress.valueObj = newValueObj;
+ CheckAnimation(pb);
+
+ return TCL_OK;
+}
+
+/* $sb start|stop ?args? --
+ * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...]
+ * and pass to interpreter.
+ */
+static int ProgressbarStartStopCommand(
+ Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *const objv[])
+{
+ Tcl_Obj *cmd = Tcl_NewListObj(objc, objv);
+ Tcl_Obj *prefix[2];
+ int status;
+
+ /* ASSERT: objc >= 2 */
+
+ prefix[0] = Tcl_NewStringObj(cmdName, -1);
+ prefix[1] = objv[0];
+ Tcl_ListObjReplace(interp, cmd, 0,2, 2,prefix);
+
+ Tcl_IncrRefCount(cmd);
+ status = Tcl_EvalObjEx(interp, cmd, 0);
+ Tcl_DecrRefCount(cmd);
+
+ return status;
+}
+
+static int ProgressbarStartCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ return ProgressbarStartStopCommand(
+ interp, "::ttk::progressbar::start", objc, objv);
+}
+
+static int ProgressbarStopCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ return ProgressbarStartStopCommand(
+ interp, "::ttk::progressbar::stop", objc, objv);
+}
+
+static const Ttk_Ensemble ProgressbarCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "start", ProgressbarStartCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "step", ProgressbarStepCommand,0 },
+ { "stop", ProgressbarStopCommand,0 },
+ { 0,0,0 }
+};
+
+/*
+ * Widget specification:
+ */
+static WidgetSpec ProgressbarWidgetSpec =
+{
+ "TProgressbar", /* className */
+ sizeof(Progressbar), /* recordSize */
+ ProgressbarOptionSpecs, /* optionSpecs */
+ ProgressbarCommands, /* subcommands */
+ ProgressbarInitialize, /* initializeProc */
+ ProgressbarCleanup, /* cleanupProc */
+ ProgressbarConfigure, /* configureProc */
+ ProgressbarPostConfigure, /* postConfigureProc */
+ ProgressbarGetLayout, /* getLayoutProc */
+ ProgressbarSize, /* sizeProc */
+ ProgressbarDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+/*
+ * Layouts:
+ */
+TTK_BEGIN_LAYOUT(VerticalProgressbarLayout)
+ TTK_GROUP("Vertical.Progressbar.trough", TTK_FILL_BOTH,
+ TTK_NODE("Vertical.Progressbar.pbar", TTK_PACK_BOTTOM|TTK_FILL_X))
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(HorizontalProgressbarLayout)
+ TTK_GROUP("Horizontal.Progressbar.trough", TTK_FILL_BOTH,
+ TTK_NODE("Horizontal.Progressbar.pbar", TTK_PACK_LEFT|TTK_FILL_Y))
+TTK_END_LAYOUT
+
+/*
+ * Initialization:
+ */
+
+MODULE_SCOPE
+void TtkProgressbar_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(themePtr,
+ "Vertical.TProgressbar", VerticalProgressbarLayout);
+ Ttk_RegisterLayout(themePtr,
+ "Horizontal.TProgressbar", HorizontalProgressbarLayout);
+
+ RegisterWidget(interp, "ttk::progressbar", &ProgressbarWidgetSpec);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
new file mode 100644
index 0000000..69753d1
--- /dev/null
+++ b/generic/ttk/ttkScale.c
@@ -0,0 +1,515 @@
+/*
+ * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+ *
+ * ttk::scale widget.
+ */
+
+#include <tk.h>
+#include <string.h>
+#include <stdio.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+#define DEF_SCALE_LENGTH "100"
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+/*
+ * Scale widget record
+ */
+typedef struct
+{
+ /* slider element options */
+ Tcl_Obj *fromObj; /* minimum value */
+ Tcl_Obj *toObj; /* maximum value */
+ Tcl_Obj *valueObj; /* current value */
+ Tcl_Obj *lengthObj; /* length of the long axis of the scale */
+ Tcl_Obj *orientObj; /* widget orientation */
+ int orient;
+
+ /* widget options */
+ Tcl_Obj *commandObj;
+ Tcl_Obj *variableObj;
+
+ /* internal state */
+ Ttk_TraceHandle *variableTrace;
+
+} ScalePart;
+
+typedef struct
+{
+ WidgetCore core;
+ ScalePart scale;
+} Scale;
+
+static Tk_OptionSpec ScaleOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-command", "command", "Command", "",
+ Tk_Offset(Scale,scale.commandObj), -1,
+ TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_STRING, "-variable", "variable", "Variable", "",
+ Tk_Offset(Scale,scale.variableObj), -1,
+ 0,0,0},
+ {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
+ Tk_Offset(Scale,scale.orientObj),
+ Tk_Offset(Scale,scale.orient), 0,
+ (ClientData)ttkOrientStrings, STYLE_CHANGED },
+
+ {TK_OPTION_DOUBLE, "-from", "from", "From", "0",
+ Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0},
+ {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0",
+ Tk_Offset(Scale,scale.toObj), -1, 0, 0, 0},
+ {TK_OPTION_DOUBLE, "-value", "value", "Value", "0",
+ Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0},
+ {TK_OPTION_PIXELS, "-length", "length", "Length",
+ DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0,
+ GEOMETRY_CHANGED},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+static XPoint ValueToPoint(Scale *scalePtr, double value);
+static double PointToValue(Scale *scalePtr, int x, int y);
+
+/* ScaleVariableChanged --
+ * Variable trace procedure for scale -variable;
+ * Updates the scale's value.
+ * If the linked variable is not a valid double,
+ * sets the 'invalid' state.
+ */
+static void ScaleVariableChanged(void *recordPtr, const char *value)
+{
+ Scale *scale = recordPtr;
+ double v;
+
+ if (value == NULL || Tcl_GetDouble(0, value, &v) != TCL_OK) {
+ TtkWidgetChangeState(&scale->core, TTK_STATE_INVALID, 0);
+ } else {
+ Tcl_Obj *valueObj = Tcl_NewDoubleObj(v);
+ Tcl_IncrRefCount(valueObj);
+ Tcl_DecrRefCount(scale->scale.valueObj);
+ scale->scale.valueObj = valueObj;
+ TtkWidgetChangeState(&scale->core, 0, TTK_STATE_INVALID);
+ }
+ TtkRedisplayWidget(&scale->core);
+}
+
+/* ScaleInitialize --
+ * Scale widget initialization hook.
+ */
+static void ScaleInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Scale *scalePtr = recordPtr;
+ TtkTrackElementState(&scalePtr->core);
+}
+
+static void ScaleCleanup(void *recordPtr)
+{
+ Scale *scale = recordPtr;
+
+ if (scale->scale.variableTrace) {
+ Ttk_UntraceVariable(scale->scale.variableTrace);
+ scale->scale.variableTrace = 0;
+ }
+}
+
+/* ScaleConfigure --
+ * Configuration hook.
+ */
+static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Scale *scale = recordPtr;
+ Tcl_Obj *varName = scale->scale.variableObj;
+ Ttk_TraceHandle *vt = 0;
+
+ if (varName != NULL && *Tcl_GetString(varName) != '\0') {
+ vt = Ttk_TraceVariable(interp,varName, ScaleVariableChanged,recordPtr);
+ if (!vt) return TCL_ERROR;
+ }
+
+ if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) {
+ if (vt) Ttk_UntraceVariable(vt);
+ return TCL_ERROR;
+ }
+
+ if (scale->scale.variableTrace) {
+ Ttk_UntraceVariable(scale->scale.variableTrace);
+ }
+ scale->scale.variableTrace = vt;
+
+ return TCL_OK;
+}
+
+/* ScalePostConfigure --
+ * Post-configuration hook.
+ */
+static int ScalePostConfigure(
+ Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Scale *scale = recordPtr;
+ int status = TCL_OK;
+
+ if (scale->scale.variableTrace) {
+ status = Ttk_FireTrace(scale->scale.variableTrace);
+ if (WidgetDestroyed(&scale->core)) {
+ return TCL_ERROR;
+ }
+ if (status != TCL_OK) {
+ /* Unset -variable: */
+ Ttk_UntraceVariable(scale->scale.variableTrace);
+ Tcl_DecrRefCount(scale->scale.variableObj);
+ scale->scale.variableTrace = 0;
+ scale->scale.variableObj = NULL;
+ status = TCL_ERROR;
+ }
+ }
+
+ return status;
+}
+
+/* ScaleGetLayout --
+ * getLayout hook.
+ */
+static Ttk_Layout
+ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
+{
+ Scale *scalePtr = recordPtr;
+ return TtkWidgetGetOrientedLayout(
+ interp, theme, recordPtr, scalePtr->scale.orientObj);
+}
+
+/*
+ * TroughBox --
+ * Returns the inner area of the trough element.
+ */
+static Ttk_Box TroughBox(Scale *scalePtr)
+{
+ return Ttk_ClientRegion(scalePtr->core.layout, "trough");
+}
+
+/*
+ * TroughRange --
+ * Return the value area of the trough element, adjusted
+ * for slider size.
+ */
+static Ttk_Box TroughRange(Scale *scalePtr)
+{
+ Ttk_Box troughBox = TroughBox(scalePtr);
+ Ttk_Element slider = Ttk_FindElement(scalePtr->core.layout,"slider");
+
+ /*
+ * If this is a scale widget, adjust range for slider:
+ */
+ if (slider) {
+ Ttk_Box sliderBox = Ttk_ElementParcel(slider);
+ if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) {
+ troughBox.x += sliderBox.width / 2;
+ troughBox.width -= sliderBox.width;
+ } else {
+ troughBox.y += sliderBox.height / 2;
+ troughBox.height -= sliderBox.height;
+ }
+ }
+
+ return troughBox;
+}
+
+/*
+ * ScaleFraction --
+ */
+static double ScaleFraction(Scale *scalePtr, double value)
+{
+ double from = 0, to = 1, fraction;
+
+ Tcl_GetDoubleFromObj(NULL, scalePtr->scale.fromObj, &from);
+ Tcl_GetDoubleFromObj(NULL, scalePtr->scale.toObj, &to);
+
+ if (from == to) {
+ return 1.0;
+ }
+
+ fraction = (value - from) / (to - from);
+
+ return fraction < 0 ? 0 : fraction > 1 ? 1 : fraction;
+}
+
+/* $scale get ?x y? --
+ * Returns the current value of the scale widget, or if $x and
+ * $y are specified, the value represented by point @x,y.
+ */
+static int
+ScaleGetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Scale *scalePtr = recordPtr;
+ int x, y, r = TCL_OK;
+ double value = 0;
+
+ if ((objc != 2) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?");
+ return TCL_ERROR;
+ }
+ if (objc == 2) {
+ Tcl_SetObjResult(interp, scalePtr->scale.valueObj);
+ } else {
+ r = Tcl_GetIntFromObj(interp, objv[2], &x);
+ if (r == TCL_OK)
+ r = Tcl_GetIntFromObj(interp, objv[3], &y);
+ if (r == TCL_OK) {
+ value = PointToValue(scalePtr, x, y);
+ Tcl_SetObjResult(interp, Tcl_NewDoubleObj(value));
+ }
+ }
+ return r;
+}
+
+/* $scale set $newValue
+ */
+static int
+ScaleSetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Scale *scalePtr = recordPtr;
+ double from = 0.0, to = 1.0, value;
+ int result = TCL_OK;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "set value");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetDoubleFromObj(interp, objv[2], &value) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (scalePtr->core.state & TTK_STATE_DISABLED) {
+ return TCL_OK;
+ }
+
+ /* ASSERT: fromObj and toObj are valid doubles.
+ */
+ Tcl_GetDoubleFromObj(interp, scalePtr->scale.fromObj, &from);
+ Tcl_GetDoubleFromObj(interp, scalePtr->scale.toObj, &to);
+
+ /* Limit new value to between 'from' and 'to':
+ */
+ if (from < to) {
+ value = value < from ? from : value > to ? to : value;
+ } else {
+ value = value < to ? to : value > from ? from : value;
+ }
+
+ /*
+ * Set value:
+ */
+ Tcl_DecrRefCount(scalePtr->scale.valueObj);
+ scalePtr->scale.valueObj = Tcl_NewDoubleObj(value);
+ Tcl_IncrRefCount(scalePtr->scale.valueObj);
+ TtkRedisplayWidget(&scalePtr->core);
+
+ /*
+ * Set attached variable, if any:
+ */
+ if (scalePtr->scale.variableObj != NULL) {
+ Tcl_ObjSetVar2(interp, scalePtr->scale.variableObj, NULL,
+ scalePtr->scale.valueObj, TCL_GLOBAL_ONLY);
+ }
+ if (WidgetDestroyed(&scalePtr->core)) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Invoke -command, if any:
+ */
+ if (scalePtr->scale.commandObj != NULL) {
+ Tcl_Obj *cmdObj = Tcl_DuplicateObj(scalePtr->scale.commandObj);
+ Tcl_IncrRefCount(cmdObj);
+ Tcl_AppendToObj(cmdObj, " ", 1);
+ Tcl_AppendObjToObj(cmdObj, scalePtr->scale.valueObj);
+ result = Tcl_EvalObjEx(interp, cmdObj, TCL_EVAL_GLOBAL);
+ Tcl_DecrRefCount(cmdObj);
+ }
+
+ return result;
+}
+
+static int
+ScaleCoordsCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Scale *scalePtr = recordPtr;
+ double value;
+ int r = TCL_OK;
+
+ if (objc < 2 || objc > 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ r = Tcl_GetDoubleFromObj(interp, objv[2], &value);
+ } else {
+ r = Tcl_GetDoubleFromObj(interp, scalePtr->scale.valueObj, &value);
+ }
+
+ if (r == TCL_OK) {
+ Tcl_Obj *point[2];
+ XPoint pt = ValueToPoint(scalePtr, value);
+ point[0] = Tcl_NewIntObj(pt.x);
+ point[1] = Tcl_NewIntObj(pt.y);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, point));
+ }
+ return r;
+}
+
+static void ScaleDoLayout(void *clientData)
+{
+ WidgetCore *corePtr = clientData;
+ Ttk_Element slider = Ttk_FindElement(corePtr->layout, "slider");
+
+ Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
+
+ /* Adjust the slider position:
+ */
+ if (slider) {
+ Scale *scalePtr = clientData;
+ Ttk_Box troughBox = TroughBox(scalePtr);
+ Ttk_Box sliderBox = Ttk_ElementParcel(slider);
+ double value = 0.0;
+ double fraction;
+ int range;
+
+ Tcl_GetDoubleFromObj(NULL, scalePtr->scale.valueObj, &value);
+ fraction = ScaleFraction(scalePtr, value);
+
+ if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) {
+ range = troughBox.width - sliderBox.width;
+ sliderBox.x += (int)(fraction * range);
+ } else {
+ range = troughBox.height - sliderBox.height;
+ sliderBox.y += (int)(fraction * range);
+ }
+ Ttk_PlaceElement(corePtr->layout, slider, sliderBox);
+ }
+}
+
+/*
+ * ScaleSize --
+ * Compute requested size of scale.
+ */
+static int ScaleSize(void *clientData, int *widthPtr, int *heightPtr)
+{
+ WidgetCore *corePtr = clientData;
+ Scale *scalePtr = clientData;
+ int length;
+
+ Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);
+
+ /* Assert the -length configuration option */
+ Tk_GetPixelsFromObj(NULL, corePtr->tkwin,
+ scalePtr->scale.lengthObj, &length);
+ if (scalePtr->scale.orient == TTK_ORIENT_VERTICAL) {
+ *heightPtr = MAX(*heightPtr, length);
+ } else {
+ *widthPtr = MAX(*widthPtr, length);
+ }
+
+ return 1;
+}
+
+static double
+PointToValue(Scale *scalePtr, int x, int y)
+{
+ Ttk_Box troughBox = TroughRange(scalePtr);
+ double from = 0, to = 1, fraction;
+
+ Tcl_GetDoubleFromObj(NULL, scalePtr->scale.fromObj, &from);
+ Tcl_GetDoubleFromObj(NULL, scalePtr->scale.toObj, &to);
+
+ if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) {
+ fraction = (double)(x - troughBox.x) / (double)troughBox.width;
+ } else {
+ fraction = (double)(y - troughBox.y) / (double)troughBox.height;
+ }
+
+ fraction = fraction < 0 ? 0 : fraction > 1 ? 1 : fraction;
+
+ return from + fraction * (to-from);
+}
+
+/*
+ * Return the center point in the widget corresponding to the given
+ * value. This point can be used to center the slider.
+ */
+
+static XPoint
+ValueToPoint(Scale *scalePtr, double value)
+{
+ Ttk_Box troughBox = TroughRange(scalePtr);
+ double fraction = ScaleFraction(scalePtr, value);
+ XPoint pt = {0, 0};
+
+ if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) {
+ pt.x = troughBox.x + (int)(fraction * troughBox.width);
+ pt.y = troughBox.y + troughBox.height / 2;
+ } else {
+ pt.x = troughBox.x + troughBox.width / 2;
+ pt.y = troughBox.y + (int)(fraction * troughBox.height);
+ }
+ return pt;
+}
+
+static const Ttk_Ensemble ScaleCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "set", ScaleSetCommand,0 },
+ { "get", ScaleGetCommand,0 },
+ { "coords", ScaleCoordsCommand,0 },
+ { 0,0,0 }
+};
+
+static WidgetSpec ScaleWidgetSpec =
+{
+ "TScale", /* Class name */
+ sizeof(Scale), /* record size */
+ ScaleOptionSpecs, /* option specs */
+ ScaleCommands, /* widget commands */
+ ScaleInitialize, /* initialization proc */
+ ScaleCleanup, /* cleanup proc */
+ ScaleConfigure, /* configure proc */
+ ScalePostConfigure, /* postConfigure */
+ ScaleGetLayout, /* getLayoutProc */
+ ScaleSize, /* sizeProc */
+ ScaleDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(VerticalScaleLayout)
+ TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH,
+ TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) )
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(HorizontalScaleLayout)
+ TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH,
+ TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) )
+TTK_END_LAYOUT
+
+/*
+ * Initialization.
+ */
+MODULE_SCOPE
+void TtkScale_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(theme, "Vertical.TScale", VerticalScaleLayout);
+ Ttk_RegisterLayout(theme, "Horizontal.TScale", HorizontalScaleLayout);
+
+ RegisterWidget(interp, "ttk::scale", &ScaleWidgetSpec);
+}
+
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
new file mode 100644
index 0000000..defe05a
--- /dev/null
+++ b/generic/ttk/ttkScroll.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2004, Joe English
+ *
+ * Support routines for scrollable widgets.
+ *
+ * (This is sort of half-baked; needs some work)
+ *
+ * Scrollable interface:
+ *
+ * + 'first' is controlled by [xy]view widget command
+ * and other scrolling commands like 'see';
+ * + 'total' depends on widget contents;
+ * + 'last' depends on first, total, and widget size.
+ *
+ * Choreography (typical usage):
+ *
+ * 1. User adjusts scrollbar, scrollbar widget calls its -command
+ * 2. Scrollbar -command invokes the scrollee [xy]view widget method
+ * 3. TtkScrollviewCommand calls TtkScrollTo(), which updates
+ * 'first' and schedules a redisplay.
+ * 4. Once the scrollee knows 'total' and 'last' (typically in
+ * the LayoutProc), call TtkScrolled(h,first,last,total) to
+ * synchronize the scrollbar.
+ * 5. The scrollee -[xy]scrollcommand is called (in an idle callback)
+ * 6. Which calls the scrollbar 'set' method and redisplays the scrollbar.
+ *
+ * If the scrollee has internal scrolling (e.g., a 'see' method),
+ * it should TtkScrollTo() directly (step 2).
+ *
+ * If the widget value changes, it should call TtkScrolled() (step 4).
+ * (This usually happens automatically when the widget is redisplayed).
+ *
+ * If the scrollee's -[xy]scrollcommand changes, it should call
+ * TtkScrollbarUpdateRequired, which will invoke step (5) (@@@ Fix this)
+ */
+
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/* Private data:
+ */
+#define SCROLL_UPDATE_PENDING (0x1)
+#define SCROLL_UPDATE_REQUIRED (0x2)
+
+struct ScrollHandleRec
+{
+ unsigned flags;
+ WidgetCore *corePtr;
+ Scrollable *scrollPtr;
+};
+
+/* TtkCreateScrollHandle --
+ * Initialize scroll handle.
+ */
+ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr)
+{
+ ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h));
+
+ h->flags = 0;
+ h->corePtr = corePtr;
+ h->scrollPtr = scrollPtr;
+
+ scrollPtr->first = 0;
+ scrollPtr->last = 1;
+ scrollPtr->total = 1;
+ return h;
+}
+
+/* UpdateScrollbar --
+ * Call the -scrollcommand callback to sync the scrollbar.
+ * Returns: Whatever the -scrollcommand does.
+ */
+static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h)
+{
+ Scrollable *s = h->scrollPtr;
+ WidgetCore *corePtr = h->corePtr;
+ char arg1[TCL_DOUBLE_SPACE + 2];
+ char arg2[TCL_DOUBLE_SPACE + 2];
+ int code;
+
+ h->flags &= ~SCROLL_UPDATE_REQUIRED;
+
+ if (s->scrollCmd == NULL) {
+ return TCL_OK;
+ }
+
+ arg1[0] = arg2[0] = ' ';
+ Tcl_PrintDouble(interp, (double)s->first / s->total, arg1+1);
+ Tcl_PrintDouble(interp, (double)s->last / s->total, arg2+1);
+
+ Tcl_Preserve(corePtr);
+ code = Tcl_VarEval(interp, s->scrollCmd, arg1, arg2, NULL);
+ if (WidgetDestroyed(corePtr)) {
+ Tcl_Release(corePtr);
+ return TCL_ERROR;
+ }
+ Tcl_Release(corePtr);
+
+ if (code != TCL_OK && !Tcl_InterpDeleted(interp)) {
+ /* Disable the -scrollcommand, add to stack trace:
+ */
+ ckfree(s->scrollCmd);
+ s->scrollCmd = 0;
+
+ Tcl_AddErrorInfo(interp, /* @@@ "horizontal" / "vertical" */
+ "\n (scrolling command executed by ");
+ Tcl_AddErrorInfo(interp, Tk_PathName(h->corePtr->tkwin));
+ Tcl_AddErrorInfo(interp, ")");
+ }
+ return code;
+}
+
+/* UpdateScrollbarBG --
+ * Idle handler to update the scrollbar.
+ */
+static void UpdateScrollbarBG(ClientData clientData)
+{
+ ScrollHandle h = (ScrollHandle)clientData;
+ Tcl_Interp *interp = h->corePtr->interp;
+ int code;
+
+ h->flags &= ~SCROLL_UPDATE_PENDING;
+ Tcl_Preserve((ClientData) interp);
+ code = UpdateScrollbar(interp, h);
+ if (code == TCL_ERROR && !Tcl_InterpDeleted(interp)) {
+ Tcl_BackgroundError(interp);
+ }
+ Tcl_Release((ClientData) interp);
+}
+
+/* TtkScrolled --
+ * Update scroll info, schedule scrollbar update.
+ */
+void TtkScrolled(ScrollHandle h, int first, int last, int total)
+{
+ Scrollable *s = h->scrollPtr;
+
+ /* Sanity-check inputs:
+ */
+ if (total <= 0) {
+ first = 0;
+ last = 1;
+ total = 1;
+ }
+
+ if (last > total) {
+ first -= (last - total);
+ if (first < 0) first = 0;
+ last = total;
+ }
+
+ if (s->first != first || s->last != last || s->total != total
+ || (h->flags & SCROLL_UPDATE_REQUIRED))
+ {
+ s->first = first;
+ s->last = last;
+ s->total = total;
+
+ if (!(h->flags & SCROLL_UPDATE_PENDING)) {
+ Tcl_DoWhenIdle(UpdateScrollbarBG, (ClientData)h);
+ h->flags |= SCROLL_UPDATE_PENDING;
+ }
+ }
+}
+
+/* TtkScrollbarUpdateRequired --
+ * Force a scrollbar update at the next call to TtkScrolled(),
+ * even if scroll parameters haven't changed (e.g., if
+ * -yscrollcommand has changed).
+ */
+
+void TtkScrollbarUpdateRequired(ScrollHandle h)
+{
+ h->flags |= SCROLL_UPDATE_REQUIRED;
+}
+
+/* TtkScrollviewCommand --
+ * Widget [xy]view command implementation.
+ *
+ * $w [xy]view -- return current view region
+ * $w [xy]view $index -- set topmost item
+ * $w [xy]view moveto $fraction
+ * $w [xy]view scroll $number $what -- scrollbar interface
+ */
+int TtkScrollviewCommand(
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle h)
+{
+ Scrollable *s = h->scrollPtr;
+ int newFirst = s->first;
+
+ if (objc == 2) {
+ Tcl_Obj *result[2];
+ result[0] = Tcl_NewDoubleObj((double)s->first / s->total);
+ result[1] = Tcl_NewDoubleObj((double)s->last / s->total);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, result));
+ return TCL_OK;
+ } else if (objc == 3) {
+ if (Tcl_GetIntFromObj(interp, objv[2], &newFirst) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ } else {
+ double fraction;
+ int count;
+
+ switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) {
+ case TK_SCROLL_ERROR:
+ return TCL_ERROR;
+ case TK_SCROLL_MOVETO:
+ newFirst = (int) ((fraction * s->total) + 0.5);
+ break;
+ case TK_SCROLL_UNITS:
+ newFirst = s->first + count;
+ break;
+ case TK_SCROLL_PAGES: {
+ int perPage = s->last - s->first; /* @@@ */
+ newFirst = s->first + count * perPage;
+ break;
+ }
+ }
+ }
+
+ TtkScrollTo(h, newFirst);
+
+ return TCL_OK;
+}
+
+void TtkScrollTo(ScrollHandle h, int newFirst)
+{
+ Scrollable *s = h->scrollPtr;
+
+ if (newFirst >= s->total)
+ newFirst = s->total - 1;
+ if (newFirst > s->first && s->last >= s->total) /* don't scroll past end */
+ newFirst = s->first;
+ if (newFirst < 0)
+ newFirst = 0;
+
+ if (newFirst != s->first) {
+ s->first = newFirst;
+ TtkRedisplayWidget(h->corePtr);
+ }
+}
+
+void TtkFreeScrollHandle(ScrollHandle h)
+{
+ if (h->flags & SCROLL_UPDATE_PENDING) {
+ Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h);
+ }
+ ckfree((ClientData)h);
+}
+
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
new file mode 100644
index 0000000..5b0c212
--- /dev/null
+++ b/generic/ttk/ttkScrollbar.c
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 2003, Joe English
+ *
+ * ttk::scrollbar widget.
+ */
+
+#include <tk.h>
+
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/*------------------------------------------------------------------------
+ * +++ Scrollbar widget record.
+ */
+typedef struct
+{
+ Tcl_Obj *commandObj;
+
+ int orient;
+ Tcl_Obj *orientObj;
+
+ double first; /* top fraction */
+ double last; /* bottom fraction */
+
+ Ttk_Box troughBox; /* trough parcel */
+ int minSize; /* minimum size of thumb */
+} ScrollbarPart;
+
+typedef struct
+{
+ WidgetCore core;
+ ScrollbarPart scrollbar;
+} Scrollbar;
+
+static Tk_OptionSpec ScrollbarOptionSpecs[] =
+{
+ {TK_OPTION_STRING, "-command", "command", "Command", "",
+ Tk_Offset(Scrollbar,scrollbar.commandObj), -1, 0,0,0},
+
+ {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
+ Tk_Offset(Scrollbar,scrollbar.orientObj),
+ Tk_Offset(Scrollbar,scrollbar.orient),
+ 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+
+ WIDGET_TAKEFOCUS_FALSE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget hooks.
+ */
+
+static void
+ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Scrollbar *sb = recordPtr;
+ sb->scrollbar.first = 0.0;
+ sb->scrollbar.last = 1.0;
+
+ TtkTrackElementState(&sb->core);
+}
+
+static Ttk_Layout ScrollbarGetLayout(
+ Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
+{
+ Scrollbar *sb = recordPtr;
+ return TtkWidgetGetOrientedLayout(
+ interp, theme, recordPtr, sb->scrollbar.orientObj);
+}
+
+/*
+ * ScrollbarDoLayout --
+ * Layout hook. Adjusts the position of the scrollbar thumb.
+ *
+ * Side effects:
+ * Sets sb->troughBox and sb->minSize.
+ */
+static void ScrollbarDoLayout(void *recordPtr)
+{
+ Scrollbar *sb = recordPtr;
+ WidgetCore *corePtr = &sb->core;
+ Ttk_Element thumb;
+ Ttk_Box thumbBox;
+ int thumbWidth, thumbHeight;
+ double first, last, size;
+ int minSize;
+
+ /*
+ * Use generic layout manager to compute initial layout:
+ */
+ Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
+
+ /*
+ * Locate thumb element, extract parcel and requested minimum size:
+ */
+ thumb = Ttk_FindElement(corePtr->layout, "thumb");
+ if (!thumb) /* Something has gone wrong -- bail */
+ return;
+
+ sb->scrollbar.troughBox = thumbBox = Ttk_ElementParcel(thumb);
+ Ttk_LayoutNodeReqSize(
+ corePtr->layout, thumb, &thumbWidth,&thumbHeight);
+
+ /*
+ * Adjust thumb element parcel:
+ */
+ first = sb->scrollbar.first;
+ last = sb->scrollbar.last;
+
+ if (sb->scrollbar.orient == TTK_ORIENT_VERTICAL) {
+ minSize = thumbHeight;
+ size = thumbBox.height - minSize;
+ thumbBox.y += (int)(size * first);
+ thumbBox.height = (int)(size * last) + minSize - (int)(size * first);
+ } else {
+ minSize = thumbWidth;
+ size = thumbBox.width - minSize;
+ thumbBox.x += (int)(size * first);
+ thumbBox.width = (int)(size * last) + minSize - (int)(size * first);
+ }
+ sb->scrollbar.minSize = minSize;
+ Ttk_PlaceElement(corePtr->layout, thumb, thumbBox);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands.
+ */
+
+/* $sb set $first $last --
+ * Set the position of the scrollbar.
+ */
+static int
+ScrollbarSetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Scrollbar *scrollbar = recordPtr;
+ Tcl_Obj *firstObj, *lastObj;
+ double first, last;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "first last");
+ return TCL_ERROR;
+ }
+
+ firstObj = objv[2];
+ lastObj = objv[3];
+ if (Tcl_GetDoubleFromObj(interp, firstObj, &first) != TCL_OK
+ || Tcl_GetDoubleFromObj(interp, lastObj, &last) != TCL_OK)
+ return TCL_ERROR;
+
+ /* Range-checks:
+ */
+ if (first < 0.0) {
+ first = 0.0;
+ } else if (first > 1.0) {
+ first = 1.0;
+ }
+
+ if (last < first) {
+ last = first;
+ } else if (last > 1.0) {
+ last = 1.0;
+ }
+
+ /* ASSERT: 0.0 <= first <= last <= 1.0 */
+
+ scrollbar->scrollbar.first = first;
+ scrollbar->scrollbar.last = last;
+ if (first <= 0.0 && last >= 1.0) {
+ scrollbar->core.state |= TTK_STATE_DISABLED;
+ } else {
+ scrollbar->core.state &= ~TTK_STATE_DISABLED;
+ }
+
+ TtkRedisplayWidget(&scrollbar->core);
+
+ return TCL_OK;
+}
+
+/* $sb get --
+ * Returns the last thing passed to 'set'.
+ */
+static int
+ScrollbarGetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Scrollbar *scrollbar = recordPtr;
+ Tcl_Obj *result[2];
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
+ return TCL_ERROR;
+ }
+
+ result[0] = Tcl_NewDoubleObj(scrollbar->scrollbar.first);
+ result[1] = Tcl_NewDoubleObj(scrollbar->scrollbar.last);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, result));
+
+ return TCL_OK;
+}
+
+/* $sb delta $dx $dy --
+ * Returns the percentage change corresponding to a mouse movement
+ * of $dx, $dy.
+ */
+static int
+ScrollbarDeltaCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Scrollbar *sb = recordPtr;
+ double dx, dy;
+ double delta = 0.0;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "dx dy");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetDoubleFromObj(interp, objv[2], &dx) != TCL_OK
+ || Tcl_GetDoubleFromObj(interp, objv[3], &dy) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ delta = 0.0;
+ if (sb->scrollbar.orient == TTK_ORIENT_VERTICAL) {
+ int size = sb->scrollbar.troughBox.height - sb->scrollbar.minSize;
+ if (size > 0) {
+ delta = (double)dy / (double)size;
+ }
+ } else {
+ int size = sb->scrollbar.troughBox.width - sb->scrollbar.minSize;
+ if (size > 0) {
+ delta = (double)dx / (double)size;
+ }
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewDoubleObj(delta));
+ return TCL_OK;
+}
+
+/* $sb fraction $x $y --
+ * Returns a real number between 0 and 1 indicating where the
+ * point given by x and y lies in the trough area of the scrollbar.
+ */
+static int
+ScrollbarFractionCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Scrollbar *sb = recordPtr;
+ Ttk_Box b = sb->scrollbar.troughBox;
+ int minSize = sb->scrollbar.minSize;
+ double x, y;
+ double fraction = 0.0;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "x y");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetDoubleFromObj(interp, objv[2], &x) != TCL_OK
+ || Tcl_GetDoubleFromObj(interp, objv[3], &y) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ fraction = 0.0;
+ if (sb->scrollbar.orient == TTK_ORIENT_VERTICAL) {
+ if (b.height > minSize) {
+ fraction = (double)(y - b.y) / (double)(b.height - minSize);
+ }
+ } else {
+ if (b.width > minSize) {
+ fraction = (double)(x - b.x) / (double)(b.width - minSize);
+ }
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewDoubleObj(fraction));
+ return TCL_OK;
+}
+
+static const Ttk_Ensemble ScrollbarCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "delta", ScrollbarDeltaCommand,0 },
+ { "fraction", ScrollbarFractionCommand,0 },
+ { "get", ScrollbarGetCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "set", ScrollbarSetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { 0,0,0 }
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget specification.
+ */
+static WidgetSpec ScrollbarWidgetSpec =
+{
+ "TScrollbar", /* className */
+ sizeof(Scrollbar), /* recordSize */
+ ScrollbarOptionSpecs, /* optionSpecs */
+ ScrollbarCommands, /* subcommands */
+ ScrollbarInitialize, /* initializeProc */
+ TtkNullCleanup, /* cleanupProc */
+ TtkCoreConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ ScrollbarGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ ScrollbarDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(VerticalScrollbarLayout)
+ TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y,
+ TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP)
+ TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM)
+ TTK_NODE(
+ "Vertical.Scrollbar.thumb", TTK_PACK_TOP|TTK_EXPAND|TTK_FILL_BOTH))
+TTK_END_LAYOUT
+
+TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout)
+ TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X,
+ TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT)
+ TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT)
+ TTK_NODE(
+ "Horizontal.Scrollbar.thumb", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkScrollbar_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(theme,"Vertical.TScrollbar",VerticalScrollbarLayout);
+ Ttk_RegisterLayout(theme,"Horizontal.TScrollbar",HorizontalScrollbarLayout);
+
+ RegisterWidget(interp, "ttk::scrollbar", &ScrollbarWidgetSpec);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
new file mode 100644
index 0000000..b52e6f4
--- /dev/null
+++ b/generic/ttk/ttkSeparator.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2004, Joe English
+ *
+ * ttk::separator and ttk::sizegrip widgets.
+ */
+
+#include <tk.h>
+
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/* +++ Separator widget record:
+ */
+typedef struct
+{
+ Tcl_Obj *orientObj;
+ int orient;
+} SeparatorPart;
+
+typedef struct
+{
+ WidgetCore core;
+ SeparatorPart separator;
+} Separator;
+
+static Tk_OptionSpec SeparatorOptionSpecs[] = {
+ {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
+ Tk_Offset(Separator,separator.orientObj),
+ Tk_Offset(Separator,separator.orient),
+ 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+
+ WIDGET_TAKEFOCUS_FALSE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*
+ * GetLayout hook --
+ * Choose layout based on -orient option.
+ */
+static Ttk_Layout SeparatorGetLayout(
+ Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
+{
+ Separator *sep = recordPtr;
+ return TtkWidgetGetOrientedLayout(
+ interp, theme, recordPtr, sep->separator.orientObj);
+}
+
+/*
+ * Widget commands:
+ */
+static const Ttk_Ensemble SeparatorCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { 0,0,0 }
+};
+
+/*
+ * Widget specification:
+ */
+static WidgetSpec SeparatorWidgetSpec =
+{
+ "TSeparator", /* className */
+ sizeof(Separator), /* recordSize */
+ SeparatorOptionSpecs, /* optionSpecs */
+ SeparatorCommands, /* subcommands */
+ TtkNullInitialize, /* initializeProc */
+ TtkNullCleanup, /* cleanupProc */
+ TtkCoreConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ SeparatorGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(SeparatorLayout)
+ TTK_NODE("Separator.separator", TTK_FILL_BOTH)
+TTK_END_LAYOUT
+
+/* +++ Sizegrip widget:
+ * Has no options or methods other than the standard ones.
+ */
+
+static Tk_OptionSpec SizegripOptionSpecs[] = {
+ WIDGET_TAKEFOCUS_FALSE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+static const Ttk_Ensemble SizegripCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { 0,0,0 }
+};
+
+static WidgetSpec SizegripWidgetSpec =
+{
+ "TSizegrip", /* className */
+ sizeof(WidgetCore), /* recordSize */
+ SizegripOptionSpecs, /* optionSpecs */
+ SizegripCommands, /* subcommands */
+ TtkNullInitialize, /* initializeProc */
+ TtkNullCleanup, /* cleanupProc */
+ TtkCoreConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ TtkWidgetDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+TTK_BEGIN_LAYOUT(SizegripLayout)
+ TTK_NODE("Sizegrip.sizegrip", TTK_PACK_BOTTOM|TTK_STICK_S|TTK_STICK_E)
+TTK_END_LAYOUT
+
+/* +++ Initialization:
+ */
+
+MODULE_SCOPE
+void TtkSeparator_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(theme, "TSeparator", SeparatorLayout);
+ Ttk_RegisterLayout(theme, "TSizegrip", SizegripLayout);
+
+ RegisterWidget(interp, "ttk::separator", &SeparatorWidgetSpec);
+ RegisterWidget(interp, "ttk::sizegrip", &SizegripWidgetSpec);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c
new file mode 100644
index 0000000..d002f2f
--- /dev/null
+++ b/generic/ttk/ttkSquare.c
@@ -0,0 +1,301 @@
+/* square.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+ *
+ * Minimal sample ttk widget.
+ */
+
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+#if defined(TTK_SQUARE_WIDGET) || 1
+
+#ifndef DEFAULT_BORDERWIDTH
+#define DEFAULT_BORDERWIDTH "2"
+#endif
+
+/*
+ * First, we setup the widget record. The Ttk package provides a structure
+ * that contains standard widget data so it is only necessary to define
+ * a structure that holds the data required for our widget. We do this by
+ * defining a widget part and then specifying the widget record as the
+ * concatenation of the two structures.
+ */
+
+typedef struct
+{
+ Tcl_Obj *widthObj;
+ Tcl_Obj *heightObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *paddingObj;
+ Tcl_Obj *anchorObj;
+} SquarePart;
+
+typedef struct
+{
+ WidgetCore core;
+ SquarePart square;
+} Square;
+
+/*
+ * Widget options.
+ *
+ * This structure is the same as the option specification structure used
+ * for Tk widgets. For each option we provide the type, name and options
+ * database name and class name and the position in the structure and
+ * default values. At the bottom we bring in the standard widget option
+ * defined for all widgets.
+ */
+
+static Tk_OptionSpec SquareOptionSpecs[] =
+{
+ {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
+ DEFAULT_BORDERWIDTH, Tk_Offset(Square,square.borderWidthObj), -1,
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
+ DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj),
+ -1, 0, 0, 0},
+
+ {TK_OPTION_PIXELS, "-width", "width", "Width",
+ "50", Tk_Offset(Square,square.widthObj), -1, 0, 0,
+ GEOMETRY_CHANGED},
+ {TK_OPTION_PIXELS, "-height", "height", "Height",
+ "50", Tk_Offset(Square,square.heightObj), -1, 0, 0,
+ GEOMETRY_CHANGED},
+
+ {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL,
+ Tk_Offset(Square,square.paddingObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+
+ {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
+ NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0},
+
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
+ NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*
+ * Almost all of the widget functionality is handled by the default Ttk
+ * widget code and the contained element. The one thing that we must handle
+ * is the -anchor option which positions the square element within the parcel
+ * of space available for the widget.
+ * To do this we must find out the layout preferences for the square
+ * element and adjust its position within our region.
+ *
+ * Note that if we do not have a "square" elememt then just the default
+ * layout will be done. So if someone places a label element into the
+ * widget layout it will still be handled but the -anchor option will be
+ * passed onto the label element instead of handled here.
+ */
+
+static void
+SquareDoLayout(void *clientData)
+{
+ WidgetCore *corePtr = (WidgetCore *)clientData;
+ Ttk_Box winBox;
+ Ttk_Element squareNode;
+
+ squareNode = Ttk_FindElement(corePtr->layout, "square");
+ winBox = Ttk_WinBox(corePtr->tkwin);
+ Ttk_PlaceLayout(corePtr->layout, corePtr->state, winBox);
+
+ /*
+ * Adjust the position of the square element within the widget according
+ * to the -anchor option.
+ */
+
+ if (squareNode) {
+ Square *squarePtr = clientData;
+ Tk_Anchor anchor = TK_ANCHOR_CENTER;
+ Ttk_Box b;
+
+ b = Ttk_ElementParcel(squareNode);
+ if (squarePtr->square.anchorObj != NULL)
+ Tk_GetAnchorFromObj(NULL, squarePtr->square.anchorObj, &anchor);
+ b = Ttk_AnchorBox(winBox, b.width, b.height, anchor);
+
+ Ttk_PlaceElement(corePtr->layout, squareNode, b);
+ }
+}
+
+/*
+ * Widget commands. A widget is impelemented as an ensemble and the
+ * subcommands are listed here. Ttk provides default implementations
+ * that are sufficient for our needs.
+ */
+
+static const Ttk_Ensemble SquareCommands[] = {
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { 0,0,0 }
+};
+
+/*
+ * The Widget specification structure holds all the implementation
+ * information about this widget and this is what must be registered
+ * with Tk in the package initialization code (see bottom).
+ */
+
+static WidgetSpec SquareWidgetSpec =
+{
+ "TSquare", /* className */
+ sizeof(Square), /* recordSize */
+ SquareOptionSpecs, /* optionSpecs */
+ SquareCommands, /* subcommands */
+ TtkNullInitialize, /* initializeProc */
+ TtkNullCleanup, /* cleanupProc */
+ TtkCoreConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetSize, /* sizeProc */
+ SquareDoLayout, /* layoutProc */
+ TtkWidgetDisplay /* displayProc */
+};
+
+/* ----------------------------------------------------------------------
+ * Square element
+ *
+ * In this section we demonstrate what is required to create a new themed
+ * element.
+ */
+
+typedef struct
+{
+ Tcl_Obj *borderObj;
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *widthObj;
+ Tcl_Obj *heightObj;
+} SquareElement;
+
+static Ttk_ElementOptionSpec SquareElementOptions[] =
+{
+ { "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj),
+ DEFAULT_BACKGROUND },
+ { "-foreground", TK_OPTION_BORDER, Tk_Offset(SquareElement,foregroundObj),
+ DEFAULT_BACKGROUND },
+ { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SquareElement,borderWidthObj),
+ DEFAULT_BORDERWIDTH },
+ { "-relief", TK_OPTION_RELIEF, Tk_Offset(SquareElement,reliefObj),
+ "raised" },
+ { "-width", TK_OPTION_PIXELS, Tk_Offset(SquareElement,widthObj), "20"},
+ { "-height", TK_OPTION_PIXELS, Tk_Offset(SquareElement,heightObj), "20"},
+ { NULL, 0, 0, NULL }
+};
+
+/*
+ * The element geometry function is called when the layout code wishes to
+ * find out how big this element wants to be. We must return our preferred
+ * size and padding information
+ */
+
+static void SquareElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SquareElement *square = elementRecord;
+ int borderWidth = 0;
+
+ Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
+ *paddingPtr = Ttk_UniformPadding((short)borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, square->widthObj, widthPtr);
+ Tk_GetPixelsFromObj(NULL, tkwin, square->heightObj, heightPtr);
+}
+
+/*
+ * Draw the element in the box provided.
+ */
+
+static void SquareElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ SquareElement *square = elementRecord;
+ Tk_3DBorder foreground = NULL;
+ int borderWidth = 1, relief = TK_RELIEF_FLAT;
+
+ foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
+ Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
+ Tk_GetReliefFromObj(NULL, square->reliefObj, &relief);
+
+ Tk_Fill3DRectangle(tkwin, d, foreground,
+ b.x, b.y, b.width, b.height, borderWidth, relief);
+}
+
+static Ttk_ElementSpec SquareElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(SquareElement),
+ SquareElementOptions,
+ SquareElementSize,
+ SquareElementDraw
+};
+
+/* ----------------------------------------------------------------------
+ *
+ * Layout section.
+ *
+ * Every widget class needs a layout style that specifies which elements
+ * are part of the widget and how they should be placed. The element layout
+ * engine is similar to the Tk pack geometry manager. Read the documentation
+ * for the details. In this example we just need to have the square element
+ * that has been defined for this widget placed on a background. We will
+ * also need some padding to keep it away from the edges.
+ */
+
+TTK_BEGIN_LAYOUT(SquareLayout)
+ TTK_NODE("Square.background", TTK_FILL_BOTH)
+ TTK_GROUP("Square.padding", TTK_FILL_BOTH,
+ TTK_NODE("Square.square", 0))
+TTK_END_LAYOUT
+
+/* ----------------------------------------------------------------------
+ *
+ * Widget initialization.
+ *
+ * This file defines a new element and a new widget. We need to register
+ * the element with the themes that will need it. In this case we will
+ * register with the default theme that is the root of the theme inheritance
+ * tree. This means all themes will find this element.
+ * We then need to register the widget class style. This is the layout
+ * specification. If a different theme requires an alternative layout, we
+ * could register that here. For instance, in some themes the scrollbars have
+ * one uparrow, in other themes there are two uparrow elements.
+ * Finally we register the widget itself. This step creates a tcl command so
+ * that we can actually create an instance of this class. The widget is
+ * linked to a particular style by the widget class name. This is important
+ * to realise as the programmer may change the classname when creating a
+ * new instance. If this is done, a new layout will need to be created (which
+ * can be done at script level). Some widgets may require particular elements
+ * to be present but we try to avoid this where possible. In this widget's C
+ * code, no reference is made to any particular elements. The programmer is
+ * free to specify a new style using completely different elements.
+ */
+
+/* public */ MODULE_SCOPE int
+TtkSquareWidget_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ /* register the new elements for this theme engine */
+ Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL);
+
+ /* register the layout for this theme */
+ Ttk_RegisterLayout(theme, "TSquare", SquareLayout);
+
+ /* register the widget */
+ RegisterWidget(interp, "ttk::square", &SquareWidgetSpec);
+
+ return TCL_OK;
+}
+
+#endif /* TTK_SQUARE_WIDGET */
+
diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c
new file mode 100644
index 0000000..a71ae21
--- /dev/null
+++ b/generic/ttk/ttkState.c
@@ -0,0 +1,273 @@
+/*
+ * Tk widget state utilities.
+ *
+ * Copyright (c) 2003 Joe English. Freely redistributable.
+ *
+ */
+
+#include <string.h>
+
+#include <tk.h>
+#include "ttkTheme.h"
+
+/*
+ * Table of state names. Must be kept in sync with TTK_STATE_*
+ * #defines in ttkTheme.h.
+ */
+static const char *const stateNames[] =
+{
+ "active", /* Mouse cursor is over widget or element */
+ "disabled", /* Widget is disabled */
+ "focus", /* Widget has keyboard focus */
+ "pressed", /* Pressed or "armed" */
+ "selected", /* "on", "true", "current", etc. */
+ "background", /* Top-level window lost focus (Mac,Win "inactive") */
+ "alternate", /* Widget-specific alternate display style */
+ "invalid", /* Bad value */
+ "readonly", /* Editing/modification disabled */
+ "hover", /* Mouse cursor is over widget */
+ "reserved1", /* Reserved for future extension */
+ "reserved2", /* Reserved for future extension */
+ "reserved3", /* Reserved for future extension */
+ "user3", /* User-definable state */
+ "user2", /* User-definable state */
+ "user1", /* User-definable state */
+ NULL
+};
+
+/*------------------------------------------------------------------------
+ * +++ StateSpec object type:
+ *
+ * The string representation consists of a list of state names,
+ * each optionally prefixed by an exclamation point (!).
+ *
+ * The internal representation uses the upper half of the longValue
+ * to store the on bits and the lower half to store the off bits.
+ * If we ever get more than 16 states, this will need to be reconsidered...
+ */
+
+static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *obj);
+/* static void StateSpecFreeIntRep(Tcl_Obj *); */
+#define StateSpecFreeIntRep 0 /* not needed */
+static void StateSpecDupIntRep(Tcl_Obj *, Tcl_Obj *);
+static void StateSpecUpdateString(Tcl_Obj *);
+
+static
+struct Tcl_ObjType StateSpecObjType =
+{
+ "StateSpec",
+ StateSpecFreeIntRep,
+ StateSpecDupIntRep,
+ StateSpecUpdateString,
+ StateSpecSetFromAny
+};
+
+static void StateSpecDupIntRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr)
+{
+ copyPtr->internalRep.longValue = srcPtr->internalRep.longValue;
+ copyPtr->typePtr = &StateSpecObjType;
+}
+
+static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr)
+{
+ int status;
+ int objc;
+ Tcl_Obj **objv;
+ int i;
+ unsigned int onbits = 0, offbits = 0;
+
+ status = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv);
+ if (status != TCL_OK)
+ return status;
+
+ for (i = 0; i < objc; ++i) {
+ const char *stateName = Tcl_GetString(objv[i]);
+ int on, j;
+
+ if (*stateName == '!') {
+ ++stateName;
+ on = 0;
+ } else {
+ on = 1;
+ }
+
+ for (j = 0; stateNames[j] != 0; ++j) {
+ if (strcmp(stateName, stateNames[j]) == 0)
+ break;
+ }
+
+ if (stateNames[j] == 0) {
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Invalid state name ", stateName,NULL);
+ }
+ return TCL_ERROR;
+ }
+
+ if (on) {
+ onbits |= (1<<j);
+ } else {
+ offbits |= (1<<j);
+ }
+ }
+
+ /* Invalidate old intrep:
+ */
+ if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) {
+ objPtr->typePtr->freeIntRepProc(objPtr);
+ }
+
+ objPtr->typePtr = &StateSpecObjType;
+ objPtr->internalRep.longValue = (onbits << 16) | offbits;
+
+ return TCL_OK;
+}
+
+static void StateSpecUpdateString(Tcl_Obj *objPtr)
+{
+ unsigned int onbits = (objPtr->internalRep.longValue & 0xFFFF0000) >> 16;
+ unsigned int offbits = objPtr->internalRep.longValue & 0x0000FFFF;
+ unsigned int mask = onbits | offbits;
+ Tcl_DString result;
+ int i, len;
+
+ Tcl_DStringInit(&result);
+
+ for (i=0; stateNames[i] != NULL; ++i) {
+ if (mask & (1<<i)) {
+ if (offbits & (1<<i))
+ Tcl_DStringAppend(&result, "!", 1);
+ Tcl_DStringAppend(&result, stateNames[i], -1);
+ Tcl_DStringAppend(&result, " ", 1);
+ }
+ }
+
+ len = Tcl_DStringLength(&result);
+ if (len) {
+ /* 'len' includes extra trailing ' ' */
+ objPtr->bytes = Tcl_Alloc((unsigned)len);
+ objPtr->length = len-1;
+ strncpy(objPtr->bytes, Tcl_DStringValue(&result), (size_t)len-1);
+ objPtr->bytes[len-1] = '\0';
+ } else {
+ /* empty string */
+ objPtr->length = 0;
+ objPtr->bytes = Tcl_Alloc(1);
+ *objPtr->bytes = '\0';
+ }
+
+ Tcl_DStringFree(&result);
+}
+
+Tcl_Obj *Ttk_NewStateSpecObj(unsigned int onbits, unsigned int offbits)
+{
+ Tcl_Obj *objPtr = Tcl_NewObj();
+
+ Tcl_InvalidateStringRep(objPtr);
+ objPtr->typePtr = &StateSpecObjType;
+ objPtr->internalRep.longValue = (onbits << 16) | offbits;
+
+ return objPtr;
+}
+
+int Ttk_GetStateSpecFromObj(
+ Tcl_Interp *interp,
+ Tcl_Obj *objPtr,
+ Ttk_StateSpec *spec)
+{
+ if (objPtr->typePtr != &StateSpecObjType) {
+ int status = StateSpecSetFromAny(interp, objPtr);
+ if (status != TCL_OK)
+ return status;
+ }
+
+ spec->onbits = (objPtr->internalRep.longValue & 0xFFFF0000) >> 16;
+ spec->offbits = objPtr->internalRep.longValue & 0x0000FFFF;
+ return TCL_OK;
+}
+
+
+/*
+ * Tk_StateMapLookup --
+ *
+ * A state map is a paired list of StateSpec / value pairs.
+ * Returns the value corresponding to the first matching state
+ * specification, or NULL if not found or an error occurs.
+ */
+Tcl_Obj *Ttk_StateMapLookup(
+ Tcl_Interp *interp, /* Where to leave error messages; may be NULL */
+ Ttk_StateMap map, /* State map */
+ Ttk_State state) /* State to look up */
+{
+ Tcl_Obj **specs;
+ int nSpecs;
+ int j, status;
+
+ status = Tcl_ListObjGetElements(interp, map, &nSpecs, &specs);
+ if (status != TCL_OK)
+ return NULL;
+
+ for (j = 0; j < nSpecs; j += 2) {
+ Ttk_StateSpec spec;
+ status = Ttk_GetStateSpecFromObj(interp, specs[j], &spec);
+ if (status != TCL_OK)
+ return NULL;
+ if (Ttk_StateMatches(state, &spec))
+ return specs[j+1];
+ }
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "No match in state map", NULL);
+ }
+ return NULL;
+}
+
+/* Ttk_GetStateMapFromObj --
+ * Returns a Ttk_StateMap from a Tcl_Obj*.
+ * Since a Ttk_StateMap is just a specially-formatted Tcl_Obj,
+ * this basically just checks for errors.
+ */
+Ttk_StateMap Ttk_GetStateMapFromObj(
+ Tcl_Interp *interp, /* Where to leave error messages; may be NULL */
+ Tcl_Obj *mapObj) /* State map */
+{
+ Tcl_Obj **specs;
+ int nSpecs;
+ int j, status;
+
+ status = Tcl_ListObjGetElements(interp, mapObj, &nSpecs, &specs);
+ if (status != TCL_OK)
+ return NULL;
+
+ if (nSpecs % 2 != 0) {
+ if (interp)
+ Tcl_SetResult(interp,
+ "State map must have an even number of elements",
+ TCL_STATIC);
+ return 0;
+ }
+
+ for (j = 0; j < nSpecs; j += 2) {
+ Ttk_StateSpec spec;
+ if (Ttk_GetStateSpecFromObj(interp, specs[j], &spec) != TCL_OK)
+ return NULL;
+ }
+
+ return mapObj;
+}
+
+/*
+ * Ttk_StateTableLooup --
+ * Look up an index from a statically allocated state table.
+ */
+int Ttk_StateTableLookup(Ttk_StateTable *map, unsigned int state)
+{
+ while ((state & map->onBits) != map->onBits
+ || (~state & map->offBits) != map->offBits)
+ {
+ ++map;
+ }
+ return map->index;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c
new file mode 100644
index 0000000..87b33dc
--- /dev/null
+++ b/generic/ttk/ttkStubInit.c
@@ -0,0 +1,61 @@
+/*
+ * This file is (mostly) automatically generated from ttk.decls.
+ * It is compiled and linked in with the ttk package proper.
+ */
+
+#include "tk.h"
+#include "ttkTheme.h"
+
+MODULE_SCOPE const TtkStubs ttkStubs;
+
+/* !BEGIN!: Do not edit below this line. */
+
+const TtkStubs ttkStubs = {
+ TCL_STUB_MAGIC,
+ TTK_STUBS_EPOCH,
+ TTK_STUBS_REVISION,
+ 0,
+ Ttk_GetTheme, /* 0 */
+ Ttk_GetDefaultTheme, /* 1 */
+ Ttk_GetCurrentTheme, /* 2 */
+ Ttk_CreateTheme, /* 3 */
+ Ttk_RegisterCleanup, /* 4 */
+ Ttk_RegisterElementSpec, /* 5 */
+ Ttk_RegisterElement, /* 6 */
+ Ttk_RegisterElementFactory, /* 7 */
+ Ttk_RegisterLayout, /* 8 */
+ 0, /* 9 */
+ Ttk_GetStateSpecFromObj, /* 10 */
+ Ttk_NewStateSpecObj, /* 11 */
+ Ttk_GetStateMapFromObj, /* 12 */
+ Ttk_StateMapLookup, /* 13 */
+ Ttk_StateTableLookup, /* 14 */
+ 0, /* 15 */
+ 0, /* 16 */
+ 0, /* 17 */
+ 0, /* 18 */
+ 0, /* 19 */
+ Ttk_GetPaddingFromObj, /* 20 */
+ Ttk_GetBorderFromObj, /* 21 */
+ Ttk_GetStickyFromObj, /* 22 */
+ Ttk_MakePadding, /* 23 */
+ Ttk_UniformPadding, /* 24 */
+ Ttk_AddPadding, /* 25 */
+ Ttk_RelievePadding, /* 26 */
+ Ttk_MakeBox, /* 27 */
+ Ttk_BoxContains, /* 28 */
+ Ttk_PackBox, /* 29 */
+ Ttk_StickBox, /* 30 */
+ Ttk_AnchorBox, /* 31 */
+ Ttk_PadBox, /* 32 */
+ Ttk_ExpandBox, /* 33 */
+ Ttk_PlaceBox, /* 34 */
+ Ttk_NewBoxObj, /* 35 */
+ 0, /* 36 */
+ 0, /* 37 */
+ 0, /* 38 */
+ 0, /* 39 */
+ Ttk_GetOrientFromObj, /* 40 */
+};
+
+/* !END!: Do not edit above this line. */
diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c
new file mode 100644
index 0000000..2c07b9d
--- /dev/null
+++ b/generic/ttk/ttkStubLib.c
@@ -0,0 +1,74 @@
+/*
+ * We need to ensure that we use the tcl stub macros so that this file
+ * contains no references to any of the tcl stub functions.
+ */
+
+#undef USE_TCL_STUBS
+#define USE_TCL_STUBS
+
+#include "tk.h"
+
+#define USE_TTK_STUBS 1
+#include "ttkTheme.h"
+
+MODULE_SCOPE const TtkStubs *ttkStubsPtr;
+const TtkStubs *ttkStubsPtr = NULL;
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TtkInitializeStubs --
+ * Load the Ttk package, initialize stub table pointer.
+ * Do not call this function directly, use Ttk_InitStubs() macro instead.
+ *
+ * Results:
+ * The actual version of the package that satisfies the request, or
+ * NULL to indicate that an error occurred.
+ *
+ * Side effects:
+ * Sets the stub table pointer.
+ *
+ */
+MODULE_SCOPE const char *
+TtkInitializeStubs(
+ Tcl_Interp *interp, const char *version, int epoch, int revision)
+{
+ int exact = 0;
+ const char *packageName = "Ttk";
+ const char *errMsg = NULL;
+ ClientData pkgClientData = NULL;
+ const char *actualVersion = Tcl_PkgRequireEx(
+ interp, packageName, version, exact, &pkgClientData);
+ const TtkStubs *stubsPtr = pkgClientData;
+
+ if (!actualVersion) {
+ return NULL;
+ }
+
+ if (!stubsPtr) {
+ errMsg = "missing stub table pointer";
+ goto error;
+ }
+ if (stubsPtr->epoch != epoch) {
+ errMsg = "epoch number mismatch";
+ goto error;
+ }
+ if (stubsPtr->revision < revision) {
+ errMsg = "require later revision";
+ goto error;
+ }
+
+ ttkStubsPtr = stubsPtr;
+ return actualVersion;
+
+error:
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Error loading ", packageName, " package",
+ " (requested version '", version,
+ "', loaded version '", actualVersion, "'): ",
+ errMsg,
+ NULL);
+ return NULL;
+}
+
diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c
new file mode 100644
index 0000000..9f2a87b
--- /dev/null
+++ b/generic/ttk/ttkTagSet.c
@@ -0,0 +1,306 @@
+/*
+ * Tag tables. 3/4-baked, work in progress.
+ *
+ * Copyright (C) 2005, Joe English. Freely redistributable.
+ */
+
+#include <string.h> /* for memset() */
+#include <tcl.h>
+#include <tk.h>
+
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+/*------------------------------------------------------------------------
+ * +++ Internal data structures.
+ */
+struct TtkTag {
+ int priority; /* 1=>highest */
+ const char *tagName; /* Back-pointer to hash table entry */
+ void *tagRecord; /* User data */
+};
+
+struct TtkTagTable {
+ Tk_Window tkwin; /* owner window */
+ Tk_OptionSpec *optionSpecs; /* ... */
+ Tk_OptionTable optionTable; /* ... */
+ int recordSize; /* size of tag record */
+ int nTags; /* #tags defined so far */
+ Tcl_HashTable tags; /* defined tags */
+};
+
+/*------------------------------------------------------------------------
+ * +++ Tags.
+ */
+static Ttk_Tag NewTag(Ttk_TagTable tagTable, const char *tagName)
+{
+ Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag));
+ tag->tagRecord = ckalloc(tagTable->recordSize);
+ memset(tag->tagRecord, 0, tagTable->recordSize);
+ /* Don't need Tk_InitOptions() here, all defaults should be NULL. */
+ tag->priority = ++tagTable->nTags;
+ tag->tagName = tagName;
+ return tag;
+}
+
+static void DeleteTag(Ttk_TagTable tagTable, Ttk_Tag tag)
+{
+ Tk_FreeConfigOptions(tag->tagRecord,tagTable->optionTable,tagTable->tkwin);
+ ckfree(tag->tagRecord);
+ ckfree((void*)tag);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Tag tables.
+ */
+
+Ttk_TagTable Ttk_CreateTagTable(
+ Tcl_Interp *interp, Tk_Window tkwin,
+ Tk_OptionSpec optionSpecs[], int recordSize)
+{
+ Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable));
+ tagTable->tkwin = tkwin;
+ tagTable->optionSpecs = optionSpecs;
+ tagTable->optionTable = Tk_CreateOptionTable(interp, optionSpecs);
+ tagTable->recordSize = recordSize;
+ tagTable->nTags = 0;
+ Tcl_InitHashTable(&tagTable->tags, TCL_STRING_KEYS);
+ return tagTable;
+}
+
+void Ttk_DeleteTagTable(Ttk_TagTable tagTable)
+{
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr;
+
+ entryPtr = Tcl_FirstHashEntry(&tagTable->tags, &search);
+ while (entryPtr != NULL) {
+ DeleteTag(tagTable, Tcl_GetHashValue(entryPtr));
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+
+ Tcl_DeleteHashTable(&tagTable->tags);
+ ckfree((void*)tagTable);
+}
+
+Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName)
+{
+ int isNew = 0;
+ Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(
+ &tagTable->tags, tagName, &isNew);
+
+ if (isNew) {
+ tagName = Tcl_GetHashKey(&tagTable->tags, entryPtr);
+ Tcl_SetHashValue(entryPtr, NewTag(tagTable,tagName));
+ }
+ return Tcl_GetHashValue(entryPtr);
+}
+
+Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr)
+{
+ return Ttk_GetTag(tagTable, Tcl_GetString(objPtr));
+}
+
+/*------------------------------------------------------------------------
+ * +++ Tag sets.
+ */
+
+/* Ttk_GetTagSetFromObj --
+ * Extract an array of pointers to Ttk_Tags from a Tcl_Obj.
+ * objPtr may be NULL, in which case a new empty tag set is returned.
+ *
+ * Returns NULL and leaves an error message in interp->result on error.
+ *
+ * Non-NULL results must be passed to Ttk_FreeTagSet().
+ */
+Ttk_TagSet Ttk_GetTagSetFromObj(
+ Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr)
+{
+ Ttk_TagSet tagset = (Ttk_TagSet)(ckalloc(sizeof *tagset));
+ Tcl_Obj **objv;
+ int i, objc;
+
+ if (objPtr == NULL) {
+ tagset->tags = NULL;
+ tagset->nTags = 0;
+ return tagset;
+ }
+
+ if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
+ ckfree((ClientData)tagset);
+ return NULL;
+ }
+
+ tagset->tags = (Ttk_Tag*)ckalloc((objc+1) * sizeof(Ttk_Tag));
+ for (i=0; i<objc; ++i) {
+ tagset->tags[i] = Ttk_GetTagFromObj(tagTable, objv[i]);
+ }
+ tagset->tags[i] = NULL;
+ tagset->nTags = objc;
+
+ return tagset;
+}
+
+/* Ttk_NewTagSetObj --
+ * Construct a fresh Tcl_Obj * from a tag set.
+ */
+Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet tagset)
+{
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+ int i;
+
+ for (i = 0; i < tagset->nTags; ++i) {
+ Tcl_ListObjAppendElement(
+ NULL, result, Tcl_NewStringObj(tagset->tags[i]->tagName, -1));
+ }
+ return result;
+}
+
+void Ttk_FreeTagSet(Ttk_TagSet tagset)
+{
+ ckfree((ClientData)tagset->tags);
+ ckfree((ClientData)tagset);
+}
+
+/* Ttk_TagSetContains -- test if tag set contains a tag.
+ */
+int Ttk_TagSetContains(Ttk_TagSet tagset, Ttk_Tag tag)
+{
+ int i;
+ for (i = 0; i < tagset->nTags; ++i) {
+ if (tagset->tags[i] == tag) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* Ttk_TagSetAdd -- add a tag to a tag set.
+ *
+ * Returns: 0 if tagset already contained tag,
+ * 1 if tagset was modified.
+ */
+int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag)
+{
+ int i;
+ for (i = 0; i < tagset->nTags; ++i) {
+ if (tagset->tags[i] == tag) {
+ return 0;
+ }
+ }
+ tagset->tags = (void*)ckrealloc((void*)tagset->tags,
+ (tagset->nTags+1)*sizeof(tagset->tags[0]));
+ tagset->tags[tagset->nTags++] = tag;
+ return 1;
+}
+
+/* Ttk_TagSetRemove -- remove a tag from a tag set.
+ *
+ * Returns: 0 if tagset did not contain tag,
+ * 1 if tagset was modified.
+ */
+int Ttk_TagSetRemove(Ttk_TagSet tagset, Ttk_Tag tag)
+{
+ int i = 0, j = 0;
+ while (i < tagset->nTags) {
+ if ((tagset->tags[j] = tagset->tags[i]) != tag) {
+ ++j;
+ }
+ ++i;
+ }
+ tagset->nTags = j;
+ return j != i;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Utilities for widget commands.
+ */
+
+/* Ttk_EnumerateTags -- implements [$w tag names]
+ */
+int Ttk_EnumerateTags(
+ Tcl_Interp *interp, Ttk_TagTable tagTable)
+{
+ return TtkEnumerateHashTable(interp, &tagTable->tags);
+}
+
+/* Ttk_EnumerateTagOptions -- implements [$w tag configure $tag]
+ */
+int Ttk_EnumerateTagOptions(
+ Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag)
+{
+ return TtkEnumerateOptions(interp, tag->tagRecord,
+ tagTable->optionSpecs, tagTable->optionTable, tagTable->tkwin);
+}
+
+/* Ttk_TagOptionValue -- implements [$w tag configure $tag -option]
+ */
+Tcl_Obj *Ttk_TagOptionValue(
+ Tcl_Interp *interp,
+ Ttk_TagTable tagTable,
+ Ttk_Tag tag,
+ Tcl_Obj *optionName)
+{
+ return Tk_GetOptionValue(interp,
+ tag->tagRecord, tagTable->optionTable, optionName, tagTable->tkwin);
+}
+
+/* Ttk_ConfigureTag -- implements [$w tag configure $tag -option value...]
+ */
+int Ttk_ConfigureTag(
+ Tcl_Interp *interp,
+ Ttk_TagTable tagTable,
+ Ttk_Tag tag,
+ int objc, Tcl_Obj *const objv[])
+{
+ return Tk_SetOptions(
+ interp, tag->tagRecord, tagTable->optionTable,
+ objc, objv, tagTable->tkwin, NULL/*savedOptions*/, NULL/*mask*/);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Tag values.
+ */
+
+#define OBJ_AT(record, offset) (*(Tcl_Obj**)(((char*)record)+offset))
+
+void Ttk_TagSetValues(Ttk_TagTable tagTable, Ttk_TagSet tagSet, void *record)
+{
+ const int LOWEST_PRIORITY = 0x7FFFFFFF;
+ int i, j;
+
+ memset(record, 0, tagTable->recordSize);
+
+ for (i = 0; tagTable->optionSpecs[i].type != TK_OPTION_END; ++i) {
+ Tk_OptionSpec *optionSpec = tagTable->optionSpecs + i;
+ int offset = optionSpec->objOffset;
+ int prio = LOWEST_PRIORITY;
+
+ for (j = 0; j < tagSet->nTags; ++j) {
+ Ttk_Tag tag = tagSet->tags[j];
+ if (OBJ_AT(tag->tagRecord, offset) != 0 && tag->priority < prio) {
+ OBJ_AT(record, offset) = OBJ_AT(tag->tagRecord, offset);
+ prio = tag->priority;
+ }
+ }
+ }
+}
+
+void Ttk_TagSetApplyStyle(
+ Ttk_TagTable tagTable, Ttk_Style style, Ttk_State state, void *record)
+{
+ Tk_OptionSpec *optionSpec = tagTable->optionSpecs;
+
+ while (optionSpec->type != TK_OPTION_END) {
+ int offset = optionSpec->objOffset;
+ const char *optionName = optionSpec->optionName;
+ Tcl_Obj *val = Ttk_StyleMap(style, optionName, state);
+ if (val) {
+ OBJ_AT(record, offset) = val;
+ } else if (OBJ_AT(record, offset) == 0) {
+ OBJ_AT(record, offset) = Ttk_StyleDefault(style, optionName);
+ }
+ ++optionSpec;
+ }
+}
+
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
new file mode 100644
index 0000000..5095487
--- /dev/null
+++ b/generic/ttk/ttkTheme.c
@@ -0,0 +1,1737 @@
+/*
+ * ttkTheme.c --
+ *
+ * This file implements the widget styles and themes support.
+ *
+ * Copyright (c) 2002 Frederic Bonnet
+ * Copyright (c) 2003 Joe English
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <tk.h>
+#include <tkInt.h>
+#include "ttkThemeInt.h"
+
+#define PKG_ASSOC_KEY "Ttk"
+
+/*------------------------------------------------------------------------
+ * +++ Styles.
+ *
+ * Invariants:
+ * If styleName contains a dot, parentStyle->styleName is everything
+ * after the first dot; otherwise, parentStyle is the theme's root
+ * style ".". The root style's parentStyle is NULL.
+ *
+ */
+
+typedef struct Ttk_Style_
+{
+ const char *styleName; /* points to hash table key */
+ Tcl_HashTable settingsTable; /* KEY: string; VALUE: StateMap */
+ Tcl_HashTable defaultsTable; /* KEY: string; VALUE: resource */
+ Ttk_LayoutTemplate layoutTemplate; /* Layout template for style, or NULL */
+ Ttk_Style parentStyle; /* Previous style in chain */
+ Ttk_ResourceCache cache; /* Back-pointer to resource cache */
+} Style;
+
+static Style *NewStyle()
+{
+ Style *stylePtr = (Style*)ckalloc(sizeof(Style));
+
+ stylePtr->styleName = NULL;
+ stylePtr->parentStyle = NULL;
+ stylePtr->layoutTemplate = NULL;
+ stylePtr->cache = NULL;
+ Tcl_InitHashTable(&stylePtr->settingsTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&stylePtr->defaultsTable, TCL_STRING_KEYS);
+
+ return stylePtr;
+}
+
+static void FreeStyle(Style *stylePtr)
+{
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr;
+
+ entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search);
+ while (entryPtr != NULL) {
+ Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr);
+ Tcl_DecrRefCount(stateMap);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&stylePtr->settingsTable);
+
+ entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search);
+ while (entryPtr != NULL) {
+ Tcl_Obj *defaultValue = Tcl_GetHashValue(entryPtr);
+ Tcl_DecrRefCount(defaultValue);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&stylePtr->defaultsTable);
+
+ Ttk_FreeLayoutTemplate(stylePtr->layoutTemplate);
+
+ ckfree((ClientData)stylePtr);
+}
+
+/*
+ * Ttk_StyleMap --
+ * Look up state-specific option value from specified style.
+ */
+Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state)
+{
+ while (style) {
+ Tcl_HashEntry *entryPtr =
+ Tcl_FindHashEntry(&style->settingsTable, optionName);
+ if (entryPtr) {
+ Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr);
+ return Ttk_StateMapLookup(NULL, stateMap, state);
+ }
+ style = style->parentStyle;
+ }
+ return 0;
+}
+
+/*
+ * Ttk_StyleDefault --
+ * Look up default resource setting the in the specified style.
+ */
+Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName)
+{
+ while (style) {
+ Tcl_HashEntry *entryPtr =
+ Tcl_FindHashEntry(&style->defaultsTable, optionName);
+ if (entryPtr)
+ return Tcl_GetHashValue(entryPtr);
+ style= style->parentStyle;
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Elements.
+ */
+typedef const Tk_OptionSpec **OptionMap;
+ /* array of Tk_OptionSpecs mapping widget options to element options */
+
+struct Ttk_ElementClass_ {
+ const char *name; /* Points to hash table key */
+ Ttk_ElementSpec *specPtr; /* Template provided during registration. */
+ void *clientData; /* Client data passed in at registration time */
+ void *elementRecord; /* Scratch buffer for element record storage */
+ int nResources; /* #Element options */
+ Tcl_Obj **defaultValues; /* Array of option default values */
+ Tcl_HashTable optMapCache; /* Map: Tk_OptionTable * -> OptionMap */
+};
+
+/* TTKGetOptionSpec --
+ * Look up a Tk_OptionSpec by name from a Tk_OptionTable,
+ * and verify that it's compatible with the specified Tk_OptionType,
+ * along with other constraints (see below).
+ */
+static const Tk_OptionSpec *TTKGetOptionSpec(
+ const char *optionName,
+ Tk_OptionTable optionTable,
+ Tk_OptionType optionType)
+{
+ const Tk_OptionSpec *optionSpec = TkGetOptionSpec(optionName, optionTable);
+
+ if (!optionSpec)
+ return 0;
+
+ /* Make sure widget option has a Tcl_Obj* entry:
+ */
+ if (optionSpec->objOffset < 0) {
+ return 0;
+ }
+
+ /* Grrr. Ignore accidental mismatches caused by prefix-matching:
+ */
+ if (strcmp(optionSpec->optionName, optionName)) {
+ return 0;
+ }
+
+ /* Ensure that the widget option type is compatible with
+ * the element option type.
+ *
+ * TK_OPTION_STRING element options are compatible with anything.
+ * As a workaround for the workaround for Bug #967209,
+ * TK_OPTION_STRING widget options are also compatible with anything
+ * (see <<NOTE-NULLOPTIONS>>).
+ */
+ if ( optionType != TK_OPTION_STRING
+ && optionSpec->type != TK_OPTION_STRING
+ && optionType != optionSpec->type)
+ {
+ return 0;
+ }
+
+ return optionSpec;
+}
+
+/* BuildOptionMap --
+ * Construct the mapping from element options to widget options.
+ */
+static OptionMap
+BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
+{
+ OptionMap optionMap = (OptionMap)ckalloc(
+ sizeof(const Tk_OptionSpec) * elementClass->nResources + 1);
+ int i;
+
+ for (i = 0; i < elementClass->nResources; ++i) {
+ Ttk_ElementOptionSpec *e = elementClass->specPtr->options+i;
+ optionMap[i] = TTKGetOptionSpec(e->optionName, optionTable, e->type);
+ }
+
+ return optionMap;
+}
+
+/* GetOptionMap --
+ * Return a cached OptionMap matching the specified optionTable
+ * for the specified element, creating it if necessary.
+ */
+static OptionMap
+GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
+{
+ OptionMap optionMap;
+ int isNew;
+ Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(
+ &elementClass->optMapCache, (void*)optionTable, &isNew);
+
+ if (isNew) {
+ optionMap = BuildOptionMap(elementClass, optionTable);
+ Tcl_SetHashValue(entryPtr, optionMap);
+ } else {
+ optionMap = Tcl_GetHashValue(entryPtr);
+ }
+
+ return optionMap;
+}
+
+/*
+ * NewElementClass --
+ * Allocate and initialize an element class record
+ * from the specified element specification.
+ */
+static Ttk_ElementClass *
+NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
+{
+ Ttk_ElementClass *elementClass =
+ (Ttk_ElementClass*)ckalloc(sizeof(Ttk_ElementClass));
+ int i;
+
+ elementClass->name = name;
+ elementClass->specPtr = specPtr;
+ elementClass->clientData = clientData;
+ elementClass->elementRecord = ckalloc(specPtr->elementSize);
+
+ /* Count #element resources:
+ */
+ for (i = 0; specPtr->options[i].optionName != 0; ++i)
+ continue;
+ elementClass->nResources = i;
+
+ /* Initialize default values:
+ */
+ elementClass->defaultValues = (Tcl_Obj**)
+ ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1);
+ for (i=0; i < elementClass->nResources; ++i) {
+ const char *defaultValue = specPtr->options[i].defaultValue;
+ if (defaultValue) {
+ elementClass->defaultValues[i] = Tcl_NewStringObj(defaultValue,-1);
+ Tcl_IncrRefCount(elementClass->defaultValues[i]);
+ } else {
+ elementClass->defaultValues[i] = 0;
+ }
+ }
+
+ /* Initialize option map cache:
+ */
+ Tcl_InitHashTable(&elementClass->optMapCache, TCL_ONE_WORD_KEYS);
+
+ return elementClass;
+}
+
+/*
+ * FreeElementClass --
+ * Release resources associated with an element class record.
+ */
+static void FreeElementClass(Ttk_ElementClass *elementClass)
+{
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr;
+ int i;
+
+ /*
+ * Free default values:
+ */
+ for (i = 0; i < elementClass->nResources; ++i) {
+ if (elementClass->defaultValues[i]) {
+ Tcl_DecrRefCount(elementClass->defaultValues[i]);
+ }
+ }
+ ckfree((ClientData)elementClass->defaultValues);
+
+ /*
+ * Free option map cache:
+ */
+ entryPtr = Tcl_FirstHashEntry(&elementClass->optMapCache, &search);
+ while (entryPtr != NULL) {
+ ckfree(Tcl_GetHashValue(entryPtr));
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&elementClass->optMapCache);
+
+ ckfree(elementClass->elementRecord);
+ ckfree((ClientData)elementClass);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Themes.
+ */
+
+static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; }
+ /* Default ThemeEnabledProc -- always return true */
+
+typedef struct Ttk_Theme_
+{
+ Ttk_Theme parentPtr; /* Parent theme. */
+ Tcl_HashTable elementTable; /* Map element names to class records */
+ Tcl_HashTable styleTable; /* Map style names to Styles */
+ Ttk_Style rootStyle; /* "." style, root of chain */
+ Ttk_ThemeEnabledProc *enabledProc; /* Function called by SetTheme */
+ void *enabledData; /* ClientData for enabledProc */
+ Ttk_ResourceCache cache; /* Back-pointer to resource cache */
+} Theme;
+
+static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent)
+{
+ Theme *themePtr = (Theme*)ckalloc(sizeof(Theme));
+ Tcl_HashEntry *entryPtr;
+ int unused;
+
+ themePtr->parentPtr = parent;
+ themePtr->enabledProc = ThemeEnabled;
+ themePtr->enabledData = NULL;
+ themePtr->cache = cache;
+ Tcl_InitHashTable(&themePtr->elementTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&themePtr->styleTable, TCL_STRING_KEYS);
+
+ /*
+ * Create root style "."
+ */
+ entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused);
+ themePtr->rootStyle = NewStyle();
+ themePtr->rootStyle->styleName =
+ Tcl_GetHashKey(&themePtr->styleTable, entryPtr);
+ themePtr->rootStyle->cache = themePtr->cache;
+ Tcl_SetHashValue(entryPtr, themePtr->rootStyle);
+
+ return themePtr;
+}
+
+static void FreeTheme(Theme *themePtr)
+{
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr;
+
+ /*
+ * Free element table:
+ */
+ entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search);
+ while (entryPtr != NULL) {
+ Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr);
+ FreeElementClass(elementClass);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&themePtr->elementTable);
+
+ /*
+ * Free style table:
+ */
+ entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search);
+ while (entryPtr != NULL) {
+ Style *stylePtr = Tcl_GetHashValue(entryPtr);
+ FreeStyle(stylePtr);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&themePtr->styleTable);
+
+ /*
+ * Free theme record:
+ */
+ ckfree((ClientData)themePtr);
+
+ return;
+}
+
+/*
+ * Element constructors.
+ */
+typedef struct {
+ Ttk_ElementFactory factory;
+ void *clientData;
+} FactoryRec;
+
+/*
+ * Cleanup records:
+ */
+typedef struct CleanupStruct {
+ void *clientData;
+ Ttk_CleanupProc *cleanupProc;
+ struct CleanupStruct *next;
+} Cleanup;
+
+/*------------------------------------------------------------------------
+ * +++ Master style package data structure.
+ */
+typedef struct
+{
+ Tcl_Interp *interp; /* Owner interp */
+ Tcl_HashTable themeTable; /* KEY: name; VALUE: Theme pointer */
+ Tcl_HashTable factoryTable; /* KEY: name; VALUE: FactoryRec ptr */
+ Theme *defaultTheme; /* Default theme; global fallback*/
+ Theme *currentTheme; /* Currently-selected theme */
+ Cleanup *cleanupList; /* Cleanup records */
+ Ttk_ResourceCache cache; /* Resource cache */
+ int themeChangePending; /* scheduled ThemeChangedProc call? */
+} StylePackageData;
+
+static void ThemeChangedProc(ClientData); /* Forward */
+
+/* Ttk_StylePkgFree --
+ * Cleanup procedure for StylePackageData.
+ */
+static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
+{
+ StylePackageData *pkgPtr = clientData;
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr;
+ Cleanup *cleanup;
+
+ /*
+ * Cancel any pending ThemeChanged calls:
+ */
+ if (pkgPtr->themeChangePending) {
+ Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr);
+ }
+
+ /*
+ * Free themes.
+ */
+ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
+ while (entryPtr != NULL) {
+ Theme *themePtr = Tcl_GetHashValue(entryPtr);
+ FreeTheme(themePtr);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&pkgPtr->themeTable);
+
+ /*
+ * Free element constructor table:
+ */
+ entryPtr = Tcl_FirstHashEntry(&pkgPtr->factoryTable, &search);
+ while (entryPtr != NULL) {
+ ckfree(Tcl_GetHashValue(entryPtr));
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&pkgPtr->factoryTable);
+
+ /*
+ * Release cache:
+ */
+ Ttk_FreeResourceCache(pkgPtr->cache);
+
+ /*
+ * Call all registered cleanup procedures:
+ */
+ cleanup = pkgPtr->cleanupList;
+ while (cleanup) {
+ Cleanup *next = cleanup->next;
+ cleanup->cleanupProc(cleanup->clientData);
+ ckfree((ClientData)cleanup);
+ cleanup = next;
+ }
+
+ ckfree((ClientData)pkgPtr);
+}
+
+/*
+ * GetStylePackageData --
+ * Look up the package data registered with the interp.
+ */
+
+static StylePackageData *GetStylePackageData(Tcl_Interp *interp)
+{
+ return Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL);
+}
+
+/*
+ * Ttk_RegisterCleanup --
+ *
+ * Register a function to be called when a theme engine is deleted.
+ * (This only happens when the main interp is destroyed). The cleanup
+ * function is called with the current Tcl interpreter and the client
+ * data provided here.
+ *
+ */
+void Ttk_RegisterCleanup(
+ Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc)
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+ Cleanup *cleanup = (Cleanup*)ckalloc(sizeof(*cleanup));
+
+ cleanup->clientData = clientData;
+ cleanup->cleanupProc = cleanupProc;
+ cleanup->next = pkgPtr->cleanupList;
+ pkgPtr->cleanupList = cleanup;
+}
+
+/* ThemeChangedProc --
+ * Notify all widgets that the theme has been changed.
+ * Scheduled as an idle callback; clientData is a StylePackageData *.
+ *
+ * Sends a <<ThemeChanged>> event to every widget in the hierarchy.
+ * Widgets respond to this by calling the WorldChanged class proc,
+ * which in turn recreates the layout.
+ *
+ * The Tk C API doesn't doesn't provide an easy way to traverse
+ * the widget hierarchy, so this is done by evaluating a Tcl script.
+ */
+
+static void ThemeChangedProc(ClientData clientData)
+{
+ static char ThemeChangedScript[] = "ttk::ThemeChanged";
+ StylePackageData *pkgPtr = clientData;
+
+ if (Tcl_GlobalEval(pkgPtr->interp, ThemeChangedScript) != TCL_OK) {
+ Tcl_BackgroundError(pkgPtr->interp);
+ }
+ pkgPtr->themeChangePending = 0;
+}
+
+/*
+ * ThemeChanged --
+ * Schedule a call to ThemeChanged if one is not already pending.
+ */
+static void ThemeChanged(StylePackageData *pkgPtr)
+{
+ if (!pkgPtr->themeChangePending) {
+ Tcl_DoWhenIdle(ThemeChangedProc, pkgPtr);
+ pkgPtr->themeChangePending = 1;
+ }
+}
+
+/*
+ * Ttk_CreateTheme --
+ * Create a new theme and register it in the global theme table.
+ *
+ * Returns:
+ * Pointer to new Theme structure; NULL if named theme already exists.
+ * Leaves an error message in interp's result on error.
+ */
+
+Ttk_Theme
+Ttk_CreateTheme(
+ Tcl_Interp *interp, /* Interpreter in which to create theme */
+ const char *name, /* Name of the theme to create. */
+ Ttk_Theme parent) /* Parent/fallback theme, NULL for default */
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+ Tcl_HashEntry *entryPtr;
+ int newEntry;
+ Theme *themePtr;
+
+ entryPtr = Tcl_CreateHashEntry(&pkgPtr->themeTable, name, &newEntry);
+ if (!newEntry) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Theme ", name, " already exists", NULL);
+ return NULL;
+ }
+
+ /*
+ * Initialize new theme:
+ */
+ if (!parent) parent = pkgPtr->defaultTheme;
+
+ themePtr = NewTheme(pkgPtr->cache, parent);
+ Tcl_SetHashValue(entryPtr, themePtr);
+
+ return themePtr;
+}
+
+/*
+ * Ttk_SetThemeEnabledProc --
+ * Sets a procedure that is used to check that this theme is available.
+ */
+
+void Ttk_SetThemeEnabledProc(
+ Ttk_Theme theme, Ttk_ThemeEnabledProc enabledProc, void *enabledData)
+{
+ theme->enabledProc = enabledProc;
+ theme->enabledData = enabledData;
+}
+
+/*
+ * LookupTheme --
+ * Retrieve a registered theme by name. If not found,
+ * returns NULL and leaves an error message in interp's result.
+ */
+
+static Ttk_Theme LookupTheme(
+ Tcl_Interp *interp, /* where to leave error messages */
+ StylePackageData *pkgPtr, /* style package master record */
+ const char *name) /* theme name */
+{
+ Tcl_HashEntry *entryPtr;
+
+ entryPtr = Tcl_FindHashEntry(&pkgPtr->themeTable, name);
+ if (!entryPtr) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "theme \"", name, "\" doesn't exist", NULL);
+ return NULL;
+ }
+
+ return Tcl_GetHashValue(entryPtr);
+}
+
+/*
+ * Ttk_GetTheme --
+ * Public interface to LookupTheme.
+ */
+Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *themeName)
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+
+ return LookupTheme(interp, pkgPtr, themeName);
+}
+
+Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp)
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+ return pkgPtr->currentTheme;
+}
+
+Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp)
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+ return pkgPtr->defaultTheme;
+}
+
+/*
+ * Ttk_UseTheme --
+ * Set the current theme, notify all widgets that the theme has changed.
+ */
+int Ttk_UseTheme(Tcl_Interp *interp, Ttk_Theme theme)
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+
+ /*
+ * Check if selected theme is enabled:
+ */
+ while (theme && !theme->enabledProc(theme, theme->enabledData)) {
+ theme = theme->parentPtr;
+ }
+ if (!theme) {
+ /* This shouldn't happen -- default theme should always work */
+ Tcl_Panic("No themes available?");
+ return TCL_ERROR;
+ }
+
+ pkgPtr->currentTheme = theme;
+ ThemeChanged(pkgPtr);
+ return TCL_OK;
+}
+
+/*
+ * Ttk_GetResourceCache --
+ * Return the resource cache associated with 'interp'
+ */
+Ttk_ResourceCache
+Ttk_GetResourceCache(Tcl_Interp *interp)
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+ return pkgPtr->cache;
+}
+
+/*
+ * Register a new layout specification with a style.
+ * @@@ TODO: Make sure layoutName is not ".", root style must not have a layout
+ */
+MODULE_SCOPE
+void Ttk_RegisterLayoutTemplate(
+ Ttk_Theme theme, /* Target theme */
+ const char *layoutName, /* Name of new layout */
+ Ttk_LayoutTemplate layoutTemplate) /* Template */
+{
+ Ttk_Style style = Ttk_GetStyle(theme, layoutName);
+ if (style->layoutTemplate) {
+ Ttk_FreeLayoutTemplate(style->layoutTemplate);
+ }
+ style->layoutTemplate = layoutTemplate;
+}
+
+void Ttk_RegisterLayout(
+ Ttk_Theme themePtr, /* Target theme */
+ const char *layoutName, /* Name of new layout */
+ Ttk_LayoutSpec specPtr) /* Static layout information */
+{
+ Ttk_LayoutTemplate layoutTemplate = Ttk_BuildLayoutTemplate(specPtr);
+ Ttk_RegisterLayoutTemplate(themePtr, layoutName, layoutTemplate);
+}
+
+/*
+ * Ttk_GetStyle --
+ * Look up a Style from a Theme, create new style if not found.
+ */
+Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName)
+{
+ Tcl_HashEntry *entryPtr;
+ int newStyle;
+
+ entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, styleName, &newStyle);
+ if (newStyle) {
+ Ttk_Style stylePtr = NewStyle();
+ const char *dot = strchr(styleName, '.');
+
+ if (dot) {
+ stylePtr->parentStyle = Ttk_GetStyle(themePtr, dot + 1);
+ } else {
+ stylePtr->parentStyle = themePtr->rootStyle;
+ }
+
+ stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr);
+ stylePtr->cache = stylePtr->parentStyle->cache;
+ Tcl_SetHashValue(entryPtr, stylePtr);
+ return stylePtr;
+ }
+ return Tcl_GetHashValue(entryPtr);
+}
+
+/* FindLayoutTemplate --
+ * Locate a layout template in the layout table, checking
+ * generic names to specific names first, then looking for
+ * the full name in the parent theme.
+ */
+Ttk_LayoutTemplate
+Ttk_FindLayoutTemplate(Ttk_Theme themePtr, const char *layoutName)
+{
+ while (themePtr) {
+ Ttk_Style stylePtr = Ttk_GetStyle(themePtr, layoutName);
+ while (stylePtr) {
+ if (stylePtr->layoutTemplate) {
+ return stylePtr->layoutTemplate;
+ }
+ stylePtr = stylePtr->parentStyle;
+ }
+ themePtr = themePtr->parentPtr;
+ }
+ return NULL;
+}
+
+const char *Ttk_StyleName(Ttk_Style stylePtr)
+{
+ return stylePtr->styleName;
+}
+
+/*
+ * Ttk_GetElement --
+ * Look up an element class by name in a given theme.
+ * If not found, try generic element names in this theme, then
+ * repeat the lookups in the parent theme.
+ * If not found, return the null element.
+ */
+Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
+{
+ Tcl_HashEntry *entryPtr;
+ const char *dot = elementName;
+
+ /*
+ * Check if element has already been registered:
+ */
+ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName);
+ if (entryPtr) {
+ return Tcl_GetHashValue(entryPtr);
+ }
+
+ /*
+ * Check generic names:
+ */
+ while (!entryPtr && ((dot = strchr(dot, '.')) != NULL)) {
+ dot++;
+ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot);
+ }
+ if (entryPtr) {
+ return Tcl_GetHashValue(entryPtr);
+ }
+
+ /*
+ * Check parent theme:
+ */
+ if (themePtr->parentPtr) {
+ return Ttk_GetElement(themePtr->parentPtr, elementName);
+ }
+
+ /*
+ * Not found, and this is the root theme; return null element, "".
+ * (@@@ SHOULD: signal a background error)
+ */
+ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, "");
+ /* ASSERT: entryPtr != 0 */
+ return Tcl_GetHashValue(entryPtr);
+}
+
+const char *Ttk_ElementClassName(Ttk_ElementClass *elementClass)
+{
+ return elementClass->name;
+}
+
+/*
+ * Ttk_RegisterElementFactory --
+ * Register a new element factory.
+ */
+int Ttk_RegisterElementFactory(
+ Tcl_Interp *interp, const char *name,
+ Ttk_ElementFactory factory, void *clientData)
+{
+ StylePackageData *pkgPtr = GetStylePackageData(interp);
+ FactoryRec *recPtr = (FactoryRec*)ckalloc(sizeof(*recPtr));
+ Tcl_HashEntry *entryPtr;
+ int newEntry;
+
+ recPtr->factory = factory;
+ recPtr->clientData = clientData;
+
+ entryPtr = Tcl_CreateHashEntry(&pkgPtr->factoryTable, name, &newEntry);
+ if (!newEntry) {
+ /* Free old factory: */
+ ckfree(Tcl_GetHashValue(entryPtr));
+ }
+ Tcl_SetHashValue(entryPtr, recPtr);
+
+ return TCL_OK;
+}
+
+/* Ttk_CloneElement -- element factory procedure.
+ * (style element create $name) "from" $theme ?$element?
+ */
+static int Ttk_CloneElement(
+ Tcl_Interp *interp, void *clientData,
+ Ttk_Theme theme, const char *elementName,
+ int objc, Tcl_Obj *const objv[])
+{
+ Ttk_Theme fromTheme;
+ Ttk_ElementClass *fromElement;
+
+ if (objc <= 0 || objc > 2) {
+ Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?");
+ return TCL_ERROR;
+ }
+
+ fromTheme = Ttk_GetTheme(interp, Tcl_GetString(objv[0]));
+ if (!fromTheme) {
+ return TCL_ERROR;
+ }
+
+ if (objc == 2) {
+ fromElement = Ttk_GetElement(fromTheme, Tcl_GetString(objv[1]));
+ } else {
+ fromElement = Ttk_GetElement(fromTheme, elementName);
+ }
+ if (!fromElement) {
+ return TCL_ERROR;
+ }
+
+ if (Ttk_RegisterElement(interp, theme, elementName,
+ fromElement->specPtr, fromElement->clientData) == NULL)
+ {
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/* Ttk_RegisterElement--
+ * Register an element in the given theme.
+ * Returns: Element handle if successful, NULL otherwise.
+ * On failure, leaves an error message in interp's result
+ * if interp is non-NULL.
+ */
+
+Ttk_ElementClass *Ttk_RegisterElement(
+ Tcl_Interp *interp, /* Where to leave error messages */
+ Ttk_Theme theme, /* Style engine providing the implementation. */
+ const char *name, /* Name of new element */
+ Ttk_ElementSpec *specPtr, /* Static template information */
+ void *clientData) /* application-specific data */
+{
+ Ttk_ElementClass *elementClass;
+ Tcl_HashEntry *entryPtr;
+ int newEntry;
+
+ if (specPtr->version != TK_STYLE_VERSION_2) {
+ /* Version mismatch */
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Internal error: Ttk_RegisterElement (",
+ name, "): invalid version",
+ NULL);
+ }
+ return 0;
+ }
+
+ entryPtr = Tcl_CreateHashEntry(&theme->elementTable, name, &newEntry);
+ if (!newEntry) {
+ if (interp) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Duplicate element ", name, NULL);
+ }
+ return 0;
+ }
+
+ name = Tcl_GetHashKey(&theme->elementTable, entryPtr);
+ elementClass = NewElementClass(name, specPtr, clientData);
+ Tcl_SetHashValue(entryPtr, elementClass);
+
+ return elementClass;
+}
+
+/* Ttk_RegisterElementSpec (deprecated) --
+ * Register a new element.
+ */
+int Ttk_RegisterElementSpec(Ttk_Theme theme,
+ const char *name, Ttk_ElementSpec *specPtr, void *clientData)
+{
+ return Ttk_RegisterElement(NULL, theme, name, specPtr, clientData)
+ ? TCL_OK : TCL_ERROR;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Element record initialization.
+ */
+
+/*
+ * AllocateResource --
+ * Extra initialization for element options like TK_OPTION_COLOR, etc.
+ *
+ * Returns: 1 if OK, 0 on failure.
+ *
+ * Note: if resource allocation fails at this point (just prior
+ * to drawing an element), there's really no good place to
+ * report the error. Instead we just silently fail.
+ */
+
+static int AllocateResource(
+ Ttk_ResourceCache cache,
+ Tk_Window tkwin,
+ Tcl_Obj **destPtr,
+ int optionType)
+{
+ Tcl_Obj *resource = *destPtr;
+
+ switch (optionType)
+ {
+ case TK_OPTION_FONT:
+ return (*destPtr = Ttk_UseFont(cache, tkwin, resource)) != NULL;
+ case TK_OPTION_COLOR:
+ return (*destPtr = Ttk_UseColor(cache, tkwin, resource)) != NULL;
+ case TK_OPTION_BORDER:
+ return (*destPtr = Ttk_UseBorder(cache, tkwin, resource)) != NULL;
+ default:
+ /* no-op; always succeeds */
+ return 1;
+ }
+}
+
+/*
+ * InitializeElementRecord --
+ *
+ * Fill in the element record based on the element's option table.
+ * Resources are initialized from:
+ * the corresponding widget option if present and non-NULL,
+ * otherwise the dynamic state map if specified,
+ * otherwise from the corresponding widget resource if present,
+ * otherwise the default value specified at registration time.
+ *
+ * Returns:
+ * 1 if OK, 0 if an error is detected.
+ *
+ * NOTES:
+ * Tcl_Obj * reference counts are _NOT_ adjusted.
+ */
+
+static
+int InitializeElementRecord(
+ Ttk_ElementClass *eclass, /* Element instance to initialize */
+ Ttk_Style style, /* Style table */
+ char *widgetRecord, /* Source of widget option values */
+ Tk_OptionTable optionTable, /* Option table describing widget record */
+ Tk_Window tkwin, /* Corresponding window */
+ Ttk_State state) /* Widget or element state */
+{
+ char *elementRecord = eclass->elementRecord;
+ OptionMap optionMap = GetOptionMap(eclass,optionTable);
+ int nResources = eclass->nResources;
+ Ttk_ResourceCache cache = style->cache;
+ Ttk_ElementOptionSpec *elementOption = eclass->specPtr->options;
+
+ int i;
+ for (i=0; i<nResources; ++i, ++elementOption) {
+ Tcl_Obj **dest = (Tcl_Obj **)
+ (elementRecord + elementOption->offset);
+ const char *optionName = elementOption->optionName;
+ Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state);
+ Tcl_Obj *widgetValue = 0;
+ Tcl_Obj *elementDefault = eclass->defaultValues[i];
+
+ if (optionMap[i]) {
+ widgetValue = *(Tcl_Obj **)
+ (widgetRecord + optionMap[i]->objOffset);
+ }
+
+ if (widgetValue) {
+ *dest = widgetValue;
+ } else if (dynamicSetting) {
+ *dest = dynamicSetting;
+ } else {
+ Tcl_Obj *styleDefault = Ttk_StyleDefault(style, optionName);
+ *dest = styleDefault ? styleDefault : elementDefault;
+ }
+
+ if (!AllocateResource(cache, tkwin, dest, elementOption->type)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Public API.
+ */
+
+/*
+ * Ttk_QueryStyle --
+ * Look up a style option based on the current state.
+ */
+Tcl_Obj *Ttk_QueryStyle(
+ Ttk_Style style, /* Style to query */
+ void *recordPtr, /* Widget record */
+ Tk_OptionTable optionTable, /* Option table describing widget record */
+ const char *optionName, /* Option name */
+ Ttk_State state) /* Current state */
+{
+ const Tk_OptionSpec *optionSpec;
+ Tcl_Obj *result;
+
+ /*
+ * Check widget record:
+ */
+ optionSpec = TTKGetOptionSpec(optionName, optionTable, TK_OPTION_ANY);
+ if (optionSpec) {
+ result = *(Tcl_Obj**)(((char*)recordPtr) + optionSpec->objOffset);
+ if (result) {
+ return result;
+ }
+ }
+
+ /*
+ * Check dynamic settings:
+ */
+ result = Ttk_StyleMap(style, optionName, state);
+ if (result) {
+ return result;
+ }
+
+ /*
+ * Use style default:
+ */
+ return Ttk_StyleDefault(style, optionName);
+}
+
+/*
+ * Ttk_ElementSize --
+ * Compute the requested size of the given element.
+ */
+
+void
+Ttk_ElementSize(
+ Ttk_ElementClass *eclass, /* Element to query */
+ Ttk_Style style, /* Style settings */
+ char *recordPtr, /* The widget record. */
+ Tk_OptionTable optionTable, /* Description of widget record */
+ Tk_Window tkwin, /* The widget window. */
+ Ttk_State state, /* Current widget state */
+ int *widthPtr, /* Requested width */
+ int *heightPtr, /* Reqested height */
+ Ttk_Padding *paddingPtr) /* Requested inner border */
+{
+ paddingPtr->left = paddingPtr->right = paddingPtr->top = paddingPtr->bottom
+ = *widthPtr = *heightPtr = 0;
+
+ if (!InitializeElementRecord(
+ eclass, style, recordPtr, optionTable, tkwin, state))
+ {
+ return;
+ }
+ eclass->specPtr->size(
+ eclass->clientData, eclass->elementRecord,
+ tkwin, widthPtr, heightPtr, paddingPtr);
+}
+
+/*
+ * Ttk_DrawElement --
+ * Draw the given widget element in a given drawable area.
+ */
+
+void
+Ttk_DrawElement(
+ Ttk_ElementClass *eclass, /* Element instance */
+ Ttk_Style style, /* Style settings */
+ char *recordPtr, /* The widget record. */
+ Tk_OptionTable optionTable, /* Description of option table */
+ Tk_Window tkwin, /* The widget window. */
+ Drawable d, /* Where to draw element. */
+ Ttk_Box b, /* Element area */
+ Ttk_State state) /* Widget or element state flags. */
+{
+ if (b.width <= 0 || b.height <= 0)
+ return;
+ if (!InitializeElementRecord(
+ eclass, style, recordPtr, optionTable, tkwin, state))
+ {
+ return;
+ }
+ eclass->specPtr->draw(
+ eclass->clientData, eclass->elementRecord,
+ tkwin, d, b, state);
+}
+
+/*------------------------------------------------------------------------
+ * +++ 'style' command ensemble procedures.
+ */
+
+/*
+ * TtkEnumerateHashTable --
+ * Helper routine. Sets interp's result to the list of all keys
+ * in the hash table.
+ *
+ * Returns: TCL_OK.
+ * Side effects: Sets interp's result.
+ */
+
+MODULE_SCOPE
+int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht)
+{
+ Tcl_HashSearch search;
+ Tcl_Obj *result = Tcl_NewListObj(0, NULL);
+ Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search);
+
+ while (entryPtr != NULL) {
+ Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1);
+ Tcl_ListObjAppendElement(interp, result, nameObj);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+}
+
+/* HashTableToDict --
+ * Helper routine. Converts a TCL_STRING_KEYS Tcl_HashTable
+ * with Tcl_Obj * entries into a dictionary.
+ */
+static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht)
+{
+ Tcl_HashSearch search;
+ Tcl_Obj *result = Tcl_NewListObj(0, NULL);
+ Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search);
+
+ while (entryPtr != NULL) {
+ Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1);
+ Tcl_Obj *valueObj = Tcl_GetHashValue(entryPtr);
+ Tcl_ListObjAppendElement(NULL, result, nameObj);
+ Tcl_ListObjAppendElement(NULL, result, valueObj);
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+
+ return result;
+}
+
+/* + style map $style ? -resource statemap ... ?
+ *
+ * Note that resource names are unconstrained; the Style
+ * doesn't know what resources individual elements may use.
+ */
+static int
+StyleMapCmd(
+ ClientData clientData, /* Master StylePackageData pointer */
+ Tcl_Interp *interp, /* Current interpreter */
+ int objc, /* Number of arguments */
+ Tcl_Obj *const objv[]) /* Argument objects */
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme = pkgPtr->currentTheme;
+ const char *styleName;
+ Style *stylePtr;
+ int i;
+
+ if (objc < 3) {
+usage:
+ Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??");
+ return TCL_ERROR;
+ }
+
+ styleName = Tcl_GetString(objv[2]);
+ stylePtr = Ttk_GetStyle(theme, styleName);
+
+ /* NOTE: StateMaps are actually Tcl_Obj *s, so HashTableToDict works
+ * for settingsTable.
+ */
+ if (objc == 3) { /* style map $styleName */
+ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->settingsTable));
+ return TCL_OK;
+ } else if (objc == 4) { /* style map $styleName -option */
+ const char *optionName = Tcl_GetString(objv[3]);
+ Tcl_HashEntry *entryPtr =
+ Tcl_FindHashEntry(&stylePtr->settingsTable, optionName);
+ if (entryPtr) {
+ Tcl_SetObjResult(interp, (Tcl_Obj*)Tcl_GetHashValue(entryPtr));
+ }
+ return TCL_OK;
+ } else if (objc % 2 != 1) {
+ goto usage;
+ }
+
+ for (i = 3; i < objc; i += 2) {
+ const char *optionName = Tcl_GetString(objv[i]);
+ Tcl_Obj *stateMap = objv[i+1];
+ Tcl_HashEntry *entryPtr;
+ int newEntry;
+
+ /* Make sure 'stateMap' is legal:
+ * (@@@ SHOULD: check for valid resource values as well,
+ * but we don't know what types they should be at this level.)
+ */
+ if (!Ttk_GetStateMapFromObj(interp, stateMap))
+ return TCL_ERROR;
+
+ entryPtr = Tcl_CreateHashEntry(
+ &stylePtr->settingsTable,optionName,&newEntry);
+
+ Tcl_IncrRefCount(stateMap);
+ if (!newEntry) {
+ Tcl_DecrRefCount((Tcl_Obj*)Tcl_GetHashValue(entryPtr));
+ }
+ Tcl_SetHashValue(entryPtr, stateMap);
+ }
+ ThemeChanged(pkgPtr);
+ return TCL_OK;
+}
+
+/* + style configure $style -option ?value...
+ */
+static int StyleConfigureCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme = pkgPtr->currentTheme;
+ const char *styleName;
+ Style *stylePtr;
+ int i;
+
+ if (objc < 3) {
+usage:
+ Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??");
+ return TCL_ERROR;
+ }
+
+ styleName = Tcl_GetString(objv[2]);
+ stylePtr = Ttk_GetStyle(theme, styleName);
+
+ if (objc == 3) { /* style default $styleName */
+ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable));
+ return TCL_OK;
+ } else if (objc == 4) { /* style default $styleName -option */
+ const char *optionName = Tcl_GetString(objv[3]);
+ Tcl_HashEntry *entryPtr =
+ Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName);
+ if (entryPtr) {
+ Tcl_SetObjResult(interp, (Tcl_Obj*)Tcl_GetHashValue(entryPtr));
+ }
+ return TCL_OK;
+ } else if (objc % 2 != 1) {
+ goto usage;
+ }
+
+ for (i = 3; i < objc; i += 2) {
+ const char *optionName = Tcl_GetString(objv[i]);
+ Tcl_Obj *value = objv[i+1];
+ Tcl_HashEntry *entryPtr;
+ int newEntry;
+
+ entryPtr = Tcl_CreateHashEntry(
+ &stylePtr->defaultsTable,optionName,&newEntry);
+
+ Tcl_IncrRefCount(value);
+ if (!newEntry) {
+ Tcl_DecrRefCount((Tcl_Obj*)Tcl_GetHashValue(entryPtr));
+ }
+ Tcl_SetHashValue(entryPtr, value);
+ }
+
+ ThemeChanged(pkgPtr);
+ return TCL_OK;
+}
+
+/* + style lookup $style -option ?statespec? ?defaultValue?
+ */
+static int StyleLookupCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme = pkgPtr->currentTheme;
+ Ttk_Style style = NULL;
+ const char *optionName;
+ Ttk_State state = 0ul;
+ Tcl_Obj *result;
+
+ if (objc < 4 || objc > 6) {
+ Tcl_WrongNumArgs(interp, 2, objv, "style -option ?state? ?default?");
+ return TCL_ERROR;
+ }
+
+ style = Ttk_GetStyle(theme, Tcl_GetString(objv[2]));
+ if (!style) {
+ return TCL_ERROR;
+ }
+ optionName = Tcl_GetString(objv[3]);
+
+ if (objc >= 5) {
+ Ttk_StateSpec stateSpec;
+ /* @@@ SB: Ttk_GetStateFromObj(); 'offbits' spec is ignored */
+ if (Ttk_GetStateSpecFromObj(interp, objv[4], &stateSpec) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ state = stateSpec.onbits;
+ }
+
+ result = Ttk_QueryStyle(style, NULL,NULL, optionName, state);
+ if (result == NULL && objc >= 6) { /* Use caller-supplied fallback */
+ result = objv[5];
+ }
+
+ if (result) {
+ Tcl_SetObjResult(interp, result);
+ }
+
+ return TCL_OK;
+}
+
+static int StyleThemeCurrentCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr = NULL;
+ const char *name = NULL;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, "");
+ return TCL_ERROR;
+ }
+
+ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
+ while (entryPtr != NULL) {
+ Theme *ptr = Tcl_GetHashValue(entryPtr);
+ if (ptr == pkgPtr->currentTheme) {
+ name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr);
+ break;
+ }
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+
+ if (name == NULL) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj("error: failed to get theme name", -1));
+ return TCL_ERROR;
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1));
+ return TCL_OK;
+}
+
+/* + style theme create name ?-parent $theme? ?-settings { script }?
+ */
+static int StyleThemeCreateCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ static const char *optStrings[] =
+ { "-parent", "-settings", NULL };
+ enum { OP_PARENT, OP_SETTINGS };
+ Ttk_Theme parentTheme = pkgPtr->defaultTheme, newTheme;
+ Tcl_Obj *settingsScript = NULL;
+ const char *themeName;
+ int i;
+
+ if (objc < 4 || objc % 2 != 0) {
+ Tcl_WrongNumArgs(interp, 3, objv, "name ?-option value ...?");
+ return TCL_ERROR;
+ }
+
+ themeName = Tcl_GetString(objv[3]);
+
+ for (i=4; i < objc; i +=2) {
+ int option;
+ if (Tcl_GetIndexFromObj(
+ interp, objv[i], optStrings, "option", 0, &option) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ switch (option) {
+ case OP_PARENT:
+ parentTheme = LookupTheme(
+ interp, pkgPtr, Tcl_GetString(objv[i+1]));
+ if (!parentTheme)
+ return TCL_ERROR;
+ break;
+ case OP_SETTINGS:
+ settingsScript = objv[i+1];
+ break;
+ }
+ }
+
+ newTheme = Ttk_CreateTheme(interp, themeName, parentTheme);
+ if (!newTheme) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Evaluate the -settings script, if supplied:
+ */
+ if (settingsScript) {
+ Ttk_Theme oldTheme = pkgPtr->currentTheme;
+ int status;
+
+ pkgPtr->currentTheme = newTheme;
+ status = Tcl_EvalObjEx(interp, settingsScript, 0);
+ pkgPtr->currentTheme = oldTheme;
+ return status;
+ } else {
+ return TCL_OK;
+ }
+}
+
+/* + style theme names --
+ * Return list of registered themes.
+ */
+static int StyleThemeNamesCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ return TtkEnumerateHashTable(interp, &pkgPtr->themeTable);
+}
+
+/* + style theme settings $theme $script
+ *
+ * Temporarily sets the current theme to $themeName,
+ * evaluates $script, then restores the old theme.
+ */
+static int
+StyleThemeSettingsCmd(
+ ClientData clientData, /* Master StylePackageData pointer */
+ Tcl_Interp *interp, /* Current interpreter */
+ int objc, /* Number of arguments */
+ Tcl_Obj *const objv[]) /* Argument objects */
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme oldTheme = pkgPtr->currentTheme;
+ Ttk_Theme newTheme;
+ int status;
+
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "theme script");
+ return TCL_ERROR;
+ }
+
+ newTheme = LookupTheme(interp, pkgPtr, Tcl_GetString(objv[3]));
+ if (!newTheme)
+ return TCL_ERROR;
+
+ pkgPtr->currentTheme = newTheme;
+ status = Tcl_EvalObjEx(interp, objv[4], 0);
+ pkgPtr->currentTheme = oldTheme;
+
+ return status;
+}
+
+/* + style element create name type ? ...args ?
+ */
+static int StyleElementCreateCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme = pkgPtr->currentTheme;
+ const char *elementName, *factoryName;
+ Tcl_HashEntry *entryPtr;
+ FactoryRec *recPtr;
+
+ if (objc < 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "name type ?-option value ...?");
+ return TCL_ERROR;
+ }
+
+ elementName = Tcl_GetString(objv[3]);
+ factoryName = Tcl_GetString(objv[4]);
+
+ entryPtr = Tcl_FindHashEntry(&pkgPtr->factoryTable, factoryName);
+ if (!entryPtr) {
+ Tcl_AppendResult(interp, "No such element type ", factoryName, NULL);
+ return TCL_ERROR;
+ }
+
+ recPtr = Tcl_GetHashValue(entryPtr);
+
+ return recPtr->factory(interp, recPtr->clientData,
+ theme, elementName, objc - 5, objv + 5);
+}
+
+/* + style element names --
+ * Return a list of elements defined in the current theme.
+ */
+static int StyleElementNamesCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme = pkgPtr->currentTheme;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
+ return TtkEnumerateHashTable(interp, &theme->elementTable);
+}
+
+/* + style element options $element --
+ * Return list of element options for specified element
+ */
+static int StyleElementOptionsCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme = pkgPtr->currentTheme;
+ const char *elementName;
+ Ttk_ElementClass *elementClass;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "element");
+ return TCL_ERROR;
+ }
+
+ elementName = Tcl_GetString(objv[3]);
+ elementClass = Ttk_GetElement(theme, elementName);
+ if (elementClass) {
+ Ttk_ElementSpec *specPtr = elementClass->specPtr;
+ Ttk_ElementOptionSpec *option = specPtr->options;
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+
+ while (option->optionName) {
+ Tcl_ListObjAppendElement(
+ interp, result, Tcl_NewStringObj(option->optionName,-1));
+ ++option;
+ }
+
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ }
+
+ Tcl_AppendResult(interp, "element ", elementName, " not found", NULL);
+ return TCL_ERROR;
+}
+
+/* + style layout name ?spec?
+ */
+static int StyleLayoutCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme = pkgPtr->currentTheme;
+ const char *layoutName;
+ Ttk_LayoutTemplate layoutTemplate;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "name ?spec?");
+ return TCL_ERROR;
+ }
+
+ layoutName = Tcl_GetString(objv[2]);
+
+ if (objc == 3) {
+ layoutTemplate = Ttk_FindLayoutTemplate(theme, layoutName);
+ if (!layoutTemplate) {
+ Tcl_AppendResult(interp, "Layout ", layoutName, " not found", NULL);
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, Ttk_UnparseLayoutTemplate(layoutTemplate));
+ } else {
+ layoutTemplate = Ttk_ParseLayoutTemplate(interp, objv[3]);
+ if (!layoutTemplate) {
+ return TCL_ERROR;
+ }
+ Ttk_RegisterLayoutTemplate(theme, layoutName, layoutTemplate);
+ ThemeChanged(pkgPtr);
+ }
+ return TCL_OK;
+}
+
+/* + style theme use $theme --
+ * Sets the current theme to $theme
+ */
+static int
+StyleThemeUseCmd(
+ ClientData clientData, /* Master StylePackageData pointer */
+ Tcl_Interp *interp, /* Current interpreter */
+ int objc, /* Number of arguments */
+ Tcl_Obj *const objv[]) /* Argument objects */
+{
+ StylePackageData *pkgPtr = clientData;
+ Ttk_Theme theme;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "?theme?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ return StyleThemeCurrentCmd(clientData, interp, objc, objv);
+ }
+
+ theme = LookupTheme(interp, pkgPtr, Tcl_GetString(objv[3]));
+ if (!theme) {
+ return TCL_ERROR;
+ }
+
+ return Ttk_UseTheme(interp, theme);
+}
+
+/*
+ * StyleObjCmd --
+ * Implementation of the [style] command.
+ */
+
+static const Ttk_Ensemble StyleThemeEnsemble[] = {
+ { "create", StyleThemeCreateCmd, 0 },
+ { "names", StyleThemeNamesCmd, 0 },
+ { "settings", StyleThemeSettingsCmd, 0 },
+ { "use", StyleThemeUseCmd, 0 },
+ { NULL, 0, 0 }
+};
+
+static const Ttk_Ensemble StyleElementEnsemble[] = {
+ { "create", StyleElementCreateCmd, 0 },
+ { "names", StyleElementNamesCmd, 0 },
+ { "options", StyleElementOptionsCmd, 0 },
+ { NULL, 0, 0 }
+};
+
+static const Ttk_Ensemble StyleEnsemble[] = {
+ { "configure", StyleConfigureCmd, 0 },
+ { "map", StyleMapCmd, 0 },
+ { "lookup", StyleLookupCmd, 0 },
+ { "layout", StyleLayoutCmd, 0 },
+ { "theme", 0, StyleThemeEnsemble },
+ { "element", 0, StyleElementEnsemble },
+ { NULL, 0, 0 }
+};
+
+static int
+StyleObjCmd(
+ ClientData clientData, /* Master StylePackageData pointer */
+ Tcl_Interp *interp, /* Current interpreter */
+ int objc, /* Number of arguments */
+ Tcl_Obj *const objv[]) /* Argument objects */
+{
+ return Ttk_InvokeEnsemble(StyleEnsemble, 1, clientData,interp,objc,objv);
+}
+
+MODULE_SCOPE
+int Ttk_InvokeEnsemble( /* Run an ensemble command */
+ const Ttk_Ensemble *ensemble, int cmdIndex,
+ void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ while (cmdIndex < objc) {
+ int index;
+ if (Tcl_GetIndexFromObjStruct(interp,
+ objv[cmdIndex], ensemble, sizeof(ensemble[0]),
+ "command", 0, &index)
+ != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ if (ensemble[index].command) {
+ return ensemble[index].command(clientData, interp, objc, objv);
+ }
+ ensemble = ensemble[index].ensemble;
+ ++cmdIndex;
+ }
+ Tcl_WrongNumArgs(interp, cmdIndex, objv, "option ?arg ...?");
+ return TCL_ERROR;
+}
+
+/*
+ * Ttk_StylePkgInit --
+ * Initializes all the structures that are used by the style
+ * package on a per-interp basis.
+ */
+
+void Ttk_StylePkgInit(Tcl_Interp *interp)
+{
+ Tcl_Namespace *nsPtr;
+
+ StylePackageData *pkgPtr = (StylePackageData *)
+ ckalloc(sizeof(StylePackageData));
+
+ pkgPtr->interp = interp;
+ Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS);
+ Tcl_InitHashTable(&pkgPtr->factoryTable, TCL_STRING_KEYS);
+ pkgPtr->cleanupList = NULL;
+ pkgPtr->cache = Ttk_CreateResourceCache(interp);
+ pkgPtr->themeChangePending = 0;
+
+ Tcl_SetAssocData(interp, PKG_ASSOC_KEY, Ttk_StylePkgFree, pkgPtr);
+
+ /*
+ * Create the default system theme:
+ *
+ * pkgPtr->defaultTheme must be initialized to 0 before
+ * calling Ttk_CreateTheme for the first time, since it's used
+ * as the parent theme.
+ */
+ pkgPtr->defaultTheme = 0;
+ pkgPtr->defaultTheme = pkgPtr->currentTheme =
+ Ttk_CreateTheme(interp, "default", NULL);
+
+ /*
+ * Register null element, used as a last-resort fallback:
+ */
+ Ttk_RegisterElement(interp, pkgPtr->defaultTheme, "", &ttkNullElementSpec, 0);
+
+ /*
+ * Register commands:
+ */
+ Tcl_CreateObjCommand(interp, "::ttk::style", StyleObjCmd, pkgPtr, 0);
+
+ nsPtr = Tcl_FindNamespace(interp, "::ttk", NULL, TCL_LEAVE_ERR_MSG);
+ Tcl_Export(interp, nsPtr, "style", 0 /* dontResetList */);
+
+ Ttk_RegisterElementFactory(interp, "from", Ttk_CloneElement, 0);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h
new file mode 100644
index 0000000..7bf2a7f
--- /dev/null
+++ b/generic/ttk/ttkTheme.h
@@ -0,0 +1,444 @@
+/*
+ * Copyright (c) 2003 Joe English. Freely redistributable.
+ *
+ * Declarations for Tk theme engine.
+ */
+
+#ifndef _TTKTHEME
+#define _TTKTHEME
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MODULE_SCOPE
+# ifdef __cplusplus
+# define MODULE_SCOPE extern "C"
+# else
+# define MODULE_SCOPE extern
+# endif
+#endif
+
+#define TTKAPI MODULE_SCOPE
+
+/* Ttk syncs to the Tk version & patchlevel */
+#define TTK_VERSION TK_VERSION
+#define TTK_PATCH_LEVEL TK_PATCH_LEVEL
+
+/*------------------------------------------------------------------------
+ * +++ Defaults for element option specifications.
+ */
+#define DEFAULT_FONT "TkDefaultFont"
+#define DEFAULT_BACKGROUND "#d9d9d9"
+#define DEFAULT_FOREGROUND "black"
+
+/*------------------------------------------------------------------------
+ * +++ Widget states.
+ * Keep in sync with stateNames[] in tkstate.c.
+ */
+
+typedef unsigned int Ttk_State;
+
+#define TTK_STATE_ACTIVE (1<<0)
+#define TTK_STATE_DISABLED (1<<1)
+#define TTK_STATE_FOCUS (1<<2)
+#define TTK_STATE_PRESSED (1<<3)
+#define TTK_STATE_SELECTED (1<<4)
+#define TTK_STATE_BACKGROUND (1<<5)
+#define TTK_STATE_ALTERNATE (1<<6)
+#define TTK_STATE_INVALID (1<<7)
+#define TTK_STATE_READONLY (1<<8)
+#define TTK_STATE_HOVER (1<<9)
+#define TTK_STATE_USER6 (1<<10)
+#define TTK_STATE_USER5 (1<<11)
+#define TTK_STATE_USER4 (1<<12)
+#define TTK_STATE_USER3 (1<<13)
+#define TTK_STATE_USER2 (1<<14)
+#define TTK_STATE_USER1 (1<<15)
+
+/* Maintenance note: if you get all the way to "USER1",
+ * see tkstate.c
+ */
+typedef struct
+{
+ unsigned int onbits; /* bits to turn on */
+ unsigned int offbits; /* bits to turn off */
+} Ttk_StateSpec;
+
+#define Ttk_StateMatches(state, spec) \
+ (((state) & ((spec)->onbits|(spec)->offbits)) == (spec)->onbits)
+
+#define Ttk_ModifyState(state, spec) \
+ (((state) & ~(spec)->offbits) | (spec)->onbits)
+
+TTKAPI int Ttk_GetStateSpecFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_StateSpec *);
+TTKAPI Tcl_Obj *Ttk_NewStateSpecObj(unsigned int onbits,unsigned int offbits);
+
+/*------------------------------------------------------------------------
+ * +++ State maps and state tables.
+ */
+typedef Tcl_Obj *Ttk_StateMap;
+
+TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj(Tcl_Interp *, Tcl_Obj *);
+TTKAPI Tcl_Obj *Ttk_StateMapLookup(Tcl_Interp*, Ttk_StateMap, Ttk_State);
+
+/*
+ * Table for looking up an integer index based on widget state:
+ */
+typedef struct
+{
+ int index; /* Value to return if this entry matches */
+ unsigned int onBits; /* Bits which must be set */
+ unsigned int offBits; /* Bits which must be cleared */
+} Ttk_StateTable;
+
+TTKAPI int Ttk_StateTableLookup(Ttk_StateTable map[], Ttk_State);
+
+/*------------------------------------------------------------------------
+ * +++ Padding.
+ * Used to represent internal padding and borders.
+ */
+typedef struct
+{
+ short left;
+ short top;
+ short right;
+ short bottom;
+} Ttk_Padding;
+
+TTKAPI int Ttk_GetPaddingFromObj(Tcl_Interp*,Tk_Window,Tcl_Obj*,Ttk_Padding*);
+TTKAPI int Ttk_GetBorderFromObj(Tcl_Interp*,Tcl_Obj*,Ttk_Padding*);
+
+TTKAPI Ttk_Padding Ttk_MakePadding(short l, short t, short r, short b);
+TTKAPI Ttk_Padding Ttk_UniformPadding(short borderWidth);
+TTKAPI Ttk_Padding Ttk_AddPadding(Ttk_Padding, Ttk_Padding);
+TTKAPI Ttk_Padding Ttk_RelievePadding(Ttk_Padding, int relief, int n);
+
+#define Ttk_PaddingWidth(p) ((p).left + (p).right)
+#define Ttk_PaddingHeight(p) ((p).top + (p).bottom)
+
+#define Ttk_SetMargins(tkwin, pad) \
+ Tk_SetInternalBorderEx(tkwin, pad.left, pad.right, pad.top, pad.bottom)
+
+/*------------------------------------------------------------------------
+ * +++ Boxes.
+ * Used to represent rectangular regions
+ */
+typedef struct /* Hey, this is an XRectangle! */
+{
+ int x;
+ int y;
+ int width;
+ int height;
+} Ttk_Box;
+
+TTKAPI Ttk_Box Ttk_MakeBox(int x, int y, int width, int height);
+TTKAPI int Ttk_BoxContains(Ttk_Box, int x, int y);
+
+#define Ttk_WinBox(tkwin) Ttk_MakeBox(0,0,Tk_Width(tkwin),Tk_Height(tkwin))
+
+/*------------------------------------------------------------------------
+ * +++ Layout utilities.
+ */
+typedef enum {
+ TTK_SIDE_LEFT, TTK_SIDE_TOP, TTK_SIDE_RIGHT, TTK_SIDE_BOTTOM
+} Ttk_Side;
+
+typedef unsigned int Ttk_Sticky;
+
+/*
+ * -sticky bits for Ttk_StickBox:
+ */
+#define TTK_STICK_W (0x1)
+#define TTK_STICK_E (0x2)
+#define TTK_STICK_N (0x4)
+#define TTK_STICK_S (0x8)
+
+/*
+ * Aliases and useful combinations:
+ */
+#define TTK_FILL_X (0x3) /* -sticky ew */
+#define TTK_FILL_Y (0xC) /* -sticky ns */
+#define TTK_FILL_BOTH (0xF) /* -sticky nswe */
+
+TTKAPI int Ttk_GetStickyFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Sticky *);
+TTKAPI Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky);
+
+/*
+ * Extra bits for position specifications (combine -side and -sticky)
+ */
+
+typedef unsigned int Ttk_PositionSpec; /* See below */
+
+#define TTK_PACK_LEFT (0x10) /* pack at left of current parcel */
+#define TTK_PACK_RIGHT (0x20) /* pack at right of current parcel */
+#define TTK_PACK_TOP (0x40) /* pack at top of current parcel */
+#define TTK_PACK_BOTTOM (0x80) /* pack at bottom of current parcel */
+#define TTK_EXPAND (0x100) /* use entire parcel */
+#define TTK_BORDER (0x200) /* draw this element after children */
+#define TTK_UNIT (0x400) /* treat descendants as a part of element */
+
+/*
+ * Extra bits for layout specifications
+ */
+#define _TTK_CHILDREN (0x1000)/* for LayoutSpecs -- children follow */
+#define _TTK_LAYOUT_END (0x2000)/* for LayoutSpecs -- end of child list */
+#define _TTK_LAYOUT (0x4000)/* for LayoutSpec tables -- define layout */
+
+#define _TTK_MASK_STICK (0x0F) /* See Ttk_UnparseLayout() */
+#define _TTK_MASK_PACK (0xF0) /* See Ttk_UnparseLayout(), packStrings */
+
+TTKAPI Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int w, int h, Ttk_Side side);
+TTKAPI Ttk_Box Ttk_StickBox(Ttk_Box parcel, int w, int h, Ttk_Sticky sticky);
+TTKAPI Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h, Tk_Anchor anchor);
+TTKAPI Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p);
+TTKAPI Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p);
+TTKAPI Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int w,int h, Ttk_Side,Ttk_Sticky);
+TTKAPI Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec);
+
+/*------------------------------------------------------------------------
+ * +++ Themes.
+ */
+MODULE_SCOPE void Ttk_StylePkgInit(Tcl_Interp *);
+
+typedef struct Ttk_Theme_ *Ttk_Theme;
+typedef struct Ttk_ElementClass_ Ttk_ElementClass;
+typedef struct Ttk_Layout_ *Ttk_Layout;
+typedef struct Ttk_LayoutNode_ *Ttk_Element;
+typedef struct Ttk_Style_ *Ttk_Style;
+
+TTKAPI Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *name);
+TTKAPI Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp);
+TTKAPI Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp);
+
+TTKAPI Ttk_Theme Ttk_CreateTheme(
+ Tcl_Interp *interp, const char *name, Ttk_Theme parent);
+
+typedef int (Ttk_ThemeEnabledProc)(Ttk_Theme theme, void *clientData);
+MODULE_SCOPE void Ttk_SetThemeEnabledProc(Ttk_Theme, Ttk_ThemeEnabledProc, void *);
+
+MODULE_SCOPE int Ttk_UseTheme(Tcl_Interp *, Ttk_Theme);
+
+typedef void (Ttk_CleanupProc)(void *clientData);
+TTKAPI void Ttk_RegisterCleanup(
+ Tcl_Interp *interp, void *deleteData, Ttk_CleanupProc *cleanupProc);
+
+/*------------------------------------------------------------------------
+ * +++ Elements.
+ */
+
+enum TTKStyleVersion2 { TK_STYLE_VERSION_2 = 2 };
+
+typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord,
+ Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding*);
+typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord,
+ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state);
+
+typedef struct Ttk_ElementOptionSpec
+{
+ const char *optionName; /* Command-line name of the widget option */
+ Tk_OptionType type; /* Accepted option types */
+ int offset; /* Offset of Tcl_Obj* field in element record */
+ const char *defaultValue; /* Default value to used if resource missing */
+} Ttk_ElementOptionSpec;
+
+#define TK_OPTION_ANY TK_OPTION_STRING
+
+typedef struct Ttk_ElementSpec {
+ enum TTKStyleVersion2 version; /* Version of the style support. */
+ size_t elementSize; /* Size of element record */
+ Ttk_ElementOptionSpec *options; /* List of options, NULL-terminated */
+ Ttk_ElementSizeProc *size; /* Compute min size and padding */
+ Ttk_ElementDrawProc *draw; /* Draw the element */
+} Ttk_ElementSpec;
+
+TTKAPI Ttk_ElementClass *Ttk_RegisterElement(
+ Tcl_Interp *interp, Ttk_Theme theme, const char *elementName,
+ Ttk_ElementSpec *, void *clientData);
+
+typedef int (*Ttk_ElementFactory)
+ (Tcl_Interp *, void *clientData,
+ Ttk_Theme, const char *elementName, int objc, Tcl_Obj *const objv[]);
+
+TTKAPI int Ttk_RegisterElementFactory(
+ Tcl_Interp *, const char *name, Ttk_ElementFactory, void *clientData);
+
+/*
+ * Null element implementation:
+ * has no geometry or layout; may be used as a stub or placeholder.
+ */
+
+typedef struct {
+ Tcl_Obj *unused;
+} NullElement;
+
+MODULE_SCOPE void TtkNullElementSize
+ (void *, void *, Tk_Window, int *, int *, Ttk_Padding *);
+MODULE_SCOPE void TtkNullElementDraw
+ (void *, void *, Tk_Window, Drawable, Ttk_Box, Ttk_State);
+MODULE_SCOPE Ttk_ElementOptionSpec TtkNullElementOptions[];
+MODULE_SCOPE Ttk_ElementSpec ttkNullElementSpec;
+
+/*------------------------------------------------------------------------
+ * +++ Layout templates.
+ */
+typedef struct {
+ const char * elementName;
+ unsigned opcode;
+} TTKLayoutInstruction, *Ttk_LayoutSpec;
+
+#define TTK_BEGIN_LAYOUT_TABLE(name) \
+ static TTKLayoutInstruction name[] = {
+#define TTK_LAYOUT(name, content) \
+ { name, _TTK_CHILDREN|_TTK_LAYOUT }, \
+ content \
+ { 0, _TTK_LAYOUT_END },
+#define TTK_GROUP(name, flags, children) \
+ { name, flags | _TTK_CHILDREN }, \
+ children \
+ { 0, _TTK_LAYOUT_END },
+#define TTK_NODE(name, flags) { name, flags },
+#define TTK_END_LAYOUT_TABLE { 0, _TTK_LAYOUT | _TTK_LAYOUT_END } };
+
+#define TTK_BEGIN_LAYOUT(name) static TTKLayoutInstruction name[] = {
+#define TTK_END_LAYOUT { 0, _TTK_LAYOUT_END } };
+
+TTKAPI void Ttk_RegisterLayout(
+ Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec);
+
+TTKAPI void Ttk_RegisterLayouts(
+ Ttk_Theme theme, Ttk_LayoutSpec layoutTable);
+
+/*------------------------------------------------------------------------
+ * +++ Layout instances.
+ */
+
+MODULE_SCOPE Ttk_Layout Ttk_CreateLayout(
+ Tcl_Interp *, Ttk_Theme, const char *name,
+ void *recordPtr, Tk_OptionTable, Tk_Window tkwin);
+
+MODULE_SCOPE Ttk_Layout Ttk_CreateSublayout(
+ Tcl_Interp *, Ttk_Theme, Ttk_Layout, const char *name, Tk_OptionTable);
+
+MODULE_SCOPE void Ttk_FreeLayout(Ttk_Layout);
+
+MODULE_SCOPE void Ttk_LayoutSize(Ttk_Layout,Ttk_State,int *widthPtr,int *heightPtr);
+MODULE_SCOPE void Ttk_PlaceLayout(Ttk_Layout, Ttk_State, Ttk_Box);
+MODULE_SCOPE void Ttk_DrawLayout(Ttk_Layout, Ttk_State, Drawable);
+
+MODULE_SCOPE void Ttk_RebindSublayout(Ttk_Layout, void *recordPtr);
+
+MODULE_SCOPE Ttk_Element Ttk_IdentifyElement(Ttk_Layout, int x, int y);
+MODULE_SCOPE Ttk_Element Ttk_FindElement(Ttk_Layout, const char *nodeName);
+
+MODULE_SCOPE const char *Ttk_ElementName(Ttk_Element);
+MODULE_SCOPE Ttk_Box Ttk_ElementParcel(Ttk_Element);
+
+MODULE_SCOPE Ttk_Box Ttk_ClientRegion(Ttk_Layout, const char *elementName);
+
+MODULE_SCOPE Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_Element);
+MODULE_SCOPE Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_Element);
+MODULE_SCOPE void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_Element, int *w, int *h);
+
+MODULE_SCOPE void Ttk_PlaceElement(Ttk_Layout, Ttk_Element, Ttk_Box);
+MODULE_SCOPE void Ttk_ChangeElementState(Ttk_Element,unsigned set,unsigned clr);
+
+MODULE_SCOPE Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State);
+
+TTKAPI Ttk_Style Ttk_LayoutStyle(Ttk_Layout);
+TTKAPI Tcl_Obj *Ttk_StyleDefault(Ttk_Style, const char *optionName);
+TTKAPI Tcl_Obj *Ttk_StyleMap(Ttk_Style, const char *optionName, Ttk_State);
+
+/*------------------------------------------------------------------------
+ * +++ Resource cache.
+ * See resource.c for explanation.
+ */
+
+typedef struct Ttk_ResourceCache_ *Ttk_ResourceCache;
+MODULE_SCOPE Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *);
+MODULE_SCOPE void Ttk_FreeResourceCache(Ttk_ResourceCache);
+
+MODULE_SCOPE Ttk_ResourceCache Ttk_GetResourceCache(Tcl_Interp*);
+MODULE_SCOPE Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache, Tk_Window, Tcl_Obj *);
+MODULE_SCOPE Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache, Tk_Window, Tcl_Obj *);
+MODULE_SCOPE Tcl_Obj *Ttk_UseBorder(Ttk_ResourceCache, Tk_Window, Tcl_Obj *);
+MODULE_SCOPE Tk_Image Ttk_UseImage(Ttk_ResourceCache, Tk_Window, Tcl_Obj *);
+
+MODULE_SCOPE void Ttk_RegisterNamedColor(Ttk_ResourceCache, const char *, XColor *);
+
+/*------------------------------------------------------------------------
+ * +++ Image specifications.
+ */
+
+typedef struct TtkImageSpec Ttk_ImageSpec;
+TTKAPI Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *);
+TTKAPI void TtkFreeImageSpec(Ttk_ImageSpec *);
+TTKAPI Tk_Image TtkSelectImage(Ttk_ImageSpec *, Ttk_State);
+
+/*------------------------------------------------------------------------
+ * +++ Miscellaneous enumerations.
+ * Other stuff that element implementations need to know about.
+ */
+typedef enum /* -default option values */
+{
+ TTK_BUTTON_DEFAULT_NORMAL, /* widget defaultable */
+ TTK_BUTTON_DEFAULT_ACTIVE, /* currently the default widget */
+ TTK_BUTTON_DEFAULT_DISABLED /* not defaultable */
+} Ttk_ButtonDefaultState;
+
+TTKAPI int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, int *);
+
+typedef enum /* -compound option values */
+{
+ TTK_COMPOUND_NONE, /* image if specified, otherwise text */
+ TTK_COMPOUND_TEXT, /* text only */
+ TTK_COMPOUND_IMAGE, /* image only */
+ TTK_COMPOUND_CENTER, /* text overlays image */
+ TTK_COMPOUND_TOP, /* image above text */
+ TTK_COMPOUND_BOTTOM, /* image below text */
+ TTK_COMPOUND_LEFT, /* image to left of text */
+ TTK_COMPOUND_RIGHT /* image to right of text */
+} Ttk_Compound;
+
+TTKAPI int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, int *);
+
+typedef enum { /* -orient option values */
+ TTK_ORIENT_HORIZONTAL,
+ TTK_ORIENT_VERTICAL
+} Ttk_Orient;
+
+/*------------------------------------------------------------------------
+ * +++ Utilities.
+ */
+
+typedef struct TtkEnsemble {
+ const char *name; /* subcommand name */
+ Tcl_ObjCmdProc *command; /* subcommand implementation, OR: */
+ const struct TtkEnsemble *ensemble; /* subcommand ensemble */
+} Ttk_Ensemble;
+
+MODULE_SCOPE int Ttk_InvokeEnsemble( /* Run an ensemble command */
+ const Ttk_Ensemble *commands, int cmdIndex,
+ void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
+
+MODULE_SCOPE int TtkEnumerateHashTable(Tcl_Interp *, Tcl_HashTable *);
+
+/*------------------------------------------------------------------------
+ * +++ Stub table declarations.
+ */
+
+#include "ttkDecls.h"
+
+/*
+ * Drawing utilities for theme code:
+ * (@@@ find a better home for this)
+ */
+typedef enum { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT } ArrowDirection;
+MODULE_SCOPE void TtkArrowSize(int h, ArrowDirection, int *widthPtr, int *heightPtr);
+MODULE_SCOPE void TtkDrawArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection);
+MODULE_SCOPE void TtkFillArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TTKTHEME */
diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h
new file mode 100644
index 0000000..3aaada8
--- /dev/null
+++ b/generic/ttk/ttkThemeInt.h
@@ -0,0 +1,42 @@
+/*
+ * Theme engine: private definitions.
+ *
+ * Copyright (c) 2004 Joe English. Freely redistributable.
+ */
+
+#ifndef _TTKTHEMEINT
+#define _TTKTHEMEINT
+
+#include "ttkTheme.h"
+
+typedef struct Ttk_TemplateNode_ Ttk_TemplateNode, *Ttk_LayoutTemplate;
+
+MODULE_SCOPE Ttk_ElementClass *Ttk_GetElement(Ttk_Theme, const char *name);
+MODULE_SCOPE const char *Ttk_ElementClassName(Ttk_ElementClass *);
+
+MODULE_SCOPE void Ttk_ElementSize(
+ Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable,
+ Tk_Window tkwin, Ttk_State state,
+ int *widthPtr, int *heightPtr, Ttk_Padding*);
+MODULE_SCOPE void Ttk_DrawElement(
+ Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable,
+ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state);
+
+MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle(
+ Ttk_Style, void *, Tk_OptionTable, const char *, Ttk_State state);
+
+MODULE_SCOPE Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(
+ Tcl_Interp *, Tcl_Obj *);
+MODULE_SCOPE Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_LayoutTemplate);
+MODULE_SCOPE Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec);
+MODULE_SCOPE void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate);
+MODULE_SCOPE void Ttk_RegisterLayoutTemplate(
+ Ttk_Theme theme, const char *layoutName, Ttk_LayoutTemplate);
+
+MODULE_SCOPE Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName);
+MODULE_SCOPE Ttk_LayoutTemplate Ttk_FindLayoutTemplate(
+ Ttk_Theme themePtr, const char *layoutName);
+
+MODULE_SCOPE const char *Ttk_StyleName(Ttk_Style);
+
+#endif /* _TTKTHEMEINT */
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
new file mode 100644
index 0000000..8bc8519
--- /dev/null
+++ b/generic/ttk/ttkTrace.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2003, Joe English
+ *
+ * Simplified interface to Tcl_TraceVariable.
+ *
+ * PROBLEM: Can't distinguish "variable does not exist" (which is OK)
+ * from other errors (which are not).
+ */
+
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+struct TtkTraceHandle_
+{
+ Tcl_Interp *interp; /* Containing interpreter */
+ Tcl_Obj *varnameObj; /* Name of variable being traced */
+ Ttk_TraceProc callback; /* Callback procedure */
+ void *clientData; /* Data to pass to callback */
+};
+
+/*
+ * Tcl_VarTraceProc for trace handles.
+ */
+static char *
+VarTraceProc(
+ ClientData clientData, /* Widget record pointer */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ const char *name1, /* (unused) */
+ const char *name2, /* (unused) */
+ int flags) /* Information about what happened. */
+{
+ Ttk_TraceHandle *tracePtr = clientData;
+ const char *name, *value;
+ Tcl_Obj *valuePtr;
+
+ if (flags & TCL_INTERP_DESTROYED) {
+ return NULL;
+ }
+
+ name = Tcl_GetString(tracePtr->varnameObj);
+
+ /*
+ * If the variable is being unset, then re-establish the trace:
+ */
+ if (flags & TCL_TRACE_DESTROYED) {
+ /*
+ * If a prior call to Ttk_UntraceVariable() left behind an
+ * indicator that we wanted this handler to be deleted (see below),
+ * cleanup the ClientData bits and exit.
+ */
+ if (tracePtr->interp == NULL) {
+ Tcl_DecrRefCount(tracePtr->varnameObj);
+ ckfree((ClientData)tracePtr);
+ return NULL;
+ }
+ Tcl_TraceVar(interp, name,
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ VarTraceProc, clientData);
+ tracePtr->callback(tracePtr->clientData, NULL);
+ return NULL;
+ }
+
+ /*
+ * Call the callback:
+ */
+ valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY);
+ value = valuePtr ? Tcl_GetString(valuePtr) : NULL;
+ tracePtr->callback(tracePtr->clientData, value);
+
+ return NULL;
+}
+
+/* Ttk_TraceVariable(interp, varNameObj, callback, clientdata) --
+ * Attach a write trace to the specified variable,
+ * which will pass the variable's value to 'callback'
+ * whenever the variable is set.
+ *
+ * When the variable is unset, passes NULL to the callback
+ * and reattaches the trace.
+ */
+Ttk_TraceHandle *Ttk_TraceVariable(
+ Tcl_Interp *interp,
+ Tcl_Obj *varnameObj,
+ Ttk_TraceProc callback,
+ void *clientData)
+{
+ Ttk_TraceHandle *h = (Ttk_TraceHandle*)ckalloc(sizeof(*h));
+ int status;
+
+ h->interp = interp;
+ h->varnameObj = Tcl_DuplicateObj(varnameObj);
+ Tcl_IncrRefCount(h->varnameObj);
+ h->clientData = clientData;
+ h->callback = callback;
+
+ status = Tcl_TraceVar(interp, Tcl_GetString(varnameObj),
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ VarTraceProc, (ClientData)h);
+
+ if (status != TCL_OK) {
+ Tcl_DecrRefCount(h->varnameObj);
+ ckfree((ClientData)h);
+ return NULL;
+ }
+
+ return h;
+}
+
+/*
+ * Ttk_UntraceVariable --
+ * Remove previously-registered trace and free the handle.
+ */
+void Ttk_UntraceVariable(Ttk_TraceHandle *h)
+{
+ if (h) {
+ ClientData cd = NULL;
+
+ /*
+ * Workaround for Tcl Bug 3062331. The trace design problem is
+ * that when variable unset traces fire, Tcl documents that the
+ * traced variable has already been unset. It's already gone.
+ * So from within an unset trace, if you try to call
+ * Tcl_UntraceVar() on that variable, it will do nothing, because
+ * the variable by that name can no longer be found. It's gone.
+ * This means callers of Tcl_UntraceVar() that might be running
+ * in response to an unset trace have to handle the possibility
+ * that their Tcl_UntraceVar() call will do nothing. In this case,
+ * we have to support the possibility that Tcl_UntraceVar() will
+ * leave the trace in place, so we need to leave the ClientData
+ * untouched so when that trace does fire it will not crash.
+ */
+
+ /*
+ * Search the traces on the variable to see if the one we are tasked
+ * with removing is present.
+ */
+ while ((cd = Tcl_VarTraceInfo(h->interp, Tcl_GetString(h->varnameObj),
+ TCL_GLOBAL_ONLY, VarTraceProc, cd)) != NULL) {
+ if (cd == (ClientData) h) {
+ break;
+ }
+ }
+ /*
+ * If the trace we wish to delete is not visible, Tcl_UntraceVar
+ * will do nothing, so don't try to call it. Instead set an
+ * indicator in the Ttk_TraceHandle that we need to cleanup later.
+ */
+ if (cd == NULL) {
+ h->interp = NULL;
+ return;
+ }
+ Tcl_UntraceVar(h->interp, Tcl_GetString(h->varnameObj),
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ VarTraceProc, (ClientData)h);
+ Tcl_DecrRefCount(h->varnameObj);
+ ckfree((ClientData)h);
+ }
+}
+
+/*
+ * Ttk_FireTrace --
+ * Executes a trace handle as if the variable has been written.
+ *
+ * Note: may reenter the interpreter.
+ */
+int Ttk_FireTrace(Ttk_TraceHandle *tracePtr)
+{
+ Tcl_Interp *interp = tracePtr->interp;
+ void *clientData = tracePtr->clientData;
+ const char *name = Tcl_GetString(tracePtr->varnameObj);
+ Ttk_TraceProc callback = tracePtr->callback;
+ Tcl_Obj *valuePtr;
+ const char *value;
+
+ /* Read the variable.
+ * Note that this can reenter the interpreter, and anything can happen --
+ * including the current trace handle being freed!
+ */
+ valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY);
+ value = valuePtr ? Tcl_GetString(valuePtr) : NULL;
+
+ /* Call callback.
+ */
+ callback(clientData, value);
+
+ return TCL_OK;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c
new file mode 100644
index 0000000..9cf8267
--- /dev/null
+++ b/generic/ttk/ttkTrack.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2004, Joe English
+ *
+ * TtkTrackElementState() -- helper routine for widgets
+ * like scrollbars in which individual elements may
+ * be active or pressed instead of the widget as a whole.
+ *
+ * Usage:
+ * TtkTrackElementState(&recordPtr->core);
+ *
+ * Registers an event handler on the widget that tracks pointer
+ * events and updates the state of the element under the
+ * mouse cursor.
+ *
+ * The "active" element is the one under the mouse cursor,
+ * and is normally set to the ACTIVE state unless another element
+ * is currently being pressed.
+ *
+ * The active element becomes "pressed" on <ButtonPress> events,
+ * and remains "active" and "pressed" until the corresponding
+ * <ButtonRelease> event.
+ *
+ * TODO: Handle "chords" properly (e.g., <B1-ButtonPress-2>)
+ */
+
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+typedef struct {
+ WidgetCore *corePtr; /* widget to track */
+ Ttk_Layout tracking; /* current layout being tracked */
+ Ttk_Element activeElement; /* element under the mouse cursor */
+ Ttk_Element pressedElement; /* currently pressed element */
+} ElementStateTracker;
+
+/*
+ * ActivateElement(es, node) --
+ * Make 'node' the active element if non-NULL.
+ * Deactivates the currently active element if different.
+ *
+ * The active element has TTK_STATE_ACTIVE set _unless_
+ * another element is 'pressed'
+ */
+static void ActivateElement(ElementStateTracker *es, Ttk_Element element)
+{
+ if (es->activeElement == element) {
+ /* No change */
+ return;
+ }
+
+ if (!es->pressedElement) {
+ if (es->activeElement) {
+ /* Deactivate old element */
+ Ttk_ChangeElementState(es->activeElement, 0,TTK_STATE_ACTIVE);
+ }
+ if (element) {
+ /* Activate new element */
+ Ttk_ChangeElementState(element, TTK_STATE_ACTIVE,0);
+ }
+ TtkRedisplayWidget(es->corePtr);
+ }
+
+ es->activeElement = element;
+}
+
+/* ReleaseElement --
+ * Releases the currently pressed element, if any.
+ */
+static void ReleaseElement(ElementStateTracker *es)
+{
+ if (!es->pressedElement)
+ return;
+
+ Ttk_ChangeElementState(
+ es->pressedElement, 0,TTK_STATE_PRESSED|TTK_STATE_ACTIVE);
+ es->pressedElement = 0;
+
+ /* Reactivate element under the mouse cursor:
+ */
+ if (es->activeElement)
+ Ttk_ChangeElementState(es->activeElement, TTK_STATE_ACTIVE,0);
+
+ TtkRedisplayWidget(es->corePtr);
+}
+
+/* PressElement --
+ * Presses the specified element.
+ */
+static void PressElement(ElementStateTracker *es, Ttk_Element element)
+{
+ if (es->pressedElement) {
+ ReleaseElement(es);
+ }
+
+ if (element) {
+ Ttk_ChangeElementState(
+ element, TTK_STATE_PRESSED|TTK_STATE_ACTIVE, 0);
+ }
+
+ es->pressedElement = element;
+ TtkRedisplayWidget(es->corePtr);
+}
+
+/* ElementStateEventProc --
+ * Event handler for tracking element states.
+ */
+
+static const unsigned ElementStateMask =
+ ButtonPressMask
+ | ButtonReleaseMask
+ | PointerMotionMask
+ | LeaveWindowMask
+ | EnterWindowMask
+ | StructureNotifyMask
+ ;
+
+static void
+ElementStateEventProc(ClientData clientData, XEvent *ev)
+{
+ ElementStateTracker *es = clientData;
+ Ttk_Layout layout = es->corePtr->layout;
+ Ttk_Element element;
+
+ /* Guard against dangling pointers [#2431428]
+ */
+ if (es->tracking != layout) {
+ es->pressedElement = es->activeElement = 0;
+ es->tracking = layout;
+ }
+
+ switch (ev->type)
+ {
+ case MotionNotify :
+ element = Ttk_IdentifyElement(
+ layout, ev->xmotion.x, ev->xmotion.y);
+ ActivateElement(es, element);
+ break;
+ case LeaveNotify:
+ ActivateElement(es, 0);
+ if (ev->xcrossing.mode == NotifyGrab)
+ PressElement(es, 0);
+ break;
+ case EnterNotify:
+ element = Ttk_IdentifyElement(
+ layout, ev->xcrossing.x, ev->xcrossing.y);
+ ActivateElement(es, element);
+ break;
+ case ButtonPress:
+ element = Ttk_IdentifyElement(
+ layout, ev->xbutton.x, ev->xbutton.y);
+ if (element)
+ PressElement(es, element);
+ break;
+ case ButtonRelease:
+ ReleaseElement(es);
+ break;
+ case DestroyNotify:
+ /* Unregister this event handler and free client data.
+ */
+ Tk_DeleteEventHandler(es->corePtr->tkwin,
+ ElementStateMask, ElementStateEventProc, es);
+ ckfree(clientData);
+ break;
+ }
+}
+
+/*
+ * TtkTrackElementState --
+ * Register an event handler to manage the 'pressed'
+ * and 'active' states of individual widget elements.
+ */
+
+void TtkTrackElementState(WidgetCore *corePtr)
+{
+ ElementStateTracker *es = (ElementStateTracker*)ckalloc(sizeof(*es));
+ es->corePtr = corePtr;
+ es->tracking = 0;
+ es->activeElement = es->pressedElement = 0;
+ Tk_CreateEventHandler(corePtr->tkwin,
+ ElementStateMask,ElementStateEventProc,es);
+}
+
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
new file mode 100644
index 0000000..222b280
--- /dev/null
+++ b/generic/ttk/ttkTreeview.c
@@ -0,0 +1,3442 @@
+/*
+ * Copyright (c) 2004, Joe English
+ *
+ * ttk::treeview widget implementation.
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+#define DEF_TREE_ROWS "10"
+#define DEF_COLWIDTH "200"
+#define DEF_MINWIDTH "20"
+
+static const int DEFAULT_ROWHEIGHT = 20;
+static const int DEFAULT_INDENT = 20;
+static const int HALO = 4; /* separator */
+
+#define TTK_STATE_OPEN TTK_STATE_USER1
+#define TTK_STATE_LEAF TTK_STATE_USER2
+
+#define STATE_CHANGED (0x100) /* item state option changed */
+
+/*------------------------------------------------------------------------
+ * +++ Tree items.
+ *
+ * INVARIANTS:
+ * item->children ==> item->children->parent == item
+ * item->next ==> item->next->parent == item->parent
+ * item->next ==> item->next->prev == item
+ * item->prev ==> item->prev->next == item
+ */
+
+typedef struct TreeItemRec TreeItem;
+struct TreeItemRec {
+ Tcl_HashEntry *entryPtr; /* Back-pointer to hash table entry */
+ TreeItem *parent; /* Parent item */
+ TreeItem *children; /* Linked list of child items */
+ TreeItem *next; /* Next sibling */
+ TreeItem *prev; /* Previous sibling */
+
+ /*
+ * Options and instance data:
+ */
+ Ttk_State state;
+ Tcl_Obj *textObj;
+ Tcl_Obj *imageObj;
+ Tcl_Obj *valuesObj;
+ Tcl_Obj *openObj;
+ Tcl_Obj *tagsObj;
+
+ /*
+ * Derived resources:
+ */
+ Ttk_TagSet tagset;
+ Ttk_ImageSpec *imagespec;
+};
+
+#define ITEM_OPTION_TAGS_CHANGED 0x100
+#define ITEM_OPTION_IMAGE_CHANGED 0x200
+
+static Tk_OptionSpec ItemOptionSpecs[] = {
+ {TK_OPTION_STRING, "-text", "text", "Text",
+ "", Tk_Offset(TreeItem,textObj), -1,
+ 0,0,0 },
+ {TK_OPTION_STRING, "-image", "image", "Image",
+ NULL, Tk_Offset(TreeItem,imageObj), -1,
+ TK_OPTION_NULL_OK,0,ITEM_OPTION_IMAGE_CHANGED },
+ {TK_OPTION_STRING, "-values", "values", "Values",
+ NULL, Tk_Offset(TreeItem,valuesObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_BOOLEAN, "-open", "open", "Open",
+ "0", Tk_Offset(TreeItem,openObj), -1,
+ 0,0,0 },
+ {TK_OPTION_STRING, "-tags", "tags", "Tags",
+ NULL, Tk_Offset(TreeItem,tagsObj), -1,
+ TK_OPTION_NULL_OK,0,ITEM_OPTION_TAGS_CHANGED },
+
+ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+};
+
+/* + NewItem --
+ * Allocate a new, uninitialized, unlinked item
+ */
+static TreeItem *NewItem(void)
+{
+ TreeItem *item = (TreeItem*)ckalloc(sizeof(*item));
+
+ item->entryPtr = 0;
+ item->parent = item->children = item->next = item->prev = NULL;
+
+ item->state = 0ul;
+ item->textObj = NULL;
+ item->imageObj = NULL;
+ item->valuesObj = NULL;
+ item->openObj = NULL;
+ item->tagsObj = NULL;
+
+ item->tagset = NULL;
+ item->imagespec = NULL;
+
+ return item;
+}
+
+/* + FreeItem --
+ * Destroy an item
+ */
+static void FreeItem(TreeItem *item)
+{
+ if (item->textObj) { Tcl_DecrRefCount(item->textObj); }
+ if (item->imageObj) { Tcl_DecrRefCount(item->imageObj); }
+ if (item->valuesObj) { Tcl_DecrRefCount(item->valuesObj); }
+ if (item->openObj) { Tcl_DecrRefCount(item->openObj); }
+ if (item->tagsObj) { Tcl_DecrRefCount(item->tagsObj); }
+
+ if (item->tagset) { Ttk_FreeTagSet(item->tagset); }
+ if (item->imagespec) { TtkFreeImageSpec(item->imagespec); }
+
+ ckfree((ClientData)item);
+}
+
+static void FreeItemCB(void *clientData) { FreeItem(clientData); }
+
+/* + DetachItem --
+ * Unlink an item from the tree.
+ */
+static void DetachItem(TreeItem *item)
+{
+ if (item->parent && item->parent->children == item)
+ item->parent->children = item->next;
+ if (item->prev)
+ item->prev->next = item->next;
+ if (item->next)
+ item->next->prev = item->prev;
+ item->next = item->prev = item->parent = NULL;
+}
+
+/* + InsertItem --
+ * Insert an item into the tree after the specified item.
+ *
+ * Preconditions:
+ * + item is currently detached
+ * + prev != NULL ==> prev->parent == parent.
+ */
+static void InsertItem(TreeItem *parent, TreeItem *prev, TreeItem *item)
+{
+ item->parent = parent;
+ item->prev = prev;
+ if (prev) {
+ item->next = prev->next;
+ prev->next = item;
+ } else {
+ item->next = parent->children;
+ parent->children = item;
+ }
+ if (item->next) {
+ item->next->prev = item;
+ }
+}
+
+/* + NextPreorder --
+ * Return the next item in preorder traversal order.
+ */
+
+static TreeItem *NextPreorder(TreeItem *item)
+{
+ if (item->children)
+ return item->children;
+ while (!item->next) {
+ item = item->parent;
+ if (!item)
+ return 0;
+ }
+ return item->next;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Display items and tag options.
+ */
+
+typedef struct {
+ Tcl_Obj *textObj; /* taken from item / data cell */
+ Tcl_Obj *imageObj; /* taken from item */
+ Tcl_Obj *anchorObj; /* from column <<NOTE-ANCHOR>> */
+ Tcl_Obj *backgroundObj; /* remainder from tag */
+ Tcl_Obj *foregroundObj;
+ Tcl_Obj *fontObj;
+} DisplayItem;
+
+static Tk_OptionSpec TagOptionSpecs[] = {
+ {TK_OPTION_STRING, "-text", "text", "Text",
+ NULL, Tk_Offset(DisplayItem,textObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_STRING, "-image", "image", "Image",
+ NULL, Tk_Offset(DisplayItem,imageObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
+ NULL, Tk_Offset(DisplayItem,anchorObj), -1,
+ TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, /* <<NOTE-ANCHOR>> */
+ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor",
+ NULL, Tk_Offset(DisplayItem,backgroundObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
+ NULL, Tk_Offset(DisplayItem,foregroundObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_FONT, "-font", "font", "Font",
+ NULL, Tk_Offset(DisplayItem,fontObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+
+ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+};
+
+/*------------------------------------------------------------------------
+ * +++ Columns.
+ *
+ * There are separate option tables associated with the column record:
+ * ColumnOptionSpecs is for configuring the column,
+ * and HeadingOptionSpecs is for drawing headings.
+ */
+typedef struct {
+ int width; /* Column width, in pixels */
+ int minWidth; /* Minimum column width, in pixels */
+ int stretch; /* Should column stretch while resizing? */
+ Tcl_Obj *idObj; /* Column identifier, from -columns option */
+
+ Tcl_Obj *anchorObj; /* -anchor for cell data <<NOTE-ANCHOR>> */
+
+ /* Column heading data:
+ */
+ Tcl_Obj *headingObj; /* Heading label */
+ Tcl_Obj *headingImageObj; /* Heading image */
+ Tcl_Obj *headingAnchorObj; /* -anchor for heading label */
+ Tcl_Obj *headingCommandObj; /* Command to execute */
+ Tcl_Obj *headingStateObj; /* @@@ testing ... */
+ Ttk_State headingState; /* ... */
+
+ /* Temporary storage for cell data
+ */
+ Tcl_Obj *data;
+} TreeColumn;
+
+static void InitColumn(TreeColumn *column)
+{
+ column->width = 200;
+ column->minWidth = 20;
+ column->stretch = 1;
+ column->idObj = 0;
+ column->anchorObj = 0;
+
+ column->headingState = 0;
+ column->headingObj = 0;
+ column->headingImageObj = 0;
+ column->headingAnchorObj = 0;
+ column->headingStateObj = 0;
+ column->headingCommandObj = 0;
+
+ column->data = 0;
+}
+
+static void FreeColumn(TreeColumn *column)
+{
+ if (column->idObj) { Tcl_DecrRefCount(column->idObj); }
+ if (column->anchorObj) { Tcl_DecrRefCount(column->anchorObj); }
+
+ if (column->headingObj) { Tcl_DecrRefCount(column->headingObj); }
+ if (column->headingImageObj) { Tcl_DecrRefCount(column->headingImageObj); }
+ if (column->headingAnchorObj) { Tcl_DecrRefCount(column->headingAnchorObj); }
+ if (column->headingStateObj) { Tcl_DecrRefCount(column->headingStateObj); }
+ if (column->headingCommandObj) { Tcl_DecrRefCount(column->headingCommandObj); }
+
+ /* Don't touch column->data, it's scratch storage */
+}
+
+static Tk_OptionSpec ColumnOptionSpecs[] = {
+ {TK_OPTION_INT, "-width", "width", "Width",
+ DEF_COLWIDTH, -1, Tk_Offset(TreeColumn,width),
+ 0,0,GEOMETRY_CHANGED },
+ {TK_OPTION_INT, "-minwidth", "minWidth", "MinWidth",
+ DEF_MINWIDTH, -1, Tk_Offset(TreeColumn,minWidth),
+ 0,0,0 },
+ {TK_OPTION_BOOLEAN, "-stretch", "stretch", "Stretch",
+ "1", -1, Tk_Offset(TreeColumn,stretch),
+ 0,0,0 },
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
+ "w", Tk_Offset(TreeColumn,anchorObj), -1, /* <<NOTE-ANCHOR>> */
+ 0,0,0 },
+ {TK_OPTION_STRING, "-id", "id", "ID",
+ NULL, Tk_Offset(TreeColumn,idObj), -1,
+ TK_OPTION_NULL_OK,0,READONLY_OPTION },
+ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+};
+
+static Tk_OptionSpec HeadingOptionSpecs[] = {
+ {TK_OPTION_STRING, "-text", "text", "Text",
+ "", Tk_Offset(TreeColumn,headingObj), -1,
+ 0,0,0 },
+ {TK_OPTION_STRING, "-image", "image", "Image",
+ "", Tk_Offset(TreeColumn,headingImageObj), -1,
+ 0,0,0 },
+ {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
+ "center", Tk_Offset(TreeColumn,headingAnchorObj), -1,
+ 0,0,0 },
+ {TK_OPTION_STRING, "-command", "", "",
+ "", Tk_Offset(TreeColumn,headingCommandObj), -1,
+ TK_OPTION_NULL_OK,0,0 },
+ {TK_OPTION_STRING, "state", "", "",
+ "", Tk_Offset(TreeColumn,headingStateObj), -1,
+ 0,0,STATE_CHANGED },
+ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0}
+};
+
+/*------------------------------------------------------------------------
+ * +++ -show option:
+ * TODO: Implement SHOW_BRANCHES.
+ */
+
+#define SHOW_TREE (0x1) /* Show tree column? */
+#define SHOW_HEADINGS (0x2) /* Show heading row? */
+
+#define DEFAULT_SHOW "tree headings"
+
+static const char *showStrings[] = {
+ "tree", "headings", NULL
+};
+
+static int GetEnumSetFromObj(
+ Tcl_Interp *interp,
+ Tcl_Obj *objPtr,
+ const char *table[],
+ unsigned *resultPtr)
+{
+ unsigned result = 0;
+ int i, objc;
+ Tcl_Obj **objv;
+
+ if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK)
+ return TCL_ERROR;
+
+ for (i = 0; i < objc; ++i) {
+ int index;
+ if (TCL_OK != Tcl_GetIndexFromObj(
+ interp, objv[i], table, "value", TCL_EXACT, &index))
+ {
+ return TCL_ERROR;
+ }
+ result |= (1 << index);
+ }
+
+ *resultPtr = result;
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Treeview widget record.
+ *
+ * Dependencies:
+ * columns, columnNames: -columns
+ * displayColumns: -columns, -displaycolumns
+ * headingHeight: [layout]
+ * rowHeight, indent: style
+ */
+typedef struct {
+ /* Resources acquired at initialization-time:
+ */
+ Tk_OptionTable itemOptionTable;
+ Tk_OptionTable columnOptionTable;
+ Tk_OptionTable headingOptionTable;
+ Tk_OptionTable tagOptionTable;
+ Tk_BindingTable bindingTable;
+ Ttk_TagTable tagTable;
+
+ /* Acquired in GetLayout hook:
+ */
+ Ttk_Layout itemLayout;
+ Ttk_Layout cellLayout;
+ Ttk_Layout headingLayout;
+ Ttk_Layout rowLayout;
+
+ int headingHeight; /* Space for headings */
+ int rowHeight; /* Height of each item */
+ int indent; /* #pixels horizontal offset for child items */
+
+ /* Tree data:
+ */
+ Tcl_HashTable items; /* Map: item name -> item */
+ int serial; /* Next item # for autogenerated names */
+ TreeItem *root; /* Root item */
+
+ TreeColumn column0; /* Column options for display column #0 */
+ TreeColumn *columns; /* Array of column options for data columns */
+
+ TreeItem *focus; /* Current focus item */
+ TreeItem *endPtr; /* See EndPosition() */
+
+ /* Widget options:
+ */
+ Tcl_Obj *columnsObj; /* List of symbolic column names */
+ Tcl_Obj *displayColumnsObj; /* List of columns to display */
+
+ Tcl_Obj *heightObj; /* height (rows) */
+ Tcl_Obj *paddingObj; /* internal padding */
+
+ Tcl_Obj *showObj; /* -show list */
+ Tcl_Obj *selectModeObj; /* -selectmode option */
+
+ Scrollable xscroll;
+ ScrollHandle xscrollHandle;
+ Scrollable yscroll;
+ ScrollHandle yscrollHandle;
+
+ /* Derived resources:
+ */
+ Tcl_HashTable columnNames; /* Map: column name -> column table entry */
+ int nColumns; /* #columns */
+ unsigned showFlags; /* bitmask of subparts to display */
+
+ TreeColumn **displayColumns; /* List of columns for display (incl tree) */
+ int nDisplayColumns; /* #display columns */
+ Ttk_Box headingArea; /* Display area for column headings */
+ Ttk_Box treeArea; /* Display area for tree */
+ int slack; /* Slack space (see Resizing section) */
+
+} TreePart;
+
+typedef struct {
+ WidgetCore core;
+ TreePart tree;
+} Treeview;
+
+#define USER_MASK 0x0100
+#define COLUMNS_CHANGED (USER_MASK)
+#define DCOLUMNS_CHANGED (USER_MASK<<1)
+#define SCROLLCMD_CHANGED (USER_MASK<<2)
+#define SHOW_CHANGED (USER_MASK<<3)
+
+static const char *SelectModeStrings[] = { "none", "browse", "extended", NULL };
+
+static Tk_OptionSpec TreeviewOptionSpecs[] = {
+ {TK_OPTION_STRING, "-columns", "columns", "Columns",
+ "", Tk_Offset(Treeview,tree.columnsObj), -1,
+ 0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
+ {TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns",
+ "#all", Tk_Offset(Treeview,tree.displayColumnsObj), -1,
+ 0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
+ {TK_OPTION_STRING, "-show", "show", "Show",
+ DEFAULT_SHOW, Tk_Offset(Treeview,tree.showObj), -1,
+ 0,0,SHOW_CHANGED | GEOMETRY_CHANGED },
+
+ {TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode",
+ "extended", Tk_Offset(Treeview,tree.selectModeObj), -1,
+ 0,(ClientData)SelectModeStrings,0 },
+
+ {TK_OPTION_PIXELS, "-height", "height", "Height",
+ DEF_TREE_ROWS, Tk_Offset(Treeview,tree.heightObj), -1,
+ 0,0,GEOMETRY_CHANGED},
+ {TK_OPTION_STRING, "-padding", "padding", "Pad",
+ NULL, Tk_Offset(Treeview,tree.paddingObj), -1,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+
+ {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
+ NULL, -1, Tk_Offset(Treeview, tree.xscroll.scrollCmd),
+ TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED},
+ {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand",
+ NULL, -1, Tk_Offset(Treeview, tree.yscroll.scrollCmd),
+ TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED},
+
+ WIDGET_TAKEFOCUS_TRUE,
+ WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
+};
+
+/*------------------------------------------------------------------------
+ * +++ Utilities.
+ */
+typedef void (*HashEntryIterator)(void *hashValue);
+
+static void foreachHashEntry(Tcl_HashTable *ht, HashEntryIterator func)
+{
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search);
+ while (entryPtr != NULL) {
+ func(Tcl_GetHashValue(entryPtr));
+ entryPtr = Tcl_NextHashEntry(&search);
+ }
+}
+
+/* + unshare(objPtr) --
+ * Ensure that a Tcl_Obj * has refcount 1 -- either return objPtr
+ * itself, or a duplicated copy.
+ */
+static Tcl_Obj *unshare(Tcl_Obj *objPtr)
+{
+ if (Tcl_IsShared(objPtr)) {
+ Tcl_Obj *newObj = Tcl_DuplicateObj(objPtr);
+ Tcl_DecrRefCount(objPtr);
+ Tcl_IncrRefCount(newObj);
+ return newObj;
+ }
+ return objPtr;
+}
+
+/* DisplayLayout --
+ * Rebind, place, and draw a layout + object combination.
+ */
+static void DisplayLayout(
+ Ttk_Layout layout, void *recordPtr, Ttk_State state, Ttk_Box b, Drawable d)
+{
+ Ttk_RebindSublayout(layout, recordPtr);
+ Ttk_PlaceLayout(layout, state, b);
+ Ttk_DrawLayout(layout, state, d);
+}
+
+/* + GetColumn --
+ * Look up column by name or number.
+ * Returns: pointer to column table entry, NULL if not found.
+ * Leaves an error message in interp->result on error.
+ */
+static TreeColumn *GetColumn(
+ Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj)
+{
+ Tcl_HashEntry *entryPtr;
+ int columnIndex;
+
+ /* Check for named column:
+ */
+ entryPtr = Tcl_FindHashEntry(
+ &tv->tree.columnNames, Tcl_GetString(columnIDObj));
+ if (entryPtr) {
+ return Tcl_GetHashValue(entryPtr);
+ }
+
+ /* Check for number:
+ */
+ if (Tcl_GetIntFromObj(NULL, columnIDObj, &columnIndex) == TCL_OK) {
+ if (columnIndex < 0 || columnIndex >= tv->tree.nColumns) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Column index ",
+ Tcl_GetString(columnIDObj),
+ " out of bounds",
+ NULL);
+ return NULL;
+ }
+
+ return tv->tree.columns + columnIndex;
+ }
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Invalid column index ", Tcl_GetString(columnIDObj),
+ NULL);
+ return NULL;
+}
+
+/* + FindColumn --
+ * Look up column by name, number, or display index.
+ */
+static TreeColumn *FindColumn(
+ Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj)
+{
+ int colno;
+
+ if (sscanf(Tcl_GetString(columnIDObj), "#%d", &colno) == 1)
+ { /* Display column specification, #n */
+ if (colno >= 0 && colno < tv->tree.nDisplayColumns) {
+ return tv->tree.displayColumns[colno];
+ }
+ /* else */
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Column ", Tcl_GetString(columnIDObj), " out of range",
+ NULL);
+ return NULL;
+ }
+
+ return GetColumn(interp, tv, columnIDObj);
+}
+
+/* + FindItem --
+ * Locates the item with the specified identifier in the tree.
+ * If there is no such item, leaves an error message in interp.
+ */
+static TreeItem *FindItem(
+ Tcl_Interp *interp, Treeview *tv, Tcl_Obj *itemNameObj)
+{
+ const char *itemName = Tcl_GetString(itemNameObj);
+ Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&tv->tree.items, itemName);
+
+ if (!entryPtr) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Item ", itemName, " not found", NULL);
+ return 0;
+ }
+ return Tcl_GetHashValue(entryPtr);
+}
+
+/* + GetItemListFromObj --
+ * Parse a Tcl_Obj * as a list of items.
+ * Returns a NULL-terminated array of items; result must
+ * be ckfree()d. On error, returns NULL and leaves an error
+ * message in interp.
+ */
+
+static TreeItem **GetItemListFromObj(
+ Tcl_Interp *interp, Treeview *tv, Tcl_Obj *objPtr)
+{
+ TreeItem **items;
+ Tcl_Obj **elements;
+ int i, nElements;
+
+ if (Tcl_ListObjGetElements(interp,objPtr,&nElements,&elements) != TCL_OK) {
+ return NULL;
+ }
+
+ items = (TreeItem**)ckalloc((nElements + 1)*sizeof(TreeItem*));
+ for (i = 0; i < nElements; ++i) {
+ items[i] = FindItem(interp, tv, elements[i]);
+ if (!items[i]) {
+ ckfree((ClientData)items);
+ return NULL;
+ }
+ }
+ items[i] = NULL;
+ return items;
+}
+
+/* + ItemName --
+ * Returns the item's ID.
+ */
+static const char *ItemName(Treeview *tv, TreeItem *item)
+{
+ return Tcl_GetHashKey(&tv->tree.items, item->entryPtr);
+}
+
+/* + ItemID --
+ * Returns a fresh Tcl_Obj * (refcount 0) holding the
+ * item identifier of the specified item.
+ */
+static Tcl_Obj *ItemID(Treeview *tv, TreeItem *item)
+{
+ return Tcl_NewStringObj(ItemName(tv, item), -1);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Column configuration.
+ */
+
+/* + TreeviewFreeColumns --
+ * Free column data.
+ */
+static void TreeviewFreeColumns(Treeview *tv)
+{
+ int i;
+
+ Tcl_DeleteHashTable(&tv->tree.columnNames);
+ Tcl_InitHashTable(&tv->tree.columnNames, TCL_STRING_KEYS);
+
+ if (tv->tree.columns) {
+ for (i = 0; i < tv->tree.nColumns; ++i)
+ FreeColumn(tv->tree.columns + i);
+ ckfree((ClientData)tv->tree.columns);
+ tv->tree.columns = 0;
+ }
+}
+
+/* + TreeviewInitColumns --
+ * Initialize column data when -columns changes.
+ * Returns: TCL_OK or TCL_ERROR;
+ */
+static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv)
+{
+ Tcl_Obj **columns;
+ int i, ncols;
+
+ if (Tcl_ListObjGetElements(
+ interp, tv->tree.columnsObj, &ncols, &columns) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Free old values:
+ */
+ TreeviewFreeColumns(tv);
+
+ /*
+ * Initialize columns array and columnNames hash table:
+ */
+ tv->tree.nColumns = ncols;
+ tv->tree.columns =
+ (TreeColumn*)ckalloc(tv->tree.nColumns * sizeof(TreeColumn));
+
+ for (i = 0; i < ncols; ++i) {
+ int isNew;
+ Tcl_Obj *columnName = Tcl_DuplicateObj(columns[i]);
+
+ Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(
+ &tv->tree.columnNames, Tcl_GetString(columnName), &isNew);
+ Tcl_SetHashValue(entryPtr, tv->tree.columns + i);
+
+ InitColumn(tv->tree.columns + i);
+ Tk_InitOptions(
+ interp, (ClientData)(tv->tree.columns + i),
+ tv->tree.columnOptionTable, tv->core.tkwin);
+ Tk_InitOptions(
+ interp, (ClientData)(tv->tree.columns + i),
+ tv->tree.headingOptionTable, tv->core.tkwin);
+ Tcl_IncrRefCount(columnName);
+ tv->tree.columns[i].idObj = columnName;
+ }
+
+ return TCL_OK;
+}
+
+/* + TreeviewInitDisplayColumns --
+ * Initializes the 'displayColumns' array.
+ *
+ * Note that displayColumns[0] is always the tree column,
+ * even when SHOW_TREE is not set.
+ *
+ * @@@ TODO: disallow duplicated columns
+ */
+static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv)
+{
+ Tcl_Obj **dcolumns;
+ int index, ndcols;
+ TreeColumn **displayColumns = 0;
+
+ if (Tcl_ListObjGetElements(interp,
+ tv->tree.displayColumnsObj, &ndcols, &dcolumns) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) {
+ ndcols = tv->tree.nColumns;
+ displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*));
+ for (index = 0; index < ndcols; ++index) {
+ displayColumns[index+1] = tv->tree.columns + index;
+ }
+ } else {
+ displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*));
+ for (index = 0; index < ndcols; ++index) {
+ displayColumns[index+1] = GetColumn(interp, tv, dcolumns[index]);
+ if (!displayColumns[index+1]) {
+ ckfree((ClientData)displayColumns);
+ return TCL_ERROR;
+ }
+ }
+ }
+ displayColumns[0] = &tv->tree.column0;
+
+ if (tv->tree.displayColumns)
+ ckfree((ClientData)tv->tree.displayColumns);
+ tv->tree.displayColumns = displayColumns;
+ tv->tree.nDisplayColumns = ndcols + 1;
+
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Resizing.
+ * slack invariant: TreeWidth(tree) + slack = treeArea.width
+ */
+
+#define FirstColumn(tv) ((tv->tree.showFlags&SHOW_TREE) ? 0 : 1)
+
+/* + TreeWidth --
+ * Compute the requested tree width from the sum of visible column widths.
+ */
+static int TreeWidth(Treeview *tv)
+{
+ int i = FirstColumn(tv);
+ int width = 0;
+
+ while (i < tv->tree.nDisplayColumns) {
+ width += tv->tree.displayColumns[i++]->width;
+ }
+ return width;
+}
+
+/* + RecomputeSlack --
+ */
+static void RecomputeSlack(Treeview *tv)
+{
+ tv->tree.slack = tv->tree.treeArea.width - TreeWidth(tv);
+}
+
+/* + PickupSlack/DepositSlack --
+ * When resizing columns, distribute extra space to 'slack' first,
+ * and only adjust column widths if 'slack' goes to zero.
+ * That is, don't bother changing column widths if the tree
+ * is already scrolled or short.
+ */
+static int PickupSlack(Treeview *tv, int extra)
+{
+ int newSlack = tv->tree.slack + extra;
+
+ if ( (newSlack < 0 && 0 <= tv->tree.slack)
+ || (newSlack > 0 && 0 >= tv->tree.slack))
+ {
+ tv->tree.slack = 0;
+ return newSlack;
+ } else {
+ tv->tree.slack = newSlack;
+ return 0;
+ }
+}
+
+static void DepositSlack(Treeview *tv, int extra)
+{
+ tv->tree.slack += extra;
+}
+
+/* + Stretch --
+ * Adjust width of column by N pixels, down to minimum width.
+ * Returns: #pixels actually moved.
+ */
+static int Stretch(TreeColumn *c, int n)
+{
+ int newWidth = n + c->width;
+ if (newWidth < c->minWidth) {
+ n = c->minWidth - c->width;
+ c->width = c->minWidth;
+ } else {
+ c->width = newWidth;
+ }
+ return n;
+}
+
+/* + ShoveLeft --
+ * Adjust width of (stretchable) columns to the left by N pixels.
+ * Returns: leftover slack.
+ */
+static int ShoveLeft(Treeview *tv, int i, int n)
+{
+ int first = FirstColumn(tv);
+ while (n != 0 && i >= first) {
+ TreeColumn *c = tv->tree.displayColumns[i];
+ if (c->stretch) {
+ n -= Stretch(c, n);
+ }
+ --i;
+ }
+ return n;
+}
+
+/* + ShoveRight --
+ * Adjust width of (stretchable) columns to the right by N pixels.
+ * Returns: leftover slack.
+ */
+static int ShoveRight(Treeview *tv, int i, int n)
+{
+ while (n != 0 && i < tv->tree.nDisplayColumns) {
+ TreeColumn *c = tv->tree.displayColumns[i];
+ if (c->stretch) {
+ n -= Stretch(c, n);
+ }
+ ++i;
+ }
+ return n;
+}
+
+/* + DistributeWidth --
+ * Distribute n pixels evenly across all stretchable display columns.
+ * Returns: leftover slack.
+ * Notes:
+ * The "((++w % m) < r)" term is there so that the remainder r = n % m
+ * is distributed round-robin.
+ */
+static int DistributeWidth(Treeview *tv, int n)
+{
+ int w = TreeWidth(tv);
+ int m = 0;
+ int i, d, r;
+
+ for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) {
+ if (tv->tree.displayColumns[i]->stretch) {
+ ++m;
+ }
+ }
+ if (m == 0) {
+ return n;
+ }
+
+ d = n / m;
+ r = n % m;
+ if (r < 0) { r += m; --d; }
+
+ for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) {
+ TreeColumn *c = tv->tree.displayColumns[i];
+ if (c->stretch) {
+ n -= Stretch(c, d + ((++w % m) < r));
+ }
+ }
+ return n;
+}
+
+/* + ResizeColumns --
+ * Recompute column widths based on available width.
+ * Pick up slack first;
+ * Distribute the remainder evenly across stretchable columns;
+ * If any is still left over due to minwidth constraints, shove left.
+ */
+static void ResizeColumns(Treeview *tv, int newWidth)
+{
+ int delta = newWidth - (TreeWidth(tv) + tv->tree.slack);
+ DepositSlack(tv,
+ ShoveLeft(tv, tv->tree.nDisplayColumns - 1,
+ DistributeWidth(tv, PickupSlack(tv, delta))));
+}
+
+/* + DragColumn --
+ * Move the separator to the right of specified column,
+ * adjusting other column widths as necessary.
+ */
+static void DragColumn(Treeview *tv, int i, int delta)
+{
+ TreeColumn *c = tv->tree.displayColumns[i];
+ int dl = delta - ShoveLeft(tv, i-1, delta - Stretch(c, delta));
+ int dr = ShoveRight(tv, i+1, PickupSlack(tv, -dl));
+ DepositSlack(tv, dr);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Event handlers.
+ */
+
+static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/
+
+static const unsigned int TreeviewBindEventMask =
+ KeyPressMask|KeyReleaseMask
+ | ButtonPressMask|ButtonReleaseMask
+ | PointerMotionMask|ButtonMotionMask
+ | VirtualEventMask
+ ;
+
+static void TreeviewBindEventProc(void *clientData, XEvent *event)
+{
+ Treeview *tv = clientData;
+ TreeItem *item = NULL;
+ Ttk_TagSet tagset;
+
+ /*
+ * Figure out where to deliver the event.
+ */
+ switch (event->type)
+ {
+ case KeyPress:
+ case KeyRelease:
+ case VirtualEvent:
+ item = tv->tree.focus;
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ item = IdentifyItem(tv, event->xbutton.y);
+ break;
+ case MotionNotify:
+ item = IdentifyItem(tv, event->xmotion.y);
+ break;
+ default:
+ break;
+ }
+
+ if (!item) {
+ return;
+ }
+
+ /* ASSERT: Ttk_GetTagSetFromObj succeeds.
+ * NB: must use a local copy of the tagset,
+ * in case a binding script stomps on -tags.
+ */
+ tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, item->tagsObj);
+
+ /*
+ * Fire binding:
+ */
+ Tcl_Preserve(clientData);
+ Tk_BindEvent(tv->tree.bindingTable, event, tv->core.tkwin,
+ tagset->nTags, (void **)tagset->tags);
+ Tcl_Release(clientData);
+
+ Ttk_FreeTagSet(tagset);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Initialization and cleanup.
+ */
+
+static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+ Treeview *tv = recordPtr;
+ int unused;
+
+ tv->tree.itemOptionTable =
+ Tk_CreateOptionTable(interp, ItemOptionSpecs);
+ tv->tree.columnOptionTable =
+ Tk_CreateOptionTable(interp, ColumnOptionSpecs);
+ tv->tree.headingOptionTable =
+ Tk_CreateOptionTable(interp, HeadingOptionSpecs);
+ tv->tree.tagOptionTable =
+ Tk_CreateOptionTable(interp, TagOptionSpecs);
+
+ tv->tree.tagTable = Ttk_CreateTagTable(
+ interp, tv->core.tkwin, TagOptionSpecs, sizeof(DisplayItem));
+ tv->tree.bindingTable = Tk_CreateBindingTable(interp);
+ Tk_CreateEventHandler(tv->core.tkwin,
+ TreeviewBindEventMask, TreeviewBindEventProc, tv);
+
+ tv->tree.itemLayout
+ = tv->tree.cellLayout
+ = tv->tree.headingLayout
+ = tv->tree.rowLayout
+ = 0;
+ tv->tree.headingHeight = tv->tree.rowHeight = DEFAULT_ROWHEIGHT;
+ tv->tree.indent = DEFAULT_INDENT;
+
+ Tcl_InitHashTable(&tv->tree.columnNames, TCL_STRING_KEYS);
+ tv->tree.nColumns = tv->tree.nDisplayColumns = 0;
+ tv->tree.columns = NULL;
+ tv->tree.displayColumns = NULL;
+ tv->tree.showFlags = ~0;
+
+ InitColumn(&tv->tree.column0);
+ Tk_InitOptions(
+ interp, (ClientData)(&tv->tree.column0),
+ tv->tree.columnOptionTable, tv->core.tkwin);
+ Tk_InitOptions(
+ interp, (ClientData)(&tv->tree.column0),
+ tv->tree.headingOptionTable, tv->core.tkwin);
+
+ Tcl_InitHashTable(&tv->tree.items, TCL_STRING_KEYS);
+ tv->tree.serial = 0;
+
+ tv->tree.focus = tv->tree.endPtr = 0;
+
+ /* Create root item "":
+ */
+ tv->tree.root = NewItem();
+ Tk_InitOptions(interp, (ClientData)tv->tree.root,
+ tv->tree.itemOptionTable, tv->core.tkwin);
+ tv->tree.root->tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, NULL);
+ tv->tree.root->entryPtr = Tcl_CreateHashEntry(&tv->tree.items, "", &unused);
+ Tcl_SetHashValue(tv->tree.root->entryPtr, tv->tree.root);
+
+ /* Scroll handles:
+ */
+ tv->tree.xscrollHandle = TtkCreateScrollHandle(&tv->core,&tv->tree.xscroll);
+ tv->tree.yscrollHandle = TtkCreateScrollHandle(&tv->core,&tv->tree.yscroll);
+
+ /* Size parameters:
+ */
+ tv->tree.treeArea = tv->tree.headingArea = Ttk_MakeBox(0,0,0,0);
+ tv->tree.slack = 0;
+}
+
+static void TreeviewCleanup(void *recordPtr)
+{
+ Treeview *tv = recordPtr;
+
+ Tk_DeleteEventHandler(tv->core.tkwin,
+ TreeviewBindEventMask, TreeviewBindEventProc, tv);
+ Tk_DeleteBindingTable(tv->tree.bindingTable);
+ Ttk_DeleteTagTable(tv->tree.tagTable);
+
+ if (tv->tree.itemLayout) Ttk_FreeLayout(tv->tree.itemLayout);
+ if (tv->tree.cellLayout) Ttk_FreeLayout(tv->tree.cellLayout);
+ if (tv->tree.headingLayout) Ttk_FreeLayout(tv->tree.headingLayout);
+ if (tv->tree.rowLayout) Ttk_FreeLayout(tv->tree.rowLayout);
+
+ TreeviewFreeColumns(tv);
+
+ if (tv->tree.displayColumns)
+ Tcl_Free((ClientData)tv->tree.displayColumns);
+
+ foreachHashEntry(&tv->tree.items, FreeItemCB);
+ Tcl_DeleteHashTable(&tv->tree.items);
+
+ TtkFreeScrollHandle(tv->tree.xscrollHandle);
+ TtkFreeScrollHandle(tv->tree.yscrollHandle);
+}
+
+/* + TreeviewConfigure --
+ * Configuration widget hook.
+ *
+ * BUG: If user sets -columns and -displaycolumns, but -displaycolumns
+ * has an error, the widget is left in an inconsistent state.
+ */
+static int
+TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+{
+ Treeview *tv = recordPtr;
+ unsigned showFlags = tv->tree.showFlags;
+
+ if (mask & COLUMNS_CHANGED) {
+ if (TreeviewInitColumns(interp, tv) != TCL_OK)
+ return TCL_ERROR;
+ mask |= DCOLUMNS_CHANGED;
+ }
+ if (mask & DCOLUMNS_CHANGED) {
+ if (TreeviewInitDisplayColumns(interp, tv) != TCL_OK)
+ return TCL_ERROR;
+ }
+ if (mask & SCROLLCMD_CHANGED) {
+ TtkScrollbarUpdateRequired(tv->tree.xscrollHandle);
+ TtkScrollbarUpdateRequired(tv->tree.yscrollHandle);
+ }
+ if ( (mask & SHOW_CHANGED)
+ && GetEnumSetFromObj(
+ interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ tv->tree.showFlags = showFlags;
+
+ if (mask & (SHOW_CHANGED | DCOLUMNS_CHANGED)) {
+ RecomputeSlack(tv);
+ }
+ return TCL_OK;
+}
+
+/* + ConfigureItem --
+ * Set item options.
+ */
+static int ConfigureItem(
+ Tcl_Interp *interp, Treeview *tv, TreeItem *item,
+ int objc, Tcl_Obj *const objv[])
+{
+ Tk_SavedOptions savedOptions;
+ int mask;
+ Ttk_ImageSpec *newImageSpec = NULL;
+ Ttk_TagSet newTagSet = NULL;
+
+ if (Tk_SetOptions(interp, (ClientData)item, tv->tree.itemOptionTable,
+ objc, objv, tv->core.tkwin, &savedOptions, &mask)
+ != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ /* Make sure that -values is a valid list:
+ */
+ if (item->valuesObj) {
+ int unused;
+ if (Tcl_ListObjLength(interp, item->valuesObj, &unused) != TCL_OK)
+ goto error;
+ }
+
+ /* Check -image.
+ */
+ if ((mask & ITEM_OPTION_IMAGE_CHANGED) && item->imageObj) {
+ newImageSpec = TtkGetImageSpec(interp, tv->core.tkwin, item->imageObj);
+ if (!newImageSpec) {
+ goto error;
+ }
+ }
+
+ /* Check -tags.
+ * Side effect: may create new tags.
+ */
+ if (mask & ITEM_OPTION_TAGS_CHANGED) {
+ newTagSet = Ttk_GetTagSetFromObj(
+ interp, tv->tree.tagTable, item->tagsObj);
+ if (!newTagSet) {
+ goto error;
+ }
+ }
+
+ /* Keep TTK_STATE_OPEN flag in sync with item->openObj.
+ * We use both a state flag and a Tcl_Obj* resource so elements
+ * can access the value in either way.
+ */
+ if (item->openObj) {
+ int isOpen;
+ if (Tcl_GetBooleanFromObj(interp, item->openObj, &isOpen) != TCL_OK)
+ goto error;
+ if (isOpen)
+ item->state |= TTK_STATE_OPEN;
+ else
+ item->state &= ~TTK_STATE_OPEN;
+ }
+
+ /* All OK.
+ */
+ Tk_FreeSavedOptions(&savedOptions);
+ if (mask & ITEM_OPTION_TAGS_CHANGED) {
+ if (item->tagset) { Ttk_FreeTagSet(item->tagset); }
+ item->tagset = newTagSet;
+ }
+ if (mask & ITEM_OPTION_IMAGE_CHANGED) {
+ if (item->imagespec) { TtkFreeImageSpec(item->imagespec); }
+ item->imagespec = newImageSpec;
+ }
+ TtkRedisplayWidget(&tv->core);
+ return TCL_OK;
+
+error:
+ Tk_RestoreSavedOptions(&savedOptions);
+ if (newTagSet) { Ttk_FreeTagSet(newTagSet); }
+ if (newImageSpec) { TtkFreeImageSpec(newImageSpec); }
+ return TCL_ERROR;
+}
+
+/* + ConfigureColumn --
+ * Set column options.
+ */
+static int ConfigureColumn(
+ Tcl_Interp *interp, Treeview *tv, TreeColumn *column,
+ int objc, Tcl_Obj *const objv[])
+{
+ Tk_SavedOptions savedOptions;
+ int mask;
+
+ if (Tk_SetOptions(interp, (ClientData)column,
+ tv->tree.columnOptionTable, objc, objv, tv->core.tkwin,
+ &savedOptions,&mask) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ if (mask & READONLY_OPTION) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Attempt to change read-only option", NULL);
+ goto error;
+ }
+
+ /* Propagate column width changes to overall widget request width,
+ * but only if the widget is currently unmapped, in order to prevent
+ * geometry jumping during interactive column resize.
+ */
+ if (mask & GEOMETRY_CHANGED) {
+ if (!Tk_IsMapped(tv->core.tkwin)) {
+ TtkResizeWidget(&tv->core);
+ }
+ RecomputeSlack(tv);
+ }
+ TtkRedisplayWidget(&tv->core);
+
+ /* ASSERT: SLACKINVARIANT */
+
+ Tk_FreeSavedOptions(&savedOptions);
+ return TCL_OK;
+
+error:
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
+}
+
+/* + ConfigureHeading --
+ * Set heading options.
+ */
+static int ConfigureHeading(
+ Tcl_Interp *interp, Treeview *tv, TreeColumn *column,
+ int objc, Tcl_Obj *const objv[])
+{
+ Tk_SavedOptions savedOptions;
+ int mask;
+
+ if (Tk_SetOptions(interp, (ClientData)column,
+ tv->tree.headingOptionTable, objc, objv, tv->core.tkwin,
+ &savedOptions,&mask) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ /* @@@ testing ... */
+ if ((mask & STATE_CHANGED) && column->headingStateObj) {
+ Ttk_StateSpec stateSpec;
+ if (Ttk_GetStateSpecFromObj(
+ interp, column->headingStateObj, &stateSpec) != TCL_OK)
+ {
+ goto error;
+ }
+ column->headingState = Ttk_ModifyState(column->headingState,&stateSpec);
+ Tcl_DecrRefCount(column->headingStateObj);
+ column->headingStateObj = Ttk_NewStateSpecObj(column->headingState,0);
+ Tcl_IncrRefCount(column->headingStateObj);
+ }
+
+ TtkRedisplayWidget(&tv->core);
+ Tk_FreeSavedOptions(&savedOptions);
+ return TCL_OK;
+
+error:
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Geometry routines.
+ */
+
+/* + CountRows --
+ * Returns the number of viewable rows rooted at item
+ */
+static int CountRows(TreeItem *item)
+{
+ int rows = 1;
+
+ if (item->state & TTK_STATE_OPEN) {
+ TreeItem *child = item->children;
+ while (child) {
+ rows += CountRows(child);
+ child = child->next;
+ }
+ }
+ return rows;
+}
+
+/* + IdentifyRow --
+ * Recursive search for item at specified y position.
+ * Main work routine for IdentifyItem()
+ */
+static TreeItem *IdentifyRow(
+ Treeview *tv, /* Widget record */
+ TreeItem *item, /* Where to start search */
+ int *ypos, /* Scan position */
+ int y) /* Target y coordinate */
+{
+ while (item) {
+ int next_ypos = *ypos + tv->tree.rowHeight;
+ if (*ypos <= y && y <= next_ypos) {
+ return item;
+ }
+ *ypos = next_ypos;
+ if (item->state & TTK_STATE_OPEN) {
+ TreeItem *subitem = IdentifyRow(tv, item->children, ypos, y);
+ if (subitem) {
+ return subitem;
+ }
+ }
+ item = item->next;
+ }
+ return 0;
+}
+
+/* + IdentifyItem --
+ * Locate the item at the specified y position, if any.
+ */
+static TreeItem *IdentifyItem(Treeview *tv, int y)
+{
+ int rowHeight = tv->tree.rowHeight;
+ int ypos = tv->tree.treeArea.y - rowHeight * tv->tree.yscroll.first;
+ return IdentifyRow(tv, tv->tree.root->children, &ypos, y);
+}
+
+/* + IdentifyDisplayColumn --
+ * Returns the display column number at the specified x position,
+ * or -1 if x is outside any columns.
+ */
+static int IdentifyDisplayColumn(Treeview *tv, int x, int *x1)
+{
+ int colno = FirstColumn(tv);
+ int xpos = tv->tree.treeArea.x - tv->tree.xscroll.first;
+
+ while (colno < tv->tree.nDisplayColumns) {
+ TreeColumn *column = tv->tree.displayColumns[colno];
+ int next_xpos = xpos + column->width;
+ if (xpos <= x && x <= next_xpos + HALO) {
+ *x1 = next_xpos;
+ return colno;
+ }
+ ++colno;
+ xpos = next_xpos;
+ }
+
+ return -1;
+}
+
+/* + RowNumber --
+ * Calculate which row the specified item appears on;
+ * returns -1 if the item is not viewable.
+ * Xref: DrawForest, IdentifyItem.
+ */
+static int RowNumber(Treeview *tv, TreeItem *item)
+{
+ TreeItem *p = tv->tree.root->children;
+ int n = 0;
+
+ while (p) {
+ if (p == item)
+ return n;
+
+ ++n;
+
+ /* Find next viewable item in preorder traversal order
+ */
+ if (p->children && (p->state & TTK_STATE_OPEN)) {
+ p = p->children;
+ } else {
+ while (!p->next && p && p->parent)
+ p = p->parent;
+ if (p)
+ p = p->next;
+ }
+ }
+
+ return -1;
+}
+
+/* + ItemDepth -- return the depth of a tree item.
+ * The depth of an item is equal to the number of proper ancestors,
+ * not counting the root node.
+ */
+static int ItemDepth(TreeItem *item)
+{
+ int depth = 0;
+ while (item->parent) {
+ ++depth;
+ item = item->parent;
+ }
+ return depth-1;
+}
+
+/* + ItemRow --
+ * Returns row number of specified item relative to root,
+ * -1 if item is not viewable.
+ */
+static int ItemRow(Treeview *tv, TreeItem *p)
+{
+ TreeItem *root = tv->tree.root;
+ int rowNumber = 0;
+
+ for (;;) {
+ if (p->prev) {
+ p = p->prev;
+ rowNumber += CountRows(p);
+ } else {
+ p = p->parent;
+ if (!(p && (p->state & TTK_STATE_OPEN))) {
+ /* detached or closed ancestor */
+ return -1;
+ }
+ if (p == root) {
+ return rowNumber;
+ }
+ ++rowNumber;
+ }
+ }
+}
+
+/* + BoundingBox --
+ * Compute the parcel of the specified column of the specified item,
+ * (or the entire item if column is NULL)
+ * Returns: 0 if item or column is not viewable, 1 otherwise.
+ */
+static int BoundingBox(
+ Treeview *tv, /* treeview widget */
+ TreeItem *item, /* desired item */
+ TreeColumn *column, /* desired column */
+ Ttk_Box *bbox_rtn) /* bounding box of item */
+{
+ int row = ItemRow(tv, item);
+ Ttk_Box bbox = tv->tree.treeArea;
+
+ if (row < tv->tree.yscroll.first || row > tv->tree.yscroll.last) {
+ /* not viewable, or off-screen */
+ return 0;
+ }
+
+ bbox.y += (row - tv->tree.yscroll.first) * tv->tree.rowHeight;
+ bbox.height = tv->tree.rowHeight;
+
+ bbox.x -= tv->tree.xscroll.first;
+ bbox.width = TreeWidth(tv);
+
+ if (column) {
+ int xpos = 0, i = FirstColumn(tv);
+ while (i < tv->tree.nDisplayColumns) {
+ if (tv->tree.displayColumns[i] == column) {
+ break;
+ }
+ xpos += tv->tree.displayColumns[i]->width;
+ ++i;
+ }
+ if (i == tv->tree.nDisplayColumns) { /* specified column unviewable */
+ return 0;
+ }
+ bbox.x += xpos;
+ bbox.width = column->width;
+
+ /* Account for indentation in tree column:
+ */
+ if (column == &tv->tree.column0) {
+ int indent = tv->tree.indent * ItemDepth(item);
+ bbox.x += indent;
+ bbox.width -= indent;
+ }
+ }
+ *bbox_rtn = bbox;
+ return 1;
+}
+
+/* + IdentifyRegion --
+ */
+
+typedef enum {
+ REGION_NOTHING = 0,
+ REGION_HEADING,
+ REGION_SEPARATOR,
+ REGION_TREE,
+ REGION_CELL
+} TreeRegion;
+
+static const char *regionStrings[] = {
+ "nothing", "heading", "separator", "tree", "cell", 0
+};
+
+static TreeRegion IdentifyRegion(Treeview *tv, int x, int y)
+{
+ int x1 = 0, colno;
+
+ colno = IdentifyDisplayColumn(tv, x, &x1);
+ if (Ttk_BoxContains(tv->tree.headingArea, x, y)) {
+ if (colno < 0) {
+ return REGION_NOTHING;
+ } else if (-HALO <= x1 - x && x1 - x <= HALO) {
+ return REGION_SEPARATOR;
+ } else {
+ return REGION_HEADING;
+ }
+ } else if (Ttk_BoxContains(tv->tree.treeArea, x, y)) {
+ TreeItem *item = IdentifyItem(tv, y);
+ if (item && colno > 0) {
+ return REGION_CELL;
+ } else if (item) {
+ return REGION_TREE;
+ }
+ }
+ return REGION_NOTHING;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Display routines.
+ */
+
+/* + GetSublayout --
+ * Utility routine; acquires a sublayout for items, cells, etc.
+ */
+static Ttk_Layout GetSublayout(
+ Tcl_Interp *interp,
+ Ttk_Theme themePtr,
+ Ttk_Layout parentLayout,
+ const char *layoutName,
+ Tk_OptionTable optionTable,
+ Ttk_Layout *layoutPtr)
+{
+ Ttk_Layout newLayout = Ttk_CreateSublayout(
+ interp, themePtr, parentLayout, layoutName, optionTable);
+
+ if (newLayout) {
+ if (*layoutPtr)
+ Ttk_FreeLayout(*layoutPtr);
+ *layoutPtr = newLayout;
+ }
+ return newLayout;
+}
+
+/* + TreeviewGetLayout --
+ * GetLayout() widget hook.
+ */
+static Ttk_Layout TreeviewGetLayout(
+ Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
+{
+ Treeview *tv = recordPtr;
+ Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr);
+ Tcl_Obj *objPtr;
+ int unused;
+
+ if (!(
+ treeLayout
+ && GetSublayout(interp, themePtr, treeLayout, ".Item",
+ tv->tree.tagOptionTable, &tv->tree.itemLayout)
+ && GetSublayout(interp, themePtr, treeLayout, ".Cell",
+ tv->tree.tagOptionTable, &tv->tree.cellLayout)
+ && GetSublayout(interp, themePtr, treeLayout, ".Heading",
+ tv->tree.headingOptionTable, &tv->tree.headingLayout)
+ && GetSublayout(interp, themePtr, treeLayout, ".Row",
+ tv->tree.tagOptionTable, &tv->tree.rowLayout)
+ )) {
+ return 0;
+ }
+
+ /* Compute heading height.
+ */
+ Ttk_RebindSublayout(tv->tree.headingLayout, &tv->tree.column0);
+ Ttk_LayoutSize(tv->tree.headingLayout, 0, &unused, &tv->tree.headingHeight);
+
+ /* Get item height, indent from style:
+ * @@@ TODO: sanity-check.
+ */
+ tv->tree.rowHeight = DEFAULT_ROWHEIGHT;
+ tv->tree.indent = DEFAULT_INDENT;
+ if ((objPtr = Ttk_QueryOption(treeLayout, "-rowheight", 0))) {
+ (void)Tcl_GetIntFromObj(NULL, objPtr, &tv->tree.rowHeight);
+ }
+ if ((objPtr = Ttk_QueryOption(treeLayout, "-indent", 0))) {
+ (void)Tcl_GetIntFromObj(NULL, objPtr, &tv->tree.indent);
+ }
+
+ return treeLayout;
+}
+
+/* + TreeviewDoLayout --
+ * DoLayout() widget hook. Computes widget layout.
+ *
+ * Side effects:
+ * Computes headingArea and treeArea.
+ * Computes subtree height.
+ * Invokes scroll callbacks.
+ */
+static void TreeviewDoLayout(void *clientData)
+{
+ Treeview *tv = clientData;
+ int visibleRows;
+
+ /* ASSERT: SLACKINVARIANT */
+
+ Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin));
+ tv->tree.treeArea = Ttk_ClientRegion(tv->core.layout, "treearea");
+
+ ResizeColumns(tv, tv->tree.treeArea.width);
+ /* ASSERT: SLACKINVARIANT */
+
+ TtkScrolled(tv->tree.xscrollHandle,
+ tv->tree.xscroll.first,
+ tv->tree.xscroll.first + tv->tree.treeArea.width,
+ TreeWidth(tv));
+
+ if (tv->tree.showFlags & SHOW_HEADINGS) {
+ tv->tree.headingArea = Ttk_PackBox(
+ &tv->tree.treeArea, 1, tv->tree.headingHeight, TTK_SIDE_TOP);
+ } else {
+ tv->tree.headingArea = Ttk_MakeBox(0,0,0,0);
+ }
+
+ visibleRows = tv->tree.treeArea.height / tv->tree.rowHeight;
+ tv->tree.root->state |= TTK_STATE_OPEN;
+ TtkScrolled(tv->tree.yscrollHandle,
+ tv->tree.yscroll.first,
+ tv->tree.yscroll.first + visibleRows,
+ CountRows(tv->tree.root) - 1);
+}
+
+/* + TreeviewSize --
+ * SizeProc() widget hook. Size is determined by
+ * -height option and column widths.
+ */
+static int TreeviewSize(void *clientData, int *widthPtr, int *heightPtr)
+{
+ Treeview *tv = clientData;
+ int nRows, padHeight, padWidth;
+
+ Ttk_LayoutSize(tv->core.layout, tv->core.state, &padWidth, &padHeight);
+ Tcl_GetIntFromObj(NULL, tv->tree.heightObj, &nRows);
+
+ *widthPtr = padWidth + TreeWidth(tv);
+ *heightPtr = padHeight + tv->tree.rowHeight * nRows;
+
+ if (tv->tree.showFlags & SHOW_HEADINGS) {
+ *heightPtr += tv->tree.headingHeight;
+ }
+
+ return 1;
+}
+
+/* + ItemState --
+ * Returns the state of the specified item, based
+ * on widget state, item state, and other information.
+ */
+static Ttk_State ItemState(Treeview *tv, TreeItem *item)
+{
+ Ttk_State state = tv->core.state | item->state;
+ if (!item->children)
+ state |= TTK_STATE_LEAF;
+ if (item != tv->tree.focus)
+ state &= ~TTK_STATE_FOCUS;
+ return state;
+}
+
+/* + DrawHeadings --
+ * Draw tree headings.
+ */
+static void DrawHeadings(Treeview *tv, Drawable d)
+{
+ const int x0 = tv->tree.headingArea.x - tv->tree.xscroll.first;
+ const int y0 = tv->tree.headingArea.y;
+ const int h0 = tv->tree.headingArea.height;
+ int i = FirstColumn(tv);
+ int x = 0;
+
+ while (i < tv->tree.nDisplayColumns) {
+ TreeColumn *column = tv->tree.displayColumns[i];
+ Ttk_Box parcel = Ttk_MakeBox(x0+x, y0, column->width, h0);
+ DisplayLayout(tv->tree.headingLayout,
+ column, column->headingState, parcel, d);
+ x += column->width;
+ ++i;
+ }
+}
+
+/* + PrepareItem --
+ * Fill in a displayItem record.
+ */
+static void PrepareItem(
+ Treeview *tv, TreeItem *item, DisplayItem *displayItem)
+{
+ Ttk_Style style = Ttk_LayoutStyle(tv->core.layout);
+ Ttk_State state = ItemState(tv, item);
+
+ Ttk_TagSetValues(tv->tree.tagTable, item->tagset, displayItem);
+ Ttk_TagSetApplyStyle(tv->tree.tagTable, style, state, displayItem);
+}
+
+/* + DrawCells --
+ * Draw data cells for specified item.
+ */
+static void DrawCells(
+ Treeview *tv, TreeItem *item, DisplayItem *displayItem,
+ Drawable d, int x, int y)
+{
+ Ttk_Layout layout = tv->tree.cellLayout;
+ Ttk_State state = ItemState(tv, item);
+ Ttk_Padding cellPadding = {4, 0, 4, 0};
+ int rowHeight = tv->tree.rowHeight;
+ int nValues = 0;
+ Tcl_Obj **values = 0;
+ int i;
+
+ if (!item->valuesObj) {
+ return;
+ }
+
+ Tcl_ListObjGetElements(NULL, item->valuesObj, &nValues, &values);
+ for (i = 0; i < tv->tree.nColumns; ++i) {
+ tv->tree.columns[i].data = (i < nValues) ? values[i] : 0;
+ }
+
+ for (i = 1; i < tv->tree.nDisplayColumns; ++i) {
+ TreeColumn *column = tv->tree.displayColumns[i];
+ Ttk_Box parcel = Ttk_PadBox(
+ Ttk_MakeBox(x, y, column->width, rowHeight), cellPadding);
+
+ displayItem->textObj = column->data;
+ displayItem->anchorObj = column->anchorObj; /* <<NOTE-ANCHOR>> */
+
+ DisplayLayout(layout, displayItem, state, parcel, d);
+ x += column->width;
+ }
+}
+
+/* + DrawItem --
+ * Draw an item (row background, tree label, and cells).
+ */
+static void DrawItem(
+ Treeview *tv, TreeItem *item, Drawable d, int depth, int row)
+{
+ Ttk_State state = ItemState(tv, item);
+ DisplayItem displayItem;
+ int rowHeight = tv->tree.rowHeight;
+ int x = tv->tree.treeArea.x - tv->tree.xscroll.first;
+ int y = tv->tree.treeArea.y + rowHeight * (row - tv->tree.yscroll.first);
+
+ if (row % 2) state |= TTK_STATE_ALTERNATE;
+
+ PrepareItem(tv, item, &displayItem);
+
+ /* Draw row background:
+ */
+ {
+ Ttk_Box rowBox = Ttk_MakeBox(x, y, TreeWidth(tv), rowHeight);
+ DisplayLayout(tv->tree.rowLayout, &displayItem, state, rowBox, d);
+ }
+
+ /* Draw tree label:
+ */
+ if (tv->tree.showFlags & SHOW_TREE) {
+ int indent = depth * tv->tree.indent;
+ int colwidth = tv->tree.column0.width;
+ Ttk_Box parcel = Ttk_MakeBox(
+ x+indent, y, colwidth-indent, rowHeight);
+ if (item->textObj) { displayItem.textObj = item->textObj; }
+ if (item->imageObj) { displayItem.imageObj = item->imageObj; }
+ /* ??? displayItem.anchorObj = 0; <<NOTE-ANCHOR>> */
+ DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d);
+ x += colwidth;
+ }
+
+ /* Draw data cells:
+ */
+ DrawCells(tv, item, &displayItem, d, x, y);
+}
+
+/* + DrawSubtree --
+ * Draw an item and all of its (viewable) descendants.
+ *
+ * Returns:
+ * Row number of the last item drawn.
+ */
+
+static int DrawForest( /* forward */
+ Treeview *tv, TreeItem *item, Drawable d, int depth, int row);
+
+static int DrawSubtree(
+ Treeview *tv, TreeItem *item, Drawable d, int depth, int row)
+{
+ if (row >= tv->tree.yscroll.first) {
+ DrawItem(tv, item, d, depth, row);
+ }
+
+ if (item->state & TTK_STATE_OPEN) {
+ return DrawForest(tv, item->children, d, depth + 1, row + 1);
+ } else {
+ return row + 1;
+ }
+}
+
+/* + DrawForest --
+ * Draw a sequence of items and their visible descendants.
+ *
+ * Returns:
+ * Row number of the last item drawn.
+ */
+static int DrawForest(
+ Treeview *tv, TreeItem *item, Drawable d, int depth, int row)
+{
+ while (item && row <= tv->tree.yscroll.last) {
+ row = DrawSubtree(tv, item, d, depth, row);
+ item = item->next;
+ }
+ return row;
+}
+
+/* + TreeviewDisplay --
+ * Display() widget hook. Draw the widget contents.
+ */
+static void TreeviewDisplay(void *clientData, Drawable d)
+{
+ Treeview *tv = clientData;
+
+ Ttk_DrawLayout(tv->core.layout, tv->core.state, d);
+ if (tv->tree.showFlags & SHOW_HEADINGS) {
+ DrawHeadings(tv, d);
+ }
+ DrawForest(tv, tv->tree.root->children, d, 0,0);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Utilities for widget commands
+ */
+
+/* + InsertPosition --
+ * Locate the previous sibling for [$tree insert].
+ *
+ * Returns a pointer to the item just before the specified index,
+ * or 0 if the item is to be inserted at the beginning.
+ */
+static TreeItem *InsertPosition(TreeItem *parent, int index)
+{
+ TreeItem *prev = 0, *next = parent->children;
+
+ while (next != 0 && index > 0) {
+ --index;
+ prev = next;
+ next = prev->next;
+ }
+
+ return prev;
+}
+
+/* + EndPosition --
+ * Locate the last child of the specified node.
+ *
+ * To avoid quadratic-time behavior in the common cases
+ * where the treeview is populated in breadth-first or
+ * depth-first order using [$tv insert $parent end ...],
+ * we cache the result from the last call to EndPosition()
+ * and start the search from there on a cache hit.
+ *
+ */
+static TreeItem *EndPosition(Treeview *tv, TreeItem *parent)
+{
+ TreeItem *endPtr = tv->tree.endPtr;
+
+ while (endPtr && endPtr->parent != parent) {
+ endPtr = endPtr->parent;
+ }
+ if (!endPtr) {
+ endPtr = parent->children;
+ }
+
+ if (endPtr) {
+ while (endPtr->next) {
+ endPtr = endPtr->next;
+ }
+ tv->tree.endPtr = endPtr;
+ }
+
+ return endPtr;
+}
+
+/* + AncestryCheck --
+ * Verify that specified item is not an ancestor of the specified parent;
+ * returns 1 if OK, 0 and leaves an error message in interp otherwise.
+ */
+static int AncestryCheck(
+ Tcl_Interp *interp, Treeview *tv, TreeItem *item, TreeItem *parent)
+{
+ TreeItem *p = parent;
+ while (p) {
+ if (p == item) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Cannot insert ", ItemName(tv, item),
+ " as a descendant of ", ItemName(tv, parent),
+ NULL);
+ return 0;
+ }
+ p = p->parent;
+ }
+ return 1;
+}
+
+/* + DeleteItems --
+ * Remove an item and all of its descendants from the hash table
+ * and detach them from the tree; returns a linked list (chained
+ * along the ->next pointer) of deleted items.
+ */
+static TreeItem *DeleteItems(TreeItem *item, TreeItem *delq)
+{
+ if (item->entryPtr) {
+ DetachItem(item);
+ while (item->children) {
+ delq = DeleteItems(item->children, delq);
+ }
+ Tcl_DeleteHashEntry(item->entryPtr);
+ item->entryPtr = 0;
+ item->next = delq;
+ delq = item;
+ } /* else -- item has already been unlinked */
+ return delq;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands -- item inquiry.
+ */
+
+/* + $tv children $item ?newchildren? --
+ * Return the list of children associated with $item
+ */
+static int TreeviewChildrenCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item;
+ Tcl_Obj *result;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item ?newchildren?");
+ return TCL_ERROR;
+ }
+ item = FindItem(interp, tv, objv[2]);
+ if (!item) {
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ result = Tcl_NewListObj(0,0);
+ for (item = item->children; item; item = item->next) {
+ Tcl_ListObjAppendElement(interp, result, ItemID(tv, item));
+ }
+ Tcl_SetObjResult(interp, result);
+ } else {
+ TreeItem **newChildren = GetItemListFromObj(interp, tv, objv[3]);
+ TreeItem *child;
+ int i;
+
+ if (!newChildren)
+ return TCL_ERROR;
+
+ /* Sanity-check:
+ */
+ for (i=0; newChildren[i]; ++i) {
+ if (!AncestryCheck(interp, tv, newChildren[i], item)) {
+ ckfree((ClientData)newChildren);
+ return TCL_ERROR;
+ }
+ }
+
+ /* Detach old children:
+ */
+ child = item->children;
+ while (child) {
+ TreeItem *next = child->next;
+ DetachItem(child);
+ child = next;
+ }
+
+ /* Detach new children from their current locations:
+ */
+ for (i=0; newChildren[i]; ++i) {
+ DetachItem(newChildren[i]);
+ }
+
+ /* Reinsert new children:
+ * Note: it is not an error for an item to be listed more than once,
+ * though it probably should be...
+ */
+ child = 0;
+ for (i=0; newChildren[i]; ++i) {
+ if (newChildren[i]->parent) {
+ /* This is a duplicate element which has already been
+ * inserted. Ignore it.
+ */
+ continue;
+ }
+ InsertItem(item, child, newChildren[i]);
+ child = newChildren[i];
+ }
+
+ ckfree((ClientData)newChildren);
+ TtkRedisplayWidget(&tv->core);
+ }
+
+ return TCL_OK;
+}
+
+/* + $tv parent $item --
+ * Return the item ID of $item's parent.
+ */
+static int TreeviewParentCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item");
+ return TCL_ERROR;
+ }
+ item = FindItem(interp, tv, objv[2]);
+ if (!item) {
+ return TCL_ERROR;
+ }
+
+ if (item->parent) {
+ Tcl_SetObjResult(interp, ItemID(tv, item->parent));
+ } else {
+ /* This is the root item. @@@ Return an error? */
+ Tcl_ResetResult(interp);
+ }
+
+ return TCL_OK;
+}
+
+/* + $tv next $item
+ * Return the ID of $item's next sibling.
+ */
+static int TreeviewNextCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item");
+ return TCL_ERROR;
+ }
+ item = FindItem(interp, tv, objv[2]);
+ if (!item) {
+ return TCL_ERROR;
+ }
+
+ if (item->next) {
+ Tcl_SetObjResult(interp, ItemID(tv, item->next));
+ } /* else -- leave interp-result empty */
+
+ return TCL_OK;
+}
+
+/* + $tv prev $item
+ * Return the ID of $item's previous sibling.
+ */
+static int TreeviewPrevCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item");
+ return TCL_ERROR;
+ }
+ item = FindItem(interp, tv, objv[2]);
+ if (!item) {
+ return TCL_ERROR;
+ }
+
+ if (item->prev) {
+ Tcl_SetObjResult(interp, ItemID(tv, item->prev));
+ } /* else -- leave interp-result empty */
+
+ return TCL_OK;
+}
+
+/* + $tv index $item --
+ * Return the index of $item within its parent.
+ */
+static int TreeviewIndexCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item;
+ int index = 0;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item");
+ return TCL_ERROR;
+ }
+ item = FindItem(interp, tv, objv[2]);
+ if (!item) {
+ return TCL_ERROR;
+ }
+
+ while (item->prev) {
+ ++index;
+ item = item->prev;
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ return TCL_OK;
+}
+
+/* + $tv exists $itemid --
+ * Test if the specified item id is present in the tree.
+ */
+static int TreeviewExistsCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ Tcl_HashEntry *entryPtr;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "itemid");
+ return TCL_ERROR;
+ }
+
+ entryPtr = Tcl_FindHashEntry(&tv->tree.items, Tcl_GetString(objv[2]));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(entryPtr != 0));
+ return TCL_OK;
+}
+
+/* + $tv bbox $itemid ?$column? --
+ * Return bounding box [x y width height] of specified item.
+ */
+static int TreeviewBBoxCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item = 0;
+ TreeColumn *column = 0;
+ Ttk_Box bbox;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "itemid ?column");
+ return TCL_ERROR;
+ }
+
+ item = FindItem(interp, tv, objv[2]);
+ if (!item) {
+ return TCL_ERROR;
+ }
+ if (objc >=4 && (column = FindColumn(interp,tv,objv[3])) == NULL) {
+ return TCL_ERROR;
+ }
+
+ if (BoundingBox(tv, item, column, &bbox)) {
+ Tcl_SetObjResult(interp, Ttk_NewBoxObj(bbox));
+ }
+
+ return TCL_OK;
+}
+
+/* + $tv identify $x $y -- (obsolescent)
+ * Implements the old, horrible, 2-argument form of [$tv identify].
+ *
+ * Returns: one of
+ * heading #n
+ * cell itemid #n
+ * item itemid element
+ * row itemid
+ */
+static int TreeviewHorribleIdentify(
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Treeview *tv)
+{
+ const char *what = "nothing", *detail = NULL;
+ TreeItem *item = 0;
+ Tcl_Obj *result;
+ int dColumnNumber;
+ char dcolbuf[16];
+ int x, y, x1;
+
+ /* ASSERT: objc == 4 */
+
+ if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK
+ ) {
+ return TCL_ERROR;
+ }
+
+ dColumnNumber = IdentifyDisplayColumn(tv, x, &x1);
+ if (dColumnNumber < 0) {
+ goto done;
+ }
+ sprintf(dcolbuf, "#%d", dColumnNumber);
+
+ if (Ttk_BoxContains(tv->tree.headingArea,x,y)) {
+ if (-HALO <= x1 - x && x1 - x <= HALO) {
+ what = "separator";
+ } else {
+ what = "heading";
+ }
+ detail = dcolbuf;
+ } else if (Ttk_BoxContains(tv->tree.treeArea,x,y)) {
+ item = IdentifyItem(tv, y);
+ if (item && dColumnNumber > 0) {
+ what = "cell";
+ detail = dcolbuf;
+ } else if (item) {
+ Ttk_Layout layout = tv->tree.itemLayout;
+ Ttk_Box itemBox;
+ DisplayItem displayItem;
+ Ttk_Element element;
+
+ BoundingBox(tv, item, NULL, &itemBox);
+ PrepareItem(tv, item, &displayItem); /*@@@ FIX: -text, etc*/
+ Ttk_RebindSublayout(layout, &displayItem);
+ Ttk_PlaceLayout(layout, ItemState(tv,item), itemBox);
+ element = Ttk_IdentifyElement(layout, x, y);
+
+ if (element) {
+ what = "item";
+ detail = Ttk_ElementName(element);
+ } else {
+ what = "row";
+ }
+ }
+ }
+
+done:
+ result = Tcl_NewListObj(0,0);
+ Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(what, -1));
+ if (item)
+ Tcl_ListObjAppendElement(NULL, result, ItemID(tv, item));
+ if (detail)
+ Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(detail, -1));
+
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+}
+
+/* + $tv identify $component $x $y --
+ * Identify the component at position x,y.
+ */
+
+static int TreeviewIdentifyCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ static const char *submethodStrings[] =
+ { "region", "item", "column", "row", "element", NULL };
+ enum { I_REGION, I_ITEM, I_COLUMN, I_ROW, I_ELEMENT };
+
+ Treeview *tv = recordPtr;
+ int submethod;
+ int x, y;
+
+ TreeRegion region;
+ Ttk_Box bbox;
+ TreeItem *item;
+ TreeColumn *column = 0;
+ int colno, x1;
+
+ if (objc == 4) { /* Old form */
+ return TreeviewHorribleIdentify(interp, objc, objv, tv);
+ } else if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "command x y");
+ return TCL_ERROR;
+ }
+
+ if ( Tcl_GetIndexFromObj(interp, objv[2],
+ submethodStrings, "command", TCL_EXACT, &submethod) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK
+ ) {
+ return TCL_ERROR;
+ }
+
+ region = IdentifyRegion(tv, x, y);
+ item = IdentifyItem(tv, y);
+ colno = IdentifyDisplayColumn(tv, x, &x1);
+ column = (colno >= 0) ? tv->tree.displayColumns[colno] : NULL;
+
+ switch (submethod)
+ {
+ case I_REGION :
+ Tcl_SetObjResult(interp,Tcl_NewStringObj(regionStrings[region],-1));
+ break;
+
+ case I_ITEM :
+ case I_ROW :
+ if (item) {
+ Tcl_SetObjResult(interp, ItemID(tv, item));
+ }
+ break;
+
+ case I_COLUMN :
+ if (colno >= 0) {
+ char dcolbuf[16];
+ sprintf(dcolbuf, "#%d", colno);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(dcolbuf, -1));
+ }
+ break;
+
+ case I_ELEMENT :
+ {
+ Ttk_Layout layout = 0;
+ DisplayItem displayItem;
+ Ttk_Element element;
+
+ switch (region) {
+ case REGION_NOTHING:
+ layout = tv->core.layout;
+ return TCL_OK; /* @@@ NYI */
+ case REGION_HEADING:
+ case REGION_SEPARATOR:
+ layout = tv->tree.headingLayout;
+ return TCL_OK; /* @@@ NYI */
+ case REGION_TREE:
+ layout = tv->tree.itemLayout;
+ break;
+ case REGION_CELL:
+ layout = tv->tree.cellLayout;
+ break;
+ }
+
+ if (!BoundingBox(tv, item, column, &bbox)) {
+ return TCL_OK;
+ }
+
+ PrepareItem(tv, item, &displayItem); /*@@@ FIX: fill in -text,etc */
+ Ttk_RebindSublayout(layout, &displayItem);
+ Ttk_PlaceLayout(layout, ItemState(tv,item), bbox);
+ element = Ttk_IdentifyElement(layout, x, y);
+
+ if (element) {
+ const char *elementName = Ttk_ElementName(element);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1));
+ }
+ break;
+ }
+ }
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands -- item and column configuration.
+ */
+
+/* + $tv item $item ?options ....?
+ * Query or configure item options.
+ */
+static int TreeviewItemCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item ?option ?value??...");
+ return TCL_ERROR;
+ }
+ if (!(item = FindItem(interp, tv, objv[2]))) {
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ return TtkEnumerateOptions(interp, item, ItemOptionSpecs,
+ tv->tree.itemOptionTable, tv->core.tkwin);
+ } else if (objc == 4) {
+ return TtkGetOptionValue(interp, item, objv[3],
+ tv->tree.itemOptionTable, tv->core.tkwin);
+ } else {
+ return ConfigureItem(interp, tv, item, objc-3, objv+3);
+ }
+}
+
+/* + $tv column column ?options ....?
+ * Column data accessor
+ */
+static int TreeviewColumnCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeColumn *column;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "column -option value...");
+ return TCL_ERROR;
+ }
+ if (!(column = FindColumn(interp, tv, objv[2]))) {
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ return TtkEnumerateOptions(interp, column, ColumnOptionSpecs,
+ tv->tree.columnOptionTable, tv->core.tkwin);
+ } else if (objc == 4) {
+ return TtkGetOptionValue(interp, column, objv[3],
+ tv->tree.columnOptionTable, tv->core.tkwin);
+ } else {
+ return ConfigureColumn(interp, tv, column, objc-3, objv+3);
+ }
+}
+
+/* + $tv heading column ?options ....?
+ * Heading data accessor
+ */
+static int TreeviewHeadingCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ Tk_OptionTable optionTable = tv->tree.headingOptionTable;
+ Tk_Window tkwin = tv->core.tkwin;
+ TreeColumn *column;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "column -option value...");
+ return TCL_ERROR;
+ }
+ if (!(column = FindColumn(interp, tv, objv[2]))) {
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ return TtkEnumerateOptions(
+ interp, column, HeadingOptionSpecs, optionTable, tkwin);
+ } else if (objc == 4) {
+ return TtkGetOptionValue(
+ interp, column, objv[3], optionTable, tkwin);
+ } else {
+ return ConfigureHeading(interp, tv, column, objc-3,objv+3);
+ }
+}
+
+/* + $tv set $item ?$column ?value??
+ * Query or configure cell values
+ */
+static int TreeviewSetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item;
+ TreeColumn *column;
+ int columnNumber;
+
+ if (objc < 3 || objc > 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item ?column ?value??");
+ return TCL_ERROR;
+ }
+ if (!(item = FindItem(interp, tv, objv[2])))
+ return TCL_ERROR;
+
+ /* Make sure -values exists:
+ */
+ if (!item->valuesObj) {
+ item->valuesObj = Tcl_NewListObj(0,0);
+ Tcl_IncrRefCount(item->valuesObj);
+ }
+
+ if (objc == 3) {
+ /* Return dictionary:
+ */
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+ Tcl_Obj *value;
+ for (columnNumber=0; columnNumber<tv->tree.nColumns; ++columnNumber) {
+ Tcl_ListObjIndex(interp, item->valuesObj, columnNumber, &value);
+ if (value) {
+ Tcl_ListObjAppendElement(interp, result,
+ tv->tree.columns[columnNumber].idObj);
+ Tcl_ListObjAppendElement(interp, result, value);
+ }
+ }
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ }
+
+ /* else -- get or set column
+ */
+ if (!(column = FindColumn(interp, tv, objv[3])))
+ return TCL_ERROR;
+
+ if (column == &tv->tree.column0) {
+ /* @@@ Maybe set -text here instead? */
+ Tcl_AppendResult(interp, "Display column #0 cannot be set", NULL);
+ return TCL_ERROR;
+ }
+
+ /* Note: we don't do any error checking in the list operations,
+ * since item->valuesObj is guaranteed to be a list.
+ */
+ columnNumber = column - tv->tree.columns;
+
+ if (objc == 4) { /* get column */
+ Tcl_Obj *result = 0;
+ Tcl_ListObjIndex(interp, item->valuesObj, columnNumber, &result);
+ if (!result) {
+ result = Tcl_NewStringObj("",0);
+ }
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ } else { /* set column */
+ int length;
+
+ item->valuesObj = unshare(item->valuesObj);
+
+ /* Make sure -values is fully populated:
+ */
+ Tcl_ListObjLength(interp, item->valuesObj, &length);
+ while (length < tv->tree.nColumns) {
+ Tcl_Obj *empty = Tcl_NewStringObj("",0);
+ Tcl_ListObjAppendElement(interp, item->valuesObj, empty);
+ ++length;
+ }
+
+ /* Set value:
+ */
+ Tcl_ListObjReplace(interp,item->valuesObj,columnNumber,1,1,objv+4);
+ TtkRedisplayWidget(&tv->core);
+ return TCL_OK;
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands -- tree modification.
+ */
+
+/* + $tv insert $parent $index ?-id id? ?-option value ...?
+ * Insert a new item.
+ */
+static int TreeviewInsertCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *parent, *sibling, *newItem;
+ Tcl_HashEntry *entryPtr;
+ int isNew;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "parent index ?-id id? -options...");
+ return TCL_ERROR;
+ }
+
+ /* Get parent node:
+ */
+ if ((parent = FindItem(interp, tv, objv[2])) == NULL) {
+ return TCL_ERROR;
+ }
+
+ /* Locate previous sibling based on $index:
+ */
+ if (!strcmp(Tcl_GetString(objv[3]), "end")) {
+ sibling = EndPosition(tv, parent);
+ } else {
+ int index;
+ if (Tcl_GetIntFromObj(interp, objv[3], &index) != TCL_OK)
+ return TCL_ERROR;
+ sibling = InsertPosition(parent, index);
+ }
+
+ /* Get node name:
+ * If -id supplied and does not already exist, use that;
+ * Otherwise autogenerate new one.
+ */
+ objc -= 4; objv += 4;
+ if (objc >= 2 && !strcmp("-id", Tcl_GetString(objv[0]))) {
+ const char *itemName = Tcl_GetString(objv[1]);
+ entryPtr = Tcl_CreateHashEntry(&tv->tree.items, itemName, &isNew);
+ if (!isNew) {
+ Tcl_AppendResult(interp, "Item ",itemName," already exists",NULL);
+ return TCL_ERROR;
+ }
+ objc -= 2; objv += 2;
+ } else {
+ char idbuf[16];
+ do {
+ ++tv->tree.serial;
+ sprintf(idbuf, "I%03X", tv->tree.serial);
+ entryPtr = Tcl_CreateHashEntry(&tv->tree.items, idbuf, &isNew);
+ } while (!isNew);
+ }
+
+ /* Create and configure new item:
+ */
+ newItem = NewItem();
+ Tk_InitOptions(
+ interp, (ClientData)newItem, tv->tree.itemOptionTable, tv->core.tkwin);
+ newItem->tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, NULL);
+ if (ConfigureItem(interp, tv, newItem, objc, objv) != TCL_OK) {
+ Tcl_DeleteHashEntry(entryPtr);
+ FreeItem(newItem);
+ return TCL_ERROR;
+ }
+
+ /* Store in hash table, link into tree:
+ */
+ Tcl_SetHashValue(entryPtr, newItem);
+ newItem->entryPtr = entryPtr;
+ InsertItem(parent, sibling, newItem);
+ TtkRedisplayWidget(&tv->core);
+
+ Tcl_SetObjResult(interp, ItemID(tv, newItem));
+ return TCL_OK;
+}
+
+/* + $tv detach $item --
+ * Unlink $item from the tree.
+ */
+static int TreeviewDetachCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem **items;
+ int i;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item");
+ return TCL_ERROR;
+ }
+ if (!(items = GetItemListFromObj(interp, tv, objv[2]))) {
+ return TCL_ERROR;
+ }
+
+ /* Sanity-check */
+ for (i = 0; items[i]; ++i) {
+ if (items[i] == tv->tree.root) {
+ Tcl_AppendResult(interp, "Cannot detach root item", NULL);
+ ckfree((ClientData)items);
+ return TCL_ERROR;
+ }
+ }
+
+ for (i = 0; items[i]; ++i) {
+ DetachItem(items[i]);
+ }
+
+ TtkRedisplayWidget(&tv->core);
+ ckfree((ClientData)items);
+ return TCL_OK;
+}
+
+/* + $tv delete $items --
+ * Delete each item in $items.
+ *
+ * Do this in two passes:
+ * First detach the item and all its descendants and remove them
+ * from the hash table. Free the items themselves in a second pass.
+ *
+ * It's done this way because an item may appear more than once
+ * in the list of items to delete (either directly or as a descendant
+ * of a previously deleted item.)
+ */
+
+static int TreeviewDeleteCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem **items, *delq;
+ int i;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "items");
+ return TCL_ERROR;
+ }
+
+ if (!(items = GetItemListFromObj(interp, tv, objv[2]))) {
+ return TCL_ERROR;
+ }
+
+ /* Sanity-check:
+ */
+ for (i=0; items[i]; ++i) {
+ if (items[i] == tv->tree.root) {
+ ckfree((ClientData)items);
+ Tcl_AppendResult(interp, "Cannot delete root item", NULL);
+ return TCL_ERROR;
+ }
+ }
+
+ /* Remove items from hash table.
+ */
+ delq = 0;
+ for (i=0; items[i]; ++i) {
+ delq = DeleteItems(items[i], delq);
+ }
+
+ /* Free items:
+ */
+ while (delq) {
+ TreeItem *next = delq->next;
+ if (tv->tree.focus == delq)
+ tv->tree.focus = 0;
+ if (tv->tree.endPtr == delq)
+ tv->tree.endPtr = 0;
+ FreeItem(delq);
+ delq = next;
+ }
+
+ ckfree((ClientData)items);
+ TtkRedisplayWidget(&tv->core);
+ return TCL_OK;
+}
+
+/* + $tv move $item $parent $index
+ * Move $item to the specified $index in $parent's child list.
+ */
+static int TreeviewMoveCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item, *parent;
+ TreeItem *sibling;
+
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item parent index");
+ return TCL_ERROR;
+ }
+ if ( (item = FindItem(interp, tv, objv[2])) == 0
+ || (parent = FindItem(interp, tv, objv[3])) == 0)
+ {
+ return TCL_ERROR;
+ }
+
+ /* Locate previous sibling based on $index:
+ */
+ if (!strcmp(Tcl_GetString(objv[4]), "end")) {
+ sibling = EndPosition(tv, parent);
+ } else {
+ TreeItem *p;
+ int index;
+
+ if (Tcl_GetIntFromObj(interp, objv[4], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ sibling = 0;
+ for (p = parent->children; p != NULL && index > 0; p = p->next) {
+ if (p != item) {
+ --index;
+ } /* else -- moving node forward, count index+1 nodes */
+ sibling = p;
+ }
+ }
+
+ /* Check ancestry:
+ */
+ if (!AncestryCheck(interp, tv, item, parent)) {
+ return TCL_ERROR;
+ }
+
+ /* Moving an item after itself is a no-op:
+ */
+ if (item == sibling) {
+ return TCL_OK;
+ }
+
+ /* Move item:
+ */
+ DetachItem(item);
+ InsertItem(parent, sibling, item);
+
+ TtkRedisplayWidget(&tv->core);
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands -- scrolling
+ */
+
+static int TreeviewXViewCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ return TtkScrollviewCommand(interp, objc, objv, tv->tree.xscrollHandle);
+}
+
+static int TreeviewYViewCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ return TtkScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle);
+}
+
+/* $tree see $item --
+ * Ensure that $item is visible.
+ */
+static int TreeviewSeeCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ TreeItem *item, *parent;
+ int rowNumber;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "item");
+ return TCL_ERROR;
+ }
+ if (!(item = FindItem(interp, tv, objv[2]))) {
+ return TCL_ERROR;
+ }
+
+ /* Make sure all ancestors are open:
+ */
+ for (parent = item->parent; parent; parent = parent->parent) {
+ if (!(parent->state & TTK_STATE_OPEN)) {
+ parent->openObj = unshare(parent->openObj);
+ Tcl_SetBooleanObj(parent->openObj, 1);
+ parent->state |= TTK_STATE_OPEN;
+ TtkRedisplayWidget(&tv->core);
+ }
+ }
+
+ /* Make sure item is visible:
+ * @@@ DOUBLE-CHECK THIS:
+ */
+ rowNumber = RowNumber(tv, item);
+ if (rowNumber < tv->tree.yscroll.first) {
+ TtkScrollTo(tv->tree.yscrollHandle, rowNumber);
+ } else if (rowNumber >= tv->tree.yscroll.last) {
+ TtkScrollTo(tv->tree.yscrollHandle,
+ tv->tree.yscroll.first + (1+rowNumber - tv->tree.yscroll.last));
+ }
+
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands -- interactive column resize
+ */
+
+/* + $tree drag $column $newX --
+ * Set right edge of display column $column to x position $X
+ */
+static int TreeviewDragCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ int left = tv->tree.treeArea.x - tv->tree.xscroll.first;
+ int i = FirstColumn(tv);
+ TreeColumn *column;
+ int newx;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "column xposition");
+ return TCL_ERROR;
+ }
+
+ if ( (column = FindColumn(interp, tv, objv[2])) == 0
+ || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ for (;i < tv->tree.nDisplayColumns; ++i) {
+ TreeColumn *c = tv->tree.displayColumns[i];
+ int right = left + c->width;
+ if (c == column) {
+ DragColumn(tv, i, newx - right);
+ /* ASSERT: SLACKINVARIANT */
+ TtkRedisplayWidget(&tv->core);
+ return TCL_OK;
+ }
+ left = right;
+ }
+
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "column ", Tcl_GetString(objv[2]), " is not displayed",
+ NULL);
+ return TCL_ERROR;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands -- focus and selection
+ */
+
+/* + $tree focus ?item?
+ */
+static int TreeviewFocusCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+
+ if (objc == 2) {
+ if (tv->tree.focus) {
+ Tcl_SetObjResult(interp, ItemID(tv, tv->tree.focus));
+ }
+ return TCL_OK;
+ } else if (objc == 3) {
+ TreeItem *newFocus = FindItem(interp, tv, objv[2]);
+ if (!newFocus)
+ return TCL_ERROR;
+ tv->tree.focus = newFocus;
+ TtkRedisplayWidget(&tv->core);
+ return TCL_OK;
+ } else {
+ Tcl_WrongNumArgs(interp, 2, objv, "?newFocus?");
+ return TCL_ERROR;
+ }
+}
+
+/* + $tree selection ?add|remove|set|toggle $items?
+ */
+static int TreeviewSelectionCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ enum {
+ SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE
+ };
+ static const char *selopStrings[] = {
+ "set", "add", "remove", "toggle", NULL
+ };
+
+ Treeview *tv = recordPtr;
+ int selop, i;
+ TreeItem *item, **items;
+
+ if (objc == 2) {
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+ for (item = tv->tree.root->children; item; item=NextPreorder(item)) {
+ if (item->state & TTK_STATE_SELECTED)
+ Tcl_ListObjAppendElement(NULL, result, ItemID(tv, item));
+ }
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ }
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?add|remove|set|toggle items?");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[2], selopStrings,
+ "selection operation", 0, &selop) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+
+ items = GetItemListFromObj(interp, tv, objv[3]);
+ if (!items) {
+ return TCL_ERROR;
+ }
+
+ switch (selop)
+ {
+ case SELECTION_SET:
+ for (item=tv->tree.root; item; item=NextPreorder(item)) {
+ item->state &= ~TTK_STATE_SELECTED;
+ }
+ /*FALLTHRU*/
+ case SELECTION_ADD:
+ for (i=0; items[i]; ++i) {
+ items[i]->state |= TTK_STATE_SELECTED;
+ }
+ break;
+ case SELECTION_REMOVE:
+ for (i=0; items[i]; ++i) {
+ items[i]->state &= ~TTK_STATE_SELECTED;
+ }
+ break;
+ case SELECTION_TOGGLE:
+ for (i=0; items[i]; ++i) {
+ items[i]->state ^= TTK_STATE_SELECTED;
+ }
+ break;
+ }
+
+ ckfree((ClientData)items);
+ TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
+ TtkRedisplayWidget(&tv->core);
+
+ return TCL_OK;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands -- tags and bindings.
+ */
+
+/* + $tv tag bind $tag ?$sequence ?$script??
+ */
+static int TreeviewTagBindCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ Ttk_TagTable tagTable = tv->tree.tagTable;
+ Tk_BindingTable bindingTable = tv->tree.bindingTable;
+ Ttk_Tag tag;
+
+ if (objc < 4 || objc > 6) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName ?sequence? ?script?");
+ return TCL_ERROR;
+ }
+
+ tag = Ttk_GetTagFromObj(tagTable, objv[3]);
+ if (!tag) { return TCL_ERROR; }
+
+ if (objc == 4) { /* $tv tag bind $tag */
+ Tk_GetAllBindings(interp, bindingTable, tag);
+ } else if (objc == 5) { /* $tv tag bind $tag $sequence */
+ /* TODO: distinguish "no such binding" (OK) from "bad pattern" (ERROR)
+ */
+ const char *script = Tk_GetBinding(interp,
+ bindingTable, tag, Tcl_GetString(objv[4]));
+ if (script != NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(script,-1));
+ }
+ } else if (objc == 6) { /* $tv tag bind $tag $sequence $script */
+ const char *sequence = Tcl_GetString(objv[4]);
+ const char *script = Tcl_GetString(objv[5]);
+
+ if (!*script) { /* Delete existing binding */
+ Tk_DeleteBinding(interp, bindingTable, tag, sequence);
+ } else {
+ unsigned long mask = Tk_CreateBinding(interp,
+ bindingTable, tag, sequence, script, 0);
+
+ /* Test mask to make sure event is supported:
+ */
+ if (mask & (~TreeviewBindEventMask)) {
+ Tk_DeleteBinding(interp, bindingTable, tag, sequence);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "unsupported event ", sequence,
+ "\nonly key, button, motion, and virtual events supported",
+ NULL);
+ return TCL_ERROR;
+ }
+ }
+ }
+ return TCL_OK;
+}
+
+/* + $tv tag configure $tag ?-option ?value -option value...??
+ */
+static int TreeviewTagConfigureCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ Ttk_TagTable tagTable = tv->tree.tagTable;
+ Ttk_Tag tag;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName ?-option ?value ...??");
+ return TCL_ERROR;
+ }
+
+ tag = Ttk_GetTagFromObj(tagTable, objv[3]);
+
+ if (objc == 4) {
+ return Ttk_EnumerateTagOptions(interp, tagTable, tag);
+ } else if (objc == 5) {
+ Tcl_Obj *result = Ttk_TagOptionValue(interp, tagTable, tag, objv[4]);
+ if (result) {
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ } /* else */
+ return TCL_ERROR;
+ }
+ /* else */
+ TtkRedisplayWidget(&tv->core);
+ return Ttk_ConfigureTag(interp, tagTable, tag, objc - 4, objv + 4);
+}
+
+/* + $tv tag has $tag ?$item?
+ */
+static int TreeviewTagHasCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+
+ if (objc == 4) { /* Return list of all items with tag */
+ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]);
+ TreeItem *item = tv->tree.root;
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+
+ while (item) {
+ if (Ttk_TagSetContains(item->tagset, tag)) {
+ Tcl_ListObjAppendElement(NULL, result, ItemID(tv, item));
+ }
+ item = NextPreorder(item);
+ }
+
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ } else if (objc == 5) { /* Test if item has specified tag */
+ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]);
+ TreeItem *item = FindItem(interp, tv, objv[4]);
+ if (!item) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj(Ttk_TagSetContains(item->tagset, tag)));
+ return TCL_OK;
+ } else {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName ?item?");
+ return TCL_ERROR;
+ }
+}
+
+/* + $tv tag names $tag
+ */
+static int TreeviewTagNamesCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, "");
+ return TCL_ERROR;
+ }
+
+ return Ttk_EnumerateTags(interp, tv->tree.tagTable);
+}
+
+/* + $tv tag add $tag $items
+ */
+static void AddTag(TreeItem *item, Ttk_Tag tag)
+{
+ if (Ttk_TagSetAdd(item->tagset, tag)) {
+ if (item->tagsObj) Tcl_DecrRefCount(item->tagsObj);
+ item->tagsObj = Ttk_NewTagSetObj(item->tagset);
+ Tcl_IncrRefCount(item->tagsObj);
+ }
+}
+
+static int TreeviewTagAddCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ Ttk_Tag tag;
+ TreeItem **items;
+ int i;
+
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName items");
+ return TCL_ERROR;
+ }
+
+ tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]);
+ items = GetItemListFromObj(interp, tv, objv[4]);
+
+ if (!items) {
+ return TCL_ERROR;
+ }
+
+ for (i=0; items[i]; ++i) {
+ AddTag(items[i], tag);
+ }
+
+ return TCL_OK;
+}
+
+/* + $tv tag remove $tag ?$items?
+ */
+static void RemoveTag(TreeItem *item, Ttk_Tag tag)
+{
+ if (Ttk_TagSetRemove(item->tagset, tag)) {
+ if (item->tagsObj) Tcl_DecrRefCount(item->tagsObj);
+ item->tagsObj = Ttk_NewTagSetObj(item->tagset);
+ Tcl_IncrRefCount(item->tagsObj);
+ }
+}
+
+static int TreeviewTagRemoveCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Treeview *tv = recordPtr;
+ Ttk_Tag tag;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "tagName items");
+ return TCL_ERROR;
+ }
+
+ tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]);
+
+ if (objc == 5) {
+ TreeItem **items = GetItemListFromObj(interp, tv, objv[4]);
+ int i;
+
+ if (!items) {
+ return TCL_ERROR;
+ }
+ for (i=0; items[i]; ++i) {
+ RemoveTag(items[i], tag);
+ }
+ } else if (objc == 4) {
+ TreeItem *item = tv->tree.root;
+ while (item) {
+ RemoveTag(item, tag);
+ item=NextPreorder(item);
+ }
+ }
+ return TCL_OK;
+}
+
+static const Ttk_Ensemble TreeviewTagCommands[] = {
+ { "add", TreeviewTagAddCommand,0 },
+ { "bind", TreeviewTagBindCommand,0 },
+ { "configure", TreeviewTagConfigureCommand,0 },
+ { "has", TreeviewTagHasCommand,0 },
+ { "names", TreeviewTagNamesCommand,0 },
+ { "remove", TreeviewTagRemoveCommand,0 },
+ { 0,0,0 }
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget commands record.
+ */
+static const Ttk_Ensemble TreeviewCommands[] = {
+ { "bbox", TreeviewBBoxCommand,0 },
+ { "children", TreeviewChildrenCommand,0 },
+ { "cget", TtkWidgetCgetCommand,0 },
+ { "column", TreeviewColumnCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "delete", TreeviewDeleteCommand,0 },
+ { "detach", TreeviewDetachCommand,0 },
+ { "drag", TreeviewDragCommand,0 },
+ { "exists", TreeviewExistsCommand,0 },
+ { "focus", TreeviewFocusCommand,0 },
+ { "heading", TreeviewHeadingCommand,0 },
+ { "identify", TreeviewIdentifyCommand,0 },
+ { "index", TreeviewIndexCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
+ { "insert", TreeviewInsertCommand,0 },
+ { "item", TreeviewItemCommand,0 },
+ { "move", TreeviewMoveCommand,0 },
+ { "next", TreeviewNextCommand,0 },
+ { "parent", TreeviewParentCommand,0 },
+ { "prev", TreeviewPrevCommand,0 },
+ { "see", TreeviewSeeCommand,0 },
+ { "selection" , TreeviewSelectionCommand,0 },
+ { "set", TreeviewSetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "tag", 0,TreeviewTagCommands },
+ { "xview", TreeviewXViewCommand,0 },
+ { "yview", TreeviewYViewCommand,0 },
+ { 0,0,0 }
+};
+
+/*------------------------------------------------------------------------
+ * +++ Widget definition.
+ */
+
+static WidgetSpec TreeviewWidgetSpec = {
+ "Treeview", /* className */
+ sizeof(Treeview), /* recordSize */
+ TreeviewOptionSpecs, /* optionSpecs */
+ TreeviewCommands, /* subcommands */
+ TreeviewInitialize, /* initializeProc */
+ TreeviewCleanup, /* cleanupProc */
+ TreeviewConfigure, /* configureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ TreeviewGetLayout, /* getLayoutProc */
+ TreeviewSize, /* sizeProc */
+ TreeviewDoLayout, /* layoutProc */
+ TreeviewDisplay /* displayProc */
+};
+
+/*------------------------------------------------------------------------
+ * +++ Layout specifications.
+ */
+
+TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
+
+TTK_LAYOUT("Treeview",
+ TTK_GROUP("Treeview.field", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Treeview.padding", TTK_FILL_BOTH,
+ TTK_NODE("Treeview.treearea", TTK_FILL_BOTH))))
+
+TTK_LAYOUT("Item",
+ TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH,
+ TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT)
+ TTK_NODE("Treeitem.image", TTK_PACK_LEFT)
+ TTK_GROUP("Treeitem.focus", TTK_PACK_LEFT,
+ TTK_NODE("Treeitem.text", TTK_PACK_LEFT))))
+
+TTK_LAYOUT("Cell",
+ TTK_GROUP("Treedata.padding", TTK_FILL_BOTH,
+ TTK_NODE("Treeitem.text", TTK_FILL_BOTH)))
+
+TTK_LAYOUT("Heading",
+ TTK_NODE("Treeheading.cell", TTK_FILL_BOTH)
+ TTK_GROUP("Treeheading.border", TTK_FILL_BOTH,
+ TTK_GROUP("Treeheading.padding", TTK_FILL_BOTH,
+ TTK_NODE("Treeheading.image", TTK_PACK_RIGHT)
+ TTK_NODE("Treeheading.text", TTK_FILL_X))))
+
+TTK_LAYOUT("Row",
+ TTK_NODE("Treeitem.row", TTK_FILL_BOTH))
+
+TTK_END_LAYOUT_TABLE
+
+/*------------------------------------------------------------------------
+ * +++ Tree indicator element.
+ */
+
+typedef struct {
+ Tcl_Obj *colorObj;
+ Tcl_Obj *sizeObj;
+ Tcl_Obj *marginsObj;
+} TreeitemIndicator;
+
+static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = {
+ { "-foreground", TK_OPTION_COLOR,
+ Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND },
+ { "-indicatorsize", TK_OPTION_PIXELS,
+ Tk_Offset(TreeitemIndicator,sizeObj), "12" },
+ { "-indicatormargins", TK_OPTION_STRING,
+ Tk_Offset(TreeitemIndicator,marginsObj), "2 2 4 2" },
+ { NULL, 0, 0, NULL }
+};
+
+static void TreeitemIndicatorSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TreeitemIndicator *indicator = elementRecord;
+ Ttk_Padding margins;
+ int size = 0;
+
+ Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginsObj, &margins);
+ Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
+
+ *widthPtr = size + Ttk_PaddingWidth(margins);
+ *heightPtr = size + Ttk_PaddingHeight(margins);
+}
+
+static void TreeitemIndicatorDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ TreeitemIndicator *indicator = elementRecord;
+ ArrowDirection direction =
+ (state & TTK_STATE_OPEN) ? ARROW_DOWN : ARROW_RIGHT;
+ Ttk_Padding margins;
+ XColor *borderColor = Tk_GetColorFromObj(tkwin, indicator->colorObj);
+ XGCValues gcvalues; GC gc; unsigned mask;
+
+ if (state & TTK_STATE_LEAF) /* don't draw anything */
+ return;
+
+ Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginsObj,&margins);
+ b = Ttk_PadBox(b, margins);
+
+ gcvalues.foreground = borderColor->pixel;
+ gcvalues.line_width = 1;
+ mask = GCForeground | GCLineWidth;
+ gc = Tk_GetGC(tkwin, mask, &gcvalues);
+
+ TtkDrawArrow(Tk_Display(tkwin), d, gc, b, direction);
+
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+}
+
+static Ttk_ElementSpec TreeitemIndicatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TreeitemIndicator),
+ TreeitemIndicatorOptions,
+ TreeitemIndicatorSize,
+ TreeitemIndicatorDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Row element.
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+ Tcl_Obj *rowNumberObj;
+} RowElement;
+
+static Ttk_ElementOptionSpec RowElementOptions[] = {
+ { "-background", TK_OPTION_COLOR,
+ Tk_Offset(RowElement,backgroundObj), DEFAULT_BACKGROUND },
+ { "-rownumber", TK_OPTION_INT,
+ Tk_Offset(RowElement,rowNumberObj), "0" },
+ { NULL, 0, 0, NULL }
+};
+
+static void RowElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ RowElement *row = elementRecord;
+ XColor *color = Tk_GetColorFromObj(tkwin, row->backgroundObj);
+ GC gc = Tk_GCForColor(color, d);
+ XFillRectangle(Tk_Display(tkwin), d, gc,
+ b.x, b.y, b.width, b.height);
+}
+
+static Ttk_ElementSpec RowElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(RowElement),
+ RowElementOptions,
+ TtkNullElementSize,
+ RowElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Initialisation.
+ */
+
+MODULE_SCOPE
+void TtkTreeview_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ RegisterWidget(interp, "ttk::treeview", &TreeviewWidgetSpec);
+
+ Ttk_RegisterElement(interp, theme, "Treeitem.indicator",
+ &TreeitemIndicatorElementSpec, 0);
+ Ttk_RegisterElement(interp, theme, "Treeitem.row", &RowElementSpec, 0);
+ Ttk_RegisterElement(interp, theme, "Treeheading.cell", &RowElementSpec, 0);
+ Ttk_RegisterElement(interp, theme, "treearea", &ttkNullElementSpec, 0);
+
+ Ttk_RegisterLayouts(theme, LayoutTable);
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
new file mode 100644
index 0000000..d5e0484
--- /dev/null
+++ b/generic/ttk/ttkWidget.c
@@ -0,0 +1,789 @@
+/*
+ * Copyright (c) 2003, Joe English
+ *
+ * Core widget utilities.
+ */
+
+#include <string.h>
+#include <tk.h>
+#include "ttkTheme.h"
+#include "ttkWidget.h"
+
+#ifdef MAC_OSX_TK
+#define TK_NO_DOUBLE_BUFFERING 1
+#endif
+
+/*------------------------------------------------------------------------
+ * +++ Internal helper routines.
+ */
+
+/* UpdateLayout --
+ * Call the widget's get-layout hook to recompute corePtr->layout.
+ * Returns TCL_OK if successful, returns TCL_ERROR and leaves
+ * the layout unchanged otherwise.
+ */
+static int UpdateLayout(Tcl_Interp *interp, WidgetCore *corePtr)
+{
+ Ttk_Theme themePtr = Ttk_GetCurrentTheme(interp);
+ Ttk_Layout newLayout =
+ corePtr->widgetSpec->getLayoutProc(interp, themePtr,corePtr);
+
+ if (newLayout) {
+ if (corePtr->layout) {
+ Ttk_FreeLayout(corePtr->layout);
+ }
+ corePtr->layout = newLayout;
+ return TCL_OK;
+ }
+ return TCL_ERROR;
+}
+
+/* SizeChanged --
+ * Call the widget's sizeProc to compute new requested size
+ * and pass it to the geometry manager.
+ */
+static void SizeChanged(WidgetCore *corePtr)
+{
+ int reqWidth = 1, reqHeight = 1;
+
+ if (corePtr->widgetSpec->sizeProc(corePtr,&reqWidth,&reqHeight)) {
+ Tk_GeometryRequest(corePtr->tkwin, reqWidth, reqHeight);
+ }
+}
+
+#ifndef TK_NO_DOUBLE_BUFFERING
+
+/* BeginDrawing --
+ * Returns a Drawable for drawing the widget contents.
+ * This is normally an off-screen Pixmap, copied to
+ * the window by EndDrawing().
+ */
+static Drawable BeginDrawing(Tk_Window tkwin)
+{
+ return Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
+ Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
+}
+
+/* EndDrawing --
+ * Copy the drawable contents to the screen and release resources.
+ */
+static void EndDrawing(Tk_Window tkwin, Drawable d)
+{
+ XGCValues gcValues;
+ GC gc;
+
+ gcValues.function = GXcopy;
+ gcValues.graphics_exposures = False;
+ gc = Tk_GetGC(tkwin, GCFunction|GCGraphicsExposures, &gcValues);
+
+ XCopyArea(Tk_Display(tkwin), d, Tk_WindowId(tkwin), gc,
+ 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
+ 0, 0);
+
+ Tk_FreePixmap(Tk_Display(tkwin), d);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+}
+#else
+/* No double-buffering: draw directly into the window. */
+static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); }
+static void EndDrawing(Tk_Window tkwin, Drawable d) { }
+#endif
+
+/* DrawWidget --
+ * Redraw a widget. Called as an idle handler.
+ */
+static void DrawWidget(ClientData recordPtr)
+{
+ WidgetCore *corePtr = recordPtr;
+
+ corePtr->flags &= ~REDISPLAY_PENDING;
+ if (Tk_IsMapped(corePtr->tkwin)) {
+ Drawable d = BeginDrawing(corePtr->tkwin);
+ corePtr->widgetSpec->layoutProc(recordPtr);
+ corePtr->widgetSpec->displayProc(recordPtr, d);
+ EndDrawing(corePtr->tkwin, d);
+ }
+}
+
+/* TtkRedisplayWidget --
+ * Schedule redisplay as an idle handler.
+ */
+void TtkRedisplayWidget(WidgetCore *corePtr)
+{
+ if (corePtr->flags & WIDGET_DESTROYED) {
+ return;
+ }
+
+ if (!(corePtr->flags & REDISPLAY_PENDING)) {
+ Tcl_DoWhenIdle(DrawWidget, corePtr);
+ corePtr->flags |= REDISPLAY_PENDING;
+ }
+}
+
+/* TtkResizeWidget --
+ * Recompute widget size, schedule geometry propagation and redisplay.
+ */
+void TtkResizeWidget(WidgetCore *corePtr)
+{
+ if (corePtr->flags & WIDGET_DESTROYED) {
+ return;
+ }
+
+ SizeChanged(corePtr);
+ TtkRedisplayWidget(corePtr);
+}
+
+/* TtkWidgetChangeState --
+ * Set / clear the specified bits in the 'state' flag,
+ */
+void TtkWidgetChangeState(WidgetCore *corePtr,
+ unsigned int setBits, unsigned int clearBits)
+{
+ Ttk_State oldState = corePtr->state;
+ corePtr->state = (oldState & ~clearBits) | setBits;
+ if (corePtr->state ^ oldState) {
+ TtkRedisplayWidget(corePtr);
+ }
+}
+
+/* WidgetInstanceObjCmd --
+ * Widget instance command implementation.
+ */
+static int
+WidgetInstanceObjCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = clientData;
+ const Ttk_Ensemble *commands = corePtr->widgetSpec->commands;
+ int status;
+
+ Tcl_Preserve(clientData);
+ status = Ttk_InvokeEnsemble(commands,1, clientData,interp,objc,objv);
+ Tcl_Release(clientData);
+
+ return status;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Widget destruction.
+ *
+ * A widget can be destroyed when the application explicitly
+ * destroys the window or one of its ancestors via [destroy]
+ * or Tk_DestroyWindow(); when the application deletes the widget
+ * instance command; when there is an error in the widget constructor;
+ * or when another application calls XDestroyWindow on the window ID.
+ *
+ * The window receives a <DestroyNotify> event in all cases,
+ * so we do the bulk of the cleanup there. See [#2207435] for
+ * further notes (esp. re: Tk_FreeConfigOptions).
+ *
+ * Widget code that reenters the interp should only do so
+ * when the widtget is Tcl_Preserve()d, and should check
+ * the WIDGET_DESTROYED flag bit upon return.
+ */
+
+/* WidgetInstanceObjCmdDeleted --
+ * Widget instance command deletion callback.
+ */
+static void
+WidgetInstanceObjCmdDeleted(ClientData clientData)
+{
+ WidgetCore *corePtr = clientData;
+ corePtr->widgetCmd = NULL;
+ if (corePtr->tkwin != NULL)
+ Tk_DestroyWindow(corePtr->tkwin);
+}
+
+/* FreeWidget --
+ * Final cleanup for widget; called via Tcl_EventuallyFree().
+ */
+static void
+FreeWidget(char *memPtr)
+{
+ ckfree(memPtr);
+}
+
+/* DestroyWidget --
+ * Main widget destructor; called from <DestroyNotify> event handler.
+ */
+static void
+DestroyWidget(WidgetCore *corePtr)
+{
+ corePtr->flags |= WIDGET_DESTROYED;
+
+ corePtr->widgetSpec->cleanupProc(corePtr);
+
+ Tk_FreeConfigOptions(
+ (ClientData)corePtr, corePtr->optionTable, corePtr->tkwin);
+
+ if (corePtr->layout) {
+ Ttk_FreeLayout(corePtr->layout);
+ }
+
+ if (corePtr->flags & REDISPLAY_PENDING) {
+ Tcl_CancelIdleCall(DrawWidget, corePtr);
+ }
+
+ corePtr->tkwin = NULL;
+ if (corePtr->widgetCmd) {
+ Tcl_Command cmd = corePtr->widgetCmd;
+ corePtr->widgetCmd = 0;
+ /* NB: this can reenter the interpreter via a command traces */
+ Tcl_DeleteCommandFromToken(corePtr->interp, cmd);
+ }
+ Tcl_EventuallyFree(corePtr, FreeWidget);
+}
+
+/*
+ * CoreEventProc --
+ * Event handler for basic events.
+ * Processes Expose, Configure, FocusIn/Out, and Destroy events.
+ * Also handles <<ThemeChanged>> virtual events.
+ *
+ * For Expose and Configure, simply schedule the widget for redisplay.
+ * For Destroy events, handle the cleanup process.
+ *
+ * For Focus events, set/clear the focus bit in the state field.
+ * It turns out this is impossible to do correctly in a binding script,
+ * because Tk filters out focus events with detail == NotifyInferior.
+ *
+ * For Deactivate/Activate pseudo-events, set/clear the background state
+ * flag.
+ */
+
+static const unsigned CoreEventMask
+ = ExposureMask
+ | StructureNotifyMask
+ | FocusChangeMask
+ | VirtualEventMask
+ | ActivateMask
+ | EnterWindowMask
+ | LeaveWindowMask
+ ;
+
+static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
+{
+ WidgetCore *corePtr = clientData;
+
+ switch (eventPtr->type)
+ {
+ case ConfigureNotify :
+ TtkRedisplayWidget(corePtr);
+ break;
+ case Expose :
+ if (eventPtr->xexpose.count == 0) {
+ TtkRedisplayWidget(corePtr);
+ }
+ break;
+ case DestroyNotify :
+ Tk_DeleteEventHandler(
+ corePtr->tkwin, CoreEventMask,CoreEventProc,clientData);
+ DestroyWidget(corePtr);
+ break;
+ case FocusIn:
+ case FocusOut:
+ /* Don't process "virtual crossing" events */
+ if ( eventPtr->xfocus.detail == NotifyInferior
+ || eventPtr->xfocus.detail == NotifyAncestor
+ || eventPtr->xfocus.detail == NotifyNonlinear)
+ {
+ if (eventPtr->type == FocusIn)
+ corePtr->state |= TTK_STATE_FOCUS;
+ else
+ corePtr->state &= ~TTK_STATE_FOCUS;
+ TtkRedisplayWidget(corePtr);
+ }
+ break;
+ case ActivateNotify:
+ corePtr->state &= ~TTK_STATE_BACKGROUND;
+ TtkRedisplayWidget(corePtr);
+ break;
+ case DeactivateNotify:
+ corePtr->state |= TTK_STATE_BACKGROUND;
+ TtkRedisplayWidget(corePtr);
+ break;
+ case LeaveNotify:
+ corePtr->state &= ~TTK_STATE_HOVER;
+ TtkRedisplayWidget(corePtr);
+ break;
+ case EnterNotify:
+ corePtr->state |= TTK_STATE_HOVER;
+ TtkRedisplayWidget(corePtr);
+ break;
+ case VirtualEvent:
+ if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) {
+ (void)UpdateLayout(corePtr->interp, corePtr);
+ SizeChanged(corePtr);
+ TtkRedisplayWidget(corePtr);
+ }
+ default:
+ /* can't happen... */
+ break;
+ }
+}
+
+/*
+ * WidgetWorldChanged --
+ * Default Tk_ClassWorldChangedProc() for widgets.
+ * Invoked whenever fonts or other system resources are changed;
+ * recomputes geometry.
+ */
+static void WidgetWorldChanged(ClientData clientData)
+{
+ WidgetCore *corePtr = clientData;
+ SizeChanged(corePtr);
+ TtkRedisplayWidget(corePtr);
+}
+
+static Tk_ClassProcs widgetClassProcs = {
+ sizeof(Tk_ClassProcs), /* size */
+ WidgetWorldChanged, /* worldChangedProc */
+ NULL, /* createProc */
+ NULL /* modalProc */
+};
+
+/*
+ * TtkWidgetConstructorObjCmd --
+ * General-purpose widget constructor command implementation.
+ * ClientData is a WidgetSpec *.
+ */
+int TtkWidgetConstructorObjCmd(
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetSpec *widgetSpec = clientData;
+ const char *className = widgetSpec->className;
+ Tk_OptionTable optionTable =
+ Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
+ Tk_Window tkwin;
+ void *recordPtr;
+ WidgetCore *corePtr;
+ Tk_SavedOptions savedOptions;
+ int i;
+
+ if (objc < 2 || objc % 2 == 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
+ return TCL_ERROR;
+ }
+
+ /* Check if a -class option has been specified.
+ * We have to do this before the InitOptions() call,
+ * since InitOptions() is affected by the widget class.
+ */
+ for (i = 2; i < objc; i += 2) {
+ if (!strcmp(Tcl_GetString(objv[i]), "-class")) {
+ className = Tcl_GetString(objv[i+1]);
+ break;
+ }
+ }
+
+ tkwin = Tk_CreateWindowFromPath(
+ interp, Tk_MainWindow(interp), Tcl_GetString(objv[1]), NULL);
+ if (tkwin == NULL)
+ return TCL_ERROR;
+
+ /*
+ * Allocate and initialize the widget record.
+ */
+ recordPtr = ckalloc(widgetSpec->recordSize);
+ memset(recordPtr, 0, widgetSpec->recordSize);
+ corePtr = recordPtr;
+
+ corePtr->tkwin = tkwin;
+ corePtr->interp = interp;
+ corePtr->widgetSpec = widgetSpec;
+ corePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin),
+ WidgetInstanceObjCmd, recordPtr, WidgetInstanceObjCmdDeleted);
+ corePtr->optionTable = optionTable;
+ corePtr->layout = NULL;
+ corePtr->flags = 0;
+ corePtr->state = 0;
+
+ Tk_SetClass(tkwin, className);
+ Tk_SetClassProcs(tkwin, &widgetClassProcs, recordPtr);
+ Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);
+
+ widgetSpec->initializeProc(interp, recordPtr);
+
+ Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);
+
+ /*
+ * Initial configuration.
+ */
+
+ Tcl_Preserve(corePtr);
+ if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK) {
+ goto error;
+ }
+
+ if (Tk_SetOptions(interp, recordPtr, optionTable,
+ objc - 2, objv + 2, tkwin, &savedOptions, NULL) != TCL_OK) {
+ Tk_RestoreSavedOptions(&savedOptions);
+ goto error;
+ } else {
+ Tk_FreeSavedOptions(&savedOptions);
+ }
+ if (widgetSpec->configureProc(interp, recordPtr, ~0) != TCL_OK)
+ goto error;
+ if (widgetSpec->postConfigureProc(interp, recordPtr, ~0) != TCL_OK)
+ goto error;
+
+ if (WidgetDestroyed(corePtr))
+ goto error;
+
+ Tcl_Release(corePtr);
+
+ SizeChanged(corePtr);
+ Tk_MakeWindowExist(tkwin);
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), -1));
+ return TCL_OK;
+
+error:
+ if (WidgetDestroyed(corePtr)) {
+ Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
+ } else {
+ Tk_DestroyWindow(tkwin);
+ }
+ Tcl_Release(corePtr);
+ return TCL_ERROR;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Default implementations for widget hook procedures.
+ */
+
+/* TtkWidgetGetLayout --
+ * Default getLayoutProc.
+ * Looks up the layout based on the -style resource (if specified),
+ * otherwise use the widget class.
+ */
+Ttk_Layout TtkWidgetGetLayout(
+ Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
+{
+ WidgetCore *corePtr = recordPtr;
+ const char *styleName = 0;
+
+ if (corePtr->styleObj)
+ styleName = Tcl_GetString(corePtr->styleObj);
+
+ if (!styleName || *styleName == '\0')
+ styleName = corePtr->widgetSpec->className;
+
+ return Ttk_CreateLayout(interp, themePtr, styleName,
+ recordPtr, corePtr->optionTable, corePtr->tkwin);
+}
+
+/*
+ * TtkWidgetGetOrientedLayout --
+ * Helper routine. Same as TtkWidgetGetLayout, but prefixes
+ * "Horizontal." or "Vertical." to the style name, depending
+ * on the value of the 'orient' option.
+ */
+Ttk_Layout TtkWidgetGetOrientedLayout(
+ Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj)
+{
+ WidgetCore *corePtr = recordPtr;
+ const char *baseStyleName = 0;
+ Tcl_DString styleName;
+ int orient = TTK_ORIENT_HORIZONTAL;
+ Ttk_Layout layout;
+
+ Tcl_DStringInit(&styleName);
+
+ /* Prefix:
+ */
+ Ttk_GetOrientFromObj(NULL, orientObj, &orient);
+ if (orient == TTK_ORIENT_HORIZONTAL)
+ Tcl_DStringAppend(&styleName, "Horizontal.", -1);
+ else
+ Tcl_DStringAppend(&styleName, "Vertical.", -1);
+
+ /* Add base style name:
+ */
+ if (corePtr->styleObj)
+ baseStyleName = Tcl_GetString(corePtr->styleObj);
+ if (!baseStyleName || *baseStyleName == '\0')
+ baseStyleName = corePtr->widgetSpec->className;
+
+ Tcl_DStringAppend(&styleName, baseStyleName, -1);
+
+ /* Create layout:
+ */
+ layout= Ttk_CreateLayout(interp, themePtr, Tcl_DStringValue(&styleName),
+ recordPtr, corePtr->optionTable, corePtr->tkwin);
+
+ Tcl_DStringFree(&styleName);
+
+ return layout;
+}
+
+/* TtkNullInitialize --
+ * Default widget initializeProc (no-op)
+ */
+void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
+{
+}
+
+/* TtkNullPostConfigure --
+ * Default widget postConfigureProc (no-op)
+ */
+int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
+{
+ return TCL_OK;
+}
+
+/* TtkCoreConfigure --
+ * Default widget configureProc.
+ * Handles -style option.
+ */
+int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask)
+{
+ WidgetCore *corePtr = clientData;
+ int status = TCL_OK;
+
+ if (mask & STYLE_CHANGED) {
+ status = UpdateLayout(interp, corePtr);
+ }
+
+ return status;
+}
+
+/* TtkNullCleanup --
+ * Default widget cleanupProc (no-op)
+ */
+void TtkNullCleanup(void *recordPtr)
+{
+ return;
+}
+
+/* TtkWidgetDoLayout --
+ * Default widget layoutProc.
+ */
+void TtkWidgetDoLayout(void *clientData)
+{
+ WidgetCore *corePtr = clientData;
+ Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
+}
+
+/* TtkWidgetDisplay --
+ * Default widget displayProc.
+ */
+void TtkWidgetDisplay(void *recordPtr, Drawable d)
+{
+ WidgetCore *corePtr = recordPtr;
+ Ttk_DrawLayout(corePtr->layout, corePtr->state, d);
+}
+
+/* TtkWidgetSize --
+ * Default widget sizeProc()
+ */
+int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
+{
+ WidgetCore *corePtr = recordPtr;
+ Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);
+ return 1;
+}
+
+/*------------------------------------------------------------------------
+ * +++ Default implementations for widget subcommands.
+ */
+
+/* $w cget -option
+ */
+int TtkWidgetCgetCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = recordPtr;
+ Tcl_Obj *result;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ return TCL_ERROR;
+ }
+ result = Tk_GetOptionValue(interp, recordPtr,
+ corePtr->optionTable, objv[2], corePtr->tkwin);
+ if (result == NULL)
+ return TCL_ERROR;
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+}
+
+/* $w configure ?-option ?value ....??
+ */
+int TtkWidgetConfigureCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = recordPtr;
+ Tcl_Obj *result;
+
+ if (objc == 2) {
+ result = Tk_GetOptionInfo(interp, recordPtr,
+ corePtr->optionTable, NULL, corePtr->tkwin);
+ } else if (objc == 3) {
+ result = Tk_GetOptionInfo(interp, recordPtr,
+ corePtr->optionTable, objv[2], corePtr->tkwin);
+ } else {
+ Tk_SavedOptions savedOptions;
+ int status;
+ int mask = 0;
+
+ status = Tk_SetOptions(interp, recordPtr,
+ corePtr->optionTable, objc - 2, objv + 2,
+ corePtr->tkwin, &savedOptions, &mask);
+ if (status != TCL_OK)
+ return status;
+
+ if (mask & READONLY_OPTION) {
+ Tcl_SetResult(interp,
+ "Attempt to change read-only option", TCL_STATIC);
+ Tk_RestoreSavedOptions(&savedOptions);
+ return TCL_ERROR;
+ }
+
+ status = corePtr->widgetSpec->configureProc(interp, recordPtr, mask);
+ if (status != TCL_OK) {
+ Tk_RestoreSavedOptions(&savedOptions);
+ return status;
+ }
+ Tk_FreeSavedOptions(&savedOptions);
+
+ status = corePtr->widgetSpec->postConfigureProc(interp,recordPtr,mask);
+ if (WidgetDestroyed(corePtr)) {
+ Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
+ status = TCL_ERROR;
+ }
+ if (status != TCL_OK) {
+ return status;
+ }
+
+ if (mask & (STYLE_CHANGED | GEOMETRY_CHANGED)) {
+ SizeChanged(corePtr);
+ }
+
+ TtkRedisplayWidget(corePtr);
+ result = Tcl_NewObj();
+ }
+
+ if (result == 0) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+}
+
+/* $w state ? $stateSpec ?
+ *
+ * If $stateSpec is specified, modify the widget state accordingly,
+ * return a new stateSpec representing the changed bits.
+ *
+ * Otherwise, return a statespec matching all the currently-set bits.
+ */
+
+int TtkWidgetStateCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = recordPtr;
+ Ttk_StateSpec spec;
+ int status;
+ Ttk_State oldState, changed;
+
+ if (objc == 2) {
+ Tcl_SetObjResult(interp,
+ Ttk_NewStateSpecObj(corePtr->state, 0ul));
+ return TCL_OK;
+ }
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "state-spec");
+ return TCL_ERROR;
+ }
+ status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec);
+ if (status != TCL_OK)
+ return status;
+
+ oldState = corePtr->state;
+ corePtr->state = Ttk_ModifyState(corePtr->state, &spec);
+ changed = corePtr->state ^ oldState;
+
+ TtkRedisplayWidget(corePtr);
+
+ Tcl_SetObjResult(interp,
+ Ttk_NewStateSpecObj(oldState & changed, ~oldState & changed));
+ return status;
+}
+
+/* $w instate $stateSpec ?$script?
+ *
+ * Tests if widget state matches $stateSpec.
+ * If $script is specified, execute script if state matches.
+ * Otherwise, return true/false
+ */
+
+int TtkWidgetInstateCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = recordPtr;
+ Ttk_State state = corePtr->state;
+ Ttk_StateSpec spec;
+ int status = TCL_OK;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "state-spec ?script?");
+ return TCL_ERROR;
+ }
+ status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec);
+ if (status != TCL_OK)
+ return status;
+
+ if (objc == 3) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj(Ttk_StateMatches(state,&spec)));
+ } else if (objc == 4) {
+ if (Ttk_StateMatches(state,&spec)) {
+ status = Tcl_EvalObjEx(interp, objv[3], 0);
+ }
+ }
+ return status;
+}
+
+/* $w identify $x $y
+ * $w identify element $x $y
+ * Returns: name of element at $x, $y
+ */
+int TtkWidgetIdentifyCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = recordPtr;
+ Ttk_Element element;
+ static const char *whatTable[] = { "element", NULL };
+ int x, y, what;
+
+ if (objc < 4 || objc > 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?what? x y");
+ return TCL_ERROR;
+ }
+ if (objc == 5) {
+ /* $w identify element $x $y */
+ if (Tcl_GetIndexFromObj(interp,objv[2],whatTable,"option",0,&what)
+ != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+ }
+
+ if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
+ ) {
+ return TCL_ERROR;
+ }
+
+ element = Ttk_IdentifyElement(corePtr->layout, x, y);
+ if (element) {
+ const char *elementName = Ttk_ElementName(element);
+ Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1));
+ }
+
+ return TCL_OK;
+}
+
+/*EOF*/
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
new file mode 100644
index 0000000..9e9ab69
--- /dev/null
+++ b/generic/ttk/ttkWidget.h
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2003, Joe English
+ * Helper routines for widget implementations.
+ */
+
+#ifndef _TTKWIDGET
+#define _TTKWIDGET
+
+/*
+ * State flags for 'flags' field.
+ */
+#define WIDGET_DESTROYED 0x0001
+#define REDISPLAY_PENDING 0x0002 /* scheduled call to RedisplayWidget */
+#define CURSOR_ON 0x0020 /* See TtkBlinkCursor() */
+#define WIDGET_USER_FLAG 0x0100 /* 0x0100 - 0x8000 for user flags */
+
+/*
+ * Bit fields for OptionSpec 'mask' field:
+ */
+#define READONLY_OPTION 0x1
+#define STYLE_CHANGED 0x2
+#define GEOMETRY_CHANGED 0x4
+
+/*
+ * Core widget elements
+ */
+typedef struct WidgetSpec_ WidgetSpec; /* Forward */
+
+typedef struct
+{
+ Tk_Window tkwin; /* Window associated with widget */
+ Tcl_Interp *interp; /* Interpreter associated with widget. */
+ WidgetSpec *widgetSpec; /* Widget class hooks */
+ Tcl_Command widgetCmd; /* Token for widget command. */
+ Tk_OptionTable optionTable; /* Option table */
+ Ttk_Layout layout; /* Widget layout */
+
+ /*
+ * Storage for resources:
+ */
+ Tcl_Obj *takeFocusPtr; /* Storage for -takefocus option */
+ Tcl_Obj *cursorObj; /* Storage for -cursor option */
+ Tcl_Obj *styleObj; /* Name of currently-applied style */
+ Tcl_Obj *classObj; /* Class name (readonly option) */
+
+ Ttk_State state; /* Current widget state */
+ unsigned int flags; /* internal flags, see above */
+
+} WidgetCore;
+
+/*
+ * Widget specifications:
+ */
+struct WidgetSpec_
+{
+ const char *className; /* Widget class name */
+ size_t recordSize; /* #bytes in widget record */
+ const Tk_OptionSpec *optionSpecs; /* Option specifications */
+ const Ttk_Ensemble *commands; /* Widget instance subcommands */
+
+ /*
+ * Hooks:
+ */
+ void (*initializeProc)(Tcl_Interp *, void *recordPtr);
+ void (*cleanupProc)(void *recordPtr);
+ int (*configureProc)(Tcl_Interp *, void *recordPtr, int flags);
+ int (*postConfigureProc)(Tcl_Interp *, void *recordPtr, int flags);
+ Ttk_Layout (*getLayoutProc)(Tcl_Interp *,Ttk_Theme, void *recordPtr);
+ int (*sizeProc)(void *recordPtr, int *widthPtr, int *heightPtr);
+ void (*layoutProc)(void *recordPtr);
+ void (*displayProc)(void *recordPtr, Drawable d);
+};
+
+/*
+ * Common factors for widget implementations:
+ */
+MODULE_SCOPE void TtkNullInitialize(Tcl_Interp *, void *);
+MODULE_SCOPE int TtkNullPostConfigure(Tcl_Interp *, void *, int);
+MODULE_SCOPE void TtkNullCleanup(void *recordPtr);
+MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout(
+ Tcl_Interp *, Ttk_Theme, void *recordPtr);
+MODULE_SCOPE Ttk_Layout TtkWidgetGetOrientedLayout(
+ Tcl_Interp *, Ttk_Theme, void *recordPtr, Tcl_Obj *orientObj);
+MODULE_SCOPE int TtkWidgetSize(void *recordPtr, int *w, int *h);
+MODULE_SCOPE void TtkWidgetDoLayout(void *recordPtr);
+MODULE_SCOPE void TtkWidgetDisplay(void *recordPtr, Drawable);
+
+MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask);
+
+/* Common widget commands:
+ */
+MODULE_SCOPE int TtkWidgetConfigureCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
+MODULE_SCOPE int TtkWidgetCgetCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
+MODULE_SCOPE int TtkWidgetInstateCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
+MODULE_SCOPE int TtkWidgetStateCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
+MODULE_SCOPE int TtkWidgetIdentifyCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
+
+/* Widget constructor:
+ */
+MODULE_SCOPE int TtkWidgetConstructorObjCmd(
+ ClientData, Tcl_Interp*, int, Tcl_Obj*const[]);
+
+#define RegisterWidget(interp, name, specPtr) \
+ Tcl_CreateObjCommand(interp, name, \
+ TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL)
+
+/* WIDGET_TAKEFOCUS_TRUE --
+ * WIDGET_TAKEFOCUS_FALSE --
+ * Add one or the other of these to each OptionSpecs table
+ * to indicate whether the widget should take focus
+ * during keyboard traversal.
+ */
+#define WIDGET_TAKEFOCUS_TRUE \
+ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \
+ "ttk::takefocus", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 }
+#define WIDGET_TAKEFOCUS_FALSE \
+ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \
+ "", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 }
+
+/* WIDGET_INHERIT_OPTIONS(baseOptionSpecs) --
+ * Add this at the end of an OptionSpecs table to inherit
+ * the options from 'baseOptionSpecs'.
+ */
+#define WIDGET_INHERIT_OPTIONS(baseOptionSpecs) \
+ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0, (ClientData)baseOptionSpecs, 0}
+
+/* All widgets should inherit from ttkCoreOptionSpecs[].
+ */
+MODULE_SCOPE Tk_OptionSpec ttkCoreOptionSpecs[];
+
+/*
+ * Useful routines for use inside widget implementations:
+ */
+/* extern int WidgetDestroyed(WidgetCore *); */
+#define WidgetDestroyed(corePtr) ((corePtr)->flags & WIDGET_DESTROYED)
+
+MODULE_SCOPE void TtkWidgetChangeState(WidgetCore *,
+ unsigned int setBits, unsigned int clearBits);
+
+MODULE_SCOPE void TtkRedisplayWidget(WidgetCore *);
+MODULE_SCOPE void TtkResizeWidget(WidgetCore *);
+
+MODULE_SCOPE void TtkTrackElementState(WidgetCore *);
+MODULE_SCOPE void TtkBlinkCursor(WidgetCore *);
+
+/*
+ * -state option values (compatibility)
+ */
+MODULE_SCOPE void TtkCheckStateOption(WidgetCore *, Tcl_Obj *);
+
+/*
+ * Variable traces:
+ */
+typedef void (*Ttk_TraceProc)(void *recordPtr, const char *value);
+typedef struct TtkTraceHandle_ Ttk_TraceHandle;
+
+MODULE_SCOPE Ttk_TraceHandle *Ttk_TraceVariable(
+ Tcl_Interp*, Tcl_Obj *varnameObj, Ttk_TraceProc callback, void *clientData);
+MODULE_SCOPE void Ttk_UntraceVariable(Ttk_TraceHandle *);
+MODULE_SCOPE int Ttk_FireTrace(Ttk_TraceHandle *);
+
+/*
+ * Virtual events:
+ */
+MODULE_SCOPE void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName);
+
+/*
+ * Helper routines for data accessor commands:
+ */
+MODULE_SCOPE int TtkEnumerateOptions(
+ Tcl_Interp *, void *, const Tk_OptionSpec *, Tk_OptionTable, Tk_Window);
+MODULE_SCOPE int TtkGetOptionValue(
+ Tcl_Interp *, void *, Tcl_Obj *optName, Tk_OptionTable, Tk_Window);
+
+/*
+ * Helper routines for scrolling widgets (see scroll.c).
+ */
+typedef struct {
+ int first; /* First visible item */
+ int last; /* Last visible item */
+ int total; /* Total #items */
+ char *scrollCmd; /* Widget option */
+} Scrollable;
+
+typedef struct ScrollHandleRec *ScrollHandle;
+
+MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *);
+MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle);
+
+MODULE_SCOPE int TtkScrollviewCommand(
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle);
+
+MODULE_SCOPE void TtkScrollTo(ScrollHandle, int newFirst);
+MODULE_SCOPE void TtkScrolled(ScrollHandle, int first, int last, int total);
+MODULE_SCOPE void TtkScrollbarUpdateRequired(ScrollHandle);
+
+/*
+ * Tag sets (work in progress, half-baked)
+ */
+
+typedef struct TtkTag *Ttk_Tag;
+typedef struct TtkTagTable *Ttk_TagTable;
+typedef struct TtkTagSet { /* TODO: make opaque */
+ Ttk_Tag *tags;
+ int nTags;
+} *Ttk_TagSet;
+
+MODULE_SCOPE Ttk_TagTable Ttk_CreateTagTable(
+ Tcl_Interp *, Tk_Window tkwin, Tk_OptionSpec[], int recordSize);
+MODULE_SCOPE void Ttk_DeleteTagTable(Ttk_TagTable);
+
+MODULE_SCOPE Ttk_Tag Ttk_GetTag(Ttk_TagTable, const char *tagName);
+MODULE_SCOPE Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable, Tcl_Obj *);
+
+MODULE_SCOPE Tcl_Obj *Ttk_TagOptionValue(
+ Tcl_Interp *, Ttk_TagTable, Ttk_Tag, Tcl_Obj *optionName);
+
+MODULE_SCOPE int Ttk_EnumerateTagOptions(
+ Tcl_Interp *, Ttk_TagTable, Ttk_Tag);
+
+MODULE_SCOPE int Ttk_EnumerateTags(Tcl_Interp *, Ttk_TagTable);
+
+MODULE_SCOPE int Ttk_ConfigureTag(
+ Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag,
+ int objc, Tcl_Obj *const objv[]);
+
+MODULE_SCOPE Ttk_TagSet Ttk_GetTagSetFromObj(
+ Tcl_Interp *interp, Ttk_TagTable, Tcl_Obj *objPtr);
+MODULE_SCOPE Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet);
+
+MODULE_SCOPE void Ttk_FreeTagSet(Ttk_TagSet);
+
+MODULE_SCOPE int Ttk_TagSetContains(Ttk_TagSet, Ttk_Tag tag);
+MODULE_SCOPE int Ttk_TagSetAdd(Ttk_TagSet, Ttk_Tag tag);
+MODULE_SCOPE int Ttk_TagSetRemove(Ttk_TagSet, Ttk_Tag tag);
+
+MODULE_SCOPE void Ttk_TagSetValues(Ttk_TagTable, Ttk_TagSet, void *record);
+MODULE_SCOPE void Ttk_TagSetApplyStyle(Ttk_TagTable,Ttk_Style,Ttk_State,void*);
+
+/*
+ * String tables for widget resource specifications:
+ */
+
+MODULE_SCOPE const char *ttkOrientStrings[];
+MODULE_SCOPE const char *ttkCompoundStrings[];
+MODULE_SCOPE const char *ttkDefaultStrings[];
+
+/*
+ * ... other option types...
+ */
+MODULE_SCOPE int TtkGetLabelAnchorFromObj(
+ Tcl_Interp*, Tcl_Obj*, Ttk_PositionSpec *);
+
+/*
+ * Platform-specific initialization.
+ */
+
+#if defined(__WIN32__)
+#define Ttk_PlatformInit Ttk_WinPlatformInit
+MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *);
+#elif defined(MAC_OSX_TK)
+#define Ttk_PlatformInit Ttk_MacOSXPlatformInit
+MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *);
+#else
+#define Ttk_PlatformInit(interp) /* TTK_X11PlatformInit() */
+#endif
+
+#endif /* _TTKWIDGET */
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index 4ecabd8..a9e7d30 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -7,6 +7,7 @@
# Donal K. Fellows.
#
# Copyright (c) 1998-2000 by Ajuba Solutions.
+# Copyright (c) 2007 by ActiveState Software Inc.
# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
namespace eval ::tk::dialog::error {
@@ -15,6 +16,7 @@ namespace eval ::tk::dialog::error {
option add *ErrorDialog.function.text [mc "Save To Log"] \
widgetDefault
option add *ErrorDialog.function.command [namespace code SaveToLog]
+ option add *ErrorDialog*Label.font TkCaptionFont widgetDefault
if {[tk windowingsystem] eq "aqua"} {
option add *ErrorDialog*background systemAlertBackgroundActive \
widgetDefault
@@ -40,7 +42,7 @@ proc ::tk::dialog::error::Details {} {
if { ($caption eq "") || ($command eq "") } {
grid forget $w.function
}
- lappend command [.bgerrorDialog.top.info.text get 1.0 end-1c]
+ lappend command [$w.top.info.text get 1.0 end-1c]
$w.function configure -text $caption -command $command
grid $w.top.info - -sticky nsew -padx 3m -pady 3m
}
@@ -93,29 +95,21 @@ proc ::tk::dialog::error::bgerror err {
# Ok the application's tkerror either failed or was not found
# we use the default dialog then :
set windowingsystem [tk windowingsystem]
-
- if {($tcl_platform(platform) eq "macintosh")
- || ($windowingsystem eq "aqua")} {
- set ok [mc Ok]
- set messageFont system
- set textRelief flat
- set textHilight 0
+ if {$windowingsystem eq "aqua"} {
+ set ok [mc Ok]
} else {
- set ok [mc OK]
- set messageFont {Times -18}
- set textRelief sunken
- set textHilight 1
+ set ok [mc OK]
}
-
- # Truncate the message if it is too wide (longer than 30 characacters) or
- # too tall (more than 4 newlines). Truncation occurs at the first point at
+ # Truncate the message if it is too wide (>maxLine characters) or
+ # too tall (>4 lines). Truncation occurs at the first point at
# which one of those conditions is met.
set displayedErr ""
set lines 0
+ set maxLine 45
foreach line [split $err \n] {
- if { [string length $line] > 30 } {
- append displayedErr "[string range $line 0 29]..."
+ if { [string length $line] > $maxLine } {
+ append displayedErr "[string range $line 0 [expr {$maxLine-3}]]..."
break
}
if { $lines > 4 } {
@@ -127,50 +121,42 @@ proc ::tk::dialog::error::bgerror err {
incr lines
}
- set w .bgerrorDialog
set title [mc "Application Error"]
- set text [mc {Error: %1$s} $displayedErr]
+ set text [mc "Error: %1\$s" $displayedErr]
set buttons [list ok $ok dismiss [mc "Skip Messages"] \
- function [mc "Details >>"]]
+ function [mc "Details >>"]]
# 1. Create the top-level window and divide it into top
# and bottom parts.
- destroy .bgerrorDialog
- toplevel .bgerrorDialog -class ErrorDialog
- wm withdraw .bgerrorDialog
- wm title .bgerrorDialog $title
- wm iconname .bgerrorDialog ErrorDialog
- wm protocol .bgerrorDialog WM_DELETE_WINDOW { }
+ set dlg .bgerrorDialog
+ destroy $dlg
+ toplevel $dlg -class ErrorDialog
+ wm withdraw $dlg
+ wm title $dlg $title
+ wm iconname $dlg ErrorDialog
+ wm protocol $dlg WM_DELETE_WINDOW { }
- if {($tcl_platform(platform) eq "macintosh")
- || ($windowingsystem eq "aqua")} {
- ::tk::unsupported::MacWindowStyle style .bgerrorDialog moveableAlert {}
+ if {$windowingsystem eq "aqua"} {
+ ::tk::unsupported::MacWindowStyle style $dlg moveableAlert {}
} elseif {$windowingsystem eq "x11"} {
- wm attributes .bgerrorDialog -type dialog
+ wm attributes $dlg -type dialog
}
- frame .bgerrorDialog.bot
- frame .bgerrorDialog.top
+ frame $dlg.bot
+ frame $dlg.top
if {$windowingsystem eq "x11"} {
- .bgerrorDialog.bot configure -relief raised -bd 1
- .bgerrorDialog.top configure -relief raised -bd 1
+ $dlg.bot configure -relief raised -bd 1
+ $dlg.top configure -relief raised -bd 1
}
- pack .bgerrorDialog.bot -side bottom -fill both
- pack .bgerrorDialog.top -side top -fill both -expand 1
-
- set W [frame $w.top.info]
- text $W.text \
- -yscrollcommand [list $W.scroll set]\
- -setgrid true \
- -width 40 \
- -height 10 \
- -state normal \
- -relief $textRelief \
- -highlightthickness $textHilight \
- -wrap char
- if {$windowingsystem eq "aqua"} {
- $W.text configure -width 80 -background white
+ pack $dlg.bot -side bottom -fill both
+ pack $dlg.top -side top -fill both -expand 1
+
+ set W [frame $dlg.top.info]
+ text $W.text -setgrid true -height 10 -wrap char \
+ -yscrollcommand [list $W.scroll set]
+ if {$windowingsystem ne "aqua"} {
+ $W.text configure -width 40
}
scrollbar $W.scroll -command [list $W.text yview]
@@ -184,83 +170,68 @@ proc ::tk::dialog::error::bgerror err {
# 2. Fill the top part with bitmap and message
# Max-width of message is the width of the screen...
- set wrapwidth [winfo screenwidth .bgerrorDialog]
+ set wrapwidth [winfo screenwidth $dlg]
# ...minus the width of the icon, padding and a fudge factor for
# the window manager decorations and aesthetics.
- set wrapwidth [expr {$wrapwidth-60-[winfo pixels .bgerrorDialog 9m]}]
- label .bgerrorDialog.msg -justify left -text $text -font $messageFont \
- -wraplength $wrapwidth
- if {($tcl_platform(platform) eq "macintosh")
- || ($windowingsystem eq "aqua")} {
+ set wrapwidth [expr {$wrapwidth-60-[winfo pixels $dlg 9m]}]
+ label $dlg.msg -justify left -text $text -wraplength $wrapwidth
+ if {$windowingsystem eq "aqua"} {
# On the Macintosh, use the stop bitmap
- label .bgerrorDialog.bitmap -bitmap stop
+ label $dlg.bitmap -bitmap stop
} else {
# On other platforms, make the error icon
- canvas .bgerrorDialog.bitmap -width 32 -height 32 -highlightthickness 0
- .bgerrorDialog.bitmap create oval 0 0 31 31 -fill red -outline black
- .bgerrorDialog.bitmap create line 9 9 23 23 -fill white -width 4
- .bgerrorDialog.bitmap create line 9 23 23 9 -fill white -width 4
+ canvas $dlg.bitmap -width 32 -height 32 -highlightthickness 0
+ $dlg.bitmap create oval 0 0 31 31 -fill red -outline black
+ $dlg.bitmap create line 9 9 23 23 -fill white -width 4
+ $dlg.bitmap create line 9 23 23 9 -fill white -width 4
}
- grid .bgerrorDialog.bitmap .bgerrorDialog.msg \
- -in .bgerrorDialog.top \
- -row 0 \
- -padx 3m \
- -pady 3m
- grid configure .bgerrorDialog.msg -sticky nsw -padx {0 3m}
- grid rowconfigure .bgerrorDialog.top 1 -weight 1
- grid columnconfigure .bgerrorDialog.top 1 -weight 1
+ grid $dlg.bitmap $dlg.msg -in $dlg.top -row 0 -padx 3m -pady 3m
+ grid configure $dlg.msg -sticky nsw -padx {0 3m}
+ grid rowconfigure $dlg.top 1 -weight 1
+ grid columnconfigure $dlg.top 1 -weight 1
# 3. Create a row of buttons at the bottom of the dialog.
set i 0
foreach {name caption} $buttons {
- button .bgerrorDialog.$name \
- -text $caption \
- -default normal \
- -command [namespace code [list set button $i]]
- grid .bgerrorDialog.$name \
- -in .bgerrorDialog.bot \
- -column $i \
- -row 0 \
- -sticky ew \
- -padx 10
- grid columnconfigure .bgerrorDialog.bot $i -weight 1
+ button $dlg.$name -text $caption -default normal \
+ -command [namespace code [list set button $i]]
+ grid $dlg.$name -in $dlg.bot -column $i -row 0 -sticky ew -padx 10
+ grid columnconfigure $dlg.bot $i -weight 1
# We boost the size of some Mac buttons for l&f
- if {($tcl_platform(platform) eq "macintosh")
- || ($windowingsystem eq "aqua")} {
+ if {$windowingsystem eq "aqua"} {
if {($name eq "ok") || ($name eq "dismiss")} {
- grid columnconfigure .bgerrorDialog.bot $i -minsize 90
+ grid columnconfigure $dlg.bot $i -minsize 90
}
- grid configure .bgerrorDialog.$name -pady 7
+ grid configure $dlg.$name -pady 7
}
incr i
}
# The "OK" button is the default for this dialog.
- .bgerrorDialog.ok configure -default active
+ $dlg.ok configure -default active
- bind .bgerrorDialog <Return> [namespace code Return]
- bind .bgerrorDialog <Destroy> [namespace code [list Destroy %W]]
- .bgerrorDialog.function configure -command [namespace code Details]
+ bind $dlg <Return> [namespace code Return]
+ bind $dlg <Destroy> [namespace code [list Destroy %W]]
+ $dlg.function configure -command [namespace code Details]
- # 6. Update all the geometry information so we know how big it wants
- # to be, then center the window in the display and deiconify it.
+ # 6. Place the window (centered in the display) and deiconify it.
- ::tk::PlaceWindow .bgerrorDialog
+ ::tk::PlaceWindow $dlg
# 7. Ensure that we are topmost.
- raise .bgerrorDialog
+ raise $dlg
if {$tcl_platform(platform) eq "windows"} {
# Place it topmost if we aren't at the top of the stacking
# order to ensure that it's seen
- if {[lindex [wm stackorder .] end] ne ".bgerrorDialog"} {
- wm attributes .bgerrorDialog -topmost 1
+ if {[lindex [wm stackorder .] end] ne "$dlg"} {
+ wm attributes $dlg -topmost 1
}
}
# 8. Set a grab and claim the focus too.
- ::tk::SetFocusGrab .bgerrorDialog .bgerrorDialog.ok
+ ::tk::SetFocusGrab $dlg $dlg.ok
# 9. Wait for the user to respond, then restore the focus and
# return the index of the selected button. Restore the focus
@@ -271,7 +242,7 @@ proc ::tk::dialog::error::bgerror err {
vwait [namespace which -variable button]
set copy $button; # Save a copy...
- ::tk::RestoreFocusGrab .bgerrorDialog .bgerrorDialog.ok destroy
+ ::tk::RestoreFocusGrab $dlg $dlg.ok destroy
if {$copy == 1} {
return -code break
diff --git a/library/button.tcl b/library/button.tcl
index 0da95f0..b817b76 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -16,7 +16,7 @@
# The code below creates the default class bindings for buttons.
#-------------------------------------------------------------------------
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
+if {[tk windowingsystem] eq "aqua"} {
bind Radiobutton <Enter> {
tk::ButtonEnter %W
}
@@ -35,6 +35,9 @@ if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Checkbutton <ButtonRelease-1> {
tk::ButtonUp %W
}
+ bind Checkbutton <Leave> {
+ tk::ButtonLeave %W
+ }
}
if {"windows" eq $tcl_platform(platform)} {
bind Checkbutton <equal> {
@@ -55,6 +58,9 @@ if {"windows" eq $tcl_platform(platform)} {
bind Checkbutton <Enter> {
tk::CheckRadioEnter %W
}
+ bind Checkbutton <Leave> {
+ tk::ButtonLeave %W
+ }
bind Radiobutton <1> {
tk::CheckRadioDown %W
@@ -69,7 +75,7 @@ if {"windows" eq $tcl_platform(platform)} {
if {"x11" eq [tk windowingsystem]} {
bind Checkbutton <Return> {
if {!$tk_strictMotif} {
- tk::CheckRadioInvoke %W
+ tk::CheckInvoke %W
}
}
bind Radiobutton <Return> {
@@ -78,17 +84,20 @@ if {"x11" eq [tk windowingsystem]} {
}
}
bind Checkbutton <1> {
- tk::CheckRadioInvoke %W
+ tk::CheckInvoke %W
}
bind Radiobutton <1> {
tk::CheckRadioInvoke %W
}
bind Checkbutton <Enter> {
- tk::ButtonEnter %W
+ tk::CheckEnter %W
}
bind Radiobutton <Enter> {
tk::ButtonEnter %W
}
+ bind Checkbutton <Leave> {
+ tk::CheckLeave %W
+ }
}
bind Button <space> {
@@ -116,9 +125,6 @@ bind Button <ButtonRelease-1> {
}
bind Checkbutton <FocusIn> {}
-bind Checkbutton <Leave> {
- tk::ButtonLeave %W
-}
bind Radiobutton <FocusIn> {}
bind Radiobutton <Leave> {
@@ -442,7 +448,7 @@ proc ::tk::ButtonUp w {
}
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
+if {[tk windowingsystem] eq "aqua"} {
####################
# Mac implementation
@@ -633,3 +639,110 @@ proc ::tk::CheckRadioInvoke {w {cmd invoke}} {
uplevel #0 [list $w $cmd]
}
}
+
+# Special versions of the handlers for checkbuttons on Unix that do the magic
+# to make things work right when the checkbutton indicator is hidden;
+# radiobuttons don't need this complexity.
+
+# ::tk::CheckInvoke --
+# The procedure below invokes the checkbutton, like ButtonInvoke, but handles
+# what to do when the checkbutton indicator is missing. Only used on Unix.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc ::tk::CheckInvoke {w} {
+ variable ::tk::Priv
+ if {[$w cget -state] ne "disabled"} {
+ # Additional logic to switch the "selected" colors around if necessary
+ # (when we're indicator-less).
+
+ if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
+ if {[$w cget -selectcolor] eq $Priv($w,aselectcolor)} {
+ $w configure -selectcolor $Priv($w,selectcolor)
+ } else {
+ $w configure -selectcolor $Priv($w,aselectcolor)
+ }
+ }
+ uplevel #0 [list $w invoke]
+ }
+}
+
+# ::tk::CheckEnter --
+# The procedure below enters the checkbutton, like ButtonEnter, but handles
+# what to do when the checkbutton indicator is missing. Only used on Unix.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc ::tk::CheckEnter {w} {
+ variable ::tk::Priv
+ if {[$w cget -state] ne "disabled"} {
+ # On unix the state is active just with mouse-over
+ $w configure -state active
+
+ # If the mouse button is down, set the relief to sunken on entry.
+ # Overwise, if there's an -overrelief value, set the relief to that.
+
+ set Priv($w,relief) [$w cget -relief]
+ if {$Priv(buttonWindow) eq $w} {
+ $w configure -relief sunken
+ set Priv($w,prelief) sunken
+ } elseif {[set over [$w cget -overrelief]] ne ""} {
+ $w configure -relief $over
+ set Priv($w,prelief) $over
+ }
+
+ # Compute what the "selected and active" color should be.
+
+ if {![$w cget -indicatoron] && [$w cget -selectcolor] ne ""} {
+ set Priv($w,selectcolor) [$w cget -selectcolor]
+ lassign [winfo rgb $w [$w cget -selectcolor]] r1 g1 b1
+ lassign [winfo rgb $w [$w cget -activebackground]] r2 g2 b2
+ set Priv($w,aselectcolor) \
+ [format "#%04x%04x%04x" [expr {($r1+$r2)/2}] \
+ [expr {($g1+$g2)/2}] [expr {($b1+$b2)/2}]]
+ # use uplevel to work with other var resolvers
+ if {[uplevel #0 [list set [$w cget -variable]]]
+ eq [$w cget -onvalue]} {
+ $w configure -selectcolor $Priv($w,aselectcolor)
+ }
+ }
+ }
+ set Priv(window) $w
+}
+
+# ::tk::CheckLeave --
+# The procedure below leaves the checkbutton, like ButtonLeave, but handles
+# what to do when the checkbutton indicator is missing. Only used on Unix.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc ::tk::CheckLeave {w} {
+ variable ::tk::Priv
+ if {[$w cget -state] ne "disabled"} {
+ $w configure -state normal
+ }
+
+ # Restore the original button "selected" color; assume that the user
+ # wasn't monkeying around with things too much.
+
+ if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
+ $w configure -selectcolor $Priv($w,selectcolor)
+ }
+ unset -nocomplain Priv($w,selectcolor) Priv($w,aselectcolor)
+
+ # Restore the original button relief if it was changed by Tk. That is
+ # signaled by the existence of Priv($w,prelief).
+
+ if {[info exists Priv($w,relief)]} {
+ if {[info exists Priv($w,prelief)] && \
+ $Priv($w,prelief) eq [$w cget -relief]} {
+ $w configure -relief $Priv($w,relief)
+ }
+ unset -nocomplain Priv($w,relief) Priv($w,prelief)
+ }
+
+ set Priv(window) ""
+}
diff --git a/library/choosedir.tcl b/library/choosedir.tcl
index b9c2aa8..8f3f75f 100644
--- a/library/choosedir.tcl
+++ b/library/choosedir.tcl
@@ -25,7 +25,7 @@ proc ::tk::dialog::file::chooseDir:: {args} {
variable ::tk::Priv
set dataName __tk_choosedir
upvar ::tk::dialog::file::$dataName data
- ::tk::dialog::file::chooseDir::Config $dataName $args
+ Config $dataName $args
if {$data(-parent) eq "."} {
set w .$dataName
@@ -41,14 +41,14 @@ proc ::tk::dialog::file::chooseDir:: {args} {
destroy $w
::tk::dialog::file::Create $w TkChooseDir
} else {
- set data(dirMenuBtn) $w.f1.menu
- set data(dirMenu) $w.f1.menu.menu
- set data(upBtn) $w.f1.up
- set data(icons) $w.icons
- set data(ent) $w.f2.ent
- set data(okBtn) $w.f2.ok
- set data(cancelBtn) $w.f2.cancel
- set data(hiddenBtn) $w.f2.hidden
+ set data(dirMenuBtn) $w.contents.f1.menu
+ set data(dirMenu) $w.contents.f1.menu.menu
+ set data(upBtn) $w.contents.f1.up
+ set data(icons) $w.contents.icons
+ set data(ent) $w.contents.f2.ent
+ set data(okBtn) $w.contents.f2.ok
+ set data(cancelBtn) $w.contents.f2.cancel
+ set data(hiddenBtn) $w.contents.f2.hidden
}
if {$::tk::dialog::file::showHiddenBtn} {
$data(hiddenBtn) configure -state normal
@@ -58,6 +58,15 @@ proc ::tk::dialog::file::chooseDir:: {args} {
grid remove $data(hiddenBtn)
}
+ # When using -mustexist, manage the OK button state for validity
+ $data(okBtn) configure -state normal
+ if {$data(-mustexist)} {
+ $data(ent) configure -validate key \
+ -validatecommand [list ::tk::dialog::file::chooseDir::IsOK? $w %P]
+ } else {
+ $data(ent) configure -validate none
+ }
+
# Dialog boxes should be transient with respect to their parent,
# so that they will always stay on top of their parent window. However,
# some window managers will create the window as withdrawn if the parent
@@ -69,7 +78,8 @@ proc ::tk::dialog::file::chooseDir:: {args} {
wm transient $w $data(-parent)
}
- trace add variable data(selectPath) write [list ::tk::dialog::file::SetPath $w]
+ trace add variable data(selectPath) write \
+ [list ::tk::dialog::file::SetPath $w]
$data(dirMenuBtn) configure \
-textvariable ::tk::dialog::file::${dataName}(selectPath)
@@ -199,25 +209,25 @@ proc ::tk::dialog::file::chooseDir::OkCmd {w} {
# 4b. If the value is different from the current directory, change to
# that directory.
- set selection [tk::IconList_Curselection $data(icons)]
- if { [llength $selection] != 0 } {
+ set selection [tk::IconList_CurSelection $data(icons)]
+ if {[llength $selection] != 0} {
set iconText [tk::IconList_Get $data(icons) [lindex $selection 0]]
set iconText [file join $data(selectPath) $iconText]
- ::tk::dialog::file::chooseDir::Done $w $iconText
+ Done $w $iconText
} else {
set text [$data(ent) get]
- if { $text eq "" } {
+ if {$text eq ""} {
return
}
- set text [eval file join [file split [string trim $text]]]
- if { ![file exists $text] || ![file isdirectory $text] } {
+ set text [file join {*}[file split [string trim $text]]]
+ if {![file exists $text] || ![file isdirectory $text]} {
# Entry contains an invalid directory. If it's the same as the
# last time they came through here, reset the saved value and end
# the dialog. Otherwise, save the value (so we can do this test
# next time).
- if { $text eq $data(previousEntryText) } {
+ if {$text eq $data(previousEntryText)} {
set data(previousEntryText) ""
- ::tk::dialog::file::chooseDir::Done $w $text
+ Done $w $text
} else {
set data(previousEntryText) $text
}
@@ -225,8 +235,8 @@ proc ::tk::dialog::file::chooseDir::OkCmd {w} {
# Entry contains a valid directory. If it is the same as the
# current directory, end the dialog. Otherwise, change to that
# directory.
- if { $text eq $data(selectPath) } {
- ::tk::dialog::file::chooseDir::Done $w $text
+ if {$text eq $data(selectPath)} {
+ Done $w $text
} else {
set data(selectPath) $text
}
@@ -235,10 +245,22 @@ proc ::tk::dialog::file::chooseDir::OkCmd {w} {
return
}
+# Change state of OK button to match -mustexist correctness of entry
+#
+proc ::tk::dialog::file::chooseDir::IsOK? {w text} {
+ upvar ::tk::dialog::file::[winfo name $w] data
+
+ set ok [file isdirectory $text]
+ $data(okBtn) configure -state [expr {$ok ? "normal" : "disabled"}]
+
+ # always return 1
+ return 1
+}
+
proc ::tk::dialog::file::chooseDir::DblClick {w} {
upvar ::tk::dialog::file::[winfo name $w] data
- set selection [tk::IconList_Curselection $data(icons)]
- if { [llength $selection] != 0 } {
+ set selection [tk::IconList_CurSelection $data(icons)]
+ if {[llength $selection] != 0} {
set filenameFragment \
[tk::IconList_Get $data(icons) [lindex $selection 0]]
set file $data(selectPath)
@@ -247,7 +269,7 @@ proc ::tk::dialog::file::chooseDir::DblClick {w} {
return
}
}
-}
+}
# Gets called when user browses the IconList widget (dragging mouse, arrow
# keys, etc)
@@ -279,11 +301,8 @@ proc ::tk::dialog::file::chooseDir::Done {w {selectFilePath ""}} {
if {$selectFilePath eq ""} {
set selectFilePath $data(selectPath)
}
- if { $data(-mustexist) } {
- if { ![file exists $selectFilePath] || \
- ![file isdir $selectFilePath] } {
- return
- }
+ if {$data(-mustexist) && ![file isdirectory $selectFilePath]} {
+ return
}
set Priv(selectFilePath) $selectFilePath
}
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index cfbfb4f..712c45d 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -105,10 +105,11 @@ proc ::tk::dialog::color:: {args} {
# restore any grab that was in effect.
vwait ::tk::Priv(selectColor)
+ set result $Priv(selectColor)
::tk::RestoreFocusGrab $w $data(okBtn)
unset data
- return $Priv(selectColor)
+ return $result
}
# ::tk::dialog::color::InitValues --
@@ -123,8 +124,7 @@ proc ::tk::dialog::color::InitValues {dataName} {
set data(intensityIncr) [expr {256 / $data(NUM_COLORBARS)}]
# ColorbarWidth is the width of each colorbar
- set data(colorbarWidth) \
- [expr {$data(BARS_WIDTH) / $data(NUM_COLORBARS)}]
+ set data(colorbarWidth) [expr {$data(BARS_WIDTH) / $data(NUM_COLORBARS)}]
# Indent is the width of the space at the left and right side of the
# colorbar. It is always half the selector polygon width, because the
@@ -213,12 +213,12 @@ proc ::tk::dialog::color::BuildDialog {w} {
set stripsFrame [frame $topFrame.colorStrip]
set maxWidth [::tk::mcmaxamp &Red &Green &Blue]
- set maxWidth [expr {$maxWidth<6?6:$maxWidth}]
- set colorList [list \
- red [mc "&Red"] \
- green [mc "&Green"] \
- blue [mc "&Blue"] \
- ]
+ set maxWidth [expr {$maxWidth<6 ? 6 : $maxWidth}]
+ set colorList {
+ red "&Red"
+ green "&Green"
+ blue "&Blue"
+ }
foreach {color l} $colorList {
# each f frame contains an [R|G|B] entry and the equiv. color strip.
set f [frame $stripsFrame.$color]
@@ -226,9 +226,10 @@ proc ::tk::dialog::color::BuildDialog {w} {
# The box frame contains the label and entry widget for an [R|G|B]
set box [frame $f.box]
- bind [::tk::AmpWidget label $box.label -text $l: -width $maxWidth \
- -anchor ne] <<AltUnderlined>> [list focus $box.entry]
-
+ ::tk::AmpWidget label $box.label -text "[mc $l]:" \
+ -width $maxWidth -anchor ne
+ bind $box.label <<AltUnderlined>> [list focus $box.entry]
+
entry $box.entry -textvariable \
::tk::dialog::color::[winfo name $w]($color,intensity) \
-width 4
@@ -236,14 +237,15 @@ proc ::tk::dialog::color::BuildDialog {w} {
pack $box.entry -side left -anchor n -pady 0
pack $box -side left -fill both
- set height [expr \
- {[winfo reqheight $box.entry] - \
- 2*([$box.entry cget -highlightthickness] + [$box.entry cget -bd])}]
+ set height [expr {
+ [winfo reqheight $box.entry] -
+ 2*([$box.entry cget -highlightthickness] + [$box.entry cget -bd])
+ }]
- canvas $f.color -height $height\
- -width $data(BARS_WIDTH) -relief sunken -bd 2
+ canvas $f.color -height $height \
+ -width $data(BARS_WIDTH) -relief sunken -bd 2
canvas $f.sel -height $data(PLGN_HEIGHT) \
- -width $data(canvasWidth) -highlightthickness 0
+ -width $data(canvasWidth) -highlightthickness 0
pack $f.color -expand yes -fill both
pack $f.sel -expand yes -fill both
@@ -254,16 +256,16 @@ proc ::tk::dialog::color::BuildDialog {w} {
set data($color,sel) $f.sel
bind $data($color,col) <Configure> \
- [list tk::dialog::color::DrawColorScale $w $color 1]
+ [list tk::dialog::color::DrawColorScale $w $color 1]
bind $data($color,col) <Enter> \
- [list tk::dialog::color::EnterColorBar $w $color]
+ [list tk::dialog::color::EnterColorBar $w $color]
bind $data($color,col) <Leave> \
- [list tk::dialog::color::LeaveColorBar $w $color]
+ [list tk::dialog::color::LeaveColorBar $w $color]
bind $data($color,sel) <Enter> \
- [list tk::dialog::color::EnterColorBar $w $color]
+ [list tk::dialog::color::EnterColorBar $w $color]
bind $data($color,sel) <Leave> \
- [list tk::dialog::color::LeaveColorBar $w $color]
+ [list tk::dialog::color::LeaveColorBar $w $color]
bind $box.entry <Return> [list tk::dialog::color::HandleRGBEntry $w]
}
@@ -274,11 +276,11 @@ proc ::tk::dialog::color::BuildDialog {w} {
# selected color
#
set selFrame [frame $topFrame.sel]
- set lab [::tk::AmpWidget label $selFrame.lab -text [mc "&Selection:"] \
- -anchor sw]
+ set lab [::tk::AmpWidget label $selFrame.lab \
+ -text [mc "&Selection:"] -anchor sw]
set ent [entry $selFrame.ent \
- -textvariable ::tk::dialog::color::[winfo name $w](selection) \
- -width 16]
+ -textvariable ::tk::dialog::color::[winfo name $w](selection) \
+ -width 16]
set f1 [frame $selFrame.f1 -relief sunken -bd 2]
set data(finalCanvas) [frame $f1.demo -bd 0 -width 100 -height 70]
@@ -294,7 +296,7 @@ proc ::tk::dialog::color::BuildDialog {w} {
# the botFrame frame contains the buttons
#
set botFrame [frame $w.bot -relief raised -bd 1]
-
+
::tk::AmpWidget button $botFrame.ok -text [mc "&OK"] \
-command [list tk::dialog::color::OkCmd $w]
::tk::AmpWidget button $botFrame.cancel -text [mc "&Cancel"] \
@@ -302,7 +304,7 @@ proc ::tk::dialog::color::BuildDialog {w} {
set data(okBtn) $botFrame.ok
set data(cancelBtn) $botFrame.cancel
-
+
grid x $botFrame.ok x $botFrame.cancel x -sticky ew
grid configure $botFrame.ok $botFrame.cancel -padx 10 -pady 10
grid columnconfigure $botFrame {0 4} -weight 1 -uniform space
@@ -310,13 +312,13 @@ proc ::tk::dialog::color::BuildDialog {w} {
grid columnconfigure $botFrame 2 -weight 2 -uniform space
pack $botFrame -side bottom -fill x
-
# Accelerator bindings
bind $lab <<AltUnderlined>> [list focus $ent]
bind $w <KeyPress-Escape> [list tk::ButtonInvoke $data(cancelBtn)]
bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A]
wm protocol $w WM_DELETE_WINDOW [list tk::dialog::color::CancelCmd $w]
+ bind $lab <Destroy> [list tk::dialog::color::CancelCmd $w]
}
# ::tk::dialog::color::SetRGBValue --
@@ -329,11 +331,11 @@ proc ::tk::dialog::color::SetRGBValue {w color} {
set data(red,intensity) [lindex $color 0]
set data(green,intensity) [lindex $color 1]
set data(blue,intensity) [lindex $color 2]
-
+
RedrawColorBars $w all
# Now compute the new x value of each colorbars pointer polygon
- foreach color [list red green blue ] {
+ foreach color {red green blue} {
set x [RgbToX $w $data($color,intensity)]
MoveSelector $w $data($color,sel) $color $x 0
}
@@ -345,9 +347,11 @@ proc ::tk::dialog::color::SetRGBValue {w color} {
#
proc ::tk::dialog::color::XToRgb {w x} {
upvar ::tk::dialog::color::[winfo name $w] data
-
+
set x [expr {($x * $data(intensityIncr))/ $data(colorbarWidth)}]
- if {$x > 255} { set x 255 }
+ if {$x > 255} {
+ set x 255
+ }
return $x
}
@@ -357,11 +361,10 @@ proc ::tk::dialog::color::XToRgb {w x} {
#
proc ::tk::dialog::color::RgbToX {w color} {
upvar ::tk::dialog::color::[winfo name $w] data
-
+
return [expr {($color * $data(colorbarWidth)/ $data(intensityIncr))}]
}
-
# ::tk::dialog::color::DrawColorScale --
#
# Draw color scale is called whenever the size of one of the color
@@ -380,7 +383,7 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
# First remove all the lines that already exist.
if { $data(lines,$c,last) > $data(lines,$c,start)} {
for {set i $data(lines,$c,start)} \
- {$i <= $data(lines,$c,last)} { incr i} {
+ {$i <= $data(lines,$c,last)} {incr i} {
$sel delete $i
}
}
@@ -388,7 +391,7 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
if {[info exists data($c,index)]} {
$sel delete $data($c,index)
}
-
+
# Draw the selection polygons
CreateSelector $w $sel $c
$sel bind $data($c,index) <ButtonPress-1> \
@@ -421,7 +424,7 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
# l is the canvas index of the first colorbar.
set l $data(lines,$c,start)
}
-
+
# Draw the color bars.
set highlightW [expr {[$col cget -highlightthickness] + [$col cget -bd]}]
for {set i 0} { $i < $data(NUM_COLORBARS)} { incr i} {
@@ -429,26 +432,20 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
set startx [expr {$i * $data(colorbarWidth) + $highlightW}]
if {$c eq "red"} {
set color [format "#%02x%02x%02x" \
- $intensity \
- $data(green,intensity) \
- $data(blue,intensity)]
+ $intensity $data(green,intensity) $data(blue,intensity)]
} elseif {$c eq "green"} {
set color [format "#%02x%02x%02x" \
- $data(red,intensity) \
- $intensity \
- $data(blue,intensity)]
+ $data(red,intensity) $intensity $data(blue,intensity)]
} else {
set color [format "#%02x%02x%02x" \
- $data(red,intensity) \
- $data(green,intensity) \
- $intensity]
+ $data(red,intensity) $data(green,intensity) $intensity]
}
if {$create} {
set index [$col create rect $startx $highlightW \
[expr {$startx +$data(colorbarWidth)}] \
- [expr {[winfo height $col] + $highlightW}]\
- -fill $color -outline $color]
+ [expr {[winfo height $col] + $highlightW}] \
+ -fill $color -outline $color]
} else {
$col itemconfigure $l -fill $color -outline $color
incr l
@@ -472,9 +469,9 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
proc ::tk::dialog::color::CreateSelector {w sel c } {
upvar ::tk::dialog::color::[winfo name $w] data
set data($c,index) [$sel create polygon \
- 0 $data(PLGN_HEIGHT) \
- $data(PLGN_WIDTH) $data(PLGN_HEIGHT) \
- $data(indent) 0]
+ 0 $data(PLGN_HEIGHT) \
+ $data(PLGN_WIDTH) $data(PLGN_HEIGHT) \
+ $data(indent) 0]
set data($c,x) [RgbToX $w $data($c,intensity)]
$sel move $data($c,index) $data($c,x) 0
}
@@ -487,8 +484,8 @@ proc ::tk::dialog::color::RedrawFinalColor {w} {
upvar ::tk::dialog::color::[winfo name $w] data
set color [format "#%02x%02x%02x" $data(red,intensity) \
- $data(green,intensity) $data(blue,intensity)]
-
+ $data(green,intensity) $data(blue,intensity)]
+
$data(finalCanvas) configure -bg $color
set data(finalColor) $color
set data(selection) $color
@@ -571,7 +568,7 @@ proc ::tk::dialog::color::MoveSelector {w sel color x delta} {
set diff [expr {$x - $data($color,x)}]
$sel move $data($color,index) $diff 0
set data($color,x) [expr {$data($color,x) + $diff}]
-
+
# Return the x value that it was actually set at
return $x
}
@@ -587,7 +584,7 @@ proc ::tk::dialog::color::ReleaseMouse {w sel color x delta} {
upvar ::tk::dialog::color::[winfo name $w] data
set x [MoveSelector $w $sel $color $x $delta]
-
+
# Determine exactly what color we are looking at.
set data($color,intensity) [XToRgb $w $x]
@@ -601,13 +598,15 @@ proc ::tk::dialog::color::ReleaseMouse {w sel color x delta} {
#
proc ::tk::dialog::color::ResizeColorBars {w} {
upvar ::tk::dialog::color::[winfo name $w] data
-
- if { ($data(BARS_WIDTH) < $data(NUM_COLORBARS)) ||
- (($data(BARS_WIDTH) % $data(NUM_COLORBARS)) != 0)} {
+
+ if {
+ ($data(BARS_WIDTH) < $data(NUM_COLORBARS)) ||
+ (($data(BARS_WIDTH) % $data(NUM_COLORBARS)) != 0)
+ } then {
set data(BARS_WIDTH) $data(NUM_COLORBARS)
}
InitValues [winfo name $w]
- foreach color [list red green blue ] {
+ foreach color {red green blue} {
$data($color,col) configure -width $data(canvasWidth)
DrawColorScale $w $color 1
}
@@ -626,7 +625,7 @@ proc ::tk::dialog::color::HandleSelEntry {w} {
set data(selection) $data(finalColor)
return
}
-
+
set R [expr {[lindex $color 0]/0x100}]
set G [expr {[lindex $color 1]/0x100}]
set B [expr {[lindex $color 2]/0x100}]
@@ -642,7 +641,7 @@ proc ::tk::dialog::color::HandleSelEntry {w} {
proc ::tk::dialog::color::HandleRGBEntry {w} {
upvar ::tk::dialog::color::[winfo name $w] data
- foreach c [list red green blue] {
+ foreach c {red green blue} {
if {[catch {
set data($c,intensity) [expr {int($data($c,intensity))}]
}]} {
@@ -686,10 +685,9 @@ proc ::tk::dialog::color::OkCmd {w} {
set Priv(selectColor) $data(finalColor)
}
-# user hits Cancel button
+# user hits Cancel button or destroys window
#
proc ::tk::dialog::color::CancelCmd {w} {
variable ::tk::Priv
set Priv(selectColor) ""
}
-
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index 6ded323..39d27d3 100644
--- a/library/comdlg.tcl
+++ b/library/comdlg.tcl
@@ -182,7 +182,7 @@ proc ::tk::FocusGroup_Destroy {t w} {
unset FocusOut($name)
}
} else {
- if {[info exists Priv(focus,$t)] && $Priv(focus,$t) eq $w} {
+ if {[info exists Priv(focus,$t)] && ($Priv(focus,$t) eq $w)} {
set Priv(focus,$t) ""
}
unset -nocomplain FocusIn($t,$w) FocusOut($t,$w)
@@ -257,7 +257,7 @@ proc ::tk::FDGetFileTypes {string} {
if {[llength $t] < 2 || [llength $t] > 3} {
error "bad file type \"$t\", should be \"typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?\""
}
- eval lappend [list fileTypes([lindex $t 0])] [lindex $t 1]
+ lappend fileTypes([lindex $t 0]) {*}[lindex $t 1]
}
set types {}
@@ -269,6 +269,15 @@ proc ::tk::FDGetFileTypes {string} {
continue
}
+ # Validate each macType. This is to agree with the
+ # behaviour of TkGetFileFilters(). This list may be
+ # empty.
+ foreach macType [lindex $t 2] {
+ if {[string length $macType] != 4} {
+ error "bad Macintosh file type \"$macType\""
+ }
+ }
+
set name "$label \("
set sep ""
set doAppend 1
diff --git a/library/console.tcl b/library/console.tcl
index b473dd4..e44324f 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -22,7 +22,7 @@ namespace eval ::tk::console {
variable showMatches 1 ; # show multiple expand matches
variable inPlugin [info exists embed_args]
- variable defaultPrompt ; # default prompt if tcl_prompt1 isn't used
+ variable defaultPrompt ; # default prompt if tcl_prompt1 isn't used
if {$inPlugin} {
@@ -48,74 +48,92 @@ proc ::tk::ConsoleInit {} {
wm withdraw .
}
- if {$tcl_platform(platform) eq "macintosh"
- || [tk windowingsystem] eq "aqua"} {
+ if {[tk windowingsystem] eq "aqua"} {
set mod "Cmd"
} else {
set mod "Ctrl"
}
- if {[catch {menu .menubar} err]} { bgerror "INIT: $err" }
- .menubar add cascade -label File -menu .menubar.file -underline 0
- .menubar add cascade -label Edit -menu .menubar.edit -underline 0
+ if {[catch {menu .menubar} err]} {
+ bgerror "INIT: $err"
+ }
+ AmpMenuArgs .menubar add cascade -label [mc &File] -menu .menubar.file
+ AmpMenuArgs .menubar add cascade -label [mc &Edit] -menu .menubar.edit
menu .menubar.file -tearoff 0
- .menubar.file add command -label [mc "Source..."] \
- -underline 0 -command tk::ConsoleSource
- .menubar.file add command -label [mc "Hide Console"] \
- -underline 0 -command {wm withdraw .}
- .menubar.file add command -label [mc "Clear Console"] \
- -underline 0 -command {.console delete 1.0 "promptEnd linestart"}
- if {$tcl_platform(platform) eq "macintosh"
- || [tk windowingsystem] eq "aqua"} {
- .menubar.file add command -label [mc "Quit"] \
- -command exit -accel Cmd-Q
- } else {
- .menubar.file add command -label [mc "Exit"] \
- -underline 1 -command exit
+ AmpMenuArgs .menubar.file add command -label [mc "&Source..."] \
+ -command {tk::ConsoleSource}
+ AmpMenuArgs .menubar.file add command -label [mc "&Hide Console"] \
+ -command {wm withdraw .}
+ AmpMenuArgs .menubar.file add command -label [mc "&Clear Console"] \
+ -command {.console delete 1.0 "promptEnd linestart"}
+ if {[tk windowingsystem] ne "aqua"} {
+ AmpMenuArgs .menubar.file add command -label [mc E&xit] -command {exit}
}
menu .menubar.edit -tearoff 0
- .menubar.edit add command -label [mc "Cut"] -underline 2 \
- -command { event generate .console <<Cut>> } -accel "$mod+X"
- .menubar.edit add command -label [mc "Copy"] -underline 0 \
- -command { event generate .console <<Copy>> } -accel "$mod+C"
- .menubar.edit add command -label [mc "Paste"] -underline 1 \
- -command { event generate .console <<Paste>> } -accel "$mod+V"
+ AmpMenuArgs .menubar.edit add command -label [mc Cu&t] -accel "$mod+X"\
+ -command {event generate .console <<Cut>>}
+ AmpMenuArgs .menubar.edit add command -label [mc &Copy] -accel "$mod+C"\
+ -command {event generate .console <<Copy>>}
+ AmpMenuArgs .menubar.edit add command -label [mc P&aste] -accel "$mod+V"\
+ -command {event generate .console <<Paste>>}
if {$tcl_platform(platform) ne "windows"} {
- .menubar.edit add command -label [mc "Clear"] -underline 2 \
- -command { event generate .console <<Clear>> }
+ AmpMenuArgs .menubar.edit add command -label [mc Cl&ear] \
+ -command {event generate .console <<Clear>>}
} else {
- .menubar.edit add command -label [mc "Delete"] -underline 0 \
- -command { event generate .console <<Clear>> } -accel "Del"
-
- .menubar add cascade -label Help -menu .menubar.help -underline 0
+ AmpMenuArgs .menubar.edit add command -label [mc &Delete] \
+ -command {event generate .console <<Clear>>} -accel "Del"
+
+ AmpMenuArgs .menubar add cascade -label [mc &Help] -menu .menubar.help
menu .menubar.help -tearoff 0
- .menubar.help add command -label [mc "About..."] \
- -underline 0 -command tk::ConsoleAbout
+ AmpMenuArgs .menubar.help add command -label [mc &About...] \
+ -command tk::ConsoleAbout
}
+ AmpMenuArgs .menubar.edit add separator
+ AmpMenuArgs .menubar.edit add command -label [mc "&Increase Font Size"] \
+ -accel "$mod++" -command {event generate .console <<Console_FontSizeIncr>>}
+ AmpMenuArgs .menubar.edit add command -label [mc "&Decrease Font Size"] \
+ -accel "$mod+-" -command {event generate .console <<Console_FontSizeDecr>>}
+
. configure -menu .menubar
- set con [text .console -yscrollcommand [list .sb set] -setgrid true]
- scrollbar .sb -command [list $con yview]
- pack .sb -side right -fill both
- pack $con -fill both -expand 1 -side left
- switch -exact $tcl_platform(platform) {
- "macintosh" {
- $con configure -font {Monaco 10 normal} -highlightthickness 0
- }
- "windows" {
- $con configure -font systemfixed
- }
- "unix" {
- if {[tk windowingsystem] eq "aqua"} {
- $con configure -font {Monaco 10 normal} -highlightthickness 0
- }
- }
+ # See if we can find a better font than the TkFixedFont
+ catch {font create TkConsoleFont {*}[font configure TkFixedFont]}
+ set families [font families]
+ switch -exact -- [tk windowingsystem] {
+ aqua { set preferred {Monaco 10} }
+ win32 { set preferred {ProFontWindows 8 Consolas 8} }
+ default { set preferred {} }
+ }
+ foreach {family size} $preferred {
+ if {[lsearch -exact $families $family] != -1} {
+ font configure TkConsoleFont -family $family -size $size
+ break
+ }
}
+ # Provide the right border for the text widget (platform dependent).
+ ::ttk::style layout ConsoleFrame {
+ Entry.field -sticky news -border 1 -children {
+ ConsoleFrame.padding -sticky news
+ }
+ }
+ ::ttk::frame .consoleframe -style ConsoleFrame
+
+ set con [text .console -yscrollcommand [list .sb set] -setgrid true \
+ -borderwidth 0 -highlightthickness 0 -font TkConsoleFont]
+ if {[tk windowingsystem] eq "aqua"} {
+ scrollbar .sb -command [list $con yview]
+ } else {
+ ::ttk::scrollbar .sb -command [list $con yview]
+ }
+ pack .sb -in .consoleframe -fill both -side right -padx 1 -pady 1
+ pack $con -in .consoleframe -fill both -expand 1 -side left -padx 1 -pady 1
+ pack .consoleframe -fill both -expand 1 -side left
+
ConsoleBind $con
$con tag configure stderr -foreground red
@@ -129,6 +147,9 @@ proc ::tk::ConsoleInit {} {
focus $con
+ # Avoid listing this console in [winfo interps]
+ if {[info command ::send] eq "::send"} {rename ::send {}}
+
wm protocol . WM_DELETE_WINDOW { wm withdraw . }
wm title . [mc "Console"]
flush stdout
@@ -302,6 +323,39 @@ proc ::tk::ConsolePrompt {{partial normal}} {
$w see end
}
+# Copy selected text from the console
+proc ::tk::console::Copy {w} {
+ if {![catch {set data [$w get sel.first sel.last]}]} {
+ clipboard clear -displayof $w
+ clipboard append -displayof $w $data
+ }
+}
+# Copies selected text. If the selection is within the current active edit
+# region then it will be cut, if not it is only copied.
+proc ::tk::console::Cut {w} {
+ if {![catch {set data [$w get sel.first sel.last]}]} {
+ clipboard clear -displayof $w
+ clipboard append -displayof $w $data
+ if {[$w compare sel.first >= output]} {
+ $w delete sel.first sel.last
+ }
+ }
+}
+# Paste text from the clipboard
+proc ::tk::console::Paste {w} {
+ catch {
+ set clip [::tk::GetSelection $w CLIPBOARD]
+ set list [split $clip \n\r]
+ tk::ConsoleInsert $w [lindex $list 0]
+ foreach x [lrange $list 1 end] {
+ $w mark set insert {end - 1c}
+ tk::ConsoleInsert $w "\n"
+ tk::ConsoleInvoke
+ tk::ConsoleInsert $w $x
+ }
+ }
+}
+
# ::tk::ConsoleBind --
# This procedure first ensures that the default bindings for the Text
# class have been defined. Then certain bindings are overridden for
@@ -314,7 +368,9 @@ proc ::tk::ConsoleBind {w} {
bindtags $w [list $w Console PostConsole [winfo toplevel $w] all]
## Get all Text bindings into Console
- foreach ev [bind Text] { bind Console $ev [bind Text $ev] }
+ foreach ev [bind Text] {
+ bind Console $ev [bind Text $ev]
+ }
## We really didn't want the newline insertion...
bind Console <Control-Key-o> {}
## ...or any Control-v binding (would block <<Paste>>)
@@ -326,6 +382,8 @@ proc ::tk::ConsoleBind {w} {
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
# Otherwise, if a widget binding for one of these is defined, the
+ # <Keypress> class binding will also fire and insert the character
+ # which is wrong.
bind Console <Alt-KeyPress> {# nothing }
bind Console <Meta-KeyPress> {# nothing}
@@ -354,22 +412,40 @@ proc ::tk::ConsoleBind {w} {
<<Console_Transpose>> <Control-Key-t>
<<Console_ClearLine>> <Control-Key-u>
<<Console_SaveCommand>> <Control-Key-z>
+ <<Console_FontSizeIncr>> <Control-Key-plus>
+ <<Console_FontSizeDecr>> <Control-Key-minus>
} {
event add $ev $key
bind Console $key {}
}
-
+ if {[tk windowingsystem] eq "aqua"} {
+ foreach {ev key} {
+ <<Console_FontSizeIncr>> <Command-Key-plus>
+ <<Console_FontSizeDecr>> <Command-Key-minus>
+ } {
+ event add $ev $key
+ bind Console $key {}
+ }
+ }
bind Console <<Console_Expand>> {
- if {[%W compare insert > promptEnd]} {::tk::console::Expand %W}
+ if {[%W compare insert > promptEnd]} {
+ ::tk::console::Expand %W
+ }
}
bind Console <<Console_ExpandFile>> {
- if {[%W compare insert > promptEnd]} {::tk::console::Expand %W path}
+ if {[%W compare insert > promptEnd]} {
+ ::tk::console::Expand %W path
+ }
}
bind Console <<Console_ExpandProc>> {
- if {[%W compare insert > promptEnd]} {::tk::console::Expand %W proc}
+ if {[%W compare insert > promptEnd]} {
+ ::tk::console::Expand %W proc
+ }
}
bind Console <<Console_ExpandVar>> {
- if {[%W compare insert > promptEnd]} {::tk::console::Expand %W var}
+ if {[%W compare insert > promptEnd]} {
+ ::tk::console::Expand %W var
+ }
}
bind Console <<Console_Eval>> {
%W mark set insert {end - 1c}
@@ -378,7 +454,8 @@ proc ::tk::ConsoleBind {w} {
break
}
bind Console <Delete> {
- if {[%W tag nextrange sel 1.0 end] ne "" && [%W compare sel.first >= promptEnd]} {
+ if {{} ne [%W tag nextrange sel 1.0 end] \
+ && [%W compare sel.first >= promptEnd]} {
%W delete sel.first sel.last
} elseif {[%W compare insert >= promptEnd]} {
%W delete insert
@@ -386,7 +463,8 @@ proc ::tk::ConsoleBind {w} {
}
}
bind Console <BackSpace> {
- if {[%W tag nextrange sel 1.0 end] ne "" && [%W compare sel.first >= promptEnd]} {
+ if {{} ne [%W tag nextrange sel 1.0 end] \
+ && [%W compare sel.first >= promptEnd]} {
%W delete sel.first sel.last
} elseif {[%W compare insert != 1.0] && \
[%W compare insert > promptEnd]} {
@@ -409,11 +487,15 @@ proc ::tk::ConsoleBind {w} {
}
bind Console <Control-e> [bind Console <End>]
bind Console <Control-d> {
- if {[%W compare insert < promptEnd]} break
+ if {[%W compare insert < promptEnd]} {
+ break
+ }
%W delete insert
}
bind Console <<Console_KillLine>> {
- if {[%W compare insert < promptEnd]} break
+ if {[%W compare insert < promptEnd]} {
+ break
+ }
if {[%W compare insert == {insert lineend}]} {
%W delete insert
} else {
@@ -467,42 +549,24 @@ proc ::tk::ConsoleBind {w} {
}
bind Console <F9> {
eval destroy [winfo child .]
- if {$tcl_platform(platform) eq "macintosh"} {
- if {[catch {source [file join $tk_library console.tcl]}]} {source -rsrc console}
- } else {
- source [file join $tk_library console.tcl]
+ source [file join $tk_library console.tcl]
+ }
+ if {[tk windowingsystem] eq "aqua"} {
+ bind Console <Command-q> {
+ exit
}
}
- if {$::tcl_platform(platform) eq "macintosh" || [tk windowingsystem] eq "aqua"} {
- bind Console <Command-q> {
- exit
- }
+ bind Console <<Cut>> { ::tk::console::Cut %W }
+ bind Console <<Copy>> { ::tk::console::Copy %W }
+ bind Console <<Paste>> { ::tk::console::Paste %W }
+
+ bind Console <<Console_FontSizeIncr>> {
+ set size [font configure TkConsoleFont -size]
+ font configure TkConsoleFont -size [incr size]
}
- bind Console <<Cut>> {
- # Same as the copy event
- if {![catch {set data [%W get sel.first sel.last]}]} {
- clipboard clear -displayof %W
- clipboard append -displayof %W $data
- }
- }
- bind Console <<Copy>> {
- if {![catch {set data [%W get sel.first sel.last]}]} {
- clipboard clear -displayof %W
- clipboard append -displayof %W $data
- }
- }
- bind Console <<Paste>> {
- catch {
- set clip [::tk::GetSelection %W CLIPBOARD]
- set list [split $clip \n\r]
- tk::ConsoleInsert %W [lindex $list 0]
- foreach x [lrange $list 1 end] {
- %W mark set insert {end - 1c}
- tk::ConsoleInsert %W "\n"
- tk::ConsoleInvoke
- tk::ConsoleInsert %W $x
- }
- }
+ bind Console <<Console_FontSizeDecr>> {
+ set size [font configure TkConsoleFont -size]
+ font configure TkConsoleFont -size [incr size -1]
}
##
@@ -533,7 +597,6 @@ proc ::tk::ConsoleBind {w} {
if {"%A" ne ""} {
::tk::console::TagProc %W
}
- break
}
}
@@ -552,7 +615,7 @@ proc ::tk::ConsoleInsert {w s} {
return
}
catch {
- if {[$w compare sel.first <= insert]
+ if {[$w compare sel.first <= insert] \
&& [$w compare sel.last >= insert]} {
$w tag remove sel sel.first promptEnd
$w delete sel.first sel.last
@@ -618,10 +681,16 @@ Tk $::tk_patchLevel"
# w - console text widget
proc ::tk::console::TagProc w {
- if {!$::tk::console::magicKeys} { return }
+ if {!$::tk::console::magicKeys} {
+ return
+ }
set exp "\[^\\\\\]\[\[ \t\n\r\;{}\"\$\]"
set i [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
- if {$i eq ""} {set i promptEnd} else {append i +2c}
+ if {$i eq ""} {
+ set i promptEnd
+ } else {
+ append i +2c
+ }
regsub -all "\[\[\\\\\\?\\*\]" [$w get $i "insert-1c wordend"] {\\\0} c
if {[llength [EvalAttached [list info commands $c]]]} {
$w tag add proc $i "insert-1c wordend"
@@ -653,30 +722,42 @@ proc ::tk::console::TagProc w {
# Calls: ::tk::console::Blink
proc ::tk::console::MatchPair {w c1 c2 {lim 1.0}} {
- if {!$::tk::console::magicKeys} { return }
- if {[set ix [$w search -back $c1 insert $lim]] ne ""} {
+ if {!$::tk::console::magicKeys} {
+ return
+ }
+ if {{} ne [set ix [$w search -back $c1 insert $lim]]} {
while {
[string match {\\} [$w get $ix-1c]] &&
- [set ix [$w search -back $c1 $ix-1c $lim]] ne ""
+ [set ix [$w search -back $c1 $ix-1c $lim]] ne {}
} {}
set i1 insert-1c
- while {$ix ne ""} {
+ while {$ix ne {}} {
set i0 $ix
set j 0
- while {[set i0 [$w search $c2 $i0 $i1]] ne ""} {
+ while {[set i0 [$w search $c2 $i0 $i1]] ne {}} {
append i0 +1c
- if {[string match {\\} [$w get $i0-2c]]} continue
+ if {[string match {\\} [$w get $i0-2c]]} {
+ continue
+ }
incr j
}
- if {!$j} break
+ if {!$j} {
+ break
+ }
set i1 $ix
- while {$j && [set ix [$w search -back $c1 $ix $lim]] ne ""} {
- if {[string match {\\} [$w get $ix-1c]]} continue
+ while {$j && [set ix [$w search -back $c1 $ix $lim]] ne {}} {
+ if {[string match {\\} [$w get $ix-1c]]} {
+ continue
+ }
incr j -1
}
}
- if {[string match {} $ix]} { set ix [$w index $lim] }
- } else { set ix [$w index $lim] }
+ if {[string match {} $ix]} {
+ set ix [$w index $lim]
+ }
+ } else {
+ set ix [$w index $lim]
+ }
if {$::tk::console::blinkRange} {
Blink $w $ix [$w index insert]
} else {
@@ -696,12 +777,18 @@ proc ::tk::console::MatchPair {w c1 c2 {lim 1.0}} {
# Calls: ::tk::console::Blink
proc ::tk::console::MatchQuote {w {lim 1.0}} {
- if {!$::tk::console::magicKeys} { return }
+ if {!$::tk::console::magicKeys} {
+ return
+ }
set i insert-1c
set j 0
- while {[set i [$w search -back \" $i $lim]] ne ""} {
- if {[string match {\\} [$w get $i-1c]]} continue
- if {!$j} {set i0 $i}
+ while {[set i [$w search -back \" $i $lim]] ne {}} {
+ if {[string match {\\} [$w get $i-1c]]} {
+ continue
+ }
+ if {!$j} {
+ set i0 $i
+ }
incr j
}
if {$j&1} {
@@ -769,17 +856,31 @@ proc ::tk::console::ConstrainBuffer {w size} {
proc ::tk::console::Expand {w {type ""}} {
set exp "\[^\\\\\]\[\[ \t\n\r\\\{\"\\\\\$\]"
set tmp [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
- if {$tmp eq ""} {set tmp promptEnd} else {append tmp +2c}
- if {[$w compare $tmp >= insert]} { return }
+ if {$tmp eq ""} {
+ set tmp promptEnd
+ } else {
+ append tmp +2c
+ }
+ if {[$w compare $tmp >= insert]} {
+ return
+ }
set str [$w get $tmp insert]
switch -glob $type {
- path* { set res [ExpandPathname $str] }
- proc* { set res [ExpandProcname $str] }
- var* { set res [ExpandVariable $str] }
+ path* {
+ set res [ExpandPathname $str]
+ }
+ proc* {
+ set res [ExpandProcname $str]
+ }
+ var* {
+ set res [ExpandVariable $str]
+ }
default {
set res {}
foreach t {Pathname Procname Variable} {
- if {![catch {Expand$t $str} res] && ($res ne "")} { break }
+ if {![catch {Expand$t $str} res] && ($res ne "")} {
+ break
+ }
}
}
}
@@ -788,10 +889,12 @@ proc ::tk::console::Expand {w {type ""}} {
set repl [lindex $res 0]
$w delete $tmp insert
$w insert $tmp $repl {input stdin}
- if {($len > 1) && $::tk::console::showMatches && $repl eq $str} {
+ if {($len > 1) && ($::tk::console::showMatches) && ($repl eq $str)} {
puts stdout [lsort [lreplace $res 0 0]]
}
- } else { bell }
+ } else {
+ bell
+ }
return [incr len -1]
}
@@ -816,7 +919,9 @@ proc ::tk::console::ExpandPathname str {
set dir [file tail $str]
## Check to see if it was known to be a directory and keep the trailing
## slash if so (file tail cuts it off)
- if {[string match */ $str]} { append dir / }
+ if {[string match */ $str]} {
+ append dir /
+ }
if {[catch {lsort [EvalAttached [list glob $dir*]]} m]} {
set match {}
} else {
@@ -843,7 +948,9 @@ proc ::tk::console::ExpandPathname str {
} else {
## This may look goofy, but it handles spaces in path names
eval append match $m
- if {[file isdir $match]} {append match /}
+ if {[file isdir $match]} {
+ append match /
+ }
if {[string match ?*/* $str]} {
set match [file dirname $str]/$match
} elseif {[string match /* $str]} {
@@ -903,12 +1010,14 @@ proc ::tk::console::ExpandProcname str {
# possible further matches
proc ::tk::console::ExpandVariable str {
- if {[regexp {([^\(]*)\((.*)} $str junk ary str]} {
+ if {[regexp {([^\(]*)\((.*)} $str -> ary str]} {
## Looks like they're trying to expand an array.
set match [EvalAttached [list array names $ary $str*]]
if {[llength $match] > 1} {
set vars $ary\([ExpandBestMatch $match $str]
- foreach var $match {lappend vars $ary\($var\)}
+ foreach var $match {
+ lappend vars $ary\($var\)
+ }
return $vars
} elseif {[llength $match] == 1} {
set match $ary\($match\)
@@ -941,8 +1050,8 @@ proc ::tk::console::ExpandVariable str {
proc ::tk::console::ExpandBestMatch {l {e {}}} {
set ec [lindex $l 0]
if {[llength $l]>1} {
- set e [string length $e]; incr e -1
- set ei [string length $ec]; incr ei -1
+ set e [expr {[string length $e] - 1}]
+ set ei [expr {[string length $ec] - 1}]
foreach l $l {
while {$ei>=$e && [string first $ec $l]} {
set ec [string range $ec 0 [incr ei -1]]
@@ -953,4 +1062,4 @@ proc ::tk::console::ExpandBestMatch {l {e {}}} {
}
# now initialize the console
-::tk::ConsoleInit
+::tk::ConsoleInit
diff --git a/library/demos/README b/library/demos/README
index cb856cb..7285a93 100644
--- a/library/demos/README
+++ b/library/demos/README
@@ -1,9 +1,9 @@
This directory contains a collection of programs to demonstrate
the features of the Tk toolkit. The programs are all scripts for
-"wish", a windowing shell. If wish has been installed in /usr/local
+"wish", a windowing shell. If wish has been installed on your path
then you can invoke any of the programs in this directory just
-by typing its file name to your command shell. Otherwise invoke
-wish with the file as its first argument, e.g., "wish hello".
+by typing its file name to your command shell under Unix. Otherwise
+invoke wish with the file as its first argument, e.g., "wish hello".
The rest of this file contains a brief description of each program.
Files with names ending in ".tcl" are procedure packages used by one
or more of the demo programs; they can't be used as programs by
diff --git a/library/demos/anilabel.tcl b/library/demos/anilabel.tcl
new file mode 100644
index 0000000..61e6315
--- /dev/null
+++ b/library/demos/anilabel.tcl
@@ -0,0 +1,160 @@
+# anilabel.tcl --
+#
+# This demonstration script creates a toplevel window containing
+# several animated label widgets.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+
+set w .anilabel
+catch {destroy $w}
+toplevel $w
+wm title $w "Animated Label Demonstration"
+wm iconname $w "anilabel"
+positionWindow $w
+
+label $w.msg -font $font -wraplength 4i -justify left -text "Four animated labels are displayed below; each of the labels on the left is animated by making the text message inside it appear to scroll, and the label on the right is animated by animating the image that it displays."
+pack $w.msg -side top
+
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
+
+# Ensure that this this is an array
+array set animationCallbacks {}
+
+## This callback is the core of how to do animation in Tcl/Tk; all
+## animations work in basically the same way, with a procedure that
+## uses the [after] command to reschedule itself at some point in the
+## future. Of course, the details of how to update the state will vary
+## according to what is being animated.
+proc RotateLabelText {w interval} {
+ global animationCallbacks
+
+ # Schedule the calling of this procedure again in the future
+ set animationCallbacks($w) [after $interval RotateLabelText $w $interval]
+
+ # We do marquee-like scrolling text by chopping characters off the
+ # front of the text and sticking them on the end.
+ set text [$w cget -text]
+ set newText [string range $text 1 end][string index $text 0]
+ $w configure -text $newText
+}
+
+## A helper procedure to start the animation happening.
+proc animateLabelText {w text interval} {
+ global animationCallbacks
+
+ # Install the text into the widget
+ $w configure -text $text
+
+ # Schedule the start of the animation loop
+ set animationCallbacks($w) [after $interval RotateLabelText $w $interval]
+
+ # Make sure that the animation stops and is cleaned up after itself
+ # when the animated label is destroyed. Note that at this point we
+ # cannot manipulate the widget itself, as that has already died.
+ bind $w <Destroy> {
+ after cancel $animationCallbacks(%W)
+ unset animationCallbacks(%W)
+ }
+}
+
+## Next, a similar pair of procedures to animate a GIF loaded into a
+## photo image.
+proc SelectNextImageFrame {w interval} {
+ global animationCallbacks
+ set animationCallbacks($w) \
+ [after $interval SelectNextImageFrame $w $interval]
+ set image [$w cget -image]
+
+ # The easy way to animate a GIF!
+ set idx -1
+ scan [$image cget -format] "GIF -index %d" idx
+ if {[catch {
+ # Note that we get an error if the index is out of range
+ $image configure -format "GIF -index [incr idx]"
+ }]} then {
+ $image configure -format "GIF -index 0"
+ }
+}
+proc animateLabelImage {w imageData interval} {
+ global animationCallbacks
+
+ # Create a multi-frame GIF from base-64-encoded data
+ set image [image create photo -format GIF -data $imageData]
+
+ # Install the image into the widget
+ $w configure -image $image
+
+ # Schedule the start of the animation loop
+ set animationCallbacks($w) \
+ [after $interval SelectNextImageFrame $w $interval]
+
+ # Make sure that the animation stops and is cleaned up after itself
+ # when the animated label is destroyed. Note that at this point we
+ # cannot manipulate the widget itself, as that has already died.
+ # Also note that this script is in double-quotes; this is always OK
+ # because image names are chosen automatically to be simple words.
+ bind $w <Destroy> "
+ after cancel \$animationCallbacks(%W)
+ unset animationCallbacks(%W)
+ rename $image {}
+ "
+}
+
+# Make some widgets to contain the animations
+labelframe $w.left -text "Scrolling Texts"
+labelframe $w.right -text "GIF Image"
+pack $w.left $w.right -side left -padx 10 -pady 10 -expand yes
+
+# This method of scrolling text looks far better with a fixed-width font
+label $w.left.l1 -bd 4 -relief ridge -font fixedFont
+label $w.left.l2 -bd 4 -relief groove -font fixedFont
+label $w.left.l3 -bd 4 -relief flat -font fixedFont -width 18
+pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -padx 10 -pady 10 -anchor w
+# Don't need to do very much with this label except turn off the border
+label $w.right.l -bd 0
+pack $w.right.l -side top -expand yes -padx 10 -pady 10
+
+# This is a base-64-encoded animated GIF file.
+set tclPoweredData {
+ R0lGODlhKgBAAPQAAP//////zP//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM
+ zMyZmcyZZsxmZsxmAMwzAJnMzJmZzJmZmZlmmZlmZplmM5kzM2aZzGZmzGZm
+ mWZmZmYzZmYzMzNmzDMzZgAzmSH+IE1hZGUgd2l0aCBHSU1QIGJ5IExARGVt
+ YWlsbHkuY29tACH5BAVkAAEALAAAAAAqAEAAAAX+YCCOZEkyTKM2jOm66yPP
+ dF03bx7YcuHIDkGBR7SZeIyhTID4FZ+4Es8nQyCe2EeUNJ0peY2s9mi7PhAM
+ ngEAMGRbUpvzSxskLh1J+Hkg134OdDIDEB+GHxtYMEQMTjMGEYeGFoomezaC
+ DZGSHFmLXTQKkh8eNQVpZ2afmDQGHaOYSoEyhhcklzVmMpuHnaZmDqiGJbg0
+ qFqvh6UNAwB7VA+OwydEjgujkgrPNhbTI8dFvNgEYcHcHx0lB1kX2IYeA2G6
+ NN0YfkXJ2BsAMuAzHB9cZMk3qoEbRzUACsRCUBK5JxsC3iMiKd8GN088SIyT
+ 0RAFSROyeEg38caDiB/+JEgqxsODrZJ1BkT0oHKSmI0ceQxo94HDpg0qsuDk
+ UmRAMgu8OgwQ+uIJgUMVeGXA+IQkzEeHGvD8cIGlDXsLiRjQ+EHroQhea7xY
+ 8IQBSgYYDi1IS+OFBCgaDMGVS3fGi5BPJpBaENdQ0EomKGD56IHwO39EXiSC
+ Ysgxor5+Xfgq0qByYUpiXmwuoredB2aYH4gWWda0B7SeNENpEJHC1ghi+pS4
+ AJpIAwWvKPBi+8YEht5EriEqpFfMlhEdkBNpx0HUhwypx5T4IB1MBg/Ws2sn
+ wV3MSQOkzI8fUd48Aw3dOZto71x85hHtHijYv18Gf/3GqCdDCXHNoICBobSo
+ IqBqJLyCoH8JPrLgdh88CKCFD0CGmAiGYPgffwceZh6FC2ohIIklnkhehTNY
+ 4CIHHGzgwYw01ujBBhvAqKOLLq5AAk9kuSPkkKO40NB+h1gnypJIIvkBf09a
+ N5QIRz5p5ZJXJpmlIVhOGQA2TmIJZZhKKmmll2BqyWSXWUrZpQtpatlmk1c2
+ KaWRHeTZEJF8SqLDn/hhsOeQgBbqAh6DGqronxeARUIIACH5BAUeAAAALAUA
+ LgAFAAUAAAUM4CeKz/OV5YmqaRkCACH5BAUeAAEALAUALgAKAAUAAAUUICCK
+ z/OdJVCaa7p+7aOWcDvTZwgAIfkEBR4AAQAsCwAuAAkABQAABRPgA4zP95zA
+ eZqoWqqpyqLkZ38hACH5BAUKAAEALAcALgANAA4AAAU7ICA+jwiUJEqeKau+
+ r+vGaTmac63v/GP9HM7GQyx+jsgkkoRUHJ3Qx0cK/VQVTKtWwbVKn9suNunc
+ WkMAIfkEBQoAAAAsBwA3AAcABQAABRGgIHzk842j+Yjlt5KuO8JmCAAh+QQF
+ CgAAACwLADcABwAFAAAFEeAnfN9TjqP5oOWziq05lmUIACH5BAUKAAAALA8A
+ NwAHAAUAAAUPoPCJTymS3yiQj4qOcPmEACH5BAUKAAAALBMANwAHAAUAAAUR
+ oCB+z/MJX2o+I2miKimiawgAIfkEBQoAAAAsFwA3AAcABQAABRGgIHzfY47j
+ Q4qk+aHl+pZmCAAh+QQFCgAAACwbADcABwAFAAAFEaAgfs/zCV9qPiNJouo7
+ ll8IACH5BAUKAAAALB8ANwADAAUAAAUIoCB8o0iWZggAOw==
+}
+
+# Finally, set up the text scrolling animation
+animateLabelText $w.left.l1 "* Slow Animation *" 300
+animateLabelText $w.left.l2 "* Fast Animation *" 80
+animateLabelText $w.left.l3 "This is a longer scrolling text in a widget that will not show the whole message at once. " 150
+animateLabelImage $w.right.l $tclPoweredData 100
diff --git a/library/demos/aniwave.tcl b/library/demos/aniwave.tcl
new file mode 100644
index 0000000..6122132
--- /dev/null
+++ b/library/demos/aniwave.tcl
@@ -0,0 +1,104 @@
+# aniwave.tcl --
+#
+# This demonstration script illustrates how to adjust canvas item
+# coordinates in a way that does something fairly similar to waveform
+# display.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+
+set w .aniwave
+catch {destroy $w}
+toplevel $w
+wm title $w "Animated Wave Demonstration"
+wm iconname $w "aniwave"
+positionWindow $w
+
+label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line."
+pack $w.msg -side top
+
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
+
+# Create a canvas large enough to hold the wave. In fact, the wave
+# sticks off both sides of the canvas to prevent visual glitches.
+pack [canvas $w.c -width 300 -height 200 -background black] -padx 10 -pady 10 -expand yes
+
+# Ensure that this this is an array
+array set animationCallbacks {}
+
+# Creates a coordinates list of a wave. This code does a very sketchy
+# job and relies on Tk's line smoothing to make things look better.
+set waveCoords {}
+for {set x -10} {$x<=300} {incr x 5} {
+ lappend waveCoords $x 100
+}
+lappend waveCoords $x 0 [incr x 5] 200
+
+# Create a smoothed line and arrange for its coordinates to be the
+# contents of the variable waveCoords.
+$w.c create line $waveCoords -tags wave -width 1 -fill green -smooth 1
+proc waveCoordsTracer {w args} {
+ global waveCoords
+ # Actual visual update will wait until we have finished
+ # processing; Tk does that for us automatically.
+ $w.c coords wave $waveCoords
+}
+trace add variable waveCoords write [list waveCoordsTracer $w]
+
+# Basic motion handler. Given what direction the wave is travelling
+# in, it advances the y coordinates in the coordinate-list one step in
+# that direction.
+proc basicMotion {} {
+ global waveCoords direction
+ set oc $waveCoords
+ for {set i 1} {$i<[llength $oc]} {incr i 2} {
+ if {$direction eq "left"} {
+ lset waveCoords $i [lindex $oc \
+ [expr {$i+2>[llength $oc] ? 1 : $i+2}]]
+ } else {
+ lset waveCoords $i \
+ [lindex $oc [expr {$i-2<0 ? "end" : $i-2}]]
+ }
+ }
+}
+
+# Oscillation handler. This detects whether to reverse the direction
+# of the wave by checking to see if the peak of the wave has moved off
+# the screen (whose size we know already.)
+proc reverser {} {
+ global waveCoords direction
+ if {[lindex $waveCoords 1] < 10} {
+ set direction "right"
+ } elseif {[lindex $waveCoords end] < 10} {
+ set direction "left"
+ }
+}
+
+# Main animation "loop". This calls the two procedures that handle the
+# movement repeatedly by scheduling asynchronous calls back to itself
+# using the [after] command. This procedure is the fundamental basis
+# for all animated effect handling in Tk.
+proc move {} {
+ basicMotion
+ reverser
+
+ # Theoretically 100 frames-per-second (==10ms between frames)
+ global animationCallbacks
+ set animationCallbacks(simpleWave) [after 10 move]
+}
+
+# Initialise our remaining animation variables
+set direction "left"
+set animateAfterCallback {}
+# Arrange for the animation loop to stop when the canvas is deleted
+bind $w.c <Destroy> {
+ after cancel $animationCallbacks(simpleWave)
+ unset animationCallbacks(simpleWave)
+}
+# Start the animation processing
+move
diff --git a/library/demos/arrow.tcl b/library/demos/arrow.tcl
index 61b17dc..5011f6f 100644
--- a/library/demos/arrow.tcl
+++ b/library/demos/arrow.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# arrowSetup --
# This procedure regenerates all the text and graphics in the canvas
# window. It's called when the canvas is initially created, and also
@@ -105,7 +107,6 @@ proc arrowSetup c {
}
set w .arrow
-global tk_library
catch {destroy $w}
toplevel $w
wm title $w "Arrowhead Editor Demonstration"
@@ -116,11 +117,9 @@ set c $w.c
label $w.msg -font $font -wraplength 5i -justify left -text "This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
canvas $c -width 500 -height 350 -relief sunken -borderwidth 2
pack $c -expand yes -fill both
@@ -140,8 +139,9 @@ if {[winfo depth $c] > 1} {
set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1"
set demo_arrowInfo(activeStyle) "-fill red -outline black -width 1"
} else {
+ # Main widget program sets variable tk_demoDirectory
set demo_arrowInfo(bigLineStyle) "-fill black \
- -stipple @[file join $tk_library demos images grey.25]"
+ -stipple @[file join $tk_demoDirectory images grey.25]"
set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1"
set demo_arrowInfo(activeStyle) "-fill black -outline black -width 1"
}
diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl
index 4b4e1ac..d9bc22f 100644
--- a/library/demos/bind.tcl
+++ b/library/demos/bind.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .bind
catch {destroy $w}
toplevel $w
@@ -14,11 +16,9 @@ wm title $w "Text Demonstration - Tag Bindings"
wm iconname $w "bind"
positionWindow $w
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
text $w.text -yscrollcommand "$w.scroll set" -setgrid true \
-width 60 -height 24 -font $font -wrap word
@@ -66,12 +66,13 @@ foreach tag {d1 d2 d3 d4 d5 d6} {
$w.text tag bind $tag <Any-Enter> "$w.text tag configure $tag $bold"
$w.text tag bind $tag <Any-Leave> "$w.text tag configure $tag $normal"
}
-$w.text tag bind d1 <1> {source [file join $tk_library demos items.tcl]}
-$w.text tag bind d2 <1> {source [file join $tk_library demos plot.tcl]}
-$w.text tag bind d3 <1> {source [file join $tk_library demos ctext.tcl]}
-$w.text tag bind d4 <1> {source [file join $tk_library demos arrow.tcl]}
-$w.text tag bind d5 <1> {source [file join $tk_library demos ruler.tcl]}
-$w.text tag bind d6 <1> {source [file join $tk_library demos cscroll.tcl]}
+# Main widget program sets variable tk_demoDirectory
+$w.text tag bind d1 <1> {source [file join $tk_demoDirectory items.tcl]}
+$w.text tag bind d2 <1> {source [file join $tk_demoDirectory plot.tcl]}
+$w.text tag bind d3 <1> {source [file join $tk_demoDirectory ctext.tcl]}
+$w.text tag bind d4 <1> {source [file join $tk_demoDirectory arrow.tcl]}
+$w.text tag bind d5 <1> {source [file join $tk_demoDirectory ruler.tcl]}
+$w.text tag bind d6 <1> {source [file join $tk_demoDirectory cscroll.tcl]}
$w.text mark set insert 0.0
$w.text configure -state disabled
diff --git a/library/demos/bitmap.tcl b/library/demos/bitmap.tcl
index e0a5d94..453987d 100644
--- a/library/demos/bitmap.tcl
+++ b/library/demos/bitmap.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# bitmapRow --
# Create a row of bitmap items in a window.
#
@@ -31,7 +33,6 @@ proc bitmapRow {w args} {
}
set w .bitmap
-global tk_library
catch {destroy $w}
toplevel $w
wm title $w "Bitmap Demonstration"
@@ -41,11 +42,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame
bitmapRow $w.frame.0 error gray12 gray25 gray50 gray75
diff --git a/library/demos/browse b/library/demos/browse
index 2de9ec0..d107f28 100644
--- a/library/demos/browse
+++ b/library/demos/browse
@@ -7,6 +7,8 @@ exec wish "$0" ${1+"$@"}
# directory and allows you to open files or subdirectories by
# double-clicking.
+package require Tk
+
# Create a scrollbar on the right side of the main window and a listbox
# on the left side.
diff --git a/library/demos/button.tcl b/library/demos/button.tcl
index d11416c..bb943e6 100644
--- a/library/demos/button.tcl
+++ b/library/demos/button.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .button
catch {destroy $w}
toplevel $w
@@ -17,20 +19,16 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "If you click on any of the four buttons below, the background of the button area will change to the color indicated in the button. You can press Tab to move among the buttons, then press Space to invoke the current button."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+pack [addSeeDismiss $w.buttons $w] -side bottom -fill x
proc colorrefresh {w col} {
$w configure -bg $col
- $w.buttons configure -bg $col
if {[tk windowingsystem] eq "aqua"} {
# set highlightbackground of all buttons in $w
set l [list $w]
while {[llength $l]} {
- set l [concat [lrange $l 1 end] [winfo children [set b [lindex $l 0]]]]
+ set l [concat [lassign $l b] [winfo children $b]]
if {[winfo class $b] eq "Button"} {
$b configure -highlightbackground $col
}
diff --git a/library/demos/check.tcl b/library/demos/check.tcl
index 4ec9ef3..c072096 100644
--- a/library/demos/check.tcl
+++ b/library/demos/check.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .check
catch {destroy $w}
toplevel $w
@@ -14,18 +16,56 @@ wm title $w "Checkbutton Demonstration"
wm iconname $w "check"
positionWindow $w
-label $w.msg -font $font -wraplength 4i -justify left -text "Three checkbuttons are displayed below. If you click on a button, it will toggle the button's selection state and set a Tcl variable to a value indicating the state of the checkbutton. Click the \"See Variables\" button to see the current values of the variables."
+label $w.msg -font $font -wraplength 4i -justify left -text "Four checkbuttons are displayed below. If you click on a button, it will toggle the button's selection state and set a Tcl variable to a value indicating the state of the checkbutton. The first button also follows the state of the other three. If only some of the three are checked, the first button will display the tri-state mode. Click the \"See Variables\" button to see the current values of the variables."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-button $w.buttons.vars -text "See Variables" \
- -command "showVars $w.dialog wipers brakes sober"
-pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w [list safety wipers brakes sober]]
+pack $btns -side bottom -fill x
+checkbutton $w.b0 -text "Safety Check" -variable safety -relief flat \
+ -onvalue "all" \
+ -offvalue "none" \
+ -tristatevalue "partial"
checkbutton $w.b1 -text "Wipers OK" -variable wipers -relief flat
checkbutton $w.b2 -text "Brakes OK" -variable brakes -relief flat
checkbutton $w.b3 -text "Driver Sober" -variable sober -relief flat
-pack $w.b1 $w.b2 $w.b3 -side top -pady 2 -anchor w
+pack $w.b0 -side top -pady 2 -anchor w
+pack $w.b1 $w.b2 $w.b3 -side top -pady 2 -anchor w -padx 15
+
+## This code makes $w.b0 function as a tri-state button; it's not
+## needed at all for just straight yes/no buttons.
+
+set in_check 0
+proc tristate_check {n1 n2 op} {
+ global safety wipers brakes sober in_check
+ if {$in_check} {
+ return
+ }
+ set in_check 1
+ if {$n1 eq "safety"} {
+ if {$safety eq "none"} {
+ set wipers 0
+ set brakes 0
+ set sober 0
+ } elseif {$safety eq "all"} {
+ set wipers 1
+ set brakes 1
+ set sober 1
+ }
+ } else {
+ if {$wipers == 1 && $brakes == 1 && $sober == 1} {
+ set safety all
+ } elseif {$wipers == 1 || $brakes == 1 || $sober == 1} {
+ set safety partial
+ } else {
+ set safety none
+ }
+ }
+ set in_check 0
+}
+
+trace variable wipers w tristate_check
+trace variable brakes w tristate_check
+trace variable sober w tristate_check
+trace variable safety w tristate_check
diff --git a/library/demos/clrpick.tcl b/library/demos/clrpick.tcl
index 4abd5a7..ba50b75 100644
--- a/library/demos/clrpick.tcl
+++ b/library/demos/clrpick.tcl
@@ -6,6 +6,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .clrpick
catch {destroy $w}
toplevel $w
@@ -16,11 +18,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "Press the buttons below to choose the foreground and background colors for the widgets in this window."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
button $w.back -text "Set background color ..." \
-command \
diff --git a/library/demos/colors.tcl b/library/demos/colors.tcl
index ff72bee..99dec92 100644
--- a/library/demos/colors.tcl
+++ b/library/demos/colors.tcl
@@ -8,6 +8,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .colors
catch {destroy $w}
toplevel $w
@@ -18,11 +20,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing several color names is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by dragging in the listbox window with button 2 pressed. If you double-click button 1 on a color, then the application's color palette will be set to match that color"
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame -borderwidth 10
pack $w.frame -side top -expand yes -fill y
diff --git a/library/demos/combo.tcl b/library/demos/combo.tcl
new file mode 100644
index 0000000..5dad9f0
--- /dev/null
+++ b/library/demos/combo.tcl
@@ -0,0 +1,62 @@
+# combo.tcl --
+#
+# This demonstration script creates several combobox widgets.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .combo
+catch {destroy $w}
+toplevel $w
+wm title $w "Combobox Demonstration"
+wm iconname $w "combo"
+positionWindow $w
+
+ttk::label $w.msg -font $font -wraplength 5i -justify left -text "Three different\
+ combo-boxes are displayed below. You can add characters to the first\
+ one by pointing, clicking and typing, just as with an entry; pressing\
+ Return will cause the current value to be added to the list that is\
+ selectable from the drop-down list, and you can choose other values\
+ by pressing the Down key, using the arrow keys to pick another one,\
+ and pressing Return again. The second combo-box is fixed to a\
+ particular value, and cannot be modified at all. The third one only\
+ allows you to select values from its drop-down list of Australian\
+ cities."
+pack $w.msg -side top -fill x
+
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w {firstValue secondValue ozCity}]
+pack $btns -side bottom -fill x
+
+ttk::frame $w.f
+pack $w.f -fill both -expand 1
+set w $w.f
+
+set australianCities {
+ Canberra Sydney Melbourne Perth Adelaide Brisbane
+ Hobart Darwin "Alice Springs"
+}
+set secondValue unchangable
+set ozCity Sydney
+
+ttk::labelframe $w.c1 -text "Fully Editable"
+ttk::combobox $w.c1.c -textvariable firstValue
+ttk::labelframe $w.c2 -text Disabled
+ttk::combobox $w.c2.c -textvariable secondValue -state disabled
+ttk::labelframe $w.c3 -text "Defined List Only"
+ttk::combobox $w.c3.c -textvariable ozCity -state readonly \
+ -values $australianCities
+bind $w.c1.c <Return> {
+ if {[%W get] ni [%W cget -values]} {
+ %W configure -values [concat [%W cget -values] [list [%W get]]]
+ }
+}
+
+pack $w.c1 $w.c2 $w.c3 -side top -pady 5 -padx 10
+pack $w.c1.c -pady 5 -padx 10
+pack $w.c2.c -pady 5 -padx 10
+pack $w.c3.c -pady 5 -padx 10
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index 7fa1dcc..f6e88f4 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .cscroll
catch {destroy $w}
toplevel $w
@@ -18,11 +20,9 @@ set c $w.c
label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget that can be scrolled either using the scrollbars or by dragging with button 2 in the canvas. If you click button 1 on one of the rectangles, its indices will be printed on stdout."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.grid
scrollbar $w.hscroll -orient horiz -command "$c xview"
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index 3be4b58..e894bc2 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .ctext
catch {destroy $w}
toplevel $w
@@ -25,11 +27,9 @@ label $w.msg -font $font -wraplength 5i -justify left -text "This window display
the character just after the insertion cursor."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
canvas $c -relief flat -borderwidth 0 -width 500 -height 350
pack $w.c -side top -expand yes -fill both
@@ -40,7 +40,7 @@ $c create rectangle 245 195 255 205 -outline black -fill red
# First, create the text item and give it bindings so it can be edited.
-$c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been been defined to support editing (see above)." -width 440 -anchor n -font {Helvetica 24} -justify left]
+$c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
$c bind text <1> "textB1Press $c %x %y"
$c bind text <B1-Motion> "textB1Move $c %x %y"
$c bind text <Shift-1> "$c select adjust current @%x,%y"
diff --git a/library/demos/en.msg b/library/demos/en.msg
new file mode 100644
index 0000000..d4783fe
--- /dev/null
+++ b/library/demos/en.msg
@@ -0,0 +1,97 @@
+::msgcat::mcset en "Widget Demonstration"
+::msgcat::mcset en "tkWidgetDemo"
+::msgcat::mcset en "&File"
+::msgcat::mcset en "About..."
+::msgcat::mcset en "&About..."
+::msgcat::mcset en "<F1>"
+::msgcat::mcset en "&Quit"
+::msgcat::mcset en "Meta+Q" ;# Displayed hotkey
+::msgcat::mcset en "Meta-q" ;# Actual binding sequence
+::msgcat::mcset en "Ctrl+Q" ;# Displayed hotkey
+::msgcat::mcset en "Control-q" ;# Actual binding sequence
+::msgcat::mcset en "Variable values"
+::msgcat::mcset en "Variable values:"
+::msgcat::mcset en "OK"
+::msgcat::mcset en "Run the \"%s\" sample program"
+::msgcat::mcset en "Dismiss"
+::msgcat::mcset en "Rerun Demo"
+::msgcat::mcset en "Demo code: %s"
+::msgcat::mcset en "About Widget Demo"
+::msgcat::mcset en "Tk widget demonstration application"
+::msgcat::mcset en "Copyright (c) %s" "Copyright \u00a9 %s"
+::msgcat::mcset en "
+ @@title
+ Tk Widget Demonstrations
+ @@newline
+ @@normal
+ @@newline
+
+ This application provides a front end for several short scripts
+ that demonstrate what you can do with Tk widgets. Each of the
+ numbered lines below describes a demonstration; you can click on
+ it to invoke the demonstration. Once the demonstration window
+ appears, you can click the
+ @@bold
+ See Code
+ @@normal
+ button to see the Tcl/Tk code that created the demonstration. If
+ you wish, you can edit the code and click the
+ @@bold
+ Rerun Demo
+ @@normal
+ button in the code window to reinvoke the demonstration with the
+ modified code.
+ @@newline
+"
+::msgcat::mcset en "Labels, buttons, checkbuttons, and radiobuttons"
+::msgcat::mcset en "Labels (text and bitmaps)"
+::msgcat::mcset en "Labels and UNICODE text"
+::msgcat::mcset en "Buttons"
+::msgcat::mcset en "Check-buttons (select any of a group)"
+::msgcat::mcset en "Radio-buttons (select one of a group)"
+::msgcat::mcset en "A 15-puzzle game made out of buttons"
+::msgcat::mcset en "Iconic buttons that use bitmaps"
+::msgcat::mcset en "Two labels displaying images"
+::msgcat::mcset en "A simple user interface for viewing images"
+::msgcat::mcset en "Labelled frames"
+::msgcat::mcset en "Listboxes"
+::msgcat::mcset en "The 50 states"
+::msgcat::mcset en "Colors: change the color scheme for the application"
+::msgcat::mcset en "A collection of famous and infamous sayings"
+::msgcat::mcset en "Entries and Spin-boxes"
+::msgcat::mcset en "Entries without scrollbars"
+::msgcat::mcset en "Entries with scrollbars"
+::msgcat::mcset en "Validated entries and password fields"
+::msgcat::mcset en "Spin-boxes"
+::msgcat::mcset en "Simple Rolodex-like form"
+::msgcat::mcset en "Text"
+::msgcat::mcset en "Basic editable text"
+::msgcat::mcset en "Text display styles"
+::msgcat::mcset en "Hypertext (tag bindings)"
+::msgcat::mcset en "A text widget with embedded windows"
+::msgcat::mcset en "A search tool built with a text widget"
+::msgcat::mcset en "Canvases"
+::msgcat::mcset en "The canvas item types"
+::msgcat::mcset en "A simple 2-D plot"
+::msgcat::mcset en "Text items in canvases"
+::msgcat::mcset en "An editor for arrowheads on canvas lines"
+::msgcat::mcset en "A ruler with adjustable tab stops"
+::msgcat::mcset en "A building floor plan"
+::msgcat::mcset en "A simple scrollable canvas"
+::msgcat::mcset en "Scales"
+::msgcat::mcset en "Horizontal scale"
+::msgcat::mcset en "Vertical scale"
+::msgcat::mcset en "Paned Windows"
+::msgcat::mcset en "Horizontal paned window"
+::msgcat::mcset en "Vertical paned window"
+::msgcat::mcset en "Menus"
+::msgcat::mcset en "Menus and cascades (sub-menus)"
+::msgcat::mcset en "Menu-buttons"
+::msgcat::mcset en "Common Dialogs"
+::msgcat::mcset en "Message boxes"
+::msgcat::mcset en "File selection dialog"
+::msgcat::mcset en "Color picker"
+::msgcat::mcset en "Miscellaneous"
+::msgcat::mcset en "The built-in bitmaps"
+::msgcat::mcset en "A dialog box with a local grab"
+::msgcat::mcset en "A dialog box with a global grab"
diff --git a/library/demos/entry1.tcl b/library/demos/entry1.tcl
index 0136b84..eef8964 100644
--- a/library/demos/entry1.tcl
+++ b/library/demos/entry1.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .entry1
catch {destroy $w}
toplevel $w
@@ -17,11 +19,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse button2 pressed."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
entry $w.e1
entry $w.e2
diff --git a/library/demos/entry2.tcl b/library/demos/entry2.tcl
index a81e0d5..d0ca35a 100644
--- a/library/demos/entry2.tcl
+++ b/library/demos/entry2.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .entry2
catch {destroy $w}
toplevel $w
@@ -17,11 +19,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with mouse button2 pressed."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame -borderwidth 10
pack $w.frame -side top -fill x -expand 1
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl
index 36daf5b..3d76c2e 100644
--- a/library/demos/entry3.tcl
+++ b/library/demos/entry3.tcl
@@ -1,4 +1,4 @@
-# entry2.tcl --
+# entry3.tcl --
#
# This demonstration script creates several entry widgets whose
# permitted input is constrained in some way. It also shows off a
@@ -8,6 +8,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .entry3
catch {destroy $w}
toplevel $w
@@ -15,11 +17,10 @@ wm title $w "Constrained Entry Demonstration"
wm iconname $w "entry3"
positionWindow $w
-
label $w.msg -font $font -wraplength 5i -justify left -text "Four different\
entries are displayed below. You can add characters by pointing,\
clicking and typing, though each is constrained in what it will\
- accept. The first only accepts integers or the empty string\
+ accept. The first only accepts 32-bit integers or the empty string\
(checking when focus leaves it) and will flash to indicate any\
problem. The second only accepts strings with fewer than ten\
characters and sounds the bell when an attempt to go over the limit\
@@ -30,11 +31,9 @@ label $w.msg -font $font -wraplength 5i -justify left -text "Four different\
characters (silently ignoring further ones), and displaying them as\
asterisk characters."
-frame $w.buttons
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
-
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
# focusAndFlash --
# Error handler for entry widgets that forces the focus onto the
@@ -63,6 +62,8 @@ proc focusAndFlash {W fg bg {count 9}} {
}
labelframe $w.l1 -text "Integer Entry"
+# Alternatively try using {string is digit} for arbitrary length numbers,
+# and not just 32-bit ones.
entry $w.l1.e -validate focus -vcmd {string is integer %P}
$w.l1.e configure -invalidcommand \
"focusAndFlash %W [$w.l1.e cget -fg] [$w.l1.e cget -bg]"
@@ -181,5 +182,4 @@ grid $w.l1 $w.l2 -in $w.mid -padx 3m -pady 1m -sticky ew
grid $w.l3 $w.l4 -in $w.mid -padx 3m -pady 1m -sticky ew
grid columnconfigure $w.mid {0 1} -uniform 1
pack $w.msg -side top
-pack $w.buttons -side bottom -fill x -pady 2m
pack $w.mid -fill both -expand 1
diff --git a/library/demos/filebox.tcl b/library/demos/filebox.tcl
index 5ac67cb..032e3d8 100644
--- a/library/demos/filebox.tcl
+++ b/library/demos/filebox.tcl
@@ -6,6 +6,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .filebox
catch {destroy $w}
toplevel $w
@@ -16,11 +18,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "Enter a file name in the entry box or click on the \"Browse\" buttons to select a file name using the file selection dialog."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
foreach i {open save} {
set f [frame $w.$i]
@@ -33,7 +33,7 @@ foreach i {open save} {
pack $f -fill x -padx 1c -pady 3
}
-if {![string compare $tcl_platform(platform) unix]} {
+if {[tk windowingsystem] eq "x11"} {
checkbutton $w.strict -text "Use Motif Style Dialog" \
-variable tk_strictMotif -onvalue 1 -offvalue 0
pack $w.strict -anchor c
@@ -59,10 +59,16 @@ proc fileDialog {w ent operation} {
{"All files" *}
}
if {$operation == "open"} {
- set file [tk_getOpenFile -filetypes $types -parent $w]
+ global selected_type
+ if {![info exists selected_type]} {
+ set selected_type "Tcl Scripts"
+ }
+ set file [tk_getOpenFile -filetypes $types -parent $w \
+ -typevariable selected_type]
+ puts "You selected filetype \"$selected_type\""
} else {
set file [tk_getSaveFile -filetypes $types -parent $w \
- -initialfile Untitled -defaultextension .txt]
+ -initialfile Untitled -defaultextension .txt]
}
if {[string compare $file ""]} {
$ent delete 0 end
diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl
index abd921e..827600b 100644
--- a/library/demos/floor.tcl
+++ b/library/demos/floor.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# floorDisplay --
# Recreate the floorplan display in the canvas given by "w". The
# floor given by "active" is displayed on top with its office structure
@@ -1288,7 +1290,7 @@ proc fg3 {w color} {
# Below is the "main program" that creates the floorplan demonstration.
set w .floor
-global c tk_library currentRoom colors activeFloor
+global c currentRoom colors activeFloor
catch {destroy $w}
toplevel $w
wm title $w "Floorplan Canvas Demonstration"
@@ -1299,36 +1301,32 @@ wm minsize $w 100 100
label $w.msg -font $font -wraplength 8i -justify left -text "This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
set f [frame $w.frame]
pack $f -side top -fill both -expand yes
-set h [scrollbar $f.hscroll -highlightthickness 0 -orient horizontal]
-set v [scrollbar $f.vscroll -highlightthickness 0 -orient vertical]
-set f1 [frame $f.f1 -bd 2 -relief sunken]
-set c [canvas $f1.c -width 900 -height 500 -borderwidth 0 \
- -highlightthickness 0 -xscrollcommand "$h set" -yscrollcommand "$v set"]
+set h [scrollbar $f.hscroll -orient horizontal]
+set v [scrollbar $f.vscroll -orient vertical]
+set f1 [frame $f.f1 -borderwidth 2 -relief sunken]
+set c [canvas $f1.c -width 900 -height 500 -highlightthickness 0 \
+ -xscrollcommand [list $h set] \
+ -yscrollcommand [list $v set]]
pack $c -expand yes -fill both
-grid $f1 -padx 1 -pady 1 \
- -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
-grid $v -padx 1 -pady 1 \
- -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
-grid $h -padx 1 -pady 1 \
- -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
+grid $f1 -padx 1 -pady 1 -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
+grid $v -padx 1 -pady 1 -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
+grid $h -padx 1 -pady 1 -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
grid rowconfig $f 0 -weight 1 -minsize 0
grid columnconfig $f 0 -weight 1 -minsize 0
pack $f -expand yes -fill both -padx 1 -pady 1
-$v config -command "$c yview"
-$h config -command "$c xview"
+$v configure -command [list $c yview]
+$h configure -command [list $c xview]
# Create an entry for displaying and typing in current room.
-entry $c.entry -width 10 -relief sunken -bd 2 -textvariable currentRoom
+entry $c.entry -width 10 -textvariable currentRoom
# Choose colors, then fill in the floorplan.
diff --git a/library/demos/form.tcl b/library/demos/form.tcl
index 579b4af..4d80437 100644
--- a/library/demos/form.tcl
+++ b/library/demos/form.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .form
catch {destroy $w}
toplevel $w
@@ -17,11 +19,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "This window contains a simple form where you can type in the various entries and use tabs to move circularly between the entries."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
foreach i {f1 f2 f3 f4 f5} {
frame $w.$i -bd 2
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
new file mode 100644
index 0000000..284b5c2
--- /dev/null
+++ b/library/demos/goldberg.tcl
@@ -0,0 +1,1833 @@
+##+#################################################################
+#
+# TkGoldberg.tcl
+# by Keith Vetter, March 13, 2003
+#
+# "Man will always find a difficult means to perform a simple task"
+# Rube Goldberg
+#
+# Reproduced here with permission.
+#
+##+#################################################################
+#
+# Keith Vetter 2003-03-21: this started out as a simple little program
+# but was so much fun that it grew and grew. So I apologize about the
+# size but I just couldn't resist sharing it.
+#
+# This is a whizzlet that does a Rube Goldberg type animation, the
+# design of which comes from an New Years e-card from IncrediMail.
+# That version had nice sound effects which I eschewed. On the other
+# hand, that version was in black and white (actually dark blue and
+# light blue) and this one is fully colorized.
+#
+# One thing I learned from this project is that drawing filled complex
+# objects on a canvas is really hard. More often than not I had to
+# draw each item twice--once with the desired fill color but no
+# outline, and once with no fill but with the outline. Another trick
+# is erasing by drawing with the background color. Having a flood fill
+# command would have been extremely helpful.
+#
+# Two wiki pages were extremely helpful: Drawing rounded rectangles
+# which I generalized into Drawing rounded polygons, and regular
+# polygons which allowed me to convert ovals and arcs into polygons
+# which could then be rotated (see Canvas Rotation). I also wrote
+# Named Colors to aid in the color selection.
+#
+# I could comment on the code, but it's just 26 state machines with
+# lots of canvas create and move calls.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+
+set w .goldberg
+catch {destroy $w}
+toplevel $w
+wm title $w "Tk Goldberg (demonstration)"
+wm iconname $w "goldberg"
+wm resizable $w 0 0
+#positionWindow $w
+
+label $w.msg -font {Arial 10} -wraplength 4i -justify left -text "This is a\
+ demonstration of just how complex you can make your animations\
+ become. Click the ball to start things moving!\n\n\"Man will always\
+ find a difficult means to perform a simple task\"\n - Rube Goldberg"
+pack $w.msg -side top
+
+###--- End of Boilerplate ---###
+
+# Ensure that this this is an array
+array set animationCallbacks {}
+bind $w <Destroy> {
+ if {"%W" eq [winfo toplevel %W]} {
+ unset S C speed
+ }
+}
+
+set S(title) "Tk Goldberg"
+set S(speed) 5
+set S(cnt) 0
+set S(message) "\\nWelcome\\nto\\nTcl/Tk"
+array set speed {1 10 2 20 3 50 4 80 5 100 6 150 7 200 8 300 9 400 10 500}
+
+set MSTART 0; set MGO 1; set MPAUSE 2; set MSSTEP 3; set MBSTEP 4; set MDONE 5
+set S(mode) $::MSTART
+
+# Colors for everything
+set C(fg) black
+set C(bg) gray75
+set C(bg) cornflowerblue
+
+set C(0) white; set C(1a) darkgreen; set C(1b) yellow
+set C(2) red; set C(3a) green; set C(3b) darkblue
+set C(4) $C(fg); set C(5a) brown; set C(5b) white
+set C(6) magenta; set C(7) green; set C(8) $C(fg)
+set C(9) blue4; set C(10a) white; set C(10b) cyan
+set C(11a) yellow; set C(11b) mediumblue; set C(12) tan2
+set C(13a) yellow; set C(13b) red; set C(14) white
+set C(15a) green; set C(15b) yellow; set C(16) gray65
+set C(17) \#A65353; set C(18) $C(fg); set C(19) gray50
+set C(20) cyan; set C(21) gray65; set C(22) $C(20)
+set C(23a) blue; set C(23b) red; set C(23c) yellow
+set C(24a) red; set C(24b) white;
+
+proc DoDisplay {w} {
+ global S C
+
+ ttk::frame $w.ctrl -relief ridge -borderwidth 2 -padding 5
+ pack [frame $w.screen -bd 2 -relief raised] \
+ -side left -fill both -expand 1
+
+ canvas $w.c -width 860 -height 730 -bg $C(bg) -highlightthickness 0
+ $w.c config -scrollregion {0 0 1000 1000} ;# Kludge: move everything up
+ $w.c yview moveto .05
+ pack $w.c -in $w.screen -side top -fill both -expand 1
+
+ bind $w.c <3> [list $w.pause invoke]
+ bind $w.c <Destroy> {
+ after cancel $animationCallbacks(goldberg)
+ unset animationCallbacks(goldberg)
+ }
+ DoCtrlFrame $w
+ DoDetailFrame $w
+ if {[tk windowingsystem] ne "aqua"} {
+ ttk::button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2
+ } else {
+ button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
+ }
+ place $w.show -in $w.c -relx 1 -rely 0 -anchor ne
+ update
+}
+
+proc DoCtrlFrame {w} {
+ global S
+ ttk::button $w.start -text "Start" -command [list DoButton $w 0]
+ ttk::checkbutton $w.pause -text "Pause" -command [list DoButton $w 1] \
+ -variable S(pause)
+ ttk::button $w.step -text "Single Step" -command [list DoButton $w 2]
+ ttk::button $w.bstep -text "Big Step" -command [list DoButton $w 4]
+ ttk::button $w.reset -text "Reset" -command [list DoButton $w 3]
+ ttk::labelframe $w.details
+ raise $w.details
+ set S(details) 0
+ ttk::checkbutton $w.details.cb -text "Details" -variable S(details)
+ ttk::labelframe $w.message -text "Message"
+ ttk::entry $w.message.e -textvariable S(message) -justify center
+ ttk::labelframe $w.speed -text "Speed: 0"
+ ttk::scale $w.speed.scale -orient h -from 1 -to 10 -variable S(speed)
+ ttk::button $w.about -text About -command [list About $w]
+
+ grid $w.start -in $w.ctrl -row 0 -sticky ew
+ grid rowconfigure $w.ctrl 1 -minsize 10
+ grid $w.pause -in $w.ctrl -row 2 -sticky ew
+ grid $w.step -in $w.ctrl -sticky ew -pady 2
+ grid $w.bstep -in $w.ctrl -sticky ew
+ grid $w.reset -in $w.ctrl -sticky ew -pady 2
+ grid rowconfigure $w.ctrl 10 -minsize 18
+ grid $w.details -in $w.ctrl -row 11 -sticky ew
+ grid rowconfigure $w.ctrl 11 -minsize 20
+ $w.details configure -labelwidget $w.details.cb
+ grid [ttk::frame $w.details.b -height 1] ;# Work around minor bug
+ raise $w.details
+ raise $w.details.cb
+ grid rowconfigure $w.ctrl 50 -weight 1
+ trace variable ::S(mode) w [list ActiveGUI $w]
+ trace variable ::S(details) w [list ActiveGUI $w]
+ trace variable ::S(speed) w [list ActiveGUI $w]
+
+ grid $w.message -in $w.ctrl -row 98 -sticky ew -pady 5
+ grid $w.message.e -sticky nsew
+ grid $w.speed -in $w.ctrl -row 99 -sticky ew -pady {0 5}
+ pack $w.speed.scale -fill both -expand 1
+ grid $w.about -in $w.ctrl -row 100 -sticky ew
+ bind $w.reset <3> {set S(mode) -1} ;# Debugging
+
+ ## See Code / Dismiss buttons hack!
+ set btns [addSeeDismiss $w.ctrl.buttons $w]
+ grid [ttk::separator $w.ctrl.sep] -sticky ew -pady 4
+ set i 0
+ foreach b [winfo children $btns] {
+ if {[winfo class $b] eq "TButton"} {
+ grid [set b2 [ttk::button $w.ctrl.b[incr i]]] -sticky ew
+ foreach b3 [$b configure] {
+ set b3 [lindex $b3 0]
+ # Some options are read-only; ignore those errors
+ catch {$b2 configure $b3 [$b cget $b3]}
+ }
+ }
+ }
+ destroy $btns
+}
+
+proc DoDetailFrame {w} {
+ set w2 $w.details.f
+ ttk::frame $w2
+
+ set bd 2
+ ttk::label $w2.l -textvariable S(cnt) -background white
+ grid $w2.l - - - -sticky ew -row 0
+ for {set i 1} {1} {incr i} {
+ if {[info procs "Move$i"] eq ""} break
+ ttk::label $w2.l$i -text $i -anchor e -width 2 -background white
+ ttk::label $w2.ll$i -textvariable STEP($i) -width 5 -background white
+ set row [expr {($i + 1) / 2}]
+ set col [expr {(($i + 1) & 1) * 2}]
+ grid $w2.l$i -sticky ew -row $row -column $col
+ grid $w2.ll$i -sticky ew -row $row -column [incr col]
+ }
+ grid columnconfigure $w2 1 -weight 1
+}
+
+# Map or unmap the ctrl window
+proc ShowCtrl {w} {
+ if {[winfo ismapped $w.ctrl]} {
+ pack forget $w.ctrl
+ $w.show config -text "\u00bb"
+ } else {
+ pack $w.ctrl -side right -fill both -ipady 5
+ $w.show config -text "\u00ab"
+ }
+}
+
+proc DrawAll {w} {
+ ResetStep
+ $w.c delete all
+ for {set i 0} {1} {incr i} {
+ set p "Draw$i"
+ if {[info procs $p] eq ""} break
+ $p $w
+ }
+}
+
+proc ActiveGUI {w var1 var2 op} {
+ global S MGO MSTART MDONE
+ array set z {0 disabled 1 normal}
+
+ set m $S(mode)
+ set S(pause) [expr {$m == 2}]
+ $w.start config -state $z([expr {$m != $MGO}])
+ $w.pause config -state $z([expr {$m != $MSTART && $m != $MDONE}])
+ $w.step config -state $z([expr {$m != $MGO && $m != $MDONE}])
+ $w.bstep config -state $z([expr {$m != $MGO && $m != $MDONE}])
+ $w.reset config -state $z([expr {$m != $MSTART}])
+
+ if {$S(details)} {
+ grid $w.details.f -sticky ew
+ } else {
+ grid forget $w.details.f
+ }
+ set S(speed) [expr {round($S(speed))}]
+ $w.speed config -text "Speed: $S(speed)"
+}
+
+proc Start {} {
+ global S MGO
+ set S(mode) $MGO
+}
+
+proc DoButton {w what} {
+ global S MDONE MGO MSSTEP MBSTEP MPAUSE
+
+ if {$what == 0} { ;# Start
+ if {$S(mode) == $MDONE} {
+ Reset $w
+ }
+ set S(mode) $MGO
+ } elseif {$what == 1} { ;# Pause
+ set S(mode) [expr {$S(pause) ? $MPAUSE : $MGO}]
+ } elseif {$what == 2} { ;# Step
+ set S(mode) $MSSTEP
+ } elseif {$what == 3} { ;# Reset
+ Reset $w
+ } elseif {$what == 4} { ;# Big step
+ set S(mode) $MBSTEP
+ }
+}
+
+proc Go {w {who {}}} {
+ global S speed animationCallbacks MGO MPAUSE MSSTEP MBSTEP
+
+ set now [clock clicks -milliseconds]
+ catch {after cancel $animationCallbacks(goldberg)}
+ if {$who ne ""} { ;# Start here for debugging
+ set S(active) $who;
+ set S(mode) $MGO
+ }
+ if {$S(mode) == -1} return ;# Debugging
+ set n 0
+ if {$S(mode) != $MPAUSE} { ;# Not paused
+ set n [NextStep $w] ;# Do the next move
+ }
+ if {$S(mode) == $MSSTEP} { ;# Single step
+ set S(mode) $MPAUSE
+ }
+ if {$S(mode) == $MBSTEP && $n} { ;# Big step
+ set S(mode) $MSSTEP
+ }
+
+ set elapsed [expr {[clock click -milliseconds] - $now}]
+ set delay [expr {$speed($S(speed)) - $elapsed}]
+ if {$delay <= 0} {
+ set delay 1
+ }
+ set animationCallbacks(goldberg) [after $delay [list Go $w]]
+}
+
+# NextStep: drives the next step of the animation
+proc NextStep {w} {
+ global S MSTART MDONE
+ set rval 0 ;# Return value
+
+ if {$S(mode) != $MSTART && $S(mode) != $MDONE} {
+ incr S(cnt)
+ }
+ set alive {}
+ foreach {who} $S(active) {
+ set n ["Move$who" $w]
+ if {$n & 1} { ;# This guy still alive
+ lappend alive $who
+ }
+ if {$n & 2} { ;# Next guy is active
+ lappend alive [expr {$who + 1}]
+ set rval 1
+ }
+ if {$n & 4} { ;# End of puzzle flag
+ set S(mode) $MDONE ;# Done mode
+ set S(active) {} ;# No more animation
+ return 1
+ }
+ }
+ set S(active) $alive
+ return $rval
+}
+proc About {w} {
+ set msg "$::S(title)\nby Keith Vetter, March 2003\n(Reproduced by kind\
+ permission of the author)\n\n\"Man will always find a difficult\
+ means to perform a simple task.\"\nRube Goldberg"
+ tk_messageBox -parent $w -message $msg -title About
+}
+################################################################
+#
+# All the drawing and moving routines
+#
+
+# START HERE! banner
+proc Draw0 {w} {
+ set color $::C(0)
+ set xy {579 119}
+ $w.c create text $xy -text "START HERE!" -fill $color -anchor w \
+ -tag I0 -font {{Times Roman} 12 italic bold}
+ set xy {719 119 763 119}
+ $w.c create line $xy -tag I0 -fill $color -width 5 -arrow last \
+ -arrowshape {18 18 5}
+ $w.c bind I0 <1> Start
+}
+proc Move0 {w {step {}}} {
+ set step [GetStep 0 $step]
+
+ if {$::S(mode) > $::MSTART} { ;# Start the ball rolling
+ MoveAbs $w I0 {-100 -100} ;# Hide the banner
+ return 2
+ }
+
+ set pos {
+ {673 119} {678 119} {683 119} {688 119}
+ {693 119} {688 119} {683 119} {678 119}
+ }
+ set step [expr {$step % [llength $pos]}]
+ MoveAbs $w I0 [lindex $pos $step]
+ return 1
+}
+
+# Dropping ball
+proc Draw1 {w} {
+ set color $::C(1a)
+ set color2 $::C(1b)
+ set xy {844 133 800 133 800 346 820 346 820 168 844 168 844 133}
+ $w.c create poly $xy -width 3 -fill $color -outline {}
+ set xy {771 133 685 133 685 168 751 168 751 346 771 346 771 133}
+ $w.c create poly $xy -width 3 -fill $color -outline {}
+
+ set xy [box 812 122 9]
+ $w.c create oval $xy -tag I1 -fill $color2 -outline {}
+ $w.c bind I1 <1> Start
+}
+proc Move1 {w {step {}}} {
+ set step [GetStep 1 $step]
+ set pos {
+ {807 122} {802 122} {797 123} {793 124} {789 129} {785 153}
+ {785 203} {785 278 x} {785 367} {810 392} {816 438} {821 503}
+ {824 585 y} {838 587} {848 593} {857 601} {-100 -100}
+ }
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+ set where [lindex $pos $step]
+ MoveAbs $w I1 $where
+
+ if {[lindex $where 2] eq "y"} {
+ Move15a $w
+ }
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# Lighting the match
+proc Draw2 {w} {
+ set color red
+ set color $::C(2)
+ set xy {750 369 740 392 760 392} ;# Fulcrum
+ $w.c create poly $xy -fill $::C(fg) -outline $::C(fg)
+ set xy {628 335 660 383} ;# Strike box
+ $w.c create rect $xy -fill {} -outline $::C(fg)
+ for {set y 0} {$y < 3} {incr y} {
+ set yy [expr {335+$y*16}]
+ $w.c create bitmap 628 $yy -bitmap gray25 -anchor nw \
+ -foreground $::C(fg)
+ $w.c create bitmap 644 $yy -bitmap gray25 -anchor nw \
+ -foreground $::C(fg)
+ }
+
+ set xy {702 366 798 366} ;# Lever
+ $w.c create line $xy -fill $::C(fg) -width 6 -tag I2_0
+ set xy {712 363 712 355} ;# R strap
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I2_1
+ set xy {705 363 705 355} ;# L strap
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I2_2
+ set xy {679 356 679 360 717 360 717 356 679 356} ;# Match stick
+ $w.c create line $xy -fill $::C(fg) -tag I2_3
+
+ #set xy {662 352 680 365} ;# Match head
+ set xy {
+ 671 352 677.4 353.9 680 358.5 677.4 363.1 671 365 664.6 363.1
+ 662 358.5 664.6 353.9
+ }
+ $w.c create poly $xy -fill $color -outline $color -tag I2_4
+}
+proc Move2 {w {step {}}} {
+ set step [GetStep 2 $step]
+
+ set stages {0 0 1 2 0 2 1 0 1 2 0 2 1}
+ set xy(0) {
+ 686 333 692 323 682 316 674 309 671 295 668 307 662 318 662 328
+ 671 336
+ }
+ set xy(1) {687 331 698 322 703 295 680 320 668 297 663 311 661 327 671 335}
+ set xy(2) {
+ 686 331 704 322 688 300 678 283 678 283 674 298 666 309 660 324
+ 672 336
+ }
+
+ if {$step >= [llength $stages]} {
+ $w.c delete I2
+ return 0
+ }
+
+ if {$step == 0} { ;# Rotate the match
+ set beta 20
+ lassign [Anchor $w I2_0 s] Ox Oy ;# Where to pivot
+ for {set i 0} {[$w.c find withtag I2_$i] ne ""} {incr i} {
+ RotateItem $w I2_$i $Ox $Oy $beta
+ }
+ $w.c create poly -tag I2 -smooth 1 -fill $::C(2) ;# For the flame
+ return 1
+ }
+ $w.c coords I2 $xy([lindex $stages $step])
+ return [expr {$step == 7 ? 3 : 1}]
+}
+
+# Weight and pulleys
+proc Draw3 {w} {
+ set color $::C(3a)
+ set color2 $::C(3b)
+
+ set xy {602 296 577 174 518 174}
+ foreach {x y} $xy { ;# 3 Pulleys
+ $w.c create oval [box $x $y 13] -fill $color -outline $::C(fg) \
+ -width 3
+ $w.c create oval [box $x $y 2] -fill $::C(fg) -outline $::C(fg)
+ }
+
+ set xy {750 309 670 309} ;# Wall to flame
+ $w.c create line $xy -tag I3_s -width 3 -fill $::C(fg) -smooth 1
+ set xy {670 309 650 309} ;# Flame to pulley 1
+ $w.c create line $xy -tag I3_0 -width 3 -fill $::C(fg)
+ set xy {650 309 600 309} ;# Flame to pulley 1
+ $w.c create line $xy -tag I3_1 -width 3 -fill $::C(fg)
+ set xy {589 296 589 235} ;# Pulley 1 half way to 2
+ $w.c create line $xy -tag I3_2 -width 3 -fill $::C(fg)
+ set xy {589 235 589 174} ;# Pulley 1 other half to 2
+ $w.c create line $xy -width 3 -fill $::C(fg)
+ set xy {577 161 518 161} ;# Across the top
+ $w.c create line $xy -width 3 -fill $::C(fg)
+ set xy {505 174 505 205} ;# Down to weight
+ $w.c create line $xy -tag I3_w -width 3 -fill $::C(fg)
+
+ # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle
+ set xy {515 207 495 207}
+ foreach {x1 y1 x2 y2} $xy {
+ $w.c create oval [box $x1 $y1 6] -tag I3_ -fill $color2 \
+ -outline $color2
+ $w.c create oval [box $x2 $y2 6] -tag I3_ -fill $color2 \
+ -outline $color2
+ incr y1 -6; incr y2 6
+ $w.c create rect $x1 $y1 $x2 $y2 -tag I3_ -fill $color2 \
+ -outline $color2
+ }
+ set xy {492 220 518 263}
+ set xy [RoundRect $w $xy 15]
+ $w.c create poly $xy -smooth 1 -tag I3_ -fill $color2 -outline $color2
+ set xy {500 217 511 217}
+ $w.c create line $xy -tag I3_ -fill $color2 -width 10
+
+ set xy {502 393 522 393 522 465} ;# Bottom weight target
+ $w.c create line $xy -tag I3__ -fill $::C(fg) -join miter -width 10
+}
+proc Move3 {w {step {}}} {
+ set step [GetStep 3 $step]
+
+ set pos {{505 247} {505 297} {505 386.5} {505 386.5}}
+ set rope(0) {750 309 729 301 711 324 690 300}
+ set rope(1) {750 309 737 292 736 335 717 315 712 320}
+ set rope(2) {750 309 737 309 740 343 736 351 725 340}
+ set rope(3) {750 309 738 321 746 345 742 356}
+
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+
+ $w.c delete "I3_$step" ;# Delete part of the rope
+ MoveAbs $w I3_ [lindex $pos $step] ;# Move weight down
+ $w.c coords I3_s $rope($step) ;# Flapping rope end
+ $w.c coords I3_w [concat 505 174 [lindex $pos $step]]
+ if {$step == 2} {
+ $w.c move I3__ 0 30
+ return 2
+ }
+ return 1
+}
+
+# Cage and door
+proc Draw4 {w} {
+ set color $::C(4)
+ lassign {527 356 611 464} x0 y0 x1 y1
+
+ for {set y $y0} {$y <= $y1} {incr y 12} { ;# Horizontal bars
+ $w.c create line $x0 $y $x1 $y -fill $color -width 1
+ }
+ for {set x $x0} {$x <= $x1} {incr x 12} { ;# Vertical bars
+ $w.c create line $x $y0 $x $y1 -fill $color -width 1
+ }
+
+ set xy {518 464 518 428} ;# Swing gate
+ $w.c create line $xy -tag I4 -fill $color -width 3
+}
+proc Move4 {w {step {}}} {
+ set step [GetStep 4 $step]
+
+ set angles {-10 -20 -30 -30}
+ if {$step >= [llength $angles]} {
+ return 0
+ }
+ RotateItem $w I4 518 464 [lindex $angles $step]
+ $w.c raise I4
+ return [expr {$step == 3 ? 3 : 1}]
+}
+
+# Mouse
+proc Draw5 {w} {
+ set color $::C(5a)
+ set color2 $::C(5b)
+ set xy {377 248 410 248 410 465 518 465} ;# Mouse course
+ lappend xy 518 428 451 428 451 212 377 212
+ $w.c create poly $xy -fill $color2 -outline $::C(fg) -width 3
+
+ set xy {
+ 534.5 445.5 541 440 552 436 560 436 569 440 574 446 575 452 574 454
+ 566 456 554 456 545 456 537 454 530 452
+ }
+ $w.c create poly $xy -tag {I5 I5_0} -fill $color
+ set xy {573 452 592 458 601 460 613 456} ;# Tail
+ $w.c create line $xy -tag {I5 I5_1} -fill $color -smooth 1 -width 3
+ set xy [box 540 446 2] ;# Eye
+ set xy {540 444 541 445 541 447 540 448 538 447 538 445}
+ #.c create oval $xy -tag {I5 I5_2} -fill $::C(bg) -outline {}
+ $w.c create poly $xy -tag {I5 I5_2} -fill $::C(bg) -outline {} -smooth 1
+ set xy {538 454 535 461} ;# Front leg
+ $w.c create line $xy -tag {I5 I5_3} -fill $color -width 2
+ set xy {566 455 569 462} ;# Back leg
+ $w.c create line $xy -tag {I5 I5_4} -fill $color -width 2
+ set xy {544 455 545 460} ;# 2nd front leg
+ $w.c create line $xy -tag {I5 I5_5} -fill $color -width 2
+ set xy {560 455 558 460} ;# 2nd back leg
+ $w.c create line $xy -tag {I5 I5_6} -fill $color -width 2
+}
+proc Move5 {w {step {}}} {
+ set step [GetStep 5 $step]
+
+ set pos {
+ {553 452} {533 452} {513 452} {493 452} {473 452}
+ {463 442 30} {445.5 441.5 30} {425.5 434.5 30} {422 414} {422 394}
+ {422 374} {422 354} {422 334} {422 314} {422 294}
+ {422 274 -30} {422 260.5 -30 x} {422.5 248.5 -28} {425 237}
+ }
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+
+ lassign [lindex $pos $step] x y beta next
+ MoveAbs $w I5 [list $x $y]
+ if {$beta ne ""} {
+ lassign [Centroid $w I5_0] Ox Oy
+ foreach id {0 1 2 3 4 5 6} {
+ RotateItem $w I5_$id $Ox $Oy $beta
+ }
+ }
+ if {$next eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# Dropping gumballs
+array set XY6 {
+ -1 {366 207} -2 {349 204} -3 {359 193} -4 {375 192} -5 {340 190}
+ -6 {349 177} -7 {366 177} -8 {380 176} -9 {332 172} -10 {342 161}
+ -11 {357 164} -12 {372 163} -13 {381 149} -14 {364 151} -15 {349 146}
+ -16 {333 148} 0 {357 219}
+ 1 {359 261} 2 {359 291} 3 {359 318} 4 {361 324} 5 {365 329} 6 {367 334}
+ 7 {367 340} 8 {366 346} 9 {364 350} 10 {361 355} 11 {359 370} 12 {359 391}
+ 13,0 {360 456} 13,1 {376 456} 13,2 {346 456} 13,3 {330 456}
+ 13,4 {353 444} 13,5 {368 443} 13,6 {339 442} 13,7 {359 431}
+ 13,8 {380 437} 13,9 {345 428} 13,10 {328 434} 13,11 {373 424}
+ 13,12 {331 420} 13,13 {360 417} 13,14 {345 412} 13,15 {376 410}
+ 13,16 {360 403}
+}
+proc Draw6 {w} {
+ set color $::C(6)
+ set xy {324 130 391 204} ;# Ball holder
+ set xy [RoundRect $w $xy 10]
+ $w.c create poly $xy -smooth 1 -outline $::C(fg) -width 3 -fill $color
+ set xy {339 204 376 253} ;# Below the ball holder
+ $w.c create rect $xy -fill {} -outline $::C(fg) -width 3 -fill $color \
+ -tag I6c
+ set xy [box 346 339 28]
+ $w.c create oval $xy -fill $color -outline {} ;# Rotor
+ $w.c create arc $xy -outline $::C(fg) -width 2 -style arc \
+ -start 80 -extent 205
+ $w.c create arc $xy -outline $::C(fg) -width 2 -style arc \
+ -start -41 -extent 85
+
+ set xy [box 346 339 15] ;# Center of rotor
+ $w.c create oval $xy -outline $::C(fg) -fill $::C(fg) -tag I6m
+ set xy {352 312 352 254 368 254 368 322} ;# Top drop to rotor
+ $w.c create poly $xy -fill $color -outline {}
+ $w.c create line $xy -fill $::C(fg) -width 2
+
+ set xy {353 240 367 300} ;# Poke bottom hole
+ $w.c create rect $xy -fill $color -outline {}
+ set xy {341 190 375 210} ;# Poke another hole
+ $w.c create rect $xy -fill $color -outline {}
+
+ set xy {368 356 368 403 389 403 389 464 320 464 320 403 352 403 352 366}
+ $w.c create poly $xy -fill $color -outline {} -width 2 ;# Below rotor
+ $w.c create line $xy -fill $::C(fg) -width 2
+ set xy [box 275 342 7] ;# On/off rotor
+ $w.c create oval $xy -outline $::C(fg) -fill $::C(fg)
+ set xy {276 334 342 325} ;# Fan belt top
+ $w.c create line $xy -fill $::C(fg) -width 3
+ set xy {276 349 342 353} ;# Fan belt bottom
+ $w.c create line $xy -fill $::C(fg) -width 3
+
+ set xy {337 212 337 247} ;# What the mouse pushes
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I6_
+ set xy {392 212 392 247}
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I6_
+ set xy {337 230 392 230}
+ $w.c create line $xy -fill $::C(fg) -width 7 -tag I6_
+
+ set who -1 ;# All the balls
+ set colors {red cyan orange green blue darkblue}
+ lappend colors {*}$colors {*}$colors
+
+ for {set i 0} {$i < 17} {incr i} {
+ set loc [expr {-1 * $i}]
+ set color [lindex $colors $i]
+ $w.c create oval [box {*}$::XY6($loc) 5] -fill $color \
+ -outline $color -tag I6_b$i
+ }
+ Draw6a $w 12 ;# The wheel
+}
+proc Draw6a {w beta} {
+ $w.c delete I6_0
+ lassign {346 339} Ox Oy
+ for {set i 0} {$i < 4} {incr i} {
+ set b [expr {$beta + $i * 45}]
+ lassign [RotateC 28 0 0 0 $b] x y
+ set xy [list [expr {$Ox+$x}] [expr {$Oy+$y}] \
+ [expr {$Ox-$x}] [expr {$Oy-$y}]]
+ $w.c create line $xy -tag I6_0 -fill $::C(fg) -width 2
+ }
+}
+proc Move6 {w {step {}}} {
+ set step [GetStep 6 $step]
+ if {$step > 62} {
+ return 0
+ }
+
+ if {$step < 2} { ;# Open gate for balls to drop
+ $w.c move I6_ -7 0
+ if {$step == 1} { ;# Poke a hole
+ set xy {348 226 365 240}
+ $w.c create rect $xy -fill [$w.c itemcget I6c -fill] -outline {}
+ }
+ return 1
+ }
+
+ set s [expr {$step - 1}] ;# Do the gumball drop dance
+ for {set i 0} {$i <= int(($s-1) / 3)} {incr i} {
+ set tag "I6_b$i"
+ if {[$w.c find withtag $tag] eq ""} break
+ set loc [expr {$s - 3 * $i}]
+
+ if {[info exists ::XY6($loc,$i)]} {
+ MoveAbs $w $tag $::XY6($loc,$i)
+ } elseif {[info exists ::XY6($loc)]} {
+ MoveAbs $w $tag $::XY6($loc)
+ }
+ }
+ if {($s % 3) == 1} {
+ set first [expr {($s + 2) / 3}]
+ for {set i $first} {1} {incr i} {
+ set tag "I6_b$i"
+ if {[$w.c find withtag $tag] eq ""} break
+ set loc [expr {$first - $i}]
+ MoveAbs $w $tag $::XY6($loc)
+ }
+ }
+ if {$s >= 3} { ;# Rotate the motor
+ set idx [expr {$s % 3}]
+ #Draw6a $w [lindex {12 35 64} $idx]
+ Draw6a $w [expr {12 + $s * 15}]
+ }
+ return [expr {$s == 3 ? 3 : 1}]
+}
+
+# On/off switch
+proc Draw7 {w} {
+ set color $::C(7)
+ set xy {198 306 277 374} ;# Box
+ $w.c create rect $xy -outline $::C(fg) -width 2 -fill $color -tag I7z
+ $w.c lower I7z
+ set xy {275 343 230 349}
+ $w.c create line $xy -tag I7 -fill $::C(fg) -arrow last \
+ -arrowshape {23 23 8} -width 6
+ set xy {225 324} ;# On button
+ $w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg)
+ set xy {218 323} ;# On text
+ set font {{Times Roman} 8}
+ $w.c create text $xy -text "on" -anchor e -fill $::C(fg) -font $font
+ set xy {225 350} ;# Off button
+ $w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg)
+ set xy {218 349} ;# Off button
+ $w.c create text $xy -text "off" -anchor e -fill $::C(fg) -font $font
+}
+proc Move7 {w {step {}}} {
+ set step [GetStep 7 $step]
+ set numsteps 30
+ if {$step > $numsteps} {
+ return 0
+ }
+ set beta [expr {30.0 / $numsteps}]
+ RotateItem $w I7 275 343 $beta
+
+ return [expr {$step == $numsteps ? 3 : 1}]
+}
+
+# Electricity to the fan
+proc Draw8 {w} {
+ Sine $w 271 248 271 306 5 8 -tag I8_s -fill $::C(8) -width 3
+}
+proc Move8 {w {step {}}} {
+ set step [GetStep 8 $step]
+
+ if {$step > 3} {
+ return 0
+ }
+ if {$step == 0} {
+ Sparkle $w [Anchor $w I8_s s] I8
+ return 1
+
+ } elseif {$step == 1} {
+ MoveAbs $w I8 [Anchor $w I8_s c]
+ } elseif {$step == 2} {
+ MoveAbs $w I8 [Anchor $w I8_s n]
+ } else {
+ $w.c delete I8
+ }
+ return [expr {$step == 2 ? 3 : 1}]
+}
+
+# Fan
+proc Draw9 {w} {
+ set color $::C(9)
+ set xy {266 194 310 220}
+ $w.c create oval $xy -outline $color -fill $color
+ set xy {280 209 296 248}
+ $w.c create oval $xy -outline $color -fill $color
+ set xy {288 249 252 249 260 240 280 234 296 234 316 240 324 249 288 249}
+ $w.c create poly $xy -fill $color -smooth 1
+
+ set xy {248 205 265 214 264 205 265 196} ;# Spinner
+ $w.c create poly $xy -fill $color
+
+ set xy {255 206 265 234} ;# Fan blades
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 3 -tag I9_0
+ set xy {255 176 265 204}
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 3 -tag I9_0
+ set xy {255 206 265 220}
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 1 -tag I9_1
+ set xy {255 190 265 204}
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 1 -tag I9_1
+}
+proc Move9 {w {step {}}} {
+ set step [GetStep 9 $step]
+
+ if {$step & 1} {
+ $w.c itemconfig I9_0 -width 4
+ $w.c itemconfig I9_1 -width 1
+ $w.c lower I9_1 I9_0
+ } else {
+ $w.c itemconfig I9_0 -width 1
+ $w.c itemconfig I9_1 -width 4
+ $w.c lower I9_0 I9_1
+ }
+ if {$step == 0} {
+ return 3
+ }
+ return 1
+}
+
+# Boat
+proc Draw10 {w} {
+ set color $::C(10a)
+ set color2 $::C(10b)
+ set xy {191 230 233 230 233 178 191 178} ;# Sail
+ $w.c create poly $xy -fill $color -width 3 -outline $::C(fg) -tag I10
+ set xy [box 209 204 31] ;# Front
+ $w.c create arc $xy -outline {} -fill $color -style pie \
+ -start 120 -extent 120 -tag I10
+ $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ -start 120 -extent 120 -tag I10
+ set xy [box 249 204 31] ;# Back
+ $w.c create arc $xy -outline {} -fill $::C(bg) -width 3 -style pie \
+ -start 120 -extent 120 -tag I10
+ $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ -start 120 -extent 120 -tag I10
+
+ set xy {200 171 200 249} ;# Mast
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I10
+ set xy {159 234 182 234} ;# Bow sprit
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I10
+ set xy {180 234 180 251 220 251} ;# Hull
+ $w.c create line $xy -fill $::C(fg) -width 6 -tag I10
+
+ set xy {92 255 221 255} ;# Waves
+ Sine $w {*}$xy 2 25 -fill $color2 -width 1 -tag I10w
+
+ set xy [lrange [$w.c coords I10w] 4 end-4] ;# Water
+ set xy [concat $xy 222 266 222 277 99 277]
+ $w.c create poly $xy -fill $color2 -outline $color2
+ set xy {222 266 222 277 97 277 97 266} ;# Water bottom
+ $w.c create line $xy -fill $::C(fg) -width 3
+
+ set xy [box 239 262 17]
+ $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ -start 95 -extent 103
+ set xy [box 76 266 21]
+ $w.c create arc $xy -outline $::C(fg) -width 3 -style arc -extent 190
+}
+proc Move10 {w {step {}}} {
+ set step [GetStep 10 $step]
+ set pos {
+ {195 212} {193 212} {190 212} {186 212} {181 212} {176 212}
+ {171 212} {166 212} {161 212} {156 212} {151 212} {147 212} {142 212}
+ {137 212} {132 212 x} {127 212} {121 212} {116 212} {111 212}
+ }
+
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+ set where [lindex $pos $step]
+ MoveAbs $w I10 $where
+
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# 2nd ball drop
+proc Draw11 {w} {
+ set color $::C(11a)
+ set color2 $::C(11b)
+ set xy {23 264 55 591} ;# Color the down tube
+ $w.c create rect $xy -fill $color -outline {}
+ set xy [box 71 460 48] ;# Color the outer loop
+ $w.c create oval $xy -fill $color -outline {}
+
+ set xy {55 264 55 458} ;# Top right side
+ $w.c create line $xy -fill $::C(fg) -width 3
+ set xy {55 504 55 591} ;# Bottom right side
+ $w.c create line $xy -fill $::C(fg) -width 3
+ set xy [box 71 460 48] ;# Outer loop
+ $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ -start 110 -extent -290 -tag I11i
+ set xy [box 71 460 16] ;# Inner loop
+ $w.c create oval $xy -outline $::C(fg) -fill {} -width 3 -tag I11i
+ $w.c create oval $xy -outline $::C(fg) -fill $::C(bg) -width 3
+
+ set xy {23 264 23 591} ;# Left side
+ $w.c create line $xy -fill $::C(fg) -width 3
+ set xy [box 1 266 23] ;# Top left curve
+ $w.c create arc $xy -outline $::C(fg) -width 3 -style arc -extent 90
+
+ set xy [box 75 235 9] ;# The ball
+ $w.c create oval $xy -fill $color2 -outline {} -width 3 -tag I11
+}
+proc Move11 {w {step {}}} {
+ set step [GetStep 11 $step]
+ set pos {
+ {75 235} {70 235} {65 237} {56 240} {46 247} {38 266} {38 296}
+ {38 333} {38 399} {38 475} {74 496} {105 472} {100 437} {65 423}
+ {-100 -100} {38 505} {38 527 x} {38 591}
+ }
+
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+ set where [lindex $pos $step]
+ MoveAbs $w I11 $where
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# Hand
+proc Draw12 {w} {
+ set xy {20 637 20 617 20 610 20 590 40 590 40 590 60 590 60 610 60 610}
+ lappend xy 60 610 65 620 60 631 ;# Thumb
+ lappend xy 60 631 60 637 60 662 60 669 52 669 56 669 50 669 50 662 50 637
+
+ set y0 637 ;# Bumps for fingers
+ set y1 645
+ for {set x 50} {$x > 20} {incr x -10} {
+ set x1 [expr {$x - 5}]
+ set x2 [expr {$x - 10}]
+ lappend xy $x $y0 $x1 $y1 $x2 $y0
+ }
+ $w.c create poly $xy -fill $::C(12) -outline $::C(fg) -smooth 1 -tag I12 \
+ -width 3
+}
+proc Move12 {w {step {}}} {
+ set step [GetStep 12 $step]
+ set pos {{42.5 641 x}}
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+
+ set where [lindex $pos $step]
+ MoveAbs $w I12 $where
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# Fax
+proc Draw13 {w} {
+ set color $::C(13a)
+ set xy {86 663 149 663 149 704 50 704 50 681 64 681 86 671}
+ set xy2 {784 663 721 663 721 704 820 704 820 681 806 681 784 671}
+ set radii {2 9 9 8 5 5 2}
+
+ RoundPoly $w.c $xy $radii -width 3 -outline $::C(fg) -fill $color
+ RoundPoly $w.c $xy2 $radii -width 3 -outline $::C(fg) -fill $color
+
+ set xy {56 677}
+ $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 3 \
+ -tag I13
+ set xy {809 677}
+ $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 3 \
+ -tag I13R
+
+ set xy {112 687} ;# Label
+ $w.c create text $xy -text "FAX" -fill $::C(fg) \
+ -font {{Times Roman} 12 bold}
+ set xy {762 687}
+ $w.c create text $xy -text "FAX" -fill $::C(fg) \
+ -font {{Times Roman} 12 bold}
+
+ set xy {138 663 148 636 178 636} ;# Paper guide
+ $w.c create line $xy -smooth 1 -fill $::C(fg) -width 3
+ set xy {732 663 722 636 692 636}
+ $w.c create line $xy -smooth 1 -fill $::C(fg) -width 3
+
+ Sine $w 149 688 720 688 5 15 -tag I13_s -fill $::C(fg) -width 3
+}
+proc Move13 {w {step {}}} {
+ set step [GetStep 13 $step]
+ set numsteps 7
+
+ if {$step == $numsteps+2} {
+ MoveAbs $w I13_star {-100 -100}
+ $w.c itemconfig I13R -fill $::C(13b) -width 2
+ return 2
+ }
+ if {$step == 0} { ;# Button down
+ $w.c delete I13
+ Sparkle $w {-100 -100} I13_star ;# Create off screen
+ return 1
+ }
+ lassign [Anchor $w I13_s w] x0 y0
+ lassign [Anchor $w I13_s e] x1 y1
+ set x [expr {$x0 + ($x1-$x0) * ($step - 1) / double($numsteps)}]
+ MoveAbs $w I13_star [list $x $y0]
+ return 1
+}
+
+# Paper in fax
+proc Draw14 {w} {
+ set color $::C(14)
+ set xy {102 661 113 632 130 618} ;# Left paper edge
+ $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14L_0
+ set xy {148 629 125 640 124 662} ;# Right paper edge
+ $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14L_1
+ Draw14a $w L
+
+ set xy {
+ 768.0 662.5 767.991316225 662.433786215 767.926187912 662.396880171
+ }
+ $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14R_0
+ $w.c lower I14R_0
+ # NB. these numbers are VERY sensitive, you must start with final size
+ # and shrink down to get the values
+ set xy {
+ 745.947897349 662.428358855 745.997829056 662.452239237 746.0 662.5
+ }
+ $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14R_1
+ $w.c lower I14R_1
+}
+proc Draw14a {w side} {
+ set color $::C(14)
+ set xy [$w.c coords I14${side}_0]
+ set xy2 [$w.c coords I14${side}_1]
+ lassign $xy x0 y0 x1 y1 x2 y2
+ lassign $xy2 x3 y3 x4 y4 x5 y5
+ set zz [concat \
+ $x0 $y0 $x0 $y0 $xy $x2 $y2 $x2 $y2 \
+ $x3 $y3 $x3 $y3 $xy2 $x5 $y5 $x5 $y5]
+ $w.c delete I14$side
+ $w.c create poly $zz -tag I14$side -smooth 1 -fill $color -outline $color \
+ -width 3
+ $w.c lower I14$side
+}
+proc Move14 {w {step {}}} {
+ set step [GetStep 14 $step]
+
+ # Paper going down
+ set sc [expr {.9 - .05*$step}]
+ if {$sc < .3} {
+ $w.c delete I14L
+ return 0
+ }
+
+ lassign [$w.c coords I14L_0] Ox Oy
+ $w.c scale I14L_0 $Ox $Oy $sc $sc
+ lassign [lrange [$w.c coords I14L_1] end-1 end] Ox Oy
+ $w.c scale I14L_1 $Ox $Oy $sc $sc
+ Draw14a $w L
+
+ # Paper going up
+ set sc [expr {.35 + .05*$step}]
+ set sc [expr {1 / $sc}]
+
+ lassign [$w.c coords I14R_0] Ox Oy
+ $w.c scale I14R_0 $Ox $Oy $sc $sc
+ lassign [lrange [$w.c coords I14R_1] end-1 end] Ox Oy
+ $w.c scale I14R_1 $Ox $Oy $sc $sc
+ Draw14a $w R
+
+ return [expr {$step == 10 ? 3 : 1}]
+}
+
+# Light beam
+proc Draw15 {w} {
+ set color $::C(15a)
+ set xy {824 599 824 585 820 585 829 585}
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I15a
+ set xy {789 599 836 643}
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+ set xy {778 610 788 632}
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+ set xy {766 617 776 625}
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+
+ set xy {633 600 681 640}
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+ set xy {635 567 657 599}
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2
+ set xy {765 557 784 583}
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2
+
+ Sine $w 658 580 765 580 3 15 -tag I15_s -fill $::C(fg) -width 3
+}
+proc Move15a {w} {
+ set color $::C(15b)
+ $w.c scale I15a 824 599 1 .3 ;# Button down
+ set xy {765 621 681 621}
+ $w.c create line $xy -dash "-" -width 3 -fill $color -tag I15
+}
+proc Move15 {w {step {}}} {
+ set step [GetStep 15 $step]
+ set numsteps 6
+
+ if {$step == $numsteps+2} {
+ MoveAbs $w I15_star {-100 -100}
+ return 2
+ }
+ if {$step == 0} { ;# Break the light beam
+ Sparkle $w {-100 -100} I15_star
+ set xy {765 621 745 621}
+ $w.c coords I15 $xy
+ return 1
+ }
+ lassign [Anchor $w I15_s w] x0 y0
+ lassign [Anchor $w I15_s e] x1 y1
+ set x [expr {$x0 + ($x1-$x0) * ($step - 1) / double($numsteps)}]
+ MoveAbs $w I15_star [list $x $y0]
+ return 1
+}
+
+# Bell
+proc Draw16 {w} {
+ set color $::C(16)
+ set xy {722 485 791 556}
+ $w.c create rect $xy -fill {} -outline $::C(fg) -width 3
+ set xy [box 752 515 25] ;# Bell
+ $w.c create oval $xy -fill $color -outline black -tag I16b -width 2
+ set xy [box 752 515 5] ;# Bell button
+ $w.c create oval $xy -fill black -outline black -tag I16b
+
+ set xy {784 523 764 549} ;# Clapper
+ $w.c create line $xy -width 3 -tag I16c -fill $::C(fg)
+ set xy [box 784 523 4]
+ $w.c create oval $xy -fill $::C(fg) -outline $::C(fg) -tag I16d
+}
+proc Move16 {w {step {}}} {
+ set step [GetStep 16 $step]
+
+ # Note: we never stop
+ lassign {760 553} Ox Oy
+ if {$step & 1} {
+ set beta 12
+ $w.c move I16b 3 0
+ } else {
+ set beta -12
+ $w.c move I16b -3 0
+ }
+ RotateItem $w I16c $Ox $Oy $beta
+ RotateItem $w I16d $Ox $Oy $beta
+
+ return [expr {$step == 1 ? 3 : 1}]
+}
+
+# Cat
+proc Draw17 {w} {
+ set color $::C(17)
+
+ set xy {584 556 722 556}
+ $w.c create line $xy -fill $::C(fg) -width 3
+ set xy {584 485 722 485}
+ $w.c create line $xy -fill $::C(fg) -width 3
+
+ set xy {664 523 717 549} ;# Body
+ $w.c create arc $xy -outline $::C(fg) -fill $color -width 3 \
+ -style chord -start 128 -extent -260 -tag I17
+
+ set xy {709 554 690 543} ;# Paw
+ $w.c create oval $xy -outline $::C(fg) -fill $color -width 3 -tag I17
+ set xy {657 544 676 555}
+ $w.c create oval $xy -outline $::C(fg) -fill $color -width 3 -tag I17
+
+ set xy [box 660 535 15] ;# Lower face
+ $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ -start 150 -extent 240 -tag I17_
+ $w.c create arc $xy -outline {} -fill $color -width 1 -style chord \
+ -start 150 -extent 240 -tag I17_
+ set xy {674 529 670 513 662 521 658 521 650 513 647 529} ;# Ears
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ $w.c create poly $xy -fill $color -outline {} -width 1 -tag {I17_ I17_c}
+ set xy {652 542 628 539} ;# Whiskers
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ set xy {652 543 632 545}
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ set xy {652 546 632 552}
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+
+ set xy {668 543 687 538}
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
+ set xy {668 544 688 546}
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
+ set xy {668 547 688 553}
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
+
+ set xy {649 530 654 538 659 530} ;# Left eye
+ $w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
+ set xy {671 530 666 538 661 530} ;# Right eye
+ $w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
+ set xy {655 543 660 551 665 543} ;# Mouth
+ $w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
+}
+proc Move17 {w {step {}}} {
+ set step [GetStep 17 $step]
+
+ if {$step == 0} {
+ $w.c delete I17 ;# Delete most of the cat
+ set xy {655 543 660 535 665 543} ;# Mouth
+ $w.c create line $xy -fill $::C(fg) -width 3 -smooth 1 -tag I17_
+ set xy [box 654 530 4] ;# Left eye
+ $w.c create oval $xy -outline $::C(fg) -width 3 -fill {} -tag I17_
+ set xy [box 666 530 4] ;# Right eye
+ $w.c create oval $xy -outline $::C(fg) -width 3 -fill {} -tag I17_
+
+ $w.c move I17_ 0 -20 ;# Move face up
+ set xy {652 528 652 554} ;# Front leg
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ set xy {670 528 670 554} ;# 2nd front leg
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+
+ set xy {
+ 675 506 694 489 715 513 715 513 715 513 716 525 716 525 716 525
+ 706 530 695 530 679 535 668 527 668 527 668 527 675 522 676 517
+ 677 512
+ } ;# Body
+ $w.c create poly $xy -fill [$w.c itemcget I17_c -fill] \
+ -outline $::C(fg) -width 3 -smooth 1 -tag I17_
+ set xy {716 514 716 554} ;# Back leg
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ set xy {694 532 694 554} ;# 2nd back leg
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ set xy {715 514 718 506 719 495 716 488};# Tail
+ $w.c create line $xy -fill $::C(fg) -width 3 -smooth 1 -tag I17_
+
+ $w.c raise I17w ;# Make whiskers visible
+ $w.c move I17_ -5 0 ;# Move away from wall a bit
+ return 2
+ }
+ return 0
+}
+
+# Sling shot
+proc Draw18 {w} {
+ set color $::C(18)
+ set xy {721 506 627 506} ;# Sling hold
+ $w.c create line $xy -width 4 -fill $::C(fg) -tag I18
+
+ set xy {607 500 628 513} ;# Sling rock
+ $w.c create oval $xy -fill $color -outline {} -tag I18a
+
+ set xy {526 513 606 507 494 502} ;# Sling band
+ $w.c create line $xy -fill $::C(fg) -width 4 -tag I18b
+ set xy { 485 490 510 540 510 575 510 540 535 491 } ;# Sling
+ $w.c create line $xy -fill $::C(fg) -width 6
+}
+proc Move18 {w {step {}}} {
+ set step [GetStep 18 $step]
+
+ set pos {
+ {587 506} {537 506} {466 506} {376 506} {266 506 x} {136 506}
+ {16 506} {-100 -100}
+ }
+
+ set b(0) {490 502 719 507 524 512} ;# Band collapsing
+ set b(1) {
+ 491 503 524 557 563 505 559 496 546 506 551 525 553 536 538 534
+ 532 519 529 499
+ }
+ set b(2) {491 503 508 563 542 533 551 526 561 539 549 550 530 500}
+ set b(3) {491 503 508 563 530 554 541 562 525 568 519 544 530 501}
+
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+
+ if {$step == 0} {
+ $w.c delete I18
+ $w.c itemconfig I18b -smooth 1
+ }
+ if {[info exists b($step)]} {
+ $w.c coords I18b $b($step)
+ }
+
+ set where [lindex $pos $step]
+ MoveAbs $w I18a $where
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# Water pipe
+proc Draw19 {w} {
+ set color $::C(19)
+ set xx {249 181 155 118 86 55 22 0}
+ foreach {x1 x2} $xx {
+ $w.c create rect $x1 453 $x2 467 -fill $color -outline {} -tag I19
+ $w.c create line $x1 453 $x2 453 -fill $::C(fg) -width 1;# Pipe top
+ $w.c create line $x1 467 $x2 467 -fill $::C(fg) -width 1;# Pipe bottom
+ }
+ $w.c raise I11i
+
+ set xy [box 168 460 16] ;# Bulge by the joint
+ $w.c create oval $xy -fill $color -outline {}
+ $w.c create arc $xy -outline $::C(fg) -width 1 -style arc \
+ -start 21 -extent 136
+ $w.c create arc $xy -outline $::C(fg) -width 1 -style arc \
+ -start -21 -extent -130
+
+ set xy {249 447 255 473} ;# First joint 26x6
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+
+ set xy [box 257 433 34] ;# Bend up
+ $w.c create arc $xy -outline {} -fill $color -width 1 \
+ -style pie -start 0 -extent -91
+ $w.c create arc $xy -outline $::C(fg) -width 1 \
+ -style arc -start 0 -extent -90
+ set xy [box 257 433 20]
+ $w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
+ -style pie -start 0 -extent -92
+ $w.c create arc $xy -outline $::C(fg) -width 1 \
+ -style arc -start 0 -extent -90
+ set xy [box 257 421 34] ;# Bend left
+ $w.c create arc $xy -outline {} -fill $color -width 1 \
+ -style pie -start 1 -extent 91
+ $w.c create arc $xy -outline $::C(fg) -width 1 \
+ -style arc -start 0 -extent 90
+ set xy [box 257 421 20]
+ $w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
+ -style pie -start 0 -extent 90
+ $w.c create arc $xy -outline $::C(fg) -width 1 \
+ -style arc -start 0 -extent 90
+ set xy [box 243 421 34] ;# Bend down
+ $w.c create arc $xy -outline {} -fill $color -width 1 \
+ -style pie -start 90 -extent 90
+ $w.c create arc $xy -outline $::C(fg) -width 1 \
+ -style arc -start 90 -extent 90
+ set xy [box 243 421 20]
+ $w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
+ -style pie -start 90 -extent 90
+ $w.c create arc $xy -outline $::C(fg) -width 1 \
+ -style arc -start 90 -extent 90
+
+ set xy {270 427 296 433} ;# 2nd joint bottom
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ set xy {270 421 296 427} ;# 2nd joint top
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ set xy {249 382 255 408} ;# Third joint right
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ set xy {243 382 249 408} ;# Third joint left
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ set xy {203 420 229 426} ;# Last joint
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+
+ set xy [box 168 460 6] ;# Handle joint
+ $w.c create oval $xy -fill $::C(fg) -outline {} -tag I19a
+ set xy {168 460 168 512} ;# Handle bar
+ $w.c create line $xy -fill $::C(fg) -width 5 -tag I19b
+}
+proc Move19 {w {step {}}} {
+ set step [GetStep 19 $step]
+
+ set angles {30 30 30}
+ if {$step == [llength $angles]} {
+ return 2
+ }
+
+ RotateItem $w I19b {*}[Centroid $w I19a] [lindex $angles $step]
+ return 1
+}
+
+# Water pouring
+proc Draw20 {w} {
+}
+proc Move20 {w {step {}}} {
+ set step [GetStep 20 $step]
+
+ set pos {451 462 473 484 496 504 513 523 532}
+ set freq {20 40 40 40 40 40 40 40 40}
+ set pos {
+ {451 20} {462 40} {473 40} {484 40} {496 40} {504 40} {513 40}
+ {523 40} {532 40 x}
+ }
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+
+ $w.c delete I20
+ set where [lindex $pos $step]
+ lassign $where y f
+ H2O $w $y $f
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+proc H2O {w y f} {
+ set color $::C(20)
+ $w.c delete I20
+
+ Sine $w 208 428 208 $y 4 $f -tag {I20 I20s} -width 3 -fill $color \
+ -smooth 1
+ $w.c create line [$w.c coords I20s] -width 3 -fill $color -smooth 1 \
+ -tag {I20 I20a}
+ $w.c create line [$w.c coords I20s] -width 3 -fill $color -smooth 1 \
+ -tag {I20 I20b}
+ $w.c move I20a 8 0
+ $w.c move I20b 16 0
+}
+
+# Bucket
+proc Draw21 {w} {
+ set color $::C(21)
+ set xy {217 451 244 490} ;# Right handle
+ $w.c create line $xy -fill $::C(fg) -width 2 -tag I21_a
+ set xy {201 467 182 490} ;# Left handle
+ $w.c create line $xy -fill $::C(fg) -width 2 -tag I21_a
+
+ set xy {245 490 237 535} ;# Right side
+ set xy2 {189 535 181 490} ;# Left side
+ $w.c create poly [concat $xy $xy2] -fill $color -outline {} \
+ -tag {I21 I21f}
+ $w.c create line $xy -fill $::C(fg) -width 2 -tag I21
+ $w.c create line $xy2 -fill $::C(fg) -width 2 -tag I21
+
+ set xy {182 486 244 498} ;# Top
+ $w.c create oval $xy -fill $color -outline {} -width 2 -tag {I21 I21f}
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 2 -tag {I21 I21t}
+ set xy {189 532 237 540} ;# Bottom
+ $w.c create oval $xy -fill $color -outline $::C(fg) -width 2 \
+ -tag {I21 I21b}
+}
+proc Move21 {w {step {}}} {
+ set step [GetStep 21 $step]
+
+ set numsteps 30
+ if {$step >= $numsteps} {
+ return 0
+ }
+
+ lassign [$w.c coords I21b] x1 y1 x2 y2
+ #lassign [$w.c coords I21t] X1 Y1 X2 Y2
+ lassign {183 492 243 504} X1 Y1 X2 Y2
+
+ set f [expr {$step / double($numsteps)}]
+ set y2 [expr {$y2 - 3}]
+ set xx1 [expr {$x1 + ($X1 - $x1) * $f}]
+ set yy1 [expr {$y1 + ($Y1 - $y1) * $f}]
+ set xx2 [expr {$x2 + ($X2 - $x2) * $f}]
+ set yy2 [expr {$y2 + ($Y2 - $y2) * $f}]
+ #H2O $w $yy1 40
+
+ $w.c itemconfig I21b -fill $::C(20)
+ $w.c delete I21w
+ $w.c create poly $x2 $y2 $x1 $y1 $xx1 $yy1 $xx2 $yy1 -tag {I21 I21w} \
+ -outline {} -fill $::C(20)
+ $w.c lower I21w I21
+ $w.c raise I21b
+ $w.c lower I21f
+
+ return [expr {$step == $numsteps-1 ? 3 : 1}]
+}
+
+# Bucket drop
+proc Draw22 {w} {
+}
+proc Move22 {w {step {}}} {
+ set step [GetStep 22 $step]
+ set pos {{213 513} {213 523} {213 543 x} {213 583} {213 593}}
+
+ if {$step == 0} {$w.c itemconfig I21f -fill $::C(22)}
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+ set where [lindex $pos $step]
+ MoveAbs $w I21 $where
+ H2O $w [lindex $where 1] 40
+ $w.c delete I21_a ;# Delete handles
+
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# Blow dart
+proc Draw23 {w} {
+ set color $::C(23a)
+ set color2 $::C(23b)
+ set color3 $::C(23c)
+
+ set xy {185 623 253 650} ;# Block
+ $w.c create rect $xy -fill black -outline $::C(fg) -width 2 -tag I23a
+ set xy {187 592 241 623} ;# Balloon
+ $w.c create oval $xy -outline {} -fill $color -tag I23b
+ $w.c create arc $xy -outline $::C(fg) -width 3 -tag I23b \
+ -style arc -start 12 -extent 336
+ set xy {239 604 258 589 258 625 239 610} ;# Balloon nozzle
+ $w.c create poly $xy -outline {} -fill $color -tag I23b
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I23b
+
+ set xy {285 611 250 603} ;# Dart body
+ $w.c create oval $xy -fill $color2 -outline $::C(fg) -width 3 -tag I23d
+ set xy {249 596 249 618 264 607 249 596} ;# Dart tail
+ $w.c create poly $xy -fill $color3 -outline $::C(fg) -width 3 -tag I23d
+ set xy {249 607 268 607} ;# Dart detail
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I23d
+ set xy {285 607 305 607} ;# Dart needle
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I23d
+}
+proc Move23 {w {step {}}} {
+ set step [GetStep 23 $step]
+
+ set pos {
+ {277 607} {287 607} {307 607 x} {347 607} {407 607} {487 607}
+ {587 607} {687 607} {787 607} {-100 -100}
+ }
+
+ if {$step >= [llength $pos]} {
+ return 0
+ }
+ if {$step <= 1} {
+ $w.c scale I23b {*}[Anchor $w I23a n] .9 .5
+ }
+ set where [lindex $pos $step]
+ MoveAbs $w I23d $where
+
+ if {[lindex $where 2] eq "x"} {
+ return 3
+ }
+ return 1
+}
+
+# Balloon
+proc Draw24 {w} {
+ set color $::C(24a)
+ set xy {366 518 462 665} ;# Balloon
+ $w.c create oval $xy -fill $color -outline $::C(fg) -width 3 -tag I24
+ set xy {414 666 414 729} ;# String
+ $w.c create line $xy -fill $::C(fg) -width 3 -tag I24
+ set xy {410 666 404 673 422 673 418 666} ;# Nozzle
+ $w.c create poly $xy -fill $color -outline $::C(fg) -width 3 -tag I24
+
+ set xy {387 567 390 549 404 542} ;# Reflections
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+ set xy {395 568 399 554 413 547}
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+ set xy {403 570 396 555 381 553}
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+ set xy {408 564 402 547 386 545}
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+}
+proc Move24 {w {step {}}} {
+ global S
+ set step [GetStep 24 $step]
+
+ if {$step > 4} {
+ return 0
+ } elseif {$step == 4} {
+ return 2
+ }
+
+ if {$step == 0} {
+ $w.c delete I24 ;# Exploding balloon
+ set xy {
+ 347 465 361 557 271 503 272 503 342 574 259 594 259 593 362 626
+ 320 737 320 740 398 691 436 738 436 739 476 679 528 701 527 702
+ 494 627 548 613 548 613 480 574 577 473 577 473 474 538 445 508
+ 431 441 431 440 400 502 347 465 347 465
+ }
+ $w.c create poly $xy -tag I24 -fill $::C(24b) -outline $::C(24a) \
+ -width 10 -smooth 1
+ set msg [subst $S(message)]
+ $w.c create text [Centroid $w I24] -text $msg -tag {I24 I24t} \
+ -justify center -font {{Times Roman} 18 bold}
+ return 1
+ }
+
+ $w.c itemconfig I24t -font [list {Times Roman} [expr {18 + 6*$step}] bold]
+ $w.c move I24 0 -60
+ $w.c scale I24 {*}[Centroid $w I24] 1.25 1.25
+ return 1
+}
+
+# Displaying the message
+proc Move25 {w {step {}}} {
+ global S
+ set step [GetStep 25 $step]
+ if {$step == 0} {
+ set ::XY(25) [clock clicks -milliseconds]
+ return 1
+ }
+ set elapsed [expr {[clock clicks -milliseconds] - $::XY(25)}]
+ if {$elapsed < 5000} {
+ return 1
+ }
+ return 2
+}
+
+# Collapsing balloon
+proc Move26 {w {step {}}} {
+ global S
+ set step [GetStep 26 $step]
+
+ if {$step >= 3} {
+ $w.c delete I24 I26
+ $w.c create text 430 755 -anchor s -tag I26 \
+ -text "click to continue" -font {{Times Roman} 24 bold}
+ bind $w.c <1> [list Reset $w]
+ return 4
+ }
+
+ $w.c scale I24 {*}[Centroid $w I24] .8 .8
+ $w.c move I24 0 60
+ $w.c itemconfig I24t -font [list {Times Roman} [expr {30 - 6*$step}] bold]
+ return 1
+}
+
+################################################################
+#
+# Helper functions
+#
+
+proc box {x y r} {
+ return [list [expr {$x-$r}] [expr {$y-$r}] [expr {$x+$r}] [expr {$y+$r}]]
+}
+
+proc MoveAbs {w item xy} {
+ lassign $xy x y
+ lassign [Centroid $w $item] Ox Oy
+ set dx [expr {$x - $Ox}]
+ set dy [expr {$y - $Oy}]
+ $w.c move $item $dx $dy
+}
+
+proc RotateItem {w item Ox Oy beta} {
+ set xy [$w.c coords $item]
+ set xy2 {}
+ foreach {x y} $xy {
+ lappend xy2 {*}[RotateC $x $y $Ox $Oy $beta]
+ }
+ $w.c coords $item $xy2
+}
+
+proc RotateC {x y Ox Oy beta} {
+ # rotates vector (Ox,Oy)->(x,y) by beta degrees clockwise
+
+ set x [expr {$x - $Ox}] ;# Shift to origin
+ set y [expr {$y - $Oy}]
+
+ set beta [expr {$beta * atan(1) * 4 / 180.0}] ;# Radians
+ set xx [expr {$x * cos($beta) - $y * sin($beta)}] ;# Rotate
+ set yy [expr {$x * sin($beta) + $y * cos($beta)}]
+
+ set xx [expr {$xx + $Ox}] ;# Shift back
+ set yy [expr {$yy + $Oy}]
+
+ return [list $xx $yy]
+}
+
+proc Reset {w} {
+ global S
+ DrawAll $w
+ bind $w.c <1> {}
+ set S(mode) $::MSTART
+ set S(active) 0
+}
+
+# Each Move## keeps its state info in STEP, this retrieves and increments it
+proc GetStep {who step} {
+ global STEP
+ if {$step ne ""} {
+ set STEP($who) $step
+ } elseif {![info exists STEP($who)] || $STEP($who) eq ""} {
+ set STEP($who) 0
+ } else {
+ incr STEP($who)
+ }
+ return $STEP($who)
+}
+
+proc ResetStep {} {
+ global STEP
+ set ::S(cnt) 0
+ foreach a [array names STEP] {
+ set STEP($a) ""
+ }
+}
+
+proc Sine {w x0 y0 x1 y1 amp freq args} {
+ set PI [expr {4 * atan(1)}]
+ set step 2
+ set xy {}
+ if {$y0 == $y1} { ;# Horizontal
+ for {set x $x0} {$x <= $x1} {incr x $step} {
+ set beta [expr {($x - $x0) * 2 * $PI / $freq}]
+ set y [expr {$y0 + $amp * sin($beta)}]
+ lappend xy $x $y
+ }
+ } else {
+ for {set y $y0} {$y <= $y1} {incr y $step} {
+ set beta [expr {($y - $y0) * 2 * $PI / $freq}]
+ set x [expr {$x0 + $amp * sin($beta)}]
+ lappend xy $x $y
+ }
+ }
+ return [$w.c create line $xy {*}$args]
+}
+
+proc RoundRect {w xy radius args} {
+ lassign $xy x0 y0 x3 y3
+ set r [winfo pixels $w.c $radius]
+ set d [expr {2 * $r}]
+
+ # Make sure that the radius of the curve is less than 3/8 size of the box!
+ set maxr 0.75
+ if {$d > $maxr * ($x3 - $x0)} {
+ set d [expr {$maxr * ($x3 - $x0)}]
+ }
+ if {$d > $maxr * ($y3 - $y0)} {
+ set d [expr {$maxr * ($y3 - $y0)}]
+ }
+
+ set x1 [expr { $x0 + $d }]
+ set x2 [expr { $x3 - $d }]
+ set y1 [expr { $y0 + $d }]
+ set y2 [expr { $y3 - $d }]
+
+ set xy [list $x0 $y0 $x1 $y0 $x2 $y0 $x3 $y0 $x3 $y1 $x3 $y2]
+ lappend xy $x3 $y3 $x2 $y3 $x1 $y3 $x0 $y3 $x0 $y2 $x0 $y1
+ return $xy
+}
+
+proc RoundPoly {canv xy radii args} {
+ set lenXY [llength $xy]
+ set lenR [llength $radii]
+ if {$lenXY != 2*$lenR} {
+ error "wrong number of vertices and radii"
+ }
+
+ set knots {}
+ lassign [lrange $xy end-1 end] x0 y0
+ lassign $xy x1 y1
+ lappend xy {*}[lrange $xy 0 1]
+
+ for {set i 0} {$i < $lenXY} {incr i 2} {
+ set radius [lindex $radii [expr {$i/2}]]
+ set r [winfo pixels $canv $radius]
+
+ lassign [lrange $xy [expr {$i + 2}] [expr {$i + 3}]] x2 y2
+ set z [_RoundPoly2 $x0 $y0 $x1 $y1 $x2 $y2 $r]
+ lappend knots {*}$z
+
+ lassign [list $x1 $y1] x0 y0
+ lassign [list $x2 $y2] x1 y1
+ }
+ set n [$canv create polygon $knots -smooth 1 {*}$args]
+ return $n
+}
+
+proc _RoundPoly2 {x0 y0 x1 y1 x2 y2 radius} {
+ set d [expr {2 * $radius}]
+ set maxr 0.75
+
+ set v1x [expr {$x0 - $x1}]
+ set v1y [expr {$y0 - $y1}]
+ set v2x [expr {$x2 - $x1}]
+ set v2y [expr {$y2 - $y1}]
+
+ set vlen1 [expr {sqrt($v1x*$v1x + $v1y*$v1y)}]
+ set vlen2 [expr {sqrt($v2x*$v2x + $v2y*$v2y)}]
+ if {$d > $maxr * $vlen1} {
+ set d [expr {$maxr * $vlen1}]
+ }
+ if {$d > $maxr * $vlen2} {
+ set d [expr {$maxr * $vlen2}]
+ }
+
+ lappend xy [expr {$x1 + $d * $v1x/$vlen1}] [expr {$y1 + $d * $v1y/$vlen1}]
+ lappend xy $x1 $y1
+ lappend xy [expr {$x1 + $d * $v2x/$vlen2}] [expr {$y1 + $d * $v2y/$vlen2}]
+
+ return $xy
+}
+
+proc Sparkle {w Oxy tag} {
+ set xy {299 283 298 302 295 314 271 331 239 310 242 292 256 274 281 273}
+ foreach {x y} $xy {
+ $w.c create line 271 304 $x $y -fill white -width 3 -tag $tag
+ }
+ MoveAbs $w $tag $Oxy
+}
+
+proc Centroid {w item} {
+ return [Anchor $w $item c]
+}
+
+proc Anchor {w item where} {
+ lassign [$w.c bbox $item] x1 y1 x2 y2
+ if {[string match *n* $where]} {
+ set y $y1
+ } elseif {[string match *s* $where]} {
+ set y $y2
+ } else {
+ set y [expr {($y1 + $y2) / 2.0}]
+ }
+ if {[string match *w* $where]} {
+ set x $x1
+ } elseif {[string match *e* $where]} {
+ set x $x2
+ } else {
+ set x [expr {($x1 + $x2) / 2.0}]
+ }
+ return [list $x $y]
+}
+
+DoDisplay $w
+Reset $w
+Go $w ;# Start everything going
diff --git a/library/demos/hello b/library/demos/hello
index b9823f6..d10b8d5 100644
--- a/library/demos/hello
+++ b/library/demos/hello
@@ -5,7 +5,9 @@ exec wish "$0" ${1+"$@"}
# hello --
# Simple Tk script to create a button that prints "Hello, world".
# Click on the button to terminate the program.
-#
+
+package require Tk
+
# The first line below creates the button, and the second line
# asks the packer to shrink-wrap the application's main window
# around the button.
diff --git a/library/demos/hscale.tcl b/library/demos/hscale.tcl
index 4902d8e..1df144d 100644
--- a/library/demos/hscale.tcl
+++ b/library/demos/hscale.tcl
@@ -6,6 +6,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .hscale
catch {destroy $w}
toplevel $w
@@ -16,11 +18,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a horizontal scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the length of the arrow."
pack $w.msg -side top -padx .5c
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame -borderwidth 10
pack $w.frame -side top -fill x
diff --git a/library/demos/icon.tcl b/library/demos/icon.tcl
index 4452b91..224d8f9 100644
--- a/library/demos/icon.tcl
+++ b/library/demos/icon.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .icon
catch {destroy $w}
toplevel $w
@@ -17,18 +19,17 @@ positionWindow $w
label $w.msg -font $font -wraplength 5i -justify left -text "This window shows three ways of using bitmaps or images in radiobuttons and checkbuttons. On the left are two radiobuttons, each of which displays a bitmap and an indicator. In the middle is a checkbutton that displays a different image depending on whether it is selected or not. On the right is a checkbutton that displays a single bitmap but changes its background color to indicate whether or not it is selected."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
+# Main widget program sets variable tk_demoDirectory
image create bitmap flagup \
- -file [file join $tk_library demos images flagup.bmp] \
- -maskfile [file join $tk_library demos images flagup.bmp]
+ -file [file join $tk_demoDirectory images flagup.xbm] \
+ -maskfile [file join $tk_demoDirectory images flagup.xbm]
image create bitmap flagdown \
- -file [file join $tk_library demos images flagdown.bmp] \
- -maskfile [file join $tk_library demos images flagdown.bmp]
+ -file [file join $tk_demoDirectory images flagdown.xbm] \
+ -maskfile [file join $tk_demoDirectory images flagdown.xbm]
frame $w.frame -borderwidth 10
pack $w.frame -side top
@@ -36,15 +37,15 @@ checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
-indicatoron 0
$w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
checkbutton $w.frame.b2 \
- -bitmap @[file join $tk_library demos images letters.bmp] \
+ -bitmap @[file join $tk_demoDirectory images letters.xbm] \
-indicatoron 0 -selectcolor SeaGreen1
frame $w.frame.left
pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
radiobutton $w.frame.left.b3 \
- -bitmap @[file join $tk_library demos images letters.bmp] \
+ -bitmap @[file join $tk_demoDirectory images letters.xbm] \
-variable letters -value full
radiobutton $w.frame.left.b4 \
- -bitmap @[file join $tk_library demos images noletter.bmp] \
+ -bitmap @[file join $tk_demoDirectory images noletter.xbm] \
-variable letters -value empty
pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes
diff --git a/library/demos/image1.tcl b/library/demos/image1.tcl
index a4226ac..0bd2f49 100644
--- a/library/demos/image1.tcl
+++ b/library/demos/image1.tcl
@@ -6,6 +6,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .image1
catch {destroy $w}
toplevel $w
@@ -16,19 +18,18 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration displays two images, each in a separate label widget."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
+# Main widget program sets variable tk_demoDirectory
catch {image delete image1a}
-image create photo image1a -file [file join $tk_library demos images earth.gif]
+image create photo image1a -file [file join $tk_demoDirectory images earth.gif]
label $w.l1 -image image1a -bd 1 -relief sunken
catch {image delete image1b}
image create photo image1b \
- -file [file join $tk_library demos images earthris.gif]
+ -file [file join $tk_demoDirectory images earthris.gif]
label $w.l2 -image image1b -bd 1 -relief sunken
pack $w.l1 $w.l2 -side top -padx .5m -pady .5m
diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl
index 67560b3..7b3d748 100644
--- a/library/demos/image2.tcl
+++ b/library/demos/image2.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# loadDir --
# This procedure reloads the directory listbox from the directory
# named in the demo's entry.
@@ -18,7 +20,7 @@ proc loadDir w {
global dirName
$w.f.list delete 0 end
- foreach i [lsort [glob -directory $dirName *]] {
+ foreach i [lsort [glob -type f -directory $dirName *]] {
$w.f.list insert end [file tail $i]
}
}
@@ -53,7 +55,12 @@ proc loadImage {w x y} {
global dirName
set file [file join $dirName [$w.f.list get @$x,$y]]
- image2a configure -file $file
+ if {[catch {
+ image2a configure -file $file
+ }]} then {
+ # Mark the file as not loadable
+ $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000
+ }
}
set w .image2
@@ -66,17 +73,16 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration allows you to view images using a Tk \"photo\" image. First type a directory name in the listbox, then type Return to load the directory into the listbox. Then double-click on a file name in the listbox to see that image."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.mid
pack $w.mid -fill both -expand 1
labelframe $w.dir -text "Directory:"
-set dirName [file join $tk_library demos images]
+# Main widget program sets variable tk_demoDirectory
+set dirName [file join $tk_demoDirectory images]
entry $w.dir.e -width 30 -textvariable dirName
button $w.dir.b -pady 0 -padx 2m -text "Select Dir." \
-command "selectAndLoadDir $w"
diff --git a/library/demos/images/face.bmp b/library/demos/images/face.xbm
index 03d829f..03d829f 100644
--- a/library/demos/images/face.bmp
+++ b/library/demos/images/face.xbm
diff --git a/library/demos/images/flagdown.bmp b/library/demos/images/flagdown.xbm
index 55abc51..55abc51 100644
--- a/library/demos/images/flagdown.bmp
+++ b/library/demos/images/flagdown.xbm
diff --git a/library/demos/images/flagup.bmp b/library/demos/images/flagup.xbm
index 6eb0d84..6eb0d84 100644
--- a/library/demos/images/flagup.bmp
+++ b/library/demos/images/flagup.xbm
diff --git a/library/demos/images/gray25.bmp b/library/demos/images/gray25.xbm
index b234b3c..b234b3c 100644
--- a/library/demos/images/gray25.bmp
+++ b/library/demos/images/gray25.xbm
diff --git a/library/demos/images/letters.bmp b/library/demos/images/letters.xbm
index 0f12568..0f12568 100644
--- a/library/demos/images/letters.bmp
+++ b/library/demos/images/letters.xbm
diff --git a/library/demos/images/noletter.bmp b/library/demos/images/noletter.xbm
index 5774124..5774124 100644
--- a/library/demos/images/noletter.bmp
+++ b/library/demos/images/noletter.xbm
diff --git a/library/demos/images/pattern.bmp b/library/demos/images/pattern.xbm
index df31baf..df31baf 100644
--- a/library/demos/images/pattern.bmp
+++ b/library/demos/images/pattern.xbm
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index b4d91f8..85bf5f3 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .items
catch {destroy $w}
toplevel $w
@@ -18,11 +20,9 @@ set c $w.frame.c
label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame
pack $w.frame -side top -fill both -expand yes
@@ -75,8 +75,9 @@ $c create line 6.33c 1c 6.33c 4c -arrow both -tags item
$c create line 5c 6c 9c 6c 9c 1c 8c 1c 8c 4.8c 8.8c 4.8c 8.8c 1.2c \
8.2c 1.2c 8.2c 4.6c 8.6c 4.6c 8.6c 1.4c 8.4c 1.4c 8.4c 4.4c \
-width 3 -fill $red -tags item
+# Main widget program sets variable tk_demoDirectory
$c create line 1c 5c 7c 5c 7c 7c 9c 7c -width .5c \
- -stipple @[file join $tk_library demos images gray25.bmp] \
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
-arrow both -arrowshape {15 15 7} -tags item
$c create line 1c 7c 1.75c 5.8c 2.5c 7c 3.25c 5.8c 4c 7c -width .5c \
-cap round -join round -tags item
@@ -88,7 +89,7 @@ $c create line 15.5c 1c 19.5c 1.5c 15.5c 4.5c 19.5c 4c -smooth on \
-arrow both -width 3 -tags item
$c create line 12c 6c 13.5c 4.5c 16.5c 7.5c 18c 6c \
16.5c 4.5c 13.5c 7.5c 12c 6c -smooth on -width 3m -cap round \
- -stipple @[file join $tk_library demos images gray25.bmp] \
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
-fill $red -tags item
$c create text 25c .2c -text Polygons -anchor n
@@ -99,21 +100,21 @@ $c create polygon 25c 4c 25c 4c 25c 1c 26c 1c 27c 4c 28c 1c \
29c 1c 29c 4c 29c 4c -fill $red -smooth on -tags item
$c create polygon 22c 4.5c 25c 4.5c 25c 6.75c 28c 6.75c \
28c 5.25c 24c 5.25c 24c 6.0c 26c 6c 26c 7.5c 22c 7.5c \
- -stipple @[file join $tk_library demos images gray25.bmp] \
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
-outline black -tags item
$c create text 5c 8.2c -text Rectangles -anchor n
$c create rectangle 1c 9.5c 4c 12.5c -outline $red -width 3m -tags item
$c create rectangle 0.5c 13.5c 4.5c 15.5c -fill $green -tags item
$c create rectangle 6c 10c 9c 15c -outline {} \
- -stipple @[file join $tk_library demos images gray25.bmp] \
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
-fill $blue -tags item
$c create text 15c 8.2c -text Ovals -anchor n
$c create oval 11c 9.5c 14c 12.5c -outline $red -width 3m -tags item
$c create oval 10.5c 13.5c 14.5c 15.5c -fill $green -tags item
$c create oval 16c 10c 19c 15c -outline {} \
- -stipple @[file join $tk_library demos images gray25.bmp] \
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
-fill $blue -tags item
$c create text 25c 8.2c -text Text -anchor n
@@ -133,7 +134,7 @@ $c create arc 0.5c 17c 7c 20c -fill $green -outline black \
-start 45 -extent 270 -style pieslice -tags item
$c create arc 6.5c 17c 9.5c 20c -width 4m -style arc \
-outline $blue -start -135 -extent 270 -tags item \
- -outlinestipple @[file join $tk_library demos images gray25.bmp]
+ -outlinestipple @[file join $tk_demoDirectory images gray25.xbm]
$c create arc 0.5c 20c 9.5c 24c -width 4m -style pieslice \
-fill {} -outline $red -start 225 -extent -90 -tags item
$c create arc 5.5c 20.5c 9.5c 23.5c -width 4m -style chord \
@@ -141,11 +142,11 @@ $c create arc 5.5c 20.5c 9.5c 23.5c -width 4m -style chord \
$c create text 15c 16.2c -text Bitmaps -anchor n
$c create bitmap 13c 20c -tags item \
- -bitmap @[file join $tk_library demos images face.bmp]
+ -bitmap @[file join $tk_demoDirectory images face.xbm]
$c create bitmap 17c 18.5c -tags item \
- -bitmap @[file join $tk_library demos images noletter.bmp]
+ -bitmap @[file join $tk_demoDirectory images noletter.xbm]
$c create bitmap 17c 21.5c -tags item \
- -bitmap @[file join $tk_library demos images letters.bmp]
+ -bitmap @[file join $tk_demoDirectory images letters.xbm]
$c create text 25c 16.2c -text Windows -anchor n
button $c.button -text "Press Me" -command "butPress $c $red"
diff --git a/library/demos/ixset b/library/demos/ixset
index 1677542..06b644d 100644
--- a/library/demos/ixset
+++ b/library/demos/ixset
@@ -9,6 +9,9 @@ exec wish "$0" ${1+"$@"}
# 91/11/23 : pda@masi.ibp.fr, jt@ratp.fr : design
# 92/08/01 : pda@masi.ibp.fr : cleaning
+package require Tcl 8.4
+package require Tk
+
#
# Button actions
#
@@ -53,38 +56,31 @@ proc readsettings {} {
set xfd [open "|xset q" r]
while {[gets $xfd line] > -1} {
- set kw [lindex $line 0]
-
- case $kw in {
- {auto}
- {
- set rpt [lindex $line 1]
- if {[expr "{$rpt} == {repeat:}"]} then {
- set kbdrep [lindex $line 2]
- set kbdcli [lindex $line 6]
- }
- }
- {bell}
- {
- set bellvol [lindex $line 2]
- set bellpit [lindex $line 5]
- set belldur [lindex $line 8]
- }
- {acceleration:}
- {
- set mouseacc [lindex $line 1]
- set mousethr [lindex $line 3]
- }
- {prefer}
- {
- set bla [lindex $line 2]
- set screenbla [expr "{$bla} == {yes} ? {blank} : {noblank}"]
- }
- {timeout:}
- {
- set screentim [lindex $line 1]
- set screencyc [lindex $line 3]
+ switch -- [lindex $line 0] {
+ auto {
+ set rpt [lindex $line 1]
+ if {$rpt eq "repeat:"} {
+ set kbdrep [lindex $line 2]
+ set kbdcli [lindex $line 6]
}
+ }
+ bell {
+ set bellvol [lindex $line 2]
+ set bellpit [lindex $line 5]
+ set belldur [lindex $line 8]
+ }
+ acceleration: {
+ set mouseacc [lindex $line 1]
+ set mousethr [lindex $line 3]
+ }
+ prefer {
+ set bla [lindex $line 2]
+ set screenbla [expr {$bla eq "yes" ? "blank" : "noblank"}]
+ }
+ timeout: {
+ set screentim [lindex $line 1]
+ set screencyc [lindex $line 3]
+ }
}
}
close $xfd
@@ -114,7 +110,7 @@ proc writesettings {} {
set bellpit [.bell.val.pit.entry get]
set belldur [.bell.val.dur.entry get]
- if {[expr "{$kbdrep} == {on}"]} then {
+ if {$kbdrep eq "on"} {
set kbdcli [.kbd.val.cli get]
} else {
set kbdcli "off"
@@ -150,7 +146,7 @@ proc dispsettings {} {
.bell.val.dur.entry delete 0 end
.bell.val.dur.entry insert 0 $belldur
- .kbd.val.onoff [expr "{$kbdrep} == {on} ? {select} : {deselect}"]
+ .kbd.val.onoff [expr {$kbdrep eq "on" ? "select" : "deselect"}]
.kbd.val.cli set $kbdcli
.mouse.hor.acc.entry delete 0 end
@@ -158,8 +154,8 @@ proc dispsettings {} {
.mouse.hor.thr.entry delete 0 end
.mouse.hor.thr.entry insert 0 $mousethr
- .screen.blank [expr "{$screenbla}=={blank} ? {select} : {deselect}"]
- .screen.pat [expr "{$screenbla}!={blank} ? {select} : {deselect}"]
+ .screen.blank [expr {$screenbla eq "blank" ? "select" : "deselect"}]
+ .screen.pat [expr {$screenbla ne "blank" ? "select" : "deselect"}]
.screen.tim.entry delete 0 end
.screen.tim.entry insert 0 $screentim
.screen.cyc.entry delete 0 end
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
new file mode 100644
index 0000000..b52e38f
--- /dev/null
+++ b/library/demos/knightstour.tcl
@@ -0,0 +1,255 @@
+# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+#
+# Calculate a Knight's tour of a chessboard.
+#
+# This uses Warnsdorff's rule to calculate the next square each
+# time. This specifies that the next square should be the one that
+# has the least number of available moves.
+#
+# Using this rule it is possible to get to a position where
+# there are no squares available to move into. In this implementation
+# this occurs when the starting square is d6.
+#
+# To solve this fault an enhancement to the rule is that if we
+# have a choice of squares with an equal score, we should choose
+# the one nearest the edge of the board.
+#
+# If the call to the Edgemost function is commented out you can see
+# this occur.
+#
+# You can drag the knight to a specific square to start if you wish.
+# If you let it repeat then it will choose random start positions
+# for each new tour.
+
+package require Tk 8.5
+
+# Return a list of accessible squares from a given square
+proc ValidMoves {square} {
+ set moves {}
+ foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} {
+ set col [expr {($square % 8) + [lindex $pair 0]}]
+ set row [expr {($square / 8) + [lindex $pair 1]}]
+ if {$row > -1 && $row < 8 && $col > -1 && $col < 8} {
+ lappend moves [expr {$row * 8 + $col}]
+ }
+ }
+ return $moves
+}
+
+# Return the number of available moves for this square
+proc CheckSquare {square} {
+ variable visited
+ set moves 0
+ foreach test [ValidMoves $square] {
+ if {[lsearch -exact -integer $visited $test] == -1} {
+ incr moves
+ }
+ }
+ return $moves
+}
+
+# Select the next square to move to. Returns -1 if there are no available
+# squares remaining that we can move to.
+proc Next {square} {
+ variable visited
+ set minimum 9
+ set nextSquare -1
+ foreach testSquare [ValidMoves $square] {
+ if {[lsearch -exact -integer $visited $testSquare] == -1} {
+ set count [CheckSquare $testSquare]
+ if {$count < $minimum} {
+ set minimum $count
+ set nextSquare $testSquare
+ } elseif {$count == $minimum} {
+ set nextSquare [Edgemost $nextSquare $testSquare]
+ }
+ }
+ }
+ return $nextSquare
+}
+
+# Select the square nearest the edge of the board
+proc Edgemost {a b} {
+ set colA [expr {3-int(abs(3.5-($a%8)))}]
+ set colB [expr {3-int(abs(3.5-($b%8)))}]
+ set rowA [expr {3-int(abs(3.5-($a/8)))}]
+ set rowB [expr {3-int(abs(3.5-($b/8)))}]
+ return [expr {($colA * $rowA) < ($colB * $rowB) ? $a : $b}]
+}
+
+# Display a square number as a standard chess square notation.
+proc N {square} {
+ return [format %c%d [expr {97 + $square % 8}] \
+ [expr {$square / 8 + 1}]]
+}
+
+# Perform a Knight's move and schedule the next move.
+proc MovePiece {dlg last square} {
+ variable visited
+ variable delay
+ variable continuous
+ $dlg.f.txt insert end "[llength $visited]. [N $last] .. [N $square]\n" {}
+ $dlg.f.txt see end
+ $dlg.f.c itemconfigure [expr {1+$last}] -state normal -outline black
+ $dlg.f.c itemconfigure [expr {1+$square}] -state normal -outline red
+ $dlg.f.c coords knight [lrange [$dlg.f.c coords [expr {1+$square}]] 0 1]
+ lappend visited $square
+ set next [Next $square]
+ if {$next ne -1} {
+ variable aid [after $delay [list MovePiece $dlg $square $next]]
+ } else {
+ $dlg.tf.b1 configure -state normal
+ if {[llength $visited] == 64} {
+ variable initial
+ if {$initial == $square} {
+ $dlg.f.txt insert end "Closed tour!"
+ } else {
+ $dlg.f.txt insert end "Success\n" {}
+ if {$continuous} {
+ after [expr {$delay * 2}] [namespace code \
+ [list Tour $dlg [expr {int(rand() * 64)}]]]
+ }
+ }
+ } else {
+ $dlg.f.txt insert end "FAILED!\n" {}
+ }
+ }
+}
+
+# Begin a new tour of the board given a random start position
+proc Tour {dlg {square {}}} {
+ variable visited {}
+ $dlg.f.txt delete 1.0 end
+ $dlg.tf.b1 configure -state disabled
+ for {set n 0} {$n < 64} {incr n} {
+ $dlg.f.c itemconfigure $n -state disabled -outline black
+ }
+ if {$square eq {}} {
+ set square [expr {[$dlg.f.c find closest \
+ {*}[$dlg.f.c coords knight] 0 65]-1}]
+ }
+ variable initial $square
+ after idle [list MovePiece $dlg $initial $initial]
+}
+
+proc Stop {} {
+ variable aid
+ catch {after cancel $aid}
+}
+
+proc Exit {dlg} {
+ Stop
+ destroy $dlg
+}
+
+proc SetDelay {new} {
+ variable delay [expr {int($new)}]
+}
+
+proc DragStart {w x y} {
+ $w dtag selected
+ $w addtag selected withtag current
+ variable dragging [list $x $y]
+}
+proc DragMotion {w x y} {
+ variable dragging
+ if {[info exists dragging]} {
+ $w move selected [expr {$x - [lindex $dragging 0]}] \
+ [expr {$y - [lindex $dragging 1]}]
+ variable dragging [list $x $y]
+ }
+}
+proc DragEnd {w x y} {
+ set square [$w find closest $x $y 0 65]
+ $w coords selected [lrange [$w coords $square] 0 1]
+ $w dtag selected
+ variable dragging ; unset dragging
+}
+
+proc CreateGUI {} {
+ catch {destroy .knightstour}
+ set dlg [toplevel .knightstour]
+ wm title $dlg "Knights tour"
+ wm withdraw $dlg
+ set f [ttk::frame $dlg.f]
+ set c [canvas $f.c -width 240 -height 240]
+ text $f.txt -width 10 -height 1 -background white \
+ -yscrollcommand [list $f.vs set] -font {Arial 8}
+ ttk::scrollbar $f.vs -command [list $f.txt yview]
+
+ variable delay 600
+ variable continuous 0
+ ttk::frame $dlg.tf
+ ttk::label $dlg.tf.ls -text Speed
+ ttk::scale $dlg.tf.sc -from 8 -to 2000 -command [list SetDelay] \
+ -variable [namespace which -variable delay]
+ ttk::checkbutton $dlg.tf.cc -text Repeat \
+ -variable [namespace which -variable continuous]
+ ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
+ ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
+ set square 0
+ for {set row 7} {$row != -1} {incr row -1} {
+ for {set col 0} {$col < 8} {incr col} {
+ if {(($col & 1) ^ ($row & 1))} {
+ set fill tan3 ; set dfill tan4
+ } else {
+ set fill bisque ; set dfill bisque3
+ }
+ set coords [list [expr {$col * 30 + 4}] [expr {$row * 30 + 4}] \
+ [expr {$col * 30 + 30}] [expr {$row * 30 + 30}]]
+ $c create rectangle $coords -fill $fill -disabledfill $dfill \
+ -width 2 -state disabled
+ }
+ }
+ catch {eval font create KnightFont -size -24}
+ $c create text 0 0 -font KnightFont -text "\u265e" \
+ -anchor nw -tags knight -fill black -activefill "#600000"
+ $c coords knight [lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1]
+ $c bind knight <ButtonPress-1> [namespace code [list DragStart %W %x %y]]
+ $c bind knight <Motion> [namespace code [list DragMotion %W %x %y]]
+ $c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]]
+
+ grid $c $f.txt $f.vs -sticky news
+ grid rowconfigure $f 0 -weight 1
+ grid columnconfigure $f 1 -weight 1
+
+ grid $f - - - - - -sticky news
+ set things [list $dlg.tf.ls $dlg.tf.sc $dlg.tf.cc $dlg.tf.b1]
+ if {![info exists ::widgetDemo]} {
+ lappend things $dlg.tf.b2
+ if {[tk windowingsystem] ne "aqua"} {
+ set things [linsert $things 0 [ttk::sizegrip $dlg.tf.sg]]
+ }
+ }
+ pack {*}$things -side right
+ if {[tk windowingsystem] eq "aqua"} {
+ pack configure {*}$things -padx {4 4} -pady {12 12}
+ pack configure [lindex $things 0] -padx {4 24}
+ pack configure [lindex $things end] -padx {16 4}
+ }
+ grid $dlg.tf - - - - - -sticky ew
+ if {[info exists ::widgetDemo]} {
+ grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew
+ }
+
+ grid rowconfigure $dlg 0 -weight 1
+ grid columnconfigure $dlg 0 -weight 1
+
+ bind $dlg <Control-F2> {console show}
+ bind $dlg <Return> [list $dlg.tf.b1 invoke]
+ bind $dlg <Escape> [list $dlg.tf.b2 invoke]
+ bind $dlg <Destroy> [namespace code [list Stop]]
+ wm protocol $dlg WM_DELETE_WINDOW [namespace code [list Exit $dlg]]
+
+ wm deiconify $dlg
+ tkwait window $dlg
+}
+
+if {![winfo exists .knightstour]} {
+ if {![info exists widgetDemo]} { wm withdraw . }
+ set r [catch [linsert $argv 0 CreateGUI] err]
+ if {$r} {
+ tk_messageBox -icon error -title "Error" -message $err
+ }
+ if {![info exists widgetDemo]} { exit $r }
+}
diff --git a/library/demos/label.tcl b/library/demos/label.tcl
index c572c2d..a5cab10 100644
--- a/library/demos/label.tcl
+++ b/library/demos/label.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .label
catch {destroy $w}
toplevel $w
@@ -17,11 +19,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "Five labels are displayed below: three textual ones on the left, and a bitmap label and a text label on the right. Labels are pretty boring because you can't do anything with them."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.left
frame $w.right
@@ -32,7 +32,8 @@ label $w.left.l2 -text "Second label, raised" -relief raised
label $w.left.l3 -text "Third label, sunken" -relief sunken
pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -pady 2 -anchor w
+# Main widget program sets variable tk_demoDirectory
label $w.right.bitmap -borderwidth 2 -relief sunken \
- -bitmap @[file join $tk_library demos images face.bmp]
+ -bitmap @[file join $tk_demoDirectory images face.xbm]
label $w.right.caption -text "Tcl/Tk Proprietor"
pack $w.right.bitmap $w.right.caption -side top
diff --git a/library/demos/labelframe.tcl b/library/demos/labelframe.tcl
index 127852e..21d079f 100644
--- a/library/demos/labelframe.tcl
+++ b/library/demos/labelframe.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .labelframe
catch {destroy $w}
toplevel $w
@@ -21,13 +23,9 @@ label $w.msg -font $font -wraplength 4i -justify left -text "Labelframes are\
plain text or another widget."
pack $w.msg -side top
-# The bottom buttons
-
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w" -width 15
-button $w.buttons.code -text "See Code" -command "showCode $w" -width 15
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
# Demo area
diff --git a/library/demos/mclist.tcl b/library/demos/mclist.tcl
new file mode 100644
index 0000000..d1d3f47
--- /dev/null
+++ b/library/demos/mclist.tcl
@@ -0,0 +1,96 @@
+# mclist.tcl --
+#
+# This demonstration script creates a toplevel window containing a Ttk
+# tree widget configured as a multi-column listbox.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .mclist
+catch {destroy $w}
+toplevel $w
+wm title $w "Multi-Column List"
+wm iconname $w "mclist"
+positionWindow $w
+
+## Explanatory text
+ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which can be configured to display multiple columns of informational data without displaying the tree itself. This is a simple way to build a listbox that has multiple columns. Clicking on the heading for a column will sort the data by that column. You can also change the width of the columns by dragging the boundary between them."
+pack $w.msg -fill x
+
+## See Code / Dismiss
+pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
+
+ttk::frame $w.container
+ttk::treeview $w.tree -columns {country capital currency} -show headings \
+ -yscroll "$w.vsb set" -xscroll "$w.hsb set"
+if {[tk windowingsystem] ne "aqua"} {
+ ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
+ ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
+} else {
+ scrollbar $w.vsb -orient vertical -command "$w.tree yview"
+ scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
+}
+pack $w.container -fill both -expand 1
+grid $w.tree $w.vsb -in $w.container -sticky nsew
+grid $w.hsb -in $w.container -sticky nsew
+grid column $w.container 0 -weight 1
+grid row $w.container 0 -weight 1
+
+## The data we're going to insert
+set data {
+ Argentina {Buenos Aires} ARS
+ Australia Canberra AUD
+ Brazil Brazilia BRL
+ Canada Ottawa CAD
+ China Beijing CNY
+ France Paris EUR
+ Germany Berlin EUR
+ India {New Delhi} INR
+ Italy Rome EUR
+ Japan Tokyo JPY
+ Mexico {Mexico City} MXN
+ Russia Moscow RUB
+ {South Africa} Pretoria ZAR
+ {United Kingdom} London GBP
+ {United States} {Washington, D.C.} USD
+}
+
+## Code to insert the data nicely
+set font [ttk::style lookup [$w.tree cget -style] -font]
+foreach col {country capital currency} name {Country Capital Currency} {
+ $w.tree heading $col -command [list SortBy $w.tree $col 0] -text $name
+ $w.tree column $col -width [font measure $font $name]
+}
+foreach {country capital currency} $data {
+ $w.tree insert {} end -values [list $country $capital $currency]
+ foreach col {country capital currency} {
+ set len [font measure $font "[set $col] "]
+ if {[$w.tree column $col -width] < $len} {
+ $w.tree column $col -width $len
+ }
+ }
+}
+
+## Code to do the sorting of the tree contents when clicked on
+proc SortBy {tree col direction} {
+ # Build something we can sort
+ set data {}
+ foreach row [$tree children {}] {
+ lappend data [list [$tree set $row $col] $row]
+ }
+
+ set dir [expr {$direction ? "-decreasing" : "-increasing"}]
+ set r -1
+
+ # Now reshuffle the rows into the sorted order
+ foreach info [lsort -dictionary -index 0 $dir $data] {
+ $tree move [lindex $info 1] {} [incr r]
+ }
+
+ # Switch the heading so that it will sort in the opposite direction
+ $tree heading $col -command [list SortBy $tree $col [expr {!$direction}]]
+}
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index 2c3e83e..ebd44f7 100644
--- a/library/demos/menu.tcl
+++ b/library/demos/menu.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .menu
catch {destroy $w}
toplevel $w
@@ -15,8 +17,7 @@ wm iconname $w "menu"
positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left
-if {[string equal [tk windowingsystem] "classic"]
- || [string equal [tk windowingsystem] "aqua"]} {
+if {[tk windowingsystem] eq "aqua"} {
catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1}
$w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu."
} else {
@@ -30,11 +31,9 @@ label $w.statusBar.label -textvariable menustatus -relief sunken -bd 1 -font "He
pack $w.statusBar.label -side left -padx 2 -expand yes -fill both
pack $w.statusBar -side bottom -fill x -pady 2
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
menu $w.menu -tearoff 0
@@ -55,8 +54,7 @@ set m $w.menu.basic
$w.menu add cascade -label "Basic" -menu $m -underline 0
menu $m -tearoff 0
$m add command -label "Long entry that does nothing"
-if {[string equal [tk windowingsystem] "classic"]
- || [string equal [tk windowingsystem] "aqua"]} {
+if {[tk windowingsystem] eq "aqua"} {
set modifier Command
} elseif {$tcl_platform(platform) == "windows"} {
set modifier Control
@@ -115,8 +113,9 @@ $m invoke 7
set m $w.menu.icon
$w.menu add cascade -label "Icons" -menu $m -underline 0
menu $m -tearoff 0
-$m add command -bitmap @[file join $tk_library demos images pattern.bmp] \
- -hidemargin 1 -command [list \
+# Main widget program sets variable tk_demoDirectory
+$m add command -bitmap @[file join $tk_demoDirectory images pattern.xbm] \
+ -hidemargin 1 -command [list \
tk_dialog $w.pattern {Bitmap Menu Entry} \
"The menu entry you invoked displays a bitmap rather than\
a text string. Other than this, it is just like any other\
@@ -159,6 +158,4 @@ bind Menu <<MenuSelect>> {
update idletasks
}
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
- catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}
-}
+if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}}
diff --git a/library/demos/menubu.tcl b/library/demos/menubu.tcl
index b506161..86326b5 100644
--- a/library/demos/menubu.tcl
+++ b/library/demos/menubu.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .menubu
catch {destroy $w}
toplevel $w
@@ -41,11 +43,9 @@ $w.body.above.m add command -label "Above menu: first item" -command "puts \"You
$w.body.above.m add command -label "Above menu: second item" -command "puts \"You have selected the second item from the Above menu.\""
grid $w.body.above -row 2 -column 1 -sticky s
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode .menubu"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
set body $w.body.center
label $body.label -wraplength 300 -font "Helvetica 14" -justify left -text "This is a demonstration of menubuttons. The \"Below\" menubutton pops its menu below the button; the \"Right\" button pops to the right, etc. There are two option menus directly below this text; one is just a standard menu and the other is a 16-color palette."
@@ -55,8 +55,7 @@ pack $body.buttons -padx 25 -pady 25
tk_optionMenu $body.buttons.options menubuttonoptions one two three
pack $body.buttons.options -side left -padx 25 -pady 25
set m [tk_optionMenu $body.buttons.colors paletteColor Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 Yellow Cyan Magenta White Brown DarkSeaGreen DarkViolet]
-if {[string equal [tk windowingsystem] "classic"]
- || [string equal [tk windowingsystem] "aqua"]} {
+if {[tk windowingsystem] eq "aqua"} {
set topBorderColor Black
set bottomBorderColor Black
} else {
diff --git a/library/demos/msgbox.tcl b/library/demos/msgbox.tcl
index 51efde6..a8f7d17 100644
--- a/library/demos/msgbox.tcl
+++ b/library/demos/msgbox.tcl
@@ -6,6 +6,9 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+package require Ttk
+
set w .msgbox
catch {destroy $w}
toplevel $w
@@ -16,13 +19,10 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "Choose the icon and type option of the message box. Then press the \"Message Box\" button to see the message box."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-button $w.buttons.vars -text "Message Box" \
- -command "showMessageBox $w"
-pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1
+pack [addSeeDismiss $w.buttons $w {} {
+ ttk::button $w.buttons.vars -text "Message Box" -command "showMessageBox $w"
+}] -side bottom -fill x
+#pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1
frame $w.left
frame $w.right
diff --git a/library/demos/nl.msg b/library/demos/nl.msg
new file mode 100644
index 0000000..b17ceaa
--- /dev/null
+++ b/library/demos/nl.msg
@@ -0,0 +1,125 @@
+::msgcat::mcset nl "Widget Demonstration" "Demonstratie van widgets"
+::msgcat::mcset nl "tkWidgetDemo" "tkWidgetDemo"
+::msgcat::mcset nl "&File" "&Bestand"
+::msgcat::mcset nl "About..." "Info..."
+::msgcat::mcset nl "&About..." "&Info..."
+::msgcat::mcset nl "<F1>" "<F1>"
+::msgcat::mcset nl "&Quit" "&Einde"
+::msgcat::mcset nl "Meta+Q" "Meta+E" ;# Displayed hotkey
+::msgcat::mcset nl "Meta-q" "Meta-e" ;# Actual binding sequence
+::msgcat::mcset nl "Ctrl+Q" "Ctrl+E" ;# Displayed hotkey
+::msgcat::mcset nl "Control-q" "Control-e" ;# Actual binding sequence
+::msgcat::mcset nl "Dismiss" "Sluiten"
+::msgcat::mcset nl "See Variables" "Bekijk Variabelen"
+::msgcat::mcset nl "Variable Values" "Waarden Variabelen"
+::msgcat::mcset nl "OK" "OK"
+::msgcat::mcset nl "Run the \"%s\" sample program" "Start voorbeeld \"%s\""
+::msgcat::mcset nl "Print Code" "Code Afdrukken"
+::msgcat::mcset nl "Demo code: %s" "Code van Demo %s"
+::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie"
+::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets"
+::msgcat::mcset nl "Copyright (c) %s" "Copyright (c) %s"
+
+::msgcat::mcset nl "Tk Widget Demonstrations" "Demostratie van Tk widgets"
+::msgcat::mcset nl "This application provides a front end for several short scripts" \
+ "Dit programma is een schil rond enkele korte scripts waarmee"
+::msgcat::mcset nl "that demonstrate what you can do with Tk widgets. Each of the" \
+ "gedemonstreerd wordt wat je kunt doen met Tk widgets. Elk van de"
+::msgcat::mcset nl "numbered lines below describes a demonstration; you can click on" \
+ "genummerde regels hieronder omschrijft een demonstratie; je kunt de"
+::msgcat::mcset nl "it to invoke the demonstration. Once the demonstration window" \
+ "demonstratie starten door op de regel te klikken."
+::msgcat::mcset nl "appears, you can click the" \
+ "Zodra het nieuwe venster verschijnt, kun je op de knop"
+::msgcat::mcset nl "See Code" "Bekijk Code" ;# This is also button text!
+::msgcat::mcset nl "button to see the Tcl/Tk code that created the demonstration. If" \
+ "drukken om de achterliggende Tcl/Tk code te zien. Als je dat wilt,"
+::msgcat::mcset nl "you wish, you can edit the code and click the" \
+ "kun je de code wijzigen en op de knop"
+::msgcat::mcset nl "Rerun Demo" "Herstart Demo" ;# This is also button text!
+::msgcat::mcset nl "button in the code window to reinvoke the demonstration with the" \
+ "drukken in het codevenster om de demonstratie uit te voeren met de"
+::msgcat::mcset nl "modified code." \
+ "nieuwe code."
+
+::msgcat::mcset nl "Labels, buttons, checkbuttons, and radiobuttons" \
+ "Labels, knoppen, vinkjes/aankruishokjes en radioknoppen"
+
+::msgcat::mcset nl "Labels (text and bitmaps)" "Labels (tekst en plaatjes)"
+::msgcat::mcset nl "Labels and UNICODE text" "Labels en tekst in UNICODE"
+::msgcat::mcset nl "Buttons" "Buttons (drukknoppen)"
+::msgcat::mcset nl "Check-buttons (select any of a group)" \
+ "Check-buttons (een of meer uit een groep)"
+::msgcat::mcset nl "Radio-buttons (select one of a group)" \
+ "Radio-buttons (een van een groep)"
+::msgcat::mcset nl "A 15-puzzle game made out of buttons" \
+ "Een schuifpuzzel van buttons"
+::msgcat::mcset nl "Iconic buttons that use bitmaps" \
+ "Buttons met pictogrammen"
+::msgcat::mcset nl "Two labels displaying images" \
+ "Twee labels met plaatjes in plaats van tekst"
+::msgcat::mcset nl "A simple user interface for viewing images" \
+ "Een eenvoudige user-interface voor het bekijken van plaatjes"
+::msgcat::mcset nl "Labelled frames" \
+ "Kaders met bijschrift"
+
+::msgcat::mcset nl "Listboxes" "Keuzelijsten"
+::msgcat::mcset nl "The 50 states" "De 50 staten van de VS"
+::msgcat::mcset nl "Colors: change the color scheme for the application" \
+ "Kleuren: verander het kleurenschema voor het programma"
+::msgcat::mcset nl "A collection of famous and infamous sayings" \
+ "Beroemde en beruchte citaten en gezegden"
+
+::msgcat::mcset nl "Entries and Spin-boxes" "Invulvelden en Spinboxen"
+::msgcat::mcset nl "Entries without scrollbars" "Invulvelden zonder schuifbalk"
+::msgcat::mcset nl "Entries with scrollbars" "Invulvelden met schuifbalk"
+::msgcat::mcset nl "Validated entries and password fields" \
+ "Invulvelden met controle of wachtwoorden"
+::msgcat::mcset nl "Spin-boxes" "Spinboxen"
+::msgcat::mcset nl "Simple Rolodex-like form" "Simpel kaartsysteem"
+
+::msgcat::mcset nl "Text" "Tekst"
+::msgcat::mcset nl "Basic editable text" "Voorbeeld met te wijzigen tekst"
+::msgcat::mcset nl "Text display styles" "Tekst met verschillende stijlen"
+::msgcat::mcset nl "Hypertext (tag bindings)" \
+ "Hypertext (verwijzingen via \"tags\")"
+::msgcat::mcset nl "A text widget with embedded windows" \
+ "Tekstwidget met windows erin"
+::msgcat::mcset nl "A search tool built with a text widget" \
+ "Zoeken in tekst met behulp van een tekstwidget"
+
+::msgcat::mcset nl "Canvases" "Canvaswidgets"
+::msgcat::mcset nl "The canvas item types" "Objecten in een canvas"
+::msgcat::mcset nl "A simple 2-D plot" "Eenvoudige 2D-grafiek"
+::msgcat::mcset nl "Text items in canvases" "Tekstobjecten in een canvas"
+::msgcat::mcset nl "An editor for arrowheads on canvas lines" \
+ "Editor voor de vorm van de pijl (begin/eind van een lijn)"
+::msgcat::mcset nl "A ruler with adjustable tab stops" \
+ "Een meetlat met aanpasbare ruiters"
+::msgcat::mcset nl "A building floor plan" "Plattegrond van een gebouw"
+::msgcat::mcset nl "A simple scrollable canvas" "Een schuifbaar canvas"
+
+::msgcat::mcset nl "Scales" "Schaalverdelingen"
+::msgcat::mcset nl "Horizontal scale" "Horizontale schaal"
+::msgcat::mcset nl "Vertical scale" "Verticale schaal"
+
+::msgcat::mcset nl "Paned Windows" "Vensters opgedeeld in stukken"
+::msgcat::mcset nl "Horizontal paned window" "Horizontaal gedeeld venster"
+::msgcat::mcset nl "Vertical paned window" "Verticaal gedeeld venster"
+
+::msgcat::mcset nl "Menus" "Menu's"
+::msgcat::mcset nl "Menus and cascades (sub-menus)" \
+ "Menu's en cascades (submenu's)"
+::msgcat::mcset nl "Menu-buttons" "Menu-buttons"
+
+::msgcat::mcset nl "Common Dialogs" "Veel voorkomende dialoogvensters"
+::msgcat::mcset nl "Message boxes" "Mededeling (message box)"
+::msgcat::mcset nl "File selection dialog" "Selectie van bestanden"
+::msgcat::mcset nl "Color picker" "Kleurenpalet"
+
+::msgcat::mcset nl "Miscellaneous" "Diversen"
+::msgcat::mcset nl "The built-in bitmaps" "Ingebouwde plaatjes"
+::msgcat::mcset nl "A dialog box with a local grab" \
+ "Een dialoogvenster met een locale \"grab\""
+::msgcat::mcset nl "A dialog box with a global grab" \
+ "Een dialoogvenster met een globale \"grab\""
diff --git a/library/demos/paned1.tcl b/library/demos/paned1.tcl
index 2e01a22..783b7f3 100644
--- a/library/demos/paned1.tcl
+++ b/library/demos/paned1.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .paned1
catch {destroy $w}
toplevel $w
@@ -17,11 +19,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two coloured windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)"
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
panedwindow $w.pane
pack $w.pane -side top -expand yes -fill both -pady 2 -padx 2m
diff --git a/library/demos/paned2.tcl b/library/demos/paned2.tcl
index 9f6f22a..f481d14 100644
--- a/library/demos/paned2.tcl
+++ b/library/demos/paned2.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .paned2
catch {destroy $w}
toplevel $w
@@ -17,11 +19,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)"
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
# Create the pane itself
panedwindow $w.pane -orient vertical
@@ -61,7 +61,7 @@ pack $f.list -fill both -expand 1
# The bottom window is a text widget with scrollbar
set f [frame $w.pane.bottom]
text $f.text -xscrollcommand "$f.xscr set" -yscrollcommand "$f.yscr set" \
- -width 30 -wrap none
+ -width 30 -height 8 -wrap none
scrollbar $f.xscr -orient horizontal -command "$f.text xview"
scrollbar $f.yscr -orient vertical -command "$f.text yview"
grid $f.text $f.yscr -sticky nsew
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
new file mode 100644
index 0000000..2e3d459
--- /dev/null
+++ b/library/demos/pendulum.tcl
@@ -0,0 +1,197 @@
+# pendulum.tcl --
+#
+# This demonstration illustrates how Tcl/Tk can be used to construct
+# simulations of physical systems.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+
+set w .pendulum
+catch {destroy $w}
+toplevel $w
+wm title $w "Pendulum Animation Demonstration"
+wm iconname $w "pendulum"
+positionWindow $w
+
+label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows how Tcl/Tk can be used to carry out animations that are linked to simulations of physical systems. In the left canvas is a graphical representation of the physical system itself, a simple pendulum, and in the right canvas is a graph of the phase space of the system, which is a plot of the angle (relative to the vertical) against the angular velocity. The pendulum bob may be repositioned by clicking and dragging anywhere on the left canvas."
+pack $w.msg
+
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
+
+# Create some structural widgets
+pack [panedwindow $w.p] -fill both -expand 1
+$w.p add [labelframe $w.p.l1 -text "Pendulum Simulation"]
+$w.p add [labelframe $w.p.l2 -text "Phase Space"]
+
+# Create the canvas containing the graphical representation of the
+# simulated system.
+canvas $w.c -width 320 -height 200 -background white -bd 2 -relief sunken
+$w.c create text 5 5 -anchor nw -text "Click to Adjust Bob Start Position"
+# Coordinates of these items don't matter; they will be set properly below
+$w.c create line 0 25 320 25 -tags plate -fill grey50 -width 2
+$w.c create oval 155 20 165 30 -tags pivot -fill grey50 -outline {}
+$w.c create line 1 1 1 1 -tags rod -fill black -width 3
+$w.c create oval 1 1 2 2 -tags bob -fill yellow -outline black
+pack $w.c -in $w.p.l1 -fill both -expand true
+
+# Create the canvas containing the phase space graph; this consists of
+# a line that gets gradually paler as it ages, which is an extremely
+# effective visual trick.
+canvas $w.k -width 320 -height 200 -background white -bd 2 -relief sunken
+$w.k create line 160 200 160 0 -fill grey75 -arrow last -tags y_axis
+$w.k create line 0 100 320 100 -fill grey75 -arrow last -tags x_axis
+for {set i 90} {$i>=0} {incr i -10} {
+ # Coordinates of these items don't matter; they will be set properly below
+ $w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
+}
+# FIXME: UNICODE labels
+$w.k create text 0 0 -anchor ne -text "q" -font {Symbol 8} -tags label_theta
+$w.k create text 0 0 -anchor ne -text "dq" -font {Symbol 8} -tags label_dtheta
+pack $w.k -in $w.p.l2 -fill both -expand true
+
+# Initialize some variables
+set points {}
+set Theta 45.0
+set dTheta 0.0
+set pi 3.1415926535897933
+set length 150
+set home 160
+
+# This procedure makes the pendulum appear at the correct place on the
+# canvas. If the additional arguments "at $x $y" are passed (the 'at'
+# is really just syntactic sugar) instead of computing the position of
+# the pendulum from the length of the pendulum rod and its angle, the
+# length and angle are computed in reverse from the given location
+# (which is taken to be the centre of the pendulum bob.)
+proc showPendulum {canvas {at {}} {x {}} {y {}}} {
+ global Theta dTheta pi length home
+ if {$at eq "at" && ($x!=$home || $y!=25)} {
+ set dTheta 0.0
+ set x2 [expr {$x - $home}]
+ set y2 [expr {$y - 25}]
+ set length [expr {hypot($x2, $y2)}]
+ set Theta [expr {atan2($x2, $y2) * 180/$pi}]
+ } else {
+ set angle [expr {$Theta * $pi/180}]
+ set x [expr {$home + $length*sin($angle)}]
+ set y [expr {25 + $length*cos($angle)}]
+ }
+ $canvas coords rod $home 25 $x $y
+ $canvas coords bob \
+ [expr {$x-15}] [expr {$y-15}] [expr {$x+15}] [expr {$y+15}]
+}
+showPendulum $w.c
+
+# Update the phase-space graph according to the current angle and the
+# rate at which the angle is changing (the first derivative with
+# respect to time.)
+proc showPhase {canvas} {
+ global Theta dTheta points psw psh
+ lappend points [expr {$Theta+$psw}] [expr {-20*$dTheta+$psh}]
+ if {[llength $points] > 100} {
+ set points [lrange $points end-99 end]
+ }
+ for {set i 0} {$i<100} {incr i 10} {
+ set list [lrange $points end-[expr {$i-1}] end-[expr {$i-12}]]
+ if {[llength $list] >= 4} {
+ $canvas coords graph$i $list
+ }
+ }
+}
+
+# Set up some bindings on the canvases. Note that when the user
+# clicks we stop the animation until they release the mouse
+# button. Also note that both canvases are sensitive to <Configure>
+# events, which allows them to find out when they have been resized by
+# the user.
+bind $w.c <Destroy> {
+ after cancel $animationCallbacks(pendulum)
+ unset animationCallbacks(pendulum)
+}
+bind $w.c <1> {
+ after cancel $animationCallbacks(pendulum)
+ showPendulum %W at %x %y
+}
+bind $w.c <B1-Motion> {
+ showPendulum %W at %x %y
+}
+bind $w.c <ButtonRelease-1> {
+ showPendulum %W at %x %y
+ set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]]
+}
+bind $w.c <Configure> {
+ %W coords plate 0 25 %w 25
+ set home [expr %w/2]
+ %W coords pivot [expr $home-5] 20 [expr $home+5] 30
+}
+bind $w.k <Configure> {
+ set psh [expr %h/2]
+ set psw [expr %w/2]
+ %W coords x_axis 2 $psh [expr %w-2] $psh
+ %W coords y_axis $psw [expr %h-2] $psw 2
+ %W coords label_dtheta [expr $psw-4] 6
+ %W coords label_theta [expr %w-6] [expr $psh+4]
+}
+
+# This procedure is the "business" part of the simulation that does
+# simple numerical integration of the formula for a simple rotational
+# pendulum.
+proc recomputeAngle {} {
+ global Theta dTheta pi length
+ set scaling [expr {3000.0/$length/$length}]
+
+ # To estimate the integration accurately, we really need to
+ # compute the end-point of our time-step. But to do *that*, we
+ # need to estimate the integration accurately! So we try this
+ # technique, which is inaccurate, but better than doing it in a
+ # single step. What we really want is bound up in the
+ # differential equation:
+ # .. - sin theta
+ # theta + theta = -----------
+ # length
+ # But my math skills are not good enough to solve this!
+
+ # first estimate
+ set firstDDTheta [expr {-sin($Theta * $pi/180)*$scaling}]
+ set midDTheta [expr {$dTheta + $firstDDTheta}]
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
+ # second estimate
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
+ set midDTheta [expr {$dTheta + ($firstDDTheta + $midDDTheta)/2}]
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
+ # Now we do a double-estimate approach for getting the final value
+ # first estimate
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
+ set lastDTheta [expr {$midDTheta + $midDDTheta}]
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
+ # second estimate
+ set lastDDTheta [expr {-sin($lastTheta * $pi/180)*$scaling}]
+ set lastDTheta [expr {$midDTheta + ($midDDTheta + $lastDDTheta)/2}]
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
+ # Now put the values back in our globals
+ set dTheta $lastDTheta
+ set Theta $lastTheta
+}
+
+# This method ties together the simulation engine and the graphical
+# display code that visualizes it.
+proc repeat w {
+ global animationCallbacks
+
+ # Simulate
+ recomputeAngle
+
+ # Update the display
+ showPendulum $w.c
+ showPhase $w.k
+
+ # Reschedule ourselves
+ set animationCallbacks(pendulum) [after 15 [list repeat $w]]
+}
+# Start the simulation after a short pause
+set animationCallbacks(pendulum) [after 500 [list repeat $w]]
diff --git a/library/demos/plot.tcl b/library/demos/plot.tcl
index cd7fbd8..e7f0361 100644
--- a/library/demos/plot.tcl
+++ b/library/demos/plot.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .plot
catch {destroy $w}
toplevel $w
@@ -18,11 +20,9 @@ set c $w.c
label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
canvas $c -relief raised -width 450 -height 300
pack $w.c -side top -fill x
diff --git a/library/demos/puzzle.tcl b/library/demos/puzzle.tcl
index 4273926..fb8ab4c 100644
--- a/library/demos/puzzle.tcl
+++ b/library/demos/puzzle.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# puzzleSwitch --
# This procedure is invoked when the user clicks on a particular button;
# if the button is next to the empty space, it moves the button into th
@@ -42,11 +44,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "A 15-puzzle appears below as a collection of buttons. Click on any of the pieces next to the space, and that piece will slide over the space. Continue this until the pieces are arranged in numerical order from upper-left to lower-right."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
# Special trick: select a darker color for the space by creating a
# scrollbar widget and using its trough color.
diff --git a/library/demos/radio.tcl b/library/demos/radio.tcl
index a9a2a73..5c73703 100644
--- a/library/demos/radio.tcl
+++ b/library/demos/radio.tcl
@@ -7,31 +7,37 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .radio
catch {destroy $w}
toplevel $w
wm title $w "Radiobutton Demonstration"
wm iconname $w "radio"
positionWindow $w
-label $w.msg -font $font -wraplength 5i -justify left -text "Three groups of radiobuttons are displayed below. If you click on a button then the button will become selected exclusively among all the buttons in its group. A Tcl variable is associated with each group to indicate which of the group's buttons is selected. Click the \"See Variables\" button to see the current values of the variables."
-pack $w.msg -side top
+label $w.msg -font $font -wraplength 5i -justify left -text "Three groups of radiobuttons are displayed below. If you click on a button then the button will become selected exclusively among all the buttons in its group. A Tcl variable is associated with each group to indicate which of the group's buttons is selected. When the 'Tristate' button is pressed, the radio buttons will display the tri-state mode. Selecting any radio button will return the buttons to their respective on/off state. Click the \"See Variables\" button to see the current values of the variables."
+grid $w.msg -row 0 -column 0 -columnspan 3 -sticky nsew
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-button $w.buttons.vars -text "See Variables" \
- -command "showVars $w.dialog size color align"
-pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w [list size color align]]
+grid $btns -row 3 -column 0 -columnspan 3 -sticky ew
labelframe $w.left -pady 2 -text "Point Size" -padx 2
labelframe $w.mid -pady 2 -text "Color" -padx 2
labelframe $w.right -pady 2 -text "Alignment" -padx 2
-pack $w.left $w.mid $w.right -side left -expand yes -pady .5c -padx .5c
+button $w.tristate -text Tristate -command "set size multi; set color multi" \
+ -pady 2 -padx 2
+if {[tk windowingsystem] eq "aqua"} {
+ $w.tristate configure -padx 10
+}
+grid $w.left -column 0 -row 1 -pady .5c -padx .5c -rowspan 2
+grid $w.mid -column 1 -row 1 -pady .5c -padx .5c -rowspan 2
+grid $w.right -column 2 -row 1 -pady .5c -padx .5c
+grid $w.tristate -column 2 -row 2 -pady .5c -padx .5c
foreach i {10 12 14 18 24} {
radiobutton $w.left.b$i -text "Point Size $i" -variable size \
- -relief flat -value $i
+ -relief flat -value $i -tristatevalue "multi"
pack $w.left.b$i -side top -pady 2 -anchor w -fill x
}
@@ -39,10 +45,12 @@ foreach c {Red Green Blue Yellow Orange Purple} {
set lower [string tolower $c]
radiobutton $w.mid.$lower -text $c -variable color \
-relief flat -value $lower -anchor w \
- -command "$w.mid configure -fg \$color"
+ -command "$w.mid configure -fg \$color" \
+ -tristatevalue "multi"
pack $w.mid.$lower -side top -pady 2 -fill x
}
+
label $w.right.l -text "Label" -bitmap questhead -compound left
$w.right.l configure -width [winfo reqwidth $w.right.l] -compound top
$w.right.l configure -height [winfo reqheight $w.right.l]
@@ -52,6 +60,7 @@ foreach a {Top Left Right Bottom} {
-relief flat -value $lower -indicatoron 0 -width 7 \
-command "$w.right.l configure -compound \$align"
}
+
grid x $w.right.top
grid $w.right.left $w.right.l $w.right.right
grid x $w.right.bottom
diff --git a/library/demos/rmt b/library/demos/rmt
index 423c4a6..51886de 100644
--- a/library/demos/rmt
+++ b/library/demos/rmt
@@ -7,6 +7,9 @@ exec wish "$0" ${1+"$@"}
# Tk applications. It allows you to select an application and
# then type commands to that application.
+package require Tcl 8.4
+package require Tk
+
wm title . "Tk Remote Controller"
wm iconname . "Tk Remote"
wm minsize . 1 1
@@ -40,7 +43,7 @@ menu .menu.file.apps -postcommand fillAppsMenu
# Create text window and scrollbar.
-text .t -relief sunken -bd 2 -yscrollcommand ".s set" -setgrid true
+text .t -yscrollcommand ".s set" -setgrid true
scrollbar .s -command ".t yview"
grid .t .s -sticky nsew
grid rowconfigure . 0 -weight 1
@@ -60,58 +63,60 @@ bind .t <Return> {
}
bind .t <Delete> {
catch {.t tag remove sel sel.first promptEnd}
- if {[.t tag nextrange sel 1.0 end] == ""} {
- if [.t compare insert < promptEnd] {
+ if {[.t tag nextrange sel 1.0 end] eq ""} {
+ if {[.t compare insert < promptEnd]} {
break
}
}
}
bind .t <BackSpace> {
catch {.t tag remove sel sel.first promptEnd}
- if {[.t tag nextrange sel 1.0 end] == ""} {
- if [.t compare insert <= promptEnd] {
+ if {[.t tag nextrange sel 1.0 end] eq ""} {
+ if {[.t compare insert <= promptEnd]} {
break
}
}
}
bind .t <Control-d> {
- if [.t compare insert < promptEnd] {
+ if {[.t compare insert < promptEnd]} {
break
}
}
bind .t <Control-k> {
- if [.t compare insert < promptEnd] {
+ if {[.t compare insert < promptEnd]} {
.t mark set insert promptEnd
}
}
bind .t <Control-t> {
- if [.t compare insert < promptEnd] {
+ if {[.t compare insert < promptEnd]} {
break
}
}
bind .t <Meta-d> {
- if [.t compare insert < promptEnd] {
+ if {[.t compare insert < promptEnd]} {
break
}
}
bind .t <Meta-BackSpace> {
- if [.t compare insert <= promptEnd] {
+ if {[.t compare insert <= promptEnd]} {
break
}
}
bind .t <Control-h> {
- if [.t compare insert <= promptEnd] {
+ if {[.t compare insert <= promptEnd]} {
break
}
}
-auto_load tkTextInsert
-proc tkTextInsert {w s} {
- if {$s == ""} {
+### This next bit *isn't* nice - DKF ###
+auto_load tk::TextInsert
+proc tk::TextInsert {w s} {
+ if {$s eq ""} {
return
}
catch {
- if {[$w compare sel.first <= insert]
- && [$w compare sel.last >= insert]} {
+ if {
+ [$w compare sel.first <= insert] && [$w compare sel.last >= insert]
+ } then {
$w tag remove sel sel.first promptEnd
$w delete sel.first sel.last
}
@@ -143,23 +148,21 @@ proc invoke {} {
global app executing lastCommand
set cmd [.t get promptEnd insert]
incr executing 1
- if [info complete $cmd] {
- if {$cmd == "!!\n"} {
+ if {[info complete $cmd]} {
+ if {$cmd eq "!!\n"} {
set cmd $lastCommand
} else {
set lastCommand $cmd
}
- if {$app == "local"} {
+ if {$app eq "local"} {
set result [catch [list uplevel #0 $cmd] msg]
} else {
set result [catch [list send $app $cmd] msg]
}
if {$result != 0} {
.t insert insert "Error: $msg\n"
- } else {
- if {$msg != ""} {
- .t insert insert $msg\n
- }
+ } elseif {$msg ne ""} {
+ .t insert insert $msg\n
}
prompt
.t mark set promptEnd insert
@@ -177,14 +180,14 @@ proc invoke {} {
proc newApp appName {
global app executing
set app $appName
- if !$executing {
+ if {!$executing} {
.t mark gravity promptEnd right
.t delete "promptEnd linestart" promptEnd
.t insert promptEnd "$appName: "
.t tag add bold "promptEnd linestart" promptEnd
.t mark gravity promptEnd left
}
- return {}
+ return
}
# The procedure below will fill in the applications sub-menu with a list
diff --git a/library/demos/rolodex b/library/demos/rolodex
index 50ac590..8941570 100644
--- a/library/demos/rolodex
+++ b/library/demos/rolodex
@@ -8,6 +8,8 @@ exec wish "$0" ${1+"$@"}
# feel of a rolodex program, although it's lifeless and doesn't
# actually do the rolodex application.
+package require Tk
+
foreach i [winfo child .] {
catch {destroy $i}
}
@@ -41,6 +43,10 @@ pack .buttons.clear .buttons.add .buttons.search .buttons.delete \
# Phase 1: Add menus, dialog boxes
#------------------------------------------
+# DKF - note that this is an old-style menu bar; I just have not yet
+# got around to converting the context help code to work with the new
+# menu system and its <<MenuSelect>> virtual event.
+
frame .menu -relief raised -borderwidth 1
pack .menu -before .frame -side top -fill x
@@ -192,3 +198,7 @@ set helpTopics(version) "This is version $version."
-underline 3
.menu.help.m add command -label "On Version..." -command {Help version} \
-underline 3
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/library/demos/ruler.tcl b/library/demos/ruler.tcl
index ccdb1fc..557b680 100644
--- a/library/demos/ruler.tcl
+++ b/library/demos/ruler.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# rulerMkTab --
# This procedure creates a new triangular polygon in a canvas to
# represent a tab stop.
@@ -22,7 +24,6 @@ proc rulerMkTab {c x y} {
}
set w .ruler
-global tk_library
catch {destroy $w}
toplevel $w
wm title $w "Ruler Demonstration"
@@ -33,11 +34,9 @@ set c $w.c
label $w.msg -font $font -wraplength 5i -justify left -text "This canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
canvas $c -width 14.8c -height 2.5c
pack $w.c -side top -fill x
@@ -49,14 +48,15 @@ set demo_rulerInfo(top) [winfo fpixels $c 1c]
set demo_rulerInfo(bottom) [winfo fpixels $c 1.5c]
set demo_rulerInfo(size) [winfo fpixels $c .2c]
set demo_rulerInfo(normalStyle) "-fill black"
+# Main widget program sets variable tk_demoDirectory
if {[winfo depth $c] > 1} {
set demo_rulerInfo(activeStyle) "-fill red -stipple {}"
set demo_rulerInfo(deleteStyle) [list -fill red \
- -stipple @[file join $tk_library demos images gray25.bmp]]
+ -stipple @[file join $tk_demoDirectory images gray25.xbm]]
} else {
set demo_rulerInfo(activeStyle) "-fill black -stipple {}"
set demo_rulerInfo(deleteStyle) [list -fill black \
- -stipple @[file join $tk_library demos images gray25.bmp]]
+ -stipple @[file join $tk_demoDirectory images gray25.xbm]]
}
$c create line 1c 0.5c 1c 1c 13c 1c 13c 0.5c -width 1
diff --git a/library/demos/sayings.tcl b/library/demos/sayings.tcl
index 72c141c..4d26ffe 100644
--- a/library/demos/sayings.tcl
+++ b/library/demos/sayings.tcl
@@ -8,6 +8,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .sayings
catch {destroy $w}
toplevel $w
@@ -18,14 +20,12 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "The listbox below contains a collection of well-known sayings. You can scan the list using either of the scrollbars or by dragging in the listbox window with button 2 pressed."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame -borderwidth 10
-pack $w.frame -side top -expand yes -fill y
+pack $w.frame -side top -expand yes -fill both -padx 1c
scrollbar $w.frame.yscroll -command "$w.frame.list yview"
@@ -41,4 +41,4 @@ grid rowconfig $w.frame 0 -weight 1 -minsize 0
grid columnconfig $w.frame 0 -weight 1 -minsize 0
-$w.frame.list insert 0 "Waste not, want not" "Early to bed and early to rise makes a man healthy, wealthy, and wise" "Ask not what your country can do for you, ask what you can do for your country" "I shall return" "NOT" "A picture is worth a thousand words" "User interfaces are hard to build" "Thou shalt not steal" "A penny for your thoughts" "Fool me once, shame on you; fool me twice, shame on me" "Every cloud has a silver lining" "Where there's smoke there's fire" "It takes one to know one" "Curiosity killed the cat" "Take this job and shove it" "Up a creek without a paddle" "I'm mad as hell and I'm not going to take it any more" "An apple a day keeps the doctor away" "Don't look a gift horse in the mouth"
+$w.frame.list insert 0 "Don't speculate, measure" "Waste not, want not" "Early to bed and early to rise makes a man healthy, wealthy, and wise" "Ask not what your country can do for you, ask what you can do for your country" "I shall return" "NOT" "A picture is worth a thousand words" "User interfaces are hard to build" "Thou shalt not steal" "A penny for your thoughts" "Fool me once, shame on you; fool me twice, shame on me" "Every cloud has a silver lining" "Where there's smoke there's fire" "It takes one to know one" "Curiosity killed the cat" "Take this job and shove it" "Up a creek without a paddle" "I'm mad as hell and I'm not going to take it any more" "An apple a day keeps the doctor away" "Don't look a gift horse in the mouth" "Measure twice, cut once"
diff --git a/library/demos/search.tcl b/library/demos/search.tcl
index 3a5e9bc..9f44e16 100644
--- a/library/demos/search.tcl
+++ b/library/demos/search.tcl
@@ -8,6 +8,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# textLoadFile --
# This procedure below loads a file into a text widget, discarding
# the previous contents of the widget. Tags for the old widget are
@@ -80,11 +82,9 @@ wm title $w "Text Demonstration - Search and Highlight"
wm iconname $w "search"
positionWindow $w
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.file
label $w.file.label -text "File name:" -width 13 -anchor w
diff --git a/library/demos/spin.tcl b/library/demos/spin.tcl
index b31d76d..d897e6d 100644
--- a/library/demos/spin.tcl
+++ b/library/demos/spin.tcl
@@ -6,6 +6,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .spin
catch {destroy $w}
toplevel $w
@@ -26,11 +28,9 @@ label $w.msg -font $font -wraplength 5i -justify left -text "Three different\
Australian cities."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
set australianCities {
Canberra Sydney Melbourne Perth Adelaide Brisbane
diff --git a/library/demos/square b/library/demos/square
index ca7b42a..08c362b 100644
--- a/library/demos/square
+++ b/library/demos/square
@@ -11,6 +11,9 @@ exec wish "$0" ${1+"$@"}
# Button-1 press/drag: moves square to mouse
# "a": toggle size animation on/off
+package require Tk ;# We use Tk generally, and...
+package require Tktest ;# ... we use the square widget too.
+
square .s
pack .s -expand yes -fill both
wm minsize . 1 1
@@ -51,3 +54,7 @@ proc timer {} {
.s size [expr {$s+$inc}]
after 30 timer
}
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/library/demos/states.tcl b/library/demos/states.tcl
index 2455cf9..e76540d 100644
--- a/library/demos/states.tcl
+++ b/library/demos/states.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .states
catch {destroy $w}
toplevel $w
@@ -17,11 +19,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing the 50 states is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by scanning. To scan, press button 2 in the widget and drag up or down."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame -borderwidth .5c
pack $w.frame -side top -expand yes -fill y
diff --git a/library/demos/style.tcl b/library/demos/style.tcl
index 52b7dc1..614ea1f 100644
--- a/library/demos/style.tcl
+++ b/library/demos/style.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .style
catch {destroy $w}
toplevel $w
@@ -14,23 +16,26 @@ wm title $w "Text Demonstration - Display Styles"
wm iconname $w "style"
positionWindow $w
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
+
+# Only set the font family in one place for simplicity and consistency
+
+set family Courier
text $w.text -yscrollcommand "$w.scroll set" -setgrid true \
- -width 70 -height 32 -wrap word
+ -width 70 -height 32 -wrap word -font "$family 12"
scrollbar $w.scroll -command "$w.text yview"
pack $w.scroll -side right -fill y
pack $w.text -expand yes -fill both
# Set up display styles
-$w.text tag configure bold -font {Courier 12 bold italic}
-$w.text tag configure big -font {Courier 14 bold}
-$w.text tag configure verybig -font {Helvetica 24 bold}
+$w.text tag configure bold -font "$family 12 bold italic"
+$w.text tag configure big -font "$family 14 bold"
+$w.text tag configure verybig -font "Helvetica 24 bold"
+$w.text tag configure tiny -font "Times 8 bold"
if {[winfo depth $w] > 1} {
$w.text tag configure color1 -background #a0b7ce
$w.text tag configure color2 -foreground red
@@ -51,8 +56,8 @@ $w.text tag configure underline -underline on
$w.text tag configure overstrike -overstrike on
$w.text tag configure right -justify right
$w.text tag configure center -justify center
-$w.text tag configure super -offset 4p -font {Courier 10}
-$w.text tag configure sub -offset -2p -font {Courier 10}
+$w.text tag configure super -offset 4p -font "$family 10"
+$w.text tag configure sub -offset -2p -font "$family 10"
$w.text tag configure margins -lmargin1 12m -lmargin2 6m -rmargin 10m
$w.text tag configure spacing -spacing1 10p -spacing2 2p \
-lmargin1 12m -lmargin2 6m -rmargin 10m
@@ -61,17 +66,17 @@ $w.text insert end {Text widgets like this one allow you to display information
variety of styles. Display styles are controlled using a mechanism
called }
$w.text insert end tags bold
-$w.text insert end {. Tags are just textual names that you can apply to one
+$w.text insert end {. Tags are just textual names that you can apply to one
or more ranges of characters within a text widget. You can configure
tags with various display styles. If you do this, then the tagged
characters will be displayed with the styles you chose. The
available display styles are:
}
$w.text insert end "\n1. Font." big
-$w.text insert end " You can choose any X font, "
+$w.text insert end " You can choose any system font, "
$w.text insert end large verybig
$w.text insert end " or "
-$w.text insert end "small.\n"
+$w.text insert end "small" tiny ".\n"
$w.text insert end "\n2. Color." big
$w.text insert end " You can change either the "
$w.text insert end background color1
diff --git a/library/demos/tcolor b/library/demos/tcolor
index 4dd61bb..6e50c61 100644
--- a/library/demos/tcolor
+++ b/library/demos/tcolor
@@ -7,6 +7,7 @@ exec wish "$0" ${1+"$@"}
# create colors using either the RGB, HSB, or CYM color spaces
# and apply the color to existing applications.
+package require Tk 8.4
wm title . "Color Editor"
# Global variables that control the program:
@@ -39,10 +40,6 @@ set updating 0
set autoUpdate 1
set name ""
-if {$tcl_platform(platform) eq "unix"} {
- option add *Entry.background white
-}
-
# Create the menu bar at the top of the window.
. configure -menu [menu .menu]
@@ -66,8 +63,7 @@ menu .menu.file
# with the update button.
labelframe .command -text "Command:" -padx {1m 0}
-entry .command.e -relief sunken -borderwidth 2 -textvariable command \
- -font {Courier 12}
+entry .command.e -textvariable command
button .command.update -text Update -command doUpdate
pack .command.update -side right -pady .1c -padx {.25c 0}
pack .command.e -expand yes -fill x -ipadx 0.25c
@@ -93,12 +89,11 @@ foreach i {
grid .names -row 0 -column 0 -sticky nsew -padx .15c -pady .15c -rowspan 2
grid columnconfigure . 0 -weight 1
listbox .names.lb -width 20 -height 12 -yscrollcommand ".names.s set" \
- -relief sunken -borderwidth 2 -exportselection false
+ -exportselection false
bind .names.lb <Double-1> {
tc_loadNamedColor [.names.lb get [.names.lb curselection]]
}
- scrollbar .names.s -orient vertical -command ".names.lb yview" \
- -relief sunken -borderwidth 2
+ scrollbar .names.s -orient vertical -command ".names.lb yview"
pack .names.lb .names.s -side left -fill y -expand 1
while {[gets $f line] >= 0} {
if {[regexp {^\s*\d+\s+\d+\s+\d+\s+(\S+)$} $line -> col]} {
@@ -124,8 +119,7 @@ foreach i {1 2 3} {
grid .adjust -row 0 -column 1 -sticky nsew -padx .15c -pady .15c
labelframe .name -text "Name:" -padx 1m -pady 1m
-entry .name.e -relief sunken -borderwidth 2 -textvariable name -width 10 \
- -font {Courier 12}
+entry .name.e -textvariable name -width 10
pack .name.e -side right -expand 1 -fill x
bind .name.e <Return> {tc_loadNamedColor $name}
grid .name -column 1 -row 1 -sticky nsew -padx .15c -pady .15c
diff --git a/library/demos/text.tcl b/library/demos/text.tcl
index 52d6030..21ee096 100644
--- a/library/demos/text.tcl
+++ b/library/demos/text.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .text
catch {destroy $w}
toplevel $w
@@ -14,15 +16,13 @@ wm title $w "Text Demonstration - Basic Facilities"
wm iconname $w "text"
positionWindow $w
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
-text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 \
+text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \
-height 30 -undo 1 -autosep 1
-scrollbar $w.scroll -command "$w.text yview"
+scrollbar $w.scroll -command [list $w.text yview]
pack $w.scroll -side right -fill y
pack $w.text -expand yes -fill both
$w.text insert 0.0 \
@@ -68,7 +68,7 @@ insertion cursor. Control-z undoes the last editing action performed,
and }
switch $tcl_platform(platform) {
- "unix" - "macintosh" {
+ "unix" {
$w.text insert end "Control-Shift-z"
}
"windows" {
diff --git a/library/demos/textpeer.tcl b/library/demos/textpeer.tcl
new file mode 100644
index 0000000..e94284e
--- /dev/null
+++ b/library/demos/textpeer.tcl
@@ -0,0 +1,62 @@
+# textpeer.tcl --
+#
+# This demonstration script creates a pair of text widgets that can edit a
+# single logical buffer. This is particularly useful when editing related text
+# in two (or more) parts of the same file.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+
+set w .textpeer
+catch {destroy $w}
+toplevel $w
+wm title $w "Text Widget Peering Demonstration"
+wm iconname $w "textpeer"
+positionWindow $w
+
+set count 0
+
+## Define a widget that we peer from; it won't ever actually be shown though
+set first [text $w.text[incr count]]
+$first insert end "This is a coupled pair of text widgets; they are peers to "
+$first insert end "each other. They have the same underlying data model, but "
+$first insert end "can show different locations, have different current edit "
+$first insert end "locations, and have different selections. You can also "
+$first insert end "create additional peers of any of these text widgets using "
+$first insert end "the Make Peer button beside the text widget to clone, and "
+$first insert end "delete a particular peer widget using the Delete Peer "
+$first insert end "button."
+
+## Procedures to make and kill clones; most of this is just so that the demo
+## looks nice...
+proc makeClone {w parent} {
+ global count
+ set t [$parent peer create $w.text[incr count] -yscroll "$w.sb$count set"\
+ -height 10 -wrap word]
+ set sb [scrollbar $w.sb$count -command "$t yview" -orient vertical]
+ set b1 [button $w.clone$count -command "makeClone $w $t" \
+ -text "Make Peer"]
+ set b2 [button $w.kill$count -command "killClone $w $count" \
+ -text "Delete Peer"]
+ set row [expr {$count * 2}]
+ grid $t $sb $b1 -sticky nsew -row $row
+ grid ^ ^ $b2 -row [incr row]
+ grid configure $b1 $b2 -sticky new
+ grid rowconfigure $w $b2 -weight 1
+}
+proc killClone {w count} {
+ destroy $w.text$count $w.sb$count
+ destroy $w.clone$count $w.kill$count
+}
+
+## Now set up the GUI
+makeClone $w $first
+makeClone $w $first
+destroy $first
+
+## See Code / Dismiss buttons
+grid [addSeeDismiss $w.buttons $w] - - -sticky ew -row 5000
+grid columnconfigure $w 0 -weight 1
diff --git a/library/demos/timer b/library/demos/timer
index 320cd0e..e10b840 100644
--- a/library/demos/timer
+++ b/library/demos/timer
@@ -5,6 +5,9 @@ exec wish "$0" ${1+"$@"}
# timer --
# This script generates a counter with start and stop buttons.
+package require Tcl 8.4
+package require Tk
+
label .counter -text 0.00 -relief raised -width 10 -padx 2m -pady 1m
button .start -text Start -command {
if {$stopped} {
diff --git a/library/demos/toolbar.tcl b/library/demos/toolbar.tcl
new file mode 100644
index 0000000..541e8ba
--- /dev/null
+++ b/library/demos/toolbar.tcl
@@ -0,0 +1,104 @@
+# toolbar.tcl --
+#
+# This demonstration script creates a toolbar that can be torn off.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .toolbar
+destroy $w
+toplevel $w
+wm title $w "Toolbar Demonstration"
+wm iconname $w "toolbar"
+positionWindow $w
+
+if {[tk windowingsystem] ne "aqua"} {
+ ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\
+ a toolbar that is styled correctly and which can be torn off. The\
+ buttons are configured to be \u201Ctoolbar style\u201D buttons by\
+ telling them that they are to use the Toolbutton style. At the left\
+ end of the toolbar is a simple marker that the cursor changes to a\
+ movement icon over; drag that away from the toolbar to tear off the\
+ whole toolbar into a separate toplevel widget. When the dragged-off\
+ toolbar is no longer needed, just close it like any normal toplevel\
+ and it will reattach to the window it was torn off from."
+} else {
+ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\
+ a toolbar that is styled correctly. The buttons are configured to\
+ be \u201Ctoolbar style\u201D buttons by telling them that they are\
+ to use the Toolbutton style."
+}
+
+## Set up the toolbar hull
+set t [frame $w.toolbar] ;# Must be a frame!
+ttk::separator $w.sep
+ttk::frame $t.tearoff -cursor fleur
+if {[tk windowingsystem] ne "aqua"} {
+ ttk::separator $t.tearoff.to -orient vertical
+ ttk::separator $t.tearoff.to2 -orient vertical
+ pack $t.tearoff.to -fill y -expand 1 -padx 2 -side left
+ pack $t.tearoff.to2 -fill y -expand 1 -side left
+}
+ttk::frame $t.contents
+grid $t.tearoff $t.contents -sticky nsew
+grid columnconfigure $t $t.contents -weight 1
+grid columnconfigure $t.contents 1000 -weight 1
+
+if {[tk windowingsystem] ne "aqua"} {
+ ## Bindings so that the toolbar can be torn off and reattached
+ bind $t.tearoff <B1-Motion> [list tearoff $t %X %Y]
+ bind $t.tearoff.to <B1-Motion> [list tearoff $t %X %Y]
+ bind $t.tearoff.to2 <B1-Motion> [list tearoff $t %X %Y]
+ proc tearoff {w x y} {
+ if {[string match $w* [winfo containing $x $y]]} {
+ return
+ }
+ grid remove $w
+ grid remove $w.tearoff
+ wm manage $w
+ wm protocol $w WM_DELETE_WINDOW [list untearoff $w]
+ }
+ proc untearoff {w} {
+ wm forget $w
+ grid $w.tearoff
+ grid $w
+ }
+}
+
+## Toolbar contents
+ttk::button $t.button -text "Button" -style Toolbutton -command [list \
+ $w.txt insert end "Button Pressed\n"]
+ttk::checkbutton $t.check -text "Check" -variable check -style Toolbutton \
+ -command [concat [list $w.txt insert end] {"check is $check\n"}]
+ttk::menubutton $t.menu -text "Menu" -menu $t.menu.m
+ttk::combobox $t.combo -value [lsort [font families]] -state readonly
+menu $t.menu.m
+$t.menu.m add command -label "Just" -command [list $w.txt insert end Just\n]
+$t.menu.m add command -label "An" -command [list $w.txt insert end An\n]
+$t.menu.m add command -label "Example" \
+ -command [list $w.txt insert end Example\n]
+bind $t.combo <<ComboboxSelected>> [list changeFont $w.txt $t.combo]
+proc changeFont {txt combo} {
+ $txt configure -font [list [$combo get] 10]
+}
+
+## Some content for the rest of the toplevel
+text $w.txt -width 40 -height 10
+interp alias {} doInsert {} $w.txt insert end ;# Make bindings easy to write
+
+## Arrange contents
+grid $t.button $t.check $t.menu $t.combo -in $t.contents -padx 2 -sticky ns
+grid $t -sticky ew
+grid $w.sep -sticky ew
+grid $w.msg -sticky ew
+grid $w.txt -sticky nsew
+grid rowconfigure $w $w.txt -weight 1
+grid columnconfigure $w $w.txt -weight 1
+
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+grid $btns -sticky ew
diff --git a/library/demos/tree.tcl b/library/demos/tree.tcl
new file mode 100644
index 0000000..14d5db8
--- /dev/null
+++ b/library/demos/tree.tcl
@@ -0,0 +1,94 @@
+# tree.tcl --
+#
+# This demonstration script creates a toplevel window containing a Ttk
+# tree widget.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .tree
+catch {destroy $w}
+toplevel $w
+wm title $w "Directory Browser"
+wm iconname $w "tree"
+positionWindow $w
+
+## Explanatory text
+ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which allows the user to browse a hierarchical data-set such as a filesystem. The tree widget not only allows for the tree part itself, but it also supports an arbitrary number of additional columns which can show additional data (in this case, the size of the files found in your filesystem). You can also change the width of the columns by dragging the boundary between them."
+pack $w.msg -fill x
+
+## See Code / Dismiss
+pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
+
+## Code to populate the roots of the tree (can be more than one on Windows)
+proc populateRoots {tree} {
+ foreach dir [lsort -dictionary [file volumes]] {
+ populateTree $tree [$tree insert {} end -text $dir \
+ -values [list $dir directory]]
+ }
+}
+
+## Code to populate a node of the tree
+proc populateTree {tree node} {
+ if {[$tree set $node type] ne "directory"} {
+ return
+ }
+ set path [$tree set $node fullpath]
+ $tree delete [$tree children $node]
+ foreach f [lsort -dictionary [glob -nocomplain -dir $path *]] {
+ set type [file type $f]
+ set id [$tree insert $node end -text [file tail $f] \
+ -values [list $f $type]]
+
+ if {$type eq "directory"} {
+ ## Make it so that this node is openable
+ $tree insert $id 0 -text dummy ;# a dummy
+ $tree item $id -text [file tail $f]/
+
+ } elseif {$type eq "file"} {
+ set size [file size $f]
+ ## Format the file size nicely
+ if {$size >= 1024*1024*1024} {
+ set size [format %.1f\ GB [expr {$size/1024/1024/1024.}]]
+ } elseif {$size >= 1024*1024} {
+ set size [format %.1f\ MB [expr {$size/1024/1024.}]]
+ } elseif {$size >= 1024} {
+ set size [format %.1f\ kB [expr {$size/1024.}]]
+ } else {
+ append size " bytes"
+ }
+ $tree set $id size $size
+ }
+ }
+
+ # Stop this code from rerunning on the current node
+ $tree set $node type processedDirectory
+}
+
+## Create the tree and set it up
+ttk::treeview $w.tree -columns {fullpath type size} -displaycolumns {size} \
+ -yscroll "$w.vsb set" -xscroll "$w.hsb set"
+if {[tk windowingsystem] ne "aqua"} {
+ ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
+ ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
+} else {
+ scrollbar $w.vsb -orient vertical -command "$w.tree yview"
+ scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
+}
+$w.tree heading \#0 -text "Directory Structure"
+$w.tree heading size -text "File Size"
+$w.tree column size -stretch 0 -width 70
+populateRoots $w.tree
+bind $w.tree <<TreeviewOpen>> {populateTree %W [%W focus]}
+
+## Arrange the tree and its scrollbars in the toplevel
+lower [ttk::frame $w.dummy]
+pack $w.dummy -fill both -expand 1
+grid $w.tree $w.vsb -sticky nsew -in $w.dummy
+grid $w.hsb -sticky nsew -in $w.dummy
+grid columnconfigure $w.dummy 0 -weight 1
+grid rowconfigure $w.dummy 0 -weight 1
diff --git a/library/demos/ttkbut.tcl b/library/demos/ttkbut.tcl
new file mode 100644
index 0000000..66ff1d7
--- /dev/null
+++ b/library/demos/ttkbut.tcl
@@ -0,0 +1,85 @@
+# ttkbut.tcl --
+#
+# This demonstration script creates a toplevel window containing several
+# simple Ttk widgets, such as labels, labelframes, buttons, checkbuttons and
+# radiobuttons.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .ttkbut
+catch {destroy $w}
+toplevel $w
+wm title $w "Simple Ttk Widgets"
+wm iconname $w "ttkbut"
+positionWindow $w
+
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the \u201cEnabled\u201d button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons."
+pack $w.msg -side top -fill x
+
+## See Code / Dismiss
+pack [addSeeDismiss $w.seeDismiss $w {enabled cheese tomato basil oregano happyness}]\
+ -side bottom -fill x
+
+## Add buttons for setting the theme
+ttk::labelframe $w.buttons -text "Buttons"
+foreach theme [ttk::themes] {
+ ttk::button $w.buttons.$theme -text $theme \
+ -command [list ttk::setTheme $theme]
+ pack $w.buttons.$theme -pady 2
+}
+
+## Helper procedure for the top checkbutton
+proc setState {rootWidget exceptThese value} {
+ if {$rootWidget in $exceptThese} {
+ return
+ }
+ ## Non-Ttk widgets (e.g. the toplevel) will fail, so make it silent
+ catch {
+ $rootWidget state $value
+ }
+ ## Recursively invoke on all children of this root that are in the same
+ ## toplevel widget
+ foreach w [winfo children $rootWidget] {
+ if {[winfo toplevel $w] eq [winfo toplevel $rootWidget]} {
+ setState $w $exceptThese $value
+ }
+ }
+}
+
+## Set up the checkbutton group
+ttk::labelframe $w.checks -text "Checkbuttons"
+ttk::checkbutton $w.checks.e -text Enabled -variable enabled -command {
+ setState .ttkbut .ttkbut.checks.e \
+ [expr {$enabled ? "!disabled" : "disabled"}]
+}
+set enabled 1
+## See ttk_widget(n) for other possible state flags
+ttk::separator $w.checks.sep1
+ttk::checkbutton $w.checks.c1 -text Cheese -variable cheese
+ttk::checkbutton $w.checks.c2 -text Tomato -variable tomato
+ttk::separator $w.checks.sep2
+ttk::checkbutton $w.checks.c3 -text Basil -variable basil
+ttk::checkbutton $w.checks.c4 -text Oregano -variable oregano
+pack $w.checks.e $w.checks.sep1 $w.checks.c1 $w.checks.c2 $w.checks.sep2 \
+ $w.checks.c3 $w.checks.c4 -fill x -pady 2
+
+## Set up the radiobutton group
+ttk::labelframe $w.radios -text "Radiobuttons"
+ttk::radiobutton $w.radios.r1 -text "Great" -variable happyness -value great
+ttk::radiobutton $w.radios.r2 -text "Good" -variable happyness -value good
+ttk::radiobutton $w.radios.r3 -text "OK" -variable happyness -value ok
+ttk::radiobutton $w.radios.r4 -text "Poor" -variable happyness -value poor
+ttk::radiobutton $w.radios.r5 -text "Awful" -variable happyness -value awful
+pack $w.radios.r1 $w.radios.r2 $w.radios.r3 $w.radios.r4 $w.radios.r5 \
+ -fill x -padx 3 -pady 2
+
+## Arrange things neatly
+pack [ttk::frame $w.f] -fill both -expand 1
+lower $w.f
+grid $w.buttons $w.checks $w.radios -in $w.f -sticky nwe -pady 2 -padx 3
+grid columnconfigure $w.f {0 1 2} -weight 1 -uniform yes
diff --git a/library/demos/ttkmenu.tcl b/library/demos/ttkmenu.tcl
new file mode 100644
index 0000000..c01c9af
--- /dev/null
+++ b/library/demos/ttkmenu.tcl
@@ -0,0 +1,54 @@
+# ttkmenu.tcl --
+#
+# This demonstration script creates a toplevel window containing several Ttk
+# menubutton widgets.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .ttkmenu
+catch {destroy $w}
+toplevel $w
+wm title $w "Ttk Menu Buttons"
+wm iconname $w "ttkmenu"
+positionWindow $w
+
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set, and one widget that is available in themed form is the menubutton. Below are some themed menu buttons that allow you to pick the current theme in use. Notice how picking a theme changes the way that the menu buttons themselves look, and that the central menu button is styled differently (in a way that is normally suitable for toolbars). However, there are no themed menus; the standard Tk menus were judged to have a sufficiently good look-and-feel on all platforms, especially as they are implemented as native controls in many places."
+pack $w.msg [ttk::separator $w.msgSep] -side top -fill x
+
+## See Code / Dismiss
+pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
+
+ttk::menubutton $w.m1 -menu $w.m1.menu -text "Select a theme" -direction above
+ttk::menubutton $w.m2 -menu $w.m1.menu -text "Select a theme" -direction left
+ttk::menubutton $w.m3 -menu $w.m1.menu -text "Select a theme" -direction right
+ttk::menubutton $w.m4 -menu $w.m1.menu -text "Select a theme" \
+ -direction flush -style TMenubutton.Toolbutton
+ttk::menubutton $w.m5 -menu $w.m1.menu -text "Select a theme" -direction below
+
+menu $w.m1.menu -tearoff 0
+menu $w.m2.menu -tearoff 0
+menu $w.m3.menu -tearoff 0
+menu $w.m4.menu -tearoff 0
+menu $w.m5.menu -tearoff 0
+
+foreach theme [ttk::themes] {
+ $w.m1.menu add command -label $theme -command [list ttk::setTheme $theme]
+ $w.m2.menu add command -label $theme -command [list ttk::setTheme $theme]
+ $w.m3.menu add command -label $theme -command [list ttk::setTheme $theme]
+ $w.m4.menu add command -label $theme -command [list ttk::setTheme $theme]
+ $w.m5.menu add command -label $theme -command [list ttk::setTheme $theme]
+}
+
+pack [ttk::frame $w.f] -fill x
+pack [ttk::frame $w.f1] -fill both -expand yes
+lower $w.f
+
+grid anchor $w.f center
+grid x $w.m1 x -in $w.f -padx 3 -pady 2
+grid $w.m2 $w.m4 $w.m3 -in $w.f -padx 3 -pady 2
+grid x $w.m5 x -in $w.f -padx 3 -pady 2
diff --git a/library/demos/ttknote.tcl b/library/demos/ttknote.tcl
new file mode 100644
index 0000000..5683892
--- /dev/null
+++ b/library/demos/ttknote.tcl
@@ -0,0 +1,62 @@
+# ttknote.tcl --
+#
+# This demonstration script creates a toplevel window containing a Ttk
+# notebook widget.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .ttknote
+catch {destroy $w}
+toplevel $w
+wm title $w "Ttk Notebook Widget"
+wm iconname $w "ttknote"
+positionWindow $w
+
+## See Code / Dismiss
+pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
+
+ttk::frame $w.f
+pack $w.f -fill both -expand 1
+set w $w.f
+
+## Make the notebook and set up Ctrl+Tab traversal
+ttk::notebook $w.note
+pack $w.note -fill both -expand 1 -padx 2 -pady 3
+ttk::notebook::enableTraversal $w.note
+
+## Popuplate the first pane
+ttk::frame $w.note.msg
+ttk::label $w.note.msg.m -font $font -wraplength 4i -justify left -anchor n -text "Ttk is the new Tk themed widget set. One of the widgets it includes is the notebook widget, which provides a set of tabs that allow the selection of a group of panels, each with distinct content. They are a feature of many modern user interfaces. Not only can the tabs be selected with the mouse, but they can also be switched between using Ctrl+Tab when the notebook page heading itself is selected. Note that the second tab is disabled, and cannot be selected."
+ttk::button $w.note.msg.b -text "Neat!" -underline 0 -command {
+ set neat "Yeah, I know..."
+ after 500 {set neat {}}
+}
+bind $w <Alt-n> "focus $w.note.msg.b; $w.note.msg.b invoke"
+ttk::label $w.note.msg.l -textvariable neat
+$w.note add $w.note.msg -text "Description" -underline 0 -padding 2
+grid $w.note.msg.m - -sticky new -pady 2
+grid $w.note.msg.b $w.note.msg.l -pady {2 4}
+grid rowconfigure $w.note.msg 1 -weight 1
+grid columnconfigure $w.note.msg {0 1} -weight 1 -uniform 1
+
+## Populate the second pane. Note that the content doesn't really matter
+ttk::frame $w.note.disabled
+$w.note add $w.note.disabled -text "Disabled" -state disabled
+
+## Popuplate the third pane
+ttk::frame $w.note.editor
+$w.note add $w.note.editor -text "Text Editor" -underline 0
+text $w.note.editor.t -width 40 -height 10 -wrap char \
+ -yscroll "$w.note.editor.s set"
+if {[tk windowingsystem] ne "aqua"} {
+ ttk::scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
+} else {
+ scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
+}
+pack $w.note.editor.s -side right -fill y -padx {0 2} -pady 2
+pack $w.note.editor.t -fill both -expand 1 -pady 2 -padx {2 0}
diff --git a/library/demos/ttkpane.tcl b/library/demos/ttkpane.tcl
new file mode 100644
index 0000000..a4d5738
--- /dev/null
+++ b/library/demos/ttkpane.tcl
@@ -0,0 +1,107 @@
+# ttkpane.tcl --
+#
+# This demonstration script creates a Ttk pane with some content.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .ttkpane
+catch {destroy $w}
+toplevel $w
+wm title $w "Themed Nested Panes"
+wm iconname $w "ttkpane"
+positionWindow $w
+
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows off a nested set of themed paned windows. Their sizes can be changed by grabbing the area between each contained pane and dragging the divider."
+pack $w.msg [ttk::separator $w.msgSep] -side top -fill x
+
+## See Code / Dismiss
+pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
+
+ttk::frame $w.f
+pack $w.f -fill both -expand 1
+set w $w.f
+ttk::panedwindow $w.outer -orient horizontal
+$w.outer add [ttk::panedwindow $w.outer.inLeft -orient vertical]
+$w.outer add [ttk::panedwindow $w.outer.inRight -orient vertical]
+$w.outer.inLeft add [ttk::labelframe $w.outer.inLeft.top -text Button]
+$w.outer.inLeft add [ttk::labelframe $w.outer.inLeft.bot -text Clocks]
+$w.outer.inRight add [ttk::labelframe $w.outer.inRight.top -text Progress]
+$w.outer.inRight add [ttk::labelframe $w.outer.inRight.bot -text Text]
+if {[tk windowingsystem] eq "aqua"} {
+ foreach i [list inLeft.top inLeft.bot inRight.top inRight.bot] {
+ $w.outer.$i configure -padding 3
+ }
+}
+
+# Fill the button pane
+ttk::button $w.outer.inLeft.top.b -text "Press Me" -command {
+ tk_messageBox -type ok -icon info -message "Ouch!" -detail "That hurt..." \
+ -parent .ttkpane -title "Button Pressed"
+}
+pack $w.outer.inLeft.top.b -padx 2 -pady 5
+
+# Fill the clocks pane
+set i 0
+proc every {delay script} {
+ uplevel #0 $script
+ after $delay [list every $delay $script]
+}
+set zones {
+ :Europe/Berlin
+ :America/Argentina/Buenos_Aires
+ :Africa/Johannesburg
+ :Europe/London
+ :America/Los_Angeles
+ :Europe/Moscow
+ :America/New_York
+ :Asia/Singapore
+ :Australia/Sydney
+ :Asia/Tokyo
+}
+# Force a pre-load of all the timezones needed; otherwise can end up
+# poor-looking synch problems!
+foreach zone $zones {clock format 0 -timezone $zone}
+foreach zone $zones {
+ set city [string map {_ " "} [regexp -inline {[^/]+$} $zone]]
+ if {$i} {
+ pack [ttk::separator $w.outer.inLeft.bot.s$i] -fill x
+ }
+ ttk::label $w.outer.inLeft.bot.l$i -text $city -anchor w
+ ttk::label $w.outer.inLeft.bot.t$i -textvariable time($zone) -anchor w
+ pack $w.outer.inLeft.bot.l$i $w.outer.inLeft.bot.t$i -fill x
+ every 1000 "set time($zone) \[clock format \[clock seconds\] -timezone $zone -format %T\]"
+ incr i
+}
+
+# Fill the progress pane
+ttk::progressbar $w.outer.inRight.top.progress -mode indeterminate
+pack $w.outer.inRight.top.progress -fill both -expand 1
+$w.outer.inRight.top.progress start
+
+# Fill the text pane
+if {[tk windowingsystem] ne "aqua"} {
+ # The trick with the ttk::frame makes the text widget look like it fits with
+ # the current Ttk theme despite not being a themed widget itself. It is done
+ # by styling the frame like an entry, turning off the border in the text
+ # widget, and putting the text widget in the frame with enough space to allow
+ # the surrounding border to show through (2 pixels seems to be enough).
+ ttk::frame $w.outer.inRight.bot.f -style TEntry
+ text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0
+ pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot.f -pady 2 -padx 2
+ ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview"
+ pack $w.sb -side right -fill y -in $w.outer.inRight.bot
+ pack $w.outer.inRight.bot.f -fill both -expand 1
+ pack $w.outer -fill both -expand 1
+} else {
+ text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0
+ scrollbar $w.sb -orient vertical -command "$w.txt yview"
+ pack $w.sb -side right -fill y -in $w.outer.inRight.bot
+ pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot
+ pack $w.outer -fill both -expand 1 -padx 10 -pady {6 10}
+}
+
diff --git a/library/demos/ttkprogress.tcl b/library/demos/ttkprogress.tcl
new file mode 100644
index 0000000..87765d7
--- /dev/null
+++ b/library/demos/ttkprogress.tcl
@@ -0,0 +1,47 @@
+# ttkprogress.tcl --
+#
+# This demonstration script creates several progress bar widgets.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+package require Ttk
+
+set w .ttkprogress
+catch {destroy $w}
+toplevel $w
+wm title $w "Progress Bar Demonstration"
+wm iconname $w "ttkprogress"
+positionWindow $w
+
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a \u201Cdeterminate\u201D progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an \u201Cindeterminate\u201D progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
+pack $w.msg -side top -fill x
+
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
+
+ttk::frame $w.f
+pack $w.f -fill both -expand 1
+set w $w.f
+
+proc doBars {op args} {
+ foreach w $args {
+ $w $op
+ }
+}
+ttk::progressbar $w.p1 -mode determinate
+ttk::progressbar $w.p2 -mode indeterminate
+ttk::button $w.start -text "Start Progress" -command [list \
+ doBars start $w.p1 $w.p2]
+ttk::button $w.stop -text "Stop Progress" -command [list \
+ doBars stop $w.p1 $w.p2]
+
+grid $w.p1 - -pady 5 -padx 10
+grid $w.p2 - -pady 5 -padx 10
+grid $w.start $w.stop -padx 10 -pady 5
+grid configure $w.start -sticky e
+grid configure $w.stop -sticky w
+grid columnconfigure $w all -weight 1
diff --git a/library/demos/ttkscale.tcl b/library/demos/ttkscale.tcl
new file mode 100644
index 0000000..1a95416
--- /dev/null
+++ b/library/demos/ttkscale.tcl
@@ -0,0 +1,39 @@
+# ttkscale.tcl --
+#
+# This demonstration script shows an example with a horizontal scale.
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+
+set w .ttkscale
+catch {destroy $w}
+toplevel $w -bg [ttk::style lookup TLabel -background]
+wm title $w "Themed Scale Demonstration"
+wm iconname $w "ttkscale"
+positionWindow $w
+
+pack [ttk::frame [set w $w.contents]] -fill both -expand 1
+
+ttk::label $w.msg -font $font -wraplength 3.5i -justify left -text "A label tied to a horizontal scale is displayed below. If you click or drag mouse button 1 in the scale, you can change the contents of the label; a callback command is used to couple the slider to both the text and the coloring of the label."
+pack $w.msg -side top -padx .5c
+
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons [winfo toplevel $w]]
+pack $btns -side bottom -fill x
+
+ttk::frame $w.frame -borderwidth 10
+pack $w.frame -side top -fill x
+
+# List of colors from rainbox; "Indigo" is not a standard color
+set colorList {Red Orange Yellow Green Blue Violet}
+ttk::label $w.frame.label
+ttk::scale $w.frame.scale -from 0 -to 5 -command [list apply {{w idx} {
+ set c [lindex $::colorList [tcl::mathfunc::int $idx]]
+ $w.frame.label configure -foreground $c -text "Color: $c"
+}} $w]
+# Trigger the setting of the label's text
+$w.frame.scale set 0
+pack $w.frame.label $w.frame.scale
diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl
index 7f5b9b7..e1d0b5b 100644
--- a/library/demos/twind.tcl
+++ b/library/demos/twind.tcl
@@ -7,27 +7,32 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .twind
catch {destroy $w}
toplevel $w
-wm title $w "Text Demonstration - Embedded Windows"
+wm title $w "Text Demonstration - Embedded Windows and Other Features"
wm iconname $w "Embedded Windows"
positionWindow $w
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
-frame $w.f -highlightthickness 2 -borderwidth 2 -relief sunken
+frame $w.f -highlightthickness 1 -borderwidth 1 -relief sunken
set t $w.f.text
text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font -width 70 \
-height 35 -wrap word -highlightthickness 0 -borderwidth 0
pack $t -expand yes -fill both
scrollbar $w.scroll -command "$t yview"
pack $w.scroll -side right -fill y
-pack $w.f -expand yes -fill both
+panedwindow $w.pane
+pack $w.pane -expand yes -fill both
+$w.pane add $w.f
+# Import to raise given creation order above
+raise $w.f
+
$t tag configure center -justify center -spacing1 5m -spacing3 5m
$t tag configure buttons -lmargin1 1c -lmargin2 1c -rmargin 1c \
-spacing1 3m -spacing2 0 -spacing3 0
@@ -36,10 +41,12 @@ button $t.on -text "Turn On" -command "textWindOn $w" \
-cursor top_left_arrow
button $t.off -text "Turn Off" -command "textWindOff $w" \
-cursor top_left_arrow
-button $t.click -text "Click Here" -command "textWindPlot $t" \
- -cursor top_left_arrow
-button $t.delete -text "Delete" -command "textWindDel $w" \
- -cursor top_left_arrow
+
+$t insert end "A text widget can contain many different kinds of items, "
+$t insert end "both active and passive. It can lay these out in various "
+$t insert end "ways, with wrapping, tabs, centering, etc. In addition, "
+$t insert end "when the contents are too big for the window, smooth "
+$t insert end "scrolling in all directions is provided.\n\n"
$t insert end "A text widget can contain other widgets embedded "
$t insert end "it. These are called \"embedded windows\", "
@@ -54,15 +61,44 @@ $t window create end -window $t.off
$t insert end " horizontal scrolling and turn back on word wrapping.\n\n"
$t insert end "Or, here is another example. If you "
-$t window create end -window $t.click
+$t window create end -create {
+ button %W.click -text "Click Here" -command "textWindPlot %W" \
+ -cursor top_left_arrow}
+
$t insert end " a canvas displaying an x-y plot will appear right here."
$t mark set plot insert
$t mark gravity plot left
$t insert end " You can drag the data points around with the mouse, "
$t insert end "or you can click here to "
-$t window create end -window $t.delete
+$t window create end -create {
+ button %W.delete -text "Delete" -command "textWindDel %W" \
+ -cursor top_left_arrow
+}
$t insert end " the plot again.\n\n"
+$t insert end "You can also create multiple text widgets each of which "
+$t insert end "display the same underlying text. Click this button to "
+$t window create end \
+ -create {button %W.peer -text "Make A Peer" -command "textMakePeer %W" \
+ -cursor top_left_arrow} -padx 3
+$t insert end " widget. Notice how peer widgets can have different "
+$t insert end "font settings, and by default contain all the images "
+$t insert end "of the 'parent', but many of the embedded windows, "
+$t insert end "such as buttons will not be there. The easiest way "
+$t insert end "to ensure they are in all peers is to use '-create' "
+$t insert end "embedded window creation scripts "
+$t insert end "(the plot above and the 'Make A Peer' button are "
+$t insert end "designed to show up in all peers). A good use of "
+$t insert end "peers is for "
+$t window create end \
+ -create {button %W.split -text "Split Windows" -command "textSplitWindow %W" \
+ -cursor top_left_arrow} -padx 3
+$t insert end " \n\n"
+
+$t insert end "Users of previous versions of Tk will also be interested "
+$t insert end "to note that now cursor movement is now by visual line by "
+$t insert end "default, and that all scrolling of this widget is by pixel.\n\n"
+
$t insert end "You may also find it useful to put embedded windows in "
$t insert end "a text without any actual text. In this case the "
$t insert end "text widget acts like a geometry manager. For "
@@ -97,6 +133,63 @@ foreach color {AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
}
$t tag add buttons $t.default end
+button $t.bigB -text "Big borders" -command "textWindBigB $t" \
+ -cursor top_left_arrow
+button $t.smallB -text "Small borders" -command "textWindSmallB $t" \
+ -cursor top_left_arrow
+button $t.bigH -text "Big highlight" -command "textWindBigH $t" \
+ -cursor top_left_arrow
+button $t.smallH -text "Small highlight" -command "textWindSmallH $t" \
+ -cursor top_left_arrow
+button $t.bigP -text "Big pad" -command "textWindBigP $t" \
+ -cursor top_left_arrow
+button $t.smallP -text "Small pad" -command "textWindSmallP $t" \
+ -cursor top_left_arrow
+
+set text_normal(border) [$t cget -borderwidth]
+set text_normal(highlight) [$t cget -highlightthickness]
+set text_normal(pad) [$t cget -padx]
+
+$t insert end "\nYou can also change the usual border width and "
+$t insert end "highlightthickness and padding.\n"
+$t window create end -window $t.bigB
+$t window create end -window $t.smallB
+$t window create end -window $t.bigH
+$t window create end -window $t.smallH
+$t window create end -window $t.bigP
+$t window create end -window $t.smallP
+
+$t insert end "\n\nFinally, images fit comfortably in text widgets too:"
+
+$t image create end -image \
+ [image create bitmap -file [file join $tk_demoDirectory images face.xbm]]
+
+
+proc textWindBigB w {
+ $w configure -borderwidth 15
+}
+
+proc textWindBigH w {
+ $w configure -highlightthickness 15
+}
+
+proc textWindBigP w {
+ $w configure -padx 15 -pady 15
+}
+
+proc textWindSmallB w {
+ $w configure -borderwidth $::text_normal(border)
+}
+
+proc textWindSmallH w {
+ $w configure -highlightthickness $::text_normal(highlight)
+}
+
+proc textWindSmallP w {
+ $w configure -padx $::text_normal(pad) -pady $::text_normal(pad)
+}
+
+
proc textWindOn w {
catch {destroy $w.scroll2}
set t $w.f.text
@@ -116,6 +209,20 @@ proc textWindPlot t {
if {[winfo exists $c]} {
return
}
+
+ while {[string first [$t get plot] " \t\n"] >= 0} {
+ $t delete plot
+ }
+ $t insert plot "\n"
+
+ $t window create plot -create {createPlot %W}
+ $t tag add center plot
+ $t insert plot "\n"
+}
+
+proc createPlot {t} {
+ set c $t.c
+
canvas $c -relief sunken -width 450 -height 300 -cursor top_left_arrow
set font {Helvetica 18}
@@ -151,13 +258,7 @@ proc textWindPlot t {
$c bind point <1> "embPlotDown $c %x %y"
$c bind point <ButtonRelease-1> "$c dtag selected"
bind $c <B1-Motion> "embPlotMove $c %x %y"
- while {[string first [$t get plot] " \t\n"] >= 0} {
- $t delete plot
- }
- $t insert plot "\n"
- $t window create plot -window $c
- $t tag add center plot
- $t insert plot "\n"
+ return $c
}
set embPlot(lastX) 0
@@ -179,8 +280,7 @@ proc embPlotMove {w x y} {
set embPlot(lastY) $y
}
-proc textWindDel w {
- set t $w.f.text
+proc textWindDel t {
if {[winfo exists $t.c]} {
$t delete $t.c
while {[string first [$t get plot] " \t\n"] >= 0} {
@@ -193,3 +293,33 @@ proc textWindDel w {
proc embDefBg t {
$t configure -background [lindex [$t configure -background] 3]
}
+
+proc textMakePeer {parent} {
+ set n 1
+ while {[winfo exists .peer$n]} { incr n }
+ set w [toplevel .peer$n]
+ wm title $w "Text Peer #$n"
+ frame $w.f -highlightthickness 1 -borderwidth 1 -relief sunken
+ set t [$parent peer create $w.f.text -yscrollcommand "$w.scroll set" \
+ -borderwidth 0 -highlightthickness 0]
+ pack $t -expand yes -fill both
+ scrollbar $w.scroll -command "$t yview"
+ pack $w.scroll -side right -fill y
+ pack $w.f -expand yes -fill both
+}
+
+proc textSplitWindow {textW} {
+ if {$textW eq ".twind.f.text"} {
+ if {[winfo exists .twind.peer]} {
+ destroy .twind.peer
+ } else {
+ set parent [winfo parent $textW]
+ set w [winfo parent $parent]
+ set t [$textW peer create $w.peer \
+ -yscrollcommand "$w.scroll set"]
+ $w.pane add $t
+ }
+ } else {
+ return
+ }
+}
diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl
index ec0b7d0..11cc933 100644
--- a/library/demos/unicodeout.tcl
+++ b/library/demos/unicodeout.tcl
@@ -7,6 +7,28 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
+# On Windows, we need to determine whether the font system will render
+# right-to-left text.
+
+if {[tk windowingsystem] eq {win32}} {
+ set rkey [join {
+ HKEY_LOCAL_MACHINE
+ SOFTWARE
+ Microsoft
+ {Windows NT}
+ CurrentVersion
+ LanguagePack
+ } \\]
+ set w32langs {}
+ if {![catch {package require registry}]} {
+ if {[catch {registry values $rkey} w32langs]} {
+ set w32langs {}
+ }
+ }
+}
+
set w .unicodeout
catch {destroy $w}
toplevel $w
@@ -14,7 +36,7 @@ wm title $w "Unicode Label Demonstration"
wm iconname $w "unicodeout"
positionWindow $w
-label $w.msg -font $font -wraplength 4i -justify left \
+label $w.msg -font $font -wraplength 4i -anchor w -justify left \
-text "This is a sample of Tk's support for languages that use\
non-Western character sets. However, what you will actually see\
below depends largely on what character sets you have installed,\
@@ -24,11 +46,9 @@ label $w.msg -font $font -wraplength 4i -justify left \
portable fashion."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
pack [label $w.wait -text "Please wait while loading fonts..." \
-font {Helvetica 12 italic}]
@@ -53,17 +73,35 @@ set oldCursor [$w cget -cursor]
$w conf -cursor watch
update
-addSample $w Arabic \
- "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94" \
- "\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
+if {[tk windowingsystem] eq {x11}
+ || (([tk windowingsystem] eq {win32}) && ({ARABIC} ni $w32langs))} {
+ # Using presentation forms (pre-layouted)
+ addSample $w Arabic \
+ "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \
+ "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
+} else {
+ # Using standard text characters
+ addSample $w Arabic \
+ "\u0627\u0644\u0643\u0644\u0645\u0629 " \
+ "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
+}
addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
addSample $w "Simpl. Chinese" "\u6C49\u8BED"
addSample $w Greek \
"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
"\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
-addSample $w Hebrew \
- "\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 " \
- "\u05DC\u05D9\u05D0\u05E8\u05E9\u05D9"
+if {[tk windowingsystem] eq {x11}
+ || (([tk windowingsystem] eq {win32}) && ({HEBREW} ni $w32langs))} {
+ # Visual order (pre-layouted)
+ addSample $w Hebrew \
+ "\u05EA\u05D9\u05E8\u05D1\u05E2 " \
+ "\u05D1\u05EA\u05DB"
+} else {
+ # Standard logical order
+ addSample $w Hebrew \
+ "\u05DB\u05EA\u05D1 " \
+ "\u05E2\u05D1\u05E8\u05D9\u05EA"
+}
addSample $w Japanese \
"\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
"\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
diff --git a/library/demos/vscale.tcl b/library/demos/vscale.tcl
index b04201d..2c7ea76 100644
--- a/library/demos/vscale.tcl
+++ b/library/demos/vscale.tcl
@@ -6,6 +6,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
set w .vscale
catch {destroy $w}
toplevel $w
@@ -16,11 +18,9 @@ positionWindow $w
label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a vertical scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the size of the arrow."
pack $w.msg -side top -padx .5c
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
frame $w.frame -borderwidth 10
pack $w.frame
diff --git a/library/demos/widget b/library/demos/widget
index d4ec511..d58f086 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -3,99 +3,180 @@
exec wish "$0" ${1+"$@"}
# widget --
-# This script demonstrates the various widgets provided by Tk,
-# along with many of the features of the Tk toolkit. This file
-# only contains code to generate the main window for the
-# application, which invokes individual demonstrations. The
-# code for the actual demonstrations is contained in separate
-# ".tcl" files is this directory, which are sourced by this script
-# as needed.
+# This script demonstrates the various widgets provided by Tk, along with many
+# of the features of the Tk toolkit. This file only contains code to generate
+# the main window for the application, which invokes individual
+# demonstrations. The code for the actual demonstrations is contained in
+# separate ".tcl" files is this directory, which are sourced by this script as
+# needed.
+
+package require Tcl 8.5
+package require Tk 8.5
+package require msgcat
+package require Ttk
eval destroy [winfo child .]
-wm title . "Widget Demonstration"
+set tk_demoDirectory [file join [pwd] [file dirname [info script]]]
+::msgcat::mcload $tk_demoDirectory
+namespace import ::msgcat::mc
+wm title . [mc "Widget Demonstration"]
if {[tk windowingsystem] eq "x11"} {
- # This won't work everywhere, but there's no other way in core Tk
- # at the moment to display a coloured icon.
+ # This won't work everywhere, but there's no other way in core Tk at the
+ # moment to display a coloured icon.
image create photo TclPowered \
-file [file join $tk_library images logo64.gif]
wm iconwindow . [toplevel ._iconWindow]
pack [label ._iconWindow.i -image TclPowered]
- wm iconname . "tkWidgetDemo"
+ wm iconname . [mc "tkWidgetDemo"]
}
-array set widgetFont {
- main {Helvetica 12}
- bold {Helvetica 12 bold}
- title {Helvetica 18 bold}
- status {Helvetica 10}
- vars {Helvetica 14}
+if {"defaultFont" ni [font names]} {
+ # TIP #145 defines some standard named fonts
+ if {"TkDefaultFont" in [font names] && "TkFixedFont" in [font names]} {
+ # FIX ME: the following technique of cloning the font to copy it works
+ # fine but means that if the system font is changed by Tk
+ # cannot update the copied font. font alias might be useful
+ # here -- or fix the app to use TkDefaultFont etc.
+ font create mainFont {*}[font configure TkDefaultFont]
+ font create fixedFont {*}[font configure TkFixedFont]
+ font create boldFont {*}[font configure TkDefaultFont] -weight bold
+ font create titleFont {*}[font configure TkDefaultFont] -weight bold
+ font create statusFont {*}[font configure TkDefaultFont]
+ font create varsFont {*}[font configure TkDefaultFont]
+ if {[tk windowingsystem] eq "aqua"} {
+ font configure titleFont -size 17
+ }
+ } else {
+ font create mainFont -family Helvetica -size 12
+ font create fixedFont -family Courier -size 10
+ font create boldFont -family Helvetica -size 12 -weight bold
+ font create titleFont -family Helvetica -size 18 -weight bold
+ font create statusFont -family Helvetica -size 10
+ font create varsFont -family Helvetica -size 14
+ }
}
set widgetDemo 1
-set font $widgetFont(main)
+set font mainFont
+
+image create photo ::img::refresh -format GIF -data {
+ R0lGODlhEAAQAJEDAP///wAAACpnKv///yH5BAEAAAMALAAAAAAQABAAAAI63IKp
+ xgcPH2ouwgBCw1HIxHCQ4F3hSJKmwZXqWrmWxj7lKJ2dndcon9EBUq+gz3brVXAR
+ 2tICU0gXBQA7
+}
+
+image create photo ::img::view -format GIF -data {
+ R0lGODlhEAAQAKIHAP///wwMDAAAAMDAwNnZ2SYmJmZmZv///yH5BAEAAAcALAAA
+ AAAQABAAAANMKLos90+ASamDRxJCgw9YVnlDOXiQBgRDBRgHKE6sW8QR3doPKK27
+ yg33q/GIOhdg6OsEJzeZykiBSUcs06e56Xx6np8ScIkFGuhQAgA7
+}
+
+image create photo ::img::delete -format GIF -data {
+ R0lGODlhEAAQAIABAIQAAP///yH5BAEAAAEALAAAAAAQABAAAAIjjI+pmwAc3HGy
+ PUSvqYpuvWQg40FfSVacBa5nN6JYDI3mzRQAOw==
+}
+
+image create photo ::img::print -format GIF -data {
+ R0lGODlhEAAQALMKAAAAAP///52VunNkl8C82Yl+qldBgq+pyrOzs1fYAP///wAA
+ AAAAAAAAAAAAAAAAACH5BAEAAAoALAAAAAAQABAAAARGUMlJKwU4AztB+ODGeUiJ
+ fGLlgeEYmGWQXmx7aXgmAUTv/74N4EAsGhOJg1DAbDqbwoJ0Sp0KB9isNis0eL/g
+ ryhH5pgnEQA7
+}
+
+# Note that this is run through the message catalog! This is because this is
+# actually an image of a word.
+image create photo ::img::new -format GIF -data [mc {
+ R0lGODlhHgAOALMPALMAANyIiOu7u8dEROaqqvru7sxVVeGZmbgREfXd3b0iItZ3
+ d8IzM9FmZvDMzP///yH5BAEAAA8ALAAAAAAeAA4AAASa8MlJq7046827WVOCHEkw
+ nANhUgJlEBIABJIwL3K+4IcUALCHjfbItYZDSgJgkBiYPmBMAUAkkLPKs/BAyLgM
+ wAQwOAAY2ByCaw4QAFQSoDEePJ6DmU1xInYZTw5nOEFFdgVUelkVDTIMd3AKFGQ1
+ MgI2AwEmQW8APZ0gdRONAks5nhIFVVxdAAkUAS2pAVwFl7ITB4UqHb0XEQA7
+}]
#----------------------------------------------------------------
-# The code below create the main window, consisting of a menu bar
-# and a text widget that explains how to use the program, plus lists
-# all of the demos as hypertext items.
+# The code below create the main window, consisting of a menu bar and a text
+# widget that explains how to use the program, plus lists all of the demos as
+# hypertext items.
#----------------------------------------------------------------
menu .menuBar -tearoff 0
-if {[tk windowingsystem] ne "classic" && [tk windowingsystem] ne "aqua"} {
- .menuBar add cascade -menu .menuBar.file -label "File" -underline 0
+if {[tk windowingsystem] ne "aqua"} {
+ # This is a tk-internal procedure to make i18n easier
+ ::tk::AmpMenuArgs .menuBar add cascade -label [mc "&File"] \
+ -menu .menuBar.file
menu .menuBar.file -tearoff 0
- .menuBar.file add command -label "About..." -command "tkAboutDialog" \
- -underline 0 -accelerator "<F1>"
+ ::tk::AmpMenuArgs .menuBar.file add command -label [mc "&About..."] \
+ -command {tkAboutDialog} -accelerator [mc "<F1>"]
+ bind . <F1> {tkAboutDialog}
.menuBar.file add sep
- .menuBar.file add command -label "Quit" -command "exit" -underline 0 \
- -accelerator "Meta-Q"
- bind . <F1> tkAboutDialog
+ if {[string match win* [tk windowingsystem]]} {
+ # Windows doesn't usually have a Meta key
+ ::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
+ -command {exit} -accelerator [mc "Ctrl+Q"]
+ bind . <[mc "Control-q"]> {exit}
+ } else {
+ ::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
+ -command {exit} -accelerator [mc "Meta-Q"]
+ bind . <[mc "Meta-q"]> {exit}
+ }
}
. configure -menu .menuBar
-frame .statusBar
-label .statusBar.lab -text " " -relief sunken -bd 1 \
- -font $widgetFont(status) -anchor w
-label .statusBar.foo -width 8 -relief sunken -bd 1 \
- -font $widgetFont(status) -anchor w
+ttk::frame .statusBar
+ttk::label .statusBar.lab -text " " -anchor w
+if {[tk windowingsystem] eq "aqua"} {
+ ttk::separator .statusBar.sep
+ pack .statusBar.sep -side top -expand yes -fill x -pady 0
+}
pack .statusBar.lab -side left -padx 2 -expand yes -fill both
-pack .statusBar.foo -side left -padx 2
+if {[tk windowingsystem] ne "aqua"} {
+ ttk::sizegrip .statusBar.foo
+ pack .statusBar.foo -side left -padx 2
+}
pack .statusBar -side bottom -fill x -pady 2
set textheight 30
catch {
set textheight [expr {
- ([winfo screenheight .] - 200) /
- [font metrics $widgetFont(main) -displayof . -linespace]
+ ([winfo screenheight .] * 0.7) /
+ [font metrics mainFont -displayof . -linespace]
}]
}
-frame .textFrame
-scrollbar .s -orient vertical -command {.t yview} -highlightthickness 0 \
- -takefocus 1
+ttk::frame .textFrame
+scrollbar .s -orient vertical -command {.t yview} -takefocus 1
pack .s -in .textFrame -side right -fill y
-text .t -yscrollcommand {.s set} -wrap word -width 70 -height $textheight \
- -font $widgetFont(main) -setgrid 1 -highlightthickness 0 \
- -padx 4 -pady 2 -takefocus 0
+text .t -yscrollcommand {.s set} -wrap word -width 70 -height $textheight \
+ -font mainFont -setgrid 1 -highlightthickness 0 \
+ -padx 4 -pady 2 -takefocus 0
pack .t -in .textFrame -expand y -fill both -padx 1
-pack .textFrame -expand yes -fill both
+pack .textFrame -expand yes -fill both
+if {[tk windowingsystem] eq "aqua"} {
+ pack configure .statusBar.lab -padx {10 18} -pady {4 6}
+ pack configure .statusBar -pady 0
+ .t configure -padx 10 -pady 0
+}
-# Create a bunch of tags to use in the text widget, such as those for
-# section titles and demo descriptions. Also define the bindings for
-# tags.
+# Create a bunch of tags to use in the text widget, such as those for section
+# titles and demo descriptions. Also define the bindings for tags.
-.t tag configure title -font $widgetFont(title)
-.t tag configure bold -font $widgetFont(bold)
+.t tag configure title -font titleFont
+.t tag configure subtitle -font titleFont
+.t tag configure bold -font boldFont
+if {[tk windowingsystem] eq "aqua"} {
+ .t tag configure title -spacing1 8
+ .t tag configure subtitle -spacing3 3
+}
-# We put some "space" characters to the left and right of each demo description
-# so that the descriptions are highlighted only when the mouse cursor
-# is right over them (but not when the cursor is to their left or right)
+# We put some "space" characters to the left and right of each demo
+# description so that the descriptions are highlighted only when the mouse
+# cursor is right over them (but not when the cursor is to their left or
+# right).
#
.t tag configure demospace -lmargin1 1c -lmargin2 1c
-
if {[winfo depth .] == 1} {
.t tag configure demo -lmargin1 1c -lmargin2 1c \
-underline 1
@@ -116,17 +197,17 @@ set lastLine ""
.t tag bind demo <Enter> {
set lastLine [.t index {@%x,%y linestart}]
.t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars"
- .t config -cursor hand2
+ .t config -cursor [::ttk::cursor link]
showStatus [.t index {@%x,%y}]
}
.t tag bind demo <Leave> {
.t tag remove hot 1.0 end
- .t config -cursor xterm
+ .t config -cursor [::ttk::cursor text]
.statusBar.lab config -text ""
}
.t tag bind demo <Motion> {
set newLine [.t index {@%x,%y linestart}]
- if {[string compare $newLine $lastLine] != 0} {
+ if {$newLine ne $lastLine} {
.t tag remove hot 1.0 end
set lastLine $newLine
@@ -138,97 +219,239 @@ set lastLine ""
}
showStatus [.t index {@%x,%y}]
}
-
+
+##############################################################################
# Create the text for the text widget.
-proc addDemoSection {title demos} {
- .t insert end "\n" {} $title title " \n " demospace
- set num 0
- foreach {name description} $demos {
- .t insert end "[incr num]. $description." [list demo demo-$name]
- .t insert end " \n " demospace
+# addFormattedText --
+#
+# Add formatted text (but not hypertext) to the text widget after first
+# passing it through the message catalog to allow for localization.
+# Lines starting with @@ are formatting directives (insert title, insert
+# demo hyperlink, begin newline, or change style) and all other lines
+# are literal strings to be inserted. Substitutions are performed,
+# allowing processing pieces through the message catalog. Blank lines
+# are ignored.
+#
+proc addFormattedText {formattedText} {
+ set style normal
+ set isNL 1
+ set demoCount 0
+ set new 0
+ foreach line [split $formattedText \n] {
+ set line [string trim $line]
+ if {$line eq ""} {
+ continue
+ }
+ if {[string match @@* $line]} {
+ set data [string range $line 2 end]
+ set key [lindex $data 0]
+ set values [lrange $data 1 end]
+ switch -exact -- $key {
+ title {
+ .t insert end [mc $values]\n title \n normal
+ }
+ newline {
+ .t insert end \n $style
+ set isNL 1
+ }
+ subtitle {
+ .t insert end "\n" {} [mc $values] subtitle \
+ " \n " demospace
+ set demoCount 0
+ }
+ demo {
+ set description [lassign $values name]
+ .t insert end "[incr demoCount]. [mc $description]" \
+ [list demo demo-$name]
+ if {$new} {
+ .t image create end -image ::img::new -padx 5
+ set new 0
+ }
+ .t insert end " \n " demospace
+ }
+ new {
+ set new 1
+ }
+ default {
+ set style $key
+ }
+ }
+ continue
+ }
+ if {!$isNL} {
+ .t insert end " " $style
+ }
+ set isNL 0
+ .t insert end [mc $line] $style
}
}
-.t insert end "Tk Widget Demonstrations\n" title
-.t insert end "\nThis application provides a front end for several short\
- scripts that demonstrate what you can do with Tk widgets. Each of\
- the numbered lines below describes a demonstration; you can click\
- on it to invoke the demonstration. Once the demonstration window\
- appears, you can click the " {} "See Code" bold " button to see the\
- Tcl/Tk code that created the demonstration. If you wish, you can\
- edit the code and click the " {} "Rerun Demo" bold " button in the\
- code window to reinvoke the demonstration with the modified code.\n"
-
-addDemoSection "Labels, buttons, checkbuttons, and radiobuttons" {
- label "Labels (text and bitmaps)"
- unicodeout "Labels and UNICODE text"
- button "Buttons"
- check "Check-buttons (select any of a group)"
- radio "Radio-buttons (select one of a group)"
- puzzle "A 15-puzzle game made out of buttons"
- icon "Iconic buttons that use bitmaps"
- image1 "Two labels displaying images"
- image2 "A simple user interface for viewing images"
- labelframe "Labelled frames"
-}
-addDemoSection "Listboxes" {
- states "The 50 states"
- colors "Colors: change the color scheme for the application"
- sayings "A collection of famous and infamous sayings"
-}
-addDemoSection "Entries and Spin-boxes" {
- entry1 "Entries without scrollbars"
- entry2 "Entries with scrollbars"
- entry3 "Validated entries and password fields"
- spin "Spin-boxes"
- form "Simple Rolodex-like form"
-}
-addDemoSection "Text" {
- text "Basic editable text"
- style "Text display styles"
- bind "Hypertext (tag bindings)"
- twind "A text widget with embedded windows"
- search "A search tool built with a text widget"
-}
-addDemoSection "Canvases" {
- items "The canvas item types"
- plot "A simple 2-D plot"
- ctext "Text items in canvases"
- arrow "An editor for arrowheads on canvas lines"
- ruler "A ruler with adjustable tab stops"
- floor "A building floor plan"
- cscroll "A simple scrollable canvas"
-}
-addDemoSection "Scales" {
- hscale "Horizontal scale"
- vscale "Vertical scale"
-}
-addDemoSection "Paned Windows" {
- paned1 "Horizontal paned window"
- paned2 "Vertical paned window"
-}
-addDemoSection "Menus" {
- menu "Menus and cascades (sub-menus)"
- menubu "Menu-buttons"
-}
-addDemoSection "Common Dialogs" {
- msgbox "Message boxes"
- filebox "File selection dialog"
- clrpick "Color picker"
-}
-addDemoSection "Miscellaneous" {
- bitmap "The built-in bitmaps"
- dialog1 "A dialog box with a local grab"
- dialog2 "A dialog box with a global grab"
+addFormattedText {
+ @@title Tk Widget Demonstrations
+
+ This application provides a front end for several short scripts
+ that demonstrate what you can do with Tk widgets. Each of the
+ numbered lines below describes a demonstration; you can click on
+ it to invoke the demonstration. Once the demonstration window
+ appears, you can click the
+ @@bold
+ See Code
+ @@normal
+ button to see the Tcl/Tk code that created the demonstration. If
+ you wish, you can edit the code and click the
+ @@bold
+ Rerun Demo
+ @@normal
+ button in the code window to reinvoke the demonstration with the
+ modified code.
+ @@newline
+
+ @@subtitle Labels, buttons, checkbuttons, and radiobuttons
+ @@demo label Labels (text and bitmaps)
+ @@demo unicodeout Labels and UNICODE text
+ @@demo button Buttons
+ @@demo check Check-buttons (select any of a group)
+ @@demo radio Radio-buttons (select one of a group)
+ @@demo puzzle A 15-puzzle game made out of buttons
+ @@demo icon Iconic buttons that use bitmaps
+ @@demo image1 Two labels displaying images
+ @@demo image2 A simple user interface for viewing images
+ @@demo labelframe Labelled frames
+ @@new
+ @@demo ttkbut The simple Themed Tk widgets
+
+ @@subtitle Listboxes and Trees
+ @@demo states The 50 states
+ @@demo colors Colors: change the color scheme for the application
+ @@demo sayings A collection of famous and infamous sayings
+ @@new
+ @@demo mclist A multi-column list of countries
+ @@new
+ @@demo tree A directory browser tree
+
+ @@subtitle Entries, Spin-boxes and Combo-boxes
+ @@demo entry1 Entries without scrollbars
+ @@demo entry2 Entries with scrollbars
+ @@demo entry3 Validated entries and password fields
+ @@demo spin Spin-boxes
+ @@new
+ @@demo combo Combo-boxes
+ @@demo form Simple Rolodex-like form
+
+ @@subtitle Text
+ @@demo text Basic editable text
+ @@demo style Text display styles
+ @@demo bind Hypertext (tag bindings)
+ @@demo twind A text widget with embedded windows and other features
+ @@demo search A search tool built with a text widget
+ @@new
+ @@demo textpeer Peering text widgets
+
+ @@subtitle Canvases
+ @@demo items The canvas item types
+ @@demo plot A simple 2-D plot
+ @@demo ctext Text items in canvases
+ @@demo arrow An editor for arrowheads on canvas lines
+ @@demo ruler A ruler with adjustable tab stops
+ @@demo floor A building floor plan
+ @@demo cscroll A simple scrollable canvas
+ @@new
+ @@demo knightstour A Knight's tour of the chess board
+
+ @@subtitle Scales and Progress Bars
+ @@demo hscale Horizontal scale
+ @@demo vscale Vertical scale
+ @@new
+ @@demo ttkscale Themed scale linked to a label with traces
+ @@new
+ @@demo ttkprogress Progress bar
+
+ @@subtitle Paned Windows and Notebooks
+ @@demo paned1 Horizontal paned window
+ @@demo paned2 Vertical paned window
+ @@new
+ @@demo ttkpane Themed nested panes
+ @@new
+ @@demo ttknote Notebook widget
+
+ @@subtitle Menus and Toolbars
+ @@demo menu Menus and cascades (sub-menus)
+ @@demo menubu Menu-buttons
+ @@new
+ @@demo ttkmenu Themed menu buttons
+ @@new
+ @@demo toolbar Themed toolbar
+
+ @@subtitle Common Dialogs
+ @@demo msgbox Message boxes
+ @@demo filebox File selection dialog
+ @@demo clrpick Color picker
+
+ @@subtitle Animation
+ @@new
+ @@demo anilabel Animated labels
+ @@new
+ @@demo aniwave Animated wave
+ @@new
+ @@demo pendulum Pendulum simulation
+ @@new
+ @@demo goldberg A celebration of Rube Goldberg
+
+ @@subtitle Miscellaneous
+ @@demo bitmap The built-in bitmaps
+ @@demo dialog1 A dialog box with a local grab
+ @@demo dialog2 A dialog box with a global grab
}
+
+##############################################################################
.t configure -state disabled
focus .s
+# addSeeDismiss --
+# Add "See Code" and "Dismiss" button frame, with optional "See Vars"
+#
+# Arguments:
+# w - The name of the frame to use.
+
+proc addSeeDismiss {w show {vars {}} {extra {}}} {
+ ## See Code / Dismiss buttons
+ ttk::frame $w
+ ttk::separator $w.sep
+ #ttk::frame $w.sep -height 2 -relief sunken
+ grid $w.sep -columnspan 4 -row 0 -sticky ew -pady 2
+ ttk::button $w.dismiss -text [mc "Dismiss"] \
+ -image ::img::delete -compound left \
+ -command [list destroy [winfo toplevel $w]]
+ ttk::button $w.code -text [mc "See Code"] \
+ -image ::img::view -compound left \
+ -command [list showCode $show]
+ set buttons [list x $w.code $w.dismiss]
+ if {[llength $vars]} {
+ ttk::button $w.vars -text [mc "See Variables"] \
+ -image ::img::view -compound left \
+ -command [concat [list showVars $w.dialog] $vars]
+ set buttons [linsert $buttons 1 $w.vars]
+ }
+ if {$extra ne ""} {
+ set buttons [linsert $buttons 1 [uplevel 1 $extra]]
+ }
+ grid {*}$buttons -padx 4 -pady 4
+ grid columnconfigure $w 0 -weight 1
+ if {[tk windowingsystem] eq "aqua"} {
+ foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
+ grid configure $w.sep -pady 0
+ grid configure {*}$buttons -pady {10 12}
+ grid configure [lindex $buttons 1] -padx {16 4}
+ grid configure [lindex $buttons end] -padx {4 18}
+ }
+ return $w
+}
+
# positionWindow --
-# This procedure is invoked by most of the demos to position a
-# new demo window.
+# This procedure is invoked by most of the demos to position a new demo
+# window.
#
# Arguments:
# w - The name of the window to position.
@@ -238,59 +461,66 @@ proc positionWindow w {
}
# showVars --
-# Displays the values of one or more variables in a window, and
-# updates the display whenever any of the variables changes.
+# Displays the values of one or more variables in a window, and updates the
+# display whenever any of the variables changes.
#
# Arguments:
# w - Name of new window to create for display.
# args - Any number of names of variables.
proc showVars {w args} {
- global widgetFont
catch {destroy $w}
toplevel $w
- wm title $w "Variable values"
- label $w.title -text "Variable values:" -width 20 -anchor center \
- -font $widgetFont(vars)
- pack $w.title -side top -fill x
- set len 1
- foreach i $args {
- if {[string length $i] > $len} {
- set len [string length $i]
- }
+ if {[tk windowingsystem] eq "x11"} {wm attributes $w -type dialog}
+ wm title $w [mc "Variable values"]
+
+ set b [ttk::frame $w.frame]
+ grid $b -sticky news
+ set f [ttk::labelframe $b.title -text [mc "Variable values:"]]
+ foreach var $args {
+ ttk::label $f.n$var -text "$var:" -anchor w
+ ttk::label $f.v$var -textvariable $var -anchor w
+ grid $f.n$var $f.v$var -padx 2 -pady 2 -sticky w
}
- foreach i $args {
- frame $w.$i
- label $w.$i.name -text "$i: " -width [expr $len + 2] -anchor w
- label $w.$i.value -textvar $i -anchor w
- pack $w.$i.name -side left
- pack $w.$i.value -side left -expand 1 -fill x
- pack $w.$i -side top -anchor w -fill x
+ ttk::button $b.ok -text [mc "OK"] \
+ -command [list destroy $w] -default active
+ bind $w <Return> [list $b.ok invoke]
+ bind $w <Escape> [list $b.ok invoke]
+
+ grid $f -sticky news -padx 4
+ grid $b.ok -sticky e -padx 4 -pady {6 4}
+ if {[tk windowingsystem] eq "aqua"} {
+ $b.ok configure -takefocus 0
+ grid configure $b.ok -pady {10 12} -padx {16 18}
+ grid configure $f -padx 10 -pady {10 0}
}
- button $w.ok -text OK -command "destroy $w" -default active
- bind $w <Return> "tkButtonInvoke $w.ok"
- pack $w.ok -side bottom -pady 2
+ grid columnconfig $f 1 -weight 1
+ grid rowconfigure $f 100 -weight 1
+ grid columnconfig $b 0 -weight 1
+ grid rowconfigure $b 0 -weight 1
+ grid columnconfig $w 0 -weight 1
+ grid rowconfigure $w 0 -weight 1
}
# invoke --
-# This procedure is called when the user clicks on a demo description.
-# It is responsible for invoking the demonstration.
+# This procedure is called when the user clicks on a demo description. It is
+# responsible for invoking the demonstration.
#
# Arguments:
# index - The index of the character that the user clicked on.
proc invoke index {
- global tk_library
+ global tk_demoDirectory
set tags [.t tag names $index]
set i [lsearch -glob $tags demo-*]
if {$i < 0} {
return
}
set cursor [.t cget -cursor]
- .t configure -cursor watch
+ .t configure -cursor [::ttk::cursor busy]
update
set demo [string range [lindex $tags $i] 5 end]
- uplevel [list source [file join $tk_library demos $demo.tcl]]
+ uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]]
update
.t configure -cursor $cursor
@@ -299,97 +529,205 @@ proc invoke index {
# showStatus --
#
-# Show the name of the demo program in the status bar. This procedure
-# is called when the user moves the cursor over a demo description.
+# Show the name of the demo program in the status bar. This procedure is
+# called when the user moves the cursor over a demo description.
#
proc showStatus index {
- global tk_library
set tags [.t tag names $index]
set i [lsearch -glob $tags demo-*]
set cursor [.t cget -cursor]
if {$i < 0} {
.statusBar.lab config -text " "
- set newcursor xterm
+ set newcursor [::ttk::cursor text]
} else {
set demo [string range [lindex $tags $i] 5 end]
- .statusBar.lab config -text "Run the \"$demo\" sample program"
- set newcursor hand2
+ .statusBar.lab config -text [mc "Run the \"%s\" sample program" $demo]
+ set newcursor [::ttk::cursor link]
}
- if [string compare $cursor $newcursor] {
+ if {$cursor ne $newcursor} {
.t config -cursor $newcursor
}
}
+# evalShowCode --
+#
+# Arguments:
+# w - Name of text widget containing code to eval
+
+proc evalShowCode {w} {
+ set code [$w get 1.0 end-1c]
+ uplevel #0 $code
+}
# showCode --
-# This procedure creates a toplevel window that displays the code for
-# a demonstration and allows it to be edited and reinvoked.
+# This procedure creates a toplevel window that displays the code for a
+# demonstration and allows it to be edited and reinvoked.
#
# Arguments:
-# w - The name of the demonstration's window, which can be
-# used to derive the name of the file containing its code.
+# w - The name of the demonstration's window, which can be used to
+# derive the name of the file containing its code.
proc showCode w {
- global tk_library
+ global tk_demoDirectory
set file [string range $w 1 end].tcl
- if ![winfo exists .code] {
- toplevel .code
- frame .code.buttons
- pack .code.buttons -side bottom -fill x
- button .code.buttons.dismiss -text Dismiss \
- -default active -command "destroy .code"
- button .code.buttons.rerun -text "Rerun Demo" -command {
- eval [.code.text get 1.0 end]
+ set top .code
+ if {![winfo exists $top]} {
+ toplevel $top
+ if {[tk windowingsystem] eq "x11"} {wm attributes $top -type dialog}
+
+ set t [frame $top.f]
+ set text [text $t.text -font fixedFont -height 24 -wrap word \
+ -xscrollcommand [list $t.xscroll set] \
+ -yscrollcommand [list $t.yscroll set] \
+ -setgrid 1 -highlightthickness 0 -pady 2 -padx 3]
+ scrollbar $t.xscroll -command [list $t.text xview] -orient horizontal
+ scrollbar $t.yscroll -command [list $t.text yview] -orient vertical
+
+ grid $t.text $t.yscroll -sticky news
+ #grid $t.xscroll
+ grid rowconfigure $t 0 -weight 1
+ grid columnconfig $t 0 -weight 1
+
+ set btns [ttk::frame $top.btns]
+ ttk::separator $btns.sep
+ grid $btns.sep -columnspan 4 -row 0 -sticky ew -pady 2
+ ttk::button $btns.dismiss -text [mc "Dismiss"] \
+ -default active -command [list destroy $top] \
+ -image ::img::delete -compound left
+ ttk::button $btns.print -text [mc "Print Code"] \
+ -command [list printCode $text $file] \
+ -image ::img::print -compound left
+ ttk::button $btns.rerun -text [mc "Rerun Demo"] \
+ -command [list evalShowCode $text] \
+ -image ::img::refresh -compound left
+ set buttons [list x $btns.rerun $btns.print $btns.dismiss]
+ grid {*}$buttons -padx 4 -pady 4
+ grid columnconfigure $btns 0 -weight 1
+ if {[tk windowingsystem] eq "aqua"} {
+ foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
+ grid configure $btns.sep -pady 0
+ grid configure {*}$buttons -pady {10 12}
+ grid configure [lindex $buttons 1] -padx {16 4}
+ grid configure [lindex $buttons end] -padx {4 18}
}
- pack .code.buttons.dismiss .code.buttons.rerun -side left \
- -expand 1 -pady 2
- frame .code.frame
- pack .code.frame -expand yes -fill both -padx 1 -pady 1
- text .code.text -height 40 -wrap word\
- -xscrollcommand ".code.xscroll set" \
- -yscrollcommand ".code.yscroll set" \
- -setgrid 1 -highlightthickness 0 -pady 2 -padx 3
- scrollbar .code.xscroll -command ".code.text xview" \
- -highlightthickness 0 -orient horizontal
- scrollbar .code.yscroll -command ".code.text yview" \
- -highlightthickness 0 -orient vertical
-
- grid .code.text -in .code.frame -padx 1 -pady 1 \
- -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
- grid .code.yscroll -in .code.frame -padx 1 -pady 1 \
- -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
-# grid .code.xscroll -in .code.frame -padx 1 -pady 1 \
-# -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
- grid rowconfig .code.frame 0 -weight 1 -minsize 0
- grid columnconfig .code.frame 0 -weight 1 -minsize 0
+ grid $t -sticky news
+ grid $btns -sticky ew
+ grid rowconfigure $top 0 -weight 1
+ grid columnconfig $top 0 -weight 1
+
+ bind $top <Return> {
+ if {[winfo class %W] ne "Text"} { .code.btns.dismiss invoke }
+ }
+ bind $top <Escape> [bind $top <Return>]
} else {
- wm deiconify .code
- raise .code
+ wm deiconify $top
+ raise $top
}
- wm title .code "Demo code: [file join $tk_library demos $file]"
- wm iconname .code $file
- set id [open [file join $tk_library demos $file]]
- .code.text delete 1.0 end
- .code.text insert 1.0 [read $id]
- .code.text mark set insert 1.0
+ wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]]
+ wm iconname $top $file
+ set id [open [file join $tk_demoDirectory $file]]
+ $top.f.text delete 1.0 end
+ $top.f.text insert 1.0 [read $id]
+ $top.f.text mark set insert 1.0
close $id
}
-# tkAboutDialog --
+# printCode --
+# Prints the source code currently displayed in the See Code dialog. Much
+# thanks to Arjen Markus for this.
#
-# Pops up a message box with an "about" message
-#
-proc tkAboutDialog {} {
- tk_messageBox -icon info -type ok -title "About Widget Demo" -message \
-"Tk widget demonstration
+# Arguments:
+# w - Name of text widget containing code to print
+# file - Name of the original file (implicitly for title)
+
+proc printCode {w file} {
+ set code [$w get 1.0 end-1c]
+
+ set dir "."
+ if {[info exists ::env(HOME)]} {
+ set dir "$::env(HOME)"
+ }
+ if {[info exists ::env(TMP)]} {
+ set dir $::env(TMP)
+ }
+ if {[info exists ::env(TEMP)]} {
+ set dir $::env(TEMP)
+ }
-Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ set filename [file join $dir "tkdemo-$file"]
+ set outfile [open $filename "w"]
+ puts $outfile $code
+ close $outfile
+
+ switch -- $::tcl_platform(platform) {
+ unix {
+ if {[catch {exec lp -c $filename} msg]} {
+ tk_messageBox -title "Print spooling failure" \
+ -message "Print spooling probably failed: $msg"
+ }
+ }
+ windows {
+ if {[catch {PrintTextWin32 $filename} msg]} {
+ tk_messageBox -title "Print spooling failure" \
+ -message "Print spooling probably failed: $msg"
+ }
+ }
+ default {
+ tk_messageBox -title "Operation not Implemented" \
+ -message "Wow! Unknown platform: $::tcl_platform(platform)"
+ }
+ }
-Copyright (c) 1997-2000 Ajuba Solutions, Inc.
+ #
+ # Be careful to throw away the temporary file in a gentle manner ...
+ #
+ if {[file exists $filename]} {
+ catch {file delete $filename}
+ }
+}
-Copyright (c) 2001-2002 Donal K. Fellows
+# PrintTextWin32 --
+# Print a file under Windows using all the "intelligence" necessary
+#
+# Arguments:
+# filename - Name of the file
+#
+# Note:
+# Taken from the Wiki page by Keith Vetter, "Printing text files under
+# Windows".
+# Note:
+# Do not execute the command in the background: that way we can dispose of the
+# file smoothly.
+#
+proc PrintTextWin32 {filename} {
+ package require registry
+ set app [auto_execok notepad.exe]
+ set pcmd "$app /p %1"
+ catch {
+ set app [registry get {HKEY_CLASSES_ROOT\.txt} {}]
+ set pcmd [registry get \
+ {HKEY_CLASSES_ROOT\\$app\\shell\\print\\command} {}]
+ }
+
+ regsub -all {%1} $pcmd $filename pcmd
+ puts $pcmd
-Copyright (c) 2002-2007 Daniel A. Steffen"
+ regsub -all {\\} $pcmd {\\\\} pcmd
+ set command "[auto_execok start] /min $pcmd"
+ eval exec $command
+}
+
+# tkAboutDialog --
+#
+# Pops up a message box with an "about" message
+#
+proc tkAboutDialog {} {
+ tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \
+ -message [mc "Tk widget demonstration application"] -detail \
+"[mc {Copyright (c) %s} {1996-1997 Sun Microsystems, Inc.}]
+[mc {Copyright (c) %s} {1997-2000 Ajuba Solutions, Inc.}]
+[mc {Copyright (c) %s} {2001-2007 Donal K. Fellows}]
+[mc {Copyright (c) %s} {2002-2007 Daniel A. Steffen}]"
}
# Local Variables:
diff --git a/library/dialog.tcl b/library/dialog.tcl
index 04acb3b..abe142b 100644
--- a/library/dialog.tcl
+++ b/library/dialog.tcl
@@ -37,7 +37,6 @@ proc ::tk_dialog {w title text bitmap default args} {
return -code error "default button index greater than number of\
buttons specified for tk_dialog"
}
- # Never call if -strict option is omitted in previous test !
} elseif {"" eq $default} {
set default -1
} else {
@@ -45,7 +44,7 @@ proc ::tk_dialog {w title text bitmap default args} {
}
set windowingsystem [tk windowingsystem]
- if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
option add *Dialog*background systemDialogBackgroundActive widgetDefault
option add *Dialog*Button.highlightBackground \
systemDialogBackgroundActive widgetDefault
@@ -71,7 +70,7 @@ proc ::tk_dialog {w title text bitmap default args} {
wm transient $w [winfo toplevel [winfo parent $w]]
}
- if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
::tk::unsupported::MacWindowStyle style $w moveableModal {}
} elseif {$windowingsystem eq "x11"} {
wm attributes $w -type dialog
@@ -85,23 +84,19 @@ proc ::tk_dialog {w title text bitmap default args} {
}
pack $w.bot -side bottom -fill both
pack $w.top -side top -fill both -expand 1
+ grid anchor $w.bot center
# 2. Fill the top part with bitmap and message (use the option
# database for -wraplength and -font so that they can be
# overridden by the caller).
option add *Dialog.msg.wrapLength 3i widgetDefault
- if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
- option add *Dialog.msg.font system widgetDefault
- } else {
- option add *Dialog.msg.font {Times 12} widgetDefault
- }
+ option add *Dialog.msg.font TkCaptionFont widgetDefault
label $w.msg -justify left -text $text
pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
if {$bitmap ne ""} {
- if {($tcl_platform(platform) eq "macintosh"
- || $windowingsystem eq "aqua") && ($bitmap eq "error")} {
+ if {$windowingsystem eq "aqua" && $bitmap eq "error"} {
set bitmap "stop"
}
label $w.bitmap -bitmap $bitmap
@@ -122,7 +117,7 @@ proc ::tk_dialog {w title text bitmap default args} {
-padx 10 -pady 4
grid columnconfigure $w.bot $i
# We boost the size of some Mac buttons for l&f
- if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
set tmp [string tolower $but]
if {$tmp eq "ok" || $tmp eq "cancel"} {
grid columnconfigure $w.bot $i -minsize 90
@@ -134,15 +129,14 @@ proc ::tk_dialog {w title text bitmap default args} {
# 4. Create a binding for <Return> on the dialog if there is a
# default button.
+ # Convention also dictates that if the keyboard focus moves among the
+ # the buttons that the <Return> binding affects the button with the focus.
if {$default >= 0} {
- bind $w <Return> "
- [list $w.button$default] configure -state active -relief sunken
- update idletasks
- after 100
- set ::tk::Priv(button) $default
- "
+ bind $w <Return> [list $w.button$default invoke]
}
+ bind $w <<PrevWindow>> [list bind $w <Return> {[tk_focusPrev %W] invoke}]
+ bind $w <Tab> [list bind $w <Return> {[tk_focusNext %W] invoke}]
# 5. Create a <Destroy> binding for the window that sets the
# button variable to -1; this is needed in case something happens
@@ -177,17 +171,12 @@ proc ::tk_dialog {w title text bitmap default args} {
# 7. Set a grab and claim the focus too.
- set oldFocus [focus]
- set oldGrab [grab current $w]
- if {$oldGrab ne ""} {
- set grabStatus [grab status $oldGrab]
- }
- grab $w
if {$default >= 0} {
- focus $w.button$default
+ set focus $w.button$default
} else {
- focus $w
+ set focus $w
}
+ tk::SetFocusGrab $w $focus
# 8. Wait for the user to respond, then restore the focus and
# return the index of the selected button. Restore the focus
@@ -196,21 +185,14 @@ proc ::tk_dialog {w title text bitmap default args} {
# restore any grab that was in effect.
vwait ::tk::Priv(button)
- catch {focus $oldFocus}
+
catch {
# It's possible that the window has already been destroyed,
# hence this "catch". Delete the Destroy handler so that
# Priv(button) doesn't get reset by it.
bind $w <Destroy> {}
- destroy $w
- }
- if {$oldGrab ne ""} {
- if {$grabStatus ne "global"} {
- grab $oldGrab
- } else {
- grab -global $oldGrab
- }
}
+ tk::RestoreFocusGrab $w $focus
return $Priv(button)
}
diff --git a/library/entry.tcl b/library/entry.tcl
index bfbaccf..54f2136 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -68,6 +68,11 @@ bind Entry <<PasteSelection>> {
}
}
+bind Entry <<TraverseIn>> {
+ %W selection range 0 end
+ %W icursor end
+}
+
# Standard Motif bindings:
bind Entry <1> {
@@ -203,8 +208,8 @@ bind Entry <Escape> {# nothing}
bind Entry <Return> {# nothing}
bind Entry <KP_Enter> {# nothing}
bind Entry <Tab> {# nothing}
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
- bind Entry <Command-KeyPress> {# nothing}
+if {[tk windowingsystem] eq "aqua"} {
+ bind Entry <Command-KeyPress> {# nothing}
}
# On Windows, paste is done using Shift-Insert. Shift-Insert already
@@ -331,7 +336,9 @@ proc ::tk::EntryButton1 {w x} {
set Priv(pressX) $x
$w icursor [EntryClosestGap $w $x]
$w selection from insert
- if {"disabled" ne [$w cget -state]} {focus $w}
+ if {"disabled" ne [$w cget -state]} {
+ focus $w
+ }
}
# ::tk::EntryMouseSelect --
@@ -402,7 +409,9 @@ proc ::tk::EntryMouseSelect {w x} {
proc ::tk::EntryPaste {w x} {
$w icursor [EntryClosestGap $w $x]
catch {$w insert insert [::tk::GetSelection $w PRIMARY]}
- if {"disabled" ne [$w cget -state]} {focus $w}
+ if {"disabled" ne [$w cget -state]} {
+ focus $w
+ }
}
# ::tk::EntryAutoScan --
@@ -418,7 +427,9 @@ proc ::tk::EntryPaste {w x} {
proc ::tk::EntryAutoScan {w} {
variable ::tk::Priv
set x $Priv(x)
- if {![winfo exists $w]} return
+ if {![winfo exists $w]} {
+ return
+ }
if {$x >= [winfo width $w]} {
$w xview scroll 2 units
EntryMouseSelect $w $x
@@ -486,7 +497,9 @@ proc ::tk::EntryBackspace w {
$w delete sel.first sel.last
} else {
set x [expr {[$w index insert] - 1}]
- if {$x >= 0} {$w delete $x}
+ if {$x >= 0} {
+ $w delete $x
+ }
if {[$w index @0] >= [$w index insert]} {
set range [$w xview]
set left [lindex $range 0]
diff --git a/library/focus.tcl b/library/focus.tcl
index 9be0e9a..640406e 100644
--- a/library/focus.tcl
+++ b/library/focus.tcl
@@ -36,7 +36,7 @@ proc ::tk_focusNext w {
incr i
if {$i < [llength $children]} {
set cur [lindex $children $i]
- if {[winfo toplevel $cur] eq $cur} {
+ if {[winfo toplevel $cur] eq $cur} {
continue
} else {
break
@@ -163,8 +163,7 @@ proc ::tk::FocusOK w {
proc ::tk_focusFollowsMouse {} {
set old [bind all <Enter>]
set script {
- if {"%d" eq "NotifyAncestor" \
- || "%d" eq "NotifyNonlinear" \
+ if {"%d" eq "NotifyAncestor" || "%d" eq "NotifyNonlinear" \
|| "%d" eq "NotifyInferior"} {
if {[tk::FocusOK %W]} {
focus %W
diff --git a/library/listbox.tcl b/library/listbox.tcl
index 9fd86e4..f3434a5 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -33,7 +33,7 @@
bind Listbox <1> {
if {[winfo exists %W]} {
- tk::ListboxBeginSelect %W [%W index @%x,%y]
+ tk::ListboxBeginSelect %W [%W index @%x,%y] 1
}
}
@@ -176,7 +176,8 @@ bind Listbox <B2-Motion> {
# The MouseWheel will typically only fire on Windows and Mac OS X.
# However, someone could use the "event generate" command to produce
# one on other platforms.
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
+
+if {[tk windowingsystem] eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D)}] units
}
@@ -224,7 +225,7 @@ if {"x11" eq [tk windowingsystem]} {
# el - The element for the selection operation (typically the
# one under the pointer). Must be in numerical form.
-proc ::tk::ListboxBeginSelect {w el} {
+proc ::tk::ListboxBeginSelect {w el {focus 1}} {
variable ::tk::Priv
if {[$w cget -selectmode] eq "multiple"} {
if {[$w selection includes $el]} {
@@ -240,6 +241,10 @@ proc ::tk::ListboxBeginSelect {w el} {
set Priv(listboxPrev) $el
}
event generate $w <<ListboxSelect>>
+ # check existence as ListboxSelect may destroy us
+ if {$focus && [winfo exists $w] && [$w cget -state] eq "normal"} {
+ focus $w
+ }
}
# ::tk::ListboxMotion --
@@ -477,7 +482,7 @@ proc ::tk::ListboxCancel w {
}
set first [$w index anchor]
set last $Priv(listboxPrev)
- if { $last eq "" } {
+ if {$last eq ""} {
# Not actually doing any selection right now
return
}
diff --git a/library/menu.tcl b/library/menu.tcl
index ed8182e..e00dad9 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -259,8 +259,10 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
if {$cur ne ""} {
MenuUnpost {}
}
- set Priv(cursor) [$w cget -cursor]
- $w configure -cursor arrow
+ if {$::tk_strictMotif} {
+ set Priv(cursor) [$w cget -cursor]
+ $w configure -cursor arrow
+ }
if {[tk windowingsystem] ne "aqua"} {
set Priv(relief) [$w cget -relief]
$w configure -relief raised
@@ -303,7 +305,7 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set x [expr {[winfo rootx $w] - [winfo reqwidth $menu]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [MenuFindName $menu [$w cget -text]]
- if {[$w cget -indicatoron]} {
+ if {[$w cget -indicatoron] && $entry ne ""} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
+ [winfo reqheight $menu])/2}]
@@ -323,7 +325,7 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set x [expr {[winfo rootx $w] + [winfo width $w]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [MenuFindName $menu [$w cget -text]]
- if {[$w cget -indicatoron]} {
+ if {[$w cget -indicatoron] && $entry ne ""} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
+ [winfo reqheight $menu])/2}]
@@ -402,12 +404,19 @@ proc ::tk::MenuUnpost menu {
# Unpost menu(s) and restore some stuff that's dependent on
# what was posted.
+ after cancel [array get Priv menuActivatedTimer]
+ unset -nocomplain Priv(menuActivated)
+ after cancel [array get Priv menuDeactivatedTimer]
+ unset -nocomplain Priv(menuDeactivated)
+
catch {
if {$mb ne ""} {
set menu [$mb cget -menu]
$menu unpost
set Priv(postedMb) {}
- $mb configure -cursor $Priv(cursor)
+ if {$::tk_strictMotif} {
+ $mb configure -cursor $Priv(cursor)
+ }
if {[tk windowingsystem] ne "aqua"} {
$mb configure -relief $Priv(relief)
} else {
@@ -416,7 +425,8 @@ proc ::tk::MenuUnpost menu {
} elseif {$Priv(popup) ne ""} {
$Priv(popup) unpost
set Priv(popup) {}
- } elseif {[$menu cget -type] ne "menubar" && [$menu cget -type] ne "tearoff"} {
+ } elseif {[$menu cget -type] ne "menubar" \
+ && [$menu cget -type] ne "tearoff"} {
# We're in a cascaded sub-menu from a torn-off menu or popup.
# Unpost all the menus up to the toplevel one (but not
# including the top-level torn-off one) and deactivate the
@@ -424,7 +434,8 @@ proc ::tk::MenuUnpost menu {
while {1} {
set parent [winfo parent $menu]
- if {[winfo class $parent] ne "Menu" || ![winfo ismapped $parent]} {
+ if {[winfo class $parent] ne "Menu" \
+ || ![winfo ismapped $parent]} {
break
}
$parent activate none
@@ -453,7 +464,9 @@ proc ::tk::MenuUnpost menu {
}
RestoreOldGrab
if {$Priv(menuBar) ne ""} {
- $Priv(menuBar) configure -cursor $Priv(cursor)
+ if {$::tk_strictMotif} {
+ $Priv(menuBar) configure -cursor $Priv(cursor)
+ }
set Priv(menuBar) {}
}
if {[tk windowingsystem] ne "x11"} {
@@ -537,6 +550,7 @@ proc ::tk::MbButtonUp w {
proc ::tk::MenuMotion {menu x y state} {
variable ::tk::Priv
if {$menu eq $Priv(window)} {
+ set activeindex [$menu index active]
if {[$menu cget -type] eq "menubar"} {
if {[info exists Priv(focus)] && $menu ne $Priv(focus)} {
$menu activate @$x,$y
@@ -546,9 +560,22 @@ proc ::tk::MenuMotion {menu x y state} {
$menu activate @$x,$y
GenerateMenuSelect $menu
}
- }
- if {($state & 0x1f00) != 0} {
- $menu postcascade active
+ set index [$menu index @$x,$y]
+ if {[info exists Priv(menuActivated)] \
+ && $index ne "none" \
+ && $index ne $activeindex} {
+ set mode [option get $menu clickToFocus ClickToFocus]
+ if {[string is false $mode]} {
+ set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}]
+ if {[$menu type $index] eq "cascade"} {
+ set Priv(menuActivatedTimer) \
+ [after $delay [list $menu postcascade active]]
+ } else {
+ set Priv(menuDeactivatedTimer) \
+ [after $delay [list $menu postcascade none]]
+ }
+ }
+ }
}
}
@@ -584,10 +611,15 @@ proc ::tk::MenuButtonDown menu {
set menu [winfo parent $menu]
}
- if {$Priv(menuBar) eq ""} {
+ if {$Priv(menuBar) eq {}} {
set Priv(menuBar) $menu
- set Priv(cursor) [$menu cget -cursor]
- $menu configure -cursor arrow
+ if {$::tk_strictMotif} {
+ set Priv(cursor) [$menu cget -cursor]
+ $menu configure -cursor arrow
+ }
+ if {[$menu type active] eq "cascade"} {
+ set Priv(menuActivated) 1
+ }
}
# Don't update grab information if the grab window isn't changing.
@@ -625,7 +657,8 @@ proc ::tk::MenuLeave {menu rootx rooty state} {
return
}
if {[$menu type active] eq "cascade" \
- && [winfo containing $rootx $rooty] eq [$menu entrycget active -menu]} {
+ && [winfo containing $rootx $rooty] eq \
+ [$menu entrycget active -menu]} {
return
}
$menu activate none
@@ -779,7 +812,8 @@ proc ::tk::MenuNextMenu {menu direction} {
} else {
set parent [winfo parent $menu]
while {$parent ne "."} {
- if {[winfo class $parent] eq "Menu" && [$parent cget -type] eq "menubar"} {
+ if {[winfo class $parent] eq "Menu" \
+ && [$parent cget -type] eq "menubar"} {
tk_menuSetFocus $parent
MenuNextEntry $parent 1
return
@@ -803,16 +837,14 @@ proc ::tk::MenuNextMenu {menu direction} {
}
}
- # Can't traverse into or out of a cascaded menu. Go to the next
+ # Can't traverse into or out of a cascaded menu. Go to the next
# or previous menubutton, if that makes sense.
set m2 [winfo parent $menu]
- if {[winfo class $m2] eq "Menu"} {
- if {[$m2 cget -type] eq "menubar"} {
- tk_menuSetFocus $m2
- MenuNextEntry $m2 -1
- return
- }
+ if {[winfo class $m2] eq "Menu" && [$m2 cget -type] eq "menubar"} {
+ tk_menuSetFocus $m2
+ MenuNextEntry $m2 -1
+ return
}
set w $Priv(postedMb)
@@ -932,7 +964,8 @@ proc ::tk::MenuFind {w char} {
if {[winfo toplevel $w] ne [winfo toplevel $child]} {
continue
}
- if {[winfo class $child] eq "Menu" && [$child cget -type] eq "menubar"} {
+ if {[winfo class $child] eq "Menu" && \
+ [$child cget -type] eq "menubar"} {
if {$char eq ""} {
return $child
}
@@ -957,7 +990,7 @@ proc ::tk::MenuFind {w char} {
if {[winfo toplevel $w] ne [winfo toplevel $child]} {
continue
}
- switch [winfo class $child] {
+ switch -- [winfo class $child] {
Menubutton {
set char2 [string index [$child cget -text] \
[$child cget -underline]]
@@ -997,10 +1030,11 @@ proc ::tk::TraverseToMenu {w char} {
return
}
while {[winfo class $w] eq "Menu"} {
+ if {[$w cget -type] ne "menubar" && $Priv(postedMb) eq ""} {
+ return
+ }
if {[$w cget -type] eq "menubar"} {
break
- } elseif {$Priv(postedMb) eq ""} {
- return
}
set w [winfo parent $w]
}
@@ -1112,15 +1146,15 @@ proc ::tk::MenuFirstEntry menu {
}
for {set i 0} {$i <= $last} {incr i} {
if {([catch {set state [$menu entrycget $i -state]}] == 0) \
- && $state ne "disabled" \
- && [$menu type $i] ne "tearoff"} {
+ && $state ne "disabled" && [$menu type $i] ne "tearoff"} {
$menu activate $i
GenerateMenuSelect $menu
# Only post the cascade if the current menu is a menubar;
# otherwise, if the first entry of the cascade is a cascade,
# we can get an annoying cascading effect resulting in a bunch of
# menus getting posted (bug 676)
- if {[$menu type $i] eq "cascade" && [$menu cget -type] eq "menubar"} {
+ if {[$menu type $i] eq "cascade" \
+ && [$menu cget -type] eq "menubar"} {
set cascade [$menu entrycget $i -menu]
if {$cascade ne ""} {
$menu postcascade $i
@@ -1188,24 +1222,35 @@ proc ::tk::PostOverPoint {menu x y {entry {}}} {
}
incr x [expr {-[winfo reqwidth $menu]/2}]
}
+
if {$tcl_platform(platform) eq "windows"} {
+ # osVersion is not available in safe interps
+ set ver 5
+ if {[info exists tcl_platform(osVersion)]} {
+ scan $tcl_platform(osVersion) %d ver
+ }
+
# We need to fix some problems with menu posting on Windows,
# where, if the menu would overlap top or bottom of screen,
# Windows puts it in the wrong place for us. We must also
# subtract an extra amount for half the height of the current
# entry. To be safe we subtract an extra 10.
- set yoffset [expr {[winfo screenheight $menu] \
- - $y - [winfo reqheight $menu] - 10}]
- if {$yoffset < 0} {
- # The bottom of the menu is offscreen, so adjust upwards
- incr y $yoffset
- if {$y < 0} { set y 0 }
- }
- # If we're off the top of the screen (either because we were
- # originally or because we just adjusted too far upwards),
- # then make the menu popup on the top edge.
- if {$y < 0} {
- set y 0
+ # NOTE: this issue appears to have been resolved in the Window
+ # manager provided with Vista and Windows 7.
+ if {$ver < 6} {
+ set yoffset [expr {[winfo screenheight $menu] \
+ - $y - [winfo reqheight $menu] - 10}]
+ if {$yoffset < 0} {
+ # The bottom of the menu is offscreen, so adjust upwards
+ incr y $yoffset
+ if {$y < 0} { set y 0 }
+ }
+ # If we're off the top of the screen (either because we were
+ # originally or because we just adjusted too far upwards),
+ # then make the menu popup on the top edge.
+ if {$y < 0} {
+ set y 0
+ }
}
}
$menu post $x $y
@@ -1243,7 +1288,7 @@ proc ::tk::RestoreOldGrab {} {
# be visible anymore.
catch {
- if {$Priv(grabStatus) eq "global"} {
+ if {$Priv(grabStatus) eq "global"} {
grab set -global $Priv(oldGrab)
} else {
grab set $Priv(oldGrab)
@@ -1260,11 +1305,12 @@ proc ::tk_menuSetFocus {menu} {
}
focus $menu
}
-
+
proc ::tk::GenerateMenuSelect {menu} {
variable ::tk::Priv
- if {$Priv(activeMenu) eq $menu && $Priv(activeItem) eq [$menu index active]} {
+ if {$Priv(activeMenu) eq $menu \
+ && $Priv(activeItem) eq [$menu index active]} {
return
}
@@ -1296,6 +1342,7 @@ proc ::tk_popup {menu x y {entry {}}} {
tk::SaveGrabInfo $menu
grab -global $menu
set Priv(popup) $menu
+ set Priv(menuActivated) 1
tk_menuSetFocus $menu
}
}
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 2a22d54..ed1f4fe 100644
--- a/library/msgbox.tcl
+++ b/library/msgbox.tcl
@@ -143,6 +143,7 @@ proc ::tk::MessageBox {args} {
#
set specs {
{-default "" "" ""}
+ {-detail "" "" ""}
{-icon "" "" "info"}
{-message "" "" ""}
{-parent "" "" .}
@@ -156,7 +157,7 @@ proc ::tk::MessageBox {args} {
error "bad -icon value \"$data(-icon)\": must be error, info, question, or warning"
}
set windowingsystem [tk windowingsystem]
- if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
switch -- $data(-icon) {
"error" {set data(-icon) "stop"}
"warning" {set data(-icon) "caution"}
@@ -241,16 +242,17 @@ proc ::tk::MessageBox {args} {
set w .__tk__messagebox
}
+ # There is only one background colour for the whole dialog
+ set bg [ttk::style lookup . -background]
+
# 3. Create the top-level window and divide it into top
# and bottom parts.
catch {destroy $w}
- toplevel $w -class Dialog
+ toplevel $w -class Dialog -bg $bg
wm title $w $data(-title)
wm iconname $w Dialog
wm protocol $w WM_DELETE_WINDOW [list $w.$cancel invoke]
- # There is only one background colour for the whole dialog
- set bg [$w cget -background]
# Message boxes should be transient with respect to their parent so that
# they always stay on top of the parent window. But some window managers
@@ -263,38 +265,42 @@ proc ::tk::MessageBox {args} {
wm transient $w $data(-parent)
}
- if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
::tk::unsupported::MacWindowStyle style $w moveableModal {}
} elseif {$windowingsystem eq "x11"} {
wm attributes $w -type dialog
}
- frame $w.bot -background $bg
+ ttk::frame $w.bot;# -background $bg
+ grid anchor $w.bot center
pack $w.bot -side bottom -fill both
- frame $w.top -background $bg
+ ttk::frame $w.top;# -background $bg
pack $w.top -side top -fill both -expand 1
- if {$windowingsystem ne "classic" && $windowingsystem ne "aqua"} {
- $w.bot configure -relief raised -bd 1
- $w.top configure -relief raised -bd 1
+ if {$windowingsystem ne "aqua"} {
+ #$w.bot configure -relief raised -bd 1
+ #$w.top configure -relief raised -bd 1
}
- # 4. Fill the top part with bitmap and message (use the option
- # database for -wraplength and -font so that they can be
+ # 4. Fill the top part with bitmap, message and detail (use the
+ # option database for -wraplength and -font so that they can be
# overridden by the caller).
option add *Dialog.msg.wrapLength 3i widgetDefault
- if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
- option add *Dialog.msg.font system widgetDefault
- } else {
- option add *Dialog.msg.font {Times 14} widgetDefault
+ option add *Dialog.dtl.wrapLength 3i widgetDefault
+ option add *Dialog.msg.font TkCaptionFont widgetDefault
+ option add *Dialog.dtl.font TkDefaultFont widgetDefault
+
+ ttk::label $w.msg -anchor nw -justify left -text $data(-message)
+ #-background $bg
+ if {$data(-detail) ne ""} {
+ ttk::label $w.dtl -anchor nw -justify left -text $data(-detail)
+ #-background $bg
}
-
- label $w.msg -anchor nw -justify left -text $data(-message) \
- -background $bg
if {$data(-icon) ne ""} {
- if {($windowingsystem eq "classic" || $windowingsystem eq "aqua")
+ if {$windowingsystem eq "aqua"
|| ([winfo depth $w] < 4) || $tk_strictMotif} {
- label $w.bitmap -bitmap $data(-icon) -background $bg
+ # ttk::label has no -bitmap option
+ label $w.bitmap -bitmap $data(-icon);# -background $bg
} else {
canvas $w.bitmap -width 32 -height 32 -highlightthickness 0 \
-background $bg
@@ -333,7 +339,12 @@ proc ::tk::MessageBox {args} {
}
grid $w.bitmap $w.msg -in $w.top -sticky news -padx 2m -pady 2m
grid columnconfigure $w.top 1 -weight 1
- grid rowconfigure $w.top 0 -weight 1
+ if {$data(-detail) ne ""} {
+ grid ^ $w.dtl -in $w.top -sticky news -padx 2m -pady {0 2m}
+ grid rowconfigure $w.top 1 -weight 1
+ } else {
+ grid rowconfigure $w.top 0 -weight 1
+ }
# 5. Create a row of buttons at the bottom of the dialog.
@@ -347,8 +358,9 @@ proc ::tk::MessageBox {args} {
set opts [list -text $capName]
}
- eval [list tk::AmpWidget button $w.$name -padx 3m] $opts \
+ eval [list tk::AmpWidget ttk::button $w.$name] $opts \
[list -command [list set tk::Priv(button) $name]]
+ # -padx 3m
if {$name eq $data(-default)} {
$w.$name configure -default active
@@ -358,7 +370,7 @@ proc ::tk::MessageBox {args} {
grid $w.$name -in $w.bot -row 0 -column $i -padx 3m -pady 2m -sticky ew
grid columnconfigure $w.bot $i -uniform buttons
# We boost the size of some Mac buttons for l&f
- if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
set tmp [string tolower $name]
if {$tmp eq "ok" || $tmp eq "cancel" || $tmp eq "yes" ||
$tmp eq "no" || $tmp eq "abort" || $tmp eq "retry" ||
@@ -382,28 +394,31 @@ proc ::tk::MessageBox {args} {
if {$data(-default) ne ""} {
bind $w <FocusIn> {
- if {"Button" eq [winfo class %W]} {
+ if {[winfo class %W] in "Button TButton"} {
%W configure -default active
}
}
bind $w <FocusOut> {
- if {"Button" eq [winfo class %W]} {
+ if {[winfo class %W] in "Button TButton"} {
%W configure -default normal
}
}
}
- # 6. Create bindings for <Return> and <Escape> on the dialog
+ # 6. Create bindings for <Return>, <Escape> and <Destroy> on the dialog
bind $w <Return> {
- if {"Button" eq [winfo class %W]} {
- tk::ButtonInvoke %W
+ if {[winfo class %W] in "Button TButton"} {
+ %W invoke
}
}
# Invoke the designated cancelling operation
bind $w <Escape> [list $w.$cancel invoke]
+ # At <Destroy> the buttons have vanished, so must do this directly.
+ bind $w.msg <Destroy> [list set tk::Priv(button) $cancel]
+
# 7. Withdraw the window, then update all the geometry information
# so we know how big it wants to be, then center the window in the
# display and de-iconify it.
@@ -426,8 +441,11 @@ proc ::tk::MessageBox {args} {
# restore any grab that was in effect.
vwait ::tk::Priv(button)
+ # Copy the result now so any <Destroy> that happens won't cause
+ # trouble
+ set result $Priv(button)
::tk::RestoreFocusGrab $w $focus
- return $Priv(button)
+ return $result
}
diff --git a/library/msgs/cs.msg b/library/msgs/cs.msg
index e4014a3..cd86ca9 100644
--- a/library/msgs/cs.msg
+++ b/library/msgs/cs.msg
@@ -1,61 +1,75 @@
namespace eval ::tk {
::msgcat::mcset cs "&Abort" "&P\u0159eru\u0161it"
+ ::msgcat::mcset cs "&About..." "&O programu..."
+ ::msgcat::mcset cs "&Blue" "&Modr\341"
+ ::msgcat::mcset cs "&Cancel" "&Zru\u0161it"
+ ::msgcat::mcset cs "&Clear Console" "&Smazat konzolu"
+ ::msgcat::mcset cs "&Copy" "&Kop\355rovat"
+ ::msgcat::mcset cs "&Delete" "&Smazat"
+ ::msgcat::mcset cs "&Directory:" "&Adres\341\u0159:"
+ ::msgcat::mcset cs "&Edit" "&\332pravy"
+ ::msgcat::mcset cs "&File" "&Soubor"
+ ::msgcat::mcset cs "&Filter" "&Filtr"
+ ::msgcat::mcset cs "&Green" "Ze&len\341"
+ ::msgcat::mcset cs "&Help" "&N\341pov\u011bda"
+ ::msgcat::mcset cs "&Hide Console" "&Schovat Konzolu"
+ ::msgcat::mcset cs "&Ignore" "&Ignorovat"
+ ::msgcat::mcset cs "&No" "&Ne"
+ ::msgcat::mcset cs "&OK"
+ ::msgcat::mcset cs "&Open" "&Otev\u0159\355t"
+ ::msgcat::mcset cs "&Quit" "&Ukon\u010dit"
+ ::msgcat::mcset cs "&Red" "\u010ce&rven\341"
+ ::msgcat::mcset cs "&Retry" "Z&novu"
+ ::msgcat::mcset cs "&Save" "&Ulo\u017eit"
+ ::msgcat::mcset cs "&Selection:" "&V\375b\u011br:"
+ ::msgcat::mcset cs "&Source..." "&Zdroj..."
+ ::msgcat::mcset cs "&Yes" "&Ano"
::msgcat::mcset cs "About..." "O programu..."
::msgcat::mcset cs "All Files" "V\u0161echny soubory"
::msgcat::mcset cs "Application Error" "Chyba programu"
- ::msgcat::mcset cs "&Blue" "&Modr\341"
- ::msgcat::mcset cs "&Cancel" "&Zru\u0161it"
::msgcat::mcset cs "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nemohu zm\u011bnit atku\341ln\355 adres\341\u0159 na \"%1\$s\".\nP\u0159\355stup odm\355tnut."
::msgcat::mcset cs "Choose Directory" "V\375b\u011br adres\341\u0159e"
+ ::msgcat::mcset cs "Cl&ear" "Sma&zat"
::msgcat::mcset cs "Clear" "Smazat"
::msgcat::mcset cs "Color" "Barva"
::msgcat::mcset cs "Console" "Konzole"
::msgcat::mcset cs "Copy" "Kop\355rovat"
+ ::msgcat::mcset cs "Cu&t" "V&y\u0159\355znout"
::msgcat::mcset cs "Cut" "Vy\u0159\355znout"
::msgcat::mcset cs "Delete" "Smazat"
::msgcat::mcset cs "Details >>" "Detaily >>"
::msgcat::mcset cs "Directory \"%1\$s\" does not exist." "Adres\341\u0159 \"%1\$s\" neexistuje."
- ::msgcat::mcset cs "&Directory:" "&Adres\341\u0159:"
+ ::msgcat::mcset cs "E&xit" "&Konec"
::msgcat::mcset cs "Error: %1\$s" "Chyba: %1\$s"
::msgcat::mcset cs "Exit" "Konec"
+ ::msgcat::mcset cs "Fi&les:" "Sou&bory:"
+ ::msgcat::mcset cs "Fil&ter:" "Fil&tr:"
::msgcat::mcset cs "File \"%1\$s\" already exists.\n\n" "Soubor \"%1\$s\" ji\u017e existuje.\n\n"
::msgcat::mcset cs "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Soubor \"%1\$s\" ji\u017e existuje.\nChcete jej p\u0159epsat?"
::msgcat::mcset cs "File \"%1\$s\" does not exist." "Soubor \"%1\$s\" neexistuje."
::msgcat::mcset cs "File &name:" "&Jm\351no souboru:"
::msgcat::mcset cs "File &names:" "&Jm\351na soubor\u016f:"
::msgcat::mcset cs "Files of &type:" "&Typy soubor\u016f:"
- ::msgcat::mcset cs "Fi&les:" "Sou&bory:"
- ::msgcat::mcset cs "&Filter" "&Filtr"
- ::msgcat::mcset cs "Fil&ter:" "Fil&tr:"
- ::msgcat::mcset cs "&Green" "Ze&len\341"
- ::msgcat::mcset cs "Hi"
+ ::msgcat::mcset cs "Hi" "Ahoj"
::msgcat::mcset cs "Hide Console" "Skr\375t konsolu"
- ::msgcat::mcset cs "&Ignore" "&Ignorovat"
::msgcat::mcset cs "Invalid file name \"%1\$s\"." "\u0160patn\351 jm\351no souboru \"%1\$s\"."
::msgcat::mcset cs "Log Files" "Log soubory"
- ::msgcat::mcset cs "&No" "&Ne"
- ::msgcat::mcset cs "&OK"
::msgcat::mcset cs "Ok"
::msgcat::mcset cs "Open" "Otev\u0159\355t"
- ::msgcat::mcset cs "&Open" "&Otev\u0159\355t"
::msgcat::mcset cs "Open Multiple Files" "Otev\u0159\355t v\355ce soubor\u016f"
+ ::msgcat::mcset cs "P&aste" "&Vlo\u017eit"
::msgcat::mcset cs "Paste" "Vlo\u017eit"
::msgcat::mcset cs "Quit" "Skon\u010dit"
- ::msgcat::mcset cs "&Red" " \u010ce&rven\341"
::msgcat::mcset cs "Replace existing file?" "Nahradit st\341vaj\355c\355 soubor?"
- ::msgcat::mcset cs "&Retry" "Z&novu"
- ::msgcat::mcset cs "&Save" "&Ulo\u017eit"
::msgcat::mcset cs "Save As" "Ulo\u017eit jako"
::msgcat::mcset cs "Save To Log" "Ulo\u017eit do logu"
::msgcat::mcset cs "Select Log File" "Vybrat log soubor"
::msgcat::mcset cs "Select a file to source" "Vybrat soubor k nahr\341n\355"
- ::msgcat::mcset cs "&Selection:" "&V\375b\u011br:"
::msgcat::mcset cs "Skip Messages" "P\u0159esko\u010dit zpr\341vy"
::msgcat::mcset cs "Source..." "Nahr\341t..."
::msgcat::mcset cs "Tcl Scripts" "Tcl skripty"
::msgcat::mcset cs "Tcl for Windows" "Tcl pro Windows"
::msgcat::mcset cs "Text Files" "Textov\351 soubory"
- ::msgcat::mcset cs "&Yes" "&Ano"
::msgcat::mcset cs "abort" "p\u0159eru\u0161it"
::msgcat::mcset cs "blue" "modr\341"
::msgcat::mcset cs "cancel" "zru\u0161it"
diff --git a/library/msgs/da.msg b/library/msgs/da.msg
new file mode 100644
index 0000000..c749608
--- /dev/null
+++ b/library/msgs/da.msg
@@ -0,0 +1,77 @@
+namespace eval ::tk {
+ ::msgcat::mcset da "&Abort" "&Afbryd"
+ ::msgcat::mcset da "&About..." "&Om..."
+ ::msgcat::mcset da "All Files" "Alle filer"
+ ::msgcat::mcset da "Application Error" "Programfejl"
+ ::msgcat::mcset da "&Blue" "&Bl\u00E5"
+ ::msgcat::mcset da "&Cancel" "&Annuller"
+ ::msgcat::mcset da "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ikke skifte til katalog \"%1\$s\".\nIngen rettigheder."
+ ::msgcat::mcset da "Choose Directory" "V\u00E6lg katalog"
+ ::msgcat::mcset da "&Clear" "&Ryd"
+ ::msgcat::mcset da "&Clear Console" "&Ryd konsolen"
+ ::msgcat::mcset da "Color" "Farve"
+ ::msgcat::mcset da "Console" "Konsol"
+ ::msgcat::mcset da "&Copy" "&Kopier"
+ ::msgcat::mcset da "Cu&t" "Kli&p"
+ ::msgcat::mcset da "&Delete" "&Slet"
+ ::msgcat::mcset da "Details >>" "Detailer"
+ ::msgcat::mcset da "Directory \"%1\$s\" does not exist." "Katalog \"%1\$s\" findes ikke."
+ ::msgcat::mcset da "&Directory:" "&Katalog:"
+ ::msgcat::mcset da "&Edit" "&Rediger"
+ ::msgcat::mcset da "Error: %1\$s" "Fejl: %1\$s"
+ ::msgcat::mcset da "E&xit" "&Afslut"
+ ::msgcat::mcset da "&File" "&Fil"
+ ::msgcat::mcset da "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Filen \"%1\$s\" findes allerede.\nSkal den overskrives?"
+ ::msgcat::mcset da "File \"%1\$s\" already exists.\n\n" "Filen \"%1\$s\" findes allerede.\n\n"
+ ::msgcat::mcset da "File \"%1\$s\" does not exist." "Filen \"%1\$s\" findes ikke."
+ ::msgcat::mcset da "File &name:" "Fil&navn:"
+ ::msgcat::mcset da "File &names:" "Fil&navne:"
+ ::msgcat::mcset da "Files of &type:" "Fil&typer:"
+ ::msgcat::mcset da "Fi&les:" "Fi&ler:"
+ ::msgcat::mcset da "&Filter"
+ ::msgcat::mcset da "Fil&ter:"
+ ::msgcat::mcset da "&Green" "&Gr\u00F8n"
+ ::msgcat::mcset da "&Help" "&Hj\u00E6lp"
+ ::msgcat::mcset da "Hi" "Hej"
+ ::msgcat::mcset da "&Hide Console" "Skjul &konsol"
+ ::msgcat::mcset da "&Ignore" "&Ignorer"
+ ::msgcat::mcset da "Invalid file name \"%1\$s\"." "Ugyldig fil navn \"%1\$s\"."
+ ::msgcat::mcset da "Log Files" "Logfiler"
+ ::msgcat::mcset da "&No" "&Nej"
+ ::msgcat::mcset da "OK" "O.K."
+ ::msgcat::mcset da "&OK" "&O.K."
+ ::msgcat::mcset da "Ok"
+ ::msgcat::mcset da "Open" "\u00C5bn"
+ ::msgcat::mcset da "&Open" "&\u00C5bn"
+ ::msgcat::mcset da "Open Multiple Files" "\u00C5bn flere filer"
+ ::msgcat::mcset da "P&aste" "&Inds\u00E6t"
+ ::msgcat::mcset da "&Quit" "&Afslut"
+ ::msgcat::mcset da "&Red" "&R\u00F8d"
+ ::msgcat::mcset da "Replace existing file?" "Erstat eksisterende fil?"
+ ::msgcat::mcset da "&Retry" "&Gentag"
+ ::msgcat::mcset da "&Save" "&Gem"
+ ::msgcat::mcset da "Save As" "Gem som"
+ ::msgcat::mcset da "Save To Log" "Gem i log"
+ ::msgcat::mcset da "Select Log File" "V\u00E6lg logfil"
+ ::msgcat::mcset da "Select a file to source" "V\u00E6lg k\u00F8rbar fil"
+ ::msgcat::mcset da "&Selection:" "&Udvalg:"
+ ::msgcat::mcset da "Show &Hidden Directories" "Vis &skjulte kataloger"
+ ::msgcat::mcset da "Show &Hidden Files and Directories" "Vis &skjulte filer og kataloger"
+ ::msgcat::mcset da "Skip Messages" "Overspring beskeder"
+ ::msgcat::mcset da "&Source..." "&K\u00F8r..."
+ ::msgcat::mcset da "Tcl Scripts" "Tcl-Skripter"
+ ::msgcat::mcset da "Tcl for Windows" "Tcl for Windows"
+ ::msgcat::mcset da "Text Files" "Tekstfiler"
+ ::msgcat::mcset da "&Yes" "&Ja"
+ ::msgcat::mcset da "abort" "afbryd"
+ ::msgcat::mcset da "blue" "bl\u00E5"
+ ::msgcat::mcset da "cancel" "afbryd"
+ ::msgcat::mcset da "extension"
+ ::msgcat::mcset da "extensions"
+ ::msgcat::mcset da "green" "gr\u00F8n"
+ ::msgcat::mcset da "ignore" "ignorer"
+ ::msgcat::mcset da "ok"
+ ::msgcat::mcset da "red" "r\u00F8d"
+ ::msgcat::mcset da "retry" "gentag"
+ ::msgcat::mcset da "yes" "ja"
+}
diff --git a/library/msgs/de.msg b/library/msgs/de.msg
index c5ae689..7750313 100644
--- a/library/msgs/de.msg
+++ b/library/msgs/de.msg
@@ -1,23 +1,26 @@
namespace eval ::tk {
::msgcat::mcset de "&Abort" "&Abbruch"
- ::msgcat::mcset de "About..." "\u00dcber..."
+ ::msgcat::mcset de "&About..." "&\u00dcber..."
::msgcat::mcset de "All Files" "Alle Dateien"
::msgcat::mcset de "Application Error" "Applikationsfehler"
::msgcat::mcset de "&Blue" "&Blau"
::msgcat::mcset de "&Cancel" "&Abbruch"
::msgcat::mcset de "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kann nicht in das Verzeichnis \"%1\$s\" wechseln.\nKeine Rechte vorhanden."
::msgcat::mcset de "Choose Directory" "W\u00e4hle Verzeichnis"
- ::msgcat::mcset de "Clear" "R\u00fccksetzen"
+ ::msgcat::mcset de "Cl&ear" "&R\u00fccksetzen"
+ ::msgcat::mcset de "&Clear Console" "&Konsole l\u00f6schen"
::msgcat::mcset de "Color" "Farbe"
::msgcat::mcset de "Console" "Konsole"
- ::msgcat::mcset de "Copy" "Kopieren"
- ::msgcat::mcset de "Cut" "Ausschneiden"
- ::msgcat::mcset de "Delete" "L\u00f6schen"
+ ::msgcat::mcset de "&Copy" "&Kopieren"
+ ::msgcat::mcset de "Cu&t" "Aus&schneiden"
+ ::msgcat::mcset de "&Delete" "&L\u00f6schen"
::msgcat::mcset de "Details >>"
::msgcat::mcset de "Directory \"%1\$s\" does not exist." "Das Verzeichnis \"%1\$s\" existiert nicht."
::msgcat::mcset de "&Directory:" "&Verzeichnis:"
+ ::msgcat::mcset de "&Edit" "&Bearbeiten"
::msgcat::mcset de "Error: %1\$s" "Fehler: %1\$s"
- ::msgcat::mcset de "Exit" "Ende"
+ ::msgcat::mcset de "E&xit" "&Ende"
+ ::msgcat::mcset de "&File" "&Datei"
::msgcat::mcset de "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Die Datei \"%1\$s\" ist bereits vorhanden.\nWollen sie diese Datei \u00fcberschreiben ?"
::msgcat::mcset de "File \"%1\$s\" already exists.\n\n" "Die Datei \"%1\$s\" ist bereits vorhanden.\n\n"
::msgcat::mcset de "File \"%1\$s\" does not exist." "Die Datei \"%1\$s\" existiert nicht."
@@ -28,19 +31,20 @@ namespace eval ::tk {
::msgcat::mcset de "&Filter"
::msgcat::mcset de "Fil&ter:"
::msgcat::mcset de "&Green" "&Gr\u00fcn"
+ ::msgcat::mcset de "&Help" "&Hilfe"
::msgcat::mcset de "Hi" "Hallo"
- ::msgcat::mcset de "Hide Console" "Konsole unsichtbar machen"
+ ::msgcat::mcset de "&Hide Console" "&Konsole unsichtbar machen"
::msgcat::mcset de "&Ignore" "&Ignorieren"
::msgcat::mcset de "Invalid file name \"%1\$s\"." "Ung\u00fcltiger Dateiname \"%1\$s\"."
::msgcat::mcset de "Log Files" "Protokolldatei"
::msgcat::mcset de "&No" "&Nein"
- ::msgcat::mcset de "OK"
+ ::msgcat::mcset de "&OK"
::msgcat::mcset de "Ok"
::msgcat::mcset de "Open" "\u00d6ffnen"
::msgcat::mcset de "&Open" "\u00d6&ffnen"
- ::msgcat::mcset de "Open Multiple Files"
- ::msgcat::mcset de "Paste" "Einf\u00fcgen"
- ::msgcat::mcset de "Quit" "Beenden"
+ ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien \u00F6ffnen"
+ ::msgcat::mcset de "P&aste" "E&inf\u00fcgen"
+ ::msgcat::mcset de "&Quit" "&Beenden"
::msgcat::mcset de "&Red" "&Rot"
::msgcat::mcset de "Replace existing file?" "Existierende Datei ersetzen?"
::msgcat::mcset de "&Retry" "&Wiederholen"
@@ -50,8 +54,10 @@ namespace eval ::tk {
::msgcat::mcset de "Select Log File" "Protokolldatei ausw\u00e4hlen"
::msgcat::mcset de "Select a file to source" "Auszuf\u00fchrende Datei ausw\u00e4hlen"
::msgcat::mcset de "&Selection:" "Auswah&l:"
+ ::msgcat::mcset de "Show &Hidden Directories" "Zeige versteckte Dateien"
+ ::msgcat::mcset de "Show &Hidden Files and Directories" "Zeige versteckte Dateien und Verzeichnisse"
::msgcat::mcset de "Skip Messages" "Weitere Nachrichten \u00fcberspringen"
- ::msgcat::mcset de "Source..." "Ausf\u00fchren..."
+ ::msgcat::mcset de "&Source..." "&Ausf\u00fchren..."
::msgcat::mcset de "Tcl Scripts" "Tcl-Skripte"
::msgcat::mcset de "Tcl for Windows" "Tcl f\u00fcr Windows"
::msgcat::mcset de "Text Files" "Textdateien"
diff --git a/library/msgs/el.msg b/library/msgs/el.msg
index 2e96cd9..1dcc451 100644
--- a/library/msgs/el.msg
+++ b/library/msgs/el.msg
@@ -65,7 +65,7 @@ namespace eval ::tk {
::msgcat::mcset el "Select a file to source" \
"\u0395\u03c0\u03b9\u03bb\u03ad\u03be\u03c4\u03b5 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03b3\u03b9\u03b1 \u03b5\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7"
::msgcat::mcset el "&Selection:" "\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae:"
- ::msgcat::mcset el "Skip Messages" "\u0391\u03c0\u03bf\u03c6\u03c5\u03b3\u03ae \u03bc\u03c5\u03bd\u03b7\u03bc\u03ac\u03c4\u03c9\u03bd"
+ ::msgcat::mcset el "Skip Messages" "\u0391\u03c0\u03bf\u03c6\u03c5\u03b3\u03ae\u03bc\u03b7\u03bd\u03c5\u03bc\u03ac\u03c4\u03c9\u03bd"
::msgcat::mcset el "Source..." "\u0395\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7..."
::msgcat::mcset el "Tcl Scripts" "Tcl Scripts"
::msgcat::mcset el "Tcl for Windows" "Tcl \u03b3\u03b9\u03b1 Windows"
diff --git a/library/msgs/en.msg b/library/msgs/en.msg
index 7242f91..b4e51bf 100644
--- a/library/msgs/en.msg
+++ b/library/msgs/en.msg
@@ -1,23 +1,26 @@
namespace eval ::tk {
::msgcat::mcset en "&Abort"
- ::msgcat::mcset en "About..."
+ ::msgcat::mcset en "&About..."
::msgcat::mcset en "All Files"
::msgcat::mcset en "Application Error"
::msgcat::mcset en "&Blue"
::msgcat::mcset en "&Cancel"
::msgcat::mcset en "Cannot change to the directory \"%1\$s\".\nPermission denied."
::msgcat::mcset en "Choose Directory"
- ::msgcat::mcset en "Clear"
+ ::msgcat::mcset en "Cl&ear"
+ ::msgcat::mcset en "&Clear Console"
::msgcat::mcset en "Color"
::msgcat::mcset en "Console"
- ::msgcat::mcset en "Copy"
- ::msgcat::mcset en "Cut"
- ::msgcat::mcset en "Delete"
+ ::msgcat::mcset en "&Copy"
+ ::msgcat::mcset en "Cu&t"
+ ::msgcat::mcset en "&Delete"
::msgcat::mcset en "Details >>"
::msgcat::mcset en "Directory \"%1\$s\" does not exist."
::msgcat::mcset en "&Directory:"
+ ::msgcat::mcset en "&Edit"
::msgcat::mcset en "Error: %1\$s"
- ::msgcat::mcset en "Exit"
+ ::msgcat::mcset en "E&xit"
+ ::msgcat::mcset en "&File"
::msgcat::mcset en "File \"%1\$s\" already exists.\nDo you want to overwrite it?"
::msgcat::mcset en "File \"%1\$s\" already exists.\n\n"
::msgcat::mcset en "File \"%1\$s\" does not exist."
@@ -28,8 +31,9 @@ namespace eval ::tk {
::msgcat::mcset en "&Filter"
::msgcat::mcset en "Fil&ter:"
::msgcat::mcset en "&Green"
+ ::msgcat::mcset en "&Help"
::msgcat::mcset en "Hi"
- ::msgcat::mcset en "Hide Console"
+ ::msgcat::mcset en "&Hide Console"
::msgcat::mcset en "&Ignore"
::msgcat::mcset en "Invalid file name \"%1\$s\"."
::msgcat::mcset en "Log Files"
@@ -39,8 +43,8 @@ namespace eval ::tk {
::msgcat::mcset en "Open"
::msgcat::mcset en "&Open"
::msgcat::mcset en "Open Multiple Files"
- ::msgcat::mcset en "Paste"
- ::msgcat::mcset en "Quit"
+ ::msgcat::mcset en "P&aste"
+ ::msgcat::mcset en "&Quit"
::msgcat::mcset en "&Red"
::msgcat::mcset en "Replace existing file?"
::msgcat::mcset en "&Retry"
@@ -50,8 +54,10 @@ namespace eval ::tk {
::msgcat::mcset en "Select Log File"
::msgcat::mcset en "Select a file to source"
::msgcat::mcset en "&Selection:"
+ ::msgcat::mcset en "Show &Hidden Directories"
+ ::msgcat::mcset en "Show &Hidden Files and Directories"
::msgcat::mcset en "Skip Messages"
- ::msgcat::mcset en "Source..."
+ ::msgcat::mcset en "&Source..."
::msgcat::mcset en "Tcl Scripts"
::msgcat::mcset en "Tcl for Windows"
::msgcat::mcset en "Text Files"
diff --git a/library/msgs/es.msg b/library/msgs/es.msg
index 29e5cc6..ceb12d6 100644
--- a/library/msgs/es.msg
+++ b/library/msgs/es.msg
@@ -1,24 +1,27 @@
namespace eval ::tk {
::msgcat::mcset es "&Abort" "&Abortar"
- ::msgcat::mcset es "About..." "Acerca de ..."
- ::msgcat::mcset es "All Files" "Todos los archivos"
+ ::msgcat::mcset es "&About..." "&Acerca de ..."
+ ::msgcat::mcset es "All Files" "Todos los archivos"
::msgcat::mcset es "Application Error" "Error de la aplicaci\u00f3n"
::msgcat::mcset es "&Blue" "&Azul"
::msgcat::mcset es "&Cancel" "&Cancelar"
::msgcat::mcset es "Cannot change to the directory \"%1\$s\".\nPermission denied." "No es posible acceder al directorio \"%1\$s\".\nPermiso denegado."
::msgcat::mcset es "Choose Directory" "Elegir directorio"
- ::msgcat::mcset es "Clear" "Borrar"
+ ::msgcat::mcset es "Cl&ear" "&Borrar"
+ ::msgcat::mcset es "&Clear Console" "&Borrar consola"
::msgcat::mcset es "Color" "Color"
::msgcat::mcset es "Console" "Consola"
- ::msgcat::mcset es "Copy" "Copiar"
- ::msgcat::mcset es "Cut" "Cortar"
- ::msgcat::mcset es "Delete" "Borrar"
+ ::msgcat::mcset es "&Copy" "&Copiar"
+ ::msgcat::mcset es "Cu&t" "Cor&tar"
+ ::msgcat::mcset es "&Delete" "&Borrar"
::msgcat::mcset es "Details >>" "Detalles >>"
::msgcat::mcset es "Directory \"%1\$s\" does not exist." "El directorio \"%1\$s\" no existe."
::msgcat::mcset es "&Directory:" "&Directorio:"
+ ::msgcat::mcset es "&Edit" "&Editar"
::msgcat::mcset es "Error: %1\$s" "Error: %1\$s"
- ::msgcat::mcset es "Exit" "Salir"
- ::msgcat::mcset es "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "El archivo \"%1\$s\" ya existe.\nDesea sobreescribirlo?"
+ ::msgcat::mcset es "E&xit" "Salir"
+ ::msgcat::mcset es "&File" "&Archivo"
+ ::msgcat::mcset es "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "El archivo \"%1\$s\" ya existe.\n\u00bfDesea sobreescribirlo?"
::msgcat::mcset es "File \"%1\$s\" already exists.\n\n" "El archivo \"%1\$s\" ya existe.\n\n"
::msgcat::mcset es "File \"%1\$s\" does not exist." "El archivo \"%1\$s\" no existe."
::msgcat::mcset es "File &name:" "&Nombre de archivo:"
@@ -28,30 +31,31 @@ namespace eval ::tk {
::msgcat::mcset es "&Filter" "&Filtro"
::msgcat::mcset es "Fil&ter:" "Fil&tro:"
::msgcat::mcset es "&Green" "&Verde"
- ::msgcat::mcset es "Hi" "Hola"
- ::msgcat::mcset es "Hide Console" "Esconder la consola"
+ ::msgcat::mcset es "&Help" "&Ayuda"
+ ::msgcat::mcset es "Hi" "Hola"
+ ::msgcat::mcset es "&Hide Console" "&Esconder la consola"
::msgcat::mcset es "&Ignore" "&Ignorar"
::msgcat::mcset es "Invalid file name \"%1\$s\"." "Nombre de archivo inv\u00e1lido \"%1\$s\"."
- ::msgcat::mcset es "Log Files" "Ficheros de traza"
+ ::msgcat::mcset es "Log Files" "Ficheros de traza"
::msgcat::mcset es "&No" "&No"
::msgcat::mcset es "&OK" "&OK"
::msgcat::mcset es "Ok" "Ok"
::msgcat::mcset es "Open" "Abrir"
::msgcat::mcset es "&Open" "&Abrir"
::msgcat::mcset es "Open Multiple Files" "Abrir m\u00faltiples archivos"
- ::msgcat::mcset es "Paste" "Pegar"
- ::msgcat::mcset es "Quit" "Abandonar"
+ ::msgcat::mcset es "P&aste" "Peg&ar"
+ ::msgcat::mcset es "&Quit" "&Abandonar"
::msgcat::mcset es "&Red" "&Rojo"
- ::msgcat::mcset es "Replace existing file?" "Reemplazar el archivo existente?"
+ ::msgcat::mcset es "Replace existing file?" "\u00bfReemplazar el archivo existente?"
::msgcat::mcset es "&Retry" "&Reintentar"
::msgcat::mcset es "&Save" "&Guardar"
::msgcat::mcset es "Save As" "Guardar como"
::msgcat::mcset es "Save To Log" "Guardar al archivo de traza"
- ::msgcat::mcset es "Select Log File" "Elegir un archivo de traza"
+ ::msgcat::mcset es "Select Log File" "Elegir un archivo de traza"
::msgcat::mcset es "Select a file to source" "Seleccionar un archivo a evaluar"
::msgcat::mcset es "&Selection:" "&Selecci\u00f3n:"
::msgcat::mcset es "Skip Messages" "Omitir los mensajes"
- ::msgcat::mcset es "Source..." "Evaluar..."
+ ::msgcat::mcset es "&Source..." "E&valuar..."
::msgcat::mcset es "Tcl Scripts" "Scripts Tcl"
::msgcat::mcset es "Tcl for Windows" "Tcl para Windows"
::msgcat::mcset es "Text Files" "Archivos de texto"
@@ -59,7 +63,7 @@ namespace eval ::tk {
::msgcat::mcset es "abort" "abortar"
::msgcat::mcset es "blue" "azul"
::msgcat::mcset es "cancel" "cancelar"
- ::msgcat::mcset es "extension" "extensi\u00f3n"
+ ::msgcat::mcset es "extension" "extensi\u00f3n"
::msgcat::mcset es "extensions" "extensiones"
::msgcat::mcset es "green" "verde"
::msgcat::mcset es "ignore" "ignorar"
diff --git a/library/msgs/hu.msg b/library/msgs/hu.msg
index 636c2cd..fc4700f 100644
--- a/library/msgs/hu.msg
+++ b/library/msgs/hu.msg
@@ -9,16 +9,19 @@ namespace eval ::tk {
::msgcat::mcset hu "Cannot change to the directory \"%1\$s\".\nPermission denied." "A k\u00f6nyvt\u00e1rv\u00e1lt\u00e1s nem siker\u00fclt: \"%1\$s\".\nHozz\u00e1f\u00e9r\u00e9s megtagadva."
::msgcat::mcset hu "Choose Directory" "K\u00f6nyvt\u00e1r kiv\u00e1laszt\u00e1sa"
::msgcat::mcset hu "Clear" "T\u00f6rl\u00e9s"
+ ::msgcat::mcset hu "&Clear Console" "&T\u00f6rl\u00e9s Konzol"
::msgcat::mcset hu "Color" "Sz\u00edn"
::msgcat::mcset hu "Console" "Konzol"
- ::msgcat::mcset hu "Copy" "M\u00e1sol\u00e1s"
- ::msgcat::mcset hu "Cut" "Kiv\u00e1g\u00e1s"
- ::msgcat::mcset hu "Delete" "T\u00f6rl\u00e9s"
+ ::msgcat::mcset hu "&Copy" "&M\u00e1sol\u00e1s"
+ ::msgcat::mcset hu "Cu&t" "&Kiv\u00e1g\u00e1s"
+ ::msgcat::mcset hu "&Delete" "&T\u00f6rl\u00e9s"
::msgcat::mcset hu "Details >>" "R\u00e9szletek >>"
::msgcat::mcset hu "Directory \"%1\$s\" does not exist." "\"%1\$s\" k\u00f6nyvt\u00e1r nem l\u00e9tezik."
::msgcat::mcset hu "&Directory:" "&K\u00f6nyvt\u00e1r:"
+ #::msgcat::mcset hu "&Edit"
::msgcat::mcset hu "Error: %1\$s" "Hiba: %1\$s"
- ::msgcat::mcset hu "Exit" "Kil\u00e9p\u00e9s"
+ ::msgcat::mcset hu "E&xit" "Kil\u00e9p\u00e9s"
+ ::msgcat::mcset hu "&File" "&F\u00e1jl"
::msgcat::mcset hu "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "\"%1\$s\" f\u00e1jl m\u00e1r l\u00e9tezik.\nFel\u00fcl\u00edrjam?"
::msgcat::mcset hu "File \"%1\$s\" already exists.\n\n" "\"%1\$s\" f\u00e1jl m\u00e1r l\u00e9tezik.\n\n"
::msgcat::mcset hu "File \"%1\$s\" does not exist." "\"%1\$s\" f\u00e1jl nem l\u00e9tezik."
@@ -29,20 +32,20 @@ namespace eval ::tk {
::msgcat::mcset hu "&Filter" "&Sz\u0171r\u0151"
::msgcat::mcset hu "Fil&ter:" "S&z\u0171r\u0151:"
::msgcat::mcset hu "&Green" "&Z\u00f6ld"
+ #::msgcat::mcset hu "&Help"
::msgcat::mcset hu "Hi" "\u00dcdv"
- ::msgcat::mcset hu "Hide Console" "Konzol elrejt\u00e9se"
+ ::msgcat::mcset hu "&Hide Console" "Konzol &elrejt\u00e9se"
::msgcat::mcset hu "&Ignore" "K&ihagy\u00e1s"
::msgcat::mcset hu "Invalid file name \"%1\$s\"." "\u00c9rv\u00e9nytelen f\u00e1jln\u00e9v: \"%1\$s\"."
::msgcat::mcset hu "Log Files" "Log f\u00e1jlok"
::msgcat::mcset hu "&No" "&Nem"
::msgcat::mcset hu "&OK"
::msgcat::mcset hu "OK"
- ::msgcat::mcset hu "Ok"
::msgcat::mcset hu "Open" "Megnyit\u00e1s"
::msgcat::mcset hu "&Open" "&Megnyit\u00e1s"
::msgcat::mcset hu "Open Multiple Files" "T\u00f6bb f\u00e1jl megnyit\u00e1sa"
- ::msgcat::mcset hu "Paste" "Beilleszt\u00e9s"
- ::msgcat::mcset hu "Quit" "Kil\u00e9p\u00e9s"
+ ::msgcat::mcset hu "P&aste" "&Beilleszt\u00e9s"
+ ::msgcat::mcset hu "&Quit" "&Kil\u00e9p\u00e9s"
::msgcat::mcset hu "&Red" "&V\u00f6r\u00f6s"
::msgcat::mcset hu "Replace existing file?" "Megl\u00e9v\u0151 f\u00e1jl cser\u00e9je?"
::msgcat::mcset hu "&Retry" "\u00daj&ra"
@@ -55,7 +58,7 @@ namespace eval ::tk {
::msgcat::mcset hu "Show &Hidden Directories" "&Rejtett k\u00f6nyvt\u00e1rak megjelen\u00edt\u00e9se"
::msgcat::mcset hu "Show &Hidden Files and Directories" "&Rejtett f\u00e1jlok \u00e9s k\u00f6nyvt\u00e1rak megjelen\u00edt\u00e9se"
::msgcat::mcset hu "Skip Messages" "\u00dczenetek kihagy\u00e1sa"
- ::msgcat::mcset hu "Source..." "Forr\u00e1s..."
+ ::msgcat::mcset hu "&Source..." "&Forr\u00e1s..."
::msgcat::mcset hu "Tcl Scripts" "Tcl scriptek"
::msgcat::mcset hu "Tcl for Windows" "Tcl Windows-hoz"
::msgcat::mcset hu "Text Files" "Sz\u00f6vegf\u00e1jlok"
diff --git a/library/msgs/pl.msg b/library/msgs/pl.msg
index 02e6ffc..debebcb 100644
--- a/library/msgs/pl.msg
+++ b/library/msgs/pl.msg
@@ -1,66 +1,66 @@
namespace eval ::tk {
- ::msgcat::mcset pl "&Abort" "&Anuluj"
- ::msgcat::mcset pl "&About..." "O Programie..."
+ ::msgcat::mcset pl "&Abort" "&Przerwij"
+ ::msgcat::mcset pl "&About..." "O programie..."
::msgcat::mcset pl "All Files" "Wszystkie pliki"
- ::msgcat::mcset pl "Application Error" "Bl\u0105d w Programie"
+ ::msgcat::mcset pl "Application Error" "B\u0142\u0105d w programie"
::msgcat::mcset pl "&Blue" "&Niebieski"
::msgcat::mcset pl "&Cancel" "&Anuluj"
- ::msgcat::mcset pl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Katalog \"%1\$s\" nie mo\u017ce zosta\u0107 odczytany lub nie istnieje."
+ ::msgcat::mcset pl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nie mo\u017cna otworzy\u0107 katalogu \"%1\$s\".\nOdmowa dost\u0119pu."
::msgcat::mcset pl "Choose Directory" "Wybierz katalog"
- ::msgcat::mcset pl "&Clear" "&Wyczy\u015b\u0107"
+ ::msgcat::mcset pl "Cl&ear" "&Wyczy\u015b\u0107"
::msgcat::mcset pl "&Clear Console" "&Wyczy\u015b\u0107 konsol\u0119"
::msgcat::mcset pl "Color" "Kolor"
::msgcat::mcset pl "Console" "Konsola"
::msgcat::mcset pl "&Copy" "&Kopiuj"
::msgcat::mcset pl "Cu&t" "&Wytnij"
::msgcat::mcset pl "&Delete" "&Usu\u0144"
- ::msgcat::mcset pl "Details >>" "Detale >>"
- ::msgcat::mcset pl "Directory \"%1\$s\" does not exist." "Katalog \"%1\$s\" nie istniej."
+ ::msgcat::mcset pl "Details >>" "Szczeg\u00f3\u0142y >>"
+ ::msgcat::mcset pl "Directory \"%1\$s\" does not exist." "Katalog \"%1\$s\" nie istnieje."
::msgcat::mcset pl "&Directory:" "&Katalog:"
::msgcat::mcset pl "&Edit" "&Edytuj"
::msgcat::mcset pl "Error: %1\$s" "B\u0142\u0105d: %1\$s"
- ::msgcat::mcset pl "E&xit" "&Zako\u0144cz"
+ ::msgcat::mcset pl "E&xit" "&Wyjd\u017a"
::msgcat::mcset pl "&File" "&Plik"
- ::msgcat::mcset pl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Plik \"%1\$s\" ju\u017c istnieje.\nCzy chcesz go zast\u0105pi\u0107?"
- ::msgcat::mcset pl "File \"%1\$s\" already exists.\n\n" "Plik \"%1\$s\" ju\u017c istnieje. \n\n"
+ ::msgcat::mcset pl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Plik \"%1\$s\" ju\u017c istnieje.\nCzy chcesz go nadpisa\u0107?"
+ ::msgcat::mcset pl "File \"%1\$s\" already exists.\n\n" "Plik \"%1\$s\" ju\u017c istnieje.\n\n"
::msgcat::mcset pl "File \"%1\$s\" does not exist." "Plik \"%1\$s\" nie istnieje."
::msgcat::mcset pl "File &name:" "Nazwa &pliku:"
::msgcat::mcset pl "File &names:" "Nazwy &plik\u00f3w:"
::msgcat::mcset pl "Files of &type:" "Pliki &typu:"
::msgcat::mcset pl "Fi&les:" "Pli&ki:"
- ::msgcat::mcset pl "&Filter" "&Filter"
- ::msgcat::mcset pl "Fil&ter:" "&Filter:"
+ ::msgcat::mcset pl "&Filter" "&Filtr"
+ ::msgcat::mcset pl "Fil&ter:" "&Filtr:"
::msgcat::mcset pl "&Green" "&Zielony"
::msgcat::mcset pl "&Help" "&Pomoc"
::msgcat::mcset pl "Hi" "Witaj"
- ::msgcat::mcset pl "&Hide Console" "&Schowaj konsol\u0119"
+ ::msgcat::mcset pl "&Hide Console" "&Ukryj konsol\u0119"
::msgcat::mcset pl "&Ignore" "&Ignoruj"
::msgcat::mcset pl "Invalid file name \"%1\$s\"." "Niew\u0142a\u015bciwa nazwa pliku \"%1\$s\"."
- ::msgcat::mcset pl "Log Files" "Protoko\u0142uj"
+ ::msgcat::mcset pl "Log Files" "Pliki dziennika"
::msgcat::mcset pl "&No" "&Nie"
- ::msgcat::mcset pl "OK"
- ::msgcat::mcset pl "Ok"
- ::msgcat::mcset pl "Open" "Wczytaj"
- ::msgcat::mcset pl "&Open" "&Wczytaj"
- ::msgcat::mcset pl "Open Multiple Files" "Wczytuj wiele plik\u00f3w"
+ ::msgcat::mcset pl "OK" "OK"
+ ::msgcat::mcset pl "Ok" "Ok"
+ ::msgcat::mcset pl "Open" "Otw\u00f3rz"
+ ::msgcat::mcset pl "&Open" "&Otw\u00f3rz"
+ ::msgcat::mcset pl "Open Multiple Files" "Otw\u00f3rz wiele plik\u00f3w"
::msgcat::mcset pl "P&aste" "&Wklej"
::msgcat::mcset pl "&Quit" "&Zako\u0144cz"
- ::msgcat::mcset pl "&Red" "&Czerwonz"
- ::msgcat::mcset pl "Replace existing file?" "Czy zost\u0105pi\u0107 instniej\u0105cy plik?"
- ::msgcat::mcset pl "&Retry" "&Powt\u00f3rz"
+ ::msgcat::mcset pl "&Red" "&Czerwony"
+ ::msgcat::mcset pl "Replace existing file?" "Czy zast\u0105pi\u0107 istniej\u0105cy plik?"
+ ::msgcat::mcset pl "&Retry" "&Pon\u00f3w"
::msgcat::mcset pl "&Save" "&Zapisz"
::msgcat::mcset pl "Save As" "Zapisz jako"
- ::msgcat::mcset pl "Save To Log" "Wpisz do protoko\u0142u"
- ::msgcat::mcset pl "Select Log File" "Wybierz plik proko\u0142u"
+ ::msgcat::mcset pl "Save To Log" "Wpisz do dziennika"
+ ::msgcat::mcset pl "Select Log File" "Wybierz plik dziennika"
::msgcat::mcset pl "Select a file to source" "Wybierz plik do wykonania"
::msgcat::mcset pl "&Selection:" "&Wyb\u00f3r:"
- ::msgcat::mcset pl "Skip Messages" "Omi\u0144 pozosta\u0142e komunikaty"
+ ::msgcat::mcset pl "Skip Messages" "Pomi\u0144 pozosta\u0142e komunikaty"
::msgcat::mcset pl "&Source..." "&Kod \u017ar\u00f3d\u0142owy..."
- ::msgcat::mcset pl "Tcl Scripts" "Tcl-skrypty"
- ::msgcat::mcset pl "Tcl for Windows" "Tcl dla Okienek (Windows)"
- ::msgcat::mcset pl "Text Files" "Pliki Tekstowe"
+ ::msgcat::mcset pl "Tcl Scripts" "Skrypty Tcl"
+ ::msgcat::mcset pl "Tcl for Windows" "Tcl dla Windows"
+ ::msgcat::mcset pl "Text Files" "Pliki tekstowe"
::msgcat::mcset pl "&Yes" "&Tak"
- ::msgcat::mcset pl "abort" "zako\u0144cz"
+ ::msgcat::mcset pl "abort" "przerwij"
::msgcat::mcset pl "blue" "niebieski"
::msgcat::mcset pl "cancel" "anuluj"
::msgcat::mcset pl "extension" "rozszerzenie"
@@ -68,6 +68,6 @@ namespace eval ::tk {
::msgcat::mcset pl "green" "zielony"
::msgcat::mcset pl "ignore" "ignoruj"
::msgcat::mcset pl "red" "czerwony"
- ::msgcat::mcset pl "retry" "potw\u00f3rz"
+ ::msgcat::mcset pl "retry" "pon\u00f3w"
::msgcat::mcset pl "yes" "tak"
}
diff --git a/library/msgs/sv.msg b/library/msgs/sv.msg
new file mode 100644
index 0000000..14ce14d
--- /dev/null
+++ b/library/msgs/sv.msg
@@ -0,0 +1,74 @@
+namespace eval ::tk {
+ ::msgcat::mcset sv "&Abort" "&Avsluta"
+ ::msgcat::mcset sv "&About..." "&Om..."
+ ::msgcat::mcset sv "All Files" "Samtliga filer"
+ ::msgcat::mcset sv "Application Error" "Programfel"
+ ::msgcat::mcset sv "&Blue" "&Bl\u00e5"
+ ::msgcat::mcset sv "&Cancel" "&Avbryt"
+ ::msgcat::mcset sv "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ej n\u00e5 mappen \"%1\$s\".\nSaknar r\u00e4ttigheter."
+ ::msgcat::mcset sv "Choose Directory" "V\u00e4lj mapp"
+ ::msgcat::mcset sv "&Clear" "&Radera"
+ ::msgcat::mcset sv "&Clear Console" "&Radera konsollen"
+ ::msgcat::mcset sv "Color" "F\u00e4rg"
+ ::msgcat::mcset sv "Console" "Konsoll"
+ ::msgcat::mcset sv "&Copy" "&Kopiera"
+ ::msgcat::mcset sv "Cu&t" "Klipp u&t"
+ ::msgcat::mcset sv "&Delete" "&Radera"
+ ::msgcat::mcset sv "Details >>" "Detaljer >>"
+ ::msgcat::mcset sv "Directory \"%1\$s\" does not exist." "Mappen \"%1\$s\" finns ej."
+ ::msgcat::mcset sv "&Directory:" "&Mapp:"
+ ::msgcat::mcset sv "&Edit" "R&edigera"
+ ::msgcat::mcset sv "Error: %1\$s" "Fel: %1\$s"
+ ::msgcat::mcset sv "E&xit" "&Avsluta"
+ ::msgcat::mcset sv "&File" "&Fil"
+ ::msgcat::mcset sv "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Filen \"%1\$s\" finns redan.\nVill du skriva \u00f6ver den?"
+ ::msgcat::mcset sv "File \"%1\$s\" already exists.\n\n" "Filen \"%1\$s\" finns redan.\n\n"
+ ::msgcat::mcset sv "File \"%1\$s\" does not exist." "Filen \"%1\$s\" finns ej."
+ ::msgcat::mcset sv "File &name:" "Fil&namn:"
+ ::msgcat::mcset sv "File &names:" "Fil&namn:"
+ ::msgcat::mcset sv "Files of &type:" "Filer av &typ:"
+ ::msgcat::mcset sv "Fi&les:" "Fi&ler:"
+ ::msgcat::mcset sv "&Filter"
+ ::msgcat::mcset sv "Fil&ter:"
+ ::msgcat::mcset sv "&Green" "&Gr\u00f6n"
+ ::msgcat::mcset sv "&Help" "&Hj\u00e4lp"
+ ::msgcat::mcset sv "Hi" "Hej"
+ ::msgcat::mcset sv "&Hide Console" "&G\u00f6m konsollen"
+ ::msgcat::mcset sv "&Ignore" "&Ignorera"
+ ::msgcat::mcset sv "Invalid file name \"%1\$s\"." "Ogiltigt filnamn \"%1\$s\"."
+ ::msgcat::mcset sv "Log Files" "Loggfiler"
+ ::msgcat::mcset sv "&No" "&Nej"
+ ::msgcat::mcset sv "OK"
+ ::msgcat::mcset sv "Ok"
+ ::msgcat::mcset sv "Open" "\u00d6ppna"
+ ::msgcat::mcset sv "&Open" "&\u00d6ppna"
+ ::msgcat::mcset sv "Open Multiple Files" "\u00d6ppna flera filer"
+ ::msgcat::mcset sv "P&aste" "&Klistra in"
+ ::msgcat::mcset sv "&Quit" "&Avsluta"
+ ::msgcat::mcset sv "&Red" "&R\u00f6d"
+ ::msgcat::mcset sv "Replace existing file?" "Ers\u00e4tt existerande fil?"
+ ::msgcat::mcset sv "&Retry" "&F\u00f6rs\u00f6k igen"
+ ::msgcat::mcset sv "&Save" "&Spara"
+ ::msgcat::mcset sv "Save As" "Spara som"
+ ::msgcat::mcset sv "Save To Log" "Spara till logg"
+ ::msgcat::mcset sv "Select Log File" "V\u00e4lj loggfil"
+ ::msgcat::mcset sv "Select a file to source" "V\u00e4lj k\u00e4llfil"
+ ::msgcat::mcset sv "&Selection:" "&Val:"
+ ::msgcat::mcset sv "Skip Messages" "Hoppa \u00f6ver meddelanden"
+ ::msgcat::mcset sv "&Source..." "&K\u00e4lla..."
+ ::msgcat::mcset sv "Tcl Scripts" "Tcl skript"
+ ::msgcat::mcset sv "Tcl for Windows" "Tcl f\u00f6r Windows"
+ ::msgcat::mcset sv "Text Files" "Textfiler"
+ ::msgcat::mcset sv "&Yes" "&Ja"
+ ::msgcat::mcset sv "abort" "avbryt"
+ ::msgcat::mcset sv "blue" "bl\u00e5"
+ ::msgcat::mcset sv "cancel" "avbryt"
+ ::msgcat::mcset sv "extension" "utvidgning"
+ ::msgcat::mcset sv "extensions" "utvidgningar"
+ ::msgcat::mcset sv "green" "gr\u00f6n"
+ ::msgcat::mcset sv "ignore" "ignorera"
+ ::msgcat::mcset sv "ok"
+ ::msgcat::mcset sv "red" "r\u00f6d"
+ ::msgcat::mcset sv "retry" "f\u00f6rs\u00f6k igen"
+ ::msgcat::mcset sv "yes" "ja"
+}
diff --git a/library/obsolete.tcl b/library/obsolete.tcl
index 9a60c78..3ee7f28 100644
--- a/library/obsolete.tcl
+++ b/library/obsolete.tcl
@@ -17,3 +17,162 @@
proc tk_menuBar args {}
proc tk_bindForTraversal args {}
+
+# ::tk::classic::restore --
+#
+# Restore the pre-8.5 (Tk classic) look as the widget defaults for classic
+# Tk widgets.
+#
+# The value following an 'option add' call is the new 8.5 value.
+#
+namespace eval ::tk::classic {
+ # This may need to be adjusted for some window managers that are
+ # more aggressive with their own Xdefaults (like KDE and CDE)
+ variable prio "widgetDefault"
+}
+
+proc ::tk::classic::restore {args} {
+ # Restore classic (8.4) look to classic Tk widgets
+ variable prio
+
+ if {[llength $args]} {
+ foreach what $args {
+ ::tk::classic::restore_$what
+ }
+ } else {
+ foreach cmd [info procs restore_*] {
+ $cmd
+ }
+ }
+}
+
+proc ::tk::classic::restore_font {args} {
+ # Many widgets were adjusted from hard-coded defaults to using the
+ # TIP#145 fonts defined in fonts.tcl (eg TkDefaultFont, TkFixedFont, ...)
+ # For restoring compatibility, we only correct size and weighting changes,
+ # as the fonts themselves remained mostly the same.
+ if {[tk windowingsystem] eq "x11"} {
+ font configure TkDefaultFont -weight bold ; # normal
+ font configure TkFixedFont -size -12 ; # -10
+ }
+ # Add these with prio 21 to override value in dialog/msgbox.tcl
+ if {[tk windowingsystem] eq "aqua"} {
+ option add *Dialog.msg.font system 21; # TkCaptionFont
+ option add *Dialog.dtl.font system 21; # TkCaptionFont
+ option add *ErrorDialog*Label.font system 21; # TkCaptionFont
+ } else {
+ option add *Dialog.msg.font {Times 12} 21; # TkCaptionFont
+ option add *Dialog.dtl.font {Times 10} 21; # TkCaptionFont
+ option add *ErrorDialog*Label.font {Times -18} 21; # TkCaptionFont
+ }
+}
+
+proc ::tk::classic::restore_button {args} {
+ variable prio
+ if {[tk windowingsystem] eq "x11"} {
+ foreach cls {Button Radiobutton Checkbutton} {
+ option add *$cls.borderWidth 2 $prio; # 1
+ }
+ }
+}
+
+proc ::tk::classic::restore_entry {args} {
+ variable prio
+ # Entry and Spinbox share core defaults
+ foreach cls {Entry Spinbox} {
+ if {[tk windowingsystem] ne "aqua"} {
+ option add *$cls.borderWidth 2 $prio; # 1
+ }
+ if {[tk windowingsystem] eq "x11"} {
+ option add *$cls.background "#d9d9d9" $prio; # "white"
+ option add *$cls.selectBorderWidth 1 $prio; # 0
+ }
+ }
+}
+
+proc ::tk::classic::restore_listbox {args} {
+ variable prio
+ if {[tk windowingsystem] ne "win32"} {
+ option add *Listbox.background "#d9d9d9" $prio; # "white"
+ option add *Listbox.activeStyle "underline" $prio; # "dotbox"
+ }
+ if {[tk windowingsystem] ne "aqua"} {
+ option add *Listbox.borderWidth 2 $prio; # 1
+ }
+ if {[tk windowingsystem] eq "x11"} {
+ option add *Listbox.selectBorderWidth 1 $prio; # 0
+ }
+ # Remove focus into Listbox added for 8.5
+ bind Listbox <1> {
+ if {[winfo exists %W]} {
+ tk::ListboxBeginSelect %W [%W index @%x,%y]
+ }
+ }
+}
+
+proc ::tk::classic::restore_menu {args} {
+ variable prio
+ if {[tk windowingsystem] eq "x11"} {
+ option add *Menu.activeBorderWidth 2 $prio; # 1
+ option add *Menu.borderWidth 2 $prio; # 1
+ option add *Menu.clickToFocus true $prio
+ option add *Menu.useMotifHelp true $prio
+ }
+ if {[tk windowingsystem] ne "aqua"} {
+ option add *Menu.font "TkDefaultFont" $prio; # "TkMenuFont"
+ }
+}
+
+proc ::tk::classic::restore_menubutton {args} {
+ variable prio
+ option add *Menubutton.borderWidth 2 $prio; # 1
+}
+
+proc ::tk::classic::restore_message {args} {
+ variable prio
+ option add *Message.borderWidth 2 $prio; # 1
+}
+
+proc ::tk::classic::restore_panedwindow {args} {
+ variable prio
+ option add *Panedwindow.borderWidth 2 $prio; # 1
+ option add *Panedwindow.sashWidth 2 $prio; # 3
+ option add *Panedwindow.sashPad 2 $prio; # 0
+ option add *Panedwindow.sashRelief raised $prio; # flat
+ option add *Panedwindow.opaqueResize 0 $prio; # 1
+ if {[tk windowingsystem] ne "win32"} {
+ option add *Panedwindow.showHandle 1 $prio; # 0
+ }
+}
+
+proc ::tk::classic::restore_scale {args} {
+ variable prio
+ option add *Scale.borderWidth 2 $prio; # 1
+ if {[tk windowingsystem] eq "x11"} {
+ option add *Scale.troughColor "#c3c3c3" $prio; # "#b3b3b3"
+ }
+}
+
+proc ::tk::classic::restore_scrollbar {args} {
+ variable prio
+ if {[tk windowingsystem] eq "x11"} {
+ option add *Scrollbar.borderWidth 2 $prio; # 1
+ option add *Scrollbar.highlightThickness 1 $prio; # 0
+ option add *Scrollbar.width 15 $prio; # 11
+ option add *Scrollbar.troughColor "#c3c3c3" $prio; # "#b3b3b3"
+ }
+}
+
+proc ::tk::classic::restore_text {args} {
+ variable prio
+ if {[tk windowingsystem] ne "aqua"} {
+ option add *Text.borderWidth 2 $prio; # 1
+ }
+ if {[tk windowingsystem] eq "win32"} {
+ option add *Text.font "TkDefaultFont" $prio; # "TkFixedFont"
+ }
+ if {[tk windowingsystem] eq "x11"} {
+ option add *Text.background "#d9d9d9" $prio; # white
+ option add *Text.selectBorderWidth 1 $prio; # 0
+ }
+}
diff --git a/library/optMenu.tcl b/library/optMenu.tcl
index 984436f..7cfdaa0 100644
--- a/library/optMenu.tcl
+++ b/library/optMenu.tcl
@@ -32,7 +32,7 @@ proc ::tk_optionMenu {w varName firstValue args} {
set var $firstValue
}
menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu \
- -relief raised -bd 2 -highlightthickness 2 -anchor c \
+ -relief raised -highlightthickness 1 -anchor c \
-direction flush
menu $w.menu -tearoff 0
$w.menu add radiobutton -label $firstValue -variable $varName
diff --git a/library/palette.tcl b/library/palette.tcl
index 1838514..21be8dc 100644
--- a/library/palette.tcl
+++ b/library/palette.tcl
@@ -50,13 +50,11 @@ proc ::tk_setPalette {args} {
set new(foreground) white
}
}
-
- # To avoir too many lindex...
- foreach {fg_r fg_g fg_b} [winfo rgb . $new(foreground)] {break}
- foreach {bg_r bg_g bg_b} $bg {break}
-
+ lassign [winfo rgb . $new(foreground)] fg_r fg_g fg_b
+ lassign $bg bg_r bg_g bg_b
set darkerBg [format #%02x%02x%02x [expr {(9*$bg_r)/2560}] \
[expr {(9*$bg_g)/2560}] [expr {(9*$bg_b)/2560}]]
+
foreach i {activeForeground insertBackground selectForeground \
highlightColor} {
if {![info exists new($i)]} {
@@ -78,7 +76,7 @@ proc ::tk_setPalette {args} {
# up by 15% or 1/3 of the way to full white, whichever is
# greater.
- foreach i {0 1 2} color "$bg_r $bg_g $bg_b" {
+ foreach i {0 1 2} color $bg {
set light($i) [expr {$color/256}]
set inc1 [expr {($light($i)*15)/100}]
set inc2 [expr {(255-$light($i))/3}]
@@ -100,9 +98,6 @@ proc ::tk_setPalette {args} {
if {![info exists new(troughColor)]} {
set new(troughColor) $darkerBg
}
- if {![info exists new(selectColor)]} {
- set new(selectColor) #b03060
- }
# let's make one of each of the widgets so we know what the
# defaults are currently for this platform.
@@ -176,16 +171,16 @@ proc ::tk::RecolorTree {w colors} {
# dbOption, then use it, otherwise use the defaults
# for the widget.
set defaultcolor [option get $w $dbOption $class]
- if {[string match {} $defaultcolor] || \
+ if {$defaultcolor eq "" || \
([info exists prototype] && \
[$prototype cget $option] ne "$defaultcolor")} {
set defaultcolor [lindex $value 3]
}
- if {![string match {} $defaultcolor]} {
+ if {$defaultcolor ne ""} {
set defaultcolor [winfo rgb . $defaultcolor]
}
set chosencolor [lindex $value 4]
- if {![string match {} $chosencolor]} {
+ if {$chosencolor ne ""} {
set chosencolor [winfo rgb . $chosencolor]
}
if {[string match $defaultcolor $chosencolor]} {
@@ -242,7 +237,7 @@ proc ::tk_bisque {} {
tk_setPalette activeBackground #e6ceb1 activeForeground black \
background #ffe4c4 disabledForeground #b0b0b0 foreground black \
highlightBackground #ffe4c4 highlightColor black \
- insertBackground black selectColor #b03060 \
+ insertBackground black \
selectBackground #e6ceb1 selectForeground black \
troughColor #cdb79e
}
diff --git a/library/panedwindow.tcl b/library/panedwindow.tcl
index 58b0bae..d3dfabc 100644
--- a/library/panedwindow.tcl
+++ b/library/panedwindow.tcl
@@ -32,16 +32,21 @@ namespace eval ::tk::panedwindow {}
# None
#
proc ::tk::panedwindow::MarkSash {w x y proxy} {
- if {[$w cget -opaqueresize]} { set proxy 0 }
+ variable ::tk::Priv
+ if {[$w cget -opaqueresize]} {
+ set proxy 0
+ }
set what [$w identify $x $y]
if { [llength $what] == 2 } {
- foreach {index which} $what break
- if { !$::tk_strictMotif || $which eq "handle" } {
- if {!$proxy} { $w sash mark $index $x $y }
- set ::tk::Priv(sash) $index
- foreach {sx sy} [$w sash coord $index] break
- set ::tk::Priv(dx) [expr {$sx-$x}]
- set ::tk::Priv(dy) [expr {$sy-$y}]
+ lassign $what index which
+ if {!$::tk_strictMotif || $which eq "handle"} {
+ if {!$proxy} {
+ $w sash mark $index $x $y
+ }
+ set Priv(sash) $index
+ lassign [$w sash coord $index] sx sy
+ set Priv(dx) [expr {$sx-$x}]
+ set Priv(dy) [expr {$sy-$y}]
# Do this to init the proxy location
DragSash $w $x $y $proxy
}
@@ -61,14 +66,16 @@ proc ::tk::panedwindow::MarkSash {w x y proxy} {
# Moves sash
#
proc ::tk::panedwindow::DragSash {w x y proxy} {
- if {[$w cget -opaqueresize]} { set proxy 0 }
- if { [info exists ::tk::Priv(sash)] } {
+ variable ::tk::Priv
+ if {[$w cget -opaqueresize]} {
+ set proxy 0
+ }
+ if {[info exists Priv(sash)]} {
if {$proxy} {
- $w proxy place \
- [expr {$x+$::tk::Priv(dx)}] [expr {$y+$::tk::Priv(dy)}]
+ $w proxy place [expr {$x+$Priv(dx)}] [expr {$y+$Priv(dy)}]
} else {
- $w sash place $::tk::Priv(sash) \
- [expr {$x+$::tk::Priv(dx)}] [expr {$y+$::tk::Priv(dy)}]
+ $w sash place $Priv(sash) \
+ [expr {$x+$Priv(dx)}] [expr {$y+$Priv(dy)}]
}
}
}
@@ -84,14 +91,17 @@ proc ::tk::panedwindow::DragSash {w x y proxy} {
# Returns ...
#
proc ::tk::panedwindow::ReleaseSash {w proxy} {
- if {[$w cget -opaqueresize]} { set proxy 0 }
- if { [info exists ::tk::Priv(sash)] } {
+ variable ::tk::Priv
+ if {[$w cget -opaqueresize]} {
+ set proxy 0
+ }
+ if {[info exists Priv(sash)]} {
if {$proxy} {
- foreach {x y} [$w proxy coord] break
- $w sash place $::tk::Priv(sash) $x $y
+ lassign [$w proxy coord] x y
+ $w sash place $Priv(sash) $x $y
$w proxy forget
}
- unset ::tk::Priv(sash) ::tk::Priv(dx) ::tk::Priv(dy)
+ unset Priv(sash) Priv(dx) Priv(dy)
}
}
@@ -113,16 +123,14 @@ proc ::tk::panedwindow::Motion {w x y} {
set id [$w identify $x $y]
if {([llength $id] == 2) && \
(!$::tk_strictMotif || [lindex $id 1] eq "handle")} {
- if { ![info exists Priv($w,panecursor)] } {
+ if {![info exists Priv($w,panecursor)]} {
set Priv($w,panecursor) [$w cget -cursor]
- if { [$w cget -sashcursor] eq "" } {
- if { [$w cget -orient] eq "horizontal" } {
- $w configure -cursor sb_h_double_arrow
- } else {
- $w configure -cursor sb_v_double_arrow
- }
- } else {
+ if {[$w cget -sashcursor] ne ""} {
$w configure -cursor [$w cget -sashcursor]
+ } elseif {[$w cget -orient] eq "horizontal"} {
+ $w configure -cursor sb_h_double_arrow
+ } else {
+ $w configure -cursor sb_v_double_arrow
}
if {[info exists Priv($w,pwAfterId)]} {
after cancel $Priv($w,pwAfterId)
@@ -132,7 +140,7 @@ proc ::tk::panedwindow::Motion {w x y} {
}
return
}
- if { [info exists Priv($w,panecursor)] } {
+ if {[info exists Priv($w,panecursor)]} {
$w configure -cursor $Priv($w,panecursor)
unset Priv($w,panecursor)
}
@@ -178,8 +186,9 @@ proc ::tk::panedwindow::Cursor {w} {
# Restores the default cursor
#
proc ::tk::panedwindow::Leave {w} {
- if {[info exists ::tk::Priv($w,panecursor)]} {
- $w configure -cursor $::tk::Priv($w,panecursor)
- unset ::tk::Priv($w,panecursor)
+ variable ::tk::Priv
+ if {[info exists Priv($w,panecursor)]} {
+ $w configure -cursor $Priv($w,panecursor)
+ unset Priv($w,panecursor)
}
}
diff --git a/library/prolog.ps b/library/prolog.ps
deleted file mode 100644
index bf87d31..0000000
--- a/library/prolog.ps
+++ /dev/null
@@ -1,283 +0,0 @@
-%%BeginProlog
-50 dict begin
-
-% This is a standard prolog for Postscript generated by Tk's canvas
-% widget.
-
-% The definitions below just define all of the variables used in
-% any of the procedures here. This is needed for obscure reasons
-% explained on p. 716 of the Postscript manual (Section H.2.7,
-% "Initializing Variables," in the section on Encapsulated Postscript).
-
-/baseline 0 def
-/stipimage 0 def
-/height 0 def
-/justify 0 def
-/lineLength 0 def
-/spacing 0 def
-/stipple 0 def
-/strings 0 def
-/xoffset 0 def
-/yoffset 0 def
-/tmpstip null def
-
-% Define the array ISOLatin1Encoding (which specifies how characters are
-% encoded for ISO-8859-1 fonts), if it isn't already present (Postscript
-% level 2 is supposed to define it, but level 1 doesn't).
-
-systemdict /ISOLatin1Encoding known not {
- /ISOLatin1Encoding [
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /exclam /quotedbl /numbersign /dollar /percent /ampersand
- /quoteright
- /parenleft /parenright /asterisk /plus /comma /minus /period /slash
- /zero /one /two /three /four /five /six /seven
- /eight /nine /colon /semicolon /less /equal /greater /question
- /at /A /B /C /D /E /F /G
- /H /I /J /K /L /M /N /O
- /P /Q /R /S /T /U /V /W
- /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
- /quoteleft /a /b /c /d /e /f /g
- /h /i /j /k /l /m /n /o
- /p /q /r /s /t /u /v /w
- /x /y /z /braceleft /bar /braceright /asciitilde /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
- /dieresis /space /ring /cedilla /space /hungarumlaut /ogonek /caron
- /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
- /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen
- /registered /macron
- /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph
- /periodcentered
- /cedillar /onesuperior /ordmasculine /guillemotright /onequarter
- /onehalf /threequarters /questiondown
- /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
- /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex
- /Idieresis
- /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
- /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn
- /germandbls
- /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
- /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex
- /idieresis
- /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
- /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn
- /ydieresis
- ] def
-} if
-
-% font ISOEncode font
-% This procedure changes the encoding of a font from the default
-% Postscript encoding to ISOLatin1. It's typically invoked just
-% before invoking "setfont". The body of this procedure comes from
-% Section 5.6.1 of the Postscript book.
-
-/ISOEncode {
- dup length dict begin
- {1 index /FID ne {def} {pop pop} ifelse} forall
- /Encoding ISOLatin1Encoding def
- currentdict
- end
-
- % I'm not sure why it's necessary to use "definefont" on this new
- % font, but it seems to be important; just use the name "Temporary"
- % for the font.
-
- /Temporary exch definefont
-} bind def
-
-% StrokeClip
-%
-% This procedure converts the current path into a clip area under
-% the assumption of stroking. It's a bit tricky because some Postscript
-% interpreters get errors during strokepath for dashed lines. If
-% this happens then turn off dashes and try again.
-
-/StrokeClip {
- {strokepath} stopped {
- (This Postscript printer gets limitcheck overflows when) =
- (stippling dashed lines; lines will be printed solid instead.) =
- [] 0 setdash strokepath} if
- clip
-} bind def
-
-% desiredSize EvenPixels closestSize
-%
-% The procedure below is used for stippling. Given the optimal size
-% of a dot in a stipple pattern in the current user coordinate system,
-% compute the closest size that is an exact multiple of the device's
-% pixel size. This allows stipple patterns to be displayed without
-% aliasing effects.
-
-/EvenPixels {
- % Compute exact number of device pixels per stipple dot.
- dup 0 matrix currentmatrix dtransform
- dup mul exch dup mul add sqrt
-
- % Round to an integer, make sure the number is at least 1, and compute
- % user coord distance corresponding to this.
- dup round dup 1 lt {pop 1} if
- exch div mul
-} bind def
-
-% width height string StippleFill --
-%
-% Given a path already set up and a clipping region generated from
-% it, this procedure will fill the clipping region with a stipple
-% pattern. "String" contains a proper image description of the
-% stipple pattern and "width" and "height" give its dimensions. Each
-% stipple dot is assumed to be about one unit across in the current
-% user coordinate system. This procedure trashes the graphics state.
-
-/StippleFill {
- % The following code is needed to work around a NeWSprint bug.
-
- /tmpstip 1 index def
-
- % Change the scaling so that one user unit in user coordinates
- % corresponds to the size of one stipple dot.
- 1 EvenPixels dup scale
-
- % Compute the bounding box occupied by the path (which is now
- % the clipping region), and round the lower coordinates down
- % to the nearest starting point for the stipple pattern. Be
- % careful about negative numbers, since the rounding works
- % differently on them.
-
- pathbbox
- 4 2 roll
- 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
- 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
-
- % Stack now: width height string y1 y2 x1 x2
- % Below is a doubly-nested for loop to iterate across this area
- % in units of the stipple pattern size, going up columns then
- % across rows, blasting out a stipple-pattern-sized rectangle at
- % each position
-
- 6 index exch {
- 2 index 5 index 3 index {
- % Stack now: width height string y1 y2 x y
-
- gsave
- 1 index exch translate
- 5 index 5 index true matrix tmpstip imagemask
- grestore
- } for
- pop
- } for
- pop pop pop pop pop
-} bind def
-
-% -- AdjustColor --
-% Given a color value already set for output by the caller, adjusts
-% that value to a grayscale or mono value if requested by the CL
-% variable.
-
-/AdjustColor {
- CL 2 lt {
- currentgray
- CL 0 eq {
- .5 lt {0} {1} ifelse
- } if
- setgray
- } if
-} bind def
-
-% x y strings spacing xoffset yoffset justify stipple DrawText --
-% This procedure does all of the real work of drawing text. The
-% color and font must already have been set by the caller, and the
-% following arguments must be on the stack:
-%
-% x, y - Coordinates at which to draw text.
-% strings - An array of strings, one for each line of the text item,
-% in order from top to bottom.
-% spacing - Spacing between lines.
-% xoffset - Horizontal offset for text bbox relative to x and y: 0 for
-% nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
-% yoffset - Vertical offset for text bbox relative to x and y: 0 for
-% nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
-% justify - 0 for left justification, 0.5 for center, 1 for right justify.
-% stipple - Boolean value indicating whether or not text is to be
-% drawn in stippled fashion. If text is stippled,
-% procedure StippleText must have been defined to call
-% StippleFill in the right way.
-%
-% Also, when this procedure is invoked, the color and font must already
-% have been set for the text.
-
-/DrawText {
- /stipple exch def
- /justify exch def
- /yoffset exch def
- /xoffset exch def
- /spacing exch def
- /strings exch def
-
- % First scan through all of the text to find the widest line.
-
- /lineLength 0 def
- strings {
- stringwidth pop
- dup lineLength gt {/lineLength exch def} {pop} ifelse
- newpath
- } forall
-
- % Compute the baseline offset and the actual font height.
-
- 0 0 moveto (TXygqPZÄ) false charpath
- pathbbox dup /baseline exch def
- exch pop exch sub /height exch def pop
- newpath
-
- % Translate coordinates first so that the origin is at the upper-left
- % corner of the text's bounding box. Remember that x and y for
- % positioning are still on the stack.
-
- translate
- lineLength xoffset mul
- strings length 1 sub spacing mul height add yoffset mul translate
-
- % Now use the baseline and justification information to translate so
- % that the origin is at the baseline and positioning point for the
- % first line of text.
-
- justify lineLength mul baseline neg translate
-
- % Iterate over each of the lines to output it. For each line,
- % compute its width again so it can be properly justified, then
- % display it.
-
- strings {
- dup stringwidth pop
- justify neg mul 0 moveto
- stipple {
-
- % The text is stippled, so turn it into a path and print
- % by calling StippledText, which in turn calls StippleFill.
- % Unfortunately, many Postscript interpreters will get
- % overflow errors if we try to do the whole string at
- % once, so do it a character at a time.
-
- gsave
- /char (X) def
- {
- char 0 3 -1 roll put
- currentpoint
- gsave
- char true charpath clip StippleText
- grestore
- char stringwidth translate
- moveto
- } forall
- grestore
- } {show} ifelse
- 0 spacing neg translate
- } forall
-} bind def
-
-%%EndProlog
diff --git a/library/safetk.tcl b/library/safetk.tcl
index cba854c..c975fd6 100644
--- a/library/safetk.tcl
+++ b/library/safetk.tcl
@@ -25,57 +25,51 @@ package require opt 0.4.1;
namespace eval ::safe {
# counter for safe toplevels
- variable tkSafeId 0;
-
- #
- # tkInterpInit : prepare the slave interpreter for tk loading
- # most of the real job is done by loadTk
- # returns the slave name (tkInterpInit does)
- #
- proc ::safe::tkInterpInit {slave argv} {
- global env tk_library
-
- # We have to make sure that the tk_library variable uses a file
- # pathname that works better in Tk (of the style returned by
- # [file join], ie C:/path/to/tk/lib, not C:\path\to\tk\lib
- set tk_library [file join $tk_library]
-
- # Clear Tk's access for that interp (path).
- allowTk $slave $argv
-
- # there seems to be an obscure case where the tk_library
- # variable value is changed to point to a sym link destination
- # dir instead of the sym link itself, and thus where the $tk_library
- # would then not be anymore one of the auto_path dir, so we use
- # the addToAccessPath which adds if it's not already in instead
- # of the more conventional findInAccessPath.
- # Might be usefull for masters without Tk really loaded too.
- ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]]
- return $slave
+ variable tkSafeId 0
+}
+
+#
+# tkInterpInit : prepare the slave interpreter for tk loading
+# most of the real job is done by loadTk
+# returns the slave name (tkInterpInit does)
+#
+proc ::safe::tkInterpInit {slave argv} {
+ global env tk_library
+
+ # We have to make sure that the tk_library variable is normalized.
+ set tk_library [file normalize $tk_library]
+
+ # Clear Tk's access for that interp (path).
+ allowTk $slave $argv
+
+ # Ensure tk_library and subdirs (eg, ttk) are on the access path
+ ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]]
+ foreach subdir [::safe::AddSubDirs [list $tk_library]] {
+ ::safe::interpAddToAccessPath $slave $subdir
}
+ return $slave
+}
-# tkInterpLoadTk :
-# Do additional configuration as needed (calling tkInterpInit)
+# tkInterpLoadTk:
+# Do additional configuration as needed (calling tkInterpInit)
# and actually load Tk into the slave.
-#
+#
# Either contained in the specified windowId (-use) or
# creating a decorated toplevel for it.
# empty definition for auto_mkIndex
proc ::safe::loadTk {} {}
-
-::tcl::OptProc loadTk {
+
+::tcl::OptProc ::safe::loadTk {
{slave -interp "name of the slave interpreter"}
{-use -windowId {} "window Id to use (new toplevel otherwise)"}
{-display -displayName {} "display name to use (current one otherwise)"}
} {
set displayGiven [::tcl::OptProcArgGiven "-display"]
if {!$displayGiven} {
-
# Try to get the current display from "."
# (which might not exist if the master is tk-less)
-
if {[catch {set display [winfo screen .]}]} {
if {[info exists ::env(DISPLAY)]} {
set display $::env(DISPLAY)
@@ -85,42 +79,38 @@ proc ::safe::loadTk {} {}
}
}
}
+
+ # Get state for access to the cleanupHook.
+ namespace upvar ::safe S$slave state
+
if {![::tcl::OptProcArgGiven "-use"]} {
-
# create a decorated toplevel
-
::tcl::Lassign [tkTopLevel $slave $display] w use
# set our delete hook (slave arg is added by interpDelete)
# to clean up both window related code and tkInit(slave)
- Set [DeleteHookName $slave] [list tkDelete {} $w]
+ set state(cleanupHook) [list tkDelete {} $w]
} else {
# set our delete hook (slave arg is added by interpDelete)
# to clean up tkInit(slave)
-
- Set [DeleteHookName $slave] [list disallowTk]
+ set state(cleanupHook) [list disallowTk]
# Let's be nice and also accept tk window names instead of ids
-
if {[string match ".*" $use]} {
set windowName $use
set use [winfo id $windowName]
set nDisplay [winfo screen $windowName]
} else {
-
# Check for a better -display value
# (works only for multi screens on single host, but not
# cross hosts, for that a tk window name would be better
# but embeding is also usefull for non tk names)
-
if {![catch {winfo pathname $use} name]} {
set nDisplay [winfo screen $name]
} else {
-
# Can't have a better one
-
set nDisplay $display
}
}
@@ -135,9 +125,8 @@ proc ::safe::loadTk {} {}
}
# Prepares the slave for tk with those parameters
-
tkInterpInit $slave [list "-use" $use "-display" $display]
-
+
load {} Tk $slave
return $slave
@@ -221,7 +210,7 @@ proc ::safe::tkDelete {W window slave} {
Log $slave "Destroy toplevel $window" NOTICE
destroy $window
}
-
+
# clean up tkInit(slave)
disallowTk $slave
return
@@ -240,36 +229,36 @@ proc ::safe::tkTopLevel {slave display} {
set msg "Untrusted Tcl applet ($slave)"
wm title $w $msg
- # Control frame
+ # Control frame (we must create a style for it)
+ ttk::style layout TWarningFrame {WarningFrame.border -sticky nswe}
+ ttk::style configure TWarningFrame -background red
+
set wc $w.fc
- frame $wc -bg red -borderwidth 3 -relief ridge
+ ttk::frame $wc -relief ridge -borderwidth 4 -style TWarningFrame
# We will destroy the interp when the window is destroyed
bindtags $wc [concat Safe$wc [bindtags $wc]]
bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $slave]
- label $wc.l -text $msg -padx 2 -pady 0 -anchor w
+ ttk::label $wc.l -text $msg -anchor w
# We want the button to be the last visible item
# (so be packed first) and at the right and not resizing horizontally
# frame the button so it does not expand horizontally
# but still have the default background instead of red one from the parent
- frame $wc.fb -bd 0
- button $wc.fb.b -text "Delete" \
- -bd 1 -padx 2 -pady 0 -highlightthickness 0 \
+ ttk::frame $wc.fb -borderwidth 0
+ ttk::button $wc.fb.b -text "Delete" \
-command [list ::safe::tkDelete $w $w $slave]
pack $wc.fb.b -side right -fill both
pack $wc.fb -side right -fill both -expand 1
- pack $wc.l -side left -fill both -expand 1
+ pack $wc.l -side left -fill both -expand 1 -ipady 2
pack $wc -side bottom -fill x
# Container frame
frame $w.c -container 1
pack $w.c -fill both -expand 1
-
+
# return both the toplevel window name and the id to use for embedding
list $w [winfo id $w.c]
}
-
-}
diff --git a/library/scale.tcl b/library/scale.tcl
index 41fd720..d362284 100644
--- a/library/scale.tcl
+++ b/library/scale.tcl
@@ -270,8 +270,9 @@ proc ::tk::ScaleButton2Down {w x y} {
variable ::tk::Priv
if {[$w cget -state] eq "disabled"} {
- return
+ return
}
+
$w configure -state active
$w set [$w get $x $y]
set Priv(dragging) 1
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index f048922..4cb95bd 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -128,7 +128,7 @@ bind Scrollbar <End> {
tk::ScrollToPos %W 1
}
}
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
+if {[tk windowingsystem] eq "aqua"} {
bind Scrollbar <MouseWheel> {
tk::ScrollByUnits %W v [expr {- (%D)}]
}
@@ -314,7 +314,8 @@ proc ::tk::ScrollEndDrag {w x y} {
proc ::tk::ScrollByUnits {w orient amount} {
set cmd [$w cget -command]
- if {$cmd eq "" || ([string first [string index [$w cget -orient] 0] $orient] < 0)} {
+ if {$cmd eq "" || ([string first \
+ [string index [$w cget -orient] 0] $orient] < 0)} {
return
}
set info [$w get]
@@ -338,7 +339,8 @@ proc ::tk::ScrollByUnits {w orient amount} {
proc ::tk::ScrollByPages {w orient amount} {
set cmd [$w cget -command]
- if {$cmd eq "" || ([string first [string index [$w cget -orient] 0] $orient] < 0)} {
+ if {$cmd eq "" || ([string first \
+ [string index [$w cget -orient] 0] $orient] < 0)} {
return
}
set info [$w get]
diff --git a/library/spinbox.tcl b/library/spinbox.tcl
index 933c25c..c05ccec 100644
--- a/library/spinbox.tcl
+++ b/library/spinbox.tcl
@@ -73,6 +73,11 @@ bind Spinbox <<PasteSelection>> {
}
}
+bind Spinbox <<TraverseIn>> {
+ %W selection range 0 end
+ %W icursor end
+}
+
# Standard Motif bindings:
bind Spinbox <1> {
@@ -210,9 +215,8 @@ bind Spinbox <Escape> {# nothing}
bind Spinbox <Return> {# nothing}
bind Spinbox <KP_Enter> {# nothing}
bind Spinbox <Tab> {# nothing}
-
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
- bind Spinbox <Command-KeyPress> {# nothing}
+if {[tk windowingsystem] eq "aqua"} {
+ bind Spinbox <Command-KeyPress> {# nothing}
}
# On Windows, paste is done using Shift-Insert. Shift-Insert already
@@ -494,7 +498,9 @@ proc ::tk::spinbox::MouseSelect {w x {cursor {}}} {
proc ::tk::spinbox::Paste {w x} {
$w icursor [::tk::spinbox::ClosestGap $w $x]
catch {$w insert insert [::tk::GetSelection $w PRIMARY]}
- if {"disabled" eq [$w cget -state]} {focus $w}
+ if {"disabled" eq [$w cget -state]} {
+ focus $w
+ }
}
# ::tk::spinbox::Motion --
diff --git a/library/tclIndex b/library/tclIndex
index 6b3547d..e7f5b81 100644
--- a/library/tclIndex
+++ b/library/tclIndex
@@ -122,6 +122,7 @@ set auto_index(::tk::ensure_psenc_is_loaded) [list source [file join $dir mkpsen
set auto_index(::tk::MessageBox) [list source [file join $dir msgbox.tcl]]
set auto_index(tk_menuBar) [list source [file join $dir obsolete.tcl]]
set auto_index(tk_bindForTraversal) [list source [file join $dir obsolete.tcl]]
+set auto_index(::tk::classic::restore) [list source [file join $dir obsolete.tcl]]
set auto_index(tk_optionMenu) [list source [file join $dir optMenu.tcl]]
set auto_index(tk_setPalette) [list source [file join $dir palette.tcl]]
set auto_index(::tk::RecolorTree) [list source [file join $dir palette.tcl]]
@@ -200,7 +201,7 @@ set auto_index(::tk::TabToWindow) [list source [file join $dir tk.tcl]]
set auto_index(::tk::IconList) [list source [file join $dir tkfbox.tcl]]
set auto_index(::tk::IconList_Index) [list source [file join $dir tkfbox.tcl]]
set auto_index(::tk::IconList_Selection) [list source [file join $dir tkfbox.tcl]]
-set auto_index(::tk::IconList_Curselection) [list source [file join $dir tkfbox.tcl]]
+set auto_index(::tk::IconList_CurSelection) [list source [file join $dir tkfbox.tcl]]
set auto_index(::tk::IconList_DrawSelection) [list source [file join $dir tkfbox.tcl]]
set auto_index(::tk::IconList_Get) [list source [file join $dir tkfbox.tcl]]
set auto_index(::tk::IconList_Config) [list source [file join $dir tkfbox.tcl]]
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index 297a203..6da2a0f 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -44,7 +44,8 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
}
set parent [winfo parent $w]
- while {[winfo toplevel $parent] ne $parent || [winfo class $parent] eq "Menu"} {
+ while {[winfo toplevel $parent] ne $parent \
+ || [winfo class $parent] eq "Menu"} {
set parent [winfo parent $parent]
}
if {$parent eq "."} {
@@ -67,7 +68,7 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
if {[$menu cget -title] ne ""} {
wm title $menu [$menu cget -title]
} else {
- switch [winfo class $parent] {
+ switch -- [winfo class $parent] {
Menubutton {
wm title $menu [$parent cget -text]
}
@@ -77,6 +78,16 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
}
}
+ if {[tk windowingsystem] eq "win32"} {
+ # [Bug 3181181]: Find the toplevel window for the menu
+ set parent [winfo toplevel $parent]
+ while {[winfo class $parent] eq "Menu"} {
+ set parent [winfo toplevel [winfo parent $parent]]
+ }
+ wm transient $menu [winfo toplevel $parent]
+ wm attributes $menu -toolwindow 1
+ }
+
$menu post $x $y
if {[winfo exists $menu] == 0} {
diff --git a/library/text.tcl b/library/text.tcl
index 3f608f3..d4ff18e 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -31,6 +31,7 @@
# char, word, or line.
# x, y - Last known mouse coordinates for scanning
# and auto-scanning.
+#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
@@ -51,12 +52,12 @@ bind Text <B1-Motion> {
bind Text <Double-1> {
set tk::Priv(selectMode) word
tk::TextSelectTo %W %x %y
- catch {%W mark set insert sel.last}
+ catch {%W mark set insert sel.first}
}
bind Text <Triple-1> {
set tk::Priv(selectMode) line
tk::TextSelectTo %W %x %y
- catch {%W mark set insert sel.last}
+ catch {%W mark set insert sel.first}
}
bind Text <Shift-1> {
tk::TextResetAnchor %W @%x,%y
@@ -86,10 +87,10 @@ bind Text <Control-1> {
%W mark set insert @%x,%y
}
bind Text <Left> {
- tk::TextSetCursor %W insert-1c
+ tk::TextSetCursor %W insert-1displayindices
}
bind Text <Right> {
- tk::TextSetCursor %W insert+1c
+ tk::TextSetCursor %W insert+1displayindices
}
bind Text <Up> {
tk::TextSetCursor %W [tk::TextUpDownLine %W -1]
@@ -98,10 +99,10 @@ bind Text <Down> {
tk::TextSetCursor %W [tk::TextUpDownLine %W 1]
}
bind Text <Shift-Left> {
- tk::TextKeySelect %W [%W index {insert - 1c}]
+ tk::TextKeySelect %W [%W index {insert - 1displayindices}]
}
bind Text <Shift-Right> {
- tk::TextKeySelect %W [%W index {insert + 1c}]
+ tk::TextKeySelect %W [%W index {insert + 1displayindices}]
}
bind Text <Shift-Up> {
tk::TextKeySelect %W [tk::TextUpDownLine %W -1]
@@ -153,16 +154,16 @@ bind Text <Control-Next> {
}
bind Text <Home> {
- tk::TextSetCursor %W {insert linestart}
+ tk::TextSetCursor %W {insert display linestart}
}
bind Text <Shift-Home> {
- tk::TextKeySelect %W {insert linestart}
+ tk::TextKeySelect %W {insert display linestart}
}
bind Text <End> {
- tk::TextSetCursor %W {insert lineend}
+ tk::TextSetCursor %W {insert display lineend}
}
bind Text <Shift-End> {
- tk::TextKeySelect %W {insert lineend}
+ tk::TextKeySelect %W {insert display lineend}
}
bind Text <Control-Home> {
tk::TextSetCursor %W 1.0
@@ -171,14 +172,14 @@ bind Text <Control-Shift-Home> {
tk::TextKeySelect %W 1.0
}
bind Text <Control-End> {
- tk::TextSetCursor %W {end - 1 char}
+ tk::TextSetCursor %W {end - 1 indices}
}
bind Text <Control-Shift-End> {
- tk::TextKeySelect %W {end - 1 char}
+ tk::TextKeySelect %W {end - 1 indices}
}
bind Text <Tab> {
- if { [%W cget -state] eq "normal" } {
+ if {[%W cget -state] eq "normal"} {
tk::TextInsert %W \t
focus %W
break
@@ -200,30 +201,32 @@ bind Text <Control-i> {
}
bind Text <Return> {
tk::TextInsert %W \n
- if {[%W cget -autoseparators]} {%W edit separator}
+ if {[%W cget -autoseparators]} {
+ %W edit separator
+ }
}
bind Text <Delete> {
- if {[%W tag nextrange sel 1.0 end] ne ""} {
+ if {[tk::TextCursorInSelection %W]} {
%W delete sel.first sel.last
- } else {
+ } elseif {[%W compare end != insert+1c]} {
%W delete insert
- %W see insert
}
+ %W see insert
}
bind Text <BackSpace> {
- if {[%W tag nextrange sel 1.0 end] ne ""} {
+ if {[tk::TextCursorInSelection %W]} {
%W delete sel.first sel.last
} elseif {[%W compare insert != 1.0]} {
%W delete insert-1c
- %W see insert
}
+ %W see insert
}
bind Text <Control-space> {
- %W mark set anchor insert
+ %W mark set [tk::TextAnchor %W] insert
}
bind Text <Select> {
- %W mark set anchor insert
+ %W mark set [tk::TextAnchor %W] insert
}
bind Text <Control-Shift-space> {
set tk::Priv(selectMode) char
@@ -253,7 +256,7 @@ bind Text <<Clear>> {
}
bind Text <<PasteSelection>> {
if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)]
- || !$tk::Priv(mouseMoved)} {
+ || !$tk::Priv(mouseMoved)} {
tk::TextPasteSelection %W %x %y
}
}
@@ -274,8 +277,7 @@ bind Text <Meta-KeyPress> {# nothing}
bind Text <Control-KeyPress> {# nothing}
bind Text <Escape> {# nothing}
bind Text <KP_Enter> {# nothing}
-
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
+if {[tk windowingsystem] eq "aqua"} {
bind Text <Command-KeyPress> {# nothing}
}
@@ -283,31 +285,31 @@ if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Text <Control-a> {
if {!$tk_strictMotif} {
- tk::TextSetCursor %W {insert linestart}
+ tk::TextSetCursor %W {insert display linestart}
}
}
bind Text <Control-b> {
if {!$tk_strictMotif} {
- tk::TextSetCursor %W insert-1c
+ tk::TextSetCursor %W insert-1displayindices
}
}
bind Text <Control-d> {
- if {!$tk_strictMotif} {
+ if {!$tk_strictMotif && [%W compare end != insert+1c]} {
%W delete insert
}
}
bind Text <Control-e> {
if {!$tk_strictMotif} {
- tk::TextSetCursor %W {insert lineend}
+ tk::TextSetCursor %W {insert display lineend}
}
}
bind Text <Control-f> {
if {!$tk_strictMotif} {
- tk::TextSetCursor %W insert+1c
+ tk::TextSetCursor %W insert+1displayindices
}
}
bind Text <Control-k> {
- if {!$tk_strictMotif} {
+ if {!$tk_strictMotif && [%W compare end != insert+1c]} {
if {[%W compare insert == {insert lineend}]} {
%W delete insert
} else {
@@ -345,21 +347,13 @@ bind Text <<Redo>> {
catch { %W edit redo }
}
-if {$tcl_platform(platform) ne "windows"} {
-bind Text <Control-v> {
- if {!$tk_strictMotif} {
- tk::TextScrollPages %W 1
- }
-}
-}
-
bind Text <Meta-b> {
if {!$tk_strictMotif} {
tk::TextSetCursor %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord]
}
}
bind Text <Meta-d> {
- if {!$tk_strictMotif} {
+ if {!$tk_strictMotif && [%W compare end != insert+1c]} {
%W delete insert [tk::TextNextWord %W insert]
}
}
@@ -391,13 +385,7 @@ bind Text <Meta-Delete> {
# Macintosh only bindings:
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
-bind Text <FocusIn> {
- %W configure -selectbackground systemHighlight -selectforeground systemHighlightText
-}
-bind Text <FocusOut> {
- %W configure -selectbackground systemHighlightSecondary -selectforeground systemHighlightText
-}
+if {[tk windowingsystem] eq "aqua"} {
bind Text <Option-Left> {
tk::TextSetCursor %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord]
}
@@ -422,6 +410,9 @@ bind Text <Shift-Option-Up> {
bind Text <Shift-Option-Down> {
tk::TextKeySelect %W [tk::TextNextPara %W insert]
}
+bind Text <Control-v> {
+ tk::TextScrollPages %W 1
+}
# End of Mac only bindings
}
@@ -429,11 +420,9 @@ bind Text <Shift-Option-Down> {
# A few additional bindings of my own.
bind Text <Control-h> {
- if {!$tk_strictMotif} {
- if {[%W compare insert != 1.0]} {
- %W delete insert-1c
- %W see insert
- }
+ if {!$tk_strictMotif && [%W compare insert != 1.0]} {
+ %W delete insert-1c
+ %W see insert
}
}
bind Text <2> {
@@ -449,25 +438,36 @@ bind Text <B2-Motion> {
set ::tk::Priv(prevPos) {}
# The MouseWheel will typically only fire on Windows and MacOS X.
-# However, someone could use the "event generate" command to produce
-# one on other platforms.
+# However, someone could use the "event generate" command to produce one
+# on other platforms. We must be careful not to round -ve values of %D
+# down to zero.
-if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
+if {[tk windowingsystem] eq "aqua"} {
bind Text <MouseWheel> {
- %W yview scroll [expr {- (%D)}] units
+ %W yview scroll [expr {-15 * (%D)}] pixels
}
bind Text <Option-MouseWheel> {
- %W yview scroll [expr {-10 * (%D)}] units
+ %W yview scroll [expr {-150 * (%D)}] pixels
}
bind Text <Shift-MouseWheel> {
- %W xview scroll [expr {- (%D)}] units
+ %W xview scroll [expr {-15 * (%D)}] pixels
}
bind Text <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10 * (%D)}] units
+ %W xview scroll [expr {-150 * (%D)}] pixels
}
} else {
+ # We must make sure that positive and negative movements are rounded
+ # equally to integers, avoiding the problem that
+ # (int)1/3 = 0,
+ # but
+ # (int)-1/3 = -1
+ # The following code ensure equal +/- behaviour.
bind Text <MouseWheel> {
- %W yview scroll [expr {- (%D / 120) * 4}] units
+ if {%D >= 0} {
+ %W yview scroll [expr {-%D/3}] pixels
+ } else {
+ %W yview scroll [expr {(2-%D)/3}] pixels
+ }
}
}
@@ -478,12 +478,12 @@ if {"x11" eq [tk windowingsystem]} {
# http://www.inria.fr/koala/colas/mouse-wheel-scroll/
bind Text <4> {
if {!$tk_strictMotif} {
- %W yview scroll -5 units
+ %W yview scroll -50 pixels
}
}
bind Text <5> {
if {!$tk_strictMotif} {
- %W yview scroll 5 units
+ %W yview scroll 50 pixels
}
}
}
@@ -526,12 +526,26 @@ proc ::tk::TextButton1 {w x y} {
set Priv(selectMode) char
set Priv(mouseMoved) 0
set Priv(pressX) $x
+ set anchorname [tk::TextAnchor $w]
$w mark set insert [TextClosestGap $w $x $y]
- $w mark set anchor insert
+ $w mark set $anchorname insert
+ # Set the anchor mark's gravity depending on the click position
+ # relative to the gap
+ set bbox [$w bbox [$w index $anchorname]]
+ if {$x > [lindex $bbox 0]} {
+ $w mark gravity $anchorname right
+ } else {
+ $w mark gravity $anchorname left
+ }
# Allow focus in any case on Windows, because that will let the
# selection be displayed even for state disabled text widgets.
- if {$::tcl_platform(platform) eq "windows" || [$w cget -state] eq "normal"} {focus $w}
- if {[$w cget -autoseparators]} {$w edit separator}
+ if {$::tcl_platform(platform) eq "windows" \
+ || [$w cget -state] eq "normal"} {
+ focus $w
+ }
+ if {[$w cget -autoseparators]} {
+ $w edit separator
+ }
}
# ::tk::TextSelectTo --
@@ -541,61 +555,85 @@ proc ::tk::TextButton1 {w x y} {
# ignores mouse motions initially until the mouse has moved from
# one character to another or until there have been multiple clicks.
#
+# Note that the 'anchor' is implemented programmatically using
+# a text widget mark, and uses a name that will be unique for each
+# text widget (even when there are multiple peers). Currently the
+# anchor is considered private to Tk, hence the name 'tk::anchor$w'.
+#
# Arguments:
# w - The text window in which the button was pressed.
# x - Mouse x position.
# y - Mouse y position.
+set ::tk::Priv(textanchoruid) 0
+
+proc ::tk::TextAnchor {w} {
+ variable Priv
+ if {![info exists Priv(textanchor,$w)]} {
+ set Priv(textanchor,$w) tk::anchor[incr Priv(textanchoruid)]
+ }
+ return $Priv(textanchor,$w)
+}
+
proc ::tk::TextSelectTo {w x y {extend 0}} {
global tcl_platform
variable ::tk::Priv
+ set anchorname [tk::TextAnchor $w]
set cur [TextClosestGap $w $x $y]
- if {[catch {$w index anchor}]} {
- $w mark set anchor $cur
+ if {[catch {$w index $anchorname}]} {
+ $w mark set $anchorname $cur
}
- set anchor [$w index anchor]
+ set anchor [$w index $anchorname]
if {[$w compare $cur != $anchor] || (abs($Priv(pressX) - $x) >= 3)} {
set Priv(mouseMoved) 1
}
- switch $Priv(selectMode) {
+ switch -- $Priv(selectMode) {
char {
- if {[$w compare $cur < anchor]} {
+ if {[$w compare $cur < $anchorname]} {
set first $cur
- set last anchor
+ set last $anchorname
} else {
- set first anchor
+ set first $anchorname
set last $cur
}
}
word {
- if {[$w compare $cur < anchor]} {
- set first [TextPrevPos $w "$cur + 1c" tcl_wordBreakBefore]
- if { !$extend } {
- set last [TextNextPos $w "anchor" tcl_wordBreakAfter]
- } else {
- set last anchor
- }
+ # Set initial range based only on the anchor (1 char min width)
+ if {[$w mark gravity $anchorname] eq "right"} {
+ set first $anchorname
+ set last "$anchorname + 1c"
} else {
- set last [TextNextPos $w "$cur - 1c" tcl_wordBreakAfter]
- if { !$extend } {
- set first [TextPrevPos $w anchor tcl_wordBreakBefore]
- } else {
- set first anchor
- }
+ set first "$anchorname - 1c"
+ set last $anchorname
}
+ # Extend range (if necessary) based on the current point
+ if {[$w compare $cur < $first]} {
+ set first $cur
+ } elseif {[$w compare $cur > $last]} {
+ set last $cur
+ }
+
+ # Now find word boundaries
+ set first [TextPrevPos $w "$first + 1c" tcl_wordBreakBefore]
+ set last [TextNextPos $w "$last - 1c" tcl_wordBreakAfter]
}
line {
- if {[$w compare $cur < anchor]} {
- set first [$w index "$cur linestart"]
- set last [$w index "anchor - 1c lineend + 1c"]
- } else {
- set first [$w index "anchor linestart"]
- set last [$w index "$cur lineend + 1c"]
+ # Set initial range based only on the anchor
+ set first "$anchorname linestart"
+ set last "$anchorname lineend"
+
+ # Extend range (if necessary) based on the current point
+ if {[$w compare $cur < $first]} {
+ set first "$cur linestart"
+ } elseif {[$w compare $cur > $last]} {
+ set last "$cur lineend"
}
+ set first [$w index $first]
+ set last [$w index "$last + 1c"]
}
}
- if {$Priv(mouseMoved) || $Priv(selectMode) ne "char"} {
+ if {$Priv(mouseMoved) || ($Priv(selectMode) ne "char")} {
$w tag remove sel 0.0 end
$w mark set insert $cur
$w tag add sel $first $last
@@ -615,16 +653,17 @@ proc ::tk::TextSelectTo {w x y {extend 0}} {
proc ::tk::TextKeyExtend {w index} {
+ set anchorname [tk::TextAnchor $w]
set cur [$w index $index]
- if {[catch {$w index anchor}]} {
- $w mark set anchor $cur
+ if {[catch {$w index $anchorname}]} {
+ $w mark set $anchorname $cur
}
- set anchor [$w index anchor]
- if {[$w compare $cur < anchor]} {
+ set anchor [$w index $anchorname]
+ if {[$w compare $cur < $anchorname]} {
set first $cur
- set last anchor
+ set last $anchorname
} else {
- set first anchor
+ set first $anchorname
set last $cur
}
$w tag remove sel 0.0 $first
@@ -654,7 +693,9 @@ proc ::tk::TextPasteSelection {w x y} {
$w configure -autoseparators 1
}
}
- if {[$w cget -state] eq "normal"} {focus $w}
+ if {[$w cget -state] eq "normal"} {
+ focus $w
+ }
}
# ::tk::TextAutoScan --
@@ -670,11 +711,13 @@ proc ::tk::TextPasteSelection {w x y} {
proc ::tk::TextAutoScan {w} {
variable ::tk::Priv
- if {![winfo exists $w]} return
+ if {![winfo exists $w]} {
+ return
+ }
if {$Priv(y) >= [winfo height $w]} {
- $w yview scroll 2 units
+ $w yview scroll [expr {1 + $Priv(y) - [winfo height $w]}] pixels
} elseif {$Priv(y) < 0} {
- $w yview scroll -2 units
+ $w yview scroll [expr {-1 + $Priv(y)}] pixels
} elseif {$Priv(x) >= [winfo width $w]} {
$w xview scroll 2 units
} elseif {$Priv(x) < 0} {
@@ -697,14 +740,15 @@ proc ::tk::TextAutoScan {w} {
# pos - The desired new position for the cursor in the window.
proc ::tk::TextSetCursor {w pos} {
-
if {[$w compare $pos == end]} {
set pos {end - 1 chars}
}
$w mark set insert $pos
$w tag remove sel 1.0 end
$w see insert
- if {[$w cget -autoseparators]} {$w edit separator}
+ if {[$w cget -autoseparators]} {
+ $w edit separator
+ }
}
# ::tk::TextKeySelect
@@ -718,20 +762,20 @@ proc ::tk::TextSetCursor {w pos} {
# actually been moved to this position yet).
proc ::tk::TextKeySelect {w new} {
-
+ set anchorname [tk::TextAnchor $w]
if {[$w tag nextrange sel 1.0 end] eq ""} {
if {[$w compare $new < insert]} {
$w tag add sel $new insert
} else {
$w tag add sel insert $new
}
- $w mark set anchor insert
+ $w mark set $anchorname insert
} else {
- if {[$w compare $new < anchor]} {
+ if {[$w compare $new < $anchorname]} {
set first $new
- set last anchor
+ set last $anchorname
} else {
- set first anchor
+ set first $anchorname
set last $new
}
$w tag remove sel 1.0 $first
@@ -758,23 +802,23 @@ proc ::tk::TextKeySelect {w new} {
# which end of selection should be used as anchor point.
proc ::tk::TextResetAnchor {w index} {
-
if {[$w tag ranges sel] eq ""} {
- # Don't move the anchor if there is no selection now; this makes
- # the widget behave "correctly" when the user clicks once, then
- # shift-clicks somewhere -- ie, the area between the two clicks will be
- # selected. [Bug: 5929].
+ # Don't move the anchor if there is no selection now; this
+ # makes the widget behave "correctly" when the user clicks
+ # once, then shift-clicks somewhere -- ie, the area between
+ # the two clicks will be selected. [Bug: 5929].
return
}
+ set anchorname [tk::TextAnchor $w]
set a [$w index $index]
set b [$w index sel.first]
set c [$w index sel.last]
if {[$w compare $a < $b]} {
- $w mark set anchor sel.last
+ $w mark set $anchorname sel.last
return
}
if {[$w compare $a > $c]} {
- $w mark set anchor sel.first
+ $w mark set $anchorname sel.first
return
}
scan $a "%d.%d" lineA chA
@@ -786,16 +830,31 @@ proc ::tk::TextResetAnchor {w index} {
return
}
if {[string length [$w get $b $a]] < ($total/2)} {
- $w mark set anchor sel.last
+ $w mark set $anchorname sel.last
} else {
- $w mark set anchor sel.first
+ $w mark set $anchorname sel.first
}
return
}
if {($lineA-$lineB) < ($lineC-$lineA)} {
- $w mark set anchor sel.last
+ $w mark set $anchorname sel.last
} else {
- $w mark set anchor sel.first
+ $w mark set $anchorname sel.first
+ }
+}
+
+# ::tk::TextCursorInSelection --
+# Check whether the selection exists and contains the insertion cursor. Note
+# that it assumes that the selection is contiguous.
+#
+# Arguments:
+# w - The text widget whose selection is to be checked
+
+proc ::tk::TextCursorInSelection {w} {
+ expr {
+ [llength [$w tag ranges sel]]
+ && [$w compare sel.first <= insert]
+ && [$w compare sel.last >= insert]
}
}
@@ -813,49 +872,47 @@ proc ::tk::TextInsert {w s} {
return
}
set compound 0
- catch {
- if {[$w compare sel.first <= insert] \
- && [$w compare sel.last >= insert]} {
- set oldSeparator [$w cget -autoseparators]
- if { $oldSeparator } {
- $w configure -autoseparators 0
- $w edit separator
- set compound 1
- }
- $w delete sel.first sel.last
+ if {[TextCursorInSelection $w]} {
+ set compound [$w cget -autoseparators]
+ if {$compound} {
+ $w configure -autoseparators 0
+ $w edit separator
}
+ $w delete sel.first sel.last
}
$w insert insert $s
$w see insert
- if { $compound && $oldSeparator } {
- $w edit separator
- $w configure -autoseparators 1
+ if {$compound} {
+ $w edit separator
+ $w configure -autoseparators 1
}
}
# ::tk::TextUpDownLine --
-# Returns the index of the character one line above or below the
-# insertion cursor. There are two tricky things here. First,
-# we want to maintain the original column across repeated operations,
-# even though some lines that will get passed through don't have
-# enough characters to cover the original column. Second, don't
-# try to scroll past the beginning or end of the text.
+# Returns the index of the character one display line above or below the
+# insertion cursor. There are two tricky things here. First, we want to
+# maintain the original x position across repeated operations, even though
+# some lines that will get passed through don't have enough characters to
+# cover the original column. Second, don't try to scroll past the
+# beginning or end of the text.
#
# Arguments:
# w - The text window in which the cursor is to move.
-# n - The number of lines to move: -1 for up one line,
+# n - The number of display lines to move: -1 for up one line,
# +1 for down one line.
proc ::tk::TextUpDownLine {w n} {
variable ::tk::Priv
set i [$w index insert]
- scan $i "%d.%d" line char
if {$Priv(prevPos) ne $i} {
- set Priv(char) $char
+ set Priv(textPosOrig) $i
}
- set new [$w index [expr {$line + $n}].$Priv(char)]
- if {[$w compare $new == end] || [$w compare $new == "insert linestart"]} {
+ set lines [$w count -displaylines $Priv(textPosOrig) $i]
+ set new [$w index \
+ "$Priv(textPosOrig) + [expr {$lines + $n}] displaylines"]
+ if {[$w compare $new == end] \
+ || [$w compare $new == "insert display linestart"]} {
set new $i
}
set Priv(prevPos) $new
@@ -874,13 +931,13 @@ proc ::tk::TextUpDownLine {w n} {
proc ::tk::TextPrevPara {w pos} {
set pos [$w index "$pos linestart"]
while {1} {
- if {([$w get "$pos - 1 line"] eq "\n" \
- && [$w get $pos] ne "\n") || $pos eq "1.0"} {
- if {[regexp -indices {^[ ]+(.)} [$w get $pos "$pos lineend"] \
- dummy index]} {
+ if {([$w get "$pos - 1 line"] eq "\n" && ([$w get $pos] ne "\n")) \
+ || $pos eq "1.0"} {
+ if {[regexp -indices -- {^[ \t]+(.)} \
+ [$w get $pos "$pos lineend"] -> index]} {
set pos [$w index "$pos + [lindex $index 0] chars"]
}
- if {[$w compare $pos != insert] || [lindex [split $pos .] 0] == 1} {
+ if {[$w compare $pos != insert] || [lindex [split $pos .] 0]==1} {
return $pos
}
}
@@ -911,8 +968,8 @@ proc ::tk::TextNextPara {w start} {
return [$w index "end - 1c"]
}
}
- if {[regexp -indices {^[ ]+(.)} [$w get $pos "$pos lineend"] \
- dummy index]} {
+ if {[regexp -indices -- {^[ \t]+(.)} \
+ [$w get $pos "$pos lineend"] -> index]} {
return [$w index "$pos + [lindex $index 0] chars"]
}
return $pos
@@ -1013,9 +1070,8 @@ proc ::tk_textCut w {
proc ::tk_textPaste w {
global tcl_platform
if {![catch {::tk::GetSelection $w CLIPBOARD} sel]} {
- # ensure this is seen as an atomic op to undo
set oldSeparator [$w cget -autoseparators]
- if { $oldSeparator } {
+ if {$oldSeparator} {
$w configure -autoseparators 0
$w edit separator
}
@@ -1023,7 +1079,7 @@ proc ::tk_textPaste w {
catch { $w delete sel.first sel.last }
}
$w insert insert $sel
- if { $oldSeparator } {
+ if {$oldSeparator} {
$w edit separator
$w configure -autoseparators 1
}
@@ -1043,7 +1099,7 @@ proc ::tk_textPaste w {
if {$tcl_platform(platform) eq "windows"} {
proc ::tk::TextNextWord {w start} {
TextNextPos $w [TextNextPos $w $start tcl_endOfWord] \
- tcl_startOfNextWord
+ tcl_startOfNextWord
}
} else {
proc ::tk::TextNextWord {w start} {
@@ -1064,16 +1120,10 @@ proc ::tk::TextNextPos {w start op} {
set text ""
set cur $start
while {[$w compare $cur < end]} {
- set text $text[$w get $cur "$cur lineend + 1c"]
+ set text $text[$w get -displaychars $cur "$cur lineend + 1c"]
set pos [$op $text 0]
if {$pos >= 0} {
- ## Adjust for embedded windows and images
- ## dump gives us 3 items per window/image
- set dump [$w dump -image -window $start "$start + $pos c"]
- if {[llength $dump]} {
- set pos [expr {$pos + ([llength $dump]/3)}]
- }
- return [$w index "$start + $pos c"]
+ return [$w index "$start + $pos display chars"]
}
set cur [$w index "$cur lineend +1c"]
}
@@ -1093,22 +1143,10 @@ proc ::tk::TextPrevPos {w start op} {
set text ""
set cur $start
while {[$w compare $cur > 0.0]} {
- set text [$w get "$cur linestart - 1c" $cur]$text
+ set text [$w get -displaychars "$cur linestart - 1c" $cur]$text
set pos [$op $text end]
if {$pos >= 0} {
- ## Adjust for embedded windows and images
- ## dump gives us 3 items per window/image
- set dump [$w dump -image -window "$cur linestart" "$start - 1c"]
- if {[llength $dump]} {
- ## This is a hokey extra hack for control-arrow movement
- ## that should be in a while loop to be correct (hobbs)
- if {[$w compare [lindex $dump 2] > \
- "$cur linestart - 1c + $pos c"]} {
- incr pos -1
- }
- set pos [expr {$pos + ([llength $dump]/3)}]
- }
- return [$w index "$cur linestart - 1c + $pos c"]
+ return [$w index "$cur linestart - 1c + $pos display chars"]
}
set cur [$w index "$cur linestart - 1c"]
}
@@ -1125,10 +1163,11 @@ proc ::tk::TextPrevPos {w start op} {
# y - y location on screen
proc ::tk::TextScanMark {w x y} {
+ variable ::tk::Priv
$w scan mark $x $y
- set ::tk::Priv(x) $x
- set ::tk::Priv(y) $y
- set ::tk::Priv(mouseMoved) 0
+ set Priv(x) $x
+ set Priv(y) $y
+ set Priv(mouseMoved) 0
}
# ::tk::TextScanDrag --
@@ -1141,14 +1180,19 @@ proc ::tk::TextScanMark {w x y} {
# y - y location on screen
proc ::tk::TextScanDrag {w x y} {
+ variable ::tk::Priv
# Make sure these exist, as some weird situations can trigger the
# motion binding without the initial press. [Bug #220269]
- if {![info exists ::tk::Priv(x)]} { set ::tk::Priv(x) $x }
- if {![info exists ::tk::Priv(y)]} { set ::tk::Priv(y) $y }
- if {($x != $::tk::Priv(x)) || ($y != $::tk::Priv(y))} {
- set ::tk::Priv(mouseMoved) 1
+ if {![info exists Priv(x)]} {
+ set Priv(x) $x
+ }
+ if {![info exists Priv(y)]} {
+ set Priv(y) $y
+ }
+ if {($x != $Priv(x)) || ($y != $Priv(y))} {
+ set Priv(mouseMoved) 1
}
- if {[info exists ::tk::Priv(mouseMoved)] && $::tk::Priv(mouseMoved)} {
+ if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} {
$w scan dragto $x $y
}
}
diff --git a/library/tk.tcl b/library/tk.tcl
index b9c3872..8e967cb 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -1,18 +1,21 @@
# tk.tcl --
#
-# Initialization script normally executed in the interpreter for each
-# Tk-based application. Arranges class bindings for widgets.
+# Initialization script normally executed in the interpreter for each Tk-based
+# application. Arranges class bindings for widgets.
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+# See the file "license.terms" for information on usage and redistribution of
+# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# Insist on running with compatible versions of Tcl and Tk.
-package require -exact Tk 8.4
-package require -exact Tcl 8.4
+package require Tcl 8.5 ;# Guard against [source] in an 8.4- interp before
+ ;# using 8.5 [package] features.
+# Insist on running with compatible version of Tcl
+package require Tcl 8.5.0
+# Verify that we have Tk binary and script components from the same release
+package require -exact Tk 8.5.11
# Create a ::tk namespace
namespace eval ::tk {
@@ -20,10 +23,10 @@ namespace eval ::tk {
namespace eval msgcat {
namespace export mc mcmax
if {[interp issafe] || [catch {package require msgcat}]} {
- # The msgcat package is not available. Supply our own
- # minimal replacement.
+ # The msgcat package is not available. Supply our own minimal
+ # replacement.
proc mc {src args} {
- return [eval [list format $src] $args]
+ return [format $src {*}$args]
}
proc mcmax {args} {
set max 0
@@ -44,26 +47,33 @@ namespace eval ::tk {
}
namespace import ::tk::msgcat::*
}
+# and a ::ttk namespace
+namespace eval ::ttk {
+ if {$::tk_library ne ""} {
+ # avoid file join to work in safe interps, but this is also x-plat ok
+ variable library $::tk_library/ttk
+ }
+}
-# Add Tk's directory to the end of the auto-load search path, if it
+# Add Ttk & Tk's directory to the end of the auto-load search path, if it
# isn't already on the path:
-if {[info exists ::auto_path] && $::tk_library ne "" && \
- [lsearch -exact $::auto_path $::tk_library] < 0} {
- lappend ::auto_path $::tk_library
+if {[info exists ::auto_path] && ($::tk_library ne "")
+ && ($::tk_library ni $::auto_path)} {
+ lappend ::auto_path $::tk_library $::ttk::library
}
# Turn off strict Motif look and feel as a default.
set ::tk_strictMotif 0
-# Turn on useinputmethods (X Input Methods) by default.
-# We catch this because safe interpreters may not allow the call.
+# Turn on useinputmethods (X Input Methods) by default. We catch this because
+# safe interpreters may not allow the call.
catch {tk useinputmethods 1}
-
+
# ::tk::PlaceWindow --
-# place a toplevel at a particular position
+# Place a toplevel at a particular position
# Arguments:
# toplevel name of toplevel window
# ?placement? pointer ?center? ; places $w centered on the pointer
@@ -77,12 +87,11 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
wm withdraw $w
update idletasks
set checkBounds 1
- set place_len [string length $place]
if {$place eq ""} {
set x [expr {([winfo screenwidth $w]-[winfo reqwidth $w])/2}]
set y [expr {([winfo screenheight $w]-[winfo reqheight $w])/2}]
set checkBounds 0
- } elseif {[string equal -length $place_len $place "pointer"]} {
+ } elseif {[string equal -length [string length $place] $place "pointer"]} {
## place at POINTER (centered if $anchor == center)
if {[string equal -length [string length $anchor] $anchor "center"]} {
set x [expr {[winfo pointerx $w]-[winfo reqwidth $w]/2}]
@@ -91,7 +100,7 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
set x [winfo pointerx $w]
set y [winfo pointery $w]
}
- } elseif {[string equal -length $place_len $place "widget"] && \
+ } elseif {[string equal -length [string length $place] $place "widget"] && \
[winfo exists $anchor] && [winfo ismapped $anchor]} {
## center about WIDGET $anchor, widget must be mapped
set x [expr {[winfo rootx $anchor] + \
@@ -103,10 +112,7 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
set y [expr {([winfo screenheight $w]-[winfo reqheight $w])/2}]
set checkBounds 0
}
-
- set windowingsystem [tk windowingsystem]
-
- if {$windowingsystem eq "win32"} {
+ if {[tk windowingsystem] eq "win32"} {
# Bug 533519: win32 multiple desktops may produce negative geometry.
set checkBounds 0
}
@@ -121,7 +127,7 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
} elseif {$y > ([winfo screenheight $w]-[winfo reqheight $w])} {
set y [expr {[winfo screenheight $w]-[winfo reqheight $w]}]
}
- if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
+ if {[tk windowingsystem] eq "aqua"} {
# Avoid the native menu bar which sits on top of everything.
if {$y < 22} { set y 22 }
}
@@ -129,9 +135,9 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
wm geometry $w +$x+$y
wm deiconify $w
}
-
+
# ::tk::SetFocusGrab --
-# swap out current focus and grab temporarily (for dialogs)
+# Swap out current focus and grab temporarily (for dialogs)
# Arguments:
# grab new window to grab
# focus window to give focus to
@@ -148,8 +154,8 @@ proc ::tk::SetFocusGrab {grab {focus {}}} {
if {[winfo exists $oldGrab]} {
lappend data [grab status $oldGrab]
}
- # The "grab" command will fail if another application
- # already holds the grab. So catch it.
+ # The "grab" command will fail if another application already holds the
+ # grab. So catch it.
catch {grab $grab}
if {[winfo exists $focus]} {
focus $focus
@@ -157,7 +163,7 @@ proc ::tk::SetFocusGrab {grab {focus {}}} {
}
# ::tk::RestoreFocusGrab --
-# restore old focus and grab (for dialogs)
+# Restore old focus and grab (for dialogs)
# Arguments:
# grab window that had taken grab
# focus window that had taken focus
@@ -189,12 +195,12 @@ proc ::tk::RestoreFocusGrab {grab focus {destroy destroy}} {
}
}
}
-
+
# ::tk::GetSelection --
-# This tries to obtain the default selection. On Unix, we first try
-# and get a UTF8_STRING, a type supported by modern Unix apps for
-# passing Unicode data safely. We fall back on the default STRING
-# type otherwise. On Windows, only the STRING type is necessary.
+# This tries to obtain the default selection. On Unix, we first try and get
+# a UTF8_STRING, a type supported by modern Unix apps for passing Unicode
+# data safely. We fall back on the default STRING type otherwise. On
+# Windows, only the STRING type is necessary.
# Arguments:
# w The widget for which the selection will be retrieved.
# Important for the -displayof property.
@@ -221,18 +227,18 @@ if {$tcl_platform(platform) eq "unix"} {
}
}
}
-
+
# ::tk::ScreenChanged --
-# This procedure is invoked by the binding mechanism whenever the
-# "current" screen is changing. The procedure does two things.
-# First, it uses "upvar" to make variable "::tk::Priv" point at an
-# array variable that holds state for the current display. Second,
-# it initializes the array if it didn't already exist.
+# This procedure is invoked by the binding mechanism whenever the "current"
+# screen is changing. The procedure does two things. First, it uses "upvar"
+# to make variable "::tk::Priv" point at an array variable that holds state
+# for the current display. Second, it initializes the array if it didn't
+# already exist.
#
# Arguments:
# screen - The name of the new screen.
-proc ::tk::ScreenChanged screen {
+proc ::tk::ScreenChanged {screen} {
set x [string last . $screen]
if {$x > 0} {
set disp [string range $screen 0 [expr {$x - 1}]]
@@ -245,7 +251,7 @@ proc ::tk::ScreenChanged screen {
# display names. [Bug 2912473]
set disp [string map {:: _doublecolon_} $disp]
- uplevel #0 upvar #0 ::tk::Priv.$disp ::tk::Priv
+ uplevel #0 [list upvar #0 ::tk::Priv.$disp ::tk::Priv]
variable ::tk::Priv
global tcl_platform
@@ -285,11 +291,10 @@ proc ::tk::ScreenChanged screen {
# value, which will cause trouble later).
tk::ScreenChanged [winfo screen .]
-
+
# ::tk::EventMotifBindings --
-# This procedure is invoked as a trace whenever ::tk_strictMotif is
-# changed. It is used to turn on or turn off the motif virtual
-# bindings.
+# This procedure is invoked as a trace whenever ::tk_strictMotif is changed.
+# It is used to turn on or turn off the motif virtual bindings.
#
# Arguments:
# n1 - the name of the variable being changed ("::tk_strictMotif").
@@ -308,119 +313,102 @@ proc ::tk::EventMotifBindings {n1 dummy dummy} {
event $op <<Paste>> <Control-Key-y>
event $op <<Undo>> <Control-underscore>
}
-
+
#----------------------------------------------------------------------
-# Define common dialogs on platforms where they are not implemented
-# using compiled code.
+# Define common dialogs on platforms where they are not implemented using
+# compiled code.
#----------------------------------------------------------------------
-if {[info commands tk_chooseColor] eq ""} {
+if {![llength [info commands tk_chooseColor]]} {
proc ::tk_chooseColor {args} {
- return [eval tk::dialog::color:: $args]
+ return [tk::dialog::color:: {*}$args]
}
}
-if {[info commands tk_getOpenFile] eq ""} {
+if {![llength [info commands tk_getOpenFile]]} {
proc ::tk_getOpenFile {args} {
if {$::tk_strictMotif} {
- return [eval tk::MotifFDialog open $args]
+ return [tk::MotifFDialog open {*}$args]
} else {
- return [eval ::tk::dialog::file:: open $args]
+ return [::tk::dialog::file:: open {*}$args]
}
}
}
-if {[info commands tk_getSaveFile] eq ""} {
+if {![llength [info commands tk_getSaveFile]]} {
proc ::tk_getSaveFile {args} {
if {$::tk_strictMotif} {
- return [eval tk::MotifFDialog save $args]
+ return [tk::MotifFDialog save {*}$args]
} else {
- return [eval ::tk::dialog::file:: save $args]
+ return [::tk::dialog::file:: save {*}$args]
}
}
}
-if {[info commands tk_messageBox] eq ""} {
+if {![llength [info commands tk_messageBox]]} {
proc ::tk_messageBox {args} {
- return [eval tk::MessageBox $args]
+ return [tk::MessageBox {*}$args]
}
}
-if {[info command tk_chooseDirectory] eq ""} {
+if {![llength [info command tk_chooseDirectory]]} {
proc ::tk_chooseDirectory {args} {
- return [eval ::tk::dialog::file::chooseDir:: $args]
+ return [::tk::dialog::file::chooseDir:: {*}$args]
}
}
-
+
#----------------------------------------------------------------------
# Define the set of common virtual events.
#----------------------------------------------------------------------
-switch [tk windowingsystem] {
+switch -exact -- [tk windowingsystem] {
"x11" {
- event add <<Cut>> <Control-Key-x> <Key-F20>
- event add <<Copy>> <Control-Key-c> <Key-F16>
- event add <<Paste>> <Control-Key-v> <Key-F18>
+ event add <<Cut>> <Control-Key-x> <Key-F20> <Control-Lock-Key-X>
+ event add <<Copy>> <Control-Key-c> <Key-F16> <Control-Lock-Key-C>
+ event add <<Paste>> <Control-Key-v> <Key-F18> <Control-Lock-Key-V>
event add <<PasteSelection>> <ButtonRelease-2>
- event add <<Undo>> <Control-Key-z>
- event add <<Redo>> <Control-Key-Z>
- # Some OS's define a goofy (as in, not <Shift-Tab>) keysym
- # that is returned when the user presses <Shift-Tab>. In order for
- # tab traversal to work, we have to add these keysyms to the
- # PrevWindow event.
- # We use catch just in case the keysym isn't recognized.
- # This is needed for XFree86 systems
+ event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z>
+ event add <<Redo>> <Control-Key-Z> <Control-Lock-Key-z>
+ # Some OS's define a goofy (as in, not <Shift-Tab>) keysym that is
+ # returned when the user presses <Shift-Tab>. In order for tab
+ # traversal to work, we have to add these keysyms to the PrevWindow
+ # event. We use catch just in case the keysym isn't recognized. This
+ # is needed for XFree86 systems
catch { event add <<PrevWindow>> <ISO_Left_Tab> }
# This seems to be correct on *some* HP systems.
catch { event add <<PrevWindow>> <hpBackTab> }
trace add variable ::tk_strictMotif write ::tk::EventMotifBindings
set ::tk_strictMotif $::tk_strictMotif
- # On unix, we want to always display entry/text selection,
- # regardless of which window has focus
+ # On unix, we want to always display entry/text selection, regardless
+ # of which window has focus
set ::tk::AlwaysShowSelection 1
}
"win32" {
- event add <<Cut>> <Control-Key-x> <Shift-Key-Delete>
- event add <<Copy>> <Control-Key-c> <Control-Key-Insert>
- event add <<Paste>> <Control-Key-v> <Shift-Key-Insert>
+ event add <<Cut>> <Control-Key-x> <Shift-Key-Delete> \
+ <Control-Lock-Key-X>
+ event add <<Copy>> <Control-Key-c> <Control-Key-Insert> \
+ <Control-Lock-Key-C>
+ event add <<Paste>> <Control-Key-v> <Shift-Key-Insert> \
+ <Control-Lock-Key-V>
event add <<PasteSelection>> <ButtonRelease-2>
- event add <<Undo>> <Control-Key-z>
- event add <<Redo>> <Control-Key-y>
+ event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z>
+ event add <<Redo>> <Control-Key-y> <Control-Lock-Key-Y>
}
"aqua" {
- event add <<Cut>> <Command-Key-x> <Key-F2>
- event add <<Copy>> <Command-Key-c> <Key-F3>
- event add <<Paste>> <Command-Key-v> <Key-F4>
+ event add <<Cut>> <Command-Key-x> <Key-F2> <Control-Lock-Key-X>
+ event add <<Copy>> <Command-Key-c> <Key-F3> <Control-Lock-Key-C>
+ event add <<Paste>> <Command-Key-v> <Key-F4> <Control-Lock-Key-V>
event add <<PasteSelection>> <ButtonRelease-2>
event add <<Clear>> <Clear>
- event add <<Undo>> <Command-Key-z>
- event add <<Redo>> <Command-Key-y>
- }
- "classic" {
- event add <<Cut>> <Control-Key-x> <Key-F2>
- event add <<Copy>> <Control-Key-c> <Key-F3>
- event add <<Paste>> <Control-Key-v> <Key-F4>
- event add <<PasteSelection>> <ButtonRelease-2>
- event add <<Clear>> <Clear>
- event add <<Undo>> <Control-Key-z> <Key-F1>
- event add <<Redo>> <Control-Key-Z>
+ event add <<Undo>> <Command-Key-z> <Control-Lock-Key-Z>
+ event add <<Redo>> <Command-Key-y> <Control-Lock-Key-Y>
}
}
+
# ----------------------------------------------------------------------
# Read in files that define all of the class bindings.
# ----------------------------------------------------------------------
if {$::tk_library ne ""} {
- if {$tcl_platform(platform) eq "macintosh"} {
- proc ::tk::SourceLibFile {file} {
- if {[catch {
- namespace eval :: \
- [list source [file join $::tk_library $file.tcl]]
- }]} {
- namespace eval :: [list source -rsrc $file]
- }
- }
- } else {
- proc ::tk::SourceLibFile {file} {
- namespace eval :: [list source [file join $::tk_library $file.tcl]]
- }
+ proc ::tk::SourceLibFile {file} {
+ namespace eval :: [list source [file join $::tk_library $file.tcl]]
}
namespace eval ::tk {
SourceLibFile button
@@ -434,6 +422,7 @@ if {$::tk_library ne ""} {
SourceLibFile text
}
}
+
# ----------------------------------------------------------------------
# Default bindings for keyboard traversal.
# ----------------------------------------------------------------------
@@ -441,12 +430,11 @@ if {$::tk_library ne ""} {
event add <<PrevWindow>> <Shift-Tab>
bind all <Tab> {tk::TabToWindow [tk_focusNext %W]}
bind all <<PrevWindow>> {tk::TabToWindow [tk_focusPrev %W]}
-
+
# ::tk::CancelRepeat --
-# This procedure is invoked to cancel an auto-repeat action described
-# by ::tk::Priv(afterId). It's used by several widgets to auto-scroll
-# the widget when the mouse is dragged out of the widget with a
-# button pressed.
+# This procedure is invoked to cancel an auto-repeat action described by
+# ::tk::Priv(afterId). It's used by several widgets to auto-scroll the widget
+# when the mouse is dragged out of the widget with a button pressed.
#
# Arguments:
# None.
@@ -456,102 +444,103 @@ proc ::tk::CancelRepeat {} {
after cancel $Priv(afterId)
set Priv(afterId) {}
}
-
+
# ::tk::TabToWindow --
-# This procedure moves the focus to the given widget. If the widget
-# is an entry or a spinbox, it selects the entire contents of the widget.
+# This procedure moves the focus to the given widget.
+# It sends a <<TraverseOut>> virtual event to the previous focus window, if
+# any, before changing the focus, and a <<TraverseIn>> event to the new focus
+# window afterwards.
#
# Arguments:
# w - Window to which focus should be set.
proc ::tk::TabToWindow {w} {
- set wclass [winfo class $w]
-
- if {$wclass eq "Entry" || $wclass eq "Spinbox"} {
- $w selection range 0 end
- $w icursor end
+ set focus [focus]
+ if {$focus ne ""} {
+ event generate $focus <<TraverseOut>>
}
focus $w
+ event generate $w <<TraverseIn>>
}
-
+
# ::tk::UnderlineAmpersand --
-# This procedure takes some text with ampersand and returns
-# text w/o ampersand and position of the ampersand.
-# Double ampersands are converted to single ones.
-# Position returned is -1 when there is no ampersand.
+# This procedure takes some text with ampersand and returns text w/o ampersand
+# and position of the ampersand. Double ampersands are converted to single
+# ones. Position returned is -1 when there is no ampersand.
#
proc ::tk::UnderlineAmpersand {text} {
- set idx [string first "&" $text]
- if {$idx >= 0} {
- set underline $idx
- # ignore "&&"
- while {[string match "&" [string index $text [expr {$idx + 1}]]]} {
- set base [expr {$idx + 2}]
- set idx [string first "&" [string range $text $base end]]
- if {$idx < 0} {
- break
- } else {
- set underline [expr {$underline + $idx + 1}]
- incr idx $base
- }
- }
- }
- if {$idx >= 0} {
- regsub -all -- {&([^&])} $text {\1} text
- }
- return [list $text $idx]
+ set s [string map {&& & & \ufeff} $text]
+ set idx [string first \ufeff $s]
+ return [list [string map {\ufeff {}} $s] $idx]
}
# ::tk::SetAmpText --
-# Given widget path and text with "magic ampersands",
-# sets -text and -underline options for the widget
+# Given widget path and text with "magic ampersands", sets -text and
+# -underline options for the widget
#
proc ::tk::SetAmpText {widget text} {
- foreach {newtext under} [::tk::UnderlineAmpersand $text] {
- $widget configure -text $newtext -underline $under
- }
+ lassign [UnderlineAmpersand $text] newtext under
+ $widget configure -text $newtext -underline $under
}
# ::tk::AmpWidget --
-# Creates new widget, turning -text option into -text and
-# -underline options, returned by ::tk::UnderlineAmpersand.
+# Creates new widget, turning -text option into -text and -underline options,
+# returned by ::tk::UnderlineAmpersand.
#
proc ::tk::AmpWidget {class path args} {
- set wcmd [list $class $path]
+ set options {}
foreach {opt val} $args {
if {$opt eq "-text"} {
- foreach {newtext under} [::tk::UnderlineAmpersand $val] {
- lappend wcmd -text $newtext -underline $under
- }
+ lassign [UnderlineAmpersand $val] newtext under
+ lappend options -text $newtext -underline $under
} else {
- lappend wcmd $opt $val
+ lappend options $opt $val
}
}
- eval $wcmd
- if {$class eq "button"} {
+ set result [$class $path {*}$options]
+ if {[string match "*button" $class]} {
bind $path <<AltUnderlined>> [list $path invoke]
}
- return $path
+ return $result
}
+# ::tk::AmpMenuArgs --
+# Processes arguments for a menu entry, turning -label option into -label and
+# -underline options, returned by ::tk::UnderlineAmpersand.
+#
+proc ::tk::AmpMenuArgs {widget add type args} {
+ set options {}
+ foreach {opt val} $args {
+ if {$opt eq "-label"} {
+ lassign [UnderlineAmpersand $val] newlabel under
+ lappend options -label $newlabel -underline $under
+ } else {
+ lappend options $opt $val
+ }
+ }
+ $widget add $type {*}$options
+}
+
# ::tk::FindAltKeyTarget --
-# search recursively through the hierarchy of visible widgets
-# to find button or label which has $char as underlined character
+# Search recursively through the hierarchy of visible widgets to find button
+# or label which has $char as underlined character
#
proc ::tk::FindAltKeyTarget {path char} {
- switch [winfo class $path] {
- Button -
- Label {
+ switch -- [winfo class $path] {
+ Button - Label -
+ TButton - TLabel - TCheckbutton {
if {[string equal -nocase $char \
- [string index [$path cget -text] \
- [$path cget -underline]]]} {return $path} else {return {}}
+ [string index [$path cget -text] [$path cget -underline]]]} {
+ return $path
+ } else {
+ return {}
+ }
}
default {
- foreach child \
- [concat [grid slaves $path] \
- [pack slaves $path] \
- [place slaves $path] ] {
- if {"" ne [set target [::tk::FindAltKeyTarget $child $char]]} {
+ foreach child [concat [grid slaves $path] \
+ [pack slaves $path] [place slaves $path]] {
+ set target [FindAltKeyTarget $child $char]
+ if {$target ne ""} {
return $target
}
}
@@ -561,15 +550,15 @@ proc ::tk::FindAltKeyTarget {path char} {
}
# ::tk::AltKeyInDialog --
-# <Alt-Key> event handler for standard dialogs. Sends <<AltUnderlined>>
-# to button or label which has appropriate underlined character
+# <Alt-Key> event handler for standard dialogs. Sends <<AltUnderlined>> to
+# button or label which has appropriate underlined character
#
proc ::tk::AltKeyInDialog {path key} {
- set target [::tk::FindAltKeyTarget $path $key]
+ set target [FindAltKeyTarget $path $key]
if { $target eq ""} return
event generate $target <<AltUnderlined>>
}
-
+
# ::tk::mcmaxamp --
# Replacement for mcmax, used for texts with "magic ampersand" in it.
#
@@ -577,17 +566,30 @@ proc ::tk::AltKeyInDialog {path key} {
proc ::tk::mcmaxamp {args} {
set maxlen 0
foreach arg $args {
- set length [string length [lindex [::tk::UnderlineAmpersand [mc $arg]] 0]]
- if {$length>$maxlen} {
+ # Should we run [mc] in caller's namespace?
+ lassign [UnderlineAmpersand [mc $arg]] msg
+ set length [string length $msg]
+ if {$length > $maxlen} {
set maxlen $length
}
}
return $maxlen
}
+
# For now, turn off the custom mdef proc for the mac:
if {[tk windowingsystem] eq "aqua"} {
namespace eval ::tk::mac {
- set useCustomMDEF 0
+ variable useCustomMDEF 0
}
}
+
+# Run the Ttk themed widget set initialization
+if {$::ttk::library ne ""} {
+ uplevel \#0 [list source [file join $::ttk::library ttk.tcl]]
+}
+
+# Local Variables:
+# mode: tcl
+# fill-column: 78
+# End:
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index b778bd0..78112e1 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -17,11 +17,13 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
+package require Ttk
+
#----------------------------------------------------------------------
#
# I C O N L I S T
#
-# This is a pseudo-widget that implements the icon list inside the
+# This is a pseudo-widget that implements the icon list inside the
# ::tk::dialog::file:: dialog box.
#
#----------------------------------------------------------------------
@@ -36,15 +38,16 @@ proc ::tk::IconList {w args} {
}
proc ::tk::IconList_Index {w i} {
- upvar #0 ::tk::$w data
- upvar #0 ::tk::$w:itemList itemList
- if {![info exists data(list)]} {set data(list) {}}
+ upvar #0 ::tk::$w data ::tk::$w:itemList itemList
+ if {![info exists data(list)]} {
+ set data(list) {}
+ }
switch -regexp -- $i {
"^-?[0-9]+$" {
- if { $i < 0 } {
+ if {$i < 0} {
set i 0
}
- if { $i >= [llength $data(list)] } {
+ if {$i >= [llength $data(list)]} {
set i [expr {[llength $data(list)] - 1}]
}
return $i
@@ -62,7 +65,8 @@ proc ::tk::IconList_Index {w i} {
foreach {x y} [scan $i "@%d,%d"] {
break
}
- set item [$data(canvas) find closest $x $y]
+ set item [$data(canvas) find closest \
+ [$data(canvas) canvasx $x] [$data(canvas) canvasy $y]]
return [lindex [$data(canvas) itemcget $item -tags] 1]
}
}
@@ -72,18 +76,18 @@ proc ::tk::IconList_Selection {w op args} {
upvar ::tk::$w data
switch -exact -- $op {
"anchor" {
- if { [llength $args] == 1 } {
+ if {[llength $args] == 1} {
set data(index,anchor) [tk::IconList_Index $w [lindex $args 0]]
} else {
return $data(index,anchor)
}
}
"clear" {
- if { [llength $args] == 2 } {
+ if {[llength $args] == 2} {
foreach {first last} $args {
break
}
- } elseif { [llength $args] == 1 } {
+ } elseif {[llength $args] == 1} {
set first [set last [lindex $args 0]]
} else {
error "wrong # args: should be [lindex [info level 0] 0] path\
@@ -91,7 +95,7 @@ proc ::tk::IconList_Selection {w op args} {
}
set first [IconList_Index $w $first]
set last [IconList_Index $w $last]
- if { $first > $last } {
+ if {$first > $last} {
set tmp $first
set first $last
set last $tmp
@@ -102,6 +106,7 @@ proc ::tk::IconList_Selection {w op args} {
set first $ind
break
}
+ incr ind
}
set ind [expr {[llength $data(selection)] - 1}]
for {} {$ind >= 0} {incr ind -1} {
@@ -152,7 +157,7 @@ proc ::tk::IconList_Selection {w op args} {
}
}
-proc ::tk::IconList_Curselection {w} {
+proc ::tk::IconList_CurSelection {w} {
upvar ::tk::$w data
return $data(selection)
}
@@ -162,6 +167,10 @@ proc ::tk::IconList_DrawSelection {w} {
upvar ::tk::$w:itemList itemList
$data(canvas) delete selection
+ $data(canvas) itemconfigure selectionText -fill black
+ $data(canvas) dtag selectionText
+ set cbg [ttk::style lookup TEntry -selectbackground focus]
+ set cfg [ttk::style lookup TEntry -selectforeground focus]
foreach item $data(selection) {
set rTag [lindex [lindex $data(list) $item] 2]
foreach {iTag tTag text serial} $itemList($rTag) {
@@ -169,8 +178,9 @@ proc ::tk::IconList_DrawSelection {w} {
}
set bbox [$data(canvas) bbox $tTag]
- $data(canvas) create rect $bbox -fill \#a0a0ff -outline \#a0a0ff \
+ $data(canvas) create rect $bbox -fill $cbg -outline $cbg \
-tags selection
+ $data(canvas) itemconfigure $tTag -fill $cfg -tags selectionText
}
$data(canvas) lower selection
return
@@ -214,13 +224,15 @@ proc ::tk::IconList_Config {w argList} {
proc ::tk::IconList_Create {w} {
upvar ::tk::$w data
- frame $w
- set data(sbar) [scrollbar $w.sbar -orient horizontal -takefocus 0]
+ ttk::frame $w
+ ttk::entry $w.cHull -takefocus 0 -cursor {}
+ set data(sbar) [ttk::scrollbar $w.cHull.sbar -orient horizontal -takefocus 0]
catch {$data(sbar) configure -highlightthickness 0}
- set data(canvas) [canvas $w.canvas -bd 2 -relief sunken \
- -width 400 -height 120 -takefocus 1]
- pack $data(sbar) -side bottom -fill x -padx 2
- pack $data(canvas) -expand yes -fill both
+ set data(canvas) [canvas $w.cHull.canvas -highlightthick 0 \
+ -width 400 -height 120 -takefocus 1 -background white]
+ pack $data(sbar) -side bottom -fill x -padx 2 -in $w.cHull -pady {0 2}
+ pack $data(canvas) -expand yes -fill both -padx 2 -pady {2 0}
+ pack $w.cHull -expand yes -fill both -ipadx 2 -ipady 2
$data(sbar) configure -command [list $data(canvas) xview]
$data(canvas) configure -xscrollcommand [list $data(sbar) set]
@@ -232,7 +244,6 @@ proc ::tk::IconList_Create {w} {
set data(maxTW) 1
set data(maxTH) 1
set data(numItems) 0
- set data(curItem) {}
set data(noScroll) 1
set data(selection) {}
set data(index,anchor) ""
@@ -257,6 +268,10 @@ proc ::tk::IconList_Create {w} {
bind $data(canvas) <Double-ButtonRelease-1> \
[list tk::IconList_Double1 $w %x %y]
+ bind $data(canvas) <Control-B1-Motion> {;}
+ bind $data(canvas) <Shift-B1-Motion> \
+ [list tk::IconList_ShiftMotion1 $w %x %y]
+
bind $data(canvas) <Up> [list tk::IconList_UpDown $w -1]
bind $data(canvas) <Down> [list tk::IconList_UpDown $w 1]
bind $data(canvas) <Left> [list tk::IconList_LeftRight $w -1]
@@ -324,7 +339,6 @@ proc ::tk::IconList_DeleteAll {w} {
set data(maxTW) 1
set data(maxTH) 1
set data(numItems) 0
- set data(curItem) {}
set data(noScroll) 1
set data(selection) {}
set data(index,anchor) ""
@@ -347,7 +361,7 @@ proc ::tk::IconList_Add {w image items} {
-tags [list text $data(numItems) item$data(numItems)]]
set rTag [$data(canvas) create rect 0 0 0 0 -fill "" -outline "" \
-tags [list rect $data(numItems) item$data(numItems)]]
-
+
foreach {x1 y1 x2 y2} [$data(canvas) bbox $iTag] {
break
}
@@ -359,7 +373,7 @@ proc ::tk::IconList_Add {w image items} {
if {$data(maxIH) < $iH} {
set data(maxIH) $iH
}
-
+
foreach {x1 y1 x2 y2} [$data(canvas) bbox $tTag] {
break
}
@@ -371,7 +385,7 @@ proc ::tk::IconList_Add {w image items} {
if {$data(maxTH) < $tH} {
set data(maxTH) $tH
}
-
+
lappend data(list) [list $iTag $tTag $rTag $iW $iH $tW \
$tH $data(numItems)]
set itemList($rTag) [list $iTag $tTag $text $data(numItems)]
@@ -459,9 +473,7 @@ proc ::tk::IconList_Arrange {w} {
set data(itemsPerColumn) 1
}
- if {$data(curItem) ne ""} {
- IconList_Select $w [lindex [lindex $data(list) $data(curItem)] 2] 0
- }
+ IconList_DrawSelection $w
}
# Gets called when the user invokes the IconList (usually by double-clicking
@@ -531,10 +543,10 @@ proc ::tk::IconList_Btn1 {w x y} {
upvar ::tk::$w data
focus $data(canvas)
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
- if {$i eq ""} return
+ set i [IconList_Index $w @$x,$y]
+ if {$i eq ""} {
+ return
+ }
IconList_Selection $w clear 0 end
IconList_Selection $w set $i
IconList_Selection $w anchor $i
@@ -542,13 +554,13 @@ proc ::tk::IconList_Btn1 {w x y} {
proc ::tk::IconList_CtrlBtn1 {w x y} {
upvar ::tk::$w data
-
+
if { $data(-multiple) } {
focus $data(canvas)
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
- if {$i eq ""} return
+ set i [IconList_Index $w @$x,$y]
+ if {$i eq ""} {
+ return
+ }
if { [IconList_Selection $w includes $i] } {
IconList_Selection $w clear $i
} else {
@@ -560,37 +572,48 @@ proc ::tk::IconList_CtrlBtn1 {w x y} {
proc ::tk::IconList_ShiftBtn1 {w x y} {
upvar ::tk::$w data
-
+
if { $data(-multiple) } {
focus $data(canvas)
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
- if {$i eq ""} return
- set a [IconList_Index $w anchor]
- if { $a eq "" } {
- set a $i
+ set i [IconList_Index $w @$x,$y]
+ if {$i eq ""} {
+ return
+ }
+ if {[IconList_Index $w anchor] eq ""} {
+ IconList_Selection $w anchor $i
}
IconList_Selection $w clear 0 end
- IconList_Selection $w set $a $i
+ IconList_Selection $w set anchor $i
}
}
# Gets called on button-1 motions
#
proc ::tk::IconList_Motion1 {w x y} {
- upvar ::tk::$w data
variable ::tk::Priv
set Priv(x) $x
set Priv(y) $y
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
- if {$i eq ""} return
+ set i [IconList_Index $w @$x,$y]
+ if {$i eq ""} {
+ return
+ }
IconList_Selection $w clear 0 end
IconList_Selection $w set $i
}
+proc ::tk::IconList_ShiftMotion1 {w x y} {
+ upvar ::tk::$w data
+ variable ::tk::Priv
+ set Priv(x) $x
+ set Priv(y) $y
+ set i [IconList_Index $w @$x,$y]
+ if {$i eq ""} {
+ return
+ }
+ IconList_Selection $w clear 0 end
+ IconList_Selection $w set anchor $i
+}
+
proc ::tk::IconList_Double1 {w x y} {
upvar ::tk::$w data
@@ -614,6 +637,7 @@ proc ::tk::IconList_Leave1 {w x y} {
proc ::tk::IconList_FocusIn {w} {
upvar ::tk::$w data
+ $w.cHull state focus
if {![info exists data(list)]} {
return
}
@@ -624,6 +648,7 @@ proc ::tk::IconList_FocusIn {w} {
}
proc ::tk::IconList_FocusOut {w} {
+ $w.cHull state !focus
IconList_Selection $w clear 0 end
}
@@ -642,12 +667,14 @@ proc ::tk::IconList_UpDown {w amount} {
return
}
- set curr [tk::IconList_Curselection $w]
+ set curr [tk::IconList_CurSelection $w]
if { [llength $curr] == 0 } {
set i 0
} else {
set i [tk::IconList_Index $w anchor]
- if {$i eq ""} return
+ if {$i eq ""} {
+ return
+ }
incr i $amount
}
IconList_Selection $w clear 0 end
@@ -671,12 +698,14 @@ proc ::tk::IconList_LeftRight {w amount} {
return
}
- set curr [IconList_Curselection $w]
+ set curr [IconList_CurSelection $w]
if { [llength $curr] == 0 } {
set i 0
} else {
set i [IconList_Index $w anchor]
- if {$i eq ""} return
+ if {$i eq ""} {
+ return
+ }
incr i [expr {$amount*$data(itemsPerColumn)}]
}
IconList_Selection $w clear 0 end
@@ -716,24 +745,22 @@ proc ::tk::IconList_Goto {w text} {
return
}
- if {$data(curItem) eq "" || $data(curItem) == 0} {
- set start 0
+ if {[llength [IconList_CurSelection $w]]} {
+ set start [IconList_Index $w anchor]
} else {
- set start $data(curItem)
+ set start 0
}
- set text [string tolower $text]
set theIndex -1
set less 0
set len [string length $text]
set len0 [expr {$len-1}]
set i $start
- # Search forward until we find a filename whose prefix is an exact match
- # with $text
+ # Search forward until we find a filename whose prefix is a
+ # case-insensitive match with $text
while {1} {
- set sub [string range $textList($i) 0 $len0]
- if {$text eq $sub} {
+ if {[string equal -nocase -length $len0 $textList($i) $text]} {
set theIndex $i
break
}
@@ -789,34 +816,34 @@ proc ::tk::dialog::file:: {type args} {
set dataName __tk_filedialog
upvar ::tk::dialog::file::$dataName data
- ::tk::dialog::file::Config $dataName $type $args
+ Config $dataName $type $args
if {$data(-parent) eq "."} {
- set w .$dataName
+ set w .$dataName
} else {
- set w $data(-parent).$dataName
+ set w $data(-parent).$dataName
}
# (re)create the dialog box if necessary
#
if {![winfo exists $w]} {
- ::tk::dialog::file::Create $w TkFDialog
+ Create $w TkFDialog
} elseif {[winfo class $w] ne "TkFDialog"} {
destroy $w
- ::tk::dialog::file::Create $w TkFDialog
+ Create $w TkFDialog
} else {
- set data(dirMenuBtn) $w.f1.menu
- set data(dirMenu) $w.f1.menu.menu
- set data(upBtn) $w.f1.up
- set data(icons) $w.icons
- set data(ent) $w.f2.ent
- set data(typeMenuLab) $w.f2.lab2
- set data(typeMenuBtn) $w.f2.menu
+ set data(dirMenuBtn) $w.contents.f1.menu
+ set data(dirMenu) $w.contents.f1.menu.menu
+ set data(upBtn) $w.contents.f1.up
+ set data(icons) $w.contents.icons
+ set data(ent) $w.contents.f2.ent
+ set data(typeMenuLab) $w.contents.f2.lab2
+ set data(typeMenuBtn) $w.contents.f2.menu
set data(typeMenu) $data(typeMenuBtn).m
- set data(okBtn) $w.f2.ok
- set data(cancelBtn) $w.f2.cancel
- set data(hiddenBtn) $w.f2.hidden
- ::tk::dialog::file::SetSelectMode $w $data(-multiple)
+ set data(okBtn) $w.contents.f2.ok
+ set data(cancelBtn) $w.contents.f2.cancel
+ set data(hiddenBtn) $w.contents.f2.hidden
+ SetSelectMode $w $data(-multiple)
}
if {$::tk::dialog::file::showHiddenBtn} {
$data(hiddenBtn) configure -state normal
@@ -843,21 +870,39 @@ proc ::tk::dialog::file:: {type args} {
# Add traces on the selectPath variable
#
- trace add variable data(selectPath) write [list ::tk::dialog::file::SetPath $w]
+ trace add variable data(selectPath) write \
+ [list ::tk::dialog::file::SetPath $w]
$data(dirMenuBtn) configure \
-textvariable ::tk::dialog::file::${dataName}(selectPath)
+ # Cleanup previous menu
+ #
+ $data(typeMenu) delete 0 end
+ $data(typeMenuBtn) configure -state normal -text ""
+
# Initialize the file types menu
#
if {[llength $data(-filetypes)]} {
- $data(typeMenu) delete 0 end
+ # Default type and name to first entry
+ set initialtype [lindex $data(-filetypes) 0]
+ set initialTypeName [lindex $initialtype 0]
+ if {$data(-typevariable) ne ""} {
+ upvar #0 $data(-typevariable) typeVariable
+ if {[info exists typeVariable]} {
+ set initialTypeName $typeVariable
+ }
+ }
foreach type $data(-filetypes) {
set title [lindex $type 0]
set filter [lindex $type 1]
$data(typeMenu) add command -label $title \
-command [list ::tk::dialog::file::SetFilter $w $type]
+ # string first avoids glob-pattern char issues
+ if {[string first ${initialTypeName} $title] == 0} {
+ set initialtype $type
+ }
}
- ::tk::dialog::file::SetFilter $w [lindex $data(-filetypes) 0]
+ SetFilter $w $initialtype
$data(typeMenuBtn) configure -state normal
$data(typeMenuLab) configure -state normal
} else {
@@ -865,7 +910,7 @@ proc ::tk::dialog::file:: {type args} {
$data(typeMenuBtn) configure -state disabled -takefocus 0
$data(typeMenuLab) configure -state disabled
}
- ::tk::dialog::file::UpdateWhenIdle $w
+ UpdateWhenIdle $w
# Withdraw the window, then update all the geometry information
# so we know how big it wants to be, then center the window in the
@@ -929,14 +974,21 @@ proc ::tk::dialog::file::Config {dataName type argList} {
{-initialfile "" "" ""}
{-parent "" "" "."}
{-title "" "" ""}
+ {-typevariable "" "" ""}
}
# The "-multiple" option is only available for the "open" file dialog.
#
- if { $type eq "open" } {
+ if {$type eq "open"} {
lappend specs {-multiple "" "" "0"}
}
+ # The "-confirmoverwrite" option is only for the "save" file dialog.
+ #
+ if {$type eq "save"} {
+ lappend specs {-confirmoverwrite "" "" "1"}
+ }
+
# 2: default values depending on the type of the dialog
#
if {![info exists data(selectPath)]} {
@@ -951,9 +1003,9 @@ proc ::tk::dialog::file::Config {dataName type argList} {
if {$data(-title) eq ""} {
if {$type eq "open"} {
- set data(-title) "[mc "Open"]"
+ set data(-title) [mc "Open"]
} else {
- set data(-title) "[mc "Save As"]"
+ set data(-title) [mc "Save As"]
}
}
@@ -985,8 +1037,8 @@ proc ::tk::dialog::file::Config {dataName type argList} {
# like "yes") so we can use it in tests more easily.
if {$type eq "save"} {
set data(-multiple) 0
- } elseif {$data(-multiple)} {
- set data(-multiple) 1
+ } elseif {$data(-multiple)} {
+ set data(-multiple) 1
} else {
set data(-multiple) 0
}
@@ -1000,16 +1052,25 @@ proc ::tk::dialog::file::Create {w class} {
toplevel $w -class $class
if {[tk windowingsystem] eq "x11"} {wm attributes $w -type dialog}
+ pack [ttk::frame $w.contents] -expand 1 -fill both
+ #set w $w.contents
# f1: the frame with the directory option menu
#
- set f1 [frame $w.f1]
- bind [::tk::AmpWidget label $f1.lab -text "[mc "&Directory:"]" ] \
- <<AltUnderlined>> [list focus $f1.menu]
-
+ set f1 [ttk::frame $w.contents.f1]
+ bind [::tk::AmpWidget ttk::label $f1.lab -text [mc "&Directory:"]] \
+ <<AltUnderlined>> [list focus $f1.menu]
+
set data(dirMenuBtn) $f1.menu
- set data(dirMenu) [tk_optionMenu $f1.menu [format %s(selectPath) ::tk::dialog::file::$dataName] ""]
- set data(upBtn) [button $f1.up]
+ if {![info exists data(selectPath)]} {
+ set data(selectPath) ""
+ }
+ set data(dirMenu) $f1.menu.menu
+ ttk::menubutton $f1.menu -menu $data(dirMenu) -direction flush \
+ -textvariable [format %s(selectPath) ::tk::dialog::file::$dataName]
+ [menu $data(dirMenu) -tearoff 0] add radiobutton -label "" -variable \
+ [format %s(selectPath) ::tk::dialog::file::$dataName]
+ set data(upBtn) [ttk::button $f1.up]
if {![info exists Priv(updirImage)]} {
set Priv(updirImage) [image create bitmap -data {
#define updir_width 28
@@ -1024,7 +1085,7 @@ static char updir_bits[] = {
}
$data(upBtn) configure -image $Priv(updirImage)
- $f1.menu configure -takefocus 1 -highlightthickness 2
+ $f1.menu configure -takefocus 1;# -highlightthickness 2
pack $data(upBtn) -side right -padx 4 -fill both
pack $f1.lab -side left -padx 4 -fill both
@@ -1032,7 +1093,7 @@ static char updir_bits[] = {
# data(icons): the IconList that list the files and directories.
#
- if { $class eq "TkFDialog" } {
+ if {$class eq "TkFDialog"} {
if { $data(-multiple) } {
set fNameCaption [mc "File &names:"]
} else {
@@ -1044,34 +1105,35 @@ static char updir_bits[] = {
set fNameCaption [mc "&Selection:"]
set iconListCommand [list ::tk::dialog::file::chooseDir::DblClick $w]
}
- set data(icons) [::tk::IconList $w.icons \
- -command $iconListCommand \
- -multiple $data(-multiple)]
+ set data(icons) [::tk::IconList $w.contents.icons \
+ -command $iconListCommand -multiple $data(-multiple)]
bind $data(icons) <<ListboxSelect>> \
[list ::tk::dialog::file::ListBrowse $w]
# f2: the frame with the OK button, cancel button, "file name" field
# and file types field.
#
- set f2 [frame $w.f2 -bd 0]
- bind [::tk::AmpWidget label $f2.lab -text $fNameCaption -anchor e -pady 0]\
+ set f2 [ttk::frame $w.contents.f2]
+ bind [::tk::AmpWidget ttk::label $f2.lab -text $fNameCaption -anchor e]\
<<AltUnderlined>> [list focus $f2.ent]
- set data(ent) [entry $f2.ent]
+ # -pady 0
+ set data(ent) [ttk::entry $f2.ent]
# The font to use for the icons. The default Canvas font on Unix
# is just deviant.
- set ::tk::$w.icons(font) [$data(ent) cget -font]
+ set ::tk::$w.contents.icons(font) [$data(ent) cget -font]
# Make the file types bits only if this is a File Dialog
- if { $class eq "TkFDialog" } {
- set data(typeMenuLab) [::tk::AmpWidget label $f2.lab2 \
- -text $fTypeCaption -anchor e -pady [$f2.lab cget -pady]]
- set data(typeMenuBtn) [menubutton $f2.menu -indicatoron 1 \
+ if {$class eq "TkFDialog"} {
+ set data(typeMenuLab) [::tk::AmpWidget ttk::label $f2.lab2 \
+ -text $fTypeCaption -anchor e]
+ # -pady [$f2.lab cget -pady]
+ set data(typeMenuBtn) [ttk::menubutton $f2.menu \
-menu $f2.menu.m]
+ # -indicatoron 1
set data(typeMenu) [menu $data(typeMenuBtn).m -tearoff 0]
- $data(typeMenuBtn) configure -takefocus 1 -highlightthickness 2 \
- -relief raised -bd 2 -anchor w
- bind $data(typeMenuLab) <<AltUnderlined>> [list \
+ # $data(typeMenuBtn) configure -takefocus 1 -relief raised -anchor w
+ bind $data(typeMenuLab) <<AltUnderlined>> [list \
focus $data(typeMenuBtn)]
}
@@ -1083,10 +1145,11 @@ static char updir_bits[] = {
} else {
set text [mc "Show &Hidden Directories"]
}
- set data(hiddenBtn) [::tk::AmpWidget checkbutton $f2.hidden \
- -text $text -anchor w -padx 3 -state disabled \
+ set data(hiddenBtn) [::tk::AmpWidget ttk::checkbutton $f2.hidden \
+ -text $text -state disabled \
-variable ::tk::dialog::file::showHiddenVar \
-command [list ::tk::dialog::file::UpdateWhenIdle $w]]
+# -anchor w -padx 3
# the okBtn is created after the typeMenu so that the keyboard traversal
# is in the right order, and add binding so that we find out when the
@@ -1094,17 +1157,17 @@ static char updir_bits[] = {
# window so no confusion about how much <Destroy> gets called; exactly
# once will do). [Bug 987169]
- set data(okBtn) [::tk::AmpWidget button $f2.ok \
- -text [mc "&OK"] -default active -pady 3]
+ set data(okBtn) [::tk::AmpWidget ttk::button $f2.ok \
+ -text [mc "&OK"] -default active];# -pady 3]
bind $data(okBtn) <Destroy> [list ::tk::dialog::file::Destroyed $w]
- set data(cancelBtn) [::tk::AmpWidget button $f2.cancel \
- -text [mc "&Cancel"] -default normal -pady 3]
+ set data(cancelBtn) [::tk::AmpWidget ttk::button $f2.cancel \
+ -text [mc "&Cancel"] -default normal];# -pady 3]
# grid the widgets in f2
#
- grid $f2.lab $f2.ent $data(okBtn) -padx 4 -sticky ew
+ grid $f2.lab $f2.ent $data(okBtn) -padx 4 -pady 3 -sticky ew
grid configure $f2.ent -padx 2
- if { $class eq "TkFDialog" } {
+ if {$class eq "TkFDialog"} {
grid $data(typeMenuLab) $data(typeMenuBtn) $data(cancelBtn) \
-padx 4 -sticky ew
grid configure $data(typeMenuBtn) -padx 0
@@ -1117,7 +1180,7 @@ static char updir_bits[] = {
# Pack all the frames together. We are done with widget construction.
#
pack $f1 -side top -fill x -pady 4
- pack $f2 -side bottom -fill x
+ pack $f2 -side bottom -pady 4 -fill x
pack $data(icons) -expand yes -fill both -padx 4 -pady 1
# Set up the event handlers that are common to Directory and File Dialogs
@@ -1126,12 +1189,12 @@ static char updir_bits[] = {
wm protocol $w WM_DELETE_WINDOW [list ::tk::dialog::file::CancelCmd $w]
$data(upBtn) configure -command [list ::tk::dialog::file::UpDirCmd $w]
$data(cancelBtn) configure -command [list ::tk::dialog::file::CancelCmd $w]
- bind $w <KeyPress-Escape> [list tk::ButtonInvoke $data(cancelBtn)]
+ bind $w <KeyPress-Escape> [list $data(cancelBtn) invoke]
bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A]
# Set up event handlers specific to File or Directory Dialogs
#
- if { $class eq "TkFDialog" } {
+ if {$class eq "TkFDialog"} {
bind $data(ent) <Return> [list ::tk::dialog::file::ActivateEnt $w]
$data(okBtn) configure -command [list ::tk::dialog::file::OkCmd $w]
bind $w <Alt-t> [format {
@@ -1144,15 +1207,18 @@ static char updir_bits[] = {
bind $data(ent) <Return> $okCmd
$data(okBtn) configure -command $okCmd
bind $w <Alt-s> [list focus $data(ent)]
- bind $w <Alt-o> [list tk::ButtonInvoke $data(okBtn)]
+ bind $w <Alt-o> [list $data(okBtn) invoke]
}
bind $w <Alt-h> [list $data(hiddenBtn) invoke]
+ bind $data(ent) <Tab> [list ::tk::dialog::file::CompleteEnt $w]
# Build the focus group for all the entries
#
::tk::FocusGroup_Create $w
- ::tk::FocusGroup_BindIn $w $data(ent) [list ::tk::dialog::file::EntFocusIn $w]
- ::tk::FocusGroup_BindOut $w $data(ent) [list ::tk::dialog::file::EntFocusOut $w]
+ ::tk::FocusGroup_BindIn $w $data(ent) [list \
+ ::tk::dialog::file::EntFocusIn $w]
+ ::tk::FocusGroup_BindOut $w $data(ent) [list \
+ ::tk::dialog::file::EntFocusOut $w]
}
# ::tk::dialog::file::SetSelectMode --
@@ -1170,12 +1236,12 @@ proc ::tk::dialog::file::SetSelectMode {w multi} {
set dataName __tk_filedialog
upvar ::tk::dialog::file::$dataName data
if { $multi } {
- set fNameCaption "[mc {File &names:}]"
+ set fNameCaption [mc "File &names:"]
} else {
- set fNameCaption "[mc {File &name:}]"
+ set fNameCaption [mc "File &name:"]
}
set iconListCommand [list ::tk::dialog::file::OkCmd $w]
- ::tk::SetAmpText $w.f2.lab $fNameCaption
+ ::tk::SetAmpText $w.contents.f2.lab $fNameCaption
::tk::IconList_Config $data(icons) \
[list -multiple $multi -command $iconListCommand]
return
@@ -1242,7 +1308,7 @@ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
# we normally won't come to here. Anyways, give an error and abort
# action.
tk_messageBox -type ok -parent $w -icon warning -message \
- [mc "Cannot change to the directory \"%1\$s\".\nPermission denied." $data(selectPath)]
+ [mc "Cannot change to the directory \"%1\$s\".\nPermission denied." $data(selectPath)]
cd $appPWD
return
}
@@ -1279,10 +1345,12 @@ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
# but 'd'irectory type files.
#
set cmd [list glob -tails -directory [pwd] \
- -type {f b c l p s} -nocomplain]
+ -type {f b c l p s} -nocomplain]
if {$data(filter) eq "*"} {
lappend cmd *
- if {$showHidden} { lappend cmd .* }
+ if {$showHidden} {
+ lappend cmd .*
+ }
} else {
eval [list lappend cmd] $data(filter)
}
@@ -1311,7 +1379,7 @@ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
#
cd $appPWD
- if { $class eq "TkFDialog" } {
+ if {$class eq "TkFDialog"} {
# Restore the Open/Save Button if this is a File Dialog
#
if {$data(type) eq "open"} {
@@ -1333,7 +1401,7 @@ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
#
proc ::tk::dialog::file::SetPathSilently {w path} {
upvar ::tk::dialog::file::[winfo name $w] data
-
+
trace remove variable data(selectPath) write [list ::tk::dialog::file::SetPath $w]
set data(selectPath) $path
trace add variable data(selectPath) write [list ::tk::dialog::file::SetPath $w]
@@ -1345,9 +1413,9 @@ proc ::tk::dialog::file::SetPathSilently {w path} {
proc ::tk::dialog::file::SetPath {w name1 name2 op} {
if {[winfo exists $w]} {
upvar ::tk::dialog::file::[winfo name $w] data
- ::tk::dialog::file::UpdateWhenIdle $w
+ UpdateWhenIdle $w
# On directory dialogs, we keep the entry in sync with the currentdir.
- if { [winfo class $w] eq "TkChooseDir" } {
+ if {[winfo class $w] eq "TkChooseDir"} {
$data(ent) delete 0 end
$data(ent) insert end $data(selectPath)
}
@@ -1360,8 +1428,9 @@ proc ::tk::dialog::file::SetFilter {w type} {
upvar ::tk::dialog::file::[winfo name $w] data
upvar ::tk::$data(icons) icons
+ set data(filterType) $type
set data(filter) [lindex $type 1]
- $data(typeMenuBtn) configure -text [lindex $type 0] -indicatoron 1
+ $data(typeMenuBtn) configure -text [lindex $type 0] ;#-indicatoron 1
# If we aren't using a default extension, use the one suppled
# by the filter.
@@ -1387,8 +1456,8 @@ proc ::tk::dialog::file::SetFilter {w type} {
}
$icons(sbar) set 0.0 0.0
-
- ::tk::dialog::file::UpdateWhenIdle $w
+
+ UpdateWhenIdle $w
}
# tk::dialog::file::ResolveFile --
@@ -1400,11 +1469,14 @@ proc ::tk::dialog::file::SetFilter {w type} {
# (2) resolve all instances of . and ..
# (3) check for non-existent files/directories
# (4) check for chdir permissions
+# (5) conversion of environment variable references to their
+# contents (once only)
#
# Arguments:
# context: the current directory you are in
# text: the text entered by the user
# defaultext: the default extension to add to files with no extension
+# expandEnv: whether to expand environment variables (yes by default)
#
# Return vaue:
# [list $flag $directory $file]
@@ -1423,20 +1495,21 @@ proc ::tk::dialog::file::SetFilter {w type} {
# directory may not be the same as context, because text may contain
# a subdirectory name
#
-proc ::tk::dialog::file::ResolveFile {context text defaultext} {
-
+proc ::tk::dialog::file::ResolveFile {context text defaultext {expandEnv 1}} {
set appPWD [pwd]
- set path [::tk::dialog::file::JoinFile $context $text]
+ set path [JoinFile $context $text]
# If the file has no extension, append the default. Be careful not
# to do this for directories, otherwise typing a dirname in the box
# will give back "dirname.extension" instead of trying to change dir.
- if {![file isdirectory $path] && [file ext $path] eq ""} {
+ if {
+ ![file isdirectory $path] && ([file ext $path] eq "") &&
+ ![string match {$*} [file tail $path]]
+ } then {
set path "$path$defaultext"
}
-
if {[catch {file exists $path}]} {
# This "if" block can be safely removed if the following code
# stop generating errors.
@@ -1471,17 +1544,31 @@ proc ::tk::dialog::file::ResolveFile {context text defaultext} {
return [list CHDIR $dirname ""]
}
set directory [pwd]
+ cd $appPWD
set file [file tail $path]
- if {[regexp {[*]|[?]} $file]} {
+ # It's nothing else, so check to see if it is an env-reference
+ if {$expandEnv && [string match {$*} $file]} {
+ set var [string range $file 1 end]
+ if {[info exist ::env($var)]} {
+ return [ResolveFile $context $::env($var) $defaultext 0]
+ }
+ }
+ if {[regexp {[*?]} $file]} {
set flag PATTERN
} else {
set flag FILE
}
- cd $appPWD
} else {
set directory $dirname
set file [file tail $path]
set flag PATH
+ # It's nothing else, so check to see if it is an env-reference
+ if {$expandEnv && [string match {$*} $file]} {
+ set var [string range $file 1 end]
+ if {[info exist ::env($var)]} {
+ return [ResolveFile $context $::env($var) $defaultext 0]
+ }
+ }
}
}
@@ -1490,7 +1577,7 @@ proc ::tk::dialog::file::ResolveFile {context text defaultext} {
# Gets called when the entry box gets keyboard focus. We clear the selection
-# from the icon list . This way the user can be certain that the input in the
+# from the icon list . This way the user can be certain that the input in the
# entry box is the selection.
#
proc ::tk::dialog::file::EntFocusIn {w} {
@@ -1503,7 +1590,7 @@ proc ::tk::dialog::file::EntFocusIn {w} {
$data(ent) selection clear
}
- if { [winfo class $w] eq "TkFDialog" } {
+ if {[winfo class $w] eq "TkFDialog"} {
# If this is a File Dialog, make sure the buttons are labeled right.
if {$data(type) eq "open"} {
::tk::SetAmpText $data(okBtn) [mc "&Open"]
@@ -1527,24 +1614,11 @@ proc ::tk::dialog::file::ActivateEnt {w} {
set text [$data(ent) get]
if {$data(-multiple)} {
- # For the multiple case we have to be careful to get the file
- # names as a true list, watching out for a single file with a
- # space in the name. Thus we query the IconList directly.
-
- set selIcos [::tk::IconList_Curselection $data(icons)]
- set data(selectFile) ""
- if {[llength $selIcos] == 0 && $text ne ""} {
- # This assumes the user typed something in without selecting
- # files - so assume they only type in a single filename.
- ::tk::dialog::file::VerifyFileName $w $text
- } else {
- foreach item $selIcos {
- ::tk::dialog::file::VerifyFileName $w \
- [::tk::IconList_Get $data(icons) $item]
- }
+ foreach t $text {
+ VerifyFileName $w $t
}
} else {
- ::tk::dialog::file::VerifyFileName $w $text
+ VerifyFileName $w $text
}
}
@@ -1553,8 +1627,7 @@ proc ::tk::dialog::file::ActivateEnt {w} {
proc ::tk::dialog::file::VerifyFileName {w filename} {
upvar ::tk::dialog::file::[winfo name $w] data
- set list [::tk::dialog::file::ResolveFile $data(selectPath) $filename \
- $data(-defaultextension)]
+ set list [ResolveFile $data(selectPath) $filename $data(-defaultextension)]
foreach {flag path file} $list {
break
}
@@ -1566,13 +1639,13 @@ proc ::tk::dialog::file::VerifyFileName {w filename} {
set data(selectPath) $path
$data(ent) delete 0 end
} else {
- ::tk::dialog::file::SetPathSilently $w $path
+ SetPathSilently $w $path
if {$data(-multiple)} {
lappend data(selectFile) $file
} else {
set data(selectFile) $file
}
- ::tk::dialog::file::Done $w
+ Done $w
}
}
PATTERN {
@@ -1582,36 +1655,36 @@ proc ::tk::dialog::file::VerifyFileName {w filename} {
FILE {
if {$data(type) eq "open"} {
tk_messageBox -icon warning -type ok -parent $w \
- -message "[mc "File \"%1\$s\" does not exist." [file join $path $file]]"
+ -message [mc "File \"%1\$s\" does not exist." \
+ [file join $path $file]]
$data(ent) selection range 0 end
$data(ent) icursor end
} else {
- ::tk::dialog::file::SetPathSilently $w $path
+ SetPathSilently $w $path
if {$data(-multiple)} {
lappend data(selectFile) $file
} else {
set data(selectFile) $file
}
- ::tk::dialog::file::Done $w
+ Done $w
}
}
PATH {
tk_messageBox -icon warning -type ok -parent $w \
- -message "[mc "Directory \"%1\$s\" does not exist." $path]"
+ -message [mc "Directory \"%1\$s\" does not exist." $path]
$data(ent) selection range 0 end
$data(ent) icursor end
}
CHDIR {
- tk_messageBox -type ok -parent $w -message \
- "[mc "Cannot change to the directory \"%1\$s\".\nPermission denied." $path]"\
- -icon warning
+ tk_messageBox -type ok -parent $w -icon warning -message \
+ [mc "Cannot change to the directory\
+ \"%1\$s\".\nPermission denied." $path]
$data(ent) selection range 0 end
$data(ent) icursor end
}
ERROR {
- tk_messageBox -type ok -parent $w -message \
- "[mc "Invalid file name \"%1\$s\"." $path]"\
- -icon warning
+ tk_messageBox -type ok -parent $w -icon warning -message \
+ [mc "Invalid file name \"%1\$s\"." $path]
$data(ent) selection range 0 end
$data(ent) icursor end
}
@@ -1624,7 +1697,7 @@ proc ::tk::dialog::file::InvokeBtn {w key} {
upvar ::tk::dialog::file::[winfo name $w] data
if {[$data(okBtn) cget -text] eq $key} {
- ::tk::ButtonInvoke $data(okBtn)
+ $data(okBtn) invoke
}
}
@@ -1655,21 +1728,21 @@ proc ::tk::dialog::file::OkCmd {w} {
upvar ::tk::dialog::file::[winfo name $w] data
set filenames {}
- foreach item [::tk::IconList_Curselection $data(icons)] {
+ foreach item [::tk::IconList_CurSelection $data(icons)] {
lappend filenames [::tk::IconList_Get $data(icons) $item]
}
if {([llength $filenames] && !$data(-multiple)) || \
($data(-multiple) && ([llength $filenames] == 1))} {
set filename [lindex $filenames 0]
- set file [::tk::dialog::file::JoinFile $data(selectPath) $filename]
+ set file [JoinFile $data(selectPath) $filename]
if {[file isdirectory $file]} {
- ::tk::dialog::file::ListInvoke $w [list $filename]
+ ListInvoke $w [list $filename]
return
}
}
- ::tk::dialog::file::ActivateEnt $w
+ ActivateEnt $w
}
# Gets called when user presses the "Cancel" button
@@ -1698,16 +1771,16 @@ proc ::tk::dialog::file::ListBrowse {w} {
upvar ::tk::dialog::file::[winfo name $w] data
set text {}
- foreach item [::tk::IconList_Curselection $data(icons)] {
+ foreach item [::tk::IconList_CurSelection $data(icons)] {
lappend text [::tk::IconList_Get $data(icons) $item]
}
if {[llength $text] == 0} {
return
}
- if { [llength $text] > 1 } {
+ if {$data(-multiple)} {
set newtext {}
foreach file $text {
- set fullfile [::tk::dialog::file::JoinFile $data(selectPath) $file]
+ set fullfile [JoinFile $data(selectPath) $file]
if { ![file isdirectory $fullfile] } {
lappend newtext $file
}
@@ -1716,28 +1789,26 @@ proc ::tk::dialog::file::ListBrowse {w} {
set isDir 0
} else {
set text [lindex $text 0]
- set file [::tk::dialog::file::JoinFile $data(selectPath) $text]
+ set file [JoinFile $data(selectPath) $text]
set isDir [file isdirectory $file]
}
if {!$isDir} {
$data(ent) delete 0 end
$data(ent) insert 0 $text
- if { [winfo class $w] eq "TkFDialog" } {
+ if {[winfo class $w] eq "TkFDialog"} {
if {$data(type) eq "open"} {
::tk::SetAmpText $data(okBtn) [mc "&Open"]
} else {
::tk::SetAmpText $data(okBtn) [mc "&Save"]
}
}
- } else {
- if { [winfo class $w] eq "TkFDialog" } {
- ::tk::SetAmpText $data(okBtn) [mc "&Open"]
- }
+ } elseif {[winfo class $w] eq "TkFDialog"} {
+ ::tk::SetAmpText $data(okBtn) [mc "&Open"]
}
}
-# Gets called when user invokes the IconList widget (double-click,
+# Gets called when user invokes the IconList widget (double-click,
# Return key, etc)
#
proc ::tk::dialog::file::ListInvoke {w filenames} {
@@ -1747,16 +1818,14 @@ proc ::tk::dialog::file::ListInvoke {w filenames} {
return
}
- set file [::tk::dialog::file::JoinFile $data(selectPath) \
- [lindex $filenames 0]]
-
+ set file [JoinFile $data(selectPath) [lindex $filenames 0]]
+
set class [winfo class $w]
if {$class eq "TkChooseDir" || [file isdirectory $file]} {
set appPWD [pwd]
if {[catch {cd $file}]} {
- tk_messageBox -type ok -parent $w -message \
- "[mc "Cannot change to the directory \"%1\$s\".\nPermission denied." $file]"\
- -icon warning
+ tk_messageBox -type ok -parent $w -icon warning -message \
+ [mc "Cannot change to the directory \"%1\$s\".\nPermission denied." $file]
} else {
cd $appPWD
set data(selectPath) $file
@@ -1767,7 +1836,7 @@ proc ::tk::dialog::file::ListInvoke {w filenames} {
} else {
set data(selectFile) $file
}
- ::tk::dialog::file::Done $w
+ Done $w
}
}
@@ -1787,28 +1856,114 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} {
if {$data(-multiple)} {
set selectFilePath {}
foreach f $data(selectFile) {
- lappend selectFilePath [::tk::dialog::file::JoinFile \
- $data(selectPath) $f]
+ lappend selectFilePath [JoinFile $data(selectPath) $f]
}
} else {
- set selectFilePath [::tk::dialog::file::JoinFile \
- $data(selectPath) $data(selectFile)]
- }
-
- set Priv(selectFile) $data(selectFile)
- set Priv(selectPath) $data(selectPath)
-
- if {$data(type) eq "save"} {
- if {[file exists $selectFilePath]} {
- set reply [tk_messageBox -icon warning -type yesno\
- -parent $w -message \
- "[mc "File \"%1\$s\" already exists.\nDo you want to overwrite it?" $selectFilePath]"]
+ set selectFilePath [JoinFile $data(selectPath) $data(selectFile)]
+ }
+
+ set Priv(selectFile) $data(selectFile)
+ set Priv(selectPath) $data(selectPath)
+
+ if {($data(type) eq "save") && $data(-confirmoverwrite) && [file exists $selectFilePath]} {
+ set reply [tk_messageBox -icon warning -type yesno -parent $w \
+ -message [mc "File \"%1\$s\" already exists.\nDo you want\
+ to overwrite it?" $selectFilePath]]
if {$reply eq "no"} {
return
- }
}
}
+ if {[info exists data(-typevariable)] && $data(-typevariable) ne ""
+ && [info exists data(-filetypes)] && [llength $data(-filetypes)]
+ && [info exists data(filterType)] && $data(filterType) ne ""} {
+ upvar #0 $data(-typevariable) typeVariable
+ set typeVariable [lindex $data(filterType) 0]
+ }
}
bind $data(okBtn) <Destroy> {}
set Priv(selectFilePath) $selectFilePath
}
+
+proc ::tk::dialog::file::CompleteEnt {w} {
+ upvar ::tk::dialog::file::[winfo name $w] data
+ set f [$data(ent) get]
+ if {$data(-multiple)} {
+ if {[catch {llength $f} len] || $len != 1} {
+ return -code break
+ }
+ set f [lindex $f 0]
+ }
+
+ # Get list of matching filenames and dirnames
+ set globF [list glob -tails -directory $data(selectPath) \
+ -type {f b c l p s} -nocomplain]
+ set globD [list glob -tails -directory $data(selectPath) -type d \
+ -nocomplain *]
+ if {$data(filter) eq "*"} {
+ lappend globF *
+ if {$::tk::dialog::file::showHiddenVar} {
+ lappend globF .*
+ lappend globD .*
+ }
+ if {[winfo class $w] eq "TkFDialog"} {
+ set files [lsort -dictionary -unique [{*}$globF]]
+ } else {
+ set files {}
+ }
+ set dirs [lsort -dictionary -unique [{*}$globD]]
+ } else {
+ if {$::tk::dialog::file::showHiddenVar} {
+ lappend globD .*
+ }
+ if {[winfo class $w] eq "TkFDialog"} {
+ set files [lsort -dictionary -unique [{*}$globF {*}$data(filter)]]
+ } else {
+ set files {}
+ }
+ set dirs [lsort -dictionary -unique [{*}$globD]]
+ }
+ # Filter specials
+ set dirs [lsearch -all -not -exact -inline $dirs .]
+ set dirs [lsearch -all -not -exact -inline $dirs ..]
+ set dirs2 {}
+ foreach d $dirs {lappend dirs2 $d/}
+
+ set targets [concat \
+ [lsearch -glob -all -inline $files $f*] \
+ [lsearch -glob -all -inline $dirs2 $f*]]
+
+ if {[llength $targets] == 1} {
+ # We have a winner!
+ set f [lindex $targets 0]
+ } elseif {$f in $targets || [llength $targets] == 0} {
+ if {[string length $f] > 0} {
+ bell
+ }
+ return
+ } elseif {[llength $targets] > 1} {
+ # Multiple possibles
+ if {[string length $f] == 0} {
+ return
+ }
+ set t0 [lindex $targets 0]
+ for {set len [string length $t0]} {$len>0} {} {
+ set allmatch 1
+ foreach s $targets {
+ if {![string equal -length $len $s $t0]} {
+ set allmatch 0
+ break
+ }
+ }
+ incr len -1
+ if {$allmatch} break
+ }
+ set f [string range $t0 0 $len]
+ }
+
+ if {$data(-multiple)} {
+ set f [list $f]
+ }
+ $data(ent) delete 0 end
+ $data(ent) insert 0 $f
+ return -code break
+}
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl
new file mode 100644
index 0000000..d57227c
--- /dev/null
+++ b/library/ttk/altTheme.tcl
@@ -0,0 +1,101 @@
+#
+# Ttk widget set: Alternate theme
+#
+
+namespace eval ttk::theme::alt {
+
+ variable colors
+ array set colors {
+ -frame "#d9d9d9"
+ -window "#ffffff"
+ -darker "#c3c3c3"
+ -border "#414141"
+ -activebg "#ececec"
+ -disabledfg "#a3a3a3"
+ -selectbg "#4a6984"
+ -selectfg "#ffffff"
+ }
+
+ ttk::style theme settings alt {
+
+ ttk::style configure "." \
+ -background $colors(-frame) \
+ -foreground black \
+ -troughcolor $colors(-darker) \
+ -bordercolor $colors(-border) \
+ -selectbackground $colors(-selectbg) \
+ -selectforeground $colors(-selectfg) \
+ -font TkDefaultFont \
+ ;
+
+ ttk::style map "." -background \
+ [list disabled $colors(-frame) active $colors(-activebg)] ;
+ ttk::style map "." -foreground [list disabled $colors(-disabledfg)] ;
+ ttk::style map "." -embossed [list disabled 1] ;
+
+ ttk::style configure TButton \
+ -anchor center -width -11 -padding "1 1" \
+ -relief raised -shiftrelief 1 \
+ -highlightthickness 1 -highlightcolor $colors(-frame)
+
+ ttk::style map TButton -relief {
+ {pressed !disabled} sunken
+ {active !disabled} raised
+ } -highlightcolor {alternate black}
+
+ ttk::style configure TCheckbutton -indicatorcolor "#ffffff" -padding 2
+ ttk::style configure TRadiobutton -indicatorcolor "#ffffff" -padding 2
+ ttk::style map TCheckbutton -indicatorcolor \
+ [list disabled $colors(-frame) pressed $colors(-frame)]
+ ttk::style map TRadiobutton -indicatorcolor \
+ [list disabled $colors(-frame) pressed $colors(-frame)]
+
+ ttk::style configure TMenubutton \
+ -width -11 -padding "3 3" -relief raised
+
+ ttk::style configure TEntry -padding 1
+ ttk::style map TEntry -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)]
+ ttk::style configure TCombobox -padding 1
+ ttk::style map TCombobox -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)]
+ ttk::style configure ComboboxPopdownFrame \
+ -relief solid -borderwidth 1
+
+ ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
+ ttk::style map TSpinbox -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)] \
+ -arrowcolor [list disabled $colors(-disabledfg)]
+
+ ttk::style configure Toolbutton -relief flat -padding 2
+ ttk::style map Toolbutton -relief \
+ {disabled flat selected sunken pressed sunken active raised}
+ ttk::style map Toolbutton -background \
+ [list pressed $colors(-darker) active $colors(-activebg)]
+
+ ttk::style configure TScrollbar -relief raised
+
+ ttk::style configure TLabelframe -relief groove -borderwidth 2
+
+ ttk::style configure TNotebook -tabmargins {2 2 1 0}
+ ttk::style configure TNotebook.Tab \
+ -padding {4 2} -background $colors(-darker)
+ ttk::style map TNotebook.Tab \
+ -background [list selected $colors(-frame)] \
+ -expand [list selected {2 2 1 0}] \
+ ;
+
+ # Treeview:
+ ttk::style configure Heading -font TkHeadingFont -relief raised
+ ttk::style configure Treeview -background $colors(-window)
+ ttk::style map Treeview \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
+ ttk::style configure TScale \
+ -groovewidth 4 -troughrelief sunken \
+ -sliderwidth raised -borderwidth 2
+ ttk::style configure TProgressbar \
+ -background $colors(-selectbg) -borderwidth 0
+ }
+}
diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl
new file mode 100644
index 0000000..fa0fa12
--- /dev/null
+++ b/library/ttk/aquaTheme.tcl
@@ -0,0 +1,59 @@
+#
+# Aqua theme (OSX native look and feel)
+#
+
+namespace eval ttk::theme::aqua {
+ ttk::style theme settings aqua {
+
+ ttk::style configure . \
+ -font TkDefaultFont \
+ -background systemWindowBody \
+ -foreground systemModelessDialogActiveText \
+ -selectbackground systemHighlight \
+ -selectforeground systemModelessDialogActiveText \
+ -selectborderwidth 0 \
+ -insertwidth 1
+
+ ttk::style map . \
+ -foreground {disabled systemModelessDialogInactiveText
+ background systemModelessDialogInactiveText} \
+ -selectbackground {background systemHighlightSecondary
+ !focus systemHighlightSecondary} \
+ -selectforeground {background systemModelessDialogInactiveText
+ !focus systemDialogActiveText}
+
+ # Workaround for #1100117:
+ # Actually, on Aqua we probably shouldn't stipple images in
+ # disabled buttons even if it did work...
+ ttk::style configure . -stipple {}
+
+ ttk::style configure TButton -anchor center -width -6
+ ttk::style configure Toolbutton -padding 4
+
+ ttk::style configure TNotebook -tabmargins {10 0} -tabposition n
+ ttk::style configure TNotebook -padding {18 8 18 17}
+ ttk::style configure TNotebook.Tab -padding {12 3 12 2}
+
+ # Combobox:
+ ttk::style configure TCombobox -postoffset {5 -2 -10 0}
+
+ # Treeview:
+ ttk::style configure Heading -font TkHeadingFont
+ ttk::style configure Treeview -rowheight 18 -background White
+ ttk::style map Treeview \
+ -background {{selected background} systemHighlightSecondary
+ selected systemHighlight}
+
+ # Enable animation for ttk::progressbar widget:
+ ttk::style configure TProgressbar -period 100 -maxphase 255
+
+ # For Aqua, labelframe labels should appear outside the border,
+ # with a 14 pixel inset and 4 pixels spacing between border and label
+ # (ref: Apple Human Interface Guidelines / Controls / Grouping Controls)
+ #
+ ttk::style configure TLabelframe \
+ -labeloutside true -labelmargins {14 0 14 4}
+
+ # TODO: panedwindow sashes should be 9 pixels (HIG:Controls:Split Views)
+ }
+}
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl
new file mode 100644
index 0000000..9f2cec7
--- /dev/null
+++ b/library/ttk/button.tcl
@@ -0,0 +1,83 @@
+#
+# Bindings for Buttons, Checkbuttons, and Radiobuttons.
+#
+# Notes: <Button1-Leave>, <Button1-Enter> only control the "pressed"
+# state; widgets remain "active" if the pointer is dragged out.
+# This doesn't seem to be conventional, but it's a nice way
+# to provide extra feedback while the grab is active.
+# (If the button is released off the widget, the grab deactivates and
+# we get a <Leave> event then, which turns off the "active" state)
+#
+# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are
+# delivered to the widget which received the initial <ButtonPress>
+# event. However, Tk [grab]s (#1223103) and menu interactions
+# (#1222605) can interfere with this. To guard against spurious
+# <Button1-Enter> events, the <Button1-Enter> binding only sets
+# the pressed state if the button is currently active.
+#
+
+namespace eval ttk::button {}
+
+bind TButton <Enter> { %W instate !disabled {%W state active} }
+bind TButton <Leave> { %W state !active }
+bind TButton <Key-space> { ttk::button::activate %W }
+bind TButton <<Invoke>> { ttk::button::activate %W }
+
+bind TButton <ButtonPress-1> \
+ { %W instate !disabled { ttk::clickToFocus %W; %W state pressed } }
+bind TButton <ButtonRelease-1> \
+ { %W instate pressed { %W state !pressed; %W instate !disabled { %W invoke } } }
+bind TButton <Button1-Leave> \
+ { %W state !pressed }
+bind TButton <Button1-Enter> \
+ { %W instate {active !disabled} { %W state pressed } }
+
+# Checkbuttons and Radiobuttons have the same bindings as Buttons:
+#
+ttk::copyBindings TButton TCheckbutton
+ttk::copyBindings TButton TRadiobutton
+
+# ...plus a few more:
+
+bind TRadiobutton <KeyPress-Up> { ttk::button::RadioTraverse %W -1 }
+bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 }
+
+# bind TCheckbutton <KeyPress-plus> { %W select }
+# bind TCheckbutton <KeyPress-minus> { %W deselect }
+
+# activate --
+# Simulate a button press: temporarily set the state to 'pressed',
+# then invoke the button.
+#
+proc ttk::button::activate {w} {
+ $w instate disabled { return }
+ set oldState [$w state pressed]
+ update idletasks; after 100 ;# block event loop to avoid reentrancy
+ $w state $oldState
+ $w invoke
+}
+
+# RadioTraverse -- up/down keyboard traversal for radiobutton groups.
+# Set focus to previous/next radiobutton in a group.
+# A radiobutton group consists of all the radiobuttons with
+# the same parent and -variable; this is a pretty good heuristic
+# that works most of the time.
+#
+proc ttk::button::RadioTraverse {w dir} {
+ set group [list]
+ foreach sibling [winfo children [winfo parent $w]] {
+ if { [winfo class $sibling] eq "TRadiobutton"
+ && [$sibling cget -variable] eq [$w cget -variable]
+ && ![$sibling instate disabled]
+ } {
+ lappend group $sibling
+ }
+ }
+
+ if {![llength $group]} { # Shouldn't happen, but can.
+ return
+ }
+
+ set pos [expr {([lsearch -exact $group $w] + $dir) % [llength $group]}]
+ tk::TabToWindow [lindex $group $pos]
+}
diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl
new file mode 100644
index 0000000..f184ea0
--- /dev/null
+++ b/library/ttk/clamTheme.tcl
@@ -0,0 +1,137 @@
+#
+# "Clam" theme.
+#
+# Inspired by the XFCE family of Gnome themes.
+#
+
+namespace eval ttk::theme::clam {
+ variable colors
+ array set colors {
+ -disabledfg "#999999"
+ -frame "#dcdad5"
+ -window "#ffffff"
+ -dark "#cfcdc8"
+ -darker "#bab5ab"
+ -darkest "#9e9a91"
+ -lighter "#eeebe7"
+ -lightest "#ffffff"
+ -selectbg "#4a6984"
+ -selectfg "#ffffff"
+ }
+
+ ttk::style theme settings clam {
+
+ ttk::style configure "." \
+ -background $colors(-frame) \
+ -foreground black \
+ -bordercolor $colors(-darkest) \
+ -darkcolor $colors(-dark) \
+ -lightcolor $colors(-lighter) \
+ -troughcolor $colors(-darker) \
+ -selectbackground $colors(-selectbg) \
+ -selectforeground $colors(-selectfg) \
+ -selectborderwidth 0 \
+ -font TkDefaultFont \
+ ;
+
+ ttk::style map "." \
+ -background [list disabled $colors(-frame) \
+ active $colors(-lighter)] \
+ -foreground [list disabled $colors(-disabledfg)] \
+ -selectbackground [list !focus $colors(-darkest)] \
+ -selectforeground [list !focus white] \
+ ;
+ # -selectbackground [list !focus "#847d73"]
+
+ ttk::style configure TButton \
+ -anchor center -width -11 -padding 5 -relief raised
+ ttk::style map TButton \
+ -background [list \
+ disabled $colors(-frame) \
+ pressed $colors(-darker) \
+ active $colors(-lighter)] \
+ -lightcolor [list pressed $colors(-darker)] \
+ -darkcolor [list pressed $colors(-darker)] \
+ -bordercolor [list alternate "#000000"] \
+ ;
+
+ ttk::style configure Toolbutton \
+ -anchor center -padding 2 -relief flat
+ ttk::style map Toolbutton \
+ -relief [list \
+ disabled flat \
+ selected sunken \
+ pressed sunken \
+ active raised] \
+ -background [list \
+ disabled $colors(-frame) \
+ pressed $colors(-darker) \
+ active $colors(-lighter)] \
+ -lightcolor [list pressed $colors(-darker)] \
+ -darkcolor [list pressed $colors(-darker)] \
+ ;
+
+ ttk::style configure TCheckbutton \
+ -indicatorbackground "#ffffff" \
+ -indicatormargin {1 1 4 1} \
+ -padding 2 ;
+ ttk::style configure TRadiobutton \
+ -indicatorbackground "#ffffff" \
+ -indicatormargin {1 1 4 1} \
+ -padding 2 ;
+ ttk::style map TCheckbutton -indicatorbackground \
+ [list disabled $colors(-frame) pressed $colors(-frame)]
+ ttk::style map TRadiobutton -indicatorbackground \
+ [list disabled $colors(-frame) pressed $colors(-frame)]
+
+ ttk::style configure TMenubutton \
+ -width -11 -padding 5 -relief raised
+
+ ttk::style configure TEntry -padding 1 -insertwidth 1
+ ttk::style map TEntry \
+ -background [list readonly $colors(-frame)] \
+ -bordercolor [list focus $colors(-selectbg)] \
+ -lightcolor [list focus "#6f9dc6"] \
+ -darkcolor [list focus "#6f9dc6"] \
+ ;
+
+ ttk::style configure TCombobox -padding 1 -insertwidth 1
+ ttk::style map TCombobox \
+ -background [list active $colors(-lighter) \
+ pressed $colors(-lighter)] \
+ -fieldbackground [list {readonly focus} $colors(-selectbg) \
+ readonly $colors(-frame)] \
+ -foreground [list {readonly focus} $colors(-selectfg)] \
+ ;
+ ttk::style configure ComboboxPopdownFrame \
+ -relief solid -borderwidth 1
+
+ ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
+ ttk::style map TSpinbox \
+ -background [list readonly $colors(-frame)] \
+ -arrowcolor [list disabled $colors(-disabledfg)]
+
+ ttk::style configure TNotebook.Tab -padding {6 2 6 2}
+ ttk::style map TNotebook.Tab \
+ -padding [list selected {6 4 6 2}] \
+ -background [list selected $colors(-frame) {} $colors(-darker)] \
+ -lightcolor [list selected $colors(-lighter) {} $colors(-dark)] \
+ ;
+
+ # Treeview:
+ ttk::style configure Heading \
+ -font TkHeadingFont -relief raised -padding {3}
+ ttk::style configure Treeview -background $colors(-window)
+ ttk::style map Treeview \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
+ ttk::style configure TLabelframe \
+ -labeloutside true -labelmargins {0 0 0 4} \
+ -borderwidth 2 -relief raised
+
+ ttk::style configure TProgressbar -background $colors(-frame)
+
+ ttk::style configure Sash -sashthickness 6 -gripcount 10
+ }
+}
diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl
new file mode 100644
index 0000000..7e3eff5
--- /dev/null
+++ b/library/ttk/classicTheme.tcl
@@ -0,0 +1,108 @@
+#
+# "classic" Tk theme.
+#
+# Implements Tk's traditional Motif-like look and feel.
+#
+
+namespace eval ttk::theme::classic {
+
+ variable colors; array set colors {
+ -frame "#d9d9d9"
+ -window "#ffffff"
+ -activebg "#ececec"
+ -troughbg "#c3c3c3"
+ -selectbg "#c3c3c3"
+ -selectfg "#000000"
+ -disabledfg "#a3a3a3"
+ -indicator "#b03060"
+ }
+
+ ttk::style theme settings classic {
+ ttk::style configure "." \
+ -font TkDefaultFont \
+ -background $colors(-frame) \
+ -foreground black \
+ -selectbackground $colors(-selectbg) \
+ -selectforeground $colors(-selectfg) \
+ -troughcolor $colors(-troughbg) \
+ -indicatorcolor $colors(-frame) \
+ -highlightcolor $colors(-frame) \
+ -highlightthickness 1 \
+ -selectborderwidth 1 \
+ -insertwidth 2 \
+ ;
+
+ # To match pre-Xft X11 appearance, use:
+ # ttk::style configure . -font {Helvetica 12 bold}
+
+ ttk::style map "." -background \
+ [list disabled $colors(-frame) active $colors(-activebg)]
+ ttk::style map "." -foreground \
+ [list disabled $colors(-disabledfg)]
+
+ ttk::style map "." -highlightcolor [list focus black]
+
+ ttk::style configure TButton \
+ -anchor center -padding "3m 1m" -relief raised -shiftrelief 1
+ ttk::style map TButton -relief [list {!disabled pressed} sunken]
+
+ ttk::style configure TCheckbutton -indicatorrelief raised
+ ttk::style map TCheckbutton \
+ -indicatorcolor [list \
+ pressed $colors(-frame) selected $colors(-indicator)] \
+ -indicatorrelief {selected sunken pressed sunken} \
+ ;
+
+ ttk::style configure TRadiobutton -indicatorrelief raised
+ ttk::style map TRadiobutton \
+ -indicatorcolor [list \
+ pressed $colors(-frame) selected $colors(-indicator)] \
+ -indicatorrelief {selected sunken pressed sunken} \
+ ;
+
+ ttk::style configure TMenubutton -relief raised -padding "3m 1m"
+
+ ttk::style configure TEntry -relief sunken -padding 1 -font TkTextFont
+ ttk::style map TEntry -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)]
+ ttk::style configure TCombobox -padding 1
+ ttk::style map TCombobox -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)]
+ ttk::style configure ComboboxPopdownFrame \
+ -relief solid -borderwidth 1
+
+ ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
+ ttk::style map TSpinbox -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)]
+
+ ttk::style configure TLabelframe -borderwidth 2 -relief groove
+
+ ttk::style configure TScrollbar -relief raised
+ ttk::style map TScrollbar -relief {{pressed !disabled} sunken}
+
+ ttk::style configure TScale -sliderrelief raised
+ ttk::style map TScale -sliderrelief {{pressed !disabled} sunken}
+
+ ttk::style configure TProgressbar -background SteelBlue
+ ttk::style configure TNotebook.Tab \
+ -padding {3m 1m} \
+ -background $colors(-troughbg)
+ ttk::style map TNotebook.Tab -background [list selected $colors(-frame)]
+
+ # Treeview:
+ ttk::style configure Heading -font TkHeadingFont -relief raised
+ ttk::style configure Treeview -background $colors(-window)
+ ttk::style map Treeview \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
+ #
+ # Toolbar buttons:
+ #
+ ttk::style configure Toolbutton -padding 2 -relief flat -shiftrelief 2
+ ttk::style map Toolbutton -relief \
+ {disabled flat selected sunken pressed sunken active raised}
+ ttk::style map Toolbutton -background \
+ [list pressed $colors(-troughbg) active $colors(-activebg)]
+ }
+}
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
new file mode 100644
index 0000000..eab3e1a
--- /dev/null
+++ b/library/ttk/combobox.tcl
@@ -0,0 +1,453 @@
+#
+# Combobox bindings.
+#
+# <<NOTE-WM-TRANSIENT>>:
+#
+# Need to set [wm transient] just before mapping the popdown
+# instead of when it's created, in case a containing frame
+# has been reparented [#1818441].
+#
+# On Windows: setting [wm transient] prevents the parent
+# toplevel from becoming inactive when the popdown is posted
+# (Tk 8.4.8+)
+#
+# On X11: WM_TRANSIENT_FOR on override-redirect windows
+# may be used by compositing managers and by EWMH-aware
+# window managers (even though the older ICCCM spec says
+# it's meaningless).
+#
+# On OSX: [wm transient] does utterly the wrong thing.
+# Instead, we use [MacWindowStyle "help" "noActivates hideOnSuspend"].
+# The "noActivates" attribute prevents the parent toplevel
+# from deactivating when the popdown is posted, and is also
+# necessary for "help" windows to receive mouse events.
+# "hideOnSuspend" makes the popdown disappear (resp. reappear)
+# when the parent toplevel is deactivated (resp. reactivated).
+# (see [#1814778]). Also set [wm resizable 0 0], to prevent
+# TkAqua from shrinking the scrollbar to make room for a grow box
+# that isn't there.
+#
+# In order to work around other platform quirks in TkAqua,
+# [grab] and [focus] are set in <Map> bindings instead of
+# immediately after deiconifying the window.
+#
+
+namespace eval ttk::combobox {
+ variable Values ;# Values($cb) is -listvariable of listbox widget
+ variable State
+ set State(entryPress) 0
+}
+
+### Combobox bindings.
+#
+# Duplicate the Entry bindings, override if needed:
+#
+
+ttk::copyBindings TEntry TCombobox
+
+bind TCombobox <KeyPress-Down> { ttk::combobox::Post %W }
+bind TCombobox <KeyPress-Escape> { ttk::combobox::Unpost %W }
+
+bind TCombobox <ButtonPress-1> { ttk::combobox::Press "" %W %x %y }
+bind TCombobox <Shift-ButtonPress-1> { ttk::combobox::Press "s" %W %x %y }
+bind TCombobox <Double-ButtonPress-1> { ttk::combobox::Press "2" %W %x %y }
+bind TCombobox <Triple-ButtonPress-1> { ttk::combobox::Press "3" %W %x %y }
+bind TCombobox <B1-Motion> { ttk::combobox::Drag %W %x }
+bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y }
+
+ttk::bindMouseWheel TCombobox [list ttk::combobox::Scroll %W]
+
+bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W }
+
+### Combobox listbox bindings.
+#
+bind ComboboxListbox <ButtonRelease-1> { ttk::combobox::LBSelected %W }
+bind ComboboxListbox <KeyPress-Return> { ttk::combobox::LBSelected %W }
+bind ComboboxListbox <KeyPress-Escape> { ttk::combobox::LBCancel %W }
+bind ComboboxListbox <KeyPress-Tab> { ttk::combobox::LBTab %W next }
+bind ComboboxListbox <<PrevWindow>> { ttk::combobox::LBTab %W prev }
+bind ComboboxListbox <Destroy> { ttk::combobox::LBCleanup %W }
+bind ComboboxListbox <Motion> { ttk::combobox::LBHover %W %x %y }
+bind ComboboxListbox <Map> { focus -force %W }
+
+switch -- [tk windowingsystem] {
+ win32 {
+ # Dismiss listbox when user switches to a different application.
+ # NB: *only* do this on Windows (see #1814778)
+ bind ComboboxListbox <FocusOut> { ttk::combobox::LBCancel %W }
+ }
+}
+
+### Combobox popdown window bindings.
+#
+bind ComboboxPopdown <Map> { ttk::combobox::MapPopdown %W }
+bind ComboboxPopdown <Unmap> { ttk::combobox::UnmapPopdown %W }
+bind ComboboxPopdown <ButtonPress> \
+ { ttk::combobox::Unpost [winfo parent %W] }
+
+### Option database settings.
+#
+
+option add *TCombobox*Listbox.font TkTextFont
+option add *TCombobox*Listbox.relief flat
+option add *TCombobox*Listbox.highlightThickness 0
+
+## Platform-specific settings.
+#
+switch -- [tk windowingsystem] {
+ x11 {
+ option add *TCombobox*Listbox.background white
+ }
+ aqua {
+ option add *TCombobox*Listbox.borderWidth 0
+ }
+}
+
+### Binding procedures.
+#
+
+## Press $mode $x $y -- ButtonPress binding for comboboxes.
+# Either post/unpost the listbox, or perform Entry widget binding,
+# depending on widget state and location of button press.
+#
+proc ttk::combobox::Press {mode w x y} {
+ variable State
+ set State(entryPress) [expr {
+ [$w instate {!readonly !disabled}]
+ && [string match *textarea [$w identify $x $y]]
+ }]
+
+ focus $w
+ if {$State(entryPress)} {
+ switch -- $mode {
+ s { ttk::entry::Shift-Press $w $x ; # Shift }
+ 2 { ttk::entry::Select $w $x word ; # Double click}
+ 3 { ttk::entry::Select $w $x line ; # Triple click }
+ "" -
+ default { ttk::entry::Press $w $x }
+ }
+ } else {
+ Post $w
+ }
+}
+
+## Drag -- B1-Motion binding for comboboxes.
+# If the initial ButtonPress event was handled by Entry binding,
+# perform Entry widget drag binding; otherwise nothing.
+#
+proc ttk::combobox::Drag {w x} {
+ variable State
+ if {$State(entryPress)} {
+ ttk::entry::Drag $w $x
+ }
+}
+
+## Motion --
+# Set cursor.
+#
+proc ttk::combobox::Motion {w x y} {
+ if { [$w identify $x $y] eq "textarea"
+ && [$w instate {!readonly !disabled}]
+ } {
+ ttk::setCursor $w text
+ } else {
+ ttk::setCursor $w ""
+ }
+}
+
+## TraverseIn -- receive focus due to keyboard navigation
+# For editable comboboxes, set the selection and insert cursor.
+#
+proc ttk::combobox::TraverseIn {w} {
+ $w instate {!readonly !disabled} {
+ $w selection range 0 end
+ $w icursor end
+ }
+}
+
+## SelectEntry $cb $index --
+# Set the combobox selection in response to a user action.
+#
+proc ttk::combobox::SelectEntry {cb index} {
+ $cb current $index
+ $cb selection range 0 end
+ $cb icursor end
+ event generate $cb <<ComboboxSelected>> -when mark
+}
+
+## Scroll -- Mousewheel binding
+#
+proc ttk::combobox::Scroll {cb dir} {
+ $cb instate disabled { return }
+ set max [llength [$cb cget -values]]
+ set current [$cb current]
+ incr current $dir
+ if {$max != 0 && $current == $current % $max} {
+ SelectEntry $cb $current
+ }
+}
+
+## LBSelected $lb -- Activation binding for listbox
+# Set the combobox value to the currently-selected listbox value
+# and unpost the listbox.
+#
+proc ttk::combobox::LBSelected {lb} {
+ set cb [LBMaster $lb]
+ LBSelect $lb
+ Unpost $cb
+ focus $cb
+}
+
+## LBCancel --
+# Unpost the listbox.
+#
+proc ttk::combobox::LBCancel {lb} {
+ Unpost [LBMaster $lb]
+}
+
+## LBTab -- Tab key binding for combobox listbox.
+# Set the selection, and navigate to next/prev widget.
+#
+proc ttk::combobox::LBTab {lb dir} {
+ set cb [LBMaster $lb]
+ switch -- $dir {
+ next { set newFocus [tk_focusNext $cb] }
+ prev { set newFocus [tk_focusPrev $cb] }
+ }
+
+ if {$newFocus ne ""} {
+ LBSelect $lb
+ Unpost $cb
+ # The [grab release] call in [Unpost] queues events that later
+ # re-set the focus (@@@ NOTE: this might not be true anymore).
+ # Set new focus later:
+ after 0 [list ttk::traverseTo $newFocus]
+ }
+}
+
+## LBHover -- <Motion> binding for combobox listbox.
+# Follow selection on mouseover.
+#
+proc ttk::combobox::LBHover {w x y} {
+ $w selection clear 0 end
+ $w activate @$x,$y
+ $w selection set @$x,$y
+}
+
+## MapPopdown -- <Map> binding for ComboboxPopdown
+#
+proc ttk::combobox::MapPopdown {w} {
+ [winfo parent $w] state pressed
+ ttk::globalGrab $w
+}
+
+## UnmapPopdown -- <Unmap> binding for ComboboxPopdown
+#
+proc ttk::combobox::UnmapPopdown {w} {
+ [winfo parent $w] state !pressed
+ ttk::releaseGrab $w
+}
+
+###
+#
+
+namespace eval ::ttk::combobox {
+ # @@@ Until we have a proper native scrollbar on Aqua, use
+ # @@@ the regular Tk one. Use ttk::scrollbar on other platforms.
+ variable scrollbar ttk::scrollbar
+ if {[tk windowingsystem] eq "aqua"} {
+ set scrollbar ::scrollbar
+ }
+}
+
+## PopdownWindow --
+# Returns the popdown widget associated with a combobox,
+# creating it if necessary.
+#
+proc ttk::combobox::PopdownWindow {cb} {
+ variable scrollbar
+
+ if {![winfo exists $cb.popdown]} {
+ set poplevel [PopdownToplevel $cb.popdown]
+ set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame]
+
+ $scrollbar $popdown.sb \
+ -orient vertical -command [list $popdown.l yview]
+ listbox $popdown.l \
+ -listvariable ttk::combobox::Values($cb) \
+ -yscrollcommand [list $popdown.sb set] \
+ -exportselection false \
+ -selectmode browse \
+ -activestyle none \
+ ;
+
+ bindtags $popdown.l \
+ [list $popdown.l ComboboxListbox Listbox $popdown all]
+
+ grid $popdown.l -row 0 -column 0 -padx {1 0} -pady 1 -sticky nsew
+ grid $popdown.sb -row 0 -column 1 -padx {0 1} -pady 1 -sticky ns
+ grid columnconfigure $popdown 0 -weight 1
+ grid rowconfigure $popdown 0 -weight 1
+
+ grid $popdown -sticky news -padx 0 -pady 0
+ grid rowconfigure $poplevel 0 -weight 1
+ grid columnconfigure $poplevel 0 -weight 1
+ }
+ return $cb.popdown
+}
+
+## PopdownToplevel -- Create toplevel window for the combobox popdown
+#
+# See also <<NOTE-WM-TRANSIENT>>
+#
+proc ttk::combobox::PopdownToplevel {w} {
+ toplevel $w -class ComboboxPopdown
+ wm withdraw $w
+ switch -- [tk windowingsystem] {
+ default -
+ x11 {
+ $w configure -relief flat -borderwidth 0
+ wm attributes $w -type combo
+ wm overrideredirect $w true
+ }
+ win32 {
+ $w configure -relief flat -borderwidth 0
+ wm overrideredirect $w true
+ wm attributes $w -topmost 1
+ }
+ aqua {
+ $w configure -relief solid -borderwidth 0
+ tk::unsupported::MacWindowStyle style $w \
+ help {noActivates hideOnSuspend}
+ wm resizable $w 0 0
+ }
+ }
+ return $w
+}
+
+## ConfigureListbox --
+# Set listbox values, selection, height, and scrollbar visibility
+# from current combobox values.
+#
+proc ttk::combobox::ConfigureListbox {cb} {
+ variable Values
+
+ set popdown [PopdownWindow $cb].f
+ set values [$cb cget -values]
+ set current [$cb current]
+ if {$current < 0} {
+ set current 0 ;# no current entry, highlight first one
+ }
+ set Values($cb) $values
+ $popdown.l selection clear 0 end
+ $popdown.l selection set $current
+ $popdown.l activate $current
+ $popdown.l see $current
+ set height [llength $values]
+ if {$height > [$cb cget -height]} {
+ set height [$cb cget -height]
+ grid $popdown.sb
+ grid configure $popdown.l -padx {1 0}
+ } else {
+ grid remove $popdown.sb
+ grid configure $popdown.l -padx 1
+ }
+ $popdown.l configure -height $height
+}
+
+## PlacePopdown --
+# Set popdown window geometry.
+#
+# @@@TODO: factor with menubutton::PostPosition
+#
+proc ttk::combobox::PlacePopdown {cb popdown} {
+ set x [winfo rootx $cb]
+ set y [winfo rooty $cb]
+ set w [winfo width $cb]
+ set h [winfo height $cb]
+ set postoffset [ttk::style lookup TCombobox -postoffset {} {0 0 0 0}]
+ foreach var {x y w h} delta $postoffset {
+ incr $var $delta
+ }
+
+ set H [winfo reqheight $popdown]
+ if {$y + $h + $H > [winfo screenheight $popdown]} {
+ set Y [expr {$y - $H}]
+ } else {
+ set Y [expr {$y + $h}]
+ }
+ wm geometry $popdown ${w}x${H}+${x}+${Y}
+}
+
+## Post $cb --
+# Pop down the associated listbox.
+#
+proc ttk::combobox::Post {cb} {
+ # Don't do anything if disabled:
+ #
+ $cb instate disabled { return }
+
+ # ASSERT: ![$cb instate pressed]
+
+ # Run -postcommand callback:
+ #
+ uplevel #0 [$cb cget -postcommand]
+
+ set popdown [PopdownWindow $cb]
+ ConfigureListbox $cb
+ update idletasks ;# needed for geometry propagation.
+ PlacePopdown $cb $popdown
+ # See <<NOTE-WM-TRANSIENT>>
+ switch -- [tk windowingsystem] {
+ x11 - win32 { wm transient $popdown [winfo toplevel $cb] }
+ }
+
+ # Post the listbox:
+ #
+ wm attribute $popdown -topmost 1
+ wm deiconify $popdown
+ raise $popdown
+}
+
+## Unpost $cb --
+# Unpost the listbox.
+#
+proc ttk::combobox::Unpost {cb} {
+ if {[winfo exists $cb.popdown]} {
+ wm withdraw $cb.popdown
+ }
+ grab release $cb.popdown ;# in case of stuck or unexpected grab [#1239190]
+}
+
+## LBMaster $lb --
+# Return the combobox main widget that owns the listbox.
+#
+proc ttk::combobox::LBMaster {lb} {
+ winfo parent [winfo parent [winfo parent $lb]]
+}
+
+## LBSelect $lb --
+# Transfer listbox selection to combobox value.
+#
+proc ttk::combobox::LBSelect {lb} {
+ set cb [LBMaster $lb]
+ set selection [$lb curselection]
+ if {[llength $selection] == 1} {
+ SelectEntry $cb [lindex $selection 0]
+ }
+}
+
+## LBCleanup $lb --
+# <Destroy> binding for combobox listboxes.
+# Cleans up by unsetting the linked textvariable.
+#
+# Note: we can't just use { unset [%W cget -listvariable] }
+# because the widget command is already gone when this binding fires).
+# [winfo parent] still works, fortunately.
+#
+proc ttk::combobox::LBCleanup {lb} {
+ variable Values
+ unset Values([LBMaster $lb])
+}
+
+#*EOF*
diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl
new file mode 100644
index 0000000..75f7791
--- /dev/null
+++ b/library/ttk/cursors.tcl
@@ -0,0 +1,186 @@
+#
+# Map symbolic cursor names to platform-appropriate cursors.
+#
+# The following cursors are defined:
+#
+# standard -- default cursor for most controls
+# "" -- inherit cursor from parent window
+# none -- no cursor
+#
+# text -- editable widgets (entry, text)
+# link -- hyperlinks within text
+# crosshair -- graphic selection, fine control
+# busy -- operation in progress
+# forbidden -- action not allowed
+#
+# hresize -- horizontal resizing
+# vresize -- vertical resizing
+#
+# Also resize cursors for each of the compass points,
+# {nw,n,ne,w,e,sw,s,se}resize.
+#
+# Platform notes:
+#
+# Windows doesn't distinguish resizing at the 8 compass points,
+# only horizontal, vertical, and the two diagonals.
+#
+# OSX doesn't have resize cursors for nw, ne, sw, or se corners.
+# We use the Tk-defined X11 fallbacks for these.
+#
+# X11 doesn't have a "forbidden" cursor (usually a slashed circle);
+# "pirate" seems to be the conventional cursor for this purpose.
+#
+# Windows has an IDC_HELP cursor, but it's not available from Tk.
+#
+# Tk does not support "none" on Windows.
+#
+
+namespace eval ttk {
+
+ variable Cursors
+
+ # Use X11 cursor names as defaults, since Tk supplies these
+ # on all platforms.
+ #
+ array set Cursors {
+ "" ""
+ none none
+
+ standard left_ptr
+ text xterm
+ link hand2
+ crosshair crosshair
+ busy watch
+ forbidden pirate
+
+ hresize sb_h_double_arrow
+ vresize sb_v_double_arrow
+
+ nresize top_side
+ sresize bottom_side
+ wresize left_side
+ eresize right_side
+ nwresize top_left_corner
+ neresize top_right_corner
+ swresize bottom_left_corner
+ seresize bottom_right_corner
+ move fleur
+
+ }
+
+ # Platform-specific overrides for Windows and OSX.
+ #
+ switch [tk windowingsystem] {
+ "win32" {
+ array set Cursors {
+ none {}
+
+ standard arrow
+ text ibeam
+ link hand2
+ crosshair crosshair
+ busy wait
+ forbidden no
+
+ vresize size_ns
+ nresize size_ns
+ sresize size_ns
+
+ wresize size_we
+ eresize size_we
+ hresize size_we
+
+ nwresize size_nw_se
+ swresize size_ne_sw
+
+ neresize size_ne_sw
+ seresize size_nw_se
+ }
+ }
+
+ "aqua" {
+ if {[package vsatisfies [package provide Tk] 8.5]} {
+ # appeared 2007-04-23, Tk 8.5a6
+ array set Cursors {
+ standard arrow
+ text ibeam
+ link pointinghand
+ crosshair crosshair
+ busy watch
+ forbidden notallowed
+
+ hresize resizeleftright
+ vresize resizeupdown
+ nresize resizeup
+ sresize resizedown
+ wresize resizeleft
+ eresize resizeright
+ }
+ }
+ }
+ }
+}
+
+## ttk::cursor $cursor --
+# Return platform-specific cursor for specified symbolic cursor.
+#
+proc ttk::cursor {name} {
+ variable Cursors
+ return $Cursors($name)
+}
+
+## ttk::setCursor $w $cursor --
+# Set the cursor for specified window.
+#
+# [ttk::setCursor] should be used in <Motion> bindings
+# instead of directly calling [$w configure -cursor ...],
+# as the latter always incurs a server round-trip and
+# can lead to high CPU load (see [#1184746])
+#
+
+proc ttk::setCursor {w name} {
+ variable Cursors
+ if {[$w cget -cursor] ne $Cursors($name)} {
+ $w configure -cursor $Cursors($name)
+ }
+}
+
+## Interactive test harness:
+#
+proc ttk::CursorSampler {f} {
+ ttk::frame $f
+
+ set r 0
+ foreach row {
+ {nwresize nresize neresize}
+ { wresize move eresize}
+ {swresize sresize seresize}
+ {text link crosshair}
+ {hresize vresize ""}
+ {busy forbidden ""}
+ {none standard ""}
+ } {
+ set c 0
+ foreach cursor $row {
+ set w $f.${r}${c}
+ ttk::label $w -text $cursor -cursor [ttk::cursor $cursor] \
+ -relief solid -borderwidth 1 -padding 3
+ grid $w -row $r -column $c -sticky nswe
+ grid columnconfigure $f $c -uniform cols -weight 1
+ incr c
+ }
+ grid rowconfigure $f $r -uniform rows -weight 1
+ incr r
+ }
+
+ return $f
+}
+
+if {[info exists argv0] && $argv0 eq [info script]} {
+ wm title . "[array size ::ttk::Cursors] cursors"
+ pack [ttk::CursorSampler .f] -expand true -fill both
+ bind . <KeyPress-Escape> [list destroy .]
+ focus .f
+}
+
+#*EOF*
diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl
new file mode 100644
index 0000000..05a46bd
--- /dev/null
+++ b/library/ttk/defaults.tcl
@@ -0,0 +1,125 @@
+#
+# Settings for default theme.
+#
+
+namespace eval ttk::theme::default {
+ variable colors
+ array set colors {
+ -frame "#d9d9d9"
+ -foreground "#000000"
+ -window "#ffffff"
+ -text "#000000"
+ -activebg "#ececec"
+ -selectbg "#4a6984"
+ -selectfg "#ffffff"
+ -darker "#c3c3c3"
+ -disabledfg "#a3a3a3"
+ -indicator "#4a6984"
+ }
+
+ ttk::style theme settings default {
+
+ ttk::style configure "." \
+ -borderwidth 1 \
+ -background $colors(-frame) \
+ -foreground $colors(-foreground) \
+ -troughcolor $colors(-darker) \
+ -font TkDefaultFont \
+ -selectborderwidth 1 \
+ -selectbackground $colors(-selectbg) \
+ -selectforeground $colors(-selectfg) \
+ -insertwidth 1 \
+ -indicatordiameter 10 \
+ ;
+
+ ttk::style map "." -background \
+ [list disabled $colors(-frame) active $colors(-activebg)]
+ ttk::style map "." -foreground \
+ [list disabled $colors(-disabledfg)]
+
+ ttk::style configure TButton \
+ -anchor center -padding "3 3" -width -9 \
+ -relief raised -shiftrelief 1
+ ttk::style map TButton -relief [list {!disabled pressed} sunken]
+
+ ttk::style configure TCheckbutton \
+ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
+ ttk::style map TCheckbutton -indicatorcolor \
+ [list pressed $colors(-activebg) selected $colors(-indicator)]
+
+ ttk::style configure TRadiobutton \
+ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
+ ttk::style map TRadiobutton -indicatorcolor \
+ [list pressed $colors(-activebg) selected $colors(-indicator)]
+
+ ttk::style configure TMenubutton \
+ -relief raised -padding "10 3"
+
+ ttk::style configure TEntry \
+ -relief sunken -fieldbackground white -padding 1
+ ttk::style map TEntry -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)]
+
+ ttk::style configure TCombobox -arrowsize 12 -padding 1
+ ttk::style map TCombobox -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)]
+
+ ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
+ ttk::style map TSpinbox -fieldbackground \
+ [list readonly $colors(-frame) disabled $colors(-frame)] \
+ -arrowcolor [list disabled $colors(-disabledfg)]
+
+ ttk::style configure TLabelframe \
+ -relief groove -borderwidth 2
+
+ ttk::style configure TScrollbar \
+ -width 12 -arrowsize 12
+ ttk::style map TScrollbar \
+ -arrowcolor [list disabled $colors(-disabledfg)]
+
+ ttk::style configure TScale \
+ -sliderrelief raised
+ ttk::style configure TProgressbar \
+ -background $colors(-selectbg)
+
+ ttk::style configure TNotebook.Tab \
+ -padding {4 2} -background $colors(-darker)
+ ttk::style map TNotebook.Tab \
+ -background [list selected $colors(-frame)]
+
+ # Treeview.
+ #
+ ttk::style configure Heading -font TkHeadingFont -relief raised
+ ttk::style configure Treeview \
+ -background $colors(-window) \
+ -foreground $colors(-text) ;
+ ttk::style map Treeview \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
+ # Combobox popdown frame
+ ttk::style layout ComboboxPopdownFrame {
+ ComboboxPopdownFrame.border -sticky nswe
+ }
+ ttk::style configure ComboboxPopdownFrame \
+ -borderwidth 1 -relief solid
+
+ #
+ # Toolbar buttons:
+ #
+ ttk::style layout Toolbutton {
+ Toolbutton.border -children {
+ Toolbutton.padding -children {
+ Toolbutton.label
+ }
+ }
+ }
+
+ ttk::style configure Toolbutton \
+ -padding 2 -relief flat
+ ttk::style map Toolbutton -relief \
+ [list disabled flat selected sunken pressed sunken active raised]
+ ttk::style map Toolbutton -background \
+ [list pressed $colors(-darker) active $colors(-activebg)]
+ }
+}
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
new file mode 100644
index 0000000..e60df90
--- /dev/null
+++ b/library/ttk/entry.tcl
@@ -0,0 +1,585 @@
+#
+# DERIVED FROM: tk/library/entry.tcl r1.22
+#
+# Copyright (c) 1992-1994 The Regents of the University of California.
+# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright (c) 2004, Joe English
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+namespace eval ttk {
+ namespace eval entry {
+ variable State
+
+ set State(x) 0
+ set State(selectMode) char
+ set State(anchor) 0
+ set State(scanX) 0
+ set State(scanIndex) 0
+ set State(scanMoved) 0
+
+ # Button-2 scan speed is (scanNum/scanDen) characters
+ # per pixel of mouse movement.
+ # The standard Tk entry widget uses the equivalent of
+ # scanNum = 10, scanDen = average character width.
+ # I don't know why that was chosen.
+ #
+ set State(scanNum) 1
+ set State(scanDen) 1
+ set State(deadband) 3 ;# #pixels for mouse-moved deadband.
+ }
+}
+
+### Option database settings.
+#
+option add *TEntry.cursor [ttk::cursor text]
+
+### Bindings.
+#
+# Removed the following standard Tk bindings:
+#
+# <Control-Key-space>, <Control-Shift-Key-space>,
+# <Key-Select>, <Shift-Key-Select>:
+# ttk::entry widget doesn't use selection anchor.
+# <Key-Insert>:
+# Inserts PRIMARY selection (on non-Windows platforms).
+# This is inconsistent with typical platform bindings.
+# <Double-Shift-ButtonPress-1>, <Triple-Shift-ButtonPress-1>:
+# These don't do the right thing to start with.
+# <Meta-Key-b>, <Meta-Key-d>, <Meta-Key-f>,
+# <Meta-Key-BackSpace>, <Meta-Key-Delete>:
+# Judgment call. If <Meta> happens to be assigned to the Alt key,
+# these could conflict with application accelerators.
+# (Plus, who has a Meta key these days?)
+# <Control-Key-t>:
+# Another judgment call. If anyone misses this, let me know
+# and I'll put it back.
+#
+
+## Clipboard events:
+#
+bind TEntry <<Cut>> { ttk::entry::Cut %W }
+bind TEntry <<Copy>> { ttk::entry::Copy %W }
+bind TEntry <<Paste>> { ttk::entry::Paste %W }
+bind TEntry <<Clear>> { ttk::entry::Clear %W }
+
+## Button1 bindings:
+# Used for selection and navigation.
+#
+bind TEntry <ButtonPress-1> { ttk::entry::Press %W %x }
+bind TEntry <Shift-ButtonPress-1> { ttk::entry::Shift-Press %W %x }
+bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word }
+bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line }
+bind TEntry <B1-Motion> { ttk::entry::Drag %W %x }
+
+bind TEntry <B1-Leave> { ttk::Repeatedly ttk::entry::AutoScroll %W }
+bind TEntry <B1-Enter> { ttk::CancelRepeat }
+bind TEntry <ButtonRelease-1> { ttk::CancelRepeat }
+
+bind TEntry <Control-ButtonPress-1> {
+ %W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
+}
+
+## Button2 bindings:
+# Used for scanning and primary transfer.
+# Note: ButtonRelease-2 is mapped to <<PasteSelection>> in tk.tcl.
+#
+bind TEntry <ButtonPress-2> { ttk::entry::ScanMark %W %x }
+bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
+bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
+bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
+
+## Keyboard navigation bindings:
+#
+bind TEntry <Key-Left> { ttk::entry::Move %W prevchar }
+bind TEntry <Key-Right> { ttk::entry::Move %W nextchar }
+bind TEntry <Control-Key-Left> { ttk::entry::Move %W prevword }
+bind TEntry <Control-Key-Right> { ttk::entry::Move %W nextword }
+bind TEntry <Key-Home> { ttk::entry::Move %W home }
+bind TEntry <Key-End> { ttk::entry::Move %W end }
+
+bind TEntry <Shift-Key-Left> { ttk::entry::Extend %W prevchar }
+bind TEntry <Shift-Key-Right> { ttk::entry::Extend %W nextchar }
+bind TEntry <Shift-Control-Key-Left> { ttk::entry::Extend %W prevword }
+bind TEntry <Shift-Control-Key-Right> { ttk::entry::Extend %W nextword }
+bind TEntry <Shift-Key-Home> { ttk::entry::Extend %W home }
+bind TEntry <Shift-Key-End> { ttk::entry::Extend %W end }
+
+bind TEntry <Control-Key-slash> { %W selection range 0 end }
+bind TEntry <Control-Key-backslash> { %W selection clear }
+
+bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end }
+
+## Edit bindings:
+#
+bind TEntry <KeyPress> { ttk::entry::Insert %W %A }
+bind TEntry <Key-Delete> { ttk::entry::Delete %W }
+bind TEntry <Key-BackSpace> { ttk::entry::Backspace %W }
+
+# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
+# Otherwise, the <KeyPress> class binding will fire and insert the character.
+# Ditto for Escape, Return, and Tab.
+#
+bind TEntry <Alt-KeyPress> {# nothing}
+bind TEntry <Meta-KeyPress> {# nothing}
+bind TEntry <Control-KeyPress> {# nothing}
+bind TEntry <Key-Escape> {# nothing}
+bind TEntry <Key-Return> {# nothing}
+bind TEntry <Key-KP_Enter> {# nothing}
+bind TEntry <Key-Tab> {# nothing}
+
+# Argh. Apparently on Windows, the NumLock modifier is interpreted
+# as a Command modifier.
+if {[tk windowingsystem] eq "aqua"} {
+ bind TEntry <Command-KeyPress> {# nothing}
+}
+# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
+bind TEntry <Down> {# nothing}
+bind TEntry <Up> {# nothing}
+
+## Additional emacs-like bindings:
+#
+bind TEntry <Control-Key-a> { ttk::entry::Move %W home }
+bind TEntry <Control-Key-b> { ttk::entry::Move %W prevchar }
+bind TEntry <Control-Key-d> { ttk::entry::Delete %W }
+bind TEntry <Control-Key-e> { ttk::entry::Move %W end }
+bind TEntry <Control-Key-f> { ttk::entry::Move %W nextchar }
+bind TEntry <Control-Key-h> { ttk::entry::Backspace %W }
+bind TEntry <Control-Key-k> { %W delete insert end }
+
+### Clipboard procedures.
+#
+
+## EntrySelection -- Return the selected text of the entry.
+# Raises an error if there is no selection.
+#
+proc ttk::entry::EntrySelection {w} {
+ set entryString [string range [$w get] [$w index sel.first] \
+ [expr {[$w index sel.last] - 1}]]
+ if {[$w cget -show] ne ""} {
+ return [string repeat [string index [$w cget -show] 0] \
+ [string length $entryString]]
+ }
+ return $entryString
+}
+
+## Paste -- Insert clipboard contents at current insert point.
+#
+proc ttk::entry::Paste {w} {
+ catch {
+ set clipboard [::tk::GetSelection $w CLIPBOARD]
+ PendingDelete $w
+ $w insert insert $clipboard
+ See $w insert
+ }
+}
+
+## Copy -- Copy selection to clipboard.
+#
+proc ttk::entry::Copy {w} {
+ if {![catch {EntrySelection $w} selection]} {
+ clipboard clear -displayof $w
+ clipboard append -displayof $w $selection
+ }
+}
+
+## Clear -- Delete the selection.
+#
+proc ttk::entry::Clear {w} {
+ catch { $w delete sel.first sel.last }
+}
+
+## Cut -- Copy selection to clipboard then delete it.
+#
+proc ttk::entry::Cut {w} {
+ Copy $w; Clear $w
+}
+
+### Navigation procedures.
+#
+
+## ClosestGap -- Find closest boundary between characters.
+# Returns the index of the character just after the boundary.
+#
+proc ttk::entry::ClosestGap {w x} {
+ set pos [$w index @$x]
+ set bbox [$w bbox $pos]
+ if {$x - [lindex $bbox 0] > [lindex $bbox 2]/2} {
+ incr pos
+ }
+ return $pos
+}
+
+## See $index -- Make sure that the character at $index is visible.
+#
+proc ttk::entry::See {w {index insert}} {
+ update idletasks ;# ensure scroll data up-to-date
+ set c [$w index $index]
+ # @@@ OR: check [$w index left] / [$w index right]
+ if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} {
+ $w xview $c
+ }
+}
+
+## NextWord -- Find the next word position.
+# Note: The "next word position" follows platform conventions:
+# either the next end-of-word position, or the start-of-word
+# position following the next end-of-word position.
+#
+set ::ttk::entry::State(startNext) \
+ [string equal $::tcl_platform(platform) "windows"]
+
+proc ttk::entry::NextWord {w start} {
+ variable State
+ set pos [tcl_endOfWord [$w get] [$w index $start]]
+ if {$pos >= 0 && $State(startNext)} {
+ set pos [tcl_startOfNextWord [$w get] $pos]
+ }
+ if {$pos < 0} {
+ return end
+ }
+ return $pos
+}
+
+## PrevWord -- Find the previous word position.
+#
+proc ttk::entry::PrevWord {w start} {
+ set pos [tcl_startOfPreviousWord [$w get] [$w index $start]]
+ if {$pos < 0} {
+ return 0
+ }
+ return $pos
+}
+
+## RelIndex -- Compute character/word/line-relative index.
+#
+proc ttk::entry::RelIndex {w where {index insert}} {
+ switch -- $where {
+ prevchar { expr {[$w index $index] - 1} }
+ nextchar { expr {[$w index $index] + 1} }
+ prevword { PrevWord $w $index }
+ nextword { NextWord $w $index }
+ home { return 0 }
+ end { $w index end }
+ default { error "Bad relative index $index" }
+ }
+}
+
+## Move -- Move insert cursor to relative location.
+# Also clears the selection, if any, and makes sure
+# that the insert cursor is visible.
+#
+proc ttk::entry::Move {w where} {
+ $w icursor [RelIndex $w $where]
+ $w selection clear
+ See $w insert
+}
+
+### Selection procedures.
+#
+
+## ExtendTo -- Extend the selection to the specified index.
+#
+# The other end of the selection (the anchor) is determined as follows:
+#
+# (1) if there is no selection, the anchor is the insert cursor;
+# (2) if the index is outside the selection, grow the selection;
+# (3) if the insert cursor is at one end of the selection, anchor the other end
+# (4) otherwise anchor the start of the selection
+#
+# The insert cursor is placed at the new end of the selection.
+#
+# Returns: selection anchor.
+#
+proc ttk::entry::ExtendTo {w index} {
+ set index [$w index $index]
+ set insert [$w index insert]
+
+ # Figure out selection anchor:
+ if {![$w selection present]} {
+ set anchor $insert
+ } else {
+ set selfirst [$w index sel.first]
+ set sellast [$w index sel.last]
+
+ if { ($index < $selfirst)
+ || ($insert == $selfirst && $index <= $sellast)
+ } {
+ set anchor $sellast
+ } else {
+ set anchor $selfirst
+ }
+ }
+
+ # Extend selection:
+ if {$anchor < $index} {
+ $w selection range $anchor $index
+ } else {
+ $w selection range $index $anchor
+ }
+
+ $w icursor $index
+ return $anchor
+}
+
+## Extend -- Extend the selection to a relative position, show insert cursor
+#
+proc ttk::entry::Extend {w where} {
+ ExtendTo $w [RelIndex $w $where]
+ See $w
+}
+
+### Button 1 binding procedures.
+#
+# Double-clicking followed by a drag enters "word-select" mode.
+# Triple-clicking enters "line-select" mode.
+#
+
+## Press -- ButtonPress-1 binding.
+# Set the insertion cursor, claim the input focus, set up for
+# future drag operations.
+#
+proc ttk::entry::Press {w x} {
+ variable State
+
+ $w icursor [ClosestGap $w $x]
+ $w selection clear
+ $w instate !disabled { focus $w }
+
+ # Set up for future drag, double-click, or triple-click.
+ set State(x) $x
+ set State(selectMode) char
+ set State(anchor) [$w index insert]
+}
+
+## Shift-Press -- Shift-ButtonPress-1 binding.
+# Extends the selection, sets anchor for future drag operations.
+#
+proc ttk::entry::Shift-Press {w x} {
+ variable State
+
+ focus $w
+ set anchor [ExtendTo $w @$x]
+
+ set State(x) $x
+ set State(selectMode) char
+ set State(anchor) $anchor
+}
+
+## Select $w $x $mode -- Binding for double- and triple- clicks.
+# Selects a word or line (according to mode),
+# and sets the selection mode for subsequent drag operations.
+#
+proc ttk::entry::Select {w x mode} {
+ variable State
+ set cur [ClosestGap $w $x]
+
+ switch -- $mode {
+ word { WordSelect $w $cur $cur }
+ line { LineSelect $w $cur $cur }
+ char { # no-op }
+ }
+
+ set State(anchor) $cur
+ set State(selectMode) $mode
+}
+
+## Drag -- Button1 motion binding.
+#
+proc ttk::entry::Drag {w x} {
+ variable State
+ set State(x) $x
+ DragTo $w $x
+}
+
+## DragTo $w $x -- Extend selection to $x based on current selection mode.
+#
+proc ttk::entry::DragTo {w x} {
+ variable State
+
+ set cur [ClosestGap $w $x]
+ switch $State(selectMode) {
+ char { CharSelect $w $State(anchor) $cur }
+ word { WordSelect $w $State(anchor) $cur }
+ line { LineSelect $w $State(anchor) $cur }
+ }
+}
+
+## AutoScroll
+# Called repeatedly when the mouse is outside an entry window
+# with Button 1 down. Scroll the window left or right,
+# depending on where the mouse is, and extend the selection
+# according to the current selection mode.
+#
+# TODO: AutoScroll should repeat faster (50ms) than normal autorepeat.
+# TODO: Need a way for Repeat scripts to cancel themselves.
+#
+proc ttk::entry::AutoScroll {w} {
+ variable State
+ if {![winfo exists $w]} return
+ set x $State(x)
+ if {$x > [winfo width $w]} {
+ $w xview scroll 2 units
+ DragTo $w $x
+ } elseif {$x < 0} {
+ $w xview scroll -2 units
+ DragTo $w $x
+ }
+}
+
+## CharSelect -- select characters between index $from and $to
+#
+proc ttk::entry::CharSelect {w from to} {
+ if {$to <= $from} {
+ $w selection range $to $from
+ } else {
+ $w selection range $from $to
+ }
+ $w icursor $to
+}
+
+## WordSelect -- Select whole words between index $from and $to
+#
+proc ttk::entry::WordSelect {w from to} {
+ if {$to < $from} {
+ set first [WordBack [$w get] $to]
+ set last [WordForward [$w get] $from]
+ $w icursor $first
+ } else {
+ set first [WordBack [$w get] $from]
+ set last [WordForward [$w get] $to]
+ $w icursor $last
+ }
+ $w selection range $first $last
+}
+
+## WordBack, WordForward -- helper routines for WordSelect.
+#
+proc ttk::entry::WordBack {text index} {
+ if {[set pos [tcl_wordBreakBefore $text $index]] < 0} { return 0 }
+ return $pos
+}
+proc ttk::entry::WordForward {text index} {
+ if {[set pos [tcl_wordBreakAfter $text $index]] < 0} { return end }
+ return $pos
+}
+
+## LineSelect -- Select the entire line.
+#
+proc ttk::entry::LineSelect {w _ _} {
+ variable State
+ $w selection range 0 end
+ $w icursor end
+}
+
+### Button 2 binding procedures.
+#
+
+## ScanMark -- ButtonPress-2 binding.
+# Marks the start of a scan or primary transfer operation.
+#
+proc ttk::entry::ScanMark {w x} {
+ variable State
+ set State(scanX) $x
+ set State(scanIndex) [$w index @0]
+ set State(scanMoved) 0
+}
+
+## ScanDrag -- Button2 motion binding.
+#
+proc ttk::entry::ScanDrag {w x} {
+ variable State
+
+ set dx [expr {$State(scanX) - $x}]
+ if {abs($dx) > $State(deadband)} {
+ set State(scanMoved) 1
+ }
+ set left [expr {$State(scanIndex) + ($dx*$State(scanNum))/$State(scanDen)}]
+ $w xview $left
+
+ if {$left != [set newLeft [$w index @0]]} {
+ # We've scanned past one end of the entry;
+ # reset the mark so that the text will start dragging again
+ # as soon as the mouse reverses direction.
+ #
+ set State(scanX) $x
+ set State(scanIndex) $newLeft
+ }
+}
+
+## ScanRelease -- Button2 release binding.
+# Do a primary transfer if the mouse has not moved since the button press.
+#
+proc ttk::entry::ScanRelease {w x} {
+ variable State
+ if {!$State(scanMoved)} {
+ $w instate {!disabled !readonly} {
+ $w icursor [ClosestGap $w $x]
+ catch {$w insert insert [::tk::GetSelection $w PRIMARY]}
+ }
+ }
+}
+
+### Insertion and deletion procedures.
+#
+
+## PendingDelete -- Delete selection prior to insert.
+# If the entry currently has a selection, delete it and
+# set the insert position to where the selection was.
+# Returns: 1 if pending delete occurred, 0 if nothing was selected.
+#
+proc ttk::entry::PendingDelete {w} {
+ if {[$w selection present]} {
+ $w icursor sel.first
+ $w delete sel.first sel.last
+ return 1
+ }
+ return 0
+}
+
+## Insert -- Insert text into the entry widget.
+# If a selection is present, the new text replaces it.
+# Otherwise, the new text is inserted at the insert cursor.
+#
+proc ttk::entry::Insert {w s} {
+ if {$s eq ""} { return }
+ PendingDelete $w
+ $w insert insert $s
+ See $w insert
+}
+
+## Backspace -- Backspace over the character just before the insert cursor.
+# If there is a selection, delete that instead.
+# If the new insert position is offscreen to the left,
+# scroll to place the cursor at about the middle of the window.
+#
+proc ttk::entry::Backspace {w} {
+ if {[PendingDelete $w]} {
+ See $w
+ return
+ }
+ set x [expr {[$w index insert] - 1}]
+ if {$x < 0} { return }
+
+ $w delete $x
+
+ if {[$w index @0] >= [$w index insert]} {
+ set range [$w xview]
+ set left [lindex $range 0]
+ set right [lindex $range 1]
+ $w xview moveto [expr {$left - ($right - $left)/2.0}]
+ }
+}
+
+## Delete -- Delete the character after the insert cursor.
+# If there is a selection, delete that instead.
+#
+proc ttk::entry::Delete {w} {
+ if {![PendingDelete $w]} {
+ $w delete insert
+ }
+}
+
+#*EOF*
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
new file mode 100644
index 0000000..52298c5
--- /dev/null
+++ b/library/ttk/fonts.tcl
@@ -0,0 +1,157 @@
+#
+# Font specifications.
+#
+# This file, [source]d at initialization time, sets up the following
+# symbolic fonts based on the current platform:
+#
+# TkDefaultFont -- default for GUI items not otherwise specified
+# TkTextFont -- font for user text (entry, listbox, others)
+# TkFixedFont -- standard fixed width font
+# TkHeadingFont -- headings (column headings, etc)
+# TkCaptionFont -- dialog captions (primary text in alert dialogs, etc.)
+# TkTooltipFont -- font to use for tooltip windows
+# TkIconFont -- font to use for icon captions
+# TkMenuFont -- used to use for menu items
+#
+# In Tk 8.5, some of these fonts may be provided by the TIP#145 implementation
+# (On Windows and Mac OS X as of Oct 2007).
+#
+# +++ Platform notes:
+#
+# Windows:
+# The default system font changed from "MS Sans Serif" to "Tahoma"
+# in Windows XP/Windows 2000.
+#
+# MS documentation says to use "Tahoma 8" in Windows 2000/XP,
+# although many MS programs still use "MS Sans Serif 8"
+#
+# Should use SystemParametersInfo() instead.
+#
+# Mac OSX / Aqua:
+# Quoth the Apple HIG:
+# The _system font_ (Lucida Grande Regular 13 pt) is used for text
+# in menus, dialogs, and full-size controls.
+# [...] Use the _view font_ (Lucida Grande Regular 12pt) as the default
+# font of text in lists and tables.
+# [...] Use the _emphasized system font_ (Lucida Grande Bold 13 pt)
+# sparingly. It is used for the message text in alerts.
+# [...] The _small system font_ (Lucida Grande Regular 11 pt) [...]
+# is also the default font for column headings in lists, for help tags,
+# and for small controls.
+#
+# Note that the font for column headings (TkHeadingFont) is
+# _smaller_ than the default font.
+#
+# There does not appear to be any recommendations for fixed-width fonts.
+#
+# X11:
+# Need a way to tell if Xft is enabled or not.
+# For now, assume patch #971980 applied.
+#
+# "Classic" look used Helvetica bold for everything except
+# for entry widgets, which use Helvetica medium.
+# Most other toolkits use medium weight for all UI elements,
+# which is what we do now.
+#
+# Font size specified in pixels on X11, not points.
+# This is Theoretically Wrong, but in practice works better; using
+# points leads to huge inconsistencies across different servers.
+#
+
+namespace eval ttk {
+
+set tip145 [catch {font create TkDefaultFont}]
+catch {font create TkTextFont}
+catch {font create TkHeadingFont}
+catch {font create TkCaptionFont}
+catch {font create TkTooltipFont}
+catch {font create TkFixedFont}
+catch {font create TkIconFont}
+catch {font create TkMenuFont}
+catch {font create TkSmallCaptionFont}
+
+if {!$tip145} {
+variable F ;# miscellaneous platform-specific font parameters
+switch -- [tk windowingsystem] {
+ win32 {
+ # In safe interps there is no osVersion element.
+ if {[info exists tcl_platform(osVersion)]} {
+ if {$tcl_platform(osVersion) >= 5.0} {
+ set F(family) "Tahoma"
+ } else {
+ set F(family) "MS Sans Serif"
+ }
+ } else {
+ if {[lsearch -exact [font families] Tahoma] != -1} {
+ set F(family) "Tahoma"
+ } else {
+ set F(family) "MS Sans Serif"
+ }
+ }
+ set F(size) 8
+
+ font configure TkDefaultFont -family $F(family) -size $F(size)
+ font configure TkTextFont -family $F(family) -size $F(size)
+ font configure TkHeadingFont -family $F(family) -size $F(size)
+ font configure TkCaptionFont -family $F(family) -size $F(size) \
+ -weight bold
+ font configure TkTooltipFont -family $F(family) -size $F(size)
+ font configure TkFixedFont -family Courier -size 10
+ font configure TkIconFont -family $F(family) -size $F(size)
+ font configure TkMenuFont -family $F(family) -size $F(size)
+ font configure TkSmallCaptionFont -family $F(family) -size $F(size)
+ }
+ aqua {
+ set F(family) "Lucida Grande"
+ set F(fixed) "Monaco"
+ set F(menusize) 14
+ set F(size) 13
+ set F(viewsize) 12
+ set F(smallsize) 11
+ set F(labelsize) 10
+ set F(fixedsize) 11
+
+ font configure TkDefaultFont -family $F(family) -size $F(size)
+ font configure TkTextFont -family $F(family) -size $F(size)
+ font configure TkHeadingFont -family $F(family) -size $F(smallsize)
+ font configure TkCaptionFont -family $F(family) -size $F(size) \
+ -weight bold
+ font configure TkTooltipFont -family $F(family) -size $F(smallsize)
+ font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
+ font configure TkIconFont -family $F(family) -size $F(size)
+ font configure TkMenuFont -family $F(family) -size $F(menusize)
+ font configure TkSmallCaptionFont -family $F(family) -size $F(labelsize)
+ }
+ default -
+ x11 {
+ if {![catch {tk::pkgconfig get fontsystem} F(fs)] && $F(fs) eq "xft"} {
+ set F(family) "sans-serif"
+ set F(fixed) "monospace"
+ } else {
+ set F(family) "Helvetica"
+ set F(fixed) "courier"
+ }
+ set F(size) -12
+ set F(ttsize) -10
+ set F(capsize) -14
+ set F(fixedsize) -12
+
+ font configure TkDefaultFont -family $F(family) -size $F(size)
+ font configure TkTextFont -family $F(family) -size $F(size)
+ font configure TkHeadingFont -family $F(family) -size $F(size) \
+ -weight bold
+ font configure TkCaptionFont -family $F(family) -size $F(capsize) \
+ -weight bold
+ font configure TkTooltipFont -family $F(family) -size $F(ttsize)
+ font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
+ font configure TkIconFont -family $F(family) -size $F(size)
+ font configure TkMenuFont -family $F(family) -size $F(size)
+ font configure TkSmallCaptionFont -family $F(family) -size $F(ttsize)
+ }
+}
+unset -nocomplain F
+}
+
+}
+
+#*EOF*
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
new file mode 100644
index 0000000..093bb02
--- /dev/null
+++ b/library/ttk/menubutton.tcl
@@ -0,0 +1,169 @@
+#
+# Bindings for Menubuttons.
+#
+# Menubuttons have three interaction modes:
+#
+# Pulldown: Press menubutton, drag over menu, release to activate menu entry
+# Popdown: Click menubutton to post menu
+# Keyboard: <Key-space> or accelerator key to post menu
+#
+# (In addition, when menu system is active, "dropdown" -- menu posts
+# on mouse-over. Ttk menubuttons don't implement this).
+#
+# For keyboard and popdown mode, we hand off to tk_popup and let
+# the built-in Tk bindings handle the rest of the interaction.
+#
+# ON X11:
+#
+# Standard Tk menubuttons use a global grab on the menubutton.
+# This won't work for Ttk menubuttons in pulldown mode,
+# since we need to process the final <ButtonRelease> event,
+# and this might be delivered to the menu. So instead we
+# rely on the passive grab that occurs on <ButtonPress> events,
+# and transition to popdown mode when the mouse is released
+# or dragged outside the menubutton.
+#
+# ON WINDOWS:
+#
+# I'm not sure what the hell is going on here. [$menu post] apparently
+# sets up some kind of internal grab for native menus.
+# On this platform, just use [tk_popup] for all menu actions.
+#
+# ON MACOS:
+#
+# Same probably applies here.
+#
+
+namespace eval ttk {
+ namespace eval menubutton {
+ variable State
+ array set State {
+ pulldown 0
+ oldcursor {}
+ }
+ }
+}
+
+bind TMenubutton <Enter> { %W instate !disabled {%W state active } }
+bind TMenubutton <Leave> { %W state !active }
+bind TMenubutton <Key-space> { ttk::menubutton::Popdown %W }
+bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W }
+
+if {[tk windowingsystem] eq "x11"} {
+ bind TMenubutton <ButtonPress-1> { ttk::menubutton::Pulldown %W }
+ bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W }
+ bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W }
+} else {
+ bind TMenubutton <ButtonPress-1> \
+ { %W state pressed ; ttk::menubutton::Popdown %W }
+ bind TMenubutton <ButtonRelease-1> \
+ { %W state !pressed }
+}
+
+# PostPosition --
+# Returns the x and y coordinates where the menu
+# should be posted, based on the menubutton and menu size
+# and -direction option.
+#
+# TODO: adjust menu width to be at least as wide as the button
+# for -direction above, below.
+#
+proc ttk::menubutton::PostPosition {mb menu} {
+ set x [winfo rootx $mb]
+ set y [winfo rooty $mb]
+ set dir [$mb cget -direction]
+
+ set bw [winfo width $mb]
+ set bh [winfo height $mb]
+ set mw [winfo reqwidth $menu]
+ set mh [winfo reqheight $menu]
+ set sw [expr {[winfo screenwidth $menu] - $bw - $mw}]
+ set sh [expr {[winfo screenheight $menu] - $bh - $mh}]
+
+ switch -- $dir {
+ above { if {$y >= $mh} { incr y -$mh } { incr y $bh } }
+ below { if {$y <= $sh} { incr y $bh } { incr y -$mh } }
+ left { if {$x >= $mw} { incr x -$mw } { incr x $bw } }
+ right { if {$x <= $sw} { incr x $bw } { incr x -$mw } }
+ flush {
+ # post menu atop menubutton.
+ # If there's a menu entry whose label matches the
+ # menubutton -text, assume this is an optionmenu
+ # and place that entry over the menubutton.
+ set index [FindMenuEntry $menu [$mb cget -text]]
+ if {$index ne ""} {
+ incr y -[$menu yposition $index]
+ }
+ }
+ }
+
+ return [list $x $y]
+}
+
+# Popdown --
+# Post the menu and set a grab on the menu.
+#
+proc ttk::menubutton::Popdown {mb} {
+ if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
+ return
+ }
+ foreach {x y} [PostPosition $mb $menu] { break }
+ tk_popup $menu $x $y
+}
+
+# Pulldown (X11 only) --
+# Called when Button1 is pressed on a menubutton.
+# Posts the menu; a subsequent ButtonRelease
+# or Leave event will set a grab on the menu.
+#
+proc ttk::menubutton::Pulldown {mb} {
+ variable State
+ if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
+ return
+ }
+ foreach {x y} [PostPosition $mb $menu] { break }
+ set State(pulldown) 1
+ set State(oldcursor) [$mb cget -cursor]
+
+ $mb state pressed
+ $mb configure -cursor [$menu cget -cursor]
+ $menu post $x $y
+ tk_menuSetFocus $menu
+}
+
+# TransferGrab (X11 only) --
+# Switch from pulldown mode (menubutton has an implicit grab)
+# to popdown mode (menu has an explicit grab).
+#
+proc ttk::menubutton::TransferGrab {mb} {
+ variable State
+ if {$State(pulldown)} {
+ $mb configure -cursor $State(oldcursor)
+ $mb state {!pressed !active}
+ set State(pulldown) 0
+
+ set menu [$mb cget -menu]
+ tk_popup $menu [winfo rootx $menu] [winfo rooty $menu]
+ }
+}
+
+# FindMenuEntry --
+# Hack to support tk_optionMenus.
+# Returns the index of the menu entry with a matching -label,
+# -1 if not found.
+#
+proc ttk::menubutton::FindMenuEntry {menu s} {
+ set last [$menu index last]
+ if {$last eq "none"} {
+ return ""
+ }
+ for {set i 0} {$i <= $last} {incr i} {
+ if {![catch {$menu entrycget $i -label} label]
+ && ($label eq $s)} {
+ return $i
+ }
+ }
+ return ""
+}
+
+#*EOF*
diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl
new file mode 100644
index 0000000..d424b6c
--- /dev/null
+++ b/library/ttk/notebook.tcl
@@ -0,0 +1,197 @@
+#
+# Bindings for TNotebook widget
+#
+
+namespace eval ttk::notebook {
+ variable TLNotebooks ;# See enableTraversal
+}
+
+bind TNotebook <ButtonPress-1> { ttk::notebook::Press %W %x %y }
+bind TNotebook <Key-Right> { ttk::notebook::CycleTab %W 1; break }
+bind TNotebook <Key-Left> { ttk::notebook::CycleTab %W -1; break }
+bind TNotebook <Control-Key-Tab> { ttk::notebook::CycleTab %W 1; break }
+bind TNotebook <Control-Shift-Key-Tab> { ttk::notebook::CycleTab %W -1; break }
+catch {
+bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break }
+}
+bind TNotebook <Destroy> { ttk::notebook::Cleanup %W }
+
+# ActivateTab $nb $tab --
+# Select the specified tab and set focus.
+#
+# Desired behavior:
+# + take focus when reselecting the currently-selected tab;
+# + keep focus if the notebook already has it;
+# + otherwise set focus to the first traversable widget
+# in the newly-selected tab;
+# + do not leave the focus in a deselected tab.
+#
+proc ttk::notebook::ActivateTab {w tab} {
+ set oldtab [$w select]
+ $w select $tab
+ set newtab [$w select] ;# NOTE: might not be $tab, if $tab is disabled
+
+ if {[focus] eq $w} { return }
+ if {$newtab eq $oldtab} { focus $w ; return }
+
+ update idletasks ;# needed so focus logic sees correct mapped states
+ if {[set f [ttk::focusFirst $newtab]] ne ""} {
+ ttk::traverseTo $f
+ } else {
+ focus $w
+ }
+}
+
+# Press $nb $x $y --
+# ButtonPress-1 binding for notebook widgets.
+# Activate the tab under the mouse cursor, if any.
+#
+proc ttk::notebook::Press {w x y} {
+ set index [$w index @$x,$y]
+ if {$index ne ""} {
+ ActivateTab $w $index
+ }
+}
+
+# CycleTab --
+# Select the next/previous tab in the list.
+#
+proc ttk::notebook::CycleTab {w dir} {
+ if {[$w index end] != 0} {
+ set current [$w index current]
+ set select [expr {($current + $dir) % [$w index end]}]
+ while {[$w tab $select -state] != "normal" && ($select != $current)} {
+ set select [expr {($select + $dir) % [$w index end]}]
+ }
+ if {$select != $current} {
+ ActivateTab $w $select
+ }
+ }
+}
+
+# MnemonicTab $nb $key --
+# Scan all tabs in the specified notebook for one with the
+# specified mnemonic. If found, returns path name of tab;
+# otherwise returns ""
+#
+proc ttk::notebook::MnemonicTab {nb key} {
+ set key [string toupper $key]
+ foreach tab [$nb tabs] {
+ set label [$nb tab $tab -text]
+ set underline [$nb tab $tab -underline]
+ set mnemonic [string toupper [string index $label $underline]]
+ if {$mnemonic ne "" && $mnemonic eq $key} {
+ return $tab
+ }
+ }
+ return ""
+}
+
+# +++ Toplevel keyboard traversal.
+#
+
+# enableTraversal --
+# Enable keyboard traversal for a notebook widget
+# by adding bindings to the containing toplevel window.
+#
+# TLNotebooks($top) keeps track of the list of all traversal-enabled
+# notebooks contained in the toplevel
+#
+proc ttk::notebook::enableTraversal {nb} {
+ variable TLNotebooks
+
+ set top [winfo toplevel $nb]
+
+ if {![info exists TLNotebooks($top)]} {
+ # Augment $top bindings:
+ #
+ bind $top <Control-Key-Next> {+ttk::notebook::TLCycleTab %W 1}
+ bind $top <Control-Key-Prior> {+ttk::notebook::TLCycleTab %W -1}
+ bind $top <Control-Key-Tab> {+ttk::notebook::TLCycleTab %W 1}
+ bind $top <Shift-Control-Key-Tab> {+ttk::notebook::TLCycleTab %W -1}
+ catch {
+ bind $top <Control-Key-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
+ }
+ if {[tk windowingsystem] eq "aqua"} {
+ bind $top <Option-KeyPress> \
+ +[list ttk::notebook::MnemonicActivation $top %K]
+ } else {
+ bind $top <Alt-KeyPress> \
+ +[list ttk::notebook::MnemonicActivation $top %K]
+ }
+ bind $top <Destroy> {+ttk::notebook::TLCleanup %W}
+ }
+
+ lappend TLNotebooks($top) $nb
+}
+
+# TLCleanup -- <Destroy> binding for traversal-enabled toplevels
+#
+proc ttk::notebook::TLCleanup {w} {
+ variable TLNotebooks
+ if {$w eq [winfo toplevel $w]} {
+ unset -nocomplain -please TLNotebooks($w)
+ }
+}
+
+# Cleanup -- <Destroy> binding for notebooks
+#
+proc ttk::notebook::Cleanup {nb} {
+ variable TLNotebooks
+ set top [winfo toplevel $nb]
+ if {[info exists TLNotebooks($top)]} {
+ set index [lsearch -exact $TLNotebooks($top) $nb]
+ set TLNotebooks($top) [lreplace $TLNotebooks($top) $index $index]
+ }
+}
+
+# EnclosingNotebook $w --
+# Return the nearest traversal-enabled notebook widget
+# that contains $w.
+#
+# BUGS: this only works properly for tabs that are direct children
+# of the notebook widget. This routine should follow the
+# geometry manager hierarchy, not window ancestry, but that
+# information is not available in Tk.
+#
+proc ttk::notebook::EnclosingNotebook {w} {
+ variable TLNotebooks
+
+ set top [winfo toplevel $w]
+ if {![info exists TLNotebooks($top)]} { return }
+
+ while {$w ne $top && $w ne ""} {
+ if {[lsearch -exact $TLNotebooks($top) $w] >= 0} {
+ return $w
+ }
+ set w [winfo parent $w]
+ }
+ return ""
+}
+
+# TLCycleTab --
+# toplevel binding procedure for Control-Tab / Shift-Control-Tab
+# Select the next/previous tab in the nearest ancestor notebook.
+#
+proc ttk::notebook::TLCycleTab {w dir} {
+ set nb [EnclosingNotebook $w]
+ if {$nb ne ""} {
+ CycleTab $nb $dir
+ return -code break
+ }
+}
+
+# MnemonicActivation $nb $key --
+# Alt-KeyPress binding procedure for mnemonic activation.
+# Scan all notebooks in specified toplevel for a tab with the
+# the specified mnemonic. If found, activate it and return TCL_BREAK.
+#
+proc ttk::notebook::MnemonicActivation {top key} {
+ variable TLNotebooks
+ foreach nb $TLNotebooks($top) {
+ if {[set tab [MnemonicTab $nb $key]] ne ""} {
+ ActivateTab $nb [$nb index $tab]
+ return -code break
+ }
+ }
+}
diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl
new file mode 100644
index 0000000..a2e073b
--- /dev/null
+++ b/library/ttk/panedwindow.tcl
@@ -0,0 +1,82 @@
+#
+# Bindings for ttk::panedwindow widget.
+#
+
+namespace eval ttk::panedwindow {
+ variable State
+ array set State {
+ pressed 0
+ pressX -
+ pressY -
+ sash -
+ sashPos -
+ }
+}
+
+## Bindings:
+#
+bind TPanedwindow <ButtonPress-1> { ttk::panedwindow::Press %W %x %y }
+bind TPanedwindow <B1-Motion> { ttk::panedwindow::Drag %W %x %y }
+bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y }
+
+bind TPanedwindow <Motion> { ttk::panedwindow::SetCursor %W %x %y }
+bind TPanedwindow <Enter> { ttk::panedwindow::SetCursor %W %x %y }
+bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W }
+# See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>>
+bind TPanedwindow <<EnteredChild>> { ttk::panedwindow::ResetCursor %W }
+
+## Sash movement:
+#
+proc ttk::panedwindow::Press {w x y} {
+ variable State
+
+ set sash [$w identify $x $y]
+ if {$sash eq ""} {
+ set State(pressed) 0
+ return
+ }
+ set State(pressed) 1
+ set State(pressX) $x
+ set State(pressY) $y
+ set State(sash) $sash
+ set State(sashPos) [$w sashpos $sash]
+}
+
+proc ttk::panedwindow::Drag {w x y} {
+ variable State
+ if {!$State(pressed)} { return }
+ switch -- [$w cget -orient] {
+ horizontal { set delta [expr {$x - $State(pressX)}] }
+ vertical { set delta [expr {$y - $State(pressY)}] }
+ }
+ $w sashpos $State(sash) [expr {$State(sashPos) + $delta}]
+}
+
+proc ttk::panedwindow::Release {w x y} {
+ variable State
+ set State(pressed) 0
+ SetCursor $w $x $y
+}
+
+## Cursor management:
+#
+proc ttk::panedwindow::ResetCursor {w} {
+ variable State
+ if {!$State(pressed)} {
+ ttk::setCursor $w {}
+ }
+}
+
+proc ttk::panedwindow::SetCursor {w x y} {
+ set cursor ""
+ if {[llength [$w identify $x $y]]} {
+ # Assume we're over a sash.
+ switch -- [$w cget -orient] {
+ horizontal { set cursor hresize }
+ vertical { set cursor vresize }
+ }
+ }
+ ttk::setCursor $w $cursor
+}
+
+#*EOF*
diff --git a/library/ttk/progress.tcl b/library/ttk/progress.tcl
new file mode 100644
index 0000000..b6e2ffb
--- /dev/null
+++ b/library/ttk/progress.tcl
@@ -0,0 +1,49 @@
+#
+# Ttk widget set: progress bar utilities.
+#
+
+namespace eval ttk::progressbar {
+ variable Timers ;# Map: widget name -> after ID
+}
+
+# Autoincrement --
+# Periodic callback procedure for autoincrement mode
+#
+proc ttk::progressbar::Autoincrement {pb steptime stepsize} {
+ variable Timers
+
+ if {![winfo exists $pb]} {
+ # widget has been destroyed -- cancel timer
+ unset -nocomplain Timers($pb)
+ return
+ }
+
+ $pb step $stepsize
+
+ set Timers($pb) [after $steptime \
+ [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ]
+}
+
+# ttk::progressbar::start --
+# Start autoincrement mode. Invoked by [$pb start] widget code.
+#
+proc ttk::progressbar::start {pb {steptime 50} {stepsize 1}} {
+ variable Timers
+ if {![info exists Timers($pb)]} {
+ Autoincrement $pb $steptime $stepsize
+ }
+}
+
+# ttk::progressbar::stop --
+# Cancel autoincrement mode. Invoked by [$pb stop] widget code.
+#
+proc ttk::progressbar::stop {pb} {
+ variable Timers
+ if {[info exists Timers($pb)]} {
+ after cancel $Timers($pb)
+ unset Timers($pb)
+ }
+ $pb configure -value 0
+}
+
+
diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl
new file mode 100644
index 0000000..23d08ed
--- /dev/null
+++ b/library/ttk/scale.tcl
@@ -0,0 +1,88 @@
+# scale.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+#
+# Bindings for the TScale widget
+
+namespace eval ttk::scale {
+ variable State
+ array set State {
+ dragging 0
+ }
+}
+
+bind TScale <ButtonPress-1> { ttk::scale::Press %W %x %y }
+bind TScale <B1-Motion> { ttk::scale::Drag %W %x %y }
+bind TScale <ButtonRelease-1> { ttk::scale::Release %W %x %y }
+
+bind TScale <ButtonPress-2> { ttk::scale::Jump %W %x %y }
+bind TScale <B2-Motion> { ttk::scale::Drag %W %x %y }
+bind TScale <ButtonRelease-2> { ttk::scale::Release %W %x %y }
+
+bind TScale <ButtonPress-3> { ttk::scale::Jump %W %x %y }
+bind TScale <B3-Motion> { ttk::scale::Drag %W %x %y }
+bind TScale <ButtonRelease-3> { ttk::scale::Release %W %x %y }
+
+bind TScale <Left> { ttk::scale::Increment %W -1 }
+bind TScale <Up> { ttk::scale::Increment %W -1 }
+bind TScale <Right> { ttk::scale::Increment %W 1 }
+bind TScale <Down> { ttk::scale::Increment %W 1 }
+bind TScale <Control-Left> { ttk::scale::Increment %W -10 }
+bind TScale <Control-Up> { ttk::scale::Increment %W -10 }
+bind TScale <Control-Right> { ttk::scale::Increment %W 10 }
+bind TScale <Control-Down> { ttk::scale::Increment %W 10 }
+bind TScale <Home> { %W set [%W cget -from] }
+bind TScale <End> { %W set [%W cget -to] }
+
+proc ttk::scale::Press {w x y} {
+ variable State
+ set State(dragging) 0
+
+ switch -glob -- [$w identify $x $y] {
+ *track -
+ *trough {
+ set inc [expr {([$w get $x $y] <= [$w get]) ? -1 : 1}]
+ ttk::Repeatedly Increment $w $inc
+ }
+ *slider {
+ set State(dragging) 1
+ set State(initial) [$w get]
+ }
+ }
+}
+
+# scale::Jump -- ButtonPress-2/3 binding for scale acts like
+# Press except that clicking in the trough jumps to the
+# clicked position.
+proc ttk::scale::Jump {w x y} {
+ variable State
+ set State(dragging) 0
+
+ switch -glob -- [$w identify $x $y] {
+ *track -
+ *trough {
+ $w set [$w get $x $y]
+ set State(dragging) 1
+ set State(initial) [$w get]
+ }
+ *slider {
+ Press $w $x $y
+ }
+ }
+}
+
+proc ttk::scale::Drag {w x y} {
+ variable State
+ if {$State(dragging)} {
+ $w set [$w get $x $y]
+ }
+}
+
+proc ttk::scale::Release {w x y} {
+ variable State
+ set State(dragging) 0
+ ttk::CancelRepeat
+}
+
+proc ttk::scale::Increment {w delta} {
+ if {![winfo exists $w]} return
+ $w set [expr {[$w get] + $delta}]
+}
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
new file mode 100644
index 0000000..4bd5107
--- /dev/null
+++ b/library/ttk/scrollbar.tcl
@@ -0,0 +1,123 @@
+#
+# Bindings for TScrollbar widget
+#
+
+# Still don't have a working ttk::scrollbar under OSX -
+# Swap in a [tk::scrollbar] on that platform,
+# unless user specifies -class or -style.
+#
+if {[tk windowingsystem] eq "aqua"} {
+ rename ::ttk::scrollbar ::ttk::_scrollbar
+ proc ttk::scrollbar {w args} {
+ set constructor ::tk::scrollbar
+ foreach {option _} $args {
+ if {$option eq "-class" || $option eq "-style"} {
+ set constructor ::ttk::_scrollbar
+ break
+ }
+ }
+ return [$constructor $w {*}$args]
+ }
+}
+
+namespace eval ttk::scrollbar {
+ variable State
+ # State(xPress) --
+ # State(yPress) -- initial position of mouse at start of drag.
+ # State(first) -- value of -first at start of drag.
+}
+
+bind TScrollbar <ButtonPress-1> { ttk::scrollbar::Press %W %x %y }
+bind TScrollbar <B1-Motion> { ttk::scrollbar::Drag %W %x %y }
+bind TScrollbar <ButtonRelease-1> { ttk::scrollbar::Release %W %x %y }
+
+bind TScrollbar <ButtonPress-2> { ttk::scrollbar::Jump %W %x %y }
+bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y }
+bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
+
+proc ttk::scrollbar::Scroll {w n units} {
+ set cmd [$w cget -command]
+ if {$cmd ne ""} {
+ uplevel #0 $cmd scroll $n $units
+ }
+}
+
+proc ttk::scrollbar::Moveto {w fraction} {
+ set cmd [$w cget -command]
+ if {$cmd ne ""} {
+ uplevel #0 $cmd moveto $fraction
+ }
+}
+
+proc ttk::scrollbar::Press {w x y} {
+ variable State
+
+ set State(xPress) $x
+ set State(yPress) $y
+
+ switch -glob -- [$w identify $x $y] {
+ *uparrow -
+ *leftarrow {
+ ttk::Repeatedly Scroll $w -1 units
+ }
+ *downarrow -
+ *rightarrow {
+ ttk::Repeatedly Scroll $w 1 units
+ }
+ *thumb {
+ set State(first) [lindex [$w get] 0]
+ }
+ *trough {
+ set f [$w fraction $x $y]
+ if {$f < [lindex [$w get] 0]} {
+ # Clicked in upper/left trough
+ ttk::Repeatedly Scroll $w -1 pages
+ } elseif {$f > [lindex [$w get] 1]} {
+ # Clicked in lower/right trough
+ ttk::Repeatedly Scroll $w 1 pages
+ } else {
+ # Clicked on thumb (???)
+ set State(first) [lindex [$w get] 0]
+ }
+ }
+ }
+}
+
+proc ttk::scrollbar::Drag {w x y} {
+ variable State
+ if {![info exists State(first)]} {
+ # Initial buttonpress was not on the thumb,
+ # or something screwy has happened. In either case, ignore:
+ return;
+ }
+ set xDelta [expr {$x - $State(xPress)}]
+ set yDelta [expr {$y - $State(yPress)}]
+ Moveto $w [expr {$State(first) + [$w delta $xDelta $yDelta]}]
+}
+
+proc ttk::scrollbar::Release {w x y} {
+ variable State
+ unset -nocomplain State(xPress) State(yPress) State(first)
+ ttk::CancelRepeat
+}
+
+# scrollbar::Jump -- ButtonPress-2 binding for scrollbars.
+# Behaves exactly like scrollbar::Press, except that
+# clicking in the trough jumps to the the selected position.
+#
+proc ttk::scrollbar::Jump {w x y} {
+ variable State
+
+ switch -glob -- [$w identify $x $y] {
+ *thumb -
+ *trough {
+ set State(first) [$w fraction $x $y]
+ Moveto $w $State(first)
+ set State(xPress) $x
+ set State(yPress) $y
+ }
+ default {
+ Press $w $x $y
+ }
+ }
+}
diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl
new file mode 100644
index 0000000..153e310
--- /dev/null
+++ b/library/ttk/sizegrip.tcl
@@ -0,0 +1,102 @@
+#
+# Sizegrip widget bindings.
+#
+# Dragging a sizegrip widget resizes the containing toplevel.
+#
+# NOTE: the sizegrip widget must be in the lower right hand corner.
+#
+
+switch -- [tk windowingsystem] {
+ x11 -
+ win32 {
+ option add *TSizegrip.cursor [ttk::cursor seresize]
+ }
+ aqua {
+ # Aqua sizegrips use default Arrow cursor.
+ }
+}
+
+namespace eval ttk::sizegrip {
+ variable State
+ array set State {
+ pressed 0
+ pressX 0
+ pressY 0
+ width 0
+ height 0
+ widthInc 1
+ heightInc 1
+ resizeX 1
+ resizeY 1
+ toplevel {}
+ }
+}
+
+bind TSizegrip <ButtonPress-1> { ttk::sizegrip::Press %W %X %Y }
+bind TSizegrip <B1-Motion> { ttk::sizegrip::Drag %W %X %Y }
+bind TSizegrip <ButtonRelease-1> { ttk::sizegrip::Release %W %X %Y }
+
+proc ttk::sizegrip::Press {W X Y} {
+ variable State
+
+ if {[$W instate disabled]} { return }
+
+ set top [winfo toplevel $W]
+
+ # If the toplevel is not resizable then bail
+ foreach {State(resizeX) State(resizeY)} [wm resizable $top] break
+ if {!$State(resizeX) && !$State(resizeY)} {
+ return
+ }
+
+ # Sanity-checks:
+ # If a negative X or Y position was specified for [wm geometry],
+ # just bail out -- there's no way to handle this cleanly.
+ #
+ if {[scan [wm geometry $top] "%dx%d+%d+%d" width height x y] != 4} {
+ return;
+ }
+
+ # Account for gridded geometry:
+ #
+ set grid [wm grid $top]
+ if {[llength $grid]} {
+ set State(widthInc) [lindex $grid 2]
+ set State(heightInc) [lindex $grid 3]
+ } else {
+ set State(widthInc) [set State(heightInc) 1]
+ }
+
+ set State(toplevel) $top
+ set State(pressX) $X
+ set State(pressY) $Y
+ set State(width) $width
+ set State(height) $height
+ set State(x) $x
+ set State(y) $y
+ set State(pressed) 1
+}
+
+proc ttk::sizegrip::Drag {W X Y} {
+ variable State
+ if {!$State(pressed)} { return }
+ set w $State(width)
+ set h $State(height)
+ if {$State(resizeX)} {
+ set w [expr {$w + ($X - $State(pressX))/$State(widthInc)}]
+ }
+ if {$State(resizeY)} {
+ set h [expr {$h + ($Y - $State(pressY))/$State(heightInc)}]
+ }
+ if {$w <= 0} { set w 1 }
+ if {$h <= 0} { set h 1 }
+ set x $State(x) ; set y $State(y)
+ wm geometry $State(toplevel) ${w}x${h}+${x}+${y}
+}
+
+proc ttk::sizegrip::Release {W X Y} {
+ variable State
+ set State(pressed) 0
+}
+
+#*EOF*
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
new file mode 100644
index 0000000..1aa0ccb
--- /dev/null
+++ b/library/ttk/spinbox.tcl
@@ -0,0 +1,173 @@
+#
+# ttk::spinbox bindings
+#
+
+namespace eval ttk::spinbox { }
+
+### Spinbox bindings.
+#
+# Duplicate the Entry bindings, override if needed:
+#
+
+ttk::copyBindings TEntry TSpinbox
+
+bind TSpinbox <Motion> { ttk::spinbox::Motion %W %x %y }
+bind TSpinbox <ButtonPress-1> { ttk::spinbox::Press %W %x %y }
+bind TSpinbox <ButtonRelease-1> { ttk::spinbox::Release %W }
+bind TSpinbox <Double-Button-1> { ttk::spinbox::DoubleClick %W %x %y }
+bind TSpinbox <Triple-Button-1> {} ;# disable TEntry triple-click
+
+bind TSpinbox <KeyPress-Up> { event generate %W <<Increment>> }
+bind TSpinbox <KeyPress-Down> { event generate %W <<Decrement>> }
+
+bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 }
+bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 }
+
+ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W]
+
+## Motion --
+# Sets cursor.
+#
+proc ttk::spinbox::Motion {w x y} {
+ if { [$w identify $x $y] eq "textarea"
+ && [$w instate {!readonly !disabled}]
+ } {
+ ttk::setCursor $w text
+ } else {
+ ttk::setCursor $w ""
+ }
+}
+
+## Press --
+#
+proc ttk::spinbox::Press {w x y} {
+ if {[$w instate disabled]} { return }
+ focus $w
+ switch -glob -- [$w identify $x $y] {
+ *textarea { ttk::entry::Press $w $x }
+ *rightarrow -
+ *uparrow { ttk::Repeatedly event generate $w <<Increment>> }
+ *leftarrow -
+ *downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
+ *spinbutton {
+ if {$y * 2 >= [winfo height $w]} {
+ set event <<Decrement>>
+ } else {
+ set event <<Increment>>
+ }
+ ttk::Repeatedly event generate $w $event
+ }
+ }
+}
+
+## DoubleClick --
+# Select all if over the text area; otherwise same as Press.
+#
+proc ttk::spinbox::DoubleClick {w x y} {
+ if {[$w instate disabled]} { return }
+
+ switch -glob -- [$w identify $x $y] {
+ *textarea { SelectAll $w }
+ * { Press $w $x $y }
+ }
+}
+
+proc ttk::spinbox::Release {w} {
+ ttk::CancelRepeat
+}
+
+## MouseWheel --
+# Mousewheel callback. Turn these into <<Increment>> (-1, up)
+# or <<Decrement> (+1, down) events.
+#
+proc ttk::spinbox::MouseWheel {w dir} {
+ if {$dir < 0} {
+ event generate $w <<Increment>>
+ } else {
+ event generate $w <<Decrement>>
+ }
+}
+
+## SelectAll --
+# Select widget contents.
+#
+proc ttk::spinbox::SelectAll {w} {
+ $w selection range 0 end
+ $w icursor end
+}
+
+## Limit --
+# Limit $v to lie between $min and $max
+#
+proc ttk::spinbox::Limit {v min max} {
+ if {$v < $min} { return $min }
+ if {$v > $max} { return $max }
+ return $v
+}
+
+## Wrap --
+# Adjust $v to lie between $min and $max, wrapping if out of bounds.
+#
+proc ttk::spinbox::Wrap {v min max} {
+ if {$v < $min} { return $max }
+ if {$v > $max} { return $min }
+ return $v
+}
+
+## Adjust --
+# Limit or wrap spinbox value depending on -wrap.
+#
+proc ttk::spinbox::Adjust {w v min max} {
+ if {[$w cget -wrap]} {
+ return [Wrap $v $min $max]
+ } else {
+ return [Limit $v $min $max]
+ }
+}
+
+## Spin --
+# Handle <<Increment>> and <<Decrement>> events.
+# If -values is specified, cycle through the list.
+# Otherwise cycle through numeric range based on
+# -from, -to, and -increment.
+#
+proc ttk::spinbox::Spin {w dir} {
+ set nvalues [llength [set values [$w cget -values]]]
+ set value [$w get]
+ if {$nvalues} {
+ set current [lsearch -exact $values $value]
+ set index [Adjust $w [expr {$current + $dir}] 0 [expr {$nvalues - 1}]]
+ $w set [lindex $values $index]
+ } else {
+ if {[catch {
+ set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
+ }]} {
+ set v [$w cget -from]
+ }
+ $w set [FormatValue $w [Adjust $w $v [$w cget -from] [$w cget -to]]]
+ }
+ SelectAll $w
+ uplevel #0 [$w cget -command]
+}
+
+## FormatValue --
+# Reformat numeric value based on -format.
+#
+proc ttk::spinbox::FormatValue {w val} {
+ set fmt [$w cget -format]
+ if {$fmt eq ""} {
+ # Try to guess a suitable -format based on -increment.
+ set delta [expr {abs([$w cget -increment])}]
+ if {0 < $delta && $delta < 1} {
+ # NB: This guesses wrong if -increment has more than 1
+ # significant digit itself, e.g., -increment 0.25
+ set nsd [expr {int(ceil(-log10($delta)))}]
+ set fmt "%.${nsd}f"
+ } else {
+ set fmt "%.0f"
+ }
+ }
+ return [format $fmt $val]
+}
+
+#*EOF*
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl
new file mode 100644
index 0000000..1160e9b
--- /dev/null
+++ b/library/ttk/treeview.tcl
@@ -0,0 +1,363 @@
+#
+# ttk::treeview widget bindings and utilities.
+#
+
+namespace eval ttk::treeview {
+ variable State
+
+ # Enter/Leave/Motion
+ #
+ set State(activeWidget) {}
+ set State(activeHeading) {}
+
+ # Press/drag/release:
+ #
+ set State(pressMode) none
+ set State(pressX) 0
+
+ # For pressMode == "resize"
+ set State(resizeColumn) #0
+
+ # For pressmode == "heading"
+ set State(heading) {}
+}
+
+### Widget bindings.
+#
+
+bind Treeview <Motion> { ttk::treeview::Motion %W %x %y }
+bind Treeview <B1-Leave> { #nothing }
+bind Treeview <Leave> { ttk::treeview::ActivateHeading {} {}}
+bind Treeview <ButtonPress-1> { ttk::treeview::Press %W %x %y }
+bind Treeview <Double-ButtonPress-1> { ttk::treeview::DoubleClick %W %x %y }
+bind Treeview <ButtonRelease-1> { ttk::treeview::Release %W %x %y }
+bind Treeview <B1-Motion> { ttk::treeview::Drag %W %x %y }
+bind Treeview <KeyPress-Up> { ttk::treeview::Keynav %W up }
+bind Treeview <KeyPress-Down> { ttk::treeview::Keynav %W down }
+bind Treeview <KeyPress-Right> { ttk::treeview::Keynav %W right }
+bind Treeview <KeyPress-Left> { ttk::treeview::Keynav %W left }
+bind Treeview <KeyPress-Prior> { %W yview scroll -1 pages }
+bind Treeview <KeyPress-Next> { %W yview scroll 1 pages }
+bind Treeview <KeyPress-Return> { ttk::treeview::ToggleFocus %W }
+bind Treeview <KeyPress-space> { ttk::treeview::ToggleFocus %W }
+
+bind Treeview <Shift-ButtonPress-1> \
+ { ttk::treeview::Select %W %x %y extend }
+bind Treeview <Control-ButtonPress-1> \
+ { ttk::treeview::Select %W %x %y toggle }
+
+ttk::copyBindings TtkScrollable Treeview
+
+### Binding procedures.
+#
+
+## Keynav -- Keyboard navigation
+#
+# @@@ TODO: verify/rewrite up and down code.
+#
+proc ttk::treeview::Keynav {w dir} {
+ set focus [$w focus]
+ if {$focus eq ""} { return }
+
+ switch -- $dir {
+ up {
+ if {[set up [$w prev $focus]] eq ""} {
+ set focus [$w parent $focus]
+ } else {
+ while {[$w item $up -open] && [llength [$w children $up]]} {
+ set up [lindex [$w children $up] end]
+ }
+ set focus $up
+ }
+ }
+ down {
+ if {[$w item $focus -open] && [llength [$w children $focus]]} {
+ set focus [lindex [$w children $focus] 0]
+ } else {
+ set up $focus
+ while {$up ne "" && [set down [$w next $up]] eq ""} {
+ set up [$w parent $up]
+ }
+ set focus $down
+ }
+ }
+ left {
+ if {[$w item $focus -open] && [llength [$w children $focus]]} {
+ CloseItem $w $focus
+ } else {
+ set focus [$w parent $focus]
+ }
+ }
+ right {
+ OpenItem $w $focus
+ }
+ }
+
+ if {$focus != {}} {
+ SelectOp $w $focus choose
+ }
+}
+
+## Motion -- pointer motion binding.
+# Sets cursor, active element ...
+#
+proc ttk::treeview::Motion {w x y} {
+ set cursor {}
+ set activeHeading {}
+
+ switch -- [$w identify region $x $y] {
+ separator { set cursor hresize }
+ heading { set activeHeading [$w identify column $x $y] }
+ }
+
+ ttk::setCursor $w $cursor
+ ActivateHeading $w $activeHeading
+}
+
+## ActivateHeading -- track active heading element
+#
+proc ttk::treeview::ActivateHeading {w heading} {
+ variable State
+
+ if {$w != $State(activeWidget) || $heading != $State(activeHeading)} {
+ if {$State(activeHeading) != {}} {
+ $State(activeWidget) heading $State(activeHeading) state !active
+ }
+ if {$heading != {}} {
+ $w heading $heading state active
+ }
+ set State(activeHeading) $heading
+ set State(activeWidget) $w
+ }
+}
+
+## Select $w $x $y $selectop
+# Binding procedure for selection operations.
+# See "Selection modes", below.
+#
+proc ttk::treeview::Select {w x y op} {
+ if {[set item [$w identify row $x $y]] ne "" } {
+ SelectOp $w $item $op
+ }
+}
+
+## DoubleClick -- Double-ButtonPress-1 binding.
+#
+proc ttk::treeview::DoubleClick {w x y} {
+ if {[set row [$w identify row $x $y]] ne ""} {
+ Toggle $w $row
+ } else {
+ Press $w $x $y ;# perform single-click action
+ }
+}
+
+## Press -- ButtonPress binding.
+#
+proc ttk::treeview::Press {w x y} {
+ focus $w
+ switch -- [$w identify region $x $y] {
+ nothing { }
+ heading { heading.press $w $x $y }
+ separator { resize.press $w $x $y }
+ tree -
+ cell {
+ set item [$w identify item $x $y]
+ SelectOp $w $item choose
+ switch -glob -- [$w identify element $x $y] {
+ *indicator -
+ *disclosure { Toggle $w $item }
+ }
+ }
+ }
+}
+
+## Drag -- B1-Motion binding
+#
+proc ttk::treeview::Drag {w x y} {
+ variable State
+ switch $State(pressMode) {
+ resize { resize.drag $w $x }
+ heading { heading.drag $w $x $y }
+ }
+}
+
+proc ttk::treeview::Release {w x y} {
+ variable State
+ switch $State(pressMode) {
+ resize { resize.release $w $x }
+ heading { heading.release $w }
+ }
+ set State(pressMode) none
+ Motion $w $x $y
+}
+
+### Interactive column resizing.
+#
+proc ttk::treeview::resize.press {w x y} {
+ variable State
+ set State(pressMode) "resize"
+ set State(resizeColumn) [$w identify column $x $y]
+}
+
+proc ttk::treeview::resize.drag {w x} {
+ variable State
+ $w drag $State(resizeColumn) $x
+}
+
+proc ttk::treeview::resize.release {w x} {
+ # no-op
+}
+
+### Heading activation.
+#
+
+proc ttk::treeview::heading.press {w x y} {
+ variable State
+ set column [$w identify column $x $y]
+ set State(pressMode) "heading"
+ set State(heading) $column
+ $w heading $column state pressed
+}
+
+proc ttk::treeview::heading.drag {w x y} {
+ variable State
+ if { [$w identify region $x $y] eq "heading"
+ && [$w identify column $x $y] eq $State(heading)
+ } {
+ $w heading $State(heading) state pressed
+ } else {
+ $w heading $State(heading) state !pressed
+ }
+}
+
+proc ttk::treeview::heading.release {w} {
+ variable State
+ if {[lsearch -exact [$w heading $State(heading) state] pressed] >= 0} {
+ after 0 [$w heading $State(heading) -command]
+ }
+ $w heading $State(heading) state !pressed
+}
+
+### Selection modes.
+#
+
+## SelectOp $w $item [ choose | extend | toggle ] --
+# Dispatch to appropriate selection operation
+# depending on current value of -selectmode.
+#
+proc ttk::treeview::SelectOp {w item op} {
+ select.$op.[$w cget -selectmode] $w $item
+}
+
+## -selectmode none:
+#
+proc ttk::treeview::select.choose.none {w item} { $w focus $item }
+proc ttk::treeview::select.toggle.none {w item} { $w focus $item }
+proc ttk::treeview::select.extend.none {w item} { $w focus $item }
+
+## -selectmode browse:
+#
+proc ttk::treeview::select.choose.browse {w item} { BrowseTo $w $item }
+proc ttk::treeview::select.toggle.browse {w item} { BrowseTo $w $item }
+proc ttk::treeview::select.extend.browse {w item} { BrowseTo $w $item }
+
+## -selectmode multiple:
+#
+proc ttk::treeview::select.choose.extended {w item} {
+ BrowseTo $w $item
+}
+proc ttk::treeview::select.toggle.extended {w item} {
+ $w selection toggle [list $item]
+}
+proc ttk::treeview::select.extend.extended {w item} {
+ if {[set anchor [$w focus]] ne ""} {
+ $w selection set [between $w $anchor $item]
+ } else {
+ BrowseTo $w $item
+ }
+}
+
+### Tree structure utilities.
+#
+
+## between $tv $item1 $item2 --
+# Returns a list of all items between $item1 and $item2,
+# in preorder traversal order. $item1 and $item2 may be
+# in either order.
+#
+# NOTES:
+# This routine is O(N) in the size of the tree.
+# There's probably a way to do this that's O(N) in the number
+# of items returned, but I'm not clever enough to figure it out.
+#
+proc ttk::treeview::between {tv item1 item2} {
+ variable between [list]
+ variable selectingBetween 0
+ ScanBetween $tv $item1 $item2 {}
+ return $between
+}
+
+## ScanBetween --
+# Recursive worker routine for ttk::treeview::between
+#
+proc ttk::treeview::ScanBetween {tv item1 item2 item} {
+ variable between
+ variable selectingBetween
+
+ if {$item eq $item1 || $item eq $item2} {
+ lappend between $item
+ set selectingBetween [expr {!$selectingBetween}]
+ } elseif {$selectingBetween} {
+ lappend between $item
+ }
+ foreach child [$tv children $item] {
+ ScanBetween $tv $item1 $item2 $child
+ }
+}
+
+### User interaction utilities.
+#
+
+## OpenItem, CloseItem -- Set the open state of an item, generate event
+#
+
+proc ttk::treeview::OpenItem {w item} {
+ $w focus $item
+ event generate $w <<TreeviewOpen>>
+ $w item $item -open true
+}
+
+proc ttk::treeview::CloseItem {w item} {
+ $w item $item -open false
+ $w focus $item
+ event generate $w <<TreeviewClose>>
+}
+
+## Toggle -- toggle opened/closed state of item
+#
+proc ttk::treeview::Toggle {w item} {
+ if {[$w item $item -open]} {
+ CloseItem $w $item
+ } else {
+ OpenItem $w $item
+ }
+}
+
+## ToggleFocus -- toggle opened/closed state of focus item
+#
+proc ttk::treeview::ToggleFocus {w} {
+ set item [$w focus]
+ if {$item ne ""} {
+ Toggle $w $item
+ }
+}
+
+## BrowseTo -- navigate to specified item; set focus and selection
+#
+proc ttk::treeview::BrowseTo {w item} {
+ $w see $item
+ $w focus $item
+ $w selection set [list $item]
+}
+
+#*EOF*
diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl
new file mode 100644
index 0000000..7bae211
--- /dev/null
+++ b/library/ttk/ttk.tcl
@@ -0,0 +1,176 @@
+#
+# Ttk widget set initialization script.
+#
+
+### Source library scripts.
+#
+
+namespace eval ::ttk {
+ variable library
+ if {![info exists library]} {
+ set library [file dirname [info script]]
+ }
+}
+
+source [file join $::ttk::library fonts.tcl]
+source [file join $::ttk::library cursors.tcl]
+source [file join $::ttk::library utils.tcl]
+
+## ttk::deprecated $old $new --
+# Define $old command as a deprecated alias for $new command
+# $old and $new must be fully namespace-qualified.
+#
+proc ttk::deprecated {old new} {
+ interp alias {} $old {} ttk::do'deprecate $old $new
+}
+## do'deprecate --
+# Implementation procedure for deprecated commands --
+# issue a warning (once), then re-alias old to new.
+#
+proc ttk::do'deprecate {old new args} {
+ deprecated'warning $old $new
+ interp alias {} $old {} $new
+ uplevel 1 [linsert $args 0 $new]
+}
+
+## deprecated'warning --
+# Gripe about use of deprecated commands.
+#
+proc ttk::deprecated'warning {old new} {
+ puts stderr "$old deprecated -- use $new instead"
+}
+
+### Backward-compatibility.
+#
+#
+# Make [package require tile] an effective no-op;
+# see SF#3016598 for discussion.
+#
+package ifneeded tile 0.8.6 { package provide tile 0.8.6 }
+
+# ttk::panedwindow used to be named ttk::paned. Keep the alias for now.
+#
+::ttk::deprecated ::ttk::paned ::ttk::panedwindow
+
+### ::ttk::ThemeChanged --
+# Called from [::ttk::style theme use].
+# Sends a <<ThemeChanged>> virtual event to all widgets.
+#
+proc ::ttk::ThemeChanged {} {
+ set Q .
+ while {[llength $Q]} {
+ set QN [list]
+ foreach w $Q {
+ event generate $w <<ThemeChanged>>
+ foreach child [winfo children $w] {
+ lappend QN $child
+ }
+ }
+ set Q $QN
+ }
+}
+
+### Public API.
+#
+
+proc ::ttk::themes {{ptn *}} {
+ set themes [list]
+
+ foreach pkg [lsearch -inline -all -glob [package names] ttk::theme::$ptn] {
+ lappend themes [namespace tail $pkg]
+ }
+
+ return $themes
+}
+
+## ttk::setTheme $theme --
+# Set the current theme to $theme, loading it if necessary.
+#
+proc ::ttk::setTheme {theme} {
+ variable currentTheme ;# @@@ Temp -- [::ttk::style theme use] doesn't work
+ if {$theme ni [::ttk::style theme names]} {
+ package require ttk::theme::$theme
+ }
+ ::ttk::style theme use $theme
+ set currentTheme $theme
+}
+
+### Load widget bindings.
+#
+source [file join $::ttk::library button.tcl]
+source [file join $::ttk::library menubutton.tcl]
+source [file join $::ttk::library scrollbar.tcl]
+source [file join $::ttk::library scale.tcl]
+source [file join $::ttk::library progress.tcl]
+source [file join $::ttk::library notebook.tcl]
+source [file join $::ttk::library panedwindow.tcl]
+source [file join $::ttk::library entry.tcl]
+source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
+source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
+source [file join $::ttk::library treeview.tcl]
+source [file join $::ttk::library sizegrip.tcl]
+
+## Label and Labelframe bindings:
+# (not enough to justify their own file...)
+#
+bind TLabelframe <<Invoke>> { tk::TabToWindow [tk_focusNext %W] }
+bind TLabel <<Invoke>> { tk::TabToWindow [tk_focusNext %W] }
+
+### Load settings for built-in themes:
+#
+proc ttk::LoadThemes {} {
+ variable library
+
+ # "default" always present:
+ uplevel #0 [list source [file join $library defaults.tcl]]
+
+ set builtinThemes [style theme names]
+ foreach {theme scripts} {
+ classic classicTheme.tcl
+ alt altTheme.tcl
+ clam clamTheme.tcl
+ winnative winTheme.tcl
+ xpnative {xpTheme.tcl vistaTheme.tcl}
+ aqua aquaTheme.tcl
+ } {
+ if {[lsearch -exact $builtinThemes $theme] >= 0} {
+ foreach script $scripts {
+ uplevel #0 [list source [file join $library $script]]
+ }
+ }
+ }
+}
+
+ttk::LoadThemes; rename ::ttk::LoadThemes {}
+
+### Select platform-specific default theme:
+#
+# Notes:
+# + On OSX, aqua theme is the default
+# + On Windows, xpnative takes precedence over winnative if available.
+# + On X11, users can use the X resource database to
+# specify a preferred theme (*TkTheme: themeName);
+# otherwise "default" is used.
+#
+
+proc ttk::DefaultTheme {} {
+ set preferred [list aqua vista xpnative winnative]
+
+ set userTheme [option get . tkTheme TkTheme]
+ if {$userTheme ne {} && ![catch {
+ uplevel #0 [list package require ttk::theme::$userTheme]
+ }]} {
+ return $userTheme
+ }
+
+ foreach theme $preferred {
+ if {[package provide ttk::theme::$theme] ne ""} {
+ return $theme
+ }
+ }
+ return "default"
+}
+
+ttk::setTheme [ttk::DefaultTheme] ; rename ttk::DefaultTheme {}
+
+#*EOF*
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
new file mode 100644
index 0000000..7cc1bb7
--- /dev/null
+++ b/library/ttk/utils.tcl
@@ -0,0 +1,350 @@
+#
+# Utilities for widget implementations.
+#
+
+### Focus management.
+#
+# See also: #1516479
+#
+
+## ttk::takefocus --
+# This is the default value of the "-takefocus" option
+# for ttk::* widgets that participate in keyboard navigation.
+#
+# NOTES:
+# tk::FocusOK (called by tk_focusNext) tests [winfo viewable]
+# if -takefocus is 1, empty, or missing; but not if it's a
+# script prefix, so we have to check that here as well.
+#
+#
+proc ttk::takefocus {w} {
+ expr {[$w instate !disabled] && [winfo viewable $w]}
+}
+
+## ttk::GuessTakeFocus --
+# This routine is called as a fallback for widgets
+# with a missing or empty -takefocus option.
+#
+# It implements the same heuristics as tk::FocusOK.
+#
+proc ttk::GuessTakeFocus {w} {
+ # Don't traverse to widgets with '-state disabled':
+ #
+ if {![catch {$w cget -state} state] && $state eq "disabled"} {
+ return 0
+ }
+
+ # Allow traversal to widgets with explicit key or focus bindings:
+ #
+ if {[regexp {Key|Focus} [concat [bind $w] [bind [winfo class $w]]]]} {
+ return 1;
+ }
+
+ # Default is nontraversable:
+ #
+ return 0;
+}
+
+## ttk::traverseTo $w --
+# Set the keyboard focus to the specified window.
+#
+proc ttk::traverseTo {w} {
+ set focus [focus]
+ if {$focus ne ""} {
+ event generate $focus <<TraverseOut>>
+ }
+ focus $w
+ event generate $w <<TraverseIn>>
+}
+
+## ttk::clickToFocus $w --
+# Utility routine, used in <ButtonPress-1> bindings --
+# Assign keyboard focus to the specified widget if -takefocus is enabled.
+#
+proc ttk::clickToFocus {w} {
+ if {[ttk::takesFocus $w]} { focus $w }
+}
+
+## ttk::takesFocus w --
+# Test if the widget can take keyboard focus.
+#
+# See the description of the -takefocus option in options(n)
+# for details.
+#
+proc ttk::takesFocus {w} {
+ if {![winfo viewable $w]} {
+ return 0
+ } elseif {[catch {$w cget -takefocus} takefocus]} {
+ return [GuessTakeFocus $w]
+ } else {
+ switch -- $takefocus {
+ "" { return [GuessTakeFocus $w] }
+ 0 { return 0 }
+ 1 { return 1 }
+ default {
+ return [expr {[uplevel #0 $takefocus [list $w]] == 1}]
+ }
+ }
+ }
+}
+
+## ttk::focusFirst $w --
+# Return the first descendant of $w, in preorder traversal order,
+# that can take keyboard focus, "" if none do.
+#
+# See also: tk_focusNext
+#
+
+proc ttk::focusFirst {w} {
+ if {[ttk::takesFocus $w]} {
+ return $w
+ }
+ foreach child [winfo children $w] {
+ if {[set c [ttk::focusFirst $child]] ne ""} {
+ return $c
+ }
+ }
+ return ""
+}
+
+### Grabs.
+#
+# Rules:
+# Each call to [grabWindow $w] or [globalGrab $w] must be
+# matched with a call to [releaseGrab $w] in LIFO order.
+#
+# Do not call [grabWindow $w] for a window that currently
+# appears on the grab stack.
+#
+# See #1239190 and #1411983 for more discussion.
+#
+namespace eval ttk {
+ variable Grab ;# map: window name -> grab token
+
+ # grab token details:
+ # Two-element list containing:
+ # 1) a script to evaluate to restore the previous grab (if any);
+ # 2) a script to evaluate to restore the focus (if any)
+}
+
+## SaveGrab --
+# Record current grab and focus windows.
+#
+proc ttk::SaveGrab {w} {
+ variable Grab
+
+ if {[info exists Grab($w)]} {
+ # $w is already on the grab stack.
+ # This should not happen, but bail out in case it does anyway:
+ #
+ return
+ }
+
+ set restoreGrab [set restoreFocus ""]
+
+ set grabbed [grab current $w]
+ if {[winfo exists $grabbed]} {
+ switch [grab status $grabbed] {
+ global { set restoreGrab [list grab -global $grabbed] }
+ local { set restoreGrab [list grab $grabbed] }
+ none { ;# grab window is really in a different interp }
+ }
+ }
+
+ set focus [focus]
+ if {$focus ne ""} {
+ set restoreFocus [list focus -force $focus]
+ }
+
+ set Grab($w) [list $restoreGrab $restoreFocus]
+}
+
+## RestoreGrab --
+# Restore previous grab and focus windows.
+# If called more than once without an intervening [SaveGrab $w],
+# does nothing.
+#
+proc ttk::RestoreGrab {w} {
+ variable Grab
+
+ if {![info exists Grab($w)]} { # Ignore
+ return;
+ }
+
+ # The previous grab/focus window may have been destroyed,
+ # unmapped, or some other abnormal condition; ignore any errors.
+ #
+ foreach script $Grab($w) {
+ catch $script
+ }
+
+ unset Grab($w)
+}
+
+## ttk::grabWindow $w --
+# Records the current focus and grab windows, sets an application-modal
+# grab on window $w.
+#
+proc ttk::grabWindow {w} {
+ SaveGrab $w
+ grab $w
+}
+
+## ttk::globalGrab $w --
+# Same as grabWindow, but sets a global grab on $w.
+#
+proc ttk::globalGrab {w} {
+ SaveGrab $w
+ grab -global $w
+}
+
+## ttk::releaseGrab --
+# Release the grab previously set by [ttk::grabWindow]
+# or [ttk::globalGrab].
+#
+proc ttk::releaseGrab {w} {
+ grab release $w
+ RestoreGrab $w
+}
+
+### Auto-repeat.
+#
+# NOTE: repeating widgets do not have -repeatdelay
+# or -repeatinterval resources as in standard Tk;
+# instead a single set of settings is applied application-wide.
+# (TODO: make this user-configurable)
+#
+# (@@@ Windows seems to use something like 500/50 milliseconds
+# @@@ for -repeatdelay/-repeatinterval)
+#
+
+namespace eval ttk {
+ variable Repeat
+ array set Repeat {
+ delay 300
+ interval 100
+ timer {}
+ script {}
+ }
+}
+
+## ttk::Repeatedly --
+# Begin auto-repeat.
+#
+proc ttk::Repeatedly {args} {
+ variable Repeat
+ after cancel $Repeat(timer)
+ set script [uplevel 1 [list namespace code $args]]
+ set Repeat(script) $script
+ uplevel #0 $script
+ set Repeat(timer) [after $Repeat(delay) ttk::Repeat]
+}
+
+## Repeat --
+# Continue auto-repeat
+#
+proc ttk::Repeat {} {
+ variable Repeat
+ uplevel #0 $Repeat(script)
+ set Repeat(timer) [after $Repeat(interval) ttk::Repeat]
+}
+
+## ttk::CancelRepeat --
+# Halt auto-repeat.
+#
+proc ttk::CancelRepeat {} {
+ variable Repeat
+ after cancel $Repeat(timer)
+}
+
+### Bindings.
+#
+
+## ttk::copyBindings $from $to --
+# Utility routine; copies bindings from one bindtag onto another.
+#
+proc ttk::copyBindings {from to} {
+ foreach event [bind $from] {
+ bind $to $event [bind $from $event]
+ }
+}
+
+### Mousewheel bindings.
+#
+# Platform inconsistencies:
+#
+# On X11, the server typically maps the mouse wheel to Button4 and Button5.
+#
+# On OSX, Tk generates sensible values for the %D field in <MouseWheel> events.
+#
+# On Windows, %D must be scaled by a factor of 120.
+# In addition, Tk redirects mousewheel events to the window with
+# keyboard focus instead of sending them to the window under the pointer.
+# We do not attempt to fix that here, see also TIP#171.
+#
+# OSX conventionally uses Shift+MouseWheel for horizontal scrolling,
+# and Option+MouseWheel for accelerated scrolling.
+#
+# The Shift+MouseWheel behavior is not conventional on Windows or most
+# X11 toolkits, but it's useful.
+#
+# MouseWheel scrolling is accelerated on X11, which is conventional
+# for Tk and appears to be conventional for other toolkits (although
+# Gtk+ and Qt do not appear to use as large a factor).
+#
+
+## ttk::bindMouseWheel $bindtag $command...
+# Adds basic mousewheel support to $bindtag.
+# $command will be passed one additional argument
+# specifying the mousewheel direction (-1: up, +1: down).
+#
+
+proc ttk::bindMouseWheel {bindtag callback} {
+ switch -- [tk windowingsystem] {
+ x11 {
+ bind $bindtag <ButtonPress-4> "$callback -1"
+ bind $bindtag <ButtonPress-5> "$callback +1"
+ }
+ win32 {
+ bind $bindtag <MouseWheel> [append callback { [expr {-(%D/120)}]}]
+ }
+ aqua {
+ bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
+ }
+ }
+}
+
+## Mousewheel bindings for standard scrollable widgets.
+#
+# Usage: [ttk::copyBindings TtkScrollable $bindtag]
+#
+# $bindtag should be for a widget that supports the
+# standard scrollbar protocol.
+#
+
+switch -- [tk windowingsystem] {
+ x11 {
+ bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units }
+ bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units }
+ bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units }
+ bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units }
+ }
+ win32 {
+ bind TtkScrollable <MouseWheel> \
+ { %W yview scroll [expr {-(%D/120)}] units }
+ bind TtkScrollable <Shift-MouseWheel> \
+ { %W xview scroll [expr {-(%D/120)}] units }
+ }
+ aqua {
+ bind TtkScrollable <MouseWheel> \
+ { %W yview scroll [expr {-(%D)}] units }
+ bind TtkScrollable <Shift-MouseWheel> \
+ { %W xview scroll [expr {-(%D)}] units }
+ bind TtkScrollable <Option-MouseWheel> \
+ { %W yview scroll [expr {-10*(%D)}] units }
+ bind TtkScrollable <Shift-Option-MouseWheel> \
+ { %W xview scroll [expr {-10*(%D)}] units }
+ }
+}
+
+#*EOF*
diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl
new file mode 100644
index 0000000..99410cb
--- /dev/null
+++ b/library/ttk/vistaTheme.tcl
@@ -0,0 +1,224 @@
+#
+# Settings for Microsoft Windows Vista and Server 2008
+#
+
+# The Vista theme can only be defined on Windows Vista and above. The theme
+# is created in C due to the need to assign a theme-enabled function for
+# detecting when themeing is disabled. On systems that cannot support the
+# Vista theme, there will be no such theme created and we must not
+# evaluate this script.
+
+if {"vista" ni [ttk::style theme names]} {
+ return
+}
+
+namespace eval ttk::theme::vista {
+
+ ttk::style theme settings vista {
+
+ ttk::style configure . \
+ -background SystemButtonFace \
+ -foreground SystemWindowText \
+ -selectforeground SystemHighlightText \
+ -selectbackground SystemHighlight \
+ -font TkDefaultFont \
+ ;
+
+ ttk::style map "." \
+ -foreground [list disabled SystemGrayText] \
+ ;
+
+ ttk::style configure TButton -anchor center -padding {1 1} -width -11
+ ttk::style configure TRadiobutton -padding 2
+ ttk::style configure TCheckbutton -padding 2
+ ttk::style configure TMenubutton -padding {8 4}
+
+ ttk::style element create Menubutton.dropdown vsapi \
+ TOOLBAR 4 {{selected active} 6 {selected !active} 5
+ disabled 4 pressed 3 active 2 {} 1} \
+ -syssize {SM_CXVSCROLL SM_CYVSCROLL}
+
+ ttk::style configure TNotebook -tabmargins {2 2 2 0}
+ ttk::style map TNotebook.Tab \
+ -expand [list selected {2 2 2 2}]
+
+ # Treeview:
+ ttk::style configure Heading -font TkHeadingFont
+ ttk::style configure Treeview -background SystemWindow
+ ttk::style map Treeview \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+
+ # Label and Toolbutton
+ ttk::style configure TLabelframe.Label -foreground "#0046d5"
+
+ ttk::style configure Toolbutton -padding {4 4}
+
+ # Combobox
+ ttk::style configure TCombobox -padding 2
+ ttk::style element create Combobox.field vsapi \
+ COMBOBOX 2 {{} 1}
+ ttk::style element create Combobox.border vsapi \
+ COMBOBOX 4 {disabled 4 focus 3 active 2 hover 2 {} 1}
+ ttk::style element create Combobox.rightdownarrow vsapi \
+ COMBOBOX 6 {disabled 4 pressed 3 active 2 {} 1} \
+ -syssize {SM_CXVSCROLL SM_CYVSCROLL}
+ ttk::style layout TCombobox {
+ Combobox.border -sticky nswe -border 0 -children {
+ Combobox.rightdownarrow -side right -sticky ns
+ Combobox.padding -expand 1 -sticky nswe -children {
+ Combobox.focus -expand 1 -sticky nswe -children {
+ Combobox.textarea -sticky nswe
+ }
+ }
+ }
+ }
+ # Vista.Combobox droplist frame
+ ttk::style element create ComboboxPopdownFrame.background vsapi\
+ LISTBOX 3 {disabled 4 active 3 focus 2 {} 1}
+ ttk::style layout ComboboxPopdownFrame {
+ ComboboxPopdownFrame.background -sticky news -border 1 -children {
+ ComboboxPopdownFrame.padding -sticky news
+ }
+ }
+ ttk::style map TCombobox \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ -foreground [list \
+ disabled SystemGrayText \
+ {readonly focus} SystemHighlightText \
+ ] \
+ -focusfill [list {readonly focus} SystemHighlight] \
+ ;
+
+ # Entry
+ ttk::style configure TEntry -padding {1 1 1 1} ;# Needs lookup
+ ttk::style element create Entry.field vsapi \
+ EDIT 6 {disabled 4 focus 3 hover 2 {} 1} -padding {2 2 2 2}
+ ttk::style element create Entry.background vsapi \
+ EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
+ ttk::style layout TEntry {
+ Entry.field -sticky news -border 0 -children {
+ Entry.background -sticky news -children {
+ Entry.padding -sticky news -children {
+ Entry.textarea -sticky news
+ }
+ }
+ }
+ }
+ ttk::style map TEntry \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ ;
+
+ # Spinbox
+ ttk::style configure TSpinbox -padding 0
+ ttk::style element create Spinbox.field vsapi \
+ EDIT 9 {disabled 4 focus 3 hover 2 {} 1} -padding {1 1 1 2}
+ ttk::style element create Spinbox.background vsapi \
+ EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
+ ttk::style element create Spinbox.innerbg vsapi \
+ EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}\
+ -padding {2 0 15 2}
+ ttk::style element create Spinbox.uparrow vsapi \
+ SPIN 1 {disabled 4 pressed 3 active 2 {} 1} \
+ -padding 1 -halfheight 1 \
+ -syssize { SM_CXVSCROLL SM_CYVSCROLL }
+ ttk::style element create Spinbox.downarrow vsapi \
+ SPIN 2 {disabled 4 pressed 3 active 2 {} 1} \
+ -padding 1 -halfheight 1 \
+ -syssize { SM_CXVSCROLL SM_CYVSCROLL }
+ ttk::style layout TSpinbox {
+ Spinbox.field -sticky nswe -children {
+ Spinbox.background -sticky news -children {
+ Spinbox.padding -sticky news -children {
+ Spinbox.innerbg -sticky news -children {
+ Spinbox.textarea -expand 1 -sticky {}
+ }
+ }
+ Spinbox.uparrow -side top -sticky ens
+ Spinbox.downarrow -side bottom -sticky ens
+ }
+ }
+ }
+ ttk::style map TSpinbox \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ ;
+
+
+ # SCROLLBAR elements (Vista includes a state for 'hover')
+ ttk::style element create Vertical.Scrollbar.uparrow vsapi \
+ SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \
+ -syssize {SM_CXVSCROLL SM_CYVSCROLL}
+ ttk::style element create Vertical.Scrollbar.downarrow vsapi \
+ SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5} \
+ -syssize {SM_CXVSCROLL SM_CYVSCROLL}
+ ttk::style element create Vertical.Scrollbar.trough vsapi \
+ SCROLLBAR 7 {disabled 4 pressed 3 active 2 hover 5 {} 1}
+ ttk::style element create Vertical.Scrollbar.thumb vsapi \
+ SCROLLBAR 3 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
+ -syssize {SM_CXVSCROLL SM_CYVSCROLL}
+ ttk::style element create Vertical.Scrollbar.grip vsapi \
+ SCROLLBAR 9 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
+ -syssize {SM_CXVSCROLL SM_CYVSCROLL}
+ ttk::style element create Horizontal.Scrollbar.leftarrow vsapi \
+ SCROLLBAR 1 {disabled 12 pressed 11 active 10 hover 19 {} 9} \
+ -syssize {SM_CXHSCROLL SM_CYHSCROLL}
+ ttk::style element create Horizontal.Scrollbar.rightarrow vsapi \
+ SCROLLBAR 1 {disabled 16 pressed 15 active 14 hover 20 {} 13} \
+ -syssize {SM_CXHSCROLL SM_CYHSCROLL}
+ ttk::style element create Horizontal.Scrollbar.trough vsapi \
+ SCROLLBAR 5 {disabled 4 pressed 3 active 2 hover 5 {} 1}
+ ttk::style element create Horizontal.Scrollbar.thumb vsapi \
+ SCROLLBAR 2 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
+ -syssize {SM_CXHSCROLL SM_CYHSCROLL}
+ ttk::style element create Horizontal.Scrollbar.grip vsapi \
+ SCROLLBAR 8 {disabled 4 pressed 3 active 2 hover 5 {} 1}
+
+ # Progressbar
+ ttk::style element create Horizontal.Progressbar.pbar vsapi \
+ PROGRESS 3 {{} 1} -padding 8
+ ttk::style layout Horizontal.TProgressbar {
+ Horizontal.Progressbar.trough -sticky nswe -children {
+ Horizontal.Progressbar.pbar -side left -sticky ns
+ }
+ }
+ ttk::style element create Vertical.Progressbar.pbar vsapi \
+ PROGRESS 3 {{} 1} -padding 8
+ ttk::style layout Vertical.TProgressbar {
+ Vertical.Progressbar.trough -sticky nswe -children {
+ Vertical.Progressbar.pbar -side bottom -sticky we
+ }
+ }
+
+ # Scale
+ ttk::style element create Horizontal.Scale.slider vsapi \
+ TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
+ -width 6 -height 12
+ ttk::style layout Horizontal.TScale {
+ Scale.focus -expand 1 -sticky nswe -children {
+ Horizontal.Scale.trough -expand 1 -sticky nswe -children {
+ Horizontal.Scale.track -sticky we
+ Horizontal.Scale.slider -side left -sticky {}
+ }
+ }
+ }
+ ttk::style element create Vertical.Scale.slider vsapi \
+ TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
+ -width 12 -height 6
+ ttk::style layout Vertical.TScale {
+ Scale.focus -expand 1 -sticky nswe -children {
+ Vertical.Scale.trough -expand 1 -sticky nswe -children {
+ Vertical.Scale.track -sticky ns
+ Vertical.Scale.slider -side top -sticky {}
+ }
+ }
+ }
+
+ # Treeview
+ ttk::style configure Item -padding {4 0 0 0}
+
+ package provide ttk::theme::vista 1.0
+ }
+}
diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl
new file mode 100644
index 0000000..55367bc
--- /dev/null
+++ b/library/ttk/winTheme.tcl
@@ -0,0 +1,80 @@
+#
+# Settings for 'winnative' theme.
+#
+
+namespace eval ttk::theme::winnative {
+ ttk::style theme settings winnative {
+
+ ttk::style configure "." \
+ -background SystemButtonFace \
+ -foreground SystemWindowText \
+ -selectforeground SystemHighlightText \
+ -selectbackground SystemHighlight \
+ -troughcolor SystemScrollbar \
+ -font TkDefaultFont \
+ ;
+
+ ttk::style map "." -foreground [list disabled SystemGrayText] ;
+ ttk::style map "." -embossed [list disabled 1] ;
+
+ ttk::style configure TButton \
+ -anchor center -width -11 -relief raised -shiftrelief 1
+ ttk::style configure TCheckbutton -padding "2 4"
+ ttk::style configure TRadiobutton -padding "2 4"
+ ttk::style configure TMenubutton \
+ -padding "8 4" -arrowsize 3 -relief raised
+
+ ttk::style map TButton -relief {{!disabled pressed} sunken}
+
+ ttk::style configure TEntry \
+ -padding 2 -selectborderwidth 0 -insertwidth 1
+ ttk::style map TEntry \
+ -fieldbackground \
+ [list readonly SystemButtonFace disabled SystemButtonFace] \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ ;
+
+ ttk::style configure TCombobox -padding 2
+ ttk::style map TCombobox \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ -fieldbackground [list \
+ readonly SystemButtonFace \
+ disabled SystemButtonFace] \
+ -foreground [list \
+ disabled SystemGrayText \
+ {readonly focus} SystemHighlightText \
+ ] \
+ -focusfill [list {readonly focus} SystemHighlight] \
+ ;
+
+ ttk::style element create ComboboxPopdownFrame.border from default
+ ttk::style configure ComboboxPopdownFrame \
+ -borderwidth 1 -relief solid
+
+ ttk::style configure TSpinbox -padding {2 0 16 0}
+
+ ttk::style configure TLabelframe -borderwidth 2 -relief groove
+
+ ttk::style configure Toolbutton -relief flat -padding {8 4}
+ ttk::style map Toolbutton -relief \
+ {disabled flat selected sunken pressed sunken active raised}
+
+ ttk::style configure TScale -groovewidth 4
+
+ ttk::style configure TNotebook -tabmargins {2 2 2 0}
+ ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1
+ ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}]
+
+ # Treeview:
+ ttk::style configure Heading -font TkHeadingFont -relief raised
+ ttk::style configure Treeview -background SystemWindow
+ ttk::style map Treeview \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+
+ ttk::style configure TProgressbar \
+ -background SystemHighlight -borderwidth 0 ;
+ }
+}
diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl
new file mode 100644
index 0000000..187ce0b
--- /dev/null
+++ b/library/ttk/xpTheme.tcl
@@ -0,0 +1,65 @@
+#
+# Settings for 'xpnative' theme
+#
+
+namespace eval ttk::theme::xpnative {
+
+ ttk::style theme settings xpnative {
+
+ ttk::style configure . \
+ -background SystemButtonFace \
+ -foreground SystemWindowText \
+ -selectforeground SystemHighlightText \
+ -selectbackground SystemHighlight \
+ -font TkDefaultFont \
+ ;
+
+ ttk::style map "." \
+ -foreground [list disabled SystemGrayText] \
+ ;
+
+ ttk::style configure TButton -anchor center -padding {1 1} -width -11
+ ttk::style configure TRadiobutton -padding 2
+ ttk::style configure TCheckbutton -padding 2
+ ttk::style configure TMenubutton -padding {8 4}
+
+ ttk::style configure TNotebook -tabmargins {2 2 2 0}
+ ttk::style map TNotebook.Tab \
+ -expand [list selected {2 2 2 2}]
+
+ # Treeview:
+ ttk::style configure Heading -font TkHeadingFont
+ ttk::style configure Treeview -background SystemWindow
+ ttk::style map Treeview \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+
+ ttk::style configure TLabelframe.Label -foreground "#0046d5"
+
+ # OR: -padding {3 3 3 6}, which some apps seem to use.
+ ttk::style configure TEntry -padding {2 2 2 4}
+ ttk::style map TEntry \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ ;
+ ttk::style configure TCombobox -padding 2
+ ttk::style map TCombobox \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ -foreground [list \
+ disabled SystemGrayText \
+ {readonly focus} SystemHighlightText \
+ ] \
+ -focusfill [list {readonly focus} SystemHighlight] \
+ ;
+
+ ttk::style configure TSpinbox -padding {2 0 14 0}
+ ttk::style map TSpinbox \
+ -selectbackground [list !focus SystemWindow] \
+ -selectforeground [list !focus SystemWindowText] \
+ ;
+
+ ttk::style configure Toolbutton -padding {4 4}
+
+ }
+}
diff --git a/library/unsupported.tcl b/library/unsupported.tcl
index f9a2ab9..aeece38 100644
--- a/library/unsupported.tcl
+++ b/library/unsupported.tcl
@@ -93,7 +93,7 @@ namespace eval ::tk::unsupported {
tkIconList_Config ::tk::IconList_Config
tkIconList_Create ::tk::IconList_Create
tkIconList_CtrlBtn1 ::tk::IconList_CtrlBtn1
- tkIconList_Curselection ::tk::IconList_Curselection
+ tkIconList_Curselection ::tk::IconList_CurSelection
tkIconList_DeleteAll ::tk::IconList_DeleteAll
tkIconList_Double1 ::tk::IconList_Double1
tkIconList_DrawSelection ::tk::IconList_DrawSelection
diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl
index df5a363..0cbf251 100644
--- a/library/xmfbox.tcl
+++ b/library/xmfbox.tcl
@@ -155,7 +155,24 @@ proc ::tk::MotifFDialog_FileTypes {w} {
# The filetypes radiobuttons
# set data(fileType) $data(-defaulttype)
+ # Default type to first entry
+ set initialTypeName [lindex $data(-filetypes) 0 0]
+ if {$data(-typevariable) ne ""} {
+ upvar #0 $data(-typevariable) typeVariable
+ if {[info exist typeVariable]} {
+ set initialTypeName $typeVariable
+ }
+ }
+ set ix 0
set data(fileType) 0
+ foreach fltr $data(-filetypes) {
+ set fname [lindex $fltr 0]
+ if {[string first $initialTypeName $fname] == 0} {
+ set data(fileType) $ix
+ break
+ }
+ incr ix
+ }
MotifFDialog_SetFilter $w [lindex $data(-filetypes) $data(fileType)]
@@ -166,7 +183,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
frame $f
set cnt 0
- if {$data(-filetypes) ne ""} {
+ if {$data(-filetypes) ne {}} {
foreach type $data(-filetypes) {
set title [lindex [lindex $type 0] 0]
set filter [lindex $type 1]
@@ -174,7 +191,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
-text $title \
-variable ::tk::dialog::file::[winfo name $w](fileType) \
-value $cnt \
- -command "[list tk::MotifFDialog_SetFilter $w $type]"
+ -command [list tk::MotifFDialog_SetFilter $w $type]
pack $f.b$cnt -side left
incr cnt
}
@@ -224,12 +241,17 @@ proc ::tk::MotifFDialog_Config {dataName type argList} {
{-initialfile "" "" ""}
{-parent "" "" "."}
{-title "" "" ""}
+ {-typevariable "" "" ""}
}
- if { $type eq "open" } {
+ if {$type eq "open"} {
lappend specs {-multiple "" "" "0"}
}
+ if {$type eq "save"} {
+ lappend specs {-confirmoverwrite "" "" "1"}
+ }
set data(-multiple) 0
+ set data(-confirmoverwrite) 1
# 2: default values depending on the type of the dialog
#
if {![info exists data(selectPath)]} {
@@ -247,7 +269,7 @@ proc ::tk::MotifFDialog_Config {dataName type argList} {
if {$data(-multiple) != 0} {
set data(-title) "[mc {Open Multiple Files}]"
} else {
- set data(-title) [mc "Open"]
+ set data(-title) [mc "Open"]
}
} else {
set data(-title) [mc "Save As"]
@@ -487,7 +509,7 @@ proc ::tk::MotifFDialog_InterpFilter {w} {
if {$relative} {
tk_messageBox -icon warning -type ok \
- -message "\"$text\" must be an absolute pathname"
+ -message "\"$text\" must be an absolute pathname"
$data(fEnt) delete 0 end
$data(fEnt) insert 0 [::tk::dialog::file::JoinFile $data(selectPath) \
@@ -575,12 +597,12 @@ proc ::tk::MotifFDialog_LoadFiles {w} {
} else {
foreach pat $data(filter) {
if {[string match $pat $f]} {
- if {[string match .* $f]} {
- incr top
- }
- lappend flist $f
+ if {[string match .* $f]} {
+ incr top
+ }
+ lappend flist $f
break
- }
+ }
}
}
}
@@ -725,7 +747,7 @@ proc ::tk::MotifFDialog_BrowseFList {w} {
$data(sEnt) insert 0 $data(selectFile)
} else {
$data(sEnt) insert 0 [::tk::dialog::file::JoinFile $data(selectPath) \
- [lindex $data(selectFile) 0]]
+ [lindex $data(selectFile) 0]]
}
$data(sEnt) xview end
}
@@ -829,23 +851,27 @@ proc ::tk::MotifFDialog_ActivateSEnt {w} {
-message [mc {File "%1$s" does not exist.} $item]
return
}
- } else {
- if {$data(type) eq "save"} {
- set message [format %s%s \
- [mc "File \"%1\$s\" already exists.\n\n" \
- $selectFilePath] \
- [mc {Replace existing file?}]]
- set answer [tk_messageBox -icon warning -type yesno \
- -message $message]
- if {$answer eq "no"} {
- return
- }
+ } elseif {$data(type) eq "save" && $data(-confirmoverwrite)} {
+ set message [format %s%s \
+ [mc "File \"%1\$s\" already exists.\n\n" $selectFilePath] \
+ [mc {Replace existing file?}]]
+ set answer [tk_messageBox -icon warning -type yesno \
+ -message $message]
+ if {$answer eq "no"} {
+ return
}
}
-
+
lappend newFileList $item
}
+ # Return selected filter
+ if {[info exists data(-typevariable)] && $data(-typevariable) ne ""
+ && [info exists data(-filetypes)] && $data(-filetypes) ne ""} {
+ upvar #0 $data(-typevariable) typeVariable
+ set typeVariable [lindex $data(-filetypes) $data(fileType) 0]
+ }
+
if {$data(-multiple) != 0} {
set Priv(selectFilePath) $newFileList
} else {
diff --git a/license.terms b/license.terms
index 03ca6fc..50619a3 100644
--- a/license.terms
+++ b/license.terms
@@ -33,7 +33,7 @@ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
-252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
+252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
diff --git a/mac/MW_TkBuildLibHeader.h b/mac/MW_TkBuildLibHeader.h
deleted file mode 100644
index cbca0c2..0000000
--- a/mac/MW_TkBuildLibHeader.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#if __POWERPC__
-#include "MW_TkBuildLibHeaderPPC"
-#elif __CFM68K__
-#include "MW_TkBuildLibHeaderCFM68K"
-#else
-#include "MW_TkBuildLibHeader68K"
-#endif
diff --git a/mac/MW_TkBuildLibHeader.pch b/mac/MW_TkBuildLibHeader.pch
deleted file mode 100644
index ff3f477..0000000
--- a/mac/MW_TkBuildLibHeader.pch
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * MW_TkBuildLibHeader.pch --
- *
- * This file is the source for a pre-compilied header that gets used
- * for all files in the Tk projects. This make compilies go a bit
- * faster. This file is only intended to be used in the MetroWerks
- * CodeWarrior environment. It essentially acts as a place to set
- * compiler flags. See MetroWerks documention for more details.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-/*
- * To use the compilied header you need to set the "Prefix file" in
- * the "C/C++ Language" preference panel to point to the created
- * compilied header. The name of the header depends on the
- * architecture we are compiling for (see the code below). For
- * example, for a 68k app the prefix file should be: MW_TclHeader68K.
- */
-
-#if __POWERPC__
-#pragma precompile_target "MW_TkBuildLibHeaderPPC"
-#elif __CFM68K__
-#pragma precompile_target "MW_TkBuildLibHeaderCFM68K"
-#else
-#pragma precompile_target "MW_TkBuildLibHeader68K"
-#endif
-
-#define BUILD_tk 1
-
-#include "MW_TkHeaderCommon.h"
diff --git a/mac/MW_TkHeader.h b/mac/MW_TkHeader.h
deleted file mode 100755
index a5ee464..0000000
--- a/mac/MW_TkHeader.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#if __POWERPC__
-#include "MW_TkHeaderPPC"
-#elif __CFM68K__
-#include "MW_TkHeaderCFM68K"
-#else
-#include "MW_TkHeader68K"
-#endif
diff --git a/mac/MW_TkHeader.pch b/mac/MW_TkHeader.pch
deleted file mode 100644
index f21685b..0000000
--- a/mac/MW_TkHeader.pch
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * MW_TkHeader.pch --
- *
- * This file is the source for a pre-compilied header that gets used
- * for all files in the Tk projects. This make compilies go a bit
- * faster. This file is only intended to be used in the MetroWerks
- * CodeWarrior environment. It essentially acts as a place to set
- * compiler flags. See MetroWerks documention for more details.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-/*
- * To use the compilied header you need to set the "Prefix file" in
- * the "C/C++ Language" preference panel to point to the created
- * compilied header. The name of the header depends on the
- * architecture we are compiling for (see the code below). For
- * example, for a 68k app the prefix file should be: MW_TclHeader68K.
- */
-
-#if __POWERPC__
-#pragma precompile_target "MW_TkHeaderPPC"
-#elif __CFM68K__
-#pragma precompile_target "MW_TkHeaderCFM68K"
-#else
-#pragma precompile_target "MW_TkHeader68K"
-#endif
-
-#include "MW_TkHeaderCommon.h"
diff --git a/mac/MW_TkHeaderCommon.h b/mac/MW_TkHeaderCommon.h
deleted file mode 100644
index 349b562..0000000
--- a/mac/MW_TkHeaderCommon.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * MW_TkHeaderCommon.h --
- *
- * Common includes for precompiled headers
- *
- * Copyright (c) 1998 by Scriptics Corporation.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#pragma once
-
-#include "tclMacCommonPch.h"
-
-#ifdef TCL_DEBUG
- #define TK_TEST
-#endif
-
-/*
- * The following defines are for the Xlib.h file to force
- * it to generate prototypes in the way we need it. This is
- * defined here in case X.h & company are ever included before
- * tk.h.
- */
-
-#define NeedFunctionPrototypes 1
-#define NeedWidePrototypes 0
-
-/*
- * Place any includes below that will are needed by the majority of the
- * and is OK to be in any file in the system.
- */
-
-#include "tcl.h"
-
-#include "tk.h"
-#include "tkInt.h"
diff --git a/mac/MW_TkOldImgHeader.h b/mac/MW_TkOldImgHeader.h
deleted file mode 100755
index 309ca20..0000000
--- a/mac/MW_TkOldImgHeader.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define USE_OLD_IMAGE
-
-#include "MW_TkBuildLibHeader.pch"
diff --git a/mac/MW_TkOldImgStaticHeader.h b/mac/MW_TkOldImgStaticHeader.h
deleted file mode 100644
index 967b763..0000000
--- a/mac/MW_TkOldImgStaticHeader.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define USE_OLD_IMAGE
-
-#include "MW_TkStaticHeader.pch"
diff --git a/mac/MW_TkStaticHeader.h b/mac/MW_TkStaticHeader.h
deleted file mode 100644
index b381c22..0000000
--- a/mac/MW_TkStaticHeader.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#if __POWERPC__
-#include "MW_TkStaticHeaderPPC"
-#elif __CFM68K__
-#include "MW_TkStaticHeaderCFM68K"
-#else
-#include "MW_TkStaticHeader68K"
-#endif
diff --git a/mac/MW_TkStaticHeader.pch b/mac/MW_TkStaticHeader.pch
deleted file mode 100644
index cd619e6..0000000
--- a/mac/MW_TkStaticHeader.pch
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * MW_TkStaticHeader.pch --
- *
- * This file is the source for a pre-compilied header that gets used
- * for all files in the Tk projects. This make compilies go a bit
- * faster. This file is only intended to be used in the MetroWerks
- * CodeWarrior environment. It essentially acts as a place to set
- * compiler flags. See MetroWerks documention for more details.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-/*
- * To use the compilied header you need to set the "Prefix file" in
- * the "C/C++ Language" preference panel to point to the created
- * compilied header. The name of the header depends on the
- * architecture we are compiling for (see the code below). For
- * example, for a 68k app the prefix file should be: MW_TclHeader68K.
- */
-
-#if __POWERPC__
-#pragma precompile_target "MW_TkStaticHeaderPPC"
-#elif __CFM68K__
-#pragma precompile_target "MW_TkStaticHeaderCFM68K"
-#else
-#pragma precompile_target "MW_TkStaticHeader68K"
-#endif
-
-#define STATIC_BUILD 1
-
-#include "MW_TkHeaderCommon.h"
diff --git a/mac/MW_TkTestHeader.h b/mac/MW_TkTestHeader.h
deleted file mode 100755
index 995e9fd..0000000
--- a/mac/MW_TkTestHeader.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#if __POWERPC__
-#include "MW_TkTestHeaderPPC"
-#elif __CFM68K__
-#include "MW_TkTestHeaderCFM68K"
-#else
-#include "MW_TkTestHeader68K"
-#endif
diff --git a/mac/MW_TkTestHeader.pch b/mac/MW_TkTestHeader.pch
deleted file mode 100755
index 4d0bae8..0000000
--- a/mac/MW_TkTestHeader.pch
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * MW_TkTestHeader.pch --
- *
- * This file is the source for a pre-compilied header that gets used
- * for all files in the Tk projects. This make compilies go a bit
- * faster. This file is only intended to be used in the MetroWerks
- * CodeWarrior environment. It essentially acts as a place to set
- * compiler flags. See MetroWerks documention for more details.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-/*
- * To use the compilied header you need to set the "Prefix file" in
- * the "C/C++ Language" preference panel to point to the created
- * compilied header. The name of the header depends on the
- * architecture we are compiling for (see the code below). For
- * example, for a 68k app the prefix file should be: MW_TclHeader68K.
- */
-
-#if __POWERPC__
-#pragma precompile_target "MW_TkTestHeaderPPC"
-#elif __CFM68K__
-#pragma precompile_target "MW_TkTestHeaderCFM68K"
-#else
-#pragma precompile_target "MW_TkTestHeader68K"
-#endif
-
-#define BUILD_tk 1
-
-#define STATIC_BUILD 1
-
-#define TCL_DEBUG 1
-
-#define TCL_THREADS 1
-
-#include "MW_TkHeaderCommon.h"
diff --git a/mac/README b/mac/README
deleted file mode 100644
index 1634bc3..0000000
--- a/mac/README
+++ /dev/null
@@ -1,91 +0,0 @@
-Tk 8.4 for Macintosh
-
-Originally by Ray Johnson while at Sun Microsystems Labs
-with major help from Jim Ingham while at Cygnus Solutions
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-Note that Tk on Mac OS Classic is no longer supported and likely no longer
-compiles, the last release known to work is 8.4.2. The 'mac' source
-directory and all other Mac Classic code have been removed from Tk 8.5.
-
-The Mac OS X port of Tk can be found in the 'macosx' source directory.
-
-The information and URLs below are known to be outdated and incorrect.
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-1. Introduction
----------------
-
-This is the README file for the Macintosh version of the Tk
-extension for the Tcl scripting language. The file consists of
-information specific to the Macintosh version of Tcl and Tk. For more
-general information please read the README file in the main Tk
-directory.
-
-3. Mac specific features
-------------------------
-
-There are several features or enhancements in Tk that are unique to
-the Macintosh version of Tk. The list of these features is
-maintained at
- http://www.tcl.tk/software/mac/features.html
-
-4. The Distribution
--------------------
-
-Macintosh Tk is distributed in three different forms. This should
-make it easier to only download what you need. Replace <version>
-with the current version of Tk. The packages are as follows:
-
-mactk<version>.sea.hqx
-
- This distribution is a "binary" only release. It contains an
- installer program that will install a 68k, PowerPC, or Fat
- version of the "Wish" application. In addition, in installs
- the Tcl & Tk libraries in the Extensions folder inside your
- System Folder. (No "INIT"'s or Control Pannels are installed.)
-
-mactcltk-full-<version>.sea.hqx
-
- This release contains the full release of Tcl and Tk for the
- Macintosh plus the More Files package on which Macintosh Tcl and
- Tk rely.
-
-mactk-source-<version>.sea.hqx
-
- This release contains the complete source to Tk for the Macintosh
- In addition, Metrowerks CodeWarrior libraries and project files
- are included. However, you must already have the More Files
- package to compile this code.
-
-5. Compiling Tk
----------------
-
-In order to compile Macintosh Tk you must have the
-following items:
-
- CodeWarrior Pro 5 or higher
- Mac Tcl (source)
- (which requires More Files 1.4.9)
- Mac Tk (source)
-
-The project files included with the Mac Tcl source should work
-fine. The only thing you may need to update are the access paths.
-As with Tcl, you need to upgrade to the 2.0.1 version of the C
-compilers or later to build the CFM68K version of Tcl/Tk.
-
-Special notes:
-
-* Check out the file bugs.doc for information about known bugs.
-
-* We are starting to support the new Appearance Manager that shipped
- with MacOS 8.0. The Tk 8.0.3 release is the first Tk release
- that supported the Appearance Manager well. Tk 8.0.4 extended this support
- to the menu system, though you have to have Appearance 1.0.1 or later
- installed for this to work.
-
-
-If you have comments or Bug reports, use our on-line database at
- http://tcl.sourceforge.net/
diff --git a/mac/bugs.doc b/mac/bugs.doc
deleted file mode 100644
index 91269b2..0000000
--- a/mac/bugs.doc
+++ /dev/null
@@ -1,52 +0,0 @@
-Known bug list for Tk 8.0 for Macintosh
-
-Originally by Ray Johnson
-Sun Microsystems Laboratories
-rjohnson@eng.sun.com
-
-Maintained by:
-Jim Ingham
-Cygnus Solutions, a Red Hat Company
-jingham@cygnus.com
-
-We are now very close to passing the test suite for Tk. We are very
-interested in finding remaining bugs that still linger. Please let us
-know (and send us test cases) of any bugs you find.
-
-Known bugs:
-
-* Transient windows (set by wm transient) do not go away when the
- master does.
-
-* Tearoff menus should be floating windows & floating windows should
- float. They also shouldn't be resizable.
-
-* The -use and -container windows only work with other Tk windows in
- the same process. Also, if you try really hard (for instance by binding
- on Destroy of an embedded window and destroying the container's toplevel)
- you can get Tk to crash. This should never be necessary, however, since
- the destruction of the embedded window triggers the destruction of the
- container, so you can watch that instead.
- All the focus bugs in Tk8.0 have been fixed, however.
-
-* The send command is only implemented within the same app.
-
-* You cannot color buttons, and the indicators for radiobuttons and
- checkbuttons under Appearance. They will always use the current
- Theme color. But, then, you are not supposed to...
-
-* Drawing is not really correct. This shows up mostly in the canvas
- when line widths are greater than one. Unfortunantly, this will not
- be easy to fix.
-
-* The active menu highlight color in Tearoff menus will not match the system-wide
- menu highlight color under Appearance. It will be black instead. This is not
- easy to fix, since the Appearance API's don't really allow you to get your hands
- on this information...
-
-There are many other bugs. However, will no get listed until they
-are reported at least once. Send those bug reports in!
-
-
-
-Jim
diff --git a/mac/tclets.r b/mac/tclets.r
deleted file mode 100755
index e4553ae..0000000
--- a/mac/tclets.r
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * tclets.r --
- *
- */
-
-/*
- * New style DLOG templates have an extra field for the positioning
- * options for the Dialog Box. We will not use this, for now, so we
- * turn it off here.
- */
-
-#define DLOG_RezTemplateVersion 0
-
-#include <Types.r>
-#include <SysTypes.r>
-#include <AEUserTermTypes.r>
-
-/*
- * We now load the Tclets code into the resource fork
- */
-
-#define TK_LIBRARY_RESOURCES 3000
-
-read 'TEXT' (TK_LIBRARY_RESOURCES+114, "tclshrc", purgeable)
- "::mac:tclets.tcl";
-
-data 'icns' (-16455) {
- $"6963 6E73 0000 08F8 6963 7323 0000 0048" /* icns...¯ics#...H */
- $"0100 02EE 05CE 09EE 13DE 23FF 47CE 86C6" /* ...Ó.‘Ó.Þ#G‘Ü */
- $"4681 22C2 12C4 0888 0410 0220 0140 0080" /* FÅ"¬.Ÿ.à... .@.Ä */
- $"0100 03EE 07CE 0FEE 1FFE 3FFF 7FFE FFFE" /* ...Ó.‘.Ó.œ?.œœ */
- $"7FFF 3FFE 1FFC 0FF8 07F0 03E0 01C0 0080" /* .?œ.¸.¯.•.ý.¿.Ä */
- $"6963 7334 0000 0088 0000 000F 0000 0000" /* ics4...à........ */
- $"0000 00FC F6D0 FFF0 0000 0FC5 DD00 F6F0" /* ...¸–­•...‰ð.–• */
- $"0000 FCCD 66F0 F6F0 000F CC6E 66CE F6F0" /* ..¸Õf•–•..Ãnf‘–• */
- $"00FC CC6E 67EF F6FF 0FCC CD66 66CC F6F0" /* .¸ÃngÔ–.ÃÕffÖ• */
- $"FCCC CDDC 66CC CFA0 0FCC CD6C EDCC CC0F" /* ¸ÃÕÐfæÝ.ÃÕlÌÃÃ. */
- $"00FC CC6C E6CC CCF0 000F CC6C 66CC CF00" /* .¸ÃlÊÃÕ..Ãlfæ. */
- $"0000 FCCC 6CCC F000 0000 0FCC DCCF 0000" /* ..¸ÃlÕ....ÃЦ.. */
- $"0000 00FD DCF0 0000 0000 000F CF00 0000" /* ...›Ð•......¦... */
- $"0000 0000 F000 0000 6963 7338 0000 0108" /* ....•...ics8.... */
- $"0000 0000 0000 00FF 0000 0000 0000 0000" /* ............... */
- $"0000 0000 0000 FF2B FFEC 7F00 FFFF FF00" /* ......+Ï... */
- $"0000 0000 00FF 2BB0 7F7F 0000 FFEC FF00" /* .....+ƒ....Ï. */
- $"0000 0000 FF2B 2B7F ECEC FF00 FFEC FF00" /* ....++.ÏÏ.Ï. */
- $"0000 00FF 2B2B ECFC ECEC 2BFB FFEC FF00" /* ...++ϸÏÏ+šÏ. */
- $"0000 FF2B 2B2B ECFC ECC0 FBFF FFEC FFFF" /* ..+++ϸϿšÏ */
- $"00FF 2B2B 2B7F ECEC ECEC 2B2B FFEC FF00" /* .+++.ÏÏÏÏ++Ï. */
- $"FF2B 2B2B 2B7F 7FF6 ECEC 2B2B 2BFF FD00" /* ++++..–ÏÏ+++›. */
- $"00FF 2B2B 2B7F ECF6 FCF9 2B2B 2B2B 00FF" /* .+++.Ï–¸˜++++. */
- $"0000 FF2B 2B2B ECF6 FCEC 2B2B 2B2B FF00" /* ..+++Ï–¸Ï++++. */
- $"0000 00FF 2B2B ECF6 ECEC 2B2B 2BFF 0000" /* ...++Ï–ÏÏ+++.. */
- $"0000 0000 FF2B 2BF6 EC2B 2B2B FF00 0000" /* ....++–Ï+++... */
- $"0000 0000 00FF 2BF6 F92B 2BFF 0000 0000" /* .....+–˜++.... */
- $"0000 0000 0000 FFF9 F92B FF00 0000 0000" /* ......˜˜+..... */
- $"0000 0000 0000 00FF 2BFF 0000 0000 0000" /* .......+...... */
- $"0000 0000 0000 0000 FF00 0000 0000 0000" /* ............... */
- $"4943 4E23 0000 0108 0001 0000 0002 8000" /* ICN#..........Ä. */
- $"0004 78F8 0008 70F8 0010 F0F8 0021 E8F8" /* ..x¯..p¯..•¯.!˯ */
- $"0043 C4F8 0081 FAF8 0107 F1F8 0207 F0F8" /* .CŸ¯.Å™¯..Ò¯..•¯ */
- $"0407 F7FF 0807 E3FE 1007 E1FC 200E E0F8" /* ..—..“œ..·¸ .ý¯ */
- $"4002 E074 800E E022 400E E001 200E C002" /* @.ýtÄ.ý"@.ý. .¿. */
- $"1006 E004 0806 C008 0406 E010 0202 C020" /* ..ý...¿...ý...¿ */
- $"0102 C040 0080 8080 0040 0100 0020 0200" /* ..¿@.ÄÄÄ.@... .. */
- $"0010 0400 0008 0800 0004 1000 0002 2000" /* .............. . */
- $"0001 4000 0000 8000 0001 0000 0003 8000" /* ..@...Ä.......Ä. */
- $"0007 F8F8 000F F0F8 001F F0F8 003F F8F8" /* ..¯¯..•¯..•¯.?¯¯ */
- $"007F FCF8 00FF FEF8 01FF FFF8 03FF FFF8" /* ..¸¯.œ¯.¯.¯ */
- $"07FF FFFF 0FFF FFFE 1FFF FFFC 3FFF FFF8" /* ..œ.¸?¯ */
- $"7FFF FFFC FFFF FFFE 7FFF FFFF 3FFF FFFE" /* .¸œ.?œ */
- $"1FFF FFFC 0FFF FFF8 07FF FFF0 03FF FFE0" /* .¸.¯.•.ý */
- $"01FF FFC0 00FF FF80 007F FF00 003F FE00" /* .¿.Ä....?œ. */
- $"001F FC00 000F F800 0007 F000 0003 E000" /* ..¸...¯...•...ý. */
- $"0001 C000 0000 8000 6963 6C34 0000 0208" /* ..¿...Ä.icl4.... */
- $"0000 0000 0000 000F 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 00FC F000 0000 0000 0000" /* .......¸•....... */
- $"0000 0000 0000 0FCC CFD6 D000 FFFF F000" /* .......æ÷­.•. */
- $"0000 0000 0000 FCCC C556 0000 F767 F000" /* ......¸Ã‰V..—g•. */
- $"0000 0000 000F CCCC 566F 0000 F676 F000" /* ......ÃÃVo..–v•. */
- $"0000 0000 00FC CCC5 6F5C F000 F767 F000" /* .....¸Ã‰o\•.—g•. */
- $"0000 0000 0FCC CC66 66CC 0F00 F676 F000" /* .....ÃÃffÃ..–v•. */
- $"0000 0000 FCCC CCD5 5666 FCF0 F767 F000" /* ....¸ÃùVf¸•—g•. */
- $"0000 000F CCCC C656 5667 CCCF F676 F000" /* ....ÃÃVVgæ–v•. */
- $"0000 00FC CCCC C6E5 5566 CCCC F767 F000" /* ...¸ÃÃÂUfÃ×g•. */
- $"0000 0FCC CCCC C656 5657 CFFF F676 FFFF" /* ...ÃÃÃVVW¦–v */
- $"0000 FCCC CCCC C6E5 565C CCF7 6767 67F0" /* ..¸ÃÃÃÂV\×ggg• */
- $"000F CCCC CCCC C655 565C CCCF 7676 7F00" /* ..ÃÃÃÃUV\ævv.. */
- $"00FC CCCC CCCC 7660 556C CCCC F767 F000" /* .¸ÃÃÃÃv`UlÃ×g•. */
- $"0FCC CCCC CCCC CD5D 567C CCCC CF7F CF00" /* .ÃÃÃÃÃÕ]V|Ãæ.¦. */
- $"FCCC CCCC CCCC 6660 556C CCCC CCFC CCF0" /* ¸ÃÃÃÃÃf`UlÃÃøÕ */
- $"0FCC CCCC CCCC 665C 565C CCCC CCCC CCCF" /* .ÃÃÃÃÃf\V\ÃÃÃÃæ */
- $"00FC CCCC CCCC 6660 E6DC CCCC CCCC CCF0" /* .¸ÃÃÃÃf`ÊÐÃÃÃÃÕ */
- $"000F CCCC CCCC C650 656C CCCC CCCC CF00" /* ..ÃÃÃÃPelÃÃÃæ. */
- $"0000 FCCC CCCC C6EC 5ECC CCCC CCCC F000" /* ..¸ÃÃÃÏ^ÃÃÃÃÕ. */
- $"0000 0FCC CCCC C650 566C CCCC CCCF 0000" /* ...ÃÃÃPVlÃÃæ.. */
- $"0000 00FC CCCC CC50 D5CC CCCC CCF0 0000" /* ...¸ÃÃÃP¹ÃÃÃÕ.. */
- $"0000 000F CCCC CC50 56CC CCCC CF00 0000" /* ....ÃÃÃPVÃÃæ... */
- $"0000 0000 FCCC CCD0 5CCC CCCC F000 0000" /* ....¸Ãí\ÃÃÕ... */
- $"0000 0000 0FCC CCD0 DCCC CCCF 0000 0000" /* .....ÃíÐÃæ.... */
- $"0000 0000 00FC CCD0 DCCC CCF0 0000 0000" /* .....¸Ã­ÐÃÕ.... */
- $"0000 0000 000F CCD0 DCCC CF00 0000 0000" /* ......íÐæ..... */
- $"0000 0000 0000 FCC0 CCCC F000 0000 0000" /* ......¸¿ÃÕ..... */
- $"0000 0000 0000 0FCD CCCF 0000 0000 0000" /* .......Õæ...... */
- $"0000 0000 0000 00FC CCF0 0000 0000 0000" /* .......¸Ã•...... */
- $"0000 0000 0000 000F CF00 0000 0000 0000" /* ........¦....... */
- $"0000 0000 0000 0000 F000 0000 0000 0000" /* ........•....... */
- $"6963 6C38 0000 0408 0000 0000 0000 0000" /* icl8............ */
- $"0000 0000 0000 00FF 0000 0000 0000 0000" /* ............... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 FF2B FF00 0000 0000 0000" /* ......+....... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 00FF 2B2B 2BFF 7FEC 7F00 0000" /* .....+++.Ï.... */
- $"FFFF FFFF FF00 0000 0000 0000 0000 0000" /* ........... */
- $"0000 0000 FF2B 2B2B 2BB0 B0EC 0000 0000" /* ....++++ƒƒÏ.... */
- $"FFC0 ECC0 FF00 0000 0000 0000 0000 0000" /* ¿Ï¿........... */
- $"0000 00FF 2B2B 2B2B B0EC ECFF 0000 0000" /* ...++++ƒÏÏ.... */
- $"FFEC C0EC FF00 0000 0000 0000 0000 0000" /* Ï¿Ï........... */
- $"0000 FF2B 2B2B 2BB0 ECFF B02B FF00 0000" /* ..++++ƒÏƒ+... */
- $"FFC0 ECC0 FF00 0000 0000 0000 0000 0000" /* ¿Ï¿........... */
- $"00FF 2B2B 2B2B ECEC ECEC 2B2B 00FF 0000" /* .++++ÏÏÏÏ++... */
- $"FFEC C0EC FF00 0000 0000 0000 0000 0000" /* Ï¿Ï........... */
- $"FF2B 2B2B 2B2B F9B0 B0EC ECEC FF2B FF00" /* +++++˜ƒƒÏÏÏ+. */
- $"FFC0 ECC0 FF00 0000 0000 0000 0000 00FF" /* ¿Ï¿.......... */
- $"2B2B 2B2B 2BEC B0EC B0EC ECC0 2B2B 2BFF" /* +++++σσÏÏ¿+++ */
- $"FFEC C0EC FF00 0000 0000 0000 0000 FF2B" /* Ï¿Ï.........+ */
- $"2B2B 2B2B 2BEC FCB0 B0B0 ECEC 2B2B 2B2B" /* +++++ϸƒƒƒÏÏ++++ */
- $"FFC0 ECC0 FF00 0000 0000 0000 00FF 2B2B" /* ¿Ï¿........++ */
- $"2B2B 2B2B 2BEC B0EC B0EC B0C0 2BFF FFFF" /* +++++σσσ¿+ */
- $"FFEC C0EC FFFF FFFF 0000 0000 FF2B 2B2B" /* Ï¿Ï....+++ */
- $"2B2B 2B2B 2BEC FCB0 B0EC B02B 2B2B FFC0" /* +++++ϸƒƒÏƒ+++¿ */
- $"ECC0 ECC0 ECC0 FF00 0000 00FF 2B2B 2B2B" /* Ï¿Ï¿Ï¿....++++ */
- $"2B2B 2B2B 2BEC B0B0 B0EC B02B 2B2B 2BFF" /* +++++σƒƒÏƒ++++ */
- $"C0EC C0EC C0FF 0000 0000 FF2B 2B2B 2B2B" /* ¿Ï¿Ï¿....+++++ */
- $"2B2B 2B2B C0EC EC00 B0B0 EC2B 2B2B 2B2B" /* ++++¿ÏÏ.ƒƒÏ+++++ */
- $"FFC0 ECC0 FF00 0000 00FF 2B2B 2B2B 2B2B" /* ¿Ï¿....++++++ */
- $"2B2B 2B2B 2BF9 B0F9 B0EC C02B 2B2B 2B2B" /* +++++˜ƒ˜ƒÏ¿+++++ */
- $"2BFF C0FF 2BFF 0000 FF2B 2B2B 2B2B 2B2B" /* +¿+..+++++++ */
- $"2B2B 2B2B ECEC EC00 B0B0 EC2B 2B2B 2B2B" /* ++++ÏÏÏ.ƒƒÏ+++++ */
- $"2B2B FF2B 2B2B FF00 00FF 2B2B 2B2B 2B2B" /* +++++..++++++ */
- $"2B2B 2B2B ECEC B02B B0EC B02B 2B2B 2B2B" /* ++++Ïσ+ƒÏƒ+++++ */
- $"2B2B 2B2B 2B2B 2BFF 0000 FF2B 2B2B 2B2B" /* +++++++..+++++ */
- $"2B2B 2B2B ECEC EC00 FCEC F92B 2B2B 2B2B" /* ++++ÏÏÏ.¸Ï˜+++++ */
- $"2B2B 2B2B 2B2B FF00 0000 00FF 2B2B 2B2B" /* ++++++....++++ */
- $"2B2B 2B2B 2BEC B000 ECB0 EC2B 2B2B 2B2B" /* +++++σ.σÏ+++++ */
- $"2B2B 2B2B 2BFF 0000 0000 0000 FF2B 2B2B" /* +++++......+++ */
- $"2B2B 2B2B 2BEC FC2B B0FC 2B2B 2B2B 2B2B" /* +++++ϸ+ƒ¸++++++ */
- $"2B2B 2B2B FF00 0000 0000 0000 00FF 2B2B" /* ++++........++ */
- $"2B2B 2B2B 2BEC B000 B0EC EC2B 2B2B 2B2B" /* +++++σ.ƒÏÏ+++++ */
- $"2B2B 2BFF 0000 0000 0000 0000 0000 FF2B" /* +++..........+ */
- $"2B2B 2B2B 2B2B B000 7FB0 2B2B 2B2B 2B2B" /* ++++++ƒ..ƒ++++++ */
- $"2B2B FF00 0000 0000 0000 0000 0000 00FF" /* ++............ */
- $"2B2B 2B2B 2B2B B000 B0EC 2B2B 2B2B 2B2B" /* ++++++ƒ.ƒÏ++++++ */
- $"2BFF 0000 0000 0000 0000 0000 0000 0000" /* +.............. */
- $"FF2B 2B2B 2B2B F900 B02B 2B2B 2B2B 2B2B" /* +++++˜.ƒ+++++++ */
- $"FF00 0000 0000 0000 0000 0000 0000 0000" /* ............... */
- $"00FF 2B2B 2B2B F900 F92B 2B2B 2B2B 2BFF" /* .++++˜.˜++++++ */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 FF2B 2B2B F900 F92B 2B2B 2B2B FF00" /* ..+++˜.˜+++++. */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 00FF 2B2B F900 F92B 2B2B 2BFF 0000" /* ...++˜.˜++++.. */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 FF2B 2B00 2B2B 2B2B FF00 0000" /* ....++.++++... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 00FF 2BF9 2B2B 2BFF 0000 0000" /* .....+˜+++.... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 FF2B 2B2B FF00 0000 0000" /* ......+++..... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 00FF 2BFF 0000 0000 0000" /* .......+...... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 0000 FF00 0000 0000 0000" /* ............... */
- $"0000 0000 0000 0000" /* ........ */
-};
diff --git a/mac/tclets.tcl b/mac/tclets.tcl
deleted file mode 100644
index ccaaae8..0000000
--- a/mac/tclets.tcl
+++ /dev/null
@@ -1,223 +0,0 @@
-# tclets.tcl --
-#
-# Drag & Drop Tclets
-# by Ray Johnson
-#
-# A simple way to create Tcl applications. This applications will copy a
-# droped Tcl file into a copy of a stub application (the user can pick).
-# The file is placed into the TEXT resource named "tclshrc" which is
-# automatically executed on startup.
-#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-
-namespace eval ::tk {}
-namespace eval ::tk::mac {}
-
-# ::tk::mac::OpenDocument --
-#
-# This procedure is a called whenever Wish recieves an "Open" event. The
-# procedure must be named ::tk::mac::OpenDocument for this to work.
-# Passed in files are assumed to be Tcl files that the user wants to be
-# made into Tclets. (Only the first one is used.) The procedure then
-# creates a copy of the stub app and places the Tcl file in the new
-# application's resource fork.
-#
-# Parameters:
-# args List of files
-#
-# Results:
-# One success a new Tclet is created.
-
-proc ::tk::mac::OpenDocument {args} {
- variable Droped_to_start
-
- # We only deal with the one file droped on the App
- set tclFile [lindex $args 0]
- set stub [GetStub]
-
- # Give a helper screen to guide user
- toplevel .helper -menu .bar
- ::tk::unsupported::MacWindowStyle style .helper dBoxProc
- message .helper.m -aspect 300 -text \
- "Select the name & location of your target Tcl application."
- pack .helper.m
- wm geometry .helper +20+40
- update idletasks
-
- # Get the target file from the end user
- set target [tk_getSaveFile]
- destroy .helper
- if {$target == ""} return
-
- # Copy stub, copy the droped file into the stubs text resource
- file copy $stub $target
- set id [open $tclFile r]
- set rid [resource open $target w]
- resource write -name tclshrc -file $rid TEXT [read $id]
- resource close $rid
- close $id
-
- # This is a hint to the start-up code - always set to true
- set Droped_to_start true
-}
-
-# ::tk::mac::GetStub --
-#
-# Get the location of our stub application. The value may be cached,
-# in the preferences file, or we may need to ask the user.
-#
-# Parameters:
-# None.
-#
-# Results:
-# A path to the stub application.
-
-proc ::tk::mac::GetStub {} {
- global env
- variable Stub_location
-
- if {[info exists Stub_location]} {
- return $Stub_location
- }
-
- set file $env(PREF_FOLDER)
- append file "D&D Tclet Preferences"
-
-
- if {[file exists $file]} {
- uplevel #0 [list source $file]
- if {[info exists Stub_location] && [file exists $Stub_location]} {
- return $Stub_location
- }
- }
-
- SelectStub
-
- if {[info exists Stub_location]} {
- return $Stub_location
- } else {
- exit
- }
-}
-
-# ::tk::mac::SelectStub --
-#
-# This procedure uses tk_getOpenFile to allow the user to select
-# the copy of "Wish" that is used as the basis for Tclets. The
-# result is stored in a preferences file.
-#
-# Parameters:
-# None.
-#
-# Results:
-# None. The prefernce file is updated.
-
-proc ::tk::mac::SelectStub {} {
- global env
- variable Stub_location
-
- # Give a helper screen to guide user
- toplevel .helper -menu .bar
- ::tk::unsupported::MacWindowStyle style .helper dBoxProc
- message .helper.m -aspect 300 -text \
- "Select \"Wish\" stub to clone. A copy of this application will be made to create your Tclet." \
-
- pack .helper.m
- wm geometry .helper +20+40
- update idletasks
-
- set new_location [tk_getOpenFile]
- destroy .helper
- if {$new_location != ""} {
- set Stub_location $new_location
- set file [file join $env(PREF_FOLDER) "D&D Tclet Preferences"]
-
- set id [open $file w]
- puts $id [list set [namespace which -variable Stub_location] \
- $Stub_location]
- close $id
- }
-}
-
-# ::tk::mac::CreateMenus --
-#
-# Create the menubar for this application.
-#
-# Parameters:
-# None.
-#
-# Results:
-# None.
-
-proc ::tk::mac::CreateMenus {} {
- menu .bar
- .bar add cascade -menu .bar.file -label File
- .bar add cascade -menu .bar.apple
- . configure -menu .bar
-
- menu .bar.apple -tearoff 0
- .bar.apple add command -label "About Drag & Drop Tclets..." \
- -command [namespace code ShowAbout]
-
- menu .bar.file -tearoff 0
- .bar.file add command -label "Show Console..." -command {console show}
- .bar.file add command -label "Select Wish Stub..." \
- -command [namespace code SelectStub]
- .bar.file add separator
- .bar.file add command -label "Quit" -accel Command-Q -command exit
-}
-
-# ::tk::mac::ShowAbout --
-#
-# Show the about box for Drag & Drop Tclets.
-#
-# Parameters:
-# None.
-#
-# Results:
-# None.
-
-proc ::tk::mac::ShowAbout {} {
- tk_messageBox -icon info -type ok -message \
-"Drag & Drop Tclets
-by Ray Johnson\n\n\
-Copyright (c) 1997 Sun Microsystems, Inc."
-}
-
-# ::tk::mac::Start --
-#
-# This procedure provides the main start-up code for the application.
-# It should be run first thing on start up. It will create the UI
-# and set up the rest of the state of the application.
-#
-# Parameters:
-# None.
-#
-# Results:
-# None.
-
-proc ::tk::mac::Start {} {
- variable Droped_to_start
-
- # Hide . & console - see if we ran as a droped item
- wm geometry . 1x1-25000-25000
- console hide
-
- # Run update - if we get any drop events we know that we were
- # started by a drag & drop - if so, we quit automatically when done
- set Droped_to_start false
- update
- if {$Droped_to_start == "true"} {
- exit
- }
-
- # We were not started by a drag & drop - create the UI
- CreateMenus
-}
-
-# Now that everything is defined, lets start the app!
-::tk::mac::Start
diff --git a/mac/tkMac.h b/mac/tkMac.h
deleted file mode 100644
index 3caf2eb..0000000
--- a/mac/tkMac.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * tkMacInt.h --
- *
- * Declarations of Macintosh specific exported variables and procedures.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#ifndef _TKMAC
-#define _TKMAC
-
-#ifndef _TK
-#include <tk.h>
-#endif
-
-#ifndef _TKINT
-#include "tkInt.h"
-#endif
-
-#include <Windows.h>
-#include <QDOffscreen.h>
-
-#ifdef BUILD_tk
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLEXPORT
-#endif
-
-/*
- * This variable is exported and can be used by extensions. It is the
- * way Tk extensions should access the QD Globals. This is so Tk
- * can support embedding itself in another window.
- */
-
-EXTERN QDGlobalsPtr tcl_macQdPtr;
-
-/*
- * Structures and function types for handling Netscape-type in process
- * embedding where Tk does not control the top-level
- */
-typedef int (Tk_MacEmbedRegisterWinProc) (int winID, Tk_Window window);
-typedef GWorldPtr (Tk_MacEmbedGetGrafPortProc) (Tk_Window window);
-typedef int (Tk_MacEmbedMakeContainerExistProc) (Tk_Window window);
-typedef void (Tk_MacEmbedGetClipProc) (Tk_Window window, RgnHandle rgn);
-typedef void (Tk_MacEmbedGetOffsetInParentProc) (Tk_Window window, Point *ulCorner);
-
-#include "tkPlatDecls.h"
-
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLIMPORT
-
-#endif /* _TKMAC */
diff --git a/mac/tkMacAppInit.c b/mac/tkMacAppInit.c
deleted file mode 100644
index b833c2e..0000000
--- a/mac/tkMacAppInit.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * tkMacAppInit.c --
- *
- * Provides a version of the Tcl_AppInit procedure for the example shell.
- *
- * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Gestalt.h>
-#include <ToolUtils.h>
-#include <Fonts.h>
-#include <Dialogs.h>
-#include <SegLoad.h>
-#include <Traps.h>
-#include <Appearance.h>
-
-#include "tk.h"
-#include "tkInt.h"
-#include "tkMacInt.h"
-#include "tclInt.h"
-#include "tclMac.h"
-#include "tclMacInt.h"
-
-#ifdef TK_TEST
-extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
-#endif /* TK_TEST */
-
-Tcl_Interp *gStdoutInterp = NULL;
-
-int TkMacConvertEvent _ANSI_ARGS_((EventRecord *eventPtr));
-
-/*
- * Prototypes for functions the ANSI library needs to link against.
- */
-short InstallConsole _ANSI_ARGS_((short fd));
-void RemoveConsole _ANSI_ARGS_((void));
-long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n));
-long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n));
-extern char * __ttyname _ANSI_ARGS_((long fildes));
-int kbhit _ANSI_ARGS_((void));
-int getch _ANSI_ARGS_((void));
-void clrscr _ANSI_ARGS_((void));
-short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event));
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static int MacintoshInit _ANSI_ARGS_((void));
-static int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp));
-static void SetupSIOUX _ANSI_ARGS_((void));
-
-static int inMacExit = 0;
-static pascal void NoMoreOutput() { inMacExit = 1; }
-
-/*
- *----------------------------------------------------------------------
- *
- * main --
- *
- * Main program for Wish.
- *
- * Results:
- * None. This procedure never returns (it exits the process when
- * it's done
- *
- * Side effects:
- * This procedure initializes the wish world and then
- * calls Tk_Main.
- *
- *----------------------------------------------------------------------
- */
-
-void
-main(
- int argc, /* Number of arguments. */
- char **argv) /* Array of argument strings. */
-{
- char *newArgv[2];
-
- if (MacintoshInit() != TCL_OK) {
- Tcl_Exit(1);
- }
-
- argc = 1;
- newArgv[0] = "Wish";
- newArgv[1] = NULL;
-
- /* Tk_Main is actually #defined to
- * Tk_MainEx(argc, argv, Tcl_AppInit, Tcl_CreateInterp())
- * Unfortunately, you also HAVE to call Tcl_FindExecutable
- * BEFORE creating the first interp, or the tcl_library will not
- * get set properly. So we call it by hand here...
- */
-
- Tcl_FindExecutable(newArgv[0]);
- Tk_Main(argc, newArgv, Tcl_AppInit);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_AppInit --
- *
- * This procedure performs application-specific initialization.
- * Most applications, especially those that incorporate additional
- * packages, will have their own version of this procedure.
- *
- * Results:
- * Returns a standard Tcl completion code, and leaves an error
- * message in the interp's result if an error occurs.
- *
- * Side effects:
- * Depends on the startup script.
- *
- *----------------------------------------------------------------------
- */
-
-int
-Tcl_AppInit(
- Tcl_Interp *interp) /* Interpreter for application. */
-{
- if (Tcl_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- if (Tk_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
-
- /*
- * Call the init procedures for included packages. Each call should
- * look like this:
- *
- * if (Mod_Init(interp) == TCL_ERROR) {
- * return TCL_ERROR;
- * }
- *
- * where "Mod" is the name of the module.
- */
-
-#ifdef TK_TEST
- if (Tktest_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
- (Tcl_PackageInitProc *) NULL);
-#endif /* TK_TEST */
-
- /*
- * Call Tcl_CreateCommand for application-specific commands, if
- * they weren't already created by the init procedures called above.
- * Each call would look like this:
- *
- * Tcl_CreateCommand(interp, "tclName", CFuncCmd, NULL, NULL);
- */
-
- SetupMainInterp(interp);
-
- /*
- * Specify a user-specific startup script to invoke if the application
- * is run interactively. On the Mac we can specifiy either a TEXT resource
- * which contains the script or the more UNIX like file location
- * may also used. (I highly recommend using the resource method.)
- */
-
- Tcl_SetVar(interp, "tcl_rcRsrcName", "tclshrc", TCL_GLOBAL_ONLY);
- /* Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); */
-
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MacintoshInit --
- *
- * This procedure calls Mac specific initilization calls. Most of
- * these calls must be made as soon as possible in the startup
- * process.
- *
- * Results:
- * Returns TCL_OK if everything went fine. If it didn't the
- * application should probably fail.
- *
- * Side effects:
- * Inits the application.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-MacintoshInit()
-{
- int i;
- long result, mask = 0x0700; /* mask = system 7.x */
-
-#if GENERATING68K && !GENERATINGCFM
- SetApplLimit(GetApplLimit() - (TK_MAC_68K_STACK_GROWTH));
-#endif
- MaxApplZone();
- for (i = 0; i < 4; i++) {
- (void) MoreMasters();
- }
-
- /*
- * Tk needs us to set the qd pointer it uses. This is needed
- * so Tk doesn't have to assume the availablity of the qd global
- * variable. Which in turn allows Tk to be used in code resources.
- */
- tcl_macQdPtr = &qd;
-
- /*
- * If appearance is present, then register Tk as an Appearance client
- * This means that the mapping from non-Appearance to Appearance cdefs
- * will be done for Tk regardless of the setting in the Appearance
- * control panel.
- */
-
- if (TkMacHaveAppearance()) {
- RegisterAppearanceClient();
- }
-
- InitGraf(&tcl_macQdPtr->thePort);
- InitFonts();
- if (TkMacHaveAppearance() >= 0x110) {
- InitFloatingWindows();
- } else {
- InitWindows();
- }
- InitMenus();
- InitDialogs((long) NULL);
- InitCursor();
-
- /*
- * Make sure we are running on system 7 or higher
- */
-
- if ((NGetTrapAddress(_Gestalt, ToolTrap) ==
- NGetTrapAddress(_Unimplemented, ToolTrap))
- || (((Gestalt(gestaltSystemVersion, &result) != noErr)
- || (result < mask)))) {
- panic("Tcl/Tk requires System 7 or higher.");
- }
-
- /*
- * Make sure we have color quick draw
- * (this means we can't run on 68000 macs)
- */
-
- if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr)
- || (result < gestalt32BitQD13))) {
- panic("Tk requires Color QuickDraw.");
- }
-
-
- FlushEvents(everyEvent, 0);
- SetEventMask(everyEvent);
-
-
- Tcl_MacSetEventProc(TkMacConvertEvent);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetupMainInterp --
- *
- * This procedure calls initalization routines require a Tcl
- * interp as an argument. This call effectively makes the passed
- * iterpreter the "main" interpreter for the application.
- *
- * Results:
- * Returns TCL_OK if everything went fine. If it didn't the
- * application should probably fail.
- *
- * Side effects:
- * More initilization.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-SetupMainInterp(
- Tcl_Interp *interp)
-{
- /*
- * Initialize the console only if we are running as an interactive
- * application.
- */
-
- TkMacInitAppleEvents(interp);
- TkMacInitMenus(interp);
-
- if (strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "1")
- == 0) {
- if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
- goto error;
- }
- SetupSIOUX();
- TclMacInstallExitToShellPatch(NoMoreOutput);
- }
-
- /*
- * Attach the global interpreter to tk's expected global console
- */
-
- gStdoutInterp = interp;
-
- return TCL_OK;
-
-error:
- panic(Tcl_GetStringResult(interp));
- return TCL_ERROR;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * InstallConsole, RemoveConsole, etc. --
- *
- * The following functions provide the UI for the console package.
- * Users wishing to replace SIOUX with their own console package
- * need only provide the four functions below in a library.
- *
- * Results:
- * See SIOUX documentation for details.
- *
- * Side effects:
- * See SIOUX documentation for details.
- *
- *----------------------------------------------------------------------
- */
-
-short
-InstallConsole(short fd)
-{
-#pragma unused (fd)
-
- return 0;
-}
-
-void
-RemoveConsole(void)
-{
-}
-
-long
-WriteCharsToConsole(char *buffer, long n)
-{
- if (!inMacExit) {
- Tcl_DString ds;
- Tcl_ExternalToUtfDString(NULL, buffer, n, &ds);
- TkConsolePrint(gStdoutInterp, TCL_STDOUT, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
- Tcl_DStringFree(&ds);
- return n;
- } else {
- return 0;
- }
-}
-
-long
-ReadCharsFromConsole(char *buffer, long n)
-{
- return 0;
-}
-
-extern char *
-__ttyname(long fildes)
-{
- static char *__devicename = "null device";
-
- if (fildes >= 0 && fildes <= 2) {
- return (__devicename);
- }
-
- return (0L);
-}
-
-int kbhit(void)
-{
- return 0;
-}
-
-int getch(void)
-{
- return 0;
-}
-
-void clrscr(void)
-{
- return;
-}
-
-short
-SIOUXHandleOneEvent(EventRecord *event)
-{
- return 0;
-}
-static void SetupSIOUX(void) {
-#ifndef STATIC_BUILD
- extern DLLIMPORT void SetupConsolePlugins(void*, void*, void*, void*,
- void*, void*, void*, void*);
- SetupConsolePlugins( &InstallConsole,
- &RemoveConsole,
- &WriteCharsToConsole,
- &ReadCharsFromConsole,
- &__ttyname,
- &kbhit,
- &getch,
- &clrscr);
-#endif
-}
diff --git a/mac/tkMacAppearanceStubs.c b/mac/tkMacAppearanceStubs.c
deleted file mode 100755
index 0fd0fee..0000000
--- a/mac/tkMacAppearanceStubs.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * tkMacAppearanceStubs.c --
- *
- * This file contains stubs for some MacOS8.6+ Toolbox calls that
- * are not contained in any of the CFM68K stubs libraries. Their
- * use must be conditionalized by checks (usually for Appearance version
- * greater than 1.1), so they will never get called on a CFM68k system.
- * Putting in the stubs means I don't have to clutter the code BOTH
- * with appearance version checks & #ifdef GENERATING_CFM68K...
- *
- * Copyright (c) 1999 Scriptics Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- *
- */
-
-#include <MacWindows.h>
-#include <Appearance.h>
-
-/* Export these calls from the Tk library, since we may need to use
- * them in shell calls.
- */
-
-pascal OSStatus
-MoveWindowStructure(
- WindowPtr window,
- short hGlobal,
- short vGlobal)
-{
- panic("Error: Running stub for PPC-Only routine");
- return noErr;
-
-}
-
-pascal OSStatus
-CreateNewWindow(
- WindowClass windowClass,
- WindowAttributes attributes,
- const Rect *bounds,
- WindowPtr *outWindow)
-{
- panic("Error: Running stub for PPC-Only routine");
- return noErr;
-
-}
-
-pascal WindowPtr
-FrontNonFloatingWindow()
-{
- panic("Error: Running stub for PPC-Only routine");
- return NULL;
-}
-
-pascal OSStatus
-GetWindowClass(
- WindowPtr window,
- WindowClass *outClass)
-{
- panic("Error: Running stub for PPC-Only routine");
- return noErr;
-}
-
-pascal OSStatus
-ApplyThemeBackground(
- ThemeBackgroundKind inKind,
- const Rect* bounds,
- ThemeDrawState inState,
- SInt16 inDepth,
- Boolean inColorDev)
-{
- panic("Error: Running stub for PPC-Only routine");
- return noErr;
-}
-
-pascal OSStatus
-InitFloatingWindows(void)
-{
- panic("Error: Running stub for PPC-Only routine");
- return noErr;
-}
-
-pascal OSStatus
-ShowFloatingWindows(void)
-{
- panic("Error: Running stub for PPC-Only routine");
- return noErr;
-}
-
-pascal OSStatus
-HideFloatingWindows(void)
-{
- panic("Error: Running stub for PPC-Only routine");
- return noErr;
-}
-
-pascal Boolean
-IsValidWindowPtr(GrafPtr grafPort)
-{
- panic("Error: Running stub for PPC-Only routine");
- return true;
-}
-
diff --git a/mac/tkMacApplication.r b/mac/tkMacApplication.r
deleted file mode 100644
index 6b6b443..0000000
--- a/mac/tkMacApplication.r
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * tkMacApplication.r --
- *
- * This file creates resources for use in the Wish application.
- *
- * Copyright (c) 1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Types.r>
-#include <SysTypes.r>
-#include <Balloons.r>
-#include <BalloonTypes.r>
-#include <AEUserTermTypes.r>
-
-/*
- * The folowing include and defines help construct
- * the version string for Tcl.
- */
-
-#define RC_INVOKED
-#include "tk.h"
-
-#if (TK_RELEASE_LEVEL == 0)
-# define RELEASE_LEVEL alpha
-#elif (TK_RELEASE_LEVEL == 1)
-# define RELEASE_LEVEL beta
-#elif (TK_RELEASE_LEVEL == 2)
-# define RELEASE_LEVEL final
-#endif
-
-#if (TK_RELEASE_LEVEL == 2)
-# define MINOR_VERSION (TK_MINOR_VERSION * 16) + TK_RELEASE_SERIAL
-# define RELEASE_CODE 0x00
-#else
-# define MINOR_VERSION TK_MINOR_VERSION * 16
-# define RELEASE_CODE TK_RELEASE_SERIAL
-#endif
-
-resource 'vers' (1) {
- TK_MAJOR_VERSION, MINOR_VERSION,
- RELEASE_LEVEL, RELEASE_CODE, verUS,
- TK_PATCH_LEVEL,
- TK_PATCH_LEVEL ", by Ray Johnson & Jim Ingham" "\n" "© 2001 Tcl Core Team"
-};
-
-resource 'vers' (2) {
- TK_MAJOR_VERSION, MINOR_VERSION,
- RELEASE_LEVEL, RELEASE_CODE, verUS,
- TK_PATCH_LEVEL,
- "Wish " TK_PATCH_LEVEL " © 1993-2001"
-};
-
-#define TK_APP_RESOURCES 128
-#define TK_APP_CREATOR 'WIsH'
-
-/*
- * The 'BNDL' resource is the primary link between a file's
- * creator/type and its icon. This resource acts for all Tcl shared
- * libraries; other libraries will not need one and ought to use
- * custom icons rather than new file types for a different appearance.
- */
-
-resource 'BNDL' (TK_APP_RESOURCES, "Tk app bundle", purgeable)
-{
- TK_APP_CREATOR,
- 0,
- {
- 'FREF',
- {
- 0, TK_APP_RESOURCES,
- 1, TK_APP_RESOURCES+1
- },
- 'ICN#',
- {
- 0, TK_APP_RESOURCES,
- 1, TK_APP_RESOURCES+1
- }
- }
-};
-
-resource 'FREF' (TK_APP_RESOURCES, purgeable)
-{
- 'APPL', 0, ""
-};
-resource 'FREF' (TK_APP_RESOURCES+1, purgeable)
-{
- 'TEXT', 1, ""
-};
-
-type TK_APP_CREATOR as 'STR ';
-resource TK_APP_CREATOR (0, purgeable) {
- "Wish " TK_PATCH_LEVEL " © 1993-2001"
-};
-
-/*
- * The 'kind' resource works with a 'BNDL' in Macintosh Easy Open
- * to affect the text the Finder displays in the "kind" column and
- * file info dialog. This information will be applied to all files
- * with the listed creator and type.
- */
-resource 'kind' (TK_APP_RESOURCES, "Tcl kind", purgeable) {
- TK_APP_CREATOR,
- 0, /* region = USA */
- {
- 'APPL', "Wish",
- 'TEXT', "Tcl/Tk Script"
- }
-};
-
-#define kIconHelpString 256
-
-resource 'hfdr' (-5696, purgeable) {
- HelpMgrVersion, hmDefaultOptions, 0, 0,
- {HMSTRResItem {kIconHelpString}}
-};
-resource 'STR ' (kIconHelpString, purgeable) {
- "This is the interpreter for Tcl & Tk scripts"
- " running on Macintosh computers."
-};
-
-/*
- * The following resource define the icon used by Tcl scripts. Any
- * TEXT file with the creator of WIsH will get this icon.
- */
-
-data 'icl4' (TK_APP_RESOURCES + 1, "Tk Doc", purgeable) {
- $"000F FFFF FFFF FFFF FFFF FFF0 0000 0000"
- $"000F 3333 3333 3333 3333 33FF 0000 0000"
- $"000F 3333 3333 3333 3433 33F2 F000 0000"
- $"000F 3333 3333 3333 7D43 33F2 2F00 0000"
- $"000F 3333 3333 3335 5623 33F2 22F0 0000"
- $"000F 3333 3333 3356 6343 33FF FFFF 0000"
- $"000F 3333 3333 256F 5223 3333 333F 0000"
- $"000F 3333 3333 D666 2433 3333 333F 0000"
- $"000F 3333 3333 D5F6 6633 3333 333F 0000"
- $"000F 3333 3332 5666 6733 3333 333F 0000"
- $"000F 3333 3336 E56F 6633 3333 333F 0000"
- $"000F 3333 3336 5656 5733 3333 333F 0000"
- $"000F 3333 3336 E5B6 5233 3333 333F 0000"
- $"000F 3333 3336 5ED6 3333 3333 333F 0000"
- $"000F 3333 3376 6475 6233 3333 333F 0000"
- $"000F 3333 333D 5D56 7333 3333 333F 0000"
- $"000F 3333 3336 6C55 6333 3333 333F 0000"
- $"000F 3333 3336 5C56 7333 3333 333F 0000"
- $"000F 3333 3362 6CE6 D333 3333 333F 0000"
- $"000F 3333 3336 5C65 6333 3333 333F 0000"
- $"000F 3333 3336 EC5E 3333 3333 333F 0000"
- $"000F 3333 3336 5C56 6333 3333 333F 0000"
- $"000F 3333 3333 5C75 3333 3333 333F 0000"
- $"000F 3333 3333 5DD6 3333 3333 333F 0000"
- $"000F 3333 3333 3CDD 3333 3333 333F 0000"
- $"000F 3333 3333 3303 3333 3333 333F 0000"
- $"000F 3333 3333 3C33 3333 3333 333F 0000"
- $"000F 3333 3333 3C33 3333 3333 333F 0000"
- $"000F 3333 3333 3C33 3333 3333 333F 0000"
- $"000F 3333 3333 3333 3333 3333 333F 0000"
- $"000F 3333 3333 3333 3333 3333 333F 0000"
- $"000F FFFF FFFF FFFF FFFF FFFF FFFF 0000"
-};
-
-data 'ICN#' (TK_APP_RESOURCES + 1, "Tk Doc", purgeable) {
- $"1FFF FE00 1000 0300 1000 F280 1003 F240"
- $"1003 E220 1007 E3F0 100F C010 100F C010"
- $"100F C010 101F F010 101F F010 101F F010"
- $"101F F010 101F F010 101D E010 101D E010"
- $"101D E010 101D C010 101D C010 101D C010"
- $"101D C010 100D 8010 100D 8010 100D 8010"
- $"1005 8010 1002 0010 1002 0010 1002 0010"
- $"1002 0010 1002 0010 1000 0010 1FFF FFF0"
- $"1FFF FE00 1FFF FF00 1FFF FF80 1FFF FFC0"
- $"1FFF FFE0 1FFF FFF0 1FFF FFF0 1FFF FFF0"
- $"1FFF FFF0 1FFF FFF0 1FFF FFF0 1FFF FFF0"
- $"1FFF FFF0 1FFF FFF0 1FFF FFF0 1FFF FFF0"
- $"1FFF FFF0 1FFF FFF0 1FFF FFF0 1FFF FFF0"
- $"1FFF FFF0 1FFF FFF0 1FFF FFF0 1FFF FFF0"
- $"1FFF FFF0 1FFF FFF0 1FFF FFF0 1FFF FFF0"
- $"1FFF FFF0 1FFF FFF0 1FFF FFF0 1FFF FFF0"
-};
-
-data 'ics#' (TK_APP_RESOURCES + 1, "Tk Doc", purgeable) {
- $"7FF0 41D8 419C 4384 43C4 47C4 47C4 4784"
- $"4684 4684 4284 4284 4104 4104 4104 7FFC"
- $"7FE0 7FF0 7FF8 7FFC 7FFC 7FFC 7FFC 7FFC"
- $"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
-};
-
-data 'ics4' (TK_APP_RESOURCES + 1, "Tk Doc", purgeable) {
- $"0FFF FFFF FFFF 0000 0F33 3333 53F2 F000"
- $"0F33 3335 52FF FF00 0F33 33E6 3333 3F00"
- $"0F33 3256 6333 3F00 0F33 3556 6333 3F00"
- $"0F33 3A5E 3333 3F00 0F33 65D6 D333 3F00"
- $"0F33 3655 5333 3F00 0F33 65C6 3333 3F00"
- $"0F33 3EC5 E333 3F00 0F33 36C6 3333 3F00"
- $"0F33 33CD 3333 3F00 0F33 33C3 3333 3F00"
- $"0F33 33C3 3333 3F00 0FFF FFFF FFFF FF00"
-};
-
-/*
- * The following resources define the icons for the Wish
- * application.
- */
-
-data 'icl4' (TK_APP_RESOURCES, "Tk App", purgeable) {
- $"0000 0000 0000 000F 0000 0000 0000 0000"
- $"0000 0000 0000 00FC F000 0000 0000 0000"
- $"0000 0000 0000 0FCC CF66 0000 0000 0000"
- $"0000 0000 0000 FCCC C556 0000 0000 0000"
- $"0000 0000 000F CCCC 566F 0000 0000 0000"
- $"0000 0000 00FC CCC5 6F5C F000 0000 0000"
- $"0000 0000 0FCC CC66 66CC CF00 0000 0000"
- $"0000 0000 FCCC CCD5 5666 CCF0 0000 0000"
- $"0000 000F CCCC C656 5667 CCCF 0000 0000"
- $"0000 00FC CCCC C6E5 5566 CCCC F000 0000"
- $"0000 0FCC CCCC C656 5657 CCCC CF00 0000"
- $"0000 FCCC CCCC C6E5 565C CCCC CCF0 0000"
- $"000F CCCC CCCC C655 565C CCCC CCCF 0000"
- $"00FC CCCC CCCC 7660 556C CCCC CCCC F000"
- $"0FCC CCCC CCCC CD5D 567C CCCC CCCC CF00"
- $"FCCC CCCC CCCC 6660 556C CCCC CCCC CCF0"
- $"0FCC CCCC CCCC 665C 565C CCCC CCCC C0CF"
- $"00FC CCCC CCCC 6660 E6DC CCCC CCCC CCF0"
- $"000F CCCC CCCC C650 656C CCCC CCCC CF00"
- $"0000 FCCC CCCC C6EC 5ECC CCCC CCCC F000"
- $"0000 0FCC CCCC C650 566C CCCC CCCF 0000"
- $"0000 00FC CCCC CC50 75CC CCCC CCF0 0000"
- $"0000 000F CCCC CC50 56CC CCCC CF00 0000"
- $"0000 0000 FCCC CCC0 5CCC CCCC F000 0000"
- $"0000 0000 0FCC CCC0 CCCC CCCF 0000 0000"
- $"0000 0000 00FC CCC0 CCCC CCF0 0000 0000"
- $"0000 0000 000F CCC0 CCCC CF00 0000 0000"
- $"0000 0000 0000 FCCC CCCC F000 0000 0000"
- $"0000 0000 0000 0FCC CCCF 0000 0000 0000"
- $"0000 0000 0000 00FC CCF0 0000 0000 0000"
- $"0000 0000 0000 000F CF00 0000 0000 0000"
- $"0000 0000 0000 0000 F000 0000 0000 0000"
-};
-
-data 'ICN#' (TK_APP_RESOURCES, "Tk App", purgeable) {
- $"0001 0000 0002 8000 0004 7000 0008 7000"
- $"0010 F000 0021 E800 0043 C400 0081 F200"
- $"0107 F100 0207 F080 0407 F040 0807 E020"
- $"1007 E010 200E E008 4002 E004 800E E002"
- $"400E E001 200E C002 1006 E004 0806 C008"
- $"0406 E010 0202 C020 0102 C040 0080 8080"
- $"0041 0100 0021 0200 0011 0400 0009 0800"
- $"0004 1000 0002 2000 0001 4000 0000 8000"
- $"0001 0000 0003 8000 0007 F000 000F F000"
- $"001F F000 003F F800 007F FC00 00FF FE00"
- $"01FF FF00 03FF FF80 07FF FFC0 0FFF FFE0"
- $"1FFF FFF0 3FFF FFF8 7FFF FFFC FFFF FFFE"
- $"7FFF FFFF 3FFF FFFE 1FFF FFFC 0FFF FFF8"
- $"07FF FFF0 03FF FFE0 01FF FFC0 00FF FF80"
- $"007F FF00 003F FE00 001F FC00 000F F800"
- $"0007 F000 0003 E000 0001 C000 0000 8000"
-};
-
-data 'ics#' (TK_APP_RESOURCES, "Tk App", purgeable) {
- $"01C0 0260 04E0 09D0 1388 23C4 43C2 8281"
- $"8282 4284 2188 1190 0920 0540 0280 0100"
- $"01C0 03E0 07E0 0FF0 1FF8 3FFC 7FFE FFFF"
- $"FFFE 7FFC 3FF8 1FF0 0FE0 07C0 0380 0100"
-};
-
-data 'ics4' (TK_APP_RESOURCES, "Tk App", purgeable) {
- $"0000 000F C000 0000 0000 00FC 6600 0000"
- $"0000 0FCC 6600 0000 0000 FCC6 66F0 0000"
- $"000F CCD5 56CF 0000 00FC CC66 57CC F000"
- $"0FCC CC65 56CC CF00 FCCC CC56 57CC CCF0"
- $"0FCC CCC6 6CCC CCCF 00FC CCC6 5CCC CCF0"
- $"000F CCC6 6CCC CF00 0000 FCCC 5CCC F000"
- $"0000 0FCC CCCF 0000 0000 00FC CCF0 0000"
- $"0000 000F CF00 0000 0000 0000 F000 0000"
-};
-
-/*
- * The following resource is used when creating the 'env' variable in
- * the Macintosh environment. The creation mechanisim looks for the
- * 'STR#' resource named "Tcl Environment Variables" rather than a
- * specific resource number. (In other words, feel free to change the
- * resource id if it conflicts with your application.) Each string in
- * the resource must be of the form "KEYWORD=SOME STRING". See Tcl
- * documentation for futher information about the env variable.
- */
-
-/* A good example of something you may want to set is:
- * "TCL_LIBRARY=My disk:etc."
- */
-
-resource 'STR#' (128, "Tcl Environment Variables") {
- {
- /*
- "SCHEDULE_NAME=Agent Controller Schedule",
- "SCHEDULE_PATH=Lozoya:System Folder:Tcl Lib:Tcl-Scheduler"
- */
- };
-};
-
-data 'alis' (1000, "Library Folder") {
- $"0000 0000 00BA 0002 0001 012F 0000 0000" /* .....†...../.... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 985C FB00 4244 0000 0000" /* ......ò\š.BD.... */
- $"0002 1328 5375 7070 6F72 7420 4C69 6272" /* ...(Support Libr */
- $"6172 6965 7329 0000 0000 0000 0000 0000" /* aries).......... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0076 8504 B617 A796 003D 0027 025B" /* ...vÖ..ßñ.=.'.[ */
- $"01E4 0001 0001 0000 0000 0000 0000 0000" /* .”.............. */
- $"0000 0000 0000 0000 0001 2F00 0002 0015" /* ........../..... */
- $"2F3A 2853 7570 706F 7274 204C 6962 7261" /* /:(Support Libra */
- $"7269 6573 2900 FFFF 0000" /* ries)... */
-};
-
diff --git a/mac/tkMacBitmap.c b/mac/tkMacBitmap.c
deleted file mode 100644
index 7149288..0000000
--- a/mac/tkMacBitmap.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * tkMacBitmap.c --
- *
- * This file handles the implementation of native bitmaps.
- *
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkPort.h"
-#include "tk.h"
-#include "tkMacInt.h"
-
-#include <Icons.h>
-#include <Dialogs.h>
-#include <Resources.h>
-#include <Strings.h>
-
-/*
- * Depending on the resource type there are different ways to
- * draw native icons.
- */
-#define TYPE1 0 /* Family icon suite. */
-#define TYPE2 1 /* ICON resource. */
-#define TYPE3 2 /* cicn resource. */
-
-/*
- * This data structure describes the id and type of a given icon.
- * It is used as the source for native icons.
- */
-typedef struct {
- int id; /* Resource Id for Icon. */
- long int type; /* Type of icon. */
-} NativeIcon;
-
-/*
- * This structure holds information about native bitmaps.
- */
-
-typedef struct {
- char *name; /* Name of icon. */
- long int type; /* Type of icon. */
- int id; /* Id of icon. */
- int size; /* Size of icon. */
-} BuiltInIcon;
-
-/*
- * This array mapps a string name to the supported builtin icons
- * on the Macintosh.
- */
-
-static BuiltInIcon builtInIcons[] = {
- {"document", TYPE1, kGenericDocumentIconResource, 32},
- {"stationery", TYPE1, kGenericStationeryIconResource, 32},
- {"edition", TYPE1, kGenericEditionFileIconResource, 32},
- {"application", TYPE1, kGenericApplicationIconResource, 32},
- {"accessory", TYPE1, kGenericDeskAccessoryIconResource, 32},
- {"folder", TYPE1, kGenericFolderIconResource, 32},
- {"pfolder", TYPE1, kPrivateFolderIconResource, 32},
- {"trash", TYPE1, kTrashIconResource, 32},
- {"floppy", TYPE1, kFloppyIconResource, 32},
- {"ramdisk", TYPE1, kGenericRAMDiskIconResource, 32},
- {"cdrom", TYPE1, kGenericCDROMIconResource, 32},
- {"preferences", TYPE1, kGenericPreferencesIconResource, 32},
- {"querydoc", TYPE1, kGenericQueryDocumentIconResource, 32},
- {"stop", TYPE2, kStopIcon, 32},
- {"note", TYPE2, kNoteIcon, 32},
- {"caution", TYPE2, kCautionIcon, 32},
- {(char *) NULL, 0, 0, 0}
-};
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDefineNativeBitmaps --
- *
- * Add native bitmaps.
- *
- * Results:
- * A standard Tcl result. If an error occurs then TCL_ERROR is
- * returned and a message is left in the interp's result.
- *
- * Side effects:
- * "Name" is entered into the bitmap table and may be used from
- * here on to refer to the given bitmap.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDefineNativeBitmaps()
-{
- int new;
- Tcl_HashEntry *predefHashPtr;
- TkPredefBitmap *predefPtr;
- CONST char * name;
- BuiltInIcon *builtInPtr;
- NativeIcon *nativeIconPtr;
- Tcl_HashTable *tablePtr;
-
- for (builtInPtr = builtInIcons; builtInPtr->name != NULL; builtInPtr++) {
- name = Tk_GetUid(builtInPtr->name);
- tablePtr = TkGetBitmapPredefTable();
- predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &new);
- if (!new) {
- continue;
- }
- predefPtr = (TkPredefBitmap *) ckalloc(sizeof(TkPredefBitmap));
- nativeIconPtr = (NativeIcon *) ckalloc(sizeof(NativeIcon));
- nativeIconPtr->id = builtInPtr->id;
- nativeIconPtr->type = builtInPtr->type;
- predefPtr->source = (char *) nativeIconPtr;
- predefPtr->width = builtInPtr->size;
- predefPtr->height = builtInPtr->size;
- predefPtr->native = 1;
- Tcl_SetHashValue(predefHashPtr, predefPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpCreateNativeBitmap --
- *
- * Add native bitmaps.
- *
- * Results:
- * A standard Tcl result. If an error occurs then TCL_ERROR is
- * returned and a message is left in the interp's result.
- *
- * Side effects:
- * "Name" is entered into the bitmap table and may be used from
- * here on to refer to the given bitmap.
- *
- *----------------------------------------------------------------------
- */
-
-Pixmap
-TkpCreateNativeBitmap(
- Display *display,
- CONST char * source) /* Info about the icon to build. */
-{
- Pixmap pix;
- GWorldPtr destPort;
- Rect destRect;
- Handle icon;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- NativeIcon *nativeIconPtr;
-
- pix = Tk_GetPixmap(display, None, 32, 32, 0);
- destPort = TkMacGetDrawablePort(pix);
-
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- nativeIconPtr = (NativeIcon *) source;
- SetRect(&destRect, 0, 0, 32, 32);
- if (nativeIconPtr->type == TYPE1) {
- RGBColor white = {0xFFFF, 0xFFFF, 0xFFFF};
-
- RGBForeColor(&white);
- PaintRect(&destRect);
- PlotIconID(&destRect, atAbsoluteCenter, ttNone, nativeIconPtr->id);
- } else if (nativeIconPtr->type == TYPE2) {
- icon = GetIcon(nativeIconPtr->id);
- if (icon != NULL) {
- RGBColor black = {0, 0, 0};
-
- RGBForeColor(&black);
- PlotIcon(&destRect, icon);
- ReleaseResource(icon);
- }
- }
-
- SetGWorld(saveWorld, saveDevice);
- return pix;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetNativeAppBitmap --
- *
- * Add native bitmaps.
- *
- * Results:
- * A standard Tcl result. If an error occurs then TCL_ERROR is
- * returned and a message is left in the interp's result.
- *
- * Side effects:
- * "Name" is entered into the bitmap table and may be used from
- * here on to refer to the given bitmap.
- *
- *----------------------------------------------------------------------
- */
-
-Pixmap
-TkpGetNativeAppBitmap(
- Display *display, /* The display. */
- CONST char *name, /* The name of the bitmap. */
- int *width, /* The width & height of the bitmap. */
- int *height)
-{
- Pixmap pix;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- Rect destRect;
- Handle resource;
- int type, destWrote;
- Str255 nativeName;
-
- /*
- * macRoman is the encoding that the resource fork uses.
- */
-
- Tcl_UtfToExternal(NULL, Tcl_GetEncoding(NULL, "macRoman"), name,
- strlen(name), 0, NULL,
- (char *) &nativeName[1],
- 255, NULL, &destWrote, NULL); /* Internalize native */
- nativeName[0] = destWrote;
-
- resource = GetNamedResource('cicn', nativeName);
- if (resource != NULL) {
- type = TYPE3;
- } else {
- resource = GetNamedResource('ICON', nativeName);
- if (resource != NULL) {
- type = TYPE2;
- }
- }
-
- if (resource == NULL) {
- return NULL;
- }
-
- pix = Tk_GetPixmap(display, None, 32, 32, 0);
- destPort = TkMacGetDrawablePort(pix);
-
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- SetRect(&destRect, 0, 0, 32, 32);
- if (type == TYPE2) {
- RGBColor black = {0, 0, 0};
-
- RGBForeColor(&black);
- PlotIcon(&destRect, resource);
- ReleaseResource(resource);
- } else if (type == TYPE3) {
- RGBColor white = {0xFFFF, 0xFFFF, 0xFFFF};
- short id;
- ResType theType;
- Str255 dummy;
-
- /*
- * We need to first paint the background white. Also, for
- * some reason we *must* use GetCIcon instead of GetNamedResource
- * for PlotCIcon to work - so we use GetResInfo to get the id.
- */
- RGBForeColor(&white);
- PaintRect(&destRect);
- GetResInfo(resource, &id, &theType, dummy);
- ReleaseResource(resource);
- resource = (Handle) GetCIcon(id);
- PlotCIcon(&destRect, (CIconHandle) resource);
- DisposeCIcon((CIconHandle) resource);
- }
-
- *width = 32;
- *height = 32;
- SetGWorld(saveWorld, saveDevice);
- return pix;
-}
diff --git a/mac/tkMacButton.c b/mac/tkMacButton.c
deleted file mode 100644
index 887d813..0000000
--- a/mac/tkMacButton.c
+++ /dev/null
@@ -1,1709 +0,0 @@
-/*
- * tkMacButton.c --
- *
- * This file implements the Macintosh specific portion of the
- * button widgets.
- *
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkButton.h"
-#include "tkMacInt.h"
-#include <Controls.h>
-#include <ControlDefinitions.h>
-#include <LowMem.h>
-#include <Appearance.h>
-
-
-#include <ToolUtils.h>
-
-/*
- * Some defines used to control what type of control is drawn.
- */
-
-#define DRAW_LABEL 0 /* Labels are treated genericly. */
-#define DRAW_CONTROL 1 /* Draw using the Native control. */
-#define DRAW_CUSTOM 2 /* Make our own button drawing. */
-#define DRAW_BEVEL 3
-
-/*
- * The following structures are used to draw our controls. Rather than
- * having many Mac controls we just use one control of each type and
- * reuse them for all Tk widgets. When the windowRef variable is NULL
- * it means none of the data structures have been allocated.
- */
-
-static WindowRef windowRef = NULL;
-static CWindowRecord windowRecord;
-static ControlRef buttonHandle;
-static ControlRef checkHandle;
-static ControlRef radioHandle;
-static ControlRef smallBevelHandle;
-static ControlRef smallStickyBevelHandle;
-static ControlRef medBevelHandle;
-static ControlRef medStickyBevelHandle;
-static ControlRef largeBevelHandle;
-static ControlRef largeStickyBevelHandle;
-
-/*
- * These are used to store the image content for
- * beveled buttons - i.e. buttons with images.
- */
-
-static ControlButtonContentInfo bevelButtonContent;
-static OpenCPicParams picParams;
-
-static CCTabHandle buttonTabHandle;
-static CCTabHandle checkTabHandle;
-static CCTabHandle radioTabHandle;
-static PixMapHandle oldPixPtr;
-
-/*
- * These functions are used when Appearance is present.
- * By embedding all our controls in a userPane control,
- * we can color the background of the text in radiobuttons
- * and checkbuttons. Thanks to Peter Gontier of Apple DTS
- * for help on this one.
- */
-
-static ControlRef userPaneHandle;
-static RGBColor gUserPaneBackground = { ~0, ~0, ~0};
-static pascal OSErr SetUserPaneDrawProc(ControlRef control,
- ControlUserPaneDrawProcPtr upp);
-static pascal OSErr SetUserPaneSetUpSpecialBackgroundProc(ControlRef control,
- ControlUserPaneBackgroundProcPtr upp);
-static pascal void UserPaneDraw(ControlRef control, ControlPartCode cpc);
-static pascal void UserPaneBackgroundProc(ControlHandle,
- ControlBackgroundPtr info);
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static void ButtonEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static int UpdateControlColors _ANSI_ARGS_((TkButton *butPtr,
- ControlRef controlHandle, CCTabHandle ccTabHandle,
- RGBColor *saveColorPtr));
-static void DrawBufferedControl _ANSI_ARGS_((TkButton *butPtr,
- GWorldPtr destPort, GC gc, Pixmap pixmap));
-static void InitSampleControls();
-static void SetupBevelButton _ANSI_ARGS_((TkButton *butPtr,
- ControlRef controlHandle,
- GWorldPtr destPort, GC gc, Pixmap pixmap));
-static void ChangeBackgroundWindowColor _ANSI_ARGS_((
- WindowRef macintoshWindow, RGBColor rgbColor,
- RGBColor *oldColor));
-static void ButtonExitProc _ANSI_ARGS_((ClientData clientData));
-
-/*
- * The class procedure table for the button widgets.
- */
-
-Tk_ClassProcs tkpButtonProcs = {
- sizeof(Tk_ClassProcs), /* size */
- TkButtonWorldChanged, /* worldChangedProc */
-};
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpCreateButton --
- *
- * Allocate a new TkButton structure.
- *
- * Results:
- * Returns a newly allocated TkButton structure.
- *
- * Side effects:
- * Registers an event handler for the widget.
- *
- *----------------------------------------------------------------------
- */
-
-TkButton *
-TkpCreateButton(
- Tk_Window tkwin)
-{
- TkButton *buttonPtr;
- buttonPtr = (TkButton *) ckalloc(sizeof(TkButton));
- Tk_CreateEventHandler(tkwin, ActivateMask,
- ButtonEventProc, (ClientData) buttonPtr);
- return buttonPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDisplayButton --
- *
- * This procedure is invoked to display a button widget. It is
- * normally invoked as an idle handler.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the button in its
- * current mode. The REDRAW_PENDING flag is cleared.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDisplayButton(
- ClientData clientData) /* Information about widget. */
-{
- TkButton *butPtr = (TkButton *) clientData;
- Pixmap pixmap;
- GC gc;
- Tk_3DBorder border;
- int x = 0; /* Initialization only needed to stop
- * compiler warning. */
- int y, relief;
- register Tk_Window tkwin = butPtr->tkwin;
- int width, height, fullWidth, fullHeight;
- int textXOffset, textYOffset;
- int haveImage = 0, haveText = 0;
- int offset; /* 0 means this is a normal widget. 1 means
- * it is an image button, so we offset the
- * image to make the button appear to move
- * up and down as the relief changes. */
- int hasImageOrBitmap;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- int drawType, borderWidth;
- int imageWidth, imageHeight;
- int imageXOffset = 0, imageYOffset = 0; /* image information that will
- * be used to restrict disabled
- * pixmap as well */
-
- GetGWorld(&saveWorld, &saveDevice);
-
- butPtr->flags &= ~REDRAW_PENDING;
- if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
- return;
- }
-
- /*
- * In order to avoid screen flashes, this procedure redraws
- * the button in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
- */
-
- pixmap = Tk_GetPixmap(butPtr->display, Tk_WindowId(tkwin),
- Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
-
- hasImageOrBitmap = ((butPtr->image != NULL) || (butPtr->bitmap != None));
- offset = (butPtr->type == TYPE_BUTTON) && hasImageOrBitmap;
-
- border = butPtr->normalBorder;
- if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) {
- gc = butPtr->disabledGC;
- } else if ((butPtr->type == TYPE_BUTTON)
- && (butPtr->state == STATE_ACTIVE)) {
- gc = butPtr->activeTextGC;
- border = butPtr->activeBorder;
- } else {
- gc = butPtr->normalTextGC;
- }
-
- if ((butPtr->flags & SELECTED) && (butPtr->state != STATE_ACTIVE)
- && (butPtr->selectBorder != NULL) && !butPtr->indicatorOn) {
- border = butPtr->selectBorder;
- }
-
- /*
- * Override the relief specified for the button if this is a
- * checkbutton or radiobutton and there's no indicator.
- * However, don't do this in the presence of Appearance, since
- * then the bevel button will take care of the relief.
- */
-
- relief = butPtr->relief;
-
- if ((butPtr->type >= TYPE_CHECK_BUTTON) && !butPtr->indicatorOn) {
- if (!TkMacHaveAppearance() || !hasImageOrBitmap) {
- if (butPtr->flags & SELECTED) {
- relief = TK_RELIEF_SUNKEN;
- } else if (butPtr->overRelief != relief) {
- relief = butPtr->offRelief;
- }
- }
- }
-
- /*
- * See the comment in UpdateControlColors as to why we use the
- * highlightbackground for the border of Macintosh buttons.
- */
-
- if (butPtr->type == TYPE_BUTTON) {
- Tk_Fill3DRectangle(tkwin, pixmap, butPtr->highlightBorder, 0, 0,
- Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
- } else {
- Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0,
- Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
- }
-
- if (butPtr->type == TYPE_LABEL) {
- drawType = DRAW_LABEL;
- } else if (butPtr->type == TYPE_BUTTON) {
- if (!hasImageOrBitmap) {
- drawType = DRAW_CONTROL;
- } else if (butPtr->image != None) {
- drawType = DRAW_BEVEL;
- } else {
- /*
- * TO DO - The current way the we draw bitmaps (XCopyPlane)
- * uses CopyDeepMask in this one case. The Picture recording
- * does not record this call, and so we can't use the
- * Appearance bevel button here. The only case that would
- * exercise this is if you use a bitmap, with
- * -data & -mask specified. We should probably draw the
- * appearance button and overprint the image in this case.
- * This just punts and draws the old-style, ugly, button.
- */
-
- if (gc->clip_mask == 0) {
- drawType = DRAW_BEVEL;
- } else {
- TkpClipMask *clipPtr = (TkpClipMask*) gc->clip_mask;
- if ((clipPtr->type == TKP_CLIP_PIXMAP) &&
- (clipPtr->value.pixmap != butPtr->bitmap)) {
- drawType = DRAW_CUSTOM;
- } else {
- drawType = DRAW_BEVEL;
- }
- }
- }
- } else {
- if (butPtr->indicatorOn) {
- drawType = DRAW_CONTROL;
- } else if (hasImageOrBitmap) {
- if (gc->clip_mask == 0) {
- drawType = DRAW_BEVEL;
- } else {
- TkpClipMask *clipPtr = (TkpClipMask*) gc->clip_mask;
- if ((clipPtr->type == TKP_CLIP_PIXMAP) &&
- (clipPtr->value.pixmap != butPtr->bitmap)) {
- drawType = DRAW_CUSTOM;
- } else {
- drawType = DRAW_BEVEL;
- }
- }
- } else {
- drawType = DRAW_CUSTOM;
- }
- }
-
- /*
- * Draw the native portion of the buttons. Start by creating the control
- * if it doesn't already exist. Then configure the Macintosh control from
- * the Tk info. Finally, we call Draw1Control to draw to the screen.
- */
-
- if ((drawType == DRAW_CONTROL) ||
- ((drawType == DRAW_BEVEL) && TkMacHaveAppearance())) {
- borderWidth = 0;
-
- /*
- * This part uses Macintosh rather than Tk calls to draw
- * to the screen. Make sure the ports etc. are set correctly.
- */
-
- destPort = TkMacGetDrawablePort(pixmap);
- SetGWorld(destPort, NULL);
- DrawBufferedControl(butPtr, destPort, gc, pixmap);
- }
-
- if ((drawType == DRAW_CUSTOM) || (drawType == DRAW_LABEL)) {
- borderWidth = butPtr->borderWidth;
- }
-
- /*
- * Display image or bitmap or text for button. This has
- * already been done under Appearance with the Bevel
- * button types.
- */
-
- if ((drawType == DRAW_BEVEL) && TkMacHaveAppearance()) {
- /* Empty Body */
- } else {
- if (butPtr->image != None) {
- Tk_SizeOfImage(butPtr->image, &width, &height);
- haveImage = 1;
- } else if (butPtr->bitmap != None) {
- Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
- haveImage = 1;
- }
- imageWidth = width;
- imageHeight = height;
-
- haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
- if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- textXOffset = 0;
- textYOffset = 0;
- fullWidth = 0;
- fullHeight = 0;
-
- switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (butPtr->compound == COMPOUND_TOP) {
- textYOffset = height + butPtr->padY;
- } else {
- imageYOffset = butPtr->textHeight + butPtr->padY;
- }
- fullHeight = height + butPtr->textHeight + butPtr->padY;
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- if (butPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + butPtr->padX;
- } else {
- imageXOffset = butPtr->textWidth + butPtr->padX;
- }
- fullWidth = butPtr->textWidth + butPtr->padX + width;
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_NONE: {break;}
- }
-
- TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
- butPtr->indicatorSpace + fullWidth, fullHeight, &x, &y);
-
- x += butPtr->indicatorSpace;
-
- x += offset;
- y += offset;
- if (relief == TK_RELIEF_RAISED) {
- x -= offset;
- y -= offset;
- } else if (relief == TK_RELIEF_SUNKEN) {
- x += offset;
- y += offset;
- }
- imageXOffset += x;
- imageYOffset += y;
- if (butPtr->image != NULL) {
- if ((butPtr->selectImage != NULL) &&
- (butPtr->flags & SELECTED)) {
- Tk_RedrawImage(butPtr->selectImage, 0, 0,
- width, height, pixmap, imageXOffset, imageYOffset);
- } else {
- Tk_RedrawImage(butPtr->image, 0, 0, width,
- height, pixmap, imageXOffset, imageYOffset);
- }
- } else {
- XSetClipOrigin(butPtr->display, gc,
- imageXOffset, imageYOffset);
- XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, gc,
- 0, 0, (unsigned int) width, (unsigned int) height,
- imageXOffset, imageYOffset, 1);
- XSetClipOrigin(butPtr->display, gc, 0, 0);
- }
-
- Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout,
- x + textXOffset, y + textYOffset, 0, -1);
- Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,
- butPtr->textLayout, x + textXOffset, y + textYOffset,
- butPtr->underline);
- y += fullHeight/2;
- } else {
- if (haveImage) {
- TkComputeAnchor(butPtr->anchor, tkwin, 0, 0,
- butPtr->indicatorSpace + width, height, &x, &y);
- x += butPtr->indicatorSpace;
-
- x += offset;
- y += offset;
- if (relief == TK_RELIEF_RAISED) {
- x -= offset;
- y -= offset;
- } else if (relief == TK_RELIEF_SUNKEN) {
- x += offset;
- y += offset;
- }
- imageXOffset += x;
- imageYOffset += y;
- if (butPtr->image != NULL) {
- if ((butPtr->selectImage != NULL) &&
- (butPtr->flags & SELECTED)) {
- Tk_RedrawImage(butPtr->selectImage, 0, 0, width,
- height, pixmap, imageXOffset, imageYOffset);
- } else {
- Tk_RedrawImage(butPtr->image, 0, 0, width, height,
- pixmap, imageXOffset, imageYOffset);
- }
- } else {
- XSetClipOrigin(butPtr->display, gc, x, y);
- XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, gc,
- 0, 0, (unsigned int) width,
- (unsigned int) height, x, y, 1);
- XSetClipOrigin(butPtr->display, gc, 0, 0);
- }
- y += height/2;
- } else {
- TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX,
- butPtr->padY,
- butPtr->indicatorSpace + butPtr->textWidth,
- butPtr->textHeight, &x, &y);
-
- x += butPtr->indicatorSpace;
-
- Tk_DrawTextLayout(butPtr->display, pixmap, gc,
- butPtr->textLayout, x, y, 0, -1);
- y += butPtr->textHeight/2;
- }
- }
- }
-
- /*
- * If the button is disabled with a stipple rather than a special
- * foreground color, generate the stippled effect. If the widget
- * is selected and we use a different background color when selected,
- * must temporarily modify the GC so the stippling is the right color.
- */
-
- if ((butPtr->state == STATE_DISABLED)
- && ((butPtr->disabledFg == NULL) || (butPtr->image != NULL))) {
- if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn
- && (butPtr->selectBorder != NULL)) {
- XSetForeground(butPtr->display, butPtr->stippleGC,
- Tk_3DBorderColor(butPtr->selectBorder)->pixel);
- }
- /*
- * Stipple the whole button if no disabledFg was specified,
- * otherwise restrict stippling only to displayed image
- */
- if (butPtr->disabledFg == NULL) {
- XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, 0, 0,
- (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin));
- } else {
- XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC,
- imageXOffset, imageYOffset,
- (unsigned) imageWidth, (unsigned) imageHeight);
- }
- if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn
- && (butPtr->selectBorder != NULL)) {
- XSetForeground(butPtr->display, butPtr->stippleGC,
- Tk_3DBorderColor(butPtr->normalBorder)->pixel);
- }
- }
-
- /*
- * Draw the border and traversal highlight last. This way, if the
- * button's contents overflow they'll be covered up by the border.
- */
-
- if (relief != TK_RELIEF_FLAT) {
- int inset = butPtr->highlightWidth;
- Tk_Draw3DRectangle(tkwin, pixmap, border, inset, inset,
- Tk_Width(tkwin) - 2*inset, Tk_Height(tkwin) - 2*inset,
- butPtr->borderWidth, relief);
- }
-
- /*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
- */
-
- XCopyArea(butPtr->display, pixmap, Tk_WindowId(tkwin),
- butPtr->copyGC, 0, 0, (unsigned) Tk_Width(tkwin),
- (unsigned) Tk_Height(tkwin), 0, 0);
- Tk_FreePixmap(butPtr->display, pixmap);
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpComputeButtonGeometry --
- *
- * After changes in a button's text or bitmap, this procedure
- * recomputes the button's geometry and passes this information
- * along to the geometry manager for the window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The button's window may change size.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpComputeButtonGeometry(
- TkButton *butPtr) /* Button whose geometry may have changed. */
-{
- int width, height, avgWidth, haveImage = 0, haveText = 0;
- int txtWidth, txtHeight;
- Tk_FontMetrics fm;
-
- width = 0;
- height = 0;
- txtWidth = 0;
- txtHeight = 0;
- avgWidth = 0;
-
- /*
- * First figure out the size of the contents of the button.
- */
-
- butPtr->indicatorSpace = 0;
- if (butPtr->image != NULL) {
- Tk_SizeOfImage(butPtr->image, &width, &height);
- haveImage = 1;
- } else if (butPtr->bitmap != None) {
- Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
- haveImage = 1;
- }
-
- if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) {
- Tk_FreeTextLayout(butPtr->textLayout);
- butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
- butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
-
- txtWidth = butPtr->textWidth;
- txtHeight = butPtr->textHeight;
- avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1);
- Tk_GetFontMetrics(butPtr->tkfont, &fm);
- haveText = (txtWidth != 0 && txtHeight != 0);
- }
-
- /*
- * If the button is compound (ie, it shows both an image and text),
- * the new geometry is a combination of the image and text geometry.
- * We only honor the compound bit if the button has both text and an
- * image, because otherwise it is not really a compound button.
- */
-
- if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- height += txtHeight + butPtr->padY;
- width = (width > txtWidth ? width : txtWidth);
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- width += txtWidth + butPtr->padX;
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- width = (width > txtWidth ? width : txtWidth);
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_NONE: {break;}
- }
- if (butPtr->width > 0) {
- width = butPtr->width;
- }
- if (butPtr->height > 0) {
- height = butPtr->height;
- }
-
- if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
- butPtr->indicatorSpace = height;
- if (butPtr->type == TYPE_CHECK_BUTTON) {
- butPtr->indicatorDiameter = (65*height)/100;
- } else {
- butPtr->indicatorDiameter = (75*height)/100;
- }
- }
-
- width += 2*butPtr->padX;
- height += 2*butPtr->padY;
-
- } else {
- if (haveImage) {
- if (butPtr->width > 0) {
- width = butPtr->width;
- }
- if (butPtr->height > 0) {
- height = butPtr->height;
- }
- if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
- butPtr->indicatorSpace = height;
- if (butPtr->type == TYPE_CHECK_BUTTON) {
- butPtr->indicatorDiameter = (65*height)/100;
- } else {
- butPtr->indicatorDiameter = (75*height)/100;
- }
- }
- } else {
- width = txtWidth;
- height = txtHeight;
- if (butPtr->width > 0) {
- width = butPtr->width * avgWidth;
- }
- if (butPtr->height > 0) {
- height = butPtr->height * fm.linespace;
- }
- if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
- butPtr->indicatorDiameter = fm.linespace;
- if (butPtr->type == TYPE_CHECK_BUTTON) {
- butPtr->indicatorDiameter =
- (80*butPtr->indicatorDiameter)/100;
- }
- butPtr->indicatorSpace = butPtr->indicatorDiameter + avgWidth;
- }
- }
- }
-
- /*
- * Now figure out the size of the border decorations for the button.
- */
-
- if (butPtr->highlightWidth < 0) {
- butPtr->highlightWidth = 0;
- }
-
- /*
- * The width and height calculation for Appearance buttons with images &
- * non-Appearance buttons with images is different. In the latter case,
- * we add the borderwidth to the inset, since we are going to stamp a
- * 3-D border over the image. In the former, we add it to the height,
- * directly, since Appearance will draw the border as part of our control.
- *
- * When issuing the geometry request, add extra space for the indicator,
- * if any, and for the border and padding, plus if this is an image two
- * extra pixels so the display can be offset by 1 pixel in either
- * direction for the raised or lowered effect.
- *
- * The highlight width corresponds to the default ring on the Macintosh.
- * As such, the highlight width is only added if the button is the default
- * button. The actual width of the default ring is one less than the
- * highlight width as there is also one pixel of spacing.
- * Appearance buttons with images do not have a highlight ring, because the
- * Bevel button type does not support one.
- */
-
- if ((butPtr->image == None) && (butPtr->bitmap == None)) {
- width += 2*butPtr->padX;
- height += 2*butPtr->padY;
- }
-
- if ((butPtr->type == TYPE_BUTTON)) {
- if ((butPtr->image == None) && (butPtr->bitmap == None)) {
- butPtr->inset = 0;
- if (butPtr->defaultState != STATE_DISABLED) {
- butPtr->inset += butPtr->highlightWidth;
- }
- } else if (TkMacHaveAppearance()) {
- butPtr->inset = 0;
- width += (2 * butPtr->borderWidth + 4);
- height += (2 * butPtr->borderWidth + 4);
- } else {
- butPtr->inset = butPtr->borderWidth;
- width += 2;
- height += 2;
- if (butPtr->defaultState != STATE_DISABLED) {
- butPtr->inset += butPtr->highlightWidth;
- }
- }
- } else if ((butPtr->type != TYPE_LABEL)) {
- if (butPtr->indicatorOn) {
- butPtr->inset = 0;
- } else {
- /*
- * Under Appearance, the Checkbutton or radiobutton with an image
- * is represented by a BevelButton with the Sticky defProc...
- * So we must set its height in the same way as the Button
- * with an image or bitmap.
- */
- if (((butPtr->image != None) || (butPtr->bitmap != None))
- && TkMacHaveAppearance()) {
- int border;
- butPtr->inset = 0;
- if ( butPtr->borderWidth <= 2 ) {
- border = 6;
- } else {
- border = 2 * butPtr->borderWidth + 2;
- }
- width += border;
- height += border;
- } else {
- butPtr->inset = butPtr->borderWidth;
- }
- }
- } else {
- butPtr->inset = butPtr->borderWidth;
- }
-
-
-
- Tk_GeometryRequest(butPtr->tkwin, (int) (width + butPtr->indicatorSpace
- + 2*butPtr->inset), (int) (height + 2*butPtr->inset));
- Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDestroyButton --
- *
- * Free data structures associated with the button control.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Restores the default control state.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDestroyButton(
- TkButton *butPtr)
-{
- /* Do nothing. */
-}
-
-/*
- *--------------------------------------------------------------
- *
- * DrawBufferedControl --
- *
- * This function uses a dummy Macintosh window to allow
- * drawing Mac controls to any GWorld (including off-screen
- * bitmaps). In addition, this code may apply custom
- * colors passed in the TkButton.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Control is to the GWorld. Static state created on
- * first invocation of this routine.
- *
- *--------------------------------------------------------------
- */
-
-static void
-DrawBufferedControl(
- TkButton *butPtr, /* Tk button. */
- GWorldPtr destPort, /* Off screen GWorld. */
- GC gc, /* The GC we are drawing into - needed for
- * the bevel button */
- Pixmap pixmap /* The pixmap we are drawing into - needed
- for the bevel button */
- )
-{
- ControlRef controlHandle;
- CCTabHandle ccTabHandle;
- int windowColorChanged = false;
- RGBColor saveBackColor;
- int isBevel = 0;
-
- if (windowRef == NULL) {
- InitSampleControls();
- }
-
- /*
- * Now swap in the passed in GWorld for the portBits of our fake
- * window. We also adjust various fields in the WindowRecord to make
- * the system think this is a normal window.
- * Note, we can use DrawControlInCurrentPort under Appearance, so we don't
- * need to swap pixmaps.
- */
-
- if (!TkMacHaveAppearance()) {
- ((CWindowPeek) windowRef)->port.portPixMap = destPort->portPixMap;
- }
-
- ((CWindowPeek) windowRef)->port.portRect = destPort->portRect;
- RectRgn(((CWindowPeek) windowRef)->port.visRgn, &destPort->portRect);
- RectRgn(((CWindowPeek) windowRef)->strucRgn, &destPort->portRect);
- RectRgn(((CWindowPeek) windowRef)->updateRgn, &destPort->portRect);
- RectRgn(((CWindowPeek) windowRef)->contRgn, &destPort->portRect);
- PortChanged(windowRef);
-
- /*
- * Set up control in hidden window to match what we need
- * to draw in the buffered window.
- */
-
- isBevel = 0;
- switch (butPtr->type) {
- case TYPE_BUTTON:
- if (TkMacHaveAppearance()) {
- if ((butPtr->image == None) && (butPtr->bitmap == None)) {
- controlHandle = buttonHandle;
- ccTabHandle = buttonTabHandle;
- } else {
- if (butPtr->borderWidth <= 2) {
- controlHandle = smallBevelHandle;
- } else if (butPtr->borderWidth == 3) {
- controlHandle = medBevelHandle;
- } else {
- controlHandle = largeBevelHandle;
- }
- ccTabHandle = buttonTabHandle;
- SetupBevelButton(butPtr, controlHandle, destPort,
- gc, pixmap);
- isBevel = 1;
- }
- } else {
- controlHandle = buttonHandle;
- ccTabHandle = buttonTabHandle;
- }
- break;
- case TYPE_RADIO_BUTTON:
- if (TkMacHaveAppearance()) {
- if (((butPtr->image == None) && (butPtr->bitmap == None))
- || (butPtr->indicatorOn)) {
- controlHandle = radioHandle;
- ccTabHandle = radioTabHandle;
- } else {
- if (butPtr->borderWidth <= 2) {
- controlHandle = smallStickyBevelHandle;
- } else if (butPtr->borderWidth == 3) {
- controlHandle = medStickyBevelHandle;
- } else {
- controlHandle = largeStickyBevelHandle;
- }
- ccTabHandle = radioTabHandle;
- SetupBevelButton(butPtr, controlHandle, destPort,
- gc, pixmap);
- isBevel = 1;
- }
- } else {
- controlHandle = radioHandle;
- ccTabHandle = radioTabHandle;
- }
- break;
- case TYPE_CHECK_BUTTON:
- if (TkMacHaveAppearance()) {
- if (((butPtr->image == None) && (butPtr->bitmap == None))
- || (butPtr->indicatorOn)) {
- controlHandle = checkHandle;
- ccTabHandle = checkTabHandle;
- } else {
- if (butPtr->borderWidth <= 2) {
- controlHandle = smallStickyBevelHandle;
- } else if (butPtr->borderWidth == 3) {
- controlHandle = medStickyBevelHandle;
- } else {
- controlHandle = largeStickyBevelHandle;
- }
- ccTabHandle = checkTabHandle;
- SetupBevelButton(butPtr, controlHandle, destPort,
- gc, pixmap);
- isBevel = 1;
- }
- } else {
- controlHandle = checkHandle;
- ccTabHandle = checkTabHandle;
- }
- break;
- }
-
- (**controlHandle).contrlRect.left = butPtr->inset;
- (**controlHandle).contrlRect.top = butPtr->inset;
- (**controlHandle).contrlRect.right = Tk_Width(butPtr->tkwin)
- - butPtr->inset;
- (**controlHandle).contrlRect.bottom = Tk_Height(butPtr->tkwin)
- - butPtr->inset;
-
- /*
- * Setting the control visibility by hand does not
- * seem to work under Appearance.
- */
-
- if (TkMacHaveAppearance()) {
- SetControlVisibility(controlHandle, true, false);
- (**userPaneHandle).contrlRect.left = 0;
- (**userPaneHandle).contrlRect.top = 0;
- (**userPaneHandle).contrlRect.right = Tk_Width(butPtr->tkwin);
- (**userPaneHandle).contrlRect.bottom = Tk_Height(butPtr->tkwin);
- } else {
- (**controlHandle).contrlVis = 255;
- }
-
-
-
- if (butPtr->flags & SELECTED) {
- (**controlHandle).contrlValue = 1;
- } else {
- (**controlHandle).contrlValue = 0;
- }
-
- if (!tkMacAppInFront || butPtr->state == STATE_DISABLED) {
- (**controlHandle).contrlHilite = kControlInactivePart;
- } else if (butPtr->state == STATE_ACTIVE) {
- if (isBevel) {
- (**controlHandle).contrlHilite = kControlButtonPart;
- } else {
- switch (butPtr->type) {
- case TYPE_BUTTON:
- (**controlHandle).contrlHilite = kControlButtonPart;
- break;
- case TYPE_RADIO_BUTTON:
- (**controlHandle).contrlHilite = kControlRadioButtonPart;
- break;
- case TYPE_CHECK_BUTTON:
- (**controlHandle).contrlHilite = kControlCheckBoxPart;
- break;
- }
- }
- } else {
- (**controlHandle).contrlHilite = kControlNoPart;
- }
- /*
- * Before we draw the control we must add the hidden window back to the
- * main window list. Otherwise, radiobuttons and checkbuttons will draw
- * incorrectly. I don't really know why - but clearly the control draw
- * proc needs to have the controls window in the window list. This is not
- * necessary under Appearance, and will have to go when we Carbonize Tk...
- */
- if (!TkMacHaveAppearance()) {
- ((CWindowPeek) windowRef)->nextWindow = (CWindowPeek) LMGetWindowList();
- LMSetWindowList(windowRef);
- }
-
- /*
- * Now we can set the port to our doctered up window. We next need
- * to muck with the colors for the port & window to draw the control
- * with the proper Tk colors. If we need to we also draw a default
- * ring for buttons.
- * Under Appearance, we draw the control directly into destPort, and
- * just set the default control data.
- */
-
- if (TkMacHaveAppearance()) {
- SetPort((GrafPort *) destPort);
- } else {
- SetPort(windowRef);
- }
-
- windowColorChanged = UpdateControlColors(butPtr, controlHandle,
- ccTabHandle, &saveBackColor);
-
- if ((butPtr->type == TYPE_BUTTON) && TkMacHaveAppearance()) {
- Boolean isDefault;
-
- if (butPtr->defaultState == STATE_ACTIVE) {
- isDefault = true;
- } else {
- isDefault = false;
- }
- SetControlData(controlHandle, kControlNoPart,
- kControlPushButtonDefaultTag,
- sizeof(isDefault), (Ptr) &isDefault);
- }
-
- if (TkMacHaveAppearance()) {
- DrawControlInCurrentPort(userPaneHandle);
- } else {
- Draw1Control(controlHandle);
- }
-
- if (!TkMacHaveAppearance() &&
- (butPtr->type == TYPE_BUTTON) &&
- (butPtr->defaultState == STATE_ACTIVE)) {
- Rect box = (**controlHandle).contrlRect;
- RGBColor rgbColor;
-
- TkSetMacColor(butPtr->highlightColorPtr->pixel, &rgbColor);
- RGBForeColor(&rgbColor);
- PenSize(butPtr->highlightWidth - 1, butPtr->highlightWidth - 1);
- InsetRect(&box, -butPtr->highlightWidth, -butPtr->highlightWidth);
- FrameRoundRect(&box, 16, 16);
- }
-
- if (windowColorChanged) {
- RGBColor dummyColor;
- ChangeBackgroundWindowColor(windowRef, saveBackColor, &dummyColor);
- }
-
- /*
- * Clean up: remove the hidden window from the main window list, and
- * hide the control we drew.
- */
-
- if (TkMacHaveAppearance()) {
- SetControlVisibility(controlHandle, false, false);
- if (isBevel) {
- KillPicture(bevelButtonContent.u.picture);
- }
- } else {
- (**controlHandle).contrlVis = 0;
- }
- if (!TkMacHaveAppearance()) {
- LMSetWindowList((WindowRef) ((CWindowPeek) windowRef)->nextWindow);
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * InitSampleControls --
- *
- * This function initializes a dummy Macintosh window and
- * sample controls to allow drawing Mac controls to any GWorld
- * (including off-screen bitmaps).
- *
- * Results:
- * None.
- *
- * Side effects:
- * Controls & a window are created.
- *
- *--------------------------------------------------------------
- */
-
-static void
-InitSampleControls()
-{
- Rect geometry = {0, 0, 10, 10};
- CWindowPeek windowList;
- GWorldPtr frontWin = NULL;
- TkMacWindowList *winListPtr;
-
- /*
- * Create a dummy window that we can draw to. We will
- * actually replace this window's bitmap with the one
- * we want to draw to at a later time. This window and
- * the data structures attached to it are only deallocated
- * on exit of the application.
- */
-
- /*
- * This is a bit of a hack... The problem is that under appearance,
- * taking a window out of the window list causes instability, so we can't
- * do that. OTOH, we need to make sure that this window is NEVER the front
- * window, or we may inadvertently send keystrokes to it...
- * So we put it BEHIND ".", and then we won't ever be able to destroy
- * ALL the windows that are above it.
- */
-
- for (winListPtr = tkMacWindowListPtr; winListPtr != NULL;
- winListPtr = winListPtr->nextPtr) {
- frontWin = ((MacDrawable *) tkMacWindowListPtr->winPtr->privatePtr)->portPtr;
- if (strcmp(tkMacWindowListPtr->winPtr->pathName, ".") == 0) {
- break;
- }
- }
-
- windowRef = NewCWindow(NULL, &geometry, "\pempty", false,
- zoomDocProc, (WindowRef) frontWin, true, 0);
- if (windowRef == NULL) {
- panic("Can't allocate buffer window.");
- }
-
- /*
- * Now add the three standard controls to hidden window. We
- * only create one of each and reuse them for every widget in
- * Tk.
- * Under Appearance, we have to embed the controls in a UserPane
- * control, so that we can color the background text in
- * radiobuttons and checkbuttons.
- */
-
- SetPort(windowRef);
-
- if (TkMacHaveAppearance()) {
-
- OSErr err;
- ControlRef dontCare;
-
- /*
- * Adding UserPaneBackgroundProcs to the root control does
- * not seem to work, so we have to add another UserPane to
- * the root control.
- */
-
- err = CreateRootControl(windowRef, &dontCare);
- if (err != noErr) {
- panic("Can't create root control in DrawBufferedControl");
- }
-
- userPaneHandle = NewControl(windowRef, &geometry, "\p",
- true, kControlSupportsEmbedding|kControlHasSpecialBackground,
- 0, 1, kControlUserPaneProc, (SInt32) 0);
- SetUserPaneSetUpSpecialBackgroundProc(userPaneHandle,
- UserPaneBackgroundProc);
- SetUserPaneDrawProc(userPaneHandle, UserPaneDraw);
-
- buttonHandle = NewControl(windowRef, &geometry, "\p",
- false, 1, 0, 1, kControlPushButtonProc, (SInt32) 0);
- EmbedControl(buttonHandle, userPaneHandle);
- checkHandle = NewControl(windowRef, &geometry, "\p",
- false, 1, 0, 1, kControlCheckBoxProc, (SInt32) 0);
- EmbedControl(checkHandle, userPaneHandle);
- radioHandle = NewControl(windowRef, &geometry, "\p",
- false, 1, 0, 1, kControlRadioButtonProc, (SInt32) 0);
- EmbedControl(radioHandle, userPaneHandle);
- smallBevelHandle = NewControl(windowRef, &geometry, "\p",
- false, 0, 0,
- kControlBehaviorOffsetContents << 16
- | kControlContentPictHandle,
- kControlBevelButtonSmallBevelProc, (SInt32) 0);
- EmbedControl(smallBevelHandle, userPaneHandle);
- medBevelHandle = NewControl(windowRef, &geometry, "\p",
- false, 0, 0,
- kControlBehaviorOffsetContents << 16
- | kControlContentPictHandle,
- kControlBevelButtonNormalBevelProc, (SInt32) 0);
- EmbedControl(medBevelHandle, userPaneHandle);
- largeBevelHandle = NewControl(windowRef, &geometry, "\p",
- false, 0, 0,
- kControlBehaviorOffsetContents << 16
- | kControlContentPictHandle,
- kControlBevelButtonLargeBevelProc, (SInt32) 0);
- EmbedControl(largeBevelHandle, userPaneHandle);
- bevelButtonContent.contentType = kControlContentPictHandle;
- smallStickyBevelHandle = NewControl(windowRef, &geometry, "\p",
- false, 0, 0,
- (kControlBehaviorOffsetContents
- | kControlBehaviorSticky) << 16
- | kControlContentPictHandle,
- kControlBevelButtonSmallBevelProc, (SInt32) 0);
- EmbedControl(smallStickyBevelHandle, userPaneHandle);
- medStickyBevelHandle = NewControl(windowRef, &geometry, "\p",
- false, 0, 0,
- (kControlBehaviorOffsetContents
- | kControlBehaviorSticky) << 16
- | kControlContentPictHandle,
- kControlBevelButtonNormalBevelProc, (SInt32) 0);
- EmbedControl(medStickyBevelHandle, userPaneHandle);
- largeStickyBevelHandle = NewControl(windowRef, &geometry, "\p",
- false, 0, 0,
- (kControlBehaviorOffsetContents
- | kControlBehaviorSticky) << 16
- | kControlContentPictHandle,
- kControlBevelButtonLargeBevelProc, (SInt32) 0);
- EmbedControl(largeStickyBevelHandle, userPaneHandle);
-
- picParams.version = -2;
- picParams.hRes = 0x00480000;
- picParams.vRes = 0x00480000;
- picParams.srcRect.top = 0;
- picParams.srcRect.left = 0;
-
- ((CWindowPeek) windowRef)->visible = true;
- } else {
- buttonHandle = NewControl(windowRef, &geometry, "\p",
- false, 1, 0, 1, pushButProc, (SInt32) 0);
- checkHandle = NewControl(windowRef, &geometry, "\p",
- false, 1, 0, 1, checkBoxProc, (SInt32) 0);
- radioHandle = NewControl(windowRef, &geometry, "\p",
- false, 1, 0, 1, radioButProc, (SInt32) 0);
- ((CWindowPeek) windowRef)->visible = true;
-
- buttonTabHandle = (CCTabHandle) NewHandle(sizeof(CtlCTab));
- checkTabHandle = (CCTabHandle) NewHandle(sizeof(CtlCTab));
- radioTabHandle = (CCTabHandle) NewHandle(sizeof(CtlCTab));
- }
-
- /*
- * Remove our window from the window list. This way our
- * applications and others will not be confused that this
- * window exists - but no one knows about it.
- * I actually don't see the point of doing this, and it causes Floating
- * Window support to crash under Appearance, so I just leave it out.
- * Note that we have to do without this under Carbon, since you can't
- * go poking at the window list...
- */
-
- if (!TkMacHaveAppearance()) {
- windowList = (CWindowPeek) LMGetWindowList();
- if (windowList == (CWindowPeek) windowRef) {
- LMSetWindowList((WindowRef) windowList->nextWindow);
- } else {
- while ((windowList != NULL)
- && (windowList->nextWindow != (CWindowPeek) windowRef)) {
- windowList = windowList->nextWindow;
- }
- if (windowList != NULL) {
- windowList->nextWindow = windowList->nextWindow->nextWindow;
- }
- }
- ((CWindowPeek) windowRef)->nextWindow = NULL;
- }
-
- /*
- * Create an exit handler to clean up this mess if we our
- * unloaded etc. We need to remember the windows portPixMap
- * so it isn't leaked.
- *
- * TODO: The ButtonExitProc doesn't currently work and the
- * code it includes will crash the Mac on exit from Tk.
-
- oldPixPtr = ((CWindowPeek) windowRef)->port.portPixMap;
- TkCreateExitHandler(ButtonExitProc, (ClientData) NULL);
- */
-
-}
-
-/*
- *--------------------------------------------------------------
- *
- * SetupBevelButton --
- *
- * Sets up the Bevel Button with image by copying the
- * source image onto the PicHandle for the button.
- *
- * Results:
- * None
- *
- * Side effects:
- * The image or bitmap for the button is copied over to a picture.
- *
- *--------------------------------------------------------------
- */
-void
-SetupBevelButton(
- TkButton *butPtr, /* Tk button. */
- ControlRef controlHandle, /* The control to set this picture to */
- GWorldPtr destPort, /* Off screen GWorld. */
- GC gc, /* The GC we are drawing into - needed for
- * the bevel button */
- Pixmap pixmap /* The pixmap we are drawing into - needed
- for the bevel button */
- )
-{
- int height, width;
- ControlButtonGraphicAlignment theAlignment;
-
- SetPort((GrafPtr) destPort);
-
- if (butPtr->image != None) {
- Tk_SizeOfImage(butPtr->image,
- &width, &height);
- } else {
- Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap,
- &width, &height);
- }
-
- if ((butPtr->width > 0) && (butPtr->width < width)) {
- width = butPtr->width;
- }
- if ((butPtr->height > 0) && (butPtr->height < height)) {
- height = butPtr->height;
- }
-
- picParams.srcRect.right = width;
- picParams.srcRect.bottom = height;
-
- bevelButtonContent.u.picture = OpenCPicture(&picParams);
-
- /*
- * TO DO - There is one case where XCopyPlane calls CopyDeepMask,
- * which does not get recorded in the picture. So the bitmap code
- * will fail in that case.
- */
-
- if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
- Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height,
- pixmap, 0, 0);
- } else if (butPtr->image != NULL) {
- Tk_RedrawImage(butPtr->image, 0, 0, width,
- height, pixmap, 0, 0);
- } else {
- XSetClipOrigin(butPtr->display, gc, 0, 0);
- XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, gc, 0, 0,
- (unsigned int) width, (unsigned int) height, 0, 0, 1);
- }
-
- ClosePicture();
-
- SetControlData(controlHandle, kControlButtonPart,
- kControlBevelButtonContentTag,
- sizeof(ControlButtonContentInfo),
- (char *) &bevelButtonContent);
-
- if (butPtr->anchor == TK_ANCHOR_N) {
- theAlignment = kControlBevelButtonAlignTop;
- } else if (butPtr->anchor == TK_ANCHOR_NE) {
- theAlignment = kControlBevelButtonAlignTopRight;
- } else if (butPtr->anchor == TK_ANCHOR_E) {
- theAlignment = kControlBevelButtonAlignRight;
- } else if (butPtr->anchor == TK_ANCHOR_SE) {
- theAlignment = kControlBevelButtonAlignBottomRight;
- } else if (butPtr->anchor == TK_ANCHOR_S) {
- theAlignment = kControlBevelButtonAlignBottom;
- } else if (butPtr->anchor == TK_ANCHOR_SW) {
- theAlignment = kControlBevelButtonAlignBottomLeft;
- } else if (butPtr->anchor == TK_ANCHOR_W) {
- theAlignment = kControlBevelButtonAlignLeft;
- } else if (butPtr->anchor == TK_ANCHOR_NW) {
- theAlignment = kControlBevelButtonAlignTopLeft;
- } else if (butPtr->anchor == TK_ANCHOR_CENTER) {
- theAlignment = kControlBevelButtonAlignCenter;
- }
-
- SetControlData(controlHandle, kControlButtonPart,
- kControlBevelButtonGraphicAlignTag,
- sizeof(ControlButtonGraphicAlignment),
- (char *) &theAlignment);
-
-}
-
-/*
- *--------------------------------------------------------------
- *
- * SetUserPaneDrawProc --
- *
- * Utility function to add a UserPaneDrawProc
- * to a userPane control. From MoreControls code
- * from Apple DTS.
- *
- * Results:
- * MacOS system error.
- *
- * Side effects:
- * The user pane gets a new UserPaneDrawProc.
- *
- *--------------------------------------------------------------
- */
-pascal OSErr SetUserPaneDrawProc (
- ControlRef control,
- ControlUserPaneDrawProcPtr upp)
-{
- ControlUserPaneDrawUPP myControlUserPaneDrawUPP;
- myControlUserPaneDrawUPP = NewControlUserPaneDrawProc(upp);
- return SetControlData (control,
- kControlNoPart, kControlUserPaneDrawProcTag,
- sizeof(myControlUserPaneDrawUPP),
- (Ptr) &myControlUserPaneDrawUPP);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * SetUserPaneSetUpSpecialBackgroundProc --
- *
- * Utility function to add a UserPaneBackgroundProc
- * to a userPane control
- *
- * Results:
- * MacOS system error.
- *
- * Side effects:
- * The user pane gets a new UserPaneBackgroundProc.
- *
- *--------------------------------------------------------------
- */
-pascal OSErr
-SetUserPaneSetUpSpecialBackgroundProc(
- ControlRef control,
- ControlUserPaneBackgroundProcPtr upp)
-{
- ControlUserPaneBackgroundUPP myControlUserPaneBackgroundUPP;
- myControlUserPaneBackgroundUPP = NewControlUserPaneBackgroundProc(upp);
- return SetControlData (control, kControlNoPart,
- kControlUserPaneBackgroundProcTag,
- sizeof(myControlUserPaneBackgroundUPP),
- (Ptr) &myControlUserPaneBackgroundUPP);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * UserPaneDraw --
- *
- * This function draws the background of the user pane that will
- * lie under checkboxes and radiobuttons.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The user pane gets updated to the current color.
- *
- *--------------------------------------------------------------
- */
-pascal void
-UserPaneDraw(
- ControlRef control,
- ControlPartCode cpc)
-{
- Rect contrlRect = (**control).contrlRect;
- RGBBackColor (&gUserPaneBackground);
- EraseRect (&contrlRect);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * UserPaneBackgroundProc --
- *
- * This function sets up the background of the user pane that will
- * lie under checkboxes and radiobuttons.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The user pane background gets set to the current color.
- *
- *--------------------------------------------------------------
- */
-
-pascal void
-UserPaneBackgroundProc(
- ControlHandle,
- ControlBackgroundPtr info)
-{
- if (info->colorDevice) {
- RGBBackColor (&gUserPaneBackground);
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * UpdateControlColors --
- *
- * This function will review the colors used to display
- * a Macintosh button. If any non-standard colors are
- * used we create a custom palette for the button, populate
- * with the colors for the button and install the palette.
- *
- * Under Appearance, we just set the pointer that will be
- * used by the UserPaneDrawProc.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The Macintosh control may get a custom palette installed.
- *
- *--------------------------------------------------------------
- */
-
-static int
-UpdateControlColors(
- TkButton *butPtr,
- ControlRef controlHandle,
- CCTabHandle ccTabHandle,
- RGBColor *saveColorPtr)
-{
- XColor *xcolor;
-
- /*
- * Under Appearance we cannot change the background of the
- * button itself. However, the color we are setting is the color
- * of the containing userPane. This will be the color that peeks
- * around the rounded corners of the button.
- * We make this the highlightbackground rather than the background,
- * because if you color the background of a frame containing a
- * button, you usually also color the highlightbackground as well,
- * or you will get a thin grey ring around the button.
- */
-
- if (TkMacHaveAppearance() && (butPtr->type == TYPE_BUTTON)) {
- xcolor = Tk_3DBorderColor(butPtr->highlightBorder);
- } else {
- xcolor = Tk_3DBorderColor(butPtr->normalBorder);
- }
- if (TkMacHaveAppearance()) {
- TkSetMacColor(xcolor->pixel, &gUserPaneBackground);
- } else {
- (**ccTabHandle).ccSeed = 0;
- (**ccTabHandle).ccRider = 0;
- (**ccTabHandle).ctSize = 3;
- (**ccTabHandle).ctTable[0].value = cBodyColor;
- TkSetMacColor(xcolor->pixel,
- &(**ccTabHandle).ctTable[0].rgb);
- (**ccTabHandle).ctTable[1].value = cTextColor;
- TkSetMacColor(butPtr->normalFg->pixel,
- &(**ccTabHandle).ctTable[1].rgb);
- (**ccTabHandle).ctTable[2].value = cFrameColor;
- TkSetMacColor(butPtr->highlightColorPtr->pixel,
- &(**ccTabHandle).ctTable[2].rgb);
- SetControlColor(controlHandle, ccTabHandle);
-
- if (((xcolor->pixel >> 24) != CONTROL_BODY_PIXEL) &&
- ((butPtr->type == TYPE_CHECK_BUTTON) ||
- (butPtr->type == TYPE_RADIO_BUTTON))) {
- RGBColor newColor;
-
- if (TkSetMacColor(xcolor->pixel, &newColor)) {
- ChangeBackgroundWindowColor((**controlHandle).contrlOwner,
- newColor, saveColorPtr);
- }
- return true;
- }
- }
-
- return false;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ChangeBackgroundWindowColor --
- *
- * This procedure will change the background color entry
- * in the Window's colortable. The system isn't notified
- * of the change. This call should only be used to fool
- * the drawing routines for checkboxes and radiobuttons.
- * Any change should be temporary and be reverted after
- * the widget is drawn.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The Window's color table will be adjusted.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ChangeBackgroundWindowColor(
- WindowRef macintoshWindow, /* A Mac window whose color to change. */
- RGBColor rgbColor, /* The new RGB Color for the background. */
- RGBColor *oldColor) /* The old color of the background. */
-{
- AuxWinHandle auxWinHandle;
- WCTabHandle winCTabHandle;
- short ctIndex;
- ColorSpecPtr rgbScan;
-
- GetAuxWin(macintoshWindow, &auxWinHandle);
- winCTabHandle = (WCTabHandle) ((**auxWinHandle).awCTable);
-
- /*
- * Scan through the color table until we find the content
- * (background) color for the window. Don't tell the system
- * about the change - it will generate damage and we will get
- * into an infinite loop.
- */
-
- ctIndex = (**winCTabHandle).ctSize;
- while (ctIndex > -1) {
- rgbScan = ctIndex + (**winCTabHandle).ctTable;
-
- if (rgbScan->value == wContentColor) {
- *oldColor = rgbScan->rgb;
- rgbScan->rgb = rgbColor;
- break;
- }
- ctIndex--;
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ButtonEventProc --
- *
- * This procedure is invoked by the Tk dispatcher for various
- * events on buttons.
- *
- * Results:
- * None.
- *
- * Side effects:
- * When it gets exposed, it is redisplayed.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ButtonEventProc(
- ClientData clientData, /* Information about window. */
- XEvent *eventPtr) /* Information about event. */
-{
- TkButton *buttonPtr = (TkButton *) clientData;
-
- if (eventPtr->type == ActivateNotify
- || eventPtr->type == DeactivateNotify) {
- if ((buttonPtr->tkwin == NULL) || (!Tk_IsMapped(buttonPtr->tkwin))) {
- return;
- }
- if ((buttonPtr->flags & REDRAW_PENDING) == 0) {
- Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) buttonPtr);
- buttonPtr->flags |= REDRAW_PENDING;
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ButtonExitProc --
- *
- * This procedure is invoked just before the application exits.
- * It frees all of the control handles, our dummy window, etc.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Memory is freed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-ButtonExitProc(clientData)
- ClientData clientData; /* Not used. */
-{
- Rect pixRect = {0, 0, 10, 10};
- Rect rgnRect = {0, 0, 0, 0};
-
- /*
- * Restore our dummy window to it's origional state by putting it
- * back in the window list and restoring it's bits. The destroy
- * the controls and window.
- */
-
- ((CWindowPeek) windowRef)->nextWindow = (CWindowPeek) LMGetWindowList();
- LMSetWindowList(windowRef);
- ((CWindowPeek) windowRef)->port.portPixMap = oldPixPtr;
- ((CWindowPeek) windowRef)->port.portRect = pixRect;
- RectRgn(((CWindowPeek) windowRef)->port.visRgn, &rgnRect);
- RectRgn(((CWindowPeek) windowRef)->strucRgn, &rgnRect);
- RectRgn(((CWindowPeek) windowRef)->updateRgn, &rgnRect);
- RectRgn(((CWindowPeek) windowRef)->contRgn, &rgnRect);
- PortChanged(windowRef);
-
- DisposeControl(buttonHandle);
- DisposeControl(checkHandle);
- DisposeControl(radioHandle);
- DisposeWindow(windowRef);
- windowRef = NULL;
-}
diff --git a/mac/tkMacClipboard.c b/mac/tkMacClipboard.c
deleted file mode 100644
index 953ae23..0000000
--- a/mac/tkMacClipboard.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * tkMacClipboard.c --
- *
- * This file manages the clipboard for the Tk toolkit.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkInt.h"
-#include "tkPort.h"
-#include "tkMacInt.h"
-
-#include <Scrap.h>
-#include <Events.h>
-
-#include "tkSelect.h"
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSelGetSelection --
- *
- * Retrieve the specified selection from another process. For
- * now, only fetching XA_STRING from CLIPBOARD is supported.
- * Eventually other types should be allowed.
- *
- * Results:
- * The return value is a standard Tcl return value.
- * If an error occurs (such as no selection exists)
- * then an error message is left in the interp's result.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkSelGetSelection(
- Tcl_Interp *interp, /* Interpreter to use for reporting
- * errors. */
- Tk_Window tkwin, /* Window on whose behalf to retrieve
- * the selection (determines display
- * from which to retrieve). */
- Atom selection, /* Selection to retrieve. */
- Atom target, /* Desired form in which selection
- * is to be returned. */
- Tk_GetSelProc *proc, /* Procedure to call to process the
- * selection, once it has been retrieved. */
- ClientData clientData) /* Arbitrary value to pass to proc. */
-{
- int result;
- long length, offset = 0;
- Handle handle;
-
- if ((selection == Tk_InternAtom(tkwin, "CLIPBOARD"))
- && (target == XA_STRING)) {
- /*
- * Get the scrap from the Macintosh global clipboard.
- */
- handle = NewHandle(1);
- length = GetScrap(handle, 'TEXT', &offset);
- if (length > 0) {
- Tcl_DString encodedText;
-
- SetHandleSize(handle, (Size) length + 1);
- HLock(handle);
- (*handle)[length] = '\0';
-
- Tcl_ExternalToUtfDString(NULL, *handle, length, &encodedText);
- result = (*proc)(clientData, interp,
- Tcl_DStringValue(&encodedText));
- Tcl_DStringFree(&encodedText);
-
- HUnlock(handle);
- DisposeHandle(handle);
- return result;
- }
-
- DisposeHandle(handle);
- }
-
- Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
- " selection doesn't exist or form \"", Tk_GetAtomName(tkwin, target),
- "\" not defined", (char *) NULL);
- return TCL_ERROR;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSetSelectionOwner --
- *
- * This function claims ownership of the specified selection.
- * If the selection is CLIPBOARD, then we empty the system
- * clipboard.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XSetSelectionOwner(
- Display* display, /* X Display. */
- Atom selection, /* What selection to own. */
- Window owner, /* Window to be the owner. */
- Time time) /* The current time? */
-{
- Tk_Window tkwin;
- TkDisplay *dispPtr;
-
- /*
- * This is a gross hack because the Tk_InternAtom interface is broken.
- * It expects a Tk_Window, even though it only needs a Tk_Display.
- */
-
- tkwin = (Tk_Window) TkGetMainInfoList()->winPtr;
-
- if (selection == Tk_InternAtom(tkwin, "CLIPBOARD")) {
-
- /*
- * Only claim and empty the clipboard if we aren't already the
- * owner of the clipboard.
- */
-
- dispPtr = TkGetMainInfoList()->winPtr->dispPtr;
- if (dispPtr->clipboardActive) {
- return;
- }
- ZeroScrap();
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSelUpdateClipboard --
- *
- * This function is called to force the clipboard to be updated
- * after new data is added. On the Mac we don't need to do
- * anything.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkSelUpdateClipboard(
- TkWindow *winPtr, /* Window associated with clipboard. */
- TkClipboardTarget *targetPtr) /* Info about the content. */
-{
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkSelEventProc --
- *
- * This procedure is invoked whenever a selection-related
- * event occurs.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Lots: depends on the type of event.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkSelEventProc(
- Tk_Window tkwin, /* Window for which event was
- * targeted. */
- register XEvent *eventPtr) /* X event: either SelectionClear,
- * SelectionRequest, or
- * SelectionNotify. */
-{
- if (eventPtr->type == SelectionClear) {
- TkSelClearSelection(tkwin, eventPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSelPropProc --
- *
- * This procedure is invoked when property-change events
- * occur on windows not known to the toolkit. This is a stub
- * function under Windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkSelPropProc(
- register XEvent *eventPtr) /* X PropertyChange event. */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSuspendClipboard --
- *
- * Handle clipboard conversion as required by the suppend event.
- * This function is also called on exit.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The local scrap is moved to the global scrap.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkSuspendClipboard()
-{
- TkClipboardTarget *targetPtr;
- TkClipboardBuffer *cbPtr;
- TkDisplay *dispPtr;
- char *buffer, *p, *endPtr, *buffPtr;
- long length;
-
- dispPtr = TkGetDisplayList();
- if ((dispPtr == NULL) || !dispPtr->clipboardActive) {
- return;
- }
-
- for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
- targetPtr = targetPtr->nextPtr) {
- if (targetPtr->type == XA_STRING)
- break;
- }
- if (targetPtr != NULL) {
- Tcl_DString encodedText;
-
- length = 0;
- for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL;
- cbPtr = cbPtr->nextPtr) {
- length += cbPtr->length;
- }
-
- buffer = ckalloc(length);
- buffPtr = buffer;
- for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL;
- cbPtr = cbPtr->nextPtr) {
- for (p = cbPtr->buffer, endPtr = p + cbPtr->length;
- p < endPtr; p++) {
- if (*p == '\n') {
- *buffPtr++ = '\r';
- } else {
- *buffPtr++ = *p;
- }
- }
- }
-
- ZeroScrap();
- Tcl_UtfToExternalDString(NULL, buffer, length, &encodedText);
- PutScrap(Tcl_DStringLength(&encodedText), 'TEXT',
- Tcl_DStringValue(&encodedText));
- Tcl_DStringFree(&encodedText);
- ckfree(buffer);
- }
-
- /*
- * The system now owns the scrap. We tell Tk that it has
- * lost the selection so that it will look for it the next time
- * it needs it. (Window list NULL if quiting.)
- */
-
- if (TkGetMainInfoList() != NULL) {
- Tk_ClearSelection((Tk_Window) TkGetMainInfoList()->winPtr,
- Tk_InternAtom((Tk_Window) TkGetMainInfoList()->winPtr,
- "CLIPBOARD"));
- }
-
- return;
-}
diff --git a/mac/tkMacColor.c b/mac/tkMacColor.c
deleted file mode 100644
index 6fd0263..0000000
--- a/mac/tkMacColor.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * tkMacColor.c --
- *
- * This file maintains a database of color values for the Tk
- * toolkit, in order to avoid round-trips to the server to
- * map color names to pixel values.
- *
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <tkColor.h>
-#include "tkMacInt.h"
-
-#include <LowMem.h>
-#include <Palettes.h>
-#include <Quickdraw.h>
-
-/*
- * Default Auxillary Control Record for all controls. This is cached once
- * and is updated by the system. We use this to get the default system
- * colors used by controls.
- */
-static AuxCtlHandle defaultAuxCtlHandle = NULL;
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static int GetControlPartColor _ANSI_ARGS_((short part, RGBColor *macColor));
-static int GetMenuPartColor _ANSI_ARGS_((int part, RGBColor *macColor));
-static int GetWindowPartColor _ANSI_ARGS_((short part, RGBColor *macColor));
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSetMacColor --
- *
- * Populates a Macintosh RGBColor structure from a X style
- * pixel value.
- *
- * Results:
- * Returns false if not a real pixel, true otherwise.
- *
- * Side effects:
- * The variable macColor is updated to the pixels value.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkSetMacColor(
- unsigned long pixel, /* Pixel value to convert. */
- RGBColor *macColor) /* Mac color struct to modify. */
-{
- switch (pixel >> 24) {
- case HIGHLIGHT_PIXEL:
- LMGetHiliteRGB(macColor);
- return true;
- case HIGHLIGHT_TEXT_PIXEL:
- LMGetHiliteRGB(macColor);
- if ((macColor->red == 0) && (macColor->green == 0)
- && (macColor->blue == 0)) {
- macColor->red = macColor->green = macColor->blue = 0xFFFFFFFF;
- } else {
- macColor->red = macColor->green = macColor->blue = 0;
- }
- return true;
- case CONTROL_TEXT_PIXEL:
- GetControlPartColor(cTextColor, macColor);
- return true;
- case CONTROL_BODY_PIXEL:
- GetControlPartColor(cBodyColor, macColor);
- return true;
- case CONTROL_FRAME_PIXEL:
- GetControlPartColor(cFrameColor, macColor);
- return true;
- case WINDOW_BODY_PIXEL:
- GetWindowPartColor(wContentColor, macColor);
- return true;
- case MENU_ACTIVE_PIXEL:
- case MENU_ACTIVE_TEXT_PIXEL:
- case MENU_BACKGROUND_PIXEL:
- case MENU_DISABLED_PIXEL:
- case MENU_TEXT_PIXEL:
- return GetMenuPartColor((pixel >> 24), macColor);
- case APPEARANCE_PIXEL:
- return false;
- case PIXEL_MAGIC:
- default:
- macColor->blue = (unsigned short) ((pixel & 0xFF) << 8);
- macColor->green = (unsigned short) (((pixel >> 8) & 0xFF) << 8);
- macColor->red = (unsigned short) (((pixel >> 16) & 0xFF) << 8);
- return true;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Stub functions --
- *
- * These functions are just stubs for functions that either
- * don't make sense on the Mac or have yet to be implemented.
- *
- * Results:
- * None.
- *
- * Side effects:
- * These calls do nothing - which may not be expected.
- *
- *----------------------------------------------------------------------
- */
-
-Status
-XAllocColor(
- Display *display, /* Display. */
- Colormap map, /* Not used. */
- XColor *colorPtr) /* XColor struct to modify. */
-{
- display->request++;
- colorPtr->pixel = TkpGetPixel(colorPtr);
- return 1;
-}
-
-Colormap
-XCreateColormap(
- Display *display, /* Display. */
- Window window, /* X window. */
- Visual *visual, /* Not used. */
- int alloc) /* Not used. */
-{
- static Colormap index = 1;
-
- /*
- * Just return a new value each time.
- */
- return index++;
-}
-
-void
-XFreeColormap(
- Display* display, /* Display. */
- Colormap colormap) /* Colormap. */
-{
-}
-
-void
-XFreeColors(
- Display* display, /* Display. */
- Colormap colormap, /* Colormap. */
- unsigned long* pixels, /* Array of pixels. */
- int npixels, /* Number of pixels. */
- unsigned long planes) /* Number of pixel planes. */
-{
- /*
- * The Macintosh version of Tk uses TrueColor. Nothing
- * needs to be done to release colors as there really is
- * no colormap in the Tk sense.
- */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetColor --
- *
- * Allocate a new TkColor for the color with the given name.
- *
- * Results:
- * Returns a newly allocated TkColor, or NULL on failure.
- *
- * Side effects:
- * May invalidate the colormap cache associated with tkwin upon
- * allocating a new colormap entry. Allocates a new TkColor
- * structure.
- *
- *----------------------------------------------------------------------
- */
-
-TkColor *
-TkpGetColor(
- Tk_Window tkwin, /* Window in which color will be used. */
- Tk_Uid name) /* Name of color to allocated (in form
- * suitable for passing to XParseColor). */
-{
- Display *display = Tk_Display(tkwin);
- Colormap colormap = Tk_Colormap(tkwin);
- TkColor *tkColPtr;
- XColor color;
-
- /*
- * Check to see if this is a system color. Otherwise, XParseColor
- * will do all the work.
- */
- if (strncasecmp(name, "system", 6) == 0) {
- int foundSystemColor = false;
- RGBColor rgbValue;
- char pixelCode;
-
- if (!strcasecmp(name+6, "Highlight")) {
- LMGetHiliteRGB(&rgbValue);
- pixelCode = HIGHLIGHT_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "HighlightText")) {
- LMGetHiliteRGB(&rgbValue);
- if ((rgbValue.red == 0) && (rgbValue.green == 0)
- && (rgbValue.blue == 0)) {
- rgbValue.red = rgbValue.green = rgbValue.blue = 0xFFFFFFFF;
- } else {
- rgbValue.red = rgbValue.green = rgbValue.blue = 0;
- }
- pixelCode = HIGHLIGHT_TEXT_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "ButtonText")) {
- GetControlPartColor(cTextColor, &rgbValue);
- pixelCode = CONTROL_TEXT_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "ButtonFace")) {
- GetControlPartColor(cBodyColor, &rgbValue);
- pixelCode = CONTROL_BODY_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "ButtonFrame")) {
- GetControlPartColor(cFrameColor, &rgbValue);
- pixelCode = CONTROL_FRAME_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "WindowBody")) {
- GetWindowPartColor(wContentColor, &rgbValue);
- pixelCode = WINDOW_BODY_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "MenuActive")) {
- GetMenuPartColor(MENU_ACTIVE_PIXEL, &rgbValue);
- pixelCode = MENU_ACTIVE_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "MenuActiveText")) {
- GetMenuPartColor(MENU_ACTIVE_TEXT_PIXEL, &rgbValue);
- pixelCode = MENU_ACTIVE_TEXT_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "Menu")) {
- GetMenuPartColor(MENU_BACKGROUND_PIXEL, &rgbValue);
- pixelCode = MENU_BACKGROUND_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "MenuDisabled")) {
- GetMenuPartColor(MENU_DISABLED_PIXEL, &rgbValue);
- pixelCode = MENU_DISABLED_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "MenuText")) {
- GetMenuPartColor(MENU_TEXT_PIXEL, &rgbValue);
- pixelCode = MENU_TEXT_PIXEL;
- foundSystemColor = true;
- } else if (!strcasecmp(name+6, "AppearanceColor")) {
- color.red = 0;
- color.green = 0;
- color.blue = 0;
- pixelCode = APPEARANCE_PIXEL;
- foundSystemColor = true;
- }
-
- if (foundSystemColor) {
- color.red = rgbValue.red;
- color.green = rgbValue.green;
- color.blue = rgbValue.blue;
- color.pixel = ((((((pixelCode << 8)
- | ((color.red >> 8) & 0xff)) << 8)
- | ((color.green >> 8) & 0xff)) << 8)
- | ((color.blue >> 8) & 0xff));
-
- tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
- tkColPtr->color = color;
- return tkColPtr;
- }
- }
-
- if (XParseColor(display, colormap, name, &color) == 0) {
- return (TkColor *) NULL;
- }
-
- tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
- tkColPtr->color = color;
-
- return tkColPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetColorByValue --
- *
- * Given a desired set of red-green-blue intensities for a color,
- * locate a pixel value to use to draw that color in a given
- * window.
- *
- * Results:
- * The return value is a pointer to an TkColor structure that
- * indicates the closest red, blue, and green intensities available
- * to those specified in colorPtr, and also specifies a pixel
- * value to use to draw in that color.
- *
- * Side effects:
- * May invalidate the colormap cache for the specified window.
- * Allocates a new TkColor structure.
- *
- *----------------------------------------------------------------------
- */
-
-TkColor *
-TkpGetColorByValue(
- Tk_Window tkwin, /* Window in which color will be used. */
- XColor *colorPtr) /* Red, green, and blue fields indicate
- * desired color. */
-{
- TkColor *tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
-
- tkColPtr->color.red = colorPtr->red;
- tkColPtr->color.green = colorPtr->green;
- tkColPtr->color.blue = colorPtr->blue;
- tkColPtr->color.pixel = TkpGetPixel(&tkColPtr->color);
- return tkColPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetControlPartColor --
- *
- * Given a part number this function will return the standard
- * system default color for that part. It does this by looking
- * in the system's 'cctb' resource.
- *
- * Results:
- * True if a color is found, false otherwise.
- *
- * Side effects:
- * If a color is found then the RGB variable will be changed to
- * the parts color.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GetControlPartColor(
- short part, /* Part code. */
- RGBColor *macColor) /* Pointer to Mac color. */
-{
- short index;
- CCTabHandle ccTab;
-
- if (defaultAuxCtlHandle == NULL) {
- GetAuxiliaryControlRecord(NULL, &defaultAuxCtlHandle);
- }
- ccTab = (**defaultAuxCtlHandle).acCTable;
- if(ccTab && (ResError() == noErr)) {
- for(index = 0; index <= (**ccTab).ctSize; index++) {
- if((**ccTab).ctTable[index].value == part) {
- *macColor = (**ccTab).ctTable[index].rgb;
- return true;
- }
- }
- }
- return false;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetWindowPartColor --
- *
- * Given a part number this function will return the standard
- * system default color for that part. It does this by looking
- * in the system's 'wctb' resource.
- *
- * Results:
- * True if a color is found, false otherwise.
- *
- * Side effects:
- * If a color is found then the RGB variable will be changed to
- * the parts color.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GetWindowPartColor(
- short part, /* Part code. */
- RGBColor *macColor) /* Pointer to Mac color. */
-{
- short index;
- WCTabHandle wcTab;
-
- wcTab = (WCTabHandle) GetResource('wctb', 0);
- if(wcTab && (ResError() == noErr)) {
- for(index = 0; index <= (**wcTab).ctSize; index++) {
- if((**wcTab).ctTable[index].value == part) {
- *macColor = (**wcTab).ctTable[index].rgb;
- return true;
- }
- }
- }
- return false;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetMenuPartColor --
- *
- * Given a magic pixel value, returns the RGB color associated
- * with it by looking the value up in the system's 'mctb' resource.
- *
- * Results:
- * True if a color is found, false otherwise.
- *
- * Side effects:
- * If a color is found then the RGB variable will be changed to
- * the parts color.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GetMenuPartColor(
- int pixel, /* The magic pixel value */
- RGBColor *macColor) /* Pointer to Mac color */
-{
- RGBColor backColor, foreColor;
- GDHandle maxDevice;
- Rect globalRect;
- MCEntryPtr mcEntryPtr;
-
- /* Under Appearance, we don't want to set any menu colors when we
- are asked for the standard menu colors. So we return false (which
- means don't use this color... */
-
- if (TkMacHaveAppearance()) {
- macColor->red = 0xFFFF;
- macColor->green = 0;
- macColor->blue = 0;
- return false;
- } else {
- mcEntryPtr = GetMCEntry(0, 0);
- switch (pixel) {
- case MENU_ACTIVE_PIXEL:
- if (mcEntryPtr == NULL) {
- macColor->red = macColor->blue = macColor->green = 0;
- } else {
- *macColor = mcEntryPtr->mctRGB3;
- }
- return true;
- case MENU_ACTIVE_TEXT_PIXEL:
- if (mcEntryPtr == NULL) {
- macColor->red = macColor->blue = macColor->green = 0xFFFF;
- } else {
- *macColor = mcEntryPtr->mctRGB2;
- }
- return true;
- case MENU_BACKGROUND_PIXEL:
- if (mcEntryPtr == NULL) {
- macColor->red = macColor->blue = macColor->green = 0xFFFF;
- } else {
- *macColor = mcEntryPtr->mctRGB2;
- }
- return true;
- case MENU_DISABLED_PIXEL:
- if (mcEntryPtr == NULL) {
- backColor.red = backColor.blue = backColor.green = 0xFFFF;
- foreColor.red = foreColor.blue = foreColor.green = 0x0000;
- } else {
- backColor = mcEntryPtr->mctRGB2;
- foreColor = mcEntryPtr->mctRGB3;
- }
- SetRect(&globalRect, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
- maxDevice = GetMaxDevice(&globalRect);
- if (GetGray(maxDevice, &backColor, &foreColor)) {
- *macColor = foreColor;
- } else {
-
- /*
- * Pointer may have been moved by GetMaxDevice or GetGray.
- */
-
- mcEntryPtr = GetMCEntry(0,0);
- if (mcEntryPtr == NULL) {
- macColor->red = macColor->green = macColor->blue = 0x7777;
- } else {
- *macColor = mcEntryPtr->mctRGB2;
- }
- }
- return true;
- case MENU_TEXT_PIXEL:
- if (mcEntryPtr == NULL) {
- macColor->red = macColor->green = macColor->blue = 0;
- } else {
- *macColor = mcEntryPtr->mctRGB3;
- }
- return true;
- }
- return false;
-}
-}
diff --git a/mac/tkMacConfig.c b/mac/tkMacConfig.c
deleted file mode 100644
index 30d9386..0000000
--- a/mac/tkMacConfig.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * tkMacConfig.c --
- *
- * This module implements the Macintosh system defaults for
- * the configuration package.
- *
- * Copyright (c) 1997 by Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tk.h"
-#include "tkInt.h"
-
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetSystemDefault --
- *
- * Given a dbName and className for a configuration option,
- * return a string representation of the option.
- *
- * Results:
- * Returns a Tk_Uid that is the string identifier that identifies
- * this option. Returns NULL if there are no system defaults
- * that match this pair.
- *
- * Side effects:
- * None, once the package is initialized.
- *
- *----------------------------------------------------------------------
- */
-
-Tcl_Obj *
-TkpGetSystemDefault(
- Tk_Window tkwin, /* A window to use. */
- CONST char *dbName, /* The option database name. */
- CONST char *className) /* The name of the option class. */
-{
- return NULL;
-}
diff --git a/mac/tkMacCursor.c b/mac/tkMacCursor.c
deleted file mode 100644
index 2a255e0..0000000
--- a/mac/tkMacCursor.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * tkMacCursor.c --
- *
- * This file contains Macintosh specific cursor related routines.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkPort.h"
-#include "tkInt.h"
-#include "tkMacInt.h"
-
-#include <Resources.h>
-#include <ToolUtils.h>
-#include <Strings.h>
-
-/*
- * There are three different ways to set the cursor on the Mac.
- */
-#define ARROW 0 /* The arrow cursor. */
-#define COLOR 1 /* Cursors of type crsr. */
-#define NORMAL 2 /* Cursors of type CURS. */
-
-/*
- * The following data structure contains the system specific data
- * necessary to control Windows cursors.
- */
-
-typedef struct {
- TkCursor info; /* Generic cursor info used by tkCursor.c */
- Handle macCursor; /* Resource containing Macintosh cursor. */
- int type; /* Type of Mac cursor: arrow, crsr, CURS */
-} TkMacCursor;
-
-/*
- * The table below is used to map from the name of a predefined cursor
- * to its resource identifier.
- */
-
-static struct CursorName {
- char *name;
- int id;
-} cursorNames[] = {
- {"ibeam", 1},
- {"text", 1},
- {"xterm", 1},
- {"cross", 2},
- {"crosshair", 2},
- {"cross-hair", 2},
- {"plus", 3},
- {"watch", 4},
- {"arrow", 5},
- {NULL, 0}
-};
-
-/*
- * Declarations of static variables used in this file.
- */
-
-static TkMacCursor * gCurrentCursor = NULL; /* A pointer to the current
- * cursor. */
-static int gResizeOverride = false; /* A boolean indicating whether
- * we should use the resize
- * cursor during installations. */
-static int gTkOwnsCursor = true; /* A boolean indicating whether
- Tk owns the cursor. If not (for
- instance, in the case where a Tk
- window is embedded in another app's
- window, and the cursor is out of
- the tk window, we will not attempt
- to adjust the cursor */
-
-/*
- * Declarations of procedures local to this file
- */
-
-static void FindCursorByName _ANSI_ARGS_ ((TkMacCursor *macCursorPtr,
- CONST char *string));
-
-/*
- *----------------------------------------------------------------------
- *
- * FindCursorByName --
- *
- * Retrieve a system cursor by name, and fill the macCursorPtr
- * structure. If the cursor cannot be found, the macCursor field
- * will be NULL. The function first attempts to load a color
- * cursor. If that fails it will attempt to load a black & white
- * cursor.
- *
- * Results:
- * Fills the macCursorPtr record.
- *
- * Side effects:
- * None
- *
- *----------------------------------------------------------------------
- */
-
-void
-FindCursorByName(
- TkMacCursor *macCursorPtr,
- CONST char *string)
-{
- Handle resource;
- Str255 curName;
- int destWrote, inCurLen;
-
- inCurLen = strlen(string);
- if (inCurLen > 255) {
- return;
- }
-
- /*
- * macRoman is the encoding that the resource fork uses.
- */
-
- Tcl_UtfToExternal(NULL, Tcl_GetEncoding(NULL, "macRoman"), string,
- inCurLen, 0, NULL,
- (char *) &curName[1],
- 255, NULL, &destWrote, NULL); /* Internalize native */
- curName[0] = destWrote;
-
- resource = GetNamedResource('crsr', curName);
-
- if (resource != NULL) {
- short id;
- Str255 theName;
- ResType theType;
-
- HLock(resource);
- GetResInfo(resource, &id, &theType, theName);
- HUnlock(resource);
- macCursorPtr->macCursor = (Handle) GetCCursor(id);
- macCursorPtr->type = COLOR;
- }
-
- if (resource == NULL) {
- macCursorPtr->macCursor = GetNamedResource('CURS', curName);
- macCursorPtr->type = NORMAL;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGetCursorByName --
- *
- * Retrieve a system cursor by name.
- *
- * Results:
- * Returns a new cursor, or NULL on errors.
- *
- * Side effects:
- * Allocates a new cursor.
- *
- *----------------------------------------------------------------------
- */
-
-TkCursor *
-TkGetCursorByName(
- Tcl_Interp *interp, /* Interpreter to use for error reporting. */
- Tk_Window tkwin, /* Window in which cursor will be used. */
- Tk_Uid string) /* Description of cursor. See manual entry
- * for details on legal syntax. */
-{
- struct CursorName *namePtr;
- TkMacCursor *macCursorPtr;
-
- macCursorPtr = (TkMacCursor *) ckalloc(sizeof(TkMacCursor));
- macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr;
-
- /*
- * To find a cursor we must first determine if it is one of the
- * builtin cursors or the standard arrow cursor. Otherwise, we
- * attempt to load the cursor as a named Mac resource.
- */
-
- for (namePtr = cursorNames; namePtr->name != NULL; namePtr++) {
- if (strcmp(namePtr->name, string) == 0) {
- break;
- }
- }
-
-
- if (namePtr->name != NULL) {
- if (namePtr->id == 5) {
- macCursorPtr->macCursor = (Handle) -1;
- macCursorPtr->type = ARROW;
- } else {
- macCursorPtr->macCursor = (Handle) GetCursor(namePtr->id);
- macCursorPtr->type = NORMAL;
- }
- } else {
- FindCursorByName(macCursorPtr, string);
-
- if (macCursorPtr->macCursor == NULL) {
- CONST char **argv;
- int argc, err;
-
- /*
- * The user may be trying to specify an XCursor with fore
- * & back colors. We don't want this to be an error, so pick
- * off the first word, and try again.
- */
-
- err = Tcl_SplitList(interp, string, &argc, &argv);
- if (err == TCL_OK ) {
- if (argc > 1) {
- FindCursorByName(macCursorPtr, argv[0]);
- }
-
- ckfree((char *) argv);
- }
- }
- }
-
- if (macCursorPtr->macCursor == NULL) {
- ckfree((char *)macCursorPtr);
- Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
- (char *) NULL);
- return NULL;
- } else {
- return (TkCursor *) macCursorPtr;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkCreateCursorFromData --
- *
- * Creates a cursor from the source and mask bits.
- *
- * Results:
- * Returns a new cursor, or NULL on errors.
- *
- * Side effects:
- * Allocates a new cursor.
- *
- *----------------------------------------------------------------------
- */
-
-TkCursor *
-TkCreateCursorFromData(
- Tk_Window tkwin, /* Window in which cursor will be used. */
- CONST char *source, /* Bitmap data for cursor shape. */
- CONST char *mask, /* Bitmap data for cursor mask. */
- int width, int height, /* Dimensions of cursor. */
- int xHot, int yHot, /* Location of hot-spot in cursor. */
- XColor fgColor, /* Foreground color for cursor. */
- XColor bgColor) /* Background color for cursor. */
-{
- return NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpFreeCursor --
- *
- * This procedure is called to release a cursor allocated by
- * TkGetCursorByName.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The cursor data structure is deallocated.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpFreeCursor(
- TkCursor *cursorPtr)
-{
- TkMacCursor *macCursorPtr = (TkMacCursor *) cursorPtr;
-
- switch (macCursorPtr->type) {
- case COLOR:
- DisposeCCursor((CCrsrHandle) macCursorPtr->macCursor);
- break;
- case NORMAL:
- ReleaseResource(macCursorPtr->macCursor);
- break;
- }
-
- if (macCursorPtr == gCurrentCursor) {
- gCurrentCursor = NULL;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacInstallCursor --
- *
- * Installs either the current cursor as defined by TkpSetCursor
- * or a resize cursor as the cursor the Macintosh should currently
- * display.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Changes the Macintosh mouse cursor.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacInstallCursor(
- int resizeOverride)
-{
- TkMacCursor *macCursorPtr = gCurrentCursor;
- CCrsrHandle ccursor;
- CursHandle cursor;
-
- gResizeOverride = resizeOverride;
-
- if (resizeOverride) {
- cursor = (CursHandle) GetNamedResource('CURS', "\presize");
- SetCursor(*cursor);
- } else if (macCursorPtr == NULL || macCursorPtr->type == ARROW) {
- SetCursor(&tcl_macQdPtr->arrow);
- } else {
- switch (macCursorPtr->type) {
- case COLOR:
- ccursor = (CCrsrHandle) macCursorPtr->macCursor;
- SetCCursor(ccursor);
- break;
- case NORMAL:
- cursor = (CursHandle) macCursorPtr->macCursor;
- SetCursor(*cursor);
- break;
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpSetCursor --
- *
- * Set the current cursor and install it.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Changes the current cursor.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpSetCursor(
- TkpCursor cursor)
-{
- if (!gTkOwnsCursor) {
- return;
- }
- if (cursor == None) {
- gCurrentCursor = NULL;
- } else {
- gCurrentCursor = (TkMacCursor *) cursor;
- }
-
- if (tkMacAppInFront) {
- TkMacInstallCursor(gResizeOverride);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_MacTkOwnsCursor --
- *
- * Sets whether Tk has the right to adjust the cursor.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May keep Tk from changing the cursor.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_MacTkOwnsCursor(
- int tkOwnsIt)
-{
- gTkOwnsCursor = tkOwnsIt;
-}
diff --git a/mac/tkMacCursors.r b/mac/tkMacCursors.r
deleted file mode 100644
index 0d2ad29..0000000
--- a/mac/tkMacCursors.r
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * tkMacCursors.r --
- *
- * This file defines a set of Macintosh cursor resources that
- * are only available on the Macintosh platform.
- *
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-/*
- * These are resource definitions for Macintosh cursors.
- * The are identified and loaded by the "name" of the
- * cursor. However, the ids must be unique.
- */
-
-data 'CURS' (1000, "hand") {
- $"0180 1A70 2648 264A 124D 1249 6809 9801"
- $"8802 4002 2002 2004 1004 0808 0408 0408"
- $"0180 1BF0 3FF8 3FFA 1FFF 1FFF 6FFF FFFF"
- $"FFFE 7FFE 3FFE 3FFC 1FFC 0FF8 07F8 07F8"
- $"0009 0008"
-};
-
-data 'CURS' (1002, "bucket") {
- $"0000 0000 0600 0980 0940 0B30 0D18 090C"
- $"129C 212C 104C 088C 050C 0208 0000 0000"
- $"0000 0000 0600 0980 09C0 0BF0 0FF8 0FFC"
- $"1FFC 3FEC 1FCC 0F8C 070C 0208 0000 0000"
- $"000D 000C"
-};
-
-data 'CURS' (1003, "cancel") {
- $"0000 0000 0000 0000 3180 4A40 4A40 3F80"
- $"0A00 3F80 4A40 4A46 3186 0000 0000 0000"
- $"0000 0000 0000 3180 7BC0 FFE0 FFE0 7FC0"
- $"3F80 7FC0 FFE6 FFEF 7BCF 3186 0000 0000"
- $"0008 0005"
-};
-
-data 'CURS' (1004, "Resize") {
- $"FFFF 8001 BF01 A181 A1F9 A18D A18D BF8D"
- $"9F8D 880D 880D 880D 8FFD 87FD 8001 FFFF"
- $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
- $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
- $"0008 0008"
-};
-
-data 'CURS' (1005, "eyedrop") {
- $"000E 001F 001F 00FF 007E 00B8 0118 0228"
- $"0440 0880 1100 2200 4400 4800 B000 4000"
- $"000E 001F 001F 00FF 007E 00F8 01F8 03E8"
- $"07C0 0F80 1F00 3E00 7C00 7800 F000 4000"
- $"000F 0000"
-};
-
-data 'CURS' (1006, "eyedrop-full") {
- $"000E 001F 001F 00FF 007E 00B8 0118 0328"
- $"07C0 0F80 1F00 3E00 7C00 7800 F000 4000"
- $"000E 001F 001F 00FF 007E 00F8 01F8 03E8"
- $"07C0 0F80 1F00 3E00 7C00 7800 F000 4000"
- $"000F 0000"
-};
-
-data 'CURS' (1007, "zoom-in") {
- $"0780 1860 2790 5868 5028 A014 AFD4 AFD4"
- $"A014 5028 5868 2798 187C 078E 0007 0003"
- $"0780 1FE0 3FF0 7878 7038 E01C EFDC EFDC"
- $"E01C 7038 7878 3FF8 1FFC 078E 0007 0003"
- $"0007 0007"
-};
-
-data 'CURS' (1008, "zoom-out") {
- $"0780 1860 2790 5868 5328 A314 AFD4 AFD4"
- $"A314 5328 5868 2798 187C 078E 0007 0003"
- $"0780 1FE0 3FF0 7878 7338 E31C EFDC EFDC"
- $"E31C 7338 7878 3FF8 1FFC 078E 0007 0003"
- $"0007 0007"
-};
-
-/*
- * The following are resource definitions for color
- * cursors on the Macintosh. If a color cursor and
- * a black & white cursor are both defined with the
- * same name preference will be given to the color
- * cursors.
- */
-
-data 'crsr' (1000, "hand") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0180 1A70 2648 264A 124D 1249"
- $"6809 9801 8802 4002 2002 2004 1004 0808"
- $"0408 0408 0180 1BF0 3FF8 3FFA 1FFF 1FFF"
- $"6FFF FFFF FFFE 7FFE 3FFE 3FFC 1FFC 0FF8"
- $"07F8 07F8 0008 0008 0000 0000 0000 0000"
- $"0000 0000 8004 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0002 0001 0002 0000 0000 0000 00D2 0000"
- $"0000 0003 C000 03CD 7F00 0D7D 75C0 0D7D"
- $"75CC 035D 75F7 035D 75D7 3CD5 55D7 D7D5"
- $"5557 D5D5 555C 3555 555C 0D55 555C 0D55"
- $"5570 0355 5570 00D5 55C0 0035 55C0 0035"
- $"55C0 0000 0000 0000 0002 0000 FFFF FFFF"
- $"FFFF 0001 FFFF CCCC 9999 0003 0000 0000"
- $"0000"
-};
-
-data 'crsr' (1001, "fist") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0DB0 124C"
- $"100A 0802 1802 2002 2002 2004 1004 0808"
- $"0408 0408 0000 0000 0000 0000 0DB0 1FFC"
- $"1FFE 0FFE 1FFE 3FFE 3FFE 3FFC 1FFC 0FF8"
- $"07F8 07F8 0008 0008 0000 0000 0000 0000"
- $"0000 0000 8004 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0002 0001 0002 0000 0000 0000 00D2 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 00F3 CF00 035D 75F0 0355 55DC 00D5"
- $"555C 03D5 555C 0D55 555C 0D55 555C 0D55"
- $"5570 0355 5570 00D5 55C0 0035 55C0 0035"
- $"55C0 0000 0000 0000 0002 0000 FFFF FFFF"
- $"FFFF 0001 FFFF CCCC 9999 0003 0000 0000"
- $"0000"
-};
-
diff --git a/mac/tkMacDefault.h b/mac/tkMacDefault.h
deleted file mode 100644
index 30cf1f3..0000000
--- a/mac/tkMacDefault.h
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * tkMacDefault.h --
- *
- * This file defines the defaults for all options for all of
- * the Tk widgets.
- *
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#ifndef _TKMACDEFAULT
-#define _TKMACDEFAULT
-
-/*
- * The definitions below provide symbolic names for the default colors.
- * NORMAL_BG - Normal background color.
- * ACTIVE_BG - Background color when widget is active.
- * SELECT_BG - Background color for selected text.
- * SELECT_FG - Foreground color for selected text.
- * TROUGH - Background color for troughs in scales and scrollbars.
- * INDICATOR - Color for indicator when button is selected.
- * DISABLED - Foreground color when widget is disabled.
- */
-
-#define BLACK "Black"
-#define WHITE "White"
-
-#define NORMAL_BG "systemWindowBody"
-#define ACTIVE_BG "#ececec"
-#define SELECT_BG "systemHighlight"
-#define SELECT_FG "systemHighlightText"
-#define TROUGH "#c3c3c3"
-#define INDICATOR "#b03060"
-#define DISABLED "#a3a3a3"
-
-/*
- * Defaults for labels, buttons, checkbuttons, and radiobuttons:
- */
-
-#define DEF_BUTTON_ANCHOR "center"
-#define DEF_BUTTON_ACTIVE_BG_COLOR "systemButtonText"
-#define DEF_BUTTON_ACTIVE_BG_MONO BLACK
-#define DEF_BUTTON_ACTIVE_FG_COLOR "systemButtonFace"
-#define DEF_CHKRAD_ACTIVE_FG_COLOR DEF_BUTTON_ACTIVE_FG_COLOR
-#define DEF_BUTTON_ACTIVE_FG_MONO WHITE
-#define DEF_BUTTON_BG_COLOR "systemButtonFace"
-#define DEF_BUTTON_BG_MONO WHITE
-#define DEF_BUTTON_BITMAP ""
-#define DEF_BUTTON_BORDER_WIDTH "2"
-#define DEF_BUTTON_CURSOR ""
-#define DEF_BUTTON_COMMAND ""
-#define DEF_BUTTON_COMPOUND "none"
-#define DEF_BUTTON_DEFAULT "disabled"
-#define DEF_BUTTON_DISABLED_FG_COLOR DISABLED
-#define DEF_BUTTON_DISABLED_FG_MONO ""
-#define DEF_BUTTON_FG "systemButtonText"
-#define DEF_CHKRAD_FG DEF_BUTTON_FG
-#define DEF_BUTTON_FONT "system"
-#define DEF_BUTTON_HEIGHT "0"
-#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
-#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO
-#define DEF_BUTTON_HIGHLIGHT "systemButtonFrame"
-#define DEF_LABEL_HIGHLIGHT_WIDTH "0"
-#define DEF_BUTTON_HIGHLIGHT_WIDTH "4"
-#define DEF_BUTTON_IMAGE (char *) NULL
-#define DEF_BUTTON_INDICATOR "1"
-#define DEF_BUTTON_JUSTIFY "center"
-#define DEF_BUTTON_OFF_VALUE "0"
-#define DEF_BUTTON_ON_VALUE "1"
-#define DEF_BUTTON_OVER_RELIEF ""
-#define DEF_BUTTON_PADX "7"
-#define DEF_LABCHKRAD_PADX "1"
-#define DEF_BUTTON_PADY "3"
-#define DEF_LABCHKRAD_PADY "1"
-#define DEF_BUTTON_RELIEF "flat"
-#define DEF_LABCHKRAD_RELIEF "flat"
-#define DEF_BUTTON_REPEAT_DELAY "0"
-#define DEF_BUTTON_REPEAT_INTERVAL "0"
-#define DEF_BUTTON_SELECT_COLOR INDICATOR
-#define DEF_BUTTON_SELECT_MONO BLACK
-#define DEF_BUTTON_SELECT_IMAGE (char *) NULL
-#define DEF_BUTTON_STATE "normal"
-#define DEF_LABEL_TAKE_FOCUS "0"
-#define DEF_BUTTON_TAKE_FOCUS (char *) NULL
-#define DEF_BUTTON_TEXT ""
-#define DEF_BUTTON_TEXT_VARIABLE ""
-#define DEF_BUTTON_UNDERLINE "-1"
-#define DEF_BUTTON_VALUE ""
-#define DEF_BUTTON_WIDTH "0"
-#define DEF_BUTTON_WRAP_LENGTH "0"
-#define DEF_RADIOBUTTON_VARIABLE "selectedButton"
-#define DEF_CHECKBUTTON_VARIABLE ""
-
-/*
- * Defaults for canvases:
- */
-
-#define DEF_CANVAS_BG_COLOR NORMAL_BG
-#define DEF_CANVAS_BG_MONO WHITE
-#define DEF_CANVAS_BORDER_WIDTH "0"
-#define DEF_CANVAS_CLOSE_ENOUGH "1"
-#define DEF_CANVAS_CONFINE "1"
-#define DEF_CANVAS_CURSOR ""
-#define DEF_CANVAS_HEIGHT "7c"
-#define DEF_CANVAS_HIGHLIGHT_BG NORMAL_BG
-#define DEF_CANVAS_HIGHLIGHT BLACK
-#define DEF_CANVAS_HIGHLIGHT_WIDTH "3"
-#define DEF_CANVAS_INSERT_BG BLACK
-#define DEF_CANVAS_INSERT_BD_COLOR "0"
-#define DEF_CANVAS_INSERT_BD_MONO "0"
-#define DEF_CANVAS_INSERT_OFF_TIME "300"
-#define DEF_CANVAS_INSERT_ON_TIME "600"
-#define DEF_CANVAS_INSERT_WIDTH "2"
-#define DEF_CANVAS_RELIEF "flat"
-#define DEF_CANVAS_SCROLL_REGION ""
-#define DEF_CANVAS_SELECT_COLOR SELECT_BG
-#define DEF_CANVAS_SELECT_MONO BLACK
-#define DEF_CANVAS_SELECT_BD_COLOR "1"
-#define DEF_CANVAS_SELECT_BD_MONO "0"
-#define DEF_CANVAS_SELECT_FG_COLOR BLACK
-#define DEF_CANVAS_SELECT_FG_MONO WHITE
-#define DEF_CANVAS_TAKE_FOCUS (char *) NULL
-#define DEF_CANVAS_WIDTH "10c"
-#define DEF_CANVAS_X_SCROLL_CMD ""
-#define DEF_CANVAS_X_SCROLL_INCREMENT "0"
-#define DEF_CANVAS_Y_SCROLL_CMD ""
-#define DEF_CANVAS_Y_SCROLL_INCREMENT "0"
-
-/*
- * Defaults for entries:
- */
-
-#define DEF_ENTRY_BG_COLOR NORMAL_BG
-#define DEF_ENTRY_BG_MONO WHITE
-/* #define DEF_ENTRY_BORDER_WIDTH "2" */
-#define DEF_ENTRY_BORDER_WIDTH "1"
-#define DEF_ENTRY_CURSOR "xterm"
-#define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG
-#define DEF_ENTRY_DISABLED_BG_MONO WHITE
-#define DEF_ENTRY_DISABLED_FG DISABLED
-#define DEF_ENTRY_EXPORT_SELECTION "1"
-#define DEF_ENTRY_FONT "Helvetica 12"
-#define DEF_ENTRY_FG BLACK
-#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG
-#define DEF_ENTRY_HIGHLIGHT BLACK
-/* #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" */
-#define DEF_ENTRY_HIGHLIGHT_WIDTH "0"
-#define DEF_ENTRY_INSERT_BG BLACK
-#define DEF_ENTRY_INSERT_BD_COLOR "0"
-#define DEF_ENTRY_INSERT_BD_MONO "0"
-#define DEF_ENTRY_INSERT_OFF_TIME "300"
-#define DEF_ENTRY_INSERT_ON_TIME "600"
-/* #define DEF_ENTRY_INSERT_WIDTH "2" */
-#define DEF_ENTRY_INSERT_WIDTH "1"
-#define DEF_ENTRY_JUSTIFY "left"
-#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG
-#define DEF_ENTRY_READONLY_BG_MONO WHITE
-/* #define DEF_ENTRY_RELIEF "sunken" */
-#define DEF_ENTRY_RELIEF "solid"
-#define DEF_ENTRY_SCROLL_COMMAND ""
-#define DEF_ENTRY_SELECT_COLOR SELECT_BG
-#define DEF_ENTRY_SELECT_MONO BLACK
-#define DEF_ENTRY_SELECT_BD_COLOR "1"
-#define DEF_ENTRY_SELECT_BD_MONO "0"
-#define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG
-#define DEF_ENTRY_SELECT_FG_MONO WHITE
-#define DEF_ENTRY_SHOW (char *) NULL
-#define DEF_ENTRY_STATE "normal"
-#define DEF_ENTRY_TAKE_FOCUS (char *) NULL
-#define DEF_ENTRY_TEXT_VARIABLE ""
-#define DEF_ENTRY_WIDTH "20"
-
-/*
- * Defaults for frames:
- */
-
-#define DEF_FRAME_BG_COLOR NORMAL_BG
-#define DEF_FRAME_BG_MONO WHITE
-#define DEF_FRAME_BORDER_WIDTH "0"
-#define DEF_FRAME_CLASS "Frame"
-#define DEF_FRAME_COLORMAP ""
-#define DEF_FRAME_CONTAINER "0"
-#define DEF_FRAME_CURSOR ""
-#define DEF_FRAME_HEIGHT "0"
-#define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG
-#define DEF_FRAME_HIGHLIGHT BLACK
-#define DEF_FRAME_HIGHLIGHT_WIDTH "0"
-#define DEF_FRAME_PADX "0"
-#define DEF_FRAME_PADY "0"
-#define DEF_FRAME_RELIEF "flat"
-#define DEF_FRAME_TAKE_FOCUS "0"
-#define DEF_FRAME_VISUAL ""
-#define DEF_FRAME_WIDTH "0"
-
-/*
- * Defaults for labelframes:
- */
-
-#define DEF_LABELFRAME_BORDER_WIDTH "2"
-#define DEF_LABELFRAME_CLASS "Labelframe"
-#define DEF_LABELFRAME_RELIEF "groove"
-#define DEF_LABELFRAME_FG "systemButtonText"
-#define DEF_LABELFRAME_FONT "system"
-#define DEF_LABELFRAME_TEXT ""
-#define DEF_LABELFRAME_LABELANCHOR "nw"
-
-/*
- * Defaults for listboxes:
- */
-
-#define DEF_LISTBOX_ACTIVE_STYLE "underline"
-#define DEF_LISTBOX_BG_COLOR NORMAL_BG
-#define DEF_LISTBOX_BG_MONO WHITE
-#define DEF_LISTBOX_BORDER_WIDTH "1"
-#define DEF_LISTBOX_CURSOR ""
-#define DEF_LISTBOX_DISABLED_FG DISABLED
-#define DEF_LISTBOX_EXPORT_SELECTION "1"
-#define DEF_LISTBOX_FONT "application"
-#define DEF_LISTBOX_FG BLACK
-#define DEF_LISTBOX_HEIGHT "10"
-#define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG
-#define DEF_LISTBOX_HIGHLIGHT BLACK
-#define DEF_LISTBOX_HIGHLIGHT_WIDTH "0"
-#define DEF_LISTBOX_RELIEF "solid"
-#define DEF_LISTBOX_SCROLL_COMMAND ""
-#define DEF_LISTBOX_LIST_VARIABLE ""
-#define DEF_LISTBOX_SELECT_COLOR SELECT_BG
-#define DEF_LISTBOX_SELECT_MONO BLACK
-#define DEF_LISTBOX_SELECT_BD "0"
-#define DEF_LISTBOX_SELECT_FG_COLOR SELECT_FG
-#define DEF_LISTBOX_SELECT_FG_MONO WHITE
-#define DEF_LISTBOX_SELECT_MODE "browse"
-#define DEF_LISTBOX_SET_GRID "0"
-#define DEF_LISTBOX_STATE "normal"
-#define DEF_LISTBOX_TAKE_FOCUS (char *) NULL
-#define DEF_LISTBOX_WIDTH "20"
-
-/*
- * Defaults for individual entries of menus:
- */
-
-#define DEF_MENU_ENTRY_ACTIVE_BG (char *) NULL
-#define DEF_MENU_ENTRY_ACTIVE_FG (char *) NULL
-#define DEF_MENU_ENTRY_ACCELERATOR (char *) NULL
-#define DEF_MENU_ENTRY_BG (char *) NULL
-#define DEF_MENU_ENTRY_BITMAP None
-#define DEF_MENU_ENTRY_COLUMN_BREAK "0"
-#define DEF_MENU_ENTRY_COMMAND (char *) NULL
-#define DEF_MENU_ENTRY_COMPOUND "none"
-#define DEF_MENU_ENTRY_FG (char *) NULL
-#define DEF_MENU_ENTRY_FONT (char *) NULL
-#define DEF_MENU_ENTRY_HIDE_MARGIN "0"
-#define DEF_MENU_ENTRY_IMAGE (char *) NULL
-#define DEF_MENU_ENTRY_INDICATOR "1"
-#define DEF_MENU_ENTRY_LABEL (char *) NULL
-#define DEF_MENU_ENTRY_MENU (char *) NULL
-#define DEF_MENU_ENTRY_OFF_VALUE "0"
-#define DEF_MENU_ENTRY_ON_VALUE "1"
-#define DEF_MENU_ENTRY_SELECT_IMAGE (char *) NULL
-#define DEF_MENU_ENTRY_STATE "normal"
-#define DEF_MENU_ENTRY_VALUE (char *) NULL
-#define DEF_MENU_ENTRY_CHECK_VARIABLE (char *) NULL
-#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
-#define DEF_MENU_ENTRY_SELECT (char *) NULL
-#define DEF_MENU_ENTRY_UNDERLINE "-1"
-
-/*
- * Defaults for menus overall:
- */
-
-#define DEF_MENU_ACTIVE_BG_COLOR "SystemMenuActive"
-#define DEF_MENU_ACTIVE_BG_MONO BLACK
-#define DEF_MENU_ACTIVE_BORDER_WIDTH "0"
-#define DEF_MENU_ACTIVE_FG_COLOR "SystemMenuActiveText"
-#define DEF_MENU_ACTIVE_FG_MONO WHITE
-#define DEF_MENU_BG_COLOR "SystemMenu"
-#define DEF_MENU_BG_MONO WHITE
-#define DEF_MENU_BORDER_WIDTH "0"
-#define DEF_MENU_CURSOR "arrow"
-#define DEF_MENU_DISABLED_FG_COLOR "SystemMenuDisabled"
-#define DEF_MENU_DISABLED_FG_MONO ""
-#define DEF_MENU_FONT "system"
-#define DEF_MENU_FG "SystemMenuText"
-#define DEF_MENU_POST_COMMAND ""
-#define DEF_MENU_RELIEF "flat"
-#define DEF_MENU_SELECT_COLOR "SystemMenuActive"
-#define DEF_MENU_SELECT_MONO BLACK
-#define DEF_MENU_TAKE_FOCUS "0"
-#define DEF_MENU_TEAROFF "1"
-#define DEF_MENU_TEAROFF_CMD (char *) NULL
-#define DEF_MENU_TITLE ""
-#define DEF_MENU_TYPE "normal"
-
-/*
- * Defaults for menubuttons:
- */
-
-#define DEF_MENUBUTTON_ANCHOR "center"
-#define DEF_MENUBUTTON_ACTIVE_BG_COLOR ACTIVE_BG
-#define DEF_MENUBUTTON_ACTIVE_BG_MONO BLACK
-#define DEF_MENUBUTTON_ACTIVE_FG_COLOR BLACK
-#define DEF_MENUBUTTON_ACTIVE_FG_MONO WHITE
-#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
-#define DEF_MENUBUTTON_BG_MONO WHITE
-#define DEF_MENUBUTTON_BITMAP ""
-#define DEF_MENUBUTTON_BORDER_WIDTH "2"
-#define DEF_MENUBUTTON_CURSOR ""
-#define DEF_MENUBUTTON_DIRECTION "below"
-#define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED
-#define DEF_MENUBUTTON_DISABLED_FG_MONO ""
-#define DEF_MENUBUTTON_FONT "system"
-#define DEF_MENUBUTTON_FG BLACK
-#define DEF_MENUBUTTON_HEIGHT "0"
-#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
-#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
-#define DEF_MENUBUTTON_HIGHLIGHT BLACK
-#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
-#define DEF_MENUBUTTON_IMAGE (char *) NULL
-#define DEF_MENUBUTTON_INDICATOR "0"
-/* #define DEF_MENUBUTTON_JUSTIFY "center" */
-#define DEF_MENUBUTTON_JUSTIFY "left"
-#define DEF_MENUBUTTON_MENU ""
-#define DEF_MENUBUTTON_PADX "4p"
-#define DEF_MENUBUTTON_PADY "3p"
-#define DEF_MENUBUTTON_RELIEF "flat"
-#define DEF_MENUBUTTON_STATE "normal"
-#define DEF_MENUBUTTON_TAKE_FOCUS "0"
-#define DEF_MENUBUTTON_TEXT ""
-#define DEF_MENUBUTTON_TEXT_VARIABLE ""
-#define DEF_MENUBUTTON_UNDERLINE "-1"
-#define DEF_MENUBUTTON_WIDTH "0"
-#define DEF_MENUBUTTON_WRAP_LENGTH "0"
-
-/*
- * Defaults for messages:
- */
-
-#define DEF_MESSAGE_ANCHOR "center"
-#define DEF_MESSAGE_ASPECT "150"
-#define DEF_MESSAGE_BG_COLOR NORMAL_BG
-#define DEF_MESSAGE_BG_MONO WHITE
-#define DEF_MESSAGE_BORDER_WIDTH "2"
-#define DEF_MESSAGE_CURSOR ""
-#define DEF_MESSAGE_FG BLACK
-#define DEF_MESSAGE_FONT "system"
-#define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG
-#define DEF_MESSAGE_HIGHLIGHT BLACK
-#define DEF_MESSAGE_HIGHLIGHT_WIDTH "0"
-#define DEF_MESSAGE_JUSTIFY "left"
-#define DEF_MESSAGE_PADX "-1"
-#define DEF_MESSAGE_PADY "-1"
-#define DEF_MESSAGE_RELIEF "flat"
-#define DEF_MESSAGE_TAKE_FOCUS "0"
-#define DEF_MESSAGE_TEXT ""
-#define DEF_MESSAGE_TEXT_VARIABLE ""
-#define DEF_MESSAGE_WIDTH "0"
-
-/*
- * Defaults for panedwindows
- */
-
-#define DEF_PANEDWINDOW_BG_COLOR NORMAL_BG
-#define DEF_PANEDWINDOW_BG_MONO WHITE
-#define DEF_PANEDWINDOW_BORDERWIDTH "2"
-#define DEF_PANEDWINDOW_CURSOR ""
-#define DEF_PANEDWINDOW_HANDLEPAD "8"
-#define DEF_PANEDWINDOW_HANDLESIZE "8"
-#define DEF_PANEDWINDOW_HEIGHT ""
-#define DEF_PANEDWINDOW_OPAQUERESIZE "0"
-#define DEF_PANEDWINDOW_ORIENT "horizontal"
-#define DEF_PANEDWINDOW_RELIEF "flat"
-#define DEF_PANEDWINDOW_SASHCURSOR ""
-#define DEF_PANEDWINDOW_SASHPAD "2"
-#define DEF_PANEDWINDOW_SASHRELIEF "raised"
-#define DEF_PANEDWINDOW_SASHWIDTH "2"
-#define DEF_PANEDWINDOW_SHOWHANDLE "0"
-#define DEF_PANEDWINDOW_WIDTH ""
-
-/*
- * Defaults for panedwindow panes
- */
-
-#define DEF_PANEDWINDOW_PANE_AFTER ""
-#define DEF_PANEDWINDOW_PANE_BEFORE ""
-#define DEF_PANEDWINDOW_PANE_HEIGHT ""
-#define DEF_PANEDWINDOW_PANE_MINSIZE "0"
-#define DEF_PANEDWINDOW_PANE_PADX "0"
-#define DEF_PANEDWINDOW_PANE_PADY "0"
-#define DEF_PANEDWINDOW_PANE_STICKY "nsew"
-#define DEF_PANEDWINDOW_PANE_WIDTH ""
-
-/*
- * Defaults for scales:
- */
-
-#define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG
-#define DEF_SCALE_ACTIVE_BG_MONO BLACK
-#define DEF_SCALE_BG_COLOR NORMAL_BG
-#define DEF_SCALE_BG_MONO WHITE
-#define DEF_SCALE_BIG_INCREMENT "0"
-#define DEF_SCALE_BORDER_WIDTH "2"
-#define DEF_SCALE_COMMAND ""
-#define DEF_SCALE_CURSOR ""
-#define DEF_SCALE_DIGITS "0"
-#define DEF_SCALE_FONT "system"
-#define DEF_SCALE_FG_COLOR BLACK
-#define DEF_SCALE_FG_MONO BLACK
-#define DEF_SCALE_FROM "0"
-#define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR
-#define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO
-#define DEF_SCALE_HIGHLIGHT BLACK
-#define DEF_SCALE_HIGHLIGHT_WIDTH "0"
-#define DEF_SCALE_LABEL ""
-#define DEF_SCALE_LENGTH "100"
-#define DEF_SCALE_ORIENT "vertical"
-#define DEF_SCALE_RELIEF "flat"
-#define DEF_SCALE_REPEAT_DELAY "300"
-#define DEF_SCALE_REPEAT_INTERVAL "100"
-#define DEF_SCALE_RESOLUTION "1"
-#define DEF_SCALE_TROUGH_COLOR TROUGH
-#define DEF_SCALE_TROUGH_MONO WHITE
-#define DEF_SCALE_SHOW_VALUE "1"
-#define DEF_SCALE_SLIDER_LENGTH "30"
-#define DEF_SCALE_SLIDER_RELIEF "raised"
-#define DEF_SCALE_STATE "normal"
-#define DEF_SCALE_TAKE_FOCUS (char *) NULL
-#define DEF_SCALE_TICK_INTERVAL "0"
-#define DEF_SCALE_TO "100"
-#define DEF_SCALE_VARIABLE ""
-#define DEF_SCALE_WIDTH "15"
-
-/*
- * Defaults for scrollbars:
- */
-
-#define DEF_SCROLLBAR_ACTIVE_BG_COLOR ACTIVE_BG
-#define DEF_SCROLLBAR_ACTIVE_BG_MONO BLACK
-#define DEF_SCROLLBAR_ACTIVE_RELIEF "raised"
-#define DEF_SCROLLBAR_BG_COLOR NORMAL_BG
-#define DEF_SCROLLBAR_BG_MONO WHITE
-/* #define DEF_SCROLLBAR_BORDER_WIDTH "2" */
-#define DEF_SCROLLBAR_BORDER_WIDTH "0"
-#define DEF_SCROLLBAR_COMMAND ""
-#define DEF_SCROLLBAR_CURSOR ""
-#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1"
-#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG
-#define DEF_SCROLLBAR_HIGHLIGHT BLACK
-/* #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "2" */
-#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0"
-#define DEF_SCROLLBAR_JUMP "0"
-#define DEF_SCROLLBAR_ORIENT "vertical"
-/*#define DEF_SCROLLBAR_RELIEF "sunken" */
-#define DEF_SCROLLBAR_RELIEF "flat"
-#define DEF_SCROLLBAR_REPEAT_DELAY "300"
-#define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
-#define DEF_SCROLLBAR_TAKE_FOCUS (char *) NULL
-#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
-#define DEF_SCROLLBAR_TROUGH_MONO WHITE
-/*#define DEF_SCROLLBAR_WIDTH "15" */
-#define DEF_SCROLLBAR_WIDTH "16"
-
-/*
- * Defaults for texts:
- */
-
-#define DEF_TEXT_AUTO_SEPARATORS "1"
-#define DEF_TEXT_BG_COLOR NORMAL_BG
-#define DEF_TEXT_BG_MONO WHITE
-#define DEF_TEXT_BORDER_WIDTH "0"
-#define DEF_TEXT_CURSOR "xterm"
-#define DEF_TEXT_FG BLACK
-#define DEF_TEXT_EXPORT_SELECTION "1"
-#define DEF_TEXT_FONT "Courier 12"
-#define DEF_TEXT_HEIGHT "24"
-#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG
-#define DEF_TEXT_HIGHLIGHT BLACK
-#define DEF_TEXT_HIGHLIGHT_WIDTH "3"
-#define DEF_TEXT_INSERT_BG BLACK
-#define DEF_TEXT_INSERT_BD_COLOR "0"
-#define DEF_TEXT_INSERT_BD_MONO "0"
-#define DEF_TEXT_INSERT_OFF_TIME "300"
-#define DEF_TEXT_INSERT_ON_TIME "600"
-#define DEF_TEXT_INSERT_WIDTH "1"
-#define DEF_TEXT_MAX_UNDO "0"
-#define DEF_TEXT_PADX "1"
-#define DEF_TEXT_PADY "1"
-#define DEF_TEXT_RELIEF "flat"
-#define DEF_TEXT_SELECT_COLOR SELECT_BG
-#define DEF_TEXT_SELECT_MONO BLACK
-#define DEF_TEXT_SELECT_BD_COLOR "1"
-#define DEF_TEXT_SELECT_BD_MONO "0"
-#define DEF_TEXT_SELECT_FG_COLOR SELECT_FG
-#define DEF_TEXT_SELECT_FG_MONO WHITE
-#define DEF_TEXT_SELECT_RELIEF "solid"
-#define DEF_TEXT_SET_GRID "0"
-#define DEF_TEXT_SPACING1 "0"
-#define DEF_TEXT_SPACING2 "0"
-#define DEF_TEXT_SPACING3 "0"
-#define DEF_TEXT_STATE "normal"
-#define DEF_TEXT_TABS ""
-#define DEF_TEXT_TAKE_FOCUS (char *) NULL
-#define DEF_TEXT_UNDO "0"
-#define DEF_TEXT_WIDTH "80"
-#define DEF_TEXT_WRAP "char"
-#define DEF_TEXT_XSCROLL_COMMAND ""
-#define DEF_TEXT_YSCROLL_COMMAND ""
-
-/*
- * Defaults for canvas text:
- */
-
-#define DEF_CANVTEXT_FONT "Helvetica 12"
-
-/*
- * Defaults for toplevels (most of the defaults for frames also apply
- * to toplevels):
- */
-
-#define DEF_TOPLEVEL_CLASS "Toplevel"
-#define DEF_TOPLEVEL_MENU ""
-#define DEF_TOPLEVEL_SCREEN ""
-#define DEF_TOPLEVEL_USE ""
-
-#endif /* _TKMACDEFAULT */
diff --git a/mac/tkMacDialog.c b/mac/tkMacDialog.c
deleted file mode 100644
index b00ff9d..0000000
--- a/mac/tkMacDialog.c
+++ /dev/null
@@ -1,1418 +0,0 @@
-/*
- * tkMacDialog.c --
- *
- * Contains the Mac implementation of the common dialog boxes.
- *
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Gestalt.h>
-#include <Aliases.h>
-#include <Errors.h>
-#include <Strings.h>
-#include <MoreFiles.h>
-#include <MoreFilesExtras.h>
-#include <StandardFile.h>
-#include <ColorPicker.h>
-#include <Lowmem.h>
-#include <Navigation.h>
-#include "tkPort.h"
-#include "tkInt.h"
-#include "tclMacInt.h"
-#include "tkMacInt.h"
-#include "tkFileFilter.h"
-
-#ifndef StrLength
-#define StrLength(s) (*((unsigned char *) (s)))
-#endif
-#ifndef StrBody
-#define StrBody(s) ((char *) (s) + 1)
-#endif
-
-/*
- * The following are ID's for resources that are defined in tkMacResource.r
- */
-#define OPEN_BOX 130
-#define OPEN_POPUP 131
-#define OPEN_MENU 132
-#define OPEN_POPUP_ITEM 10
-
-#define SAVE_FILE 0
-#define OPEN_FILE 1
-#define CHOOSE_FOLDER 2
-
-#define MATCHED 0
-#define UNMATCHED 1
-
-/*
- * The following structure is used in the GetFileName() function. It stored
- * information about the file dialog and the file filters.
- */
-typedef struct _OpenFileData {
- FileFilterList fl; /* List of file filters. */
- SInt16 curType; /* The filetype currently being
- * listed. */
- short popupItem; /* Item number of the popup in the
- * dialog. */
- int usePopup; /* True if we show the popup menu (this
- * is an open operation and the
- * -filetypes option is set). */
-} OpenFileData;
-
-
-static pascal Boolean FileFilterProc _ANSI_ARGS_((CInfoPBPtr pb,
- void *myData));
-static int GetFileName _ANSI_ARGS_ ((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[], int isOpen));
-static int NavGetFileName _ANSI_ARGS_ ((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[], int isOpen));
-static Boolean MatchOneType _ANSI_ARGS_((StringPtr fileNamePtr, OSType fileType,
- OpenFileData *myofdPtr, FileFilter *filterPtr));
-static pascal short OpenHookProc _ANSI_ARGS_((short item,
- DialogPtr theDialog, OpenFileData * myofdPtr));
-static int ParseFileDlgArgs _ANSI_ARGS_ ((Tcl_Interp * interp,
- OpenFileData * myofdPtr, int argc, char ** argv,
- int isOpen));
-static pascal Boolean OpenFileFilterProc(AEDesc* theItem, void* info,
- NavCallBackUserData callBackUD,
- NavFilterModes filterMode );
-pascal void OpenEventProc(NavEventCallbackMessage callBackSelector,
- NavCBRecPtr callBackParms,
- NavCallBackUserData callBackUD );
-static void InitFileDialogs();
-static int StdGetFile(Tcl_Interp *interp, OpenFileData *ofd,
- unsigned char *initialFile, int isOpen);
-static int NavServicesGetFile(Tcl_Interp *interp, OpenFileData *ofd,
- AEDesc *initialDesc, unsigned char *initialFile,
- StringPtr title, StringPtr message, int multiple, int isOpen);
-static int HandleInitialDirectory (Tcl_Interp *interp, char *initialDir, FSSpec *dirSpec,
- AEDesc *dirDescPtr);
-/*
- * Filter and hook functions used by the tk_getOpenFile and tk_getSaveFile
- * commands.
- */
-
-int fileDlgInited = 0;
-int useNavServices = 0;
-NavObjectFilterUPP openFileFilterUPP;
-NavEventUPP openFileEventUPP;
-
-static FileFilterYDUPP openFilter = NULL;
-static DlgHookYDUPP openHook = NULL;
-static DlgHookYDUPP saveHook = NULL;
-
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_ChooseColorObjCmd --
- *
- * This procedure implements the color dialog box for the Mac
- * platform. See the user documentation for details on what it
- * does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-int
-Tk_ChooseColorObjCmd(
- ClientData clientData, /* Main window associated with interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
-{
- Tk_Window parent;
- char *title;
- int i, picked, srcRead, dstWrote;
- long response;
- OSErr err;
- static inited = 0;
- static RGBColor in;
- static CONST char *optionStrings[] = {
- "-initialcolor", "-parent", "-title", NULL
- };
- enum options {
- COLOR_INITIAL, COLOR_PARENT, COLOR_TITLE
- };
-
- if (inited == 0) {
- /*
- * 'in' stores the last color picked. The next time the color dialog
- * pops up, the last color will remain in the dialog.
- */
-
- in.red = 0xffff;
- in.green = 0xffff;
- in.blue = 0xffff;
- inited = 1;
- }
-
- parent = (Tk_Window) clientData;
- title = "Choose a color:";
- picked = 0;
-
- for (i = 1; i < objc; i += 2) {
- int index;
- char *option, *value;
-
- if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option",
- TCL_EXACT, &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (i + 1 == objc) {
- option = Tcl_GetStringFromObj(objv[i], NULL);
- Tcl_AppendResult(interp, "value for \"", option, "\" missing",
- (char *) NULL);
- return TCL_ERROR;
- }
- value = Tcl_GetStringFromObj(objv[i + 1], NULL);
-
- switch ((enum options) index) {
- case COLOR_INITIAL: {
- XColor *colorPtr;
-
- colorPtr = Tk_GetColor(interp, parent, value);
- if (colorPtr == NULL) {
- return TCL_ERROR;
- }
- in.red = colorPtr->red;
- in.green = colorPtr->green;
- in.blue = colorPtr->blue;
- Tk_FreeColor(colorPtr);
- break;
- }
- case COLOR_PARENT: {
- parent = Tk_NameToWindow(interp, value, parent);
- if (parent == NULL) {
- return TCL_ERROR;
- }
- break;
- }
- case COLOR_TITLE: {
- title = value;
- break;
- }
- }
- }
-
- /*
- * Use the gestalt manager to determine how to bring
- * up the color picker. If versin 2.0 isn't available
- * we can assume version 1.0 is available as it comes with
- * Color Quickdraw which Tk requires to run at all.
- */
-
- err = Gestalt(gestaltColorPicker, &response);
- if ((err == noErr) && (response == 0x0200L)) {
- ColorPickerInfo cpinfo;
-
- /*
- * Version 2.0 of the color picker is available. Let's use it
- */
-
- cpinfo.theColor.profile = 0L;
- cpinfo.theColor.color.rgb.red = in.red;
- cpinfo.theColor.color.rgb.green = in.green;
- cpinfo.theColor.color.rgb.blue = in.blue;
- cpinfo.dstProfile = 0L;
- cpinfo.flags = kColorPickerCanModifyPalette | kColorPickerCanAnimatePalette;
- cpinfo.placeWhere = kDeepestColorScreen;
- cpinfo.pickerType = 0L;
- cpinfo.eventProc = NULL;
- cpinfo.colorProc = NULL;
- cpinfo.colorProcData = NULL;
-
- Tcl_UtfToExternal(NULL, NULL, title, -1, 0, NULL,
- StrBody(cpinfo.prompt), 255, &srcRead, &dstWrote, NULL);
- StrLength(cpinfo.prompt) = (unsigned char) dstWrote;
-
- if ((PickColor(&cpinfo) == noErr) && (cpinfo.newColorChosen != 0)) {
- in.red = cpinfo.theColor.color.rgb.red;
- in.green = cpinfo.theColor.color.rgb.green;
- in.blue = cpinfo.theColor.color.rgb.blue;
- picked = 1;
- }
- } else {
- RGBColor out;
- Str255 prompt;
- Point point = {-1, -1};
-
- /*
- * Use version 1.0 of the color picker
- */
-
- Tcl_UtfToExternal(NULL, NULL, title, -1, 0, NULL, StrBody(prompt),
- 255, &srcRead, &dstWrote, NULL);
- StrLength(prompt) = (unsigned char) dstWrote;
-
- if (GetColor(point, prompt, &in, &out)) {
- in = out;
- picked = 1;
- }
- }
-
- if (picked != 0) {
- char result[32];
-
- sprintf(result, "#%02x%02x%02x", in.red >> 8, in.green >> 8,
- in.blue >> 8);
- Tcl_AppendResult(interp, result, NULL);
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_GetOpenFileObjCmd --
- *
- * This procedure implements the "open file" dialog box for the
- * Mac platform. See the user documentation for details on what
- * it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See user documentation.
- *----------------------------------------------------------------------
- */
-
-int
-Tk_GetOpenFileObjCmd(
- ClientData clientData, /* Main window associated with interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
-{
- int i, result, multiple;
- OpenFileData ofd;
- Tk_Window parent;
- Str255 message, title;
- AEDesc initialDesc = {typeNull, NULL};
- FSSpec dirSpec;
- static CONST char *openOptionStrings[] = {
- "-defaultextension", "-filetypes",
- "-initialdir", "-initialfile",
- "-message", "-multiple",
- "-parent", "-title", NULL
- };
- enum openOptions {
- OPEN_DEFAULT, OPEN_TYPES,
- OPEN_INITDIR, OPEN_INITFILE,
- OPEN_MESSAGE, OPEN_MULTIPLE,
- OPEN_PARENT, OPEN_TITLE
- };
-
- if (!fileDlgInited) {
- InitFileDialogs();
- }
-
- result = TCL_ERROR;
- parent = (Tk_Window) clientData;
- multiple = false;
- title[0] = 0;
- message[0] = 0;
-
- TkInitFileFilters(&ofd.fl);
-
- ofd.curType = 0;
- ofd.popupItem = OPEN_POPUP_ITEM;
- ofd.usePopup = 1;
-
- for (i = 1; i < objc; i += 2) {
- char *choice;
- int index, choiceLen;
- char *string;
- int srcRead, dstWrote;
-
- if (Tcl_GetIndexFromObj(interp, objv[i], openOptionStrings, "option",
- TCL_EXACT, &index) != TCL_OK) {
- result = TCL_ERROR;
- goto end;
- }
- if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(objv[i], NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
- result = TCL_ERROR;
- goto end;
- }
-
- switch (index) {
- case OPEN_DEFAULT:
- break;
- case OPEN_TYPES:
- choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
- if (TkGetFileFilters(interp, &ofd.fl, choice, 0)
- != TCL_OK) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case OPEN_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
- if (HandleInitialDirectory(interp, choice, &dirSpec,
- &initialDesc) != TCL_OK) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case OPEN_INITFILE:
- break;
- case OPEN_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- Tcl_UtfToExternal(NULL, NULL, choice, choiceLen,
- 0, NULL, StrBody(message), 255,
- &srcRead, &dstWrote, NULL);
- message[0] = dstWrote;
- break;
- case OPEN_MULTIPLE:
- if (Tcl_GetBooleanFromObj(interp, objv[i + 1], &multiple) != TCL_OK) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case OPEN_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice, parent);
- if (parent == NULL) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case OPEN_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- Tcl_UtfToExternal(NULL, NULL, choice, choiceLen,
- 0, NULL, StrBody(title), 255,
- &srcRead, &dstWrote, NULL);
- title[0] = dstWrote;
- break;
- }
- }
-
- if (useNavServices) {
- AEDesc *initialPtr = NULL;
-
- if (initialDesc.descriptorType == typeFSS) {
- initialPtr = &initialDesc;
- }
- result = NavServicesGetFile(interp, &ofd, initialPtr, NULL,
- title, message, multiple, OPEN_FILE);
- } else {
- result = StdGetFile(interp, &ofd, NULL, OPEN_FILE);
- }
-
- end:
- TkFreeFileFilters(&ofd.fl);
- AEDisposeDesc(&initialDesc);
-
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_GetSaveFileObjCmd --
- *
- * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box
- * instead
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See user documentation.
- *----------------------------------------------------------------------
- */
-
-int
-Tk_GetSaveFileObjCmd(
- ClientData clientData, /* Main window associated with interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
-{
- int i, result;
- Str255 initialFile;
- Tk_Window parent;
- AEDesc initialDesc = {typeNull, NULL};
- FSSpec dirSpec;
- Str255 title, message;
- OpenFileData ofd;
- static CONST char *saveOptionStrings[] = {
- "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-message", "-parent", "-title", NULL
- };
- enum saveOptions {
- SAVE_DEFAULT, SAVE_TYPES, SAVE_INITDIR, SAVE_INITFILE,
- SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE
- };
-
- if (!fileDlgInited) {
- InitFileDialogs();
- }
-
- result = TCL_ERROR;
- parent = (Tk_Window) clientData;
- StrLength(initialFile) = 0;
- title[0] = 0;
- message[0] = 0;
-
-
- for (i = 1; i < objc; i += 2) {
- char *choice;
- int index, choiceLen;
- char *string;
- Tcl_DString ds;
- int srcRead, dstWrote;
-
- if (Tcl_GetIndexFromObj(interp, objv[i], saveOptionStrings, "option",
- TCL_EXACT, &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(objv[i], NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
- return TCL_ERROR;
- }
- switch (index) {
- case SAVE_DEFAULT:
- break;
- case SAVE_TYPES:
- break;
- case SAVE_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
- if (HandleInitialDirectory(interp, choice, &dirSpec,
- &initialDesc) != TCL_OK) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case SAVE_INITFILE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (Tcl_TranslateFileName(interp, choice, &ds) == NULL) {
- result = TCL_ERROR;
- goto end;
- }
- Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds), 0, NULL,
- StrBody(initialFile), 255, &srcRead, &dstWrote, NULL);
- StrLength(initialFile) = (unsigned char) dstWrote;
- Tcl_DStringFree(&ds);
- break;
- case SAVE_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- Tcl_UtfToExternal(NULL, NULL, choice, choiceLen,
- 0, NULL, StrBody(message), 255,
- &srcRead, &dstWrote, NULL);
- StrLength(message) = (unsigned char) dstWrote;
- break;
- case SAVE_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice, parent);
- if (parent == NULL) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case SAVE_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- Tcl_UtfToExternal(NULL, NULL, choice, choiceLen,
- 0, NULL, StrBody(title), 255,
- &srcRead, &dstWrote, NULL);
- StrLength(title) = (unsigned char) dstWrote;
- break;
- }
- }
-
- TkInitFileFilters(&ofd.fl);
- ofd.usePopup = 0;
-
- if (useNavServices) {
- AEDesc *initialPtr = NULL;
-
- if (initialDesc.descriptorType == typeFSS) {
- initialPtr = &initialDesc;
- }
- result = NavServicesGetFile(interp, &ofd, initialPtr, initialFile,
- title, message, false, SAVE_FILE);
- } else {
- result = StdGetFile(interp, NULL, initialFile, SAVE_FILE);
- }
-
- end:
-
- AEDisposeDesc(&initialDesc);
-
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_ChooseDirectoryObjCmd --
- *
- * This procedure implements the "tk_chooseDirectory" dialog box
- * for the Windows platform. See the user documentation for details
- * on what it does.
- *
- * Results:
- * See user documentation.
- *
- * Side effects:
- * A modal dialog window is created. Tcl_SetServiceMode() is
- * called to allow background events to be processed
- *
- *----------------------------------------------------------------------
- */
-
-int
-Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- int i, result;
- Tk_Window parent;
- AEDesc initialDesc = {typeNull, NULL};
- FSSpec dirSpec;
- Str255 message, title;
- int srcRead, dstWrote;
- OpenFileData ofd;
- static CONST char *chooseOptionStrings[] = {
- "-initialdir", "-message", "-mustexist", "-parent", "-title", NULL
- };
- enum chooseOptions {
- CHOOSE_INITDIR, CHOOSE_MESSAGE, CHOOSE_MUSTEXIST,
- CHOOSE_PARENT, CHOOSE_TITLE
- };
-
-
- if (!NavServicesAvailable()) {
- return TCL_ERROR;
- }
-
- if (!fileDlgInited) {
- InitFileDialogs();
- }
- result = TCL_ERROR;
- parent = (Tk_Window) clientData;
- title[0] = 0;
- message[0] = 0;
-
- for (i = 1; i < objc; i += 2) {
- char *choice;
- int index, choiceLen;
- char *string;
-
- if (Tcl_GetIndexFromObj(interp, objv[i], chooseOptionStrings, "option",
- TCL_EXACT, &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(objv[i], NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
- return TCL_ERROR;
- }
- switch (index) {
- case CHOOSE_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
- if (HandleInitialDirectory(interp, choice, &dirSpec,
- &initialDesc) != TCL_OK) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case CHOOSE_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- Tcl_UtfToExternal(NULL, NULL, choice, choiceLen,
- 0, NULL, StrBody(message), 255,
- &srcRead, &dstWrote, NULL);
- StrLength(message) = (unsigned char) dstWrote;
- break;
- case CHOOSE_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice, parent);
- if (parent == NULL) {
- result = TCL_ERROR;
- goto end;
- }
- break;
- case CHOOSE_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- Tcl_UtfToExternal(NULL, NULL, choice, choiceLen,
- 0, NULL, StrBody(title), 255,
- &srcRead, &dstWrote, NULL);
- StrLength(title) = (unsigned char) dstWrote;
- break;
- }
- }
-
- TkInitFileFilters(&ofd.fl);
- ofd.usePopup = 0;
-
- if (useNavServices) {
- AEDesc *initialPtr = NULL;
-
- if (initialDesc.descriptorType == typeFSS) {
- initialPtr = &initialDesc;
- }
- result = NavServicesGetFile(interp, &ofd, initialPtr, NULL,
- title, message, false, CHOOSE_FOLDER);
- } else {
- result = TCL_ERROR;
- }
-
- end:
- AEDisposeDesc(&initialDesc);
-
- return result;
-}
-
-int
-HandleInitialDirectory (
- Tcl_Interp *interp,
- char *initialDir,
- FSSpec *dirSpec,
- AEDesc *dirDescPtr)
-{
- Tcl_DString ds;
- long dirID;
- OSErr err;
- Boolean isDirectory;
- Str255 dir;
- int srcRead, dstWrote;
-
- if (Tcl_TranslateFileName(interp, initialDir, &ds) == NULL) {
- return TCL_ERROR;
- }
- Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds), 0, NULL, StrBody(dir), 255,
- &srcRead, &dstWrote, NULL);
- StrLength(dir) = (unsigned char) dstWrote;
- Tcl_DStringFree(&ds);
-
- err = FSpLocationFromPath(StrLength(dir), StrBody(dir), dirSpec);
- if (err != noErr) {
- Tcl_AppendResult(interp, "bad directory \"", initialDir, "\"", NULL);
- return TCL_ERROR;
- }
- err = FSpGetDirectoryIDTcl(dirSpec, &dirID, &isDirectory);
- if ((err != noErr) || !isDirectory) {
- Tcl_AppendResult(interp, "bad directory \"", initialDir, "\"", NULL);
- return TCL_ERROR;
- }
-
- if (useNavServices) {
- AECreateDesc( typeFSS, dirSpec, sizeof(*dirSpec), dirDescPtr);
- } else {
- /*
- * Make sure you negate -dirSpec.vRefNum because the
- * standard file package wants it that way !
- */
-
- LMSetSFSaveDisk(-dirSpec->vRefNum);
- LMSetCurDirStore(dirID);
- }
- return TCL_OK;
-}
-
-static void
-InitFileDialogs()
-{
- fileDlgInited = 1;
-
- if (NavServicesAvailable()) {
- openFileFilterUPP = NewNavObjectFilterProc(OpenFileFilterProc);
- openFileEventUPP = NewNavEventProc(OpenEventProc);
- useNavServices = 1;
- } else {
- openFilter = NewFileFilterYDProc(FileFilterProc);
- openHook = NewDlgHookYDProc(OpenHookProc);
- saveHook = NewDlgHookYDProc(OpenHookProc);
- useNavServices = 0;
- }
-
-
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * GetFileName --
- *
- * Calls the Mac file dialog functions for the user to choose a
- * file to or save.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * If the user selects a file, the native pathname of the file
- * is returned in the interp's result. Otherwise an empty string
- * is returned in the interp's result.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GetFileName(
- ClientData clientData, /* Main window associated with interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
- int isOpen) /* true if we should call GetOpenFileName(),
- * false if we should call GetSaveFileName() */
-{
- return TCL_OK;
-}
-
-static int
-NavServicesGetFile(
- Tcl_Interp *interp,
- OpenFileData *ofdPtr,
- AEDesc *initialDesc,
- unsigned char *initialFile,
- StringPtr title,
- StringPtr message,
- int multiple,
- int isOpen)
-{
- NavReplyRecord theReply;
- NavDialogOptions diagOptions;
- OSErr err;
- Tcl_Obj *theResult;
- int result;
-
-
- diagOptions.location.h = -1;
- diagOptions.location.v = -1;
- diagOptions.dialogOptionFlags = kNavDontAutoTranslate
- + kNavDontAddTranslateItems;
-
- if (multiple) {
- diagOptions.dialogOptionFlags += kNavAllowMultipleFiles;
- }
-
- if (ofdPtr != NULL && ofdPtr->usePopup) {
- FileFilter *filterPtr;
-
- filterPtr = ofdPtr->fl.filters;
- if (filterPtr == NULL) {
- ofdPtr->usePopup = 0;
- }
- }
-
- if (ofdPtr != NULL && ofdPtr->usePopup) {
- NavMenuItemSpecHandle popupExtensionHandle = NULL;
- NavMenuItemSpec *popupItems;
- FileFilter *filterPtr;
- short index = 0;
-
- ofdPtr->curType = 0;
-
- popupExtensionHandle = (NavMenuItemSpecHandle) NewHandle(ofdPtr->fl.numFilters
- * sizeof(NavMenuItemSpec));
- HLock((Handle) popupExtensionHandle);
- popupItems = *popupExtensionHandle;
-
- for (filterPtr = ofdPtr->fl.filters; filterPtr != NULL;
- filterPtr = filterPtr->next, popupItems++, index++) {
- int len;
-
- len = strlen(filterPtr->name);
- BlockMove(filterPtr->name, popupItems->menuItemName + 1, len);
- popupItems->menuItemName[0] = len;
- popupItems->menuCreator = 'WIsH';
- popupItems->menuType = index;
- }
- HUnlock((Handle) popupExtensionHandle);
- diagOptions.popupExtension = popupExtensionHandle;
- } else {
- diagOptions.dialogOptionFlags += kNavNoTypePopup;
- diagOptions.popupExtension = NULL;
- }
-
- if ((initialFile != NULL) && (initialFile[0] != 0)) {
- char *lastColon;
- int len;
-
- len = initialFile[0];
-
- p2cstr(initialFile);
- lastColon = strrchr((char *)initialFile, ':');
- if (lastColon != NULL) {
- len -= lastColon - ((char *) (initialFile + 1));
- BlockMove(lastColon + 1, diagOptions.savedFileName + 1, len);
- diagOptions.savedFileName[0] = len;
- } else {
- BlockMove(initialFile, diagOptions.savedFileName + 1, len);
- diagOptions.savedFileName[0] = len;
- }
- } else {
- diagOptions.savedFileName[0] = 0;
- }
-
- strcpy((char *) (diagOptions.clientName + 1),"Wish");
- diagOptions.clientName[0] = strlen("Wish");
-
- if (title == NULL) {
- diagOptions.windowTitle[0] = 0;
- } else {
- BlockMove(title, diagOptions.windowTitle, title[0] + 1);
- diagOptions.windowTitle[0] = title[0];
- }
-
- if (message == NULL) {
- diagOptions.message[0] = 0;
- } else {
- BlockMove(message, diagOptions.message, message[0] + 1);
- diagOptions.message[0] = message[0];
- }
-
- diagOptions.actionButtonLabel[0] = 0;
- diagOptions.cancelButtonLabel[0] = 0;
- diagOptions.preferenceKey = 0;
-
- /* Now process the selection list. We have to use the popupExtension
- * to fill the menu.
- */
-
-
- if (isOpen == OPEN_FILE) {
- err = NavGetFile(initialDesc, &theReply, &diagOptions, openFileEventUPP,
- NULL, openFileFilterUPP, NULL, ofdPtr);
- } else if (isOpen == SAVE_FILE) {
- err = NavPutFile (initialDesc, &theReply, &diagOptions, openFileEventUPP,
- 'TEXT', 'WIsH', NULL);
- } else if (isOpen == CHOOSE_FOLDER) {
- err = NavChooseFolder (initialDesc, &theReply, &diagOptions,
- openFileEventUPP, NULL, NULL);
- }
-
-
- /*
- * Most commands assume that the file dialogs return a single
- * item, not a list. So only build a list if multiple is true...
- */
-
- if (multiple) {
- theResult = Tcl_NewListObj(0, NULL);
- } else {
- theResult = Tcl_NewObj();
- }
-
- if ( theReply.validRecord && err == noErr ) {
- AEDesc resultDesc;
- long count;
- Tcl_DString fileName;
- Handle pathHandle;
- int length;
-
- if ( err == noErr ) {
- err = AECountItems(&(theReply.selection), &count);
- if (err == noErr) {
- long i;
- for (i = 1; i <= count; i++ ) {
- err = AEGetNthDesc(&(theReply.selection),
- i, typeFSS, NULL, &resultDesc);
- if (err == noErr) {
- HLock(resultDesc.dataHandle);
- pathHandle = NULL;
- FSpPathFromLocation((FSSpec *) *resultDesc.dataHandle,
- &length, &pathHandle);
- HLock(pathHandle);
- Tcl_ExternalToUtfDString(NULL, (char *) *pathHandle, -1, &fileName);
- if (multiple) {
- Tcl_ListObjAppendElement(interp, theResult,
- Tcl_NewStringObj(Tcl_DStringValue(&fileName),
- Tcl_DStringLength(&fileName)));
- } else {
- Tcl_SetStringObj(theResult, Tcl_DStringValue(&fileName),
- Tcl_DStringLength(&fileName));
- }
-
- Tcl_DStringFree(&fileName);
- HUnlock(pathHandle);
- DisposeHandle(pathHandle);
- HUnlock(resultDesc.dataHandle);
- AEDisposeDesc( &resultDesc );
- }
- }
- }
- }
- err = NavDisposeReply( &theReply );
- Tcl_SetObjResult(interp, theResult);
- result = TCL_OK;
- } else if (err == userCanceledErr) {
- result = TCL_OK;
- } else {
- result = TCL_ERROR;
- }
-
- if (diagOptions.popupExtension != NULL) {
- DisposeHandle((Handle) diagOptions.popupExtension);
- }
-
- return result;
-}
-
-static pascal Boolean
-OpenFileFilterProc(
- AEDesc* theItem, void* info,
- NavCallBackUserData callBackUD,
- NavFilterModes filterMode )
-{
- OpenFileData *ofdPtr = (OpenFileData *) callBackUD;
- if (!ofdPtr->usePopup) {
- return true;
- } else {
- if (ofdPtr->fl.numFilters == 0) {
- return true;
- } else {
-
- if ( theItem->descriptorType == typeFSS ) {
- NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*)info;
- int result;
-
- if ( !theInfo->isFolder ) {
- OSType fileType;
- StringPtr fileNamePtr;
- int i;
- FileFilter *filterPtr;
-
- fileType = theInfo->fileAndFolder.fileInfo.finderInfo.fdType;
- HLock(theItem->dataHandle);
- fileNamePtr = (((FSSpec *) *theItem->dataHandle)->name);
-
- if (ofdPtr->usePopup) {
- i = ofdPtr->curType;
- for (filterPtr=ofdPtr->fl.filters; filterPtr && i>0; i--) {
- filterPtr = filterPtr->next;
- }
- if (filterPtr) {
- result = MatchOneType(fileNamePtr, fileType,
- ofdPtr, filterPtr);
- } else {
- result = false;
- }
- } else {
- /*
- * We are not using the popup menu. In this case, the file is
- * considered matched if it matches any of the file filters.
- */
- result = UNMATCHED;
- for (filterPtr=ofdPtr->fl.filters; filterPtr;
- filterPtr=filterPtr->next) {
- if (MatchOneType(fileNamePtr, fileType,
- ofdPtr, filterPtr) == MATCHED) {
- result = MATCHED;
- break;
- }
- }
- }
-
- HUnlock(theItem->dataHandle);
- return (result == MATCHED);
- } else {
- return true;
- }
- }
- }
-
- return true;
- }
-}
-
-pascal void
-OpenEventProc(
- NavEventCallbackMessage callBackSelector,
- NavCBRecPtr callBackParams,
- NavCallBackUserData callBackUD )
-{
- NavMenuItemSpec *chosenItem;
- OpenFileData *ofd = (OpenFileData *) callBackUD;
-
- if (callBackSelector == kNavCBPopupMenuSelect) {
- chosenItem = (NavMenuItemSpec *) callBackParams->eventData.eventDataParms.param;
- ofd->curType = chosenItem->menuType;
- } else if (callBackSelector == kNavCBEvent) {
- if (callBackParams->eventData.eventDataParms.event->what == updateEvt) {
- if (TkMacConvertEvent( callBackParams->eventData.eventDataParms.event)) {
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT|TCL_WINDOW_EVENTS)) {
- /* Empty Body */
- }
- }
- }
- }
-}
-
-static int
-StdGetFile(
- Tcl_Interp *interp,
- OpenFileData *ofd,
- unsigned char *initialFile,
- int isOpen)
-{
- int i;
- StandardFileReply reply;
- Point mypoint;
- MenuHandle menu = NULL;
-
-
- /*
- * Set the items in the file types popup.
- */
-
- /*
- * Delete all the entries inside the popup menu, in case there's any
- * left overs from previous invocation of this command
- */
-
- if (ofd != NULL && ofd->usePopup) {
- FileFilter *filterPtr;
-
- menu = GetMenu(OPEN_MENU);
- for (i = CountMItems(menu); i > 0; i--) {
- /*
- * The item indices are one based. Also, if we delete from
- * the beginning, the items may be re-numbered. So we
- * delete from the end
- */
-
- DeleteMenuItem(menu, i);
- }
-
- filterPtr = ofd->fl.filters;
- if (filterPtr == NULL) {
- ofd->usePopup = 0;
- } else {
- for ( ; filterPtr != NULL; filterPtr = filterPtr->next) {
- Str255 str;
-
- StrLength(str) = (unsigned char) strlen(filterPtr->name);
- strcpy(StrBody(str), filterPtr->name);
- AppendMenu(menu, str);
- }
- }
- }
-
- /*
- * Call the toolbox file dialog function.
- */
-
- SetPt(&mypoint, -1, -1);
- TkpSetCursor(NULL);
- if (isOpen == OPEN_FILE) {
- if (ofd != NULL && ofd->usePopup) {
- CustomGetFile(openFilter, (short) -1, NULL, &reply, OPEN_BOX,
- mypoint, openHook, NULL, NULL, NULL, (void*) ofd);
- } else {
- StandardGetFile(NULL, -1, NULL, &reply);
- }
- } else if (isOpen == SAVE_FILE) {
- static Str255 prompt = "\pSave as";
-
- if (ofd != NULL && ofd->usePopup) {
- /*
- * Currently this never gets called because we don't use
- * popup for the save dialog.
- */
- CustomPutFile(prompt, initialFile, &reply, OPEN_BOX,
- mypoint, saveHook, NULL, NULL, NULL, (void *) ofd);
- } else {
- StandardPutFile(prompt, initialFile, &reply);
- }
- }
-
- /*
- * Now parse the reply, and populate the Tcl result.
- */
-
- if (reply.sfGood) {
- int length;
- Handle pathHandle;
-
- pathHandle = NULL;
- FSpPathFromLocation(&reply.sfFile, &length, &pathHandle);
- if (pathHandle != NULL) {
- Tcl_DString ds;
-
- HLock(pathHandle);
- Tcl_ExternalToUtfDString(NULL, (char *) *pathHandle, -1, &ds);
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
- Tcl_DStringFree(&ds);
- HUnlock(pathHandle);
- DisposeHandle(pathHandle);
- }
- }
-
- if (menu != NULL) {
- DisposeMenu(menu);
- }
-
- return TCL_OK;
-}
-/*
- *----------------------------------------------------------------------
- *
- * OpenHookProc --
- *
- * Gets called for various events that occur in the file dialog box.
- * Initializes the popup menu or rebuild the file list depending on
- * the type of the event.
- *
- * Results:
- * A standard result understood by the Mac file dialog event dispatcher.
- *
- * Side effects:
- * The contents in the file dialog may be changed depending on
- * the type of the event.
- *----------------------------------------------------------------------
- */
-
-static pascal short
-OpenHookProc(
- short item, /* Event description. */
- DialogPtr theDialog, /* The dialog where the event occurs. */
- OpenFileData *ofdPtr) /* Information about the file dialog. */
-{
- short ignore;
- Rect rect;
- Handle handle;
- int newType;
-
- switch (item) {
- case sfHookFirstCall:
- if (ofdPtr->usePopup) {
- /*
- * Set the popup list to display the selected type.
- */
- GetDialogItem(theDialog, ofdPtr->popupItem, &ignore, &handle,
- &rect);
- SetControlValue((ControlRef) handle, ofdPtr->curType + 1);
- }
- return sfHookNullEvent;
-
- case OPEN_POPUP_ITEM:
- if (ofdPtr->usePopup) {
- GetDialogItem(theDialog, ofdPtr->popupItem,
- &ignore, &handle, &rect);
- newType = GetControlValue((ControlRef) handle) - 1;
- if (ofdPtr->curType != newType) {
- if (newType<0 || newType>ofdPtr->fl.numFilters) {
- /*
- * Sanity check. Looks like the user selected an
- * non-existent menu item?? Don't do anything.
- */
- } else {
- ofdPtr->curType = newType;
- }
- return sfHookRebuildList;
- }
- }
- break;
- }
-
- return item;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FileFilterProc --
- *
- * Filters files according to file types. Get called whenever the
- * file list needs to be updated inside the dialog box.
- *
- * Results:
- * Returns MATCHED if the file should be shown in the listbox, returns
- * UNMATCHED otherwise.
- *
- * Side effects:
- * If MATCHED is returned, the file is shown in the listbox.
- *
- *----------------------------------------------------------------------
- */
-
-static pascal Boolean
-FileFilterProc(
- CInfoPBPtr pb, /* Information about the file */
- void *myData) /* Client data for this file dialog */
-{
- int i;
- OpenFileData * ofdPtr = (OpenFileData*)myData;
- FileFilter * filterPtr;
-
- if (ofdPtr->fl.numFilters == 0) {
- /*
- * No types have been specified. List all files by default
- */
- return MATCHED;
- }
-
- if (pb->dirInfo.ioFlAttrib & 0x10) {
- /*
- * This is a directory: always show it
- */
- return MATCHED;
- }
-
- if (ofdPtr->usePopup) {
- i = ofdPtr->curType;
- for (filterPtr=ofdPtr->fl.filters; filterPtr && i>0; i--) {
- filterPtr = filterPtr->next;
- }
- if (filterPtr) {
- return MatchOneType(pb->hFileInfo.ioNamePtr, pb->hFileInfo.ioFlFndrInfo.fdType,
- ofdPtr, filterPtr);
- } else {
- return UNMATCHED;
- }
- } else {
- /*
- * We are not using the popup menu. In this case, the file is
- * considered matched if it matches any of the file filters.
- */
-
- for (filterPtr=ofdPtr->fl.filters; filterPtr;
- filterPtr=filterPtr->next) {
- if (MatchOneType(pb->hFileInfo.ioNamePtr, pb->hFileInfo.ioFlFndrInfo.fdType,
- ofdPtr, filterPtr) == MATCHED) {
- return MATCHED;
- }
- }
- return UNMATCHED;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MatchOneType --
- *
- * Match a file with one file type in the list of file types.
- *
- * Results:
- * Returns MATCHED if the file matches with the file type; returns
- * UNMATCHED otherwise.
- *
- * Side effects:
- * None
- *
- *----------------------------------------------------------------------
- */
-
-static Boolean
-MatchOneType(
- StringPtr fileNamePtr, /* Name of the file */
- OSType fileType, /* Type of the file */
- OpenFileData * ofdPtr, /* Information about this file dialog */
- FileFilter * filterPtr) /* Match the file described by pb against
- * this filter */
-{
- FileFilterClause * clausePtr;
-
- /*
- * A file matches with a file type if it matches with at least one
- * clause of the type.
- *
- * If the clause has both glob patterns and ostypes, the file must
- * match with at least one pattern AND at least one ostype.
- *
- * If the clause has glob patterns only, the file must match with at least
- * one pattern.
- *
- * If the clause has mac types only, the file must match with at least
- * one mac type.
- *
- * If the clause has neither glob patterns nor mac types, it's
- * considered an error.
- */
-
- for (clausePtr=filterPtr->clauses; clausePtr; clausePtr=clausePtr->next) {
- int macMatched = 0;
- int globMatched = 0;
- GlobPattern * globPtr;
- MacFileType * mfPtr;
-
- if (clausePtr->patterns == NULL) {
- globMatched = 1;
- }
- if (clausePtr->macTypes == NULL) {
- macMatched = 1;
- }
-
- for (globPtr=clausePtr->patterns; globPtr; globPtr=globPtr->next) {
- char filename[256];
- int len;
- char * p, *q, *ext;
-
- if (fileNamePtr == NULL) {
- continue;
- }
- p = (char*)(fileNamePtr);
- len = p[0];
- strncpy(filename, p+1, len);
- filename[len] = '\0';
- ext = globPtr->pattern;
-
- if (ext[0] == '\0') {
- /*
- * We don't want any extensions: OK if the filename doesn't
- * have "." in it
- */
- for (q=filename; *q; q++) {
- if (*q == '.') {
- goto glob_unmatched;
- }
- }
- goto glob_matched;
- }
-
- if (Tcl_StringMatch(filename, ext)) {
- goto glob_matched;
- } else {
- goto glob_unmatched;
- }
-
- glob_unmatched:
- continue;
-
- glob_matched:
- globMatched = 1;
- break;
- }
-
- for (mfPtr=clausePtr->macTypes; mfPtr; mfPtr=mfPtr->next) {
- if (fileType == mfPtr->type) {
- macMatched = 1;
- break;
- }
- }
-
- if (globMatched && macMatched) {
- return MATCHED;
- }
- }
-
- return UNMATCHED;
-}
-
-
diff --git a/mac/tkMacDraw.c b/mac/tkMacDraw.c
deleted file mode 100644
index ddf23d2..0000000
--- a/mac/tkMacDraw.c
+++ /dev/null
@@ -1,1221 +0,0 @@
-/*
- * tkMacDraw.c --
- *
- * This file contains functions that preform drawing to
- * Xlib windows. Most of the functions simple emulate
- * Xlib functions.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkInt.h"
-#include "X.h"
-#include "Xlib.h"
-#include <stdio.h>
-#include <tcl.h>
-
-#include <Windows.h>
-#include <Fonts.h>
-#include <QDOffscreen.h>
-#include "tkMacInt.h"
-#include "tkPort.h"
-
-#ifndef PI
-# define PI 3.14159265358979323846
-#endif
-
-/*
- * Temporary regions that can be reused.
- */
-static RgnHandle tmpRgn = NULL;
-static RgnHandle tmpRgn2 = NULL;
-
-static PixPatHandle gPenPat = NULL;
-
-/*
- * Prototypes for functions used only in this file.
- */
-static unsigned char InvertByte _ANSI_ARGS_((unsigned char data));
-
-/*
- *----------------------------------------------------------------------
- *
- * XCopyArea --
- *
- * Copies data from one drawable to another using block transfer
- * routines.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Data is moved from a window or bitmap to a second window or
- * bitmap.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XCopyArea(
- Display* display, /* Display. */
- Drawable src, /* Source drawable. */
- Drawable dest, /* Destination drawable. */
- GC gc, /* GC to use. */
- int src_x, /* X & Y, width & height */
- int src_y, /* define the source rectangle */
- unsigned int width, /* the will be copied. */
- unsigned int height,
- int dest_x, /* Dest X & Y on dest rect. */
- int dest_y)
-{
- Rect srcRect, destRect;
- BitMapPtr srcBit, destBit;
- MacDrawable *srcDraw = (MacDrawable *) src;
- MacDrawable *destDraw = (MacDrawable *) dest;
- GWorldPtr srcPort, destPort;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- short tmode;
- RGBColor origForeColor, origBackColor, whiteColor, blackColor;
-
- destPort = TkMacGetDrawablePort(dest);
- srcPort = TkMacGetDrawablePort(src);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- GetForeColor(&origForeColor);
- GetBackColor(&origBackColor);
- whiteColor.red = 0;
- whiteColor.blue = 0;
- whiteColor.green = 0;
- RGBForeColor(&whiteColor);
- blackColor.red = 0xFFFF;
- blackColor.blue = 0xFFFF;
- blackColor.green = 0xFFFF;
- RGBBackColor(&blackColor);
-
-
- TkMacSetUpClippingRgn(dest);
-
- /*
- * We will change the clip rgn in this routine, so we need to
- * be able to restore it when we exit.
- */
-
- if (tmpRgn2 == NULL) {
- tmpRgn2 = NewRgn();
- }
- GetClip(tmpRgn2);
-
- if (((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) {
- RgnHandle clipRgn = (RgnHandle)
- ((TkpClipMask*)gc->clip_mask)->value.region;
-
- int xOffset, yOffset;
-
- if (tmpRgn == NULL) {
- tmpRgn = NewRgn();
- }
-
- xOffset = destDraw->xOff + gc->clip_x_origin;
- yOffset = destDraw->yOff + gc->clip_y_origin;
-
- OffsetRgn(clipRgn, xOffset, yOffset);
-
- GetClip(tmpRgn);
- SectRgn(tmpRgn, clipRgn, tmpRgn);
-
- SetClip(tmpRgn);
-
- OffsetRgn(clipRgn, -xOffset, -yOffset);
- }
-
- srcBit = &((GrafPtr) srcPort)->portBits;
- destBit = &((GrafPtr) destPort)->portBits;
- SetRect(&srcRect, (short) (srcDraw->xOff + src_x),
- (short) (srcDraw->yOff + src_y),
- (short) (srcDraw->xOff + src_x + width),
- (short) (srcDraw->yOff + src_y + height));
- SetRect(&destRect, (short) (destDraw->xOff + dest_x),
- (short) (destDraw->yOff + dest_y),
- (short) (destDraw->xOff + dest_x + width),
- (short) (destDraw->yOff + dest_y + height));
- tmode = srcCopy;
-
- CopyBits(srcBit, destBit, &srcRect, &destRect, tmode, NULL);
- RGBForeColor(&origForeColor);
- RGBBackColor(&origBackColor);
- SetClip(tmpRgn2);
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XCopyPlane --
- *
- * Copies a bitmap from a source drawable to a destination
- * drawable. The plane argument specifies which bit plane of
- * the source contains the bitmap. Note that this implementation
- * ignores the gc->function.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Changes the destination drawable.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XCopyPlane(
- Display* display, /* Display. */
- Drawable src, /* Source drawable. */
- Drawable dest, /* Destination drawable. */
- GC gc, /* The GC to use. */
- int src_x, /* X, Y, width & height */
- int src_y, /* define the source rect. */
- unsigned int width,
- unsigned int height,
- int dest_x, /* X & Y on dest where we will copy. */
- int dest_y,
- unsigned long plane) /* Which plane to copy. */
-{
- Rect srcRect, destRect;
- BitMapPtr srcBit, destBit, maskBit;
- MacDrawable *srcDraw = (MacDrawable *) src;
- MacDrawable *destDraw = (MacDrawable *) dest;
- GWorldPtr srcPort, destPort, maskPort;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- RGBColor macColor;
- TkpClipMask *clipPtr = (TkpClipMask*)gc->clip_mask;
- short tmode;
-
- destPort = TkMacGetDrawablePort(dest);
- srcPort = TkMacGetDrawablePort(src);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(dest);
-
- srcBit = &((GrafPtr) srcPort)->portBits;
- destBit = &((GrafPtr) destPort)->portBits;
- SetRect(&srcRect, (short) (srcDraw->xOff + src_x),
- (short) (srcDraw->yOff + src_y),
- (short) (srcDraw->xOff + src_x + width),
- (short) (srcDraw->yOff + src_y + height));
- SetRect(&destRect, (short) (destDraw->xOff + dest_x),
- (short) (destDraw->yOff + dest_y),
- (short) (destDraw->xOff + dest_x + width),
- (short) (destDraw->yOff + dest_y + height));
- tmode = srcOr;
- tmode = srcCopy + transparent;
-
- if (TkSetMacColor(gc->foreground, &macColor) == true) {
- RGBForeColor(&macColor);
- }
-
- if (clipPtr == NULL || clipPtr->type == TKP_CLIP_REGION) {
-
- /*
- * Case 1: opaque bitmaps.
- */
-
- TkSetMacColor(gc->background, &macColor);
- RGBBackColor(&macColor);
- tmode = srcCopy;
- CopyBits(srcBit, destBit, &srcRect, &destRect, tmode, NULL);
- } else if (clipPtr->type == TKP_CLIP_PIXMAP) {
- if (clipPtr->value.pixmap == src) {
- /*
- * Case 2: transparent bitmaps. If it's color we ignore
- * the forecolor.
- */
- if ((**(srcPort->portPixMap)).pixelSize == 1) {
- tmode = srcOr;
- } else {
- tmode = transparent;
- }
- CopyBits(srcBit, destBit, &srcRect, &destRect, tmode, NULL);
- } else {
- /*
- * Case 3: two arbitrary bitmaps.
- */
- tmode = srcCopy;
- maskPort = TkMacGetDrawablePort(clipPtr->value.pixmap);
- maskBit = &((GrafPtr) maskPort)->portBits;
- CopyDeepMask(srcBit, maskBit, destBit, &srcRect, &srcRect, &destRect, tmode, NULL);
- }
- }
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkPutImage --
- *
- * Copies a subimage from an in-memory image to a rectangle of
- * of the specified drawable.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Draws the image on the specified drawable.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkPutImage(
- unsigned long *colors, /* Unused on Macintosh. */
- int ncolors, /* Unused on Macintosh. */
- Display* display, /* Display. */
- Drawable d, /* Drawable to place image on. */
- GC gc, /* GC to use. */
- XImage* image, /* Image to place. */
- int src_x, /* Source X & Y. */
- int src_y,
- int dest_x, /* Destination X & Y. */
- int dest_y,
- unsigned int width, /* Same width & height for both */
- unsigned int height) /* distination and source. */
-{
- MacDrawable *destDraw = (MacDrawable *) d;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- int i, j;
- BitMap bitmap;
- char *newData = NULL;
- Rect destRect, srcRect;
-
- destPort = TkMacGetDrawablePort(d);
- SetRect(&destRect, dest_x, dest_y, dest_x + width, dest_y + height);
- SetRect(&srcRect, src_x, src_y, src_x + width, src_y + height);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- if (image->depth == 1) {
-
- /*
- * This code assumes a pixel depth of 1
- */
-
- bitmap.bounds.top = bitmap.bounds.left = 0;
- bitmap.bounds.right = (short) image->width;
- bitmap.bounds.bottom = (short) image->height;
- if ((image->bytes_per_line % 2) == 1) {
- char *newPtr, *oldPtr;
- newData = (char *) ckalloc(image->height *
- (image->bytes_per_line + 1));
- newPtr = newData;
- oldPtr = image->data;
- for (i = 0; i < image->height; i++) {
- for (j = 0; j < image->bytes_per_line; j++) {
- *newPtr = InvertByte((unsigned char) *oldPtr);
- newPtr++, oldPtr++;
- }
- *newPtr = 0;
- newPtr++;
- }
- bitmap.baseAddr = newData;
- bitmap.rowBytes = image->bytes_per_line + 1;
- } else {
- newData = (char *) ckalloc(image->height * image->bytes_per_line);
- for (i = 0; i < image->height * image->bytes_per_line; i++) {
- newData[i] = InvertByte((unsigned char) image->data[i]);
- }
- bitmap.baseAddr = newData;
- bitmap.rowBytes = image->bytes_per_line;
- }
-
- CopyBits(&bitmap, &((GrafPtr) destPort)->portBits,
- &srcRect, &destRect, srcCopy, NULL);
-
- } else {
- /* Color image */
- PixMap pixmap;
-
- pixmap.bounds.left = 0;
- pixmap.bounds.top = 0;
- pixmap.bounds.right = (short) image->width;
- pixmap.bounds.bottom = (short) image->height;
- pixmap.pixelType = RGBDirect;
- pixmap.pmVersion = 4; /* 32bit clean */
- pixmap.packType = 0;
- pixmap.packSize = 0;
- pixmap.hRes = 0x00480000;
- pixmap.vRes = 0x00480000;
- pixmap.pixelSize = 32;
- pixmap.cmpCount = 3;
- pixmap.cmpSize = 8;
- pixmap.planeBytes = 0;
- pixmap.pmTable = NULL;
- pixmap.pmReserved = 0;
- pixmap.baseAddr = image->data;
- if (image->bytes_per_line >= 0x4000) {
- panic("TkImage too wide!");
- }
- pixmap.rowBytes = image->bytes_per_line | 0x8000;
-
- CopyBits((BitMap *) &pixmap, &((GrafPtr) destPort)->portBits,
- &srcRect, &destRect, srcCopy, NULL);
- }
-
- if (newData != NULL) {
- ckfree(newData);
- }
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XFillRectangles --
- *
- * Fill multiple rectangular areas in the given drawable.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Draws onto the specified drawable.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XFillRectangles(
- Display* display, /* Display. */
- Drawable d, /* Draw on this. */
- GC gc, /* Use this GC. */
- XRectangle *rectangles, /* Rectangle array. */
- int n_rectangels) /* Number of rectangles. */
-{
- MacDrawable *macWin = (MacDrawable *) d;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- Rect theRect;
- int i;
-
- destPort = TkMacGetDrawablePort(d);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- TkMacSetUpGraphicsPort(gc);
-
- for (i=0; i<n_rectangels; i++) {
- theRect.left = (short) (macWin->xOff + rectangles[i].x);
- theRect.top = (short) (macWin->yOff + rectangles[i].y);
- theRect.right = (short) (theRect.left + rectangles[i].width);
- theRect.bottom = (short) (theRect.top + rectangles[i].height);
- FillCRect(&theRect, gPenPat);
- }
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XDrawLines --
- *
- * Draw connected lines.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Renders a series of connected lines.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XDrawLines(
- Display* display, /* Display. */
- Drawable d, /* Draw on this. */
- GC gc, /* Use this GC. */
- XPoint* points, /* Array of points. */
- int npoints, /* Number of points. */
- int mode) /* Line drawing mode. */
-{
- MacDrawable *macWin = (MacDrawable *) d;
- CGrafPtr saveWorld;
- GWorldPtr destPort;
- GDHandle saveDevice;
- int i;
-
- destPort = TkMacGetDrawablePort(d);
-
- display->request++;
- if (npoints < 2) {
- return; /* TODO: generate BadValue error. */
- }
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- TkMacSetUpGraphicsPort(gc);
-
- ShowPen();
-
- PenPixPat(gPenPat);
- MoveTo((short) (macWin->xOff + points[0].x),
- (short) (macWin->yOff + points[0].y));
- for (i = 1; i < npoints; i++) {
- if (mode == CoordModeOrigin) {
- LineTo((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
- } else {
- Line((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
- }
- }
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XDrawSegments --
- *
- * Draw unconnected lines.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Renders a series of connected lines.
- *
- *----------------------------------------------------------------------
- */
-
-void XDrawSegments(
- Display *display,
- Drawable d,
- GC gc,
- XSegment *segments,
- int nsegments)
-{
- MacDrawable *macWin = (MacDrawable *) d;
- CGrafPtr saveWorld;
- GWorldPtr destPort;
- GDHandle saveDevice;
- int i;
-
- destPort = TkMacGetDrawablePort(d);
-
- display->request++;
-
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- TkMacSetUpGraphicsPort(gc);
-
- ShowPen();
-
- PenPixPat(gPenPat);
- for (i = 0; i < nsegments; i++) {
- MoveTo((short) (macWin->xOff + segments[i].x1),
- (short) (macWin->yOff + segments[i].y1));
- LineTo((short) (macWin->xOff + segments[i].x2),
- (short) (macWin->yOff + segments[i].y2));
- }
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XFillPolygon --
- *
- * Draws a filled polygon.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Draws a filled polygon on the specified drawable.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XFillPolygon(
- Display* display, /* Display. */
- Drawable d, /* Draw on this. */
- GC gc, /* Use this GC. */
- XPoint* points, /* Array of points. */
- int npoints, /* Number of points. */
- int shape, /* Shape to draw. */
- int mode) /* Drawing mode. */
-{
- MacDrawable *macWin = (MacDrawable *) d;
- PolyHandle polygon;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- int i;
-
- destPort = TkMacGetDrawablePort(d);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- TkMacSetUpGraphicsPort(gc);
-
- PenNormal();
- polygon = OpenPoly();
-
- MoveTo((short) (macWin->xOff + points[0].x),
- (short) (macWin->yOff + points[0].y));
- for (i = 1; i < npoints; i++) {
- if (mode == CoordModePrevious) {
- Line((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
- } else {
- LineTo((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
- }
- }
-
- ClosePoly();
-
- FillCPoly(polygon, gPenPat);
-
- KillPoly(polygon);
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XDrawRectangle --
- *
- * Draws a rectangle.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Draws a rectangle on the specified drawable.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XDrawRectangle(
- Display* display, /* Display. */
- Drawable d, /* Draw on this. */
- GC gc, /* Use this GC. */
- int x, /* Upper left corner. */
- int y,
- unsigned int width, /* Width & height of rect. */
- unsigned int height)
-{
- MacDrawable *macWin = (MacDrawable *) d;
- Rect theRect;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(d);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- TkMacSetUpGraphicsPort(gc);
-
- theRect.left = (short) (macWin->xOff + x);
- theRect.top = (short) (macWin->yOff + y);
- theRect.right = (short) (theRect.left + width);
- theRect.bottom = (short) (theRect.top + height);
-
- ShowPen();
- PenPixPat(gPenPat);
- FrameRect(&theRect);
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XDrawArc --
- *
- * Draw an arc.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Draws an arc on the specified drawable.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XDrawArc(
- Display* display, /* Display. */
- Drawable d, /* Draw on this. */
- GC gc, /* Use this GC. */
- int x, /* Upper left of */
- int y, /* bounding rect. */
- unsigned int width, /* Width & height. */
- unsigned int height,
- int angle1, /* Staring angle of arc. */
- int angle2) /* Ending angle of arc. */
-{
- MacDrawable *macWin = (MacDrawable *) d;
- Rect theRect;
- short start, extent;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(d);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- TkMacSetUpGraphicsPort(gc);
-
- theRect.left = (short) (macWin->xOff + x);
- theRect.top = (short) (macWin->yOff + y);
- theRect.right = (short) (theRect.left + width);
- theRect.bottom = (short) (theRect.top + height);
- start = (short) (90 - (angle1 / 64));
- extent = (short) (-(angle2 / 64));
-
- ShowPen();
- PenPixPat(gPenPat);
- FrameArc(&theRect, start, extent);
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XFillArc --
- *
- * Draw a filled arc.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Draws a filled arc on the specified drawable.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XFillArc(
- Display* display, /* Display. */
- Drawable d, /* Draw on this. */
- GC gc, /* Use this GC. */
- int x, /* Upper left of */
- int y, /* bounding rect. */
- unsigned int width, /* Width & height. */
- unsigned int height,
- int angle1, /* Staring angle of arc. */
- int angle2) /* Ending angle of arc. */
-{
- MacDrawable *macWin = (MacDrawable *) d;
- Rect theRect;
- short start, extent;
- PolyHandle polygon;
- double sin1, cos1, sin2, cos2, angle;
- double boxWidth, boxHeight;
- double vertex[2], center1[2], center2[2];
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(d);
-
- display->request++;
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(d);
-
- TkMacSetUpGraphicsPort(gc);
-
- theRect.left = (short) (macWin->xOff + x);
- theRect.top = (short) (macWin->yOff + y);
- theRect.right = (short) (theRect.left + width);
- theRect.bottom = (short) (theRect.top + height);
- start = (short) (90 - (angle1 / 64));
- extent = (short) (- (angle2 / 64));
-
- if (gc->arc_mode == ArcChord) {
- boxWidth = theRect.right - theRect.left;
- boxHeight = theRect.bottom - theRect.top;
- angle = -(angle1/64.0)*PI/180.0;
- sin1 = sin(angle);
- cos1 = cos(angle);
- angle -= (angle2/64.0)*PI/180.0;
- sin2 = sin(angle);
- cos2 = cos(angle);
- vertex[0] = (theRect.left + theRect.right)/2.0;
- vertex[1] = (theRect.top + theRect.bottom)/2.0;
- center1[0] = vertex[0] + cos1*boxWidth/2.0;
- center1[1] = vertex[1] + sin1*boxHeight/2.0;
- center2[0] = vertex[0] + cos2*boxWidth/2.0;
- center2[1] = vertex[1] + sin2*boxHeight/2.0;
-
- polygon = OpenPoly();
- MoveTo((short) ((theRect.left + theRect.right)/2),
- (short) ((theRect.top + theRect.bottom)/2));
-
- LineTo((short) (center1[0] + 0.5), (short) (center1[1] + 0.5));
- LineTo((short) (center2[0] + 0.5), (short) (center2[1] + 0.5));
- ClosePoly();
-
- ShowPen();
- FillCArc(&theRect, start, extent, gPenPat);
- FillCPoly(polygon, gPenPat);
-
- KillPoly(polygon);
- } else {
- ShowPen();
- FillCArc(&theRect, start, extent, gPenPat);
- }
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkScrollWindow --
- *
- * Scroll a rectangle of the specified window and accumulate
- * a damage region.
- *
- * Results:
- * Returns 0 if the scroll genereated no additional damage.
- * Otherwise, sets the region that needs to be repainted after
- * scrolling and returns 1.
- *
- * Side effects:
- * Scrolls the bits in the window.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkScrollWindow(
- Tk_Window tkwin, /* The window to be scrolled. */
- GC gc, /* GC for window to be scrolled. */
- int x, /* Position rectangle to be scrolled. */
- int y,
- int width,
- int height,
- int dx, /* Distance rectangle should be moved. */
- int dy,
- TkRegion damageRgn) /* Region to accumulate damage in. */
-{
- MacDrawable *destDraw = (MacDrawable *) Tk_WindowId(tkwin);
- RgnHandle rgn = (RgnHandle) damageRgn;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- Rect srcRect, scrollRect;
-
- destPort = TkMacGetDrawablePort(Tk_WindowId(tkwin));
-
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(Tk_WindowId(tkwin));
-
- /*
- * Due to the implementation below the behavior may be differnt
- * than X in certain cases that should never occur in Tk. The
- * scrollRect is the source rect extended by the offset (the union
- * of the source rect and the offset rect). Everything
- * in the extended scrollRect is scrolled. On X, it's possible
- * to "skip" over an area if the offset makes the source and
- * destination rects disjoint and non-aligned.
- */
-
- SetRect(&srcRect, (short) (destDraw->xOff + x),
- (short) (destDraw->yOff + y),
- (short) (destDraw->xOff + x + width),
- (short) (destDraw->yOff + y + height));
- scrollRect = srcRect;
- if (dx < 0) {
- scrollRect.left += dx;
- } else {
- scrollRect.right += dx;
- }
- if (dy < 0) {
- scrollRect.top += dy;
- } else {
- scrollRect.bottom += dy;
- }
-
- /*
- * Adjust clip region so that we don't copy any windows
- * that may overlap us.
- */
- RectRgn(rgn, &srcRect);
- DiffRgn(rgn, destPort->visRgn, rgn);
- OffsetRgn(rgn, dx, dy);
- DiffRgn(destPort->clipRgn, rgn, destPort->clipRgn);
- SetEmptyRgn(rgn);
-
- /*
- * When a menu is up, the Mac does not expect drawing to occur and
- * does not clip out the menu. We have to do it ourselves. This
- * is pretty gross.
- */
-
- if (tkUseMenuCascadeRgn == 1) {
- Point scratch = {0, 0};
- MacDrawable *macDraw = (MacDrawable *) Tk_WindowId(tkwin);
-
- LocalToGlobal(&scratch);
- CopyRgn(tkMenuCascadeRgn, rgn);
- OffsetRgn(rgn, -scratch.h, -scratch.v);
- DiffRgn(destPort->clipRgn, rgn, destPort->clipRgn);
- SetEmptyRgn(rgn);
- macDraw->toplevel->flags |= TK_DRAWN_UNDER_MENU;
- }
-
- ScrollRect(&scrollRect, dx, dy, rgn);
-
- SetGWorld(saveWorld, saveDevice);
-
- /*
- * Fortunantly, the region returned by ScrollRect is symanticlly
- * the same as what we need to return in this function. If the
- * region is empty we return zero to denote that no damage was
- * created.
- */
- if (EmptyRgn(rgn)) {
- return 0;
- } else {
- return 1;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacSetUpGraphicsPort --
- *
- * Set up the graphics port from the given GC.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The current port is adjusted.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacSetUpGraphicsPort(
- GC gc) /* GC to apply to current port. */
-{
- RGBColor macColor;
-
- if (gPenPat == NULL) {
- gPenPat = NewPixPat();
- }
-
- if (TkSetMacColor(gc->foreground, &macColor) == true) {
- /* TODO: cache RGBPats for preformace - measure gains... */
- MakeRGBPat(gPenPat, &macColor);
- }
-
- PenNormal();
- if(gc->function == GXxor) {
- PenMode(patXor);
- }
- if (gc->line_width > 1) {
- PenSize(gc->line_width, gc->line_width);
- }
- if (gc->line_style != LineSolid) {
- unsigned char *p = (unsigned char *) &(gc->dashes);
- /*
- * Here the dash pattern should be set in the drawing,
- * environment, but I don't know how to do that for the Mac.
- *
- * p[] is an array of unsigned chars containing the dash list.
- * A '\0' indicates the end of this list.
- *
- * Someone knows how to implement this? If you have a more
- * complete implementation of SetUpGraphicsPort() for
- * the Mac (or for Windows), please let me know.
- *
- * Jan Nijtmans
- * CMG Arnhem, B.V.
- * email: j.nijtmans@chello.nl (private)
- * jan.nijtmans@cmg.nl (work)
- * url: http://purl.oclc.org/net/nijtmans/
- */
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacSetUpClippingRgn --
- *
- * Set up the clipping region so that drawing only occurs on the
- * specified X subwindow.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The clipping region in the current port is changed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacSetUpClippingRgn(
- Drawable drawable) /* Drawable to update. */
-{
- MacDrawable *macDraw = (MacDrawable *) drawable;
-
- if (macDraw->winPtr != NULL) {
- if (macDraw->flags & TK_CLIP_INVALID) {
- TkMacUpdateClipRgn(macDraw->winPtr);
- }
-
- /*
- * When a menu is up, the Mac does not expect drawing to occur and
- * does not clip out the menu. We have to do it ourselves. This
- * is pretty gross.
- */
-
- if (macDraw->clipRgn != NULL) {
- if (tkUseMenuCascadeRgn == 1) {
- Point scratch = {0, 0};
- GDHandle saveDevice;
- GWorldPtr saveWorld;
-
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(TkMacGetDrawablePort(drawable), NULL);
- LocalToGlobal(&scratch);
- SetGWorld(saveWorld, saveDevice);
- if (tmpRgn == NULL) {
- tmpRgn = NewRgn();
- }
- CopyRgn(tkMenuCascadeRgn, tmpRgn);
- OffsetRgn(tmpRgn, -scratch.h, -scratch.v);
- DiffRgn(macDraw->clipRgn, tmpRgn, tmpRgn);
- SetClip(tmpRgn);
- macDraw->toplevel->flags |= TK_DRAWN_UNDER_MENU;
- } else {
- SetClip(macDraw->clipRgn);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacMakeStippleMap --
- *
- * Given a drawable and a stipple pattern this function draws the
- * pattern repeatedly over the drawable. The drawable can then
- * be used as a mask for bit-bliting a stipple pattern over an
- * object.
- *
- * Results:
- * A BitMap data structure.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-BitMapPtr
-TkMacMakeStippleMap(
- Drawable drawable, /* Window to apply stipple. */
- Drawable stipple) /* The stipple pattern. */
-{
- MacDrawable *destDraw = (MacDrawable *) drawable;
- GWorldPtr destPort;
- BitMapPtr bitmapPtr;
- int width, height, stippleHeight, stippleWidth;
- int i, j;
- char * data;
- Rect bounds;
-
- destPort = TkMacGetDrawablePort(drawable);
- width = destPort->portRect.right - destPort->portRect.left;
- height = destPort->portRect.bottom - destPort->portRect.top;
-
- bitmapPtr = (BitMap *) ckalloc(sizeof(BitMap));
- data = (char *) ckalloc(height * ((width / 8) + 1));
- bitmapPtr->bounds.top = bitmapPtr->bounds.left = 0;
- bitmapPtr->bounds.right = (short) width;
- bitmapPtr->bounds.bottom = (short) height;
- bitmapPtr->baseAddr = data;
- bitmapPtr->rowBytes = (width / 8) + 1;
-
- destPort = TkMacGetDrawablePort(stipple);
- stippleWidth = destPort->portRect.right - destPort->portRect.left;
- stippleHeight = destPort->portRect.bottom - destPort->portRect.top;
-
- for (i = 0; i < height; i += stippleHeight) {
- for (j = 0; j < width; j += stippleWidth) {
- bounds.left = j;
- bounds.top = i;
- bounds.right = j + stippleWidth;
- bounds.bottom = i + stippleHeight;
-
- CopyBits(&((GrafPtr) destPort)->portBits, bitmapPtr,
- &((GrafPtr) destPort)->portRect, &bounds, srcCopy, NULL);
- }
- }
- return bitmapPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * InvertByte --
- *
- * This function reverses the bits in the passed in Byte of data.
- *
- * Results:
- * The incoming byte in reverse bit order.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static unsigned char
-InvertByte(
- unsigned char data) /* Byte of data. */
-{
- unsigned char i;
- unsigned char mask = 1, result = 0;
-
- for (i = (1 << 7); i != 0; i /= 2) {
- if (data & mask) {
- result |= i;
- }
- mask = mask << 1;
- }
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDrawHighlightBorder --
- *
- * This procedure draws a rectangular ring around the outside of
- * a widget to indicate that it has received the input focus.
- *
- * On the Macintosh, this puts a 1 pixel border in the bgGC color
- * between the widget and the focus ring, except in the case where
- * highlightWidth is 1, in which case the border is left out.
- *
- * For proper Mac L&F, use highlightWidth of 3.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A rectangle "width" pixels wide is drawn in "drawable",
- * corresponding to the outer area of "tkwin".
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDrawHighlightBorder (
- Tk_Window tkwin,
- GC fgGC,
- GC bgGC,
- int highlightWidth,
- Drawable drawable)
-{
- if (highlightWidth == 1) {
- TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth, drawable, 0);
- } else {
- TkDrawInsetFocusHighlight (tkwin, bgGC, highlightWidth, drawable, 0);
- if (fgGC != bgGC) {
- TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth - 1, drawable, 0);
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDrawFrame --
- *
- * This procedure draws the rectangular frame area.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Draws inside the tkwin area.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
- int highlightWidth, int borderWidth, int relief)
-{
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
- border, highlightWidth, highlightWidth,
- Tk_Width(tkwin) - 2 * highlightWidth,
- Tk_Height(tkwin) - 2 * highlightWidth,
- borderWidth, relief);
-}
diff --git a/mac/tkMacEmbed.c b/mac/tkMacEmbed.c
deleted file mode 100644
index 77908da..0000000
--- a/mac/tkMacEmbed.c
+++ /dev/null
@@ -1,1205 +0,0 @@
-/*
- * tkMacEmbed.c --
- *
- * This file contains platform-specific procedures for theMac to provide
- * basic operations needed for application embedding (where one
- * application can use as its main window an internal window from
- * some other application).
- * Currently only Toplevel embedding within the same Tk application is
- * allowed on the Macintosh.
- *
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkInt.h"
-#include "tkPort.h"
-#include "X.h"
-#include "Xlib.h"
-#include <stdio.h>
-
-#include <Windows.h>
-#include <QDOffscreen.h>
-#include "tkMacInt.h"
-
-/*
- * One of the following structures exists for each container in this
- * application. It keeps track of the container window and its
- * associated embedded window.
- */
-
-typedef struct Container {
- Window parent; /* The Mac Drawable for the parent of
- * the pair (the container). */
- TkWindow *parentPtr; /* Tk's information about the container,
- * or NULL if the container isn't
- * in this process. */
- Window embedded; /* The MacDrawable for the embedded
- * window. Starts off as None, but
- * gets filled in when the window is
- * eventually created. */
- TkWindow *embeddedPtr; /* Tk's information about the embedded
- * window, or NULL if the
- * embedded application isn't in
- * this process. */
- struct Container *nextPtr; /* Next in list of all containers in
- * this process. */
-} Container;
-
-static Container *firstContainerPtr = NULL;
- /* First in list of all containers
- * managed by this process. */
-/*
- * Globals defined in this file
- */
-
-TkMacEmbedHandler *gMacEmbedHandler = NULL;
-
-/*
- * Prototypes for static procedures defined in this file:
- */
-
-static void ContainerEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void EmbeddedEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void EmbedActivateProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbedFocusProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbedGeometryRequest _ANSI_ARGS_((
- Container * containerPtr, int width, int height));
-static void EmbedSendConfigure _ANSI_ARGS_((
- Container *containerPtr));
-static void EmbedStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbedWindowDeleted _ANSI_ARGS_((TkWindow *winPtr));
-
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_MacSetEmbedHandler --
- *
- * Registers a handler for an in process form of embedding, like
- * Netscape plugins, where Tk is loaded into the process, but does
- * not control the main window
- *
- * Results:
- * None
- *
- * Side effects:
- * The embed handler is set.
- *
- *----------------------------------------------------------------------
- */
-void
-Tk_MacSetEmbedHandler(
- Tk_MacEmbedRegisterWinProc *registerWinProc,
- Tk_MacEmbedGetGrafPortProc *getPortProc,
- Tk_MacEmbedMakeContainerExistProc *containerExistProc,
- Tk_MacEmbedGetClipProc *getClipProc,
- Tk_MacEmbedGetOffsetInParentProc *getOffsetProc)
-{
- if (gMacEmbedHandler == NULL) {
- gMacEmbedHandler = (TkMacEmbedHandler *) ckalloc(sizeof(TkMacEmbedHandler));
- }
- gMacEmbedHandler->registerWinProc = registerWinProc;
- gMacEmbedHandler->getPortProc = getPortProc;
- gMacEmbedHandler->containerExistProc = containerExistProc;
- gMacEmbedHandler->getClipProc = getClipProc;
- gMacEmbedHandler->getOffsetProc = getOffsetProc;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpMakeWindow --
- *
- * Creates an X Window (Mac subwindow).
- *
- * Results:
- * The window id is returned.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Window
-TkpMakeWindow(
- TkWindow *winPtr,
- Window parent)
-{
- MacDrawable *macWin;
- XEvent event;
-
- /*
- * If this window is marked as embedded then
- * the window structure should have already been
- * created in the TkpUseWindow function.
- */
-
- if (Tk_IsEmbedded(winPtr)) {
- return (Window) winPtr->privatePtr;
- }
-
- /*
- * Allocate sub window
- */
-
- macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable));
- if (macWin == NULL) {
- winPtr->privatePtr = NULL;
- return None;
- }
- macWin->winPtr = winPtr;
- winPtr->privatePtr = macWin;
- macWin->clipRgn = NewRgn();
- macWin->aboveClipRgn = NewRgn();
- macWin->referenceCount = 0;
- macWin->flags = TK_CLIP_INVALID;
-
- if (Tk_IsTopLevel(macWin->winPtr)) {
-
- /*
- *This will be set when we are mapped.
- */
-
- macWin->portPtr = (GWorldPtr) NULL;
- macWin->toplevel = macWin;
- macWin->xOff = 0;
- macWin->yOff = 0;
- } else {
- macWin->portPtr = NULL;
- macWin->xOff = winPtr->parentPtr->privatePtr->xOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.x;
- macWin->yOff = winPtr->parentPtr->privatePtr->yOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.y;
- macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
- }
-
- macWin->toplevel->referenceCount++;
-
- /*
- * TODO: need general solution for visibility events.
- */
- event.xany.serial = Tk_Display(winPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(winPtr);
-
- event.xvisibility.type = VisibilityNotify;
- event.xvisibility.window = (Window) macWin;;
- event.xvisibility.state = VisibilityUnobscured;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
- return (Window) macWin;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpUseWindow --
- *
- * This procedure causes a Tk window to use a given X window as
- * its parent window, rather than the root window for the screen.
- * It is invoked by an embedded application to specify the window
- * in which it is embedded.
- *
- * Results:
- * The return value is normally TCL_OK. If an error occurs (such
- * as string not being a valid window spec), then the return value
- * is TCL_ERROR and an error message is left in the interp's result if
- * interp is non-NULL.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpUseWindow(
- Tcl_Interp *interp, /* If not NULL, used for error reporting
- * if string is bogus. */
- Tk_Window tkwin, /* Tk window that does not yet have an
- * associated X window. */
- CONST char *string) /* String identifying an X window to use
- * for tkwin; must be an integer value. */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- TkWindow *usePtr;
- MacDrawable *parent, *macWin;
- Container *containerPtr;
- XEvent event;
- int result;
-
- if (winPtr->window != None) {
- panic("TkpUseWindow: X window already assigned");
- }
-
- /*
- * Decode the container pointer, and look for it among the
- *list of available containers.
- *
- * N.B. For now, we are limiting the containers to be in the same Tk
- * application as tkwin, since otherwise they would not be in our list
- * of containers.
- *
- */
-
- if (Tcl_GetInt(interp, string, &result) != TCL_OK) {
- return TCL_ERROR;
- }
-
- usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, (Window) result);
-
- if (usePtr == NULL) {
- Tcl_AppendResult(interp, "Tk window does not correspond to id \"",
- string, "\"", (char *) NULL);
- return TCL_ERROR;
- } else {
- if (!(usePtr->flags & TK_CONTAINER)) {
- Tcl_AppendResult(interp, "window \"", usePtr->pathName,
- "\" doesn't have -container option set", (char *) NULL);
- return TCL_ERROR;
- }
- }
-
- parent = (MacDrawable *) result;
-
- /*
- * Save information about the container and the embedded window
- * in a Container structure. Currently, there must already be an existing
- * Container structure, since we only allow the case where both container
- * and embedded app. are in the same process.
- */
-
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
- containerPtr = containerPtr->nextPtr) {
- if (containerPtr->parent == (Window) parent) {
- winPtr->flags |= TK_BOTH_HALVES;
- containerPtr->parentPtr->flags |= TK_BOTH_HALVES;
- break;
- }
- }
-
- /*
- * Make the embedded window.
- */
-
- macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable));
- if (macWin == NULL) {
- winPtr->privatePtr = NULL;
- return TCL_ERROR;
- }
-
- macWin->winPtr = winPtr;
- winPtr->privatePtr = macWin;
-
- /*
- * The portPtr will be NULL for a Tk in Tk embedded window.
- * It is none of our business what it is for a Tk not in Tk embedded window,
- * but we will initialize it to NULL, and let the registerWinProc
- * set it. In any case, you must always use TkMacGetDrawablePort
- * to get the portPtr. It will correctly find the container's port.
- */
-
- macWin->portPtr = (GWorldPtr) NULL;
-
- macWin->clipRgn = NewRgn();
- macWin->aboveClipRgn = NewRgn();
- macWin->referenceCount = 0;
- macWin->flags = TK_CLIP_INVALID;
- macWin->toplevel = macWin;
- macWin->toplevel->referenceCount++;
-
- winPtr->flags |= TK_EMBEDDED;
-
-
- /*
- * Make a copy of the TK_EMBEDDED flag, since sometimes
- * we need this to get the port after the TkWindow structure
- * has been freed.
- */
-
- macWin->flags |= TK_EMBEDDED;
-
- /*
- * Now check whether it is embedded in another Tk widget. If not (the first
- * case below) we see if there is an in-process embedding handler registered,
- * and if so, let that fill in the rest of the macWin.
- */
-
- if (containerPtr == NULL) {
- /*
- * If someone has registered an in process embedding handler, then
- * see if it can handle this window...
- */
-
- if (gMacEmbedHandler == NULL ||
- gMacEmbedHandler->registerWinProc(result, (Tk_Window) winPtr) != TCL_OK) {
- Tcl_AppendResult(interp, "The window ID ", string,
- " does not correspond to a valid Tk Window.",
- (char *) NULL);
- return TCL_ERROR;
- } else {
- containerPtr = (Container *) ckalloc(sizeof(Container));
-
- containerPtr->parentPtr = NULL;
- containerPtr->embedded = (Window) macWin;
- containerPtr->embeddedPtr = macWin->winPtr;
- containerPtr->nextPtr = firstContainerPtr;
- firstContainerPtr = containerPtr;
-
- }
- } else {
-
- /*
- * The window is embedded in another Tk window.
- */
-
- macWin->xOff = parent->winPtr->privatePtr->xOff +
- parent->winPtr->changes.border_width +
- winPtr->changes.x;
- macWin->yOff = parent->winPtr->privatePtr->yOff +
- parent->winPtr->changes.border_width +
- winPtr->changes.y;
-
-
- /*
- * Finish filling up the container structure with the embedded window's
- * information.
- */
-
- containerPtr->embedded = (Window) macWin;
- containerPtr->embeddedPtr = macWin->winPtr;
-
- /*
- * Create an event handler to clean up the Container structure when
- * tkwin is eventually deleted.
- */
-
- Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
- (ClientData) winPtr);
-
- }
-
- /*
- * TODO: need general solution for visibility events.
- */
-
- event.xany.serial = Tk_Display(winPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(winPtr);
-
- event.xvisibility.type = VisibilityNotify;
- event.xvisibility.window = (Window) macWin;;
- event.xvisibility.state = VisibilityUnobscured;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
-
- /*
- * TODO: need general solution for visibility events.
- */
-
- event.xany.serial = Tk_Display(winPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(winPtr);
-
- event.xvisibility.type = VisibilityNotify;
- event.xvisibility.window = (Window) macWin;;
- event.xvisibility.state = VisibilityUnobscured;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpMakeContainer --
- *
- * This procedure is called to indicate that a particular window
- * will be a container for an embedded application. This changes
- * certain aspects of the window's behavior, such as whether it
- * will receive events anymore.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpMakeContainer(
- Tk_Window tkwin) /* Token for a window that is about to
- * become a container. */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- Container *containerPtr;
-
- /*
- * Register the window as a container so that, for example, we can
- * make sure the argument to -use is valid.
- */
-
-
- Tk_MakeWindowExist(tkwin);
- containerPtr = (Container *) ckalloc(sizeof(Container));
- containerPtr->parent = Tk_WindowId(tkwin);
- containerPtr->parentPtr = winPtr;
- containerPtr->embedded = None;
- containerPtr->embeddedPtr = NULL;
- containerPtr->nextPtr = firstContainerPtr;
- firstContainerPtr = containerPtr;
- winPtr->flags |= TK_CONTAINER;
-
- /*
- * Request SubstructureNotify events so that we can find out when
- * the embedded application creates its window or attempts to
- * resize it. Also watch Configure events on the container so that
- * we can resize the child to match. Also, pass activate events from
- * the container down to the embedded toplevel.
- */
-
- Tk_CreateEventHandler(tkwin,
- SubstructureNotifyMask|SubstructureRedirectMask,
- ContainerEventProc, (ClientData) winPtr);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbedStructureProc,
- (ClientData) containerPtr);
- Tk_CreateEventHandler(tkwin, ActivateMask, EmbedActivateProc,
- (ClientData) containerPtr);
- Tk_CreateEventHandler(tkwin, FocusChangeMask, EmbedFocusProc,
- (ClientData) containerPtr);
-
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacContainerId --
- *
- * Given an embedded window, this procedure returns the MacDrawable
- * identifier for the associated container window.
- *
- * Results:
- * The return value is the MacDrawable for winPtr's
- * container window.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-MacDrawable *
-TkMacContainerId(winPtr)
- TkWindow *winPtr; /* Tk's structure for an embedded window. */
-{
- Container *containerPtr;
-
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
- containerPtr = containerPtr->nextPtr) {
- if (containerPtr->embeddedPtr == winPtr) {
- return (MacDrawable *) containerPtr->parent;
- }
- }
- panic("TkMacContainerId couldn't find window");
- return None;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacGetHostToplevel --
- *
- * Given the TkWindow, return the MacDrawable for the outermost
- * toplevel containing it. This will be a real Macintosh window.
- *
- * Results:
- * Returns a MacDrawable corresponding to a Macintosh Toplevel
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-MacDrawable *
-TkMacGetHostToplevel(
- TkWindow *winPtr) /* Tk's structure for a window. */
-{
- TkWindow *contWinPtr, *topWinPtr;
-
- topWinPtr = winPtr->privatePtr->toplevel->winPtr;
- if (!Tk_IsEmbedded(topWinPtr)) {
- return winPtr->privatePtr->toplevel;
- } else {
- contWinPtr = TkpGetOtherWindow(topWinPtr);
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- if (contWinPtr != NULL) {
- return TkMacGetHostToplevel(contWinPtr);
- } else {
- return None;
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpClaimFocus --
- *
- * This procedure is invoked when someone asks for the input focus
- * to be put on a window in an embedded application, but the
- * application doesn't currently have the focus. It requests the
- * input focus from the container application.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The input focus may change.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpClaimFocus(
- TkWindow *topLevelPtr, /* Top-level window containing desired
- * focus window; should be embedded. */
- int force) /* One means that the container should
- * claim the focus if it doesn't
- * currently have it. */
-{
- XEvent event;
- Container *containerPtr;
-
- if (!(topLevelPtr->flags & TK_EMBEDDED)) {
- return;
- }
-
- for (containerPtr = firstContainerPtr;
- containerPtr->embeddedPtr != topLevelPtr;
- containerPtr = containerPtr->nextPtr) {
- /* Empty loop body. */
- }
-
-
- event.xfocus.type = FocusIn;
- event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display);
- event.xfocus.send_event = 1;
- event.xfocus.display = topLevelPtr->display;
- event.xfocus.window = containerPtr->parent;
- event.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS;
- event.xfocus.detail = force;
- Tk_QueueWindowEvent(&event,TCL_QUEUE_TAIL);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpTestembedCmd --
- *
- * This procedure implements the "testembed" command. It returns
- * some or all of the information in the list pointed to by
- * firstContainerPtr.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpTestembedCmd(
- ClientData clientData, /* Main window for application. */
- Tcl_Interp *interp, /* Current interpreter. */
- int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
-{
- int all;
- Container *containerPtr;
- Tcl_DString dString;
- char buffer[50];
-
- if ((argc > 1) && (strcmp(argv[1], "all") == 0)) {
- all = 1;
- } else {
- all = 0;
- }
- Tcl_DStringInit(&dString);
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
- containerPtr = containerPtr->nextPtr) {
- Tcl_DStringStartSublist(&dString);
- if (containerPtr->parent == None) {
- Tcl_DStringAppendElement(&dString, "");
- } else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->parent);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
- }
- if (containerPtr->parentPtr == NULL) {
- Tcl_DStringAppendElement(&dString, "");
- } else {
- Tcl_DStringAppendElement(&dString,
- containerPtr->parentPtr->pathName);
- }
- if (containerPtr->embedded == None) {
- Tcl_DStringAppendElement(&dString, "");
- } else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->embedded);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
- }
- if (containerPtr->embeddedPtr == NULL) {
- Tcl_DStringAppendElement(&dString, "");
- } else {
- Tcl_DStringAppendElement(&dString,
- containerPtr->embeddedPtr->pathName);
- }
- Tcl_DStringEndSublist(&dString);
- }
- Tcl_DStringResult(interp, &dString);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpRedirectKeyEvent --
- *
- * This procedure is invoked when a key press or release event
- * arrives for an application that does not believe it owns the
- * input focus. This can happen because of embedding; for example,
- * X can send an event to an embedded application when the real
- * focus window is in the container application and is an ancestor
- * of the container. This procedure's job is to forward the event
- * back to the application where it really belongs.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The event may get sent to a different application.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpRedirectKeyEvent(
- TkWindow *winPtr, /* Window to which the event was originally
- * reported. */
- XEvent *eventPtr) /* X event to redirect (should be KeyPress
- * or KeyRelease). */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetOtherWindow --
- *
- * If both the container and embedded window are in the same
- * process, this procedure will return either one, given the other.
- *
- * Results:
- * If winPtr is a container, the return value is the token for the
- * embedded window, and vice versa. If the "other" window isn't in
- * this process, NULL is returned.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkWindow *
-TkpGetOtherWindow(
- TkWindow *winPtr) /* Tk's structure for a container or
- * embedded window. */
-{
- Container *containerPtr;
-
- /*
- * TkpGetOtherWindow returns NULL if both windows are not
- * in the same process...
- */
-
- if (!(winPtr->flags & TK_BOTH_HALVES)) {
- return NULL;
- }
-
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
- containerPtr = containerPtr->nextPtr) {
- if (containerPtr->embeddedPtr == winPtr) {
- return containerPtr->parentPtr;
- } else if (containerPtr->parentPtr == winPtr) {
- return containerPtr->embeddedPtr;
- }
- }
- return NULL;
-}
-/*
- *----------------------------------------------------------------------
- *
- * EmbeddedEventProc --
- *
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for a window that is embedded in
- * another application.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Our internal state gets cleaned up when an embedded window is
- * destroyed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbeddedEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
-{
- TkWindow *winPtr = (TkWindow *) clientData;
-
- if (eventPtr->type == DestroyNotify) {
- EmbedWindowDeleted(winPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ContainerEventProc --
- *
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for the children of a container
- * window. It forwards relevant information, such as geometry
- * requests, from the events into the container's application.
- *
- * NOTE: on the Mac, only the DestroyNotify branch is ever taken.
- * We don't synthesize the other events.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Depends on the event. For example, when ConfigureRequest events
- * occur, geometry information gets set for the container window.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-ContainerEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
-{
- TkWindow *winPtr = (TkWindow *) clientData;
- Container *containerPtr;
- Tk_ErrorHandler errHandler;
-
- /*
- * Ignore any X protocol errors that happen in this procedure
- * (almost any operation could fail, for example, if the embedded
- * application has deleted its window).
- */
-
- errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
-
- /*
- * Find the Container structure associated with the parent window.
- */
-
- for (containerPtr = firstContainerPtr;
- containerPtr->parent != eventPtr->xmaprequest.parent;
- containerPtr = containerPtr->nextPtr) {
- if (containerPtr == NULL) {
- panic("ContainerEventProc couldn't find Container record");
- }
- }
-
- if (eventPtr->type == CreateNotify) {
- /*
- * A new child window has been created in the container. Record
- * its id in the Container structure (if more than one child is
- * created, just remember the last one and ignore the earlier
- * ones).
- */
-
- containerPtr->embedded = eventPtr->xcreatewindow.window;
- } else if (eventPtr->type == ConfigureRequest) {
- if ((eventPtr->xconfigurerequest.x != 0)
- || (eventPtr->xconfigurerequest.y != 0)) {
- /*
- * The embedded application is trying to move itself, which
- * isn't legal. At this point, the window hasn't actually
- * moved, but we need to send it a ConfigureNotify event to
- * let it know that its request has been denied. If the
- * embedded application was also trying to resize itself, a
- * ConfigureNotify will be sent by the geometry management
- * code below, so we don't need to do anything. Otherwise,
- * generate a synthetic event.
- */
-
- if ((eventPtr->xconfigurerequest.width == winPtr->changes.width)
- && (eventPtr->xconfigurerequest.height
- == winPtr->changes.height)) {
- EmbedSendConfigure(containerPtr);
- }
- }
- EmbedGeometryRequest(containerPtr,
- eventPtr->xconfigurerequest.width,
- eventPtr->xconfigurerequest.height);
- } else if (eventPtr->type == MapRequest) {
- /*
- * The embedded application's map request was ignored and simply
- * passed on to us, so we have to map the window for it to appear
- * on the screen.
- */
-
- XMapWindow(eventPtr->xmaprequest.display,
- eventPtr->xmaprequest.window);
- } else if (eventPtr->type == DestroyNotify) {
- /*
- * The embedded application is gone. Destroy the container window.
- */
-
- Tk_DestroyWindow((Tk_Window) winPtr);
- }
- Tk_DeleteErrorHandler(errHandler);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmbedStructureProc --
- *
- * This procedure is invoked by the Tk event dispatcher when
- * a container window owned by this application gets resized
- * (and also at several other times that we don't care about).
- * This procedure reflects the size change in the embedded
- * window that corresponds to the container.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The embedded window gets resized to match the container.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbedStructureProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
-{
- Container *containerPtr = (Container *) clientData;
- Tk_ErrorHandler errHandler;
-
- if (eventPtr->type == ConfigureNotify) {
- if (containerPtr->embedded != None) {
- /*
- * Ignore errors, since the embedded application could have
- * deleted its window.
- */
-
- errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
- Tk_MoveResizeWindow((Tk_Window) containerPtr->embeddedPtr, 0, 0,
- (unsigned int) Tk_Width(
- (Tk_Window) containerPtr->parentPtr),
- (unsigned int) Tk_Height(
- (Tk_Window) containerPtr->parentPtr));
- Tk_DeleteErrorHandler(errHandler);
- }
- } else if (eventPtr->type == DestroyNotify) {
- EmbedWindowDeleted(containerPtr->parentPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmbedActivateProc --
- *
- * This procedure is invoked by the Tk event dispatcher when
- * Activate and Deactivate events occur for a container window owned
- * by this application. It is responsible for forwarding an activate
- * event down into the embedded toplevel.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The X focus may change.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbedActivateProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
-{
- Container *containerPtr = (Container *) clientData;
-
- if (containerPtr->embeddedPtr != NULL) {
- if (eventPtr->type == ActivateNotify) {
- TkGenerateActivateEvents(containerPtr->embeddedPtr,1);
- } else if (eventPtr->type == DeactivateNotify) {
- TkGenerateActivateEvents(containerPtr->embeddedPtr,0);
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmbedFocusProc --
- *
- * This procedure is invoked by the Tk event dispatcher when
- * FocusIn and FocusOut events occur for a container window owned
- * by this application. It is responsible for moving the focus
- * back and forth between a container application and an embedded
- * application.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The X focus may change.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbedFocusProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
-{
- Container *containerPtr = (Container *) clientData;
- Display *display;
- XEvent event;
-
- if (containerPtr->embeddedPtr != NULL) {
- display = Tk_Display(containerPtr->parentPtr);
- event.xfocus.serial = LastKnownRequestProcessed(display);
- event.xfocus.send_event = false;
- event.xfocus.display = display;
- event.xfocus.mode = NotifyNormal;
- event.xfocus.window = containerPtr->embedded;
-
- if (eventPtr->type == FocusIn) {
- /*
- * The focus just arrived at the container. Change the X focus
- * to move it to the embedded application, if there is one.
- * Ignore X errors that occur during this operation (it's
- * possible that the new focus window isn't mapped).
- */
-
- event.xfocus.detail = NotifyNonlinear;
- event.xfocus.type = FocusIn;
-
- } else if (eventPtr->type == FocusOut) {
- /* When the container gets a FocusOut event, it has to tell the embedded app
- * that it has lost the focus.
- */
-
- event.xfocus.type = FocusOut;
- event.xfocus.detail = NotifyNonlinear;
- }
-
- Tk_QueueWindowEvent(&event, TCL_QUEUE_MARK);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmbedGeometryRequest --
- *
- * This procedure is invoked when an embedded application requests
- * a particular size. It processes the request (which may or may
- * not actually honor the request) and reflects the results back
- * to the embedded application.
- *
- * NOTE: On the Mac, this is a stub, since we don't synthesize
- * ConfigureRequest events.
- *
- * Results:
- * None.
- *
- * Side effects:
- * If we deny the child's size change request, a Configure event
- * is synthesized to let the child know how big it ought to be.
- * Events get processed while we're waiting for the geometry
- * managers to do their thing.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbedGeometryRequest(containerPtr, width, height)
- Container *containerPtr; /* Information about the embedding. */
- int width, height; /* Size that the child has requested. */
-{
- TkWindow *winPtr = containerPtr->parentPtr;
-
- /*
- * Forward the requested size into our geometry management hierarchy
- * via the container window. We need to send a Configure event back
- * to the embedded application if we decide not to honor its
- * request; to make this happen, process all idle event handlers
- * synchronously here (so that the geometry managers have had a
- * chance to do whatever they want to do), and if the window's size
- * didn't change then generate a configure event.
- */
-
- Tk_GeometryRequest((Tk_Window) winPtr, width, height);
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {
- /* Empty loop body. */
- }
- if ((winPtr->changes.width != width)
- || (winPtr->changes.height != height)) {
- EmbedSendConfigure(containerPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmbedSendConfigure --
- *
- * This is currently a stub. It is called to notify an
- * embedded application of its current size and location. This
- * procedure is called when the embedded application made a
- * geometry request that we did not grant, so that the embedded
- * application knows that its geometry didn't change after all.
- * It is a response to ConfigureRequest events, which we do not
- * currently synthesize on the Mac
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbedSendConfigure(containerPtr)
- Container *containerPtr; /* Information about the embedding. */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmbedWindowDeleted --
- *
- * This procedure is invoked when a window involved in embedding
- * (as either the container or the embedded application) is
- * destroyed. It cleans up the Container structure for the window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A Container structure may be freed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbedWindowDeleted(winPtr)
- TkWindow *winPtr; /* Tk's information about window that
- * was deleted. */
-{
- Container *containerPtr, *prevPtr;
-
- /*
- * Find the Container structure for this window. Delete the
- * information about the embedded application and free the container's
- * record.
- */
-
- prevPtr = NULL;
- containerPtr = firstContainerPtr;
- while (1) {
- if (containerPtr->embeddedPtr == winPtr) {
-
- /*
- * We also have to destroy our parent, to clean up the container.
- * Fabricate an event to do this.
- */
-
- if (containerPtr->parentPtr != NULL &&
- containerPtr->parentPtr->flags & TK_BOTH_HALVES) {
- XEvent event;
-
- event.xany.serial =
- Tk_Display(containerPtr->parentPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(containerPtr->parentPtr);
-
- event.xany.type = DestroyNotify;
- event.xany.window = containerPtr->parent;
- event.xdestroywindow.event = containerPtr->parent;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD);
-
- }
-
- containerPtr->embedded = None;
- containerPtr->embeddedPtr = NULL;
-
- break;
- }
- if (containerPtr->parentPtr == winPtr) {
- containerPtr->parentPtr = NULL;
- break;
- }
- prevPtr = containerPtr;
- containerPtr = containerPtr->nextPtr;
- }
- if ((containerPtr->embeddedPtr == NULL)
- && (containerPtr->parentPtr == NULL)) {
- if (prevPtr == NULL) {
- firstContainerPtr = containerPtr->nextPtr;
- } else {
- prevPtr->nextPtr = containerPtr->nextPtr;
- }
- ckfree((char *) containerPtr);
- }
-}
-
diff --git a/mac/tkMacFont.c b/mac/tkMacFont.c
deleted file mode 100644
index 2cf270b..0000000
--- a/mac/tkMacFont.c
+++ /dev/null
@@ -1,2150 +0,0 @@
-/*
- * tkMacFont.c --
- *
- * Contains the Macintosh implementation of the platform-independant
- * font package interface.
- *
- * Copyright (c) 1990-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Windows.h>
-#include <Strings.h>
-#include <Fonts.h>
-#include <Script.h>
-#include <Resources.h>
-#include <TextUtils.h>
-
-#include "tkMacInt.h"
-#include "tkFont.h"
-
-/*
- * For doing things with Mac strings and Fixed numbers. This probably should move
- * the mac header file.
- */
-
-#ifndef StrLength
-#define StrLength(s) (*((unsigned char *) (s)))
-#endif
-#ifndef StrBody
-#define StrBody(s) ((char *) (s) + 1)
-#endif
-#define pstrcmp(s1, s2) RelString((s1), (s2), 1, 1)
-#define pstrcasecmp(s1, s2) RelString((s1), (s2), 0, 1)
-
-#ifndef Fixed2Int
-#define Fixed2Int(f) ((f) >> 16)
-#define Int2Fixed(i) ((i) << 16)
-#endif
-
-/*
- * The preferred font encodings.
- */
-
-static CONST char *encodingList[] = {
- "macRoman", "macJapan", NULL
-};
-
-/*
- * The following structures are used to map the script/language codes of a
- * font to the name that should be passed to Tcl_GetTextEncoding() to obtain
- * the encoding for that font. The set of numeric constants is fixed and
- * defined by Apple.
- */
-
-static TkStateMap scriptMap[] = {
- {smRoman, "macRoman"},
- {smJapanese, "macJapan"},
- {smTradChinese, "macChinese"},
- {smKorean, "macKorean"},
- {smArabic, "macArabic"},
- {smHebrew, "macHebrew"},
- {smGreek, "macGreek"},
- {smCyrillic, "macCyrillic"},
- {smRSymbol, "macRSymbol"},
- {smDevanagari, "macDevanagari"},
- {smGurmukhi, "macGurmukhi"},
- {smGujarati, "macGujarati"},
- {smOriya, "macOriya"},
- {smBengali, "macBengali"},
- {smTamil, "macTamil"},
- {smTelugu, "macTelugu"},
- {smKannada, "macKannada"},
- {smMalayalam, "macMalayalam"},
- {smSinhalese, "macSinhalese"},
- {smBurmese, "macBurmese"},
- {smKhmer, "macKhmer"},
- {smThai, "macThailand"},
- {smLaotian, "macLaos"},
- {smGeorgian, "macGeorgia"},
- {smArmenian, "macArmenia"},
- {smSimpChinese, "macSimpChinese"},
- {smTibetan, "macTIbet"},
- {smMongolian, "macMongolia"},
- {smGeez, "macEthiopia"},
- {smEastEurRoman, "macCentEuro"},
- {smVietnamese, "macVietnam"},
- {smExtArabic, "macSindhi"},
- {NULL, NULL}
-};
-
-static TkStateMap romanMap[] = {
- {langCroatian, "macCroatian"},
- {langSlovenian, "macCroatian"},
- {langIcelandic, "macIceland"},
- {langRomanian, "macRomania"},
- {langTurkish, "macTurkish"},
- {langGreek, "macGreek"},
- {NULL, NULL}
-};
-
-static TkStateMap cyrillicMap[] = {
- {langUkrainian, "macUkraine"},
- {langBulgarian, "macBulgaria"},
- {NULL, NULL}
-};
-
-/*
- * The following structure represents a font family. It is assumed that
- * all screen fonts constructed from the same "font family" share certain
- * properties; all screen fonts with the same "font family" point to a
- * shared instance of this structure. The most important shared property
- * is the character existence metrics, used to determine if a screen font
- * can display a given Unicode character.
- *
- * Under Macintosh, a "font family" is uniquely identified by its face number.
- */
-
-
-#define FONTMAP_SHIFT 10
-
-#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar) * 8 - FONTMAP_SHIFT))
-#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
-
-typedef struct FontFamily {
- struct FontFamily *nextPtr; /* Next in list of all known font families. */
- int refCount; /* How many SubFonts are referring to this
- * FontFamily. When the refCount drops to
- * zero, this FontFamily may be freed. */
- /*
- * Key.
- */
-
- short faceNum; /* Unique face number key for this FontFamily. */
-
- /*
- * Derived properties.
- */
-
- Tcl_Encoding encoding; /* Encoding for this font family. */
- int isSymbolFont; /* Non-zero if this is a symbol family. */
- int isMultiByteFont; /* Non-zero if this is a multi-byte family. */
- char typeTable[256]; /* Table that identfies all lead bytes for a
- * multi-byte family, used when measuring chars.
- * If a byte is a lead byte, the value at the
- * corresponding position in the typeTable is 1,
- * otherwise 0. If this is a single-byte font,
- * all entries are 0. */
- char *fontMap[FONTMAP_PAGES];
- /* Two-level sparse table used to determine
- * quickly if the specified character exists.
- * As characters are encountered, more pages
- * in this table are dynamically added. The
- * contents of each page is a bitmask
- * consisting of FONTMAP_BITSPERPAGE bits,
- * representing whether this font can be used
- * to display the given character at the
- * corresponding bit position. The high bits
- * of the character are used to pick which
- * page of the table is used. */
-} FontFamily;
-
-/*
- * The following structure encapsulates an individual screen font. A font
- * object is made up of however many SubFonts are necessary to display a
- * stream of multilingual characters.
- */
-
-typedef struct SubFont {
- char **fontMap; /* Pointer to font map from the FontFamily,
- * cached here to save a dereference. */
- FontFamily *familyPtr; /* The FontFamily for this SubFont. */
-} SubFont;
-
-/*
- * The following structure represents Macintosh's implementation of a font
- * object.
- */
-
-#define SUBFONT_SPACE 3
-
-typedef struct MacFont {
- TkFont font; /* Stuff used by generic font package. Must
- * be first in structure. */
- SubFont staticSubFonts[SUBFONT_SPACE];
- /* Builtin space for a limited number of
- * SubFonts. */
- int numSubFonts; /* Length of following array. */
- SubFont *subFontArray; /* Array of SubFonts that have been loaded
- * in order to draw/measure all the characters
- * encountered by this font so far. All fonts
- * start off with one SubFont initialized by
- * AllocFont() from the original set of font
- * attributes. Usually points to
- * staticSubFonts, but may point to malloced
- * space if there are lots of SubFonts. */
-
- short size; /* Font size in pixels, constructed from
- * font attributes. */
- short style; /* Style bits, constructed from font
- * attributes. */
-} MacFont;
-
-/*
- * The following structure is used to map between the UTF-8 name for a font and
- * the name that the Macintosh uses to refer to the font, in order to determine
- * if a font exists. The Macintosh names for fonts are stored in the encoding
- * of the font itself.
- */
-
-typedef struct FontNameMap {
- Tk_Uid utfName; /* The name of the font in UTF-8. */
- StringPtr nativeName; /* The name of the font in the font's encoding. */
- short faceNum; /* Unique face number for this font. */
-} FontNameMap;
-
-/*
- * The list of font families that are currently loaded. As screen fonts
- * are loaded, this list grows to hold information about what characters
- * exist in each font family.
- */
-
-static FontFamily *fontFamilyList = NULL;
-
-/*
- * Information cached about the system at startup time.
- */
-
-static FontNameMap *gFontNameMap = NULL;
-static GWorldPtr gWorld = NULL;
-
-/*
- * Procedures used only in this file.
- */
-
-static FontFamily * AllocFontFamily(CONST MacFont *fontPtr, int family);
-static SubFont * CanUseFallback(MacFont *fontPtr,
- CONST char *fallbackName, int ch);
-static SubFont * CanUseFallbackWithAliases(MacFont *fontPtr,
- CONST char *faceName, int ch, Tcl_DString *nameTriedPtr);
-static SubFont * FindSubFontForChar(MacFont *fontPtr, int ch);
-static void FontMapInsert(SubFont *subFontPtr, int ch);
-static void FontMapLoadPage(SubFont *subFontPtr, int row);
-static int FontMapLookup(SubFont *subFontPtr, int ch);
-static void FreeFontFamily(FontFamily *familyPtr);
-static void InitFont(Tk_Window tkwin, int family, int size,
- int style, MacFont *fontPtr);
-static void InitSubFont(CONST MacFont *fontPtr, int family,
- SubFont *subFontPtr);
-static void MultiFontDrawText(MacFont *fontPtr,
- CONST char *source, int numBytes, int x, int y);
-static void ReleaseFont(MacFont *fontPtr);
-static void ReleaseSubFont(SubFont *subFontPtr);
-static int SeenName(CONST char *name, Tcl_DString *dsPtr);
-
-static CONST char * BreakLine(FontFamily *familyPtr, int flags,
- CONST char *source, int numBytes, int *widthPtr);
-static int GetFamilyNum(CONST char *faceName, short *familyPtr);
-static int GetFamilyOrAliasNum(CONST char *faceName,
- short *familyPtr);
-static Tcl_Encoding GetFontEncoding(int faceNum, int allowSymbol,
- int *isSymbolPtr);
-static Tk_Uid GetUtfFaceName(StringPtr faceNameStr);
-
-
-/*
- *-------------------------------------------------------------------------
- *
- * TkpFontPkgInit --
- *
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the
- * platform-dependant code on a per application basis.
- *
- * Results:
- * None.
- *
- * Side effects:
- * See comments below.
- *
- *-------------------------------------------------------------------------
- */
-
-void
-TkpFontPkgInit(mainPtr)
- TkMainInfo *mainPtr; /* The application being created. */
-{
- MenuHandle fontMenu;
- FontNameMap *tmpFontNameMap, *newFontNameMap, *mapPtr;
- int i, j, numFonts, fontMapOffset, isSymbol;
- Str255 nativeName;
- Tcl_DString ds;
- Tcl_Encoding encoding;
- Tcl_Encoding *encodings;
-
- if (gWorld == NULL) {
- /*
- * Do the following one time only.
- */
-
- Rect rect = {0, 0, 1, 1};
-
- SetFractEnable(0);
-
- /*
- * Used for saving and restoring state while drawing and measuring.
- */
-
- if (NewGWorld(&gWorld, 0, &rect, NULL, NULL, 0) != noErr) {
- panic("TkpFontPkgInit: NewGWorld failed");
- }
-
- /*
- * The name of each font is stored in the encoding of that font.
- * How would we translate a name from UTF-8 into the native encoding
- * of the font unless we knew the encoding of that font? We can't.
- * So, precompute the UTF-8 and native names of all fonts on the
- * system. The when the user asks for font by its UTF-8 name, we
- * lookup the name in that table and really ask for the font by its
- * native name. Any unknown UTF-8 names will be mapped to the system
- * font.
- */
-
- fontMenu = NewMenu('FT', "\px");
- AppendResMenu(fontMenu, 'FONT');
-
- numFonts = CountMItems(fontMenu);
- tmpFontNameMap = (FontNameMap *) ckalloc(sizeof(FontNameMap) * numFonts);
- encodings = (Tcl_Encoding *) ckalloc(sizeof(Tcl_Encoding) * numFonts);
-
- mapPtr = tmpFontNameMap;
- for (i = 0; i < numFonts; i++) {
- GetMenuItemText(fontMenu, i + 1, nativeName);
- GetFNum(nativeName, &mapPtr->faceNum);
- encodings[i] = GetFontEncoding(mapPtr->faceNum, 0, &isSymbol);
- Tcl_ExternalToUtfDString(encodings[i], StrBody(nativeName),
- StrLength(nativeName), &ds);
- mapPtr->utfName = Tk_GetUid(Tcl_DStringValue(&ds));
- mapPtr->nativeName = (StringPtr) ckalloc(StrLength(nativeName) + 1);
- memcpy(mapPtr->nativeName, nativeName, StrLength(nativeName) + 1);
- Tcl_DStringFree(&ds);
- mapPtr++;
- }
- DisposeMenu(fontMenu);
-
- /*
- * Reorder FontNameMap so fonts with the preferred encodings are at
- * the front of the list. The relative order of fonts that all have
- * the same encoding is preserved. Fonts with unknown encodings get
- * stuck at the end.
- */
-
- newFontNameMap = (FontNameMap *) ckalloc(sizeof(FontNameMap) * (numFonts + 1));
- fontMapOffset = 0;
- for (i = 0; encodingList[i] != NULL; i++) {
- encoding = Tcl_GetEncoding(NULL, encodingList[i]);
- if (encoding == NULL) {
- continue;
- }
- for (j = 0; j < numFonts; j++) {
- if (encodings[j] == encoding) {
- newFontNameMap[fontMapOffset] = tmpFontNameMap[j];
- fontMapOffset++;
- Tcl_FreeEncoding(encodings[j]);
- tmpFontNameMap[j].utfName = NULL;
- }
- }
- Tcl_FreeEncoding(encoding);
- }
- for (i = 0; i < numFonts; i++) {
- if (tmpFontNameMap[i].utfName != NULL) {
- newFontNameMap[fontMapOffset] = tmpFontNameMap[i];
- fontMapOffset++;
- Tcl_FreeEncoding(encodings[i]);
- }
- }
- if (fontMapOffset != numFonts) {
- panic("TkpFontPkgInit: unexpected number of fonts");
- }
-
- mapPtr = &newFontNameMap[numFonts];
- mapPtr->utfName = NULL;
- mapPtr->nativeName = NULL;
- mapPtr->faceNum = 0;
-
- ckfree((char *) tmpFontNameMap);
- ckfree((char *) encodings);
-
- gFontNameMap = newFontNameMap;
- }
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkpGetNativeFont --
- *
- * Map a platform-specific native font name to a TkFont.
- *
- * Results:
- * The return value is a pointer to a TkFont that represents the
- * native font. If a native font by the given name could not be
- * found, the return value is NULL.
- *
- * Every call to this procedure returns a new TkFont structure,
- * even if the name has already been seen before. The caller should
- * call TkpDeleteFont() when the font is no longer needed.
- *
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generics TkFont before calling TkpDeleteFont().
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-TkFont *
-TkpGetNativeFont(
- Tk_Window tkwin, /* For display where font will be used. */
- CONST char *name) /* Platform-specific font name. */
-{
- short family;
- MacFont *fontPtr;
-
- if (strcmp(name, "system") == 0) {
- family = GetSysFont();
- } else if (strcmp(name, "application") == 0) {
- family = GetAppFont();
- } else {
- return NULL;
- }
-
- fontPtr = (MacFont *) ckalloc(sizeof(MacFont));
- InitFont(tkwin, family, 0, 0, fontPtr);
-
- return (TkFont *) fontPtr;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkpGetFontFromAttributes --
- *
- * Given a desired set of attributes for a font, find a font with
- * the closest matching attributes.
- *
- * Results:
- * The return value is a pointer to a TkFont that represents the
- * font with the desired attributes. If a font with the desired
- * attributes could not be constructed, some other font will be
- * substituted automatically.
- *
- * Every call to this procedure returns a new TkFont structure,
- * even if the specified attributes have already been seen before.
- * The caller should call TkpDeleteFont() to free the platform-
- * specific data when the font is no longer needed.
- *
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generic TkFont before calling TkpDeleteFont().
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-TkFont *
-TkpGetFontFromAttributes(
- TkFont *tkFontPtr, /* If non-NULL, store the information in
- * this existing TkFont structure, rather than
- * allocating a new structure to hold the
- * font; the existing contents of the font
- * will be released. If NULL, a new TkFont
- * structure is allocated. */
- Tk_Window tkwin, /* For display where font will be used. */
- CONST TkFontAttributes *faPtr)
- /* Set of attributes to match. */
-{
- short faceNum, style;
- int i, j;
- CONST char *faceName;
- char *fallback;
- char ***fallbacks;
- MacFont *fontPtr;
-
- /*
- * Algorithm to get the closest font to the one requested.
- *
- * try fontname
- * try all aliases for fontname
- * foreach fallback for fontname
- * try the fallback
- * try all aliases for the fallback
- */
-
- faceNum = 0;
- faceName = faPtr->family;
- if (faceName != NULL) {
- if (GetFamilyOrAliasNum(faceName, &faceNum) != 0) {
- goto found;
- }
- fallbacks = TkFontGetFallbacks();
- for (i = 0; fallbacks[i] != NULL; i++) {
- for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
- if (strcasecmp(faceName, fallback) == 0) {
- for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
- if (GetFamilyOrAliasNum(fallback, &faceNum)) {
- goto found;
- }
- }
- }
- break;
- }
- }
- }
-
- found:
- style = 0;
- if (faPtr->weight != TK_FW_NORMAL) {
- style |= bold;
- }
- if (faPtr->slant != TK_FS_ROMAN) {
- style |= italic;
- }
- if (faPtr->underline) {
- style |= underline;
- }
- if (tkFontPtr == NULL) {
- fontPtr = (MacFont *) ckalloc(sizeof(MacFont));
- } else {
- fontPtr = (MacFont *) tkFontPtr;
- ReleaseFont(fontPtr);
- }
- InitFont(tkwin, faceNum, faPtr->size, style, fontPtr);
-
- return (TkFont *) fontPtr;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkpDeleteFont --
- *
- * Called to release a font allocated by TkpGetNativeFont() or
- * TkpGetFontFromAttributes(). The caller should have already
- * released the fields of the TkFont that are used exclusively by
- * the generic TkFont code.
- *
- * Results:
- * None.
- *
- * Side effects:
- * TkFont is deallocated.
- *
- *---------------------------------------------------------------------------
- */
-
-void
-TkpDeleteFont(
- TkFont *tkFontPtr) /* Token of font to be deleted. */
-{
- MacFont *fontPtr;
-
- fontPtr = (MacFont *) tkFontPtr;
- ReleaseFont(fontPtr);
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkpGetFontFamilies --
- *
- * Return information about the font families that are available
- * on the display of the given window.
- *
- * Results:
- * Modifies interp's result object to hold a list of all the available
- * font families.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-void
-TkpGetFontFamilies(
- Tcl_Interp *interp, /* Interp to hold result. */
- Tk_Window tkwin) /* For display to query. */
-{
- FontNameMap *mapPtr;
- Tcl_Obj *resultPtr, *strPtr;
-
- resultPtr = Tcl_GetObjResult(interp);
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- strPtr = Tcl_NewStringObj(mapPtr->utfName, -1);
- Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
- }
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * TkpGetSubFonts --
- *
- * A function used by the testing package for querying the actual
- * screen fonts that make up a font object.
- *
- * Results:
- * Modifies interp's result object to hold a list containing the
- * names of the screen fonts that make up the given font object.
- *
- * Side effects:
- * None.
- *
- *-------------------------------------------------------------------------
- */
-
-void
-TkpGetSubFonts(interp, tkfont)
- Tcl_Interp *interp; /* Interp to hold result. */
- Tk_Font tkfont; /* Font object to query. */
-{
- int i;
- Tcl_Obj *resultPtr, *strPtr;
- MacFont *fontPtr;
- FontFamily *familyPtr;
- Str255 nativeName;
-
- resultPtr = Tcl_GetObjResult(interp);
- fontPtr = (MacFont *) tkfont;
- for (i = 0; i < fontPtr->numSubFonts; i++) {
- familyPtr = fontPtr->subFontArray[i].familyPtr;
- GetFontName(familyPtr->faceNum, nativeName);
- strPtr = Tcl_NewStringObj(GetUtfFaceName(nativeName), -1);
- Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
- }
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Tk_MeasureChars --
- *
- * Determine the number of characters from the string that will fit
- * in the given horizontal span. The measurement is done under the
- * assumption that Tk_DrawChars() will be used to actually display
- * the characters.
- *
- * Results:
- * The return value is the number of bytes from source that
- * fit into the span that extends from 0 to maxLength. *lengthPtr is
- * filled with the x-coordinate of the right edge of the last
- * character that did fit.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-int
-Tk_MeasureChars(
- Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. */
- int numBytes, /* Maximum number of bytes to consider
- * from source string. */
- int maxLength, /* If >= 0, maxLength specifies the longest
- * permissible line length; don't consider any
- * character that would cross this
- * x-position. If < 0, then line length is
- * unbounded and the flags argument is
- * ignored. */
- int flags, /* Various flag bits OR-ed together:
- * TK_PARTIAL_OK means include the last char
- * which only partially fit on this line.
- * TK_WHOLE_WORDS means stop on a word
- * boundary, if possible.
- * TK_AT_LEAST_ONE means return at least one
- * character even if no characters fit. */
- int *lengthPtr) /* Filled with x-location just after the
- * terminating character. */
-{
- MacFont *fontPtr;
- FontFamily *lastFamilyPtr;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- int curX, curByte;
-
- /*
- * According to "Inside Macintosh: Text", the Macintosh may
- * automatically substitute
- * ligatures or context-sensitive presentation forms when
- * measuring/displaying text within a font run. We cannot safely
- * measure individual characters and add up the widths w/o errors.
- * However, if we convert a range of text from UTF-8 to, say,
- * Shift-JIS, and get the offset into the Shift-JIS string as to
- * where a word or line break would occur, then can we map that
- * number back to UTF-8?
- */
-
- fontPtr = (MacFont *) tkfont;
-
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(gWorld, NULL);
-
- TextSize(fontPtr->size);
- TextFace(fontPtr->style);
-
- lastFamilyPtr = fontPtr->subFontArray[0].familyPtr;
-
- if (numBytes == 0) {
- curX = 0;
- curByte = 0;
- } else if (maxLength < 0) {
- CONST char *p, *end, *next;
- Tcl_UniChar ch;
- FontFamily *thisFamilyPtr;
- Tcl_DString runString;
-
- /*
- * A three step process:
- * 1. Find a contiguous range of characters that can all be
- * represented by a single screen font.
- * 2. Convert those chars to the encoding of that font.
- * 3. Measure converted chars.
- */
-
- curX = 0;
- end = source + numBytes;
- for (p = source; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisFamilyPtr = FindSubFontForChar(fontPtr, ch)->familyPtr;
- if (thisFamilyPtr != lastFamilyPtr) {
- TextFont(lastFamilyPtr->faceNum);
- Tcl_UtfToExternalDString(lastFamilyPtr->encoding, source,
- p - source, &runString);
- curX += TextWidth(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
- lastFamilyPtr = thisFamilyPtr;
- source = p;
- }
- p = next;
- }
- TextFont(lastFamilyPtr->faceNum);
- Tcl_UtfToExternalDString(lastFamilyPtr->encoding, source, p - source,
- &runString);
- curX += TextWidth(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
- curByte = numBytes;
- } else {
- CONST char *p, *end, *next, *sourceOrig;
- int widthLeft;
- FontFamily *thisFamilyPtr;
- Tcl_UniChar ch;
- CONST char *rest;
-
- /*
- * How many chars will fit in the space allotted?
- */
-
- if (maxLength > 32767) {
- maxLength = 32767;
- }
-
- widthLeft = maxLength;
- sourceOrig = source;
- end = source + numBytes;
- for (p = source; p < end; p = next) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisFamilyPtr = FindSubFontForChar(fontPtr, ch)->familyPtr;
- if (thisFamilyPtr != lastFamilyPtr) {
- if (p > source) {
- rest = BreakLine(lastFamilyPtr, flags, source,
- p - source, &widthLeft);
- flags &= ~TK_AT_LEAST_ONE;
- if (rest != NULL) {
- p = source;
- break;
- }
- }
- lastFamilyPtr = thisFamilyPtr;
- source = p;
- }
- }
-
- if (p > source) {
- rest = BreakLine(lastFamilyPtr, flags, source, p - source,
- &widthLeft);
- }
-
- if (rest == NULL) {
- curByte = numBytes;
- } else {
- curByte = rest - sourceOrig;
- }
- curX = maxLength - widthLeft;
- }
-
- SetGWorld(saveWorld, saveDevice);
-
- *lengthPtr = curX;
- return curByte;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * BreakLine --
- *
- * Determine where the given line of text should be broken so that it
- * fits in the specified range. Before calling this function, the
- * font values and graphics port must be set.
- *
- * Results:
- * The return value is NULL if the specified range is larger that the
- * space the text needs, and *widthLeftPtr is filled with how much
- * space is left in the range after measuring the whole text buffer.
- * Otherwise, the return value is a pointer into the text buffer that
- * indicates where the line should be broken (up to, but not including
- * that character), and *widthLeftPtr is filled with how much space is
- * left in the range after measuring up to that character.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-static CONST char *
-BreakLine(
- FontFamily *familyPtr, /* FontFamily that describes the font values
- * that are already selected into the graphics
- * port. */
- int flags, /* Various flag bits OR-ed together:
- * TK_PARTIAL_OK means include the last char
- * which only partially fit on this line.
- * TK_WHOLE_WORDS means stop on a word
- * boundary, if possible.
- * TK_AT_LEAST_ONE means return at least one
- * character even if no characters fit. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. */
- int numBytes, /* Maximum number of bytes to consider
- * from source string. */
- int *widthLeftPtr) /* On input, specifies size of range into
- * which characters from source buffer should
- * be fit. On output, filled with how much
- * space is left after fitting as many
- * characters as possible into the range.
- * Result may be negative if TK_AT_LEAST_ONE
- * was specified in the flags argument. */
-{
- Fixed pixelWidth, widthLeft;
- StyledLineBreakCode breakCode;
- Tcl_DString runString;
- long textOffset;
- Boolean leadingEdge;
- Point point;
- int charOffset, thisCharWasDoubleByte;
- char *p, *end, *typeTable;
-
- TextFont(familyPtr->faceNum);
- Tcl_UtfToExternalDString(familyPtr->encoding, source, numBytes,
- &runString);
- pixelWidth = Int2Fixed(*widthLeftPtr) + 1;
- if (flags & TK_WHOLE_WORDS) {
- textOffset = (flags & TK_AT_LEAST_ONE);
- widthLeft = pixelWidth;
- breakCode = StyledLineBreak(Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString), 0, Tcl_DStringLength(&runString),
- 0, &widthLeft, &textOffset);
- if (breakCode != smBreakOverflow) {
- /*
- * StyledLineBreak includes all the space characters at the end of
- * line that we want to suppress.
- */
-
- textOffset = VisibleLength(Tcl_DStringValue(&runString), textOffset);
- goto getoffset;
- }
- } else {
- point.v = 1;
- point.h = 1;
- textOffset = PixelToChar(Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString), 0, pixelWidth, &leadingEdge,
- &widthLeft, smOnlyStyleRun, point, point);
- if (Fixed2Int(widthLeft) < 0) {
- goto getoffset;
- }
- }
- *widthLeftPtr = Fixed2Int(widthLeft);
- Tcl_DStringFree(&runString);
- return NULL;
-
- /*
- * The conversion routine that converts UTF-8 to the target encoding
- * must map one UTF-8 character to exactly one encoding-specific
- * character, so that the following algorithm works:
- *
- * 1. Get byte offset of where line should be broken.
- * 2. Get char offset corresponding to that byte offset.
- * 3. Map that char offset to byte offset in UTF-8 string.
- */
-
- getoffset:
- thisCharWasDoubleByte = 0;
- if (familyPtr->isMultiByteFont == 0) {
- charOffset = textOffset;
- } else {
- charOffset = 0;
- typeTable = familyPtr->typeTable;
-
- p = Tcl_DStringValue(&runString);
- end = p + textOffset;
- thisCharWasDoubleByte = typeTable[*((unsigned char *) p)];
- for ( ; p < end; p++) {
- thisCharWasDoubleByte = typeTable[*((unsigned char *) p)];
- p += thisCharWasDoubleByte;
- charOffset++;
- }
- }
-
- if ((flags & TK_WHOLE_WORDS) == 0) {
- if ((flags & TK_PARTIAL_OK) && (leadingEdge != 0)) {
- textOffset += thisCharWasDoubleByte;
- textOffset++;
- charOffset++;
- } else if (((flags & TK_PARTIAL_OK) == 0) && (leadingEdge == 0)) {
- textOffset -= thisCharWasDoubleByte;
- textOffset--;
- charOffset--;
- }
- }
- if ((textOffset == 0) && (Tcl_DStringLength(&runString) > 0)
- && (flags & TK_AT_LEAST_ONE)) {
- p = Tcl_DStringValue(&runString);
- textOffset += familyPtr->typeTable[*((unsigned char *) p)];
- textOffset++;
- charOffset++;
- }
- *widthLeftPtr = Fixed2Int(pixelWidth)
- - TextWidth(Tcl_DStringValue(&runString), 0, textOffset);
- Tcl_DStringFree(&runString);
- return Tcl_UtfAtIndex(source, charOffset);
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Tk_DrawChars --
- *
- * Draw a string of characters on the screen.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Information gets drawn on the screen.
- *
- *---------------------------------------------------------------------------
- */
-
-void
-Tk_DrawChars(
- Display *display, /* Display on which to draw. */
- Drawable drawable, /* Window or pixmap in which to draw. */
- GC gc, /* Graphics context for drawing characters. */
- Tk_Font tkfont, /* Font in which characters will be drawn;
- * must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
- * (tabs, control characters, and newlines)
- * should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
- * regular printing characters. */
- int numBytes, /* Number of bytes in string. */
- int x, int y) /* Coordinates at which to place origin of
- * string when drawing. */
-{
- MacFont *fontPtr;
- MacDrawable *macWin;
- RGBColor macColor, origColor;
- GWorldPtr destPort;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- short txFont, txFace, txSize;
- BitMapPtr stippleMap;
-
- fontPtr = (MacFont *) tkfont;
- macWin = (MacDrawable *) drawable;
-
- destPort = TkMacGetDrawablePort(drawable);
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- TkMacSetUpClippingRgn(drawable);
- TkMacSetUpGraphicsPort(gc);
-
- txFont = tcl_macQdPtr->thePort->txFont;
- txFace = tcl_macQdPtr->thePort->txFace;
- txSize = tcl_macQdPtr->thePort->txSize;
- GetForeColor(&origColor);
-
- if ((gc->fill_style == FillStippled
- || gc->fill_style == FillOpaqueStippled)
- && gc->stipple != None) {
- Pixmap pixmap;
- GWorldPtr bufferPort;
-
- stippleMap = TkMacMakeStippleMap(drawable, gc->stipple);
-
- pixmap = Tk_GetPixmap(display, drawable,
- stippleMap->bounds.right, stippleMap->bounds.bottom, 0);
-
- bufferPort = TkMacGetDrawablePort(pixmap);
- SetGWorld(bufferPort, NULL);
-
- if (TkSetMacColor(gc->foreground, &macColor) == true) {
- RGBForeColor(&macColor);
- }
- ShowPen();
- FillRect(&stippleMap->bounds, &tcl_macQdPtr->white);
- MultiFontDrawText(fontPtr, source, numBytes, 0, 0);
-
- SetGWorld(destPort, NULL);
- CopyDeepMask(&((GrafPtr) bufferPort)->portBits, stippleMap,
- &((GrafPtr) destPort)->portBits, &stippleMap->bounds,
- &stippleMap->bounds, &((GrafPtr) destPort)->portRect,
- srcOr, NULL);
-
- /* TODO: this doesn't work quite right - it does a blend. you can't
- * draw white text when you have a stipple.
- */
-
- Tk_FreePixmap(display, pixmap);
- ckfree(stippleMap->baseAddr);
- ckfree((char *)stippleMap);
- } else {
- if (TkSetMacColor(gc->foreground, &macColor) == true) {
- RGBForeColor(&macColor);
- }
- ShowPen();
- MultiFontDrawText(fontPtr, source, numBytes, macWin->xOff + x,
- macWin->yOff + y);
- }
-
- TextFont(txFont);
- TextSize(txSize);
- TextFace(txFace);
- RGBForeColor(&origColor);
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * MultiFontDrawText --
- *
- * Helper function for Tk_DrawChars. Draws characters, using the
- * various screen fonts in fontPtr to draw multilingual characters.
- * Note: No bidirectional support.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Information gets drawn on the screen.
- * Contents of fontPtr may be modified if more subfonts were loaded
- * in order to draw all the multilingual characters in the given
- * string.
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-MultiFontDrawText(
- MacFont *fontPtr, /* Contains set of fonts to use when drawing
- * following string. */
- CONST char *source, /* Potentially multilingual UTF-8 string. */
- int numBytes, /* Length of string in bytes. */
- int x, int y) /* Coordinates at which to place origin *
- * of string when drawing. */
-{
- FontFamily *lastFamilyPtr, *thisFamilyPtr;
- Tcl_DString runString;
- CONST char *p, *end, *next;
- Tcl_UniChar ch;
-
- TextSize(fontPtr->size);
- TextFace(fontPtr->style);
-
- lastFamilyPtr = fontPtr->subFontArray[0].familyPtr;
-
- end = source + numBytes;
- for (p = source; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisFamilyPtr = FindSubFontForChar(fontPtr, ch)->familyPtr;
- if (thisFamilyPtr != lastFamilyPtr) {
- if (p > source) {
- TextFont(lastFamilyPtr->faceNum);
- Tcl_UtfToExternalDString(lastFamilyPtr->encoding, source,
- p - source, &runString);
- MoveTo((short) x, (short) y);
- DrawText(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- x += TextWidth(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
- source = p;
- }
- lastFamilyPtr = thisFamilyPtr;
- }
- p = next;
- }
- if (p > source) {
- TextFont(thisFamilyPtr->faceNum);
- Tcl_UtfToExternalDString(lastFamilyPtr->encoding, source,
- p - source, &runString);
- MoveTo((short) x, (short) y);
- DrawText(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
- }
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * TkMacIsCharacterMissing --
- *
- * Given a tkFont and a character determines whether the character has
- * a glyph defined in the font or not. Note that this is potentially
- * not compatible with Mac OS 8 as it looks at the font handle
- * structure directly. Looks into the character array of the font
- * handle to determine whether the glyph is defined or not.
- *
- * Results:
- * Returns a 1 if the character is missing, a 0 if it is not.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-int
-TkMacIsCharacterMissing(
- Tk_Font tkfont, /* The font we are looking in. */
- unsigned int searchChar) /* The character we are looking for. */
-{
- MacFont *fontPtr = (MacFont *) tkfont;
- FMInput fm;
- FontRec **fontRecHandle;
-
- fm.family = fontPtr->subFontArray[0].familyPtr->faceNum;
- fm.size = fontPtr->size;
- fm.face = fontPtr->style;
- fm.needBits = 0;
- fm.device = 0;
- fm.numer.h = fm.numer.v = fm.denom.h = fm.denom.v = 1;
-
-#if !defined(UNIVERSAL_INTERFACES_VERSION) || (UNIVERSAL_INTERFACES_VERSION < 0x0300)
- fontRecHandle = (FontRec **) FMSwapFont(&fm)->fontResult;
-#else
- fontRecHandle = (FontRec **) FMSwapFont(&fm)->fontHandle;
-#endif
- return *(short *) ((long) &(*fontRecHandle)->owTLoc
- + ((long)((*fontRecHandle)->owTLoc + searchChar
- - (*fontRecHandle)->firstChar) * sizeof(short))) == -1;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * InitFont --
- *
- * Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Initializes the memory for a MacFont that wraps the platform-specific
- * data.
- *
- * The caller is responsible for initializing the fields of the
- * TkFont that are used exclusively by the generic TkFont code, and
- * for releasing those fields before calling TkpDeleteFont().
- *
- * Results:
- * Fills the MacFont structure.
- *
- * Side effects:
- * Memory allocated.
- *
- *---------------------------------------------------------------------------
- */
-
-static void
-InitFont(
- Tk_Window tkwin, /* For display where font will be used. */
- int faceNum, /* Macintosh font number. */
- int size, /* Point size for Macintosh font. */
- int style, /* Macintosh style bits. */
- MacFont *fontPtr) /* Filled with information constructed from
- * the above arguments. */
-{
- Str255 nativeName;
- FontInfo fi;
- TkFontAttributes *faPtr;
- TkFontMetrics *fmPtr;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- short pixels;
-
- if (size == 0) {
- size = -GetDefFontSize();
- }
- pixels = (short) TkFontGetPixels(tkwin, size);
-
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(gWorld, NULL);
- TextFont(faceNum);
- TextSize(pixels);
- TextFace(style);
-
- GetFontInfo(&fi);
- GetFontName(faceNum, nativeName);
-
- fontPtr->font.fid = (Font) fontPtr;
-
- faPtr = &fontPtr->font.fa;
- faPtr->family = GetUtfFaceName(nativeName);
- faPtr->size = TkFontGetPoints(tkwin, size);
- faPtr->weight = (style & bold) ? TK_FW_BOLD : TK_FW_NORMAL;
- faPtr->slant = (style & italic) ? TK_FS_ITALIC : TK_FS_ROMAN;
- faPtr->underline = ((style & underline) != 0);
- faPtr->overstrike = 0;
-
- fmPtr = &fontPtr->font.fm;
- fmPtr->ascent = fi.ascent;
- fmPtr->descent = fi.descent;
- fmPtr->maxWidth = fi.widMax;
- fmPtr->fixed = (CharWidth('i') == CharWidth('w'));
-
- fontPtr->size = pixels;
- fontPtr->style = (short) style;
-
- fontPtr->numSubFonts = 1;
- fontPtr->subFontArray = fontPtr->staticSubFonts;
- InitSubFont(fontPtr, faceNum, &fontPtr->subFontArray[0]);
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * ReleaseFont --
- *
- * Called to release the Macintosh-specific contents of a TkFont.
- * The caller is responsible for freeing the memory used by the
- * font itself.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Memory is freed.
- *
- *---------------------------------------------------------------------------
- */
-
-static void
-ReleaseFont(
- MacFont *fontPtr) /* The font to delete. */
-{
- int i;
-
- for (i = 0; i < fontPtr->numSubFonts; i++) {
- ReleaseSubFont(&fontPtr->subFontArray[i]);
- }
- if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
- }
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * InitSubFont --
- *
- * Wrap a screen font and load the FontFamily that represents
- * it. Used to prepare a SubFont so that characters can be mapped
- * from UTF-8 to the charset of the font.
- *
- * Results:
- * The subFontPtr is filled with information about the font.
- *
- * Side effects:
- * None.
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-InitSubFont(
- CONST MacFont *fontPtr, /* Font object in which the SubFont will be
- * used. */
- int faceNum, /* The font number. */
- SubFont *subFontPtr) /* Filled with SubFont constructed from
- * above attributes. */
-{
- subFontPtr->familyPtr = AllocFontFamily(fontPtr, faceNum);
- subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * ReleaseSubFont --
- *
- * Called to release the contents of a SubFont. The caller is
- * responsible for freeing the memory used by the SubFont itself.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Memory and resources are freed.
- *
- *---------------------------------------------------------------------------
- */
-
-static void
-ReleaseSubFont(
- SubFont *subFontPtr) /* The SubFont to delete. */
-{
- FreeFontFamily(subFontPtr->familyPtr);
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * AllocFontFamily --
- *
- * Find the FontFamily structure associated with the given font
- * family. The information should be stored by the caller in a
- * SubFont and used when determining if that SubFont supports a
- * character.
- *
- * Results:
- * A pointer to a FontFamily. The reference count in the FontFamily
- * is automatically incremented. When the SubFont is released, the
- * reference count is decremented. When no SubFont is using this
- * FontFamily, it may be deleted.
- *
- * Side effects:
- * A new FontFamily structure will be allocated if this font family
- * has not been seen.
- *
- *-------------------------------------------------------------------------
- */
-
-static FontFamily *
-AllocFontFamily(
- CONST MacFont *fontPtr, /* Font object in which the FontFamily will
- * be used. */
- int faceNum) /* The font number. */
-{
- FontFamily *familyPtr;
- int i;
-
- familyPtr = fontFamilyList;
- for (; familyPtr != NULL; familyPtr = familyPtr->nextPtr) {
- if (familyPtr->faceNum == faceNum) {
- familyPtr->refCount++;
- return familyPtr;
- }
- }
-
- familyPtr = (FontFamily *) ckalloc(sizeof(FontFamily));
- memset(familyPtr, 0, sizeof(FontFamily));
- familyPtr->nextPtr = fontFamilyList;
- fontFamilyList = familyPtr;
-
- /*
- * Set key for this FontFamily.
- */
-
- familyPtr->faceNum = faceNum;
-
- /*
- * An initial refCount of 2 means that FontFamily information will
- * persist even when the SubFont that loaded the FontFamily is released.
- * Change it to 1 to cause FontFamilies to be unloaded when not in use.
- */
-
- familyPtr->refCount = 2;
- familyPtr->encoding = GetFontEncoding(faceNum, 1, &familyPtr->isSymbolFont);
- familyPtr->isMultiByteFont = 0;
- FillParseTable(familyPtr->typeTable, FontToScript(faceNum));
- for (i = 0; i < 256; i++) {
- if (familyPtr->typeTable[i] != 0) {
- familyPtr->isMultiByteFont = 1;
- break;
- }
- }
- return familyPtr;
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * FreeFontFamily --
- *
- * Called to free a FontFamily when the SubFont is finished using it.
- * Frees the contents of the FontFamily and the memory used by the
- * FontFamily itself.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-FreeFontFamily(
- FontFamily *familyPtr) /* The FontFamily to delete. */
-{
- FontFamily **familyPtrPtr;
- int i;
-
- if (familyPtr == NULL) {
- return;
- }
- familyPtr->refCount--;
- if (familyPtr->refCount > 0) {
- return;
- }
- Tcl_FreeEncoding(familyPtr->encoding);
- for (i = 0; i < FONTMAP_PAGES; i++) {
- if (familyPtr->fontMap[i] != NULL) {
- ckfree((char *) familyPtr->fontMap[i]);
- }
- }
-
- /*
- * Delete from list.
- */
-
- for (familyPtrPtr = &fontFamilyList; ; ) {
- if (*familyPtrPtr == familyPtr) {
- *familyPtrPtr = familyPtr->nextPtr;
- break;
- }
- familyPtrPtr = &(*familyPtrPtr)->nextPtr;
- }
-
- ckfree((char *) familyPtr);
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * FindSubFontForChar --
- *
- * Determine which physical screen font is necessary to use to
- * display the given character. If the font object does not have
- * a screen font that can display the character, another screen font
- * may be loaded into the font object, following a set of preferred
- * fallback rules.
- *
- * Results:
- * The return value is the SubFont to use to display the given
- * character.
- *
- * Side effects:
- * The contents of fontPtr are modified to cache the results
- * of the lookup and remember any SubFonts that were dynamically
- * loaded.
- *
- *-------------------------------------------------------------------------
- */
-
-static SubFont *
-FindSubFontForChar(
- MacFont *fontPtr, /* The font object with which the character
- * will be displayed. */
- int ch) /* The Unicode character to be displayed. */
-{
- int i, j, k;
- CONST char *fallbackName;
- char **aliases;
- SubFont *subFontPtr;
- FontNameMap *mapPtr;
- Tcl_DString faceNames;
- char ***fontFallbacks;
- char **anyFallbacks;
-
- if (FontMapLookup(&fontPtr->subFontArray[0], ch)) {
- return &fontPtr->subFontArray[0];
- }
-
- for (i = 1; i < fontPtr->numSubFonts; i++) {
- if (FontMapLookup(&fontPtr->subFontArray[i], ch)) {
- return &fontPtr->subFontArray[i];
- }
- }
-
- /*
- * Keep track of all face names that we check, so we don't check some
- * name multiple times if it can be reached by multiple paths.
- */
-
- Tcl_DStringInit(&faceNames);
-
- aliases = TkFontGetAliasList(fontPtr->font.fa.family);
-
- subFontPtr = NULL;
- fontFallbacks = TkFontGetFallbacks();
- for (i = 0; fontFallbacks[i] != NULL; i++) {
- for (j = 0; fontFallbacks[i][j] != NULL; j++) {
- fallbackName = fontFallbacks[i][j];
- if (strcasecmp(fallbackName, fontPtr->font.fa.family) == 0) {
- /*
- * If the base font has a fallback...
- */
-
- goto tryfallbacks;
- } else if (aliases != NULL) {
- /*
- * Or if an alias for the base font has a fallback...
- */
-
- for (k = 0; aliases[k] != NULL; k++) {
- if (strcasecmp(aliases[k], fallbackName) == 0) {
- goto tryfallbacks;
- }
- }
- }
- }
- continue;
-
- /*
- * ...then see if we can use one of the fallbacks, or an
- * alias for one of the fallbacks.
- */
-
- tryfallbacks:
- for (j = 0; fontFallbacks[i][j] != NULL; j++) {
- fallbackName = fontFallbacks[i][j];
- subFontPtr = CanUseFallbackWithAliases(fontPtr, fallbackName,
- ch, &faceNames);
- if (subFontPtr != NULL) {
- goto end;
- }
- }
- }
-
- /*
- * See if we can use something from the global fallback list.
- */
-
- anyFallbacks = TkFontGetGlobalClass();
- for (i = 0; anyFallbacks[i] != NULL; i++) {
- fallbackName = anyFallbacks[i];
- subFontPtr = CanUseFallbackWithAliases(fontPtr, fallbackName, ch,
- &faceNames);
- if (subFontPtr != NULL) {
- goto end;
- }
- }
-
- /*
- * Try all face names available in the whole system until we
- * find one that can be used.
- */
-
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- fallbackName = mapPtr->utfName;
- if (SeenName(fallbackName, &faceNames) == 0) {
- subFontPtr = CanUseFallback(fontPtr, fallbackName, ch);
- if (subFontPtr != NULL) {
- goto end;
- }
- }
- }
-
- end:
- Tcl_DStringFree(&faceNames);
-
- if (subFontPtr == NULL) {
- /*
- * No font can display this character. We will use the base font
- * and have it display the "unknown" character.
- */
-
- subFontPtr = &fontPtr->subFontArray[0];
- FontMapInsert(subFontPtr, ch);
- }
- return subFontPtr;
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * FontMapLookup --
- *
- * See if the screen font can display the given character.
- *
- * Results:
- * The return value is 0 if the screen font cannot display the
- * character, non-zero otherwise.
- *
- * Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
- *
- *-------------------------------------------------------------------------
- */
-
-static int
-FontMapLookup(
- SubFont *subFontPtr, /* Contains font mapping cache to be queried
- * and possibly updated. */
- int ch) /* Character to be tested. */
-{
- int row, bitOffset;
-
- row = ch >> FONTMAP_SHIFT;
- if (subFontPtr->fontMap[row] == NULL) {
- FontMapLoadPage(subFontPtr, row);
- }
- bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
- return (subFontPtr->fontMap[row][bitOffset >> 3] >> (bitOffset & 7)) & 1;
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * FontMapInsert --
- *
- * Tell the font mapping cache that the given screen font should be
- * used to display the specified character. This is called when no
- * font on the system can be be found that can display that
- * character; we lie to the font and tell it that it can display
- * the character, otherwise we would end up re-searching the entire
- * fallback hierarchy every time that character was seen.
- *
- * Results:
- * None.
- *
- * Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-FontMapInsert(
- SubFont *subFontPtr, /* Contains font mapping cache to be
- * updated. */
- int ch) /* Character to be added to cache. */
-{
- int row, bitOffset;
-
- row = ch >> FONTMAP_SHIFT;
- if (subFontPtr->fontMap[row] == NULL) {
- FontMapLoadPage(subFontPtr, row);
- }
- bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
- subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * FontMapLoadPage --
- *
- * Load information about all the characters on a given page.
- * This information consists of one bit per character that indicates
- * whether the associated HFONT can (1) or cannot (0) display the
- * characters on the page.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Mempry allocated.
- *
- *-------------------------------------------------------------------------
- */
-static void
-FontMapLoadPage(
- SubFont *subFontPtr, /* Contains font mapping cache to be
- * updated. */
- int row) /* Index of the page to be loaded into
- * the cache. */
-{
- FMInput fm;
- FontRec *fontRecPtr;
- short *widths;
- int i, end, bitOffset, isMultiByteFont;
- char src[TCL_UTF_MAX];
- unsigned char buf[16];
- int srcRead, dstWrote;
- Tcl_Encoding encoding;
- Handle fHandle;
- short theID;
- ResType theType;
- Str255 theName;
-
- subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
- memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
-
- encoding = subFontPtr->familyPtr->encoding;
-
- fm.family = subFontPtr->familyPtr->faceNum;
- fm.size = 12;
- fm.face = 0;
- fm.needBits = 0;
- fm.device = 0;
- fm.numer.h = 1;
- fm.numer.v = 1;
- fm.denom.h = 1;
- fm.denom.v = 1;
-
-#if !defined(UNIVERSAL_INTERFACES_VERSION) || (UNIVERSAL_INTERFACES_VERSION < 0x0300)
- fHandle = FMSwapFont(&fm)->fontHandle;
-#else
- fHandle = FMSwapFont(&fm)->fontHandle;
-#endif
- GetResInfo(fHandle, &theID, &theType, theName);
- isMultiByteFont = subFontPtr->familyPtr->isMultiByteFont;
- if( theType=='sfnt' ) {
- /*
- * Found an outline font which has very complex font record.
- * Let's just assume *ALL* the characters are allowed.
- */
-
- end = (row + 1) << FONTMAP_SHIFT;
- for (i = row << FONTMAP_SHIFT; i < end; i++) {
- if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i,
- src),
- TCL_ENCODING_STOPONERROR, NULL, (char *) buf,
- sizeof(buf),
- &srcRead, &dstWrote, NULL) == TCL_OK) {
- bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
- subFontPtr->fontMap[row][bitOffset >> 3] |= 1
- << (bitOffset & 7);
- }
- }
- } else {
- /*
- * Found an old bitmap font which has a well-defined record.
- * We can check the width table to see which characters exist.
- */
-
- fontRecPtr = *((FontRec **) fHandle );
- widths = (short *) ((long) &fontRecPtr->owTLoc
- + ((long) (fontRecPtr->owTLoc - fontRecPtr->firstChar)
- * sizeof(short)));
-
- end = (row + 1) << FONTMAP_SHIFT;
- for (i = row << FONTMAP_SHIFT; i < end; i++) {
- if (Tcl_UtfToExternal(NULL, encoding, src,
- Tcl_UniCharToUtf(i, src),
- TCL_ENCODING_STOPONERROR, NULL, (char *) buf, sizeof(buf),
- &srcRead, &dstWrote, NULL) == TCL_OK) {
-
- if (((isMultiByteFont != 0) && (buf[0] > 31))
- || (widths[buf[0]] != -1)) {
- if ((buf[0] == 0x11) && (widths[0x12] == -1)) {
- continue;
- }
-
- /*
- * Mac's char existence metrics are only for one-byte
- * characters. If we have a double-byte char, just
- * assume that the font supports that char if the font's
- * encoding supports that char.
- */
-
- bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
- subFontPtr->fontMap[row][bitOffset >> 3] |= 1
- << (bitOffset & 7);
- }
- }
- }
- }
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * CanUseFallbackWithAliases --
- *
- * Helper function for FindSubFontForChar. Determine if the
- * specified face name (or an alias of the specified face name)
- * can be used to construct a screen font that can display the
- * given character.
- *
- * Results:
- * See CanUseFallback().
- *
- * Side effects:
- * If the name and/or one of its aliases was rejected, the
- * rejected string is recorded in nameTriedPtr so that it won't
- * be tried again.
- *
- *---------------------------------------------------------------------------
- */
-
-static SubFont *
-CanUseFallbackWithAliases(
- MacFont *fontPtr, /* The font object that will own the new
- * screen font. */
- CONST char *faceName, /* Desired face name for new screen font. */
- int ch, /* The Unicode character that the new
- * screen font must be able to display. */
- Tcl_DString *nameTriedPtr) /* Records face names that have already
- * been tried. It is possible for the same
- * face name to be queried multiple times when
- * trying to find a suitable screen font. */
-{
- SubFont *subFontPtr;
- char **aliases;
- int i;
-
- if (SeenName(faceName, nameTriedPtr) == 0) {
- subFontPtr = CanUseFallback(fontPtr, faceName, ch);
- if (subFontPtr != NULL) {
- return subFontPtr;
- }
- }
- aliases = TkFontGetAliasList(faceName);
- if (aliases != NULL) {
- for (i = 0; aliases[i] != NULL; i++) {
- if (SeenName(aliases[i], nameTriedPtr) == 0) {
- subFontPtr = CanUseFallback(fontPtr, aliases[i], ch);
- if (subFontPtr != NULL) {
- return subFontPtr;
- }
- }
- }
- }
- return NULL;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * SeenName --
- *
- * Used to determine we have already tried and rejected the given
- * face name when looking for a screen font that can support some
- * Unicode character.
- *
- * Results:
- * The return value is 0 if this face name has not already been seen,
- * non-zero otherwise.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-static int
-SeenName(
- CONST char *name, /* The name to check. */
- Tcl_DString *dsPtr) /* Contains names that have already been
- * seen. */
-{
- CONST char *seen, *end;
-
- seen = Tcl_DStringValue(dsPtr);
- end = seen + Tcl_DStringLength(dsPtr);
- while (seen < end) {
- if (strcasecmp(seen, name) == 0) {
- return 1;
- }
- seen += strlen(seen) + 1;
- }
- Tcl_DStringAppend(dsPtr, (char *) name, (int) (strlen(name) + 1));
- return 0;
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * CanUseFallback --
- *
- * If the specified physical screen font has not already been loaded
- * into the font object, determine if the specified physical screen
- * font can display the given character.
- *
- * Results:
- * The return value is a pointer to a newly allocated SubFont, owned
- * by the font object. This SubFont can be used to display the given
- * character. The SubFont represents the screen font with the base set
- * of font attributes from the font object, but using the specified
- * font name. NULL is returned if the font object already holds
- * a reference to the specified physical font or if the specified
- * physical font cannot display the given character.
- *
- * Side effects:
- * The font object's subFontArray is updated to contain a reference
- * to the newly allocated SubFont.
- *
- *-------------------------------------------------------------------------
- */
-
-static SubFont *
-CanUseFallback(
- MacFont *fontPtr, /* The font object that will own the new
- * screen font. */
- CONST char *faceName, /* Desired face name for new screen font. */
- int ch) /* The Unicode character that the new
- * screen font must be able to display. */
-{
- int i;
- SubFont subFont;
- short faceNum;
-
- if (GetFamilyNum(faceName, &faceNum) == 0) {
- return NULL;
- }
-
- /*
- * Skip all fonts we've already used.
- */
-
- for (i = 0; i < fontPtr->numSubFonts; i++) {
- if (faceNum == fontPtr->subFontArray[i].familyPtr->faceNum) {
- return NULL;
- }
- }
-
- /*
- * Load this font and see if it has the desired character.
- */
-
- InitSubFont(fontPtr, faceNum, &subFont);
- if (((ch < 256) && (subFont.familyPtr->isSymbolFont))
- || (FontMapLookup(&subFont, ch) == 0)) {
- ReleaseSubFont(&subFont);
- return NULL;
- }
-
- if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
- SubFont *newPtr;
-
- newPtr = (SubFont *) ckalloc(sizeof(SubFont)
- * (fontPtr->numSubFonts + 1));
- memcpy((char *) newPtr, fontPtr->subFontArray,
- fontPtr->numSubFonts * sizeof(SubFont));
- if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
- }
- fontPtr->subFontArray = newPtr;
- }
- fontPtr->subFontArray[fontPtr->numSubFonts] = subFont;
- fontPtr->numSubFonts++;
- return &fontPtr->subFontArray[fontPtr->numSubFonts - 1];
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * GetFamilyNum --
- *
- * Determines if any physical screen font exists on the system with
- * the given family name. If the family exists, then it should be
- * possible to construct some physical screen font with that family
- * name.
- *
- * Results:
- * The return value is 0 if the specified font family does not exist,
- * non-zero otherwise. *faceNumPtr is filled with the unique face
- * number that identifies the screen font, or 0 if the font family
- * did not exist.
- *
- * Side effects:
- * None.
- *
- *-------------------------------------------------------------------------
- */
-
-static int
-GetFamilyNum(
- CONST char *faceName, /* UTF-8 name of font family to query. */
- short *faceNumPtr) /* Filled with font number for above family. */
-{
- FontNameMap *mapPtr;
-
- if (faceName != NULL) {
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- if (strcasecmp(faceName, mapPtr->utfName) == 0) {
- *faceNumPtr = mapPtr->faceNum;
- return 1;
- }
- }
- }
- *faceNumPtr = 0;
- return 0;
-}
-
-static int
-GetFamilyOrAliasNum(
- CONST char *faceName, /* UTF-8 name of font family to query. */
- short *faceNumPtr) /* Filled with font number for above family. */
-{
- char **aliases;
- int i;
-
- if (GetFamilyNum(faceName, faceNumPtr) != 0) {
- return 1;
- }
- aliases = TkFontGetAliasList(faceName);
- if (aliases != NULL) {
- for (i = 0; aliases[i] != NULL; i++) {
- if (GetFamilyNum(aliases[i], faceNumPtr) != 0) {
- return 1;
- }
- }
- }
- return 0;
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * GetUtfFaceName --
- *
- * Given the native name for a Macintosh font (in which the name of
- * the font is in the encoding of the font itself), return the UTF-8
- * name that corresponds to that font. The specified font name must
- * refer to a font that actually exists on the machine.
- *
- * This function is used to obtain the UTF-8 name when querying the
- * properties of a Macintosh font object.
- *
- * Results:
- * The return value is a pointer to the UTF-8 of the specified font.
- *
- * Side effects:
- * None.
- *
- *------------------------------------------------------------------------
- */
-
-static Tk_Uid
-GetUtfFaceName(
- StringPtr nativeName) /* Pascal name for font in native encoding. */
-{
- FontNameMap *mapPtr;
-
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- if (pstrcmp(nativeName, mapPtr->nativeName) == 0) {
- return mapPtr->utfName;
- }
- }
- panic("GetUtfFaceName: unexpected nativeName");
- return NULL;
-}
-
-/*
- *------------------------------------------------------------------------
- *
- * GetFontEncoding --
- *
- * Return a string that can be passed to Tcl_GetTextEncoding() and
- * used to convert bytes from UTF-8 into the encoding of the
- * specified font.
- *
- * The desired encoding to use to convert the name of a symbolic
- * font into UTF-8 is macRoman, while the desired encoding to use
- * to convert bytes in a symbolic font to UTF-8 is the corresponding
- * symbolic encoding. Due to this dual interpretatation of symbolic
- * fonts, the caller can specify what type of encoding to return
- * should the specified font be symbolic.
- *
- * Results:
- * The return value is a string that specifies the font's encoding.
- * If the font's encoding could not be identified, NULL is returned.
- *
- * Side effects:
- * None.
- *
- *------------------------------------------------------------------------
- */
-
-static Tcl_Encoding
-GetFontEncoding(
- int faceNum, /* Macintosh font number. */
- int allowSymbol, /* If non-zero, then the encoding string
- * for symbol fonts will be the corresponding
- * symbol encoding. Otherwise, the encoding
- * string for symbol fonts will be
- * "macRoman". */
- int *isSymbolPtr) /* Filled with non-zero if this font is a
- * symbol font, 0 otherwise. */
-{
- Str255 faceName;
- int script, lang;
- char *name;
-
- if (allowSymbol != 0) {
- GetFontName(faceNum, faceName);
- if (pstrcasecmp(faceName, "\psymbol") == 0) {
- *isSymbolPtr = 1;
- return Tcl_GetEncoding(NULL, "symbol");
- }
- if (pstrcasecmp(faceName, "\pzapf dingbats") == 0) {
- *isSymbolPtr = 1;
- return Tcl_GetEncoding(NULL, "macDingbats");
- }
- }
-
- *isSymbolPtr = 0;
-
- script = FontToScript(faceNum);
- lang = GetScriptVariable(script, smScriptLang);
- name = NULL;
- if (script == smRoman) {
- name = TkFindStateString(romanMap, lang);
- } else if (script == smCyrillic) {
- name = TkFindStateString(cyrillicMap, lang);
- }
- if (name == NULL) {
- name = TkFindStateString(scriptMap, script);
- }
- return Tcl_GetEncoding(NULL, name);
-}
diff --git a/mac/tkMacHLEvents.c b/mac/tkMacHLEvents.c
deleted file mode 100644
index c74766b..0000000
--- a/mac/tkMacHLEvents.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * tkMacHLEvents.c --
- *
- * Implements high level event support for the Macintosh. Currently,
- * the only event that really does anything is the Quit event.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tcl.h"
-#include "tclMacInt.h"
-#include "tkMacInt.h"
-
-#include <Aliases.h>
-#include <AppleEvents.h>
-#include <SegLoad.h>
-#include <ToolUtils.h>
-
-/*
- * This is a Tcl_Event structure that the Quit AppleEvent handler
- * uses to schedule the tkReallyKillMe function.
- */
-
-typedef struct KillEvent {
- Tcl_Event header; /* Information that is standard for
- * all events. */
- Tcl_Interp *interp; /* Interp that was passed to the
- * Quit AppleEvent */
-} KillEvent;
-
-/*
- * Static functions used only in this file.
- */
-
-static pascal OSErr QuitHandler _ANSI_ARGS_((AppleEvent* event,
- AppleEvent* reply, long refcon));
-static pascal OSErr OappHandler _ANSI_ARGS_((AppleEvent* event,
- AppleEvent* reply, long refcon));
-static pascal OSErr OdocHandler _ANSI_ARGS_((AppleEvent* event,
- AppleEvent* reply, long refcon));
-static pascal OSErr PrintHandler _ANSI_ARGS_((AppleEvent* event,
- AppleEvent* reply, long refcon));
-static pascal OSErr ScriptHandler _ANSI_ARGS_((AppleEvent* event,
- AppleEvent* reply, long refcon));
-static int MissedAnyParameters _ANSI_ARGS_((AppleEvent *theEvent));
-static int ReallyKillMe _ANSI_ARGS_((Tcl_Event *eventPtr, int flags));
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacInitAppleEvents --
- *
- * Initilize the Apple Events on the Macintosh. This registers the
- * core event handlers.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacInitAppleEvents(
- Tcl_Interp *interp) /* Interp to handle basic events. */
-{
- OSErr err;
- AEEventHandlerUPP OappHandlerUPP, OdocHandlerUPP,
- PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP;
-
- /*
- * Install event handlers for the core apple events.
- */
- QuitHandlerUPP = NewAEEventHandlerProc(QuitHandler);
- err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
- QuitHandlerUPP, (long) interp, false);
-
- OappHandlerUPP = NewAEEventHandlerProc(OappHandler);
- err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
- OappHandlerUPP, (long) interp, false);
-
- OdocHandlerUPP = NewAEEventHandlerProc(OdocHandler);
- err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
- OdocHandlerUPP, (long) interp, false);
-
- PrintHandlerUPP = NewAEEventHandlerProc(PrintHandler);
- err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
- PrintHandlerUPP, (long) interp, false);
-
- if (interp != NULL) {
- ScriptHandlerUPP = NewAEEventHandlerProc(ScriptHandler);
- err = AEInstallEventHandler('misc', 'dosc',
- ScriptHandlerUPP, (long) interp, false);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacDoHLEvent --
- *
- * Dispatch incomming highlevel events.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Depends on the incoming event.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacDoHLEvent(
- EventRecord *theEvent)
-{
- AEProcessAppleEvent(theEvent);
-
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * QuitHandler, OappHandler, etc. --
- *
- * These are the core Apple event handlers. Only the Quit event does
- * anything interesting.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static pascal OSErr
-QuitHandler(
- AppleEvent *theAppleEvent,
- AppleEvent *reply,
- long handlerRefcon)
-{
- Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
- KillEvent *eventPtr;
-
- /*
- * Call the exit command from the event loop, since you are not supposed
- * to call ExitToShell in an Apple Event Handler. We put this at the head
- * of Tcl's event queue because this message usually comes when the Mac is
- * shutting down, and we want to kill the shell as quickly as possible.
- */
-
- eventPtr = (KillEvent *) ckalloc(sizeof(KillEvent));
- eventPtr->header.proc = ReallyKillMe;
- eventPtr->interp = interp;
-
- Tcl_QueueEvent((Tcl_Event *) eventPtr, TCL_QUEUE_HEAD);
-
- return noErr;
-}
-
-static pascal OSErr
-OappHandler(
- AppleEvent *theAppleEvent,
- AppleEvent *reply,
- long handlerRefcon)
-{
- return noErr;
-}
-
-static pascal OSErr
-OdocHandler(
- AppleEvent *theAppleEvent,
- AppleEvent *reply,
- long handlerRefcon)
-{
- Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
- AEDescList fileSpecList;
- FSSpec file;
- OSErr err;
- DescType type;
- Size actual;
- long count;
- AEKeyword keyword;
- long index;
- Tcl_DString command;
- Tcl_DString pathName;
- Tcl_CmdInfo dummy;
-
- /*
- * Don't bother if we don't have an interp or
- * the open document procedure doesn't exist.
- */
-
- if ((interp == NULL) ||
- (Tcl_GetCommandInfo(interp, "::tk::mac::OpenDocument", &dummy)) == 0) {
- return noErr;
- }
-
- /*
- * If we get any errors wil retrieving our parameters
- * we just return with no error.
- */
-
- err = AEGetParamDesc(theAppleEvent, keyDirectObject,
- typeAEList, &fileSpecList);
- if (err != noErr) {
- return noErr;
- }
-
- err = MissedAnyParameters(theAppleEvent);
- if (err != noErr) {
- return noErr;
- }
-
- err = AECountItems(&fileSpecList, &count);
- if (err != noErr) {
- return noErr;
- }
-
- Tcl_DStringInit(&command);
- Tcl_DStringAppend(&command, "::tk::mac::OpenDocument", -1);
- for (index = 1; index <= count; index++) {
- int length;
- Handle fullPath;
-
- err = AEGetNthPtr(&fileSpecList, index, typeFSS,
- &keyword, &type, (Ptr) &file, sizeof(FSSpec), &actual);
- if ( err != noErr ) {
- continue;
- }
-
- err = FSpPathFromLocation(&file, &length, &fullPath);
- HLock(fullPath);
- Tcl_ExternalToUtfDString(NULL, *fullPath, length, &pathName);
- HUnlock(fullPath);
- DisposeHandle(fullPath);
-
- Tcl_DStringAppendElement(&command, Tcl_DStringValue(&pathName));
- Tcl_DStringFree(&pathName);
- }
-
- Tcl_GlobalEval(interp, Tcl_DStringValue(&command));
-
- Tcl_DStringFree(&command);
- return noErr;
-}
-
-static pascal OSErr
-PrintHandler(
- AppleEvent *theAppleEvent,
- AppleEvent *reply,
- long handlerRefcon)
-{
- return noErr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DoScriptHandler --
- *
- * This handler process the do script event.
- *
- * Results:
- * Scedules the given event to be processed.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static pascal OSErr
-ScriptHandler(
- AppleEvent *theAppleEvent,
- AppleEvent *reply,
- long handlerRefcon)
-{
- OSErr theErr;
- AEDescList theDesc;
- int tclErr = -1;
- Tcl_Interp *interp;
- char errString[128];
-
- interp = (Tcl_Interp *) handlerRefcon;
-
- /*
- * The do script event receives one parameter that should be data or a file.
- */
- theErr = AEGetParamDesc(theAppleEvent, keyDirectObject, typeWildCard,
- &theDesc);
- if (theErr != noErr) {
- sprintf(errString, "AEDoScriptHandler: GetParamDesc error %d", theErr);
- theErr = AEPutParamPtr(reply, keyErrorString, typeChar, errString,
- strlen(errString));
- } else if (MissedAnyParameters(theAppleEvent)) {
- sprintf(errString, "AEDoScriptHandler: extra parameters");
- AEPutParamPtr(reply, keyErrorString, typeChar, errString,
- strlen(errString));
- theErr = -1771;
- } else {
- if (theDesc.descriptorType == (DescType)'TEXT') {
- Tcl_DString encodedText;
- short length, i;
-
- length = GetHandleSize(theDesc.dataHandle);
- SetHandleSize(theDesc.dataHandle, length + 1);
- *(*theDesc.dataHandle + length) = '\0';
- for (i=0; i<length; i++) {
- if ((*theDesc.dataHandle)[i] == '\r') {
- (*theDesc.dataHandle)[i] = '\n';
- }
- }
-
- HLock(theDesc.dataHandle);
- Tcl_ExternalToUtfDString(NULL, *theDesc.dataHandle, length,
- &encodedText);
- tclErr = Tcl_GlobalEval(interp, Tcl_DStringValue(&encodedText));
- Tcl_DStringFree(&encodedText);
- HUnlock(theDesc.dataHandle);
- } else if (theDesc.descriptorType == (DescType)'alis') {
- Boolean dummy;
- FSSpec theFSS;
- Handle fullPath;
- int length;
-
- theErr = ResolveAlias(NULL, (AliasHandle)theDesc.dataHandle,
- &theFSS, &dummy);
- if (theErr == noErr) {
- FSpPathFromLocation(&theFSS, &length, &fullPath);
- HLock(fullPath);
- Tcl_EvalFile(interp, *fullPath);
- HUnlock(fullPath);
- DisposeHandle(fullPath);
- } else {
- sprintf(errString, "AEDoScriptHandler: file not found");
- AEPutParamPtr(reply, keyErrorString, typeChar,
- errString, strlen(errString));
- }
- } else {
- sprintf(errString,
- "AEDoScriptHandler: invalid script type '%-4.4s', must be 'alis' or 'TEXT'",
- &theDesc.descriptorType);
- AEPutParamPtr(reply, keyErrorString, typeChar,
- errString, strlen(errString));
- theErr = -1770;
- }
- }
-
- /*
- * If we actually go to run Tcl code - put the result in the reply.
- */
- if (tclErr >= 0) {
- if (tclErr == TCL_OK) {
- AEPutParamPtr(reply, keyDirectObject, typeChar,
- Tcl_GetStringResult(interp),
- strlen(Tcl_GetStringResult(interp)));
- } else {
- AEPutParamPtr(reply, keyErrorString, typeChar,
- Tcl_GetStringResult(interp),
- strlen(Tcl_GetStringResult(interp)));
- AEPutParamPtr(reply, keyErrorNumber, typeInteger,
- (Ptr) &tclErr, sizeof(int));
- }
- }
-
- AEDisposeDesc(&theDesc);
-
- return theErr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ReallyKillMe --
- *
- * This proc tries to kill the shell by running exit, and if that
- * has not succeeded (e.g. because someone has renamed the exit
- * command), calls Tcl_Exit to really kill the shell. Called from
- * an event scheduled by the "Quit" AppleEvent handler.
- *
- * Results:
- * Kills the shell.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-ReallyKillMe(Tcl_Event *eventPtr, int flags)
-{
- Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp;
- if (interp != NULL) {
- Tcl_GlobalEval(interp, "exit");
- }
- Tcl_Exit(0);
-
- return 1;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MissedAnyParameters --
- *
- * Checks to see if parameters are still left in the event.
- *
- * Results:
- * True or false.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-MissedAnyParameters(
- AppleEvent *theEvent)
-{
- DescType returnedType;
- Size actualSize;
- OSErr err;
-
- err = AEGetAttributePtr(theEvent, keyMissedKeywordAttr, typeWildCard,
- &returnedType, NULL, 0, &actualSize);
-
- return (err != errAEDescNotFound);
-}
diff --git a/mac/tkMacInit.c b/mac/tkMacInit.c
deleted file mode 100644
index 4e73c14..0000000
--- a/mac/tkMacInit.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * tkMacInit.c --
- *
- * This file contains Mac-specific interpreter initialization
- * functions.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Resources.h>
-#include <Files.h>
-#include <TextUtils.h>
-#include <Strings.h>
-#include "tkInt.h"
-#include "tkMacInt.h"
-#include "tclMacInt.h"
-
-/*
- * The following global is used by various parts of Tk to access
- * information in the global qd variable. It is provided as a pointer
- * in the AppInit because we don't assume that Tk is running as an
- * application. For example, Tk could be a plugin and may not have
- * access to the qd variable. This mechanism provides a way for the
- * container application to give a pointer to the qd variable.
- */
-
-QDGlobalsPtr tcl_macQdPtr = NULL;
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpInit --
- *
- * Performs Mac-specific interpreter initialization related to the
- * tk_library variable.
- *
- * Results:
- * A standard Tcl completion code (TCL_OK or TCL_ERROR). Also
- * leaves information in the interp's result.
- *
- * Side effects:
- * Sets "tk_library" Tcl variable, runs initialization scripts
- * for Tk.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpInit(
- Tcl_Interp *interp) /* Interp to initialize. */
-{
- CONST char *libDir, *tempPath;
- Tcl_DString path, ds;
- int result;
-
- static char initCmd[] = "if {[info proc tkInit]==\"\"} {\n\
-proc tkInit {} {\n\
-proc sourcePath {file} {\n\
- global tk_library\n\
- if {[catch {uplevel #0 [list source [file join $tk_library $file.tcl]]}] == 0} {\n\
- return\n\
- }\n\
- if {[catch {uplevel #0 [list source -rsrc $file]}] == 0} {\n\
- return\n\
- }\n\
- rename sourcePath {}\n\
- set msg \"Can't find $file resource or a usable $file.tcl file\"\n\
- append msg \" perhaps you need to install Tk or set your\"\n\
- append msg \" TK_LIBRARY environment variable?\"\n\
- error $msg\n\
-}\n\
-sourcePath tk\n\
-sourcePath dialog\n\
-sourcePath focus\n\
-sourcePath optMenu\n\
-sourcePath palette\n\
-sourcePath tearoff\n\
-if {[catch {package require msgcat}]} {sourcePath msgcat}\n\
-sourcePath bgerror\n\
-sourcePath msgbox\n\
-sourcePath comdlg\n\
-rename sourcePath {}\n\
-rename tkInit {}\n\
-} }\n\
-tkInit";
-
- Tcl_DStringInit(&path);
- Tcl_DStringInit(&ds);
-
- /*
- * The tk_library path can be found in several places. Here is the order
- * in which the are searched.
- * 1) the variable may already exist
- * 2) env array
- * 3) System Folder:Extensions:Tool Command Language:
- */
-
- libDir = Tcl_GetVar(interp, "tk_library", TCL_GLOBAL_ONLY);
- if (libDir == NULL) {
- libDir = TclGetEnv("TK_LIBRARY", &ds);
- }
- if ((libDir == NULL) || (libDir[0] == '\0')) {
- tempPath = TclGetEnv("EXT_FOLDER", &ds);
- if ((tempPath != NULL) && (tempPath[0] != '\0')) {
- Tcl_DString libPath;
- CONST char *argv[3];
-
- argv[0] = tempPath;
- argv[1] = "Tool Command Language";
- Tcl_DStringInit(&libPath);
- Tcl_DStringAppend(&libPath, "tk", -1);
- argv[2] = Tcl_DStringAppend(&libPath, TK_VERSION, -1);
- libDir = Tcl_JoinPath(3, argv, &path);
- Tcl_DStringFree(&libPath);
- }
- }
- if (libDir == NULL) {
- libDir = "no library";
- }
-
- /*
- * Assign path to the global Tcl variable tcl_library.
- */
- Tcl_SetVar(interp, "tk_library", libDir, TCL_GLOBAL_ONLY);
- Tcl_DStringFree(&path);
- Tcl_DStringFree(&ds);
-
- result = Tcl_Eval(interp, initCmd);
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetAppName --
- *
- * Retrieves the name of the current application from a platform
- * specific location. On the Macintosh we look to see if the
- * App Name is specified in a resource. If not, the application
- * name is the root of the tail of the path contained in the tcl
- * variable argv0.
- *
- * Results:
- * Returns the application name in the given Tcl_DString.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpGetAppName(
- Tcl_Interp *interp, /* The main interpreter. */
- Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
-{
- int argc;
- CONST char **argv = NULL, *name, *p;
- int nameLength = -1;
- Handle h = NULL;
-
- h = GetNamedResource('STR ', "\pTk App Name");
- if (h != NULL) {
- HLock(h);
- Tcl_DStringAppend(namePtr, (*h)+1, **h);
- HUnlock(h);
- ReleaseResource(h);
- return;
- }
-
- name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY);
- if (name != NULL) {
- Tcl_SplitPath(name, &argc, &argv);
- if (argc > 0) {
- name = argv[argc-1];
- p = strrchr(name, '.');
- if (p != NULL) {
- nameLength = p - name;
- }
- } else {
- name = NULL;
- }
- }
- if ((name == NULL) || (*name == 0) || (nameLength == 0)) {
- name = "tk";
- nameLength = -1;
- }
- Tcl_DStringAppend(namePtr, name, nameLength);
- if (argv != NULL) {
- ckfree((char *)argv);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDisplayWarning --
- *
- * This routines is called from Tk_Main to display warning
- * messages that occur during startup.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Displays a message box.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDisplayWarning(
- CONST char *msg, /* Message to be displayed. */
- CONST char *title) /* Title of warning. */
-{
- Tcl_DString ds;
- Tcl_DStringInit(&ds);
- Tcl_DStringAppend(&ds, title, -1);
- Tcl_DStringAppend(&ds, ": ", -1);
- Tcl_DStringAppend(&ds, msg, -1);
- panic(Tcl_DStringValue(&ds));
- Tcl_DStringFree(&ds);
-}
diff --git a/mac/tkMacInt.h b/mac/tkMacInt.h
deleted file mode 100644
index 4713d39..0000000
--- a/mac/tkMacInt.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * tkMacInt.h --
- *
- * Declarations of Macintosh specific shared variables and procedures.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#ifndef _TKMACINT
-#define _TKMACINT
-
-#ifndef _TKINT
-#include "tkInt.h"
-#endif
-
-/*
- * Include platform specific public interfaces.
- */
-
-#ifndef _TKMAC
-#include "tkMac.h"
-#endif
-
-#ifndef _TKPORT
-#include "tkPort.h"
-#endif
-
-#include <AppleEvents.h>
-#include <Windows.h>
-#include <QDOffscreen.h>
-#include <Menus.h>
-
-#define TK_MAC_68K_STACK_GROWTH (256*1024)
-
-struct TkWindowPrivate {
- TkWindow *winPtr; /* Ptr to tk window or NULL if Pixmap */
- GWorldPtr portPtr; /* Either WindowRef or off screen world */
- int xOff; /* X offset from toplevel window */
- int yOff; /* Y offset from toplevel window */
- RgnHandle clipRgn; /* Visable region of window */
- RgnHandle aboveClipRgn; /* Visable region of window & it's children */
- int referenceCount; /* Don't delete toplevel until children are
- * gone. */
- struct TkWindowPrivate *toplevel; /* Pointer to the toplevel
- * datastruct. */
- int flags; /* Various state see defines below. */
-};
-typedef struct TkWindowPrivate MacDrawable;
-
-/*
- * This list is used to keep track of toplevel windows that have a Mac
- * window attached. This is useful for several things, not the least
- * of which is maintaining floating windows.
- */
-
-typedef struct TkMacWindowList {
- struct TkMacWindowList *nextPtr; /* The next window in the list. */
- TkWindow *winPtr; /* This window */
-} TkMacWindowList;
-
-/*
- * Defines use for the flags field of the MacDrawable data structure.
- */
-
-#define TK_SCROLLBAR_GROW 1
-#define TK_CLIP_INVALID 2
-#define TK_HOST_EXISTS 4
-#define TK_DRAWN_UNDER_MENU 8
-
-/*
- * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags
- * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the
- * TkWindow structure for the window, but in the MacWin. This way we can still tell
- * what the correct port is after the TKWindow structure has been freed. This
- * actually happens when you bind destroy of a toplevel to Destroy of a child.
- */
-
-/*
- * This structure is for handling Netscape-type in process
- * embedding where Tk does not control the top-level. It contains
- * various functions that are needed by Mac specific routines, like
- * TkMacGetDrawablePort. The definitions of the function types
- * are in tkMac.h.
- */
-
-typedef struct {
- Tk_MacEmbedRegisterWinProc *registerWinProc;
- Tk_MacEmbedGetGrafPortProc *getPortProc;
- Tk_MacEmbedMakeContainerExistProc *containerExistProc;
- Tk_MacEmbedGetClipProc *getClipProc;
- Tk_MacEmbedGetOffsetInParentProc *getOffsetProc;
-} TkMacEmbedHandler;
-
-extern TkMacEmbedHandler *gMacEmbedHandler;
-
-/*
- * Defines used for TkMacInvalidateWindow
- */
-
-#define TK_WINDOW_ONLY 0
-#define TK_PARENT_WINDOW 1
-
-/*
- * Accessor for the privatePtr flags field for the TK_HOST_EXISTS field
- */
-
-#define TkMacHostToplevelExists(tkwin) \
- (((TkWindow *) (tkwin))->privatePtr->toplevel->flags & TK_HOST_EXISTS)
-
-/*
- * Defines use for the flags argument to TkGenWMConfigureEvent.
- */
-
-#define TK_LOCATION_CHANGED 1
-#define TK_SIZE_CHANGED 2
-#define TK_BOTH_CHANGED 3
-
-/*
- * Variables shared among various Mac Tk modules but are not
- * exported to the outside world.
- */
-
-extern int tkMacAppInFront;
-
-/*
- * Globals shared among Macintosh Tk
- */
-
-extern MenuHandle tkAppleMenu; /* Handle to the Apple Menu */
-extern MenuHandle tkFileMenu; /* Handles to menus */
-extern MenuHandle tkEditMenu; /* Handles to menus */
-extern RgnHandle tkMenuCascadeRgn; /* A region to clip with. */
-extern int tkUseMenuCascadeRgn; /* If this is 1, clipping code
- * should intersect tkMenuCascadeRgn
- * before drawing occurs.
- * tkMenuCascadeRgn will only
- * be valid when the value of this
- * variable is 1. */
-extern TkMacWindowList *tkMacWindowListPtr;
- /* The list of toplevels */
-
-/*
- * The following types and defines are for MDEF support.
- */
-
-#if STRUCTALIGNMENTSUPPORTED
-#pragma options align=mac8k
-#endif
-typedef struct TkMenuLowMemGlobals {
- long menuDisable; /* A combination of the menu and the item
- * that the mouse is currently over. */
- short menuTop; /* Where in global coords the top of the
- * menu is. */
- short menuBottom; /* Where in global coords the bottom of
- * the menu is. */
- Rect itemRect; /* This is the rectangle of the currently
- * selected item. */
- short scrollFlag; /* This is used by the MDEF and the
- * Menu Manager to control when scrolling
- * starts. With hierarchicals, an
- * mChooseMsg can come before an
- * mDrawMsg, and scrolling should not
- * occur until after the mDrawMsg.
- * The mDrawMsg sets this flag;
- * mChooseMsg checks the flag and
- * does not scroll if it is set;
- * and then resets the flag. */
-} TkMenuLowMemGlobals;
-#if STRUCTALIGNMENTSUPPORTED
-#pragma options align=reset
-#endif
-
-typedef pascal void (*TkMenuDefProcPtr) (short message, MenuHandle theMenu,
- Rect *menuRectPtr, Point hitPt, short *whichItemPtr,
- TkMenuLowMemGlobals *globalsPtr);
-enum {
- tkUppMenuDefProcInfo = kPascalStackBased
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
- | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(MenuRef)))
- | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect*)))
- | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Point)))
- | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(short*)))
- | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(TkMenuLowMemGlobals *)))
-};
-
-#if GENERATINGCFM
-typedef UniversalProcPtr TkMenuDefUPP;
-#else
-typedef TkMenuDefProcPtr TkMenuDefUPP;
-#endif
-
-#if GENERATINGCFM
-#define TkNewMenuDefProc(userRoutine) \
- (TkMenuDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
- tkUppMenuDefProcInfo, GetCurrentArchitecture())
-#else
-#define TkNewMenuDefProc(userRoutine) \
- ((TkMenuDefUPP) (userRoutine))
-#endif
-
-#if GENERATINGCFM
-#define TkCallMenuDefProc(userRoutine, message, theMenu, menuRectPtr, hitPt, \
- whichItemPtr, globalsPtr) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), TkUppMenuDefProcInfo, \
- (message), (theMenu), (menuRectPtr), (hitPt), (whichItemPtr), \
- (globalsPtr))
-#else
-#define TkCallMenuDefProc(userRoutine, message, theMenu, menuRectPtr, hitPt, \
- whichItemPtr, globalsPtr) \
- (*(userRoutine))((message), (theMenu), (menuRectPtr), (hitPt), \
- (whichItemPtr), (globalsPtr))
-#endif
-
-#include "tkIntPlatDecls.h"
-
-#ifdef BUILD_tk
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLEXPORT
-#endif
-
-/*
- * mac specific procedures exported from the DLL
- */
-
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLIMPORT
-
-#endif /* _TKMACINT */
diff --git a/mac/tkMacKeyboard.c b/mac/tkMacKeyboard.c
deleted file mode 100644
index 07b57c0..0000000
--- a/mac/tkMacKeyboard.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * tkMacKeyboard.c --
- *
- * Routines to support keyboard events on the Macintosh.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkInt.h"
-#include "Xlib.h"
-#include "keysym.h"
-
-#include <Events.h>
-#include <Script.h>
-
-typedef struct {
- short keycode; /* Macintosh keycode */
- KeySym keysym; /* X windows Keysym */
-} KeyInfo;
-
-static KeyInfo keyArray[] = {
- {0x4C, XK_Return},
- {0x24, XK_Return},
- {0x33, XK_BackSpace},
- {0x75, XK_Delete},
- {0x30, XK_Tab},
- {0x74, XK_Page_Up},
- {0x79, XK_Page_Down},
- {0x73, XK_Home},
- {0x77, XK_End},
- {0x7B, XK_Left},
- {0x7C, XK_Right},
- {0x7E, XK_Up},
- {0x7D, XK_Down},
- {0x72, XK_Help},
- {0x35, XK_Escape},
- {0x47, XK_Clear},
- {0, 0}
-};
-
-static KeyInfo vituralkeyArray[] = {
- {122, XK_F1},
- {120, XK_F2},
- {99, XK_F3},
- {118, XK_F4},
- {96, XK_F5},
- {97, XK_F6},
- {98, XK_F7},
- {100, XK_F8},
- {101, XK_F9},
- {109, XK_F10},
- {103, XK_F11},
- {111, XK_F12},
- {105, XK_F13},
- {107, XK_F14},
- {113, XK_F15},
- {0, 0}
-};
-
-static int initialized = 0;
-static Tcl_HashTable keycodeTable; /* keyArray hashed by keycode value. */
-static Tcl_HashTable vkeyTable; /* vituralkeyArray hashed by virtual
- keycode value. */
-static Ptr KCHRPtr; /* Pointer to 'KCHR' resource. */
-
-/*
- * Prototypes for static functions used in this file.
- */
-static void InitKeyMaps _ANSI_ARGS_((void));
-
-
-/*
- *----------------------------------------------------------------------
- *
- * InitKeyMaps --
- *
- * Creates hash tables used by some of the functions in this file.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Allocates memory & creates some hash tables.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-InitKeyMaps()
-{
- register Tcl_HashEntry *hPtr;
- register KeyInfo *kPtr;
- int dummy;
-
- Tcl_InitHashTable(&keycodeTable, TCL_ONE_WORD_KEYS);
- for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
- hPtr = Tcl_CreateHashEntry(&keycodeTable, (char *) kPtr->keycode,
- &dummy);
- Tcl_SetHashValue(hPtr, kPtr->keysym);
- }
- Tcl_InitHashTable(&vkeyTable, TCL_ONE_WORD_KEYS);
- for (kPtr = vituralkeyArray; kPtr->keycode != 0; kPtr++) {
- hPtr = Tcl_CreateHashEntry(&vkeyTable, (char *) kPtr->keycode,
- &dummy);
- Tcl_SetHashValue(hPtr, kPtr->keysym);
- }
- KCHRPtr = (Ptr) GetScriptManagerVariable(smKCHRCache);
- initialized = 1;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XKeycodeToKeysym --
- *
- * Translate from a system-dependent keycode to a
- * system-independent keysym.
- *
- * Results:
- * Returns the translated keysym, or NoSymbol on failure.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-KeySym
-XKeycodeToKeysym(
- Display* display,
- KeyCode keycode,
- int index)
-{
- register Tcl_HashEntry *hPtr;
- int c;
- char virtualKey;
- int newKeycode;
- unsigned long dummy, newChar;
-
- if (!initialized) {
- InitKeyMaps();
- }
-
- virtualKey = (char) (keycode >> 16);
- c = (keycode) & 0xffff;
- if (c > 255) {
- return NoSymbol;
- }
-
- /*
- * When determining what keysym to produce we firt check to see if
- * the key is a function key. We then check to see if the character
- * is another non-printing key. Finally, we return the key syms
- * for all ASCI chars.
- */
- if (c == 0x10) {
- hPtr = Tcl_FindHashEntry(&vkeyTable, (char *) virtualKey);
- if (hPtr != NULL) {
- return (KeySym) Tcl_GetHashValue(hPtr);
- }
- }
- hPtr = Tcl_FindHashEntry(&keycodeTable, (char *) virtualKey);
- if (hPtr != NULL) {
- return (KeySym) Tcl_GetHashValue(hPtr);
- }
-
- /*
- * Recompute the character based on the Shift key only.
- * TODO: The index may also specify the NUM_LOCK.
- */
- newKeycode = virtualKey;
- if (index & 0x01) {
- newKeycode += 0x0200;
- }
- dummy = 0;
- newChar = KeyTranslate(KCHRPtr, (short) newKeycode, &dummy);
- c = newChar & charCodeMask;
-
- if (c >= XK_space && c < XK_asciitilde) {
- return c;
- }
-
- return NoSymbol;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetString --
- *
- * Retrieve the string equivalent for the given keyboard event.
- *
- * Results:
- * Returns the UTF string.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-char *
-TkpGetString(
- TkWindow *winPtr, /* Window where event occurred: needed to
- * get input context. */
- XEvent *eventPtr, /* X keyboard event. */
- Tcl_DString *dsPtr) /* Uninitialized or empty string to hold
- * result. */
-{
- register Tcl_HashEntry *hPtr;
- char string[3];
- char virtualKey;
- int c, len;
-
- if (!initialized) {
- InitKeyMaps();
- }
-
- Tcl_DStringInit(dsPtr);
-
- virtualKey = (char) (eventPtr->xkey.keycode >> 16);
- c = (eventPtr->xkey.keycode) & 0xffff;
-
- if (c < 256) {
- string[0] = (char) c;
- len = 1;
- } else {
- string[0] = (char) (c >> 8);
- string[1] = (char) c;
- len = 2;
- }
-
- /*
- * Just return NULL if the character is a function key or another
- * non-printing key.
- */
- if (c == 0x10) {
- len = 0;
- } else {
- hPtr = Tcl_FindHashEntry(&keycodeTable, (char *) virtualKey);
- if (hPtr != NULL) {
- len = 0;
- }
- }
- return Tcl_ExternalToUtfDString(NULL, string, len, dsPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XGetModifierMapping --
- *
- * Fetch the current keycodes used as modifiers.
- *
- * Results:
- * Returns a new modifier map.
- *
- * Side effects:
- * Allocates a new modifier map data structure.
- *
- *----------------------------------------------------------------------
- */
-
-XModifierKeymap *
-XGetModifierMapping(
- Display* display)
-{
- XModifierKeymap * modmap;
-
- modmap = (XModifierKeymap *) ckalloc(sizeof(XModifierKeymap));
- modmap->max_keypermod = 0;
- modmap->modifiermap = NULL;
- return modmap;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XFreeModifiermap --
- *
- * Deallocate a modifier map that was created by
- * XGetModifierMapping.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Frees the datastructure referenced by modmap.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XFreeModifiermap(
- XModifierKeymap *modmap)
-{
- if (modmap->modifiermap != NULL) {
- ckfree((char *) modmap->modifiermap);
- }
- ckfree((char *) modmap);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XKeysymToString, XStringToKeysym --
- *
- * These X window functions map Keysyms to strings & strings to
- * keysyms. However, Tk already does this for the most common keysyms.
- * Therefor, these functions only need to support keysyms that will be
- * specific to the Macintosh. Currently, there are none.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-char *
-XKeysymToString(
- KeySym keysym)
-{
- return NULL;
-}
-
-KeySym
-XStringToKeysym(
- const char* string)
-{
- return NoSymbol;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XKeysymToKeycode --
- *
- * The function XKeysymToKeycode is only used by tkTest.c and
- * currently only implementes the support for keys used in the
- * Tk test suite.
- * FIXME - This is no longer true. This function is now used in
- * "event generate" so we really should make it work.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-KeyCode
-XKeysymToKeycode(
- Display* display,
- KeySym keysym)
-{
- KeyCode keycode = 0;
- char virtualKeyCode = 0;
-
- if ((keysym >= XK_space) && (XK_asciitilde)) {
- if (keysym == 'a') {
- virtualKeyCode = 0x00;
- } else if (keysym == 'b' || keysym == 'B') {
- virtualKeyCode = 0x0B;
- } else if (keysym == 'c') {
- virtualKeyCode = 0x08;
- } else if (keysym == 'x' || keysym == 'X') {
- virtualKeyCode = 0x07;
- } else if (keysym == 'z') {
- virtualKeyCode = 0x06;
- } else if (keysym == ' ') {
- virtualKeyCode = 0x31;
- } else if (keysym == XK_Return) {
- virtualKeyCode = 0x24;
- keysym = '\r';
- }
- keycode = keysym + (virtualKeyCode <<16);
- }
-
- return keycode;
-}
-
-/*
- * When mapping from a keysym to a keycode, need
- * information about the modifier state that should be used
- * so that when they call XKeycodeToKeysym taking into
- * account the xkey.state, they will get back the original
- * keysym.
- */
-
-void
-TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
- Tk_Window tkwin;
- KeySym keySym;
- XEvent *eventPtr;
-{
- Display *display;
- int state;
- KeyCode keycode;
-
- display = Tk_Display(tkwin);
-
- if (keySym == NoSymbol) {
- keycode = 0;
- } else {
- keycode = XKeysymToKeycode(display, keySym);
- }
- if (keycode != 0) {
- for (state = 0; state < 4; state++) {
- if (XKeycodeToKeysym(display, keycode, state) == keySym) {
- if (state & 1) {
- eventPtr->xkey.state |= ShiftMask;
- }
- if (state & 2) {
- TkDisplay *dispPtr;
-
- dispPtr = ((TkWindow *) tkwin)->dispPtr;
- eventPtr->xkey.state |= dispPtr->modeModMask;
- }
- break;
- }
- }
- }
- eventPtr->xkey.keycode = keycode;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetKeySym --
- *
- * Given an X KeyPress or KeyRelease event, map the
- * keycode in the event into a KeySym.
- *
- * Results:
- * The return value is the KeySym corresponding to
- * eventPtr, or NoSymbol if no matching Keysym could be
- * found.
- *
- * Side effects:
- * In the first call for a given display, keycode-to-
- * KeySym maps get loaded.
- *
- *----------------------------------------------------------------------
- */
-
-KeySym
-TkpGetKeySym(dispPtr, eventPtr)
- TkDisplay *dispPtr; /* Display in which to
- * map keycode. */
- XEvent *eventPtr; /* Description of X event. */
-{
- KeySym sym;
- int index;
-
- /*
- * Refresh the mapping information if it's stale
- */
-
- if (dispPtr->bindInfoStale) {
- TkpInitKeymapInfo(dispPtr);
- }
-
- /*
- * Figure out which of the four slots in the keymap vector to
- * use for this key. Refer to Xlib documentation for more info
- * on how this computation works.
- */
-
- index = 0;
- if (eventPtr->xkey.state & dispPtr->modeModMask) {
- index = 2;
- }
- if ((eventPtr->xkey.state & ShiftMask)
- || ((dispPtr->lockUsage != LU_IGNORE)
- && (eventPtr->xkey.state & LockMask))) {
- index += 1;
- }
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
-
- /*
- * Special handling: if the key was shifted because of Lock, but
- * lock is only caps lock, not shift lock, and the shifted keysym
- * isn't upper-case alphabetic, then switch back to the unshifted
- * keysym.
- */
-
- if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
- && (dispPtr->lockUsage == LU_CAPS)) {
- if (!(((sym >= XK_A) && (sym <= XK_Z))
- || ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
- || ((sym >= XK_Ooblique) && (sym <= XK_Thorn)))) {
- index &= ~1;
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
- index);
- }
- }
-
- /*
- * Another bit of special handling: if this is a shifted key and there
- * is no keysym defined, then use the keysym for the unshifted key.
- */
-
- if ((index & 1) && (sym == NoSymbol)) {
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
- index & ~1);
- }
- return sym;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkpInitKeymapInfo --
- *
- * This procedure is invoked to scan keymap information
- * to recompute stuff that's important for binding, such
- * as the modifier key (if any) that corresponds to "mode
- * switch".
- *
- * Results:
- * None.
- *
- * Side effects:
- * Keymap-related information in dispPtr is updated.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkpInitKeymapInfo(dispPtr)
- TkDisplay *dispPtr; /* Display for which to recompute keymap
- * information. */
-{
- XModifierKeymap *modMapPtr;
- KeyCode *codePtr;
- KeySym keysym;
- int count, i, j, max, arraySize;
-#define KEYCODE_ARRAY_SIZE 20
-
- dispPtr->bindInfoStale = 0;
- modMapPtr = XGetModifierMapping(dispPtr->display);
-
- /*
- * Check the keycodes associated with the Lock modifier. If
- * any of them is associated with the XK_Shift_Lock modifier,
- * then Lock has to be interpreted as Shift Lock, not Caps Lock.
- */
-
- dispPtr->lockUsage = LU_IGNORE;
- codePtr = modMapPtr->modifiermap + modMapPtr->max_keypermod*LockMapIndex;
- for (count = modMapPtr->max_keypermod; count > 0; count--, codePtr++) {
- if (*codePtr == 0) {
- continue;
- }
- keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0);
- if (keysym == XK_Shift_Lock) {
- dispPtr->lockUsage = LU_SHIFT;
- break;
- }
- if (keysym == XK_Caps_Lock) {
- dispPtr->lockUsage = LU_CAPS;
- break;
- }
- }
-
- /*
- * Look through the keycodes associated with modifiers to see if
- * the the "mode switch", "meta", or "alt" keysyms are associated
- * with any modifiers. If so, remember their modifier mask bits.
- */
-
- dispPtr->modeModMask = 0;
- dispPtr->metaModMask = 0;
- dispPtr->altModMask = 0;
- codePtr = modMapPtr->modifiermap;
- max = 8*modMapPtr->max_keypermod;
- for (i = 0; i < max; i++, codePtr++) {
- if (*codePtr == 0) {
- continue;
- }
- keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0);
- if (keysym == XK_Mode_switch) {
- dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
- }
- if ((keysym == XK_Meta_L) || (keysym == XK_Meta_R)) {
- dispPtr->metaModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
- }
- if ((keysym == XK_Alt_L) || (keysym == XK_Alt_R)) {
- dispPtr->altModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
- }
- }
-
- /*
- * Create an array of the keycodes for all modifier keys.
- */
-
- if (dispPtr->modKeyCodes != NULL) {
- ckfree((char *) dispPtr->modKeyCodes);
- }
- dispPtr->numModKeyCodes = 0;
- arraySize = KEYCODE_ARRAY_SIZE;
- dispPtr->modKeyCodes = (KeyCode *) ckalloc((unsigned)
- (KEYCODE_ARRAY_SIZE * sizeof(KeyCode)));
- for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) {
- if (*codePtr == 0) {
- continue;
- }
-
- /*
- * Make sure that the keycode isn't already in the array.
- */
-
- for (j = 0; j < dispPtr->numModKeyCodes; j++) {
- if (dispPtr->modKeyCodes[j] == *codePtr) {
- goto nextModCode;
- }
- }
- if (dispPtr->numModKeyCodes >= arraySize) {
- KeyCode *new;
-
- /*
- * Ran out of space in the array; grow it.
- */
-
- arraySize *= 2;
- new = (KeyCode *) ckalloc((unsigned)
- (arraySize * sizeof(KeyCode)));
- memcpy((VOID *) new, (VOID *) dispPtr->modKeyCodes,
- (dispPtr->numModKeyCodes * sizeof(KeyCode)));
- ckfree((char *) dispPtr->modKeyCodes);
- dispPtr->modKeyCodes = new;
- }
- dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr;
- dispPtr->numModKeyCodes++;
- nextModCode: continue;
- }
- XFreeModifiermap(modMapPtr);
-}
diff --git a/mac/tkMacLibrary.r b/mac/tkMacLibrary.r
deleted file mode 100644
index 5acede1..0000000
--- a/mac/tkMacLibrary.r
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * tkMacLibrary.r --
- *
- * This file creates resources for use in most Tk applications.
- * This is designed to be an example of using the Tcl/Tk
- * libraries in a Macintosh Application.
- *
- * Copyright (c) 1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Types.r>
-#include <SysTypes.r>
-#include <AEUserTermTypes.r>
-
-/*
- * The folowing include and defines help construct
- * the version string for Tcl.
- */
-
-#define RC_INVOKED
-#include <tcl.h>
-#include "tk.h"
-
-#if (TK_RELEASE_LEVEL == 0)
-# define RELEASE_LEVEL alpha
-#elif (TK_RELEASE_LEVEL == 1)
-# define RELEASE_LEVEL beta
-#elif (TK_RELEASE_LEVEL == 2)
-# define RELEASE_LEVEL final
-#endif
-
-#if (TK_RELEASE_LEVEL == 2)
-# define MINOR_VERSION (TK_MINOR_VERSION * 16) + TK_RELEASE_SERIAL
-# define RELEASE_CODE 0x00
-#else
-# define MINOR_VERSION TK_MINOR_VERSION * 16
-# define RELEASE_CODE TK_RELEASE_SERIAL
-#endif
-
-#define RELEASE_CODE 0x00
-
-resource 'vers' (1) {
- TK_MAJOR_VERSION, MINOR_VERSION,
- RELEASE_LEVEL, RELEASE_CODE, verUS,
- TK_PATCH_LEVEL,
- TK_PATCH_LEVEL ", by Ray Johnson & Jim Ingham" "\n" "© 2001 Tcl Core Team"
-};
-
-resource 'vers' (2) {
- TK_MAJOR_VERSION, MINOR_VERSION,
- RELEASE_LEVEL, RELEASE_CODE, verUS,
- TK_PATCH_LEVEL,
- "Tk Library " TK_PATCH_LEVEL " © 1993-2001"
-};
-
-/*
- * The -16397 string will be displayed by Finder when a user
- * tries to open the shared library. The string should
- * give the user a little detail about the library's capabilities
- * and enough information to install the library in the correct location.
- * A similar string should be placed in all shared libraries.
- */
-resource 'STR ' (-16397, purgeable) {
- "Tk Library\n\n"
- "This is the library needed to run Tcl/Tk programs. "
- "To work properly, it should be placed in the Tool Command Language folder "
- "within the Extensions folder."
-};
diff --git a/mac/tkMacMDEF.c b/mac/tkMacMDEF.c
deleted file mode 100644
index 27dbac0..0000000
--- a/mac/tkMacMDEF.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * TkMacMDEF.c --
- *
- * This module is implements the MDEF for tkMenus. The address of the
- * real entry proc will be blasted into the MDEF.
- *
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#define MAC_TCL
-#define NeedFunctionPrototypes 1
-#define NeedWidePrototypes 0
-
-#include <Menus.h>
-#include <LowMem.h>
-#include "tkMacInt.h"
-
-
-/*
- * The following structure is built from assembly equates in MPW 3.0
- * AIncludes file: "Private.a." We're forced to update several locations not
- * documented in "Inside Mac" to make our MDEF behave properly with hierarchical
- * menus.
- */
-
-#if STRUCTALIGNMENTSUPPORTED
-#pragma options align=mac68k
-#endif
-typedef struct mbPrivate {
- Byte unknown[6];
- Rect mbItemRect; /* rect of currently chosen menu item */
-} mbPrivate;
-#if STRUCTALIGNMENTSUPPORTED
-#pragma options align=reset
-#endif
-
-/*
- * We are forced to update a low-memory global to get cascades to work. This
- * global does not have a LMEquate associated with it.
- */
-
-#define SELECTRECT (*(Rect *)0x09fa) /* Menu select seems to need this */
-#define MBSAVELOC (*(short *)0x0B5C) /* address of handle to mbarproc private data redefined below */
-
-pascal void main _ANSI_ARGS_((short message,
- MenuHandle menu, Rect *menuRect,
- Point hitPt, short *whichItem));
-
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacStdMenu --
- *
- * The dispatch routine called by the system to handle menu drawing,
- * scrolling, etc. This is a stub; the address of the real routine
- * is blasted in. The real routine will be a UniversalProcPtr,
- * which will give the real dispatch routine in Tk globals
- * and the like.
- *
- * Results:
- * None.
- *
- * Side effects:
- * This routine causes menus to be drawn and will certainly allocate
- * memory as a result. Also, the menu can scroll up and down, and
- * various other interface actions can take place
- *
- *----------------------------------------------------------------------
- */
-
-pascal void
-main(
- short message, /* What action are we taking? */
- MenuHandle menu, /* The menu we are working with */
- Rect *menuRect, /* A pointer to the rect we are working with */
- Point hitPt, /* Where the mouse was hit for appropriate
- * messages. */
- short *whichItemPtr) /* Output result. Which item was hit by
- * the user? */
-{
- /*
- * The constant 'MDEF' is what will be punched during menu intialization.
- */
-
- TkMenuDefProcPtr procPtr = (TkMenuDefProcPtr) 'MDEF';
- TkMenuLowMemGlobals globals;
- short oldItem;
-
- globals.menuDisable = LMGetMenuDisable();
- globals.menuTop = LMGetTopMenuItem();
- globals.menuBottom = LMGetAtMenuBottom();
- if (MBSAVELOC == -1) {
- globals.itemRect = (**(mbPrivate***)&MBSAVELOC)->mbItemRect;
- }
- if (message == mChooseMsg) {
- oldItem = *whichItemPtr;
- }
-
- TkCallMenuDefProc(procPtr, message, menu, menuRect, hitPt, whichItemPtr,
- &globals);
-
- LMSetMenuDisable(globals.menuDisable);
- LMSetTopMenuItem(globals.menuTop);
- LMSetAtMenuBottom(globals.menuBottom);
- if ((message == mChooseMsg) && (oldItem != *whichItemPtr)
- && (MBSAVELOC != -1)) {
- (**(mbPrivate***)&MBSAVELOC)->mbItemRect = globals.itemRect;
- SELECTRECT = globals.itemRect;
- }
-}
diff --git a/mac/tkMacMDEF.r b/mac/tkMacMDEF.r
deleted file mode 100644
index cc87c93..0000000
--- a/mac/tkMacMDEF.r
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * tkMacMDEF.r --
- *
- * This file contains the actual MDEF. Since this is not likely to
- * change much, this seems the easiest method to use. The address
- * of the routine descriptor is written into offset 0x24 hex, and
- * then when the MDEF is called, the Mixed Mode Manager will take
- * care of the setup.
- *
- * This file also contains the icons 'SICN' used by the menu code
- * in menu items.
- *
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Types.r>
-
-/*
- * This code was generated by a project file and will not need to be changed.
- * It is just a stub. The address of the real MDEF handler will be blasted
- * in.
- */
-
-data 'MDEF' (591, preload) {
- $"600A 0000 4D44 4546 024F 0000 4EFA 0004" /* `...MDEF.O..N™.. */
- $"4E75 48E7 1030 4FEF FFEE 266F 0022 247C" /* NuHÁ.0OÔÓ&o."$| */
- $"4D44 4546 594F 2EB8 0B54 2E9F 554F 3EB8" /* MDEFYO.½.T.üUO>½ */
- $"0A0A 3F5F 0004 554F 3EB8 0A0C 3F5F 0006" /* ..?_..UO>½..?_.. */
- $"3038 0B5C 48C0 0C80 FFFF FFFF 6612 2078" /* 08.\H¿.Äf. x */
- $"0B5C 2050 2F68 0006 0008 2F68 000A 000C" /* .\ P/h..../h.... */
- $"302F 0032 48C0 0C80 0000 0001 6602 3613" /* 0/.2H¿.Ä....f.6. */
- $"3F2F 0032 2F2F 0030 2F2F 0030 2F2F 0030" /* ?/.2//.0//.0//.0 */
- $"2F0B 486F 0012 4E92 2F17 21DF 0B54 3F2F" /* /.Ho..Ní/.!þ.T?/ */
- $"0004 31DF 0A0A 3F2F 0006 31DF 0A0C 302F" /* ..1þ..?/..1þ..0/ */
- $"0032 48C0 0C80 0000 0001 6638 3013 48C0" /* .2H¿.Ä....f80.H¿ */
- $"3203 48C1 B280 672C 3038 0B5C 48C0 0C80" /* 2.H¡¾Äg,08.\H¿.Ä */
- $"FFFF FFFF 671E 2078 0B5C 2050 216F 0008" /* g. x.\ P!o.. */
- $"0006 216F 000C 000A 21EF 0008 09FA 21EF" /* ..!o....!Ô..™!Ô */
- $"000C 09FE 4FEF 0012 4CDF 0C08 4E74 0012" /* ..œOÔ..Lþ..Nt.. */
-};
diff --git a/mac/tkMacMenu.c b/mac/tkMacMenu.c
deleted file mode 100644
index d9ec4fd..0000000
--- a/mac/tkMacMenu.c
+++ /dev/null
@@ -1,4605 +0,0 @@
-/*
- * tkMacMenu.c --
- *
- * This module implements the Mac-platform specific features of menus.
- *
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkMacInt.h"
-#include "tkMenu.h"
-#include "tkMenuButton.h"
-#include "tkColor.h"
-#include "tkMacInt.h"
-#undef Status
-#include <Menus.h>
-#include <OSUtils.h>
-#include <Palettes.h>
-#include <Resources.h>
-#include <string.h>
-#include <ToolUtils.h>
-#include <Balloons.h>
-#include <Appearance.h>
-#include <Devices.h>
-
-typedef struct MacMenu {
- MenuHandle menuHdl; /* The Menu Manager data structure. */
- Rect menuRect; /* The rectangle as calculated in the
- * MDEF. This is used to figure ou the
- * clipping rgn before we push
- * the <<MenuSelect>> virtual binding
- * through. */
-} MacMenu;
-
-typedef struct MenuEntryUserData {
- Drawable mdefDrawable;
- TkMenuEntry *mePtr;
- Tk_Font tkfont;
- Tk_FontMetrics *fmPtr;
-} MenuEntryUserData;
-/*
- * Various geometry definitions:
- */
-
-#define CASCADE_ARROW_HEIGHT 10
-#define CASCADE_ARROW_WIDTH 8
-#define DECORATION_BORDER_WIDTH 2
-#define MAC_MARGIN_WIDTH 8
-
-/*
- * The following are constants relating to the SICNs used for drawing the MDEF.
- */
-
-#define SICN_RESOURCE_NUMBER 128
-
-#define SICN_HEIGHT 16
-#define SICN_ROWS 2
-#define CASCADE_ICON_WIDTH 7
-#define SHIFT_ICON_WIDTH 10
-#define OPTION_ICON_WIDTH 16
-#define CONTROL_ICON_WIDTH 12
-#define COMMAND_ICON_WIDTH 10
-
-#define CASCADE_ARROW 0
-#define SHIFT_ICON 1
-#define OPTION_ICON 2
-#define CONTROL_ICON 3
-#define COMMAND_ICON 4
-#define DOWN_ARROW 5
-#define UP_ARROW 6
-
-/*
- * Platform specific flags for menu entries
- *
- * ENTRY_COMMAND_ACCEL Indicates the entry has the command key
- * in its accelerator string.
- * ENTRY_OPTION_ACCEL Indicates the entry has the option key
- * in its accelerator string.
- * ENTRY_SHIFT_ACCEL Indicates the entry has the shift key
- * in its accelerator string.
- * ENTRY_CONTROL_ACCEL Indicates the entry has the control key
- * in its accelerator string.
- */
-
-#define ENTRY_COMMAND_ACCEL ENTRY_PLATFORM_FLAG1
-#define ENTRY_OPTION_ACCEL ENTRY_PLATFORM_FLAG2
-#define ENTRY_SHIFT_ACCEL ENTRY_PLATFORM_FLAG3
-#define ENTRY_CONTROL_ACCEL ENTRY_PLATFORM_FLAG4
-#define ENTRY_ACCEL_MASK (ENTRY_COMMAND_ACCEL | ENTRY_OPTION_ACCEL \
- | ENTRY_SHIFT_ACCEL | ENTRY_CONTROL_ACCEL)
-
-/*
- * This structure is used to keep track of subfields within Macintosh menu
- * items.
- */
-
-typedef struct EntryGeometry {
- int accelTextStart; /* Offset into the accel string where
- * the text starts. Everything before
- * this is modifier key descriptions.
- */
- int modifierWidth; /* Width of modifier symbols. */
- int accelTextWidth; /* Width of the text after the modifier
- * keys. */
- int nonAccelMargin; /* The width of the margin for entries
- * without accelerators. */
-} EntryGeometry;
-
-/*
- * Structure to keep track of toplevel windows and their menubars.
- */
-
-typedef struct TopLevelMenubarList {
- struct TopLevelMenubarList *nextPtr;
- /* The next window in the list. */
- Tk_Window tkwin; /* The toplevel window. */
- TkMenu *menuPtr; /* The menu associated with this
- * toplevel. */
-} TopLevelMenubarList;
-
-/*
- * Platform-specific flags for menus.
- *
- * MENU_APPLE_MENU 0 indicates a custom Apple menu has
- * not been installed; 1 a custom Apple
- * menu has been installed.
- * MENU_HELP_MENU 0 indicates a custom Help menu has
- * not been installed; 1 a custom Help
- * menu has been installed.
- * MENU_RECONFIGURE_PENDING 1 indicates that an idle handler has
- * been scheduled to reconfigure the
- * Macintosh MenuHandle.
- */
-
-#define MENU_APPLE_MENU MENU_PLATFORM_FLAG1
-#define MENU_HELP_MENU MENU_PLATFORM_FLAG2
-#define MENU_RECONFIGURE_PENDING MENU_PLATFORM_FLAG3
-
-#define CASCADE_CMD (0x1b)
- /* The special command char for cascade
- * menus. */
-#define SEPARATOR_TEXT "\p(-"
- /* The text for a menu separator. */
-
-#define MENUBAR_REDRAW_PENDING 1
-
-static int gNoTkMenus = 0; /* This is used by Tk_MacTurnOffMenus as the
- * flag that Tk is not to draw any menus. */
-RgnHandle tkMenuCascadeRgn = NULL;
- /* The region to clip drawing to when the
- * MDEF is up. */
-int tkUseMenuCascadeRgn = 0; /* If this is 1, clipping code
- * should intersect tkMenuCascadeRgn
- * before drawing occurs.
- * tkMenuCascadeRgn will only
- * be valid when the value of this
- * variable is 1. */
-
-static Tcl_HashTable commandTable;
- /* The list of menuInstancePtrs associated with
- * menu ids */
-static short currentAppleMenuID;
- /* The id of the current Apple menu. 0 for
- * none. */
-static short currentHelpMenuID; /* The id of the current Help menu. 0 for
- * none. */
-static Tcl_Interp *currentMenuBarInterp;
- /* The interpreter of the window that owns
- * the current menubar. */
-static char *currentMenuBarName;
- /* Malloced. Name of current menu in menu bar.
- * NULL if no menu set. TO DO: make this a
- * DString. */
-static Tk_Window currentMenuBarOwner;
- /* Which window owns the current menu bar. */
-static char elipsisString[TCL_UTF_MAX + 1];
- /* The UTF representation of the elipsis (Š)
- * character. */
-static int helpItemCount; /* The number of items in the help menu.
- * -1 means that the help menu is
- * unavailable. This does not include
- * the automatically generated separator. */
-static int inPostMenu; /* We cannot be re-entrant like X
- * windows. */
-static short lastMenuID; /* To pass to NewMenu; need to figure out
- * a good way to do this. */
-static unsigned char lastCascadeID;
- /* Cascades have to have ids that are
- * less than 256. */
-static MacDrawable macMDEFDrawable;
- /* Drawable for use by MDEF code */
-static MDEFScrollFlag = 0; /* Used so that popups don't scroll too soon. */
-static int menuBarFlags; /* Used for whether the menu bar needs
- * redrawing or not. */
-static TkMenuDefUPP menuDefProc = NULL ;
- /* The routine descriptor to the MDEF proc.
- * The MDEF is needed to draw menus with
- * non-standard attributes and to support
- * tearoff menus. */
-static struct TearoffSelect {
- TkMenu *menuPtr; /* The menu that is torn off */
- Point point; /* The point to place the new menu */
- Rect excludeRect; /* We don't want to drag tearoff highlights
- * when we are in this menu */
-} tearoffStruct;
-
-static RgnHandle totalMenuRgn = NULL;
- /* Used to update windows which have been
- * obscured by menus. */
-static RgnHandle utilRgn = NULL;/* Used when creating the region that is to
- * be clipped out while the MDEF is active. */
-
-static TopLevelMenubarList *windowListPtr;
- /* A list of windows that have menubars set. */
-static MenuItemDrawingUPP tkThemeMenuItemDrawingUPP;
- /* Points to the UPP for theme Item drawing. */
-
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static void CompleteIdlers _ANSI_ARGS_((TkMenu *menuPtr));
-static void DrawMenuBarWhenIdle _ANSI_ARGS_((
- ClientData clientData));
-static void DrawMenuBackground _ANSI_ARGS_((
- Rect *menuRectPtr, Drawable d, ThemeMenuType type));
-static void DrawMenuEntryAccelerator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr,
- Tk_3DBorder activeBorder, int x, int y,
- int width, int height, int drawArrow));
-static void DrawMenuEntryBackground _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, Tk_3DBorder activeBorder,
- Tk_3DBorder bgBorder, int x, int y,
- int width, int heigth));
-static void DrawMenuEntryIndicator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, GC indicatorGC,
- Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuEntryLabel _ANSI_ARGS_((
- TkMenu * menuPtr, TkMenuEntry *mePtr, Drawable d,
- GC gc, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuSeparator _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static void DrawTearoffEntry _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static Handle FixMDEF _ANSI_ARGS_((void));
-static void GetEntryText _ANSI_ARGS_((TkMenuEntry *mePtr,
- Tcl_DString *dStringPtr));
-static void GetMenuAccelGeometry _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *modWidthPtr,
- int *textWidthPtr, int *heightPtr));
-static void GetMenuLabelGeometry _ANSI_ARGS_((TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuIndicatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuSeparatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetTearoffEntryGeometry _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *widthPtr,
- int *heightPtr));
-static int GetNewID _ANSI_ARGS_((Tcl_Interp *interp,
- TkMenu *menuInstPtr, int cascade,
- short *menuIDPtr));
-static char FindMarkCharacter _ANSI_ARGS_((TkMenuEntry *mePtr));
-static void FreeID _ANSI_ARGS_((short menuID));
-static void InvalidateMDEFRgns _ANSI_ARGS_((void));
-static void MenuDefProc _ANSI_ARGS_((short message,
- MenuHandle menu, Rect *menuRectPtr,
- Point hitPt, short *whichItem,
- TkMenuLowMemGlobals *globalsPtr));
-static void MenuSelectEvent _ANSI_ARGS_((TkMenu *menuPtr));
-static void ReconfigureIndividualMenu _ANSI_ARGS_((
- TkMenu *menuPtr, MenuHandle macMenuHdl,
- int base));
-static void ReconfigureMacintoshMenu _ANSI_ARGS_ ((
- ClientData clientData));
-static void RecursivelyClearActiveMenu _ANSI_ARGS_((
- TkMenu *menuPtr));
-static void RecursivelyDeleteMenu _ANSI_ARGS_((
- TkMenu *menuPtr));
-static void RecursivelyInsertMenu _ANSI_ARGS_((
- TkMenu *menuPtr));
-static void SetDefaultMenubar _ANSI_ARGS_((void));
-static int SetMenuCascade _ANSI_ARGS_((TkMenu *menuPtr));
-static void SetMenuIndicator _ANSI_ARGS_((TkMenuEntry *mePtr));
-static void SetMenuTitle _ANSI_ARGS_((MenuHandle menuHdl,
- Tcl_Obj *titlePtr));
-static void AppearanceEntryDrawWrapper _ANSI_ARGS_((TkMenuEntry *mePtr,
- Rect * menuRectPtr, TkMenuLowMemGlobals *globalsPtr,
- Drawable d, Tk_FontMetrics *fmPtr, Tk_Font tkfont,
- int x, int y, int width, int height));
-pascal void tkThemeMenuItemDrawingProc _ANSI_ARGS_ ((const Rect *inBounds,
- SInt16 inDepth, Boolean inIsColorDevice,
- SInt32 inUserData));
-
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacUseID --
- *
- * Take the ID out of the available list for new menus. Used by the
- * default menu bar's menus so that they do not get created at the tk
- * level. See GetNewID for more information.
- *
- * Results:
- * Returns TCL_OK if the id was not in use. Returns TCL_ERROR if the
- * id was in use.
- *
- * Side effects:
- * A hash table entry in the command table is created with a NULL
- * value.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacUseMenuID(
- short macID) /* The id to take out of the table */
-{
- Tcl_HashEntry *commandEntryPtr;
- int newEntry;
-
- TkMenuInit();
- commandEntryPtr = Tcl_CreateHashEntry(&commandTable, (char *) macID,
- &newEntry);
- if (newEntry == 1) {
- Tcl_SetHashValue(commandEntryPtr, NULL);
- return TCL_OK;
- } else {
- return TCL_ERROR;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetNewID --
- *
- * Allocates a new menu id and marks it in use. Each menu on the
- * mac must be designated by a unique id, which is a short. In
- * addition, some ids are reserved by the system. Since Tk uses
- * mostly dynamic menus, we must allocate and free these ids on
- * the fly. We use the id as a key into a hash table; if there
- * is no hash entry, we know that we can use the id.
- *
- * Results:
- * Returns TCL_OK if succesful; TCL_ERROR if there are no more
- * ids of the appropriate type to allocate. menuIDPtr contains
- * the new id if succesful.
- *
- * Side effects:
- * An entry is created for the menu in the command hash table,
- * and the hash entry is stored in the appropriate field in the
- * menu data structure.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GetNewID(
- Tcl_Interp *interp, /* Used for error reporting */
- TkMenu *menuPtr, /* The menu we are working with */
- int cascade, /* 0 if we are working with a normal menu;
- 1 if we are working with a cascade */
- short *menuIDPtr) /* The resulting id */
-{
- int found = 0;
- int newEntry;
- Tcl_HashEntry *commandEntryPtr;
- short returnID = *menuIDPtr;
-
- /*
- * The following code relies on shorts and unsigned chars wrapping
- * when the highest value is incremented. Also, the values between
- * 236 and 255 inclusive are reserved for DA's by the Mac OS.
- */
-
- if (!cascade) {
- short curID = lastMenuID + 1;
- if (curID == 236) {
- curID = 256;
- }
-
- while (curID != lastMenuID) {
- commandEntryPtr = Tcl_CreateHashEntry(&commandTable,
- (char *) curID, &newEntry);
- if (newEntry == 1) {
- found = 1;
- lastMenuID = returnID = curID;
- break;
- }
- curID++;
- if (curID == 236) {
- curID = 256;
- }
- }
- } else {
-
- /*
- * Cascade ids must be between 0 and 235 only, so they must be
- * dealt with separately.
- */
-
- unsigned char curID = lastCascadeID + 1;
- if (curID == 236) {
- curID = 0;
- }
-
- while (curID != lastCascadeID) {
- commandEntryPtr = Tcl_CreateHashEntry(&commandTable,
- (char *) curID, &newEntry);
- if (newEntry == 1) {
- found = 1;
- lastCascadeID = returnID = curID;
- break;
- }
- curID++;
- if (curID == 236) {
- curID = 0;
- }
- }
- }
-
- if (found) {
- Tcl_SetHashValue(commandEntryPtr, (char *) menuPtr);
- *menuIDPtr = returnID;
- return TCL_OK;
- } else {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "No more menus can be allocated.",
- (char *) NULL);
- return TCL_ERROR;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FreeID --
- *
- * Marks the id as free.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The hash table entry for the ID is cleared.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-FreeID(
- short menuID) /* The id to free */
-{
- Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&commandTable,
- (char *) menuID);
-
- if (entryPtr != NULL) {
- Tcl_DeleteHashEntry(entryPtr);
- }
- if (menuID == currentAppleMenuID) {
- currentAppleMenuID = 0;
- }
- if (menuID == currentHelpMenuID) {
- currentHelpMenuID = 0;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpNewMenu --
- *
- * Gets a new blank menu. Only the platform specific options are filled
- * in.
- *
- * Results:
- * Returns a standard TCL error.
- *
- * Side effects:
- * Allocates a Macintosh menu handle and puts in the platformData
- * field of the menuPtr.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpNewMenu(
- TkMenu *menuPtr) /* The common structure we are making the
- * platform structure for. */
-{
- short menuID;
- Str255 itemText;
- int length;
- MenuHandle macMenuHdl;
- int error = TCL_OK;
-
- error = GetNewID(menuPtr->interp, menuPtr, 0, &menuID);
- if (error != TCL_OK) {
- return error;
- }
- length = strlen(Tk_PathName(menuPtr->tkwin));
- memmove(&itemText[1], Tk_PathName(menuPtr->tkwin),
- (length > 230) ? 230 : length);
- itemText[0] = (length > 230) ? 230 : length;
- macMenuHdl = NewMenu(menuID, itemText);
-#if GENERATINGCFM
- {
- Handle mdefProc = FixMDEF();
- if ((mdefProc != NULL)) {
- (*macMenuHdl)->menuProc = mdefProc;
- }
- }
-#endif
- menuPtr->platformData = (TkMenuPlatformData) ckalloc(sizeof(MacMenu));
- ((MacMenu *) menuPtr->platformData)->menuHdl = macMenuHdl;
- SetRect(&((MacMenu *) menuPtr->platformData)->menuRect, 0, 0, 0, 0);
-
- if ((currentMenuBarInterp == menuPtr->interp)
- && (currentMenuBarName != NULL)) {
- Tk_Window parentWin = Tk_Parent(menuPtr->tkwin);
-
- if (strcmp(currentMenuBarName, Tk_PathName(parentWin)) == 0) {
- if ((strcmp(Tk_PathName(menuPtr->tkwin)
- + strlen(Tk_PathName(parentWin)), ".apple") == 0)
- || (strcmp(Tk_PathName(menuPtr->tkwin)
- + strlen(Tk_PathName(parentWin)), ".help") == 0)) {
- if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DrawMenuBarWhenIdle, (ClientData *) NULL);
- menuBarFlags |= MENUBAR_REDRAW_PENDING;
- }
- }
- }
- }
-
- menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDestroyMenu --
- *
- * Destroys platform-specific menu structures.
- *
- * Results:
- * None.
- *
- * Side effects:
- * All platform-specific allocations are freed up.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDestroyMenu(
- TkMenu *menuPtr) /* The common menu structure */
-{
- MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
-
- if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
- Tcl_CancelIdleCall(ReconfigureMacintoshMenu, (ClientData) menuPtr);
- menuPtr->menuFlags &= ~MENU_RECONFIGURE_PENDING;
- }
-
- if ((*macMenuHdl)->menuID == currentHelpMenuID) {
- MenuHandle helpMenuHdl;
-
- if ((HMGetHelpMenuHandle(&helpMenuHdl) == noErr)
- && (helpMenuHdl != NULL)) {
- int i, count = CountMItems(helpMenuHdl);
-
- for (i = helpItemCount; i <= count; i++) {
- DeleteMenuItem(helpMenuHdl, helpItemCount);
- }
- }
- currentHelpMenuID = 0;
- }
-
- if (menuPtr->platformData != NULL) {
- DeleteMenu((*macMenuHdl)->menuID);
- FreeID((*macMenuHdl)->menuID);
- DisposeMenu(macMenuHdl);
- ckfree((char *) menuPtr->platformData);
- menuPtr->platformData = NULL;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetMenuCascade --
- *
- * Does any cleanup to change a menu from a normal to a cascade.
- *
- * Results:
- * Standard Tcl error.
- *
- * Side effects:
- * The mac menu id is reset.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-SetMenuCascade(
- TkMenu* menuPtr) /* The menu we are setting up to be a
- * cascade. */
-{
- MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
- short newMenuID, menuID = (*macMenuHdl)->menuID;
- int error = TCL_OK;
-
- if (menuID >= 256) {
- error = GetNewID(menuPtr->interp, menuPtr, 1, &newMenuID);
- if (error == TCL_OK) {
- FreeID(menuID);
- (*macMenuHdl)->menuID = newMenuID;
- }
- }
- return error;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDestroyMenuEntry --
- *
- * Cleans up platform-specific menu entry items.
- *
- * Results:
- * None
- *
- * Side effects:
- * All platform-specific allocations are freed up.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDestroyMenuEntry(
- TkMenuEntry *mePtr) /* The common structure for the menu
- * entry. */
-{
- TkMenu *menuPtr = mePtr->menuPtr;
-
- ckfree((char *) mePtr->platformEntryData);
- if ((menuPtr->platformData != NULL)
- && !(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
- menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetEntryText --
- *
- * Given a menu entry, gives back the text that should go in it.
- * Separators should be done by the caller, as they have to be
- * handled specially. This is primarily used to do a substitution
- * between "..." and "Š".
- *
- * Results:
- * itemText points to the new text for the item.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GetEntryText(
- TkMenuEntry *mePtr, /* A pointer to the menu entry. */
- Tcl_DString *dStringPtr) /* The DString to put the text into. This
- * will be initialized by this routine. */
-{
- Tcl_DStringInit(dStringPtr);
- if (mePtr->type == TEAROFF_ENTRY) {
- Tcl_DStringAppend(dStringPtr, "(Tear-off)", -1);
- } else if ((mePtr->imagePtr != NULL) && (mePtr->compound == COMPOUND_NONE)) {
- Tcl_DStringAppend(dStringPtr, "(Image)", -1);
- } else if ((mePtr->bitmapPtr != NULL) && (mePtr->compound == COMPOUND_NONE)) {
- Tcl_DStringAppend(dStringPtr, "(Pixmap)", -1);
- } else if (mePtr->labelPtr == NULL || mePtr->labelLength == 0) {
- /*
- * The Mac menu manager does not like null strings.
- */
-
- Tcl_DStringAppend(dStringPtr, " ", -1);
- } else {
- int length;
- char *text = Tcl_GetStringFromObj(mePtr->labelPtr, &length);
- char *dStringText;
- int i;
-
- for (i = 0; *text; text++, i++) {
- if ((*text == '.')
- && (*(text + 1) != '\0') && (*(text + 1) == '.')
- && (*(text + 2) != '\0') && (*(text + 2) == '.')) {
- Tcl_DStringAppend(dStringPtr, elipsisString, -1);
- i += strlen(elipsisString) - 1;
- text += 2;
- } else {
- Tcl_DStringSetLength(dStringPtr,
- Tcl_DStringLength(dStringPtr) + 1);
- dStringText = Tcl_DStringValue(dStringPtr);
- dStringText[i] = *text;
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FindMarkCharacter --
- *
- * Finds the Macintosh mark character based on the font of the
- * item. We calculate a good mark character based on the font
- * that this item is rendered in.
- *
- * We try the following special mac characters. If none of them
- * are present, just use the check mark.
- * '' - Check mark character (\022)
- * '€' - Mac Bullet character (\245)
- * '' - Filled diamond (\023)
- * '×' - Hollow diamond (\327)
- * '‹' = Mac Long dash ("em dash") (\321)
- * '-' = short dash (minus, "en dash");
- *
- * Results:
- * None.
- *
- * Side effects:
- * New item is added to platform menu
- *
- *----------------------------------------------------------------------
- */
-
-static char
-FindMarkCharacter(
- TkMenuEntry *mePtr) /* The entry we are finding the character
- * for. */
-{
- char markChar;
- Tk_Font tkfont;
-
- tkfont = Tk_GetFontFromObj(mePtr->menuPtr->tkwin,
- (mePtr->fontPtr == NULL) ? mePtr->menuPtr->fontPtr
- : mePtr->fontPtr);
-
- if (!TkMacIsCharacterMissing(tkfont, '\022')) {
- markChar = '\022'; /* Check mark */
- } else if (!TkMacIsCharacterMissing(tkfont, '\245')) {
- markChar = '\245'; /* Bullet */
- } else if (!TkMacIsCharacterMissing(tkfont, '\023')) {
- markChar = '\023'; /* Filled Diamond */
- } else if (!TkMacIsCharacterMissing(tkfont, '\327')) {
- markChar = '\327'; /* Hollow Diamond */
- } else if (!TkMacIsCharacterMissing(tkfont, '\321')) {
- markChar = '\321'; /* Long Dash */
- } else if (!TkMacIsCharacterMissing(tkfont, '-')) {
- markChar = '-'; /* Short Dash */
- } else {
- markChar = '\022'; /* Check mark */
- }
- return markChar;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetMenuIndicator --
- *
- * Sets the Macintosh mark character based on the font of the
- * item.
- *
- * Results:
- * None.
- *
- * Side effects:
- * New item is added to platform menu
- *
- *----------------------------------------------------------------------
- */
-
-static void
-SetMenuIndicator(
- TkMenuEntry *mePtr) /* The entry we are setting */
-{
- TkMenu *menuPtr = mePtr->menuPtr;
- MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
- char markChar;
-
- /*
- * There can be no indicators on menus that are not checkbuttons
- * or radiobuttons. However, we should go ahead and set them
- * so that menus look right when they are displayed. We should
- * not set cascade entries, however, as the mark character
- * means something different for cascade items on the Mac.
- * Also, we do reflect the tearOff menu items in the Mac menu
- * handle, so we ignore them.
- */
-
- if (mePtr->type == CASCADE_ENTRY) {
- return;
- }
-
- markChar = 0;
- if ((mePtr->type == RADIO_BUTTON_ENTRY)
- || (mePtr->type == CHECK_BUTTON_ENTRY)) {
- if (mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED)) {
- markChar = FindMarkCharacter(mePtr);
- }
- }
- SetItemMark(macMenuHdl, mePtr->index + 1, markChar);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetMenuTitle --
- *
- * Sets title of menu so that the text displays correctly in menubar.
- * This code directly manipulates menu handle data. This code
- * was originally part of an ancient Apple Developer Response mail.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The menu handle will change size depending on the length of the
- * title
- *
- *----------------------------------------------------------------------
- */
-
-static void
-SetMenuTitle(
- MenuHandle menuHdl, /* The menu we are setting the title of. */
- Tcl_Obj *titlePtr) /* The C string to set the title to. */
-{
- int oldLength, newLength, oldHandleSize, dataLength;
- Ptr menuDataPtr;
- char *title = (titlePtr == NULL) ? ""
- : Tcl_GetStringFromObj(titlePtr, NULL);
-
- menuDataPtr = (Ptr) (*menuHdl)->menuData;
-
- if (strncmp(title, menuDataPtr + 1, menuDataPtr[0]) != 0) {
- newLength = strlen(title) + 1;
- oldLength = menuDataPtr[0] + 1;
- oldHandleSize = GetHandleSize((Handle) menuHdl);
- dataLength = oldHandleSize - (sizeof(MenuInfo) - sizeof(Str255))
- - oldLength;
- if (newLength > oldLength) {
- SetHandleSize((Handle) menuHdl, oldHandleSize + (newLength
- - oldLength));
- menuDataPtr = (Ptr) (*menuHdl)->menuData;
- }
-
- BlockMove(menuDataPtr + oldLength, menuDataPtr + newLength,
- dataLength);
- BlockMove(title, menuDataPtr + 1, newLength - 1);
- menuDataPtr[0] = newLength - 1;
-
- if (newLength < oldLength) {
- SetHandleSize((Handle) menuHdl, oldHandleSize + (newLength
- - oldLength));
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpConfigureMenuEntry --
- *
- * Processes configurations for menu entries.
- *
- * Results:
- * Returns standard TCL result. If TCL_ERROR is returned, then
- * the interp's result contains an error message.
- *
- * Side effects:
- * Configuration information get set for mePtr; old resources
- * get freed, if any need it.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpConfigureMenuEntry(
- register TkMenuEntry *mePtr) /* Information about menu entry; may
- * or may not already have values for
- * some fields. */
-{
- TkMenu *menuPtr = mePtr->menuPtr;
- int index = mePtr->index;
- MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
- MenuHandle helpMenuHdl = NULL;
-
- /*
- * Cascade menus have to have menu IDs of less than 256. So
- * we need to change the child menu if this has been configured
- * for a cascade item.
- */
-
- if (mePtr->type == CASCADE_ENTRY) {
- if ((mePtr->childMenuRefPtr != NULL)
- && (mePtr->childMenuRefPtr->menuPtr != NULL)) {
- MenuHandle childMenuHdl = ((MacMenu *) mePtr
- ->childMenuRefPtr->menuPtr->platformData)->menuHdl;
-
- if (childMenuHdl != NULL) {
- int error = SetMenuCascade(mePtr->childMenuRefPtr->menuPtr);
-
- if (error != TCL_OK) {
- return error;
- }
-
- if (menuPtr->menuType == MENUBAR) {
- SetMenuTitle(childMenuHdl, mePtr->labelPtr);
- }
- }
- }
- }
-
- /*
- * We need to parse the accelerator string. If it has the strings
- * for Command, Control, Shift or Option, we need to flag it
- * so we can draw the symbols for it. We also need to precalcuate
- * the position of the first real character we are drawing.
- */
-
- if (0 == mePtr->accelLength) {
- ((EntryGeometry *)mePtr->platformEntryData)->accelTextStart = -1;
- } else {
- char *accelString = (mePtr->accelPtr == NULL) ? ""
- : Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
- char *accel = accelString;
- mePtr->entryFlags |= ~ENTRY_ACCEL_MASK;
-
- while (1) {
- if ((0 == strncasecmp("Control", accelString, 6))
- && (('-' == accelString[6]) || ('+' == accelString[6]))) {
- mePtr->entryFlags |= ENTRY_CONTROL_ACCEL;
- accelString += 7;
- } else if ((0 == strncasecmp("Ctrl", accelString, 4))
- && (('-' == accelString[4]) || ('+' == accelString[4]))) {
- mePtr->entryFlags |= ENTRY_CONTROL_ACCEL;
- accelString += 5;
- } else if ((0 == strncasecmp("Shift", accelString, 5))
- && (('-' == accelString[5]) || ('+' == accelString[5]))) {
- mePtr->entryFlags |= ENTRY_SHIFT_ACCEL;
- accelString += 6;
- } else if ((0 == strncasecmp("Option", accelString, 6))
- && (('-' == accelString[6]) || ('+' == accelString[6]))) {
- mePtr->entryFlags |= ENTRY_OPTION_ACCEL;
- accelString += 7;
- } else if ((0 == strncasecmp("Opt", accelString, 3))
- && (('-' == accelString[3]) || ('+' == accelString[3]))) {
- mePtr->entryFlags |= ENTRY_OPTION_ACCEL;
- accelString += 4;
- } else if ((0 == strncasecmp("Command", accelString, 7))
- && (('-' == accelString[7]) || ('+' == accelString[7]))) {
- mePtr->entryFlags |= ENTRY_COMMAND_ACCEL;
- accelString += 8;
- } else if ((0 == strncasecmp("Cmd", accelString, 3))
- && (('-' == accelString[3]) || ('+' == accelString[3]))) {
- mePtr->entryFlags |= ENTRY_COMMAND_ACCEL;
- accelString += 4;
- } else if ((0 == strncasecmp("Alt", accelString, 3))
- && (('-' == accelString[3]) || ('+' == accelString[3]))) {
- mePtr->entryFlags |= ENTRY_OPTION_ACCEL;
- accelString += 4;
- } else if ((0 == strncasecmp("Meta", accelString, 4))
- && (('-' == accelString[4]) || ('+' == accelString[4]))) {
- mePtr->entryFlags |= ENTRY_COMMAND_ACCEL;
- accelString += 5;
- } else {
- break;
- }
- }
-
- ((EntryGeometry *)mePtr->platformEntryData)->accelTextStart
- = ((long) accelString - (long) accel);
- }
-
- if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
- menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
- }
-
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ReconfigureIndividualMenu --
- *
- * This routine redoes the guts of the menu. It works from
- * a base item and offset, so that a regular menu will
- * just have all of its items added, but the help menu will
- * have all of its items appended after the apple-defined
- * items.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The Macintosh menu handle is updated
- *
- *----------------------------------------------------------------------
- */
-
-static void
-ReconfigureIndividualMenu(
- TkMenu *menuPtr, /* The menu we are affecting. */
- MenuHandle macMenuHdl, /* The macintosh menu we are affecting.
- * Will not necessarily be
- * menuPtr->platformData because this could
- * be the help menu. */
- int base) /* The last index that we do not want
- * touched. 0 for normal menus;
- * helpMenuItemCount for help menus. */
-{
- int count;
- int index;
- TkMenuEntry *mePtr;
- Str255 itemText;
- int parentDisabled = 0;
-
- for (mePtr = menuPtr->menuRefPtr->parentEntryPtr; mePtr != NULL;
- mePtr = mePtr->nextCascadePtr) {
- char *name = (mePtr->namePtr == NULL) ? ""
- : Tcl_GetStringFromObj(mePtr->namePtr, NULL);
-
- if (strcmp(Tk_PathName(menuPtr->tkwin), name) == 0) {
- if (mePtr->state == ENTRY_DISABLED) {
- parentDisabled = 1;
- }
- break;
- }
- }
-
- /*
- * First, we get rid of all of the old items.
- */
-
- count = CountMItems(macMenuHdl);
- for (index = base; index < count; index++) {
- DeleteMenuItem(macMenuHdl, base + 1);
- }
-
- count = menuPtr->numEntries;
-
- for (index = 1; index <= count; index++) {
- mePtr = menuPtr->entries[index - 1];
-
- /*
- * We have to do separators separately because SetMenuItemText
- * does not parse meta-characters.
- */
-
- if (mePtr->type == SEPARATOR_ENTRY) {
- AppendMenu(macMenuHdl, SEPARATOR_TEXT);
- } else {
- Tcl_DString itemTextDString;
- int destWrote;
-
- GetEntryText(mePtr, &itemTextDString);
- Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&itemTextDString),
- Tcl_DStringLength(&itemTextDString), 0, NULL,
- (char *) &itemText[1],
- 231, NULL, &destWrote, NULL);
- itemText[0] = destWrote;
-
- AppendMenu(macMenuHdl, "\px");
- SetMenuItemText(macMenuHdl, base + index, itemText);
- Tcl_DStringFree(&itemTextDString);
-
- /*
- * Set enabling and disabling correctly.
- */
-
- if (parentDisabled || (mePtr->state == ENTRY_DISABLED)) {
- DisableItem(macMenuHdl, base + index);
- } else {
- EnableItem(macMenuHdl, base + index);
- }
-
- /*
- * Set the check mark for check entries and radio entries.
- */
-
- SetItemMark(macMenuHdl, base + index, 0);
- if ((mePtr->type == CHECK_BUTTON_ENTRY)
- || (mePtr->type == RADIO_BUTTON_ENTRY)) {
- CheckItem(macMenuHdl, base + index, (mePtr->entryFlags
- & ENTRY_SELECTED) && mePtr->indicatorOn);
- if (mePtr->indicatorOn
- && (mePtr->entryFlags & ENTRY_SELECTED)) {
- SetItemMark(macMenuHdl, base + index,
- FindMarkCharacter(mePtr));
- }
- }
-
- if (mePtr->type == CASCADE_ENTRY) {
- if ((mePtr->childMenuRefPtr != NULL)
- && (mePtr->childMenuRefPtr->menuPtr != NULL)) {
- MenuHandle childMenuHdl =
- ((MacMenu *) mePtr->childMenuRefPtr
- ->menuPtr->platformData)->menuHdl;
-
- if (childMenuHdl == NULL) {
- childMenuHdl = ((MacMenu *) mePtr->childMenuRefPtr
- ->menuPtr->platformData)->menuHdl;
- }
- if (childMenuHdl != NULL) {
- if (TkMacHaveAppearance() > 1) {
- SetMenuItemHierarchicalID(macMenuHdl, base + index,
- (*childMenuHdl)->menuID);
- } else {
- SetItemMark(macMenuHdl, base + index,
- (*childMenuHdl)->menuID);
- SetItemCmd(macMenuHdl, base + index, CASCADE_CMD);
- }
- }
- /*
- * If we changed the highligthing of this menu, its
- * children all have to be reconfigured so that
- * their state will be reflected in the menubar.
- */
-
- if (!(mePtr->childMenuRefPtr->menuPtr->menuFlags
- & MENU_RECONFIGURE_PENDING)) {
- mePtr->childMenuRefPtr->menuPtr->menuFlags
- |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
- (ClientData) mePtr->childMenuRefPtr->menuPtr);
- }
- }
- }
-
- if ((mePtr->type != CASCADE_ENTRY)
- && (ENTRY_COMMAND_ACCEL
- == (mePtr->entryFlags & ENTRY_ACCEL_MASK))) {
- char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
- SetItemCmd(macMenuHdl, base + index, accel[((EntryGeometry *)
- mePtr->platformEntryData)->accelTextStart]);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ReconfigureMacintoshMenu --
- *
- * Rebuilds the Macintosh MenuHandle items from the menu. Called
- * usually as an idle handler, but can be called synchronously
- * if the menu is about to be posted.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Configuration information get set for mePtr; old resources
- * get freed, if any need it.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-ReconfigureMacintoshMenu(
- ClientData clientData) /* Information about menu entry; may
- * or may not already have values for
- * some fields. */
-{
- TkMenu *menuPtr = (TkMenu *) clientData;
- MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
- MenuHandle helpMenuHdl = NULL;
-
- menuPtr->menuFlags &= ~MENU_RECONFIGURE_PENDING;
-
- if (NULL == macMenuHdl) {
- return;
- }
-
- ReconfigureIndividualMenu(menuPtr, macMenuHdl, 0);
-
- if (menuPtr->menuFlags & MENU_APPLE_MENU) {
- AppendResMenu(macMenuHdl, 'DRVR');
- }
-
- if ((*macMenuHdl)->menuID == currentHelpMenuID) {
- HMGetHelpMenuHandle(&helpMenuHdl);
- if (helpMenuHdl != NULL) {
- ReconfigureIndividualMenu(menuPtr, helpMenuHdl, helpItemCount);
- }
- }
-
- if (menuPtr->menuType == MENUBAR) {
- if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DrawMenuBarWhenIdle, (ClientData *) NULL);
- menuBarFlags |= MENUBAR_REDRAW_PENDING;
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * CompleteIdlers --
- *
- * Completes all idle handling so that the menus are in sync when
- * the user invokes them with the mouse.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The Macintosh menu handles are flushed out.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-CompleteIdlers(
- TkMenu *menuPtr) /* The menu we are completing. */
-{
- int i;
-
- if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
- Tcl_CancelIdleCall(ReconfigureMacintoshMenu, (ClientData) menuPtr);
- ReconfigureMacintoshMenu((ClientData) menuPtr);
- }
-
- for (i = 0; i < menuPtr->numEntries; i++) {
- if (menuPtr->entries[i]->type == CASCADE_ENTRY) {
- if ((menuPtr->entries[i]->childMenuRefPtr != NULL)
- && (menuPtr->entries[i]->childMenuRefPtr->menuPtr
- != NULL)) {
- CompleteIdlers(menuPtr->entries[i]->childMenuRefPtr
- ->menuPtr);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpPostMenu --
- *
- * Posts a menu on the screen
- *
- * Results:
- * None.
- *
- * Side effects:
- * The menu is posted and handled.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpPostMenu(
- Tcl_Interp *interp, /* The interpreter this menu lives in */
- TkMenu *menuPtr, /* The menu we are posting */
- int x, /* The global x-coordinate of the top, left-
- * hand corner of where the menu is supposed
- * to be posted. */
- int y) /* The global y-coordinate */
-{
- MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
- long popUpResult;
- int result;
- int oldMode;
-
- if (inPostMenu) {
- Tcl_AppendResult(interp,
- "Cannot call post menu while already posting menu",
- (char *) NULL);
- result = TCL_ERROR;
- } else {
- Window dummyWin;
- unsigned int state;
- int dummy, mouseX, mouseY;
- short menuID;
- Window window;
- int oldWidth = menuPtr->totalWidth;
- Tk_Window parentWindow = Tk_Parent(menuPtr->tkwin);
-
- inPostMenu++;
-
- result = TkPreprocessMenu(menuPtr);
- if (result != TCL_OK) {
- inPostMenu--;
- return result;
- }
-
- /*
- * The post commands could have deleted the menu, which means
- * we are dead and should go away.
- */
-
- if (menuPtr->tkwin == NULL) {
- inPostMenu--;
- return TCL_OK;
- }
-
- CompleteIdlers(menuPtr);
- if (menuBarFlags & MENUBAR_REDRAW_PENDING) {
- Tcl_CancelIdleCall(DrawMenuBarWhenIdle, (ClientData *) NULL);
- DrawMenuBarWhenIdle((ClientData *) NULL);
- }
-
- if (NULL == parentWindow) {
- tearoffStruct.excludeRect.top = tearoffStruct.excludeRect.left
- = tearoffStruct.excludeRect.bottom
- = tearoffStruct.excludeRect.right = SHRT_MAX;
- } else {
- int left, top;
-
- Tk_GetRootCoords(parentWindow, &left, &top);
- tearoffStruct.excludeRect.left = left;
- tearoffStruct.excludeRect.top = top;
- tearoffStruct.excludeRect.right = left + Tk_Width(parentWindow);
- tearoffStruct.excludeRect.bottom = top + Tk_Height(parentWindow);
- if (Tk_Class(parentWindow) == Tk_GetUid("Menubutton")) {
- TkWindow *parentWinPtr = (TkWindow *) parentWindow;
- TkMenuButton *mbPtr =
- (TkMenuButton *) parentWinPtr->instanceData;
- int menuButtonWidth = Tk_Width(parentWindow)
- - 2 * (mbPtr->highlightWidth + mbPtr->borderWidth + 1);
- menuPtr->totalWidth = menuButtonWidth > menuPtr->totalWidth
- ? menuButtonWidth : menuPtr->totalWidth;
- }
- }
-
- InsertMenu(macMenuHdl, -1);
- RecursivelyInsertMenu(menuPtr);
- CountMItems(macMenuHdl);
-
- FixMDEF();
- oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- popUpResult = PopUpMenuSelect(macMenuHdl, y, x, menuPtr->active);
- Tcl_SetServiceMode(oldMode);
-
- menuPtr->totalWidth = oldWidth;
- RecursivelyDeleteMenu(menuPtr);
- DeleteMenu((*macMenuHdl)->menuID);
-
- /*
- * Simulate the mouse up.
- */
-
- XQueryPointer(NULL, None, &dummyWin, &dummyWin, &mouseX,
- &mouseY, &dummy, &dummy, &state);
- window = Tk_WindowId(menuPtr->tkwin);
- TkGenerateButtonEvent(mouseX, mouseY, window, state);
-
- /*
- * Dispatch the command.
- */
-
- menuID = HiWord(popUpResult);
- if (menuID != 0) {
- result = TkMacDispatchMenuEvent(menuID, LoWord(popUpResult));
- } else {
- TkMacHandleTearoffMenu();
- result = TCL_OK;
- }
- InvalidateMDEFRgns();
- RecursivelyClearActiveMenu(menuPtr);
-
- inPostMenu--;
- }
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpMenuNewEntry --
- *
- * Adds a pointer to a new menu entry structure with the platform-
- * specific fields filled in. The Macintosh uses the
- * platformEntryData field of the TkMenuEntry record to store
- * geometry information.
- *
- * Results:
- * Standard TCL error.
- *
- * Side effects:
- * Storage gets allocated. New menu entry data is put into the
- * platformEntryData field of the mePtr.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpMenuNewEntry(
- TkMenuEntry *mePtr) /* The menu we are adding an entry to */
-{
- EntryGeometry *geometryPtr =
- (EntryGeometry *) ckalloc(sizeof(EntryGeometry));
- TkMenu *menuPtr = mePtr->menuPtr;
-
- geometryPtr->accelTextStart = 0;
- geometryPtr->accelTextWidth = 0;
- geometryPtr->nonAccelMargin = 0;
- geometryPtr->modifierWidth = 0;
- mePtr->platformEntryData = (TkMenuPlatformEntryData) geometryPtr;
- if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
- menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- *
- * Tk_MacTurnOffMenus --
- *
- * Turns off all the menu drawing code. This is more than just disabling
- * the "menu" command, this means that Tk will NEVER touch the menubar.
- * It is needed in the Plugin, where Tk does not own the menubar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A flag is set which will disable all menu drawing.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_MacTurnOffMenus()
-{
- gNoTkMenus = 1;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- *
- * DrawMenuBarWhenIdle --
- *
- * Update the menu bar next time there is an idle event.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Menu bar is redrawn.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-DrawMenuBarWhenIdle(
- ClientData clientData) /* ignored here */
-{
- TkMenuReferences *menuRefPtr;
- TkMenu *appleMenuPtr, *helpMenuPtr;
- MenuHandle macMenuHdl;
- Tcl_HashEntry *hashEntryPtr;
-
- /*
- * If we have been turned off, exit.
- */
-
- if (gNoTkMenus) {
- return;
- }
-
- /*
- * We need to clear the apple and help menus of any extra items.
- */
-
- if (currentAppleMenuID != 0) {
- hashEntryPtr = Tcl_FindHashEntry(&commandTable,
- (char *) currentAppleMenuID);
- appleMenuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
- TkpDestroyMenu(appleMenuPtr);
- TkpNewMenu(appleMenuPtr);
- appleMenuPtr->menuFlags &= ~MENU_APPLE_MENU;
- appleMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
- (ClientData) appleMenuPtr);
- }
-
- if (currentHelpMenuID != 0) {
- hashEntryPtr = Tcl_FindHashEntry(&commandTable,
- (char *) currentHelpMenuID);
- helpMenuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
- TkpDestroyMenu(helpMenuPtr);
- TkpNewMenu(helpMenuPtr);
- helpMenuPtr->menuFlags &= ~MENU_HELP_MENU;
- helpMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
- (ClientData) helpMenuPtr);
- }
-
- /*
- * We need to find the clone of this menu that is the menubar.
- * Once we do that, for every cascade in the menu, we need to
- * insert the Mac menu in the Mac menubar. Finally, we need
- * to redraw the menubar.
- */
-
- menuRefPtr = NULL;
- if (currentMenuBarName != NULL) {
- menuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
- currentMenuBarName);
- }
- if (menuRefPtr != NULL) {
- TkMenu *menuPtr, *menuBarPtr;
- TkMenu *cascadeMenuPtr;
- char *appleMenuName, *helpMenuName;
- int appleIndex = -1, helpIndex = -1;
- int i;
-
- menuPtr = menuRefPtr->menuPtr;
- if (menuPtr != NULL) {
- TkMenuReferences *specialMenuRefPtr;
- TkMenuEntry *specialEntryPtr;
-
- appleMenuName = ckalloc(strlen(currentMenuBarName)
- + 1 + strlen(".apple") + 1);
- sprintf(appleMenuName, "%s.apple",
- Tk_PathName(menuPtr->tkwin));
- specialMenuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
- appleMenuName);
- if ((specialMenuRefPtr != NULL)
- && (specialMenuRefPtr->menuPtr != NULL)) {
- for (specialEntryPtr
- = specialMenuRefPtr->parentEntryPtr;
- specialEntryPtr != NULL;
- specialEntryPtr
- = specialEntryPtr->nextCascadePtr) {
- if (specialEntryPtr->menuPtr == menuPtr) {
- appleIndex = specialEntryPtr->index;
- break;
- }
- }
- }
- ckfree(appleMenuName);
-
- helpMenuName = ckalloc(strlen(currentMenuBarName)
- + 1 + strlen(".help") + 1);
- sprintf(helpMenuName, "%s.help",
- Tk_PathName(menuPtr->tkwin));
- specialMenuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
- helpMenuName);
- if ((specialMenuRefPtr != NULL)
- && (specialMenuRefPtr->menuPtr != NULL)) {
- for (specialEntryPtr
- = specialMenuRefPtr->parentEntryPtr;
- specialEntryPtr != NULL;
- specialEntryPtr
- = specialEntryPtr->nextCascadePtr) {
- if (specialEntryPtr->menuPtr == menuPtr) {
- helpIndex = specialEntryPtr->index;
- break;
- }
- }
- }
- ckfree(helpMenuName);
-
- }
-
- for (menuBarPtr = menuPtr;
- (menuBarPtr != NULL)
- && (menuBarPtr->menuType != MENUBAR);
- menuBarPtr = menuBarPtr->nextInstancePtr) {
-
- /*
- * Null loop body.
- */
-
- }
-
- if (menuBarPtr == NULL) {
- SetDefaultMenubar();
- } else {
- if (menuBarPtr->tearoff != menuPtr->tearoff) {
- if (menuBarPtr->tearoff) {
- appleIndex = (-1 == appleIndex) ? appleIndex
- : appleIndex + 1;
- helpIndex = (-1 == helpIndex) ? helpIndex
- : helpIndex + 1;
- } else {
- appleIndex = (-1 == appleIndex) ? appleIndex
- : appleIndex - 1;
- helpIndex = (-1 == helpIndex) ? helpIndex
- : helpIndex - 1;
- }
- }
- ClearMenuBar();
-
- if (appleIndex == -1) {
- InsertMenu(tkAppleMenu, 0);
- currentAppleMenuID = 0;
- } else {
- short appleID;
- appleMenuPtr = menuBarPtr->entries[appleIndex]
- ->childMenuRefPtr->menuPtr;
- TkpDestroyMenu(appleMenuPtr);
- GetNewID(appleMenuPtr->interp, appleMenuPtr, 0,
- &appleID);
- macMenuHdl = NewMenu(appleID, "\p\024");
- appleMenuPtr->platformData =
- (TkMenuPlatformData) ckalloc(sizeof(MacMenu));
- ((MacMenu *)appleMenuPtr->platformData)->menuHdl
- = macMenuHdl;
- SetRect(&((MacMenu *) appleMenuPtr->platformData)->menuRect,
- 0, 0, 0, 0);
- appleMenuPtr->menuFlags |= MENU_APPLE_MENU;
- if (!(appleMenuPtr->menuFlags
- & MENU_RECONFIGURE_PENDING)) {
- appleMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
- (ClientData) appleMenuPtr);
- }
- InsertMenu(macMenuHdl, 0);
- RecursivelyInsertMenu(appleMenuPtr);
- currentAppleMenuID = appleID;
- }
- if (helpIndex == -1) {
- currentHelpMenuID = 0;
- }
-
- for (i = 0; i < menuBarPtr->numEntries; i++) {
- if (i == appleIndex) {
- if (menuBarPtr->entries[i]->state == ENTRY_DISABLED) {
- DisableItem(((MacMenu *) menuBarPtr->entries[i]
- ->childMenuRefPtr->menuPtr
- ->platformData)->menuHdl,
- 0);
- } else {
- EnableItem(((MacMenu *) menuBarPtr->entries[i]
- ->childMenuRefPtr->menuPtr
- ->platformData)->menuHdl,
- 0);
- }
- continue;
- } else if (i == helpIndex) {
- TkMenu *helpMenuPtr = menuBarPtr->entries[i]
- ->childMenuRefPtr->menuPtr;
- MenuHandle helpMenuHdl = NULL;
-
- if (helpMenuPtr == NULL) {
- continue;
- }
- helpMenuPtr->menuFlags |= MENU_HELP_MENU;
- if (!(helpMenuPtr->menuFlags
- & MENU_RECONFIGURE_PENDING)) {
- helpMenuPtr->menuFlags
- |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
- (ClientData) helpMenuPtr);
- }
- macMenuHdl =
- ((MacMenu *) helpMenuPtr->platformData)->menuHdl;
- currentHelpMenuID = (*macMenuHdl)->menuID;
- } else if (menuBarPtr->entries[i]->type
- == CASCADE_ENTRY) {
- if ((menuBarPtr->entries[i]->childMenuRefPtr != NULL)
- && menuBarPtr->entries[i]->childMenuRefPtr
- ->menuPtr != NULL) {
- cascadeMenuPtr = menuBarPtr->entries[i]
- ->childMenuRefPtr->menuPtr;
- macMenuHdl = ((MacMenu *) cascadeMenuPtr
- ->platformData)->menuHdl;
- DeleteMenu((*macMenuHdl)->menuID);
- InsertMenu(macMenuHdl, 0);
- RecursivelyInsertMenu(cascadeMenuPtr);
- if (menuBarPtr->entries[i]->state == ENTRY_DISABLED) {
- DisableItem(((MacMenu *) menuBarPtr->entries[i]
- ->childMenuRefPtr->menuPtr
- ->platformData)->menuHdl,
- 0);
- } else {
- EnableItem(((MacMenu *) menuBarPtr->entries[i]
- ->childMenuRefPtr->menuPtr
- ->platformData)->menuHdl,
- 0);
- }
- }
- }
- }
- }
- } else {
- SetDefaultMenubar();
- }
- DrawMenuBar();
- menuBarFlags &= ~MENUBAR_REDRAW_PENDING;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * RecursivelyInsertMenu --
- *
- * Puts all of the cascades of this menu in the Mac hierarchical list.
- *
- *
- * Results:
- * None.
- *
- * Side effects:
- * The menubar is changed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-RecursivelyInsertMenu(
- TkMenu *menuPtr) /* All of the cascade items in this menu
- * will be inserted into the mac menubar. */
-{
- int i;
- TkMenu *cascadeMenuPtr;
- MenuHandle macMenuHdl;
-
- for (i = 0; i < menuPtr->numEntries; i++) {
- if (menuPtr->entries[i]->type == CASCADE_ENTRY) {
- if ((menuPtr->entries[i]->childMenuRefPtr != NULL)
- && (menuPtr->entries[i]->childMenuRefPtr->menuPtr
- != NULL)) {
- cascadeMenuPtr = menuPtr->entries[i]->childMenuRefPtr->menuPtr;
- macMenuHdl =
- ((MacMenu *) cascadeMenuPtr->platformData)->menuHdl;
- InsertMenu(macMenuHdl, -1);
- RecursivelyInsertMenu(cascadeMenuPtr);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * RecursivelyDeleteMenu --
- *
- * Takes all of the cascades of this menu out of the Mac hierarchical
- * list.
- *
- *
- * Results:
- * None.
- *
- * Side effects:
- * The menubar is changed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-RecursivelyDeleteMenu(
- TkMenu *menuPtr) /* All of the cascade items in this menu
- * will be inserted into the mac menubar. */
-{
- int i;
- TkMenu *cascadeMenuPtr;
- MenuHandle macMenuHdl;
-
- for (i = 0; i < menuPtr->numEntries; i++) {
- if (menuPtr->entries[i]->type == CASCADE_ENTRY) {
- if ((menuPtr->entries[i]->childMenuRefPtr != NULL)
- && (menuPtr->entries[i]->childMenuRefPtr->menuPtr
- != NULL)) {
- cascadeMenuPtr = menuPtr->entries[i]->childMenuRefPtr->menuPtr;
- macMenuHdl =
- ((MacMenu *) cascadeMenuPtr->platformData)->menuHdl;
- DeleteMenu((*macMenuHdl)->menuID);
- RecursivelyInsertMenu(cascadeMenuPtr);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetDefaultMenubar --
- *
- * Puts the Apple, File and Edit menus into the Macintosh menubar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The menubar is changed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-SetDefaultMenubar()
-{
- if (currentMenuBarName != NULL) {
- ckfree(currentMenuBarName);
- currentMenuBarName = NULL;
- }
- currentMenuBarOwner = NULL;
- ClearMenuBar();
- InsertMenu(tkAppleMenu, 0);
- InsertMenu(tkFileMenu, 0);
- InsertMenu(tkEditMenu, 0);
- if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DrawMenuBarWhenIdle, (ClientData *) NULL);
- menuBarFlags |= MENUBAR_REDRAW_PENDING;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpSetMainMenubar --
- *
- * Puts the menu associated with a window into the menubar. Should
- * only be called when the window is in front.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The menubar is changed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpSetMainMenubar(
- Tcl_Interp *interp, /* The interpreter of the application */
- Tk_Window tkwin, /* The frame we are setting up */
- char *menuName) /* The name of the menu to put in front.
- * If NULL, use the default menu bar.
- */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- WindowRef macWindowPtr = (WindowRef) TkMacGetDrawablePort(winPtr->window);
- WindowRef frontNonFloating;
-
- if (TkMacHaveAppearance() >= 0x110) {
- frontNonFloating = FrontNonFloatingWindow();
- } else {
- frontNonFloating = FrontWindow();
- }
-
- if ((macWindowPtr == NULL) || (macWindowPtr != frontNonFloating)) {
- return;
- }
-
- if ((currentMenuBarInterp != interp)
- || (currentMenuBarOwner != tkwin)
- || (currentMenuBarName == NULL)
- || (menuName == NULL)
- || (strcmp(menuName, currentMenuBarName) != 0)) {
- Tk_Window searchWindow;
- TopLevelMenubarList *listPtr;
-
- if (currentMenuBarName != NULL) {
- ckfree(currentMenuBarName);
- }
-
- if (menuName == NULL) {
- searchWindow = tkwin;
- if (strcmp(Tk_Class(searchWindow), "Menu") == 0) {
- TkMenuReferences *menuRefPtr;
-
- menuRefPtr = TkFindMenuReferences(interp, Tk_PathName(tkwin));
- if (menuRefPtr != NULL) {
- TkMenu *menuPtr = menuRefPtr->menuPtr;
- if (menuPtr != NULL) {
- menuPtr = menuPtr->masterMenuPtr;
- searchWindow = menuPtr->tkwin;
- }
- }
- }
- for (; searchWindow != NULL;
- searchWindow = Tk_Parent(searchWindow)) {
-
- for (listPtr = windowListPtr; listPtr != NULL;
- listPtr = listPtr->nextPtr) {
- if (listPtr->tkwin == searchWindow) {
- break;
- }
- }
- if (listPtr != NULL) {
- menuName = Tk_PathName(listPtr->menuPtr->masterMenuPtr
- ->tkwin);
- break;
- }
- }
- }
-
- if (menuName == NULL) {
- currentMenuBarName = NULL;
- } else {
- currentMenuBarName = ckalloc(strlen(menuName) + 1);
- strcpy(currentMenuBarName, menuName);
- }
- currentMenuBarOwner = tkwin;
- currentMenuBarInterp = interp;
- }
- if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DrawMenuBarWhenIdle, (ClientData *) NULL);
- menuBarFlags |= MENUBAR_REDRAW_PENDING;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpSetWindowMenuBar --
- *
- * Associates a given menu with a window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * On Windows and UNIX, associates the platform menu with the
- * platform window.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpSetWindowMenuBar(
- Tk_Window tkwin, /* The window we are setting the menu in */
- TkMenu *menuPtr) /* The menu we are setting */
-{
- TopLevelMenubarList *listPtr, *prevPtr;
-
- /*
- * Remove any existing reference to this window.
- */
-
- for (prevPtr = NULL, listPtr = windowListPtr;
- listPtr != NULL;
- prevPtr = listPtr, listPtr = listPtr->nextPtr) {
- if (listPtr->tkwin == tkwin) {
- break;
- }
- }
-
- if (listPtr != NULL) {
- if (prevPtr != NULL) {
- prevPtr->nextPtr = listPtr->nextPtr;
- } else {
- windowListPtr = listPtr->nextPtr;
- }
- ckfree((char *) listPtr);
- }
-
- if (menuPtr != NULL) {
- listPtr = (TopLevelMenubarList *) ckalloc(sizeof(TopLevelMenubarList));
- listPtr->nextPtr = windowListPtr;
- windowListPtr = listPtr;
- listPtr->tkwin = tkwin;
- listPtr->menuPtr = menuPtr;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacDispatchMenuEvent --
- *
- * Given a menu id and an item, dispatches the command associated
- * with it.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands get executed.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacDispatchMenuEvent(
- int menuID, /* The menu id of the menu we are invoking */
- int index) /* The one-based index of the item that was
- * selected. */
-{
- int result = TCL_OK;
- if (menuID != 0) {
- if (menuID == kHMHelpMenuID) {
- if (currentMenuBarOwner != NULL) {
- TkMenuReferences *helpMenuRef;
- char *helpMenuName = ckalloc(strlen(currentMenuBarName)
- + strlen(".help") + 1);
- sprintf(helpMenuName, "%s.help", currentMenuBarName);
- helpMenuRef = TkFindMenuReferences(currentMenuBarInterp,
- helpMenuName);
- ckfree(helpMenuName);
- if ((helpMenuRef != NULL) && (helpMenuRef->menuPtr != NULL)) {
- int newIndex = index - helpItemCount - 1;
- result = TkInvokeMenu(currentMenuBarInterp,
- helpMenuRef->menuPtr, newIndex);
- }
- }
- } else {
- Tcl_HashEntry *commandEntryPtr =
- Tcl_FindHashEntry(&commandTable, (char *) menuID);
- TkMenu *menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
- if ((currentAppleMenuID == menuID)
- && (index > menuPtr->numEntries + 1)) {
- Str255 itemText;
-
- GetMenuItemText(GetMenuHandle(menuID), index, itemText);
- OpenDeskAcc(itemText);
- result = TCL_OK;
- } else {
- result = TkInvokeMenu(menuPtr->interp, menuPtr, index - 1);
- }
- }
- }
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetMenuIndicatorGeometry --
- *
- * Gets the width and height of the indicator area of a menu.
- *
- * Results:
- * widthPtr and heightPtr are set.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GetMenuIndicatorGeometry (
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* Precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* Precalculated font metrics */
- int *widthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
-{
- char markChar;
-
- *heightPtr = fmPtr->linespace;
-
- markChar = (char) FindMarkCharacter(mePtr);
- *widthPtr = Tk_TextWidth(tkfont, &markChar, 1) + 4;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetMenuAccelGeometry --
- *
- * Gets the width and height of the accelerator area of a menu.
- *
- * Results:
- * widthPtr and heightPtr are set.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GetMenuAccelGeometry (
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int *modWidthPtr, /* The width of all of the key
- * modifier symbols. */
- int *textWidthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
-{
- *heightPtr = fmPtr->linespace;
- *modWidthPtr = 0;
- if (mePtr->type == CASCADE_ENTRY) {
- *textWidthPtr = SICN_HEIGHT;
- *modWidthPtr = Tk_TextWidth(tkfont, "W", 1);
- } else if (0 == mePtr->accelLength) {
- *textWidthPtr = 0;
- } else {
- char *accel = (mePtr->accelPtr == NULL) ? ""
- : Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
-
- if (NULL == GetResource('SICN', SICN_RESOURCE_NUMBER)) {
- *textWidthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
- } else {
- int emWidth = Tk_TextWidth(tkfont, "W", 1) + 1;
- if ((mePtr->entryFlags & ENTRY_ACCEL_MASK) == 0) {
- int width = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
- *textWidthPtr = emWidth;
- if (width < emWidth) {
- *modWidthPtr = 0;
- } else {
- *modWidthPtr = width - emWidth;
- }
- } else {
- int length = ((EntryGeometry *)mePtr->platformEntryData)
- ->accelTextStart;
- if (mePtr->entryFlags & ENTRY_CONTROL_ACCEL) {
- *modWidthPtr += CONTROL_ICON_WIDTH;
- }
- if (mePtr->entryFlags & ENTRY_SHIFT_ACCEL) {
- *modWidthPtr += SHIFT_ICON_WIDTH;
- }
- if (mePtr->entryFlags & ENTRY_OPTION_ACCEL) {
- *modWidthPtr += OPTION_ICON_WIDTH;
- }
- if (mePtr->entryFlags & ENTRY_COMMAND_ACCEL) {
- *modWidthPtr += COMMAND_ICON_WIDTH;
- }
- if (1 == (mePtr->accelLength - length)) {
- *textWidthPtr = emWidth;
- } else {
- *textWidthPtr += Tk_TextWidth(tkfont, accel
- + length, mePtr->accelLength - length);
- }
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetTearoffEntryGeometry --
- *
- * Gets the width and height of of a tearoff entry.
- *
- * Results:
- * widthPtr and heightPtr are set.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GetTearoffEntryGeometry (
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int *widthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
-{
- if ((GetResource('MDEF', 591) == NULL) &&
- (menuPtr->menuType == MASTER_MENU)) {
- *heightPtr = fmPtr->linespace;
- *widthPtr = 0;
- } else {
- *widthPtr = *heightPtr = 0;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetMenuSeparatorGeometry --
- *
- * Gets the width and height of menu separator.
- *
- * Results:
- * widthPtr and heightPtr are set.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GetMenuSeparatorGeometry(
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalcualted font metrics */
- int *widthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
-{
- if (TkMacHaveAppearance() > 1) {
- SInt16 outHeight;
-
- GetThemeMenuSeparatorHeight(&outHeight);
- *widthPtr = 0;
- *heightPtr = outHeight;
- } else {
- *widthPtr = 0;
- *heightPtr = fmPtr->linespace;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawMenuEntryIndicator --
- *
- * This procedure draws the indicator part of a menu.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-DrawMenuEntryIndicator(
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
- Drawable d, /* The drawable we are drawing */
- GC gc, /* The GC we are drawing with */
- GC indicatorGC, /* The GC to use for the indicator */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int x, /* topleft hand corner of entry */
- int y, /* topleft hand corner of entry */
- int width, /* width of entry */
- int height) /* height of entry */
-{
- if ((mePtr->type == CHECK_BUTTON_ENTRY) ||
- (mePtr->type == RADIO_BUTTON_ENTRY)) {
- if (mePtr->indicatorOn
- && (mePtr->entryFlags & ENTRY_SELECTED)) {
- int baseline;
- short markShort;
-
- baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
- GetItemMark(((MacMenu *) menuPtr->platformData)->menuHdl,
- mePtr->index + 1, &markShort);
- if (markShort != 0) {
- char markChar;
- char markCharUTF[TCL_UTF_MAX + 1];
- int dstWrote;
-
- markChar = (char) markShort;
- Tcl_ExternalToUtf(NULL, NULL, &markChar, 1, 0, NULL,
- markCharUTF, TCL_UTF_MAX + 1, NULL, &dstWrote, NULL);
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, markCharUTF,
- dstWrote, x + 2, baseline);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawMenuBackground --
- *
- * If Appearance is present, draws the Appearance background
- *
- * Results:
- * Nothing
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-static void
-DrawMenuBackground(
- Rect *menuRectPtr, /* The menu rect */
- Drawable d, /* What we are drawing into */
- ThemeMenuType type /* Type of menu */
- )
-{
- if (!TkMacHaveAppearance()) {
- return;
- } else {
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(d);
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- TkMacSetUpClippingRgn(d);
- DrawThemeMenuBackground (menuRectPtr, type);
- SetGWorld(saveWorld, saveDevice);
- return;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawSICN --
- *
- * Given a resource id and an index, loads the appropriate SICN
- * and draws it into a given drawable using the given gc.
- *
- * Results:
- * Returns 1 if the SICN was found, 0 if not found.
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-static int
-DrawSICN(
- int resourceID, /* The resource # of the SICN table */
- int index, /* The index into the SICN table of the
- * icon we want. */
- Drawable d, /* What we are drawing into */
- GC gc, /* The GC to draw with */
- int x, /* The left hand coord of the SICN */
- int y) /* The top coord of the SICN */
-{
- Handle sicnHandle = (Handle) GetResource('SICN', SICN_RESOURCE_NUMBER);
-
- if (NULL == sicnHandle) {
- return 0;
- } else {
- BitMap sicnBitmap;
- Rect destRect;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- BitMapPtr destBitMap;
- RGBColor origForeColor, origBackColor, foreColor, backColor;
-
- HLock(sicnHandle);
- destPort = TkMacGetDrawablePort(d);
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- TkMacSetUpClippingRgn(d);
- TkMacSetUpGraphicsPort(gc);
- GetForeColor(&origForeColor);
- GetBackColor(&origBackColor);
-
- if (TkSetMacColor(gc->foreground, &foreColor)) {
- RGBForeColor(&foreColor);
- }
-
- if (TkSetMacColor(gc->background, &backColor)) {
- RGBBackColor(&backColor);
- }
-
- SetRect(&destRect, x, y, x + SICN_HEIGHT, y + SICN_HEIGHT);
- sicnBitmap.baseAddr = (Ptr) (*sicnHandle) + index * SICN_HEIGHT
- * SICN_ROWS;
- sicnBitmap.rowBytes = SICN_ROWS;
- SetRect(&sicnBitmap.bounds, 0, 0, 16, 16);
- destBitMap = &((GrafPtr) destPort)->portBits;
- CopyBits(&sicnBitmap, destBitMap, &sicnBitmap.bounds, &destRect,
- destPort->txMode, NULL);
- HUnlock(sicnHandle);
- RGBForeColor(&origForeColor);
- RGBBackColor(&origBackColor);
- SetGWorld(saveWorld, saveDevice);
- return 1;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawMenuEntryAccelerator --
- *
- * This procedure draws the accelerator part of a menu. We
- * need to decide what to draw here. Should we replace strings
- * like "Control", "Command", etc?
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-DrawMenuEntryAccelerator(
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
- Drawable d, /* The drawable we are drawing in */
- GC gc, /* The gc to draw into */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- Tk_3DBorder activeBorder, /* border for menu background */
- int x, /* The left side of the entry */
- int y, /* The top of the entry */
- int width, /* The width of the entry */
- int height, /* The height of the entry */
- int drawArrow) /* Whether or not to draw cascade arrow */
-{
- int activeBorderWidth;
-
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
- &activeBorderWidth);
- if (mePtr->type == CASCADE_ENTRY) {
- /*
- * Under Appearance, we let the Appearance Manager draw the icon
- */
-
- if (!TkMacHaveAppearance()) {
- if (0 == DrawSICN(SICN_RESOURCE_NUMBER, CASCADE_ARROW, d, gc,
- x + width - SICN_HEIGHT, (y + (height / 2))
- - (SICN_HEIGHT / 2))) {
- XPoint points[3];
- Tk_Window tkwin = menuPtr->tkwin;
-
- if (mePtr->type == CASCADE_ENTRY) {
- points[0].x = width - activeBorderWidth
- - MAC_MARGIN_WIDTH - CASCADE_ARROW_WIDTH;
- points[0].y = y + (height - CASCADE_ARROW_HEIGHT)/2;
- points[1].x = points[0].x;
- points[1].y = points[0].y + CASCADE_ARROW_HEIGHT;
- points[2].x = points[0].x + CASCADE_ARROW_WIDTH;
- points[2].y = points[0].y + CASCADE_ARROW_HEIGHT/2;
- Tk_Fill3DPolygon(menuPtr->tkwin, d, activeBorder, points,
- 3, DECORATION_BORDER_WIDTH, TK_RELIEF_FLAT);
- }
- }
- }
- } else if (mePtr->accelLength != 0) {
- int leftEdge = x + width;
- int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
- char *accel;
-
- accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
-
- if (NULL == GetResource('SICN', SICN_RESOURCE_NUMBER)) {
- leftEdge -= ((EntryGeometry *) mePtr->platformEntryData)
- ->accelTextWidth;
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
- mePtr->accelLength, leftEdge, baseline);
- } else {
- EntryGeometry *geometryPtr =
- (EntryGeometry *) mePtr->platformEntryData;
- int length = mePtr->accelLength - geometryPtr->accelTextStart;
-
- leftEdge -= geometryPtr->accelTextWidth;
- if ((mePtr->entryFlags & ENTRY_ACCEL_MASK) == 0) {
- leftEdge -= geometryPtr->modifierWidth;
- }
-
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel
- + geometryPtr->accelTextStart, length, leftEdge, baseline);
-
- if (mePtr->entryFlags & ENTRY_COMMAND_ACCEL) {
- leftEdge -= COMMAND_ICON_WIDTH;
- DrawSICN(SICN_RESOURCE_NUMBER, COMMAND_ICON, d, gc,
- leftEdge, (y + (height / 2)) - (SICN_HEIGHT / 2) - 1);
- }
-
- if (mePtr->entryFlags & ENTRY_OPTION_ACCEL) {
- leftEdge -= OPTION_ICON_WIDTH;
- DrawSICN(SICN_RESOURCE_NUMBER, OPTION_ICON, d, gc,
- leftEdge, (y + (height / 2)) - (SICN_HEIGHT / 2) - 1);
- }
-
- if (mePtr->entryFlags & ENTRY_SHIFT_ACCEL) {
- leftEdge -= SHIFT_ICON_WIDTH;
- DrawSICN(SICN_RESOURCE_NUMBER, SHIFT_ICON, d, gc,
- leftEdge, (y + (height / 2)) - (SICN_HEIGHT / 2) - 1);
- }
-
- if (mePtr->entryFlags & ENTRY_CONTROL_ACCEL) {
- leftEdge -= CONTROL_ICON_WIDTH;
- DrawSICN(SICN_RESOURCE_NUMBER, CONTROL_ICON, d, gc,
- leftEdge, (y + (height / 2)) - (SICN_HEIGHT / 2) - 1);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawMenuSeparator --
- *
- * The menu separator is drawn.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-DrawMenuSeparator(
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
- Drawable d, /* The drawable we are drawing into */
- GC gc, /* The gc we are drawing with */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int x, /* left coordinate of entry */
- int y, /* top coordinate of entry */
- int width, /* width of entry */
- int height) /* height of entry */
-{
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(d);
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- TkMacSetUpClippingRgn(d);
- if (TkMacHaveAppearance() > 1) {
- Rect r;
- r.top = y;
- r.left = x;
- r.bottom = y + height;
- r.right = x + width;
-
- DrawThemeMenuSeparator(&r);
- } else {
- /*
- * We don't want to use the text GC for drawing the separator. It
- * needs to be the same color as disabled items.
- */
-
- TkMacSetUpGraphicsPort(mePtr->disabledGC != None ? mePtr->disabledGC
- : menuPtr->disabledGC);
-
- MoveTo(x, y + (height / 2));
- Line(width, 0);
-
- SetGWorld(saveWorld, saveDevice);
-}
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MenuDefProc --
- *
- * This routine is the MDEF handler for Tk. It receives all messages
- * for the menu and dispatches them.
- *
- * Results:
- * None.
- *
- * Side effects:
- * This routine causes menus to be drawn and will certainly allocate
- * memory as a result. Also, the menu can scroll up and down, and
- * various other interface actions can take place.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-MenuDefProc(
- short message, /* What action are we taking? */
- MenuHandle menu, /* The menu we are working with */
- Rect *menuRectPtr, /* A pointer to the rect for the
- * whole menu. */
- Point hitPt, /* Where the mouse was clicked for
- * the appropriate messages. */
- short *whichItem, /* Output result. Which item was
- * hit by the user? */
- TkMenuLowMemGlobals *globalsPtr) /* The low mem globals we have
- * to change */
-{
-#define SCREEN_MARGIN 5
- TkMenu *menuPtr;
- TkMenuEntry *parentEntryPtr;
- Tcl_HashEntry *commandEntryPtr;
- GrafPtr windowMgrPort;
- Tk_Font tkfont, menuFont;
- Tk_FontMetrics fontMetrics, entryMetrics;
- Tk_FontMetrics *fmPtr;
- TkMenuEntry *mePtr;
- int i;
- int maxMenuHeight;
- int oldItem;
- int newItem = -1;
- GDHandle device;
- Rect itemRect;
- short windowPart;
- WindowRef whichWindow;
- RGBColor bgColor;
- RGBColor fgColor;
- RGBColor origFgColor;
- PenState origPenState;
- Rect dragRect;
- Rect scratchRect = {-32768, -32768, 32767, 32767};
- RgnHandle oldClipRgn;
- TkMenuReferences *menuRefPtr;
- TkMenu *searchMenuPtr;
- Rect menuClipRect;
-
- HLock((Handle) menu);
- commandEntryPtr = Tcl_FindHashEntry(&commandTable,
- (char *) (*menu)->menuID);
- HUnlock((Handle) menu);
- menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
-
- switch (message) {
- case mSizeMsg:
- GetWMgrPort(&windowMgrPort);
- maxMenuHeight = windowMgrPort->portRect.bottom
- - windowMgrPort->portRect.top
- - GetMBarHeight() - SCREEN_MARGIN;
- (*menu)->menuWidth = menuPtr->totalWidth;
- (*menu)->menuHeight = maxMenuHeight < menuPtr->totalHeight ?
- maxMenuHeight : menuPtr->totalHeight;
- break;
-
- case mDrawMsg:
-
- /*
- * Store away the menu rectangle so we can keep track of the
- * different regions that the menu obscures.
- */
-
- ((MacMenu *) menuPtr->platformData)->menuRect = *menuRectPtr;
- if (tkMenuCascadeRgn == NULL) {
- tkMenuCascadeRgn = NewRgn();
- }
- if (utilRgn == NULL) {
- utilRgn = NewRgn();
- }
- if (totalMenuRgn == NULL) {
- totalMenuRgn = NewRgn();
- }
- SetEmptyRgn(tkMenuCascadeRgn);
- for (searchMenuPtr = menuPtr; searchMenuPtr != NULL; ) {
- RectRgn(utilRgn,
- &((MacMenu *) searchMenuPtr->platformData)->menuRect);
- InsetRgn(utilRgn, -1, -1);
- UnionRgn(tkMenuCascadeRgn, utilRgn, tkMenuCascadeRgn);
- OffsetRgn(utilRgn, 1, 1);
- UnionRgn(tkMenuCascadeRgn, utilRgn, tkMenuCascadeRgn);
-
- if (searchMenuPtr->menuRefPtr->parentEntryPtr != NULL) {
- searchMenuPtr = searchMenuPtr->menuRefPtr
- ->parentEntryPtr->menuPtr;
- } else {
- break;
- }
- if (searchMenuPtr->menuType == MENUBAR) {
- break;
- }
- }
- UnionRgn(totalMenuRgn, tkMenuCascadeRgn, totalMenuRgn);
- SetEmptyRgn(utilRgn);
-
- /*
- * Now draw the background if Appearance is present...
- */
-
- GetGWorld(&macMDEFDrawable.portPtr, &device);
- if (TkMacHaveAppearance() > 1) {
- ThemeMenuType menuType;
-
- if (menuPtr->menuRefPtr->topLevelListPtr != NULL) {
- menuType = kThemeMenuTypePullDown;
- } else if (menuPtr->menuRefPtr->parentEntryPtr != NULL) {
- menuType = kThemeMenuTypeHierarchical;
- } else {
- menuType = kThemeMenuTypePopUp;
- }
-
- DrawMenuBackground(menuRectPtr, (Drawable) &macMDEFDrawable,
- menuType);
- }
-
- /*
- * Next, figure out scrolling information.
- */
-
- menuClipRect = *menuRectPtr;
- if ((menuClipRect.bottom - menuClipRect.top)
- < menuPtr->totalHeight) {
- if (globalsPtr->menuTop < menuRectPtr->top) {
- DrawSICN(SICN_RESOURCE_NUMBER, UP_ARROW,
- (Drawable) &macMDEFDrawable,
- menuPtr->textGC,
- menuRectPtr->left
- + menuPtr->entries[1]->indicatorSpace,
- menuRectPtr->top);
- menuClipRect.top += SICN_HEIGHT;
- }
- if ((globalsPtr->menuTop + menuPtr->totalHeight)
- > menuRectPtr->bottom) {
- DrawSICN(SICN_RESOURCE_NUMBER, DOWN_ARROW,
- (Drawable) &macMDEFDrawable,
- menuPtr->textGC,
- menuRectPtr->left
- + menuPtr->entries[1]->indicatorSpace,
- menuRectPtr->bottom - SICN_HEIGHT);
- menuClipRect.bottom -= SICN_HEIGHT;
- }
- GetClip(utilRgn);
- }
-
- /*
- * Now, actually draw the menu. Don't draw entries that
- * are higher than the top arrow, and don't draw entries
- * that are lower than the bottom.
- */
-
- menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
- Tk_GetFontMetrics(menuFont, &fontMetrics);
- for (i = 0; i < menuPtr->numEntries; i++) {
- mePtr = menuPtr->entries[i];
- if (globalsPtr->menuTop + mePtr->y + mePtr->height
- < menuClipRect.top) {
- continue;
- } else if (globalsPtr->menuTop + mePtr->y
- > menuClipRect.bottom) {
- continue;
- }
- /* ClipRect(&menuClipRect); */
- if (mePtr->fontPtr == NULL) {
- fmPtr = &fontMetrics;
- tkfont = menuFont;
- } else {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
- Tk_GetFontMetrics(tkfont, &entryMetrics);
- fmPtr = &entryMetrics;
- }
- AppearanceEntryDrawWrapper(mePtr, menuRectPtr, globalsPtr,
- (Drawable) &macMDEFDrawable, fmPtr, tkfont,
- menuRectPtr->left + mePtr->x,
- globalsPtr->menuTop + mePtr->y,
- (mePtr->entryFlags & ENTRY_LAST_COLUMN) ?
- menuPtr->totalWidth - mePtr->x : mePtr->width,
- menuPtr->entries[i]->height);
- }
- globalsPtr->menuBottom = globalsPtr->menuTop
- + menuPtr->totalHeight;
- if (!EmptyRgn(utilRgn)) {
- SetClip(utilRgn);
- SetEmptyRgn(utilRgn);
- }
- MDEFScrollFlag = 1;
- break;
-
- case mChooseMsg: {
- int hasTopScroll, hasBottomScroll;
- enum {
- DONT_SCROLL, DOWN_SCROLL, UP_SCROLL
- } scrollDirection;
- Rect updateRect;
- short scrollAmt;
- RGBColor origForeColor, origBackColor, foreColor, backColor;
-
- GetGWorld(&macMDEFDrawable.portPtr, &device);
- GetForeColor(&origForeColor);
- GetBackColor(&origBackColor);
-
- if (TkSetMacColor(menuPtr->textGC->foreground,
- &foreColor)) {
- /* if (!TkMacHaveAppearance()) { */
- RGBForeColor(&foreColor);
- /* } */
- }
- if (TkSetMacColor(menuPtr->textGC->background,
- &backColor)) {
- /* if (!TkMacHaveAppearance()) { */
- RGBBackColor(&backColor);
- /* } */
- }
-
- /*
- * Find out which item was hit. If it is the same as the old item,
- * we don't need to do anything.
- */
-
- oldItem = *whichItem - 1;
-
- if (PtInRect(hitPt, menuRectPtr)) {
- for (i = 0; i < menuPtr->numEntries; i++) {
- mePtr = menuPtr->entries[i];
- itemRect.left = menuRectPtr->left + mePtr->x;
- itemRect.top = globalsPtr->menuTop + mePtr->y;
- if (mePtr->entryFlags & ENTRY_LAST_COLUMN) {
- itemRect.right = itemRect.left + menuPtr->totalWidth
- - mePtr->x;
- } else {
- itemRect.right = itemRect.left + mePtr->width;
- }
- itemRect.bottom = itemRect.top
- + menuPtr->entries[i]->height;
- if (PtInRect(hitPt, &itemRect)) {
- if ((mePtr->type == SEPARATOR_ENTRY)
- || (mePtr->state == ENTRY_DISABLED)) {
- newItem = -1;
- } else {
- TkMenuEntry *cascadeEntryPtr;
- int parentDisabled = 0;
-
- for (cascadeEntryPtr
- = menuPtr->menuRefPtr->parentEntryPtr;
- cascadeEntryPtr != NULL;
- cascadeEntryPtr
- = cascadeEntryPtr->nextCascadePtr) {
- char *name;
-
- name = Tcl_GetStringFromObj(
- cascadeEntryPtr->namePtr, NULL);
- if (strcmp(name, Tk_PathName(menuPtr->tkwin))
- == 0) {
- if (cascadeEntryPtr->state == ENTRY_DISABLED) {
- parentDisabled = 1;
- }
- break;
- }
- }
- if (parentDisabled) {
- newItem = -1;
- } else {
- newItem = i;
- if ((mePtr->type == CASCADE_ENTRY)
- && (oldItem != newItem)) {
- globalsPtr->itemRect = itemRect;
- }
- }
- }
- break;
- }
- }
- }
-
- /*
- * Now we need to take care of scrolling the menu.
- */
-
- hasTopScroll = globalsPtr->menuTop < menuRectPtr->top;
- hasBottomScroll = globalsPtr->menuBottom > menuRectPtr->bottom;
- scrollDirection = DONT_SCROLL;
- if (hasTopScroll
- && (hitPt.v < menuRectPtr->top + SICN_HEIGHT)) {
- newItem = -1;
- scrollDirection = DOWN_SCROLL;
- } else if (hasBottomScroll
- && (hitPt.v > menuRectPtr->bottom - SICN_HEIGHT)) {
- newItem = -1;
- scrollDirection = UP_SCROLL;
- }
- menuClipRect = *menuRectPtr;
- if (hasTopScroll) {
- menuClipRect.top += SICN_HEIGHT;
- }
- if (hasBottomScroll) {
- menuClipRect.bottom -= SICN_HEIGHT;
- }
- if (MDEFScrollFlag) {
- scrollDirection = DONT_SCROLL;
- MDEFScrollFlag = 0;
- }
- GetClip(utilRgn);
- ClipRect(&menuClipRect);
-
- if (oldItem != newItem) {
- if (oldItem >= 0) {
- mePtr = menuPtr->entries[oldItem];
- if (mePtr->fontPtr == NULL) {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin,
- menuPtr->fontPtr);
- } else {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin,
- mePtr->fontPtr);
- }
- Tk_GetFontMetrics(tkfont, &fontMetrics);
- AppearanceEntryDrawWrapper(mePtr, menuRectPtr, globalsPtr,
- (Drawable) &macMDEFDrawable, &fontMetrics, tkfont,
- menuRectPtr->left + mePtr->x,
- globalsPtr->menuTop + mePtr->y,
- (mePtr->entryFlags & ENTRY_LAST_COLUMN) ?
- menuPtr->totalWidth - mePtr->x : mePtr->width,
- mePtr->height);
- }
- if (newItem != -1) {
- int oldActiveItem = menuPtr->active;
-
- mePtr = menuPtr->entries[newItem];
- if (mePtr->state != ENTRY_DISABLED) {
- TkActivateMenuEntry(menuPtr, newItem);
- }
- if (mePtr->fontPtr == NULL) {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin,
- menuPtr->fontPtr);
- } else {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin,
- mePtr->fontPtr);
- }
- Tk_GetFontMetrics(tkfont, &fontMetrics);
- AppearanceEntryDrawWrapper(mePtr, menuRectPtr, globalsPtr,
- (Drawable) &macMDEFDrawable, &fontMetrics, tkfont,
- menuRectPtr->left + mePtr->x,
- globalsPtr->menuTop + mePtr->y,
- (mePtr->entryFlags & ENTRY_LAST_COLUMN) ?
- menuPtr->totalWidth - mePtr->x : mePtr->width,
- mePtr->height);
- }
-
- tkUseMenuCascadeRgn = 1;
- MenuSelectEvent(menuPtr);
- Tcl_ServiceAll();
- tkUseMenuCascadeRgn = 0;
- if (mePtr->state != ENTRY_DISABLED) {
- TkActivateMenuEntry(menuPtr, -1);
- }
- *whichItem = newItem + 1;
- }
- globalsPtr->menuDisable = ((*menu)->menuID << 16) | (newItem + 1);
-
- if (scrollDirection == UP_SCROLL) {
- scrollAmt = menuClipRect.bottom - hitPt.v;
- if (scrollAmt < menuRectPtr->bottom
- - globalsPtr->menuBottom) {
- scrollAmt = menuRectPtr->bottom - globalsPtr->menuBottom;
- }
- if (!hasTopScroll && ((globalsPtr->menuTop + scrollAmt)
- < menuRectPtr->top)) {
- SetRect(&updateRect, menuRectPtr->left,
- globalsPtr->menuTop, menuRectPtr->right,
- globalsPtr->menuTop + SICN_HEIGHT);
- EraseRect(&updateRect);
- DrawSICN(SICN_RESOURCE_NUMBER, UP_ARROW,
- (Drawable) &macMDEFDrawable,
- menuPtr->textGC, menuRectPtr->left
- + menuPtr->entries[1]->indicatorSpace,
- menuRectPtr->top);
- menuClipRect.top += SICN_HEIGHT;
- }
- } else if (scrollDirection == DOWN_SCROLL) {
- scrollAmt = menuClipRect.top - hitPt.v;
- if (scrollAmt > menuRectPtr->top - globalsPtr->menuTop) {
- scrollAmt = menuRectPtr->top - globalsPtr->menuTop;
- }
- if (!hasBottomScroll && ((globalsPtr->menuBottom + scrollAmt)
- > menuRectPtr->bottom)) {
- SetRect(&updateRect, menuRectPtr->left,
- globalsPtr->menuBottom - SICN_HEIGHT,
- menuRectPtr->right, globalsPtr->menuBottom);
- EraseRect(&updateRect);
- DrawSICN(SICN_RESOURCE_NUMBER, DOWN_ARROW,
- (Drawable) &macMDEFDrawable,
- menuPtr->textGC, menuRectPtr->left
- + menuPtr->entries[1]->indicatorSpace,
- menuRectPtr->bottom - SICN_HEIGHT);
- menuClipRect.bottom -= SICN_HEIGHT;
- }
- }
- if (scrollDirection != DONT_SCROLL) {
- Tk_Font menuFont;
- RgnHandle updateRgn = NewRgn();
- ScrollRect(&menuClipRect, 0, scrollAmt, updateRgn);
- updateRect = (*updateRgn)->rgnBBox;
- DisposeRgn(updateRgn);
- globalsPtr->menuTop += scrollAmt;
- globalsPtr->menuBottom += scrollAmt;
- if (globalsPtr->menuTop == menuRectPtr->top) {
- updateRect.top -= SICN_HEIGHT;
- }
- if (globalsPtr->menuBottom == menuRectPtr->bottom) {
- updateRect.bottom += SICN_HEIGHT;
- }
- ClipRect(&updateRect);
- EraseRect(&updateRect);
- menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
- Tk_GetFontMetrics(menuFont, &fontMetrics);
- for (i = 0; i < menuPtr->numEntries; i++) {
- mePtr = menuPtr->entries[i];
- if (globalsPtr->menuTop + mePtr->y + mePtr->height
- < updateRect.top) {
- continue;
- } else if (globalsPtr->menuTop + mePtr->y
- > updateRect.bottom) {
- continue;
- }
- if (mePtr->fontPtr == NULL) {
- fmPtr = &fontMetrics;
- tkfont = menuFont;
- } else {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin,
- mePtr->fontPtr);
- Tk_GetFontMetrics(tkfont, &entryMetrics);
- fmPtr = &entryMetrics;
- }
- AppearanceEntryDrawWrapper(mePtr, menuRectPtr, globalsPtr,
- (Drawable) &macMDEFDrawable, fmPtr, tkfont,
- menuRectPtr->left + mePtr->x,
- globalsPtr->menuTop + mePtr->y,
- (mePtr->entryFlags & ENTRY_LAST_COLUMN) ?
- menuPtr->totalWidth - mePtr->x : mePtr->width,
- menuPtr->entries[i]->height);
- }
- }
-
- SetClip(utilRgn);
- SetEmptyRgn(utilRgn);
- RGBForeColor(&origForeColor);
- RGBBackColor(&origBackColor);
-
- /*
- * If the menu is a tearoff, and the mouse is outside the menu,
- * we need to draw the drag rectangle.
- *
- * In order for tearoffs to work properly, we need to set
- * the active member of the containing menubar.
- */
-
- menuRefPtr = TkFindMenuReferences(menuPtr->interp,
- Tk_PathName(menuPtr->tkwin));
- if ((menuRefPtr != NULL) && (menuRefPtr->parentEntryPtr != NULL)) {
- char *name;
- for (parentEntryPtr = menuRefPtr->parentEntryPtr;
- parentEntryPtr != NULL
- ; parentEntryPtr = parentEntryPtr->nextCascadePtr) {
- name = Tcl_GetStringFromObj(parentEntryPtr->namePtr,
- NULL);
- if (strcmp(name, Tk_PathName(menuPtr->tkwin)) != 0) {
- break;
- }
- }
- if (parentEntryPtr != NULL) {
- TkActivateMenuEntry(parentEntryPtr->menuPtr,
- parentEntryPtr->index);
- }
- }
-
- if (menuPtr->tearoff) {
- scratchRect = *menuRectPtr;
- if (tearoffStruct.menuPtr == NULL) {
- scratchRect.top -= 10;
- scratchRect.bottom += 10;
- scratchRect.left -= 10;
- scratchRect.right += 10;
- }
-
- windowPart = FindWindow(hitPt, &whichWindow);
- if ((windowPart != inMenuBar) && (newItem == -1)
- && (hitPt.v != 0) && (hitPt.h != 0)
- && (!PtInRect(hitPt, &scratchRect))
- && (!PtInRect(hitPt, &tearoffStruct.excludeRect))) {
-/*
- * This is the second argument to the Toolbox Delay function. It changed
- * from long to unsigned long between Universal Headers 2.0 & 3.0
- */
-#if !defined(UNIVERSAL_INTERFACES_VERSION) || (UNIVERSAL_INTERFACES_VERSION < 0x0300)
- long dummy;
-#else
- unsigned long dummy;
-#endif
- oldClipRgn = NewRgn();
- GetClip(oldClipRgn);
- GetForeColor(&origFgColor);
- GetPenState(&origPenState);
- GetForeColor(&fgColor);
- GetBackColor(&bgColor);
- GetGray(device, &bgColor, &fgColor);
- RGBForeColor(&fgColor);
- SetRect(&scratchRect, -32768, -32768, 32767, 32767);
- ClipRect(&scratchRect);
-
- dragRect = *menuRectPtr;
- tearoffStruct.menuPtr = menuPtr;
-
- PenMode(srcXor);
- dragRect = *menuRectPtr;
- OffsetRect(&dragRect, -dragRect.left, -dragRect.top);
- OffsetRect(&dragRect, tearoffStruct.point.h,
- tearoffStruct.point.v);
- if ((dragRect.top != 0) && (dragRect.left != 0)) {
- FrameRect(&dragRect);
- Delay(1, &dummy);
- FrameRect(&dragRect);
- }
- tearoffStruct.point = hitPt;
-
- SetClip(oldClipRgn);
- DisposeRgn(oldClipRgn);
- RGBForeColor(&origFgColor);
- SetPenState(&origPenState);
- } else {
- tearoffStruct.menuPtr = NULL;
- tearoffStruct.point.h = tearoffStruct.point.v = 0;
- }
- } else {
- tearoffStruct.menuPtr = NULL;
- tearoffStruct.point.h = tearoffStruct.point.v = 0;
- }
-
- break;
- }
-
- case mPopUpMsg:
-
- /*
- * Note that for some oddball reason, h and v are reversed in the
- * point given to us by the MDEF.
- */
-
- oldItem = *whichItem;
- if (oldItem >= menuPtr->numEntries) {
- oldItem = -1;
- }
- GetWMgrPort(&windowMgrPort);
- maxMenuHeight = windowMgrPort->portRect.bottom
- - windowMgrPort->portRect.top
- - GetMBarHeight() - SCREEN_MARGIN;
- if (menuPtr->totalHeight > maxMenuHeight) {
- menuRectPtr->top = GetMBarHeight();
- } else {
- int delta;
- menuRectPtr->top = hitPt.h;
- if (oldItem >= 0) {
- menuRectPtr->top -= menuPtr->entries[oldItem]->y;
- }
-
- if (menuRectPtr->top < GetMBarHeight()) {
- /* Displace downward if the menu would stick off the
- * top of the screen.
- */
-
- menuRectPtr->top = GetMBarHeight() + SCREEN_MARGIN;
- } else {
- /*
- * Or upward if the menu sticks off the
- * bottom end...
- */
-
- delta = menuRectPtr->top + menuPtr->totalHeight
- - maxMenuHeight;
- if (delta > 0) {
- menuRectPtr->top -= delta;
- }
- }
- }
- menuRectPtr->left = hitPt.v;
- menuRectPtr->right = menuRectPtr->left + menuPtr->totalWidth;
- menuRectPtr->bottom = menuRectPtr->top +
- ((maxMenuHeight < menuPtr->totalHeight)
- ? maxMenuHeight : menuPtr->totalHeight);
- if (menuRectPtr->top == GetMBarHeight()) {
- *whichItem = hitPt.h;
- } else {
- *whichItem = menuRectPtr->top;
- }
- globalsPtr->menuTop = *whichItem;
- globalsPtr->menuBottom = menuRectPtr->bottom;
- break;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AppearanceEntryDrawWrapper --
- *
- * This routine wraps the TkpDrawMenuEntry function. Under Appearance,
- * it routes to the Appearance Managers DrawThemeEntry, otherwise it
- * just goes straight to TkpDrawMenuEntry.
- *
- * Results:
- * A menu entry is drawn
- *
- * Side effects:
- * None
- *
- *----------------------------------------------------------------------
- */
-static void
-AppearanceEntryDrawWrapper(
- TkMenuEntry *mePtr,
- Rect *menuRectPtr,
- TkMenuLowMemGlobals *globalsPtr,
- Drawable d,
- Tk_FontMetrics *fmPtr,
- Tk_Font tkfont,
- int x,
- int y,
- int width,
- int height)
-{
- if (TkMacHaveAppearance() > 1) {
- MenuEntryUserData meData;
- Rect itemRect;
- ThemeMenuState theState;
- ThemeMenuItemType theType;
-
- meData.mePtr = mePtr;
- meData.mdefDrawable = d;
- meData.fmPtr = fmPtr;
- meData.tkfont = tkfont;
-
- itemRect.top = y;
- itemRect.left = x;
- itemRect.bottom = itemRect.top + height;
- itemRect.right = itemRect.left + width;
-
- if (mePtr->state == ENTRY_ACTIVE) {
- theState = kThemeMenuSelected;
- } else if (mePtr->state == ENTRY_DISABLED) {
- theState = kThemeMenuDisabled;
- } else {
- theState = kThemeMenuActive;
- }
-
- if (mePtr->type == CASCADE_ENTRY) {
- theType = kThemeMenuItemHierarchical;
- } else {
- theType = kThemeMenuItemPlain;
- }
-
- DrawThemeMenuItem (menuRectPtr, &itemRect,
- globalsPtr->menuTop, globalsPtr->menuBottom, theState,
- theType, tkThemeMenuItemDrawingUPP,
- (unsigned long) &meData);
-
- } else {
- TkpDrawMenuEntry(mePtr, d, tkfont, fmPtr,
- x, y, width, height, 0, 1);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * tkThemeMenuItemDrawingProc --
- *
- * This routine is called from the Appearance DrawThemeMenuEntry
- *
- * Results:
- * A menu entry is drawn
- *
- * Side effects:
- * None
- *
- *----------------------------------------------------------------------
- */
-pascal void
-tkThemeMenuItemDrawingProc (
- const Rect *inBounds,
- SInt16 inDepth,
- Boolean inIsColorDevice,
- SInt32 inUserData)
-{
- MenuEntryUserData *meData = (MenuEntryUserData *) inUserData;
-
- TkpDrawMenuEntry(meData->mePtr, meData->mdefDrawable,
- meData->tkfont, meData->fmPtr, inBounds->left,
- inBounds->top, inBounds->right - inBounds->left,
- inBounds->bottom - inBounds->top, 0, 1);
-
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacHandleTearoffMenu() --
- *
- * This routine sees if the MDEF has set a menu and a mouse position
- * for tearing off and makes a tearoff menu if it has.
- *
- * Results:
- * menuPtr->interp will have the result of the tearoff command.
- *
- * Side effects:
- * A new tearoff menu is created if it is supposed to be.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacHandleTearoffMenu(void)
-{
- if (tearoffStruct.menuPtr != NULL) {
- Tcl_DString tearoffCmdStr;
- char intString[TCL_INTEGER_SPACE];
- short windowPart;
- WindowRef whichWindow;
-
- windowPart = FindWindow(tearoffStruct.point, &whichWindow);
-
- if (windowPart != inMenuBar) {
- Tcl_DStringInit(&tearoffCmdStr);
- Tcl_DStringAppendElement(&tearoffCmdStr, "tk::TearOffMenu");
- Tcl_DStringAppendElement(&tearoffCmdStr,
- Tk_PathName(tearoffStruct.menuPtr->tkwin));
- sprintf(intString, "%d", tearoffStruct.point.h);
- Tcl_DStringAppendElement(&tearoffCmdStr, intString);
- sprintf(intString, "%d", tearoffStruct.point.v);
- Tcl_DStringAppendElement(&tearoffCmdStr, intString);
- Tcl_Eval(tearoffStruct.menuPtr->interp,
- Tcl_DStringValue(&tearoffCmdStr));
- Tcl_DStringFree(&tearoffCmdStr);
- tearoffStruct.menuPtr = NULL;
- }
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkpInitializeMenuBindings --
- *
- * For every interp, initializes the bindings for Windows
- * menus. Does nothing on Mac or XWindows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * C-level bindings are setup for the interp which will
- * handle Alt-key sequences for menus without beeping
- * or interfering with user-defined Alt-key bindings.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkpInitializeMenuBindings(interp, bindingTable)
- Tcl_Interp *interp; /* The interpreter to set. */
- Tk_BindingTable bindingTable; /* The table to add to. */
-{
- /*
- * Nothing to do.
- */
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkpComputeMenubarGeometry --
- *
- * This procedure is invoked to recompute the size and
- * layout of a menu that is a menubar clone.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkpComputeMenubarGeometry(menuPtr)
- TkMenu *menuPtr; /* Structure describing menu. */
-{
- TkpComputeStandardMenuGeometry(menuPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawTearoffEntry --
- *
- * This procedure draws the background part of a menu.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-
-void
-DrawTearoffEntry(
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
- Drawable d, /* The drawable we are drawing into */
- GC gc, /* The gc we are drawing with */
- Tk_Font tkfont, /* The font we are drawing with */
- CONST Tk_FontMetrics *fmPtr, /* The metrics we are drawing with */
- int x, /* Left edge of entry. */
- int y, /* Top edge of entry. */
- int width, /* Width of entry. */
- int height) /* Height of entry. */
-{
- XPoint points[2];
- int margin, segmentWidth, maxX;
- Tk_3DBorder border;
-
- if ((menuPtr->menuType != MASTER_MENU) || (FixMDEF() != NULL)) {
- return;
- }
-
- margin = (fmPtr->ascent + fmPtr->descent)/2;
- points[0].x = x;
- points[0].y = y + height/2;
- points[1].y = points[0].y;
- segmentWidth = 6;
- maxX = width - 1;
- border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
-
- while (points[0].x < maxX) {
- points[1].x = points[0].x + segmentWidth;
- if (points[1].x > maxX) {
- points[1].x = maxX;
- }
- Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1,
- TK_RELIEF_RAISED);
- points[0].x += 2*segmentWidth;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacSetHelpMenuItemCount --
- *
- * Has to be called after the first call to InsertMenu. Sets
- * up the global variable for the number of items in the
- * unmodified help menu.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Sets the global helpItemCount.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacSetHelpMenuItemCount()
-{
- MenuHandle helpMenuHandle;
-
- if ((HMGetHelpMenuHandle(&helpMenuHandle) != noErr)
- || (helpMenuHandle == NULL)) {
- helpItemCount = -1;
- } else {
- helpItemCount = CountMItems(helpMenuHandle);
- DeleteMenuItem(helpMenuHandle, helpItemCount);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacMenuClick --
- *
- * Prepares a menubar for MenuSelect or MenuKey.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Any pending configurations of the menubar are completed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacMenuClick()
-{
- TkMenu *menuPtr;
- TkMenuReferences *menuRefPtr;
-
- if ((currentMenuBarInterp != NULL) && (currentMenuBarName != NULL)) {
- menuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
- currentMenuBarName);
- for (menuPtr = menuRefPtr->menuPtr->masterMenuPtr;
- menuPtr != NULL; menuPtr = menuPtr->nextInstancePtr) {
- if (menuPtr->menuType == MENUBAR) {
- CompleteIdlers(menuPtr);
- break;
- }
- }
- }
-
- if (menuBarFlags & MENUBAR_REDRAW_PENDING) {
- Tcl_CancelIdleCall(DrawMenuBarWhenIdle, (ClientData *) NULL);
- DrawMenuBarWhenIdle((ClientData *) NULL);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDrawMenuEntry --
- *
- * Draws the given menu entry at the given coordinates with the
- * given attributes.
- *
- * Results:
- * None.
- *
- * Side effects:
- * X Server commands are executed to display the menu entry.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDrawMenuEntry(
- TkMenuEntry *mePtr, /* The entry to draw */
- Drawable d, /* What to draw into */
- Tk_Font tkfont, /* Precalculated font for menu */
- CONST Tk_FontMetrics *menuMetricsPtr,
- /* Precalculated metrics for menu */
- int x, /* X-coordinate of topleft of entry */
- int y, /* Y-coordinate of topleft of entry */
- int width, /* Width of the entry rectangle */
- int height, /* Height of the current rectangle */
- int strictMotif, /* Boolean flag */
- int drawArrow) /* Whether or not to draw the cascade
- * arrow for cascade items. Only applies
- * to Windows. */
-{
- GC gc;
- TkMenu *menuPtr = mePtr->menuPtr;
- int padY = (menuPtr->menuType == MENUBAR) ? 3 : 0;
- GC indicatorGC;
- Tk_3DBorder bgBorder, activeBorder;
- const Tk_FontMetrics *fmPtr;
- Tk_FontMetrics entryMetrics;
- int adjustedY = y + padY;
- int adjustedHeight = height - 2 * padY;
-
- /*
- * Choose the gc for drawing the foreground part of the entry.
- * Under Appearance, we pass a null (appearanceGC) to tell
- * ourselves not to change whatever color the appearance manager has set.
- */
-
- if ((mePtr->state == ENTRY_ACTIVE) && !strictMotif) {
- gc = mePtr->activeGC;
- if (gc == NULL) {
- gc = menuPtr->activeGC;
- }
- } else {
- TkMenuEntry *cascadeEntryPtr;
- int parentDisabled = 0;
-
- for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
- cascadeEntryPtr != NULL;
- cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
- char *name = (cascadeEntryPtr->namePtr == NULL) ? ""
- : Tcl_GetStringFromObj(cascadeEntryPtr->namePtr, NULL);
-
- if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
- if (cascadeEntryPtr->state == ENTRY_DISABLED) {
- parentDisabled = 1;
- }
- break;
- }
- }
-
- if (((parentDisabled || (mePtr->state == ENTRY_DISABLED)))
- && (menuPtr->disabledFgPtr != NULL)) {
- gc = mePtr->disabledGC;
- if (gc == NULL) {
- gc = menuPtr->disabledGC;
- }
- } else {
- gc = mePtr->textGC;
- if (gc == NULL) {
- gc = menuPtr->textGC;
- }
- }
- }
-
- indicatorGC = mePtr->indicatorGC;
- if (indicatorGC == NULL) {
- indicatorGC = menuPtr->indicatorGC;
- }
-
- bgBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- (mePtr->borderPtr == NULL)
- ? menuPtr->borderPtr : mePtr->borderPtr);
- if (strictMotif) {
- activeBorder = bgBorder;
- } else {
- activeBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- (mePtr->activeBorderPtr == NULL)
- ? menuPtr->activeBorderPtr : mePtr->activeBorderPtr);
- }
-
- if (mePtr->fontPtr == NULL) {
- fmPtr = menuMetricsPtr;
- } else {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
- Tk_GetFontMetrics(tkfont, &entryMetrics);
- fmPtr = &entryMetrics;
- }
-
- /*
- * Need to draw the entire background, including padding. On Unix,
- * for menubars, we have to draw the rest of the entry taking
- * into account the padding.
- */
-
- DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder,
- bgBorder, x, y, width, height);
-
- if (mePtr->type == SEPARATOR_ENTRY) {
- DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
- fmPtr, x, adjustedY, width, adjustedHeight);
- } else if (mePtr->type == TEAROFF_ENTRY) {
- DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, adjustedY,
- width, adjustedHeight);
- } else {
- DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x,
- adjustedY, width, adjustedHeight);
- DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
- activeBorder, x, adjustedY, width, adjustedHeight, drawArrow);
- if (!mePtr->hideMargin) {
- DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont,
- fmPtr, x, adjustedY, width, adjustedHeight);
- }
-
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkpComputeStandardMenuGeometry --
- *
- * This procedure is invoked to recompute the size and
- * layout of a menu that is not a menubar clone.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkpComputeStandardMenuGeometry(
- TkMenu *menuPtr) /* Structure describing menu. */
-{
- Tk_Font tkfont, menuFont;
- Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
- int x, y, height, modifierWidth, labelWidth, indicatorSpace;
- int windowWidth, windowHeight, accelWidth, maxAccelTextWidth;
- int i, j, lastColumnBreak, maxModifierWidth, maxWidth, nonAccelMargin;
- int maxNonAccelMargin, maxEntryWithAccelWidth, maxEntryWithoutAccelWidth;
- int entryWidth, maxIndicatorSpace, borderWidth, activeBorderWidth;
- TkMenuEntry *mePtr, *columnEntryPtr;
- EntryGeometry *geometryPtr;
-
- if (menuPtr->tkwin == NULL) {
- return;
- }
-
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
- &borderWidth);
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
- &activeBorderWidth);
- x = y = borderWidth;
- indicatorSpace = labelWidth = accelWidth = maxAccelTextWidth = 0;
- windowHeight = windowWidth = maxWidth = lastColumnBreak = 0;
- maxModifierWidth = nonAccelMargin = maxNonAccelMargin = 0;
- maxEntryWithAccelWidth = maxEntryWithoutAccelWidth = 0;
- maxIndicatorSpace = 0;
-
- /*
- * On the Mac especially, getting font metrics can be quite slow,
- * so we want to do it intelligently. We are going to precalculate
- * them and pass them down to all of the measuring and drawing
- * routines. We will measure the font metrics of the menu once.
- * If an entry does not have its own font set, then we give
- * the geometry/drawing routines the menu's font and metrics.
- * If an entry has its own font, we will measure that font and
- * give all of the geometry/drawing the entry's font and metrics.
- */
-
- menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
- Tk_GetFontMetrics(menuFont, &menuMetrics);
-
- for (i = 0; i < menuPtr->numEntries; i++) {
- mePtr = menuPtr->entries[i];
- if (mePtr->fontPtr == NULL) {
- tkfont = menuFont;
- fmPtr = &menuMetrics;
- } else {
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
- Tk_GetFontMetrics(tkfont, &entryMetrics);
- fmPtr = &entryMetrics;
- }
-
- if ((i > 0) && mePtr->columnBreak) {
- if (maxIndicatorSpace != 0) {
- maxIndicatorSpace += 2;
- }
- for (j = lastColumnBreak; j < i; j++) {
- columnEntryPtr = menuPtr->entries[j];
- geometryPtr =
- (EntryGeometry *) columnEntryPtr->platformEntryData;
-
- columnEntryPtr->indicatorSpace = maxIndicatorSpace;
- columnEntryPtr->width = maxIndicatorSpace + maxWidth
- + 2 * activeBorderWidth;
- geometryPtr->accelTextWidth = maxAccelTextWidth;
- geometryPtr->modifierWidth = maxModifierWidth;
- columnEntryPtr->x = x;
- columnEntryPtr->entryFlags &= ~ENTRY_LAST_COLUMN;
- if (maxEntryWithoutAccelWidth > maxEntryWithAccelWidth) {
- geometryPtr->nonAccelMargin = maxEntryWithoutAccelWidth
- - maxEntryWithAccelWidth;
- if (geometryPtr->nonAccelMargin > maxNonAccelMargin) {
- geometryPtr->nonAccelMargin = maxNonAccelMargin;
- }
- } else {
- geometryPtr->nonAccelMargin = 0;
- }
- }
- x += maxIndicatorSpace + maxWidth + 2 * borderWidth;
- windowWidth = x;
- maxWidth = maxIndicatorSpace = maxAccelTextWidth = 0;
- maxModifierWidth = maxNonAccelMargin = maxEntryWithAccelWidth = 0;
- maxEntryWithoutAccelWidth = 0;
- lastColumnBreak = i;
- y = borderWidth;
- }
-
- if (mePtr->type == SEPARATOR_ENTRY) {
- GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &entryWidth, &height);
- mePtr->height = height;
- } else if (mePtr->type == TEAROFF_ENTRY) {
- GetTearoffEntryGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &entryWidth, &height);
- mePtr->height = height;
- } else {
- /*
- * For each entry, compute the height required by that
- * particular entry, plus three widths: the width of the
- * label, the width to allow for an indicator to be displayed
- * to the left of the label (if any), and the width of the
- * accelerator to be displayed to the right of the label
- * (if any). These sizes depend, of course, on the type
- * of the entry.
- */
-
- GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &labelWidth,
- &height);
- mePtr->height = height;
-
- if (mePtr->type == CASCADE_ENTRY) {
- GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr,
- &modifierWidth, &accelWidth, &height);
- nonAccelMargin = 0;
- } else if (mePtr->accelLength == 0) {
- nonAccelMargin = mePtr->hideMargin ? 0
- : Tk_TextWidth(tkfont, "m", 1);
- accelWidth = modifierWidth = 0;
- } else {
- labelWidth += Tk_TextWidth(tkfont, "m", 1);
- GetMenuAccelGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &modifierWidth, &accelWidth, &height);
- if (height > mePtr->height) {
- mePtr->height = height;
- }
- nonAccelMargin = 0;
- }
-
- if (!(mePtr->hideMargin)) {
- GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &indicatorSpace, &height);
- if (height > mePtr->height) {
- mePtr->height = height;
- }
- } else {
- indicatorSpace = 0;
- }
-
- if (nonAccelMargin > maxNonAccelMargin) {
- maxNonAccelMargin = nonAccelMargin;
- }
- if (accelWidth > maxAccelTextWidth) {
- maxAccelTextWidth = accelWidth;
- }
- if (modifierWidth > maxModifierWidth) {
- maxModifierWidth = modifierWidth;
- }
- if (indicatorSpace > maxIndicatorSpace) {
- maxIndicatorSpace = indicatorSpace;
- }
-
- entryWidth = labelWidth + modifierWidth + accelWidth
- + nonAccelMargin;
-
- if (entryWidth > maxWidth) {
- maxWidth = entryWidth;
- }
-
- if (mePtr->accelLength > 0) {
- if (entryWidth > maxEntryWithAccelWidth) {
- maxEntryWithAccelWidth = entryWidth;
- }
- } else {
- if (entryWidth > maxEntryWithoutAccelWidth) {
- maxEntryWithoutAccelWidth = entryWidth;
- }
- }
-
- mePtr->height += 2 * activeBorderWidth;
- }
- mePtr->y = y;
- y += menuPtr->entries[i]->height + borderWidth;
- if (y > windowHeight) {
- windowHeight = y;
- }
- }
-
- for (j = lastColumnBreak; j < menuPtr->numEntries; j++) {
- columnEntryPtr = menuPtr->entries[j];
- geometryPtr = (EntryGeometry *) columnEntryPtr->platformEntryData;
-
- columnEntryPtr->indicatorSpace = maxIndicatorSpace;
- columnEntryPtr->width = maxIndicatorSpace + maxWidth
- + 2 * activeBorderWidth;
- geometryPtr->accelTextWidth = maxAccelTextWidth;
- geometryPtr->modifierWidth = maxModifierWidth;
- columnEntryPtr->x = x;
- columnEntryPtr->entryFlags |= ENTRY_LAST_COLUMN;
- if (maxEntryWithoutAccelWidth > maxEntryWithAccelWidth) {
- geometryPtr->nonAccelMargin = maxEntryWithoutAccelWidth
- - maxEntryWithAccelWidth;
- if (geometryPtr->nonAccelMargin > maxNonAccelMargin) {
- geometryPtr->nonAccelMargin = maxNonAccelMargin;
- }
- } else {
- geometryPtr->nonAccelMargin = 0;
- }
- }
- windowWidth = x + maxIndicatorSpace + maxWidth
- + 2 * activeBorderWidth + borderWidth;
- windowHeight += borderWidth;
-
- /*
- * The X server doesn't like zero dimensions, so round up to at least
- * 1 (a zero-sized menu should never really occur, anyway).
- */
-
- if (windowWidth <= 0) {
- windowWidth = 1;
- }
- if (windowHeight <= 0) {
- windowHeight = 1;
- }
- menuPtr->totalWidth = windowWidth;
- menuPtr->totalHeight = windowHeight;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawMenuEntryLabel --
- *
- * This procedure draws the label part of a menu.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-DrawMenuEntryLabel(
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
- Drawable d, /* What we are drawing into */
- GC gc, /* The gc we are drawing into */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int x, /* left edge */
- int y, /* right edge */
- int width, /* width of entry */
- int height) /* height of entry */
-{
- int indicatorSpace = mePtr->indicatorSpace;
- int leftEdge = x + indicatorSpace;
- int imageHeight, imageWidth;
- int textHeight, textWidth;
- int haveImage = 0, haveText = 0;
- int imageXOffset = 0, imageYOffset = 0;
- int textXOffset = 0, textYOffset = 0;
-
- /*
- * Work out what we will need to draw first.
- */
-
- if (mePtr->image != NULL) {
- Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
- haveImage = 1;
- } else if (mePtr->bitmapPtr != NULL) {
- Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
- Tk_SizeOfBitmap(menuPtr->display, bitmap, &imageWidth, &imageHeight);
- haveImage = 1;
- }
- if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
- if (mePtr->labelLength > 0) {
- Tcl_DString itemTextDString;
- textHeight = fmPtr->linespace;
- GetEntryText(mePtr, &itemTextDString);
- textWidth = Tk_TextWidth(tkfont,
- Tcl_DStringValue(&itemTextDString),
- Tcl_DStringLength(&itemTextDString));
- Tcl_DStringFree(&itemTextDString);
- haveText = 1;
- }
- }
-
- /*
- * Now work out what the relative positions are.
- */
-
- if (haveImage && haveText) {
- int fullWidth = (imageWidth > textWidth ? imageWidth : textWidth);
- switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = imageHeight/2 + 2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = -textHeight/2;
- break;
- }
- case COMPOUND_BOTTOM: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = -imageHeight/2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = textHeight/2 + 2;
- break;
- }
- case COMPOUND_LEFT: {
- textXOffset = imageWidth + 2;
- textYOffset = 0;
- imageXOffset = 0;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_RIGHT: {
- textXOffset = 0;
- textYOffset = 0;
- imageXOffset = textWidth + 2;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_CENTER: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = 0;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_NONE: {break;}
- }
- } else {
- textXOffset = 0;
- textYOffset = 0;
- imageXOffset = 0;
- imageYOffset = 0;
- }
-
- /*
- * Draw label and/or bitmap or image for entry.
- */
-
- if (mePtr->image != NULL) {
- Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
- if ((mePtr->selectImage != NULL)
- && (mePtr->entryFlags & ENTRY_SELECTED)) {
- Tk_RedrawImage(mePtr->selectImage, 0, 0,
- imageWidth, imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
- } else {
- Tk_RedrawImage(mePtr->image, 0, 0, imageWidth,
- imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
- }
- } else if (mePtr->bitmapPtr != NULL) {
- Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
- XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
- (unsigned) imageWidth, (unsigned) imageHeight,
- leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), 1);
- }
- if ((mePtr->compound != COMPOUND_NONE) || !haveImage) {
- if (mePtr->labelLength > 0) {
- Tcl_DString itemTextDString, convertedTextDString;
- int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
-
- GetEntryText(mePtr, &itemTextDString);
-
- /* Somehow DrawChars is changing the colors, it is odd, since
- it works for the Apple Platinum Appearance, but not for
- some Kaleidoscope Themes... Untill I can figure out what
- exactly is going on, this will have to do: */
-
- TkMacSetUpGraphicsPort(gc);
- MoveTo((short) leftEdge + textXOffset,
- (short) baseline + textYOffset);
- Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&itemTextDString),
- Tcl_DStringLength(&itemTextDString), &convertedTextDString);
- DrawText(Tcl_DStringValue(&convertedTextDString), 0,
- Tcl_DStringLength(&convertedTextDString));
-
- /* Tk_DrawChars(menuPtr->display, d, gc,
- tkfont, Tcl_DStringValue(&itemTextDString),
- Tcl_DStringLength(&itemTextDString),
- leftEdge, baseline); */
-
- Tcl_DStringFree(&itemTextDString);
- }
- }
-
- if (mePtr->state == ENTRY_DISABLED) {
- if (menuPtr->disabledFgPtr == NULL) {
- if (!TkMacHaveAppearance()) {
- XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
- (unsigned) width, (unsigned) height);
- }
- } else if ((mePtr->image != NULL)
- && (menuPtr->disabledImageGC != None)) {
- XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
- leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset),
- (unsigned) imageWidth, (unsigned) imageHeight);
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DrawMenuEntryBackground --
- *
- * This procedure draws the background part of a menu entry.
- * Under Appearance, we only draw the background if the entry's
- * border is set, we DO NOT inherit it from the menu...
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-DrawMenuEntryBackground(
- TkMenu *menuPtr, /* The menu we are drawing. */
- TkMenuEntry *mePtr, /* The entry we are drawing. */
- Drawable d, /* What we are drawing into */
- Tk_3DBorder activeBorder, /* Border for active items */
- Tk_3DBorder bgBorder, /* Border for the background */
- int x, /* left edge */
- int y, /* top edge */
- int width, /* width of rectangle to draw */
- int height) /* height of rectangle to draw */
-{
- if (!TkMacHaveAppearance()
- || (menuPtr->menuType == TEAROFF_MENU)
- || ((mePtr->state == ENTRY_ACTIVE)
- && (mePtr->activeBorderPtr != None))
- || ((mePtr->state != ENTRY_ACTIVE) && (mePtr->borderPtr != None))) {
- if (mePtr->state == ENTRY_ACTIVE) {
- bgBorder = activeBorder;
- }
- Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder,
- x, y, width, height, 0, TK_RELIEF_FLAT);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GetMenuLabelGeometry --
- *
- * Figures out the size of the label portion of a menu item.
- *
- * Results:
- * widthPtr and heightPtr are filled in with the correct geometry
- * information.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GetMenuLabelGeometry(
- TkMenuEntry *mePtr, /* The entry we are computing */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated metrics */
- int *widthPtr, /* The resulting width of the label
- * portion */
- int *heightPtr) /* The resulting height of the label
- * portion */
-{
- TkMenu *menuPtr = mePtr->menuPtr;
- int haveImage = 0, haveText = 0;
-
- if (mePtr->image != NULL) {
- Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr);
- haveImage = 1;
- } else if (mePtr->bitmapPtr != NULL) {
- Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
- Tk_SizeOfBitmap(menuPtr->display, bitmap, widthPtr, heightPtr);
- haveImage = 1;
- } else {
- *heightPtr = 0;
- *widthPtr = 0;
- }
-
- if (haveImage && (mePtr->compound == COMPOUND_NONE)) {
- /* We don't care about the text in this case */
- } else {
- /* Either it is compound or we don't have an image */
- if (mePtr->labelPtr != NULL) {
- Tcl_DString itemTextDString;
- int textWidth;
- GetEntryText(mePtr, &itemTextDString);
- textWidth = Tk_TextWidth(tkfont,
- Tcl_DStringValue(&itemTextDString),
- Tcl_DStringLength(&itemTextDString));
- Tcl_DStringFree(&itemTextDString);
-
- if ((mePtr->compound != COMPOUND_NONE) && haveImage) {
- switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- /* Add text and padding */
- *heightPtr += fmPtr->linespace + 2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- /* Add text and padding */
- *widthPtr += textWidth + 2;
- break;
- }
- case COMPOUND_CENTER: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- break;
- }
- case COMPOUND_NONE: {break;}
- }
- } else {
- /* We don't have an image or we're not compound */
- *heightPtr = fmPtr->linespace;
- *widthPtr = textWidth;
- }
- } else {
- /* An empty entry still has this height */
- *heightPtr = fmPtr->linespace;
- }
- }
- *heightPtr += 1;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MenuSelectEvent --
- *
- * Generates a "MenuSelect" virtual event. This can be used to
- * do context-sensitive menu help.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Places a virtual event on the event queue.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-MenuSelectEvent(
- TkMenu *menuPtr) /* the menu we have selected. */
-{
- XVirtualEvent event;
- Point where;
-
- event.type = VirtualEvent;
- event.serial = menuPtr->display->request;
- event.send_event = false;
- event.display = menuPtr->display;
- Tk_MakeWindowExist(menuPtr->tkwin);
- event.event = Tk_WindowId(menuPtr->tkwin);
- event.root = XRootWindow(menuPtr->display, 0);
- event.subwindow = None;
- event.time = TkpGetMS();
-
- GetMouse(&where);
- event.x_root = where.h;
- event.y_root = where.v;
- event.state = TkMacButtonKeyState();
- event.same_screen = true;
- event.name = Tk_GetUid("MenuSelect");
- Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * RecursivelyClearActiveMenu --
- *
- * Recursively clears the active entry in the menu's cascade hierarchy.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Generates <<MenuSelect>> virtual events.
- *
- *----------------------------------------------------------------------
- */
-
-void
-RecursivelyClearActiveMenu(
- TkMenu *menuPtr) /* The menu to reset. */
-{
- int i;
- TkMenuEntry *mePtr;
-
- TkActivateMenuEntry(menuPtr, -1);
- MenuSelectEvent(menuPtr);
- for (i = 0; i < menuPtr->numEntries; i++) {
- mePtr = menuPtr->entries[i];
- if (mePtr->type == CASCADE_ENTRY) {
- if ((mePtr->childMenuRefPtr != NULL)
- && (mePtr->childMenuRefPtr->menuPtr != NULL)) {
- RecursivelyClearActiveMenu(mePtr->childMenuRefPtr->menuPtr);
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * InvalidateMDEFRgns --
- *
- * Invalidates the regions covered by menus that did redrawing and
- * might be damaged.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Generates Mac update events for affected windows.
- *
- *----------------------------------------------------------------------
- */
-
-void
-InvalidateMDEFRgns(void)
-{
- GDHandle saveDevice;
- GWorldPtr saveWorld, destPort;
- Point scratch;
- MacDrawable *macDraw;
- TkMacWindowList *listPtr;
-
- if (totalMenuRgn == NULL) {
- return;
- }
-
- GetGWorld(&saveWorld, &saveDevice);
- for (listPtr = tkMacWindowListPtr ; listPtr != NULL;
- listPtr = listPtr->nextPtr) {
- macDraw = (MacDrawable *) Tk_WindowId(listPtr->winPtr);
- if (macDraw->flags & TK_DRAWN_UNDER_MENU) {
- destPort = TkMacGetDrawablePort(Tk_WindowId(listPtr->winPtr));
- SetGWorld(destPort, NULL);
- scratch.h = scratch.v = 0;
- GlobalToLocal(&scratch);
- OffsetRgn(totalMenuRgn, scratch.v, scratch.h);
- InvalRgn(totalMenuRgn);
- OffsetRgn(totalMenuRgn, -scratch.v, -scratch.h);
- macDraw->flags &= ~TK_DRAWN_UNDER_MENU;
- }
- }
-
- SetGWorld(saveWorld, saveDevice);
- SetEmptyRgn(totalMenuRgn);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacClearMenubarActive --
- *
- * Recursively clears the active entry in the current menubar hierarchy.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Generates <<MenuSelect>> virtual events.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacClearMenubarActive(void)
-{
- TkMenuReferences *menuBarRefPtr;
-
- if (currentMenuBarName != NULL) {
- menuBarRefPtr = TkFindMenuReferences(currentMenuBarInterp,
- currentMenuBarName);
- if ((menuBarRefPtr != NULL) && (menuBarRefPtr->menuPtr != NULL)) {
- TkMenu *menuPtr;
-
- for (menuPtr = menuBarRefPtr->menuPtr->masterMenuPtr; menuPtr != NULL;
- menuPtr = menuPtr->nextInstancePtr) {
- if (menuPtr->menuType == MENUBAR) {
- RecursivelyClearActiveMenu(menuPtr);
- }
- }
- }
- }
- InvalidateMDEFRgns();
- FixMDEF();
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpMenuNotifyToplevelCreate --
- *
- * This routine reconfigures the menu and the clones indicated by
- * menuName becuase a toplevel has been created and any system
- * menus need to be created. Only applicable to Windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * An idle handler is set up to do the reconfiguration.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpMenuNotifyToplevelCreate(
- Tcl_Interp *interp, /* The interp the menu lives in. */
- char *menuName) /* The name of the menu to
- * reconfigure. */
-{
- /*
- * Nothing to do.
- */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FixMDEF --
- *
- * Loads the MDEF and blasts our routine descriptor into it.
- * We have to set up the MDEF. This is pretty slimy. The real MDEF
- * resource is 68K code. All this code does is call another procedure.
- * When the application in launched, a dummy value for the procedure
- * is compiled into the MDEF. We are going to replace that dummy
- * value with a routine descriptor. When the routine descriptor
- * is invoked, the globals and everything will be setup, and we
- * can do what we need. This will not work from 68K or CFM 68k
- * currently, so we will conditional compile this until we
- * figure it out.
- *
- * Results:
- * Returns the MDEF handle.
- *
- * Side effects:
- * The MDEF is read in and massaged.
- *
- *----------------------------------------------------------------------
- */
-
-#if __MWERKS__ != 0x2400
-#define MDEF_PROC_OFFSET 0x24
-#else
-#define MDEF_PROC_OFFSET 0x20
-#endif
-
-static Handle
-FixMDEF(void)
-{
-#if GENERATINGCFM
- Handle MDEFHandle = GetResource('MDEF', 591);
- Handle SICNHandle = GetResource('SICN', SICN_RESOURCE_NUMBER);
- if ((MDEFHandle != NULL) && (SICNHandle != NULL)) {
- HLock(MDEFHandle);
- HLock(SICNHandle);
- if (menuDefProc == NULL) {
- menuDefProc = TkNewMenuDefProc(MenuDefProc);
- }
- memmove((void *) (((long) (*MDEFHandle)) + MDEF_PROC_OFFSET), &menuDefProc, 4);
- return MDEFHandle;
- } else {
- return NULL;
- }
-#else
- return NULL;
-#endif
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpMenuInit --
- *
- * Initializes Mac-specific menu data.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Allocates a hash table.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpMenuInit(void)
-{
- lastMenuID = 256;
- Tcl_InitHashTable(&commandTable, TCL_ONE_WORD_KEYS);
- currentMenuBarOwner = NULL;
- tearoffStruct.menuPtr = NULL;
- currentAppleMenuID = 0;
- currentHelpMenuID = 0;
- currentMenuBarInterp = NULL;
- currentMenuBarName = NULL;
- windowListPtr = NULL;
-
- /*
- * Get the GC that we will use as the sign to the font
- * routines that they should not muck with the foreground color...
- */
-
- if (TkMacHaveAppearance() > 1) {
- XGCValues tmpValues;
- TkColor *tmpColorPtr;
-
- tmpColorPtr = TkpGetColor(NULL, "systemAppearanceColor");
- tmpValues.foreground = tmpColorPtr->color.pixel;
- tmpValues.background = tmpColorPtr->color.pixel;
- ckfree((char *) tmpColorPtr);
-
- tkThemeMenuItemDrawingUPP = NewMenuItemDrawingProc(tkThemeMenuItemDrawingProc);
- }
- FixMDEF();
-
- Tcl_ExternalToUtf(NULL, NULL, "\311", /* Š */
- -1, 0, NULL, elipsisString,
- TCL_UTF_MAX + 1, NULL, NULL, NULL);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpMenuThreadInit --
- *
- * Does platform-specific initialization of thread-specific
- * menu state.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpMenuThreadInit()
-{
- /*
- * Nothing to do.
- */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpPreprocessMacMenu --
- *
- * Handle preprocessing of menubar if it exists.
- *
- * Results:
- * None.
- *
- * Side effects:
- * All post commands for the current menubar get executed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacPreprocessMenu()
-{
- TkMenuReferences *mbRefPtr;
- int code;
-
- if ((currentMenuBarName != NULL) && (currentMenuBarInterp != NULL)) {
- mbRefPtr = TkFindMenuReferences(currentMenuBarInterp,
- currentMenuBarName);
- if ((mbRefPtr != NULL) && (mbRefPtr->menuPtr != NULL)) {
- Tcl_Preserve((ClientData)currentMenuBarInterp);
- code = TkPreprocessMenu(mbRefPtr->menuPtr->masterMenuPtr);
- if ((code != TCL_OK) && (code != TCL_CONTINUE)
- && (code != TCL_BREAK)) {
- Tcl_AddErrorInfo(currentMenuBarInterp,
- "\n (menu preprocess)");
- Tcl_BackgroundError(currentMenuBarInterp);
- }
- Tcl_Release((ClientData)currentMenuBarInterp);
- }
- }
-}
diff --git a/mac/tkMacMenu.r b/mac/tkMacMenu.r
deleted file mode 100644
index 835112b..0000000
--- a/mac/tkMacMenu.r
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * tkMacMenu.r --
- *
- * Resources needed by menus.
- *
- * This file also contains the icons 'SICN' used by the menu code
- * in menu items.
- *
- * Copyright (c) 1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Types.r>
-
-/*
- * Icons used in menu items.
- */
-
-resource 'SICN' (128, preload, locked) {
- { /* array: 7 elements */
- /* [1] */
- $"0000 0000 8000 C000 E000 F000 F800 FC00"
- $"F800 F000 E000 C000 80",
- /* [2] */
- $"0000 0000 0000 0800 1400 2200 4100 8080"
- $"E380 2200 2200 2200 3E",
- /* [3] */
- $"0000 0000 0000 0000 0000 F8F0 C4F0 F270"
- $"0900 0480 0270 0130 00F0",
- /* [4] */
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 E4E0 CE60 1B00 3180",
- /* [5] */
- $"0000 0000 0000 0000 6300 9480 9480 7F00"
- $"1400 7F00 9480 9480 63",
- /* [6] */
- $"0000 0000 0000 0000 0000 3FF8 1FF0 0FE0"
- $"07C0 0380 01",
- /* [7] */
- $"0000 0000 0000 0000 0000 0100 0380 07C0"
- $"0FE0 1FF0 3FF8"
- }
-};
diff --git a/mac/tkMacMenubutton.c b/mac/tkMacMenubutton.c
deleted file mode 100644
index b6a830b..0000000
--- a/mac/tkMacMenubutton.c
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * tkMacMenubutton.c --
- *
- * This file implements the Macintosh specific portion of the
- * menubutton widget.
- *
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkMenubutton.h"
-#include "tkMacInt.h"
-#include <Controls.h>
-
-#define kShadowOffset (3) /* amount to offset shadow from frame */
-#define kTriangleWidth (11) /* width of the triangle */
-#define kTriangleHeight (6) /* height of the triangle */
-#define kTriangleMargin (5) /* margin around triangle */
-
-/*
- * Declaration of Unix specific button structure.
- */
-
-typedef struct MacMenuButton {
- TkMenuButton info; /* Generic button info. */
-} MacMenuButton;
-
-/*
- * The structure below defines menubutton class behavior by means of
- * procedures that can be invoked from generic window code.
- */
-
-Tk_ClassProcs tkpMenubuttonClass = {
- sizeof(Tk_ClassProcs), /* size */
- TkMenuButtonWorldChanged, /* worldChangedProc */
-};
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpCreateMenuButton --
- *
- * Allocate a new TkMenuButton structure.
- *
- * Results:
- * Returns a newly allocated TkMenuButton structure.
- *
- * Side effects:
- * Registers an event handler for the widget.
- *
- *----------------------------------------------------------------------
- */
-
-TkMenuButton *
-TkpCreateMenuButton(
- Tk_Window tkwin)
-{
- MacMenuButton *butPtr = (MacMenuButton *)ckalloc(sizeof(MacMenuButton));
-
- return (TkMenuButton *) butPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDisplayMenuButton --
- *
- * This procedure is invoked to display a menubutton widget.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Commands are output to X to display the menubutton in its
- * current mode.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDisplayMenuButton(
- ClientData clientData) /* Information about widget. */
-{
- TkMenuButton *mbPtr = (TkMenuButton *) clientData;
- GC gc;
- Tk_3DBorder border;
- int x = 0; /* Initialization needed only to stop
- * compiler warning. */
- int y;
- Tk_Window tkwin = mbPtr->tkwin;
- int width, height, fullWidth, fullHeight;
- int imageWidth, imageHeight;
- int imageXOffset, imageYOffset, textXOffset, textYOffset;
- int haveImage = 0, haveText = 0;
- MacMenuButton * macMBPtr = (MacMenuButton *) mbPtr;
- GWorldPtr destPort;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- MacDrawable *macDraw;
-
- mbPtr->flags &= ~REDRAW_PENDING;
- if ((mbPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
- return;
- }
-
- GetGWorld(&saveWorld, &saveDevice);
- destPort = TkMacGetDrawablePort(Tk_WindowId(tkwin));
- SetGWorld(destPort, NULL);
- macDraw = (MacDrawable *) Tk_WindowId(tkwin);
-
- if ((mbPtr->state == STATE_DISABLED) && (mbPtr->disabledFg != NULL)) {
- gc = mbPtr->disabledGC;
- } else if ((mbPtr->state == STATE_ACTIVE)
- && !Tk_StrictMotif(mbPtr->tkwin)) {
- gc = mbPtr->activeTextGC;
- } else {
- gc = mbPtr->normalTextGC;
- }
- border = mbPtr->normalBorder;
-
- if (mbPtr->image != None) {
- Tk_SizeOfImage(mbPtr->image, &width, &height);
- haveImage = 1;
- } else if (mbPtr->bitmap != None) {
- Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
- haveImage = 1;
- }
- imageWidth = width;
- imageHeight = height;
-
- haveText = (mbPtr->textWidth != 0 && mbPtr->textHeight != 0);
-
- /*
- * In order to avoid screen flashes, this procedure redraws
- * the menu button in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
- */
-
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, 0, 0,
- Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
-
- imageXOffset = 0;
- imageYOffset = 0;
- textXOffset = 0;
- textYOffset = 0;
- fullWidth = 0;
- fullHeight = 0;
-
- if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- switch ((enum compound) mbPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (mbPtr->compound == COMPOUND_TOP) {
- textYOffset = height + mbPtr->padY;
- } else {
- imageYOffset = mbPtr->textHeight + mbPtr->padY;
- }
- fullHeight = height + mbPtr->textHeight + mbPtr->padY;
- fullWidth = (width > mbPtr->textWidth ? width :
- mbPtr->textWidth);
- textXOffset = (fullWidth - mbPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- if (mbPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + mbPtr->padX;
- } else {
- imageXOffset = mbPtr->textWidth + mbPtr->padX;
- }
- fullWidth = mbPtr->textWidth + mbPtr->padX + width;
- fullHeight = (height > mbPtr->textHeight ? height :
- mbPtr->textHeight);
- textYOffset = (fullHeight - mbPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- fullWidth = (width > mbPtr->textWidth ? width :
- mbPtr->textWidth);
- fullHeight = (height > mbPtr->textHeight ? height :
- mbPtr->textHeight);
- textXOffset = (fullWidth - mbPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - mbPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_NONE: {break;}
- }
-
-
- TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
- mbPtr->indicatorWidth + fullWidth, fullHeight,
- &x, &y);
-
- imageXOffset += x;
- imageYOffset += y;
- if (mbPtr->image != NULL) {
- Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
- imageXOffset, imageYOffset);
- } else if (mbPtr->bitmap != None) {
- XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
- gc, 0, 0, (unsigned) width, (unsigned) height,
- imageXOffset, imageYOffset, 1);
- }
-
- Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
- mbPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
- Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
- mbPtr->textLayout, x + textXOffset, y + textYOffset,
- mbPtr->underline);
- } else if (haveImage) {
- TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
- width + mbPtr->indicatorWidth, height, &x, &y);
- imageXOffset += x;
- imageYOffset += y;
- if (mbPtr->image != NULL) {
- Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
- imageXOffset, imageYOffset);
- } else if (mbPtr->bitmap != None) {
- XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
- gc, 0, 0, (unsigned) width, (unsigned) height,
- x, y, 1);
- }
- } else {
- TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
- mbPtr->textWidth + mbPtr->indicatorWidth,
- mbPtr->textHeight, &x, &y);
- Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
- mbPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
- Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
- mbPtr->textLayout, x + textXOffset, y + textYOffset,
- mbPtr->underline);
- }
-
-#if 0 /* this is the original code */
- /*
- * Display image or bitmap or text for button.
- */
-
- if (mbPtr->image != None) {
- Tk_SizeOfImage(mbPtr->image, &width, &height);
-
- imageOrBitmap:
- TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
- width + mbPtr->indicatorWidth, height, &x, &y);
- if (mbPtr->image != NULL) {
- Tk_RedrawImage(mbPtr->image, 0, 0, width, height,
- Tk_WindowId(tkwin), x, y);
- } else {
- XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
- gc, 0, 0, (unsigned) width, (unsigned) height, x, y, 1);
- }
- } else if (mbPtr->bitmap != None) {
- Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
- goto imageOrBitmap;
- } else {
- TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
- mbPtr->textWidth + mbPtr->indicatorWidth, mbPtr->textHeight,
- &x, &y);
- Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
- mbPtr->textLayout, x, y, 0, -1);
- }
-#endif
-
- /*
- * If the menu button is disabled with a stipple rather than a special
- * foreground color, generate the stippled effect.
- */
-
- if ((mbPtr->state == STATE_DISABLED)
- && ((mbPtr->disabledFg != NULL) || (mbPtr->image != NULL))) {
- /*
- * Stipple the whole button if no disabledFg was specified,
- * otherwise restrict stippling only to displayed image
- */
- if (mbPtr->disabledFg == NULL) {
- XFillRectangle(mbPtr->display, Tk_WindowId(tkwin),
- mbPtr->stippleGC, mbPtr->inset, mbPtr->inset,
- (unsigned) (Tk_Width(tkwin) - 2*mbPtr->inset),
- (unsigned) (Tk_Height(tkwin) - 2*mbPtr->inset));
- } else {
- XFillRectangle(mbPtr->display, Tk_WindowId(tkwin),
- mbPtr->stippleGC, imageXOffset, imageYOffset,
- (unsigned) imageWidth, (unsigned) imageHeight);
- }
- }
-
- /*
- * Draw the cascade indicator for the menu button on the
- * right side of the window, if desired.
- */
-
- if (mbPtr->indicatorOn) {
- int w, h, i;
- Rect r;
-
- r.left = macDraw->xOff + Tk_Width(tkwin) - mbPtr->inset
- - mbPtr->indicatorWidth;
- r.top = macDraw->yOff + Tk_Height(tkwin)/2
- - mbPtr->indicatorHeight/2;
- r.right = macDraw->xOff + Tk_Width(tkwin) - mbPtr->inset
- - kTriangleMargin;
- r.bottom = macDraw->yOff + Tk_Height(tkwin)/2
- + mbPtr->indicatorHeight/2;
-
- h = mbPtr->indicatorHeight;
- w = mbPtr->indicatorWidth - 1 - kTriangleMargin;
- for (i = 0; i < h; i++) {
- MoveTo(r.left + i, r.top + i);
- LineTo(r.left + i + w, r.top + i);
- w -= 2;
- }
- }
-
- /*
- * Draw the border and traversal highlight last. This way, if the
- * menu button's contents overflow onto the border they'll be covered
- * up by the border.
- */
-
- TkMacSetUpClippingRgn(Tk_WindowId(tkwin));
- if (mbPtr->borderWidth > 0) {
- Rect r;
-
- r.left = macDraw->xOff + mbPtr->highlightWidth + mbPtr->borderWidth;
- r.top = macDraw->yOff + mbPtr->highlightWidth + mbPtr->borderWidth;
- r.right = macDraw->xOff + Tk_Width(tkwin) - mbPtr->highlightWidth
- - mbPtr->borderWidth;
- r.bottom = macDraw->yOff + Tk_Height(tkwin) - mbPtr->highlightWidth
- - mbPtr->borderWidth;
- FrameRect(&r);
-
- PenSize(mbPtr->borderWidth - 1, mbPtr->borderWidth - 1);
- MoveTo(r.right, r.top + kShadowOffset);
- LineTo(r.right, r.bottom);
- LineTo(r.left + kShadowOffset, r.bottom);
- }
-
- if (mbPtr->highlightWidth != 0) {
- GC fgGC, bgGC;
-
- bgGC = Tk_GCForColor(mbPtr->highlightBgColorPtr, Tk_WindowId(tkwin));
- if (mbPtr->flags & GOT_FOCUS) {
- fgGC = Tk_GCForColor(mbPtr->highlightColorPtr, Tk_WindowId(tkwin));
- TkpDrawHighlightBorder(tkwin, fgGC, bgGC, mbPtr->highlightWidth,
- Tk_WindowId(tkwin));
- } else {
- TkpDrawHighlightBorder(tkwin, bgGC, bgGC, mbPtr->highlightWidth,
- Tk_WindowId(tkwin));
- }
- }
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDestroyMenuButton --
- *
- * Free data structures associated with the menubutton control.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Restores the default control state.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDestroyMenuButton(
- TkMenuButton *mbPtr)
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpComputeMenuButtonGeometry --
- *
- * After changes in a menu button's text or bitmap, this procedure
- * recomputes the menu button's geometry and passes this information
- * along to the geometry manager for the window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The menu button's window may change size.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpComputeMenuButtonGeometry(mbPtr)
- register TkMenuButton *mbPtr; /* Widget record for menu button. */
-{
- int width=0, height=0, textwidth=0, textheight=0, mm, pixels, noimage=0;
-
- mbPtr->inset = mbPtr->highlightWidth + mbPtr->borderWidth;
- if (mbPtr->image != None) {
- Tk_SizeOfImage(mbPtr->image, &width, &height);
- if (mbPtr->width > 0) {
- width = mbPtr->width;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height;
- }
- } else if (mbPtr->bitmap != None) {
- Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
- if (mbPtr->width > 0) {
- width = mbPtr->width;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height;
- }
- } else {
- noimage=1;
- }
-
- if ( noimage || mbPtr->compound != COMPOUND_NONE ) {
- Tk_FreeTextLayout(mbPtr->textLayout);
- mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->text,
- -1, mbPtr->wrapLength, mbPtr->justify, 0, &mbPtr->textWidth,
- &mbPtr->textHeight);
- textwidth = mbPtr->textWidth;
- textheight = mbPtr->textHeight;
- if (mbPtr->width > 0) {
- textwidth = mbPtr->width * Tk_TextWidth(mbPtr->tkfont, "0", 1);
- }
- if (mbPtr->height > 0) {
- Tk_FontMetrics fm;
-
- Tk_GetFontMetrics(mbPtr->tkfont, &fm);
- textheight = mbPtr->height * fm.linespace;
- }
- textwidth += 2*mbPtr->padX;
- textheight += 2*mbPtr->padY;
- }
-
- switch ((enum compound) mbPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- height += textheight + mbPtr->padY;
- width = (width > textwidth ? width : textwidth);
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- height = (height > textheight ? height : textheight);
- width += textwidth + mbPtr->padX;
- break;
- }
- case COMPOUND_CENTER: {
- height = (height > textheight ? height : textheight);
- width = (width > textwidth ? width : textwidth);
- break;
- }
- case COMPOUND_NONE: {
- if (noimage) {
- height = textheight;
- width = textwidth;
- }
- break;
- }
- }
-
- if (mbPtr->indicatorOn) {
- mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin));
- pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
- mbPtr->indicatorHeight= kTriangleHeight;
- mbPtr->indicatorWidth = kTriangleWidth + kTriangleMargin;
- width += mbPtr->indicatorWidth;
- } else {
- mbPtr->indicatorHeight = 0;
- mbPtr->indicatorWidth = 0;
- }
-
- Tk_GeometryRequest(mbPtr->tkwin, (int) (width + 2*mbPtr->inset),
- (int) (height + 2*mbPtr->inset));
- Tk_SetInternalBorder(mbPtr->tkwin, mbPtr->inset);
-}
diff --git a/mac/tkMacMenus.c b/mac/tkMacMenus.c
deleted file mode 100644
index dfb40dd..0000000
--- a/mac/tkMacMenus.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * tkMacMenus.c --
- *
- * These calls set up and manage the menubar for the
- * Macintosh version of Tk.
- *
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tcl.h"
-#include "tclMacInt.h" /* Needed for FSpLocationFromPath */
-#include "tk.h"
-#include "tkInt.h"
-#include "tkMacInt.h"
-
-/*
- * The define Status defined by Xlib.h conflicts with the function Status
- * defined by Devices.h. We undefine it here to compile.
- */
-#undef Status
-#include <Devices.h>
-#include <Menus.h>
-#include <Memory.h>
-#include <SegLoad.h>
-#include <StandardFile.h>
-#include <ToolUtils.h>
-#include <Balloons.h>
-
-#define kAppleMenu 256
-#define kAppleAboutItem 1
-#define kFileMenu 2
-#define kEditMenu 3
-
-#define kSourceItem 1
-#define kCloseItem 2
-#define kQuitItem 4
-
-#define EDIT_CUT 1
-#define EDIT_COPY 2
-#define EDIT_PASTE 3
-#define EDIT_CLEAR 4
-
-MenuHandle tkAppleMenu;
-MenuHandle tkFileMenu;
-MenuHandle tkEditMenu;
-
-static Tcl_Interp * gInterp; /* Interpreter for this application. */
-
-static void GenerateEditEvent _ANSI_ARGS_((int flag));
-static void SourceDialog _ANSI_ARGS_((void));
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacHandleMenuSelect --
- *
- * Handles events that occur in the Menu bar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacHandleMenuSelect(
- long mResult,
- int optionKeyPressed)
-{
- short theItem = LoWord(mResult);
- short theMenu = HiWord(mResult);
- Str255 name;
- Tk_Window tkwin;
- Window window;
- TkDisplay *dispPtr;
-
- if (mResult == 0) {
- TkMacHandleTearoffMenu();
- TkMacClearMenubarActive();
- return;
- }
-
- switch (theMenu) {
-
- case kAppleMenu:
- switch (theItem) {
- case kAppleAboutItem:
- {
- Tcl_CmdInfo dummy;
-
- if (optionKeyPressed || gInterp == NULL ||
- Tcl_GetCommandInfo(gInterp,
- "tkAboutDialog", &dummy) == 0) {
- TkAboutDlg();
- } else {
- Tcl_Eval(gInterp, "tkAboutDialog");
- }
- break;
- }
- default:
- GetMenuItemText(tkAppleMenu, theItem, name);
- HiliteMenu(0);
- OpenDeskAcc(name);
- return;
- }
- break;
- case kFileMenu:
- switch (theItem) {
- case kSourceItem:
- /* TODO: source script */
- SourceDialog();
- break;
- case kCloseItem:
- /* Send close event */
- if (TkMacHaveAppearance() >= 0x110) {
- window = TkMacGetXWindow(FrontNonFloatingWindow());
- } else {
- window = TkMacGetXWindow(FrontWindow());
- }
- dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
- TkGenWMDestroyEvent(tkwin);
- break;
- case kQuitItem:
- /* Exit */
- if (optionKeyPressed || gInterp == NULL) {
- Tcl_Exit(0);
- } else {
- Tcl_Eval(gInterp, "exit");
- }
- break;
- }
- break;
- case kEditMenu:
- /*
- * This implementation just send keysyms
- * the Tk thinks are associated with function keys that
- * do Cut, Copy & Paste on a Sun keyboard.
- */
- GenerateEditEvent(theItem);
- break;
- default:
- TkMacDispatchMenuEvent(theMenu, theItem);
- TkMacClearMenubarActive();
- break;
- }
-
- /*
- * Finally we unhighlight the menu.
- */
- HiliteMenu(0);
-} /* TkMacHandleMenuSelect */
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacInitMenus --
- *
- * This procedure initializes the Macintosh menu bar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacInitMenus(
- Tcl_Interp *interp)
-{
- gInterp = interp;
-
- /*
- * At this point, InitMenus() should have already been called.
- */
-
- if (TkMacUseMenuID(256) != TCL_OK) {
- panic("Menu ID 256 is already in use!");
- }
- tkAppleMenu = NewMenu(256, "\p\024");
- if (tkAppleMenu == NULL) {
- panic("memory - menus");
- }
- InsertMenu(tkAppleMenu, 0);
- AppendMenu(tkAppleMenu, "\pAbout Tcl & TkŠ");
- AppendMenu(tkAppleMenu, "\p(-");
- AppendResMenu(tkAppleMenu, 'DRVR');
-
- if (TkMacUseMenuID(kFileMenu) != TCL_OK) {
- panic("Menu ID %d is already in use!", kFileMenu);
- }
- tkFileMenu = NewMenu(kFileMenu, "\pFile");
- if (tkFileMenu == NULL) {
- panic("memory - menus");
- }
- InsertMenu(tkFileMenu, 0);
- AppendMenu(tkFileMenu, "\pSourceŠ");
- AppendMenu(tkFileMenu, "\pClose/W");
- AppendMenu(tkFileMenu, "\p(-");
- AppendMenu(tkFileMenu, "\pQuit/Q");
-
- if (TkMacUseMenuID(kEditMenu) != TCL_OK) {
- panic("Menu ID %d is already in use!", kEditMenu);
- }
- tkEditMenu = NewMenu(kEditMenu, "\pEdit");
- if (tkEditMenu == NULL) {
- panic("memory - menus");
- }
- InsertMenu(tkEditMenu, 0);
- AppendMenu(tkEditMenu, "\pCut/X");
- AppendMenu(tkEditMenu, "\pCopy/C");
- AppendMenu(tkEditMenu, "\pPaste/V");
- AppendMenu(tkEditMenu, "\pClear");
- if (TkMacUseMenuID(kHMHelpMenuID) != TCL_OK) {
- panic("Help menu ID %s is already in use!", kHMHelpMenuID);
- }
-
- DrawMenuBar();
- TkMacSetHelpMenuItemCount();
-
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateEditEvent --
- *
- * Takes an edit menu item and posts the corasponding a virtual
- * event to Tk's event queue.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May place events of queue.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GenerateEditEvent(
- int flag)
-{
- XVirtualEvent event;
- Point where;
- Tk_Window tkwin;
- Window window;
- TkDisplay *dispPtr;
-
- if (TkMacHaveAppearance() >= 0x110) {
- window = TkMacGetXWindow(FrontNonFloatingWindow());
- } else {
- window = TkMacGetXWindow(FrontWindow());
- }
- dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
- tkwin = (Tk_Window) ((TkWindow *) tkwin)->dispPtr->focusPtr;
- if (tkwin == NULL) {
- return;
- }
-
- event.type = VirtualEvent;
- event.serial = Tk_Display(tkwin)->request;
- event.send_event = false;
- event.display = Tk_Display(tkwin);
- event.event = Tk_WindowId(tkwin);
- event.root = XRootWindow(Tk_Display(tkwin), 0);
- event.subwindow = None;
- event.time = TkpGetMS();
-
- GetMouse(&where);
- tkwin = Tk_TopCoordsToWindow(tkwin, where.h, where.v,
- &event.x, &event.y);
- LocalToGlobal(&where);
- event.x_root = where.h;
- event.y_root = where.v;
- event.state = TkMacButtonKeyState();
- event.same_screen = true;
-
- switch (flag) {
- case EDIT_CUT:
- event.name = Tk_GetUid("Cut");
- break;
-
- case EDIT_COPY:
- event.name = Tk_GetUid("Copy");
- break;
-
- case EDIT_PASTE:
- event.name = Tk_GetUid("Paste");
- break;
-
- case EDIT_CLEAR:
- event.name = Tk_GetUid("Clear");
- break;
- }
- Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SourceDialog --
- *
- * Presents a dialog to the user for selecting a Tcl file. The
- * selected file will be sourced into the main interpreter.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-SourceDialog()
-{
- int result;
- CONST char *path;
- char openCmd[] = "tk_getOpenFile -filetypes {\
- {{TCL Scripts} {.tcl} TEXT} {{Text Files} {} TEXT}}";
-
- if (gInterp == NULL) {
- return;
- }
-
- if (Tcl_Eval(gInterp, openCmd) != TCL_OK) {
- return;
- }
-
- path = Tcl_GetStringResult(gInterp);
-
- if (strlen(path) == 0) {
- return;
- }
-
- result = Tcl_EvalFile(gInterp, path);
- if (result == TCL_ERROR) {
- Tcl_BackgroundError(gInterp);
- }
-}
diff --git a/mac/tkMacPort.h b/mac/tkMacPort.h
deleted file mode 100644
index 41e0615..0000000
--- a/mac/tkMacPort.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * tkMacPort.h --
- *
- * This file is included by all of the Tk C files. It contains
- * information that may be configuration-dependent, such as
- * #includes for system include files and a few other things.
- *
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#ifndef _TKMACPORT
-#define _TKMACPORT
-
-/*
- * Macro to use instead of "void" for arguments that must have
- * type "void *" in ANSI C; maps them to type "char *" in
- * non-ANSI systems. This macro may be used in some of the include
- * files below, which is why it is defined here.
- */
-
-#ifndef VOID
-# ifdef __STDC__
-# define VOID void
-# else
-# define VOID char
-# endif
-#endif
-
-#ifndef _TCL
-# include <tcl.h>
-#endif
-
-#include <time.h>
-#include <stdlib.h>
-#include <string.h>
-#include "tclMath.h"
-#include <ctype.h>
-#include <limits.h>
-
-#include <Xlib.h>
-#include <cursorfont.h>
-#include <keysym.h>
-#include <Xatom.h>
-#include <Xfuncproto.h>
-#include <Xutil.h>
-#include "tkIntXlibDecls.h"
-
-/*
- * Not all systems declare the errno variable in errno.h. so this
- * file does it explicitly.
- */
-
-extern int errno;
-
-/*
- * Define "NBBY" (number of bits per byte) if it's not already defined.
- */
-
-#ifndef NBBY
-# define NBBY 8
-#endif
-
-/*
- * Declarations for various library procedures that may not be declared
- * in any other header file.
- */
-
-#ifndef panic /* In a stubs-aware setting, this could confuse the #define */
-EXTERN void panic _ANSI_ARGS_(TCL_VARARGS(char *, string));
-#endif
-#ifndef strcasecmp
-EXTERN int strcasecmp _ANSI_ARGS_((CONST char *s1,
- CONST char *s2));
-#endif
-#ifndef strncasecmp
-EXTERN int strncasecmp _ANSI_ARGS_((CONST char *s1,
- CONST char *s2, size_t n));
-#endif
-/*
- * Defines for X functions that are used by Tk but are treated as
- * no-op functions on the Macintosh.
- */
-
-#define XFlush(display)
-#define XFree(data) {if ((data) != NULL) ckfree((char *) (data));}
-#define XGrabServer(display)
-#define XNoOp(display) {display->request++;}
-#define XUngrabServer(display)
-#define XSynchronize(display, bool) {display->request++;}
-#define XSync(display, bool) {display->request++;}
-#define XVisualIDFromVisual(visual) (visual->visualid)
-
-/*
- * The following functions are not used on the Mac, so we stub them out.
- */
-
-#define TkFreeWindowId(dispPtr,w)
-#define TkInitXId(dispPtr)
-#define TkpButtonSetDefaults(specPtr) {}
-#define TkpCmapStressed(tkwin,colormap) (0)
-#define TkpFreeColor(tkColPtr)
-#define TkSetPixmapColormap(p,c) {}
-#define TkpSync(display)
-
-/*
- * The following macro returns the pixel value that corresponds to the
- * RGB values in the given XColor structure.
- */
-
-#define PIXEL_MAGIC ((unsigned char) 0x69)
-#define TkpGetPixel(p) ((((((PIXEL_MAGIC << 8) \
- | (((p)->red >> 8) & 0xff)) << 8) \
- | (((p)->green >> 8) & 0xff)) << 8) \
- | (((p)->blue >> 8) & 0xff))
-
-/*
- * This macro stores a representation of the window handle in a string.
- * This should perhaps use the real size of an XID.
- */
-
-#define TkpPrintWindowId(buf,w) \
- sprintf((buf), "0x%x", (unsigned int) (w))
-
-/*
- * TkpScanWindowId is just an alias for Tcl_GetInt on Unix.
- */
-
-#define TkpScanWindowId(i,s,wp) \
- Tcl_GetInt((i),(s),(int *)(wp))
-
-/*
- * Magic pixel values for dynamic (or active) colors.
- */
-
-#define HIGHLIGHT_PIXEL 31
-#define HIGHLIGHT_TEXT_PIXEL 33
-#define CONTROL_TEXT_PIXEL 35
-#define CONTROL_BODY_PIXEL 37
-#define CONTROL_FRAME_PIXEL 39
-#define WINDOW_BODY_PIXEL 41
-#define MENU_ACTIVE_PIXEL 43
-#define MENU_ACTIVE_TEXT_PIXEL 45
-#define MENU_BACKGROUND_PIXEL 47
-#define MENU_DISABLED_PIXEL 49
-#define MENU_TEXT_PIXEL 51
-#define APPEARANCE_PIXEL 52
-
-/*
- * The following declaration is used to get access to a private Tcl interface
- * that is needed for portability reasons.
- */
-
-#ifndef _TCLINT
-#include <tclInt.h>
-#endif
-
-#endif /* _TKMACPORT */
diff --git a/mac/tkMacProjects.sea.hqx b/mac/tkMacProjects.sea.hqx
deleted file mode 100644
index a4dbd68..0000000
--- a/mac/tkMacProjects.sea.hqx
+++ /dev/null
@@ -1,3718 +0,0 @@
-(This file must be converted with BinHex 4.0)
-:%A4V6@&M8(*[DQ9MG(-ZFf9K!%&38%aKGA0d)!!!!5F$!!'6Y5MI8h4eCQC*G#!
-SBbNa16Nh,6%j16JJ3@aKC'4TEL"6HA0dC@ec,#"*EQ-Z,#"SG(4`1Lm[Gj!$,Q&
-XB@4ND@jcHA-ZBfpY,e0dG@CQ5A3[$3SD!!83!!%R!`#3!h)!!3#3!h+H#JfPT9*
-PFf9bGQ9NTD8!TC!%!3!!23"%YeSN#ER+0Li!N!d0(p)!N!26!#TU"`!"*M!!!R4
-V6@&M8(*[DQ9MG(-!!'l0!*N"63*m!cX"`2q3"!)HrrMrm-Y!!!#!!*!%!5i,TC!
-%!3!!1!"%Y[&1mlEa6e`!N!0b!!%Pk!#3!h)!#*j@!!!",`!UD#%!!55j!!)Y2L"
-#G@PXC!!!NqF!G`!$!B8#)`(!rj!%!alrq2r`bd3!!)!!N!HPN!3"!!!e!%5d(A&
-cZFSb"`#3!p-!!564!*!$d`!&k(!!!!')!#TQ1`!")dN!"Ldq)(4V!!"4'J"p!"!
-"f3(k!F$rN!3#([rirr$,3!!!J!#3"k@3"!%!!$S!J,5Kk8#h64Vb!!!",`!!$PJ
-!!!%[!!UlRJ!!USS!!!ab!*!%$`"8Dep04%9',Xq!!!"!XNe08(*$9dP&!3$rN!3
-!N!U!F!#3"N,"e+m!ShpY8pbfEdh,f+P*HUj[2"9e3-k!SAj`@SQ0BeALjCD&G!e
-H`rE%$YFh)m2m'P9a'jDKMm&p[l*Xd1VSUmTrp(-,R(0)+CX8h*8DCEbQZY)G!kS
-N[r'lPccY[hF&9FRKCmd,$#"8KX[+8!XYfbABbfMpe20%lmFrX))lpZ5*6q#mV9I
-L'2lL%8KQKr,Q(j0XLC@iL1V'6NSI9$b,LTc%c1D-R4Pc!djpZIi`RM[hS'D06Z4
-c"NfU8YM8f%Dr!q$CHfc6kkfR"3)S0d"D0&E#AiLm)bk!a"8!*cN5CTHI'6kb[$b
-C6e61M9YPAJk#cM[I-PGRjf685IAJ$c&JBFmiTk-AN5bNFHUDrS(cU!CH9mjDcFR
-mA-%#)DkJ&$rGfU%UCI#Pe*K,%cIf@Zfkc((03"b9[S2U51T+-aB"%AQ'EmfNUrb
-2k@1jQ`pFQKr14ID16DLfC#QkqLlNr9RRMNiB$GlZ"31ZGBJNk3XCI-l-%,5NdP,
-LEhdPX*VG[iQaI"IV93pi83#21F0pM5p$#104XQl+)ZmcV5**rR!DIijDZa"rehZ
-YqGEKK@lMp&d*la-a%*AGZ9kT6A6`H"PQ3kLAmljV,S3B+29-SqMV`i,*1$33FfV
-#8K-TRbfMY*FX'HM'P9-3k9LIi3ajNadfimF%"r&8`Seh@UA$$)iI64YkrcP3,R`
-%6"mG3VhP)i'ReraXSG4QJY21T2i,2m"eQi%ifNlPhY0+k--LF383V,+k,&@@VKl
-a[pMFeFRMkj4",5HjV4XKqBi1dAFe!BPBBS)F#f%ZX)"@TC'b@V-E3ZJ1XZ9RZNd
-p9eqRhF&PS+f6(XaCKHaSiH+4Te6bbA4,4C0VIjbHQMJfi)@(VQD!k&%VA4LpmP)
-D!KP#TZ1iK6V*(#FJ961AKXY[)lGXI(+FdN6kPl#!++9J-%$-Q+%mZje$A*)k`Li
-ZQ[4j"XQV&@BDPSME[*+DQJYaU0Qqi(fmf1R&FajY,PQCPA1Z#bPLej!!V,5J+6N
-A(V(SF3C"![9P5dfXMiX3@ZeS#b"ZebaZ2"+&SEC*c6qL!A3$l`S-k0XY&#`BJGd
-EfJh*ka9`C"+U3Hcq6H"Lc1'#QmIFCaI3Lq`&ShcY,fcl)B8PJT3aq5mLJ*lRfpH
-5KJ0!LS,UeJm#hC!!&RM[+&M*DKEr9GdcTK+j`bhQ#"Gl&@U0q2PK'GX%eMLSf5@
-G![S@M!5Gq+l`rHrH1S!6p%GRLGLUcDhTFc,6X'b,L3+He01fZXNck090))[[38+
-e&d4A4-KXbGTKIJFUN["NB('MN@LjdZP"ZJY4m,Yl&S'FPIEE(jh!kPB0+dY8h##
-,'5IlRh8L1%0E1l)XphLM$Kq$(NdrLHH2!ePKfA$cbY)8kR1TDq$DpRkXFDq*i%S
-lEG2a0"8A-%XkkMqlI#5,[qC"Y&eM[DVR!)J,1,XrRA`B,"DcPPl1fEp)Td*-E0N
-C"J$le2LE$[S)cYh'+Nk,D*BFT""VT$)GQ6r!GfQ*$8YhN!$h-jY5Kk,E%lmpZdj
-@DG0B+jTXP%3*1cJA@c,I&%JCNBBU[0hU&eMBKK'Z-23pNbhljm*3Jd+N(l[ZB@-
-kG8YJXM`fDX8GMCU*`pT%5Gf8QJd+l,*hG4*j-2&`PbHjNS88A`hPL4Xj)p&!$d(
-!3dS%@Lk,IS'%56,Da[rFJdj0dd9X1#*fQeApGIdPDkL!f&`K!+1h0!CA*,6Kq0E
-`qR@!Dc!('Vc6h9lFS*LB%j&b["N9!DLhfflMD5T6h"C+0b@"c+%qP3r"1,4q9)U
-kBik('`qmb&4iR8VPEK!@6I()Vp!2#6PHh"%NFRfYX009lZSM3LLcViD2@)9DH#6
-1S65C*p4SZk@Qm%%BYAp(U6AjLiS3HE4G0$S'RCe*[CD[5Mq%,E*&)02iHR6jDPp
-08C%[93G-$R*L[Ll&[Y#pIrY8%(d,+2I`C%L2ji$Sdel4#GT-c[3*X*RD52maR[8
-kIiK#h&NCFIN(cfp8ei5I+5['Bh5P[99)jc+Lim2mCRp24`54e-S$FI2UbrR&Eca
-3-G+X50#kaMkI[''4304P)8'C5#M1!VDd1@I+Ie1K5lhFHQKJiIRb'`!Fqk0#!5p
-#0Iakl@+55#YR"MEm[JTe09L-AHrIiRETS!f8E2pV3*[0fD$ih$$@-qm$+`eA[93
-h8pPa66!H#@a%I%aZ#R226eC-)8J[%I`,-6KDBPdjETaDPmhZVA1HK$hH2S+EibV
-'',rLDL(qL@,44j)b8SHF[P[b!Vd#LlVLVNq*dfbhU'*S,K3$QE20DN1V6D5Md!M
-cf#!Q*C!!jTN+ai*!Y,j6+31ZY45GiZ[-%N5#Dr`ba4CI-fMYAbPi-NNbG`b&PBL
-p1b#6qRZGVXMj3UF'%Fd(R'R5SJ4F'*M-jPL"Mb+A4(H6B+3BL#3Y)%Cl&ddA#I,
-bpAhrp'Y+9(k8k8@5UJ#Y8(h(HDP8dPTlPmTkNP'3!,m6EYQbN!!(eUIp0id`103
-5a10GZlJ5EMNhb6!pS1+rU-EZd+pApdSEc`JJQH5JeiZ5h80F"Kep)$P)k+J(TTr
-S+H*)PmCCIIVJ*'l6QG#T(H(QaKH26'FI3I0XL-c"T`4dMDqHDKf#DekIV&)@X*!
-!$R'#UQIJeK8bR)XSiS9F-pbQ5H`QQ*S$BeDjpT5LA+0A"@Sp1E'[d2)UXi$BAkd
-UrjE4G5G$rA!LFJpThmaVdXLrI)qq19rr1G#1d5L&qi%'*K%8&B8P*fC)e)lbBC!
-!&l@81Aj1V6LK0IXd6R[G*%*1FR4`3kMaT'*keMlXU0RXr-&lP-''Zd1N4P5Q5(D
-[lDDJr5"Tc!Q4VR@iKFU6Bm!3h%qC50UZELG2fX(%0YLEc[fmr%F6r@K!i`!RV'#
-+'S-SK`l*4%D+A[48S4k6@,D)LBDp"'RFrQLqKIhm"MT(L+Z,C4im'&Zk4VN#2*P
-U1kM'5qF9R@Xk$&IqQDNMM((&5p5*Zf&eE!hM*h,@2j!!Qa1lL2DC#Qp*N@krY$-
-+&qfV&*LV26!f3Xj4"X4#-b(1BFL$61!mSRdqJ#%bhEbj+L`RmYUqi4PL@9TH+a'
-M!hIm+A6c4jmd@Z"+-0be2Z"YVK9K-L"mq!0#2%i8@Ehi6&@HD9IZDLj*'EN8USj
-3a,pBPP6*cI1Mcpi)b2fJN4jB4!fQ2rFM2KIKJN84X)#EBlAdjP$jp`[Dm[p(ke1
-IK-Va)M+E5j8NK@F[4aQQN`"L(dUQh!0#DDmL+0TQC%lal[54p[)jKeUQ9HHr`c$
-@fcP%QDDS&cZamHhTDT,@T(Xc$6K*"!`F4"2Dq+RpADF15cjb(0BmC``8iTSqFcI
-N'(qm-L$GBLGE+YDbA[EK4U[V*#+(SMaXmC,'&I2PKVrEMrb&@*iK2d,2@9SNADh
-1f2bYbjkXNVZ#CA@ah8e#L&T1IQU0h#ae9bCXr"pj9%qBPFM3fVUrZp!k(iSe'ek
-Uq8$LcY['KRE"CJF+eLRB)`f[9hDAK"Cm1$U#J5Qh3qPS3*JFD9pCVK`&IH&[2#A
-%eFMU40@AM&9H[mNL$#Xj$Jqq`T*Yc1kSFb+VVAjj*'C-G#mYS#i)Ib+Nf#Li*"Y
-E@U,C*`mQS,05kcR20V[Hd'MqhX,j-5jc#(%iKY[TXAb[S$AfH0U,0`U$V@'*X8p
-cRQYT$mUc"lEZ0ddpLp-,TmU3!2aN#LISXU2!&MEaHH!$0eHqNP$2k(JfCVR!9f)
-M5XTLDU%Ym3@-3MNh@i@b(l&Njp,k"'fLplMbc&KUa1d,9UUh`8T`JG,!HAqqc#&
-E'ia@J-!MZ*rZ2fmk59F&`jU2l!EkpX31q1(40!DLcZE9E[S@KYTq*@[2cq&A501
-mXP6P1N%iiFS#*50PI%i%01ZQhKmZSKPV2`XmLT59iYfG56Librm$M*`'El'$dqc
-VDS68!'PVJ&V52Idd+V1a&R690+YYSBUV3I!klJZ5pc'G#M&pV1TH6jS(9KrbQlQ
-JD(VfqC&p*lU4HLX32r5Jrq(+Mf8cad+DS$Y*)D'SABY!Sjad52M5Qc,'i3Fbd#Y
-a31X-GbPdiP)US8m`8p5ilGb9[E9r9YN-hNX+fjRRR*RJQ34KaEK!))aKJiC'"`"
-YBjr"pP,@9cJCM(DM-ZPeA!rReSrjalTQNc+@X@4-5G5LjD@!VNC8'YIGkFrS#VC
-%LMpKUXe4R+4@pabL9V)j`dF1+d93rFCc'!EiR+qCr$*9@-*AB[T*3Xm12S31(IX
-heIFq4D8dUc%UX,[rCMSH9L30,0LC2fNZV$Yq01GL'G8%!!#PN!3"!!!q!"#i)p`
-(Z#2F"`!!!BJ!!"i(!!!",`!1Km`!!2"0!!!263#3"!m!9'YI684&4Ll2J#jiE@`
-!!(2"9%9B9%0A588"!2q3"!#3#S!!N!G#`G6T*BNSlI8[DSa1RMMR#l)FH([BdN#
-briKlm@-Y"[+C#`LF@90GbfA@VaFECBeY#K%'X$!1d3le`b4Z$Qr"QDkbeI8T0CM
-@H+&Ij16B8hX$T(RZPka18bIBiHYa2iTmq9mbYaK#M91Ei#94k[5LUi5%I'5q'#!
-@k@415brdY(L9fN4`YQXE$)!DB21jk#IKGVeLkL!jelXf!ZDAC!@pqLUbHBhVSK5
-'paDEPa[+QDP@mYjfXqj!c86ql#Eq!1ji)$)EbjVc#Fdp4C'f)aX0F)JKDa6fCr)
--"PUD!92&Y+$ahYSBTPpSMh)GS+2Vj0$[Ba8dH3R8FPKlKD5#aaHKb8+BCRC[H$5
-#CPXKHELB(Lrhc!$c`dFrMCH@Bakf4RC+E!#MK9cDFcS56)&I8XFp`jiJqV)ZjC(
-fR"b&r*e0XHrZdRlG+8JK1'a*l#pY%*QEN!"F),P(`A2CQaHYjG#6AQfL$e55K*r
-S'ShVHcPdMl#I6T!!V,-'ip#h$*QfFNMerC`NdiZ$X,J6%AF'2rLl8G5,*0pqeN"
-8T'a`e6%hQTS&f*UlH"a&Q$J!LXB%!df!6'0VS1al3Xd38U$r*-9cVBBHJcjPek*
-mR@Db&!hIeSLN5-GSNp+5G-ACLp@CdYD*lF6CapV[TcBlVEQkfXKJ`FI6XTD,Zr3
-P2Y)-5J*PJZmkfB-6I%IJeNiR5UDTkcq"Q[De53USpqpjS5VDehV82Q34r[crB`e
-j-i1-XPHN2#%%ljre6"['-h@4(56YcqMZRMNc8@MpFRS&"2Zq$ZA0%1!I3Uep4#P
--2FD"5G3[A!dB2X9KLk98DF$2M!jUGRD0qbkUFT!!%VV-ASjVZ*S*NqI,'LM8ZiU
-2NcSh#$EjfYMX8M@(cX!AC'cY#3ZUZ(Q&KNbS,*'LD9`b6N@MH)fJ$PEY+eH&VcP
-EXd!%f4,A1ZJ)0L3)Al+*bIA963GcR8RMhI6)+Dp1a%Z(Q-fjbNPqRYfmFYi4DeE
-VF!FZhS3EQ@2ql'hT04$dPj*k'@QaDji85L(N&0@J2Fb-SFVCieV12UL5FYPeIKQ
-KK(LML$(Yd#H(4*Ub&*ZA522%0T@SS4[e8XIfZD[Pd8"dZ"94CTCGKS,0*6LidrY
-XbmQT&AD,b@3%SDf"36$SiC!!LiH$q$AdaHd#,,CB2j8S+a3daLX*&c,$9-kPDHK
-Qmhkcfk6e*dG1BSS'pB'L*Sbd)"J'DP9NB2eRqr$*,aV&G9L[48!Hm6$Kbk+"M'J
-&H'eRFKe0Zc+kDi`*54q-9NJJ0X"G1e0pi`+0ar+Lfc-Idp,d(`(TTL9ih@H-9&F
-h"$rY)HG5dKGHFB8hT6qa$fM+08r@X)TDSZNVVDcT%RkKjMX&@ldqYP'hE*Y%Cj!
-!&Y'ZP+%Pc2(UlP1AC+H14,K6kS+)G",bmmkQ4!&`J2S+iAUe(*JKRq3Vk*8!h$#
-a"ATKKCi(2C+TXH`4DjbAJ-%%CPBp9(5J4J''ihKbC+emrG&JA42E(%Kqb,jk`Fd
-QBPJ[0&5AGM"UP(c5SeP[(mK486IHTDV%@0'MNfY5D0'&!'PbJJIq6KQNNjd5-T[
-K64$VX%+*@Zb#@FR*GjfSY312a2N%`U2JD+%l(Z*EjHH1SbJ6UdTd"CT2l'q'qIG
-FYPf4R2KD58DX#V0jc)KhbX,E9"r)JKDq8B@ZE4!B$Z"IYMrQ6lj"2UI6p+D3!&q
-Z1iL#"lCpjqim@)UeR4dkX`YNJ"l6iVY9NkHX(Bd4`CQ6&R35TJcL*G9TDhAGUTN
-aZp"QDN!RQ!5#bH&H@0j-3!A,$CV&qAK0kG-65b$hDdmV46kHkq$2F8[1'al"L52
-U-HIBk0P[2R,h,@)NYJdSDm"3"LN6mm"cidkqf[(6+f9UVHqS[eVKpm"TL#((EH6
-BU2+kP9L3!2[ZX#d06([X)HU(qHJZ"KCB,PZ,pe5SMRE0hX$6qZ@eliriaD39I#N
-)L*LCI9mJl8%'3q$'Lq6GqE`hRp@2*J-GTC3$P,&Ba55B0K8TfBbmDN*SQZJrcjb
-9q+H1X'EaQ[T3PG+2%U*,3)HZmf*jQce+MYa'rB9FU-YVdL+k)59XJ+NV'K"["Pk
-J`f3!)0U"UL`Sqlf2d001NhfJDacJ``$1D'`X#(kc0TebHrBcAASH#cD`PfRXRrb
-PY[92RI9$8DF*Qa&FBLL$rVB#%*jRa(J2jcUpc3pXPkiq@Jje-6UBEQ4)`5342Jk
-##8%dT6,LDlRY-Je-mA$&H3m3blk`"CVYK'+%rDrLljm*K1)B@j!!V5NR-$$ZTa#
-3!)dE%1jjc1I"EG,[(`@Fm%NiPQ40M$SDPbHTiI$9L0Sl113hVH05GQf8$8SH+ed
-4&1*reI[$Vcil&ACGa"`4b0j-5X5#,C8-*ih+eKK'HcABf0q--hNJF"KH2P)bX$c
-Z5mSTCVE,['Dh)&#*PdafP)rNAY30)2CJacc3,i`@-V)@812PUYV`%U)hS$3Q'D&
-rBKDb)!*mDi8adecKQm#'[12l*l*dqI0Ea6+8K3ZKMhA'AG5aiMi88h$AZZP#X+H
-%)#kaG[f,,(Kp!`R8#ca(DFMrCQPLc,&Z63lD'j1S81"!aXq4M'5J,$[mm`kT"!j
-amMS4PeN%bAAP5jm))&mF)-k`cY[dHcTTZPFYEQ#2!UrDElCVIdfji0GNd2&BK-8
-XM[d`!*&ApfF"P'3iD62ZQlMX6r2kZSa8VGDGr8ecL$a1!CaESqPhr-0K8q('X"Y
-$[)q+8h0-ih*R!Z-pPmIY2)3,Q,cB0b5*Q&'ZZ+8DS8f@%Hf2q2)JmEZF"`*YMF3
-)%'LqX8ZT@0@0`-`d0B4DPlH0TPHUZ)bU45p#2&1"qYZqT&%I6R'3!-HHaXEacji
-p[PEpb"F@[hB&fERE'LAd(%1URq-@kBrp'dbLjXFb"Z1!INcljEG1"%[RAqD&V+[
-3'LBeA$bISB0[EB1mA-6[X2bjScddEHR5F"k-G#BTD4fYmNL3!2`Zf#m*K,dPBLJ
-22-51(5lrL8qiUijfCQZF8RqpPAUhrVX*rKPD6FY5Y5YeV-dR`c$qiP$"ebS*l[b
-[`Dq`YF4kfN1f@fC"UG#ka&*6AmVjGcqPLGJ29Y-12rTfl%(Hqd(SpZ+mrcR5'38
-A01LM"$fKr)m%D2c@-i`mJ(bf8%IhJA)k-C-h*j'HH$6RNbV%U8AlKm6L[fe@AM1
-PjIK0'm5-@(U3!#N[lI$PDF@Peq+LM@,NSmX#6``Q6cX)m5lF2"hcHT-ihN-KU5Q
-i62C#*$fmphfL12fma9[!'(*9E-'pdZAmPG!EE1K6S9k3!*YRFG*KN!"AES##&50
-`lSRq9[-5b+iZXjG&f$G"3N-E`h8fp6Gr-XH"l!ZK9fL22(6R5Da,`0ap'rS1V0[
-(@G-9+Tm`E,5$fF'V552E2"&NL`'T%V,D)523[M5'LL8kSR`"lC)jf*45rA0C@`&
-E0V!9M&-3Eq'&hNEHS,r#b32EDIQ5&dT!kTiFArY"CL*`qhA)pD)m+!UI**-2-J6
-8(b!eCJ%0f'J["U&&CpGYh0Di!X8k+PS'lSECAaXL+&!*r[rH8kA&Rrkr,'I@FH5
-TIL"6Vf!bDTCHjf@NAV9-kAUiRZBm9'cFfVB2388[l+e8Elc"qHf&#h+4cSd1YBi
-M$+B#L6T"pccf,)d5,AFHN!"ammYdGGC#'C!!Ib1[@YTk,ejj#EbUj&q-T[i4UYm
-@PdE42fGA,C!!6F"cj4)UEr-'[J(4J,pQCJ0("iFeNq3j[S!B(&SrLciDr%2$jXQ
-UDMjTIjT(qT4IS(V#A@SdHb9C5"lbXQGh[e,RkTeXEZ`aRXCh*!Cc!jXTI6,a5D&
-(RjG(@aVj4pbkR(c)1P"U&I,IC5G6hZYDcHUK99P&FE`!G2BrXD"Sj1H4Q`S(%!-
-m[Br2L8!,&e(38jppRmDU(f[F4&!rTLehC4RHKXA)5CAHP`Sq2Yb3!!X+c5B)PF,
-l0[!i$B``Q(,+CikL5D#L8C6Nh#B1K+5a#ck%*PrIPj`)lll4-,LpVpdb-LY99)'
-V-6S*,d(e930*#Zj+V(YG'&8)8"!G2LXM[pqIDHYh!%N'a4XlbaX@##1km#!UHiE
-Q#d)+Q#N%Q0Q5NA+`SL5Jb5-)i4T2-U,VVp0V`,He(F[jJP8Z38`DlG-b`IYD%i[
-eV4Y@`QHU[mDJ"5q#pA%2Yq(!,$@T"Zb*Lf5mkePD6T@GqbT$aZXS`fbeLrc",8)
-MBEB#Ydm3YAhDlFAE-NTleD5&G$b#P,5Nd3$-HMl%&G(H3qd%A2T0Q8K*$-G@G#)
-*"mM[dqde!8Rkp2&bZG21KimM06%02&E3qXIjdm$Tf24h+9*c!K93E8X6%b6%A0Y
--Xef[X3%L$pPe&RT*!B(Z3i0I&!eJQ!KJFCC(U2MHH`VcaFdK0D94(fH##FTUBfG
-@ZmH&28L,#DKHe969aSliX#&%l1010+8bSh'R[F4+58LdN5XaePMEiMZN$@9UAB0
-(,8#"1AkY#*`'5Ra0"E33a5SE)*[Bc1`Rkj1Zqm4$j&abq2@`HZ)V6l6lCq(aYbN
-KI5Y9pma%VANU%J(EQMi-T2c+lFHq4dpRHbCG6%@aF$!,ri1DF3Z8TDB#m@JVXLX
-cr',mF4cUM*F@kk[3j,(ikYL06@'Q!XST6q$CKCDY,p%CDfZRih@mZ[`9eiIPSH(
-eSQIKX!-'&"Ice"Ml)rLA2p`e)U+T"+VSZf%%rH,QT2PlIqB8Lc%V+*r*+Ulbe2J
-P(DkKGJpfh,[U2+f@&CLI95'GQNX10!Xr9Ra&9-,8`jSXG`dd0[*k,`i*mFX6@"c
-b9JX0lNkE&K+YFfcB"3-+pCm81QPr"%4#1Pf%fKP**h`i@fVKD(1%'P%iPp)[p`+
-AMr(b@0d)cK$%*M3d,l,Mm2m!BYN8UcJPN@Q-ZRIiYFXfEk#RKf2fqJh)2lPmSe,
-IdXe*X`[1GCSdQ$'2`"$CT8qQdXbBfeTJAT!!ie`mCSZYNaPVH41SX#+mZ#d`N!"
-eFelhdYX0UPk!0Aa1Vbb&5TK1REK$Y3K(B!jZHY#$rmV%41qqPpPYB0bLmeZdQ@!
-p+[@deR&j8cNFL&5$9(6AXQE-N!#h[k5a(!$T%Y1QrPZ#-L#2*"XTi0%BDV,I`Xj
-+X"6!'F`E+LYp9TCd[mTS5eGriQRP2f%,,IE5'1r!RbBJ"4KUfRGN`)i$iqlfm`4
-plE0e,ES%2mGBc*CM&DU0Y116qhd+EN$4T@a"N!!NMPHCXX3+*&P`$S3CB-pq%J8
-a0f'Lk@*8$qj@1[a)KHTES1XAjqPlSf'2i`#PN!3"!!!q!)#dSHR'ZFE#'!!!$PJ
-!!(CB!!!",`!1)I`!"kpM!!"Al`#3"!m!9'Y-D@*bBA*TCA-Zci!!!%#b68e3FN0
-A588"!2q3"!#3#S"`!*!'3X(9%)Lf[k"9Nii4G-`J5jTGUp)0N!"U+fi$e2kMVXU
-#k-'XAS')A18f2@"E%B&4BfPe!3Z3!%-Lp(jR3+[C9$dhlk[qd$HL3fQX)k*,&lQ
-jA&MDFVLQ"kpS&BraKa8e$eZI95j8!8P58)J09EQF+)48"-DbCHR#Adie[!q21S5
-&TPckKX($#$86i2N"q6F9rE!BS6DU861NKbLqdR,b61J,R0Q+6*I""hi'C5r!lS+
-YNrYQqP[TcTi-CHKY@8)r,U,"V*&$X2&iZ)"eE%$S#2HPBDS*)'a3`*!!##KG-XY
-HX[+DaYNXBmJeS``Rai25"CGY8"h(XmV&IXHTq4q&@3,S'-38#Bc(R,l@bfG[(RF
-M)NEaJZ$ie5b'3dK8&dUiSHF9d0ImqHI3"UL(&QAfLP"#S8,BaXZc-IhKBEp0eP&
-3SC4BBbp3(9`dkqBHpF90b"GIeTN9*ZF*0A+(r[9"20ErA9p5`*PC[9D$Af0"Ce5
-@a[mhp)R-@fdqiRQH)(CVrAe0l(3IT4JidPDFk'r-''d9-eG,l3iD2(R@-@[84!E
-mbCaDMYq2c-l5)VT9J*J&Uj'qCPjP3lV583dd0QlLDL`qr16IRC!!4[KJr#h51#A
-NbNljNU2a2RX3GYK0rDdbClhVQk)$U!NHS"5kDilp'+5!#bKQ(3A$T'$e-)Qh5LX
-KaP)M&R3'fN"@J5h8C+'*iE(0-Bd'@-PlAV[I92A$Eb3CTD2jXe*d&$+LeEGmA3l
-LFD)8+-VHa@'T3)`*I#E-AqS&k[A4FF@`pCH'@kDTM8@(8`5r$Tf0`"SN&0%"r8q
-a-IVrLkA*@rH'*$#klCr(-K8Lppl'[cRB',3,GUq8Hk&@raI3cGd2c@ZaHXG#LRE
-PCL+A4UiLGAUF3-LVdKNRT$1B335dKM@hU5@j,cL)[f'KUKblK+9(MXqe!!Ccp"(
-'*jX$HK-FXS0CU`Jq`'&a'MiZdhjmc"c"aQlUh%UcT-$'#I2DiL*Ec@l8jYY0*qV
-PYGb"YHqhf48Kr'QSb"*c1NbhGTCT%NeM8iLZE[CJF80J946aiXBUj+SU'UU"("8
-p%e1ZBi$3NEZh)IYM0&++9B,jaq3(Jr3(RF'TSmX46*(-)0rrlb0'RYdca%Z"!YL
-akhcVhel*SQ&2hG61i)e1#4MACb(UC,SApf*D#QdYekC,MPICAJjM2!lKG185+DM
-M2YSS+G$&iXqS`KV[3B+bpq-Fb[Qi-BQ5NeH8Bd#)mLk-hiF5h8G8AR`PA0[6Tem
-9%C@T8%aSpBFF'q(k3X+(Pc!4ETKf!lLS4$`6FY5'!9bllJ9`m8VPS+rS4pakr(F
-pT&6bCHN9585'+bjQ99![F$Q+CfjVi@AHV-JY&m-9jqY[e2+YdZh,l*!!)Ai`6mF
-eQaa#+*-C8"'0Y#bGbV$9Rb6D$d)BT,[$hq@pibQJc9R'f3cS$Mbh#!5Uclm-I()
-qEE9Z,r"Y`Xr`i4Cq0L"5b*2i[VEAT1(!h[Vhefk4Jb[@4'm0cplGcGKM-el8Sp@
-XdY[cD0aIf5TjBVbP$G!QJ*!!pke$,JI(Pp*0!D(54JVhhdFmC'8B"SGHK'@fZAi
-59Md,-hjSDVQp6P6*eQSqAcY6G(2I4r!lB3EY0clY-h[TILA![%3`hXN(5Cj+D2T
-K"l&08maXri5&qKXN6K0U6PF*I!j5PYah9&j#2M5l8JMT0"D"1XlVddGh5p),%bU
-ISMAjmDj@ChUh$YRA1QpFckp9k9-YmC3lc6'qCKkhd,S!p`0-D8%US"#1DNi3YiA
-)iXpb'"5S-lZV'TlX((HF43Z##UNb,lHIbYD6VKpUa'Yf@mB'k6kI#%2YDfmLf0m
-TdERP*GUN(R!eQJS"9RIY1A#+VR'Mh-VVZN$+IV,UH,h#+%P-SpAd6S5"qjGV,aC
-UeXqa*QM#ShN3h&9SMCC,ie"T)(iU6i'23Mlqe0E+BU,l+Zrb+)F5'R'Y-1FZmY'
-Aa0leS'Tej8!Vi[iZ1UHhh`FSBH["@,SB2jLE@)`338XlN@C2UPjDVSB5Cj!$@df
-((J8fa0biP4dc$KEkJ412mTk&q9691EI$jck(&a,SHjBbN!#MbI"$qjK1*'&G3&i
-N2Gdm*TGQ34P0PVMp5#PT`PjefpLqj1BK+2iX9lCc,NpSSYaim-DNbC8!i@A3l[a
-6[*l3hdFEa3)-R$!QN4@`pC%#Ua'!M0Md!8Ta'T)kQ@DH$%f11-DX8#Ai5m--6ZC
-*e2ImZ60'NiBp8'PNZM!SSjqZfS&)3#8-X,T)[MQVGdV!2G6Y8)mS%"rX*[&Jd8H
-3!#m)(h2A`QX,E3LSMB,@fJ0JSKh%64[iIaqf)5GG"5LRRXG8(3Vi!-'fXDEi)P9
-Nm5h89b8'@*@U6!9cCCX$r1dSGJ66pA'MG0$8lK8jNehmR[5eRBMI8eJ2fb24MmB
-chB&qP+bS[#l)-H"5jaH2(Gmd'qV0#Kf!X6Q@i'Nm*S(UXX8'*$5fHlB#dk@02-G
-jVmEZU2hmqj8)VK8rUME48EH!NFV0IGrErB#VZ&@N"jeY[,XZD@[(JVqTI0Xq[[I
-@P@4dC"9`+3H(hX93aj`3@hI2(ABjK3"crecjBQY`K)3K1)T!1"TQ1l%eX$q3!'E
-`TqR@TDfYkS"&EQIAiG4Q(!K@S,I(TD8mAMXE&)jLk%3Z4MZkk%KkI+YD*0rERU$
-0Ki`q"[8"XjDiF3*H&N4fGiSGGli1BFFp[A2NBFAeS-9Bhb)@A69R#kU[l4XfFTE
-Q"ZV(8Hm'd41HLPf*MQ4GFY8jZR`)P$(#b&NV0JRZMbL%PMlj+mQIZ-j(YPQK!I#
-TTH'jN!$MC1mKDNVN&D--fMb8Ill1AYj2cV[)(U2%!mBjfq9'QX0eah-kl!aVMlA
-NLXc'RCZDmFqj'Hj92DXK"JqjeZQJ-HJ4mYYPqFr55Y%Ib-k%RljLN!!AJcPIMLL
-))aq6YC'd1SMdiEGTCaQb&4jGF!qUVSadZKdYmT,be$T3#'8jpHRa9Dm4#2Zd(QA
-6#*3mmK,P@N)9AKRbN!$T4HBdI)qL0&ei8PIUa!h0HKL3!%qK!Lad'pAkaQ#(AYj
-V&(rVHJ&@389hIl5(G$pB1*(!,!@eml-NDd3Y3@NCB,Rm@*M6S###[J'IXh1qUNC
-p(`HXpQ(")TK#4$%8DAG40!q&2JUe+)ar*iXNTPJVj-JUe[-$!F1R!e$BCGKjKV3
-!(Pdb"p!1jdF6iY#eD),#%!0$EJa@hfXqP!+-ZRIhGV#XiZ@NAk62k`j0C'$%Fm+
-2jYG$Cp0$a5PQ9C6-`l,eM#ImA"dl"9&G5D)Z044NN!$Sc+cLBAE-@bUmUj+1Jj(
-*P(Q0mR#VDQQkc#,61q&)eRV)3ElqE@GEI8Ql*`"$G`96CrIY1Cd4r-Q'$X4,1e$
-hr3ZACN#2"0flm0"kk`l,E-'Vhf#JB!h5'bFjT`VIEqHS+FATeD#&DrjUB2'9$$P
-)XJG2SiJIPNae9m!,k3lk8(qJ1Ka0851PTd@JXZ$4j!9kG*PS,lN&82F[XHJRlK)
-b"T2diM@P8PMiKRXkI)bNNR56AcTPAMV$EdT2D,H4EL-FV#EEk)Kip)c19B("Af`
-lFMpSbilIpE2rj`c,16jQIJ(Jk3L0B3BA-5((0E+VG6L&TSj)63c66D*bVG%*XTF
-DRS1[ZPX%@LM)8A!A'DbfHkhLlHYFj6"2f2ph"X(5,C9ke*P0"DZC@C3j)N$M&I0
-cC2d"k"#h54KRQZ$X[J!6DFLLalIh&"D0U-l4cR2[,B1X9@[Hbi8AhekLC,&CPfm
-eLFU%qi0'Pd#ph%NV-6fSZ2*Ch1FP"HM%P`qK+aXRLj1qpE5mVQLI0,[R(mimN!"
-aFRf5lUNSSk-p!4*E5Y[@r1P*dF)Tc9Br3mQp*&e$#l(hL*()"@qd'KLTeR@BHl%
-@6VHUT51A0MK*q4SfB!)(qU#58[-3H(eKLPI[rU$F08A"a@i""P4bbJTa4Daj1qI
-lMlP%@TF,8IY261CY055p1V&HQ&8FGXXdk8@Q!"+G!$lQ-a*ImX9(@-T4'pGkpd&
-fKp@,j&'p31S(`ZUCePY2+BIm#CGGJ`V9NdR(NEr@YQ#SqSEha-+*MQr3BmDlESX
-*JfCdT1edM4*+P#1b"(("0IH#a90rK`QAaB%UcNp-&d,m&B1%6"BFjj)a(XVMqi6
-R'4IS5aX&%H982PPZfpb#5`6K0(p!EN8IbBiFmm+-2F%4S5DqrQVmNT3AMVaRiRk
-q3i+Z'Rb*i5(p-JjA%4rNb(cE!+SCZN'5AD,6+M0lK''AMh90-kHjbX(RB"GllIC
-LiXRL$"j$A+[ebA%R!LcMci-kc+E!1Ef8mNieId%2[r`9LdHZLaia-'SaGI-)2Er
-`[Q5UGXl[%rXh&9ibQ$ER0KpB*`6J)6PRC)[(MHjAS'e)JNS!lVYiq5b2T)([AE9
--hUf,VE`e!kC+mL'J,m-qUqTBhd+V$HCh@Ye-E*2Pp%Z#2rQI3h05i6"aLa30QYE
-&hMD1@&1U9X4rSbR,df,i4UB)ZdR-U2YU03X8[)YjedTB`Kf8%4eq)Y24a9qP(&B
-l'TH$2)aYBl)l2k(STDCUCADlYbP[2[am2`KiHZe6)[kZHYdMe9YUkf4EPICG@9a
-hm*mdpd(!S8dc!h@,##4$fl$8"P$XRpqm'ArBQ6cdC&Ab8N,V'19"TL9DL&YqVP)
-`jjp8##*Ua%1jcL"iF(MG&$@%fK'Pc6K3fpjr`i92Kh-qHcP92)`AC0[Z-f(%ab!
-c4AB4)m6+d)SAJ*!!`#JQ'lXK,UpRRT,!j`cm$(&Urka@$1'B32ljDq41p*bVYXT
-jqf@GYj+*@1XJ'bhL`Za4ASUJ1T-K`&KqpI2NaN%k#E5i1lAh"$ZYU)PIR&q(#lc
-3TmP39lN!'2Z2rCR'TS1+R0+flR#Z4FU0X6Qm11emrTAd5dRqLclqaU0X!a,$p"f
-)`3(JeV2HGCNZ+(,YkIf@IbmCFFfh#c6LDN&edRB[a"QSB&*6iIe#FckpTkkQi[[
-*E%miZI0`AiT"RP,NQ6al@adi#l&A)bmD4Za6XIE1BcJ3&"I6%VP0`Ha2B2CrH,,
-m(N9JNJh@bk(pq!1,N!"`MJElqCKR-GDdTCTGI159D(,J2480A42J@U`(qfcJ5p$
-ZMDUK09EM6!X!`Y*I!#F+$(Zb+Y1-Fj@EY1&X-59MF,c2lN''Y2'pi+Ap*aVX&hT
-Cc"9NlqG%m)BCl#DB,3X,PXA-!m'VI4m#ip3JL&+MCE(HX!F0f+KAkHlIR3AabC8
-+CGHS*CETFGH`GSkVF+GSNlN(mMG13I3afN$Hr"qKTHNcJA(eXHrZ5(2(!U-j-Tp
-AkE1D&R5f)eNe1!4K)-`,fMfEpcV&BNb50M2TqdQN[GA@T3Ch+rZLS"a$qZ$0G*U
-KeR&F+T+BEJCLaIeRpY+9f&c*ikZq$dXP*HYPk*-)21Z([i'pc+lFD(5Sa1mdKib
-BT221DU*JYjB!KP$9$m90QR!NZL#X[Ir,jC!!YfmUUJZ!XmG0ULRk[4#hYkfBc$L
-9+m2&J5CaAhL5(ifL&8-9Ed6[6","al'XM`05rF`hLCiKM2fbZhXFZ'UpN8RX&*L
-Z2jZh9X%p#S0"H&F8ZVB-QJH'Bd,9BAC9+bXKVX9+idZHB%dpkeCF8Y-+&i#F4&`
-@#Ui+[%RP"NANpjA)e8B3cr'm)8LcKTR(#m1+a!QQR(I2a6Dm1Xlmj`i&pIQ,Mf@
-"@4#0G#`)GH2Bb-q@"IH3!+"d16'Sm'$GU$61S'3DGE+DkjF3@eY`I0a1#-5*,ec
-I@3K9S[#$cpPA2MSYE[!(86GkG[G@LZ#9@`r`(84$9mfCMKQ+iNe[pFrN,irP+mN
-[00U#cVlb%"MQQ0%"cEl-RSfhj18*8PaJ-CIBV6bja`',!3RLXA36FiQeU[6`GSV
-TH23!G5Ipd#'SbUPS@9d@jR#I8YGf'TJE,'HNIVTj[$F5U9b@Kq'`PT41SVBH*Xf
-e8FEedR-0Qj0SaV@XN!!V-'f,Qkair#+)m2p@DCFj$YGVe*4Im4+%h3RCMQA4IS$
-Scd9q@"j$&SK4l@`XEqXF&mZT$D3r[0Qjh2d42bPlDb3kRX9+3Qb9(mbZPb8G[Rd
-h#UBB+6ZN@$Y*#Z%LHm6'4($l1I$GfLiqA8""rdbTF(fTie9,F&qNJ*m8hp$(CLR
-Pld`AkE[TeR%%3S0rYc&&X`VCX2lh0KekQ!K434ZqSKKI"#X1fm6ADqZVM[TfK`l
-Q1be,Jrdjmk15%AJNCP18!"QA"pQU,fc@j!cjUJ&F"qJpr#m9L%mirh$U--c65Kp
-MRjh!@bf3!$Q(Db-LCT[[EG6iBjI#aLM%0+RB`25%GY20N@q*-Nck9IDM9#2e`lH
-%`[l@YQ2Y+T%fhJRfT&9["'a"ZAcIDNE*@c`TeV8&dk9B21Hd%Jr8K!,%'V+`XK'
-M@pXadlPDG@XmGDBbf2ZH!TR(f4f'-L,Spc8UCeC[IH,G)@r3R@8hR[$)(LiL"Te
-[l6&#206$!rfflUKcML%)3H"ZNb0j4"A49VhrSLh86rEXp*6AGSl&,mcrUp@pF(U
-dh[YKJ-1+4AXXP`0MU)*U4c#48Ue$RHf&!VQF1RDcKHK%"GCB'HkPAMjJJri9,Y+
-N$r9"+IJ,X0r2,A'm,02fTkU$56L)T4!12Y(,68)Km@8"PKh%%qAaHd@QZAUL[S$
-!*B#$!le*D2bXL*ej"M0rH1R@'h-KbP'Xa!&EX+ZDS0+q,$,)a,bfkVD8'-1ZQ*6
-VfmZK!E`lM0c49l0Zj8X3C[Q%[%[J,YaZa'S(d)928*PbYQJ1GhrN-2RG2D!,mV(
-1IPRTlf9#q,Q8%("qHNM#dI8BiYAfU2"jL3-S808jhJaAN`%k%Ki*li!P%"&-Uqj
-NTQU&ZR@pkiUFjP+jYF)9'06$a`F6ilC$NBa9ZrIXAXdLF+rH@fJN(q-@(!fhf6e
-*pb&mRZMDM&4jUbNVJXphSl9IMFTq2S6chqdllR"Q`,G-dV1$4Qa$0plmD(GhpRF
-DL8[5Z[4Ei+XLm62Z-KIPGFCKZSal+,"%NA6qG86,H1@"$"-8Y)KM*bVq559-bip
-'%$UjV!d8$J`-Sj'R*-bJC0iCKVMX[-f)Sq[$4r)jhk*M+cdR4+$cd%Z#9$4C#ke
-2TUkQLh%ckfFim**bF@mXVp4FYMh@QhHYV&0!%"U)IMj`9@De0b'1P929ZdXRmj[
-6@44eEpH"bf1jYZ,V4V-3cbYLEU[Ikj*LI2Km@$i1B`,(-X-d0eD9DDCa1hS5am"
-$Ih8"VA4Sj(aE[&mP(E2S"E,)2ee-)p%9-`J&Krj!md,jG5dZ'HVHaqS)0Cq+kDC
-K+*jpUGNK2@i0P`d8)4CIZ''bD[Y@ULbMf8MHH13RpRGD%bN-j%*ZCYr4`b+B6dE
-d[*3dD&"Tri48N`jk`+hmF`ZX#H$m`jaP43RZXPfa$XN8dfV+A8l)R39cjB4G`5i
-(b8YBU9[f4!8`Z$4fJjj'LK(-a(LX'2TF$Ami&DcdQdFKUaBDf+j1BQ&(BV1X`rL
-p6DP$AG2K$%#D"F3F48rl!6r8Uj()3Gje`'2)lJIZBHU&YqecB(PhP!8AVSRc)d+
-&GH)#)@Y9+VLd66'##L3XN!$UJF40!!CB@9XcQ1VHAEm`Q+FV3Ek*[8XmbTl8()e
-@Y*4K)8Ka"V,FC,V-E2"FUr[RGSqb20"Dr(aM+d,V5ShPZA!)D$Y@f`flS%HqK4K
-cqrRNhJefYLh-UfM9@!KrT&pf#YUD*!deJAEmPCkDR%$HG@P)ED"VF6-jde)-VL$
-mCI43Bb'6i6FEZk&Pb)Jhh+XpAD-qMM`F"&EH+-2BL@r84'HREa+i3Eb#2!(N#L,
-1cYdmZ'SH!Dh!Kik4*f'5QlZMC@Ie-Ua[N!!me'qLa1VC#%iCSA,*a-b0h`S*BZ!
-hD3%,Zm"V!-1XLUm054dc&"mpTLNXj'K8EGULY4L1JV6N&TLR4F,d4c""R@25iP4
-1&-$1fVQE*23`(1PRfl*Qr[#Iq$L$$i[TMp$R'4ZGB5eP48"3pNb!,B!p))b2ZeX
-X@4%JVU5Z,UhL&k'd,-$'4#$1QC4R"He4E$TiH(1IGf$M1*Z!DRD@*5PGc5+V*2'
-6p648Q1#[m5)31)l&6hfr@5kb)6b&Lhki14&B,Q&Ie90bq0`JiYQrj3JUFQ"&iaa
-a@1U(l1*ar@XZ6,FGIZkX#Z*`jYk`XF+2Gam$'E%U3#0f1bc5%#TDMf%cAckjGe*
-H,[L4qC4lHm$6mM-Q2PXYf33r`VlEjlIhc`,1GQ(l#fUiA9!TGGalmi1X2E(ED1R
-"HHr"6VaT%rL"#)#'6`0b5Xal@Ta[4#,42ab14qiIZLT4eDa1+4PVFQI,,UN"0+V
-a(fHl$,**k'#e($Eli)lE,B"`%XN9lL[*CMk69K&cR5@ajFp#i(h1+0(jTT2&-kG
-UCh3hjbC9(BkDL@9H1*Zj3rFT1X*K*2qbP02&L4UTAl%5AHaKLl3m(kcK,VTEFY`
-2@0fCIe,B4h5(qZ&DAifrp9VlKA(Nh$H&3qp+pY4DU,rGU8TRcLA[`q-$)p!($6e
-Q6GMChmkY5jkf-ZLCU-GSc2hUrQ`SLhG%U$c$LZULFZRl85XR9*!!09[f$TDEZM!
-2+%ZL2RMpc#KIqX#qNTNQk'mEBFJ!!fkK4-TU4[rS(VcXN4,U2'F1kk1,BJek&K*
-3AIbj,Pl$P9'iK#8T'IHI3GJ+J"(!94IAq!r,2p9`Q92EXM[,TRfGXMiT%irUMLe
-6SVR2#fm234NQ'Z3@@DLE9(p%2+Cd'`fj8*RY,ckblhP),kiRe402p@YRF5'QP,F
-,T!0Scr995pC[#j!!+0[N9Ii10PJ@KAjhReepKLVDc4*$'("mrpZMb9YDNBpC(+S
-2M3IaIY*bA-LY@`e4NV'"BX0!J5FI%8h-1"C2jr34VBkfF`J2NJ1RFT&!MR*XADm
-KUTHTTD8Ck-GQ$3#5"i99V4%`UVf)2G**"3djq&40kmLAMEY044"6%e$9p%`&N4@
-q%XTY(``!*$92&MB,+@H&SR%qBq2r1J-6Jm0h4TV1i(!%T4PbaApDq4aMULNXj+R
-9TB64%FbB-bfZQT105HP6kq-b8D(J`&D@,elr,X[c*HL9+!&1J9V%[60Q%8BEAF6
-0krSN,XrUi(-NDpeL8&SaR6D)ca+jS)PiH1fI$'Ym5S[1QPQ-K9T*c$9KZYbP4F$
-3$+L%![4keaJacP8#PMdfjME&!))qC6IS3)*JUT2P@D*F[a,00KaU5NZbDmUAA%c
-d609+@KH9LSNDpPaCVDb`VaXcmLK)B9N0Erd@Y5M#mI!(p%FK0CM916LImDLL`BG
-3pX3R#*+fiSGrKIa&dK''C$R,['"+T-pidG3&3FH5@4fRTH(r5@kGjV8i(X5AN['
-"99-2$)(YMJbIk8e$Nk#N[Tp'qj!!Qm)+pk(&mkq*2fdK"PDM')Y(rKr!jKRJc'U
-X#rI8UdeI6PrpfTE-GB*khYf2ja-fU!hE&f('Bcpj0+$,8ZBr$HS5TAMf!@$G3qf
-eq6,cMe2&M!LK'ri#3TE3dI4Mlb8J(jX9q5NH'JI#db"fP[hNlZaJ5eY5%lYhD%K
-'dAlICp,I+'@eN8+XF2ZE8G!IZE9lrE`1MF0fQk8q$m@'G"K&CGaK'5,0Z(%Dbl$
-D&5,BRq#,LKRC"0@%!F6YURMeYEmdajq%Gh!2aBSSD91r4[J*Ih8`fX"d4rep!Ra
-I18kr2rDJ1G5DY(YjT0A+#'QCSd"jEr!UH`cQXqMq1rjeEXH15dK`[r1ACjFjIZ0
-YkAdXMS%BHU+@bh8UIrKM9k3c4"BAMa%p#[i)4aDb8dplhSm`E0e`%SLIAUEZr9A
-MT"AJJm"Ncc)Zr39Z39#qShSBr`+bZm'&6E2dS0rbRjR6VPDA[@$6T9aIeiShKq)
-Hc,&qPiVZpCUSqm"D@i%C[@0$fd%lGHRCYCF,T%'22m5Gfq`$*d'*56Fh1H2cNb#
--DMS!e+55`+G[86k[&8%,P)QR`1SZKkfHYa`VcQH*C0Jh%c(KDNQHD0kI-Y*QpU8
-@m$dhh5SM8%1(4jrh`@LlrUdq2$GN4Hj+m9E*N6!IZ,EMIKLrSm-Z2T2Ejk9SY!6
-B)1-eeIF+Nd1YYKT"rB[Jl6H$hYj#Eqf[H6ih4V!e#S#2-6E8HY8-rIa*3+P&pfA
-)KKp+i-He$rdq#KX[HmUAceGD&2'Yh3*BN!"b+eRYa98[j,)KKD1+[DiEjHeJr0a
-GN6ZVS,03(5X#k1fTpBi#a*GA6adS#8f4#!TFR)e"kpdJ9k[e@l)f2d&aplXfbmp
-1SH&3Q"Sc1D1kB4-G"LA6RQ&acUhET%U(la$2c$cQZA4[dfGP`T!!a*-%#E)`hGG
-Y!Y(e%HCXR,-28Mh0G5IpiF(I%VH#BSUTL,XCYH`a9['UCX6kh!j%r@@l26*LVTP
-H0M0BAB+"#MeH$YMRPV!e!LEG6qNXA8IeXG!fGG2H$DdDqe%p6L#ai3a#FbpdUUr
-%9j%%66PYjI6PL&lDH%BkT$&Da,DdqXQe2D5aK0&,!UYrrhC-&C@@RJNG'[HjdVX
-QkI$PZr5[0Q-6eK3SBrqf8DQN-4d!1a2Q0Y2AIi`1EQ[eYLl*@4FkKf95@BDMc(5
--NYD3!%!iMTmm!%a1PF'afP+46V`*1l#bfF"Je'-H&)V$eI2`Ki"N[U6Be#kA[cP
-pT8IJf1r3JK5G,JXA"M2#TVr8pTZ+Y+"dCYQZHXMi#d8q&6$FS&IkNRf84jHJj1K
-h@hVd`fGH-M8D9(3U)ccGk#[XcqX`pp6dp+I3I(`qlSaiVeE%J[HJ)3`(XG,MdKf
-f(%V&Mb`jd!D"UZ[2ek[%YHJPplb)h2'mf#Cclpi-KS6re!mZD1Zk#V6!Dd,$mNh
-Z46M@*Si"JU#e[Y`i'b2*Lq90cPdC*iKhj&F2*%*+cl@kNf*1e3J1VYEFI8"0d0+
-J"q9&,5eibLpJDd`l!(aAZE,MZ)B1pEX94eJJ,R4Qhrp0#XdcpU4&h*A@dT)c1p*
-,VBe1CPNR*EKKT&a5$D`[RVP,c05V`a9(eq[am@ed#,3cb!a,XQ48@`C@%0b2r&`
-2FZf%#Ye`d5,i-feV+DN,Ef6N3!13!(,FL#d[cV-(-*iMLZ!6#F6eAM3(V,T#GfJ
-2A!eC%TH++j6*h0"2"Jk3!-"Xa!4ZjmFdfKc`*0Fc5@V[+%Am#l9rd8N&LUT3C0S
-PYTPQH5F)iP``l'kpQc+pCIde'X4EUIY$l[*,DkhU'BV+6YcP%jZqVd'qfc93VZT
-YQbPZK-UrVXPJ13jh-N9j91!Chj%BhD8i5k%iI,0U335V5D$US(+li6GlTReH&R,
-QC2C+6Lj`JZ0#mAq%a-lNTD,P`X'hiaGJV3U&MhQ6UJlLYX,BDGXlR6pG`)*HfhE
-+A(+94Jq#'dT@A6&qJ*YeE"fUAEXVE%*'1`Sq[Mf()-Bm2%0$[M8I+6j*2K58c#8
-ST)GUHhVlT69D`-BX3Hq'5UJrHc&X1P!-6MrL9c#'#hka$&3CA2`"0C1$Hri&k"(
-Cc(Nh!04i!l@rZreQ$HM$P54bBkDJl*UC'SC[-*SIqah(Th3UG%2rTk'CdNAI1',
-A94+Mb%lRSF,LceflSGHd#r3#b5r&F$RCC4afpVpEmh'U#'X9Kq[Vk)[l#&T,(jG
-%lRC6D9'G9[C*1r[4M"Fj*FG-1NCUMG2PqNTq#Uca*Uj8P,9QFJdINNLcK!6*-CJ
-YfdUDT1ZTGR%DNj1V"2XEi0"LT1b`eLHG0-99rQiJ!lCj`5pL44!&m(6XlJGkD*)
-HKBXMhPY)-h(qLf)$SDdJ#pVqdHK@Qd,p&6,K&jfHS%ea4aJTd!B8AUQQ$Sm'NP-
-9i`*mrZJQD"2mA+k0eBjDEqi&*EcB6FYP52ILfh@`4pcqi[kY#`lP89H6qldIp+4
-#S0r(&8RQmXKk'4RdB4MmSPXbI,aR(fP4ZcJJT8FKeIcYTcZ)35[%e%Tp*[2hBBN
-89h(l0qbdj80Hj8X#@iF6`pH''S%TXaHTS!fU'S0E03*K%9Gl5dGMee26S5f[CU$
-T[f&JJa)AflbZ'2Ch9'E@f'dM9Zl'!#'-'4%)44Pq*B[1)+l)QUC8d*LJ+``GZBV
-"kCLiK6Y9I`F8H5Kh!!B8k'mBMRRCa-)R*!@AC#%B@5FPLjq06[JUclH@GSrN5N`
-Q"JBX*f85kC-20%0C2V@hFHeD@B3ZLG[(NbLl68hU0JLc&U&j6'3$hZbbP[4mbM9
-8TRfZ[Y4r5p1%jU%E8m*9rh+QI9!Kp#FB`qkaCdXHKbe$#e*@BciA+p04H05S2QS
-hiJP&"+##01GqSI9!bmTjPGIr@[0qA+'QNkC!"qVZ'Y%2G9Cpp8i`X'26h(j+!f-
-+PEdlPF(L6T`[i'CkV0[R!F6ca%ADG'L-V!8(2RdY,h%,MY!K!9r3UEa4[ArbkHI
-VUM#DXr0H34p+SLPl-`[$6bGm9`2CE`d8MhLLc2-23mdqmLUA##(rq`Xiej1q$k2
-,9'*Tkj*4UPTee8kf0!-eR8Nf1pPQ2B9!mrP6&4!(%VD*8)PYjAfZ9C)VP#j@-A1
-[,IK9$9!(8BK6kjZK*XRX[1QT5icbd%[[JY#00rI$Gi3Gd6mi@EkSAlQcl+XKGpB
-X)aE5+$jB1RI(JfpEZ`(BVLTlJ6Le+eJrKIq3!2VqI"iLH%rc2Nb#NH"b0L8@-Y%
-KNXG4aBcQ")Xm6Qkb#V+8&`%3Y4rqL)HaQNG-EU29Ul1!KH9E#3+'deM4H&pi*'E
-APcCrm@h13R&K2KhqbJeT5"ed)hNcKbdY!Ere@IAEl@eMpNGkHZ*-T"drS8k!YeD
-0le691$U'EF5Dl1ZSMV%UDeE3RT5G$THIlbbh$RRZ+,miD(kKaQbb`kLlVEENR-8
-b[0H6KeHJ"HSj*A0QkZZ$YY35cKHfQT(%mEPSP-6#P-F`r6Df`1ZKQe$DMSb0Ab9
-&NYp#+Pff1(pqI+VDU#NhaV!M5f2pTcX*VYRDKB@*AC(i0L%+a0j+YqFSAKNH)62
-q*LA*U25jT5D&qr$$hE1GBqTC9r9I@SL'-f@k"SIS&rc!aP)qZDC#%'ACr259d"0
-DR[Jr+ZiC`4EdaNCGLY'+'UT%fJ)cd*P5jfbPKMU*Y&*6U@(DbN[TcT!!kR53!0#
-ZmP)pD84EN8"f)0hR,ZS1kZS85LHd!!5ji$rEfM&%fNV#HDQRl(f@l%c"L"qQ'`G
-#QKpX*B%9,`NqA-XRBXNdQDe@DqN#!aNIF+1lKTb-Qa32Q+p)A#*p`(K9Tc,DZq0
-09@4((5k6GKT[Ta81(fkdBB'a-e(CPI&T`[a@l!LT&cjEdpZj#Hi`kAGh#&1@V#c
-J2"FIF`)4lR9Ej#'e-Q+VREG!"d@kaRbB5X"(ZmQmj!cmEaf!re0@B%S&ZJbC+"Q
-#NL!MPIM,ZX([jQ3SH$Q)3(rPF0EAA&1jqU!&!h&fr@TNMCNCMIbUjHK,$&0m*6-
-hr#A#E%)$&HCHbVYJ0%FN@0I'ZTA-8GF"aL#CXLV'mm0aUiNA`EE6ZU4CFc+)++h
-+T3pd+Za)QkAqd`0VGY%rjHa#i3(YAPl)hQA'DC@Y1cdZ2F*!,bpcl&2Y4C9JqpL
-h1EqAXehc9HI6rSp@+%HQ-T-"Ue!N!P86D1%cj6XVl5mpmDkS-C2P")2*`@eqJfP
-XlI5p25rZE*YIGH9+bVRrPEc%2Xb3!+cl-%*0`h,hYfG(mV$,-H56N!!FG3B`hU`
-QL#2MPEd9GbNkLHV6IcHR)88X)!86%r+!8r4hr[b(8e`c1%*#%e9R0EI)KfNeCH*
-RPEV!r+B(#JMjmJMjX9H,V*J)dV'r`Xl3Xe6)"3d2KM1a5H!Z5QYEN!$#l%@aIP*
-K-'TCGFMlNk"1rSmh@8#122k+`a-Le8RlKS9Maa!ch[hHI606Zp1N0)Y%V3+ifqL
-bUirpJ8eq-GS8+#I&aS%2mIFZP'20kNeVZTeKC'Cr&0EhRXCB,YfefRPZB#2Raa"
-86TYFV9"4ma[@[1H(Q)XY[#PAcXRPpG-RN6a5HcjZ@(@E$@bDL5(b(-U8TQDRK1%
-Pfe2L9Z@,fcY(0E'pkc%J'er"q!d1$Pf*f#'$&mJbGR,Z'DAfaZi,VU)QZl2h+8i
-V*rZLHKe#6"1LZ2cIjIe2P%kiqdFHp-J`30VpJ,0h1IH,j&YSE)Uf,M&F0j2&,Kk
-hV'T&Z[0!fU#,,1dl*1"&55',M[-6!hl,kUJm+Qq)9jY[Rk55A[pZ50pLeHa[`fK
-&jUJFEfAA#1F$*0YY588##LlM0&FGLjCp%Hd3YGSMNMkX5#m6%*iH8k(`Y3*RTTl
-*8XREN!",pCF(qPq(qGU9fZb@-%bT0SN@k)0JqUFl%AfM"*C3)P#!TfDIZI++[5c
-F02ecTmq(Q2HT2@p#VN-B)hL*9j2Gr9I4RmT5TcN-T,h1Tar3aA"T!faUDHVG9p-
-$3Ir#Y4eUpAdK@+B"&$Vh4K4bjkVqpM8lHKGGKHQ0T[8E)6cNAaY&$(DqLA',9fN
-M+,aP#X0a@V0,m&q0CU956KZp"qQ2+eDD3@HEJ)jEFbr6S$pYHHAI+8S0)HAD)AH
-AGQX*pSh'k'SdTi!b''TA2BIcHE#pXMN[r$Pbipd4*!jBm@56'mP2$-Bl[`E#*B%
-l)Jq'pNTEmFG`D8DaU3NZ@Ni9kT`+@r@JJNS4CfKDdp$)3SVSYb$&'&*YU#1kZ([
-j%PFBCF!k'"4KDSr*P$1i@E!hN!#+cBjHVdQkB#iP'iqXi[l9$`)4Za0CNHaf@Ja
-8l!TFmT9l+fAGVlqlcD922q-6D#9U5'Aem6U@b'Qp$p$,M[mJpG"!mR&aXHT+b9q
-a"%ch3"bT'DB6,b0L%b4"f5`HKID2AbL$"V!r'hALhLN05VVc0413!(#fT%d63,A
-GXDQNEqjQrLPDfeST%)-DR,ql&&1Z#9Ap'ldJR1Z[p"Ni5D1"0a[&a!T-N!"%TpU
-R)r5Gm2L@F6E!&mpb'!qj11QNNrXCe-GmH$eVR[Aj"(8GiQkAHmd13YmC*#a!EG1
-TQ)1RjlK(YY8I,I")$mNHT[rKLMA"6UVCEXQqB`Y0-[hCl!+8(QFF3--S+-SU8#H
-F)S%m*2)T'3jp[HYCA5h`,VMa@+f0KfhQhK'8Z4TldrIZQKN"PRCV*&a$E%'AUhR
-rP!GVGI*e!1V6leb&%SQQ@p#SJJ*hmk3V*cIZjj'YdhI@jAT[6P8S#4&*[@E*I--
-L1HPilZZ)LN-R&ZKa%!SJ35$46N*M5%M-#$VeUF4%D!mV2Ice+cI-45c0T&#fQI!
-q$Er%GTUX1A1Z"RNK5FhN%LdU"2p5'LN4hVb(3IUD5U6"CVKKSY"qMmrUKAI-H0r
-L'CaIiSh*JeS+FK#SI-!R69c5@#AXC*3KK-N2``hADI(5X*QaHdr-RC%Jf38kh4T
-EqAP,2E2jkF`'m6+eKKIY9JIf6*HFS%0RARLqcZb3!*5q"Sb'QZ2#$@[fjL2b433
-P-mr$qr`31&QYq,-8`fQHh#&'(CH3!*UAd19APFI6ZHUU6BDmAp%JrH&d0(&0f9l
-G65f6AX4(A'm1hNaiJ41DeZbSJEReGqS!GjPpmKSG9Mhqr2"BIFELm"$"CicU#MS
-Xp)Qb(HHl)qK&(e$PieZ1B2hJ'6D@L$-S8X#'B"8VHKf)bI90f0HKSP@@ihHL"0k
-6ae%r13LNl-l*GhFKV-'m0[-lD[N9c8G1el1JH)6c$HaC)NQS$1mjP"T(%mr-NiV
-9*K20'E1(8e`cE2'V*AFlpQPp*CX)f#mLi25FjblV*ihJEG8IN[S"Z-[Yp(CPM)X
-5dkLi[6qZDAYR38F%Dd4(#KM)bT5!-1jpQlPbAM+F1P"Zm*YkU)9hT#lcU2V6(54
-f@,KT1#jpa#cfE92L$9BhDIEQjGq"",`5(P!3Pbpfa`JUPSR,8rm5cbC`SZ-D&f(
-X22dV5TdA@VX6H'eAr[CLXUE1I-kV5Q&la#*HRlhGl*Ue9@,FdIe%kaiXHJ,TX#j
-0A44%'QmLPPG%eiUp@,1#Mk*5ULjjD[J"0Rb4m*0f(*Uh*kl0TC+fGUC)NFU`Q+#
-prKPGeUZq@X24US$FK9T13[lqS,cZ5f)H0GU,0rS''A[+QBeT(5*)*'iP(%"j@@Q
-ZB4VrpN2ecKe0ZMdc!L3'hiij0IfCKea'9Echq(R@8F%1hXjT[Q9e")*)VeQ+qCj
-hMbZ(KU8E(2EJN9F'PDhK0VJeMNml9T08(*iaA98i+8+KB'QGaEVK,KV'HZ2IMXV
-N'R(#*I0%Hff(@NNr5E&U0!*EM+NU,cBIDGKESdab542T+3Gjfq[Yed8*1+k3!""
-PYe05ZcCeM*9fK6a'MCKDQ!H-[+j#DF[RhVUDcR`YE2$DG4LLLrb2&,Hh5G%rZ9(
-B-%2#%Y$bPP#+$8p694Q)cC!!PXL+'$&2XIA`6Q(F[3"e+G[&'V9G9Ym-BIlrC!B
-Yd9"1I#dbP,Q3!1HIUC(aITi(H#j)9H@,8rXDKlSXPQ8LIdL-m@fJ+q@%F,cFX6i
-qGS8Gfd0D)AVc1#LpNh1RPHYJM6$d34+%44%6[V*1hjZ`EbSUKlHVF'CIKlliQ$'
-HI5be+4IP&QfVY)eE"T,ffl`lU%mH3abH5SE1-CP-'()U3hY[(Q9P,4CBBGT%GGF
-NaFF$RVGYM(a5Y1+4d-!*6*j6%D,qFLl33a#e&Fjr&HafGDR2CFQ1*lbcXcdk&V`
-QPQ)Y)ZkMr`V24Uh,VYr+p-'"SC%$Gb4qXSNrY,UDYGGD!H%k#0(Xb,KEJ,!QCal
-6a#rPf%@-0rC6l!R$(ed9IGiYQZ!-k5Z@VP%KJU$D*GI[&KL%04H[eCR&E)m+apT
-0HB*I&b2Ja%Dl[GqN$DM30+Y"qaH$SY+%48bCA0J44(m)B15U8frH4E!AS$5'([J
-DB$pURIJ'j*P+R"FHi-Vl10$XLEj@`EP#[#!8mIP0Jdkd13,QC,!hC4m)jK$"QYY
-lT9H,aE1r'N@2Bf6`dRe[qBELmr)ha'NBa%5c8"@`fj!!3HPlr+2$*0)*K90QHb&
-KA#R`IJVVQrYVX'NmX(jb"G`6pV(+Y+e3kKpFTk`CZBlb83Cb@3Y0$1q#PAcCLd9
-VcPULUL1l`4icQ6H5#b606@U,*QR+eNqJ@jp3$+9N!$e#cpEBEFG&qKUmljVVh5X
-Kj'08EjUc`0%0q2'G#rL0`Cj-dSV-E1mMh1@'Sj!!$&B1ECXiNjk*TLG3,b@+(Z2
-pY3j&-8MqhX#!`Hm49BVF+XRA)R",9jQrdUZ[!ZhDLDcTm"CD$d-eIe5!,GL[Tp%
-&S@#VHdXA`l%p3LT9#%0B!hAD,$RD"$85Gi8lVD23R11Y-&2L$F)-D`F94D`D6r!
-ERrrClLX+Tp#GPK!,!*dEE+lkr,$LZU5e"RpQFf'*8XZNY,IR6`M,ST%p&*c9af!
-bDj*@ACb"(jh9*T)cj,9jMD!UHkR--l'iA%ciAdfeejk[I#9!04)f`RUFHVI4C3`
-14h463KS!JZUTA['-liT$bi68Nb!'!l'R%@#L"eecBX8(0%N'Zj2,p3GZmT'2PKc
-0kc)T1E2&K"p@r1TNC$6k48i6b[r8!INc058GGBC$Lp#6H3kf%#q,0650VF-YX)r
-Cd[$d"NF(e1I5!0BU4#8B4NG-'l#6+!I@FRl3jdEr3b@CNF*M!U"ESAcR'DCVNiF
-31e4-3T!!XCJhGR(LV`MQ"X[&,5(eVmXSDMlBb*,d(-VXF(UlR*[VlYap4+e!J8m
-pISAd*%,b95fc%'',[cBLZi&DLA%aApTa[lmdTk9,)$VZ1afShkF3'8d)rm5+QS8
-DJ!GAM@H[F(5Aml()$A&3H)PF*Z+['UejahX9,B4r4LbBqSlU9iqR26*I2CdiTKX
-%G@RHLKcN9cJiZ[BkbeFmfI+!*DUhDD'L2l9)@2Jpqa2Yc)Ye5q'C"Di#9NqcCVA
-dr@1dZ$Yr)MGccII,ZLS31TII!+D$)NKfDcDi'B2pR(1c#2'+pE)ZIhNb8U8fbS6
-""HKiCPZCDe)Q#63(G$Y6FJ"jHR%!f5A*44`TKdhJ-U!RjUX3`h0p'4f[Be)@3K$
-G0HM5hcc%HGlfkIlfSX#Jb%p)+0SV`l"3Ti6HI&Aj@#FqU2`-M84Mr%e4Ecmec0!
-B1'jHp#N"%CUdGJR6F5)PB5YA"225K@04"&1NlCA+AjZcNMjblf6-2bZjEHC+*l6
-ClkqBKVQh)Q,4@3$%Pf"qdC[pF-41IHIYJq$HF"!q&-RXaCKJ'h6((4XM6Vl&Q%!
-DZqf'(jD-&hJp!GdYMGiH&9&&m&-%lQ9le22BTEj)*"i,pdIRCJJ`M1M8br*`mLP
-%S(5HmTYNE2@D@c2qq%Ch4JZjVdqaZem3iI"TB8,@!@EBCe8,9ZIMmC&,aj8[K&@
-B9590%EEfq45Cadi6Q,rAI@NEb-A`cQcjC'9i#Y2+1Nl+CB(I`+13!1CrZ[eYVJI
-[9%[p*mT,%ik,[X8iG+Rq+Ecb5i`ic@J(qSXBX4Z205BIS1aY&E(b$j!!fSrh6[j
-KkNAbS*2"`DDN@[+(!UDQkHP`R)mITP(D#*)Vdc8cl9UYDD6m6X12ZlFVbZ6[jXk
-"Z@41fCLQhd5V)pX05I#r0rAAKF)(*8MZq$$eNUM+,PCdUbACAU0rbNiqpLhmAhi
-5S#RRqF(J+8#p#ffP5lb`"k@Y(Mki*pBb$MdhFYXRYB$B8ReCF*!!Uhj*qSSQT[9
-T(hR0ra&McaEQ[d,B)1"`fmcXPB3V-)R,R+*QI9115'6'e"R3))@N[a"[Rp9PYIP
-F6eliYNrh4K6m,L,h4&A9%4SRQZAM0ePNe,cJ#@i1!k,a6k'N,iPCfL8PXR5Z5NU
-rN!!BmPiIR(M31DmY81NCq2$Db2*DfBR[ke*1QI(44cKV5GY)$pdmT,6A'6CSFGG
-f-hBclCaSi"C+ffkcfZh'j'F64'Z3!%!-SpDLZ%JlUfE%`L2Hcr%`EGbrh3iVHG6
-J35ZZ@(*i'eG$4!GrV,5#G6HcQ2a[9N9a%Uhl`TYcEh4Ie-*@eXj(l3IAY4$,`fK
-Lm)ma1(A6N8$3$qR[d-U$Ejbi3MV8%XhLKbC0+M)G1XPL)T08dI2r(PS2Si)-ZJM
-0p`jf*U@f!ceR9VJea!D&DmaN8,bam#0DQmE`JPmL!kU'cKScNi'@fe3`#e,aETZ
-MKSX5QBR*A4lRV0AmUFNfidE0F!pmm8$`*BjjT@L3!,,lbYq+8jlSr45%haaY*N$
-lm&52haK2AHUcF)[E343**HIeHZHA44UJEY0Nhr9%$F!eG[8CCmiK@$PPK%prL`e
-1(PbB0qD&cl[AIVLPc%0f",+(dG(jZq6NZrmqp[)ZDd5Gp5TRGc6LjBaC0dfD$[c
-SXaqiF`-!3a68$01(8JS+#8K+NJePFdaZc8M@QjR[Bf+QP@[Ih1X93U$f6DB66mj
-0fj)4,H4@b@-Y'q@%TQQP'C55Hccr8!JGM[Qf-[V'6T(33QKRT1Yf[I$jVTNhT1C
-&R5Q26!2"Q$B0*3-5j%I#bG!(S%HYd[Jd2cBKU))%!Pk-JLS@VjjY@B@5pDk'1#%
-H30M4`DFDMXNF9pTrdLM359lU`2QGer35$KJ"jkfHUF3SAI1AK@*1'bNHb9jhSUf
-SMJ-D[H4l9rkTR+N%qqh'GTcbB-f#B#jKi$C4RQLX!%$qhDQqfPG)hk-d2#DalX6
-,IZElpPDUJb[VY9$F"4G-&%5TQH*VK6IqFC!!Lbi#S1#`0-N*G1Q`+q"VZ9%,`5M
-NDS0MJFE6kL[01jJ$M"B+j!J"IrRVk9SIkp%)4d3)G$Kbja+ZRYZ),)E*c-h!S2p
-(AXLpThjHDij[i[Ibk'fVef(-qbTIP3cMTd8MI0C2MeKr@f(2`*'appcYdrB0&,b
-IXA0"E3#RhES(*Lb"a&'3!"9Q9NaL8eIPGU9EZC3S4Re4,1665(UG8-q[Ed`2rI#
-X0F2Ud#L`))&eNhe&RdYfY3Y&2X8$pBY&&Lr-P4ml1!PGeIk9B*IU54J56NV,R9U
-DP1"-c$a8B1$1l2aGhYDakjVh-G5'M0SqP%)JSTpZ`jZU$ZV5M,4VZEUVJ)hljca
--mi$p0!f*NXhFGb`'0l2daQj8FPQdP`J2@BeaYNJ69Dc$14I@TI&eCi!-JbG$f(a
-Il!&YAU)I)1VP0Cb!AkM[&@S%ql)SZd5SE1,*bLVM6EM3UKD$j)hiZ3mDN@CH-Y'
-E(V#8[3l[!5SMaH8ZcY+"5rZXANY8aSET$L*ka%F`djYN`4UirB6lBeid9DV'(1E
-d-2PcjU@"0iMIM@1+ad!@!P#e6(djD6JhEQ$#Pj(1m)5il)[bL*aZ4jQ9fZQ83kJ
-C&KmI`H,ccBk4qrTXaclG!HFAC,Z0[eI`-28Q&"p1M,3(9HXCB+L1E4&MpX#lalP
-BIp&pq,[mR5cAhElcNeqeY8"*FU5G%p"#`"*dVqIFb4L3!)ZBIG[NNUlRB5*$dKl
-IF)m%fP%%Hb(bV-m&R59(%QeF-`!d33&&m@ei1iTM#ar)'Fid*dk1THNBrh(2fK#
-mNi6'pcJEIJ2D#MRJ'8D["G@@MX3jcH1*f)r3*TN&$EN(SDMk8[FbjeLfYd"S2Ap
-#IAhpEF"''Vh0fpPDr2e%mAUEVXEGpr(,0UTGq'8EDH`*0RkIE#3RBkZ2*8ZG5Z!
-ZjiL&%i-TZB4#b2BlG[65(BbB*E+XdDdaBcNmU,'2A!#I`+q9k@)XSXMDC2F-6Rm
-P6B@0NCq(ir5MQ'$)`m!M`3r-,K-ZCkQede1ZXdN(K@11VfPLi1(c(BA"4GDc5a$
-G9"F@CAY&h#$#H!UF*!4icY6H!9,k)Q8*%8b,Mci-RUHma-Uh3X89dSGZ1akV'e`
-+`*pDB+P[2Z5dB8h8h)[('SFIjSFXc2Ekm%i-N9Sip2Y9'b4%Y"2*VB-eU[aepN5
-0XX5BbXZiCHqaTh8r3DiiAm!!ice(+ZpiFUF08*ET@E(jkPaJi"+01PE%+8pM8Ef
-!QkqXc61S`8Y+m3-cI$jDq6fYMI3jeKZ+&X""CATZ9rAUbSTj-KXRp5K(pGl8N!"
-4e$k,Ck#5rUfflK"Gf+PcYBlJ6&DK[kj,)Mdb2[-b$pm&l"!ZX"qV)E$`4IcIV!%
-qh#i8mXdEp84Pe`R(fXG*`pTF$q"pVp&5aiV4Bk"I*9&"0&r*k3"*kb"iiZF)fDP
-T"5)r4&ZQ#f%2CLPr`!0)92`-i8'Rk@bh&FpGd@B"(+2P$9EVS@E,%BjDXD!-8p'
-R%m%6)e%!B[YY-$X5ia1,p)k'A3$mI1["$YhJHiYG5p(c!HeTX6b%*(K6Iqre@a`
-I5TKRkLd"RC!!@64U'K"[Qk'2GXaFfACMEieA1GacY53F"hY[J4Tii8cQ1qSVGA@
-mXf(Fl3dm&LL-HLr2HB,j!6A,)Q*mH2+-M8#bNQ&3)lmk2a1%fYE*Td9)$H-&S!Q
-1R`M6GMc&kKfCXp@[5bcd%))28US0rGaT2q&hJjlD8J2T$h-23d'R4R94q(b&4Ld
-"rK)XqmImh&HH%UPVeEF!IiQk*BI)(di$MpI5&S!,hV,N6#"0#N'e)[$M#[0RQi%
--&P!*PNZD'QhKV$jqki'9FHEJP-6F@$eJ&T%A%VC(-1T'-JXB5T1l3PNm5JK*U5V
-Qa@PdF515Ya9l+90MLaJm-p$ai'UH-$fCX6G4afId2QiUij1mj'h(LeJiYZeJF"2
-GiF-Z)elk3*+Ia8RY6AqeX,l"lmqfAqSFE3&AmX)AXh%(J&jX9p+pKK3H$V[0A6q
-&ZYYq5YEaH-FccphN"*h4K!ka8E0eZSjbH-N1M+ZG![H4Ja@i0i"flV[c03e2plc
-MC@jS*X0F1f-,C2E,mcDDTK*@3*ISB'9MpBFlQbii-dP9aidZlGYqE4SR,F9H1G3
-i3$[+b-DeQfjZTR)@Q2S`-[,$h#d+qFTbGH!)400@&C*GVVF''8)jG'r*D&BfC(d
-1")"i8K$6NP3ieX8dc)-9U0HTrf9E3KC!%S,@H&[PK&Vlr$$)qHCV%PZ&m0&h&UI
-AHN,CF8`DUEiK9ckBSJejGf*`9K2*cSMd4VL)`A!f$,-p6+Gj6$31!B)`c[i@*6D
-&f%IF'%FcVN#jU`HUT90TeH4eZAGKr2jGp$bedJVM,Yl9N8ZUdQ9P2rUSpXe-q@F
-5U85ANNlS0,cqS[l,Jm2pAbPT#F'iSV)GMqA`GjN$YMTkiC3KEMEV2QajQm,cBpN
-)VC3+bH)X9F@d5a%"Qm-mQ&LKDJ`dlT'ad&jl&jr!km6#9%A"[-lD*ChGVRSc(qY
-RLUh2!Ij`d-(8`b-AEq%%VaP[XM48#8dI,a*1eYCGX%r&"p@FABM++N20Sk8K1,h
-)mQVDJcPMl`Q,Rh6@3B6Z)cNfqjKdQ+ECp2`&BF"%)3ZNb50cki8f)KbEb,ZAejl
-2c,(9)`XHR*r9Y(A9CUTHc$Qefc5p+J5-SeRGbaQ&fHRGFN04SR[9cDl23CaJq-V
-BX"G"1S'cA[2HXTpQXNPrLd[@I8HaX+@Qa9B!SjQTS!'Y8lUcB8iJ5q+d[ZLQ5Zr
-kCNpRTMGBYfh(T`bQ*KAm['`4(LrSJ-jR[1Q3!&jp[G`)Y*Z`(d*Bq+Bd[%@HRD8
-I*)bNLX1FYcZ!pEBb&223VkHS(LTD6X'r#MTk9#`SYV2d!p+-b&f@*9D6&ZJr#P6
-GP-Mc(H"MU$-P)mckjC!!IhFQ&18bq(eKD34DG@(MY)YR'm39m*`H5iDia10*RGJ
-*T'f'CjR"T*m%mVNebc9#(GZMk[c4e(+,-T[MMP8C3,aR3fST+X*5d&$$F3h#al"
-ca!2&H%,1alqfDZCRFEqeA18Y$IDe#G*SQ3RF9K"hafRhk1e4!jGb4R22YVVl4iN
-)k0S+Q1+p#Kd)*a%LU6@3!)UIJTi9FP15M89UpQ-l#X3P3`c)J#iCAf02rEl2l`8
-Jb[J9&N6*GYqPlK2DH8J"*f31(-D@4Y8*1$S1)IQH`hTLjaTe-9Lh*hcKa)08m0D
-,E3[c*PpKRdK*FAK0SKH`4RJmkVPJB)[BE1p)`mM6I$cQAl0lN3'm%fI*p8!54V1
-"ZSr#Gm88+T)Q!1)E&QTkMldAk4&ZdpFiqNmBJU8-0NEdhNNbe`frABZmG4*XPfc
-ff8""lfcCmKfML3'H[+ePQMm80B[2`AjDEJe-X(Q$d"pI`[-*Z`H2GK#b+eNbSXc
-Y-!9`qR6"(GpZapah60NI@V9fjTQ#3rQKB(Rl&2Vp*r90-&P+[qBb2&,&0D+,6G@
-3!&UrH9ieHK$-(AS'k9!V[EF'2&Me6&mfUj42SMkJaHc5*[iT65JGJd$9*Te++YX
-6kJ9H*RN-lA&#SCKNel(aY+L$eR+kkJ2)8iEGG+PPE,EeIAGCKj+J,0T+Y"hNAU-
-rA,G4E+SjC@-dJHU9jb2&&aG+XMU4G%AhX-SRb-CapcQVK`JcTA@4!,+B'#U9(4d
-PSeh,MA)9U[2bKaYXV3@U&RGceJ,9BjXZdE[eSCP#1fMFrrJDTl[RrSkc@LiIf@r
-Dr[3JAH!dfTj5%+['&`Hih,9dAk8"RlL9064DYC[&-6(2qiPq*E-QeKX+-PA51Cd
-rSG416e1cLM'!GEqc!T)Va`j43'mKBFrDplYA"6d[GF+r,'KBLLar#LUMY2mDXE8
-D@6VI+eD#cF$dNS(DMmDZ`FVP)%&9CR56CK0Hbe)SNY4j)@#24C6mK&0([*c+b1(
-dMmUrbPJ(dHGG&q@S5aYGYSULDhP-$"+G"R(Le%0(K-P%M3iVM'1`U!q(#J%&HJe
-G-!d[*+F`0%XCE849''GNaKb8Nbr+XTNQlqVb)#3`IK8S5$8+UaD[-'H[pm03*TM
--T-+Jf1(HfJ-2fD%$1eXPbG2iR5Ulh+br3ZU4m,QI-Xi3dA1LYk06dpJ3R98LCH8
-12"6$`TEN+(BS&VJ"rfUfCZ"GCd5(52%iMrYAV"ZpK6Ta@`M*"LU1$FiK0J,G6'`
-f"Ne[b#ISfqjI218kU1D*FcIfXkmaqTUHDG$F3NfaJ0eReF3D)PH*mHZiZf-ciB#
-H5D0!`%lT*LJ9r`TI6I`r&pYj5dIT'ddi+9U`NPN*'FKUIL(A*6*cTcNrSCdQAA)
-`QFL#bJ33)!ZJFMP!rir63G)!@9jidf-N6`B,I)5eH1DeX2mSXmm$*3EjUL9mBVP
-9X"3!4$'Z'8G5&H0TA*k#fE,QC8I[md&2VpN,qZlT6jdl(`YEIX(a+1(Pi0$KbXk
-k0VD$hD@qr3fH6c5Ff0rUAED`kCM010F28DbpUiGf#Tc")#2j-HTUecH[Kaj65A(
-Y4`CHUq-1hMlHDB#L1!#'C"01S6E#Q1$S`$q#RY+F6RSHh3@C!ldH4%e6e'eM4C(
-K20PSJDNebe*bZF)ri$H8kEQ[D#QRpX"LbapM8)#9(SEb(TZUTi"6-UNaQ8'JUSH
-HYQNe&VYbIaRK#6NpN!"8q+%c`&j-PVPAB-,%,00R9[mLDQ6K4XZDM,ajD"@@kNA
-qD)SE&T!!Y,4FI%h9''l118Lhf0jd$'`*SN5`VrIkqe53!)&P@lUVB(N%Rr0RZZ8
-V*@Q4YE8ad[)5`a8"38aHR#pU$dC$QD,d)CD*Q%&qb!$#(0$+1pj$C'6$$pl*H*G
-iB1i9ZQ&M%"+epQ`KCG!QFCJH&Th[CRRUp-L8eYT+i,eRcX"DqUi#GrP1i6rhCiV
-[$)&1jJY(FC5QllB)ID1HPJM+eAAFKiJRBGDdHUjR8p5mlpJp$leVPbBkU)8Ec1a
-iC4(i%05Mc82M[Q,DS@aT9lQSdUKk3"[0,@X3*R-C"28rJ0RX+-@&J)YXhZR8U6i
-EM-D*N!"8fRP%#`0$aAKrhB[[L9L(rB'+ZIP$PrJa*aj5&Q1QAfhG6pmF!pr64$I
-lq4GV)6JXq&@(6,!-bLikL@'A8-M9L,S*jVrXiUAXY3cr`3$D*GZ'cm5T63PC-Kk
-CJ["e0iq4hXd+eJE"ImL9VLVEaDQ25D0i@j&%9lF98!ji%%a*S"j*E%Zedm6(i3!
-kP(VF9Cdhr%jD@'JBS[#*P[R[l9jb$erq))JQSG1V,G2hpK[XfdI46,F'j"U2V8k
-YY-k1M(ZDd+&NmIZ"H8B+5ff*iVj-#ViCFUNlJTJ['eRJAi`KbNPRq,1(F4lpAfZ
-PXQ[Q#UqMa+[RQc#9Mkq+S5QqmdlBNH3$2dTKBp,A5k0C5$bFK&f3!(8JAm#9*Bh
-++JcHGB1BZ"R12(lI1C5E%VX8Y@DR6&FBIT9$l8SAVi+Xf#!8qEiN!&"a(Xc%)K@
-DipqLHjf%pIeSRNdk62LGe`YrkL`h4kB3H&r&KE(8qi6CcMk*@rmQkfmS`%c1SSb
-hPT90Z+J+4([hUea$V0`K6$B4)'2[6T,Q!Mh'e4mNp@A86hjqber4,@)J6Iej[Sa
-)m#GGT6aGe"Xl"hkmkGGf'mAUEcGp$ip2a`Xk,jj0&m5M+(R+'GT%664AL*4FA+Q
-l0p+bLTUNiIYI+'1j--)3iVkqqGQI6p(AQ%cGHA2@%,ZXD3rBeY6c$9Z+#j!!XP%
-Bc0Fb@!HKh1f'p!4T+Xrbd(bf-SXPSI``cX0kl&E*G[aYLAH&QD,aa&ESK"4`ZBm
-`kH`cY`4+4G&LACFRX+''rj!!,3*rZGHF@KKIPjBf"DaKC8p&HhbAm(T)9m$KYZ4
-la)jQ#a%6[`jqMBhD6%D-b3f'N!$TRI%h`Y*caieIc,`8qLDA-5FYdiaIcY+(f"8
-&NdRD3Zkq3DVq)pErD',U%dDjcV"rVjL3!)pkb2S5P&@ddBcBbK8G"-mhZPj4Q)H
-'NUVhEf`U+"(#"cMh4$&dc90G2K4F0mci+iTj,4*J4DrE`*L40MR-Rd9J3Xdr,cV
-H$'&CZXYSS5mT$TG9AkD68jH#fX)r1b('(rdUH3Jc1Z0[1-a(#miBrlh&09V*iSS
-Rf`qq*@-,LAHhpf6!C0@`6'm`5`B*$Rk''FZ28D6pL`rr-RIKih4fjLq4VVeVdcj
-I[R%3*$fZjbP5GU5IN33Gjr%&cem8aSaUq4MD#V'm&f!3kUlYXaAe8Y,IU`ZSN6F
-)&5V"mfQ8N!"JTKhXD2G%Y*cC!BV9Q(&0NG[C`A6kIilGXb-3GF!kp[0ThNKIUEI
-(Y"`T(bImAI@mcBhm)G,E,XqB"$"[ZK1DUH$QXhIV&dFHh0C[qEi9qTRTeUR[209
-[A'5B*5ULm+6%jZ-'Raf*l4Eh6lb6Gq%&m1I0RN#TF1$S`#VH"-ah03,XL*1eX4(
-$5q'H3i1ke530mNjehXpLE-l%2`2k!+!2dUf1Lhrk"pX4+FQR%k[d2r9J13Q(Umi
-Z+4!aK[FlL2-U0SS,J0)[fI9BJ!-f+$#YB`9!(%+b@A8iZ9J'bh41l@h,9B[HYL9
-`!"*iJei#R,P8[L$63ql))6Q*F2LE(C&%Pr&fAD35&SAbBp@)ebBcP[KRHJei#VI
-U@5h+)E212@`XpJhRHTMEAAcSedL3!'rL#QHP"eX[p-(Pq'2CZSQV"10!PQkiY&I
-S60f9&%R(25`a[bh+NVP#)U'$$6`%kR0G`NLGUXpfMq-9*CILZi!faR@21,+S','
-240#BDGG)aP8lVFjb&EIEh'qaf!M6Up#4dhK-`FU#S@AeLKVLrDkq-ZdXA#KC9ka
-91MS@iN[&B[V-8IYfHDpqUBiEA[D@-@4M%Xc4+(X5GSi[1qTN6q09%U@l&3i2qFf
-mcjUIj2j5S1m&FflDf015G*IZRp@JUd(@lkCG!!P8X6k!F-q[1M`VqQhNMhH[)AM
-"BShY#eLT,4,%0IHbR80NE$)$2UL4Hrpr90"3&3E%9hRkGM2-I))Y2eBlQI(R"KZ
-!HiB#M6qHrp'Xi&,m+%@5TV9a[kdUQ1Ca1e$S""$G2!iF29!P"'V1b0fpK#meDIB
-51[`YY+"%(jR#*ZR(-hIGc4Kb0BENq)Dr%6'IpDkV'p5fKlY)DP'KaiTeIYHXI16
-!Q1cV0"5-e0SMMEIPf`@Qa(JeMNi@p#4E*1ZA@LbNQhAS(6Q6UXdkEPK2d&K[E3,
-BP)*0Emf0"H*FGhJ)@4+bY&SEpqcFl#KSFbC3MD#Fm9hE3j(ST5TS2'eMfjDLX$r
-6Fb&8fP@@EUVfk40)UHVK4P&Z+ZeE$pj&rU-d6#*3p*ZN'V5T&KfMNP)Tj4QV!M5
-+cppBT8q)jf`*GNL@r)DSbiE[%##$MH(``T(4#E[LQ9edIe[U*dI[V6Q[Q#LD1@a
--T0[!D5[C`!)+58SDSH+Z8rfIMl@QQIpdBB-"DhIVHqUqc#fJ@pNIP'S'#5b,D*!
-!Zpc,[8$,HT[L-J9`Sf!FqjD(-RY(T-L@NR2e39MlGpAURAY0-)DajffVpr4UM23
-dCh"*GfdkX!Y)B4V(3VmF1TqL2dQhXqB9D&A5i3[9T'dBi1r0jEaE2([MaF%BTU9
-`Q'*6b``6j`#3!&C!TLeBjM40pPpjT5Jie,Jae5EP6Jjc0d8jc'Cid5k8E%L2b))
-64ER[FEYHk&Rq&p`&10f8E-iZQVH`&+RFRIdc1QC-Z2lcm)FF3j%GE`+H8mJbmDQ
-EY[#LH5,LB!$"")!a-1k@`&p6[bj,qKM,T1I5!p#3!#-l*4YU(+XI5BXF)ABX'qd
-f"38('"+3!'Vi'i$#G)EB6(5!ar5e,D816S2f5%jZ*Uc(F'K$JefTk!30"pAC6k@
-hBJAfJD[T[&ABbrrUTTQRk1CD1r2[qdZL-alT!Iq%K,N$h@&lI"GQ2cIAVF5-fYA
-aCL2F+4"a#k8XR*0Mmprj#D4DEP0JqHpJMH&U[Z(#H+HZ2UG-`Rp`MYYpJ)-XGEG
-&(G5*U00iqGGAkkE`f%c@'%Kf&iFUdNIqQaq@2![,P9[Qp&6-5X#0Jj,X#3a0FK!
-!PaU*[P6qqEGUhU5qS4rX"6J1,ZP"4T!!'"p"6a&98LK'F2QjQ-j8I*GKUTp#,1"
-4UBqm2&!S5C,d3I[KD4`B0&NPSIUKC[m+QF22dSaU))k3!"q)0d#d"RbhMC5f6Xm
-IdrhprZ[Jmk5X,BKD"Zl*4B2'%5"QrA+ej*c`3V0G0%i5'pcaV6lM2p0(a1"G[FP
-,*6F!Y-MC6cbX5lPJK8e@9l[b04[@MUPRcIC$XPSQj$m0JVj6A`[*CE4aq1KcV[C
-lXjV5XJm#)2I1JR+&*ABE5mUHHSTY(l24$Hd4&&r@JCl&J*PXfhURqm%b!SFmi%V
-,GK#kZRhJ20J!k@#F[f0jN9ZISX$pcF'@G$@T2N)U2lDR5I$Z-2"*$CV28ZJ*QI$
-r!-2TF#pKjcRP2'@Am*,5F2BXf2UAq'L3!*0kf*pXPIV,IA%j8Lp'KJUV++'!Ei(
-@H%TE3dD[XT!!TJ2Xld%KSh++BeBr1!5(im!Md*'[@Gbd&BJX0iC@*+5ML"UJ1ec
-`Y1`H!+%j6"FYSD6bHaYJr$UE8PY3,9DA+kbSG)M%1'Bp$,Jk&Ufh8!XTE`6LS4F
-0!48#Da%fQ$3PN3XFfD$RlmMCGCE55p2AD,fd)B#5Je$(LU&cLmqJGk#2Y'Xd-)$
-bEH$Vcj93HMTB28PCfaM*$*5F3(JAXp+I0q-(B(H9SmCpeFUhl9XAl,QY9)%SIE*
-5-!RN9*DUUXjS'IcjEce`bVf[6"jr')6TpE99%M$%VIiSH4[A0#N@[M524*I+GP"
-l1C[V1-C-Y0%1[G+N%'IfqlA!%FlpNecUC()V2kX3GDB92@+i)iKcRN04rqbA`)$
-2mYFH+YD`BJNHFT1NUfBE%(H`0CHG`UCN`TeVe"6!BB*Bdp[aB&-iE'5#MLYXN!#
-+"Tc[AB,MXR,%p[0hr'VpEb1H*RXirI&2R2F#T(0`b-22cBM$VYF!&rG9(Mj`)!d
-NrLp)aiSmU5mJ%2M`F6)+5@+&f8Z'4iaF6cp&@)IQ!ZV#QbaPGZi`D`[GjcF4MU0
-lCfiMcX+h!BB#IF'd!TeN%XbqNjQ3!(+e(PmFQB-!FmCdp5BYVAaljI)Kd"jfE5Y
-*(X[4VS@8f&M3DZ8hiDYN"Qq68D@j+F#)r`ZB0E$"jcL$(JMELIeVe,lm`8c+M9,
-'c6%m2E#[LVU"T$JA@Xh%06$bEm%Ul090l"!8ABJRM!%B!9!CKQ@"P$T2QJd$H)4
-Q-p5m31h)lk&B#-QH-,"-G#K0h8-*if!i&k$&[BDepKAI9K&h@hd),3dr`DBr#5[
-iDQ(f,Q9b#j9jIm"ZX4IQ2"Z`62Qa5FZ[UId4!Ia@TC+l1VaGV#DmI-E%UeYH[Be
-[1%PZ3q-NkmQh(`A8D,!JM'@(b)j%CNJm)`D2S)B,m%lNPNehZY`96pdY)3&B9h,
-U!mi@ZENp0b!Xl[QBZb$,+PZ$JJA,Mdm!K'ajjGj`8BEG3b"$d9HAlYdMd*!!kX$
-e"Z,de93Vl#R4b(4RFG)E,dj1ebjr3$9lM#$-fS'5Tb6(V)dX8crTC2)6eGTcA$8
-B8P,b3mjHACDEH0N$Fd+I)X0@d5UcAFhD2*!!2[E*!Q*UK-9hJ4LGkQRrRS99Apk
-%9E5#X$@*R3jprEHpLMBZ#f2B``B[XJABCM1H-f+HX&j*mPpX)G9%ijpUTIVdFck
-2-389MN'XY)C4#XS4Y@X@ajD&60%Z2#j9E4((Y19+hp,XLd"ai-``bU3jqpUCp`I
-%1XKRPMKE-N`YGh"r9,2cMNm018FF0%#lAErrD9'$,J!LVS61Se`3SeL'2,'-5YG
-,K!"aiRil5*-Lffj"1C8k(6aa5*RXBcEe+59'HEJM9F'4RHCDqCS'A'XkR0SlZiK
-&9r+qX'M6%Lce*A#*Q%EJ[D0b[K"ha`Q,0i0RdQ'+3mfAG"5S@SUE8RD8!@$@k&k
-1BYV,I00r$Z1V8XE+SiU8#3%a9YRR'ArURITSMfp3*mLRlSKkq&N$5$2L*f-E'Y4
-)LdPZaD`L+HPm&+(#e1G*T,Ec"F8dI!pE*5V95RCbam`4Mr6**f4d&'AiGK'2Uc*
-$1!Y[LRR'j8rC(JRLP`T-bqAXC09GXU3Ti[85I)9IeF4Rj'QkkZ*+pfBe)!"2qq(
-IRiXhpISj"#M`&EF"`@Mp8,J[&1dkSG*DFjJ@$SI6d46Ya`d'H!V18J)UXNY(He"
-2AG8ae#Hl88[)SlUdVL1[M2Y4NrkBC`ffLK0Rf)E4k$'MYPG2eml[&`5d03-[0Tr
-$[86cHH[A[GThP4$ad(@2C-XeaB4YiL"3aAmDbA1SfB9k(i%Xf4EbLB(IrkDVPSU
-(dG'mVP93$R!er03CHehDIb8cb`UP8r-D3IUS`dI9"K,(L$A'jkf3!2-3LK*YSTA
-Jpq-IbN&!5d(PX%Qd5T&0UMKI#[kD(l@&FZlC%Z(jTc958,%YbH0drKQB%`qZjYP
-YqJA!,YmJ$%2l4jFaMpq#Xap)B[-!iBVa5`,(#Q5q*)rHp)&4V0H'4iYfXQ)+iKN
-(,X*Glm%p9HE4hYFUEF+*%fAq#6RklPZCE-811QFMe5G[P"r[+"f[mX+&3,B%U%[
-RMQr%F83!TC!%!3!!3J!3Z#2F!,R'`UB!!"i(!!#`3J!!!5m!%R'B!!kNH`!!13d
-!N!32!&4V6'PLFQ&bD@9c,Xq!,RKYE!!"m)Y849K83eG*43%!rj!%!*!+J!#3#3'
-D!*!$D3#3"!m!3X(8LR6XRV2cd)#%E942VNJ1jkhchrY)K0bPlVlVi(1%rZlb0-M
-5JEZEqhHlaPFlmrDjdKl,LX4c&HT!J"dKS'YRe3$6d&B*kL1GLLpqbp%86Ti1D-V
-`#L5MjV-&Z&Ue8DEB1M8Y&XGJ3X(9!lZbb6dXY"hc4NPYMidK3cN%q*9YD%+eJ%S
-j6r#)fGiFdFpl4QbMaLV5R+*qdJPK(Kp6XL'*34T496pH',-l50cBXZUC!HF!*#5
-VfII`)c#64P[2k0D1a!df)"@`)k$55RR#,eP,`dc"A6r5#P"`3B(ZZLT`D@LNZq@
-bRJ6Af-NbajIF+%Q'SFq8l6L400Dra*53!+16UF*)U0blbc[@HT`Da"JZK`qM!e*
-I`)CRF,e#J*Cd[6d8c$`j22@Ab`4`X`PCh+BAKL'k+D#+ULS6!fk$9E*,2L1QqE2
-Ip9IX883))G0kRKqA`9XIa,qhS*Y9dD-Kc+dZ6m4Hf,pTeS6Dr&i-GkLcm59K+-d
-d$0ZDli$@e8@VI*iH,'fh5$kbC0B`"23c%93MDp1DSN[DVY+iYP`@CBUeUZEZb*!
-!1NYZ1Y[r"m'K2eh)H8c*h8H+(KdD`22j9YjTipf02(e!FU6'k@IT*ML"%2(j&)9
-34bIYbf2hD61eKQjS@R,Q`Y[NZhrEM8F3K4eQ,BkX(Lb#`l%IZaZ2DK8Am8XrK54
-bB5J-$pL[9!EH3+CcjfmVi'(fR"&k)2!AI+'h0,F,4MN$XlG`aTMJ8$cm`Gl3L+)
-bh@2L#La9K6&iq$Pkif%cT2P0!A%G&6'ZiDDrK(-d54Vf8+!C'E-e8!6Vc@UNZZb
-pB0XX"A@eI86qdL%p!iG+[&N@3`+8@XdpR[lM[4A0k#30UVRB$NG$$9Ii)e1QJ@L
-kqD2b'feB8"q,Y,[%UTdCI@,9N@b66M`45I0M,VJ89*a+iM($""P"+fSiH8CE@4b
-B&#98ja"&ab2YXkhm8R`T`9U2Hfm4e%(KHY"'%-5XhMQVeYmKIIVkC+A`LVX&ha)
-%Q#"MDU@R*C*fH%LE$`YFMFA(B(`(afre-8DY@8*)9!P(rXq9%@!NP&$!a'AjbDj
-F'"`Uck@b[MMFTABEK#pGDl#*@AGUD@*Ga0p8#l$#i%GS4q+8DJii8b35mlDq-5U
-&58#'Z(q$jRa,0S2SVTTpRm+iq3R9Y&"iA$+!eL&BF*hU35M2m4f6[6Dh3iBXDFJ
-85!TJb$6&V34%j5,`@SbH!RQ1(eEVP`2f[aXSK$Z8bBG#m0J"6[Y1k&FT(j8UJfQ
-,1$2TImqhGKP3r4jL-3Ummi$a`pVlRKqZKaemI%G"+#'f5mC#Jm*#&BX09LP#b%9
-,0SNX4DV)JXeq84QZ!q-4C%()&AZIIaSZU!V,6bc&IbI6cdCIS@6lN!#+HUaiaa#
-)F-ESU@"!"@h8S3mUS*!!'FR8$qiN$3TBe!LZ+`&1'!qhle`fi-P1CDmKrNL5Rkf
-+N!"PJ)G[b0#9ZUimhSDIXMMl5)#8*-I18'a-rRN,Vr-XiSG&Le-NIlh"rrAkd(`
-+Z'"G8N!p+@9P*,+H",0d%Lcd8IbVDJE-lV@C`VYM1'FQ&p#*QUeiCP6!ikh0UP+
-1P`h)YQA!40Ef#8`H`Pf1ImfJF6@cRGf4X,j!bq)(ki"bU*VJE[40FjlVYSi8I0*
-TX5CT!E3cH@BXdqajSDbVp$!2E`3f5a(*RmQ"c0Vm+(j6fPlBVjDM4,UKDj`a#hX
-%M'2Q,Vdh'V(f%faA3V`pAPB%*qU$Rr1CQ%-,"0XaLaBYCM92k1$h(Q9Tpl9ZQr!
-j8@"L$elACeV++VFmcDUeMDmr-3H+(1&h8L,L*pIbCRbBT++6jadHrQ4Ib0FrE3e
-blT*[mkM,06GEXET[$f$$iR!9+ZN"D$RRZFV$rScX@6BTNYj8dFLSY95)4Y9DYYC
-Fib$hfZ!Pb42!QPIF8RR'YZp0l$aNK(l*!iq2fNe4-!V4UB,cr[(8BHGSMlZ@1)c
-RH8i+6f*RqX*qJY+TQXVZV!"f"c+hCkG!IG@EdZPeD%eY5!cHbQ+BTiNd4"9a%RS
-+K65V&(cT9Vr4e$#RK#d4Gc6DcVMRKJEX$e$pkMUC&r`TmK#6Z*cQdRK%EF3DEQ+
-+"MDQVXKT-G,16X`2fNQPYh,#[A5G"Z`L"Z(FrU3"cM5kEKS&11jD*r$lHM&HGrU
-mLd@$$3(J[h13!%U,CpmY"9XK0C5*pG[S#U#G1J*LQQC!*Z`Q0%UH%'dj"Em5C[8
-!b,*k3XBP25kd(T2XaYd``cEClXHYT[Y9!p14bqibY4Z`"X)8qJeQN!!`)RX`pLD
-2*YTcNE,jM8KVc@3%1lYCai`)&pLZR[A`ai1@(1ma*T-A3#qidem&KC*"UeqBVKe
-MD4('e,aF5(3'A15SFBRS%94q)'#)h@0rNPT1h$HJB,644iIUR@-8J5Y[5IiES!#
-I&2RE24Q)@Rd#q-RV(L9H$"J3B4E@9pSMNHRQfQc$j4+2(Dm"*UhMFp2&`3*pme!
-a5(3Q[U3B-E@L(HVDcbN4SN5e[+X+AlNHjT!!"XeJ%PR!jMFP[&r,"PDHciiUTZ1
-56TJfD[8Fb!(ii!$hfd'NbIL"a%"FSmLGmIKK$,C$30H,$Z3)T9km"*(%`GN*3@6
-VAD[RHcLbS-a*cb'1rD04)piTG9FRICKbN5c0`PS0&)4rc)fq6kIPm'-&ISJ+[IN
-(@#UYDQiJDNhe&b@1VA!SQ)-UcXq%+$J4ZIB!iGRTBP04A(X*bXqU5AVpCD893IH
-JpHEb!flr@TcM%pqJQHlaemRJhjk[4-jaqRNZjTV0,8I&*Jd"U$J1i@3,!RYACZ6
-&(h0h3lN9$GK5ZZqdY(c0F,1!+A%!Dj2hk,P-Z4kN%VV5)ELf1[-N8MG@6p9cYm*
-XN!!0HY`3kUI"'pk9'TUX`AXYX!(X53(j0qph6NP@6hea+GF&P3L1*q34@6`1UcK
-DRr3!J@T&!4#&EHBLj,NL#'0ClXNJd,IT"VkDaYl1fkPfb,%,f6!G('E9e)i4ddd
-ehV9&chmV0pUDE,%*i6"D6-CH%2!P&dbBQjCl1Bmcaa8TR1*cT!fqrJNPH1+lk(#
-E,NaTlJcdlJhj33ATYarYiCLFZi1d,,A8!a0Ab9N*MQeIFI"frSR'Vki1Dj,[NXl
-@3THQrTmAQIa0*fe$K+JIDZ9X*d,qKi-ECj%4D$'*XXeXd($R,S4P6NNaMG[2(8N
-r9),AFki80kMCHIBr6VrhK1NPH`@cdiN#[,p"b&,c-34XkI`!EY1Kl4XA+a*$X"!
-bkkNj%&9q#iDNSe+#cB013qk25$VZddL[KB5MZDGj!Y23plP09UPV9PlaFDa[&d-
-#TU#KEFi4+jVScj18'$HDEJT"lDm3,`%PfdlXqe3krK06fjkGiNd#$(2%k&EIh2E
-El1ppZJbSB3q`YfYVbpZ1df%T+Xr#qiAfp'3fQdm`UL&0mlaB!hN-DGIcC9kU@Mp
-C&0Jp*!8d!+4PZN,45S9+9KhSbqF8r%8+[-T3H@1@9MhHX#flX$Th4EHSciL-Pj+
-JaQH$XdhIfb81$M6A4*95L+5b&V3%qK!"6GUC(DlMqrKAAEA([RaRC[QlVrPDABl
-jh0MAKV6[XP#FKGBjj`PX(*i#$')&j1T2#L82P44EP,XdKE@F!Gk80L9cCYG0,I2
-X@M1[TE%j4QYd&TcZlJ'0A%F4I$`0`+!"q,50`-I)j#,9PB`$A8G8jcaHI@@+FKl
-V-2-`!ZQ1H0[2hSkc)#d,3k-JZVBSPedEJ&ZGdYY&F'KbbbX@C,Q)FF&UHaPqAce
-$apP6QGlFBHY,-AXpe%c@#X63!&K4&#G)6h849rYlUUVGJBA-cVkb,lEQdq#NHb(
-`G[,&%V2MT9`T9c[JE,D$r*Y)AG(NT*GL5k61TIQR%YMY,4pL85EiBaNYDd9(#[V
-d2ffMd,HZPRF,MNF),)iZp%8Qr!2!08h99d&PB(Vp!P[ZA!"HkY!#Se6+JcAiUhp
-@bS-&JS1Q+h4iEXR*3YQ1U)CV&U$2#Z@V&da"[R-H3r9"ia'0Bj%m,kjBX3cF9'i
-K%6@0!$'6P-ZP`$BR"mT9TEU6-ir!HZblmTICLT8ZJS4d4&#q`S13!$,J&jfbEBf
-4Z"l#FclcTlZ@[KdXE*(L[Q-*0VD%1$Y0I4AJ[AP3T3A5B!i,E*hlSE8,@Q,#KE#
-qV%0,QFck*cR'fkeYBm8J&elJ1,CV*`*Ie"T8j6TffZ%2dQ&BVXLh,*X&TRXh$VH
-QEK$ANh5!G(Bp*$,-c065!#3eRa1h9l#3!$T9cZT!`a#9!kmFclI0Vh2EGMJCeP*
-&FT+"9fYGS)r3hTeBKRSIaSY5N@L2)rqrbJMTX4ZCYTmY834H9HB@[*Ne6r@c4MV
-%frBY`jC4K0K1qTqb5#pYZmEZIe3@8H+DJD%GECR,%S(V1kR4TA$+p@#ZHTBHND!
-HE1CfSSl$PVKGrjkX5QiI)R(1@T,FZSGm60iIF5@Q+6D&cJcq*ZbI29CP4QcSh3&
-+bL0D(Ce%q&B)SN#LY,CdZ8'53[GmVc($f`H62V+b!SP'EN'eX%!5q'ek&0)+e+-
-DlYlDTC@$@X(%$FL'SdQBX*FCc$Bb@3p)jS6A(QFhr*lM&!Vm#[`a-l-LYq,+8#Q
-4+V)UReab$@P$MI1bLARYq%-62C%M[D8cDL+$bFI#qE8T,icriAURi%h`h'Z)rNM
-G)QN81G!hSe%Piq,QFXRml++(!LG,&fS5*`ld"BVIjJLTi`3e45`fBI#rKXVM(5A
-aK)FCSi&*GVh4JHR%1&E3Q$XiT19'T%PciDrbUI6DJJC4cd-5kpUN@IqcL8'#4VP
-FNFVM&1Xr(r`Tf(XbT!m3mlQCj)''S"&bTFdZ%%)FU1%54J!6ZS3ICYK*$(C*IYc
-jp6)@AYI!T5*XD9JN9!hG@-PI!h-Fm-rjcN81fUlU@"hB*M++XDGlIjDP6DIZF4S
-RTS!X2TM8ZFK`30!kLUT!@Bk%jmjkk5k[m3h",`aYYi-$Ff[FZNKGKPG+[Hb#FVq
-kmKq4r5[ATA8IN8RNk"Krd-YT6lPL(p36Smlj&Q!%EPVc'r!V5"IC"+JPDVf%p4L
-Z,h3JfTd-S0L`YQJmK'ULq-IlUSMq-Ukl8T@j!$[5jQiQI92RE8Qp5kU0)ebY5DE
-c"Qr*J@6bZBUeeeTd(Jj3DreJ$ENR'*k!Y"C(q)C(HNfGKY0QY4T4j4!-HVINMQZ
-3!"AEC3kfcEdQ!MNKIhLHPa-Xbc8BAk$FKmP,(6A19lfQ,445FkEA#l@RD%d!HVK
-mm@FM#r8cK2aZPT!!h0N%[4@)@*NKNm8L-f#pB@$66a1A(HQ64kI2A4Yi0I#J$S[
-aa+C1TE9Fl9'1JQbCECb&-$2%Di+"EfPCd3`8I96J44l4kHHp-J9TP4!kr`d[S")
-bJ+U1L8fETli*e#mHl8%hBB2S+,Uf%3q-Yc@dhIhC"lTJ@@SXlLNR-JRJbSTj0G0
-L8LA%pc3(a!-eD3X8eLbKhJQ9"mFE6Q0MJV30a4dBI!LJlPJh+2044,XlLLX0*N(
-pSFm(djPR"TBb,I3jNG3CrM"Sar!E1KSDHeZ'TGe5UlK8!A25-@(L*lQ,ZqXC00Z
-8+h,0ql&Q(r[Z3CI1V'30J'lIQX#r44(SlA#X-&IhU'$M`$V'13kN["B,APXAPfV
-a4%)21R+mj4m@D-kMbJ-,Z%j*Z$&CLDRrXe003YNZpq%%rd@&+4+h4rd`T!!m'hQ
-q3Z+,$P$6lH`I3h'9iP3'jN)LP"Qa,4PK)ELp5bY#-1k(VBfefY29XUVR@h-L[[2
-!Al`F6e(bKR`[GS#)"`EF-0G6N!#H$kb$bUa&-(M9DTqk*6-FKS!(Pfc`c+,CSKP
-i8$RrVldDh9UML)l'YXFQ1%P)FN!p0@B[Lk-k4@@Z1#r0l)$eI-ET!PD3!0VUrfC
-%R(LV)N$IQjE(jPi6E,C8A,,V+DiLYVPbTqN6mM#RJ6+q[*5k&Y0T2)E@GHeHF'B
-T'V(%IB@MY"P4q%'CYC-B3b"0(i6I@j)$bl2I0cV`P%TS'8f**+HkILT0ae!AJ[Y
-`AmRcrjdQLP,+4rcF$mSmSi"4D"bR[bpRC0)b$HDK#LRTL0c&dL6bJY#lp)fT8IC
-0Cr&`m3Z(0)EaVC@8pM)@0!(@1D6A,kV!XP'P`NQ4r6,E,[rEGP*rFeP-kL&kVDe
-XcZZTZ,VI2(Ueqe2'D-eMH&&a-II,[9G$V(AICZE!AA[Zb0l%U''B#UdPGU,q`(I
-"L$6VJ'YYH@T)`65eGQT"lR-[,Z*dYKaFIjN2HqF8)FYLDYlR*#q)!8irTIR[jX)
-"N!$YdcRVJ*cYh(G8MiI,9c8(F(ZALhIXeT,"@(DN"[G@,brcVP3XKY-Y'r4l4+,
-@4dRUCZK,XN3KIa@f4XeX0(*Y(%hCVccUbX'JT,%GeZKUDX!f1'j`k[3dP,&[D4[
-R0kdDq!ApK2c9XTJ,a8RKck'AVq'[Kd2b(Fec`2'%E`FM0jhG"U`+eiQam40Q*'*
-ca-CDmHTQNQT5jaJ4"PK2J36T21k2Z#q3!!kU)lNU!TlTM!9S9%L@!JQ3!,PMSdF
-X@*2,15Gb+64S0aF3!c3raQr[$p9Ii"p340q"l0MEdGdJD5B-'U9-hfQd`6!8p+h
-+#lDFIZC6fkF1Fm169YI91aK(-"@dT6MmC"*IqUll`&fQcceFaXaRLUZV+HF,Jl0
-rIlQNZY(E6`j1`(cE`Rq!60m*APYi(JAVjMbq*HR+rq4qk3MMIiTLmR#0XGckC86
-6AE*b*[h0)dfKiUQ%L"ap`EH3!#lc-p1p%-HhMU*Aa@f%a0QT[&"Z"--IXj!!-$j
-Y4QpZX9eZ9aV+6B6NJA-p#NTkN!#GjmJlN!"60IqL*X9[q&Xb*8'c(2J9S0l-C3&
-6d$hjq"kNdfM6THFcTP8[YjD[IPpQ*Y(EHcG&hcimiAQ[Dml!#T-YklUcpFK4Gbc
-NMaKF1lEPG"mBUi1VJIYJS0BSAkT*X`RL2(2,,QX!N!!9NLUpN!!*,aj!LpS,#4C
-V%9EBhS8rqP`YcJeFL5GNl*E#Ge#hH`L0'i-K&L@8'8kXGXM6VPa-MG3FdB9f`rX
-1p6'J[)PMMB81#hN+!P3*9C)A6fTIbjJ,XLkK3rN55b5UpdIe2+04Qa$jI`1I`dN
-$fFDeT0V)Li(8(%Fi9X5QiC,YCN#lK+3A0AqZV-3S)Cm(Kp61!Nk(c0+5"2M"'e(
-S8[[R[X`E#MqSlpB9MBqJmU9r66)m'#eifBIQ59$$J[qFdUQMeF9ClXH3!),)(jU
-A`ZKS!'(KY!SV%8rrbT*pjj2qMN+4*C0d(QAR,LHKi5,EF2KrL5ab#3UKdp[e&c9
-$UbrkRZGVM+,GADPqi!I@8R**REfk#8$%EZSiHIja(QG,[cP*BIA60G$`i('PaCe
-[ICKZL*L#cXPqh'CH01ahc3Npl&"@hL,#c$Rpb"hc-ID688R$KGf'C+50U6Gd3+k
--[eRDXmFV%2[(mpJ)JFiq98hRA)0LTrZ)%NXIHf[*$mVJ6HM%H#r1,J8399$a+"F
-T3LQUAZ5Q,RmCYQh29Z6l,2P$`#dpDQllF',UP[[F)LJ$E0#*D&@0UZ`)D8-f$LH
-%@e$,61kSCdeE)TH6Mr(G4Uf*K2Ch%-5c%@+NC!RASEYqYd&9+S@cP(k+6'64(L'
-iYjZCrlIXePNBKj!!!jA+2QJiJQUKP#rHk@JPlbFj,HU"d'C2mMIiQ-F&&B+I4M6
-j5CXZ&)J)XV%fPrKSN!#YlT,%Y5&`+![dTUj6C)b%A%hBUCHF0I9%J)LR*a8Serm
-`5kdDPT!!529B2h2PH,-hZ%5b&Y$)1pcSIp4(4a+-`l0`)$aDefECQk4+@"TDQDr
-phhJ85(UU)mIlqDqG2pfR(Y,AC$(Y0Rb"TmDUjaVI1+kSF43"4c+#h2ZdN!$fh!%
-"hrX4@DiBpIL9E98MjmHQB%69"d'%hpE)2*4#eXk9f0iQ1e(lqbcpC@l5(fMR'ak
-0+PaBC*palBSQkLp!-+Ym$0a0DRTJM#0GT-Y,RE2(f($$[TDR0bAS'"Nm1eY`0&V
-Ca)h1C0IhAK$ITim##i6RF`*9CK@%#%P6&3d(I[QZ88!Dj92%P5d0LL!1V&!&!BT
-QeZcI*@1*F1GP$I62Eh(QQ#XF+3CD,[1`AQi@3ESA52BF6)AiT$G%hMl*[DrqMc*
-b[+k$k"U,b%'[@0rS"Q@F'39q!l8HqF&ZdT&Xf[q6M)TT(XrVMLZal6e6f#-eD'N
-jcJZbRl%i(XieMV4jA[B[6L4AQ8ikEQEhPlI'3Nb05U"h*+Fq")MH9A-kKI!TkUJ
-DLkcb(Ve"X!VVFc29m,kJ(Fq6eJ#FSTiGjLP"Y)mIf,!LmQRZD%Gd2*khULeZf@5
-#qQ1*'NC80!&fp%FBSlm#KTlTVe!hFh'EY%J+%6NE6'rFrS5q-d(H5XQLX(kq"9T
-XliR4V$QrT,c,+Q+S"h2,k1ZjHZYG"@QeqTQT[L#(iQ5H#MEJpZL+,G0K`V1Pjai
-Emh[ZYHJ#dbQh-mjIV1i*dRZ[*q,#'Jp$5&GimbaKlX`Rm&HkYKIFD0@CHiM(3H!
-8k,SZ)GUrR,06Yj3*prJdqUpINAbE$j03,MM'-&8!ID#FkY6YV8I2lb9V`H''(hi
-UTKPC`e60IjdBZVDXdETQfR1ik3,EibSK'b98d11ZS"1a&TlkNdEe@cI0NM,e[a3
-lAfFNhcqq8(hA*6)`E1fmqe,d,irFS(QjhPl'U#B(p)'"G#je8cXQGSAVar[6GJ$
-fRB9CJ&eGeGcK(p0J*H6,TdS'6HMp1#9)*[EPN94[0P4R!e-d3pfN&'p[qVDA"JM
-c1%@,1j!!"0CReMYkFNlN1(@,eZ[0-)pFl9N)N!")aE6XC,UfDr)VVk%5pR8-J19
-NUE"d294HfaqYH'[Rc$11I102NN@'NV&rbpZDlQecYe-9G9DEMEX$CD#XRYELfDb
-HEdG%VZ5,U+IhbXD8R8YER&J+CeMKM-c#Ah-T!L!j"QF9XYJjSPXL6i@j51ABrYU
-qRU(Qk+mSHE)p,q[MfEpepqZXr`lHjPA[Ead1HFe$r14e6cSQRMl*HSKhKZcj@,1
-XeXL"f`FG+)!Z68jmdBeEBBMRaaQVc1%[(e[FjK0`[l*rm6)eL2aE*#MYF(!cUK6
-Ri8b`P0C#e2$h`r69C5Gf`fSdLC36HaVX!eF$1Z0!P,Ci"NdXPf`MqNc#68C-$0[
-B+93T,jrTmd#B#@#QIb(jQmb-8"q))PpqkZqmB1M8i"p[TM+cm'0CASSd&2$ebUj
-3f,9HaS*@RI26E8H&)3GE2FPH9B4'Gj!!RmLHe(VDP0AeBpU#QH&*jaBKf!m0Y8h
-8jFK""0Y8M2d[YmKH2HZX*`JVJr,VTYP+A@VJK'LMU[8["-aQ#UFp`JTc9h)e$Nb
-`K+H'h0A53F*YR[i6UBa[*QaSb"l[m#J%i#[aC8mA@bKIQ$NBI1TBI3"pJ2mpdmT
-S!FREh8@9&NFP9K3,1k4`qK2A-"4L'Q#$[Z)jXr-e'U-X$mp')3VA$D)-#Y$dMY$
-bKbA*p9NdQm+e2Z*4K22,"EB!qfeImh+rd8!LZkdKcpqIc0DlKHb8iETE,SCb-df
-Mp"8bC@@QR$br'c0L+6*[VLBErkk[j"ler#m8q@DmPZ[3i*,2k!Lhj`qdHC&T(UU
-DhiJGBdbHXEqQ4Fm65[2Z-[$B!G(Qak%@c[MCa!qdLJFmQ",VB1M)FE2PBie!lQ#
-'-AI+J#4j64bpNl988Cp25TJZa$A"Nm1,8!DJDdm-JaKirM9X[B3@GXYMRR(p4YG
-a[Be'hlp5B5&V`Gc+m5+4C'*)S+Zbe2P5%GS8%1TJB32Y*64M`F#!(6XdHZk58CB
-hmJ&2Nr`GD60NZU*qRqB+@HQ5#feYP1K%,GfiTj'5EA*35UY-kPX!pXF6mapXp&j
-*eG8`peY26!l8Zi[c+8mk(Q3-ip$3A5j+"NJGA@DaLmDH*%J4Tf($R+P+mI",&de
-dFR-1$KlZ*eU@8lH'JPCRdk6DRZ@0L+FJ+95P4e`Ar@-X"F%A[JS(V+)K5[Jm$GA
-8R)iABA-'eKadHSZ3!,aT'8!SCR(D!15#'iUc[$6rX*VXZIhANI4C3J6[fP8*r&'
-I,Ube+mP,X(b&CJ0kCZ('cbX@N!#6(fM-4$&5BNe0T(ljdIpdBR(TQlH29jri*ha
-#%N!daV4U9U5IYEQ6`-`ri,I12@3q`mK0%*MT0@I%ICD@hcX3-B)pIp#rIplri0D
-GEdKBdrZepXRDjUV@EeQ-,Nba@9,FDEL[1FAdBiGXp6q$`UF3Me1&FEbF+Mb@Yf"
-i&a,m[$*m!Sk43e55frpJ9h!RE-hb44Fp$ZdR*`KRqB4LNIC4B$$lIpTpZ&0i5Ck
-iraU,K5J,GjD[U`V8!*jdY%U,mCi'M6XBRJr5h*!!!Y*8EajiHjCM&HaAKm31Cp)
-HQU3`!QNUJ3'5pU!$[dYk*2[ArM8TkEMr4cJF9PBp3I1FZ'0Re8k@@D6-85lF"DT
-lph2mfFmM89hbZ+3mj([KA39J*$Yf,rR!EX`jG+,-`pG4M(9bM5[40R8Q(Vf'5#Q
-Ri$24hZc4U@'SdC1pVSHN1i$@1DXj2,BcDSkNY"`ZP4DYJmSaG#*1%@BDAjX`MV'
-mNm&PZC!!%%D-Ki4Ba!i-rlh(HZ4d2[Tp+rIAAjMr@ifXBC!!8F0qN!"&Q-IdAiU
-*dr@(pmiAEK2H[ehY%'Z,XS0pF((,(h5V+8SUJ!8Ar"5N!GT"h2J&#eQBEK-e%9f
-9XK4eYTPM@191p6*a"6c`&mKDKheV)pC@DHpZ(j!!&b0kiqC"iVM,-Jic3$L"jqM
-HhR,XB3Dm2KF8h-V&$XhiP)lJQEeXHPC!0J00ei(,GGE5@MU!0mmT"NQ--V9B1RF
-MfiQUH)CBlNNUZ`8#PjmGCFTFFJDUS`kd,MB3[I*L4*&,H0Dai6!4b)R`1PM0`pj
-l[Sc"pZ--T+!TLrQ9rXdlrpKX8e6acEZh(k[DGe*!!"FZdbCdMQ2V(Ipqr)bL+FF
-3Z[FX9L5)#1Nq4!rPjaS2kDYiTriq*ia*eh+QIjQL[%C%-M@lj#E*81#TCa#BLHa
-V401DpkbX6S+@Fm($Q'Mj[r5cG`[bF8G)6*de41R1FaKV!HQ+2V&B@mS#BF'-,I%
-'ReB,FAJ,iKcdU@U%&c5!JEQJe2-6a2cMhr)IdDM%R9-j29mTMPTFce#H8"53!)p
-@Z+lX$cFfd,i'AjBe45a6m&BXS'G!IL@4)RjSGlT-#a)f,l1mc)8N4k%9EJ)8b*%
-U4Y#GfT2[m6+-c&e13`erElPf[Dk[aA[)#6F"!FQUQlFp2SUrYHB+"[`9VIUUTb'
-L%dBIdP(S*be`$0`DVqK958,)3Q6M,9"6$FS#S%p&221%5c4(MQkjf[h)#H,lCUC
-PcYVbhkl2XM*dH0GqYQ*pZ6%Z0r0GNcZY'jmE4YAPVKYc94j)NQ-e'3,ikRPT*m`
-5m3(PcUVfN3mBdFC!lEpRFj9S3QD!U+K+(T(ZE'L9dHE"cGK8Zm@r)2Il%`5MEJD
-%1@RKLTaNhL'i"pe3dqI+BQN@FHh5NCIKpr84Tjqr3Hl%HiJPRdpG*!9j#c(9Zcj
-`ZmI53LVd)&1e+)[3GmU$SkCMbm`cJHmrdiEc2KN!AJK@NF`2",Fq5AYF8#U-Kr9
-aU6qX[h-HQJkZN4G0`D[Hc,i1&2Dcr8%eHA-+c+m$)$Ml8A9XSmN``VaV23N0,1%
-+aCQ5A(DXa@C)HC,b'Dfr[EH#A[lNKdS2jdAeBjmG"ri+Ch*Ud9B9+AP-c*12[r5
-b42ILaUrBSjG8Y@dqEj9rG05pJ$qY`2@K6F2,Zh2H0-Mp*M55'ljFN@N@#['%e'E
-hDfk5I-)G%XTF99aG%VkfN!$(@5Q9qBf-2cL#cEP,3Y!Ll6MVTh84V)24bMRS54M
-QZKKmbBDkD"51262MV+@,$(0FTD-1D9!2,U(2RX+9-Mh3Kr*HEYj9#F[4@jRZR$c
-Tr@rD"b)+Em8P@'DcAIG,2D&'aVFf-'lKl!JcELhi`j,V4Ik8p0F)"@E4IjN03qT
-hVBUC(P"NF,R#F4DN5'rS6I2S1r30RIC9*kpleN+J&iCSj&24AL8A-4S'VGmr*V#
-`P6rM)4kd,(#*(+$''QP"qhE!fMQ-e(clF%$2&#)rJfESm3Lk#ZZ2RP@4Cr*0E)+
-Jea*e4q`*Q85NMSacR2d-LIF9h@E+laHm!r`VlehUT2#,4LmU8SV'+fda@d1)`T`
-Y6MPiq8X&&&&Sje9V9[mhT&UZ3kih*BXqN!!BKhX5UTh%!CdV(NQS`0TbH1Z,cmS
-+H3,J&GEeSG(&,Jp@U4K#TYV-m9G-c6B5J+368Uie5!+3!,@&p!DV$8RaQmq[b)c
-hh3G442b3!$f9R(baG@XR-"FGAiEVbKLklU&#TqX'j!Y3Vk5CSGE0cI("GJ([qpC
-&qG-pYiQ&fM'9EM`NAEJ$H-V`+'KFYmQPKdAaQ2p0)V)01"A'DUZQP"'*5kda$+&
-Gi5j"fFXq[2PrMAICAR9#GR)#[JapDMRUbmdB+h@KSkNDJFhP$DTTTp[BD4%`@R+
-@DbjAH@#PF6RU3fhIa9$(jl%e%1'C&,Ek12@cbMN2Yd[c%h49J))"rRVdQR'hEfC
-`If*`DV*`lVe()kN8j$Q9@R10S4NaHYY-X`dRZ)%Rc-pefd"rK+l!Na@4KNFFqaL
-*'e*6+ZY*AP&FKR[4LS%"T'i0RAbTEh`NP9b''Dd@9Y*r(jiN@4e4q&4,RY(iq)k
-1ELAA!b%X0NYf+iYlQ,ZHFfiFEZRYdL8pD--p8K'e5eAjR0YLfQBpTU8(AH*pMc2
-4ET4qmd&jNXN0'Zmip8EHPBhd['"4B1ArSi+FG03i-MM"$RC`9k+rklicBF`JpM'
-EJQI#(rTa$BHV)4aMX')SbiPHXM22D)NJLpDb2Qe*d'dlR0cEINRGqUS@Uhe1hFj
-)c9cYP'R5+)lAe"c#+h,1jkNP$2+%cZ`$Ad+jUM!Kmrf8TU)""e2@(+SADI,b#S#
-FC`!E`9RXJirj,4bEp"mUZD965qlLr!'fbLYFGMX%EZfTCEA$XH(`[RCNlraaN6B
-*Te%*X%A[F25a[SM5AeN&T0NqkFNTLq%P1"8fpKHUT'(Tk&$$P-M@CT4r6c%)aD8
-128SJ8KSU*%3FG9PKlCl3LUhlk"`GQTBL@'*p,MrDa,bZE31Uh4#`,3$+2k6dpXV
-[0U6$EHe`1M%fK*ea'+T-MSbB%llTBd44`bd-2pj'1*+`'a[eGP!HH%M"K6UG*Zk
-1$*dM1LZ&S#-aJC%G*9YDDHCF!JT4!S&haric+++EIjLp+1dHpR+C!#L(AeAjU*'
-4DH)(f#9!',$I%dLPK%k4r!kY,BqqMQ9$(a)GF@!`c,adc,BRhe)C&R3iaT!!c5U
-bL%G*j"[N0r8TH"ak3e8Yk[5jG+[DqfC%Y#FPH[k2!QF@JkapFmKNTfD%%hb%Z1f
-B-hH`mI)"9pF880a)8!*A%%'dc8[QI['%4$`3Ua9ed%Lp6B(69-LM%PUGq#-#B24
-iFE8%#6hf+eeL3)6A`9$EhV'9L8iZ8l)!$-9[QjV,Hj-1Spl'Y#)J5fP)SCTq'UZ
-kZSVpbe`dZ"3Q*k!22Y*2(B09SkYfLpU*KlGNXJqc6qGaM#$`q&CaLS[)$C4hK6A
-2Fhcq[83XLpDXT0KljTY(dJDr&Pec#Z,iPk[)%X*lb,#L"HqlQY-+qdaLbLcD0Yr
-R#DDbi0jSG'h+DeN[bfCf-@6jH64G)6Z%0-Xa"["VVp`pi,K&2bF16d@d3VSY[Aa
-'"-,9jdY(Ij5&hJ(Q8b*#p!CSaXar&ETlk8aHU`@#@A[Q5#@H&(rcTL4%"ceG*05
-F6m5Ke'F8RKEp%KGI4lbPl8qAK"hh'jJ'T6ZIrVJ'0!)A)5EQf2#L`)#,$Cfh!2D
-R5*kaXR@F%KJYTZP8!D&8D&rNVq'VV6b&`rJEm2h)JIVIQ2ZP02aP68"S1qaGYSp
-JB-UZPZ5akGpd!0%"0aaMbkq!HqPD"JG)akGXb6k#5Y-8TaP-P"+%c1FRq!CVb+#
-$&0QHDjrj"#'m!3rKCZISG1$#5qpUT8VDDkPL#,Y#j`&Xf&"E+P2I*QUR%Nd9B!m
-ZbdCQUJAUFS`1*EN)[[Ve1-KF1ILV%BAVG%`R"U8B6-iZF'keShpP[RAA@(XDrp,
-a(PdXTE#iJfRJMIKqf5$F@$)ccC5r'UAKU-5'j#De6!YY%YI2a!kldJGl#VUKRqk
-Aar'S8,LC#6e9Ea,Xi$UmC-C4jP1e)iG9chBZIj*8F,m*MMYSZ@h(&N3r%1Flpjj
-pFC!!kK"TXSKL%2fZU+"Yq6FAmkCr-%Mp`ffiA,%YUHjPKYNVIDSH)#FbeF%+f&e
-C8&*RKm%I@CkRP8FH2+TPkaHA6U9V3S02jU0iRE-T20TC3Yc4fD"c"E)"`'!PAql
-dh2aFRPBB$fImX%iVfB4KiYP(*Ck[aDGQSG$-$RDbdkbXL!"@#UMCaKS[JX-XUaL
-(40R(Jj0i&I,[JJ'k6FTYa%a5#5C[[,c"Hpe39`%q4"4%$)hT2d(cQ"d6)bU[QCB
-K`0G$Ik-9&D,e(m$bJbliD@5fFU8pN!$IcfUMDRi)68R2`f0q3a5@F6r`LD`(&cK
-!U4SI!G5NpTR#0!YhmSa&m,,6[B5+@p[qBmeM2LZD*eZB&q)r#5qZ@`Q8REP`N`U
-!1LGM)U!9FZURIk2*$0q[aTTTFmF-GraqA9!!CUI6iI&S"*Td&,N)2Hb-"AqSY5A
-Kh@Kj+kE'RGTeGAX@JL0&J2Z!aLGc83(q01Var`3I,h!D$@+)@r44!l99B4SHk,T
-'C!5Z%[I"ccG,9eq$`A)%[M6AfEBq0[Cd'edQX`c,YZcGG&jK`UH,-m&ph5dhE,G
-%USe'&$a5(6f3!!(CpZ8f2!VqZ,'kG-EK#-k)fj%ZJNL,!'1jp&j,qQ,CXPL#5$4
-4eTPja%@kbC!!"i`4IP#+"CafA8KkK423MV8EBkLkZ'djaXepbBJDprF43ccH'2,
-m!4RLX*Zj0jcFIXMGJSSm(@b2[FVQ9r,*GB0`&+'dPeEENp%!p!Urbr%AYFGXT'C
-mmDh"6f-mEh9q$a-Cekq1hk[R5Se6Y5'J&,GDL))KC!SIa)-Z'Tj+&l*bB-C2PG'
-#+*3MjA4Jc2T4qRdf!b2*95aQ[b&(l54+$K,Sl5!P$i9#A0G1-##@-!'@"a`%ejF
-c`Ar843!X9r(IeZGBXBkGP"bcZ3j96Z+Q($&DJ6A-AL[G#BAh'ETl#*UYM[H"8+@
-02QNPfjFiCYBp&5&hS[AU$$XAIm'p9mjSe#r!C25*JP)1EZm#ljM4-1rfj64GBhc
-4)GVe1"GhZ'IBaMcqVE0-)-l-k8Z#N3l-`$'E"GG1fc#iZPmD1V06!hXQXRr[@[l
-e(Y35-jNm6)BI`H1HKdHXM3P-PLjRiFT8X(h&(8q!i4M6)MEC5h[$#2!+81Q!,kd
-2PQCjAURF#[m(aXjT8rB`L8X6"a59q%9"#R-MB[ia6IcEcXSUi2M6*80b-I,BEbI
-*V&*r6)!0q3TUEJ2G&4T+NT2N9!$TVhDT!!!k!3Qa@qT9T8c**&r'HY4jY0qa3Y8
--E'c)FBEiJG@Nd!&R'IpK0j%Q0'L,@XZ-IhKVfpX`FYU&)IIA03`CVhHkXp$eFj@
--M1"E!Va!mJBVm$S!M[RLJkGEmdkX3T@2h$AM@Ub)P5Y"$DhHhA*h(6,V!1hmR''
-a4(0lJj3F`BMSN!"h"clIkIbep5kHd`R&QjrX-,d(,ma@$+rYZ`a6AcN9pAdAf6*
-P$$e4-%B+LcjjkbJHQr)J(,$m`$bpcKKGR#Pi)lkM0[4V8$*A9lf0ffX8-m9T)U-
-jcAM43*8&q`l(`#lQ$NUST0qJbFUcATKEb6Aj$-c0,'1D3,EDE)Y2!940XX+eTeA
-[p@XT%(Vh53kTcAU%LL"*$IpDC0VC(jC!9FmmLQER+'CK)RQN3DSA%appa0Y$eiC
-LGkjRSP4q[ZL"Kq4jc!+fB#GK@qRqTEZN2be+`F&(lfNDSRb#1GYMbE#m!+BV4GP
-SP'5qf#MM1"`dL*f#P6"K%f0kKI+%LaCmlc!hfq!P46Y$fkQaS(EADi6X81#a"JT
-(8kK0a,Gp`2S-E0k"GBPRRdbadZS,@bQR`Qh*`)fX*U)p3"eGQX2"2$'0i8,SU*f
-NR0HA`LHC&FdRi-0EKF#&$!6PceINpVC,AL8*0a)(QaSBAE`Qr#6fKkcjT"XJmZL
-KU@!SQ*fjE%iUC@mI[(ZX95QmrkK9lFakD[6EID#4fPd)i9aI4B--84r'bT(RD&p
-4mI(RI$-h*pT$R!Sp(SMAA$T4X4Jhq4lSZI`MQPFj2)KDPbSb[*Ff%*,S(JaX"j&
-ETeL9Mc4$QZkqCD59Z(raG-2eb`U$$edIL4#&[USD3ErJA[8CQG-PC"[RfDJqc'k
-QcI#(L8EP"QQ20M1!lT6ihhDQEd6ceXQ&+LcG$iabe-9Y3IBFE(Q!bfXi)'U(9lr
-lE''bhdR&3A&"N!"E`qlp%V2Nhi@bbMDT!HmM$"JaT#8!$3H8jpbJD4JQIC(!%Ki
-2MU69"A$mI$TRhF,JckTPrKC*frU`2Z5'"iYJ4mdr(ad-8(rIqjZLSRkSrhTk*eX
-TXh'j0)l,bFqqD2MPpR1a%1Y3X*B5d`Lf!QBiXD,IAkk(JV`#Y8[[NL!ICqVX&CQ
-Dq3JE(J'9TUP3AKp)r!B"ArTj(,ef(R!T5V9mA-cRQ-I"JQ@NP$Nr&+2[P+DhUIB
-D"Sm(XDqdejKS'B#H*j@-lVHDa6A#p5,NE6[GX0)G2URUEQe!b*2CU1K['H493Vh
-9@)Kp(DrZmUK[rejKK,m*(!NA3Q'(VRU@"d6l!Lf91mjqPlYDI62DF*eeA2-XeS&
-ZB+-)+`+`TaF,`Bm5cai`@Kra@Y3EeT))`@)S2kqjXPJ4cCTIK5kP46$beU'QYal
-pb4KbMK[m[kNlQMhTU3GQVB&c9Rq2!E[-8S'B*DNMQ4B0DlUr0!eX[XA(Q1YIXie
-IbX5kRNI1rJka%eFrNLiD-m*)pNGccQ5@`YDYZ5A9+"!q21(%bEci@bGR4(b0,&R
-6&i8QraHpf(AG$R%b%XR48L,F"6RE"B[C)1TiJHcE5G"cdVG*GR!,P6aUmfVBFD1
-9j@KMQ#D8+Il8U96cEVmC5$jfR@CD"3%eT2PVh,(&ZG+XU9%4V3ImqC0K&ANE2Ue
-UM%,rL[i3kAfLc@pk"dA48-i(@k'Bp3NepB$Gp!p"9`H'!!QF,'%&fjEaHBH+iKB
-dN!$5#QXfmS$@LpGqjc2J)@lr04f6-,$))UQrXT5HqkqZ#af0C("IIXhUX@-RPK*
-Ri$"@RNU)E0E9"!G5eLq'LipVVM2'1lIM[0-d"k&Cjk9Q*pTM639"Vk,0Yp4[0Ec
-0#YXK"SX*lBbN3l)kVlj'j#Y6'Sl-kYl,Y6)!YK3%)FRVT)r!NSY0HbB0%U%&pVP
-T[eh2!kYeEd+QEVD"FcjQ5`EV3$jIr9!+c1#5F,0DHY44jcJ$5rZ2l!Mq'bM0L2#
-%#YC8qade(5(X0jeEJ'H$59DcLBN0MeGJN[mUS*Ie(GZlRE*e"-YfUI[dj*KVQji
-5L)(1lE%-Ir)bkq8C5i*j@plVl@FriVRbNJp0N!$N0%LEkp!lB1f,,N*bN9D#*N&
-QjP@4@A9&"ZcCDE5EbPLCLjNQ($&Y&Ud4VB@b)MBFrV*`d%5rNea`%U8YiD`!ITI
-YB,*5!)N(r*GY$3d@ZjHFrh(i)l1kFJXk)Fj3VGkMP!k!@'djZ[AMkV0M59q%Hd0
-0@)NcMYmBKM$SA1IRLQeR(@SBacRLiYbP-[[-3AeKk+Ac+Jb58VD@&V&aT(#MKB6
-T['d4Qb(NETj*J)Ci8@%5%+,Glr)Qi5HKC9K-Ti0phaM$G*!!8M#6+qE"LY4dNJh
-!15F93Q%8BmA$QIV[9kP,`8K"f"PlBHCPNJrXASa!K1TM(iJpHAmJhkYjM%mN&2b
-#XXlI&,LKXeU1er`e3Fm9rG$rA@*+i5VA914biMB6+,9X'HDa2YeJ,-Q(3X9HmET
-53TCCC0qPP)(jmBZ#YE6,DHEBq$KCm@f#d3HhUH&NQCMZV(Gd-l22bEX801@E,-N
-ETj51A1'km%IQ+Z8S1TAN96VB'r4CV+$-[G%mih%P,Vq*9i(T8Hfq+"!NXfLKja+
-$a4DdcEhlUM)ILA-,%QS[,Fd[I[arQUSa8JZFTlXKLRhh(!dJ)DK[!,9ch&PDSY,
-(KHcq[$!`bp@N9mlk26M#[f1419lajA2(,4B+%mXf&[Z8[J-fQp"TDR)RlJJETV[
-K0p!HJ49kb*6TPSRErqjb@Q2`I'r*rei*[SlGi[!4ce2kDBa,#,&)$VrQd)Z-bST
-Pp16EKU[YHTfSi3@NeDEMXL'#b3*+0pmakBRC*$23jXc1qM33XS%qc+VaehijpTN
-#A2lR5*UTNMKLp10`rFpaHIJd!403kPpSf,T`Vm9jRp@ZmqUG1SiUXIQTmSBA1mf
-&,50GINpED)&@CfD2V6Tp&$R3Tj9jM@Z-!a2)ihF9*-A)rIIq2j[JXjNFMb#$Q[3
-dEKT&AR9j54C9+QTL'N,(CUD'LkZ*#+SXCVf-c%E'FTmiRDm"31eQb&&mNIT+%r3
-1G-Bf5Y@6XJU)cV-Q%#251@0A9ZD4AdfJ1L(@60m-eL1drCSa0iRUL2&4Zr-Lb-K
-1*AVE-6Bi3e!Rhb6ipQ@CrLedGT6S+56UrFl)NEX'jCI82e38bdSJ,BUfG4[5jef
-EY`rmq2idTe6dH%Ue-c(LXUiHE$##@a[hlD!ciT'(Z'R#QkFE`c-c#)(1NLFA(%P
-(Q+F4f6LdIa$bbYDGE%,lRPC3XUpHYq@b%`6(9J'D"kT8M*Fi-DiS[K#eBeF2J`k
-2m&AkI4"U1VKB!NP1CAf&QP,,HPR5LeF&%BT&iiXXS*Ja1lpK`df&LKZif38HpIm
-c@0mLI!lC,X(Ii%@Bf9)d91r(AZUj!ppiappr9L13!+Q%-R@1Q,!'),q4fqX2#`!
-`mKG3PXm1ZpU!hd1d4cXKFBC2&-`@KS3I``d!X4V""cqmCkbhYjfJ01$JKadEFY'
-j2QAEA(,lPRLZi!X8)ZI`N66b%RLB6l[YHCh!cm9`%($bE4+$STB6RJc9ZAU!iKk
-J#%9-c,"kM)Qa4crY2Uid[Tqmm#r4`Pd*qK%a*mSdeEZ*fpkU&N%qpVD0bL#PacX
-HD93hIlmCc9TUjiK8&Sd[!QQT"`hJI##d[@-F&9l#'5UlBD"BH%JPC%EYTT+c#!H
-(iZjU2656M4Jk3ITQ8)m![[DfdrD5l1(DUG@#aYqSX)lN'U2jerP#[Rk&iXqNDS+
-[cPKYi0Z)@%D#dCH*ZU)&+1mL&4!m#a36G)S-VY`NYDl!%$1RGD"RZL!T)`4lYjJ
-,2D8$`,X*Gk,HhC@1@dEpR1*mI&riJCKMfI&'3-Je$QmPjKS$%DYH4jGYV)%*R)-
-@Imlm,!Y@U2+%aK"T8TKDfZ'X29,mU@Z3!)*D%LI64G68Yf(JEQ9JVNcd`+q0lkY
-j3[GhYbY#kA13!-6pPAr@PQ@i8`qXXR,!`N#p8jHG5dcIc8BRLm@Ye"#f'#Z+$KD
-TU0q9402lZ0)rX+LD3YYM9&pM*V"!h+KMS!N029IcV+Q(81HM81Q*,4bl`-M'Vr-
-T+eQ(Er,kFdHL%@aB6AXB**'&q@0bV6CcNPda4fkpk3iILBRf&-9jTNk8jMEbUj@
-T8CIS*E#Db4h3Q%'JVQDF+9"'l8MI+eJE41G1593Z,1@-RV-IdLercIa(hZ")a5G
-+Bk-+3ac*k!(XEG1*D&M$lf(8N!$ANLDI3Y6ALYl+Hi2!C!Ubp[11!!#PN!3"!!!
-l!)#dSNd[Yl'dI`!!GPJ!!3)8!!!",`!,'$B!"mFk!!"4F`#3"!m!9'Y6D'9XE(-
-Zci!!!%#b68e3FN0A588"!2q3"!#3#S"`!*!'3X(8L#ff)S$m6EUH,rkT-ZKZ*0G
-%`0YV,P+pT-#I)P*H3NY--N(I,I(SC*Zi$a[liHG4iD!a'X*,R&ecKS8SK,i9(qJ
-QbK&CPI$M!C9B,f$l0M8(RKbAI(M1BMhIBUS6B9PJF8r`10BMC6XErj[-YTEHm$f
-MLP++4m6Z6GN4ZQGl8+hflZl1,6D@ac@le1K3'X0XXSq(@1,cQ-)0,YiMP2JfB5A
-,%MaH9T!!c-D+H-8IpcmKLN++UDLQGH#*eSJc)VpEFXG-AHcZ)!h(6Zm2QQ%X+M0
-i&CR"NAdm&Z-rIeQ'Ih$ZQkr+6j+Qq[UH6RU4A@cQbp1426MJJS`($E"&BfJa9Z'
-a,!k2dJ6VL,T*1"qeH#NE'X-hE,*02JRl80ff%l",VcEbKAKGUf&K0-L89YC!8i0
-'SNkZ34)J(l2'JSb#9GJK4a1bUfCB8P3#"[Mj[2YdjdFlVA$@'Ccl4+(9j@R43Qh
-BTAm*V2($Uq,T!DSXVclq'@E))EG&&SHQ61H)cGEC*ENl&SYqiAU!0&INZh#E-E6
-QJ5m*@6fLAH,AK"F#CrX*f#PPECm)b4HAIPfFG-1P1q,J98I*-BJQFC&DDeiNF)&
-G!+p0lXhr#MSH%BBr65),"@Ik[fdL,,)jIK0VfMZY8m3I"l0aXV+CYM30Hl%hVCQ
-A'a'JX6+G9V6eUcmj%$68FBj(k"B,R,YHXGIXKebE"LeCI%bX$UYH",'5cd#$-CH
-&a+i"4DU1(lf@@kMCIHHI541f3cZTC[#,lQBFT"C9GZiA!4J@F+i[I-6rm+$m"E'
-6aLqF5+6F['2eeB"#(A8MY3-YKbI3hM`aLPrIJ58"'+hl"5!1TfPl@SY&&N&6U!)
-@1jrELT!!lLqD+`9ACfGl8%VddBIPeESq8TQ1rJ8KI*m9#m(5mM3l)32+N!#,IRG
-a,2m&L*[LcJ$EkPqqFp9e1&2jZhV3THISZ,B(1,f`8Bqd@1JIVcN$XYeRi$dhBBp
-K'E)hVJ$@&"1f5Rjh+bT%"")ILCT0bG*q9F3!%X-(Sli-#9m23SQYPF%YJR!8*6P
-AA)9q9REY6)Ue"TT9Y8CZefNbZ0E*C@pcTrUY[l'%r#mjrp[F%)0P!f-pPp-"HMD
-d8fPb#4+6dZVXL!KRT%8`#kfGh5l&q8*mUQk($03TVc'CGR3PGjL@!k""F3mi!4J
-0Z"*rc!HLYi,X&`cRS5c[mUJaIdBQaA4,pb&c`5fFX@HQI#-CK#'T`D%9M*mbGqN
-rrCe`"QVrMVL4((((+iUG*8"TH,Ybjc`lBC9Icf"UT+2K4SF!ZI@4Lpl02"8j*CS
-`2d!R'XN-@2U"ReEYN!!,ipjdR[)Z5YQB,c6P0Mj'N!$D&+6`a#k*pr,Z$rkU$3T
-HpS*+2KK%LHbJe+-Er[Tb@b-V'(#r+Q$$9k[rT4a"piq@hAiZHeSP1,X8[#%ImH(
-iG6,Nh6KK3RYG,E(j@+Lh)*i@K0q[!ileX$5D%JiKME4AIQKDLjL#[6DX95LcUhN
-0heKdib4e$F(BaeaA#5%I6LDV`2rC,l(V-UC3ehQP*Sm-9DYC!SN"@l%6iai@J$k
-DchSK*kid$mAeD)SNjL*+b2hN[kr8%N-(2b#3!)&H%"M2iD)1Z$(6!aII[`!,U2!
-(p1BLiUj6e!E0ChN2P,P51Ik5@+iRHEYL),-@Z[qK8Mqkk[f9J'R`(+$C-XY,Xf1
-JEqQc(jBjdJ8bKXNTm$2G#pRAGYGSqmm(-TI-KXS&$T%ha&alm2Gi4M6MceJ9UH[
-a!GrVBKk25CfGfh36aALIYb5r*djAZ)hFEfcQlrjh%Xl3YST@Y-!938'm'A)a%#m
-TVJllK$dc`5UIeRNb9HNF['`lBp&K*RH8$&H(&,L))r%e3*r+NHdfb%SDFqJXIEb
-k%+eH5dH,IlB#D&9Q)b$Yp60Ql+825AMfU(iIPDE+'bF`"VNrBjAD!SAAMd5N6T'
-dS'Hr-8'Q4cGI#`6V+aNa+(['k,L'fN2P,(fY)j'CVhAGUPlLKH3LJ3Fr+hVILLm
-m'IY$'D6bKB5e4dLTrfIr6#$kf-[dB6UR&+&#Id!h"S14)i4%"&Ffh@K`IDql'R`
-Dj0X@UQ38[IlM3H"-`LKHG$KlJY1fDm1F+#Uj+8`aL!#TH1P(a6m8eC6cj!JrVV)
-TiC6ClE1mIpf#LJY$!HL'15JbM3!1Ujkr[*YhC$V2lQ8&9*A[a"Uk&1!SpfMRH8p
-0ZL5Xk%8(Q3Rca(I1Ep[PjZ1`RmCN#ZYkEVJ2QMITj%!iIdda[1qYX44NR,r,GDK
-SGB`jL$C[)C[@VbLU5kH2B)%b*Rli)kYplCT`"2fR5URJ0(Lj50qqJ#A`[!$VpS(
-8$R*8(P)&Aa6'm1ND%1lb+NS6MAI`Bp!)beCc#b@$3h)ai`2!NQrr0JJ684$,)E%
--X1YhRHj+U"feJ3(R!IV9,fRf1,rFA0BkKFmGSI,ABfVX'a3G0aa#`k@iVV%FpVe
-X5EE"X%R%5m[j61GBD!6r8b9BQM%qrP#eBNiH-SErJbT"hXqHF*E["@G2qb)qNpU
-ij-,Z`GRdc*aShr*q6q)$iN6GTHR0hdmp0BJdp6e&[N"6!XFMk!2RHf(lXBL3!,I
-S4PHIJ"RR,,M9KTrCl+h3)+-N'N+K2Jc$'5F9"*S*3#PKC)pPCMRF9D2q#2cj*EM
-YpKdD*mXheBh"+%D2kNq5@@JRJ"E+UT!!jq@H3b@IUZ6A'8Pqe)TB`G$r#1Y[+(V
-I"'#Hc[#de&[@8jf#Jiim[kUJ@[06MG'$Y*kqpm`l+GqkKV!9-6C9bjmTK-Dl8G9
-Xf"'cJhBUIY4QhSS+c2-bP[Nd'KQF*'4DpBbVP+'4DL%arZ`lVr&+V"&b+62-eXG
-F-Z5"RdD5(+cEc"1*!63,-0#P"(@XjYS3[!PU(a4%BF,qYqq0e-jqVjYlBG$1$S*
-9IeE,i(3qf#$CRiH@+B66aFpXG0QT81,'JpNdrl5KBi)lM3#BLR`!k0I*KK*jF*B
-&dZFZFpcCJUVS)jJ8KkRQKH8Qc"YIqk`I0J2dU%dkYNk'VZ!%"V[D5YRjI,BM)MT
-ce@mE$*)D,TS6bJFGLpafbI(dQT'&jPq!B1"eS5#3!+CDS*'J*E04P-f'VGr2-$V
-$`("b4QJaE@JLhk`kHJDq*iGX0GN*rK!&YB'@"Q(4ASH$C"'p$bGLRl2'fEf*2Kf
-e*ZNPE3YLdQ'Q-J(bN4@rYV,hFPEajp#qXZ*YM)*hAmZLN602VZ,cT%&9B9+fc$p
-VpL8XA@5JrSDrJAZ#fQi4hGq`+-iUlMcr%4M&EiU,j-AE)F%CQ2EL@rcr%"H$jYe
-"'+QCq["'hfk2+31*fqNRhr,!TXjcphc)fI`qb"LaZmm(Y$f(r"4,5F2AI8LQAZm
-d3[p,p!$qLXH'dqK9BYNmA#`K26)`Ge,6!A+l(!K,jSk`6rp"qadJ6J`+1-bp)jk
-Df%MF'l"`[Tm-em+"J3%6XS2`+Z(U5TADb'Ef-9L'ZfJ(40'5Kp'a%P*89P2$J&4
-eY[JL'F!l1fKkK2S2r+f,G8cPc'Rer&K[$-T6Y#PYjp2H@M)'mSCLR9LdhYZmUXM
-bS8qJDYALE@m%G`IFeHcY@mD3!"CR'!!!KQ&1#NTR5-Lm+eaH5)@PT3RGrq8S$HV
-kUJKpeM$Pm`%B(+%Ec*+'hC69KadJRF)I@CJY3FALBpP%KQRBeSCmPTpV#bLf6VK
-!M&X8"d5e1"9+Y5q3!2VZ$Acj9j4Y*)QA4Y)A4!1ijbZSaB)ZeX(d25r"JVqm6kB
-"5dLr&IefYQhJlXUa3f61b-S9F@6R6d(&mX@HkRiI6RbYbPj4HPUqB0&-6bL&dAb
-hXf-+dS(e&U9*bk-8r2C*Rc4mckKqK+#0P*+9`81hUI4`pG[-GHkVhd#9#2"+-eT
-S#cH[U&[FHIFFGbrYScDG9'FF)`rldV3D4bBRP,AibUXBVXcmTS,V,a*kD#-D04P
-I8!l(rMRaNb303&0LH-CqX5+%JNjd`piA+c3[b--AA9"BGFBpHpGK3qdGrHQ@l*!
-$D+U2L$m0)&CV"N1Y5qP8fHXbi#IE5I(+-G*FkNF&1149m*cd#cTlP20Hb,G))I(
-j%hiT%SV`JbHFTFqd*8Br[M8A)l-rHI6RY-Ahiadc09q3!,EZp5+`HVKQd2r3(Nj
-mr*f+RkK%4dRh)QXYfZriXkN,)B&0mJM82Eb-jIjV4[QEPM1")Gc&3@D0i5#&SEi
-r#)-HLpmbLBqI[Jk'$$&md4(SqiEb+9BJHpFD0@0jr@CkX@5LMD2-NF("`jKCS0m
-F45DSrjD-BLYq38QMiX+ZL(Y9RT!!id&%)'AlS),CX0Mrr!kPSRLA!&Er*R(""S3
-9XM0V*1Tr-&h%*6G&51@TG-9kP592,c[MPE8UpXjJJ*h-B$K#Mm$S2d,q+IJ#T2V
-2&%J9TEH8Bc3qK9&ZHH#'1lCB2Lkf6SG*&eUbXqF$SIaPa@#Ib#HPMY)6QXF`[0F
-[El5k&'$FdNQ($+D$CT+rFqH`[,)!R1Y$@#*Q0I6dMUlJ5-%NC!*(M#UE'MF5G6+
-$4l29aG-dr,EZfNUCK8HdB"*!bYpP+*eQ3qjeUrmfD+,#c!JEYph)U`,V)$H+$I6
-$TbZSp!i9V''&ZL%HKT8L"a['lfUSN!18V0(1&l965!kk"mHm+9KE%!TfAV##$,9
-G9[Cl4i#DU$Q0l*P+hl@L)jAheQ"Bem,B3XGZQAGA6'"U!@1%hEeZVLc)C4L"cDa
-11@e$(B#5bjS[lrd`-fc,I24ch3*U9re(SD'q'lCSG$Aej'Ge3b''aADjr#N0lf+
-E2XD#Z@c$9rm)0Vi)P&-#rPKq3S(12P0Tq$8`$IhL6fAI[LXKi55ijb12Llqf0BX
-Fj`Kj#c8dUE5f0R$hSjfbSPUi@6*L6NXh!-0Emj6-ZfD"UAd([!f(`TZeHM`P)JI
-e*%X"N!"9U*,6*j3GHA'h'"i-f9i(UCdrV(!SE0#5""Gmma2@ILhNb'bDrBq&6L8
-[EK-Hd'K4mTDlYeh#C2h()XXf60R-)FahVVe--XfBKB`h)dbVGfd9kQqBHqPMjSQ
-6KS1@XhFiA*E)-kLPEI+)-FeAq)P$,"L`BP'XhAf3!2bKe-QC$4"8)1C24R$5KDj
-0"Jl"bPGH!6$[4[AYRdbA@d0-q+A55d#J+l!@qT!!,"'Um'I%m92h6Jb%Gfk2d()
-b(1c9eY#($K'@Y*(4p-C3&H#Z"*,*lLi8*J)Cf(DmP*iBS@@"#SAT*S[qY4F3rqU
-$!miA2Xa*A%hYbE(U!0MZ`00`h8%GM%V5bFcSPEX"4X"bf,i1[YPkN!$`Cq"fSfH
-"MV"(Eqq0jYm$ApV!A(kQ6S#U5GV,NL%ff4dG-Y)*F-"Z!@iHKbXJ1d8R8k&0ZBA
-6jB*5`CqFS(DCSIRVZ"MbM$RSeZ*Xf9NdKbAMHGD'leqe2iCKSl`)cf&dTj1XAU1
-C`[KB,Fqfk,J"jf!G&[IM-K'*G!**9UCSm@PcpMI,Z"$"C)*hd3+lQVYE3X`ZE+M
-D9m8TH)'MpkJEbDX[CaK3$-EJlDQ*BU1862l0eQV"h#a2QfT#,lHC%4230MV'[!'
-4Z%'NHUc4eBr&F,`+$+Kq[MhESCJ+ilm$2Ui8aI!"Fk6c`)JTDb2V84*8b!lNJ%h
-9@(KRcp5cFU2kapcB&K2jXqik)P![I4`TiUm@UVCFm`(XP8C5l+Y&d"R4Hd%5j6m
-p`p+8)J&a%lpJ2q9,fk(LfeGMSqKk[A5`0UJ6eDNm%%"UV@0Th8,Xc0qB1N2TANE
-)'R`P%ar0V'SZelAe'YlKf4YpYUkHS!rei0eaPSAI*$kb#(c4iLA`U,Y%lH-@SF9
-@-2Q-BhLl%A"PijRjrhNZDP%``CNCjA"1rIB(rfDk3[QCDlEAa`#m'K!3Caf&iL$
-"*DCX%3@-kPr,ZH34,qUK6(FY#f''FaKA+2`+6d(E"F@TH(6HUAfq*@Rai)U5[0L
-@C1r5ZAbLIT%8EJf+hVm@(!6%`@hJ90'e,X56S%RCbD3#dbcicV2bD-l!0ij5BAp
-8hGee"Iq[V--'#!D91CVIR#&`@eNLFFTKA(`KZ4kQh&pCVkbpRP@#$j0CTa934E$
-Y3r+l`9&)GlS*,U!N&L'!9QQ05Qc(,DjHA%(LhkVrM1NR#XKH0#fGIF4akq%ipSG
-V(r-qM%qii#4PFI`G4m#YmRAkP05j(S2N`NApm[A5JVMGI8SX*DBKZYDk$qk(&9-
-rBeC-j0fXiPm'-"B%'$q"P8dGiLMRVDJjEPXS*qT4qA@+c#Q4e0UABR##AqBDAS-
-)%acQia!mMd2EZ*8dI`DdJ'Nd-61FAdH*!A4Hc"5-@8KV2,Z&q+3bmm8*lXi`K,1
-&X+kTqrK#&XJAY(X1ETQJj@33R8,'mK$U)S4e(R#Z8QV81r1LLmD`I3KQ)SGrC@d
-dR#+D"eR9GJL,a%6Cq4d&D1#rkRZGZ"ZRi2`clFX6F[#!%SP5C`Kb'j'Lh#%`59,
-Hr9lRJ13*IRZ)H%lYje6Ab&XJC)[1$A-ENraX$mV&*CBMLMbTmL"P4Vc@3cHK26T
-iCYebJQN(0398e*&Y"VT'#q+XAMPE3`K#abC``*+[0(9A1HFhQr,b)[1Xj-TbZh5
-J$,mbP[VcAljmGB3'&Z-pJ)m'RKPY$"Afj4&Z2(NHU2P[Z&NM(dA$!kC622H3!)Z
-rmi6'Z64E-LTVmaS`Rk,YQmP#0d1YMBYLXmCp`B19@rG3$NhGf41#E!+e@[6+mi[
-PI2b#S111VDdJB$T9ZQ*TDI&h`I`XN!$"3Ia53LmqNfId3`5eSFm0%F-`%B&BQd'
-Tc@IN%MkKIGb4+Kl#NT1qi-ZkCE0-c6C,MX+$fC&VVN(-%I[*9N&+*EGRX[&iBcl
-`*6VVp0DiZGA++rRhikUBpL#YY,rc9eREk8YR#cf,QT3KG4G+C4$aLKPRVUIi--J
-&98pfrhDRp5hPB@jNkj2YE8IGU,3JXdJA[aNE@D@ik+%cj&lL%qPN#&X)2UFYThG
-Fci*Rl!MAAa$'$EPM'%*qAdGM@q&AN!#`F&pbXiT!di9SZ2UhjBJP5GNM#EPL@AT
-P&h%"&d31iZ(HmC+VP&&VEm1l5q[c+Aj3l(6PJ8jM16U$G"'6Q9TPcRP6c6jHa,(
-r+V')cLh(AZcNAJD1P&2h&%-85Yh,@2MCSLA3J5mY*J[T1-jIc#U988KG8eAch5G
-0Id#2Y0`i*S@a6Y!SJSUUT,"'VfSE,A5(i@[!JGP6%9K25!N'l$a58kr%$NlAFFE
-9EGi!m6X9hT)lL(!,,3LTZR2+FImam3kd"h5&4h@2R,lcfJZ,GGaXQb$8L`QbQEM
-eRFM1M[h-&L'T0X98EZ2-p6DCS$p2kd)mjQi@m$)N)m0[XRiK,&1%"L#mqlNSTp#
-UQT6#(GXaR'FYib[S-X&NY*f(lFA*2DI3r@f6fS@iSNaaL)hpp-M$h3h+804QMaI
-6@UK%%BF#*&QQMl#V`H1j[fA6aL%T(,SCkR%RQLD(kUVQ"U$L*4Lm1ERRr#VpUh[
-8VBAh)+T8VeKqemIL@rD+VKbIDQaGijCr'rPicCYTR[P#C0VXb-LPKUe%-DB3[A9
-MC[S1-CUX+"Q[L2m[IqZ0e2i&ZEYdCBl1h@C[f*qe4I%fRG#S%8`[DIh6CF!aG`R
-Z8D)d%)QpE,@G*"834aTHhFH&0[N@@%FeCNlaNUA+,ERfh'@(a9[SeNB*%%'bI&0
-,"IZMb0""BF5%5KVre,C#G4dLdH&2mTQfm(((d)KUBEK,r'0p+8YE@&DMl-1j6#,
-HH(,iP`*hEe&DVV@#jpKqpJS[6i`Y#)'6[0C+0UXT9%%5TS[4Y#h+,K1GF@m4qhk
-+!EYqa3#[ZQFKqakF!ml*6m0@Ge[XMR%i0&6U85T&dlVlG5V(3r@0T@ZU1"pd$#f
-`ak'ERE86(@IQV&DQb6Y%FV6mD@`kZ4Y!a2"cD&PHY)!`"pD@d5"AA`'DmFZ9%D(
-V19C[p4R6JjRGEQJA,j!!VRkhKQ4-ADHiAFSEqAK2V4r)I,'A"9cDRcqVMl3T$Ak
-LTA"5SdZX+ITL5['9#JjQi$($6K(Cpm@)EQh'j9I#h(#f*HKNAXIA0Dfq"Gi`I&1
-3!('U`TmVq+raUpc,+,,1"SDICkKfCL0R&6Sii6EV("MLbe@#Sq5fMkRFB*Q$PBm
-K0&p`3D9E`3A3f$Ckl"j1386Zqe03AIMST$D'5%Q5@ZMcUYb19pTi'6IQKf,hb1a
-3RQ9rk(de3ZSL84C5+6@kU3mfJfTdk,NJP-cef64QLqIGNCd'BYl54h%T'c5F-3L
-PEHGe4dHl8'NV#8P%Nf`AN!!T',3YAKEq9h*bRHYTl%aYC(E)-DK2)V'-J-`a9[(
-`bi4Mk'RDL+B1"'b0iUQ#KSpae[ARIDI@e9pQSJ5$aVcjCS#S%@bS'@EJd9dUSG8
-+hMEQ+Gm$#5VUYIm4X0b9f-3XNJNmq%(#0B9-,0UT$L,eVpbIVFhGcZYHmb%8@l4
-Y))BfR"p-HG&f&*!!IH)8FmU`bD*56C5I4mEEX$h'dZ@LLPbZR!abjrIeSJ0-2d%
-N@8-jd-E3#($"HLRPScfcMX-FT%#hVK5kD813!(14eB4lpY@b5Vc%rJNX'2"6$,V
-*IS`)@cBmAD$90$[#4NqVh9`IR'$1,YqlfJ'5PD1#*C3EQ[,*CcbYb0-c-35rdbf
-Eflj5ZR%H3bGL0m+pPpMZ(Zmi4+5YXZcUKDMGqTA*b"-64A890rGeq[ARNdU0KiR
-2TZhJ9G)!CR5a`jM8CiSaKf'Ldm"Qb1*k4AFC+,8kIDAJDXC1$d@&F2P*+kmG5`H
-fM"'jhf+$eB@G1T9+QdEFK82MEl)JL@rLNj3c"AEj(Tf)EQqqA#mhZjSpGJ84lUM
--+cQm1+QYi-f3!$56+RaEHYiUcjKj50JNr$E$8k&q)R-H*PSN,4kB@)&2e063(D0
-`DXcc8#BP&T!!PUi!@,%DT!R`(j@%0m8cj5Zi3c*llFr[!EP'5[cD`QRPdKa-'H)
-`'6C1pe,haqMjZ0IMV-f4NeaKkp68e668H+h2+QCRFm6"BUY643#j(CHkmUBe,H6
-pV21J3Bhd&0FQEkE-1imqEY`,34"R*ChBp'LKhhJp+6Em9PZ&R3K*FLQieIB3FjL
-@GA)ALEhB8U2bRXbbM,bNIU4@Q-(aR&X!(1+,kCREfClCP!HFDSAapG4i@11a'm*
-#BeS@PDK#2P#3!"pHHAZPj[*Xp3K%MaV*J+&Mhr#RSP`8UF6kEYM%K#IqfPi4('p
--h)-qd,3ch'RTe[U4SZE%Qp[Zj#&Uhe(Jb0q[+`,,3U9J%H"[iai3C,`b#4bKZ(T
-Je*9#ApH"eXfr!+Qf568U2(%2&EJiAc*-lkE*Kk9LLK`-02Za0eSTk)a0iJISVRC
-5hUaH6DafGC9fBbN!r*31b1@@9e'ARiVr8K3)pIVVI4(IURc$6+TAaGL1"U95Hji
-[q'e@[VL0FPQAMfaV2kXFUrB8Xeq1lkj+NM5L)ck1q5BfCbfpl"JV1kVK%pPFLIr
-8@@aLi-SXNDNITRF+eHj4#mm@1Fp#+2#%Lcp(MRM4AJ`i$lakKmcPelb[h696%jk
-%pp@R*J4pbl`'ILdb24f(E980,$-AKhfGf@ikqS1l-e&9`bE0L0HYDV0,fHDF1+M
-6Njh5piKk['MD0JQ2RML2"pqI[NMclqfhM6XaV-S[TR`'ijF9Vi,dZK&iR(@ZRA*
-(cf&,i,!*Z*!!SKj)V"Qimhh8)kBNmCP[VQZBKk!i(!2(i[cGdRir,b[J3pVHfAF
-l9afj0$ar(3-Eq+8*KS)&kMX$4X-d@EPldD6"'41kQXY&'pNT&d'(eGRlZ*Q"h-!
-'9EXc4qi((PZ`(lpFE)L+5j2B2a&1`YqGAF4iNBK&@m&3"1)838)cPeSQF,VQH1E
-JY0r99QPafaF3-,#TdkAY&mHN`YHK'#P)%S@aMUqeerf#%D!Yck,h33Qea4f8@FA
-bDM6M#+#1hB&kGUMk59c,33F(@(-QN8S2R2EeL*J`#49"MQiY0jdkq0CmjkVUD4D
-VU9,Q3)0Ee')0PUK1,rFmJB(P4*BVCFYPQiL#UP@Y$5V9d*jfS"cCA6SL)T%d43)
-#Z5GB([BQeFYfrQb&eGSU0kZ#GP(C*jUf+5NV2h3EQ6+M3N@+Cb0&3RhD#hF,4e+
-1h-ERJA"U6A22(qR[hAZD@f&j@PRhcJemDpMHjdH"4RZ"ArY6FI9%3eQ0,c,Dq"9
-V!T[ar6)J8TLYc3(S3N+i1S(hb4J"di"K[idYYY-lbB13!(A9192,cVp5dhBKbFV
-)rP"%5R)"QmB$jVNH*,d0"+4MMQBbk)9MGr65H"V"2PfLm98FD'(#8SB8fRYVfPp
-&TqHN!9+QCLfVpV(8QT@5Xbk@%%&@cZ2b@,815#Q-`!lT6c13!,YQ0pMpf%Y&Ti!
-H2R()%AGFfp#QkF-m+6`8m1![NjBXaN10VTIdIc,&jGL$0mVFrjPRf+jT5af@cJX
--Hp+@[TTc#-aRVBjVM3IkB!4)3Y6&a@4dKqb!U09k4jdM#KeXZl98")G*BAa#)FD
-d$EJIlI3(YZadY6$mZ(mM#!k+A2f%$Vaa$F'3!%PJ)Q0@Y"!mA![a0F)'imAU&Bp
-"UmliLR(AS"S#Jf#J+-rID-VUJM!AN9@DlYM&SSIT"X+ZhYjSl$b*LjSAi*PqPaV
-m1)$RPN6h23h[953-@YBB&fINpX"%L[%D6M)29ZV8Ab5P2XGZCTN!'$Aq1-%HfP3
-R*qafH')p2+r!$C6r0"(0'"5L5`XH&BJ3`pY(m*SBJAV$XfI4[)eM$$6[C#Xe2T3
-rZU#e9A%&RmS2i*,56rG%")G6,mBC[NdUbaJccN*bLa*ZTFQjDffLF)d5eI["b-&
-e4dc)l@SQlI@aaDa"m[EeT'IXpBH@)GZmmJr*-%BVc$X8pXiIXBJL(Gp$LmNm`VZ
-)TGr#hPAe5[&8lh#kj5CMGXrq61"JLdM9cpAk8Af9`Ed&*f5UcT4[p(fXT%rrmZh
-KYF$*iZ+d)ENJ,M&lX9L,(cSf26SJ6ddqH)(N@Dpf#BSqAUpV%E&6TDMf"RV`43Y
-S(45B41X9*6)TP"KE)M1')C5(aVAMTJkhLl'e+f2(Dcb!ic5"Yl8DHE3*XPl"m@)
-4cB$Hh[%4YcFH3c,aeh5Q@,F&iIp3bL,"fq&IN6)HAf1[hGC9B+48AH#FBB3!%j6
-(MPcF[DXHfE-Rjir86e$l*f@&TfN%HP`J&ei(Jpp6aA*p2NVRZBD8Y5LZBa4QNH[
-SD@&U*5p,Y[r&RCi8TKI(-T9FSk#L%@T6'%8Ji,&3PjFmLqe%$$$DMj+"YA%pm@9
-,qB9k#S[j#"UiBPD$([m+YZJT4r#4!E120eSf%USKV`er8NX8Vb#%KSjR6'b8&RS
-l)*'`4L5S#IBMD-F!Sja`lIE1-0"Y9E&AHC+Q&9Q%6B3$1cG%i(Ti5Ue`d@8)J5b
-Uf9CE1dRIbr,@"-%[%0[JDYGrQ9dVIHRa+kBjG1Z2!i@-McS-ThJD+5-KblL#F8d
--iFI#cQBp'VHb1S0NTqjpbCkF)E)q$2bM"e3-"aNqEa%9PT3844q'iRHb-R#K5,M
-MM[GlP`C2$TNbJY&Z*IdMk)ke'3LD(QJcF-pY0-P8-,6Ip`$*6fZ2e61%qPacC9B
-UrMZ6(Z2hHpX(Aa'I0X5EQ4rea-`EarES0#SaM%,8F[jdHAKVM,$&p5YPDK5I0)!
-i"B34KD`fK-b-+A8iU,UVqM&`kqL`Jl-`#&QkV41GU8#(9*!!ZTBISfm[6`E8C-N
-i)$N*D)3dN!$b-EdI'Nad`RCH&1P*M4pk'XadR9S90r+)pITh+6K'4Y6'[FdpPlq
-+-5FPRIQ4Gj5-U-aXPXS-QVr-1D)pE+CAA"ZkES8H`RU$QMGVR-*4@14GjXCI"$L
--"hNkeFd*q9rR3XPDch5PEp4iqX'!Xb9C$ABST8ZErihbi2"@"IAiK)f-l-mTS-U
-A-1'!idD!kplJ84[81rSB)j%&hJar+V1'KT[0bVlq*9MEjKlIAJ1lPlPCcDS#C'i
-P2CD8#G*AT*j+5",ZU`U,h%J`NN-,L9RrTe9@[B@X6(h0'TTq&Q2b4V&-fEL3!#0
-PH))`S2S2B3!#AaN2cba4XkNEmf"-p%A#kjKpl*A&%Db"3a@jbNBdZUSK+dKiJA8
-I$*6-CEq,0d`Qm43fQAYV&6P6[YD(!*-(XmV'i%bG8riL'180M!FRPdEVQLqkMfR
-)5+[Y4iQ004b-2*cK$$!"%0)mV`DcC9qifqiTNB31`%&KQ`r9dpaKIFCaecH8"1[
-46$2RjCA05r9"j(if(-PXj'c#4KkL)&ZeNlHRT'18bDK9$"N6-j9Ljr+U%2I3BAf
-E'902T`L$`FTAI["J6G+lU)D6SE3`UIK0(jfYPamr4"R9Djj'f@hfR*!!+`MDB)!
-!Bcc')QEA4PeCi$9RbA#aG9VQ1qjYQ4jeN@K08r#ee%U8"'J)i))eR@3+hkBDaTF
-Uh5!d,)$XFQ@9Nr`$-ie%Q!hE)dM@riSKNl3'QjqYY+I,l"#ZMJY9XSQfSaJ)Q9P
-T'(#QUP62)ejj@9efGAa%Z,U[#U@DI*iJ9GSpV)(XNEhTfbh%K4h$b348lL!c-YM
-e9X(BbTPGp3*V3Mk$0G)j2P&4aIU"$VSR`d%rJD[bd$e'$5$6+PJD'*F1d3TR`k$
-I',A8P1DCM8VrPCL#+I"@@L@4Rc6S+IIkK#8&MUr0i4%@U["ZFGc6T5N+eqYR!*R
-NG4BA-PYjG[F9QUr0'a`8["+Aq(`(8,`@Hlb8YI%jYC3AqBL2'(-SZ3"&3P#QjkY
-9afe2iVE%XpiaQYqIrjePGUNYG$&c0AS3P*!!-h9JAYmMPj[@`[$4S5'Vm1X&-[J
-XJ(GP0hB3lUMjX)Rc"[bQd*2'dZM#H#Y,1[3!&%F3f*R6NQ&&6YR63hmk[S9QdGr
-fdbMB12'rrH1(iHCr08e@Sbi-%9[e*G[ArF1M6+5iVMm8QK"%C),DbmZDIeN%BR9
-,rmMb@,leJ[&&1Zk9,kld'jQPaeBej)AVR'[ArATJP2')ST8KaMX6-*pR2Ej3P'&
-2C!&KkCm$R*%4!m%MpJSAiUh)2a[YmJUPIqkQPPHRBN+beZ&5QKa%FXUV&Z10[mj
-ZE3-A@`$rEJ'-6dHX8+)mIlkL@Ab)F0K[6fKZMj)UXj3#JU5V@#Ph[c9V@bDEIVN
-*kGXT*6pLH)(12GbJ9-SJ+r2*#MG[!*D-RTC-G8LBCMpm9Y[T1!-(6d1CfVa`p4H
-1!YH`BYD`e4`1YhCc0jTHJVZ[plLPXp1P)*fKqYEfcZ1MM*)([V*`#eEPMSdQ9-"
-Aq4h!QICJdm#Y)p&p6A-MakA8(V85ERl6bSTE8@Yc'2T@rcIqij5l$'f!I0Ferab
-"PJ0"`S,)j&TlGEPeZ+X-!(%a@0bMJ9!C,(1NQE2d[iC)JBmTQ0CbVBd+KmDX1l1
-(XMF'HH!4@HH82@Q8DCIEYdUNZ3JAN!"1KMlQ-kPUi@RY[pAqm9k5Tdf1[[d)A1I
-$R0d5MZ&cPi"Y26@prAaC%ZfQch)UVQr#@8KH$R*lCA!R@GGQG@R%k"PS3$m,NXH
-92d*'bNb'b)BNkHZpTbFVh`D)@h*T(cC,DhVRqPl11E821%QRlU-ABfiVC,F-i9@
-3!'a#P5F#R--m4T[!SRVX-a*LfbpMePm+1IrLX+X,52rp&k!3!hD$r+ejFm26ELi
-1i2aPYfjBZ'U[V3k[2PAhZDqCh$8)de*XqS3AM51ZiVhLJQh8&i'QG5al*Y)'`G@
-22$08jUqVM9'pebR"j129#Q@r4MH[IV8aUkKSF8ecN5Bfl3Xa+'PNa1B3BURlCCG
-""T%l+l&l"3$m`Y)H0qeFC@"JK')13`6MQVpCH04-qmJP6m5UiLfFBFCR)Gfr54@
-`kb#J1MmVMJ6PE!'9eQ*8+hN*,9#)&pGlAaRkN!#'0iYq$lc$Tl1Sh"Xf`M5a0BX
-ma$9,9ZfDBGfFqk!@)FlE"a@UBJ$(Nij'EKmMGHjP)If,0hX0-AG!3UCjMlI%3r+
-)Mj-lji5$LP,reRH3!-N(-CXVje1XD6B2Yj38*MdrG`C!pYTh+r*HBJB8pSMM$TH
-&*CUSSrXV(kfqZ"jPQ9ZN9U(9&T&b4f6N)PLh`lCEZpK*[a(FDHS9J(eElGRhLUS
-UHmHVf5*hrj'6j-@,@2c#jqm1TjUF0(B25BS6fkmFCF(@F!AEIcpll)Q)N!$@CR$
-SF+fFZG1C"hSNi[,$,8c1c@Q'Z(iQfIp*lS&+,`I&`506$5a+[SHDP#kK4N*E2)6
-1Z!1HBpf$kLXGeSP@1Y[#p1R8H@*q$Q5)`f%%GqrarqA$S!p52`e-`1bNl!UHkpa
-lSUF%rq[HpeJ!Yd+cLKSkVR-Tajea%S5(I%FpYe#jQKQKRIe$)E9H1kqFMSUZ9!b
-!cBC2UmKa,`*[bj!!VdPNUNNmj#)&eIJXc4-K#d'6mFQfML,k%"b'$EZRH`MHrA,
-S94'R40m(mkkj0H&Vb6UP9h&eb'GM3!*DJeB1fambb4eHrUbMper+UqV4!Umc%30
-kjV#YTAUIl+rfC'096--N&U(G8SbYXhJll5jMYJ,Zl@VSPhDBIM94+GcGKGZpKpC
-b+(N6-l6p$dSQm*L`BPrBaD"XHaE%QUL[1B"1SXXf4Z4iIc$34A*N'Td0A,h9D3f
-6*5jM$,*Ba*Q)Nm3,(abY-pk6+"a6-1"0a&5IQrPll`XrR&iql(#P[f*P'AEYlb'
-0H3cfD@Y`4TYbBlNr4CSRf&M2L'K9*XEa(8"HdPLD5l$`kFT[QS[4BGKlh"D%fZL
-HHQ(MZRfVBVY-R*r!k(Mk`q%4eIi,hlGRh*QmUM6hQ%qQ2Kj"*f1-K'Y!qL@6mBA
-0@[hT'$m!NK5*GdEaEFLQm[%ZJT8IDqY#qd43L)-U%JXMN!#-0"JVrq'l%p5JeE+
-pN!#JTa5'eN-"GQf'!fj'+GkG#9r@Zb*&2F`bF!UUP`BTJXm,kl,H!eeY!%X!fGk
-#4KF$TR@S%C*E@#rBZY'+XICKV8M[3ES8eY`3@bhi2D#1pleLlIl2HCjM)04#cKK
-bIQ(S`%i#TJ%86Ga$ej1T`&bkkk1j+!Gd3(LqbZXcV#QLY&Kd5dRQP8[T34#XGQR
-#Kl8(Pj-S4-I`&`fY!%I@rmhFBlcRp-)59V'pRY[5VEQ6U-h%IV[IK$N9(Z#dUMj
-EMJl'm55)'1YJFVHI5'T`Bb2CG"F9@N%dD`[B@",,[DD#b%qhmr3Hq#kL+d3rUJ2
-LI!#1al'fTQi[+"Mi-jC&00I`K*R$CmNVZ,CHX8A#-fT0qL&2h2)+E#@SlQY)b%q
-XlKPYdMGbbV--XX8CZm$E4lj#)32ic3Ej@)mPN[)&d`Se)9VrM5&XSk[BqM88[,j
-XbVY+!jlJ+GK9'fZEBh%VKaMbfZQdUE3[JF,YpJmbF2eI-Y5FKEl"9L64YARNLaL
-qHMfFGJfFpR$VUP3KajJE8SP[$5-#qNm#T8a-GXDkbN)8hFFd(dk@C"`q)J6URS*
-2bQ"!N!!0@@i0,hMVDk1qX0!"IRGJ#@Z!qh&)f$lkJarIKDi3r$`ISc[Q9fQFD"V
-'e816lF$2$5RX*ULe18m9CV1fHLYFL8qI+a62'V`9I@`@!p+*qkHD+MH@`p)f8p[
-dE%KC`!G1`hSU`klE21$VSK5Jdch4%IL1dX*#VTiq@b9HiHV`0D6UVjdNYB9a(U%
-HjXY$QZf`KkG!9(`DhXrJ0XriP[hB'U"imGMHdlN%aAG%&$rq((*plP-qhc1rMM$
-a*'JJdAJ+NE8#-lU&*P[d&,e%2@kNmPDh1JaqS0mI+1bN68i,CT1"8FlGLjI14cV
-3F&#c),4c9lrRU68LY(0K9XlB"q0Db$4KcSF3-HmaZ(AUU@U+ar3)8a%jfB4fB'f
-ai("jNpB80LH[UPF6laE[MmBrqIrcV[m"cQ%DJYr5S2&aQQ1NS-IP`DXUU50hUbT
-Gq"@)&D&UkTQKhpR1bX`SifQLhb)&K+le1(S#!Nl"e%pK0[[[eV63BEAbU8$X5iM
-H+rS4#!l0@$"PrZ*,4BEB3h$Y5j8I+,cGjY6h(d%m'IYZ,#hGMdHGhqrPejF2[%6
-'q!BXrpV#@Re'KKQ%[kKN"KCI6mRS5J[TraB[f@&ca-cZ@e8IPhCMN6A1!P)[PL2
-aIr"dqS",P#LMkH"d0@d@MRm[YL'a%fJX+`kYk4cmXTM@QrEHlV!Qf-FHlC&bZPX
-+a&h1-$pSf!H0&D3AI`fE`KplUY`Th+A%ec'r),"fc[KrTe,4A%jQY&*I8'4ppCq
-"l9)$qaNCG,(FHbGPEE0*i%0rSZM5Xh+S([bYAQ!IRGqk#@&Jm0N6@*1hd,-fb#C
-J&NDDS30pcpN4S9lH!YH&CA'$3SEV+J9KD$6'q&[-!$d`J+VZaNA`G*0Gh6rp-Vl
-1da+RQi8NL&9-Tb!U#pmDH3Q$'b!ZAT0U%6A0!8r2@&d8Xa4FP0lEUED8Cd(-8[I
-9EFFp5)PGD6qb&+H@q#'lUTel+1!LZ8r4XKNLV"IkHG!,Aiia'2Cb'QS81kG@YT5
-c!TE4UARiA513!%54Y!Zp2FJU"Y5U($ZAT*Y3%36,f$Q&i#V&-XRf8p0d6Tl'd5h
-E-UY)fk1A3&1DblABiVS3)I!XjV*c0mH,(PC2C43F&kAT[4LhNXYp64'JS(Z4d!R
-H"h@4MihmIeU@6mUDre,AZ*5r6&qX4Z6B!cZjB"RE&lU5$&JES@[Z%,A*l6qjUXj
-0m$rLj$MdlJ@Q'YM)B*!!TU"ffi-aKAYP4+pa5Ai8YLVL8D)4)%lDQ%pPU9qiPdj
-"V1SC'*)%P-q`-c!5$b0q2FVVqGV)B"$*+'5YRM@RJ*Eaj1"qmSMZVGLJHeAL&`p
-(XAl&d+GqbUr'rZkR(j!!(AZ6F-C$9'Gcc&0c,ZUmAGbR5BB-*5@)CU9'8,Nf#10
-BVjeY%(a1"-h-)Aehq2BbSPDXhq*lhjUMMf4*"PQM$h(aPT!!rb5LdrY+3q(`ppa
-@c(XZ&&Hak(Y&f[P@@MA"*C'2@QK%h$JDq#+M5)H[VPH0j&5UJd#3!+U9IQA%'NQ
-A,+)Q4#`&q%L!R'C@Zq4efb[c%d6[#VIf*j!!Aa6iJfPd&1-G5YmkIVqP%`[fhY9
-Z*bP+AQ"j-(6@&!Y#eIb16G$PieEacKKlNa&R8KbEbrKBprA1LFLqVl+ACZ-hm(-
-GBc9Rdb!5)qhZ!N'G5$ADbk0[L[r#-%VXIqLJ(0R,jAf2ep0ZFcZF+hGAl0r!2N%
-@NEEef-Yr@-Y%#PllBGAUjC'i[drp[aBVbPJ+TNj#-%!hT@je4@YRB2m8&2!$U+l
-a%dKLhSk)(@bIU5l5k"C$Z(feY"#-X[K3YB#U+p"'hDkP"iBkK'38"8RGl,(r(kN
-"cbT"KjJN4D`a!k&PCR3)X0m4*@X3f#eB!Y-[Xpq3!+Hb3'Q2XV,bjfRdaX$0G*L
-$4P9E*iZAr@jC(8)$[4XekF'T+Kc'a8%``TE3dj!!lK-ND2V&-jF'S##PK-ilqdc
-M)"eXaBklQ#E*RFJKm#@NKk%6j`QlYC!!i-dbDG$-H6ENVkG0SMFH"CmGQ[a*Mjl
-"JqX`,5pGSDl1YFH!["CXMi)0dEc9fG3!NK0hN!#*(0m+f!)5cIP)k'BDF93Cq'L
-hMFb)$B9NSjB[TUGIa)a4#icTTmN*9[K%[d+16R#iEA5@c,9KkX%YM,$2[mG$Eca
-fZlpQ0(0C%NRNYa#F4+E1Z*XCXXaBVNBKBX'blMjrGGQhe5c)Y!A[5MH)%G-T4Q0
-F6RZaGe(TVN@mmcJ#fJarYAG+TpV$dq$%kR"he65&P%$ZNV,*K64jr3Q1&5p25f"
-QebFrVA0eRG8r@"mm'ZEi8,85,96X(B,91Bm4J33Ae[Q%I0+pXXr8Pcqa8qVaPYM
-U(U"pbTJm(@BdT5ESGH5Le"rceJ'03%'acRU4VbY9Jph'3bXP4Hj,,6"flZ&Y2IF
-PYmqZhB5$k&ET1@0F`bN5,Hf1)LRIH(S'`(-L42G+XYlDkZAQUX)f@H05'PLh+-K
-*,A%$YlGac5rjXa5pje1HJiF)#KKB&m2H$(*[rqpNG0iSaV9PSS90!RjN+)JYh&`
-VpTTm5-iRNp-+%UPJPk#0*IK4j3jYhjTJ*+),Qed$m9,L9pc[9X6E!)de1GIS05Q
-VD*&*k8GjLS"+G854PmKmMhI"Mh%cPr8VqRZ1&-G8Ii*TV3XFh4DAf1UV[k8pCf%
-,RcXH*6Ui`'!qX[jEpk#Pe&Aj&(!I9L%[c#5I!,$0am)Qr30eS$5Y++T@"-B%BX[
-0NiNHES&eB+$dK2MiS%-XPKU+K-lRPf)4p)%9c,X`(0+&cAT01+e81EB!j61-UeT
-0haX6CG"`6$c5jMJbcrh#pRL0dSkL$imrF56!Mf1r%IfLZHrd[+&"r##bNT6mCV`
-T"cGj3ZcFMQXVX1U%kVARHpfH"!TfN!"09c'2eD3Y5VY+)G@6##HSGKc&M9b-+MS
-#a3#TL9$k$QU@DBeT(+mbLV9IHBmI1F$rcH"ak#2fa0FU%ef9!mqCTRGlY0,MENf
-EPq)&I%(8(,2qXrrMF@Mfd[@('4f@6pCJ,j!!ATPX(dmXZ@UcCbCR8RS1c!KT)aa
-LR8mGb%TT5&*(V8*lNff'YUQpG$##[DlTL'eUGC8L5E(35jq[,0@KEacma%-LXRC
-N!M$#i+Z@*0i#D")RP"58a8q8f(*acXVUYV[+H&k1$F2X+60M"9*MrS+E,f8E6B8
-lXYM4F2SJq"T6pS@$c&Y*Q4Zd(5PINN'*UiY#6A[$,6BMkhefLZpfP(e2T@66GXY
-b`3D%GhqT)i&ZTkf5PZkk'+d9@Qh3A3`CQbjITGX(T`r',4XLTAV!Q%rRL@8*fp`
-%F+-!I5pQrT+$(hHT")IAE2rFS`Rk&KTIU')E9*Yj4`j0,RXKDh2iIq**RD6+2A*
-j8c',ae!IIZ+$X9X36S1CSCa0&'-8&MK0kRrRN!#`hAPT4G19Y"XJ6Vf!p!Tea1d
-lP@h'ce2$R!rKhJirU8-l$*jm0FL,jLa24UCPbJQ"SkE$qaE2B"kaX-SF)6p(1TI
-L$2GXBF[V@+$8#lfB(HTHC[R(P5KqTl+dT`5Eaj&K*PCQ2ac(m#PS4G(F6#)T5GE
-d,dN6b-ICDGV%"[V@a'UTCi6#bc39S"`&TLq4Ecr@VYE-CZ2jDfLL5+L%83QqR@T
--r,hHF"$68he1L8'4ESEHpX3p9I0ZpV+*FqGmEML03q$I1@kY!G98A)RdM+4SJmM
-%U&[C`0)Mp"qFi@*%`rhic#5)"N$#i*Z"[-SY$623MiH$"PkDm+%@4BNml1$3FqB
-HVrlBca,HrJ!6a2QbS522e&#MP*mFhM`e%5K`&N5JZ`fh"Xjj&PQqQ&NdKEIi!+%
-(#TBT%ZpY6p3qp699M6@+ZY*9)kJ!rCiXr0)+P"lCAG[ia5'K@kKVA&mc#iXJk&H
-HR201f5c'jC(4%$33'BH'9b56%p2QFr$HkM6h%8`+3'a`[9GD2M3#Y`GQ%MbU",$
-a"5G'X*@eGZPrX`J#e[Pi#aZ@e3qNkYd8BNiq$4Ace[d8ea#aL5qllXI0&XB'kkb
-Sa-R"f#)PNr6QI6*8l"jZUZ&kqeZ%I8CFm5Q+5f[Rr2d([++NZ@iNU#C1-ikq*-@
-0d-U(2ce9+8ZXmK#fafED(&b`VT54-eX%1ajjZZ2[[aa5'3C(Y$LJ3YZ&e&[9JS#
-PhPX(JSE9iJ1ICF5pI#X4`3+"fM1BD-Q4i"`MJY#@l[b0#RXZ3kpRbrIrYN(PrM8
-MLpmhke20T,$$3BVZrZad!e-AIFh[*![KUYU6EmdRqm&JJ(N2ZB4-"aSb[L)KE1!
-b!h$FDhU0R`2lf35rkb3LAaeaYFT*ba[*IfT4QBN8mJ`*-M3d"[1'!%AJh&eQVA4
-%%NSrrd8I#*!!CIi&k2M*A4U1A$cYZ622"rIDHYY1T&6jYchA1&b0+G@1G0%`5S#
-*ZD'UJ14G-$`Z[ekNC,a9dJKfNAeai)aklk49TJXH-&TDe!Z03rbCmql0D1rd1GM
-dSm&SF+rd3hMFUlVbji!'VKX4p%)FeEe&X4PblQ,9f,fhMa,+KYf*HK%3#4*,@q1
-)MVI5,`k!Ff!#Q)mCG0Gh,TI)HhaHX-LETZ,3%[Y$"lb2$E046))j-P&f#XeHd[*
-hA3S&5@LI6ACp'kSa3c`iTqJ,4h*2,`$J0@$3%)'6[mDQT(EkEYaN0[fZBU)C&20
-i#-d)Aj9IrPa&"JT&M46Dha&5TM69R*hcA-Q&D2MSbMq(X!TJ93lBN!!KNDNEBb-
-)&DR,A'-06I`ZriNb+2E+9[b9KFc6A,iYq)Jf9r4VZ%E"#-l"lqRjU%Kl%aA4f6J
-m6)hLeBV,US)12q'Y5VXm%08NEfSmfk@JlETd35-!rR*Q&GHEJRE,[X4Z%B'jf08
-IrBEG&qPlLXaX[(3VY+0@dqFSZ!!m'Y-JCS9R()!b[NSc`pZ4Jp1,B#e%jXfA!Ea
-YV'T!2eKHc0L8-j%+m!M0"%ea&Ajf0C0U*S4C[TL%L[P+TchlLm()mK(kZja4YG1
-1p#TC4BLX023ceKU!"KKjb,8EUA0k@4!6A1PA)VVlAbC!S4XXP0!CFaMDFbdAJi$
-3,#)1CZHjU0#F(4365@*VG3`4MT8*XUr0A@2Y3+VJZiD2'PVIRmcDadq-"chc#VM
-N6*'4&U9h2AT8A6"#%-"(9Z@raDk%UIDE+%'FC5PGrDRH5XQHY5i`#!ZMq+Z#@pK
-Z(dpV@#G!*4e'62UimDhKh4Y091Y`$6KY[V(m(YmT1`aLrbYbZ9Frd`B-a)kED*G
-L)r-K[5!XYk4'LT!!Ma,V%!Tm,iQPHTXS*6R&YNY5PZclbMMf+$&VN3'*N!!&QbG
-qS"Mi6rIDK*!!(+"e-6&mqjbRI3A(2i2SR&@EU!QZ$`)PQ4jKMGAe#,hTIAm+Y"N
-qX8XTHaP,S&b$cBdkY81(pqC+P8+YP43$'Xp%kfm(mpfNAa[-VX8!S#NaU`fNM3G
-D)$9*1K&p4F$P[UH'CmYp2&L$QaD&)p5))P9$43I[h$FR5fRVZeAe5jUVCRFlbc1
-UZ)$Ur*qQKdipZ9DDcUB%cPfIJbPP`b)lXP8HGC5%d4dMG*dUpN@@bMPAjIEp$df
-XLVNDTD1+a&QC)fpYE)ba8'6IFGL,@2,&T5+5ppi)6!UV-##ZUbkJ&L,#rRS55E!
-8a`*kCD5E,`M,`6A!PkYXKi[RRf@i[[a-34%i2I!`B5jcqUC!V!fiZMM0Y#k0mCb
-M9R[f8&#EYHPS(f$iehFl-6`dipHR3EYjjlL+GkHll%(bi+80&#c8V`cbP)5#i32
-rU-6p"0SY(1j6MP`D@@JbXM,0%2f`li1Qi5iDjKrr5%MpQLF!'ZZ`P-MUmU&k+H2
-MheZI[3&$9m%9kf3A"If9rbpklFNbG$ak4-RT+E&`G"8PS(RXRNVEp*!!MQM[`+S
-*P8V4kcSUel6edp"%l@3iKLi2M5B0C+JfLLj$ZPDl5"EQ+4@er-iIc2$l6(Th2hH
-l-qr3f5G@TXjHRfiVrZ3f)p&5TqDPKq5[V4@`&99m(0CDPQ#)4M%fD$,A(('b-R&
-hB$8-'YU4M[9BrcfH43G)CVCB@F$ECP2d6SKU#K&mPF`83'P$S[r(1-UX03H$@'A
-)c'$kCTJjFYiBYfIq&r0LhA0H)B8bpRfHZGJ5)hla(Bh6Y4!h0e-&-!qVA3EUVE"
-iaES!GjK)pr%Q4,@)X,IlJ+U1%dc`,bcqJDS+SJ'F4M&@'X%ZXRS,5RB"d&EU[r'
-3!!G'3!LhZY03d)2QN8293'e40[G('&2M$5C(MZ8RXkE[i5cP)f11VGCL"Ri)GX&
-69+j24A!k(AKNlHMK4i85N!$aafm[2HpYr+Q-8rMcR5T'U$#Q2e#!YFeN1kUb@*m
-Hj6rHU4#XAF*6ZA&%rQACa(@G$T9rUm9+)0[SEZ@em$T,LE3)CTN3(-[p*E"(C(B
-1L"PK)*rDR[P-eI&%P96UD!,akle#fIeZ3*pL4"S(T*EM9)ZKk!3hIi@q!KB!XdM
-&34SfQjm'IbkSiGF21qC`b"*J@cbKXj2Q56362cj$b)SfXEc2Sd'c66mCJ*i%J`F
-T(i"[a+K1UeEQLJLcD2K&Q2Zr*#9G9Zma2eAdGQ8q6MXDf6mZfm6)aF*cqHpL68C
-V&HQh8GPeH%XID%P2YC9cRbjT*86L8bR8fFX@!rKLFQX)ljm0f"BA'bZM1!U2V9j
-SZLK&Q"#NiR,mH9+-lcA!c'D-M(a)fSH(i"(f[GdA%42XN!"K"NK4e!!CJGh#NBK
-KV%5ccFK"6bJb%NT0LI`"(DKN'RFUEK*K0L8q50lV)YKrDKl0!bY$B9Gq1R"1RCq
-aE+`0(4M2"b$Rb+56K%$JIA-c16p9q%EU$[2b-AFSLeFIRHEhYFaaYT`HjFTR"rU
--k%"p1Z$%&h3F[dhN"V-c,ZNaKYY&pPhherE"MaHq50[dSc2Q,I&F9q`8'Mq!5iN
-[c06RAqa21KFLFQ3QcNpV+K**R$a4'NDdL)L6D!r3rpFlk)B`@V[NS2$q4$BB(ZR
-VSkm&a'X-T5Krk6ZaaT4r4DhILdHQ9"B2M%lp3E8cUL&X!fC`0!0kKYajL9bqCrN
-RMAF,6EeZQUhH&$eCCSB-qKPA%#c+%rcV#3VPUr9@Zpcrd#iNb`V-P6GR-*[FamE
-hmMjNQm&`[T%q0NaAjc&bi30XRfe&*M(dm6*rU-H'hl,kFN39Bf+Vd*(3'G,!Dfq
-+rC!!6143X3SFEj!!M#CE!6kq)#dY!j!!eMpYC0le4j4`$cb[*Kq+JIl22(B(cDB
-JT9NT#c#(9bVbld6#EaM!03Jk3j@#HSK8Z'mQm`H`Y,,)`q5E1@LKVhIf@Ip2Rq`
-2Yj2B)+!3Z1Ql-dA+!HFb!H(0i8RkG8@qS'R6b+"iVlh1Gb6QLZ0i"`&E`plkk3J
-RF5Bcd#cY$5rq("#kM0PX1G'l-QFZQ2[Q-K`9cqeRqBNe95F3Iq"(L2e80QY11Jm
-c91S00[)NqN6TdU'aUqMPaK(jqD-[U3@J"[$E3XSl"pm(+)a5R-'#S'PD95C'C1#
-f'4c0HFU`4NA0Y&[R$@KF5$*@'(Bh2NkN14pJ&h!)ii&GR*E)!eKa%c0S2+TXfV[
-"*qpJJ,i+qL4"aA04VPbHJ0cRNS%AAN8qJ-0@QcBY9B3[@Sr#b0*bRR8Bcjcpl+i
-%p,2YadeC!T3Nqk)@d4bU3E'8mR9HqCS!@Ke[6Y4H"`a$cJRPP8-DPi0Ib+kC*LX
-,N6JcPSk"QU,fA"$*,C'91qfZ@hXmBM[!Tj&kI9K2bC,DbPF3c5[RHQc'lCK'"CT
-3(D0pSG*Qfc8!8jB0(@$VSkQGYVd'9mB-B`IZX-AaAT28920)CpqJX&m4063c"4%
-0SG3!9TeiNlS1XdTT(jY8ASLC-3f&cJJC)@Kj[,V1iJSL@m!VV[e1c+N!C2YdT2)
-%+@e1'f0D,+E!AZi!MZ)MJRI4R25$'0Xh0'Ya"3)a"ce1*fTT[@HR",+Bl43-Vbe
-erUlN$&PRdeTSDVj,0K"PmUAa4C[NC-TNhdTeR9Kmdd1dha,HlPkSbZCC[mPel&1
-E0edhh)%Yd,PA!TQDkE@&TAaA&hP+mqdS5)-bdK8lHc[+h4IAS+U5q#I%A!L+0aM
-ZK9MiKBHl)$!0)%J2Z&+GrCT3ejKKp4+bD,15QLMY6L@caf&NN!#1Ke)-HA6-Y!B
-%JAc5a+4#l-!YIR*kpekT($5Y%1NS+Ipk6CK(pUa1UJpYEK0%T#$VrMb',RQ'lXH
-dVV&AfaNVYLb!cCI2-59ZQdJmX,2Sfp3bU6D#a8ADU1UhX"RlI+!I-344i#l6i$p
-*NK#)#XGdCM'`56VfSJj(pHQQP45p-&dU[cJS,`QH#YjBPD-A![rZRpJ3kGAVfRC
-Gl,a%iAR!`Rj'GaNV-(Tr8DD`cfF&3q@jXI2(pU1bIij"3,AB6@LSqf2Q!MhBb`j
-!+X5jBU!8A+X312VVhHFJ1m&9@"Np-ELYBEJ)FqYAF+NGJqj@(f$G&pEdZ9'e4JT
-F%DRVI(X#d&8*0k[U)bVlk-FrP3-rYAfTRb0VUlRKBk*jVG#&T`FS*@2F8Z1@F&D
-*HR*`H33[8+1p24@[l&(X+*T$Mhd9+[Hr1TZQ'#MN[&V6`[U"J0iE3jmUb&FkKT3
-JQ$1bmL9*RJ1lh2"df9b4%Gkf&3pSN9q2r0-&S&4&+3@pKKce(Yq48H#fM2RPk0E
-eT4PBF)iJ8R)$beCQSK,bN!$e9-p2U9XaDRmX)q)6'ZTAXB&),KK"Gh6P1DdHYla
-h0X8S(!`@jhK-MH)HRFZA#-MJQ`qKJZ+p"@[,hX1'X$(e#pd52dh#[HBTflV`jRa
-akZNrG'a(Z`8S3ZVJiUib!K$9"hZamb'@"fj8CX!qM#E"i0,$aM*#-IqQ-l%[#Cr
-C'LZ41M$HHVI"YCU1ZXj`ji%mT(*8J)3fD1bJ#RP1I`HTV0Ad0D#0)$d1Pd-)'Cd
-5#hS1lCe0FhmY$2GD0-bK(d$Xr4f1!kBB6"2MFFIH@((5GcK5&k(6$j5CS)$j9dl
-hf1R(1HK5MEBTqJ$@Z1&b1RAZJMDMP)DJ[8)Zqc0ri*384P0!3biPH,E16*Dc4`U
-@Z&R+#p@IUC*qMAJMP*BHMLI1q'd-k94UUPFhFq4H!VR"L%e(Y8Rp#m(mPa100BS
-SL%$El)ihVZSUMVpDFIeXY,S-pd!*&UC@m(jY2%Pjir8CT*pEL)jr(ECc0ZR@(5T
-aSbIP9!ffdRL[!$SRI[)U&LIhL25dF-U[a#0c9@'SEY%U9FAP4&K3831Qb(TM"c0
-SCH+SV2'J8,EAAP011DR(ilTc%GQeHL,BcAPXmk`AdVb%Hi%ji!P[#Z-4k0NP3Ql
-JVlk,@bm181bTJD1#&pPjK8A13cJ+qFpp&FhQJmNj42b"'pfM([9mN[VJi"B8hY"
-%`8'fMT@5TUQhU-"ASjQB68@8&mQrqEJ!FG#bfF'Z*5bXP["dH!4Z+EjcN8dMr3M
-6IEl"b1iHrD"'NZ&`Md,Kq*2V$MV4VfV0Z"Y%G(9cE,"ETfD9X[VQd-r&A393a$"
-1k4hr`QE,q,94qD!6340-m-"FF`D,Qj)#e1YpV4QkMNBSJ`K*ESl`mla@cTIeU04
-PiTPZp!(C(pr4MZVGf$l)dhmTF0GG#e&Xk6ibmIl013M-beBE[3rCC-#U3c4m61V
-PaAf!VMYkA@B4T'*'#IVGcI#G(fYF4-!*IQP2PZ"QI*(V&KU2-q4)#Z6VMB*pmG`
-0rP,jla$mV3Dmk"+),9l*48p'FQG,RR,4SU2j0qQ3!)3+-K*-2&ZfjNHcC!J*BPC
-DfiY1Jj%mUPS99iNerZ*`V`FbCVpcZ!RrMVVi`hq$Z8ka`KAle%THdKp6IDKA9#V
-d$efU'A86"JE[cZNj0E0M&h[KfAU"IL9H4KT6je&(bCJqIl0FEV!bJr,dM,H%RfG
-X#Zr)113#JrKXL$SpeCSLV,3"#T&,[k)YST'0AGJ5M"aT2l6lY"m4ece(8k%d`ki
-QHc#kdZ)4Y0D2#NL,kaeNj6!irPB4JS$,HaK*F3+EY2*RlDe,[A8"ek!TS`@N1`$
-QPFUPXeMR#c-YX5I'H54,cciF826#mq,ErTF#!i(BN8%(H5IGdp,#R$!B`I9[qQG
-kma@93+"F,CQ+d'M8q8Al11!jBRA)-9*mKkI)jiaf[kk9+9BA`J(+#(6[Ue"G'&V
-F`JGXc$[QX4#V"L#qaUNdr@'Zq9U+Rd-QYG'Bph`pDbG3N!!Q"[q)qiB(YkKSrHb
-(GeZ3!)A**`XhJD9EI["aG6Sjjb)MYIkh5kiY$$c*V!jNI6TTjbpU,iVKi"'jLM,
-2&ZC)!h288,bm8+T9@U2QF4'Y%ZVFDK9SGQ4T*QYUr!))18+ma-A*9d&La!2YCl$
-Yc`1lZHIrCCe*@S&N-VI+kVH8V)[P4I%LM*!!`[UMCj+ZFmF"ETlX&'8LFTf5%CH
-1FIV",6dKLGAdkE&X'RSPUa1h'`RP4QGNL1q!FkQqESQJk3#8d+-c1r,Rqk$"*8B
-ELTV4r&'C8$pA8Ac&eKeXMMIDcSK4NGQSD$kV2DQNCU%dJT9*6[K(45'ICeh2qNc
-M`5&#9MX%S@VRTDL*e$Jim"j'GdLlJ,jb-q`$$)hh!'1[IJi"`QjR!+[N[r"e$al
-`Uj9CaGiDfC6$Q8)RTNjlHrbYNF%Z69$9[J*4SCI)1R,IrYB'IAp6$GBVh`Jh"R*
-#f-+,'&LkE1P&*2-6B#Cpq+lN,FLD'hriK+rh0`9b0+jHq%!hFmlri(c"8ZfZj)0
-c`TcNd&K(jb%LD6dN4`"cP8R19-[),b3Z'Z"KqGMje3*(-D+m),qLT*5mQkHB9Q+
-i6qDb'ZrT5IRXNZ+bRLr`6)*bh*%e(!h12M9dhI+C59%rM%cb8EbE"mENYr@j5P'
-Z5MaDmFbTH!)RFKa%5FG!&B("Dk6U&DYGIcKQdFjrE#f[9`P`f0H4L4fH!qcSJ[c
-Yp(Jd0[Rr3Z+p'DY2IPk[3bcNE,62E0E#KhlGeD+U(%"c3LJ-4)f$h)8fF+3'@a)
-NLSd2@-QGQ8S0Rjp&dd4BX5mPVDdU04#,,CGfk3Um9,jb4L9)e@5dJGE5%hL#HYr
-M`Ic6,TTqR)q#qRdmr#b[dp2qIl[L)UB-+VS)BAX-j#AHFMG,RF`$A0aB1GI8F5R
-GTUe*$8,CM3ANCqScal$-SG(),C%J!eD(d-G%8!D)FSaU(H9P(L@''TkiT2fMc@F
--SYc0"L0N)A'&-c`D5G0-Uhflp0fP&+2,Fr[2`#$9LVU6MX%+MLEr`B)Vr3`4Q'q
-U"#aaC%Tk`3,VU`Xp+`Z0S2H4eI9'ch,mGm'VjUeZ$)#X@A91l[8X&jfTM-,9,I+
-C2F&'B-UFK)SlYmf3!1qqS*E+[Xb"Y6&1&`I*b%4-cbl1(FTbS4)bG$-icT3f"13
-N9H*GV6qKhBqL[hX'S2TQXcRL32e6TU!1*-1Jd-Rq*d2$lj!!c81p2h!p,rT4d(Y
-I-bKcTS+(r%0LJlQL!!iM`LL[S$DLca@ZI[#U6ChrN!#S,PJ&[pE2D0!fj%R'aXc
-8aTREr6C['4J)bD6I3`$[#V9KM"U@fYfdhk!m+j)UH(0%rV1lRLAZBaEi9T6BJ&0
-Nb!HdVe-CKpiD'q"LE,6E@A8!`1ZYMGEr5@kJd$#5EmJR'D-HQ`pdAYjQ&DaR,59
-YTZ(U5jc0VK`LSTdM`-43H3&k%&V['IV3"$R`VbC*-&-h&i%bC*S-j'kpSkaQeB#
-HmS1FrAE!ME,2#,0J)ZVAMYQ0cHRh'pC&D0[jYk[Y+"#3!+0(YAK(jbXj#d,)ELQ
-03r'Lq[,*0%i`2CNqUb!%4$)I8X#qS2AAq+8liEMD-Q58I3L#XA,)90X$3DkN5fU
-Ck@0C`p5"-S(S+@"9Lj)H@!4YpqH8S+&[4#qh[D2aFqm8P-Il!TlhbhSFHAcXb'%
-"%Ie6d1cKMe%994HjBZ`3TVh$hPCZT40T)CG0LZ%,S"AN*BPQ1M0i,Dm4imqY95k
-)$1h2h3T(ff3YQ""Z"prJFbB&h5'VLADH29#@A1lbD)8R1#hS2McaAS19E$$f65h
-R#f5kbijQj[9BF#-GS6)-AJ9&dqa#fTmD0S$PIQSG$1r6jFj(MfL'N4&RQ+ASM4d
-TJrLfrZkk0A#8f2hP6@cd##2pb@hM+Vl84+-NE2%lRmrLkU$FdQH*9C@BZfp*IQb
-*F1*)j,!I&$CXEf@iV4%%M6+*'cQBm6TC@SpbSLXDX9DbM(jfcq0J[lZDX3435(G
--96QDV,pm'8@9IU#NEEVB0F8GRhN59G@EhKEUY3T#"c6NE,*VqK&@N50`p%&H'[4
-A,b'2kFCfMLJHaYkFmfCV,G!r[f(4b*aH#m$YbbS@f@hrcLbi*6V+AR3(Pe[X1@8
-k)A5a'1qkjUGHUUVq%U5hPLqBCr2LMfDaj2GaGJfjdmKJ1LH0C!9A1d''fHeB&l#
-T*+pdKQLIL'He0H,a+84)1mQG#ZIe'9rZU"%j'pph`A&`DrBeAD#8)LY`JG-$TTZ
-N"%0pfJ"$XfDVk'*aA%3lZGU[Q&(X0%[E8LSPc36)@kplX[#X@LHlK@HIc4G`XL@
-),e%miQ6Q1RHj)kRH0l8h'$BFMV5#Bfa[Y*jajlJG`+@3"!%!!$m!%,JMfqki)p[
-Z!!#`3J!"*+%!!!%[!!mif!!+VV)!!#)U!*!%$`"8De0SC@aXFbl2J#jiE@`!!(2
-"9%9B9%0A588"!2q3"!#3#S!!N!G#`G8Kde44CHa@Aa`3[hE5CGaS#)!896!%Pql
-CVCrYURDGQVlm$Ape4ScZU)EUBDP48I%b"k%HcMm09(R@U,dNJRN`a!*6VHBFVAi
-mZmJi4B[%NaSkQ-b6Decf0dR@i",+Vi(Jd9$"f2b)6PkZ,,Za3%VYSTpE-5rK%+S
-DJ*EQEhflGQ4e1U2E$!CdMQaV*ml()X+3!%5,S+ISH5%Kj[L-h3P$KqV0DH3hENe
-ZhQqR),'HUjf*+1YkV@N)64X$50L!PJDYYUR1Sb'6Ta8@H('UUF8'11-A-,AZNlj
-[A&8k`&pTiNS@YTk&SD"'11PY969@L3j)Sb!$kM8*dKTKdhaL%Hm,[Q4V-r8h9L%
-rJS0m85eXHJNN'V["'I1+V,3pc!eUS!,*VbCS!j`[UXCB$%SrdRbq#,cAR2I"8-f
-F6S@r'k5kmBRFb!h0)G6YP&h+(4a(rFi290)Pmdjjj*PR48#E42V[-KM5k*Q664!
-m-%K`d(fU''RKQ+L3!+B[i45+&Pm`b2$HjQbEZ`lCDLLr45RBdRF"bB$C1%Pi@G0
-`00&D$ER(Xj!!$"95M5Q)[!b#FecpDpJckUqda4Y5SZ"6T*@'CkV`RYI#XdVdIlj
-i90+SB2*EXJVYCpQ!X0UPr%!Q*-pVPl2b26%kNi%LirNF,#Pr)eA&M3UFAp%pHE9
-3QlI9qU-#dmS)dl+3!16Y[H8Ara#,K*eM*R9@j93HLX`L&X23#SJQm*4T$H"$)AJ
-aIMXc8C%ER[6dFa%kQ[CEL-(fRG*YH2-,pZFh#ZMHrHl6FXjKQJE*d%k0r&+RZAN
-m&65L`K2Hh4'92QP*@qTa@c"TKD'*cpqED*!!lJBHAr,ZN`IZBEZc0NP*DQN52&c
-2VN%jG8Q9&+dI&m#mp4Ji,4Qj4f"Q#9MF2E0p5m-9Y"D#**%bGD,,,,()G0T!S$r
-e#hi6T6Ih&G(ET"-[(")K4(J8fk'kMb[FDR@,1p'3!1rE`GV4Z"F0*cmJ2E`m5Si
-H%4A1JDj$Ph2h'cFq(bp)FT`EqhG8#D4q#*+%(K0#aNAIIp+CERR6M)f-mLjHYZG
-NreMiDK`*b&)FSk5ad)rr`2"h,X&DIT1A4J'THM+eDDGR'[SAiNZJaje'e"UNdRQ
-HJ!0-(e0aD!5FKHZDkE($XkY@SZhVp)B'#fG"-l08VM(e)(J,4l5+8STSG-FjQ5Z
-#Y[YJjCCP2`KaM@!F4BU$BT%qUJYjc%4`6c6F'5**#ZA!ZQ#@3N(3[@`#h-h2b,a
-PJ'Z+@%SU#r1YM4TM"U&'HIad@M-[(G'1@GAeK61[@61[lMJlLHIUZGR1hXb@`T`
-1$BZ5&fXbm!lD9,#1(Jedk,YZ)KPcb+(V+SqR#hpjrKq@Dh9-G-D0A$V`49*cpM"
-U(kMLLfB+0Va+[J(ZL5ZPm"Jrb9bfb)#+hU'mIU'lqr2N`)jYCDULMqEPTpNhdAr
-Y2"A0-lPqS"$)9"5JZQ9XL)krL,mCie@![C,V3#a%3&XQKf[%0`,AR@i!M&IK$`H
-4e8(&ra%mU51$j0-PS05Z)"@5@Dl3Tk-B0cJ8j`X!pD0G",8[FKXrQEp,RJ-%mX,
-j#ap`dXe-l2aHU-,)6a*X$Zc9KqTld,0+JX93MMC"$N10h+3JciU,eYJd%Xl1mVh
-ENZhr#14MN!!YIcEBKlZ*B,h$bBCR*c5*#hmlA02*0CfV)kSh3e6RbZDq-T`piQJ
-I$rjGjU(ZII1J0%fiT582lYqUpcbqRl!HDY[%!-Xq60&89$FSAH!iK+SBdZaa*@l
-$@AmDY2`Ah&2)M3AGZ@5R"KA'p*YF*lYXL[S,VFH0iX9HH'#,$DLbTUr)[ieDCmF
-G)1-H2r1kkbi&Kim*HIU,R&-c9Lila!4h9R&15KjYqS+Pq3"rP2%1BeE(b%&UBPS
-&j+Q+0)&X*'3CcQ[0(QVmZXp-`mN%F#VAT1&jCM+U&@&qN!"E2c*q[Tmf`KL%IUp
-!cBU`-caFXUa'l$[ljSKfZ(*dqU)c(kI2hAl615BTE+k2k*60ibU)'+M+69f&-V&
-[L20XjQEU8B#CD"rbb!,qZm(3!LP"Yj`F@(p[B@D83R$),(e1qAMc)qHNYNHrNC@
-L*$Yil&6jkj`TbKkHT!&@)5Bj%L"YKU6YH1IDPTmc*E9Tk(MTkXN)*bB`h&'Be2F
-NXEBAkISYE`jS()RYVITkEIqL-PlJ8,EfC1DDj1D!MC8FBIX0V0EIaAq*3Z!cd"9
-ARf6(Mf@(2RCmSL1EMQ@UJ2Mp@B5*Rfc4&c5!1m*B5&+ZlaFR,E$#cAhc(cLG!EP
-a#Tam!PHL1i6(jj5KDE(V81LGNAG,-f!La"+(b%d"!B9!TmDM'mlZNZ9T"ET!!V+
-3!,``IMQT$'2qB+!N!Ie8-bUS@cd3YK@5Nj0c4aUe`ZrVDhkN3G89Q82lH%pM4+D
-E*pANYl$"MaJkV`1ZF#L,aXAlT,XDYRDeQ4fa9(,h!rHCCY(!d*NAdY*ad(*DF*`
-1Qd4KVk'ZLBh0A@3KIJC(+RfacV$V(VMebPZd-Tl*8!8aD6R'YQa5Te+kXG!5'ic
-CXarBV[Hiei"FdTjaj-HHIf(PE6U"r5V*-$,G1*`mScih$+p6dKbJmi1"l"r+9ai
--58-rXJmfXHSq4Xp9b5er$5-pG0++X5T"Im0ZAcY2e"RVFL,a))4AKpcb4G2GH2a
-1-q5MFh2Y!J,6C6%m0m4iZK5VUQ-(`aD42UC9U'"L+ka-aH4G-T!!2'A2KAYmQ[N
-`VFTif3r%bc!4#bBlMYbM"DBirraQQYm[2j%r1J#Q&m98S5BV#2kqZdZm!"a"&0%
-KSXHM@1DS+JilHX#Y9dj&bA'fcQL&8#U(JN$8'X")+$HI3Prb&Y692%a#bi+*kU1
-3!)BebTcEBZLYJQL&)TP2LHKJPM2"mCXP(#VPXMZHK)CSk9EQ0ccKDZF!Aalf[9-
-9%5&DM$(S99m3Gq1!5[*Bb+alQKSdqjQEdGcHjF8CBN)-!Je#fm1a%d6K,M"bqb3
-6M#a0X&LfE-(eRmAq@CHK[FQIR4iSeSGacdMJ(k%Fqr3lQH*53ePH@q8#EAh93B`
-@RqH&ipI+"%KSCEBj,Y-hSXT,Uh)#$*1QYhdD,N8Ka`23fL!HPJEYm+RRq`4I$3&
-AI,PSAA-Z$pcb#m)8HN[*!3FGR%fE''HP9b%c8bC[FNa,059clANaC88[QTT9P02
-F+A*pipeL,h*V3"CPr1UUkmfPMa!6TaYjEC`mHClhY*CK@Q1Eq#QE"CUp#G&XIYe
-2a&VM*Mjed#bMFFEd590[qj`,3UIb+d+ik(%U6'"c!E1,jKV@lACXqSQXU"U['%,
-%8KqM&HkLk,Sca,1C-6cpI*m4GpU$qNa3*NQ@9raqPQK1IEAb*hlFfBZYi5)iEJU
-kh'p3U0CE"Ad68!X!PLkM,a!KpZ+(6JK[,Lbc6SaT1'%ZQXmH5BCDjEk0C0C&G`F
-69F'd8L6Bmq-e9RrfG89iXl35r@G,QiHZ&9#1*DcFBC!!%KR(Zb"r"F)N4bZ#iVV
-)R43'CbiK92M9lrhe'P(q+U"++iUH#H)b*SG0`0ZJ@K)FDR1,MpNb[bA$bPa)`jR
-X*hm46ppU(k28YB[K,J$2Ue3(5N(!dZFe6reZ,eRYcE1j*`Qrr#2%d(MRH3dp5lh
-!T"j5$CMZSYF3AhLBjBHY'LepUJE3iPfjFa@@%%Ia+Hl-X+5`CEifNr(DQ+GRYCl
-!4J*q*!*Qq(5lGPhA)(p,A"@IBPph,+9reP-%kFQVrSaEbEd-6drj(e1PK0"Hb"f
-MQFXNqmBpiF%*JY[2lAr+lpUqC3XVrl!$CdQV)F5#B6)peQ4mcM#jF`3)a"5$G5K
-LDkC)mGL*+f$0"FTcV1hKh5dP'BL4hV6111[3!Rek%D[-[N'1@QeH[-,`lT%JkF!
-q68L2lTMENaY`L,UUerdmYUNKrBqXHUcIEB%EY#MJ-KGdi)aTLKQdZ8RJTHpY"IP
-F"p,Ji6N4RKeME"j%YPCp"GD%N4$"kdRdk%iKJEQEJJa),AeN92*-GjJS%&'XP2%
-F%@hEBi00DBfD6(I6+hqY0JqZF-rjP(rN8BIQ'k-chD-M@Xc%8Fk%"32&Ul&9%CD
-TmSS&1Jjl@0*P48Tq(k5j,*3*r)&e23jU&L,PXEkZ#IMYjHB5aVc$"cF)V+FQXmQ
-ifc+XEUiDMD0beL$DL!kh-5lM&b*CCXbFDC8!RYM"Y`"#*d*Qjd@['mKfNSj'2N0
-N9!TNF`e8VAJZQQ,,Z(rN!l`$hA!0*)GhZpS1G&dBak5#j-"8CA&@j'GHq5jZ-f$
-jcZKmVq`jPK$r4kiZe%-6[Me5*S,bJVieUUHID*jr60A+ia,!2")FM2E'1mI$mK*
-C1*rCZ,AK-"lpAQ+UFaU$rQ8mk"(,aCB$3*&#*Q3&F1*)cLL[AFj'4[#lRpa@hba
-3GCl1ic+0RUSKb+9Ge2P13QTEeE)f![3[lR6e%RqlIL$YY58*FIH!TX3MZ%+ZT8E
-*YPB'ISj5Z6,I",eFi"!mZ)dkL,(@a2'8-qXNh!R'Rbd&@6U1VAZNZP8#L0%IDkB
-Xf2Q09dScFadjZ4&ic!4S"h'Q6$Yqr4Y'iT!!V[`VaT%1P3bCc#8B&AhCAH`#ZIM
-ZZ)C8N6*GL8B-ISYI9eM*eq,S)26SIA@9N!$rQiZ5%kfi2'dqcP,NKH!)$P2ifcl
-%FEh4+RbaB!"Fr8hVr,edRKEhN4#ipAaRD9Eqk099#!iYY*!!'d!'IfBhG`XQrVr
-5)1lkHEq#)NbfC432Hf*3U,"@8&YrrpK(jUdZ!hh'5`q"`p@T`[5qF9!6&Hpp*D-
-I((jF,A8I8C,fi%ZR*%k5CQB&DQe[blZ'RI1[IlNpUlmcGl8j(q0m&4PVK"eNVdp
-aC00I%AN0q'Z"cY5`jPTY("#R+k42#khi5(maU"U,19r"1`hcf"9YCT*L,Y*kkpd
-N6EHTKC9,fZ$FU"BhC$DYIQ#3!,qPIYh1)c3JJmrPHUEL'1)#U9HdMKP(e)TPfa!
-rlr*C1HfQZJia"pBdDL*Z%@00Xc2E6@5f55Yl0lfaR1'fU$hpZ2Vkh&Kk(FhmqP1
-)2Bf'Qh"8a0QE0pQlqDlme%3FHA2F`UTkjmd52&10JC!!(hhV)aSUIE`kS'`DjA'
-Ca0`(UDqJ4%lm9E&4j@*4#*rLM"E24A+3!1X'qNpebXVj9K'EqQDXcY%rm0B4KKm
-Hrb@G1))-6Vm#jle"EK#EHHmX2LHc2mKNF21mXYHfDBL3!-Bc$,SHf[A1pNrFRF0
-')`U94#*(rV8'T*m8CNSj3+a$JZ"%b)#($2T!MhKIDSAY#aJ3`3idqkN*Y&*FXT!
-!qH(Xj8SKarTpe*iHcApZ#6ILPE@NMmfhFB&liCcjEdI0iNL&0YBC2`MH,RjbAkA
-KbpL,MR+i+chEhDBiT86Ue-D,Ce8iX$bNBB4%4dbY8l[FqdVacTjT13iNADjZ"(1
-X+L"FLR-%FdSi2r)YFmGb'PbcSLd82f`!K38A4MXH@P9XrZ6CqQ,FUJJr&#Y[1I,
-jeb"IKf33Q$[R99ChQ5%YS`)NN!!dcKfPe,`bP*A35AhZj&h5QVPP2p0F'0rAQEX
-CPHhqaI9FP9*GC)k)$qk-+Pi!HT6[hh(0hqFp2IIjpePJ!llX,@UV)&Qk`9)cj8M
-0rpJN!XElGm8#5PBmr&`MSaRj*0BHZ9F$4lVJhaKr$,9bH6)fNSTQl0cqh&V-U,c
-"FE2f"%Gj)kli+fcDP2*aX*!!@5X5NkeGi@)'P`,S32Add9PMk&fc'Ihm5Uaa(+[
-f[ZF)A&Tp1XSq#B58h"KYk$frZDc,BK@CG[eQ@Z5P`fYJ*aak+Pd&Z8jl8)6cJQh
-3blK(9lkD[f(CaXZk&M$CF@8!-T3)AT)-59#5D6kVIL2Ta92+'d3-EE'FQDpZ8[G
-jY"XZeT-"i!*(DEHe[MC8-6&[VPb(Ifr2ZVd(6L#86p$HV1[21fLfRUjd9bC'YPp
-Y!0CmpD[8IqVMJp(hdQMbH[i)lBV[pGdMcL6(0"`6Deee(eQN2CYha)IIe4mB*4p
-6`K'(CDp3*N05&LMDA+llPdD$RSeP)c[QGPQbPXP9"0Jbb8p*Zh8PI%jFI!(P'0[
-k'X`VBXjB9@FMSRZcH8DjqUAR@R504f+h#l&BbP+qU'kNUJXA6#mN8j3j-5U+ILI
-BRfI'6lQ@XA2qrl%0,&9q3`lVNY+6[k3eEJ)5k5pP60mqjXXM`a3"R`@B5,(h22F
-UV'%*-6%jdGGdM"em&hp6XU9d3Qj2jUZr8)[fP*+Hc%G[PCUPdVhaY"Vq*Z6)D!-
-V2TpQQbfa*E%Fr'6E"%NNYf$dM*5RXXSVUiI5AM2Hk3JQG'j1ea1LGf+l(L2FhK!
-Q5XbTmmq"[JT#'3#q92*VdmCAr$#RP*!!ZQA4F9AD4cl@P4BNNMcarCJ@1G`2a6N
-4L2"Hd(#$+L@*2&0Q1BDTlEVF9@mFQ@)V*0V8R@4TJp+,RYh[I)YZd3'N938i&ib
-BD-J&6!%T'',Qh`#YE8LMrHIE8&2-HrqIlQFBTNK9im30#r0NEbYTl&S!DBkfbZR
-1,epCDGTPX9lG,!%mdGrIR)`cRR$11m&M0KrF2X%6G-j*cC%0'Y4(hA"Q+%lq`@2
-YF`S-8k"aX,He-Vjj(mSmAY3D*3PE,F4J`hA8LQ%CF"l$Ldf5K'(8E-Xh[@iqBVZ
-@a[R%q5&!"lNK"GCXRhifED+5486@E%XHAiiQLScLh*UF$6SJHTM!)V&+BPGaNM#
-@S6DD&hii10c9CZSY'+eTp`0IP5NGlQU#Q&2jp*1V`aQ1j14F3Yarc%4q"9ZhkRI
-(U1DVFfqf6MRm'cmk!`KZj@-0aPTr48)%KBel8fac-h5[kmU5QYE[le$C-`j8&4J
-AaG33j`-,(29TPVjGY&$aa-(cT8@qQMrAfQ1'Ni`SrQFU4l0F8LR$HD4BQXAVCSP
-Fr0'J*9P')e!'!d,CB18RULLc'kclZb)aGM$GkCDp2iF9-0*Cp3LDDLUXGkX'"Mk
-aXr(jrFMb2rq&*$UM+mbX*"3!U3NS(YaT%,V(SdL8CT[5aDHh1N`YFp4,`N5c,J$
-V1iTLj-Y%N!"26qGI@4!c[,Tk9(fkK@bI6r6I50j2eYQHLH43TjTe0h3)IB-QkRP
-G9@RrXH#lhMEcGpKk(D&%#[bTQHEUAi(E3V1e*L8bR94KNF%EGa%Z@KU0!%K+9M[
-Q@0UrZc0EdVfLG4XEjc6jbBYeU8!8Bb$JDpCCjHNAIh1Bhm%UKm!D*fG+IX[*Xfr
-)2YC,ji5IVb6h2VdBj,rX8qQYPIRTCmbfd[822j%5++P*'6+dj9a*2QSrP-6im#I
-kcDAa$4F89`PkJbhTYpcH[pYNLR'0KYCC*HmMZGXS3'aI#(+*(@QFe&0Z&,ki2Pr
-fJmFDJjf3!,mS03($9d5f6ciFiSfZ(%FT61*Sj'e3YVUeT`,&(b&S$2'-eXU)[ra
-5LVk"ZX!kS9jh'd*GhNTcS+C4*U"H+h5&p[5fe4FaMiq*Crf)IIim&FddV2YKG''
-l#2EY-kH@@PMD0`CXY5N8DqE$Y(`U5a[@i*IBlbK%HCC"(k&&eF*A3j8Zr6E`5J$
-9b,Q8EaAi-NHFNBDCJN)PLak-e5q2Y&b2hXK(33cSaLDh*d-UX3UN*a`GhBfP4@S
-'6(LM[Da1d#DlPA4[XeeeAXC[F2U0%ZK-k@RSQ99AI*a15!BdU2"'Vp-HhLXQi6q
-8dG`#1DP,q22L[69)EiU%qG3XYaR2!R'XZNEi+@XC80b!`fGU6@%R+*q40N"hFUq
-G`-)*Hjr!6AFTK81*pcTZV3HQM3e@jB2dmT)kM%Upk#UhH2beN!$UA+E[j#PE$28
-aaJ+hKM32'q1LF4AaGa@"(elE%2#VP!!0i[!(U`f&TLcLhAZ#D6bYUHiL%QqB9)N
-iHN"5)QDB*$!F$L"TGaTpAlUS!%-VdYKT5j[Vp'd[r320IdmbK*GHG,@BKqfL4@i
-qQh68!JHMkQ33DaT&Q&T9[N*-F8ICh*NbKp#CH%3N!G`C$*aKlUQ&QUm8I!V#F5B
-KilfiR$LD,C!!pBhI6R&#B9$KIb6D"dk2hDi4E",EqGBKdFfYJ@PF,r'XALT@A@V
-*G$kpLL1B-$0Lfd-QXV0dlF#AcdC1`lPfC4lDTjiS%h$dp0ejYf6iX[3mdCcdPEI
-pV[(@UYJUM'jGr#Z*"PE-4bXS&a2m+M*#10B2'CH0[0`30l5,cGqR"29Ec6Vlj8$
-JMGd(ED!DmSAAFK&,K`@FVH9e"-f)&ATrD5FX1ZYLd#BU9,iImU-Kdm+Rl+`[46T
-p,+P%TPIUeTF-rhH$U%VXqTEB2fSbAAmiA%#&THG$MF$Q9U`cFmAi9Nb3!,K5la"
-#K@T'NC'&lXRHkL,i)CEI1qT4-G6KUa,HG#8q$KR&Mj&,k$`j'SUbXeAYL"aPhMK
-lNmkMHmT+qhpG$kV`HD2`%HA(1@#P4Vm@5HZ(#ccdXpNRm(a69-h09RZfNA2Y4"C
-aad$*qYah8Kr%U'iA&fcE+T0YUSr$LS4DQdD!DUEDml6Ta)FGlG6ep[lX2qli4b9
-h5j@f)1GYShX"Vm+RKAjG,ck)rMVc"r&*'d@a44K&fY@$XLCG+YpX)E5p"!Q(`AH
-+GkR5*+9'rTMFqqh!hQ8DZrZK,Yh*!CqekSSp&+TPkU)J)ZCAkDa"C-$H8rP,QC6
-I%FrQ8kIpJ+*JE1#mC6cp)CG)`#bD2J9,+[[$T"F$A**IHaZX)RS[(BqSq$pTXbr
-JbQ)bRlT*Fi'AC%4q()Q&VC[Kp28Yr4,&$2I5$K!R"3H)(*6HNFaH@jLGMG[$U0Y
-I'r@G$2Er('1eYh3rqm1edpUQ0PBEIIMa"bkrQ%F9,G3&djFU-q4hAq2CMKPjqbF
-JJ*CD4*Lci)`c4+NaJrcQPmih1*jpT!A2"(pljHP0BdYImr+Z'(m,-&IcDIN$G"(
-6BI#YRM3mR(i#LRT)BrMEpHD#rFD8621QQ6ZRI8e*qfH"NQmGXZ"m,@h`9G8k3LN
-@LSED*%$,HP-`5@-e!lk%$be"C4c+@U&SLrRM!-$19U'k1#LG!JIhq-Km(6J0md(
-B8DD[B!-l&E09b208H,ldK4@A"qZPapHjIHjHDLkErV6qL8#DjfDJ(#[#Ed(34N)
-%"qT6GcE1HMYIl5Cf1K*m3"lp'BK&2eYI%"4eHelV!Nc2MUKLk9'80%@l3'ek"ih
-FR4Q+AGfd`cDG[4cr)"$6NdAQl*!!T#Rm@EMdiF0FRlecpjE2S[@DdQ)Uf0LaS"l
-&"N@halU`FIZ91HH'1hS#PEf,!62@I%GCB[&d`NqJm-9+GbZX($'M(,dVDXPA(Y*
-h`S)E,lXC"Q(Xl5#''0FQ3l9(-k5jRmbp0Kc2#44p'N3Yfp#GZ(K2Q-B90IdN+$Y
-'-0"[GK-(F6k!q5XjjRN%kGQ-@0MkMD,F`6-#8DMH1Ji9jJH0-(3QIQ*QZqcP",2
-BfT3)#ifq+k#Y1T2qTlI0il)eSh@rjHHp%&DX,3eU[+&)3AFDCSN+6G5YHX(CR6%
-PM*%rH4Qa52(cR5*MSN'8c[,(P!YM"2-6IE%d!HA,PA)IqMQL@'%Vl8)r0(-aV1i
-aJb0YK[&Cdj!!--U&I&F!fN(hr5eB8TC-8U`BAq9X1IPb'pQHHNql6`PGPJpieR'
-$)GKZA#Te,M%l6mHek%cr,JL)iU5rHMb-[qiPG*1AHk6Qb&)Zl%6AJ,TpPKHBb$c
-bc'-BN!"@YR%&m1'`c0BiFp$UlB[rZH(mT12YjN&X&KeCh*1(-6il8I*CCMh@U1M
-aSdJ!fF`XT)"hZ-+M"M0EGA[$3apMDkr#TQRVCraS$bcP9AI'V8$*"bC%0Q3VJ6+
-@#2IT0NlY""hd1$HK0Qa)$Y5Q4,2MSM(5C-TH!@Sk$lc(Saf5$U4`5C@-fdd"+aI
-3(f,d9P$jdD[5`cSU@5ZMXmIeYL!G-Lp&Vj,Bq-SBRI0STZ4q+-%QeLrVe4*A+hS
-ajjaRHp3i''RLf035d(qQB9A2G*M5%m'IM%f+qGEZX5IPlALdY2@Lf&,EhrEFVZL
-LS+Rf-"4#e+-kZa"l8!D0h'lcc5B$h)LTFVJ2[#0@&20JN5k*aiXINc0k$GM&YR2
-amQ,)r,318km!P!F+B6Fm&UkqL$)q[pBXm#0PG-qC51$ZfqVE+fECrELQ8V!Ca&`
-(UD[8b'cAA6!PlP19e(8%Ep1BkEdhi$033JQTMXKHlL9k`l3B0p+KPrpiNC-)PjL
--N@bh0')5GG+$Z4#[SDZ[#EZ$hfR#)KZ!f$JJ%D"HrUPSXZdfh+65a3CCH`r)4Zj
-(p3F66bf-8CA+dX52qQ5#MFYRY[%[HZVBQ6a[51eGPia,1eRVqElB2$S0CXD6VHN
-ZHcie#@UV5V4jSq3q"kS@4$5`S"mP(M1Rbq&+HE8k"8L"AIYB`8K2LU`Cl1'8j-Y
-hGa1*19h0H3a+p"BIml[Cq#"F"UPfSGQIN6JTiYVYRZ`@VkN"S$4CcdhA(RPi#3b
-k2*J4QG6iM5@VZSBY5Me9aC-)pQCLeZ2&Q9,0Rb1GrLj3&'DV%!5*6hC!+Y&%rGS
-[e2+"6-SSk-Z92#APC18A[E"bqr)phe!R@VPU[XppDmLC!S9f&bR[dFpapECkPTT
-ViEG+p-96FGmD&T8Lib3a0b2i'Dm3K!66Q#`@rPXBj+H9)qCX`"SPYH41j4JFPeI
-!I%&bJrkL$ZH!L)aCSbHX%$4LiQl-33`JfNNKDfk%pS66FX`,$,S4!kh51CUr,"9
-p#Vam)J,)dGBTI%cAi+@Ae[b`Y$(5dP'TBCMLB$&IeN@[mlj5T!Z(QpL'I4jcGUc
-aIQklG*,Ldbl#``#f+e3[cq-5CASklPXY9B'5a#dp`'#KhR5`DBaKqU6f!@,'0dC
-6[95$Ubqc[[8*NNTj&&149d+TkEil'Z9%@GFqVr+cM&Y8IDm[UN3aQ[d@d+m4)@,
-H+ZMR!9D1)'1qBUY`Zpeq1CX"JLN&K*R#PjqClAeZe1$k94["&RXqJ@E5$9AJ&Zh
-6e8I[Q(eDYk1pj@GYLRbReTKk!@(H$lR'B68`ajajPVkAl&Y"@'r+$'b)3`f"D+$
-`Q!-@Q,dkN@&YEfmmHCPq-mBFVKGN)5Ic4)LJi)C%L4cB)XM,hSr@1NFL@mINT#R
-Y[NjdL'1,ke!&"!P(eH1Ua9!#T+@a!)UA$kl8UTH3!#8rB,fUqN-"aT,B#mU+)MY
-cmZri-2PTkBKc!f(M!F6BL-pbGMF482DVNQjM5%1SapjDJZ-5&@&h'D9H8be)`)a
--Vb+(a&e&1iFBZpEf8KJ`Rr''"V%61if)AN3mfVX*Xp(i*m8i)&j0SDh3-qRpGa*
--*cUr!6DI(293&B8q!SbG)TpedIeqPDm*E(hFpR6%IT!!8qi[%X%ZMda)))c$GNl
-AKmXE`&('6)A0j3k"Q8+h6FDBA0k3!!ZJZF-mVV'V8$%C[XBV`FNb5!a4F*!!GVH
-ceQ#+r'9"3Y&8dU2[)Z)QXGKb-Z5"Zj'BYB5B`%ZbIN0DC%2ir#d*&95EMI9)r!e
-iVLmkC-MBebd6%%I0fe2Z"6R,dHXK+IaQa!c+m+Y%MpKr!ck@L#HQmQa9Nfr8f4L
-fQ,Dl(-A)q`#RQ6XH!BIImRDIUmGcGE)#mc`@3k0K&1)f39NH0h'JITFHj`%kUTa
-6ZYe`i49Si4$Fh5ec`*!!kkkCl4SDM)X*""P21l0qXP@Spk0J-`T%9T(*e36EUi%
-1*UlDU`SHDfBYZ%Em@*elXabrXiYRl4Y3U3i@3f-*Z3q#[h`aVm4b[,P,+1$lR)U
-VYpL#%fN*a(X0+li9B4Pm*hG!TC!%!3!!-!"!!*!*!3)8!*!'!5m!!+m8rj!%!*!
-+TC!%!3!!03!!Y[&1mlEa6[-!!!%[!!%PZ!#3!p-!"EeZ!*!15@0[EJd!!GZmD@0
-[ENe"3e0"!*!2J!#3#3(Q!*!$J!#3"!m!3X(8iHr%)(JHNZXl)T0$PMe1&X9%h,U
-"-`j,RCS+U(NFRSIR`'$MA4ifZ1eNp(bc"k[8Tf29`V5Ebi-dlUp1aif&(6j6c4P
-RTLP1eK5a-h2EPVY&cfClKmZkIGS2aXQ*%PIPjC5M%Hph@9&a(ZfDKkIUBkh$)JJ
-i(L3&)ZG6@!#PN!3"!!!`!%!!N!N"*0%!N!I6!!$c'rq3"!#3#U@3"!%!!$8!!,G
-D*!Qh@L3*!*!$d`!"*Y-!N!0b!!8$j!#3$NPMEfi0!!%Eq@PMEfj0380633#3$i!
-!N!N"jJ#3!i3!N!32!%,"e(hUjNKc6hS*X&!ZqFG%dkqC`#&3,a$2e2#TXr,m"`I
-TX2aa#U@1B4RRLq-r1QJ#9qLYrI((9&L$XA)2,'LECK*f+UV8Th1V9l2ki)&%iL5
-K5Q'@4Y#J-DE$2UC8f&-1bXefXah+kUPMMV51KF1,@ANmC1b*FBUJTHU(L9(UGP!
-`)+@3"!%!!$!!3!#3#3%Pk!#3"h)!!21(rj!%!*!+MM`!!!%!!!'253!"MNN!!!4
-X!*$cI!!"!*!&D3"M!(d!R`3#6dX!N!Fp!'!!miKF9'KPFQ8JDA-JEQpd)'9ZEh9
-RD#"bEfpY)'pZ)0*H-0-JG'mJBfpZG'PZG@8J9@j6G(9QCQPZCbiJ)%&Z)'&NC'P
-dD@pZB@`JAM%JBRPdCA-JBA*P)'jPC@4PC#i!N!05!!%!N!9Y!'B!J3#L"!*25`#
-3"33!5!"R!31)-P0[FR*j,#"LGA3JB5"NDA0V)(*PE'&dC@3JCA*bEh)J+&i`+5"
-SBA-JEf0MGA*bC@3Z!*!$6!!#!*!&-3"R!%8!V33%8A9TG!#3"3S!8!!F!4#)'P9
-Z8h4eCQCTEQFJGf&c)(0eBf0PFh0QG@`K!*!&#!!1!#J!,U!#!!%!N!0p384$8J-
-!!(i08`U6K!'ME3$X#h)$Y,)b+b[M@dhH@qpUpkCZ*YH!-3"!!`#3!lUe$)!!#@N
-UrZ!"94)XqdV)@`lMjA1kK9'1XMr2MrqZ)$NhV"Vi%FU'0AQ'BU0RDr#XAMm&lZ`
-,`,#T"L)i6&Fq[H[,VD-C!m8F@8XE1!X!N!0D!!%!N!9G!(!!F3#X"!*25`#3"dS
-!93%6L$T6Eh*bH5iJ)%PZFh4KE'aKG'P[EL"MB@iJEfjXH5"LC5"`CA*QEh*YC@3
-JEfiJ5%C6)(C[E(9YCA-Z!*!$EJ!"!*!&D!"k!(`!YJ3#6dX!N!G)!&i"*BK18fp
-YC5"TG'9YFb"hCA*P)(0VDA"`C@3JBQ9MBA9cC5"dD'9j)'&bC5"ZEh3JFh9`F'p
-bG'9N)'*j)(4SDA-JFf9XCLePH(4bB@0dEh)Z!*!$@J!"!*!&A3"`!(%!V!3#6dX
-!N!G+!&8"%iJk9'KP)'CTE'8JdPi`db"YBANJBQ8JC'&YB@GPC#iJ)&"XC@&cC5"
-eFf8JDA3JGfPdD#"MBA9dD@pZ,J#3!bJ!!3#3"D3!M3#i!0%%#%0[ER4TER9P!*!
-*RJ&H`!)$k!#3!p4"4%05!`!"%Je6#TXN!$Z+L)S9caE3Fka%E"$e,$pr2qcAREr
-RlXi-TeMBB58U@)999@,P[r%%XDS&#l*P1diJqC!!(`&8**Mk0Eb&Tph&fGe0dXK
-kNVep(bj$h-@Aak8,&[Q01&G2PI8,*$a+MT*"[ZKdYI"dDK@D)Mi&jNl(,(@,TA1
-"CHpm&"bi0FV-TR9!6`FK$%aAP&QFVF'lCA-L&paq$(JIm$a!SNrM'Ub)p-`20hN
-S80Z-b('VTjc&BeY4ZFc0eZQ"Uj3hhmRl$1Rr92r*E3#3"$S!!3#3"9!!@3"N!*-
-%!Np,!*!&!`"%!%J!k)JC9'KTFb"KFQ0SDACP)'Pc)'4KE@&RC@3Z)!#3"%J!!3#
-3"8F!@J"E!*3%!Np,!*!&!J"&!$%!k)JR@@pe)'KKGQ8JC@jdCA*PC#"KEL"TEQ0
-[FR*PBh3JF'&cFhG[FQ3Z!*!%$!!S!#J!YJ%F"!&993#3!``!)!!)!+)"(!##998
-!N!--!')!NJ$`!CJ!K999!*!$$!!S!#J!G3%m!)G993#3!``!4J#Q!,S"eJ#'998
-!N!--!#!!#!#L!4`!J&99!*!$$!!S!#J!VJ&1!,9993#3!`i!+!!S!-)"T!#)998
-S#J#3!``!+!!S!*3"%J)!998!N!--!#J!+!#0!4F#!999!*!$$!Y9EP0dG@CQ)'&
-c1J#3!`J()'C[E'4PFJ!!"$0"4%05!`!'G`e9$8-L%K(QAQi3C#dC4'Vb4#3,%&Q
-VTLBRYcf,M1"fjmK*Yc06mTPrGlr[fiSm'pr-Yl9!NYA1l-RN5GLq1j-4NZ9@j)Q
-Xb1mIN6q6RmQmfGCf%8N@%l)h,FNL+%$L"rp1@BD49%3iU!XlH1)RGL%XdS$Y8-@
-K&RB5AKr2MQN-Tdqr@5Tb%b2*lEeNEa2deYr0KTa,b#P((lQrdKDbpHCeqFBN#8X
-TDGMHT"F9Nj*A@5m3r1$*iF)A(Ra+`bCSd@*%bYh0[UE$mLb8Z8NZL1FKb4cpaH#
-,'S2Z2"A0G593mh5B(ilNbH!U(HDq*03V2L&LN!#Glm-GLj)350pE&JffVadV0j9
-c-)PcYTmmT-U'cCf2[lLr"Zb,Dr,j*UQJ&eL!@HMeXIT'U5KXK+Zi)G(%4'NH4P'
-P*SBS*l2%Ke)*Td69NE&*%bSLi2'$"P$iBJ#e%QfCd)!P0"&UFSY0QF0BUD3IT`b
-XGDL,fZ$B!U8fSh08@--BYZrp*)$#,J2%1@+BZ'k&r-qa*h(XSZeGPi*0bi'TkX2
-@JbVR0)ahG0E&J(3EJ`[@YV@,-D*-cb(Q-Y`6mPcZfjMcBMp"cGLljK3Rb&aVTMa
-i@-PP[RfUT+62k1U0klXYd-Kcq8@f`RZ!4-@X%K,E)89)*H!)2HGQk+!L4L(61rD
-KE[-93T%lT4&h#Yj6*Gq@)$NpfZfT-bIQ[*a$ZHi9U@$-fpTGbR)EqIHh6JN-ELh
-Ir*F2iT-R9S%)rHb*!9X*2'JQcVG5aT+bk)"66"T!8Hh@RKiMNZDb1RCPrpLBBZE
-'f'*+5Z1k(+rRjMiNk%bc`$2Y2dPbk)d[lP"05[[rh(fm5+9i5KpCGN!BDPI(P8i
-GH))aB&$'@AMak[HhZkICP"IAk`20U"30ED$cl3ANPB5bhE"dKJq'UT!!'MJ$K%E
-f[#TaY#Qi5[JiZdp@*Ek(V6S2"5LGMGP9XcSTH`kX!)Q$@e`Lj!Hc!YeF"G@qBdC
-pV(kpX(EYJl32qi0AAhd*'kUV,i&`%M,25lL3!)9HJTA-Hq-JNiRVb1C`%N0V@&,
-9LJXedG30VZTedYBKmQ8[pD@$C2LX$T!!US[$LD0[BBPS9ake"Bi4i"NpQ[B5,S$
-!l!aZkDY"[CV-MSM(ZdcHrYqi$lHRmXQ0Uj1Q&hdZmV+6dc$Q@CReZ"0&fVV&S"U
-a`C3d8JpM+h9[1peJ#QP[H2ESABrbfDQ9EXl,)rR"Y(aV,(DK,&e(qXHCLJYTG`c
-eq9R+jqIUrhj)D3VcIeGqcX4Q-IlfpqABR&9R,NpTEKEkTP6FE&CkmZ##0U6Epj,
-8cI&CH25LN[RmcjI[Q)F-e2@eAFBV*qph(["`34I,9E@$fDIYZ+ZVJh8&%Tl"cXY
-,fjl%2ZKNB,XDjI@RH3*a"UE`8,`*ALRF`jGi-!Gh[Rked&R$@pIN$J#3!aJ!0!#
-3!r-"AJ!"!3!"!*!&!qJ!N!18!*!$2!!&"#"[CL!()'PdC@ec,J46G'p`'dPdC@e
-c)(*PE@&TEQPZCb"dEb"9EP0dG@CQ1JY9EP0dG@CQD@jR1J!!"b*"4%05!`!-3`j
-G#kZ#*$lU%1prGjb%8-8Ke%4U9$M4)k"mV`1cHE"X35+++e)@+mTLVcDH@@K*2-m
-fY,@Gq([e)E3@F+Y3`CU6#q4l%rB@IfqViqmTMVm(#i0NeC)kXl[86Qa45-+m*-Y
-)P`SKT2Fr)CeBA(YZrId!$HEQ0$%"*$3M04p9j!kQI8Mr1XJ2KmNe8STE4UDQIi,
-S@Rhe[I@qarqjqdZ#CYHDLRYFmcXRh'Fqe)[)rKRQcr8Z)jY$mqMAB4Z*`8GNQ$3
-LNF,eb%X++LNJ[Q-))Z%`N@8J`NC%+3H8XKIX1QSI*qQMdQDIpGLhEpjV%lmY1l+
-5fDcpH'C-jhq['[`3jSrETKXX9fHMKlcNER4riBTCqG'#)HTh9+c"*XN$@Cl+I(h
-)QjMblcphCF`KE5hCkEmEJ'dKrURKM#aIRB*N3e24C0KHQ)Tl$%Br@CYXcVBTrfS
-iNkeV5'3-b4AlqD@&QA@GlC-5"V-KqeISpU@)!9VF#TrPGVe3`$j(GLp+(M+%)bJ
-Kr&Sfl6c(iZ1Y!9iHNp3EPSIpCePFTPi6XLqMR56Ea[SbUjGDGG,V$qpI@A3Hj0j
-Cf4[JHkF,BhCr0'i62[6hH)6PrqmTD$jIpH[T![HreCf6"(cN`HmpTrP+(EbH[''
-!b&!IJmY(HX)"[R"cV$$bkT!!BFkfqZ%`*Q+HH1mQpFh)rJ@qePkBpb0ELS5`[Fq
-P*d'Lda$-8qj%Tj%SG+&FF'&0$-QD@&h34--"6@3i6E!+&5CN6k*#4QZTHTiUAUN
-T`YdPZGKX@*2jFEfX5HRlGNQ6`Y[fJLBRhkjk5j-GMr1P!HBl[3'Qm)HHJ"HPEDQ
-!T2NIX`%2j1DEYFhii,)JXp(b1Mbrp)q9Zl25JF%)$&*Jm!+$kJjf`(I`)SH&YIF
-)dciHP@*rMBUa4$IDcXH3!-q&V(Q`BSJadb$'CXSYUpXb)Mq,Xi0GD)T&6U4-SpF
-Ie6rLf`lAZj!!4!fm'%+q8%hL1133Cp,eVX%T8F2L###cAI$mL&00G&-%Cd*2iB%
-iCf`MfF-jf!FJ1%J4[MVRbX'20Z1CcLbH@N1)6)kDFS+SqQb1EX+TQJDrTfh#kJ*
-5aM-q0k+Q%VF[a'CXI#96N@%'546j5+F6eCZ`Y)TX2A,NUk)B-Ej,R0VL%(mE&PX
-rq-#p#2e$Mh`2m[mZZU6[&E)M(T+mmZ5*C[*Naii8P6'D6(cbha3TS[J5ABK&@0U
-BMc(1MV#HAk%1$dlX0f$d-%mhXhTHI(EKj`HhGF*SlVcm3"f0R8KeA4MGl##9e5F
-lJEb)E"IQpI`h[mJ1R[b#0H)%!d,9%Uh1GmIjmI'(P'YJ%XlMTk6lU'PlpV!H4Gr
-mYK0%M4LGSRTmK3Gb$BLAff+Tl2CbF&6Y![$@m5BA+)6!`8@ee[Q9(MN+4[41XU3
-cmMk'DQ'S6h&HI"C4IqZm$K%CM(`cNh-UZ['2M!%2")E[(Qeki1c3Sd5C@fSUeH@
-m*6B09&BcS)f1L@L#PQ*+KA6-TD%G95+1T&jmbi%QIa"&$XCA8%pjZ(#6lN3Mjf1
-EiJUFd@m[mhpEDRiY`BBack+-$RSC#LEPF![d"pU$S5L'jPlJNJjCi#!A!`%J-Ir
-FfDFJj'I2C[Bd0UCE2jZlIl&[h22GqrIq+,l2YIaTXma5M'Br@GG*k@i'TkPPB`@
-qB46N'fV8i#e-mqY#FQQhm,*pdPaSPhIj$G'iC,9Ub5XUlPrMUJ4eJF&a@NLbIaH
-iI1&RqABj*aPfCDA)c9$b&Q1&B+d6")mEj`"hp!LF[E!INQri$5f+0$%85TjqUk*
-%EUa+@q*c!aF,QlbR+TRT&K*AHmBm`H+'b@!Ybe[DD%JNC+YK,rT32-h-5[2H&`V
-q&@3lX4p3qFD#JN-be"TjPN2HL'*jq3e('@KA62r,S8m@)G*`Y9bQVCUKQ*,F46f
-P#De(dpG(,*GddTH@hAh9Cmq89@fhA6q[&HaSDHi-`A&rBc"SL*VAklaba4[#Y3N
-[eaKF#TAbf#jhZMBU6rSp`@$*6JDqIde3IqrP2-(&8*'2lGSHTLKVm%m-dEa@`90
-(@8HSq#r2kiERdSZ#C9dhN3qf5G9@i9,MEQj4F)61!R+`NF*EQ#T+d!MBVHi6(K1
-%BpVk5r4F!%DirSj!pl[YiQ83Vp(a)p)(#6++Y%mhNNJ2e#*CJ3JADBr0GlNJA$E
-L+aRZ3114C2lUKK@1Nj`-Cd`A*&$Smk@bIplmk&rjj*%N!V4E+8QIVZ9DXkIkqYr
--K5K(p'2[p%4qhlC$P5dE9Uqbd&iR9pd`'&Kc0*!!U["1F`I#QD4#UF6[J,+V(BC
-CFebM0LLP5'&(NU-8pp2f1U[GXf#3!0bTkLKeI+$XpBE#8R'ID@5dE+#fMGY9GNq
-ZYN`D+Xf6iI+JTG!R)B'`%6K'3j9)bMeQTe#4CN8`4!JVG%2hqIS((dfBili2!*!
-$'JB!J!#3!`-f,M!28h4eCQC*G#"648%J0Li`!*!$$JB!J!#3!`-f,M!$0Li`!*!
-$&3"8!'3!L`''!!%"!*!("%X!N!3B!$`!3!#`!CJ!!3%!N!F""`#3"J%L384$8J-
-!!iS08`UE*!"rKN@`h6Nj%l$&$Pe,6NmGf`%9!pZaqYJ-9[A12LLS@(eX`@kXkXE
-!2f0r925rrfq2mhC@'FEU!!ZC03eF9Shd`Bj'pkj6'Z`%Xr-S&0c&iM*#YY5j)-P
-c#j!!hfq#GS,Td84dcbPjXa2G[-RZ+i@%-ma,@ZUD8SSG#ciIQp0r"2"krMRUbY2
-UD[qIAfl(Ujrp3rrlNCBP!VJcDU1#E9E"5#Dm4DYXM&@eAPXqBTZhKHeK&AhF&mE
-5@NbNP,3#F4p-ISc$ekiEjSHQ'HT6frC0h3qk%'KDJ#F%b!#F!%bpqLd!rZS*!a&
-r!2#LFZ%#%"b#J!'#BQ!Y1)Z43BcI$%,N%MVLkQ15c,dSF4p-hh6j4F3VE-XB!*!
-$Gd&%3e)$!!#!$9-,@b!$!kCJ`kTUXc#`!5*LB$G,XGYCPD!JBX-HkYR!Q&8a#f-
-UZ[HR8k`+#iPMb,ELGpB!8LMpiEh!JNUia8#RBdJbMUrCpbBL$VrTa[llf*mk9dm
-STT%&(C'kJKQiSm8DVUKU*k42-JV[4Fi&!*!$6!!#!*!&#!!d!"S"'iJE8'aPBA0
-P)'PZFf9bG#"NDA0V)&i`)(GTG'Jk!*!'#`!,!#X!+k!#"%X!N!8G!$3!,3%BL!*
-H-3#3!cS!!3#3"6B!K`"+!-%%!Np,!*!&!J"&!#m"2iJCAM!JBA"`C@&bFb"dEb"
-LC5"NB@eKCf9N,NX!N!1U384$8J-!!,B0@`Y6-!0hFbeQ"Z`CdmT9aMFdilke99E
-'2fp2lp9kYqiprq)E'J!!m!d!!1Jf$3!!#l)Y'i'Pq!GfCr[jjDdYFp0@cGpCf*-
-4E6ZY!bFUCeRCbDlbH0Gh4)AJ8X4rJKJ8[N3-RI0#5DL'!59#J#kS$Yl9"F#6K4b
-J',6dJeNIl`L5Cd'q)0q+c@'mi[eVN`@PK4)VLVPbh1Hj`Y*8H1AaB3%!N!--!#J
-!+!"r!A!%Ve99!!!"!*!$J!!Ird!!)!)J!#)%N!!!*JR)!#)6j!!L)!)!)N!"!##
-(i)!K$r"!)K``)#3Cra!S'SS)-M++*#BbmM*10!Bj*QAd-K*P&#3)Cr`)"($!%!)
-ri#!"!B"!!)E!J!"!!3!!)!)!!"2N!!!*b!!!"*!!!!!#)!!!!8!!N!1!!*!(J!!
-Irm!!2rrJ!$rrm!!rrrJ!2rrm!$rrrJ!rrrm!2rrrJ$rrrm!rrrrJ2rrrm$rrrrJ
-rrrrm2rrrrRrrN!-rrrrq(rrrr!rrrrJ(rrr`!rrri!(rrm!!rrq!!(rr!!!rrJ!
-!(r`!!!ri!!!(m!!!!q!!!!(!!*!$J!#3"`%!"rrq!!J!J`!*J3+!#N)#3!L%!L!
-*#!)3#p!$q!JJ!!J)3!!)#)!!#!N!!!J+!!!)$!!!#!J!!!J)!IJ)#!2m#!J($!J
-)"Rr)#!DJL!J-S)J)$!')#!d"L!JCI3J)'8F)#"Rr#!JF-!J)$rJ)#!"J#!J"X!J
-)!!!)#!!!#!rrrrJ(rri!$rrr!!rrri!2rrr!$rrri!rrrr!2rrri$rrrq!rrrrJ
-2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ
-2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!!!!3!
-(rri!#!#$!!Z"!S!)3J*!#B3#)!K)!K!,N!!$q!JJ!!J)3!!)#)!!#!N!!!J+!!!
-)$!!!#!J!!!J)!IJ)#!2m#!J($!J)"Rr)#!DJL!J-S)J)$!')#!d"L!JCI3J)'8F
-)#"Rr#!JF-!J)$rJ)#!"J#!J"X!J)!!!)#!!!#!rrrrJ(rri!$rrr!!rrri!2rrr
-!$rrri!rrrr!2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrr
-i$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrr
-i$rrrq!rrrrJ2rrri$rrrq!!!!3!(rri!#!#$!!Z"!S!+3J*!#N3#)!T)!K!+8!2
-i##!!#!K!!!J)J!!)#3!!#!S!!!J-!!!)#!!!#!J"q!J)!r`)#!F-#!J'ImJ)"U#
-)#!bJL!J-!BJ)$3')#"Pp#!JC4`J)'Im)#"``#!J2q!J)!'!)#!'`#!J!!!J)!!!
-)$rrrq!IrrJ!2rrm!$rrrJ!rrrm!2rrrJ$rrrm!rrrrJ2rrri$rrrq!rrrrJ2rrr
-i$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrr
-i$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri$rrrq!rrrrJ2rrri!!!"!*!$J!!!!8!
-!!!)J!!!%N!!!!!R)!!!6j!!!)!)!!%!"!!#(i)!"$r"!!K``)!3Cra!)'SS)%M+
-+*#BbmM*10!Bj*QAd-K*P&#3)Cr`)"($!%!)ri#!"!B"!!)E!J!"!!3!!)!)!!"2
-N!!!*b!!!"*!!!!!#)!!!!8!!N!1!!*!(J!!!!F!!!!2J!!!(m!!!$rJ!!"rm!!!
-rrJ!!Irm!!2rrJ!(rrm!$rrrJ"rrrm!rrrrJIrrrm2rrrrRrrN!-rrrrq(rrrr!r
-rrrJ(rrr`!rrri!(rrm!!rrq!!(rr!!!rrJ!!(r`!!!ri!!!(m!!!!q!!!!(!!*!
-$J!#3#!G"8&"-!*!'"e0PCc)!!3#3"!G6C@Fc!!*r!*!$"e0PCdi!!rm!N!-(39"
-36!#3"KaKGA0d!*!$!8P$6L-!N!@%4P*&4J#3"B3!N!-d399c-J#3!`&*3diM!!-
-!N!1!!!%!J3!#!))!!`#$4P*&4J!$!*!$J!!"!)%!!J##!!-!J`#3!b!IU5!a16N
-`,6Ni)%&XB@4ND@iJ8hPcG'9YFb`J5@jM,J#3"eG"4%05!`!"!3e6!Yc@"T2hdNE
-0440Y!,6j0bkmfddECX*X[UX,hi6GX0[NhAE9eA9K!!NiTBMrG!Ak'M5Q0Klla*e
-Vf8k#LE$6%2V!XqJ!D*!!aElq",i'!!!%!*!4J3#3(S%!r`#3()%!9#[r!*!DJ3"
-8re3Vr`#3')%!92q3!e3Vr`#3&S%!92q3"93Vr`#3&)%!pID3!e6fN!3Vr`#3%S%
-!pID3"2MfN!8Vr`#3%)%!pIEfJC!'9[IfpL[r!*!1J3$ep[Eprj!'r&EfN!-Vr`#
-3$)%!pIEf9[prpj!%JIrhpT!%+rm!N!U"!2AfN!2mrIG@Ij!&Uj!$IrEf+rm!N!L
-"!&6fN!6rIrCr+Rm!N!089(p@+rC8+rm!N!D"!&6rpT!$9[riphmUI`#3!e48UrF
-Vp[p8+rm!N!5"!&6rrrD3!rcppeC8+P53"AqVprEfrrp8+rm!!)%!92q3!e6ip[p
-rpRmUN!989(prprK8rj!$92Mr!!$r+e6rrrEf9[rhphmUJC!%V&5V9[D3!rrr92M
-r!*!%rbY8rrEfr2hf9UXUJID3!i&rrrIfN!2r92Mr!*!'rbY8p[EprIG@Uk[rN!C
-rprD3!e6ir`#3#2mVp[C@rRrhN!6rJIH3"2D3!rIir`#3#[mVp[C@rIq3"S(fN!A
-hq2m!N!cr+rD3"[q"pj!$pT!$prMr!*!1rb[fN!2rrrMrrrMfN!2hq2m!N"$r+rD
-3!rIhq2H3!rEhq2m!N",r+rD3"&6fN!2hq2m!N"6r+e6rN!98q2m!N"Er+e6rN!0
-8q2m!N"Mr+e6r92Mr!*!DrbY8q2m!N"crq2m!N"lr!*!a3Ej"4%05!`#)P""9$@9
-9%3!K9Hj'RckIP9+A1THPQ3[p@HHXJkd919ilR0"ecjZZ,P[Y"Nk#VV#Y"GcclQX
--A$KHA-'"#b!1j!a($*R6`fd),X3[m6M2QjaRL1F40-C6ipFJAjmh-ES33mJFfrV
-qqr`qEAmG!b'AerIr14e@0K)4!J'3""%"N!-43Ji!A32IQ[Ej"hUL-`Km2d5"rJb
-ZdI4iYUQE[`3Tm6XAhiZ&e28rqjHmNSQ(K@lSkfQ#6r`iVi51%R'3!"ppNiMDBVV
-e&PPM2LpJ(+*"mm&3LHU40Ie0Ta2I!E(6NmKV1Sd&"12cP@QJ+GX')Y9EJeDr$H6
-H,`GrpKGRmP13!#bEXSf"1qIEaTUh[$@iaYbd'mYIm@8%bjemf8Q[*dT#jjHGTGF
-6*F&@[Y`*SR$2XV1Gr`B3[)iqlT-J)#BF!mrN18-Q*db"*XqIq-$d9ZHrJBj8$b*
-c9I013I3G00mrlfl2%H2BSK"2V[aQr(XLJ*m3IS+Y18,qdhm2IfTqeKB%XFVLV!J
-0LIqCqZ[NN!"M++XipJ#IGMNVq'*Ia'@Zre0pE#iIbXiNQ114SC&2Ba+$fJQ#RIM
-'!GA82c-"bfc"+$+J6QE-GGQH%Vl1l5")aN45M)YY`T4rCDT3TH)rIjhk+cA-f04
-IfF3j$*[aXfAd#Ne&V[$T8Iedj)V%bPk-l4X6hfMqFD3[fLH#H8,PN@r2lqBNJi0
-@pqIGL4`4AIQImFqaqFqaqFp&X11(k5,@e[)$GB"[2AT(3"d`@mceeeYLZT9(L*@
-rFMQMYKmqBGlUiUmUp-GEIrM%PDe(j4`8,PBaG9H$6N`HFKc+EC!!qr1l1q*%0'h
-YYpjL69*@L-TL(@Jkc3ET@%K,bNjT*8+Ta0chAIBL3ZcDBCmeU4edkBrm4iR3f81
-8(5LU1JkJXC(AY0Z",GUp@%D3!-QBE2[,'f+d'b4Jr)GXZ4,jimk$3im+-C9HAbM
-8cpIjYh3HK-S#%2[#D,IjrSdE6ldY2$!)Mcc3&(-QCGFq%-%lDdBrd"3Rlp8(*jU
-N!'8I"PX@-MqJFJ0Vl#C(elVC6UrXUXk3!0qXrNM1PM@b[rS8b2jq'c(081e*Q1r
-D,,#CSSebGZ)lIp`X[#!lKa,q@25H[Ce!m)r0)U6jkFYc9-mi%*3SNq61qEJX3iP
-5fer+bKaGJ3&RU&R&Yd(&F5QbFT,BJ$pkMJ6C$d4"`"Hq[*5,FpMPSG@fiFhr)"D
-KJN',eRi%H8ePa*Uh#2'5&M&XV3-&8hmBJZH9#,CQpr`'&F("MV5eAJUqL*41(T!
-!Ye"%5B'E)JT"'T%IQeS6D6,Z'e1TV-L!N!#4!G&CFk+l0Dr*+#IY6e*dQqqhLI4
-3jrD%L#AE!S,)fp(1Jkh#E(VrXrD!HHLpqZZ(c#D6UIkcZ8HPPf&(*V4(!LD6f@3
-IRi@QRYRPp&Nqf`3KYL!Yj*!!a,5*[c5EfJ-ThlMqk&f@KQFc[6A24N)[raKECdb
-GMkT8*4iL`eQ$P+dBX#'Uae4&&M'aa5qU"kT6cAR0KjYbQiUXL"b9LM)SQPZDEFe
-h)j2M[jSdeE1UCmPMaT5F9'6)&0kj1&%h5pM(UB+HY$Kpq!R&r'5FcA0L845jkTK
-2'QUc$1CEJf[bQMjX["HIDBdR1aGrZaJN[+MT,6$@)C0`ciPZBf!#i(Cec9-!YKY
-2I*UVqRVMT$aQ2b2,qNXG,V[I'+S('8qILIHTUc%#TYb-P&8b[5b2R8R2X)Fa"5S
-ar9hRiZ+06qeG+aV(q'IT8hY9UXE$TVc'[UIfLQLMUA2aVXe!r$Pc@NKJ-3F(c-J
-DbPY5KjqUcKNrZ-B@0beZRR[iZG#8,GlRHXV9I,dTVrNQ)SRJCbj8r%AR$2-e!hX
-RqU$NqDC&UNI`8if+HE2U4E"8dmqq-9Y&mkm03lqkqGGJDac)Dbj9,F*N)reSfGL
-3!0MB%#3*[d%%$Eemq!*q[Y#bIS'Ipl5XmpR3hrcV8r9pBPMB"TUIT!`9LiA!&@G
-SIq"8Yh*ML+VVejLE(cG1VA%eEm@f2h3%l5d6$cGrBE69aU$JBFFLeH010CN"-Zk
-Rc'NLp-CIJXK+ACF#a4QbNRCC+4X*3"G3++%XAh0HifMcaeDH05Q5c8p6&U*))ZT
-f96q9X0!,9202'l*F$-6r,MK*c)mX4C!!RSH#a!'5QR2%pUUjITZ`V4&HFhh0XED
-pILTGIA12a6E4UalpUpF5BZ02k9rT6qq`E$eL`f5Vf(L&rT9HZGkb&5$R(DrC!V2
-S3-KFVh0KiF2"bp[%aU[dVr6UcCDYafcZbJFI1AVcj8fSUZIfr6fUeEmI&#'EEfi
-["Vj`JMePK!+)DHXq#fAiQkYEN6f()YP4r9&lT!Y)cTpFLL[Rh5C#B`00(jVIfc(
-30-hmfI*MBelcHmZ2E3YSd6Lbp9K+mZBMK`HDlMCr(fac`IEDBEIjqmYIk`PXr)$
-qPAl`q*'YVmdk"P6kj-J03!bIXd#YE'i[Rr"aC2T(fq6)2TeSDDiHb1ECpiA9$XS
-1Skbli4S!GJ10NdkG,N,CeL)*iY9!I8PmQdMZfbD3!$d0%M)b5#R#'QqAXf1kpKE
-''#4'H3JjIdQ)$f0Yr[rPl(BcYYdKhfj3%,)NNi654&YNY,*kb-$-+&LX,848PKd
-`eb3+B1e"Dj!!MU!UQG&UTL@Kd(aX9T`ZX3AEiq8bAe8`[hBGc#F9c)G@CeBp3`E
-HG%CKjXr`c14F9A(car5aMUN+9B90c5KiJb,Bp%eT8UL&ZUN"L`$!d'rUK9('+*'
--@mRF35i'10l5,Tkf109'rh5,A8De@8'C0mlKRpmR3RBHr2CjLG#YfUrTMZ8EJp0
-4A"[GB'k$Se*)bM*Y&bQh)%[&4krYQkcVpRNCQS@%D[2(&2@b*US$0Ia@*jVS3Qf
-VNX3@ZSb"%pdaRRdEp5M93eQAD#KAQ2p"$NET'[G*QqfTN!!%8(D++2lTk'G0T2(
-m'P5JM9Pb8Q14A@XdMFBe!0XEdf2Ym4ia!X80Bc&P68*p&A,HiQ%dCR4L&-fjaF8
-k4,ID-E$N8AY#$MSpRdY9N6T@J8,%L*rcB*)eh36+0cV$)K"439&#6-5-+XYR+&,
-8j%E%La6D"Pb#TKki0$Q80mc"`(A@+-6'0&FQKqMkV2YJU(l$iA'C-Uj"dNrLF!8
-1Z0%mAIcSq9Q#60-q5ch3I(1+'P'NYJidPe,60H#I*D$%m92G8+UEXQaq8@@,+iB
-MXq+f)$+P&0RMFClj$NHPj*l!hX"6JmdhVHPV,ReU#!Ac`dY+8$$2j8Aa@Pi8#c&
-2HqhT$P`,T#MEIVV$FU,EZ9FDLP*8BL9mX2K4)l+$[$3"0ipLMSaKiV)YcT9Ilk!
-YUCe()i0ld%*3l3eMQeRTf1kPF@5Qj1pcdp%p)M)ifSe$CPZCZ4i!5V&#JAaVT-!
-d`4#Yi)LD'++$P4!GD%b`5cVCTGUT9cIDiPe#3TH3!,9j`jd-aX95TNDUYNPPY92
-2,@iZYEI-b'Yqh"iP!)"8f[a&p5qXAN,qd65+,+H(,X+959YFqF+q@AQ"P8c!r`T
--#0R4MA!dJN'*6E,$q%TY6''+kb4'Q*ZDf16EUcpkC9,)+2!3`#U+AmN@VEm!)Q*
-!%[$+AZ2aJeQL#i)5*+Kp09'mQ*e#F2%daGZcjAA1VR)%9h2"ZH*(@X'%+"-,jJi
-iThbT&%qQhDV2V1VKJCXUp3!82YBre2QmPCQVDMp9p64p)69VNhBkKZNJQql56MX
-`lC@QcaK%E-+dQddE4+c%Y)p0'd43"QD9)A!3H,[rCUNa$l*P)CBI[$8)%Q-KJ(e
-bij!!Df1ca,iK-F8"N!"d!1kl#akJkPFCE'A(8'N"XTl9,4&,EFpH!I!VLTm@%2L
-'*dS,(S"Sf6J&!NNV`#""!-mXiI6CJM&!(A*2`@BU9YA#$QF"6(AK5#'1m1-JMYP
--ZDTaIR#YiQ!,J%"CC3&"Ta9A%@Li!!GUHA9l'4YYIbHlS-54@e!#0p'Ya-,%,S#
-iC5$'e82NCH1lY6&Fm3NQUP$dp+LUT1-&+HDd!"TFqkEM5"djQNQ&#hc2!NdMlf3
-A&G+bqCZ1h+*#bPJ#-6-0lQ4MTXkqYUCE`&$d$VP[(3"j29"8P#F#VXrCDf4,(B#
-M@MB%lq@ZK-1S,2DL'BP2UfBJSUU+0T*j#,rGSh0S,YZf%EMe4&e+mSl,GeL3!&@
-q-qD4(CSk)XbMmDCr@AH(46H"V4AEm#2lRkL$`*hF[E!%"*'[k2V"51mJTNX)K'K
-#d5iRRHRYNBjAiG+QfJqRQbjF&4ZKCQ6$EF*VMh)(00AK6C[m-ArqPFM3p,kFV3i
-`1pY*(#'jVi`*QYTA"[8Be"FLTFaBT,)i@q#UjmU+iZ+kK1Ej3aNSb2)AU8SLK#C
-3"+'aZ!'99ij3hFX9d3%aHjZr"!0PB"pSb#dUbK&&j14CClKJHmQqRU,#jRRF841
-LUjqhp458K)%r343iU2lfX@UVFdEdLePaK4Rl*8FPU`5)4%h[aMQC),P&cF$XNLH
-*U'4D9!LRJE5!j*B)-NmJ6iJV"(M[mcCpJd"mS&9#6SRmCBbl)jEX#cC9Y'CENf!
-X-ZF@f[#cUENTZSM!-9@*[4eQmCUU+-q2a5998BikQZXHa%3&&ML5kq11L&i!4Sl
-)N!$KLZQZR1T)Ri6+FbkSl)!*&6Nf1V#NcMU`T-UFYPC0fk!U(f3m&cCpNk(U'He
-fmZ$PEM!YAR+9Q'j!-dbBhN"$626K`#JBeI6#e#3b!&`1,,PU(9JmM'Qr`m8V,[q
-"J$&MM@[*eA*H4qh#hF'Q2&b-,[!5`)j6('##Fk46*T!!&DpG$[%Q'NbIZTBm5S$
-)#6eL(SFE4-M,TlVT1)c8CFllGc34NkJBM4NA&rple4T-,,Nbi#Vd'TJ)A)2B'89
-4j9EY`VY!)5LhN!!UeH@G-pDqASNYl5Qm@,),Ri@0D9'%db8,R49SU'TL`R[#U&V
-M!JU,(kfC+&kV(J+BJ!+ZDkfDLMKclRB["cmY3(%D$F(Ba5[D-H(Pdmra+RAaSfS
-flHE6Y@cDRbED[B4Lp$`!eY0FK3QJGKlS8P3BL4'$df#f(!J3!`*bd`("Ab#Uk89
-d3(LAP'Lk8`H"fX#5NMFY"-`3H@+SY2$[MGlU(J4LEq%QU,+1M"""-qN3QQjl#kD
-Z5P1&a66Pp(i1!45`*dFMmVka8)#D$-5#CJ+Z`J8pKCY5iXXYdP804c6G18PM[!E
-6L%T#GC1dY@+0TPXK52#Q4f6SiFB$2&Y!e2E!FCj8dS*$T*`pq$Q+J`dF2"UfFc,
-bNNG4a0qd"UqA($$R)M##Q4#C+#hF4-!DSZbSRP43k-G29#)9G1f0jTRkQSXJDXS
-jc%NP82[AG**3!)dLC$'U'Q"1@@C#XcI01%N1fkhC01`mQ$G)`hBUe04b4+HqCP&
-KG,+U,GIP,B5,)+V%bAf%#-b()UpG*hE(pLUMc3&6ccQ(+UeflU+L&qE5F8YEVK#
-&d@Z3!-e4X!c6cee,bp-)'#ke!+$[!KP[LJP)bqmQ!k8,i-V@8h#&JSp,f*1FL-P
-I++r+rFVa,+U3!%A2SCK+A5TlDl"Skk(VV%)#k-T+p9&MHJYNU8ZN%Lm+ZQH'$5S
-*j$Tkl6&5-B,e(K3R4`RmjX%kD8q%[CLaXj1QPB%SB10&d&&LdNFTJYU*m+!@5*+
-DH!&3E!8J@V`&PmLpTB@M*kkJQ5A%HijHTmmdm2BV-@iB!&83hB6NfkpSZM(`*+#
-q1k!q9(5"e43iSN56U@JZ98+a&@e-&lkaVqd2hjM6cma3BqdTD,$f&-dXjiSjC,"
-@,fd+SQe`!+H'9BXqLR5#4a*DLhc,a+6,afD+0aX+*j!!mBTXF5TN81biZ!#*`2G
-Dji`Y(i,!*`cZJ0aCPS18aN"l4m"Arkc6(qd3UZ!KZm2Sae$Yk3MP4EfS[*ILilC
-[`ZZb8*CcQp'QCDkbVc4kLAQi)r#pD"$-&ILilI5k,($DMZb@Ya--L51G-rj3HU*
-E8J@2M)6Ne!c`N6GGj6M-+54h@dAe*ClC(1fFkdJ,AEdYB4X609m1*XaB!,$mj4b
-RQV+j!2b[VDlC"r)*$ZH!q!bc6TKM[Z#Vkj!!hJ9$p9EAT-Z8$`*diBj24!J*HKE
-GXeG9"2GPDNU[GCSF!&jbjAX)[!raUfch8-)L$0BPcV9L%"+Kf,MT!Mm5!M1U,8a
-l-Hh$)LK#H1Q0GSP3`*UE9(F&V"(AUbj4aS99q,Z%Geh#kAZ9K2UMDIY8SDXRTH&
-DG9GS*E)B[VF$"Ab$r1D2NDNkFFq%5$Uk3KG[ml4d"ECM$pq)J[KJ6`,aQemp,mV
-%,IHNKG5L`T%@h*AAKkXVF(c-j!5CZ9$Z[L%YQ5mm4RpYc0jk`hRih3hAPYP(hMJ
-[6J[E'hYl)rfhLh&M!+pppj`(IE%##MiJpbIJP(hiNrZU1ZmLNk"#9FU'SfAeBTi
-49`%AbbL)YM#94&fX(GPUXfaMpld-9m[Sl2P1Rf1qXb@fDkK%b(qFLma&BV0`Y`%
-eZ3aS2ZLF#rC)V(4rCXSC90ka[11Tjl()122l-rZaU#150KE,lFD$F!i3#rkI$*N
-@QfmlQB&&B14iHYCY@*MbmSJKN!#4FMb2&R9C@0&#X2pJ6%F6L'+M0hT"(%35X*E
-SKG"q!,lHL#[Q8hG&IhQ#-Y0M)0Pd"8jMZCXUB)Sb$"b)4'r!kZaLNEC*lRi'KHA
-AhVApX-FFGF8pcZ'SDjr(UFDRbeQ"U5ki6)KB"Dj0'Q%1aL#C-N3*+D*cak9'8#Y
-AjC,J@i05KI9#RGf()b,Qiqk$P&%q66)'-C``YhLFSZL1fF+qkq+2C6pHcZE'l#[
-cZ[eVi6,-c@-ic$cmC"i!MFV!AL@CBKk4D,UL2i[L4QF8Rf#HGp)P)9J88b*'M61
-j+q"rS3j*R6j!)"eZqN#1JfhTljD0M'!B4DBK9+2fQ&hU(cLX5%KAJBr2kAea,+D
-Z(SY&TH'b-4`C5`,&1%a&(pc4J*`QGlq"*U"SZB'Da3$ma!Kq2J8B1@iFUBj&ADT
-TpP#e)%2Ed53m-,3@jTU5e![!86q5`m!T!T0i13SMI2Qc@%McQIB#[j!!Ek!'Y`H
-#SQqm,&T0jm8fA0,M#0LpeD&BU$T)SZPeSJR14IFQT#X36&6eA%55SqJA`p@r!'X
-&XCciJ$-dF)B@cU#@YP$YY`rML[(UU,eLD$1FDdS46"D*D28Yle#L-8Pm"6mq,9`
-m2lkfdKA5*U2Bj+hdLJFk++KF&Sq#T@FePJVKiBcEZ&*kU[ZNJ*ZJJ%[4k89'V4r
-NrP)%C56HJ&R%Hp!-3f)cS9E([1V0)S$LYF5NCZbDjXGJ!0j%(BTP2mr33l(#!,M
-Rb4@NZCU8DVT9MMX6P)PSmm"phHmFRZdk#8H-b3QR6qfjUckf5kf1Z+Tlp%8)%,l
-E'S4ENeVe1"VDGpG1c4)J*d6K[,q9*`C"4T+0SS`hb"6QG$F19DJHI`I-UUdBq&@
-&A-![9M1F+QX3E-1UH@"V8Eh!$hk&aZb#(p(Khh#RM@SFVM+1%0Q!VXAeMr"V2GT
-Ve4XQV$CjAD*35BYhb+PZ(T&"39KiJDZ"Lq-L8',CGG`*84+*-X$Z'D#,Q[L'Ak4
-$r08Y5(cJa58M)**jf$8Y#S5R1-*UIN98p4AIV%qr@DMi"BlLX"C&+4PEe6YdD"i
-rp!+rdS$FfYA9[!VfL3eL0kh'I[Fla,+9)YJBUSeTJhqhhS$i*VGbC6h!)i%ENl'
--E9*Y)dGe5MK%L45N6@mZGp-2)D%UC3-N3BLV!!Qc4Cr`,ZVbLEaC9-6H15JPpfS
-DN4*HPA`K*IILT%Xhb'IViT3Y-@+,NpNL!G#F[5VP+dUUL!E@#l2LpLJ4(fLi26%
-V$QFNIh4)p4-3PDqFNT,&PC*V**TH0i-jR61AkM-iT+`L93L[6K-lA3$@cCJ!)[+
-kkP0@*)@M#j[I(`2aY[RY@I(S)Y5Q)9@aIBSIJ6L@+'&f9ca@SCr%PRCe!4elD"B
-)L$Im*4Qcq@JV!$$6`S,J3d6ii!NiT%3RkM"PGB3Tke0*@BmZCmU+5JTTqK3JIEe
-H2DCh*H88cPFUTm3(e)G8Il+hD"RISUCmi5HN02Z"F'9YEm"KHhR++VJ@VpS-bYS
-1!ACN1M6rE0AUfEi`A$f2AK1Z(JR`0TJV,aBj+DRNG6J#m!b-BmBGU@I58i58r*!
-!#Qdb4mR4,$,a`Udm5Gf),6!j!FFap5rpI#)T6GLh'!-+8V%K%GcN8R@NGjBl1L3
-#@A4JE,p`p1CX5K1YNhpkIr3+-Jf*M&[$QqdmDdPZ&$iXTV"!SQBN%P0IB`'jVMG
-['S(UiiVQ3p4$f648S"m3)e0GlNeH4ep1*,T*p-M#2UKfei3LSX@5&QK[ZhCQj&+
-XeGEAkRpeL8T9*dCZ30k6@ac2M1*ci+62H`15iiR)T8JI+TCEGhM0Rmffj-c&pEj
-*8qiLZYKMdermHEFjlh@3!%!QqdFcNF93MkV%CeVmHNPX%e3km(S*A,X3m92hbR&
-lLc3P%H0q-4HJM9UD`X%518l(H,0paqM[ZH1DPYMZ`#YNCc(Q(hVNZ2EJ6$P1%3I
-(0BQ`9dY*$PPfP4V0UDRpd[&@kBL9CcQ@E)@B&PhFAY'qU'4ckk+5Kl!jN!#Rj#L
-)9#"$PY35)`K266`Lf[3'b9r4L`k@f40Y4q(8ZNK9[$m3FfMCm[jp)@Ic-MDEJUf
-e-P["ii`YD@"6"`d*'C(5%4XNm0iSSNIhi6pl0(U%,bJ4kXVSdG(Hr&'Dc-JjFja
-2*Ke(l6l(%53L$HLc!8a1kjJp*bY$#PCIHp'4r@Bp*C2hpj!!Fm[ZcqS$I3**3lR
-KAq`I1Q@Hf0dlf0rC0pMGeYFEi5krA-MaV!YRQ*!!f+U%[-5%6,6e6daqCk*ciUa
-H$!8LJ&&HYR#cKBm[cNZ"c#M3U855[DTJVcVCK)DbaSNdM+Jm,b)`!TZ8(5qL%j[
-&FM4pfSeZq8CUCYSZ8XA#QMkSH1VkKb+6Sa1485&'2%-TQFI6-qA8R&cl"HI"P12
-Tm(#@MjpC5QJ@@FZ`A9iJq,BKLDYhcl4Bb(5@XZFJ-0U$#SM!UGHi`'i0hpT9UU6
-JPP'5Z'C($9aU5e$C3e@U,b3!iaddDe@0))rPJM@E-MX1@bKa1JQ8a&hH$AAeN!0
-(*M@p3lcB89faPN&X4CMB@Llf%lVZ"'88,1$J9"-AI9N[qR$FILm$C@TTm3B+@K&
-#9(P9ME[V%b$`6aKR`qPmpfF@0"Mf"')fFX8Y'X&Qfk@Y8c#&b%[iZ@+-0Mer1,k
-lhY+MZJ4h`S!cY#I`cPR4dX-ViXF,U4$pk@$h+4K-IeX[4aeCmf8F+03M,dZ&NrT
-%hG"[4F6i$5Q+10SPHQ8MDc2lcHrhPDR,l$el!h5%6%0LfZH6Q)VZ)l9e)+["''J
-ij,c*FBL1r1JX9ACL)d-)P4hbSbFkpIE,Lh"Z1"@d-ISaC"kS%`2C%[!LE38")%,
-'2p6G1GKr9VZPqmch"kJ3pj1U#Pq(UPCDaiMqEB8E@+DGK&UMjLb"KKfT+kB$@4K
-*ekQDkja41JG4-QabSMSUP0M`iVl1'EYf(Bj$PG'f[kJYK!*)5(1[dZdDj1FSd&F
-Y3kBF[ji5Lqi421K4`ZX@%%dd&2J3+G-FVr%A+aep6hq'TY18Sfrh6%I)@G%HII-
-IhJmH$99QHj-1$L0TUMU*aQYp!00qq!"9%*YT8-rih1#pR0(dPXhh@5(FI0,*@E'
-JSLG1bB8GV`(iqF)dD(+$XEl&,BPbfRLNYKL1B-2,F1b"NEJd5DjY3h$[P@qdAB5
-JQ@Sh06paB4G38$Yhm'Kr"K&qM#+m4pKP554ca5"KmdELA%`Th2SJ4K,"0j!!3&"
-j#"Q"8,kULG3%TYG42-$`%YH3!1%G#+MGGPm2("B,lX8@e0`i@L6"&A8pFDlDebJ
-VieB3Y!E18SF4kQ*Q*!!ljm0)c[CfpNBQfLVE#NAA,KL,4erTla'1E8)MUGiqpXk
-NDYI!E35dF""S&i#9ph[LpK'j691A3&F*qU,V"d5BFTZf#Cq%b!mN405SI#hk!Qd
-K&8!S,IS(2kq%JZ$0""5'0U1hr-*`13lhp3j1R'SET@1G%pr"dH'TrYcdc*6Fc(4
-C!k216-R-6Fdm``@U#3bf6-,P%Mr*Q*Ub3*&S)2S1%Gk5-DmTe`$JApEd4VicfMd
-i53X&3Q5XF$5F4S8HL$6#82KG'M,h$YhHhcRChbF&0lL!"F@i90$l6@6U&CrJq*[
-e+D(CY2JX2I##lmfC-d1m!"1aEF6#,aKR!4hZXVGNmDMd5bT%!KXTbM1Kb"B8&r@
-'3(pTX$Xbe'Y!30U`8c)-J'39,k+3!+KJ5&IS1dri10,EeMXa'AE35NPAr46PZqY
-jK4KeC)P1*cQ"G6E2-f'!50ASX[8EEqZ'J-&Z6@mRhhLaqIj[N!$C*%H!J'3kZqX
-GlMHTS*C-b+p'9UipY1H[21LK5Z(ZCA!c3l&5JHD$'i&'BiX6k2l-Nf0aJ&*[5d(
-)q+F'+#,PaYQ[FA'jDVFf3[faQ)RF9Nk(Ll2bLN,kG-liPHL++em$#'JSlrU#1pM
-eGZAe3$IkGi1Lm`HpU-+h#EHYc1Y5IHMdIFm&9eNTBSiMBY!jKAU,AX&8BCYkcrC
-h5X'UK%F(LZb#"UVbpG9'dC8ICDZf8l@S0kGM10MEfFH2&9&5*4iB66e&aGYH4DF
-G&J+XM5SCf9dk&aIUNDUlSYp#H&92r-ek5YMP!0$"LdJ*26X[%"H*+9lF8Q)EC1`
-8&40`ER)4JF4FEa9bR%KeY6fF'4HqqCRMf0-cF5bk1k`)4Y5p#1@JQ8*A)E1JXhQ
-q39PiI3b)3I%4$9h5*1Zb$DrPU&f,%LU9Y`L-r2A'MVM4fh!S4hU9J9H(CIIR&Qa
-fP+VG4!e(SYla%NFrmFP,@Al1HM)@f[DU2*9[X8T1B$lp&[CjQqF$)2C5Kba-56f
-NS-)RSIaLA1$Y3IBqSQ`F4C+qD*a#aFZ,aP'U`)3q+,1+%de!1AjRSUG1paZ6%mk
-c-Y[Z-,pJLLG3)L5QN!#9DZq*4eqM6GURV&0d%!639JNiP#el"#lfk#Y0A!cb6)h
-KB[-%A$&B88b!#,pq$bN1bZIJf%iH"FZNLaQSmc88a5MkB9C4A(CKT@8m$VD4F15
-NMQq3!!9fE`qpAXQC1hJbjCd5NXUYJ8AQ,"p9hL)6iqQ*@k0aRjU1RQ2Sp("8pR6
-3"D%HYdc4pKU20VL8kPA"&,$4S!!pf+,8!)'b62fNZ&'eZ[i6FR#-@!i,+k(M*j!
-!eQ#f0,aVS9ka9%em205Yq4c8`[l1XpfR4V8UT3!e"IFJYHQX[)l!",[1m4)9+hE
-CFHKT@RLX"($"YHUhJ`PdQ2AdNGRm"6IrXrD)V[I'2c+'pQea8L"3p"P3i9%p$1H
-4d'i5[c*KTQjZCVpm,`QRkL#k3fhql*-MA+Mhm*MU,-5L1bj*&#G'kXJa19bN0$R
-h-NcJ'3j))1X&"3JjT$mM05J#02'KB5*%%c--%d'DD$4-H'PL(KH1ETk3!'cXQH@
-ADij`FTAP(4j*(N8NA6V9UCNBZVfhFc6bZ9kChb"PUSNF8iibUm+9HAm*8fC9Q$,
-lp-UmrkB15CRq5XVdVe+CIP,QM("P$NU#H#0LG9@bb@hLjXY@(kN4jM9S-#m$mcX
-F-2GX-3$QP`FR*NF48TN@p*8pUB&AR5Bb+jIk9G0%bp4X9fkDIP!c-3DJIdm!%e-
-0Cr-L)#bie2I%i-i)pa`"iS83&9Mm&j))qVb!0`jE1-XQibTBE2''E+TqN!"Xlfa
-XQ56kDDRD*N#VAKm-V[C2ST(GLfUqZh2h"!2*898(rDbELLJ9,ccbfKd,HH5Y4-&
-2Lf%HH5LL(cK-N6Il@,DK+[G3B@2P$4XL#k"`VC8+$KDmk`fQFe8UhVicS6%SVNK
-[2Vbc$&4[KG3`5+cMKBA(ZJj94b'T,laUBSLf-%56U+B+&H"&PQR`J1#)Z9PPHpU
-4EGr0`6!A-VD'2h%p6Ff#,TVbSb%[IX%V54f4,ZP+HX%#9RX,YSbA%K!h1)lM1MF
-h(`5@QbbaqDb*8H%B$+pSl91X`15Gh8R0m*kiT"DY-8%YI`Ze-*hdpdiDi&K%cdi
-di8Q)'SN-4r9%4@6)l`H`,8Z[8'JA@lA03$H+G*T#mISmVTV50QkMN[TaNH%'IpP
-hMKZ0&h+GG"8c""5a1JX459+0ZHP5!Epe$-UMcBa4X5`"8XBhQMTd[h%XY+-#YJK
-,)+B$!bq-ZA-4XK@E1RV3"4G%64Rp64eN%YX%#CI!Ih@pJT`aa-JCHS18'VNN#Nd
-K5C3%*KP%m@V&0m!ER33#-d,'N!#@N!#KVl#MK$MN,%HP[A+e5VX(9G'SeFp!X"+
-JA+(I#*Ul(USH8@&03Cea"I,DLJ9A-Yb9))*M)5@!)J"!CHZ*aj*5d#Ne8M9*SJD
-d6@8'jNPBkaXB&HK!%T&,5kYDhm$(*Rbm8Gj"cIbB"'`SA!Irm%"imaq!4$P01Rj
-"#bl3m3YDV'U3!1RTTd*a89+XC"F0aeC+6FV+E($mf%3-KUENGrZ(9Y#5C0G'FHd
-i[cCU9@X0*FLZ8XGD*)+B*2jA965T9c2)F1@d$eFTH0d+"#p5#JD`X9VENBP0DX8
-QZC,mR!cLCQ)VQ0KNR)[pQTSQpH!qM)*"qdbB4kY`$dI4!%"*JYA#a`52-i9l+V2
-KNL*L-!#S2b@&-rL8A65&LeVj492m)Z8P8G(+,[(%+J'$dJ9IIi4HKJ'LPH'`pEY
-SC08AlC`HIY%(fSdB`$h@c+jaH[JeIPa$48'5LBl'+[40U'GQdi38N!!1p3raeK)
-6S0B')l99L5)bmCQJ+4D-&1L9A+8AKL,cirkKX"*c[93`[QS92&S4VS+&r*,95[r
-eZfaUeCF9bq'AIFc9EDKr@E)6'lV!S%3a&G6!h#r5a!(K1*YM(hmekK2rFp+2K0e
-$NDTB"-1j'He`k!J4Q,DfI3S*11a45[Jp@M8kG%!9Xd@Z4+T',id1aBJYb0N%CkZ
-3!"+)lklD6BaqBYapDII3p,0j"(Dfb&8f0c+c&!P'9YV'&%JG%2Z&c4hTE4M-%[i
-&(M4re9i[GpVPLC!!rZHNm+ITNb'"FPF4'!pd",S#Ji(4`-Q!-E!RF$N`,p!8Q"j
-i2h"(B'1J0&!B5SBmSIE3TT!!+D3*h4[+#Kd)eB@q#VdBQKfU$pd4fKJU$48'Nm(
-aB%H`+cJB(!hDJqR"Sm'&`GTJ3h"QF'j`Dh#R0q49Ha2H6Gj"lkMAlNhh([A@H"G
-iArI1m-laAZ[Gl0hPpVY(h$Vh,,IC[GZGi8ja@paAhBqi&lRVhAHiRh6[m[Pp`ck
-GEjD[clIEGpjh`(ICYm$Ai*[TQq[EkYYCjLZE+NZ8fFS1Pl@9R5ilAlDrV+TXH9P
-efHbbqV*TC6HAh9Hfbarb9rK(r1hq(Il$ISGrYrrN9+(i"ra8M6iE%f9f0Mc%KrP
-Xq"SI1YM`Th`iaSBAqE#($ErL3jN0(q($&MDmN`qpE&K03pmZ0UcP`meXq#)IhX5
-'Ar,Kh@ciVhci"4ZqaBF0E0M-Kl9Xf-5(#pQ`N3q2XH%52NaM`m9mH)i0AqI$%fb
-iL!mlfI"Y2R5aiFriF!FErT)2@pP`0Km1Xq%,I1KR`qNdG*H`iIrQ`iIBF!BI2Xk
-'rmD(FpR`2rK`*KYq`SF[B,N92aC5kQkD)J838`0R@-L'A-AZBfc)PHT1Bd1Z4[F
-jKDKD,LUI-8J)k`hJ0h`iaPjb"EPlf*!!4i&ECU+UY+)U'!0AK&Z`)BmLlc1-rDI
-k,AJhXUZ1FBBlf(!q(ll2f1[`Xi#ccfELH(4iAe5)Hj%c,&G-r5ZIXV!Mh*Lm+@c
-))m+ESEMJ+'H2++BZmLQABZS$2N8+q!NTM`Z4&3a,1)0H!G`-[AS&m-J1NJ+QkC8
-AI**YGaNIAXZ'cr(K((E`(rP`"K[bJ"9mR3fjq3BA+&#B4bJ%,f2j(Rk@FiBp#UA
-8FBBXaC&MI1Sd%mN$5l#0$EN4"JmVM'8CCpr''(M!$UjNL(1&"09Xq#`IKYM`EfN
-BfSRP2qX4#ch!KLrai6@+DekLDd,[+DB@mLPP!(L%6p8UTVl&TfS88r2je"l&e(r
-bU5b'eXrjeIFbKZrLj`TRD'--A2QK``a4(M%K'f-r3NE2f8N"Ib$ceaYe++UimYp
-S+P#LQ*V"TcDcBa5C4rM8YBSTESk"paA(lZ46qJ$!83qmU'$J84pBVTML35CJ88`
-em+PFYVfMA%L-$Dr`BB30Mr"K(aYHiX0CE&M(KcSfr*J24pM`+Kp'fI!$'SSL0Vc
--Ke[BN!"(1dH0KJ[jm(UQJLp*qB5Xd"H!h'6%#f`iM`qAXH%hqA!q'riR(k+,'[%
-q+bMfB[&2V)JaXJ&99aP-Q963jl-A92#dX3'*FV%"AEQ*(5"$d,%Ahm*JR!d)%68
-E8$AURASrmQcNNJ5Fj)P[fcNimb`Pl#@ATE#%dj58+N5*N!#mGNU%b!'BQ4b!ZH@
-Nm,CTNe'2`h0L0(JqZ-"VN[i&Cr2&L,F("cY%J"qYjNIMk"6['Zh4k@+"-!Z0Q)B
-H1kH*h5*GR"HA4D0i%F16BLD5)4c!FTV)&FI%#6&(I),"FY(!*kH*qF0MiNj5,"D
-e@"c&iX[B!AaHM+AMXbb@Ldp6l$`qcE'6q#b*RF$RpGKZI(i@dq$c3Xb"crq1pH(
-c(l($q(`5km+R2VB$RmpLfr#C'@[(jrXa'CmjX4&m2Sa0i9-BUm#R11E(jl%B[+c
-95%,T0LXf,B&lqdk+N!"1#qiY#m`&@2FkYP`(YqfD`-eLIZ$$`,@"RB'YJFf"dY"
-+84hb"8T##&LL+E3b8!2!,aTU%3fKP4KD4,ei$UUi4X`9'`2ca@C4,,B!K23(21K
-c5!lS`'3,Z!"-QJ2j!8hJZ8"ei(`J"U!bM3[i!XM#!6``$iXM&$La1)S&+C'##5Q
-a#JY5ib%X8V!iKX8j,&l$JY4BKm9T,(j+J41,+eL3!"S[B@(#!Pd-"TCLm6%@T-D
-V@(4Jm3%@#5aU+("LF4',&Lb@Bj(%iL8X3PJX4'5@B2'h@$b$a9GBh)I&GbP`BM%
-ILjZ`3*HEiJiXjQ(a)4EIT-#*a50Bc-$L@eM-aQ)"&SeBr!D,@LcH`S)8X!J,8X$
-Ec)LqB%EdMpb)rSNEdGhFL2k&'p'eh)LZi8Ed"$HL"lJ4hFq0D$-hSYpb)lU2'p'
-[Z4%pa)hSB@j%TGb)rX#0k&IFL*lK4[3eEN3lp8B8p#,Kb-rJeZj6MiQ[5blVS5d
-+`eVZV+!1"[MJ&5HDpcJqMB[k#4GeSej8D!C%,@HLhQHLPLP%(A-Q)-V-"lIb35Y
-qf[(6JamNY(,+-4Y%lZ,Eq$EIaU0m'b9m'p[j0JVij8AmFTAfmX1i[*PGrZrXmJj
--@YMN[l(*BIj"JNeNDD1i#AQ(@j!!I'BV%MK9SkYUS2VB*Bjb#)QmJS5Uj58Nd1U
-BT)H2G(a1ReQ6KXrS+ITi*JdI-df*'Mk`d8GFTQ0LkmX@cYccXS@rp%XIVS`2UGX
-h@JCA1M2iBL-jUI'$,dS(4"@1TqN(H0AfXZ9l&QF+&r"rRI[j`Z2X`DZPB$T-%lF
-m!@Bbm(USUTSCkVmb3feNKVUB'@S$-p6Cc&"rb3ae1M28Rh0$IBiEkJaZU2r!$I@
-IZD'qa`heapa3jh*$[BXEkKhF82r)$I9kEUKriSEkhcb+Eq*4I$12i[r,ShJMMq+
-Y2)Vr&irL*eN8Rd!drF'ZU4a*d@H&H2fSFaYI(('ZT-@ArqK-dU+f'TRH(JMC`XA
-qPBYpR)[p#a2ViadK#8AA*8K-car")T%+3#B3+hNh&P&lP,Nh8I)%'h9h)KdT1%E
-1Rkh-%B3bHJE1`39prM[Ri)lq#"*demU1fV*CP1&lEI5FU3mGYIQ-dkJB3GFpIHL
-iai6N-4hLX-l#&chY&NVUMXl0(d&LH$KH&ab$!pJbkQJk*&502&(kE"Tk"AFb2eB
-GJ[#dD+jj69()RR,GKh&06j'hVFF[#ZECFJYU%rl4)qPVRfMQ5G1e)TeH*0&[4`,
-'BqCkUPM-DjcHrG0L,DrN&L`50YfLJZRYL`TQNaUT1YHlU&*@T%HQa`P9)bF!b4Q
-I48,0HEN*U2&DC!+3!(-SUEF)"*!!(c@Kql&BK4cmed3V%T!!bF%lXC!!(IU%D3`
-dN!"FaTV`+SN%b'V6ZjbiJfj[H')U2#DM9G&C3p6[3E3K%pc[[$I"ZQf)H9[HT`l
-[d&P--,&fTX@q"3kZKekYbKI'H2dKqdkmfS%Z*,ebk,'k+SXF-VY-,LckGIdhrV-
-ZqX[h-kENQH(rIRChjN-J80X-"L12j5Lkkd*d*+Q,-(SJMEkM,@h(6jZPlLU3!$L
-eG3+G[lhUDUh$`-m(4e[Vd(e60!FGVP$RL0qZbqq@(HM@"4ePmBRcqGfa)QR$hmV
-1cNM2cRjjachSi1Z'HdiHcmM16%[00**riq"qUI0@l9@H$48rAbRqlm)N#dQBP1#
-%NTp`pY49XUGe([c2"mmI,iGTL,Jidil1J`Z86*8fa6R&kJTXkIcG&"Lq4EVVH&C
-@6LUl4N+UTBpB`e(AXJj*DYChH!)N9Nimr*2@eMTNa5$KkhB0SA+L1mG23`N9C8G
-+G)J6)SRC,"hPRC(id6&%Gf9@5Ibd"9VaYJd3Vj11AUIidGpCr1KeLrqAKr6L#m4
-kL-HV`Q,T'1qS"4dTj+p)p(iQHNC"G,e%cbJi,"d,&dS&"K,lI53DRCl%4f+C(+K
-T&VA26iKDZ4p1K5ZI0iX&Ub(3!9'LYBiqB'V&JpQQT'f@A,0LC1"iV#G",bkC5iH
-PC*jk-66%G9155bm81m+c9TY%,9XXSm@Yj*VA5%Y#MaeD`!p4eh%@L4fCY,LQm$b
-5ha44`FXQDr&`U`9iI09)*cSdJlYUNB,Cb+Xjmr0JNkjLD0qREkJj1U#NT+04e0U
-p*Jcia"5kJe`3D43,IU44U5BEH40T2TK'l0a35MEQ8a,a'L-p6'@RqC`@V8*pKe[
-i88%)8*T&+"8b*U0ML*ccNFcN4ZHJj%iVPZAMmA&)[1N`DhL'lq)5**AIAXHFlKq
-#@9SdB%'QF!6+jae@5Sb2&U25@%N2DQ&GJ,&U(dlL'A*Q5NT1LR`K9qj05aqmN!#
-9fCpV2*JqQBkAH8ZA%S[Z)b(H3#Q`G+QfA(VMM9l$ZVpE-G*Qe$$e)8Q1fUE[XUq
-Gh"q3!"#JA&AZS+lIfcY%lA5`C2'1i%QjLGZT8N(@2Mjh3G'dZ#JTHKPAG!ZkQ&[
-(PEfCG6@a(0dG),%[G6!JMT)JKH*,p"d2@YFTe&kb!V8r4*Qe61epA1fl&'VIaGf
-I$@V29kKpPelYX[3302m'+$cer2'8MQhbQ3X(-V262pSJjDX++9Q3!*4"*P0hb$9
-`j4l(`qjQ5JNEYTIQ5mK59b&'RR!+L+efaDNcQ5P+b5a,5-d69fNcNpCKmkjf$L3
-k4eT[id8$3"d1V%5Y3CiS#KRXFP#[!!P3BQ,SH&Hl-+UQ8aFV(6mD8UQBN!#9*)3
-#"R8jT4Fc61El,*P[Q%#!)@'C@`D8d,N$)F&8iGHVSZ3j548P6c*9Y1K9)623GRh
-8`5lfKfeL"cT`iLL[GQNIZp6i0lR8%!88N!#BXUBqlqE1q3U9YmGKqQU1S"4*-EV
-+S$3)5L1R3%PPmTX*6H)#XJ%[+V[,Sm*E2m%l[Z9*KJcGjQQVJRCd,1JPTbKdM4X
-eRq-GF)p6*8#AVU"+UR5"SBS5J`k4hffA"X2jh5K3ND3H`%cSiTc`lKKjN8+2A[A
-+P"JqJ%FlqT9Gr['XiLEK*cIPmUV2Re6VUdmaFYh9*`lei0$*eMT5KZaJ(Bfh5L+
-qI[Nk0U`A-X*958@9Ile"M4QL48+h%T!!)@A2Ca&D8MA+A!2p$,QNS4"Q+TmK6NG
-JTPEUc,D'$*&9aBU-BG&",bSIecIrC,rk4MXHdUKm)@Z83b2Fia`HHiPbdUU'`%e
---"VrqJB"KP1a+!G5&dXJU[kBi3&l*##r,Rc6US8V8&5&DAQiNK69d'D&DQ"Bj9r
--,QJ2QeMmlIQ'aeF+E9*(rM#Tq@5Z6RpN#44aHf`3lV0TP%`'R6`qd'SQJaMSTSS
-'"N[UYr(UD59RiP1&#bR!8XFbhcBbK0+S)6JZ`KU#84b"%J2(U$')kLR+#ccDFY+
-`AIk!6fhAZ+d[@9m&`eId`,2q8TiSjcB#*TN+1U8!Ji++"9i@F0X"b%AP&KkFef#
-6(GaX$["Z9R9KL%P"f,)LNbAhLYDD&88(SMKB[iJRqr2[2V,F)JF86&%bjjBD*AM
-+NdPMdbPb`j&-Efe2$&e%1T1*Y5hA6&VX*BN*Z6r-*-p,P4S[T0GT8B-+9FG))@G
-,q3X+,N`KUX2P+d3ec"9#fapAGSj)#'N(%26E1KkSp+CGSVq@NSDU@JbA%ZL"4&%
-E+6$S,bqD@IlP4I2SFR2H6li[48249M*[UA2jpZ`rIc%FMVCSU)bfQ+j%@m4@B%+
-E'0V[-q0T+3pYI66[U&'UFDj&UFBrUe&a*YrE5+,i%0!XfER0-2Mk[BE"eeC@,[,
-RUX1+I)"d8T(rKhRAU9ab[TY')U6L@9%!QDqVU'D&XD',fM595Z'ZYVK%T`@Qd,5
-"mp494A(H&4BBG&j[dS)0KK@TdX9PkXV&G1%AUdfp[YV822f8e)Qc%[3U-CGAeFj
-0eeHek#CY[DZp4mHPSkY(1"jBS$B8b4)"XTfk+@fCAT84D[HL`kSCfapT&hL-ZRI
-kSIcZM!J9`qhRb196$KU-GAZASVKE*aRXpU[DJ,41B[ZfjT8Ki586MQRdKA4XF2U
-K9*0Z0C%P$bK%XZ*cqjK@*!ZBZiVd)T8*h282Q99@0P*h@3d!JM*p!),3M'49$#r
-1YKpY9e3b8L@arD61,%G45E6`LJ-A8N96XSXB#CKbd'2'"kPc4`Vm*6BC(3+LmF+
-,$5Vb`AbjI6Q[U'4qe6VTXUrI9dj9GEZb5T!!*@3"FSdU3#jPmBdQA,r5c)%%J3B
-Y"**)"U6D'#B1REj80VqLDa@ZB,`l-A*2KaYB)%diMZ@-@j--R29dAU31c*bK+mp
-HqfbNkVPMH8r+F#AcTPAZYS"AG'Y`B%DJ4#Gd!+TEfcUQfYdcUM6G*p&ek,A,TeH
-P&ZZ#mjGc9R4a,,',p[EN9kMiRhb@QTm')&S13RfHm+i,T-HJpJ"Fl5KVki&,Eh5
-E@pH"VUDKp[R(5$N05(L988&Jr9G)b04@CJ2ap+Y$FXXTG*rif1*YlZR(6UkmpPP
-%NjGG&HfmQ2$L-6hS8)k-2(8VM#U+4jZV$3mc03$+h)M819%*p!$b#8hhrX"lMB,
-qH)(SeMS8j@3HDMQX)h0pKff8H!2'9a9qIEX!dF-[0AcXJe*LeLdqeP3qcj[+KBU
-Q-LGe+*V+'BUQFU'fU4b8b"-6$pmiLQiSE1Jh#@TkV2PCS+S"JXrK"eh5THP*j4H
-Sj5cEdBD@-h-ccXJ(Fc26M*QTkCNC@ErI8*)&+l+J%1Vb%-TdmD'kl4b'ILZ[SLD
-TLJS$ZhM9j8Id460mY%6(TceDm-0!XKhQK(XG&ArjBF9I1#"U%,Y2DY)45D)kV)K
-B*&8GIr-VT+-mbk#&AkF21[l1LbFU&lPrYQX9'hYZa9G3pfSdV+p40Yr+Qjaiq(U
-ASB)0UqBI,YQS''a@$+k4M[jT,2bSSH)ZILKFe(DK'2J9!ip#E$%*L'ZVld"22Rp
-XIQ!@,F+VG#6Ii#Vm"C&iGi#)e@VR#IG4B1r!NEi6hAKUqMhiS@%&Ef3N%'M1)@J
-PH0"#iJY4cB*5Kjk8)+Rj3XkCl*2(cf6+pZ-AXN"`)N*6DPEQmC69!`5Id"pBZT5
-G#!m3(!bk[M5miIZVE9+&rX$#p3'$(TK$)XTVT2l+AVQCL53i1l346SQ8m4!i*1$
-h(l@S!q@pQ+Pi`36FS`Aqq4BS5Z)`8p8L20Da%!mD$b0q-c,bMR#8$D!ADe#dVJE
-B1%!m$2'QE3SR@@cE0bB,l@3Rl`Te"MTiFe(Q(FLE5)U%!M5%)V!DA@hQVNKPP%A
-*(hc(0fF,fa`5T@QlT@(G2&"$i9Sb-'+)Nr*Q&+($&8-3d3G@8`[)V!'HT4!LJ%'
-,kM2F[$6DL6YNIhih*fT,%c0j`jfMVChm3QVf6RdLU&ZCqB5)rQ9K)AA++UV#*MG
-MdULF+QU4!NI4$UimRMaCqr+F4#SS1Ra#HfA"9Vj*2FZ8G,aJ*dHN`J#DN!!T'KV
-5P3SaG&)C4Kb#ZYj8&#AUmJTZ,F&QHp2US1Z+#MN1V#!21*aN4Jp*eT)SHAFKQR,
-*%%T5a4qb9N5U-*!!5"3N[(%$#FmS9LpbYiF9ZC%QhNQ0IcA6RN,41-)b&-Xe8MS
-fLH0fkY6'6k5j969HU%*mSNj2%,fVAX'X*0V@Vc))DJ(MbN3R42fl,0((BPADUK$
-C%16#,f&NSB`9NldF0ACrC2(2MmVdSej0TCi0)M31'jMc9m5XIiJ%-Lf3!094B@h
-K'5#5Dd!dM%"3LG5U*8`V!I52K"GUZ"#Q!UkDm!Bj2k`Z2k+)R2I3i*0e+b#Xk6G
-A8EjC86@k[CLUd8+rBU"@$)55F*!!U#RAG$GFdBX,G#Y@Y,jj,@CTQpH'$4G*64J
-`,#l`Dl60l`*Aj5TY4@LUdPH98EUH9kZ[qfUH#(4+bL,N$DlG'ZU8[jLjqY"4)Nb
-Uf84d"B'Q-N'i[)KJMb2!jQl@%LAeei$BUqNfA++UV8b3!+KmHAPJS3%Ke3(&&KA
-AU"D&AA2hDNFA&mLV,",d@h[jPh-9e@JK5m4F5*8l1p5L80R5X!$eFS)+erj9&QN
-D6GhUL"5p@2kf`T9AC+p8e6#e&heBcRDl9U$!UA+feX&HGLQf0PbT'(5Y,UbJG!@
-4F@mBfUlV3NqTI'A9[&Tf%BM[#BA6QIcb'fh#UlZBZ24Z[r#fCqX-i&581T6(G@%
-&@9KNM2e2*H+BV&ke-C3Ab9*#DriJ,dNPZY8$fBUL2c`59ad!bJpii8&)pIi+#+J
-H1YjDm`TB+5YJ4@68$51ldKpmScbJQNeGr,e#RG98ZX5kVPfIM66jaJ@1"$lb5mT
-($T@*(UQ"J%iS@hN(eKf"QijZ2E60r89$PXMd*Yba8+YE$Y8F!H(r56NJGBPQL*C
-@1Rj"S+YY'r`*(k0+68H%"*diUL!)Fa9+V,TE&iPA296GU6F5qqiE,#0K*#diRC4
-AU'l@9m%Sd2G222br2L4AQ0pZ3iAFq[-j)(TZ&KSXKQN5JfS-Q'Y@`@B8p%RR$K`
-b%A%6VmGPhJ4RcDYaBY[H"*!!ZC,leZS1A[U+h[,r+RfklS'VeTN,UGP%&MPjd*l
-pS0k[E"0j&@5RTabrN!"q"Y2C"XHbX-eXIAqp0e1Xhmc@rd1E55eh-kRDc4K!)b#
-fHq,KadT"N!$edN*6PeqAL#6UfL2dq+',rr5Z@5`P02"!E%`!E3rBVY+IPi3reFE
-"(B*SLh01G'mSXMPRZ#I(G5Sq$0R6Z(irA8q,F'6cPHJQT#N&`P''F24h4IM#li)
-`P,YaTU6FM62A4lNEcrmjPEY"KJ$PEY4)bYfS@9rPFS6rE-TG$i6ek#ESFTCK`Up
-PB'+PDrQPpi4Gq[IXdT`c'hMKBeIrTKHZ4b'M[p$djbNZ1%*rTd4Sd`d53T,1ekH
-i#%IVce%JV`pDUeD@fNVG%(BHI#3M*r["#aQCZAT*ADRT[cGQJR&S-&ASRB%mA@`
-$IFL-#V@2$Um41cc"&2HF)`k[ACkeKTceLD3Z#qV#QC'KZ$NA2CGIMMRVZq@e('D
-EZ'H$LVCCCc*cde0q(qD'V5IhM8XAEFHI8P&CP4``NC3hjXa-Kirala#T3rpIAV[
-#,I0VShLD'@A4)I,3853qDq(5M3M-23j([`I,LF%(+3VT)@qcV1LbD5J!d!C*$Y6
-m$d2!3l"+X`ihq)AYKrK6YZ+5U25FV*`(-e2+Nl9+89[+%AA3D&bK+&idH2QMELX
-ii%TrU)"a@#+j4Y1%*cM(S[B5-(`#)RAFFFeLJp`,CmS4+CR2$6CTLSM-Qr+1RlR
-Y`8T&N!!mmI!6ipbChDFJ2C86Y,kV$&RDLbJ+b"dI3AHTV(lCFYIE)"M!LIh!U(,
-kFqf,rbUArEmDbQIIHk)bX[FAVJqbPRH9f1ki*rYXCQjQ#U`U05FM-h9r1M"(f9P
-1J8aAY2jCVNJ0[i,!D[bK(A$L!J!m61Dr3RFD)K63&DqXb)T6%EfDS96mRkT*CFA
-@+SbHq&06bd0NDVd3HAi&TD%"$id8T)")P2im"'41@T!!!%9&38%GR(Mi[LaU"Z$
-b`+U$9#SVAPFXkYIPL#S[51P&SB[bJaBGq2+1Tf9RCHBkdmpR'dU6X+M5&f(&",`
--d%-iLRY,9E`$6LK-6Bmhj3ijH$`!$jK0XTSD@!`!kF%Peh9"C1L#T+p6@3be06K
-f21["ilmrNjfEJkl#pkm51qP31`kKhpbF$232YNTqBa$X!f!rQ([Qr!9lqLS`Zk"
-"(%Ci0#)J6XP[`d$`CdpJiH&LGP!KNlY+#AaR%@i-6&DjSZk"U*b$k4XS5e41r($
-r94j)eHXEA"H%*9[D9%iJA5p6HG#JhTHlHpi'X))r"Z)L(KH)2bI#+rq`S5l,1r(
-I-Hr%(c#%H9b(B6aBVQ')p61-"cI--"lF%-0iX"c$U"`&QmpTSk$`Ea!&LS)B!!!
-`!d&%3e)$!&D`$e8,,#N!+Qec[jGh@9G%A&BL)U)9%G(8M((-'%IIppepbI2,b%c
-06%(1,4J"`S*QTXqlZ`)LRXh8'M1RF4c(DFbDaM'RS(%FTm`m[aV(2$HH1b8cN!-
-MT19qRJ9F2(I6I2r[ZVl[ZmlcAGF&'ab""%%3"%'3!%L+C%3VeYA9r@Ep8rTj4l$
-i&@M"-f#1`jb'k3V$B8*K,X0dJZPlX-ec+UE*63K"8H6*hDGbXi0(@j,U0%2kK5(
-Mmp@lkQ3M%$f1re)YTPmRYG-mdLbM0RSCIdmp3"mRcG'+T$ck)1P6EE6d@f0-Y*R
-29'FB*G'2m6qSMp"h5BZdE#QGPL3Yd"kAPKU24QIaa@ST68pk3hYDqV2a9(3CIdf
-GBRLM$r+TDJ&05jUYQD6"aZRS&qVi2HUrkHkNJ9UPG)D'*0f[h5NpB2`cqL`IT"k
-PQU5l003$id6d-@j93icbk$raSHTYG%G5X(CFDU#8T)He2G*$a[24qrK`GB4a+[S
-jIUpkNKj-'URYPqBD1G&lq6IUEKU@0%UVPh*TIY*#lC!!0-mi('hKN@SR)c`kUSi
-rSbE6[j)kDcZNCZU6p(GYXr4()bJkJGqZCP#rT,pUldKr-r+M-rP2DRpMBr6Vr(G
-U%rdPUDr@+1fLRNNrehk8AMAHMVl!HkZI'cHMEr![e@rT0dRGYB[5*iBl1TEr9pe
-#rdKkAdZ6)UK(dSGDM25$X5QkPIG58qPbdUelY-qN!FCAd5[j1E@EX5*k&Ap#rCk
-H61UL,CGH0VC&Im6rSqkNCj-kD0ZPVG3qk4AY6DQMm9EdDYj9$6@14'rJep@eG#8
-T6&XMVD1V5CHd,k4VaYI4khQEkL*RdRP0Pa+0qk,MH,aU0j4S"lGC9-QQ*A(0)YR
-3p$#8rJE*0)i1d10dJQj3R9%ReifV1e$hH0f*1M*lDJ[c!NA'Q1*PmZKa"e4lmBc
-4ZVEDV'X56,3jML2Z'UGVc`GdVE4BefTKXQ!HJ4N0T!NG#cV(`93#-f1-bcjk4Uh
-,E[!mPch!4l[XXV!(1*!!ii6eF#`KF)AX9$!I%(DFX'2BhKQeZZD"C+03Ya6UfMK
-Cef52VTQ,*52k$Vl-mXI%P8%a34&T33Q@2dVfVpbaPZEi$@j,3r+H&bbhfHmmLH!
-mEP%cSL`*jjSb,9rp'1-1HLGQ[f9$C[+TrCC'LeYV,EFmGhL,l958B'TVbScj-HB
-8XVcRQ,#`$HlRPZ9Pdl,l-S)XQI%@06E'hC5Tr+p!RGV*qBdE0bd'pqMF8#f'a@-
-a*,Z(d&0%G'JHXKM-@MbUc51ZqJSHc@2Sh+0D22%'#Da(e3`2j!Y1b-%3M+Laj-%
-!aXQiG#"aRGM$$8I&FJVhX"eL-B8E,VB8dd#a3CUKBKAZFGJp6#"R#U*RKl5UC6M
-MUMlQH$'Y9NXrchSH&k3QHMKbF8jFi9aeSNmQeh8,0j&!@VJU"P`BX0KK9@jb*6)
-'-R%e[S,4`EQV3J!h+6D"9VR&TCQiNPLahH63J!TP,'+hHTkYB&,Y1&GXJN89+cK
-#fC)3Ee'iKH&F6LB%DkYFU%69kL@b!CKGGVq'Z,BIaV6hbe"iSF9X+A6CcB9N-8Y
-FZ"V@86@"8I&[0e-KmP*,S3dp)(QK3qc5a8EX9bf&NQBZ9*d3B5Dfh9iSHLS1a4k
-c)PJj*)&$%C)Nj-aLT0S+Ui4,BTQiUR8Va)!&qhLeHPAm6!UL*YCK&L*9SCTr498
-Sb!X9aQ8afrbDJ95Lm#fD-%SE)a!q8@N`!JmS!MNe4P)`F-d9,mijJc!8&NJVk'H
-`8RCJJhVH,d#FqrZL609i*KFLVQK8)B('5cf#&C6VIRDffbQ1aq[Pp'rQ@X@UGU(
-GGBY4TDh39,9C+JUc3KZrI*5fJG3,SpS983P!CS-N44-Bb5``kV9#k)-"JB-8Xf)
-c#aB3#cQG+R+l@a)lmCY#0X"Z-PaF8Ca-[-)9KqBA*pC4l!cTAkG0UC!!cpC401b
-1&lZ!mc-+P"fb9E'bSTaRbl"m9SAFke9EQIS-(FVf#`HLf[(+i)!b&SXNqUJpV%Z
-5DVI!9Ja!MH[Si)d"&P9--VRLr828$X%QfF4!#B8-BXCPNCJXa5kKCNJ5Yc#V#,'
-1mibR#Lq@J!iQS3d@FrSAB4JQ3f1Xm*!!5S93PdhX9e!cE@!9H-ldU0,*8E'D)l3
-#Ji3QHLa8k#&cS6l!6+)$i#rd@$#`L)(`S+,%#Mf+6E#+UJFfp3SlCP[K@1hBSYU
-a4@L*J30e)C6*%I)Ff1k`#CN!CE-JfL@a%M1-(f9ehLp11(6')U3*'4AU++L9(K5
-[Kid9b,R2b8BZ*d-jl%)2Qa#+#U['3jL*6"*c8Kji3Sp*BTl3"$J")H$U*C0($4-
-(j!(H!hIRB4X%a6dUSb%1&#IM8+qc(F+B&$3,lR1bNCm*'BIJ8[`4KH84CH"`XKe
-#e(Qa2-(PBJX6lprZJ'T-*dHSAa'UBNJ%QYK4I)@+b+$Bb[$aINj&V)2-46jmUN#
-l(qmNprG9IM)1IimQQViV1DM9M@m)KqQ`cd$IjBjVbJMDN!$C'Z[qbKd4&2@1HX9
-R4!ADV+X1Qq"4dHrXZ$3"Zq"SVr"5a,i1BeB[G+*pF-DXk8"I3(ma6,#ZIIp*J9E
-6!)1AU*VMUVBU"CdM-+Q#`FY(UYU10KJh$$+V&IeMh!Q@mY#J+T@KaRY((GGD*!P
-+[,IHBEbh(*dG-*PBjk`kB19m*5VjpFd4qE'C#HZEd2$-$)T3%kZli'c[Z+3Q0lT
-M-cGASB@Xfb'V(cVGaF"iEbE'mHM2KTQVDmXAUApjDl8VbKd&8VL$)Rb*-5P+d-*
-Kc2%@D(0ba-#BFaVbDM$'Lq5FpC!!Ge(9hJT@%prUN4U4[cNLb"*cDq*Lf0BjMGK
-QKqQ'VHQUYM9DI@,VNI(DI"(VpLR)&N2XqX"aDb*m1*N"dC(S$")$if2#Z%H"pV%
-C*N[A[ST@Y6HKjjYR#ja$)eQ"a'INEfj+hKPNLG$b'5P"riq2JRmGc&CGfpC(G@l
-2C,b*'8'CQpf0JYQHc`Lmh[Ki+rJM`1Z%k3Vq#&AERURD$V-YcKe4#6ZM,"Rfr16
-$qN53!+Tp8U$iH*(MZLp!I$`F5`a%"l5H$6HqSk[U6%kEU2+#GlDP`$QlNTfhjFH
-kGqBhlib)bY`Fa%3CXiq"*3k59X0Nk&VbBM9aHfC9J3h3di)bh8GM-f1D0QIL25J
-M2h2c-3LHl64QGcC#,)k*TH'U'K%6P0Q8A29eca)6#ZSi+JDhmL1B9&G66'Z81lQ
-4!HEX5'0f#$5C9D"0+i3T-N+J8-JZQ(#B4L1NG@*,D3VHSei*LJK+m!@TPZ!eECY
-MSQ!hVG&K6'Y&abi'aV5V'+1b6ZX'dpm)`EH2N!$,"HG$ZSjYh8YLhCF%bQNMaJ+
-8dfSFaK42J6DP4!b-+6PB'ppITZb(NBb3!,jBZbG-G-%c)EdHl'Qc61LA@UCNLV[
-DL8d*0DC`jTkQ)$e6%Y""HUBJ260mA41%qlLQ+IfCDpS)30fi&DDji&C)T*!!q&+
-Tie0G9DY1,61Q&V&9TfCKe4(S`"p-2@k%",GFY8BUd)D@q&HGHYbrkNbBAM$GB@l
-(1HVP8&2"Xd-RiQpD*RYUHf0U(iFa&38ep5HBhXC3V$2dH-'!SG+,F"K6KaY6Jl(
-rY3*Y1X40Vc@'3UfKJ,UKi3AAKNDfA'hkIQ2kF@0SSc'dpHU',mCAaNNVkr6`PT9
-eHU[$Q!iiRQiA!f-kbQ8kI2PdP-[drXE3d1UUQpL8(l0c4e4-%'TaFe464Qb%)#l
-ErbikLf"'kGVV(94RIJREF6iM2cN+A`l+RFe4b8&Z`@deh[$Uer+[6T!!f$IUM6I
-1'N0R'd-""N-M&6j#i5X8(Uc`AbMm2`Tr9Z%r+Abr`[qUm2F8RX1`II$kTr!5KIp
-FiFmSh+l`@)8rc,Lr9hLc`MFU2&lKQa5q@1&1*V%E#mq`m5k&rd2KPBa29[K#d3E
-Q"8`SfLXZKGY8mEVTB'GC#Kr-a)(lGB8IB(Y1-Y46#RmEE3Z&$m(l)C0lJDda6q(
-h+Vb0(53UI+h#rkl`q3VIS[!3KIGN,I`4E"c0dV0(%DpcZjR'AS9(XT@Q+IbL`[-
-8IPhKhc*"lCL+53Tr3H&r8rKaTNUM`Kp4H*V#Ie6i#B9rTr"I-Y3CTKa@6DjDVjB
-0VM"&XIN*KEqLm$mVr*,#PbTmS-,raA4UBk5rMHRd)91S31&&,,8+5bF+Sjh#cbR
-m,BA2C%Y+6)-%KAr##L"Ei4d8EPAi6S8(&(j8i5UMb(5&peGi9jCJP1AMM1jp@GU
-Q+,b6`JH`ihZCVU$qJi`klbVm)CD'KpNDKeLDda@q9q'V&,j%i@MbI+c`'`Vr4Z'
-pf@,$fImCTNS$)`d5Xje"c$T'eUX+Ame+#i[GBRTJl9HV3'3$Sq#2,*&h-pB[&,j
-5i5mceLf-q[XBiF!k@q%G&Iie9'I&%`jC$(TL@6R0B8`@*RS9+im(&&k[m1F9(UE
-`,eN#)-+Qm,-+(k68289FLVCd#SmdA8kGIETAkf"ck*'C$AdE8dUkVTja[1HZB)r
-6e5lRpS5jT9f@6crlLAY3EG[k@I[lCBc-HRREiU2G,pB8fT9hFc[[Q1mpYh*+CBq
-)JAPKDclBehrMm1cf@aH9pli3%SL2QecIThP8@EF9Vjej2fe)dG9eFdlpP$NL[F2
-f*FFq[ePR063ekI!c8I-+ERdflB8I0Ydcj[U'hqlj5p2$Mh9mk`qhrIc(1iV2klr
-HqmHJEjjqm[Xhr[RIf!H@AI[k[C0rIHI"4rrcdG,IrqEEZf5EiaH(rT@mm1#!VkE
-qqm1BZdGI@I[TmlplrD&(ARRcZcqpq[E3FBRhrA,hhcF2HqU*9AqqmapElMp`kBZ
-2RrYErVf22lYc`BN[EjLZ+8hZPfJ8,dUBH)kj#-jS%AcCSM!a-"Ce`aLqE&%(Q"l
-'d-'UYRN(A,IN@1RiGk@[$k)*(0+Lb,&NM)Y'31D3!),%lr+B%#ckAEUaD!4H"C!
-!,haA9Y&"GVPS$MV),VmlBRb(E'aSX+T&e--8`@3,*iGF"YYVc!ARDd`9qG4h&ih
-[l%D0CG*-#6RKjCV859SYAI-M3+Q[ma1#-QKV8%6q&a%*34&X,-4pi*LdR41I2jj
-KNF2iEMik0@*J,$CMM(aUX3NQakM"eC8D0,TV4,iFU@V00pA,cFI',[$D*!SXEMB
-@TcQ-aH[4[`N6CY4FRN6SqHCM%fQq6%4D1f2aG+0QCV@%Dj!!i(pjB'de`62)@&T
-Se!aqBX+A#TphMUAeaP)dj*H@S3rD,R8CGp&DhjH5T3R'dNcMVY5*YHA1953r,LV
-'r5Zd(*IfQdK"q"[M5bG$'8$+d[PLB#`&G#hYJ[k3!!*Y5Cja9d8$mbl@`%5R%Df
-peTI3l+Z-r#frJQC,YSe9Xb8SZ58SY5ARa-"BdJ&M&rTpB(SEGqfUd)aAD"CDF#Q
-NpHZSC*q@am4H%jB-E0Rd@&$S-"EN&9aE81VEC"%(aJ),cP!,&TbY'"X,MN!*%'S
-"@N%,-SblaVp5K&Be6-4HTl(JR((A6)Grr@l!ifd$"5`Um0(NaUL)r4CfG%N-GVS
-MSTVF-Hc!FUa+CepjLbXNRDZ3!*3Iml1NB"GHD4EJl5I5)JE)b0"(IPPV,1L2,P)
-8H86A,Qi6(5mZ9QMfFi*$GhjEkkYdrSY6fVq'fEq'fBKdSiYLLZbYDfrh%Kd[$eD
-GpSY-3XH@p0ML&eJKrTb[q)UcDUSm1Ci!,fUER`ccm1Bp,kkD$20@#M*%SU8iEbX
--2K5m6D,M*d1#i!!C@ZLDrk[S@Nd-XC,CQ0FHh5N`D*CH@#ikIQ+XBd+kqPI`,l!
-MY[PR8hTq`*KIVQ[IMLc3V2$T9N#L&5l0'UTUq5K1+qUV&9A#L[TU4E@`iYA0ZJX
-[lEembl8C[[l&,9IZ-1DM$Xj(-Fl[VQXriMh#'Pfa,TbJ&Fl35MlV$SE"5j-edVq
-ZG3D6rXU%kAaaT13,*@-K8RX6E`9@N!$8LQc"#P@XH2@ciJh*#Z#fiJZA&CA8LTc
-+#RGUlBTP*GrLUdVYLbbqK8Mc3U4jiIX`lq*b+li"@B2&kPjZpL)I['Y`eG*HhZ$
-P&LmAZR6eGM"9[jY8[*PBF,8c15-S+S)16q#),)IYBhZGX4a@*ZEiR`AeQM)h@j,
-cm8dP)MECR4p4EXQd(,1m%l9VCdc6KD#U6bH6VY,LDdIedZ1rb6"d44fEp(9TEXm
-+ph-VfIeMDe!9XBljhqV#',E+9Fe0-HB'-qLI1mYKc*eHS(d$p$HPZUCC98hVjZ9
-iRj@mr!K'kldm&E(3beHVfSd5,`r(9BpCAYjiRfdI1@LhFDM`0#k(R63hR0jVcZP
-8bA2-1H'98UkC'cGZf#HbqUJ%apJ5-HUL`hF,!h"4f+2F60Y4Pah'+!$1+2qAaNi
-lla-j-@L@M*`r1FeG89(mS5R6AH@3!0SU'+T9''%-Sr%L*aGS`c!BKZpRYYShrAZ
-kMNdQ&I"K$[pHBaJq%!a$NfAB4TKiAB[(Uhpm!NbfUTfI#r-qM"fQ4(8k8jMJfbG
-4ZKVH*lS)9J#!$d-p(6C)eqcp+r4Vra,E99m9"cQ-&(bq5)&M6GQKDk'9AYl9bcZ
-T@Q)0c"bBpM!+$0c[U-q01UjUcJjH$MrPA1lPPe8YmkUUfBE!c&(2fc,rCm"l2Le
-)e!K,HCIUqL'%q2NXIVlla,YF+AY[GcQd22kCdAZrZ!4ES2AHri94Pq,PJq'DMBF
-[1M3[6PqY1(feaHNX"bk9IQCdVcMYlRXk21Y'DTe4+(Z+!q2-Br*'ebiV1Q!Um"i
-XIEVXUC,(XKr*HM6pFF[Kh%-jHqYh0qcCprcqNkHH1re#jEr2r[2-RFG[+rr6dGm
-I1b&&l8K1#'VHh0LdmI@-Gc,c@cG&a,KMdlEXq[(#QpXqfVicI1`-EermpZD0X&P
-YekjfDrpXBZMeX#[SAlTmkpb!,NpfHk*VarD[[2bI$XpfHUEc[flrBjqrpre,rpr
-eqq[RArEkSFH(RrchrArdr(R[9l[rj[-[Sj2Hr8@lAdrqjFcIIK"kj4A,aiQcTdf
-C1[f0erjXQ9'hk,[&5jFXL*`hIq(FkjF6EedkeqA*!8pd(0cej3lrH@$)rF&hK!b
-YZFYD4rp6'UL+`kA(hAGN`jUeklpHpdAUCbZr@[lpLP@VhlTlUjm)BqABbSM!0E[
-0H6jqf+IIm&RS2c`UCIL$$iedMVMRh[2[$4adGha,'[cdYjBdq1P[2M6iG0ClPMR
-MDI!(AaTm-fTBbX2$(aVji)Kl"pmcm1j",@J`bDq`qQHmL*qiGME4Re6RljfHb+m
-PEbHI(hq42em"i6irbHGA*p(BIe@lM3NN5lrbVf9UI"%J`B6+QLIKPmCb0&kM56I
-aX3LBN!"-RDZS06'k9IaFGD,-CC4N-38`hFY-BbL24P-Y,D-L62ib83(ZpML)ZmQ
-HTM*kLNVS-FUQ4bL,(U9d6!fcd'(+T8183hZTRRC6!qfKII3mlDH6Z,[L146h#jL
-AqfrF4r42h*Yf*afRfkLFrS5ja,qRBjKBKS++SKf86!N84-fdQ4UTL6E5kj4"le!
-QjH0'Zdd836(NTPK+SbfdLhkN#r3QED12D$[Y4+Rr[`KiQbl5Yh36mpV#U+k0VY&
-9kNEYk9P+T&#k$Z`9mU-[d@@k4HGS!(@K*m(d"(@PMQ"pK9kQre!(E1P%ce"RqKI
-G6RqN2[4hkNYrSIld1qT(IkA2k8[U46p3$rU3!$kKrp,lp!rU56qRh[3UGDII-)C
-Sc,kLGqNAe)jq6C2TPc56INXI3)mV@19Mr'E60*T#8fNk[8'[dCpT"Rk,k$YD6%Y
-T#5fJ5*T(mfNKcBAQPj'#@p$k(00h!26Y5)1Kmm[3p6rd!!fKqbQBlU!3'NSeG"G
-CU8lj[`m#+QCA1-K&1XA4IA5%0Y!D@N[Vk@YD4ep3+Re'+qNV@NlId`TD4D[T,GV
-D!J6qA`5-"`(FG+@4R@cNT2-86m2S8rS'f&RN4cp-SbL&KY1$p"#0"0-)ZSIZ"HY
-l0*!!"Y(Gf2*5)2!6rHdP38!`4&2Ga%$J8qM`(Xh"Ed)3q!0q%`H"Ek$Y-1Ml-$3
-@qMi)IHm&#0`$EHq'[K-&!6,@m6Y8flMJG3MQ'K(bPV2!44LG`m)()Y4QX0"1"&-
-F#aG%1*JY`Q1$4FKfLT!!EN+`T'YX8-N#fj!!(Xr#C"BL@CJV`Z0(@'$(MrGRB4B
-,)d5`P,+JX,#D"DX)KpH`d)@&%"&b%eL)CQ'*#(Xc4DM[)m,Z2"E1L0"J&Z&%*a'
-NXb+NcKEK+lEjUd%L,%pRB58,&eRSaF)L%Ei[BS&YrVk4K9!@2Q'"L9Le@)3hfl2
-!%[EQjb*XBkTX+fGK1`X4)Rc%52N4)mTf4[VYM(cE@H+hGfDKK`MKM#MKp5b`!JY
-RL3r[c3)MF6K60-V&`Q84GR4PJDQ9c!k5`ePiQB@I@'!N5'C-#5B@@#)6f)BJPZ`
-J4TUJ15``GB-Bk$6[&k&a[JK0TePJfjTB!63aj6BbdQr-BS%aE@4-'fqb`)Tcih3
-4-SkcN!$+!P-dJi&A"Q2+B)4qTeQ%r+-X-#$,pk-BD1EhC'%+#`aS@XYBB)4VCD$
-3bTC[hFS#+kV@[Lb`cDf-P+d-@$Fa%QpbXm"8fF3)YiQ"a5C@Y*Z'La$"LLf#JA8
-%+lB)"XSa,0Na$&aL'$PL'2RF!4BB@Gd-V0fXXVPC*A5c",[lXF")idjKJ9AD@%E
-3@!X,$&"L@@*L'8M&XNS9biSfPUNBqaS,E(-D+q#d"KBBZG0fX,#,KA-XX%U5aXL
-4aUTPfK!4YM#PYl#NEQ&*hF)+D8Xh&KMKYV"Nla,,m&d@i@NXZjKAf#@NDVYkb94
-E+&0rQ(D&XP&D+"FZKh%Ab[*0Q!r351pE+"F(B#S,j6&(#q8m$*DY+C5,qK6+*4d
-+j82E#ZAG10MG!fC%SGa`$!B#'VS8bR[+BF#`"m+I6i!"m[REBAV#c)5C!C05+1m
-R,"U3!1A#5&N1R*,PNM4ChKdYbmrhPqApdfAj4*JXUd@bV'6)XYjCPZq,Jh(,mK'
-6,'m!``CXA1Z&k5(,kl0J9X)XPZ@[JIbkQbar!8'THE,mfAiB#([VXLb(Mj!!jDK
-d'!L+kLl,1bl+FR+U,!H9`4b"!5+S6CDE&9RH$%&01'K&Cj09PL1JC%3cc%qb(0-
-H"XTZk3S$j5jdJ*NXbeRR22,TH)rm*jG(rRfj4ck"cSPq(YQeh52VPchb+S,"!G8
-@bj4G,-YZQ(E&XUFrc)KL19!+d`rQY@,C["AQ!Nb2BRR-l'+jGP5aA03"CNLaA&"
-B,"qF85`rA9mXPi3AbpPGLZ9(MX0!B&CHXCbZ`-b%'9iX2ei#FlPB2R`'jL)-0ZB
-@`C6$""I,Kl$3S4d`@1a3CjMHaA*1*FaUQ$DB2M!3PJ-&pqE#5$$BX"H(HaFAbrA
-,BAE"32(k16$cLqAG8'Jh&QT)+CEh4"6,*j'`NpK`mRdB,(U+B"B9bmp"NHFJr(3
-C$!5IKS)[R),T@5aAGLq@cd,aIiB@bfI#LZ8lSH$a"TK2LZAEc$")f'hlBD"%Z3N
-''mS(&mY(Qi[P%p(&XZ5#Z3N68L`V5+4b&3E%GZb$@3H$MDi!$)MSJR"A2-bjBMQ
-ZY9Lq,keB2J,PMX`YPMId,CEAG#Z@eqE!J-"VSF"k&0JA8$B9KCJ+iCqP&X[,)Ia
-l,2jpHaJ3B3819m&3@8#Q5N!k`I3-b)'iJ$`Z,5#E!IhQ9TLDJ$aQ)mcmJ*bh$bB
-$TJG-5%!H$FE4R`INfJ$-6CM*!APC,Fa+Q0N"Z3M#$`"a!%*-%'BD%C!!#qB'C1p
-V!IRJQS$m9'T!cZSIN!!IE3[)k9-#XJ9#$Zf!53R)$GN"qIP5Q#%"qH64J(`+R4F
-'"q4+-0eT#XJU&(8FJjNCN!"Gkf%J3#q(k3`c-L$(V3kJ-X*J`j()J,`"'cEd#mK
-VHJINp8K3+K#Ir33c25"[KH*EV3(jc48"1H&-3'l1JpN1dbH!*`#J!5ZX&,U`G"d
-9eG1ir5iq$R0EF2%'Xd"j,6kLU0V+VCLd@AK86-IRim4X6DdedK8DQA@@mR*SA"N
-B#lcf&'k+ifZmL5Pdf*a$biT8@bQC6bND0r!9"Pqkqr)m6)$1+iLr2j6#McH3!-8
-VAFmV!bGC625S)Q4%-QE9PYQH$VViD9q-1*r*J8l`*Xj%)fiE&CGMGV0ICLKN6S#
-c#Cb&akqRTqV*9+R'Vk1F0A5i6)hI5Xql+Eh--E&dqT25AGMT(&qejkl("k9+Re'
-KepZK1d8YGp&6Q1fC6DZD+6H2(Ld6-h22P0!H%q%k2b6MXZR3[K$(0,Eh)d0FaK$
-TU'AdZfPhmB-1cFMefY[ji,$ZBPm@&`pTL5V`hF#dEHY(GEbr9NBPARSk@h9UjC4
-HJPBTT4p4E9Q8hU`kbbLGprBRE69E0Phd$+&Pfah"H(S4Ek-b[21i9#IrJ)T1UFi
-X+X,N&Fh2C,XM@1cY*26TiJhV4(8P1C4RSR((UJSH*rZmB5PdEdNF1dRh19R[E8X
-K5dNfQB[`aP@06aFESP+cUDb)$TV8@hP8j+8X%ceI5RY0H-&U8I#pr&[mRDd#,+U
-JiDES&(Jl42l2bq6ENC18LF$jP!PMD9%Q&4cM0rL8#3qT,T-59LBPV%bb@CQ8SN`
-kq*C*BA@CA"&PX[eQGC&-CN@5,BV%dE*)1JYeiVeKRImh,*)f&)QjN@UcD9`ZlPi
-G[p[-*P$9JPSAP6Cm0H+G9p$[q5JU,e)((+Ikj94C4)Ij9FTZS)-jG$L9ZD2"STk
-k4$@YUDLQ%$K%YGh!T(MFrYE9Djmp(PAJ1a5+p45Hk30[@mqIU91Yd#R+R2Dc&+r
-pQ9be)Pi[+CZ!bYPHRM*4I*JS%palA%6M[$k&9IQ5*q%P#C1F0)lpj$*1cKkKV'`
-U-"(ZfcY8kUUZ'!bdl9lE,",qFl6`Ri*XhEcfZD$ST2L`Z65XC$APPG#i)Tp9QVh
-A8kM1QB9,4B&M`S0!q-L#@c@$DAHp3Yib1T!!+cBG3'RkJ[*Fi9qAB,CGUMGd,X$
-ChJe2V2-Amq!AZAfTA@b(AT%0fbP[6AAL)iA#REfKN@6*UUF!GeE)9Dp(i$'Y@EQ
-q1#eLK')[mFRQ)NDiVPVU+mPVHUQe&rG3H,R3h&+NAD"!598plBLUE-((RcZckA3
-flFQQA(a)bUC5h$'TX"8`9q@bBZp,i`GY2S0@Rm&bRm&aRd&@Y5$G@544F8Q9e`l
-&iSG,0e*aGP81l%GGR""PDUa'e45F&bJYem)PV5KEYEPS6,Dr&('K954CG'X+VM-
-fEbB&XKeD"9+l)eJj[ipUc95X9LN9MPY!+JBiaJedZ'&'%0I[,6F0ekqAi*0XV@p
-0U"AYKbKmXbV1Uml+Eb%V2jbH5mY+bCY&HFGT@4CcZr1&dL(LYCK3aNHU-9V'*kK
-MTJP%PrUV([!QAh`*1VKKU%5+0fIj(Zcheccie63DYm1RKG-'3BUphLFP+lI'fE1
-U%8LiC8+%Uk0apKL9jG+M*F+plLQPJlP89%)(c95QqJX$j#8'V[j03e0p!'dm$Y!
-fE6)Q(EEJr0@PRjj8qQQrp$-YTCpfK9P+d)aV3CX'I`Bb+IlR+66-'Gj!P@Bk@8,
-IiS&XCQV)SLB[0AMTd%ANJR5)pk8lDqR3$NV&U)3DDZPN,9A@1TLVQ-98&Ge2a(F
-8eZdT[U+`lY`#@`daaYN&YU'$'6+k`"CLqC@fG(r4LcLaTGVYr8U-[XHAF&aRFSQ
-fp4JqLiTU'I%(#FAprZdDr0[%b)QDF+KSUdqG&[@Z6N[I4iHmkQAiNE0dS*C+&AU
-XK%Tj9dC#kbLrB(6RLkp5j+qG9A9h[ZTXR1r6CRj113+``@epd%"Y1dfjkI4d,TP
-+k'PcPCTq2lHi'T!!aN-1i'8fjY*D[EJPqe,p"ASXTpT*iR'+eBc%h+3IS1iUF9A
-YkqD,PJU2mS(5qG&m#CQVmba`IScCp8Bl848M5ij5hQUI()dGBiDeS01`%S@+Mi0
-1&GJ)88I2)fXfMIG'm%#iSlkUaZ,PTF4&HGi**-+4Va(,c5Z4+'rjT+HK,(20UK5
-jTmpT()qVpLi6FcV`FRQqq$cQ3dj9Cc5LG4-hJ8paa8H9mT6Uh'5)hqZ@m9l9Z'#
-4+Y`rPqEMDd*Q5)ADe[h5afi6jCYSiaP+A8%rPP&U%IhG4+RVDDfAi[*)VD@M*VV
-65j8PG,)Hp8p8bU1eiL#ZPYE@8ZSqHZ-B"9A5aPV+Vb@h(fVE!EVkLREcB[(9@26
-k!a8XHQN!qA$4Z`"8U1LG%eq64Dq$q*4-)1'XlAKr1L8FVKKPBP614VT@'#pk!N6
-I&9q6@EGrPFK-mIQC`@qI!QG0,jqkp[pAD1hr4k%f##eiNFca0EdUjK0TqFQ+jYf
-1QlT1UpTAh960LeYD[-d`p[[X,@BHJ4@c)F)F%dkM91#[6dq3!-@G%BU%@l)NTfL
-YPIM"GUlr&F%jGfcc1hb@XKc',I$+pC+L#9UYAMpiPdk!,r&H5a'lafZP(8c9YFr
-3[[SUS'S(-9rQ)'B@(6aANDLf&YaUU1r'FcVU!ZV$I'aS2fPbRI0)0#QZF5r,UeX
-QI*mrRjU8(VIJ6mjQ8lD*LXj333Q0,N(,c5%iCM%fmHdKXfSNURHkejNb0N+e9"q
-dUTMY0H'"DV+9jV+UkX@XR#kU9SVj3Z0#GHh8,PA,bX!8Ida$R2keYVVXDfe9Ae9
-lp#KQLkISfQC-hFR0!4#ZIS[4m1"XPG(Ni#ISI1+(&@pl!5mk+LAZ%mD9("'@Tl1
-`NS@,,24LBC%)haHaF*D&4J6Yqe!GB-UkQ'jT@U&U+rUViZj9EG9L(6H#BV"2GEk
-eQZ1Z@GYE2AL8`rP@-)mU9*aEMh!$Gp*ZM4E4pZCCR0RI[)MR#EcCAYMqh)9,3*!
-!E(mc"2eYH@+4EH8kV[q)jEIeB@'i#"pPLm12MQ'a8PAl+%29$PK9qdF3SAhdVQl
-rD$B%IM3AcdRBVQJ(!"2EXhAlpNT)aAdEf,NGmje`Sk*fB,*Uhhi1c0XlBq[f(N#
-&UlDG1@"blNcPN@L)lZb1E6YRL@dl"q[fm(T`KLrARH%*20bMD1'pJCb-TbD%,q,
-K!38AP-3$'U)X3%9G&LJY+N5hlkL&P"d@)@@(5mH9*YCGM2A+9AYb'64)hSFYb5i
-ZlQY2$YIYb@N#'bEXbm,q*'`da#3[&J4)-!N4#@Ge,F%&-EQU&P5NDd(T+ZiSdS,
-Qk2BJT0iH9!0YQl0dHr0qE'dqaTpcf*T[BJUBV6Q&Rh$B0ZrJKad-F*E03#2JUK$
-D1&RA'N'bCGe9He-@"$5GeV8QV&+l!ffDQi+RU3p3[B'+!mmJm'`dkrD0A86[G[5
-Q)bNEDlLP9V'phN&XH"hb4MHJY@h5R4RK()rFd$+FZMe$E-QiA8HcA,#p8kVEhcN
-+h$[`Bk04rc-hkPSQ!$C[Z'V2R)'66%"e(ZDPjD-KNSI#bMqUfr2MF*+r$EeQdEZ
-Jfr*C1[*l!MG&i%DKC`8e@N&RVE9HYlHka(#VX*N#C`HZVqMee(%Y5j!!Ga-$qNh
-P20aKhj5!XdeZhElTCG(VKGlRSJG&mZ,%*5faA%54MJYDBPG%QJ#HL-kL**d4Rl-
-#MCL2ia(L)#D,(F3FC`Fafh4R6#-QRbMf'!'!-3#Q')#Z-fDZU$afG`"BGlTZG`0
-dRHieIQ`'`0TY%8GGG+HlRm"UlZRJ5K()B0dHD`ClV)@ailiKPce@*$Bf3U$Mr@J
-"6V'I#maVIN``0UHCG(YDJqJG4fm(H0*fLD&6GkE0%QTUD80dqaDKe4CSYH8)J'T
-,Z%MrPM!G9lCBYlIZh$+CijCqEFX)-I%@VJ[3q52Q$)l$%c8Z,!G0E@m6#le%Z,K
-0K'pV"I'q&Gi(RmC8,6"II,9%jedaVe3AAfF@1V3EZ0A$Jb-1Re-B,+DDkMDY'jF
-G0NaFaPEl1YeQlbp%fB4!Zdf8V`fe`6B%25GUlIN5(JlGcYYe@la`FTMDU0Y#+d8
-hY-[AcXI1m$U3!$2lFphfL"RH5FYDSpZb1[-kKrCS$ee,amh6T4Y9Cqi-2JpmKlE
-"Z8,ER"*GbeQ13Ar9ZGI$&cBSfZkMZQdhUbblHk!l3Y5c"RLVJf@U[F%0E4VJele
-i!@fBM-llURe21HLpCjZ`0iAY"+BplGCac"BeCDJff3db1H9f2!V2#I"dd'fHrX"
-S(Y`[G1"f95X'43i)HTAUYN!r!@Q"erK#m*T6GDIj!XI$9CcQ([a3VD+03Dj3"-p
-6LlRXbp"m+EUUfSTB05h#4-iLj#8&H($+-U6Vi!add,4i'RFEeGj8YC*`2)i+b0(
-`&GPG"*QcTr"$$YXMamAJ%6II$B,Pi9&@d'6d4NaH%+k@TeXiZ1cT-`%YkFah2ei
-#M2Bi2N2J`5V*+!j,AedlI!DlPQ1QJS!"jq%Ch#K8l,P&)%-Z*SrRSVD22SCC#m&
-#dd0EGIXK!Cq(,JJVUXkKhVSY4j5M,@He+2UF0KcPp-'L16-C@P3rqpjFS2G+31r
-G)G"lfrKQKlChX@kVAbi3pEZ%r2TqZV0q$UZKpB#f[$6-LZJLA-&ZiB4f)c21JbY
-Xb16c(,D'&!#QE8m%#YLfCcK3fMj8kRe1ATHPD2X(klD6E8,bbIFj@Q%RJhAE+3D
-ITd6@UMd(PreF215G9Qh2#6hYTq'ME+I4KR*STbrUfZP"UL92YEe`5QakJ@Rh3Np
-9'i0XYa)eD`amd&R-`Kd$Ara2e,!aI96Y6"Jkje6YcJ[SS0510qLfimbr(TqKfiq
-24"*Z-qZffjJHYiQm4#XhkEEb8)%Slmi3JhAY6ihBM`TlY&QJMZ*6URQNDMXfA!$
-bL@cGGZ+8+-36AA@E*$)m6@T%9`#m6HSXMU5"ZUDL5@VZVGU8VB*&ZDVE(#c[FJ9
-BU"GS&pSRCN#`#ilEG8k8[@X+FiJZNAATH!5''91-pFr4fD8kieTjH+RL[#q0Kq2
-4(8H+4051S%6-+e6RKVim('@fBC!!EPXM()bf"ZfFY5)VYkeGai*E,,N@V5%c@NR
-Vd@Baiakk,blUYLpB1bL9Y5P5SG)i9*!!cc#aI4aUjr*fD1dFCDfICKED#iIerAb
-Kl)TXIJJUV-THab["hNF4hjc(+DV051'4$Ll(fH5HF#1f3*cB1NjN$6CcS3!@FbX
-Ee!L#MYQ)QSZb'c0IGqD&L)D50MS06i9$&KJ)%h92GbjEbD2JFCE0aUHl-Mi-EDJ
-$YA`K8!GUG+GT"%-9c'8SlfZkGK![``&-a5q&K`QJCT9KUR-!RjUI3U++RDU@MH@
-+YkV14clJ#e%"Xd!,$qEf2iVRGAMJFG1RS0-C6`F#!(QJh5'dPJkK@HI*!GaR#lr
-BJ'DRh+SkpjeP%Tj('db'H4iZT"!ZiL6F5#%JpC4!B0,i#`#TbT[Ll8Leh@N5%Zl
-XJ0IeH09jfck@)GlQpXI*V0U9)hmhFJ&plk*qfRkI)Ic[-EJ!!q9eSNB4hqh81!!
-BEJRq#FmR`-h"BDV0F8a84FG-%9cV4AEKQU,Ep*'L'lGDYaeKl[K)*)##Y@[Aj`V
-%HV3a[XB0Y)fUE9ffJ*TeZ)9k*F$L&'le9EA81!HZH"BfZr[@p-2[mS`CdXS+Xhc
-'M"XGDfTU"PP$V0D"6ZG8Uh@)X1Lr)IV"mf$[(ALM&8`e9QX`3`krF6l8DMd(4(b
-`04M)N!$je[&r)6@I6R$mMIqNKTe'KJJKLd*B$,''Y'1pTG@)EaEAe$a3`e3B!K3
-dZhqZdaRLG!kXi"JiTH8B'qkZ%D,[UDQjafkh$kPC+)*!,I$h'11pLqhXEh$0r8j
-Vc4$r%S1'3X*`Ch!&dphIER4#`0de)l"pF%d&q[k4cZ#DJ8kVN`Ppf#PS&9)c,Hb
-Fe6NA%Thf%B`XGl`@HRQi'&FK8[alr'SZB2[mbh`RYJd88U$m``*p$a3%i[l[a1J
-KG"qShVP3p,kT'-kYk!ak@$"&9LeA3Dc"GbbaAPKqde&9&#Mep"lRHi8pfI'16P,
-M!1Q#X1HNeekqjiG,mCFZa8Ykr+AZGl#rpm2#`JB-[4b@q%ITR5Zhhp2aqX""Rl-
-JZ6[1NAD1l(M2b'($T+dX**r[fL8XV223i-X$VPdIf1&@fp9ZYhTh[A,pNl!`UAR
-+$e1Q5-N`S3p23IJGJR3Kc1Um+Ze%H$)86iVGpRE%AIp(rlfp9i"c66!$pprqZB,
-FRpl`eJMXM98hZLIpGXKVm4m-LVr4+IipK+XhRl"qE,eae@QpmF1hTdCDjpjB"H#
-imD(6H[-pqbclC2Xm+iSib@TGB,A1XIlDrZRPP(01P&pHHHa$9b6P!FR9mm-KG`q
-j@rV`0a@G[bFqmdV`S2k*9r&629HZ5j0l$T*5T4U8ceT45(mG)MdV"8PEZjbAVSN
-bq&CBQehDBRr@6[krfb5Z&UNjK0QmmD'KciD'GR[Lh-[SGPhje`'*eb@(X1Y#TG4
-3IrJ`Y&GScm6VV`,p9ZJRLCmN5Npm+Dhi33e)dk3Nb"XRCGV#L066E9IDK(`!!"`
-4384$8J-!,[%293eP44%!-@AZ3lpYEjBjAm,,$2Q'N!#6[)3jadbbiC%d4b8Z@4,
-R-T+a4!RFI-R8C"2*NMA'019kF$%aK'JKKKBXPd-$TDIaq3`X8+XHJ3'@`a8[0r*
-mV29i15)8T)MPYPb[f04prRl[Zf3*PR,[kAhq!4ZQ*q9"%!4!%!#L!4IRm4'G$Lm
-qA-KF8)PNK!'qrQI6#bh1aZi@2YRY$6j1PIakU[aLI1'41jh[rIf,p4#*3eUE'RP
-f1QaCD(,k902TFL3G1!DH1-f%9(bZ(jeRSipam@1B@&8)ca,l@K4#KqjM"FhS[%2
-lm&%YIL6%$lq[$HiadFdM1B##IR)i1IK19aFh(#8A*#XScD"+5+5F10cV-!jCIK@
-ZH*QhAMX5qZq#8!%jU8C[qH#CpDP@ERNR%&Ul0d5Z3pehHhXG'GH2l`fdq9BkPBe
-lDLhcZErlar5hm8,hMmr[jp[lR(pfD)06rH5H+b($6`24R%"6fC39Ie99C-IPPpb
-p(M6hSfECJHp"9V$K`0h9cJVVU0'UF$Q,AT1KX&pTNN("C"PHVI&U['*&IV`q1a$
-+jEhEii)Tk$QM")IDp)RY9STGB@d6`m1-M$)#4rd11'bKN[8l`ME9AlpML+ZQihY
-mX8"-hG#NK0YpCP0qh0[iN4cK#8p#&[KR(U%T%Y@`LPKC1Im-4D(XhDC)lel2DR@
-$NUBQ'V++&4MAaR4SlZB4)5@9#DhmXj'`48dJD@A9"T'mLkNQ`eBbP`3MNjTJ)"9
-1(56-r0SESjcIEAS$)J@QmVT9'CmhqXcK(RMVJmN+DMJ'TlaFUj[PJ$)R)'keH$9
-aHIQAIE&*DIMrH1'8RRA&NediCr@9qklNPUdZJ*YFU!r[k"qE&9,(fq,YKZ31ZYG
-bYI0C(cV#mRJU+I3jrk6e@U4P2IfHD8cI#ZIh!Qce1E80DD`H*,%kker`QG80kK@
-6hC2`pSE0fX6Tc9a!d8X*51Y@(K[4A(C-bfSl%RdDDphP[G9+P)TIpXP)h,@VHe-
-4II$"CF5F-`5+2$4*2)+[)ZT&XLmXAKUZ"$krq0*)F9TpU6ijP0m'*kJ+CX,%@c*
-6`Dbfqkc)DPU2PCqa8USbUD61PU%a3("NT%HG2I*0$KaA5)dKYGVVL)p&2DD#!dX
-$S68&[AYArAUi3Ndp,iFF40!jKdG3+k)@0A9e5G@N-&)4&F)9eZhI&K4GLJB`f&F
-mq0b+ja8fU1cFLUZ98S[AD(AQreA@kPe[3[pkm6&X6mA'RhVEI&C[Tqr`I4G88rh
-$Xr+4SUP)4V54PT&N"4))'9a'-G3bJP6!&kQf&f%f'U%%p3'&0U,NiQJ#9Y$&FcQ
-ZVG#e!pq%+`!mB53e(&1$J6C[+I4P+3*6rA12I!Jb%S3N[VC#14"ji0G$&DVI6)P
-U$R%PdF!5+K$*%q5QNe*JDQAcAP*%eApICR1D!6P6ECjUVe8effp(hM[be,$2T#k
-)YiCl`hX[Yh1N8pAeeB)%9+[M-LP8CfP%QQD*!5RC3-J$SYlfYNRT#%2&80ZX,%q
--Z6"ie%mI!JqJ)j35$SCd``5AZlLB8U"da)Up4Q%Fb35@3"#)88"Lr$X$BerEmR`
-bb%JQ&"V!4*d*J5Q2GpFKQHH%N4J`mClqH*1k[pImR"B*T[*RR51C*T[((`C`mS*
-YGYiN'[`F,T4QB[SDkIe'5NeD#L2hpY@C-'3Rfdah[a,4lbE%33N-5F5E6!"+h*!
-!4N'+"F2rfPIRlLmHSL[Id3pa"BNpRX"209e+06SEBI4Y-!T)*-EKISCaf8E9Ai%
-Fh[d5*Z"GfNRDA!chFL3lHE$la`$'9QaNkijq@N`(M'6MPMSFV3@VXZ)M9+e*YB(
-e9'T`bfp@',F@)UddZ+9ZKA(,aC8ZA+I(e[K"'Jlfi@$bZ21$0$TSF'kTD8#([G#
-fj49em)1ddkM3"SX44*Q3!""Nq"a5JcYp-pkEH5KX"VTVYLhK&L5N!V`['JYEB6L
-189US0UD2m#`0D1lI3+$D@"p'%UYqNK61CjeBb)A&[5F@F[qMB*NDE,PNFHdIE,R
-4mXR6MT4JF6hY-"qCliFkq,@*-ika`CBpP[pB2pM5E(QRlSfa#XYre,da(&cl"2d
-GHq,1JP9[M'HPr-eGU[8VK'2JY3&-+jXl@)@IN6'lakaD!3E0a[V"'CEH,Umh8ES
-)U5hRRa3)2S0EHq0HVjA5ZYK816RSfY8fa"2RKpJf9e-#%B*KqGC1G5EUp@R%K4&
-DU0U4'8Z!IDQP'rp9RI&Cb'b89MZ6dGND9e1$cPCX@fDmXGZjXIN8+MGH2hV,a[I
-Urcpl9BZ!A%[*Za05S!0$YD4`[U,2HGYmNieeCl8PPF[rZ-6%QC'1B8%Qd,F(L+b
-*Qr1#Tq`EebcXfRMX9!FQ1DCEZp#bXCQQdFjj+JT9#LL$'mrN+Ui###e`fiVXDUZ
-`me[Yd@hkU6rGfj3NB%"m'ilSlYDf)pa8%5Hh'&ANeI+"IJaZU)U@91b'STJ'Ypb
-'3*Uj9U!aQ$4E#ZFS'1#3!)dmZ,A3hCpZ5H%S'F2K*pJNFK32kciTR&jX'a05P8L
-GF`dFE9mLiIN[A4KZI2mCBY2Rh1HQ)BB#,U&dRk8L6BcdH"G)k8EciNPf39QkB*3
-(pd[,)#kF-2'TIT!!&X"e&*0IZP,h@6J"0ddC,J-@`@CQQQTT!kRke(cHAAS6Sp0
-d5'S1J+`iC5Yph00[)&35%Lf&1Kd*LN)RPVmAYL36,5F4'&"!fi#Vc%+5AdC&rNI
-S+,EF&Xf"%GQ[dj'cJaLd4*(Z*%Fm'Lmc$Xq0AL6@9F&LXlL`a5PUGT82Mh-b9"+
-`HBM5`ApmKS'K1Pj0V!N8Tqc1eQJ63dTlPH[!Y3q3!'J!%R*c[Xd-qI*GEdrekb9
-K,P+A5ilb4R5j"X2KR9(hHp)c*Q'q,iVQ'i&%VUpe&`hK(8dm-!66dS(1-pX%da*
-IfKC*,Q"N`X5!q)[kf`9d0*Q%q"K!J12NrXQLNcHcl6Z)ReeDh[)#$+T+,%$S,VK
-M$i,&Ye9B5'DVMTNY%D82CT(*krjD9cGkl'!@K,h&$q)UZUHlXh923A'bRUT%-ia
-)(N2S`DILp@*kCM%-XqMh0$8'G(q%-"b,qr'bH+3%UQ(+-rU'%NB@D+rI6"#qJ*U
-mA+T4!9"DY,)S0(2rbS3EG$@IHNfqMS%Vbhie'9Bd&NGMQ5Ar)GY%a059A8D#C`S
-!AS'3!)Y*2bdU1[2kKCpI1K#JT8f(,@Q,EH-35)fYTLk2NPSS,He&9cREPHfRT8X
-h,IY`-ZBVmclZbimqq[0,(Q'J*YVMdi44SAB1C)jd22kT1QH9BfdQr5h+E(lYESI
-DHIc55'a9`GVAk'r4DpGNhPh`T50$`EC3UQXXh$P3iqk29LFV,$HMkekZ'`SXJ,1
-ZirJPVI!,ee+Z5qN,@bN5,R(GATXaeVfiHh'[,D2%T*lI(q2*3HGk-0R8Yha1MKk
-)+"$J6UKRk"HhE$lSSFf(5N#i4TA9k83(VbMMA$*&I"F*,[13!(J9YpN2)3G#d`N
-HX[0+K%CpFRkr3K1G!00XFG*a&*Cf'jhKEUFcB1TL+0DReE`cemG(Eh&HR8c&3&j
-`9"SfTe@UR"#S%N5FX-bhJF3j)6UB5%h)1)bG&b6'X89J0adG-(A%`m9-r-YTi!K
-ql2ID1)PM0[l8-"U9UYkLKdT2i-mL`V5*C[YjN@KrcP6r3S$6U3+P%RT'rAEUZ'N
-S0EkK![Zm+14a'18QCcM$PX*9Q@2f,8&+EUQl@K`!b8+E-q$'))Q"d48BG!DS#If
-jcNX*I`%Tdh9bD-`[Eq"bGLfU+LE@b6c9VQ)KN!#RRKMm1aK%Ak@UA&QU%SaFGSC
-TqESF'@,pICPKSh2i1PGd#'B&dmC*-"%3+"0!eXeeAbD)'clY3Y-56&BjL%8[%@A
-9kH)h6QMNVL#I(&BMeR`Xp(f6&Z0b2YVi1U-Q'B(K(AM%k93(qSdmp&iH*h$!'I9
-R#@9#QlhCZReJ-$DC1#(i1h34+',pp`TBa0JcE3"C4-G!N!!S!8%#B"R')TY(PJJ
-Gk)rb8+YK`#&T`1FP!cjhK[dGI24l4Gi36C6&YT)#,33-'hqH6kINd)-EG!G,0Y3
-rNF+'EY$Id0r4KPkpdJheBb2(eqGL8qImjcB9SNKA[("-k0d!FXU2"0GAhTAp[ET
-kDS-hCVrPrDG5Ap9`LiZ)Zf)M-ZD9A#rPYi,K-&q4RkkSP3hj&KFPGh@kaBjS3MV
-d4KBl8K8@e`JlU(--"@F9C!MEXSaMUQ!PdG`h!S3FX4aH%H00"S485L(N-03bM4f
-%#RP[KqH6+#pr&8$cAIHZ$kprc%eeE-SXqbmFlF+469m%2384i[hkpB2[emZMP8,
-'G'T8M4&!ZlA9!Rj#Ajh6kDUjGC51MD[dh868h08bBjbN$UNDkFeAMr"#RXGITJ#
-SDZR3Ci0K0jp*QpBSPE0G&16eT52HfPKTbCq)b&dkR8FS4,"CbUj9'c),JrGX0YR
-6@p'93b4*qQ'3!-)$r@![ih-@'Dk"'JTM3C2bJR&c+5H5(`imG)SjRmmY',hPI9F
-CiZYQ[ch[0HhRVJ)&KRHfDbKdlbYR(2T9!Iqp[ej6ULTFF@r0pD8AK6lq)LA99,*
-!$3AD$#ifh5k!+f8)G%+U5qC+GZ$P)!*`P,Z-HCbkQZB,ARir`NjNIXIAr"YcD&1
-(E&Hi%5jDIU1kJ*VARqYm(%liAGi&8*A0fYZEiDCmd-B#E5,bHYiQKq+e616EjE2
-GFBiUaV'T9Z2lpIIRRq24K(3i[PkQMh)N--V4YAQJ8'PaAmSHL+%E'4llkK8K$S%
-kUU6%`B3+AcQZ&XCjG#KP(f,,([c*+b(G340H8%3)9&@ACiI'qDSVaG0i(Q8(Z0i
-ia"ejRhkcX*!!!deVmaLU3"9X2K[%lc5SP`,eh#qUCrN29-pbK!ij5e36Jiec53d
-P`!ec,&pr!XB(A8cU51LUA3UKP%""L'db[5U3!)LFPcS9m[Ip%hi1"0(b9X3h6I*
-kDaH"qiidQCVcer6U&qHb!T5&&EH*KNT14Daf5K$GN9E,$FY,QbNXchbjmK+@pqb
-PS`IBdBZ-V0i1E&+C2K1TdV1SC'V6bqGTF'jL63%0Am5'rlq21ea@+U`Faj%l(,@
-F%K90kmhFNQDeda)S'6qBPmGp*UmFMAhIcN-$&m5M0100bF4j8RdQL2lc'$9-5LN
-NQX0jl-VhCAEFmRlcGDlc%39'fq+!f+'4",6b"p`e9VYXjjG*YB[Ze(I#L!'Ce9k
-'(Q%cL#249ViIC*4pPq)`"(EQ@NSc,Q,*)J-TNb)T,,`b+A[6i9"0)LN&TjbDcZ8
-4XkNJlYHXlLh`l&,0F-RYcTUC1C!!V[dYpMdTM'!jNM(AUL%@NZU)Tl3ferCiUrE
-mA!G3l9T[k*iVQH`c,0a6NqD)#SDMNG!pVfehK)-dLETGRHeYkp[p5%IKq%6Rc)D
-LR(k2jf44cXa-ZrZ!HdF'5db@'d`S"&QjZ`'*%VK,bGRHF4[RC6P3!p9RK312"mZ
-@I9L%4dc8cY2[,[Yd+3m+TUeF4YSbTTU2IqL0q3*FIZ##qPNcA-Fqfa%HL1cBUdC
-f1)V@qIbEpUkk-"a4+qr,R29GM"HeUYJ1-(*j,E0DH'a5m*QMbP$%QK89!R$2RpY
-lB-mM(f*5[fN,&c`#820*eAVk"L4'j"I``-ELap@&&$a,X)&ERN6p6+MLCmeB6YG
-3(@6JI,dp&kJ)pjF!jrFbcT[f)%BIhB+EZ9JJm)Z9j)*cpmFEeq"MHGV5DS6CYGl
-6#A#fCYQLeb0peXK5E!l'h(hD*4)#00!UelP`FF($$jiaS*dM*F'lrERXbBl#!dA
-D('5#V8J,jdj+N!$rk[l(AL`jQChY55FdaBE&`[1jr#d56Kj*d0G3)$'&9$Zm%N[
-llYcFSZbFd3-dNTMC[eSRP@ER&18Hc8R2034q+j+CAd+"[(&jr,$N'(9`*!+AF-9
-()%P)3,Pfh!3RSLH'4ePd!26eY1#bQbZdZI(h8$@,'AD#p@'BSbHEEDP6A$*)Lf'
-58RK030UhF$FIJ-@C$eecSj,q#M(MBTk&a!+B4E1eeHc$)eCFVG@`MjhL4jqiS&f
-X'0-fXSpaFF#`Z-!RINa2dDX*j+&Tq,I-A,QjJ"hif985Z)LF8JL%-2@XBHX)5f$
-X+bV8Jq&93BLY%&**(R195aIpXf,KIE[aFY"V0L[-CJ86+jKBSC-91P(iJc62BqP
-j46hTlHj#YZXR$9XMTBX)3C%BQXmRe0ja"FQKTm2Q2pc++C`eJMBa`"eC'rG1),!
-qcqrEX1&@hK4J!UeVEpcrHXeC+eGI[p"VAf@'d3TP2+"YFfA&`hP+B59EA-X@4l"
-BH,h'9iHPADXki3L2C-a6@5*`2im(*[DV2+qbK+hbCXhV04"eQ&,8QUEk4IC#aTh
-UKTGk3+MCR6Qb!@LrAmhJ3JQbIeqkV6YGfjYcp-$0lEP(M88-VZYljZHQrmLHRTd
-$H+m-jaQDqY+"MNNNq)#Jb!G`Q5QeCfFSRa+DfXTYMZb%'[NE-aE4DMAbTN-UM-l
-MDYL#E@UbZ(BiiKVmY-+X4b`1LiYYq1i8R!9U6#US'ZNMI$1IZ1lGNQ%+IKV*f9!
-bb&TeL'1Na(EZ2*UaHb9hbf"ELdG"a&"-+*lX*F@626k$NY8qjBAM$-+MU($Nr[1
-XSH,$cdH['5mELdJ+bR8'4BYX,PDd5$d8V3q[9lJV@"Dm-43,[4Uk&0SAI#K5crl
-')QDm-RdbZGj8q`LZLBF,3TDIa$JHUr(h08JUK1BiMla+bf$6lA!kqLAbrZ9,Nj4
-'DedTJd4I`e5rU(3mdLT0!bB#Ba)b-#%@5DlDUdiCQMH%T#'F840rQFG$!8`l#+D
-kFKqFdrLX4Q2HLm"SK$b3!2K%c)4VrZ)bjDGVIMqATX,M-"ep$Ehj8rhCad66`%1
-r'C)C#Hhk*(KY*C8P9r2aNXU%S6*3A&PG-TLV`NLNH(TFarZ@*'KmFRImUQ!!q'`
-!(J9A*[3fS0S!MZ#D(`E!(cLdRQeGD+9E0r3@a&6VXC3f8la%X)qfKQh()KTHDV$
-Y0-,@["DeAGbbDYhYf,*UI'Td0f(,k!'%QkJj@JTSLC8#66,NR0rTNcmHiT!!di#
-[d%294*8,Mr`J4J-'P*frl"L5[APLm989L(Kk%3p"A)QTA5B)(r%4eHje,lX9,Y(
-BfIP)L8%8%Dp!c')%-YE96$0@3c#B3k8l(%Q48j9L&m[,3phX`[rF9G9-lXMq%B3
-#CLNrMT&djh'$L+B`%Bfk$55-B4$$RA"#U%b-JGJPQCD($iV1C%S5+K"-mkA1FC[
-$Z+RB[HY)5X6-2MNlZeGEG1!jch-(MKTk3`JRid@&-bIe$b3LpY#MXH6UK2"30YJ
-[UHV$pGLSlFbK[BJU4PDE("#N40Fa9ChG6b6"D3kjYUa(Ej'YiaM#jePhBref&+,
-QB9Xidf[#ePIM@R[Si)8T&!r5d$G[5XU-aA!a8`S5Cm8[T3d`2)ClC@CQGhC4)Dk
-3!&-dbDAZR-4TmcbqMm[QHBJaprDG0KKfFhTfh,6EU&h*IZ59#&2-X2[%%(XNi5)
-5dNdIB4h+)KMp,Gabq@EHa3@mc$b'Kd(,S(j!(h8)63dSRc3Nh!65bdUfiM'*#-[
-4l-Q-SKdP9(mXh2KK'l@D'L`Nr$Ap'bCd('D"6'%(`(8'U')6Zk#[G@FJp)QS#e'
-[#ijQT"GdC`b25Y)I+KDj-pfC-!0Eq33pHNS$@YmE4`T06bLXIG&Qp-8E"4Y2'+G
-4N!$M6EffH"JrS@MeiENd[GM9+3BQ(m@)5A3j%TllI$hr3-F!`!Qmkh)[Yd"jc*F
-lZ6XUi00GPDM"*A`##[($L-N!!APa$b-Q'i@TH!+%61,(bY4P08h*c%D!GqNVMFF
-D(C-Z2*!!kE-N&F-##9dp)mR$$)3-BF-p0+6+j649,XGe5mJ0Qj5,"diIJ8!qmBp
-&21(EbLeRPa$#i!@%JE$D*5Xm`%KT96X*l'I4`-#"K4iSd+h'Bmd8I)-+'1E9G#K
-0M`[G$56c@l4!-SQm*RHrSGPT%(NC-NPiPRY9p1,mQA,HBrNlRP6KPVrVk"(",`$
-15EirQFjlZ!f[!Gk&ea5hi"APjZ6R009PiBfCQ4cL*+P+-N')aibR"U3bdbNeT"m
-Afbp(F`l-*r6YBS)f"N!aJAimASCAM0*p6+@I(qM(jR1%)C8K2IrLX+f['@TGP!h
-91%!mZ'(#C)3HY[H%mJ3i)CG"J2`8VYIB3,qRe85J1!)h$6kmRk!jm&ZUk'Z)EP*
-0KZEpDc-cf6m#2-5'm$`@Q#%ehiPCXfL-jK8E)h(BC!C"8633dJ#3!(f-MQZ)k9'
-4+f0V@1!G@cR$'Q*i914)3qkQ9*3*kU[CamaNZEkCe25&-hd'-hPhD62CQj)-V@C
-6XCN-cdLKJ,mAYfTQkG(*QD-C'HN(CQEqlf61C,Yi$AEP@E6dq'61I!1UP&j#L#i
-YfEh5*DTaMl@[J5e"BmViA2E4R++V,0NT,DREV@I[$'XiFeSi@l3[!6'iJ*I!B`X
-Y,9SbiRfl&mr-j"E&RcX*lM2aM25P4c0QdTFZ!4-ZT4h4N!#SKCY&$54j@1hSEN"
-iQd`TACD`faffbfAFl9P[[5!IjRC2L(hX&$rb2%fU[8P"d+!Ek9&%%K82""XmVN@
-0"1DBHbQ1IhL"d$&b5V6mFN%m*UCUGbZD&4pjeXQYr#A2lANmfU4'FK15F+4TY44
-BhVR'S@fqaZ%,iZQbPcbVe!iehc!&'l4,HTNdRK+@2V2e3V6&@L15R-"3)K`9M46
-8D#pHbUk53191D3'@lL`qCX[G,1eVp64Z1acI(&9-NH)V5Laam&I$N!!r'0#&kGX
--"E3Ic5d5%4lSUGe*SE))kd)J"S8bKZB1p#0`GX`3rQ9!1cCJd$N'ThQ,IT!!T9L
-jYFULEkY8I&UPiT+KJX3,28C[P`5a1*eM,2K%`Bq-8-'548(UHMA4NN-@NPM-BKF
-GkkHhmE"Ia&@3!$[RVK,#Y4'ipH@F1AG[I0["PK38ZaM*m&Q@8,ViZK0h8-"FU"Z
-0dB(qdJ'rhp"4X&5`UjF(UiDlXJBN"!f%eT6"Y46'[fj4I4e!CEqh`iZ+@IN(3Yi
-)rU8&`Lk55!$cpeUT#e2L!X31&B%pNIfFKBLdHq5(d[iapl+GKp'KUUL-S9)`j@H
-I5rQV"'k@L*HB9J1MfQLL%-P`f0ca9a5XfH8Q+pca'S4$QUFbl6GS$kYrHI0601,
--8aHfEH(K!i*[)3mRLD`&,%85D1@Q0%D@aP6K58$X9NHk+"6`,2j9KYVjC+Q!482
-)!"'!X!'PN!!hDN`"(S`["FS'ie-SK1+Y30P'J$@8T+N@iM'1j6F-h'(M%AFr&N3
-mK0iK6`V"YiN!MJG[jQ&HKQDRQUa!U%+C*3FGT#aYdJe2SMX0&`D*3%8S&6UCN!#
-#)FPPL)A(J'B)#MJBkPl#'pQRKVfk94-*FY,f`LKmBplDiAZLEM6cR80elj52&Mk
-alhHfdCUkTh%@Fhp`b221k,lMhGZ2fcj%cF4M(efdeB`QE#eCSlFqAc[kj*rZrA$
-9RrpfejQ,&bmHH[r1dEZA2AVXZdh22*krr2FfZfhMSESpYUX2,EFe(+UcG66822h
-G,cHh2(@miBfIAYN+!!"(DN&%3e)$!(VJ%&80C&B"%$%elNAr[fh1-9FC-ZaLV2i
-bPQ84RhHKLEA%i*JLbl"UTU@'FQ#PX&QLXN-mAJmIElU"2'q!jP$#5HQjZId5QT1
-U9#A2HbKI5h)-d)45$YHN0!&+%mSK+D@%FJNPKSTlrrjq[cf[K[6fHcr2rrIc!"Z
-YTbJRJL!)J%!dcjH+4h8k[-6P,8i'd"qrJ-a9XX3A%@"*9MiG6"K')#U9T-H5N[q
-rSrK8*6e3YQRQpCN2TE65rT*pdNPT[mcX84KCHP-9P$&ec,!jZ&eApN%NBIKkqY&
-j)8R6&E0+@UKSp"Qq3"`r)5Jc6$-[J!8QJm0L9JDdi!)3b[@Fq8X89QD2G%LHM*2
-)H)kDKJ+4R$UKaU,-SPH[2RP#K%aRSE6TPBT&A,)(r*&L)!R9#0!*0RqR51iBQmV
-$T%`M)V`kjNrX0bCq2ceJ0IN$$JaSPkk)d2aL%ESH5Z`20Yp4T$dCl&MJ+pb#aM%
-6KJhBRdNhA"Aal-TRjdPG,LaK@DmXkl&F4-Yk&bk'5-JeK+Ck93AcXPk%-'&$l3R
-GiQI5(4d[&c&*Rpf4kJ*6eH2kXH[(5R0T8-GCBR4NGUGmf+$8&8MbF@$CR,)emB(
-cdG5jpU[a4G!KYIZ3!&#YFiAkNmNN-kGY,$5TAQKU+ehD`NUAb3a4jNeQ`',`UC%
-ZI(lb"&M*PBH`U9i%TLeA$*AC8K*J-H4-@N044,JU+l10p5-G6(!Pd6TG3cE51+r
-S6TUGk0*VU)m$55ceBG"H'V6CFP#CP5RDQXCc3b)jq"p5ea2QbJaD(*U`U$AP"S#
-5`)EcJj9J!Bj0RJaXDKMLL3Q4DVq,YeKEH3LLbeN6,K$30p9@mVCk5Y,j3PM-$Kb
-B!(UprrI"`@+l16JS'aRp68bSNR4-chIK)XcJG3B"m"U*cDR'`HBd#h'UU%GBES@
-C[`KHHP`3a4`cLqh-IQdrS0@m&)TRI`eXE"2q1d5,5##I-LTFTVSIQ'+2MJLM"Y(
-pX6T%8iJ1a#4%@a(pBU`0d5&%Xf0f4*1)TXG#)d#3!*BAFi1+!dJ#$)kY)*3T8$G
-L649@QK,l`B$V!fUc5N2cAldH5TN1EI-XN!!ABeZC*CrkAi3QNZk"@PPY5)JIUVp
-Q'R3f$ATMa!VbQj3KSrpMQr$(($PA4A0-2kpB*'2qP-PSYcMJ!DNK%(FIdMU"SFe
-CIERa%3J4`SrAN!")IJmCIl#@pQIZcG`,SDG0-bkf5qZIQkSVdk`2Aa&Y30hqXA'
-Kqp$-8Dd[XIml4BHfBD*m+EfV46PmN5AU#fkGI$55b@iU9[@"YUBk9Gpd4AdrZr,
-jF%TNTJIm6rDTHM3f8f2cLaUEd6K%M8-[DKb5kQ33F3Jl!8UX*9@RRJTBQcc1b4&
-jFSpkbRe&A4SQ%$0+k)&5dK"T4P%0&H6Uh$D"!R)S&MHK)C!!41'GCLJbaU9aR5l
-rHDF#!N$)a6ZcZV%j3i()iNKr4*L4H$0XNrbXmJ8,cQj-5LpV2h)j-NkE6N2Bp%4
-Ac[(&YNC#Zh)PIdBZ!PDcp(,*4kkEmQGXHG!cc5H&-*fDZ+[m'9XHFDT!dLa*#m"
-a'1SpRa,$lDcpLZJ5SFad-0HrBa5HLi`#15!qPJG1H#Hr""3H$L$mak$U2rK,%HV
-EaJL@Pl5q'Bh*+k*G*!**83b1LP$MED[Y(L%&((Jp"99[IVl(M[8$RCKJYNei+K$
-(kq%BG`0-UI%JL`LV8bUffT,dL2DBPCDZ#*8@ila)KdJmL![NjU3!BT8-pk(!b!Q
-ICH,2[dp%@@#4"rC0R$V-,,6`H@ALX(ZL'4-e9d5#96+VG)`D9Tk9Qb3d19CI-N0
-&fFB,`NF,4Lc%JfC[X4T2VXE&iX%NIi!NUM`j+0N@j-N1QXbN8[(TjmmRla-A96e
-HBfScAMI8)E`'e$Dm-Y8@1&E%eABJfhr%`P(e&&iPDMCH4PAlf(f3!'[1iG@MMZ-
-98irLG9deif95ac#T9ah&+k8fiP@RAX4J(5UVcRXSfDjH#S2TA+bkk2-qJpPPYRe
-@JqhXr#Ld44YrCr"H93hddF44Sa#PG$%qb%8(pDSAj3XSaie"4%JCc)DLamad`BK
-UaP+GXZ6#8ShDXjZhdJ[LDk"(e1dfUiFa9&E)D#S1'30QI"`2AHI0K3SFUd0#YfU
-h1940"l3(@SMd53a4'#SdaRIRL9#S%*m&SIZ#`IcF*mfKBCPS3!MC!B10G$(e&#H
--2*ak6KQZ98NF([!qp5rbJ1TIm2NVp4NH-,miG2e*XhVmb4l2*3`cl"R"+qUTCe@
-J$9%-+Q,j8*k!X[T2VLVGp-CD,UVP`&D'E+KSF6PH38$8hAY`K@lcc2!B)jbiaQ-
-8b9E6QCK9,YErA0c)4ASmZ"!0ISM#CESF"&[pKLV4$,(k(HUmCNc%4(X9a1TY!20
-GmV#eKh8VQ,NC&lVPVl!DH`Q,iEM+aJM%EmN2iAhjr*1hp*,RCLl%Tq9j+Jrf53L
-(V0$0JE2$LXMqPlH+U,6ri(B4V8[qilj8adB8RIKTaK$,CjmmM!kCqc,hMDdH,M2
-ei3Sek$C(fQqrqGri&iL2!)fdKdeA4%FJ16DH$lHBGMf"MKqLUa8r$[cBmF20caY
-&I#Z+jVD!#`Lb$F&8`m(81SmrJ6bUG)ZD")+i"U,m&4'rP*r[E4*"$6*SH[`d3h&
-!L0Lk#m%jqXTpb-V2Fpe(5%'b$9E0Rrm6Jme'Xi3-l$`HP+ljCebc9qi'0XULi6J
-j#2c*1N[i!5)G3*EhLD3DabX1P)QA#!(Jp"5BQp8@[)BSU,G48'p"8"r@[81!e#R
-mcN**&P[!mTdD'+m&F1PH#qVQca,4Q0k**)eKG(b0N!""LT!!34f"G+0k,[2)m52
-"jSfqf6lM964%U6P&c5MJGR0J+m'V9ReQ0hA!UdRpbpqZUL@ke`0K1E'$cIPl*A2
-I0Y@)j'V8[6kMN5DmLFmkYH45FljhI4%e[CR[6CPaf$i6J$b@-X9M83dF[Ja&mh-
-,`jbK*[!--AKf3,d*N!##bP%$Y`GffPQH$`E0G"1#4NPkS*QATD3d!!E1p"Q0r*N
-bV*qkFCmbH"5$G`Epmh`(*JhXRqFF'!(B3iKb6e#0fZG!G0jpA*8S'bcYIMqTiM0
-+Re(q0$UNJD`MMf9LLKb*PKal*PIUZ!N!32"1Q+kUd3"BeCSk9FS[9K0BM,b#4Ge
-m@ScL3p*9)C1*#AIk8JFhHY(3U*Z2T8CGeCfqpHr1hSG*RET"kY#*)&BFlEK@TAX
-RGI"0hbd'TN8SC*ImIS@ZZ0U!,#1"(UEiD+$"QdaDE(rp&k5'"c%3N8%#'9T0ZF1
-6L1"jc8N%"T!!)J!)6d"3AqiBHVN)!D`YJaf[CY0V'lp#0i`LY(HL%133X53ki9U
-KB@H4adPUc`A4,KjSQA5SfANS5'Qr@D9Em50d"[*BT&ZZ*)"G'ZMEUY0*rKQ0'8G
-5!bDV%`eir0M1e&J,&BY3f3BFFZ&bk5+jcb`haS-*MM#DQ8I"$+KVN6%qXKkAQcS
-+F30"1m6&2GJ6LcKS1kl0`bFAj-jJ'TTCV`E6C-%"BN0Bf5b+p)$L&!+a+&3[G[H
-S0FL%lifDqRkU0V,$$[qRJ'#PaD214EUd8,@fD`Ze&i%V%6,L&D(LU5C8`-%UG*@
-$9HJq,Y4#eAJp(#S-ei@ZSSX9BY2&[QfK5b`@cfK%4M[d3XNJYM2j#HKEQIK"2a2
-&R36U1j`%4Mde,1*'%(bEjfb3!!B@a5mim%dD@,)0,%dD1+B-,%dD@-,!fKF0'kG
-KEp#JcEC"QbF01U3-f[cL33RTKi%)&J9BX'kM4,9Rjc5rSl$'5Kq%Ha54Iic%J5M
-3!mMQZC5rP`Yh+YCETEV3X,0S0MCE6P'2-cU*X)-U3$T@!%fV'V-#PI@5i`f+(rj
-iZBL"!NMhmaD"BQ`k&pQ'UfSF)Z2dIL#eTJC%2iHJhmDCDJDk&DGi+&bb,@E0DG4
-p(QMHM5PU,aIY$SM1((#%lPDF&*`k-)LR3eaZjq#`Z`ICAKb!M(1MEMU'XX0Y$4R
-R@,+T26[RrV55G,N)9iVYB9f1%[4k0"i,eYpQCMT`0RDL'!&Q!aAa)0C`i"`,"*,
-Ti2E3*D$E&Bc#3i@"CJ8T$(dG'39M'k1+S)")G49*a!iMbrP$2Yj*@!6ajFaNX5A
-UH4$qH+$%HB"UG"kJrZ@&$P",h!HS*Fi$e10!X0V*"d`J3BmP!CbX#Cf,K5``ZXJ
-aJef1S*!!YMBfL[#)$ZbDZUD1IRp62$YRfCD83@T!3L%6+@GBqqlNl'Td!fGA,d*
-*$PDPm+"!%md[&kA-Z$K[32m04TFKS*)jF%BQB5Bd$kcb5`GPaF[PB"!AITZZH&E
-Ub$q$cleS2#H$I1K)82ep85b2!3NrFqb0%%PZ"X+)D""a)2)8)NP%(YEGK)!Ac$r
-'))KK0[-(XeEaXa8,ldQpm`I&UGYq$23H#2kQJAmi`c1XZ`CRL!mYXcD)3%AEF"S
-E$MGe01RPKHA*-8(C(+XLjYUEp-aqATSc*SkR[bK3#h@c#aPVS+Ihr[L&Ekl$)-m
-JD#E!3'PRXN)Xl4`6#*,2%2Jc3k89"Hmf@a'm!m@RK-L'VkIhqp%p+lYbHCUQ5bj
-1XD8M!2`Mc"a0'CK40GD9P4ic)dJFZA@$Zi!eTH*5LI`cc2"EAMc@&BXU3aeT@Sf
-P(@0GcSNBLSF["VZf,aDM)YS91%q&U-[bU-K21LUbeU1X,hJ8YSlYqC!!)*Ri'F#
-2!6mpB+0ST2h-f+h0d'@#5GQ!$R2"S$5!DGJQ$9"6PQi!6ADPUBF)fmJ4h3"q$2M
-*C$)hkEZBZ8!J[1*H!Z!)LY6p-qZB!BR"kSMX9P,rlm1("2%0#LcT#!VN"TTk3CP
-k!D54%#4DJ9am("L!D29bm#"%&QE'K59UN9PPV&6!pDc-D'fU%pHGV!Yi3QB"*CS
-T)h1C!%Z+fEQ*PeEdC+CE-Vk)iF"S#U`aCRB!4GM%IJ3aU$28b%J3VqL)KJIBHY3
-NQ)9*D$dTLjahq5)!8FP[#D3"!bqSF21-M4&+RiM'GAaYlLlLr3+XaABN+G`lp6X
--4AIjH-2'T0aX-AJ5`X'3!#cHbB*GLIG1heeH4BKLT(!82pRi-4S[6EV1J@$L,Kp
-[i*G[d`Dd9&30%-+pbL,cA6lMd8QG'NY1'ZXQ,EB%*8be6PVf"j[[mNNH5lBXXiJ
-ZMUYMdXZ*Ki4$SfBF*,CD@)l'&Pe`#FG%KK,)EcIkY4pTpeVA"**K4m$rQMq`c1%
-`q)C#"ZmeXdD0Z0P8(Hj13+X1Z@2'XB!pM-j@G*iA#QbPcQZFRHZF,+BCl'3lS[Y
-kHZFmrIP`&cc&i3J1e$L$+LA!cBL3!2Y'4"r!mTaJFSEaKJJNqcXH[NG[00EeX`#
-!!Ja*0Q2`L5lrQR[dja%),CB4025$,@0GFL1$VY-&9eINc(J6iT@chY1i1pKY`lT
-TM)L1XQ)!bdE4-Fr@9)5QdU0Je(GmBPRdN!"JALbid#VMc,3IQ@P@ANNHbMjAkBU
-3!)&Ze"AG2-R&'Lki2$[RlP,1f%3-FYBQCTHCm8HlF+!"KIPdh3UjN!!lbYQL-I[
-#M*HcRN+"F6-eF&QeIqA5`#rq8qM4e'V,@MBc%qj*bNa#b25c%N#Y`dmMILi#a)B
-8CC!!`pJ5E%29J#5pl%Bl1MQFRb4Q$5PCDcm(r)lcA#5`LN1IQ6S"4qq&iehXc-m
-**QH!daiG%h,bfIYd1Q66K,T6lL#GH1X,XG"P11YecfB(picEj3'ZFN%$9@KBiI%
-T%)d3-jeS-0*eUec+H+`!`Da9bRJb%a8H#V#CF&!r$pNK,"8)[HJ-1ZEjUQmJ%pQ
-U-1EM"fTXM2N%rMIMIaXbbmeJ4iC%Uj%M(BM%j3AAMi'DJ1Lf$i&&fASmh4KfA3@
-MjDVJ5"YqV2KTK@+K%dlXhhhKCN5L8%)akNKNjfbVEKVri[lErbC[N6H)BU31'd`
-jYbGeiF#SP!%4,m%S4%4R02)4SSjjMkkV+PFD'AGGqRqq-B&-#3`L#DiiTEU('J#
-JiCm9c,%)$i,Z+I`NL0#r+ZqE-!5Mmai-)9N1JDi*lXTG2L[rYqS*AGUi!*J`1F@
-664d"2j,c(r[MhE-KkR`j08$XRqX!&iHKm&dlJmcAlM@C[`(@4&KFGZ6j'Ab-VCS
-1lD'f(`S"*UkQN!"CZGqkTEL`6a93%5Dj8JJ3dJCm)-q'SCJPBm9J"5CcCMS!rp'
-a+q)!-R3()PI%H63H`*(AqEM31r`CI&pQed#!AJ''qA8Xj)*CFjfB03LD6QC0D1Y
-4,SUL%&jf,N$(32)SC369,ED!T%9@,)1#8KB&TH1#@DmP##,A1BKmHm#`hHK-%%j
-@*5KHj1#)M'('*8H4&f`m)bUef,(Cmaamq!I%hSaU&''jS5KYBN2!(US6Ia8U-fq
--RG*!jK&h!*(C%`Jd!b@mh"PXIV"Bf1N`#CR3FB9pN9!L+96MXjIiN!$YDD5L,!(
-KZK'I&qNc439EJJZf[cZ(B6CeSp)p!KF*L%-$ik-%JPNRll!m,(N("X224@+4CJ5
-B$Gc+J!qP9hchqjU%YNm'IUl+m+D[F1X0I'J2MA9SqU6NK'XhD`kPNV`S$`LPP2e
-kr#Lc4"+SeL3MUaC'9L4mq&RG)LHcbUkbECDCTahj*HNb'PH%Y'Q+N!!'GJT8YP#
-"Dmk!9I8RYhK6GXSThSaX)L%J#mLc&cqZEl"#I4c$)8JDKXY1FA%"NE!1Pi!J4!+
-3!#`)fG&mcP)3H[U5,!K092NCIQYRaaZUH0&hrl[9l$!lDT8k-Sj"3F2-4hm#1K9
-(1"Tkba[b8L@3!)GEK1&G+E6$*eF+H4fZlh+(@2jSlX!p$Se&3DFj+PIkDiBkTq8
-ITZF*8fk-eGe#ABj0X-Mc(QrK4KH8,k`JI`p0-d#BS8"b(NMmFk(QTP#"C["rrEJ
-A49D4C[b$bZrf`UfTL*80d[LYcb3*PCLQIe!Ch8X+lE0"4a'62NmD(bQFd(JdU&,
-6Q$4qk4H&PNd*Ce9!&*26Epk-qh3k!AaP2iEUPH*@21GNG5M9dH54(5@iS,c4*HQ
-cS(Jc(3U%GTk8p0L5ZX"A[FQdKjQLVA#PL*P5IQFAGU`)k*hUlSPG%*AF8q8T'&S
-TN!"[S%!@#dha3$0PNUB"I$S(rjAF+4iL*[TKG`CFk&(mDm(!d-"pD2QmNpIpb*)
-Ul)dE8"df066*iXN+&*V*f8"B'')*)dM6SCJIb6*e`N'5FY#&IjKZG+!c!rJ3-Q1
-EUFSMXUPVR`iQ-$+!b&3MF49JIdm'GNd(9!p1YX"'Td-3XXEXmZAijVSrIZ'Sji(
-$$r4G9V0clXN#m+(S0[80Yb,Vbq!J3LJiXh1qDSE)0a6G@j+1!N$r0khZ!FH3!-)
-LdBFEG3q%r1*RaTE*MJ0K-,*iNY@RD6F8!F`fj[ZiJNFMR0([rPG0(lXVSR!CSUT
-SC9h)2(leA!X(&VfT!mT5IibVG6C`"N+h1$YRdpb8S55G&jb*#U"p@l,(p-`DfI6
-P#$IE*c3E-9!E"LpYDN"P!$J@2-e94j&jTFUJ%0EBKDNTcUL%,V%,cXSF1,E,RH"
-%-"-C-DJHG&[Kd)),L5heF2l3HH%HC!!ClVNX)#lZS-il))BZ)9E328"'GQB&X3[
-"2-T5a+6,DMd)HbX-"m`G8Up$BaEcKjMBfMhDRRPpKAc)$N*F1l#C-*Jq(B&B[8M
-X4q@p*HLS-3h&%KU`caQ"A[0*kX&Y3S9)%CV4D#d64IMaDIZbHL#-Bm!&2F2jP(c
-R0Af4*$28[q56%a"CJN`+'$h5rUL*'8jJcc&+CA'q$5T&1GP6YSk'54he8Ur5%8i
--b%3QQ4hhT3*1'(bJD2l5F6KIj(aee`4f&$QLJ4AMH&YmFpfBripIS))h$8%"&HB
-f2F#98#'3!+HCHSCEkjf!PmQ!Yh'U"H!GC@6CiR"d++"R4e5)Rh'@cYJj'IKiQDG
-a*cL-)LRUQ)'b9HUiQbSC)D1H&Q$J@1Ek-5VZ)31im3&d5Q2`Bb$6p$!"0KV@!R3
-,0$d5CAqLqfFdML#46$fhc*`i05,$a`P8TllTUdiKkeN8Nq`NjXA#5$"@LDY5r1D
-a$#M%A5dC2GSq5V#qHAh$43bkFJ@@p9[@!XSZU2f8J,$q09ElmB,&K'JE0[(bP-#
-BIEJG&B)#M36#pRj')'!S2(hp"JHXjPJE#+dMSXc9q9l*imP`'L4bJ"&`-YBkZD2
-*6"e4*FbB583cb9@FQ8"0$4C"TefThL`((R4qGRCG9k!9JrC5FMZ2pGU1IAZ8JCZ
-6q`!kPfERE0Ji#Ga-82UBf2N3!(H8!&92J(U6UR"beiLQ*d@JZZ(,NcVE+BP-NSH
-"&@#&bN@-+$E-CH,+J,YK[KY`0hc#J2ZP'ShI8Kb!baa91VXX8)3@UqmVKHJ3#4m
-Sh"m`M4,c$-TC2p$+NY49pAf!5c15[80NACHAGf'TMUH,R6`)-RiYF#**2QP3hjH
-6F,4,'5$RXTUR`LQ&R8`d+@B@&+6UK0&i3#BdL4LHb3,',iG'C8C,,`XQQ(#9"R$
-)9iYTZ!-%e#``B$i'Uk"aU9&@*%,%4JBelChmUU9IZFYRkSR&&a5$PEJ383P((9F
-Z%SB!I0c8!G%e6*[BK-$BM'*),q'JQ4FJhVl24,0EZ,YeMXU13C`G6#MC4a409i5
-VkBVSD@TJmCBckCaeK%"afTCaR-i&HBXYkrKbqX%#"'[IB"F08c%+!5$@D1r4Q31
-4$eSL"VFTJ4HB2M$c#@c(LS,6JDVMel#"bZG((c&`)PKQDYc1HVU&cL5hc2cHk#,
-"c`@bp)$j0Lim&YGIJ#*J*YcT2hhPUR$TLS(8jYGH&6fkD4!#&JCAcM#kXm@R+)2
-%fe-UaPYF1R8#B-+&,E%q8I6E'TYULjCdcb*3YD*"6TC)+bFJ-Z[GPA)f(*QS1'r
-)b0[kjX4,@9a)2m2Bhm&EYNp`6b5'(LG[[XQ-`-0UX0j8lC6U51f8i"AYP1SV8*0
--#FUL"4"$MVKS-Km(5&cT3f22P#"-E441UBDbl8B`K+be(JejD2#aii10+EqXbF0
-$+&-GF[8$&YhAa-$m@!CA69CAP6N(@l@#83RrB%S2@#Z,&`"a!+KEkB+G*J6`30Z
-9`LRP8h,aUTqbp`U'Q9+1`q[GeEV"X1++D+`q(XMmb''G(kCUe2'hrR4lF9#0R(#
-c0CN)lJZZ#L)V!*)iTNZe8mVIZSCAr9[&3QEhSQ&9*V%eL4b16rPD0VEQ0KU-K63
-f,E#Cf6$%D&59T6)j%TU2b$Ej`l--bE10#`Ji9U'+El"M4Q-rh-18,PrQ!1iqJ+[
-#-ZX0`FbU6#PJTh!jqd%,Xj9$"L`119+2bUL(F"#'Dc%k(%2cIkJ4R'QIbQ*)(fA
-*89$12hClPmAK8BIrH,UlbU[XIKG'"JaJi'09[f!A,$m8hDUNIY$*JRH!&9e$8C1
-Xb14Ahh*b[V6,(@Bd'ZVp("LCjCaN&6pFjr5-KTrSBD4eCApP&X6DVJQ1cieFD8b
-`1bP3@DZ0J3RP@&DJQC+&QTlS2-k1TPN6%aD-J`)q-,'ASd#P3pQ9%-5d6q8&$Pd
-!TjLMIrf[@4p"b%CdGXkQ0'60%(9Fc"S49Pc+iFkkb8",e@D5%ipK!Cf(IRi[!fG
-*qUdNS4b),j,*PRc%KQ53!)3kbMi1FJ6l8eQ4eIFHQFVUrALGq1hHkhiYR%DNMYr
-ZPE)H[#Qc53,edQ(Y'BeIfa20@Re6K1dp`K`lIPR8#lMD&#@b1-ZBiLcMaG%@GYC
-#SP`FID)mI(IhD4mY2rkl[6i[9qk!5rh&F$MAPcTGXNplU+3(KM`FYppK4UH8"6B
-+-dcXp8![#RYQVi8J0pqCJC!!Y,@CZK9iJ4%""9krT+eah2[a1PpYVfiq+Lb0kYk
-XYQ[L-0XabX+U88mIpIb"bK*F'I!e",-M(*!!dPB!C5l+%`J!#j!!)5KP!5bPC9,
-3GRjSfmi2,EEc3pYfiYM1$hNlB!+95UG,UR5PU+UbU+3AefM@,EVp'MDf30,+'e-
-ICA8BLjfCk4%Y+B,58N*ke*k8Xp6NS&(fZ#pF%KQ5HL60H(,(AXZQ'R@0,ra-hC!
-!G)JEA@D$@@jHibXiecJN(HCPYp%',2m&PdNV`B'iMPqAGRZ2"6(KMVmUc!8P""G
-l1Hb@4-$UA$hI8')30d,D3iCImfG*5BNB$fAe'YlMci+5!R%dG1U`iA2qV#q"le+
-S"+jb-"Z#KDNP8l&`cNaCV6+B"K+VjbG,`PJm,Lq@@LkHPaFAZaFcAABS"JU&EX6
-eX!6%(9kQA(8ZNMh-ef53!'pdT'!QSLk#6#4-U%LHAPr4fDKRcV(6[YVRG&[[r&(
-FHmI96qSIm%VYpBp[(ibdrrA)AYq'Nj)I%ip&rA01BZ+[3)c51lZ&2qlGr[R[6fh
-b5[&,eTf$dALjR4-iGI#1D9)$1Tb-0Xc*T3j*h64d5-Dp#5RiTBeHU50[eGE"QSl
-b0AGA(I&YfLI&-6dAdmr5G,XZ(p2YFHqlEfaHFCGAmPc@EaZXmj5hh9fjalF4#YP
-HAl5Kb"[Y8$SiG*[3`4(hrMP[9F8'Vq3IHIcH`C6rVr[1qZik0Q',-*DPfil*eVM
-hm*RhkZji9fTiflTLX,%"9krif2I!5DQG0YUZE$5-DNIG)Kch$QTk9p0'9p&'ebJ
-ErGbfd628S99AK!kYFHr5hRp3DD0kfQLEa8E2f$BUkGCKZK6hrXShH`0[P%MZ)C+
-ICC,60[h+p)4Z!kBRiYjp2FpAF!)4dGYPSU1#IpPkaC!!!'dB%BAi%GdZG)c%[6V
-GApkL,DqL,DqK,A1RGL*rqaam8*FDh6*dUBPl2cTqacZmE8U!Z*)!CcJ"LYJ33iH
-bEBeZ,MTSiYllEUk*VM8"cYJ5i&(G9%aq&#5DrFq[rPfj-Qd&%ANcNB2VTdMfAP5
-b39,BPD3Be@e"ap'ipp0rkrZBYVq+YZp-LR@F&)f#%b0KRh1D1ShVGU$6H0clmQ[
-*TpD5(!hBYTh*LiT%TA([SXiR$e!b2-(*m%Xj'H+8B,NdDA(F@f4qhEcqAFPqk6F
-ihPkqNSq2([cl0!@%9bV$,BYl8qI228IN(L*b0a1j2k*NKD1he&k8kr1b%d$Fpp-
-&RaG[mS(-GL+c95(c5L,F5LBFKY`Hppl9j2Kh)Zm660jIbZ59!GE$5B&TZq,H8)m
-eiqr[5L[TLL[P+a**1`K8lFU!1q,H$4rFkb95$K%TQjA0V1-NBbF[D@A45EVNTVM
-[YhrrfY502T!!d%iNY")*2q*NSZhBLml5e!eahe1rqkpl@D%jJB`V#5KA+S6F%[G
-1q9llAC-*5BM$!K9JDRlFZrJl2cM$'b*#VP3)Z8m1(KD%A"Ih(6TR[AmYK'a3!Tf
-mmDPaErFrrE6Mri+3!02LhV+rIVH8%j!!VYKJ5fSR)Cd*8a6h"Qk&eM-KmiC!(#D
-N6"b23Tbi3XDjFGrhk`Ef-"RVl5!1Nr%VFP"r!e2ImXV*V&[b,4FK[9C'HMrp2MB
-"emAriB['DFUkZ2I-2brb8K,[TL4Z8)MhDkRK$lkSRkB"!![rrep%1I"b-GFB0aa
-f(5E#Y8FEA[G&1fJD%Q,ThD0f)XC+*NEjEqkH"A+FN6cr![,5*!5-6plCeX2"Tlk
-9Vre6T8$i[5rD6P-faEhl(rMrZSPBZiPB$ECJX4)App!d%'V4(rBEQ9"mTCTf3kq
-VP`J9MkjmhAPa!2!lrc)h5!4B58Mr0dkNEb-5NM$brllp(PflPDrp8`A4r-&*T+e
-allB2(PP#B,1E`+E"LGjrlp`m3'[,AcA(R#5+aJd(A3ITfTp,+rr&H@d%HIrH[h8
-3mPK*S2mE*ARPDmXNf"$hVYq5rbe#(N`Ncdq26%VBZA([[9rkjYd8h(C6F'Y`&j@
-fa%@Jl*U49mSATf4E15RCC#)"1+GpjG4Y3X`V#G4ri`Cehc(P8L$#iSHL285Q&LE
-6r6C!pje8L)"%kD[6rC'5VSf56Qq*,U,fd`M)Ve1eq,K[eX),2hi!!Hl5'YV!UJR
-SBL@QfQRUpVL[l0@Chb*Nd8!Nfqe'&VkcES,FrXXc8iKN,8bbqff)`THVN!!$5I5
-[pRAA#%fd%CV3@k+*D!-1pG1KZk"kq1[Lrq2[48M`0C6JUpaS`RI'$FV(F[rp35*
-F!a&ZpeS)K`"fDr$Yp*p)1#48@Xfp1bB6cSNHL"`bi4E(IGp9qka-Z,`eK"j@ZG'
-$M4`!kHcNQJmSN!!e%'VBVD!'5i)JS$fImICT#K`Y($MZPj&$R+j[#rK[h&Mq')2
-35"ZZ[a*AQd8Em&YX!#"8GmHGIf"5%-(L#X&1m[9"-)m6V(pjpZmrBP*38[U9T$c
-cTCYI(46qH`C&mSj"BBHJ@6V*35-j)S+V)2)2EII1!HY@fiI-3G&6AVp`Y&aD9H4
-pb[HSd2ECqb#XEUJAPe&r"1+ebJjXc)5pY1UDldl[h4mGZRr+ZZqmDp3c`jFqLU6
-9ZrCH@[@Shc!R&FSmIHld0#m2R0$8L,[hj2S5Th&S`jdRjrKUe+LQ9Hck+1%jIRU
-D6jRJrGfHBpHLRP1i8U-bS9brjD4lJX(PF['86%b*((31SE8B)KMqAI'aI`cfAeT
-9[K*G[G(92rhSp2`D-FHAm&jDPI"Ni8T43r6KDZ&Xq0e(*kpKHM00Khe@C`-M'fj
-+H(JEdBIAfCT`52I*DeR(N!#ekd%@%H*mfLk,6!Ha8q3-V'L4@5YUA'%Ei%2XYA3
-K8M,XMbYC)&3(NRcZ"DS3G01pJ#T"&TrHfHk2Ek[M'UAMcFPAN!$@Z,08ML*TM6[
-EaCr1$"Sq(RF[IeXGP#-G2MGMSiYC+P$(6PQA@TfR4MhPAEZkjjbYm@`kHm3,&`6
-rC6AUap+a1[r'BhZmEd2pZRd[JPXV"cITmEGbJre&Z3I[Rck3!0,B4E!rkYrad4c
-I`IZR$TbGhbULIYG"`d&HH%pC+!pM-#a-Si9)4r6aeh0jJ#pJ`A+!2ddDi(0P3Hl
-qDlPl[+DMc[rlBpV$pX18LBY*(6[h4M[+Z`MT[5[&m4QR$qr!28Qh-jpG8VBFH4N
-Z(ElSKYIAh9jL`4DE0%&DEcP"9im+Um6-B$0e!+*k-%DQeqDT&`i&G+@eH4r0qUq
-r%N12`+ZX%kB65RmcV(Y@U(JY%5'm[LBmH*8*2ej,43GHD5+1PdkdMl!$YGiB5Hb
-(%i(GB@9PceXYVPB+r-PU[mNDf`D'+"Zm5Sf!BB'&,A"Rc&FZ%Ld"fkT9BG(S&V%
-C3kl55&8E&9BIe(hk*Mm8T@G0T"i*k,[B#2*&X2MK`+!C5JQSrC0FC4fUb)Y`R`M
-*3!-Q4TVG,"UK*US6cEbS#KM!8bESf$922!EPlqKF%F*")6TNQ!BI"AX8lV"fGL4
-,LcP-YE1@J)Nm2`-40!bLi3Nd*&hb!S`$`9X198B4JEYNl*cl`%"f8(`36E&ck4*
-ff@NDccT8NSA0,qPH+X(&3EI%lB+8kV+IP"h18l,$H8EIrE1qaUU4*rTQ,@&h8'-
-0MZM5TGe+f'Z&EYD5kfeDA!%"%kq$pmpDXUD+e@R'1*1YHfS6Xd(p"YQeH*'KX$L
-Vqr[dLVLdVLb&L(jANlLS'(-X"j[d90SL`h"Df@!jXr%'2i-LLUX*LINiiRUR&P'
-U0X5-),&QV[K[B@Zq[G2Tj)%"PZ$(iXM"$rM9K'Y"TG#YU5dqC5M+m[@MXReaLD(
-S'iJ1[ST,LX&F0RQ*b"%SqXd2&Q*L2C6k"fL3!"RiH'S35LKFlc1kEK`JXa9%C5E
-ZXX&b9(&1T%i`ST39-Ghl1)%-pHa+#V0Bl5"bHF,3K'h"G9SQ$60jYl*KJHl[bi[
-pV'kZIH-k,E*a1E!bhbKJ)RErL!X`*CP$51ClQH5%!,P+NS#lQ,ll*&MpADai'ra
--RXE+K*H,%LG55Q"-@qaNj,I99[aF*MAm`!XVZETeK"aCh+lVTk&1rC!!'dd4pG@
-!#a1qVLK9aq3Z--%k`P&8GDR[@j'f'#cEiE6&['3S8"GQjrafUNbZS*V*UPNY0lQ
-(LE9#8@0RiS6BGIVbmA4P1T4RS45j-B#B-BGNJMZ)F'l6#$-"hlYQU&r*UJ%fE**
-RmN(*B69jf26!pc,GJkJlPF9a9Zd`b"#c'3$$9BfTHqA6[FlVbX0p68Y1D5Pj@qT
-#2KVZTBd!a15NU4'B3R*[p4e@LF5QIRZ%ZAFqZDijH'N0!S,kDMdEc+JMBUJb-E$
-3BL0qf),iGLG4M@aIr0XQUGMbNdJkCRD6G'QG*8NI5l-Bj+DbZ1f&51S'*6BkmpX
-@HG1LALC+%jXk9Z8ZE'cjYqF)TEB&1QN`6%CeUBA"1%b9@j,'BGZ@DVNYa`3M%aC
-''k4*4KXm-+U"J"l32#1lZ3iC8iTD*SN"V`%ifmB`aER)KRerqaUaQ#f-rX))dVK
-pSqD`P2bJ%fBbcV&LX@Nmml2EjDaqkjkCkNS0)#Me*6*(e)c$K5"@F"@c@%'b*$Z
-!ErFCrBk@PiZBU98$pDA$`dU90S&U6j%ARMTEY%ec6M@1f6[%UTmdIB2Pp+5Mii6
-JTBc$e8*AIQ@J-LJ0!+J2i[VP(!fG4V6qT6c48*PhKBe9kbVITSCVD$M08FrI%6h
-,d3iVSRX`q3H9(r2N"PhP6@T)S'%K4q1h%Ch0dIC2%AdINjXVCr,NeEV+'G5`!!f
-IFM6j2+,&(0@2)PT&PhK6ZF4Ve'"!`cb10Rb%k&b1fUFM@N56TbQ6hl1XFL!jfH5
-UX9R,&3)GDpi#,!JY9caIFc(%,S@hlV98D%C)b%eZ"i)h`)QUYM+9AEQSe&6Eh5H
-Vkef&9DH-@6#%N6,PhKT)qEQ!e#N&T%jha939Zp*AG49ANUSZ[94B1EhU[+Zb5JX
-e9@ePh&"Be3ZecM)HLJ2$bKk6J00[r$Y6CTmFIUfrYZS8&M@m''"c+0-R'%b"Xfa
-8-DDF8&4iNNYb4+h)S+pjbj[bXK(QD)e!eM6kN!"!YZb4Je!&V8QXrJpI!L,S@kH
-MB*c$THjd3,pcMcM0f-%BfVN(,[hqe)R)LFQQ*"4K[h'YbUTQ9P1Y68R&4'`2mb@
-KT(*F&Z@#"H1XI6b-Dp!IadrSNSMZMhSP9HZl!)-2NTV&ND5NRZ+)A9*,11+3!04
-c(,&+kR'1K#8B$%@NYHqR3XVdfVf-U!VRjI&JDj!!Q)q@L(c[&PrS0)XTdGGVa#2
-H'U%pPR1'(FT,2Y+HYCqP,RI+cL3#CRE#1pbAAX@%*9$KLbGUr+&)M6m1"pDpaNE
-YDARB1Q6(0K`,83@m'Xf!H1SBIXl@3*M22mY'0$RVp[VM8R[''6K@6Rr)j3mpe11
-2`lebQI-JJ%+4'`84+Lm3jmJ!rcNiiU'C2V*0(0AcK#X&`PK9a)R49)[11H)'&a0
-341Z-N45@H$Y0%E@C*b2##RlTLVQU+*-VpqXi+RRF+)YG9&1b)A'ldB(*"SL4cm*
-JK!k)r%1q`KZjJIL#bPPlURGqRBSb0L*#kPbUDR9AjDb2P@PF`4rSj8IiJ&+8PE#
-eP9$XVQXKYam(AG(P(N4@IV0T%NabjCr-6#Fc9Rj8hj)(Y$ETPB+"TdJmF'Ek4"-
-m6M&P4-#9iC6PPYQS#JRN1ES@Q8!`H($GA3%YiM6()V&*PiPGb8M*M,[-9-MRS(S
-P9eAM!4*`E4lM3Y3XBL&YhiZlST!!f$2CT0'BA'N`b5iHX6T6BGA8J!-"HbSIdhM
-k*A29HmI6X6`03DLfq&ZSQXNLA[[J)kE+#Q[!#QF4N!!5(Gk6#LZXf6IKS"A5H2V
-a`!+&%#4J#X'19-,Hr4ZTbqllV2akM-dpp5X"&pXT4dHr"J[S1N6Gp(4"L+@TB6N
-M3mIhdPA-R'&jcKFEj5`#98&'*31HJ%68`q@q(D*`C2+5+i"V6ZYq'qK`'Ll[#,!
-61JkJ`P,HJ%2H3&"dQGR&)AA#+Fj$pBk,"P)34r9`%1ZNDh!P%KL0%AVh`'cDUU,
-"f3d9B@3(DqXcr'J(pqE2Q@SV'J,MMYUUE9c-'AaM`S8P)Ldl6La4K1VP%+LjUNp
-KeEEZmkLFUEGpRZ#(466C#*LfaG'&5cG54U644RU(E2kHYmMGA)pBZ0UhQ@UVTJG
-S!$41arEYf6H0c8j%+Lr3-%PX4DYN+C-)M(CkN!$$32TK)R#5$IYX[bdEq&RfLhl
-4260aJMI3l8KTB4iL"$G1')NJ4diX3i!D-K3p'N(eQcN,I3ZpF2(HbrpAl-dr[G1
-(c1B-GK0V+'D6A4!3Y1j2lSj("cJ-lk+l&Gfp#hd4VFD+!e#%m!'6K`068BXKClk
-%kS"9dr#+9Nfp![1I&9Dm)K81UMMSi1eMbkJX%hN!!F6[!Q%i14$CPTe6Ck4Y3La
-PTm[Z%`S*je`j8@&(TXCRX6K9FBlR"lKmdMqqr6D5DbBQPH-R$i!L%+PQ!9#dGfp
-VUUf`@hD@HQ")[PMUJe'qVa"J`E8+9aU!N!$j#DlPSX'8!c"3%"01pBm[q`8qkM'
-N"d0kQMMMG6`ljj(TbK"'$+((%+IB,GIpU!'JGFlD"4!!@mQP2facklF9SfPfQp-
-*)9aNMTr&Xi&b)#Z,!%bb!%6`!!`#q-Ij0HYCRM+KfQ5p1Q#DT`i%HUJb4*`B$(&
-L-+5`B&@bpLhmZ#@&lGE)Mab4Xph)'$6r4kQD'BJRY"#Fjdj%V,)j1MbDSl+LjAB
-GVP@$)28F9qH4'bl9jRZ[Q#YDM-h1TH-qAR!qYU6*Bc&%jqd#)+2aVrd,1h3bD3D
-0E9fa835"'hJXbQ8T%iiI)E"i#N3F!!`h6KK#5DX1Fi9m4-ZUQq%H(pGYVd8(hEB
-4&5)YCkAaS*XI`(e``J8k,4beC!0X-R&K(XcS!MZ(Lp)Ef6N2A3BbpXAm$Sqa4Y2
-AK-!lD`Q+(Me(E*Pb"U4MR*&3b1mjRZiF2Qd(Zb8k$I@Rj)S43e34Xf95!FHZ6H3
-k$aFcVQJDIY'%&RN#3'NZ'@!DNee)Ki)`F9GEN@#"D[PmVZU*+VJ`[X*9j$P6Y#D
-,hCMpD93T*%)6MV)"-XX#L60S6L-86jJV%Xk-BQcL8(SD#NDcGjq&fB'0,0M'U0)
-b3"kX)+ifL#c-,bk9JdJ464HC#IdbLD36"R,-SB'UL4"#T1%+F*-fe(-QmrQT2#b
-b[Th1J4%`3dK'L0*24j9"mIJKUXCDrC+jZ2I+eG$eL[0i'5[10HPG!@UkVer)KJA
-NL1HN%MQQ0&3MmS8L',TUiU,0`aA)2EZ#CPj#%1d-a+pFpEaGFBl"!Jl3$3M1+CM
-RFU%!jNhEUI)RVV4m)kSke"DEjPm0&34UD(V+kCkXJ-CT621"H)Zi+j`Aic+B0(A
-`CYRjGr8"5R#KYY%!H(5C6"!kDQeND*A*X,4(*S0k6LD$UQ8bU0P-"JBCDRa'hV$
-k&i8!Tj9)VY*`$Sm%)e%(6erjRTXBS3fS@'0*M-X9j`"UmkKDXpkC9("RR8#Jhd5
-4PHk`5-5e%!S'lAiLS4bE*a)+alU)&#)d5S'd4EPNjI,CR+9Q8T6Gb',f4KN(J8A
-,6%*fji@CrdpK(+%B&@5QXAZXdc'@6%-dJQ'aN!#c!dj6+L'J%YeF)+m,Z2LML$`
-CD)5cEKe9FANR%%AKme`JQQ`%GT`ED!N0TqQJ$KaqD`I8NIakaaLA&a'd,Z+R%3P
-ehX6QXb4%"b)'*0imr,b'kl1$H`QpQ$PNa6'GLPQb0VVF8H9b@Fl,e9j9fh5Em'V
-4lH!XHShi1L0`cebBSq-(HQAR*0Jic5Dj'NFLM)mGQHQmFDIc,4d`&ML+E@3'kRL
-EXF3V2@NlD[[5GS+9G#mMNUHZSLL-i"1$228q#q)33Tc%rN5Z(K0S`e$Y-+M3l!4
--E1046CGLCU%HE1%)1HC(')@`ZC1EJh!H&l+!rkH`,1$(-X%SMJ4-Q(i85H3L*QN
-0M[Nb+S-LdkL,N!"CJ[fkSr`"Plm"F[k2+!B+-V'eipKD66!b`dM6,mJ)%5bQfR9
-IP0dbXh2XMb,BlFe#%,XVFk*Ce#i*U(J)9G9DBDLb%kLCX`C4b81&hl*!%J*+Z0J
--!D5`f1`UV%LjDSX$3A[4bCLG*S%(J1$kk%Z(+dZF#kJfG"L,#CPpTViU#j2MJLX
-J1Bf+)G'5L'3bJph8Jm)'CJ6!DN&Pr$DZdQaM"hCjd*b8$CK!Q#0$+BE-IQBSe9D
-FGaB+)-B4"KqMDI*J2+8V!VCLJIS2rh1$8F"-iV%R3!%rk*@CA&6PZH2!Q+h+-l,
-Cq0r)2bmGUNJK@2Ib`kf!3&BKfqMi8@A&HFdK+FN4ia"0FAib@k,%iS%`'jd9"YN
-`-*+JHB5I10,eFcqFNEZiDK-A@CeE+"V[4b@+PL)#S#&8#rN3lUFEYIYXdkUdI94
-!ie%MA%!65h"MIHGXm`frTJ2U@6'%`2%QLVPErVrK`5mdB3H!D!HBrSf`S06SA06
-kH,P[@9,Ji@-dc)a'HjrRYr6BVKTHH,#4(JMS[&30A8U2ajZ8%q-H`DG6#L,SZb[
-!,68i9F`X"M5b5r'N!MKPcZ1-4i)GQ-(J,A#b8Q'+T5ZYJ-eISM),SR)4d3%63'N
-&-"daJS3U8j!!,3bN4)!S'%dX06L4h0+YPJKZk@)RLS33N!"Ne,Cd8FcfF+qP[f5
-d&d19U+@r("%@8jZ9c$!J24!D8Ir@Yr49L&C$6Q5eG+(c%,j@8cZC%)m5)eBId-Y
-S(-@pPP"'1dm#QB*)TXDaVS2B,0a[C84pH#+LCY5qb%K-,Z'h(X4Q*L0Y%kiDL01
-eie5Gp"dX[4VJb3YIK%32@e4&i+(MmY#H(!9j`5c1dM*'AN[,eSDmTKeAN!"APJN
-6!pQZUV3KS0!f4PjT3N&H&b9dCq3PEbaYL"GU-p-N4Q",bf3%PTDS2CbQ`43K)c"
-dZF!XiMqA+eH+!"3H[S(#H6+V)L9)c(q5`B!UUUFCl8j'$$kA6@$#h$Z"#92`!Nb
-B!TN*dqKaXf&b&[*'Q8L,GmTA#RfiGQC-cS,m-cqC'C1c8'E'6'D!T!M!RKF6*KI
-3B$Ra6db(L04Xj06-TJAGc*K'*c1Q-H-3YP91CTYc@VK+!a4mZL"!M%h!I(`%JBN
-$&#X$)"TXYTp4M!J9Q2B&f$aXh#RUXY,,"S)!60fd9r+!c#D!iG-EC8+S(c1!SKT
-T+B-6M0K[UKeHDT!!#q@88LJ[X"A+V6IGKA*VVP`SVa@-NGb"Z"L')Bqj,`c!,`C
-f5h"qHP5qSYL+kMc49hU@IP*lH1QR$)B)S-9"-eGpB)E'dNmJTZ9"D9eC%3Q-Fi%
-2mPP[#&5l2B5+!q(aMZGkiCLI[+A2l&[3@lM%#1E9JN1&5q5TMpHld*("Nif$9G3
-%fR$8!)l+aS3D$$q!53H3!%QqRR&S![K9bq!ReFlk'#EjUMRCj16#ihG+h3NChJj
-!33@`d2$%"&dqcb*")b3'LU9@#`F62&+L9@([-81+c3Q+c8L3!"(mA-+R&K(T"+X
-JMcb(5Tm!L5*Qfq"aM8m-YQQk4PMe95A"30YEpeIF3%,2`)CZ$(lQC'V*5Npqk+*
-G2k+5X1QcQ&iZ6`ISlU'KVNGB*8qXAME`aTAqlAl4#%@VAcb"$Mf+1VZfJS*6plr
-cJchKlV"#YhMQ5e%I0lJ#hImZSdiD%L`k9!+MUMhG06HkZ%L,S0*R$&@IZD(l&6C
-($k&UXD+UJENVCY,)&a4EQ&N&K4[-pX8Z)X%rV5dFR-lCj-(0p*Lb-QA`lGe2ZJV
-I'-"2YJ'4`5!QDieC33mk`X4jbc!UG1PPCjl"IkD(U*BUjQq@G9GVZZ#DS'G6995
-j'Bd3l3Z8CEZmCDG)rhJCYMA1C*,S-C%C#0"3,Z3')Ucb4T8e[RLV6&Bd`15k1`R
-dHcN*('aib&Be5-NJ*a@QLF2#Y8,*e))PCl8a!p1)f6VZfHjNRr9lq-'mJBZ+DYe
-MS9L[IF-S+mYC'3j'VN@(iqQacCDX%'3qDb[k%6"Z)1Y3@@(')kZ4P0eI4k!amfD
-kVBMHN!#hL1T+5@6Ip95*$Jb[aiFX"ZS!`f2X+B#c@)M(Nbj-4-6lVhPMc9'$p*!
-!Q!QcDl-"hYGHJr%,RZJD&*p`*'Ui8#!@L[IaQLeQ`J$6l0I39&KJ'K3,Ecf+LK-
-,*94JeLf$m0S@$Hh`$Sb(fD$'Vk@1(Ei"FeJe$N9$cX@"3eL!US89*H,AYq,4FCU
-+Baiq++DcmQ8J!XY8#`IbNY3"Mr(qT+jV,4ZBrErM"RJL'1$*"`[%cE8XAV2B+#p
-99KL3!0b'@d!j2%fUV6!m1#K[r8e%U[eiX2PXfZ,r0X3!S"VUZLC92'X'@f#Hfh`
-A+b8jJ2*3Bq0UeiF&iQ-8j0Abp0@Gh'#2`(Kl0BZ[8,dMLZaRHS#0fAQiQDHl!Nh
-MTj1k(B2r`C@4i6USiV'q!a#U#YGP$aiClH*L4*l+,M6cBC!!i--H)a%V)b+U*cF
-2hmXGRB[C16[(-m'+Xc!KCVXb*Jc)9aeLak!N$a!(UL,#Q-A(NlU`HJp0A'a$D'Z
-8'IQ61TNXJ38DRYNf96p3-4l'$+DN+5+'Bif%$(B$D*!!0F0($bVP%V+$S`eH%1G
-GcJIZGJR,*LjLN!!%1D&,F*q%QCN3-i&2@D#D3KR41ihF%5U5k*%!k)kY'S#-rFF
-TDkTFHKe%,MiJLJ3q4G%,,bB@e)cV!X035Rq[1!X[II%T[&c&*AJp@(`1489@X99
-fLP*)ZePHF,T(8H#"Le4qJCL13kH#AA9+FB!UI10FXI8PZ%89Rf-e[,2"D(VKibB
-lAp(5GpGbL$cCpJ!$0KS&JX@GMRP3SGC@$-"N8j,0[pUBd$#8FMXQId+a-##6!BH
-2dR81&TI`85m9L+R&Ti)0I"`I05B@B#R3q(#IQ#SCL'$XPVLNq(&jLr*9E-5-8k2
-9cB,'d(qcf'kYlCL2P@em&pYp#1jVVcU"Gc"hBN)KD'9JB%S-pcDG3pZ'8iCr+8p
-pb$NdN5k#`&Yd5Cr[lHI#p#(E3G@6$m)!+bfZ'VCGe@4a9D[&95AR%1`+fEU@kmT
-$fSC4KX89`jCA()f)Di@2M[Q"CQlHm*J1&8D8l2iLcZiVQc"CE-*+$RL,"R-Y$2%
-YN9d3+"296`MAiBU)!Ia8idGk')+r-0$V'P!aA)N"5MF048#*#fPj1L0Sr-c%crX
-2Xj%h%ldqaUY"6!@l+@%[e1RH')KP!KL08)I9&PpRG4KABNZl3e*Y+M([6Yp,jMH
-bh5Se6$d2G9TYm3&@TehUhZ)Gb)Z%f0MF&Yp,VMF'D'!Y@,%3c0l)I!N[*!-%0B$
-K0r*"*S"K#3H!Z&PpL%'5!cp%[f)@0`$)286bLr6`G8`RpF8MpX*f8Abmd"rXB*@
-K%(Sm6*p%)$b+[IJ3ZYd`DVlp,YfVZBZ-l14NPP',M&CNe%4%MiM"Kr-q(a@EkC9
-2T,f6Ji5-TRi`im9S5N&'HV"6Me-``L#a8B$+$`NB$a0kf-6!SrkYq0`cK03)5C!
-!J%82EF+V1`YA0"XCkF+!4IF*"83(1BYK(dDfTG8jZ&0dFekB46JBV$X$`,)2lV&
-9U5kch#l8dK$T#,LHBp9PaA1-mR'!ScXb%6%lf9kF34SRpY[c'r#6$hDM!3kHcei
-TV"bU$2(V+fPJ-Ni(ff`61`kj#VZcm,2C9GPGMCpl,9P[!5MKrm*'e'ZqcLqi%SI
-H6S(&Cbm8rXS50RXV'd1TmdJG(h4bpAH!arXlMm(SPIKCDI8f21kRZ@kF2pK3#c)
-3[NK(cXPESBM(80Mp$Y5CC*E9Xrc3rGh[C1l*h%0rqN$1,Q(5$TIf`e$8VRQ8!69
-qQ)[(-C83Zc`3D!fLQPY!V`%,&Bpff'Z%Z0p%CUShc-e-ChHQr[BQ-[[S4aEjRei
-M"kFFIa@cq%`RCC&r#!6jaVXpkX[[`Q!k(Xm08c!`IU%@`AQBcFr-B`HURj8@*ZA
-,'d0e(Q@B!VTi"bjH@iQVHNBr2#C2jZ%,Na'P!fq`FKdkM+*$$ffdYK)!i8PqQ)Y
-,5DCMh!(#AC&ckpKb@ApYpfBd6e-bhCr3TK1dk8jXqTLbk3lDG!HaN!"`L6[HXff
-l3lR@GP-ZNr+@%F2h@!`2GXJra@MihNQ$[jLJG1%lV[,JPHZ)T2)@MR"'Q6*")Qf
-M6"D29YkZa`4`[`c!23I!+i%bEKJJIJU#'9LDKX*RMIL"@F4R-r&6!S-kbmCB!)&
-lfCqAmd36f)f"FB#ISGF-C'1!@l`[9Q1TJ$Ebi`6e%p3lCpd+8[cT!*A2ld#aEbJ
-f@4J*+f8$$mj(c`1"R4mQeb)94e@N$%Aj@'*Q0-$96L3!H)-)K)Kq9XV9c"2lS&!
-S8pK3-DRfM9`8jkA9afX,hmM9P8ed55)(G4K5$PLKi&d2P3%BF,pE(04ajPj-Rq6
-FP-19IF'i+(h`'KX&iJ0Za@RBdJR$PV)4KZ8l4TfXX#42C`CBBKp(q5(`,l!C(("
-c,dbU)C)5Id5cY2r"+A!SFd6h`T`J'fB['ak#!CVe-%N,TXR[@!'UJbD,JF01@AJ
-%`Zr%)-jK)dpIcmjj(Sq*i)S)EN-@Z#JB&Pp*JkQP`Up!*+`F!M$Jd84TCiQaD5H
-R+cY2deC@mL19('jA959K&2Ae!NSF[UE4l1,AME@5@#m6)hDjLIimKH@ER@3&XcV
-f)ED%am'@Z9Q@Eq31cb-`Y`,-6mEmNXHB*1*im[HQK'Z@X(q2(r89KPR1'[c"'p)
-MI5)"0""5K[$r%5mB4YV)*&Kq!!aHqd3#N!$c'KadlKNJjdb2l+aViCcT4h@2+0a
-4NYd2A1RVhXP1Q0hES!TbG0r&b!6Ahci'SM+Sh$-p+ph#JB$%#QI`94kH"@(cRNr
-`Cf#FX(c%'KX"TZ0YcX+6,R!aCH+(ejJbKX['kS3$TMlajhJJ)bdpbCY2`+#X*'S
-HimHFKBQ"ZPfj%"5JPSpK3f%8MV83H&L*U-f+5`Q%`lr$aDf*KfJKKXL3!)diE2j
-GjBj3$dehGdLEaJA6#,(cQrU%l$K"(EN5[,!M!h`Uk!")DqA((GS%kE,EB4PYr*p
-c'@dS)V8@4YUQGaA1HPCKb#59S-qQQrL26E"c)"jE$C2NT8a@ed)jb&@F[f@%@mG
-jADQaa!PZrD[GJ)DJR1c[%aS%efXb`#dll`Bi01ETeU1jR%&dE&#Ba`#QcQ$0bUR
-[&$fid-BB9e"(iBHF9D@!V9pl`+BJ1339@c-(bkqqeYmM,J+&0-X6+XirZ"",'X[
-++%)!a*UlmepL30Z#$hhh#K6U'`qLH'&fXc-*AccY*3K+,jlBj#'$L8PbS4XIrXr
-UDM,BaApbaRMbbF'fX5k0aa*8&51M-&P*ACJ&kZGT-6)kT+YL%*pS-06CbA3YPJc
-b3cApcZbTK8(e0q9!J-5ELjqLi$L!B4UL8cNjMH@Ni*fV')qm-IL[8*8Bl5L4HV5
-k,E&6pUS[(Zc,d'f)$C!!DpmS6Am68lp(8b2bJM,%(p$`#M8i)!cm!HE&V`9$-"A
-Q0qS61"k2)#S5I-%fq9"-(qAT8-rPDFDA$Ni-N!$XAXb%#aEmiZG`4hK%-pj45q4
-S5@5!4&CESjiD9CQJPN'Yb30RjL6F%2RaM@&E"blqZ)[J,NEPXBX+XI,*&$NEF+6
-+1JKLSfc)$K%09p*""%Ti9L#N59fb%q)@I,a2D,U0rY3GHHPkQ*9c3p)2kZTAqZP
-22XP(%UEBp#bZmGN`CrfhX(XBrDNX#MM%HVNj0Rcp%Plr'H4U39[Ck*,m4jPSaKZ
-X0%f5VlCd(3-%1iM+3-8",KJD[$$'$cD!)@dZQ#"FcQCQmmb(H1KI92rU-rjXFY$
-LNe4"BjIYq"JPbq+Qm9VmNj[L$QSDN!#*X23F(AP8RXL%B'5*C(6)c&RAMcAM2rL
-0R%JbQCC'U)YG*Yl5&[kN`q[iBE"!"[Q-)Y1bT)jh[`rh(EjbR#CFN!!(+0XZGbh
-E)9qKE)1mqE*mMBI98*Cr5SR6'*4Xq"G+-N,L6pr3f*bNCE1r6E*4V'ECqIPTXmB
-@")0LJRN`UZBB(A!UHC6r0qe@dAA,(iBD2$,K%D)c,eJmD*-HB!!`M6-#J"VhBk1
-,R9[PLRGeRS'mc!jN)([VHf(f!+BcCbCNShp!PHbJh"EX(HK!bD*pX+J[Rak#d)Y
-(A%eJUj1MF(+#!I"HYm,&,Dc95ki-cQ$+4JV&Qf0c#@ca"mJ`#adUXm9XDSR*2"L
-8rc`A2$4kXDk8rc`BrZ0Ji,kh1"r'VH%J@SE(0m2809GdI#Dpq+(%#@c`2!&$+4P
-6LR,L$"E$DADFd4F!i`I&0IKX9$jAdDH%aa%AL$BT%fKHiLCAJ"YL)9I'JTlUd+L
-(#99mKBH2c5!MJSUBX(360T*0lY9I$(!5hi5,CFKi(LVH69bG#B!%BiG,0c(c5Ef
-#T'hM6fl1c[Q[I$JIJT9*"RUh)AK[a3r-Uk9YiJIPik18Jcb8GTYQRQIJFB(44jp
-1*)Sr&N0)*K&VBaG)F[CDe[h2$VMl`I&'",BTdeB319B%G8h-j[J@)cFH2"MLiPF
-Q&8r!cr019!QRKHIGaTpD"8bi*A(dBSM1GV&VjR2mm)$35Ilc@b)HHXJ$2j!!+Lj
-1XKh6MDKF2b%)S$LJLP%&iRd3f*(94dU8Pl-'qYQTI#BPf4!TBcK"m+MNj3[iMqH
-C@+L3!0&8IrIrJ%"`(GPN+-cjeH3BI)kb%6ph6Kc-4%DD2SA&2`!!-BP"4%05!`"
-B)Jp9$@C'%4!KiqjKrffrPUVdjZqk[VQHj['jVUYkUVCk3I0%GP)h"Zc+!VeZ*V1
-cb*r(e[+3!)lVQlQ&%-)9lHHA(A$+M)K1McJA$K0VN[%mkf3HYa"Hcm*kK("k!b1
-%j9Q(dB#"*YdNlh`c(Z[[hprrph8G),ql*1mP,cm!&AGH*2-J-L)5)I%!%5)'AhP
-G*Q-ar-LqCJ'NQ"c!*L')CV-(JC2-S[20R!1c&,&8JZr0qr1q#52iqmk#M2G`pEC
-DKMbLd51Y3amCHVZK48lF$KFUBV(IrB)9$i+jGMADr*`4l'rh@haI,j*'%1&V@$'
-3!$VG3"D&JAKK))8c#+3,I1N**R'qR0U+J,#d[d@@iSMNQ$KF4Yka2ZGiShr!2`#
-`r@&r($qAeDh0F5L,bQK3@RaM-0(+iVm'I"EQ!l&N"+cJFTK`k@35*Qc#G2I$E""
-9ifAHl#RqDeZ%Lf9SP9)$-MJpFG4(,I%a,MkL'[&(2c,M3"SY[YDM,QA4,b@h!L#
-Z%jG$)#S[5Y8d3Vr[c#R(PeXFh5Q'2B1c&p9G9m3$fZml-mS$RIS$fR6*8CIT%CI
-aF6+LbT-UD*qdb*i0(EjQGF,3E#fb'F&d-d$N%%((G3LakR`CBrj4Qm0[*)ZeU58
-Cp6rXD9CVUILMYU@lYJ%jEKQh`A#VM&"r&`##-#p$%1HMj5%5b%2'aX&Z,k$'M)!
-D@DbS3(m(PYUc23a'$(r+"[qKa90L"&8#+92@`D@PLaQ&*2"5K(&fK("@jrR#mUh
-GNd&1A5$mrLahGlrP#DHa(%U`eCPAHiaN@cY!iqA+)aH94k*B'YKlIc6Bhf@%("E
-!ZZGZKp5GMhkNDJAYqIZ65@@"Ab`iZmY)#PLI$,5'$C6$b%*1DM"$ZkfpXGehK8d
-@#85Y+,,VLqj)JfA"Cq5NfAD#LLNRl@dR#[RK(!F6fFLNa$59Q#E&G(+j#d$#C!#
-AjV$$bU$*'!cfcqq6UVYPj#X)%Ph-b2#+dp1Ke1PBc*FdU,!",Cj!+UX($1R$aXE
-GV*TU[$PThAQLX14G[Y0L,"'`a[#@YY-#k+6ZSVbX!9+bmX8rDe&65br&k[aCP`6
-jk9l@[9$VeTUk@9K)h@MH1)SSE)KZjX8Q8XjV-J`$#MLkHD'CP5J(a36hXrM53F2
-5SiX,ZFVd!K-&a"[%e%V6ZQf`IPD*Na&-cF4d3N`RT9jBkej8#UXUKf,k,+Y2*X0
-G*(Mab-1+i+@m6SANB`(jl+1Kh9r-aU(ZjI!m&m2V&R8E95,U8dG$[-%XNKld`+I
-L!EIjqc9)K*!!`,E0meDDcQfhB01Y,&iBAVH4cjNH,eq'J2'EFcNC&U$JP#CPf`R
-HQ(rH*`Vc)G@Ib8R$Nc45E4dXEM8Ni%)Zq%PF[!q9j1+H00'P@A@'HBT8%J6h$!`
-(B"+JPFd(8%&[QSP@!CBmZY$[FT8b+2+p*a)&A[8R+QCdKXSVA-a+SI+(-9'S(Vd
-U&a19GSmZ[p%#SmIPTUkj!P)E,!4[B#U#BYLN#,N5e@r&%DKq)DpLF5(r5kZq2+h
-LP0EibNkPkS[T%,@H''#Bja9@&#J+L*+KjpS-EAIQ6TqINkC3[6[R!Z-Il@kRi)H
-CSAXC*"b8`+I+@%)+512ZiZr`D(iNfX3"@2Lk9f2QbENd&pm@j1,bRr2B,dAHHpL
-6Z46&6m@P)(jFkV@V+*KR0Nk'5+e!A,'[BG2fM&4lMhe9I9TjYI,B9j8VP&I'XDq
-qkPCHK@KVMcVZT$TiLlj`!`+TIj%aVk%09F1N["J+Xh0K#i2)jQ6TZ+faBlUdS1f
-qEd`"k,*Yl5cFbldEUaTl0eETld,eEk8TQ`mJ0*Mb+r1,%1(`4KBZ+h-#M(-%(Jq
-`@[@-U%9A@@MDC)$)%SXcKDVHj@dAT2VD`9k[Hd9jR6rBkkpZ8PjlMhN0#(EcJ[)
-b41c'SmaBT&IH&)Nq4m&9'*9Q9iZdcc`,!U)F6N)SCh)jb)j`NSi)R`'f!da-%2U
-"M`pKNQ9@1@9EBT!!hK1@lG"UH)N*k,d4e&0iJqi5P-jb&9c'ZqJ!p`&6S@-B8hh
-MNq&*1mMeZl,e9-2A(aFE5$K,V!$K0'(5GQ&k@+`94G'GFc$CCFBmZY'+l,Z5`hm
-E+K(QbL#%"R`PV3SK-625h`&J--SGbV#S5+M3Y"drjUr[389SEb%p2r@hBDX5r0N
-TF9h$56ERf8(#Zl3jZTi$qkA0N3maUIV$!55eB!k4-hmii,26X9BkYY9SGdZmm+'
-6e3"3V6A1piiM`,B[b%K@U$L4CK+Gc'U1GiJ8"5H!(11r2A"EQ0Tra5&HmDSi!(-
-U,GE)`0Ld9T+CMC2*hBAaqG5cJKNkSU3HAQE'Z[,rhNHaXD,Sl[8L"$(-(q0cUN9
-bVV*b)66h8UaD(FF(NcrF$Xe9aYDTLhT4c"Dd&MBBFAKaFQpp+,pGcYR!S&C(mm&
-B+&q1@e8RZQ"PQKKHjb+f'-ZE10cJJVB3X59@+G)UraIr,r)rq#pkc(p"j6m0r`A
-`Rhj3eS)8NL@icl"XK[29`rK$d%+0`SSN@&!BY-D'r!q(&%1ZqBG$"cAN(CcDC82
-q,b`k'ENah+SNkHT51(blR+lJb3pM#p[qi4!HZ$L-BqBLUABTbq@d`C1rM5eB3jC
-B,#1,NmrAYl@(X-$*AD'ZGiU04PS!F@NA)kU,Em15EU2U6%UB#Gm'`Ci!0&GZ0E@
-3!'V4T()E8+fTPVq'TFAU&V5,)69j-FTTJYLk@&e&!#a-L!,DqmD!k)Cb1j[G)cC
-f([%iUA1YT-lPSXlPSmjeQ6UAP"G!lKV"f2mEEa1klIreRcI18rKG9d1TdIrI,j9
-d-bZ2['PDm+Ki*0&G[1+44cMerX,GKYJPP,@dlDQYUL4AN!$*j6#-C230p&K1V)D
-jXa0Kif+CS!)aUA$LDV0m!r'B9#Gi%Q(&MdP8&Mk6&["`%YDdYmL2fB%MHLmN'B+
-`JQa`JT*[K[R&8N6L@$im5BG(eDJM,Pl4NNMaah[Aqj*f!QELH1dP"@kH3rV81TM
-b*6)44M#AZT6kfF0PIrQp*8lU8J@1fISA,XGL-USLmIL&2#BKGi3RFqr+k#)+F-1
-!akZNi`%qI"GK,C,jH-P-cTCcR+,qEPk'`1kC2Jll+SpJbVH#J0"fhQFfiia%3"Q
--[FpN,m[TS$qmaD$a#K5+hBJ6l,%-,T`J2M&Ei5Dl8RK5R*4MYdjm2)$$rq#6d@S
-iX2`"j-aJmJD5CJH"5[*aUScZ"DRE-4PmrMk!'CYalaQ&4IJR*Z)6Ba+ZR4X"rMm
-Faa&F&)!mpf`M*RFU%TEfXGJMA+"YjiSLT-6,1-$#NAr!RrHcpP3Hi48cY15d`Xi
-`fi)rQf'"1#aAj6-K*E41$BHL5iY#8-[hVLH(`I98i+08i0I)H1$S4ae-bVh8h@5
-NP6SI!!J!$HkX[IL2'TG!(ReCHfqqZ0Uf"),H0S1$'3+m'(heFm5JhMIZI4IKq,#
-G`6N!H@&M"Kqd43BbFMKNJJlaCZf1I((%FV"$USBF8MAd%&QLEd5qQ,k4iXL3!%2
-UKKa5Gm`KDr50b"[T'bQ1$MQNGXJKY8-18BIYJk39,r*`[G,i%"D*CfE4`XRQh@Y
-hh!H-Q5($K0[,H`K&h&(m4&8$KUI"3+a$6DIb1Ged@'3f)E+*[HXpeTQPJYc5[[@
-qmpl65l(UB6Yq+[[cLjE8'"X`3ZVhB$SPF#+p#G-SChG2r0Q(2kX"#qlMp"FcNE&
-pB0m1FCJ%X'81kQSIM'Sl6(NIEVErQ*0NF+p%Z&X2pQ%C`ZE9"VTVE-AZ0h[206%
-FD&16U9ZX`(cj-a*`h`Sea`UNPd192FbXpBf$A*8a#HZGiXlHGakIlHi8ZB1@B$-
-V0Z$SD9QjApRk034r4R(HGXlh'LkqST&IpqVGJ3q(+ep8la$8$F#!V84akpe!J4Z
-LU3'P-b5(JrZ@8(3DG3)%eepYjNk!)Qkp5JR6c3dM$`Bl(,Uq*4d'%UPiVJ)!Vj1
-AC@'UllacbZ9AHh'jebG$KG$cpmR8V`pfjiN*lXiC#G$J*T6#IbFi$Kd!4IMCli+
-d!VDeim9*Aj)!V*0[R8DDpM354&h'I'2A`MIi*6VD'"DG3"%diFD,`MVKD-mJ13`
-JE"[IASbmqU8l1$)lR*@[EKSHcX['*@3N#(Thq9I''HChRFr1El2-GF2-p`"X1&'
-BFTh(cB(&#KNE"@bL0KF#cprRMFePXh,$`+bf'"`$40+!bbj-k#rplUcdE69#+2"
-kF8R3e`&fEmTXh,d*K,U%#68"q18-'[-$Z(PaG+0D83KFL4cqNNK))%N(pm4#J$l
-8m3FSjM#$(lM-$Ha!FS+"LXPLb[lZKUi&Qe,!0Gcpi"$&&kLK4eTL,dVTk&U'V8l
-,@(C3C0AEG6L@PIAhmY9P4I+YHp8PSm'ai'8j-eCG4H69,!lDB-69YIK6``'@FIk
-4%XN+IF!lIZ5`0''L,K)3a!f$,QFbd+HEYQl%CAcMBM-[JASIJ1LQ2,-J,SB("Km
-VAhUTZY*Y'Mrmihe`9iE*FC!!Jr![LFlR%N&FV"bJ!-1UV6RT+I!#GN9hrDREp'l
-RC8B)")%A@i@EC&9Uj!&-FBU&`q4KDj0)ID,DCk[h6!DHNC-%SLkrcNB)V'5XHLq
-E0UTC,N**``A!`'SIUbjMBM)9b@X!K,3YRHMm!iScfrMhcXE1ar*JlFIK3JQMpYJ
-*CSVi1#4-ZH2'Fl`j*!6(P8"DK$81)L!M4$Km4%EF4$`Z%ZQi8Vb4#-S0K*rR2-A
-&(q1RU$K*(lZ+Pr0(eFe&APd&9[#R8PEAUBmR2N6T`dMLJdBITK)I`[5K)[%K3Kp
-bB`%e!j0ZU5j4ME'!1mSL9jXaMG!dP@-'l(GL'DVYVbjcG*X`%Pm48VaP"3H)r10
-'B%XRM-lekrY5+XTd"aGq`A6RbC3Y&1l1IpJa'@5QVkeM8U*T!94`fdQ!T2&6$8r
-0XTV059qc%HIdYT1C`adrCPHDl8IHJ"VY)MADI&RUc!EFDm+m%BpFYiNf*'8Y40(
-+bY'6T'hr$ETbZ3M4K9!Kl$)@pT6-DflV#iNe6@`$*,Ca%YY8'M[G5f,V)l(G*E%
-9Np!F*,5l*$5940DV1K,#1T83dd"#3#X6SXNQK&+!8,b+8(S53M%63JN*S6LTQce
-UJ`0lTK$SEpp`#ijphCj@JiV)Zh(,Aajr+GClr*ZQE(VM5$f+BGjTmAIj*P+hf"P
-f@Kcc0rJNj9TMSm2#h4i0G,3V8R4PYC5KFe,H&lJ6#3J0US(CaE#MBm@Yfbp5S"1
-T,VNpS8!ZJ#Lq8Z0kJ#1X!2dd*R,#T4X11A"EBjAcI#F$d0ML@(A0kA1fFjD@kPU
-R*@U*eFCLZ+Pc@N"ZmMUji5fT9P)CmB0erk(!0,N3Nd-B+c8+$Za`JUpM*hM[GQD
-A&-8A4RGMiBk4F--NeKRe-KcPN9SJKh9b@Z!+[A3UFe@"i%D-m`cZ*"j)#8C%GLU
-3!&h&83m!`T)ha@[P%1[",[,bI[dLR[Khm*Q+c[lVXl%U9"r%%+!U&l'G!DfA,Di
-("!!*J2#h"!HQT9C-)XIFjIa)5AL'[mhL5,Pdq"A-!!N,%02N[0J`B#[qD$9k6c8
-9VUV4SSF)CKX%c$L)3P-M0$%T*HM-Y$%mpLA*F@dT"4dAkA@4(Lc&4K6BeS!b9Y2
-K+Ib-b8ba"5a-d565`a[AiY,E6M9mIX6e!!T!DVZJ8Zjb9kBIUmFe&P6R#KZhh0F
-CjS+*p'0f&JNN6ZJ#$"j`YPq-I0,0,LKbQq(bCb*VI0(q#ijED*!!j&c92[dc%IJ
-M`BB2D1lc%-#a46KA26ccYVMiBhd`69l-DQ!%651Zb99'dM1""b$!aeDkf%9rBHC
-YU,`4Q(8a2KESifdm-KTT`BGQqM#,iKRPK*U2652$bkYYh"eL)hIfbiHS3Fp$I3r
-iTF'(C@6TUBCAcr,PBb0XkVajcaL1cFLH8`f,0[(+Hdhf'2q%"j!!DX*2mYGRC8i
-fibFV%Icam6rJQq32q!8H3JI62pZP$cpKHGB2SrG0*$DBF2'2IH[1rXJDN!"YG[3
-EF5H*E+qQQ`QkfCIKQqE[L`ILp2&!J@p+(k'25b9b&6kfd32&p!#Vra%LqpYj5Qa
-Z16hJS`IfL)@4&X%Li)9AX,ad8k#E'Z@K$a9RSa(h6G&)LQl1dJhJrQLBa&SUQ*E
-'pJ8l'CXT)))q'!K5bNiXX[P0c`!BLYA-"U0ipKRaiRcE15C!"S$cf)'f#lLaRfV
-B[edK4M+bcl!c('[B35EHcc"4H[r(&m!@Ii[%Zjb2`jmf((Q0(3d4,Uc&iKjDl)E
-T,m1&Yq2#cX*mY*h""3D1!!lBH4+9RT3!*J63J)I,+4QdKiiZ1p9`Z*6"A[6L,P)
-Ga9ae0*l`XY+k2F[`,iU-(CIf'DiX1`I9C#dJa0IJJ,6$(9G8T+Kk+cHU-ZcS0#[
-J"2&q8mH4*JiJP)SGGHQ508-Z28#'Jc5pCq@9b&@0&aLQY)"b544DBU&`JGjFK-A
-01IQpJGJb1Z#h2Jdh+P)1!"PLbcbpbUBQ5#(B!H+X10,%5FMBDLGA+IlM*UT8r%U
-NT2j`2EE+$mCj%YZ$4qU84kV%4iKE6%a&0CLiP&bhAe`F8eidiKp&edSK16$+AH[
-TY528YC5ZRS*3&lKl2Repj!&ZEJpfpDH[d+GCdG'I[JRfmPQK0TjqEH3"%e485[@
-%LCcq9Qe@@"@UR,r**mMX6P*S59*%-&GX2m4++-dj+bZDeic[ELBhIb5k*SU-CHf
-c`d`b'lYmSk2ajlSDfUHM0pS,J5hh1Cb#!SL$Q!@Hlq3JllXS#0RTq%##('MAdKS
-cQ)UEp!3h@10N!eLR#VI4B*QGbma[lbib9Z$BepZCf&-3NC'Gl,6ZXiTQCm3NXFX
-+8Y6Nk'%4$G(#D3f16+1)NVr1pKrFS`f%del5"U#+8hrr*DNpmSBaAf3diT*rr`B
-1#3qQ0kh@c+#$5*`53"22D%KF+Ha$E*JCGM5XBp8ekcrT'dDhUk+%bq-JAbBl-[h
-d$$p8N!#q`XcmMp!B38E`!f!-2qYN819dSmCGA(+U-eQ3!2jfRh9brYK,9A0LG)*
-*S09kM)0!Z'+-NrbFCRAf)Z&N,rMGVBrBcL!je'rK"2eSF1pI8F%pKH+Z"32D@3M
-X[Xp!4$EHH(V"cNR,aY26+AUS&JmpTFiL"!`HrK)9[YPiqRDTXI&`24FjhbkB4N!
-j@MjhDqpIJ4312TlK`fEC$DP'@8+ITLI!20j#8iFD@U,aC5#dTh`bGJQ6@XqX%GL
-Y#jA"ZVUSK9YrHC*4"A"@lfC$R#6h"RDR0@"jhH,XK8YR(CN%6+jJ-NQ1YY0LN`2
-iU)82S+BepVF!5IkZ2&C&a9@(#UGLAcHi)BK)jeHP-@i%iqIBN4pX(X6[4&&RLJ$
-RC'"X-SZ1-bCcP%k[B4FICJYC@#!!PA!iDhC($ZA[rQ3J-0iprK-81C0ldi%NMA$
-G)RHb5VeC%%'!V@#6*rlM-U$dfS,SYXQ#RJ3q3CIm'KXAXfLLBBI-kHcDUBEGebP
-Y,RdU-lPJ[RZ-HHlBAV2a(*b&Q2bdJZ`!NZkr`"8pFT+f$fJEA6kR'SDpep,BXF!
-%+YIE)R-)fQYl6kUk-eA5m3D$(!MC9r*@I!A96"aT2Yr*abSA6JeHH,DF'$EG@@!
-2QqXB#K-&QEZ-JX5$'8-8*UIQEk%Spp"RTm%165K1DR$-l(*iU85c-jQ&bQpQPCr
-Z'J43dUXA,c8(+,0+"Vkh+-Pf00kja`iJ0bj3)bf#qQ"Nf$JRe!Vjl,b!B1(X&',
-&0BS'm6iR16(C55#l%,,XZKK9P'NKTiZP)8l03%afRc[U@&3K8iK6pECa-f'P%F8
-H0#GPjALIhA"10@cCUC!!pFHj`abjJ)*!)L'69je82'CEGq1Yfd+0rd)GjimrE&+
-ea4rqTKZEV&)+[C8+c8`)2*836M[%MCH1*[&)BiY-6F[U(8-#P$T&M44QlLdb-cb
-DECm*BM*QYRm2B6*3aV#H4Q!(,Sm$P@hQK!J$C-2#F6E5eXj"Uq`Tj%f'm+0`I"1
-TeGmKL9rPadH2q2!S2T6JS5!%9CHGT`YDp"3)1C@@NXS`f9R,hdi0e1&NaZj9&Cr
-kQKI4c&jkMI[qAXmP4A#2U`jf"MZ(VSVL6Tf4T9*e1FrhRPrjU4R(CIjGQ!-E`bH
-hf!3f@(b&a@lPS$ZHR$M)Nc*(CB3UEP'Y-i"PeEL5!,S2)d%$EVJIe[YlI38BS8P
-XKpdGAE633G5!6(4Da8dP1X3jU9iaIQl)Q)%bb9k@C&SVb1"c"UN2N!$p9T!!r9D
-$Qjr"PElB22)A-2Tk)`q'Ni'Y6@U5!XKkr0QNZ!eCS8!DXI8H928pE+f((!JdGaC
-E82(a(e%Sfe$il+VQa-([X`+MlU8djbI&e5-8&aKA(mM2M'k`bX!$jH5d-"EEK$r
-eHY)Il-FrSJP,)iH%k(VfUkEL#$ZDJmX%3)ZDf(X!,lI$4A92V"`1ZVYLCHbQ'b[
-"bjGM0@#(NJSM*L09KYeKDE`e1i$MAmDIrILcLiFmq#@A,KPbk8@q0#UiR8M,bmh
-S6YDaf(XE00q%2`Jc1V!"Rc&C2A2(VhQX'c52I6MJZ#1D,S!pAIEGCA"@NM#P'Xm
-`rc4LZ5F$J$X5Uf%h+U!6Ed&"m'4X'jB+*eTD#YJ6S&[ChR&ZE+Xb8e[H#p!cDal
-m3EL)Pm'BYY2&[-V&A[CB$lDK'3'F,Z03KCZ1mL8J[P`KVMG"Ll1!&`F$ppMlNmY
-*#C86%`bJm[GRpG""-RYG"c@cA#JTGB$-cd6$KM,4)"-U`TP31#UreLm%CYJFV0U
-Fl6HLL9qCEcmfe!SeC#8bBb48N!!"&@3)&45V!N(K-+S5cAYU(#F,pJfhTZ@k$iF
-SS[@k5jAaK'c0X2-+KcRVL95[SHkbU8KdPhC5MZh$l`UR3Ma3,aJP&02laT65A9B
-FT$XXSqiJJpq!8XNUAD*4PF%2UG&0bf9*,0"U"YlC[%ccLV4+a@8%3BQZpP#-p8,
-Pa9B8mR'S0b8"fL-DXK*m8b"SET4!Z9I82MVk%`KdYATh*JM9qJRqV&EpZTS-RP*
-8IKHk!NMCG+RZQK,FGX`V0[(9iN!eS9D$c2*riU%ZiHL#D&Tqc`ECmTGRBbh#lC!
-!#dT4[6r"`k["HVA1(!F4Dp'*'%*J-&")A&`hi-!1TMH2elp3QJ2XJq1FqBJ0k9X
-0$4EfE4KBD)9$8+KaB0Sq#YJ'M34U$lA%eR0LS-%bf&JrGXJ[ICUrhrFcX-P`beR
-*a49Tb(Y#lQK$h[FD*hPJI%&+64fJMf#YBJHHjm6Y!CK"LVI#D5[aq8J,J3+fV%P
-U'bR%-p'X)$T,-2%frc83'bRhRG'BlH*Nmj8J8XeKE[c168he)jd-UHiM"dY85EK
-BEV%mDQ1S&daI(SY#rc%5Dr1&AfQ&@iC0C6Ce'C`!IS*+lH3'Kh$A+eHh1DGkTeD
-f%URjH4UT%8N2*MEK9`*d`$D&R*c)-%6I"MA3"RIp8R89E6q!lFGjFfJqe()QLNl
-2-)60IpaAi+B#(MXqEH*2Ck,%a2ifYNC0dI3K6'8NTDL&M3QP-+1$hP!$M9#F@9)
-,0P),YP-0[qY6h&RA`,%G#T*!l3ZLBh!k8@E9diTkf*LQ(-4&Im%APDq6JYJSe!-
-,"FV"aL'rc)+*c'BY[cQ1#Za5&)5KQh'rjB88KFcmMJmUJEVi3"fPT)ASeRZS-`p
-Pr-S`,)G9"fMiD1SFXT*6SQZ'0Tfh@NPeQ+3k8JVBpeQ!I6i#qciR3ZHIZKR#"$P
-Ui(5QCi$#i`'#qel*"&9R392J2Yk`$[Jj&DE5#[D[hG("i"j#ead("rFL2RD5,BV
-BfMhK*)(8dMi)c[&3-Eb4Mc%!%!0r5'ip!AECC3Kh4bZT&6r"qaG&FPpZBP9ep9h
-jUH+5Pe)!EcX65Jabi54)#+`q'm!NNTcIc$#Kc("6J*Brbm+k[,+`k%qqM"RFIp1
-`F!`,ArQc,Ia+VE*3F6FP'$S0`-JF(-$3")"KYDB$')$#P+CH02M)++Q60Lj##0[
-1$TVM,mP`E!m)`q@-R`I@Z#`jC-i%qc[8-35mafp2C!,p(D2DFef1EJ5[28L'hPF
-5Sp('il20ZB#MLer[r5[peE+1k8q-`1&1GYI1cMFHAj!!`H[Fd4Z26mZJTF!+%iN
-!0*!!Q'#&#68KJcGCRG,J5kHJi-X94B@KBY3i+IYbGFcr")B4bl!DTN0VP50,P!2
-VP!2VF1!1p4!89MNU&GH2B[D),N+U-[Ukk,UkHrPZ#e6VGV#!&NUID&"pB"MQq+(
-J(XY+'Ef$0V["k!"DM`@8*N-i9!3pbND6rRk2M+lP$@*,e+"-f9)9YV5Ah8FE"aD
-H`b3*XV(cQ)dT+MbU%&bSjI$3V89fdGD#Y$8E05B#!dc#U`4TX8'dCY[e3[kLc!A
-h[M0%I+(qMTa@hZhSf[X1a"FkI$m"98"mR&,Reh[Id9me3(b&d"@0)3d#55$!b#'
-#55$!L+h2Em4[KX%qlm#fA)12-LbQ9'Q(8Vaa8BQT#[)B6+%U[+L9UK+PUU`H@XJ
-9`HKT'I2ImE&K*p%(l1SB9hB1eGY`"aZC`8ELMAH`N88K#N%qaD!Q@'$ehf+h(el
-dk2qq+$2q[LR9QQD-TaI#C$LRCm11EL2Hf,f`PhrJ'&$#30c0*+GI'#jA,r'(4)9
-#kHBbT%,#X6##kUa-E28i0pQPVD,)j$ZL1-4@pF@mBEGG321+5pfMkZ0`NQKc"cC
-B`#"S-"YZ`,XGkE8iTmV8#KiJ,"YR-'l1JV!RqL-iP'%5a#5)53!6$C-`*J&-2[i
-4Zj!!S5%&*KXC+-43,H*5j80$0(*BYbSTUK5D#fKJDV5FI@aqf5h2"&3ch,#-94M
-kkCE2ZD+E2J(D-cEaB&#qH)%"2aJXYTedacCB"SGZXUE"5@Jmd$$4`)#4NFqih1E
-hE9IJ'Q!bf&8&jV&Jj0GrKjPPT`X*DRqX8SFri&jh@53C#RjeN4e&j3k#)KQ!21h
-LBEeDPD3aZ3HrfXQ$E,Mh(,%CB6aFldipBJ0T![RDbSrFi`(k8Kd33@"k"4a"Qr@
-%BI9Q2XaRCa8)dd!)Ka3e!&B-Ge@HIMXp$M&8&4c(Aj8A`0LpiSl--9KIkad[5[h
-m)hF@!r)K(2'1pb%KbMG`&X4V)bKH'0dcHF1"C1d&ESL")Ep`f2T4)jA@Z++1#fZ
-PD)JeF88D+5j3$2Ph"`eVeTjUq+0G$0l0"AKBU-2R8'8AX`Nl1`Y,B1q6[XHK*T1
-qVj(5V()q!B)2+0f)$eKqE(&B`+C9Q3cY-#K6q3bR'b(SbAN-3[HHF2r*"XCYKbf
-d94H(i'fGKIbcH&LQ%2lKZ29qKKNmiZBl5(K11(""Jcp"S5&YS3e@463&B+I-*eC
-Lif212!r"KH-GqY'm@Br@MarDYTfU-!(@*L9Jhq6Q[JGT64BVGHJDA6J1KSJCE(B
-c3DS!JE"%K3!N9km53,+[K`NY[4UMbMEMj9VaNU'jF&T$b-&"VKK85MmH0pDEF93
-`!rH85LjZ`maBe*j*[QLVFM55aGAMbQ8[+TI9Ab+a8Ce6AVif5GY*[%4$K'T6H6Q
-$6J9"I+m[Fc8"G&CFFKHlZDYYC2F[%iqe8YSja!*#Gi&S-6KJRG4q`%RT-!'1#9G
-9N5"1VdbLL(ap$p)+TDr[35*&I0!LTS9FbE(%3Uk@NEMPLX4jqkdh#PH9E@-BYBf
-(A!m'#aTT+3D0`fJ5bJaK5QdQf-FeNhmk,kdc!(%if)8)2X2X5pm$[A'%Z@J)Nq2
-&JTNd`8cf`M`HChALCcA*5Qf9mQUPfrPhhX+iXGbAqXf$9eC%MEQViamKJFkT"5Q
-I02U0CFcf)U%,9U[R58ScKihlQAj12I-J3Md[8Z+i8L6Tf4AQdc8Bd"%-U'm'J8L
-Ym4crrf9f$IRdMj8K(cre'eFRT6i!j+GhqAEQE4a@*3Bpj)9[MD2DfNb1@%'`PCY
-,qM"%SC(d#D$j4EAA5!T9`afNUA2U-LIcT2%GGXh`HkIJBT'#'J%,KdpS8L-D%%f
-LFBZlP5HF,#2h5k4Ef+%"BVRHakNaVZKT*-E!H#14VaRRehqH4DG80iHd@j!!#dq
-i&aLIF6h3%er#')VNXrFL(q,2$EGm0KrjmjPh)fYrL@#h#F&5bVZ8a!Y("0`8dH"
-0p@$[r8K22m3GI-[G[JF(%AXCLje*%EClV1$hR'S)Aq*'h8F*rK0Uf2l*hhNcidE
-UB-+2G"Lp*2be*2)6*(!-`'PpL34H*EVJPeFS`TiecZY$0AUh'lhr")&(eT!!`&&
-XArjD3Z"mkp-&rZ8`#E`'S(Q01rphAQr[jmIK+"!qHN0`%@Gcl*f"H`'!d&ii%I5
-`U+TfdZ#LCGcJ@M%-+3pa'1c-Se0Gd98qQUSN6)5A4lk"#X'XV!Bj+*4jHqmGMVa
-(*S0E%+m80T12V$*-RXK$F,@Q&"*prQ$Q@@F[Nefi4+bD6)*N9@*jbq6(iXCGr(-
-EEL#bc@fF5#j)Q"8ZpU0D0L[I+"*[0b-Yk&TJf0)$eIm$Tk4[2a$0#J&6lZJ64JL
-5CNb4%9B*%IbSrZ"'5!T*`',,2A&R2a%cKf&b-j!!MCrcD%82UGP6$D&C%0)8f!!
-(*mpHl64k"B(KKN3mq1IQ*f&drHXrciNUEJ62"UGIU#rY3X`!iD"iSCHGj&%GFD'
-eG+&A-*KX*AGAA!J9MA`$&h)FFb%E1R3r*E9$aNhCJk'%HrQbQ4Hi,)1TNJCT)AF
-i5P#!f$qN3Z8%QQ!!JPPEaFcDi!#MVBNKYTL"#Ud@3pRk3X3Dl4*$d[)2ZU!9)Ud
-M4SVKacTh6MKaC2VGelj[8iF(3hSmF!mEk-B!!a63-j0QQ)F&+e@VX&,A%fa8c9!
-fkNT%6@&SiQk2b@bGSi--3@hXQ0f[6kIc2+JV-8e0B*VQ&+DTC*!!68*('l`T-33
-$eU%`5dd*CURfB-`5&dB4#N2,-'Z%EX$$h2B)*Bl2'jM&9$jVp(QG#-9MG9#4Q`"
-l`(c51Y[192HPXprk&`$dh8c+2'%eKHDA+IUC8%0&R2aU`6!%mUB9!M3"VJPia8*
-(2),A69P0BD1U"YNS02j-dU!+8m6XR#B@VISJ,&Uemcbl%)*4UrBd8i2&-0a[SCS
-L%d+jkk`BZTk6f#rH4T)C-,%4JiCD0R,#B3e$CVGlV+PfC)%I3NSij8RK11%L0qT
-kS"!#&)AG58i9+*aB&@kEZ8ZQ&68$5@$KSkYC$38AD$$ET+HBLK++IGfX+%L2bZ3
-kC9'+d+)8SCq+81-Lp!mm86'R+D`JP%YE8b(23I-ac+!e8@"T$+(Fc`aKkj!!)3X
-i(1+ZM3&T6eCFa4EI36I&YT4!kh6EK8cH0BA"K&2XM1cqS`mF+kqkB`"DSC,Ir-A
-LeA%'[$ZI#EcjZ[l"0d*J&!qeB[*Jd38,GmD-%'mqmGJFP)TrF[l0#r`*3iP(hic
-Kd`m+8UKkHLL1*JX3h8qV'&b$fQ-e&&Z@pfM2K0jm[H%d*S%hEk3GS!fQM(8A2rm
-E''3hM+@Mq21R#9E0j)%Hq)&[BcMAf$TFj-A#94!jGZGC"dDRqMFBTYBL*bZQVe`
-k1r-X(VU)2jIGX[lc'0b@h%JSZA!#DDQ,X3m"ZYbBi3%E2`YRqC93'4H3!,UkM!6
-AFXqFG4i$YTchqJ'&Sd(#qM&q$!b0C@d+L4`dL2[9YFFABZ[Ka0SbIICf8@b0Mb&
-k'KVCJkl1JeQTcX4MCZ+a%$m'T`5k%)BB5KcUf8Q,3@$-#qj("90"fpa'$mqabff
-X&Bp[JcSc8#d3P`K-Bdk1Iq3"Zfb1k1T@$*1VUeZmQK&$#@2"#9,Q)5BRV'!63`A
-c5hIL*4,EcXmN&[A4Ll!J0%FY@kQrrM8lpfPT#ifdKH'M&ND(,%blS#a*@jJkGU%
-m0'4KbTPS%NH[0`ejEDBGHb(Y@2Y4aeiDXY!qH#`2hEjm[I%CIK'P,UKr-M,iN!!
-BI)6*@3%TD2KmcKGK80aX2*@2`-R"jAHdEqLBVYh3-DXCbI6"4hKJD,#'la%cc1"
-"-l'+M3K-mX3#[LZ+QiD#9Z#%m1+9Q$*XX4JqPD$jf'-mJ'aNkfm%d`%@ae3krH,
-9Cc64aAP!F5B8!"e#9f*i["jNS)5'$m&3m-2,)PP",#Df#a*#!r(HP1B)'Mq#'DV
-brR(IR`Sh&Zi-LJ+&bT`SJmU%dJPHHhX)#mSAj1f,Lk+,,M,VY1iNA%iaLC36ZbG
-H0EZca!M1mN&*mff['-EYKBk5Z`6lZHj-Rm+)"Um0(LGAZ9e%@&eJpe,%("Y[$`Q
--MMV`K"K!&1`5+ZcY4m"aHZdBKTA[4e01+#pfKZ@$0,'efKIFfT`)JpB4HdrJL-Y
-VFHGT+aS#PHAN`S2U4fXiX)9SEXcNe4`(*Xa%9ql5+b3[L'+5Vq'Sf!T@R(LBKbH
-'SM66JeCKGQi66@%Ub3@fXQ#U2848dJM)jJrk([5h%lPTpqe0$f,B#)R4l(GLN!"
-iU'Sr$`-[0[69%S)Kj#pjq21*Kjp-IjJCP0*&FQR'j90G)YJXZ(MSprqFrYAX-aA
-5S[ac"!$""%PDHC9GTL*R"IY!JhKc+M8j+L"#r1-'&(C8RIVLNmYb9ih3fk@CF5%
-'AZV4"e`DSr!'KTNbK5(cJ9k6"pR!F"Y64LMGH&1CN3H&%dA1lhpNT1jDVP6D1M*
-jZ)jVlMiH9[ZZaGEKc'F!qlDGH$B[QLM4P2jT%*UD(*E5e%j!0%qYQ0TTfSUTPDB
-'TUddG@*Ud$5$UC1Q18`c0-eLQU2T0Nbc0&h%G"Y0+c"GT'NHd`UD$Q#DTqNiTJ-
-dRF*dR+BZ6+GSfSZTLkCpQ2E5G!61Cpj-J*S,bAr9-S'"MQF(T)NrG[baiNmVrKK
-'B!Kj6T)BIF@r%Q*dINCKj+qc8H!I+lLJUaYGL9CI5JaTa-e%Z,XFQ&bZQdH3!*0
--U3,B"$$PqJXB[eDErN)RkkX[69mKXVi@IpB`@HI3dP1-fcEHN!!lJZ(K[[M0CYi
-%[d,hlY)ArmZhE[rUk-@q@Gj506IiDd2hMS,NVSf&b$8J432L'QMU8H[qH+h+K0B
-hKim'%U(E$VE-(6[i-LMc)%,e$U5iLTajiFVrXCX-P#'50UqMf2Rc[iJc#$kSB'[
-TXDi4JJUU,Ab*kZYS%[F1-aI968Xd$'Ce&eqZQT2"cIpaY[TkE)3ZraUr4KLrJ%2
-VaD&Va`5Vb-2J`fNp35")`5"TVK-+TGKZR*(1AU8"GGeS(!-D,IDamfHPcQ#k,%3
-mTYBl"d0mN!!M#)Z9&CM,#e$U$+&Uf-a))6"9NHA468j[2HQp*e3X&+,#NNFUa(!
-r[UMMP[+CeH4,Jjq4hNJD[3k%4(b*3@Cba@P2R#kB5L0b"d5K1-jb-99I)ZC+9Zp
-P9i+K+H+VeM%aC(0F$"Z#4'lciIXCqpD1`Me@PmC!MSF$DdBUKCf9-830TE21FZ$
-Kk1C('VUQbaUkCYNGZFIS9Re',`r`Xkc$YcLUZBhR,*`DG*XBXQl+#1T&T@bcNNN
-'#ZQ1e#J&G9*FY!$QkpRM8[X#,S1'V0bJ*FN!&)8j28BA&i0"EXrTDBDVj,6+AI2
-5YGRL0!A,3#%FD'%J(c*CA1mA8&X"$!4F*$UQY3dGYm8$ERTJ+#12I`CN8KPLA-X
-TLI,aa"%Q-3Q1V9r#b%([bYR'GMJ!qihJiFlLDfhRp1SU"mA"@Yf6XcVB'#SQmkr
-6e8"SJ6lm1am1JQEA#4T$DM"$&8(jp8bH!hJ+pPbMl*C8LF5AbB'R-3m)(L*Lb($
-QhQ2hC"KrN!#8H3c&"QH3!,!R3fj5E&JQ"RHUi$#0Nc[V0M1XNj'2BH"qQ&U(la3
-YQX#Lj&','0lP4CqN,CV!STiLmj'23%*)$6VU84JEqfmaBa'lH98-')N+"eC4Q2R
-[SVU"aK%Lp@pq,Rhi*$%iU5l)ra`Ub"*GN!$4'``9N!!J5a4"KY)&'Ee%$a`Mb1K
-V*%L!6Y&C)FMS91))Hd+3!*c35ZQ#I,@cf$a@N!$4CK*N5JF4Y3q'#P+lN4"NL3,
-&L*4@68+Bi9H&--fMK'Q('6Bjf35Q#Xrarf4U'3*q8dMFpN!ijN`H2h%5P(d1"Z!
-C(5USrlcdVlpL39@@TJR+$N(K(qULCFem,*E'$l+8c1+VC@P,QfQT4NZYbP,l88Y
-"$QRT"fP,VEa8(U+P2FV5jS-X[8e,h@P,HfKT%beY9CCDMc9),"AER8YEfSUPGfP
-Kk3X[r*pdbFh9D3Y,XE!8F(U,q#G'%XBFeSfj@MGQ0U%Rdidj@NE'A$,8Q-8!*3@
-#kiaJBTK(!HeY93eK$S"dHVCE[Yd1Y[6Vf!)(35(ab0$"4kiZ-ZMhC#G",D2-'Mp
-jA3Q6@X(X4Mh0!)4i!+U`Z3bDM+"e%0`mIjT"Q2cN+3+l@Yf'#&)m,*JJ"4dD(@I
-YSb"'RL3@[j,r-5eC$hMAlcSr&Vr-iGbm%XkG4c2f@p1ebfljAS-MJVEKPXme'Zc
-YKS)2&!9helXX3cT-NE2h"e$`2'3L1bQicZFfU['CHh2YAlM(lS2-E0+4hG2lm9#
-RH'J1`CMM!U8I06&i#QeZ$F+BX-IN&006F33'!ra"$d8)d!R65k5V-*aF"4-*cbK
-h,F-&*f0lJQAA2jRTRr!c*9MjTe)S$%f"EDYd))%('F2,%)A*!!+C1ANUT!K"bMm
-R-8Mj)B!XFXb$!9r2`('&#YYbUU%f3d[Y[2#E!j`-%CHV(FAa$IqmNekRp-rrA%k
-I1d436SXXp1Q9Y%mc1+Ch509kKe4VLN&S,Q)DlN`N"j2L(f)#9#2KE1pIrpmi4+$
-K8hR4GbMP&MELBLJcKQ25i)8J`GE@CMc%Jld##"l$[bV"+6SFZRjdF%!fIV$iTlC
-ca6h2er1!1G&cl,pbbGcbTJA$)NZ62k"j-9`INCB8,NZT3@#Frr%MEVL#MmG!jP&
-,-#CPXFRrh-R"AV19&2FFr4TG8I)rKmI0rQ)a0T+A[mkK2J1K'@8aQLC*VjDf0BK
-I@SmjKSG*6BQZ#fJ!#6*b-c(45!30J!QZQ)!jYb2Ga)dI5`BE!kF2``8!!#-E384
-$8J-!9q)293eQ4!)3)H,Z91r"58kmfLZjQ#[$k#Fj,aH#(%fYie+UJ-DF*cfZB#R
-MZ[%8lNk-r2i@N!"5amfF!5eMhDiD0q0f-PNhQdN6'`aLaY"EkeVMC"a$l@QXieL
-EB4cUd&3003FPS[$hrhl[ppeh`1'Cp0PRRhPq!"eQ2L34%#m3!"!3!""4,j@*[fK
-U`KraSeFSN!$5B481A*FXl*'maYH8V$&P0li@53akdN3GL+E--E2PNq8[P9Pl!Cb
-c)d@IcCmB%HfQ69D%%KXA4a*(HX!#39VJCaFkE"jBfEKVS%`%Tq`3CDrTE`C@0Lf
-QJGZQaXh)P-kiD1Zq2BBLBUrZ*)9pq,3#dkC$#)GD4FIA)a3XkM6PI[BDN!!*)0m
-!`QikdABZ8[6&*"jS[eejIY+Pkm+2-@i+&Ef6CMDEkX4jG(!C6CSpF`b"@a3l3Xp
-QMMehpCddeUP$kD4A1RNLL8JT1[@JNf&JAP[3j2j'%hYkSqcTG[ATh(I51Pi4RD3
--kqehdL+*I@pc%HM#d(ZB-S-VkMhm6-HbaGS2a``&ADIMjd3Nm@#Hp8emBZ+I"HN
-$2e$LSRCF!U+dF6-'pQ$L88aXia2hi'Gh*0'qJclS%RT@qe%h3X(G1F)6@5Tek&c
-*TbDQ9V-VNqTmqrZEQKJka"CdH4TES*Y@aKBid-PTE)&MHJqb"@hL9EDJl9%4p)(
-iCE"iV,(JC,p`a50mXB38V*Y`UU9MqLJqD0JpTJ[ZKaUX0p4Mfb0,6iee!$PH9(N
-qDDJBImaGD62LE@Qdh6)SZbkdcc`ce)`#MB3@F`,mLCQb*bEFBp,41!2PX`@fpIY
-9l-M%VMpJ#,$dYbrXhqGEJLeiQ4K"NKHP*'Idp8AVdU0*bDL,&Lhk9NSdp42R@SM
-15pPTC`rQC'JCmNT,5dNqQaaG*2Cq!3reAV(f5N&Qh8RV-)keap"L(0HZJ!QpK-4
-3!-cTX`lcaABF-KK#&CKPTi%[YQ51D5($'H-CCbM1-D'%iSMpX0NYNB6Bj!DldT5
-B"qaI&1Xb#RlK[)dZA1P)l`CVVi36jCM*6B&fS'*ZcZ!LSM!i!XB9r-U8)rcBF%4
-dDb'JKK&LXY-"8T*6Fl*e@RT@0Mi2T#GRTICTfGSa,IGXhCQ8R"0489-TI1"JPLi
-Rr8`d068V94Q+CZZ5,bTMNUSSk+Z%H@9U'cA#qD"Gd38RRcFl5)@aB5YFYD3FpeJ
-9UQT9,M%X3@@`@&J)m-#0dj&%3EC@+0h#(APer$)#3(Cma)fQZ9H&K435pdV2GAb
-GrLFe+5aUma!)&`F(RN5iI(HPF)"-RJjh"Q8UC8LrS39EFbbY0&)Sb%2(X!i$l3$
-b*%$@&BL*`cT%S*4Rh34e`i#(2cmU(5aQd-De@P2Z,aBU`kDN)`+I@iPKiL0b&UT
-ji2K-J+EFGcl&"+m"DS-3U+S'iU)TGdiT2Jj%LZDXCBSS$YeqKeHMCV$11bG-Z6%
-62QlLLSM5jBrJF*)kSI-Xh[%"X0N'pP5(6FGCe"'2[Y680-p0$j1VH'"jB(&hbiY
-3R,$JM`-CINPP!B8"JY60d&)cUjdLi9@$dhS#b+6'@rR)8Q,lf0YJqd,1pK9!0%Y
-XlqY9f&lUIUfC!T@A9T)l&-k))*Kre-LZNN6)I)S*K6dNN!"P%HY68(CC5%#3!$[
-dippp`GbPKH*#0+0Li8+Z(pFmA-Jpp3ZjYCHZN!!b*"lkKiI0R9C,apFjbp3Y)+!
-j4-q*fHLm1MlDm6iE@)m21YC"BJ%6&r*BUX)Ne&N,+5k,bfG6)(D5d2EeR8e+LQC
-RD%PC+9V@J@3YbkbPRXh@4Id@@F`kNf8q`fFT)T[N8l+,K,HEA$*I+lk@dB@P"kB
-,UN!h08VC598G-U)4!9#($'$*Q*-$()HDZ6&N,JpSNm'!"0#8M1AJl&S0F&DJCL`
-*bUH83HEJ!Q+,AVLjDI"$3`X2qG$L!AlG9QPK&"ZE-mFbZME8EQb1cS1LD4J&890
-Zi,Y1X60aXB-i0R0`ITmH3cLl(T9,3%lM@Kc4Y2%SB#6"6a[p2`'3!!QL3((,M($
-@$h+&JQ'GV0pfKkYSRC2efd+ULRMhDl8%$N'SYBlBL8!"B%SdMS`k&(96KPcZP*C
-F6(DcLIG310rY9M1MEC3rYF1C'@hpeCkk&fLH%NV'3)KQFX6,fqM!`KH8!dfM53@
-@9a4J#G,0JfQVV9hm%N&X6q+QJN`9B()488&RU*Nkk0V""Pi``48E!%T%3Dpd`1k
-K&IHZh59#9,TUf8I8,90)8k3Pchi$@1*ejd8A18XBEbV9qqhaTP)L0A6Yh+5LA[%
-hr"6!iSGmq%TBX(e`,`FEVRD`9kTYGEMQ9R(dI#ILSX,-0a&Z#5N&$&Xf6SdQ(6b
-E(Ud*1Cidk+Mr!EQi2$&#!Z$NC9DPr5CXPEE,cbTYP9p9QJ[LZ!EJ$3Bq*lF-,&q
-fQUUh&dh#5d"`%F,f$T5iC)X,bQ*3L"!Y8,$3f%FRqiL`Mh(fB@!IHTMkM$@9Q1S
-Xb,i[AQ02698EQ+"U"Dbd"XbeQ`i1F(Q)LbL-!XVcXIecY*!!#JDam`amRL)'C#3
-dG4`N%SQ62!bB-aE)MHCQTIj%bmR@"P*6SYNjkFkS$SM#[RT'DfCT69*CUI)l5)8
-`221#d$2Jq@Rid,12+IBa34mG1US8Ijp2a!&9I[85#*YKG+C@)LG%d[&m9fjANMI
-IPA8"fp[P9*!!ckJS+$C0TU"e6JAj1Qd9&02`l&BB%'UkmD6MfrM&fk5,0mNZY[#
-,5c"KN!"GA)+I5TRL'f8ASq0R1qMLr-9#ba,LCR8eK!$+Xl,6I&rq"KLK`MT%f3j
-e'G42rHM3QRZ-!6E,''!MUbi6RbN-%11&41G"0XN13Kd(*3B"!pa!*9G(+XeKCD,
-Xk)qeb`HcdMr3`T!!rMBCV%b,eZ@N*&-Y+*YEp96r@#iR1bGCl*A*'Zr,R-dHJ0q
-RLI3h5#%"Mr8jFC)BD[5BH`c'FmF`F!c&arY3d+DM[ZlRK2CA5c#SiDF2"9ShLV1
-GND8M!PRF"a-UNE5rHqdhGk#3!2%0%H%NSpj8ep4%KNf01b&-([UJd-5G1kaJ5X1
-VdE@pB`Bp&NNmPjNjKSTKplBCPm&%M9YN6,5@-Um462I9f9,Q0B)j'f-bjPcMc$c
-HN5U$VG,&YlGb3Y8S,DG+MF)ldL4#Y4M-di,M-l32K2jVcABa@@ZZL"pLh4*'!E*
-!Y%mF%GiEDVGlGQQLia-JIrC4F(&6dq3Y6#cmbd003TSk1Kf(PKifm)G&d`3l'#N
-cSEejDN`eaI+e$9PZG,eT2pjlaI1PQ9p`I'hiUH!cUardrU(pMcVrFZX#E9(hLiD
-ja[Ie$idq0h9la$VaUdGqIZIh*rrXb(rUqfhrYirY(acSf(ISN`[[QLk&V[Cm*c,
-QrZEij,P[jIdSmmr2rlp6rrIC-r'cPp-cSQEGaCc$(ac-cFj+qZqT+FN(dRjFpj-
-6Ih(d[lhpakklVpBfhl[jrCBrZIA6krrPKrrMfY,TcmriR`rmml6rqS0rrI$[h[[
-rmrr2TrrlihpmlHZ[[,Ai'fm8,AQRH'("V*IrBH2VqGp0r)GYhp[mRcIpCYG(Zrr
-qXErCmGIE(klmhDTI"*DYH'(GccEmlGTr@r2,2Epqr*p+rqAqAl9qEZHrPhhjkDq
-XAllbdBU[E[NX9PliaC+AjMA-RY2B*-P"9KTUX!2C@XB"AX#f#6IXRDfGjMQM8Q$
-9%4S9Gm$30cMS5,5rl4j,%q5SpJPH$%TB%`TVNTK[5G8I&SDT'k&la,BS[UjYYp3
-*EqINc38JPaLV)p`d[KL9dDJBlcQ-Qbk%lTiD-hZid`C#-e(J(KX"8RZ6Sd1KZfE
-(lAFjS)Y4Kem0ZXF3)Vf4$`220&mmHl`@aNqZA2-*dBk(Y"Z6pf"XNRFD$hDiaic
-di*!!l-&pcJFR!L"Tq,AQa@NLG0-XQUDFJ1fVmpN#bKMC,C(`5TLkB6j-HiiiLbX
-0J8ML$`JmVBK,iCD'9ULd$m!MU)3F1E&(4ITfkNiL2NV&0Jm##5H4"5FaR!r'AdX
-,#(NlZRE+*MZ3!&9!d84$PhX-drS`d)GT,f0D*EVEDF!*FVbLjQ!l$9TX"e12"qi
-DBBENX+31&0mPeijj0@9#DJSCe#BGhmJVV)fm`QVi9!CX&K1`DDL-**CINi"03b9
-qhT!!!C[&6Q$$1hSjX%%493hd15*,hehCd2VZ9bafr9984TQb`hNM5bGG2pTd5$`
-c+1j`%f6Ra'"N+8*AC#SM(mB823@&,,*"E"(2'Q`[$U%`SCY"l!h%1)kh+C*iG$T
-p%&Z-*0LKDIK$#J'[[NrCbLl!ie#MCUY'Sq#CAK3cmd$!L)l809p@V@lMkYS@5Db
-rc05e$6mIbkV9(6*eSH0ARZEUiZc`d#Q'S-aqM#f)A9D`"GM01j-Y`)S2"LQ-$RE
-P*PrC@FRD@E9+e"5`%Fe!M$)eHMChEm"MhrJq,IeL02f$P!1j@Qj15ZlCj25,[b8
-k2`R9EXECj,0D6SV'+Qmr5$J3bQXBkIh[B8R[-Mp*ljKIT2Gm!-"+kj!!NBVi2*!
-!6N6iP3XJ)3Z)&1jZiD6f2Z&Jj,-p91XH-a1*YUS'DB4UmqRh6,N0,BcdJh(rPlD
-b6&aR5rSpED4-"!%@NmJZ4RD$N!$JC&HPl2,G#[RhG)H-r![)''52,IRhjHf8Z%!
-KZh(S)!q[Q&km#%YK$bdN)q%6dG3X,5X9T*MZE(*1@P5lI-"XMUCbUSSST3kqMQC
-FbNCf6R+1N!$(EU[-d%YMmYbY3B69FhGIAcfMTd2fkbR6$#d3$-VU&SQi2riT)qj
-lkb2ZZ6N`*qj486MZYk"+#'jdA4lZ2SbK`e$@d+FMF`q6f[4!8DGVc9B"P*d(ca"
-'CS,Z)%&2DZ)LlY&CrRDa##T"(HFK3aJf$h1$[jZd)2GB8P-m1)N&2BF+bq0`5#E
-5mL0fDLa)ikJ6XNXkC*GN)!&5-&'EBG5'VYfc8MM0`i[i0NI8L`F`KBl)3femJkP
-DmGfSjG14q%a8S,hGaiIA6VV-mlS(X!A22k2lfPTkV('$CXN%d@9aQRrR&JY*9)Z
-r&%j8LfIk*kV&lAk*kSlk40Aqb-$b&DBR)kSlBlDLHMbCLG-'@e(GHG4[8Ae-%G@
-Gdm+)DUQYU1l8j+)U&e&X*(MkSMV')@mpX[Vj%&Ejl8jTP3qITVLZ-&8AekjErSN
-Va0("KE9CTpFXefUYa1Tf@hD(i$U3!05)Lkmmb-U2`CQRD3QT'%PR,-i+["k4YA0
-aHa9(8B38$L%5fTS()qE8mi1PDhaD$hI-H'b24N4Er!Lj+(NR"'6LSpf(HFEl)C,
-bM8"iM%`-Iaj@$1ri+BD$ISPK"F5`K"*r'&RJf&KE*`aA1f#f(@V@RGFXX$!&4Be
-!EdQ5$b(H%L*i)%K&X9CHQ1XPJj(l,DqliPh5*cP1Z$J8a4lRA5b[5bEJ*IGGcQ[
--#53DQbdXQEI'Qch0p%6ZG8kQJHb&fIG9FNTj[(*h`L+Sdf*4-j5l%`akLd9V+ff
-"kE[RdQrdEE1DfjS*h1SRHL`,QaFGXPMd#p3T50DQCfi*FJXCTL`@E,&EkmPXFIc
-KdUEZYS9hfql5G,UbHk*6c()Ca'5cqIj$(A54rSb-h4LiqN)a(F0dNBMrf0-3!8C
-Nd#I-(!`-Z($4lp",iEmD$Ud,e0fJ6N,!*SJ#QeI('AAikF`a*&d+m8F53dXN`IT
-#+K1XqPeJMGBK#L8M'jUNJcle)DScRe+GSB,TT33$8Y9N9&88JL$S1[((JD#k$9K
-qLT[k8()N'D[f-&Epml#XHYj29MAl`kS0QUhbCpk4+EpLB2N,JiVbAaMd@rNpe0f
-J6P+92j-A,"J3N@G"Ejk8"9qUU#S,K&042#084Dk@-a%&mhNBAeS8FPF&lcLm8YC
-4PK($'f3CN!$+-Z#2`fD!bmm-Z1jA"Y3j9FFG%@$i&hBC@ZCbGkd@bKacEPp9m&D
-TNk3d`C9fDUaqP98$hKiCm'C+U0E&84fmmf1"&GB&phiXkL3GbpjFeE%@e(ci54a
-0FPZ['`c[YZD%)3I#Q1!CjF3KTNdKkEFH!BYlU)"NS4!pL&0b9HTkRfNq)XCV0pk
-,PZU(0)Xck3pRN@Q-4Iia,)ZmjLH,&2M&)MYNQF%FY,(cf(J"1A,GiE+LJ'9&8Hc
-FhKL%%lT,&q8)Ll#Jf'r4MZ[DaTFUB!m'+if5S2J84r0pZ(Q(*1B!1*`A+5ShmQ5
-a$H6d+QrR!4H2,LP0J#!XP!DPlC8r-Ji&QbmJ10A"hHq%$$,N6(8)C#-5@4D9Yi8
-%N6QkQ8kh(9f04qpc%kBKR8HC&*YpLKNVm30T@ZM8Q('"6$P9Q,U8(r((e%A3NDD
-FM1AJM'A+I4e"KI+E4Zl!,'F',Z8R0VVFBaPHbBbJ2*N0CaZ3!"!Cj2Ba!,#CXU!
-iIl$m)VVemJQAqB5%k+jj!C&&j%6df'9(19,28I,S#&'Be@K$ibkV01KQ,PaDK!`
-Q-Tk!UeFMpflj)6+5`@''Z5QC)KEFN!"-!UAPa``YQEC',6!*SFTI3fEc5r,d!Q)
-&phlk56+YiFr`,HXd[X8U(KNRFi$YP)9D$bS&")h@M0+5Ah0G9Lei@0Ed1*1-%ZY
-,$'PN!P*qLV[RpH4SP`DkKkC6jR$(GrPlQC*C4%*Xi'6QP(05KQE6TDKm'VP`q`A
-[2T-1)@FV8VkHJ4F+#F2!"1!a(Z((IQrT`jVp[UZdKIjIha*SDA8CLA4EMH0ke%H
-)000c`mHV5lGARl$d$3+hFU9E19JNa`V%eV'`%X6[YFb@c$pC@'NZe#lTce3h!YB
-c`)IM"3(fK#r'Ye9X&!Ni'#lh8P'i''CE'Fc!`,H(&mpDR3B'[Teb!i2baG6daiT
-l5"`iZ`!+Zj`R+@aTCEfEe4!1X(bZKB)"bcETlGSK8p)TN!#C&"6d28DAFM$FUhp
-q[$Ec1J"Zi5paQ,M`4@jM5P--`@ilQ3E$f9ma0Dce))P$6'qrheakRIjIIheY5fY
-c#+E"jVDM[QdJL$1kpYcFH22b2*MiG2'$I8`0Dc#(IC!!LMrDZkDN(Q&p%mAe![8
-!5'DKhILQ5cqBC%qiX,bT@3+eG1K&chX%#9#JfENmCl2-XePQfLc2fba2f5bIP5h
-GY4Z[4kr(CmUIjGA25K6I,2Qe'3B05L3bAe)N+C%fdLp-5ABBJmmTipA+pd&J$9[
-Ij"ZIcN2M[$"JZ+Q%hG1Lh*J3EMbB8#EEfJ)m%9-!UiH$!5G6GVfSJ5(R14Q59jb
-E@FAjF0L+Xp,2LR1YAa9R@A95i@Ip9C-+AT98S+)-*R@M+,193&UkGm%MC+iTFjX
-!B*dDLjE*#e5bcEDbcAiel'Dhq,RC4Vmf@k)Bqb'CVLF9lSM3UqRYf2+j3('R''G
-&X0jI#CpG&,mDh9Q0a*2!CU)mE@$jQJ3)KmAFP01"(hYi%S0hjF4HH8C9*)BTGf'
-[T)k&$iC6ad+[IqTBD2"((E1p-M)5&@P&XN*1QLjD-&"Z'&Mq5lG8P,%iD1&ZB8Y
-l[3@D)p4TVYSCRhDTm%,Aa@C,K&EjaUS,,dkLeq*a-Y)#Y4K5i9)IPX*h3lE(MZd
--eA*!0Xc#*G+dSe+P*&2h"&2hYm1UqjLIkJljTHj-HKLUZH8--+)+"d%9LcZh3!'
-XmQh5SF@jHY9mKbiaY(!L)-5R*0idUdXNM9RKV9V&dP9)m(#B6hilFfbr`!+9lCD
-5L38U`X`3-(IEdMLK9ZH0+a8b!NJkrLdNX49XJ@)NM!r3#!D+q1,6%954D2S%VRB
-3Qe[@R9a`ENb(-'IM5PQBmlaL5V!-C2kFDIZ(Q$%"R+%[HVNj()8kcpQD%bbMC$e
-EpimdcT-1fl@G"lr)j,4A)6c5cfD64bS,KUDD1HFJ$feH`!G-`$"f'N(-lja0Y`e
-U3JQ2Rki5S)!YD+U(,kcpqr'Ip!H)p5FAF,@8bY55VkJPm+'0@T!!K,ql69A,4PZ
-e",J"%#9NB@S[P061Vhqma[8)'3H1UGHAF)1)a++2eHYIPPf2cVrBaC4H+#Rp"T%
-dL6R&p5Jp(I(Ej'JeY8ZM6d6aiE2dL9p1KJZb6-8',5Gj!$&C%3K,(JN%9,VQj!)
-fT!rYbq3X6FEFURTl&+I!UP*&[6`SLB34fJ99[4&Eam#U$&)[Udime49k-#Z&YNY
-qd'Sl*p36h2KkCH0)aZP!X(48H+lK)%C"cAXFj-Pa36c1cNT69$(8`d%$ZFTjN@G
-,+CM-lGRAp'pF'HYPbR!V6ScIV9193@k-PC(%JMj9'BGX(4Qrbb4P8%"h'3j#(iT
-#N!$2'4)PjY3"$Akq9-#$N!!`QqGKb+153T4YYq99frC15E4X0MbZE,LbYIU'YiE
-#EEMbSRc$h0@JXX#28h-J5Y+HT3hcS5Hfi5eUCC2`ZEP4qJA1S28BCeCfbKaE-&C
-Cq5&c2KfcCH#(2qDEN!!D5[,)6I0X1AE[jRR9MmXVkca@@DH(VD`cr+bXNrbUV1Z
-8S)qf4+UDDe6$-m16b"T[2UVi@Kk-5Q3%4`ZUp'&L)PDpVjC23,0HEFV!"*RkE1,
-2Zf3A($APcSk6Qd+kV1PC0cXq"Ui6%LC8Z3[4G&h6)4RU3fND!X'j#emK"j%-q3C
-$YQ'"aLHD2!S5UTKJUQKaETYI8qHMX(+E3Jb,632,pdbaT","qNPJkX##X)rYK36
-HaM,kVm0Qp(Br-hU$AaNpcBDmpr*N6caj"SL+!)iqR39c[EC*3DTYF,Ub`6HEpl,
-"qfb$MiEGB)@I'jcYe`CI83p,"UCf-X['"i*mc'RC*KYZJpY"!JbG+2DAm54T%XU
-LSSi!Y8U'XUZSFd#p,%-j9&358$rJE#DK0"9e(5LA$$@SSX#UM@D*i6M+TD+3!)L
-dXBH,Q!m0XjBbph`VFl58d3F8-,qHV%*V05UC60IdU8YkENTGdV'fUNXk[N0GdME
-Ee#A8-5HQ,U'f16Yj-)i)Scf-#*qSedQfKEQ%4d@CfB)U[e9eqAM*jH-KjeM[CH%
-c6[bfV5[5J#5i'PScb"5Aa9(aJ#J@P@)R8[1Z6QT#JjDP#!3GQNY0-D,49AkPm0h
-KLF1fN`'[6mq4E5V5bj&,10+6j'0AY+'Dkh3HiTb,%0`!Z!bS)l,M19'VJ$VR4,Q
-GU*H"5R+L8Kf"ZbTb'T!!ef9)688H"HS9'@T349d'DVF6e88+8TkVARNG8bU[[ir
-,$1GPaXR#E9YjlDE!d&BTFj4U+q8RZCHc$SDam2l1Z3[IbFU)(ZcVddAp-24f"Pi
-j%03iBHP"d+U9XPiE3Z+d89%U$jJ5'iI!eXr+Ua"Q&X!c[6A0p``e59`'!i&5lX,
-fQE[Je'q01rLbc@cAKJ)Z%"5Y'lM4cCcVcUjiISI86EHT!d`"-i4@@`-M4Ji"BDD
-UE,%S9CTAY!RVjKEB*B"@m%`iJ&D`fMq!9Y$Y&d$E9#0TVTm9-LTbab,ZPMZGUDT
-"er#N+pAh,fr0(C!!3Mi`B"l@,*20-+VSP*PM)&!4U0hJNP!JUeVR`S")VPUCkND
-BkRiE9RApIUV1j*IUbRLL),jT9&Pl&#FPrJ5T)9dbEk'%2'MHc[1j&UYJL6F8`k3
-e0BKF#-iZ%5EK6Ya@`(l6SL6F8F%F919dMpB`%MS2#k@ae)aS+K-cfi(6-3cD+Qf
-@'3C0Skc1V-,&4iempZJ"A"bSA$a`mYQlbE(UQlb,V2CdPk%i`KIQQ00K4Z%Fl5(
-K#E`P(#pLQJCA$DPaS!)"l)H%BpNe3KHr*B,T)ae[JE4(Kqk(e'[EYDI3('D,dF8
-[q9GqKI6)6UG,MBHk2+(DA&i0ERa&@(*9JC3ae6R'9'I$-Y9P2jNUfaqQQQ153PU
-rlR@'Y1Tc2IqkYkU!XZSq6h603qFH)LE$1Fi*cBbl@UXLY6Kj8e5qMK%0j%ED)6p
-HZ)A6qDP@kc4j&k[@LmTA9@Rk8N,'&P5SB`IBkDC'R%YBSC''eUMCTCKP&*8hUNd
-%F%+0KU@3!%*K(f[DQaBMlM'fK2P6SCi+RK++RQ&,3PQi-pLV-h'R-`ee)J-G6X(
-M#5h+'0+aPiXkcIPUiJ4Xrj5D-FTa&4@cBciV1h+QcC((C8q9f$`e@12)298FqF*
-H,V)pmLlCNGH6FeYaAI#N'q6JAFm[UC!!M-E+U4(epB3S[+0H(Q1)%QP4f-X1,-4
-L0Y5YZ4HZ!-!r`4+ac@C6k&LVfG6CkY5JESS0+"-l`hEfQ0Iaa!G5iqJaFS1f25B
-l6)Cd'20@0V#kaN%p5'abAYjNKk+'d20%%V0V&8A%C)USN!!TSN+f,GXMHRA8E0T
-XG3XmdE6T!`U&&KkZfGfmSZ0j`pA-@h0$F,RGUZpJr0QMNf5Z*ahK935L+Ta*Zd9
-QM@6fFFAe+LADCXqR`@`!eGYF0i%AAZ4"+,X`DIaj[L$"TJBH0H83"j%@m22Yp+2
-QC)AUB$EPrMSZ0F"3Q'mk5#jVb3&3@'!-CIldI66dBI`T9DANpLjmJbYqMj3KKDm
-4Dj2C-*NAm`lcHBHe6,f[)9(,9VEiJH+8,jc"KRl)c%'8c'LK"1rQ3*`A"HDXYdR
-X,4N3Kf6r6%+MNMAB`#PHm+GXbAFfRb"i8%'lbVDcfCR"fP8T,'!m8bqiCFBQe-3
-&6qV2'CSD)+%KPNQPf&UF-Y,UB&Qi@cC"BLZ(MPb5$MBS-H%9+4aIH(KbHSd*AR2
-!pJRj%9(pR@!9kII$9U3YIPDN-rbU5*0B4CUfPiSdcEq+G&IE`2,(KbR*-SM9[$$
-9kDM5#F44RM2jmNGG94P00ke4%K$`*M!XI-U889$LB#3$2UTF4XBY@GNRI&mZiN6
-P$4P*Q8I,$Djk#-Z3!%*B[[j+'-)bdjD`I(e#)5cTRh4!iMZ@T#"F)Yd,Ce15Rda
-#ADNa30Tf'LAAQ1SSlPFq,1c$cMiml-2"2S,X`mXq1YfeRPTZF,`aMCZm`SbLNXM
-&ElTimqhfiLA8p,)S`!3pA%K)lNT6aiXp3Khbe4KUUc%d9'2)8Q2S4SfKVKT$EbT
-$-,j!mfp4dA3a(Uaj1,MjFI$S6Ja-G&a,me(6`++ND6e-b#DSNrEcrYQ"i[lClk2
-TEldbH+GIB&!mj1UhS($+"lX2DErUY`4)XBF@ZIVYS`VL%b$X!9,d*d"iTK6%"5!
-m!9,m"5!F)`VLA5!F!FU)Gi%)`NaQ!Ui03S&eJ!`'+(-Z!HRPb"+',!(5'k!-)f3
-RhrEkA$4('pr+1mCBaaJkmLhaMP!!bpBe,&ZRR%V5NjSQB*+IechK%5r@G[+"mH)
-H4@hV-*!!Tj(a%6UF3&0hr!Sh$#ST-@N(%T0f5iP$Bp19"+IP+ja*4Q0Na$*-$fS
-haZrK)F06a8H3!%k"VM91i($0qI4--5@D9j+9FM!hRi'jSV"JESQIB#lK&jLlCJZ
-Q[RF+)'LA(f"U9dd`Y6PqZQ"UmmfpJkQ!5`kQ!UkU`G5X0[r!9-'Yd`06N`HcI[a
-N`&4$krmD-0A3qKmhQ'TS26d`e9$fT`&-0C5G(TK#FZJ+8S44BT1*pj2`lm&Bf+H
-G*eLN6`p2fNHI$Z&JRd'H`*!!2Vh#bcil4HHlAi&i+8pmc"MR%FS'DV5"NRVVdB4
-$3i89B)ih(eD%IhF(!dj35-!LZSShQQEK(3*'N!#$V(0JP!`Lf86pN!$a"X#DJmK
-,mq-dj5JPM)Cja+2CdY-`Dc@aj2J%3LRTr(S#""A6F#8bJ$faR9r,(`#JlKUrL3-
-EU&N*p8M"+#Y3mZZ0@THcZ3J'5"pMJ25&X)"dRCq!Y03[3*TIdb4Y@GI!mRp+0V6
-mAQUf,U`a'R@53'LJT-S!#L20CFf@V6D1Fb0b0"6('jZ509a@Z%GUq'hC5Z'a*DD
-PDp"F($YS`EB&5T)5H90a5fcGKl`4258*R%Gh3QNk%QDdlDcTVeTH21308ZfeH&K
-Rfr#AAY"'b)M8bXf9#r3,*$-bGL6@I"9[RT-+3TE`cGF"3KmiQ%aTdMA@'+@XpFN
-ReQK8`AV'9Lq&CDYjrV(9V+kUf5TdHpD$CJFk8PEH*m5X"c2(',-&!#)Ih(GSAmi
-Rha[ifF"(!pmDh$6`YAdI$UB0IRr`pAdE"Zm0CJdQG9`Fr,Z"dAdIGk4dI$a`8V$
-r!*!$+aY"4%05!`"TZa"9#f5C!&PYNqr@ET4DPQB-deZ'[)aDkTcEN!$&')l!fdf
-PeV'9EXK#5&UhYGedep1cke-)Ke9h23b[Mmej$"J1-BD)'03&G8iLdSJh%I%(`aJ
-3BN!%3BKkHh*c2$YLl22prqrEkpZQQd$1ZArh04e@0L32%4!3!"!3!"!3)HlIe5Y
-4M`Gr&088FU5%&GQP)Yq%Lpa5T@cDaeaN%2ice%ZZ'4-CTXf5B#)f+F5%8G(bk(!
-3cX'Ep2@(&'GpE2"1-5'Pc6d+"-3dmh3eF-)FFrHTG,GFmRMUE5NV2*klTV'EraL
-Q3Bi@-QEjKr+N1-I#qKV&Pl*#86kM@krTeXPZh4!0K0Ud'-)ZcL3T6R3$-$`!rSh
-GATCMYhpeqZVdR,*pT@RTp[`MkGUpf9bmV+qI@aqMSq`#%b8b@+0FlCkJf'3ReUf
-#F[T2chZ(i,!GTe5'mq#feZ&@2"MRDBdH9Xam19F`+TU6iP3#3S@YdFb9*q[*a8D
-(DS03hHT'Tk@*%+RUKI9QpK++26X3aiqjhRV-A6X9d4'ME36qmE!E5fRbEU8YVp0
-BeSNI-hjXq2(LTamr2[`d4Ha"1ahejG+-dJU1'X"CCFHQb9dMKRlb0pA01L"*Y!&
-P*c401MMFP8B*(38-[$*#)Xfl$LK1a8P)&HHUKN,0(-"F)9`Vl2BMkDCe'q`KVDB
-R,6FM4eX@b%Q9[Mrd*lZp1+h`5,(@ATSCYMmNMlrkY$fK0%1&led0Y1m0p6aH[#A
-!e-IU,Hk$8jr9T)3YKi5Tjm+0q(-jH($UZ4"8ZGF&aca(G#4kb$heT1KZQ(l0q-(
-T8lX[,TRD(FeFlSXqTbK(MNR+Ph8h%$D94)dA6*GVh*cTH-jd(*L1$ih@@i`B6K$
-GhZRA2!Q'Nm"`%KK'L1%[9[XaA%i-JlG(#0(r"YpR!d1SYm&pF1ecQXTSjYTLQ[E
-FF$6c-ATmJC4-0bf!65iVQlA286A"P,rb+9qDTMb2abd96[NVQe*b+ddT-CZQV-I
-MfBUQP0`U65RN8il6P-1V'&NPC66PcfmC6#Q8TRc$TcaVQJ+b5[396[Q'69Pj0de
-Cf@+D!V*@0P8dCHAGI$2Zi2+'d26P$@iAYR`l,bjCANHJiQSISfR[EX((T`JBeSp
-R+bmZ@41MirTrA,lCm+-DNcXcPpIG%9AUf-1D'$f)Z&(2aTC#G$X*F3YLG898JZi
-kPc4P-`h$-J%#NC9Prf*m(%0!X(im-rlLNV9"1UEracAc$$qU-4NN""Jjp,!fb-K
-C'qb+($jP(Jd$Z!,NE)F6d8b9r%fl[C!!4-[9IU+PEJF%cYjX8c8bG3Q,%`"QK%+
-cS-j2FB%b*3S`b,I,0l0E%[piV"1rl5aAc*fP%+JGdXHRq%HRmFFeXD)IPfmfrSK
-"BqMih`FSe`EPfcAcf+h%*P"dZ69MLV*H'kb!K(R'(`'N+(8prYd1Vk)%X,+U!3a
-#2U*aGQaaE(IA+#1UX`b"0A9Z*5Q1[cL&6QN%iTKh)Bj(h0JJ90',2)MqL,bJDep
-KF9UkeL6lrS$e5J[YQY*LEAkZaVjIPS&eKH9(8ZdjU8G+Fp,afFkk35B##H'4FL@
-b"ZiP93XMj%Jq@c$XBCY3dR*r6RmZSh#X9Z[Uk0I,4lplJpr4Vhq&4bqXN!#D`XI
-Rk*0GM3FcpE4&K1@Lj8U6RaPJC1c`KD+PQIQjTQ292F4@5Xp*e4l*R$b8jHjb1q[
-X8,h6d*ARZUj0eqE3e,(J'GKIV($c,pIe"f-!e)C*YXcLq[6bY2fC4c+H'eXq5"l
-a%+2FM$*YUUBiEIpB-J*#&P)A5SlJqVQSfJ&8E&e+"`+PK6E"ii%DjQh(BSjBj)"
-LM[mT0RAD'bbb5(6GR2X+&TF2%Fir8RK!Fk5dH'`Bl6FaZMBYHqaKXIr99XkZkm&
-B+fIA2!1&aE94VFR@dA"9&@XLBS8fh)SU&Y[bSUdk%R$C(SH0&#X%aF,f9,YBGG@
-U`L'US&KGXbQ9$m'#2,kPIP6aG6b#6C)SY[(-@A!5&1HTPhUf1TcUTGMfpDC9)M6
-Slp`TMSM19$&VYpBjUGV4JSh#@1H,l3X5A*V&RHSE%E,FZ2NP6%D)j8hEHlB*E2Y
-rmSML+fZRfa!'"+2H8B$MAFIC&j3cP[V%qTJ%`(dT(8%P%"IfP,K8YJ3`#284Qi`
-[4DFFk,QZ2j`HcXh*'#XekL%pBXIf'4rEKQ1E*hYXFqF)dR#k2[CQ(0aX1VB!TQB
-FfPE@3T0aD$-rX0Gde%SkDK)lDRY`*(6Kl+M4JIAm`$ce`(AYiA59GL`2c+X0UKr
-5+j!!JML09d1B+0S$iE6dXH()A[aC3r0,$3fII@PKE8CQ@TQfk+)(D0%dc9M9r@+
-$GIj-c-T+8bHcI&H+,CVR$G1rTF1p`l0F9&8V3(H%P"a*F6CXAd*!UU$X[DkJmMB
-TpJH%BKk@%*S(YeZ9fdZhm9bj'dDh[q[S[pPbLjpLEeFqMl2eH$aqLVfk0SSpQDk
-lCrpN&,[+acEMf(2*0@!ppShkQb6&0KhlHT0bffJ5$QhHEU$Dfk(Dr,"3lIJ,fie
-9He0Y9(YLaNUY9EYVMSqIDRHpk0LTGLYh#!$"UNlUb!2$5F18H0Xj6)J2R%Xkaaa
-ekLAcb[QI!,e'Z'HQ"p2`VcU(Z8(-2h9X3+,[cI5"MX9H`&#3!)aNC5Y-m6UB#+h
-X3mB#HZ$"hF["+2)V49-(f*65F9EKB43IJX&MEZe4pK&,fP``GAlP8U6TCf#A-U"
-06U$9@Rc8$Q6hAHCrXUdJZbrle35CS[bKaJ"N[,ViJqa2Y3ECC#T+VGA5!'5R'-L
--!@DJB*XNF$RTS5*`@B(eIk&@DBqA@[f50M4dT!*)6i-`A43DeTN([A3E2`aRm3@
-iMpH,#8%[8Y*dbQP0qF&bTFlc&2pc`SfY1P8l0JbH3P)#*5Y`j`9F#`Q9AR%[Ra$
-M+Ef,()TbeF'pRJRLhR[,PG1H(i548YCHlIR"(YHpDXmE520m!``Q%)1M@cq2`r!
-XE"f0%h[im%R5m%Pmq'8-[icKiib'la%6a!"F4DHVcIF'2&IZcI"Fm6b*G*XR+FR
-CV@M1LKrMaBr#MCc4MrDi$RlXbI$Z&K-1"V#P'q$,A-#d#jjRi!DIJ`pAHkCK1k6
-Dm`bI-Qf6#aX4hX&Rk"m2-F,8P3#9"FcpMHfG98UM'!r!4$`[m$r$!-m`dZCr#G$
-q0m"i2`$eJQF0T@CB93)G@4mhY2YJD-GcB2fhBd5-Tm28Q-@,)(Zm42CiN!"pdC-
-+XZ-jJFY"hR*+`8-+GN@Np8U1H5`20pH#52bp4h(-+4+l+AYFYkU9dpbaFBDrHTQ
-rH(Q25h66mM!NIqRGM9GAHplL!hl-!I)@(rCM$K!!(SU56bDRHXQlHl!C[,86P@R
-G8RC,'`T*`l5"(Xfm2ir3pI2H%"`9NSZk$EFm2CdH&hYT%([%`%e*h#@+fh%!feE
-2'(+E(RJ,!q"N[&md(E6TB))RQk0aYS6'Pd$N5kQ*qYe)i4R&i8Fe05"NpVAP5S2
-RG@ca[6l%RBMBe'SAMf%VM9*TXNf+1b*[8,RfDBTcdmZlUSF6#pDV*(SN3Eh8+RV
-Z@rV+4FqV,Cl6(NIac0+JXaYY&U84,YLq(8XpV8NAS&5YT&3)15YCi3iL2(T!dCR
--Xrk8$Kr5*+'5&KbK(f&-Hi*,eB+I[!5Hm)NYXHdA`3M*kc!3bcUaY4IaRSQkSRT
-52lMS6S4Ff1ULVE-@T(pXe9j&4+Mk+$9H-ZaZcXe),br9j)bPZmk648T!+#GR4I5
-SJD-LbqUSX#)aHCi*L6P!HU89DE6TL+1fmmRcV*0K[&EkGc&*E)%YeN(SCQia)AQ
-[Rd1NkSFUiJjK@kZR1!Ta6"ZP*ETrUN48hV#2K)6L#cD5Q0$B`Tk)LlB%)DM(ki"
-8&(jJ"2Y51R3b`8D1Ql"A2`UKeZNq"&GVNlZ[f-H#'-RG'M-a2)k85)JqK0k(Q11
-ec1YfNIK6@3HG$TXjZe2L6YT+Z"-9cA4V0YhD"V&B"+EpVVf+Na@#!E$X"UCieF&
-9C80F6KSa!U2A%%M"#S"8Bq(!0VZl99lhD)BaN!$[Ye@MF%LraSQA%3l%8ql4iM0
-q3$5HX)B%Zp+2LK1MRkpG+Y(4H4K&-JihiXAC9$2[BXk)"a#)r9%a[cRXD$Nmj,#
-#1"AXKej3kTeLBLFAmmk0pFTN8$*Sa,B+D*&CjDqT9L*2%iZN1*1B,M8)A+U1SV%
-,@bE*k4pmSr[kJdI4d@r@j-(aVJ`p44fjBY2d5cFNA*a)r,EKC6kf$@j4kG$CE#C
-a`%331[m&[20I`%@4ac5m$S`V2C33mT&9$6"mSk3)Ni`U5b-BE+4%[RXcP1pij[1
-T'c")MjqVm20hr+b5EZC$$"%4'b5fYT31G*2[iHFQhVRI40f"T!JN5-dSI)'M0Ei
-1dfLqjqqd[8%Tc%A%+!G!ie1-r-EX3EJ0XGbAJhFLlF"#)T`'hqcM*0l&MCa(SD6
-i3qQT)(i"42jG)6)9CT(4%#aAE*dlrpCEq5,50+J,@&5I9cqA$J6LCq(Q,Rk3!%5
-rBrbA$ij9Vj11J1lJ%XL2PilKFa4,JT3R1[aEDpM$MFD2B%MH"4)Ej9IIRFE61Di
-(%BXk2UNf$pjCrkP-rU90r'8R%BMdAeH)A"#r`a!U41BhL"d0+H(Eb6A"#dpLJ!k
-(FP4c%2BA!@"r"34@KbM0EcBChM!RE8L(JQ(kYpi9lfQqp"p1B2rF@LAqeG#pA[8
-k!9mUhf++T#'eU4j13"L(UTMN+((Q`f(!YjCb%mD4m`!Z[cakk4fP"eCB8V5`)Dj
-,4CbkYD)$9HfiA09SBieAY$DQD*D0*YG01lNNk4'SehRSC3Q[D1KSj($%6QP-(r&
-UpP'5T+U@0M"dHMC,VL8RN!"d!6mhK&X`l)+Q%S$Ic!hACf&mE[D8!23Pq2KX1)C
-L`8Mk6l83kd3R@0r!MH@'A56!h'm[pGb!aiF`GCL+(+1)kE"L3q9jfr-HNIRl$-p
-l(Jq[DZq"M"L[V"-Sm2'VjPG*e6c*50aAHkj#94p!+X#3!,c*b)qfJ4pYJhbdS4)
-XprmpXcMVF@!5PSVj2S#I(1PQPL3'aNR,HRN&HJNr2q2%rDaL-6$d'CM2mMc!JDF
-h!PiIIUlM`1[M`00ci%d#m25Hm3$HH(bF*!([1L2JA@F![1XNi,NNi,Qimir!pS!
-%YJFJAYEK#-GPp9qmM`[!U`*aaAZYJ!NUT*)!bYQ++RlMbGXYIY8q+f%Jh2JPG91
-aM#qjH&V'+r%bL+D0*Y%dalU!$JX8G,h!k5ERlARq5mKL6EH6"0["(ClIF43YNJT
-"c1&#M4HmmIbZhLBKD*%IJ[lV&!Qi6d&QcGHbB009+0LHjF93fG*6%%$H&BKM"i*
-3ZX64YmS)IFrMCb0(hr-FIDXiqXB!IDZ3!%*0DFG)cTA3Yp%)I4X0d,G43YpK#Af
-(6HLl5d,IACKf`P"iH8iB#DppZ@-RZE,PP$&QF*2)B"[f8&bqlE'5a!8+jARIG66
-jEei`99%j5DJCE@YG+V+a9P[cr`QC(2@5@B1GEL3TGj%8a`(C4!&2VG2aRV#+##b
-cQ3@C&0EGaK-%*FHHMYrSN!$9613!DA,!DI$"E2#"`LiNT#TQ8fKb$`Y0T!&bH(+
-23AJbhdS@XB6L9abLE2BIq(Z%+FCT2+kHLX,4LF0I#NIrC0qlBq5Lm[p%U$NaGm0
-BK*UZikC3mjeA0G4m[iUKCLf53ViRSHD)FDJTT63pAU(Q5+e$c9GKbqGa#$9rCa"
-UMKL(QK)3M5GX+K*U9MXD%'TZp`XeGA+SkErPpkEVHaTiMVbL`229hLkEiKGiMR#
-$H*2'6#Ne--e1fM)m(S5FCk3EXiJA%$e8$*f&P'%BaZqVUY'&E')ICH&%KKJh)Uq
-M3)icG%U6,R%MC6dQVIFc8(XP*CPL%)Ef3V#fA3[9mYc!Tfl"S09'BHLA2!4&J9R
-*`0RL&m$p&6rrj)E#2`d-8#6BXi-fMS-*qSr*"+)53"VhX#-d[L#&SJ@'S5JRFh%
-&SHJ0k")@aeFp&&dmd9$dHKcKZ(58-ii-I`1)#1C'@qrM()c@&3P''lS)4Xp@5',
-Ai@L"`B4DKU166r@5`p(Y4F24'*('`Xf[B9EaMASHN!!fM0+$U4*3i`&9$dXR5ip
-"@$SLKD@5fMNE6)'T0ei+6"YdRS9iGCCA2`K![l"d2Dpikj0-LQYCbXhc6E*jAL6
-Pi3*h'E%`G6X3JSe+)$8,a[SQcaUS6``,C2'L[j6m3%@-&KLCl!Yi@VR9E-IVAQc
-f[+fAYRZ-JPB8IIV)m`iGiD%-ccZHKGJiH3F%T[#+r35@H-*2*-b[-'5G,i@X%Eq
-3!(8,2rB@kl'(@P'Y2r(FajP2-`TDCdP"+phF*`Q0DAj"d@r`Xi),M49&K%Dla(i
--AYmAG5&4FKB(lqSZ`GZ(Rh95)%[JAFh"1`AJAHejA3,[&#VFD3,[1L2`VLX#hR9
-qi$8)DaqLB*S!1`Z#DP%&3Hem",A4#S*DAm8LT2(CbB5e"3CKV9A-946@GV9%B+`
-#fm@e$Qc21+Ul%*-I'BHfALp(kf+Mm,D1SrM,,P(m2(9I8V",+2k5SrKPS2K,cjX
-5LPr'cjXQ&2FDSELh#)Tlr9"X%2S#aBXp#kqP2bF-K@3Y`Yk*TX-EKEdM21aPhAL
-0+I"e0KL%[GX9%T%8pT,SE+K0f$Za8-3Sl(hJHa,f2V"K)Q([b#X*HhQBa-,HGak
-hX2IpUSHp%pf%03jl&m+S@#JIjGTLcViK&m820%F+Y6Pb%EM#R1I#@Z*KYp1(#X-
-[2eEA2mX+&aLb!P'`9`ZcFa#')kQRDij&@0kbG@)XpdqFT8X1EY!dS`eT&mI##dY
-F+*9p'F,Z(NT#S"3&+YL[A[*K2M8qb"-8PR&heaceN[Yr'ID%A'kICM'UqXXKPd'
-5`Kb@T-"Z+8%"dhK$'MfB+TUp0fU3!!,ai45q!"DXiBA22NqY6d5kJXZ8VZ#$N!$
-aXZ*d9&JqL%)i5!bCM53'Pbi"k5)ZeHQ`46rDD6Qqqk4VQeT"FfVE"+KSTH,N4Pi
-"Eqj$CY#f$HV+Nfh3m"i2VDMaU3[ee%62KASH%T9Y4f,-+*UdK*!!IRIkr6[h+56
-%)-aMeHr@ImS+!KQRMN""el'd%BME"ph6Tij6YB6`4ih#IMSc'DV@)d5LR2aHASL
-U")dIC%93,"!(`*r1Je-Rd5(3b"%+i%dG,lU4U-m,`0UAF4-$4pY&4kZ4MMD01RI
-6dISJ5QeL1hrejX(-U423$81SHelRM5iJp)$`IE1V*'Cqa!J)@X0-S3S1ZBSG8KF
-,pTR%F+&aHG3rrF'8bi"5Q9elQk6[Tim8NblQT+9b&p6AaB@bM[Ur-a9YCFeZm5E
-B3N'[cR)l&BC,C%@c&JXP!p4YPh8'3d'%`MGpJ+4V)&G-E1Y$J'YKiA8C,k)Z0j[
-PLN0E"+8[D&qe!jK)4A)BUUPlqXSX65`dIH@H3jNVpkc-#KjFQ58H#`BL1d9,&N3
-mNZ)Y-iF4Z*XMB6-DUU%QC+e&ML1Xb,&A[H5ICb+m5e![QGN8'4D2eAL$&h8A$GR
-AJ(ePSTLBp92&U6eER4Kk'Xb8qNqPiVjkhK(RX3AIePHEN5MeX5k!SX("K#F8TmB
-TMML'1VB%SlUG+2lEcJS+5k)B4H%qMm1f%4Uk&FpaSSq*!5TL&rNA%1ifUF0HZlf
-fSP)'*J4iH4T+HD@Le'i4-"BB(E3!B#bB#"LcLS$4"MF8Gq'0G+*j%5X)r9J$K!A
-rab"m[bJ)UpK&9!a*3e#Z-MV`+S"beGL$FZF0IU$dB`e3V[UI$-VpB`R+fKFMRjP
-N,8DqmZJV,dBqmaI@BZ3VXkY3M$b,'PqQ*K"3Q2SCc9(CJ6hieX8P+kI*VQdb)S0
-ZhJNB1,#a$%mMc"K$)T5@kF,TEH63jX@aRe&M!91c"BA&4p**YYVp3#dAQQ`P`"T
-hN[kUPU*(8HqB62Vl363Ge-T5YfIQb`C)%%)qQMNcAjTbKVS+iq-9)EY6,[$jljP
-($QMYA9-S0ce+95JS05B(NkNrdP0bS8ah5hXplk,h*SRZMJmkcI0HShp,ApXi2'[
-hpedq*IlFf[@IafNAm#4*YR'a[5`0fGYf3`RC3d8jk(rQe(bSJEhKTBScMk3I-#+
-&0I$3MN1fV0a3'$QXq%!B5,%a8Xj5F'M4plP4l%56"a)qdFlL982D1!%"kB9(-LU
-QSS[P'A&M4i5U+"(r+K14NCC6HbTi%lCIam(*G5DBTTaDqdPCF&rlGUIY@+1LG6C
-B(,cBHbq+ZbmV[Ml,V$4m[ml&5EK"h"NIaaZXcA9eJS5FY0a`'"@m!Pb`PDUkd0+
-*,B6SF(),3Ec"BDG,8lbGD5K8Y,iXj[9&ADIe2eQ[A551k-J0G`FBl5mYdfC8U$Q
-&p2pqa9pGDF1#e"@'8$q3!(9flISbhqf@@ml!qFq%D4e#,2hDpB%il@`M"Gf&T6+
-1T+CD!pSL5PSB+14SZ&f"Nl(*eY1SP2A,`*K6h0"J9QM,J)T9`m`dKa'S+@K'[X+
-"&RRJFIdaaDG81#M2H&#6FNEajRf,@h,$YMZMZk0rUFC@&M9ecaEb*Y+V5N@2CMc
-$3p*(Tca&hih2cXQ3!#5D52qX`J&HSk-e6)D4B$63)C&a5CP5a5Q#dF#crJ0j8m`
-ZD@J-6&eX-'rQ'6G[-QQQHDi#"*+53-QFC&Cf$Yq4TV63`qb6r-'XQ0q&)U+`ej1
-+'3f[,jPC4X(qi$CdecZJ'UH0`fb*Db%93HZL`ZCrA@c3F-4T@L`b$0HZ6@@$'id
-C&bmM))ZTmTLTfe@$#rk0r*K@cjDF1DJiU+3q9&,GfIESD23$+F(+3pA8De%[q@-
-aYMdEN!$'hYM[#P%eA5$Zj!k%b3Q$3Y*jUPe9AHD4L5e6N5M`@qE6"LbK`e*e%!U
-4$VKSrEX9I'l!jdSbQb+0cbZVGjFjRfq-*!DR+Q*NUP+CUVMhJ&0hcG"A!f(c'PF
-K8[hMQcY$SC2Yde$BiR&i#1aqGN!laY&Lr$'dqpNpfUAH2"aq(Jjr03kIPQ[#Rk%
-TeV-h9-T%5iMq3Vk%*"(cU4IJL%"P'h"`%3G[kM6MYK+hZKVc[#[dEqQ9'iCR$93
-R'S#MUA1UST2!-FB%$N8j*bD%QXN4+Ri9hi&Qd"lh4`kJF`k[rfF1SMN%)M1"k$5
-C"4Q6Ka$T5)L,qJ!JYGqiFP%5Ja6LM%%P1iT!d4f)BeARamEeeT!!p9lr5QV%D*j
-kbD1AUm#Sd-U)#[X$@@EapePYaAP8A",TZE`"J1C-R+l8DR+AiRm$8@5QKdHT#!`
-*'jhaDUH[YRqXcG#Q`N+VJ2`+f%5Ub+E3'!M86"eV2JZT"Z4iGF*9Xa@AI`L&UA(
-Zqf'L1[Nfbf'Ti5aANY`%N8-Aa@8ZR-b0%Q60E-ePc@`CZ&&Q5d@IV)eVlIF6Ukp
-qieU",Yl*33f#!h)"dPBS'[@Ebp`TBN+%YR(G)K8QaSZZ(%IL6YjiQ'6SZlkLRNH
-9mHUi9+$UK"RZqT5k%2GJQq`FKlRrZ99GikS"A)3V-ae5!aFme&bX5-9eI&,M,U+
-I$KZ#4&D%1E+*Uf20&ATYIEFJPS,`'+kDBh6f)QYJ)PSQlKK&b12Z`64rTbJ5T1k
-4A+*SRQVfDUY,&!hV9HVkYKe$'1bF1@`01lHjBCBl)m8)pP%d6Q@10#HG5aM9Y*U
--Zhh'$VZVkl+eK36Y3%qf#69@(0"RJNQS"lI@!"ME5GKmN!"#X5JHZU22mFEpT$!
-8J5CYQ[CVmRJJZ!!IET3HEX6$$G,$$AMiKr6`$cc-PalQiq([dX2ImA#9p(!9(Uk
-4(Ul"`ccTB4iHlT-HlX2$,1PK&KiHN!!H(UKGd2kBcbKSelrbS2faZif#p[86#GT
-cDE13!-#V[84X9pi[IrKUA5!Z*AIJ5(jDDSkL`19b[fDlHhV"l,3c#IJM(LbB24-
-&ieE1&Z'm381-q*Ma)%r`QH#H[Q)CNJ!b9ba,D4[%3hdpFbZ(JNPJfDFpA!U1B,P
-L$M&E-8FmZ')1-5ZB)c0E-5F$MZd9ph!fph!fpcaj6dTZYpdZ6CI-)bp5i2[$&YF
-S(0@fAGLqfYFDG!I1"mk6%+b2K@IhMX)Gbjfam@&k*)GfZ&92'eh2QVH5-++A#4P
-86*%C6Qm-3L-23'4R3)cN&ZE3BUIf)9J5+qZ9##BrSGJL1HDY36GF9ZD1,6`p,$H
-b-l[eRHBDLbkaT,XX%S%M("p1ePJ+F-%BR@AY*aSEUSpTH%QhGVjSDHY1$8$-fC!
-!VX,*L&q&jNMi!YY!)-L,XI!f2NDG)TYkQC'ART[2laJSEJCj2KJZ684%q,YrD4C
-h[[e"*"UqkbpYZp$JXN6db$re[cTAkAE281d63hH@NrP0$V(EGLUf1d2Nj-DY1A)
-HblE6XPr(4iC0$`q5bU$CS[0hBK"qE1&@-D4[#bTC6bMQ3ZHf(YSFqacJ1mF),#l
-0B-3TCq3`-l9e8dGiD(G(f,Rl*dLqi83&4fl5rqTmjFlPefQF`5F9fr+rDFb$cB0
-JLXD$NDTc@bNR%hp`Db0AHK+DjER!&XR0N!#@i@C!24$Ek*U+5EMJQVME29AaSUN
-Yjqifh2DVE&Lk$BpC2L5Eh,EEYc8Ppf5#"%4MA(2R*CQ!eI@+lS9@hEXEqX*$qMi
-jQ!XUcc[A0dGfr[1[iB9k1"Yaf5+,r&+R30Abd*6(Tl,#SBN,01f",B'RmBUK1-`
-E,0@TcU,a5aYV0Z-f#0&G"&BhE9acKf,ZC40akH&L5H&EcJ#-69"#-Hc8GfMbDlB
-K*6B4j0%Ph(B!01'8h1#1hf`+IrUAjR!VJA[MRNfZd@B-DGE%$VGZk9L`jmkqk&C
-aEfAJLrIJp)64B3@b$VFL"2PY)h5a'mC1CYYX)LG6QkV5fY'NFMC$,N$P"B,lJFl
-QL),d!RhP$L`i3a0L"$"Lp,Yh-c+FG`,dr0B-j9cZSq3hjflF"10AJL6G6k%#kc4
-$JbHk4ViK-4RD`cR-*)2!D%A+B1D+eXifmD[EGLM11r!!CF!ImE9$1eDd1Q,dTr1
-e1hD3!)RB*kN20Ei5*(F)QL2Y(&RaL@DSqEf95eDdDT`dA(a4CHjXCJ`(JI,"CR&
-(d%iZNQk6!P)h"8&NbaY9&1rhKdBpRQ@+E43TJ%TC(Llad%JAB5,dDeDKiie48Jf
-Fc6cC#4Y&A$&#CHcQH+V)hD,Xp@9D!%IFEmqh9[B'+[3$"(pRiqJQ9l!a(#KaP3e
-P"rMamqL`MKKEl[LbT,KJ&-lfZ8a-NA!VJ5'6lc-YfiZQ!qB'i$!lj-E%"SJYjeS
-kqJ+CKC9JaX"i+Yca1`2$l-9[T'iF$[$8Y%al0UbYF&TDF6SRQ5T8reIR@CA"K40
--3TH*DYe1U-3**"1d-m&-&iq$qM3rkj+Ec+9dEJP!%pL0CL-AL&MkT6,YC"Br4BZ
-,#-iLGb,)K6,8+jA8e6c@p,Bq%Vdc!21P2@P8Cm',ZNiR5b+T9'S8+$95AN8NZX!
-)Fchr(r-(a-3%&bk8XlZ`(),d!pejQ$j1RI[9Z3hd&A4VTcPDM&Q(qQM*!TIf%Ge
-j)M[9aT*Re8Y@E(dEKAGJI!8!cUP+!qXB6ZiY29b4122GV)2,,&ZjL%-lR%N`3JT
-1jVH+&Rq'`@M5X#lUEY-FMalqcK4kpHeRaXMr(+j&A',2rD[KbUJHbA6LF9`bbqc
-JADQRp5XAdT,ZkFA'*j+(E&#5Gf9AHY*`m"`hKq0e-+1TB6,4R66-',lNMcK0k@&
-YQ49eR($4N!"`G2P0[cTR5,i1j&G'G`%JPHH`S@2@L-&i8Ra92c8Z,*&LSdmid*c
-"%i-c'!Qr0P3H2b*iT6CVmULbi[M(5Pcj0PBaIR81f`j50I[f-e3c$1M1j,`NCc%
-jEZ"LZTi",FL!PZ!2Y+#LXh#f,I85NCm0"SLa4(#5j0,Ydk4U+Af#+Jl!8GP`U9'
-[am(Q4&A5B-FM)-+0kMZ#p1i@PG5Be'F,3HDCS3-,Ed%cb`FJKC`J+3CA@)Z+40N
-)c*Fe2*!!bMf2+)@hH)Nc-(('!@qmP0H[#FZKE!mY"aEcjF+%B-,DBZ"-5#"61"l
-aLN-*He#"1pYrEfY8(YENYDp#8Q`-$c'0%`m2KejM3c4AFCFEY"HjU$N-(a"p%)(
-Dp#iCaMM$KcR$KcR$Q$($rl3bc%NcBNF'`feSNP#*i)q)*#5GiY02Jj-(#8Rij)1
-M1[H+RIUjX"d*24TYUT("#G3bB(b14MUbi2DKBRflMK)M1"LM2(fZ4QQUT`ES,UA
-!4!S2P9##(jU$4aLTJeSkJlKaMkVNSNbj5,$3SFN[(bi@De%509kC#9mQ"+03B31
-[82aiT-b)+*r*4BMP)NLRDp+CJ`M'9+&G2BUZ3SC$f0`b*&3J3X@j4+B"H6iVHDC
-M+l*UATD4,P0%*)N%*MSU91eKMFfU41Md2EJB&bBL93+Zf%IQSJ)d&U#B6RLI(LN
-Q$jUTQ4401dqHIjKBb"2#PK*AjRB[66)R+(mdijU+miCUP0X9mfjmT0FF"3d!Vq9
-E&abLTmfr&a[CC$C3SF[`QPP3`)qa,XL6E$4j5-E6D@T`'6ZAaQCGfZ&P%rNRQc%
-a#B4%!"YE`K'iB,hXmcQl(Df,fFR0`!d#!-%F2Bb'k&Ph0GZ0T1e-FYY'#*c%"%V
-FBXa)V[JrAja%lUrF!3di&M+3!%)8HMQLkH)&qRF)R$Y0)(Dk4kfJ*@A6m+3Ll5N
-'-)5-3kRl0K'!Ak3#1+UEB6k1UNiKc"Z5`@%UKX%[eqX(0K%Z1JRa5A%b#P39)5Q
-2N!!ibrbe`Jj'bSJdDe(6+5rcmh)#3d@6MB(UlC0CR9A!V-&Y8H@&B`@ZUM$L$dM
-U0b%&EGcj)F9@)9+UMC!!dQmLC+Sb&mcUPEN101@#%*Ch1ID4J)3Hm#kd+Mb&JM)
-CILS[!93@RpJfTJTh,+80eldm5U*jm#5UU4-0cX6a$BSQ@A3$V8j8C+QaB-DQ@m2
-PY&(+24EQK2eL042$&98kpNUZC!N+NF8q-S6DF%eAVFfiSV!AAbY-C*R3hX)'bG2
-jT65NKH#FNaUmb9r$LbF0C5Z63aKM`4K#92NBkYMREJfA+R6-4(,ZRXCa0T9LQ4e
-eMEBK&-V,JlJI3YAGTMb-`1k13m)AP@&2$6VKrQdJ&DJ3YbNqqS$J)G,a'"ccfj5
-kMF1BE0(L-RYRKViH1$NJ0Y+3!'kl*NG,2CBL1bRbSq5N'*!![TY%,)`S+eJ"a$`
-#085AY$`6L$+S0$U$`rZ-$ZmhK3XHA%T3!Pj8Tpc)Za5Ub+Sb'@RI+USNaYa(P5,
-2jP3XQVd`#he)Sr'9aA$aLlU#UBU[d-a!kQLJPfep8$8BZNM6)l(MDm-3ZYL%-DS
-GHHa4%KE(B$$Y3aG&65"%NH!!iaN1J'BZ(VaG(`0*cECGk)4N4,,2!#k9QP)N8mS
-'%(YK(0DcLfhNEf#"$J'EMDYRJfabC5[l("deE`U5c#YY*KVdj9h-+6)(qTPCHlC
-HZ6XX`Nb'Uc4XUARaf-!'9f@Lb[EbJ,JMp*Th0'&!X`LGf9R4%K8'K8j,MQrQNfJ
-kbh,IX'YhYk['qFJ9$+m6Gb5pKJ6-+[m"fr8[h,kKlhkD(M0pA"5fE('KdXDNaIX
-dLl""HTL,)Z3'&b0NcF34e*3QXq"3&1iakN,K"5e0Xm-'06QfpR'R&P3M-bqF9q*
-+ik+&JKe+2e)[qD,KE6dCPET!C#6FZ%+['KTX$MHZe@2KQ+D&Ua3A2(a+6"1Mc3"
-bjm%CE%NjbET[HMN!GcK*%c,hB-T-rb++jJND#59ZHUKQh3JZFN20@0RF3R`FE@m
-$m9&(1ahLZhSFiKjb'Ri4c@iN3a!Q5Q'j9ST"dLMRPiYGMR$Y""KP@)#U1&f)J3R
-%qRDJZjm[SBZi81MN*1q@T3X8mb$BENG$9@9@RPd`jDciCq88Bm@,mjSB[@'hldm
-YKD9[iN302,mKQlkQckJkcKqGiJCYqR2TGXQU*j0abZdFPI4C-XRTF`4"!KF0j9c
-J1SPYZ!(HS-6CCPl3T3%r1NHPHdpDbj!!6[P3583J+LU*$Upl6l(0p-QV*(B11I*
-53A#U4fbNDN(C&eE6&i6CHPeGESYJmqRTr9#``["cKT23+!"H$p2V6"6d8[Kr&i5
-Hm9F0#epGqFpcU`H%6fBYq0N#BFZMp*rDIGGG3UVk0RA+XHqV$kQcNLmN,aILm62
-QDI92PmkD)D3+*p91YH@aj+`VDVI`KR"0mM2khLmq&$+%[`XjFj,A#MeU44lBV[j
-dG[,8bqUI#e1%CFN[*hrci6FI#@(KMp*)BGR6`UcNbmN6K"2VNVqC*ka-[Lcm,hj
-@#qA6K0q1&j,(#b@FYSprm1$jTmH0HhT`bjA"Z)%Vh30#3#J62RlkeeHq%Akp),P
-$k&Z``b2J8R(+3qSI6"2HIr44iAmIII6MHfB)Sc1%jfF)Nai6PTiBk"EHQ#'X9aI
-f,%Zq,6PrF,m`@hhdf-(Nlb4r0ILQfYBXR"YmF0Vb[42DK,p-+qQa#h(6"0Ud'Lm
-i!"*lYlU-X4AHIf[4SLr`)r`lAKbj8,$L3X&bGFTJQr"EGCl`dK9K3$hcUGI9Dki
-)*eHG%-je#"d&2e3I6ABN[b8F&[jPk@"LEh*1F[0J@IFh`X[5L'pqU-j*rQAbQm*
-[KG5PJc8I*KFQ$kJhFXVb-Fla`bH&kF)5GD2`3q%DiIM6*eF)&iA"RY@[Ulm9[K5
-Q$Mrjc@@Kjm,2ZSAA&kPI[0)RI(c0K!Hq'G-Rr13(`XAahH1lCj`I*h3[RcC&+&`
-jir8C*i@,mi@2IrhM%bm*&em6[RhQ0d*fKr$-VrYqG+jlc(N!N!-B!!!NL!!!9lJ
-!N!-)!*!$)!!!2c`!"kR`!*!$#PM!!&h!!!"G`!#3"#j"9A-b!*!&!e0PCc)(Ff9
-RE@9ZG&0PCc-(Ff9RE@9ZG&0PCc3(Ff9RE@9ZG!!!'Qi!N!-"GJ"1F8U$CL*"l3!
-J)$`r2!!!)MbTm!!"5N&Q"%T!C`T)3%K"))!K33!%3UG"q[r1d2`"!#m),c`!!"P
-Z,`0K!!+X9)pR3%)i#Pj#Tbmm4%&836mm"0@S(h!"%F!+ANUICaK1F6!mUA#R4N2
-k!#SLL%(k!#!`2+P`TNG+JfF%F!&1G8lY!#*1F8U$CJ+Tp(!!6R9J"J#3"3&1F4m
-krrC+(fB551IJi%(krqT3d%kk"Dj-h`F(,cVrhNjeB(*"6%&%4%008!!$!*!d8(*
-"E8MRB2"d8*r#,dJ!)#"2)P3aD3!8!"JK3!!N-A`!!3!XdT%K33!ZS!,I`NcI$`C
-1G8Si#PjR$#!U!!KR$#"!)""R"Lmkri41G8MR(`C"q[qHF!`L+J!%`VJ$'Q'NCJ!
-"2NKkrij1ZJGZ@%q`H[pDCJ!"$U%D,JJ)+J"!!!4R"L"i!UDJ'b`U!!3U+J!)'#S
-!"*I8PG3J1[p@S4ir1!)JCJ!!l&42,%JJ1[p%)JE#Z!-D@%&K!2p-)$Vr2-#i!aT
-"q[mi))"+K@B%S5*J"#"&S#GQ!!#d+NJJ$P#!3IVr###!)$Vr#P'!3IVr!##!3QG
-)HJ#m,a9)H[m#,cVqiLmkrZ)[1[l+,cVqbLmkrXTK!!e1-"pR)$m!5S9R##"0S#U
-J+f!%)%fJ)b"1S"mJ4k!E-Gm#)'"J)%kJ(b"(S"Yb!")%j`RM'H34!!%!)!)"!1!
-J6D"T!J!!(i!")%fJDYA8ep4"q[jf5T!!C`K`!D#BF!1JQ#"0*8J!#(!!60pJq%j
-e60pJq'!!rVir!#"1S"mJ4k!E-Gm#)0A8ep3`1!)J-F!+B*()*8J!#%cIB2K1G8j
-@!!")j`!i+'i!$%IkrLT&q[iU)"5`NQd%)")SJ%U!Ea)J8b*Z!!LL,L!8dC14NR!
-!B!3`22rC60mF!%jH6R919[r)51FH1#BZ!!JS,J!-+'i!%%(krESY52r83Llrb+%
-D,8Mrc&92U"``(cS!$%8!!'pF5'lrl$!&8d8r!+J298m[,[rXU!d`(c`!$%B!!'r
-F3LHTQeP2,blrl$!'8dBr!+J1)"mY32r`FJ%I!DQE)'lrm%U3!'F398m[#+QQ-"p
-)`()%`)&Ra#mZrr#TSf#m%#i!&'F+@8mZZ!+Q)&qJ'cmmS2a1ZJ5'9%mY32r35S"
-R!!'H,`"1ZJ2@@%p+!'F+F!%G3!!@6[S#'%KZrq4)E[rJ5'lrf%kk"@T2l`!-)#l
-ri+%H,8Mrh#!)C`!"C#!Zrq5K(Le)rqJJ#'F!!93[,[rN,`K1ZJ@i8%mJ!fB!!+C
-C6bmm3dp%48*RU"mJ(be!rr"+J'F!!)iJ3#*3FKM6`5m*6VS%Y&K2FJ1`3@Cf)!d
-J3(!SdF!Y52rd)Qlrm#44F"M9`#e+rrJ[#Nkk",TB6be!rr`JE[r`S#P35LCZrp3
-R5J!S@8m[,[r`6VS9c#!IFZM3J9'!*d!!,&925(Vq-LmZrr4)E[rm,``["#mZrp`
-[,[rJ,blrk%kk#XC86bmZrr#TSb4Zrp3PE[r3!!`PE[rF!"!PE[rJ!"3PE[rS!"J
-r2+'B6VS$9P42*N!r2+LI6VS$5P42)J!J#l#"CJ4`!'!#F!%J!#9!!"`P4!!J*8`
-!*%Kkqm`r2+$m2cbJr%kk![K86am!6VS98MmmSCK1ZJ--9%p+J'F%F!'JQ#"m!!!
-"@M!35-$JJ()'X)&Q$%(k!+iLI!!!!c`LL"em!!(rb#"ZrmbJ'e92U"``(cS!$%8
-!!'pd5'lrl$!&8d8r!+J298m[,[rXU!d`(c`!$%B!!'rF3LHTQeP2,blrl$!'8dB
-r!+J1)"mY32r`FJ%I!DQE98m[,[r`UDB`(dM!FJ6!J@F),blrm+QLB-)NE[r`5T*
-R%&92,`UTTM!I5-"b"-#"CkS[#UQMB+33,[r)(8!!&NcI((K1AL"I6qm!$Nl36PE
-rr%MR!$"#,[rm2cbJr%kk!La86b4!5S"RA#m!6VS"J&K25J"R8#!+*N!J3#mS!!`
-r2+$m2cbJr%kk!Gj86am!6VS81#",)'J!%+!I)%XJD!!BS"mJI!!!!9S`%%M!i)"
-b"V#"CJT`!#"m!!!$2##!(A`!!Irm%#lrr%cI$!"1ANje6PErk%MR(cKC6kPe)"m
-U!%KZrqLSG#!0)%!J%(+'d)%Y32rm)%"F5%2Zrq`Lf#,B@8m[2%4"9%%r2!69UD!
-J(bK!)%!N8$)U!!L5DJ!%2!%d+J!'P'S!!Mi#0LlrmNM$1#lrlNM%PS3i!8M%PS4
-U!P+$iS-p3rrf0Llrm%M$1#lrl%M%PS3i!NM%PS4U!P+$iS-p3rrd0LlrpYC"282
-rqM)Zrr653Me"rrKC6d+R5'lrp%Kk!'Cb!4m"FJ%r!A,r,`&#*d+RU4-J(bC!,`#
-SF`D&!*!$H#m-)%Y`%0(!,`LSpPP2UA8J(l#&C!*Jp&92UA33(fB#B2C`rcm!3QF
-J(k!b,`ZT&#m-UD-[,[rSU(0-haci6Pj1G3!#!!"19J!!51F!-#4Z!!JJ#LC!)%!
-L+!!#$)&"6%&%CKBL+!!'$)&%3de3CJS`+!!+FJ1`3@F%F!"J!R!"60m-!%jH6R8
-[#PP22cbSER!"(`"1ZK*i)&mN5&P22cbUER!"(`"1ZK*Q)PmJ5V(*CJB`2!)!B!3
-`2!3!*&p1G8j@!!![!cBZ!!J`!dM!!S!!!!J!5S"["(!"B!*`!#BI6Pj1G8j@rra
-)ja`!0Li!#$m$6VVrc&42(8$rr()"X!&Q%!*$"rp1Z[q!X%0Z"(!!B#KC6cmmU*p
-`!4m!6VS4m#!I+J"C6cm$(blrr%kk%H!J(bJ!X)9Q!R!!60m!1%jH6R919J!!51F
-B-$JZ!!JNEJ!+)%SJ%#C!)%!b%!a"384Q+$)S!!)-3805CKif"(,rYN&R'L!S!!4
-b'1+S!S!!N!2r-J0)`E#"C`4`!'!#F!%G3!!160m-'%jH)&pF6dl36PB!!&925'i
-!#($r2`"1Z[q5%"pR%L"Z!!JJ+!!%FKMLU!*!!2pJ!R$r6Pj1G8j@!!"96dKZ!!K
-`rcm!6VVrC"!ICa!JEJ!))#J!"!+!!2q3!f!#F2p1ANje6PB!!%MR'$JQEJ!)+'i
-!$#",-,`$!A!!*%`NJ#Bm!!!"*0H5"T)!!!*)"T)!N!-J+$`!N!1!fC,CNLJm!!!
-%N!$CNYH5fC)'NJ#3!h`'NJ!!J!"`!#4Z!"!NJ!D5!*!$*!D5!*!$)!D5!*!$5!D
-5!*!$2N*!60mF'%jH6R919[rN51FI1#CZ!!JU,J!-)!XS3#e!rqK`*0R!,8crl(!
-JfF!Y62r`F%MC`#e-rr4`2YR!)!b3!)Z`K@-'F'91qJ#b3N!q!%*!28$rj$B(F#5
-f3'4)F!5f3'3%F!"J$(!!-!0CJ'S#9S$NJ(J!1!-Y42rif+lrk#4%&)!J,[rid)$
-3V[r`)%!`V[rNF!%8%R)!%J,MB0&Zrq454f#`3N!q!(!"2!!f"h!IYN"N4(!"YN"
-N"(!!B!a`!$!$8i"U!P+!iS"i!$J$,86rr0LZrq`N4"5!)#lrr0#!d+lrp#"!-)C
-`!435FJ!5!Z0Jh%"54f#d3N"-haci6Pj1G8j@rr")jami*'i!##CZ!!`k,J!3+'i
-!%N*!2!!b"A!!-!(3J$3'FJ!b!V#"Ea4#3$3'FJ!b!Y+"dS`J36#!8NCJfN*!2!"
-`!Me!rr)f"VC&C!!!Z%*!2J"#3$e!rr"`!$!$jB$3LL"!)"!Y32rd-JC`!$!"d)X
-J3"J3GJ!@",C(B`!!JM!ZrrCb!F""d@lrm(!!-!06J$3(FJ!b!V#"Ecii,[r`GJ!
-f"#e$rrc@JpD-)%0+8'B5)#lrr0#!d)`J3$#Zrr*8E[rb-Llrm(!!-!(3J0#-)%!
-`%$e!rr"J&M!&d%$34M3Zrr"b!$)#dS(5M#""-)"54b!Zrr6LL#e!rr4J!2pX8NC
-J!2p%60mFq%jH6R919[rm51FF-#4Z!!Jf,J!-*Qi!$M)$F!!`!HD!1!!`!h)(`%%
-k!(!!,8$rr$3%FJ!b!Y++)%%5%(!!%!%d"A)!-J,LS()"`)(4V[rm)Llrr11*dSX
-J36)3F!!`!5e!rra546!&FJL`3@B'3N!k!&*%-Li!%R!!-!(3J,#ZrraM!Q#U%#l
-rra)Z!"25!C!!!8cI$$K1ANje6PErr%MR(b!NEJ!)1#i!$$SZ!!ib"(!!-!(QJ$`
-!-J4d"m*#2J&f!$B!eSSJ3a!3G!!8!#e#rra`!$!"0!9b!$)#d)(QJ()#X)&R$()
-"X)&R)%U!Cc4J-M3'FJ!b!P5"dSSJ34)3F!!3!A)3ikL"V[rm0!Cb!$)#8S(5LL"
-"%K"`!"!"iBL"V[rm)#lrr$3(FJ!b!Z+S,8$rr($rFL!f"A3!0!15JZ+S`'lrrNc
-I"2K1ANje6PErf%MR(cJQEJ!)+'i!$L!m!!!"*0'Z!")J2!!!!NM4VJ!5)#i!%Le
-!rqab)01Z!")L,J!5,8(rm#3m!*!$J0@Z!")N,J!5,8,rp#4,'"*f!"B%,82rq1D
-$HJI'49*$282rh#BZrrMLJhS$aN983ce$rqCf!6SZrqEVBce$rqKq3-J(I!!F"$e
-'rq*i!HYN8d3p42rJ+Llrq(i"bSGR#(S!1J46K@!#H[mp4IrHH!Jp42rN5NCR4Lm
-Z!")[!$m$8NS[#NkkrcT2l`!1jd$4E[rN,bi!%LmZrr!r!bmZrqa1ZJX)6qm!$Lm
-Zrr3r!bmZrq`[,[r`6VVmV%r[!!j#3$e!rpJ`,[rBX'i!$'3!!6S`,[rLCcSN3$m
-ZrqJ[,[rd2blrj#m,6VVpMNr[!!`5!#!+F!!3!6e!rpTd!$3!e+lrl#"#%""b!")
-!dflrj'!F2blrjMmZrq3[#dkkrI"36ce!rpS`,[rQd@lrj$!ZrpU`E[rHCKBb,[r
-B8Qlrf(!!-!(3M#"!3K"J!2pk-#lrfV"Zrq"Q!!#8-#lriQFk*%!r,[rS,blrp$m
-Zrq3[#dkkr3C2l`!-%J!J#R!!%!%p32rDG!!d!05Zrq`J3K!3FJ!5!00Zrq4J($m
-ZrqBr,[rN,`Y1Z[eS8%mp32rD-#lrjY&Zrq4@E[rD-#lrfP0ZrpT+3'F!r`!i,[r
-BGJ!f"#e$rra6JpD-)%-3%#)Zrrc5M#""%)"5E[rBB-i3,[rGd#lrfc3ZrpK5E[r
-BFJ!b!Y+-)%%3J'!!rVib,[rNF!!`!9k!jS"-haci6Pj1G8j@ria)jami*Qi!##S
-Z!!`SEJ!3,#i!&#e,rmK`*0I!,8[ri(!Jem!Y5rr-F%MA`#e,rq3Y62q8*M`!!!%
-NeklrP#!m!!!#50'Zrj4`)0'Zrj3S2!#3!i$CV[q8fDlrP#eZrj6rY#Jm!!!%N!$
-CV[q8,@lrP2qieklrP#eZrj6r[0QZrj3YE[q8rp4`I0'Zrj3YE[q8rk3J2!!!J!$
-4V[q8)#lrP*!!M,#&B`T`C6e!!#K1qJCkF!!Z!%*!28$rM#4Zrk69r!!!J!!Y5[q
-S,@lrT2q3!#em!!#!!2rS5'lrk#mZrk3JEJ!N6T!!8%mJ,[rSCJT`Cce!!#K1qJB
-d*'lrN!"55VAZrkKMD#"Zrj!!8NL4l[qS,8Mrp#"Zrj!!NHlrT#e)rr!JE[qSNHl
-rN!!Y52rX)!KR$L"Zrj!!)QlrT#!ZrqbL,L4Zrk69l[rX,8VrN!")E[r`,blrT#"
-Z!#41N!"36b!Zrr#`V[rdC!T`Cce!!#K1qJA!)'lrN!"5V[q3!"!3(8$rS()!%J$
-5390"28(rd$!Zrp$33$e!rp)JEJ!F)"$3VJ!J,8$rX#4!,``[,[qi2c`"*#mZrj!
-!6VVlmNr[!!ib!#!+F!!`!G'Zrj!!,``[,[qd2c`"*#mZrlK1ZJHk6qm!$LmZrl`
-r2!%N,blrZ#mZrl41Z[PF6qm!$L4!,``[,[qi2blrd#mZrj!!6VVlS%r[!!ib!#!
-+F!!`!G'Zrj!!,``[,[qd2blrd#mZrlK1ZJGS6qm!$LmZrp3r,[r3,blrZ#mZrl4
-1Z[N+6qm!$R!!,J"#3$e!ri`YEJ!Jrk`JE[qXXHlrX'3!"+K#3$e!rjJ-EJ*)rjK
-N!!$#-#lrM'B!!)`NE[q3!&*+YHlrU'0S)'lrN!"55*(ZrkJY52rd)'lrN!#4l[q
-N,8Mrm#"ZrkL4l[q3!#e)rq`J#'F1)'lrN!!LE[qN)#lrl+)Z*'lrT0AZrq`Y5[q
-3!%KZrr![,[qN)'i!*%k3!&"2)#lrm,#Zrr4N#R"R28!!+%lk"%)JE[q3!&+Zrj!
-!%K"`!"!",J"`#$e!ri``"h)"`%(4E[qB-LlrQ(!!-!(3J0#Zrl`J3$!328$rQ#!
-(iSJZ!&0ZriaJ!2mi"'i#52qB$'i"!2qBC"!JE[qX8UlrV"#ZrjPJ!2m)"'i"!2q
-B1#lrQ(B!0J3Y3rrieS2@V[r-)%-`%$e!rjSL,[ridUlrb#""%K"`!"!"28$rR%T
-!C`!!`JaZ!"MrM')!!*JNE[q3!&*+YHlrU'0S)'lrN!"55*(ZrkJY52rd)'lrN!#
-4l[qN,8Mrm#"ZrkL4l[q3!#e)rq`J#'F1)'lrN!!LE[qN)#lrl+)Z*'lrT0AZrq`
-Y5[q3!%KZrr![,[qN)'i!*%k3!&"2)#lrm,#Zrr4N#R"R28!!+%lk!bJJE[q3!&+
-Zrj!!%K"`!"!"0#lrM()!-J,MU)k!8'lrM'!!rf*`rh)J1#lrR(B!0J55Jq+S`%I
-4E[qD)!IQU#i!Q@lrM%*!28$rQ$!ZrjL`E[r5C!!!`M!ZriaQ!!#-*'lrN!"55VA
-ZrkKMD#"Zrj!!8NL4l[qS,8Mrp#"Zrj!!NHlrT#e)rr!JE[qSNHlrN!!Y52rX)!K
-R$L"Zrj!!)QlrT#!ZrqbL,L4Zrk69l[rX,8VrN!")E[r`,blrT#"Z!#41N!"36b!
-Zrr#`V[rdC!T`Cce!!#K1qJ*B)'lrN!"5V[q3!")3F!!3!5i!F!Jp32q--!Gb!F"
-"d@lrQ$)ZrjK`!$!"d)$3V[r8)%!`%$e!rjJJ"q+),J"6E[q-B!$r0M!Zrp+4E[q
-B1#lrQ(B!0J3Y3rrmeS2@V[rN)%-`%$e!rjiL,[rmdUlri#""%K"`!"!"28$rR%T
-!C`!!`JaZ!"MrM')!!*JNE[q3!&*+YHlrU'0S)'lrN!"55*(ZrkJY52rd)'lrN!#
-4l[qN,8Mrm#"ZrkL4l[q3!#e)rq`J#'F1)'lrN!!LE[qN)#lrl+)Z*'lrT0AZrq`
-Y5[q3!%KZrr![,[qN)'i!*%k3!&"2)#lrm,#Zrr4N#R"R28!!+%lk!9SJE[q3!&+
-Zrj!!%K"`!"!"0#lrM()!-J,MU)k!8'lrM'!!rf*`rh)J1#lrR(B!0J55Jq+S`%I
-4E[qH)!IQU#i!Q@lrM#"Zrk`b,[qHF!!`!C(!,8MrP,(Z!#"PB#"Zrj45V[q8%"!
-JE[qX8UlrV"#!)'lrP&+Zrj33%#"Zrka5V[qX%)!JE[q88UlrP"!3)'lrV&+Zrk`
-3J$!ZrjT6E[qD5N"R!2[H)'lrP&+Zrj33%#"Zrka5V[qX%)"Jh&CZrjSJEJ!BdFB
-b,[qHF!!`!5*Zrkb6lJ!JN!#*NF!Y52q8-#lrQQFQ)'i!'0('XHlrP'-D)'lrP&+
-Zrj33%#"Zrka5V[qX%)"6E[qDB03YEJ!Jrj3`,[qD8flrQNT!C`$lCL"Zrj45V[q
-8%"!JE[qX8UlrV"#!B0`JE[qXXHlrX'F)F'Fp3!!SB"3JE[qXNHi!)#*Z!"`LL%*
-!28!!+%cI(2K1AL"I6qm!)%l3!(!m!$iJ!!"i)$i`)#BQ)(JJ2$dc-J!!1N0[EA"
-bCA0cD@pZ1N4PBfpYF(*PFh0TEfi`-c!a,Q-!!$`!2L!!!(JJ2M!J*LBJH#!m26-
-b!!!k3fpYF(*PFh0TEfik4'9MEfe`FQ9cFfP[EM!c-$%ZB`!!6PErk%MR(cJq,J!
-)+'i!$$BZ!!T`!$!$1!Gb!$)%N!#"FJ'`J@m!!E3p42rS282rkP*ZrqJ`,[rSX'i
-!#Q3FFJ!b!0+-)%%3%$3(FJ!b!Y+-)%%5%,!"C!*JeP0ZrqS`,[rUX%GM(()!-J$
-5M#""%"!d"h)!-J,5M#""%K#`!@-#B0J`,[rSX'lrkQ8#B()i,[rSGJ!f"#e$rr$
-@M#4$%K*`!"!"28$rl$SZrqTi!$J&,86rp0L-*N33%a5!&Ulrl5!Zrr$3J0#Z!"!
-J3$!328$rl#)Zrr65JG+Z!"!J36)3*#lrm05#e+i!%#"#-)%L,[rddS(5VJ!3)%%
-`J'!!rc)`,[rUX%GQ"P*(B!$r"$J(GJ!f"#e$rrM@M#4$%K*`!"!"28$rl$`ZrqT
-k!$S',8Arr0U-*N83%a5!&Ulrl5!ZrrM3J0#Z!"!J3$!328$rl#)Zrrc5JG+Z!"!
-J36)3*#lrq05#e+i!%#"#-)%L,[rmdS(5VJ!3)%%`J#!Zrr`L,[riN!#"0#i!#R)
-!-J)N,[rm8S+5JV#"E"i[,J!3,``r"Mm%6VVqA%r[!!``,[rU8N!q!'!!rP`[,J!
-3,``r,J!+-#lrkP*!2`"1Z[if6qm!$$eZrqS!#Q!!rMK-haci6Pj1G8j@rq4)jam
-i*'i!#$SZ!!`QEJ!1+'i!%Le-rr!J2!!!!56C`#e-rr4#3$`!0JDf4@3XH!!i!be
-%rrMBLL"%%"!L,[ridUlrm#""%)!J,[rid)$3V[rd)%!`Je*'B-i[,[rd,blrm$m
-&3QG1Z[fb6qm!$%*!2!!f"VC&C"*`!$!$d+lrm#"!5K"Q"&*'B1K`!#e!rq3f"VC
-&C!!!U%T$Cc)J,[rNH!!i!be%rrcBV[r`)%38%()!%J)Q,[rm8i2@V[r`)%-@%(3
-!&!15JZ1S,8$rj$3'FJ!b!Y+Zrr!J34)3F!!3!6i!,@lrj2rXF!!Y32rS-!G64dT
-!Cb!J,[rSiiJL,[rXG!(#JS#",8$rk#!ZrqcLL#e!rqaJf$3'FJ!b!Y+"dUlrp#"
-"-K"`!$!"jB$3Lb"!)+lrk&*'8Ulrj'!!re4-haci6Pj1G5*I)&qJ*5k!DJ*#Pdl
-4)Pm5(c!I5J&R"+G'B!+M4Lk)6Y%LAa)I-"mJAdS"C`5Q4f!#SNG1d3#3!`S!1+!
-"!!8!N!B"!!!"MdN!!Bj*!!!%E&028P3!GJ#!!"`$dJ!838a59!!+!+T"9A-b!!!
-",N*14%`!!3%k3dp%43!(!9*%394"!!!"XN4*9%`!$3'q4%a24`!#!QC'8N9'!!3
-#LNCPBA3!!!,'5801)`!%!Y**3dp1!!!$$P"*3e3!!!-D8(0PG!!!!bC659T&!!!
-$-P088L!!!3-q8e45)`!!!eCKGA0d!!%$BQ0TBfi!!!0kD@0X1!!!!iCVD@jN!!!
-$NRCPFR-!!31H!)$rrb!!",-!N!@"rrmJ!!6$!*!&J[rr)!!%F`#3"BArrb3!")-
--mE"B!)Errb3!"+--mJ"`!)Irrb!!"*-!N!@)rrmJ!!66!*!%!J$rrb!!"18!N!3
-#!Irr)!!%p3#3"!3"rrmJ!!4M!*!%"+rrr`!!&"`!N!G!!!!Cc`#3"B$rr`!!'CF
-!N!3"!2rr!!!CG`#3"[rr+!&cE3#3"3%!AK`!(PB-mjFF!!)!D"`!N!!I$21A#!!
-$!()F!+`d$21A$!!%!(`F!21L$2(rm!!&!)BF!58[$1raR!!'!*!!(!&)6JccP`!
-!"rrr!!&cb3#3"[rr+!"J'!#3"B$rr`!!!DF!N!@#rrm!!!*h!*!&KIrr*!!!J!c
-aX%!!K[rr*!!"*JcY6C`!Krrr!*!$eJ#3"BMrr`!!!`%!N!@errmJ!!)&!*!%!3F
-!0#!!%fi!N!3#!2rr!!!$f3#3"!)"rrm!!!3A!*!%!qMrrb!!!Y8!N!3%!Irr)!#
-3"`4,!#J%!",J$2'[d!5[rrm!!"-`!*!%!3F!(#!!%5-!N!3$k2rr)!!*@!#3"!4
-,!"!%!"%+$2)!R!#!rrm!!"P!!*!&JIrr!!!C5`#3"B,rr`!!'9B!N!@$rrm!!"P
-K!*!&K2rr!!!CE!#3"[rr!!'11`#3"B$rr`!!&#`!N!@"rrm!!"8`!*!&J[rr!!!
-@0!#3"B2rr`!!&cJ!N!@%rrm!!"Jm!*!%"%[rr`3!%Q8-mDr8!qMrr`!!#E3!N!@
-!rrm!!!8K!*!%rj!%!!&cL3#3"!)!N!-J!!8&!*!%!J%!"b!!"48!N!@!rrm!!!P
-d!*!(6`!!'IF!N!@%rrm!!"Rc!*!%"%[rr`3!%6m-mJ!)!)6rr`!!'P)!N!@!rrm
-!!A1A!*!&!Irr)!!3q!#3"3,rrb!!%0S!N!3'F(*[EA"d#-3JFh9QCQPi#dPZFf9
-bG#"%DA0V#d9iDA0dD@jR)&"A#dPZFf9bG#"%DA0V#d9iDA0dD@jR)&"A$NphEQ9
-b)(*PFfpeFQ0P$NphEQ9b)(*PFfpeFQ0P#90PCfePER3J-3P6C@GYC@jd)$)*8f9
-RE@9ZG#!c#90PCfePER3J03P6C@GYC@jd)$B*8f9RE@9ZG#!f*-d:
diff --git a/mac/tkMacRegion.c b/mac/tkMacRegion.c
deleted file mode 100644
index ae63ff2..0000000
--- a/mac/tkMacRegion.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * tkMacRegion.c --
- *
- * Implements X window calls for manipulating regions
- *
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkInt.h"
-#include "tkMacInt.h"
-#include "X.h"
-#include "Xlib.h"
-
-#include <Windows.h>
-#include <QDOffscreen.h>
-
-/*
- * Temporary region that can be reused.
- */
-static RgnHandle tmpRgn = NULL;
-
-
-/*
- *----------------------------------------------------------------------
- *
- * TkCreateRegion --
- *
- * Implements the equivelent of the X window function
- * XCreateRegion. See X window documentation for more details.
- *
- * Results:
- * Returns an allocated region handle.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkRegion
-TkCreateRegion()
-{
- RgnHandle rgn;
-
- rgn = NewRgn();
- return (TkRegion) rgn;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkDestroyRegion --
- *
- * Implements the equivelent of the X window function
- * XDestroyRegion. See X window documentation for more details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Memory is freed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkDestroyRegion(
- TkRegion r)
-{
- RgnHandle rgn = (RgnHandle) r;
-
- DisposeRgn(rgn);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkIntersectRegion --
- *
- * Implements the equivilent of the X window function
- * XIntersectRegion. See X window documentation for more details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkIntersectRegion(
- TkRegion sra,
- TkRegion srb,
- TkRegion dr_return)
-{
- RgnHandle srcRgnA = (RgnHandle) sra;
- RgnHandle srcRgnB = (RgnHandle) srb;
- RgnHandle destRgn = (RgnHandle) dr_return;
-
- SectRgn(srcRgnA, srcRgnB, destRgn);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkUnionRectWithRegion --
- *
- * Implements the equivelent of the X window function
- * XUnionRectWithRegion. See X window documentation for more
- * details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkUnionRectWithRegion(
- XRectangle* rectangle,
- TkRegion src_region,
- TkRegion dest_region_return)
-{
- RgnHandle srcRgn = (RgnHandle) src_region;
- RgnHandle destRgn = (RgnHandle) dest_region_return;
-
- if (tmpRgn == NULL) {
- tmpRgn = NewRgn();
- }
- SetRectRgn(tmpRgn, rectangle->x, rectangle->y,
- rectangle->x + rectangle->width, rectangle->y + rectangle->height);
- UnionRgn(srcRgn, tmpRgn, destRgn);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkRectInRegion --
- *
- * Implements the equivelent of the X window function
- * XRectInRegion. See X window documentation for more details.
- *
- * Results:
- * Returns one of: RectangleOut, RectangleIn, RectanglePart.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkRectInRegion(
- TkRegion region,
- int x,
- int y,
- unsigned int width,
- unsigned int height)
-{
- RgnHandle rgn = (RgnHandle) region;
- RgnHandle rectRgn, destRgn;
- int result;
-
- rectRgn = NewRgn();
- destRgn = NewRgn();
- SetRectRgn(rectRgn, x, y, x + width, y + height);
- SectRgn(rgn, rectRgn, destRgn);
- if (EmptyRgn(destRgn)) {
- result = RectangleOut;
- } else if (EqualRgn(rgn, destRgn)) {
- result = RectangleIn;
- } else {
- result = RectanglePart;
- }
- DisposeRgn(rectRgn);
- DisposeRgn(destRgn);
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkClipBox --
- *
- * Implements the equivelent of the X window function XClipBox.
- * See X window documentation for more details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkClipBox(
- TkRegion r,
- XRectangle* rect_return)
-{
- RgnHandle rgn = (RgnHandle) r;
-
- rect_return->x = (**rgn).rgnBBox.left;
- rect_return->y = (**rgn).rgnBBox.top;
- rect_return->width = (**rgn).rgnBBox.right - (**rgn).rgnBBox.left;
- rect_return->height = (**rgn).rgnBBox.bottom - (**rgn).rgnBBox.top;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSubtractRegion --
- *
- * Implements the equivilent of the X window function
- * XSubtractRegion. See X window documentation for more details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkSubtractRegion(
- TkRegion sra,
- TkRegion srb,
- TkRegion dr_return)
-{
- RgnHandle srcRgnA = (RgnHandle) sra;
- RgnHandle srcRgnB = (RgnHandle) srb;
- RgnHandle destRgn = (RgnHandle) dr_return;
-
- DiffRgn(srcRgnA, srcRgnB, destRgn);
-}
diff --git a/mac/tkMacResource.r b/mac/tkMacResource.r
deleted file mode 100644
index 9d49f74..0000000
--- a/mac/tkMacResource.r
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * tkMacResources.r --
- *
- * This file creates resources for use in a simple shell.
- * This is designed to be an example of using the Tcl/Tk
- * libraries in a Macintosh Application.
- *
- * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-/*
- * We define SystemSevenOrLater so that our dialogs may use the
- * auto center feature.
- */
-#define SystemSevenOrLater 1
-
-#include <Types.r>
-#include <SysTypes.r>
-
-/*
- * The folowing include and defines help construct
- * the version string for Tcl.
- */
-
-#define RC_INVOKED
-#include "tcl.h"
-#include "tk.h"
-
-/*
- * The mechanisim below loads Tcl source into the resource fork of the
- * application. The example below creates a TEXT resource named
- * "Init" from the file "init.tcl". This allows applications to use
- * Tcl to define the behavior of the application without having to
- * require some predetermined file structure - all needed Tcl "files"
- * are located within the application. To source a file for the
- * resource fork the source command has been modified to support
- * sourcing from resources. In the below case "source -rsrc {Init}"
- * will load the TEXT resource named "Init".
- */
-
-#ifndef TCLTK_NO_LIBRARY_TEXT_RESOURCES
-#include "tkMacTclCode.r"
-#endif
-
-/*
- * The following two resources define the default "About Box" for Mac Tk.
- * This dialog appears if the "About Tk..." menu item is selected from
- * the Apple menu. This dialog may be overridden by defining a Tcl procedure
- * with the name of "tkAboutDialog". If this procedure is defined the
- * default dialog will not be shown and the Tcl procedure is expected to
- * create and manage an About Dialog box.
- */
-
-resource 'DLOG' (128, "Default About Box", purgeable) {
- {85, 107, 260, 412}, dBoxProc, visible, goAway, 0,
- 128, "", centerMainScreen
-};
-
-resource 'DITL' (128, "About Box", purgeable) {
- {
- {143, 147, 167, 201}, Button {enabled, "Ok"},
- { 14, 108, 137, 314}, StaticText {disabled,
- "Wish - Windowing Shell" "\n" "based on Tcl "
- TCL_PATCH_LEVEL " & Tk " TK_PATCH_LEVEL "\n\n"
- "Jim Ingham & Ray Johnson" "\n"
- "© 2001 Tcl Core Team" "\n"
- "jingham@apple.com"},
- { 19, 24, 119, 92}, Picture {enabled, 128}
- }
-};
-
-data 'PICT' (128) {
- $"13A4 0000 0000 0064 0044 0011 02FF 0C00"
- $"FFFE 0000 0048 0000 0048 0000 0000 0000"
- $"0064 0044 0000 0000 0001 000A 0000 0000"
- $"0064 0044 0099 8044 0000 0000 0064 0044"
- $"0000 0000 0000 0000 0048 0000 0048 0000"
- $"0000 0008 0001 0008 0000 0000 0108 00D8"
- $"0000 0000 0001 5A5A 8000 00FF 3736 FF00"
- $"FF00 FF00 3535 FF00 FF00 CC00 3434 FF00"
- $"FF00 9900 3333 FF00 FF00 6600 3736 FF00"
- $"FF00 3300 3535 FF00 FF00 0000 3434 FF00"
- $"CC00 FF00 3333 FF00 CC00 CC00 3736 FF00"
- $"CC00 9900 3535 FF00 CC00 6600 FAFA FF00"
- $"CC00 3300 3333 FF00 CC00 0000 3130 FF00"
- $"9900 FF00 2F2F FF00 9900 CC00 FAFA FF00"
- $"9900 9900 F9F9 FF00 9900 6600 3130 FF00"
- $"9900 3300 2F2F FF00 9900 0000 2E2E FF00"
- $"6600 FF00 F9F9 FF00 6600 CC00 3130 FF00"
- $"6600 9900 2F2F FF00 6600 6600 2E2E FF00"
- $"6600 3300 2D2D FF00 6600 0000 3130 FF00"
- $"3300 FF00 2F2F FF00 3300 CC00 2E2E FF00"
- $"3300 9900 2D2D FF00 3300 6600 3130 FF00"
- $"3300 3300 2F2F FF00 3300 0000 2E2E FF00"
- $"0000 FF00 2D2D FF00 0000 CC00 3130 FF00"
- $"0000 9900 2F2F FF00 0000 6600 2E2E FF00"
- $"0000 3300 2DF8 FF00 0000 0000 2B2A CC00"
- $"FF00 FF00 2929 CC00 FF00 CC00 2828 CC00"
- $"FF00 9900 27F8 CC00 FF00 6600 2B2A CC00"
- $"FF00 3300 2929 CC00 FF00 0000 2828 CC00"
- $"CC00 FF00 2727 CC00 CC00 CC00 2B2A CC00"
- $"CC00 9900 2929 CC00 CC00 6600 2828 CC00"
- $"CC00 3300 2727 CC00 CC00 0000 2B2A CC00"
- $"9900 FF00 2929 CC00 9900 CC00 2828 CC00"
- $"9900 9900 2727 CC00 9900 6600 DBDB CC00"
- $"9900 3300 4747 CC00 9900 0000 4646 CC00"
- $"6600 FF00 4545 CC00 6600 CC00 DBDB CC00"
- $"6600 9900 4747 CC00 6600 6600 4646 CC00"
- $"6600 3300 4545 CC00 6600 0000 DBDB CC00"
- $"3300 FF00 4747 CC00 3300 CC00 4646 CC00"
- $"3300 9900 4545 CC00 3300 6600 DBDB CC00"
- $"3300 3300 4141 CC00 3300 0000 4040 CC00"
- $"0000 FF00 3F3F CC00 0000 CC00 4342 CC00"
- $"0000 9900 4141 CC00 0000 6600 4040 CC00"
- $"0000 3300 3F3F CC00 0000 0000 4342 9900"
- $"FF00 FF00 4141 9900 FF00 CC00 4040 9900"
- $"FF00 9900 3F3F 9900 FF00 6600 4342 9900"
- $"FF00 3300 4141 9900 FF00 0000 4040 9900"
- $"CC00 FF00 3F3F 9900 CC00 CC00 4342 9900"
- $"CC00 9900 4141 9900 CC00 6600 4040 9900"
- $"CC00 3300 3F3F 9900 CC00 0000 4342 9900"
- $"9900 FF00 4141 9900 9900 CC00 4040 9900"
- $"9900 9900 3F3F 9900 9900 6600 3D3C 9900"
- $"9900 3300 3B3B 9900 9900 0000 3A3A 9900"
- $"6600 FF00 3939 9900 6600 CC00 3D3C 9900"
- $"6600 9900 3B3B 9900 6600 6600 3A3A 9900"
- $"6600 3300 3939 9900 6600 0000 3D3C 9900"
- $"3300 FF00 3B3B 9900 3300 CC00 3A3A 9900"
- $"3300 9900 3939 9900 3300 6600 3D3C 9900"
- $"3300 3300 3B3B 9900 3300 0000 3A3A 9900"
- $"0000 FF00 3939 9900 0000 CC00 3D3C 9900"
- $"0000 9900 3B3B 9900 0000 6600 3A3A 9900"
- $"0000 3300 3939 9900 0000 0000 3D3C 6600"
- $"FF00 FF00 3B3B 6600 FF00 CC00 3A3A 6600"
- $"FF00 9900 3939 6600 FF00 6600 3D3C 6600"
- $"FF00 3300 3B3B 6600 FF00 0000 3A3A 6600"
- $"CC00 FF00 3939 6600 CC00 CC00 3736 6600"
- $"CC00 9900 3535 6600 CC00 6600 3434 6600"
- $"CC00 3300 3333 6600 CC00 0000 3736 6600"
- $"9900 FF00 3535 6600 9900 CC00 3434 6600"
- $"9900 9900 3333 6600 9900 6600 3736 6600"
- $"9900 3300 3535 6600 9900 0000 3434 6600"
- $"6600 FF00 3333 6600 6600 CC00 3736 6600"
- $"6600 9900 3535 6600 6600 6600 3434 6600"
- $"6600 3300 3333 6600 6600 0000 3736 6600"
- $"3300 FF00 3535 6600 3300 CC00 3434 6600"
- $"3300 9900 3333 6600 3300 6600 3736 6600"
- $"3300 3300 3535 6600 3300 0000 3434 6600"
- $"0000 FF00 3333 6600 0000 CC00 3130 6600"
- $"0000 9900 2F2F 6600 0000 6600 2E2E 6600"
- $"0000 3300 F9F9 6600 0000 0000 3130 3300"
- $"FF00 FF00 2F2F 3300 FF00 CC00 2E2E 3300"
- $"FF00 9900 F9F9 3300 FF00 6600 3130 3300"
- $"FF00 3300 2F2F 3300 FF00 0000 2E2E 3300"
- $"CC00 FF00 2D2D 3300 CC00 CC00 3130 3300"
- $"CC00 9900 2F2F 3300 CC00 6600 2E2E 3300"
- $"CC00 3300 2D2D 3300 CC00 0000 3130 3300"
- $"9900 FF00 2F2F 3300 9900 CC00 2E2E 3300"
- $"9900 9900 2D2D 3300 9900 6600 3130 3300"
- $"9900 3300 2F2F 3300 9900 0000 2E2E 3300"
- $"6600 FF00 2DF8 3300 6600 CC00 2B2A 3300"
- $"6600 9900 2929 3300 6600 6600 2828 3300"
- $"6600 3300 27F8 3300 6600 0000 2B2A 3300"
- $"3300 FF00 2929 3300 3300 CC00 2828 3300"
- $"3300 9900 2727 3300 3300 6600 2B2A 3300"
- $"3300 3300 2929 3300 3300 0000 2828 3300"
- $"0000 FF00 2727 3300 0000 CC00 2B2A 3300"
- $"0000 9900 2929 3300 0000 6600 2828 3300"
- $"0000 3300 2727 3300 0000 0000 4948 0000"
- $"FF00 FF00 4747 0000 FF00 CC00 4646 0000"
- $"FF00 9900 4545 0000 FF00 6600 4948 0000"
- $"FF00 3300 4747 0000 FF00 0000 4646 0000"
- $"CC00 FF00 4545 0000 CC00 CC00 4948 0000"
- $"CC00 9900 4747 0000 CC00 6600 4646 0000"
- $"CC00 3300 4545 0000 CC00 0000 4342 0000"
- $"9900 FF00 4141 0000 9900 CC00 4040 0000"
- $"9900 9900 3F3F 0000 9900 6600 4342 0000"
- $"9900 3300 4141 0000 9900 0000 4040 0000"
- $"6600 FF00 3F3F 0000 6600 CC00 4342 0000"
- $"6600 9900 4141 0000 6600 6600 4040 0000"
- $"6600 3300 3F3F 0000 6600 0000 4342 0000"
- $"3300 FF00 4141 0000 3300 CC00 4040 0000"
- $"3300 9900 3F3F 0000 3300 6600 4342 0000"
- $"3300 3300 4141 0000 3300 0000 4040 0000"
- $"0000 FF00 3F3F 0000 0000 CC00 4342 0000"
- $"0000 9900 4141 0000 0000 6600 4040 0000"
- $"0000 3300 3F3F EE00 0000 0000 3D3C DD00"
- $"0000 0000 3B3B BB00 0000 0000 3A3A AA00"
- $"0000 0000 3939 8800 0000 0000 3D3C 7700"
- $"0000 0000 3B3B 5500 0000 0000 3A3A 4400"
- $"0000 0000 3939 2200 0000 0000 3D3C 1100"
- $"0000 0000 3B3B 0000 EE00 0000 3A3A 0000"
- $"DD00 0000 3939 0000 BB00 0000 3D3C 0000"
- $"AA00 0000 3B3B 0000 8800 0000 3A3A 0000"
- $"7700 0000 3939 0000 5500 0000 3D3C 0000"
- $"4400 0000 3B3B 0000 2200 0000 3A3A 0000"
- $"1100 0000 3939 0000 0000 EE00 3D3C 0000"
- $"0000 DD00 3B3B 0000 0000 BB00 3A3A 0000"
- $"0000 AA00 3939 0000 0000 8800 3D3C 0000"
- $"0000 7700 3B3B 0000 0000 5500 3A3A 0000"
- $"0000 4400 3939 0000 0000 2200 3736 0000"
- $"0000 1100 3535 EE00 EE00 EE00 3434 DD00"
- $"DD00 DD00 3333 BB00 BB00 BB00 3736 AA00"
- $"AA00 AA00 3535 8800 8800 8800 3434 7700"
- $"7700 7700 3333 5500 5500 5500 3736 4400"
- $"4400 4400 3535 2200 2200 2200 3434 1100"
- $"1100 1100 3333 0000 0000 0000 0000 0000"
- $"0064 0044 0000 0000 0064 0044 0000 000A"
- $"0000 0000 0064 0044 02BD 0013 E800 01F5"
- $"F6FE 07FE 0E02 3232 33FD 3900 0EE6 001D"
- $"FC00 01F5 F5FE 0700 08FE 0E02 3232 33FE"
- $"3900 3AFC 40F2 4102 4033 07E9 0017 0100"
- $"0EFC 40DC 4102 390E F5F5 0002 F5F5 F6FE"
- $"0702 0E07 0016 0100 32D5 4104 4039 0E32"
- $"33FD 3900 3AFC 40FC 4101 3200 0801 000E"
- $"C141 010E 0008 0100 0EC1 4101 0800 0801"
- $"000E C141 0107 0008 0100 0EC1 4101 0700"
- $"0901 0007 C241 0240 F500 0E01 0007 E841"
- $"0147 47DD 4102 4000 0012 0100 07F0 4100"
- $"47FA 4101 3B3B DD41 0240 0000 1901 0007"
- $"F141 0C47 3B0B 3B47 4141 4711 0505 3B47"
- $"DF41 023A 0000 1701 00F6 F041 010B 0BFE"
- $"4105 473B 0505 113B DE41 0239 0000 1A02"
- $"00F5 40F3 410C 473B 053B 4741 4741 0B0B"
- $"3B47 47DE 4102 3900 0018 0200 F540 F341"
- $"0247 110B FE41 0447 1105 4147 DC41 0233"
- $"0000 1B02 0000 40F3 4103 4711 1147 FE41"
- $"0205 3547 F741 FD47 E941 0232 0000 1E02"
- $"0000 40F2 4106 113B 4741 4735 0BF7 4106"
- $"4741 390E 0E40 47EA 4102 0E00 0021 0200"
- $"0040 F241 0711 3B47 4141 0B35 47F9 4102"
- $"4740 07FE 0002 F640 47EB 4102 0E00 0023"
- $"0200 0040 F341 0847 3541 4147 3B05 4147"
- $"FA41 0947 3AF6 00F5 4F55 F50E 47EB 4102"
- $"0700 0022 0200 003A F341 0147 3BFE 4101"
- $"0B0B F941 0547 3AF5 0055 C8FE CE01 5640"
- $"EB41 0207 0000 1F02 0000 39F0 4104 4741"
- $"053B 47FB 4104 4740 F5F5 A4FC CE01 C85D"
- $"EB41 02F6 0000 1F02 0000 39F0 4104 473B"
- $"0541 47FC 4104 4740 07F6 C8FA CE00 64EC"
- $"4103 40F5 0000 1C02 0000 39F0 4102 4711"
- $"0BFA 4103 4708 2AC8 FACE 0164 D8EC 4100"
- $"40FE 0025 0200 0039 EF41 020B 3B47 FC41"
- $"0347 0FF5 A4FB CE02 C887 D8FC 41FE 47FC"
- $"4100 47F9 4100 3AFE 0028 0200 0039 EF41"
- $"020B 3B47 FD41 0347 3900 A4FA CE00 ABFA"
- $"4109 3B11 3B41 4147 3B0B 3B47 FA41 0039"
- $"FE00 2402 0000 33F1 4102 4741 0BFA 4101"
- $"0779 F9CE 0064 FA41 0235 050B FD41 010B"
- $"0BF9 4100 39FE 0028 0200 0032 F141 0247"
- $"3B0B FC41 0247 39F6 F9CE 0187 D8FB 4103"
- $"4741 050B FE41 0247 110B F941 0039 FE00"
- $"2C02 0000 32F1 4102 473B 11FB 4101 0879"
- $"FACE 05AA 4041 4147 47FE 410A 4741 0511"
- $"4741 4147 3511 47FA 4100 32FE 002F 0200"
- $"000E F141 0347 3B11 47FE 4103 4740 F6C8"
- $"FACE 0564 D841 4039 39FE 4104 473B 053B"
- $"47FE 4102 3541 47FA 4100 0EFE 0027 0200"
- $"000E F141 0347 3B3B 47FE 4102 470F 79FA"
- $"CE0C 8741 4032 F500 003A 4741 473B 05F2"
- $"4100 0EFE 0027 0200 000E F141 0347 3B3B"
- $"47FD 4101 0EA4 FACE 01AB AAFE C808 7900"
- $"3947 4147 110B 47F3 4100 07FE 001C 0200"
- $"000E EA41 0240 2BC8 F5CE 0881 0033 4741"
- $"410B 3B47 F341 0007 FE00 1A02 0000 08EB"
- $"4102 473A 55F4 CE06 5D00 3947 4741 0BF1"
- $"4100 F6FE 001C 0200 0007 EB41 0247 3979"
- $"F4CE 0739 0039 4747 3511 47F3 4101 40F5"
- $"FE00 1C02 0000 07EB 4102 4739 A4F5 CE08"
- $"AB0E 0040 4741 1141 47F3 4100 40FD 001B"
- $"0200 0007 EB41 0247 39A4 F5CE 0787 0707"
- $"4147 4111 47F2 4100 40FD 001B 0200 0007"
- $"EB41 0247 39C8 F5CE 0763 F532 4747 3B3B"
- $"47F2 4100 3AFD 001A 0300 00F6 40EC 4102"
- $"4739 C8F5 CE05 39F5 4047 413B F041 0039"
- $"FD00 1C03 0000 F540 EB41 0140 C8FD CE01"
- $"C8A4 FCCE 03AB 080E 47ED 4100 39FD 001A"
- $"FE00 0040 EB41 0040 FCCE 01A4 C8FC CE03"
- $"FA07 4047 ED41 0032 FD00 1AFE 0000 40EA"
- $"4100 AAFE CE02 87F9 C8FC CE02 560F 47EC"
- $"4100 32FD 0019 FE00 0040 EA41 00AB FECE"
- $"0264 56C8 FDCE 01C8 32EA 4100 0EFD 001B"
- $"FE00 0040 ED41 030E 4047 87FE CE01 4055"
- $"FCCE 01FA 40EA 4100 08FD 001A FE00 003A"
- $"ED41 0807 0740 FBCE CEAB 3979 FDCE 00AB"
- $"E841 0007 FD00 1CFE 0000 3AED 4108 0700"
- $"F6A4 CECE 8733 79FD CE02 4147 47EA 4100"
- $"07FD 001E FE00 0039 ED41 0807 2AA4 C8CE"
- $"CE88 0E9D FECE 0364 1C39 39EB 4101 40F5"
- $"FD00 1CFE 0000 39ED 4101 074F FDCE 0264"
- $"F7A4 FECE 03AB 80F6 07EB 4100 40FC 001C"
- $"FE00 0039 ED41 0108 79FE CE03 AB40 2BA4"
- $"FCCE 02F7 0E47 EC41 0040 FC00 1CFE 0000"
- $"39ED 4101 0879 FECE 03AB 40F6 C8FC CE02"
- $"F615 47EC 4100 40FC 001E FE00 003A EE41"
- $"0247 0E79 FECE 03AB 40F5 C8FD CE03 A4F5"
- $"3A47 EC41 0040 FC00 1EFE 0000 3AEE 4102"
- $"470E 56FE CE03 FB3A F6C8 FDCE 0280 F540"
- $"EB41 0140 F5FD 001E FE00 0040 EE41 0947"
- $"0F56 CECE C888 39F6 C8FD CE02 5601 40EB"
- $"4101 40F5 FD00 1CFE 0000 40EE 4109 4739"
- $"32CE CEC8 8839 2AC8 FDCE 0156 07E9 4100"
- $"F6FD 001B FE00 0040 EE41 0847 3A32 CECE"
- $"C864 152A FCCE 0132 07E9 4100 07FD 001A"
- $"FE00 0040 ED41 0740 32AB CEC8 6439 4EFC"
- $"CE01 3A07 E941 0007 FD00 1D03 0000 F540"
- $"ED41 0740 0EAB CECE 640F 4EFD CE03 AB40"
- $"0840 EA41 0007 FD00 1B03 0000 F540 EC41"
- $"060F 81CE CE64 334E FDCE 02AB 400E E941"
- $"000E FD00 1C02 0000 F6EC 4107 4715 FACE"
- $"CE64 334E FDCE 0387 0F0E 47EA 4100 0EFD"
- $"001C 0200 0007 EC41 0747 16F9 CEC8 6433"
- $"4EFD CE03 6308 4047 EA41 000E FD00 1A02"
- $"0000 07EB 4106 40F9 CEC8 6439 4EFD CE02"
- $"3940 47E9 4100 32FD 001B 0200 0007 EA41"
- $"0539 CECE 8839 F6FE CE04 AB41 4139 40EA"
- $"4100 32FD 001C 0200 0007 EB41 0E47 3AC8"
- $"CE88 39F6 C8CE CE64 15F6 F540 EA41 0033"
- $"FD00 1A02 0000 07EA 410C 40A4 CE87 392A"
- $"C8CE AB41 40F8 F6E9 4100 39FD 001B 0200"
- $"000E EB41 0D47 41AB C887 39F5 C8CE ABAB"
- $"CEA4 07E9 4100 39FD 001C 0200 000E ED41"
- $"0947 3939 4787 C8AB 40F5 C8FD CE01 A40E"
- $"E941 0039 FD00 1D02 0000 0EED 4109 473A"
- $"0007 80CE AB40 F5C8 FDCE 0255 0E47 EA41"
- $"0039 FD00 1B02 0000 0EEB 4107 0779 C8CE"
- $"CE40 F6A4 FDCE 022B 3947 EA41 003A FD00"
- $"1C02 0000 0EEC 4102 4739 79FE CE02 6407"
- $"A4FE CE02 A407 40E9 4100 40FD 001A 0200"
- $"0032 EA41 0632 A4CE CE88 0879 FECE 02F9"
- $"0F47 E941 0040 FD00 1A02 0000 32EB 4107"
- $"4740 F7C8 CE87 0E79 FECE 0132 40E8 4100"
- $"40FD 0019 0200 0033 EA41 0B47 40F8 C8AB"
- $"0E55 CECE 8015 47E8 4100 40FD 0017 0200"
- $"0033 E941 0847 40F9 A439 4FCE CE5D E641"
- $"0140 F5FE 0014 0200 0039 E841 0647 64FB"
- $"392B C8AB E441 00F6 FE00 1102 0000 39E5"
- $"4103 40F6 8764 E441 0007 FE00 1E02 0000"
- $"39EB 4102 3A0E 0EFD 4102 0740 47F6 4104"
- $"400F 0839 47F4 4100 07FE 0027 0200 0039"
- $"FB41 0147 47F2 4102 0800 40FE 4102 0839"
- $"47FC 4101 4747 FC41 0339 0039 47F4 4100"
- $"07FE 0029 0200 0039 FB41 0140 39F3 4109"
- $"470E F540 4141 470E 3347 FC41 0139 3AFD"
- $"4104 4739 0039 47F4 4100 08FE 0036 0200"
- $"003A FC41 0347 0E00 40FC 4102 4741 40FC"
- $"4109 470E F540 4141 4733 0E47 FE41 0447"
- $"4000 0E47 FE41 0447 3900 3941 FE40 F741"
- $"000E FE00 3A02 0000 3AFD 410E 4740 0700"
- $"0E40 4741 4147 390E 390E 40FE 4108 470E"
- $"F540 4141 4739 0EFC 4103 0F00 0739 FE41"
- $"0747 3900 3940 080F 39F7 4100 0EFE 0035"
- $"0200 0040 FB41 020E 0040 FE41 0D47 4000"
- $"3941 0032 4741 4147 0EF5 40FE 4101 4008"
- $"FC41 023A 000E FD41 0547 3900 3939 33F5"
- $"4100 0EFE 0039 0200 0040 FC41 0347 0E00"
- $"40FE 4106 4732 0040 4139 40FE 4103 470E"
- $"F540 FD41 0108 40FE 4104 4740 000E 47FE"
- $"4106 4739 0007 F540 47F6 4100 32FE 003A"
- $"0200 0040 FC41 0C47 0E00 4047 4141 470E"
- $"0040 4747 FD41 0347 0EF5 40FE 410A 470E"
- $"3947 4141 4740 000E 47FE 4107 4739 000E"
- $"0007 4147 F741 0032 FE00 3802 0000 40FC"
- $"4102 470E 00FD 4106 4739 003A 4740 39FE"
- $"4102 470E F5FD 410A 4733 3347 4141 4740"
- $"000E 47FE 4106 4739 0039 3900 0EF6 4100"
- $"33FE 003A 0200 F540 FC41 0447 3200 0E39"
- $"FD41 0B0E 0E40 333A 4741 413A 07F5 39FE"
- $"4102 473A 0EFD 410F 40F5 0733 4041 4140"
- $"0E00 0E40 0700 0E40 F841 0039 FE00 2902"
- $"00F5 40FA 4101 3939 FB41 023A 3A40 FD41"
- $"FD40 FD41 0240 0E40 FD41 0240 3940 FD41"
- $"FA40 F741 0039 FE00 2A01 00F6 F941 0147"
- $"47FB 4101 4747 FB41 0147 47FB 4101 3940"
- $"FD41 0147 47FB 4100 47FE 4100 47F6 4100"
- $"39FE 000D 0100 07E1 4100 40E4 4100 3AFE"
- $"0009 0100 07C3 4100 3AFE 0009 0100 07C3"
- $"4100 40FE 0009 0100 07C3 4100 40FE 0009"
- $"0100 07C3 4100 40FE 000A 0100 0EC3 4103"
- $"40F5 0000 0901 000E C241 02F6 0000 0901"
- $"000E C241 0207 0000 0901 000E C241 0207"
- $"0000 1101 000E ED41 FE40 003A F940 E241"
- $"0207 0000 2B01 0032 F941 FE40 FE39 0632"
- $"0E0E 0707 F6F5 F800 02F5 F5F6 FB07 FB0E"
- $"0332 3233 33FB 3901 3A3A FB40 0207 0000"
- $"0E0A 000E 3939 320E 0E07 07F6 F5C8 0002"
- $"BD00 00FF"
-};
-
-/*
- * Here is the custom file open dialog. This dialog is used instead of
- * the default file dialog if the -filetypes flag is specified.
- */
-
-resource 'DLOG' (130, purgeable) {
- {0, 0, 195, 344}, dBoxProc, invisible, noGoAway, 0,
- 130, "", noAutoCenter
-};
-
-resource 'DITL' (130, "File Open Box", purgeable) {
- {
- {135, 252, 155, 332}, Button {enabled, "Open"},
- {104, 252, 124, 332}, Button {enabled, "Cancel"},
- { 0, 0, 0, 0}, HelpItem {disabled, HMScanhdlg {130}},
- { 8, 235, 24, 337}, UserItem {enabled},
- { 32, 252, 52, 332}, Button {enabled, "Eject"},
- { 60, 252, 80, 332}, Button {enabled, "Desktop"},
- { 29, 12, 159, 230}, UserItem {enabled},
- { 6, 12, 25, 230}, UserItem {enabled},
- { 91, 251, 92, 333}, Picture {disabled, 11},
- {168, 20, 187, 300}, Control {enabled, 131}
- }
-};
-
-resource 'CNTL' (131, "File Types menu", purgeable) {
- {168, 20, 187, 300},
- popupTitleLeftJust,
- visible,
- 80,
- 132,
- popupMenuCDEFProc,
- 0,
- "File Type:"
-};
-
-
-resource 'MENU' (132, preload) {
- 132,
- textMenuProc,
- 0xFFFF, enabled, "", {}
-};
diff --git a/mac/tkMacScale.c b/mac/tkMacScale.c
deleted file mode 100644
index 1e24674..0000000
--- a/mac/tkMacScale.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * tkMacScale.c --
- *
- * This file implements the Macintosh specific portion of the
- * scale widget.
- *
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 by Scriptics Corporation.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkScale.h"
-#include "tkInt.h"
-#include <Controls.h>
-#include "tkMacInt.h"
-
-/*
- * Defines used in this file.
- */
-#define slider 1110
-#define inSlider 1
-#define inInc 2
-#define inDecr 3
-
-/*
- * Declaration of Macintosh specific scale structure.
- */
-
-typedef struct MacScale {
- TkScale info; /* Generic scale info. */
- int flags; /* Flags. */
- ControlRef scaleHandle; /* Handle to the Scale control struct. */
-} MacScale;
-
-/*
- * Globals uses locally in this file.
- */
-static ControlActionUPP scaleActionProc = NULL; /* Pointer to func. */
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static void MacScaleEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static pascal void ScaleActionProc _ANSI_ARGS_((ControlRef theControl,
- ControlPartCode partCode));
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpCreateScale --
- *
- * Allocate a new TkScale structure.
- *
- * Results:
- * Returns a newly allocated TkScale structure.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkScale *
-TkpCreateScale(tkwin)
- Tk_Window tkwin;
-{
- MacScale *macScalePtr;;
-
- macScalePtr = (MacScale *) ckalloc(sizeof(MacScale));
- macScalePtr->scaleHandle = NULL;
- if (scaleActionProc == NULL) {
- scaleActionProc = NewControlActionProc(ScaleActionProc);
- }
-
- Tk_CreateEventHandler(tkwin, ButtonPressMask,
- MacScaleEventProc, (ClientData) macScalePtr);
-
- return (TkScale *) macScalePtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDestroyScale --
- *
- * Free Macintosh specific resources.
- *
- * Results:
- * None
- *
- * Side effects:
- * The slider control is destroyed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDestroyScale(scalePtr)
- TkScale *scalePtr;
-{
- MacScale *macScalePtr = (MacScale *) scalePtr;
-
- /*
- * Free Macintosh control.
- */
- if (macScalePtr->scaleHandle != NULL) {
- DisposeControl(macScalePtr->scaleHandle);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDisplayScale --
- *
- * This procedure is invoked as an idle handler to redisplay
- * the contents of a scale widget.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The scale gets redisplayed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDisplayScale(clientData)
- ClientData clientData; /* Widget record for scale. */
-{
- TkScale *scalePtr = (TkScale *) clientData;
- Tk_Window tkwin = scalePtr->tkwin;
- Tcl_Interp *interp = scalePtr->interp;
- int result;
- char string[PRINT_CHARS];
- MacScale *macScalePtr = (MacScale *) clientData;
- Rect r;
- WindowRef windowRef;
- GWorldPtr destPort;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- MacDrawable *macDraw;
-
- scalePtr->flags &= ~REDRAW_PENDING;
- if ((scalePtr->tkwin == NULL) || !Tk_IsMapped(scalePtr->tkwin)) {
- goto done;
- }
-
- /*
- * Invoke the scale's command if needed.
- */
-
- Tcl_Preserve((ClientData) scalePtr);
- if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
- Tcl_Preserve((ClientData) interp);
- sprintf(string, scalePtr->format, scalePtr->value);
- result = Tcl_VarEval(interp, scalePtr->command, " ", string,
- (char *) NULL);
- if (result != TCL_OK) {
- Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
- Tcl_BackgroundError(interp);
- }
- Tcl_Release((ClientData) interp);
- }
- scalePtr->flags &= ~INVOKE_COMMAND;
- if (scalePtr->flags & SCALE_DELETED) {
- Tcl_Release((ClientData) scalePtr);
- return;
- }
- Tcl_Release((ClientData) scalePtr);
-
- /*
- * Now handle the part of redisplay that is the same for
- * horizontal and vertical scales: border and traversal
- * highlight.
- */
-
- if (scalePtr->highlightWidth != 0) {
- GC gc;
-
- gc = Tk_GCForColor(scalePtr->highlightColorPtr, Tk_WindowId(tkwin));
- Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth,
- Tk_WindowId(tkwin));
- }
- Tk_Draw3DRectangle(tkwin, Tk_WindowId(tkwin), scalePtr->bgBorder,
- scalePtr->highlightWidth, scalePtr->highlightWidth,
- Tk_Width(tkwin) - 2*scalePtr->highlightWidth,
- Tk_Height(tkwin) - 2*scalePtr->highlightWidth,
- scalePtr->borderWidth, scalePtr->relief);
-
- /*
- * Set up port for drawing Macintosh control.
- */
- macDraw = (MacDrawable *) Tk_WindowId(tkwin);
- destPort = TkMacGetDrawablePort(Tk_WindowId(tkwin));
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- TkMacSetUpClippingRgn(Tk_WindowId(tkwin));
-
- /*
- * Create Macintosh control.
- */
- if (macScalePtr->scaleHandle == NULL) {
- r.left = r.top = 0;
- r.right = r.bottom = 1;
- /* TODO: initial value. */
- /* 16*slider+4 */
- macScalePtr->scaleHandle = NewControl((WindowRef) destPort,
- &r, "\p", false, (short) 35, 0, 1000,
- 16*slider, (SInt32) macScalePtr);
-
- /*
- * If we are foremost than make us active.
- */
- if ((WindowPtr) destPort == FrontWindow()) {
- macScalePtr->flags |= ACTIVE;
- }
- }
- windowRef = (**macScalePtr->scaleHandle).contrlOwner;
-
- /*
- * We can't use the Macintosh commands SizeControl and MoveControl as these
- * calls will also cause a redraw which in our case will also cause
- * flicker. To avoid this we adjust the control record directly. The
- * Draw1Control command appears to just draw where ever the control says to
- * draw so this seems right.
- *
- * NOTE: changing the control record directly may not work when
- * Apple releases the Copland version of the MacOS in late 1996.
- */
-
- (**macScalePtr->scaleHandle).contrlRect.left = macDraw->xOff
- + scalePtr->inset;
- (**macScalePtr->scaleHandle).contrlRect.top = macDraw->yOff
- + scalePtr->inset;
- (**macScalePtr->scaleHandle).contrlRect.right = macDraw->xOff
- + Tk_Width(tkwin) - scalePtr->inset;
- (**macScalePtr->scaleHandle).contrlRect.bottom = macDraw->yOff
- + Tk_Height(tkwin) - scalePtr->inset;
-
- /*
- * Set the thumb and resolution etc.
- */
- (**macScalePtr->scaleHandle).contrlMin = (SInt16) scalePtr->toValue;
- (**macScalePtr->scaleHandle).contrlMax = (SInt16) scalePtr->fromValue;
- (**macScalePtr->scaleHandle).contrlValue = (SInt16) scalePtr->value;
-
- /*
- * Finally draw the control.
- */
- (**macScalePtr->scaleHandle).contrlVis = 255;
- (**macScalePtr->scaleHandle).contrlHilite = 0;
- Draw1Control(macScalePtr->scaleHandle);
-
- SetGWorld(saveWorld, saveDevice);
-
- done:
- scalePtr->flags &= ~REDRAW_ALL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpScaleElement --
- *
- * Determine which part of a scale widget lies under a given
- * point.
- *
- * Results:
- * The return value is either TROUGH1, SLIDER, TROUGH2, or
- * OTHER, depending on which of the scale's active elements
- * (if any) is under the point at (x,y).
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpScaleElement(scalePtr, x, y)
- TkScale *scalePtr; /* Widget record for scale. */
- int x, y; /* Coordinates within scalePtr's window. */
-{
- MacScale *macScalePtr = (MacScale *) scalePtr;
- ControlPartCode part;
- Point where;
- Rect bounds;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(Tk_WindowId(scalePtr->tkwin));
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
-
- /*
- * All of the calculations in this procedure mirror those in
- * DisplayScrollbar. Be sure to keep the two consistent.
- */
-
- TkMacWinBounds((TkWindow *) scalePtr->tkwin, &bounds);
- where.h = x + bounds.left;
- where.v = y + bounds.top;
- part = TestControl(macScalePtr->scaleHandle, where);
-
- SetGWorld(saveWorld, saveDevice);
-
- switch (part) {
- case inSlider:
- return SLIDER;
- case inInc:
- if (scalePtr->orient == ORIENT_VERTICAL) {
- return TROUGH1;
- } else {
- return TROUGH2;
- }
- case inDecr:
- if (scalePtr->orient == ORIENT_VERTICAL) {
- return TROUGH2;
- } else {
- return TROUGH1;
- }
- default:
- return OTHER;
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * MacScaleEventProc --
- *
- * This procedure is invoked by the Tk dispatcher for
- * ButtonPress events on scales.
- *
- * Results:
- * None.
- *
- * Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
- *
- *--------------------------------------------------------------
- */
-
-static void
-MacScaleEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
-{
- MacScale *macScalePtr = (MacScale *) clientData;
- Point where;
- Rect bounds;
- int part, x, y, dummy;
- unsigned int state;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- Window dummyWin;
-
- /*
- * To call Macintosh control routines we must have the port
- * set to the window containing the control. We will then test
- * which part of the control was hit and act accordingly.
- */
- destPort = TkMacGetDrawablePort(Tk_WindowId(macScalePtr->info.tkwin));
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- TkMacSetUpClippingRgn(Tk_WindowId(macScalePtr->info.tkwin));
-
- TkMacWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds);
- where.h = eventPtr->xbutton.x + bounds.left;
- where.v = eventPtr->xbutton.y + bounds.top;
- part = TestControl(macScalePtr->scaleHandle, where);
- if (part == 0) {
- return;
- }
-
- part = TrackControl(macScalePtr->scaleHandle, where, scaleActionProc);
-
- /*
- * Update the value for the widget.
- */
- macScalePtr->info.value = (**macScalePtr->scaleHandle).contrlValue;
- /* TkScaleSetValue(&macScalePtr->info, macScalePtr->info.value, 1, 0); */
-
- /*
- * The TrackControl call will "eat" the ButtonUp event. We now
- * generate a ButtonUp event so Tk will unset implicit grabs etc.
- */
- GetMouse(&where);
- XQueryPointer(NULL, None, &dummyWin, &dummyWin, &x,
- &y, &dummy, &dummy, &state);
- TkGenerateButtonEvent(x, y, Tk_WindowId(macScalePtr->info.tkwin), state);
-
- SetGWorld(saveWorld, saveDevice);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ScaleActionProc --
- *
- * Callback procedure used by the Macintosh toolbox call
- * TrackControl. This call will update the display while
- * the scrollbar is being manipulated by the user.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May change the display.
- *
- *--------------------------------------------------------------
- */
-
-static pascal void
-ScaleActionProc(ControlRef theControl, ControlPartCode partCode)
- /* ControlRef theControl; /* Handle to scrollbat control */
- /* ControlPartCode partCode; /* Part of scrollbar that was "hit" */
-{
- register int value;
- register TkScale *scalePtr = (TkScale *) GetCRefCon(theControl);
-
- value = (**theControl).contrlValue;
- TkScaleSetValue(scalePtr, value, 1, 1);
- Tcl_Preserve((ClientData) scalePtr);
- Tcl_DoOneEvent(TCL_IDLE_EVENTS);
- Tcl_Release((ClientData) scalePtr);
-}
-
diff --git a/mac/tkMacScrlbr.c b/mac/tkMacScrlbr.c
deleted file mode 100644
index 62523d2..0000000
--- a/mac/tkMacScrlbr.c
+++ /dev/null
@@ -1,1067 +0,0 @@
-/*
- * tkMacScrollbar.c --
- *
- * This file implements the Macintosh specific portion of the scrollbar
- * widget. The Macintosh scrollbar may also draw a windows grow
- * region under certain cases.
- *
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkScrollbar.h"
-#include "tkMacInt.h"
-#include <Controls.h>
-#include <ControlDefinitions.h>
-
-/*
- * The following definitions should really be in MacOS
- * header files. They are included here as this is the only
- * file that needs the declarations.
- */
-typedef pascal void (*ThumbActionFunc)(void);
-
-#if GENERATINGCFM
-typedef UniversalProcPtr ThumbActionUPP;
-#else
-typedef ThumbActionFunc ThumbActionUPP;
-#endif
-
-enum {
- uppThumbActionProcInfo = kPascalStackBased
-};
-
-#if GENERATINGCFM
-#define NewThumbActionProc(userRoutine) \
- (ThumbActionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppThumbActionProcInfo, GetCurrentArchitecture())
-#else
-#define NewThumbActionProc(userRoutine) \
- ((ThumbActionUPP) (userRoutine))
-#endif
-
-/*
- * Minimum slider length, in pixels (designed to make sure that the slider
- * is always easy to grab with the mouse).
- */
-
-#define MIN_SLIDER_LENGTH 5
-
-/*
- * Declaration of Windows specific scrollbar structure.
- */
-
-typedef struct MacScrollbar {
- TkScrollbar info; /* Generic scrollbar info. */
- ControlRef sbHandle; /* Handle to the Scrollbar control struct. */
- int macFlags; /* Various flags; see below. */
-} MacScrollbar;
-
-/*
- * Flag bits for scrollbars on the Mac:
- *
- * ALREADY_DEAD: Non-zero means this scrollbar has been
- * destroyed, but has not been cleaned up.
- * IN_MODAL_LOOP: Non-zero means this scrollbar is in the middle
- * of a modal loop.
- * ACTIVE: Non-zero means this window is currently
- * active (in the foreground).
- * FLUSH_TOP: Flush with top of Mac window.
- * FLUSH_BOTTOM: Flush with bottom of Mac window.
- * FLUSH_RIGHT: Flush with right of Mac window.
- * FLUSH_LEFT: Flush with left of Mac window.
- * SCROLLBAR_GROW: Non-zero means this window draws the grow
- * region for the toplevel window.
- * AUTO_ADJUST: Non-zero means we automatically adjust
- * the size of the widget to align correctly
- * along a Mac window.
- * DRAW_GROW: Non-zero means we draw the grow region.
- */
-
-#define ALREADY_DEAD 1
-#define IN_MODAL_LOOP 2
-#define ACTIVE 4
-#define FLUSH_TOP 8
-#define FLUSH_BOTTOM 16
-#define FLUSH_RIGHT 32
-#define FLUSH_LEFT 64
-#define SCROLLBAR_GROW 128
-#define AUTO_ADJUST 256
-#define DRAW_GROW 512
-
-/*
- * Globals uses locally in this file.
- */
-static ControlActionUPP scrollActionProc = NULL; /* Pointer to func. */
-static ThumbActionUPP thumbActionProc = NULL; /* Pointer to func. */
-static TkScrollbar *activeScrollPtr = NULL; /* Non-null when in thumb */
- /* proc. */
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static pascal void ScrollbarActionProc _ANSI_ARGS_((ControlRef theControl,
- ControlPartCode partCode));
-static int ScrollbarBindProc _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, XEvent *eventPtr,
- Tk_Window tkwin, KeySym keySym));
-static void ScrollbarEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static pascal void ThumbActionProc _ANSI_ARGS_((void));
-static void UpdateControlValues _ANSI_ARGS_((MacScrollbar *macScrollPtr));
-
-/*
- * The class procedure table for the scrollbar widget. Leave the proc fields
- * initialized to NULL, which should happen automatically because of the scope
- * at which the variable is declared.
- */
-
-Tk_ClassProcs tkpScrollbarProcs = {
- sizeof(Tk_ClassProcs) /* size */
-};
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpCreateScrollbar --
- *
- * Allocate a new TkScrollbar structure.
- *
- * Results:
- * Returns a newly allocated TkScrollbar structure.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkScrollbar *
-TkpCreateScrollbar(
- Tk_Window tkwin) /* New Tk Window. */
-{
- MacScrollbar * macScrollPtr;
- TkWindow *winPtr = (TkWindow *)tkwin;
-
- if (scrollActionProc == NULL) {
- scrollActionProc = NewControlActionProc(ScrollbarActionProc);
- thumbActionProc = NewThumbActionProc(ThumbActionProc);
- }
-
- macScrollPtr = (MacScrollbar *) ckalloc(sizeof(MacScrollbar));
- macScrollPtr->sbHandle = NULL;
- macScrollPtr->macFlags = 0;
-
- Tk_CreateEventHandler(tkwin, ActivateMask|ExposureMask|
- StructureNotifyMask|FocusChangeMask,
- ScrollbarEventProc, (ClientData) macScrollPtr);
-
- if (!Tcl_GetAssocData(winPtr->mainPtr->interp, "TkScrollbar", NULL)) {
- Tcl_SetAssocData(winPtr->mainPtr->interp, "TkScrollbar", NULL,
- (ClientData)1);
- TkCreateBindingProcedure(winPtr->mainPtr->interp,
- winPtr->mainPtr->bindingTable,
- (ClientData)Tk_GetUid("Scrollbar"), "<ButtonPress>",
- ScrollbarBindProc, NULL, NULL);
- }
-
- return (TkScrollbar *) macScrollPtr;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkpDisplayScrollbar --
- *
- * This procedure redraws the contents of a scrollbar window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Information appears on the screen.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkpDisplayScrollbar(
- ClientData clientData) /* Information about window. */
-{
- register TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
- register MacScrollbar *macScrollPtr = (MacScrollbar *) clientData;
- register Tk_Window tkwin = scrollPtr->tkwin;
-
- MacDrawable *macDraw;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- WindowRef windowRef;
-
- if ((scrollPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
- goto done;
- }
-
- /*
- * Draw the focus or any 3D relief we may have.
- */
- if (scrollPtr->highlightWidth != 0) {
- GC fgGC, bgGC;
-
- bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr,
- Tk_WindowId(tkwin));
-
- if (scrollPtr->flags & GOT_FOCUS) {
- fgGC = Tk_GCForColor(scrollPtr->highlightColorPtr,
- Tk_WindowId(tkwin));
- TkpDrawHighlightBorder(tkwin, fgGC, bgGC, scrollPtr->highlightWidth,
- Tk_WindowId(tkwin));
- } else {
- TkpDrawHighlightBorder(tkwin, bgGC, bgGC, scrollPtr->highlightWidth,
- Tk_WindowId(tkwin));
- }
- }
- Tk_Draw3DRectangle(tkwin, Tk_WindowId(tkwin), scrollPtr->bgBorder,
- scrollPtr->highlightWidth, scrollPtr->highlightWidth,
- Tk_Width(tkwin) - 2*scrollPtr->highlightWidth,
- Tk_Height(tkwin) - 2*scrollPtr->highlightWidth,
- scrollPtr->borderWidth, scrollPtr->relief);
-
- /*
- * Set up port for drawing Macintosh control.
- */
- macDraw = (MacDrawable *) Tk_WindowId(tkwin);
- destPort = TkMacGetDrawablePort(Tk_WindowId(tkwin));
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- TkMacSetUpClippingRgn(Tk_WindowId(tkwin));
-
- if (macScrollPtr->sbHandle == NULL) {
- Rect r;
- WindowRef frontNonFloating;
-
- r.left = r.top = 0;
- r.right = r.bottom = 1;
- macScrollPtr->sbHandle = NewControl((WindowRef) destPort, &r, "\p",
- false, (short) 500, 0, 1000,
- scrollBarProc, (SInt32) scrollPtr);
-
- /*
- * If we are foremost than make us active.
- */
-
- if (TkMacHaveAppearance() >= 0x110) {
- frontNonFloating = FrontNonFloatingWindow();
- } else {
- frontNonFloating = FrontWindow();
- }
-
- if ((WindowPtr) destPort == FrontWindow() || TkpIsWindowFloating((WindowPtr) destPort)) {
- macScrollPtr->macFlags |= ACTIVE;
- }
- }
-
- /*
- * Update the control values before we draw.
- */
- windowRef = (**macScrollPtr->sbHandle).contrlOwner;
- UpdateControlValues(macScrollPtr);
-
- if (macScrollPtr->macFlags & ACTIVE) {
- Draw1Control(macScrollPtr->sbHandle);
- if (macScrollPtr->macFlags & DRAW_GROW) {
- DrawGrowIcon(windowRef);
- }
- } else {
- (**macScrollPtr->sbHandle).contrlHilite = 255;
- Draw1Control(macScrollPtr->sbHandle);
- if (macScrollPtr->macFlags & DRAW_GROW) {
- DrawGrowIcon(windowRef);
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), scrollPtr->bgBorder,
- Tk_Width(tkwin) - 13, Tk_Height(tkwin) - 13,
- Tk_Width(tkwin), Tk_Height(tkwin),
- 0, TK_RELIEF_FLAT);
- }
- }
-
- SetGWorld(saveWorld, saveDevice);
-
- done:
- scrollPtr->flags &= ~REDRAW_PENDING;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpConfigureScrollbar --
- *
- * This procedure is called after the generic code has finished
- * processing configuration options, in order to configure
- * platform specific options.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpConfigureScrollbar(scrollPtr)
- register TkScrollbar *scrollPtr; /* Information about widget; may or
- * may not already have values for
- * some fields. */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpComputeScrollbarGeometry --
- *
- * After changes in a scrollbar's size or configuration, this
- * procedure recomputes various geometry information used in
- * displaying the scrollbar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The scrollbar will be displayed differently.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpComputeScrollbarGeometry(
- register TkScrollbar *scrollPtr) /* Scrollbar whose geometry may
- * have changed. */
-{
- MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr;
- int width, fieldLength, adjust = 0;
-
- if (scrollPtr->highlightWidth < 0) {
- scrollPtr->highlightWidth = 0;
- }
- scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth;
- width = (scrollPtr->vertical) ? Tk_Width(scrollPtr->tkwin)
- : Tk_Height(scrollPtr->tkwin);
- scrollPtr->arrowLength = width - 2*scrollPtr->inset + 1;
- fieldLength = (scrollPtr->vertical ? Tk_Height(scrollPtr->tkwin)
- : Tk_Width(scrollPtr->tkwin))
- - 2*(scrollPtr->arrowLength + scrollPtr->inset);
- if (fieldLength < 0) {
- fieldLength = 0;
- }
- scrollPtr->sliderFirst = fieldLength*scrollPtr->firstFraction;
- scrollPtr->sliderLast = fieldLength*scrollPtr->lastFraction;
-
- /*
- * Adjust the slider so that some piece of it is always
- * displayed in the scrollbar and so that it has at least
- * a minimal width (so it can be grabbed with the mouse).
- */
-
- if (scrollPtr->sliderFirst > (fieldLength - 2*scrollPtr->borderWidth)) {
- scrollPtr->sliderFirst = fieldLength - 2*scrollPtr->borderWidth;
- }
- if (scrollPtr->sliderFirst < 0) {
- scrollPtr->sliderFirst = 0;
- }
- if (scrollPtr->sliderLast < (scrollPtr->sliderFirst
- + MIN_SLIDER_LENGTH)) {
- scrollPtr->sliderLast = scrollPtr->sliderFirst + MIN_SLIDER_LENGTH;
- }
- if (scrollPtr->sliderLast > fieldLength) {
- scrollPtr->sliderLast = fieldLength;
- }
- scrollPtr->sliderFirst += scrollPtr->arrowLength + scrollPtr->inset;
- scrollPtr->sliderLast += scrollPtr->arrowLength + scrollPtr->inset;
-
- /*
- * Register the desired geometry for the window (leave enough space
- * for the two arrows plus a minimum-size slider, plus border around
- * the whole window, if any). Then arrange for the window to be
- * redisplayed.
- */
-
- if (scrollPtr->vertical) {
- if ((macScrollPtr->macFlags & AUTO_ADJUST) &&
- (macScrollPtr->macFlags & (FLUSH_RIGHT|FLUSH_LEFT))) {
- adjust--;
- }
- Tk_GeometryRequest(scrollPtr->tkwin,
- scrollPtr->width + 2*scrollPtr->inset + adjust,
- 2*(scrollPtr->arrowLength + scrollPtr->borderWidth
- + scrollPtr->inset));
- } else {
- if ((macScrollPtr->macFlags & AUTO_ADJUST) &&
- (macScrollPtr->macFlags & (FLUSH_TOP|FLUSH_BOTTOM))) {
- adjust--;
- }
- Tk_GeometryRequest(scrollPtr->tkwin,
- 2*(scrollPtr->arrowLength + scrollPtr->borderWidth
- + scrollPtr->inset), scrollPtr->width + 2*scrollPtr->inset + adjust);
- }
- Tk_SetInternalBorder(scrollPtr->tkwin, scrollPtr->inset);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpDestroyScrollbar --
- *
- * Free data structures associated with the scrollbar control.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpDestroyScrollbar(
- TkScrollbar *scrollPtr) /* Scrollbar to destroy. */
-{
- MacScrollbar *macScrollPtr = (MacScrollbar *)scrollPtr;
-
- if (macScrollPtr->sbHandle != NULL) {
- if (!(macScrollPtr->macFlags & IN_MODAL_LOOP)) {
- DisposeControl(macScrollPtr->sbHandle);
- macScrollPtr->sbHandle = NULL;
- }
- }
- macScrollPtr->macFlags |= ALREADY_DEAD;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkpScrollbarPosition --
- *
- * Determine the scrollbar element corresponding to a
- * given position.
- *
- * Results:
- * One of TOP_ARROW, TOP_GAP, etc., indicating which element
- * of the scrollbar covers the position given by (x, y). If
- * (x,y) is outside the scrollbar entirely, then OUTSIDE is
- * returned.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-int
-TkpScrollbarPosition(
- TkScrollbar *scrollPtr, /* Scrollbar widget record. */
- int x, int y) /* Coordinates within scrollPtr's
- * window. */
-{
- MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr;
- GWorldPtr destPort;
- int length, width, tmp, inactive = false;
- ControlPartCode part;
- Point where;
- Rect bounds;
-
- if (scrollPtr->vertical) {
- length = Tk_Height(scrollPtr->tkwin);
- width = Tk_Width(scrollPtr->tkwin);
- } else {
- tmp = x;
- x = y;
- y = tmp;
- length = Tk_Width(scrollPtr->tkwin);
- width = Tk_Height(scrollPtr->tkwin);
- }
-
- if ((x < scrollPtr->inset) || (x >= (width - scrollPtr->inset))
- || (y < scrollPtr->inset) || (y >= (length - scrollPtr->inset))) {
- return OUTSIDE;
- }
-
- /*
- * All of the calculations in this procedure mirror those in
- * DisplayScrollbar. Be sure to keep the two consistent. On the
- * Macintosh we use the OS call TestControl to do this mapping.
- * For TestControl to work, the scrollbar must be active and must
- * be in the current port.
- */
-
- destPort = TkMacGetDrawablePort(Tk_WindowId(scrollPtr->tkwin));
- SetGWorld(destPort, NULL);
- UpdateControlValues(macScrollPtr);
- if ((**macScrollPtr->sbHandle).contrlHilite == 255) {
- inactive = true;
- (**macScrollPtr->sbHandle).contrlHilite = 0;
- }
-
- TkMacWinBounds((TkWindow *) scrollPtr->tkwin, &bounds);
- where.h = x + bounds.left;
- where.v = y + bounds.top;
- part = TestControl(((MacScrollbar *) scrollPtr)->sbHandle, where);
- if (inactive) {
- (**macScrollPtr->sbHandle).contrlHilite = 255;
- }
- switch (part) {
- case kControlUpButtonPart:
- return TOP_ARROW;
- case kControlPageUpPart:
- return TOP_GAP;
- case kControlIndicatorPart:
- return SLIDER;
- case kControlPageDownPart:
- return BOTTOM_GAP;
- case kControlDownButtonPart:
- return BOTTOM_ARROW;
- default:
- return OUTSIDE;
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ThumbActionProc --
- *
- * Callback procedure used by the Macintosh toolbox call
- * TrackControl. This call is used to track the thumb of
- * the scrollbar. Unlike the ScrollbarActionProc function
- * this function is called once and basically takes over
- * tracking the scrollbar from the control. This is done
- * to avoid conflicts with what the control plans to draw.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May change the display.
- *
- *--------------------------------------------------------------
- */
-
-static pascal void
-ThumbActionProc()
-{
- register TkScrollbar *scrollPtr = activeScrollPtr;
- register MacScrollbar *macScrollPtr = (MacScrollbar *) activeScrollPtr;
- Tcl_DString cmdString;
- Rect nullRect = {0,0,0,0};
- int origValue, trackBarPin;
- double thumbWidth, newFirstFraction, trackBarSize;
- char vauleString[40];
- Point currentPoint = { 0, 0 };
- Point lastPoint = { 0, 0 };
- Rect trackRect;
- Tcl_Interp *interp;
-
- if (scrollPtr == NULL) {
- return;
- }
-
- Tcl_DStringInit(&cmdString);
-
- /*
- * First compute values that will remain constant during the tracking
- * of the thumb. The variable trackBarSize is the length of the scrollbar
- * minus the 2 arrows and half the width of the thumb on both sides
- * (3 * arrowLength). The variable trackBarPin is the lower starting point
- * of the drag region.
- *
- * Note: the arrowLength is equal to the thumb width of a Mac scrollbar.
- */
- origValue = GetControlValue(macScrollPtr->sbHandle);
- trackRect = (**macScrollPtr->sbHandle).contrlRect;
- if (scrollPtr->vertical == true) {
- trackBarSize = (double) (trackRect.bottom - trackRect.top
- - (scrollPtr->arrowLength * 3));
- trackBarPin = trackRect.top + scrollPtr->arrowLength
- + (scrollPtr->arrowLength / 2);
- InsetRect(&trackRect, -25, -113);
-
- } else {
- trackBarSize = (double) (trackRect.right - trackRect.left
- - (scrollPtr->arrowLength * 3));
- trackBarPin = trackRect.left + scrollPtr->arrowLength
- + (scrollPtr->arrowLength / 2);
- InsetRect(&trackRect, -113, -25);
- }
-
- /*
- * Track the mouse while the button is held down. If the mouse is moved,
- * we calculate the value that should be passed to the "command" part of
- * the scrollbar.
- */
- while (StillDown()) {
- GetMouse(&currentPoint);
- if (EqualPt(currentPoint, lastPoint)) {
- continue;
- }
- lastPoint = currentPoint;
-
- /*
- * Calculating this value is a little tricky. We need to calculate a
- * value for where the thumb would be in a Motif widget (variable
- * thumb). This value is what the "command" expects and is what will
- * be resent to the scrollbar to update its value.
- */
- thumbWidth = scrollPtr->lastFraction - scrollPtr->firstFraction;
- if (PtInRect(currentPoint, &trackRect)) {
- if (scrollPtr->vertical == true) {
- newFirstFraction = (1.0 - thumbWidth) *
- ((double) (currentPoint.v - trackBarPin) / trackBarSize);
- } else {
- newFirstFraction = (1.0 - thumbWidth) *
- ((double) (currentPoint.h - trackBarPin) / trackBarSize);
- }
- } else {
- newFirstFraction = ((double) origValue / 1000.0)
- * (1.0 - thumbWidth);
- }
-
- sprintf(vauleString, "%g", newFirstFraction);
-
- Tcl_DStringSetLength(&cmdString, 0);
- Tcl_DStringAppend(&cmdString, scrollPtr->command,
- scrollPtr->commandSize);
- Tcl_DStringAppendElement(&cmdString, "moveto");
- Tcl_DStringAppendElement(&cmdString, vauleString);
-
- interp = scrollPtr->interp;
- Tcl_Preserve((ClientData) interp);
- Tcl_GlobalEval(interp, cmdString.string);
- Tcl_Release((ClientData) interp);
-
- Tcl_DStringSetLength(&cmdString, 0);
- Tcl_DStringAppend(&cmdString, "update idletasks",
- strlen("update idletasks"));
- Tcl_Preserve((ClientData) interp);
- Tcl_GlobalEval(interp, cmdString.string);
- Tcl_Release((ClientData) interp);
- }
-
- /*
- * This next bit of code is a bit of a hack - but needed. The problem is
- * that the control wants to draw the drag outline if the control value
- * changes during the drag (which it does). What we do here is change the
- * clip region to hide this drawing from the user.
- */
- ClipRect(&nullRect);
-
- Tcl_DStringFree(&cmdString);
- return;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ScrollbarActionProc --
- *
- * Callback procedure used by the Macintosh toolbox call
- * TrackControl. This call will update the display while
- * the scrollbar is being manipulated by the user.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May change the display.
- *
- *--------------------------------------------------------------
- */
-
-static pascal void
-ScrollbarActionProc(
- ControlRef theControl, /* Handle to scrollbat control */
- ControlPartCode partCode) /* Part of scrollbar that was "hit" */
-{
- register TkScrollbar *scrollPtr = (TkScrollbar *) GetControlReference(theControl);
- Tcl_DString cmdString;
-
- Tcl_DStringInit(&cmdString);
- Tcl_DStringAppend(&cmdString, scrollPtr->command,
- scrollPtr->commandSize);
-
- if (partCode == kControlUpButtonPart || partCode == kControlDownButtonPart) {
- Tcl_DStringAppendElement(&cmdString, "scroll");
- Tcl_DStringAppendElement(&cmdString,
- (partCode == kControlUpButtonPart ) ? "-1" : "1");
- Tcl_DStringAppendElement(&cmdString, "unit");
- } else if (partCode == kControlPageUpPart || partCode == kControlPageDownPart) {
- Tcl_DStringAppendElement(&cmdString, "scroll");
- Tcl_DStringAppendElement(&cmdString,
- (partCode == kControlPageUpPart ) ? "-1" : "1");
- Tcl_DStringAppendElement(&cmdString, "page");
- }
- Tcl_Preserve((ClientData) scrollPtr->interp);
- Tcl_DStringAppend(&cmdString, "; update idletasks",
- strlen("; update idletasks"));
- Tcl_GlobalEval(scrollPtr->interp, cmdString.string);
- Tcl_Release((ClientData) scrollPtr->interp);
-
- Tcl_DStringFree(&cmdString);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ScrollbarBindProc --
- *
- * This procedure is invoked when the default <ButtonPress>
- * binding on the Scrollbar bind tag fires.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The event enters a modal loop.
- *
- *--------------------------------------------------------------
- */
-
-static int
-ScrollbarBindProc(
- ClientData clientData, /* Not used. */
- Tcl_Interp *interp, /* Interp with binding. */
- XEvent *eventPtr, /* X event that triggered binding. */
- Tk_Window tkwin, /* Target window for event. */
- KeySym keySym) /* The KeySym if a key event. */
-{
- TkWindow *winPtr = (TkWindow*)tkwin;
- TkScrollbar *scrollPtr = (TkScrollbar *) winPtr->instanceData;
- MacScrollbar *macScrollPtr = (MacScrollbar *) winPtr->instanceData;
-
- Tcl_Preserve((ClientData)scrollPtr);
- macScrollPtr->macFlags |= IN_MODAL_LOOP;
-
- if (eventPtr->type == ButtonPress) {
- Point where;
- Rect bounds;
- int part, x, y, dummy;
- unsigned int state;
- CGrafPtr saveWorld;
- GDHandle saveDevice;
- GWorldPtr destPort;
- Window window;
-
- /*
- * To call Macintosh control routines we must have the port
- * set to the window containing the control. We will then test
- * which part of the control was hit and act accordingly.
- */
- destPort = TkMacGetDrawablePort(Tk_WindowId(scrollPtr->tkwin));
- GetGWorld(&saveWorld, &saveDevice);
- SetGWorld(destPort, NULL);
- TkMacSetUpClippingRgn(Tk_WindowId(scrollPtr->tkwin));
-
- TkMacWinBounds((TkWindow *) scrollPtr->tkwin, &bounds);
- where.h = eventPtr->xbutton.x + bounds.left;
- where.v = eventPtr->xbutton.y + bounds.top;
- part = TestControl(macScrollPtr->sbHandle, where);
- if (part == kControlIndicatorPart && scrollPtr->jump == false) {
- /*
- * Case 1: In thumb, no jump scrolling. Call track control
- * with the thumb action proc which will do most of the work.
- * Set the global activeScrollPtr to the current control
- * so the callback may have access to it.
- */
- activeScrollPtr = scrollPtr;
- part = TrackControl(macScrollPtr->sbHandle, where,
- (ControlActionUPP) thumbActionProc);
- activeScrollPtr = NULL;
- } else if (part == kControlIndicatorPart) {
- /*
- * Case 2: in thumb with jump scrolling. Call TrackControl
- * with a NULL action proc. Use the new value of the control
- * to set update the control.
- */
- part = TrackControl(macScrollPtr->sbHandle, where, NULL);
- if (part == kControlIndicatorPart) {
- double newFirstFraction, thumbWidth;
- Tcl_DString cmdString;
- char vauleString[TCL_DOUBLE_SPACE];
-
- /*
- * The following calculation takes the new control
- * value and maps it to what Tk needs for its variable
- * thumb size representation.
- */
- thumbWidth = scrollPtr->lastFraction
- - scrollPtr->firstFraction;
- newFirstFraction = (1.0 - thumbWidth) *
- ((double) GetControlValue(macScrollPtr->sbHandle) / 1000.0);
- sprintf(vauleString, "%g", newFirstFraction);
-
- Tcl_DStringInit(&cmdString);
- Tcl_DStringAppend(&cmdString, scrollPtr->command,
- strlen(scrollPtr->command));
- Tcl_DStringAppendElement(&cmdString, "moveto");
- Tcl_DStringAppendElement(&cmdString, vauleString);
- Tcl_DStringAppend(&cmdString, "; update idletasks",
- strlen("; update idletasks"));
-
- interp = scrollPtr->interp;
- Tcl_Preserve((ClientData) interp);
- Tcl_GlobalEval(interp, cmdString.string);
- Tcl_Release((ClientData) interp);
- Tcl_DStringFree(&cmdString);
- }
- } else if (part != 0) {
- /*
- * Case 3: in any other part of the scrollbar. We call
- * TrackControl with the scrollActionProc which will do
- * most all the work.
- */
- TrackControl(macScrollPtr->sbHandle, where, scrollActionProc);
- HiliteControl(macScrollPtr->sbHandle, 0);
- }
-
- /*
- * The TrackControl call will "eat" the ButtonUp event. We now
- * generate a ButtonUp event so Tk will unset implicit grabs etc.
- */
- GetMouse(&where);
- XQueryPointer(NULL, None, &window, &window, &x,
- &y, &dummy, &dummy, &state);
- window = Tk_WindowId(scrollPtr->tkwin);
- TkGenerateButtonEvent(x, y, window, state);
-
- SetGWorld(saveWorld, saveDevice);
- }
-
- if (macScrollPtr->sbHandle && (macScrollPtr->macFlags & ALREADY_DEAD)) {
- DisposeControl(macScrollPtr->sbHandle);
- macScrollPtr->sbHandle = NULL;
- }
- macScrollPtr->macFlags &= ~IN_MODAL_LOOP;
- Tcl_Release((ClientData)scrollPtr);
-
- return TCL_OK;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ScrollbarEventProc --
- *
- * This procedure is invoked by the Tk dispatcher for various
- * events on scrollbars.
- *
- * Results:
- * None.
- *
- * Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ScrollbarEventProc(
- ClientData clientData, /* Information about window. */
- XEvent *eventPtr) /* Information about event. */
-{
- TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
- MacScrollbar *macScrollPtr = (MacScrollbar *) clientData;
-
- if (eventPtr->type == UnmapNotify) {
- TkMacSetScrollbarGrow((TkWindow *) scrollPtr->tkwin, false);
- } else if (eventPtr->type == ActivateNotify) {
- macScrollPtr->macFlags |= ACTIVE;
- TkScrollbarEventuallyRedraw((ClientData) scrollPtr);
- } else if (eventPtr->type == DeactivateNotify) {
- macScrollPtr->macFlags &= ~ACTIVE;
- TkScrollbarEventuallyRedraw((ClientData) scrollPtr);
- } else {
- TkScrollbarEventProc(clientData, eventPtr);
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * UpdateControlValues --
- *
- * This procedure updates the Macintosh scrollbar control
- * to display the values defined by the Tk scrollbar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The Macintosh control is updated.
- *
- *--------------------------------------------------------------
- */
-
-static void
-UpdateControlValues(
- MacScrollbar *macScrollPtr) /* Scrollbar data struct. */
-{
- TkScrollbar *scrollPtr = (TkScrollbar *) macScrollPtr;
- Tk_Window tkwin = scrollPtr->tkwin;
- MacDrawable * macDraw = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin);
- WindowRef windowRef = (**macScrollPtr->sbHandle).contrlOwner;
- double middle;
- int drawGrowRgn = false;
- int flushRight = false;
- int flushBottom = false;
-
- /*
- * We can't use the Macintosh commands SizeControl and MoveControl as these
- * calls will also cause a redraw which in our case will also cause
- * flicker. To avoid this we adjust the control record directly. The
- * Draw1Control command appears to just draw where ever the control says to
- * draw so this seems right.
- *
- * NOTE: changing the control record directly may not work when
- * Apple releases the Copland version of the MacOS (or when hell is cold).
- */
-
- (**macScrollPtr->sbHandle).contrlRect.left = macDraw->xOff + scrollPtr->inset;
- (**macScrollPtr->sbHandle).contrlRect.top = macDraw->yOff + scrollPtr->inset;
- (**macScrollPtr->sbHandle).contrlRect.right = macDraw->xOff + Tk_Width(tkwin)
- - scrollPtr->inset;
- (**macScrollPtr->sbHandle).contrlRect.bottom = macDraw->yOff +
- Tk_Height(tkwin) - scrollPtr->inset;
-
- /*
- * To make Tk applications look more like Macintosh applications without
- * requiring additional work by the Tk developer we do some cute tricks.
- * The first trick plays with the size of the widget to get it to overlap
- * with the side of the window by one pixel (we don't do this if the placer
- * is the geometry manager). The second trick shrinks the scrollbar if it
- * it covers the area of the grow region ao the scrollbar can also draw
- * the grow region if need be.
- */
- if (!strcmp(macDraw->winPtr->geomMgrPtr->name, "place")) {
- macScrollPtr->macFlags &= AUTO_ADJUST;
- } else {
- macScrollPtr->macFlags |= AUTO_ADJUST;
- }
- /* TODO: use accessor function!!! */
- if (windowRef->portRect.left == (**macScrollPtr->sbHandle).contrlRect.left) {
- if (macScrollPtr->macFlags & AUTO_ADJUST) {
- (**macScrollPtr->sbHandle).contrlRect.left--;
- }
- if (!(macScrollPtr->macFlags & FLUSH_LEFT)) {
- macScrollPtr->macFlags |= FLUSH_LEFT;
- if (scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
- } else if (macScrollPtr->macFlags & FLUSH_LEFT) {
- macScrollPtr->macFlags &= ~FLUSH_LEFT;
- if (scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
-
- if (windowRef->portRect.top == (**macScrollPtr->sbHandle).contrlRect.top) {
- if (macScrollPtr->macFlags & AUTO_ADJUST) {
- (**macScrollPtr->sbHandle).contrlRect.top--;
- }
- if (!(macScrollPtr->macFlags & FLUSH_TOP)) {
- macScrollPtr->macFlags |= FLUSH_TOP;
- if (! scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
- } else if (macScrollPtr->macFlags & FLUSH_TOP) {
- macScrollPtr->macFlags &= ~FLUSH_TOP;
- if (! scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
-
- if (windowRef->portRect.right == (**macScrollPtr->sbHandle).contrlRect.right) {
- flushRight = true;
- if (macScrollPtr->macFlags & AUTO_ADJUST) {
- (**macScrollPtr->sbHandle).contrlRect.right++;
- }
- if (!(macScrollPtr->macFlags & FLUSH_RIGHT)) {
- macScrollPtr->macFlags |= FLUSH_RIGHT;
- if (scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
- } else if (macScrollPtr->macFlags & FLUSH_RIGHT) {
- macScrollPtr->macFlags &= ~FLUSH_RIGHT;
- if (scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
-
- if (windowRef->portRect.bottom == (**macScrollPtr->sbHandle).contrlRect.bottom) {
- flushBottom = true;
- if (macScrollPtr->macFlags & AUTO_ADJUST) {
- (**macScrollPtr->sbHandle).contrlRect.bottom++;
- }
- if (!(macScrollPtr->macFlags & FLUSH_BOTTOM)) {
- macScrollPtr->macFlags |= FLUSH_BOTTOM;
- if (! scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
- } else if (macScrollPtr->macFlags & FLUSH_BOTTOM) {
- macScrollPtr->macFlags &= ~FLUSH_BOTTOM;
- if (! scrollPtr->vertical) {
- TkpComputeScrollbarGeometry(scrollPtr);
- }
- }
-
- /*
- * If the scrollbar is flush against the bottom right hand coner then
- * it may need to draw the grow region for the window so we let the
- * wm code know about this scrollbar. We don't actually draw the grow
- * region, however, unless we are currently resizable.
- */
- macScrollPtr->macFlags &= ~DRAW_GROW;
- if (flushBottom && flushRight) {
- TkMacSetScrollbarGrow((TkWindow *) tkwin, true);
- if (TkMacResizable(macDraw->toplevel->winPtr)) {
- if (scrollPtr->vertical) {
- (**macScrollPtr->sbHandle).contrlRect.bottom -= 14;
- } else {
- (**macScrollPtr->sbHandle).contrlRect.right -= 14;
- }
- macScrollPtr->macFlags |= DRAW_GROW;
- }
- } else {
- TkMacSetScrollbarGrow((TkWindow *) tkwin, false);
- }
-
- /*
- * Given the Tk parameters for the fractions of the start and
- * end of the thumb, the following calculation determines the
- * location for the fixed sized Macintosh thumb.
- */
- middle = scrollPtr->firstFraction / (scrollPtr->firstFraction +
- (1.0 - scrollPtr->lastFraction));
-
- (**macScrollPtr->sbHandle).contrlValue = (short) (middle * 1000);
- if ((**macScrollPtr->sbHandle).contrlHilite == 0 ||
- (**macScrollPtr->sbHandle).contrlHilite == 255) {
- if (scrollPtr->firstFraction == 0.0 &&
- scrollPtr->lastFraction == 1.0) {
- (**macScrollPtr->sbHandle).contrlHilite = 255;
- } else {
- (**macScrollPtr->sbHandle).contrlHilite = 0;
- }
- }
- if ((**macScrollPtr->sbHandle).contrlVis != 255) {
- (**macScrollPtr->sbHandle).contrlVis = 255;
- }
-}
diff --git a/mac/tkMacSend.c b/mac/tkMacSend.c
deleted file mode 100644
index 4fa0425..0000000
--- a/mac/tkMacSend.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * tkMacSend.c --
- *
- * This file provides procedures that implement the "send"
- * command, allowing commands to be passed from interpreter
- * to interpreter. This current implementation for the Mac
- * has most functionality stubed out.
- *
- * The current plan, which we have not had time to implement, is
- * for the first Wish app to create a gestalt of type 'WIsH'.
- * This gestalt will point to a table, in system memory, of
- * Tk apps. Each Tk app, when it starts up, will register their
- * name, and process ID, in this table. This will allow us to
- * implement "tk appname".
- *
- * Then the send command will look up the process id of the target
- * app in this table, and send an AppleEvent to that process. The
- * AppleEvent handler is much like the do script handler, except that
- * you have to specify the name of the tk app as well, since there may
- * be many interps in one wish app, and you need to send it to the
- * right one.
- *
- * Implementing this has been on our list of things to do, but what
- * with the demise of Tcl at Sun, and the lack of resources at
- * Scriptics it may not get done for awhile. So this sketch is
- * offered for the brave to attempt if they need the functionality...
- *
- * Copyright (c) 1989-1994 The Regents of the University of California.
- * Copyright (c) 1994-1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Gestalt.h>
-#include "tkPort.h"
-#include "tkInt.h"
-
-EXTERN int Tk_SendObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
-
- /*
- * The following structure is used to keep track of the
- * interpreters registered by this process.
- */
-
-typedef struct RegisteredInterp {
- char *name; /* Interpreter's name (malloc-ed). */
- Tcl_Interp *interp; /* Interpreter associated with
- * name. */
- struct RegisteredInterp *nextPtr;
- /* Next in list of names associated
- * with interps in this process.
- * NULL means end of list. */
-} RegisteredInterp;
-
-/*
- * A registry of all interpreters for a display is kept in a
- * property "InterpRegistry" on the root window of the display.
- * It is organized as a series of zero or more concatenated strings
- * (in no particular order), each of the form
- * window space name '\0'
- * where "window" is the hex id of the comm. window to use to talk
- * to an interpreter named "name".
- *
- * When the registry is being manipulated by an application (e.g. to
- * add or remove an entry), it is loaded into memory using a structure
- * of the following type:
- */
-
-typedef struct NameRegistry {
- TkDisplay *dispPtr; /* Display from which the registry was
- * read. */
- int locked; /* Non-zero means that the display was
- * locked when the property was read in. */
- int modified; /* Non-zero means that the property has
- * been modified, so it needs to be written
- * out when the NameRegistry is closed. */
- unsigned long propLength; /* Length of the property, in bytes. */
- char *property; /* The contents of the property, or NULL
- * if none. See format description above;
- * this is *not* terminated by the first
- * null character. Dynamically allocated. */
- int allocedByX; /* Non-zero means must free property with
- * XFree; zero means use ckfree. */
-} NameRegistry;
-
-static initialized = false; /* A flag to denote if we have initialized yet. */
-
-static RegisteredInterp *interpListPtr = NULL;
-/* List of all interpreters
- * registered by this process. */
-
- /*
- * The information below is used for communication between processes
- * during "send" commands. Each process keeps a private window, never
- * even mapped, with one property, "Comm". When a command is sent to
- * an interpreter, the command is appended to the comm property of the
- * communication window associated with the interp's process. Similarly,
- * when a result is returned from a sent command, it is also appended
- * to the comm property.
- *
- * Each command and each result takes the form of ASCII text. For a
- * command, the text consists of a zero character followed by several
- * null-terminated ASCII strings. The first string consists of the
- * single letter "c". Subsequent strings have the form "option value"
- * where the following options are supported:
- *
- * -r commWindow serial
- *
- * This option means that a response should be sent to the window
- * whose X identifier is "commWindow" (in hex), and the response should
- * be identified with the serial number given by "serial" (in decimal).
- * If this option isn't specified then the send is asynchronous and
- * no response is sent.
- *
- * -n name
- * "Name" gives the name of the application for which the command is
- * intended. This option must be present.
- *
- * -s script
- *
- * "Script" is the script to be executed. This option must be present.
- *
- * The options may appear in any order. The -n and -s options must be
- * present, but -r may be omitted for asynchronous RPCs. For compatibility
- * with future releases that may add new features, there may be additional
- * options present; as long as they start with a "-" character, they will
- * be ignored.
- *
- * A result also consists of a zero character followed by several null-
- * terminated ASCII strings. The first string consists of the single
- * letter "r". Subsequent strings have the form "option value" where
- * the following options are supported:
- *
- * -s serial
- *
- * Identifies the command for which this is the result. It is the
- * same as the "serial" field from the -s option in the command. This
- * option must be present.
- *
- * -c code
- *
- * "Code" is the completion code for the script, in decimal. If the
- * code is omitted it defaults to TCL_OK.
- *
- * -r result
- *
- * "Result" is the result string for the script, which may be either
- * a result or an error message. If this field is omitted then it
- * defaults to an empty string.
- *
- * -i errorInfo
- *
- * "ErrorInfo" gives a string with which to initialize the errorInfo
- * variable. This option may be omitted; it is ignored unless the
- * completion code is TCL_ERROR.
- *
- * -e errorCode
- *
- * "ErrorCode" gives a string with with to initialize the errorCode
- * variable. This option may be omitted; it is ignored unless the
- * completion code is TCL_ERROR.
- *
- * Options may appear in any order, and only the -s option must be
- * present. As with commands, there may be additional options besides
- * these; unknown options are ignored.
- */
-
- /*
- * The following variable is the serial number that was used in the
- * last "send" command. It is exported only for testing purposes.
- */
-
-int tkSendSerial = 0;
-
- /*
- * Maximum size property that can be read at one time by
- * this module:
- */
-
-#define MAX_PROP_WORDS 100000
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static int AppendErrorProc _ANSI_ARGS_((ClientData clientData,
- XErrorEvent *errorPtr));
-static void DeleteProc _ANSI_ARGS_((ClientData clientData));
-static void RegAddName _ANSI_ARGS_((NameRegistry *regPtr,
- char *name, Window commWindow));
-static void RegClose _ANSI_ARGS_((NameRegistry *regPtr));
-static void RegDeleteName _ANSI_ARGS_((NameRegistry *regPtr,
- char *name));
-static Window RegFindName _ANSI_ARGS_((NameRegistry *regPtr,
- char *name));
-static NameRegistry * RegOpen _ANSI_ARGS_((Tcl_Interp *interp,
- TkWindow *winPtr, int lock));
-static void SendEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int SendInit _ANSI_ARGS_((Tcl_Interp *interp));
-static Bool SendRestrictProc _ANSI_ARGS_((Display *display,
- XEvent *eventPtr, char *arg));
-static int ServerSecure _ANSI_ARGS_((TkDisplay *dispPtr));
-static void TimeoutProc _ANSI_ARGS_((ClientData clientData));
-static int ValidateName _ANSI_ARGS_((TkDisplay *dispPtr,
- char *name, Window commWindow, int oldOK));
-
-/*
- *--------------------------------------------------------------
- *
- * Tk_SetAppName --
- *
- * This procedure is called to associate an ASCII name with a Tk
- * application. If the application has already been named, the
- * name replaces the old one.
- *
- * Results:
- * The return value is the name actually given to the application.
- * This will normally be the same as name, but if name was already
- * in use for an application then a name of the form "name #2" will
- * be chosen, with a high enough number to make the name unique.
- *
- * Side effects:
- * Registration info is saved, thereby allowing the "send" command
- * to be used later to invoke commands in the application. In
- * addition, the "send" command is created in the application's
- * interpreter. The registration will be removed automatically
- * if the interpreter is deleted or the "send" command is removed.
- *
- *--------------------------------------------------------------
- */
-
-CONST char *
-Tk_SetAppName(
- Tk_Window tkwin, /* Token for any window in the application
- * to be named: it is just used to identify
- * the application and the display. */
- CONST char *name) /* The name that will be used to
- * refer to the interpreter in later
- * "send" commands. Must be globally
- * unique. */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- Tcl_Interp *interp = winPtr->mainPtr->interp;
- int i, suffix, offset, result;
- int createCommand = 0;
- RegisteredInterp *riPtr, *prevPtr;
- CONST char *actualName;
- Tcl_DString dString;
- Tcl_Obj *resultObjPtr, *interpNamePtr;
- char *interpName;
-
- if (!initialized) {
- SendInit(interp);
- }
-
- /*
- * See if the application is already registered; if so, remove its
- * current name from the registry. The deletion of the command
- * will take care of disposing of this entry.
- */
-
- for (riPtr = interpListPtr, prevPtr = NULL; riPtr != NULL;
- prevPtr = riPtr, riPtr = riPtr->nextPtr) {
- if (riPtr->interp == interp) {
- if (prevPtr == NULL) {
- interpListPtr = interpListPtr->nextPtr;
- } else {
- prevPtr->nextPtr = riPtr->nextPtr;
- }
- break;
- }
- }
-
- /*
- * Pick a name to use for the application. Use "name" if it's not
- * already in use. Otherwise add a suffix such as " #2", trying
- * larger and larger numbers until we eventually find one that is
- * unique.
- */
-
- actualName = name;
- suffix = 1;
- offset = 0;
- Tcl_DStringInit(&dString);
-
- TkGetInterpNames(interp, tkwin);
- resultObjPtr = Tcl_GetObjResult(interp);
- Tcl_IncrRefCount(resultObjPtr);
- for (i = 0; ; ) {
- result = Tcl_ListObjIndex(NULL, resultObjPtr, i, &interpNamePtr);
- if (interpNamePtr == NULL) {
- break;
- }
- interpName = Tcl_GetStringFromObj(interpNamePtr, NULL);
- if (strcmp(actualName, interpName) == 0) {
- if (suffix == 1) {
- Tcl_DStringAppend(&dString, name, -1);
- Tcl_DStringAppend(&dString, " #", 2);
- offset = Tcl_DStringLength(&dString);
- Tcl_DStringSetLength(&dString, offset + 10);
- actualName = Tcl_DStringValue(&dString);
- }
- suffix++;
- sprintf(Tcl_DStringValue(&dString) + offset, "%d", suffix);
- i = 0;
- } else {
- i++;
- }
- }
-
- Tcl_DecrRefCount(resultObjPtr);
- Tcl_ResetResult(interp);
-
- /*
- * We have found a unique name. Now add it to the registry.
- */
-
- riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
- riPtr->interp = interp;
- riPtr->name = ckalloc(strlen(actualName) + 1);
- riPtr->nextPtr = interpListPtr;
- interpListPtr = riPtr;
- strcpy(riPtr->name, actualName);
-
- Tcl_CreateObjCommand(interp, "send", Tk_SendObjCmd,
- (ClientData) riPtr, NULL /* TODO: DeleteProc */);
- if (Tcl_IsSafe(interp)) {
- Tcl_HideCommand(interp, "send", "send");
- }
- Tcl_DStringFree(&dString);
-
- return riPtr->name;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * Tk_SendObjCmd --
- *
- * This procedure is invoked to process the "send" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *--------------------------------------------------------------
- */
-
-int
-Tk_SendObjCmd(
- ClientData clientData, /* Used only for deletion */
- Tcl_Interp *interp, /* The interp we are sending from */
- int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[]) /* The arguments */
-{
- static CONST char *sendOptions[] = {"-async", "-displayof", "-", (char *) NULL};
- char *stringRep, *destName;
- int async = 0;
- int i, index, firstArg;
- RegisteredInterp *riPtr;
- Tcl_Obj *resultPtr, *listObjPtr;
- int result;
-
- for (i = 1; i < (objc - 1); ) {
- stringRep = Tcl_GetStringFromObj(objv[i], NULL);
- if (stringRep[0] == '-') {
- if (Tcl_GetIndexFromObj(interp, objv[i], sendOptions, "option", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (index == 0) {
- async = 1;
- i++;
- } else if (index == 1) {
- i += 2;
- } else {
- i++;
- }
- } else {
- break;
- }
- }
-
- if (objc < (i + 2)) {
- Tcl_WrongNumArgs(interp, 1, objv,
- "?options? interpName arg ?arg ...?");
- return TCL_ERROR;
- }
-
- destName = Tcl_GetStringFromObj(objv[i], NULL);
- firstArg = i + 1;
-
- resultPtr = Tcl_GetObjResult(interp);
-
- /*
- * See if the target interpreter is local. If so, execute
- * the command directly without going through the DDE server.
- * The only tricky thing is passing the result from the target
- * interpreter to the invoking interpreter. Watch out: they
- * could be the same!
- */
-
- for (riPtr = interpListPtr; (riPtr != NULL)
- && (strcmp(destName, riPtr->name)); riPtr = riPtr->nextPtr) {
- /*
- * Empty loop body.
- */
-
- }
-
- if (riPtr != NULL) {
- /*
- * This command is to a local interp. No need to go through
- * the server.
- */
-
- Tcl_Interp *localInterp;
-
- Tcl_Preserve((ClientData) riPtr);
- localInterp = riPtr->interp;
- Tcl_Preserve((ClientData) localInterp);
- if (firstArg == (objc - 1)) {
- /*
- * This might be one of those cases where the new
- * parser is faster.
- */
-
- result = Tcl_EvalObjEx(localInterp, objv[firstArg], TCL_EVAL_DIRECT);
- } else {
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
- for (i = firstArg; i < objc; i++) {
- Tcl_ListObjAppendList(interp, listObjPtr, objv[i]);
- }
- Tcl_IncrRefCount(listObjPtr);
- result = Tcl_EvalObjEx(localInterp, listObjPtr, TCL_EVAL_DIRECT);
- Tcl_DecrRefCount(listObjPtr);
- }
- if (interp != localInterp) {
- if (result == TCL_ERROR) {
- /* Tcl_Obj *errorObjPtr; */
-
- /*
- * An error occurred, so transfer error information from the
- * destination interpreter back to our interpreter. Must clear
- * interp's result before calling Tcl_AddErrorInfo, since
- * Tcl_AddErrorInfo will store the interp's result in errorInfo
- * before appending riPtr's $errorInfo; we've already got
- * everything we need in riPtr's $errorInfo.
- */
-
- Tcl_ResetResult(interp);
- Tcl_AddErrorInfo(interp, Tcl_GetVar2(localInterp,
- "errorInfo", (char *) NULL, TCL_GLOBAL_ONLY));
- /* errorObjPtr = Tcl_GetObjVar2(localInterp, "errorCode", NULL,
- TCL_GLOBAL_ONLY);
- Tcl_SetObjErrorCode(interp, errorObjPtr); */
- }
- Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
- }
- Tcl_Release((ClientData) riPtr);
- Tcl_Release((ClientData) localInterp);
- } else {
- /*
- * This is a non-local request. Send the script to the server and poll
- * it for a result. TODO!!!
- */
- }
-
-done:
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGetInterpNames --
- *
- * This procedure is invoked to fetch a list of all the
- * interpreter names currently registered for the display
- * of a particular window.
- *
- * Results:
- * A standard Tcl return value. Interp->result will be set
- * to hold a list of all the interpreter names defined for
- * tkwin's display. If an error occurs, then TCL_ERROR
- * is returned and interp->result will hold an error message.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkGetInterpNames(
- Tcl_Interp *interp, /* Interpreter for returning a result. */
- Tk_Window tkwin) /* Window whose display is to be used
- * for the lookup. */
-{
- Tcl_Obj *listObjPtr;
- RegisteredInterp *riPtr;
-
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
- riPtr = interpListPtr;
- while (riPtr != NULL) {
- Tcl_ListObjAppendElement(interp, listObjPtr,
- Tcl_NewStringObj(riPtr->name, -1));
- riPtr = riPtr->nextPtr;
- }
-
- Tcl_SetObjResult(interp, listObjPtr);
- return TCL_OK;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * SendInit --
- *
- * This procedure is called to initialize the
- * communication channels for sending commands and
- * receiving results.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Sets up various data structures and windows.
- *
- *--------------------------------------------------------------
- */
-
-static int
-SendInit(
- Tcl_Interp *interp) /* Interpreter to use for error reporting
- * (no errors are ever returned, but the
- * interpreter is needed anyway). */
-{
- return TCL_OK;
-}
diff --git a/mac/tkMacSubwindows.c b/mac/tkMacSubwindows.c
deleted file mode 100644
index 80bfdaa..0000000
--- a/mac/tkMacSubwindows.c
+++ /dev/null
@@ -1,1256 +0,0 @@
-/*
- * tkMacSubwindows.c --
- *
- * Implements subwindows for the macintosh version of Tk.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkInt.h"
-#include "X.h"
-#include "Xlib.h"
-#include <stdio.h>
-
-#include <Windows.h>
-#include <QDOffscreen.h>
-#include "tkMacInt.h"
-
-/*
- * Temporary region that can be reused.
- */
-static RgnHandle tmpRgn = NULL;
-
-static void UpdateOffsets _ANSI_ARGS_((TkWindow *winPtr, int deltaX, int deltaY));
-
-void tkMacMoveWindow _ANSI_ARGS_((WindowRef window, int x, int y));
-
-/*
- *----------------------------------------------------------------------
- *
- * XDestroyWindow --
- *
- * Dealocates the given X Window.
- *
- * Results:
- * The window id is returned.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XDestroyWindow(
- Display* display, /* Display. */
- Window window) /* Window. */
-{
- MacDrawable *macWin = (MacDrawable *) window;
- GWorldPtr destPort;
-
- /*
- * Remove any dangling pointers that may exist if
- * the window we are deleting is being tracked by
- * the grab code.
- */
-
- TkPointerDeadWindow(macWin->winPtr);
- macWin->toplevel->referenceCount--;
-
-
- if (Tk_IsTopLevel(macWin->winPtr)) {
- DisposeRgn(macWin->clipRgn);
- DisposeRgn(macWin->aboveClipRgn);
-
- /*
- * Delete the Mac window and remove it from the windowTable.
- * The window could be NULL if the window was never mapped.
- * However, we don't do this for embedded windows, they don't
- * go in the window list, and they do not own their portPtr's.
- */
-
- if (!(Tk_IsEmbedded(macWin->winPtr))) {
- destPort = TkMacGetDrawablePort(window);
- if (destPort != NULL) {
- TkMacWindowList *listPtr, *prevPtr;
-
- TkMacUnregisterMacWindow(destPort);
- DisposeWindow((WindowRef) destPort);
-
- for (listPtr = tkMacWindowListPtr, prevPtr = NULL;
- tkMacWindowListPtr != NULL;
- prevPtr = listPtr, listPtr = listPtr->nextPtr) {
- if (listPtr->winPtr == macWin->winPtr) {
- if (prevPtr == NULL) {
- tkMacWindowListPtr = listPtr->nextPtr;
- } else {
- prevPtr->nextPtr = listPtr->nextPtr;
- }
- ckfree((char *) listPtr);
- break;
- }
- }
- }
- }
-
- macWin->portPtr = NULL;
-
- /*
- * Delay deletion of a toplevel data structure untill all
- * children have been deleted.
- */
- if (macWin->toplevel->referenceCount == 0) {
- ckfree((char *) macWin->toplevel);
- }
- } else {
- destPort = TkMacGetDrawablePort(window);
- if (destPort != NULL) {
- SetGWorld(destPort, NULL);
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW);
- }
- if (macWin->winPtr->parentPtr != NULL) {
- TkMacInvalClipRgns(macWin->winPtr->parentPtr);
- }
- DisposeRgn(macWin->clipRgn);
- DisposeRgn(macWin->aboveClipRgn);
-
- if (macWin->toplevel->referenceCount == 0) {
- ckfree((char *) macWin->toplevel);
- }
- ckfree((char *) macWin);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XMapWindow --
- *
- * Map the given X Window to the screen. See X window documentation
- * for more details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The subwindow or toplevel may appear on the screen.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XMapWindow(
- Display* display, /* Display. */
- Window window) /* Window. */
-{
- MacDrawable *macWin = (MacDrawable *) window;
- XEvent event;
- GWorldPtr destPort;
-
- /*
- * Under certain situations it's possible for this function to be
- * called before the toplevel window it's associated with has actually
- * been mapped. In that case we need to create the real Macintosh
- * window now as this function as well as other X functions assume that
- * the portPtr is valid.
- */
- if (!TkMacHostToplevelExists(macWin->toplevel->winPtr)) {
- TkMacMakeRealWindowExist(macWin->toplevel->winPtr);
- }
- destPort = TkMacGetDrawablePort(window);
-
- display->request++;
- macWin->winPtr->flags |= TK_MAPPED;
- if (Tk_IsTopLevel(macWin->winPtr)) {
- if (!Tk_IsEmbedded(macWin->winPtr)) {
- ShowWindow((WindowRef) destPort);
- }
-
- /*
- * We only need to send the MapNotify event
- * for toplevel windows.
- */
- event.xany.serial = display->request;
- event.xany.send_event = False;
- event.xany.display = display;
-
- event.xmap.window = window;
- event.xmap.type = MapNotify;
- event.xmap.event = window;
- event.xmap.override_redirect = macWin->winPtr->atts.override_redirect;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- } else {
- TkMacInvalClipRgns(macWin->winPtr->parentPtr);
- }
-
- /*
- * Generate damage for that area of the window
- */
- SetGWorld(destPort, NULL);
- TkMacUpdateClipRgn(macWin->winPtr);
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XUnmapWindow --
- *
- * Unmap the given X Window to the screen. See X window
- * documentation for more details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The subwindow or toplevel may be removed from the screen.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XUnmapWindow(
- Display* display, /* Display. */
- Window window) /* Window. */
-{
- MacDrawable *macWin = (MacDrawable *) window;
- XEvent event;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(window);
-
- display->request++;
- macWin->winPtr->flags &= ~TK_MAPPED;
- if (Tk_IsTopLevel(macWin->winPtr)) {
- if (!Tk_IsEmbedded(macWin->winPtr)) {
- HideWindow((WindowRef) destPort);
- }
-
- /*
- * We only need to send the UnmapNotify event
- * for toplevel windows.
- */
- event.xany.serial = display->request;
- event.xany.send_event = False;
- event.xany.display = display;
-
- event.xunmap.type = UnmapNotify;
- event.xunmap.window = window;
- event.xunmap.event = window;
- event.xunmap.from_configure = false;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- } else {
- /*
- * Generate damage for that area of the window.
- */
- SetGWorld(destPort, NULL);
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW); /* TODO: may not be valid */
- TkMacInvalClipRgns(macWin->winPtr->parentPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XResizeWindow --
- *
- * Resize a given X window. See X windows documentation for
- * further details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XResizeWindow(
- Display* display, /* Display. */
- Window window, /* Window. */
- unsigned int width,
- unsigned int height)
-{
- MacDrawable *macWin = (MacDrawable *) window;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(window);
- if (destPort == NULL) {
- return;
- }
-
- display->request++;
- SetPort((GrafPtr) destPort);
- if (Tk_IsTopLevel(macWin->winPtr)) {
- if (!Tk_IsEmbedded(macWin->winPtr)) {
- /*
- * NOTE: we are not adding the new space to the update
- * region. It is currently assumed that Tk will need
- * to completely redraw anway.
- */
- SizeWindow((WindowRef) destPort,
- (short) width, (short) height, false);
- TkMacInvalidateWindow(macWin, TK_WINDOW_ONLY);
- TkMacInvalClipRgns(macWin->winPtr);
- } else {
- int deltaX, deltaY;
-
- /*
- * Find the Parent window -
- * For an embedded window this will be its container.
- */
- TkWindow *contWinPtr;
-
- contWinPtr = TkpGetOtherWindow(macWin->winPtr);
-
- if (contWinPtr != NULL) {
- MacDrawable *macParent = contWinPtr->privatePtr;
-
- TkMacInvalClipRgns(macParent->winPtr);
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW);
-
- deltaX = macParent->xOff +
- macWin->winPtr->changes.x - macWin->xOff;
- deltaY = macParent->yOff +
- macWin->winPtr->changes.y - macWin->yOff;
-
- UpdateOffsets(macWin->winPtr, deltaX, deltaY);
- } else {
- /*
- * This is the case where we are embedded in
- * another app. At this point, we are assuming that
- * the changes.x,y is not maintained, if you need
- * the info get it from Tk_GetRootCoords,
- * and that the toplevel sits at 0,0 when it is drawn.
- */
-
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW);
- UpdateOffsets(macWin->winPtr, 0, 0);
- }
-
- }
- } else {
- /* TODO: update all xOff & yOffs */
- int deltaX, deltaY, parentBorderwidth;
- MacDrawable *macParent = macWin->winPtr->parentPtr->privatePtr;
-
- if (macParent == NULL) {
- return; /* TODO: Probably should be a panic */
- }
-
- TkMacInvalClipRgns(macParent->winPtr);
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW);
-
- deltaX = - macWin->xOff;
- deltaY = - macWin->yOff;
-
- parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width;
-
- deltaX += macParent->xOff + parentBorderwidth +
- macWin->winPtr->changes.x;
- deltaY += macParent->yOff + parentBorderwidth +
- macWin->winPtr->changes.y;
-
- UpdateOffsets(macWin->winPtr, deltaX, deltaY);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XMoveResizeWindow --
- *
- * Move or resize a given X window. See X windows documentation
- * for further details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XMoveResizeWindow(
- Display* display, /* Display. */
- Window window, /* Window. */
- int x, int y,
- unsigned int width,
- unsigned int height)
-{
- MacDrawable *macWin = (MacDrawable *) window;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(window);
- if (destPort == NULL) {
- return;
- }
-
- SetPort((GrafPtr) destPort);
- if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
- /*
- * NOTE: we are not adding the new space to the update
- * region. It is currently assumed that Tk will need
- * to completely redraw anway.
- */
-
- SizeWindow((WindowRef) destPort,
- (short) width, (short) height, false);
- tkMacMoveWindow((WindowRef) destPort, x, y);
-
- /* TODO: is the following right? */
- TkMacInvalidateWindow(macWin, TK_WINDOW_ONLY);
- TkMacInvalClipRgns(macWin->winPtr);
- } else {
- int deltaX, deltaY, parentBorderwidth;
- Rect bounds;
- MacDrawable *macParent;
-
- /*
- * Find the Parent window -
- * For an embedded window this will be its container.
- */
-
- if (Tk_IsEmbedded(macWin->winPtr)) {
- TkWindow *contWinPtr;
-
- contWinPtr = TkpGetOtherWindow(macWin->winPtr);
- if (contWinPtr == NULL) {
- panic("XMoveResizeWindow could not find container");
- }
- macParent = contWinPtr->privatePtr;
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
-
- } else {
- macParent = macWin->winPtr->parentPtr->privatePtr;
- if (macParent == NULL) {
- return; /* TODO: Probably should be a panic */
- }
- }
-
- TkMacInvalClipRgns(macParent->winPtr);
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW);
-
- deltaX = - macWin->xOff;
- deltaY = - macWin->yOff;
-
- /*
- * If macWin->winPtr is an embedded window, don't offset by its
- * parent's borderwidth...
- */
-
- if (!Tk_IsEmbedded(macWin->winPtr)) {
- parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width;
- } else {
- parentBorderwidth = 0;
- }
- deltaX += macParent->xOff + parentBorderwidth +
- macWin->winPtr->changes.x;
- deltaY += macParent->yOff + parentBorderwidth +
- macWin->winPtr->changes.y;
-
- UpdateOffsets(macWin->winPtr, deltaX, deltaY);
- TkMacWinBounds(macWin->winPtr, &bounds);
- InvalRect(&bounds);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XMoveWindow --
- *
- * Move a given X window. See X windows documentation for further
- * details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XMoveWindow(
- Display* display, /* Display. */
- Window window, /* Window. */
- int x,
- int y)
-{
- MacDrawable *macWin = (MacDrawable *) window;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(window);
- if (destPort == NULL) {
- return;
- }
-
- SetPort((GrafPtr) destPort);
- if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
- /*
- * NOTE: we are not adding the new space to the update
- * region. It is currently assumed that Tk will need
- * to completely redraw anway.
- */
- tkMacMoveWindow((WindowRef) destPort, x, y);
-
- /* TODO: is the following right? */
- TkMacInvalidateWindow(macWin, TK_WINDOW_ONLY);
- TkMacInvalClipRgns(macWin->winPtr);
- } else {
- int deltaX, deltaY, parentBorderwidth;
- Rect bounds;
- MacDrawable *macParent;
-
- /*
- * Find the Parent window -
- * For an embedded window this will be its container.
- */
-
- if (Tk_IsEmbedded(macWin->winPtr)) {
- TkWindow *contWinPtr;
-
- contWinPtr = TkpGetOtherWindow(macWin->winPtr);
- if (contWinPtr == NULL) {
- panic("XMoveWindow could not find container");
- }
- macParent = contWinPtr->privatePtr;
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- } else {
- macParent = macWin->winPtr->parentPtr->privatePtr;
- if (macParent == NULL) {
- return; /* TODO: Probably should be a panic */
- }
- }
-
- TkMacInvalClipRgns(macParent->winPtr);
- TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW);
-
- deltaX = - macWin->xOff;
- deltaY = - macWin->yOff;
-
- /*
- * If macWin->winPtr is an embedded window, don't offset by its
- * parent's borderwidth...
- */
-
- if (!Tk_IsEmbedded(macWin->winPtr)) {
- parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width;
- } else {
- parentBorderwidth = 0;
- }
- deltaX += macParent->xOff + parentBorderwidth +
- macWin->winPtr->changes.x;
- deltaY += macParent->yOff + parentBorderwidth +
- macWin->winPtr->changes.y;
-
- UpdateOffsets(macWin->winPtr, deltaX, deltaY);
- TkMacWinBounds(macWin->winPtr, &bounds);
- InvalRect(&bounds);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XRaiseWindow --
- *
- * Change the stacking order of a window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Changes the stacking order of the specified window.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XRaiseWindow(
- Display* display, /* Display. */
- Window window) /* Window. */
-{
- MacDrawable *macWin = (MacDrawable *) window;
-
- display->request++;
- if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
- TkWmRestackToplevel(macWin->winPtr, Above, NULL);
- } else {
- /* TODO: this should generate damage */
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XConfigureWindow --
- *
- * Change the size, position, stacking, or border of the specified
- * window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Changes the attributes of the specified window. Note that we
- * ignore the passed in values and use the values stored in the
- * TkWindow data structure.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XConfigureWindow(
- Display* display, /* Display. */
- Window w, /* Window. */
- unsigned int value_mask,
- XWindowChanges* values)
-{
- MacDrawable *macWin = (MacDrawable *) w;
- TkWindow *winPtr = macWin->winPtr;
-
- display->request++;
-
- /*
- * Change the shape and/or position of the window.
- */
-
- if (value_mask & (CWX|CWY|CWWidth|CWHeight)) {
- XMoveResizeWindow(display, w, winPtr->changes.x, winPtr->changes.y,
- winPtr->changes.width, winPtr->changes.height);
- }
-
- /*
- * Change the stacking order of the window. Tk actuall keeps all
- * the information we need for stacking order. All we need to do
- * is make sure the clipping regions get updated and generate damage
- * that will ensure things get drawn correctly.
- */
-
- if (value_mask & CWStackMode) {
- Rect bounds;
- GWorldPtr destPort;
-
- destPort = TkMacGetDrawablePort(w);
- if (destPort != NULL) {
- SetPort((GrafPtr) destPort);
- TkMacInvalClipRgns(winPtr->parentPtr);
- TkMacWinBounds(winPtr, &bounds);
- InvalRect(&bounds);
- }
- }
-
- /* TkGenWMMoveRequestEvent(macWin->winPtr,
- macWin->winPtr->changes.x, macWin->winPtr->changes.y); */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacUpdateClipRgn --
- *
- * This function updates the cliping regions for a given window
- * and all of its children. Once updated the TK_CLIP_INVALID flag
- * in the subwindow data structure is unset. The TK_CLIP_INVALID
- * flag should always be unset before any drawing is attempted.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The clip regions for the window and its children are updated.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacUpdateClipRgn(
- TkWindow *winPtr)
-{
- RgnHandle rgn;
- int x, y;
- TkWindow *win2Ptr;
-
- if (winPtr == NULL) {
- return;
- }
-
- if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {
- rgn = winPtr->privatePtr->aboveClipRgn;
- if (tmpRgn == NULL) {
- tmpRgn = NewRgn();
- }
-
- /*
- * Start with a region defined by the window bounds.
- */
-
- x = winPtr->privatePtr->xOff;
- y = winPtr->privatePtr->yOff;
- SetRectRgn(rgn, (short) x, (short) y,
- (short) (winPtr->changes.width + x),
- (short) (winPtr->changes.height + y));
-
- /*
- * Clip away the area of any windows that may obscure this
- * window.
- * For a non-toplevel window, first, clip to the parents visable
- * clip region.
- * Second, clip away any siblings that are higher in the
- * stacking order.
- * For an embedded toplevel, just clip to the container's visible
- * clip region. Remember, we only allow one contained window
- * in a frame, and don't support any other widgets in the frame either.
- * This is not currently enforced, however.
- */
-
- if (!Tk_TopWinHierarchy(winPtr)) {
- TkMacUpdateClipRgn(winPtr->parentPtr);
- SectRgn(rgn,
- winPtr->parentPtr->privatePtr->aboveClipRgn, rgn);
-
- win2Ptr = winPtr->nextPtr;
- while (win2Ptr != NULL) {
- if (Tk_TopWinHierarchy(win2Ptr) || !Tk_IsMapped(win2Ptr)) {
- win2Ptr = win2Ptr->nextPtr;
- continue;
- }
- x = win2Ptr->privatePtr->xOff;
- y = win2Ptr->privatePtr->yOff;
- SetRectRgn(tmpRgn, (short) x, (short) y,
- (short) (win2Ptr->changes.width + x),
- (short) (win2Ptr->changes.height + y));
- DiffRgn(rgn, tmpRgn, rgn);
-
- win2Ptr = win2Ptr->nextPtr;
- }
- } else if (Tk_IsEmbedded(winPtr)) {
- TkWindow *contWinPtr;
-
- contWinPtr = TkpGetOtherWindow(winPtr);
-
- if (contWinPtr != NULL) {
- TkMacUpdateClipRgn(contWinPtr);
- SectRgn(rgn,
- contWinPtr->privatePtr->aboveClipRgn, rgn);
- } else if (gMacEmbedHandler != NULL) {
- gMacEmbedHandler->getClipProc((Tk_Window) winPtr, tmpRgn);
- SectRgn(rgn, tmpRgn, rgn);
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- }
-
- /*
- * The final clip region is the aboveClip region (or visable
- * region) minus all the children of this window.
- * Alternatively, if the window is a container, we must also
- * subtract the region of the embedded window.
- */
-
- rgn = winPtr->privatePtr->clipRgn;
- CopyRgn(winPtr->privatePtr->aboveClipRgn, rgn);
-
- win2Ptr = winPtr->childList;
- while (win2Ptr != NULL) {
- if (Tk_TopWinHierarchy(win2Ptr) || !Tk_IsMapped(win2Ptr)) {
- win2Ptr = win2Ptr->nextPtr;
- continue;
- }
- x = win2Ptr->privatePtr->xOff;
- y = win2Ptr->privatePtr->yOff;
- SetRectRgn(tmpRgn, (short) x, (short) y,
- (short) (win2Ptr->changes.width + x),
- (short) (win2Ptr->changes.height + y));
- DiffRgn(rgn, tmpRgn, rgn);
-
- win2Ptr = win2Ptr->nextPtr;
- }
-
- if (Tk_IsContainer(winPtr)) {
- win2Ptr = TkpGetOtherWindow(winPtr);
- if (win2Ptr != NULL) {
- if (Tk_IsMapped(win2Ptr)) {
- x = win2Ptr->privatePtr->xOff;
- y = win2Ptr->privatePtr->yOff;
- SetRectRgn(tmpRgn, (short) x, (short) y,
- (short) (win2Ptr->changes.width + x),
- (short) (win2Ptr->changes.height + y));
- DiffRgn(rgn, tmpRgn, rgn);
- }
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- }
-
- winPtr->privatePtr->flags &= ~TK_CLIP_INVALID;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacVisableClipRgn --
- *
- * This function returnd the Macintosh cliping region for the
- * given window. A NULL Rgn means the window is not visable.
- *
- * Results:
- * The region.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-RgnHandle
-TkMacVisableClipRgn(
- TkWindow *winPtr)
-{
- if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {
- TkMacUpdateClipRgn(winPtr);
- }
-
- return winPtr->privatePtr->clipRgn;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacInvalidateWindow --
- *
- * This function makes the window as invalid will generate damage
- * for the window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Damage is created.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacInvalidateWindow(
- MacDrawable *macWin, /* Make window that's causing damage. */
- int flag) /* Should be TK_WINDOW_ONLY or
- * TK_PARENT_WINDOW */
-{
-
- if (flag == TK_WINDOW_ONLY) {
- InvalRgn(macWin->clipRgn);
- } else {
- if (!EmptyRgn(macWin->aboveClipRgn)) {
- InvalRgn(macWin->aboveClipRgn);
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacGetDrawablePort --
- *
- * This function returns the Graphics Port for a given X drawable.
- *
- * Results:
- * A GWorld pointer. Either an off screen pixmap or a Window.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-GWorldPtr
-TkMacGetDrawablePort(
- Drawable drawable)
-{
- MacDrawable *macWin = (MacDrawable *) drawable;
- GWorldPtr resultPort = NULL;
-
- if (macWin == NULL) {
- return NULL;
- }
-
- /*
- * This is NULL for off-screen pixmaps. Then the portPtr
- * always points to the off-screen port, and we don't
- * have to worry about containment
- */
-
- if (macWin->clipRgn == NULL) {
- return macWin->portPtr;
- }
-
- /*
- * If the Drawable is in an embedded window, use the Port of its container.
- *
- * TRICKY POINT: we can have cases when a toplevel is being destroyed
- * where the winPtr for the toplevel has been freed, but the children
- * are not all the way destroyed. The children will call this function
- * as they are being destroyed, but Tk_IsEmbedded will return garbage.
- * So we check the copy of the TK_EMBEDDED flag we put into the
- * toplevel's macWin flags.
- */
-
- if (!(macWin->toplevel->flags & TK_EMBEDDED)) {
- return macWin->toplevel->portPtr;
- } else {
- TkWindow *contWinPtr;
-
- contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
-
- if (contWinPtr != NULL) {
- resultPort = TkMacGetDrawablePort(
- (Drawable) contWinPtr->privatePtr);
- } else if (gMacEmbedHandler != NULL) {
- resultPort = gMacEmbedHandler->getPortProc(
- (Tk_Window) macWin->winPtr);
- }
-
- if (resultPort == NULL) {
- /*
- * FIXME:
- *
- * So far as I can tell, the only time that this happens is when
- * we are tearing down an embedded child interpreter, and most
- * of the time, this is harmless... However, we really need to
- * find why the embedding loses.
- */
- DebugStr("\pTkMacGetDrawablePort couldn't find container");
- return NULL;
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- }
- return resultPort;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacInvalClipRgns --
- *
- * This function invalidates the clipping regions for a given
- * window and all of its children. This function should be
- * called whenever changes are made to subwindows that would
- * effect the size or position of windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The cliping regions for the window and its children are
- * mark invalid. (Make sure they are valid before drawing.)
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacInvalClipRgns(
- TkWindow *winPtr)
-{
- TkWindow *childPtr;
-
- /*
- * If already marked we can stop because all
- * decendants will also already be marked.
- */
- if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {
- return;
- }
-
- winPtr->privatePtr->flags |= TK_CLIP_INVALID;
-
- /*
- * Invalidate clip regions for all children &
- * their decendants - unless the child is a toplevel.
- */
- childPtr = winPtr->childList;
- while (childPtr != NULL) {
- if (!Tk_TopWinHierarchy(childPtr) && Tk_IsMapped(childPtr)) {
- TkMacInvalClipRgns(childPtr);
- }
- childPtr = childPtr->nextPtr;
- }
-
- /*
- * Also, if the window is a container, mark its embedded window
- */
-
- if (Tk_IsContainer(winPtr)) {
- childPtr = TkpGetOtherWindow(winPtr);
-
- if (childPtr != NULL && Tk_IsMapped(childPtr)) {
- TkMacInvalClipRgns(childPtr);
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacWinBounds --
- *
- * Given a Tk window this function determines the windows
- * bounds in relation to the Macintosh window's coordinate
- * system. This is also the same coordinate system as the
- * Tk toplevel window in which this window is contained.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacWinBounds(
- TkWindow *winPtr,
- Rect *bounds)
-{
- bounds->left = (short) winPtr->privatePtr->xOff;
- bounds->top = (short) winPtr->privatePtr->yOff;
- bounds->right = (short) (winPtr->privatePtr->xOff +
- winPtr->changes.width);
- bounds->bottom = (short) (winPtr->privatePtr->yOff +
- winPtr->changes.height);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * tkMacMoveWindow --
- *
- * A replacement for the Macintosh MoveWindow function. This
- * function adjusts the inputs to MoveWindow to offset the root of
- * the window system. This has the effect of making the coords
- * refer to the window dressing rather than the top of the content.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Moves the Macintosh window.
- *
- *----------------------------------------------------------------------
- */
-
-void
-tkMacMoveWindow(
- WindowRef window,
- int x,
- int y)
-{
- int xOffset, yOffset;
-
- if (TkMacHaveAppearance() >= 0x110) {
- MoveWindowStructure((WindowRef) window, (short) x, (short) y);
- } else {
- TkMacWindowOffset(window, &xOffset, &yOffset);
- MoveWindow((WindowRef) window,
- (short) (x + xOffset), (short) (y + yOffset), false);
-}
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * UpdateOffsets --
- *
- * Updates the X & Y offsets of the given TkWindow from the
- * TopLevel it is a decendant of.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The xOff & yOff fields for the Mac window datastructure
- * is updated to the proper offset.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-UpdateOffsets(
- TkWindow *winPtr,
- int deltaX,
- int deltaY)
-{
- TkWindow *childPtr;
-
- if (winPtr->privatePtr == NULL) {
- /*
- * We havn't called Tk_MakeWindowExist for this window yet. The
- * offset information will be postponed and calulated at that
- * time. (This will usually only happen when a mapped parent is
- * being moved but has child windows that have yet to be mapped.)
- */
- return;
- }
-
- winPtr->privatePtr->xOff += deltaX;
- winPtr->privatePtr->yOff += deltaY;
-
- childPtr = winPtr->childList;
- while (childPtr != NULL) {
- if (!Tk_TopWinHierarchy(childPtr)) {
- UpdateOffsets(childPtr, deltaX, deltaY);
- }
- childPtr = childPtr->nextPtr;
- }
-
- if (Tk_IsContainer(winPtr)) {
- childPtr = TkpGetOtherWindow(winPtr);
- if (childPtr != NULL) {
- UpdateOffsets(childPtr,deltaX,deltaY);
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_GetPixmap --
- *
- * Creates an in memory drawing surface.
- *
- * Results:
- * Returns a handle to a new pixmap.
- *
- * Side effects:
- * Allocates a new Macintosh GWorld.
- *
- *----------------------------------------------------------------------
- */
-
-Pixmap
-Tk_GetPixmap(
- Display *display, /* Display for new pixmap (can be null). */
- Drawable d, /* Drawable where pixmap will be used (ignored). */
- int width, /* Dimensions of pixmap. */
- int height,
- int depth) /* Bits per pixel for pixmap. */
-{
- QDErr err;
- GWorldPtr gWorld;
- Rect bounds;
- MacDrawable *macPix;
- PixMapHandle pixels;
-
- if (display != NULL) {
- display->request++;
- }
- macPix = (MacDrawable *) ckalloc(sizeof(MacDrawable));
- macPix->winPtr = NULL;
- macPix->xOff = 0;
- macPix->yOff = 0;
- macPix->clipRgn = NULL;
- macPix->aboveClipRgn = NULL;
- macPix->referenceCount = 0;
- macPix->toplevel = NULL;
- macPix->flags = 0;
-
- bounds.top = bounds.left = 0;
- bounds.right = (short) width;
- bounds.bottom = (short) height;
- if (depth != 1) {
- depth = 0;
- }
-
- /*
- * Allocate memory for the off screen pixmap. If we fail
- * try again from system memory. Eventually, we may have
- * to panic.
- */
- err = NewGWorld(&gWorld, depth, &bounds, NULL, NULL, 0);
- if (err != noErr) {
- err = NewGWorld(&gWorld, depth, &bounds, NULL, NULL, useTempMem);
- }
- if (err != noErr) {
- panic("Out of memory: NewGWorld failed in Tk_GetPixmap");
- }
-
- /*
- * Lock down the pixels so they don't move out from under us.
- */
- pixels = GetGWorldPixMap(gWorld);
- LockPixels(pixels);
- macPix->portPtr = gWorld;
-
- return (Pixmap) macPix;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_FreePixmap --
- *
- * Release the resources associated with a pixmap.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Deletes the Macintosh GWorld created by Tk_GetPixmap.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_FreePixmap(
- Display *display, /* Display. */
- Pixmap pixmap) /* Pixmap to destroy */
-{
- MacDrawable *macPix = (MacDrawable *) pixmap;
- PixMapHandle pixels;
-
- display->request++;
- pixels = GetGWorldPixMap(macPix->portPtr);
- UnlockPixels(pixels);
- DisposeGWorld(macPix->portPtr);
- ckfree((char *) macPix);
-}
-
diff --git a/mac/tkMacTclCode.r b/mac/tkMacTclCode.r
deleted file mode 100644
index 53d427f..0000000
--- a/mac/tkMacTclCode.r
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * tkMacTclCode.r --
- *
- * This file creates resources from the Tcl code that is
- * usually stored in the TCL_LIBRARY
- *
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Types.r>
-#include <SysTypes.r>
-
-#define TK_LIBRARY_RESOURCES 3000
-
-/*
- * The mechanisim below loads Tcl source into the resource fork of the
- * application. The example below creates a TEXT resource named
- * "Init" from the file "init.tcl". This allows applications to use
- * Tcl to define the behavior of the application without having to
- * require some predetermined file structure - all needed Tcl "files"
- * are located within the application. To source a file for the
- * resource fork the source command has been modified to support
- * sourcing from resources. In the below case "source -rsrc {Init}"
- * will load the TEXT resource named "Init".
- */
-
-read 'TEXT' (TK_LIBRARY_RESOURCES+1, "tk", purgeable,preload)
- "::library:tk.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+2, "button", purgeable)
- "::library:button.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+3, "dialog", purgeable)
- "::library:dialog.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+4, "entry", purgeable)
- "::library:entry.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+5, "focus", purgeable)
- "::library:focus.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+6, "listbox", purgeable)
- "::library:listbox.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+7, "menu", purgeable)
- "::library:menu.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+8, "optMenu", purgeable)
- "::library:optMenu.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+9, "palette", purgeable)
- "::library:palette.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+10, "scale", purgeable)
- "::library:scale.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+11, "scrlbar", purgeable)
- "::library:scrlbar.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+12, "tearoff", purgeable)
- "::library:tearoff.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+13, "text", purgeable)
- "::library:text.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+14, "bgerror", purgeable)
- "::library:bgerror.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+15, "console", purgeable)
- "::library:console.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+16, "msgbox", purgeable)
- "::library:msgbox.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+17, "comdlg", purgeable)
- "::library:comdlg.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+18, "spinbox", purgeable)
- "::library:spinbox.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+19, "panedwindow", purgeable)
- "::library:panedwindow.tcl";
-read 'TEXT' (TK_LIBRARY_RESOURCES+20, "msgcat", purgeable)
- ":::tcl:library:msgcat:msgcat.tcl";
diff --git a/mac/tkMacTest.c b/mac/tkMacTest.c
deleted file mode 100644
index 3ee3f11..0000000
--- a/mac/tkMacTest.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * tkMacTest.c --
- *
- * Contains commands for platform specific tests for
- * the Macintosh platform.
- *
- * Copyright (c) 1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Types.h>
-#include <tcl.h>
-
-/*
- * Forward declarations of procedures defined later in this file:
- */
-
-int TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
-static int DebuggerCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-
-/*
- *----------------------------------------------------------------------
- *
- * TkplatformtestInit --
- *
- * Defines commands that test platform specific functionality for
- * Unix platforms.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * Defines new commands.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkplatformtestInit(
- Tcl_Interp *interp) /* Interpreter to add commands to. */
-{
- /*
- * Add commands for platform specific tests on MacOS here.
- */
-
- Tcl_CreateCommand(interp, "debugger", DebuggerCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
-
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DebuggerCmd --
- *
- * This procedure simply calls the low level debugger.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-DebuggerCmd(
- ClientData clientData, /* Not used. */
- Tcl_Interp *interp, /* Not used. */
- int argc, /* Not used. */
- CONST char **argv) /* Not used. */
-{
- Debugger();
- return TCL_OK;
-}
diff --git a/mac/tkMacWindowMgr.c b/mac/tkMacWindowMgr.c
deleted file mode 100644
index 68019c0..0000000
--- a/mac/tkMacWindowMgr.c
+++ /dev/null
@@ -1,1789 +0,0 @@
-/*
- * tkMacWindowMgr.c --
- *
- * Implements common window manager functions for the Macintosh.
- *
- * Copyright (c) 1995-1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Events.h>
-#include <Dialogs.h>
-#include <EPPC.h>
-#include <Windows.h>
-#include <ToolUtils.h>
-#include <DiskInit.h>
-#include <LowMem.h>
-#include <Timer.h>
-#include <Sound.h>
-
-#include "tkInt.h"
-#include "tkPort.h"
-#include "tkMacInt.h"
-
-#define TK_DEFAULT_ABOUT 128
-
-/*
- * Declarations of global variables defined in this file.
- */
-
-int tkMacAppInFront = true; /* Boolean variable for determining
- * if we are the frontmost app. */
-
-/*
- * Non-standard event types that can be passed to HandleEvent.
- * These are defined and used by Netscape's plugin architecture.
- */
-#define getFocusEvent (osEvt + 16)
-#define loseFocusEvent (osEvt + 17)
-#define adjustCursorEvent (osEvt + 18)
-
-/*
- * Declarations of static variables used in this file.
- */
-
-static int gEatButtonUp = 0; /* 1 if we need to eat the next
- * up event */
-static Tk_Window gGrabWinPtr = NULL; /* Current grab window, NULL if no grab. */
-static Tk_Window gKeyboardWinPtr = NULL; /* Current keyboard grab window. */
-static RgnHandle gDamageRgn = NULL; /* Damage region used for handling
- * screen updates. */
-/*
- * Forward declarations of procedures used in this file.
- */
-
-static void BringWindowForward _ANSI_ARGS_((WindowRef wRef));
-static int CheckEventsAvail _ANSI_ARGS_((void));
-static int GenerateActivateEvents _ANSI_ARGS_((EventRecord *eventPtr,
- Window window));
-static int GenerateFocusEvent _ANSI_ARGS_((EventRecord *eventPtr,
- Window window));
-static int GenerateKeyEvent _ANSI_ARGS_((EventRecord *eventPtr,
- Window window, UInt32 savedCode));
-static int GenerateUpdateEvent _ANSI_ARGS_((EventRecord *eventPtr,
- Window window));
-static void GenerateUpdates _ANSI_ARGS_((RgnHandle updateRgn,
- TkWindow *winPtr));
-static int GeneratePollingEvents _ANSI_ARGS_((void));
-static int GeneratePollingEvents2 _ANSI_ARGS_((Window window,
- int adjustCursor));
-static OSErr TellWindowDefProcToCalcRegions _ANSI_ARGS_((WindowRef wRef));
-static int WindowManagerMouse _ANSI_ARGS_((EventRecord *theEvent,
- Window window));
-
-
-/*
- *----------------------------------------------------------------------
- *
- * WindowManagerMouse --
- *
- * This function determines if a button event is a "Window Manager"
- * function or an event that should be passed to Tk's event
- * queue.
- *
- * Results:
- * Return true if event was placed on Tk's event queue.
- *
- * Side effects:
- * Depends on where the button event occurs.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WindowManagerMouse(
- EventRecord *eventPtr, /* Macintosh event record. */
- Window window) /* Window pointer. */
-{
- WindowRef whichWindow, frontWindow, frontNonFloating;
- Tk_Window tkwin;
- Point where, where2;
- int xOffset, yOffset;
- short windowPart;
- TkDisplay *dispPtr;
-
- frontWindow = FrontWindow();
- if (TkMacHaveAppearance() >= 0x110) {
- frontNonFloating = FrontNonFloatingWindow();
- } else {
- frontNonFloating = frontWindow;
- }
-
- /*
- * The window manager only needs to know about mouse down events
- * and sometimes we need to "eat" the mouse up. Otherwise, we
- * just pass the event to Tk.
- */
- if (eventPtr->what == mouseUp) {
- if (gEatButtonUp) {
- gEatButtonUp = false;
- return false;
- }
- return TkGenerateButtonEvent(eventPtr->where.h, eventPtr->where.v,
- window, TkMacButtonKeyState());
- }
-
- windowPart = FindWindow(eventPtr->where, &whichWindow);
- dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
- switch (windowPart) {
- case inSysWindow:
- SystemClick(eventPtr, (GrafPort *) whichWindow);
- return false;
- case inDrag:
- if (!(TkpIsWindowFloating(whichWindow)) && (whichWindow != frontNonFloating)) {
- if (!(eventPtr->modifiers & cmdKey)) {
- if ((gGrabWinPtr != NULL) && (gGrabWinPtr != tkwin)) {
- SysBeep(1);
- return false;
- }
- }
- }
-
- /*
- * Call DragWindow to move the window around. It will
- * also eat the mouse up event.
- */
- SetPort((GrafPort *) whichWindow);
- where.h = where.v = 0;
- LocalToGlobal(&where);
- DragWindow(whichWindow, eventPtr->where,
- &tcl_macQdPtr->screenBits.bounds);
- gEatButtonUp = false;
-
- where2.h = where2.v = 0;
- LocalToGlobal(&where2);
- if (EqualPt(where, where2)) {
- return false;
- }
-
- TkMacWindowOffset(whichWindow, &xOffset, &yOffset);
- where2.h -= xOffset;
- where2.v -= yOffset;
- TkGenWMConfigureEvent(tkwin, where2.h, where2.v,
- -1, -1, TK_LOCATION_CHANGED);
- return true;
- case inGrow:
- case inContent:
- if (!(TkpIsWindowFloating(whichWindow))
- && (whichWindow != frontNonFloating)) {
- /*
- * This click moves the window forward. We don't want
- * the corasponding mouse-up to be reported to the application
- * or else it will mess up some Tk scripts.
- */
- if ((gGrabWinPtr != NULL) && (gGrabWinPtr != tkwin)) {
- SysBeep(1);
- return false;
- }
- gEatButtonUp = true;
- SetPort((GrafPort *) whichWindow);
- BringWindowForward(whichWindow);
- return false;
- } else {
- /*
- * Generally the content region is the domain of Tk
- * sub-windows. However, one exception is the grow
- * region. A button down in this area will be handled
- * by the window manager. Note: this means that Tk
- * may not get button down events in this area!
- */
-
- if (TkMacGrowToplevel(whichWindow, eventPtr->where) == true) {
- return true;
- } else {
- return TkGenerateButtonEvent(eventPtr->where.h,
- eventPtr->where.v, window, TkMacButtonKeyState());
- }
- }
- case inGoAway:
- if (TrackGoAway( whichWindow, eventPtr->where)) {
- if (tkwin == NULL) {
- return false;
- }
- TkGenWMDestroyEvent(tkwin);
- return true;
- }
- return false;
- case inMenuBar:
- {
- int oldMode;
- KeyMap theKeys;
-
- GetKeys(theKeys);
- oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- TkMacClearMenubarActive();
- /*
- * Handle -postcommand
- */
- TkMacPreprocessMenu();
- TkMacHandleMenuSelect(MenuSelect(eventPtr->where),
- theKeys[1] & 4);
- Tcl_SetServiceMode(oldMode);
- return true; /* TODO: may not be on event on queue. */
- }
- case inZoomIn:
- case inZoomOut:
- if (TkMacZoomToplevel(whichWindow, eventPtr->where, windowPart)
- == true) {
- return true;
- } else {
- return false;
- }
- default:
- return false;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkAboutDlg --
- *
- * Displays the default Tk About box. This code uses Macintosh
- * resources to define the content of the About Box.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkAboutDlg()
-{
- DialogPtr aboutDlog;
- short itemHit = -9;
-
- aboutDlog = GetNewDialog(128, NULL, (void*)(-1));
-
- if (!aboutDlog) {
- return;
- }
-
- SelectWindow((WindowRef) aboutDlog);
-
- while (itemHit != 1) {
- ModalDialog( NULL, &itemHit);
- }
- DisposeDialog(aboutDlog);
- aboutDlog = NULL;
-
- if (TkMacHaveAppearance() >= 0x110) {
- SelectWindow(FrontNonFloatingWindow());
- } else {
- SelectWindow(FrontWindow());
- }
-
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateUpdateEvent --
- *
- * Given a Macintosh update event this function generates all the
- * X update events needed by Tk.
- *
- * Results:
- * True if event(s) are generated - false otherwise.
- *
- * Side effects:
- * Additional events may be place on the Tk event queue.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GenerateUpdateEvent(
- EventRecord *eventPtr, /* Incoming Mac event */
- Window window) /* Root X window for event. */
-{
- WindowRef macWindow;
- register TkWindow *winPtr;
- TkDisplay *dispPtr;
-
- dispPtr = TkGetDisplayList();
- winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
-
- if (winPtr == NULL) {
- return false;
- }
-
- if (gDamageRgn == NULL) {
- gDamageRgn = NewRgn();
- }
-
- /*
- * After the call to BeginUpdate the visable region (visRgn) of the
- * window is equal to the intersection of the real visable region and
- * the update region for this event. We use this region in all of our
- * calculations.
- */
-
- if (eventPtr->message != NULL) {
- macWindow = (WindowRef) TkMacGetDrawablePort(window);
- BeginUpdate(macWindow);
- GenerateUpdates(macWindow->visRgn, winPtr);
- EndUpdate(macWindow);
- return true;
- } else {
- /*
- * This event didn't come from the system. This might
- * occur if we are running from inside of Netscape.
- * In this we shouldn't call BeginUpdate as the vis region
- * may be NULL.
- */
- RgnHandle rgn;
- Rect bounds;
-
- rgn = NewRgn();
- TkMacWinBounds(winPtr, &bounds);
- RectRgn(rgn, &bounds);
- GenerateUpdates(rgn, winPtr);
- DisposeRgn(rgn);
- return true;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateUpdates --
- *
- * Given a Macintosh update region and a Tk window this function
- * geneates a X damage event for the window if it is within the
- * update region. The function will then recursivly have each
- * damaged window generate damage events for its child windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Additional events may be place on the Tk event queue.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-GenerateUpdates(
- RgnHandle updateRgn,
- TkWindow *winPtr)
-{
- TkWindow *childPtr;
- XEvent event;
- Rect bounds;
-
- TkMacWinBounds(winPtr, &bounds);
-
- if (bounds.top > (*updateRgn)->rgnBBox.bottom ||
- (*updateRgn)->rgnBBox.top > bounds.bottom ||
- bounds.left > (*updateRgn)->rgnBBox.right ||
- (*updateRgn)->rgnBBox.left > bounds.right ||
- !RectInRgn(&bounds, updateRgn)) {
- return;
- }
-
- event.xany.serial = Tk_Display(winPtr)->request;
- event.xany.send_event = false;
- event.xany.window = Tk_WindowId(winPtr);
- event.xany.display = Tk_Display(winPtr);
-
- event.type = Expose;
-
- /*
- * Compute the bounding box of the area that the damage occured in.
- */
-
- /*
- * CopyRgn(TkMacVisableClipRgn(winPtr), rgn);
- * TODO: this call doesn't work doing resizes!!!
- */
- RectRgn(gDamageRgn, &bounds);
- SectRgn(gDamageRgn, updateRgn, gDamageRgn);
- OffsetRgn(gDamageRgn, -bounds.left, -bounds.top);
- event.xexpose.x = (**gDamageRgn).rgnBBox.left;
- event.xexpose.y = (**gDamageRgn).rgnBBox.top;
- event.xexpose.width = (**gDamageRgn).rgnBBox.right -
- (**gDamageRgn).rgnBBox.left;
- event.xexpose.height = (**gDamageRgn).rgnBBox.bottom -
- (**gDamageRgn).rgnBBox.top;
- event.xexpose.count = 0;
-
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
- /*
- * Generate updates for the children of this window
- */
-
- for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
- if (!Tk_IsMapped(childPtr) || Tk_TopWinHierarchy(childPtr)) {
- continue;
- }
-
- GenerateUpdates(updateRgn, childPtr);
- }
-
- /*
- * Generate updates for any contained windows
- */
-
- if (Tk_IsContainer(winPtr)) {
- childPtr = TkpGetOtherWindow(winPtr);
- if (childPtr != NULL && Tk_IsMapped(childPtr)) {
- GenerateUpdates(updateRgn, childPtr);
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- }
-
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGenerateButtonEvent --
- *
- * Given a global x & y position and the button key status this
- * procedure generates the appropiate X button event. It also
- * handles the state changes needed to implement implicit grabs.
- *
- * Results:
- * True if event(s) are generated - false otherwise.
- *
- * Side effects:
- * Additional events may be place on the Tk event queue.
- * Grab state may also change.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkGenerateButtonEvent(
- int x, /* X location of mouse */
- int y, /* Y location of mouse */
- Window window, /* X Window containing button event. */
- unsigned int state) /* Button Key state suitable for X event */
-{
- WindowRef whichWin, frontWin;
- Point where;
- Tk_Window tkwin;
- int dummy;
- TkDisplay *dispPtr;
-
- /*
- * ButtonDown events will always occur in the front
- * window. ButtonUp events, however, may occur anywhere
- * on the screen. ButtonUp events should only be sent
- * to Tk if in the front window or during an implicit grab.
- */
- where.h = x;
- where.v = y;
- FindWindow(where, &whichWin);
- if (TkMacHaveAppearance() >= 0x110) {
- frontWin = FrontNonFloatingWindow();
- } else {
- frontWin = FrontWindow();
- }
-
- if ((frontWin == NULL) || ((!(TkpIsWindowFloating(whichWin)) && (frontWin != whichWin))
- && gGrabWinPtr == NULL)) {
- return false;
- }
-
- dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
-
- GlobalToLocal(&where);
- if (tkwin != NULL) {
- tkwin = Tk_TopCoordsToWindow(tkwin, where.h, where.v, &dummy, &dummy);
- }
-
- Tk_UpdatePointer(tkwin, x, y, state);
-
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateActivateEvents --
- *
- * Generate Activate/Deactivate events from a Macintosh Activate
- * event. Note, the activate-on-foreground bit must be set in the
- * SIZE flags to ensure we get Activate/Deactivate in addition to
- * Susspend/Resume events.
- *
- * Results:
- * Returns true if events were generate.
- *
- * Side effects:
- * Queue events on Tk's event queue.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GenerateActivateEvents(
- EventRecord *eventPtr, /* Incoming Mac event */
- Window window) /* Root X window for event. */
-{
- TkWindow *winPtr;
- TkDisplay *dispPtr;
-
- dispPtr = TkGetDisplayList();
- winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
- if (winPtr == NULL || winPtr->window == None) {
- return false;
- }
-
- TkGenerateActivateEvents(winPtr,
- (eventPtr->modifiers & activeFlag) ? 1 : 0);
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XSetInputFocus --
- *
- * Change the focus window for the application.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XSetInputFocus(
- Display* display,
- Window focus,
- int revert_to,
- Time time)
-{
- /*
- * Don't need to do a thing. Tk manages the focus for us.
- */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpChangeFocus --
- *
- * This procedure is a stub on the Mac because we always own the
- * focus if we are a front most application.
- *
- * Results:
- * The return value is the serial number of the command that
- * changed the focus. It may be needed by the caller to filter
- * out focus change events that were queued before the command.
- * If the procedure doesn't actually change the focus then
- * it returns 0.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpChangeFocus(winPtr, force)
- TkWindow *winPtr; /* Window that is to receive the X focus. */
- int force; /* Non-zero means claim the focus even
- * if it didn't originally belong to
- * topLevelPtr's application. */
-{
- /*
- * We don't really need to do anything on the Mac. Tk will
- * keep all this state for us.
- */
-
- if (winPtr->atts.override_redirect) {
- return 0;
- }
-
- /*
- * Remember the current serial number for the X server and issue
- * a dummy server request. This marks the position at which we
- * changed the focus, so we can distinguish FocusIn and FocusOut
- * events on either side of the mark.
- */
-
- return NextRequest(winPtr->display);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateFocusEvent --
- *
- * Generate FocusIn/FocusOut events from a Macintosh Activate
- * event. Note, the activate-on-foreground bit must be set in
- * the SIZE flags to ensure we get Activate/Deactivate in addition
- * to Susspend/Resume events.
- *
- * Results:
- * Returns true if events were generate.
- *
- * Side effects:
- * Queue events on Tk's event queue.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GenerateFocusEvent(
- EventRecord *eventPtr, /* Incoming Mac event */
- Window window) /* Root X window for event. */
-{
- XEvent event;
- Tk_Window tkwin;
- TkDisplay *dispPtr;
-
- dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
- if (tkwin == NULL) {
- return false;
- }
-
- /*
- * Generate FocusIn and FocusOut events. This event
- * is only sent to the toplevel window.
- */
-
- if (eventPtr->modifiers & activeFlag) {
- event.xany.type = FocusIn;
- } else {
- event.xany.type = FocusOut;
- }
-
- event.xany.serial = dispPtr->display->request;
- event.xany.send_event = False;
- event.xfocus.display = dispPtr->display;
- event.xfocus.window = window;
- event.xfocus.mode = NotifyNormal;
- event.xfocus.detail = NotifyDetailNone;
-
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateKeyEvent --
- *
- * Given Macintosh keyUp, keyDown & autoKey events this function
- * generates the appropiate X key events. The window that is passed
- * should represent the frontmost window - which will recieve the
- * event.
- *
- * Results:
- * True if event(s) are generated - false otherwise.
- *
- * Side effects:
- * Additional events may be place on the Tk event queue.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GenerateKeyEvent(
- EventRecord *eventPtr, /* Incoming Mac event */
- Window window, /* Root X window for event. */
- UInt32 savedKeyCode) /* If non-zero, this is a lead byte which
- * should be combined with the character
- * in this event to form one multi-byte
- * character. */
-{
- Point where;
- Tk_Window tkwin;
- XEvent event;
- unsigned char byte;
- char buf[16];
- TkDisplay *dispPtr;
-
- /*
- * The focus must be in the FrontWindow on the Macintosh.
- * We then query Tk to determine the exact Tk window
- * that owns the focus.
- */
-
- dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
-
- if (tkwin == NULL) {
- return false;
- }
- tkwin = (Tk_Window) ((TkWindow *) tkwin)->dispPtr->focusPtr;
- if (tkwin == NULL) {
- return false;
- }
- byte = (unsigned char) (eventPtr->message & charCodeMask);
- if ((savedKeyCode == 0) &&
- (Tcl_ExternalToUtf(NULL, NULL, (char *) &byte, 1, 0, NULL,
- buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK)) {
- /*
- * This event specifies a lead byte. Wait for the second byte
- * to come in before sending the XEvent.
- */
-
- return false;
- }
-
- where.v = eventPtr->where.v;
- where.h = eventPtr->where.h;
-
- event.xany.send_event = False;
- event.xkey.same_screen = true;
- event.xkey.subwindow = None;
- event.xkey.time = TkpGetMS();
-
- event.xkey.x_root = where.h;
- event.xkey.y_root = where.v;
- GlobalToLocal(&where);
- Tk_TopCoordsToWindow(tkwin, where.h, where.v,
- &event.xkey.x, &event.xkey.y);
-
- event.xkey.keycode = byte |
- ((savedKeyCode & charCodeMask) << 8) |
- ((eventPtr->message & keyCodeMask) << 8);
-
- event.xany.serial = Tk_Display(tkwin)->request;
- event.xkey.window = Tk_WindowId(tkwin);
- event.xkey.display = Tk_Display(tkwin);
- event.xkey.root = XRootWindow(Tk_Display(tkwin), 0);
- event.xkey.state = TkMacButtonKeyState();
-
- if (eventPtr->what == keyDown) {
- event.xany.type = KeyPress;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- } else if (eventPtr->what == keyUp) {
- event.xany.type = KeyRelease;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- } else {
- /*
- * Autokey events send multiple XKey events.
- *
- * Note: the last KeyRelease will always be missed with
- * this scheme. However, most Tk scripts don't look for
- * KeyUp events so we should be OK.
- */
- event.xany.type = KeyRelease;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.xany.type = KeyPress;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- }
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GeneratePollingEvents --
- *
- * This function polls the mouse position and generates X Motion,
- * Enter & Leave events. The cursor is also updated at this
- * time.
- *
- * Results:
- * True if event(s) are generated - false otherwise.
- *
- * Side effects:
- * Additional events may be place on the Tk event queue.
- * The cursor may be changed.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GeneratePollingEvents()
-{
- Tk_Window tkwin, rootwin;
- Window window;
- WindowRef whichWindow, frontWin, frontNonFloating;
- Point whereLocal, whereGlobal;
- Boolean inContentRgn;
- short part;
- int local_x, local_y;
- int generatedEvents = false;
- TkDisplay *dispPtr;
-
- /*
- * First we get the current mouse position and determine
- * what Tk window the mouse is over (if any).
- */
- frontWin = FrontWindow();
- if (frontWin == NULL) {
- return false;
- }
- SetPort((GrafPort *) frontWin);
-
- GetMouse(&whereLocal);
- whereGlobal = whereLocal;
- LocalToGlobal(&whereGlobal);
-
- part = FindWindow(whereGlobal, &whichWindow);
- inContentRgn = (part == inContent || part == inGrow);
-
- if (TkMacHaveAppearance() >= 0x110) {
- /*
- * If the mouse is over the front non-floating window, then we
- * need to set the local coordinates relative to that window
- * rather than a possibly floating window above it.
- */
-
- frontNonFloating = FrontNonFloatingWindow();
- if (whichWindow == frontNonFloating
- && (whichWindow != frontWin)) {
- SetPort((GrafPort *) frontNonFloating);
- whereLocal = whereGlobal;
- GlobalToLocal(&whereLocal);
- }
- } else {
- frontNonFloating = frontWin;
- }
-
- if ((!TkpIsWindowFloating(whichWindow) && (frontNonFloating != whichWindow)) || !inContentRgn) {
- tkwin = NULL;
- } else {
- window = TkMacGetXWindow(whichWindow);
- dispPtr = TkGetDisplayList();
- rootwin = Tk_IdToWindow(dispPtr->display, window);
- if (rootwin == NULL) {
- tkwin = NULL;
- } else {
- tkwin = Tk_TopCoordsToWindow(rootwin, whereLocal.h, whereLocal.v,
- &local_x, &local_y);
- }
- }
-
- /*
- * The following call will generate the appropiate X events and
- * adjust any state that Tk must remember.
- */
-
- if ((tkwin == NULL) && (gGrabWinPtr != NULL)) {
- tkwin = gGrabWinPtr;
- }
- Tk_UpdatePointer(tkwin, whereGlobal.h, whereGlobal.v,
- TkMacButtonKeyState());
-
- /*
- * Finally, we make sure the proper cursor is installed. The installation
- * is polled to 1) make our resize hack work, and 2) make sure we have the
- * proper cursor even if someone else changed the cursor out from under
- * us.
- */
- if ((gGrabWinPtr == NULL) && (part == inGrow) &&
- TkMacResizable((TkWindow *) tkwin) &&
- (TkMacGetScrollbarGrowWindow((TkWindow *) tkwin) == NULL)) {
- TkMacInstallCursor(1);
- } else {
- TkMacInstallCursor(0);
- }
-
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * GeneratePollingEvents2 --
- *
- * This function polls the mouse position and generates X Motion,
- * Enter & Leave events. The cursor is also updated at this
- * time. NOTE: this version is for Netscape!!!
- *
- * Results:
- * True if event(s) are generated - false otherwise.
- *
- * Side effects:
- * Additional events may be place on the Tk event queue.
- * The cursor may be changed.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-GeneratePollingEvents2(
- Window window,
- int adjustCursor)
-{
- Tk_Window tkwin, rootwin;
- WindowRef whichwindow, frontWin;
- Point whereLocal, whereGlobal;
- int local_x, local_y;
- int generatedEvents = false;
- Rect bounds;
- TkDisplay *dispPtr;
-
- /*
- * First we get the current mouse position and determine
- * what Tk window the mouse is over (if any).
- */
- frontWin = FrontWindow();
- if (frontWin == NULL) {
- return false;
- }
- SetPort((GrafPort *) frontWin);
-
- GetMouse(&whereLocal);
- whereGlobal = whereLocal;
- LocalToGlobal(&whereGlobal);
-
- /*
- * Determine if we are in a Tk window or not.
- */
- whichwindow = (WindowRef) TkMacGetDrawablePort(window);
- if (whichwindow != frontWin) {
- tkwin = NULL;
- } else {
- dispPtr = TkGetDisplayList();
- rootwin = Tk_IdToWindow(dispPtr->display, window);
- TkMacWinBounds((TkWindow *) rootwin, &bounds);
- if (!PtInRect(whereLocal, &bounds)) {
- tkwin = NULL;
- } else {
- tkwin = Tk_TopCoordsToWindow(rootwin, whereLocal.h, whereLocal.v,
- &local_x, &local_y);
- }
- }
-
-
- /*
- * The following call will generate the appropiate X events and
- * adjust any state that Tk must remember.
- */
-
- if ((tkwin == NULL) && (gGrabWinPtr != NULL)) {
- tkwin = gGrabWinPtr;
- }
- Tk_UpdatePointer(tkwin, whereGlobal.h, whereGlobal.v,
- TkMacButtonKeyState());
-
- /*
- * Finally, we make sure the proper cursor is installed. The installation
- * is polled to 1) make our resize hack work, and 2) make sure we have the
- * proper cursor even if someone else changed the cursor out from under
- * us.
- */
-
- if (adjustCursor) {
- TkMacInstallCursor(0);
- }
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacButtonKeyState --
- *
- * Returns the current state of the button & modifier keys.
- *
- * Results:
- * A bitwise inclusive OR of a subset of the following:
- * Button1Mask, ShiftMask, LockMask, ControlMask, Mod?Mask,
- * Mod?Mask.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-unsigned int
-TkMacButtonKeyState()
-{
- unsigned int state = 0;
- KeyMap theKeys;
-
- if (Button() & !gEatButtonUp) {
- state |= Button1Mask;
- }
-
- GetKeys(theKeys);
-
- if (theKeys[1] & 2) {
- state |= LockMask;
- }
-
- if (theKeys[1] & 1) {
- state |= ShiftMask;
- }
-
- if (theKeys[1] & 8) {
- state |= ControlMask;
- }
-
- if (theKeys[1] & 32768) {
- state |= Mod1Mask; /* command key */
- }
-
- if (theKeys[1] & 4) {
- state |= Mod2Mask; /* option key */
- }
-
- return state;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XGrabKeyboard --
- *
- * Simulates a keyboard grab by setting the focus.
- *
- * Results:
- * Always returns GrabSuccess.
- *
- * Side effects:
- * Sets the keyboard focus to the specified window.
- *
- *----------------------------------------------------------------------
- */
-
-int
-XGrabKeyboard(
- Display* display,
- Window grab_window,
- Bool owner_events,
- int pointer_mode,
- int keyboard_mode,
- Time time)
-{
- gKeyboardWinPtr = Tk_IdToWindow(display, grab_window);
- return GrabSuccess;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XUngrabKeyboard --
- *
- * Releases the simulated keyboard grab.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Sets the keyboard focus back to the value before the grab.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XUngrabKeyboard(
- Display* display,
- Time time)
-{
- gKeyboardWinPtr = NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XQueryPointer --
- *
- * Check the current state of the mouse. This is not a complete
- * implementation of this function. It only computes the root
- * coordinates and the current mask.
- *
- * Results:
- * Sets root_x_return, root_y_return, and mask_return. Returns
- * true on success.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Bool
-XQueryPointer(
- Display* display,
- Window w,
- Window* root_return,
- Window* child_return,
- int* root_x_return,
- int* root_y_return,
- int* win_x_return,
- int* win_y_return,
- unsigned int* mask_return)
-{
- Point where;
-
- GetMouse(&where);
- LocalToGlobal(&where);
- *root_x_return = where.h;
- *root_y_return = where.v;
- *mask_return = TkMacButtonKeyState();
- return True;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacGenerateTime --
- *
- * Returns the total number of ticks from startup This function
- * is used to generate the time of generated X events.
- *
- * Results:
- * Returns the current time (ticks from startup).
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Time
-TkMacGenerateTime()
-{
- return (Time) LMGetTicks();
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacConvertEvent --
- *
- * This function converts a Macintosh event into zero or more
- * Tcl events.
- *
- * Results:
- * Returns 1 if event added to Tcl queue, 0 otherwse.
- *
- * Side effects:
- * May add events to Tcl's event queue.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacConvertEvent(
- EventRecord *eventPtr)
-{
- WindowRef whichWindow;
- Window window;
- int eventFound = false;
- static UInt32 savedKeyCode;
-
- switch (eventPtr->what) {
- case nullEvent:
- case adjustCursorEvent:
- if (GeneratePollingEvents()) {
- eventFound = true;
- }
- break;
- case updateEvt:
- whichWindow = (WindowRef)eventPtr->message;
- window = TkMacGetXWindow(whichWindow);
- if (GenerateUpdateEvent(eventPtr, window)) {
- eventFound = true;
- }
- break;
- case mouseDown:
- case mouseUp:
- FindWindow(eventPtr->where, &whichWindow);
- window = TkMacGetXWindow(whichWindow);
- if (WindowManagerMouse(eventPtr, window)) {
- eventFound = true;
- }
- break;
- case autoKey:
- case keyDown:
- /*
- * Handle menu-key events here. If it is *not*
- * a menu key - just fall through to handle as a
- * normal key event.
- */
- if ((eventPtr->modifiers & cmdKey) == cmdKey) {
- long menuResult;
- int oldMode;
-
- oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- menuResult = MenuKey(eventPtr->message & charCodeMask);
- Tcl_SetServiceMode(oldMode);
-
- if (HiWord(menuResult) != 0) {
- TkMacHandleMenuSelect(menuResult, false);
- break;
- }
- }
- /* fall through */
-
- case keyUp:
- if (TkMacHaveAppearance() >= 0x110) {
- whichWindow = FrontNonFloatingWindow();
- } else {
- whichWindow = FrontWindow();
- }
- if (whichWindow == NULL) {
- /*
- * This happens if we get a key event before Tk has had a
- * chance to actually create and realize ".", if they type
- * when "." is withdrawn(!), or between the time "." is
- * destroyed and the app exits.
- */
-
- return false;
- }
- window = TkMacGetXWindow(whichWindow);
- if (GenerateKeyEvent(eventPtr, window, savedKeyCode) == 0) {
- savedKeyCode = eventPtr->message;
- return false;
- }
- eventFound = true;
- break;
-
- case activateEvt:
- window = TkMacGetXWindow((WindowRef) eventPtr->message);
- eventFound |= GenerateActivateEvents(eventPtr, window);
- eventFound |= GenerateFocusEvent(eventPtr, window);
- break;
- case getFocusEvent:
- eventPtr->modifiers |= activeFlag;
- window = TkMacGetXWindow((WindowRef) eventPtr->message);
- eventFound |= GenerateFocusEvent(eventPtr, window);
- break;
- case loseFocusEvent:
- eventPtr->modifiers &= ~activeFlag;
- window = TkMacGetXWindow((WindowRef) eventPtr->message);
- eventFound |= GenerateFocusEvent(eventPtr, window);
- break;
- case kHighLevelEvent:
- TkMacDoHLEvent(eventPtr);
- /* TODO: should return true if events were placed on event queue. */
- break;
- case osEvt:
- /*
- * Do clipboard conversion.
- */
- switch ((eventPtr->message & osEvtMessageMask) >> 24) {
- case mouseMovedMessage:
- if (GeneratePollingEvents()) {
- eventFound = true;
- }
- break;
- case suspendResumeMessage:
- if (!(eventPtr->message & resumeFlag)) {
- TkSuspendClipboard();
- }
- tkMacAppInFront = (eventPtr->message & resumeFlag);
- if (TkMacHaveAppearance() >= 0x110) {
- if (tkMacAppInFront) {
- ShowFloatingWindows();
- } else {
- HideFloatingWindows();
- }
- }
- break;
- }
- break;
- case diskEvt:
- /*
- * Disk insertion.
- */
- if (HiWord(eventPtr->message) != noErr) {
- Point pt;
-
- DILoad();
- pt.v = pt.h = 120; /* parameter ignored in sys 7 */
- DIBadMount(pt, eventPtr->message);
- DIUnload();
- }
- break;
- }
-
- savedKeyCode = 0;
- return eventFound;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacConvertTkEvent --
- *
- * This function converts a Macintosh event into zero or more
- * Tcl events. It is intended for use in Netscape-style embedding.
- *
- * Results:
- * Returns 1 if event added to Tcl queue, 0 otherwse.
- *
- * Side effects:
- * May add events to Tcl's event queue.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacConvertTkEvent(
- EventRecord *eventPtr,
- Window window)
-{
- int eventFound = false;
- Point where;
- static UInt32 savedKeyCode;
-
- /*
- * By default, assume it is legal for us to set the cursor
- */
-
- Tk_MacTkOwnsCursor(1);
-
- switch (eventPtr->what) {
- case nullEvent:
- /*
- * We get NULL events only when the cursor is NOT over
- * the plugin. Otherwise we get updateCursor events.
- * We will not generate polling events or move the cursor
- * in this case.
- */
-
- eventFound = false;
- break;
- case adjustCursorEvent:
- if (GeneratePollingEvents2(window, 1)) {
- eventFound = true;
- }
- break;
- case updateEvt:
- /*
- * It is possibly not legal for us to set the cursor
- */
-
- Tk_MacTkOwnsCursor(0);
- if (GenerateUpdateEvent(eventPtr, window)) {
- eventFound = true;
- }
- break;
- case mouseDown:
- case mouseUp:
- GetMouse(&where);
- LocalToGlobal(&where);
- eventFound |= TkGenerateButtonEvent(where.h, where.v,
- window, TkMacButtonKeyState());
- break;
- case autoKey:
- case keyDown:
- /*
- * Handle menu-key events here. If it is *not*
- * a menu key - just fall through to handle as a
- * normal key event.
- */
- if ((eventPtr->modifiers & cmdKey) == cmdKey) {
- long menuResult = MenuKey(eventPtr->message & charCodeMask);
-
- if (HiWord(menuResult) != 0) {
- TkMacHandleMenuSelect(menuResult, false);
- break;
- }
- }
- /* fall through. */
-
- case keyUp:
- if (GenerateKeyEvent(eventPtr, window, savedKeyCode) == 0) {
- savedKeyCode = eventPtr->message;
- return false;
- }
- eventFound = true;
- break;
-
- case activateEvt:
- /*
- * It is probably not legal for us to set the cursor
- * here, since we don't know where the mouse is in the
- * window that is being activated.
- */
-
- Tk_MacTkOwnsCursor(0);
- eventFound |= GenerateActivateEvents(eventPtr, window);
- eventFound |= GenerateFocusEvent(eventPtr, window);
- break;
- case getFocusEvent:
- eventPtr->modifiers |= activeFlag;
- eventFound |= GenerateFocusEvent(eventPtr, window);
- break;
- case loseFocusEvent:
- eventPtr->modifiers &= ~activeFlag;
- eventFound |= GenerateFocusEvent(eventPtr, window);
- break;
- case kHighLevelEvent:
- TkMacDoHLEvent(eventPtr);
- /* TODO: should return true if events were placed on event queue. */
- break;
- case osEvt:
- /*
- * Do clipboard conversion.
- */
- switch ((eventPtr->message & osEvtMessageMask) >> 24) {
- /*
- * It is possibly not legal for us to set the cursor.
- * Netscape sends us these events all the time...
- */
-
- Tk_MacTkOwnsCursor(0);
-
- case mouseMovedMessage:
- /* if (GeneratePollingEvents2(window, 0)) {
- eventFound = true;
- } NEXT LINE IS TEMPORARY */
- eventFound = false;
- break;
- case suspendResumeMessage:
- if (!(eventPtr->message & resumeFlag)) {
- TkSuspendClipboard();
- }
- tkMacAppInFront = (eventPtr->message & resumeFlag);
- if (TkMacHaveAppearance() >= 0x110) {
- if (tkMacAppInFront) {
- ShowFloatingWindows();
- } else {
- HideFloatingWindows();
- }
- }
- break;
- }
- break;
- case diskEvt:
- /*
- * Disk insertion.
- */
- if (HiWord(eventPtr->message) != noErr) {
- Point pt;
-
- DILoad();
- pt.v = pt.h = 120; /* parameter ignored in sys 7 */
- DIBadMount(pt, eventPtr->message);
- DIUnload();
- }
- break;
- }
- savedKeyCode = 0;
- return eventFound;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * CheckEventsAvail --
- *
- * Checks to see if events are available on the Macintosh queue.
- * This function looks for both queued events (eg. key & button)
- * and generated events (update).
- *
- * Results:
- * True is events exist, false otherwise.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-CheckEventsAvail()
-{
- QHdrPtr evPtr;
- WindowPeek macWinPtr;
-
- evPtr = GetEvQHdr();
- if (evPtr->qHead != NULL) {
- return true;
- }
-
- macWinPtr = (WindowPeek) FrontWindow();
- while (macWinPtr != NULL) {
- if (!EmptyRgn(macWinPtr->updateRgn)) {
- return true;
- }
- macWinPtr = macWinPtr->nextWindow;
- }
- return false;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpSetCapture --
- *
- * This function captures the mouse so that all future events
- * will be reported to this window, even if the mouse is outside
- * the window. If the specified window is NULL, then the mouse
- * is released.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Sets the capture flag and captures the mouse.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpSetCapture(
- TkWindow *winPtr) /* Capture window, or NULL. */
-{
- while ((winPtr != NULL) && !Tk_TopWinHierarchy(winPtr)) {
- winPtr = winPtr->parentPtr;
- }
- gGrabWinPtr = (Tk_Window) winPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacWindowOffset --
- *
- * Determines the x and y offset from the orgin of the toplevel
- * window dressing (the structure region, ie. title bar) and the
- * orgin of the content area.
- *
- * Results:
- * The x & y offset in pixels.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacWindowOffset(
- WindowRef wRef,
- int *xOffset,
- int *yOffset)
-{
- OSErr err = noErr;
- WindowPeek wPeek = (WindowPeek) wRef;
- RgnHandle strucRgn = wPeek->strucRgn;
- RgnHandle contRgn = wPeek->contRgn;
- Rect strucRect, contRect;
-
- if (!EmptyRgn(strucRgn) && !EmptyRgn(contRgn)) {
- strucRect = (**strucRgn).rgnBBox;
- contRect = (**contRgn).rgnBBox;
- } else {
- /*
- * The current window's regions are not up to date.
- * Probably because the window isn't visable. What we
- * will do is save the old regions, have the window calculate
- * what the regions should be, and then restore it self.
- */
- strucRgn = NewRgn( );
- contRgn = NewRgn( );
-
- if (!strucRgn || !contRgn) {
- err = MemError( );
-
- } else if (TkMacHaveAppearance()) {
- GetWindowRegion(wRef, kWindowStructureRgn, strucRgn);
- GetWindowRegion(wRef, kWindowContentRgn, contRgn);
- strucRect = (**strucRgn).rgnBBox;
- contRect = (**contRgn).rgnBBox;
- } else {
- CopyRgn(wPeek->strucRgn, strucRgn);
- CopyRgn(wPeek->contRgn, contRgn);
-
- if (!(err = TellWindowDefProcToCalcRegions(wRef))) {
- strucRect = (**(wPeek->strucRgn)).rgnBBox;
- contRect = (**(wPeek->contRgn)).rgnBBox;
- }
-
- CopyRgn(strucRgn, wPeek->strucRgn);
- CopyRgn(contRgn, wPeek->contRgn);
- }
-
- if (contRgn) {
- DisposeRgn(contRgn);
- }
-
- if (strucRgn) {
- DisposeRgn(strucRgn);
- }
- }
-
- if (!err) {
- *xOffset = contRect.left - strucRect.left;
- *yOffset = contRect.top - strucRect.top;
- } else {
- *xOffset = 0;
- *yOffset = 0;
- }
-
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TellWindowDefProcToCalcRegions --
- *
- * Force a Macintosh window to recalculate it's content and
- * structure regions.
- *
- * Results:
- * An OS error.
- *
- * Side effects:
- * The windows content and structure regions may be updated.
- *
- *----------------------------------------------------------------------
- */
-
-static OSErr
-TellWindowDefProcToCalcRegions(
- WindowRef wRef)
-{
- OSErr err = noErr;
- SInt8 hState;
- Handle wdef = ((WindowPeek) wRef)->windowDefProc;
-
- /*
- * Load and lock the window definition procedure for
- * the window.
- */
- hState = HGetState(wdef);
- if (!(err = MemError())) {
- LoadResource(wdef);
- if (!(err = ResError())) {
- MoveHHi(wdef);
- err = MemError();
- if (err == memLockedErr) {
- err = noErr;
- } else if (!err) {
- HLock(wdef);
- err = MemError();
- }
- }
- }
-
- /*
- * Assuming there are no errors we now call the window definition
- * procedure to tell it to calculate the regions for the window.
- */
- if (err == noErr) {
- (void) CallWindowDefProc((UniversalProcPtr) *wdef,
- GetWVariant(wRef), wRef, wCalcRgns, 0);
-
- HSetState(wdef, hState);
- if (!err) {
- err = MemError();
- }
- }
-
- return err;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * BringWindowForward --
- *
- * Bring this background window to the front. We also set state
- * so Tk thinks the button is currently up.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The window is brought forward.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-BringWindowForward(
- WindowRef wRef)
-{
- if (!TkpIsWindowFloating(wRef)) {
- if ((TkMacHaveAppearance() < 0x110) || IsValidWindowPtr(wRef))
- SelectWindow(wRef);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetMS --
- *
- * Return a relative time in milliseconds. It doesn't matter
- * when the epoch was.
- *
- * Results:
- * Number of milliseconds.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-unsigned long
-TkpGetMS()
-{
- long long * int64Ptr;
- UnsignedWide micros;
-
- Microseconds(&micros);
- int64Ptr = (long long *) &micros;
-
- /*
- * We need 64 bit math to do this. This is available in CW 11
- * and on. Other's will need to use a different scheme.
- */
-
- *int64Ptr /= 1000;
-
- return (long) *int64Ptr;
-}
-/*
- *----------------------------------------------------------------------
- *
- * TkpIsWindowFloating --
- *
- * Returns 1 if a window is floating, 0 otherwise.
- *
- * Results:
- * 1 or 0 depending on window's floating attribute.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpIsWindowFloating(WindowRef wRef)
-{
- WindowClass class;
-
- if (TkMacHaveAppearance() < 0x110) {
- return 0;
- }
-
- GetWindowClass(wRef, &class);
-
- return (class == kFloatingWindowClass);
-
-}
diff --git a/mac/tkMacWm.c b/mac/tkMacWm.c
deleted file mode 100644
index 1af4624..0000000
--- a/mac/tkMacWm.c
+++ /dev/null
@@ -1,5785 +0,0 @@
-/*
- * tkMacWm.c --
- *
- * This module takes care of the interactions between a Tk-based
- * application and the window manager. Among other things, it
- * implements the "wm" command and passes geometry information
- * to the window manager.
- *
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include <Gestalt.h>
-#include <QDOffscreen.h>
-#include <Windows.h>
-#include <ToolUtils.h>
-
-#include <tclMac.h>
-#include "tkPort.h"
-#include "tkInt.h"
-#include "tkMacInt.h"
-#include <errno.h>
-#include "tkScrollbar.h"
-
-/*
- * We now require the Appearance headers. They come with CodeWarrior Pro,
- * and are on the SDK CD. However, we do not require the Appearance
- * extension
- */
-
-#include <Appearance.h>
-
-/*
- * A data structure of the following type holds information for
- * each window manager protocol (such as WM_DELETE_WINDOW) for
- * which a handler (i.e. a Tcl command) has been defined for a
- * particular top-level window.
- */
-
-typedef struct ProtocolHandler {
- Atom protocol; /* Identifies the protocol. */
- struct ProtocolHandler *nextPtr;
- /* Next in list of protocol handlers for
- * the same top-level window, or NULL for
- * end of list. */
- Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[4]; /* Tcl command to invoke when a client
- * message for this protocol arrives.
- * The actual size of the structure varies
- * to accommodate the needs of the actual
- * command. THIS MUST BE THE LAST FIELD OF
- * THE STRUCTURE. */
-} ProtocolHandler;
-
-#define HANDLER_SIZE(cmdLength) \
-((unsigned) (sizeof(ProtocolHandler) - 3 + cmdLength))
-
-/*
- * A data structure of the following type holds window-manager-related
- * information for each top-level window in an application.
- */
-
-typedef struct TkWmInfo {
- TkWindow *winPtr; /* Pointer to main Tk information for
- * this window. */
- Window reparent; /* If the window has been reparented, this
- * gives the ID of the ancestor of the window
- * that is a child of the root window (may
- * not be window's immediate parent). If
- * the window isn't reparented, this has the
- * value None. */
- char *title; /* Title to display in window caption. If
- * NULL, use name of widget. Malloced. */
- char *iconName; /* Name to display in icon. Malloced. */
- Window master; /* Master window for TRANSIENT_FOR property,
- * or None. */
- XWMHints hints; /* Various pieces of information for
- * window manager. */
- char *leaderName; /* Path name of leader of window group
- * (corresponds to hints.window_group).
- * Malloc-ed. Note: this field doesn't
- * get updated if leader is destroyed. */
- char *masterWindowName; /* Path name of window specified as master
- * in "wm transient" command, or NULL.
- * Malloc-ed. Note: this field doesn't
- * get updated if masterWindowName is
- * destroyed. */
- Tk_Window icon; /* Window to use as icon for this window,
- * or NULL. */
- Tk_Window iconFor; /* Window for which this window is icon, or
- * NULL if this isn't an icon for anyone. */
-
- /*
- * Information used to construct an XSizeHints structure for
- * the window manager:
- */
-
- int sizeHintsFlags; /* Flags word for XSizeHints structure.
- * If the PBaseSize flag is set then the
- * window is gridded; otherwise it isn't
- * gridded. */
- int minWidth, minHeight; /* Minimum dimensions of window, in
- * grid units, not pixels. */
- int maxWidth, maxHeight; /* Maximum dimensions of window, in
- * grid units, not pixels. */
- Tk_Window gridWin; /* Identifies the window that controls
- * gridding for this top-level, or NULL if
- * the top-level isn't currently gridded. */
- int widthInc, heightInc; /* Increments for size changes (# pixels
- * per step). */
- struct {
- int x; /* numerator */
- int y; /* denominator */
- } minAspect, maxAspect; /* Min/max aspect ratios for window. */
- int reqGridWidth, reqGridHeight;
- /* The dimensions of the window (in
- * grid units) requested through
- * the geometry manager. */
- int gravity; /* Desired window gravity. */
-
- /*
- * Information used to manage the size and location of a window.
- */
-
- int width, height; /* Desired dimensions of window, specified
- * in grid units. These values are
- * set by the "wm geometry" command and by
- * ConfigureNotify events (for when wm
- * resizes window). -1 means user hasn't
- * requested dimensions. */
- int x, y; /* Desired X and Y coordinates for window.
- * These values are set by "wm geometry",
- * plus by ConfigureNotify events (when wm
- * moves window). These numbers are
- * different than the numbers stored in
- * winPtr->changes because (a) they could be
- * measured from the right or bottom edge
- * of the screen (see WM_NEGATIVE_X and
- * WM_NEGATIVE_Y flags) and (b) if the window
- * has been reparented then they refer to the
- * parent rather than the window itself. */
- int parentWidth, parentHeight;
- /* Width and height of reparent, in pixels
- * *including border*. If window hasn't been
- * reparented then these will be the outer
- * dimensions of the window, including
- * border. */
- int xInParent, yInParent; /* Offset of window within reparent, measured
- * from upper-left outer corner of parent's
- * border to upper-left outer corner of child's
- * border. If not reparented then these are
- * zero. */
- int configWidth, configHeight;
- /* Dimensions passed to last request that we
- * issued to change geometry of window. Used
- * to eliminate redundant resize operations. */
-
- /*
- * Information about the virtual root window for this top-level,
- * if there is one.
- */
-
- Window vRoot; /* Virtual root window for this top-level,
- * or None if there is no virtual root
- * window (i.e. just use the screen's root). */
- int vRootX, vRootY; /* Position of the virtual root inside the
- * root window. If the WM_VROOT_OFFSET_STALE
- * flag is set then this information may be
- * incorrect and needs to be refreshed from
- * the X server. If vRoot is None then these
- * values are both 0. */
- unsigned int vRootWidth, vRootHeight;
- /* Dimensions of the virtual root window.
- * If vRoot is None, gives the dimensions
- * of the containing screen. This information
- * is never stale, even though vRootX and
- * vRootY can be. */
-
- /*
- * List of children of the toplevel which have private colormaps.
- */
-
- TkWindow **cmapList; /* Array of window with private colormaps. */
- int cmapCount; /* Number of windows in array. */
-
- /*
- * Miscellaneous information.
- */
-
- ProtocolHandler *protPtr; /* First in list of protocol handlers for
- * this window (NULL means none). */
- int cmdArgc; /* Number of elements in cmdArgv below. */
- CONST char **cmdArgv; /* Array of strings to store in the
- * WM_COMMAND property. NULL means nothing
- * available. */
- char *clientMachine; /* String to store in WM_CLIENT_MACHINE
- * property, or NULL. */
- int flags; /* Miscellaneous flags, defined below. */
-
- /*
- * Macintosh information.
- */
- int style; /* Native window style. */
- int macClass;
- int attributes;
- TkWindow *scrollWinPtr; /* Ptr to scrollbar handling grow widget. */
-} WmInfo;
-
-
-/*
- * Flag values for WmInfo structures:
- *
- * WM_NEVER_MAPPED - non-zero means window has never been
- * mapped; need to update all info when
- * window is first mapped.
- * WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo
- * has already been scheduled for this
- * window; no need to schedule another one.
- * WM_NEGATIVE_X - non-zero means x-coordinate is measured in
- * pixels from right edge of screen, rather
- * than from left edge.
- * WM_NEGATIVE_Y - non-zero means y-coordinate is measured in
- * pixels up from bottom of screen, rather than
- * down from top.
- * WM_UPDATE_SIZE_HINTS - non-zero means that new size hints need to be
- * propagated to window manager.
- * WM_SYNC_PENDING - set to non-zero while waiting for the window
- * manager to respond to some state change.
- * WM_VROOT_OFFSET_STALE - non-zero means that (x,y) offset information
- * about the virtual root window is stale and
- * needs to be fetched fresh from the X server.
- * WM_ABOUT_TO_MAP - non-zero means that the window is about to
- * be mapped by TkWmMapWindow. This is used
- * by UpdateGeometryInfo to modify its behavior.
- * WM_MOVE_PENDING - non-zero means the application has requested
- * a new position for the window, but it hasn't
- * been reflected through the window manager
- * yet.
- * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were
- * set explicitly via "wm colormapwindows".
- * WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows"
- * was called the top-level itself wasn't
- * specified, so we added it implicitly at
- * the end of the list.
- * WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to
- * allow the user to change the width of the
- * window (controlled by "wm resizable"
- * command).
- * WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to
- * allow the user to change the height of the
- * window (controlled by "wm resizable"
- * command).
- */
-
-#define WM_NEVER_MAPPED 1
-#define WM_UPDATE_PENDING 2
-#define WM_NEGATIVE_X 4
-#define WM_NEGATIVE_Y 8
-#define WM_UPDATE_SIZE_HINTS 0x10
-#define WM_SYNC_PENDING 0x20
-#define WM_VROOT_OFFSET_STALE 0x40
-#define WM_ABOUT_TO_MAP 0x100
-#define WM_MOVE_PENDING 0x200
-#define WM_COLORMAPS_EXPLICIT 0x400
-#define WM_ADDED_TOPLEVEL_COLORMAP 0x800
-#define WM_WIDTH_NOT_RESIZABLE 0x1000
-#define WM_HEIGHT_NOT_RESIZABLE 0x2000
-
-/*
- * This is a list of all of the toplevels that have been mapped so far. It is
- * used by the menu code to inval windows that were damaged by menus, and will
- * eventually also be used to keep track of floating windows.
- */
-
-TkMacWindowList *tkMacWindowListPtr = NULL;
-
-/*
- * The variable below is used to enable or disable tracing in this
- * module. If tracing is enabled, then information is printed on
- * standard output about interesting interactions with the window
- * manager.
- */
-
-static int wmTracing = 0;
-
-/*
- * The following structure is the official type record for geometry
- * management of top-level windows.
- */
-
-static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
- Tk_Window tkwin));
-
-static Tk_GeomMgr wmMgrType = {
- "wm", /* name */
- TopLevelReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
-};
-
-/*
- * Hash table for Mac Window -> TkWindow mapping.
- */
-
-static Tcl_HashTable windowTable;
-static int windowHashInit = false;
-
-void tkMacMoveWindow(WindowRef window, int x, int y);
-
-/*
- * Forward declarations for procedures defined in this file:
- */
-
-static void InitialWindowBounds _ANSI_ARGS_((TkWindow *winPtr,
- Rect *geometry));
-static int ParseGeometry _ANSI_ARGS_((Tcl_Interp *interp,
- char *string, TkWindow *winPtr));
-static void TopLevelEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void TkWmStackorderToplevelWrapperMap _ANSI_ARGS_((
- TkWindow *winPtr,
- Tcl_HashTable *reparentTable));
-static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
- Tk_Window tkwin));
-static void UpdateGeometryInfo _ANSI_ARGS_((
- ClientData clientData));
-static void UpdateSizeHints _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdateVRootGeometry _ANSI_ARGS_((WmInfo *wmPtr));
-static int WmAspectCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmAttributesCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmClientCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmColormapwindowsCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmCommandCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmDeiconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFocusmodelCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFrameCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGeometryCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGridCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGroupCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconbitmapCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconmaskCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconnameCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconpositionCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconwindowCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMaxsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMinsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmOverrideredirectCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmPositionfromCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmProtocolCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmResizableCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmSizefromCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStackorderCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStateCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTitleCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTransientCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr,
- TkWindow *winPtr));
-
-/*
- *--------------------------------------------------------------
- *
- * TkWmNewWindow --
- *
- * This procedure is invoked whenever a new top-level
- * window is created. Its job is to initialize the WmInfo
- * structure for the window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A WmInfo structure gets allocated and initialized.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkWmNewWindow(
- TkWindow *winPtr) /* Newly-created top-level window. */
-{
- register WmInfo *wmPtr;
-
- wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
- wmPtr->winPtr = winPtr;
- wmPtr->reparent = None;
- wmPtr->title = NULL;
- wmPtr->iconName = NULL;
- wmPtr->master = None;
- wmPtr->hints.flags = InputHint | StateHint;
- wmPtr->hints.input = True;
- wmPtr->hints.initial_state = NormalState;
- wmPtr->hints.icon_pixmap = None;
- wmPtr->hints.icon_window = None;
- wmPtr->hints.icon_x = wmPtr->hints.icon_y = 0;
- wmPtr->hints.icon_mask = None;
- wmPtr->hints.window_group = None;
- wmPtr->leaderName = NULL;
- wmPtr->masterWindowName = NULL;
- wmPtr->icon = NULL;
- wmPtr->iconFor = NULL;
- wmPtr->sizeHintsFlags = 0;
- wmPtr->minWidth = wmPtr->minHeight = 1;
-
- /*
- * Default the maximum dimensions to the size of the display, minus
- * a guess about how space is needed for window manager decorations.
- */
-
- wmPtr->maxWidth = DisplayWidth(winPtr->display, winPtr->screenNum) - 15;
- wmPtr->maxHeight = DisplayHeight(winPtr->display, winPtr->screenNum) - 30;
- wmPtr->gridWin = NULL;
- wmPtr->widthInc = wmPtr->heightInc = 1;
- wmPtr->minAspect.x = wmPtr->minAspect.y = 1;
- wmPtr->maxAspect.x = wmPtr->maxAspect.y = 1;
- wmPtr->reqGridWidth = wmPtr->reqGridHeight = -1;
- wmPtr->gravity = NorthWestGravity;
- wmPtr->width = -1;
- wmPtr->height = -1;
- wmPtr->x = winPtr->changes.x;
- wmPtr->y = winPtr->changes.y;
- wmPtr->parentWidth = winPtr->changes.width
- + 2*winPtr->changes.border_width;
- wmPtr->parentHeight = winPtr->changes.height
- + 2*winPtr->changes.border_width;
- wmPtr->xInParent = 0;
- wmPtr->yInParent = 0;
- wmPtr->cmapList = NULL;
- wmPtr->cmapCount = 0;
- wmPtr->configWidth = -1;
- wmPtr->configHeight = -1;
- wmPtr->vRoot = None;
- wmPtr->protPtr = NULL;
- wmPtr->cmdArgv = NULL;
- wmPtr->clientMachine = NULL;
- wmPtr->flags = WM_NEVER_MAPPED;
- if (TkMacHaveAppearance() >= 0x110) {
- wmPtr->style = -1;
- } else {
- wmPtr->style = documentProc;
- }
- wmPtr->macClass = kDocumentWindowClass;
- wmPtr->attributes = kWindowStandardDocumentAttributes;
- wmPtr->scrollWinPtr = NULL;
- winPtr->wmInfoPtr = wmPtr;
-
- UpdateVRootGeometry(wmPtr);
-
- /*
- * Tk must monitor structure events for top-level windows, in order
- * to detect size and position changes caused by window managers.
- */
-
- Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask,
- TopLevelEventProc, (ClientData) winPtr);
-
- /*
- * Arrange for geometry requests to be reflected from the window
- * to the window manager.
- */
-
- Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkWmMapWindow --
- *
- * This procedure is invoked to map a top-level window. This
- * module gets a chance to update all window-manager-related
- * information in properties before the window manager sees
- * the map event and checks the properties. It also gets to
- * decide whether or not to even map the window after all.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Properties of winPtr may get updated to provide up-to-date
- * information to the window manager. The window may also get
- * mapped, but it may not be if this procedure decides that
- * isn't appropriate (e.g. because the window is withdrawn).
- *
- *--------------------------------------------------------------
- */
-
-void
-TkWmMapWindow(
- TkWindow *winPtr) /* Top-level window that's about to
- * be mapped. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- Point where = {0, 0};
- int xOffset, yOffset;
- int firstMap = false;
- MacDrawable *macWin;
-
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- wmPtr->flags &= ~WM_NEVER_MAPPED;
- firstMap = true;
-
- /*
- * Create the underlying Mac window for this Tk window.
- */
- macWin = (MacDrawable *) winPtr->window;
- if (!TkMacHostToplevelExists(winPtr)) {
- TkMacMakeRealWindowExist(winPtr);
- }
-
- /*
- * Generate configure event when we first map the window.
- */
- LocalToGlobal(&where);
- TkMacWindowOffset((WindowRef) TkMacGetDrawablePort((Drawable) macWin),
- &xOffset, &yOffset);
- where.h -= xOffset;
- where.v -= yOffset;
- TkGenWMConfigureEvent((Tk_Window) winPtr,
- where.h, where.v, -1, -1, TK_LOCATION_CHANGED);
-
- /*
- * This is the first time this window has ever been mapped.
- * Store all the window-manager-related information for the
- * window.
- */
-
- if (!Tk_IsEmbedded(winPtr)) {
- TkSetWMName(winPtr, ((wmPtr->title != NULL) ?
- wmPtr->title : winPtr->nameUid));
- }
-
- TkWmSetClass(winPtr);
-
- if (wmPtr->iconName != NULL) {
- XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
- }
-
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- }
- if (wmPtr->hints.initial_state == WithdrawnState) {
- return;
- }
-
- /*
- * TODO: we need to display a window if it's iconic on creation.
- */
-
- if (wmPtr->hints.initial_state == IconicState) {
- return;
- }
-
- /*
- * Update geometry information.
- */
- wmPtr->flags |= WM_ABOUT_TO_MAP;
- if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
- }
- UpdateGeometryInfo((ClientData) winPtr);
- wmPtr->flags &= ~WM_ABOUT_TO_MAP;
-
- /*
- * Map the window.
- */
-
- XMapWindow(winPtr->display, winPtr->window);
-
- /*
- * Now that the window is visable we can determine the offset
- * from the window's content orgin to the window's decorative
- * orgin (structure orgin).
- */
- TkMacWindowOffset((WindowRef) TkMacGetDrawablePort(Tk_WindowId(winPtr)),
- &wmPtr->xInParent, &wmPtr->yInParent);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkWmUnmapWindow --
- *
- * This procedure is invoked to unmap a top-level window.
- * On the Macintosh all we do is call XUnmapWindow.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Unmaps the window.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkWmUnmapWindow(
- TkWindow *winPtr) /* Top-level window that's about to
- * be mapped. */
-{
- XUnmapWindow(winPtr->display, winPtr->window);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkWmDeadWindow --
- *
- * This procedure is invoked when a top-level window is
- * about to be deleted. It cleans up the wm-related data
- * structures for the window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The WmInfo structure for winPtr gets freed up.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkWmDeadWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's being deleted. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- WmInfo *wmPtr2;
-
- if (wmPtr == NULL) {
- return;
- }
- if (wmPtr->title != NULL) {
- ckfree(wmPtr->title);
- }
- if (wmPtr->iconName != NULL) {
- ckfree(wmPtr->iconName);
- }
- if (wmPtr->hints.flags & IconPixmapHint) {
- Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
- }
- if (wmPtr->hints.flags & IconMaskHint) {
- Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask);
- }
- if (wmPtr->leaderName != NULL) {
- ckfree(wmPtr->leaderName);
- }
- if (wmPtr->masterWindowName != NULL) {
- ckfree(wmPtr->masterWindowName);
- }
- if (wmPtr->icon != NULL) {
- wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
- wmPtr2->iconFor = NULL;
- }
- if (wmPtr->iconFor != NULL) {
- wmPtr2 = ((TkWindow *) wmPtr->iconFor)->wmInfoPtr;
- wmPtr2->icon = NULL;
- wmPtr2->hints.flags &= ~IconWindowHint;
- }
- while (wmPtr->protPtr != NULL) {
- ProtocolHandler *protPtr;
-
- protPtr = wmPtr->protPtr;
- wmPtr->protPtr = protPtr->nextPtr;
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
- }
- if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
- }
- if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
- }
- if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
- }
- ckfree((char *) wmPtr);
- winPtr->wmInfoPtr = NULL;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * TkWmSetClass --
- *
- * This procedure is invoked whenever a top-level window's
- * class is changed. If the window has been mapped then this
- * procedure updates the window manager property for the
- * class. If the window hasn't been mapped, the update is
- * deferred until just before the first mapping.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A window property may get updated.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkWmSetClass(
- TkWindow *winPtr) /* Newly-created top-level window. */
-{
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_WmObjCmd --
- *
- * This procedure is invoked to process the "wm" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
- /* ARGSUSED */
-int
-Tk_WmObjCmd(
- ClientData clientData, /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
-{
- Tk_Window tkwin = (Tk_Window) clientData;
- static CONST char *optionStrings[] = {
- "aspect", "attributes", "client", "colormapwindows",
- "command", "deiconify", "focusmodel", "frame",
- "geometry", "grid", "group", "iconbitmap",
- "iconify", "iconmask", "iconname", "iconposition",
- "iconwindow", "maxsize", "minsize", "overrideredirect",
- "positionfrom", "protocol", "resizable", "sizefrom",
- "stackorder", "state", "title", "transient",
- "withdraw", (char *) NULL };
- enum options {
- WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
- WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FRAME,
- WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBITMAP,
- WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME, WMOPT_ICONPOSITION,
- WMOPT_ICONWINDOW, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
- WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
- WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
- WMOPT_WITHDRAW };
- int index, length;
- char *argv1;
- TkWindow *winPtr;
- TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
-
- if (objc < 2) {
- wrongNumArgs:
- Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
- return TCL_ERROR;
- }
-
- argv1 = Tcl_GetStringFromObj(objv[1], &length);
- if ((argv1[0] == 't') && (strncmp(argv1, "tracing", length) == 0)
- && (length >= 3)) {
- if ((objc != 2) && (objc != 3)) {
- Tcl_WrongNumArgs(interp, 2, objv, "?boolean?");
- return TCL_ERROR;
- }
- if (objc == 2) {
- Tcl_SetResult(interp, ((wmTracing) ? "on" : "off"), TCL_STATIC);
- return TCL_OK;
- }
- return Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing);
- }
-
- if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
-
- if (objc < 3) {
- goto wrongNumArgs;
- }
-
- if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr)
- != TCL_OK) {
- return TCL_ERROR;
- }
- if (!Tk_IsTopLevel(winPtr)) {
- Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't a top-level window", (char *) NULL);
- return TCL_ERROR;
- }
-
- switch ((enum options) index) {
- case WMOPT_ASPECT:
- return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ATTRIBUTES:
- return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_CLIENT:
- return WmClientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COLORMAPWINDOWS:
- return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COMMAND:
- return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_DEICONIFY:
- return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FOCUSMODEL:
- return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FRAME:
- return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GEOMETRY:
- return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GRID:
- return WmGridCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GROUP:
- return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONBITMAP:
- return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONIFY:
- return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONMASK:
- return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONNAME:
- return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPOSITION:
- return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONWINDOW:
- return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MAXSIZE:
- return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MINSIZE:
- return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_OVERRIDEREDIRECT:
- return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_POSITIONFROM:
- return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_PROTOCOL:
- return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_RESIZABLE:
- return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_SIZEFROM:
- return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STACKORDER:
- return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STATE:
- return WmStateCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TITLE:
- return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TRANSIENT:
- return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_WITHDRAW:
- return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
- }
-
- /* This should not happen */
- return TCL_ERROR;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmAspectCmd --
- *
- * This procedure is invoked to process the "wm aspect" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmAspectCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int numer1, denom1, numer2, denom2;
-
- if ((objc != 3) && (objc != 7)) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "window ?minNumer minDenom maxNumer maxDenom?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->sizeHintsFlags & PAspect) {
- char buf[TCL_INTEGER_SPACE * 4];
-
- sprintf(buf, "%d %d %d %d", wmPtr->minAspect.x,
- wmPtr->minAspect.y, wmPtr->maxAspect.x,
- wmPtr->maxAspect.y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- }
- return TCL_OK;
- }
- if (*Tcl_GetString(objv[3]) == '\0') {
- wmPtr->sizeHintsFlags &= ~PAspect;
- } else {
- if ((Tcl_GetIntFromObj(interp, objv[3], &numer1) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) {
- return TCL_ERROR;
- }
- if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
- (denom2 <= 0)) {
- Tcl_SetResult(interp, "aspect number can't be <= 0",
- TCL_STATIC);
- return TCL_ERROR;
- }
- wmPtr->minAspect.x = numer1;
- wmPtr->minAspect.y = denom1;
- wmPtr->maxAspect.x = numer2;
- wmPtr->maxAspect.y = denom2;
- wmPtr->sizeHintsFlags |= PAspect;
- }
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmAttributesCmd --
- *
- * This procedure is invoked to process the "wm attributes" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window");
- return TCL_ERROR;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmClientCmd --
- *
- * This procedure is invoked to process the "wm client" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmClientCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
- int length;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->clientMachine != NULL) {
- Tcl_SetResult(interp, wmPtr->clientMachine, TCL_STATIC);
- }
- return TCL_OK;
- }
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- if (argv3[0] == 0) {
- if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
- wmPtr->clientMachine = NULL;
- }
- return TCL_OK;
- }
- if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
- }
- wmPtr->clientMachine = (char *)
- ckalloc((unsigned) (length + 1));
- strcpy(wmPtr->clientMachine, argv3);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmColormapwindowsCmd --
- *
- * This procedure is invoked to process the "wm colormapwindows"
- * Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- TkWindow **cmapList;
- TkWindow *winPtr2;
- int i, windowObjc, gotToplevel = 0;
- Tcl_Obj **windowObjv;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?windowList?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- Tk_MakeWindowExist((Tk_Window) winPtr);
- for (i = 0; i < wmPtr->cmapCount; i++) {
- if ((i == (wmPtr->cmapCount-1))
- && (wmPtr->flags & WM_ADDED_TOPLEVEL_COLORMAP)) {
- break;
- }
- Tcl_AppendElement(interp, wmPtr->cmapList[i]->pathName);
- }
- return TCL_OK;
- }
- if (Tcl_ListObjGetElements(interp, objv[3], &windowObjc, &windowObjv)
- != TCL_OK) {
- return TCL_ERROR;
- }
- cmapList = (TkWindow **) ckalloc((unsigned)
- ((windowObjc+1)*sizeof(TkWindow*)));
- for (i = 0; i < windowObjc; i++) {
- if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
- (Tk_Window *) &winPtr2) != TCL_OK)
- {
- ckfree((char *) cmapList);
- return TCL_ERROR;
- }
- if (winPtr2 == winPtr) {
- gotToplevel = 1;
- }
- if (winPtr2->window == None) {
- Tk_MakeWindowExist((Tk_Window) winPtr2);
- }
- cmapList[i] = winPtr2;
- }
- if (!gotToplevel) {
- wmPtr->flags |= WM_ADDED_TOPLEVEL_COLORMAP;
- cmapList[windowObjc] = winPtr;
- windowObjc++;
- } else {
- wmPtr->flags &= ~WM_ADDED_TOPLEVEL_COLORMAP;
- }
- wmPtr->flags |= WM_COLORMAPS_EXPLICIT;
- if (wmPtr->cmapList != NULL) {
- ckfree((char *)wmPtr->cmapList);
- }
- wmPtr->cmapList = cmapList;
- wmPtr->cmapCount = windowObjc;
-
- /*
- * On the Macintosh all of this is just an excercise
- * in compatability as we don't support colormaps. If
- * we did they would be installed here.
- */
-
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmCommandCmd --
- *
- * This procedure is invoked to process the "wm command" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmCommandCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
- int cmdArgc;
- CONST char **cmdArgv;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->cmdArgv != NULL) {
- Tcl_SetResult(interp,
- Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
- TCL_DYNAMIC);
- }
- return TCL_OK;
- }
- argv3 = Tcl_GetString(objv[3]);
- if (argv3[0] == 0) {
- if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
- wmPtr->cmdArgv = NULL;
- }
- return TCL_OK;
- }
- if (Tcl_SplitList(interp, argv3, &cmdArgc, &cmdArgv) != TCL_OK) {
- return TCL_ERROR;
- }
- if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
- }
- wmPtr->cmdArgc = cmdArgc;
- wmPtr->cmdArgv = cmdArgv;
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmDeiconifyCmd --
- *
- * This procedure is invoked to process the "wm deiconify" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
-
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window");
- return TCL_ERROR;
- }
- if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
- return TCL_ERROR;
- }
- if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
- return TCL_ERROR;
- }
-
- /*
- * TODO: may not want to call this function - look at Map events gened.
- */
-
- TkpWmSetState(winPtr, NormalState);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmFocusmodelCmd --
- *
- * This procedure is invoked to process the "wm focusmodel" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "active", "passive", (char *) NULL };
- enum options {
- OPT_ACTIVE, OPT_PASSIVE };
- int index;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- Tcl_SetResult(interp, (wmPtr->hints.input ? "passive" : "active"),
- TCL_STATIC);
- return TCL_OK;
- }
-
- if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (index == OPT_ACTIVE) {
- wmPtr->hints.input = False;
- } else { /* OPT_PASSIVE */
- wmPtr->hints.input = True;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmFrameCmd --
- *
- * This procedure is invoked to process the "wm frame" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmFrameCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- Window window;
- char buf[TCL_INTEGER_SPACE];
-
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window");
- return TCL_ERROR;
- }
- window = wmPtr->reparent;
- if (window == None) {
- window = Tk_WindowId((Tk_Window) winPtr);
- }
- sprintf(buf, "0x%x", (unsigned int) window);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmGeometryCmd --
- *
- * This procedure is invoked to process the "wm geometry" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char xSign, ySign;
- int width, height;
- char *argv3;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- char buf[16 + TCL_INTEGER_SPACE * 4];
-
- xSign = (wmPtr->flags & WM_NEGATIVE_X) ? '-' : '+';
- ySign = (wmPtr->flags & WM_NEGATIVE_Y) ? '-' : '+';
- if (wmPtr->gridWin != NULL) {
- width = wmPtr->reqGridWidth + (winPtr->changes.width
- - winPtr->reqWidth)/wmPtr->widthInc;
- height = wmPtr->reqGridHeight + (winPtr->changes.height
- - winPtr->reqHeight)/wmPtr->heightInc;
- } else {
- width = winPtr->changes.width;
- height = winPtr->changes.height;
- }
- sprintf(buf, "%dx%d%c%d%c%d", width, height, xSign, wmPtr->x,
- ySign, wmPtr->y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
- }
- argv3 = Tcl_GetString(objv[3]);
- if (*argv3 == '\0') {
- wmPtr->width = -1;
- wmPtr->height = -1;
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
- }
- return ParseGeometry(interp, argv3, winPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmGridCmd --
- *
- * This procedure is invoked to process the "wm grid" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmGridCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int reqWidth, reqHeight, widthInc, heightInc;
-
- if ((objc != 3) && (objc != 7)) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "window ?baseWidth baseHeight widthInc heightInc?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->sizeHintsFlags & PBaseSize) {
- char buf[TCL_INTEGER_SPACE * 4];
-
- sprintf(buf, "%d %d %d %d", wmPtr->reqGridWidth,
- wmPtr->reqGridHeight, wmPtr->widthInc,
- wmPtr->heightInc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- }
- return TCL_OK;
- }
- if (*Tcl_GetString(objv[3]) == '\0') {
- /*
- * Turn off gridding and reset the width and height
- * to make sense as ungridded numbers.
- */
-
- wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
- if (wmPtr->width != -1) {
- wmPtr->width = winPtr->reqWidth + (wmPtr->width
- - wmPtr->reqGridWidth)*wmPtr->widthInc;
- wmPtr->height = winPtr->reqHeight + (wmPtr->height
- - wmPtr->reqGridHeight)*wmPtr->heightInc;
- }
- wmPtr->widthInc = 1;
- wmPtr->heightInc = 1;
- } else {
- if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) != TCL_OK)) {
- return TCL_ERROR;
- }
- if (reqWidth < 0) {
- Tcl_SetResult(interp, "baseWidth can't be < 0", TCL_STATIC);
- return TCL_ERROR;
- }
- if (reqHeight < 0) {
- Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC);
- return TCL_ERROR;
- }
- if (widthInc <= 0) {
- Tcl_SetResult(interp, "widthInc can't be <= 0", TCL_STATIC);
- return TCL_ERROR;
- }
- if (heightInc <= 0) {
- Tcl_SetResult(interp, "heightInc can't be <= 0", TCL_STATIC);
- return TCL_ERROR;
- }
- Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
- heightInc);
- }
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmGroupCmd --
- *
- * This procedure is invoked to process the "wm group" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmGroupCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- Tk_Window tkwin2;
- char *argv3;
- int length;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->hints.flags & WindowGroupHint) {
- Tcl_SetResult(interp, wmPtr->leaderName, TCL_STATIC);
- }
- return TCL_OK;
- }
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- if (*argv3 == '\0') {
- wmPtr->hints.flags &= ~WindowGroupHint;
- if (wmPtr->leaderName != NULL) {
- ckfree(wmPtr->leaderName);
- }
- wmPtr->leaderName = NULL;
- } else {
- if (TkGetWindowFromObj(interp, tkwin, objv[3], &tkwin2) != TCL_OK) {
- return TCL_ERROR;
- }
- Tk_MakeWindowExist(tkwin2);
- if (wmPtr->leaderName != NULL) {
- ckfree(wmPtr->leaderName);
- }
- wmPtr->hints.window_group = Tk_WindowId(tkwin2);
- wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = ckalloc((unsigned) (length + 1));
- strcpy(wmPtr->leaderName, argv3);
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmIconbitmapCmd --
- *
- * This procedure is invoked to process the "wm iconbitmap" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
- Pixmap pixmap;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->hints.flags & IconPixmapHint) {
- Tcl_SetResult(interp, (char *)
- Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_pixmap),
- TCL_STATIC);
- }
- return TCL_OK;
- }
- argv3 = Tcl_GetString(objv[3]);
- if (*argv3 == '\0') {
- if (wmPtr->hints.icon_pixmap != None) {
- Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
- wmPtr->hints.icon_pixmap = None;
- }
- wmPtr->hints.flags &= ~IconPixmapHint;
- } else {
- pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, argv3);
- if (pixmap == None) {
- return TCL_ERROR;
- }
- wmPtr->hints.icon_pixmap = pixmap;
- wmPtr->hints.flags |= IconPixmapHint;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmIconifyCmd --
- *
- * This procedure is invoked to process the "wm iconify" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window");
- return TCL_ERROR;
- }
- if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": override-redirect flag is set", (char *) NULL);
- return TCL_ERROR;
- }
- if (wmPtr->master != None) {
- Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": it is a transient", (char *) NULL);
- return TCL_ERROR;
- }
- if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
- return TCL_ERROR;
- }
- if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
- return TCL_ERROR;
- }
- TkpWmSetState(winPtr, IconicState);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmIconmaskCmd --
- *
- * This procedure is invoked to process the "wm iconmask" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- Pixmap pixmap;
- char *argv3;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->hints.flags & IconMaskHint) {
- Tcl_SetResult(interp, (char *)
- Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_mask),
- TCL_STATIC);
- }
- return TCL_OK;
- }
- argv3 = Tcl_GetString(objv[3]);
- if (*argv3 == '\0') {
- if (wmPtr->hints.icon_mask != None) {
- Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask);
- }
- wmPtr->hints.flags &= ~IconMaskHint;
- } else {
- pixmap = Tk_GetBitmap(interp, tkwin, argv3);
- if (pixmap == None) {
- return TCL_ERROR;
- }
- wmPtr->hints.icon_mask = pixmap;
- wmPtr->hints.flags |= IconMaskHint;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmIconnameCmd --
- *
- * This procedure is invoked to process the "wm iconname" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
- int length;
-
- if (objc > 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- Tcl_SetResult(interp,
- ((wmPtr->iconName != NULL) ? wmPtr->iconName : ""),
- TCL_STATIC);
- return TCL_OK;
- } else {
- if (wmPtr->iconName != NULL) {
- ckfree((char *) wmPtr->iconName);
- }
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc((unsigned) (length + 1));
- strcpy(wmPtr->iconName, argv3);
- if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
- XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
- }
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmIconpositionCmd --
- *
- * This procedure is invoked to process the "wm iconposition"
- * Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int x, y;
-
- if ((objc != 3) && (objc != 5)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->hints.flags & IconPositionHint) {
- char buf[TCL_INTEGER_SPACE * 2];
-
- sprintf(buf, "%d %d", wmPtr->hints.icon_x,
- wmPtr->hints.icon_y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- }
- return TCL_OK;
- }
- if (*Tcl_GetString(objv[3]) == '\0') {
- wmPtr->hints.flags &= ~IconPositionHint;
- } else {
- if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
- return TCL_ERROR;
- }
- wmPtr->hints.icon_x = x;
- wmPtr->hints.icon_y = y;
- wmPtr->hints.flags |= IconPositionHint;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmIconwindowCmd --
- *
- * This procedure is invoked to process the "wm iconwindow" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- Tk_Window tkwin2;
- WmInfo *wmPtr2;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->icon != NULL) {
- Tcl_SetResult(interp, Tk_PathName(wmPtr->icon), TCL_STATIC);
- }
- return TCL_OK;
- }
- if (*Tcl_GetString(objv[3]) == '\0') {
- wmPtr->hints.flags &= ~IconWindowHint;
- if (wmPtr->icon != NULL) {
- wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
- wmPtr2->iconFor = NULL;
- wmPtr2->hints.initial_state = WithdrawnState;
- }
- wmPtr->icon = NULL;
- } else {
- if (TkGetWindowFromObj(interp, tkwin, objv[3], &tkwin2) != TCL_OK) {
- return TCL_ERROR;
- }
- if (!Tk_IsTopLevel(tkwin2)) {
- Tcl_AppendResult(interp, "can't use ", Tcl_GetString(objv[3]),
- " as icon window: not at top level", (char *) NULL);
- return TCL_ERROR;
- }
- wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr;
- if (wmPtr2->iconFor != NULL) {
- Tcl_AppendResult(interp, Tcl_GetString(objv[3]),
- " is already an icon for ",
- Tk_PathName(wmPtr2->iconFor), (char *) NULL);
- return TCL_ERROR;
- }
- if (wmPtr->icon != NULL) {
- WmInfo *wmPtr3 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
- wmPtr3->iconFor = NULL;
- }
- Tk_MakeWindowExist(tkwin2);
- wmPtr->hints.icon_window = Tk_WindowId(tkwin2);
- wmPtr->hints.flags |= IconWindowHint;
- wmPtr->icon = tkwin2;
- wmPtr2->iconFor = (Tk_Window) winPtr;
- if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
- /*
- * Don't have iconwindows on the Mac. We just withdraw.
- */
-
- Tk_UnmapWindow(tkwin2);
- }
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmMaxsizeCmd --
- *
- * This procedure is invoked to process the "wm maxsize" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int width, height;
-
- if ((objc != 3) && (objc != 5)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- char buf[TCL_INTEGER_SPACE * 2];
-
- sprintf(buf, "%d %d", wmPtr->maxWidth, wmPtr->maxHeight);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
- }
- if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
- return TCL_ERROR;
- }
- wmPtr->maxWidth = width;
- wmPtr->maxHeight = height;
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmMinsizeCmd --
- *
- * This procedure is invoked to process the "wm minsize" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int width, height;
-
- if ((objc != 3) && (objc != 5)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- char buf[TCL_INTEGER_SPACE * 2];
-
- sprintf(buf, "%d %d", wmPtr->minWidth, wmPtr->minHeight);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
- }
- if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
- return TCL_ERROR;
- }
- wmPtr->minWidth = width;
- wmPtr->minHeight = height;
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmOverrideredirectCmd --
- *
- * This procedure is invoked to process the "wm overrideredirect"
- * Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int boolean;
- XSetWindowAttributes atts;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp),
- Tk_Attributes((Tk_Window) winPtr)->override_redirect);
- return TCL_OK;
- }
- if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) {
- return TCL_ERROR;
- }
- atts.override_redirect = (boolean) ? True : False;
- Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
- &atts);
- wmPtr->style = (boolean) ? plainDBox : documentProc;
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmPositionfromCmd --
- *
- * This procedure is invoked to process the "wm positionfrom"
- * Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
- enum options {
- OPT_PROGRAM, OPT_USER };
- int index;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->sizeHintsFlags & USPosition) {
- Tcl_SetResult(interp, "user", TCL_STATIC);
- } else if (wmPtr->sizeHintsFlags & PPosition) {
- Tcl_SetResult(interp, "program", TCL_STATIC);
- }
- return TCL_OK;
- }
- if (*Tcl_GetString(objv[3]) == '\0') {
- wmPtr->sizeHintsFlags &= ~(USPosition|PPosition);
- } else {
- if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (index == OPT_USER) {
- wmPtr->sizeHintsFlags &= ~PPosition;
- wmPtr->sizeHintsFlags |= USPosition;
- } else {
- wmPtr->sizeHintsFlags &= ~USPosition;
- wmPtr->sizeHintsFlags |= PPosition;
- }
- }
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmProtocolCmd --
- *
- * This procedure is invoked to process the "wm protocol" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- register ProtocolHandler *protPtr, *prevPtr;
- Atom protocol;
- char *cmd;
- int cmdLength;
-
- if ((objc < 3) || (objc > 5)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- /*
- * Return a list of all defined protocols for the window.
- */
- for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
- Tcl_AppendElement(interp,
- Tk_GetAtomName((Tk_Window) winPtr, protPtr->protocol));
- }
- return TCL_OK;
- }
- protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3]));
- if (objc == 4) {
- /*
- * Return the command to handle a given protocol.
- */
- for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
- if (protPtr->protocol == protocol) {
- Tcl_SetResult(interp, protPtr->command, TCL_STATIC);
- return TCL_OK;
- }
- }
- return TCL_OK;
- }
-
- /*
- * Delete any current protocol handler, then create a new
- * one with the specified command, unless the command is
- * empty.
- */
-
- for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL;
- prevPtr = protPtr, protPtr = protPtr->nextPtr) {
- if (protPtr->protocol == protocol) {
- if (prevPtr == NULL) {
- wmPtr->protPtr = protPtr->nextPtr;
- } else {
- prevPtr->nextPtr = protPtr->nextPtr;
- }
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
- break;
- }
- }
- cmd = Tcl_GetStringFromObj(objv[4], &cmdLength);
- if (cmdLength > 0) {
- protPtr = (ProtocolHandler *) ckalloc(HANDLER_SIZE(cmdLength));
- protPtr->protocol = protocol;
- protPtr->nextPtr = wmPtr->protPtr;
- wmPtr->protPtr = protPtr;
- protPtr->interp = interp;
- strcpy(protPtr->command, cmd);
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmResizableCmd --
- *
- * This procedure is invoked to process the "wm resizable" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmResizableCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int width, height;
-
- if ((objc != 3) && (objc != 5)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- char buf[TCL_INTEGER_SPACE * 2];
-
- sprintf(buf, "%d %d",
- (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
- (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
- }
- if ((Tcl_GetBooleanFromObj(interp, objv[3], &width) != TCL_OK)
- || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) {
- return TCL_ERROR;
- }
- if (width) {
- wmPtr->flags &= ~WM_WIDTH_NOT_RESIZABLE;
- } else {
- wmPtr->flags |= WM_WIDTH_NOT_RESIZABLE;
- }
- if (height) {
- wmPtr->flags &= ~WM_HEIGHT_NOT_RESIZABLE;
- } else {
- wmPtr->flags |= WM_HEIGHT_NOT_RESIZABLE;
- }
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- if (wmPtr->scrollWinPtr != NULL) {
- TkScrollbarEventuallyRedraw(
- (TkScrollbar *) wmPtr->scrollWinPtr->instanceData);
- }
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmSizefromCmd --
- *
- * This procedure is invoked to process the "wm sizefrom" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
- enum options {
- OPT_PROGRAM, OPT_USER };
- int index;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->sizeHintsFlags & USSize) {
- Tcl_SetResult(interp, "user", TCL_STATIC);
- } else if (wmPtr->sizeHintsFlags & PSize) {
- Tcl_SetResult(interp, "program", TCL_STATIC);
- }
- return TCL_OK;
- }
-
- if (*Tcl_GetString(objv[3]) == '\0') {
- wmPtr->sizeHintsFlags &= ~(USSize|PSize);
- } else {
- if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (index == OPT_USER) {
- wmPtr->sizeHintsFlags &= ~PSize;
- wmPtr->sizeHintsFlags |= USSize;
- } else { /* OPT_PROGRAM */
- wmPtr->sizeHintsFlags &= ~USSize;
- wmPtr->sizeHintsFlags |= PSize;
- }
- }
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- WmUpdateGeom(wmPtr, winPtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmStackorderCmd --
- *
- * This procedure is invoked to process the "wm stackorder" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- TkWindow **windows, **window_ptr;
- static CONST char *optionStrings[] = {
- "isabove", "isbelow", (char *) NULL };
- enum options {
- OPT_ISABOVE, OPT_ISBELOW };
- int index;
-
- if ((objc != 3) && (objc != 5)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?isabove|isbelow window?");
- return TCL_ERROR;
- }
-
- if (objc == 3) {
- windows = TkWmStackorderToplevel(winPtr);
- if (windows == NULL) {
- panic("TkWmStackorderToplevel failed");
- } else {
- for (window_ptr = windows; *window_ptr ; window_ptr++) {
- Tcl_AppendElement(interp, (*window_ptr)->pathName);
- }
- ckfree((char *) windows);
- return TCL_OK;
- }
- } else {
- TkWindow *winPtr2;
- int index1=-1, index2=-1, result;
-
- if (TkGetWindowFromObj(interp, tkwin, objv[4], (Tk_Window *) &winPtr2)
- != TCL_OK) {
- return TCL_ERROR;
- }
-
- if (!Tk_IsTopLevel(winPtr2)) {
- Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't a top-level window", (char *) NULL);
- return TCL_ERROR;
- }
-
- if (!Tk_IsMapped(winPtr)) {
- Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't mapped", (char *) NULL);
- return TCL_ERROR;
- }
-
- if (!Tk_IsMapped(winPtr2)) {
- Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't mapped", (char *) NULL);
- return TCL_ERROR;
- }
-
- /*
- * Lookup stacking order of all toplevels that are children
- * of "." and find the position of winPtr and winPtr2
- * in the stacking order.
- */
-
- windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
-
- if (windows == NULL) {
- Tcl_AppendResult(interp, "TkWmStackorderToplevel failed",
- (char *) NULL);
- return TCL_ERROR;
- } else {
- for (window_ptr = windows; *window_ptr ; window_ptr++) {
- if (*window_ptr == winPtr)
- index1 = (window_ptr - windows);
- if (*window_ptr == winPtr2)
- index2 = (window_ptr - windows);
- }
- if (index1 == -1)
- panic("winPtr window not found");
- if (index2 == -1)
- panic("winPtr2 window not found");
-
- ckfree((char *) windows);
- }
-
- if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
- if (index == OPT_ISABOVE) {
- result = index1 > index2;
- } else { /* OPT_ISBELOW */
- result = index1 < index2;
- }
- Tcl_SetIntObj(Tcl_GetObjResult(interp), result);
- return TCL_OK;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmStateCmd --
- *
- * This procedure is invoked to process the "wm state" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmStateCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "normal", "iconic", "withdrawn", "zoomed", (char *) NULL };
- enum options {
- OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED };
- int index;
-
- if ((objc < 3) || (objc > 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?state?");
- return TCL_ERROR;
- }
- if (objc == 4) {
- if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't change state of ",
- Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
- return TCL_ERROR;
- }
- if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't change state of ",
- winPtr->pathName, ": it is an embedded window",
- (char *) NULL);
- return TCL_ERROR;
- }
-
- if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
- return TCL_ERROR;
- }
-
- if (index == OPT_NORMAL) {
- TkpWmSetState(winPtr, NormalState);
- /*
- * This varies from 'wm deiconify' because it does not
- * force the window to be raised and receive focus
- */
- } else if (index == OPT_ICONIC) {
- if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": override-redirect flag is set",
- (char *) NULL);
- return TCL_ERROR;
- }
- if (wmPtr->master != NULL) {
- Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": it is a transient", (char *) NULL);
- return TCL_ERROR;
- }
- TkpWmSetState(winPtr, IconicState);
- } else if (index == OPT_WITHDRAWN) {
- TkpWmSetState(winPtr, WithdrawnState);
- } else { /* OPT_ZOOMED */
- TkpWmSetState(winPtr, ZoomState);
- }
- } else {
- if (wmPtr->iconFor != NULL) {
- Tcl_SetResult(interp, "icon", TCL_STATIC);
- } else {
- switch (wmPtr->hints.initial_state) {
- case NormalState:
- Tcl_SetResult(interp, "normal", TCL_STATIC);
- break;
- case IconicState:
- Tcl_SetResult(interp, "iconic", TCL_STATIC);
- break;
- case WithdrawnState:
- Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
- break;
- case ZoomState:
- Tcl_SetResult(interp, "zoomed", TCL_STATIC);
- break;
- }
- }
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmTitleCmd --
- *
- * This procedure is invoked to process the "wm title" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmTitleCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
- int length;
-
- if (objc > 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- Tcl_SetResult(interp, (char *)
- ((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid),
- TCL_STATIC);
- return TCL_OK;
- } else {
- if (wmPtr->title != NULL) {
- ckfree((char *) wmPtr->title);
- }
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->title = ckalloc((unsigned) (length + 1));
- strcpy(wmPtr->title, argv3);
- if (!(wmPtr->flags & WM_NEVER_MAPPED) && !Tk_IsEmbedded(winPtr)) {
- TkSetWMName(winPtr, wmPtr->title);
- }
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmTransientCmd --
- *
- * This procedure is invoked to process the "wm transient" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmTransientCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- Tk_Window master;
- WmInfo *wmPtr2;
- char *argv3;
- int length;
-
- if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
- return TCL_ERROR;
- }
- if (objc == 3) {
- if (wmPtr->master != None) {
- Tcl_SetResult(interp, wmPtr->masterWindowName, TCL_STATIC);
- }
- return TCL_OK;
- }
- if (Tcl_GetString(objv[3])[0] == '\0') {
- wmPtr->master = None;
- if (wmPtr->masterWindowName != NULL) {
- ckfree(wmPtr->masterWindowName);
- }
- wmPtr->masterWindowName = NULL;
- wmPtr->style = documentProc;
- } else {
- if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) {
- return TCL_ERROR;
- }
- Tk_MakeWindowExist(master);
-
- if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[2]),
- "\" a transient: it is an icon for ",
- Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
- return TCL_ERROR;
- }
-
- wmPtr2 = ((TkWindow *) master)->wmInfoPtr;
-
- if (wmPtr2->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[3]),
- "\" a master: it is an icon for ",
- Tk_PathName(wmPtr2->iconFor),
- (char *) NULL);
- return TCL_ERROR;
- }
-
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->master = Tk_WindowId(master);
- wmPtr->masterWindowName = ckalloc((unsigned) length+1);
- strcpy(wmPtr->masterWindowName, argv3);
- wmPtr->style = plainDBox;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WmWithdrawCmd --
- *
- * This procedure is invoked to process the "wm withdraw" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
-
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window");
- return TCL_ERROR;
- }
- if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't withdraw ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
- return TCL_ERROR;
- }
- TkpWmSetState(winPtr, WithdrawnState);
- return TCL_OK;
-}
-
-/*
- * Invoked by those wm subcommands that affect geometry.
- * Schedules a geometry update.
- */
-static void
-WmUpdateGeom(wmPtr, winPtr)
- WmInfo *wmPtr;
- TkWindow *winPtr;
-{
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_SetGrid --
- *
- * This procedure is invoked by a widget when it wishes to set a grid
- * coordinate system that controls the size of a top-level window.
- * It provides a C interface equivalent to the "wm grid" command and
- * is usually asscoiated with the -setgrid option.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Grid-related information will be passed to the window manager, so
- * that the top-level window associated with tkwin will resize on
- * even grid units. If some other window already controls gridding
- * for the top-level window then this procedure call has no effect.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_SetGrid(
- Tk_Window tkwin, /* Token for window. New window mgr info
- * will be posted for the top-level window
- * associated with this window. */
- int reqWidth, /* Width (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int reqHeight, /* Height (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int widthInc, int heightInc)/* Pixel increments corresponding to a
- * change of one grid unit. */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- register WmInfo *wmPtr;
-
- /*
- * Find the top-level window for tkwin, plus the window manager
- * information.
- */
-
- while (!(winPtr->flags & TK_TOP_HIERARCHY)) {
- winPtr = winPtr->parentPtr;
- }
- wmPtr = winPtr->wmInfoPtr;
- if (wmPtr == NULL) {
- return;
- }
-
- if ((wmPtr->gridWin != NULL) && (wmPtr->gridWin != tkwin)) {
- return;
- }
-
- if ((wmPtr->reqGridWidth == reqWidth)
- && (wmPtr->reqGridHeight == reqHeight)
- && (wmPtr->widthInc == widthInc)
- && (wmPtr->heightInc == heightInc)
- && ((wmPtr->sizeHintsFlags & (PBaseSize|PResizeInc))
- == (PBaseSize|PResizeInc))) {
- return;
- }
-
- /*
- * If gridding was previously off, then forget about any window
- * size requests made by the user or via "wm geometry": these are
- * in pixel units and there's no easy way to translate them to
- * grid units since the new requested size of the top-level window in
- * pixels may not yet have been registered yet (it may filter up
- * the hierarchy in DoWhenIdle handlers). However, if the window
- * has never been mapped yet then just leave the window size alone:
- * assume that it is intended to be in grid units but just happened
- * to have been specified before this procedure was called.
- */
-
- if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) {
- wmPtr->width = -1;
- wmPtr->height = -1;
- }
-
- /*
- * Set the new gridding information, and start the process of passing
- * all of this information to the window manager.
- */
-
- wmPtr->gridWin = tkwin;
- wmPtr->reqGridWidth = reqWidth;
- wmPtr->reqGridHeight = reqHeight;
- wmPtr->widthInc = widthInc;
- wmPtr->heightInc = heightInc;
- wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_UnsetGrid --
- *
- * This procedure cancels the effect of a previous call
- * to Tk_SetGrid.
- *
- * Results:
- * None.
- *
- * Side effects:
- * If tkwin currently controls gridding for its top-level window,
- * gridding is cancelled for that top-level window; if some other
- * window controls gridding then this procedure has no effect.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_UnsetGrid(
- Tk_Window tkwin) /* Token for window that is currently
- * controlling gridding. */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- register WmInfo *wmPtr;
-
- /*
- * Find the top-level window for tkwin, plus the window manager
- * information.
- */
-
- while (!(winPtr->flags & TK_TOP_HIERARCHY)) {
- winPtr = winPtr->parentPtr;
- }
- wmPtr = winPtr->wmInfoPtr;
- if (wmPtr == NULL) {
- return;
- }
-
- if (tkwin != wmPtr->gridWin) {
- return;
- }
-
- wmPtr->gridWin = NULL;
- wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
- if (wmPtr->width != -1) {
- wmPtr->width = winPtr->reqWidth + (wmPtr->width
- - wmPtr->reqGridWidth)*wmPtr->widthInc;
- wmPtr->height = winPtr->reqHeight + (wmPtr->height
- - wmPtr->reqGridHeight)*wmPtr->heightInc;
- }
- wmPtr->widthInc = 1;
- wmPtr->heightInc = 1;
-
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TopLevelEventProc --
- *
- * This procedure is invoked when a top-level (or other externally-
- * managed window) is restructured in any way.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Tk's internal data structures for the window get modified to
- * reflect the structural change.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-TopLevelEventProc(
- ClientData clientData, /* Window for which event occurred. */
- XEvent *eventPtr) /* Event that just happened. */
-{
- register TkWindow *winPtr = (TkWindow *) clientData;
-
- winPtr->wmInfoPtr->flags |= WM_VROOT_OFFSET_STALE;
- if (eventPtr->type == DestroyNotify) {
- Tk_ErrorHandler handler;
-
- if (!(winPtr->flags & TK_ALREADY_DEAD)) {
- /*
- * A top-level window was deleted externally (e.g., by the window
- * manager). This is probably not a good thing, but cleanup as
- * best we can. The error handler is needed because
- * Tk_DestroyWindow will try to destroy the window, but of course
- * it's already gone.
- */
-
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
- Tk_DestroyWindow((Tk_Window) winPtr);
- Tk_DeleteErrorHandler(handler);
- }
- if (wmTracing) {
- printf("TopLevelEventProc: %s deleted\n", winPtr->pathName);
- }
- } else if (eventPtr->type == ReparentNotify) {
- panic("recieved unwanted reparent event");
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TopLevelReqProc --
- *
- * This procedure is invoked by the geometry manager whenever
- * the requested size for a top-level window is changed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Arrange for the window to be resized to satisfy the request
- * (this happens as a when-idle action).
- *
- *----------------------------------------------------------------------
- */
-
- /* ARGSUSED */
-static void
-TopLevelReqProc(
- ClientData dummy, /* Not used. */
- Tk_Window tkwin) /* Information about window. */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- WmInfo *wmPtr;
-
- wmPtr = winPtr->wmInfoPtr;
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * UpdateGeometryInfo --
- *
- * This procedure is invoked when a top-level window is first
- * mapped, and also as a when-idle procedure, to bring the
- * geometry and/or position of a top-level window back into
- * line with what has been requested by the user and/or widgets.
- * This procedure doesn't return until the window manager has
- * responded to the geometry change.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The window's size and location may change, unless the WM prevents
- * that from happening.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-UpdateGeometryInfo(
- ClientData clientData) /* Pointer to the window's record. */
-{
- register TkWindow *winPtr = (TkWindow *) clientData;
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int x, y, width, height;
- unsigned long serial;
-
- wmPtr->flags &= ~WM_UPDATE_PENDING;
-
- /*
- * Compute the new size for the top-level window. See the
- * user documentation for details on this, but the size
- * requested depends on (a) the size requested internally
- * by the window's widgets, (b) the size requested by the
- * user in a "wm geometry" command or via wm-based interactive
- * resizing (if any), and (c) whether or not the window is
- * gridded. Don't permit sizes <= 0 because this upsets
- * the X server.
- */
-
- if (wmPtr->width == -1) {
- width = winPtr->reqWidth;
- } else if (wmPtr->gridWin != NULL) {
- width = winPtr->reqWidth
- + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc;
- } else {
- width = wmPtr->width;
- }
- if (width <= 0) {
- width = 1;
- }
- if (wmPtr->height == -1) {
- height = winPtr->reqHeight;
- } else if (wmPtr->gridWin != NULL) {
- height = winPtr->reqHeight
- + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc;
- } else {
- height = wmPtr->height;
- }
- if (height <= 0) {
- height = 1;
- }
-
- /*
- * Compute the new position for the upper-left pixel of the window's
- * decorative frame. This is tricky, because we need to include the
- * border widths supplied by a reparented parent in this calculation,
- * but can't use the parent's current overall size since that may
- * change as a result of this code.
- */
-
- if (wmPtr->flags & WM_NEGATIVE_X) {
- x = wmPtr->vRootWidth - wmPtr->x
- - (width + (wmPtr->parentWidth - winPtr->changes.width));
- } else {
- x = wmPtr->x;
- }
- if (wmPtr->flags & WM_NEGATIVE_Y) {
- y = wmPtr->vRootHeight - wmPtr->y
- - (height + (wmPtr->parentHeight - winPtr->changes.height));
- } else {
- y = wmPtr->y;
- }
-
- /*
- * If the window's size is going to change and the window is
- * supposed to not be resizable by the user, then we have to
- * update the size hints. There may also be a size-hint-update
- * request pending from somewhere else, too.
- */
-
- if (((width != winPtr->changes.width)
- || (height != winPtr->changes.height))
- && (wmPtr->gridWin == NULL)
- && ((wmPtr->sizeHintsFlags & (PMinSize|PMaxSize)) == 0)) {
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- }
- if (wmPtr->flags & WM_UPDATE_SIZE_HINTS) {
- UpdateSizeHints(winPtr);
- }
-
- /*
- * Reconfigure the window if it isn't already configured correctly.
- * A few tricky points:
- *
- * 1. If the window is embedded and the container is also in this
- * process, don't actually reconfigure the window; just pass the
- * desired size on to the container. Also, zero out any position
- * information, since embedded windows are not allowed to move.
- * 2. Sometimes the window manager will give us a different size
- * than we asked for (e.g. mwm has a minimum size for windows), so
- * base the size check on what we *asked for* last time, not what we
- * got.
- * 3. Don't move window unless a new position has been requested for
- * it. This is because of "features" in some window managers (e.g.
- * twm, as of 4/24/91) where they don't interpret coordinates
- * according to ICCCM. Moving a window to its current location may
- * cause it to shift position on the screen.
- */
-
- if (Tk_IsEmbedded(winPtr)) {
- TkWindow *contWinPtr;
-
- contWinPtr = TkpGetOtherWindow(winPtr);
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- if (contWinPtr != NULL) {
- /*
- * This window is embedded and the container is also in this
- * process, so we don't need to do anything special about the
- * geometry, except to make sure that the desired size is known
- * by the container. Also, zero out any position information,
- * since embedded windows are not allowed to move.
- */
-
- wmPtr->x = wmPtr->y = 0;
- wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
- Tk_GeometryRequest((Tk_Window) contWinPtr, width, height);
- }
- return;
- }
- serial = NextRequest(winPtr->display);
- if (wmPtr->flags & WM_MOVE_PENDING) {
- wmPtr->configWidth = width;
- wmPtr->configHeight = height;
- if (wmTracing) {
- printf(
- "UpdateGeometryInfo moving to %d %d, resizing to %d x %d,\n",
- x, y, width, height);
- }
- Tk_MoveResizeWindow((Tk_Window) winPtr, x, y, (unsigned) width,
- (unsigned) height);
- } else if ((width != wmPtr->configWidth)
- || (height != wmPtr->configHeight)) {
- wmPtr->configWidth = width;
- wmPtr->configHeight = height;
- if (wmTracing) {
- printf("UpdateGeometryInfo resizing to %d x %d\n", width, height);
- }
- Tk_ResizeWindow((Tk_Window) winPtr, (unsigned) width,
- (unsigned) height);
- } else {
- return;
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * UpdateSizeHints --
- *
- * This procedure is called to update the window manager's
- * size hints information from the information in a WmInfo
- * structure.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Properties get changed for winPtr.
- *
- *--------------------------------------------------------------
- */
-
-static void
-UpdateSizeHints(
- TkWindow *winPtr)
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- XSizeHints *hintsPtr;
-
- wmPtr->flags &= ~WM_UPDATE_SIZE_HINTS;
-
- hintsPtr = XAllocSizeHints();
- if (hintsPtr == NULL) {
- return;
- }
-
- /*
- * Compute the pixel-based sizes for the various fields in the
- * size hints structure, based on the grid-based sizes in
- * our structure.
- */
-
- if (wmPtr->gridWin != NULL) {
- hintsPtr->base_width = winPtr->reqWidth
- - (wmPtr->reqGridWidth * wmPtr->widthInc);
- if (hintsPtr->base_width < 0) {
- hintsPtr->base_width = 0;
- }
- hintsPtr->base_height = winPtr->reqHeight
- - (wmPtr->reqGridHeight * wmPtr->heightInc);
- if (hintsPtr->base_height < 0) {
- hintsPtr->base_height = 0;
- }
- hintsPtr->min_width = hintsPtr->base_width
- + (wmPtr->minWidth * wmPtr->widthInc);
- hintsPtr->min_height = hintsPtr->base_height
- + (wmPtr->minHeight * wmPtr->heightInc);
- hintsPtr->max_width = hintsPtr->base_width
- + (wmPtr->maxWidth * wmPtr->widthInc);
- hintsPtr->max_height = hintsPtr->base_height
- + (wmPtr->maxHeight * wmPtr->heightInc);
- } else {
- hintsPtr->min_width = wmPtr->minWidth;
- hintsPtr->min_height = wmPtr->minHeight;
- hintsPtr->max_width = wmPtr->maxWidth;
- hintsPtr->max_height = wmPtr->maxHeight;
- hintsPtr->base_width = 0;
- hintsPtr->base_height = 0;
- }
- hintsPtr->width_inc = wmPtr->widthInc;
- hintsPtr->height_inc = wmPtr->heightInc;
- hintsPtr->min_aspect.x = wmPtr->minAspect.x;
- hintsPtr->min_aspect.y = wmPtr->minAspect.y;
- hintsPtr->max_aspect.x = wmPtr->maxAspect.x;
- hintsPtr->max_aspect.y = wmPtr->maxAspect.y;
- hintsPtr->win_gravity = wmPtr->gravity;
- hintsPtr->flags = wmPtr->sizeHintsFlags | PMinSize | PMaxSize;
-
- /*
- * If the window isn't supposed to be resizable, then set the
- * minimum and maximum dimensions to be the same.
- */
-
- if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
- if (wmPtr->width >= 0) {
- hintsPtr->min_width = wmPtr->width;
- } else {
- hintsPtr->min_width = winPtr->reqWidth;
- }
- hintsPtr->max_width = hintsPtr->min_width;
- }
- if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
- if (wmPtr->height >= 0) {
- hintsPtr->min_height = wmPtr->height;
- } else {
- hintsPtr->min_height = winPtr->reqHeight;
- }
- hintsPtr->max_height = hintsPtr->min_height;
- }
-
- XSetWMNormalHints(winPtr->display, winPtr->window, hintsPtr);
-
- XFree((char *) hintsPtr);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ParseGeometry --
- *
- * This procedure parses a geometry string and updates
- * information used to control the geometry of a top-level
- * window.
- *
- * Results:
- * A standard Tcl return value, plus an error message in
- * the interp's result if an error occurs.
- *
- * Side effects:
- * The size and/or location of winPtr may change.
- *
- *--------------------------------------------------------------
- */
-
-static int
-ParseGeometry(
- Tcl_Interp *interp, /* Used for error reporting. */
- char *string, /* String containing new geometry. Has the
- * standard form "=wxh+x+y". */
- TkWindow *winPtr) /* Pointer to top-level window whose
- * geometry is to be changed. */
-{
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
- int x, y, width, height, flags;
- char *end;
- register char *p = string;
-
- /*
- * The leading "=" is optional.
- */
-
- if (*p == '=') {
- p++;
- }
-
- /*
- * Parse the width and height, if they are present. Don't
- * actually update any of the fields of wmPtr until we've
- * successfully parsed the entire geometry string.
- */
-
- width = wmPtr->width;
- height = wmPtr->height;
- x = wmPtr->x;
- y = wmPtr->y;
- flags = wmPtr->flags;
- if (isdigit(UCHAR(*p))) {
- width = strtoul(p, &end, 10);
- p = end;
- if (*p != 'x') {
- goto error;
- }
- p++;
- if (!isdigit(UCHAR(*p))) {
- goto error;
- }
- height = strtoul(p, &end, 10);
- p = end;
- }
-
- /*
- * Parse the X and Y coordinates, if they are present.
- */
-
- if (*p != '\0') {
- flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
- if (*p == '-') {
- flags |= WM_NEGATIVE_X;
- } else if (*p != '+') {
- goto error;
- }
- x = strtol(p+1, &end, 10);
- p = end;
- if (*p == '-') {
- flags |= WM_NEGATIVE_Y;
- } else if (*p != '+') {
- goto error;
- }
- y = strtol(p+1, &end, 10);
- if (*end != '\0') {
- goto error;
- }
-
- /*
- * Assume that the geometry information came from the user,
- * unless an explicit source has been specified. Otherwise
- * most window managers assume that the size hints were
- * program-specified and they ignore them.
- */
-
- if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
- wmPtr->sizeHintsFlags |= USPosition;
- flags |= WM_UPDATE_SIZE_HINTS;
- }
- }
-
- /*
- * Everything was parsed OK. Update the fields of *wmPtr and
- * arrange for the appropriate information to be percolated out
- * to the window manager at the next idle moment.
- */
-
- wmPtr->width = width;
- wmPtr->height = height;
- if ((x != wmPtr->x) || (y != wmPtr->y)
- || ((flags & (WM_NEGATIVE_X|WM_NEGATIVE_Y))
- != (wmPtr->flags & (WM_NEGATIVE_X|WM_NEGATIVE_Y)))) {
- wmPtr->x = x;
- wmPtr->y = y;
- flags |= WM_MOVE_PENDING;
- }
- wmPtr->flags = flags;
-
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
- }
- return TCL_OK;
-
- error:
- Tcl_AppendResult(interp, "bad geometry specifier \"",
- string, "\"", (char *) NULL);
- return TCL_ERROR;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_GetRootCoords --
- *
- * Given a token for a window, this procedure traces through the
- * window's lineage to find the (virtual) root-window coordinates
- * corresponding to point (0,0) in the window.
- *
- * Results:
- * The locations pointed to by xPtr and yPtr are filled in with
- * the root coordinates of the (0,0) point in tkwin. If a virtual
- * root window is in effect for the window, then the coordinates
- * in the virtual root are returned.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_GetRootCoords(
- Tk_Window tkwin, /* Token for window. */
- int *xPtr, /* Where to store x-displacement of (0,0). */
- int *yPtr) /* Where to store y-displacement of (0,0). */
-{
- int x, y;
- register TkWindow *winPtr = (TkWindow *) tkwin;
-
- /*
- * Search back through this window's parents all the way to a
- * top-level window, combining the offsets of each window within
- * its parent.
- */
-
- x = y = 0;
- while (1) {
- x += winPtr->changes.x + winPtr->changes.border_width;
- y += winPtr->changes.y + winPtr->changes.border_width;
- if (winPtr->flags & TK_TOP_HIERARCHY) {
- if (!(Tk_IsEmbedded(winPtr))) {
- x += winPtr->wmInfoPtr->xInParent;
- y += winPtr->wmInfoPtr->yInParent;
- break;
- } else {
- TkWindow *otherPtr;
-
- otherPtr = TkpGetOtherWindow(winPtr);
- if (otherPtr != NULL) {
- /*
- * The container window is in the same application.
- * Query its coordinates.
- */
- winPtr = otherPtr;
-
- /*
- * Remember to offset by the container window here,
- * since at the end of this if branch, we will
- * pop out to the container's parent...
- */
-
- x += winPtr->changes.x + winPtr->changes.border_width;
- y += winPtr->changes.y + winPtr->changes.border_width;
-
- } else {
- Point theOffset;
-
- if (gMacEmbedHandler->getOffsetProc != NULL) {
- /*
- * We do not require that the changes.x & changes.y for
- * a non-Tk master window be kept up to date. So we
- * first subtract off the possibly bogus values that have
- * been added on at the top of this pass through the loop,
- * and then call out to the getOffsetProc to give us
- * the correct offset.
- */
-
- x -= winPtr->changes.x + winPtr->changes.border_width;
- y -= winPtr->changes.y + winPtr->changes.border_width;
-
- gMacEmbedHandler->getOffsetProc((Tk_Window) winPtr, &theOffset);
-
- x += theOffset.h;
- y += theOffset.v;
- }
- break;
- }
- }
- }
- if (winPtr->flags & TK_TOP_HIERARCHY) {
- break; /* Punt */
- }
- winPtr = winPtr->parentPtr;
- }
- *xPtr = x;
- *yPtr = y;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_CoordsToWindow --
- *
- * This is a Macintosh specific implementation of this function.
- * Given the root coordinates of a point, this procedure returns
- * the token for the top-most window covering that point, if
- * there exists such a window in this application.
- *
- * Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
- * window.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Tk_Window
-Tk_CoordsToWindow(
- int rootX, int rootY, /* Coordinates of point in root window. If
- * a virtual-root window manager is in use,
- * these coordinates refer to the virtual
- * root, not the real root. */
- Tk_Window tkwin) /* Token for any window in application;
- * used to identify the display. */
-{
- WindowPtr whichWin;
- Point where;
- Window rootChild;
- register TkWindow *winPtr, *childPtr;
- TkWindow *nextPtr; /* Coordinates of highest child found so
- * far that contains point. */
- int x, y; /* Coordinates in winPtr. */
- int tmpx, tmpy, bd;
- TkDisplay *dispPtr;
-
- /*
- * Step 1: find the top-level window that contains the desired point.
- */
-
- where.h = rootX;
- where.v = rootY;
- FindWindow(where, &whichWin);
- if (whichWin == NULL) {
- return NULL;
- }
- rootChild = TkMacGetXWindow(whichWin);
- dispPtr = TkGetDisplayList();
- winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, rootChild);
- if (winPtr == NULL) {
- return NULL;
- }
-
- /*
- * Step 2: work down through the hierarchy underneath this window.
- * At each level, scan through all the children to find the highest
- * one in the stacking order that contains the point. Then repeat
- * the whole process on that child.
- */
-
- x = rootX - winPtr->wmInfoPtr->xInParent;
- y = rootY - winPtr->wmInfoPtr->yInParent;
- while (1) {
- x -= winPtr->changes.x;
- y -= winPtr->changes.y;
- nextPtr = NULL;
-
- /*
- * Container windows cannot have children. So if it is a container,
- * look there, otherwise inspect the children.
- */
-
- if (Tk_IsContainer(winPtr)) {
- childPtr = TkpGetOtherWindow(winPtr);
- if (childPtr != NULL) {
- if (Tk_IsMapped(childPtr)) {
- tmpx = x - childPtr->changes.x;
- tmpy = y - childPtr->changes.y;
- bd = childPtr->changes.border_width;
-
- if ((tmpx >= -bd) && (tmpy >= -bd)
- && (tmpx < (childPtr->changes.width + bd))
- && (tmpy < (childPtr->changes.height + bd))) {
- nextPtr = childPtr;
- }
- }
- }
-
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- } else {
- for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
- if (!Tk_IsMapped(childPtr) ||
- (childPtr->flags & TK_TOP_HIERARCHY)) {
- continue;
- }
- tmpx = x - childPtr->changes.x;
- tmpy = y - childPtr->changes.y;
- bd = childPtr->changes.border_width;
- if ((tmpx >= -bd) && (tmpy >= -bd)
- && (tmpx < (childPtr->changes.width + bd))
- && (tmpy < (childPtr->changes.height + bd))) {
- nextPtr = childPtr;
- }
- }
- }
- if (nextPtr == NULL) {
- break;
- }
- winPtr = nextPtr;
- }
- return (Tk_Window) winPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_TopCoordsToWindow --
- *
- * Given a Tk Window, and coordinates of a point relative to that window
- * this procedure returns the top-most child of the window (excluding
- * toplevels) covering that point, if there exists such a window in this
- * application.
- * It also sets newX, and newY to the coords of the point relative to the
- * window returned.
- *
- * Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
- * window. newX and newY are also set to the coords of the point relative
- * to the returned window.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Tk_Window
-Tk_TopCoordsToWindow(
- Tk_Window tkwin, /* Token for a Tk Window which defines the;
- * coordinates for rootX & rootY */
- int rootX, int rootY, /* Coordinates of a point in tkWin. */
- int *newX, int *newY) /* Coordinates of point in the upperMost child of
- * tkWin containing (rootX,rootY) */
-{
- register TkWindow *winPtr, *childPtr;
- TkWindow *nextPtr; /* Coordinates of highest child found so
- * far that contains point. */
- int x, y; /* Coordinates in winPtr. */
- Window *children; /* Children of winPtr, or NULL. */
-
- winPtr = (TkWindow *) tkwin;
- x = rootX;
- y = rootY;
- while (1) {
- nextPtr = NULL;
- children = NULL;
-
- /*
- * Container windows cannot have children. So if it is a container,
- * look there, otherwise inspect the children.
- */
-
- if (Tk_IsContainer(winPtr)) {
- childPtr = TkpGetOtherWindow(winPtr);
- if (childPtr != NULL) {
- if (Tk_IsMapped(childPtr) &&
- (x > childPtr->changes.x &&
- x < childPtr->changes.x +
- childPtr->changes.width) &&
- (y > childPtr->changes.y &&
- y < childPtr->changes.y +
- childPtr->changes.height)) {
- nextPtr = childPtr;
- }
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- } else {
-
- for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
- if (!Tk_IsMapped(childPtr) ||
- (childPtr->flags & TK_TOP_HIERARCHY)) {
- continue;
- }
- if (x < childPtr->changes.x || y < childPtr->changes.y) {
- continue;
- }
- if (x > childPtr->changes.x + childPtr->changes.width ||
- y > childPtr->changes.y + childPtr->changes.height) {
- continue;
- }
- nextPtr = childPtr;
- }
- }
- if (nextPtr == NULL) {
- break;
- }
- winPtr = nextPtr;
- x -= winPtr->changes.x;
- y -= winPtr->changes.y;
- }
- *newX = x;
- *newY = y;
- return (Tk_Window) winPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * UpdateVRootGeometry --
- *
- * This procedure is called to update all the virtual root
- * geometry information in wmPtr.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The vRootX, vRootY, vRootWidth, and vRootHeight fields in
- * wmPtr are filled with the most up-to-date information.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-UpdateVRootGeometry(
- WmInfo *wmPtr) /* Window manager information to be
- * updated. The wmPtr->vRoot field must
- * be valid. */
-{
- TkWindow *winPtr = wmPtr->winPtr;
- unsigned int bd, dummy;
- Window dummy2;
- Status status;
- Tk_ErrorHandler handler;
-
- /*
- * If this isn't a virtual-root window manager, just return information
- * about the screen.
- */
-
- wmPtr->flags &= ~WM_VROOT_OFFSET_STALE;
- if (wmPtr->vRoot == None) {
- noVRoot:
- wmPtr->vRootX = wmPtr->vRootY = 0;
- wmPtr->vRootWidth = DisplayWidth(winPtr->display, winPtr->screenNum);
- wmPtr->vRootHeight = DisplayHeight(winPtr->display, winPtr->screenNum);
- return;
- }
-
- /*
- * Refresh the virtual root information if it's out of date.
- */
-
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
- status = XGetGeometry(winPtr->display, wmPtr->vRoot,
- &dummy2, &wmPtr->vRootX, &wmPtr->vRootY,
- &wmPtr->vRootWidth, &wmPtr->vRootHeight, &bd, &dummy);
- if (wmTracing) {
- printf("UpdateVRootGeometry: x = %d, y = %d, width = %d, ",
- wmPtr->vRootX, wmPtr->vRootY, wmPtr->vRootWidth);
- printf("height = %d, status = %d\n", wmPtr->vRootHeight, status);
- }
- Tk_DeleteErrorHandler(handler);
- if (status == 0) {
- /*
- * The virtual root is gone! Pretend that it never existed.
- */
-
- wmPtr->vRoot = None;
- goto noVRoot;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_GetVRootGeometry --
- *
- * This procedure returns information about the virtual root
- * window corresponding to a particular Tk window.
- *
- * Results:
- * The values at xPtr, yPtr, widthPtr, and heightPtr are set
- * with the offset and dimensions of the root window corresponding
- * to tkwin. If tkwin is being managed by a virtual root window
- * manager these values correspond to the virtual root window being
- * used for tkwin; otherwise the offsets will be 0 and the
- * dimensions will be those of the screen.
- *
- * Side effects:
- * Vroot window information is refreshed if it is out of date.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_GetVRootGeometry(
- Tk_Window tkwin, /* Window whose virtual root is to be
- * queried. */
- int *xPtr, int *yPtr, /* Store x and y offsets of virtual root
- * here. */
- int *widthPtr, /* Store dimensions of virtual root here. */
- int *heightPtr)
-{
- WmInfo *wmPtr;
- TkWindow *winPtr = (TkWindow *) tkwin;
-
- /*
- * Find the top-level window for tkwin, and locate the window manager
- * information for that window.
- */
-
- while (!(winPtr->flags & TK_TOP_HIERARCHY)) {
- winPtr = winPtr->parentPtr;
- }
- wmPtr = winPtr->wmInfoPtr;
- if (wmPtr == NULL) {
- return; /* Punt */
- }
-
- /*
- * Make sure that the geometry information is up-to-date, then copy
- * it out to the caller.
- */
-
- if (wmPtr->flags & WM_VROOT_OFFSET_STALE) {
- UpdateVRootGeometry(wmPtr);
- }
- *xPtr = wmPtr->vRootX;
- *yPtr = wmPtr->vRootY;
- *widthPtr = wmPtr->vRootWidth;
- *heightPtr = wmPtr->vRootHeight;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_MoveToplevelWindow --
- *
- * This procedure is called instead of Tk_MoveWindow to adjust
- * the x-y location of a top-level window. It delays the actual
- * move to a later time and keeps window-manager information
- * up-to-date with the move
- *
- * Results:
- * None.
- *
- * Side effects:
- * The window is eventually moved so that its upper-left corner
- * (actually, the upper-left corner of the window's decorative
- * frame, if there is one) is at (x,y).
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_MoveToplevelWindow(
- Tk_Window tkwin, /* Window to move. */
- int x, int y) /* New location for window (within
- * parent). */
-{
- TkWindow *winPtr = (TkWindow *) tkwin;
- register WmInfo *wmPtr = winPtr->wmInfoPtr;
-
- if (!(winPtr->flags & TK_TOP_LEVEL)) {
- panic("Tk_MoveToplevelWindow called with non-toplevel window");
- }
- wmPtr->x = x;
- wmPtr->y = y;
- wmPtr->flags |= WM_MOVE_PENDING;
- wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
- if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
- wmPtr->sizeHintsFlags |= USPosition;
- wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
- }
-
- /*
- * If the window has already been mapped, must bring its geometry
- * up-to-date immediately, otherwise an event might arrive from the
- * server that would overwrite wmPtr->x and wmPtr->y and lose the
- * new position.
- */
-
- if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
- if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
- }
- UpdateGeometryInfo((ClientData) winPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkWmProtocolEventProc --
- *
- * This procedure is called by the Tk_HandleEvent whenever a
- * ClientMessage event arrives whose type is "WM_PROTOCOLS".
- * This procedure handles the message from the window manager
- * in an appropriate fashion.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Depends on what sort of handler, if any, was set up for the
- * protocol.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkWmProtocolEventProc(
- TkWindow *winPtr, /* Window to which the event was sent. */
- XEvent *eventPtr) /* X event. */
-{
- WmInfo *wmPtr;
- register ProtocolHandler *protPtr;
- Tcl_Interp *interp;
- Atom protocol;
- int result;
-
- wmPtr = winPtr->wmInfoPtr;
- if (wmPtr == NULL) {
- return;
- }
- protocol = (Atom) eventPtr->xclient.data.l[0];
- for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
- if (protocol == protPtr->protocol) {
- Tcl_Preserve((ClientData) protPtr);
- interp = protPtr->interp;
- Tcl_Preserve((ClientData) interp);
- result = Tcl_GlobalEval(interp, protPtr->command);
- if (result != TCL_OK) {
- Tcl_AddErrorInfo(interp, "\n (command for \"");
- Tcl_AddErrorInfo(interp,
- Tk_GetAtomName((Tk_Window) winPtr, protocol));
- Tcl_AddErrorInfo(interp, "\" window manager protocol)");
- Tk_BackgroundError(interp);
- }
- Tcl_Release((ClientData) interp);
- Tcl_Release((ClientData) protPtr);
- return;
- }
- }
-
- /*
- * No handler was present for this protocol. If this is a
- * WM_DELETE_WINDOW message then just destroy the window.
- */
-
- if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) {
- Tk_DestroyWindow((Tk_Window) winPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkWmStackorderToplevelWrapperMap --
- *
- * This procedure will create a table that maps the reparent wrapper
- * X id for a toplevel to the TkWindow structure that is wraps.
- * Tk keeps track of a mapping from the window X id to the TkWindow
- * structure but that does us no good here since we only get the X
- * id of the wrapper window. Only those toplevel windows that are
- * mapped have a position in the stacking order.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Adds entries to the passed hashtable.
- *
- *----------------------------------------------------------------------
- */
-void
-TkWmStackorderToplevelWrapperMap(winPtr, table)
- TkWindow *winPtr; /* TkWindow to recurse on */
- Tcl_HashTable *table; /* Maps mac window to TkWindow */
-{
- TkWindow *childPtr;
- Tcl_HashEntry *hPtr;
- WindowPeek wrapper;
- int newEntry;
-
- if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr) &&
- !Tk_IsEmbedded(winPtr)) {
- wrapper = (WindowPeek) TkMacGetDrawablePort(winPtr->window);
-
- hPtr = Tcl_CreateHashEntry(table,
- (char *) wrapper, &newEntry);
- Tcl_SetHashValue(hPtr, winPtr);
- }
-
- for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
- TkWmStackorderToplevelWrapperMap(childPtr, table);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkWmStackorderToplevel --
- *
- * This procedure returns the stack order of toplevel windows.
- *
- * Results:
- * An array of pointers to tk window objects in stacking order
- * or else NULL if there was an error.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkWindow **
-TkWmStackorderToplevel(parentPtr)
- TkWindow *parentPtr; /* Parent toplevel window. */
-{
- WindowPeek frontWindow;
- TkWindow *childWinPtr, **windows, **window_ptr;
- Tcl_HashTable table;
- Tcl_HashEntry *hPtr;
- Tcl_HashSearch search;
-
- /*
- * Map mac windows to a TkWindow of the wrapped toplevel.
- */
-
- Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
- TkWmStackorderToplevelWrapperMap(parentPtr, &table);
-
- windows = (TkWindow **) ckalloc((table.numEntries+1)
- * sizeof(TkWindow *));
-
- /*
- * Special cases: If zero or one toplevels were mapped
- * there is no need to enumerate Windows.
- */
-
- switch (table.numEntries) {
- case 0:
- windows[0] = NULL;
- goto done;
- case 1:
- hPtr = Tcl_FirstHashEntry(&table, &search);
- windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
- windows[1] = NULL;
- goto done;
- }
-
- if (TkMacHaveAppearance() >= 0x110) {
- frontWindow = (WindowPeek) FrontNonFloatingWindow();
- } else {
- frontWindow = (WindowPeek) FrontWindow();
- }
-
- if (frontWindow == NULL) {
- ckfree((char *) windows);
- windows = NULL;
- } else {
- window_ptr = windows + table.numEntries;
- *window_ptr-- = NULL;
- while (frontWindow != NULL) {
- hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
- if (hPtr != NULL) {
- childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
- *window_ptr-- = childWinPtr;
- }
- frontWindow = frontWindow->nextWindow;
- }
- if (window_ptr != (windows-1))
- panic("num matched toplevel windows does not equal num children");
- }
-
- done:
- Tcl_DeleteHashTable(&table);
- return windows;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkWmRestackToplevel --
- *
- * This procedure restacks a top-level window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * WinPtr gets restacked as specified by aboveBelow and otherPtr.
- * This procedure doesn't return until the restack has taken
- * effect and the ConfigureNotify event for it has been received.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkWmRestackToplevel(
- TkWindow *winPtr, /* Window to restack. */
- int aboveBelow, /* Gives relative position for restacking;
- * must be Above or Below. */
- TkWindow *otherPtr) /* Window relative to which to restack;
- * if NULL, then winPtr gets restacked
- * above or below *all* siblings. */
-{
- WmInfo *wmPtr;
- WindowPeek macWindow, otherMacWindow, frontWindow;
-
- wmPtr = winPtr->wmInfoPtr;
-
- /*
- * Get the mac window. Make sure it exists & is mapped.
- */
-
- if (winPtr->window == None) {
- Tk_MakeWindowExist((Tk_Window) winPtr);
- }
- if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
-
- /*
- * Can't set stacking order properly until the window is on the
- * screen (mapping it may give it a reparent window), so make sure
- * it's on the screen.
- */
-
- TkWmMapWindow(winPtr);
- }
- macWindow = (WindowPeek) TkMacGetDrawablePort(winPtr->window);
-
- /*
- * Get the window in which a raise or lower is in relation to.
- */
- if (otherPtr != NULL) {
- if (otherPtr->window == None) {
- Tk_MakeWindowExist((Tk_Window) otherPtr);
- }
- if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
- TkWmMapWindow(otherPtr);
- }
- otherMacWindow = (WindowPeek) TkMacGetDrawablePort(otherPtr->window);
- } else {
- otherMacWindow = NULL;
- }
-
- if (TkMacHaveAppearance() >= 0x110) {
- frontWindow = (WindowPeek) FrontNonFloatingWindow();
- } else {
- frontWindow = (WindowPeek) FrontWindow();
- }
-
- if (aboveBelow == Above) {
- if (macWindow == frontWindow) {
- /*
- * Do nothing - it's already at the top.
- */
- } else if (otherMacWindow == frontWindow || otherMacWindow == NULL) {
- /*
- * Raise the window to the top. If the window is visable then
- * we also make it the active window.
- */
-
- if (wmPtr->hints.initial_state == WithdrawnState) {
- BringToFront((WindowPtr) macWindow);
- } else {
- SelectWindow((WindowPtr) macWindow);
- }
- } else {
- /*
- * Find the window to be above. (Front window will actually be the
- * window to be behind.) Front window is NULL if no other windows.
- */
- while (frontWindow != NULL &&
- frontWindow->nextWindow != otherMacWindow) {
- frontWindow = frontWindow->nextWindow;
- }
- if (frontWindow != NULL) {
- SendBehind((WindowPtr) macWindow, (WindowPtr) frontWindow);
- }
- }
- } else {
- /*
- * Send behind. If it was in front find another window to make active.
- */
- if (macWindow == frontWindow) {
- if (macWindow->nextWindow != NULL) {
- SelectWindow((WindowPtr) macWindow->nextWindow);
- }
- }
- SendBehind((WindowPtr) macWindow, (WindowPtr) otherMacWindow);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkWmAddToColormapWindows --
- *
- * This procedure is called to add a given window to the
- * WM_COLORMAP_WINDOWS property for its top-level, if it
- * isn't already there. It is invoked by the Tk code that
- * creates a new colormap, in order to make sure that colormap
- * information is propagated to the window manager by default.
- *
- * Results:
- * None.
- *
- * Side effects:
- * WinPtr's window gets added to the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * colormaps have been set explicitly with the
- * "wm colormapwindows" command.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkWmAddToColormapWindows(
- TkWindow *winPtr) /* Window with a non-default colormap.
- * Should not be a top-level window. */
-{
- TkWindow *topPtr;
- TkWindow **oldPtr, **newPtr;
- int count, i;
-
- if (winPtr->window == None) {
- return;
- }
-
- for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
- if (topPtr == NULL) {
- /*
- * Window is being deleted. Skip the whole operation.
- */
-
- return;
- }
- if (topPtr->flags & TK_TOP_HIERARCHY) {
- break;
- }
- }
- if (topPtr->wmInfoPtr == NULL) {
- return;
- }
-
- if (topPtr->wmInfoPtr->flags & WM_COLORMAPS_EXPLICIT) {
- return;
- }
-
- /*
- * Make sure that the window isn't already in the list.
- */
-
- count = topPtr->wmInfoPtr->cmapCount;
- oldPtr = topPtr->wmInfoPtr->cmapList;
-
- for (i = 0; i < count; i++) {
- if (oldPtr[i] == winPtr) {
- return;
- }
- }
-
- /*
- * Make a new bigger array and use it to reset the property.
- * Automatically add the toplevel itself as the last element
- * of the list.
- */
-
- newPtr = (TkWindow **) ckalloc((unsigned) ((count+2)*sizeof(TkWindow*)));
- if (count > 0) {
- memcpy(newPtr, oldPtr, count * sizeof(TkWindow*));
- }
- if (count == 0) {
- count++;
- }
- newPtr[count-1] = winPtr;
- newPtr[count] = topPtr;
- if (oldPtr != NULL) {
- ckfree((char *) oldPtr);
- }
-
- topPtr->wmInfoPtr->cmapList = newPtr;
- topPtr->wmInfoPtr->cmapCount = count+1;
-
- /*
- * On the Macintosh all of this is just an excercise
- * in compatability as we don't support colormaps. If
- * we did they would be installed here.
- */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkWmRemoveFromColormapWindows --
- *
- * This procedure is called to remove a given window from the
- * WM_COLORMAP_WINDOWS property for its top-level. It is invoked
- * when windows are deleted.
- *
- * Results:
- * None.
- *
- * Side effects:
- * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * top-level itself is being deleted too.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkWmRemoveFromColormapWindows(
- TkWindow *winPtr) /* Window that may be present in
- * WM_COLORMAP_WINDOWS property for its
- * top-level. Should not be a top-level
- * window. */
-{
- TkWindow *topPtr;
- TkWindow **oldPtr;
- int count, i, j;
-
- for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
- if (topPtr == NULL) {
- /*
- * Ancestors have been deleted, so skip the whole operation.
- * Seems like this can't ever happen?
- */
-
- return;
- }
- if (topPtr->flags & TK_TOP_HIERARCHY) {
- break;
- }
- }
- if (topPtr->flags & TK_ALREADY_DEAD) {
- /*
- * Top-level is being deleted, so there's no need to cleanup
- * the WM_COLORMAP_WINDOWS property.
- */
-
- return;
- }
-
- /*
- * Find the window and slide the following ones down to cover
- * it up.
- */
-
- if (topPtr->wmInfoPtr == NULL) {
- return;
- }
-
- count = topPtr->wmInfoPtr->cmapCount;
- oldPtr = topPtr->wmInfoPtr->cmapList;
- for (i = 0; i < count; i++) {
- if (oldPtr[i] == winPtr) {
- for (j = i ; j < count-1; j++) {
- oldPtr[j] = oldPtr[j+1];
- }
- topPtr->wmInfoPtr->cmapCount = count - 1;
- break;
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGetPointerCoords --
- *
- * Fetch the position of the mouse pointer.
- *
- * Results:
- * *xPtr and *yPtr are filled in with the (virtual) root coordinates
- * of the mouse pointer for tkwin's display. If the pointer isn't
- * on tkwin's screen, then -1 values are returned for both
- * coordinates. The argument tkwin must be a toplevel window.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkGetPointerCoords(
- Tk_Window tkwin, /* Toplevel window that identifies screen
- * on which lookup is to be done. */
- int *xPtr, int *yPtr) /* Store pointer coordinates here. */
-{
- Point where;
-
- GetMouse(&where);
- LocalToGlobal(&where);
- *xPtr = where.h;
- *yPtr = where.v;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * InitialWindowBounds --
- *
- * This function calculates the initial bounds for a new Mac
- * toplevel window. Unless the geometry is specified by the user
- * this code will auto place the windows in a cascade diagonially
- * across the main monitor of the Mac.
- *
- * Results:
- * The bounds are returned in geometry.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-InitialWindowBounds(
- TkWindow *winPtr, /* Window to get initial bounds for. */
- Rect *geometry) /* On return the initial bounds. */
-{
- int x, y;
- static int defaultX = 5;
- static int defaultY = 45;
-
- if (!(winPtr->wmInfoPtr->sizeHintsFlags & (USPosition | PPosition))) {
- /*
- * We will override the program & hopefully place the
- * window in a "better" location.
- */
-
- if (((tcl_macQdPtr->screenBits.bounds.right - defaultX) < 30) ||
- ((tcl_macQdPtr->screenBits.bounds.bottom - defaultY) < 30)) {
- defaultX = 5;
- defaultY = 45;
- }
- x = defaultX;
- y = defaultY;
- defaultX += 20;
- defaultY += 20;
- } else {
- x = winPtr->wmInfoPtr->x;
- y = winPtr->wmInfoPtr->y;
- }
-
- geometry->left = x;
- geometry->top = y;
- geometry->right = x + winPtr->changes.width;
- geometry->bottom = y + winPtr->changes.height;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacResizable --
- *
- * This function determines if the passed in window is part of
- * a toplevel window that is resizable. If the window is
- * resizable in the x, y or both directions, true is returned.
- *
- * Results:
- * True if resizable, false otherwise.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacResizable(
- TkWindow *winPtr) /* Tk window or NULL. */
-{
- WmInfo *wmPtr;
-
- if (winPtr == NULL) {
- return false;
- }
- while (winPtr->wmInfoPtr == NULL) {
- winPtr = winPtr->parentPtr;
- }
-
- wmPtr = winPtr->wmInfoPtr;
- if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) &&
- (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)) {
- return false;
- } else {
- return true;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacGrowToplevel --
- *
- * The function is invoked when the user clicks in the grow region
- * of a Tk window. The function will handle the dragging
- * procedure and not return until completed. Finally, the function
- * may place information Tk's event queue is the window was resized.
- *
- * Results:
- * True if events were placed on event queue, false otherwise.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacGrowToplevel(
- WindowPtr whichWindow,
- Point start)
-{
- Point where = start;
- TkDisplay *dispPtr;
-
- GlobalToLocal(&where);
- if (where.h > (whichWindow->portRect.right - 16) &&
- where.v > (whichWindow->portRect.bottom - 16)) {
-
- Window window;
- TkWindow *winPtr;
- WmInfo *wmPtr;
- Rect bounds;
- long growResult;
-
- window = TkMacGetXWindow(whichWindow);
- dispPtr = TkGetDisplayList();
- winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
- wmPtr = winPtr->wmInfoPtr;
-
- /* TODO: handle grid size options. */
- if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) &&
- (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)) {
- return false;
- }
- if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
- bounds.left = bounds.right = winPtr->changes.width;
- } else {
- bounds.left = (wmPtr->minWidth < 64) ? 64 : wmPtr->minWidth;
- bounds.right = (wmPtr->maxWidth < 64) ? 64 : wmPtr->maxWidth;
- }
- if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
- bounds.top = bounds.bottom = winPtr->changes.height;
- } else {
- bounds.top = (wmPtr->minHeight < 64) ? 64 : wmPtr->minHeight;
- bounds.bottom = (wmPtr->maxHeight < 64) ? 64 : wmPtr->maxHeight;
- }
-
- growResult = GrowWindow(whichWindow, start, &bounds);
-
- if (growResult != 0) {
- SizeWindow(whichWindow,
- LoWord(growResult), HiWord(growResult), true);
- SetPort(whichWindow);
- InvalRect(&whichWindow->portRect); /* TODO: may not be needed */
- TkMacInvalClipRgns(winPtr);
- TkGenWMConfigureEvent((Tk_Window) winPtr, -1, -1,
- (int) LoWord(growResult), (int) HiWord(growResult),
- TK_SIZE_CHANGED);
- return true;
- }
- return false;
- }
- return false;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkSetWMName --
- *
- * Set the title for a toplevel window. If the window is embedded,
- * do not change the window title.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The title of the window is changed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkSetWMName(
- TkWindow *winPtr,
- CONST char *title)
-{
- Str255 pTitle;
- GWorldPtr macWin;
- int destWrote;
-
- if (Tk_IsEmbedded(winPtr)) {
- return;
- }
- Tcl_UtfToExternal(NULL, NULL, title,
- strlen(title), 0, NULL,
- (char *) &pTitle[1],
- 255, NULL, &destWrote, NULL); /* Internalize native */
- pTitle[0] = destWrote;
-
- macWin = TkMacGetDrawablePort(winPtr->window);
-
- SetWTitle((WindowPtr) macWin, pTitle);
-}
-
-void
-TkGenWMDestroyEvent(
- Tk_Window tkwin)
-{
- XEvent event;
-
- event.xany.serial = Tk_Display(tkwin)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(tkwin);
-
- event.xclient.window = Tk_WindowId(tkwin);
- event.xclient.type = ClientMessage;
- event.xclient.message_type = Tk_InternAtom(tkwin, "WM_PROTOCOLS");
- event.xclient.format = 32;
- event.xclient.data.l[0] = Tk_InternAtom(tkwin, "WM_DELETE_WINDOW");
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGenWMConfigureEvent --
- *
- * Generate a ConfigureNotify event for Tk. Depending on the
- * value of flag the values of width/height, x/y, or both may
- * be changed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A ConfigureNotify event is sent to Tk.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkGenWMConfigureEvent(
- Tk_Window tkwin,
- int x,
- int y,
- int width,
- int height,
- int flags)
-{
- XEvent event;
- WmInfo *wmPtr;
- TkWindow *winPtr = (TkWindow *) tkwin;
-
- if (tkwin == NULL) {
- return;
- }
-
- event.type = ConfigureNotify;
- event.xconfigure.serial = Tk_Display(tkwin)->request;
- event.xconfigure.send_event = False;
- event.xconfigure.display = Tk_Display(tkwin);
- event.xconfigure.event = Tk_WindowId(tkwin);
- event.xconfigure.window = Tk_WindowId(tkwin);
- event.xconfigure.border_width = winPtr->changes.border_width;
- event.xconfigure.override_redirect = winPtr->atts.override_redirect;
- if (winPtr->changes.stack_mode == Above) {
- event.xconfigure.above = winPtr->changes.sibling;
- } else {
- event.xconfigure.above = None;
- }
-
- if (flags & TK_LOCATION_CHANGED) {
- event.xconfigure.x = x;
- event.xconfigure.y = y;
- } else {
- event.xconfigure.x = Tk_X(tkwin);
- event.xconfigure.y = Tk_Y(tkwin);
- x = Tk_X(tkwin);
- y = Tk_Y(tkwin);
- }
- if (flags & TK_SIZE_CHANGED) {
- event.xconfigure.width = width;
- event.xconfigure.height = height;
- } else {
- event.xconfigure.width = Tk_Width(tkwin);
- event.xconfigure.height = Tk_Height(tkwin);
- width = Tk_Width(tkwin);
- height = Tk_Height(tkwin);
- }
-
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
- /*
- * Update window manager information.
- */
- if (Tk_IsTopLevel(winPtr)) {
- wmPtr = winPtr->wmInfoPtr;
- if (flags & TK_LOCATION_CHANGED) {
- wmPtr->x = x;
- wmPtr->y = y;
- wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
- }
- if ((flags & TK_SIZE_CHANGED) &&
- ((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) {
- if ((wmPtr->width == -1) && (width == winPtr->reqWidth)) {
- /*
- * Don't set external width, since the user didn't change it
- * from what the widgets asked for.
- */
- } else {
- if (wmPtr->gridWin != NULL) {
- wmPtr->width = wmPtr->reqGridWidth
- + (width - winPtr->reqWidth)/wmPtr->widthInc;
- if (wmPtr->width < 0) {
- wmPtr->width = 0;
- }
- } else {
- wmPtr->width = width;
- }
- }
- if ((wmPtr->height == -1) && (height == winPtr->reqHeight)) {
- /*
- * Don't set external height, since the user didn't change it
- * from what the widgets asked for.
- */
- } else {
- if (wmPtr->gridWin != NULL) {
- wmPtr->height = wmPtr->reqGridHeight
- + (height - winPtr->reqHeight)/wmPtr->heightInc;
- if (wmPtr->height < 0) {
- wmPtr->height = 0;
- }
- } else {
- wmPtr->height = height;
- }
- }
- wmPtr->configWidth = width;
- wmPtr->configHeight = height;
- }
- }
-
- /*
- * Now set up the changes structure. Under X we wait for the
- * ConfigureNotify to set these values. On the Mac we know imediatly that
- * this is what we want - so we just set them. However, we need to
- * make sure the windows clipping region is marked invalid so the
- * change is visable to the subwindow.
- */
- winPtr->changes.x = x;
- winPtr->changes.y = y;
- winPtr->changes.width = width;
- winPtr->changes.height = height;
- TkMacInvalClipRgns(winPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGetTransientMaster --
- *
- * If the passed window has the TRANSIENT_FOR property set this
- * will return the master window. Otherwise it will return None.
- *
- * Results:
- * The master window or None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Window
-TkGetTransientMaster(
- TkWindow *winPtr)
-{
- if (winPtr->wmInfoPtr != NULL) {
- return winPtr->wmInfoPtr->master;
- }
- return None;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacGetXWindow --
- *
- * Returns the X window Id associated with the given WindowRef.
- *
- * Results:
- * The window id is returned. None is returned if not a Tk window.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Window
-TkMacGetXWindow(
- WindowRef macWinPtr)
-{
- register Tcl_HashEntry *hPtr;
-
- if ((macWinPtr == NULL) || !windowHashInit) {
- return None;
- }
- hPtr = Tcl_FindHashEntry(&windowTable, (char *) macWinPtr);
- if (hPtr == NULL) {
- return None;
- }
- return (Window) Tcl_GetHashValue(hPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacZoomToplevel --
- *
- * The function is invoked when the user clicks in the zoom region
- * of a Tk window. The function will handle the mouse tracking
- * for the interaction. If the window is to be zoomed the window
- * size is changed and events are generated to let Tk know what
- * happened.
- *
- * Results:
- * True if events were placed on event queue, false otherwise.
- *
- * Side effects:
- * The window may be resized & events placed on Tk's queue.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacZoomToplevel(
- WindowPtr whichWindow, /* The Macintosh window to zoom. */
- Point where, /* The current mouse position. */
- short zoomPart) /* Either inZoomIn or inZoomOut */
-{
- Window window;
- Tk_Window tkwin;
- Point location = {0, 0};
- int xOffset, yOffset;
- WmInfo *wmPtr;
- TkDisplay *dispPtr;
-
- SetPort(whichWindow);
- if (!TrackBox(whichWindow, where, zoomPart)) {
- return false;
- }
-
- /*
- * We should now zoom the window (as long as it's one of ours). We
- * also need to generate an event to let Tk know that the window size
- * has changed.
- */
- window = TkMacGetXWindow(whichWindow);
- dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
- if (tkwin == NULL) {
- return false;
- }
-
- /*
- * The following block of code works around a bug in the window
- * definition for Apple's floating windows. The zoom behavior is
- * broken - we must manually set the standard state (by default
- * it's something like 1x1) and we must swap the zoomPart manually
- * otherwise we always get the same zoomPart and nothing happens.
- */
- wmPtr = ((TkWindow *) tkwin)->wmInfoPtr;
- if (wmPtr->style >= floatProc && wmPtr->style <= floatSideZoomGrowProc) {
- if (zoomPart == inZoomIn) {
- Rect zoomRect = tcl_macQdPtr->screenBits.bounds;
- InsetRect(&zoomRect, 60, 60);
- SetWindowStandardState(whichWindow, &zoomRect);
- zoomPart = inZoomOut;
- } else {
- zoomPart = inZoomIn;
- }
- }
-
- ZoomWindow(whichWindow, zoomPart, false);
- InvalRect(&whichWindow->portRect);
- TkMacInvalClipRgns((TkWindow *) tkwin);
-
- LocalToGlobal(&location);
- TkMacWindowOffset(whichWindow, &xOffset, &yOffset);
- location.h -= xOffset;
- location.v -= yOffset;
- TkGenWMConfigureEvent(tkwin, location.h, location.v,
- whichWindow->portRect.right - whichWindow->portRect.left,
- whichWindow->portRect.bottom - whichWindow->portRect.top,
- TK_BOTH_CHANGED);
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkUnsupported1Cmd --
- *
- * This procedure is invoked to process the
- * "::tk::unsupported::MacWindowStyle" Tcl command. This command
- * allows you to set the style of decoration for a Macintosh window.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * Changes the style of a new Mac window.
- *
- *----------------------------------------------------------------------
- */
-
- /* ARGSUSED */
-int
-TkUnsupported1Cmd(
- ClientData clientData, /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
-{
- Tk_Window tkwin = (Tk_Window) clientData;
- TkWindow *winPtr;
- register WmInfo *wmPtr;
- int c;
- size_t length;
-
- if (argc < 3) {
- wrongNumArgs:
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- argv[0], " option window ?arg ...?\"", (char *) NULL);
- return TCL_ERROR;
- }
-
- winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[2], tkwin);
- if (winPtr == NULL) {
- return TCL_ERROR;
- }
- if (!Tk_IsTopLevel(winPtr)) {
- Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't a top-level window", (char *) NULL);
- return TCL_ERROR;
- }
- wmPtr = winPtr->wmInfoPtr;
- c = argv[1][0];
- length = strlen(argv[1]);
- if ((c == 's') && (strncmp(argv[1], "style", length) == 0)) {
- if (TkMacHaveAppearance() >= 0x110) {
- if ((argc < 3) || (argc > 5)) {
- Tcl_AppendResult(interp, "wrong # arguments: must be \"",
- argv[0], " style window ?windowStyle?\"",
- " or \"", argv[0], "style window ?class attributes?\"",
- (char *) NULL);
- return TCL_ERROR;
- }
- } else {
- if ((argc != 3) && (argc != 4)) {
- Tcl_AppendResult(interp, "wrong # arguments: must be \"",
- argv[0], " style window ?windowStyle?\"",
- (char *) NULL);
- return TCL_ERROR;
- }
- }
-
- if (argc == 3) {
- int appearanceSpec = 0;
-
- switch (wmPtr->style) {
- case -1:
- appearanceSpec = 1;
- break;
- case noGrowDocProc:
- case documentProc:
- Tcl_SetResult(interp, "documentProc", TCL_STATIC);
- break;
- case dBoxProc:
- Tcl_SetResult(interp, "dBoxProc", TCL_STATIC);
- break;
- case plainDBox:
- Tcl_SetResult(interp, "plainDBox", TCL_STATIC);
- break;
- case altDBoxProc:
- Tcl_SetResult(interp, "altDBoxProc", TCL_STATIC);
- break;
- case movableDBoxProc:
- Tcl_SetResult(interp, "movableDBoxProc", TCL_STATIC);
- break;
- case zoomDocProc:
- case zoomNoGrow:
- Tcl_SetResult(interp, "zoomDocProc", TCL_STATIC);
- break;
- case rDocProc:
- Tcl_SetResult(interp, "rDocProc", TCL_STATIC);
- break;
- case floatProc:
- case floatGrowProc:
- Tcl_SetResult(interp, "floatProc", TCL_STATIC);
- break;
- case floatZoomProc:
- case floatZoomGrowProc:
- Tcl_SetResult(interp, "floatZoomProc", TCL_STATIC);
- break;
- case floatSideProc:
- case floatSideGrowProc:
- Tcl_SetResult(interp, "floatSideProc", TCL_STATIC);
- break;
- case floatSideZoomProc:
- case floatSideZoomGrowProc:
- Tcl_SetResult(interp, "floatSideZoomProc", TCL_STATIC);
- break;
- default:
- panic("invalid style");
- }
- if (appearanceSpec) {
- Tcl_Obj *attributeList, *newResult;
-
- switch (wmPtr->macClass) {
- case kAlertWindowClass:
- newResult = Tcl_NewStringObj("alert", -1);
- break;
- case kMovableAlertWindowClass:
- newResult = Tcl_NewStringObj("moveableAlert", -1);
- break;
- case kModalWindowClass:
- newResult = Tcl_NewStringObj("modal", -1);
- break;
- case kMovableModalWindowClass:
- newResult = Tcl_NewStringObj("moveableModal", -1);
- break;
- case kFloatingWindowClass:
- newResult = Tcl_NewStringObj("floating", -1);
- break;
- case kDocumentWindowClass:
- newResult = Tcl_NewStringObj("document", -1);
- break;
- default:
- panic("invalid class");
- }
-
- attributeList = Tcl_NewListObj(0, NULL);
- if (wmPtr->attributes == kWindowNoAttributes) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("none", -1));
- } else if (wmPtr->attributes == kWindowStandardDocumentAttributes) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("standardDocument", -1));
- } else if (wmPtr->attributes == kWindowStandardFloatingAttributes) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("standardFloating", -1));
- } else {
- if (wmPtr->attributes & kWindowCloseBoxAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("closeBox", -1));
- }
- if (wmPtr->attributes & kWindowHorizontalZoomAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("horizontalZoom", -1));
- }
- if (wmPtr->attributes & kWindowVerticalZoomAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("verticalZoom", -1));
- }
- if (wmPtr->attributes & kWindowCollapseBoxAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("collapseBox", -1));
- }
- if (wmPtr->attributes & kWindowResizableAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("resizable", -1));
- }
- if (wmPtr->attributes & kWindowSideTitlebarAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("sideTitlebar", -1));
- }
- if (wmPtr->attributes & kWindowNoUpdatesAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("noUpdates", -1));
- }
- if (wmPtr->attributes & kWindowNoActivatesAttribute) {
- Tcl_ListObjAppendElement(interp, attributeList,
- Tcl_NewStringObj("noActivates", -1));
- }
- }
- Tcl_ListObjAppendElement(interp, newResult, attributeList);
- Tcl_SetObjResult(interp, newResult);
- }
- return TCL_OK;
- } else if (argc == 4) {
- if (strcmp(argv[3], "documentProc") == 0) {
- wmPtr->style = documentProc;
- } else if (strcmp(argv[3], "noGrowDocProc") == 0) {
- wmPtr->style = documentProc;
- } else if (strcmp(argv[3], "dBoxProc") == 0) {
- wmPtr->style = dBoxProc;
- } else if (strcmp(argv[3], "plainDBox") == 0) {
- wmPtr->style = plainDBox;
- } else if (strcmp(argv[3], "altDBoxProc") == 0) {
- wmPtr->style = altDBoxProc;
- } else if (strcmp(argv[3], "movableDBoxProc") == 0) {
- wmPtr->style = movableDBoxProc;
- } else if (strcmp(argv[3], "zoomDocProc") == 0) {
- wmPtr->style = zoomDocProc;
- } else if (strcmp(argv[3], "zoomNoGrow") == 0) {
- wmPtr->style = zoomNoGrow;
- } else if (strcmp(argv[3], "rDocProc") == 0) {
- wmPtr->style = rDocProc;
- } else if (strcmp(argv[3], "floatProc") == 0) {
- wmPtr->style = floatGrowProc;
- } else if (strcmp(argv[3], "floatGrowProc") == 0) {
- wmPtr->style = floatGrowProc;
- } else if (strcmp(argv[3], "floatZoomProc") == 0) {
- wmPtr->style = floatZoomGrowProc;
- } else if (strcmp(argv[3], "floatZoomGrowProc") == 0) {
- wmPtr->style = floatZoomGrowProc;
- } else if (strcmp(argv[3], "floatSideProc") == 0) {
- wmPtr->style = floatSideGrowProc;
- } else if (strcmp(argv[3], "floatSideGrowProc") == 0) {
- wmPtr->style = floatSideGrowProc;
- } else if (strcmp(argv[3], "floatSideZoomProc") == 0) {
- wmPtr->style = floatSideZoomGrowProc;
- } else if (strcmp(argv[3], "floatSideZoomGrowProc") == 0) {
- wmPtr->style = floatSideZoomGrowProc;
- } else {
- Tcl_AppendResult(interp, "bad style: should be documentProc, ",
- "dBoxProc, plainDBox, altDBoxProc, movableDBoxProc, ",
- "zoomDocProc, rDocProc, floatProc, floatZoomProc, ",
- "floatSideProc, or floatSideZoomProc",
- (char *) NULL);
- return TCL_ERROR;
- }
- } else if (argc == 5) {
- int oldClass = wmPtr->macClass;
- int oldAttributes = wmPtr->attributes;
-
- if (strcmp(argv[3], "alert") == 0) {
- wmPtr->macClass = kAlertWindowClass;
- } else if (strcmp(argv[3], "moveableAlert") == 0) {
- wmPtr->macClass = kMovableAlertWindowClass;
- } else if (strcmp(argv[3], "modal") == 0) {
- wmPtr->macClass = kModalWindowClass;
- } else if (strcmp(argv[3], "moveableModal") == 0) {
- wmPtr->macClass = kMovableModalWindowClass;
- } else if (strcmp(argv[3], "floating") == 0) {
- wmPtr->macClass = kFloatingWindowClass;
- } else if (strcmp(argv[3], "document") == 0) {
- wmPtr->macClass = kDocumentWindowClass;
- } else {
- wmPtr->macClass = oldClass;
- Tcl_AppendResult(interp, "bad class: should be alert, ",
- "moveableAlert, modal, moveableModal, floating, ",
- "or document",
- (char *) NULL);
- return TCL_ERROR;
- }
-
- if (strcmp(argv[4], "none") == 0) {
- wmPtr->attributes = kWindowNoAttributes;
- } else if (strcmp(argv[4], "standardDocument") == 0) {
- wmPtr->attributes = kWindowStandardDocumentAttributes;
- } else if (strcmp(argv[4], "standardFloating") == 0) {
- wmPtr->attributes = kWindowStandardFloatingAttributes;
- } else {
- int foundOne = 0;
- int attrArgc, i;
- CONST char **attrArgv = NULL;
-
- if (Tcl_SplitList(interp, argv[4], &attrArgc, &attrArgv) != TCL_OK) {
- wmPtr->macClass = oldClass;
- Tcl_AppendResult(interp, "Ill-formed attributes list: \"",
- argv[4], "\".", (char *) NULL);
- return TCL_ERROR;
- }
-
- wmPtr->attributes = kWindowNoAttributes;
-
- for (i = 0; i < attrArgc; i++) {
- if ((*attrArgv[i] == 'c')
- && (strcmp(attrArgv[i], "closeBox") == 0)) {
- wmPtr->attributes |= kWindowCloseBoxAttribute;
- foundOne = 1;
- } else if ((*attrArgv[i] == 'h')
- && (strcmp(attrArgv[i], "horizontalZoom") == 0)) {
- wmPtr->attributes |= kWindowHorizontalZoomAttribute;
- foundOne = 1;
- } else if ((*attrArgv[i] == 'v')
- && (strcmp(attrArgv[i], "verticalZoom") == 0)) {
- wmPtr->attributes |= kWindowVerticalZoomAttribute;
- foundOne = 1;
- } else if ((*attrArgv[i] == 'c')
- && (strcmp(attrArgv[i], "collapseBox") == 0)) {
- wmPtr->attributes |= kWindowCollapseBoxAttribute;
- foundOne = 1;
- } else if ((*attrArgv[i] == 'r')
- && (strcmp(attrArgv[i], "resizable") == 0)) {
- wmPtr->attributes |= kWindowResizableAttribute;
- foundOne = 1;
- } else if ((*attrArgv[i] == 's')
- && (strcmp(attrArgv[i], "sideTitlebar") == 0)) {
- wmPtr->attributes |= kWindowSideTitlebarAttribute;
- foundOne = 1;
- } else {
- foundOne = 0;
- break;
- }
- }
-
- if (attrArgv != NULL) {
- ckfree ((char *) attrArgv);
- }
-
- if (foundOne != 1) {
- wmPtr->macClass = oldClass;
- wmPtr->attributes = oldAttributes;
-
- Tcl_AppendResult(interp, "bad attribute: \"", argv[4],
- "\", should be standardDocument, ",
- "standardFloating, or some combination of ",
- "closeBox, horizontalZoom, verticalZoom, ",
- "collapseBox, resizable, or sideTitlebar.",
- (char *) NULL);
- return TCL_ERROR;
- }
- }
-
- wmPtr->style = -1;
- }
- } else {
- Tcl_AppendResult(interp, "unknown or ambiguous option \"", argv[1],
- "\": must be style",
- (char *) NULL);
- return TCL_ERROR;
- }
-
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpMakeMenuWindow --
- *
- * Configure the window to be either a undecorated pull-down
- * (or pop-up) menu, or as a toplevel floating menu (palette).
- *
- * Results:
- * None.
- *
- * Side effects:
- * Changes the style bit used to create a new Mac toplevel.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpMakeMenuWindow(
- Tk_Window tkwin, /* New window. */
- int transient) /* 1 means menu is only posted briefly as
- * a popup or pulldown or cascade. 0 means
- * menu is always visible, e.g. as a
- * floating menu. */
-{
- if (transient) {
- ((TkWindow *) tkwin)->wmInfoPtr->style = plainDBox;
- } else {
- ((TkWindow *) tkwin)->wmInfoPtr->style = floatProc;
- ((TkWindow *) tkwin)->wmInfoPtr->flags |= WM_WIDTH_NOT_RESIZABLE;
- ((TkWindow *) tkwin)->wmInfoPtr->flags |= WM_HEIGHT_NOT_RESIZABLE;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacMakeRealWindowExist --
- *
- * This function finally creates the real Macintosh window that
- * the Mac actually understands.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A new Macintosh toplevel is created.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacMakeRealWindowExist(
- TkWindow *winPtr) /* Tk window. */
-{
- WmInfo *wmPtr = winPtr->wmInfoPtr;
- WindowRef newWindow = NULL;
- MacDrawable *macWin;
- Rect geometry = {0,0,0,0};
- Tcl_HashEntry *valueHashPtr;
- int new;
- TkMacWindowList *listPtr;
-
- if (TkMacHostToplevelExists(winPtr)) {
- return;
- }
-
- macWin = (MacDrawable *) winPtr->window;
-
- /*
- * If this is embedded, make sure its container's toplevel exists,
- * then return...
- */
-
- if (Tk_IsEmbedded(winPtr)) {
- TkWindow *contWinPtr;
-
- contWinPtr = TkpGetOtherWindow(winPtr);
- if (contWinPtr != NULL) {
- TkMacMakeRealWindowExist(contWinPtr->privatePtr->toplevel->winPtr);
- macWin->flags |= TK_HOST_EXISTS;
- return;
- } else if (gMacEmbedHandler != NULL) {
- if (gMacEmbedHandler->containerExistProc != NULL) {
- if (gMacEmbedHandler->containerExistProc((Tk_Window) winPtr) != TCL_OK) {
- panic("ContainerExistProc could not make container");
- }
- }
- return;
- } else {
- panic("TkMacMakeRealWindowExist could not find container");
- }
-
- /*
- * NOTE: Here we should handle out of process embedding.
- */
-
- }
-
- InitialWindowBounds(winPtr, &geometry);
-
- if (TkMacHaveAppearance() >= 0x110 && wmPtr->style == -1) {
- OSStatus err;
- /*
- * There seems to be a bug in CreateNewWindow: If I set the
- * window geometry to be the too small for the structure region,
- * then the whole window is positioned incorrectly.
- * Adding this here makes the positioning work, and the size will
- * get overwritten when you actually map the contents of the window.
- */
-
- geometry.right += 64;
- geometry.bottom += 24;
- err = CreateNewWindow(wmPtr->macClass, wmPtr->attributes,
- &geometry, &newWindow);
- if (err != noErr) {
- newWindow = NULL;
- }
-
- } else {
- newWindow = NewCWindow(NULL, &geometry, "\ptemp", false,
- (short) wmPtr->style, (WindowRef) -1, true, 0);
- }
-
- if (newWindow == NULL) {
- panic("couldn't allocate new Mac window");
- }
-
- /*
- * Add this window to the list of toplevel windows.
- */
-
- listPtr = (TkMacWindowList *) ckalloc(sizeof(TkMacWindowList));
- listPtr->nextPtr = tkMacWindowListPtr;
- listPtr->winPtr = winPtr;
- tkMacWindowListPtr = listPtr;
-
- macWin->portPtr = (GWorldPtr) newWindow;
- tkMacMoveWindow(newWindow, (int) geometry.left, (int) geometry.top);
- SetPort((GrafPtr) newWindow);
-
- if (!windowHashInit) {
- Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS);
- windowHashInit = true;
- }
- valueHashPtr = Tcl_CreateHashEntry(&windowTable,
- (char *) newWindow, &new);
- if (!new) {
- panic("same macintosh window allocated twice!");
- }
- Tcl_SetHashValue(valueHashPtr, macWin);
-
- macWin->flags |= TK_HOST_EXISTS;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacRegisterOffScreenWindow --
- *
- * This function adds the passed in Off Screen Port to the
- * hash table that maps Mac windows to root X windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * An entry is added to the windowTable hash table.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacRegisterOffScreenWindow(
- Window window, /* Window structure. */
- GWorldPtr portPtr) /* Pointer to a Mac GWorld. */
-{
- WindowRef newWindow = NULL;
- MacDrawable *macWin;
- Tcl_HashEntry *valueHashPtr;
- int new;
-
- macWin = (MacDrawable *) window;
- if (!windowHashInit) {
- Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS);
- windowHashInit = true;
- }
- valueHashPtr = Tcl_CreateHashEntry(&windowTable,
- (char *) portPtr, &new);
- if (!new) {
- panic("same macintosh window allocated twice!");
- }
- Tcl_SetHashValue(valueHashPtr, macWin);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacUnregisterMacWindow --
- *
- * Given a macintosh port window, this function removes the
- * association between this window and the root X window that
- * Tk cares about.
- *
- * Results:
- * None.
- *
- * Side effects:
- * An entry is removed from the windowTable hash table.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacUnregisterMacWindow(
- GWorldPtr portPtr) /* Pointer to a Mac GWorld. */
-{
- if (!windowHashInit) {
- panic("TkMacUnregisterMacWindow: unmapping before inited");;
- }
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&windowTable,
- (char *) portPtr));
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacSetScrollbarGrow --
- *
- * Sets a flag for a toplevel window indicating that the passed
- * Tk scrollbar window will display the grow region for the
- * toplevel window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * A flag is set int windows toplevel parent.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacSetScrollbarGrow(
- TkWindow *winPtr, /* Tk scrollbar window. */
- int flag) /* Boolean value true or false. */
-{
- if (flag) {
- winPtr->privatePtr->toplevel->flags |= TK_SCROLLBAR_GROW;
- winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr = winPtr;
- } else if (winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr
- == winPtr) {
- winPtr->privatePtr->toplevel->flags &= ~TK_SCROLLBAR_GROW;
- winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr = NULL;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacGetScrollbarGrowWindow --
- *
- * Tests to see if a given window's toplevel window contains a
- * scrollbar that will draw the GrowIcon for the window.
- *
- * Results:
- * Boolean value.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkWindow *
-TkMacGetScrollbarGrowWindow(
- TkWindow *winPtr) /* Tk window. */
-{
- TkWindow *scrollWinPtr;
-
- if (winPtr == NULL) {
- return NULL;
- }
- scrollWinPtr =
- winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr;
- if (winPtr != NULL) {
- /*
- * We need to confirm the window exists.
- */
- if ((Tk_Window) scrollWinPtr !=
- Tk_IdToWindow(winPtr->display, winPtr->window)) {
- scrollWinPtr = NULL;
- }
- }
- return scrollWinPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkWmFocusToplevel --
- *
- * This is a utility procedure invoked by focus-management code. It
- * exists because of the extra wrapper windows that exist under
- * Unix; its job is to map from wrapper windows to the
- * corresponding toplevel windows. On PCs and Macs there are no
- * wrapper windows so no mapping is necessary; this procedure just
- * determines whether a window is a toplevel or not.
- *
- * Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkWindow *
-TkWmFocusToplevel(
- TkWindow *winPtr) /* Window that received a focus-related
- * event. */
-{
- if (!(winPtr->flags & TK_TOP_HIERARCHY)) {
- return NULL;
- }
- return winPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpGetWrapperWindow --
- *
- * This is a utility procedure invoked by focus-management code. It
- * maps to the wrapper for a top-level, which is just the same
- * as the top-level on Macs and PCs.
- *
- * Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-TkWindow *
-TkpGetWrapperWindow(
- TkWindow *winPtr) /* Window that received a focus-related
- * event. */
-{
- if (!(winPtr->flags & TK_TOP_LEVEL)) {
- return NULL;
- }
- return winPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpWmSetState --
- *
- * Sets the window manager state for the wrapper window of a
- * given toplevel window.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May maximize, minimize, restore, or withdraw a window.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpWmSetState(winPtr, state)
- TkWindow *winPtr; /* Toplevel window to operate on. */
- int state; /* One of IconicState, ZoomState, NormalState,
- * or WithdrawnState. */
-{
- WmInfo *wmPtr = winPtr->wmInfoPtr;
- GWorldPtr macWin;
-
- wmPtr->hints.initial_state = state;
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- return;
- }
-
- macWin = TkMacGetDrawablePort(winPtr->window);
-
- if (state == WithdrawnState) {
- Tk_UnmapWindow((Tk_Window) winPtr);
- } else if (state == IconicState) {
- Tk_UnmapWindow((Tk_Window) winPtr);
- if (TkMacHaveAppearance()) {
- /*
- * The window always gets unmapped. However, if we can show the
- * icon version of the window (collapsed) we make the window visable
- * and then collapse it.
- *
- * TODO: This approach causes flashing!
- */
-
- if (IsWindowCollapsable((WindowRef) macWin)) {
- ShowWindow((WindowRef) macWin);
- CollapseWindow((WindowPtr) macWin, true);
- }
- }
- } else if (state == NormalState) {
- Tk_MapWindow((Tk_Window) winPtr);
- if (TkMacHaveAppearance()) {
- CollapseWindow((WindowPtr) macWin, false);
- }
- } else if (state == ZoomState) {
- /* TODO: need to support zoomed windows */
- }
-}
-/*
- *----------------------------------------------------------------------
- *
- * TkMacHaveAppearance --
- *
- * Determine if the appearance manager is available on this Mac.
- * We cache the result so future calls are fast. Return a different
- * value if 1.0.1 is present, since many interfaces were added in
- * 1.0.1
- *
- * Results:
- * 1 if the appearance manager is present, 2 if the appearance
- * manager version is 1.0.1 or greater, 0 if it is not present.
- *
- * Side effects:
- * Calls Gestalt to query system values.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacHaveAppearance()
-{
- static initialized = false;
- static int TkMacHaveAppearance = 0;
- long response = 0;
- OSErr err = noErr;
-
- if (!initialized) {
- err = Gestalt(gestaltAppearanceAttr, &response);
- if (err == noErr) {
- TkMacHaveAppearance = 1;
- }
-/* even if AppearanceManager 1.1 routines are present,
-we can't call them from 68K code, so we pretend
-to be running Apperarance Mgr 1.0 */
-#if !(GENERATING68K && !GENERATINGCFM)
- err = Gestalt(gestaltAppearanceVersion, &response);
-#endif
- if (err == noErr) {
- TkMacHaveAppearance = (int) response;
- }
- }
-
- return TkMacHaveAppearance;
-}
diff --git a/mac/tkMacXCursors.r b/mac/tkMacXCursors.r
deleted file mode 100644
index 1cba473..0000000
--- a/mac/tkMacXCursors.r
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- * tkMacXCursors.r --
- *
- * This file defines a set of Macintosh cursor resources that
- * emulate the X cursor set. All of these cursors were
- * constructed and donated by Grant Neufeld. (gneufeld@ccs.carleton.ca)
- *
- *
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-/*
- * All of the X cursors are defined as 'CURS' resources. However, a
- * subset of the X cursors are also defined as 'crsr' resources. Tk
- * will attempt to first use the color cursors ('crsr') if it doesn't
- * exist it will attempt to use the black & white cursor ('CURS').
- */
-
-data 'CURS' (3000, "X_cursor") {
- $"E007 F00F F81F 7C3E 3E7C 1FF8 0FF0 07E0"
- $"07E0 0FF0 1FF8 3E7C 7C3E F81F F00F E007"
- $"0000 6006 700E 381C 1C38 0E70 07E0 03C0"
- $"03C0 07E0 0E70 1C38 381C 700E 6006 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3001, "arrow") {
- $"0000 0006 001E 007C 01FC 07F8 00F8 01F0"
- $"03B0 0720 0E20 1C00 3800 7000 2000 0000"
- $"0007 001F 007F 01FE 07FE 1FFC 7FFC 03F8"
- $"07F8 0FF0 1F70 3E60 7C60 F840 7040 2000"
- $"0001 000E"
-};
-
-data 'CURS' (3002, "based_arrow_down") {
- $"0000 0000 0000 1FE0 0000 1FE0 0300 0300"
- $"0300 0B40 0780 0300 0000 0000 0000 0000"
- $"0000 0000 0000 1FE0 0000 1FE0 0780 0780"
- $"3FF0 1FE0 0FC0 0780 0300 0000 0000 0000"
- $"000B 0006"
-};
-
-data 'CURS' (3003, "based_arrow_up") {
- $"0000 0000 0000 0000 0300 0780 0B40 0300"
- $"0300 0300 1FE0 0000 1FE0 0000 0000 0000"
- $"0000 0000 0000 0300 0780 0FC0 1FE0 3FF0"
- $"0780 0780 1FE0 0000 1FE0 0000 0000 0000"
- $"0004 0006"
-};
-
-data 'CURS' (3004, "boat") {
- $"0000 0000 0000 0000 0100 03C0 8460 FFFF"
- $"0018 0020 0040 FFC0 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0100 03C0 87E0 FFFF"
- $"FFF8 FFE0 FFC0 FFC0 0000 0000 0000 0000"
- $"0007 000F"
-};
-
-data 'CURS' (3005, "bogosity") {
- $"0000 711C 1110 1110 1110 7FFC 5114 5114"
- $"5114 5114 7FFC 1110 1110 1110 711C 0000"
- $"0000 0000 0000 0000 0000 7FFC 7FFC 7FFC"
- $"7FFC 7FFC 7FFC 0000 0000 0000 0000 0000"
- $"0001 0007"
-};
-
-data 'CURS' (3006, "bottom_left_corner") {
- $"0000 0000 0000 0000 C000 C020 C840 C880"
- $"C900 CA00 CC00 CFC0 C000 C000 FFF0 FFF0"
- $"0000 0000 0000 0000 0000 0020 0840 0880"
- $"0900 0A00 0C00 0FC0 0000 0000 0000 0000"
- $"000F 0000"
-};
-
-data 'CURS' (3007, "bottom_right_corner") {
- $"0000 0000 0000 0000 0003 0403 0213 0113"
- $"0093 0053 0033 03F3 0003 0003 0FFF 0FFF"
- $"0000 0000 0000 0000 0000 0400 0210 0110"
- $"0090 0050 0030 03F0 0000 0000 0000 0000"
- $"000F 000F"
-};
-
-data 'CURS' (3008, "bottom_side") {
- $"0000 0000 0100 0100 0100 0100 0100 1110"
- $"0920 0540 0380 0100 0000 7FFC 7FFC 0000"
- $"0000 0000 0100 0100 0100 0100 0100 1110"
- $"0920 0540 0380 0100 0000 0000 0000 0000"
- $"000B 0007"
-};
-
-data 'CURS' (3009, "bottom_tee") {
- $"0000 0000 0000 0180 0180 0180 0180 0180"
- $"0180 0180 7FFE 7FFE 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"000B 0007"
-};
-
-data 'CURS' (3010, "box_spiral") {
- $"FFFE 8000 BFFE A002 AFFA A80A ABEA AA2A"
- $"AAAA ABAA A82A AFEA A00A BFFA 8002 FFFE"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0008 0008"
-};
-
-data 'CURS' (3011, "center_ptr") {
- $"0000 0300 0300 0780 0780 0FC0 0FC0 1FE0"
- $"1FE0 3330 2310 0300 0300 0300 0300 0000"
- $"0300 0780 0780 0FC0 0FC0 1FE0 1FE0 3FF0"
- $"3FF0 7FF8 77B8 6798 0780 0780 0780 0780"
- $"0001 0006"
-};
-
-data 'CURS' (3012, "circle") {
- $"0000 03C0 0FF0 1FF8 3C3C 381C 700E 700E"
- $"700E 700E 381C 3C3C 1FF8 0FF0 03C0 0000"
- $"03C0 0FF0 1FF8 3FFC 7FFE 7C3E F81F F81F"
- $"F81F F81F 7C3E 7FFE 3FFC 1FF8 0FF0 03C0"
- $"0007 0007"
-};
-
-data 'CURS' (3013, "clock") {
- $"1FF8 33CC 6466 4992 4F12 4422 63C6 3FFC"
- $"2994 2994 2994 2BD4 6996 781E 7FFE 7FFE"
- $"1FF8 3FFC 7FFE 7FFE 7FFE 7FFE 7FFE 3FFC"
- $"3FFC 3FFC 3FFC 3FFC 7FFE 7FFE 7FFE 7FFE"
- $"0004 0008"
-};
-
-data 'CURS' (3014, "coffee_mug") {
- $"03F8 0C06 1001 1C07 33F9 7001 D001 9001"
- $"960D DA55 7A55 36ED 10A1 1001 0802 07FC"
- $"03F8 0FFE 1FFF 1FFF 3FFF 7FFF FFFF FFFF"
- $"FFFF FFFF 7FFF 3FFF 1FFF 1FFF 0FFE 07FC"
- $"0004 0003"
-};
-
-data 'CURS' (3015, "cross") {
- $"0280 0280 0280 0280 0280 0280 FEFE 0000"
- $"FEFE 0280 0280 0280 0280 0280 0280 0000"
- $"0380 0380 0380 0380 0380 0380 FFFE FFFE"
- $"FFFE 0380 0380 0380 0380 0380 0380 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3016, "cross_reverse") {
- $"4284 A28A 5294 2AA8 16D0 0AA0 FD7E 0280"
- $"FD7E 0AA0 16D0 2AA8 5294 A28A 4284 0000"
- $"4384 E38E 739C 3BB8 1FF0 0FE0 FFFE FFFE"
- $"FFFE 0FE0 1FF0 3BB8 739C E38E 4384 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3017, "crosshair") {
- $"0100 0100 0100 0100 0100 0100 0100 FEFE"
- $"0100 0100 0100 0100 0100 0100 0100 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3018, "diamond_cross") {
- $"0280 06C0 0AA0 1290 2288 4284 FEFE 0000"
- $"FEFE 4284 2288 1290 0AA0 06C0 0280 0000"
- $"0280 06C0 0EE0 1EF0 3EF8 7EFC FEFE 0000"
- $"FEFE 7EFC 3EF8 1EF0 0EE0 06C0 0280 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3019, "dot") {
- $"0000 0000 0780 1FE0 1FE0 3FF0 3FF0 3FF0"
- $"3FF0 1FE0 1FE0 0780 0000 0000 0000 0000"
- $"0000 0780 1FE0 3FF0 3FF0 7FF8 7FF8 7FF8"
- $"7FF8 3FF0 3FF0 1FE0 0780 0000 0000 0000"
- $"0006 0006"
-};
-
-data 'CURS' (3020, "dotbox") {
- $"0000 0000 3FFC 2004 2004 2004 2004 2184"
- $"2184 2004 2004 2004 2004 3FFC 0000 0000"
- $"0000 0000 3FFC 3FFC 300C 300C 318C 33CC"
- $"33CC 318C 300C 300C 3FFC 3FFC 0000 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3021, "double_arrow") {
- $"0000 0180 03C0 07E0 0DB0 1998 0180 0180"
- $"0180 0180 1998 0DB0 07E0 03C0 0180 0000"
- $"0180 03C0 07E0 0FF0 1FF8 3FFC 3BDC 03C0"
- $"03C0 3BDC 3FFC 1FF8 0FF0 07E0 03C0 0180"
- $"0007 0007"
-};
-
-data 'CURS' (3022, "draft_large") {
- $"0000 0002 000C 003C 00F8 03F8 0FF0 00F0"
- $"0160 0260 0440 0840 1000 2000 4000 0000"
- $"0003 000F 003E 00FE 03FC 0FFC 3FF8 FFF8"
- $"03F0 07F0 0EE0 1CE0 38C0 70C0 E080 4080"
- $"0001 000E"
-};
-
-data 'CURS' (3023, "draft_small") {
- $"0000 0002 000C 003C 00F8 03F8 0070 00B0"
- $"0120 0220 0400 0800 1000 2000 4000 0000"
- $"0003 000F 003E 00FE 03FC 0FFC 3FF8 01F8"
- $"03F0 0770 0E60 1C60 3840 7040 E000 4000"
- $"0001 000E"
-};
-
-data 'CURS' (3024, "draped_box") {
- $"0000 0000 3FFC 2244 2664 2C34 381C 2184"
- $"2184 381C 2C34 2664 2244 3FFC 0000 0000"
- $"0000 0000 3FFC 3E7C 3E7C 3C3C 399C 23C4"
- $"23C4 399C 3C3C 3E7C 3E7C 3FFC 0000 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3025, "exchange") {
- $"0000 47C0 6FE0 7C30 4810 4C00 7E00 0000"
- $"0000 00FC 0064 1024 187C 0FEC 07C4 0000"
- $"C7C0 EFE0 FFF0 FFF8 FC38 FE10 FF00 FF80"
- $"03FE 01FE 10FE 387E 3FFE 1FFE 0FEE 07C6"
- $"0007 0007"
-};
-
-data 'CURS' (3026, "fleur") {
- $"0000 0180 03C0 07E0 0180 1188 318C 7FFE"
- $"7FFE 318C 1188 0180 07E0 03C0 0180 0000"
- $"0180 03C0 07E0 0FF0 17E8 3BDC 7FFE FFFF"
- $"FFFF 7FFE 3BDC 17E8 0FF0 07E0 03C0 0180"
- $"0007 0007"
-};
-
-data 'CURS' (3027, "gobbler") {
- $"0000 0078 0070 4036 4FB0 7FF0 7E30 7C30"
- $"3038 00F0 0FE0 0400 0400 0400 0F00 0000"
- $"00FC 00FC E0FF FFFF FFFF FFF8 FFF8 FFF8"
- $"FFFC 7FFC 3FF8 1FF0 0E00 1F80 1F80 1F80"
- $"0003 000E"
-};
-
-data 'CURS' (3028, "gumby") {
- $"3F00 10C0 C820 EAA0 C820 CBA0 F838 383E"
- $"0826 0826 092E 0926 0920 1110 2108 3EF8"
- $"3F00 1FC0 CFE0 EFE0 CFE0 CFE0 FFF8 3FFE"
- $"0FE6 0FE6 0FEE 0FE6 0FE0 1FF0 3FF8 3EF8"
- $"0000 0002"
-};
-
-data 'CURS' (3029, "hand1") {
- $"000C 003C 00F0 01E0 03C0 07E0 0FF0 2FE0"
- $"7FF0 5FF0 07E0 07C0 4A00 6200 3400 1800"
- $"000C 003C 00F0 01E0 03C0 07E0 0FF0 2FE0"
- $"7FF0 7FF0 7FE0 7FC0 7E00 7E00 3C00 1800"
- $"0000 000D"
-};
-
-data 'CURS' (3030, "hand2") {
- $"0000 3FC0 4020 3F10 0808 0708 0808 0714"
- $"0822 0641 0182 0124 0088 0050 0020 0000"
- $"0000 3FC0 7FE0 3FF0 0FF8 07F8 0FF8 07FC"
- $"0FFE 07FF 01FE 01FC 00F8 0070 0020 0000"
- $"0002 0001"
-};
-
-data 'CURS' (3031, "heart") {
- $"0000 3EF8 638C C106 8002 8002 8002 8002"
- $"C006 600C 3018 1830 0C60 06C0 0380 0000"
- $"0000 3EF8 7FFC FFFE FFFE FFFE FFFE FFFE"
- $"FFFE 7FFC 3FF8 1FF0 0FE0 07C0 0380 0000"
- $"0003 0007"
-};
-
-data 'CURS' (3032, "icon") {
- $"FFFF D555 AAAB D555 A00B D005 A00B D005"
- $"A00B D005 A00B D005 AAAB D555 AAAB FFFF"
- $"FFFF FFFF FFFF FFFF F00F F00F F00F F00F"
- $"F00F F00F F00F F00F FFFF FFFF FFFF FFFF"
- $"0007 0007"
-};
-
-data 'CURS' (3033, "iron_cross") {
- $"0000 3FFC 1FF8 4FF2 67E6 73CE 799E 7FFE"
- $"7FFE 799E 73CE 67E6 4FF2 1FF8 3FFC 0000"
- $"7FFE 7FFE FFFF FFFF FFFF FFFF FFFF FFFF"
- $"FFFF FFFF FFFF FFFF FFFF FFFF 7FFE 7FFE"
- $"0007 0006"
-};
-
-data 'CURS' (3034, "left_ptr") {
- $"0000 0800 0C00 0E00 0F00 0F80 0FC0 0FE0"
- $"0FF0 0F80 0D80 08C0 00C0 0060 0060 0000"
- $"1800 1C00 1E00 1F00 1F80 1FC0 1FE0 1FF0"
- $"1FF8 1FFC 1FC0 1DE0 19E0 10F0 00F0 0070"
- $"0001 0004"
-};
-
-data 'CURS' (3035, "left_side") {
- $"0000 6000 6000 6080 6100 6200 6400 6FFC"
- $"6400 6200 6100 6080 6000 6000 0000 0000"
- $"0000 0000 0000 0080 0100 0200 0400 0FFC"
- $"0400 0200 0100 0080 0000 0000 0000 0000"
- $"0007 0004"
-};
-
-data 'CURS' (3036, "left_tee") {
- $"0000 0C00 0C00 0C00 0C00 0C00 0C00 0FF8"
- $"0FF8 0C00 0C00 0C00 0C00 0C00 0C00 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0007 0004"
-};
-
-data 'CURS' (3037, "leftbutton") {
- $"8002 7FFC 7FFC 4444 4554 4554 4554 4554"
- $"4444 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 8002"
- $"FFFE FFFE FFFE FFFE FFFE FFFE FFFE FFFE"
- $"FFFE FFFE FFFE FFFE FFFE FFFE FFFE FFFE"
- $"0004 0003"
-};
-
-data 'CURS' (3038, "ll_angle") {
- $"0000 0000 0000 0C00 0C00 0C00 0C00 0C00"
- $"0C00 0C00 0FF8 0FF8 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"000B 0004"
-};
-
-data 'CURS' (3039, "lr_angle") {
- $"0000 0000 0000 0030 0030 0030 0030 0030"
- $"0030 0030 1FF0 1FF0 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"000B 000B"
-};
-
-data 'CURS' (3040, "man") {
- $"0380 1EF0 0280 8100 4387 244B 1D70 0540"
- $"0440 0280 0440 0920 1290 1450 783C F83F"
- $"0380 1FF0 0380 8100 4387 27CB 1FF0 07C0"
- $"07C0 0380 07C0 0FE0 1EF0 1C70 783C F83F"
- $"0001 0007"
-};
-
-data 'CURS' (3041, "middlebutton") {
- $"8002 7FFC 7FFC 4444 5454 5454 5454 5454"
- $"4444 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 8002"
- $"FFFE FFFE FFFE FFFE FFFE FFFE FFFE FFFE"
- $"FFFE FFFE FFFE FFFE FFFE FFFE FFFE FFFE"
- $"0004 0007"
-};
-
-data 'CURS' (3042, "mouse") {
- $"0600 0100 0180 0FF0 1008 17E8 1428 1428"
- $"17E8 1008 1008 1008 1008 1008 1008 0FF0"
- $"0600 0100 0180 0FF0 1FF8 1FF8 1FF8 1FF8"
- $"1FF8 1FF8 1FF8 1FF8 1FF8 1FF8 1FF8 0FF0"
- $"0000 0000"
-};
-
-data 'CURS' (3043, "pencil") {
- $"0000 00F0 0088 0108 0190 0270 0220 0440"
- $"0440 0880 0880 1100 1E00 1C00 1800 1000"
- $"0000 00F0 00F8 01F8 01F0 03F0 03E0 07C0"
- $"07C0 0F80 0F80 1F00 1E00 1C00 1800 1000"
- $"000F 0003"
-};
-
-data 'CURS' (3044, "pirate") {
- $"03C0 07E0 0FF0 1998 1998 0FF0 07E0 03C0"
- $"43C2 43C3 2184 1C38 03C0 0FF1 781F 4002"
- $"07E0 0FF0 1FF8 3FFC 3FFC 1FF8 0FF0 47E2"
- $"E7E7 E7E7 7FFF 3FFC 1FF9 7FFF FFFF F81F"
- $"000A 0007"
-};
-
-data 'CURS' (3045, "plus") {
- $"0000 0000 0000 0180 0180 0180 0180 1FF8"
- $"1FF8 0180 0180 0180 0180 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3046, "question_arrow") {
- $"07C0 0FE0 1C70 1830 1C30 0C70 00E0 03C0"
- $"0380 0280 0280 0EE0 06C0 0380 0100 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 3FF8 1FF0 0FE0 07C0 0380 0100"
- $"000E 0007"
-};
-
-data 'CURS' (3047, "right_ptr") {
- $"0000 0010 0030 0070 00F0 01F0 03F0 07F0"
- $"0FF0 01F0 01B0 0310 0300 0600 0600 0000"
- $"0018 0038 0078 00F8 01F8 03F8 07F8 0FF8"
- $"1FF8 3FF8 03F8 07B8 0798 0F08 0F00 0E00"
- $"0001 000B"
-};
-
-data 'CURS' (3048, "right_side") {
- $"0000 0000 0006 0006 0106 0086 0046 0026"
- $"3FF6 0026 0046 0086 0106 0006 0006 0000"
- $"0000 0000 0000 0000 0100 0080 0040 0020"
- $"3FF0 0020 0040 0080 0100 0000 0000 0000"
- $"0008 000B"
-};
-
-data 'CURS' (3049, "right_tee") {
- $"0000 0030 0030 0030 0030 0030 0030 1FF0"
- $"1FF0 0030 0030 0030 0030 0030 0030 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0007 000A"
-};
-
-data 'CURS' (3050, "rightbutton") {
- $"8002 7FFC 7FFC 4444 5544 5544 5544 5544"
- $"4444 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 8002"
- $"FFFE FFFE FFFE FFFE FFFE FFFE FFFE FFFE"
- $"FFFE FFFE FFFE FFFE FFFE FFFE FFFE FFFE"
- $"0004 0003"
-};
-
-data 'CURS' (3051, "rtl_logo") {
- $"0000 7FFE 4022 4022 4022 7FE2 4422 4422"
- $"4422 4422 47FE 4402 4402 4402 7FFE 0000"
- $"0000 7FFE 7FFE 6076 7FF6 7FF6 7C36 6C36"
- $"6C36 6C3E 6FFE 6FFE 6E06 7FFE 7FFE 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3052, "sailboat") {
- $"0000 0040 0040 0160 0160 0360 0370 0770"
- $"0770 0F78 0F78 1F78 1F7C 3E38 0000 0000"
- $"0040 00E0 01E0 03F0 03F0 07F0 07F8 0FF8"
- $"0FF8 1FFC 1FFC 3FFC 3FFE 7F7C 7E38 0000"
- $"000C 0008"
-};
-
-data 'CURS' (3053, "sb_down_arrow") {
- $"0280 0280 0280 0280 0280 0280 0280 0280"
- $"0280 0280 0280 0FE0 07C0 0380 0100 0000"
- $"0380 0380 0380 0380 0380 0380 0380 0380"
- $"0380 0380 0380 1FF0 0FE0 07C0 0380 0100"
- $"000E 0007"
-};
-
-data 'CURS' (3054, "sb_h_double_arrow") {
- $"0000 0000 0000 0000 0810 1818 3FFC 781E"
- $"3FFC 1818 0810 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0810 1818 381C 7FFE FFFF"
- $"7FFE 381C 1818 0810 0000 0000 0000 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3055, "sb_left_arrow") {
- $"0000 0000 0000 0000 0800 1800 3FFF 7800"
- $"3FFF 1800 0800 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0800 1800 3800 7FFF FFFF"
- $"7FFF 3800 1800 0800 0000 0000 0000 0000"
- $"0007 0001"
-};
-
-data 'CURS' (3056, "sb_right_arrow") {
- $"0000 0000 0000 0000 0000 0010 0018 FFFC"
- $"001E FFFC 0018 0010 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0010 0018 001C FFFE"
- $"FFFF FFFE 001C 0018 0010 0000 0000 0000"
- $"0008 000E"
-};
-
-data 'CURS' (3057, "sb_up_arrow") {
- $"0000 0080 01C0 03E0 07F0 0140 0140 0140"
- $"0140 0140 0140 0140 0140 0140 0140 0140"
- $"0080 01C0 03E0 07F0 0FF8 01C0 01C0 01C0"
- $"01C0 01C0 01C0 01C0 01C0 01C0 01C0 01C0"
- $"0001 0008"
-};
-
-data 'CURS' (3058, "sb_v_double_arrow") {
- $"0000 0100 0380 07C0 0FE0 0280 0280 0280"
- $"0280 0280 0280 0FE0 07C0 0380 0100 0000"
- $"0100 0380 07C0 0FE0 1FF0 0380 0380 0380"
- $"0380 0380 0380 1FF0 0FE0 07C0 0380 0100"
- $"0007 0007"
-};
-
-data 'CURS' (3059, "shuttle") {
- $"0020 0070 00F8 01DE 05DE 09DE 11DE 11DE"
- $"11DE 11DE 31DE 71DE FDDE 1888 0078 0030"
- $"0020 0070 00F8 01FE 07FE 0FFE 1FFE 1FFE"
- $"1FFE 1FFE 3FFE 7FFE FFFE 18F8 0078 0030"
- $"0000 000A"
-};
-
-data 'CURS' (3060, "sizing") {
- $"0000 7F80 4000 4000 4000 47E0 4420 4422"
- $"4422 0422 07E2 0012 000A 0006 01FE 0000"
- $"FFC0 FFC0 FFC0 E000 EFF0 EFF0 EC37 EC37"
- $"EC37 EC37 0FF7 0FFF 001F 03FF 03FF 03FF"
- $"000E 000E"
-};
-
-data 'CURS' (3061, "spider") {
- $"2010 1020 1020 0840 0840 8787 6798 1FE0"
- $"1FE0 6798 8787 0840 0840 1020 1020 2010"
- $"7038 3870 3870 1CE0 9FE7 EFDF FFFF 7FF8"
- $"7FF8 FFFF EFDF 9FE7 1CE0 3870 3870 7038"
- $"0007 0007"
-};
-
-data 'CURS' (3062, "spraycan") {
- $"0018 0040 0D18 1E40 1A18 3F00 2100 3900"
- $"2900 3900 2900 3900 3900 2100 2100 3F00"
- $"0000 0000 0C00 1E00 1E00 3F00 3F00 3F00"
- $"3F00 3F00 3F00 3F00 3F00 3F00 3F00 3F00"
- $"0002 0007"
-};
-
-data 'CURS' (3063, "star") {
- $"0100 0280 0280 0280 0440 0440 0440 3938"
- $"C006 3838 0920 1290 2448 2828 3018 2008"
- $"0100 0380 0380 0380 07C0 07C0 07C0 3FF8"
- $"FFFE 3FF8 0FE0 1EF0 3C78 3838 3018 2008"
- $"0007 0007"
-};
-
-data 'CURS' (3064, "target") {
- $"0000 0380 0FE0 1C70 3018 600C C106 C286"
- $"C106 600C 3018 1C70 0FE0 0380 0000 0000"
- $"0000 0380 0FE0 1FF0 3C78 701C E38E E38E"
- $"E38E 701C 3C78 1FF0 0FE0 0380 0000 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3065, "tcross") {
- $"0100 0100 0100 0100 0100 0100 0100 FFFE"
- $"0100 0100 0100 0100 0100 0100 0100 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0007 0007"
-};
-
-data 'CURS' (3066, "top_left_arrow") {
- $"0000 6000 7800 3E00 3F80 1FE0 1E00 0D00"
- $"0C80 0440 0420 0010 0008 0004 0000 0000"
- $"E000 F800 FE00 7F80 7FE0 3FF8 3FFE 1F80"
- $"1FC0 0EE0 0E70 0638 061C 020E 0204 0000"
- $"0001 0001"
-};
-
-data 'CURS' (3067, "top_left_corner") {
- $"FFF0 FFF0 C000 C000 CFC0 CC00 CA00 C900"
- $"C880 C840 C020 C000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0FC0 0C00 0A00 0900"
- $"0880 0840 0020 0000 0000 0000 0000 0000"
- $"0000 0000"
-};
-
-data 'CURS' (3068, "top_right_corner") {
- $"0FFF 0FFF 0003 0003 03F3 0033 0053 0093"
- $"0113 0213 0403 0003 0000 0000 0000 0000"
- $"0000 0000 0000 0000 03F0 0030 0050 0090"
- $"0110 0210 0400 0000 0000 0000 0000 0000"
- $"0000 000F"
-};
-
-data 'CURS' (3069, "top_side") {
- $"0000 7FFC 7FFC 0000 0100 0380 0540 0920"
- $"1110 0100 0100 0100 0100 0100 0000 0000"
- $"0000 0000 0000 0000 0100 0380 0540 0920"
- $"1110 0100 0100 0100 0100 0100 0000 0000"
- $"0004 0007"
-};
-
-data 'CURS' (3070, "top_tee") {
- $"0000 0000 0000 0000 7FFE 7FFE 0180 0180"
- $"0180 0180 0180 0180 0180 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0004 0007"
-};
-
-data 'CURS' (3071, "trek") {
- $"0100 0000 0380 07C0 0FE0 0EE0 0FE0 07C0"
- $"0380 0100 0BA0 0D60 0920 0820 0820 0000"
- $"0000 0380 07C0 0FE0 1FF0 1FF0 1FF0 0FE0"
- $"07C0 0BA0 1FF0 1FF0 1FF0 1D70 1C70 0820"
- $"0000 0007"
-};
-
-data 'CURS' (3072, "ul_angle") {
- $"0000 0000 0000 0FF8 0FF8 0C00 0C00 0C00"
- $"0C00 0C00 0C00 0C00 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0003 0004"
-};
-
-data 'CURS' (3073, "umbrella") {
- $"0000 0890 0228 49A6 27C8 1930 610C 0100"
- $"0100 0100 0100 0100 0140 0140 0080 0000"
- $"0000 0FF0 1FF8 7FFE 7FFC FFFE FBBE E38E"
- $"0380 0380 0380 03C0 03E0 03E0 01C0 0080"
- $"0004 0007"
-};
-
-data 'CURS' (3074, "ur_angle") {
- $"0000 0000 0000 0000 1FF0 1FF0 0030 0030"
- $"0030 0030 0030 0030 0030 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0004 000B"
-};
-
-data 'CURS' (3075, "watch") {
- $"07E0 07E0 07E0 07E0 0810 1088 1088 108C"
- $"138C 1008 1008 0810 07E0 07E0 07E0 07E0"
- $"07E0 07E0 07E0 07E0 0FF0 1FF8 1FF8 1FFC"
- $"1FFC 1FF8 1FF8 0FF0 07E0 07E0 07E0 07E0"
- $"0008 000D"
-};
-
-data 'CURS' (3076, "xterm") {
- $"0C60 0280 0100 0100 0100 0100 0100 0100"
- $"0100 0100 0100 0100 0100 0100 0280 0C60"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"000B 0007"
-};
-
-/*
- * The following are color versions of some of the
- * cursors defined above. The color cursors will be
- * used if the exist in preference to the black & white
- * cursors.
- */
-
-data 'crsr' (3004, "boat", purgeable) {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0100 03C0"
- $"8460 FFFF 0018 0020 0040 FFC0 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0100 03C0"
- $"87E0 FFFF FFF8 FFE0 FFC0 FFC0 0000 0000"
- $"0000 0000 0007 000F 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 000F 0000 0000 0000 00FF FF00"
- $"0000 F000 0F32 25F0 0000 6FFF FFFF FFFF"
- $"FFFF 2222 2222 221F F000 2222 2222 21F0"
- $"0000 3333 3333 4F00 0000 FFFF FFFF FF00"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0007 0000 FFFF FFFF"
- $"FFFF 0001 BBBB BBBB BBBB 0002 EEEE EEEE"
- $"EEEE 0003 DDDD DDDD DDDD 0004 CCCC CCCC"
- $"CCCC 0005 4444 4444 4444 0006 1111 1111"
- $"1111 000F 0000 0000 0000"
-};
-
-data 'crsr' (3013, "clock") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 1FF8 33CC 6466 4992 4F12 4422"
- $"63C6 3FFC 2994 2994 2994 2BD4 6996 781E"
- $"7FFE 7FFE 1FF8 3FFC 7FFE 7FFE 7FFE 7FFE"
- $"7FFE 3FFC 3FFC 3FFC 3FFC 3FFC 7FFE 7FFE"
- $"7FFE 7FFE 0004 0008 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 000F FFFF FFFF F000 00F6 05FF FF50"
- $"6F00 0F60 5F00 56F5 06F0 0F00 F021 F30F"
- $"00F0 0F00 F6F1 000F 00F0 0F00 5F00 00F5"
- $"00F0 0F60 05FF FF50 06F0 00FF FFFF FFFF"
- $"FF00 00F0 F001 100F 0F00 00F0 F001 100F"
- $"0F00 00F0 F021 120F 0F00 00F0 F01F F10F"
- $"0F00 0FF0 F021 120F 0FF0 0FF4 F500 005F"
- $"4FF0 0FFF FFFF FFFF FFF0 0FFF FFFF FFFF"
- $"FFF0 0000 0000 0000 0007 0000 FFFF FFFF"
- $"FFFF 0001 4444 4444 4444 0002 AAAA AAAA"
- $"AAAA 0003 EEEE EEEE EEEE 0004 5555 5555"
- $"5555 0005 DDDD DDDD DDDD 0006 7777 7777"
- $"7777 000F 0000 0000 0000"
-};
-
-data 'crsr' (3014, "coffee_mug") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 03F8 0C06 1001 1C07 33F9 7001"
- $"D001 9001 960D DA55 7A55 36ED 10A1 1001"
- $"0802 07FC 03F8 0FFE 1FFF 1FFF 3FFF 7FFF"
- $"FFFF FFFF FFFF FFFF 7FFF 3FFF 1FFF 1FFF"
- $"0FFE 07FC 0004 0003 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 00FF FFFF F000 0000 FF42 2222"
- $"4FF0 000F 4221 1111 224F 000F FF11 1111"
- $"1FFF 00FF 24FF FFFF F42F 0F5F 2222 2222"
- $"222F F52F 2222 2222 222F F40F 2222 2222"
- $"222F F40F 4FF2 2224 FF2F F52F F2F2 2F2F"
- $"2F2F 0F5F F2F2 535F 2F2F 00FF 4FF2 F3F4"
- $"FF2F 000F 2222 F2F2 222F 000F 4222 2222"
- $"224F 0000 F422 2222 24F0 0000 0FFF FFFF"
- $"FF00 0000 0000 0000 0006 0000 FFFF FFFF"
- $"FFFF 0001 CCCC 9999 6666 0002 CCCC CCCC"
- $"FFFF 0003 3333 3333 6666 0004 9999 9999"
- $"FFFF 0005 6666 6666 CCCC 000F 0000 0000"
- $"0000"
-};
-
-data 'crsr' (3027, "gobbler") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0000 0078 0070 4036 4FB0 7FF0"
- $"7E30 7C30 3038 00F0 0FE0 0400 0400 0400"
- $"0F00 0000 00FC 00FC E0FF FFFF FFFF FFF8"
- $"FFF8 FFF8 FFFC 7FFC 3FF8 1FF0 0E00 1F80"
- $"1F80 1F80 0003 000E 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 0000 0000 0000 0000 0000 0222"
- $"2000 0000 0000 0111 0000 0300 0000 0011"
- $"0220 0100 1616 1011 0000 0361 6111 1111"
- $"0000 0111 1114 4415 0000 0311 1144 4451"
- $"0000 0011 4444 4415 1000 0004 4444 5151"
- $"0000 0000 1515 1510 0000 0000 0200 0000"
- $"0000 0000 0300 0000 0000 0000 0200 0000"
- $"0000 0000 2323 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0006 0000 FFFF FFFF"
- $"FFFF 0001 CCCC 9999 6666 0002 DDDD 0000"
- $"0000 0003 FFFF 6666 3333 0004 CCCC CCCC"
- $"CCCC 0005 8888 8888 8888 0006 FFFF CCCC"
- $"9999"
-};
-
-data 'crsr' (3028, "gumby") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 3F00 10C0 C820 EAA0 C820 CBA0"
- $"F838 383E 0826 0826 092E 0926 0920 1110"
- $"2108 3EF8 3F00 1FC0 CFE0 EFE0 CFE0 CFE0"
- $"FFF8 3FFE 0FE6 0FE6 0FEE 0FE6 0FE0 1FF0"
- $"3FF8 3EF8 0000 0002 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 00FF FFFF 0000 0000 000F 1212 FF00"
- $"0000 FF00 F131 31F0 0000 FFF0 F3F3 F3F0"
- $"0000 FF00 F131 31F0 0000 FF00 F2FF F2F0"
- $"0000 4FFF F121 21FF F000 00FF F212 12FF"
- $"FF40 0000 F121 21F0 0FF0 0000 F212 12F0"
- $"0FF0 0000 F12F 21F0 FFF0 0000 F21F 12F0"
- $"0FF0 0000 F12F 21F0 0000 000F 121F 121F"
- $"0000 00F1 212F 2121 F000 00FF FFF0 FFFF"
- $"F000 0000 0000 0000 0005 0000 FFFF FFFF"
- $"FFFF 0001 0000 BBBB 0000 0002 CCCC CCCC"
- $"CCCC 0003 AAAA AAAA AAAA 0004 4444 4444"
- $"4444 000F 0000 0000 0000"
-};
-
-data 'crsr' (3031, "heart") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0000 3EF8 638C C106 8002 8002"
- $"8002 8002 C006 600C 3018 1830 0C60 06C0"
- $"0380 0000 0000 3EF8 7FFC FFFE FFFE FFFE"
- $"FFFE FFFE FFFE 7FFC 3FF8 1FF0 0FE0 07C0"
- $"0380 0000 0003 0007 0000 0000 0000 0000"
- $"0000 0000 8004 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0002 0001 0002 0000 0000 0000 00D2 0000"
- $"0000 0000 0000 0FFC FFC0 3AAB AA70 E99B"
- $"999C E665 A65C E999 999C E666 665C E999"
- $"999C D666 665C 3599 9970 0D66 65C0 0359"
- $"9700 00D6 5C00 0035 7000 000F C000 0000"
- $"0000 0000 0000 0000 0003 0000 FFFF FFFF"
- $"FFFF 0001 DDDD 0000 0000 0002 FFFF 6666"
- $"CCCC 0003 0000 0000 0000"
-};
-
-data 'crsr' (3042, "mouse", purgeable) {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 BE00 0100 0180 0FF0 1008 17E8"
- $"1428 1428 17E8 1008 1008 1008 1008 1008"
- $"1008 0FF0 FE00 0100 0180 0FF0 1FF8 1FF8"
- $"1FF8 1FF8 1FF8 1FF8 1FF8 1FF8 1FF8 1FF8"
- $"1FF8 0FF0 0001 0007 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 1379 4AF0 0000 0000 0000 000F 0000"
- $"0000 0000 000F F000 0000 0000 FFFF FFFF"
- $"0000 000F 2111 1112 F000 000F 3655 5563"
- $"F000 000F 3513 1351 F000 000F 3533 3351"
- $"F000 000F 3655 5561 F000 000F 3311 1111"
- $"F000 000F 3333 3333 F000 000F 3333 3333"
- $"F000 000F 2222 2222 F000 000F 8888 8888"
- $"F000 000F 7888 8887 F000 0000 FFFF FFFF"
- $"0000 0000 0000 0000 000B 0000 FFFF FFFF"
- $"FFFF 0001 EEEE EEEE EEEE 0002 CCCC CCCC"
- $"CCCC 0003 DDDD DDDD DDDD 0004 4444 4444"
- $"4444 0005 2222 2222 2222 0006 5555 5555"
- $"5555 0007 AAAA AAAA AAAA 0008 BBBB BBBB"
- $"BBBB 0009 7777 7777 7777 000A 1111 1111"
- $"1111 000F 0000 0000 0000"
-};
-
-data 'crsr' (3043, "pencil", purgeable) {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0000 00F0 0088 0108 0190 0270"
- $"0220 0440 0440 0880 0880 1100 1E00 1C00"
- $"1800 1000 0000 00F0 00F8 01F8 01F0 03F0"
- $"03E0 07C0 07C0 0F80 0F80 1F00 1E00 1C00"
- $"1800 1000 000F 0003 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 0000 0000 0000 0000 0000 FFFF"
- $"0000 0000 0000 F404 F000 0000 000F 4042"
- $"F000 0000 000F F42F 0000 0000 00F5 3FFF"
- $"0000 0000 00F3 52F0 0000 0000 0F35 1F00"
- $"0000 0000 0F53 2F00 0000 0000 F532 F000"
- $"0000 0000 F312 F000 0000 000F 352F 0000"
- $"0000 000F FFF0 0000 0000 000F FF00 0000"
- $"0000 000F F000 0000 0000 000F 0000 0000"
- $"0000 0000 0000 0000 0006 0000 FFFF FFFF"
- $"FFFF 0001 CCCC CCCC CCCC 0002 8888 8888"
- $"8888 0003 FFFF FFFF 0000 0004 DDDD 0000"
- $"0000 0005 FFFF 6666 3333 000F 0000 0000"
- $"0000"
-};
-
-data 'crsr' (3059, "shuttle") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0020 0070 00F8 01DE 05DE 09DE"
- $"11DE 11DE 11DE 11DE 31DE 71DE FDDE 1888"
- $"0078 0030 0020 0070 00F8 01FE 07FE 0FFE"
- $"1FFE 1FFE 1FFE 1FFE 3FFE 7FFE FFFE 18F8"
- $"0078 0030 0000 000A 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 0000 00F0 0000 0000 0000 0F3F"
- $"0000 0000 0000 F343 F000 0000 000F 3404"
- $"3FF0 0000 0F4F 3404 3FF0 0000 F55F 3404"
- $"3FF0 000F 505F 3404 3FF0 000F 005F 3404"
- $"3FF0 000F 005F 3404 3FF0 000F 005F 3404"
- $"3FF0 00F3 005F 3404 3FF0 0F33 505F 3404"
- $"3FF0 FFF3 3F4F 3404 3FF0 000F F000 1222"
- $"1000 0000 0000 0111 1000 0000 0000 0011"
- $"0000 0000 0000 0000 0006 0000 FFFF FFFF"
- $"FFFF 0001 FFFF 6666 3333 0002 DDDD 0000"
- $"0000 0003 4444 4444 4444 0004 8888 8888"
- $"8888 0005 DDDD DDDD DDDD 000F 0000 0000"
- $"0000"
-};
-
-data 'crsr' (3062, "spraycan") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0018 0040 0D18 1E40 1A18 3F00"
- $"2100 3900 2900 3900 2900 3900 3900 2100"
- $"2100 3F00 0000 0000 0C00 1E00 1E00 3F00"
- $"3F00 3F00 3F00 3F00 3F00 3F00 3F00 3F00"
- $"3F00 3F00 0002 0007 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 0000 0005 2000 0000 0000 0460"
- $"0000 0000 FF1F 6005 2000 000F 33F0 0460"
- $"0000 000F 10F0 0005 2000 00FF FFFF 0000"
- $"0000 00F8 170F 0000 0000 00F5 F70F 0000"
- $"0000 00FA F70F 0000 0000 00F9 F70F 0000"
- $"0000 00FA F70F 0000 0000 00F9 F70F 0000"
- $"0000 00F5 F70F 0000 0000 00F8 170F 0000"
- $"0000 00F8 170F 0000 0000 00FF FFFF 0000"
- $"0000 0000 0000 0000 000B 0000 FFFF FFFF"
- $"FFFF 0001 AAAA AAAA AAAA 0002 7777 7777"
- $"7777 0003 5555 5555 5555 0004 2222 2222"
- $"2222 0005 4444 4444 4444 0006 BBBB BBBB"
- $"BBBB 0007 DDDD DDDD DDDD 0008 EEEE EEEE"
- $"EEEE 0009 6666 6666 CCCC 000A CCCC CCCC"
- $"FFFF 000F 0000 0000 0000"
-};
-
-data 'crsr' (3063, "star") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0100 0280 0280 0280 0440 0440"
- $"0440 3938 C006 3838 0920 1290 2448 2828"
- $"3018 2008 0100 0380 0380 0380 07C0 07C0"
- $"07C0 3FF8 FFFE 3FF8 0FE0 1EF0 3C78 3838"
- $"3018 2008 0007 0007 0000 0000 0000 0000"
- $"0000 0000 8004 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0002 0001 0002 0000 0000 0000 00D2 0000"
- $"0000 0003 0000 000D C000 000D C000 000D"
- $"C000 0035 7000 0035 7000 0035 7000 0FD7"
- $"5FC0 F555 557C 0FD5 5FC0 00D7 5C00 035C"
- $"D700 0D70 35C0 0DC0 0DC0 0F00 03C0 0C00"
- $"00C0 0000 0000 0000 0002 0000 FFFF FFFF"
- $"FFFF 0001 FFFF FFFF 0000 0003 0000 0000"
- $"0000"
-};
-
-data 'crsr' (3071, "trek") {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 0100 0000 0380 07C0 0FE0 0EE0"
- $"0FE0 07C0 0380 0100 0BA0 0D60 0920 0820"
- $"0820 0000 0000 0380 07C0 0FE0 1FF0 1FF0"
- $"1FF0 0FE0 07C0 0BA0 1FF0 1FF0 1FF0 1D70"
- $"1C70 0820 0000 0007 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 0005 0000 0000 0000 0005 0000"
- $"0000 0000 00FF F000 0000 0000 0F31 3F00"
- $"0000 0000 F322 23F0 0000 0000 F110 11F0"
- $"0000 0000 F311 13F0 0000 0000 0F31 3F00"
- $"0000 0000 00FF F000 0000 0000 000F 0000"
- $"0000 0000 F0FF F0F0 0000 0000 FF0F 0FF0"
- $"0000 0000 400F 0040 0000 0000 4000 0040"
- $"0000 0000 4000 0040 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0006 0000 FFFF FFFF"
- $"FFFF 0001 EEEE EEEE EEEE 0002 9999 9999"
- $"FFFF 0003 DDDD DDDD DDDD 0004 3333 3333"
- $"6666 0005 DDDD 0000 0000 000F 0000 0000"
- $"0000"
-};
-
-data 'crsr' (3075, "watch", purgeable) {
- $"8001 0000 0060 0000 0092 0000 0000 0000"
- $"0000 0000 07E0 07E0 07E0 07E0 0810 1088"
- $"1088 108C 138C 1008 1008 0810 07E0 07E0"
- $"07E0 07E0 07E0 07E0 07E0 07E0 0FF0 1FF8"
- $"1FF8 1FF8 1FF8 1FF8 1FF8 0FF0 07E0 07E0"
- $"07E0 07E0 0008 000D 0000 0000 0000 0000"
- $"0000 0000 8008 0000 0000 0010 0010 0000"
- $"0000 0000 0000 0048 0000 0048 0000 0000"
- $"0004 0001 0004 0000 0000 0000 0112 0000"
- $"0000 0000 0FFF FFF0 0000 0000 0FFF FFF0"
- $"0000 0000 0FFF FFF0 0000 0000 0FFF FFF0"
- $"0000 0000 F020 202F 0000 000F 0222 F221"
- $"F000 000F 2222 F123 F000 000F 0222 F121"
- $"FF00 000F 22FF F123 FF00 000F 0222 2221"
- $"F000 000F 2222 2213 F000 0000 F131 313F"
- $"0000 0000 0FFF FFF0 0000 0000 0FFF FFF0"
- $"0000 0000 0FFF FFF0 0000 0000 0FFF FFF0"
- $"0000 0000 0000 0000 0004 0000 FFFF FFFF"
- $"FFFF 0001 CCCC CCCC CCCC 0002 EEEE EEEE"
- $"EEEE 0003 BBBB BBBB BBBB 000F 0000 0000"
- $"0000"
-};
-
diff --git a/mac/tkMacXStubs.c b/mac/tkMacXStubs.c
deleted file mode 100644
index 1e0ad51..0000000
--- a/mac/tkMacXStubs.c
+++ /dev/null
@@ -1,875 +0,0 @@
-/*
- * tkMacXStubs.c --
- *
- * This file contains most of the X calls called by Tk. Many of
- * these calls are just stubs and either don't make sense on the
- * Macintosh or thier implamentation just doesn't do anything. Other
- * calls will eventually be moved into other files.
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tkInt.h"
-#include <X.h>
-#include <Xlib.h>
-#include <stdio.h>
-#include <tcl.h>
-
-#include <Xatom.h>
-
-#include <Windows.h>
-#include <Fonts.h>
-#include <QDOffscreen.h>
-#include <ToolUtils.h>
-#include <Sound.h>
-#include "tkMacInt.h"
-#include "tkPort.h"
-
-/*
- * Because this file is still under major development Debugger statements are
- * used through out this file. The define TCL_DEBUG will decide whether
- * the debugger statements actually call the debugger or not.
- */
-
-#ifndef TCL_DEBUG
-# define Debugger()
-#endif
-
-#define ROOT_ID 10
-
-/*
- * Declarations of static variables used in this file.
- */
-
-static TkDisplay *gMacDisplay = NULL; /* Macintosh display. */
-static char *macScreenName = ":0";
- /* Default name of macintosh display. */
-
-/*
- * Forward declarations of procedures used in this file.
- */
-
-static XID MacXIdAlloc _ANSI_ARGS_((Display *display));
-static int DefaultErrorHandler _ANSI_ARGS_((Display* display,
- XErrorEvent* err_evt));
-
-/*
- * Other declrations
- */
-
-int TkMacXDestroyImage _ANSI_ARGS_((XImage *image));
-unsigned long TkMacXGetPixel _ANSI_ARGS_((XImage *image, int x, int y));
-int TkMacXPutPixel _ANSI_ARGS_((XImage *image, int x, int y,
- unsigned long pixel));
-XImage *TkMacXSubImage _ANSI_ARGS_((XImage *image, int x, int y,
- unsigned int width, unsigned int height));
-int TkMacXAddPixel _ANSI_ARGS_((XImage *image, long value));
-int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image));
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpOpenDisplay --
- *
- * Create the Display structure and fill it with device
- * specific information.
- *
- * Results:
- * Returns a Display structure on success or NULL on failure.
- *
- * Side effects:
- * Allocates a new Display structure.
- *
- *----------------------------------------------------------------------
- */
-
-TkDisplay *
-TkpOpenDisplay(
- CONST char *display_name)
-{
- Display *display;
- Screen *screen;
- GDHandle graphicsDevice;
-
- if (gMacDisplay != NULL) {
- if (strcmp(gMacDisplay->display->display_name, display_name) == 0) {
- return gMacDisplay;
- } else {
- return NULL;
- }
- }
-
- graphicsDevice = GetMainDevice();
- display = (Display *) ckalloc(sizeof(Display));
- memset(display, 0, sizeof(Display));
- display->resource_alloc = MacXIdAlloc;
- screen = (Screen *) ckalloc(sizeof(Screen) * 2);
- display->default_screen = 0;
- display->request = 0;
- display->nscreens = 1;
- display->screens = screen;
- display->display_name = macScreenName;
- display->qlen = 0;
-
- screen->root = ROOT_ID;
- screen->display = display;
- screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
- (*(*graphicsDevice)->gdPMap)->cmpCount;
- screen->height = (*graphicsDevice)->gdRect.bottom -
- (*graphicsDevice)->gdRect.top;
- screen->width = (*graphicsDevice)->gdRect.right -
- (*graphicsDevice)->gdRect.left;
-
- screen->mwidth = (screen->width * 254 + 360) / 720;
- screen->mheight = (screen->height * 254 + 360) / 720;
- screen->black_pixel = 0x00000000;
- screen->white_pixel = 0x00FFFFFF;
- screen->root_visual = (Visual *) ckalloc(sizeof(Visual));
- screen->root_visual->visualid = 0;
- screen->root_visual->class = TrueColor;
- screen->root_visual->red_mask = 0x00FF0000;
- screen->root_visual->green_mask = 0x0000FF00;
- screen->root_visual->blue_mask = 0x000000FF;
- screen->root_visual->bits_per_rgb = 24;
- screen->root_visual->map_entries = 2 ^ 8;
-
- gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay));
- memset(gMacDisplay, 0, sizeof(TkDisplay));
- gMacDisplay->display = display;
- return gMacDisplay;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpCloseDisplay --
- *
- * Deallocates a display structure created by TkpOpenDisplay.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Frees memory.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpCloseDisplay(
- TkDisplay *displayPtr)
-{
- Display *display = displayPtr->display;
- if (gMacDisplay != displayPtr) {
- panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
- }
-
- gMacDisplay = NULL;
- if (display->screens != (Screen *) NULL) {
- if (display->screens->root_visual != (Visual *) NULL) {
- ckfree((char *) display->screens->root_visual);
- }
- ckfree((char *) display->screens);
- }
- ckfree((char *) display);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkClipCleanup --
- *
- * This procedure is called to cleanup resources associated with
- * claiming clipboard ownership and for receiving selection get
- * results. This function is called in tkWindow.c. This has to be
- * called by the display cleanup function because we still need the
- * access display elements.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Resources are freed - the clipboard may no longer be used.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkClipCleanup(dispPtr)
- TkDisplay *dispPtr; /* display associated with clipboard */
-{
- /*
- * Make sure that the local scrap is transfered to the global
- * scrap if needed.
- */
-
- TkSuspendClipboard();
-
- if (dispPtr->clipWindow != NULL) {
- Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
- dispPtr->applicationAtom);
- Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
- dispPtr->windowAtom);
-
- Tk_DestroyWindow(dispPtr->clipWindow);
- Tcl_Release((ClientData) dispPtr->clipWindow);
- dispPtr->clipWindow = NULL;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MacXIdAlloc --
- *
- * This procedure is invoked by Xlib as the resource allocator
- * for a display.
- *
- * Results:
- * The return value is an X resource identifier that isn't currently
- * in use.
- *
- * Side effects:
- * The identifier is removed from the stack of free identifiers,
- * if it was previously on the stack.
- *
- *----------------------------------------------------------------------
- */
-
-static XID
-MacXIdAlloc(
- Display *display) /* Display for which to allocate. */
-{
- static long int cur_id = 100;
- /*
- * Some special XIds are reserved
- * - this is why we start at 100
- */
-
- return ++cur_id;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpWindowWasRecentlyDeleted --
- *
- * Tries to determine whether the given window was recently deleted.
- * Called from the generic code error handler to attempt to deal with
- * async BadWindow errors under some circumstances.
- *
- * Results:
- * Always 0, we do not keep this information on the Mac, so we do not
- * know whether the window was destroyed.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpWindowWasRecentlyDeleted(
- Window win,
- TkDisplay *dispPtr)
-{
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DefaultErrorHandler --
- *
- * This procedure is the default X error handler. Tk uses it's
- * own error handler so this call should never be called.
- *
- * Results:
- * None.
- *
- * Side effects:
- * This function will call panic and exit.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-DefaultErrorHandler(
- Display* display,
- XErrorEvent* err_evt)
-{
- /*
- * This call should never be called. Tk replaces
- * it with its own error handler.
- */
- panic("Warning hit bogus error handler!");
- return 0;
-}
-
-
-char *
-XGetAtomName(
- Display * display,
- Atom atom)
-{
- display->request++;
- return NULL;
-}
-
-int
-_XInitImageFuncPtrs(XImage *image)
-{
- return 0;
-}
-
-XErrorHandler
-XSetErrorHandler(
- XErrorHandler handler)
-{
- return DefaultErrorHandler;
-}
-
-Window
-XRootWindow(Display *display, int screen_number)
-{
- display->request++;
- return ROOT_ID;
-}
-
-XImage *
-XGetImage(display, d, x, y, width, height, plane_mask, format)
- Display *display;
- Drawable d;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
- unsigned long plane_mask;
- int format;
-{
- Debugger();
- return NULL;
-}
-
-int
-XGetGeometry(display, d, root_return, x_return, y_return, width_return,
- height_return, border_width_return, depth_return)
- Display* display;
- Drawable d;
- Window* root_return;
- int* x_return;
- int* y_return;
- unsigned int* width_return;
- unsigned int* height_return;
- unsigned int* border_width_return;
- unsigned int* depth_return;
-{
- /* Used in tkCanvPs.c & wm code */
- Debugger();
- return 0;
-}
-
-void
-XChangeProperty(
- Display* display,
- Window w,
- Atom property,
- Atom type,
- int format,
- int mode,
- _Xconst unsigned char* data,
- int nelements)
-{
- Debugger();
-}
-
-void
-XSelectInput(
- Display* display,
- Window w,
- long event_mask)
-{
- Debugger();
-}
-
-void
-XBell(
- Display* display,
- int percent)
-{
- SysBeep(percent);
-}
-
-void
-XSetWMNormalHints(
- Display* display,
- Window w,
- XSizeHints* hints)
-{
- /*
- * Do nothing. Shouldn't even be called.
- */
-}
-
-XSizeHints *
-XAllocSizeHints()
-{
- /*
- * Always return NULL. Tk code checks to see if NULL
- * is returned & does nothing if it is.
- */
-
- return NULL;
-}
-
-XImage *
-XCreateImage(
- Display* display,
- Visual* visual,
- unsigned int depth,
- int format,
- int offset,
- char* data,
- unsigned int width,
- unsigned int height,
- int bitmap_pad,
- int bytes_per_line)
-{
- XImage *ximage;
-
- display->request++;
- ximage = (XImage *) ckalloc(sizeof(XImage));
-
- ximage->height = height;
- ximage->width = width;
- ximage->depth = depth;
- ximage->xoffset = offset;
- ximage->format = format;
- ximage->data = data;
- ximage->bitmap_pad = bitmap_pad;
- if (bytes_per_line == 0) {
- ximage->bytes_per_line = width * 4; /* assuming 32 bits per pixel */
- } else {
- ximage->bytes_per_line = bytes_per_line;
- }
-
- if (format == ZPixmap) {
- ximage->bits_per_pixel = 32;
- ximage->bitmap_unit = 32;
- } else {
- ximage->bits_per_pixel = 1;
- ximage->bitmap_unit = 8;
- }
- ximage->byte_order = LSBFirst;
- ximage->bitmap_bit_order = LSBFirst;
- ximage->red_mask = 0x00FF0000;
- ximage->green_mask = 0x0000FF00;
- ximage->blue_mask = 0x000000FF;
-
- ximage->f.destroy_image = TkMacXDestroyImage;
- ximage->f.get_pixel = TkMacXGetPixel;
- ximage->f.put_pixel = TkMacXPutPixel;
- ximage->f.sub_image = TkMacXSubImage;
- ximage->f.add_pixel = TkMacXAddPixel;
-
- return ximage;
-}
-
-GContext
-XGContextFromGC(
- GC gc)
-{
- /* TODO - currently a no-op */
- return 0;
-}
-
-Status
-XSendEvent(
- Display* display,
- Window w,
- Bool propagate,
- long event_mask,
- XEvent* event_send)
-{
- Debugger();
- return 0;
-}
-
-void
-XClearWindow(
- Display* display,
- Window w)
-{
-}
-
-/*
-void
-XDrawPoint(
- Display* display,
- Drawable d,
- GC gc,
- int x,
- int y)
-{
-}
-
-void
-XDrawPoints(
- Display* display,
- Drawable d,
- GC gc,
- XPoint* points,
- int npoints,
- int mode)
-{
-}
-*/
-
-void
-XWarpPointer(
- Display* display,
- Window src_w,
- Window dest_w,
- int src_x,
- int src_y,
- unsigned int src_width,
- unsigned int src_height,
- int dest_x,
- int dest_y)
-{
-}
-
-void
-XQueryColor(
- Display* display,
- Colormap colormap,
- XColor* def_in_out)
-{
-}
-
-void
-XQueryColors(
- Display* display,
- Colormap colormap,
- XColor* defs_in_out,
- int ncolors)
-{
-}
-
-int
-XQueryTree(display, w, root_return, parent_return, children_return,
- nchildren_return)
- Display* display;
- Window w;
- Window* root_return;
- Window* parent_return;
- Window** children_return;
- unsigned int* nchildren_return;
-{
- return 0;
-}
-
-int
-XGetWindowProperty(
- Display *display,
- Window w,
- Atom property,
- long long_offset,
- long long_length,
- Bool delete,
- Atom req_type,
- Atom *actual_type_return,
- int *actual_format_return,
- unsigned long *nitems_return,
- unsigned long *bytes_after_return,
- unsigned char ** prop_return)
-{
- display->request++;
- *actual_type_return = None;
- *actual_format_return = *bytes_after_return = 0;
- *nitems_return = 0;
- return 0;
-}
-
-void
-XRefreshKeyboardMapping()
-{
- /* used by tkXEvent.c */
- Debugger();
-}
-
-void
-XSetIconName(
- Display* display,
- Window w,
- const char *icon_name)
-{
- /*
- * This is a no-op, no icon name for Macs.
- */
- display->request++;
-}
-
-void
-XForceScreenSaver(
- Display* display,
- int mode)
-{
- /*
- * This function is just a no-op. It is defined to
- * reset the screen saver. However, there is no real
- * way to do this on a Mac. Let me know if there is!
- */
- display->request++;
-}
-
-void
-Tk_FreeXId (
- Display *display,
- XID xid)
-{
- /* no-op function needed for stubs implementation. */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGetServerInfo --
- *
- * Given a window, this procedure returns information about
- * the window server for that window. This procedure provides
- * the guts of the "winfo server" command.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkGetServerInfo(
- Tcl_Interp *interp, /* The server information is returned in
- * this interpreter's result. */
- Tk_Window tkwin) /* Token for window; this selects a
- * particular display and server. */
-{
- char buffer[8 + TCL_INTEGER_SPACE * 2];
- char buffer2[TCL_INTEGER_SPACE];
-
- sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),
- ProtocolRevision(Tk_Display(tkwin)));
- sprintf(buffer2, " %d", VendorRelease(Tk_Display(tkwin)));
- Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),
- buffer2, (char *) NULL);
-}
-/*
- * Image stuff
- */
-
-int
-TkMacXDestroyImage(
- XImage *image)
-{
- Debugger();
- return 0;
-}
-
-unsigned long
-TkMacXGetPixel(
- XImage *image,
- int x,
- int y)
-{
- Debugger();
- return 0;
-}
-
-int
-TkMacXPutPixel(
- XImage *image,
- int x,
- int y,
- unsigned long pixel)
-{
- /* Debugger(); */
- return 0;
-}
-
-XImage *
-TkMacXSubImage(
- XImage *image,
- int x,
- int y,
- unsigned int width,
- unsigned int height)
-{
- Debugger();
- return NULL;
-}
-
-int
-TkMacXAddPixel(
- XImage *image,
- long value)
-{
- Debugger();
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XChangeWindowAttributes, XSetWindowBackground,
- * XSetWindowBackgroundPixmap, XSetWindowBorder, XSetWindowBorderPixmap,
- * XSetWindowBorderWidth, XSetWindowColormap
- *
- * These functions are all no-ops. They all have equivilent
- * Tk calls that should always be used instead.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-XChangeWindowAttributes(
- Display* display,
- Window w,
- unsigned long value_mask,
- XSetWindowAttributes* attributes)
-{
-}
-
-void
-XSetWindowBackground(
- Display *display,
- Window window,
- unsigned long value)
-{
-}
-
-void
-XSetWindowBackgroundPixmap(
- Display* display,
- Window w,
- Pixmap background_pixmap)
-{
-}
-
-void
-XSetWindowBorder(
- Display* display,
- Window w,
- unsigned long border_pixel)
-{
-}
-
-void
-XSetWindowBorderPixmap(
- Display* display,
- Window w,
- Pixmap border_pixmap)
-{
-}
-
-void
-XSetWindowBorderWidth(
- Display* display,
- Window w,
- unsigned int width)
-{
-}
-
-void
-XSetWindowColormap(
- Display* display,
- Window w,
- Colormap colormap)
-{
- Debugger();
-}
-
-Status
-XStringListToTextProperty(
- char** list,
- int count,
- XTextProperty* text_prop_return)
-{
- Debugger();
- return (Status) 0;
-}
-void
-XSetWMClientMachine(
- Display* display,
- Window w,
- XTextProperty* text_prop)
-{
- Debugger();
-}
-XIC
-XCreateIC(
- void)
-{
- Debugger();
- return (XIC) 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGetDefaultScreenName --
- *
- * Returns the name of the screen that Tk should use during
- * initialization.
- *
- * Results:
- * Returns a statically allocated string.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-CONST char *
-TkGetDefaultScreenName(
- Tcl_Interp *interp, /* Not used. */
- CONST char *screenName) /* If NULL, use default string. */
-{
- if ((screenName == NULL) || (screenName[0] == '\0')) {
- screenName = macScreenName;
- }
- return screenName;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_SetCaretPos --
- *
- * This indicates the cursor position to Tk.
- * This is currently a noop stub for MacX.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
-{
- TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);
-
- caretPtr->winPtr = ((TkWindow *) tkwin);
- caretPtr->x = x;
- caretPtr->y = y;
- caretPtr->height = height;
-}
diff --git a/mac/widget.r b/mac/widget.r
deleted file mode 100644
index d28cadc..0000000
--- a/mac/widget.r
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * widget.r --
- *
- */
-
-type 'TEXT'
-{
- string;
-};
-
-#define TK_LIBRARY_RESOURCES 3000
-
-resource 'TEXT' (TK_LIBRARY_RESOURCES+114, "tclshrc", purgeable)
-{
-"# read widgets demo script\n"
-"console hide\n"
-"source [file join $tk_library demos widget]\n"
-}; \ No newline at end of file
diff --git a/macosx/Makefile b/macosx/GNUmakefile
index 99e335d..333961c 100644
--- a/macosx/Makefile
+++ b/macosx/GNUmakefile
@@ -4,7 +4,7 @@
# uses the standard unix build system in tk/unix (which can be used directly instead of this
# if you are not using the tk/macosx projects).
#
-# Copyright (c) 2002-2007 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright (c) 2002-2008 Daniel A. Steffen <das@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -82,6 +82,10 @@ BUILD_STYLE =
CONFIGURE_ARGS =
OBJ_DIR = ${OBJROOT}/${BUILD_STYLE}
+empty :=
+space := ${empty} ${empty}
+objdir = $(subst ${space},\ ,${OBJ_DIR})
+
develop_make_args := BUILD_STYLE=Development CONFIGURE_ARGS=--enable-symbols
deploy_make_args := BUILD_STYLE=Deployment INSTALL_TARGET=install-strip
embedded_make_args := EMBEDDED_BUILD=1
@@ -106,22 +110,26 @@ WISH = wish${VERSION}
BUILD_TARGET := all tktest
INSTALL_TARGET := install
-ifneq ($(wildcard ${TCL_BUILD_DIR}/tclConfig.sh),)
+ifneq ($(wildcard $(subst ${space},\ ,${TCL_BUILD_DIR})/tclConfig.sh),)
TCL_DIR := ${TCL_BUILD_DIR}
TCL_FRAMEWORK_DIR := ${TCL_BUILD_DIR}/..
+MAKE_VARS :=
else
TCL_DIR := ${TCL_FRAMEWORK_DIR}/Tcl.framework
TCL_EXE := ${TCLSH_DIR}/tclsh${TCL_VERSION}
-MAKE_VARS = TCL_EXE
+MAKE_VARS := TCL_EXE
export DYLD_FRAMEWORK_PATH := ${TCL_FRAMEWORK_DIR}
endif
+
export CPPROG := cp -p
ifeq (${TK_X11},)
override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-aqua
else
+override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-xft
VERSION := ${VERSION}-X11
wish := ${wish}-X11
+override EMBEDDED_BUILD :=
endif
INSTALL_TARGETS = install-binaries install-libraries
@@ -143,7 +151,7 @@ install-${PROJECT}: target = ${INSTALL_TARGET}
clean-${PROJECT} distclean-${PROJECT} test-${PROJECT}: \
target = $*
-DO_MAKE = +${MAKE} -C ${OBJ_DIR} ${target} ${MAKE_ARGS_V} ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
+DO_MAKE = +${MAKE} -C "${OBJ_DIR}" ${target} ${MAKE_ARGS_V} ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
#-------------------------------------------------------------------------------------------------------
# locations for custom tk install actions
@@ -165,37 +173,37 @@ TK_FMWK_DIR := ${FMWK_DIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}
# build rules
${PROJECT}:
- ${MAKE} install-${PROJECT} INSTALL_ROOT=${OBJ_DIR}/
+ ${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/"
-${OBJ_DIR}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \
+${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \
${UNIX_DIR}/tkConfig.sh.in Tk-Info.plist.in Wish-Info.plist.in
- mkdir -p ${OBJ_DIR} && cd ${OBJ_DIR} && \
- if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure \
- --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} \
- --mandir=${MANDIR} --enable-threads --enable-framework \
- --with-tcl=${TCL_DIR} \
+ mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \
+ if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \
+ --prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \
+ --mandir="${MANDIR}" --enable-threads --enable-framework \
+ --with-tcl="${TCL_DIR}" \
${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi
-ifneq (${TK_X11},)
- @cd ${OBJ_DIR} && sed -e 's#/Versions/${TCL_VERSION}#/Versions/${VERSION}#' \
+ifneq (${VERSION},${TCL_VERSION})
+ @cd "${OBJ_DIR}" && sed -e 's#/Versions/${TCL_VERSION}#/Versions/${VERSION}#' \
tkConfig.sh > tkConfig.sh.1 && mv -f tkConfig.sh.1 tkConfig.sh
endif
-build-${PROJECT}: ${OBJ_DIR}/Makefile
+build-${PROJECT}: ${objdir}/Makefile
${DO_MAKE}
ifeq (${INSTALL_BUILD},)
# symolic link hackery to trick
# 'make install INSTALL_ROOT=${OBJ_DIR}'
# into building Tk.framework and wish in ${SYMROOT}
- @cd ${OBJ_DIR} && mkdir -p $(dir ./${LIBDIR}) $(dir ./${BINDIR}) ${SYMROOT} && \
- rm -rf ./${LIBDIR} ./${BINDIR} && ln -fs ${SYMROOT} ./${LIBDIR} && \
- ln -fs ${SYMROOT} ./${BINDIR} && ln -fs ${OBJ_DIR}/tktest ${SYMROOT}
+ @cd "${OBJ_DIR}" && mkdir -p $(dir $(subst ${space},\ ,./${LIBDIR})) $(dir $(subst ${space},\ ,./${BINDIR})) "${SYMROOT}" && \
+ rm -rf "./${LIBDIR}" "./${BINDIR}" && ln -fs "${SYMROOT}" "./${LIBDIR}" && \
+ ln -fs "${SYMROOT}" "./${BINDIR}" && ln -fs "${OBJ_DIR}/tktest" "${SYMROOT}"
ifeq (${TK_X11},)
- @rm -f ${OBJ_DIR}/${BINDIR} && \
- ln -fs Wish.app/Contents/MacOS/Wish ${SYMROOT}/${WISH}
+ @rm -f "${OBJ_DIR}/${BINDIR}" && \
+ ln -fs Wish.app/Contents/MacOS/Wish "${SYMROOT}/${WISH}"
endif
# Create symbolic link to Tcl.framework in ${SYMROOT}if necessary
- @cd ${SYMROOT} && if [ ! -e Tcl.framework -o -L Tcl.framework ]; then \
- rm -f Tcl.framework && ln -s ${TCL_FRAMEWORK_DIR}/Tcl.framework . ; fi
+ @cd "${SYMROOT}" && if [ ! -e Tcl.framework -o -L Tcl.framework ]; then \
+ rm -f Tcl.framework && ln -s "${TCL_FRAMEWORK_DIR}/Tcl.framework" . ; fi
endif
install-${PROJECT}: build-${PROJECT}
@@ -209,7 +217,7 @@ endif
ifeq (${EMBEDDED_BUILD}_${TK_X11},1_)
# workaround bug with 'cp -pRH' on Darwin 6 and earlier
@if [ "`uname -r | awk -F. '{print $$1}'`" -lt 7 ]; then \
- mkdir -p ${TOP_DIR}/{"${TCL_FMWK_DIR}","${TK_FMWK_DIR}"}/PrivateHeaders; fi
+ mkdir -p "${TOP_DIR}"/{"${TCL_FMWK_DIR}","${TK_FMWK_DIR}"}/PrivateHeaders; fi
endif
ifeq (${INSTALL_BUILD},1)
ifeq (${EMBEDDED_BUILD},1)
@@ -225,16 +233,16 @@ else
if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; \
if [ -n "${TK_X11}" -a ! -d usr/X11R6 ]; then mkdir -p usr && ln -fs /usr/X11R6 usr/ && RM_USRX11=1; fi; \
if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; \
- if [ ! -d ./${LIBDIR}/Tcl.framework ]; then ln -fs ${TCL_FRAMEWORK_DIR}/Tcl.framework ./${LIBDIR}; RM_TCL=1; fi; \
+ if [ ! -d "./${LIBDIR}/Tcl.framework" ]; then ln -fs "${TCL_FRAMEWORK_DIR}/Tcl.framework" "./${LIBDIR}"; RM_TCL=1; fi; \
redo_prebinding -r . "./${TK_FMWK_DIR}/${PRODUCT_NAME}"; \
if [ -z "${TK_X11}" ]; then redo_prebinding -r . "./${TK_FMWK_DIR}/Resources/Wish.app/Contents/MacOS/Wish"; \
else redo_prebinding -r . "./${BINDIR}/${WISH}"; fi; \
if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; \
if [ -n "$${RM_USRX11:-}" ]; then rm -f usr/X11R6; rmdir -p usr 2>&-; fi; \
if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi; \
- if [ -n "$${RM_TCL:-}" ]; then rm -f ./${LIBDIR}/Tcl.framework; fi; fi
+ if [ -n "$${RM_TCL:-}" ]; then rm -f "./${LIBDIR}/Tcl.framework"; fi; fi
# install wish symbolic link
- @ln -fs ${WISH} ${INSTALL_ROOT}${BINDIR}/${wish}
+ @ln -fs ${WISH} "${INSTALL_ROOT}${BINDIR}/${wish}"
endif
endif
ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
@@ -242,20 +250,20 @@ ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
# Deployment build can be installed on top
# of Development build without overwriting
# the debug library
- @cd ${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION} && \
+ @cd "${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}" && \
ln -f "${PRODUCT_NAME}" "${PRODUCT_NAME}_debug"
endif
ifeq (${TK_X11},)
ifeq (${EMBEDDED_BUILD},)
# install Wish.app link in APPLICATION_INSTALL_PATH and setup 'Wish Shell' compatibility links
- @cd ${TOP_DIR} && if [ -n "${APP_DIR}" ]; then mkdir -p "./${APP_DIR}" && rm -rf "./${APP_DIR}/Wish.app" && \
- ln -fsh "./$$(echo ${APP_DIR} | sed -e 's#/[^/][^/]*#/..#g')/${FMWK_DIR}/${PRODUCT_NAME}.framework/Resources/Wish.app" "./${APP_DIR}" && \
+ @cd "${TOP_DIR}" && if [ -n "${APP_DIR}" ]; then mkdir -p "./${APP_DIR}" && rm -rf "./${APP_DIR}/Wish.app" && \
+ ln -fsh "./$$(echo "${APP_DIR}" | sed -e 's#/[^/][^/]*#/..#g')/${FMWK_DIR}/${PRODUCT_NAME}.framework/Resources/Wish.app" "./${APP_DIR}" && \
ln -fsh Wish.app "./${APP_DIR}/Wish Shell.app"; fi && \
ln -fsh Wish.app "./${TK_FMWK_DIR}/Resources/Wish Shell.app" && \
ln -fsh Wish "./${TK_FMWK_DIR}/Resources/Wish.app/Contents/MacOS/Wish Shell"
else
# if we are embedding frameworks, move them into the app and fix their install names
- @cd ${TOP_DIR} && \
+ @cd "${TOP_DIR}" && \
rm -rf "./${APP_DIR}/Wish.app" && mkdir -p "./${APP_DIR}" && \
mv -f "./${TK_FMWK_DIR}/Resources/Wish.app" "./${APP_DIR}" && \
ln -fsh Wish.app "./${APP_DIR}/Wish Shell.app" && \
@@ -263,8 +271,8 @@ else
mkdir -p "./${APP_DIR}/Wish.app/Contents/Frameworks" && \
${CPPROG} -RH "./${FMWK_DIR}"/T{cl,k}.framework "./${APP_DIR}/Wish.app/Contents/Frameworks" && \
cd "./${APP_DIR}/Wish.app/Contents" && \
- rm -rf Frameworks/Tcl.framework/{,/Versions/$(TCL_VERSION)}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \
- rm -rf Frameworks/Tk.framework/{,/Versions/$(VERSION)}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \
+ rm -rf Frameworks/Tcl.framework/{,/Versions/${TCL_VERSION}}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \
+ rm -rf Frameworks/Tk.framework/{,/Versions/${VERSION}}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \
fix_install_id ( ) { \
chmod -RH a+w "$$1"; \
install_name_tool -id $$(otool -L "$$1" | awk "/$$2\.framework.*[^:]\$$/ {sub(\"^.*/Frameworks\",\"@executable_path/../Frameworks\",\$$1); print \$$1}") "$$1"; \
@@ -278,21 +286,21 @@ else
fix_install_id Frameworks/Tcl.framework/Tcl Tcl && fix_install_id Frameworks/Tk.framework/Tk Tk && \
fix_install_name MacOS/Wish Tcl && fix_install_name MacOS/Wish Tk
ifeq (${INSTALL_BUILD},1)
- @cd ${TOP_DIR} && rm -rf "./${FMWK_DIR}"/T{cl,k}.framework && rmdir -p "./${FMWK_DIR}" 2>&- || true
+ @cd "${TOP_DIR}" && rm -rf "./${FMWK_DIR}"/T{cl,k}.framework && rmdir -p "./${FMWK_DIR}" 2>&- || true
endif
endif
endif
clean-${PROJECT}: %-${PROJECT}:
${DO_MAKE}
- rm -rf ${SYMROOT}/{${PRODUCT_NAME}.framework,${WISH},tktest}
- rm -f ${OBJ_DIR}{${LIBDIR},${BINDIR}} && \
- rmdir -p ${OBJ_DIR}$(dir ${LIBDIR}) 2>&- || true && \
- rmdir -p ${OBJ_DIR}$(dir ${BINDIR}) 2>&- || true
+ rm -rf "${SYMROOT}"/{${PRODUCT_NAME}.framework,${WISH},tktest}
+ rm -f "${OBJ_DIR}"{"${LIBDIR}","${BINDIR}"} && \
+ rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${LIBDIR})) 2>&- || true && \
+ rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${BINDIR})) 2>&- || true
distclean-${PROJECT}: %-${PROJECT}: clean-${PROJECT}
${DO_MAKE}
- rm -rf ${OBJ_DIR}
+ rm -rf "${OBJ_DIR}"
test-${PROJECT}: %-${PROJECT}: build-${PROJECT}
${DO_MAKE}
diff --git a/macosx/README b/macosx/README
index 578a2a9..d0357df 100644
--- a/macosx/README
+++ b/macosx/README
@@ -3,7 +3,6 @@ Tcl/Tk Mac OS X README
This is the README file for the Mac OS X/Darwin version of Tcl/Tk.
-
1. Where to go for support
--------------------------
@@ -17,16 +16,11 @@ before asking on the list, many questions have already been answered).
http://groups.google.com/group/comp.lang.tcl/
- The Tcl'ers Wiki also has many pages dealing with Tcl & Tk on Mac OS X, see
- http://wiki.tcl.tk/references/3753!
- http://wiki.tcl.tk/references/8361!
+ http://wiki.tcl.tk/_/ref?N=3753
+ http://wiki.tcl.tk/_/ref?N=8361
- Please report bugs with Tcl or Tk on Mac OS X to the sourceforge bug trackers:
- Tcl: http://sf.net/tracker/?func=add&group_id=10894&atid=110894
- Tk: http://sf.net/tracker/?func=add&group_id=12997&atid=112997
-please make sure that your report Tk specific bugs to the tktoolkit project bug
-tracker rather than the tcl project bug tracker.
-Mac OS X specific bugs should usually be assigned to 'das' or 'wolfsuit'.
-
+ http://tcl.sourceforge.net/
2. Using Tcl/Tk on Mac OS X
---------------------------
@@ -110,9 +104,10 @@ control whether a line/shape is drawn antialiased. The antialiasing threshold is
in your script before drawing, in which case lines (or shapes with outlines)
thinner than <limit> pixels will not be antialiased.
-- Quickdraw text antialiasing is enabled by default when available (from 10.1.5
-onwards). Changing the global boolean variable '::tk::mac::antialiasedtext'
-allows to dis/enable antialiasing on the fly from Tcl (even for existing text).
+- ATSUI text antialiasing by default uses the standard OS antialising settings.
+Setting the global variable '::tk::mac::antialiasedtext' allows to control text
+antialiasing from Tcl: a value of 1 enables AA, 0 disables AA and -1 restores
+the default behaviour of respecting the OS settings.
- Scrollbars: There are two scrollbar variants in Aqua, normal & small. The
normal scrollbar has a small dimension of 15, the small variant 11. Access to
@@ -134,6 +129,11 @@ So, for instance this code will spin the spinner:
}
This was added in Tk 8.4.2
+- If you want to use Remote Debugging with Xcode 1.5 or 2.2, you need to set the
+environment variable XCNOSTDIN to 1 in the Executable editor for Wish. That will
+cause us to force closing stdin & stdout. Otherwise, given how Xcode launches
+Wish remotely, they will be left open and then Wish & gdb will fight for stdin.
+
3. Building Tcl/Tk on Mac OS X
------------------------------
@@ -156,11 +156,69 @@ The Mac OS X specific configure flags are --enable-aqua, --enable-framework and
select based notifier). Note that --enable-aqua is incompatible with
--disable-corefoundation (for both Tcl and Tk configure).
-- It is also possible to build with Apple's IDE via the tk/macosx/Wish.pbproj
-project, this simply calls through to the tk/macosx/Makefile. It requires a
-build of the tcl/macosx/Tcl.pbproj project.
-
-- To build universal binaries, set CFLAGS as follows:
+- It is also possible to build with Apple's IDE via the projects in tk/macosx,
+take care to only use the project matching your DevTools and OS version:
+ * Wish.pbproj for Xcode or ProjectBuilder on 10.3 and earlier, this has a
+ 'Tk' target that simply calls through to the tcl/macosx/GNUMakefile. It
+ requires a build of the 'Tcl' target of tcl/macosx/Tcl.pbproj.
+ * Wish.xcode Xcode 2.4 on 10.4 and Xcode 2.5 on 10.4 and later, which
+ additionally has native 'tktest' and 'tktest-X11' targets for
+ debugging, these targets' 'Debug' build configuration has ZeroLink and
+ Fix&Continue enabled, use the 'DebugNoFixZL' build configuration if you
+ need a debug build without these features. The following build
+ configurations are available:
+ 'DebugUnthreaded': debug build with threading turned off.
+ 'DebugNoCF': debug build with corefoundation turned off
+ (for 'tktest-X11' only).
+ 'DebugNoCFUnthreaded': debug build with corefoundation turned off
+ (for 'tktest-X11' only) and with threading turned off.
+ 'DebugMemCompile': debug build with memory and bytecode debugging on.
+ 'DebugLeaks': debug build with PURIFY defined.
+ 'DebugGCov': debug build with generation of gcov data files enabled.
+ 'ReleaseUniversal': builds the targets as universal binaries for the
+ ppc and i386 architectures.
+ 'ReleaseUniversal10.4uSDK': same as 'ReleaseUniversal' but builds
+ against the 10.4u SDK, required to build universal binaries on
+ PowerPC Tiger (where the system libraries are not universal).
+ 'ReleasePPC10.3.9SDK': builds for PowerPC against the 10.3.9 SDK, useful
+ for verifying on Tiger that building on Panther would succeed.
+ 'ReleasePPC10.2.8SDK': builds for PowerPC with gcc-3.3 against the
+ 10.2.8 SDK, useful to verify on Tiger that building on Jaguar
+ would succeed.
+ * Wish.xcodeproj for Xcode 3.1 on 10.5 and later, which has the following
+ additional build configurations:
+ 'ReleaseUniversal10.5SDK': same as 'ReleaseUniversal' but builds
+ against the 10.5 SDK on Leopard (with 10.5 deployment target).
+ 'Debug gcc42': same as 'Debug' but builds with gcc 4.2.
+ 'Debug llvmgcc42': same as 'Debug' but builds with llvm-gcc 4.2.
+ 'ReleaseUniversal gcc42': same as 'ReleaseUniversal' but builds with
+ gcc 4.2.
+ 'ReleaseUniversal llvmgcc42': same as 'ReleaseUniversal' but builds
+ with llvm-gcc 4.2.
+ 'Debug64bit': builds the 'tktest-X11' target as 64bit with debugging
+ enabled (requires a 64bit capable processor).
+ Note that all non-SDK configurations have 10.5 deployment target and
+ that all Universal configurations build the 'tktest-X11' target
+ also for the ppc64 and x86_64 architectures.
+
+Notes about the native targets of the Xcode projects:
+ * the Xcode projects refer to the toplevel tcl and tk source dirs through
+ the TCL_SRCROOT and TK_SRCROOT user build settings, by default these are
+ set to the project-relative paths '../../tcl' and '../../tk', if your
+ source directories are named differently, e.g. '../../tcl8.5', you'll
+ need to manually change the TCL_SRCROOT and TK_SRCROOT settings by
+ editing your ${USER}.pbxuser file (located inside the Wish.xcodeproj
+ bundle directory) with a text editor.
+ * the native targets need a version of the unix configure scripts with config
+ headers enabled, this is automatically generated as tcl/macosx/configure
+ and tk/macosx/configure by the project but that requires 2.59 versions
+ of autoconf & autoheader. These are not available on Mac OS X 10.5 by
+ default and need to be installed manually. By default they are assumed
+ to be installed as /usr/local/bin/autoconf-2.59 and
+ /usr/local/bin/autoheader-2.59, set the AUTOCONF and AUTOHEADER build
+ settings in ${USER}.pbxuser to their true locations if necessary.
+
+- To build universal binaries outside of Wish.xcodeproj, set CFLAGS as follows:
export CFLAGS="-arch ppc -arch i386 \
-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"
This requires Mac OS X 10.4 and Xcode 2.2 (_not_ Xcode 2.1) and will work on any
@@ -183,6 +241,8 @@ to the minimal OS version (>= 10.2) the binaries should be able to run on, e.g:
This requires Mac OS X 10.2 and gcc 3.1; if you have gcc 4 or later you can set
CFLAGS instead:
export CFLAGS="-mmacosx-version-min=10.2"
+The Wish.xcode project is setup to produce binaries that can run on 10.2 or
+later (except for the Universal and SDK configurations).
Support for weak-linking was added to the code for 8.4.14/8.5a5.
Detailed Instructions for building with macosx/GNUmakefile
@@ -221,26 +281,26 @@ instead by passing an INSTALL_ROOT argument to make:
make -C tcl${ver}/macosx install INSTALL_ROOT="${HOME}/"
make -C tk${ver}/macosx install INSTALL_ROOT="${HOME}/"
-- The default Makefile targets will build _both_ debug and optimized versions of
-the Tcl and Tk frameworks with the standard convention of naming the debug
+- The default GNUmakefile targets will build _both_ debug and optimized versions
+of the Tcl and Tk frameworks with the standard convention of naming the debug
library Tcl.framework/Tcl_debug resp. Tk.framework/Tk_debug.
This allows switching to the debug libraries at runtime by setting
export DYLD_IMAGE_SUFFIX=_debug
(c.f. man dyld for more details)
If you only want to build and install the debug or optimized build, use the
-'develop' or 'deploy' target variants of the Makefiles, respectively.
+'develop' or 'deploy' target variants of the GNUmakefiles, respectively.
For example, to build and install only the optimized versions:
make -C tcl${ver}/macosx deploy
make -C tk${ver}/macosx deploy
sudo make -C tcl${ver}/macosx install-deploy
sudo make -C tk${ver}/macosx install-deploy
-- The Makefiles can also build a version of 'Wish' that has the Tcl and Tk
+- The GNUmakefiles can also build a version of 'Wish' that has the Tcl and Tk
frameworks embedded in its application package. This allows for standalone
deployment of the application with no installation required, e.g. from read-only
media. To build & install in this manner, use the 'embedded' target variants of
-the Makefiles. For example, to build a standalone 'Wish.app'
+the GNUmakefiles. For example, to build a standalone 'Wish.app'
in ./embedded/Applications/Utilities:
make -C tcl${ver}/macosx embedded
make -C tk${ver}/macosx embedded
@@ -260,7 +320,7 @@ still need a tcl sourcetree in the location specified in TCL_SRC_DIR in
Tcl.framework/tclConfig.sh. Also, linking with Tcl.framework has to work exactly
as indicated in TCL_LIB_SPEC in Tcl.framework/tclConfig.sh.
If you used non-default install locations for Tcl.framework, specify them as
-make overrides to the tk/macosx Makefile, e.g.
+make overrides to the tk/macosx GNUmakefile, e.g.
make -C tk${ver}/macosx \
TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin
sudo make -C tk${ver}/macosx install \
diff --git a/macosx/Tk-Info.plist.in b/macosx/Tk-Info.plist.in
index 0c6291c..1705a98 100644
--- a/macosx/Tk-Info.plist.in
+++ b/macosx/Tk-Info.plist.in
@@ -14,10 +14,10 @@
<string>@TK_LIB_FILE@</string>
<key>CFBundleGetInfoString</key>
<string>Tk @TK_WINDOWINGSYSTEM@ @TK_VERSION@@TK_PATCH_LEVEL@,
-Copyright © @TK_YEAR@ Tcl Core Team,
+Copyright © 1989-@TK_YEAR@ Tcl Core Team,
Copyright © 2002-@TK_YEAR@ Daniel A. Steffen,
-Initial MacOS X Port by Jim Ingham &amp; Ian Reid,
-Copyright © 2001-2002, Apple Computer, Inc.</string>
+Copyright © 2001-2002 Apple Inc.,
+Copyright © 2001-2002 Jim Ingham &amp; Ian Reid</string>
<key>CFBundleIdentifier</key>
<string>com.tcltk.tklibrary</string>
<key>CFBundleInfoDictionaryVersion</key>
diff --git a/macosx/Wish-Common.xcconfig b/macosx/Wish-Common.xcconfig
new file mode 100644
index 0000000..d9646a9
--- /dev/null
+++ b/macosx/Wish-Common.xcconfig
@@ -0,0 +1,48 @@
+//
+// Wish-Common.xcconfig --
+//
+// This file contains the Xcode build settings comon to all
+// project configurations in Wish.xcodeproj.
+//
+// Copyright (c) 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
+//
+// See the file "license.terms" for information on usage and redistribution
+// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+HEADER_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TK_SRCROOT)/xlib "$(DERIVED_FILE_DIR)/tcl" "$(DERIVED_FILE_DIR)/tk" $(HEADER_SEARCH_PATHS)
+REZ_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TCL_SRCROOT)/generic $(REZ_SEARCH_PATHS)
+OTHER_LDFLAGS = -headerpad_max_install_names -sectcreate __TEXT __info_plist "$(DERIVED_FILE_DIR)/tk/Wish-Info.plist" $(OTHER_LDFLAGS)
+OTHER_LDFLAGS_AQUA = -sectcreate __TEXT __tk_rsrc "$(REZ_COLLECTOR_DIR)/$(PRODUCT_NAME).rsrc"
+INSTALL_PATH = $(APPLICATION_INSTALL_PATH)
+INSTALL_MODE_FLAG = go-w,a+rX
+GCC_PREFIX_HEADER = $(DERIVED_FILE_DIR)/tk/tkConfig.h
+OTHER_CFLAGS = -imacros "$(DERIVED_FILE_DIR)/tcl/tclConfig.h" $(OTHER_CFLAGS)
+GCC_GENERATE_DEBUGGING_SYMBOLS = YES
+GCC_NO_COMMON_BLOCKS = YES
+GCC_DYNAMIC_NO_PIC = YES
+GCC = $(DEVELOPER_DIR)/usr/bin/gcc
+GCC_VERSION = 4.0
+CC = $(GCC)-$(GCC_VERSION)
+LD = $(CC)
+WARNING_CFLAGS_GCC3 = -Wall -Wno-implicit-int -Wno-unused-parameter -Wno-deprecated-declarations
+WARNING_CFLAGS = -Wextra -Wno-missing-field-initializers -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS_GCC3) $(WARNING_CFLAGS)
+REZ_RESOURCE_MAP_READ_ONLY = YES
+APPLICATION_INSTALL_PATH = /Applications/Utilities
+BINDIR = $(PREFIX)/bin
+CFLAGS = $(CFLAGS)
+CPPFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) $(CPPFLAGS)
+FRAMEWORK_INSTALL_PATH = /Library/Frameworks
+INCLUDEDIR = $(PREFIX)/include
+LIBDIR = $(PREFIX)/lib
+MANDIR = $(PREFIX)/man
+PER_ARCH_CFLAGS_ppc = -mcpu=G3 -mtune=G4 $(PER_ARCH_CFLAGS_ppc)
+PREFIX = /usr/local
+TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects
+TCL_CONFIGURE_ARGS = --enable-threads --enable-dtrace
+TCL_FRAMEWORK_DIR = $(SYMROOT)/../tcl/$(CONFIGURATION)
+TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION)
+TCL_PACKAGE_PATH = "$(LIBDIR)"
+TCL_DEFS = HAVE_TCL_CONFIG_H
+TK_LIBRARY = $(LIBDIR)/tk$(VERSION)
+TK_DEFS = HAVE_TK_CONFIG_H TCL_NO_DEPRECATED
+VERSION = 8.5
diff --git a/macosx/Wish-Debug.xcconfig b/macosx/Wish-Debug.xcconfig
new file mode 100644
index 0000000..09def97
--- /dev/null
+++ b/macosx/Wish-Debug.xcconfig
@@ -0,0 +1,19 @@
+//
+// Wish-Debug.xcconfig --
+//
+// This file contains the Xcode build settings for all Debug
+// project configurations in Wish.xcodeproj.
+//
+// Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+//
+// See the file "license.terms" for information on usage and redistribution
+// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+#include "Wish-Common.xcconfig"
+
+DEBUG_INFORMATION_FORMAT = dwarf
+DEPLOYMENT_POSTPROCESSING = NO
+GCC_OPTIMIZATION_LEVEL = 0
+GCC_PREPROCESSOR_DEFINITIONS = DEBUGLEVEL=4 $(TCL_DEFS) $(TK_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS)
+CONFIGURE_ARGS = --enable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS)
+MAKE_TARGET = develop
diff --git a/macosx/Wish-Info.plist.in b/macosx/Wish-Info.plist.in
index ff046a8..85b0b08 100644
--- a/macosx/Wish-Info.plist.in
+++ b/macosx/Wish-Info.plist.in
@@ -39,10 +39,10 @@
<string>Wish</string>
<key>CFBundleGetInfoString</key>
<string>Wish Shell @TK_VERSION@@TK_PATCH_LEVEL@,
-Copyright © @TK_YEAR@ Tcl Core Team,
+Copyright © 1989-@TK_YEAR@ Tcl Core Team,
Copyright © 2002-@TK_YEAR@ Daniel A. Steffen,
-Initial MacOS X Port by Jim Ingham &amp; Ian Reid,
-Copyright © 2001-2002, Apple Computer, Inc.</string>
+Copyright © 2001-2002 Apple Inc.,
+Copyright © 2001-2002 Jim Ingham &amp; Ian Reid</string>
<key>CFBundleIconFile</key>
<string>Wish.icns</string>
<key>CFBundleIdentifier</key>
diff --git a/macosx/Wish-Release.xcconfig b/macosx/Wish-Release.xcconfig
new file mode 100644
index 0000000..d843341
--- /dev/null
+++ b/macosx/Wish-Release.xcconfig
@@ -0,0 +1,19 @@
+//
+// Wish-Release.xcconfig --
+//
+// This file contains the Xcode build settings for all Release
+// project configurations in Wish.xcodeproj.
+//
+// Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+//
+// See the file "license.terms" for information on usage and redistribution
+// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+#include "Wish-Common.xcconfig"
+
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
+// DEPLOYMENT_POSTPROCESSING = YES
+GCC_OPTIMIZATION_LEVEL = s
+GCC_PREPROCESSOR_DEFINITIONS = NDEBUG $(TCL_DEFS) $(TK_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS)
+CONFIGURE_ARGS = --disable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS)
+MAKE_TARGET = deploy
diff --git a/macosx/Wish.pbproj/project.pbxproj b/macosx/Wish.pbproj/project.pbxproj
index 5565720..b1c72e5 100644
--- a/macosx/Wish.pbproj/project.pbxproj
+++ b/macosx/Wish.pbproj/project.pbxproj
@@ -1794,80 +1794,80 @@
F5375689016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = error.bmp;
- path = ../bitmaps/error.bmp;
+ name = error.xbm;
+ path = ../bitmaps/error.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F537568A016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = gray12.bmp;
- path = ../bitmaps/gray12.bmp;
+ name = gray12.xbm;
+ path = ../bitmaps/gray12.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F537568B016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = gray25.bmp;
- path = ../bitmaps/gray25.bmp;
+ name = gray25.xbm;
+ path = ../bitmaps/gray25.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F537568C016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = gray50.bmp;
- path = ../bitmaps/gray50.bmp;
+ name = gray50.xbm;
+ path = ../bitmaps/gray50.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F537568D016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = gray75.bmp;
- path = ../bitmaps/gray75.bmp;
+ name = gray75.xbm;
+ path = ../bitmaps/gray75.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F537568E016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = hourglass.bmp;
- path = ../bitmaps/hourglass.bmp;
+ name = hourglass.xbm;
+ path = ../bitmaps/hourglass.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F537568F016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = info.bmp;
- path = ../bitmaps/info.bmp;
+ name = info.xbm;
+ path = ../bitmaps/info.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F5375690016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = questhead.bmp;
- path = ../bitmaps/questhead.bmp;
+ name = questhead.xbm;
+ path = ../bitmaps/questhead.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F5375691016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = question.bmp;
- path = ../bitmaps/question.bmp;
+ name = question.xbm;
+ path = ../bitmaps/question.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
F5375692016C3F1001DC9062 = {
isa = PBXFileReference;
lastKnownFileType = image.bmp;
- name = warning.bmp;
- path = ../bitmaps/warning.bmp;
+ name = warning.xbm;
+ path = ../bitmaps/warning.xbm;
refType = 2;
sourceTree = SOURCE_ROOT;
};
@@ -2261,12 +2261,13 @@
sourceTree = SOURCE_ROOT;
};
F9D6747B08E84DC100688CAA = {
- buildArgumentsString = "-c \"cd \\\"${TK_SRCROOT}/macosx\\\" && ACTION=${ACTION} && gnumake \\${ACTION:+\\${ACTION/clean/distclean}-}${MAKE_TARGET} INSTALL_ROOT=\\\"${DSTROOT}\\\" INSTALL_PATH=\\\"${INSTALL_PATH}\\\" APPLICATION_INSTALL_PATH=\\\"${APPLICATION_INSTALL_PATH}\\\" PREFIX=\\\"${PREFIX}\\\" BINDIR=\\\"${BINDIR}\\\" MANDIR=\\\"${MANDIR}\\\" TCL_BUILD_DIR=\\\"${TCL_BUILD_DIR}\\\" \\${EXTRA_MAKE_FLAGS} ${ALL_SETTINGS}\"";
+ buildArgumentsString = "-c \"cd \\\"${TK_SRCROOT}/macosx\\\" && ACTION=${ACTION} && CFLAGS=\\\"${CFLAGS}\\\" gnumake \\${ACTION:+\\${ACTION/clean/distclean}-}${MAKE_TARGET} INSTALL_ROOT=\\\"${DSTROOT}\\\" INSTALL_PATH=\\\"${INSTALL_PATH}\\\" PREFIX=\\\"${PREFIX}\\\" BINDIR=\\\"${BINDIR}\\\" MANDIR=\\\"${MANDIR}\\\" TCL_BUILD_DIR=\\\"${TCL_BUILD_DIR}\\\" APPLICATION_INSTALL_PATH=\\\"${APPLICATION_INSTALL_PATH}\\\" \\${EXTRA_MAKE_FLAGS} ${ALL_SETTINGS}\"";
buildPhases = (
);
buildSettings = {
APPLICATION_INSTALL_PATH = /Applications/Utilities;
BINDIR = "${PREFIX}/bin";
+ CFLAGS = "";
INSTALL_PATH = /Library/Frameworks;
MANDIR = "${PREFIX}/man";
PREFIX = /usr/local;
diff --git a/macosx/Wish.xcode/default.pbxuser b/macosx/Wish.xcode/default.pbxuser
new file mode 100644
index 0000000..c832f6b
--- /dev/null
+++ b/macosx/Wish.xcode/default.pbxuser
@@ -0,0 +1,337 @@
+// !$*UTF8*$!
+{
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ activeBuildConfigurationName = Debug;
+ activeExecutable = F9E61D1C090A4282002B3151 /* Wish */;
+ activeTarget = F9E61D16090A3E94002B3151 /* Tk */;
+ codeSenseManager = F944EB9D08F798180049FDD4 /* Code sense */;
+ executables = (
+ F9E61D1C090A4282002B3151 /* Wish */,
+ F944EB8F08F798100049FDD4 /* tktest */,
+ F9FD31F50CC1AD070073837D /* tktest-X11 */,
+ );
+ perUserDictionary = {
+ com.apple.ide.smrt.PBXUserSmartGroupsKey.Rev10 = <040b747970656473747265616d8103e88401408484840e4e534d757461626c654172726179008484074e534172726179008484084e534f626a65637400858401690192848484134e534d757461626c6544696374696f6e6172790084840c4e5344696374696f6e6172790095960792848484084e53537472696e67019584012b146162736f6c75746550617468546f42756e646c658692849a9a008692849a9a046e616d658692849a9a14496d706c656d656e746174696f6e2046696c65738692849a9a03636c7a8692849a9a1550425846696c656e616d65536d61727447726f75708692849a9a0b6465736372697074696f6e8692849a9a103c6e6f206465736372697074696f6e3e8692849a9a08676c6f62616c49448692849a9a183143433045413430303433353045463930303434343130428692849a9a195042585472616e7369656e744c6f636174696f6e4174546f708692849a9a06626f74746f6d8692849a9a0b707265666572656e63657386928497960892849a9a1250425850726f6a65637453636f70654b65798692849a9a035945538692849a9a05696d6167658692849a9a0b536d617274466f6c6465728692849a9a0763616e536176658692848484084e534e756d626572008484074e5356616c7565009584012a849696018692849a9a0572656765788692849a9a065c2e286329248692849a9a04726f6f748692849a9a093c50524f4a4543543e8692849a9a097265637572736976658692ad92849a9a0669734c656166869284ae9db096008692849a9a07666e6d617463688692849a9a0086868686>;
+ };
+ sourceControlManager = F944EB9C08F798180049FDD4 /* Source Control */;
+ userBuildSettings = {
+ GCC = "${DEVELOPER_DIR}/usr/bin/gcc";
+ SYMROOT = "${SRCROOT}/../../build/tk";
+ TCL_SRCROOT = "${SRCROOT}/../../tcl";
+ TK_SRCROOT = "${SRCROOT}/../../tk";
+ };
+ };
+ 8DD76FA90486AB0100D96B5E /* tktest */ = {
+ activeExec = 0;
+ executables = (
+ F944EB8F08F798100049FDD4 /* tktest */,
+ );
+ };
+ F944EB8F08F798100049FDD4 /* tktest */ = {
+ isa = PBXExecutable;
+ activeArgIndex = 0;
+ activeArgIndices = (
+ YES,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ );
+ argumentStrings = (
+ "${TK_SRCROOT}/library/demos/widget",
+ "${TK_SRCROOT}/tests/all.tcl",
+ "${TK_SRCROOT}/tests/ttk/all.tcl",
+ "-geometry +0+0",
+ "-singleproc 1",
+ "-verbose \"bet\"",
+ "-skip window-2.9",
+ );
+ autoAttachOnCrash = 1;
+ configStateDict = {
+ "PBXLSLaunchAction-0" = {
+ PBXLSLaunchAction = 0;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXLSRunLaunchConfig;
+ displayName = "Executable Runner";
+ identifier = com.apple.Xcode.launch.runConfig;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ "PBXLSLaunchAction-1" = {
+ PBXLSLaunchAction = 1;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXGDB_LaunchConfig;
+ displayName = GDB;
+ identifier = com.apple.Xcode.launch.GDBMI_Config;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ };
+ customDataFormattersEnabled = 1;
+ debuggerPlugin = GDBDebugging;
+ disassemblyDisplayState = 0;
+ dylibVariantSuffix = "";
+ enableDebugStr = 0;
+ environmentEntries = (
+ {
+ active = YES;
+ name = TCL_LIBRARY;
+ value = "${TCL_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TK_LIBRARY;
+ value = "${TK_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TCLLIBPATH;
+ value = /Library/Tcl;
+ },
+ {
+ active = NO;
+ name = DYLD_PRINT_LIBRARIES;
+ },
+ {
+ active = NO;
+ name = EventDebug;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocBadFreeAbort;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocLogFile;
+ value = /tmp/malloc.log;
+ },
+ {
+ active = NO;
+ name = MallocStackLogging;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocStackLoggingNoCompact;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocPreScribble;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocScribble;
+ value = 1;
+ },
+ );
+ executableSystemSymbolLevel = 0;
+ executableUserSymbolLevel = 0;
+ libgmallocEnabled = 0;
+ name = tktest;
+ sourceDirectories = (
+ );
+ };
+ F944EB9C08F798180049FDD4 /* Source Control */ = {
+ isa = PBXSourceControlManager;
+ fallbackIsa = XCSourceControlManager;
+ isSCMEnabled = 0;
+ scmConfiguration = {
+ CVSToolPath = /usr/bin/cvs;
+ CVSUseSSH = NO;
+ SubversionToolPath = /usr/local/bin/svn;
+ };
+ scmType = scm.cvs;
+ };
+ F944EB9D08F798180049FDD4 /* Code sense */ = {
+ isa = PBXCodeSenseManager;
+ indexTemplatePath = "";
+ };
+ F9E61D16090A3E94002B3151 /* Tk */ = {
+ activeExec = 0;
+ executables = (
+ F9E61D1C090A4282002B3151 /* Wish */,
+ );
+ };
+ F9E61D1C090A4282002B3151 /* Wish */ = {
+ isa = PBXExecutable;
+ activeArgIndex = 0;
+ activeArgIndices = (
+ YES,
+ );
+ argumentStrings = (
+ "${TK_SRCROOT}/library/demos/widget",
+ );
+ autoAttachOnCrash = 1;
+ configStateDict = {
+ "PBXLSLaunchAction-0" = {
+ PBXLSLaunchAction = 0;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXLSRunLaunchConfig;
+ displayName = "Executable Runner";
+ identifier = com.apple.Xcode.launch.runConfig;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ "PBXLSLaunchAction-1" = {
+ PBXLSLaunchAction = 1;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXGDB_LaunchConfig;
+ displayName = GDB;
+ identifier = com.apple.Xcode.launch.GDBMI_Config;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ };
+ customDataFormattersEnabled = 1;
+ debuggerPlugin = GDBDebugging;
+ disassemblyDisplayState = 0;
+ dylibVariantSuffix = "";
+ enableDebugStr = 0;
+ environmentEntries = (
+ {
+ active = NO;
+ name = DYLD_PRINT_LIBRARIES;
+ },
+ );
+ executableSystemSymbolLevel = 0;
+ executableUserSymbolLevel = 0;
+ libgmallocEnabled = 0;
+ name = Wish;
+ sourceDirectories = (
+ );
+ };
+ F97258A50A86873C00096C78 /* tktest-X11 */ = {
+ activeExec = 0;
+ executables = (
+ F9FD31F50CC1AD070073837D /* tktest-X11 */,
+ );
+ };
+ F9FD31F50CC1AD070073837D /* tktest-X11 */ = {
+ isa = PBXExecutable;
+ activeArgIndex = 0;
+ activeArgIndices = (
+ YES,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ );
+ argumentStrings = (
+ "${TK_SRCROOT}/library/demos/widget",
+ "${TK_SRCROOT}/tests/all.tcl",
+ "${TK_SRCROOT}/tests/ttk/all.tcl",
+ "-geometry +0+0",
+ "-singleproc 1",
+ "-verbose \"bet\"",
+ "-skip window-2.9",
+ );
+ autoAttachOnCrash = 1;
+ configStateDict = {
+ "PBXLSLaunchAction-0" = {
+ PBXLSLaunchAction = 0;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXLSRunLaunchConfig;
+ displayName = "Executable Runner";
+ identifier = com.apple.Xcode.launch.runConfig;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ "PBXLSLaunchAction-1" = {
+ PBXLSLaunchAction = 1;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXGDB_LaunchConfig;
+ displayName = GDB;
+ identifier = com.apple.Xcode.launch.GDBMI_Config;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ };
+ customDataFormattersEnabled = 1;
+ debuggerPlugin = GDBDebugging;
+ disassemblyDisplayState = 0;
+ dylibVariantSuffix = "";
+ enableDebugStr = 0;
+ environmentEntries = (
+ {
+ active = YES;
+ name = TCL_LIBRARY;
+ value = "${TCL_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TK_LIBRARY;
+ value = "${TK_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TCLLIBPATH;
+ value = /Library/Tcl;
+ },
+ {
+ active = YES;
+ name = DISPLAY;
+ value = ":0";
+ },
+ {
+ active = NO;
+ name = DYLD_PRINT_LIBRARIES;
+ },
+ {
+ active = NO;
+ name = MallocBadFreeAbort;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocLogFile;
+ value = /tmp/malloc.log;
+ },
+ {
+ active = NO;
+ name = MallocStackLogging;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocStackLoggingNoCompact;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocPreScribble;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocScribble;
+ value = 1;
+ },
+ );
+ executableSystemSymbolLevel = 0;
+ executableUserSymbolLevel = 0;
+ libgmallocEnabled = 0;
+ name = "tktest-X11";
+ sourceDirectories = (
+ );
+ };
+}
diff --git a/macosx/Wish.xcode/project.pbxproj b/macosx/Wish.xcode/project.pbxproj
new file mode 100644
index 0000000..24c0a82
--- /dev/null
+++ b/macosx/Wish.xcode/project.pbxproj
@@ -0,0 +1,5374 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
+ F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
+ F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
+ F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
+ F966BDD308F27A3F005CB29B /* tkBind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB008F27A39005CB29B /* tkBind.c */; };
+ F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB108F27A39005CB29B /* tkBitmap.c */; };
+ F966BDD508F27A3F005CB29B /* tkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB208F27A39005CB29B /* tkButton.c */; };
+ F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB408F27A39005CB29B /* tkCanvArc.c */; };
+ F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB508F27A39005CB29B /* tkCanvas.c */; };
+ F966BDDA08F27A3F005CB29B /* tkCanvBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB708F27A39005CB29B /* tkCanvBmap.c */; };
+ F966BDDB08F27A3F005CB29B /* tkCanvImg.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB808F27A39005CB29B /* tkCanvImg.c */; };
+ F966BDDC08F27A3F005CB29B /* tkCanvLine.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB908F27A39005CB29B /* tkCanvLine.c */; };
+ F966BDDD08F27A3F005CB29B /* tkCanvPoly.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABA08F27A39005CB29B /* tkCanvPoly.c */; };
+ F966BDDE08F27A3F005CB29B /* tkCanvPs.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABB08F27A39005CB29B /* tkCanvPs.c */; };
+ F966BDE008F27A3F005CB29B /* tkCanvText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABD08F27A39005CB29B /* tkCanvText.c */; };
+ F966BDE108F27A3F005CB29B /* tkCanvUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABE08F27A39005CB29B /* tkCanvUtil.c */; };
+ F966BDE208F27A3F005CB29B /* tkCanvWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABF08F27A39005CB29B /* tkCanvWind.c */; };
+ F966BDE308F27A3F005CB29B /* tkClipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC008F27A39005CB29B /* tkClipboard.c */; };
+ F966BDE408F27A3F005CB29B /* tkCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC108F27A39005CB29B /* tkCmds.c */; };
+ F966BDE508F27A3F005CB29B /* tkColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC208F27A39005CB29B /* tkColor.c */; };
+ F966BDE708F27A3F005CB29B /* tkConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC408F27A39005CB29B /* tkConfig.c */; };
+ F966BDE808F27A3F005CB29B /* tkConsole.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC508F27A39005CB29B /* tkConsole.c */; };
+ F966BDE908F27A3F005CB29B /* tkCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC608F27A39005CB29B /* tkCursor.c */; };
+ F966BDEB08F27A3F005CB29B /* tkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC808F27A39005CB29B /* tkEntry.c */; };
+ F966BDED08F27A3F005CB29B /* tkError.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACA08F27A39005CB29B /* tkError.c */; };
+ F966BDEE08F27A3F005CB29B /* tkEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACB08F27A39005CB29B /* tkEvent.c */; };
+ F966BDEF08F27A3F005CB29B /* tkFileFilter.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACC08F27A39005CB29B /* tkFileFilter.c */; };
+ F966BDF108F27A3F005CB29B /* tkFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACE08F27A39005CB29B /* tkFocus.c */; };
+ F966BDF208F27A3F005CB29B /* tkFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACF08F27A39005CB29B /* tkFont.c */; };
+ F966BDF408F27A3F005CB29B /* tkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD108F27A39005CB29B /* tkFrame.c */; };
+ F966BDF508F27A3F005CB29B /* tkGC.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD208F27A39005CB29B /* tkGC.c */; };
+ F966BDF608F27A3F005CB29B /* tkGeometry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD308F27A39005CB29B /* tkGeometry.c */; };
+ F966BDF708F27A3F005CB29B /* tkGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD408F27A39005CB29B /* tkGet.c */; };
+ F966BDF808F27A3F005CB29B /* tkGrab.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD508F27A39005CB29B /* tkGrab.c */; };
+ F966BDF908F27A3F005CB29B /* tkGrid.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD608F27A39005CB29B /* tkGrid.c */; };
+ F966BDFA08F27A3F005CB29B /* tkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD708F27A39005CB29B /* tkImage.c */; };
+ F966BDFB08F27A3F005CB29B /* tkImgBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD808F27A39005CB29B /* tkImgBmap.c */; };
+ F966BDFC08F27A3F005CB29B /* tkImgGIF.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD908F27A39005CB29B /* tkImgGIF.c */; };
+ F966BDFD08F27A3F005CB29B /* tkImgPhoto.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADA08F27A39005CB29B /* tkImgPhoto.c */; };
+ F966BDFE08F27A3F005CB29B /* tkImgPPM.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADB08F27A39005CB29B /* tkImgPPM.c */; };
+ F966BE0708F27A3F005CB29B /* tkListbox.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE408F27A39005CB29B /* tkListbox.c */; };
+ F966BE0808F27A3F005CB29B /* tkMacWinMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE508F27A39005CB29B /* tkMacWinMenu.c */; };
+ F966BE0908F27A3F005CB29B /* tkMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE608F27A39005CB29B /* tkMain.c */; };
+ F966BE0A08F27A3F005CB29B /* tkMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE708F27A39005CB29B /* tkMenu.c */; };
+ F966BE0C08F27A3F005CB29B /* tkMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE908F27A39005CB29B /* tkMenubutton.c */; };
+ F966BE0E08F27A3F005CB29B /* tkMenuDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEB08F27A39005CB29B /* tkMenuDraw.c */; };
+ F966BE0F08F27A3F005CB29B /* tkMessage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEC08F27A39005CB29B /* tkMessage.c */; };
+ F966BE1008F27A3F005CB29B /* tkObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAED08F27A39005CB29B /* tkObj.c */; };
+ F966BE1108F27A3F005CB29B /* tkOldConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEE08F27A39005CB29B /* tkOldConfig.c */; };
+ F966BE1208F27A3F005CB29B /* tkOption.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEF08F27A39005CB29B /* tkOption.c */; };
+ F966BE1308F27A3F005CB29B /* tkPack.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF008F27A39005CB29B /* tkPack.c */; };
+ F966BE1408F27A3F005CB29B /* tkPanedWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF108F27A39005CB29B /* tkPanedWindow.c */; };
+ F966BE1508F27A3F005CB29B /* tkPlace.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF208F27A39005CB29B /* tkPlace.c */; };
+ F966BE1708F27A3F005CB29B /* tkPointer.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF408F27A39005CB29B /* tkPointer.c */; };
+ F966BE1908F27A3F005CB29B /* tkRectOval.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF608F27A39005CB29B /* tkRectOval.c */; };
+ F966BE1A08F27A3F005CB29B /* tkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF708F27A39005CB29B /* tkScale.c */; };
+ F966BE1C08F27A40005CB29B /* tkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF908F27A39005CB29B /* tkScrollbar.c */; };
+ F966BE1E08F27A40005CB29B /* tkSelect.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFB08F27A39005CB29B /* tkSelect.c */; };
+ F966BE2008F27A40005CB29B /* tkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFD08F27A39005CB29B /* tkSquare.c */; };
+ F966BE2208F27A40005CB29B /* tkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFF08F27A39005CB29B /* tkStubInit.c */; };
+ F966BE2308F27A40005CB29B /* tkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0008F27A39005CB29B /* tkStubLib.c */; };
+ F966BE2408F27A40005CB29B /* tkStyle.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0108F27A39005CB29B /* tkStyle.c */; };
+ F966BE2508F27A40005CB29B /* tkTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0208F27A39005CB29B /* tkTest.c */; };
+ F966BE2608F27A40005CB29B /* tkText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0308F27A39005CB29B /* tkText.c */; };
+ F966BE2808F27A40005CB29B /* tkTextBTree.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0508F27A39005CB29B /* tkTextBTree.c */; };
+ F966BE2908F27A40005CB29B /* tkTextDisp.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0608F27A39005CB29B /* tkTextDisp.c */; };
+ F966BE2B08F27A40005CB29B /* tkTextImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0808F27A39005CB29B /* tkTextImage.c */; };
+ F966BE2C08F27A40005CB29B /* tkTextIndex.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0908F27A39005CB29B /* tkTextIndex.c */; };
+ F966BE2D08F27A40005CB29B /* tkTextMark.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0A08F27A39005CB29B /* tkTextMark.c */; };
+ F966BE2E08F27A40005CB29B /* tkTextTag.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0B08F27A39005CB29B /* tkTextTag.c */; };
+ F966BE2F08F27A40005CB29B /* tkTextWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0C08F27A39005CB29B /* tkTextWind.c */; };
+ F966BE3008F27A40005CB29B /* tkTrig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0D08F27A39005CB29B /* tkTrig.c */; };
+ F966BE3108F27A40005CB29B /* tkUndo.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0E08F27A39005CB29B /* tkUndo.c */; };
+ F966BE3308F27A40005CB29B /* tkUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1008F27A39005CB29B /* tkUtil.c */; };
+ F966BE3408F27A40005CB29B /* tkVisual.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1108F27A39005CB29B /* tkVisual.c */; };
+ F966BE3508F27A40005CB29B /* tkWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1208F27A39005CB29B /* tkWindow.c */; };
+ F966BEDB08F27A40005CB29B /* tkMacOSXBitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC508F27A3B005CB29B /* tkMacOSXBitmap.c */; };
+ F966BEDC08F27A40005CB29B /* tkMacOSXButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC608F27A3B005CB29B /* tkMacOSXButton.c */; };
+ F966BEDD08F27A40005CB29B /* tkMacOSXCarbonEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC708F27A3B005CB29B /* tkMacOSXCarbonEvents.c */; };
+ F966BEDE08F27A40005CB29B /* tkMacOSXClipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC808F27A3B005CB29B /* tkMacOSXClipboard.c */; };
+ F966BEDF08F27A40005CB29B /* tkMacOSXColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC908F27A3B005CB29B /* tkMacOSXColor.c */; };
+ F966BEE008F27A40005CB29B /* tkMacOSXConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBCA08F27A3B005CB29B /* tkMacOSXConfig.c */; };
+ F966BEE108F27A40005CB29B /* tkMacOSXCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBCB08F27A3B005CB29B /* tkMacOSXCursor.c */; };
+ F966BEE308F27A40005CB29B /* tkMacOSXDebug.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBCD08F27A3B005CB29B /* tkMacOSXDebug.c */; };
+ F966BEE608F27A40005CB29B /* tkMacOSXDialog.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD008F27A3B005CB29B /* tkMacOSXDialog.c */; };
+ F966BEE708F27A40005CB29B /* tkMacOSXDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD108F27A3B005CB29B /* tkMacOSXDraw.c */; };
+ F966BEE808F27A40005CB29B /* tkMacOSXEmbed.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */; };
+ F966BEE908F27A40005CB29B /* tkMacOSXEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */; };
+ F966BEEA08F27A40005CB29B /* tkMacOSXEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */; };
+ F966BEEC08F27A40005CB29B /* tkMacOSXFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */; };
+ F966BEED08F27A40005CB29B /* tkMacOSXHLEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */; };
+ F966BEEE08F27A40005CB29B /* tkMacOSXInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */; settings = {COMPILER_FLAGS = "-DTK_LIBRARY=\\\"$(TK_LIBRARY)\\\""; }; };
+ F966BEF108F27A40005CB29B /* tkMacOSXKeyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBDB08F27A3B005CB29B /* tkMacOSXKeyboard.c */; };
+ F966BEF208F27A40005CB29B /* tkMacOSXKeyEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBDC08F27A3B005CB29B /* tkMacOSXKeyEvent.c */; };
+ F966BEF308F27A40005CB29B /* tkMacOSXMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBDD08F27A3B005CB29B /* tkMacOSXMenu.c */; };
+ F966BEF608F27A40005CB29B /* tkMacOSXMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE008F27A3B005CB29B /* tkMacOSXMenubutton.c */; };
+ F966BEF708F27A40005CB29B /* tkMacOSXMenus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE108F27A3B005CB29B /* tkMacOSXMenus.c */; };
+ F966BEF808F27A40005CB29B /* tkMacOSXMouseEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE208F27A3B005CB29B /* tkMacOSXMouseEvent.c */; };
+ F966BEF908F27A40005CB29B /* tkMacOSXNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE308F27A3B005CB29B /* tkMacOSXNotify.c */; };
+ F966BF0108F27A40005CB29B /* tkMacOSXRegion.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBEB08F27A3C005CB29B /* tkMacOSXRegion.c */; };
+ F966BF0308F27A40005CB29B /* tkMacOSXScrlbr.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBED08F27A3C005CB29B /* tkMacOSXScrlbr.c */; };
+ F966BF0408F27A40005CB29B /* tkMacOSXSend.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBEE08F27A3C005CB29B /* tkMacOSXSend.c */; };
+ F966BF0508F27A40005CB29B /* tkMacOSXSubwindows.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBEF08F27A3C005CB29B /* tkMacOSXSubwindows.c */; };
+ F966BF0608F27A40005CB29B /* tkMacOSXTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF008F27A3C005CB29B /* tkMacOSXTest.c */; };
+ F966BF0708F27A40005CB29B /* tkMacOSXWindowEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF108F27A3C005CB29B /* tkMacOSXWindowEvent.c */; };
+ F966BF0808F27A40005CB29B /* tkMacOSXWm.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF208F27A3C005CB29B /* tkMacOSXWm.c */; };
+ F966BF0B08F27A40005CB29B /* tkMacOSXXStubs.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF508F27A3C005CB29B /* tkMacOSXXStubs.c */; };
+ F966BF7F08F27A41005CB29B /* tkAppInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7508F27A3D005CB29B /* tkAppInit.c */; settings = {COMPILER_FLAGS = "-DTK_TEST"; }; };
+ F966BF8308F27A41005CB29B /* tkUnix3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7908F27A3D005CB29B /* tkUnix3d.c */; };
+ F966BF9608F27A41005CB29B /* tkUnixScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8C08F27A3D005CB29B /* tkUnixScale.c */; };
+ F966C02A08F27A42005CB29B /* xcolors.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2408F27A3F005CB29B /* xcolors.c */; };
+ F966C02B08F27A42005CB29B /* xdraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2508F27A3F005CB29B /* xdraw.c */; };
+ F966C02C08F27A42005CB29B /* xgc.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2608F27A3F005CB29B /* xgc.c */; };
+ F966C02D08F27A42005CB29B /* ximage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2708F27A3F005CB29B /* ximage.c */; };
+ F966C02E08F27A42005CB29B /* xutil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2808F27A3F005CB29B /* xutil.c */; };
+ F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07408F2820D005CB29B /* CoreFoundation.framework */; };
+ F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07608F2821B005CB29B /* Carbon.framework */; };
+ F966C07908F28233005CB29B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07808F28233005CB29B /* IOKit.framework */; };
+ F96888050AF786D5000797B5 /* ttkBlink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E10AF786D5000797B5 /* ttkBlink.c */; };
+ F96888060AF786D5000797B5 /* ttkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E20AF786D5000797B5 /* ttkButton.c */; };
+ F96888070AF786D5000797B5 /* ttkCache.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E30AF786D5000797B5 /* ttkCache.c */; };
+ F96888080AF786D5000797B5 /* ttkClamTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E40AF786D5000797B5 /* ttkClamTheme.c */; };
+ F96888090AF786D5000797B5 /* ttkClassicTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E50AF786D5000797B5 /* ttkClassicTheme.c */; };
+ F968880A0AF786D5000797B5 /* ttkDefaultTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */; };
+ F968880B0AF786D5000797B5 /* ttkElements.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E80AF786D5000797B5 /* ttkElements.c */; };
+ F968880C0AF786D5000797B5 /* ttkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E90AF786D5000797B5 /* ttkEntry.c */; };
+ F968880D0AF786D5000797B5 /* ttkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EA0AF786D5000797B5 /* ttkFrame.c */; };
+ F968880E0AF786D5000797B5 /* ttkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EB0AF786D5000797B5 /* ttkImage.c */; };
+ F968880F0AF786D5000797B5 /* ttkInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EC0AF786D5000797B5 /* ttkInit.c */; };
+ F96888100AF786D5000797B5 /* ttkLabel.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887ED0AF786D5000797B5 /* ttkLabel.c */; };
+ F96888110AF786D5000797B5 /* ttkLayout.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EE0AF786D5000797B5 /* ttkLayout.c */; };
+ F96888120AF786D5000797B5 /* ttkManager.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EF0AF786D5000797B5 /* ttkManager.c */; };
+ F96888130AF786D5000797B5 /* ttkNotebook.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F10AF786D5000797B5 /* ttkNotebook.c */; };
+ F96888140AF786D5000797B5 /* ttkPanedwindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F20AF786D5000797B5 /* ttkPanedwindow.c */; };
+ F96888150AF786D5000797B5 /* ttkProgress.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F30AF786D5000797B5 /* ttkProgress.c */; };
+ F96888160AF786D5000797B5 /* ttkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F40AF786D5000797B5 /* ttkScale.c */; };
+ F96888170AF786D5000797B5 /* ttkScroll.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F50AF786D5000797B5 /* ttkScroll.c */; };
+ F96888180AF786D5000797B5 /* ttkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F60AF786D5000797B5 /* ttkScrollbar.c */; };
+ F96888190AF786D5000797B5 /* ttkSeparator.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F70AF786D5000797B5 /* ttkSeparator.c */; };
+ F968881A0AF786D5000797B5 /* ttkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F80AF786D5000797B5 /* ttkSquare.c */; };
+ F968881B0AF786D5000797B5 /* ttkState.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F90AF786D5000797B5 /* ttkState.c */; };
+ F968881C0AF786D5000797B5 /* ttkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FA0AF786D5000797B5 /* ttkStubInit.c */; };
+ F968881D0AF786D5000797B5 /* ttkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FB0AF786D5000797B5 /* ttkStubLib.c */; };
+ F968881E0AF786D5000797B5 /* ttkTagSet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FC0AF786D5000797B5 /* ttkTagSet.c */; };
+ F968881F0AF786D5000797B5 /* ttkTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FD0AF786D5000797B5 /* ttkTheme.c */; };
+ F96888200AF786D5000797B5 /* ttkTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888000AF786D5000797B5 /* ttkTrace.c */; };
+ F96888210AF786D5000797B5 /* ttkTrack.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888010AF786D5000797B5 /* ttkTrack.c */; };
+ F96888220AF786D5000797B5 /* ttkTreeview.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888020AF786D5000797B5 /* ttkTreeview.c */; };
+ F96888230AF786D5000797B5 /* ttkWidget.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888030AF786D5000797B5 /* ttkWidget.c */; };
+ F96888850AF78938000797B5 /* ttkMacOSXTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888840AF78938000797B5 /* ttkMacOSXTheme.c */; };
+ F96D456F08F272BB004A47F5 /* regcomp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED008F272A7004A47F5 /* regcomp.c */; };
+ F96D457208F272BB004A47F5 /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED308F272A7004A47F5 /* regerror.c */; };
+ F96D457508F272BB004A47F5 /* regexec.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED608F272A7004A47F5 /* regexec.c */; };
+ F96D457608F272BB004A47F5 /* regfree.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED708F272A7004A47F5 /* regfree.c */; };
+ F96D457B08F272BB004A47F5 /* tclAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDC08F272A7004A47F5 /* tclAlloc.c */; settings = {COMPILER_FLAGS = "-DUSE_TCLALLOC=0"; }; };
+ F96D457C08F272BB004A47F5 /* tclAsync.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDD08F272A7004A47F5 /* tclAsync.c */; };
+ F96D457D08F272BB004A47F5 /* tclBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDE08F272A7004A47F5 /* tclBasic.c */; };
+ F96D457E08F272BC004A47F5 /* tclBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDF08F272A7004A47F5 /* tclBinary.c */; };
+ F96D457F08F272BC004A47F5 /* tclCkalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE008F272A7004A47F5 /* tclCkalloc.c */; };
+ F96D458008F272BC004A47F5 /* tclClock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE108F272A7004A47F5 /* tclClock.c */; };
+ F96D458108F272BC004A47F5 /* tclCmdAH.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE208F272A7004A47F5 /* tclCmdAH.c */; };
+ F96D458208F272BC004A47F5 /* tclCmdIL.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE308F272A7004A47F5 /* tclCmdIL.c */; };
+ F96D458308F272BC004A47F5 /* tclCmdMZ.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */; };
+ F96D458408F272BC004A47F5 /* tclCompCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE508F272A7004A47F5 /* tclCompCmds.c */; };
+ F96D458508F272BC004A47F5 /* tclCompExpr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE608F272A7004A47F5 /* tclCompExpr.c */; };
+ F96D458608F272BC004A47F5 /* tclCompile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE708F272A7004A47F5 /* tclCompile.c */; };
+ F96D458808F272BC004A47F5 /* tclConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE908F272A7004A47F5 /* tclConfig.c */; };
+ F96D458908F272BC004A47F5 /* tclDate.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEA08F272A7004A47F5 /* tclDate.c */; };
+ F96D458B08F272BC004A47F5 /* tclDictObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEC08F272A7004A47F5 /* tclDictObj.c */; };
+ F96D458C08F272BC004A47F5 /* tclEncoding.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EED08F272A7004A47F5 /* tclEncoding.c */; };
+ F96D458D08F272BC004A47F5 /* tclEnv.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEE08F272A7004A47F5 /* tclEnv.c */; };
+ F96D458E08F272BC004A47F5 /* tclEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEF08F272A7004A47F5 /* tclEvent.c */; };
+ F96D458F08F272BC004A47F5 /* tclExecute.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF008F272A7004A47F5 /* tclExecute.c */; };
+ F96D459008F272BC004A47F5 /* tclFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF108F272A7004A47F5 /* tclFCmd.c */; };
+ F96D459108F272BC004A47F5 /* tclFileName.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF208F272A7004A47F5 /* tclFileName.c */; };
+ F96D459308F272BC004A47F5 /* tclGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF408F272A7004A47F5 /* tclGet.c */; };
+ F96D459508F272BC004A47F5 /* tclHash.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF608F272A7004A47F5 /* tclHash.c */; };
+ F96D459608F272BC004A47F5 /* tclHistory.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF708F272A7004A47F5 /* tclHistory.c */; };
+ F96D459708F272BC004A47F5 /* tclIndexObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF808F272A7004A47F5 /* tclIndexObj.c */; };
+ F96D459B08F272BC004A47F5 /* tclInterp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFC08F272A7004A47F5 /* tclInterp.c */; };
+ F96D459D08F272BC004A47F5 /* tclIO.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFE08F272A7004A47F5 /* tclIO.c */; };
+ F96D459F08F272BC004A47F5 /* tclIOCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0008F272A7004A47F5 /* tclIOCmd.c */; };
+ F96D45A008F272BC004A47F5 /* tclIOGT.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0108F272A7004A47F5 /* tclIOGT.c */; };
+ F96D45A108F272BC004A47F5 /* tclIORChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0208F272A7004A47F5 /* tclIORChan.c */; };
+ F96D45A208F272BC004A47F5 /* tclIOSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0308F272A7004A47F5 /* tclIOSock.c */; };
+ F96D45A308F272BC004A47F5 /* tclIOUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0408F272A7004A47F5 /* tclIOUtil.c */; };
+ F96D45A408F272BC004A47F5 /* tclLink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0508F272A7004A47F5 /* tclLink.c */; };
+ F96D45A508F272BC004A47F5 /* tclListObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0608F272A7004A47F5 /* tclListObj.c */; };
+ F96D45A608F272BC004A47F5 /* tclLiteral.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0708F272A7004A47F5 /* tclLiteral.c */; };
+ F96D45A708F272BC004A47F5 /* tclLoad.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0808F272A7004A47F5 /* tclLoad.c */; };
+ F96D45A908F272BC004A47F5 /* tclMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0A08F272A7004A47F5 /* tclMain.c */; };
+ F96D45AA08F272BC004A47F5 /* tclNamesp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0B08F272A7004A47F5 /* tclNamesp.c */; };
+ F96D45AB08F272BC004A47F5 /* tclNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0C08F272A7004A47F5 /* tclNotify.c */; };
+ F96D45AC08F272BC004A47F5 /* tclObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0D08F272A7004A47F5 /* tclObj.c */; };
+ F96D45AD08F272BC004A47F5 /* tclPanic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0E08F272A7004A47F5 /* tclPanic.c */; };
+ F96D45AE08F272BC004A47F5 /* tclParse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0F08F272A7004A47F5 /* tclParse.c */; };
+ F96D45B008F272BC004A47F5 /* tclPathObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1108F272A7004A47F5 /* tclPathObj.c */; };
+ F96D45B108F272BC004A47F5 /* tclPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1208F272A7004A47F5 /* tclPipe.c */; };
+ F96D45B208F272BC004A47F5 /* tclPkg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1308F272A7004A47F5 /* tclPkg.c */; };
+ F96D45B308F272BC004A47F5 /* tclPkgConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */; settings = {COMPILER_FLAGS = "-DCFG_INSTALL_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_INSTALL_BINDIR=\\\"$(BINDIR)\\\" -DCFG_INSTALL_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_INSTALL_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_INSTALL_DOCDIR=\\\"$(MANDIR)\\\" -DCFG_RUNTIME_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_RUNTIME_BINDIR=\\\"$(BINDIR)\\\" -DCFG_RUNTIME_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_RUNTIME_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_RUNTIME_DOCDIR=\\\"$(MANDIR)\\\""; }; };
+ F96D45B608F272BC004A47F5 /* tclPosixStr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1708F272A7004A47F5 /* tclPosixStr.c */; };
+ F96D45B708F272BC004A47F5 /* tclPreserve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1808F272A7004A47F5 /* tclPreserve.c */; };
+ F96D45B808F272BC004A47F5 /* tclProc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1908F272A7004A47F5 /* tclProc.c */; };
+ F96D45B908F272BC004A47F5 /* tclRegexp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1A08F272A7004A47F5 /* tclRegexp.c */; };
+ F96D45BB08F272BC004A47F5 /* tclResolve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1C08F272A7004A47F5 /* tclResolve.c */; };
+ F96D45BC08F272BC004A47F5 /* tclResult.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1D08F272A7004A47F5 /* tclResult.c */; };
+ F96D45BD08F272BC004A47F5 /* tclScan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1E08F272A7004A47F5 /* tclScan.c */; };
+ F96D45BE08F272BC004A47F5 /* tclStringObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1F08F272A7004A47F5 /* tclStringObj.c */; };
+ F96D45C308F272BC004A47F5 /* tclStrToD.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2408F272A7004A47F5 /* tclStrToD.c */; };
+ F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2508F272A7004A47F5 /* tclStubInit.c */; };
+ F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2608F272A7004A47F5 /* tclStubLib.c */; };
+ F96D45C908F272BC004A47F5 /* tclThread.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2A08F272A7004A47F5 /* tclThread.c */; };
+ F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */; };
+ F96D45CB08F272BC004A47F5 /* tclThreadJoin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */; };
+ F96D45CC08F272BC004A47F5 /* tclThreadStorage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */; };
+ F96D45CE08F272BC004A47F5 /* tclTimer.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2F08F272A7004A47F5 /* tclTimer.c */; };
+ F96D45D008F272BC004A47F5 /* tclTomMathInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */; };
+ F96D45D108F272BC004A47F5 /* tclTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3208F272A7004A47F5 /* tclTrace.c */; };
+ F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3408F272A7004A47F5 /* tclUtf.c */; };
+ F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3508F272A7004A47F5 /* tclUtil.c */; };
+ F96D45D508F272BC004A47F5 /* tclVar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3608F272A7004A47F5 /* tclVar.c */; };
+ F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */; };
+ F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */; };
+ F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426908F272B3004A47F5 /* bn_mp_add.c */; };
+ F96D48E808F272C3004A47F5 /* bn_mp_add_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */; };
+ F96D48EB08F272C3004A47F5 /* bn_mp_clamp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */; };
+ F96D48EC08F272C3004A47F5 /* bn_mp_clear.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426E08F272B3004A47F5 /* bn_mp_clear.c */; };
+ F96D48ED08F272C3004A47F5 /* bn_mp_clear_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */; };
+ F96D48EE08F272C3004A47F5 /* bn_mp_cmp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427008F272B3004A47F5 /* bn_mp_cmp.c */; };
+ F96D48F008F272C3004A47F5 /* bn_mp_cmp_mag.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */; };
+ F96D48F208F272C3004A47F5 /* bn_mp_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427408F272B3004A47F5 /* bn_mp_copy.c */; };
+ F96D48F308F272C3004A47F5 /* bn_mp_count_bits.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */; };
+ F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427608F272B3004A47F5 /* bn_mp_div.c */; };
+ F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427708F272B3004A47F5 /* bn_mp_div_2.c */; };
+ F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */; };
+ F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_mp_div_3.c */; };
+ F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */; };
+ F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427E08F272B3004A47F5 /* bn_mp_exch.c */; };
+ F96D490508F272C3004A47F5 /* bn_mp_grow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428708F272B3004A47F5 /* bn_mp_grow.c */; };
+ F96D490608F272C3004A47F5 /* bn_mp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428808F272B3004A47F5 /* bn_mp_init.c */; };
+ F96D490708F272C3004A47F5 /* bn_mp_init_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */; };
+ F96D490808F272C3004A47F5 /* bn_mp_init_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */; };
+ F96D490908F272C3004A47F5 /* bn_mp_init_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */; };
+ F96D490B08F272C3004A47F5 /* bn_mp_init_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */; };
+ F96D491008F272C3004A47F5 /* bn_mp_karatsuba_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */; };
+ F96D491108F272C3004A47F5 /* bn_mp_karatsuba_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */; };
+ F96D491308F272C3004A47F5 /* bn_mp_lshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429508F272B3004A47F5 /* bn_mp_lshd.c */; };
+ F96D491408F272C3004A47F5 /* bn_mp_mod.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429608F272B3004A47F5 /* bn_mp_mod.c */; };
+ F96D491508F272C3004A47F5 /* bn_mp_mod_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */; };
+ F96D491A08F272C3004A47F5 /* bn_mp_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429C08F272B3004A47F5 /* bn_mp_mul.c */; };
+ F96D491B08F272C3004A47F5 /* bn_mp_mul_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */; };
+ F96D491C08F272C3004A47F5 /* bn_mp_mul_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */; };
+ F96D491D08F272C3004A47F5 /* bn_mp_mul_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */; };
+ F96D492908F272C3004A47F5 /* bn_mp_radix_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */; };
+ F96D492A08F272C3004A47F5 /* bn_mp_radix_smap.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */; };
+ F96D492C08F272C3004A47F5 /* bn_mp_read_radix.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */; };
+ F96D493708F272C3004A47F5 /* bn_mp_rshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */; };
+ F96D493808F272C3004A47F5 /* bn_mp_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BA08F272B3004A47F5 /* bn_mp_set.c */; };
+ F96D493C08F272C3004A47F5 /* bn_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */; };
+ F96D493F08F272C3004A47F5 /* bn_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C108F272B3004A47F5 /* bn_mp_sub.c */; };
+ F96D494008F272C3004A47F5 /* bn_mp_sub_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */; };
+ F96D494608F272C3004A47F5 /* bn_mp_toom_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */; };
+ F96D494708F272C3004A47F5 /* bn_mp_toom_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */; };
+ F96D494908F272C3004A47F5 /* bn_mp_toradix_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */; };
+ F96D494C08F272C3004A47F5 /* bn_mp_zero.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */; };
+ F96D494E08F272C3004A47F5 /* bn_reverse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D008F272B3004A47F5 /* bn_reverse.c */; };
+ F96D494F08F272C3004A47F5 /* bn_s_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */; };
+ F96D495108F272C3004A47F5 /* bn_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */; };
+ F96D495308F272C3004A47F5 /* bn_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */; };
+ F96D495408F272C3004A47F5 /* bn_s_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */; };
+ F96D495508F272C3004A47F5 /* bncore.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D708F272B3004A47F5 /* bncore.c */; };
+ F96D49A908F272C4004A47F5 /* tclMacOSXBundle.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */; };
+ F96D49AD08F272C4004A47F5 /* tclMacOSXFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */; };
+ F96D49AE08F272C4004A47F5 /* tclMacOSXNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */; };
+ F96D4AC608F272C9004A47F5 /* tclLoadDyld.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445B08F272B9004A47F5 /* tclLoadDyld.c */; };
+ F96D4ACA08F272C9004A47F5 /* tclUnixChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445F08F272B9004A47F5 /* tclUnixChan.c */; };
+ F96D4ACB08F272C9004A47F5 /* tclUnixEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446008F272B9004A47F5 /* tclUnixEvent.c */; };
+ F96D4ACC08F272C9004A47F5 /* tclUnixFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446108F272B9004A47F5 /* tclUnixFCmd.c */; };
+ F96D4ACD08F272C9004A47F5 /* tclUnixFile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446208F272B9004A47F5 /* tclUnixFile.c */; };
+ F96D4ACE08F272C9004A47F5 /* tclUnixInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446308F272B9004A47F5 /* tclUnixInit.c */; settings = {COMPILER_FLAGS = "-DTCL_LIBRARY=\\\"$(TCL_LIBRARY)\\\" -DTCL_PACKAGE_PATH=\\\"$(TCL_PACKAGE_PATH)\\\""; }; };
+ F96D4ACF08F272C9004A47F5 /* tclUnixNotfy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446408F272B9004A47F5 /* tclUnixNotfy.c */; };
+ F96D4AD008F272C9004A47F5 /* tclUnixPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446508F272B9004A47F5 /* tclUnixPipe.c */; };
+ F96D4AD208F272CA004A47F5 /* tclUnixSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446708F272B9004A47F5 /* tclUnixSock.c */; };
+ F96D4AD408F272CA004A47F5 /* tclUnixThrd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446908F272B9004A47F5 /* tclUnixThrd.c */; };
+ F96D4AD608F272CA004A47F5 /* tclUnixTime.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446B08F272B9004A47F5 /* tclUnixTime.c */; };
+ F9E61D28090A481F002B3151 /* bn_mp_cmp_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */; };
+ F9E61D29090A486C002B3151 /* bn_mp_neg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A208F272B3004A47F5 /* bn_mp_neg.c */; };
+ F9E61D2A090A4891002B3151 /* bn_mp_sqrt.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */; };
+ F9E61D2B090A48A4002B3151 /* bn_mp_and.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426C08F272B3004A47F5 /* bn_mp_and.c */; };
+ F9E61D2C090A48AC002B3151 /* bn_mp_expt_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */; };
+ F9E61D2D090A48BB002B3151 /* bn_mp_xor.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */; };
+ F9E61D2E090A48BF002B3151 /* bn_mp_or.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A308F272B3004A47F5 /* bn_mp_or.c */; };
+ F9E61D2F090A48C7002B3151 /* bn_mp_shrink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */; };
+ F9E61D30090A48E2002B3151 /* bn_mp_to_unsigned_bin_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */; };
+ F9E61D31090A48F9002B3151 /* bn_mp_to_unsigned_bin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */; };
+ F9E61D32090A48FA002B3151 /* bn_mp_unsigned_bin_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */; };
+ F9EA4AF008FA3BD500B1F5F0 /* tkMacOSXXCursors.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBF408F27A3C005CB29B /* tkMacOSXXCursors.r */; };
+ F9EA4AF208FA3BD800B1F5F0 /* tkMacOSXCursors.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBCC08F27A3B005CB29B /* tkMacOSXCursors.r */; };
+ F9EA4AF308FA3BDA00B1F5F0 /* tkMacOSXAETE.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBC408F27A3B005CB29B /* tkMacOSXAETE.r */; };
+ F9EA4AF408FA3BDB00B1F5F0 /* tkAboutDlg.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBC108F27A3B005CB29B /* tkAboutDlg.r */; };
+ F9FC77B80AB29E9100B7077D /* tclUnixCompat.c in Sources */ = {isa = PBXBuildFile; fileRef = F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */; };
+ F9FD30BC0CC1AD070073837D /* regcomp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED008F272A7004A47F5 /* regcomp.c */; };
+ F9FD30BD0CC1AD070073837D /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED308F272A7004A47F5 /* regerror.c */; };
+ F9FD30BE0CC1AD070073837D /* regexec.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED608F272A7004A47F5 /* regexec.c */; };
+ F9FD30BF0CC1AD070073837D /* regfree.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED708F272A7004A47F5 /* regfree.c */; };
+ F9FD30C00CC1AD070073837D /* tclAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDC08F272A7004A47F5 /* tclAlloc.c */; settings = {COMPILER_FLAGS = "-DUSE_TCLALLOC=0"; }; };
+ F9FD30C10CC1AD070073837D /* tclAsync.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDD08F272A7004A47F5 /* tclAsync.c */; };
+ F9FD30C20CC1AD070073837D /* tclBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDE08F272A7004A47F5 /* tclBasic.c */; };
+ F9FD30C30CC1AD070073837D /* tclBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDF08F272A7004A47F5 /* tclBinary.c */; };
+ F9FD30C40CC1AD070073837D /* tclCkalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE008F272A7004A47F5 /* tclCkalloc.c */; };
+ F9FD30C50CC1AD070073837D /* tclClock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE108F272A7004A47F5 /* tclClock.c */; };
+ F9FD30C60CC1AD070073837D /* tclCmdAH.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE208F272A7004A47F5 /* tclCmdAH.c */; };
+ F9FD30C70CC1AD070073837D /* tclCmdIL.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE308F272A7004A47F5 /* tclCmdIL.c */; };
+ F9FD30C80CC1AD070073837D /* tclCmdMZ.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */; };
+ F9FD30C90CC1AD070073837D /* tclCompCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE508F272A7004A47F5 /* tclCompCmds.c */; };
+ F9FD30CA0CC1AD070073837D /* tclCompExpr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE608F272A7004A47F5 /* tclCompExpr.c */; };
+ F9FD30CB0CC1AD070073837D /* tclCompile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE708F272A7004A47F5 /* tclCompile.c */; };
+ F9FD30CC0CC1AD070073837D /* tclConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE908F272A7004A47F5 /* tclConfig.c */; };
+ F9FD30CD0CC1AD070073837D /* tclDate.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEA08F272A7004A47F5 /* tclDate.c */; };
+ F9FD30CE0CC1AD070073837D /* tclDictObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEC08F272A7004A47F5 /* tclDictObj.c */; };
+ F9FD30CF0CC1AD070073837D /* tclEncoding.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EED08F272A7004A47F5 /* tclEncoding.c */; };
+ F9FD30D00CC1AD070073837D /* tclEnv.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEE08F272A7004A47F5 /* tclEnv.c */; };
+ F9FD30D10CC1AD070073837D /* tclEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEF08F272A7004A47F5 /* tclEvent.c */; };
+ F9FD30D20CC1AD070073837D /* tclExecute.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF008F272A7004A47F5 /* tclExecute.c */; };
+ F9FD30D30CC1AD070073837D /* tclFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF108F272A7004A47F5 /* tclFCmd.c */; };
+ F9FD30D40CC1AD070073837D /* tclFileName.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF208F272A7004A47F5 /* tclFileName.c */; };
+ F9FD30D50CC1AD070073837D /* tclGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF408F272A7004A47F5 /* tclGet.c */; };
+ F9FD30D60CC1AD070073837D /* tclHash.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF608F272A7004A47F5 /* tclHash.c */; };
+ F9FD30D70CC1AD070073837D /* tclHistory.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF708F272A7004A47F5 /* tclHistory.c */; };
+ F9FD30D80CC1AD070073837D /* tclIndexObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF808F272A7004A47F5 /* tclIndexObj.c */; };
+ F9FD30D90CC1AD070073837D /* tclInterp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFC08F272A7004A47F5 /* tclInterp.c */; };
+ F9FD30DA0CC1AD070073837D /* tclIO.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFE08F272A7004A47F5 /* tclIO.c */; };
+ F9FD30DB0CC1AD070073837D /* tclIOCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0008F272A7004A47F5 /* tclIOCmd.c */; };
+ F9FD30DC0CC1AD070073837D /* tclIOGT.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0108F272A7004A47F5 /* tclIOGT.c */; };
+ F9FD30DD0CC1AD070073837D /* tclIORChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0208F272A7004A47F5 /* tclIORChan.c */; };
+ F9FD30DE0CC1AD070073837D /* tclIOSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0308F272A7004A47F5 /* tclIOSock.c */; };
+ F9FD30DF0CC1AD070073837D /* tclIOUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0408F272A7004A47F5 /* tclIOUtil.c */; };
+ F9FD30E00CC1AD070073837D /* tclLink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0508F272A7004A47F5 /* tclLink.c */; };
+ F9FD30E10CC1AD070073837D /* tclListObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0608F272A7004A47F5 /* tclListObj.c */; };
+ F9FD30E20CC1AD070073837D /* tclLiteral.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0708F272A7004A47F5 /* tclLiteral.c */; };
+ F9FD30E30CC1AD070073837D /* tclLoad.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0808F272A7004A47F5 /* tclLoad.c */; };
+ F9FD30E40CC1AD070073837D /* tclMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0A08F272A7004A47F5 /* tclMain.c */; };
+ F9FD30E50CC1AD070073837D /* tclNamesp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0B08F272A7004A47F5 /* tclNamesp.c */; };
+ F9FD30E60CC1AD070073837D /* tclNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0C08F272A7004A47F5 /* tclNotify.c */; };
+ F9FD30E70CC1AD070073837D /* tclObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0D08F272A7004A47F5 /* tclObj.c */; };
+ F9FD30E80CC1AD070073837D /* tclPanic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0E08F272A7004A47F5 /* tclPanic.c */; };
+ F9FD30E90CC1AD070073837D /* tclParse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0F08F272A7004A47F5 /* tclParse.c */; };
+ F9FD30EA0CC1AD070073837D /* tclPathObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1108F272A7004A47F5 /* tclPathObj.c */; };
+ F9FD30EB0CC1AD070073837D /* tclPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1208F272A7004A47F5 /* tclPipe.c */; };
+ F9FD30EC0CC1AD070073837D /* tclPkg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1308F272A7004A47F5 /* tclPkg.c */; };
+ F9FD30ED0CC1AD070073837D /* tclPkgConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */; settings = {COMPILER_FLAGS = "-DCFG_INSTALL_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_INSTALL_BINDIR=\\\"$(BINDIR)\\\" -DCFG_INSTALL_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_INSTALL_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_INSTALL_DOCDIR=\\\"$(MANDIR)\\\" -DCFG_RUNTIME_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_RUNTIME_BINDIR=\\\"$(BINDIR)\\\" -DCFG_RUNTIME_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_RUNTIME_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_RUNTIME_DOCDIR=\\\"$(MANDIR)\\\""; }; };
+ F9FD30EE0CC1AD070073837D /* tclPosixStr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1708F272A7004A47F5 /* tclPosixStr.c */; };
+ F9FD30EF0CC1AD070073837D /* tclPreserve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1808F272A7004A47F5 /* tclPreserve.c */; };
+ F9FD30F00CC1AD070073837D /* tclProc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1908F272A7004A47F5 /* tclProc.c */; };
+ F9FD30F10CC1AD070073837D /* tclRegexp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1A08F272A7004A47F5 /* tclRegexp.c */; };
+ F9FD30F20CC1AD070073837D /* tclResolve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1C08F272A7004A47F5 /* tclResolve.c */; };
+ F9FD30F30CC1AD070073837D /* tclResult.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1D08F272A7004A47F5 /* tclResult.c */; };
+ F9FD30F40CC1AD070073837D /* tclScan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1E08F272A7004A47F5 /* tclScan.c */; };
+ F9FD30F50CC1AD070073837D /* tclStringObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1F08F272A7004A47F5 /* tclStringObj.c */; };
+ F9FD30F60CC1AD070073837D /* tclStrToD.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2408F272A7004A47F5 /* tclStrToD.c */; };
+ F9FD30F70CC1AD070073837D /* tclStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2508F272A7004A47F5 /* tclStubInit.c */; };
+ F9FD30F80CC1AD070073837D /* tclStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2608F272A7004A47F5 /* tclStubLib.c */; };
+ F9FD30F90CC1AD070073837D /* tclThread.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2A08F272A7004A47F5 /* tclThread.c */; };
+ F9FD30FA0CC1AD070073837D /* tclThreadAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */; };
+ F9FD30FB0CC1AD070073837D /* tclThreadJoin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */; };
+ F9FD30FC0CC1AD070073837D /* tclThreadStorage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */; };
+ F9FD30FD0CC1AD070073837D /* tclTimer.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2F08F272A7004A47F5 /* tclTimer.c */; };
+ F9FD30FE0CC1AD070073837D /* tclTomMathInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */; };
+ F9FD30FF0CC1AD070073837D /* tclTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3208F272A7004A47F5 /* tclTrace.c */; };
+ F9FD31000CC1AD070073837D /* tclUtf.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3408F272A7004A47F5 /* tclUtf.c */; };
+ F9FD31010CC1AD070073837D /* tclUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3508F272A7004A47F5 /* tclUtil.c */; };
+ F9FD31020CC1AD070073837D /* tclVar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3608F272A7004A47F5 /* tclVar.c */; };
+ F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */; };
+ F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */; };
+ F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426908F272B3004A47F5 /* bn_mp_add.c */; };
+ F9FD31060CC1AD070073837D /* bn_mp_add_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */; };
+ F9FD31070CC1AD070073837D /* bn_mp_and.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426C08F272B3004A47F5 /* bn_mp_and.c */; };
+ F9FD31080CC1AD070073837D /* bn_mp_clamp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */; };
+ F9FD31090CC1AD070073837D /* bn_mp_clear.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426E08F272B3004A47F5 /* bn_mp_clear.c */; };
+ F9FD310A0CC1AD070073837D /* bn_mp_clear_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */; };
+ F9FD310B0CC1AD070073837D /* bn_mp_cmp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427008F272B3004A47F5 /* bn_mp_cmp.c */; };
+ F9FD310C0CC1AD070073837D /* bn_mp_cmp_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */; };
+ F9FD310D0CC1AD070073837D /* bn_mp_cmp_mag.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */; };
+ F9FD310E0CC1AD070073837D /* bn_mp_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427408F272B3004A47F5 /* bn_mp_copy.c */; };
+ F9FD310F0CC1AD070073837D /* bn_mp_count_bits.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */; };
+ F9FD31100CC1AD070073837D /* bn_mp_div.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427608F272B3004A47F5 /* bn_mp_div.c */; };
+ F9FD31110CC1AD070073837D /* bn_mp_div_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427708F272B3004A47F5 /* bn_mp_div_2.c */; };
+ F9FD31120CC1AD070073837D /* bn_mp_div_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */; };
+ F9FD31130CC1AD070073837D /* bn_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_mp_div_3.c */; };
+ F9FD31140CC1AD070073837D /* bn_mp_div_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */; };
+ F9FD31150CC1AD070073837D /* bn_mp_exch.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427E08F272B3004A47F5 /* bn_mp_exch.c */; };
+ F9FD31160CC1AD070073837D /* bn_mp_expt_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */; };
+ F9FD31170CC1AD070073837D /* bn_mp_grow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428708F272B3004A47F5 /* bn_mp_grow.c */; };
+ F9FD31180CC1AD070073837D /* bn_mp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428808F272B3004A47F5 /* bn_mp_init.c */; };
+ F9FD31190CC1AD070073837D /* bn_mp_init_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */; };
+ F9FD311A0CC1AD070073837D /* bn_mp_init_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */; };
+ F9FD311B0CC1AD070073837D /* bn_mp_init_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */; };
+ F9FD311C0CC1AD070073837D /* bn_mp_init_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */; };
+ F9FD311D0CC1AD070073837D /* bn_mp_karatsuba_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */; };
+ F9FD311E0CC1AD070073837D /* bn_mp_karatsuba_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */; };
+ F9FD311F0CC1AD070073837D /* bn_mp_lshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429508F272B3004A47F5 /* bn_mp_lshd.c */; };
+ F9FD31200CC1AD070073837D /* bn_mp_mod.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429608F272B3004A47F5 /* bn_mp_mod.c */; };
+ F9FD31210CC1AD070073837D /* bn_mp_mod_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */; };
+ F9FD31220CC1AD070073837D /* bn_mp_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429C08F272B3004A47F5 /* bn_mp_mul.c */; };
+ F9FD31230CC1AD070073837D /* bn_mp_mul_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */; };
+ F9FD31240CC1AD070073837D /* bn_mp_mul_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */; };
+ F9FD31250CC1AD070073837D /* bn_mp_mul_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */; };
+ F9FD31260CC1AD070073837D /* bn_mp_neg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A208F272B3004A47F5 /* bn_mp_neg.c */; };
+ F9FD31270CC1AD070073837D /* bn_mp_or.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A308F272B3004A47F5 /* bn_mp_or.c */; };
+ F9FD31280CC1AD070073837D /* bn_mp_radix_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */; };
+ F9FD31290CC1AD070073837D /* bn_mp_radix_smap.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */; };
+ F9FD312A0CC1AD070073837D /* bn_mp_read_radix.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */; };
+ F9FD312B0CC1AD070073837D /* bn_mp_rshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */; };
+ F9FD312C0CC1AD070073837D /* bn_mp_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BA08F272B3004A47F5 /* bn_mp_set.c */; };
+ F9FD312D0CC1AD070073837D /* bn_mp_shrink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */; };
+ F9FD312E0CC1AD070073837D /* bn_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */; };
+ F9FD312F0CC1AD070073837D /* bn_mp_sqrt.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */; };
+ F9FD31300CC1AD070073837D /* bn_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C108F272B3004A47F5 /* bn_mp_sub.c */; };
+ F9FD31310CC1AD070073837D /* bn_mp_sub_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */; };
+ F9FD31320CC1AD070073837D /* bn_mp_to_unsigned_bin_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */; };
+ F9FD31330CC1AD070073837D /* bn_mp_to_unsigned_bin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */; };
+ F9FD31340CC1AD070073837D /* bn_mp_toom_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */; };
+ F9FD31350CC1AD070073837D /* bn_mp_toom_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */; };
+ F9FD31360CC1AD070073837D /* bn_mp_toradix_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */; };
+ F9FD31370CC1AD070073837D /* bn_mp_unsigned_bin_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */; };
+ F9FD31380CC1AD070073837D /* bn_mp_xor.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */; };
+ F9FD31390CC1AD070073837D /* bn_mp_zero.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */; };
+ F9FD313A0CC1AD070073837D /* bn_reverse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D008F272B3004A47F5 /* bn_reverse.c */; };
+ F9FD313B0CC1AD070073837D /* bn_s_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */; };
+ F9FD313C0CC1AD070073837D /* bn_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */; };
+ F9FD313D0CC1AD070073837D /* bn_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */; };
+ F9FD313E0CC1AD070073837D /* bn_s_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */; };
+ F9FD313F0CC1AD070073837D /* bncore.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D708F272B3004A47F5 /* bncore.c */; };
+ F9FD31400CC1AD070073837D /* tclMacOSXBundle.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */; };
+ F9FD31410CC1AD070073837D /* tclMacOSXFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */; };
+ F9FD31420CC1AD070073837D /* tclMacOSXNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */; };
+ F9FD31430CC1AD070073837D /* tclLoadDyld.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445B08F272B9004A47F5 /* tclLoadDyld.c */; };
+ F9FD31440CC1AD070073837D /* tclUnixChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445F08F272B9004A47F5 /* tclUnixChan.c */; };
+ F9FD31450CC1AD070073837D /* tclUnixCompat.c in Sources */ = {isa = PBXBuildFile; fileRef = F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */; };
+ F9FD31460CC1AD070073837D /* tclUnixEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446008F272B9004A47F5 /* tclUnixEvent.c */; };
+ F9FD31470CC1AD070073837D /* tclUnixFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446108F272B9004A47F5 /* tclUnixFCmd.c */; };
+ F9FD31480CC1AD070073837D /* tclUnixFile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446208F272B9004A47F5 /* tclUnixFile.c */; };
+ F9FD31490CC1AD070073837D /* tclUnixInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446308F272B9004A47F5 /* tclUnixInit.c */; settings = {COMPILER_FLAGS = "-DTCL_LIBRARY=\\\"$(TCL_LIBRARY)\\\" -DTCL_PACKAGE_PATH=\\\"$(TCL_PACKAGE_PATH)\\\""; }; };
+ F9FD314A0CC1AD070073837D /* tclUnixNotfy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446408F272B9004A47F5 /* tclUnixNotfy.c */; };
+ F9FD314B0CC1AD070073837D /* tclUnixPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446508F272B9004A47F5 /* tclUnixPipe.c */; };
+ F9FD314C0CC1AD070073837D /* tclUnixSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446708F272B9004A47F5 /* tclUnixSock.c */; };
+ F9FD314D0CC1AD070073837D /* tclUnixThrd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446908F272B9004A47F5 /* tclUnixThrd.c */; };
+ F9FD314E0CC1AD070073837D /* tclUnixTime.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446B08F272B9004A47F5 /* tclUnixTime.c */; };
+ F9FD314F0CC1AD070073837D /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
+ F9FD31500CC1AD070073837D /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
+ F9FD31510CC1AD070073837D /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
+ F9FD31520CC1AD070073837D /* tkBind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB008F27A39005CB29B /* tkBind.c */; };
+ F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB108F27A39005CB29B /* tkBitmap.c */; };
+ F9FD31540CC1AD070073837D /* tkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB208F27A39005CB29B /* tkButton.c */; };
+ F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB408F27A39005CB29B /* tkCanvArc.c */; };
+ F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB508F27A39005CB29B /* tkCanvas.c */; };
+ F9FD31570CC1AD070073837D /* tkCanvBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB708F27A39005CB29B /* tkCanvBmap.c */; };
+ F9FD31580CC1AD070073837D /* tkCanvImg.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB808F27A39005CB29B /* tkCanvImg.c */; };
+ F9FD31590CC1AD070073837D /* tkCanvLine.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB908F27A39005CB29B /* tkCanvLine.c */; };
+ F9FD315A0CC1AD070073837D /* tkCanvPoly.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABA08F27A39005CB29B /* tkCanvPoly.c */; };
+ F9FD315B0CC1AD070073837D /* tkCanvPs.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABB08F27A39005CB29B /* tkCanvPs.c */; };
+ F9FD315C0CC1AD070073837D /* tkCanvText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABD08F27A39005CB29B /* tkCanvText.c */; };
+ F9FD315D0CC1AD070073837D /* tkCanvUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABE08F27A39005CB29B /* tkCanvUtil.c */; };
+ F9FD315E0CC1AD070073837D /* tkCanvWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABF08F27A39005CB29B /* tkCanvWind.c */; };
+ F9FD315F0CC1AD070073837D /* tkClipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC008F27A39005CB29B /* tkClipboard.c */; };
+ F9FD31600CC1AD070073837D /* tkCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC108F27A39005CB29B /* tkCmds.c */; };
+ F9FD31610CC1AD070073837D /* tkColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC208F27A39005CB29B /* tkColor.c */; };
+ F9FD31620CC1AD070073837D /* tkConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC408F27A39005CB29B /* tkConfig.c */; };
+ F9FD31630CC1AD070073837D /* tkConsole.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC508F27A39005CB29B /* tkConsole.c */; };
+ F9FD31640CC1AD070073837D /* tkCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC608F27A39005CB29B /* tkCursor.c */; };
+ F9FD31650CC1AD070073837D /* tkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC808F27A39005CB29B /* tkEntry.c */; };
+ F9FD31660CC1AD070073837D /* tkError.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACA08F27A39005CB29B /* tkError.c */; };
+ F9FD31670CC1AD070073837D /* tkEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACB08F27A39005CB29B /* tkEvent.c */; };
+ F9FD31680CC1AD070073837D /* tkFileFilter.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACC08F27A39005CB29B /* tkFileFilter.c */; };
+ F9FD31690CC1AD070073837D /* tkFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACE08F27A39005CB29B /* tkFocus.c */; };
+ F9FD316A0CC1AD070073837D /* tkFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACF08F27A39005CB29B /* tkFont.c */; };
+ F9FD316B0CC1AD070073837D /* tkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD108F27A39005CB29B /* tkFrame.c */; };
+ F9FD316C0CC1AD070073837D /* tkGC.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD208F27A39005CB29B /* tkGC.c */; };
+ F9FD316D0CC1AD070073837D /* tkGeometry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD308F27A39005CB29B /* tkGeometry.c */; };
+ F9FD316E0CC1AD070073837D /* tkGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD408F27A39005CB29B /* tkGet.c */; };
+ F9FD316F0CC1AD070073837D /* tkGrab.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD508F27A39005CB29B /* tkGrab.c */; };
+ F9FD31700CC1AD070073837D /* tkGrid.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD608F27A39005CB29B /* tkGrid.c */; };
+ F9FD31710CC1AD070073837D /* tkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD708F27A39005CB29B /* tkImage.c */; };
+ F9FD31720CC1AD070073837D /* tkImgBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD808F27A39005CB29B /* tkImgBmap.c */; };
+ F9FD31730CC1AD070073837D /* tkImgGIF.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD908F27A39005CB29B /* tkImgGIF.c */; };
+ F9FD31740CC1AD070073837D /* tkImgPhoto.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADA08F27A39005CB29B /* tkImgPhoto.c */; };
+ F9FD31750CC1AD070073837D /* tkImgPPM.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADB08F27A39005CB29B /* tkImgPPM.c */; };
+ F9FD31760CC1AD070073837D /* tkListbox.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE408F27A39005CB29B /* tkListbox.c */; };
+ F9FD31770CC1AD070073837D /* tkMacWinMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE508F27A39005CB29B /* tkMacWinMenu.c */; };
+ F9FD31780CC1AD070073837D /* tkMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE608F27A39005CB29B /* tkMain.c */; };
+ F9FD31790CC1AD070073837D /* tkMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE708F27A39005CB29B /* tkMenu.c */; };
+ F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE908F27A39005CB29B /* tkMenubutton.c */; };
+ F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEB08F27A39005CB29B /* tkMenuDraw.c */; };
+ F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEC08F27A39005CB29B /* tkMessage.c */; };
+ F9FD317D0CC1AD070073837D /* tkObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAED08F27A39005CB29B /* tkObj.c */; };
+ F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEE08F27A39005CB29B /* tkOldConfig.c */; };
+ F9FD317F0CC1AD070073837D /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
+ F9FD31800CC1AD070073837D /* tkOption.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEF08F27A39005CB29B /* tkOption.c */; };
+ F9FD31810CC1AD070073837D /* tkPack.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF008F27A39005CB29B /* tkPack.c */; };
+ F9FD31820CC1AD070073837D /* tkPanedWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF108F27A39005CB29B /* tkPanedWindow.c */; };
+ F9FD31830CC1AD070073837D /* tkPlace.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF208F27A39005CB29B /* tkPlace.c */; };
+ F9FD31850CC1AD070073837D /* tkRectOval.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF608F27A39005CB29B /* tkRectOval.c */; };
+ F9FD31860CC1AD070073837D /* tkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF708F27A39005CB29B /* tkScale.c */; };
+ F9FD31870CC1AD070073837D /* tkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF908F27A39005CB29B /* tkScrollbar.c */; };
+ F9FD31880CC1AD070073837D /* tkSelect.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFB08F27A39005CB29B /* tkSelect.c */; };
+ F9FD31890CC1AD070073837D /* tkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFD08F27A39005CB29B /* tkSquare.c */; };
+ F9FD318A0CC1AD070073837D /* tkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFF08F27A39005CB29B /* tkStubInit.c */; };
+ F9FD318B0CC1AD070073837D /* tkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0008F27A39005CB29B /* tkStubLib.c */; };
+ F9FD318C0CC1AD070073837D /* tkStyle.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0108F27A39005CB29B /* tkStyle.c */; };
+ F9FD318D0CC1AD070073837D /* tkTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0208F27A39005CB29B /* tkTest.c */; };
+ F9FD318E0CC1AD070073837D /* tkText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0308F27A39005CB29B /* tkText.c */; };
+ F9FD318F0CC1AD070073837D /* tkTextBTree.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0508F27A39005CB29B /* tkTextBTree.c */; };
+ F9FD31900CC1AD070073837D /* tkTextDisp.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0608F27A39005CB29B /* tkTextDisp.c */; };
+ F9FD31910CC1AD070073837D /* tkTextImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0808F27A39005CB29B /* tkTextImage.c */; };
+ F9FD31920CC1AD070073837D /* tkTextIndex.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0908F27A39005CB29B /* tkTextIndex.c */; };
+ F9FD31930CC1AD070073837D /* tkTextMark.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0A08F27A39005CB29B /* tkTextMark.c */; };
+ F9FD31940CC1AD070073837D /* tkTextTag.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0B08F27A39005CB29B /* tkTextTag.c */; };
+ F9FD31950CC1AD070073837D /* tkTextWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0C08F27A39005CB29B /* tkTextWind.c */; };
+ F9FD31960CC1AD070073837D /* tkTrig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0D08F27A39005CB29B /* tkTrig.c */; };
+ F9FD31970CC1AD070073837D /* tkUndo.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0E08F27A39005CB29B /* tkUndo.c */; };
+ F9FD31980CC1AD070073837D /* tkUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1008F27A39005CB29B /* tkUtil.c */; };
+ F9FD31990CC1AD070073837D /* tkVisual.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1108F27A39005CB29B /* tkVisual.c */; };
+ F9FD319A0CC1AD070073837D /* tkWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1208F27A39005CB29B /* tkWindow.c */; };
+ F9FD319B0CC1AD070073837D /* ttkBlink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E10AF786D5000797B5 /* ttkBlink.c */; };
+ F9FD319C0CC1AD070073837D /* ttkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E20AF786D5000797B5 /* ttkButton.c */; };
+ F9FD319D0CC1AD070073837D /* ttkCache.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E30AF786D5000797B5 /* ttkCache.c */; };
+ F9FD319E0CC1AD070073837D /* ttkClamTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E40AF786D5000797B5 /* ttkClamTheme.c */; };
+ F9FD319F0CC1AD070073837D /* ttkClassicTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E50AF786D5000797B5 /* ttkClassicTheme.c */; };
+ F9FD31A00CC1AD070073837D /* ttkDefaultTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */; };
+ F9FD31A10CC1AD070073837D /* ttkElements.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E80AF786D5000797B5 /* ttkElements.c */; };
+ F9FD31A20CC1AD070073837D /* ttkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E90AF786D5000797B5 /* ttkEntry.c */; };
+ F9FD31A30CC1AD070073837D /* ttkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EA0AF786D5000797B5 /* ttkFrame.c */; };
+ F9FD31A40CC1AD070073837D /* ttkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EB0AF786D5000797B5 /* ttkImage.c */; };
+ F9FD31A50CC1AD070073837D /* ttkInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EC0AF786D5000797B5 /* ttkInit.c */; };
+ F9FD31A60CC1AD070073837D /* ttkLabel.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887ED0AF786D5000797B5 /* ttkLabel.c */; };
+ F9FD31A70CC1AD070073837D /* ttkLayout.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EE0AF786D5000797B5 /* ttkLayout.c */; };
+ F9FD31A80CC1AD070073837D /* ttkManager.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EF0AF786D5000797B5 /* ttkManager.c */; };
+ F9FD31A90CC1AD070073837D /* ttkNotebook.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F10AF786D5000797B5 /* ttkNotebook.c */; };
+ F9FD31AA0CC1AD070073837D /* ttkPanedwindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F20AF786D5000797B5 /* ttkPanedwindow.c */; };
+ F9FD31AB0CC1AD070073837D /* ttkProgress.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F30AF786D5000797B5 /* ttkProgress.c */; };
+ F9FD31AC0CC1AD070073837D /* ttkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F40AF786D5000797B5 /* ttkScale.c */; };
+ F9FD31AD0CC1AD070073837D /* ttkScroll.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F50AF786D5000797B5 /* ttkScroll.c */; };
+ F9FD31AE0CC1AD070073837D /* ttkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F60AF786D5000797B5 /* ttkScrollbar.c */; };
+ F9FD31AF0CC1AD070073837D /* ttkSeparator.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F70AF786D5000797B5 /* ttkSeparator.c */; };
+ F9FD31B00CC1AD070073837D /* ttkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F80AF786D5000797B5 /* ttkSquare.c */; };
+ F9FD31B10CC1AD070073837D /* ttkState.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F90AF786D5000797B5 /* ttkState.c */; };
+ F9FD31B20CC1AD070073837D /* ttkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FA0AF786D5000797B5 /* ttkStubInit.c */; };
+ F9FD31B30CC1AD070073837D /* ttkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FB0AF786D5000797B5 /* ttkStubLib.c */; };
+ F9FD31B40CC1AD070073837D /* ttkTagSet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FC0AF786D5000797B5 /* ttkTagSet.c */; };
+ F9FD31B50CC1AD070073837D /* ttkTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FD0AF786D5000797B5 /* ttkTheme.c */; };
+ F9FD31B60CC1AD070073837D /* ttkTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888000AF786D5000797B5 /* ttkTrace.c */; };
+ F9FD31B70CC1AD070073837D /* ttkTrack.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888010AF786D5000797B5 /* ttkTrack.c */; };
+ F9FD31B80CC1AD070073837D /* ttkTreeview.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888020AF786D5000797B5 /* ttkTreeview.c */; };
+ F9FD31B90CC1AD070073837D /* ttkWidget.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888030AF786D5000797B5 /* ttkWidget.c */; };
+ F9FD31DA0CC1AD070073837D /* tkAppInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7508F27A3D005CB29B /* tkAppInit.c */; settings = {COMPILER_FLAGS = "-DTK_TEST"; }; };
+ F9FD31DB0CC1AD070073837D /* tkUnix3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7908F27A3D005CB29B /* tkUnix3d.c */; };
+ F9FD31DC0CC1AD070073837D /* tkUnixScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8C08F27A3D005CB29B /* tkUnixScale.c */; };
+ F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07408F2820D005CB29B /* CoreFoundation.framework */; };
+ F9FD31F80CC1ADB70073837D /* tkUnixCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */; };
+ F9FD31FA0CC1ADB70073837D /* tkUnixKey.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8708F27A3D005CB29B /* tkUnixKey.c */; };
+ F9FD31FB0CC1ADB70073837D /* tkUnixXId.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC9108F27A3D005CB29B /* tkUnixXId.c */; };
+ F9FD31FC0CC1ADB70073837D /* tkUnixInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8508F27A3D005CB29B /* tkUnixInit.c */; };
+ F9FD31FD0CC1ADB70073837D /* tkUnixEmbed.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */; };
+ F9FD31FE0CC1ADB70073837D /* tkUnixSend.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8F08F27A3D005CB29B /* tkUnixSend.c */; };
+ F9FD31FF0CC1ADB70073837D /* tkUnixFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8308F27A3D005CB29B /* tkUnixFocus.c */; };
+ F9FD32000CC1ADB70073837D /* tkUnixWm.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC9008F27A3D005CB29B /* tkUnixWm.c */; };
+ F9FD32010CC1ADB70073837D /* tkUnixRFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */; };
+ F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7808F27A3D005CB29B /* tkUnix.c */; };
+ F9FD32030CC1ADB70073837D /* tkUnixMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8808F27A3D005CB29B /* tkUnixMenu.c */; };
+ F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */; };
+ F9FD32050CC1ADB70073837D /* tkUnixDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8008F27A3D005CB29B /* tkUnixDraw.c */; };
+ F9FD32060CC1ADB70073837D /* tkUnixDialog.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7F08F27A3D005CB29B /* tkUnixDialog.c */; };
+ F9FD32070CC1ADB70073837D /* tkUnixSelect.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */; };
+ F9FD32080CC1ADB70073837D /* tkUnixEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8208F27A3D005CB29B /* tkUnixEvent.c */; };
+ F9FD32090CC1ADB70073837D /* tkUnixColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7B08F27A3D005CB29B /* tkUnixColor.c */; };
+ F9FD320A0CC1ADB70073837D /* tkUnixButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7A08F27A3D005CB29B /* tkUnixButton.c */; };
+ F9FD320B0CC1ADB70073837D /* tkUnixMenubu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8908F27A3D005CB29B /* tkUnixMenubu.c */; };
+ F9FD320C0CC1ADB70073837D /* tkUnixScrlbr.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8D08F27A3D005CB29B /* tkUnixScrlbr.c */; };
+ F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD32140CC1AF170073837D /* libX11.dylib */; };
+ F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD32150CC1AF170073837D /* libXext.dylib */; };
+ F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD32160CC1AF170073837D /* libXss.dylib */; };
+ F9FD349B0CC1BB0D0073837D /* libfreetype.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34990CC1BB0D0073837D /* libfreetype.dylib */; };
+ F9FD349C0CC1BB0D0073837D /* libXft.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD349A0CC1BB0D0073837D /* libXft.dylib */; };
+ F9FD34C40CC1BBD70073837D /* libfontconfig.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 8DD76FB20486AB0100D96B5E /* tktest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tktest; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9099B8A0CC67D30005A9580 /* textpeer.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textpeer.tcl; sourceTree = "<group>"; };
+ F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkbut.tcl; sourceTree = "<group>"; };
+ F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Tclsh-Info.plist.in"; sourceTree = "<group>"; };
+ F92240290D7C620F005EC715 /* knightstour.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = knightstour.tcl; sourceTree = "<group>"; };
+ F936FCD70CCD984500716967 /* ttkprogress.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkprogress.tcl; sourceTree = "<group>"; };
+ F936FCD80CCD984600716967 /* tree.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tree.tcl; sourceTree = "<group>"; };
+ F936FCD90CCD984600716967 /* toolbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = toolbar.tcl; sourceTree = "<group>"; };
+ F936FCDA0CCD984600716967 /* ttknote.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttknote.tcl; sourceTree = "<group>"; };
+ F936FCDB0CCD984600716967 /* combo.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combo.tcl; sourceTree = "<group>"; };
+ F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXFont.h; sourceTree = "<group>"; };
+ F95FAFF90B34F1130072E431 /* macOSXLoad.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXLoad.test; sourceTree = "<group>"; };
+ F962F7C60DADC26200648DB8 /* vsapi.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vsapi.test; sourceTree = "<group>"; };
+ F966BA0408F27A37005CB29B /* error.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = error.xbm; sourceTree = "<group>"; };
+ F966BA0508F27A37005CB29B /* gray12.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray12.xbm; sourceTree = "<group>"; };
+ F966BA0608F27A37005CB29B /* gray25.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray25.xbm; sourceTree = "<group>"; };
+ F966BA0708F27A37005CB29B /* gray50.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray50.xbm; sourceTree = "<group>"; };
+ F966BA0808F27A37005CB29B /* gray75.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray75.xbm; sourceTree = "<group>"; };
+ F966BA0908F27A37005CB29B /* hourglass.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = hourglass.xbm; sourceTree = "<group>"; };
+ F966BA0A08F27A37005CB29B /* info.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = info.xbm; sourceTree = "<group>"; };
+ F966BA0B08F27A37005CB29B /* questhead.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = questhead.xbm; sourceTree = "<group>"; };
+ F966BA0C08F27A37005CB29B /* question.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = question.xbm; sourceTree = "<group>"; };
+ F966BA0D08F27A37005CB29B /* warning.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = warning.xbm; sourceTree = "<group>"; };
+ F966BA0E08F27A37005CB29B /* ChangeLog */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = ChangeLog; sourceTree = "<group>"; };
+ F966BA0F08F27A37005CB29B /* changes */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = changes; sourceTree = "<group>"; };
+ F966BA1108F27A37005CB29B /* 3DBorder.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = 3DBorder.3; sourceTree = "<group>"; };
+ F966BA1208F27A37005CB29B /* AddOption.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AddOption.3; sourceTree = "<group>"; };
+ F966BA1308F27A37005CB29B /* bell.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bell.n; sourceTree = "<group>"; };
+ F966BA1408F27A37005CB29B /* bind.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bind.n; sourceTree = "<group>"; };
+ F966BA1508F27A37005CB29B /* BindTable.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = BindTable.3; sourceTree = "<group>"; };
+ F966BA1608F27A37005CB29B /* bindtags.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bindtags.n; sourceTree = "<group>"; };
+ F966BA1708F27A37005CB29B /* bitmap.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bitmap.n; sourceTree = "<group>"; };
+ F966BA1808F27A37005CB29B /* button.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = button.n; sourceTree = "<group>"; };
+ F966BA1908F27A37005CB29B /* canvas.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = canvas.n; sourceTree = "<group>"; };
+ F966BA1A08F27A37005CB29B /* CanvPsY.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CanvPsY.3; sourceTree = "<group>"; };
+ F966BA1B08F27A37005CB29B /* CanvTkwin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CanvTkwin.3; sourceTree = "<group>"; };
+ F966BA1C08F27A37005CB29B /* CanvTxtInfo.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CanvTxtInfo.3; sourceTree = "<group>"; };
+ F966BA1D08F27A37005CB29B /* checkbutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = checkbutton.n; sourceTree = "<group>"; };
+ F966BA1E08F27A37005CB29B /* chooseColor.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = chooseColor.n; sourceTree = "<group>"; };
+ F966BA1F08F27A37005CB29B /* chooseDirectory.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = chooseDirectory.n; sourceTree = "<group>"; };
+ F966BA2008F27A37005CB29B /* Clipboard.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Clipboard.3; sourceTree = "<group>"; };
+ F966BA2108F27A37005CB29B /* clipboard.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = clipboard.n; sourceTree = "<group>"; };
+ F966BA2208F27A37005CB29B /* ClrSelect.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ClrSelect.3; sourceTree = "<group>"; };
+ F966BA2308F27A37005CB29B /* colors.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = colors.n; sourceTree = "<group>"; };
+ F966BA2408F27A37005CB29B /* ConfigWidg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ConfigWidg.3; sourceTree = "<group>"; };
+ F966BA2508F27A37005CB29B /* ConfigWind.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ConfigWind.3; sourceTree = "<group>"; };
+ F966BA2608F27A37005CB29B /* console.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = console.n; sourceTree = "<group>"; };
+ F966BA2708F27A37005CB29B /* CoordToWin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CoordToWin.3; sourceTree = "<group>"; };
+ F966BA2808F27A37005CB29B /* CrtCmHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtCmHdlr.3; sourceTree = "<group>"; };
+ F966BA2908F27A37005CB29B /* CrtErrHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtErrHdlr.3; sourceTree = "<group>"; };
+ F966BA2A08F27A37005CB29B /* CrtGenHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtGenHdlr.3; sourceTree = "<group>"; };
+ F966BA2B08F27A37005CB29B /* CrtImgType.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtImgType.3; sourceTree = "<group>"; };
+ F966BA2C08F27A37005CB29B /* CrtItemType.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtItemType.3; sourceTree = "<group>"; };
+ F966BA2D08F27A37005CB29B /* CrtPhImgFmt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtPhImgFmt.3; sourceTree = "<group>"; };
+ F966BA2E08F27A37005CB29B /* CrtSelHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSelHdlr.3; sourceTree = "<group>"; };
+ F966BA2F08F27A37005CB29B /* CrtWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtWindow.3; sourceTree = "<group>"; };
+ F966BA3008F27A37005CB29B /* cursors.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = cursors.n; sourceTree = "<group>"; };
+ F966BA3108F27A37005CB29B /* DeleteImg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DeleteImg.3; sourceTree = "<group>"; };
+ F966BA3208F27A37005CB29B /* destroy.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = destroy.n; sourceTree = "<group>"; };
+ F966BA3308F27A37005CB29B /* dialog.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dialog.n; sourceTree = "<group>"; };
+ F966BA3408F27A37005CB29B /* DrawFocHlt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DrawFocHlt.3; sourceTree = "<group>"; };
+ F966BA3508F27A37005CB29B /* entry.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = entry.n; sourceTree = "<group>"; };
+ F966BA3608F27A37005CB29B /* event.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = event.n; sourceTree = "<group>"; };
+ F966BA3708F27A37005CB29B /* EventHndlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = EventHndlr.3; sourceTree = "<group>"; };
+ F966BA3808F27A37005CB29B /* FindPhoto.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FindPhoto.3; sourceTree = "<group>"; };
+ F966BA3908F27A37005CB29B /* focus.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = focus.n; sourceTree = "<group>"; };
+ F966BA3A08F27A37005CB29B /* focusNext.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = focusNext.n; sourceTree = "<group>"; };
+ F966BA3B08F27A37005CB29B /* font.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = font.n; sourceTree = "<group>"; };
+ F966BA3C08F27A37005CB29B /* FontId.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FontId.3; sourceTree = "<group>"; };
+ F966BA3D08F27A37005CB29B /* frame.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = frame.n; sourceTree = "<group>"; };
+ F966BA3E08F27A37005CB29B /* FreeXId.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FreeXId.3; sourceTree = "<group>"; };
+ F966BA3F08F27A37005CB29B /* GeomReq.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GeomReq.3; sourceTree = "<group>"; };
+ F966BA4008F27A37005CB29B /* GetAnchor.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetAnchor.3; sourceTree = "<group>"; };
+ F966BA4108F27A37005CB29B /* GetBitmap.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetBitmap.3; sourceTree = "<group>"; };
+ F966BA4208F27A37005CB29B /* GetCapStyl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetCapStyl.3; sourceTree = "<group>"; };
+ F966BA4308F27A37005CB29B /* GetClrmap.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetClrmap.3; sourceTree = "<group>"; };
+ F966BA4408F27A37005CB29B /* GetColor.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetColor.3; sourceTree = "<group>"; };
+ F966BA4508F27A37005CB29B /* GetCursor.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetCursor.3; sourceTree = "<group>"; };
+ F966BA4608F27A37005CB29B /* GetDash.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetDash.3; sourceTree = "<group>"; };
+ F966BA4708F27A37005CB29B /* GetFont.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetFont.3; sourceTree = "<group>"; };
+ F966BA4808F27A37005CB29B /* GetGC.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetGC.3; sourceTree = "<group>"; };
+ F966BA4908F27A37005CB29B /* GetHINSTANCE.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetHINSTANCE.3; sourceTree = "<group>"; };
+ F966BA4A08F27A37005CB29B /* GetHWND.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetHWND.3; sourceTree = "<group>"; };
+ F966BA4B08F27A37005CB29B /* GetImage.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetImage.3; sourceTree = "<group>"; };
+ F966BA4C08F27A37005CB29B /* GetJoinStl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetJoinStl.3; sourceTree = "<group>"; };
+ F966BA4D08F27A37005CB29B /* GetJustify.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetJustify.3; sourceTree = "<group>"; };
+ F966BA4E08F27A37005CB29B /* getOpenFile.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = getOpenFile.n; sourceTree = "<group>"; };
+ F966BA4F08F27A37005CB29B /* GetOption.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetOption.3; sourceTree = "<group>"; };
+ F966BA5008F27A38005CB29B /* GetPixels.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetPixels.3; sourceTree = "<group>"; };
+ F966BA5108F27A38005CB29B /* GetPixmap.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetPixmap.3; sourceTree = "<group>"; };
+ F966BA5208F27A38005CB29B /* GetRelief.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetRelief.3; sourceTree = "<group>"; };
+ F966BA5308F27A38005CB29B /* GetRootCrd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetRootCrd.3; sourceTree = "<group>"; };
+ F966BA5408F27A38005CB29B /* GetScroll.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetScroll.3; sourceTree = "<group>"; };
+ F966BA5508F27A38005CB29B /* GetSelect.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetSelect.3; sourceTree = "<group>"; };
+ F966BA5608F27A38005CB29B /* GetUid.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetUid.3; sourceTree = "<group>"; };
+ F966BA5708F27A38005CB29B /* GetVisual.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetVisual.3; sourceTree = "<group>"; };
+ F966BA5808F27A38005CB29B /* GetVRoot.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetVRoot.3; sourceTree = "<group>"; };
+ F966BA5908F27A38005CB29B /* Grab.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Grab.3; sourceTree = "<group>"; };
+ F966BA5A08F27A38005CB29B /* grab.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = grab.n; sourceTree = "<group>"; };
+ F966BA5B08F27A38005CB29B /* grid.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = grid.n; sourceTree = "<group>"; };
+ F966BA5C08F27A38005CB29B /* HandleEvent.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = HandleEvent.3; sourceTree = "<group>"; };
+ F966BA5D08F27A38005CB29B /* HWNDToWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = HWNDToWindow.3; sourceTree = "<group>"; };
+ F966BA5E08F27A38005CB29B /* IdToWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = IdToWindow.3; sourceTree = "<group>"; };
+ F966BA5F08F27A38005CB29B /* image.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = image.n; sourceTree = "<group>"; };
+ F966BA6008F27A38005CB29B /* ImgChanged.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ImgChanged.3; sourceTree = "<group>"; };
+ F966BA6108F27A38005CB29B /* Inactive.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Inactive.3; sourceTree = "<group>"; };
+ F966BA6208F27A38005CB29B /* InternAtom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = InternAtom.3; sourceTree = "<group>"; };
+ F966BA6308F27A38005CB29B /* keysyms.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = keysyms.n; sourceTree = "<group>"; };
+ F966BA6408F27A38005CB29B /* label.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = label.n; sourceTree = "<group>"; };
+ F966BA6508F27A38005CB29B /* labelframe.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = labelframe.n; sourceTree = "<group>"; };
+ F966BA6608F27A38005CB29B /* listbox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = listbox.n; sourceTree = "<group>"; };
+ F966BA6708F27A38005CB29B /* loadTk.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = loadTk.n; sourceTree = "<group>"; };
+ F966BA6808F27A38005CB29B /* lower.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lower.n; sourceTree = "<group>"; };
+ F966BA6908F27A38005CB29B /* MainLoop.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainLoop.3; sourceTree = "<group>"; };
+ F966BA6A08F27A38005CB29B /* MaintGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MaintGeom.3; sourceTree = "<group>"; };
+ F966BA6B08F27A38005CB29B /* MainWin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainWin.3; sourceTree = "<group>"; };
+ F966BA6D08F27A38005CB29B /* ManageGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ManageGeom.3; sourceTree = "<group>"; };
+ F966BA6E08F27A38005CB29B /* MapWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MapWindow.3; sourceTree = "<group>"; };
+ F966BA6F08F27A38005CB29B /* MeasureChar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MeasureChar.3; sourceTree = "<group>"; };
+ F966BA7008F27A38005CB29B /* menu.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menu.n; sourceTree = "<group>"; };
+ F966BA7108F27A38005CB29B /* menubar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menubar.n; sourceTree = "<group>"; };
+ F966BA7208F27A38005CB29B /* menubutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menubutton.n; sourceTree = "<group>"; };
+ F966BA7308F27A38005CB29B /* message.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = message.n; sourceTree = "<group>"; };
+ F966BA7408F27A38005CB29B /* messageBox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = messageBox.n; sourceTree = "<group>"; };
+ F966BA7508F27A38005CB29B /* MoveToplev.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MoveToplev.3; sourceTree = "<group>"; };
+ F966BA7608F27A38005CB29B /* Name.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Name.3; sourceTree = "<group>"; };
+ F966BA7708F27A38005CB29B /* NameOfImg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = NameOfImg.3; sourceTree = "<group>"; };
+ F966BA7808F27A38005CB29B /* option.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = option.n; sourceTree = "<group>"; };
+ F966BA7908F27A38005CB29B /* optionMenu.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = optionMenu.n; sourceTree = "<group>"; };
+ F966BA7A08F27A38005CB29B /* options.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = options.n; sourceTree = "<group>"; };
+ F966BA7B08F27A38005CB29B /* OwnSelect.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = OwnSelect.3; sourceTree = "<group>"; };
+ F966BA7C08F27A38005CB29B /* pack-old.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = "pack-old.n"; sourceTree = "<group>"; };
+ F966BA7D08F27A38005CB29B /* pack.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pack.n; sourceTree = "<group>"; };
+ F966BA7E08F27A38005CB29B /* palette.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = palette.n; sourceTree = "<group>"; };
+ F966BA7F08F27A38005CB29B /* panedwindow.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = panedwindow.n; sourceTree = "<group>"; };
+ F966BA8008F27A38005CB29B /* ParseArgv.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ParseArgv.3; sourceTree = "<group>"; };
+ F966BA8108F27A38005CB29B /* photo.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = photo.n; sourceTree = "<group>"; };
+ F966BA8208F27A38005CB29B /* place.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = place.n; sourceTree = "<group>"; };
+ F966BA8308F27A38005CB29B /* popup.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = popup.n; sourceTree = "<group>"; };
+ F966BA8408F27A38005CB29B /* QWinEvent.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = QWinEvent.3; sourceTree = "<group>"; };
+ F966BA8508F27A38005CB29B /* radiobutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = radiobutton.n; sourceTree = "<group>"; };
+ F966BA8608F27A38005CB29B /* raise.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = raise.n; sourceTree = "<group>"; };
+ F966BA8708F27A38005CB29B /* Restack.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Restack.3; sourceTree = "<group>"; };
+ F966BA8808F27A38005CB29B /* RestrictEv.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RestrictEv.3; sourceTree = "<group>"; };
+ F966BA8908F27A38005CB29B /* scale.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = scale.n; sourceTree = "<group>"; };
+ F966BA8A08F27A38005CB29B /* scrollbar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = scrollbar.n; sourceTree = "<group>"; };
+ F966BA8B08F27A38005CB29B /* selection.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = selection.n; sourceTree = "<group>"; };
+ F966BA8C08F27A38005CB29B /* send.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = send.n; sourceTree = "<group>"; };
+ F966BA8D08F27A38005CB29B /* SetAppName.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetAppName.3; sourceTree = "<group>"; };
+ F966BA8E08F27A38005CB29B /* SetCaret.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetCaret.3; sourceTree = "<group>"; };
+ F966BA8F08F27A38005CB29B /* SetClass.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetClass.3; sourceTree = "<group>"; };
+ F966BA9008F27A38005CB29B /* SetClassProcs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetClassProcs.3; sourceTree = "<group>"; };
+ F966BA9108F27A38005CB29B /* SetGrid.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetGrid.3; sourceTree = "<group>"; };
+ F966BA9208F27A38005CB29B /* SetOptions.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetOptions.3; sourceTree = "<group>"; };
+ F966BA9308F27A38005CB29B /* SetVisual.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetVisual.3; sourceTree = "<group>"; };
+ F966BA9408F27A38005CB29B /* spinbox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = spinbox.n; sourceTree = "<group>"; };
+ F966BA9508F27A38005CB29B /* StrictMotif.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StrictMotif.3; sourceTree = "<group>"; };
+ F966BA9608F27A38005CB29B /* text.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = text.n; sourceTree = "<group>"; };
+ F966BA9708F27A38005CB29B /* TextLayout.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TextLayout.3; sourceTree = "<group>"; };
+ F966BA9808F27A38005CB29B /* tk.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tk.n; sourceTree = "<group>"; };
+ F966BA9908F27A38005CB29B /* tk4.0.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = tk4.0.ps; sourceTree = "<group>"; };
+ F966BA9A08F27A38005CB29B /* Tk_Init.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tk_Init.3; sourceTree = "<group>"; };
+ F966BA9B08F27A38005CB29B /* Tk_Main.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tk_Main.3; sourceTree = "<group>"; };
+ F966BA9C08F27A38005CB29B /* tkerror.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tkerror.n; sourceTree = "<group>"; };
+ F966BA9D08F27A38005CB29B /* TkInitStubs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TkInitStubs.3; sourceTree = "<group>"; };
+ F966BA9E08F27A38005CB29B /* tkvars.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tkvars.n; sourceTree = "<group>"; };
+ F966BA9F08F27A38005CB29B /* tkwait.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tkwait.n; sourceTree = "<group>"; };
+ F966BAA008F27A38005CB29B /* toplevel.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = toplevel.n; sourceTree = "<group>"; };
+ F966BAA108F27A38005CB29B /* WindowId.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = WindowId.3; sourceTree = "<group>"; };
+ F966BAA208F27A38005CB29B /* winfo.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = winfo.n; sourceTree = "<group>"; };
+ F966BAA308F27A38005CB29B /* wish.1 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = wish.1; sourceTree = "<group>"; };
+ F966BAA408F27A38005CB29B /* wm.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = wm.n; sourceTree = "<group>"; };
+ F966BAA608F27A38005CB29B /* default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default.h; sourceTree = "<group>"; };
+ F966BAA708F27A38005CB29B /* ks_names.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ks_names.h; sourceTree = "<group>"; };
+ F966BAA808F27A38005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
+ F966BAA908F27A39005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BAAA08F27A39005CB29B /* tk.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.decls; sourceTree = "<group>"; };
+ F966BAAB08F27A39005CB29B /* tk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tk.h; sourceTree = "<group>"; };
+ F966BAAC08F27A39005CB29B /* tk3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tk3d.c; sourceTree = "<group>"; };
+ F966BAAD08F27A39005CB29B /* tk3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tk3d.h; sourceTree = "<group>"; };
+ F966BAAE08F27A39005CB29B /* tkArgv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkArgv.c; sourceTree = "<group>"; };
+ F966BAAF08F27A39005CB29B /* tkAtom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkAtom.c; sourceTree = "<group>"; };
+ F966BAB008F27A39005CB29B /* tkBind.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBind.c; sourceTree = "<group>"; };
+ F966BAB108F27A39005CB29B /* tkBitmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBitmap.c; sourceTree = "<group>"; };
+ F966BAB208F27A39005CB29B /* tkButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkButton.c; sourceTree = "<group>"; };
+ F966BAB308F27A39005CB29B /* tkButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkButton.h; sourceTree = "<group>"; };
+ F966BAB408F27A39005CB29B /* tkCanvArc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvArc.c; sourceTree = "<group>"; };
+ F966BAB508F27A39005CB29B /* tkCanvas.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvas.c; sourceTree = "<group>"; };
+ F966BAB608F27A39005CB29B /* tkCanvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkCanvas.h; sourceTree = "<group>"; };
+ F966BAB708F27A39005CB29B /* tkCanvBmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvBmap.c; sourceTree = "<group>"; };
+ F966BAB808F27A39005CB29B /* tkCanvImg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvImg.c; sourceTree = "<group>"; };
+ F966BAB908F27A39005CB29B /* tkCanvLine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvLine.c; sourceTree = "<group>"; };
+ F966BABA08F27A39005CB29B /* tkCanvPoly.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvPoly.c; sourceTree = "<group>"; };
+ F966BABB08F27A39005CB29B /* tkCanvPs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvPs.c; sourceTree = "<group>"; };
+ F966BABD08F27A39005CB29B /* tkCanvText.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvText.c; sourceTree = "<group>"; };
+ F966BABE08F27A39005CB29B /* tkCanvUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvUtil.c; sourceTree = "<group>"; };
+ F966BABF08F27A39005CB29B /* tkCanvWind.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvWind.c; sourceTree = "<group>"; };
+ F966BAC008F27A39005CB29B /* tkClipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkClipboard.c; sourceTree = "<group>"; };
+ F966BAC108F27A39005CB29B /* tkCmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCmds.c; sourceTree = "<group>"; };
+ F966BAC208F27A39005CB29B /* tkColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkColor.c; sourceTree = "<group>"; };
+ F966BAC308F27A39005CB29B /* tkColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkColor.h; sourceTree = "<group>"; };
+ F966BAC408F27A39005CB29B /* tkConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkConfig.c; sourceTree = "<group>"; };
+ F966BAC508F27A39005CB29B /* tkConsole.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkConsole.c; sourceTree = "<group>"; };
+ F966BAC608F27A39005CB29B /* tkCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCursor.c; sourceTree = "<group>"; };
+ F966BAC708F27A39005CB29B /* tkDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkDecls.h; sourceTree = "<group>"; };
+ F966BAC808F27A39005CB29B /* tkEntry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkEntry.c; sourceTree = "<group>"; };
+ F966BAC908F27A39005CB29B /* tkEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkEntry.h; sourceTree = "<group>"; };
+ F966BACA08F27A39005CB29B /* tkError.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkError.c; sourceTree = "<group>"; };
+ F966BACB08F27A39005CB29B /* tkEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkEvent.c; sourceTree = "<group>"; };
+ F966BACC08F27A39005CB29B /* tkFileFilter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFileFilter.c; sourceTree = "<group>"; };
+ F966BACD08F27A39005CB29B /* tkFileFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkFileFilter.h; sourceTree = "<group>"; };
+ F966BACE08F27A39005CB29B /* tkFocus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFocus.c; sourceTree = "<group>"; };
+ F966BACF08F27A39005CB29B /* tkFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFont.c; sourceTree = "<group>"; };
+ F966BAD008F27A39005CB29B /* tkFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkFont.h; sourceTree = "<group>"; };
+ F966BAD108F27A39005CB29B /* tkFrame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFrame.c; sourceTree = "<group>"; };
+ F966BAD208F27A39005CB29B /* tkGC.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGC.c; sourceTree = "<group>"; };
+ F966BAD308F27A39005CB29B /* tkGeometry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGeometry.c; sourceTree = "<group>"; };
+ F966BAD408F27A39005CB29B /* tkGet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGet.c; sourceTree = "<group>"; };
+ F966BAD508F27A39005CB29B /* tkGrab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGrab.c; sourceTree = "<group>"; };
+ F966BAD608F27A39005CB29B /* tkGrid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGrid.c; sourceTree = "<group>"; };
+ F966BAD708F27A39005CB29B /* tkImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImage.c; sourceTree = "<group>"; };
+ F966BAD808F27A39005CB29B /* tkImgBmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgBmap.c; sourceTree = "<group>"; };
+ F966BAD908F27A39005CB29B /* tkImgGIF.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgGIF.c; sourceTree = "<group>"; };
+ F966BADA08F27A39005CB29B /* tkImgPhoto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPhoto.c; sourceTree = "<group>"; };
+ F966BADB08F27A39005CB29B /* tkImgPPM.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPPM.c; sourceTree = "<group>"; };
+ F966BADC08F27A39005CB29B /* tkImgUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgUtil.c; sourceTree = "<group>"; };
+ F966BADE08F27A39005CB29B /* tkInt.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tkInt.decls; sourceTree = "<group>"; };
+ F966BADF08F27A39005CB29B /* tkInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkInt.h; sourceTree = "<group>"; };
+ F966BAE108F27A39005CB29B /* tkIntDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkIntDecls.h; sourceTree = "<group>"; };
+ F966BAE208F27A39005CB29B /* tkIntPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkIntPlatDecls.h; sourceTree = "<group>"; };
+ F966BAE308F27A39005CB29B /* tkIntXlibDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkIntXlibDecls.h; sourceTree = "<group>"; };
+ F966BAE408F27A39005CB29B /* tkListbox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkListbox.c; sourceTree = "<group>"; };
+ F966BAE508F27A39005CB29B /* tkMacWinMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacWinMenu.c; sourceTree = "<group>"; };
+ F966BAE608F27A39005CB29B /* tkMain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMain.c; sourceTree = "<group>"; };
+ F966BAE708F27A39005CB29B /* tkMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMenu.c; sourceTree = "<group>"; };
+ F966BAE808F27A39005CB29B /* tkMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMenu.h; sourceTree = "<group>"; };
+ F966BAE908F27A39005CB29B /* tkMenubutton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMenubutton.c; sourceTree = "<group>"; };
+ F966BAEA08F27A39005CB29B /* tkMenubutton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMenubutton.h; sourceTree = "<group>"; };
+ F966BAEB08F27A39005CB29B /* tkMenuDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMenuDraw.c; sourceTree = "<group>"; };
+ F966BAEC08F27A39005CB29B /* tkMessage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMessage.c; sourceTree = "<group>"; };
+ F966BAED08F27A39005CB29B /* tkObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkObj.c; sourceTree = "<group>"; };
+ F966BAEE08F27A39005CB29B /* tkOldConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkOldConfig.c; sourceTree = "<group>"; };
+ F966BAEF08F27A39005CB29B /* tkOption.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkOption.c; sourceTree = "<group>"; };
+ F966BAF008F27A39005CB29B /* tkPack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPack.c; sourceTree = "<group>"; };
+ F966BAF108F27A39005CB29B /* tkPanedWindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPanedWindow.c; sourceTree = "<group>"; };
+ F966BAF208F27A39005CB29B /* tkPlace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPlace.c; sourceTree = "<group>"; };
+ F966BAF308F27A39005CB29B /* tkPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkPlatDecls.h; sourceTree = "<group>"; };
+ F966BAF408F27A39005CB29B /* tkPointer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPointer.c; sourceTree = "<group>"; };
+ F966BAF508F27A39005CB29B /* tkPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkPort.h; sourceTree = "<group>"; };
+ F966BAF608F27A39005CB29B /* tkRectOval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkRectOval.c; sourceTree = "<group>"; };
+ F966BAF708F27A39005CB29B /* tkScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScale.c; sourceTree = "<group>"; };
+ F966BAF808F27A39005CB29B /* tkScale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScale.h; sourceTree = "<group>"; };
+ F966BAF908F27A39005CB29B /* tkScrollbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScrollbar.c; sourceTree = "<group>"; };
+ F966BAFA08F27A39005CB29B /* tkScrollbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScrollbar.h; sourceTree = "<group>"; };
+ F966BAFB08F27A39005CB29B /* tkSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSelect.c; sourceTree = "<group>"; };
+ F966BAFC08F27A39005CB29B /* tkSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkSelect.h; sourceTree = "<group>"; };
+ F966BAFD08F27A39005CB29B /* tkSquare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSquare.c; sourceTree = "<group>"; };
+ F966BAFE08F27A39005CB29B /* tkOldTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkOldTest.c; sourceTree = "<group>"; };
+ F966BAFF08F27A39005CB29B /* tkStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStubInit.c; sourceTree = "<group>"; };
+ F966BB0008F27A39005CB29B /* tkStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStubLib.c; sourceTree = "<group>"; };
+ F966BB0108F27A39005CB29B /* tkStyle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStyle.c; sourceTree = "<group>"; };
+ F966BB0208F27A39005CB29B /* tkTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTest.c; sourceTree = "<group>"; };
+ F966BB0308F27A39005CB29B /* tkText.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkText.c; sourceTree = "<group>"; };
+ F966BB0408F27A39005CB29B /* tkText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkText.h; sourceTree = "<group>"; };
+ F966BB0508F27A39005CB29B /* tkTextBTree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextBTree.c; sourceTree = "<group>"; };
+ F966BB0608F27A39005CB29B /* tkTextDisp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextDisp.c; sourceTree = "<group>"; };
+ F966BB0808F27A39005CB29B /* tkTextImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextImage.c; sourceTree = "<group>"; };
+ F966BB0908F27A39005CB29B /* tkTextIndex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextIndex.c; sourceTree = "<group>"; };
+ F966BB0A08F27A39005CB29B /* tkTextMark.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextMark.c; sourceTree = "<group>"; };
+ F966BB0B08F27A39005CB29B /* tkTextTag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextTag.c; sourceTree = "<group>"; };
+ F966BB0C08F27A39005CB29B /* tkTextWind.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextWind.c; sourceTree = "<group>"; };
+ F966BB0D08F27A39005CB29B /* tkTrig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTrig.c; sourceTree = "<group>"; };
+ F966BB0E08F27A39005CB29B /* tkUndo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUndo.c; sourceTree = "<group>"; };
+ F966BB0F08F27A39005CB29B /* tkUndo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUndo.h; sourceTree = "<group>"; };
+ F966BB1008F27A39005CB29B /* tkUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUtil.c; sourceTree = "<group>"; };
+ F966BB1108F27A39005CB29B /* tkVisual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkVisual.c; sourceTree = "<group>"; };
+ F966BB1208F27A39005CB29B /* tkWindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWindow.c; sourceTree = "<group>"; };
+ F966BB1408F27A39005CB29B /* bgerror.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bgerror.tcl; sourceTree = "<group>"; };
+ F966BB1508F27A39005CB29B /* button.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.tcl; sourceTree = "<group>"; };
+ F966BB1608F27A39005CB29B /* choosedir.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = choosedir.tcl; sourceTree = "<group>"; };
+ F966BB1708F27A39005CB29B /* clrpick.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clrpick.tcl; sourceTree = "<group>"; };
+ F966BB1808F27A39005CB29B /* comdlg.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = comdlg.tcl; sourceTree = "<group>"; };
+ F966BB1908F27A39005CB29B /* console.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = console.tcl; sourceTree = "<group>"; };
+ F966BB1B08F27A39005CB29B /* anilabel.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = anilabel.tcl; sourceTree = "<group>"; };
+ F966BB1C08F27A39005CB29B /* aniwave.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = aniwave.tcl; sourceTree = "<group>"; };
+ F966BB1D08F27A39005CB29B /* arrow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = arrow.tcl; sourceTree = "<group>"; };
+ F966BB1E08F27A39005CB29B /* bind.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bind.tcl; sourceTree = "<group>"; };
+ F966BB1F08F27A39005CB29B /* bitmap.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bitmap.tcl; sourceTree = "<group>"; };
+ F966BB2008F27A39005CB29B /* browse */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = browse; sourceTree = "<group>"; };
+ F966BB2108F27A39005CB29B /* button.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.tcl; sourceTree = "<group>"; };
+ F966BB2208F27A39005CB29B /* check.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = check.tcl; sourceTree = "<group>"; };
+ F966BB2308F27A39005CB29B /* clrpick.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clrpick.tcl; sourceTree = "<group>"; };
+ F966BB2408F27A39005CB29B /* colors.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = colors.tcl; sourceTree = "<group>"; };
+ F966BB2508F27A39005CB29B /* cscroll.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cscroll.tcl; sourceTree = "<group>"; };
+ F966BB2608F27A39005CB29B /* ctext.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ctext.tcl; sourceTree = "<group>"; };
+ F966BB2708F27A39005CB29B /* dialog1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog1.tcl; sourceTree = "<group>"; };
+ F966BB2808F27A39005CB29B /* dialog2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog2.tcl; sourceTree = "<group>"; };
+ F966BB2A08F27A39005CB29B /* entry1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry1.tcl; sourceTree = "<group>"; };
+ F966BB2B08F27A39005CB29B /* entry2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry2.tcl; sourceTree = "<group>"; };
+ F966BB2C08F27A39005CB29B /* entry3.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry3.tcl; sourceTree = "<group>"; };
+ F966BB2D08F27A39005CB29B /* filebox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = filebox.tcl; sourceTree = "<group>"; };
+ F966BB2E08F27A39005CB29B /* floor.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = floor.tcl; sourceTree = "<group>"; };
+ F966BB2F08F27A39005CB29B /* form.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = form.tcl; sourceTree = "<group>"; };
+ F966BB3008F27A39005CB29B /* goldberg.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = goldberg.tcl; sourceTree = "<group>"; };
+ F966BB3108F27A39005CB29B /* hello */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = hello; sourceTree = "<group>"; };
+ F966BB3208F27A39005CB29B /* hscale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = hscale.tcl; sourceTree = "<group>"; };
+ F966BB3308F27A39005CB29B /* icon.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = icon.tcl; sourceTree = "<group>"; };
+ F966BB3408F27A39005CB29B /* image1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image1.tcl; sourceTree = "<group>"; };
+ F966BB3508F27A39005CB29B /* image2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image2.tcl; sourceTree = "<group>"; };
+ F966BB4208F27A3A005CB29B /* items.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = items.tcl; sourceTree = "<group>"; };
+ F966BB4308F27A3A005CB29B /* ixset */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ixset; sourceTree = "<group>"; };
+ F966BB4408F27A3A005CB29B /* label.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = label.tcl; sourceTree = "<group>"; };
+ F966BB4508F27A3A005CB29B /* labelframe.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = labelframe.tcl; sourceTree = "<group>"; };
+ F966BB4608F27A3A005CB29B /* menu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.tcl; sourceTree = "<group>"; };
+ F966BB4708F27A3A005CB29B /* menubu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubu.tcl; sourceTree = "<group>"; };
+ F966BB4808F27A3A005CB29B /* msgbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.tcl; sourceTree = "<group>"; };
+ F966BB4A08F27A3A005CB29B /* paned1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = paned1.tcl; sourceTree = "<group>"; };
+ F966BB4B08F27A3A005CB29B /* paned2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = paned2.tcl; sourceTree = "<group>"; };
+ F966BB4C08F27A3A005CB29B /* pendulum.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pendulum.tcl; sourceTree = "<group>"; };
+ F966BB4D08F27A3A005CB29B /* plot.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = plot.tcl; sourceTree = "<group>"; };
+ F966BB4E08F27A3A005CB29B /* puzzle.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = puzzle.tcl; sourceTree = "<group>"; };
+ F966BB4F08F27A3A005CB29B /* radio.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = radio.tcl; sourceTree = "<group>"; };
+ F966BB5008F27A3A005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BB5108F27A3A005CB29B /* rmt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = rmt; sourceTree = "<group>"; };
+ F966BB5208F27A3A005CB29B /* rolodex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = rolodex; sourceTree = "<group>"; };
+ F966BB5308F27A3A005CB29B /* ruler.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ruler.tcl; sourceTree = "<group>"; };
+ F966BB5408F27A3A005CB29B /* sayings.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = sayings.tcl; sourceTree = "<group>"; };
+ F966BB5508F27A3A005CB29B /* search.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = search.tcl; sourceTree = "<group>"; };
+ F966BB5608F27A3A005CB29B /* spin.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = spin.tcl; sourceTree = "<group>"; };
+ F966BB5708F27A3A005CB29B /* square */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = square; sourceTree = "<group>"; };
+ F966BB5808F27A3A005CB29B /* states.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = states.tcl; sourceTree = "<group>"; };
+ F966BB5908F27A3A005CB29B /* style.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = style.tcl; sourceTree = "<group>"; };
+ F966BB5A08F27A3A005CB29B /* tclIndex */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclIndex; sourceTree = "<group>"; };
+ F966BB5B08F27A3A005CB29B /* tcolor */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = tcolor; sourceTree = "<group>"; };
+ F966BB5C08F27A3A005CB29B /* text.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = text.tcl; sourceTree = "<group>"; };
+ F966BB5D08F27A3A005CB29B /* timer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = timer; sourceTree = "<group>"; };
+ F966BB5E08F27A3A005CB29B /* twind.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = twind.tcl; sourceTree = "<group>"; };
+ F966BB5F08F27A3A005CB29B /* unicodeout.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unicodeout.tcl; sourceTree = "<group>"; };
+ F966BB6008F27A3A005CB29B /* vscale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vscale.tcl; sourceTree = "<group>"; };
+ F966BB6108F27A3A005CB29B /* widget */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = widget; sourceTree = "<group>"; };
+ F966BB6208F27A3A005CB29B /* dialog.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog.tcl; sourceTree = "<group>"; };
+ F966BB6308F27A3A005CB29B /* entry.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.tcl; sourceTree = "<group>"; };
+ F966BB6408F27A3A005CB29B /* focus.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focus.tcl; sourceTree = "<group>"; };
+ F966BB7308F27A3A005CB29B /* listbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listbox.tcl; sourceTree = "<group>"; };
+ F966BB7408F27A3A005CB29B /* menu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.tcl; sourceTree = "<group>"; };
+ F966BB7508F27A3A005CB29B /* mkpsenc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mkpsenc.tcl; sourceTree = "<group>"; };
+ F966BB7608F27A3A005CB29B /* msgbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.tcl; sourceTree = "<group>"; };
+ F966BB8608F27A3A005CB29B /* obsolete.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obsolete.tcl; sourceTree = "<group>"; };
+ F966BB8708F27A3A005CB29B /* optMenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optMenu.tcl; sourceTree = "<group>"; };
+ F966BB8808F27A3A005CB29B /* palette.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = palette.tcl; sourceTree = "<group>"; };
+ F966BB8908F27A3B005CB29B /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
+ F966BB8A08F27A3B005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
+ F966BB8B08F27A3B005CB29B /* safetk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safetk.tcl; sourceTree = "<group>"; };
+ F966BB8C08F27A3B005CB29B /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
+ F966BB8D08F27A3B005CB29B /* scrlbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrlbar.tcl; sourceTree = "<group>"; };
+ F966BB8E08F27A3B005CB29B /* spinbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = spinbox.tcl; sourceTree = "<group>"; };
+ F966BB8F08F27A3B005CB29B /* tclIndex */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclIndex; sourceTree = "<group>"; };
+ F966BB9008F27A3B005CB29B /* tearoff.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tearoff.tcl; sourceTree = "<group>"; };
+ F966BB9108F27A3B005CB29B /* text.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = text.tcl; sourceTree = "<group>"; };
+ F966BB9208F27A3B005CB29B /* tk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.tcl; sourceTree = "<group>"; };
+ F966BB9308F27A3B005CB29B /* tkfbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tkfbox.tcl; sourceTree = "<group>"; };
+ F966BB9408F27A3B005CB29B /* unsupported.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unsupported.tcl; sourceTree = "<group>"; };
+ F966BB9508F27A3B005CB29B /* xmfbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.tcl; sourceTree = "<group>"; };
+ F966BB9608F27A3B005CB29B /* license.terms */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = license.terms; sourceTree = "<group>"; };
+ F966BBBA08F27A3B005CB29B /* configure.ac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure.ac; sourceTree = "<group>"; };
+ F966BBBB08F27A3B005CB29B /* GNUmakefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = GNUmakefile; sourceTree = "<group>"; };
+ F966BBBE08F27A3B005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BBC008F27A3B005CB29B /* Tk-Info.plist.in */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = "Tk-Info.plist.in"; sourceTree = "<group>"; };
+ F966BBC108F27A3B005CB29B /* tkAboutDlg.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = tkAboutDlg.r; sourceTree = "<group>"; };
+ F966BBC208F27A3B005CB29B /* tkMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSX.h; sourceTree = "<group>"; };
+ F966BBC408F27A3B005CB29B /* tkMacOSXAETE.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = tkMacOSXAETE.r; sourceTree = "<group>"; };
+ F966BBC508F27A3B005CB29B /* tkMacOSXBitmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXBitmap.c; sourceTree = "<group>"; };
+ F966BBC608F27A3B005CB29B /* tkMacOSXButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXButton.c; sourceTree = "<group>"; };
+ F966BBC708F27A3B005CB29B /* tkMacOSXCarbonEvents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXCarbonEvents.c; sourceTree = "<group>"; };
+ F966BBC808F27A3B005CB29B /* tkMacOSXClipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXClipboard.c; sourceTree = "<group>"; };
+ F966BBC908F27A3B005CB29B /* tkMacOSXColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXColor.c; sourceTree = "<group>"; };
+ F966BBCA08F27A3B005CB29B /* tkMacOSXConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXConfig.c; sourceTree = "<group>"; };
+ F966BBCB08F27A3B005CB29B /* tkMacOSXCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXCursor.c; sourceTree = "<group>"; };
+ F966BBCC08F27A3B005CB29B /* tkMacOSXCursors.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = tkMacOSXCursors.r; sourceTree = "<group>"; };
+ F966BBCD08F27A3B005CB29B /* tkMacOSXDebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXDebug.c; sourceTree = "<group>"; };
+ F966BBCE08F27A3B005CB29B /* tkMacOSXDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXDebug.h; sourceTree = "<group>"; };
+ F966BBCF08F27A3B005CB29B /* tkMacOSXDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXDefault.h; sourceTree = "<group>"; };
+ F966BBD008F27A3B005CB29B /* tkMacOSXDialog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXDialog.c; sourceTree = "<group>"; };
+ F966BBD108F27A3B005CB29B /* tkMacOSXDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXDraw.c; sourceTree = "<group>"; };
+ F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXEmbed.c; sourceTree = "<group>"; };
+ F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXEntry.c; sourceTree = "<group>"; };
+ F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXEvent.c; sourceTree = "<group>"; };
+ F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXEvent.h; sourceTree = "<group>"; };
+ F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXFont.c; sourceTree = "<group>"; };
+ F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXHLEvents.c; sourceTree = "<group>"; };
+ F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXInit.c; sourceTree = "<group>"; };
+ F966BBDA08F27A3B005CB29B /* tkMacOSXInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXInt.h; sourceTree = "<group>"; };
+ F966BBDB08F27A3B005CB29B /* tkMacOSXKeyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXKeyboard.c; sourceTree = "<group>"; };
+ F966BBDC08F27A3B005CB29B /* tkMacOSXKeyEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXKeyEvent.c; sourceTree = "<group>"; };
+ F966BBDD08F27A3B005CB29B /* tkMacOSXMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMenu.c; sourceTree = "<group>"; };
+ F966BBE008F27A3B005CB29B /* tkMacOSXMenubutton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMenubutton.c; sourceTree = "<group>"; };
+ F966BBE108F27A3B005CB29B /* tkMacOSXMenus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMenus.c; sourceTree = "<group>"; };
+ F966BBE208F27A3B005CB29B /* tkMacOSXMouseEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMouseEvent.c; sourceTree = "<group>"; };
+ F966BBE308F27A3B005CB29B /* tkMacOSXNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXNotify.c; sourceTree = "<group>"; };
+ F966BBEA08F27A3C005CB29B /* tkMacOSXPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPort.h; sourceTree = "<group>"; };
+ F966BBEB08F27A3C005CB29B /* tkMacOSXRegion.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXRegion.c; sourceTree = "<group>"; };
+ F966BBEC08F27A3C005CB29B /* tkMacOSXScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXScale.c; sourceTree = "<group>"; };
+ F966BBED08F27A3C005CB29B /* tkMacOSXScrlbr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXScrlbr.c; sourceTree = "<group>"; };
+ F966BBEE08F27A3C005CB29B /* tkMacOSXSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXSend.c; sourceTree = "<group>"; };
+ F966BBEF08F27A3C005CB29B /* tkMacOSXSubwindows.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXSubwindows.c; sourceTree = "<group>"; };
+ F966BBF008F27A3C005CB29B /* tkMacOSXTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXTest.c; sourceTree = "<group>"; };
+ F966BBF108F27A3C005CB29B /* tkMacOSXWindowEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXWindowEvent.c; sourceTree = "<group>"; };
+ F966BBF208F27A3C005CB29B /* tkMacOSXWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXWm.c; sourceTree = "<group>"; };
+ F966BBF308F27A3C005CB29B /* tkMacOSXWm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXWm.h; sourceTree = "<group>"; };
+ F966BBF408F27A3C005CB29B /* tkMacOSXXCursors.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = tkMacOSXXCursors.r; sourceTree = "<group>"; };
+ F966BBF508F27A3C005CB29B /* tkMacOSXXStubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXXStubs.c; sourceTree = "<group>"; };
+ F966BBF708F27A3C005CB29B /* Wish-Info.plist.in */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = "Wish-Info.plist.in"; sourceTree = "<group>"; };
+ F966BBF808F27A3C005CB29B /* Wish.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Wish.icns; sourceTree = "<group>"; };
+ F966BC0308F27A3C005CB29B /* README */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = README; sourceTree = "<group>"; };
+ F966BC0508F27A3C005CB29B /* all.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = all.tcl; sourceTree = "<group>"; };
+ F966BC0608F27A3C005CB29B /* arc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = arc.tcl; sourceTree = "<group>"; };
+ F966BC0708F27A3C005CB29B /* bell.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bell.test; sourceTree = "<group>"; };
+ F966BC0808F27A3C005CB29B /* bevel.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bevel.tcl; sourceTree = "<group>"; };
+ F966BC0908F27A3C005CB29B /* bgerror.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bgerror.test; sourceTree = "<group>"; };
+ F966BC0A08F27A3C005CB29B /* bind.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bind.test; sourceTree = "<group>"; };
+ F966BC0B08F27A3C005CB29B /* bitmap.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bitmap.test; sourceTree = "<group>"; };
+ F966BC0C08F27A3C005CB29B /* border.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = border.test; sourceTree = "<group>"; };
+ F966BC0D08F27A3C005CB29B /* bugs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bugs.tcl; sourceTree = "<group>"; };
+ F966BC0E08F27A3C005CB29B /* butGeom.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = butGeom.tcl; sourceTree = "<group>"; };
+ F966BC0F08F27A3C005CB29B /* butGeom2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = butGeom2.tcl; sourceTree = "<group>"; };
+ F966BC1008F27A3C005CB29B /* button.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.test; sourceTree = "<group>"; };
+ F966BC1108F27A3C005CB29B /* canvas.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvas.test; sourceTree = "<group>"; };
+ F966BC1208F27A3C005CB29B /* canvImg.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvImg.test; sourceTree = "<group>"; };
+ F966BC1308F27A3C005CB29B /* canvPs.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPs.test; sourceTree = "<group>"; };
+ F966BC1408F27A3C005CB29B /* canvPsArc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsArc.tcl; sourceTree = "<group>"; };
+ F966BC1508F27A3C005CB29B /* canvPsBmap.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsBmap.tcl; sourceTree = "<group>"; };
+ F966BC1608F27A3C005CB29B /* canvPsGrph.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsGrph.tcl; sourceTree = "<group>"; };
+ F966BC1708F27A3C005CB29B /* canvPsImg.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsImg.tcl; sourceTree = "<group>"; };
+ F966BC1808F27A3C005CB29B /* canvPsText.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsText.tcl; sourceTree = "<group>"; };
+ F966BC1908F27A3C005CB29B /* canvRect.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvRect.test; sourceTree = "<group>"; };
+ F966BC1A08F27A3C005CB29B /* canvText.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvText.test; sourceTree = "<group>"; };
+ F966BC1B08F27A3C005CB29B /* canvWind.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvWind.test; sourceTree = "<group>"; };
+ F966BC1C08F27A3C005CB29B /* choosedir.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = choosedir.test; sourceTree = "<group>"; };
+ F966BC1D08F27A3C005CB29B /* clipboard.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clipboard.test; sourceTree = "<group>"; };
+ F966BC1E08F27A3C005CB29B /* clrpick.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clrpick.test; sourceTree = "<group>"; };
+ F966BC1F08F27A3C005CB29B /* cmap.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmap.tcl; sourceTree = "<group>"; };
+ F966BC2008F27A3C005CB29B /* cmds.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmds.test; sourceTree = "<group>"; };
+ F966BC2108F27A3C005CB29B /* color.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = color.test; sourceTree = "<group>"; };
+ F966BC2208F27A3C005CB29B /* config.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = config.test; sourceTree = "<group>"; };
+ F966BC2308F27A3C005CB29B /* constraints.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = constraints.tcl; sourceTree = "<group>"; };
+ F966BC2408F27A3C005CB29B /* cursor.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cursor.test; sourceTree = "<group>"; };
+ F966BC2508F27A3C005CB29B /* dialog.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog.test; sourceTree = "<group>"; };
+ F966BC2608F27A3C005CB29B /* embed.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = embed.test; sourceTree = "<group>"; };
+ F966BC2708F27A3C005CB29B /* entry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.test; sourceTree = "<group>"; };
+ F966BC2808F27A3C005CB29B /* event.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = event.test; sourceTree = "<group>"; };
+ F966BC2908F27A3C005CB29B /* filebox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = filebox.test; sourceTree = "<group>"; };
+ F966BC2A08F27A3C005CB29B /* focus.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focus.test; sourceTree = "<group>"; };
+ F966BC2B08F27A3C005CB29B /* focusTcl.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focusTcl.test; sourceTree = "<group>"; };
+ F966BC2C08F27A3C005CB29B /* font.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = font.test; sourceTree = "<group>"; };
+ F966BC2D08F27A3C005CB29B /* frame.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = frame.test; sourceTree = "<group>"; };
+ F966BC2E08F27A3C005CB29B /* geometry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = geometry.test; sourceTree = "<group>"; };
+ F966BC2F08F27A3C005CB29B /* get.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = get.test; sourceTree = "<group>"; };
+ F966BC3008F27A3C005CB29B /* grab.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grab.test; sourceTree = "<group>"; };
+ F966BC3108F27A3C005CB29B /* grid.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grid.test; sourceTree = "<group>"; };
+ F966BC3208F27A3C005CB29B /* id.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = id.test; sourceTree = "<group>"; };
+ F966BC3308F27A3C005CB29B /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
+ F966BC3408F27A3C005CB29B /* imgBmap.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgBmap.test; sourceTree = "<group>"; };
+ F966BC3508F27A3C005CB29B /* imgPhoto.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPhoto.test; sourceTree = "<group>"; };
+ F966BC3608F27A3C005CB29B /* imgPPM.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPPM.test; sourceTree = "<group>"; };
+ F966BC3708F27A3C005CB29B /* listbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listbox.test; sourceTree = "<group>"; };
+ F966BC3808F27A3C005CB29B /* main.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = main.test; sourceTree = "<group>"; };
+ F966BC3908F27A3C005CB29B /* menu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.test; sourceTree = "<group>"; };
+ F966BC3A08F27A3C005CB29B /* menubut.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubut.test; sourceTree = "<group>"; };
+ F966BC3B08F27A3C005CB29B /* menuDraw.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menuDraw.test; sourceTree = "<group>"; };
+ F966BC3C08F27A3C005CB29B /* message.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = message.test; sourceTree = "<group>"; };
+ F966BC3D08F27A3C005CB29B /* msgbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.test; sourceTree = "<group>"; };
+ F966BC3E08F27A3C005CB29B /* obj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obj.test; sourceTree = "<group>"; };
+ F966BC3F08F27A3C005CB29B /* oldpack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = oldpack.test; sourceTree = "<group>"; };
+ F966BC4008F27A3C005CB29B /* option.file1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file1; sourceTree = "<group>"; };
+ F966BC4108F27A3C005CB29B /* option.file2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file2; sourceTree = "<group>"; };
+ F966BC4208F27A3C005CB29B /* option.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = option.test; sourceTree = "<group>"; };
+ F966BC4308F27A3C005CB29B /* pack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pack.test; sourceTree = "<group>"; };
+ F966BC4408F27A3C005CB29B /* panedwindow.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.test; sourceTree = "<group>"; };
+ F966BC4508F27A3D005CB29B /* place.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = place.test; sourceTree = "<group>"; };
+ F966BC4608F27A3D005CB29B /* raise.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = raise.test; sourceTree = "<group>"; };
+ F966BC4708F27A3D005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BC4808F27A3D005CB29B /* safe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safe.test; sourceTree = "<group>"; };
+ F966BC4908F27A3D005CB29B /* scale.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.test; sourceTree = "<group>"; };
+ F966BC4A08F27A3D005CB29B /* scrollbar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrollbar.test; sourceTree = "<group>"; };
+ F966BC4B08F27A3D005CB29B /* select.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = select.test; sourceTree = "<group>"; };
+ F966BC4C08F27A3D005CB29B /* send.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = send.test; sourceTree = "<group>"; };
+ F966BC4D08F27A3D005CB29B /* spinbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = spinbox.test; sourceTree = "<group>"; };
+ F966BC4E08F27A3D005CB29B /* text.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = text.test; sourceTree = "<group>"; };
+ F966BC4F08F27A3D005CB29B /* textBTree.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textBTree.test; sourceTree = "<group>"; };
+ F966BC5008F27A3D005CB29B /* textDisp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textDisp.test; sourceTree = "<group>"; };
+ F966BC5108F27A3D005CB29B /* textImage.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textImage.test; sourceTree = "<group>"; };
+ F966BC5208F27A3D005CB29B /* textIndex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textIndex.test; sourceTree = "<group>"; };
+ F966BC5308F27A3D005CB29B /* textMark.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textMark.test; sourceTree = "<group>"; };
+ F966BC5408F27A3D005CB29B /* textTag.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textTag.test; sourceTree = "<group>"; };
+ F966BC5508F27A3D005CB29B /* textWind.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textWind.test; sourceTree = "<group>"; };
+ F966BC5608F27A3D005CB29B /* tk.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.test; sourceTree = "<group>"; };
+ F966BC5708F27A3D005CB29B /* unixButton.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixButton.test; sourceTree = "<group>"; };
+ F966BC5808F27A3D005CB29B /* unixEmbed.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixEmbed.test; sourceTree = "<group>"; };
+ F966BC5908F27A3D005CB29B /* unixFont.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixFont.test; sourceTree = "<group>"; };
+ F966BC5A08F27A3D005CB29B /* unixMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixMenu.test; sourceTree = "<group>"; };
+ F966BC5B08F27A3D005CB29B /* unixSelect.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixSelect.test; sourceTree = "<group>"; };
+ F966BC5C08F27A3D005CB29B /* unixWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixWm.test; sourceTree = "<group>"; };
+ F966BC5D08F27A3D005CB29B /* util.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = util.test; sourceTree = "<group>"; };
+ F966BC5E08F27A3D005CB29B /* visual.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = visual.test; sourceTree = "<group>"; };
+ F966BC5F08F27A3D005CB29B /* visual_bb.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = visual_bb.test; sourceTree = "<group>"; };
+ F966BC6008F27A3D005CB29B /* winButton.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winButton.test; sourceTree = "<group>"; };
+ F966BC6108F27A3D005CB29B /* winClipboard.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winClipboard.test; sourceTree = "<group>"; };
+ F966BC6208F27A3D005CB29B /* winDialog.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winDialog.test; sourceTree = "<group>"; };
+ F966BC6308F27A3D005CB29B /* window.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = window.test; sourceTree = "<group>"; };
+ F966BC6408F27A3D005CB29B /* winfo.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winfo.test; sourceTree = "<group>"; };
+ F966BC6508F27A3D005CB29B /* winFont.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFont.test; sourceTree = "<group>"; };
+ F966BC6608F27A3D005CB29B /* winMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winMenu.test; sourceTree = "<group>"; };
+ F966BC6708F27A3D005CB29B /* winSend.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winSend.test; sourceTree = "<group>"; };
+ F966BC6808F27A3D005CB29B /* winWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winWm.test; sourceTree = "<group>"; };
+ F966BC6908F27A3D005CB29B /* wm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = wm.test; sourceTree = "<group>"; };
+ F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; };
+ F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F966BC6E08F27A3D005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC6F08F27A3D005CB29B /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; };
+ F966BC7008F27A3D005CB29B /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; };
+ F966BC7108F27A3D005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F966BC7208F27A3D005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BC7308F27A3D005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F966BC7408F27A3D005CB29B /* tk.spec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.spec; sourceTree = "<group>"; };
+ F966BC7508F27A3D005CB29B /* tkAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkAppInit.c; sourceTree = "<group>"; };
+ F966BC7608F27A3D005CB29B /* tkConfig.h.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = tkConfig.h.in; sourceTree = "<group>"; };
+ F966BC7708F27A3D005CB29B /* tkConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tkConfig.sh.in; sourceTree = "<group>"; };
+ F966BC7808F27A3D005CB29B /* tkUnix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix.c; sourceTree = "<group>"; };
+ F966BC7908F27A3D005CB29B /* tkUnix3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix3d.c; sourceTree = "<group>"; };
+ F966BC7A08F27A3D005CB29B /* tkUnixButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixButton.c; sourceTree = "<group>"; };
+ F966BC7B08F27A3D005CB29B /* tkUnixColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixColor.c; sourceTree = "<group>"; };
+ F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixConfig.c; sourceTree = "<group>"; };
+ F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixCursor.c; sourceTree = "<group>"; };
+ F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixDefault.h; sourceTree = "<group>"; };
+ F966BC7F08F27A3D005CB29B /* tkUnixDialog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixDialog.c; sourceTree = "<group>"; };
+ F966BC8008F27A3D005CB29B /* tkUnixDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixDraw.c; sourceTree = "<group>"; };
+ F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixEmbed.c; sourceTree = "<group>"; };
+ F966BC8208F27A3D005CB29B /* tkUnixEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixEvent.c; sourceTree = "<group>"; };
+ F966BC8308F27A3D005CB29B /* tkUnixFocus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixFocus.c; sourceTree = "<group>"; };
+ F966BC8408F27A3D005CB29B /* tkUnixFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixFont.c; sourceTree = "<group>"; };
+ F966BC8508F27A3D005CB29B /* tkUnixInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixInit.c; sourceTree = "<group>"; };
+ F966BC8608F27A3D005CB29B /* tkUnixInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixInt.h; sourceTree = "<group>"; };
+ F966BC8708F27A3D005CB29B /* tkUnixKey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixKey.c; sourceTree = "<group>"; };
+ F966BC8808F27A3D005CB29B /* tkUnixMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixMenu.c; sourceTree = "<group>"; };
+ F966BC8908F27A3D005CB29B /* tkUnixMenubu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixMenubu.c; sourceTree = "<group>"; };
+ F966BC8A08F27A3D005CB29B /* tkUnixPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixPort.h; sourceTree = "<group>"; };
+ F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixRFont.c; sourceTree = "<group>"; };
+ F966BC8C08F27A3D005CB29B /* tkUnixScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixScale.c; sourceTree = "<group>"; };
+ F966BC8D08F27A3D005CB29B /* tkUnixScrlbr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixScrlbr.c; sourceTree = "<group>"; };
+ F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSelect.c; sourceTree = "<group>"; };
+ F966BC8F08F27A3D005CB29B /* tkUnixSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSend.c; sourceTree = "<group>"; };
+ F966BC9008F27A3D005CB29B /* tkUnixWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixWm.c; sourceTree = "<group>"; };
+ F966BC9108F27A3D005CB29B /* tkUnixXId.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixXId.c; sourceTree = "<group>"; };
+ F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
+ F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F966BC9708F27A3E005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC9808F27A3E005CB29B /* makefile.bc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.bc; sourceTree = "<group>"; };
+ F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
+ F966BC9B08F27A3E005CB29B /* mkd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mkd.bat; sourceTree = "<group>"; };
+ F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
+ F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; };
+ F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; };
+ F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; };
+ F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BCF408F27A3E005CB29B /* rmd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rmd.bat; sourceTree = "<group>"; };
+ F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
+ F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; };
+ F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F966BCF808F27A3F005CB29B /* tkConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tkConfig.sh.in; sourceTree = "<group>"; };
+ F966BCF908F27A3F005CB29B /* tkWin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWin.h; sourceTree = "<group>"; };
+ F966BCFA08F27A3F005CB29B /* tkWin32Dll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin32Dll.c; sourceTree = "<group>"; };
+ F966BCFB08F27A3F005CB29B /* tkWin3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin3d.c; sourceTree = "<group>"; };
+ F966BCFC08F27A3F005CB29B /* tkWinButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinButton.c; sourceTree = "<group>"; };
+ F966BCFD08F27A3F005CB29B /* tkWinClipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinClipboard.c; sourceTree = "<group>"; };
+ F966BCFE08F27A3F005CB29B /* tkWinColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinColor.c; sourceTree = "<group>"; };
+ F966BCFF08F27A3F005CB29B /* tkWinConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinConfig.c; sourceTree = "<group>"; };
+ F966BD0008F27A3F005CB29B /* tkWinCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinCursor.c; sourceTree = "<group>"; };
+ F966BD0108F27A3F005CB29B /* tkWinDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinDefault.h; sourceTree = "<group>"; };
+ F966BD0208F27A3F005CB29B /* tkWinDialog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinDialog.c; sourceTree = "<group>"; };
+ F966BD0308F27A3F005CB29B /* tkWinDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinDraw.c; sourceTree = "<group>"; };
+ F966BD0408F27A3F005CB29B /* tkWinEmbed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinEmbed.c; sourceTree = "<group>"; };
+ F966BD0508F27A3F005CB29B /* tkWinFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinFont.c; sourceTree = "<group>"; };
+ F966BD0708F27A3F005CB29B /* tkWinImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinImage.c; sourceTree = "<group>"; };
+ F966BD0808F27A3F005CB29B /* tkWinInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinInit.c; sourceTree = "<group>"; };
+ F966BD0908F27A3F005CB29B /* tkWinInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinInt.h; sourceTree = "<group>"; };
+ F966BD0A08F27A3F005CB29B /* tkWinKey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinKey.c; sourceTree = "<group>"; };
+ F966BD0B08F27A3F005CB29B /* tkWinMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinMenu.c; sourceTree = "<group>"; };
+ F966BD0C08F27A3F005CB29B /* tkWinPixmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinPixmap.c; sourceTree = "<group>"; };
+ F966BD0D08F27A3F005CB29B /* tkWinPointer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinPointer.c; sourceTree = "<group>"; };
+ F966BD0E08F27A3F005CB29B /* tkWinPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinPort.h; sourceTree = "<group>"; };
+ F966BD0F08F27A3F005CB29B /* tkWinRegion.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinRegion.c; sourceTree = "<group>"; };
+ F966BD1008F27A3F005CB29B /* tkWinScrlbr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinScrlbr.c; sourceTree = "<group>"; };
+ F966BD1108F27A3F005CB29B /* tkWinSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinSend.c; sourceTree = "<group>"; };
+ F966BD1208F27A3F005CB29B /* tkWinSendCom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinSendCom.c; sourceTree = "<group>"; };
+ F966BD1308F27A3F005CB29B /* tkWinSendCom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinSendCom.h; sourceTree = "<group>"; };
+ F966BD1408F27A3F005CB29B /* tkWinTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinTest.c; sourceTree = "<group>"; };
+ F966BD1508F27A3F005CB29B /* tkWinWindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinWindow.c; sourceTree = "<group>"; };
+ F966BD1608F27A3F005CB29B /* tkWinWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinWm.c; sourceTree = "<group>"; };
+ F966BD1708F27A3F005CB29B /* tkWinX.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinX.c; sourceTree = "<group>"; };
+ F966BD1808F27A3F005CB29B /* winMain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = winMain.c; sourceTree = "<group>"; };
+ F966BD1B08F27A3F005CB29B /* cursorfont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cursorfont.h; sourceTree = "<group>"; };
+ F966BD1C08F27A3F005CB29B /* keysym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keysym.h; sourceTree = "<group>"; };
+ F966BD1D08F27A3F005CB29B /* keysymdef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keysymdef.h; sourceTree = "<group>"; };
+ F966BD1E08F27A3F005CB29B /* X.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = X.h; sourceTree = "<group>"; };
+ F966BD1F08F27A3F005CB29B /* Xatom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xatom.h; sourceTree = "<group>"; };
+ F966BD2008F27A3F005CB29B /* Xfuncproto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xfuncproto.h; sourceTree = "<group>"; };
+ F966BD2108F27A3F005CB29B /* Xlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xlib.h; sourceTree = "<group>"; };
+ F966BD2208F27A3F005CB29B /* Xutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xutil.h; sourceTree = "<group>"; };
+ F966BD2308F27A3F005CB29B /* xbytes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbytes.h; sourceTree = "<group>"; };
+ F966BD2408F27A3F005CB29B /* xcolors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xcolors.c; sourceTree = "<group>"; };
+ F966BD2508F27A3F005CB29B /* xdraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xdraw.c; sourceTree = "<group>"; };
+ F966BD2608F27A3F005CB29B /* xgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xgc.c; sourceTree = "<group>"; };
+ F966BD2708F27A3F005CB29B /* ximage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ximage.c; sourceTree = "<group>"; };
+ F966BD2808F27A3F005CB29B /* xutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xutil.c; sourceTree = "<group>"; };
+ F966C07408F2820D005CB29B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+ F966C07608F2821B005CB29B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+ F966C07808F28233005CB29B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+ F96887E00AF786D5000797B5 /* ttk.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk.decls; sourceTree = "<group>"; };
+ F96887E10AF786D5000797B5 /* ttkBlink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkBlink.c; sourceTree = "<group>"; };
+ F96887E20AF786D5000797B5 /* ttkButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkButton.c; sourceTree = "<group>"; };
+ F96887E30AF786D5000797B5 /* ttkCache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkCache.c; sourceTree = "<group>"; };
+ F96887E40AF786D5000797B5 /* ttkClamTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkClamTheme.c; sourceTree = "<group>"; };
+ F96887E50AF786D5000797B5 /* ttkClassicTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkClassicTheme.c; sourceTree = "<group>"; };
+ F96887E60AF786D5000797B5 /* ttkDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkDecls.h; sourceTree = "<group>"; };
+ F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkDefaultTheme.c; sourceTree = "<group>"; };
+ F96887E80AF786D5000797B5 /* ttkElements.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkElements.c; sourceTree = "<group>"; };
+ F96887E90AF786D5000797B5 /* ttkEntry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkEntry.c; sourceTree = "<group>"; };
+ F96887EA0AF786D5000797B5 /* ttkFrame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkFrame.c; sourceTree = "<group>"; };
+ F96887EB0AF786D5000797B5 /* ttkImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkImage.c; sourceTree = "<group>"; };
+ F96887EC0AF786D5000797B5 /* ttkInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkInit.c; sourceTree = "<group>"; };
+ F96887ED0AF786D5000797B5 /* ttkLabel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkLabel.c; sourceTree = "<group>"; };
+ F96887EE0AF786D5000797B5 /* ttkLayout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkLayout.c; sourceTree = "<group>"; };
+ F96887EF0AF786D5000797B5 /* ttkManager.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkManager.c; sourceTree = "<group>"; };
+ F96887F00AF786D5000797B5 /* ttkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkManager.h; sourceTree = "<group>"; };
+ F96887F10AF786D5000797B5 /* ttkNotebook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkNotebook.c; sourceTree = "<group>"; };
+ F96887F20AF786D5000797B5 /* ttkPanedwindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkPanedwindow.c; sourceTree = "<group>"; };
+ F96887F30AF786D5000797B5 /* ttkProgress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkProgress.c; sourceTree = "<group>"; };
+ F96887F40AF786D5000797B5 /* ttkScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkScale.c; sourceTree = "<group>"; };
+ F96887F50AF786D5000797B5 /* ttkScroll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkScroll.c; sourceTree = "<group>"; };
+ F96887F60AF786D5000797B5 /* ttkScrollbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkScrollbar.c; sourceTree = "<group>"; };
+ F96887F70AF786D5000797B5 /* ttkSeparator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkSeparator.c; sourceTree = "<group>"; };
+ F96887F80AF786D5000797B5 /* ttkSquare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkSquare.c; sourceTree = "<group>"; };
+ F96887F90AF786D5000797B5 /* ttkState.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkState.c; sourceTree = "<group>"; };
+ F96887FA0AF786D5000797B5 /* ttkStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkStubInit.c; sourceTree = "<group>"; };
+ F96887FB0AF786D5000797B5 /* ttkStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkStubLib.c; sourceTree = "<group>"; };
+ F96887FC0AF786D5000797B5 /* ttkTagSet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTagSet.c; sourceTree = "<group>"; };
+ F96887FD0AF786D5000797B5 /* ttkTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTheme.c; sourceTree = "<group>"; };
+ F96887FE0AF786D5000797B5 /* ttkTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkTheme.h; sourceTree = "<group>"; };
+ F96887FF0AF786D5000797B5 /* ttkThemeInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkThemeInt.h; sourceTree = "<group>"; };
+ F96888000AF786D5000797B5 /* ttkTrace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTrace.c; sourceTree = "<group>"; };
+ F96888010AF786D5000797B5 /* ttkTrack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTrack.c; sourceTree = "<group>"; };
+ F96888020AF786D5000797B5 /* ttkTreeview.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTreeview.c; sourceTree = "<group>"; };
+ F96888030AF786D5000797B5 /* ttkWidget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWidget.c; sourceTree = "<group>"; };
+ F96888040AF786D5000797B5 /* ttkWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkWidget.h; sourceTree = "<group>"; };
+ F96888370AF787B3000797B5 /* altTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = altTheme.tcl; sourceTree = "<group>"; };
+ F96888380AF787B3000797B5 /* aquaTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = aquaTheme.tcl; sourceTree = "<group>"; };
+ F96888390AF787B3000797B5 /* button.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.tcl; sourceTree = "<group>"; };
+ F968883A0AF787B3000797B5 /* clamTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clamTheme.tcl; sourceTree = "<group>"; };
+ F968883B0AF787B3000797B5 /* classicTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = classicTheme.tcl; sourceTree = "<group>"; };
+ F968883C0AF787B3000797B5 /* combobox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combobox.tcl; sourceTree = "<group>"; };
+ F968883D0AF787B3000797B5 /* cursors.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cursors.tcl; sourceTree = "<group>"; };
+ F968883E0AF787B3000797B5 /* defaults.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = defaults.tcl; sourceTree = "<group>"; };
+ F96888400AF787B3000797B5 /* entry.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.tcl; sourceTree = "<group>"; };
+ F96888410AF787B3000797B5 /* fonts.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fonts.tcl; sourceTree = "<group>"; };
+ F96888440AF787B3000797B5 /* menubutton.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubutton.tcl; sourceTree = "<group>"; };
+ F96888450AF787B3000797B5 /* notebook.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notebook.tcl; sourceTree = "<group>"; };
+ F96888460AF787B3000797B5 /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
+ F96888470AF787B3000797B5 /* progress.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = progress.tcl; sourceTree = "<group>"; };
+ F96888480AF787B3000797B5 /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
+ F96888490AF787B3000797B5 /* scrollbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrollbar.tcl; sourceTree = "<group>"; };
+ F968884A0AF787B3000797B5 /* sizegrip.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = sizegrip.tcl; sourceTree = "<group>"; };
+ F968884B0AF787B3000797B5 /* treeview.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = treeview.tcl; sourceTree = "<group>"; };
+ F968884C0AF787B3000797B5 /* ttk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk.tcl; sourceTree = "<group>"; };
+ F968884D0AF787B3000797B5 /* utils.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = utils.tcl; sourceTree = "<group>"; };
+ F968884E0AF787B3000797B5 /* winTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTheme.tcl; sourceTree = "<group>"; };
+ F968884F0AF787B3000797B5 /* xpTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xpTheme.tcl; sourceTree = "<group>"; };
+ F96888540AF7880C000797B5 /* all.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = all.tcl; sourceTree = "<group>"; };
+ F96888560AF7880C000797B5 /* combobox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combobox.test; sourceTree = "<group>"; };
+ F96888570AF7880C000797B5 /* entry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.test; sourceTree = "<group>"; };
+ F96888580AF7880C000797B5 /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
+ F96888590AF7880C000797B5 /* labelframe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = labelframe.test; sourceTree = "<group>"; };
+ F968885A0AF7880C000797B5 /* layout.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = layout.test; sourceTree = "<group>"; };
+ F968885C0AF7880C000797B5 /* notebook.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notebook.test; sourceTree = "<group>"; };
+ F968885D0AF7880C000797B5 /* panedwindow.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.test; sourceTree = "<group>"; };
+ F968885E0AF7880C000797B5 /* progressbar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = progressbar.test; sourceTree = "<group>"; };
+ F968885F0AF7880C000797B5 /* scrollbar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrollbar.test; sourceTree = "<group>"; };
+ F96888600AF7880C000797B5 /* treetags.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = treetags.test; sourceTree = "<group>"; };
+ F96888610AF7880C000797B5 /* treeview.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = treeview.test; sourceTree = "<group>"; };
+ F96888620AF7880C000797B5 /* ttk.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk.test; sourceTree = "<group>"; };
+ F96888630AF7880C000797B5 /* validate.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = validate.test; sourceTree = "<group>"; };
+ F968886B0AF788F6000797B5 /* ttk_button.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_button.n; sourceTree = "<group>"; };
+ F968886C0AF788F6000797B5 /* ttk_checkbutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_checkbutton.n; sourceTree = "<group>"; };
+ F968886D0AF788F6000797B5 /* ttk_combobox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_combobox.n; sourceTree = "<group>"; };
+ F968886F0AF788F6000797B5 /* ttk_entry.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_entry.n; sourceTree = "<group>"; };
+ F96888700AF788F6000797B5 /* ttk_frame.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_frame.n; sourceTree = "<group>"; };
+ F96888710AF788F6000797B5 /* ttk_Geometry.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_Geometry.3; sourceTree = "<group>"; };
+ F96888720AF788F6000797B5 /* ttk_image.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_image.n; sourceTree = "<group>"; };
+ F96888730AF788F6000797B5 /* ttk_intro.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_intro.n; sourceTree = "<group>"; };
+ F96888740AF788F6000797B5 /* ttk_label.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_label.n; sourceTree = "<group>"; };
+ F96888750AF788F6000797B5 /* ttk_labelframe.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_labelframe.n; sourceTree = "<group>"; };
+ F96888760AF788F6000797B5 /* ttk_menubutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_menubutton.n; sourceTree = "<group>"; };
+ F96888770AF788F6000797B5 /* ttk_notebook.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_notebook.n; sourceTree = "<group>"; };
+ F96888780AF788F6000797B5 /* ttk_panedwindow.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_panedwindow.n; sourceTree = "<group>"; };
+ F96888790AF788F6000797B5 /* ttk_progressbar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_progressbar.n; sourceTree = "<group>"; };
+ F968887A0AF788F6000797B5 /* ttk_radiobutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_radiobutton.n; sourceTree = "<group>"; };
+ F968887B0AF788F6000797B5 /* ttk_scrollbar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_scrollbar.n; sourceTree = "<group>"; };
+ F968887C0AF788F6000797B5 /* ttk_separator.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_separator.n; sourceTree = "<group>"; };
+ F968887D0AF788F6000797B5 /* ttk_sizegrip.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_sizegrip.n; sourceTree = "<group>"; };
+ F968887E0AF788F6000797B5 /* ttk_style.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_style.n; sourceTree = "<group>"; };
+ F968887F0AF788F6000797B5 /* ttk_Theme.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_Theme.3; sourceTree = "<group>"; };
+ F96888800AF788F6000797B5 /* ttk_treeview.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_treeview.n; sourceTree = "<group>"; };
+ F96888810AF788F6000797B5 /* ttk_widget.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_widget.n; sourceTree = "<group>"; };
+ F96888840AF78938000797B5 /* ttkMacOSXTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkMacOSXTheme.c; sourceTree = "<group>"; };
+ F96888860AF78953000797B5 /* ttkWinMonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinMonitor.c; sourceTree = "<group>"; };
+ F96888870AF78953000797B5 /* ttkWinTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinTheme.c; sourceTree = "<group>"; };
+ F96888880AF78953000797B5 /* ttkWinXPTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinXPTheme.c; sourceTree = "<group>"; };
+ F96D3DFA08F272A4004A47F5 /* ChangeLog */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = ChangeLog; sourceTree = "<group>"; };
+ F96D3DFB08F272A4004A47F5 /* changes */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = changes; sourceTree = "<group>"; };
+ F96D3DFD08F272A4004A47F5 /* Access.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Access.3; sourceTree = "<group>"; };
+ F96D3DFE08F272A4004A47F5 /* AddErrInfo.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AddErrInfo.3; sourceTree = "<group>"; };
+ F96D3DFF08F272A4004A47F5 /* after.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = after.n; sourceTree = "<group>"; };
+ F96D3E0008F272A4004A47F5 /* Alloc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Alloc.3; sourceTree = "<group>"; };
+ F96D3E0108F272A4004A47F5 /* AllowExc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AllowExc.3; sourceTree = "<group>"; };
+ F96D3E0208F272A4004A47F5 /* append.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = append.n; sourceTree = "<group>"; };
+ F96D3E0308F272A4004A47F5 /* AppInit.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AppInit.3; sourceTree = "<group>"; };
+ F96D3E0408F272A5004A47F5 /* array.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = array.n; sourceTree = "<group>"; };
+ F96D3E0508F272A5004A47F5 /* AssocData.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AssocData.3; sourceTree = "<group>"; };
+ F96D3E0608F272A5004A47F5 /* Async.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Async.3; sourceTree = "<group>"; };
+ F96D3E0708F272A5004A47F5 /* BackgdErr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = BackgdErr.3; sourceTree = "<group>"; };
+ F96D3E0808F272A5004A47F5 /* Backslash.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Backslash.3; sourceTree = "<group>"; };
+ F96D3E0908F272A5004A47F5 /* bgerror.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bgerror.n; sourceTree = "<group>"; };
+ F96D3E0A08F272A5004A47F5 /* binary.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = binary.n; sourceTree = "<group>"; };
+ F96D3E0B08F272A5004A47F5 /* BoolObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = BoolObj.3; sourceTree = "<group>"; };
+ F96D3E0C08F272A5004A47F5 /* break.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = break.n; sourceTree = "<group>"; };
+ F96D3E0D08F272A5004A47F5 /* ByteArrObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ByteArrObj.3; sourceTree = "<group>"; };
+ F96D3E0E08F272A5004A47F5 /* CallDel.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CallDel.3; sourceTree = "<group>"; };
+ F96D3E0F08F272A5004A47F5 /* case.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = case.n; sourceTree = "<group>"; };
+ F96D3E1008F272A5004A47F5 /* catch.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = catch.n; sourceTree = "<group>"; };
+ F96D3E1108F272A5004A47F5 /* cd.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = cd.n; sourceTree = "<group>"; };
+ F96D3E1208F272A5004A47F5 /* chan.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = chan.n; sourceTree = "<group>"; };
+ F96D3E1308F272A5004A47F5 /* ChnlStack.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ChnlStack.3; sourceTree = "<group>"; };
+ F96D3E1408F272A5004A47F5 /* clock.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = clock.n; sourceTree = "<group>"; };
+ F96D3E1508F272A5004A47F5 /* close.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = close.n; sourceTree = "<group>"; };
+ F96D3E1608F272A5004A47F5 /* CmdCmplt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CmdCmplt.3; sourceTree = "<group>"; };
+ F96D3E1708F272A5004A47F5 /* Concat.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Concat.3; sourceTree = "<group>"; };
+ F96D3E1808F272A5004A47F5 /* concat.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = concat.n; sourceTree = "<group>"; };
+ F96D3E1908F272A5004A47F5 /* continue.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = continue.n; sourceTree = "<group>"; };
+ F96D3E1A08F272A5004A47F5 /* CrtChannel.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtChannel.3; sourceTree = "<group>"; };
+ F96D3E1B08F272A5004A47F5 /* CrtChnlHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtChnlHdlr.3; sourceTree = "<group>"; };
+ F96D3E1C08F272A5004A47F5 /* CrtCloseHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtCloseHdlr.3; sourceTree = "<group>"; };
+ F96D3E1D08F272A5004A47F5 /* CrtCommand.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtCommand.3; sourceTree = "<group>"; };
+ F96D3E1E08F272A5004A47F5 /* CrtFileHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtFileHdlr.3; sourceTree = "<group>"; };
+ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
+ F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
+ F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
+ F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
+ F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
+ F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
+ F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
+ F96D3E2608F272A5004A47F5 /* DetachPids.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DetachPids.3; sourceTree = "<group>"; };
+ F96D3E2708F272A5004A47F5 /* dict.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dict.n; sourceTree = "<group>"; };
+ F96D3E2808F272A5004A47F5 /* DictObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DictObj.3; sourceTree = "<group>"; };
+ F96D3E2908F272A5004A47F5 /* DoOneEvent.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DoOneEvent.3; sourceTree = "<group>"; };
+ F96D3E2A08F272A5004A47F5 /* DoubleObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DoubleObj.3; sourceTree = "<group>"; };
+ F96D3E2B08F272A5004A47F5 /* DoWhenIdle.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DoWhenIdle.3; sourceTree = "<group>"; };
+ F96D3E2C08F272A5004A47F5 /* DString.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DString.3; sourceTree = "<group>"; };
+ F96D3E2D08F272A5004A47F5 /* DumpActiveMemory.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DumpActiveMemory.3; sourceTree = "<group>"; };
+ F96D3E2E08F272A5004A47F5 /* Encoding.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Encoding.3; sourceTree = "<group>"; };
+ F96D3E2F08F272A5004A47F5 /* encoding.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = encoding.n; sourceTree = "<group>"; };
+ F96D3E3008F272A5004A47F5 /* Ensemble.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Ensemble.3; sourceTree = "<group>"; };
+ F96D3E3108F272A5004A47F5 /* Environment.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Environment.3; sourceTree = "<group>"; };
+ F96D3E3208F272A5004A47F5 /* eof.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = eof.n; sourceTree = "<group>"; };
+ F96D3E3308F272A5004A47F5 /* error.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = error.n; sourceTree = "<group>"; };
+ F96D3E3408F272A5004A47F5 /* Eval.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Eval.3; sourceTree = "<group>"; };
+ F96D3E3508F272A5004A47F5 /* eval.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = eval.n; sourceTree = "<group>"; };
+ F96D3E3608F272A5004A47F5 /* exec.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = exec.n; sourceTree = "<group>"; };
+ F96D3E3708F272A5004A47F5 /* Exit.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Exit.3; sourceTree = "<group>"; };
+ F96D3E3808F272A5004A47F5 /* exit.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = exit.n; sourceTree = "<group>"; };
+ F96D3E3908F272A5004A47F5 /* expr.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = expr.n; sourceTree = "<group>"; };
+ F96D3E3A08F272A5004A47F5 /* ExprLong.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ExprLong.3; sourceTree = "<group>"; };
+ F96D3E3B08F272A5004A47F5 /* ExprLongObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ExprLongObj.3; sourceTree = "<group>"; };
+ F96D3E3C08F272A5004A47F5 /* fblocked.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fblocked.n; sourceTree = "<group>"; };
+ F96D3E3D08F272A5004A47F5 /* fconfigure.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fconfigure.n; sourceTree = "<group>"; };
+ F96D3E3E08F272A5004A47F5 /* fcopy.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fcopy.n; sourceTree = "<group>"; };
+ F96D3E3F08F272A5004A47F5 /* file.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = file.n; sourceTree = "<group>"; };
+ F96D3E4008F272A5004A47F5 /* fileevent.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fileevent.n; sourceTree = "<group>"; };
+ F96D3E4108F272A5004A47F5 /* filename.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = filename.n; sourceTree = "<group>"; };
+ F96D3E4208F272A5004A47F5 /* FileSystem.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FileSystem.3; sourceTree = "<group>"; };
+ F96D3E4308F272A5004A47F5 /* FindExec.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FindExec.3; sourceTree = "<group>"; };
+ F96D3E4408F272A5004A47F5 /* flush.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = flush.n; sourceTree = "<group>"; };
+ F96D3E4508F272A5004A47F5 /* for.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = for.n; sourceTree = "<group>"; };
+ F96D3E4608F272A5004A47F5 /* foreach.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = foreach.n; sourceTree = "<group>"; };
+ F96D3E4708F272A5004A47F5 /* format.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = format.n; sourceTree = "<group>"; };
+ F96D3E4808F272A5004A47F5 /* GetCwd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetCwd.3; sourceTree = "<group>"; };
+ F96D3E4908F272A5004A47F5 /* GetHostName.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetHostName.3; sourceTree = "<group>"; };
+ F96D3E4A08F272A5004A47F5 /* GetIndex.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetIndex.3; sourceTree = "<group>"; };
+ F96D3E4B08F272A5004A47F5 /* GetInt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetInt.3; sourceTree = "<group>"; };
+ F96D3E4C08F272A5004A47F5 /* GetOpnFl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetOpnFl.3; sourceTree = "<group>"; };
+ F96D3E4D08F272A5004A47F5 /* gets.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = gets.n; sourceTree = "<group>"; };
+ F96D3E4E08F272A5004A47F5 /* GetStdChan.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetStdChan.3; sourceTree = "<group>"; };
+ F96D3E4F08F272A5004A47F5 /* GetTime.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetTime.3; sourceTree = "<group>"; };
+ F96D3E5008F272A5004A47F5 /* GetVersion.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetVersion.3; sourceTree = "<group>"; };
+ F96D3E5108F272A5004A47F5 /* glob.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = glob.n; sourceTree = "<group>"; };
+ F96D3E5208F272A6004A47F5 /* global.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = global.n; sourceTree = "<group>"; };
+ F96D3E5308F272A6004A47F5 /* Hash.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Hash.3; sourceTree = "<group>"; };
+ F96D3E5408F272A6004A47F5 /* history.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = history.n; sourceTree = "<group>"; };
+ F96D3E5508F272A6004A47F5 /* http.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = http.n; sourceTree = "<group>"; };
+ F96D3E5608F272A6004A47F5 /* if.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = if.n; sourceTree = "<group>"; };
+ F96D3E5708F272A6004A47F5 /* incr.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = incr.n; sourceTree = "<group>"; };
+ F96D3E5808F272A6004A47F5 /* info.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = info.n; sourceTree = "<group>"; };
+ F96D3E5908F272A6004A47F5 /* Init.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Init.3; sourceTree = "<group>"; };
+ F96D3E5A08F272A6004A47F5 /* InitStubs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = InitStubs.3; sourceTree = "<group>"; };
+ F96D3E5B08F272A6004A47F5 /* Interp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Interp.3; sourceTree = "<group>"; };
+ F96D3E5C08F272A6004A47F5 /* interp.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = interp.n; sourceTree = "<group>"; };
+ F96D3E5D08F272A6004A47F5 /* IntObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = IntObj.3; sourceTree = "<group>"; };
+ F96D3E5E08F272A6004A47F5 /* join.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = join.n; sourceTree = "<group>"; };
+ F96D3E5F08F272A6004A47F5 /* lappend.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lappend.n; sourceTree = "<group>"; };
+ F96D3E6008F272A6004A47F5 /* lassign.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lassign.n; sourceTree = "<group>"; };
+ F96D3E6108F272A6004A47F5 /* library.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = library.n; sourceTree = "<group>"; };
+ F96D3E6208F272A6004A47F5 /* Limit.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Limit.3; sourceTree = "<group>"; };
+ F96D3E6308F272A6004A47F5 /* lindex.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lindex.n; sourceTree = "<group>"; };
+ F96D3E6408F272A6004A47F5 /* LinkVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = LinkVar.3; sourceTree = "<group>"; };
+ F96D3E6508F272A6004A47F5 /* linsert.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = linsert.n; sourceTree = "<group>"; };
+ F96D3E6608F272A6004A47F5 /* list.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = list.n; sourceTree = "<group>"; };
+ F96D3E6708F272A6004A47F5 /* ListObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ListObj.3; sourceTree = "<group>"; };
+ F96D3E6808F272A6004A47F5 /* llength.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = llength.n; sourceTree = "<group>"; };
+ F96D3E6908F272A6004A47F5 /* load.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = load.n; sourceTree = "<group>"; };
+ F96D3E6A08F272A6004A47F5 /* lrange.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lrange.n; sourceTree = "<group>"; };
+ F96D3E6B08F272A6004A47F5 /* lrepeat.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lrepeat.n; sourceTree = "<group>"; };
+ F96D3E6C08F272A6004A47F5 /* lreplace.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lreplace.n; sourceTree = "<group>"; };
+ F96D3E6D08F272A6004A47F5 /* lsearch.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lsearch.n; sourceTree = "<group>"; };
+ F96D3E6E08F272A6004A47F5 /* lset.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lset.n; sourceTree = "<group>"; };
+ F96D3E6F08F272A6004A47F5 /* lsort.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lsort.n; sourceTree = "<group>"; };
+ F96D3E7008F272A6004A47F5 /* man.macros */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = man.macros; sourceTree = "<group>"; };
+ F96D3E7108F272A6004A47F5 /* mathfunc.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = mathfunc.n; sourceTree = "<group>"; };
+ F96D3E7208F272A6004A47F5 /* memory.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = memory.n; sourceTree = "<group>"; };
+ F96D3E7308F272A6004A47F5 /* msgcat.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = msgcat.n; sourceTree = "<group>"; };
+ F96D3E7408F272A6004A47F5 /* Namespace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Namespace.3; sourceTree = "<group>"; };
+ F96D3E7508F272A6004A47F5 /* namespace.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = namespace.n; sourceTree = "<group>"; };
+ F96D3E7608F272A6004A47F5 /* Notifier.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Notifier.3; sourceTree = "<group>"; };
+ F96D3E7708F272A6004A47F5 /* Object.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Object.3; sourceTree = "<group>"; };
+ F96D3E7808F272A6004A47F5 /* ObjectType.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ObjectType.3; sourceTree = "<group>"; };
+ F96D3E7908F272A6004A47F5 /* open.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = open.n; sourceTree = "<group>"; };
+ F96D3E7A08F272A6004A47F5 /* OpenFileChnl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = OpenFileChnl.3; sourceTree = "<group>"; };
+ F96D3E7B08F272A6004A47F5 /* OpenTcp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = OpenTcp.3; sourceTree = "<group>"; };
+ F96D3E7C08F272A6004A47F5 /* package.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = package.n; sourceTree = "<group>"; };
+ F96D3E7D08F272A6004A47F5 /* packagens.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = packagens.n; sourceTree = "<group>"; };
+ F96D3E7E08F272A6004A47F5 /* Panic.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Panic.3; sourceTree = "<group>"; };
+ F96D3E7F08F272A6004A47F5 /* ParseCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ParseCmd.3; sourceTree = "<group>"; };
+ F96D3E8008F272A6004A47F5 /* pid.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pid.n; sourceTree = "<group>"; };
+ F96D3E8108F272A6004A47F5 /* pkgMkIndex.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pkgMkIndex.n; sourceTree = "<group>"; };
+ F96D3E8208F272A6004A47F5 /* PkgRequire.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = PkgRequire.3; sourceTree = "<group>"; };
+ F96D3E8308F272A6004A47F5 /* Preserve.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Preserve.3; sourceTree = "<group>"; };
+ F96D3E8408F272A6004A47F5 /* PrintDbl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = PrintDbl.3; sourceTree = "<group>"; };
+ F96D3E8508F272A6004A47F5 /* proc.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = proc.n; sourceTree = "<group>"; };
+ F96D3E8608F272A6004A47F5 /* puts.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = puts.n; sourceTree = "<group>"; };
+ F96D3E8708F272A6004A47F5 /* pwd.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pwd.n; sourceTree = "<group>"; };
+ F96D3E8808F272A6004A47F5 /* re_syntax.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = re_syntax.n; sourceTree = "<group>"; };
+ F96D3E8908F272A6004A47F5 /* read.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = read.n; sourceTree = "<group>"; };
+ F96D3E8A08F272A6004A47F5 /* RecEvalObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RecEvalObj.3; sourceTree = "<group>"; };
+ F96D3E8B08F272A6004A47F5 /* RecordEval.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RecordEval.3; sourceTree = "<group>"; };
+ F96D3E8C08F272A6004A47F5 /* RegConfig.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RegConfig.3; sourceTree = "<group>"; };
+ F96D3E8D08F272A6004A47F5 /* RegExp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RegExp.3; sourceTree = "<group>"; };
+ F96D3E8E08F272A6004A47F5 /* regexp.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = regexp.n; sourceTree = "<group>"; };
+ F96D3E8F08F272A6004A47F5 /* registry.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = registry.n; sourceTree = "<group>"; };
+ F96D3E9008F272A6004A47F5 /* regsub.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = regsub.n; sourceTree = "<group>"; };
+ F96D3E9108F272A6004A47F5 /* rename.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = rename.n; sourceTree = "<group>"; };
+ F96D3E9208F272A6004A47F5 /* return.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = return.n; sourceTree = "<group>"; };
+ F96D3E9308F272A6004A47F5 /* safe.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = safe.n; sourceTree = "<group>"; };
+ F96D3E9408F272A6004A47F5 /* SaveResult.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SaveResult.3; sourceTree = "<group>"; };
+ F96D3E9508F272A6004A47F5 /* scan.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = scan.n; sourceTree = "<group>"; };
+ F96D3E9608F272A6004A47F5 /* seek.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = seek.n; sourceTree = "<group>"; };
+ F96D3E9708F272A6004A47F5 /* set.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = set.n; sourceTree = "<group>"; };
+ F96D3E9808F272A6004A47F5 /* SetChanErr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetChanErr.3; sourceTree = "<group>"; };
+ F96D3E9908F272A6004A47F5 /* SetErrno.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetErrno.3; sourceTree = "<group>"; };
+ F96D3E9A08F272A6004A47F5 /* SetRecLmt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetRecLmt.3; sourceTree = "<group>"; };
+ F96D3E9B08F272A7004A47F5 /* SetResult.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetResult.3; sourceTree = "<group>"; };
+ F96D3E9C08F272A7004A47F5 /* SetVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetVar.3; sourceTree = "<group>"; };
+ F96D3E9D08F272A7004A47F5 /* Signal.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Signal.3; sourceTree = "<group>"; };
+ F96D3E9E08F272A7004A47F5 /* Sleep.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Sleep.3; sourceTree = "<group>"; };
+ F96D3E9F08F272A7004A47F5 /* socket.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = socket.n; sourceTree = "<group>"; };
+ F96D3EA008F272A7004A47F5 /* source.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = source.n; sourceTree = "<group>"; };
+ F96D3EA108F272A7004A47F5 /* SourceRCFile.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SourceRCFile.3; sourceTree = "<group>"; };
+ F96D3EA208F272A7004A47F5 /* split.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = split.n; sourceTree = "<group>"; };
+ F96D3EA308F272A7004A47F5 /* SplitList.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SplitList.3; sourceTree = "<group>"; };
+ F96D3EA408F272A7004A47F5 /* SplitPath.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SplitPath.3; sourceTree = "<group>"; };
+ F96D3EA508F272A7004A47F5 /* StaticPkg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StaticPkg.3; sourceTree = "<group>"; };
+ F96D3EA608F272A7004A47F5 /* StdChannels.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StdChannels.3; sourceTree = "<group>"; };
+ F96D3EA708F272A7004A47F5 /* string.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = string.n; sourceTree = "<group>"; };
+ F96D3EA808F272A7004A47F5 /* StringObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StringObj.3; sourceTree = "<group>"; };
+ F96D3EA908F272A7004A47F5 /* StrMatch.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StrMatch.3; sourceTree = "<group>"; };
+ F96D3EAA08F272A7004A47F5 /* subst.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = subst.n; sourceTree = "<group>"; };
+ F96D3EAB08F272A7004A47F5 /* SubstObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SubstObj.3; sourceTree = "<group>"; };
+ F96D3EAC08F272A7004A47F5 /* switch.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = switch.n; sourceTree = "<group>"; };
+ F96D3EAD08F272A7004A47F5 /* Tcl.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tcl.n; sourceTree = "<group>"; };
+ F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tcl_Main.3; sourceTree = "<group>"; };
+ F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TCL_MEM_DEBUG.3; sourceTree = "<group>"; };
+ F96D3EB008F272A7004A47F5 /* tclsh.1 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tclsh.1; sourceTree = "<group>"; };
+ F96D3EB108F272A7004A47F5 /* tcltest.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tcltest.n; sourceTree = "<group>"; };
+ F96D3EB208F272A7004A47F5 /* tclvars.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tclvars.n; sourceTree = "<group>"; };
+ F96D3EB308F272A7004A47F5 /* tell.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tell.n; sourceTree = "<group>"; };
+ F96D3EB408F272A7004A47F5 /* Thread.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Thread.3; sourceTree = "<group>"; };
+ F96D3EB508F272A7004A47F5 /* time.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = time.n; sourceTree = "<group>"; };
+ F96D3EB608F272A7004A47F5 /* tm.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tm.n; sourceTree = "<group>"; };
+ F96D3EB708F272A7004A47F5 /* ToUpper.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ToUpper.3; sourceTree = "<group>"; };
+ F96D3EB808F272A7004A47F5 /* trace.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = trace.n; sourceTree = "<group>"; };
+ F96D3EB908F272A7004A47F5 /* TraceCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TraceCmd.3; sourceTree = "<group>"; };
+ F96D3EBA08F272A7004A47F5 /* TraceVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TraceVar.3; sourceTree = "<group>"; };
+ F96D3EBB08F272A7004A47F5 /* Translate.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Translate.3; sourceTree = "<group>"; };
+ F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = UniCharIsAlpha.3; sourceTree = "<group>"; };
+ F96D3EBD08F272A7004A47F5 /* unknown.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = unknown.n; sourceTree = "<group>"; };
+ F96D3EBE08F272A7004A47F5 /* unload.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = unload.n; sourceTree = "<group>"; };
+ F96D3EBF08F272A7004A47F5 /* unset.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = unset.n; sourceTree = "<group>"; };
+ F96D3EC008F272A7004A47F5 /* update.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = update.n; sourceTree = "<group>"; };
+ F96D3EC108F272A7004A47F5 /* uplevel.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = uplevel.n; sourceTree = "<group>"; };
+ F96D3EC208F272A7004A47F5 /* UpVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = UpVar.3; sourceTree = "<group>"; };
+ F96D3EC308F272A7004A47F5 /* upvar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = upvar.n; sourceTree = "<group>"; };
+ F96D3EC408F272A7004A47F5 /* Utf.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Utf.3; sourceTree = "<group>"; };
+ F96D3EC508F272A7004A47F5 /* variable.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = variable.n; sourceTree = "<group>"; };
+ F96D3EC608F272A7004A47F5 /* vwait.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = vwait.n; sourceTree = "<group>"; };
+ F96D3EC708F272A7004A47F5 /* while.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = while.n; sourceTree = "<group>"; };
+ F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = WrongNumArgs.3; sourceTree = "<group>"; };
+ F96D3ECA08F272A7004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D3ECB08F272A7004A47F5 /* regc_color.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_color.c; sourceTree = "<group>"; };
+ F96D3ECC08F272A7004A47F5 /* regc_cvec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_cvec.c; sourceTree = "<group>"; };
+ F96D3ECD08F272A7004A47F5 /* regc_lex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_lex.c; sourceTree = "<group>"; };
+ F96D3ECE08F272A7004A47F5 /* regc_locale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_locale.c; sourceTree = "<group>"; };
+ F96D3ECF08F272A7004A47F5 /* regc_nfa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_nfa.c; sourceTree = "<group>"; };
+ F96D3ED008F272A7004A47F5 /* regcomp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regcomp.c; sourceTree = "<group>"; };
+ F96D3ED108F272A7004A47F5 /* regcustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regcustom.h; sourceTree = "<group>"; };
+ F96D3ED208F272A7004A47F5 /* rege_dfa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rege_dfa.c; sourceTree = "<group>"; };
+ F96D3ED308F272A7004A47F5 /* regerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regerror.c; sourceTree = "<group>"; };
+ F96D3ED408F272A7004A47F5 /* regerrs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regerrs.h; sourceTree = "<group>"; };
+ F96D3ED508F272A7004A47F5 /* regex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regex.h; sourceTree = "<group>"; };
+ F96D3ED608F272A7004A47F5 /* regexec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regexec.c; sourceTree = "<group>"; };
+ F96D3ED708F272A7004A47F5 /* regfree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regfree.c; sourceTree = "<group>"; };
+ F96D3ED808F272A7004A47F5 /* regfronts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regfronts.c; sourceTree = "<group>"; };
+ F96D3ED908F272A7004A47F5 /* regguts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regguts.h; sourceTree = "<group>"; };
+ F96D3EDA08F272A7004A47F5 /* tcl.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tcl.decls; sourceTree = "<group>"; };
+ F96D3EDB08F272A7004A47F5 /* tcl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tcl.h; sourceTree = "<group>"; };
+ F96D3EDC08F272A7004A47F5 /* tclAlloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAlloc.c; sourceTree = "<group>"; };
+ F96D3EDD08F272A7004A47F5 /* tclAsync.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAsync.c; sourceTree = "<group>"; };
+ F96D3EDE08F272A7004A47F5 /* tclBasic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclBasic.c; sourceTree = "<group>"; };
+ F96D3EDF08F272A7004A47F5 /* tclBinary.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclBinary.c; sourceTree = "<group>"; };
+ F96D3EE008F272A7004A47F5 /* tclCkalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCkalloc.c; sourceTree = "<group>"; };
+ F96D3EE108F272A7004A47F5 /* tclClock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclClock.c; sourceTree = "<group>"; };
+ F96D3EE208F272A7004A47F5 /* tclCmdAH.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCmdAH.c; sourceTree = "<group>"; };
+ F96D3EE308F272A7004A47F5 /* tclCmdIL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCmdIL.c; sourceTree = "<group>"; };
+ F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCmdMZ.c; sourceTree = "<group>"; };
+ F96D3EE508F272A7004A47F5 /* tclCompCmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCompCmds.c; sourceTree = "<group>"; };
+ F96D3EE608F272A7004A47F5 /* tclCompExpr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCompExpr.c; sourceTree = "<group>"; };
+ F96D3EE708F272A7004A47F5 /* tclCompile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCompile.c; sourceTree = "<group>"; };
+ F96D3EE808F272A7004A47F5 /* tclCompile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclCompile.h; sourceTree = "<group>"; };
+ F96D3EE908F272A7004A47F5 /* tclConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclConfig.c; sourceTree = "<group>"; };
+ F96D3EEA08F272A7004A47F5 /* tclDate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclDate.c; sourceTree = "<group>"; };
+ F96D3EEB08F272A7004A47F5 /* tclDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclDecls.h; sourceTree = "<group>"; };
+ F96D3EEC08F272A7004A47F5 /* tclDictObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclDictObj.c; sourceTree = "<group>"; };
+ F96D3EED08F272A7004A47F5 /* tclEncoding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclEncoding.c; sourceTree = "<group>"; };
+ F96D3EEE08F272A7004A47F5 /* tclEnv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclEnv.c; sourceTree = "<group>"; };
+ F96D3EEF08F272A7004A47F5 /* tclEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclEvent.c; sourceTree = "<group>"; };
+ F96D3EF008F272A7004A47F5 /* tclExecute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclExecute.c; sourceTree = "<group>"; };
+ F96D3EF108F272A7004A47F5 /* tclFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclFCmd.c; sourceTree = "<group>"; };
+ F96D3EF208F272A7004A47F5 /* tclFileName.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclFileName.c; sourceTree = "<group>"; };
+ F96D3EF308F272A7004A47F5 /* tclFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclFileSystem.h; sourceTree = "<group>"; };
+ F96D3EF408F272A7004A47F5 /* tclGet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclGet.c; sourceTree = "<group>"; };
+ F96D3EF508F272A7004A47F5 /* tclGetDate.y */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; path = tclGetDate.y; sourceTree = "<group>"; };
+ F96D3EF608F272A7004A47F5 /* tclHash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclHash.c; sourceTree = "<group>"; };
+ F96D3EF708F272A7004A47F5 /* tclHistory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclHistory.c; sourceTree = "<group>"; };
+ F96D3EF808F272A7004A47F5 /* tclIndexObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIndexObj.c; sourceTree = "<group>"; };
+ F96D3EF908F272A7004A47F5 /* tclInt.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclInt.decls; sourceTree = "<group>"; };
+ F96D3EFA08F272A7004A47F5 /* tclInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclInt.h; sourceTree = "<group>"; };
+ F96D3EFB08F272A7004A47F5 /* tclIntDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclIntDecls.h; sourceTree = "<group>"; };
+ F96D3EFC08F272A7004A47F5 /* tclInterp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclInterp.c; sourceTree = "<group>"; };
+ F96D3EFD08F272A7004A47F5 /* tclIntPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclIntPlatDecls.h; sourceTree = "<group>"; };
+ F96D3EFE08F272A7004A47F5 /* tclIO.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIO.c; sourceTree = "<group>"; };
+ F96D3EFF08F272A7004A47F5 /* tclIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclIO.h; sourceTree = "<group>"; };
+ F96D3F0008F272A7004A47F5 /* tclIOCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOCmd.c; sourceTree = "<group>"; };
+ F96D3F0108F272A7004A47F5 /* tclIOGT.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOGT.c; sourceTree = "<group>"; };
+ F96D3F0208F272A7004A47F5 /* tclIORChan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIORChan.c; sourceTree = "<group>"; };
+ F96D3F0308F272A7004A47F5 /* tclIOSock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOSock.c; sourceTree = "<group>"; };
+ F96D3F0408F272A7004A47F5 /* tclIOUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOUtil.c; sourceTree = "<group>"; };
+ F96D3F0508F272A7004A47F5 /* tclLink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLink.c; sourceTree = "<group>"; };
+ F96D3F0608F272A7004A47F5 /* tclListObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclListObj.c; sourceTree = "<group>"; };
+ F96D3F0708F272A7004A47F5 /* tclLiteral.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLiteral.c; sourceTree = "<group>"; };
+ F96D3F0808F272A7004A47F5 /* tclLoad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoad.c; sourceTree = "<group>"; };
+ F96D3F0908F272A7004A47F5 /* tclLoadNone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadNone.c; sourceTree = "<group>"; };
+ F96D3F0A08F272A7004A47F5 /* tclMain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMain.c; sourceTree = "<group>"; };
+ F96D3F0B08F272A7004A47F5 /* tclNamesp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclNamesp.c; sourceTree = "<group>"; };
+ F96D3F0C08F272A7004A47F5 /* tclNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclNotify.c; sourceTree = "<group>"; };
+ F96D3F0D08F272A7004A47F5 /* tclObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclObj.c; sourceTree = "<group>"; };
+ F96D3F0E08F272A7004A47F5 /* tclPanic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPanic.c; sourceTree = "<group>"; };
+ F96D3F0F08F272A7004A47F5 /* tclParse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclParse.c; sourceTree = "<group>"; };
+ F96D3F1108F272A7004A47F5 /* tclPathObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPathObj.c; sourceTree = "<group>"; };
+ F96D3F1208F272A7004A47F5 /* tclPipe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPipe.c; sourceTree = "<group>"; };
+ F96D3F1308F272A7004A47F5 /* tclPkg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPkg.c; sourceTree = "<group>"; };
+ F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPkgConfig.c; sourceTree = "<group>"; };
+ F96D3F1508F272A7004A47F5 /* tclPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclPlatDecls.h; sourceTree = "<group>"; };
+ F96D3F1608F272A7004A47F5 /* tclPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclPort.h; sourceTree = "<group>"; };
+ F96D3F1708F272A7004A47F5 /* tclPosixStr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPosixStr.c; sourceTree = "<group>"; };
+ F96D3F1808F272A7004A47F5 /* tclPreserve.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPreserve.c; sourceTree = "<group>"; };
+ F96D3F1908F272A7004A47F5 /* tclProc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclProc.c; sourceTree = "<group>"; };
+ F96D3F1A08F272A7004A47F5 /* tclRegexp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclRegexp.c; sourceTree = "<group>"; };
+ F96D3F1B08F272A7004A47F5 /* tclRegexp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclRegexp.h; sourceTree = "<group>"; };
+ F96D3F1C08F272A7004A47F5 /* tclResolve.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclResolve.c; sourceTree = "<group>"; };
+ F96D3F1D08F272A7004A47F5 /* tclResult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclResult.c; sourceTree = "<group>"; };
+ F96D3F1E08F272A7004A47F5 /* tclScan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclScan.c; sourceTree = "<group>"; };
+ F96D3F1F08F272A7004A47F5 /* tclStringObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStringObj.c; sourceTree = "<group>"; };
+ F96D3F2408F272A7004A47F5 /* tclStrToD.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStrToD.c; sourceTree = "<group>"; };
+ F96D3F2508F272A7004A47F5 /* tclStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubInit.c; sourceTree = "<group>"; };
+ F96D3F2608F272A7004A47F5 /* tclStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubLib.c; sourceTree = "<group>"; };
+ F96D3F2708F272A7004A47F5 /* tclTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTest.c; sourceTree = "<group>"; };
+ F96D3F2808F272A7004A47F5 /* tclTestObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestObj.c; sourceTree = "<group>"; };
+ F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestProcBodyObj.c; sourceTree = "<group>"; };
+ F96D3F2A08F272A7004A47F5 /* tclThread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThread.c; sourceTree = "<group>"; };
+ F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadAlloc.c; sourceTree = "<group>"; };
+ F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadJoin.c; sourceTree = "<group>"; };
+ F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadStorage.c; sourceTree = "<group>"; };
+ F96D3F2E08F272A7004A47F5 /* tclThreadTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadTest.c; sourceTree = "<group>"; };
+ F96D3F2F08F272A7004A47F5 /* tclTimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTimer.c; sourceTree = "<group>"; };
+ F96D3F3008F272A7004A47F5 /* tclTomMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMath.h; sourceTree = "<group>"; };
+ F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTomMathInterface.c; sourceTree = "<group>"; };
+ F96D3F3208F272A7004A47F5 /* tclTrace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTrace.c; sourceTree = "<group>"; };
+ F96D3F3308F272A7004A47F5 /* tclUniData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUniData.c; sourceTree = "<group>"; };
+ F96D3F3408F272A7004A47F5 /* tclUtf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUtf.c; sourceTree = "<group>"; };
+ F96D3F3508F272A7004A47F5 /* tclUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUtil.c; sourceTree = "<group>"; };
+ F96D3F3608F272A7004A47F5 /* tclVar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclVar.c; sourceTree = "<group>"; };
+ F96D3F3708F272A7004A47F5 /* tommath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath.h; sourceTree = "<group>"; };
+ F96D3F3908F272A8004A47F5 /* auto.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = auto.tcl; sourceTree = "<group>"; };
+ F96D3F3A08F272A8004A47F5 /* clock.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clock.tcl; sourceTree = "<group>"; };
+ F96D3F3C08F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D3F8C08F272A8004A47F5 /* history.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = history.tcl; sourceTree = "<group>"; };
+ F96D3F8E08F272A8004A47F5 /* http.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = http.tcl; sourceTree = "<group>"; };
+ F96D3F8F08F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D3F9108F272A8004A47F5 /* http.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = http.tcl; sourceTree = "<group>"; };
+ F96D3F9208F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D3F9308F272A8004A47F5 /* init.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = init.tcl; sourceTree = "<group>"; };
+ F96D3F9508F272A8004A47F5 /* msgcat.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgcat.tcl; sourceTree = "<group>"; };
+ F96D3F9608F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D401808F272AA004A47F5 /* optparse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optparse.tcl; sourceTree = "<group>"; };
+ F96D401908F272AA004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D401A08F272AA004A47F5 /* package.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = package.tcl; sourceTree = "<group>"; };
+ F96D401B08F272AA004A47F5 /* parray.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parray.tcl; sourceTree = "<group>"; };
+ F96D401D08F272AA004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D401E08F272AA004A47F5 /* safe.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safe.tcl; sourceTree = "<group>"; };
+ F96D401F08F272AA004A47F5 /* tclIndex */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclIndex; sourceTree = "<group>"; };
+ F96D402108F272AA004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D402208F272AA004A47F5 /* tcltest.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tcltest.tcl; sourceTree = "<group>"; };
+ F96D402308F272AA004A47F5 /* tm.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tm.tcl; sourceTree = "<group>"; };
+ F96D425B08F272B2004A47F5 /* word.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = word.tcl; sourceTree = "<group>"; };
+ F96D425F08F272B3004A47F5 /* bn.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = bn.pdf; sourceTree = "<group>"; };
+ F96D426108F272B3004A47F5 /* bn_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_error.c; sourceTree = "<group>"; };
+ F96D426208F272B3004A47F5 /* bn_fast_mp_invmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_mp_invmod.c; sourceTree = "<group>"; };
+ F96D426308F272B3004A47F5 /* bn_fast_mp_montgomery_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_mp_montgomery_reduce.c; sourceTree = "<group>"; };
+ F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_s_mp_mul_digs.c; sourceTree = "<group>"; };
+ F96D426508F272B3004A47F5 /* bn_fast_s_mp_mul_high_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_s_mp_mul_high_digs.c; sourceTree = "<group>"; };
+ F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_s_mp_sqr.c; sourceTree = "<group>"; };
+ F96D426708F272B3004A47F5 /* bn_mp_2expt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_2expt.c; sourceTree = "<group>"; };
+ F96D426808F272B3004A47F5 /* bn_mp_abs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_abs.c; sourceTree = "<group>"; };
+ F96D426908F272B3004A47F5 /* bn_mp_add.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_add.c; sourceTree = "<group>"; };
+ F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_add_d.c; sourceTree = "<group>"; };
+ F96D426B08F272B3004A47F5 /* bn_mp_addmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_addmod.c; sourceTree = "<group>"; };
+ F96D426C08F272B3004A47F5 /* bn_mp_and.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_and.c; sourceTree = "<group>"; };
+ F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_clamp.c; sourceTree = "<group>"; };
+ F96D426E08F272B3004A47F5 /* bn_mp_clear.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_clear.c; sourceTree = "<group>"; };
+ F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_clear_multi.c; sourceTree = "<group>"; };
+ F96D427008F272B3004A47F5 /* bn_mp_cmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cmp.c; sourceTree = "<group>"; };
+ F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cmp_d.c; sourceTree = "<group>"; };
+ F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cmp_mag.c; sourceTree = "<group>"; };
+ F96D427308F272B3004A47F5 /* bn_mp_cnt_lsb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cnt_lsb.c; sourceTree = "<group>"; };
+ F96D427408F272B3004A47F5 /* bn_mp_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_copy.c; sourceTree = "<group>"; };
+ F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_count_bits.c; sourceTree = "<group>"; };
+ F96D427608F272B3004A47F5 /* bn_mp_div.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div.c; sourceTree = "<group>"; };
+ F96D427708F272B3004A47F5 /* bn_mp_div_2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2.c; sourceTree = "<group>"; };
+ F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2d.c; sourceTree = "<group>"; };
+ F96D427908F272B3004A47F5 /* bn_mp_div_3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_3.c; sourceTree = "<group>"; };
+ F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_d.c; sourceTree = "<group>"; };
+ F96D427B08F272B3004A47F5 /* bn_mp_dr_is_modulus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_dr_is_modulus.c; sourceTree = "<group>"; };
+ F96D427C08F272B3004A47F5 /* bn_mp_dr_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_dr_reduce.c; sourceTree = "<group>"; };
+ F96D427D08F272B3004A47F5 /* bn_mp_dr_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_dr_setup.c; sourceTree = "<group>"; };
+ F96D427E08F272B3004A47F5 /* bn_mp_exch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exch.c; sourceTree = "<group>"; };
+ F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_expt_d.c; sourceTree = "<group>"; };
+ F96D428008F272B3004A47F5 /* bn_mp_exptmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exptmod.c; sourceTree = "<group>"; };
+ F96D428108F272B3004A47F5 /* bn_mp_exptmod_fast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exptmod_fast.c; sourceTree = "<group>"; };
+ F96D428208F272B3004A47F5 /* bn_mp_exteuclid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exteuclid.c; sourceTree = "<group>"; };
+ F96D428308F272B3004A47F5 /* bn_mp_fread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_fread.c; sourceTree = "<group>"; };
+ F96D428408F272B3004A47F5 /* bn_mp_fwrite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_fwrite.c; sourceTree = "<group>"; };
+ F96D428508F272B3004A47F5 /* bn_mp_gcd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_gcd.c; sourceTree = "<group>"; };
+ F96D428608F272B3004A47F5 /* bn_mp_get_int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_get_int.c; sourceTree = "<group>"; };
+ F96D428708F272B3004A47F5 /* bn_mp_grow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_grow.c; sourceTree = "<group>"; };
+ F96D428808F272B3004A47F5 /* bn_mp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init.c; sourceTree = "<group>"; };
+ F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_copy.c; sourceTree = "<group>"; };
+ F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_multi.c; sourceTree = "<group>"; };
+ F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_set.c; sourceTree = "<group>"; };
+ F96D428C08F272B3004A47F5 /* bn_mp_init_set_int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_set_int.c; sourceTree = "<group>"; };
+ F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_size.c; sourceTree = "<group>"; };
+ F96D428E08F272B3004A47F5 /* bn_mp_invmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_invmod.c; sourceTree = "<group>"; };
+ F96D428F08F272B3004A47F5 /* bn_mp_invmod_slow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_invmod_slow.c; sourceTree = "<group>"; };
+ F96D429008F272B3004A47F5 /* bn_mp_is_square.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_is_square.c; sourceTree = "<group>"; };
+ F96D429108F272B3004A47F5 /* bn_mp_jacobi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_jacobi.c; sourceTree = "<group>"; };
+ F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_karatsuba_mul.c; sourceTree = "<group>"; };
+ F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_karatsuba_sqr.c; sourceTree = "<group>"; };
+ F96D429408F272B3004A47F5 /* bn_mp_lcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_lcm.c; sourceTree = "<group>"; };
+ F96D429508F272B3004A47F5 /* bn_mp_lshd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_lshd.c; sourceTree = "<group>"; };
+ F96D429608F272B3004A47F5 /* bn_mp_mod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mod.c; sourceTree = "<group>"; };
+ F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mod_2d.c; sourceTree = "<group>"; };
+ F96D429808F272B3004A47F5 /* bn_mp_mod_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mod_d.c; sourceTree = "<group>"; };
+ F96D429908F272B3004A47F5 /* bn_mp_montgomery_calc_normalization.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_montgomery_calc_normalization.c; sourceTree = "<group>"; };
+ F96D429A08F272B3004A47F5 /* bn_mp_montgomery_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_montgomery_reduce.c; sourceTree = "<group>"; };
+ F96D429B08F272B3004A47F5 /* bn_mp_montgomery_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_montgomery_setup.c; sourceTree = "<group>"; };
+ F96D429C08F272B3004A47F5 /* bn_mp_mul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul.c; sourceTree = "<group>"; };
+ F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul_2.c; sourceTree = "<group>"; };
+ F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul_2d.c; sourceTree = "<group>"; };
+ F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul_d.c; sourceTree = "<group>"; };
+ F96D42A008F272B3004A47F5 /* bn_mp_mulmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mulmod.c; sourceTree = "<group>"; };
+ F96D42A108F272B3004A47F5 /* bn_mp_n_root.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_n_root.c; sourceTree = "<group>"; };
+ F96D42A208F272B3004A47F5 /* bn_mp_neg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_neg.c; sourceTree = "<group>"; };
+ F96D42A308F272B3004A47F5 /* bn_mp_or.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_or.c; sourceTree = "<group>"; };
+ F96D42A408F272B3004A47F5 /* bn_mp_prime_fermat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_fermat.c; sourceTree = "<group>"; };
+ F96D42A508F272B3004A47F5 /* bn_mp_prime_is_divisible.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_is_divisible.c; sourceTree = "<group>"; };
+ F96D42A608F272B3004A47F5 /* bn_mp_prime_is_prime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_is_prime.c; sourceTree = "<group>"; };
+ F96D42A708F272B3004A47F5 /* bn_mp_prime_miller_rabin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_miller_rabin.c; sourceTree = "<group>"; };
+ F96D42A808F272B3004A47F5 /* bn_mp_prime_next_prime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_next_prime.c; sourceTree = "<group>"; };
+ F96D42A908F272B3004A47F5 /* bn_mp_prime_rabin_miller_trials.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_rabin_miller_trials.c; sourceTree = "<group>"; };
+ F96D42AA08F272B3004A47F5 /* bn_mp_prime_random_ex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_random_ex.c; sourceTree = "<group>"; };
+ F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_radix_size.c; sourceTree = "<group>"; };
+ F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_radix_smap.c; sourceTree = "<group>"; };
+ F96D42AD08F272B3004A47F5 /* bn_mp_rand.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_rand.c; sourceTree = "<group>"; };
+ F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_read_radix.c; sourceTree = "<group>"; };
+ F96D42AF08F272B3004A47F5 /* bn_mp_read_signed_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_read_signed_bin.c; sourceTree = "<group>"; };
+ F96D42B008F272B3004A47F5 /* bn_mp_read_unsigned_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_read_unsigned_bin.c; sourceTree = "<group>"; };
+ F96D42B108F272B3004A47F5 /* bn_mp_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce.c; sourceTree = "<group>"; };
+ F96D42B208F272B3004A47F5 /* bn_mp_reduce_2k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k.c; sourceTree = "<group>"; };
+ F96D42B308F272B3004A47F5 /* bn_mp_reduce_2k_l.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k_l.c; sourceTree = "<group>"; };
+ F96D42B408F272B3004A47F5 /* bn_mp_reduce_2k_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k_setup.c; sourceTree = "<group>"; };
+ F96D42B508F272B3004A47F5 /* bn_mp_reduce_2k_setup_l.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k_setup_l.c; sourceTree = "<group>"; };
+ F96D42B608F272B3004A47F5 /* bn_mp_reduce_is_2k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_is_2k.c; sourceTree = "<group>"; };
+ F96D42B708F272B3004A47F5 /* bn_mp_reduce_is_2k_l.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_is_2k_l.c; sourceTree = "<group>"; };
+ F96D42B808F272B3004A47F5 /* bn_mp_reduce_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_setup.c; sourceTree = "<group>"; };
+ F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_rshd.c; sourceTree = "<group>"; };
+ F96D42BA08F272B3004A47F5 /* bn_mp_set.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_set.c; sourceTree = "<group>"; };
+ F96D42BB08F272B3004A47F5 /* bn_mp_set_int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_set_int.c; sourceTree = "<group>"; };
+ F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_shrink.c; sourceTree = "<group>"; };
+ F96D42BD08F272B3004A47F5 /* bn_mp_signed_bin_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_signed_bin_size.c; sourceTree = "<group>"; };
+ F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sqr.c; sourceTree = "<group>"; };
+ F96D42BF08F272B3004A47F5 /* bn_mp_sqrmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sqrmod.c; sourceTree = "<group>"; };
+ F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sqrt.c; sourceTree = "<group>"; };
+ F96D42C108F272B3004A47F5 /* bn_mp_sub.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sub.c; sourceTree = "<group>"; };
+ F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sub_d.c; sourceTree = "<group>"; };
+ F96D42C308F272B3004A47F5 /* bn_mp_submod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_submod.c; sourceTree = "<group>"; };
+ F96D42C408F272B3004A47F5 /* bn_mp_to_signed_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_signed_bin.c; sourceTree = "<group>"; };
+ F96D42C508F272B3004A47F5 /* bn_mp_to_signed_bin_n.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_signed_bin_n.c; sourceTree = "<group>"; };
+ F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_unsigned_bin.c; sourceTree = "<group>"; };
+ F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_unsigned_bin_n.c; sourceTree = "<group>"; };
+ F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toom_mul.c; sourceTree = "<group>"; };
+ F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toom_sqr.c; sourceTree = "<group>"; };
+ F96D42CA08F272B3004A47F5 /* bn_mp_toradix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toradix.c; sourceTree = "<group>"; };
+ F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toradix_n.c; sourceTree = "<group>"; };
+ F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_unsigned_bin_size.c; sourceTree = "<group>"; };
+ F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_xor.c; sourceTree = "<group>"; };
+ F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_zero.c; sourceTree = "<group>"; };
+ F96D42CF08F272B3004A47F5 /* bn_prime_tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_prime_tab.c; sourceTree = "<group>"; };
+ F96D42D008F272B3004A47F5 /* bn_reverse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_reverse.c; sourceTree = "<group>"; };
+ F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_add.c; sourceTree = "<group>"; };
+ F96D42D208F272B3004A47F5 /* bn_s_mp_exptmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_exptmod.c; sourceTree = "<group>"; };
+ F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_mul_digs.c; sourceTree = "<group>"; };
+ F96D42D408F272B3004A47F5 /* bn_s_mp_mul_high_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_mul_high_digs.c; sourceTree = "<group>"; };
+ F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_sqr.c; sourceTree = "<group>"; };
+ F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_sub.c; sourceTree = "<group>"; };
+ F96D42D708F272B3004A47F5 /* bncore.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bncore.c; sourceTree = "<group>"; };
+ F96D42D908F272B3004A47F5 /* callgraph.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = callgraph.txt; sourceTree = "<group>"; };
+ F96D42DA08F272B3004A47F5 /* changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = changes.txt; sourceTree = "<group>"; };
+ F96D42F008F272B3004A47F5 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
+ F96D431D08F272B4004A47F5 /* poster.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = poster.pdf; sourceTree = "<group>"; };
+ F96D432608F272B4004A47F5 /* tommath.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = tommath.pdf; sourceTree = "<group>"; };
+ F96D432908F272B4004A47F5 /* tommath_class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath_class.h; sourceTree = "<group>"; };
+ F96D432A08F272B4004A47F5 /* tommath_superclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath_superclass.h; sourceTree = "<group>"; };
+ F96D432B08F272B4004A47F5 /* license.terms */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = license.terms; sourceTree = "<group>"; };
+ F96D432E08F272B5004A47F5 /* configure.ac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure.ac; sourceTree = "<group>"; };
+ F96D432F08F272B5004A47F5 /* GNUmakefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = GNUmakefile; sourceTree = "<group>"; };
+ F96D433108F272B5004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D433208F272B5004A47F5 /* Tcl-Info.plist.in */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = "Tcl-Info.plist.in"; sourceTree = "<group>"; };
+ F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMacOSXBundle.c; sourceTree = "<group>"; };
+ F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMacOSXFCmd.c; sourceTree = "<group>"; };
+ F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMacOSXNotify.c; sourceTree = "<group>"; };
+ F96D434308F272B5004A47F5 /* README */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = README; sourceTree = "<group>"; };
+ F96D434508F272B5004A47F5 /* all.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = all.tcl; sourceTree = "<group>"; };
+ F96D434608F272B5004A47F5 /* append.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = append.test; sourceTree = "<group>"; };
+ F96D434708F272B5004A47F5 /* appendComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = appendComp.test; sourceTree = "<group>"; };
+ F96D434808F272B5004A47F5 /* assocd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = assocd.test; sourceTree = "<group>"; };
+ F96D434908F272B5004A47F5 /* async.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = async.test; sourceTree = "<group>"; };
+ F96D434A08F272B5004A47F5 /* autoMkindex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = autoMkindex.test; sourceTree = "<group>"; };
+ F96D434B08F272B5004A47F5 /* basic.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = basic.test; sourceTree = "<group>"; };
+ F96D434C08F272B5004A47F5 /* binary.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = binary.test; sourceTree = "<group>"; };
+ F96D434D08F272B5004A47F5 /* case.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = case.test; sourceTree = "<group>"; };
+ F96D434E08F272B5004A47F5 /* chan.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chan.test; sourceTree = "<group>"; };
+ F96D434F08F272B5004A47F5 /* clock.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clock.test; sourceTree = "<group>"; };
+ F96D435008F272B5004A47F5 /* cmdAH.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdAH.test; sourceTree = "<group>"; };
+ F96D435108F272B5004A47F5 /* cmdIL.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdIL.test; sourceTree = "<group>"; };
+ F96D435208F272B5004A47F5 /* cmdInfo.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdInfo.test; sourceTree = "<group>"; };
+ F96D435308F272B5004A47F5 /* cmdMZ.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdMZ.test; sourceTree = "<group>"; };
+ F96D435408F272B5004A47F5 /* compExpr-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "compExpr-old.test"; sourceTree = "<group>"; };
+ F96D435508F272B5004A47F5 /* compExpr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = compExpr.test; sourceTree = "<group>"; };
+ F96D435608F272B5004A47F5 /* compile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = compile.test; sourceTree = "<group>"; };
+ F96D435708F272B5004A47F5 /* concat.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = concat.test; sourceTree = "<group>"; };
+ F96D435808F272B5004A47F5 /* config.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = config.test; sourceTree = "<group>"; };
+ F96D435908F272B5004A47F5 /* dcall.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dcall.test; sourceTree = "<group>"; };
+ F96D435A08F272B5004A47F5 /* dict.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dict.test; sourceTree = "<group>"; };
+ F96D435C08F272B5004A47F5 /* dstring.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dstring.test; sourceTree = "<group>"; };
+ F96D435E08F272B5004A47F5 /* encoding.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = encoding.test; sourceTree = "<group>"; };
+ F96D435F08F272B5004A47F5 /* env.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = env.test; sourceTree = "<group>"; };
+ F96D436008F272B5004A47F5 /* error.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = error.test; sourceTree = "<group>"; };
+ F96D436108F272B5004A47F5 /* eval.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eval.test; sourceTree = "<group>"; };
+ F96D436208F272B5004A47F5 /* event.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = event.test; sourceTree = "<group>"; };
+ F96D436308F272B5004A47F5 /* exec.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = exec.test; sourceTree = "<group>"; };
+ F96D436408F272B5004A47F5 /* execute.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = execute.test; sourceTree = "<group>"; };
+ F96D436508F272B5004A47F5 /* expr-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "expr-old.test"; sourceTree = "<group>"; };
+ F96D436608F272B5004A47F5 /* expr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = expr.test; sourceTree = "<group>"; };
+ F96D436708F272B6004A47F5 /* fCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fCmd.test; sourceTree = "<group>"; };
+ F96D436808F272B6004A47F5 /* fileName.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fileName.test; sourceTree = "<group>"; };
+ F96D436908F272B6004A47F5 /* fileSystem.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fileSystem.test; sourceTree = "<group>"; };
+ F96D436A08F272B6004A47F5 /* for-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "for-old.test"; sourceTree = "<group>"; };
+ F96D436B08F272B6004A47F5 /* for.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = for.test; sourceTree = "<group>"; };
+ F96D436C08F272B6004A47F5 /* foreach.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = foreach.test; sourceTree = "<group>"; };
+ F96D436D08F272B6004A47F5 /* format.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = format.test; sourceTree = "<group>"; };
+ F96D436E08F272B6004A47F5 /* get.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = get.test; sourceTree = "<group>"; };
+ F96D436F08F272B6004A47F5 /* history.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = history.test; sourceTree = "<group>"; };
+ F96D437008F272B6004A47F5 /* http.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = http.test; sourceTree = "<group>"; };
+ F96D437108F272B6004A47F5 /* httpd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = httpd; sourceTree = "<group>"; };
+ F96D437208F272B6004A47F5 /* httpold.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = httpold.test; sourceTree = "<group>"; };
+ F96D437308F272B6004A47F5 /* if-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "if-old.test"; sourceTree = "<group>"; };
+ F96D437408F272B6004A47F5 /* if.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = if.test; sourceTree = "<group>"; };
+ F96D437508F272B6004A47F5 /* incr-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "incr-old.test"; sourceTree = "<group>"; };
+ F96D437608F272B6004A47F5 /* incr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = incr.test; sourceTree = "<group>"; };
+ F96D437708F272B6004A47F5 /* indexObj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = indexObj.test; sourceTree = "<group>"; };
+ F96D437808F272B6004A47F5 /* info.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = info.test; sourceTree = "<group>"; };
+ F96D437908F272B6004A47F5 /* init.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = init.test; sourceTree = "<group>"; };
+ F96D437A08F272B6004A47F5 /* interp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = interp.test; sourceTree = "<group>"; };
+ F96D437B08F272B6004A47F5 /* io.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = io.test; sourceTree = "<group>"; };
+ F96D437C08F272B6004A47F5 /* ioCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioCmd.test; sourceTree = "<group>"; };
+ F96D437D08F272B6004A47F5 /* iogt.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = iogt.test; sourceTree = "<group>"; };
+ F96D437E08F272B6004A47F5 /* ioUtil.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioUtil.test; sourceTree = "<group>"; };
+ F96D437F08F272B6004A47F5 /* join.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = join.test; sourceTree = "<group>"; };
+ F96D438008F272B6004A47F5 /* lindex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lindex.test; sourceTree = "<group>"; };
+ F96D438108F272B6004A47F5 /* link.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = link.test; sourceTree = "<group>"; };
+ F96D438208F272B6004A47F5 /* linsert.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = linsert.test; sourceTree = "<group>"; };
+ F96D438308F272B6004A47F5 /* list.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = list.test; sourceTree = "<group>"; };
+ F96D438408F272B6004A47F5 /* listObj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listObj.test; sourceTree = "<group>"; };
+ F96D438508F272B6004A47F5 /* llength.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = llength.test; sourceTree = "<group>"; };
+ F96D438608F272B6004A47F5 /* load.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = load.test; sourceTree = "<group>"; };
+ F96D438708F272B6004A47F5 /* lrange.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lrange.test; sourceTree = "<group>"; };
+ F96D438808F272B6004A47F5 /* lrepeat.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lrepeat.test; sourceTree = "<group>"; };
+ F96D438908F272B6004A47F5 /* lreplace.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lreplace.test; sourceTree = "<group>"; };
+ F96D438A08F272B6004A47F5 /* lsearch.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lsearch.test; sourceTree = "<group>"; };
+ F96D438B08F272B6004A47F5 /* lset.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lset.test; sourceTree = "<group>"; };
+ F96D438C08F272B6004A47F5 /* lsetComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lsetComp.test; sourceTree = "<group>"; };
+ F96D438D08F272B6004A47F5 /* macOSXFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXFCmd.test; sourceTree = "<group>"; };
+ F96D438E08F272B6004A47F5 /* main.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = main.test; sourceTree = "<group>"; };
+ F96D438F08F272B6004A47F5 /* misc.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = misc.test; sourceTree = "<group>"; };
+ F96D439008F272B6004A47F5 /* msgcat.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgcat.test; sourceTree = "<group>"; };
+ F96D439108F272B6004A47F5 /* namespace-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "namespace-old.test"; sourceTree = "<group>"; };
+ F96D439208F272B7004A47F5 /* namespace.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = namespace.test; sourceTree = "<group>"; };
+ F96D439308F272B7004A47F5 /* notify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notify.test; sourceTree = "<group>"; };
+ F96D439408F272B7004A47F5 /* obj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obj.test; sourceTree = "<group>"; };
+ F96D439508F272B7004A47F5 /* opt.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = opt.test; sourceTree = "<group>"; };
+ F96D439608F272B7004A47F5 /* package.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = package.test; sourceTree = "<group>"; };
+ F96D439708F272B7004A47F5 /* parse.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parse.test; sourceTree = "<group>"; };
+ F96D439808F272B7004A47F5 /* parseExpr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parseExpr.test; sourceTree = "<group>"; };
+ F96D439908F272B7004A47F5 /* parseOld.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parseOld.test; sourceTree = "<group>"; };
+ F96D439A08F272B7004A47F5 /* pid.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pid.test; sourceTree = "<group>"; };
+ F96D439B08F272B7004A47F5 /* pkg.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkg.test; sourceTree = "<group>"; };
+ F96D439C08F272B7004A47F5 /* pkgMkIndex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgMkIndex.test; sourceTree = "<group>"; };
+ F96D439D08F272B7004A47F5 /* platform.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.test; sourceTree = "<group>"; };
+ F96D439E08F272B7004A47F5 /* proc-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "proc-old.test"; sourceTree = "<group>"; };
+ F96D439F08F272B7004A47F5 /* proc.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = proc.test; sourceTree = "<group>"; };
+ F96D43A008F272B7004A47F5 /* pwd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pwd.test; sourceTree = "<group>"; };
+ F96D43A108F272B7004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D43A208F272B7004A47F5 /* reg.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = reg.test; sourceTree = "<group>"; };
+ F96D43A308F272B7004A47F5 /* regexp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = regexp.test; sourceTree = "<group>"; };
+ F96D43A408F272B7004A47F5 /* regexpComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = regexpComp.test; sourceTree = "<group>"; };
+ F96D43A508F272B7004A47F5 /* registry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = registry.test; sourceTree = "<group>"; };
+ F96D43A608F272B7004A47F5 /* remote.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = remote.tcl; sourceTree = "<group>"; };
+ F96D43A708F272B7004A47F5 /* rename.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = rename.test; sourceTree = "<group>"; };
+ F96D43A808F272B7004A47F5 /* result.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = result.test; sourceTree = "<group>"; };
+ F96D43A908F272B7004A47F5 /* safe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safe.test; sourceTree = "<group>"; };
+ F96D43AA08F272B7004A47F5 /* scan.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scan.test; sourceTree = "<group>"; };
+ F96D43AB08F272B7004A47F5 /* security.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = security.test; sourceTree = "<group>"; };
+ F96D43AC08F272B7004A47F5 /* set-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "set-old.test"; sourceTree = "<group>"; };
+ F96D43AD08F272B7004A47F5 /* set.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = set.test; sourceTree = "<group>"; };
+ F96D43AE08F272B7004A47F5 /* socket.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = socket.test; sourceTree = "<group>"; };
+ F96D43AF08F272B7004A47F5 /* source.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = source.test; sourceTree = "<group>"; };
+ F96D43B008F272B7004A47F5 /* split.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = split.test; sourceTree = "<group>"; };
+ F96D43B108F272B7004A47F5 /* stack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = stack.test; sourceTree = "<group>"; };
+ F96D43B208F272B7004A47F5 /* string.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = string.test; sourceTree = "<group>"; };
+ F96D43B308F272B7004A47F5 /* stringComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = stringComp.test; sourceTree = "<group>"; };
+ F96D43B408F272B7004A47F5 /* stringObj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = stringObj.test; sourceTree = "<group>"; };
+ F96D43B508F272B7004A47F5 /* subst.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = subst.test; sourceTree = "<group>"; };
+ F96D43B608F272B7004A47F5 /* switch.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = switch.test; sourceTree = "<group>"; };
+ F96D43B708F272B7004A47F5 /* tcltest.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tcltest.test; sourceTree = "<group>"; };
+ F96D43B808F272B7004A47F5 /* thread.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = thread.test; sourceTree = "<group>"; };
+ F96D43B908F272B7004A47F5 /* timer.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = timer.test; sourceTree = "<group>"; };
+ F96D43BA08F272B7004A47F5 /* tm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tm.test; sourceTree = "<group>"; };
+ F96D43BB08F272B7004A47F5 /* trace.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = trace.test; sourceTree = "<group>"; };
+ F96D43BC08F272B7004A47F5 /* unixFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixFCmd.test; sourceTree = "<group>"; };
+ F96D43BD08F272B7004A47F5 /* unixFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixFile.test; sourceTree = "<group>"; };
+ F96D43BE08F272B7004A47F5 /* unixInit.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixInit.test; sourceTree = "<group>"; };
+ F96D43BF08F272B7004A47F5 /* unixNotfy.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixNotfy.test; sourceTree = "<group>"; };
+ F96D43C008F272B7004A47F5 /* unknown.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unknown.test; sourceTree = "<group>"; };
+ F96D43C108F272B7004A47F5 /* unload.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unload.test; sourceTree = "<group>"; };
+ F96D43C208F272B7004A47F5 /* uplevel.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uplevel.test; sourceTree = "<group>"; };
+ F96D43C308F272B7004A47F5 /* upvar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = upvar.test; sourceTree = "<group>"; };
+ F96D43C408F272B7004A47F5 /* utf.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = utf.test; sourceTree = "<group>"; };
+ F96D43C508F272B7004A47F5 /* util.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = util.test; sourceTree = "<group>"; };
+ F96D43C608F272B7004A47F5 /* var.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = var.test; sourceTree = "<group>"; };
+ F96D43C708F272B7004A47F5 /* while-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "while-old.test"; sourceTree = "<group>"; };
+ F96D43C808F272B7004A47F5 /* while.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = while.test; sourceTree = "<group>"; };
+ F96D43C908F272B7004A47F5 /* winConsole.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winConsole.test; sourceTree = "<group>"; };
+ F96D43CA08F272B7004A47F5 /* winDde.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winDde.test; sourceTree = "<group>"; };
+ F96D43CB08F272B7004A47F5 /* winFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFCmd.test; sourceTree = "<group>"; };
+ F96D43CC08F272B7004A47F5 /* winFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFile.test; sourceTree = "<group>"; };
+ F96D43CD08F272B7004A47F5 /* winNotify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winNotify.test; sourceTree = "<group>"; };
+ F96D43CE08F272B7004A47F5 /* winPipe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winPipe.test; sourceTree = "<group>"; };
+ F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; };
+ F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; };
+ F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F96D43D308F272B8004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D442208F272B8004A47F5 /* eolFix.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eolFix.tcl; sourceTree = "<group>"; };
+ F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fix_tommath_h.tcl; sourceTree = "<group>"; };
+ F96D442508F272B8004A47F5 /* genStubs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = genStubs.tcl; sourceTree = "<group>"; };
+ F96D442708F272B8004A47F5 /* index.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = index.tcl; sourceTree = "<group>"; };
+ F96D442808F272B8004A47F5 /* installData.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = installData.tcl; sourceTree = "<group>"; };
+ F96D442908F272B8004A47F5 /* loadICU.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = loadICU.tcl; sourceTree = "<group>"; };
+ F96D442A08F272B8004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D442B08F272B8004A47F5 /* makeTestCases.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = makeTestCases.tcl; sourceTree = "<group>"; };
+ F96D442C08F272B8004A47F5 /* man2help.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2help.tcl; sourceTree = "<group>"; };
+ F96D442D08F272B8004A47F5 /* man2help2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2help2.tcl; sourceTree = "<group>"; };
+ F96D442E08F272B8004A47F5 /* man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2html.tcl; sourceTree = "<group>"; };
+ F96D442F08F272B8004A47F5 /* man2html1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2html1.tcl; sourceTree = "<group>"; };
+ F96D443008F272B8004A47F5 /* man2html2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2html2.tcl; sourceTree = "<group>"; };
+ F96D443108F272B8004A47F5 /* man2tcl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = man2tcl.c; sourceTree = "<group>"; };
+ F96D443208F272B8004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D443308F272B8004A47F5 /* regexpTestLib.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = regexpTestLib.tcl; sourceTree = "<group>"; };
+ F96D443408F272B8004A47F5 /* str2c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = str2c; sourceTree = "<group>"; };
+ F96D443508F272B8004A47F5 /* tcl.hpj.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.hpj.in; sourceTree = "<group>"; };
+ F96D443608F272B8004A47F5 /* tcl.wse.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.wse.in; sourceTree = "<group>"; };
+ F96D443708F272B9004A47F5 /* tclmin.wse */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tclmin.wse; sourceTree = "<group>"; };
+ F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "tcltk-man2html.tcl"; sourceTree = "<group>"; };
+ F96D443A08F272B9004A47F5 /* tclZIC.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclZIC.tcl; sourceTree = "<group>"; };
+ F96D443B08F272B9004A47F5 /* uniClass.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniClass.tcl; sourceTree = "<group>"; };
+ F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; };
+ F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F96D444208F272B9004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D444408F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D444508F272B9004A47F5 /* pkga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkga.c; sourceTree = "<group>"; };
+ F96D444608F272B9004A47F5 /* pkgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgb.c; sourceTree = "<group>"; };
+ F96D444708F272B9004A47F5 /* pkgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgc.c; sourceTree = "<group>"; };
+ F96D444808F272B9004A47F5 /* pkgd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgd.c; sourceTree = "<group>"; };
+ F96D444908F272B9004A47F5 /* pkge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkge.c; sourceTree = "<group>"; };
+ F96D444B08F272B9004A47F5 /* pkgua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgua.c; sourceTree = "<group>"; };
+ F96D444C08F272B9004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D444D08F272B9004A47F5 /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; };
+ F96D444E08F272B9004A47F5 /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; };
+ F96D444F08F272B9004A47F5 /* ldAix */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ldAix; sourceTree = "<group>"; };
+ F96D445008F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D445208F272B9004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D445308F272B9004A47F5 /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F96D445408F272B9004A47F5 /* tcl.spec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.spec; sourceTree = "<group>"; };
+ F96D445508F272B9004A47F5 /* tclAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAppInit.c; sourceTree = "<group>"; };
+ F96D445608F272B9004A47F5 /* tclConfig.h.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = tclConfig.h.in; sourceTree = "<group>"; };
+ F96D445708F272B9004A47F5 /* tclConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tclConfig.sh.in; sourceTree = "<group>"; };
+ F96D445808F272B9004A47F5 /* tclLoadAix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadAix.c; sourceTree = "<group>"; };
+ F96D445908F272B9004A47F5 /* tclLoadDl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadDl.c; sourceTree = "<group>"; };
+ F96D445B08F272B9004A47F5 /* tclLoadDyld.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadDyld.c; sourceTree = "<group>"; };
+ F96D445C08F272B9004A47F5 /* tclLoadNext.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadNext.c; sourceTree = "<group>"; };
+ F96D445D08F272B9004A47F5 /* tclLoadOSF.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadOSF.c; sourceTree = "<group>"; };
+ F96D445E08F272B9004A47F5 /* tclLoadShl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadShl.c; sourceTree = "<group>"; };
+ F96D445F08F272B9004A47F5 /* tclUnixChan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixChan.c; sourceTree = "<group>"; };
+ F96D446008F272B9004A47F5 /* tclUnixEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixEvent.c; sourceTree = "<group>"; };
+ F96D446108F272B9004A47F5 /* tclUnixFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixFCmd.c; sourceTree = "<group>"; };
+ F96D446208F272B9004A47F5 /* tclUnixFile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixFile.c; sourceTree = "<group>"; };
+ F96D446308F272B9004A47F5 /* tclUnixInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixInit.c; sourceTree = "<group>"; };
+ F96D446408F272B9004A47F5 /* tclUnixNotfy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixNotfy.c; sourceTree = "<group>"; };
+ F96D446508F272B9004A47F5 /* tclUnixPipe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixPipe.c; sourceTree = "<group>"; };
+ F96D446608F272B9004A47F5 /* tclUnixPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixPort.h; sourceTree = "<group>"; };
+ F96D446708F272B9004A47F5 /* tclUnixSock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixSock.c; sourceTree = "<group>"; };
+ F96D446808F272B9004A47F5 /* tclUnixTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTest.c; sourceTree = "<group>"; };
+ F96D446908F272B9004A47F5 /* tclUnixThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixThrd.c; sourceTree = "<group>"; };
+ F96D446A08F272B9004A47F5 /* tclUnixThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixThrd.h; sourceTree = "<group>"; };
+ F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; };
+ F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; };
+ F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; };
+ F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
+ F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; };
+ F96D447308F272BA004A47F5 /* coffbase.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = coffbase.txt; sourceTree = "<group>"; };
+ F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F96D447508F272BA004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D447608F272BA004A47F5 /* makefile.bc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.bc; sourceTree = "<group>"; };
+ F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
+ F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
+ F96D447A08F272BA004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D447C08F272BA004A47F5 /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
+ F96D447D08F272BA004A47F5 /* stub16.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stub16.c; sourceTree = "<group>"; };
+ F96D447E08F272BA004A47F5 /* tcl.dsp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.dsp; sourceTree = "<group>"; };
+ F96D447F08F272BA004A47F5 /* tcl.dsw */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.dsw; sourceTree = "<group>"; };
+ F96D448008F272BA004A47F5 /* tcl.hpj.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.hpj.in; sourceTree = "<group>"; };
+ F96D448108F272BA004A47F5 /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F96D448208F272BA004A47F5 /* tcl.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.rc; sourceTree = "<group>"; };
+ F96D448308F272BA004A47F5 /* tclAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAppInit.c; sourceTree = "<group>"; };
+ F96D448408F272BA004A47F5 /* tclConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tclConfig.sh.in; sourceTree = "<group>"; };
+ F96D448608F272BA004A47F5 /* tclsh.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tclsh.rc; sourceTree = "<group>"; };
+ F96D448708F272BA004A47F5 /* tclWin32Dll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWin32Dll.c; sourceTree = "<group>"; };
+ F96D448808F272BA004A47F5 /* tclWinChan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinChan.c; sourceTree = "<group>"; };
+ F96D448908F272BA004A47F5 /* tclWinConsole.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinConsole.c; sourceTree = "<group>"; };
+ F96D448A08F272BA004A47F5 /* tclWinDde.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinDde.c; sourceTree = "<group>"; };
+ F96D448B08F272BA004A47F5 /* tclWinError.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinError.c; sourceTree = "<group>"; };
+ F96D448C08F272BA004A47F5 /* tclWinFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinFCmd.c; sourceTree = "<group>"; };
+ F96D448D08F272BA004A47F5 /* tclWinFile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinFile.c; sourceTree = "<group>"; };
+ F96D448E08F272BA004A47F5 /* tclWinInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinInit.c; sourceTree = "<group>"; };
+ F96D448F08F272BA004A47F5 /* tclWinInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinInt.h; sourceTree = "<group>"; };
+ F96D449008F272BA004A47F5 /* tclWinLoad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinLoad.c; sourceTree = "<group>"; };
+ F96D449108F272BA004A47F5 /* tclWinNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinNotify.c; sourceTree = "<group>"; };
+ F96D449208F272BA004A47F5 /* tclWinPipe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinPipe.c; sourceTree = "<group>"; };
+ F96D449308F272BA004A47F5 /* tclWinPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinPort.h; sourceTree = "<group>"; };
+ F96D449408F272BA004A47F5 /* tclWinReg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinReg.c; sourceTree = "<group>"; };
+ F96D449508F272BA004A47F5 /* tclWinSerial.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinSerial.c; sourceTree = "<group>"; };
+ F96D449608F272BA004A47F5 /* tclWinSock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinSock.c; sourceTree = "<group>"; };
+ F96D449708F272BA004A47F5 /* tclWinTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTest.c; sourceTree = "<group>"; };
+ F96D449808F272BA004A47F5 /* tclWinThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinThrd.c; sourceTree = "<group>"; };
+ F96D449908F272BA004A47F5 /* tclWinThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinThrd.h; sourceTree = "<group>"; };
+ F96D449A08F272BA004A47F5 /* tclWinTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTime.c; sourceTree = "<group>"; };
+ F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPrivate.h; sourceTree = "<group>"; };
+ F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Common.xcconfig"; sourceTree = "<group>"; };
+ F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Release.xcconfig"; sourceTree = "<group>"; };
+ F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Debug.xcconfig"; sourceTree = "<group>"; };
+ F9903CAF094FAADA004613E9 /* tclTomMath.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclTomMath.decls; sourceTree = "<group>"; };
+ F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMathDecls.h; sourceTree = "<group>"; };
+ F9A3082D08F2D4AB00BAE1AB /* Tk.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9A3084B08F2D4CE00BAE1AB /* Wish.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wish.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9A3084E08F2D4F400BAE1AB /* Tcl.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tcl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9A493240CEBF38300B78AE2 /* chanio.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chanio.test; sourceTree = "<group>"; };
+ F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mclist.tcl; sourceTree = "<group>"; };
+ F9ECB1120B26521500A28025 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F9ECB1130B26521500A28025 /* platform.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.tcl; sourceTree = "<group>"; };
+ F9ECB1140B26521500A28025 /* shell.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = shell.tcl; sourceTree = "<group>"; };
+ F9ECB1CA0B2652D300A28025 /* apply.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = apply.test; sourceTree = "<group>"; };
+ F9ECB1CB0B26534C00A28025 /* mathop.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mathop.test; sourceTree = "<group>"; };
+ F9ECB1E10B26543C00A28025 /* platform_shell.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = platform_shell.n; sourceTree = "<group>"; };
+ F9ECB1E20B26543C00A28025 /* platform.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = platform.n; sourceTree = "<group>"; };
+ F9F4EFDC0CC7B3CA00378A27 /* ttkpane.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; languageSpecificationIdentifier = shell; path = ttkpane.tcl; sourceTree = "<group>"; };
+ F9F4EFDD0CC7B3CB00378A27 /* ttkmenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; languageSpecificationIdentifier = shell; path = ttkmenu.tcl; sourceTree = "<group>"; };
+ F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixCompat.c; sourceTree = "<group>"; };
+ F9FD31F40CC1AD070073837D /* tktest-X11 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "tktest-X11"; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9FD32140CC1AF170073837D /* libX11.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libX11.dylib; path = /usr/X11R6/lib/libX11.dylib; sourceTree = "<absolute>"; };
+ F9FD32150CC1AF170073837D /* libXext.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXext.dylib; path = /usr/X11R6/lib/libXext.dylib; sourceTree = "<absolute>"; };
+ F9FD32160CC1AF170073837D /* libXss.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXss.dylib; path = /usr/X11R6/lib/libXss.dylib; sourceTree = "<absolute>"; };
+ F9FD34990CC1BB0D0073837D /* libfreetype.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfreetype.dylib; path = /usr/X11R6/lib/libfreetype.dylib; sourceTree = "<absolute>"; };
+ F9FD349A0CC1BB0D0073837D /* libXft.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXft.dylib; path = /usr/X11R6/lib/libXft.dylib; sourceTree = "<absolute>"; };
+ F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfontconfig.dylib; path = /usr/X11R6/lib/libfontconfig.dylib; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8DD76FAD0486AB0100D96B5E /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */,
+ F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */,
+ F966C07908F28233005CB29B /* IOKit.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F9FD31E30CC1AD070073837D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */,
+ F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */,
+ F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */,
+ F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */,
+ F9FD349C0CC1BB0D0073837D /* libXft.dylib in Frameworks */,
+ F9FD349B0CC1BB0D0073837D /* libfreetype.dylib in Frameworks */,
+ F9FD34C40CC1BBD70073837D /* libfontconfig.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 08FB7794FE84155DC02AAC07 /* Wish */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3DF708F271BE004A47F5 /* Tk Sources */,
+ F96D3DF608F27169004A47F5 /* Tcl Sources */,
+ F966C06F08F281DC005CB29B /* Frameworks */,
+ 1AB674ADFE9D54B511CA2CBB /* Products */,
+ );
+ 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";
+ name = Wish;
+ path = .;
+ sourceTree = SOURCE_ROOT;
+ };
+ 1AB674ADFE9D54B511CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ F9A3084B08F2D4CE00BAE1AB /* Wish.app */,
+ F9A3082D08F2D4AB00BAE1AB /* Tk.framework */,
+ F9A3084E08F2D4F400BAE1AB /* Tcl.framework */,
+ 8DD76FB20486AB0100D96B5E /* tktest */,
+ F9FD31F40CC1AD070073837D /* tktest-X11 */,
+ );
+ includeInIndex = 0;
+ name = Products;
+ sourceTree = "<group>";
+ };
+ F966BA0308F27A37005CB29B /* bitmaps */ = {
+ isa = PBXGroup;
+ children = (
+ F966BA0408F27A37005CB29B /* error.xbm */,
+ F966BA0508F27A37005CB29B /* gray12.xbm */,
+ F966BA0608F27A37005CB29B /* gray25.xbm */,
+ F966BA0708F27A37005CB29B /* gray50.xbm */,
+ F966BA0808F27A37005CB29B /* gray75.xbm */,
+ F966BA0908F27A37005CB29B /* hourglass.xbm */,
+ F966BA0A08F27A37005CB29B /* info.xbm */,
+ F966BA0B08F27A37005CB29B /* questhead.xbm */,
+ F966BA0C08F27A37005CB29B /* question.xbm */,
+ F966BA0D08F27A37005CB29B /* warning.xbm */,
+ );
+ path = bitmaps;
+ sourceTree = "<group>";
+ };
+ F966BA1008F27A37005CB29B /* doc */ = {
+ isa = PBXGroup;
+ children = (
+ F966BA1108F27A37005CB29B /* 3DBorder.3 */,
+ F966BA1208F27A37005CB29B /* AddOption.3 */,
+ F966BA1308F27A37005CB29B /* bell.n */,
+ F966BA1408F27A37005CB29B /* bind.n */,
+ F966BA1508F27A37005CB29B /* BindTable.3 */,
+ F966BA1608F27A37005CB29B /* bindtags.n */,
+ F966BA1708F27A37005CB29B /* bitmap.n */,
+ F966BA1808F27A37005CB29B /* button.n */,
+ F966BA1908F27A37005CB29B /* canvas.n */,
+ F966BA1A08F27A37005CB29B /* CanvPsY.3 */,
+ F966BA1B08F27A37005CB29B /* CanvTkwin.3 */,
+ F966BA1C08F27A37005CB29B /* CanvTxtInfo.3 */,
+ F966BA1D08F27A37005CB29B /* checkbutton.n */,
+ F966BA1E08F27A37005CB29B /* chooseColor.n */,
+ F966BA1F08F27A37005CB29B /* chooseDirectory.n */,
+ F966BA2008F27A37005CB29B /* Clipboard.3 */,
+ F966BA2108F27A37005CB29B /* clipboard.n */,
+ F966BA2208F27A37005CB29B /* ClrSelect.3 */,
+ F966BA2308F27A37005CB29B /* colors.n */,
+ F966BA2408F27A37005CB29B /* ConfigWidg.3 */,
+ F966BA2508F27A37005CB29B /* ConfigWind.3 */,
+ F966BA2608F27A37005CB29B /* console.n */,
+ F966BA2708F27A37005CB29B /* CoordToWin.3 */,
+ F966BA2808F27A37005CB29B /* CrtCmHdlr.3 */,
+ F966BA2908F27A37005CB29B /* CrtErrHdlr.3 */,
+ F966BA2A08F27A37005CB29B /* CrtGenHdlr.3 */,
+ F966BA2B08F27A37005CB29B /* CrtImgType.3 */,
+ F966BA2C08F27A37005CB29B /* CrtItemType.3 */,
+ F966BA2D08F27A37005CB29B /* CrtPhImgFmt.3 */,
+ F966BA2E08F27A37005CB29B /* CrtSelHdlr.3 */,
+ F966BA2F08F27A37005CB29B /* CrtWindow.3 */,
+ F966BA3008F27A37005CB29B /* cursors.n */,
+ F966BA3108F27A37005CB29B /* DeleteImg.3 */,
+ F966BA3208F27A37005CB29B /* destroy.n */,
+ F966BA3308F27A37005CB29B /* dialog.n */,
+ F966BA3408F27A37005CB29B /* DrawFocHlt.3 */,
+ F966BA3508F27A37005CB29B /* entry.n */,
+ F966BA3608F27A37005CB29B /* event.n */,
+ F966BA3708F27A37005CB29B /* EventHndlr.3 */,
+ F966BA3808F27A37005CB29B /* FindPhoto.3 */,
+ F966BA3908F27A37005CB29B /* focus.n */,
+ F966BA3A08F27A37005CB29B /* focusNext.n */,
+ F966BA3B08F27A37005CB29B /* font.n */,
+ F966BA3C08F27A37005CB29B /* FontId.3 */,
+ F966BA3D08F27A37005CB29B /* frame.n */,
+ F966BA3E08F27A37005CB29B /* FreeXId.3 */,
+ F966BA3F08F27A37005CB29B /* GeomReq.3 */,
+ F966BA4008F27A37005CB29B /* GetAnchor.3 */,
+ F966BA4108F27A37005CB29B /* GetBitmap.3 */,
+ F966BA4208F27A37005CB29B /* GetCapStyl.3 */,
+ F966BA4308F27A37005CB29B /* GetClrmap.3 */,
+ F966BA4408F27A37005CB29B /* GetColor.3 */,
+ F966BA4508F27A37005CB29B /* GetCursor.3 */,
+ F966BA4608F27A37005CB29B /* GetDash.3 */,
+ F966BA4708F27A37005CB29B /* GetFont.3 */,
+ F966BA4808F27A37005CB29B /* GetGC.3 */,
+ F966BA4908F27A37005CB29B /* GetHINSTANCE.3 */,
+ F966BA4A08F27A37005CB29B /* GetHWND.3 */,
+ F966BA4B08F27A37005CB29B /* GetImage.3 */,
+ F966BA4C08F27A37005CB29B /* GetJoinStl.3 */,
+ F966BA4D08F27A37005CB29B /* GetJustify.3 */,
+ F966BA4E08F27A37005CB29B /* getOpenFile.n */,
+ F966BA4F08F27A37005CB29B /* GetOption.3 */,
+ F966BA5008F27A38005CB29B /* GetPixels.3 */,
+ F966BA5108F27A38005CB29B /* GetPixmap.3 */,
+ F966BA5208F27A38005CB29B /* GetRelief.3 */,
+ F966BA5308F27A38005CB29B /* GetRootCrd.3 */,
+ F966BA5408F27A38005CB29B /* GetScroll.3 */,
+ F966BA5508F27A38005CB29B /* GetSelect.3 */,
+ F966BA5608F27A38005CB29B /* GetUid.3 */,
+ F966BA5708F27A38005CB29B /* GetVisual.3 */,
+ F966BA5808F27A38005CB29B /* GetVRoot.3 */,
+ F966BA5908F27A38005CB29B /* Grab.3 */,
+ F966BA5A08F27A38005CB29B /* grab.n */,
+ F966BA5B08F27A38005CB29B /* grid.n */,
+ F966BA5C08F27A38005CB29B /* HandleEvent.3 */,
+ F966BA5D08F27A38005CB29B /* HWNDToWindow.3 */,
+ F966BA5E08F27A38005CB29B /* IdToWindow.3 */,
+ F966BA5F08F27A38005CB29B /* image.n */,
+ F966BA6008F27A38005CB29B /* ImgChanged.3 */,
+ F966BA6108F27A38005CB29B /* Inactive.3 */,
+ F966BA6208F27A38005CB29B /* InternAtom.3 */,
+ F966BA6308F27A38005CB29B /* keysyms.n */,
+ F966BA6408F27A38005CB29B /* label.n */,
+ F966BA6508F27A38005CB29B /* labelframe.n */,
+ F966BA6608F27A38005CB29B /* listbox.n */,
+ F966BA6708F27A38005CB29B /* loadTk.n */,
+ F966BA6808F27A38005CB29B /* lower.n */,
+ F966BA6908F27A38005CB29B /* MainLoop.3 */,
+ F966BA6A08F27A38005CB29B /* MaintGeom.3 */,
+ F966BA6B08F27A38005CB29B /* MainWin.3 */,
+ F966BA6D08F27A38005CB29B /* ManageGeom.3 */,
+ F966BA6E08F27A38005CB29B /* MapWindow.3 */,
+ F966BA6F08F27A38005CB29B /* MeasureChar.3 */,
+ F966BA7008F27A38005CB29B /* menu.n */,
+ F966BA7108F27A38005CB29B /* menubar.n */,
+ F966BA7208F27A38005CB29B /* menubutton.n */,
+ F966BA7308F27A38005CB29B /* message.n */,
+ F966BA7408F27A38005CB29B /* messageBox.n */,
+ F966BA7508F27A38005CB29B /* MoveToplev.3 */,
+ F966BA7608F27A38005CB29B /* Name.3 */,
+ F966BA7708F27A38005CB29B /* NameOfImg.3 */,
+ F966BA7808F27A38005CB29B /* option.n */,
+ F966BA7908F27A38005CB29B /* optionMenu.n */,
+ F966BA7A08F27A38005CB29B /* options.n */,
+ F966BA7B08F27A38005CB29B /* OwnSelect.3 */,
+ F966BA7C08F27A38005CB29B /* pack-old.n */,
+ F966BA7D08F27A38005CB29B /* pack.n */,
+ F966BA7E08F27A38005CB29B /* palette.n */,
+ F966BA7F08F27A38005CB29B /* panedwindow.n */,
+ F966BA8008F27A38005CB29B /* ParseArgv.3 */,
+ F966BA8108F27A38005CB29B /* photo.n */,
+ F966BA8208F27A38005CB29B /* place.n */,
+ F966BA8308F27A38005CB29B /* popup.n */,
+ F966BA8408F27A38005CB29B /* QWinEvent.3 */,
+ F966BA8508F27A38005CB29B /* radiobutton.n */,
+ F966BA8608F27A38005CB29B /* raise.n */,
+ F966BA8708F27A38005CB29B /* Restack.3 */,
+ F966BA8808F27A38005CB29B /* RestrictEv.3 */,
+ F966BA8908F27A38005CB29B /* scale.n */,
+ F966BA8A08F27A38005CB29B /* scrollbar.n */,
+ F966BA8B08F27A38005CB29B /* selection.n */,
+ F966BA8C08F27A38005CB29B /* send.n */,
+ F966BA8D08F27A38005CB29B /* SetAppName.3 */,
+ F966BA8E08F27A38005CB29B /* SetCaret.3 */,
+ F966BA8F08F27A38005CB29B /* SetClass.3 */,
+ F966BA9008F27A38005CB29B /* SetClassProcs.3 */,
+ F966BA9108F27A38005CB29B /* SetGrid.3 */,
+ F966BA9208F27A38005CB29B /* SetOptions.3 */,
+ F966BA9308F27A38005CB29B /* SetVisual.3 */,
+ F966BA9408F27A38005CB29B /* spinbox.n */,
+ F966BA9508F27A38005CB29B /* StrictMotif.3 */,
+ F966BA9608F27A38005CB29B /* text.n */,
+ F966BA9708F27A38005CB29B /* TextLayout.3 */,
+ F966BA9808F27A38005CB29B /* tk.n */,
+ F966BA9908F27A38005CB29B /* tk4.0.ps */,
+ F966BA9A08F27A38005CB29B /* Tk_Init.3 */,
+ F966BA9B08F27A38005CB29B /* Tk_Main.3 */,
+ F966BA9C08F27A38005CB29B /* tkerror.n */,
+ F966BA9D08F27A38005CB29B /* TkInitStubs.3 */,
+ F966BA9E08F27A38005CB29B /* tkvars.n */,
+ F966BA9F08F27A38005CB29B /* tkwait.n */,
+ F966BAA008F27A38005CB29B /* toplevel.n */,
+ F968886B0AF788F6000797B5 /* ttk_button.n */,
+ F968886C0AF788F6000797B5 /* ttk_checkbutton.n */,
+ F968886D0AF788F6000797B5 /* ttk_combobox.n */,
+ F968886F0AF788F6000797B5 /* ttk_entry.n */,
+ F96888700AF788F6000797B5 /* ttk_frame.n */,
+ F96888710AF788F6000797B5 /* ttk_Geometry.3 */,
+ F96888720AF788F6000797B5 /* ttk_image.n */,
+ F96888730AF788F6000797B5 /* ttk_intro.n */,
+ F96888740AF788F6000797B5 /* ttk_label.n */,
+ F96888750AF788F6000797B5 /* ttk_labelframe.n */,
+ F96888760AF788F6000797B5 /* ttk_menubutton.n */,
+ F96888770AF788F6000797B5 /* ttk_notebook.n */,
+ F96888780AF788F6000797B5 /* ttk_panedwindow.n */,
+ F96888790AF788F6000797B5 /* ttk_progressbar.n */,
+ F968887A0AF788F6000797B5 /* ttk_radiobutton.n */,
+ F968887B0AF788F6000797B5 /* ttk_scrollbar.n */,
+ F968887C0AF788F6000797B5 /* ttk_separator.n */,
+ F968887D0AF788F6000797B5 /* ttk_sizegrip.n */,
+ F968887E0AF788F6000797B5 /* ttk_style.n */,
+ F968887F0AF788F6000797B5 /* ttk_Theme.3 */,
+ F96888800AF788F6000797B5 /* ttk_treeview.n */,
+ F96888810AF788F6000797B5 /* ttk_widget.n */,
+ F966BAA108F27A38005CB29B /* WindowId.3 */,
+ F966BAA208F27A38005CB29B /* winfo.n */,
+ F966BAA308F27A38005CB29B /* wish.1 */,
+ F966BAA408F27A38005CB29B /* wm.n */,
+ );
+ path = doc;
+ sourceTree = "<group>";
+ };
+ F966BAA508F27A38005CB29B /* generic */ = {
+ isa = PBXGroup;
+ children = (
+ F966BAA608F27A38005CB29B /* default.h */,
+ F966BAA708F27A38005CB29B /* ks_names.h */,
+ F966BAA808F27A38005CB29B /* prolog.ps */,
+ F966BAA908F27A39005CB29B /* README */,
+ F966BAAA08F27A39005CB29B /* tk.decls */,
+ F966BAAB08F27A39005CB29B /* tk.h */,
+ F966BAAC08F27A39005CB29B /* tk3d.c */,
+ F966BAAD08F27A39005CB29B /* tk3d.h */,
+ F966BAAE08F27A39005CB29B /* tkArgv.c */,
+ F966BAAF08F27A39005CB29B /* tkAtom.c */,
+ F966BAB008F27A39005CB29B /* tkBind.c */,
+ F966BAB108F27A39005CB29B /* tkBitmap.c */,
+ F966BAB208F27A39005CB29B /* tkButton.c */,
+ F966BAB308F27A39005CB29B /* tkButton.h */,
+ F966BAB408F27A39005CB29B /* tkCanvArc.c */,
+ F966BAB508F27A39005CB29B /* tkCanvas.c */,
+ F966BAB608F27A39005CB29B /* tkCanvas.h */,
+ F966BAB708F27A39005CB29B /* tkCanvBmap.c */,
+ F966BAB808F27A39005CB29B /* tkCanvImg.c */,
+ F966BAB908F27A39005CB29B /* tkCanvLine.c */,
+ F966BABA08F27A39005CB29B /* tkCanvPoly.c */,
+ F966BABB08F27A39005CB29B /* tkCanvPs.c */,
+ F966BABD08F27A39005CB29B /* tkCanvText.c */,
+ F966BABE08F27A39005CB29B /* tkCanvUtil.c */,
+ F966BABF08F27A39005CB29B /* tkCanvWind.c */,
+ F966BAC008F27A39005CB29B /* tkClipboard.c */,
+ F966BAC108F27A39005CB29B /* tkCmds.c */,
+ F966BAC208F27A39005CB29B /* tkColor.c */,
+ F966BAC308F27A39005CB29B /* tkColor.h */,
+ F966BAC408F27A39005CB29B /* tkConfig.c */,
+ F966BAC508F27A39005CB29B /* tkConsole.c */,
+ F966BAC608F27A39005CB29B /* tkCursor.c */,
+ F966BAC708F27A39005CB29B /* tkDecls.h */,
+ F966BAC808F27A39005CB29B /* tkEntry.c */,
+ F966BAC908F27A39005CB29B /* tkEntry.h */,
+ F966BACA08F27A39005CB29B /* tkError.c */,
+ F966BACB08F27A39005CB29B /* tkEvent.c */,
+ F966BACC08F27A39005CB29B /* tkFileFilter.c */,
+ F966BACD08F27A39005CB29B /* tkFileFilter.h */,
+ F966BACE08F27A39005CB29B /* tkFocus.c */,
+ F966BACF08F27A39005CB29B /* tkFont.c */,
+ F966BAD008F27A39005CB29B /* tkFont.h */,
+ F966BAD108F27A39005CB29B /* tkFrame.c */,
+ F966BAD208F27A39005CB29B /* tkGC.c */,
+ F966BAD308F27A39005CB29B /* tkGeometry.c */,
+ F966BAD408F27A39005CB29B /* tkGet.c */,
+ F966BAD508F27A39005CB29B /* tkGrab.c */,
+ F966BAD608F27A39005CB29B /* tkGrid.c */,
+ F966BAD708F27A39005CB29B /* tkImage.c */,
+ F966BAD808F27A39005CB29B /* tkImgBmap.c */,
+ F966BAD908F27A39005CB29B /* tkImgGIF.c */,
+ F966BADA08F27A39005CB29B /* tkImgPhoto.c */,
+ F966BADB08F27A39005CB29B /* tkImgPPM.c */,
+ F966BADC08F27A39005CB29B /* tkImgUtil.c */,
+ F966BADE08F27A39005CB29B /* tkInt.decls */,
+ F966BADF08F27A39005CB29B /* tkInt.h */,
+ F966BAE108F27A39005CB29B /* tkIntDecls.h */,
+ F966BAE208F27A39005CB29B /* tkIntPlatDecls.h */,
+ F966BAE308F27A39005CB29B /* tkIntXlibDecls.h */,
+ F966BAE408F27A39005CB29B /* tkListbox.c */,
+ F966BAE508F27A39005CB29B /* tkMacWinMenu.c */,
+ F966BAE608F27A39005CB29B /* tkMain.c */,
+ F966BAE708F27A39005CB29B /* tkMenu.c */,
+ F966BAE808F27A39005CB29B /* tkMenu.h */,
+ F966BAE908F27A39005CB29B /* tkMenubutton.c */,
+ F966BAEA08F27A39005CB29B /* tkMenubutton.h */,
+ F966BAEB08F27A39005CB29B /* tkMenuDraw.c */,
+ F966BAEC08F27A39005CB29B /* tkMessage.c */,
+ F966BAED08F27A39005CB29B /* tkObj.c */,
+ F966BAEE08F27A39005CB29B /* tkOldConfig.c */,
+ F966BAEF08F27A39005CB29B /* tkOption.c */,
+ F966BAF008F27A39005CB29B /* tkPack.c */,
+ F966BAF108F27A39005CB29B /* tkPanedWindow.c */,
+ F966BAF208F27A39005CB29B /* tkPlace.c */,
+ F966BAF308F27A39005CB29B /* tkPlatDecls.h */,
+ F966BAF408F27A39005CB29B /* tkPointer.c */,
+ F966BAF508F27A39005CB29B /* tkPort.h */,
+ F966BAF608F27A39005CB29B /* tkRectOval.c */,
+ F966BAF708F27A39005CB29B /* tkScale.c */,
+ F966BAF808F27A39005CB29B /* tkScale.h */,
+ F966BAF908F27A39005CB29B /* tkScrollbar.c */,
+ F966BAFA08F27A39005CB29B /* tkScrollbar.h */,
+ F966BAFB08F27A39005CB29B /* tkSelect.c */,
+ F966BAFC08F27A39005CB29B /* tkSelect.h */,
+ F966BAFD08F27A39005CB29B /* tkSquare.c */,
+ F966BAFE08F27A39005CB29B /* tkOldTest.c */,
+ F966BAFF08F27A39005CB29B /* tkStubInit.c */,
+ F966BB0008F27A39005CB29B /* tkStubLib.c */,
+ F966BB0108F27A39005CB29B /* tkStyle.c */,
+ F966BB0208F27A39005CB29B /* tkTest.c */,
+ F966BB0308F27A39005CB29B /* tkText.c */,
+ F966BB0408F27A39005CB29B /* tkText.h */,
+ F966BB0508F27A39005CB29B /* tkTextBTree.c */,
+ F966BB0608F27A39005CB29B /* tkTextDisp.c */,
+ F966BB0808F27A39005CB29B /* tkTextImage.c */,
+ F966BB0908F27A39005CB29B /* tkTextIndex.c */,
+ F966BB0A08F27A39005CB29B /* tkTextMark.c */,
+ F966BB0B08F27A39005CB29B /* tkTextTag.c */,
+ F966BB0C08F27A39005CB29B /* tkTextWind.c */,
+ F966BB0D08F27A39005CB29B /* tkTrig.c */,
+ F966BB0E08F27A39005CB29B /* tkUndo.c */,
+ F966BB0F08F27A39005CB29B /* tkUndo.h */,
+ F966BB1008F27A39005CB29B /* tkUtil.c */,
+ F966BB1108F27A39005CB29B /* tkVisual.c */,
+ F966BB1208F27A39005CB29B /* tkWindow.c */,
+ F96887DF0AF786D5000797B5 /* ttk */,
+ );
+ path = generic;
+ sourceTree = "<group>";
+ };
+ F966BB1308F27A39005CB29B /* library */ = {
+ isa = PBXGroup;
+ children = (
+ F966BB1408F27A39005CB29B /* bgerror.tcl */,
+ F966BB1508F27A39005CB29B /* button.tcl */,
+ F966BB1608F27A39005CB29B /* choosedir.tcl */,
+ F966BB1708F27A39005CB29B /* clrpick.tcl */,
+ F966BB1808F27A39005CB29B /* comdlg.tcl */,
+ F966BB1908F27A39005CB29B /* console.tcl */,
+ F966BB1A08F27A39005CB29B /* demos */,
+ F966BB6208F27A3A005CB29B /* dialog.tcl */,
+ F966BB6308F27A3A005CB29B /* entry.tcl */,
+ F966BB6408F27A3A005CB29B /* focus.tcl */,
+ F966BB7308F27A3A005CB29B /* listbox.tcl */,
+ F966BB7408F27A3A005CB29B /* menu.tcl */,
+ F966BB7508F27A3A005CB29B /* mkpsenc.tcl */,
+ F966BB7608F27A3A005CB29B /* msgbox.tcl */,
+ F966BB8608F27A3A005CB29B /* obsolete.tcl */,
+ F966BB8708F27A3A005CB29B /* optMenu.tcl */,
+ F966BB8808F27A3A005CB29B /* palette.tcl */,
+ F966BB8908F27A3B005CB29B /* panedwindow.tcl */,
+ F966BB8A08F27A3B005CB29B /* prolog.ps */,
+ F966BB8B08F27A3B005CB29B /* safetk.tcl */,
+ F966BB8C08F27A3B005CB29B /* scale.tcl */,
+ F966BB8D08F27A3B005CB29B /* scrlbar.tcl */,
+ F966BB8E08F27A3B005CB29B /* spinbox.tcl */,
+ F966BB8F08F27A3B005CB29B /* tclIndex */,
+ F966BB9008F27A3B005CB29B /* tearoff.tcl */,
+ F966BB9108F27A3B005CB29B /* text.tcl */,
+ F966BB9208F27A3B005CB29B /* tk.tcl */,
+ F966BB9308F27A3B005CB29B /* tkfbox.tcl */,
+ F96888360AF787B3000797B5 /* ttk */,
+ F966BB9408F27A3B005CB29B /* unsupported.tcl */,
+ F966BB9508F27A3B005CB29B /* xmfbox.tcl */,
+ );
+ path = library;
+ sourceTree = "<group>";
+ };
+ F966BB1A08F27A39005CB29B /* demos */ = {
+ isa = PBXGroup;
+ children = (
+ F966BB1B08F27A39005CB29B /* anilabel.tcl */,
+ F966BB1C08F27A39005CB29B /* aniwave.tcl */,
+ F966BB1D08F27A39005CB29B /* arrow.tcl */,
+ F966BB1E08F27A39005CB29B /* bind.tcl */,
+ F966BB1F08F27A39005CB29B /* bitmap.tcl */,
+ F966BB2008F27A39005CB29B /* browse */,
+ F966BB2108F27A39005CB29B /* button.tcl */,
+ F966BB2208F27A39005CB29B /* check.tcl */,
+ F966BB2308F27A39005CB29B /* clrpick.tcl */,
+ F966BB2408F27A39005CB29B /* colors.tcl */,
+ F936FCDB0CCD984600716967 /* combo.tcl */,
+ F966BB2508F27A39005CB29B /* cscroll.tcl */,
+ F966BB2608F27A39005CB29B /* ctext.tcl */,
+ F966BB2708F27A39005CB29B /* dialog1.tcl */,
+ F966BB2808F27A39005CB29B /* dialog2.tcl */,
+ F966BB2A08F27A39005CB29B /* entry1.tcl */,
+ F966BB2B08F27A39005CB29B /* entry2.tcl */,
+ F966BB2C08F27A39005CB29B /* entry3.tcl */,
+ F966BB2D08F27A39005CB29B /* filebox.tcl */,
+ F966BB2E08F27A39005CB29B /* floor.tcl */,
+ F966BB2F08F27A39005CB29B /* form.tcl */,
+ F966BB3008F27A39005CB29B /* goldberg.tcl */,
+ F966BB3108F27A39005CB29B /* hello */,
+ F966BB3208F27A39005CB29B /* hscale.tcl */,
+ F966BB3308F27A39005CB29B /* icon.tcl */,
+ F966BB3408F27A39005CB29B /* image1.tcl */,
+ F966BB3508F27A39005CB29B /* image2.tcl */,
+ F966BB4208F27A3A005CB29B /* items.tcl */,
+ F966BB4308F27A3A005CB29B /* ixset */,
+ F92240290D7C620F005EC715 /* knightstour.tcl */,
+ F966BB4408F27A3A005CB29B /* label.tcl */,
+ F966BB4508F27A3A005CB29B /* labelframe.tcl */,
+ F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */,
+ F966BB4608F27A3A005CB29B /* menu.tcl */,
+ F966BB4708F27A3A005CB29B /* menubu.tcl */,
+ F966BB4808F27A3A005CB29B /* msgbox.tcl */,
+ F966BB4A08F27A3A005CB29B /* paned1.tcl */,
+ F966BB4B08F27A3A005CB29B /* paned2.tcl */,
+ F966BB4C08F27A3A005CB29B /* pendulum.tcl */,
+ F966BB4D08F27A3A005CB29B /* plot.tcl */,
+ F966BB4E08F27A3A005CB29B /* puzzle.tcl */,
+ F966BB4F08F27A3A005CB29B /* radio.tcl */,
+ F966BB5008F27A3A005CB29B /* README */,
+ F966BB5108F27A3A005CB29B /* rmt */,
+ F966BB5208F27A3A005CB29B /* rolodex */,
+ F966BB5308F27A3A005CB29B /* ruler.tcl */,
+ F966BB5408F27A3A005CB29B /* sayings.tcl */,
+ F966BB5508F27A3A005CB29B /* search.tcl */,
+ F966BB5608F27A3A005CB29B /* spin.tcl */,
+ F966BB5708F27A3A005CB29B /* square */,
+ F966BB5808F27A3A005CB29B /* states.tcl */,
+ F966BB5908F27A3A005CB29B /* style.tcl */,
+ F966BB5A08F27A3A005CB29B /* tclIndex */,
+ F966BB5B08F27A3A005CB29B /* tcolor */,
+ F966BB5C08F27A3A005CB29B /* text.tcl */,
+ F9099B8A0CC67D30005A9580 /* textpeer.tcl */,
+ F966BB5D08F27A3A005CB29B /* timer */,
+ F936FCD90CCD984600716967 /* toolbar.tcl */,
+ F936FCD80CCD984600716967 /* tree.tcl */,
+ F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */,
+ F9F4EFDD0CC7B3CB00378A27 /* ttkmenu.tcl */,
+ F936FCDA0CCD984600716967 /* ttknote.tcl */,
+ F9F4EFDC0CC7B3CA00378A27 /* ttkpane.tcl */,
+ F936FCD70CCD984500716967 /* ttkprogress.tcl */,
+ F966BB5E08F27A3A005CB29B /* twind.tcl */,
+ F966BB5F08F27A3A005CB29B /* unicodeout.tcl */,
+ F966BB6008F27A3A005CB29B /* vscale.tcl */,
+ F966BB6108F27A3A005CB29B /* widget */,
+ );
+ path = demos;
+ sourceTree = "<group>";
+ };
+ F966BB9708F27A3B005CB29B /* macosx */ = {
+ isa = PBXGroup;
+ children = (
+ F966BBBA08F27A3B005CB29B /* configure.ac */,
+ F966BBBB08F27A3B005CB29B /* GNUmakefile */,
+ F966BBBE08F27A3B005CB29B /* README */,
+ F966BBC008F27A3B005CB29B /* Tk-Info.plist.in */,
+ F966BBC108F27A3B005CB29B /* tkAboutDlg.r */,
+ F966BBC208F27A3B005CB29B /* tkMacOSX.h */,
+ F966BBC408F27A3B005CB29B /* tkMacOSXAETE.r */,
+ F966BBC508F27A3B005CB29B /* tkMacOSXBitmap.c */,
+ F966BBC608F27A3B005CB29B /* tkMacOSXButton.c */,
+ F966BBC708F27A3B005CB29B /* tkMacOSXCarbonEvents.c */,
+ F966BBC808F27A3B005CB29B /* tkMacOSXClipboard.c */,
+ F966BBC908F27A3B005CB29B /* tkMacOSXColor.c */,
+ F966BBCA08F27A3B005CB29B /* tkMacOSXConfig.c */,
+ F966BBCB08F27A3B005CB29B /* tkMacOSXCursor.c */,
+ F966BBCC08F27A3B005CB29B /* tkMacOSXCursors.r */,
+ F966BBCD08F27A3B005CB29B /* tkMacOSXDebug.c */,
+ F966BBCE08F27A3B005CB29B /* tkMacOSXDebug.h */,
+ F966BBCF08F27A3B005CB29B /* tkMacOSXDefault.h */,
+ F966BBD008F27A3B005CB29B /* tkMacOSXDialog.c */,
+ F966BBD108F27A3B005CB29B /* tkMacOSXDraw.c */,
+ F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */,
+ F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */,
+ F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */,
+ F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */,
+ F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */,
+ F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */,
+ F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */,
+ F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */,
+ F966BBDA08F27A3B005CB29B /* tkMacOSXInt.h */,
+ F966BBDB08F27A3B005CB29B /* tkMacOSXKeyboard.c */,
+ F966BBDC08F27A3B005CB29B /* tkMacOSXKeyEvent.c */,
+ F966BBDD08F27A3B005CB29B /* tkMacOSXMenu.c */,
+ F966BBE008F27A3B005CB29B /* tkMacOSXMenubutton.c */,
+ F966BBE108F27A3B005CB29B /* tkMacOSXMenus.c */,
+ F966BBE208F27A3B005CB29B /* tkMacOSXMouseEvent.c */,
+ F966BBE308F27A3B005CB29B /* tkMacOSXNotify.c */,
+ F966BBEA08F27A3C005CB29B /* tkMacOSXPort.h */,
+ F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */,
+ F966BBEB08F27A3C005CB29B /* tkMacOSXRegion.c */,
+ F966BBEC08F27A3C005CB29B /* tkMacOSXScale.c */,
+ F966BBED08F27A3C005CB29B /* tkMacOSXScrlbr.c */,
+ F966BBEE08F27A3C005CB29B /* tkMacOSXSend.c */,
+ F966BBEF08F27A3C005CB29B /* tkMacOSXSubwindows.c */,
+ F966BBF008F27A3C005CB29B /* tkMacOSXTest.c */,
+ F966BBF108F27A3C005CB29B /* tkMacOSXWindowEvent.c */,
+ F966BBF208F27A3C005CB29B /* tkMacOSXWm.c */,
+ F966BBF308F27A3C005CB29B /* tkMacOSXWm.h */,
+ F966BBF408F27A3C005CB29B /* tkMacOSXXCursors.r */,
+ F966BBF508F27A3C005CB29B /* tkMacOSXXStubs.c */,
+ F96888840AF78938000797B5 /* ttkMacOSXTheme.c */,
+ F966BBF808F27A3C005CB29B /* Wish.icns */,
+ F966BBF708F27A3C005CB29B /* Wish-Info.plist.in */,
+ F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */,
+ F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */,
+ F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */,
+ );
+ path = macosx;
+ sourceTree = "<group>";
+ };
+ F966BC0408F27A3C005CB29B /* tests */ = {
+ isa = PBXGroup;
+ children = (
+ F966BC0508F27A3C005CB29B /* all.tcl */,
+ F966BC0608F27A3C005CB29B /* arc.tcl */,
+ F966BC0708F27A3C005CB29B /* bell.test */,
+ F966BC0808F27A3C005CB29B /* bevel.tcl */,
+ F966BC0908F27A3C005CB29B /* bgerror.test */,
+ F966BC0A08F27A3C005CB29B /* bind.test */,
+ F966BC0B08F27A3C005CB29B /* bitmap.test */,
+ F966BC0C08F27A3C005CB29B /* border.test */,
+ F966BC0D08F27A3C005CB29B /* bugs.tcl */,
+ F966BC0E08F27A3C005CB29B /* butGeom.tcl */,
+ F966BC0F08F27A3C005CB29B /* butGeom2.tcl */,
+ F966BC1008F27A3C005CB29B /* button.test */,
+ F966BC1108F27A3C005CB29B /* canvas.test */,
+ F966BC1208F27A3C005CB29B /* canvImg.test */,
+ F966BC1308F27A3C005CB29B /* canvPs.test */,
+ F966BC1408F27A3C005CB29B /* canvPsArc.tcl */,
+ F966BC1508F27A3C005CB29B /* canvPsBmap.tcl */,
+ F966BC1608F27A3C005CB29B /* canvPsGrph.tcl */,
+ F966BC1708F27A3C005CB29B /* canvPsImg.tcl */,
+ F966BC1808F27A3C005CB29B /* canvPsText.tcl */,
+ F966BC1908F27A3C005CB29B /* canvRect.test */,
+ F966BC1A08F27A3C005CB29B /* canvText.test */,
+ F966BC1B08F27A3C005CB29B /* canvWind.test */,
+ F966BC1C08F27A3C005CB29B /* choosedir.test */,
+ F966BC1D08F27A3C005CB29B /* clipboard.test */,
+ F966BC1E08F27A3C005CB29B /* clrpick.test */,
+ F966BC1F08F27A3C005CB29B /* cmap.tcl */,
+ F966BC2008F27A3C005CB29B /* cmds.test */,
+ F966BC2108F27A3C005CB29B /* color.test */,
+ F966BC2208F27A3C005CB29B /* config.test */,
+ F966BC2308F27A3C005CB29B /* constraints.tcl */,
+ F966BC2408F27A3C005CB29B /* cursor.test */,
+ F966BC2508F27A3C005CB29B /* dialog.test */,
+ F966BC2608F27A3C005CB29B /* embed.test */,
+ F966BC2708F27A3C005CB29B /* entry.test */,
+ F966BC2808F27A3C005CB29B /* event.test */,
+ F966BC2908F27A3C005CB29B /* filebox.test */,
+ F966BC2A08F27A3C005CB29B /* focus.test */,
+ F966BC2B08F27A3C005CB29B /* focusTcl.test */,
+ F966BC2C08F27A3C005CB29B /* font.test */,
+ F966BC2D08F27A3C005CB29B /* frame.test */,
+ F966BC2E08F27A3C005CB29B /* geometry.test */,
+ F966BC2F08F27A3C005CB29B /* get.test */,
+ F966BC3008F27A3C005CB29B /* grab.test */,
+ F966BC3108F27A3C005CB29B /* grid.test */,
+ F966BC3208F27A3C005CB29B /* id.test */,
+ F966BC3308F27A3C005CB29B /* image.test */,
+ F966BC3408F27A3C005CB29B /* imgBmap.test */,
+ F966BC3508F27A3C005CB29B /* imgPhoto.test */,
+ F966BC3608F27A3C005CB29B /* imgPPM.test */,
+ F966BC3708F27A3C005CB29B /* listbox.test */,
+ F966BC3808F27A3C005CB29B /* main.test */,
+ F966BC3908F27A3C005CB29B /* menu.test */,
+ F966BC3A08F27A3C005CB29B /* menubut.test */,
+ F966BC3B08F27A3C005CB29B /* menuDraw.test */,
+ F966BC3C08F27A3C005CB29B /* message.test */,
+ F966BC3D08F27A3C005CB29B /* msgbox.test */,
+ F966BC3E08F27A3C005CB29B /* obj.test */,
+ F966BC3F08F27A3C005CB29B /* oldpack.test */,
+ F966BC4008F27A3C005CB29B /* option.file1 */,
+ F966BC4108F27A3C005CB29B /* option.file2 */,
+ F966BC4208F27A3C005CB29B /* option.test */,
+ F966BC4308F27A3C005CB29B /* pack.test */,
+ F966BC4408F27A3C005CB29B /* panedwindow.test */,
+ F966BC4508F27A3D005CB29B /* place.test */,
+ F966BC4608F27A3D005CB29B /* raise.test */,
+ F966BC4708F27A3D005CB29B /* README */,
+ F966BC4808F27A3D005CB29B /* safe.test */,
+ F966BC4908F27A3D005CB29B /* scale.test */,
+ F966BC4A08F27A3D005CB29B /* scrollbar.test */,
+ F966BC4B08F27A3D005CB29B /* select.test */,
+ F966BC4C08F27A3D005CB29B /* send.test */,
+ F966BC4D08F27A3D005CB29B /* spinbox.test */,
+ F966BC4E08F27A3D005CB29B /* text.test */,
+ F966BC4F08F27A3D005CB29B /* textBTree.test */,
+ F966BC5008F27A3D005CB29B /* textDisp.test */,
+ F966BC5108F27A3D005CB29B /* textImage.test */,
+ F966BC5208F27A3D005CB29B /* textIndex.test */,
+ F966BC5308F27A3D005CB29B /* textMark.test */,
+ F966BC5408F27A3D005CB29B /* textTag.test */,
+ F966BC5508F27A3D005CB29B /* textWind.test */,
+ F966BC5608F27A3D005CB29B /* tk.test */,
+ F96888530AF7880C000797B5 /* ttk */,
+ F966BC5708F27A3D005CB29B /* unixButton.test */,
+ F966BC5808F27A3D005CB29B /* unixEmbed.test */,
+ F966BC5908F27A3D005CB29B /* unixFont.test */,
+ F966BC5A08F27A3D005CB29B /* unixMenu.test */,
+ F966BC5B08F27A3D005CB29B /* unixSelect.test */,
+ F966BC5C08F27A3D005CB29B /* unixWm.test */,
+ F966BC5D08F27A3D005CB29B /* util.test */,
+ F966BC5E08F27A3D005CB29B /* visual.test */,
+ F966BC5F08F27A3D005CB29B /* visual_bb.test */,
+ F966BC6008F27A3D005CB29B /* winButton.test */,
+ F966BC6108F27A3D005CB29B /* winClipboard.test */,
+ F966BC6208F27A3D005CB29B /* winDialog.test */,
+ F966BC6308F27A3D005CB29B /* window.test */,
+ F966BC6408F27A3D005CB29B /* winfo.test */,
+ F966BC6508F27A3D005CB29B /* winFont.test */,
+ F966BC6608F27A3D005CB29B /* winMenu.test */,
+ F966BC6708F27A3D005CB29B /* winSend.test */,
+ F966BC6808F27A3D005CB29B /* winWm.test */,
+ F966BC6908F27A3D005CB29B /* wm.test */,
+ F966BC6A08F27A3D005CB29B /* xmfbox.test */,
+ );
+ path = tests;
+ sourceTree = "<group>";
+ };
+ F966BC6B08F27A3D005CB29B /* unix */ = {
+ isa = PBXGroup;
+ children = (
+ F966BC6C08F27A3D005CB29B /* aclocal.m4 */,
+ F966BC6D08F27A3D005CB29B /* configure */,
+ F966BC6E08F27A3D005CB29B /* configure.in */,
+ F966BC6F08F27A3D005CB29B /* install-sh */,
+ F966BC7008F27A3D005CB29B /* installManPage */,
+ F966BC7108F27A3D005CB29B /* Makefile.in */,
+ F966BC7208F27A3D005CB29B /* README */,
+ F966BC7308F27A3D005CB29B /* tcl.m4 */,
+ F966BC7408F27A3D005CB29B /* tk.spec */,
+ F966BC7508F27A3D005CB29B /* tkAppInit.c */,
+ F966BC7608F27A3D005CB29B /* tkConfig.h.in */,
+ F966BC7708F27A3D005CB29B /* tkConfig.sh.in */,
+ F966BC7808F27A3D005CB29B /* tkUnix.c */,
+ F966BC7908F27A3D005CB29B /* tkUnix3d.c */,
+ F966BC7A08F27A3D005CB29B /* tkUnixButton.c */,
+ F966BC7B08F27A3D005CB29B /* tkUnixColor.c */,
+ F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */,
+ F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */,
+ F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */,
+ F966BC7F08F27A3D005CB29B /* tkUnixDialog.c */,
+ F966BC8008F27A3D005CB29B /* tkUnixDraw.c */,
+ F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */,
+ F966BC8208F27A3D005CB29B /* tkUnixEvent.c */,
+ F966BC8308F27A3D005CB29B /* tkUnixFocus.c */,
+ F966BC8408F27A3D005CB29B /* tkUnixFont.c */,
+ F966BC8508F27A3D005CB29B /* tkUnixInit.c */,
+ F966BC8608F27A3D005CB29B /* tkUnixInt.h */,
+ F966BC8708F27A3D005CB29B /* tkUnixKey.c */,
+ F966BC8808F27A3D005CB29B /* tkUnixMenu.c */,
+ F966BC8908F27A3D005CB29B /* tkUnixMenubu.c */,
+ F966BC8A08F27A3D005CB29B /* tkUnixPort.h */,
+ F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */,
+ F966BC8C08F27A3D005CB29B /* tkUnixScale.c */,
+ F966BC8D08F27A3D005CB29B /* tkUnixScrlbr.c */,
+ F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */,
+ F966BC8F08F27A3D005CB29B /* tkUnixSend.c */,
+ F966BC9008F27A3D005CB29B /* tkUnixWm.c */,
+ F966BC9108F27A3D005CB29B /* tkUnixXId.c */,
+ );
+ path = unix;
+ sourceTree = "<group>";
+ };
+ F966BC9208F27A3D005CB29B /* win */ = {
+ isa = PBXGroup;
+ children = (
+ F966BC9408F27A3D005CB29B /* aclocal.m4 */,
+ F966BC9508F27A3D005CB29B /* buildall.vc.bat */,
+ F966BC9608F27A3E005CB29B /* configure */,
+ F966BC9708F27A3E005CB29B /* configure.in */,
+ F966BC9808F27A3E005CB29B /* makefile.bc */,
+ F966BC9908F27A3E005CB29B /* Makefile.in */,
+ F966BC9A08F27A3E005CB29B /* makefile.vc */,
+ F966BC9B08F27A3E005CB29B /* mkd.bat */,
+ F966BC9C08F27A3E005CB29B /* nmakehlp.c */,
+ F966BC9D08F27A3E005CB29B /* rc */,
+ F966BCF308F27A3E005CB29B /* README */,
+ F966BCF408F27A3E005CB29B /* rmd.bat */,
+ F966BCF508F27A3F005CB29B /* rules.vc */,
+ F966BCF608F27A3F005CB29B /* stubs.c */,
+ F966BCF708F27A3F005CB29B /* tcl.m4 */,
+ F966BCF808F27A3F005CB29B /* tkConfig.sh.in */,
+ F966BCF908F27A3F005CB29B /* tkWin.h */,
+ F966BCFA08F27A3F005CB29B /* tkWin32Dll.c */,
+ F966BCFB08F27A3F005CB29B /* tkWin3d.c */,
+ F966BCFC08F27A3F005CB29B /* tkWinButton.c */,
+ F966BCFD08F27A3F005CB29B /* tkWinClipboard.c */,
+ F966BCFE08F27A3F005CB29B /* tkWinColor.c */,
+ F966BCFF08F27A3F005CB29B /* tkWinConfig.c */,
+ F966BD0008F27A3F005CB29B /* tkWinCursor.c */,
+ F966BD0108F27A3F005CB29B /* tkWinDefault.h */,
+ F966BD0208F27A3F005CB29B /* tkWinDialog.c */,
+ F966BD0308F27A3F005CB29B /* tkWinDraw.c */,
+ F966BD0408F27A3F005CB29B /* tkWinEmbed.c */,
+ F966BD0508F27A3F005CB29B /* tkWinFont.c */,
+ F966BD0708F27A3F005CB29B /* tkWinImage.c */,
+ F966BD0808F27A3F005CB29B /* tkWinInit.c */,
+ F966BD0908F27A3F005CB29B /* tkWinInt.h */,
+ F966BD0A08F27A3F005CB29B /* tkWinKey.c */,
+ F966BD0B08F27A3F005CB29B /* tkWinMenu.c */,
+ F966BD0C08F27A3F005CB29B /* tkWinPixmap.c */,
+ F966BD0D08F27A3F005CB29B /* tkWinPointer.c */,
+ F966BD0E08F27A3F005CB29B /* tkWinPort.h */,
+ F966BD0F08F27A3F005CB29B /* tkWinRegion.c */,
+ F966BD1008F27A3F005CB29B /* tkWinScrlbr.c */,
+ F966BD1108F27A3F005CB29B /* tkWinSend.c */,
+ F966BD1208F27A3F005CB29B /* tkWinSendCom.c */,
+ F966BD1308F27A3F005CB29B /* tkWinSendCom.h */,
+ F966BD1408F27A3F005CB29B /* tkWinTest.c */,
+ F966BD1508F27A3F005CB29B /* tkWinWindow.c */,
+ F966BD1608F27A3F005CB29B /* tkWinWm.c */,
+ F966BD1708F27A3F005CB29B /* tkWinX.c */,
+ F96888860AF78953000797B5 /* ttkWinMonitor.c */,
+ F96888870AF78953000797B5 /* ttkWinTheme.c */,
+ F96888880AF78953000797B5 /* ttkWinXPTheme.c */,
+ F966BD1808F27A3F005CB29B /* winMain.c */,
+ );
+ path = win;
+ sourceTree = "<group>";
+ };
+ F966BC9D08F27A3E005CB29B /* rc */ = {
+ isa = PBXGroup;
+ children = (
+ F966BCEE08F27A3E005CB29B /* tk.rc */,
+ F966BCEF08F27A3E005CB29B /* tk_base.rc */,
+ F966BCF208F27A3E005CB29B /* wish.rc */,
+ );
+ path = rc;
+ sourceTree = "<group>";
+ };
+ F966BD1908F27A3F005CB29B /* xlib */ = {
+ isa = PBXGroup;
+ children = (
+ F966BD1A08F27A3F005CB29B /* X11 */,
+ F966BD2308F27A3F005CB29B /* xbytes.h */,
+ F966BD2408F27A3F005CB29B /* xcolors.c */,
+ F966BD2508F27A3F005CB29B /* xdraw.c */,
+ F966BD2608F27A3F005CB29B /* xgc.c */,
+ F966BD2708F27A3F005CB29B /* ximage.c */,
+ F966BD2808F27A3F005CB29B /* xutil.c */,
+ );
+ path = xlib;
+ sourceTree = "<group>";
+ };
+ F966BD1A08F27A3F005CB29B /* X11 */ = {
+ isa = PBXGroup;
+ children = (
+ F966BD1B08F27A3F005CB29B /* cursorfont.h */,
+ F966BD1C08F27A3F005CB29B /* keysym.h */,
+ F966BD1D08F27A3F005CB29B /* keysymdef.h */,
+ F966BD1E08F27A3F005CB29B /* X.h */,
+ F966BD1F08F27A3F005CB29B /* Xatom.h */,
+ F966BD2008F27A3F005CB29B /* Xfuncproto.h */,
+ F966BD2108F27A3F005CB29B /* Xlib.h */,
+ F966BD2208F27A3F005CB29B /* Xutil.h */,
+ );
+ path = X11;
+ sourceTree = "<group>";
+ };
+ F966C06F08F281DC005CB29B /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ F966C07408F2820D005CB29B /* CoreFoundation.framework */,
+ F966C07608F2821B005CB29B /* Carbon.framework */,
+ F966C07808F28233005CB29B /* IOKit.framework */,
+ F9FD32140CC1AF170073837D /* libX11.dylib */,
+ F9FD32150CC1AF170073837D /* libXext.dylib */,
+ F9FD32160CC1AF170073837D /* libXss.dylib */,
+ F9FD349A0CC1BB0D0073837D /* libXft.dylib */,
+ F9FD34990CC1BB0D0073837D /* libfreetype.dylib */,
+ F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ F96887DF0AF786D5000797B5 /* ttk */ = {
+ isa = PBXGroup;
+ children = (
+ F96887E00AF786D5000797B5 /* ttk.decls */,
+ F96887E10AF786D5000797B5 /* ttkBlink.c */,
+ F96887E20AF786D5000797B5 /* ttkButton.c */,
+ F96887E30AF786D5000797B5 /* ttkCache.c */,
+ F96887E40AF786D5000797B5 /* ttkClamTheme.c */,
+ F96887E50AF786D5000797B5 /* ttkClassicTheme.c */,
+ F96887E60AF786D5000797B5 /* ttkDecls.h */,
+ F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */,
+ F96887E80AF786D5000797B5 /* ttkElements.c */,
+ F96887E90AF786D5000797B5 /* ttkEntry.c */,
+ F96887EA0AF786D5000797B5 /* ttkFrame.c */,
+ F96887EB0AF786D5000797B5 /* ttkImage.c */,
+ F96887EC0AF786D5000797B5 /* ttkInit.c */,
+ F96887ED0AF786D5000797B5 /* ttkLabel.c */,
+ F96887EE0AF786D5000797B5 /* ttkLayout.c */,
+ F96887EF0AF786D5000797B5 /* ttkManager.c */,
+ F96887F00AF786D5000797B5 /* ttkManager.h */,
+ F96887F10AF786D5000797B5 /* ttkNotebook.c */,
+ F96887F20AF786D5000797B5 /* ttkPanedwindow.c */,
+ F96887F30AF786D5000797B5 /* ttkProgress.c */,
+ F96887F40AF786D5000797B5 /* ttkScale.c */,
+ F96887F50AF786D5000797B5 /* ttkScroll.c */,
+ F96887F60AF786D5000797B5 /* ttkScrollbar.c */,
+ F96887F70AF786D5000797B5 /* ttkSeparator.c */,
+ F96887F80AF786D5000797B5 /* ttkSquare.c */,
+ F96887F90AF786D5000797B5 /* ttkState.c */,
+ F96887FA0AF786D5000797B5 /* ttkStubInit.c */,
+ F96887FB0AF786D5000797B5 /* ttkStubLib.c */,
+ F96887FC0AF786D5000797B5 /* ttkTagSet.c */,
+ F96887FD0AF786D5000797B5 /* ttkTheme.c */,
+ F96887FE0AF786D5000797B5 /* ttkTheme.h */,
+ F96887FF0AF786D5000797B5 /* ttkThemeInt.h */,
+ F96888000AF786D5000797B5 /* ttkTrace.c */,
+ F96888010AF786D5000797B5 /* ttkTrack.c */,
+ F96888020AF786D5000797B5 /* ttkTreeview.c */,
+ F96888030AF786D5000797B5 /* ttkWidget.c */,
+ F96888040AF786D5000797B5 /* ttkWidget.h */,
+ );
+ path = ttk;
+ sourceTree = "<group>";
+ };
+ F96888360AF787B3000797B5 /* ttk */ = {
+ isa = PBXGroup;
+ children = (
+ F96888370AF787B3000797B5 /* altTheme.tcl */,
+ F96888380AF787B3000797B5 /* aquaTheme.tcl */,
+ F96888390AF787B3000797B5 /* button.tcl */,
+ F968883A0AF787B3000797B5 /* clamTheme.tcl */,
+ F968883B0AF787B3000797B5 /* classicTheme.tcl */,
+ F968883C0AF787B3000797B5 /* combobox.tcl */,
+ F968883D0AF787B3000797B5 /* cursors.tcl */,
+ F968883E0AF787B3000797B5 /* defaults.tcl */,
+ F96888400AF787B3000797B5 /* entry.tcl */,
+ F96888410AF787B3000797B5 /* fonts.tcl */,
+ F96888440AF787B3000797B5 /* menubutton.tcl */,
+ F96888450AF787B3000797B5 /* notebook.tcl */,
+ F96888460AF787B3000797B5 /* panedwindow.tcl */,
+ F96888470AF787B3000797B5 /* progress.tcl */,
+ F96888480AF787B3000797B5 /* scale.tcl */,
+ F96888490AF787B3000797B5 /* scrollbar.tcl */,
+ F968884A0AF787B3000797B5 /* sizegrip.tcl */,
+ F968884B0AF787B3000797B5 /* treeview.tcl */,
+ F968884C0AF787B3000797B5 /* ttk.tcl */,
+ F968884D0AF787B3000797B5 /* utils.tcl */,
+ F968884E0AF787B3000797B5 /* winTheme.tcl */,
+ F968884F0AF787B3000797B5 /* xpTheme.tcl */,
+ );
+ path = ttk;
+ sourceTree = "<group>";
+ };
+ F96888530AF7880C000797B5 /* ttk */ = {
+ isa = PBXGroup;
+ children = (
+ F96888540AF7880C000797B5 /* all.tcl */,
+ F96888560AF7880C000797B5 /* combobox.test */,
+ F96888570AF7880C000797B5 /* entry.test */,
+ F96888580AF7880C000797B5 /* image.test */,
+ F96888590AF7880C000797B5 /* labelframe.test */,
+ F968885A0AF7880C000797B5 /* layout.test */,
+ F968885C0AF7880C000797B5 /* notebook.test */,
+ F968885D0AF7880C000797B5 /* panedwindow.test */,
+ F968885E0AF7880C000797B5 /* progressbar.test */,
+ F968885F0AF7880C000797B5 /* scrollbar.test */,
+ F96888600AF7880C000797B5 /* treetags.test */,
+ F96888610AF7880C000797B5 /* treeview.test */,
+ F96888620AF7880C000797B5 /* ttk.test */,
+ F96888630AF7880C000797B5 /* validate.test */,
+ F962F7C60DADC26200648DB8 /* vsapi.test */,
+ );
+ path = ttk;
+ sourceTree = "<group>";
+ };
+ F96D3DF608F27169004A47F5 /* Tcl Sources */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3EC908F272A7004A47F5 /* generic */,
+ F96D432C08F272B4004A47F5 /* macosx */,
+ F96D443E08F272B9004A47F5 /* unix */,
+ F96D425C08F272B2004A47F5 /* libtommath */,
+ F96D446E08F272B9004A47F5 /* win */,
+ F96D3F3808F272A7004A47F5 /* library */,
+ F96D434408F272B5004A47F5 /* tests */,
+ F96D3DFC08F272A4004A47F5 /* doc */,
+ F96D43D008F272B8004A47F5 /* tools */,
+ F96D3DFA08F272A4004A47F5 /* ChangeLog */,
+ F96D3DFB08F272A4004A47F5 /* changes */,
+ F96D434308F272B5004A47F5 /* README */,
+ F96D432B08F272B4004A47F5 /* license.terms */,
+ );
+ name = "Tcl Sources";
+ sourceTree = TCL_SRCROOT;
+ };
+ F96D3DF708F271BE004A47F5 /* Tk Sources */ = {
+ isa = PBXGroup;
+ children = (
+ F966BAA508F27A38005CB29B /* generic */,
+ F966BB9708F27A3B005CB29B /* macosx */,
+ F966BC6B08F27A3D005CB29B /* unix */,
+ F966BD1908F27A3F005CB29B /* xlib */,
+ F966BA0308F27A37005CB29B /* bitmaps */,
+ F966BC9208F27A3D005CB29B /* win */,
+ F966BB1308F27A39005CB29B /* library */,
+ F966BC0408F27A3C005CB29B /* tests */,
+ F966BA1008F27A37005CB29B /* doc */,
+ F966BA0E08F27A37005CB29B /* ChangeLog */,
+ F966BA0F08F27A37005CB29B /* changes */,
+ F966BC0308F27A3C005CB29B /* README */,
+ F966BB9608F27A3B005CB29B /* license.terms */,
+ );
+ name = "Tk Sources";
+ sourceTree = TK_SRCROOT;
+ };
+ F96D3DFC08F272A4004A47F5 /* doc */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3DFD08F272A4004A47F5 /* Access.3 */,
+ F96D3DFE08F272A4004A47F5 /* AddErrInfo.3 */,
+ F96D3DFF08F272A4004A47F5 /* after.n */,
+ F96D3E0008F272A4004A47F5 /* Alloc.3 */,
+ F96D3E0108F272A4004A47F5 /* AllowExc.3 */,
+ F96D3E0208F272A4004A47F5 /* append.n */,
+ F96D3E0308F272A4004A47F5 /* AppInit.3 */,
+ F96D3E0408F272A5004A47F5 /* array.n */,
+ F96D3E0508F272A5004A47F5 /* AssocData.3 */,
+ F96D3E0608F272A5004A47F5 /* Async.3 */,
+ F96D3E0708F272A5004A47F5 /* BackgdErr.3 */,
+ F96D3E0808F272A5004A47F5 /* Backslash.3 */,
+ F96D3E0908F272A5004A47F5 /* bgerror.n */,
+ F96D3E0A08F272A5004A47F5 /* binary.n */,
+ F96D3E0B08F272A5004A47F5 /* BoolObj.3 */,
+ F96D3E0C08F272A5004A47F5 /* break.n */,
+ F96D3E0D08F272A5004A47F5 /* ByteArrObj.3 */,
+ F96D3E0E08F272A5004A47F5 /* CallDel.3 */,
+ F96D3E0F08F272A5004A47F5 /* case.n */,
+ F96D3E1008F272A5004A47F5 /* catch.n */,
+ F96D3E1108F272A5004A47F5 /* cd.n */,
+ F96D3E1208F272A5004A47F5 /* chan.n */,
+ F96D3E1308F272A5004A47F5 /* ChnlStack.3 */,
+ F96D3E1408F272A5004A47F5 /* clock.n */,
+ F96D3E1508F272A5004A47F5 /* close.n */,
+ F96D3E1608F272A5004A47F5 /* CmdCmplt.3 */,
+ F96D3E1708F272A5004A47F5 /* Concat.3 */,
+ F96D3E1808F272A5004A47F5 /* concat.n */,
+ F96D3E1908F272A5004A47F5 /* continue.n */,
+ F96D3E1A08F272A5004A47F5 /* CrtChannel.3 */,
+ F96D3E1B08F272A5004A47F5 /* CrtChnlHdlr.3 */,
+ F96D3E1C08F272A5004A47F5 /* CrtCloseHdlr.3 */,
+ F96D3E1D08F272A5004A47F5 /* CrtCommand.3 */,
+ F96D3E1E08F272A5004A47F5 /* CrtFileHdlr.3 */,
+ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
+ F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
+ F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
+ F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
+ F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
+ F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
+ F96D3E2508F272A5004A47F5 /* dde.n */,
+ F96D3E2608F272A5004A47F5 /* DetachPids.3 */,
+ F96D3E2708F272A5004A47F5 /* dict.n */,
+ F96D3E2808F272A5004A47F5 /* DictObj.3 */,
+ F96D3E2908F272A5004A47F5 /* DoOneEvent.3 */,
+ F96D3E2A08F272A5004A47F5 /* DoubleObj.3 */,
+ F96D3E2B08F272A5004A47F5 /* DoWhenIdle.3 */,
+ F96D3E2C08F272A5004A47F5 /* DString.3 */,
+ F96D3E2D08F272A5004A47F5 /* DumpActiveMemory.3 */,
+ F96D3E2E08F272A5004A47F5 /* Encoding.3 */,
+ F96D3E2F08F272A5004A47F5 /* encoding.n */,
+ F96D3E3008F272A5004A47F5 /* Ensemble.3 */,
+ F96D3E3108F272A5004A47F5 /* Environment.3 */,
+ F96D3E3208F272A5004A47F5 /* eof.n */,
+ F96D3E3308F272A5004A47F5 /* error.n */,
+ F96D3E3408F272A5004A47F5 /* Eval.3 */,
+ F96D3E3508F272A5004A47F5 /* eval.n */,
+ F96D3E3608F272A5004A47F5 /* exec.n */,
+ F96D3E3708F272A5004A47F5 /* Exit.3 */,
+ F96D3E3808F272A5004A47F5 /* exit.n */,
+ F96D3E3908F272A5004A47F5 /* expr.n */,
+ F96D3E3A08F272A5004A47F5 /* ExprLong.3 */,
+ F96D3E3B08F272A5004A47F5 /* ExprLongObj.3 */,
+ F96D3E3C08F272A5004A47F5 /* fblocked.n */,
+ F96D3E3D08F272A5004A47F5 /* fconfigure.n */,
+ F96D3E3E08F272A5004A47F5 /* fcopy.n */,
+ F96D3E3F08F272A5004A47F5 /* file.n */,
+ F96D3E4008F272A5004A47F5 /* fileevent.n */,
+ F96D3E4108F272A5004A47F5 /* filename.n */,
+ F96D3E4208F272A5004A47F5 /* FileSystem.3 */,
+ F96D3E4308F272A5004A47F5 /* FindExec.3 */,
+ F96D3E4408F272A5004A47F5 /* flush.n */,
+ F96D3E4508F272A5004A47F5 /* for.n */,
+ F96D3E4608F272A5004A47F5 /* foreach.n */,
+ F96D3E4708F272A5004A47F5 /* format.n */,
+ F96D3E4808F272A5004A47F5 /* GetCwd.3 */,
+ F96D3E4908F272A5004A47F5 /* GetHostName.3 */,
+ F96D3E4A08F272A5004A47F5 /* GetIndex.3 */,
+ F96D3E4B08F272A5004A47F5 /* GetInt.3 */,
+ F96D3E4C08F272A5004A47F5 /* GetOpnFl.3 */,
+ F96D3E4D08F272A5004A47F5 /* gets.n */,
+ F96D3E4E08F272A5004A47F5 /* GetStdChan.3 */,
+ F96D3E4F08F272A5004A47F5 /* GetTime.3 */,
+ F96D3E5008F272A5004A47F5 /* GetVersion.3 */,
+ F96D3E5108F272A5004A47F5 /* glob.n */,
+ F96D3E5208F272A6004A47F5 /* global.n */,
+ F96D3E5308F272A6004A47F5 /* Hash.3 */,
+ F96D3E5408F272A6004A47F5 /* history.n */,
+ F96D3E5508F272A6004A47F5 /* http.n */,
+ F96D3E5608F272A6004A47F5 /* if.n */,
+ F96D3E5708F272A6004A47F5 /* incr.n */,
+ F96D3E5808F272A6004A47F5 /* info.n */,
+ F96D3E5908F272A6004A47F5 /* Init.3 */,
+ F96D3E5A08F272A6004A47F5 /* InitStubs.3 */,
+ F96D3E5B08F272A6004A47F5 /* Interp.3 */,
+ F96D3E5C08F272A6004A47F5 /* interp.n */,
+ F96D3E5D08F272A6004A47F5 /* IntObj.3 */,
+ F96D3E5E08F272A6004A47F5 /* join.n */,
+ F96D3E5F08F272A6004A47F5 /* lappend.n */,
+ F96D3E6008F272A6004A47F5 /* lassign.n */,
+ F96D3E6108F272A6004A47F5 /* library.n */,
+ F96D3E6208F272A6004A47F5 /* Limit.3 */,
+ F96D3E6308F272A6004A47F5 /* lindex.n */,
+ F96D3E6408F272A6004A47F5 /* LinkVar.3 */,
+ F96D3E6508F272A6004A47F5 /* linsert.n */,
+ F96D3E6608F272A6004A47F5 /* list.n */,
+ F96D3E6708F272A6004A47F5 /* ListObj.3 */,
+ F96D3E6808F272A6004A47F5 /* llength.n */,
+ F96D3E6908F272A6004A47F5 /* load.n */,
+ F96D3E6A08F272A6004A47F5 /* lrange.n */,
+ F96D3E6B08F272A6004A47F5 /* lrepeat.n */,
+ F96D3E6C08F272A6004A47F5 /* lreplace.n */,
+ F96D3E6D08F272A6004A47F5 /* lsearch.n */,
+ F96D3E6E08F272A6004A47F5 /* lset.n */,
+ F96D3E6F08F272A6004A47F5 /* lsort.n */,
+ F96D3E7008F272A6004A47F5 /* man.macros */,
+ F96D3E7108F272A6004A47F5 /* mathfunc.n */,
+ F96D3E7208F272A6004A47F5 /* memory.n */,
+ F96D3E7308F272A6004A47F5 /* msgcat.n */,
+ F96D3E7408F272A6004A47F5 /* Namespace.3 */,
+ F96D3E7508F272A6004A47F5 /* namespace.n */,
+ F96D3E7608F272A6004A47F5 /* Notifier.3 */,
+ F96D3E7708F272A6004A47F5 /* Object.3 */,
+ F96D3E7808F272A6004A47F5 /* ObjectType.3 */,
+ F96D3E7908F272A6004A47F5 /* open.n */,
+ F96D3E7A08F272A6004A47F5 /* OpenFileChnl.3 */,
+ F96D3E7B08F272A6004A47F5 /* OpenTcp.3 */,
+ F96D3E7C08F272A6004A47F5 /* package.n */,
+ F96D3E7D08F272A6004A47F5 /* packagens.n */,
+ F96D3E7E08F272A6004A47F5 /* Panic.3 */,
+ F96D3E7F08F272A6004A47F5 /* ParseCmd.3 */,
+ F96D3E8008F272A6004A47F5 /* pid.n */,
+ F96D3E8108F272A6004A47F5 /* pkgMkIndex.n */,
+ F96D3E8208F272A6004A47F5 /* PkgRequire.3 */,
+ F9ECB1E10B26543C00A28025 /* platform_shell.n */,
+ F9ECB1E20B26543C00A28025 /* platform.n */,
+ F96D3E8308F272A6004A47F5 /* Preserve.3 */,
+ F96D3E8408F272A6004A47F5 /* PrintDbl.3 */,
+ F96D3E8508F272A6004A47F5 /* proc.n */,
+ F96D3E8608F272A6004A47F5 /* puts.n */,
+ F96D3E8708F272A6004A47F5 /* pwd.n */,
+ F96D3E8808F272A6004A47F5 /* re_syntax.n */,
+ F96D3E8908F272A6004A47F5 /* read.n */,
+ F96D3E8A08F272A6004A47F5 /* RecEvalObj.3 */,
+ F96D3E8B08F272A6004A47F5 /* RecordEval.3 */,
+ F96D3E8C08F272A6004A47F5 /* RegConfig.3 */,
+ F96D3E8D08F272A6004A47F5 /* RegExp.3 */,
+ F96D3E8E08F272A6004A47F5 /* regexp.n */,
+ F96D3E8F08F272A6004A47F5 /* registry.n */,
+ F96D3E9008F272A6004A47F5 /* regsub.n */,
+ F96D3E9108F272A6004A47F5 /* rename.n */,
+ F96D3E9208F272A6004A47F5 /* return.n */,
+ F96D3E9308F272A6004A47F5 /* safe.n */,
+ F96D3E9408F272A6004A47F5 /* SaveResult.3 */,
+ F96D3E9508F272A6004A47F5 /* scan.n */,
+ F96D3E9608F272A6004A47F5 /* seek.n */,
+ F96D3E9708F272A6004A47F5 /* set.n */,
+ F96D3E9808F272A6004A47F5 /* SetChanErr.3 */,
+ F96D3E9908F272A6004A47F5 /* SetErrno.3 */,
+ F96D3E9A08F272A6004A47F5 /* SetRecLmt.3 */,
+ F96D3E9B08F272A7004A47F5 /* SetResult.3 */,
+ F96D3E9C08F272A7004A47F5 /* SetVar.3 */,
+ F96D3E9D08F272A7004A47F5 /* Signal.3 */,
+ F96D3E9E08F272A7004A47F5 /* Sleep.3 */,
+ F96D3E9F08F272A7004A47F5 /* socket.n */,
+ F96D3EA008F272A7004A47F5 /* source.n */,
+ F96D3EA108F272A7004A47F5 /* SourceRCFile.3 */,
+ F96D3EA208F272A7004A47F5 /* split.n */,
+ F96D3EA308F272A7004A47F5 /* SplitList.3 */,
+ F96D3EA408F272A7004A47F5 /* SplitPath.3 */,
+ F96D3EA508F272A7004A47F5 /* StaticPkg.3 */,
+ F96D3EA608F272A7004A47F5 /* StdChannels.3 */,
+ F96D3EA708F272A7004A47F5 /* string.n */,
+ F96D3EA808F272A7004A47F5 /* StringObj.3 */,
+ F96D3EA908F272A7004A47F5 /* StrMatch.3 */,
+ F96D3EAA08F272A7004A47F5 /* subst.n */,
+ F96D3EAB08F272A7004A47F5 /* SubstObj.3 */,
+ F96D3EAC08F272A7004A47F5 /* switch.n */,
+ F96D3EAD08F272A7004A47F5 /* Tcl.n */,
+ F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */,
+ F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */,
+ F96D3EB008F272A7004A47F5 /* tclsh.1 */,
+ F96D3EB108F272A7004A47F5 /* tcltest.n */,
+ F96D3EB208F272A7004A47F5 /* tclvars.n */,
+ F96D3EB308F272A7004A47F5 /* tell.n */,
+ F96D3EB408F272A7004A47F5 /* Thread.3 */,
+ F96D3EB508F272A7004A47F5 /* time.n */,
+ F96D3EB608F272A7004A47F5 /* tm.n */,
+ F96D3EB708F272A7004A47F5 /* ToUpper.3 */,
+ F96D3EB808F272A7004A47F5 /* trace.n */,
+ F96D3EB908F272A7004A47F5 /* TraceCmd.3 */,
+ F96D3EBA08F272A7004A47F5 /* TraceVar.3 */,
+ F96D3EBB08F272A7004A47F5 /* Translate.3 */,
+ F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */,
+ F96D3EBD08F272A7004A47F5 /* unknown.n */,
+ F96D3EBE08F272A7004A47F5 /* unload.n */,
+ F96D3EBF08F272A7004A47F5 /* unset.n */,
+ F96D3EC008F272A7004A47F5 /* update.n */,
+ F96D3EC108F272A7004A47F5 /* uplevel.n */,
+ F96D3EC208F272A7004A47F5 /* UpVar.3 */,
+ F96D3EC308F272A7004A47F5 /* upvar.n */,
+ F96D3EC408F272A7004A47F5 /* Utf.3 */,
+ F96D3EC508F272A7004A47F5 /* variable.n */,
+ F96D3EC608F272A7004A47F5 /* vwait.n */,
+ F96D3EC708F272A7004A47F5 /* while.n */,
+ F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */,
+ );
+ path = doc;
+ sourceTree = "<group>";
+ };
+ F96D3EC908F272A7004A47F5 /* generic */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3ECA08F272A7004A47F5 /* README */,
+ F96D3ECB08F272A7004A47F5 /* regc_color.c */,
+ F96D3ECC08F272A7004A47F5 /* regc_cvec.c */,
+ F96D3ECD08F272A7004A47F5 /* regc_lex.c */,
+ F96D3ECE08F272A7004A47F5 /* regc_locale.c */,
+ F96D3ECF08F272A7004A47F5 /* regc_nfa.c */,
+ F96D3ED008F272A7004A47F5 /* regcomp.c */,
+ F96D3ED108F272A7004A47F5 /* regcustom.h */,
+ F96D3ED208F272A7004A47F5 /* rege_dfa.c */,
+ F96D3ED308F272A7004A47F5 /* regerror.c */,
+ F96D3ED408F272A7004A47F5 /* regerrs.h */,
+ F96D3ED508F272A7004A47F5 /* regex.h */,
+ F96D3ED608F272A7004A47F5 /* regexec.c */,
+ F96D3ED708F272A7004A47F5 /* regfree.c */,
+ F96D3ED808F272A7004A47F5 /* regfronts.c */,
+ F96D3ED908F272A7004A47F5 /* regguts.h */,
+ F96D3EDA08F272A7004A47F5 /* tcl.decls */,
+ F96D3EDB08F272A7004A47F5 /* tcl.h */,
+ F96D3EDC08F272A7004A47F5 /* tclAlloc.c */,
+ F96D3EDD08F272A7004A47F5 /* tclAsync.c */,
+ F96D3EDE08F272A7004A47F5 /* tclBasic.c */,
+ F96D3EDF08F272A7004A47F5 /* tclBinary.c */,
+ F96D3EE008F272A7004A47F5 /* tclCkalloc.c */,
+ F96D3EE108F272A7004A47F5 /* tclClock.c */,
+ F96D3EE208F272A7004A47F5 /* tclCmdAH.c */,
+ F96D3EE308F272A7004A47F5 /* tclCmdIL.c */,
+ F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */,
+ F96D3EE508F272A7004A47F5 /* tclCompCmds.c */,
+ F96D3EE608F272A7004A47F5 /* tclCompExpr.c */,
+ F96D3EE708F272A7004A47F5 /* tclCompile.c */,
+ F96D3EE808F272A7004A47F5 /* tclCompile.h */,
+ F96D3EE908F272A7004A47F5 /* tclConfig.c */,
+ F96D3EEA08F272A7004A47F5 /* tclDate.c */,
+ F96D3EEB08F272A7004A47F5 /* tclDecls.h */,
+ F96D3EEC08F272A7004A47F5 /* tclDictObj.c */,
+ F96D3EED08F272A7004A47F5 /* tclEncoding.c */,
+ F96D3EEE08F272A7004A47F5 /* tclEnv.c */,
+ F96D3EEF08F272A7004A47F5 /* tclEvent.c */,
+ F96D3EF008F272A7004A47F5 /* tclExecute.c */,
+ F96D3EF108F272A7004A47F5 /* tclFCmd.c */,
+ F96D3EF208F272A7004A47F5 /* tclFileName.c */,
+ F96D3EF308F272A7004A47F5 /* tclFileSystem.h */,
+ F96D3EF408F272A7004A47F5 /* tclGet.c */,
+ F96D3EF508F272A7004A47F5 /* tclGetDate.y */,
+ F96D3EF608F272A7004A47F5 /* tclHash.c */,
+ F96D3EF708F272A7004A47F5 /* tclHistory.c */,
+ F96D3EF808F272A7004A47F5 /* tclIndexObj.c */,
+ F96D3EF908F272A7004A47F5 /* tclInt.decls */,
+ F96D3EFA08F272A7004A47F5 /* tclInt.h */,
+ F96D3EFB08F272A7004A47F5 /* tclIntDecls.h */,
+ F96D3EFC08F272A7004A47F5 /* tclInterp.c */,
+ F96D3EFD08F272A7004A47F5 /* tclIntPlatDecls.h */,
+ F96D3EFE08F272A7004A47F5 /* tclIO.c */,
+ F96D3EFF08F272A7004A47F5 /* tclIO.h */,
+ F96D3F0008F272A7004A47F5 /* tclIOCmd.c */,
+ F96D3F0108F272A7004A47F5 /* tclIOGT.c */,
+ F96D3F0208F272A7004A47F5 /* tclIORChan.c */,
+ F96D3F0308F272A7004A47F5 /* tclIOSock.c */,
+ F96D3F0408F272A7004A47F5 /* tclIOUtil.c */,
+ F96D3F0508F272A7004A47F5 /* tclLink.c */,
+ F96D3F0608F272A7004A47F5 /* tclListObj.c */,
+ F96D3F0708F272A7004A47F5 /* tclLiteral.c */,
+ F96D3F0808F272A7004A47F5 /* tclLoad.c */,
+ F96D3F0908F272A7004A47F5 /* tclLoadNone.c */,
+ F96D3F0A08F272A7004A47F5 /* tclMain.c */,
+ F96D3F0B08F272A7004A47F5 /* tclNamesp.c */,
+ F96D3F0C08F272A7004A47F5 /* tclNotify.c */,
+ F96D3F0D08F272A7004A47F5 /* tclObj.c */,
+ F96D3F0E08F272A7004A47F5 /* tclPanic.c */,
+ F96D3F0F08F272A7004A47F5 /* tclParse.c */,
+ F96D3F1108F272A7004A47F5 /* tclPathObj.c */,
+ F96D3F1208F272A7004A47F5 /* tclPipe.c */,
+ F96D3F1308F272A7004A47F5 /* tclPkg.c */,
+ F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */,
+ F96D3F1508F272A7004A47F5 /* tclPlatDecls.h */,
+ F96D3F1608F272A7004A47F5 /* tclPort.h */,
+ F96D3F1708F272A7004A47F5 /* tclPosixStr.c */,
+ F96D3F1808F272A7004A47F5 /* tclPreserve.c */,
+ F96D3F1908F272A7004A47F5 /* tclProc.c */,
+ F96D3F1A08F272A7004A47F5 /* tclRegexp.c */,
+ F96D3F1B08F272A7004A47F5 /* tclRegexp.h */,
+ F96D3F1C08F272A7004A47F5 /* tclResolve.c */,
+ F96D3F1D08F272A7004A47F5 /* tclResult.c */,
+ F96D3F1E08F272A7004A47F5 /* tclScan.c */,
+ F96D3F1F08F272A7004A47F5 /* tclStringObj.c */,
+ F96D3F2408F272A7004A47F5 /* tclStrToD.c */,
+ F96D3F2508F272A7004A47F5 /* tclStubInit.c */,
+ F96D3F2608F272A7004A47F5 /* tclStubLib.c */,
+ F96D3F2708F272A7004A47F5 /* tclTest.c */,
+ F96D3F2808F272A7004A47F5 /* tclTestObj.c */,
+ F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */,
+ F96D3F2A08F272A7004A47F5 /* tclThread.c */,
+ F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */,
+ F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */,
+ F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */,
+ F96D3F2E08F272A7004A47F5 /* tclThreadTest.c */,
+ F96D3F2F08F272A7004A47F5 /* tclTimer.c */,
+ F9903CAF094FAADA004613E9 /* tclTomMath.decls */,
+ F96D3F3008F272A7004A47F5 /* tclTomMath.h */,
+ F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */,
+ F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */,
+ F96D3F3208F272A7004A47F5 /* tclTrace.c */,
+ F96D3F3308F272A7004A47F5 /* tclUniData.c */,
+ F96D3F3408F272A7004A47F5 /* tclUtf.c */,
+ F96D3F3508F272A7004A47F5 /* tclUtil.c */,
+ F96D3F3608F272A7004A47F5 /* tclVar.c */,
+ F96D3F3708F272A7004A47F5 /* tommath.h */,
+ );
+ path = generic;
+ sourceTree = "<group>";
+ };
+ F96D3F3808F272A7004A47F5 /* library */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F3908F272A8004A47F5 /* auto.tcl */,
+ F96D3F3A08F272A8004A47F5 /* clock.tcl */,
+ F96D3F3B08F272A8004A47F5 /* dde */,
+ F96D3F8C08F272A8004A47F5 /* history.tcl */,
+ F96D3F8D08F272A8004A47F5 /* http */,
+ F96D3F9008F272A8004A47F5 /* http1.0 */,
+ F96D3F9308F272A8004A47F5 /* init.tcl */,
+ F96D3F9408F272A8004A47F5 /* msgcat */,
+ F96D401708F272AA004A47F5 /* opt */,
+ F96D401A08F272AA004A47F5 /* package.tcl */,
+ F96D401B08F272AA004A47F5 /* parray.tcl */,
+ F9ECB1110B26521500A28025 /* platform */,
+ F96D401C08F272AA004A47F5 /* reg */,
+ F96D401E08F272AA004A47F5 /* safe.tcl */,
+ F96D401F08F272AA004A47F5 /* tclIndex */,
+ F96D402008F272AA004A47F5 /* tcltest */,
+ F96D402308F272AA004A47F5 /* tm.tcl */,
+ F96D425B08F272B2004A47F5 /* word.tcl */,
+ );
+ path = library;
+ sourceTree = "<group>";
+ };
+ F96D3F3B08F272A8004A47F5 /* dde */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F3C08F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = dde;
+ sourceTree = "<group>";
+ };
+ F96D3F8D08F272A8004A47F5 /* http */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F8E08F272A8004A47F5 /* http.tcl */,
+ F96D3F8F08F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = http;
+ sourceTree = "<group>";
+ };
+ F96D3F9008F272A8004A47F5 /* http1.0 */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F9108F272A8004A47F5 /* http.tcl */,
+ F96D3F9208F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = http1.0;
+ sourceTree = "<group>";
+ };
+ F96D3F9408F272A8004A47F5 /* msgcat */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F9508F272A8004A47F5 /* msgcat.tcl */,
+ F96D3F9608F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = msgcat;
+ sourceTree = "<group>";
+ };
+ F96D401708F272AA004A47F5 /* opt */ = {
+ isa = PBXGroup;
+ children = (
+ F96D401808F272AA004A47F5 /* optparse.tcl */,
+ F96D401908F272AA004A47F5 /* pkgIndex.tcl */,
+ );
+ path = opt;
+ sourceTree = "<group>";
+ };
+ F96D401C08F272AA004A47F5 /* reg */ = {
+ isa = PBXGroup;
+ children = (
+ F96D401D08F272AA004A47F5 /* pkgIndex.tcl */,
+ );
+ path = reg;
+ sourceTree = "<group>";
+ };
+ F96D402008F272AA004A47F5 /* tcltest */ = {
+ isa = PBXGroup;
+ children = (
+ F96D402108F272AA004A47F5 /* pkgIndex.tcl */,
+ F96D402208F272AA004A47F5 /* tcltest.tcl */,
+ );
+ path = tcltest;
+ sourceTree = "<group>";
+ };
+ F96D425C08F272B2004A47F5 /* libtommath */ = {
+ isa = PBXGroup;
+ children = (
+ F96D425F08F272B3004A47F5 /* bn.pdf */,
+ F96D426108F272B3004A47F5 /* bn_error.c */,
+ F96D426208F272B3004A47F5 /* bn_fast_mp_invmod.c */,
+ F96D426308F272B3004A47F5 /* bn_fast_mp_montgomery_reduce.c */,
+ F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */,
+ F96D426508F272B3004A47F5 /* bn_fast_s_mp_mul_high_digs.c */,
+ F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */,
+ F96D426708F272B3004A47F5 /* bn_mp_2expt.c */,
+ F96D426808F272B3004A47F5 /* bn_mp_abs.c */,
+ F96D426908F272B3004A47F5 /* bn_mp_add.c */,
+ F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */,
+ F96D426B08F272B3004A47F5 /* bn_mp_addmod.c */,
+ F96D426C08F272B3004A47F5 /* bn_mp_and.c */,
+ F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */,
+ F96D426E08F272B3004A47F5 /* bn_mp_clear.c */,
+ F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */,
+ F96D427008F272B3004A47F5 /* bn_mp_cmp.c */,
+ F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */,
+ F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */,
+ F96D427308F272B3004A47F5 /* bn_mp_cnt_lsb.c */,
+ F96D427408F272B3004A47F5 /* bn_mp_copy.c */,
+ F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */,
+ F96D427608F272B3004A47F5 /* bn_mp_div.c */,
+ F96D427708F272B3004A47F5 /* bn_mp_div_2.c */,
+ F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */,
+ F96D427908F272B3004A47F5 /* bn_mp_div_3.c */,
+ F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */,
+ F96D427B08F272B3004A47F5 /* bn_mp_dr_is_modulus.c */,
+ F96D427C08F272B3004A47F5 /* bn_mp_dr_reduce.c */,
+ F96D427D08F272B3004A47F5 /* bn_mp_dr_setup.c */,
+ F96D427E08F272B3004A47F5 /* bn_mp_exch.c */,
+ F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */,
+ F96D428008F272B3004A47F5 /* bn_mp_exptmod.c */,
+ F96D428108F272B3004A47F5 /* bn_mp_exptmod_fast.c */,
+ F96D428208F272B3004A47F5 /* bn_mp_exteuclid.c */,
+ F96D428308F272B3004A47F5 /* bn_mp_fread.c */,
+ F96D428408F272B3004A47F5 /* bn_mp_fwrite.c */,
+ F96D428508F272B3004A47F5 /* bn_mp_gcd.c */,
+ F96D428608F272B3004A47F5 /* bn_mp_get_int.c */,
+ F96D428708F272B3004A47F5 /* bn_mp_grow.c */,
+ F96D428808F272B3004A47F5 /* bn_mp_init.c */,
+ F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */,
+ F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */,
+ F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */,
+ F96D428C08F272B3004A47F5 /* bn_mp_init_set_int.c */,
+ F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */,
+ F96D428E08F272B3004A47F5 /* bn_mp_invmod.c */,
+ F96D428F08F272B3004A47F5 /* bn_mp_invmod_slow.c */,
+ F96D429008F272B3004A47F5 /* bn_mp_is_square.c */,
+ F96D429108F272B3004A47F5 /* bn_mp_jacobi.c */,
+ F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */,
+ F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */,
+ F96D429408F272B3004A47F5 /* bn_mp_lcm.c */,
+ F96D429508F272B3004A47F5 /* bn_mp_lshd.c */,
+ F96D429608F272B3004A47F5 /* bn_mp_mod.c */,
+ F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */,
+ F96D429808F272B3004A47F5 /* bn_mp_mod_d.c */,
+ F96D429908F272B3004A47F5 /* bn_mp_montgomery_calc_normalization.c */,
+ F96D429A08F272B3004A47F5 /* bn_mp_montgomery_reduce.c */,
+ F96D429B08F272B3004A47F5 /* bn_mp_montgomery_setup.c */,
+ F96D429C08F272B3004A47F5 /* bn_mp_mul.c */,
+ F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */,
+ F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */,
+ F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */,
+ F96D42A008F272B3004A47F5 /* bn_mp_mulmod.c */,
+ F96D42A108F272B3004A47F5 /* bn_mp_n_root.c */,
+ F96D42A208F272B3004A47F5 /* bn_mp_neg.c */,
+ F96D42A308F272B3004A47F5 /* bn_mp_or.c */,
+ F96D42A408F272B3004A47F5 /* bn_mp_prime_fermat.c */,
+ F96D42A508F272B3004A47F5 /* bn_mp_prime_is_divisible.c */,
+ F96D42A608F272B3004A47F5 /* bn_mp_prime_is_prime.c */,
+ F96D42A708F272B3004A47F5 /* bn_mp_prime_miller_rabin.c */,
+ F96D42A808F272B3004A47F5 /* bn_mp_prime_next_prime.c */,
+ F96D42A908F272B3004A47F5 /* bn_mp_prime_rabin_miller_trials.c */,
+ F96D42AA08F272B3004A47F5 /* bn_mp_prime_random_ex.c */,
+ F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */,
+ F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */,
+ F96D42AD08F272B3004A47F5 /* bn_mp_rand.c */,
+ F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */,
+ F96D42AF08F272B3004A47F5 /* bn_mp_read_signed_bin.c */,
+ F96D42B008F272B3004A47F5 /* bn_mp_read_unsigned_bin.c */,
+ F96D42B108F272B3004A47F5 /* bn_mp_reduce.c */,
+ F96D42B208F272B3004A47F5 /* bn_mp_reduce_2k.c */,
+ F96D42B308F272B3004A47F5 /* bn_mp_reduce_2k_l.c */,
+ F96D42B408F272B3004A47F5 /* bn_mp_reduce_2k_setup.c */,
+ F96D42B508F272B3004A47F5 /* bn_mp_reduce_2k_setup_l.c */,
+ F96D42B608F272B3004A47F5 /* bn_mp_reduce_is_2k.c */,
+ F96D42B708F272B3004A47F5 /* bn_mp_reduce_is_2k_l.c */,
+ F96D42B808F272B3004A47F5 /* bn_mp_reduce_setup.c */,
+ F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */,
+ F96D42BA08F272B3004A47F5 /* bn_mp_set.c */,
+ F96D42BB08F272B3004A47F5 /* bn_mp_set_int.c */,
+ F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */,
+ F96D42BD08F272B3004A47F5 /* bn_mp_signed_bin_size.c */,
+ F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */,
+ F96D42BF08F272B3004A47F5 /* bn_mp_sqrmod.c */,
+ F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */,
+ F96D42C108F272B3004A47F5 /* bn_mp_sub.c */,
+ F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */,
+ F96D42C308F272B3004A47F5 /* bn_mp_submod.c */,
+ F96D42C408F272B3004A47F5 /* bn_mp_to_signed_bin.c */,
+ F96D42C508F272B3004A47F5 /* bn_mp_to_signed_bin_n.c */,
+ F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */,
+ F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */,
+ F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */,
+ F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */,
+ F96D42CA08F272B3004A47F5 /* bn_mp_toradix.c */,
+ F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */,
+ F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */,
+ F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */,
+ F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */,
+ F96D42CF08F272B3004A47F5 /* bn_prime_tab.c */,
+ F96D42D008F272B3004A47F5 /* bn_reverse.c */,
+ F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */,
+ F96D42D208F272B3004A47F5 /* bn_s_mp_exptmod.c */,
+ F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */,
+ F96D42D408F272B3004A47F5 /* bn_s_mp_mul_high_digs.c */,
+ F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */,
+ F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */,
+ F96D42D708F272B3004A47F5 /* bncore.c */,
+ F96D42D908F272B3004A47F5 /* callgraph.txt */,
+ F96D42DA08F272B3004A47F5 /* changes.txt */,
+ F96D42F008F272B3004A47F5 /* LICENSE */,
+ F96D431D08F272B4004A47F5 /* poster.pdf */,
+ F96D432608F272B4004A47F5 /* tommath.pdf */,
+ F96D432908F272B4004A47F5 /* tommath_class.h */,
+ F96D432A08F272B4004A47F5 /* tommath_superclass.h */,
+ );
+ path = libtommath;
+ sourceTree = "<group>";
+ };
+ F96D432C08F272B4004A47F5 /* macosx */ = {
+ isa = PBXGroup;
+ children = (
+ F96D432E08F272B5004A47F5 /* configure.ac */,
+ F96D432F08F272B5004A47F5 /* GNUmakefile */,
+ F96D433108F272B5004A47F5 /* README */,
+ F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */,
+ F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */,
+ F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */,
+ F96D433208F272B5004A47F5 /* Tcl-Info.plist.in */,
+ F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */,
+ );
+ path = macosx;
+ sourceTree = "<group>";
+ };
+ F96D434408F272B5004A47F5 /* tests */ = {
+ isa = PBXGroup;
+ children = (
+ F96D434508F272B5004A47F5 /* all.tcl */,
+ F96D434608F272B5004A47F5 /* append.test */,
+ F96D434708F272B5004A47F5 /* appendComp.test */,
+ F9ECB1CA0B2652D300A28025 /* apply.test */,
+ F96D434808F272B5004A47F5 /* assocd.test */,
+ F96D434908F272B5004A47F5 /* async.test */,
+ F96D434A08F272B5004A47F5 /* autoMkindex.test */,
+ F96D434B08F272B5004A47F5 /* basic.test */,
+ F96D434C08F272B5004A47F5 /* binary.test */,
+ F96D434D08F272B5004A47F5 /* case.test */,
+ F96D434E08F272B5004A47F5 /* chan.test */,
+ F9A493240CEBF38300B78AE2 /* chanio.test */,
+ F96D434F08F272B5004A47F5 /* clock.test */,
+ F96D435008F272B5004A47F5 /* cmdAH.test */,
+ F96D435108F272B5004A47F5 /* cmdIL.test */,
+ F96D435208F272B5004A47F5 /* cmdInfo.test */,
+ F96D435308F272B5004A47F5 /* cmdMZ.test */,
+ F96D435408F272B5004A47F5 /* compExpr-old.test */,
+ F96D435508F272B5004A47F5 /* compExpr.test */,
+ F96D435608F272B5004A47F5 /* compile.test */,
+ F96D435708F272B5004A47F5 /* concat.test */,
+ F96D435808F272B5004A47F5 /* config.test */,
+ F96D435908F272B5004A47F5 /* dcall.test */,
+ F96D435A08F272B5004A47F5 /* dict.test */,
+ F96D435C08F272B5004A47F5 /* dstring.test */,
+ F96D435E08F272B5004A47F5 /* encoding.test */,
+ F96D435F08F272B5004A47F5 /* env.test */,
+ F96D436008F272B5004A47F5 /* error.test */,
+ F96D436108F272B5004A47F5 /* eval.test */,
+ F96D436208F272B5004A47F5 /* event.test */,
+ F96D436308F272B5004A47F5 /* exec.test */,
+ F96D436408F272B5004A47F5 /* execute.test */,
+ F96D436508F272B5004A47F5 /* expr-old.test */,
+ F96D436608F272B5004A47F5 /* expr.test */,
+ F96D436708F272B6004A47F5 /* fCmd.test */,
+ F96D436808F272B6004A47F5 /* fileName.test */,
+ F96D436908F272B6004A47F5 /* fileSystem.test */,
+ F96D436A08F272B6004A47F5 /* for-old.test */,
+ F96D436B08F272B6004A47F5 /* for.test */,
+ F96D436C08F272B6004A47F5 /* foreach.test */,
+ F96D436D08F272B6004A47F5 /* format.test */,
+ F96D436E08F272B6004A47F5 /* get.test */,
+ F96D436F08F272B6004A47F5 /* history.test */,
+ F96D437008F272B6004A47F5 /* http.test */,
+ F96D437108F272B6004A47F5 /* httpd */,
+ F96D437208F272B6004A47F5 /* httpold.test */,
+ F96D437308F272B6004A47F5 /* if-old.test */,
+ F96D437408F272B6004A47F5 /* if.test */,
+ F96D437508F272B6004A47F5 /* incr-old.test */,
+ F96D437608F272B6004A47F5 /* incr.test */,
+ F96D437708F272B6004A47F5 /* indexObj.test */,
+ F96D437808F272B6004A47F5 /* info.test */,
+ F96D437908F272B6004A47F5 /* init.test */,
+ F96D437A08F272B6004A47F5 /* interp.test */,
+ F96D437B08F272B6004A47F5 /* io.test */,
+ F96D437C08F272B6004A47F5 /* ioCmd.test */,
+ F96D437D08F272B6004A47F5 /* iogt.test */,
+ F96D437E08F272B6004A47F5 /* ioUtil.test */,
+ F96D437F08F272B6004A47F5 /* join.test */,
+ F96D438008F272B6004A47F5 /* lindex.test */,
+ F96D438108F272B6004A47F5 /* link.test */,
+ F96D438208F272B6004A47F5 /* linsert.test */,
+ F96D438308F272B6004A47F5 /* list.test */,
+ F96D438408F272B6004A47F5 /* listObj.test */,
+ F96D438508F272B6004A47F5 /* llength.test */,
+ F96D438608F272B6004A47F5 /* load.test */,
+ F96D438708F272B6004A47F5 /* lrange.test */,
+ F96D438808F272B6004A47F5 /* lrepeat.test */,
+ F96D438908F272B6004A47F5 /* lreplace.test */,
+ F96D438A08F272B6004A47F5 /* lsearch.test */,
+ F96D438B08F272B6004A47F5 /* lset.test */,
+ F96D438C08F272B6004A47F5 /* lsetComp.test */,
+ F96D438D08F272B6004A47F5 /* macOSXFCmd.test */,
+ F95FAFF90B34F1130072E431 /* macOSXLoad.test */,
+ F96D438E08F272B6004A47F5 /* main.test */,
+ F9ECB1CB0B26534C00A28025 /* mathop.test */,
+ F96D438F08F272B6004A47F5 /* misc.test */,
+ F96D439008F272B6004A47F5 /* msgcat.test */,
+ F96D439108F272B6004A47F5 /* namespace-old.test */,
+ F96D439208F272B7004A47F5 /* namespace.test */,
+ F96D439308F272B7004A47F5 /* notify.test */,
+ F96D439408F272B7004A47F5 /* obj.test */,
+ F96D439508F272B7004A47F5 /* opt.test */,
+ F96D439608F272B7004A47F5 /* package.test */,
+ F96D439708F272B7004A47F5 /* parse.test */,
+ F96D439808F272B7004A47F5 /* parseExpr.test */,
+ F96D439908F272B7004A47F5 /* parseOld.test */,
+ F96D439A08F272B7004A47F5 /* pid.test */,
+ F96D439B08F272B7004A47F5 /* pkg.test */,
+ F96D439C08F272B7004A47F5 /* pkgMkIndex.test */,
+ F96D439D08F272B7004A47F5 /* platform.test */,
+ F96D439E08F272B7004A47F5 /* proc-old.test */,
+ F96D439F08F272B7004A47F5 /* proc.test */,
+ F96D43A008F272B7004A47F5 /* pwd.test */,
+ F96D43A108F272B7004A47F5 /* README */,
+ F96D43A208F272B7004A47F5 /* reg.test */,
+ F96D43A308F272B7004A47F5 /* regexp.test */,
+ F96D43A408F272B7004A47F5 /* regexpComp.test */,
+ F96D43A508F272B7004A47F5 /* registry.test */,
+ F96D43A608F272B7004A47F5 /* remote.tcl */,
+ F96D43A708F272B7004A47F5 /* rename.test */,
+ F96D43A808F272B7004A47F5 /* result.test */,
+ F96D43A908F272B7004A47F5 /* safe.test */,
+ F96D43AA08F272B7004A47F5 /* scan.test */,
+ F96D43AB08F272B7004A47F5 /* security.test */,
+ F96D43AC08F272B7004A47F5 /* set-old.test */,
+ F96D43AD08F272B7004A47F5 /* set.test */,
+ F96D43AE08F272B7004A47F5 /* socket.test */,
+ F96D43AF08F272B7004A47F5 /* source.test */,
+ F96D43B008F272B7004A47F5 /* split.test */,
+ F96D43B108F272B7004A47F5 /* stack.test */,
+ F96D43B208F272B7004A47F5 /* string.test */,
+ F96D43B308F272B7004A47F5 /* stringComp.test */,
+ F96D43B408F272B7004A47F5 /* stringObj.test */,
+ F96D43B508F272B7004A47F5 /* subst.test */,
+ F96D43B608F272B7004A47F5 /* switch.test */,
+ F96D43B708F272B7004A47F5 /* tcltest.test */,
+ F96D43B808F272B7004A47F5 /* thread.test */,
+ F96D43B908F272B7004A47F5 /* timer.test */,
+ F96D43BA08F272B7004A47F5 /* tm.test */,
+ F96D43BB08F272B7004A47F5 /* trace.test */,
+ F96D43BC08F272B7004A47F5 /* unixFCmd.test */,
+ F96D43BD08F272B7004A47F5 /* unixFile.test */,
+ F96D43BE08F272B7004A47F5 /* unixInit.test */,
+ F96D43BF08F272B7004A47F5 /* unixNotfy.test */,
+ F96D43C008F272B7004A47F5 /* unknown.test */,
+ F96D43C108F272B7004A47F5 /* unload.test */,
+ F96D43C208F272B7004A47F5 /* uplevel.test */,
+ F96D43C308F272B7004A47F5 /* upvar.test */,
+ F96D43C408F272B7004A47F5 /* utf.test */,
+ F96D43C508F272B7004A47F5 /* util.test */,
+ F96D43C608F272B7004A47F5 /* var.test */,
+ F96D43C708F272B7004A47F5 /* while-old.test */,
+ F96D43C808F272B7004A47F5 /* while.test */,
+ F96D43C908F272B7004A47F5 /* winConsole.test */,
+ F96D43CA08F272B7004A47F5 /* winDde.test */,
+ F96D43CB08F272B7004A47F5 /* winFCmd.test */,
+ F96D43CC08F272B7004A47F5 /* winFile.test */,
+ F96D43CD08F272B7004A47F5 /* winNotify.test */,
+ F96D43CE08F272B7004A47F5 /* winPipe.test */,
+ F96D43CF08F272B7004A47F5 /* winTime.test */,
+ );
+ path = tests;
+ sourceTree = "<group>";
+ };
+ F96D43D008F272B8004A47F5 /* tools */ = {
+ isa = PBXGroup;
+ children = (
+ F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */,
+ F96D43D208F272B8004A47F5 /* configure */,
+ F96D43D308F272B8004A47F5 /* configure.in */,
+ F96D442208F272B8004A47F5 /* eolFix.tcl */,
+ F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */,
+ F96D442508F272B8004A47F5 /* genStubs.tcl */,
+ F96D442708F272B8004A47F5 /* index.tcl */,
+ F96D442808F272B8004A47F5 /* installData.tcl */,
+ F96D442908F272B8004A47F5 /* loadICU.tcl */,
+ F96D442A08F272B8004A47F5 /* Makefile.in */,
+ F96D442B08F272B8004A47F5 /* makeTestCases.tcl */,
+ F96D442C08F272B8004A47F5 /* man2help.tcl */,
+ F96D442D08F272B8004A47F5 /* man2help2.tcl */,
+ F96D442E08F272B8004A47F5 /* man2html.tcl */,
+ F96D442F08F272B8004A47F5 /* man2html1.tcl */,
+ F96D443008F272B8004A47F5 /* man2html2.tcl */,
+ F96D443108F272B8004A47F5 /* man2tcl.c */,
+ F96D443208F272B8004A47F5 /* README */,
+ F96D443308F272B8004A47F5 /* regexpTestLib.tcl */,
+ F96D443408F272B8004A47F5 /* str2c */,
+ F96D443508F272B8004A47F5 /* tcl.hpj.in */,
+ F96D443608F272B8004A47F5 /* tcl.wse.in */,
+ F96D443708F272B9004A47F5 /* tclmin.wse */,
+ F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */,
+ F96D443A08F272B9004A47F5 /* tclZIC.tcl */,
+ F96D443B08F272B9004A47F5 /* uniClass.tcl */,
+ F96D443C08F272B9004A47F5 /* uniParse.tcl */,
+ );
+ path = tools;
+ sourceTree = "<group>";
+ };
+ F96D443E08F272B9004A47F5 /* unix */ = {
+ isa = PBXGroup;
+ children = (
+ F96D444008F272B9004A47F5 /* aclocal.m4 */,
+ F96D444108F272B9004A47F5 /* configure */,
+ F96D444208F272B9004A47F5 /* configure.in */,
+ F96D444308F272B9004A47F5 /* dltest */,
+ F96D444D08F272B9004A47F5 /* install-sh */,
+ F96D444E08F272B9004A47F5 /* installManPage */,
+ F96D444F08F272B9004A47F5 /* ldAix */,
+ F96D445008F272B9004A47F5 /* Makefile.in */,
+ F96D445208F272B9004A47F5 /* README */,
+ F96D445308F272B9004A47F5 /* tcl.m4 */,
+ F96D445408F272B9004A47F5 /* tcl.spec */,
+ F96D445508F272B9004A47F5 /* tclAppInit.c */,
+ F96D445608F272B9004A47F5 /* tclConfig.h.in */,
+ F96D445708F272B9004A47F5 /* tclConfig.sh.in */,
+ F96D445808F272B9004A47F5 /* tclLoadAix.c */,
+ F96D445908F272B9004A47F5 /* tclLoadDl.c */,
+ F96D445B08F272B9004A47F5 /* tclLoadDyld.c */,
+ F96D445C08F272B9004A47F5 /* tclLoadNext.c */,
+ F96D445D08F272B9004A47F5 /* tclLoadOSF.c */,
+ F96D445E08F272B9004A47F5 /* tclLoadShl.c */,
+ F96D445F08F272B9004A47F5 /* tclUnixChan.c */,
+ F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */,
+ F96D446008F272B9004A47F5 /* tclUnixEvent.c */,
+ F96D446108F272B9004A47F5 /* tclUnixFCmd.c */,
+ F96D446208F272B9004A47F5 /* tclUnixFile.c */,
+ F96D446308F272B9004A47F5 /* tclUnixInit.c */,
+ F96D446408F272B9004A47F5 /* tclUnixNotfy.c */,
+ F96D446508F272B9004A47F5 /* tclUnixPipe.c */,
+ F96D446608F272B9004A47F5 /* tclUnixPort.h */,
+ F96D446708F272B9004A47F5 /* tclUnixSock.c */,
+ F96D446808F272B9004A47F5 /* tclUnixTest.c */,
+ F96D446908F272B9004A47F5 /* tclUnixThrd.c */,
+ F96D446A08F272B9004A47F5 /* tclUnixThrd.h */,
+ F96D446B08F272B9004A47F5 /* tclUnixTime.c */,
+ F96D446C08F272B9004A47F5 /* tclXtNotify.c */,
+ F96D446D08F272B9004A47F5 /* tclXtTest.c */,
+ );
+ path = unix;
+ sourceTree = "<group>";
+ };
+ F96D444308F272B9004A47F5 /* dltest */ = {
+ isa = PBXGroup;
+ children = (
+ F96D444408F272B9004A47F5 /* Makefile.in */,
+ F96D444508F272B9004A47F5 /* pkga.c */,
+ F96D444608F272B9004A47F5 /* pkgb.c */,
+ F96D444708F272B9004A47F5 /* pkgc.c */,
+ F96D444808F272B9004A47F5 /* pkgd.c */,
+ F96D444908F272B9004A47F5 /* pkge.c */,
+ F96D444B08F272B9004A47F5 /* pkgua.c */,
+ F96D444C08F272B9004A47F5 /* README */,
+ );
+ path = dltest;
+ sourceTree = "<group>";
+ };
+ F96D446E08F272B9004A47F5 /* win */ = {
+ isa = PBXGroup;
+ children = (
+ F96D447008F272BA004A47F5 /* aclocal.m4 */,
+ F96D447108F272BA004A47F5 /* buildall.vc.bat */,
+ F96D447208F272BA004A47F5 /* cat.c */,
+ F96D447308F272BA004A47F5 /* coffbase.txt */,
+ F96D447408F272BA004A47F5 /* configure */,
+ F96D447508F272BA004A47F5 /* configure.in */,
+ F96D447608F272BA004A47F5 /* makefile.bc */,
+ F96D447708F272BA004A47F5 /* Makefile.in */,
+ F96D447808F272BA004A47F5 /* makefile.vc */,
+ F96D447908F272BA004A47F5 /* nmakehlp.c */,
+ F96D447A08F272BA004A47F5 /* README */,
+ F96D447C08F272BA004A47F5 /* rules.vc */,
+ F96D447D08F272BA004A47F5 /* stub16.c */,
+ F96D447E08F272BA004A47F5 /* tcl.dsp */,
+ F96D447F08F272BA004A47F5 /* tcl.dsw */,
+ F96D448008F272BA004A47F5 /* tcl.hpj.in */,
+ F96D448108F272BA004A47F5 /* tcl.m4 */,
+ F96D448208F272BA004A47F5 /* tcl.rc */,
+ F96D448308F272BA004A47F5 /* tclAppInit.c */,
+ F96D448408F272BA004A47F5 /* tclConfig.sh.in */,
+ F96D448608F272BA004A47F5 /* tclsh.rc */,
+ F96D448708F272BA004A47F5 /* tclWin32Dll.c */,
+ F96D448808F272BA004A47F5 /* tclWinChan.c */,
+ F96D448908F272BA004A47F5 /* tclWinConsole.c */,
+ F96D448A08F272BA004A47F5 /* tclWinDde.c */,
+ F96D448B08F272BA004A47F5 /* tclWinError.c */,
+ F96D448C08F272BA004A47F5 /* tclWinFCmd.c */,
+ F96D448D08F272BA004A47F5 /* tclWinFile.c */,
+ F96D448E08F272BA004A47F5 /* tclWinInit.c */,
+ F96D448F08F272BA004A47F5 /* tclWinInt.h */,
+ F96D449008F272BA004A47F5 /* tclWinLoad.c */,
+ F96D449108F272BA004A47F5 /* tclWinNotify.c */,
+ F96D449208F272BA004A47F5 /* tclWinPipe.c */,
+ F96D449308F272BA004A47F5 /* tclWinPort.h */,
+ F96D449408F272BA004A47F5 /* tclWinReg.c */,
+ F96D449508F272BA004A47F5 /* tclWinSerial.c */,
+ F96D449608F272BA004A47F5 /* tclWinSock.c */,
+ F96D449708F272BA004A47F5 /* tclWinTest.c */,
+ F96D449808F272BA004A47F5 /* tclWinThrd.c */,
+ F96D449908F272BA004A47F5 /* tclWinThrd.h */,
+ F96D449A08F272BA004A47F5 /* tclWinTime.c */,
+ );
+ path = win;
+ sourceTree = "<group>";
+ };
+ F9ECB1110B26521500A28025 /* platform */ = {
+ isa = PBXGroup;
+ children = (
+ F9ECB1120B26521500A28025 /* pkgIndex.tcl */,
+ F9ECB1130B26521500A28025 /* platform.tcl */,
+ F9ECB1140B26521500A28025 /* shell.tcl */,
+ );
+ path = platform;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8DD76FA90486AB0100D96B5E /* tktest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F95CC8B009158F3100EA5ACE /* Build configuration list for PBXNativeTarget "tktest" */;
+ buildPhases = (
+ F9A5C5F508F651A2008AE941 /* ShellScript */,
+ F9A5C5F608F651AB008AE941 /* ShellScript */,
+ F9EA4ADE08FA3B7F00B1F5F0 /* Rez */,
+ 8DD76FAB0486AB0100D96B5E /* Sources */,
+ 8DD76FAD0486AB0100D96B5E /* Frameworks */,
+ F95FA74C0B32CE190072E431 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = tktest;
+ productInstallPath = "$(BINDIR)";
+ productName = tktest;
+ productReference = 8DD76FB20486AB0100D96B5E /* tktest */;
+ productType = "com.apple.product-type.tool";
+ };
+ F97258A50A86873C00096C78 /* tktest-X11 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F97258A80A86873D00096C78 /* Build configuration list for PBXNativeTarget "tktest-X11" */;
+ buildPhases = (
+ F9FD30B40CC1AD070073837D /* ShellScript */,
+ F9FD30B50CC1AD070073837D /* ShellScript */,
+ F9FD30BB0CC1AD070073837D /* Sources */,
+ F9FD31E30CC1AD070073837D /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "tktest-X11";
+ productInstallPath = "$(BINDIR)";
+ productName = tktest;
+ productReference = F9FD31F40CC1AD070073837D /* tktest-X11 */;
+ productType = "com.apple.product-type.tool";
+ };
+ F9E61D16090A3E94002B3151 /* Tk */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F95CC8AB09158F3100EA5ACE /* Build configuration list for PBXNativeTarget "Tk" */;
+ buildPhases = (
+ F97AF02F0B665DA900310EA2 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Tk;
+ productName = Wish;
+ productReference = F9A3084B08F2D4CE00BAE1AB /* Wish.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = F95CC8B509158F3100EA5ACE /* Build configuration list for PBXProject "Wish" */;
+ hasScannedForEncodings = 1;
+ mainGroup = 08FB7794FE84155DC02AAC07 /* Wish */;
+ projectDirPath = "";
+ projectRoot = ..;
+ targets = (
+ F9E61D16090A3E94002B3151 /* Tk */,
+ 8DD76FA90486AB0100D96B5E /* tktest */,
+ F97258A50A86873C00096C78 /* tktest-X11 */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXRezBuildPhase section */
+ F9EA4ADE08FA3B7F00B1F5F0 /* Rez */ = {
+ isa = PBXRezBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9EA4AF008FA3BD500B1F5F0 /* tkMacOSXXCursors.r in Rez */,
+ F9EA4AF208FA3BD800B1F5F0 /* tkMacOSXCursors.r in Rez */,
+ F9EA4AF308FA3BDA00B1F5F0 /* tkMacOSXAETE.r in Rez */,
+ F9EA4AF408FA3BDB00B1F5F0 /* tkAboutDlg.r in Rez */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ F95FA74C0B32CE190072E431 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)",
+ "$(REZ_COLLECTOR_DIR)/$(PRODUCT_NAME).rsrc",
+ );
+ outputPaths = (
+ "$(TARGET_TEMP_DIR)/stamp",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "touch -t $(date -r $(expr $(date '+%s') + 5) '+%Y%m%d%H%M.%S') \"${TARGET_TEMP_DIR}/stamp\"\n\n## Xcode bug workaround: Rezzing does not take place for commandline tool targets\n## even when a ResourceManager Resources phase is present, but this script phase's\n## input dependency on the final merged resource file forces the Rezzing.\n\nif [ \"${ZERO_LINK}\" = \"YES\" ]; then\n ## ZeroLinking ignores OTHER_LDFLAGS, so our resource file doesn't get linked into the executable.\n ## workaround: copy resource data into resource fork of zerolink launcher (will only work on HFS+).\n cp -f \"${SCRIPT_INPUT_FILE_1}\" \"${SCRIPT_INPUT_FILE_0}/..namedfork/rsrc\"\nfi\n";
+ };
+ F97AF02F0B665DA900310EA2 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${TARGET_TEMP_DIR}/.none",
+ );
+ outputPaths = (
+ "${TARGET_BUILD_DIR}/${WRAPPER_NAME}",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "gnumake -C \"${TK_SRCROOT}/macosx\" -j \"$(sysctl -n hw.activecpu)\" \"$(echo \"${ACTION}\" | sed -e s/build// -e s/clean/distclean/ -e s/..\\*/\\&-/)${MAKE_TARGET}\" CFLAGS_WARNING=\"${WARNING_CFLAGS}\" CFLAGS_OPTIMIZE=\"-O${GCC_OPTIMIZATION_LEVEL}\" SYMROOT=\"${BUILT_PRODUCTS_DIR}\" OBJ_DIR=\"${OBJECT_FILE_DIR}\" INSTALL_ROOT=\"${DSTROOT}\" PREFIX=\"${PREFIX}\" BINDIR=\"${BINDIR}\" LIBDIR=\"${FRAMEWORK_INSTALL_PATH}\" MANDIR=\"${MANDIR}\" EXTRA_CONFIGURE_ARGS=\"${CONFIGURE_ARGS}\" APPLICATION_INSTALL_PATH=\"${APPLICATION_INSTALL_PATH}\" TCL_BUILD_DIR=\"${TCL_BUILD_DIR}\" TCL_FRAMEWORK_DIR=\"${TCL_FRAMEWORK_DIR}\" ${EXTRA_MAKE_FLAGS}\nresult=$?\nif [ -e \"${BUILT_PRODUCTS_DIR}/tktest\" ]; then\n\trm -f \"${BUILT_PRODUCTS_DIR}/tktest\"\nfi\necho \"Done\"\nrm -f \"${SCRIPT_INPUT_FILE_0}\"\nexit ${result}\n";
+ };
+ F9A5C5F508F651A2008AE941 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TCL_SRCROOT)/macosx/configure.ac",
+ "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/tcl.m4",
+ "$(TCL_SRCROOT)/unix/aclocal.m4",
+ "$(TCL_SRCROOT)/unix/tclConfig.sh.in",
+ "$(TCL_SRCROOT)/unix/Makefile.in",
+ "$(TCL_SRCROOT)/unix/dltest/Makefile.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ };
+ F9A5C5F608F651AB008AE941 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/tcl.m4",
+ "$(TK_SRCROOT)/unix/aclocal.m4",
+ "$(TK_SRCROOT)/unix/tkConfig.sh.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tk/tkConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ };
+ F9FD30B40CC1AD070073837D /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TCL_SRCROOT)/macosx/configure.ac",
+ "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/tcl.m4",
+ "$(TCL_SRCROOT)/unix/aclocal.m4",
+ "$(TCL_SRCROOT)/unix/tclConfig.sh.in",
+ "$(TCL_SRCROOT)/unix/Makefile.in",
+ "$(TCL_SRCROOT)/unix/dltest/Makefile.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ };
+ F9FD30B50CC1AD070073837D /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/tcl.m4",
+ "$(TK_SRCROOT)/unix/aclocal.m4",
+ "$(TK_SRCROOT)/unix/tkConfig.sh.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tk/tkConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation --enable-xft --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8DD76FAB0486AB0100D96B5E /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F96D456F08F272BB004A47F5 /* regcomp.c in Sources */,
+ F96D457208F272BB004A47F5 /* regerror.c in Sources */,
+ F96D457508F272BB004A47F5 /* regexec.c in Sources */,
+ F96D457608F272BB004A47F5 /* regfree.c in Sources */,
+ F96D457B08F272BB004A47F5 /* tclAlloc.c in Sources */,
+ F96D457C08F272BB004A47F5 /* tclAsync.c in Sources */,
+ F96D457D08F272BB004A47F5 /* tclBasic.c in Sources */,
+ F96D457E08F272BC004A47F5 /* tclBinary.c in Sources */,
+ F96D457F08F272BC004A47F5 /* tclCkalloc.c in Sources */,
+ F96D458008F272BC004A47F5 /* tclClock.c in Sources */,
+ F96D458108F272BC004A47F5 /* tclCmdAH.c in Sources */,
+ F96D458208F272BC004A47F5 /* tclCmdIL.c in Sources */,
+ F96D458308F272BC004A47F5 /* tclCmdMZ.c in Sources */,
+ F96D458408F272BC004A47F5 /* tclCompCmds.c in Sources */,
+ F96D458508F272BC004A47F5 /* tclCompExpr.c in Sources */,
+ F96D458608F272BC004A47F5 /* tclCompile.c in Sources */,
+ F96D458808F272BC004A47F5 /* tclConfig.c in Sources */,
+ F96D458908F272BC004A47F5 /* tclDate.c in Sources */,
+ F96D458B08F272BC004A47F5 /* tclDictObj.c in Sources */,
+ F96D458C08F272BC004A47F5 /* tclEncoding.c in Sources */,
+ F96D458D08F272BC004A47F5 /* tclEnv.c in Sources */,
+ F96D458E08F272BC004A47F5 /* tclEvent.c in Sources */,
+ F96D458F08F272BC004A47F5 /* tclExecute.c in Sources */,
+ F96D459008F272BC004A47F5 /* tclFCmd.c in Sources */,
+ F96D459108F272BC004A47F5 /* tclFileName.c in Sources */,
+ F96D459308F272BC004A47F5 /* tclGet.c in Sources */,
+ F96D459508F272BC004A47F5 /* tclHash.c in Sources */,
+ F96D459608F272BC004A47F5 /* tclHistory.c in Sources */,
+ F96D459708F272BC004A47F5 /* tclIndexObj.c in Sources */,
+ F96D459B08F272BC004A47F5 /* tclInterp.c in Sources */,
+ F96D459D08F272BC004A47F5 /* tclIO.c in Sources */,
+ F96D459F08F272BC004A47F5 /* tclIOCmd.c in Sources */,
+ F96D45A008F272BC004A47F5 /* tclIOGT.c in Sources */,
+ F96D45A108F272BC004A47F5 /* tclIORChan.c in Sources */,
+ F96D45A208F272BC004A47F5 /* tclIOSock.c in Sources */,
+ F96D45A308F272BC004A47F5 /* tclIOUtil.c in Sources */,
+ F96D45A408F272BC004A47F5 /* tclLink.c in Sources */,
+ F96D45A508F272BC004A47F5 /* tclListObj.c in Sources */,
+ F96D45A608F272BC004A47F5 /* tclLiteral.c in Sources */,
+ F96D45A708F272BC004A47F5 /* tclLoad.c in Sources */,
+ F96D45A908F272BC004A47F5 /* tclMain.c in Sources */,
+ F96D45AA08F272BC004A47F5 /* tclNamesp.c in Sources */,
+ F96D45AB08F272BC004A47F5 /* tclNotify.c in Sources */,
+ F96D45AC08F272BC004A47F5 /* tclObj.c in Sources */,
+ F96D45AD08F272BC004A47F5 /* tclPanic.c in Sources */,
+ F96D45AE08F272BC004A47F5 /* tclParse.c in Sources */,
+ F96D45B008F272BC004A47F5 /* tclPathObj.c in Sources */,
+ F96D45B108F272BC004A47F5 /* tclPipe.c in Sources */,
+ F96D45B208F272BC004A47F5 /* tclPkg.c in Sources */,
+ F96D45B308F272BC004A47F5 /* tclPkgConfig.c in Sources */,
+ F96D45B608F272BC004A47F5 /* tclPosixStr.c in Sources */,
+ F96D45B708F272BC004A47F5 /* tclPreserve.c in Sources */,
+ F96D45B808F272BC004A47F5 /* tclProc.c in Sources */,
+ F96D45B908F272BC004A47F5 /* tclRegexp.c in Sources */,
+ F96D45BB08F272BC004A47F5 /* tclResolve.c in Sources */,
+ F96D45BC08F272BC004A47F5 /* tclResult.c in Sources */,
+ F96D45BD08F272BC004A47F5 /* tclScan.c in Sources */,
+ F96D45BE08F272BC004A47F5 /* tclStringObj.c in Sources */,
+ F96D45C308F272BC004A47F5 /* tclStrToD.c in Sources */,
+ F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */,
+ F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */,
+ F96D45C908F272BC004A47F5 /* tclThread.c in Sources */,
+ F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */,
+ F96D45CB08F272BC004A47F5 /* tclThreadJoin.c in Sources */,
+ F96D45CC08F272BC004A47F5 /* tclThreadStorage.c in Sources */,
+ F96D45CE08F272BC004A47F5 /* tclTimer.c in Sources */,
+ F96D45D008F272BC004A47F5 /* tclTomMathInterface.c in Sources */,
+ F96D45D108F272BC004A47F5 /* tclTrace.c in Sources */,
+ F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */,
+ F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */,
+ F96D45D508F272BC004A47F5 /* tclVar.c in Sources */,
+ F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */,
+ F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */,
+ F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */,
+ F96D48E808F272C3004A47F5 /* bn_mp_add_d.c in Sources */,
+ F9E61D2B090A48A4002B3151 /* bn_mp_and.c in Sources */,
+ F96D48EB08F272C3004A47F5 /* bn_mp_clamp.c in Sources */,
+ F96D48EC08F272C3004A47F5 /* bn_mp_clear.c in Sources */,
+ F96D48ED08F272C3004A47F5 /* bn_mp_clear_multi.c in Sources */,
+ F96D48EE08F272C3004A47F5 /* bn_mp_cmp.c in Sources */,
+ F9E61D28090A481F002B3151 /* bn_mp_cmp_d.c in Sources */,
+ F96D48F008F272C3004A47F5 /* bn_mp_cmp_mag.c in Sources */,
+ F96D48F208F272C3004A47F5 /* bn_mp_copy.c in Sources */,
+ F96D48F308F272C3004A47F5 /* bn_mp_count_bits.c in Sources */,
+ F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */,
+ F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */,
+ F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */,
+ F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */,
+ F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */,
+ F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */,
+ F9E61D2C090A48AC002B3151 /* bn_mp_expt_d.c in Sources */,
+ F96D490508F272C3004A47F5 /* bn_mp_grow.c in Sources */,
+ F96D490608F272C3004A47F5 /* bn_mp_init.c in Sources */,
+ F96D490708F272C3004A47F5 /* bn_mp_init_copy.c in Sources */,
+ F96D490808F272C3004A47F5 /* bn_mp_init_multi.c in Sources */,
+ F96D490908F272C3004A47F5 /* bn_mp_init_set.c in Sources */,
+ F96D490B08F272C3004A47F5 /* bn_mp_init_size.c in Sources */,
+ F96D491008F272C3004A47F5 /* bn_mp_karatsuba_mul.c in Sources */,
+ F96D491108F272C3004A47F5 /* bn_mp_karatsuba_sqr.c in Sources */,
+ F96D491308F272C3004A47F5 /* bn_mp_lshd.c in Sources */,
+ F96D491408F272C3004A47F5 /* bn_mp_mod.c in Sources */,
+ F96D491508F272C3004A47F5 /* bn_mp_mod_2d.c in Sources */,
+ F96D491A08F272C3004A47F5 /* bn_mp_mul.c in Sources */,
+ F96D491B08F272C3004A47F5 /* bn_mp_mul_2.c in Sources */,
+ F96D491C08F272C3004A47F5 /* bn_mp_mul_2d.c in Sources */,
+ F96D491D08F272C3004A47F5 /* bn_mp_mul_d.c in Sources */,
+ F9E61D29090A486C002B3151 /* bn_mp_neg.c in Sources */,
+ F9E61D2E090A48BF002B3151 /* bn_mp_or.c in Sources */,
+ F96D492908F272C3004A47F5 /* bn_mp_radix_size.c in Sources */,
+ F96D492A08F272C3004A47F5 /* bn_mp_radix_smap.c in Sources */,
+ F96D492C08F272C3004A47F5 /* bn_mp_read_radix.c in Sources */,
+ F96D493708F272C3004A47F5 /* bn_mp_rshd.c in Sources */,
+ F96D493808F272C3004A47F5 /* bn_mp_set.c in Sources */,
+ F9E61D2F090A48C7002B3151 /* bn_mp_shrink.c in Sources */,
+ F96D493C08F272C3004A47F5 /* bn_mp_sqr.c in Sources */,
+ F9E61D2A090A4891002B3151 /* bn_mp_sqrt.c in Sources */,
+ F96D493F08F272C3004A47F5 /* bn_mp_sub.c in Sources */,
+ F96D494008F272C3004A47F5 /* bn_mp_sub_d.c in Sources */,
+ F9E61D30090A48E2002B3151 /* bn_mp_to_unsigned_bin_n.c in Sources */,
+ F9E61D31090A48F9002B3151 /* bn_mp_to_unsigned_bin.c in Sources */,
+ F96D494608F272C3004A47F5 /* bn_mp_toom_mul.c in Sources */,
+ F96D494708F272C3004A47F5 /* bn_mp_toom_sqr.c in Sources */,
+ F96D494908F272C3004A47F5 /* bn_mp_toradix_n.c in Sources */,
+ F9E61D32090A48FA002B3151 /* bn_mp_unsigned_bin_size.c in Sources */,
+ F9E61D2D090A48BB002B3151 /* bn_mp_xor.c in Sources */,
+ F96D494C08F272C3004A47F5 /* bn_mp_zero.c in Sources */,
+ F96D494E08F272C3004A47F5 /* bn_reverse.c in Sources */,
+ F96D494F08F272C3004A47F5 /* bn_s_mp_add.c in Sources */,
+ F96D495108F272C3004A47F5 /* bn_s_mp_mul_digs.c in Sources */,
+ F96D495308F272C3004A47F5 /* bn_s_mp_sqr.c in Sources */,
+ F96D495408F272C3004A47F5 /* bn_s_mp_sub.c in Sources */,
+ F96D495508F272C3004A47F5 /* bncore.c in Sources */,
+ F96D49A908F272C4004A47F5 /* tclMacOSXBundle.c in Sources */,
+ F96D49AD08F272C4004A47F5 /* tclMacOSXFCmd.c in Sources */,
+ F96D49AE08F272C4004A47F5 /* tclMacOSXNotify.c in Sources */,
+ F96D4AC608F272C9004A47F5 /* tclLoadDyld.c in Sources */,
+ F96D4ACA08F272C9004A47F5 /* tclUnixChan.c in Sources */,
+ F9FC77B80AB29E9100B7077D /* tclUnixCompat.c in Sources */,
+ F96D4ACB08F272C9004A47F5 /* tclUnixEvent.c in Sources */,
+ F96D4ACC08F272C9004A47F5 /* tclUnixFCmd.c in Sources */,
+ F96D4ACD08F272C9004A47F5 /* tclUnixFile.c in Sources */,
+ F96D4ACE08F272C9004A47F5 /* tclUnixInit.c in Sources */,
+ F96D4ACF08F272C9004A47F5 /* tclUnixNotfy.c in Sources */,
+ F96D4AD008F272C9004A47F5 /* tclUnixPipe.c in Sources */,
+ F96D4AD208F272CA004A47F5 /* tclUnixSock.c in Sources */,
+ F96D4AD408F272CA004A47F5 /* tclUnixThrd.c in Sources */,
+ F96D4AD608F272CA004A47F5 /* tclUnixTime.c in Sources */,
+ F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */,
+ F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */,
+ F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */,
+ F966BDD308F27A3F005CB29B /* tkBind.c in Sources */,
+ F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */,
+ F966BDD508F27A3F005CB29B /* tkButton.c in Sources */,
+ F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */,
+ F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */,
+ F966BDDA08F27A3F005CB29B /* tkCanvBmap.c in Sources */,
+ F966BDDB08F27A3F005CB29B /* tkCanvImg.c in Sources */,
+ F966BDDC08F27A3F005CB29B /* tkCanvLine.c in Sources */,
+ F966BDDD08F27A3F005CB29B /* tkCanvPoly.c in Sources */,
+ F966BDDE08F27A3F005CB29B /* tkCanvPs.c in Sources */,
+ F966BDE008F27A3F005CB29B /* tkCanvText.c in Sources */,
+ F966BDE108F27A3F005CB29B /* tkCanvUtil.c in Sources */,
+ F966BDE208F27A3F005CB29B /* tkCanvWind.c in Sources */,
+ F966BDE308F27A3F005CB29B /* tkClipboard.c in Sources */,
+ F966BDE408F27A3F005CB29B /* tkCmds.c in Sources */,
+ F966BDE508F27A3F005CB29B /* tkColor.c in Sources */,
+ F966BDE708F27A3F005CB29B /* tkConfig.c in Sources */,
+ F966BDE808F27A3F005CB29B /* tkConsole.c in Sources */,
+ F966BDE908F27A3F005CB29B /* tkCursor.c in Sources */,
+ F966BDEB08F27A3F005CB29B /* tkEntry.c in Sources */,
+ F966BDED08F27A3F005CB29B /* tkError.c in Sources */,
+ F966BDEE08F27A3F005CB29B /* tkEvent.c in Sources */,
+ F966BDEF08F27A3F005CB29B /* tkFileFilter.c in Sources */,
+ F966BDF108F27A3F005CB29B /* tkFocus.c in Sources */,
+ F966BDF208F27A3F005CB29B /* tkFont.c in Sources */,
+ F966BDF408F27A3F005CB29B /* tkFrame.c in Sources */,
+ F966BDF508F27A3F005CB29B /* tkGC.c in Sources */,
+ F966BDF608F27A3F005CB29B /* tkGeometry.c in Sources */,
+ F966BDF708F27A3F005CB29B /* tkGet.c in Sources */,
+ F966BDF808F27A3F005CB29B /* tkGrab.c in Sources */,
+ F966BDF908F27A3F005CB29B /* tkGrid.c in Sources */,
+ F966BDFA08F27A3F005CB29B /* tkImage.c in Sources */,
+ F966BDFB08F27A3F005CB29B /* tkImgBmap.c in Sources */,
+ F966BDFC08F27A3F005CB29B /* tkImgGIF.c in Sources */,
+ F966BDFD08F27A3F005CB29B /* tkImgPhoto.c in Sources */,
+ F966BDFE08F27A3F005CB29B /* tkImgPPM.c in Sources */,
+ F966BE0708F27A3F005CB29B /* tkListbox.c in Sources */,
+ F966BE0808F27A3F005CB29B /* tkMacWinMenu.c in Sources */,
+ F966BE0908F27A3F005CB29B /* tkMain.c in Sources */,
+ F966BE0A08F27A3F005CB29B /* tkMenu.c in Sources */,
+ F966BE0C08F27A3F005CB29B /* tkMenubutton.c in Sources */,
+ F966BE0E08F27A3F005CB29B /* tkMenuDraw.c in Sources */,
+ F966BE0F08F27A3F005CB29B /* tkMessage.c in Sources */,
+ F966BE1008F27A3F005CB29B /* tkObj.c in Sources */,
+ F966BE1108F27A3F005CB29B /* tkOldConfig.c in Sources */,
+ F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */,
+ F966BE1208F27A3F005CB29B /* tkOption.c in Sources */,
+ F966BE1308F27A3F005CB29B /* tkPack.c in Sources */,
+ F966BE1408F27A3F005CB29B /* tkPanedWindow.c in Sources */,
+ F966BE1508F27A3F005CB29B /* tkPlace.c in Sources */,
+ F966BE1708F27A3F005CB29B /* tkPointer.c in Sources */,
+ F966BE1908F27A3F005CB29B /* tkRectOval.c in Sources */,
+ F966BE1A08F27A3F005CB29B /* tkScale.c in Sources */,
+ F966BE1C08F27A40005CB29B /* tkScrollbar.c in Sources */,
+ F966BE1E08F27A40005CB29B /* tkSelect.c in Sources */,
+ F966BE2008F27A40005CB29B /* tkSquare.c in Sources */,
+ F966BE2208F27A40005CB29B /* tkStubInit.c in Sources */,
+ F966BE2308F27A40005CB29B /* tkStubLib.c in Sources */,
+ F966BE2408F27A40005CB29B /* tkStyle.c in Sources */,
+ F966BE2508F27A40005CB29B /* tkTest.c in Sources */,
+ F966BE2608F27A40005CB29B /* tkText.c in Sources */,
+ F966BE2808F27A40005CB29B /* tkTextBTree.c in Sources */,
+ F966BE2908F27A40005CB29B /* tkTextDisp.c in Sources */,
+ F966BE2B08F27A40005CB29B /* tkTextImage.c in Sources */,
+ F966BE2C08F27A40005CB29B /* tkTextIndex.c in Sources */,
+ F966BE2D08F27A40005CB29B /* tkTextMark.c in Sources */,
+ F966BE2E08F27A40005CB29B /* tkTextTag.c in Sources */,
+ F966BE2F08F27A40005CB29B /* tkTextWind.c in Sources */,
+ F966BE3008F27A40005CB29B /* tkTrig.c in Sources */,
+ F966BE3108F27A40005CB29B /* tkUndo.c in Sources */,
+ F966BE3308F27A40005CB29B /* tkUtil.c in Sources */,
+ F966BE3408F27A40005CB29B /* tkVisual.c in Sources */,
+ F966BE3508F27A40005CB29B /* tkWindow.c in Sources */,
+ F96888050AF786D5000797B5 /* ttkBlink.c in Sources */,
+ F96888060AF786D5000797B5 /* ttkButton.c in Sources */,
+ F96888070AF786D5000797B5 /* ttkCache.c in Sources */,
+ F96888080AF786D5000797B5 /* ttkClamTheme.c in Sources */,
+ F96888090AF786D5000797B5 /* ttkClassicTheme.c in Sources */,
+ F968880A0AF786D5000797B5 /* ttkDefaultTheme.c in Sources */,
+ F968880B0AF786D5000797B5 /* ttkElements.c in Sources */,
+ F968880C0AF786D5000797B5 /* ttkEntry.c in Sources */,
+ F968880D0AF786D5000797B5 /* ttkFrame.c in Sources */,
+ F968880E0AF786D5000797B5 /* ttkImage.c in Sources */,
+ F968880F0AF786D5000797B5 /* ttkInit.c in Sources */,
+ F96888100AF786D5000797B5 /* ttkLabel.c in Sources */,
+ F96888110AF786D5000797B5 /* ttkLayout.c in Sources */,
+ F96888120AF786D5000797B5 /* ttkManager.c in Sources */,
+ F96888130AF786D5000797B5 /* ttkNotebook.c in Sources */,
+ F96888140AF786D5000797B5 /* ttkPanedwindow.c in Sources */,
+ F96888150AF786D5000797B5 /* ttkProgress.c in Sources */,
+ F96888160AF786D5000797B5 /* ttkScale.c in Sources */,
+ F96888170AF786D5000797B5 /* ttkScroll.c in Sources */,
+ F96888180AF786D5000797B5 /* ttkScrollbar.c in Sources */,
+ F96888190AF786D5000797B5 /* ttkSeparator.c in Sources */,
+ F968881A0AF786D5000797B5 /* ttkSquare.c in Sources */,
+ F968881B0AF786D5000797B5 /* ttkState.c in Sources */,
+ F968881C0AF786D5000797B5 /* ttkStubInit.c in Sources */,
+ F968881D0AF786D5000797B5 /* ttkStubLib.c in Sources */,
+ F968881E0AF786D5000797B5 /* ttkTagSet.c in Sources */,
+ F968881F0AF786D5000797B5 /* ttkTheme.c in Sources */,
+ F96888200AF786D5000797B5 /* ttkTrace.c in Sources */,
+ F96888210AF786D5000797B5 /* ttkTrack.c in Sources */,
+ F96888220AF786D5000797B5 /* ttkTreeview.c in Sources */,
+ F96888230AF786D5000797B5 /* ttkWidget.c in Sources */,
+ F966BEDB08F27A40005CB29B /* tkMacOSXBitmap.c in Sources */,
+ F966BEDC08F27A40005CB29B /* tkMacOSXButton.c in Sources */,
+ F966BEDD08F27A40005CB29B /* tkMacOSXCarbonEvents.c in Sources */,
+ F966BEDE08F27A40005CB29B /* tkMacOSXClipboard.c in Sources */,
+ F966BEDF08F27A40005CB29B /* tkMacOSXColor.c in Sources */,
+ F966BEE008F27A40005CB29B /* tkMacOSXConfig.c in Sources */,
+ F966BEE108F27A40005CB29B /* tkMacOSXCursor.c in Sources */,
+ F966BEE308F27A40005CB29B /* tkMacOSXDebug.c in Sources */,
+ F966BEE608F27A40005CB29B /* tkMacOSXDialog.c in Sources */,
+ F966BEE708F27A40005CB29B /* tkMacOSXDraw.c in Sources */,
+ F966BEE808F27A40005CB29B /* tkMacOSXEmbed.c in Sources */,
+ F966BEE908F27A40005CB29B /* tkMacOSXEntry.c in Sources */,
+ F966BEEA08F27A40005CB29B /* tkMacOSXEvent.c in Sources */,
+ F966BEEC08F27A40005CB29B /* tkMacOSXFont.c in Sources */,
+ F966BEED08F27A40005CB29B /* tkMacOSXHLEvents.c in Sources */,
+ F966BEEE08F27A40005CB29B /* tkMacOSXInit.c in Sources */,
+ F966BEF108F27A40005CB29B /* tkMacOSXKeyboard.c in Sources */,
+ F966BEF208F27A40005CB29B /* tkMacOSXKeyEvent.c in Sources */,
+ F966BEF308F27A40005CB29B /* tkMacOSXMenu.c in Sources */,
+ F966BEF608F27A40005CB29B /* tkMacOSXMenubutton.c in Sources */,
+ F966BEF708F27A40005CB29B /* tkMacOSXMenus.c in Sources */,
+ F966BEF808F27A40005CB29B /* tkMacOSXMouseEvent.c in Sources */,
+ F966BEF908F27A40005CB29B /* tkMacOSXNotify.c in Sources */,
+ F966BF0108F27A40005CB29B /* tkMacOSXRegion.c in Sources */,
+ F966BF0308F27A40005CB29B /* tkMacOSXScrlbr.c in Sources */,
+ F966BF0408F27A40005CB29B /* tkMacOSXSend.c in Sources */,
+ F966BF0508F27A40005CB29B /* tkMacOSXSubwindows.c in Sources */,
+ F966BF0608F27A40005CB29B /* tkMacOSXTest.c in Sources */,
+ F966BF0708F27A40005CB29B /* tkMacOSXWindowEvent.c in Sources */,
+ F966BF0808F27A40005CB29B /* tkMacOSXWm.c in Sources */,
+ F966BF0B08F27A40005CB29B /* tkMacOSXXStubs.c in Sources */,
+ F96888850AF78938000797B5 /* ttkMacOSXTheme.c in Sources */,
+ F966BF7F08F27A41005CB29B /* tkAppInit.c in Sources */,
+ F966BF8308F27A41005CB29B /* tkUnix3d.c in Sources */,
+ F966BF9608F27A41005CB29B /* tkUnixScale.c in Sources */,
+ F966C02A08F27A42005CB29B /* xcolors.c in Sources */,
+ F966C02B08F27A42005CB29B /* xdraw.c in Sources */,
+ F966C02C08F27A42005CB29B /* xgc.c in Sources */,
+ F966C02D08F27A42005CB29B /* ximage.c in Sources */,
+ F966C02E08F27A42005CB29B /* xutil.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F9FD30BB0CC1AD070073837D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9FD30BC0CC1AD070073837D /* regcomp.c in Sources */,
+ F9FD30BD0CC1AD070073837D /* regerror.c in Sources */,
+ F9FD30BE0CC1AD070073837D /* regexec.c in Sources */,
+ F9FD30BF0CC1AD070073837D /* regfree.c in Sources */,
+ F9FD30C00CC1AD070073837D /* tclAlloc.c in Sources */,
+ F9FD30C10CC1AD070073837D /* tclAsync.c in Sources */,
+ F9FD30C20CC1AD070073837D /* tclBasic.c in Sources */,
+ F9FD30C30CC1AD070073837D /* tclBinary.c in Sources */,
+ F9FD30C40CC1AD070073837D /* tclCkalloc.c in Sources */,
+ F9FD30C50CC1AD070073837D /* tclClock.c in Sources */,
+ F9FD30C60CC1AD070073837D /* tclCmdAH.c in Sources */,
+ F9FD30C70CC1AD070073837D /* tclCmdIL.c in Sources */,
+ F9FD30C80CC1AD070073837D /* tclCmdMZ.c in Sources */,
+ F9FD30C90CC1AD070073837D /* tclCompCmds.c in Sources */,
+ F9FD30CA0CC1AD070073837D /* tclCompExpr.c in Sources */,
+ F9FD30CB0CC1AD070073837D /* tclCompile.c in Sources */,
+ F9FD30CC0CC1AD070073837D /* tclConfig.c in Sources */,
+ F9FD30CD0CC1AD070073837D /* tclDate.c in Sources */,
+ F9FD30CE0CC1AD070073837D /* tclDictObj.c in Sources */,
+ F9FD30CF0CC1AD070073837D /* tclEncoding.c in Sources */,
+ F9FD30D00CC1AD070073837D /* tclEnv.c in Sources */,
+ F9FD30D10CC1AD070073837D /* tclEvent.c in Sources */,
+ F9FD30D20CC1AD070073837D /* tclExecute.c in Sources */,
+ F9FD30D30CC1AD070073837D /* tclFCmd.c in Sources */,
+ F9FD30D40CC1AD070073837D /* tclFileName.c in Sources */,
+ F9FD30D50CC1AD070073837D /* tclGet.c in Sources */,
+ F9FD30D60CC1AD070073837D /* tclHash.c in Sources */,
+ F9FD30D70CC1AD070073837D /* tclHistory.c in Sources */,
+ F9FD30D80CC1AD070073837D /* tclIndexObj.c in Sources */,
+ F9FD30D90CC1AD070073837D /* tclInterp.c in Sources */,
+ F9FD30DA0CC1AD070073837D /* tclIO.c in Sources */,
+ F9FD30DB0CC1AD070073837D /* tclIOCmd.c in Sources */,
+ F9FD30DC0CC1AD070073837D /* tclIOGT.c in Sources */,
+ F9FD30DD0CC1AD070073837D /* tclIORChan.c in Sources */,
+ F9FD30DE0CC1AD070073837D /* tclIOSock.c in Sources */,
+ F9FD30DF0CC1AD070073837D /* tclIOUtil.c in Sources */,
+ F9FD30E00CC1AD070073837D /* tclLink.c in Sources */,
+ F9FD30E10CC1AD070073837D /* tclListObj.c in Sources */,
+ F9FD30E20CC1AD070073837D /* tclLiteral.c in Sources */,
+ F9FD30E30CC1AD070073837D /* tclLoad.c in Sources */,
+ F9FD30E40CC1AD070073837D /* tclMain.c in Sources */,
+ F9FD30E50CC1AD070073837D /* tclNamesp.c in Sources */,
+ F9FD30E60CC1AD070073837D /* tclNotify.c in Sources */,
+ F9FD30E70CC1AD070073837D /* tclObj.c in Sources */,
+ F9FD30E80CC1AD070073837D /* tclPanic.c in Sources */,
+ F9FD30E90CC1AD070073837D /* tclParse.c in Sources */,
+ F9FD30EA0CC1AD070073837D /* tclPathObj.c in Sources */,
+ F9FD30EB0CC1AD070073837D /* tclPipe.c in Sources */,
+ F9FD30EC0CC1AD070073837D /* tclPkg.c in Sources */,
+ F9FD30ED0CC1AD070073837D /* tclPkgConfig.c in Sources */,
+ F9FD30EE0CC1AD070073837D /* tclPosixStr.c in Sources */,
+ F9FD30EF0CC1AD070073837D /* tclPreserve.c in Sources */,
+ F9FD30F00CC1AD070073837D /* tclProc.c in Sources */,
+ F9FD30F10CC1AD070073837D /* tclRegexp.c in Sources */,
+ F9FD30F20CC1AD070073837D /* tclResolve.c in Sources */,
+ F9FD30F30CC1AD070073837D /* tclResult.c in Sources */,
+ F9FD30F40CC1AD070073837D /* tclScan.c in Sources */,
+ F9FD30F50CC1AD070073837D /* tclStringObj.c in Sources */,
+ F9FD30F60CC1AD070073837D /* tclStrToD.c in Sources */,
+ F9FD30F70CC1AD070073837D /* tclStubInit.c in Sources */,
+ F9FD30F80CC1AD070073837D /* tclStubLib.c in Sources */,
+ F9FD30F90CC1AD070073837D /* tclThread.c in Sources */,
+ F9FD30FA0CC1AD070073837D /* tclThreadAlloc.c in Sources */,
+ F9FD30FB0CC1AD070073837D /* tclThreadJoin.c in Sources */,
+ F9FD30FC0CC1AD070073837D /* tclThreadStorage.c in Sources */,
+ F9FD30FD0CC1AD070073837D /* tclTimer.c in Sources */,
+ F9FD30FE0CC1AD070073837D /* tclTomMathInterface.c in Sources */,
+ F9FD30FF0CC1AD070073837D /* tclTrace.c in Sources */,
+ F9FD31000CC1AD070073837D /* tclUtf.c in Sources */,
+ F9FD31010CC1AD070073837D /* tclUtil.c in Sources */,
+ F9FD31020CC1AD070073837D /* tclVar.c in Sources */,
+ F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */,
+ F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */,
+ F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */,
+ F9FD31060CC1AD070073837D /* bn_mp_add_d.c in Sources */,
+ F9FD31070CC1AD070073837D /* bn_mp_and.c in Sources */,
+ F9FD31080CC1AD070073837D /* bn_mp_clamp.c in Sources */,
+ F9FD31090CC1AD070073837D /* bn_mp_clear.c in Sources */,
+ F9FD310A0CC1AD070073837D /* bn_mp_clear_multi.c in Sources */,
+ F9FD310B0CC1AD070073837D /* bn_mp_cmp.c in Sources */,
+ F9FD310C0CC1AD070073837D /* bn_mp_cmp_d.c in Sources */,
+ F9FD310D0CC1AD070073837D /* bn_mp_cmp_mag.c in Sources */,
+ F9FD310E0CC1AD070073837D /* bn_mp_copy.c in Sources */,
+ F9FD310F0CC1AD070073837D /* bn_mp_count_bits.c in Sources */,
+ F9FD31100CC1AD070073837D /* bn_mp_div.c in Sources */,
+ F9FD31110CC1AD070073837D /* bn_mp_div_2.c in Sources */,
+ F9FD31120CC1AD070073837D /* bn_mp_div_2d.c in Sources */,
+ F9FD31130CC1AD070073837D /* bn_mp_div_3.c in Sources */,
+ F9FD31140CC1AD070073837D /* bn_mp_div_d.c in Sources */,
+ F9FD31150CC1AD070073837D /* bn_mp_exch.c in Sources */,
+ F9FD31160CC1AD070073837D /* bn_mp_expt_d.c in Sources */,
+ F9FD31170CC1AD070073837D /* bn_mp_grow.c in Sources */,
+ F9FD31180CC1AD070073837D /* bn_mp_init.c in Sources */,
+ F9FD31190CC1AD070073837D /* bn_mp_init_copy.c in Sources */,
+ F9FD311A0CC1AD070073837D /* bn_mp_init_multi.c in Sources */,
+ F9FD311B0CC1AD070073837D /* bn_mp_init_set.c in Sources */,
+ F9FD311C0CC1AD070073837D /* bn_mp_init_size.c in Sources */,
+ F9FD311D0CC1AD070073837D /* bn_mp_karatsuba_mul.c in Sources */,
+ F9FD311E0CC1AD070073837D /* bn_mp_karatsuba_sqr.c in Sources */,
+ F9FD311F0CC1AD070073837D /* bn_mp_lshd.c in Sources */,
+ F9FD31200CC1AD070073837D /* bn_mp_mod.c in Sources */,
+ F9FD31210CC1AD070073837D /* bn_mp_mod_2d.c in Sources */,
+ F9FD31220CC1AD070073837D /* bn_mp_mul.c in Sources */,
+ F9FD31230CC1AD070073837D /* bn_mp_mul_2.c in Sources */,
+ F9FD31240CC1AD070073837D /* bn_mp_mul_2d.c in Sources */,
+ F9FD31250CC1AD070073837D /* bn_mp_mul_d.c in Sources */,
+ F9FD31260CC1AD070073837D /* bn_mp_neg.c in Sources */,
+ F9FD31270CC1AD070073837D /* bn_mp_or.c in Sources */,
+ F9FD31280CC1AD070073837D /* bn_mp_radix_size.c in Sources */,
+ F9FD31290CC1AD070073837D /* bn_mp_radix_smap.c in Sources */,
+ F9FD312A0CC1AD070073837D /* bn_mp_read_radix.c in Sources */,
+ F9FD312B0CC1AD070073837D /* bn_mp_rshd.c in Sources */,
+ F9FD312C0CC1AD070073837D /* bn_mp_set.c in Sources */,
+ F9FD312D0CC1AD070073837D /* bn_mp_shrink.c in Sources */,
+ F9FD312E0CC1AD070073837D /* bn_mp_sqr.c in Sources */,
+ F9FD312F0CC1AD070073837D /* bn_mp_sqrt.c in Sources */,
+ F9FD31300CC1AD070073837D /* bn_mp_sub.c in Sources */,
+ F9FD31310CC1AD070073837D /* bn_mp_sub_d.c in Sources */,
+ F9FD31320CC1AD070073837D /* bn_mp_to_unsigned_bin_n.c in Sources */,
+ F9FD31330CC1AD070073837D /* bn_mp_to_unsigned_bin.c in Sources */,
+ F9FD31340CC1AD070073837D /* bn_mp_toom_mul.c in Sources */,
+ F9FD31350CC1AD070073837D /* bn_mp_toom_sqr.c in Sources */,
+ F9FD31360CC1AD070073837D /* bn_mp_toradix_n.c in Sources */,
+ F9FD31370CC1AD070073837D /* bn_mp_unsigned_bin_size.c in Sources */,
+ F9FD31380CC1AD070073837D /* bn_mp_xor.c in Sources */,
+ F9FD31390CC1AD070073837D /* bn_mp_zero.c in Sources */,
+ F9FD313A0CC1AD070073837D /* bn_reverse.c in Sources */,
+ F9FD313B0CC1AD070073837D /* bn_s_mp_add.c in Sources */,
+ F9FD313C0CC1AD070073837D /* bn_s_mp_mul_digs.c in Sources */,
+ F9FD313D0CC1AD070073837D /* bn_s_mp_sqr.c in Sources */,
+ F9FD313E0CC1AD070073837D /* bn_s_mp_sub.c in Sources */,
+ F9FD313F0CC1AD070073837D /* bncore.c in Sources */,
+ F9FD31400CC1AD070073837D /* tclMacOSXBundle.c in Sources */,
+ F9FD31410CC1AD070073837D /* tclMacOSXFCmd.c in Sources */,
+ F9FD31420CC1AD070073837D /* tclMacOSXNotify.c in Sources */,
+ F9FD31430CC1AD070073837D /* tclLoadDyld.c in Sources */,
+ F9FD31440CC1AD070073837D /* tclUnixChan.c in Sources */,
+ F9FD31450CC1AD070073837D /* tclUnixCompat.c in Sources */,
+ F9FD31460CC1AD070073837D /* tclUnixEvent.c in Sources */,
+ F9FD31470CC1AD070073837D /* tclUnixFCmd.c in Sources */,
+ F9FD31480CC1AD070073837D /* tclUnixFile.c in Sources */,
+ F9FD31490CC1AD070073837D /* tclUnixInit.c in Sources */,
+ F9FD314A0CC1AD070073837D /* tclUnixNotfy.c in Sources */,
+ F9FD314B0CC1AD070073837D /* tclUnixPipe.c in Sources */,
+ F9FD314C0CC1AD070073837D /* tclUnixSock.c in Sources */,
+ F9FD314D0CC1AD070073837D /* tclUnixThrd.c in Sources */,
+ F9FD314E0CC1AD070073837D /* tclUnixTime.c in Sources */,
+ F9FD314F0CC1AD070073837D /* tk3d.c in Sources */,
+ F9FD31500CC1AD070073837D /* tkArgv.c in Sources */,
+ F9FD31510CC1AD070073837D /* tkAtom.c in Sources */,
+ F9FD31520CC1AD070073837D /* tkBind.c in Sources */,
+ F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */,
+ F9FD31540CC1AD070073837D /* tkButton.c in Sources */,
+ F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */,
+ F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */,
+ F9FD31570CC1AD070073837D /* tkCanvBmap.c in Sources */,
+ F9FD31580CC1AD070073837D /* tkCanvImg.c in Sources */,
+ F9FD31590CC1AD070073837D /* tkCanvLine.c in Sources */,
+ F9FD315A0CC1AD070073837D /* tkCanvPoly.c in Sources */,
+ F9FD315B0CC1AD070073837D /* tkCanvPs.c in Sources */,
+ F9FD315C0CC1AD070073837D /* tkCanvText.c in Sources */,
+ F9FD315D0CC1AD070073837D /* tkCanvUtil.c in Sources */,
+ F9FD315E0CC1AD070073837D /* tkCanvWind.c in Sources */,
+ F9FD315F0CC1AD070073837D /* tkClipboard.c in Sources */,
+ F9FD31600CC1AD070073837D /* tkCmds.c in Sources */,
+ F9FD31610CC1AD070073837D /* tkColor.c in Sources */,
+ F9FD31620CC1AD070073837D /* tkConfig.c in Sources */,
+ F9FD31630CC1AD070073837D /* tkConsole.c in Sources */,
+ F9FD31640CC1AD070073837D /* tkCursor.c in Sources */,
+ F9FD31650CC1AD070073837D /* tkEntry.c in Sources */,
+ F9FD31660CC1AD070073837D /* tkError.c in Sources */,
+ F9FD31670CC1AD070073837D /* tkEvent.c in Sources */,
+ F9FD31680CC1AD070073837D /* tkFileFilter.c in Sources */,
+ F9FD31690CC1AD070073837D /* tkFocus.c in Sources */,
+ F9FD316A0CC1AD070073837D /* tkFont.c in Sources */,
+ F9FD316B0CC1AD070073837D /* tkFrame.c in Sources */,
+ F9FD316C0CC1AD070073837D /* tkGC.c in Sources */,
+ F9FD316D0CC1AD070073837D /* tkGeometry.c in Sources */,
+ F9FD316E0CC1AD070073837D /* tkGet.c in Sources */,
+ F9FD316F0CC1AD070073837D /* tkGrab.c in Sources */,
+ F9FD31700CC1AD070073837D /* tkGrid.c in Sources */,
+ F9FD31710CC1AD070073837D /* tkImage.c in Sources */,
+ F9FD31720CC1AD070073837D /* tkImgBmap.c in Sources */,
+ F9FD31730CC1AD070073837D /* tkImgGIF.c in Sources */,
+ F9FD31740CC1AD070073837D /* tkImgPhoto.c in Sources */,
+ F9FD31750CC1AD070073837D /* tkImgPPM.c in Sources */,
+ F9FD31760CC1AD070073837D /* tkListbox.c in Sources */,
+ F9FD31770CC1AD070073837D /* tkMacWinMenu.c in Sources */,
+ F9FD31780CC1AD070073837D /* tkMain.c in Sources */,
+ F9FD31790CC1AD070073837D /* tkMenu.c in Sources */,
+ F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */,
+ F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */,
+ F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */,
+ F9FD317D0CC1AD070073837D /* tkObj.c in Sources */,
+ F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */,
+ F9FD317F0CC1AD070073837D /* tkOldTest.c in Sources */,
+ F9FD31800CC1AD070073837D /* tkOption.c in Sources */,
+ F9FD31810CC1AD070073837D /* tkPack.c in Sources */,
+ F9FD31820CC1AD070073837D /* tkPanedWindow.c in Sources */,
+ F9FD31830CC1AD070073837D /* tkPlace.c in Sources */,
+ F9FD31850CC1AD070073837D /* tkRectOval.c in Sources */,
+ F9FD31860CC1AD070073837D /* tkScale.c in Sources */,
+ F9FD31870CC1AD070073837D /* tkScrollbar.c in Sources */,
+ F9FD31880CC1AD070073837D /* tkSelect.c in Sources */,
+ F9FD31890CC1AD070073837D /* tkSquare.c in Sources */,
+ F9FD318A0CC1AD070073837D /* tkStubInit.c in Sources */,
+ F9FD318B0CC1AD070073837D /* tkStubLib.c in Sources */,
+ F9FD318C0CC1AD070073837D /* tkStyle.c in Sources */,
+ F9FD318D0CC1AD070073837D /* tkTest.c in Sources */,
+ F9FD318E0CC1AD070073837D /* tkText.c in Sources */,
+ F9FD318F0CC1AD070073837D /* tkTextBTree.c in Sources */,
+ F9FD31900CC1AD070073837D /* tkTextDisp.c in Sources */,
+ F9FD31910CC1AD070073837D /* tkTextImage.c in Sources */,
+ F9FD31920CC1AD070073837D /* tkTextIndex.c in Sources */,
+ F9FD31930CC1AD070073837D /* tkTextMark.c in Sources */,
+ F9FD31940CC1AD070073837D /* tkTextTag.c in Sources */,
+ F9FD31950CC1AD070073837D /* tkTextWind.c in Sources */,
+ F9FD31960CC1AD070073837D /* tkTrig.c in Sources */,
+ F9FD31970CC1AD070073837D /* tkUndo.c in Sources */,
+ F9FD31980CC1AD070073837D /* tkUtil.c in Sources */,
+ F9FD31990CC1AD070073837D /* tkVisual.c in Sources */,
+ F9FD319A0CC1AD070073837D /* tkWindow.c in Sources */,
+ F9FD319B0CC1AD070073837D /* ttkBlink.c in Sources */,
+ F9FD319C0CC1AD070073837D /* ttkButton.c in Sources */,
+ F9FD319D0CC1AD070073837D /* ttkCache.c in Sources */,
+ F9FD319E0CC1AD070073837D /* ttkClamTheme.c in Sources */,
+ F9FD319F0CC1AD070073837D /* ttkClassicTheme.c in Sources */,
+ F9FD31A00CC1AD070073837D /* ttkDefaultTheme.c in Sources */,
+ F9FD31A10CC1AD070073837D /* ttkElements.c in Sources */,
+ F9FD31A20CC1AD070073837D /* ttkEntry.c in Sources */,
+ F9FD31A30CC1AD070073837D /* ttkFrame.c in Sources */,
+ F9FD31A40CC1AD070073837D /* ttkImage.c in Sources */,
+ F9FD31A50CC1AD070073837D /* ttkInit.c in Sources */,
+ F9FD31A60CC1AD070073837D /* ttkLabel.c in Sources */,
+ F9FD31A70CC1AD070073837D /* ttkLayout.c in Sources */,
+ F9FD31A80CC1AD070073837D /* ttkManager.c in Sources */,
+ F9FD31A90CC1AD070073837D /* ttkNotebook.c in Sources */,
+ F9FD31AA0CC1AD070073837D /* ttkPanedwindow.c in Sources */,
+ F9FD31AB0CC1AD070073837D /* ttkProgress.c in Sources */,
+ F9FD31AC0CC1AD070073837D /* ttkScale.c in Sources */,
+ F9FD31AD0CC1AD070073837D /* ttkScroll.c in Sources */,
+ F9FD31AE0CC1AD070073837D /* ttkScrollbar.c in Sources */,
+ F9FD31AF0CC1AD070073837D /* ttkSeparator.c in Sources */,
+ F9FD31B00CC1AD070073837D /* ttkSquare.c in Sources */,
+ F9FD31B10CC1AD070073837D /* ttkState.c in Sources */,
+ F9FD31B20CC1AD070073837D /* ttkStubInit.c in Sources */,
+ F9FD31B30CC1AD070073837D /* ttkStubLib.c in Sources */,
+ F9FD31B40CC1AD070073837D /* ttkTagSet.c in Sources */,
+ F9FD31B50CC1AD070073837D /* ttkTheme.c in Sources */,
+ F9FD31B60CC1AD070073837D /* ttkTrace.c in Sources */,
+ F9FD31B70CC1AD070073837D /* ttkTrack.c in Sources */,
+ F9FD31B80CC1AD070073837D /* ttkTreeview.c in Sources */,
+ F9FD31B90CC1AD070073837D /* ttkWidget.c in Sources */,
+ F9FD31DA0CC1AD070073837D /* tkAppInit.c in Sources */,
+ F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */,
+ F9FD31DB0CC1AD070073837D /* tkUnix3d.c in Sources */,
+ F9FD320A0CC1ADB70073837D /* tkUnixButton.c in Sources */,
+ F9FD32090CC1ADB70073837D /* tkUnixColor.c in Sources */,
+ F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */,
+ F9FD31F80CC1ADB70073837D /* tkUnixCursor.c in Sources */,
+ F9FD32060CC1ADB70073837D /* tkUnixDialog.c in Sources */,
+ F9FD32050CC1ADB70073837D /* tkUnixDraw.c in Sources */,
+ F9FD31FD0CC1ADB70073837D /* tkUnixEmbed.c in Sources */,
+ F9FD32080CC1ADB70073837D /* tkUnixEvent.c in Sources */,
+ F9FD31FF0CC1ADB70073837D /* tkUnixFocus.c in Sources */,
+ F9FD31FC0CC1ADB70073837D /* tkUnixInit.c in Sources */,
+ F9FD31FA0CC1ADB70073837D /* tkUnixKey.c in Sources */,
+ F9FD32030CC1ADB70073837D /* tkUnixMenu.c in Sources */,
+ F9FD320B0CC1ADB70073837D /* tkUnixMenubu.c in Sources */,
+ F9FD32010CC1ADB70073837D /* tkUnixRFont.c in Sources */,
+ F9FD31DC0CC1AD070073837D /* tkUnixScale.c in Sources */,
+ F9FD320C0CC1ADB70073837D /* tkUnixScrlbr.c in Sources */,
+ F9FD32070CC1ADB70073837D /* tkUnixSelect.c in Sources */,
+ F9FD31FE0CC1ADB70073837D /* tkUnixSend.c in Sources */,
+ F9FD32000CC1ADB70073837D /* tkUnixWm.c in Sources */,
+ F9FD31FB0CC1ADB70073837D /* tkUnixXId.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ F91BCC4F093152310042A6BF /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleaseUniversal;
+ };
+ F91BCC50093152310042A6BF /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleaseUniversal;
+ };
+ F91BCC51093152310042A6BF /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
+ CFLAGS = "-arch ppc -arch i386 $(CFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.4;
+ PREBINDING = NO;
+ };
+ name = ReleaseUniversal;
+ };
+ F93084370BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugMemCompile;
+ };
+ F93084380BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugMemCompile;
+ };
+ F93084390BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugMemCompile;
+ };
+ F930843A0BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-symbols=all";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugMemCompile;
+ };
+ F9359B250DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = YES;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS)",
+ "-lgcov",
+ );
+ PREBINDING = NO;
+ };
+ name = DebugGCov;
+ };
+ F9359B260DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugGCov;
+ };
+ F9359B270DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugGCov;
+ };
+ F9359B280DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugGCov;
+ };
+ F95CC8AC09158F3100EA5ACE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = Debug;
+ };
+ F95CC8AD09158F3100EA5ACE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = Release;
+ };
+ F95CC8AE09158F3100EA5ACE /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugNoFixZL;
+ };
+ F95CC8B109158F3100EA5ACE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ F95CC8B209158F3100EA5ACE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = Release;
+ };
+ F95CC8B309158F3100EA5ACE /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugNoFixZL;
+ };
+ F95CC8B609158F3100EA5ACE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = Debug;
+ };
+ F95CC8B709158F3100EA5ACE /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = YES;
+ };
+ name = Release;
+ };
+ F95CC8B809158F3100EA5ACE /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugNoFixZL;
+ };
+ F97258A90A86873D00096C78 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ F97258AA0A86873D00096C78 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = Release;
+ };
+ F97258AB0A86873D00096C78 /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugNoFixZL;
+ };
+ F97258AC0A86873D00096C78 /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleaseUniversal;
+ };
+ F97AED080B660A6C00310EA2 /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F97AED0F0B660AA300310EA2 /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F97AED160B660AF100310EA2 /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+ F987512F0DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --disable-corefoundation";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugNoCF;
+ };
+ F98751300DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugNoCF;
+ };
+ F98751310DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugNoCF;
+ };
+ F98751320DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugNoCF;
+ };
+ F98751330DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --disable-threads --disable-corefoundation";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F98751340DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F98751350DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F98751360DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F99EE73B0BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE73C0BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugLeaks;
+ };
+ F99EE73D0BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE73E0BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugLeaks;
+ };
+ F99EE73F0BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE7400BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugLeaks;
+ };
+ F99EE7410BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --disable-threads";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE7420BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ PURIFY,
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugLeaks;
+ };
+ F9DB62080B65ADA800A370FB /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F9DB62090B65ADA800A370FB /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F9DB620A0B65ADA800A370FB /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
+ CFLAGS = "-arch ppc -arch i386 $(CFLAGS)";
+ CPPFLAGS = "-isysroot $(SDKROOT) $(CPPFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.4;
+ PREBINDING = NO;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F9DB621F0B65AFDE00A370FB /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ LDFLAGS = "-force_cpusubtype_ALL $(LDFLAGS)";
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F9DB62200B65AFDE00A370FB /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F9DB62210B65AFDE00A370FB /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = ppc;
+ CFLAGS = "$(PER_ARCH_CFLAGS_ppc) $(CFLAGS)";
+ CPPFLAGS = "-arch ppc -isysroot $(SDKROOT) $(CPPFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.3;
+ PREBINDING = YES;
+ SDKROOT = /Developer/SDKs/MacOSX10.3.9.sdk;
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F9DB62350B65B03A00A370FB /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+ F9DB62360B65B03A00A370FB /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+ F9DB62370B65B03A00A370FB /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = ppc;
+ CFLAGS = "$(PER_ARCH_CFLAGS_ppc) -fconstant-cfstrings $(CFLAGS)";
+ CPPFLAGS = "-arch ppc -D__CONSTANT_CFSTRINGS__ -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc -isystem $(SDKROOT)/usr/include/gcc/darwin/$(GCC_VERSION) -isystem $(SDKROOT)/usr/include -F$(SDKROOT)/System/Library/Frameworks";
+ DEBUG_INFORMATION_FORMAT = stabs;
+ GCC = /usr/bin/gcc;
+ GCC_VERSION = 3.3;
+ LDFLAGS = "-L$(SDKROOT)/usr/lib/gcc/darwin/$(GCC_VERSION) -Wl,-syslibroot,$(SDKROOT)";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = YES;
+ SDKROOT = /Developer/SDKs/MacOSX10.2.8.sdk;
+ WARNING_CFLAGS = (
+ "$(WARNING_CFLAGS_GCC3)",
+ "-Wno-long-double",
+ );
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ F95CC8AB09158F3100EA5ACE /* Build configuration list for PBXNativeTarget "Tk" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F95CC8AC09158F3100EA5ACE /* Debug */,
+ F95CC8AE09158F3100EA5ACE /* DebugNoFixZL */,
+ F99EE73B0BE835310060D4AF /* DebugUnthreaded */,
+ F98751300DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751340DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F93084370BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE73C0BE835310060D4AF /* DebugLeaks */,
+ F9359B260DF212DA00E04F67 /* DebugGCov */,
+ F95CC8AD09158F3100EA5ACE /* Release */,
+ F91BCC4F093152310042A6BF /* ReleaseUniversal */,
+ F9DB62080B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
+ F9DB621F0B65AFDE00A370FB /* ReleasePPC10.3.9SDK */,
+ F9DB62350B65B03A00A370FB /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ F95CC8B009158F3100EA5ACE /* Build configuration list for PBXNativeTarget "tktest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F95CC8B109158F3100EA5ACE /* Debug */,
+ F95CC8B309158F3100EA5ACE /* DebugNoFixZL */,
+ F99EE73D0BE835310060D4AF /* DebugUnthreaded */,
+ F98751310DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751350DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F93084380BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE73E0BE835310060D4AF /* DebugLeaks */,
+ F9359B270DF212DA00E04F67 /* DebugGCov */,
+ F95CC8B209158F3100EA5ACE /* Release */,
+ F91BCC50093152310042A6BF /* ReleaseUniversal */,
+ F9DB62090B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
+ F9DB62200B65AFDE00A370FB /* ReleasePPC10.3.9SDK */,
+ F9DB62360B65B03A00A370FB /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ F95CC8B509158F3100EA5ACE /* Build configuration list for PBXProject "Wish" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F95CC8B609158F3100EA5ACE /* Debug */,
+ F95CC8B809158F3100EA5ACE /* DebugNoFixZL */,
+ F99EE7410BE835310060D4AF /* DebugUnthreaded */,
+ F987512F0DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751330DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F930843A0BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE7420BE835310060D4AF /* DebugLeaks */,
+ F9359B250DF212DA00E04F67 /* DebugGCov */,
+ F95CC8B709158F3100EA5ACE /* Release */,
+ F91BCC51093152310042A6BF /* ReleaseUniversal */,
+ F9DB620A0B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
+ F9DB62210B65AFDE00A370FB /* ReleasePPC10.3.9SDK */,
+ F9DB62370B65B03A00A370FB /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ F97258A80A86873D00096C78 /* Build configuration list for PBXNativeTarget "tktest-X11" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F97258A90A86873D00096C78 /* Debug */,
+ F97258AB0A86873D00096C78 /* DebugNoFixZL */,
+ F99EE73F0BE835310060D4AF /* DebugUnthreaded */,
+ F98751320DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751360DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F93084390BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE7400BE835310060D4AF /* DebugLeaks */,
+ F9359B280DF212DA00E04F67 /* DebugGCov */,
+ F97258AA0A86873D00096C78 /* Release */,
+ F97258AC0A86873D00096C78 /* ReleaseUniversal */,
+ F97AED080B660A6C00310EA2 /* ReleaseUniversal10.4uSDK */,
+ F97AED0F0B660AA300310EA2 /* ReleasePPC10.3.9SDK */,
+ F97AED160B660AF100310EA2 /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/macosx/Wish.xcodeproj/default.pbxuser b/macosx/Wish.xcodeproj/default.pbxuser
new file mode 100644
index 0000000..cd9a9a6
--- /dev/null
+++ b/macosx/Wish.xcodeproj/default.pbxuser
@@ -0,0 +1,339 @@
+// !$*UTF8*$!
+{
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ activeBuildConfigurationName = Debug;
+ activeExecutable = F9E61D1C090A4282002B3151 /* Wish */;
+ activeTarget = F9E61D16090A3E94002B3151 /* Tk */;
+ codeSenseManager = F944EB9D08F798180049FDD4 /* Code sense */;
+ executables = (
+ F9E61D1C090A4282002B3151 /* Wish */,
+ F944EB8F08F798100049FDD4 /* tktest */,
+ F9FD31F50CC1AD070073837D /* tktest-X11 */,
+ );
+ perUserDictionary = {
+ com.apple.ide.smrt.PBXUserSmartGroupsKey.Rev10 = <040b73747265616d747970656481e8038401408484840e4e534d757461626c654172726179008484074e534172726179008484084e534f626a65637400858401690192848484134e534d757461626c6544696374696f6e6172790084840c4e5344696374696f6e6172790095960792848484084e53537472696e67019584012b046e616d658692849a9a14496d706c656d656e746174696f6e2046696c65738692849a9a146162736f6c75746550617468546f42756e646c658692849a9a008692849a9a195042585472616e7369656e744c6f636174696f6e4174546f708692849a9a06626f74746f6d8692849a9a03636c7a8692849a9a1550425846696c656e616d65536d61727447726f75708692849a9a0b6465736372697074696f6e8692849a9a103c6e6f206465736372697074696f6e3e8692849a9a0b707265666572656e63657386928497960892849a9a07666e6d617463688692849a9a008692849a9a05696d6167658692849a9a0b536d617274466f6c6465728692849a9a04726f6f748692849a9a093c50524f4a4543543e8692849a9a0572656765788692849a9a065c2e286329248692849a9a097265637572736976658692848484084e534e756d626572008484074e5356616c7565009584012a849696018692849a9a0669734c656166869284b09db296008692849a9a0763616e536176658692af92849a9a1250425850726f6a65637453636f70654b65798692849a9a03594553868692849a9a08676c6f62616c49448692849a9a18314343304541343030343335304546393030343434313042868686>;
+ };
+ sourceControlManager = F944EB9C08F798180049FDD4 /* Source Control */;
+ userBuildSettings = {
+ AUTOCONF = "/usr/local/bin/autoconf-2.59";
+ AUTOHEADER = "/usr/local/bin/autoheader-2.59";
+ CODE_SIGN_IDENTITY = "";
+ SYMROOT = "${SRCROOT}/../../build/tk";
+ TCL_SRCROOT = "${SRCROOT}/../../tcl";
+ TK_SRCROOT = "${SRCROOT}/../../tk";
+ };
+ };
+ 8DD76FA90486AB0100D96B5E /* tktest */ = {
+ activeExec = 0;
+ executables = (
+ F944EB8F08F798100049FDD4 /* tktest */,
+ );
+ };
+ F944EB8F08F798100049FDD4 /* tktest */ = {
+ isa = PBXExecutable;
+ activeArgIndices = (
+ YES,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ );
+ argumentStrings = (
+ "${TK_SRCROOT}/library/demos/widget",
+ "${TK_SRCROOT}/tests/all.tcl",
+ "${TK_SRCROOT}/tests/ttk/all.tcl",
+ "-geometry +0+0",
+ "-singleproc 1",
+ "-verbose \"bet\"",
+ "-skip window-2.9",
+ );
+ autoAttachOnCrash = 1;
+ breakpointsEnabled = 1;
+ configStateDict = {
+ "PBXLSLaunchAction-0" = {
+ PBXLSLaunchAction = 0;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXLSRunLaunchConfig;
+ displayName = "Executable Runner";
+ identifier = com.apple.Xcode.launch.runConfig;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ "PBXLSLaunchAction-1" = {
+ PBXLSLaunchAction = 1;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXGDB_LaunchConfig;
+ displayName = GDB;
+ identifier = com.apple.Xcode.launch.GDBMI_Config;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ };
+ customDataFormattersEnabled = 1;
+ debuggerPlugin = GDBDebugging;
+ disassemblyDisplayState = 0;
+ dylibVariantSuffix = "";
+ enableDebugStr = 0;
+ environmentEntries = (
+ {
+ active = YES;
+ name = TCL_LIBRARY;
+ value = "${TCL_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TK_LIBRARY;
+ value = "${TK_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TCLLIBPATH;
+ value = /Library/Tcl;
+ },
+ {
+ active = NO;
+ name = DYLD_PRINT_LIBRARIES;
+ },
+ {
+ active = NO;
+ name = EventDebug;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocBadFreeAbort;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocLogFile;
+ value = /tmp/malloc.log;
+ },
+ {
+ active = NO;
+ name = MallocStackLogging;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocStackLoggingNoCompact;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocPreScribble;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocScribble;
+ value = 1;
+ },
+ );
+ executableSystemSymbolLevel = 0;
+ executableUserSymbolLevel = 0;
+ libgmallocEnabled = 0;
+ name = tktest;
+ sourceDirectories = (
+ );
+ };
+ F944EB9C08F798180049FDD4 /* Source Control */ = {
+ isa = PBXSourceControlManager;
+ fallbackIsa = XCSourceControlManager;
+ isSCMEnabled = 0;
+ scmConfiguration = {
+ CVSToolPath = /usr/bin/cvs;
+ CVSUseSSH = NO;
+ SubversionToolPath = /usr/bin/svn;
+ };
+ scmType = scm.cvs;
+ };
+ F944EB9D08F798180049FDD4 /* Code sense */ = {
+ isa = PBXCodeSenseManager;
+ indexTemplatePath = "";
+ };
+ F9E61D16090A3E94002B3151 /* Tk */ = {
+ activeExec = 0;
+ executables = (
+ F9E61D1C090A4282002B3151 /* Wish */,
+ );
+ };
+ F9E61D1C090A4282002B3151 /* Wish */ = {
+ isa = PBXExecutable;
+ activeArgIndices = (
+ YES,
+ );
+ argumentStrings = (
+ "${TK_SRCROOT}/library/demos/widget",
+ );
+ autoAttachOnCrash = 1;
+ breakpointsEnabled = 1;
+ configStateDict = {
+ "PBXLSLaunchAction-0" = {
+ PBXLSLaunchAction = 0;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXLSRunLaunchConfig;
+ displayName = "Executable Runner";
+ identifier = com.apple.Xcode.launch.runConfig;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ "PBXLSLaunchAction-1" = {
+ PBXLSLaunchAction = 1;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXGDB_LaunchConfig;
+ displayName = GDB;
+ identifier = com.apple.Xcode.launch.GDBMI_Config;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ };
+ customDataFormattersEnabled = 1;
+ debuggerPlugin = GDBDebugging;
+ disassemblyDisplayState = 0;
+ dylibVariantSuffix = "";
+ enableDebugStr = 0;
+ environmentEntries = (
+ {
+ active = NO;
+ name = DYLD_PRINT_LIBRARIES;
+ },
+ );
+ executableSystemSymbolLevel = 0;
+ executableUserSymbolLevel = 0;
+ libgmallocEnabled = 0;
+ name = Wish;
+ sourceDirectories = (
+ );
+ };
+ F97258A50A86873C00096C78 /* tktest-X11 */ = {
+ activeExec = 0;
+ executables = (
+ F9FD31F50CC1AD070073837D /* tktest-X11 */,
+ );
+ };
+ F9FD31F50CC1AD070073837D /* tktest-X11 */ = {
+ isa = PBXExecutable;
+ activeArgIndices = (
+ YES,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ NO,
+ );
+ argumentStrings = (
+ "${TK_SRCROOT}/library/demos/widget",
+ "${TK_SRCROOT}/tests/all.tcl",
+ "${TK_SRCROOT}/tests/ttk/all.tcl",
+ "-geometry +0+0",
+ "-singleproc 1",
+ "-verbose \"bet\"",
+ "-skip window-2.9",
+ );
+ autoAttachOnCrash = 1;
+ breakpointsEnabled = 1;
+ configStateDict = {
+ "PBXLSLaunchAction-0" = {
+ PBXLSLaunchAction = 0;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXLSRunLaunchConfig;
+ displayName = "Executable Runner";
+ identifier = com.apple.Xcode.launch.runConfig;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ "PBXLSLaunchAction-1" = {
+ PBXLSLaunchAction = 1;
+ PBXLSLaunchStartAction = 1;
+ PBXLSLaunchStdioStyle = 2;
+ PBXLSLaunchStyle = 0;
+ class = PBXGDB_LaunchConfig;
+ displayName = GDB;
+ identifier = com.apple.Xcode.launch.GDBMI_Config;
+ remoteHostInfo = "";
+ startActionInfo = "";
+ };
+ };
+ customDataFormattersEnabled = 1;
+ debuggerPlugin = GDBDebugging;
+ disassemblyDisplayState = 0;
+ dylibVariantSuffix = "";
+ enableDebugStr = 0;
+ environmentEntries = (
+ {
+ active = YES;
+ name = TCL_LIBRARY;
+ value = "${TCL_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TK_LIBRARY;
+ value = "${TK_SRCROOT}/library";
+ },
+ {
+ active = YES;
+ name = TCLLIBPATH;
+ value = /Library/Tcl;
+ },
+ {
+ active = YES;
+ name = DISPLAY;
+ value = ":0";
+ },
+ {
+ active = NO;
+ name = DYLD_PRINT_LIBRARIES;
+ },
+ {
+ active = NO;
+ name = MallocBadFreeAbort;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocLogFile;
+ value = /tmp/malloc.log;
+ },
+ {
+ active = NO;
+ name = MallocStackLogging;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocStackLoggingNoCompact;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocPreScribble;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocScribble;
+ value = 1;
+ },
+ );
+ executableSystemSymbolLevel = 0;
+ executableUserSymbolLevel = 0;
+ libgmallocEnabled = 0;
+ name = "tktest-X11";
+ sourceDirectories = (
+ );
+ };
+}
diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..fe78b0b
--- /dev/null
+++ b/macosx/Wish.xcodeproj/project.pbxproj
@@ -0,0 +1,5734 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
+ F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
+ F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
+ F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
+ F966BDD308F27A3F005CB29B /* tkBind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB008F27A39005CB29B /* tkBind.c */; };
+ F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB108F27A39005CB29B /* tkBitmap.c */; };
+ F966BDD508F27A3F005CB29B /* tkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB208F27A39005CB29B /* tkButton.c */; };
+ F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB408F27A39005CB29B /* tkCanvArc.c */; };
+ F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB508F27A39005CB29B /* tkCanvas.c */; };
+ F966BDDA08F27A3F005CB29B /* tkCanvBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB708F27A39005CB29B /* tkCanvBmap.c */; };
+ F966BDDB08F27A3F005CB29B /* tkCanvImg.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB808F27A39005CB29B /* tkCanvImg.c */; };
+ F966BDDC08F27A3F005CB29B /* tkCanvLine.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB908F27A39005CB29B /* tkCanvLine.c */; };
+ F966BDDD08F27A3F005CB29B /* tkCanvPoly.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABA08F27A39005CB29B /* tkCanvPoly.c */; };
+ F966BDDE08F27A3F005CB29B /* tkCanvPs.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABB08F27A39005CB29B /* tkCanvPs.c */; };
+ F966BDE008F27A3F005CB29B /* tkCanvText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABD08F27A39005CB29B /* tkCanvText.c */; };
+ F966BDE108F27A3F005CB29B /* tkCanvUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABE08F27A39005CB29B /* tkCanvUtil.c */; };
+ F966BDE208F27A3F005CB29B /* tkCanvWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABF08F27A39005CB29B /* tkCanvWind.c */; };
+ F966BDE308F27A3F005CB29B /* tkClipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC008F27A39005CB29B /* tkClipboard.c */; };
+ F966BDE408F27A3F005CB29B /* tkCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC108F27A39005CB29B /* tkCmds.c */; };
+ F966BDE508F27A3F005CB29B /* tkColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC208F27A39005CB29B /* tkColor.c */; };
+ F966BDE708F27A3F005CB29B /* tkConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC408F27A39005CB29B /* tkConfig.c */; };
+ F966BDE808F27A3F005CB29B /* tkConsole.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC508F27A39005CB29B /* tkConsole.c */; };
+ F966BDE908F27A3F005CB29B /* tkCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC608F27A39005CB29B /* tkCursor.c */; };
+ F966BDEB08F27A3F005CB29B /* tkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC808F27A39005CB29B /* tkEntry.c */; };
+ F966BDED08F27A3F005CB29B /* tkError.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACA08F27A39005CB29B /* tkError.c */; };
+ F966BDEE08F27A3F005CB29B /* tkEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACB08F27A39005CB29B /* tkEvent.c */; };
+ F966BDEF08F27A3F005CB29B /* tkFileFilter.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACC08F27A39005CB29B /* tkFileFilter.c */; };
+ F966BDF108F27A3F005CB29B /* tkFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACE08F27A39005CB29B /* tkFocus.c */; };
+ F966BDF208F27A3F005CB29B /* tkFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACF08F27A39005CB29B /* tkFont.c */; };
+ F966BDF408F27A3F005CB29B /* tkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD108F27A39005CB29B /* tkFrame.c */; };
+ F966BDF508F27A3F005CB29B /* tkGC.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD208F27A39005CB29B /* tkGC.c */; };
+ F966BDF608F27A3F005CB29B /* tkGeometry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD308F27A39005CB29B /* tkGeometry.c */; };
+ F966BDF708F27A3F005CB29B /* tkGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD408F27A39005CB29B /* tkGet.c */; };
+ F966BDF808F27A3F005CB29B /* tkGrab.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD508F27A39005CB29B /* tkGrab.c */; };
+ F966BDF908F27A3F005CB29B /* tkGrid.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD608F27A39005CB29B /* tkGrid.c */; };
+ F966BDFA08F27A3F005CB29B /* tkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD708F27A39005CB29B /* tkImage.c */; };
+ F966BDFB08F27A3F005CB29B /* tkImgBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD808F27A39005CB29B /* tkImgBmap.c */; };
+ F966BDFC08F27A3F005CB29B /* tkImgGIF.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD908F27A39005CB29B /* tkImgGIF.c */; };
+ F966BDFD08F27A3F005CB29B /* tkImgPhoto.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADA08F27A39005CB29B /* tkImgPhoto.c */; };
+ F966BDFE08F27A3F005CB29B /* tkImgPPM.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADB08F27A39005CB29B /* tkImgPPM.c */; };
+ F966BE0708F27A3F005CB29B /* tkListbox.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE408F27A39005CB29B /* tkListbox.c */; };
+ F966BE0808F27A3F005CB29B /* tkMacWinMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE508F27A39005CB29B /* tkMacWinMenu.c */; };
+ F966BE0908F27A3F005CB29B /* tkMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE608F27A39005CB29B /* tkMain.c */; };
+ F966BE0A08F27A3F005CB29B /* tkMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE708F27A39005CB29B /* tkMenu.c */; };
+ F966BE0C08F27A3F005CB29B /* tkMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE908F27A39005CB29B /* tkMenubutton.c */; };
+ F966BE0E08F27A3F005CB29B /* tkMenuDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEB08F27A39005CB29B /* tkMenuDraw.c */; };
+ F966BE0F08F27A3F005CB29B /* tkMessage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEC08F27A39005CB29B /* tkMessage.c */; };
+ F966BE1008F27A3F005CB29B /* tkObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAED08F27A39005CB29B /* tkObj.c */; };
+ F966BE1108F27A3F005CB29B /* tkOldConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEE08F27A39005CB29B /* tkOldConfig.c */; };
+ F966BE1208F27A3F005CB29B /* tkOption.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEF08F27A39005CB29B /* tkOption.c */; };
+ F966BE1308F27A3F005CB29B /* tkPack.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF008F27A39005CB29B /* tkPack.c */; };
+ F966BE1408F27A3F005CB29B /* tkPanedWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF108F27A39005CB29B /* tkPanedWindow.c */; };
+ F966BE1508F27A3F005CB29B /* tkPlace.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF208F27A39005CB29B /* tkPlace.c */; };
+ F966BE1708F27A3F005CB29B /* tkPointer.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF408F27A39005CB29B /* tkPointer.c */; };
+ F966BE1908F27A3F005CB29B /* tkRectOval.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF608F27A39005CB29B /* tkRectOval.c */; };
+ F966BE1A08F27A3F005CB29B /* tkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF708F27A39005CB29B /* tkScale.c */; };
+ F966BE1C08F27A40005CB29B /* tkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF908F27A39005CB29B /* tkScrollbar.c */; };
+ F966BE1E08F27A40005CB29B /* tkSelect.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFB08F27A39005CB29B /* tkSelect.c */; };
+ F966BE2008F27A40005CB29B /* tkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFD08F27A39005CB29B /* tkSquare.c */; };
+ F966BE2208F27A40005CB29B /* tkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFF08F27A39005CB29B /* tkStubInit.c */; };
+ F966BE2308F27A40005CB29B /* tkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0008F27A39005CB29B /* tkStubLib.c */; };
+ F966BE2408F27A40005CB29B /* tkStyle.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0108F27A39005CB29B /* tkStyle.c */; };
+ F966BE2508F27A40005CB29B /* tkTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0208F27A39005CB29B /* tkTest.c */; };
+ F966BE2608F27A40005CB29B /* tkText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0308F27A39005CB29B /* tkText.c */; };
+ F966BE2808F27A40005CB29B /* tkTextBTree.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0508F27A39005CB29B /* tkTextBTree.c */; };
+ F966BE2908F27A40005CB29B /* tkTextDisp.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0608F27A39005CB29B /* tkTextDisp.c */; };
+ F966BE2B08F27A40005CB29B /* tkTextImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0808F27A39005CB29B /* tkTextImage.c */; };
+ F966BE2C08F27A40005CB29B /* tkTextIndex.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0908F27A39005CB29B /* tkTextIndex.c */; };
+ F966BE2D08F27A40005CB29B /* tkTextMark.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0A08F27A39005CB29B /* tkTextMark.c */; };
+ F966BE2E08F27A40005CB29B /* tkTextTag.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0B08F27A39005CB29B /* tkTextTag.c */; };
+ F966BE2F08F27A40005CB29B /* tkTextWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0C08F27A39005CB29B /* tkTextWind.c */; };
+ F966BE3008F27A40005CB29B /* tkTrig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0D08F27A39005CB29B /* tkTrig.c */; };
+ F966BE3108F27A40005CB29B /* tkUndo.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0E08F27A39005CB29B /* tkUndo.c */; };
+ F966BE3308F27A40005CB29B /* tkUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1008F27A39005CB29B /* tkUtil.c */; };
+ F966BE3408F27A40005CB29B /* tkVisual.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1108F27A39005CB29B /* tkVisual.c */; };
+ F966BE3508F27A40005CB29B /* tkWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1208F27A39005CB29B /* tkWindow.c */; };
+ F966BEDB08F27A40005CB29B /* tkMacOSXBitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC508F27A3B005CB29B /* tkMacOSXBitmap.c */; };
+ F966BEDC08F27A40005CB29B /* tkMacOSXButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC608F27A3B005CB29B /* tkMacOSXButton.c */; };
+ F966BEDD08F27A40005CB29B /* tkMacOSXCarbonEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC708F27A3B005CB29B /* tkMacOSXCarbonEvents.c */; };
+ F966BEDE08F27A40005CB29B /* tkMacOSXClipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC808F27A3B005CB29B /* tkMacOSXClipboard.c */; };
+ F966BEDF08F27A40005CB29B /* tkMacOSXColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBC908F27A3B005CB29B /* tkMacOSXColor.c */; };
+ F966BEE008F27A40005CB29B /* tkMacOSXConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBCA08F27A3B005CB29B /* tkMacOSXConfig.c */; };
+ F966BEE108F27A40005CB29B /* tkMacOSXCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBCB08F27A3B005CB29B /* tkMacOSXCursor.c */; };
+ F966BEE308F27A40005CB29B /* tkMacOSXDebug.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBCD08F27A3B005CB29B /* tkMacOSXDebug.c */; };
+ F966BEE608F27A40005CB29B /* tkMacOSXDialog.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD008F27A3B005CB29B /* tkMacOSXDialog.c */; };
+ F966BEE708F27A40005CB29B /* tkMacOSXDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD108F27A3B005CB29B /* tkMacOSXDraw.c */; };
+ F966BEE808F27A40005CB29B /* tkMacOSXEmbed.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */; };
+ F966BEE908F27A40005CB29B /* tkMacOSXEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */; };
+ F966BEEA08F27A40005CB29B /* tkMacOSXEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */; };
+ F966BEEC08F27A40005CB29B /* tkMacOSXFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */; };
+ F966BEED08F27A40005CB29B /* tkMacOSXHLEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */; };
+ F966BEEE08F27A40005CB29B /* tkMacOSXInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */; settings = {COMPILER_FLAGS = "-DTK_LIBRARY=\\\"$(TK_LIBRARY)\\\""; }; };
+ F966BEF108F27A40005CB29B /* tkMacOSXKeyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBDB08F27A3B005CB29B /* tkMacOSXKeyboard.c */; };
+ F966BEF208F27A40005CB29B /* tkMacOSXKeyEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBDC08F27A3B005CB29B /* tkMacOSXKeyEvent.c */; };
+ F966BEF308F27A40005CB29B /* tkMacOSXMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBDD08F27A3B005CB29B /* tkMacOSXMenu.c */; };
+ F966BEF608F27A40005CB29B /* tkMacOSXMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE008F27A3B005CB29B /* tkMacOSXMenubutton.c */; };
+ F966BEF708F27A40005CB29B /* tkMacOSXMenus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE108F27A3B005CB29B /* tkMacOSXMenus.c */; };
+ F966BEF808F27A40005CB29B /* tkMacOSXMouseEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE208F27A3B005CB29B /* tkMacOSXMouseEvent.c */; };
+ F966BEF908F27A40005CB29B /* tkMacOSXNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBE308F27A3B005CB29B /* tkMacOSXNotify.c */; };
+ F966BF0108F27A40005CB29B /* tkMacOSXRegion.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBEB08F27A3C005CB29B /* tkMacOSXRegion.c */; };
+ F966BF0308F27A40005CB29B /* tkMacOSXScrlbr.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBED08F27A3C005CB29B /* tkMacOSXScrlbr.c */; };
+ F966BF0408F27A40005CB29B /* tkMacOSXSend.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBEE08F27A3C005CB29B /* tkMacOSXSend.c */; };
+ F966BF0508F27A40005CB29B /* tkMacOSXSubwindows.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBEF08F27A3C005CB29B /* tkMacOSXSubwindows.c */; };
+ F966BF0608F27A40005CB29B /* tkMacOSXTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF008F27A3C005CB29B /* tkMacOSXTest.c */; };
+ F966BF0708F27A40005CB29B /* tkMacOSXWindowEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF108F27A3C005CB29B /* tkMacOSXWindowEvent.c */; };
+ F966BF0808F27A40005CB29B /* tkMacOSXWm.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF208F27A3C005CB29B /* tkMacOSXWm.c */; };
+ F966BF0B08F27A40005CB29B /* tkMacOSXXStubs.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BBF508F27A3C005CB29B /* tkMacOSXXStubs.c */; };
+ F966BF7F08F27A41005CB29B /* tkAppInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7508F27A3D005CB29B /* tkAppInit.c */; settings = {COMPILER_FLAGS = "-DTK_TEST"; }; };
+ F966BF8308F27A41005CB29B /* tkUnix3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7908F27A3D005CB29B /* tkUnix3d.c */; };
+ F966BF9608F27A41005CB29B /* tkUnixScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8C08F27A3D005CB29B /* tkUnixScale.c */; };
+ F966C02A08F27A42005CB29B /* xcolors.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2408F27A3F005CB29B /* xcolors.c */; };
+ F966C02B08F27A42005CB29B /* xdraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2508F27A3F005CB29B /* xdraw.c */; };
+ F966C02C08F27A42005CB29B /* xgc.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2608F27A3F005CB29B /* xgc.c */; };
+ F966C02D08F27A42005CB29B /* ximage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2708F27A3F005CB29B /* ximage.c */; };
+ F966C02E08F27A42005CB29B /* xutil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BD2808F27A3F005CB29B /* xutil.c */; };
+ F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07408F2820D005CB29B /* CoreFoundation.framework */; };
+ F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07608F2821B005CB29B /* Carbon.framework */; };
+ F966C07908F28233005CB29B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07808F28233005CB29B /* IOKit.framework */; };
+ F96888050AF786D5000797B5 /* ttkBlink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E10AF786D5000797B5 /* ttkBlink.c */; };
+ F96888060AF786D5000797B5 /* ttkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E20AF786D5000797B5 /* ttkButton.c */; };
+ F96888070AF786D5000797B5 /* ttkCache.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E30AF786D5000797B5 /* ttkCache.c */; };
+ F96888080AF786D5000797B5 /* ttkClamTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E40AF786D5000797B5 /* ttkClamTheme.c */; };
+ F96888090AF786D5000797B5 /* ttkClassicTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E50AF786D5000797B5 /* ttkClassicTheme.c */; };
+ F968880A0AF786D5000797B5 /* ttkDefaultTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */; };
+ F968880B0AF786D5000797B5 /* ttkElements.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E80AF786D5000797B5 /* ttkElements.c */; };
+ F968880C0AF786D5000797B5 /* ttkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E90AF786D5000797B5 /* ttkEntry.c */; };
+ F968880D0AF786D5000797B5 /* ttkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EA0AF786D5000797B5 /* ttkFrame.c */; };
+ F968880E0AF786D5000797B5 /* ttkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EB0AF786D5000797B5 /* ttkImage.c */; };
+ F968880F0AF786D5000797B5 /* ttkInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EC0AF786D5000797B5 /* ttkInit.c */; };
+ F96888100AF786D5000797B5 /* ttkLabel.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887ED0AF786D5000797B5 /* ttkLabel.c */; };
+ F96888110AF786D5000797B5 /* ttkLayout.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EE0AF786D5000797B5 /* ttkLayout.c */; };
+ F96888120AF786D5000797B5 /* ttkManager.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EF0AF786D5000797B5 /* ttkManager.c */; };
+ F96888130AF786D5000797B5 /* ttkNotebook.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F10AF786D5000797B5 /* ttkNotebook.c */; };
+ F96888140AF786D5000797B5 /* ttkPanedwindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F20AF786D5000797B5 /* ttkPanedwindow.c */; };
+ F96888150AF786D5000797B5 /* ttkProgress.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F30AF786D5000797B5 /* ttkProgress.c */; };
+ F96888160AF786D5000797B5 /* ttkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F40AF786D5000797B5 /* ttkScale.c */; };
+ F96888170AF786D5000797B5 /* ttkScroll.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F50AF786D5000797B5 /* ttkScroll.c */; };
+ F96888180AF786D5000797B5 /* ttkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F60AF786D5000797B5 /* ttkScrollbar.c */; };
+ F96888190AF786D5000797B5 /* ttkSeparator.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F70AF786D5000797B5 /* ttkSeparator.c */; };
+ F968881A0AF786D5000797B5 /* ttkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F80AF786D5000797B5 /* ttkSquare.c */; };
+ F968881B0AF786D5000797B5 /* ttkState.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F90AF786D5000797B5 /* ttkState.c */; };
+ F968881C0AF786D5000797B5 /* ttkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FA0AF786D5000797B5 /* ttkStubInit.c */; };
+ F968881D0AF786D5000797B5 /* ttkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FB0AF786D5000797B5 /* ttkStubLib.c */; };
+ F968881E0AF786D5000797B5 /* ttkTagSet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FC0AF786D5000797B5 /* ttkTagSet.c */; };
+ F968881F0AF786D5000797B5 /* ttkTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FD0AF786D5000797B5 /* ttkTheme.c */; };
+ F96888200AF786D5000797B5 /* ttkTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888000AF786D5000797B5 /* ttkTrace.c */; };
+ F96888210AF786D5000797B5 /* ttkTrack.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888010AF786D5000797B5 /* ttkTrack.c */; };
+ F96888220AF786D5000797B5 /* ttkTreeview.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888020AF786D5000797B5 /* ttkTreeview.c */; };
+ F96888230AF786D5000797B5 /* ttkWidget.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888030AF786D5000797B5 /* ttkWidget.c */; };
+ F96888850AF78938000797B5 /* ttkMacOSXTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888840AF78938000797B5 /* ttkMacOSXTheme.c */; };
+ F96D456F08F272BB004A47F5 /* regcomp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED008F272A7004A47F5 /* regcomp.c */; };
+ F96D457208F272BB004A47F5 /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED308F272A7004A47F5 /* regerror.c */; };
+ F96D457508F272BB004A47F5 /* regexec.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED608F272A7004A47F5 /* regexec.c */; };
+ F96D457608F272BB004A47F5 /* regfree.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED708F272A7004A47F5 /* regfree.c */; };
+ F96D457B08F272BB004A47F5 /* tclAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDC08F272A7004A47F5 /* tclAlloc.c */; settings = {COMPILER_FLAGS = "-DUSE_TCLALLOC=0"; }; };
+ F96D457C08F272BB004A47F5 /* tclAsync.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDD08F272A7004A47F5 /* tclAsync.c */; };
+ F96D457D08F272BB004A47F5 /* tclBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDE08F272A7004A47F5 /* tclBasic.c */; };
+ F96D457E08F272BC004A47F5 /* tclBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDF08F272A7004A47F5 /* tclBinary.c */; };
+ F96D457F08F272BC004A47F5 /* tclCkalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE008F272A7004A47F5 /* tclCkalloc.c */; };
+ F96D458008F272BC004A47F5 /* tclClock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE108F272A7004A47F5 /* tclClock.c */; };
+ F96D458108F272BC004A47F5 /* tclCmdAH.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE208F272A7004A47F5 /* tclCmdAH.c */; };
+ F96D458208F272BC004A47F5 /* tclCmdIL.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE308F272A7004A47F5 /* tclCmdIL.c */; };
+ F96D458308F272BC004A47F5 /* tclCmdMZ.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */; };
+ F96D458408F272BC004A47F5 /* tclCompCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE508F272A7004A47F5 /* tclCompCmds.c */; };
+ F96D458508F272BC004A47F5 /* tclCompExpr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE608F272A7004A47F5 /* tclCompExpr.c */; };
+ F96D458608F272BC004A47F5 /* tclCompile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE708F272A7004A47F5 /* tclCompile.c */; };
+ F96D458808F272BC004A47F5 /* tclConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE908F272A7004A47F5 /* tclConfig.c */; };
+ F96D458908F272BC004A47F5 /* tclDate.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEA08F272A7004A47F5 /* tclDate.c */; };
+ F96D458B08F272BC004A47F5 /* tclDictObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEC08F272A7004A47F5 /* tclDictObj.c */; };
+ F96D458C08F272BC004A47F5 /* tclEncoding.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EED08F272A7004A47F5 /* tclEncoding.c */; };
+ F96D458D08F272BC004A47F5 /* tclEnv.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEE08F272A7004A47F5 /* tclEnv.c */; };
+ F96D458E08F272BC004A47F5 /* tclEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEF08F272A7004A47F5 /* tclEvent.c */; };
+ F96D458F08F272BC004A47F5 /* tclExecute.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF008F272A7004A47F5 /* tclExecute.c */; };
+ F96D459008F272BC004A47F5 /* tclFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF108F272A7004A47F5 /* tclFCmd.c */; };
+ F96D459108F272BC004A47F5 /* tclFileName.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF208F272A7004A47F5 /* tclFileName.c */; };
+ F96D459308F272BC004A47F5 /* tclGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF408F272A7004A47F5 /* tclGet.c */; };
+ F96D459508F272BC004A47F5 /* tclHash.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF608F272A7004A47F5 /* tclHash.c */; };
+ F96D459608F272BC004A47F5 /* tclHistory.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF708F272A7004A47F5 /* tclHistory.c */; };
+ F96D459708F272BC004A47F5 /* tclIndexObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF808F272A7004A47F5 /* tclIndexObj.c */; };
+ F96D459B08F272BC004A47F5 /* tclInterp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFC08F272A7004A47F5 /* tclInterp.c */; };
+ F96D459D08F272BC004A47F5 /* tclIO.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFE08F272A7004A47F5 /* tclIO.c */; };
+ F96D459F08F272BC004A47F5 /* tclIOCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0008F272A7004A47F5 /* tclIOCmd.c */; };
+ F96D45A008F272BC004A47F5 /* tclIOGT.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0108F272A7004A47F5 /* tclIOGT.c */; };
+ F96D45A108F272BC004A47F5 /* tclIORChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0208F272A7004A47F5 /* tclIORChan.c */; };
+ F96D45A208F272BC004A47F5 /* tclIOSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0308F272A7004A47F5 /* tclIOSock.c */; };
+ F96D45A308F272BC004A47F5 /* tclIOUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0408F272A7004A47F5 /* tclIOUtil.c */; };
+ F96D45A408F272BC004A47F5 /* tclLink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0508F272A7004A47F5 /* tclLink.c */; };
+ F96D45A508F272BC004A47F5 /* tclListObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0608F272A7004A47F5 /* tclListObj.c */; };
+ F96D45A608F272BC004A47F5 /* tclLiteral.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0708F272A7004A47F5 /* tclLiteral.c */; };
+ F96D45A708F272BC004A47F5 /* tclLoad.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0808F272A7004A47F5 /* tclLoad.c */; };
+ F96D45A908F272BC004A47F5 /* tclMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0A08F272A7004A47F5 /* tclMain.c */; };
+ F96D45AA08F272BC004A47F5 /* tclNamesp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0B08F272A7004A47F5 /* tclNamesp.c */; };
+ F96D45AB08F272BC004A47F5 /* tclNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0C08F272A7004A47F5 /* tclNotify.c */; };
+ F96D45AC08F272BC004A47F5 /* tclObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0D08F272A7004A47F5 /* tclObj.c */; };
+ F96D45AD08F272BC004A47F5 /* tclPanic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0E08F272A7004A47F5 /* tclPanic.c */; };
+ F96D45AE08F272BC004A47F5 /* tclParse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0F08F272A7004A47F5 /* tclParse.c */; };
+ F96D45B008F272BC004A47F5 /* tclPathObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1108F272A7004A47F5 /* tclPathObj.c */; };
+ F96D45B108F272BC004A47F5 /* tclPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1208F272A7004A47F5 /* tclPipe.c */; };
+ F96D45B208F272BC004A47F5 /* tclPkg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1308F272A7004A47F5 /* tclPkg.c */; };
+ F96D45B308F272BC004A47F5 /* tclPkgConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */; settings = {COMPILER_FLAGS = "-DCFG_INSTALL_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_INSTALL_BINDIR=\\\"$(BINDIR)\\\" -DCFG_INSTALL_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_INSTALL_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_INSTALL_DOCDIR=\\\"$(MANDIR)\\\" -DCFG_RUNTIME_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_RUNTIME_BINDIR=\\\"$(BINDIR)\\\" -DCFG_RUNTIME_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_RUNTIME_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_RUNTIME_DOCDIR=\\\"$(MANDIR)\\\""; }; };
+ F96D45B608F272BC004A47F5 /* tclPosixStr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1708F272A7004A47F5 /* tclPosixStr.c */; };
+ F96D45B708F272BC004A47F5 /* tclPreserve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1808F272A7004A47F5 /* tclPreserve.c */; };
+ F96D45B808F272BC004A47F5 /* tclProc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1908F272A7004A47F5 /* tclProc.c */; };
+ F96D45B908F272BC004A47F5 /* tclRegexp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1A08F272A7004A47F5 /* tclRegexp.c */; };
+ F96D45BB08F272BC004A47F5 /* tclResolve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1C08F272A7004A47F5 /* tclResolve.c */; };
+ F96D45BC08F272BC004A47F5 /* tclResult.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1D08F272A7004A47F5 /* tclResult.c */; };
+ F96D45BD08F272BC004A47F5 /* tclScan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1E08F272A7004A47F5 /* tclScan.c */; };
+ F96D45BE08F272BC004A47F5 /* tclStringObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1F08F272A7004A47F5 /* tclStringObj.c */; };
+ F96D45C308F272BC004A47F5 /* tclStrToD.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2408F272A7004A47F5 /* tclStrToD.c */; };
+ F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2508F272A7004A47F5 /* tclStubInit.c */; };
+ F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2608F272A7004A47F5 /* tclStubLib.c */; };
+ F96D45C908F272BC004A47F5 /* tclThread.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2A08F272A7004A47F5 /* tclThread.c */; };
+ F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */; };
+ F96D45CB08F272BC004A47F5 /* tclThreadJoin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */; };
+ F96D45CC08F272BC004A47F5 /* tclThreadStorage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */; };
+ F96D45CE08F272BC004A47F5 /* tclTimer.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2F08F272A7004A47F5 /* tclTimer.c */; };
+ F96D45D008F272BC004A47F5 /* tclTomMathInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */; };
+ F96D45D108F272BC004A47F5 /* tclTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3208F272A7004A47F5 /* tclTrace.c */; };
+ F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3408F272A7004A47F5 /* tclUtf.c */; };
+ F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3508F272A7004A47F5 /* tclUtil.c */; };
+ F96D45D508F272BC004A47F5 /* tclVar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3608F272A7004A47F5 /* tclVar.c */; };
+ F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */; };
+ F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */; };
+ F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426908F272B3004A47F5 /* bn_mp_add.c */; };
+ F96D48E808F272C3004A47F5 /* bn_mp_add_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */; };
+ F96D48EB08F272C3004A47F5 /* bn_mp_clamp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */; };
+ F96D48EC08F272C3004A47F5 /* bn_mp_clear.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426E08F272B3004A47F5 /* bn_mp_clear.c */; };
+ F96D48ED08F272C3004A47F5 /* bn_mp_clear_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */; };
+ F96D48EE08F272C3004A47F5 /* bn_mp_cmp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427008F272B3004A47F5 /* bn_mp_cmp.c */; };
+ F96D48F008F272C3004A47F5 /* bn_mp_cmp_mag.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */; };
+ F96D48F208F272C3004A47F5 /* bn_mp_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427408F272B3004A47F5 /* bn_mp_copy.c */; };
+ F96D48F308F272C3004A47F5 /* bn_mp_count_bits.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */; };
+ F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427608F272B3004A47F5 /* bn_mp_div.c */; };
+ F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427708F272B3004A47F5 /* bn_mp_div_2.c */; };
+ F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */; };
+ F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_mp_div_3.c */; };
+ F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */; };
+ F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427E08F272B3004A47F5 /* bn_mp_exch.c */; };
+ F96D490508F272C3004A47F5 /* bn_mp_grow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428708F272B3004A47F5 /* bn_mp_grow.c */; };
+ F96D490608F272C3004A47F5 /* bn_mp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428808F272B3004A47F5 /* bn_mp_init.c */; };
+ F96D490708F272C3004A47F5 /* bn_mp_init_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */; };
+ F96D490808F272C3004A47F5 /* bn_mp_init_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */; };
+ F96D490908F272C3004A47F5 /* bn_mp_init_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */; };
+ F96D490B08F272C3004A47F5 /* bn_mp_init_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */; };
+ F96D491008F272C3004A47F5 /* bn_mp_karatsuba_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */; };
+ F96D491108F272C3004A47F5 /* bn_mp_karatsuba_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */; };
+ F96D491308F272C3004A47F5 /* bn_mp_lshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429508F272B3004A47F5 /* bn_mp_lshd.c */; };
+ F96D491408F272C3004A47F5 /* bn_mp_mod.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429608F272B3004A47F5 /* bn_mp_mod.c */; };
+ F96D491508F272C3004A47F5 /* bn_mp_mod_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */; };
+ F96D491A08F272C3004A47F5 /* bn_mp_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429C08F272B3004A47F5 /* bn_mp_mul.c */; };
+ F96D491B08F272C3004A47F5 /* bn_mp_mul_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */; };
+ F96D491C08F272C3004A47F5 /* bn_mp_mul_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */; };
+ F96D491D08F272C3004A47F5 /* bn_mp_mul_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */; };
+ F96D492908F272C3004A47F5 /* bn_mp_radix_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */; };
+ F96D492A08F272C3004A47F5 /* bn_mp_radix_smap.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */; };
+ F96D492C08F272C3004A47F5 /* bn_mp_read_radix.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */; };
+ F96D493708F272C3004A47F5 /* bn_mp_rshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */; };
+ F96D493808F272C3004A47F5 /* bn_mp_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BA08F272B3004A47F5 /* bn_mp_set.c */; };
+ F96D493C08F272C3004A47F5 /* bn_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */; };
+ F96D493F08F272C3004A47F5 /* bn_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C108F272B3004A47F5 /* bn_mp_sub.c */; };
+ F96D494008F272C3004A47F5 /* bn_mp_sub_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */; };
+ F96D494608F272C3004A47F5 /* bn_mp_toom_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */; };
+ F96D494708F272C3004A47F5 /* bn_mp_toom_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */; };
+ F96D494908F272C3004A47F5 /* bn_mp_toradix_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */; };
+ F96D494C08F272C3004A47F5 /* bn_mp_zero.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */; };
+ F96D494E08F272C3004A47F5 /* bn_reverse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D008F272B3004A47F5 /* bn_reverse.c */; };
+ F96D494F08F272C3004A47F5 /* bn_s_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */; };
+ F96D495108F272C3004A47F5 /* bn_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */; };
+ F96D495308F272C3004A47F5 /* bn_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */; };
+ F96D495408F272C3004A47F5 /* bn_s_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */; };
+ F96D495508F272C3004A47F5 /* bncore.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D708F272B3004A47F5 /* bncore.c */; };
+ F96D49A908F272C4004A47F5 /* tclMacOSXBundle.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */; };
+ F96D49AD08F272C4004A47F5 /* tclMacOSXFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */; };
+ F96D49AE08F272C4004A47F5 /* tclMacOSXNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */; };
+ F96D4AC608F272C9004A47F5 /* tclLoadDyld.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445B08F272B9004A47F5 /* tclLoadDyld.c */; };
+ F96D4ACA08F272C9004A47F5 /* tclUnixChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445F08F272B9004A47F5 /* tclUnixChan.c */; };
+ F96D4ACB08F272C9004A47F5 /* tclUnixEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446008F272B9004A47F5 /* tclUnixEvent.c */; };
+ F96D4ACC08F272C9004A47F5 /* tclUnixFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446108F272B9004A47F5 /* tclUnixFCmd.c */; };
+ F96D4ACD08F272C9004A47F5 /* tclUnixFile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446208F272B9004A47F5 /* tclUnixFile.c */; };
+ F96D4ACE08F272C9004A47F5 /* tclUnixInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446308F272B9004A47F5 /* tclUnixInit.c */; settings = {COMPILER_FLAGS = "-DTCL_LIBRARY=\\\"$(TCL_LIBRARY)\\\" -DTCL_PACKAGE_PATH=\\\"$(TCL_PACKAGE_PATH)\\\""; }; };
+ F96D4ACF08F272C9004A47F5 /* tclUnixNotfy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446408F272B9004A47F5 /* tclUnixNotfy.c */; };
+ F96D4AD008F272C9004A47F5 /* tclUnixPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446508F272B9004A47F5 /* tclUnixPipe.c */; };
+ F96D4AD208F272CA004A47F5 /* tclUnixSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446708F272B9004A47F5 /* tclUnixSock.c */; };
+ F96D4AD408F272CA004A47F5 /* tclUnixThrd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446908F272B9004A47F5 /* tclUnixThrd.c */; };
+ F96D4AD608F272CA004A47F5 /* tclUnixTime.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446B08F272B9004A47F5 /* tclUnixTime.c */; };
+ F9E61D28090A481F002B3151 /* bn_mp_cmp_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */; };
+ F9E61D29090A486C002B3151 /* bn_mp_neg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A208F272B3004A47F5 /* bn_mp_neg.c */; };
+ F9E61D2A090A4891002B3151 /* bn_mp_sqrt.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */; };
+ F9E61D2B090A48A4002B3151 /* bn_mp_and.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426C08F272B3004A47F5 /* bn_mp_and.c */; };
+ F9E61D2C090A48AC002B3151 /* bn_mp_expt_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */; };
+ F9E61D2D090A48BB002B3151 /* bn_mp_xor.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */; };
+ F9E61D2E090A48BF002B3151 /* bn_mp_or.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A308F272B3004A47F5 /* bn_mp_or.c */; };
+ F9E61D2F090A48C7002B3151 /* bn_mp_shrink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */; };
+ F9E61D30090A48E2002B3151 /* bn_mp_to_unsigned_bin_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */; };
+ F9E61D31090A48F9002B3151 /* bn_mp_to_unsigned_bin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */; };
+ F9E61D32090A48FA002B3151 /* bn_mp_unsigned_bin_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */; };
+ F9EA4AF008FA3BD500B1F5F0 /* tkMacOSXXCursors.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBF408F27A3C005CB29B /* tkMacOSXXCursors.r */; };
+ F9EA4AF208FA3BD800B1F5F0 /* tkMacOSXCursors.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBCC08F27A3B005CB29B /* tkMacOSXCursors.r */; };
+ F9EA4AF308FA3BDA00B1F5F0 /* tkMacOSXAETE.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBC408F27A3B005CB29B /* tkMacOSXAETE.r */; };
+ F9EA4AF408FA3BDB00B1F5F0 /* tkAboutDlg.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBC108F27A3B005CB29B /* tkAboutDlg.r */; };
+ F9F4415E0C8BAE6F00BCCD67 /* tclDTrace.d in Sources */ = {isa = PBXBuildFile; fileRef = F9F4415D0C8BAE6F00BCCD67 /* tclDTrace.d */; };
+ F9FC77B80AB29E9100B7077D /* tclUnixCompat.c in Sources */ = {isa = PBXBuildFile; fileRef = F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */; };
+ F9FD30BC0CC1AD070073837D /* regcomp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED008F272A7004A47F5 /* regcomp.c */; };
+ F9FD30BD0CC1AD070073837D /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED308F272A7004A47F5 /* regerror.c */; };
+ F9FD30BE0CC1AD070073837D /* regexec.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED608F272A7004A47F5 /* regexec.c */; };
+ F9FD30BF0CC1AD070073837D /* regfree.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3ED708F272A7004A47F5 /* regfree.c */; };
+ F9FD30C00CC1AD070073837D /* tclAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDC08F272A7004A47F5 /* tclAlloc.c */; settings = {COMPILER_FLAGS = "-DUSE_TCLALLOC=0"; }; };
+ F9FD30C10CC1AD070073837D /* tclAsync.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDD08F272A7004A47F5 /* tclAsync.c */; };
+ F9FD30C20CC1AD070073837D /* tclBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDE08F272A7004A47F5 /* tclBasic.c */; };
+ F9FD30C30CC1AD070073837D /* tclBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EDF08F272A7004A47F5 /* tclBinary.c */; };
+ F9FD30C40CC1AD070073837D /* tclCkalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE008F272A7004A47F5 /* tclCkalloc.c */; };
+ F9FD30C50CC1AD070073837D /* tclClock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE108F272A7004A47F5 /* tclClock.c */; };
+ F9FD30C60CC1AD070073837D /* tclCmdAH.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE208F272A7004A47F5 /* tclCmdAH.c */; };
+ F9FD30C70CC1AD070073837D /* tclCmdIL.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE308F272A7004A47F5 /* tclCmdIL.c */; };
+ F9FD30C80CC1AD070073837D /* tclCmdMZ.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */; };
+ F9FD30C90CC1AD070073837D /* tclCompCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE508F272A7004A47F5 /* tclCompCmds.c */; };
+ F9FD30CA0CC1AD070073837D /* tclCompExpr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE608F272A7004A47F5 /* tclCompExpr.c */; };
+ F9FD30CB0CC1AD070073837D /* tclCompile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE708F272A7004A47F5 /* tclCompile.c */; };
+ F9FD30CC0CC1AD070073837D /* tclConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EE908F272A7004A47F5 /* tclConfig.c */; };
+ F9FD30CD0CC1AD070073837D /* tclDate.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEA08F272A7004A47F5 /* tclDate.c */; };
+ F9FD30CE0CC1AD070073837D /* tclDictObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEC08F272A7004A47F5 /* tclDictObj.c */; };
+ F9FD30CF0CC1AD070073837D /* tclEncoding.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EED08F272A7004A47F5 /* tclEncoding.c */; };
+ F9FD30D00CC1AD070073837D /* tclEnv.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEE08F272A7004A47F5 /* tclEnv.c */; };
+ F9FD30D10CC1AD070073837D /* tclEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EEF08F272A7004A47F5 /* tclEvent.c */; };
+ F9FD30D20CC1AD070073837D /* tclExecute.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF008F272A7004A47F5 /* tclExecute.c */; };
+ F9FD30D30CC1AD070073837D /* tclFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF108F272A7004A47F5 /* tclFCmd.c */; };
+ F9FD30D40CC1AD070073837D /* tclFileName.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF208F272A7004A47F5 /* tclFileName.c */; };
+ F9FD30D50CC1AD070073837D /* tclGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF408F272A7004A47F5 /* tclGet.c */; };
+ F9FD30D60CC1AD070073837D /* tclHash.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF608F272A7004A47F5 /* tclHash.c */; };
+ F9FD30D70CC1AD070073837D /* tclHistory.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF708F272A7004A47F5 /* tclHistory.c */; };
+ F9FD30D80CC1AD070073837D /* tclIndexObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EF808F272A7004A47F5 /* tclIndexObj.c */; };
+ F9FD30D90CC1AD070073837D /* tclInterp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFC08F272A7004A47F5 /* tclInterp.c */; };
+ F9FD30DA0CC1AD070073837D /* tclIO.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3EFE08F272A7004A47F5 /* tclIO.c */; };
+ F9FD30DB0CC1AD070073837D /* tclIOCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0008F272A7004A47F5 /* tclIOCmd.c */; };
+ F9FD30DC0CC1AD070073837D /* tclIOGT.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0108F272A7004A47F5 /* tclIOGT.c */; };
+ F9FD30DD0CC1AD070073837D /* tclIORChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0208F272A7004A47F5 /* tclIORChan.c */; };
+ F9FD30DE0CC1AD070073837D /* tclIOSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0308F272A7004A47F5 /* tclIOSock.c */; };
+ F9FD30DF0CC1AD070073837D /* tclIOUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0408F272A7004A47F5 /* tclIOUtil.c */; };
+ F9FD30E00CC1AD070073837D /* tclLink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0508F272A7004A47F5 /* tclLink.c */; };
+ F9FD30E10CC1AD070073837D /* tclListObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0608F272A7004A47F5 /* tclListObj.c */; };
+ F9FD30E20CC1AD070073837D /* tclLiteral.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0708F272A7004A47F5 /* tclLiteral.c */; };
+ F9FD30E30CC1AD070073837D /* tclLoad.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0808F272A7004A47F5 /* tclLoad.c */; };
+ F9FD30E40CC1AD070073837D /* tclMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0A08F272A7004A47F5 /* tclMain.c */; };
+ F9FD30E50CC1AD070073837D /* tclNamesp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0B08F272A7004A47F5 /* tclNamesp.c */; };
+ F9FD30E60CC1AD070073837D /* tclNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0C08F272A7004A47F5 /* tclNotify.c */; };
+ F9FD30E70CC1AD070073837D /* tclObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0D08F272A7004A47F5 /* tclObj.c */; };
+ F9FD30E80CC1AD070073837D /* tclPanic.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0E08F272A7004A47F5 /* tclPanic.c */; };
+ F9FD30E90CC1AD070073837D /* tclParse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F0F08F272A7004A47F5 /* tclParse.c */; };
+ F9FD30EA0CC1AD070073837D /* tclPathObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1108F272A7004A47F5 /* tclPathObj.c */; };
+ F9FD30EB0CC1AD070073837D /* tclPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1208F272A7004A47F5 /* tclPipe.c */; };
+ F9FD30EC0CC1AD070073837D /* tclPkg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1308F272A7004A47F5 /* tclPkg.c */; };
+ F9FD30ED0CC1AD070073837D /* tclPkgConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */; settings = {COMPILER_FLAGS = "-DCFG_INSTALL_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_INSTALL_BINDIR=\\\"$(BINDIR)\\\" -DCFG_INSTALL_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_INSTALL_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_INSTALL_DOCDIR=\\\"$(MANDIR)\\\" -DCFG_RUNTIME_LIBDIR=\\\"$(LIBDIR)\\\" -DCFG_RUNTIME_BINDIR=\\\"$(BINDIR)\\\" -DCFG_RUNTIME_SCRDIR=\\\"$(TCL_LIBRARY)\\\" -DCFG_RUNTIME_INCDIR=\\\"$(INCLUDEDIR)\\\" -DCFG_RUNTIME_DOCDIR=\\\"$(MANDIR)\\\""; }; };
+ F9FD30EE0CC1AD070073837D /* tclPosixStr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1708F272A7004A47F5 /* tclPosixStr.c */; };
+ F9FD30EF0CC1AD070073837D /* tclPreserve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1808F272A7004A47F5 /* tclPreserve.c */; };
+ F9FD30F00CC1AD070073837D /* tclProc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1908F272A7004A47F5 /* tclProc.c */; };
+ F9FD30F10CC1AD070073837D /* tclRegexp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1A08F272A7004A47F5 /* tclRegexp.c */; };
+ F9FD30F20CC1AD070073837D /* tclResolve.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1C08F272A7004A47F5 /* tclResolve.c */; };
+ F9FD30F30CC1AD070073837D /* tclResult.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1D08F272A7004A47F5 /* tclResult.c */; };
+ F9FD30F40CC1AD070073837D /* tclScan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1E08F272A7004A47F5 /* tclScan.c */; };
+ F9FD30F50CC1AD070073837D /* tclStringObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F1F08F272A7004A47F5 /* tclStringObj.c */; };
+ F9FD30F60CC1AD070073837D /* tclStrToD.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2408F272A7004A47F5 /* tclStrToD.c */; };
+ F9FD30F70CC1AD070073837D /* tclStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2508F272A7004A47F5 /* tclStubInit.c */; };
+ F9FD30F80CC1AD070073837D /* tclStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2608F272A7004A47F5 /* tclStubLib.c */; };
+ F9FD30F90CC1AD070073837D /* tclThread.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2A08F272A7004A47F5 /* tclThread.c */; };
+ F9FD30FA0CC1AD070073837D /* tclThreadAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */; };
+ F9FD30FB0CC1AD070073837D /* tclThreadJoin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */; };
+ F9FD30FC0CC1AD070073837D /* tclThreadStorage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */; };
+ F9FD30FD0CC1AD070073837D /* tclTimer.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2F08F272A7004A47F5 /* tclTimer.c */; };
+ F9FD30FE0CC1AD070073837D /* tclTomMathInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */; };
+ F9FD30FF0CC1AD070073837D /* tclTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3208F272A7004A47F5 /* tclTrace.c */; };
+ F9FD31000CC1AD070073837D /* tclUtf.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3408F272A7004A47F5 /* tclUtf.c */; };
+ F9FD31010CC1AD070073837D /* tclUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3508F272A7004A47F5 /* tclUtil.c */; };
+ F9FD31020CC1AD070073837D /* tclVar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3608F272A7004A47F5 /* tclVar.c */; };
+ F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */; };
+ F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */; };
+ F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426908F272B3004A47F5 /* bn_mp_add.c */; };
+ F9FD31060CC1AD070073837D /* bn_mp_add_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */; };
+ F9FD31070CC1AD070073837D /* bn_mp_and.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426C08F272B3004A47F5 /* bn_mp_and.c */; };
+ F9FD31080CC1AD070073837D /* bn_mp_clamp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */; };
+ F9FD31090CC1AD070073837D /* bn_mp_clear.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426E08F272B3004A47F5 /* bn_mp_clear.c */; };
+ F9FD310A0CC1AD070073837D /* bn_mp_clear_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */; };
+ F9FD310B0CC1AD070073837D /* bn_mp_cmp.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427008F272B3004A47F5 /* bn_mp_cmp.c */; };
+ F9FD310C0CC1AD070073837D /* bn_mp_cmp_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */; };
+ F9FD310D0CC1AD070073837D /* bn_mp_cmp_mag.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */; };
+ F9FD310E0CC1AD070073837D /* bn_mp_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427408F272B3004A47F5 /* bn_mp_copy.c */; };
+ F9FD310F0CC1AD070073837D /* bn_mp_count_bits.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */; };
+ F9FD31100CC1AD070073837D /* bn_mp_div.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427608F272B3004A47F5 /* bn_mp_div.c */; };
+ F9FD31110CC1AD070073837D /* bn_mp_div_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427708F272B3004A47F5 /* bn_mp_div_2.c */; };
+ F9FD31120CC1AD070073837D /* bn_mp_div_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */; };
+ F9FD31130CC1AD070073837D /* bn_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_mp_div_3.c */; };
+ F9FD31140CC1AD070073837D /* bn_mp_div_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */; };
+ F9FD31150CC1AD070073837D /* bn_mp_exch.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427E08F272B3004A47F5 /* bn_mp_exch.c */; };
+ F9FD31160CC1AD070073837D /* bn_mp_expt_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */; };
+ F9FD31170CC1AD070073837D /* bn_mp_grow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428708F272B3004A47F5 /* bn_mp_grow.c */; };
+ F9FD31180CC1AD070073837D /* bn_mp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428808F272B3004A47F5 /* bn_mp_init.c */; };
+ F9FD31190CC1AD070073837D /* bn_mp_init_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */; };
+ F9FD311A0CC1AD070073837D /* bn_mp_init_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */; };
+ F9FD311B0CC1AD070073837D /* bn_mp_init_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */; };
+ F9FD311C0CC1AD070073837D /* bn_mp_init_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */; };
+ F9FD311D0CC1AD070073837D /* bn_mp_karatsuba_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */; };
+ F9FD311E0CC1AD070073837D /* bn_mp_karatsuba_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */; };
+ F9FD311F0CC1AD070073837D /* bn_mp_lshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429508F272B3004A47F5 /* bn_mp_lshd.c */; };
+ F9FD31200CC1AD070073837D /* bn_mp_mod.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429608F272B3004A47F5 /* bn_mp_mod.c */; };
+ F9FD31210CC1AD070073837D /* bn_mp_mod_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */; };
+ F9FD31220CC1AD070073837D /* bn_mp_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429C08F272B3004A47F5 /* bn_mp_mul.c */; };
+ F9FD31230CC1AD070073837D /* bn_mp_mul_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */; };
+ F9FD31240CC1AD070073837D /* bn_mp_mul_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */; };
+ F9FD31250CC1AD070073837D /* bn_mp_mul_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */; };
+ F9FD31260CC1AD070073837D /* bn_mp_neg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A208F272B3004A47F5 /* bn_mp_neg.c */; };
+ F9FD31270CC1AD070073837D /* bn_mp_or.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A308F272B3004A47F5 /* bn_mp_or.c */; };
+ F9FD31280CC1AD070073837D /* bn_mp_radix_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */; };
+ F9FD31290CC1AD070073837D /* bn_mp_radix_smap.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */; };
+ F9FD312A0CC1AD070073837D /* bn_mp_read_radix.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */; };
+ F9FD312B0CC1AD070073837D /* bn_mp_rshd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */; };
+ F9FD312C0CC1AD070073837D /* bn_mp_set.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BA08F272B3004A47F5 /* bn_mp_set.c */; };
+ F9FD312D0CC1AD070073837D /* bn_mp_shrink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */; };
+ F9FD312E0CC1AD070073837D /* bn_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */; };
+ F9FD312F0CC1AD070073837D /* bn_mp_sqrt.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */; };
+ F9FD31300CC1AD070073837D /* bn_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C108F272B3004A47F5 /* bn_mp_sub.c */; };
+ F9FD31310CC1AD070073837D /* bn_mp_sub_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */; };
+ F9FD31320CC1AD070073837D /* bn_mp_to_unsigned_bin_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */; };
+ F9FD31330CC1AD070073837D /* bn_mp_to_unsigned_bin.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */; };
+ F9FD31340CC1AD070073837D /* bn_mp_toom_mul.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */; };
+ F9FD31350CC1AD070073837D /* bn_mp_toom_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */; };
+ F9FD31360CC1AD070073837D /* bn_mp_toradix_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */; };
+ F9FD31370CC1AD070073837D /* bn_mp_unsigned_bin_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */; };
+ F9FD31380CC1AD070073837D /* bn_mp_xor.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */; };
+ F9FD31390CC1AD070073837D /* bn_mp_zero.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */; };
+ F9FD313A0CC1AD070073837D /* bn_reverse.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D008F272B3004A47F5 /* bn_reverse.c */; };
+ F9FD313B0CC1AD070073837D /* bn_s_mp_add.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */; };
+ F9FD313C0CC1AD070073837D /* bn_s_mp_mul_digs.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */; };
+ F9FD313D0CC1AD070073837D /* bn_s_mp_sqr.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */; };
+ F9FD313E0CC1AD070073837D /* bn_s_mp_sub.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */; };
+ F9FD313F0CC1AD070073837D /* bncore.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42D708F272B3004A47F5 /* bncore.c */; };
+ F9FD31400CC1AD070073837D /* tclMacOSXBundle.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */; };
+ F9FD31410CC1AD070073837D /* tclMacOSXFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */; };
+ F9FD31420CC1AD070073837D /* tclMacOSXNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */; };
+ F9FD31430CC1AD070073837D /* tclLoadDyld.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445B08F272B9004A47F5 /* tclLoadDyld.c */; };
+ F9FD31440CC1AD070073837D /* tclUnixChan.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D445F08F272B9004A47F5 /* tclUnixChan.c */; };
+ F9FD31450CC1AD070073837D /* tclUnixCompat.c in Sources */ = {isa = PBXBuildFile; fileRef = F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */; };
+ F9FD31460CC1AD070073837D /* tclUnixEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446008F272B9004A47F5 /* tclUnixEvent.c */; };
+ F9FD31470CC1AD070073837D /* tclUnixFCmd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446108F272B9004A47F5 /* tclUnixFCmd.c */; };
+ F9FD31480CC1AD070073837D /* tclUnixFile.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446208F272B9004A47F5 /* tclUnixFile.c */; };
+ F9FD31490CC1AD070073837D /* tclUnixInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446308F272B9004A47F5 /* tclUnixInit.c */; settings = {COMPILER_FLAGS = "-DTCL_LIBRARY=\\\"$(TCL_LIBRARY)\\\" -DTCL_PACKAGE_PATH=\\\"$(TCL_PACKAGE_PATH)\\\""; }; };
+ F9FD314A0CC1AD070073837D /* tclUnixNotfy.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446408F272B9004A47F5 /* tclUnixNotfy.c */; };
+ F9FD314B0CC1AD070073837D /* tclUnixPipe.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446508F272B9004A47F5 /* tclUnixPipe.c */; };
+ F9FD314C0CC1AD070073837D /* tclUnixSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446708F272B9004A47F5 /* tclUnixSock.c */; };
+ F9FD314D0CC1AD070073837D /* tclUnixThrd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446908F272B9004A47F5 /* tclUnixThrd.c */; };
+ F9FD314E0CC1AD070073837D /* tclUnixTime.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446B08F272B9004A47F5 /* tclUnixTime.c */; };
+ F9FD314F0CC1AD070073837D /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
+ F9FD31500CC1AD070073837D /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
+ F9FD31510CC1AD070073837D /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
+ F9FD31520CC1AD070073837D /* tkBind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB008F27A39005CB29B /* tkBind.c */; };
+ F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB108F27A39005CB29B /* tkBitmap.c */; };
+ F9FD31540CC1AD070073837D /* tkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB208F27A39005CB29B /* tkButton.c */; };
+ F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB408F27A39005CB29B /* tkCanvArc.c */; };
+ F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB508F27A39005CB29B /* tkCanvas.c */; };
+ F9FD31570CC1AD070073837D /* tkCanvBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB708F27A39005CB29B /* tkCanvBmap.c */; };
+ F9FD31580CC1AD070073837D /* tkCanvImg.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB808F27A39005CB29B /* tkCanvImg.c */; };
+ F9FD31590CC1AD070073837D /* tkCanvLine.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAB908F27A39005CB29B /* tkCanvLine.c */; };
+ F9FD315A0CC1AD070073837D /* tkCanvPoly.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABA08F27A39005CB29B /* tkCanvPoly.c */; };
+ F9FD315B0CC1AD070073837D /* tkCanvPs.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABB08F27A39005CB29B /* tkCanvPs.c */; };
+ F9FD315C0CC1AD070073837D /* tkCanvText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABD08F27A39005CB29B /* tkCanvText.c */; };
+ F9FD315D0CC1AD070073837D /* tkCanvUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABE08F27A39005CB29B /* tkCanvUtil.c */; };
+ F9FD315E0CC1AD070073837D /* tkCanvWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BABF08F27A39005CB29B /* tkCanvWind.c */; };
+ F9FD315F0CC1AD070073837D /* tkClipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC008F27A39005CB29B /* tkClipboard.c */; };
+ F9FD31600CC1AD070073837D /* tkCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC108F27A39005CB29B /* tkCmds.c */; };
+ F9FD31610CC1AD070073837D /* tkColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC208F27A39005CB29B /* tkColor.c */; };
+ F9FD31620CC1AD070073837D /* tkConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC408F27A39005CB29B /* tkConfig.c */; };
+ F9FD31630CC1AD070073837D /* tkConsole.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC508F27A39005CB29B /* tkConsole.c */; };
+ F9FD31640CC1AD070073837D /* tkCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC608F27A39005CB29B /* tkCursor.c */; };
+ F9FD31650CC1AD070073837D /* tkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAC808F27A39005CB29B /* tkEntry.c */; };
+ F9FD31660CC1AD070073837D /* tkError.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACA08F27A39005CB29B /* tkError.c */; };
+ F9FD31670CC1AD070073837D /* tkEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACB08F27A39005CB29B /* tkEvent.c */; };
+ F9FD31680CC1AD070073837D /* tkFileFilter.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACC08F27A39005CB29B /* tkFileFilter.c */; };
+ F9FD31690CC1AD070073837D /* tkFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACE08F27A39005CB29B /* tkFocus.c */; };
+ F9FD316A0CC1AD070073837D /* tkFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BACF08F27A39005CB29B /* tkFont.c */; };
+ F9FD316B0CC1AD070073837D /* tkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD108F27A39005CB29B /* tkFrame.c */; };
+ F9FD316C0CC1AD070073837D /* tkGC.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD208F27A39005CB29B /* tkGC.c */; };
+ F9FD316D0CC1AD070073837D /* tkGeometry.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD308F27A39005CB29B /* tkGeometry.c */; };
+ F9FD316E0CC1AD070073837D /* tkGet.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD408F27A39005CB29B /* tkGet.c */; };
+ F9FD316F0CC1AD070073837D /* tkGrab.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD508F27A39005CB29B /* tkGrab.c */; };
+ F9FD31700CC1AD070073837D /* tkGrid.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD608F27A39005CB29B /* tkGrid.c */; };
+ F9FD31710CC1AD070073837D /* tkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD708F27A39005CB29B /* tkImage.c */; };
+ F9FD31720CC1AD070073837D /* tkImgBmap.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD808F27A39005CB29B /* tkImgBmap.c */; };
+ F9FD31730CC1AD070073837D /* tkImgGIF.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAD908F27A39005CB29B /* tkImgGIF.c */; };
+ F9FD31740CC1AD070073837D /* tkImgPhoto.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADA08F27A39005CB29B /* tkImgPhoto.c */; };
+ F9FD31750CC1AD070073837D /* tkImgPPM.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BADB08F27A39005CB29B /* tkImgPPM.c */; };
+ F9FD31760CC1AD070073837D /* tkListbox.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE408F27A39005CB29B /* tkListbox.c */; };
+ F9FD31770CC1AD070073837D /* tkMacWinMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE508F27A39005CB29B /* tkMacWinMenu.c */; };
+ F9FD31780CC1AD070073837D /* tkMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE608F27A39005CB29B /* tkMain.c */; };
+ F9FD31790CC1AD070073837D /* tkMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE708F27A39005CB29B /* tkMenu.c */; };
+ F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE908F27A39005CB29B /* tkMenubutton.c */; };
+ F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEB08F27A39005CB29B /* tkMenuDraw.c */; };
+ F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEC08F27A39005CB29B /* tkMessage.c */; };
+ F9FD317D0CC1AD070073837D /* tkObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAED08F27A39005CB29B /* tkObj.c */; };
+ F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEE08F27A39005CB29B /* tkOldConfig.c */; };
+ F9FD317F0CC1AD070073837D /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
+ F9FD31800CC1AD070073837D /* tkOption.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEF08F27A39005CB29B /* tkOption.c */; };
+ F9FD31810CC1AD070073837D /* tkPack.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF008F27A39005CB29B /* tkPack.c */; };
+ F9FD31820CC1AD070073837D /* tkPanedWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF108F27A39005CB29B /* tkPanedWindow.c */; };
+ F9FD31830CC1AD070073837D /* tkPlace.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF208F27A39005CB29B /* tkPlace.c */; };
+ F9FD31850CC1AD070073837D /* tkRectOval.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF608F27A39005CB29B /* tkRectOval.c */; };
+ F9FD31860CC1AD070073837D /* tkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF708F27A39005CB29B /* tkScale.c */; };
+ F9FD31870CC1AD070073837D /* tkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF908F27A39005CB29B /* tkScrollbar.c */; };
+ F9FD31880CC1AD070073837D /* tkSelect.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFB08F27A39005CB29B /* tkSelect.c */; };
+ F9FD31890CC1AD070073837D /* tkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFD08F27A39005CB29B /* tkSquare.c */; };
+ F9FD318A0CC1AD070073837D /* tkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFF08F27A39005CB29B /* tkStubInit.c */; };
+ F9FD318B0CC1AD070073837D /* tkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0008F27A39005CB29B /* tkStubLib.c */; };
+ F9FD318C0CC1AD070073837D /* tkStyle.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0108F27A39005CB29B /* tkStyle.c */; };
+ F9FD318D0CC1AD070073837D /* tkTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0208F27A39005CB29B /* tkTest.c */; };
+ F9FD318E0CC1AD070073837D /* tkText.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0308F27A39005CB29B /* tkText.c */; };
+ F9FD318F0CC1AD070073837D /* tkTextBTree.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0508F27A39005CB29B /* tkTextBTree.c */; };
+ F9FD31900CC1AD070073837D /* tkTextDisp.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0608F27A39005CB29B /* tkTextDisp.c */; };
+ F9FD31910CC1AD070073837D /* tkTextImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0808F27A39005CB29B /* tkTextImage.c */; };
+ F9FD31920CC1AD070073837D /* tkTextIndex.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0908F27A39005CB29B /* tkTextIndex.c */; };
+ F9FD31930CC1AD070073837D /* tkTextMark.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0A08F27A39005CB29B /* tkTextMark.c */; };
+ F9FD31940CC1AD070073837D /* tkTextTag.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0B08F27A39005CB29B /* tkTextTag.c */; };
+ F9FD31950CC1AD070073837D /* tkTextWind.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0C08F27A39005CB29B /* tkTextWind.c */; };
+ F9FD31960CC1AD070073837D /* tkTrig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0D08F27A39005CB29B /* tkTrig.c */; };
+ F9FD31970CC1AD070073837D /* tkUndo.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB0E08F27A39005CB29B /* tkUndo.c */; };
+ F9FD31980CC1AD070073837D /* tkUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1008F27A39005CB29B /* tkUtil.c */; };
+ F9FD31990CC1AD070073837D /* tkVisual.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1108F27A39005CB29B /* tkVisual.c */; };
+ F9FD319A0CC1AD070073837D /* tkWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BB1208F27A39005CB29B /* tkWindow.c */; };
+ F9FD319B0CC1AD070073837D /* ttkBlink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E10AF786D5000797B5 /* ttkBlink.c */; };
+ F9FD319C0CC1AD070073837D /* ttkButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E20AF786D5000797B5 /* ttkButton.c */; };
+ F9FD319D0CC1AD070073837D /* ttkCache.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E30AF786D5000797B5 /* ttkCache.c */; };
+ F9FD319E0CC1AD070073837D /* ttkClamTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E40AF786D5000797B5 /* ttkClamTheme.c */; };
+ F9FD319F0CC1AD070073837D /* ttkClassicTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E50AF786D5000797B5 /* ttkClassicTheme.c */; };
+ F9FD31A00CC1AD070073837D /* ttkDefaultTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */; };
+ F9FD31A10CC1AD070073837D /* ttkElements.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E80AF786D5000797B5 /* ttkElements.c */; };
+ F9FD31A20CC1AD070073837D /* ttkEntry.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887E90AF786D5000797B5 /* ttkEntry.c */; };
+ F9FD31A30CC1AD070073837D /* ttkFrame.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EA0AF786D5000797B5 /* ttkFrame.c */; };
+ F9FD31A40CC1AD070073837D /* ttkImage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EB0AF786D5000797B5 /* ttkImage.c */; };
+ F9FD31A50CC1AD070073837D /* ttkInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EC0AF786D5000797B5 /* ttkInit.c */; };
+ F9FD31A60CC1AD070073837D /* ttkLabel.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887ED0AF786D5000797B5 /* ttkLabel.c */; };
+ F9FD31A70CC1AD070073837D /* ttkLayout.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EE0AF786D5000797B5 /* ttkLayout.c */; };
+ F9FD31A80CC1AD070073837D /* ttkManager.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887EF0AF786D5000797B5 /* ttkManager.c */; };
+ F9FD31A90CC1AD070073837D /* ttkNotebook.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F10AF786D5000797B5 /* ttkNotebook.c */; };
+ F9FD31AA0CC1AD070073837D /* ttkPanedwindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F20AF786D5000797B5 /* ttkPanedwindow.c */; };
+ F9FD31AB0CC1AD070073837D /* ttkProgress.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F30AF786D5000797B5 /* ttkProgress.c */; };
+ F9FD31AC0CC1AD070073837D /* ttkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F40AF786D5000797B5 /* ttkScale.c */; };
+ F9FD31AD0CC1AD070073837D /* ttkScroll.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F50AF786D5000797B5 /* ttkScroll.c */; };
+ F9FD31AE0CC1AD070073837D /* ttkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F60AF786D5000797B5 /* ttkScrollbar.c */; };
+ F9FD31AF0CC1AD070073837D /* ttkSeparator.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F70AF786D5000797B5 /* ttkSeparator.c */; };
+ F9FD31B00CC1AD070073837D /* ttkSquare.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F80AF786D5000797B5 /* ttkSquare.c */; };
+ F9FD31B10CC1AD070073837D /* ttkState.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887F90AF786D5000797B5 /* ttkState.c */; };
+ F9FD31B20CC1AD070073837D /* ttkStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FA0AF786D5000797B5 /* ttkStubInit.c */; };
+ F9FD31B30CC1AD070073837D /* ttkStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FB0AF786D5000797B5 /* ttkStubLib.c */; };
+ F9FD31B40CC1AD070073837D /* ttkTagSet.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FC0AF786D5000797B5 /* ttkTagSet.c */; };
+ F9FD31B50CC1AD070073837D /* ttkTheme.c in Sources */ = {isa = PBXBuildFile; fileRef = F96887FD0AF786D5000797B5 /* ttkTheme.c */; };
+ F9FD31B60CC1AD070073837D /* ttkTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888000AF786D5000797B5 /* ttkTrace.c */; };
+ F9FD31B70CC1AD070073837D /* ttkTrack.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888010AF786D5000797B5 /* ttkTrack.c */; };
+ F9FD31B80CC1AD070073837D /* ttkTreeview.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888020AF786D5000797B5 /* ttkTreeview.c */; };
+ F9FD31B90CC1AD070073837D /* ttkWidget.c in Sources */ = {isa = PBXBuildFile; fileRef = F96888030AF786D5000797B5 /* ttkWidget.c */; };
+ F9FD31DA0CC1AD070073837D /* tkAppInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7508F27A3D005CB29B /* tkAppInit.c */; settings = {COMPILER_FLAGS = "-DTK_TEST"; }; };
+ F9FD31DB0CC1AD070073837D /* tkUnix3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7908F27A3D005CB29B /* tkUnix3d.c */; };
+ F9FD31DC0CC1AD070073837D /* tkUnixScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8C08F27A3D005CB29B /* tkUnixScale.c */; };
+ F9FD31E20CC1AD070073837D /* tclDTrace.d in Sources */ = {isa = PBXBuildFile; fileRef = F9F4415D0C8BAE6F00BCCD67 /* tclDTrace.d */; };
+ F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F966C07408F2820D005CB29B /* CoreFoundation.framework */; };
+ F9FD31F80CC1ADB70073837D /* tkUnixCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */; };
+ F9FD31FA0CC1ADB70073837D /* tkUnixKey.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8708F27A3D005CB29B /* tkUnixKey.c */; };
+ F9FD31FB0CC1ADB70073837D /* tkUnixXId.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC9108F27A3D005CB29B /* tkUnixXId.c */; };
+ F9FD31FC0CC1ADB70073837D /* tkUnixInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8508F27A3D005CB29B /* tkUnixInit.c */; };
+ F9FD31FD0CC1ADB70073837D /* tkUnixEmbed.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */; };
+ F9FD31FE0CC1ADB70073837D /* tkUnixSend.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8F08F27A3D005CB29B /* tkUnixSend.c */; };
+ F9FD31FF0CC1ADB70073837D /* tkUnixFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8308F27A3D005CB29B /* tkUnixFocus.c */; };
+ F9FD32000CC1ADB70073837D /* tkUnixWm.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC9008F27A3D005CB29B /* tkUnixWm.c */; };
+ F9FD32010CC1ADB70073837D /* tkUnixRFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */; };
+ F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7808F27A3D005CB29B /* tkUnix.c */; };
+ F9FD32030CC1ADB70073837D /* tkUnixMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8808F27A3D005CB29B /* tkUnixMenu.c */; };
+ F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */; };
+ F9FD32050CC1ADB70073837D /* tkUnixDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8008F27A3D005CB29B /* tkUnixDraw.c */; };
+ F9FD32060CC1ADB70073837D /* tkUnixDialog.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7F08F27A3D005CB29B /* tkUnixDialog.c */; };
+ F9FD32070CC1ADB70073837D /* tkUnixSelect.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */; };
+ F9FD32080CC1ADB70073837D /* tkUnixEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8208F27A3D005CB29B /* tkUnixEvent.c */; };
+ F9FD32090CC1ADB70073837D /* tkUnixColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7B08F27A3D005CB29B /* tkUnixColor.c */; };
+ F9FD320A0CC1ADB70073837D /* tkUnixButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7A08F27A3D005CB29B /* tkUnixButton.c */; };
+ F9FD320B0CC1ADB70073837D /* tkUnixMenubu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8908F27A3D005CB29B /* tkUnixMenubu.c */; };
+ F9FD320C0CC1ADB70073837D /* tkUnixScrlbr.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8D08F27A3D005CB29B /* tkUnixScrlbr.c */; };
+ F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD32140CC1AF170073837D /* libX11.dylib */; };
+ F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD32150CC1AF170073837D /* libXext.dylib */; };
+ F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD32160CC1AF170073837D /* libXss.dylib */; };
+ F9FD349B0CC1BB0D0073837D /* libfreetype.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34990CC1BB0D0073837D /* libfreetype.dylib */; };
+ F9FD349C0CC1BB0D0073837D /* libXft.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD349A0CC1BB0D0073837D /* libXft.dylib */; };
+ F9FD34C40CC1BBD70073837D /* libfontconfig.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 8DD76FB20486AB0100D96B5E /* tktest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tktest; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9099B8A0CC67D30005A9580 /* textpeer.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textpeer.tcl; sourceTree = "<group>"; };
+ F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkbut.tcl; sourceTree = "<group>"; };
+ F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Tclsh-Info.plist.in"; sourceTree = "<group>"; };
+ F92240290D7C620F005EC715 /* knightstour.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = knightstour.tcl; sourceTree = "<group>"; };
+ F936FCD70CCD984500716967 /* ttkprogress.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkprogress.tcl; sourceTree = "<group>"; };
+ F936FCD80CCD984600716967 /* tree.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tree.tcl; sourceTree = "<group>"; };
+ F936FCD90CCD984600716967 /* toolbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = toolbar.tcl; sourceTree = "<group>"; };
+ F936FCDA0CCD984600716967 /* ttknote.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttknote.tcl; sourceTree = "<group>"; };
+ F936FCDB0CCD984600716967 /* combo.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combo.tcl; sourceTree = "<group>"; };
+ F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXFont.h; sourceTree = "<group>"; };
+ F95FAFF90B34F1130072E431 /* macOSXLoad.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXLoad.test; sourceTree = "<group>"; };
+ F962F7C60DADC26200648DB8 /* vsapi.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vsapi.test; sourceTree = "<group>"; };
+ F966BA0408F27A37005CB29B /* error.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = error.xbm; sourceTree = "<group>"; };
+ F966BA0508F27A37005CB29B /* gray12.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray12.xbm; sourceTree = "<group>"; };
+ F966BA0608F27A37005CB29B /* gray25.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray25.xbm; sourceTree = "<group>"; };
+ F966BA0708F27A37005CB29B /* gray50.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray50.xbm; sourceTree = "<group>"; };
+ F966BA0808F27A37005CB29B /* gray75.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray75.xbm; sourceTree = "<group>"; };
+ F966BA0908F27A37005CB29B /* hourglass.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = hourglass.xbm; sourceTree = "<group>"; };
+ F966BA0A08F27A37005CB29B /* info.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = info.xbm; sourceTree = "<group>"; };
+ F966BA0B08F27A37005CB29B /* questhead.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = questhead.xbm; sourceTree = "<group>"; };
+ F966BA0C08F27A37005CB29B /* question.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = question.xbm; sourceTree = "<group>"; };
+ F966BA0D08F27A37005CB29B /* warning.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = warning.xbm; sourceTree = "<group>"; };
+ F966BA0E08F27A37005CB29B /* ChangeLog */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = ChangeLog; sourceTree = "<group>"; };
+ F966BA0F08F27A37005CB29B /* changes */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = changes; sourceTree = "<group>"; };
+ F966BA1108F27A37005CB29B /* 3DBorder.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = 3DBorder.3; sourceTree = "<group>"; };
+ F966BA1208F27A37005CB29B /* AddOption.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AddOption.3; sourceTree = "<group>"; };
+ F966BA1308F27A37005CB29B /* bell.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bell.n; sourceTree = "<group>"; };
+ F966BA1408F27A37005CB29B /* bind.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bind.n; sourceTree = "<group>"; };
+ F966BA1508F27A37005CB29B /* BindTable.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = BindTable.3; sourceTree = "<group>"; };
+ F966BA1608F27A37005CB29B /* bindtags.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bindtags.n; sourceTree = "<group>"; };
+ F966BA1708F27A37005CB29B /* bitmap.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bitmap.n; sourceTree = "<group>"; };
+ F966BA1808F27A37005CB29B /* button.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = button.n; sourceTree = "<group>"; };
+ F966BA1908F27A37005CB29B /* canvas.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = canvas.n; sourceTree = "<group>"; };
+ F966BA1A08F27A37005CB29B /* CanvPsY.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CanvPsY.3; sourceTree = "<group>"; };
+ F966BA1B08F27A37005CB29B /* CanvTkwin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CanvTkwin.3; sourceTree = "<group>"; };
+ F966BA1C08F27A37005CB29B /* CanvTxtInfo.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CanvTxtInfo.3; sourceTree = "<group>"; };
+ F966BA1D08F27A37005CB29B /* checkbutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = checkbutton.n; sourceTree = "<group>"; };
+ F966BA1E08F27A37005CB29B /* chooseColor.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = chooseColor.n; sourceTree = "<group>"; };
+ F966BA1F08F27A37005CB29B /* chooseDirectory.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = chooseDirectory.n; sourceTree = "<group>"; };
+ F966BA2008F27A37005CB29B /* Clipboard.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Clipboard.3; sourceTree = "<group>"; };
+ F966BA2108F27A37005CB29B /* clipboard.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = clipboard.n; sourceTree = "<group>"; };
+ F966BA2208F27A37005CB29B /* ClrSelect.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ClrSelect.3; sourceTree = "<group>"; };
+ F966BA2308F27A37005CB29B /* colors.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = colors.n; sourceTree = "<group>"; };
+ F966BA2408F27A37005CB29B /* ConfigWidg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ConfigWidg.3; sourceTree = "<group>"; };
+ F966BA2508F27A37005CB29B /* ConfigWind.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ConfigWind.3; sourceTree = "<group>"; };
+ F966BA2608F27A37005CB29B /* console.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = console.n; sourceTree = "<group>"; };
+ F966BA2708F27A37005CB29B /* CoordToWin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CoordToWin.3; sourceTree = "<group>"; };
+ F966BA2808F27A37005CB29B /* CrtCmHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtCmHdlr.3; sourceTree = "<group>"; };
+ F966BA2908F27A37005CB29B /* CrtErrHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtErrHdlr.3; sourceTree = "<group>"; };
+ F966BA2A08F27A37005CB29B /* CrtGenHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtGenHdlr.3; sourceTree = "<group>"; };
+ F966BA2B08F27A37005CB29B /* CrtImgType.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtImgType.3; sourceTree = "<group>"; };
+ F966BA2C08F27A37005CB29B /* CrtItemType.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtItemType.3; sourceTree = "<group>"; };
+ F966BA2D08F27A37005CB29B /* CrtPhImgFmt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtPhImgFmt.3; sourceTree = "<group>"; };
+ F966BA2E08F27A37005CB29B /* CrtSelHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSelHdlr.3; sourceTree = "<group>"; };
+ F966BA2F08F27A37005CB29B /* CrtWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtWindow.3; sourceTree = "<group>"; };
+ F966BA3008F27A37005CB29B /* cursors.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = cursors.n; sourceTree = "<group>"; };
+ F966BA3108F27A37005CB29B /* DeleteImg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DeleteImg.3; sourceTree = "<group>"; };
+ F966BA3208F27A37005CB29B /* destroy.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = destroy.n; sourceTree = "<group>"; };
+ F966BA3308F27A37005CB29B /* dialog.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dialog.n; sourceTree = "<group>"; };
+ F966BA3408F27A37005CB29B /* DrawFocHlt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DrawFocHlt.3; sourceTree = "<group>"; };
+ F966BA3508F27A37005CB29B /* entry.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = entry.n; sourceTree = "<group>"; };
+ F966BA3608F27A37005CB29B /* event.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = event.n; sourceTree = "<group>"; };
+ F966BA3708F27A37005CB29B /* EventHndlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = EventHndlr.3; sourceTree = "<group>"; };
+ F966BA3808F27A37005CB29B /* FindPhoto.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FindPhoto.3; sourceTree = "<group>"; };
+ F966BA3908F27A37005CB29B /* focus.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = focus.n; sourceTree = "<group>"; };
+ F966BA3A08F27A37005CB29B /* focusNext.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = focusNext.n; sourceTree = "<group>"; };
+ F966BA3B08F27A37005CB29B /* font.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = font.n; sourceTree = "<group>"; };
+ F966BA3C08F27A37005CB29B /* FontId.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FontId.3; sourceTree = "<group>"; };
+ F966BA3D08F27A37005CB29B /* frame.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = frame.n; sourceTree = "<group>"; };
+ F966BA3E08F27A37005CB29B /* FreeXId.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FreeXId.3; sourceTree = "<group>"; };
+ F966BA3F08F27A37005CB29B /* GeomReq.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GeomReq.3; sourceTree = "<group>"; };
+ F966BA4008F27A37005CB29B /* GetAnchor.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetAnchor.3; sourceTree = "<group>"; };
+ F966BA4108F27A37005CB29B /* GetBitmap.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetBitmap.3; sourceTree = "<group>"; };
+ F966BA4208F27A37005CB29B /* GetCapStyl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetCapStyl.3; sourceTree = "<group>"; };
+ F966BA4308F27A37005CB29B /* GetClrmap.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetClrmap.3; sourceTree = "<group>"; };
+ F966BA4408F27A37005CB29B /* GetColor.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetColor.3; sourceTree = "<group>"; };
+ F966BA4508F27A37005CB29B /* GetCursor.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetCursor.3; sourceTree = "<group>"; };
+ F966BA4608F27A37005CB29B /* GetDash.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetDash.3; sourceTree = "<group>"; };
+ F966BA4708F27A37005CB29B /* GetFont.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetFont.3; sourceTree = "<group>"; };
+ F966BA4808F27A37005CB29B /* GetGC.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetGC.3; sourceTree = "<group>"; };
+ F966BA4908F27A37005CB29B /* GetHINSTANCE.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetHINSTANCE.3; sourceTree = "<group>"; };
+ F966BA4A08F27A37005CB29B /* GetHWND.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetHWND.3; sourceTree = "<group>"; };
+ F966BA4B08F27A37005CB29B /* GetImage.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetImage.3; sourceTree = "<group>"; };
+ F966BA4C08F27A37005CB29B /* GetJoinStl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetJoinStl.3; sourceTree = "<group>"; };
+ F966BA4D08F27A37005CB29B /* GetJustify.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetJustify.3; sourceTree = "<group>"; };
+ F966BA4E08F27A37005CB29B /* getOpenFile.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = getOpenFile.n; sourceTree = "<group>"; };
+ F966BA4F08F27A37005CB29B /* GetOption.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetOption.3; sourceTree = "<group>"; };
+ F966BA5008F27A38005CB29B /* GetPixels.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetPixels.3; sourceTree = "<group>"; };
+ F966BA5108F27A38005CB29B /* GetPixmap.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetPixmap.3; sourceTree = "<group>"; };
+ F966BA5208F27A38005CB29B /* GetRelief.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetRelief.3; sourceTree = "<group>"; };
+ F966BA5308F27A38005CB29B /* GetRootCrd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetRootCrd.3; sourceTree = "<group>"; };
+ F966BA5408F27A38005CB29B /* GetScroll.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetScroll.3; sourceTree = "<group>"; };
+ F966BA5508F27A38005CB29B /* GetSelect.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetSelect.3; sourceTree = "<group>"; };
+ F966BA5608F27A38005CB29B /* GetUid.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetUid.3; sourceTree = "<group>"; };
+ F966BA5708F27A38005CB29B /* GetVisual.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetVisual.3; sourceTree = "<group>"; };
+ F966BA5808F27A38005CB29B /* GetVRoot.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetVRoot.3; sourceTree = "<group>"; };
+ F966BA5908F27A38005CB29B /* Grab.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Grab.3; sourceTree = "<group>"; };
+ F966BA5A08F27A38005CB29B /* grab.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = grab.n; sourceTree = "<group>"; };
+ F966BA5B08F27A38005CB29B /* grid.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = grid.n; sourceTree = "<group>"; };
+ F966BA5C08F27A38005CB29B /* HandleEvent.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = HandleEvent.3; sourceTree = "<group>"; };
+ F966BA5D08F27A38005CB29B /* HWNDToWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = HWNDToWindow.3; sourceTree = "<group>"; };
+ F966BA5E08F27A38005CB29B /* IdToWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = IdToWindow.3; sourceTree = "<group>"; };
+ F966BA5F08F27A38005CB29B /* image.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = image.n; sourceTree = "<group>"; };
+ F966BA6008F27A38005CB29B /* ImgChanged.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ImgChanged.3; sourceTree = "<group>"; };
+ F966BA6108F27A38005CB29B /* Inactive.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Inactive.3; sourceTree = "<group>"; };
+ F966BA6208F27A38005CB29B /* InternAtom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = InternAtom.3; sourceTree = "<group>"; };
+ F966BA6308F27A38005CB29B /* keysyms.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = keysyms.n; sourceTree = "<group>"; };
+ F966BA6408F27A38005CB29B /* label.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = label.n; sourceTree = "<group>"; };
+ F966BA6508F27A38005CB29B /* labelframe.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = labelframe.n; sourceTree = "<group>"; };
+ F966BA6608F27A38005CB29B /* listbox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = listbox.n; sourceTree = "<group>"; };
+ F966BA6708F27A38005CB29B /* loadTk.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = loadTk.n; sourceTree = "<group>"; };
+ F966BA6808F27A38005CB29B /* lower.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lower.n; sourceTree = "<group>"; };
+ F966BA6908F27A38005CB29B /* MainLoop.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainLoop.3; sourceTree = "<group>"; };
+ F966BA6A08F27A38005CB29B /* MaintGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MaintGeom.3; sourceTree = "<group>"; };
+ F966BA6B08F27A38005CB29B /* MainWin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainWin.3; sourceTree = "<group>"; };
+ F966BA6D08F27A38005CB29B /* ManageGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ManageGeom.3; sourceTree = "<group>"; };
+ F966BA6E08F27A38005CB29B /* MapWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MapWindow.3; sourceTree = "<group>"; };
+ F966BA6F08F27A38005CB29B /* MeasureChar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MeasureChar.3; sourceTree = "<group>"; };
+ F966BA7008F27A38005CB29B /* menu.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menu.n; sourceTree = "<group>"; };
+ F966BA7108F27A38005CB29B /* menubar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menubar.n; sourceTree = "<group>"; };
+ F966BA7208F27A38005CB29B /* menubutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menubutton.n; sourceTree = "<group>"; };
+ F966BA7308F27A38005CB29B /* message.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = message.n; sourceTree = "<group>"; };
+ F966BA7408F27A38005CB29B /* messageBox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = messageBox.n; sourceTree = "<group>"; };
+ F966BA7508F27A38005CB29B /* MoveToplev.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MoveToplev.3; sourceTree = "<group>"; };
+ F966BA7608F27A38005CB29B /* Name.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Name.3; sourceTree = "<group>"; };
+ F966BA7708F27A38005CB29B /* NameOfImg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = NameOfImg.3; sourceTree = "<group>"; };
+ F966BA7808F27A38005CB29B /* option.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = option.n; sourceTree = "<group>"; };
+ F966BA7908F27A38005CB29B /* optionMenu.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = optionMenu.n; sourceTree = "<group>"; };
+ F966BA7A08F27A38005CB29B /* options.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = options.n; sourceTree = "<group>"; };
+ F966BA7B08F27A38005CB29B /* OwnSelect.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = OwnSelect.3; sourceTree = "<group>"; };
+ F966BA7C08F27A38005CB29B /* pack-old.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = "pack-old.n"; sourceTree = "<group>"; };
+ F966BA7D08F27A38005CB29B /* pack.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pack.n; sourceTree = "<group>"; };
+ F966BA7E08F27A38005CB29B /* palette.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = palette.n; sourceTree = "<group>"; };
+ F966BA7F08F27A38005CB29B /* panedwindow.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = panedwindow.n; sourceTree = "<group>"; };
+ F966BA8008F27A38005CB29B /* ParseArgv.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ParseArgv.3; sourceTree = "<group>"; };
+ F966BA8108F27A38005CB29B /* photo.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = photo.n; sourceTree = "<group>"; };
+ F966BA8208F27A38005CB29B /* place.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = place.n; sourceTree = "<group>"; };
+ F966BA8308F27A38005CB29B /* popup.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = popup.n; sourceTree = "<group>"; };
+ F966BA8408F27A38005CB29B /* QWinEvent.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = QWinEvent.3; sourceTree = "<group>"; };
+ F966BA8508F27A38005CB29B /* radiobutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = radiobutton.n; sourceTree = "<group>"; };
+ F966BA8608F27A38005CB29B /* raise.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = raise.n; sourceTree = "<group>"; };
+ F966BA8708F27A38005CB29B /* Restack.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Restack.3; sourceTree = "<group>"; };
+ F966BA8808F27A38005CB29B /* RestrictEv.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RestrictEv.3; sourceTree = "<group>"; };
+ F966BA8908F27A38005CB29B /* scale.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = scale.n; sourceTree = "<group>"; };
+ F966BA8A08F27A38005CB29B /* scrollbar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = scrollbar.n; sourceTree = "<group>"; };
+ F966BA8B08F27A38005CB29B /* selection.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = selection.n; sourceTree = "<group>"; };
+ F966BA8C08F27A38005CB29B /* send.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = send.n; sourceTree = "<group>"; };
+ F966BA8D08F27A38005CB29B /* SetAppName.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetAppName.3; sourceTree = "<group>"; };
+ F966BA8E08F27A38005CB29B /* SetCaret.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetCaret.3; sourceTree = "<group>"; };
+ F966BA8F08F27A38005CB29B /* SetClass.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetClass.3; sourceTree = "<group>"; };
+ F966BA9008F27A38005CB29B /* SetClassProcs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetClassProcs.3; sourceTree = "<group>"; };
+ F966BA9108F27A38005CB29B /* SetGrid.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetGrid.3; sourceTree = "<group>"; };
+ F966BA9208F27A38005CB29B /* SetOptions.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetOptions.3; sourceTree = "<group>"; };
+ F966BA9308F27A38005CB29B /* SetVisual.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetVisual.3; sourceTree = "<group>"; };
+ F966BA9408F27A38005CB29B /* spinbox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = spinbox.n; sourceTree = "<group>"; };
+ F966BA9508F27A38005CB29B /* StrictMotif.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StrictMotif.3; sourceTree = "<group>"; };
+ F966BA9608F27A38005CB29B /* text.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = text.n; sourceTree = "<group>"; };
+ F966BA9708F27A38005CB29B /* TextLayout.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TextLayout.3; sourceTree = "<group>"; };
+ F966BA9808F27A38005CB29B /* tk.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tk.n; sourceTree = "<group>"; };
+ F966BA9908F27A38005CB29B /* tk4.0.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = tk4.0.ps; sourceTree = "<group>"; };
+ F966BA9A08F27A38005CB29B /* Tk_Init.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tk_Init.3; sourceTree = "<group>"; };
+ F966BA9B08F27A38005CB29B /* Tk_Main.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tk_Main.3; sourceTree = "<group>"; };
+ F966BA9C08F27A38005CB29B /* tkerror.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tkerror.n; sourceTree = "<group>"; };
+ F966BA9D08F27A38005CB29B /* TkInitStubs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TkInitStubs.3; sourceTree = "<group>"; };
+ F966BA9E08F27A38005CB29B /* tkvars.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tkvars.n; sourceTree = "<group>"; };
+ F966BA9F08F27A38005CB29B /* tkwait.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tkwait.n; sourceTree = "<group>"; };
+ F966BAA008F27A38005CB29B /* toplevel.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = toplevel.n; sourceTree = "<group>"; };
+ F966BAA108F27A38005CB29B /* WindowId.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = WindowId.3; sourceTree = "<group>"; };
+ F966BAA208F27A38005CB29B /* winfo.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = winfo.n; sourceTree = "<group>"; };
+ F966BAA308F27A38005CB29B /* wish.1 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = wish.1; sourceTree = "<group>"; };
+ F966BAA408F27A38005CB29B /* wm.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = wm.n; sourceTree = "<group>"; };
+ F966BAA608F27A38005CB29B /* default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default.h; sourceTree = "<group>"; };
+ F966BAA708F27A38005CB29B /* ks_names.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ks_names.h; sourceTree = "<group>"; };
+ F966BAA808F27A38005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
+ F966BAA908F27A39005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BAAA08F27A39005CB29B /* tk.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.decls; sourceTree = "<group>"; };
+ F966BAAB08F27A39005CB29B /* tk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tk.h; sourceTree = "<group>"; };
+ F966BAAC08F27A39005CB29B /* tk3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tk3d.c; sourceTree = "<group>"; };
+ F966BAAD08F27A39005CB29B /* tk3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tk3d.h; sourceTree = "<group>"; };
+ F966BAAE08F27A39005CB29B /* tkArgv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkArgv.c; sourceTree = "<group>"; };
+ F966BAAF08F27A39005CB29B /* tkAtom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkAtom.c; sourceTree = "<group>"; };
+ F966BAB008F27A39005CB29B /* tkBind.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBind.c; sourceTree = "<group>"; };
+ F966BAB108F27A39005CB29B /* tkBitmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBitmap.c; sourceTree = "<group>"; };
+ F966BAB208F27A39005CB29B /* tkButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkButton.c; sourceTree = "<group>"; };
+ F966BAB308F27A39005CB29B /* tkButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkButton.h; sourceTree = "<group>"; };
+ F966BAB408F27A39005CB29B /* tkCanvArc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvArc.c; sourceTree = "<group>"; };
+ F966BAB508F27A39005CB29B /* tkCanvas.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvas.c; sourceTree = "<group>"; };
+ F966BAB608F27A39005CB29B /* tkCanvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkCanvas.h; sourceTree = "<group>"; };
+ F966BAB708F27A39005CB29B /* tkCanvBmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvBmap.c; sourceTree = "<group>"; };
+ F966BAB808F27A39005CB29B /* tkCanvImg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvImg.c; sourceTree = "<group>"; };
+ F966BAB908F27A39005CB29B /* tkCanvLine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvLine.c; sourceTree = "<group>"; };
+ F966BABA08F27A39005CB29B /* tkCanvPoly.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvPoly.c; sourceTree = "<group>"; };
+ F966BABB08F27A39005CB29B /* tkCanvPs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvPs.c; sourceTree = "<group>"; };
+ F966BABD08F27A39005CB29B /* tkCanvText.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvText.c; sourceTree = "<group>"; };
+ F966BABE08F27A39005CB29B /* tkCanvUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvUtil.c; sourceTree = "<group>"; };
+ F966BABF08F27A39005CB29B /* tkCanvWind.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCanvWind.c; sourceTree = "<group>"; };
+ F966BAC008F27A39005CB29B /* tkClipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkClipboard.c; sourceTree = "<group>"; };
+ F966BAC108F27A39005CB29B /* tkCmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCmds.c; sourceTree = "<group>"; };
+ F966BAC208F27A39005CB29B /* tkColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkColor.c; sourceTree = "<group>"; };
+ F966BAC308F27A39005CB29B /* tkColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkColor.h; sourceTree = "<group>"; };
+ F966BAC408F27A39005CB29B /* tkConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkConfig.c; sourceTree = "<group>"; };
+ F966BAC508F27A39005CB29B /* tkConsole.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkConsole.c; sourceTree = "<group>"; };
+ F966BAC608F27A39005CB29B /* tkCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkCursor.c; sourceTree = "<group>"; };
+ F966BAC708F27A39005CB29B /* tkDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkDecls.h; sourceTree = "<group>"; };
+ F966BAC808F27A39005CB29B /* tkEntry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkEntry.c; sourceTree = "<group>"; };
+ F966BAC908F27A39005CB29B /* tkEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkEntry.h; sourceTree = "<group>"; };
+ F966BACA08F27A39005CB29B /* tkError.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkError.c; sourceTree = "<group>"; };
+ F966BACB08F27A39005CB29B /* tkEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkEvent.c; sourceTree = "<group>"; };
+ F966BACC08F27A39005CB29B /* tkFileFilter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFileFilter.c; sourceTree = "<group>"; };
+ F966BACD08F27A39005CB29B /* tkFileFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkFileFilter.h; sourceTree = "<group>"; };
+ F966BACE08F27A39005CB29B /* tkFocus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFocus.c; sourceTree = "<group>"; };
+ F966BACF08F27A39005CB29B /* tkFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFont.c; sourceTree = "<group>"; };
+ F966BAD008F27A39005CB29B /* tkFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkFont.h; sourceTree = "<group>"; };
+ F966BAD108F27A39005CB29B /* tkFrame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkFrame.c; sourceTree = "<group>"; };
+ F966BAD208F27A39005CB29B /* tkGC.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGC.c; sourceTree = "<group>"; };
+ F966BAD308F27A39005CB29B /* tkGeometry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGeometry.c; sourceTree = "<group>"; };
+ F966BAD408F27A39005CB29B /* tkGet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGet.c; sourceTree = "<group>"; };
+ F966BAD508F27A39005CB29B /* tkGrab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGrab.c; sourceTree = "<group>"; };
+ F966BAD608F27A39005CB29B /* tkGrid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkGrid.c; sourceTree = "<group>"; };
+ F966BAD708F27A39005CB29B /* tkImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImage.c; sourceTree = "<group>"; };
+ F966BAD808F27A39005CB29B /* tkImgBmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgBmap.c; sourceTree = "<group>"; };
+ F966BAD908F27A39005CB29B /* tkImgGIF.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgGIF.c; sourceTree = "<group>"; };
+ F966BADA08F27A39005CB29B /* tkImgPhoto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPhoto.c; sourceTree = "<group>"; };
+ F966BADB08F27A39005CB29B /* tkImgPPM.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPPM.c; sourceTree = "<group>"; };
+ F966BADC08F27A39005CB29B /* tkImgUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgUtil.c; sourceTree = "<group>"; };
+ F966BADE08F27A39005CB29B /* tkInt.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tkInt.decls; sourceTree = "<group>"; };
+ F966BADF08F27A39005CB29B /* tkInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkInt.h; sourceTree = "<group>"; };
+ F966BAE108F27A39005CB29B /* tkIntDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkIntDecls.h; sourceTree = "<group>"; };
+ F966BAE208F27A39005CB29B /* tkIntPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkIntPlatDecls.h; sourceTree = "<group>"; };
+ F966BAE308F27A39005CB29B /* tkIntXlibDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkIntXlibDecls.h; sourceTree = "<group>"; };
+ F966BAE408F27A39005CB29B /* tkListbox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkListbox.c; sourceTree = "<group>"; };
+ F966BAE508F27A39005CB29B /* tkMacWinMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacWinMenu.c; sourceTree = "<group>"; };
+ F966BAE608F27A39005CB29B /* tkMain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMain.c; sourceTree = "<group>"; };
+ F966BAE708F27A39005CB29B /* tkMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMenu.c; sourceTree = "<group>"; };
+ F966BAE808F27A39005CB29B /* tkMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMenu.h; sourceTree = "<group>"; };
+ F966BAE908F27A39005CB29B /* tkMenubutton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMenubutton.c; sourceTree = "<group>"; };
+ F966BAEA08F27A39005CB29B /* tkMenubutton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMenubutton.h; sourceTree = "<group>"; };
+ F966BAEB08F27A39005CB29B /* tkMenuDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMenuDraw.c; sourceTree = "<group>"; };
+ F966BAEC08F27A39005CB29B /* tkMessage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMessage.c; sourceTree = "<group>"; };
+ F966BAED08F27A39005CB29B /* tkObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkObj.c; sourceTree = "<group>"; };
+ F966BAEE08F27A39005CB29B /* tkOldConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkOldConfig.c; sourceTree = "<group>"; };
+ F966BAEF08F27A39005CB29B /* tkOption.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkOption.c; sourceTree = "<group>"; };
+ F966BAF008F27A39005CB29B /* tkPack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPack.c; sourceTree = "<group>"; };
+ F966BAF108F27A39005CB29B /* tkPanedWindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPanedWindow.c; sourceTree = "<group>"; };
+ F966BAF208F27A39005CB29B /* tkPlace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPlace.c; sourceTree = "<group>"; };
+ F966BAF308F27A39005CB29B /* tkPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkPlatDecls.h; sourceTree = "<group>"; };
+ F966BAF408F27A39005CB29B /* tkPointer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkPointer.c; sourceTree = "<group>"; };
+ F966BAF508F27A39005CB29B /* tkPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkPort.h; sourceTree = "<group>"; };
+ F966BAF608F27A39005CB29B /* tkRectOval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkRectOval.c; sourceTree = "<group>"; };
+ F966BAF708F27A39005CB29B /* tkScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScale.c; sourceTree = "<group>"; };
+ F966BAF808F27A39005CB29B /* tkScale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScale.h; sourceTree = "<group>"; };
+ F966BAF908F27A39005CB29B /* tkScrollbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScrollbar.c; sourceTree = "<group>"; };
+ F966BAFA08F27A39005CB29B /* tkScrollbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScrollbar.h; sourceTree = "<group>"; };
+ F966BAFB08F27A39005CB29B /* tkSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSelect.c; sourceTree = "<group>"; };
+ F966BAFC08F27A39005CB29B /* tkSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkSelect.h; sourceTree = "<group>"; };
+ F966BAFD08F27A39005CB29B /* tkSquare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSquare.c; sourceTree = "<group>"; };
+ F966BAFE08F27A39005CB29B /* tkOldTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkOldTest.c; sourceTree = "<group>"; };
+ F966BAFF08F27A39005CB29B /* tkStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStubInit.c; sourceTree = "<group>"; };
+ F966BB0008F27A39005CB29B /* tkStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStubLib.c; sourceTree = "<group>"; };
+ F966BB0108F27A39005CB29B /* tkStyle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStyle.c; sourceTree = "<group>"; };
+ F966BB0208F27A39005CB29B /* tkTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTest.c; sourceTree = "<group>"; };
+ F966BB0308F27A39005CB29B /* tkText.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkText.c; sourceTree = "<group>"; };
+ F966BB0408F27A39005CB29B /* tkText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkText.h; sourceTree = "<group>"; };
+ F966BB0508F27A39005CB29B /* tkTextBTree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextBTree.c; sourceTree = "<group>"; };
+ F966BB0608F27A39005CB29B /* tkTextDisp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextDisp.c; sourceTree = "<group>"; };
+ F966BB0808F27A39005CB29B /* tkTextImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextImage.c; sourceTree = "<group>"; };
+ F966BB0908F27A39005CB29B /* tkTextIndex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextIndex.c; sourceTree = "<group>"; };
+ F966BB0A08F27A39005CB29B /* tkTextMark.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextMark.c; sourceTree = "<group>"; };
+ F966BB0B08F27A39005CB29B /* tkTextTag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextTag.c; sourceTree = "<group>"; };
+ F966BB0C08F27A39005CB29B /* tkTextWind.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextWind.c; sourceTree = "<group>"; };
+ F966BB0D08F27A39005CB29B /* tkTrig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTrig.c; sourceTree = "<group>"; };
+ F966BB0E08F27A39005CB29B /* tkUndo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUndo.c; sourceTree = "<group>"; };
+ F966BB0F08F27A39005CB29B /* tkUndo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUndo.h; sourceTree = "<group>"; };
+ F966BB1008F27A39005CB29B /* tkUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUtil.c; sourceTree = "<group>"; };
+ F966BB1108F27A39005CB29B /* tkVisual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkVisual.c; sourceTree = "<group>"; };
+ F966BB1208F27A39005CB29B /* tkWindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWindow.c; sourceTree = "<group>"; };
+ F966BB1408F27A39005CB29B /* bgerror.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bgerror.tcl; sourceTree = "<group>"; };
+ F966BB1508F27A39005CB29B /* button.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.tcl; sourceTree = "<group>"; };
+ F966BB1608F27A39005CB29B /* choosedir.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = choosedir.tcl; sourceTree = "<group>"; };
+ F966BB1708F27A39005CB29B /* clrpick.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clrpick.tcl; sourceTree = "<group>"; };
+ F966BB1808F27A39005CB29B /* comdlg.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = comdlg.tcl; sourceTree = "<group>"; };
+ F966BB1908F27A39005CB29B /* console.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = console.tcl; sourceTree = "<group>"; };
+ F966BB1B08F27A39005CB29B /* anilabel.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = anilabel.tcl; sourceTree = "<group>"; };
+ F966BB1C08F27A39005CB29B /* aniwave.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = aniwave.tcl; sourceTree = "<group>"; };
+ F966BB1D08F27A39005CB29B /* arrow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = arrow.tcl; sourceTree = "<group>"; };
+ F966BB1E08F27A39005CB29B /* bind.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bind.tcl; sourceTree = "<group>"; };
+ F966BB1F08F27A39005CB29B /* bitmap.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bitmap.tcl; sourceTree = "<group>"; };
+ F966BB2008F27A39005CB29B /* browse */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = browse; sourceTree = "<group>"; };
+ F966BB2108F27A39005CB29B /* button.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.tcl; sourceTree = "<group>"; };
+ F966BB2208F27A39005CB29B /* check.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = check.tcl; sourceTree = "<group>"; };
+ F966BB2308F27A39005CB29B /* clrpick.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clrpick.tcl; sourceTree = "<group>"; };
+ F966BB2408F27A39005CB29B /* colors.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = colors.tcl; sourceTree = "<group>"; };
+ F966BB2508F27A39005CB29B /* cscroll.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cscroll.tcl; sourceTree = "<group>"; };
+ F966BB2608F27A39005CB29B /* ctext.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ctext.tcl; sourceTree = "<group>"; };
+ F966BB2708F27A39005CB29B /* dialog1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog1.tcl; sourceTree = "<group>"; };
+ F966BB2808F27A39005CB29B /* dialog2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog2.tcl; sourceTree = "<group>"; };
+ F966BB2A08F27A39005CB29B /* entry1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry1.tcl; sourceTree = "<group>"; };
+ F966BB2B08F27A39005CB29B /* entry2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry2.tcl; sourceTree = "<group>"; };
+ F966BB2C08F27A39005CB29B /* entry3.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry3.tcl; sourceTree = "<group>"; };
+ F966BB2D08F27A39005CB29B /* filebox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = filebox.tcl; sourceTree = "<group>"; };
+ F966BB2E08F27A39005CB29B /* floor.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = floor.tcl; sourceTree = "<group>"; };
+ F966BB2F08F27A39005CB29B /* form.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = form.tcl; sourceTree = "<group>"; };
+ F966BB3008F27A39005CB29B /* goldberg.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = goldberg.tcl; sourceTree = "<group>"; };
+ F966BB3108F27A39005CB29B /* hello */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = hello; sourceTree = "<group>"; };
+ F966BB3208F27A39005CB29B /* hscale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = hscale.tcl; sourceTree = "<group>"; };
+ F966BB3308F27A39005CB29B /* icon.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = icon.tcl; sourceTree = "<group>"; };
+ F966BB3408F27A39005CB29B /* image1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image1.tcl; sourceTree = "<group>"; };
+ F966BB3508F27A39005CB29B /* image2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image2.tcl; sourceTree = "<group>"; };
+ F966BB4208F27A3A005CB29B /* items.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = items.tcl; sourceTree = "<group>"; };
+ F966BB4308F27A3A005CB29B /* ixset */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ixset; sourceTree = "<group>"; };
+ F966BB4408F27A3A005CB29B /* label.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = label.tcl; sourceTree = "<group>"; };
+ F966BB4508F27A3A005CB29B /* labelframe.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = labelframe.tcl; sourceTree = "<group>"; };
+ F966BB4608F27A3A005CB29B /* menu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.tcl; sourceTree = "<group>"; };
+ F966BB4708F27A3A005CB29B /* menubu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubu.tcl; sourceTree = "<group>"; };
+ F966BB4808F27A3A005CB29B /* msgbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.tcl; sourceTree = "<group>"; };
+ F966BB4A08F27A3A005CB29B /* paned1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = paned1.tcl; sourceTree = "<group>"; };
+ F966BB4B08F27A3A005CB29B /* paned2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = paned2.tcl; sourceTree = "<group>"; };
+ F966BB4C08F27A3A005CB29B /* pendulum.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pendulum.tcl; sourceTree = "<group>"; };
+ F966BB4D08F27A3A005CB29B /* plot.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = plot.tcl; sourceTree = "<group>"; };
+ F966BB4E08F27A3A005CB29B /* puzzle.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = puzzle.tcl; sourceTree = "<group>"; };
+ F966BB4F08F27A3A005CB29B /* radio.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = radio.tcl; sourceTree = "<group>"; };
+ F966BB5008F27A3A005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BB5108F27A3A005CB29B /* rmt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = rmt; sourceTree = "<group>"; };
+ F966BB5208F27A3A005CB29B /* rolodex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = rolodex; sourceTree = "<group>"; };
+ F966BB5308F27A3A005CB29B /* ruler.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ruler.tcl; sourceTree = "<group>"; };
+ F966BB5408F27A3A005CB29B /* sayings.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = sayings.tcl; sourceTree = "<group>"; };
+ F966BB5508F27A3A005CB29B /* search.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = search.tcl; sourceTree = "<group>"; };
+ F966BB5608F27A3A005CB29B /* spin.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = spin.tcl; sourceTree = "<group>"; };
+ F966BB5708F27A3A005CB29B /* square */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = square; sourceTree = "<group>"; };
+ F966BB5808F27A3A005CB29B /* states.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = states.tcl; sourceTree = "<group>"; };
+ F966BB5908F27A3A005CB29B /* style.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = style.tcl; sourceTree = "<group>"; };
+ F966BB5A08F27A3A005CB29B /* tclIndex */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclIndex; sourceTree = "<group>"; };
+ F966BB5B08F27A3A005CB29B /* tcolor */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = tcolor; sourceTree = "<group>"; };
+ F966BB5C08F27A3A005CB29B /* text.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = text.tcl; sourceTree = "<group>"; };
+ F966BB5D08F27A3A005CB29B /* timer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = timer; sourceTree = "<group>"; };
+ F966BB5E08F27A3A005CB29B /* twind.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = twind.tcl; sourceTree = "<group>"; };
+ F966BB5F08F27A3A005CB29B /* unicodeout.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unicodeout.tcl; sourceTree = "<group>"; };
+ F966BB6008F27A3A005CB29B /* vscale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vscale.tcl; sourceTree = "<group>"; };
+ F966BB6108F27A3A005CB29B /* widget */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = widget; sourceTree = "<group>"; };
+ F966BB6208F27A3A005CB29B /* dialog.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog.tcl; sourceTree = "<group>"; };
+ F966BB6308F27A3A005CB29B /* entry.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.tcl; sourceTree = "<group>"; };
+ F966BB6408F27A3A005CB29B /* focus.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focus.tcl; sourceTree = "<group>"; };
+ F966BB7308F27A3A005CB29B /* listbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listbox.tcl; sourceTree = "<group>"; };
+ F966BB7408F27A3A005CB29B /* menu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.tcl; sourceTree = "<group>"; };
+ F966BB7508F27A3A005CB29B /* mkpsenc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mkpsenc.tcl; sourceTree = "<group>"; };
+ F966BB7608F27A3A005CB29B /* msgbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.tcl; sourceTree = "<group>"; };
+ F966BB8608F27A3A005CB29B /* obsolete.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obsolete.tcl; sourceTree = "<group>"; };
+ F966BB8708F27A3A005CB29B /* optMenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optMenu.tcl; sourceTree = "<group>"; };
+ F966BB8808F27A3A005CB29B /* palette.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = palette.tcl; sourceTree = "<group>"; };
+ F966BB8908F27A3B005CB29B /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
+ F966BB8A08F27A3B005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
+ F966BB8B08F27A3B005CB29B /* safetk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safetk.tcl; sourceTree = "<group>"; };
+ F966BB8C08F27A3B005CB29B /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
+ F966BB8D08F27A3B005CB29B /* scrlbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrlbar.tcl; sourceTree = "<group>"; };
+ F966BB8E08F27A3B005CB29B /* spinbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = spinbox.tcl; sourceTree = "<group>"; };
+ F966BB8F08F27A3B005CB29B /* tclIndex */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclIndex; sourceTree = "<group>"; };
+ F966BB9008F27A3B005CB29B /* tearoff.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tearoff.tcl; sourceTree = "<group>"; };
+ F966BB9108F27A3B005CB29B /* text.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = text.tcl; sourceTree = "<group>"; };
+ F966BB9208F27A3B005CB29B /* tk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.tcl; sourceTree = "<group>"; };
+ F966BB9308F27A3B005CB29B /* tkfbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tkfbox.tcl; sourceTree = "<group>"; };
+ F966BB9408F27A3B005CB29B /* unsupported.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unsupported.tcl; sourceTree = "<group>"; };
+ F966BB9508F27A3B005CB29B /* xmfbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.tcl; sourceTree = "<group>"; };
+ F966BB9608F27A3B005CB29B /* license.terms */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = license.terms; sourceTree = "<group>"; };
+ F966BBBA08F27A3B005CB29B /* configure.ac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure.ac; sourceTree = "<group>"; };
+ F966BBBB08F27A3B005CB29B /* GNUmakefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = GNUmakefile; sourceTree = "<group>"; };
+ F966BBBE08F27A3B005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BBC008F27A3B005CB29B /* Tk-Info.plist.in */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = "Tk-Info.plist.in"; sourceTree = "<group>"; };
+ F966BBC108F27A3B005CB29B /* tkAboutDlg.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = tkAboutDlg.r; sourceTree = "<group>"; };
+ F966BBC208F27A3B005CB29B /* tkMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSX.h; sourceTree = "<group>"; };
+ F966BBC408F27A3B005CB29B /* tkMacOSXAETE.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = tkMacOSXAETE.r; sourceTree = "<group>"; };
+ F966BBC508F27A3B005CB29B /* tkMacOSXBitmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXBitmap.c; sourceTree = "<group>"; };
+ F966BBC608F27A3B005CB29B /* tkMacOSXButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXButton.c; sourceTree = "<group>"; };
+ F966BBC708F27A3B005CB29B /* tkMacOSXCarbonEvents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXCarbonEvents.c; sourceTree = "<group>"; };
+ F966BBC808F27A3B005CB29B /* tkMacOSXClipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXClipboard.c; sourceTree = "<group>"; };
+ F966BBC908F27A3B005CB29B /* tkMacOSXColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXColor.c; sourceTree = "<group>"; };
+ F966BBCA08F27A3B005CB29B /* tkMacOSXConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXConfig.c; sourceTree = "<group>"; };
+ F966BBCB08F27A3B005CB29B /* tkMacOSXCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXCursor.c; sourceTree = "<group>"; };
+ F966BBCC08F27A3B005CB29B /* tkMacOSXCursors.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = tkMacOSXCursors.r; sourceTree = "<group>"; };
+ F966BBCD08F27A3B005CB29B /* tkMacOSXDebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXDebug.c; sourceTree = "<group>"; };
+ F966BBCE08F27A3B005CB29B /* tkMacOSXDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXDebug.h; sourceTree = "<group>"; };
+ F966BBCF08F27A3B005CB29B /* tkMacOSXDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXDefault.h; sourceTree = "<group>"; };
+ F966BBD008F27A3B005CB29B /* tkMacOSXDialog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXDialog.c; sourceTree = "<group>"; };
+ F966BBD108F27A3B005CB29B /* tkMacOSXDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXDraw.c; sourceTree = "<group>"; };
+ F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXEmbed.c; sourceTree = "<group>"; };
+ F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXEntry.c; sourceTree = "<group>"; };
+ F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXEvent.c; sourceTree = "<group>"; };
+ F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXEvent.h; sourceTree = "<group>"; };
+ F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXFont.c; sourceTree = "<group>"; };
+ F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXHLEvents.c; sourceTree = "<group>"; };
+ F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXInit.c; sourceTree = "<group>"; };
+ F966BBDA08F27A3B005CB29B /* tkMacOSXInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXInt.h; sourceTree = "<group>"; };
+ F966BBDB08F27A3B005CB29B /* tkMacOSXKeyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXKeyboard.c; sourceTree = "<group>"; };
+ F966BBDC08F27A3B005CB29B /* tkMacOSXKeyEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXKeyEvent.c; sourceTree = "<group>"; };
+ F966BBDD08F27A3B005CB29B /* tkMacOSXMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMenu.c; sourceTree = "<group>"; };
+ F966BBE008F27A3B005CB29B /* tkMacOSXMenubutton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMenubutton.c; sourceTree = "<group>"; };
+ F966BBE108F27A3B005CB29B /* tkMacOSXMenus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMenus.c; sourceTree = "<group>"; };
+ F966BBE208F27A3B005CB29B /* tkMacOSXMouseEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXMouseEvent.c; sourceTree = "<group>"; };
+ F966BBE308F27A3B005CB29B /* tkMacOSXNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXNotify.c; sourceTree = "<group>"; };
+ F966BBEA08F27A3C005CB29B /* tkMacOSXPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPort.h; sourceTree = "<group>"; };
+ F966BBEB08F27A3C005CB29B /* tkMacOSXRegion.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXRegion.c; sourceTree = "<group>"; };
+ F966BBEC08F27A3C005CB29B /* tkMacOSXScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXScale.c; sourceTree = "<group>"; };
+ F966BBED08F27A3C005CB29B /* tkMacOSXScrlbr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXScrlbr.c; sourceTree = "<group>"; };
+ F966BBEE08F27A3C005CB29B /* tkMacOSXSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXSend.c; sourceTree = "<group>"; };
+ F966BBEF08F27A3C005CB29B /* tkMacOSXSubwindows.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXSubwindows.c; sourceTree = "<group>"; };
+ F966BBF008F27A3C005CB29B /* tkMacOSXTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXTest.c; sourceTree = "<group>"; };
+ F966BBF108F27A3C005CB29B /* tkMacOSXWindowEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXWindowEvent.c; sourceTree = "<group>"; };
+ F966BBF208F27A3C005CB29B /* tkMacOSXWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXWm.c; sourceTree = "<group>"; };
+ F966BBF308F27A3C005CB29B /* tkMacOSXWm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXWm.h; sourceTree = "<group>"; };
+ F966BBF408F27A3C005CB29B /* tkMacOSXXCursors.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = tkMacOSXXCursors.r; sourceTree = "<group>"; };
+ F966BBF508F27A3C005CB29B /* tkMacOSXXStubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkMacOSXXStubs.c; sourceTree = "<group>"; };
+ F966BBF708F27A3C005CB29B /* Wish-Info.plist.in */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = "Wish-Info.plist.in"; sourceTree = "<group>"; };
+ F966BBF808F27A3C005CB29B /* Wish.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Wish.icns; sourceTree = "<group>"; };
+ F966BC0308F27A3C005CB29B /* README */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = README; sourceTree = "<group>"; };
+ F966BC0508F27A3C005CB29B /* all.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = all.tcl; sourceTree = "<group>"; };
+ F966BC0608F27A3C005CB29B /* arc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = arc.tcl; sourceTree = "<group>"; };
+ F966BC0708F27A3C005CB29B /* bell.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bell.test; sourceTree = "<group>"; };
+ F966BC0808F27A3C005CB29B /* bevel.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bevel.tcl; sourceTree = "<group>"; };
+ F966BC0908F27A3C005CB29B /* bgerror.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bgerror.test; sourceTree = "<group>"; };
+ F966BC0A08F27A3C005CB29B /* bind.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bind.test; sourceTree = "<group>"; };
+ F966BC0B08F27A3C005CB29B /* bitmap.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bitmap.test; sourceTree = "<group>"; };
+ F966BC0C08F27A3C005CB29B /* border.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = border.test; sourceTree = "<group>"; };
+ F966BC0D08F27A3C005CB29B /* bugs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = bugs.tcl; sourceTree = "<group>"; };
+ F966BC0E08F27A3C005CB29B /* butGeom.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = butGeom.tcl; sourceTree = "<group>"; };
+ F966BC0F08F27A3C005CB29B /* butGeom2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = butGeom2.tcl; sourceTree = "<group>"; };
+ F966BC1008F27A3C005CB29B /* button.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.test; sourceTree = "<group>"; };
+ F966BC1108F27A3C005CB29B /* canvas.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvas.test; sourceTree = "<group>"; };
+ F966BC1208F27A3C005CB29B /* canvImg.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvImg.test; sourceTree = "<group>"; };
+ F966BC1308F27A3C005CB29B /* canvPs.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPs.test; sourceTree = "<group>"; };
+ F966BC1408F27A3C005CB29B /* canvPsArc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsArc.tcl; sourceTree = "<group>"; };
+ F966BC1508F27A3C005CB29B /* canvPsBmap.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsBmap.tcl; sourceTree = "<group>"; };
+ F966BC1608F27A3C005CB29B /* canvPsGrph.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsGrph.tcl; sourceTree = "<group>"; };
+ F966BC1708F27A3C005CB29B /* canvPsImg.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsImg.tcl; sourceTree = "<group>"; };
+ F966BC1808F27A3C005CB29B /* canvPsText.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvPsText.tcl; sourceTree = "<group>"; };
+ F966BC1908F27A3C005CB29B /* canvRect.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvRect.test; sourceTree = "<group>"; };
+ F966BC1A08F27A3C005CB29B /* canvText.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvText.test; sourceTree = "<group>"; };
+ F966BC1B08F27A3C005CB29B /* canvWind.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = canvWind.test; sourceTree = "<group>"; };
+ F966BC1C08F27A3C005CB29B /* choosedir.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = choosedir.test; sourceTree = "<group>"; };
+ F966BC1D08F27A3C005CB29B /* clipboard.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clipboard.test; sourceTree = "<group>"; };
+ F966BC1E08F27A3C005CB29B /* clrpick.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clrpick.test; sourceTree = "<group>"; };
+ F966BC1F08F27A3C005CB29B /* cmap.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmap.tcl; sourceTree = "<group>"; };
+ F966BC2008F27A3C005CB29B /* cmds.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmds.test; sourceTree = "<group>"; };
+ F966BC2108F27A3C005CB29B /* color.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = color.test; sourceTree = "<group>"; };
+ F966BC2208F27A3C005CB29B /* config.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = config.test; sourceTree = "<group>"; };
+ F966BC2308F27A3C005CB29B /* constraints.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = constraints.tcl; sourceTree = "<group>"; };
+ F966BC2408F27A3C005CB29B /* cursor.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cursor.test; sourceTree = "<group>"; };
+ F966BC2508F27A3C005CB29B /* dialog.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog.test; sourceTree = "<group>"; };
+ F966BC2608F27A3C005CB29B /* embed.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = embed.test; sourceTree = "<group>"; };
+ F966BC2708F27A3C005CB29B /* entry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.test; sourceTree = "<group>"; };
+ F966BC2808F27A3C005CB29B /* event.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = event.test; sourceTree = "<group>"; };
+ F966BC2908F27A3C005CB29B /* filebox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = filebox.test; sourceTree = "<group>"; };
+ F966BC2A08F27A3C005CB29B /* focus.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focus.test; sourceTree = "<group>"; };
+ F966BC2B08F27A3C005CB29B /* focusTcl.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focusTcl.test; sourceTree = "<group>"; };
+ F966BC2C08F27A3C005CB29B /* font.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = font.test; sourceTree = "<group>"; };
+ F966BC2D08F27A3C005CB29B /* frame.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = frame.test; sourceTree = "<group>"; };
+ F966BC2E08F27A3C005CB29B /* geometry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = geometry.test; sourceTree = "<group>"; };
+ F966BC2F08F27A3C005CB29B /* get.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = get.test; sourceTree = "<group>"; };
+ F966BC3008F27A3C005CB29B /* grab.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grab.test; sourceTree = "<group>"; };
+ F966BC3108F27A3C005CB29B /* grid.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grid.test; sourceTree = "<group>"; };
+ F966BC3208F27A3C005CB29B /* id.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = id.test; sourceTree = "<group>"; };
+ F966BC3308F27A3C005CB29B /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
+ F966BC3408F27A3C005CB29B /* imgBmap.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgBmap.test; sourceTree = "<group>"; };
+ F966BC3508F27A3C005CB29B /* imgPhoto.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPhoto.test; sourceTree = "<group>"; };
+ F966BC3608F27A3C005CB29B /* imgPPM.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPPM.test; sourceTree = "<group>"; };
+ F966BC3708F27A3C005CB29B /* listbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listbox.test; sourceTree = "<group>"; };
+ F966BC3808F27A3C005CB29B /* main.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = main.test; sourceTree = "<group>"; };
+ F966BC3908F27A3C005CB29B /* menu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.test; sourceTree = "<group>"; };
+ F966BC3A08F27A3C005CB29B /* menubut.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubut.test; sourceTree = "<group>"; };
+ F966BC3B08F27A3C005CB29B /* menuDraw.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menuDraw.test; sourceTree = "<group>"; };
+ F966BC3C08F27A3C005CB29B /* message.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = message.test; sourceTree = "<group>"; };
+ F966BC3D08F27A3C005CB29B /* msgbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.test; sourceTree = "<group>"; };
+ F966BC3E08F27A3C005CB29B /* obj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obj.test; sourceTree = "<group>"; };
+ F966BC3F08F27A3C005CB29B /* oldpack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = oldpack.test; sourceTree = "<group>"; };
+ F966BC4008F27A3C005CB29B /* option.file1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file1; sourceTree = "<group>"; };
+ F966BC4108F27A3C005CB29B /* option.file2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file2; sourceTree = "<group>"; };
+ F966BC4208F27A3C005CB29B /* option.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = option.test; sourceTree = "<group>"; };
+ F966BC4308F27A3C005CB29B /* pack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pack.test; sourceTree = "<group>"; };
+ F966BC4408F27A3C005CB29B /* panedwindow.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.test; sourceTree = "<group>"; };
+ F966BC4508F27A3D005CB29B /* place.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = place.test; sourceTree = "<group>"; };
+ F966BC4608F27A3D005CB29B /* raise.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = raise.test; sourceTree = "<group>"; };
+ F966BC4708F27A3D005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BC4808F27A3D005CB29B /* safe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safe.test; sourceTree = "<group>"; };
+ F966BC4908F27A3D005CB29B /* scale.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.test; sourceTree = "<group>"; };
+ F966BC4A08F27A3D005CB29B /* scrollbar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrollbar.test; sourceTree = "<group>"; };
+ F966BC4B08F27A3D005CB29B /* select.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = select.test; sourceTree = "<group>"; };
+ F966BC4C08F27A3D005CB29B /* send.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = send.test; sourceTree = "<group>"; };
+ F966BC4D08F27A3D005CB29B /* spinbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = spinbox.test; sourceTree = "<group>"; };
+ F966BC4E08F27A3D005CB29B /* text.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = text.test; sourceTree = "<group>"; };
+ F966BC4F08F27A3D005CB29B /* textBTree.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textBTree.test; sourceTree = "<group>"; };
+ F966BC5008F27A3D005CB29B /* textDisp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textDisp.test; sourceTree = "<group>"; };
+ F966BC5108F27A3D005CB29B /* textImage.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textImage.test; sourceTree = "<group>"; };
+ F966BC5208F27A3D005CB29B /* textIndex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textIndex.test; sourceTree = "<group>"; };
+ F966BC5308F27A3D005CB29B /* textMark.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textMark.test; sourceTree = "<group>"; };
+ F966BC5408F27A3D005CB29B /* textTag.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textTag.test; sourceTree = "<group>"; };
+ F966BC5508F27A3D005CB29B /* textWind.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textWind.test; sourceTree = "<group>"; };
+ F966BC5608F27A3D005CB29B /* tk.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.test; sourceTree = "<group>"; };
+ F966BC5708F27A3D005CB29B /* unixButton.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixButton.test; sourceTree = "<group>"; };
+ F966BC5808F27A3D005CB29B /* unixEmbed.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixEmbed.test; sourceTree = "<group>"; };
+ F966BC5908F27A3D005CB29B /* unixFont.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixFont.test; sourceTree = "<group>"; };
+ F966BC5A08F27A3D005CB29B /* unixMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixMenu.test; sourceTree = "<group>"; };
+ F966BC5B08F27A3D005CB29B /* unixSelect.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixSelect.test; sourceTree = "<group>"; };
+ F966BC5C08F27A3D005CB29B /* unixWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixWm.test; sourceTree = "<group>"; };
+ F966BC5D08F27A3D005CB29B /* util.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = util.test; sourceTree = "<group>"; };
+ F966BC5E08F27A3D005CB29B /* visual.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = visual.test; sourceTree = "<group>"; };
+ F966BC5F08F27A3D005CB29B /* visual_bb.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = visual_bb.test; sourceTree = "<group>"; };
+ F966BC6008F27A3D005CB29B /* winButton.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winButton.test; sourceTree = "<group>"; };
+ F966BC6108F27A3D005CB29B /* winClipboard.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winClipboard.test; sourceTree = "<group>"; };
+ F966BC6208F27A3D005CB29B /* winDialog.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winDialog.test; sourceTree = "<group>"; };
+ F966BC6308F27A3D005CB29B /* window.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = window.test; sourceTree = "<group>"; };
+ F966BC6408F27A3D005CB29B /* winfo.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winfo.test; sourceTree = "<group>"; };
+ F966BC6508F27A3D005CB29B /* winFont.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFont.test; sourceTree = "<group>"; };
+ F966BC6608F27A3D005CB29B /* winMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winMenu.test; sourceTree = "<group>"; };
+ F966BC6708F27A3D005CB29B /* winSend.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winSend.test; sourceTree = "<group>"; };
+ F966BC6808F27A3D005CB29B /* winWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winWm.test; sourceTree = "<group>"; };
+ F966BC6908F27A3D005CB29B /* wm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = wm.test; sourceTree = "<group>"; };
+ F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; };
+ F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F966BC6E08F27A3D005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC6F08F27A3D005CB29B /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; };
+ F966BC7008F27A3D005CB29B /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; };
+ F966BC7108F27A3D005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F966BC7208F27A3D005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BC7308F27A3D005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F966BC7408F27A3D005CB29B /* tk.spec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.spec; sourceTree = "<group>"; };
+ F966BC7508F27A3D005CB29B /* tkAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkAppInit.c; sourceTree = "<group>"; };
+ F966BC7608F27A3D005CB29B /* tkConfig.h.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = tkConfig.h.in; sourceTree = "<group>"; };
+ F966BC7708F27A3D005CB29B /* tkConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tkConfig.sh.in; sourceTree = "<group>"; };
+ F966BC7808F27A3D005CB29B /* tkUnix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix.c; sourceTree = "<group>"; };
+ F966BC7908F27A3D005CB29B /* tkUnix3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix3d.c; sourceTree = "<group>"; };
+ F966BC7A08F27A3D005CB29B /* tkUnixButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixButton.c; sourceTree = "<group>"; };
+ F966BC7B08F27A3D005CB29B /* tkUnixColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixColor.c; sourceTree = "<group>"; };
+ F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixConfig.c; sourceTree = "<group>"; };
+ F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixCursor.c; sourceTree = "<group>"; };
+ F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixDefault.h; sourceTree = "<group>"; };
+ F966BC7F08F27A3D005CB29B /* tkUnixDialog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixDialog.c; sourceTree = "<group>"; };
+ F966BC8008F27A3D005CB29B /* tkUnixDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixDraw.c; sourceTree = "<group>"; };
+ F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixEmbed.c; sourceTree = "<group>"; };
+ F966BC8208F27A3D005CB29B /* tkUnixEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixEvent.c; sourceTree = "<group>"; };
+ F966BC8308F27A3D005CB29B /* tkUnixFocus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixFocus.c; sourceTree = "<group>"; };
+ F966BC8408F27A3D005CB29B /* tkUnixFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixFont.c; sourceTree = "<group>"; };
+ F966BC8508F27A3D005CB29B /* tkUnixInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixInit.c; sourceTree = "<group>"; };
+ F966BC8608F27A3D005CB29B /* tkUnixInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixInt.h; sourceTree = "<group>"; };
+ F966BC8708F27A3D005CB29B /* tkUnixKey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixKey.c; sourceTree = "<group>"; };
+ F966BC8808F27A3D005CB29B /* tkUnixMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixMenu.c; sourceTree = "<group>"; };
+ F966BC8908F27A3D005CB29B /* tkUnixMenubu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixMenubu.c; sourceTree = "<group>"; };
+ F966BC8A08F27A3D005CB29B /* tkUnixPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixPort.h; sourceTree = "<group>"; };
+ F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixRFont.c; sourceTree = "<group>"; };
+ F966BC8C08F27A3D005CB29B /* tkUnixScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixScale.c; sourceTree = "<group>"; };
+ F966BC8D08F27A3D005CB29B /* tkUnixScrlbr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixScrlbr.c; sourceTree = "<group>"; };
+ F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSelect.c; sourceTree = "<group>"; };
+ F966BC8F08F27A3D005CB29B /* tkUnixSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSend.c; sourceTree = "<group>"; };
+ F966BC9008F27A3D005CB29B /* tkUnixWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixWm.c; sourceTree = "<group>"; };
+ F966BC9108F27A3D005CB29B /* tkUnixXId.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixXId.c; sourceTree = "<group>"; };
+ F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
+ F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F966BC9708F27A3E005CB29B /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F966BC9808F27A3E005CB29B /* makefile.bc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.bc; sourceTree = "<group>"; };
+ F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
+ F966BC9B08F27A3E005CB29B /* mkd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mkd.bat; sourceTree = "<group>"; };
+ F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
+ F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; };
+ F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; };
+ F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; };
+ F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F966BCF408F27A3E005CB29B /* rmd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rmd.bat; sourceTree = "<group>"; };
+ F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
+ F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; };
+ F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F966BCF808F27A3F005CB29B /* tkConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tkConfig.sh.in; sourceTree = "<group>"; };
+ F966BCF908F27A3F005CB29B /* tkWin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWin.h; sourceTree = "<group>"; };
+ F966BCFA08F27A3F005CB29B /* tkWin32Dll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin32Dll.c; sourceTree = "<group>"; };
+ F966BCFB08F27A3F005CB29B /* tkWin3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin3d.c; sourceTree = "<group>"; };
+ F966BCFC08F27A3F005CB29B /* tkWinButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinButton.c; sourceTree = "<group>"; };
+ F966BCFD08F27A3F005CB29B /* tkWinClipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinClipboard.c; sourceTree = "<group>"; };
+ F966BCFE08F27A3F005CB29B /* tkWinColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinColor.c; sourceTree = "<group>"; };
+ F966BCFF08F27A3F005CB29B /* tkWinConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinConfig.c; sourceTree = "<group>"; };
+ F966BD0008F27A3F005CB29B /* tkWinCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinCursor.c; sourceTree = "<group>"; };
+ F966BD0108F27A3F005CB29B /* tkWinDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinDefault.h; sourceTree = "<group>"; };
+ F966BD0208F27A3F005CB29B /* tkWinDialog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinDialog.c; sourceTree = "<group>"; };
+ F966BD0308F27A3F005CB29B /* tkWinDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinDraw.c; sourceTree = "<group>"; };
+ F966BD0408F27A3F005CB29B /* tkWinEmbed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinEmbed.c; sourceTree = "<group>"; };
+ F966BD0508F27A3F005CB29B /* tkWinFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinFont.c; sourceTree = "<group>"; };
+ F966BD0708F27A3F005CB29B /* tkWinImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinImage.c; sourceTree = "<group>"; };
+ F966BD0808F27A3F005CB29B /* tkWinInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinInit.c; sourceTree = "<group>"; };
+ F966BD0908F27A3F005CB29B /* tkWinInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinInt.h; sourceTree = "<group>"; };
+ F966BD0A08F27A3F005CB29B /* tkWinKey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinKey.c; sourceTree = "<group>"; };
+ F966BD0B08F27A3F005CB29B /* tkWinMenu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinMenu.c; sourceTree = "<group>"; };
+ F966BD0C08F27A3F005CB29B /* tkWinPixmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinPixmap.c; sourceTree = "<group>"; };
+ F966BD0D08F27A3F005CB29B /* tkWinPointer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinPointer.c; sourceTree = "<group>"; };
+ F966BD0E08F27A3F005CB29B /* tkWinPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinPort.h; sourceTree = "<group>"; };
+ F966BD0F08F27A3F005CB29B /* tkWinRegion.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinRegion.c; sourceTree = "<group>"; };
+ F966BD1008F27A3F005CB29B /* tkWinScrlbr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinScrlbr.c; sourceTree = "<group>"; };
+ F966BD1108F27A3F005CB29B /* tkWinSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinSend.c; sourceTree = "<group>"; };
+ F966BD1208F27A3F005CB29B /* tkWinSendCom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinSendCom.c; sourceTree = "<group>"; };
+ F966BD1308F27A3F005CB29B /* tkWinSendCom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWinSendCom.h; sourceTree = "<group>"; };
+ F966BD1408F27A3F005CB29B /* tkWinTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinTest.c; sourceTree = "<group>"; };
+ F966BD1508F27A3F005CB29B /* tkWinWindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinWindow.c; sourceTree = "<group>"; };
+ F966BD1608F27A3F005CB29B /* tkWinWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinWm.c; sourceTree = "<group>"; };
+ F966BD1708F27A3F005CB29B /* tkWinX.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWinX.c; sourceTree = "<group>"; };
+ F966BD1808F27A3F005CB29B /* winMain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = winMain.c; sourceTree = "<group>"; };
+ F966BD1B08F27A3F005CB29B /* cursorfont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cursorfont.h; sourceTree = "<group>"; };
+ F966BD1C08F27A3F005CB29B /* keysym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keysym.h; sourceTree = "<group>"; };
+ F966BD1D08F27A3F005CB29B /* keysymdef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keysymdef.h; sourceTree = "<group>"; };
+ F966BD1E08F27A3F005CB29B /* X.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = X.h; sourceTree = "<group>"; };
+ F966BD1F08F27A3F005CB29B /* Xatom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xatom.h; sourceTree = "<group>"; };
+ F966BD2008F27A3F005CB29B /* Xfuncproto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xfuncproto.h; sourceTree = "<group>"; };
+ F966BD2108F27A3F005CB29B /* Xlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xlib.h; sourceTree = "<group>"; };
+ F966BD2208F27A3F005CB29B /* Xutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xutil.h; sourceTree = "<group>"; };
+ F966BD2308F27A3F005CB29B /* xbytes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbytes.h; sourceTree = "<group>"; };
+ F966BD2408F27A3F005CB29B /* xcolors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xcolors.c; sourceTree = "<group>"; };
+ F966BD2508F27A3F005CB29B /* xdraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xdraw.c; sourceTree = "<group>"; };
+ F966BD2608F27A3F005CB29B /* xgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xgc.c; sourceTree = "<group>"; };
+ F966BD2708F27A3F005CB29B /* ximage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ximage.c; sourceTree = "<group>"; };
+ F966BD2808F27A3F005CB29B /* xutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xutil.c; sourceTree = "<group>"; };
+ F966C07408F2820D005CB29B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+ F966C07608F2821B005CB29B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+ F966C07808F28233005CB29B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+ F96887E00AF786D5000797B5 /* ttk.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk.decls; sourceTree = "<group>"; };
+ F96887E10AF786D5000797B5 /* ttkBlink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkBlink.c; sourceTree = "<group>"; };
+ F96887E20AF786D5000797B5 /* ttkButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkButton.c; sourceTree = "<group>"; };
+ F96887E30AF786D5000797B5 /* ttkCache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkCache.c; sourceTree = "<group>"; };
+ F96887E40AF786D5000797B5 /* ttkClamTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkClamTheme.c; sourceTree = "<group>"; };
+ F96887E50AF786D5000797B5 /* ttkClassicTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkClassicTheme.c; sourceTree = "<group>"; };
+ F96887E60AF786D5000797B5 /* ttkDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkDecls.h; sourceTree = "<group>"; };
+ F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkDefaultTheme.c; sourceTree = "<group>"; };
+ F96887E80AF786D5000797B5 /* ttkElements.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkElements.c; sourceTree = "<group>"; };
+ F96887E90AF786D5000797B5 /* ttkEntry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkEntry.c; sourceTree = "<group>"; };
+ F96887EA0AF786D5000797B5 /* ttkFrame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkFrame.c; sourceTree = "<group>"; };
+ F96887EB0AF786D5000797B5 /* ttkImage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkImage.c; sourceTree = "<group>"; };
+ F96887EC0AF786D5000797B5 /* ttkInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkInit.c; sourceTree = "<group>"; };
+ F96887ED0AF786D5000797B5 /* ttkLabel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkLabel.c; sourceTree = "<group>"; };
+ F96887EE0AF786D5000797B5 /* ttkLayout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkLayout.c; sourceTree = "<group>"; };
+ F96887EF0AF786D5000797B5 /* ttkManager.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkManager.c; sourceTree = "<group>"; };
+ F96887F00AF786D5000797B5 /* ttkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkManager.h; sourceTree = "<group>"; };
+ F96887F10AF786D5000797B5 /* ttkNotebook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkNotebook.c; sourceTree = "<group>"; };
+ F96887F20AF786D5000797B5 /* ttkPanedwindow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkPanedwindow.c; sourceTree = "<group>"; };
+ F96887F30AF786D5000797B5 /* ttkProgress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkProgress.c; sourceTree = "<group>"; };
+ F96887F40AF786D5000797B5 /* ttkScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkScale.c; sourceTree = "<group>"; };
+ F96887F50AF786D5000797B5 /* ttkScroll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkScroll.c; sourceTree = "<group>"; };
+ F96887F60AF786D5000797B5 /* ttkScrollbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkScrollbar.c; sourceTree = "<group>"; };
+ F96887F70AF786D5000797B5 /* ttkSeparator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkSeparator.c; sourceTree = "<group>"; };
+ F96887F80AF786D5000797B5 /* ttkSquare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkSquare.c; sourceTree = "<group>"; };
+ F96887F90AF786D5000797B5 /* ttkState.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkState.c; sourceTree = "<group>"; };
+ F96887FA0AF786D5000797B5 /* ttkStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkStubInit.c; sourceTree = "<group>"; };
+ F96887FB0AF786D5000797B5 /* ttkStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkStubLib.c; sourceTree = "<group>"; };
+ F96887FC0AF786D5000797B5 /* ttkTagSet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTagSet.c; sourceTree = "<group>"; };
+ F96887FD0AF786D5000797B5 /* ttkTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTheme.c; sourceTree = "<group>"; };
+ F96887FE0AF786D5000797B5 /* ttkTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkTheme.h; sourceTree = "<group>"; };
+ F96887FF0AF786D5000797B5 /* ttkThemeInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkThemeInt.h; sourceTree = "<group>"; };
+ F96888000AF786D5000797B5 /* ttkTrace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTrace.c; sourceTree = "<group>"; };
+ F96888010AF786D5000797B5 /* ttkTrack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTrack.c; sourceTree = "<group>"; };
+ F96888020AF786D5000797B5 /* ttkTreeview.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkTreeview.c; sourceTree = "<group>"; };
+ F96888030AF786D5000797B5 /* ttkWidget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWidget.c; sourceTree = "<group>"; };
+ F96888040AF786D5000797B5 /* ttkWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttkWidget.h; sourceTree = "<group>"; };
+ F96888370AF787B3000797B5 /* altTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = altTheme.tcl; sourceTree = "<group>"; };
+ F96888380AF787B3000797B5 /* aquaTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = aquaTheme.tcl; sourceTree = "<group>"; };
+ F96888390AF787B3000797B5 /* button.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = button.tcl; sourceTree = "<group>"; };
+ F968883A0AF787B3000797B5 /* clamTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clamTheme.tcl; sourceTree = "<group>"; };
+ F968883B0AF787B3000797B5 /* classicTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = classicTheme.tcl; sourceTree = "<group>"; };
+ F968883C0AF787B3000797B5 /* combobox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combobox.tcl; sourceTree = "<group>"; };
+ F968883D0AF787B3000797B5 /* cursors.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cursors.tcl; sourceTree = "<group>"; };
+ F968883E0AF787B3000797B5 /* defaults.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = defaults.tcl; sourceTree = "<group>"; };
+ F96888400AF787B3000797B5 /* entry.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.tcl; sourceTree = "<group>"; };
+ F96888410AF787B3000797B5 /* fonts.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fonts.tcl; sourceTree = "<group>"; };
+ F96888440AF787B3000797B5 /* menubutton.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubutton.tcl; sourceTree = "<group>"; };
+ F96888450AF787B3000797B5 /* notebook.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notebook.tcl; sourceTree = "<group>"; };
+ F96888460AF787B3000797B5 /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
+ F96888470AF787B3000797B5 /* progress.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = progress.tcl; sourceTree = "<group>"; };
+ F96888480AF787B3000797B5 /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
+ F96888490AF787B3000797B5 /* scrollbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrollbar.tcl; sourceTree = "<group>"; };
+ F968884A0AF787B3000797B5 /* sizegrip.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = sizegrip.tcl; sourceTree = "<group>"; };
+ F968884B0AF787B3000797B5 /* treeview.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = treeview.tcl; sourceTree = "<group>"; };
+ F968884C0AF787B3000797B5 /* ttk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk.tcl; sourceTree = "<group>"; };
+ F968884D0AF787B3000797B5 /* utils.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = utils.tcl; sourceTree = "<group>"; };
+ F968884E0AF787B3000797B5 /* winTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTheme.tcl; sourceTree = "<group>"; };
+ F968884F0AF787B3000797B5 /* xpTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xpTheme.tcl; sourceTree = "<group>"; };
+ F96888540AF7880C000797B5 /* all.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = all.tcl; sourceTree = "<group>"; };
+ F96888560AF7880C000797B5 /* combobox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combobox.test; sourceTree = "<group>"; };
+ F96888570AF7880C000797B5 /* entry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.test; sourceTree = "<group>"; };
+ F96888580AF7880C000797B5 /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
+ F96888590AF7880C000797B5 /* labelframe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = labelframe.test; sourceTree = "<group>"; };
+ F968885A0AF7880C000797B5 /* layout.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = layout.test; sourceTree = "<group>"; };
+ F968885C0AF7880C000797B5 /* notebook.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notebook.test; sourceTree = "<group>"; };
+ F968885D0AF7880C000797B5 /* panedwindow.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.test; sourceTree = "<group>"; };
+ F968885E0AF7880C000797B5 /* progressbar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = progressbar.test; sourceTree = "<group>"; };
+ F968885F0AF7880C000797B5 /* scrollbar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrollbar.test; sourceTree = "<group>"; };
+ F96888600AF7880C000797B5 /* treetags.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = treetags.test; sourceTree = "<group>"; };
+ F96888610AF7880C000797B5 /* treeview.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = treeview.test; sourceTree = "<group>"; };
+ F96888620AF7880C000797B5 /* ttk.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk.test; sourceTree = "<group>"; };
+ F96888630AF7880C000797B5 /* validate.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = validate.test; sourceTree = "<group>"; };
+ F968886B0AF788F6000797B5 /* ttk_button.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_button.n; sourceTree = "<group>"; };
+ F968886C0AF788F6000797B5 /* ttk_checkbutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_checkbutton.n; sourceTree = "<group>"; };
+ F968886D0AF788F6000797B5 /* ttk_combobox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_combobox.n; sourceTree = "<group>"; };
+ F968886F0AF788F6000797B5 /* ttk_entry.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_entry.n; sourceTree = "<group>"; };
+ F96888700AF788F6000797B5 /* ttk_frame.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_frame.n; sourceTree = "<group>"; };
+ F96888710AF788F6000797B5 /* ttk_Geometry.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_Geometry.3; sourceTree = "<group>"; };
+ F96888720AF788F6000797B5 /* ttk_image.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_image.n; sourceTree = "<group>"; };
+ F96888730AF788F6000797B5 /* ttk_intro.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_intro.n; sourceTree = "<group>"; };
+ F96888740AF788F6000797B5 /* ttk_label.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_label.n; sourceTree = "<group>"; };
+ F96888750AF788F6000797B5 /* ttk_labelframe.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_labelframe.n; sourceTree = "<group>"; };
+ F96888760AF788F6000797B5 /* ttk_menubutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_menubutton.n; sourceTree = "<group>"; };
+ F96888770AF788F6000797B5 /* ttk_notebook.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_notebook.n; sourceTree = "<group>"; };
+ F96888780AF788F6000797B5 /* ttk_panedwindow.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_panedwindow.n; sourceTree = "<group>"; };
+ F96888790AF788F6000797B5 /* ttk_progressbar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_progressbar.n; sourceTree = "<group>"; };
+ F968887A0AF788F6000797B5 /* ttk_radiobutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_radiobutton.n; sourceTree = "<group>"; };
+ F968887B0AF788F6000797B5 /* ttk_scrollbar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_scrollbar.n; sourceTree = "<group>"; };
+ F968887C0AF788F6000797B5 /* ttk_separator.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_separator.n; sourceTree = "<group>"; };
+ F968887D0AF788F6000797B5 /* ttk_sizegrip.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_sizegrip.n; sourceTree = "<group>"; };
+ F968887E0AF788F6000797B5 /* ttk_style.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_style.n; sourceTree = "<group>"; };
+ F968887F0AF788F6000797B5 /* ttk_Theme.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_Theme.3; sourceTree = "<group>"; };
+ F96888800AF788F6000797B5 /* ttk_treeview.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_treeview.n; sourceTree = "<group>"; };
+ F96888810AF788F6000797B5 /* ttk_widget.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_widget.n; sourceTree = "<group>"; };
+ F96888840AF78938000797B5 /* ttkMacOSXTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkMacOSXTheme.c; sourceTree = "<group>"; };
+ F96888860AF78953000797B5 /* ttkWinMonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinMonitor.c; sourceTree = "<group>"; };
+ F96888870AF78953000797B5 /* ttkWinTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinTheme.c; sourceTree = "<group>"; };
+ F96888880AF78953000797B5 /* ttkWinXPTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinXPTheme.c; sourceTree = "<group>"; };
+ F96D3DFA08F272A4004A47F5 /* ChangeLog */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = ChangeLog; sourceTree = "<group>"; };
+ F96D3DFB08F272A4004A47F5 /* changes */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = changes; sourceTree = "<group>"; };
+ F96D3DFD08F272A4004A47F5 /* Access.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Access.3; sourceTree = "<group>"; };
+ F96D3DFE08F272A4004A47F5 /* AddErrInfo.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AddErrInfo.3; sourceTree = "<group>"; };
+ F96D3DFF08F272A4004A47F5 /* after.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = after.n; sourceTree = "<group>"; };
+ F96D3E0008F272A4004A47F5 /* Alloc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Alloc.3; sourceTree = "<group>"; };
+ F96D3E0108F272A4004A47F5 /* AllowExc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AllowExc.3; sourceTree = "<group>"; };
+ F96D3E0208F272A4004A47F5 /* append.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = append.n; sourceTree = "<group>"; };
+ F96D3E0308F272A4004A47F5 /* AppInit.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AppInit.3; sourceTree = "<group>"; };
+ F96D3E0408F272A5004A47F5 /* array.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = array.n; sourceTree = "<group>"; };
+ F96D3E0508F272A5004A47F5 /* AssocData.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AssocData.3; sourceTree = "<group>"; };
+ F96D3E0608F272A5004A47F5 /* Async.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Async.3; sourceTree = "<group>"; };
+ F96D3E0708F272A5004A47F5 /* BackgdErr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = BackgdErr.3; sourceTree = "<group>"; };
+ F96D3E0808F272A5004A47F5 /* Backslash.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Backslash.3; sourceTree = "<group>"; };
+ F96D3E0908F272A5004A47F5 /* bgerror.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bgerror.n; sourceTree = "<group>"; };
+ F96D3E0A08F272A5004A47F5 /* binary.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = binary.n; sourceTree = "<group>"; };
+ F96D3E0B08F272A5004A47F5 /* BoolObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = BoolObj.3; sourceTree = "<group>"; };
+ F96D3E0C08F272A5004A47F5 /* break.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = break.n; sourceTree = "<group>"; };
+ F96D3E0D08F272A5004A47F5 /* ByteArrObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ByteArrObj.3; sourceTree = "<group>"; };
+ F96D3E0E08F272A5004A47F5 /* CallDel.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CallDel.3; sourceTree = "<group>"; };
+ F96D3E0F08F272A5004A47F5 /* case.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = case.n; sourceTree = "<group>"; };
+ F96D3E1008F272A5004A47F5 /* catch.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = catch.n; sourceTree = "<group>"; };
+ F96D3E1108F272A5004A47F5 /* cd.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = cd.n; sourceTree = "<group>"; };
+ F96D3E1208F272A5004A47F5 /* chan.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = chan.n; sourceTree = "<group>"; };
+ F96D3E1308F272A5004A47F5 /* ChnlStack.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ChnlStack.3; sourceTree = "<group>"; };
+ F96D3E1408F272A5004A47F5 /* clock.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = clock.n; sourceTree = "<group>"; };
+ F96D3E1508F272A5004A47F5 /* close.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = close.n; sourceTree = "<group>"; };
+ F96D3E1608F272A5004A47F5 /* CmdCmplt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CmdCmplt.3; sourceTree = "<group>"; };
+ F96D3E1708F272A5004A47F5 /* Concat.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Concat.3; sourceTree = "<group>"; };
+ F96D3E1808F272A5004A47F5 /* concat.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = concat.n; sourceTree = "<group>"; };
+ F96D3E1908F272A5004A47F5 /* continue.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = continue.n; sourceTree = "<group>"; };
+ F96D3E1A08F272A5004A47F5 /* CrtChannel.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtChannel.3; sourceTree = "<group>"; };
+ F96D3E1B08F272A5004A47F5 /* CrtChnlHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtChnlHdlr.3; sourceTree = "<group>"; };
+ F96D3E1C08F272A5004A47F5 /* CrtCloseHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtCloseHdlr.3; sourceTree = "<group>"; };
+ F96D3E1D08F272A5004A47F5 /* CrtCommand.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtCommand.3; sourceTree = "<group>"; };
+ F96D3E1E08F272A5004A47F5 /* CrtFileHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtFileHdlr.3; sourceTree = "<group>"; };
+ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
+ F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
+ F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
+ F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
+ F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
+ F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
+ F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
+ F96D3E2608F272A5004A47F5 /* DetachPids.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DetachPids.3; sourceTree = "<group>"; };
+ F96D3E2708F272A5004A47F5 /* dict.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dict.n; sourceTree = "<group>"; };
+ F96D3E2808F272A5004A47F5 /* DictObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DictObj.3; sourceTree = "<group>"; };
+ F96D3E2908F272A5004A47F5 /* DoOneEvent.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DoOneEvent.3; sourceTree = "<group>"; };
+ F96D3E2A08F272A5004A47F5 /* DoubleObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DoubleObj.3; sourceTree = "<group>"; };
+ F96D3E2B08F272A5004A47F5 /* DoWhenIdle.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DoWhenIdle.3; sourceTree = "<group>"; };
+ F96D3E2C08F272A5004A47F5 /* DString.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DString.3; sourceTree = "<group>"; };
+ F96D3E2D08F272A5004A47F5 /* DumpActiveMemory.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = DumpActiveMemory.3; sourceTree = "<group>"; };
+ F96D3E2E08F272A5004A47F5 /* Encoding.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Encoding.3; sourceTree = "<group>"; };
+ F96D3E2F08F272A5004A47F5 /* encoding.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = encoding.n; sourceTree = "<group>"; };
+ F96D3E3008F272A5004A47F5 /* Ensemble.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Ensemble.3; sourceTree = "<group>"; };
+ F96D3E3108F272A5004A47F5 /* Environment.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Environment.3; sourceTree = "<group>"; };
+ F96D3E3208F272A5004A47F5 /* eof.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = eof.n; sourceTree = "<group>"; };
+ F96D3E3308F272A5004A47F5 /* error.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = error.n; sourceTree = "<group>"; };
+ F96D3E3408F272A5004A47F5 /* Eval.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Eval.3; sourceTree = "<group>"; };
+ F96D3E3508F272A5004A47F5 /* eval.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = eval.n; sourceTree = "<group>"; };
+ F96D3E3608F272A5004A47F5 /* exec.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = exec.n; sourceTree = "<group>"; };
+ F96D3E3708F272A5004A47F5 /* Exit.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Exit.3; sourceTree = "<group>"; };
+ F96D3E3808F272A5004A47F5 /* exit.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = exit.n; sourceTree = "<group>"; };
+ F96D3E3908F272A5004A47F5 /* expr.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = expr.n; sourceTree = "<group>"; };
+ F96D3E3A08F272A5004A47F5 /* ExprLong.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ExprLong.3; sourceTree = "<group>"; };
+ F96D3E3B08F272A5004A47F5 /* ExprLongObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ExprLongObj.3; sourceTree = "<group>"; };
+ F96D3E3C08F272A5004A47F5 /* fblocked.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fblocked.n; sourceTree = "<group>"; };
+ F96D3E3D08F272A5004A47F5 /* fconfigure.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fconfigure.n; sourceTree = "<group>"; };
+ F96D3E3E08F272A5004A47F5 /* fcopy.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fcopy.n; sourceTree = "<group>"; };
+ F96D3E3F08F272A5004A47F5 /* file.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = file.n; sourceTree = "<group>"; };
+ F96D3E4008F272A5004A47F5 /* fileevent.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fileevent.n; sourceTree = "<group>"; };
+ F96D3E4108F272A5004A47F5 /* filename.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = filename.n; sourceTree = "<group>"; };
+ F96D3E4208F272A5004A47F5 /* FileSystem.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FileSystem.3; sourceTree = "<group>"; };
+ F96D3E4308F272A5004A47F5 /* FindExec.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = FindExec.3; sourceTree = "<group>"; };
+ F96D3E4408F272A5004A47F5 /* flush.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = flush.n; sourceTree = "<group>"; };
+ F96D3E4508F272A5004A47F5 /* for.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = for.n; sourceTree = "<group>"; };
+ F96D3E4608F272A5004A47F5 /* foreach.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = foreach.n; sourceTree = "<group>"; };
+ F96D3E4708F272A5004A47F5 /* format.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = format.n; sourceTree = "<group>"; };
+ F96D3E4808F272A5004A47F5 /* GetCwd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetCwd.3; sourceTree = "<group>"; };
+ F96D3E4908F272A5004A47F5 /* GetHostName.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetHostName.3; sourceTree = "<group>"; };
+ F96D3E4A08F272A5004A47F5 /* GetIndex.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetIndex.3; sourceTree = "<group>"; };
+ F96D3E4B08F272A5004A47F5 /* GetInt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetInt.3; sourceTree = "<group>"; };
+ F96D3E4C08F272A5004A47F5 /* GetOpnFl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetOpnFl.3; sourceTree = "<group>"; };
+ F96D3E4D08F272A5004A47F5 /* gets.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = gets.n; sourceTree = "<group>"; };
+ F96D3E4E08F272A5004A47F5 /* GetStdChan.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetStdChan.3; sourceTree = "<group>"; };
+ F96D3E4F08F272A5004A47F5 /* GetTime.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetTime.3; sourceTree = "<group>"; };
+ F96D3E5008F272A5004A47F5 /* GetVersion.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = GetVersion.3; sourceTree = "<group>"; };
+ F96D3E5108F272A5004A47F5 /* glob.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = glob.n; sourceTree = "<group>"; };
+ F96D3E5208F272A6004A47F5 /* global.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = global.n; sourceTree = "<group>"; };
+ F96D3E5308F272A6004A47F5 /* Hash.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Hash.3; sourceTree = "<group>"; };
+ F96D3E5408F272A6004A47F5 /* history.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = history.n; sourceTree = "<group>"; };
+ F96D3E5508F272A6004A47F5 /* http.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = http.n; sourceTree = "<group>"; };
+ F96D3E5608F272A6004A47F5 /* if.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = if.n; sourceTree = "<group>"; };
+ F96D3E5708F272A6004A47F5 /* incr.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = incr.n; sourceTree = "<group>"; };
+ F96D3E5808F272A6004A47F5 /* info.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = info.n; sourceTree = "<group>"; };
+ F96D3E5908F272A6004A47F5 /* Init.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Init.3; sourceTree = "<group>"; };
+ F96D3E5A08F272A6004A47F5 /* InitStubs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = InitStubs.3; sourceTree = "<group>"; };
+ F96D3E5B08F272A6004A47F5 /* Interp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Interp.3; sourceTree = "<group>"; };
+ F96D3E5C08F272A6004A47F5 /* interp.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = interp.n; sourceTree = "<group>"; };
+ F96D3E5D08F272A6004A47F5 /* IntObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = IntObj.3; sourceTree = "<group>"; };
+ F96D3E5E08F272A6004A47F5 /* join.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = join.n; sourceTree = "<group>"; };
+ F96D3E5F08F272A6004A47F5 /* lappend.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lappend.n; sourceTree = "<group>"; };
+ F96D3E6008F272A6004A47F5 /* lassign.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lassign.n; sourceTree = "<group>"; };
+ F96D3E6108F272A6004A47F5 /* library.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = library.n; sourceTree = "<group>"; };
+ F96D3E6208F272A6004A47F5 /* Limit.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Limit.3; sourceTree = "<group>"; };
+ F96D3E6308F272A6004A47F5 /* lindex.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lindex.n; sourceTree = "<group>"; };
+ F96D3E6408F272A6004A47F5 /* LinkVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = LinkVar.3; sourceTree = "<group>"; };
+ F96D3E6508F272A6004A47F5 /* linsert.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = linsert.n; sourceTree = "<group>"; };
+ F96D3E6608F272A6004A47F5 /* list.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = list.n; sourceTree = "<group>"; };
+ F96D3E6708F272A6004A47F5 /* ListObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ListObj.3; sourceTree = "<group>"; };
+ F96D3E6808F272A6004A47F5 /* llength.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = llength.n; sourceTree = "<group>"; };
+ F96D3E6908F272A6004A47F5 /* load.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = load.n; sourceTree = "<group>"; };
+ F96D3E6A08F272A6004A47F5 /* lrange.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lrange.n; sourceTree = "<group>"; };
+ F96D3E6B08F272A6004A47F5 /* lrepeat.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lrepeat.n; sourceTree = "<group>"; };
+ F96D3E6C08F272A6004A47F5 /* lreplace.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lreplace.n; sourceTree = "<group>"; };
+ F96D3E6D08F272A6004A47F5 /* lsearch.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lsearch.n; sourceTree = "<group>"; };
+ F96D3E6E08F272A6004A47F5 /* lset.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lset.n; sourceTree = "<group>"; };
+ F96D3E6F08F272A6004A47F5 /* lsort.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = lsort.n; sourceTree = "<group>"; };
+ F96D3E7008F272A6004A47F5 /* man.macros */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = man.macros; sourceTree = "<group>"; };
+ F96D3E7108F272A6004A47F5 /* mathfunc.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = mathfunc.n; sourceTree = "<group>"; };
+ F96D3E7208F272A6004A47F5 /* memory.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = memory.n; sourceTree = "<group>"; };
+ F96D3E7308F272A6004A47F5 /* msgcat.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = msgcat.n; sourceTree = "<group>"; };
+ F96D3E7408F272A6004A47F5 /* Namespace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Namespace.3; sourceTree = "<group>"; };
+ F96D3E7508F272A6004A47F5 /* namespace.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = namespace.n; sourceTree = "<group>"; };
+ F96D3E7608F272A6004A47F5 /* Notifier.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Notifier.3; sourceTree = "<group>"; };
+ F96D3E7708F272A6004A47F5 /* Object.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Object.3; sourceTree = "<group>"; };
+ F96D3E7808F272A6004A47F5 /* ObjectType.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ObjectType.3; sourceTree = "<group>"; };
+ F96D3E7908F272A6004A47F5 /* open.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = open.n; sourceTree = "<group>"; };
+ F96D3E7A08F272A6004A47F5 /* OpenFileChnl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = OpenFileChnl.3; sourceTree = "<group>"; };
+ F96D3E7B08F272A6004A47F5 /* OpenTcp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = OpenTcp.3; sourceTree = "<group>"; };
+ F96D3E7C08F272A6004A47F5 /* package.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = package.n; sourceTree = "<group>"; };
+ F96D3E7D08F272A6004A47F5 /* packagens.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = packagens.n; sourceTree = "<group>"; };
+ F96D3E7E08F272A6004A47F5 /* Panic.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Panic.3; sourceTree = "<group>"; };
+ F96D3E7F08F272A6004A47F5 /* ParseCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ParseCmd.3; sourceTree = "<group>"; };
+ F96D3E8008F272A6004A47F5 /* pid.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pid.n; sourceTree = "<group>"; };
+ F96D3E8108F272A6004A47F5 /* pkgMkIndex.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pkgMkIndex.n; sourceTree = "<group>"; };
+ F96D3E8208F272A6004A47F5 /* PkgRequire.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = PkgRequire.3; sourceTree = "<group>"; };
+ F96D3E8308F272A6004A47F5 /* Preserve.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Preserve.3; sourceTree = "<group>"; };
+ F96D3E8408F272A6004A47F5 /* PrintDbl.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = PrintDbl.3; sourceTree = "<group>"; };
+ F96D3E8508F272A6004A47F5 /* proc.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = proc.n; sourceTree = "<group>"; };
+ F96D3E8608F272A6004A47F5 /* puts.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = puts.n; sourceTree = "<group>"; };
+ F96D3E8708F272A6004A47F5 /* pwd.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pwd.n; sourceTree = "<group>"; };
+ F96D3E8808F272A6004A47F5 /* re_syntax.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = re_syntax.n; sourceTree = "<group>"; };
+ F96D3E8908F272A6004A47F5 /* read.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = read.n; sourceTree = "<group>"; };
+ F96D3E8A08F272A6004A47F5 /* RecEvalObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RecEvalObj.3; sourceTree = "<group>"; };
+ F96D3E8B08F272A6004A47F5 /* RecordEval.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RecordEval.3; sourceTree = "<group>"; };
+ F96D3E8C08F272A6004A47F5 /* RegConfig.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RegConfig.3; sourceTree = "<group>"; };
+ F96D3E8D08F272A6004A47F5 /* RegExp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = RegExp.3; sourceTree = "<group>"; };
+ F96D3E8E08F272A6004A47F5 /* regexp.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = regexp.n; sourceTree = "<group>"; };
+ F96D3E8F08F272A6004A47F5 /* registry.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = registry.n; sourceTree = "<group>"; };
+ F96D3E9008F272A6004A47F5 /* regsub.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = regsub.n; sourceTree = "<group>"; };
+ F96D3E9108F272A6004A47F5 /* rename.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = rename.n; sourceTree = "<group>"; };
+ F96D3E9208F272A6004A47F5 /* return.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = return.n; sourceTree = "<group>"; };
+ F96D3E9308F272A6004A47F5 /* safe.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = safe.n; sourceTree = "<group>"; };
+ F96D3E9408F272A6004A47F5 /* SaveResult.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SaveResult.3; sourceTree = "<group>"; };
+ F96D3E9508F272A6004A47F5 /* scan.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = scan.n; sourceTree = "<group>"; };
+ F96D3E9608F272A6004A47F5 /* seek.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = seek.n; sourceTree = "<group>"; };
+ F96D3E9708F272A6004A47F5 /* set.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = set.n; sourceTree = "<group>"; };
+ F96D3E9808F272A6004A47F5 /* SetChanErr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetChanErr.3; sourceTree = "<group>"; };
+ F96D3E9908F272A6004A47F5 /* SetErrno.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetErrno.3; sourceTree = "<group>"; };
+ F96D3E9A08F272A6004A47F5 /* SetRecLmt.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetRecLmt.3; sourceTree = "<group>"; };
+ F96D3E9B08F272A7004A47F5 /* SetResult.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetResult.3; sourceTree = "<group>"; };
+ F96D3E9C08F272A7004A47F5 /* SetVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SetVar.3; sourceTree = "<group>"; };
+ F96D3E9D08F272A7004A47F5 /* Signal.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Signal.3; sourceTree = "<group>"; };
+ F96D3E9E08F272A7004A47F5 /* Sleep.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Sleep.3; sourceTree = "<group>"; };
+ F96D3E9F08F272A7004A47F5 /* socket.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = socket.n; sourceTree = "<group>"; };
+ F96D3EA008F272A7004A47F5 /* source.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = source.n; sourceTree = "<group>"; };
+ F96D3EA108F272A7004A47F5 /* SourceRCFile.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SourceRCFile.3; sourceTree = "<group>"; };
+ F96D3EA208F272A7004A47F5 /* split.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = split.n; sourceTree = "<group>"; };
+ F96D3EA308F272A7004A47F5 /* SplitList.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SplitList.3; sourceTree = "<group>"; };
+ F96D3EA408F272A7004A47F5 /* SplitPath.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SplitPath.3; sourceTree = "<group>"; };
+ F96D3EA508F272A7004A47F5 /* StaticPkg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StaticPkg.3; sourceTree = "<group>"; };
+ F96D3EA608F272A7004A47F5 /* StdChannels.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StdChannels.3; sourceTree = "<group>"; };
+ F96D3EA708F272A7004A47F5 /* string.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = string.n; sourceTree = "<group>"; };
+ F96D3EA808F272A7004A47F5 /* StringObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StringObj.3; sourceTree = "<group>"; };
+ F96D3EA908F272A7004A47F5 /* StrMatch.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = StrMatch.3; sourceTree = "<group>"; };
+ F96D3EAA08F272A7004A47F5 /* subst.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = subst.n; sourceTree = "<group>"; };
+ F96D3EAB08F272A7004A47F5 /* SubstObj.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = SubstObj.3; sourceTree = "<group>"; };
+ F96D3EAC08F272A7004A47F5 /* switch.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = switch.n; sourceTree = "<group>"; };
+ F96D3EAD08F272A7004A47F5 /* Tcl.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tcl.n; sourceTree = "<group>"; };
+ F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Tcl_Main.3; sourceTree = "<group>"; };
+ F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TCL_MEM_DEBUG.3; sourceTree = "<group>"; };
+ F96D3EB008F272A7004A47F5 /* tclsh.1 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tclsh.1; sourceTree = "<group>"; };
+ F96D3EB108F272A7004A47F5 /* tcltest.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tcltest.n; sourceTree = "<group>"; };
+ F96D3EB208F272A7004A47F5 /* tclvars.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tclvars.n; sourceTree = "<group>"; };
+ F96D3EB308F272A7004A47F5 /* tell.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tell.n; sourceTree = "<group>"; };
+ F96D3EB408F272A7004A47F5 /* Thread.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Thread.3; sourceTree = "<group>"; };
+ F96D3EB508F272A7004A47F5 /* time.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = time.n; sourceTree = "<group>"; };
+ F96D3EB608F272A7004A47F5 /* tm.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = tm.n; sourceTree = "<group>"; };
+ F96D3EB708F272A7004A47F5 /* ToUpper.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ToUpper.3; sourceTree = "<group>"; };
+ F96D3EB808F272A7004A47F5 /* trace.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = trace.n; sourceTree = "<group>"; };
+ F96D3EB908F272A7004A47F5 /* TraceCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TraceCmd.3; sourceTree = "<group>"; };
+ F96D3EBA08F272A7004A47F5 /* TraceVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TraceVar.3; sourceTree = "<group>"; };
+ F96D3EBB08F272A7004A47F5 /* Translate.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Translate.3; sourceTree = "<group>"; };
+ F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = UniCharIsAlpha.3; sourceTree = "<group>"; };
+ F96D3EBD08F272A7004A47F5 /* unknown.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = unknown.n; sourceTree = "<group>"; };
+ F96D3EBE08F272A7004A47F5 /* unload.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = unload.n; sourceTree = "<group>"; };
+ F96D3EBF08F272A7004A47F5 /* unset.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = unset.n; sourceTree = "<group>"; };
+ F96D3EC008F272A7004A47F5 /* update.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = update.n; sourceTree = "<group>"; };
+ F96D3EC108F272A7004A47F5 /* uplevel.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = uplevel.n; sourceTree = "<group>"; };
+ F96D3EC208F272A7004A47F5 /* UpVar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = UpVar.3; sourceTree = "<group>"; };
+ F96D3EC308F272A7004A47F5 /* upvar.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = upvar.n; sourceTree = "<group>"; };
+ F96D3EC408F272A7004A47F5 /* Utf.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Utf.3; sourceTree = "<group>"; };
+ F96D3EC508F272A7004A47F5 /* variable.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = variable.n; sourceTree = "<group>"; };
+ F96D3EC608F272A7004A47F5 /* vwait.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = vwait.n; sourceTree = "<group>"; };
+ F96D3EC708F272A7004A47F5 /* while.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = while.n; sourceTree = "<group>"; };
+ F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = WrongNumArgs.3; sourceTree = "<group>"; };
+ F96D3ECA08F272A7004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D3ECB08F272A7004A47F5 /* regc_color.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_color.c; sourceTree = "<group>"; };
+ F96D3ECC08F272A7004A47F5 /* regc_cvec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_cvec.c; sourceTree = "<group>"; };
+ F96D3ECD08F272A7004A47F5 /* regc_lex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_lex.c; sourceTree = "<group>"; };
+ F96D3ECE08F272A7004A47F5 /* regc_locale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_locale.c; sourceTree = "<group>"; };
+ F96D3ECF08F272A7004A47F5 /* regc_nfa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regc_nfa.c; sourceTree = "<group>"; };
+ F96D3ED008F272A7004A47F5 /* regcomp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regcomp.c; sourceTree = "<group>"; };
+ F96D3ED108F272A7004A47F5 /* regcustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regcustom.h; sourceTree = "<group>"; };
+ F96D3ED208F272A7004A47F5 /* rege_dfa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rege_dfa.c; sourceTree = "<group>"; };
+ F96D3ED308F272A7004A47F5 /* regerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regerror.c; sourceTree = "<group>"; };
+ F96D3ED408F272A7004A47F5 /* regerrs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regerrs.h; sourceTree = "<group>"; };
+ F96D3ED508F272A7004A47F5 /* regex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regex.h; sourceTree = "<group>"; };
+ F96D3ED608F272A7004A47F5 /* regexec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regexec.c; sourceTree = "<group>"; };
+ F96D3ED708F272A7004A47F5 /* regfree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regfree.c; sourceTree = "<group>"; };
+ F96D3ED808F272A7004A47F5 /* regfronts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regfronts.c; sourceTree = "<group>"; };
+ F96D3ED908F272A7004A47F5 /* regguts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regguts.h; sourceTree = "<group>"; };
+ F96D3EDA08F272A7004A47F5 /* tcl.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tcl.decls; sourceTree = "<group>"; };
+ F96D3EDB08F272A7004A47F5 /* tcl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tcl.h; sourceTree = "<group>"; };
+ F96D3EDC08F272A7004A47F5 /* tclAlloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAlloc.c; sourceTree = "<group>"; };
+ F96D3EDD08F272A7004A47F5 /* tclAsync.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAsync.c; sourceTree = "<group>"; };
+ F96D3EDE08F272A7004A47F5 /* tclBasic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclBasic.c; sourceTree = "<group>"; };
+ F96D3EDF08F272A7004A47F5 /* tclBinary.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclBinary.c; sourceTree = "<group>"; };
+ F96D3EE008F272A7004A47F5 /* tclCkalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCkalloc.c; sourceTree = "<group>"; };
+ F96D3EE108F272A7004A47F5 /* tclClock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclClock.c; sourceTree = "<group>"; };
+ F96D3EE208F272A7004A47F5 /* tclCmdAH.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCmdAH.c; sourceTree = "<group>"; };
+ F96D3EE308F272A7004A47F5 /* tclCmdIL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCmdIL.c; sourceTree = "<group>"; };
+ F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCmdMZ.c; sourceTree = "<group>"; };
+ F96D3EE508F272A7004A47F5 /* tclCompCmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCompCmds.c; sourceTree = "<group>"; };
+ F96D3EE608F272A7004A47F5 /* tclCompExpr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCompExpr.c; sourceTree = "<group>"; };
+ F96D3EE708F272A7004A47F5 /* tclCompile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclCompile.c; sourceTree = "<group>"; };
+ F96D3EE808F272A7004A47F5 /* tclCompile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclCompile.h; sourceTree = "<group>"; };
+ F96D3EE908F272A7004A47F5 /* tclConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclConfig.c; sourceTree = "<group>"; };
+ F96D3EEA08F272A7004A47F5 /* tclDate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclDate.c; sourceTree = "<group>"; };
+ F96D3EEB08F272A7004A47F5 /* tclDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclDecls.h; sourceTree = "<group>"; };
+ F96D3EEC08F272A7004A47F5 /* tclDictObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclDictObj.c; sourceTree = "<group>"; };
+ F96D3EED08F272A7004A47F5 /* tclEncoding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclEncoding.c; sourceTree = "<group>"; };
+ F96D3EEE08F272A7004A47F5 /* tclEnv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclEnv.c; sourceTree = "<group>"; };
+ F96D3EEF08F272A7004A47F5 /* tclEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclEvent.c; sourceTree = "<group>"; };
+ F96D3EF008F272A7004A47F5 /* tclExecute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclExecute.c; sourceTree = "<group>"; };
+ F96D3EF108F272A7004A47F5 /* tclFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclFCmd.c; sourceTree = "<group>"; };
+ F96D3EF208F272A7004A47F5 /* tclFileName.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclFileName.c; sourceTree = "<group>"; };
+ F96D3EF308F272A7004A47F5 /* tclFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclFileSystem.h; sourceTree = "<group>"; };
+ F96D3EF408F272A7004A47F5 /* tclGet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclGet.c; sourceTree = "<group>"; };
+ F96D3EF508F272A7004A47F5 /* tclGetDate.y */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; path = tclGetDate.y; sourceTree = "<group>"; };
+ F96D3EF608F272A7004A47F5 /* tclHash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclHash.c; sourceTree = "<group>"; };
+ F96D3EF708F272A7004A47F5 /* tclHistory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclHistory.c; sourceTree = "<group>"; };
+ F96D3EF808F272A7004A47F5 /* tclIndexObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIndexObj.c; sourceTree = "<group>"; };
+ F96D3EF908F272A7004A47F5 /* tclInt.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclInt.decls; sourceTree = "<group>"; };
+ F96D3EFA08F272A7004A47F5 /* tclInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclInt.h; sourceTree = "<group>"; };
+ F96D3EFB08F272A7004A47F5 /* tclIntDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclIntDecls.h; sourceTree = "<group>"; };
+ F96D3EFC08F272A7004A47F5 /* tclInterp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclInterp.c; sourceTree = "<group>"; };
+ F96D3EFD08F272A7004A47F5 /* tclIntPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclIntPlatDecls.h; sourceTree = "<group>"; };
+ F96D3EFE08F272A7004A47F5 /* tclIO.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIO.c; sourceTree = "<group>"; };
+ F96D3EFF08F272A7004A47F5 /* tclIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclIO.h; sourceTree = "<group>"; };
+ F96D3F0008F272A7004A47F5 /* tclIOCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOCmd.c; sourceTree = "<group>"; };
+ F96D3F0108F272A7004A47F5 /* tclIOGT.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOGT.c; sourceTree = "<group>"; };
+ F96D3F0208F272A7004A47F5 /* tclIORChan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIORChan.c; sourceTree = "<group>"; };
+ F96D3F0308F272A7004A47F5 /* tclIOSock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOSock.c; sourceTree = "<group>"; };
+ F96D3F0408F272A7004A47F5 /* tclIOUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIOUtil.c; sourceTree = "<group>"; };
+ F96D3F0508F272A7004A47F5 /* tclLink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLink.c; sourceTree = "<group>"; };
+ F96D3F0608F272A7004A47F5 /* tclListObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclListObj.c; sourceTree = "<group>"; };
+ F96D3F0708F272A7004A47F5 /* tclLiteral.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLiteral.c; sourceTree = "<group>"; };
+ F96D3F0808F272A7004A47F5 /* tclLoad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoad.c; sourceTree = "<group>"; };
+ F96D3F0908F272A7004A47F5 /* tclLoadNone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadNone.c; sourceTree = "<group>"; };
+ F96D3F0A08F272A7004A47F5 /* tclMain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMain.c; sourceTree = "<group>"; };
+ F96D3F0B08F272A7004A47F5 /* tclNamesp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclNamesp.c; sourceTree = "<group>"; };
+ F96D3F0C08F272A7004A47F5 /* tclNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclNotify.c; sourceTree = "<group>"; };
+ F96D3F0D08F272A7004A47F5 /* tclObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclObj.c; sourceTree = "<group>"; };
+ F96D3F0E08F272A7004A47F5 /* tclPanic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPanic.c; sourceTree = "<group>"; };
+ F96D3F0F08F272A7004A47F5 /* tclParse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclParse.c; sourceTree = "<group>"; };
+ F96D3F1108F272A7004A47F5 /* tclPathObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPathObj.c; sourceTree = "<group>"; };
+ F96D3F1208F272A7004A47F5 /* tclPipe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPipe.c; sourceTree = "<group>"; };
+ F96D3F1308F272A7004A47F5 /* tclPkg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPkg.c; sourceTree = "<group>"; };
+ F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPkgConfig.c; sourceTree = "<group>"; };
+ F96D3F1508F272A7004A47F5 /* tclPlatDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclPlatDecls.h; sourceTree = "<group>"; };
+ F96D3F1608F272A7004A47F5 /* tclPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclPort.h; sourceTree = "<group>"; };
+ F96D3F1708F272A7004A47F5 /* tclPosixStr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPosixStr.c; sourceTree = "<group>"; };
+ F96D3F1808F272A7004A47F5 /* tclPreserve.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclPreserve.c; sourceTree = "<group>"; };
+ F96D3F1908F272A7004A47F5 /* tclProc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclProc.c; sourceTree = "<group>"; };
+ F96D3F1A08F272A7004A47F5 /* tclRegexp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclRegexp.c; sourceTree = "<group>"; };
+ F96D3F1B08F272A7004A47F5 /* tclRegexp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclRegexp.h; sourceTree = "<group>"; };
+ F96D3F1C08F272A7004A47F5 /* tclResolve.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclResolve.c; sourceTree = "<group>"; };
+ F96D3F1D08F272A7004A47F5 /* tclResult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclResult.c; sourceTree = "<group>"; };
+ F96D3F1E08F272A7004A47F5 /* tclScan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclScan.c; sourceTree = "<group>"; };
+ F96D3F1F08F272A7004A47F5 /* tclStringObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStringObj.c; sourceTree = "<group>"; };
+ F96D3F2408F272A7004A47F5 /* tclStrToD.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStrToD.c; sourceTree = "<group>"; };
+ F96D3F2508F272A7004A47F5 /* tclStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubInit.c; sourceTree = "<group>"; };
+ F96D3F2608F272A7004A47F5 /* tclStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubLib.c; sourceTree = "<group>"; };
+ F96D3F2708F272A7004A47F5 /* tclTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTest.c; sourceTree = "<group>"; };
+ F96D3F2808F272A7004A47F5 /* tclTestObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestObj.c; sourceTree = "<group>"; };
+ F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestProcBodyObj.c; sourceTree = "<group>"; };
+ F96D3F2A08F272A7004A47F5 /* tclThread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThread.c; sourceTree = "<group>"; };
+ F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadAlloc.c; sourceTree = "<group>"; };
+ F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadJoin.c; sourceTree = "<group>"; };
+ F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadStorage.c; sourceTree = "<group>"; };
+ F96D3F2E08F272A7004A47F5 /* tclThreadTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadTest.c; sourceTree = "<group>"; };
+ F96D3F2F08F272A7004A47F5 /* tclTimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTimer.c; sourceTree = "<group>"; };
+ F96D3F3008F272A7004A47F5 /* tclTomMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMath.h; sourceTree = "<group>"; };
+ F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTomMathInterface.c; sourceTree = "<group>"; };
+ F96D3F3208F272A7004A47F5 /* tclTrace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTrace.c; sourceTree = "<group>"; };
+ F96D3F3308F272A7004A47F5 /* tclUniData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUniData.c; sourceTree = "<group>"; };
+ F96D3F3408F272A7004A47F5 /* tclUtf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUtf.c; sourceTree = "<group>"; };
+ F96D3F3508F272A7004A47F5 /* tclUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUtil.c; sourceTree = "<group>"; };
+ F96D3F3608F272A7004A47F5 /* tclVar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclVar.c; sourceTree = "<group>"; };
+ F96D3F3708F272A7004A47F5 /* tommath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath.h; sourceTree = "<group>"; };
+ F96D3F3908F272A8004A47F5 /* auto.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = auto.tcl; sourceTree = "<group>"; };
+ F96D3F3A08F272A8004A47F5 /* clock.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clock.tcl; sourceTree = "<group>"; };
+ F96D3F3C08F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D3F8C08F272A8004A47F5 /* history.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = history.tcl; sourceTree = "<group>"; };
+ F96D3F8E08F272A8004A47F5 /* http.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = http.tcl; sourceTree = "<group>"; };
+ F96D3F8F08F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D3F9108F272A8004A47F5 /* http.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = http.tcl; sourceTree = "<group>"; };
+ F96D3F9208F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D3F9308F272A8004A47F5 /* init.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = init.tcl; sourceTree = "<group>"; };
+ F96D3F9508F272A8004A47F5 /* msgcat.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgcat.tcl; sourceTree = "<group>"; };
+ F96D3F9608F272A8004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D401808F272AA004A47F5 /* optparse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optparse.tcl; sourceTree = "<group>"; };
+ F96D401908F272AA004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D401A08F272AA004A47F5 /* package.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = package.tcl; sourceTree = "<group>"; };
+ F96D401B08F272AA004A47F5 /* parray.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parray.tcl; sourceTree = "<group>"; };
+ F96D401D08F272AA004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D401E08F272AA004A47F5 /* safe.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safe.tcl; sourceTree = "<group>"; };
+ F96D401F08F272AA004A47F5 /* tclIndex */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclIndex; sourceTree = "<group>"; };
+ F96D402108F272AA004A47F5 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F96D402208F272AA004A47F5 /* tcltest.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tcltest.tcl; sourceTree = "<group>"; };
+ F96D402308F272AA004A47F5 /* tm.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tm.tcl; sourceTree = "<group>"; };
+ F96D425B08F272B2004A47F5 /* word.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = word.tcl; sourceTree = "<group>"; };
+ F96D425F08F272B3004A47F5 /* bn.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = bn.pdf; sourceTree = "<group>"; };
+ F96D426108F272B3004A47F5 /* bn_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_error.c; sourceTree = "<group>"; };
+ F96D426208F272B3004A47F5 /* bn_fast_mp_invmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_mp_invmod.c; sourceTree = "<group>"; };
+ F96D426308F272B3004A47F5 /* bn_fast_mp_montgomery_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_mp_montgomery_reduce.c; sourceTree = "<group>"; };
+ F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_s_mp_mul_digs.c; sourceTree = "<group>"; };
+ F96D426508F272B3004A47F5 /* bn_fast_s_mp_mul_high_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_s_mp_mul_high_digs.c; sourceTree = "<group>"; };
+ F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_fast_s_mp_sqr.c; sourceTree = "<group>"; };
+ F96D426708F272B3004A47F5 /* bn_mp_2expt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_2expt.c; sourceTree = "<group>"; };
+ F96D426808F272B3004A47F5 /* bn_mp_abs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_abs.c; sourceTree = "<group>"; };
+ F96D426908F272B3004A47F5 /* bn_mp_add.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_add.c; sourceTree = "<group>"; };
+ F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_add_d.c; sourceTree = "<group>"; };
+ F96D426B08F272B3004A47F5 /* bn_mp_addmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_addmod.c; sourceTree = "<group>"; };
+ F96D426C08F272B3004A47F5 /* bn_mp_and.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_and.c; sourceTree = "<group>"; };
+ F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_clamp.c; sourceTree = "<group>"; };
+ F96D426E08F272B3004A47F5 /* bn_mp_clear.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_clear.c; sourceTree = "<group>"; };
+ F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_clear_multi.c; sourceTree = "<group>"; };
+ F96D427008F272B3004A47F5 /* bn_mp_cmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cmp.c; sourceTree = "<group>"; };
+ F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cmp_d.c; sourceTree = "<group>"; };
+ F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cmp_mag.c; sourceTree = "<group>"; };
+ F96D427308F272B3004A47F5 /* bn_mp_cnt_lsb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_cnt_lsb.c; sourceTree = "<group>"; };
+ F96D427408F272B3004A47F5 /* bn_mp_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_copy.c; sourceTree = "<group>"; };
+ F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_count_bits.c; sourceTree = "<group>"; };
+ F96D427608F272B3004A47F5 /* bn_mp_div.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div.c; sourceTree = "<group>"; };
+ F96D427708F272B3004A47F5 /* bn_mp_div_2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2.c; sourceTree = "<group>"; };
+ F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2d.c; sourceTree = "<group>"; };
+ F96D427908F272B3004A47F5 /* bn_mp_div_3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_3.c; sourceTree = "<group>"; };
+ F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_d.c; sourceTree = "<group>"; };
+ F96D427B08F272B3004A47F5 /* bn_mp_dr_is_modulus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_dr_is_modulus.c; sourceTree = "<group>"; };
+ F96D427C08F272B3004A47F5 /* bn_mp_dr_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_dr_reduce.c; sourceTree = "<group>"; };
+ F96D427D08F272B3004A47F5 /* bn_mp_dr_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_dr_setup.c; sourceTree = "<group>"; };
+ F96D427E08F272B3004A47F5 /* bn_mp_exch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exch.c; sourceTree = "<group>"; };
+ F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_expt_d.c; sourceTree = "<group>"; };
+ F96D428008F272B3004A47F5 /* bn_mp_exptmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exptmod.c; sourceTree = "<group>"; };
+ F96D428108F272B3004A47F5 /* bn_mp_exptmod_fast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exptmod_fast.c; sourceTree = "<group>"; };
+ F96D428208F272B3004A47F5 /* bn_mp_exteuclid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exteuclid.c; sourceTree = "<group>"; };
+ F96D428308F272B3004A47F5 /* bn_mp_fread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_fread.c; sourceTree = "<group>"; };
+ F96D428408F272B3004A47F5 /* bn_mp_fwrite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_fwrite.c; sourceTree = "<group>"; };
+ F96D428508F272B3004A47F5 /* bn_mp_gcd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_gcd.c; sourceTree = "<group>"; };
+ F96D428608F272B3004A47F5 /* bn_mp_get_int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_get_int.c; sourceTree = "<group>"; };
+ F96D428708F272B3004A47F5 /* bn_mp_grow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_grow.c; sourceTree = "<group>"; };
+ F96D428808F272B3004A47F5 /* bn_mp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init.c; sourceTree = "<group>"; };
+ F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_copy.c; sourceTree = "<group>"; };
+ F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_multi.c; sourceTree = "<group>"; };
+ F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_set.c; sourceTree = "<group>"; };
+ F96D428C08F272B3004A47F5 /* bn_mp_init_set_int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_set_int.c; sourceTree = "<group>"; };
+ F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_size.c; sourceTree = "<group>"; };
+ F96D428E08F272B3004A47F5 /* bn_mp_invmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_invmod.c; sourceTree = "<group>"; };
+ F96D428F08F272B3004A47F5 /* bn_mp_invmod_slow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_invmod_slow.c; sourceTree = "<group>"; };
+ F96D429008F272B3004A47F5 /* bn_mp_is_square.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_is_square.c; sourceTree = "<group>"; };
+ F96D429108F272B3004A47F5 /* bn_mp_jacobi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_jacobi.c; sourceTree = "<group>"; };
+ F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_karatsuba_mul.c; sourceTree = "<group>"; };
+ F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_karatsuba_sqr.c; sourceTree = "<group>"; };
+ F96D429408F272B3004A47F5 /* bn_mp_lcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_lcm.c; sourceTree = "<group>"; };
+ F96D429508F272B3004A47F5 /* bn_mp_lshd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_lshd.c; sourceTree = "<group>"; };
+ F96D429608F272B3004A47F5 /* bn_mp_mod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mod.c; sourceTree = "<group>"; };
+ F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mod_2d.c; sourceTree = "<group>"; };
+ F96D429808F272B3004A47F5 /* bn_mp_mod_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mod_d.c; sourceTree = "<group>"; };
+ F96D429908F272B3004A47F5 /* bn_mp_montgomery_calc_normalization.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_montgomery_calc_normalization.c; sourceTree = "<group>"; };
+ F96D429A08F272B3004A47F5 /* bn_mp_montgomery_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_montgomery_reduce.c; sourceTree = "<group>"; };
+ F96D429B08F272B3004A47F5 /* bn_mp_montgomery_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_montgomery_setup.c; sourceTree = "<group>"; };
+ F96D429C08F272B3004A47F5 /* bn_mp_mul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul.c; sourceTree = "<group>"; };
+ F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul_2.c; sourceTree = "<group>"; };
+ F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul_2d.c; sourceTree = "<group>"; };
+ F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mul_d.c; sourceTree = "<group>"; };
+ F96D42A008F272B3004A47F5 /* bn_mp_mulmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_mulmod.c; sourceTree = "<group>"; };
+ F96D42A108F272B3004A47F5 /* bn_mp_n_root.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_n_root.c; sourceTree = "<group>"; };
+ F96D42A208F272B3004A47F5 /* bn_mp_neg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_neg.c; sourceTree = "<group>"; };
+ F96D42A308F272B3004A47F5 /* bn_mp_or.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_or.c; sourceTree = "<group>"; };
+ F96D42A408F272B3004A47F5 /* bn_mp_prime_fermat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_fermat.c; sourceTree = "<group>"; };
+ F96D42A508F272B3004A47F5 /* bn_mp_prime_is_divisible.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_is_divisible.c; sourceTree = "<group>"; };
+ F96D42A608F272B3004A47F5 /* bn_mp_prime_is_prime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_is_prime.c; sourceTree = "<group>"; };
+ F96D42A708F272B3004A47F5 /* bn_mp_prime_miller_rabin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_miller_rabin.c; sourceTree = "<group>"; };
+ F96D42A808F272B3004A47F5 /* bn_mp_prime_next_prime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_next_prime.c; sourceTree = "<group>"; };
+ F96D42A908F272B3004A47F5 /* bn_mp_prime_rabin_miller_trials.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_rabin_miller_trials.c; sourceTree = "<group>"; };
+ F96D42AA08F272B3004A47F5 /* bn_mp_prime_random_ex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_prime_random_ex.c; sourceTree = "<group>"; };
+ F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_radix_size.c; sourceTree = "<group>"; };
+ F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_radix_smap.c; sourceTree = "<group>"; };
+ F96D42AD08F272B3004A47F5 /* bn_mp_rand.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_rand.c; sourceTree = "<group>"; };
+ F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_read_radix.c; sourceTree = "<group>"; };
+ F96D42AF08F272B3004A47F5 /* bn_mp_read_signed_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_read_signed_bin.c; sourceTree = "<group>"; };
+ F96D42B008F272B3004A47F5 /* bn_mp_read_unsigned_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_read_unsigned_bin.c; sourceTree = "<group>"; };
+ F96D42B108F272B3004A47F5 /* bn_mp_reduce.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce.c; sourceTree = "<group>"; };
+ F96D42B208F272B3004A47F5 /* bn_mp_reduce_2k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k.c; sourceTree = "<group>"; };
+ F96D42B308F272B3004A47F5 /* bn_mp_reduce_2k_l.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k_l.c; sourceTree = "<group>"; };
+ F96D42B408F272B3004A47F5 /* bn_mp_reduce_2k_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k_setup.c; sourceTree = "<group>"; };
+ F96D42B508F272B3004A47F5 /* bn_mp_reduce_2k_setup_l.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_2k_setup_l.c; sourceTree = "<group>"; };
+ F96D42B608F272B3004A47F5 /* bn_mp_reduce_is_2k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_is_2k.c; sourceTree = "<group>"; };
+ F96D42B708F272B3004A47F5 /* bn_mp_reduce_is_2k_l.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_is_2k_l.c; sourceTree = "<group>"; };
+ F96D42B808F272B3004A47F5 /* bn_mp_reduce_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_reduce_setup.c; sourceTree = "<group>"; };
+ F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_rshd.c; sourceTree = "<group>"; };
+ F96D42BA08F272B3004A47F5 /* bn_mp_set.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_set.c; sourceTree = "<group>"; };
+ F96D42BB08F272B3004A47F5 /* bn_mp_set_int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_set_int.c; sourceTree = "<group>"; };
+ F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_shrink.c; sourceTree = "<group>"; };
+ F96D42BD08F272B3004A47F5 /* bn_mp_signed_bin_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_signed_bin_size.c; sourceTree = "<group>"; };
+ F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sqr.c; sourceTree = "<group>"; };
+ F96D42BF08F272B3004A47F5 /* bn_mp_sqrmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sqrmod.c; sourceTree = "<group>"; };
+ F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sqrt.c; sourceTree = "<group>"; };
+ F96D42C108F272B3004A47F5 /* bn_mp_sub.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sub.c; sourceTree = "<group>"; };
+ F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_sub_d.c; sourceTree = "<group>"; };
+ F96D42C308F272B3004A47F5 /* bn_mp_submod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_submod.c; sourceTree = "<group>"; };
+ F96D42C408F272B3004A47F5 /* bn_mp_to_signed_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_signed_bin.c; sourceTree = "<group>"; };
+ F96D42C508F272B3004A47F5 /* bn_mp_to_signed_bin_n.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_signed_bin_n.c; sourceTree = "<group>"; };
+ F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_unsigned_bin.c; sourceTree = "<group>"; };
+ F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_to_unsigned_bin_n.c; sourceTree = "<group>"; };
+ F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toom_mul.c; sourceTree = "<group>"; };
+ F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toom_sqr.c; sourceTree = "<group>"; };
+ F96D42CA08F272B3004A47F5 /* bn_mp_toradix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toradix.c; sourceTree = "<group>"; };
+ F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_toradix_n.c; sourceTree = "<group>"; };
+ F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_unsigned_bin_size.c; sourceTree = "<group>"; };
+ F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_xor.c; sourceTree = "<group>"; };
+ F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_zero.c; sourceTree = "<group>"; };
+ F96D42CF08F272B3004A47F5 /* bn_prime_tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_prime_tab.c; sourceTree = "<group>"; };
+ F96D42D008F272B3004A47F5 /* bn_reverse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_reverse.c; sourceTree = "<group>"; };
+ F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_add.c; sourceTree = "<group>"; };
+ F96D42D208F272B3004A47F5 /* bn_s_mp_exptmod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_exptmod.c; sourceTree = "<group>"; };
+ F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_mul_digs.c; sourceTree = "<group>"; };
+ F96D42D408F272B3004A47F5 /* bn_s_mp_mul_high_digs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_mul_high_digs.c; sourceTree = "<group>"; };
+ F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_sqr.c; sourceTree = "<group>"; };
+ F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_sub.c; sourceTree = "<group>"; };
+ F96D42D708F272B3004A47F5 /* bncore.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bncore.c; sourceTree = "<group>"; };
+ F96D42D908F272B3004A47F5 /* callgraph.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = callgraph.txt; sourceTree = "<group>"; };
+ F96D42DA08F272B3004A47F5 /* changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = changes.txt; sourceTree = "<group>"; };
+ F96D42F008F272B3004A47F5 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
+ F96D431D08F272B4004A47F5 /* poster.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = poster.pdf; sourceTree = "<group>"; };
+ F96D432608F272B4004A47F5 /* tommath.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = tommath.pdf; sourceTree = "<group>"; };
+ F96D432908F272B4004A47F5 /* tommath_class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath_class.h; sourceTree = "<group>"; };
+ F96D432A08F272B4004A47F5 /* tommath_superclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath_superclass.h; sourceTree = "<group>"; };
+ F96D432B08F272B4004A47F5 /* license.terms */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = license.terms; sourceTree = "<group>"; };
+ F96D432E08F272B5004A47F5 /* configure.ac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure.ac; sourceTree = "<group>"; };
+ F96D432F08F272B5004A47F5 /* GNUmakefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = GNUmakefile; sourceTree = "<group>"; };
+ F96D433108F272B5004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D433208F272B5004A47F5 /* Tcl-Info.plist.in */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = "Tcl-Info.plist.in"; sourceTree = "<group>"; };
+ F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMacOSXBundle.c; sourceTree = "<group>"; };
+ F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMacOSXFCmd.c; sourceTree = "<group>"; };
+ F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMacOSXNotify.c; sourceTree = "<group>"; };
+ F96D434308F272B5004A47F5 /* README */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = README; sourceTree = "<group>"; };
+ F96D434508F272B5004A47F5 /* all.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = all.tcl; sourceTree = "<group>"; };
+ F96D434608F272B5004A47F5 /* append.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = append.test; sourceTree = "<group>"; };
+ F96D434708F272B5004A47F5 /* appendComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = appendComp.test; sourceTree = "<group>"; };
+ F96D434808F272B5004A47F5 /* assocd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = assocd.test; sourceTree = "<group>"; };
+ F96D434908F272B5004A47F5 /* async.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = async.test; sourceTree = "<group>"; };
+ F96D434A08F272B5004A47F5 /* autoMkindex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = autoMkindex.test; sourceTree = "<group>"; };
+ F96D434B08F272B5004A47F5 /* basic.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = basic.test; sourceTree = "<group>"; };
+ F96D434C08F272B5004A47F5 /* binary.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = binary.test; sourceTree = "<group>"; };
+ F96D434D08F272B5004A47F5 /* case.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = case.test; sourceTree = "<group>"; };
+ F96D434E08F272B5004A47F5 /* chan.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chan.test; sourceTree = "<group>"; };
+ F96D434F08F272B5004A47F5 /* clock.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = clock.test; sourceTree = "<group>"; };
+ F96D435008F272B5004A47F5 /* cmdAH.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdAH.test; sourceTree = "<group>"; };
+ F96D435108F272B5004A47F5 /* cmdIL.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdIL.test; sourceTree = "<group>"; };
+ F96D435208F272B5004A47F5 /* cmdInfo.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdInfo.test; sourceTree = "<group>"; };
+ F96D435308F272B5004A47F5 /* cmdMZ.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cmdMZ.test; sourceTree = "<group>"; };
+ F96D435408F272B5004A47F5 /* compExpr-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "compExpr-old.test"; sourceTree = "<group>"; };
+ F96D435508F272B5004A47F5 /* compExpr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = compExpr.test; sourceTree = "<group>"; };
+ F96D435608F272B5004A47F5 /* compile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = compile.test; sourceTree = "<group>"; };
+ F96D435708F272B5004A47F5 /* concat.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = concat.test; sourceTree = "<group>"; };
+ F96D435808F272B5004A47F5 /* config.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = config.test; sourceTree = "<group>"; };
+ F96D435908F272B5004A47F5 /* dcall.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dcall.test; sourceTree = "<group>"; };
+ F96D435A08F272B5004A47F5 /* dict.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dict.test; sourceTree = "<group>"; };
+ F96D435C08F272B5004A47F5 /* dstring.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dstring.test; sourceTree = "<group>"; };
+ F96D435E08F272B5004A47F5 /* encoding.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = encoding.test; sourceTree = "<group>"; };
+ F96D435F08F272B5004A47F5 /* env.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = env.test; sourceTree = "<group>"; };
+ F96D436008F272B5004A47F5 /* error.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = error.test; sourceTree = "<group>"; };
+ F96D436108F272B5004A47F5 /* eval.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eval.test; sourceTree = "<group>"; };
+ F96D436208F272B5004A47F5 /* event.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = event.test; sourceTree = "<group>"; };
+ F96D436308F272B5004A47F5 /* exec.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = exec.test; sourceTree = "<group>"; };
+ F96D436408F272B5004A47F5 /* execute.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = execute.test; sourceTree = "<group>"; };
+ F96D436508F272B5004A47F5 /* expr-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "expr-old.test"; sourceTree = "<group>"; };
+ F96D436608F272B5004A47F5 /* expr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = expr.test; sourceTree = "<group>"; };
+ F96D436708F272B6004A47F5 /* fCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fCmd.test; sourceTree = "<group>"; };
+ F96D436808F272B6004A47F5 /* fileName.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fileName.test; sourceTree = "<group>"; };
+ F96D436908F272B6004A47F5 /* fileSystem.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fileSystem.test; sourceTree = "<group>"; };
+ F96D436A08F272B6004A47F5 /* for-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "for-old.test"; sourceTree = "<group>"; };
+ F96D436B08F272B6004A47F5 /* for.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = for.test; sourceTree = "<group>"; };
+ F96D436C08F272B6004A47F5 /* foreach.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = foreach.test; sourceTree = "<group>"; };
+ F96D436D08F272B6004A47F5 /* format.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = format.test; sourceTree = "<group>"; };
+ F96D436E08F272B6004A47F5 /* get.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = get.test; sourceTree = "<group>"; };
+ F96D436F08F272B6004A47F5 /* history.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = history.test; sourceTree = "<group>"; };
+ F96D437008F272B6004A47F5 /* http.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = http.test; sourceTree = "<group>"; };
+ F96D437108F272B6004A47F5 /* httpd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = httpd; sourceTree = "<group>"; };
+ F96D437208F272B6004A47F5 /* httpold.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = httpold.test; sourceTree = "<group>"; };
+ F96D437308F272B6004A47F5 /* if-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "if-old.test"; sourceTree = "<group>"; };
+ F96D437408F272B6004A47F5 /* if.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = if.test; sourceTree = "<group>"; };
+ F96D437508F272B6004A47F5 /* incr-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "incr-old.test"; sourceTree = "<group>"; };
+ F96D437608F272B6004A47F5 /* incr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = incr.test; sourceTree = "<group>"; };
+ F96D437708F272B6004A47F5 /* indexObj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = indexObj.test; sourceTree = "<group>"; };
+ F96D437808F272B6004A47F5 /* info.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = info.test; sourceTree = "<group>"; };
+ F96D437908F272B6004A47F5 /* init.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = init.test; sourceTree = "<group>"; };
+ F96D437A08F272B6004A47F5 /* interp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = interp.test; sourceTree = "<group>"; };
+ F96D437B08F272B6004A47F5 /* io.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = io.test; sourceTree = "<group>"; };
+ F96D437C08F272B6004A47F5 /* ioCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioCmd.test; sourceTree = "<group>"; };
+ F96D437D08F272B6004A47F5 /* iogt.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = iogt.test; sourceTree = "<group>"; };
+ F96D437E08F272B6004A47F5 /* ioUtil.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioUtil.test; sourceTree = "<group>"; };
+ F96D437F08F272B6004A47F5 /* join.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = join.test; sourceTree = "<group>"; };
+ F96D438008F272B6004A47F5 /* lindex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lindex.test; sourceTree = "<group>"; };
+ F96D438108F272B6004A47F5 /* link.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = link.test; sourceTree = "<group>"; };
+ F96D438208F272B6004A47F5 /* linsert.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = linsert.test; sourceTree = "<group>"; };
+ F96D438308F272B6004A47F5 /* list.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = list.test; sourceTree = "<group>"; };
+ F96D438408F272B6004A47F5 /* listObj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listObj.test; sourceTree = "<group>"; };
+ F96D438508F272B6004A47F5 /* llength.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = llength.test; sourceTree = "<group>"; };
+ F96D438608F272B6004A47F5 /* load.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = load.test; sourceTree = "<group>"; };
+ F96D438708F272B6004A47F5 /* lrange.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lrange.test; sourceTree = "<group>"; };
+ F96D438808F272B6004A47F5 /* lrepeat.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lrepeat.test; sourceTree = "<group>"; };
+ F96D438908F272B6004A47F5 /* lreplace.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lreplace.test; sourceTree = "<group>"; };
+ F96D438A08F272B6004A47F5 /* lsearch.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lsearch.test; sourceTree = "<group>"; };
+ F96D438B08F272B6004A47F5 /* lset.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lset.test; sourceTree = "<group>"; };
+ F96D438C08F272B6004A47F5 /* lsetComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lsetComp.test; sourceTree = "<group>"; };
+ F96D438D08F272B6004A47F5 /* macOSXFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXFCmd.test; sourceTree = "<group>"; };
+ F96D438E08F272B6004A47F5 /* main.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = main.test; sourceTree = "<group>"; };
+ F96D438F08F272B6004A47F5 /* misc.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = misc.test; sourceTree = "<group>"; };
+ F96D439008F272B6004A47F5 /* msgcat.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgcat.test; sourceTree = "<group>"; };
+ F96D439108F272B6004A47F5 /* namespace-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "namespace-old.test"; sourceTree = "<group>"; };
+ F96D439208F272B7004A47F5 /* namespace.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = namespace.test; sourceTree = "<group>"; };
+ F96D439308F272B7004A47F5 /* notify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notify.test; sourceTree = "<group>"; };
+ F96D439408F272B7004A47F5 /* obj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obj.test; sourceTree = "<group>"; };
+ F96D439508F272B7004A47F5 /* opt.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = opt.test; sourceTree = "<group>"; };
+ F96D439608F272B7004A47F5 /* package.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = package.test; sourceTree = "<group>"; };
+ F96D439708F272B7004A47F5 /* parse.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parse.test; sourceTree = "<group>"; };
+ F96D439808F272B7004A47F5 /* parseExpr.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parseExpr.test; sourceTree = "<group>"; };
+ F96D439908F272B7004A47F5 /* parseOld.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = parseOld.test; sourceTree = "<group>"; };
+ F96D439A08F272B7004A47F5 /* pid.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pid.test; sourceTree = "<group>"; };
+ F96D439B08F272B7004A47F5 /* pkg.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkg.test; sourceTree = "<group>"; };
+ F96D439C08F272B7004A47F5 /* pkgMkIndex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgMkIndex.test; sourceTree = "<group>"; };
+ F96D439D08F272B7004A47F5 /* platform.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.test; sourceTree = "<group>"; };
+ F96D439E08F272B7004A47F5 /* proc-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "proc-old.test"; sourceTree = "<group>"; };
+ F96D439F08F272B7004A47F5 /* proc.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = proc.test; sourceTree = "<group>"; };
+ F96D43A008F272B7004A47F5 /* pwd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pwd.test; sourceTree = "<group>"; };
+ F96D43A108F272B7004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D43A208F272B7004A47F5 /* reg.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = reg.test; sourceTree = "<group>"; };
+ F96D43A308F272B7004A47F5 /* regexp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = regexp.test; sourceTree = "<group>"; };
+ F96D43A408F272B7004A47F5 /* regexpComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = regexpComp.test; sourceTree = "<group>"; };
+ F96D43A508F272B7004A47F5 /* registry.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = registry.test; sourceTree = "<group>"; };
+ F96D43A608F272B7004A47F5 /* remote.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = remote.tcl; sourceTree = "<group>"; };
+ F96D43A708F272B7004A47F5 /* rename.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = rename.test; sourceTree = "<group>"; };
+ F96D43A808F272B7004A47F5 /* result.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = result.test; sourceTree = "<group>"; };
+ F96D43A908F272B7004A47F5 /* safe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safe.test; sourceTree = "<group>"; };
+ F96D43AA08F272B7004A47F5 /* scan.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scan.test; sourceTree = "<group>"; };
+ F96D43AB08F272B7004A47F5 /* security.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = security.test; sourceTree = "<group>"; };
+ F96D43AC08F272B7004A47F5 /* set-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "set-old.test"; sourceTree = "<group>"; };
+ F96D43AD08F272B7004A47F5 /* set.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = set.test; sourceTree = "<group>"; };
+ F96D43AE08F272B7004A47F5 /* socket.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = socket.test; sourceTree = "<group>"; };
+ F96D43AF08F272B7004A47F5 /* source.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = source.test; sourceTree = "<group>"; };
+ F96D43B008F272B7004A47F5 /* split.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = split.test; sourceTree = "<group>"; };
+ F96D43B108F272B7004A47F5 /* stack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = stack.test; sourceTree = "<group>"; };
+ F96D43B208F272B7004A47F5 /* string.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = string.test; sourceTree = "<group>"; };
+ F96D43B308F272B7004A47F5 /* stringComp.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = stringComp.test; sourceTree = "<group>"; };
+ F96D43B408F272B7004A47F5 /* stringObj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = stringObj.test; sourceTree = "<group>"; };
+ F96D43B508F272B7004A47F5 /* subst.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = subst.test; sourceTree = "<group>"; };
+ F96D43B608F272B7004A47F5 /* switch.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = switch.test; sourceTree = "<group>"; };
+ F96D43B708F272B7004A47F5 /* tcltest.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tcltest.test; sourceTree = "<group>"; };
+ F96D43B808F272B7004A47F5 /* thread.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = thread.test; sourceTree = "<group>"; };
+ F96D43B908F272B7004A47F5 /* timer.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = timer.test; sourceTree = "<group>"; };
+ F96D43BA08F272B7004A47F5 /* tm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tm.test; sourceTree = "<group>"; };
+ F96D43BB08F272B7004A47F5 /* trace.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = trace.test; sourceTree = "<group>"; };
+ F96D43BC08F272B7004A47F5 /* unixFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixFCmd.test; sourceTree = "<group>"; };
+ F96D43BD08F272B7004A47F5 /* unixFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixFile.test; sourceTree = "<group>"; };
+ F96D43BE08F272B7004A47F5 /* unixInit.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixInit.test; sourceTree = "<group>"; };
+ F96D43BF08F272B7004A47F5 /* unixNotfy.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unixNotfy.test; sourceTree = "<group>"; };
+ F96D43C008F272B7004A47F5 /* unknown.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unknown.test; sourceTree = "<group>"; };
+ F96D43C108F272B7004A47F5 /* unload.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = unload.test; sourceTree = "<group>"; };
+ F96D43C208F272B7004A47F5 /* uplevel.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uplevel.test; sourceTree = "<group>"; };
+ F96D43C308F272B7004A47F5 /* upvar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = upvar.test; sourceTree = "<group>"; };
+ F96D43C408F272B7004A47F5 /* utf.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = utf.test; sourceTree = "<group>"; };
+ F96D43C508F272B7004A47F5 /* util.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = util.test; sourceTree = "<group>"; };
+ F96D43C608F272B7004A47F5 /* var.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = var.test; sourceTree = "<group>"; };
+ F96D43C708F272B7004A47F5 /* while-old.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "while-old.test"; sourceTree = "<group>"; };
+ F96D43C808F272B7004A47F5 /* while.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = while.test; sourceTree = "<group>"; };
+ F96D43C908F272B7004A47F5 /* winConsole.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winConsole.test; sourceTree = "<group>"; };
+ F96D43CA08F272B7004A47F5 /* winDde.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winDde.test; sourceTree = "<group>"; };
+ F96D43CB08F272B7004A47F5 /* winFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFCmd.test; sourceTree = "<group>"; };
+ F96D43CC08F272B7004A47F5 /* winFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFile.test; sourceTree = "<group>"; };
+ F96D43CD08F272B7004A47F5 /* winNotify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winNotify.test; sourceTree = "<group>"; };
+ F96D43CE08F272B7004A47F5 /* winPipe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winPipe.test; sourceTree = "<group>"; };
+ F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; };
+ F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; };
+ F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F96D43D308F272B8004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D442208F272B8004A47F5 /* eolFix.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eolFix.tcl; sourceTree = "<group>"; };
+ F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fix_tommath_h.tcl; sourceTree = "<group>"; };
+ F96D442508F272B8004A47F5 /* genStubs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = genStubs.tcl; sourceTree = "<group>"; };
+ F96D442708F272B8004A47F5 /* index.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = index.tcl; sourceTree = "<group>"; };
+ F96D442808F272B8004A47F5 /* installData.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = installData.tcl; sourceTree = "<group>"; };
+ F96D442908F272B8004A47F5 /* loadICU.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = loadICU.tcl; sourceTree = "<group>"; };
+ F96D442A08F272B8004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D442B08F272B8004A47F5 /* makeTestCases.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = makeTestCases.tcl; sourceTree = "<group>"; };
+ F96D442C08F272B8004A47F5 /* man2help.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2help.tcl; sourceTree = "<group>"; };
+ F96D442D08F272B8004A47F5 /* man2help2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2help2.tcl; sourceTree = "<group>"; };
+ F96D442E08F272B8004A47F5 /* man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2html.tcl; sourceTree = "<group>"; };
+ F96D442F08F272B8004A47F5 /* man2html1.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2html1.tcl; sourceTree = "<group>"; };
+ F96D443008F272B8004A47F5 /* man2html2.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = man2html2.tcl; sourceTree = "<group>"; };
+ F96D443108F272B8004A47F5 /* man2tcl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = man2tcl.c; sourceTree = "<group>"; };
+ F96D443208F272B8004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D443308F272B8004A47F5 /* regexpTestLib.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = regexpTestLib.tcl; sourceTree = "<group>"; };
+ F96D443408F272B8004A47F5 /* str2c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = str2c; sourceTree = "<group>"; };
+ F96D443508F272B8004A47F5 /* tcl.hpj.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.hpj.in; sourceTree = "<group>"; };
+ F96D443608F272B8004A47F5 /* tcl.wse.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.wse.in; sourceTree = "<group>"; };
+ F96D443708F272B9004A47F5 /* tclmin.wse */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tclmin.wse; sourceTree = "<group>"; };
+ F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "tcltk-man2html.tcl"; sourceTree = "<group>"; };
+ F96D443A08F272B9004A47F5 /* tclZIC.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclZIC.tcl; sourceTree = "<group>"; };
+ F96D443B08F272B9004A47F5 /* uniClass.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniClass.tcl; sourceTree = "<group>"; };
+ F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; };
+ F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F96D444208F272B9004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D444408F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D444508F272B9004A47F5 /* pkga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkga.c; sourceTree = "<group>"; };
+ F96D444608F272B9004A47F5 /* pkgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgb.c; sourceTree = "<group>"; };
+ F96D444708F272B9004A47F5 /* pkgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgc.c; sourceTree = "<group>"; };
+ F96D444808F272B9004A47F5 /* pkgd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgd.c; sourceTree = "<group>"; };
+ F96D444908F272B9004A47F5 /* pkge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkge.c; sourceTree = "<group>"; };
+ F96D444B08F272B9004A47F5 /* pkgua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgua.c; sourceTree = "<group>"; };
+ F96D444C08F272B9004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D444D08F272B9004A47F5 /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; };
+ F96D444E08F272B9004A47F5 /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; };
+ F96D444F08F272B9004A47F5 /* ldAix */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ldAix; sourceTree = "<group>"; };
+ F96D445008F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D445208F272B9004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D445308F272B9004A47F5 /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F96D445408F272B9004A47F5 /* tcl.spec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.spec; sourceTree = "<group>"; };
+ F96D445508F272B9004A47F5 /* tclAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAppInit.c; sourceTree = "<group>"; };
+ F96D445608F272B9004A47F5 /* tclConfig.h.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = tclConfig.h.in; sourceTree = "<group>"; };
+ F96D445708F272B9004A47F5 /* tclConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tclConfig.sh.in; sourceTree = "<group>"; };
+ F96D445808F272B9004A47F5 /* tclLoadAix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadAix.c; sourceTree = "<group>"; };
+ F96D445908F272B9004A47F5 /* tclLoadDl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadDl.c; sourceTree = "<group>"; };
+ F96D445B08F272B9004A47F5 /* tclLoadDyld.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadDyld.c; sourceTree = "<group>"; };
+ F96D445C08F272B9004A47F5 /* tclLoadNext.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadNext.c; sourceTree = "<group>"; };
+ F96D445D08F272B9004A47F5 /* tclLoadOSF.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadOSF.c; sourceTree = "<group>"; };
+ F96D445E08F272B9004A47F5 /* tclLoadShl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclLoadShl.c; sourceTree = "<group>"; };
+ F96D445F08F272B9004A47F5 /* tclUnixChan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixChan.c; sourceTree = "<group>"; };
+ F96D446008F272B9004A47F5 /* tclUnixEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixEvent.c; sourceTree = "<group>"; };
+ F96D446108F272B9004A47F5 /* tclUnixFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixFCmd.c; sourceTree = "<group>"; };
+ F96D446208F272B9004A47F5 /* tclUnixFile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixFile.c; sourceTree = "<group>"; };
+ F96D446308F272B9004A47F5 /* tclUnixInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixInit.c; sourceTree = "<group>"; };
+ F96D446408F272B9004A47F5 /* tclUnixNotfy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixNotfy.c; sourceTree = "<group>"; };
+ F96D446508F272B9004A47F5 /* tclUnixPipe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixPipe.c; sourceTree = "<group>"; };
+ F96D446608F272B9004A47F5 /* tclUnixPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixPort.h; sourceTree = "<group>"; };
+ F96D446708F272B9004A47F5 /* tclUnixSock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixSock.c; sourceTree = "<group>"; };
+ F96D446808F272B9004A47F5 /* tclUnixTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTest.c; sourceTree = "<group>"; };
+ F96D446908F272B9004A47F5 /* tclUnixThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixThrd.c; sourceTree = "<group>"; };
+ F96D446A08F272B9004A47F5 /* tclUnixThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixThrd.h; sourceTree = "<group>"; };
+ F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; };
+ F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; };
+ F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; };
+ F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; };
+ F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; };
+ F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; };
+ F96D447308F272BA004A47F5 /* coffbase.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = coffbase.txt; sourceTree = "<group>"; };
+ F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; };
+ F96D447508F272BA004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; };
+ F96D447608F272BA004A47F5 /* makefile.bc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.bc; sourceTree = "<group>"; };
+ F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
+ F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
+ F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
+ F96D447A08F272BA004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F96D447C08F272BA004A47F5 /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
+ F96D447D08F272BA004A47F5 /* stub16.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stub16.c; sourceTree = "<group>"; };
+ F96D447E08F272BA004A47F5 /* tcl.dsp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.dsp; sourceTree = "<group>"; };
+ F96D447F08F272BA004A47F5 /* tcl.dsw */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.dsw; sourceTree = "<group>"; };
+ F96D448008F272BA004A47F5 /* tcl.hpj.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.hpj.in; sourceTree = "<group>"; };
+ F96D448108F272BA004A47F5 /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
+ F96D448208F272BA004A47F5 /* tcl.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.rc; sourceTree = "<group>"; };
+ F96D448308F272BA004A47F5 /* tclAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclAppInit.c; sourceTree = "<group>"; };
+ F96D448408F272BA004A47F5 /* tclConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tclConfig.sh.in; sourceTree = "<group>"; };
+ F96D448608F272BA004A47F5 /* tclsh.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tclsh.rc; sourceTree = "<group>"; };
+ F96D448708F272BA004A47F5 /* tclWin32Dll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWin32Dll.c; sourceTree = "<group>"; };
+ F96D448808F272BA004A47F5 /* tclWinChan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinChan.c; sourceTree = "<group>"; };
+ F96D448908F272BA004A47F5 /* tclWinConsole.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinConsole.c; sourceTree = "<group>"; };
+ F96D448A08F272BA004A47F5 /* tclWinDde.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinDde.c; sourceTree = "<group>"; };
+ F96D448B08F272BA004A47F5 /* tclWinError.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinError.c; sourceTree = "<group>"; };
+ F96D448C08F272BA004A47F5 /* tclWinFCmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinFCmd.c; sourceTree = "<group>"; };
+ F96D448D08F272BA004A47F5 /* tclWinFile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinFile.c; sourceTree = "<group>"; };
+ F96D448E08F272BA004A47F5 /* tclWinInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinInit.c; sourceTree = "<group>"; };
+ F96D448F08F272BA004A47F5 /* tclWinInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinInt.h; sourceTree = "<group>"; };
+ F96D449008F272BA004A47F5 /* tclWinLoad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinLoad.c; sourceTree = "<group>"; };
+ F96D449108F272BA004A47F5 /* tclWinNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinNotify.c; sourceTree = "<group>"; };
+ F96D449208F272BA004A47F5 /* tclWinPipe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinPipe.c; sourceTree = "<group>"; };
+ F96D449308F272BA004A47F5 /* tclWinPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinPort.h; sourceTree = "<group>"; };
+ F96D449408F272BA004A47F5 /* tclWinReg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinReg.c; sourceTree = "<group>"; };
+ F96D449508F272BA004A47F5 /* tclWinSerial.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinSerial.c; sourceTree = "<group>"; };
+ F96D449608F272BA004A47F5 /* tclWinSock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinSock.c; sourceTree = "<group>"; };
+ F96D449708F272BA004A47F5 /* tclWinTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTest.c; sourceTree = "<group>"; };
+ F96D449808F272BA004A47F5 /* tclWinThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinThrd.c; sourceTree = "<group>"; };
+ F96D449908F272BA004A47F5 /* tclWinThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinThrd.h; sourceTree = "<group>"; };
+ F96D449A08F272BA004A47F5 /* tclWinTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTime.c; sourceTree = "<group>"; };
+ F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPrivate.h; sourceTree = "<group>"; };
+ F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Common.xcconfig"; sourceTree = "<group>"; };
+ F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Release.xcconfig"; sourceTree = "<group>"; };
+ F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Debug.xcconfig"; sourceTree = "<group>"; };
+ F9903CAF094FAADA004613E9 /* tclTomMath.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclTomMath.decls; sourceTree = "<group>"; };
+ F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMathDecls.h; sourceTree = "<group>"; };
+ F9A3082D08F2D4AB00BAE1AB /* Tk.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9A3084B08F2D4CE00BAE1AB /* Wish.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wish.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9A3084E08F2D4F400BAE1AB /* Tcl.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tcl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9A493240CEBF38300B78AE2 /* chanio.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chanio.test; sourceTree = "<group>"; };
+ F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mclist.tcl; sourceTree = "<group>"; };
+ F9ECB1120B26521500A28025 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
+ F9ECB1130B26521500A28025 /* platform.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.tcl; sourceTree = "<group>"; };
+ F9ECB1140B26521500A28025 /* shell.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = shell.tcl; sourceTree = "<group>"; };
+ F9ECB1CA0B2652D300A28025 /* apply.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = apply.test; sourceTree = "<group>"; };
+ F9ECB1CB0B26534C00A28025 /* mathop.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mathop.test; sourceTree = "<group>"; };
+ F9ECB1E10B26543C00A28025 /* platform_shell.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = platform_shell.n; sourceTree = "<group>"; };
+ F9ECB1E20B26543C00A28025 /* platform.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = platform.n; sourceTree = "<group>"; };
+ F9F4415D0C8BAE6F00BCCD67 /* tclDTrace.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = tclDTrace.d; sourceTree = "<group>"; };
+ F9F4EFDC0CC7B3CA00378A27 /* ttkpane.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; languageSpecificationIdentifier = shell; path = ttkpane.tcl; sourceTree = "<group>"; };
+ F9F4EFDD0CC7B3CB00378A27 /* ttkmenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; languageSpecificationIdentifier = shell; path = ttkmenu.tcl; sourceTree = "<group>"; };
+ F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixCompat.c; sourceTree = "<group>"; };
+ F9FD31F40CC1AD070073837D /* tktest-X11 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "tktest-X11"; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9FD32140CC1AF170073837D /* libX11.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libX11.dylib; path = /usr/X11R6/lib/libX11.dylib; sourceTree = "<absolute>"; };
+ F9FD32150CC1AF170073837D /* libXext.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXext.dylib; path = /usr/X11R6/lib/libXext.dylib; sourceTree = "<absolute>"; };
+ F9FD32160CC1AF170073837D /* libXss.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXss.dylib; path = /usr/X11R6/lib/libXss.dylib; sourceTree = "<absolute>"; };
+ F9FD34990CC1BB0D0073837D /* libfreetype.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfreetype.dylib; path = /usr/X11R6/lib/libfreetype.dylib; sourceTree = "<absolute>"; };
+ F9FD349A0CC1BB0D0073837D /* libXft.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXft.dylib; path = /usr/X11R6/lib/libXft.dylib; sourceTree = "<absolute>"; };
+ F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfontconfig.dylib; path = /usr/X11R6/lib/libfontconfig.dylib; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8DD76FAD0486AB0100D96B5E /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */,
+ F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */,
+ F966C07908F28233005CB29B /* IOKit.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F9FD31E30CC1AD070073837D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */,
+ F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */,
+ F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */,
+ F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */,
+ F9FD349C0CC1BB0D0073837D /* libXft.dylib in Frameworks */,
+ F9FD349B0CC1BB0D0073837D /* libfreetype.dylib in Frameworks */,
+ F9FD34C40CC1BBD70073837D /* libfontconfig.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 08FB7794FE84155DC02AAC07 /* Wish */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3DF708F271BE004A47F5 /* Tk Sources */,
+ F96D3DF608F27169004A47F5 /* Tcl Sources */,
+ F966C06F08F281DC005CB29B /* Frameworks */,
+ 1AB674ADFE9D54B511CA2CBB /* Products */,
+ );
+ 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";
+ name = Wish;
+ path = .;
+ sourceTree = SOURCE_ROOT;
+ };
+ 1AB674ADFE9D54B511CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ F9A3084B08F2D4CE00BAE1AB /* Wish.app */,
+ F9A3082D08F2D4AB00BAE1AB /* Tk.framework */,
+ F9A3084E08F2D4F400BAE1AB /* Tcl.framework */,
+ 8DD76FB20486AB0100D96B5E /* tktest */,
+ F9FD31F40CC1AD070073837D /* tktest-X11 */,
+ );
+ includeInIndex = 0;
+ name = Products;
+ sourceTree = "<group>";
+ };
+ F966BA0308F27A37005CB29B /* bitmaps */ = {
+ isa = PBXGroup;
+ children = (
+ F966BA0408F27A37005CB29B /* error.xbm */,
+ F966BA0508F27A37005CB29B /* gray12.xbm */,
+ F966BA0608F27A37005CB29B /* gray25.xbm */,
+ F966BA0708F27A37005CB29B /* gray50.xbm */,
+ F966BA0808F27A37005CB29B /* gray75.xbm */,
+ F966BA0908F27A37005CB29B /* hourglass.xbm */,
+ F966BA0A08F27A37005CB29B /* info.xbm */,
+ F966BA0B08F27A37005CB29B /* questhead.xbm */,
+ F966BA0C08F27A37005CB29B /* question.xbm */,
+ F966BA0D08F27A37005CB29B /* warning.xbm */,
+ );
+ path = bitmaps;
+ sourceTree = "<group>";
+ };
+ F966BA1008F27A37005CB29B /* doc */ = {
+ isa = PBXGroup;
+ children = (
+ F966BA1108F27A37005CB29B /* 3DBorder.3 */,
+ F966BA1208F27A37005CB29B /* AddOption.3 */,
+ F966BA1308F27A37005CB29B /* bell.n */,
+ F966BA1408F27A37005CB29B /* bind.n */,
+ F966BA1508F27A37005CB29B /* BindTable.3 */,
+ F966BA1608F27A37005CB29B /* bindtags.n */,
+ F966BA1708F27A37005CB29B /* bitmap.n */,
+ F966BA1808F27A37005CB29B /* button.n */,
+ F966BA1908F27A37005CB29B /* canvas.n */,
+ F966BA1A08F27A37005CB29B /* CanvPsY.3 */,
+ F966BA1B08F27A37005CB29B /* CanvTkwin.3 */,
+ F966BA1C08F27A37005CB29B /* CanvTxtInfo.3 */,
+ F966BA1D08F27A37005CB29B /* checkbutton.n */,
+ F966BA1E08F27A37005CB29B /* chooseColor.n */,
+ F966BA1F08F27A37005CB29B /* chooseDirectory.n */,
+ F966BA2008F27A37005CB29B /* Clipboard.3 */,
+ F966BA2108F27A37005CB29B /* clipboard.n */,
+ F966BA2208F27A37005CB29B /* ClrSelect.3 */,
+ F966BA2308F27A37005CB29B /* colors.n */,
+ F966BA2408F27A37005CB29B /* ConfigWidg.3 */,
+ F966BA2508F27A37005CB29B /* ConfigWind.3 */,
+ F966BA2608F27A37005CB29B /* console.n */,
+ F966BA2708F27A37005CB29B /* CoordToWin.3 */,
+ F966BA2808F27A37005CB29B /* CrtCmHdlr.3 */,
+ F966BA2908F27A37005CB29B /* CrtErrHdlr.3 */,
+ F966BA2A08F27A37005CB29B /* CrtGenHdlr.3 */,
+ F966BA2B08F27A37005CB29B /* CrtImgType.3 */,
+ F966BA2C08F27A37005CB29B /* CrtItemType.3 */,
+ F966BA2D08F27A37005CB29B /* CrtPhImgFmt.3 */,
+ F966BA2E08F27A37005CB29B /* CrtSelHdlr.3 */,
+ F966BA2F08F27A37005CB29B /* CrtWindow.3 */,
+ F966BA3008F27A37005CB29B /* cursors.n */,
+ F966BA3108F27A37005CB29B /* DeleteImg.3 */,
+ F966BA3208F27A37005CB29B /* destroy.n */,
+ F966BA3308F27A37005CB29B /* dialog.n */,
+ F966BA3408F27A37005CB29B /* DrawFocHlt.3 */,
+ F966BA3508F27A37005CB29B /* entry.n */,
+ F966BA3608F27A37005CB29B /* event.n */,
+ F966BA3708F27A37005CB29B /* EventHndlr.3 */,
+ F966BA3808F27A37005CB29B /* FindPhoto.3 */,
+ F966BA3908F27A37005CB29B /* focus.n */,
+ F966BA3A08F27A37005CB29B /* focusNext.n */,
+ F966BA3B08F27A37005CB29B /* font.n */,
+ F966BA3C08F27A37005CB29B /* FontId.3 */,
+ F966BA3D08F27A37005CB29B /* frame.n */,
+ F966BA3E08F27A37005CB29B /* FreeXId.3 */,
+ F966BA3F08F27A37005CB29B /* GeomReq.3 */,
+ F966BA4008F27A37005CB29B /* GetAnchor.3 */,
+ F966BA4108F27A37005CB29B /* GetBitmap.3 */,
+ F966BA4208F27A37005CB29B /* GetCapStyl.3 */,
+ F966BA4308F27A37005CB29B /* GetClrmap.3 */,
+ F966BA4408F27A37005CB29B /* GetColor.3 */,
+ F966BA4508F27A37005CB29B /* GetCursor.3 */,
+ F966BA4608F27A37005CB29B /* GetDash.3 */,
+ F966BA4708F27A37005CB29B /* GetFont.3 */,
+ F966BA4808F27A37005CB29B /* GetGC.3 */,
+ F966BA4908F27A37005CB29B /* GetHINSTANCE.3 */,
+ F966BA4A08F27A37005CB29B /* GetHWND.3 */,
+ F966BA4B08F27A37005CB29B /* GetImage.3 */,
+ F966BA4C08F27A37005CB29B /* GetJoinStl.3 */,
+ F966BA4D08F27A37005CB29B /* GetJustify.3 */,
+ F966BA4E08F27A37005CB29B /* getOpenFile.n */,
+ F966BA4F08F27A37005CB29B /* GetOption.3 */,
+ F966BA5008F27A38005CB29B /* GetPixels.3 */,
+ F966BA5108F27A38005CB29B /* GetPixmap.3 */,
+ F966BA5208F27A38005CB29B /* GetRelief.3 */,
+ F966BA5308F27A38005CB29B /* GetRootCrd.3 */,
+ F966BA5408F27A38005CB29B /* GetScroll.3 */,
+ F966BA5508F27A38005CB29B /* GetSelect.3 */,
+ F966BA5608F27A38005CB29B /* GetUid.3 */,
+ F966BA5708F27A38005CB29B /* GetVisual.3 */,
+ F966BA5808F27A38005CB29B /* GetVRoot.3 */,
+ F966BA5908F27A38005CB29B /* Grab.3 */,
+ F966BA5A08F27A38005CB29B /* grab.n */,
+ F966BA5B08F27A38005CB29B /* grid.n */,
+ F966BA5C08F27A38005CB29B /* HandleEvent.3 */,
+ F966BA5D08F27A38005CB29B /* HWNDToWindow.3 */,
+ F966BA5E08F27A38005CB29B /* IdToWindow.3 */,
+ F966BA5F08F27A38005CB29B /* image.n */,
+ F966BA6008F27A38005CB29B /* ImgChanged.3 */,
+ F966BA6108F27A38005CB29B /* Inactive.3 */,
+ F966BA6208F27A38005CB29B /* InternAtom.3 */,
+ F966BA6308F27A38005CB29B /* keysyms.n */,
+ F966BA6408F27A38005CB29B /* label.n */,
+ F966BA6508F27A38005CB29B /* labelframe.n */,
+ F966BA6608F27A38005CB29B /* listbox.n */,
+ F966BA6708F27A38005CB29B /* loadTk.n */,
+ F966BA6808F27A38005CB29B /* lower.n */,
+ F966BA6908F27A38005CB29B /* MainLoop.3 */,
+ F966BA6A08F27A38005CB29B /* MaintGeom.3 */,
+ F966BA6B08F27A38005CB29B /* MainWin.3 */,
+ F966BA6D08F27A38005CB29B /* ManageGeom.3 */,
+ F966BA6E08F27A38005CB29B /* MapWindow.3 */,
+ F966BA6F08F27A38005CB29B /* MeasureChar.3 */,
+ F966BA7008F27A38005CB29B /* menu.n */,
+ F966BA7108F27A38005CB29B /* menubar.n */,
+ F966BA7208F27A38005CB29B /* menubutton.n */,
+ F966BA7308F27A38005CB29B /* message.n */,
+ F966BA7408F27A38005CB29B /* messageBox.n */,
+ F966BA7508F27A38005CB29B /* MoveToplev.3 */,
+ F966BA7608F27A38005CB29B /* Name.3 */,
+ F966BA7708F27A38005CB29B /* NameOfImg.3 */,
+ F966BA7808F27A38005CB29B /* option.n */,
+ F966BA7908F27A38005CB29B /* optionMenu.n */,
+ F966BA7A08F27A38005CB29B /* options.n */,
+ F966BA7B08F27A38005CB29B /* OwnSelect.3 */,
+ F966BA7C08F27A38005CB29B /* pack-old.n */,
+ F966BA7D08F27A38005CB29B /* pack.n */,
+ F966BA7E08F27A38005CB29B /* palette.n */,
+ F966BA7F08F27A38005CB29B /* panedwindow.n */,
+ F966BA8008F27A38005CB29B /* ParseArgv.3 */,
+ F966BA8108F27A38005CB29B /* photo.n */,
+ F966BA8208F27A38005CB29B /* place.n */,
+ F966BA8308F27A38005CB29B /* popup.n */,
+ F966BA8408F27A38005CB29B /* QWinEvent.3 */,
+ F966BA8508F27A38005CB29B /* radiobutton.n */,
+ F966BA8608F27A38005CB29B /* raise.n */,
+ F966BA8708F27A38005CB29B /* Restack.3 */,
+ F966BA8808F27A38005CB29B /* RestrictEv.3 */,
+ F966BA8908F27A38005CB29B /* scale.n */,
+ F966BA8A08F27A38005CB29B /* scrollbar.n */,
+ F966BA8B08F27A38005CB29B /* selection.n */,
+ F966BA8C08F27A38005CB29B /* send.n */,
+ F966BA8D08F27A38005CB29B /* SetAppName.3 */,
+ F966BA8E08F27A38005CB29B /* SetCaret.3 */,
+ F966BA8F08F27A38005CB29B /* SetClass.3 */,
+ F966BA9008F27A38005CB29B /* SetClassProcs.3 */,
+ F966BA9108F27A38005CB29B /* SetGrid.3 */,
+ F966BA9208F27A38005CB29B /* SetOptions.3 */,
+ F966BA9308F27A38005CB29B /* SetVisual.3 */,
+ F966BA9408F27A38005CB29B /* spinbox.n */,
+ F966BA9508F27A38005CB29B /* StrictMotif.3 */,
+ F966BA9608F27A38005CB29B /* text.n */,
+ F966BA9708F27A38005CB29B /* TextLayout.3 */,
+ F966BA9808F27A38005CB29B /* tk.n */,
+ F966BA9908F27A38005CB29B /* tk4.0.ps */,
+ F966BA9A08F27A38005CB29B /* Tk_Init.3 */,
+ F966BA9B08F27A38005CB29B /* Tk_Main.3 */,
+ F966BA9C08F27A38005CB29B /* tkerror.n */,
+ F966BA9D08F27A38005CB29B /* TkInitStubs.3 */,
+ F966BA9E08F27A38005CB29B /* tkvars.n */,
+ F966BA9F08F27A38005CB29B /* tkwait.n */,
+ F966BAA008F27A38005CB29B /* toplevel.n */,
+ F968886B0AF788F6000797B5 /* ttk_button.n */,
+ F968886C0AF788F6000797B5 /* ttk_checkbutton.n */,
+ F968886D0AF788F6000797B5 /* ttk_combobox.n */,
+ F968886F0AF788F6000797B5 /* ttk_entry.n */,
+ F96888700AF788F6000797B5 /* ttk_frame.n */,
+ F96888710AF788F6000797B5 /* ttk_Geometry.3 */,
+ F96888720AF788F6000797B5 /* ttk_image.n */,
+ F96888730AF788F6000797B5 /* ttk_intro.n */,
+ F96888740AF788F6000797B5 /* ttk_label.n */,
+ F96888750AF788F6000797B5 /* ttk_labelframe.n */,
+ F96888760AF788F6000797B5 /* ttk_menubutton.n */,
+ F96888770AF788F6000797B5 /* ttk_notebook.n */,
+ F96888780AF788F6000797B5 /* ttk_panedwindow.n */,
+ F96888790AF788F6000797B5 /* ttk_progressbar.n */,
+ F968887A0AF788F6000797B5 /* ttk_radiobutton.n */,
+ F968887B0AF788F6000797B5 /* ttk_scrollbar.n */,
+ F968887C0AF788F6000797B5 /* ttk_separator.n */,
+ F968887D0AF788F6000797B5 /* ttk_sizegrip.n */,
+ F968887E0AF788F6000797B5 /* ttk_style.n */,
+ F968887F0AF788F6000797B5 /* ttk_Theme.3 */,
+ F96888800AF788F6000797B5 /* ttk_treeview.n */,
+ F96888810AF788F6000797B5 /* ttk_widget.n */,
+ F966BAA108F27A38005CB29B /* WindowId.3 */,
+ F966BAA208F27A38005CB29B /* winfo.n */,
+ F966BAA308F27A38005CB29B /* wish.1 */,
+ F966BAA408F27A38005CB29B /* wm.n */,
+ );
+ path = doc;
+ sourceTree = "<group>";
+ };
+ F966BAA508F27A38005CB29B /* generic */ = {
+ isa = PBXGroup;
+ children = (
+ F966BAA608F27A38005CB29B /* default.h */,
+ F966BAA708F27A38005CB29B /* ks_names.h */,
+ F966BAA808F27A38005CB29B /* prolog.ps */,
+ F966BAA908F27A39005CB29B /* README */,
+ F966BAAA08F27A39005CB29B /* tk.decls */,
+ F966BAAB08F27A39005CB29B /* tk.h */,
+ F966BAAC08F27A39005CB29B /* tk3d.c */,
+ F966BAAD08F27A39005CB29B /* tk3d.h */,
+ F966BAAE08F27A39005CB29B /* tkArgv.c */,
+ F966BAAF08F27A39005CB29B /* tkAtom.c */,
+ F966BAB008F27A39005CB29B /* tkBind.c */,
+ F966BAB108F27A39005CB29B /* tkBitmap.c */,
+ F966BAB208F27A39005CB29B /* tkButton.c */,
+ F966BAB308F27A39005CB29B /* tkButton.h */,
+ F966BAB408F27A39005CB29B /* tkCanvArc.c */,
+ F966BAB508F27A39005CB29B /* tkCanvas.c */,
+ F966BAB608F27A39005CB29B /* tkCanvas.h */,
+ F966BAB708F27A39005CB29B /* tkCanvBmap.c */,
+ F966BAB808F27A39005CB29B /* tkCanvImg.c */,
+ F966BAB908F27A39005CB29B /* tkCanvLine.c */,
+ F966BABA08F27A39005CB29B /* tkCanvPoly.c */,
+ F966BABB08F27A39005CB29B /* tkCanvPs.c */,
+ F966BABD08F27A39005CB29B /* tkCanvText.c */,
+ F966BABE08F27A39005CB29B /* tkCanvUtil.c */,
+ F966BABF08F27A39005CB29B /* tkCanvWind.c */,
+ F966BAC008F27A39005CB29B /* tkClipboard.c */,
+ F966BAC108F27A39005CB29B /* tkCmds.c */,
+ F966BAC208F27A39005CB29B /* tkColor.c */,
+ F966BAC308F27A39005CB29B /* tkColor.h */,
+ F966BAC408F27A39005CB29B /* tkConfig.c */,
+ F966BAC508F27A39005CB29B /* tkConsole.c */,
+ F966BAC608F27A39005CB29B /* tkCursor.c */,
+ F966BAC708F27A39005CB29B /* tkDecls.h */,
+ F966BAC808F27A39005CB29B /* tkEntry.c */,
+ F966BAC908F27A39005CB29B /* tkEntry.h */,
+ F966BACA08F27A39005CB29B /* tkError.c */,
+ F966BACB08F27A39005CB29B /* tkEvent.c */,
+ F966BACC08F27A39005CB29B /* tkFileFilter.c */,
+ F966BACD08F27A39005CB29B /* tkFileFilter.h */,
+ F966BACE08F27A39005CB29B /* tkFocus.c */,
+ F966BACF08F27A39005CB29B /* tkFont.c */,
+ F966BAD008F27A39005CB29B /* tkFont.h */,
+ F966BAD108F27A39005CB29B /* tkFrame.c */,
+ F966BAD208F27A39005CB29B /* tkGC.c */,
+ F966BAD308F27A39005CB29B /* tkGeometry.c */,
+ F966BAD408F27A39005CB29B /* tkGet.c */,
+ F966BAD508F27A39005CB29B /* tkGrab.c */,
+ F966BAD608F27A39005CB29B /* tkGrid.c */,
+ F966BAD708F27A39005CB29B /* tkImage.c */,
+ F966BAD808F27A39005CB29B /* tkImgBmap.c */,
+ F966BAD908F27A39005CB29B /* tkImgGIF.c */,
+ F966BADA08F27A39005CB29B /* tkImgPhoto.c */,
+ F966BADB08F27A39005CB29B /* tkImgPPM.c */,
+ F966BADC08F27A39005CB29B /* tkImgUtil.c */,
+ F966BADE08F27A39005CB29B /* tkInt.decls */,
+ F966BADF08F27A39005CB29B /* tkInt.h */,
+ F966BAE108F27A39005CB29B /* tkIntDecls.h */,
+ F966BAE208F27A39005CB29B /* tkIntPlatDecls.h */,
+ F966BAE308F27A39005CB29B /* tkIntXlibDecls.h */,
+ F966BAE408F27A39005CB29B /* tkListbox.c */,
+ F966BAE508F27A39005CB29B /* tkMacWinMenu.c */,
+ F966BAE608F27A39005CB29B /* tkMain.c */,
+ F966BAE708F27A39005CB29B /* tkMenu.c */,
+ F966BAE808F27A39005CB29B /* tkMenu.h */,
+ F966BAE908F27A39005CB29B /* tkMenubutton.c */,
+ F966BAEA08F27A39005CB29B /* tkMenubutton.h */,
+ F966BAEB08F27A39005CB29B /* tkMenuDraw.c */,
+ F966BAEC08F27A39005CB29B /* tkMessage.c */,
+ F966BAED08F27A39005CB29B /* tkObj.c */,
+ F966BAEE08F27A39005CB29B /* tkOldConfig.c */,
+ F966BAEF08F27A39005CB29B /* tkOption.c */,
+ F966BAF008F27A39005CB29B /* tkPack.c */,
+ F966BAF108F27A39005CB29B /* tkPanedWindow.c */,
+ F966BAF208F27A39005CB29B /* tkPlace.c */,
+ F966BAF308F27A39005CB29B /* tkPlatDecls.h */,
+ F966BAF408F27A39005CB29B /* tkPointer.c */,
+ F966BAF508F27A39005CB29B /* tkPort.h */,
+ F966BAF608F27A39005CB29B /* tkRectOval.c */,
+ F966BAF708F27A39005CB29B /* tkScale.c */,
+ F966BAF808F27A39005CB29B /* tkScale.h */,
+ F966BAF908F27A39005CB29B /* tkScrollbar.c */,
+ F966BAFA08F27A39005CB29B /* tkScrollbar.h */,
+ F966BAFB08F27A39005CB29B /* tkSelect.c */,
+ F966BAFC08F27A39005CB29B /* tkSelect.h */,
+ F966BAFD08F27A39005CB29B /* tkSquare.c */,
+ F966BAFE08F27A39005CB29B /* tkOldTest.c */,
+ F966BAFF08F27A39005CB29B /* tkStubInit.c */,
+ F966BB0008F27A39005CB29B /* tkStubLib.c */,
+ F966BB0108F27A39005CB29B /* tkStyle.c */,
+ F966BB0208F27A39005CB29B /* tkTest.c */,
+ F966BB0308F27A39005CB29B /* tkText.c */,
+ F966BB0408F27A39005CB29B /* tkText.h */,
+ F966BB0508F27A39005CB29B /* tkTextBTree.c */,
+ F966BB0608F27A39005CB29B /* tkTextDisp.c */,
+ F966BB0808F27A39005CB29B /* tkTextImage.c */,
+ F966BB0908F27A39005CB29B /* tkTextIndex.c */,
+ F966BB0A08F27A39005CB29B /* tkTextMark.c */,
+ F966BB0B08F27A39005CB29B /* tkTextTag.c */,
+ F966BB0C08F27A39005CB29B /* tkTextWind.c */,
+ F966BB0D08F27A39005CB29B /* tkTrig.c */,
+ F966BB0E08F27A39005CB29B /* tkUndo.c */,
+ F966BB0F08F27A39005CB29B /* tkUndo.h */,
+ F966BB1008F27A39005CB29B /* tkUtil.c */,
+ F966BB1108F27A39005CB29B /* tkVisual.c */,
+ F966BB1208F27A39005CB29B /* tkWindow.c */,
+ F96887DF0AF786D5000797B5 /* ttk */,
+ );
+ path = generic;
+ sourceTree = "<group>";
+ };
+ F966BB1308F27A39005CB29B /* library */ = {
+ isa = PBXGroup;
+ children = (
+ F966BB1408F27A39005CB29B /* bgerror.tcl */,
+ F966BB1508F27A39005CB29B /* button.tcl */,
+ F966BB1608F27A39005CB29B /* choosedir.tcl */,
+ F966BB1708F27A39005CB29B /* clrpick.tcl */,
+ F966BB1808F27A39005CB29B /* comdlg.tcl */,
+ F966BB1908F27A39005CB29B /* console.tcl */,
+ F966BB1A08F27A39005CB29B /* demos */,
+ F966BB6208F27A3A005CB29B /* dialog.tcl */,
+ F966BB6308F27A3A005CB29B /* entry.tcl */,
+ F966BB6408F27A3A005CB29B /* focus.tcl */,
+ F966BB7308F27A3A005CB29B /* listbox.tcl */,
+ F966BB7408F27A3A005CB29B /* menu.tcl */,
+ F966BB7508F27A3A005CB29B /* mkpsenc.tcl */,
+ F966BB7608F27A3A005CB29B /* msgbox.tcl */,
+ F966BB8608F27A3A005CB29B /* obsolete.tcl */,
+ F966BB8708F27A3A005CB29B /* optMenu.tcl */,
+ F966BB8808F27A3A005CB29B /* palette.tcl */,
+ F966BB8908F27A3B005CB29B /* panedwindow.tcl */,
+ F966BB8A08F27A3B005CB29B /* prolog.ps */,
+ F966BB8B08F27A3B005CB29B /* safetk.tcl */,
+ F966BB8C08F27A3B005CB29B /* scale.tcl */,
+ F966BB8D08F27A3B005CB29B /* scrlbar.tcl */,
+ F966BB8E08F27A3B005CB29B /* spinbox.tcl */,
+ F966BB8F08F27A3B005CB29B /* tclIndex */,
+ F966BB9008F27A3B005CB29B /* tearoff.tcl */,
+ F966BB9108F27A3B005CB29B /* text.tcl */,
+ F966BB9208F27A3B005CB29B /* tk.tcl */,
+ F966BB9308F27A3B005CB29B /* tkfbox.tcl */,
+ F96888360AF787B3000797B5 /* ttk */,
+ F966BB9408F27A3B005CB29B /* unsupported.tcl */,
+ F966BB9508F27A3B005CB29B /* xmfbox.tcl */,
+ );
+ path = library;
+ sourceTree = "<group>";
+ };
+ F966BB1A08F27A39005CB29B /* demos */ = {
+ isa = PBXGroup;
+ children = (
+ F966BB1B08F27A39005CB29B /* anilabel.tcl */,
+ F966BB1C08F27A39005CB29B /* aniwave.tcl */,
+ F966BB1D08F27A39005CB29B /* arrow.tcl */,
+ F966BB1E08F27A39005CB29B /* bind.tcl */,
+ F966BB1F08F27A39005CB29B /* bitmap.tcl */,
+ F966BB2008F27A39005CB29B /* browse */,
+ F966BB2108F27A39005CB29B /* button.tcl */,
+ F966BB2208F27A39005CB29B /* check.tcl */,
+ F966BB2308F27A39005CB29B /* clrpick.tcl */,
+ F966BB2408F27A39005CB29B /* colors.tcl */,
+ F936FCDB0CCD984600716967 /* combo.tcl */,
+ F966BB2508F27A39005CB29B /* cscroll.tcl */,
+ F966BB2608F27A39005CB29B /* ctext.tcl */,
+ F966BB2708F27A39005CB29B /* dialog1.tcl */,
+ F966BB2808F27A39005CB29B /* dialog2.tcl */,
+ F966BB2A08F27A39005CB29B /* entry1.tcl */,
+ F966BB2B08F27A39005CB29B /* entry2.tcl */,
+ F966BB2C08F27A39005CB29B /* entry3.tcl */,
+ F966BB2D08F27A39005CB29B /* filebox.tcl */,
+ F966BB2E08F27A39005CB29B /* floor.tcl */,
+ F966BB2F08F27A39005CB29B /* form.tcl */,
+ F966BB3008F27A39005CB29B /* goldberg.tcl */,
+ F966BB3108F27A39005CB29B /* hello */,
+ F966BB3208F27A39005CB29B /* hscale.tcl */,
+ F966BB3308F27A39005CB29B /* icon.tcl */,
+ F966BB3408F27A39005CB29B /* image1.tcl */,
+ F966BB3508F27A39005CB29B /* image2.tcl */,
+ F966BB4208F27A3A005CB29B /* items.tcl */,
+ F966BB4308F27A3A005CB29B /* ixset */,
+ F92240290D7C620F005EC715 /* knightstour.tcl */,
+ F966BB4408F27A3A005CB29B /* label.tcl */,
+ F966BB4508F27A3A005CB29B /* labelframe.tcl */,
+ F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */,
+ F966BB4608F27A3A005CB29B /* menu.tcl */,
+ F966BB4708F27A3A005CB29B /* menubu.tcl */,
+ F966BB4808F27A3A005CB29B /* msgbox.tcl */,
+ F966BB4A08F27A3A005CB29B /* paned1.tcl */,
+ F966BB4B08F27A3A005CB29B /* paned2.tcl */,
+ F966BB4C08F27A3A005CB29B /* pendulum.tcl */,
+ F966BB4D08F27A3A005CB29B /* plot.tcl */,
+ F966BB4E08F27A3A005CB29B /* puzzle.tcl */,
+ F966BB4F08F27A3A005CB29B /* radio.tcl */,
+ F966BB5008F27A3A005CB29B /* README */,
+ F966BB5108F27A3A005CB29B /* rmt */,
+ F966BB5208F27A3A005CB29B /* rolodex */,
+ F966BB5308F27A3A005CB29B /* ruler.tcl */,
+ F966BB5408F27A3A005CB29B /* sayings.tcl */,
+ F966BB5508F27A3A005CB29B /* search.tcl */,
+ F966BB5608F27A3A005CB29B /* spin.tcl */,
+ F966BB5708F27A3A005CB29B /* square */,
+ F966BB5808F27A3A005CB29B /* states.tcl */,
+ F966BB5908F27A3A005CB29B /* style.tcl */,
+ F966BB5A08F27A3A005CB29B /* tclIndex */,
+ F966BB5B08F27A3A005CB29B /* tcolor */,
+ F966BB5C08F27A3A005CB29B /* text.tcl */,
+ F9099B8A0CC67D30005A9580 /* textpeer.tcl */,
+ F966BB5D08F27A3A005CB29B /* timer */,
+ F936FCD90CCD984600716967 /* toolbar.tcl */,
+ F936FCD80CCD984600716967 /* tree.tcl */,
+ F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */,
+ F9F4EFDD0CC7B3CB00378A27 /* ttkmenu.tcl */,
+ F936FCDA0CCD984600716967 /* ttknote.tcl */,
+ F9F4EFDC0CC7B3CA00378A27 /* ttkpane.tcl */,
+ F936FCD70CCD984500716967 /* ttkprogress.tcl */,
+ F966BB5E08F27A3A005CB29B /* twind.tcl */,
+ F966BB5F08F27A3A005CB29B /* unicodeout.tcl */,
+ F966BB6008F27A3A005CB29B /* vscale.tcl */,
+ F966BB6108F27A3A005CB29B /* widget */,
+ );
+ path = demos;
+ sourceTree = "<group>";
+ };
+ F966BB9708F27A3B005CB29B /* macosx */ = {
+ isa = PBXGroup;
+ children = (
+ F966BBBA08F27A3B005CB29B /* configure.ac */,
+ F966BBBB08F27A3B005CB29B /* GNUmakefile */,
+ F966BBBE08F27A3B005CB29B /* README */,
+ F966BBC008F27A3B005CB29B /* Tk-Info.plist.in */,
+ F966BBC108F27A3B005CB29B /* tkAboutDlg.r */,
+ F966BBC208F27A3B005CB29B /* tkMacOSX.h */,
+ F966BBC408F27A3B005CB29B /* tkMacOSXAETE.r */,
+ F966BBC508F27A3B005CB29B /* tkMacOSXBitmap.c */,
+ F966BBC608F27A3B005CB29B /* tkMacOSXButton.c */,
+ F966BBC708F27A3B005CB29B /* tkMacOSXCarbonEvents.c */,
+ F966BBC808F27A3B005CB29B /* tkMacOSXClipboard.c */,
+ F966BBC908F27A3B005CB29B /* tkMacOSXColor.c */,
+ F966BBCA08F27A3B005CB29B /* tkMacOSXConfig.c */,
+ F966BBCB08F27A3B005CB29B /* tkMacOSXCursor.c */,
+ F966BBCC08F27A3B005CB29B /* tkMacOSXCursors.r */,
+ F966BBCD08F27A3B005CB29B /* tkMacOSXDebug.c */,
+ F966BBCE08F27A3B005CB29B /* tkMacOSXDebug.h */,
+ F966BBCF08F27A3B005CB29B /* tkMacOSXDefault.h */,
+ F966BBD008F27A3B005CB29B /* tkMacOSXDialog.c */,
+ F966BBD108F27A3B005CB29B /* tkMacOSXDraw.c */,
+ F966BBD208F27A3B005CB29B /* tkMacOSXEmbed.c */,
+ F966BBD308F27A3B005CB29B /* tkMacOSXEntry.c */,
+ F966BBD408F27A3B005CB29B /* tkMacOSXEvent.c */,
+ F966BBD508F27A3B005CB29B /* tkMacOSXEvent.h */,
+ F966BBD608F27A3B005CB29B /* tkMacOSXFont.c */,
+ F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */,
+ F966BBD708F27A3B005CB29B /* tkMacOSXHLEvents.c */,
+ F966BBD808F27A3B005CB29B /* tkMacOSXInit.c */,
+ F966BBDA08F27A3B005CB29B /* tkMacOSXInt.h */,
+ F966BBDB08F27A3B005CB29B /* tkMacOSXKeyboard.c */,
+ F966BBDC08F27A3B005CB29B /* tkMacOSXKeyEvent.c */,
+ F966BBDD08F27A3B005CB29B /* tkMacOSXMenu.c */,
+ F966BBE008F27A3B005CB29B /* tkMacOSXMenubutton.c */,
+ F966BBE108F27A3B005CB29B /* tkMacOSXMenus.c */,
+ F966BBE208F27A3B005CB29B /* tkMacOSXMouseEvent.c */,
+ F966BBE308F27A3B005CB29B /* tkMacOSXNotify.c */,
+ F966BBEA08F27A3C005CB29B /* tkMacOSXPort.h */,
+ F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */,
+ F966BBEB08F27A3C005CB29B /* tkMacOSXRegion.c */,
+ F966BBEC08F27A3C005CB29B /* tkMacOSXScale.c */,
+ F966BBED08F27A3C005CB29B /* tkMacOSXScrlbr.c */,
+ F966BBEE08F27A3C005CB29B /* tkMacOSXSend.c */,
+ F966BBEF08F27A3C005CB29B /* tkMacOSXSubwindows.c */,
+ F966BBF008F27A3C005CB29B /* tkMacOSXTest.c */,
+ F966BBF108F27A3C005CB29B /* tkMacOSXWindowEvent.c */,
+ F966BBF208F27A3C005CB29B /* tkMacOSXWm.c */,
+ F966BBF308F27A3C005CB29B /* tkMacOSXWm.h */,
+ F966BBF408F27A3C005CB29B /* tkMacOSXXCursors.r */,
+ F966BBF508F27A3C005CB29B /* tkMacOSXXStubs.c */,
+ F96888840AF78938000797B5 /* ttkMacOSXTheme.c */,
+ F966BBF808F27A3C005CB29B /* Wish.icns */,
+ F966BBF708F27A3C005CB29B /* Wish-Info.plist.in */,
+ F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */,
+ F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */,
+ F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */,
+ );
+ path = macosx;
+ sourceTree = "<group>";
+ };
+ F966BC0408F27A3C005CB29B /* tests */ = {
+ isa = PBXGroup;
+ children = (
+ F966BC0508F27A3C005CB29B /* all.tcl */,
+ F966BC0608F27A3C005CB29B /* arc.tcl */,
+ F966BC0708F27A3C005CB29B /* bell.test */,
+ F966BC0808F27A3C005CB29B /* bevel.tcl */,
+ F966BC0908F27A3C005CB29B /* bgerror.test */,
+ F966BC0A08F27A3C005CB29B /* bind.test */,
+ F966BC0B08F27A3C005CB29B /* bitmap.test */,
+ F966BC0C08F27A3C005CB29B /* border.test */,
+ F966BC0D08F27A3C005CB29B /* bugs.tcl */,
+ F966BC0E08F27A3C005CB29B /* butGeom.tcl */,
+ F966BC0F08F27A3C005CB29B /* butGeom2.tcl */,
+ F966BC1008F27A3C005CB29B /* button.test */,
+ F966BC1108F27A3C005CB29B /* canvas.test */,
+ F966BC1208F27A3C005CB29B /* canvImg.test */,
+ F966BC1308F27A3C005CB29B /* canvPs.test */,
+ F966BC1408F27A3C005CB29B /* canvPsArc.tcl */,
+ F966BC1508F27A3C005CB29B /* canvPsBmap.tcl */,
+ F966BC1608F27A3C005CB29B /* canvPsGrph.tcl */,
+ F966BC1708F27A3C005CB29B /* canvPsImg.tcl */,
+ F966BC1808F27A3C005CB29B /* canvPsText.tcl */,
+ F966BC1908F27A3C005CB29B /* canvRect.test */,
+ F966BC1A08F27A3C005CB29B /* canvText.test */,
+ F966BC1B08F27A3C005CB29B /* canvWind.test */,
+ F966BC1C08F27A3C005CB29B /* choosedir.test */,
+ F966BC1D08F27A3C005CB29B /* clipboard.test */,
+ F966BC1E08F27A3C005CB29B /* clrpick.test */,
+ F966BC1F08F27A3C005CB29B /* cmap.tcl */,
+ F966BC2008F27A3C005CB29B /* cmds.test */,
+ F966BC2108F27A3C005CB29B /* color.test */,
+ F966BC2208F27A3C005CB29B /* config.test */,
+ F966BC2308F27A3C005CB29B /* constraints.tcl */,
+ F966BC2408F27A3C005CB29B /* cursor.test */,
+ F966BC2508F27A3C005CB29B /* dialog.test */,
+ F966BC2608F27A3C005CB29B /* embed.test */,
+ F966BC2708F27A3C005CB29B /* entry.test */,
+ F966BC2808F27A3C005CB29B /* event.test */,
+ F966BC2908F27A3C005CB29B /* filebox.test */,
+ F966BC2A08F27A3C005CB29B /* focus.test */,
+ F966BC2B08F27A3C005CB29B /* focusTcl.test */,
+ F966BC2C08F27A3C005CB29B /* font.test */,
+ F966BC2D08F27A3C005CB29B /* frame.test */,
+ F966BC2E08F27A3C005CB29B /* geometry.test */,
+ F966BC2F08F27A3C005CB29B /* get.test */,
+ F966BC3008F27A3C005CB29B /* grab.test */,
+ F966BC3108F27A3C005CB29B /* grid.test */,
+ F966BC3208F27A3C005CB29B /* id.test */,
+ F966BC3308F27A3C005CB29B /* image.test */,
+ F966BC3408F27A3C005CB29B /* imgBmap.test */,
+ F966BC3508F27A3C005CB29B /* imgPhoto.test */,
+ F966BC3608F27A3C005CB29B /* imgPPM.test */,
+ F966BC3708F27A3C005CB29B /* listbox.test */,
+ F966BC3808F27A3C005CB29B /* main.test */,
+ F966BC3908F27A3C005CB29B /* menu.test */,
+ F966BC3A08F27A3C005CB29B /* menubut.test */,
+ F966BC3B08F27A3C005CB29B /* menuDraw.test */,
+ F966BC3C08F27A3C005CB29B /* message.test */,
+ F966BC3D08F27A3C005CB29B /* msgbox.test */,
+ F966BC3E08F27A3C005CB29B /* obj.test */,
+ F966BC3F08F27A3C005CB29B /* oldpack.test */,
+ F966BC4008F27A3C005CB29B /* option.file1 */,
+ F966BC4108F27A3C005CB29B /* option.file2 */,
+ F966BC4208F27A3C005CB29B /* option.test */,
+ F966BC4308F27A3C005CB29B /* pack.test */,
+ F966BC4408F27A3C005CB29B /* panedwindow.test */,
+ F966BC4508F27A3D005CB29B /* place.test */,
+ F966BC4608F27A3D005CB29B /* raise.test */,
+ F966BC4708F27A3D005CB29B /* README */,
+ F966BC4808F27A3D005CB29B /* safe.test */,
+ F966BC4908F27A3D005CB29B /* scale.test */,
+ F966BC4A08F27A3D005CB29B /* scrollbar.test */,
+ F966BC4B08F27A3D005CB29B /* select.test */,
+ F966BC4C08F27A3D005CB29B /* send.test */,
+ F966BC4D08F27A3D005CB29B /* spinbox.test */,
+ F966BC4E08F27A3D005CB29B /* text.test */,
+ F966BC4F08F27A3D005CB29B /* textBTree.test */,
+ F966BC5008F27A3D005CB29B /* textDisp.test */,
+ F966BC5108F27A3D005CB29B /* textImage.test */,
+ F966BC5208F27A3D005CB29B /* textIndex.test */,
+ F966BC5308F27A3D005CB29B /* textMark.test */,
+ F966BC5408F27A3D005CB29B /* textTag.test */,
+ F966BC5508F27A3D005CB29B /* textWind.test */,
+ F966BC5608F27A3D005CB29B /* tk.test */,
+ F96888530AF7880C000797B5 /* ttk */,
+ F966BC5708F27A3D005CB29B /* unixButton.test */,
+ F966BC5808F27A3D005CB29B /* unixEmbed.test */,
+ F966BC5908F27A3D005CB29B /* unixFont.test */,
+ F966BC5A08F27A3D005CB29B /* unixMenu.test */,
+ F966BC5B08F27A3D005CB29B /* unixSelect.test */,
+ F966BC5C08F27A3D005CB29B /* unixWm.test */,
+ F966BC5D08F27A3D005CB29B /* util.test */,
+ F966BC5E08F27A3D005CB29B /* visual.test */,
+ F966BC5F08F27A3D005CB29B /* visual_bb.test */,
+ F966BC6008F27A3D005CB29B /* winButton.test */,
+ F966BC6108F27A3D005CB29B /* winClipboard.test */,
+ F966BC6208F27A3D005CB29B /* winDialog.test */,
+ F966BC6308F27A3D005CB29B /* window.test */,
+ F966BC6408F27A3D005CB29B /* winfo.test */,
+ F966BC6508F27A3D005CB29B /* winFont.test */,
+ F966BC6608F27A3D005CB29B /* winMenu.test */,
+ F966BC6708F27A3D005CB29B /* winSend.test */,
+ F966BC6808F27A3D005CB29B /* winWm.test */,
+ F966BC6908F27A3D005CB29B /* wm.test */,
+ F966BC6A08F27A3D005CB29B /* xmfbox.test */,
+ );
+ path = tests;
+ sourceTree = "<group>";
+ };
+ F966BC6B08F27A3D005CB29B /* unix */ = {
+ isa = PBXGroup;
+ children = (
+ F966BC6C08F27A3D005CB29B /* aclocal.m4 */,
+ F966BC6D08F27A3D005CB29B /* configure */,
+ F966BC6E08F27A3D005CB29B /* configure.in */,
+ F966BC6F08F27A3D005CB29B /* install-sh */,
+ F966BC7008F27A3D005CB29B /* installManPage */,
+ F966BC7108F27A3D005CB29B /* Makefile.in */,
+ F966BC7208F27A3D005CB29B /* README */,
+ F966BC7308F27A3D005CB29B /* tcl.m4 */,
+ F966BC7408F27A3D005CB29B /* tk.spec */,
+ F966BC7508F27A3D005CB29B /* tkAppInit.c */,
+ F966BC7608F27A3D005CB29B /* tkConfig.h.in */,
+ F966BC7708F27A3D005CB29B /* tkConfig.sh.in */,
+ F966BC7808F27A3D005CB29B /* tkUnix.c */,
+ F966BC7908F27A3D005CB29B /* tkUnix3d.c */,
+ F966BC7A08F27A3D005CB29B /* tkUnixButton.c */,
+ F966BC7B08F27A3D005CB29B /* tkUnixColor.c */,
+ F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */,
+ F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */,
+ F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */,
+ F966BC7F08F27A3D005CB29B /* tkUnixDialog.c */,
+ F966BC8008F27A3D005CB29B /* tkUnixDraw.c */,
+ F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */,
+ F966BC8208F27A3D005CB29B /* tkUnixEvent.c */,
+ F966BC8308F27A3D005CB29B /* tkUnixFocus.c */,
+ F966BC8408F27A3D005CB29B /* tkUnixFont.c */,
+ F966BC8508F27A3D005CB29B /* tkUnixInit.c */,
+ F966BC8608F27A3D005CB29B /* tkUnixInt.h */,
+ F966BC8708F27A3D005CB29B /* tkUnixKey.c */,
+ F966BC8808F27A3D005CB29B /* tkUnixMenu.c */,
+ F966BC8908F27A3D005CB29B /* tkUnixMenubu.c */,
+ F966BC8A08F27A3D005CB29B /* tkUnixPort.h */,
+ F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */,
+ F966BC8C08F27A3D005CB29B /* tkUnixScale.c */,
+ F966BC8D08F27A3D005CB29B /* tkUnixScrlbr.c */,
+ F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */,
+ F966BC8F08F27A3D005CB29B /* tkUnixSend.c */,
+ F966BC9008F27A3D005CB29B /* tkUnixWm.c */,
+ F966BC9108F27A3D005CB29B /* tkUnixXId.c */,
+ );
+ path = unix;
+ sourceTree = "<group>";
+ };
+ F966BC9208F27A3D005CB29B /* win */ = {
+ isa = PBXGroup;
+ children = (
+ F966BC9408F27A3D005CB29B /* aclocal.m4 */,
+ F966BC9508F27A3D005CB29B /* buildall.vc.bat */,
+ F966BC9608F27A3E005CB29B /* configure */,
+ F966BC9708F27A3E005CB29B /* configure.in */,
+ F966BC9808F27A3E005CB29B /* makefile.bc */,
+ F966BC9908F27A3E005CB29B /* Makefile.in */,
+ F966BC9A08F27A3E005CB29B /* makefile.vc */,
+ F966BC9B08F27A3E005CB29B /* mkd.bat */,
+ F966BC9C08F27A3E005CB29B /* nmakehlp.c */,
+ F966BC9D08F27A3E005CB29B /* rc */,
+ F966BCF308F27A3E005CB29B /* README */,
+ F966BCF408F27A3E005CB29B /* rmd.bat */,
+ F966BCF508F27A3F005CB29B /* rules.vc */,
+ F966BCF608F27A3F005CB29B /* stubs.c */,
+ F966BCF708F27A3F005CB29B /* tcl.m4 */,
+ F966BCF808F27A3F005CB29B /* tkConfig.sh.in */,
+ F966BCF908F27A3F005CB29B /* tkWin.h */,
+ F966BCFA08F27A3F005CB29B /* tkWin32Dll.c */,
+ F966BCFB08F27A3F005CB29B /* tkWin3d.c */,
+ F966BCFC08F27A3F005CB29B /* tkWinButton.c */,
+ F966BCFD08F27A3F005CB29B /* tkWinClipboard.c */,
+ F966BCFE08F27A3F005CB29B /* tkWinColor.c */,
+ F966BCFF08F27A3F005CB29B /* tkWinConfig.c */,
+ F966BD0008F27A3F005CB29B /* tkWinCursor.c */,
+ F966BD0108F27A3F005CB29B /* tkWinDefault.h */,
+ F966BD0208F27A3F005CB29B /* tkWinDialog.c */,
+ F966BD0308F27A3F005CB29B /* tkWinDraw.c */,
+ F966BD0408F27A3F005CB29B /* tkWinEmbed.c */,
+ F966BD0508F27A3F005CB29B /* tkWinFont.c */,
+ F966BD0708F27A3F005CB29B /* tkWinImage.c */,
+ F966BD0808F27A3F005CB29B /* tkWinInit.c */,
+ F966BD0908F27A3F005CB29B /* tkWinInt.h */,
+ F966BD0A08F27A3F005CB29B /* tkWinKey.c */,
+ F966BD0B08F27A3F005CB29B /* tkWinMenu.c */,
+ F966BD0C08F27A3F005CB29B /* tkWinPixmap.c */,
+ F966BD0D08F27A3F005CB29B /* tkWinPointer.c */,
+ F966BD0E08F27A3F005CB29B /* tkWinPort.h */,
+ F966BD0F08F27A3F005CB29B /* tkWinRegion.c */,
+ F966BD1008F27A3F005CB29B /* tkWinScrlbr.c */,
+ F966BD1108F27A3F005CB29B /* tkWinSend.c */,
+ F966BD1208F27A3F005CB29B /* tkWinSendCom.c */,
+ F966BD1308F27A3F005CB29B /* tkWinSendCom.h */,
+ F966BD1408F27A3F005CB29B /* tkWinTest.c */,
+ F966BD1508F27A3F005CB29B /* tkWinWindow.c */,
+ F966BD1608F27A3F005CB29B /* tkWinWm.c */,
+ F966BD1708F27A3F005CB29B /* tkWinX.c */,
+ F96888860AF78953000797B5 /* ttkWinMonitor.c */,
+ F96888870AF78953000797B5 /* ttkWinTheme.c */,
+ F96888880AF78953000797B5 /* ttkWinXPTheme.c */,
+ F966BD1808F27A3F005CB29B /* winMain.c */,
+ );
+ path = win;
+ sourceTree = "<group>";
+ };
+ F966BC9D08F27A3E005CB29B /* rc */ = {
+ isa = PBXGroup;
+ children = (
+ F966BCEE08F27A3E005CB29B /* tk.rc */,
+ F966BCEF08F27A3E005CB29B /* tk_base.rc */,
+ F966BCF208F27A3E005CB29B /* wish.rc */,
+ );
+ path = rc;
+ sourceTree = "<group>";
+ };
+ F966BD1908F27A3F005CB29B /* xlib */ = {
+ isa = PBXGroup;
+ children = (
+ F966BD1A08F27A3F005CB29B /* X11 */,
+ F966BD2308F27A3F005CB29B /* xbytes.h */,
+ F966BD2408F27A3F005CB29B /* xcolors.c */,
+ F966BD2508F27A3F005CB29B /* xdraw.c */,
+ F966BD2608F27A3F005CB29B /* xgc.c */,
+ F966BD2708F27A3F005CB29B /* ximage.c */,
+ F966BD2808F27A3F005CB29B /* xutil.c */,
+ );
+ path = xlib;
+ sourceTree = "<group>";
+ };
+ F966BD1A08F27A3F005CB29B /* X11 */ = {
+ isa = PBXGroup;
+ children = (
+ F966BD1B08F27A3F005CB29B /* cursorfont.h */,
+ F966BD1C08F27A3F005CB29B /* keysym.h */,
+ F966BD1D08F27A3F005CB29B /* keysymdef.h */,
+ F966BD1E08F27A3F005CB29B /* X.h */,
+ F966BD1F08F27A3F005CB29B /* Xatom.h */,
+ F966BD2008F27A3F005CB29B /* Xfuncproto.h */,
+ F966BD2108F27A3F005CB29B /* Xlib.h */,
+ F966BD2208F27A3F005CB29B /* Xutil.h */,
+ );
+ path = X11;
+ sourceTree = "<group>";
+ };
+ F966C06F08F281DC005CB29B /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ F966C07408F2820D005CB29B /* CoreFoundation.framework */,
+ F966C07608F2821B005CB29B /* Carbon.framework */,
+ F966C07808F28233005CB29B /* IOKit.framework */,
+ F9FD32140CC1AF170073837D /* libX11.dylib */,
+ F9FD32150CC1AF170073837D /* libXext.dylib */,
+ F9FD32160CC1AF170073837D /* libXss.dylib */,
+ F9FD349A0CC1BB0D0073837D /* libXft.dylib */,
+ F9FD34990CC1BB0D0073837D /* libfreetype.dylib */,
+ F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ F96887DF0AF786D5000797B5 /* ttk */ = {
+ isa = PBXGroup;
+ children = (
+ F96887E00AF786D5000797B5 /* ttk.decls */,
+ F96887E10AF786D5000797B5 /* ttkBlink.c */,
+ F96887E20AF786D5000797B5 /* ttkButton.c */,
+ F96887E30AF786D5000797B5 /* ttkCache.c */,
+ F96887E40AF786D5000797B5 /* ttkClamTheme.c */,
+ F96887E50AF786D5000797B5 /* ttkClassicTheme.c */,
+ F96887E60AF786D5000797B5 /* ttkDecls.h */,
+ F96887E70AF786D5000797B5 /* ttkDefaultTheme.c */,
+ F96887E80AF786D5000797B5 /* ttkElements.c */,
+ F96887E90AF786D5000797B5 /* ttkEntry.c */,
+ F96887EA0AF786D5000797B5 /* ttkFrame.c */,
+ F96887EB0AF786D5000797B5 /* ttkImage.c */,
+ F96887EC0AF786D5000797B5 /* ttkInit.c */,
+ F96887ED0AF786D5000797B5 /* ttkLabel.c */,
+ F96887EE0AF786D5000797B5 /* ttkLayout.c */,
+ F96887EF0AF786D5000797B5 /* ttkManager.c */,
+ F96887F00AF786D5000797B5 /* ttkManager.h */,
+ F96887F10AF786D5000797B5 /* ttkNotebook.c */,
+ F96887F20AF786D5000797B5 /* ttkPanedwindow.c */,
+ F96887F30AF786D5000797B5 /* ttkProgress.c */,
+ F96887F40AF786D5000797B5 /* ttkScale.c */,
+ F96887F50AF786D5000797B5 /* ttkScroll.c */,
+ F96887F60AF786D5000797B5 /* ttkScrollbar.c */,
+ F96887F70AF786D5000797B5 /* ttkSeparator.c */,
+ F96887F80AF786D5000797B5 /* ttkSquare.c */,
+ F96887F90AF786D5000797B5 /* ttkState.c */,
+ F96887FA0AF786D5000797B5 /* ttkStubInit.c */,
+ F96887FB0AF786D5000797B5 /* ttkStubLib.c */,
+ F96887FC0AF786D5000797B5 /* ttkTagSet.c */,
+ F96887FD0AF786D5000797B5 /* ttkTheme.c */,
+ F96887FE0AF786D5000797B5 /* ttkTheme.h */,
+ F96887FF0AF786D5000797B5 /* ttkThemeInt.h */,
+ F96888000AF786D5000797B5 /* ttkTrace.c */,
+ F96888010AF786D5000797B5 /* ttkTrack.c */,
+ F96888020AF786D5000797B5 /* ttkTreeview.c */,
+ F96888030AF786D5000797B5 /* ttkWidget.c */,
+ F96888040AF786D5000797B5 /* ttkWidget.h */,
+ );
+ path = ttk;
+ sourceTree = "<group>";
+ };
+ F96888360AF787B3000797B5 /* ttk */ = {
+ isa = PBXGroup;
+ children = (
+ F96888370AF787B3000797B5 /* altTheme.tcl */,
+ F96888380AF787B3000797B5 /* aquaTheme.tcl */,
+ F96888390AF787B3000797B5 /* button.tcl */,
+ F968883A0AF787B3000797B5 /* clamTheme.tcl */,
+ F968883B0AF787B3000797B5 /* classicTheme.tcl */,
+ F968883C0AF787B3000797B5 /* combobox.tcl */,
+ F968883D0AF787B3000797B5 /* cursors.tcl */,
+ F968883E0AF787B3000797B5 /* defaults.tcl */,
+ F96888400AF787B3000797B5 /* entry.tcl */,
+ F96888410AF787B3000797B5 /* fonts.tcl */,
+ F96888440AF787B3000797B5 /* menubutton.tcl */,
+ F96888450AF787B3000797B5 /* notebook.tcl */,
+ F96888460AF787B3000797B5 /* panedwindow.tcl */,
+ F96888470AF787B3000797B5 /* progress.tcl */,
+ F96888480AF787B3000797B5 /* scale.tcl */,
+ F96888490AF787B3000797B5 /* scrollbar.tcl */,
+ F968884A0AF787B3000797B5 /* sizegrip.tcl */,
+ F968884B0AF787B3000797B5 /* treeview.tcl */,
+ F968884C0AF787B3000797B5 /* ttk.tcl */,
+ F968884D0AF787B3000797B5 /* utils.tcl */,
+ F968884E0AF787B3000797B5 /* winTheme.tcl */,
+ F968884F0AF787B3000797B5 /* xpTheme.tcl */,
+ );
+ path = ttk;
+ sourceTree = "<group>";
+ };
+ F96888530AF7880C000797B5 /* ttk */ = {
+ isa = PBXGroup;
+ children = (
+ F96888540AF7880C000797B5 /* all.tcl */,
+ F96888560AF7880C000797B5 /* combobox.test */,
+ F96888570AF7880C000797B5 /* entry.test */,
+ F96888580AF7880C000797B5 /* image.test */,
+ F96888590AF7880C000797B5 /* labelframe.test */,
+ F968885A0AF7880C000797B5 /* layout.test */,
+ F968885C0AF7880C000797B5 /* notebook.test */,
+ F968885D0AF7880C000797B5 /* panedwindow.test */,
+ F968885E0AF7880C000797B5 /* progressbar.test */,
+ F968885F0AF7880C000797B5 /* scrollbar.test */,
+ F96888600AF7880C000797B5 /* treetags.test */,
+ F96888610AF7880C000797B5 /* treeview.test */,
+ F96888620AF7880C000797B5 /* ttk.test */,
+ F96888630AF7880C000797B5 /* validate.test */,
+ F962F7C60DADC26200648DB8 /* vsapi.test */,
+ );
+ path = ttk;
+ sourceTree = "<group>";
+ };
+ F96D3DF608F27169004A47F5 /* Tcl Sources */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3EC908F272A7004A47F5 /* generic */,
+ F96D432C08F272B4004A47F5 /* macosx */,
+ F96D443E08F272B9004A47F5 /* unix */,
+ F96D425C08F272B2004A47F5 /* libtommath */,
+ F96D446E08F272B9004A47F5 /* win */,
+ F96D3F3808F272A7004A47F5 /* library */,
+ F96D434408F272B5004A47F5 /* tests */,
+ F96D3DFC08F272A4004A47F5 /* doc */,
+ F96D43D008F272B8004A47F5 /* tools */,
+ F96D3DFA08F272A4004A47F5 /* ChangeLog */,
+ F96D3DFB08F272A4004A47F5 /* changes */,
+ F96D434308F272B5004A47F5 /* README */,
+ F96D432B08F272B4004A47F5 /* license.terms */,
+ );
+ name = "Tcl Sources";
+ sourceTree = TCL_SRCROOT;
+ };
+ F96D3DF708F271BE004A47F5 /* Tk Sources */ = {
+ isa = PBXGroup;
+ children = (
+ F966BAA508F27A38005CB29B /* generic */,
+ F966BB9708F27A3B005CB29B /* macosx */,
+ F966BC6B08F27A3D005CB29B /* unix */,
+ F966BD1908F27A3F005CB29B /* xlib */,
+ F966BA0308F27A37005CB29B /* bitmaps */,
+ F966BC9208F27A3D005CB29B /* win */,
+ F966BB1308F27A39005CB29B /* library */,
+ F966BC0408F27A3C005CB29B /* tests */,
+ F966BA1008F27A37005CB29B /* doc */,
+ F966BA0E08F27A37005CB29B /* ChangeLog */,
+ F966BA0F08F27A37005CB29B /* changes */,
+ F966BC0308F27A3C005CB29B /* README */,
+ F966BB9608F27A3B005CB29B /* license.terms */,
+ );
+ name = "Tk Sources";
+ sourceTree = TK_SRCROOT;
+ };
+ F96D3DFC08F272A4004A47F5 /* doc */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3DFD08F272A4004A47F5 /* Access.3 */,
+ F96D3DFE08F272A4004A47F5 /* AddErrInfo.3 */,
+ F96D3DFF08F272A4004A47F5 /* after.n */,
+ F96D3E0008F272A4004A47F5 /* Alloc.3 */,
+ F96D3E0108F272A4004A47F5 /* AllowExc.3 */,
+ F96D3E0208F272A4004A47F5 /* append.n */,
+ F96D3E0308F272A4004A47F5 /* AppInit.3 */,
+ F96D3E0408F272A5004A47F5 /* array.n */,
+ F96D3E0508F272A5004A47F5 /* AssocData.3 */,
+ F96D3E0608F272A5004A47F5 /* Async.3 */,
+ F96D3E0708F272A5004A47F5 /* BackgdErr.3 */,
+ F96D3E0808F272A5004A47F5 /* Backslash.3 */,
+ F96D3E0908F272A5004A47F5 /* bgerror.n */,
+ F96D3E0A08F272A5004A47F5 /* binary.n */,
+ F96D3E0B08F272A5004A47F5 /* BoolObj.3 */,
+ F96D3E0C08F272A5004A47F5 /* break.n */,
+ F96D3E0D08F272A5004A47F5 /* ByteArrObj.3 */,
+ F96D3E0E08F272A5004A47F5 /* CallDel.3 */,
+ F96D3E0F08F272A5004A47F5 /* case.n */,
+ F96D3E1008F272A5004A47F5 /* catch.n */,
+ F96D3E1108F272A5004A47F5 /* cd.n */,
+ F96D3E1208F272A5004A47F5 /* chan.n */,
+ F96D3E1308F272A5004A47F5 /* ChnlStack.3 */,
+ F96D3E1408F272A5004A47F5 /* clock.n */,
+ F96D3E1508F272A5004A47F5 /* close.n */,
+ F96D3E1608F272A5004A47F5 /* CmdCmplt.3 */,
+ F96D3E1708F272A5004A47F5 /* Concat.3 */,
+ F96D3E1808F272A5004A47F5 /* concat.n */,
+ F96D3E1908F272A5004A47F5 /* continue.n */,
+ F96D3E1A08F272A5004A47F5 /* CrtChannel.3 */,
+ F96D3E1B08F272A5004A47F5 /* CrtChnlHdlr.3 */,
+ F96D3E1C08F272A5004A47F5 /* CrtCloseHdlr.3 */,
+ F96D3E1D08F272A5004A47F5 /* CrtCommand.3 */,
+ F96D3E1E08F272A5004A47F5 /* CrtFileHdlr.3 */,
+ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
+ F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
+ F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
+ F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
+ F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
+ F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
+ F96D3E2508F272A5004A47F5 /* dde.n */,
+ F96D3E2608F272A5004A47F5 /* DetachPids.3 */,
+ F96D3E2708F272A5004A47F5 /* dict.n */,
+ F96D3E2808F272A5004A47F5 /* DictObj.3 */,
+ F96D3E2908F272A5004A47F5 /* DoOneEvent.3 */,
+ F96D3E2A08F272A5004A47F5 /* DoubleObj.3 */,
+ F96D3E2B08F272A5004A47F5 /* DoWhenIdle.3 */,
+ F96D3E2C08F272A5004A47F5 /* DString.3 */,
+ F96D3E2D08F272A5004A47F5 /* DumpActiveMemory.3 */,
+ F96D3E2E08F272A5004A47F5 /* Encoding.3 */,
+ F96D3E2F08F272A5004A47F5 /* encoding.n */,
+ F96D3E3008F272A5004A47F5 /* Ensemble.3 */,
+ F96D3E3108F272A5004A47F5 /* Environment.3 */,
+ F96D3E3208F272A5004A47F5 /* eof.n */,
+ F96D3E3308F272A5004A47F5 /* error.n */,
+ F96D3E3408F272A5004A47F5 /* Eval.3 */,
+ F96D3E3508F272A5004A47F5 /* eval.n */,
+ F96D3E3608F272A5004A47F5 /* exec.n */,
+ F96D3E3708F272A5004A47F5 /* Exit.3 */,
+ F96D3E3808F272A5004A47F5 /* exit.n */,
+ F96D3E3908F272A5004A47F5 /* expr.n */,
+ F96D3E3A08F272A5004A47F5 /* ExprLong.3 */,
+ F96D3E3B08F272A5004A47F5 /* ExprLongObj.3 */,
+ F96D3E3C08F272A5004A47F5 /* fblocked.n */,
+ F96D3E3D08F272A5004A47F5 /* fconfigure.n */,
+ F96D3E3E08F272A5004A47F5 /* fcopy.n */,
+ F96D3E3F08F272A5004A47F5 /* file.n */,
+ F96D3E4008F272A5004A47F5 /* fileevent.n */,
+ F96D3E4108F272A5004A47F5 /* filename.n */,
+ F96D3E4208F272A5004A47F5 /* FileSystem.3 */,
+ F96D3E4308F272A5004A47F5 /* FindExec.3 */,
+ F96D3E4408F272A5004A47F5 /* flush.n */,
+ F96D3E4508F272A5004A47F5 /* for.n */,
+ F96D3E4608F272A5004A47F5 /* foreach.n */,
+ F96D3E4708F272A5004A47F5 /* format.n */,
+ F96D3E4808F272A5004A47F5 /* GetCwd.3 */,
+ F96D3E4908F272A5004A47F5 /* GetHostName.3 */,
+ F96D3E4A08F272A5004A47F5 /* GetIndex.3 */,
+ F96D3E4B08F272A5004A47F5 /* GetInt.3 */,
+ F96D3E4C08F272A5004A47F5 /* GetOpnFl.3 */,
+ F96D3E4D08F272A5004A47F5 /* gets.n */,
+ F96D3E4E08F272A5004A47F5 /* GetStdChan.3 */,
+ F96D3E4F08F272A5004A47F5 /* GetTime.3 */,
+ F96D3E5008F272A5004A47F5 /* GetVersion.3 */,
+ F96D3E5108F272A5004A47F5 /* glob.n */,
+ F96D3E5208F272A6004A47F5 /* global.n */,
+ F96D3E5308F272A6004A47F5 /* Hash.3 */,
+ F96D3E5408F272A6004A47F5 /* history.n */,
+ F96D3E5508F272A6004A47F5 /* http.n */,
+ F96D3E5608F272A6004A47F5 /* if.n */,
+ F96D3E5708F272A6004A47F5 /* incr.n */,
+ F96D3E5808F272A6004A47F5 /* info.n */,
+ F96D3E5908F272A6004A47F5 /* Init.3 */,
+ F96D3E5A08F272A6004A47F5 /* InitStubs.3 */,
+ F96D3E5B08F272A6004A47F5 /* Interp.3 */,
+ F96D3E5C08F272A6004A47F5 /* interp.n */,
+ F96D3E5D08F272A6004A47F5 /* IntObj.3 */,
+ F96D3E5E08F272A6004A47F5 /* join.n */,
+ F96D3E5F08F272A6004A47F5 /* lappend.n */,
+ F96D3E6008F272A6004A47F5 /* lassign.n */,
+ F96D3E6108F272A6004A47F5 /* library.n */,
+ F96D3E6208F272A6004A47F5 /* Limit.3 */,
+ F96D3E6308F272A6004A47F5 /* lindex.n */,
+ F96D3E6408F272A6004A47F5 /* LinkVar.3 */,
+ F96D3E6508F272A6004A47F5 /* linsert.n */,
+ F96D3E6608F272A6004A47F5 /* list.n */,
+ F96D3E6708F272A6004A47F5 /* ListObj.3 */,
+ F96D3E6808F272A6004A47F5 /* llength.n */,
+ F96D3E6908F272A6004A47F5 /* load.n */,
+ F96D3E6A08F272A6004A47F5 /* lrange.n */,
+ F96D3E6B08F272A6004A47F5 /* lrepeat.n */,
+ F96D3E6C08F272A6004A47F5 /* lreplace.n */,
+ F96D3E6D08F272A6004A47F5 /* lsearch.n */,
+ F96D3E6E08F272A6004A47F5 /* lset.n */,
+ F96D3E6F08F272A6004A47F5 /* lsort.n */,
+ F96D3E7008F272A6004A47F5 /* man.macros */,
+ F96D3E7108F272A6004A47F5 /* mathfunc.n */,
+ F96D3E7208F272A6004A47F5 /* memory.n */,
+ F96D3E7308F272A6004A47F5 /* msgcat.n */,
+ F96D3E7408F272A6004A47F5 /* Namespace.3 */,
+ F96D3E7508F272A6004A47F5 /* namespace.n */,
+ F96D3E7608F272A6004A47F5 /* Notifier.3 */,
+ F96D3E7708F272A6004A47F5 /* Object.3 */,
+ F96D3E7808F272A6004A47F5 /* ObjectType.3 */,
+ F96D3E7908F272A6004A47F5 /* open.n */,
+ F96D3E7A08F272A6004A47F5 /* OpenFileChnl.3 */,
+ F96D3E7B08F272A6004A47F5 /* OpenTcp.3 */,
+ F96D3E7C08F272A6004A47F5 /* package.n */,
+ F96D3E7D08F272A6004A47F5 /* packagens.n */,
+ F96D3E7E08F272A6004A47F5 /* Panic.3 */,
+ F96D3E7F08F272A6004A47F5 /* ParseCmd.3 */,
+ F96D3E8008F272A6004A47F5 /* pid.n */,
+ F96D3E8108F272A6004A47F5 /* pkgMkIndex.n */,
+ F96D3E8208F272A6004A47F5 /* PkgRequire.3 */,
+ F9ECB1E10B26543C00A28025 /* platform_shell.n */,
+ F9ECB1E20B26543C00A28025 /* platform.n */,
+ F96D3E8308F272A6004A47F5 /* Preserve.3 */,
+ F96D3E8408F272A6004A47F5 /* PrintDbl.3 */,
+ F96D3E8508F272A6004A47F5 /* proc.n */,
+ F96D3E8608F272A6004A47F5 /* puts.n */,
+ F96D3E8708F272A6004A47F5 /* pwd.n */,
+ F96D3E8808F272A6004A47F5 /* re_syntax.n */,
+ F96D3E8908F272A6004A47F5 /* read.n */,
+ F96D3E8A08F272A6004A47F5 /* RecEvalObj.3 */,
+ F96D3E8B08F272A6004A47F5 /* RecordEval.3 */,
+ F96D3E8C08F272A6004A47F5 /* RegConfig.3 */,
+ F96D3E8D08F272A6004A47F5 /* RegExp.3 */,
+ F96D3E8E08F272A6004A47F5 /* regexp.n */,
+ F96D3E8F08F272A6004A47F5 /* registry.n */,
+ F96D3E9008F272A6004A47F5 /* regsub.n */,
+ F96D3E9108F272A6004A47F5 /* rename.n */,
+ F96D3E9208F272A6004A47F5 /* return.n */,
+ F96D3E9308F272A6004A47F5 /* safe.n */,
+ F96D3E9408F272A6004A47F5 /* SaveResult.3 */,
+ F96D3E9508F272A6004A47F5 /* scan.n */,
+ F96D3E9608F272A6004A47F5 /* seek.n */,
+ F96D3E9708F272A6004A47F5 /* set.n */,
+ F96D3E9808F272A6004A47F5 /* SetChanErr.3 */,
+ F96D3E9908F272A6004A47F5 /* SetErrno.3 */,
+ F96D3E9A08F272A6004A47F5 /* SetRecLmt.3 */,
+ F96D3E9B08F272A7004A47F5 /* SetResult.3 */,
+ F96D3E9C08F272A7004A47F5 /* SetVar.3 */,
+ F96D3E9D08F272A7004A47F5 /* Signal.3 */,
+ F96D3E9E08F272A7004A47F5 /* Sleep.3 */,
+ F96D3E9F08F272A7004A47F5 /* socket.n */,
+ F96D3EA008F272A7004A47F5 /* source.n */,
+ F96D3EA108F272A7004A47F5 /* SourceRCFile.3 */,
+ F96D3EA208F272A7004A47F5 /* split.n */,
+ F96D3EA308F272A7004A47F5 /* SplitList.3 */,
+ F96D3EA408F272A7004A47F5 /* SplitPath.3 */,
+ F96D3EA508F272A7004A47F5 /* StaticPkg.3 */,
+ F96D3EA608F272A7004A47F5 /* StdChannels.3 */,
+ F96D3EA708F272A7004A47F5 /* string.n */,
+ F96D3EA808F272A7004A47F5 /* StringObj.3 */,
+ F96D3EA908F272A7004A47F5 /* StrMatch.3 */,
+ F96D3EAA08F272A7004A47F5 /* subst.n */,
+ F96D3EAB08F272A7004A47F5 /* SubstObj.3 */,
+ F96D3EAC08F272A7004A47F5 /* switch.n */,
+ F96D3EAD08F272A7004A47F5 /* Tcl.n */,
+ F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */,
+ F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */,
+ F96D3EB008F272A7004A47F5 /* tclsh.1 */,
+ F96D3EB108F272A7004A47F5 /* tcltest.n */,
+ F96D3EB208F272A7004A47F5 /* tclvars.n */,
+ F96D3EB308F272A7004A47F5 /* tell.n */,
+ F96D3EB408F272A7004A47F5 /* Thread.3 */,
+ F96D3EB508F272A7004A47F5 /* time.n */,
+ F96D3EB608F272A7004A47F5 /* tm.n */,
+ F96D3EB708F272A7004A47F5 /* ToUpper.3 */,
+ F96D3EB808F272A7004A47F5 /* trace.n */,
+ F96D3EB908F272A7004A47F5 /* TraceCmd.3 */,
+ F96D3EBA08F272A7004A47F5 /* TraceVar.3 */,
+ F96D3EBB08F272A7004A47F5 /* Translate.3 */,
+ F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */,
+ F96D3EBD08F272A7004A47F5 /* unknown.n */,
+ F96D3EBE08F272A7004A47F5 /* unload.n */,
+ F96D3EBF08F272A7004A47F5 /* unset.n */,
+ F96D3EC008F272A7004A47F5 /* update.n */,
+ F96D3EC108F272A7004A47F5 /* uplevel.n */,
+ F96D3EC208F272A7004A47F5 /* UpVar.3 */,
+ F96D3EC308F272A7004A47F5 /* upvar.n */,
+ F96D3EC408F272A7004A47F5 /* Utf.3 */,
+ F96D3EC508F272A7004A47F5 /* variable.n */,
+ F96D3EC608F272A7004A47F5 /* vwait.n */,
+ F96D3EC708F272A7004A47F5 /* while.n */,
+ F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */,
+ );
+ path = doc;
+ sourceTree = "<group>";
+ };
+ F96D3EC908F272A7004A47F5 /* generic */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3ECA08F272A7004A47F5 /* README */,
+ F96D3ECB08F272A7004A47F5 /* regc_color.c */,
+ F96D3ECC08F272A7004A47F5 /* regc_cvec.c */,
+ F96D3ECD08F272A7004A47F5 /* regc_lex.c */,
+ F96D3ECE08F272A7004A47F5 /* regc_locale.c */,
+ F96D3ECF08F272A7004A47F5 /* regc_nfa.c */,
+ F96D3ED008F272A7004A47F5 /* regcomp.c */,
+ F96D3ED108F272A7004A47F5 /* regcustom.h */,
+ F96D3ED208F272A7004A47F5 /* rege_dfa.c */,
+ F96D3ED308F272A7004A47F5 /* regerror.c */,
+ F96D3ED408F272A7004A47F5 /* regerrs.h */,
+ F96D3ED508F272A7004A47F5 /* regex.h */,
+ F96D3ED608F272A7004A47F5 /* regexec.c */,
+ F96D3ED708F272A7004A47F5 /* regfree.c */,
+ F96D3ED808F272A7004A47F5 /* regfronts.c */,
+ F96D3ED908F272A7004A47F5 /* regguts.h */,
+ F96D3EDA08F272A7004A47F5 /* tcl.decls */,
+ F96D3EDB08F272A7004A47F5 /* tcl.h */,
+ F96D3EDC08F272A7004A47F5 /* tclAlloc.c */,
+ F96D3EDD08F272A7004A47F5 /* tclAsync.c */,
+ F96D3EDE08F272A7004A47F5 /* tclBasic.c */,
+ F96D3EDF08F272A7004A47F5 /* tclBinary.c */,
+ F96D3EE008F272A7004A47F5 /* tclCkalloc.c */,
+ F96D3EE108F272A7004A47F5 /* tclClock.c */,
+ F96D3EE208F272A7004A47F5 /* tclCmdAH.c */,
+ F96D3EE308F272A7004A47F5 /* tclCmdIL.c */,
+ F96D3EE408F272A7004A47F5 /* tclCmdMZ.c */,
+ F96D3EE508F272A7004A47F5 /* tclCompCmds.c */,
+ F96D3EE608F272A7004A47F5 /* tclCompExpr.c */,
+ F96D3EE708F272A7004A47F5 /* tclCompile.c */,
+ F96D3EE808F272A7004A47F5 /* tclCompile.h */,
+ F96D3EE908F272A7004A47F5 /* tclConfig.c */,
+ F96D3EEA08F272A7004A47F5 /* tclDate.c */,
+ F96D3EEB08F272A7004A47F5 /* tclDecls.h */,
+ F96D3EEC08F272A7004A47F5 /* tclDictObj.c */,
+ F9F4415D0C8BAE6F00BCCD67 /* tclDTrace.d */,
+ F96D3EED08F272A7004A47F5 /* tclEncoding.c */,
+ F96D3EEE08F272A7004A47F5 /* tclEnv.c */,
+ F96D3EEF08F272A7004A47F5 /* tclEvent.c */,
+ F96D3EF008F272A7004A47F5 /* tclExecute.c */,
+ F96D3EF108F272A7004A47F5 /* tclFCmd.c */,
+ F96D3EF208F272A7004A47F5 /* tclFileName.c */,
+ F96D3EF308F272A7004A47F5 /* tclFileSystem.h */,
+ F96D3EF408F272A7004A47F5 /* tclGet.c */,
+ F96D3EF508F272A7004A47F5 /* tclGetDate.y */,
+ F96D3EF608F272A7004A47F5 /* tclHash.c */,
+ F96D3EF708F272A7004A47F5 /* tclHistory.c */,
+ F96D3EF808F272A7004A47F5 /* tclIndexObj.c */,
+ F96D3EF908F272A7004A47F5 /* tclInt.decls */,
+ F96D3EFA08F272A7004A47F5 /* tclInt.h */,
+ F96D3EFB08F272A7004A47F5 /* tclIntDecls.h */,
+ F96D3EFC08F272A7004A47F5 /* tclInterp.c */,
+ F96D3EFD08F272A7004A47F5 /* tclIntPlatDecls.h */,
+ F96D3EFE08F272A7004A47F5 /* tclIO.c */,
+ F96D3EFF08F272A7004A47F5 /* tclIO.h */,
+ F96D3F0008F272A7004A47F5 /* tclIOCmd.c */,
+ F96D3F0108F272A7004A47F5 /* tclIOGT.c */,
+ F96D3F0208F272A7004A47F5 /* tclIORChan.c */,
+ F96D3F0308F272A7004A47F5 /* tclIOSock.c */,
+ F96D3F0408F272A7004A47F5 /* tclIOUtil.c */,
+ F96D3F0508F272A7004A47F5 /* tclLink.c */,
+ F96D3F0608F272A7004A47F5 /* tclListObj.c */,
+ F96D3F0708F272A7004A47F5 /* tclLiteral.c */,
+ F96D3F0808F272A7004A47F5 /* tclLoad.c */,
+ F96D3F0908F272A7004A47F5 /* tclLoadNone.c */,
+ F96D3F0A08F272A7004A47F5 /* tclMain.c */,
+ F96D3F0B08F272A7004A47F5 /* tclNamesp.c */,
+ F96D3F0C08F272A7004A47F5 /* tclNotify.c */,
+ F96D3F0D08F272A7004A47F5 /* tclObj.c */,
+ F96D3F0E08F272A7004A47F5 /* tclPanic.c */,
+ F96D3F0F08F272A7004A47F5 /* tclParse.c */,
+ F96D3F1108F272A7004A47F5 /* tclPathObj.c */,
+ F96D3F1208F272A7004A47F5 /* tclPipe.c */,
+ F96D3F1308F272A7004A47F5 /* tclPkg.c */,
+ F96D3F1408F272A7004A47F5 /* tclPkgConfig.c */,
+ F96D3F1508F272A7004A47F5 /* tclPlatDecls.h */,
+ F96D3F1608F272A7004A47F5 /* tclPort.h */,
+ F96D3F1708F272A7004A47F5 /* tclPosixStr.c */,
+ F96D3F1808F272A7004A47F5 /* tclPreserve.c */,
+ F96D3F1908F272A7004A47F5 /* tclProc.c */,
+ F96D3F1A08F272A7004A47F5 /* tclRegexp.c */,
+ F96D3F1B08F272A7004A47F5 /* tclRegexp.h */,
+ F96D3F1C08F272A7004A47F5 /* tclResolve.c */,
+ F96D3F1D08F272A7004A47F5 /* tclResult.c */,
+ F96D3F1E08F272A7004A47F5 /* tclScan.c */,
+ F96D3F1F08F272A7004A47F5 /* tclStringObj.c */,
+ F96D3F2408F272A7004A47F5 /* tclStrToD.c */,
+ F96D3F2508F272A7004A47F5 /* tclStubInit.c */,
+ F96D3F2608F272A7004A47F5 /* tclStubLib.c */,
+ F96D3F2708F272A7004A47F5 /* tclTest.c */,
+ F96D3F2808F272A7004A47F5 /* tclTestObj.c */,
+ F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */,
+ F96D3F2A08F272A7004A47F5 /* tclThread.c */,
+ F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */,
+ F96D3F2C08F272A7004A47F5 /* tclThreadJoin.c */,
+ F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */,
+ F96D3F2E08F272A7004A47F5 /* tclThreadTest.c */,
+ F96D3F2F08F272A7004A47F5 /* tclTimer.c */,
+ F9903CAF094FAADA004613E9 /* tclTomMath.decls */,
+ F96D3F3008F272A7004A47F5 /* tclTomMath.h */,
+ F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */,
+ F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */,
+ F96D3F3208F272A7004A47F5 /* tclTrace.c */,
+ F96D3F3308F272A7004A47F5 /* tclUniData.c */,
+ F96D3F3408F272A7004A47F5 /* tclUtf.c */,
+ F96D3F3508F272A7004A47F5 /* tclUtil.c */,
+ F96D3F3608F272A7004A47F5 /* tclVar.c */,
+ F96D3F3708F272A7004A47F5 /* tommath.h */,
+ );
+ path = generic;
+ sourceTree = "<group>";
+ };
+ F96D3F3808F272A7004A47F5 /* library */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F3908F272A8004A47F5 /* auto.tcl */,
+ F96D3F3A08F272A8004A47F5 /* clock.tcl */,
+ F96D3F3B08F272A8004A47F5 /* dde */,
+ F96D3F8C08F272A8004A47F5 /* history.tcl */,
+ F96D3F8D08F272A8004A47F5 /* http */,
+ F96D3F9008F272A8004A47F5 /* http1.0 */,
+ F96D3F9308F272A8004A47F5 /* init.tcl */,
+ F96D3F9408F272A8004A47F5 /* msgcat */,
+ F96D401708F272AA004A47F5 /* opt */,
+ F96D401A08F272AA004A47F5 /* package.tcl */,
+ F96D401B08F272AA004A47F5 /* parray.tcl */,
+ F9ECB1110B26521500A28025 /* platform */,
+ F96D401C08F272AA004A47F5 /* reg */,
+ F96D401E08F272AA004A47F5 /* safe.tcl */,
+ F96D401F08F272AA004A47F5 /* tclIndex */,
+ F96D402008F272AA004A47F5 /* tcltest */,
+ F96D402308F272AA004A47F5 /* tm.tcl */,
+ F96D425B08F272B2004A47F5 /* word.tcl */,
+ );
+ path = library;
+ sourceTree = "<group>";
+ };
+ F96D3F3B08F272A8004A47F5 /* dde */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F3C08F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = dde;
+ sourceTree = "<group>";
+ };
+ F96D3F8D08F272A8004A47F5 /* http */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F8E08F272A8004A47F5 /* http.tcl */,
+ F96D3F8F08F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = http;
+ sourceTree = "<group>";
+ };
+ F96D3F9008F272A8004A47F5 /* http1.0 */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F9108F272A8004A47F5 /* http.tcl */,
+ F96D3F9208F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = http1.0;
+ sourceTree = "<group>";
+ };
+ F96D3F9408F272A8004A47F5 /* msgcat */ = {
+ isa = PBXGroup;
+ children = (
+ F96D3F9508F272A8004A47F5 /* msgcat.tcl */,
+ F96D3F9608F272A8004A47F5 /* pkgIndex.tcl */,
+ );
+ path = msgcat;
+ sourceTree = "<group>";
+ };
+ F96D401708F272AA004A47F5 /* opt */ = {
+ isa = PBXGroup;
+ children = (
+ F96D401808F272AA004A47F5 /* optparse.tcl */,
+ F96D401908F272AA004A47F5 /* pkgIndex.tcl */,
+ );
+ path = opt;
+ sourceTree = "<group>";
+ };
+ F96D401C08F272AA004A47F5 /* reg */ = {
+ isa = PBXGroup;
+ children = (
+ F96D401D08F272AA004A47F5 /* pkgIndex.tcl */,
+ );
+ path = reg;
+ sourceTree = "<group>";
+ };
+ F96D402008F272AA004A47F5 /* tcltest */ = {
+ isa = PBXGroup;
+ children = (
+ F96D402108F272AA004A47F5 /* pkgIndex.tcl */,
+ F96D402208F272AA004A47F5 /* tcltest.tcl */,
+ );
+ path = tcltest;
+ sourceTree = "<group>";
+ };
+ F96D425C08F272B2004A47F5 /* libtommath */ = {
+ isa = PBXGroup;
+ children = (
+ F96D425F08F272B3004A47F5 /* bn.pdf */,
+ F96D426108F272B3004A47F5 /* bn_error.c */,
+ F96D426208F272B3004A47F5 /* bn_fast_mp_invmod.c */,
+ F96D426308F272B3004A47F5 /* bn_fast_mp_montgomery_reduce.c */,
+ F96D426408F272B3004A47F5 /* bn_fast_s_mp_mul_digs.c */,
+ F96D426508F272B3004A47F5 /* bn_fast_s_mp_mul_high_digs.c */,
+ F96D426608F272B3004A47F5 /* bn_fast_s_mp_sqr.c */,
+ F96D426708F272B3004A47F5 /* bn_mp_2expt.c */,
+ F96D426808F272B3004A47F5 /* bn_mp_abs.c */,
+ F96D426908F272B3004A47F5 /* bn_mp_add.c */,
+ F96D426A08F272B3004A47F5 /* bn_mp_add_d.c */,
+ F96D426B08F272B3004A47F5 /* bn_mp_addmod.c */,
+ F96D426C08F272B3004A47F5 /* bn_mp_and.c */,
+ F96D426D08F272B3004A47F5 /* bn_mp_clamp.c */,
+ F96D426E08F272B3004A47F5 /* bn_mp_clear.c */,
+ F96D426F08F272B3004A47F5 /* bn_mp_clear_multi.c */,
+ F96D427008F272B3004A47F5 /* bn_mp_cmp.c */,
+ F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */,
+ F96D427208F272B3004A47F5 /* bn_mp_cmp_mag.c */,
+ F96D427308F272B3004A47F5 /* bn_mp_cnt_lsb.c */,
+ F96D427408F272B3004A47F5 /* bn_mp_copy.c */,
+ F96D427508F272B3004A47F5 /* bn_mp_count_bits.c */,
+ F96D427608F272B3004A47F5 /* bn_mp_div.c */,
+ F96D427708F272B3004A47F5 /* bn_mp_div_2.c */,
+ F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */,
+ F96D427908F272B3004A47F5 /* bn_mp_div_3.c */,
+ F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */,
+ F96D427B08F272B3004A47F5 /* bn_mp_dr_is_modulus.c */,
+ F96D427C08F272B3004A47F5 /* bn_mp_dr_reduce.c */,
+ F96D427D08F272B3004A47F5 /* bn_mp_dr_setup.c */,
+ F96D427E08F272B3004A47F5 /* bn_mp_exch.c */,
+ F96D427F08F272B3004A47F5 /* bn_mp_expt_d.c */,
+ F96D428008F272B3004A47F5 /* bn_mp_exptmod.c */,
+ F96D428108F272B3004A47F5 /* bn_mp_exptmod_fast.c */,
+ F96D428208F272B3004A47F5 /* bn_mp_exteuclid.c */,
+ F96D428308F272B3004A47F5 /* bn_mp_fread.c */,
+ F96D428408F272B3004A47F5 /* bn_mp_fwrite.c */,
+ F96D428508F272B3004A47F5 /* bn_mp_gcd.c */,
+ F96D428608F272B3004A47F5 /* bn_mp_get_int.c */,
+ F96D428708F272B3004A47F5 /* bn_mp_grow.c */,
+ F96D428808F272B3004A47F5 /* bn_mp_init.c */,
+ F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */,
+ F96D428A08F272B3004A47F5 /* bn_mp_init_multi.c */,
+ F96D428B08F272B3004A47F5 /* bn_mp_init_set.c */,
+ F96D428C08F272B3004A47F5 /* bn_mp_init_set_int.c */,
+ F96D428D08F272B3004A47F5 /* bn_mp_init_size.c */,
+ F96D428E08F272B3004A47F5 /* bn_mp_invmod.c */,
+ F96D428F08F272B3004A47F5 /* bn_mp_invmod_slow.c */,
+ F96D429008F272B3004A47F5 /* bn_mp_is_square.c */,
+ F96D429108F272B3004A47F5 /* bn_mp_jacobi.c */,
+ F96D429208F272B3004A47F5 /* bn_mp_karatsuba_mul.c */,
+ F96D429308F272B3004A47F5 /* bn_mp_karatsuba_sqr.c */,
+ F96D429408F272B3004A47F5 /* bn_mp_lcm.c */,
+ F96D429508F272B3004A47F5 /* bn_mp_lshd.c */,
+ F96D429608F272B3004A47F5 /* bn_mp_mod.c */,
+ F96D429708F272B3004A47F5 /* bn_mp_mod_2d.c */,
+ F96D429808F272B3004A47F5 /* bn_mp_mod_d.c */,
+ F96D429908F272B3004A47F5 /* bn_mp_montgomery_calc_normalization.c */,
+ F96D429A08F272B3004A47F5 /* bn_mp_montgomery_reduce.c */,
+ F96D429B08F272B3004A47F5 /* bn_mp_montgomery_setup.c */,
+ F96D429C08F272B3004A47F5 /* bn_mp_mul.c */,
+ F96D429D08F272B3004A47F5 /* bn_mp_mul_2.c */,
+ F96D429E08F272B3004A47F5 /* bn_mp_mul_2d.c */,
+ F96D429F08F272B3004A47F5 /* bn_mp_mul_d.c */,
+ F96D42A008F272B3004A47F5 /* bn_mp_mulmod.c */,
+ F96D42A108F272B3004A47F5 /* bn_mp_n_root.c */,
+ F96D42A208F272B3004A47F5 /* bn_mp_neg.c */,
+ F96D42A308F272B3004A47F5 /* bn_mp_or.c */,
+ F96D42A408F272B3004A47F5 /* bn_mp_prime_fermat.c */,
+ F96D42A508F272B3004A47F5 /* bn_mp_prime_is_divisible.c */,
+ F96D42A608F272B3004A47F5 /* bn_mp_prime_is_prime.c */,
+ F96D42A708F272B3004A47F5 /* bn_mp_prime_miller_rabin.c */,
+ F96D42A808F272B3004A47F5 /* bn_mp_prime_next_prime.c */,
+ F96D42A908F272B3004A47F5 /* bn_mp_prime_rabin_miller_trials.c */,
+ F96D42AA08F272B3004A47F5 /* bn_mp_prime_random_ex.c */,
+ F96D42AB08F272B3004A47F5 /* bn_mp_radix_size.c */,
+ F96D42AC08F272B3004A47F5 /* bn_mp_radix_smap.c */,
+ F96D42AD08F272B3004A47F5 /* bn_mp_rand.c */,
+ F96D42AE08F272B3004A47F5 /* bn_mp_read_radix.c */,
+ F96D42AF08F272B3004A47F5 /* bn_mp_read_signed_bin.c */,
+ F96D42B008F272B3004A47F5 /* bn_mp_read_unsigned_bin.c */,
+ F96D42B108F272B3004A47F5 /* bn_mp_reduce.c */,
+ F96D42B208F272B3004A47F5 /* bn_mp_reduce_2k.c */,
+ F96D42B308F272B3004A47F5 /* bn_mp_reduce_2k_l.c */,
+ F96D42B408F272B3004A47F5 /* bn_mp_reduce_2k_setup.c */,
+ F96D42B508F272B3004A47F5 /* bn_mp_reduce_2k_setup_l.c */,
+ F96D42B608F272B3004A47F5 /* bn_mp_reduce_is_2k.c */,
+ F96D42B708F272B3004A47F5 /* bn_mp_reduce_is_2k_l.c */,
+ F96D42B808F272B3004A47F5 /* bn_mp_reduce_setup.c */,
+ F96D42B908F272B3004A47F5 /* bn_mp_rshd.c */,
+ F96D42BA08F272B3004A47F5 /* bn_mp_set.c */,
+ F96D42BB08F272B3004A47F5 /* bn_mp_set_int.c */,
+ F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */,
+ F96D42BD08F272B3004A47F5 /* bn_mp_signed_bin_size.c */,
+ F96D42BE08F272B3004A47F5 /* bn_mp_sqr.c */,
+ F96D42BF08F272B3004A47F5 /* bn_mp_sqrmod.c */,
+ F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */,
+ F96D42C108F272B3004A47F5 /* bn_mp_sub.c */,
+ F96D42C208F272B3004A47F5 /* bn_mp_sub_d.c */,
+ F96D42C308F272B3004A47F5 /* bn_mp_submod.c */,
+ F96D42C408F272B3004A47F5 /* bn_mp_to_signed_bin.c */,
+ F96D42C508F272B3004A47F5 /* bn_mp_to_signed_bin_n.c */,
+ F96D42C608F272B3004A47F5 /* bn_mp_to_unsigned_bin.c */,
+ F96D42C708F272B3004A47F5 /* bn_mp_to_unsigned_bin_n.c */,
+ F96D42C808F272B3004A47F5 /* bn_mp_toom_mul.c */,
+ F96D42C908F272B3004A47F5 /* bn_mp_toom_sqr.c */,
+ F96D42CA08F272B3004A47F5 /* bn_mp_toradix.c */,
+ F96D42CB08F272B3004A47F5 /* bn_mp_toradix_n.c */,
+ F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */,
+ F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */,
+ F96D42CE08F272B3004A47F5 /* bn_mp_zero.c */,
+ F96D42CF08F272B3004A47F5 /* bn_prime_tab.c */,
+ F96D42D008F272B3004A47F5 /* bn_reverse.c */,
+ F96D42D108F272B3004A47F5 /* bn_s_mp_add.c */,
+ F96D42D208F272B3004A47F5 /* bn_s_mp_exptmod.c */,
+ F96D42D308F272B3004A47F5 /* bn_s_mp_mul_digs.c */,
+ F96D42D408F272B3004A47F5 /* bn_s_mp_mul_high_digs.c */,
+ F96D42D508F272B3004A47F5 /* bn_s_mp_sqr.c */,
+ F96D42D608F272B3004A47F5 /* bn_s_mp_sub.c */,
+ F96D42D708F272B3004A47F5 /* bncore.c */,
+ F96D42D908F272B3004A47F5 /* callgraph.txt */,
+ F96D42DA08F272B3004A47F5 /* changes.txt */,
+ F96D42F008F272B3004A47F5 /* LICENSE */,
+ F96D431D08F272B4004A47F5 /* poster.pdf */,
+ F96D432608F272B4004A47F5 /* tommath.pdf */,
+ F96D432908F272B4004A47F5 /* tommath_class.h */,
+ F96D432A08F272B4004A47F5 /* tommath_superclass.h */,
+ );
+ path = libtommath;
+ sourceTree = "<group>";
+ };
+ F96D432C08F272B4004A47F5 /* macosx */ = {
+ isa = PBXGroup;
+ children = (
+ F96D432E08F272B5004A47F5 /* configure.ac */,
+ F96D432F08F272B5004A47F5 /* GNUmakefile */,
+ F96D433108F272B5004A47F5 /* README */,
+ F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */,
+ F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */,
+ F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */,
+ F96D433208F272B5004A47F5 /* Tcl-Info.plist.in */,
+ F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */,
+ );
+ path = macosx;
+ sourceTree = "<group>";
+ };
+ F96D434408F272B5004A47F5 /* tests */ = {
+ isa = PBXGroup;
+ children = (
+ F96D434508F272B5004A47F5 /* all.tcl */,
+ F96D434608F272B5004A47F5 /* append.test */,
+ F96D434708F272B5004A47F5 /* appendComp.test */,
+ F9ECB1CA0B2652D300A28025 /* apply.test */,
+ F96D434808F272B5004A47F5 /* assocd.test */,
+ F96D434908F272B5004A47F5 /* async.test */,
+ F96D434A08F272B5004A47F5 /* autoMkindex.test */,
+ F96D434B08F272B5004A47F5 /* basic.test */,
+ F96D434C08F272B5004A47F5 /* binary.test */,
+ F96D434D08F272B5004A47F5 /* case.test */,
+ F96D434E08F272B5004A47F5 /* chan.test */,
+ F9A493240CEBF38300B78AE2 /* chanio.test */,
+ F96D434F08F272B5004A47F5 /* clock.test */,
+ F96D435008F272B5004A47F5 /* cmdAH.test */,
+ F96D435108F272B5004A47F5 /* cmdIL.test */,
+ F96D435208F272B5004A47F5 /* cmdInfo.test */,
+ F96D435308F272B5004A47F5 /* cmdMZ.test */,
+ F96D435408F272B5004A47F5 /* compExpr-old.test */,
+ F96D435508F272B5004A47F5 /* compExpr.test */,
+ F96D435608F272B5004A47F5 /* compile.test */,
+ F96D435708F272B5004A47F5 /* concat.test */,
+ F96D435808F272B5004A47F5 /* config.test */,
+ F96D435908F272B5004A47F5 /* dcall.test */,
+ F96D435A08F272B5004A47F5 /* dict.test */,
+ F96D435C08F272B5004A47F5 /* dstring.test */,
+ F96D435E08F272B5004A47F5 /* encoding.test */,
+ F96D435F08F272B5004A47F5 /* env.test */,
+ F96D436008F272B5004A47F5 /* error.test */,
+ F96D436108F272B5004A47F5 /* eval.test */,
+ F96D436208F272B5004A47F5 /* event.test */,
+ F96D436308F272B5004A47F5 /* exec.test */,
+ F96D436408F272B5004A47F5 /* execute.test */,
+ F96D436508F272B5004A47F5 /* expr-old.test */,
+ F96D436608F272B5004A47F5 /* expr.test */,
+ F96D436708F272B6004A47F5 /* fCmd.test */,
+ F96D436808F272B6004A47F5 /* fileName.test */,
+ F96D436908F272B6004A47F5 /* fileSystem.test */,
+ F96D436A08F272B6004A47F5 /* for-old.test */,
+ F96D436B08F272B6004A47F5 /* for.test */,
+ F96D436C08F272B6004A47F5 /* foreach.test */,
+ F96D436D08F272B6004A47F5 /* format.test */,
+ F96D436E08F272B6004A47F5 /* get.test */,
+ F96D436F08F272B6004A47F5 /* history.test */,
+ F96D437008F272B6004A47F5 /* http.test */,
+ F96D437108F272B6004A47F5 /* httpd */,
+ F96D437208F272B6004A47F5 /* httpold.test */,
+ F96D437308F272B6004A47F5 /* if-old.test */,
+ F96D437408F272B6004A47F5 /* if.test */,
+ F96D437508F272B6004A47F5 /* incr-old.test */,
+ F96D437608F272B6004A47F5 /* incr.test */,
+ F96D437708F272B6004A47F5 /* indexObj.test */,
+ F96D437808F272B6004A47F5 /* info.test */,
+ F96D437908F272B6004A47F5 /* init.test */,
+ F96D437A08F272B6004A47F5 /* interp.test */,
+ F96D437B08F272B6004A47F5 /* io.test */,
+ F96D437C08F272B6004A47F5 /* ioCmd.test */,
+ F96D437D08F272B6004A47F5 /* iogt.test */,
+ F96D437E08F272B6004A47F5 /* ioUtil.test */,
+ F96D437F08F272B6004A47F5 /* join.test */,
+ F96D438008F272B6004A47F5 /* lindex.test */,
+ F96D438108F272B6004A47F5 /* link.test */,
+ F96D438208F272B6004A47F5 /* linsert.test */,
+ F96D438308F272B6004A47F5 /* list.test */,
+ F96D438408F272B6004A47F5 /* listObj.test */,
+ F96D438508F272B6004A47F5 /* llength.test */,
+ F96D438608F272B6004A47F5 /* load.test */,
+ F96D438708F272B6004A47F5 /* lrange.test */,
+ F96D438808F272B6004A47F5 /* lrepeat.test */,
+ F96D438908F272B6004A47F5 /* lreplace.test */,
+ F96D438A08F272B6004A47F5 /* lsearch.test */,
+ F96D438B08F272B6004A47F5 /* lset.test */,
+ F96D438C08F272B6004A47F5 /* lsetComp.test */,
+ F96D438D08F272B6004A47F5 /* macOSXFCmd.test */,
+ F95FAFF90B34F1130072E431 /* macOSXLoad.test */,
+ F96D438E08F272B6004A47F5 /* main.test */,
+ F9ECB1CB0B26534C00A28025 /* mathop.test */,
+ F96D438F08F272B6004A47F5 /* misc.test */,
+ F96D439008F272B6004A47F5 /* msgcat.test */,
+ F96D439108F272B6004A47F5 /* namespace-old.test */,
+ F96D439208F272B7004A47F5 /* namespace.test */,
+ F96D439308F272B7004A47F5 /* notify.test */,
+ F96D439408F272B7004A47F5 /* obj.test */,
+ F96D439508F272B7004A47F5 /* opt.test */,
+ F96D439608F272B7004A47F5 /* package.test */,
+ F96D439708F272B7004A47F5 /* parse.test */,
+ F96D439808F272B7004A47F5 /* parseExpr.test */,
+ F96D439908F272B7004A47F5 /* parseOld.test */,
+ F96D439A08F272B7004A47F5 /* pid.test */,
+ F96D439B08F272B7004A47F5 /* pkg.test */,
+ F96D439C08F272B7004A47F5 /* pkgMkIndex.test */,
+ F96D439D08F272B7004A47F5 /* platform.test */,
+ F96D439E08F272B7004A47F5 /* proc-old.test */,
+ F96D439F08F272B7004A47F5 /* proc.test */,
+ F96D43A008F272B7004A47F5 /* pwd.test */,
+ F96D43A108F272B7004A47F5 /* README */,
+ F96D43A208F272B7004A47F5 /* reg.test */,
+ F96D43A308F272B7004A47F5 /* regexp.test */,
+ F96D43A408F272B7004A47F5 /* regexpComp.test */,
+ F96D43A508F272B7004A47F5 /* registry.test */,
+ F96D43A608F272B7004A47F5 /* remote.tcl */,
+ F96D43A708F272B7004A47F5 /* rename.test */,
+ F96D43A808F272B7004A47F5 /* result.test */,
+ F96D43A908F272B7004A47F5 /* safe.test */,
+ F96D43AA08F272B7004A47F5 /* scan.test */,
+ F96D43AB08F272B7004A47F5 /* security.test */,
+ F96D43AC08F272B7004A47F5 /* set-old.test */,
+ F96D43AD08F272B7004A47F5 /* set.test */,
+ F96D43AE08F272B7004A47F5 /* socket.test */,
+ F96D43AF08F272B7004A47F5 /* source.test */,
+ F96D43B008F272B7004A47F5 /* split.test */,
+ F96D43B108F272B7004A47F5 /* stack.test */,
+ F96D43B208F272B7004A47F5 /* string.test */,
+ F96D43B308F272B7004A47F5 /* stringComp.test */,
+ F96D43B408F272B7004A47F5 /* stringObj.test */,
+ F96D43B508F272B7004A47F5 /* subst.test */,
+ F96D43B608F272B7004A47F5 /* switch.test */,
+ F96D43B708F272B7004A47F5 /* tcltest.test */,
+ F96D43B808F272B7004A47F5 /* thread.test */,
+ F96D43B908F272B7004A47F5 /* timer.test */,
+ F96D43BA08F272B7004A47F5 /* tm.test */,
+ F96D43BB08F272B7004A47F5 /* trace.test */,
+ F96D43BC08F272B7004A47F5 /* unixFCmd.test */,
+ F96D43BD08F272B7004A47F5 /* unixFile.test */,
+ F96D43BE08F272B7004A47F5 /* unixInit.test */,
+ F96D43BF08F272B7004A47F5 /* unixNotfy.test */,
+ F96D43C008F272B7004A47F5 /* unknown.test */,
+ F96D43C108F272B7004A47F5 /* unload.test */,
+ F96D43C208F272B7004A47F5 /* uplevel.test */,
+ F96D43C308F272B7004A47F5 /* upvar.test */,
+ F96D43C408F272B7004A47F5 /* utf.test */,
+ F96D43C508F272B7004A47F5 /* util.test */,
+ F96D43C608F272B7004A47F5 /* var.test */,
+ F96D43C708F272B7004A47F5 /* while-old.test */,
+ F96D43C808F272B7004A47F5 /* while.test */,
+ F96D43C908F272B7004A47F5 /* winConsole.test */,
+ F96D43CA08F272B7004A47F5 /* winDde.test */,
+ F96D43CB08F272B7004A47F5 /* winFCmd.test */,
+ F96D43CC08F272B7004A47F5 /* winFile.test */,
+ F96D43CD08F272B7004A47F5 /* winNotify.test */,
+ F96D43CE08F272B7004A47F5 /* winPipe.test */,
+ F96D43CF08F272B7004A47F5 /* winTime.test */,
+ );
+ path = tests;
+ sourceTree = "<group>";
+ };
+ F96D43D008F272B8004A47F5 /* tools */ = {
+ isa = PBXGroup;
+ children = (
+ F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */,
+ F96D43D208F272B8004A47F5 /* configure */,
+ F96D43D308F272B8004A47F5 /* configure.in */,
+ F96D442208F272B8004A47F5 /* eolFix.tcl */,
+ F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */,
+ F96D442508F272B8004A47F5 /* genStubs.tcl */,
+ F96D442708F272B8004A47F5 /* index.tcl */,
+ F96D442808F272B8004A47F5 /* installData.tcl */,
+ F96D442908F272B8004A47F5 /* loadICU.tcl */,
+ F96D442A08F272B8004A47F5 /* Makefile.in */,
+ F96D442B08F272B8004A47F5 /* makeTestCases.tcl */,
+ F96D442C08F272B8004A47F5 /* man2help.tcl */,
+ F96D442D08F272B8004A47F5 /* man2help2.tcl */,
+ F96D442E08F272B8004A47F5 /* man2html.tcl */,
+ F96D442F08F272B8004A47F5 /* man2html1.tcl */,
+ F96D443008F272B8004A47F5 /* man2html2.tcl */,
+ F96D443108F272B8004A47F5 /* man2tcl.c */,
+ F96D443208F272B8004A47F5 /* README */,
+ F96D443308F272B8004A47F5 /* regexpTestLib.tcl */,
+ F96D443408F272B8004A47F5 /* str2c */,
+ F96D443508F272B8004A47F5 /* tcl.hpj.in */,
+ F96D443608F272B8004A47F5 /* tcl.wse.in */,
+ F96D443708F272B9004A47F5 /* tclmin.wse */,
+ F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */,
+ F96D443A08F272B9004A47F5 /* tclZIC.tcl */,
+ F96D443B08F272B9004A47F5 /* uniClass.tcl */,
+ F96D443C08F272B9004A47F5 /* uniParse.tcl */,
+ );
+ path = tools;
+ sourceTree = "<group>";
+ };
+ F96D443E08F272B9004A47F5 /* unix */ = {
+ isa = PBXGroup;
+ children = (
+ F96D444008F272B9004A47F5 /* aclocal.m4 */,
+ F96D444108F272B9004A47F5 /* configure */,
+ F96D444208F272B9004A47F5 /* configure.in */,
+ F96D444308F272B9004A47F5 /* dltest */,
+ F96D444D08F272B9004A47F5 /* install-sh */,
+ F96D444E08F272B9004A47F5 /* installManPage */,
+ F96D444F08F272B9004A47F5 /* ldAix */,
+ F96D445008F272B9004A47F5 /* Makefile.in */,
+ F96D445208F272B9004A47F5 /* README */,
+ F96D445308F272B9004A47F5 /* tcl.m4 */,
+ F96D445408F272B9004A47F5 /* tcl.spec */,
+ F96D445508F272B9004A47F5 /* tclAppInit.c */,
+ F96D445608F272B9004A47F5 /* tclConfig.h.in */,
+ F96D445708F272B9004A47F5 /* tclConfig.sh.in */,
+ F96D445808F272B9004A47F5 /* tclLoadAix.c */,
+ F96D445908F272B9004A47F5 /* tclLoadDl.c */,
+ F96D445B08F272B9004A47F5 /* tclLoadDyld.c */,
+ F96D445C08F272B9004A47F5 /* tclLoadNext.c */,
+ F96D445D08F272B9004A47F5 /* tclLoadOSF.c */,
+ F96D445E08F272B9004A47F5 /* tclLoadShl.c */,
+ F96D445F08F272B9004A47F5 /* tclUnixChan.c */,
+ F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */,
+ F96D446008F272B9004A47F5 /* tclUnixEvent.c */,
+ F96D446108F272B9004A47F5 /* tclUnixFCmd.c */,
+ F96D446208F272B9004A47F5 /* tclUnixFile.c */,
+ F96D446308F272B9004A47F5 /* tclUnixInit.c */,
+ F96D446408F272B9004A47F5 /* tclUnixNotfy.c */,
+ F96D446508F272B9004A47F5 /* tclUnixPipe.c */,
+ F96D446608F272B9004A47F5 /* tclUnixPort.h */,
+ F96D446708F272B9004A47F5 /* tclUnixSock.c */,
+ F96D446808F272B9004A47F5 /* tclUnixTest.c */,
+ F96D446908F272B9004A47F5 /* tclUnixThrd.c */,
+ F96D446A08F272B9004A47F5 /* tclUnixThrd.h */,
+ F96D446B08F272B9004A47F5 /* tclUnixTime.c */,
+ F96D446C08F272B9004A47F5 /* tclXtNotify.c */,
+ F96D446D08F272B9004A47F5 /* tclXtTest.c */,
+ );
+ path = unix;
+ sourceTree = "<group>";
+ };
+ F96D444308F272B9004A47F5 /* dltest */ = {
+ isa = PBXGroup;
+ children = (
+ F96D444408F272B9004A47F5 /* Makefile.in */,
+ F96D444508F272B9004A47F5 /* pkga.c */,
+ F96D444608F272B9004A47F5 /* pkgb.c */,
+ F96D444708F272B9004A47F5 /* pkgc.c */,
+ F96D444808F272B9004A47F5 /* pkgd.c */,
+ F96D444908F272B9004A47F5 /* pkge.c */,
+ F96D444B08F272B9004A47F5 /* pkgua.c */,
+ F96D444C08F272B9004A47F5 /* README */,
+ );
+ path = dltest;
+ sourceTree = "<group>";
+ };
+ F96D446E08F272B9004A47F5 /* win */ = {
+ isa = PBXGroup;
+ children = (
+ F96D447008F272BA004A47F5 /* aclocal.m4 */,
+ F96D447108F272BA004A47F5 /* buildall.vc.bat */,
+ F96D447208F272BA004A47F5 /* cat.c */,
+ F96D447308F272BA004A47F5 /* coffbase.txt */,
+ F96D447408F272BA004A47F5 /* configure */,
+ F96D447508F272BA004A47F5 /* configure.in */,
+ F96D447608F272BA004A47F5 /* makefile.bc */,
+ F96D447708F272BA004A47F5 /* Makefile.in */,
+ F96D447808F272BA004A47F5 /* makefile.vc */,
+ F96D447908F272BA004A47F5 /* nmakehlp.c */,
+ F96D447A08F272BA004A47F5 /* README */,
+ F96D447C08F272BA004A47F5 /* rules.vc */,
+ F96D447D08F272BA004A47F5 /* stub16.c */,
+ F96D447E08F272BA004A47F5 /* tcl.dsp */,
+ F96D447F08F272BA004A47F5 /* tcl.dsw */,
+ F96D448008F272BA004A47F5 /* tcl.hpj.in */,
+ F96D448108F272BA004A47F5 /* tcl.m4 */,
+ F96D448208F272BA004A47F5 /* tcl.rc */,
+ F96D448308F272BA004A47F5 /* tclAppInit.c */,
+ F96D448408F272BA004A47F5 /* tclConfig.sh.in */,
+ F96D448608F272BA004A47F5 /* tclsh.rc */,
+ F96D448708F272BA004A47F5 /* tclWin32Dll.c */,
+ F96D448808F272BA004A47F5 /* tclWinChan.c */,
+ F96D448908F272BA004A47F5 /* tclWinConsole.c */,
+ F96D448A08F272BA004A47F5 /* tclWinDde.c */,
+ F96D448B08F272BA004A47F5 /* tclWinError.c */,
+ F96D448C08F272BA004A47F5 /* tclWinFCmd.c */,
+ F96D448D08F272BA004A47F5 /* tclWinFile.c */,
+ F96D448E08F272BA004A47F5 /* tclWinInit.c */,
+ F96D448F08F272BA004A47F5 /* tclWinInt.h */,
+ F96D449008F272BA004A47F5 /* tclWinLoad.c */,
+ F96D449108F272BA004A47F5 /* tclWinNotify.c */,
+ F96D449208F272BA004A47F5 /* tclWinPipe.c */,
+ F96D449308F272BA004A47F5 /* tclWinPort.h */,
+ F96D449408F272BA004A47F5 /* tclWinReg.c */,
+ F96D449508F272BA004A47F5 /* tclWinSerial.c */,
+ F96D449608F272BA004A47F5 /* tclWinSock.c */,
+ F96D449708F272BA004A47F5 /* tclWinTest.c */,
+ F96D449808F272BA004A47F5 /* tclWinThrd.c */,
+ F96D449908F272BA004A47F5 /* tclWinThrd.h */,
+ F96D449A08F272BA004A47F5 /* tclWinTime.c */,
+ );
+ path = win;
+ sourceTree = "<group>";
+ };
+ F9ECB1110B26521500A28025 /* platform */ = {
+ isa = PBXGroup;
+ children = (
+ F9ECB1120B26521500A28025 /* pkgIndex.tcl */,
+ F9ECB1130B26521500A28025 /* platform.tcl */,
+ F9ECB1140B26521500A28025 /* shell.tcl */,
+ );
+ path = platform;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8DD76FA90486AB0100D96B5E /* tktest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F95CC8B009158F3100EA5ACE /* Build configuration list for PBXNativeTarget "tktest" */;
+ buildPhases = (
+ F9A5C5F508F651A2008AE941 /* ShellScript */,
+ F9A5C5F608F651AB008AE941 /* ShellScript */,
+ F9EA4ADE08FA3B7F00B1F5F0 /* Rez */,
+ 8DD76FAB0486AB0100D96B5E /* Sources */,
+ 8DD76FAD0486AB0100D96B5E /* Frameworks */,
+ F95FA74C0B32CE190072E431 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = tktest;
+ productInstallPath = "$(BINDIR)";
+ productName = tktest;
+ productReference = 8DD76FB20486AB0100D96B5E /* tktest */;
+ productType = "com.apple.product-type.tool";
+ };
+ F97258A50A86873C00096C78 /* tktest-X11 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F97258A80A86873D00096C78 /* Build configuration list for PBXNativeTarget "tktest-X11" */;
+ buildPhases = (
+ F9FD30B40CC1AD070073837D /* ShellScript */,
+ F9FD30B50CC1AD070073837D /* ShellScript */,
+ F9FD30BB0CC1AD070073837D /* Sources */,
+ F9FD31E30CC1AD070073837D /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "tktest-X11";
+ productInstallPath = "$(BINDIR)";
+ productName = tktest;
+ productReference = F9FD31F40CC1AD070073837D /* tktest-X11 */;
+ productType = "com.apple.product-type.tool";
+ };
+ F9E61D16090A3E94002B3151 /* Tk */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F95CC8AB09158F3100EA5ACE /* Build configuration list for PBXNativeTarget "Tk" */;
+ buildPhases = (
+ F97AF02F0B665DA900310EA2 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Tk;
+ productName = Wish;
+ productReference = F9A3084B08F2D4CE00BAE1AB /* Wish.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ BuildIndependentTargetsInParallel = YES;
+ };
+ buildConfigurationList = F95CC8B509158F3100EA5ACE /* Build configuration list for PBXProject "Wish" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 08FB7794FE84155DC02AAC07 /* Wish */;
+ projectDirPath = "";
+ projectRoot = ..;
+ targets = (
+ F9E61D16090A3E94002B3151 /* Tk */,
+ 8DD76FA90486AB0100D96B5E /* tktest */,
+ F97258A50A86873C00096C78 /* tktest-X11 */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXRezBuildPhase section */
+ F9EA4ADE08FA3B7F00B1F5F0 /* Rez */ = {
+ isa = PBXRezBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9EA4AF008FA3BD500B1F5F0 /* tkMacOSXXCursors.r in Rez */,
+ F9EA4AF208FA3BD800B1F5F0 /* tkMacOSXCursors.r in Rez */,
+ F9EA4AF308FA3BDA00B1F5F0 /* tkMacOSXAETE.r in Rez */,
+ F9EA4AF408FA3BDB00B1F5F0 /* tkAboutDlg.r in Rez */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ F95FA74C0B32CE190072E431 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)",
+ "$(REZ_COLLECTOR_DIR)/$(PRODUCT_NAME).rsrc",
+ );
+ outputPaths = (
+ "$(TARGET_TEMP_DIR)/stamp",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "touch -t $(date -r $(expr $(date '+%s') + 5) '+%Y%m%d%H%M.%S') \"${TARGET_TEMP_DIR}/stamp\"\n\n## Xcode bug workaround: Rezzing does not take place for commandline tool targets\n## even when a ResourceManager Resources phase is present, but this script phase's\n## input dependency on the final merged resource file forces the Rezzing.\n";
+ showEnvVarsInLog = 0;
+ };
+ F97AF02F0B665DA900310EA2 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${TARGET_TEMP_DIR}/.none",
+ );
+ outputPaths = (
+ "${TARGET_BUILD_DIR}/${WRAPPER_NAME}",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "gnumake -C \"${TK_SRCROOT}/macosx\" -j \"$(sysctl -n hw.activecpu)\" \"$(echo \"${ACTION}\" | sed -e s/build// -e s/clean/distclean/ -e s/..\\*/\\&-/)${MAKE_TARGET}\" CFLAGS_WARNING=\"${WARNING_CFLAGS}\" CFLAGS_OPTIMIZE=\"-O${GCC_OPTIMIZATION_LEVEL}\" SYMROOT=\"${BUILT_PRODUCTS_DIR}\" OBJ_DIR=\"${OBJECT_FILE_DIR}\" INSTALL_ROOT=\"${DSTROOT}\" PREFIX=\"${PREFIX}\" BINDIR=\"${BINDIR}\" LIBDIR=\"${FRAMEWORK_INSTALL_PATH}\" MANDIR=\"${MANDIR}\" EXTRA_CONFIGURE_ARGS=\"${CONFIGURE_ARGS}\" APPLICATION_INSTALL_PATH=\"${APPLICATION_INSTALL_PATH}\" TCL_BUILD_DIR=\"${TCL_BUILD_DIR}\" TCL_FRAMEWORK_DIR=\"${TCL_FRAMEWORK_DIR}\" ${EXTRA_MAKE_FLAGS}\nresult=$?\nif [ -e \"${BUILT_PRODUCTS_DIR}/tktest\" ]; then\n\trm -f \"${BUILT_PRODUCTS_DIR}/tktest\"\nfi\necho \"Done\"\nrm -f \"${SCRIPT_INPUT_FILE_0}\"\nexit ${result}\n";
+ showEnvVarsInLog = 0;
+ };
+ F9A5C5F508F651A2008AE941 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TCL_SRCROOT)/macosx/configure.ac",
+ "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/tcl.m4",
+ "$(TCL_SRCROOT)/unix/aclocal.m4",
+ "$(TCL_SRCROOT)/unix/tclConfig.sh.in",
+ "$(TCL_SRCROOT)/unix/Makefile.in",
+ "$(TCL_SRCROOT)/unix/dltest/Makefile.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ showEnvVarsInLog = 0;
+ };
+ F9A5C5F608F651AB008AE941 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/tcl.m4",
+ "$(TK_SRCROOT)/unix/aclocal.m4",
+ "$(TK_SRCROOT)/unix/tkConfig.sh.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tk/tkConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ showEnvVarsInLog = 0;
+ };
+ F9FD30B40CC1AD070073837D /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TCL_SRCROOT)/macosx/configure.ac",
+ "$(TCL_SRCROOT)/unix/configure.in",
+ "$(TCL_SRCROOT)/unix/tcl.m4",
+ "$(TCL_SRCROOT)/unix/aclocal.m4",
+ "$(TCL_SRCROOT)/unix/tclConfig.sh.in",
+ "$(TCL_SRCROOT)/unix/Makefile.in",
+ "$(TCL_SRCROOT)/unix/dltest/Makefile.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ showEnvVarsInLog = 0;
+ };
+ F9FD30B50CC1AD070073837D /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/unix/configure.in",
+ "$(TK_SRCROOT)/unix/tcl.m4",
+ "$(TK_SRCROOT)/unix/aclocal.m4",
+ "$(TK_SRCROOT)/unix/tkConfig.sh.in",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/tk/tkConfig.sh",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/bash;
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation --enable-xft --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8DD76FAB0486AB0100D96B5E /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F96D456F08F272BB004A47F5 /* regcomp.c in Sources */,
+ F96D457208F272BB004A47F5 /* regerror.c in Sources */,
+ F96D457508F272BB004A47F5 /* regexec.c in Sources */,
+ F96D457608F272BB004A47F5 /* regfree.c in Sources */,
+ F96D457B08F272BB004A47F5 /* tclAlloc.c in Sources */,
+ F96D457C08F272BB004A47F5 /* tclAsync.c in Sources */,
+ F96D457D08F272BB004A47F5 /* tclBasic.c in Sources */,
+ F96D457E08F272BC004A47F5 /* tclBinary.c in Sources */,
+ F96D457F08F272BC004A47F5 /* tclCkalloc.c in Sources */,
+ F96D458008F272BC004A47F5 /* tclClock.c in Sources */,
+ F96D458108F272BC004A47F5 /* tclCmdAH.c in Sources */,
+ F96D458208F272BC004A47F5 /* tclCmdIL.c in Sources */,
+ F96D458308F272BC004A47F5 /* tclCmdMZ.c in Sources */,
+ F96D458408F272BC004A47F5 /* tclCompCmds.c in Sources */,
+ F96D458508F272BC004A47F5 /* tclCompExpr.c in Sources */,
+ F96D458608F272BC004A47F5 /* tclCompile.c in Sources */,
+ F96D458808F272BC004A47F5 /* tclConfig.c in Sources */,
+ F96D458908F272BC004A47F5 /* tclDate.c in Sources */,
+ F96D458B08F272BC004A47F5 /* tclDictObj.c in Sources */,
+ F96D458C08F272BC004A47F5 /* tclEncoding.c in Sources */,
+ F96D458D08F272BC004A47F5 /* tclEnv.c in Sources */,
+ F96D458E08F272BC004A47F5 /* tclEvent.c in Sources */,
+ F96D458F08F272BC004A47F5 /* tclExecute.c in Sources */,
+ F96D459008F272BC004A47F5 /* tclFCmd.c in Sources */,
+ F96D459108F272BC004A47F5 /* tclFileName.c in Sources */,
+ F96D459308F272BC004A47F5 /* tclGet.c in Sources */,
+ F96D459508F272BC004A47F5 /* tclHash.c in Sources */,
+ F96D459608F272BC004A47F5 /* tclHistory.c in Sources */,
+ F96D459708F272BC004A47F5 /* tclIndexObj.c in Sources */,
+ F96D459B08F272BC004A47F5 /* tclInterp.c in Sources */,
+ F96D459D08F272BC004A47F5 /* tclIO.c in Sources */,
+ F96D459F08F272BC004A47F5 /* tclIOCmd.c in Sources */,
+ F96D45A008F272BC004A47F5 /* tclIOGT.c in Sources */,
+ F96D45A108F272BC004A47F5 /* tclIORChan.c in Sources */,
+ F96D45A208F272BC004A47F5 /* tclIOSock.c in Sources */,
+ F96D45A308F272BC004A47F5 /* tclIOUtil.c in Sources */,
+ F96D45A408F272BC004A47F5 /* tclLink.c in Sources */,
+ F96D45A508F272BC004A47F5 /* tclListObj.c in Sources */,
+ F96D45A608F272BC004A47F5 /* tclLiteral.c in Sources */,
+ F96D45A708F272BC004A47F5 /* tclLoad.c in Sources */,
+ F96D45A908F272BC004A47F5 /* tclMain.c in Sources */,
+ F96D45AA08F272BC004A47F5 /* tclNamesp.c in Sources */,
+ F96D45AB08F272BC004A47F5 /* tclNotify.c in Sources */,
+ F96D45AC08F272BC004A47F5 /* tclObj.c in Sources */,
+ F96D45AD08F272BC004A47F5 /* tclPanic.c in Sources */,
+ F96D45AE08F272BC004A47F5 /* tclParse.c in Sources */,
+ F96D45B008F272BC004A47F5 /* tclPathObj.c in Sources */,
+ F96D45B108F272BC004A47F5 /* tclPipe.c in Sources */,
+ F96D45B208F272BC004A47F5 /* tclPkg.c in Sources */,
+ F96D45B308F272BC004A47F5 /* tclPkgConfig.c in Sources */,
+ F96D45B608F272BC004A47F5 /* tclPosixStr.c in Sources */,
+ F96D45B708F272BC004A47F5 /* tclPreserve.c in Sources */,
+ F96D45B808F272BC004A47F5 /* tclProc.c in Sources */,
+ F96D45B908F272BC004A47F5 /* tclRegexp.c in Sources */,
+ F96D45BB08F272BC004A47F5 /* tclResolve.c in Sources */,
+ F96D45BC08F272BC004A47F5 /* tclResult.c in Sources */,
+ F96D45BD08F272BC004A47F5 /* tclScan.c in Sources */,
+ F96D45BE08F272BC004A47F5 /* tclStringObj.c in Sources */,
+ F96D45C308F272BC004A47F5 /* tclStrToD.c in Sources */,
+ F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */,
+ F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */,
+ F96D45C908F272BC004A47F5 /* tclThread.c in Sources */,
+ F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */,
+ F96D45CB08F272BC004A47F5 /* tclThreadJoin.c in Sources */,
+ F96D45CC08F272BC004A47F5 /* tclThreadStorage.c in Sources */,
+ F96D45CE08F272BC004A47F5 /* tclTimer.c in Sources */,
+ F96D45D008F272BC004A47F5 /* tclTomMathInterface.c in Sources */,
+ F96D45D108F272BC004A47F5 /* tclTrace.c in Sources */,
+ F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */,
+ F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */,
+ F96D45D508F272BC004A47F5 /* tclVar.c in Sources */,
+ F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */,
+ F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */,
+ F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */,
+ F96D48E808F272C3004A47F5 /* bn_mp_add_d.c in Sources */,
+ F9E61D2B090A48A4002B3151 /* bn_mp_and.c in Sources */,
+ F96D48EB08F272C3004A47F5 /* bn_mp_clamp.c in Sources */,
+ F96D48EC08F272C3004A47F5 /* bn_mp_clear.c in Sources */,
+ F96D48ED08F272C3004A47F5 /* bn_mp_clear_multi.c in Sources */,
+ F96D48EE08F272C3004A47F5 /* bn_mp_cmp.c in Sources */,
+ F9E61D28090A481F002B3151 /* bn_mp_cmp_d.c in Sources */,
+ F96D48F008F272C3004A47F5 /* bn_mp_cmp_mag.c in Sources */,
+ F96D48F208F272C3004A47F5 /* bn_mp_copy.c in Sources */,
+ F96D48F308F272C3004A47F5 /* bn_mp_count_bits.c in Sources */,
+ F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */,
+ F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */,
+ F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */,
+ F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */,
+ F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */,
+ F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */,
+ F9E61D2C090A48AC002B3151 /* bn_mp_expt_d.c in Sources */,
+ F96D490508F272C3004A47F5 /* bn_mp_grow.c in Sources */,
+ F96D490608F272C3004A47F5 /* bn_mp_init.c in Sources */,
+ F96D490708F272C3004A47F5 /* bn_mp_init_copy.c in Sources */,
+ F96D490808F272C3004A47F5 /* bn_mp_init_multi.c in Sources */,
+ F96D490908F272C3004A47F5 /* bn_mp_init_set.c in Sources */,
+ F96D490B08F272C3004A47F5 /* bn_mp_init_size.c in Sources */,
+ F96D491008F272C3004A47F5 /* bn_mp_karatsuba_mul.c in Sources */,
+ F96D491108F272C3004A47F5 /* bn_mp_karatsuba_sqr.c in Sources */,
+ F96D491308F272C3004A47F5 /* bn_mp_lshd.c in Sources */,
+ F96D491408F272C3004A47F5 /* bn_mp_mod.c in Sources */,
+ F96D491508F272C3004A47F5 /* bn_mp_mod_2d.c in Sources */,
+ F96D491A08F272C3004A47F5 /* bn_mp_mul.c in Sources */,
+ F96D491B08F272C3004A47F5 /* bn_mp_mul_2.c in Sources */,
+ F96D491C08F272C3004A47F5 /* bn_mp_mul_2d.c in Sources */,
+ F96D491D08F272C3004A47F5 /* bn_mp_mul_d.c in Sources */,
+ F9E61D29090A486C002B3151 /* bn_mp_neg.c in Sources */,
+ F9E61D2E090A48BF002B3151 /* bn_mp_or.c in Sources */,
+ F96D492908F272C3004A47F5 /* bn_mp_radix_size.c in Sources */,
+ F96D492A08F272C3004A47F5 /* bn_mp_radix_smap.c in Sources */,
+ F96D492C08F272C3004A47F5 /* bn_mp_read_radix.c in Sources */,
+ F96D493708F272C3004A47F5 /* bn_mp_rshd.c in Sources */,
+ F96D493808F272C3004A47F5 /* bn_mp_set.c in Sources */,
+ F9E61D2F090A48C7002B3151 /* bn_mp_shrink.c in Sources */,
+ F96D493C08F272C3004A47F5 /* bn_mp_sqr.c in Sources */,
+ F9E61D2A090A4891002B3151 /* bn_mp_sqrt.c in Sources */,
+ F96D493F08F272C3004A47F5 /* bn_mp_sub.c in Sources */,
+ F96D494008F272C3004A47F5 /* bn_mp_sub_d.c in Sources */,
+ F9E61D30090A48E2002B3151 /* bn_mp_to_unsigned_bin_n.c in Sources */,
+ F9E61D31090A48F9002B3151 /* bn_mp_to_unsigned_bin.c in Sources */,
+ F96D494608F272C3004A47F5 /* bn_mp_toom_mul.c in Sources */,
+ F96D494708F272C3004A47F5 /* bn_mp_toom_sqr.c in Sources */,
+ F96D494908F272C3004A47F5 /* bn_mp_toradix_n.c in Sources */,
+ F9E61D32090A48FA002B3151 /* bn_mp_unsigned_bin_size.c in Sources */,
+ F9E61D2D090A48BB002B3151 /* bn_mp_xor.c in Sources */,
+ F96D494C08F272C3004A47F5 /* bn_mp_zero.c in Sources */,
+ F96D494E08F272C3004A47F5 /* bn_reverse.c in Sources */,
+ F96D494F08F272C3004A47F5 /* bn_s_mp_add.c in Sources */,
+ F96D495108F272C3004A47F5 /* bn_s_mp_mul_digs.c in Sources */,
+ F96D495308F272C3004A47F5 /* bn_s_mp_sqr.c in Sources */,
+ F96D495408F272C3004A47F5 /* bn_s_mp_sub.c in Sources */,
+ F96D495508F272C3004A47F5 /* bncore.c in Sources */,
+ F96D49A908F272C4004A47F5 /* tclMacOSXBundle.c in Sources */,
+ F96D49AD08F272C4004A47F5 /* tclMacOSXFCmd.c in Sources */,
+ F96D49AE08F272C4004A47F5 /* tclMacOSXNotify.c in Sources */,
+ F96D4AC608F272C9004A47F5 /* tclLoadDyld.c in Sources */,
+ F96D4ACA08F272C9004A47F5 /* tclUnixChan.c in Sources */,
+ F9FC77B80AB29E9100B7077D /* tclUnixCompat.c in Sources */,
+ F96D4ACB08F272C9004A47F5 /* tclUnixEvent.c in Sources */,
+ F96D4ACC08F272C9004A47F5 /* tclUnixFCmd.c in Sources */,
+ F96D4ACD08F272C9004A47F5 /* tclUnixFile.c in Sources */,
+ F96D4ACE08F272C9004A47F5 /* tclUnixInit.c in Sources */,
+ F96D4ACF08F272C9004A47F5 /* tclUnixNotfy.c in Sources */,
+ F96D4AD008F272C9004A47F5 /* tclUnixPipe.c in Sources */,
+ F96D4AD208F272CA004A47F5 /* tclUnixSock.c in Sources */,
+ F96D4AD408F272CA004A47F5 /* tclUnixThrd.c in Sources */,
+ F96D4AD608F272CA004A47F5 /* tclUnixTime.c in Sources */,
+ F9F4415E0C8BAE6F00BCCD67 /* tclDTrace.d in Sources */,
+ F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */,
+ F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */,
+ F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */,
+ F966BDD308F27A3F005CB29B /* tkBind.c in Sources */,
+ F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */,
+ F966BDD508F27A3F005CB29B /* tkButton.c in Sources */,
+ F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */,
+ F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */,
+ F966BDDA08F27A3F005CB29B /* tkCanvBmap.c in Sources */,
+ F966BDDB08F27A3F005CB29B /* tkCanvImg.c in Sources */,
+ F966BDDC08F27A3F005CB29B /* tkCanvLine.c in Sources */,
+ F966BDDD08F27A3F005CB29B /* tkCanvPoly.c in Sources */,
+ F966BDDE08F27A3F005CB29B /* tkCanvPs.c in Sources */,
+ F966BDE008F27A3F005CB29B /* tkCanvText.c in Sources */,
+ F966BDE108F27A3F005CB29B /* tkCanvUtil.c in Sources */,
+ F966BDE208F27A3F005CB29B /* tkCanvWind.c in Sources */,
+ F966BDE308F27A3F005CB29B /* tkClipboard.c in Sources */,
+ F966BDE408F27A3F005CB29B /* tkCmds.c in Sources */,
+ F966BDE508F27A3F005CB29B /* tkColor.c in Sources */,
+ F966BDE708F27A3F005CB29B /* tkConfig.c in Sources */,
+ F966BDE808F27A3F005CB29B /* tkConsole.c in Sources */,
+ F966BDE908F27A3F005CB29B /* tkCursor.c in Sources */,
+ F966BDEB08F27A3F005CB29B /* tkEntry.c in Sources */,
+ F966BDED08F27A3F005CB29B /* tkError.c in Sources */,
+ F966BDEE08F27A3F005CB29B /* tkEvent.c in Sources */,
+ F966BDEF08F27A3F005CB29B /* tkFileFilter.c in Sources */,
+ F966BDF108F27A3F005CB29B /* tkFocus.c in Sources */,
+ F966BDF208F27A3F005CB29B /* tkFont.c in Sources */,
+ F966BDF408F27A3F005CB29B /* tkFrame.c in Sources */,
+ F966BDF508F27A3F005CB29B /* tkGC.c in Sources */,
+ F966BDF608F27A3F005CB29B /* tkGeometry.c in Sources */,
+ F966BDF708F27A3F005CB29B /* tkGet.c in Sources */,
+ F966BDF808F27A3F005CB29B /* tkGrab.c in Sources */,
+ F966BDF908F27A3F005CB29B /* tkGrid.c in Sources */,
+ F966BDFA08F27A3F005CB29B /* tkImage.c in Sources */,
+ F966BDFB08F27A3F005CB29B /* tkImgBmap.c in Sources */,
+ F966BDFC08F27A3F005CB29B /* tkImgGIF.c in Sources */,
+ F966BDFD08F27A3F005CB29B /* tkImgPhoto.c in Sources */,
+ F966BDFE08F27A3F005CB29B /* tkImgPPM.c in Sources */,
+ F966BE0708F27A3F005CB29B /* tkListbox.c in Sources */,
+ F966BE0808F27A3F005CB29B /* tkMacWinMenu.c in Sources */,
+ F966BE0908F27A3F005CB29B /* tkMain.c in Sources */,
+ F966BE0A08F27A3F005CB29B /* tkMenu.c in Sources */,
+ F966BE0C08F27A3F005CB29B /* tkMenubutton.c in Sources */,
+ F966BE0E08F27A3F005CB29B /* tkMenuDraw.c in Sources */,
+ F966BE0F08F27A3F005CB29B /* tkMessage.c in Sources */,
+ F966BE1008F27A3F005CB29B /* tkObj.c in Sources */,
+ F966BE1108F27A3F005CB29B /* tkOldConfig.c in Sources */,
+ F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */,
+ F966BE1208F27A3F005CB29B /* tkOption.c in Sources */,
+ F966BE1308F27A3F005CB29B /* tkPack.c in Sources */,
+ F966BE1408F27A3F005CB29B /* tkPanedWindow.c in Sources */,
+ F966BE1508F27A3F005CB29B /* tkPlace.c in Sources */,
+ F966BE1708F27A3F005CB29B /* tkPointer.c in Sources */,
+ F966BE1908F27A3F005CB29B /* tkRectOval.c in Sources */,
+ F966BE1A08F27A3F005CB29B /* tkScale.c in Sources */,
+ F966BE1C08F27A40005CB29B /* tkScrollbar.c in Sources */,
+ F966BE1E08F27A40005CB29B /* tkSelect.c in Sources */,
+ F966BE2008F27A40005CB29B /* tkSquare.c in Sources */,
+ F966BE2208F27A40005CB29B /* tkStubInit.c in Sources */,
+ F966BE2308F27A40005CB29B /* tkStubLib.c in Sources */,
+ F966BE2408F27A40005CB29B /* tkStyle.c in Sources */,
+ F966BE2508F27A40005CB29B /* tkTest.c in Sources */,
+ F966BE2608F27A40005CB29B /* tkText.c in Sources */,
+ F966BE2808F27A40005CB29B /* tkTextBTree.c in Sources */,
+ F966BE2908F27A40005CB29B /* tkTextDisp.c in Sources */,
+ F966BE2B08F27A40005CB29B /* tkTextImage.c in Sources */,
+ F966BE2C08F27A40005CB29B /* tkTextIndex.c in Sources */,
+ F966BE2D08F27A40005CB29B /* tkTextMark.c in Sources */,
+ F966BE2E08F27A40005CB29B /* tkTextTag.c in Sources */,
+ F966BE2F08F27A40005CB29B /* tkTextWind.c in Sources */,
+ F966BE3008F27A40005CB29B /* tkTrig.c in Sources */,
+ F966BE3108F27A40005CB29B /* tkUndo.c in Sources */,
+ F966BE3308F27A40005CB29B /* tkUtil.c in Sources */,
+ F966BE3408F27A40005CB29B /* tkVisual.c in Sources */,
+ F966BE3508F27A40005CB29B /* tkWindow.c in Sources */,
+ F96888050AF786D5000797B5 /* ttkBlink.c in Sources */,
+ F96888060AF786D5000797B5 /* ttkButton.c in Sources */,
+ F96888070AF786D5000797B5 /* ttkCache.c in Sources */,
+ F96888080AF786D5000797B5 /* ttkClamTheme.c in Sources */,
+ F96888090AF786D5000797B5 /* ttkClassicTheme.c in Sources */,
+ F968880A0AF786D5000797B5 /* ttkDefaultTheme.c in Sources */,
+ F968880B0AF786D5000797B5 /* ttkElements.c in Sources */,
+ F968880C0AF786D5000797B5 /* ttkEntry.c in Sources */,
+ F968880D0AF786D5000797B5 /* ttkFrame.c in Sources */,
+ F968880E0AF786D5000797B5 /* ttkImage.c in Sources */,
+ F968880F0AF786D5000797B5 /* ttkInit.c in Sources */,
+ F96888100AF786D5000797B5 /* ttkLabel.c in Sources */,
+ F96888110AF786D5000797B5 /* ttkLayout.c in Sources */,
+ F96888120AF786D5000797B5 /* ttkManager.c in Sources */,
+ F96888130AF786D5000797B5 /* ttkNotebook.c in Sources */,
+ F96888140AF786D5000797B5 /* ttkPanedwindow.c in Sources */,
+ F96888150AF786D5000797B5 /* ttkProgress.c in Sources */,
+ F96888160AF786D5000797B5 /* ttkScale.c in Sources */,
+ F96888170AF786D5000797B5 /* ttkScroll.c in Sources */,
+ F96888180AF786D5000797B5 /* ttkScrollbar.c in Sources */,
+ F96888190AF786D5000797B5 /* ttkSeparator.c in Sources */,
+ F968881A0AF786D5000797B5 /* ttkSquare.c in Sources */,
+ F968881B0AF786D5000797B5 /* ttkState.c in Sources */,
+ F968881C0AF786D5000797B5 /* ttkStubInit.c in Sources */,
+ F968881D0AF786D5000797B5 /* ttkStubLib.c in Sources */,
+ F968881E0AF786D5000797B5 /* ttkTagSet.c in Sources */,
+ F968881F0AF786D5000797B5 /* ttkTheme.c in Sources */,
+ F96888200AF786D5000797B5 /* ttkTrace.c in Sources */,
+ F96888210AF786D5000797B5 /* ttkTrack.c in Sources */,
+ F96888220AF786D5000797B5 /* ttkTreeview.c in Sources */,
+ F96888230AF786D5000797B5 /* ttkWidget.c in Sources */,
+ F966BEDB08F27A40005CB29B /* tkMacOSXBitmap.c in Sources */,
+ F966BEDC08F27A40005CB29B /* tkMacOSXButton.c in Sources */,
+ F966BEDD08F27A40005CB29B /* tkMacOSXCarbonEvents.c in Sources */,
+ F966BEDE08F27A40005CB29B /* tkMacOSXClipboard.c in Sources */,
+ F966BEDF08F27A40005CB29B /* tkMacOSXColor.c in Sources */,
+ F966BEE008F27A40005CB29B /* tkMacOSXConfig.c in Sources */,
+ F966BEE108F27A40005CB29B /* tkMacOSXCursor.c in Sources */,
+ F966BEE308F27A40005CB29B /* tkMacOSXDebug.c in Sources */,
+ F966BEE608F27A40005CB29B /* tkMacOSXDialog.c in Sources */,
+ F966BEE708F27A40005CB29B /* tkMacOSXDraw.c in Sources */,
+ F966BEE808F27A40005CB29B /* tkMacOSXEmbed.c in Sources */,
+ F966BEE908F27A40005CB29B /* tkMacOSXEntry.c in Sources */,
+ F966BEEA08F27A40005CB29B /* tkMacOSXEvent.c in Sources */,
+ F966BEEC08F27A40005CB29B /* tkMacOSXFont.c in Sources */,
+ F966BEED08F27A40005CB29B /* tkMacOSXHLEvents.c in Sources */,
+ F966BEEE08F27A40005CB29B /* tkMacOSXInit.c in Sources */,
+ F966BEF108F27A40005CB29B /* tkMacOSXKeyboard.c in Sources */,
+ F966BEF208F27A40005CB29B /* tkMacOSXKeyEvent.c in Sources */,
+ F966BEF308F27A40005CB29B /* tkMacOSXMenu.c in Sources */,
+ F966BEF608F27A40005CB29B /* tkMacOSXMenubutton.c in Sources */,
+ F966BEF708F27A40005CB29B /* tkMacOSXMenus.c in Sources */,
+ F966BEF808F27A40005CB29B /* tkMacOSXMouseEvent.c in Sources */,
+ F966BEF908F27A40005CB29B /* tkMacOSXNotify.c in Sources */,
+ F966BF0108F27A40005CB29B /* tkMacOSXRegion.c in Sources */,
+ F966BF0308F27A40005CB29B /* tkMacOSXScrlbr.c in Sources */,
+ F966BF0408F27A40005CB29B /* tkMacOSXSend.c in Sources */,
+ F966BF0508F27A40005CB29B /* tkMacOSXSubwindows.c in Sources */,
+ F966BF0608F27A40005CB29B /* tkMacOSXTest.c in Sources */,
+ F966BF0708F27A40005CB29B /* tkMacOSXWindowEvent.c in Sources */,
+ F966BF0808F27A40005CB29B /* tkMacOSXWm.c in Sources */,
+ F966BF0B08F27A40005CB29B /* tkMacOSXXStubs.c in Sources */,
+ F96888850AF78938000797B5 /* ttkMacOSXTheme.c in Sources */,
+ F966BF7F08F27A41005CB29B /* tkAppInit.c in Sources */,
+ F966BF8308F27A41005CB29B /* tkUnix3d.c in Sources */,
+ F966BF9608F27A41005CB29B /* tkUnixScale.c in Sources */,
+ F966C02A08F27A42005CB29B /* xcolors.c in Sources */,
+ F966C02B08F27A42005CB29B /* xdraw.c in Sources */,
+ F966C02C08F27A42005CB29B /* xgc.c in Sources */,
+ F966C02D08F27A42005CB29B /* ximage.c in Sources */,
+ F966C02E08F27A42005CB29B /* xutil.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F9FD30BB0CC1AD070073837D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9FD30BC0CC1AD070073837D /* regcomp.c in Sources */,
+ F9FD30BD0CC1AD070073837D /* regerror.c in Sources */,
+ F9FD30BE0CC1AD070073837D /* regexec.c in Sources */,
+ F9FD30BF0CC1AD070073837D /* regfree.c in Sources */,
+ F9FD30C00CC1AD070073837D /* tclAlloc.c in Sources */,
+ F9FD30C10CC1AD070073837D /* tclAsync.c in Sources */,
+ F9FD30C20CC1AD070073837D /* tclBasic.c in Sources */,
+ F9FD30C30CC1AD070073837D /* tclBinary.c in Sources */,
+ F9FD30C40CC1AD070073837D /* tclCkalloc.c in Sources */,
+ F9FD30C50CC1AD070073837D /* tclClock.c in Sources */,
+ F9FD30C60CC1AD070073837D /* tclCmdAH.c in Sources */,
+ F9FD30C70CC1AD070073837D /* tclCmdIL.c in Sources */,
+ F9FD30C80CC1AD070073837D /* tclCmdMZ.c in Sources */,
+ F9FD30C90CC1AD070073837D /* tclCompCmds.c in Sources */,
+ F9FD30CA0CC1AD070073837D /* tclCompExpr.c in Sources */,
+ F9FD30CB0CC1AD070073837D /* tclCompile.c in Sources */,
+ F9FD30CC0CC1AD070073837D /* tclConfig.c in Sources */,
+ F9FD30CD0CC1AD070073837D /* tclDate.c in Sources */,
+ F9FD30CE0CC1AD070073837D /* tclDictObj.c in Sources */,
+ F9FD30CF0CC1AD070073837D /* tclEncoding.c in Sources */,
+ F9FD30D00CC1AD070073837D /* tclEnv.c in Sources */,
+ F9FD30D10CC1AD070073837D /* tclEvent.c in Sources */,
+ F9FD30D20CC1AD070073837D /* tclExecute.c in Sources */,
+ F9FD30D30CC1AD070073837D /* tclFCmd.c in Sources */,
+ F9FD30D40CC1AD070073837D /* tclFileName.c in Sources */,
+ F9FD30D50CC1AD070073837D /* tclGet.c in Sources */,
+ F9FD30D60CC1AD070073837D /* tclHash.c in Sources */,
+ F9FD30D70CC1AD070073837D /* tclHistory.c in Sources */,
+ F9FD30D80CC1AD070073837D /* tclIndexObj.c in Sources */,
+ F9FD30D90CC1AD070073837D /* tclInterp.c in Sources */,
+ F9FD30DA0CC1AD070073837D /* tclIO.c in Sources */,
+ F9FD30DB0CC1AD070073837D /* tclIOCmd.c in Sources */,
+ F9FD30DC0CC1AD070073837D /* tclIOGT.c in Sources */,
+ F9FD30DD0CC1AD070073837D /* tclIORChan.c in Sources */,
+ F9FD30DE0CC1AD070073837D /* tclIOSock.c in Sources */,
+ F9FD30DF0CC1AD070073837D /* tclIOUtil.c in Sources */,
+ F9FD30E00CC1AD070073837D /* tclLink.c in Sources */,
+ F9FD30E10CC1AD070073837D /* tclListObj.c in Sources */,
+ F9FD30E20CC1AD070073837D /* tclLiteral.c in Sources */,
+ F9FD30E30CC1AD070073837D /* tclLoad.c in Sources */,
+ F9FD30E40CC1AD070073837D /* tclMain.c in Sources */,
+ F9FD30E50CC1AD070073837D /* tclNamesp.c in Sources */,
+ F9FD30E60CC1AD070073837D /* tclNotify.c in Sources */,
+ F9FD30E70CC1AD070073837D /* tclObj.c in Sources */,
+ F9FD30E80CC1AD070073837D /* tclPanic.c in Sources */,
+ F9FD30E90CC1AD070073837D /* tclParse.c in Sources */,
+ F9FD30EA0CC1AD070073837D /* tclPathObj.c in Sources */,
+ F9FD30EB0CC1AD070073837D /* tclPipe.c in Sources */,
+ F9FD30EC0CC1AD070073837D /* tclPkg.c in Sources */,
+ F9FD30ED0CC1AD070073837D /* tclPkgConfig.c in Sources */,
+ F9FD30EE0CC1AD070073837D /* tclPosixStr.c in Sources */,
+ F9FD30EF0CC1AD070073837D /* tclPreserve.c in Sources */,
+ F9FD30F00CC1AD070073837D /* tclProc.c in Sources */,
+ F9FD30F10CC1AD070073837D /* tclRegexp.c in Sources */,
+ F9FD30F20CC1AD070073837D /* tclResolve.c in Sources */,
+ F9FD30F30CC1AD070073837D /* tclResult.c in Sources */,
+ F9FD30F40CC1AD070073837D /* tclScan.c in Sources */,
+ F9FD30F50CC1AD070073837D /* tclStringObj.c in Sources */,
+ F9FD30F60CC1AD070073837D /* tclStrToD.c in Sources */,
+ F9FD30F70CC1AD070073837D /* tclStubInit.c in Sources */,
+ F9FD30F80CC1AD070073837D /* tclStubLib.c in Sources */,
+ F9FD30F90CC1AD070073837D /* tclThread.c in Sources */,
+ F9FD30FA0CC1AD070073837D /* tclThreadAlloc.c in Sources */,
+ F9FD30FB0CC1AD070073837D /* tclThreadJoin.c in Sources */,
+ F9FD30FC0CC1AD070073837D /* tclThreadStorage.c in Sources */,
+ F9FD30FD0CC1AD070073837D /* tclTimer.c in Sources */,
+ F9FD30FE0CC1AD070073837D /* tclTomMathInterface.c in Sources */,
+ F9FD30FF0CC1AD070073837D /* tclTrace.c in Sources */,
+ F9FD31000CC1AD070073837D /* tclUtf.c in Sources */,
+ F9FD31010CC1AD070073837D /* tclUtil.c in Sources */,
+ F9FD31020CC1AD070073837D /* tclVar.c in Sources */,
+ F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */,
+ F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */,
+ F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */,
+ F9FD31060CC1AD070073837D /* bn_mp_add_d.c in Sources */,
+ F9FD31070CC1AD070073837D /* bn_mp_and.c in Sources */,
+ F9FD31080CC1AD070073837D /* bn_mp_clamp.c in Sources */,
+ F9FD31090CC1AD070073837D /* bn_mp_clear.c in Sources */,
+ F9FD310A0CC1AD070073837D /* bn_mp_clear_multi.c in Sources */,
+ F9FD310B0CC1AD070073837D /* bn_mp_cmp.c in Sources */,
+ F9FD310C0CC1AD070073837D /* bn_mp_cmp_d.c in Sources */,
+ F9FD310D0CC1AD070073837D /* bn_mp_cmp_mag.c in Sources */,
+ F9FD310E0CC1AD070073837D /* bn_mp_copy.c in Sources */,
+ F9FD310F0CC1AD070073837D /* bn_mp_count_bits.c in Sources */,
+ F9FD31100CC1AD070073837D /* bn_mp_div.c in Sources */,
+ F9FD31110CC1AD070073837D /* bn_mp_div_2.c in Sources */,
+ F9FD31120CC1AD070073837D /* bn_mp_div_2d.c in Sources */,
+ F9FD31130CC1AD070073837D /* bn_mp_div_3.c in Sources */,
+ F9FD31140CC1AD070073837D /* bn_mp_div_d.c in Sources */,
+ F9FD31150CC1AD070073837D /* bn_mp_exch.c in Sources */,
+ F9FD31160CC1AD070073837D /* bn_mp_expt_d.c in Sources */,
+ F9FD31170CC1AD070073837D /* bn_mp_grow.c in Sources */,
+ F9FD31180CC1AD070073837D /* bn_mp_init.c in Sources */,
+ F9FD31190CC1AD070073837D /* bn_mp_init_copy.c in Sources */,
+ F9FD311A0CC1AD070073837D /* bn_mp_init_multi.c in Sources */,
+ F9FD311B0CC1AD070073837D /* bn_mp_init_set.c in Sources */,
+ F9FD311C0CC1AD070073837D /* bn_mp_init_size.c in Sources */,
+ F9FD311D0CC1AD070073837D /* bn_mp_karatsuba_mul.c in Sources */,
+ F9FD311E0CC1AD070073837D /* bn_mp_karatsuba_sqr.c in Sources */,
+ F9FD311F0CC1AD070073837D /* bn_mp_lshd.c in Sources */,
+ F9FD31200CC1AD070073837D /* bn_mp_mod.c in Sources */,
+ F9FD31210CC1AD070073837D /* bn_mp_mod_2d.c in Sources */,
+ F9FD31220CC1AD070073837D /* bn_mp_mul.c in Sources */,
+ F9FD31230CC1AD070073837D /* bn_mp_mul_2.c in Sources */,
+ F9FD31240CC1AD070073837D /* bn_mp_mul_2d.c in Sources */,
+ F9FD31250CC1AD070073837D /* bn_mp_mul_d.c in Sources */,
+ F9FD31260CC1AD070073837D /* bn_mp_neg.c in Sources */,
+ F9FD31270CC1AD070073837D /* bn_mp_or.c in Sources */,
+ F9FD31280CC1AD070073837D /* bn_mp_radix_size.c in Sources */,
+ F9FD31290CC1AD070073837D /* bn_mp_radix_smap.c in Sources */,
+ F9FD312A0CC1AD070073837D /* bn_mp_read_radix.c in Sources */,
+ F9FD312B0CC1AD070073837D /* bn_mp_rshd.c in Sources */,
+ F9FD312C0CC1AD070073837D /* bn_mp_set.c in Sources */,
+ F9FD312D0CC1AD070073837D /* bn_mp_shrink.c in Sources */,
+ F9FD312E0CC1AD070073837D /* bn_mp_sqr.c in Sources */,
+ F9FD312F0CC1AD070073837D /* bn_mp_sqrt.c in Sources */,
+ F9FD31300CC1AD070073837D /* bn_mp_sub.c in Sources */,
+ F9FD31310CC1AD070073837D /* bn_mp_sub_d.c in Sources */,
+ F9FD31320CC1AD070073837D /* bn_mp_to_unsigned_bin_n.c in Sources */,
+ F9FD31330CC1AD070073837D /* bn_mp_to_unsigned_bin.c in Sources */,
+ F9FD31340CC1AD070073837D /* bn_mp_toom_mul.c in Sources */,
+ F9FD31350CC1AD070073837D /* bn_mp_toom_sqr.c in Sources */,
+ F9FD31360CC1AD070073837D /* bn_mp_toradix_n.c in Sources */,
+ F9FD31370CC1AD070073837D /* bn_mp_unsigned_bin_size.c in Sources */,
+ F9FD31380CC1AD070073837D /* bn_mp_xor.c in Sources */,
+ F9FD31390CC1AD070073837D /* bn_mp_zero.c in Sources */,
+ F9FD313A0CC1AD070073837D /* bn_reverse.c in Sources */,
+ F9FD313B0CC1AD070073837D /* bn_s_mp_add.c in Sources */,
+ F9FD313C0CC1AD070073837D /* bn_s_mp_mul_digs.c in Sources */,
+ F9FD313D0CC1AD070073837D /* bn_s_mp_sqr.c in Sources */,
+ F9FD313E0CC1AD070073837D /* bn_s_mp_sub.c in Sources */,
+ F9FD313F0CC1AD070073837D /* bncore.c in Sources */,
+ F9FD31400CC1AD070073837D /* tclMacOSXBundle.c in Sources */,
+ F9FD31410CC1AD070073837D /* tclMacOSXFCmd.c in Sources */,
+ F9FD31420CC1AD070073837D /* tclMacOSXNotify.c in Sources */,
+ F9FD31430CC1AD070073837D /* tclLoadDyld.c in Sources */,
+ F9FD31440CC1AD070073837D /* tclUnixChan.c in Sources */,
+ F9FD31450CC1AD070073837D /* tclUnixCompat.c in Sources */,
+ F9FD31460CC1AD070073837D /* tclUnixEvent.c in Sources */,
+ F9FD31470CC1AD070073837D /* tclUnixFCmd.c in Sources */,
+ F9FD31480CC1AD070073837D /* tclUnixFile.c in Sources */,
+ F9FD31490CC1AD070073837D /* tclUnixInit.c in Sources */,
+ F9FD314A0CC1AD070073837D /* tclUnixNotfy.c in Sources */,
+ F9FD314B0CC1AD070073837D /* tclUnixPipe.c in Sources */,
+ F9FD314C0CC1AD070073837D /* tclUnixSock.c in Sources */,
+ F9FD314D0CC1AD070073837D /* tclUnixThrd.c in Sources */,
+ F9FD314E0CC1AD070073837D /* tclUnixTime.c in Sources */,
+ F9FD31E20CC1AD070073837D /* tclDTrace.d in Sources */,
+ F9FD314F0CC1AD070073837D /* tk3d.c in Sources */,
+ F9FD31500CC1AD070073837D /* tkArgv.c in Sources */,
+ F9FD31510CC1AD070073837D /* tkAtom.c in Sources */,
+ F9FD31520CC1AD070073837D /* tkBind.c in Sources */,
+ F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */,
+ F9FD31540CC1AD070073837D /* tkButton.c in Sources */,
+ F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */,
+ F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */,
+ F9FD31570CC1AD070073837D /* tkCanvBmap.c in Sources */,
+ F9FD31580CC1AD070073837D /* tkCanvImg.c in Sources */,
+ F9FD31590CC1AD070073837D /* tkCanvLine.c in Sources */,
+ F9FD315A0CC1AD070073837D /* tkCanvPoly.c in Sources */,
+ F9FD315B0CC1AD070073837D /* tkCanvPs.c in Sources */,
+ F9FD315C0CC1AD070073837D /* tkCanvText.c in Sources */,
+ F9FD315D0CC1AD070073837D /* tkCanvUtil.c in Sources */,
+ F9FD315E0CC1AD070073837D /* tkCanvWind.c in Sources */,
+ F9FD315F0CC1AD070073837D /* tkClipboard.c in Sources */,
+ F9FD31600CC1AD070073837D /* tkCmds.c in Sources */,
+ F9FD31610CC1AD070073837D /* tkColor.c in Sources */,
+ F9FD31620CC1AD070073837D /* tkConfig.c in Sources */,
+ F9FD31630CC1AD070073837D /* tkConsole.c in Sources */,
+ F9FD31640CC1AD070073837D /* tkCursor.c in Sources */,
+ F9FD31650CC1AD070073837D /* tkEntry.c in Sources */,
+ F9FD31660CC1AD070073837D /* tkError.c in Sources */,
+ F9FD31670CC1AD070073837D /* tkEvent.c in Sources */,
+ F9FD31680CC1AD070073837D /* tkFileFilter.c in Sources */,
+ F9FD31690CC1AD070073837D /* tkFocus.c in Sources */,
+ F9FD316A0CC1AD070073837D /* tkFont.c in Sources */,
+ F9FD316B0CC1AD070073837D /* tkFrame.c in Sources */,
+ F9FD316C0CC1AD070073837D /* tkGC.c in Sources */,
+ F9FD316D0CC1AD070073837D /* tkGeometry.c in Sources */,
+ F9FD316E0CC1AD070073837D /* tkGet.c in Sources */,
+ F9FD316F0CC1AD070073837D /* tkGrab.c in Sources */,
+ F9FD31700CC1AD070073837D /* tkGrid.c in Sources */,
+ F9FD31710CC1AD070073837D /* tkImage.c in Sources */,
+ F9FD31720CC1AD070073837D /* tkImgBmap.c in Sources */,
+ F9FD31730CC1AD070073837D /* tkImgGIF.c in Sources */,
+ F9FD31740CC1AD070073837D /* tkImgPhoto.c in Sources */,
+ F9FD31750CC1AD070073837D /* tkImgPPM.c in Sources */,
+ F9FD31760CC1AD070073837D /* tkListbox.c in Sources */,
+ F9FD31770CC1AD070073837D /* tkMacWinMenu.c in Sources */,
+ F9FD31780CC1AD070073837D /* tkMain.c in Sources */,
+ F9FD31790CC1AD070073837D /* tkMenu.c in Sources */,
+ F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */,
+ F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */,
+ F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */,
+ F9FD317D0CC1AD070073837D /* tkObj.c in Sources */,
+ F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */,
+ F9FD317F0CC1AD070073837D /* tkOldTest.c in Sources */,
+ F9FD31800CC1AD070073837D /* tkOption.c in Sources */,
+ F9FD31810CC1AD070073837D /* tkPack.c in Sources */,
+ F9FD31820CC1AD070073837D /* tkPanedWindow.c in Sources */,
+ F9FD31830CC1AD070073837D /* tkPlace.c in Sources */,
+ F9FD31850CC1AD070073837D /* tkRectOval.c in Sources */,
+ F9FD31860CC1AD070073837D /* tkScale.c in Sources */,
+ F9FD31870CC1AD070073837D /* tkScrollbar.c in Sources */,
+ F9FD31880CC1AD070073837D /* tkSelect.c in Sources */,
+ F9FD31890CC1AD070073837D /* tkSquare.c in Sources */,
+ F9FD318A0CC1AD070073837D /* tkStubInit.c in Sources */,
+ F9FD318B0CC1AD070073837D /* tkStubLib.c in Sources */,
+ F9FD318C0CC1AD070073837D /* tkStyle.c in Sources */,
+ F9FD318D0CC1AD070073837D /* tkTest.c in Sources */,
+ F9FD318E0CC1AD070073837D /* tkText.c in Sources */,
+ F9FD318F0CC1AD070073837D /* tkTextBTree.c in Sources */,
+ F9FD31900CC1AD070073837D /* tkTextDisp.c in Sources */,
+ F9FD31910CC1AD070073837D /* tkTextImage.c in Sources */,
+ F9FD31920CC1AD070073837D /* tkTextIndex.c in Sources */,
+ F9FD31930CC1AD070073837D /* tkTextMark.c in Sources */,
+ F9FD31940CC1AD070073837D /* tkTextTag.c in Sources */,
+ F9FD31950CC1AD070073837D /* tkTextWind.c in Sources */,
+ F9FD31960CC1AD070073837D /* tkTrig.c in Sources */,
+ F9FD31970CC1AD070073837D /* tkUndo.c in Sources */,
+ F9FD31980CC1AD070073837D /* tkUtil.c in Sources */,
+ F9FD31990CC1AD070073837D /* tkVisual.c in Sources */,
+ F9FD319A0CC1AD070073837D /* tkWindow.c in Sources */,
+ F9FD319B0CC1AD070073837D /* ttkBlink.c in Sources */,
+ F9FD319C0CC1AD070073837D /* ttkButton.c in Sources */,
+ F9FD319D0CC1AD070073837D /* ttkCache.c in Sources */,
+ F9FD319E0CC1AD070073837D /* ttkClamTheme.c in Sources */,
+ F9FD319F0CC1AD070073837D /* ttkClassicTheme.c in Sources */,
+ F9FD31A00CC1AD070073837D /* ttkDefaultTheme.c in Sources */,
+ F9FD31A10CC1AD070073837D /* ttkElements.c in Sources */,
+ F9FD31A20CC1AD070073837D /* ttkEntry.c in Sources */,
+ F9FD31A30CC1AD070073837D /* ttkFrame.c in Sources */,
+ F9FD31A40CC1AD070073837D /* ttkImage.c in Sources */,
+ F9FD31A50CC1AD070073837D /* ttkInit.c in Sources */,
+ F9FD31A60CC1AD070073837D /* ttkLabel.c in Sources */,
+ F9FD31A70CC1AD070073837D /* ttkLayout.c in Sources */,
+ F9FD31A80CC1AD070073837D /* ttkManager.c in Sources */,
+ F9FD31A90CC1AD070073837D /* ttkNotebook.c in Sources */,
+ F9FD31AA0CC1AD070073837D /* ttkPanedwindow.c in Sources */,
+ F9FD31AB0CC1AD070073837D /* ttkProgress.c in Sources */,
+ F9FD31AC0CC1AD070073837D /* ttkScale.c in Sources */,
+ F9FD31AD0CC1AD070073837D /* ttkScroll.c in Sources */,
+ F9FD31AE0CC1AD070073837D /* ttkScrollbar.c in Sources */,
+ F9FD31AF0CC1AD070073837D /* ttkSeparator.c in Sources */,
+ F9FD31B00CC1AD070073837D /* ttkSquare.c in Sources */,
+ F9FD31B10CC1AD070073837D /* ttkState.c in Sources */,
+ F9FD31B20CC1AD070073837D /* ttkStubInit.c in Sources */,
+ F9FD31B30CC1AD070073837D /* ttkStubLib.c in Sources */,
+ F9FD31B40CC1AD070073837D /* ttkTagSet.c in Sources */,
+ F9FD31B50CC1AD070073837D /* ttkTheme.c in Sources */,
+ F9FD31B60CC1AD070073837D /* ttkTrace.c in Sources */,
+ F9FD31B70CC1AD070073837D /* ttkTrack.c in Sources */,
+ F9FD31B80CC1AD070073837D /* ttkTreeview.c in Sources */,
+ F9FD31B90CC1AD070073837D /* ttkWidget.c in Sources */,
+ F9FD31DA0CC1AD070073837D /* tkAppInit.c in Sources */,
+ F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */,
+ F9FD31DB0CC1AD070073837D /* tkUnix3d.c in Sources */,
+ F9FD320A0CC1ADB70073837D /* tkUnixButton.c in Sources */,
+ F9FD32090CC1ADB70073837D /* tkUnixColor.c in Sources */,
+ F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */,
+ F9FD31F80CC1ADB70073837D /* tkUnixCursor.c in Sources */,
+ F9FD32060CC1ADB70073837D /* tkUnixDialog.c in Sources */,
+ F9FD32050CC1ADB70073837D /* tkUnixDraw.c in Sources */,
+ F9FD31FD0CC1ADB70073837D /* tkUnixEmbed.c in Sources */,
+ F9FD32080CC1ADB70073837D /* tkUnixEvent.c in Sources */,
+ F9FD31FF0CC1ADB70073837D /* tkUnixFocus.c in Sources */,
+ F9FD31FC0CC1ADB70073837D /* tkUnixInit.c in Sources */,
+ F9FD31FA0CC1ADB70073837D /* tkUnixKey.c in Sources */,
+ F9FD32030CC1ADB70073837D /* tkUnixMenu.c in Sources */,
+ F9FD320B0CC1ADB70073837D /* tkUnixMenubu.c in Sources */,
+ F9FD32010CC1ADB70073837D /* tkUnixRFont.c in Sources */,
+ F9FD31DC0CC1AD070073837D /* tkUnixScale.c in Sources */,
+ F9FD320C0CC1ADB70073837D /* tkUnixScrlbr.c in Sources */,
+ F9FD32070CC1ADB70073837D /* tkUnixSelect.c in Sources */,
+ F9FD31FE0CC1ADB70073837D /* tkUnixSend.c in Sources */,
+ F9FD32000CC1ADB70073837D /* tkUnixWm.c in Sources */,
+ F9FD31FB0CC1ADB70073837D /* tkUnixXId.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ F91BCC4F093152310042A6BF /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleaseUniversal;
+ };
+ F91BCC50093152310042A6BF /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleaseUniversal;
+ };
+ F91BCC51093152310042A6BF /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CFLAGS = "-arch i386 -arch ppc $(CFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = ReleaseUniversal;
+ };
+ F93084370BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugMemCompile;
+ };
+ F93084380BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugMemCompile;
+ };
+ F93084390BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugMemCompile;
+ };
+ F930843A0BB93D2800CD0B9E /* DebugMemCompile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-symbols=all";
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = DebugMemCompile;
+ };
+ F9359B250DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = YES;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS)",
+ "-lgcov",
+ );
+ PREBINDING = NO;
+ };
+ name = DebugGCov;
+ };
+ F9359B260DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugGCov;
+ };
+ F9359B270DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugGCov;
+ };
+ F9359B280DF212DA00E04F67 /* DebugGCov */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugGCov;
+ };
+ F95CC8AC09158F3100EA5ACE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = Debug;
+ };
+ F95CC8AD09158F3100EA5ACE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = Release;
+ };
+ F95CC8AE09158F3100EA5ACE /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugNoFixZL;
+ };
+ F95CC8B109158F3100EA5ACE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = Debug;
+ };
+ F95CC8B209158F3100EA5ACE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = Release;
+ };
+ F95CC8B309158F3100EA5ACE /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugNoFixZL;
+ };
+ F95CC8B609158F3100EA5ACE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = Debug;
+ };
+ F95CC8B709158F3100EA5ACE /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = Release;
+ };
+ F95CC8B809158F3100EA5ACE /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = DebugNoFixZL;
+ };
+ F97258A90A86873D00096C78 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = Debug;
+ };
+ F97258AA0A86873D00096C78 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = Release;
+ };
+ F97258AB0A86873D00096C78 /* DebugNoFixZL */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugNoFixZL;
+ };
+ F97258AC0A86873D00096C78 /* ReleaseUniversal */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CFLAGS = "-arch i386 -arch x86_64 -arch ppc -arch ppc64 $(CFLAGS)";
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleaseUniversal;
+ };
+ F97AED080B660A6C00310EA2 /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F97AED0F0B660AA300310EA2 /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F97AED160B660AF100310EA2 /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+ F97AED1B0B660B2100310EA2 /* Debug64bit */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = Debug64bit;
+ };
+ F97AED1C0B660B2100310EA2 /* Debug64bit */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = Debug64bit;
+ };
+ F97AED1D0B660B2100310EA2 /* Debug64bit */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = Debug64bit;
+ };
+ F97AED1E0B660B2100310EA2 /* Debug64bit */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ ARCHS = "$(NATIVE_ARCH_64_BIT)";
+ CONFIGURE_ARGS = "--enable-64bit $(CONFIGURE_ARGS)";
+ CPPFLAGS = "-arch $(NATIVE_ARCH_64_BIT) $(CPPFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = Debug64bit;
+ };
+ F987512F0DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --disable-corefoundation";
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = DebugNoCF;
+ };
+ F98751300DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugNoCF;
+ };
+ F98751310DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugNoCF;
+ };
+ F98751320DE7B57E00B1C9EC /* DebugNoCF */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugNoCF;
+ };
+ F98751330DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --disable-threads --disable-corefoundation";
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F98751340DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F98751350DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --enable-corefoundation";
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F98751360DE7B5A200B1C9EC /* DebugNoCFUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugNoCFUnthreaded;
+ };
+ F9988AB10D814C6500B6B03B /* Debug gcc42 */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ GCC_VERSION = 4.2;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = "Debug gcc42";
+ };
+ F9988AB20D814C6500B6B03B /* Debug gcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = "Debug gcc42";
+ };
+ F9988AB30D814C6500B6B03B /* Debug gcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = "Debug gcc42";
+ };
+ F9988AB40D814C6500B6B03B /* Debug gcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = "Debug gcc42";
+ };
+ F9988AB50D814C7500B6B03B /* Debug llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CC = "$(DEVELOPER_DIR)/usr/bin/llvm-gcc-4.2";
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = "Debug llvmgcc42";
+ };
+ F9988AB60D814C7500B6B03B /* Debug llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = "Debug llvmgcc42";
+ };
+ F9988AB70D814C7500B6B03B /* Debug llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = "Debug llvmgcc42";
+ };
+ F9988AB80D814C7500B6B03B /* Debug llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CONFIGURE_ARGS = "tcl_cv_cc_visibility_hidden=no $(CONFIGURE_ARGS)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = "Debug llvmgcc42";
+ };
+ F9988BB10D81586D00B6B03B /* ReleaseUniversal gcc42 */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CFLAGS = "-arch i386 -arch ppc $(CFLAGS)";
+ GCC_VERSION = 4.2;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = "ReleaseUniversal gcc42";
+ };
+ F9988BB20D81586D00B6B03B /* ReleaseUniversal gcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = "ReleaseUniversal gcc42";
+ };
+ F9988BB30D81586D00B6B03B /* ReleaseUniversal gcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = "ReleaseUniversal gcc42";
+ };
+ F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CFLAGS = "-arch i386 -arch x86_64 -arch ppc -arch ppc64 $(CFLAGS)";
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = "ReleaseUniversal gcc42";
+ };
+ F9988BB50D81587400B6B03B /* ReleaseUniversal llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CC = "$(DEVELOPER_DIR)/usr/bin/llvm-gcc-4.2";
+ CFLAGS = "-arch i386 -arch ppc $(CFLAGS)";
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ GCC_OPTIMIZATION_LEVEL = 4;
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ OTHER_CFLAGS = (
+ "$(OTHER_CFLAGS)",
+ "-emit-llvm",
+ );
+ PREBINDING = NO;
+ TCL_CONFIGURE_ARGS = "$(TCL_CONFIGURE_ARGS) --disable-dtrace";
+ };
+ name = "ReleaseUniversal llvmgcc42";
+ };
+ F9988BB60D81587400B6B03B /* ReleaseUniversal llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = "ReleaseUniversal llvmgcc42";
+ };
+ F9988BB70D81587400B6B03B /* ReleaseUniversal llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = "ReleaseUniversal llvmgcc42";
+ };
+ F9988BB80D81587400B6B03B /* ReleaseUniversal llvmgcc42 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CFLAGS = "-arch i386 -arch x86_64 -arch ppc -arch ppc64 $(CFLAGS)";
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = "ReleaseUniversal llvmgcc42";
+ };
+ F99EE73B0BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE73C0BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = DebugLeaks;
+ };
+ F99EE73D0BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE73E0BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugLeaks;
+ };
+ F99EE73F0BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE7400BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = DebugLeaks;
+ };
+ F99EE7410BE835310060D4AF /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --disable-threads";
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = DebugUnthreaded;
+ };
+ F99EE7420BE835310060D4AF /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ PURIFY,
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ };
+ name = DebugLeaks;
+ };
+ F9DB62080B65ADA800A370FB /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F9DB62090B65ADA800A370FB /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F9DB620A0B65ADA800A370FB /* ReleaseUniversal10.4uSDK */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CFLAGS = "-arch i386 -arch ppc $(CFLAGS)";
+ CPPFLAGS = "-isysroot $(SDKROOT) $(CPPFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.4;
+ PREBINDING = NO;
+ SDKROOT = macosx10.4;
+ };
+ name = ReleaseUniversal10.4uSDK;
+ };
+ F9DB621F0B65AFDE00A370FB /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ LDFLAGS = "-force_cpusubtype_ALL $(LDFLAGS)";
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F9DB62200B65AFDE00A370FB /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F9DB62210B65AFDE00A370FB /* ReleasePPC10.3.9SDK */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = ppc;
+ CFLAGS = "$(PER_ARCH_CFLAGS_ppc) $(CFLAGS)";
+ CPPFLAGS = "-arch ppc -isysroot $(SDKROOT) $(CPPFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.3;
+ PREBINDING = YES;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk";
+ };
+ name = ReleasePPC10.3.9SDK;
+ };
+ F9DB62350B65B03A00A370FB /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+ F9DB62360B65B03A00A370FB /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+ F9DB62370B65B03A00A370FB /* ReleasePPC10.2.8SDK */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = ppc;
+ CFLAGS = "$(PER_ARCH_CFLAGS_ppc) -fconstant-cfstrings $(CFLAGS)";
+ CPPFLAGS = "-arch ppc -D__CONSTANT_CFSTRINGS__ -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc -isystem $(SDKROOT)/usr/include/gcc/darwin/$(GCC_VERSION) -isystem $(SDKROOT)/usr/include -F$(SDKROOT)/System/Library/Frameworks";
+ DEBUG_INFORMATION_FORMAT = stabs;
+ GCC = /usr/bin/gcc;
+ GCC_VERSION = 3.3;
+ LDFLAGS = "-L$(SDKROOT)/usr/lib/gcc/darwin/$(GCC_VERSION) -Wl,-syslibroot,$(SDKROOT)";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = YES;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.2.8.sdk";
+ WARNING_CFLAGS = (
+ "$(WARNING_CFLAGS_GCC3)",
+ "-Wno-long-double",
+ );
+ };
+ name = ReleasePPC10.2.8SDK;
+ };
+ F9EEED960C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ SKIP_INSTALL = NO;
+ };
+ name = ReleaseUniversal10.5SDK;
+ };
+ F9EEED970C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = (
+ "$(OTHER_LDFLAGS_AQUA)",
+ "$(OTHER_LDFLAGS)",
+ );
+ PRODUCT_NAME = tktest;
+ };
+ name = ReleaseUniversal10.5SDK;
+ };
+ F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CFLAGS = "-arch i386 -arch x86_64 -arch ppc -arch ppc64 $(CFLAGS)";
+ HEADER_SEARCH_PATHS = (
+ /usr/X11R6/include,
+ /usr/X11R6/include/freetype2,
+ "$(HEADER_SEARCH_PATHS)",
+ );
+ LIBRARY_SEARCH_PATHS = (
+ /usr/X11R6/lib,
+ "$(LIBRARY_SEARCH_PATHS)",
+ );
+ PRODUCT_NAME = "tktest-X11";
+ };
+ name = ReleaseUniversal10.5SDK;
+ };
+ F9EEED990C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CFLAGS = "-arch i386 -arch ppc $(CFLAGS)";
+ CPPFLAGS = "-isysroot $(SDKROOT) $(CPPFLAGS)";
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ PREBINDING = NO;
+ SDKROOT = macosx10.5;
+ };
+ name = ReleaseUniversal10.5SDK;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ F95CC8AB09158F3100EA5ACE /* Build configuration list for PBXNativeTarget "Tk" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F95CC8AC09158F3100EA5ACE /* Debug */,
+ F9988AB20D814C6500B6B03B /* Debug gcc42 */,
+ F9988AB60D814C7500B6B03B /* Debug llvmgcc42 */,
+ F95CC8AE09158F3100EA5ACE /* DebugNoFixZL */,
+ F99EE73B0BE835310060D4AF /* DebugUnthreaded */,
+ F98751300DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751340DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F93084370BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE73C0BE835310060D4AF /* DebugLeaks */,
+ F9359B260DF212DA00E04F67 /* DebugGCov */,
+ F97AED1B0B660B2100310EA2 /* Debug64bit */,
+ F95CC8AD09158F3100EA5ACE /* Release */,
+ F91BCC4F093152310042A6BF /* ReleaseUniversal */,
+ F9988BB20D81586D00B6B03B /* ReleaseUniversal gcc42 */,
+ F9988BB60D81587400B6B03B /* ReleaseUniversal llvmgcc42 */,
+ F9EEED960C2FEFD300396116 /* ReleaseUniversal10.5SDK */,
+ F9DB62080B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
+ F9DB621F0B65AFDE00A370FB /* ReleasePPC10.3.9SDK */,
+ F9DB62350B65B03A00A370FB /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ F95CC8B009158F3100EA5ACE /* Build configuration list for PBXNativeTarget "tktest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F95CC8B109158F3100EA5ACE /* Debug */,
+ F9988AB30D814C6500B6B03B /* Debug gcc42 */,
+ F9988AB70D814C7500B6B03B /* Debug llvmgcc42 */,
+ F95CC8B309158F3100EA5ACE /* DebugNoFixZL */,
+ F99EE73D0BE835310060D4AF /* DebugUnthreaded */,
+ F98751310DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751350DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F93084380BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE73E0BE835310060D4AF /* DebugLeaks */,
+ F9359B270DF212DA00E04F67 /* DebugGCov */,
+ F97AED1C0B660B2100310EA2 /* Debug64bit */,
+ F95CC8B209158F3100EA5ACE /* Release */,
+ F91BCC50093152310042A6BF /* ReleaseUniversal */,
+ F9988BB30D81586D00B6B03B /* ReleaseUniversal gcc42 */,
+ F9988BB70D81587400B6B03B /* ReleaseUniversal llvmgcc42 */,
+ F9EEED970C2FEFD300396116 /* ReleaseUniversal10.5SDK */,
+ F9DB62090B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
+ F9DB62200B65AFDE00A370FB /* ReleasePPC10.3.9SDK */,
+ F9DB62360B65B03A00A370FB /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ F95CC8B509158F3100EA5ACE /* Build configuration list for PBXProject "Wish" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F95CC8B609158F3100EA5ACE /* Debug */,
+ F9988AB10D814C6500B6B03B /* Debug gcc42 */,
+ F9988AB50D814C7500B6B03B /* Debug llvmgcc42 */,
+ F95CC8B809158F3100EA5ACE /* DebugNoFixZL */,
+ F99EE7410BE835310060D4AF /* DebugUnthreaded */,
+ F987512F0DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751330DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F930843A0BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE7420BE835310060D4AF /* DebugLeaks */,
+ F9359B250DF212DA00E04F67 /* DebugGCov */,
+ F97AED1E0B660B2100310EA2 /* Debug64bit */,
+ F95CC8B709158F3100EA5ACE /* Release */,
+ F91BCC51093152310042A6BF /* ReleaseUniversal */,
+ F9988BB10D81586D00B6B03B /* ReleaseUniversal gcc42 */,
+ F9988BB50D81587400B6B03B /* ReleaseUniversal llvmgcc42 */,
+ F9EEED990C2FEFD300396116 /* ReleaseUniversal10.5SDK */,
+ F9DB620A0B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
+ F9DB62210B65AFDE00A370FB /* ReleasePPC10.3.9SDK */,
+ F9DB62370B65B03A00A370FB /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ F97258A80A86873D00096C78 /* Build configuration list for PBXNativeTarget "tktest-X11" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F97258A90A86873D00096C78 /* Debug */,
+ F9988AB40D814C6500B6B03B /* Debug gcc42 */,
+ F9988AB80D814C7500B6B03B /* Debug llvmgcc42 */,
+ F97258AB0A86873D00096C78 /* DebugNoFixZL */,
+ F99EE73F0BE835310060D4AF /* DebugUnthreaded */,
+ F98751320DE7B57E00B1C9EC /* DebugNoCF */,
+ F98751360DE7B5A200B1C9EC /* DebugNoCFUnthreaded */,
+ F93084390BB93D2800CD0B9E /* DebugMemCompile */,
+ F99EE7400BE835310060D4AF /* DebugLeaks */,
+ F9359B280DF212DA00E04F67 /* DebugGCov */,
+ F97AED1D0B660B2100310EA2 /* Debug64bit */,
+ F97258AA0A86873D00096C78 /* Release */,
+ F97258AC0A86873D00096C78 /* ReleaseUniversal */,
+ F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc42 */,
+ F9988BB80D81587400B6B03B /* ReleaseUniversal llvmgcc42 */,
+ F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */,
+ F97AED080B660A6C00310EA2 /* ReleaseUniversal10.4uSDK */,
+ F97AED0F0B660AA300310EA2 /* ReleasePPC10.3.9SDK */,
+ F97AED160B660AF100310EA2 /* ReleasePPC10.2.8SDK */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/macosx/configure.ac b/macosx/configure.ac
new file mode 100644
index 0000000..229af64
--- /dev/null
+++ b/macosx/configure.ac
@@ -0,0 +1,11 @@
+#! /bin/bash -norc
+dnl This file is an input file used by the GNU "autoconf" program to
+dnl generate the file "configure", which is run during Tk installation
+dnl to configure the system for the local environment.
+
+dnl Ensure that the config (auto)headers support is used, then just
+dnl include the configure sources from ../unix:
+
+m4_include(../unix/aclocal.m4)
+m4_define(SC_USE_CONFIG_HEADERS)
+m4_include(../unix/configure.in)
diff --git a/macosx/tkAboutDlg.r b/macosx/tkAboutDlg.r
index 7bb0a0e..1492b90 100644
--- a/macosx/tkAboutDlg.r
+++ b/macosx/tkAboutDlg.r
@@ -45,11 +45,11 @@ resource 'DITL' (128, "About Box", purgeable) {
{232, 147, 252, 217}, Button {enabled, "Ok"},
{ 20, 108, 212, 344}, StaticText {disabled,
"Tcl " TCL_PATCH_LEVEL " & Tk " TK_PATCH_LEVEL "\n\n"
- "© 2002-2009 Tcl Core Team." "\n\n"
+ "© 1987-2009 Tcl Core Team." "\n\n"
"© 2002-2009 Daniel A. Steffen." "\n\n"
- "Jim Ingham & Ian Reid" "\n"
- "© 2001-2002 Apple Computer, Inc." "\n\n"
- "Jim Ingham & Ray Johnson" "\n"
+ "© 2001-2009 Apple Inc." "\n\n"
+ "© 2001-2002 Jim Ingham & Ian Reid" "\n"
+ "© 1998-2000 Jim Ingham & Ray Johnson" "\n"
"© 1998-2000 Scriptics Inc." "\n"
"© 1996-1997 Sun Microsystems Inc."},
{ 20, 24, 120, 92}, Picture {enabled, 128}
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index 263a3c8..c5b2df9 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -247,9 +247,9 @@ TkpGetNativeAppBitmap(
Str255 dummy;
/*
- * We need to first paint the background white. Also, for
- * some reason we *must* use GetCIcon instead of GetNamedResource
- * for PlotCIcon to work - so we use GetResInfo to get the id.
+ * We need to first paint the background white. Also, for some reason
+ * we *must* use GetCIcon instead of GetNamedResource for PlotCIcon to
+ * work - so we use GetResInfo to get the id.
*/
RGBForeColor(&white);
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 6940a5a..184380f 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -23,7 +23,7 @@
#define FIRST_DRAW 2
#define ACTIVE 4
-#define MAX_VALUE 1
+#define MAX_VALUE 2
/*
* Default insets for controls
@@ -363,12 +363,10 @@ TkpDisplayButton(
if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
-#if 0
} else if ((butPtr->tristateImage != NULL) &&
(butPtr->flags & TRISTATED)) {
Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
-#endif
} else {
Tk_RedrawImage(butPtr->image, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
@@ -412,12 +410,10 @@ TkpDisplayButton(
if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
-#if 0
} else if ((butPtr->tristateImage != NULL) &&
(butPtr->flags & TRISTATED)) {
Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
-#endif
} else {
Tk_RedrawImage(butPtr->image, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
@@ -898,7 +894,7 @@ TkMacOSXDrawControl(
* The control has been previously initialised.
* It may need to be re-initialised
*/
-#if 0
+#ifdef TK_REBUILD_TOPLEVEL
rebuild = (winPtr->flags & TK_REBUILD_TOPLEVEL);
winPtr->flags &= ~TK_REBUILD_TOPLEVEL;
#else
@@ -974,10 +970,8 @@ TkMacOSXDrawControl(
if (butPtr->flags & SELECTED) {
SetControlValue(mbPtr->control, 1);
-#if 0
} else if (butPtr->flags & TRISTATED) {
SetControlValue(mbPtr->control, 2);
-#endif
} else {
SetControlValue(mbPtr->control, 0);
}
@@ -1123,11 +1117,9 @@ SetupBevelButton(
if (butPtr->selectImage != NULL && (butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height, pixmap, 0, 0);
-#if 0
} else if (butPtr->tristateImage != NULL && (butPtr->flags & TRISTATED)) {
Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height, pixmap, 0,
0);
-#endif
} else if (butPtr->image != NULL) {
Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, 0, 0);
} else {
diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c
index 1339e67..1a71cbb 100644
--- a/macosx/tkMacOSXCarbonEvents.c
+++ b/macosx/tkMacOSXCarbonEvents.c
@@ -679,3 +679,12 @@ TkMacOSXReceiveAndDispatchEvent(void)
}
return err;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 6ddb95e..b6b1d18 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -639,7 +639,7 @@ TkpGetColorByValue(
return tkColPtr;
}
-#if 0
+#if !TK_DRAW_IN_CONTEXT
/*
*----------------------------------------------------------------------
*
diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c
index 1203491..4c5b332 100644
--- a/macosx/tkMacOSXCursor.c
+++ b/macosx/tkMacOSXCursor.c
@@ -7,16 +7,16 @@
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
/*
- * There are three different ways to set the cursor on the Mac.
- * The default theme cursors (listed in cursorNames below),
- * color resource cursors, & normal cursors.
+ * There are three different ways to set the cursor on the Mac. The default
+ * theme cursors (listed in cursorNames below), color resource cursors, &
+ * normal cursors.
*/
#define NONE -1 /* Hidden cursor */
@@ -26,17 +26,17 @@
#define NORMAL 3 /* Cursors of type CURS. */
/*
- * The following data structure contains the system specific data
- * necessary to control Windows cursors.
+ * The following data structure contains the system specific data necessary to
+ * control Windows cursors.
*/
typedef struct {
TkCursor info; /* Generic cursor info used by tkCursor.c */
- Handle macCursor; /* Resource containing Macintosh cursor.
- * For theme cursors, this is -1. */
- int type; /* Type of Mac cursor: for theme cursors
- * this is the theme cursor constant,
- * otherwise one of crsr or CURS */
+ Handle macCursor; /* Resource containing Macintosh cursor. For
+ * theme cursors, this is -1. */
+ int type; /* Type of Mac cursor: for theme cursors this
+ * is the theme cursor constant, otherwise one
+ * of crsr or CURS. */
int count; /* For animating cursors, the count for the
* cursor. */
} TkMacOSXCursor;
@@ -92,25 +92,23 @@ static struct CursorName animatedThemeCursorNames[] = {
* Declarations of static variables used in this file.
*/
-static TkMacOSXCursor * gCurrentCursor = NULL; /* A pointer to the current
- * cursor. */
-static int gResizeOverride = false; /* A boolean indicating whether
- * we should use the resize
- * cursor during installations. */
-static int gTkOwnsCursor = true; /* A boolean indicating whether
- * Tk owns the cursor. If not (for
- * instance, in the case where a Tk
- * window is embedded in another app's
- * window, and the cursor is out of
- * the tk window, we will not attempt
- * to adjust the cursor */
+static TkMacOSXCursor * gCurrentCursor = NULL;
+ /* A pointer to the current cursor. */
+static int gResizeOverride = false;
+ /* A boolean indicating whether we should use
+ * the resize cursor during installations. */
+static int gTkOwnsCursor = true;/* A boolean indicating whether Tk owns the
+ * cursor. If not (for instance, in the case
+ * where a Tk window is embedded in another
+ * app's window, and the cursor is out of the
+ * tk window, we will not attempt to adjust
+ * the cursor. */
/*
* Declarations of procedures local to this file
*/
static void FindCursorByName(TkMacOSXCursor *macCursorPtr, const char *string);
-
/*
*----------------------------------------------------------------------
@@ -118,10 +116,9 @@ static void FindCursorByName(TkMacOSXCursor *macCursorPtr, const char *string);
* FindCursorByName --
*
* Retrieve a system cursor by name, and fill the macCursorPtr
- * structure. If the cursor cannot be found, the macCursor field
- * will be NULL. The function first attempts to load a color
- * cursor. If that fails it will attempt to load a black & white
- * cursor.
+ * structure. If the cursor cannot be found, the macCursor field will be
+ * NULL. The function first attempts to load a color cursor. If that
+ * fails it will attempt to load a black & white cursor.
*
* Results:
* Fills the macCursorPtr record.
@@ -203,9 +200,9 @@ TkGetCursorByName(
macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr;
/*
- * To find a cursor we must first determine if it is one of the
- * builtin cursors or the standard arrow cursor. Otherwise, we
- * attempt to load the cursor as a named Mac resource.
+ * To find a cursor we must first determine if it is one of the builtin
+ * cursors or the standard arrow cursor. Otherwise, we attempt to load the
+ * cursor as a named Mac resource.
*/
if (strcmp(noneCursorName.name, string) == 0) {
@@ -223,11 +220,14 @@ TkGetCursorByName(
if (namePtr->name == NULL) {
for (namePtr = animatedThemeCursorNames;
namePtr->name != NULL; namePtr++) {
- int namelen = strlen (namePtr->name);
+ int namelen = strlen(namePtr->name);
+
if (strncmp(namePtr->name, string, namelen) == 0) {
const char *numPtr = string + namelen;
+
if (*numPtr) {
int result = Tcl_GetInt(NULL, numPtr, &count);
+
if (result != TCL_OK) {
continue;
}
@@ -249,9 +249,9 @@ TkGetCursorByName(
int argc;
/*
- * The user may be trying to specify an XCursor with fore
- * & back colors. We don't want this to be an error, so pick
- * off the first word, and try again.
+ * The user may be trying to specify an XCursor with fore & back
+ * colors. We don't want this to be an error, so pick off the
+ * first word, and try again.
*/
if (Tcl_SplitList(interp, string, &argc, &argv) == TCL_OK ) {
@@ -267,9 +267,8 @@ TkGetCursorByName(
ckfree((char *)macCursorPtr);
Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
return NULL;
- } else {
- return (TkCursor *) macCursorPtr;
}
+ return (TkCursor *) macCursorPtr;
}
/*
@@ -325,12 +324,12 @@ TkpFreeCursor(
TkMacOSXCursor *macCursorPtr = (TkMacOSXCursor *) cursorPtr;
switch (macCursorPtr->type) {
- case COLOR:
- DisposeCCursor((CCrsrHandle) macCursorPtr->macCursor);
- break;
- case NORMAL:
- ReleaseResource(macCursorPtr->macCursor);
- break;
+ case COLOR:
+ DisposeCCursor((CCrsrHandle) macCursorPtr->macCursor);
+ break;
+ case NORMAL:
+ ReleaseResource(macCursorPtr->macCursor);
+ break;
}
if (macCursorPtr == gCurrentCursor) {
@@ -343,9 +342,8 @@ TkpFreeCursor(
*
* TkMacOSXInstallCursor --
*
- * Installs either the current cursor as defined by TkpSetCursor
- * or a resize cursor as the cursor the Macintosh should currently
- * display.
+ * Installs either the current cursor as defined by TkpSetCursor or a
+ * resize cursor as the cursor the Macintosh should currently display.
*
* Results:
* None.
@@ -380,35 +378,35 @@ TkMacOSXInstallCursor(
SetThemeCursor(kThemeArrowCursor);
} else {
struct CursorName *namePtr;
+
switch (macCursorPtr->type) {
- case NONE:
- if (!cursorHidden) {
- cursorHidden = 1;
- HideCursor();
- }
- cursorNone = 1;
- break;
- case THEME:
- namePtr = (struct CursorName *) macCursorPtr->macCursor;
- SetThemeCursor(
- namePtr->id);
- break;
- case ANIMATED:
- namePtr = (struct CursorName *) macCursorPtr->macCursor;
- if (macCursorPtr->count == -1) {
- SetAnimatedThemeCursor(namePtr->id, cursorStep++);
- } else {
- SetAnimatedThemeCursor(namePtr->id, macCursorPtr->count);
- }
- break;
- case COLOR:
- ccursor = (CCrsrHandle) macCursorPtr->macCursor;
- SetCCursor(ccursor);
- break;
- case NORMAL:
- cursor = (CursHandle) macCursorPtr->macCursor;
- SetCursor(*cursor);
- break;
+ case NONE:
+ if (!cursorHidden) {
+ cursorHidden = 1;
+ HideCursor();
+ }
+ cursorNone = 1;
+ break;
+ case THEME:
+ namePtr = (struct CursorName *) macCursorPtr->macCursor;
+ SetThemeCursor(namePtr->id);
+ break;
+ case ANIMATED:
+ namePtr = (struct CursorName *) macCursorPtr->macCursor;
+ if (macCursorPtr->count == -1) {
+ SetAnimatedThemeCursor(namePtr->id, cursorStep++);
+ } else {
+ SetAnimatedThemeCursor(namePtr->id, macCursorPtr->count);
+ }
+ break;
+ case COLOR:
+ ccursor = (CCrsrHandle) macCursorPtr->macCursor;
+ SetCCursor(ccursor);
+ break;
+ case NORMAL:
+ cursor = (CursHandle) macCursorPtr->macCursor;
+ SetCursor(*cursor);
+ break;
}
}
if (cursorHidden && !cursorNone) {
@@ -446,10 +444,10 @@ TkpSetCursor(
if (cursor == None) {
/*
* This is a little tricky. We can't really tell whether
- * gCurrentCursor is NULL because it was NULL last time around
- * or because we just freed the current cursor. So if the input
- * cursor is NULL, we always need to reset it, we can't trust the
- * cursorChanged logic.
+ * gCurrentCursor is NULL because it was NULL last time around or
+ * because we just freed the current cursor. So if the input cursor is
+ * NULL, we always need to reset it, we can't trust the cursorChanged
+ * logic.
*/
gCurrentCursor = NULL;
diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h
index fba5a40..f969064 100644
--- a/macosx/tkMacOSXDefault.h
+++ b/macosx/tkMacOSXDefault.h
@@ -62,7 +62,7 @@
#define DEF_BUTTON_DISABLED_FG_MONO ""
#define DEF_BUTTON_FG "systemButtonText"
#define DEF_CHKRAD_FG DEF_BUTTON_FG
-#define DEF_BUTTON_FONT "system"
+#define DEF_BUTTON_FONT "TkDefaultFont"
#define DEF_BUTTON_HEIGHT "0"
#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO
@@ -74,6 +74,7 @@
#define DEF_BUTTON_JUSTIFY "center"
#define DEF_BUTTON_OFF_VALUE "0"
#define DEF_BUTTON_ON_VALUE "1"
+#define DEF_BUTTON_TRISTATE_VALUE ""
#define DEF_BUTTON_OVER_RELIEF ""
#define DEF_BUTTON_PADX "12"
#define DEF_LABCHKRAD_PADX "1"
@@ -157,7 +158,7 @@
#define DEF_ENTRY_DISABLED_BG_MONO WHITE
#define DEF_ENTRY_DISABLED_FG DISABLED
#define DEF_ENTRY_EXPORT_SELECTION "1"
-#define DEF_ENTRY_FONT "Helvetica 12"
+#define DEF_ENTRY_FONT "TkTextFont"
#define DEF_ENTRY_FG BLACK
#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG
#define DEF_ENTRY_HIGHLIGHT BLACK
@@ -218,7 +219,7 @@
#define DEF_LABELFRAME_CLASS "Labelframe"
#define DEF_LABELFRAME_RELIEF "groove"
#define DEF_LABELFRAME_FG "systemButtonText"
-#define DEF_LABELFRAME_FONT "system"
+#define DEF_LABELFRAME_FONT "TkDefaultFont"
#define DEF_LABELFRAME_TEXT ""
#define DEF_LABELFRAME_LABELANCHOR "nw"
@@ -233,7 +234,7 @@
#define DEF_LISTBOX_CURSOR ""
#define DEF_LISTBOX_DISABLED_FG DISABLED
#define DEF_LISTBOX_EXPORT_SELECTION "1"
-#define DEF_LISTBOX_FONT "application"
+#define DEF_LISTBOX_FONT "TkTextFont"
#define DEF_LISTBOX_FG BLACK
#define DEF_LISTBOX_HEIGHT "10"
#define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG
@@ -331,7 +332,7 @@
#define DEF_MENUBUTTON_DIRECTION "below"
#define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED
#define DEF_MENUBUTTON_DISABLED_FG_MONO ""
-#define DEF_MENUBUTTON_FONT "system"
+#define DEF_MENUBUTTON_FONT "TkDefaultFont"
#define DEF_MENUBUTTON_FG BLACK
#define DEF_MENUBUTTON_HEIGHT "0"
#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
@@ -365,7 +366,7 @@
#define DEF_MESSAGE_BORDER_WIDTH "1"
#define DEF_MESSAGE_CURSOR ""
#define DEF_MESSAGE_FG BLACK
-#define DEF_MESSAGE_FONT "system"
+#define DEF_MESSAGE_FONT "TkDefaultFont"
#define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG
#define DEF_MESSAGE_HIGHLIGHT BLACK
#define DEF_MESSAGE_HIGHLIGHT_WIDTH "0"
@@ -410,6 +411,8 @@
#define DEF_PANEDWINDOW_PANE_PADY "0"
#define DEF_PANEDWINDOW_PANE_STICKY "nsew"
#define DEF_PANEDWINDOW_PANE_WIDTH ""
+#define DEF_PANEDWINDOW_PANE_HIDE "0"
+#define DEF_PANEDWINDOW_PANE_STRETCH "last"
/*
* Defaults for scales:
@@ -424,7 +427,7 @@
#define DEF_SCALE_COMMAND ""
#define DEF_SCALE_CURSOR ""
#define DEF_SCALE_DIGITS "0"
-#define DEF_SCALE_FONT "system"
+#define DEF_SCALE_FONT "TkDefaultFont"
#define DEF_SCALE_FG_COLOR BLACK
#define DEF_SCALE_FG_MONO BLACK
#define DEF_SCALE_FROM "0"
@@ -484,11 +487,12 @@
#define DEF_TEXT_AUTO_SEPARATORS "1"
#define DEF_TEXT_BG_COLOR NORMAL_BG
#define DEF_TEXT_BG_MONO WHITE
+#define DEF_TEXT_BLOCK_CURSOR "0"
#define DEF_TEXT_BORDER_WIDTH "0"
#define DEF_TEXT_CURSOR "xterm"
#define DEF_TEXT_FG BLACK
#define DEF_TEXT_EXPORT_SELECTION "1"
-#define DEF_TEXT_FONT "Courier 12"
+#define DEF_TEXT_FONT "TkFixedFont"
#define DEF_TEXT_HEIGHT "24"
#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG
#define DEF_TEXT_HIGHLIGHT BLACK
@@ -503,6 +507,7 @@
#define DEF_TEXT_PADX "1"
#define DEF_TEXT_PADY "1"
#define DEF_TEXT_RELIEF "flat"
+#define DEF_TEXT_INACTIVE_SELECT_COLOR INACTIVE_SELECT_BG
#define DEF_TEXT_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_MONO BLACK
#define DEF_TEXT_SELECT_BD_COLOR "1"
@@ -516,6 +521,7 @@
#define DEF_TEXT_SPACING3 "0"
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
+#define DEF_TEXT_TABSTYLE "tabular"
#define DEF_TEXT_TAKE_FOCUS (char *) NULL
#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
@@ -527,7 +533,7 @@
* Defaults for canvas text:
*/
-#define DEF_CANVTEXT_FONT "Helvetica 12"
+#define DEF_CANVTEXT_FONT "TkDefaultFont"
/*
* Defaults for toplevels (most of the defaults for frames also apply
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 7776d0c..c99cdbc 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -36,6 +36,7 @@
* The following structures are used in the GetFileName() function. They store
* information about the file dialog and the file filters.
*/
+
typedef struct _OpenFileData {
FileFilterList fl; /* List of file filters. */
SInt16 curType; /* The filetype currently being listed. */
@@ -83,7 +84,8 @@ static int NavServicesGetFile(Tcl_Interp *interp,
OpenFileData *ofd, AEDesc *initialDescPtr,
char *initialFile, AEDescList *selectDescPtr,
CFStringRef title, CFStringRef message,
- const char *initialType, int multiple, int isOpen,
+ const char *initialType, int multiple,
+ int confirmOverwrite, int isOpen,
Tk_Window parent);
static int HandleInitialDirectory(Tcl_Interp *interp,
char *initialFile, char *initialDir, FSRef *dirRef,
@@ -102,16 +104,14 @@ static int fileDlgInited = 0;
static NavObjectFilterUPP openFileFilterUPP;
static NavEventUPP openFileEventUPP;
-
/*
*----------------------------------------------------------------------
*
* Tk_ChooseColorObjCmd --
*
- * This procedure implements the color dialog box for the Mac
- * platform. See the user documentation for details on what it
- * does.
+ * This procedure implements the color dialog box for the Mac platform.
+ * See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -131,7 +131,7 @@ Tk_ChooseColorObjCmd(
{
OSStatus err;
int result = TCL_ERROR;
- Tk_Window parent, tkwin = (Tk_Window) clientData;
+ Tk_Window parent, tkwin = clientData;
const char *title;
int i, srcRead, dstWrote;
CMError cmerr;
@@ -202,7 +202,7 @@ Tk_ChooseColorObjCmd(
cpinfo.placeWhere = kCenterOnMainScreen;
/* Currently, this does not actually change the colorpicker title */
Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, title, -1, 0, NULL,
- StrBody(cpinfo.prompt), 255, &srcRead, &dstWrote, NULL);
+ StrBody(cpinfo.prompt), 255, &srcRead, &dstWrote, NULL);
StrLength(cpinfo.prompt) = (unsigned char) dstWrote;
TkMacOSXTrackingLoop(1);
@@ -223,7 +223,7 @@ Tk_ChooseColorObjCmd(
}
result = TCL_OK;
-end:
+ end:
return result;
}
@@ -232,9 +232,8 @@ end:
*
* Tk_GetOpenFileObjCmd --
*
- * This procedure implements the "open file" dialog box for the
- * Mac platform. See the user documentation for details on what
- * it does.
+ * This procedure implements the "open file" dialog box for the Mac
+ * platform. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -260,18 +259,16 @@ Tk_GetOpenFileObjCmd(
AEDesc *initialPtr = NULL;
AEDescList selectDesc = {typeNull, NULL};
char *initialFile = NULL, *initialDir = NULL;
-#if 0
Tcl_Obj *typeVariablePtr = NULL;
-#endif
const char *initialtype = NULL;
static const char *openOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-message", "-multiple", "-parent", "-title",/* "-typevariable",*/ NULL
+ "-message", "-multiple", "-parent", "-title", "-typevariable", NULL
};
enum openOptions {
OPEN_DEFAULT, OPEN_FILETYPES, OPEN_INITDIR, OPEN_INITFILE,
OPEN_MESSAGE, OPEN_MULTIPLE, OPEN_PARENT, OPEN_TITLE,
- /*OPEN_TYPEVARIABLE,*/
+ OPEN_TYPEVARIABLE,
};
if (!fileDlgInited) {
@@ -287,7 +284,7 @@ Tk_GetOpenFileObjCmd(
char *choice;
int index, choiceLen;
char *string;
- char *types;
+ Tcl_Obj *types;
if (Tcl_GetIndexFromObj(interp, objv[i], openOptionStrings, "option",
TCL_EXACT, &index) != TCL_OK) {
@@ -301,59 +298,60 @@ Tk_GetOpenFileObjCmd(
}
switch (index) {
- case OPEN_DEFAULT:
- break;
- case OPEN_FILETYPES:
- types = Tcl_GetString(objv[i + 1]);
- if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
- goto end;
- }
- break;
- case OPEN_INITDIR:
- initialDir = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- /* empty strings should be like no selection given */
- if (choiceLen == 0) { initialDir = NULL; }
- break;
- case OPEN_INITFILE:
+ case OPEN_DEFAULT:
+ break;
+ case OPEN_FILETYPES:
+ types = objv[i + 1];
+ if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case OPEN_INITDIR:
+ initialDir = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialDir = NULL;
+ }
+ break;
+ case OPEN_INITFILE:
initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- /* empty strings should be like no selection given */
- if (choiceLen == 0) { initialFile = NULL; }
- break;
- case OPEN_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (message) {
- CFRelease(message);
- }
- message = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
- case OPEN_MULTIPLE:
- if (Tcl_GetBooleanFromObj(interp, objv[i + 1], &multiple)
- != TCL_OK) {
- goto end;
- }
- break;
- case OPEN_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice,
- (Tk_Window) clientData);
- if (parent == NULL) {
- goto end;
- }
- break;
- case OPEN_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (title) {
- CFRelease(title);
- }
- title = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
-#if 0
- case OPEN_TYPEVARIABLE:
- typeVariablePtr = objv[i + 1];
- break;
-#endif
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialFile = NULL;
+ }
+ break;
+ case OPEN_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case OPEN_MULTIPLE:
+ if (Tcl_GetBooleanFromObj(interp, objv[i + 1],
+ &multiple) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case OPEN_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case OPEN_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case OPEN_TYPEVARIABLE:
+ typeVariablePtr = objv[i + 1];
+ break;
}
}
@@ -364,15 +362,13 @@ Tk_GetOpenFileObjCmd(
if (initialDesc.descriptorType == typeFSRef) {
initialPtr = &initialDesc;
}
-#if 0
if (typeVariablePtr) {
- initialtype = Tcl_GetVar(interp, Tcl_GetString(typeVariablePtr), 0);
+ initialtype = Tcl_GetVar(interp, Tcl_GetString(typeVariablePtr),
+ TCL_GLOBAL_ONLY);
}
-#endif
result = NavServicesGetFile(interp, &ofd, initialPtr, NULL, &selectDesc,
- title, message, initialtype, multiple, OPEN_FILE, parent);
+ title, message, initialtype, multiple, false, OPEN_FILE, parent);
-#if 0
if (typeVariablePtr) {
FileFilter *filterPtr = ofd.fl.filters;
int i = ofd.curType;
@@ -380,12 +376,14 @@ Tk_GetOpenFileObjCmd(
while (filterPtr && i-- > 0) {
filterPtr = filterPtr->next;
}
- Tcl_SetVar(interp, Tcl_GetString(typeVariablePtr), filterPtr ?
- filterPtr->name : "", 0);
+ if (Tcl_SetVar(interp, Tcl_GetString(typeVariablePtr),
+ filterPtr ? filterPtr->name : "",
+ TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
+ result = TCL_ERROR;
+ }
}
-#endif
-end:
+ end:
TkFreeFileFilters(&ofd.fl);
if (initialDesc.dataHandle) {
ChkErr(AEDisposeDesc, &initialDesc);
@@ -407,8 +405,7 @@ end:
*
* Tk_GetSaveFileObjCmd --
*
- * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box
- * instead
+ * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box instead.
*
* Results:
* A standard Tcl result.
@@ -426,6 +423,7 @@ Tk_GetSaveFileObjCmd(
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int i, result = TCL_ERROR;
+ int confirmOverwrite = 1;
char *initialFile = NULL;
Tk_Window parent = NULL;
AEDesc initialDesc = {typeNull, NULL};
@@ -435,11 +433,13 @@ Tk_GetSaveFileObjCmd(
OpenFileData ofd;
static const char *saveOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-message", "-parent", "-title",/* "-typevariable",*/ NULL
+ "-message", "-parent", "-title", "-typevariable",
+ "-confirmoverwrite", NULL
};
enum saveOptions {
SAVE_DEFAULT, SAVE_FILETYPES, SAVE_INITDIR, SAVE_INITFILE,
- SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE,/* SAVE_TYPEVARIABLE,*/
+ SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE, SAVE_TYPEVARIABLE,
+ SAVE_CONFIRMOW
};
if (!fileDlgInited) {
@@ -453,7 +453,7 @@ Tk_GetSaveFileObjCmd(
for (i = 1; i < objc; i += 2) {
char *choice, *string;
int index, choiceLen;
- char *types;
+ Tcl_Obj *types;
if (Tcl_GetIndexFromObj(interp, objv[i], saveOptionStrings, "option",
TCL_EXACT, &index) != TCL_OK) {
@@ -466,53 +466,58 @@ Tk_GetSaveFileObjCmd(
goto end;
}
switch (index) {
- case SAVE_DEFAULT:
- break;
- case SAVE_FILETYPES:
- types = Tcl_GetString(objv[i + 1]);
- if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
- goto end;
- }
- break;
- case SAVE_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- /* empty strings should be like no selection given */
- if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
- &dirRef, NULL, &initialDesc) != TCL_OK) {
- goto end;
- }
- break;
- case SAVE_INITFILE:
- initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- /* empty strings should be like no selection given */
- if (choiceLen == 0) {
- initialFile = NULL;
- }
- break;
- case SAVE_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (message) {
- CFRelease(message);
- }
- message = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
- case SAVE_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice,
- (Tk_Window) clientData);
- if (parent == NULL) {
- goto end;
- }
- break;
- case SAVE_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (title) {
- CFRelease(title);
- }
- title = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
+ case SAVE_DEFAULT:
+ break;
+ case SAVE_FILETYPES:
+ types = objv[i + 1];
+ if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case SAVE_INITDIR:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
+ &dirRef, NULL, &initialDesc) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case SAVE_INITFILE:
+ initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialFile = NULL;
+ }
+ break;
+ case SAVE_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case SAVE_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, (Tk_Window) clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case SAVE_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case SAVE_CONFIRMOW:
+ if (Tcl_GetBooleanFromObj(interp, objv[i + 1], &confirmOverwrite)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
}
}
@@ -520,9 +525,9 @@ Tk_GetSaveFileObjCmd(
initialPtr = &initialDesc;
}
result = NavServicesGetFile(interp, &ofd, initialPtr, initialFile, NULL,
- title, message, NULL, false, SAVE_FILE, parent);
+ title, message, NULL, false, confirmOverwrite, SAVE_FILE, parent);
TkFreeFileFilters(&ofd.fl);
-end:
+ end:
if (initialDesc.dataHandle) {
ChkErr(AEDisposeDesc, &initialDesc);
}
@@ -540,9 +545,9 @@ end:
*
* Tk_ChooseDirectoryObjCmd --
*
- * This procedure implements the "tk_chooseDirectory" dialog box
- * for the Windows platform. See the user documentation for details
- * on what it does.
+ * This procedure implements the "tk_chooseDirectory" dialog box for the
+ * MacOS X platform. See the user documentation for details on what it
+ * does.
*
* Results:
* See user documentation.
@@ -554,11 +559,11 @@ end:
*/
int
-Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_ChooseDirectoryObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int i, result = TCL_ERROR;
Tk_Window parent = NULL;
@@ -579,9 +584,8 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
}
for (i = 1; i < objc; i += 2) {
- char *choice;
+ char *string, *choice;
int index, choiceLen;
- char *string;
if (Tcl_GetIndexFromObj(interp, objv[i], chooseOptionStrings, "option",
TCL_EXACT, &index) != TCL_OK) {
@@ -594,37 +598,36 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
goto end;
}
switch (index) {
- case CHOOSE_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
- &dirRef, NULL, &initialDesc) != TCL_OK) {
- goto end;
- }
- break;
- case CHOOSE_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (message) {
- CFRelease(message);
- }
- message = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
- case CHOOSE_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice,
- (Tk_Window) clientData);
- if (parent == NULL) {
- goto end;
- }
- break;
- case CHOOSE_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (title) {
- CFRelease(title);
- }
- title = CFStringCreateWithBytes(NULL, (unsigned char*) choice,
- choiceLen, kCFStringEncodingUTF8, false);
- break;
+ case CHOOSE_INITDIR:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
+ &dirRef, NULL, &initialDesc) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case CHOOSE_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case CHOOSE_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case CHOOSE_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
}
}
@@ -634,9 +637,9 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
initialPtr = &initialDesc;
}
result = NavServicesGetFile(interp, &ofd, initialPtr, NULL, NULL, title,
- message, NULL, false, CHOOSE_FOLDER, parent);
+ message, NULL, false, false, CHOOSE_FOLDER, parent);
TkFreeFileFilters(&ofd.fl);
-end:
+ end:
if (initialDesc.dataHandle) {
ChkErr(AEDisposeDesc, &initialDesc);
}
@@ -685,16 +688,16 @@ HandleInitialDirectory(
if (dirName == NULL) {
goto end;
}
- err = ChkErr(FSPathMakeRef, (unsigned char*) dirName,
- dirRef, &isDirectory);
+ err = ChkErr(FSPathMakeRef, (unsigned char *) dirName, dirRef,
+ &isDirectory);
if (err != noErr) {
Tcl_AppendResult(interp, "bad directory \"", initialDir, "\"",
NULL);
goto end;
}
if (!isDirectory) {
- Tcl_AppendResult(interp, "-intialdir \"",
- initialDir, " is a file, not a directory.\"", NULL);
+ Tcl_AppendResult(interp, "-intialdir \"", initialDir, "\""
+ " is a file, not a directory.", NULL);
goto end;
}
ChkErr(AECreateDesc, typeFSRef, dirRef, sizeof(*dirRef), dirDescPtr);
@@ -715,7 +718,7 @@ HandleInitialDirectory(
ChkErr(AECreateList, NULL, 0, false, selectDescPtr);
- err = ChkErr(FSPathMakeRef, (unsigned char*) namePtr, &fileRef,
+ err = ChkErr(FSPathMakeRef, (unsigned char *) namePtr, &fileRef,
&isDirectory);
if (err != noErr) {
Tcl_AppendResult(interp, "bad initialfile \"", initialFile,
@@ -727,7 +730,7 @@ HandleInitialDirectory(
ChkErr(AEDisposeDesc, &fileDesc);
}
result = TCL_OK;
-end:
+ end:
if (dirName) {
Tcl_DStringFree(&ds);
}
@@ -785,13 +788,14 @@ NavServicesGetFile(
CFStringRef message,
const char *initialtype,
int multiple,
+ int confirmOverwrite,
int isOpen,
Tk_Window parent)
{
NavHandlerUserData data;
NavDialogCreationOptions options;
NavDialogRef dialogRef = NULL;
- CFStringRef * menuItemNames = NULL;
+ CFStringRef *menuItemNames = NULL;
OSStatus err;
Tcl_Obj *theResult = NULL;
int result = TCL_ERROR;
@@ -806,8 +810,11 @@ NavServicesGetFile(
if (multiple) {
options.optionFlags |= kNavAllowMultipleFiles;
}
+ if (!confirmOverwrite) {
+ options.optionFlags |= kNavDontConfirmReplacement;
+ }
options.modality = kWindowModalityAppModal;
- if (parent && ((TkWindow*)parent)->window != None &&
+ if (parent && ((TkWindow *) parent)->window != None &&
TkMacOSXHostToplevelExists(parent)) {
options.parentWindow = TkMacOSXDrawableWindow(Tk_WindowId(parent));
TK_IF_HI_TOOLBOX (5,
@@ -827,10 +834,10 @@ NavServicesGetFile(
* Now process the selection list. We have to use the popupExtension
* to fill the menu.
*/
+
if (ofdPtr && ofdPtr->usePopup) {
- FileFilter *filterPtr;
+ FileFilter *filterPtr = ofdPtr->fl.filters;
- filterPtr = ofdPtr->fl.filters;
if (filterPtr == NULL) {
ofdPtr->usePopup = 0;
}
@@ -840,8 +847,8 @@ NavServicesGetFile(
int index = 0;
ofdPtr->curType = 0;
- menuItemNames = (CFStringRef *) ckalloc(ofdPtr->fl.numFilters
- * sizeof(CFStringRef));
+ menuItemNames = (CFStringRef *)
+ ckalloc(ofdPtr->fl.numFilters * sizeof(CFStringRef));
for (filterPtr = ofdPtr->fl.filters; filterPtr != NULL;
filterPtr = filterPtr->next, index++) {
@@ -861,8 +868,8 @@ NavServicesGetFile(
options.message = message;
options.windowTitle = title;
if (initialFile) {
- options.saveFileName = CFStringCreateWithCString(NULL,
- initialFile, kCFStringEncodingUTF8);
+ options.saveFileName = CFStringCreateWithCString(NULL, initialFile,
+ kCFStringEncodingUTF8);
} else {
options.saveFileName = NULL;
}
@@ -903,9 +910,10 @@ NavServicesGetFile(
}
/*
- * Most commands assume that the file dialogs return a single
- * item, not a list. So only build a list if multiple is true...
+ * Most commands assume that the file dialogs return a single item, not a
+ * list. So only build a list if multiple is true...
*/
+
if (err == noErr) {
if (multiple) {
theResult = Tcl_NewListObj(0, NULL);
@@ -918,67 +926,89 @@ NavServicesGetFile(
}
if (err == noErr && data.reply.validRecord) {
AEDesc resultDesc;
- long count;
+ long count, i;
FSRef fsRef;
char pathPtr[PATH_MAX + 1];
+ char saveName[PATH_MAX + 1];
err = ChkErr(AECountItems, &data.reply.selection, &count);
- if (err == noErr) {
- long i;
+ if (err != noErr) {
+ /*
+ * There was an error when counting the items? Treat as if no
+ * items were chosen.
+ */
- for (i = 1; i <= count; i++) {
- err = ChkErr(AEGetNthDesc, &data.reply.selection, i,
- typeFSRef, NULL, &resultDesc);
- if (err == noErr) {
- err = ChkErr(AEGetDescData, &resultDesc, &fsRef,
- sizeof(fsRef));
- if (err == noErr) {
- err = ChkErr(FSRefMakePath, &fsRef, (unsigned char*)
- pathPtr, PATH_MAX + 1);
- if (err == noErr) {
- int pathValid = 0;
-
- if (isOpen == SAVE_FILE) {
- if (data.saveNameRef) {
- char saveName [PATH_MAX + 1];
-
- if (CFStringGetCString(data.saveNameRef,
- saveName, PATH_MAX + 1,
- kCFStringEncodingUTF8)) {
- if (strlen(pathPtr) + strlen(saveName)
- < PATH_MAX) {
- strcat(pathPtr, "/");
- strcat(pathPtr, saveName);
- pathValid = 1;
- } else {
- TkMacOSXDbgMsg("Path name too "
- "long");
- }
- } else {
- TkMacOSXDbgMsg("CFStringGetCString "
- "failed");
- }
- } else {
- TkMacOSXDbgMsg("NavDialogGetSaveFileName "
- "failed");
- }
- } else {
- pathValid = 1;
- }
- if (pathValid) {
- if (multiple) {
- Tcl_ListObjAppendElement(interp, theResult,
- Tcl_NewStringObj(pathPtr, -1));
- } else {
- Tcl_SetStringObj(theResult, pathPtr, -1);
- }
- }
- }
- }
- ChkErr(AEDisposeDesc, &resultDesc);
+ goto installResult;
+ }
+
+ /*
+ * Process the chosen files. This will be one unless -multiple was
+ * specified.
+ */
+
+ for (i = 1; i <= count; i++) {
+ /*
+ * Get the name of the selected file.
+ */
+
+ err = ChkErr(AEGetNthDesc, &data.reply.selection, i,
+ typeFSRef, NULL, &resultDesc);
+ if (err != noErr) {
+ continue;
+ }
+ err = ChkErr(AEGetDescData, &resultDesc, &fsRef, sizeof(fsRef));
+ if (err != noErr) {
+ goto nextFilename;
+ }
+ err = ChkErr(FSRefMakePath, &fsRef, (unsigned char *) pathPtr,
+ PATH_MAX + 1);
+ if (err != noErr) {
+ goto nextFilename;
+ }
+
+ /*
+ * If we're saving the file, we're creating a new filename and
+ * must therefore check whether it is a legal filename (not
+ * exceeding path length limits, etc.)
+ */
+
+ if (isOpen == SAVE_FILE) {
+ if (!data.saveNameRef) {
+ TkMacOSXDbgMsg("NavDialogGetSaveFileName failed");
+ goto nextFilename;
}
+
+ if (!CFStringGetCString(data.saveNameRef, saveName,
+ PATH_MAX + 1, kCFStringEncodingUTF8)) {
+ TkMacOSXDbgMsg("CFStringGetCString failed");
+ goto nextFilename;
+ }
+
+ if (strlen(pathPtr) + strlen(saveName) >= PATH_MAX) {
+ TkMacOSXDbgMsg("Path name too long");
+ goto nextFilename;
+ }
+
+ strcat(pathPtr, "/");
+ strcat(pathPtr, saveName);
+ }
+
+ /*
+ * Got a valid file name; put it in the result object.
+ */
+
+ if (multiple) {
+ Tcl_ListObjAppendElement(interp, theResult,
+ Tcl_NewStringObj(pathPtr, -1));
+ } else {
+ Tcl_SetStringObj(theResult, pathPtr, -1);
}
+
+ nextFilename:
+ ChkErr(AEDisposeDesc, &resultDesc);
}
+
+ installResult:
Tcl_SetObjResult(interp, theResult);
result = TCL_OK;
} else if (err == userCanceledErr) {
@@ -1004,10 +1034,11 @@ NavServicesGetFile(
}
if (menuItemNames) {
int i;
+
for (i = 0; i < ofdPtr->fl.numFilters; i++) {
CFRelease(menuItemNames[i]);
}
- ckfree((void *)menuItemNames);
+ ckfree((void *) menuItemNames);
}
if (options.popupExtension) {
CFRelease(options.popupExtension);
@@ -1057,7 +1088,7 @@ OpenEventProc(
selectItem.menuCreator = 0;
selectItem.menuType = ofd->initialType;
selectItem.menuItemName[0] = strlen(filterPtr->name);
- strncpy((char*) &selectItem.menuItemName[1],
+ strncpy((char *) &selectItem.menuItemName[1],
filterPtr->name, 255);
ChkErr(NavCustomControl, callBackParams->context,
kNavCtlSelectCustomType, &selectItem);
@@ -1118,85 +1149,80 @@ OpenEventProc(
pascal Boolean
OpenFileFilterProc(
- AEDesc* theItem, void* info,
+ AEDesc *theItem,
+ void *info,
NavCallBackUserData callBackUD,
NavFilterModes filterMode)
{
- OpenFileData *ofdPtr = ((NavHandlerUserData*) callBackUD)->ofdPtr;
+ OpenFileData *ofdPtr = ((NavHandlerUserData *) callBackUD)->ofdPtr;
int result = MATCHED;
- if (ofdPtr && ofdPtr->usePopup) {
- if (ofdPtr->fl.numFilters > 0) {
- if ((theItem->descriptorType == typeFSS)
- || (theItem->descriptorType == typeFSRef)) {
- NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo *) info;
- char fileName[256];
-
- if (!theInfo->isFolder) {
- OSType fileType;
- StringPtr fileNamePtr = NULL;
- Tcl_DString fileNameDString;
- int i;
- FileFilter *filterPtr;
-
- fileType =
- theInfo->fileAndFolder.fileInfo.finderInfo.fdType;
- Tcl_DStringInit (&fileNameDString);
-
- if (theItem->descriptorType == typeFSS) {
- int len;
- fileNamePtr = ((FSSpec *) *theItem->dataHandle)->name;
- len = fileNamePtr[0];
- strncpy(fileName, (char*) fileNamePtr + 1, len);
- fileName[len] = '\0';
- fileNamePtr = (unsigned char*) fileName;
- } else if ((theItem->descriptorType == typeFSRef)) {
- OSStatus err;
- FSRef *theRef = (FSRef *) *theItem->dataHandle;
- HFSUniStr255 uniFileName;
- err = ChkErr(FSGetCatalogInfo, theRef, kFSCatInfoNone,
- NULL, &uniFileName, NULL, NULL);
-
- if (err == noErr) {
- Tcl_UniCharToUtfDString (
- (Tcl_UniChar *) uniFileName.unicode,
- uniFileName.length, &fileNameDString);
- fileNamePtr = (unsigned char*)
- Tcl_DStringValue(&fileNameDString);
- }
- }
- if (ofdPtr->usePopup) {
- i = ofdPtr->curType;
- for (filterPtr = ofdPtr->fl.filters;
- filterPtr && i > 0; i--) {
- filterPtr = filterPtr->next;
- }
- if (filterPtr) {
- result = MatchOneType(fileNamePtr, fileType,
- ofdPtr, filterPtr);
- } else {
- result = UNMATCHED;
- }
- } else {
- /*
- * We are not using the popup menu. In this case, the
- * file is considered matched if it matches any of
- * the file filters.
- */
-
- result = UNMATCHED;
- for (filterPtr = ofdPtr->fl.filters; filterPtr;
- filterPtr = filterPtr->next) {
- if (MatchOneType(fileNamePtr, fileType,
- ofdPtr, filterPtr) == MATCHED) {
- result = MATCHED;
- break;
- }
- }
+ if (ofdPtr && ofdPtr->usePopup && ofdPtr->fl.numFilters > 0 &&
+ ((theItem->descriptorType == typeFSS)
+ || (theItem->descriptorType == typeFSRef))) {
+ NavFileOrFolderInfo *theInfo = info;
+ char fileName[256];
+ OSType fileType;
+ StringPtr fileNamePtr = NULL;
+ Tcl_DString fileNameDString;
+ int i;
+ FileFilter *filterPtr;
+
+ if (!theInfo->isFolder) {
+ fileType = theInfo->fileAndFolder.fileInfo.finderInfo.fdType;
+ Tcl_DStringInit(&fileNameDString);
+
+ if (theItem->descriptorType == typeFSS) {
+ int len;
+
+ fileNamePtr = ((FSSpec *) *theItem->dataHandle)->name;
+ len = fileNamePtr[0];
+ strncpy(fileName, (char *) fileNamePtr + 1, len);
+ fileName[len] = '\0';
+ fileNamePtr = (unsigned char *) fileName;
+ } else if ((theItem->descriptorType == typeFSRef)) {
+ OSStatus err;
+ FSRef *theRef = (FSRef *) *theItem->dataHandle;
+ HFSUniStr255 uniFileName;
+
+ err = ChkErr(FSGetCatalogInfo, theRef, kFSCatInfoNone,
+ NULL, &uniFileName, NULL, NULL);
+
+ if (err == noErr) {
+ Tcl_UniCharToUtfDString((Tcl_UniChar *)uniFileName.unicode,
+ uniFileName.length, &fileNameDString);
+ fileNamePtr = (unsigned char *)
+ Tcl_DStringValue(&fileNameDString);
+ }
+ }
+ if (ofdPtr->usePopup) {
+ i = ofdPtr->curType;
+ for (filterPtr = ofdPtr->fl.filters; filterPtr && i>0; i--) {
+ filterPtr = filterPtr->next;
+ }
+ if (filterPtr) {
+ result = MatchOneType(fileNamePtr, fileType, ofdPtr,
+ filterPtr);
+ } else {
+ result = UNMATCHED;
+ }
+ } else {
+ /*
+ * We are not using the popup menu. In this case, the file is
+ * considered matched if it matches any of the file filters.
+ */
+
+ result = UNMATCHED;
+ for (filterPtr = ofdPtr->fl.filters; filterPtr;
+ filterPtr = filterPtr->next) {
+ if (MatchOneType(fileNamePtr, fileType, ofdPtr,
+ filterPtr) == MATCHED) {
+ result = MATCHED;
+ break;
}
- Tcl_DStringFree (&fileNameDString);
}
}
+ Tcl_DStringFree(&fileNameDString);
}
}
return (result == MATCHED);
@@ -1231,20 +1257,20 @@ MatchOneType(
FileFilterClause *clausePtr;
/*
- * A file matches with a file type if it matches with at least one
- * clause of the type.
+ * A file matches with a file type if it matches with at least one clause
+ * of the type.
*
- * If the clause has both glob patterns and ostypes, the file must
- * match with at least one pattern AND at least one ostype.
+ * If the clause has both glob patterns and ostypes, the file must match
+ * with at least one pattern AND at least one ostype.
*
* If the clause has glob patterns only, the file must match with at least
* one pattern.
*
- * If the clause has mac types only, the file must match with at least
- * one mac type.
+ * If the clause has mac types only, the file must match with at least one
+ * mac type.
*
- * If the clause has neither glob patterns nor mac types, it's
- * considered an error.
+ * If the clause has neither glob patterns nor mac types, it's considered
+ * an error.
*/
for (clausePtr = filterPtr->clauses; clausePtr;
@@ -1286,10 +1312,7 @@ MatchOneType(
if (Tcl_StringMatch((char*) fileNamePtr, ext)) {
goto glob_matched;
- } else {
- goto glob_unmatched;
}
-
glob_unmatched:
continue;
@@ -1306,13 +1329,12 @@ MatchOneType(
}
/*
- * On Mac OS X, it is not uncommon for files to have NO
- * file type. But folks with Tcl code on Classic MacOS pretty
- * much assume that a generic file will have type TEXT. So
- * if we were strict about matching types when the source file
- * had NO type set, they would have to add another rule always
- * with no fileType. To avoid that, we pass the macMatch side
- * of the test if no fileType is set.
+ * On Mac OS X, it is not uncommon for files to have NO file type. But
+ * folks with Tcl code on Classic MacOS pretty much assume that a
+ * generic file will have type TEXT. So if we were strict about
+ * matching types when the source file had NO type set, they would
+ * have to add another rule always with no fileType. To avoid that, we
+ * pass the macMatch side of the test if no fileType is set.
*/
if (globMatched && (macMatched || (fileType == 0))) {
@@ -1328,8 +1350,8 @@ MatchOneType(
*
* TkAboutDlg --
*
- * Displays the default Tk About box. This code uses Macintosh
- * resources to define the content of the About Box.
+ * Displays the default Tk About box. This code uses Macintosh resources
+ * to define the content of the About Box.
*
* Results:
* None.
@@ -1385,7 +1407,7 @@ Tk_MessageBoxObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
AlertStdCFStringAlertParamRec paramCFStringRec;
AlertType alertType;
DialogRef dialogRef;
@@ -1399,7 +1421,7 @@ Tk_MessageBoxObjCmd(
int typeIndex, i, indexDefaultOption = 0, result = TCL_ERROR;
static const char *movableAlertStrings[] = {
- "-default",/* "-detail",*/ "-icon", "-message", "-parent", "-title",
+ "-default", "-detail", "-icon", "-message", "-parent", "-title",
"-type", NULL
};
static const char *movableTypeStrings[] = {
@@ -1413,7 +1435,7 @@ Tk_MessageBoxObjCmd(
"error", "info", "question", "warning", NULL
};
enum movableAlertOptions {
- ALERT_DEFAULT,/* ALERT_DETAIL,*/ ALERT_ICON, ALERT_MESSAGE, ALERT_PARENT,
+ ALERT_DEFAULT, ALERT_DETAIL, ALERT_ICON, ALERT_MESSAGE, ALERT_PARENT,
ALERT_TITLE, ALERT_TYPE
};
enum movableTypeOptions {
@@ -1484,115 +1506,109 @@ Tk_MessageBoxObjCmd(
}
switch (index) {
- case ALERT_DEFAULT:
- /*
- * Need to postpone processing of this option until we are
- * sure to know the '-type' as well.
- */
- haveDefaultOption = true;
- indexDefaultOption = i;
- break;
+ case ALERT_DEFAULT:
+ /*
+ * Need to postpone processing of this option until we are sure to
+ * know the '-type' as well.
+ */
-#if 0
- case ALERT_DETAIL:
- str = Tcl_GetString(objv[i + 1]);
- if (finemessageTextCF) {
- CFRelease(finemessageTextCF);
- }
- finemessageTextCF = CFStringCreateWithCString(NULL, str,
- kCFStringEncodingUTF8);
- break;
-#endif
+ haveDefaultOption = true;
+ indexDefaultOption = i;
+ break;
- case ALERT_ICON:
- if (Tcl_GetIndexFromObj(interp, objv[i + 1],
- movableIconStrings, "value", TCL_EXACT, &iconIndex)
- != TCL_OK) {
- goto end;
- }
- switch (iconIndex) {
- case ICON_ERROR:
- alertType = kAlertStopAlert;
- break;
- case ICON_INFO:
- alertType = kAlertNoteAlert;
- break;
- case ICON_QUESTION:
- alertType = kAlertCautionAlert;
- break;
- case ICON_WARNING:
- alertType = kAlertCautionAlert;
- break;
- }
- break;
+ case ALERT_DETAIL:
+ str = Tcl_GetString(objv[i + 1]);
+ if (finemessageTextCF) {
+ CFRelease(finemessageTextCF);
+ }
+ finemessageTextCF = CFStringCreateWithCString(NULL, str,
+ kCFStringEncodingUTF8);
+ break;
- case ALERT_MESSAGE:
- str = Tcl_GetString(objv[i + 1]);
- if (messageTextCF) {
- CFRelease(messageTextCF);
- }
- messageTextCF = CFStringCreateWithCString(NULL, str,
- kCFStringEncodingUTF8);
+ case ALERT_ICON:
+ if (Tcl_GetIndexFromObj(interp, objv[i + 1], movableIconStrings,
+ "value", TCL_EXACT, &iconIndex) != TCL_OK) {
+ goto end;
+ }
+ switch (iconIndex) {
+ case ICON_ERROR:
+ alertType = kAlertStopAlert;
break;
-
- case ALERT_PARENT:
- str = Tcl_GetString(objv[i + 1]);
- tkwin = Tk_NameToWindow(interp, str, tkwin);
- if (tkwin == NULL) {
- goto end;
- }
- if (((TkWindow*)tkwin)->window != None &&
- TkMacOSXHostToplevelExists(tkwin)) {
- haveParentOption = true;
- }
+ case ICON_INFO:
+ alertType = kAlertNoteAlert;
break;
-
- case ALERT_TITLE:
+ case ICON_QUESTION:
+ alertType = kAlertCautionAlert;
break;
+ case ICON_WARNING:
+ alertType = kAlertCautionAlert;
+ break;
+ }
+ break;
- case ALERT_TYPE:
- if (Tcl_GetIndexFromObj(interp, objv[i + 1],\
- movableTypeStrings, "value", TCL_EXACT, &typeIndex)
- != TCL_OK) {
- goto end;
- }
- switch (typeIndex) {
- case TYPE_ABORTRETRYIGNORE:
- paramCFStringRec.defaultText = CFSTR("Abort");
- paramCFStringRec.cancelText = CFSTR("Retry");
- paramCFStringRec.otherText = CFSTR("Ignore");
- paramCFStringRec.cancelButton =
- kAlertStdAlertOtherButton;
- break;
- case TYPE_OK:
- paramCFStringRec.defaultText = CFSTR("OK");
- break;
- case TYPE_OKCANCEL:
- paramCFStringRec.defaultText = CFSTR("OK");
- paramCFStringRec.cancelText = CFSTR("Cancel");
- break;
- case TYPE_RETRYCANCEL:
- paramCFStringRec.defaultText = CFSTR("Retry");
- paramCFStringRec.cancelText = CFSTR("Cancel");
- break;
- case TYPE_YESNO:
- paramCFStringRec.defaultText = CFSTR("Yes");
- paramCFStringRec.cancelText = CFSTR("No");
- break;
- case TYPE_YESNOCANCEL:
- paramCFStringRec.defaultText = CFSTR("Yes");
- paramCFStringRec.cancelText = CFSTR("No");
- paramCFStringRec.otherText = CFSTR("Cancel");
- paramCFStringRec.cancelButton =
- kAlertStdAlertOtherButton;
- break;
- }
+ case ALERT_MESSAGE:
+ str = Tcl_GetString(objv[i + 1]);
+ if (messageTextCF) {
+ CFRelease(messageTextCF);
+ }
+ messageTextCF = CFStringCreateWithCString(NULL, str,
+ kCFStringEncodingUTF8);
+ break;
+
+ case ALERT_PARENT:
+ str = Tcl_GetString(objv[i + 1]);
+ tkwin = Tk_NameToWindow(interp, str, tkwin);
+ if (tkwin == NULL) {
+ goto end;
+ }
+ if (((TkWindow *) tkwin)->window != None &&
+ TkMacOSXHostToplevelExists(tkwin)) {
+ haveParentOption = true;
+ }
+ break;
+
+ case ALERT_TITLE:
+ break;
+
+ case ALERT_TYPE:
+ if (Tcl_GetIndexFromObj(interp, objv[i + 1], movableTypeStrings,
+ "value", TCL_EXACT, &typeIndex) != TCL_OK) {
+ goto end;
+ }
+ switch (typeIndex) {
+ case TYPE_ABORTRETRYIGNORE:
+ paramCFStringRec.defaultText = CFSTR("Abort");
+ paramCFStringRec.cancelText = CFSTR("Retry");
+ paramCFStringRec.otherText = CFSTR("Ignore");
+ paramCFStringRec.cancelButton = kAlertStdAlertOtherButton;
+ break;
+ case TYPE_OK:
+ paramCFStringRec.defaultText = CFSTR("OK");
+ break;
+ case TYPE_OKCANCEL:
+ paramCFStringRec.defaultText = CFSTR("OK");
+ paramCFStringRec.cancelText = CFSTR("Cancel");
+ break;
+ case TYPE_RETRYCANCEL:
+ paramCFStringRec.defaultText = CFSTR("Retry");
+ paramCFStringRec.cancelText = CFSTR("Cancel");
break;
+ case TYPE_YESNO:
+ paramCFStringRec.defaultText = CFSTR("Yes");
+ paramCFStringRec.cancelText = CFSTR("No");
+ break;
+ case TYPE_YESNOCANCEL:
+ paramCFStringRec.defaultText = CFSTR("Yes");
+ paramCFStringRec.cancelText = CFSTR("No");
+ paramCFStringRec.otherText = CFSTR("Cancel");
+ paramCFStringRec.cancelButton = kAlertStdAlertOtherButton;
+ break;
+ }
+ break;
}
}
if (haveDefaultOption) {
-
/*
* Any '-default' option needs to know the '-type' option, which is why
* we do this here.
@@ -1675,19 +1691,18 @@ Tk_MessageBoxObjCmd(
}
}
if (err == noErr) {
- int ind;
-
/*
* Map 'itemHit' (1, 2, 3) to descriptive text string.
*/
- ind = nativeButtonIndexAndTypeToButtonIndex[typeIndex][itemHit];
+ int ind = nativeButtonIndexAndTypeToButtonIndex[typeIndex][itemHit];
+
Tcl_SetObjResult(interp, Tcl_NewStringObj(movableButtonStrings[ind],
-1));
result = TCL_OK;
}
-end:
+ end:
if (finemessageTextCF) {
CFRelease(finemessageTextCF);
}
@@ -1719,21 +1734,21 @@ AlertHandler(
EventRef eventRef,
void *userData)
{
- AlertHandlerUserData *data = (AlertHandlerUserData *) userData;
+ AlertHandlerUserData *data = userData;
HICommand cmd;
ChkErr(GetEventParameter,eventRef, kEventParamDirectObject, typeHICommand,
NULL, sizeof(cmd), NULL, &cmd);
switch (cmd.commandID) {
- case kHICommandOK:
- data->buttonIndex = 1;
- break;
- case kHICommandCancel:
- data->buttonIndex = 2;
- break;
- case kHICommandOther:
- data->buttonIndex = 3;
- break;
+ case kHICommandOK:
+ data->buttonIndex = 1;
+ break;
+ case kHICommandCancel:
+ data->buttonIndex = 2;
+ break;
+ case kHICommandOther:
+ data->buttonIndex = 3;
+ break;
}
if (data->buttonIndex) {
ChkErr(QuitAppModalLoopForWindow, data->dialogWindow);
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 63e26a1..db498f9 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -17,8 +17,6 @@
#include "tkMacOSXDebug.h"
#include "xbytes.h"
-#include "tclInt.h" /* for Tcl_CreateNamespace() */
-
/*
#ifdef TK_MAC_DEBUG
#define TK_MAC_DEBUG_DRAWING
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index c5de78d..85bfe05 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -3,50 +3,47 @@
*
* This file contains platform-specific procedures for theMac to provide
* basic operations needed for application embedding (where one
- * application can use as its main window an internal window from
- * some other application).
- * Currently only Toplevel embedding within the same Tk application is
- * allowed on the Macintosh.
+ * application can use as its main window an internal window from some
+ * other application). Currently only Toplevel embedding within the same
+ * Tk application is allowed on the Macintosh.
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXInt.h"
/*
* One of the following structures exists for each container in this
- * application. It keeps track of the container window and its
- * associated embedded window.
+ * application. It keeps track of the container window and its associated
+ * embedded window.
*/
typedef struct Container {
- Window parent; /* The Mac Drawable for the parent of
- * the pair (the container). */
- TkWindow *parentPtr; /* Tk's information about the container,
- * or NULL if the container isn't
+ Window parent; /* The Mac Drawable for the parent of the pair
+ * (the container). */
+ TkWindow *parentPtr; /* Tk's information about the container, or
+ * NULL if the container isn't in this
+ * process. */
+ Window embedded; /* The MacDrawable for the embedded window.
+ * Starts off as None, but gets filled in when
+ * the window is eventually created. */
+ TkWindow *embeddedPtr; /* Tk's information about the embedded window,
+ * or NULL if the embedded application isn't
* in this process. */
- Window embedded; /* The MacDrawable for the embedded
- * window. Starts off as None, but
- * gets filled in when the window is
- * eventually created. */
- TkWindow *embeddedPtr; /* Tk's information about the embedded
- * window, or NULL if the
- * embedded application isn't in
- * this process. */
- struct Container *nextPtr; /* Next in list of all containers in
- * this process. */
+ struct Container *nextPtr; /* Next in list of all containers in this
+ * process. */
} Container;
static Container *firstContainerPtr = NULL;
- /* First in list of all containers
- * managed by this process. */
+ /* First in list of all containers managed by
+ * this process. */
/*
- * Globals defined in this file
+ * Globals defined in this file:
*/
TkMacOSXEmbedHandler *tkMacOSXEmbedHandler = NULL;
@@ -55,25 +52,24 @@ TkMacOSXEmbedHandler *tkMacOSXEmbedHandler = NULL;
* Prototypes for static procedures defined in this file:
*/
-static void ContainerEventProc(ClientData clientData, XEvent *eventPtr);
-static void EmbeddedEventProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedActivateProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedFocusProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedGeometryRequest(Container * containerPtr, int width,
- int height);
-static void EmbedSendConfigure(Container *containerPtr);
-static void EmbedStructureProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedWindowDeleted(TkWindow *winPtr);
-
+static void ContainerEventProc(ClientData clientData, XEvent *eventPtr);
+static void EmbeddedEventProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedActivateProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedFocusProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedGeometryRequest(Container *containerPtr, int width,
+ int height);
+static void EmbedSendConfigure(Container *containerPtr);
+static void EmbedStructureProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedWindowDeleted(TkWindow *winPtr);
/*
*----------------------------------------------------------------------
*
* Tk_MacOSXSetEmbedHandler --
*
- * Registers a handler for an in process form of embedding, like
- * Netscape plugins, where Tk is loaded into the process, but does
- * not control the main window
+ * Registers a handler for an in process form of embedding, like Netscape
+ * plugins, where Tk is loaded into the process, but does not control the
+ * main window
*
* Results:
* None
@@ -93,7 +89,8 @@ Tk_MacOSXSetEmbedHandler(
Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
{
if (tkMacOSXEmbedHandler == NULL) {
- tkMacOSXEmbedHandler = (TkMacOSXEmbedHandler *) ckalloc(sizeof(TkMacOSXEmbedHandler));
+ tkMacOSXEmbedHandler = (TkMacOSXEmbedHandler *)
+ ckalloc(sizeof(TkMacOSXEmbedHandler));
}
tkMacOSXEmbedHandler->registerWinProc = registerWinProc;
tkMacOSXEmbedHandler->getPortProc = getPortProc;
@@ -126,9 +123,8 @@ TkpMakeWindow(
MacDrawable *macWin;
/*
- * If this window is marked as embedded then
- * the window structure should have already been
- * created in the TkpUseWindow function.
+ * If this window is marked as embedded then the window structure should
+ * have already been created in the TkpUseWindow function.
*/
if (Tk_IsEmbedded(winPtr)) {
@@ -155,18 +151,19 @@ TkpMakeWindow(
macWin->size = CGSizeZero;
if (Tk_IsTopLevel(macWin->winPtr)) {
/*
- *This will be set when we are mapped.
+ * This will be set when we are mapped.
*/
+
macWin->xOff = 0;
macWin->yOff = 0;
macWin->toplevel = macWin;
} else {
macWin->xOff = winPtr->parentPtr->privatePtr->xOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.x;
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.x;
macWin->yOff = winPtr->parentPtr->privatePtr->yOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.y;
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.y;
macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
}
macWin->toplevel->referenceCount++;
@@ -179,15 +176,15 @@ TkpMakeWindow(
*
* TkpUseWindow --
*
- * This procedure causes a Tk window to use a given X window as
- * its parent window, rather than the root window for the screen.
- * It is invoked by an embedded application to specify the window
- * in which it is embedded.
+ * This procedure causes a Tk window to use a given X window as its
+ * parent window, rather than the root window for the screen. It is
+ * invoked by an embedded application to specify the window in which it
+ * is embedded.
*
* Results:
- * The return value is normally TCL_OK. If an error occurs (such
- * as string not being a valid window spec), then the return value
- * is TCL_ERROR and an error message is left in the interp's result if
+ * The return value is normally TCL_OK. If an error occurs (such as
+ * string not being a valid window spec), then the return value is
+ * TCL_ERROR and an error message is left in the interp's result if
* interp is non-NULL.
*
* Side effects:
@@ -198,12 +195,12 @@ TkpMakeWindow(
int
TkpUseWindow(
- Tcl_Interp *interp, /* If not NULL, used for error reporting
- * if string is bogus. */
+ Tcl_Interp *interp, /* If not NULL, used for error reporting if
+ * string is bogus. */
Tk_Window tkwin, /* Tk window that does not yet have an
* associated X window. */
- CONST char *string) /* String identifying an X window to use
- * for tkwin; must be an integer value. */
+ CONST char *string) /* String identifying an X window to use for
+ * tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *usePtr;
@@ -217,13 +214,12 @@ TkpUseWindow(
}
/*
- * Decode the container pointer, and look for it among the
- * list of available containers.
+ * Decode the container pointer, and look for it among the list of
+ * available containers.
*
* N.B. For now, we are limiting the containers to be in the same Tk
- * application as tkwin, since otherwise they would not be in our list
- * of containers.
- *
+ * application as tkwin, since otherwise they would not be in our list of
+ * containers.
*/
if (Tcl_GetInt(interp, string, (int*) &parent) != TCL_OK) {
@@ -245,8 +241,8 @@ TkpUseWindow(
*/
/*
- * Save information about the container and the embedded window
- * in a Container structure. Currently, there must already be an existing
+ * Save information about the container and the embedded window in a
+ * Container structure. Currently, there must already be an existing
* Container structure, since we only allow the case where both container
* and embedded app. are in the same process.
*/
@@ -274,11 +270,11 @@ TkpUseWindow(
winPtr->privatePtr = macWin;
/*
- * The grafPtr will be NULL for a Tk in Tk embedded window.
- * It is none of our business what it is for a Tk not in Tk embedded window,
- * but we will initialize it to NULL, and let the registerWinProc
- * set it. In any case, you must always use TkMacOSXGetDrawablePort
- * to get the portPtr. It will correctly find the container's port.
+ * The grafPtr will be NULL for a Tk in Tk embedded window. It is none of
+ * our business what it is for a Tk not in Tk embedded window, but we will
+ * initialize it to NULL, and let the registerWinProc set it. In any case,
+ * you must always use TkMacOSXGetDrawablePort to get the portPtr. It will
+ * correctly find the container's port.
*/
macWin->grafPtr = NULL;
@@ -294,19 +290,17 @@ TkpUseWindow(
winPtr->flags |= TK_EMBEDDED;
-
/*
- * Make a copy of the TK_EMBEDDED flag, since sometimes
- * we need this to get the port after the TkWindow structure
- * has been freed.
+ * Make a copy of the TK_EMBEDDED flag, since sometimes we need this to
+ * get the port after the TkWindow structure has been freed.
*/
macWin->flags |= TK_EMBEDDED;
/*
- * Now check whether it is embedded in another Tk widget. If not (the first
- * case below) we see if there is an in-process embedding handler registered,
- * and if so, let that fill in the rest of the macWin.
+ * Now check whether it is embedded in another Tk widget. If not (the
+ * first case below) we see if there is an in-process embedding handler
+ * registered, and if so, let that fill in the rest of the macWin.
*/
if (containerPtr == NULL) {
@@ -329,10 +323,8 @@ TkpUseWindow(
containerPtr->embeddedPtr = macWin->winPtr;
containerPtr->nextPtr = firstContainerPtr;
firstContainerPtr = containerPtr;
-
}
} else {
-
/*
* The window is embedded in another Tk window.
*/
@@ -344,10 +336,9 @@ TkpUseWindow(
parent->winPtr->changes.border_width +
winPtr->changes.y;
-
/*
- * Finish filling up the container structure with the embedded window's
- * information.
+ * Finish filling up the container structure with the embedded
+ * window's information.
*/
containerPtr->embedded = (Window) macWin;
@@ -359,8 +350,7 @@ TkpUseWindow(
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
- (ClientData) winPtr);
-
+ winPtr);
}
return TCL_OK;
@@ -371,10 +361,10 @@ TkpUseWindow(
*
* TkpMakeContainer --
*
- * This procedure is called to indicate that a particular window
- * will be a container for an embedded application. This changes
- * certain aspects of the window's behavior, such as whether it
- * will receive events anymore.
+ * This procedure is called to indicate that a particular window will be
+ * a container for an embedded application. This changes certain aspects
+ * of the window's behavior, such as whether it will receive events
+ * anymore.
*
* Results:
* None.
@@ -387,18 +377,17 @@ TkpUseWindow(
void
TkpMakeContainer(
- Tk_Window tkwin) /* Token for a window that is about to
- * become a container. */
+ Tk_Window tkwin) /* Token for a window that is about to become
+ * a container. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
/*
- * Register the window as a container so that, for example, we can
- * make sure the argument to -use is valid.
+ * Register the window as a container so that, for example, we can make
+ * sure the argument to -use is valid.
*/
-
Tk_MakeWindowExist(tkwin);
containerPtr = (Container *) ckalloc(sizeof(Container));
containerPtr->parent = Tk_WindowId(tkwin);
@@ -410,23 +399,22 @@ TkpMakeContainer(
winPtr->flags |= TK_CONTAINER;
/*
- * Request SubstructureNotify events so that we can find out when
- * the embedded application creates its window or attempts to
- * resize it. Also watch Configure events on the container so that
- * we can resize the child to match. Also, pass activate events from
- * the container down to the embedded toplevel.
+ * Request SubstructureNotify events so that we can find out when the
+ * embedded application creates its window or attempts to resize it. Also
+ * watch Configure events on the container so that we can resize the child
+ * to match. Also, pass activate events from the container down to the
+ * embedded toplevel.
*/
Tk_CreateEventHandler(tkwin,
SubstructureNotifyMask|SubstructureRedirectMask,
- ContainerEventProc, (ClientData) winPtr);
+ ContainerEventProc, winPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbedStructureProc,
- (ClientData) containerPtr);
+ containerPtr);
Tk_CreateEventHandler(tkwin, ActivateMask, EmbedActivateProc,
- (ClientData) containerPtr);
+ containerPtr);
Tk_CreateEventHandler(tkwin, FocusChangeMask, EmbedFocusProc,
- (ClientData) containerPtr);
-
+ containerPtr);
}
/*
@@ -438,8 +426,7 @@ TkpMakeContainer(
* identifier for the associated container window.
*
* Results:
- * The return value is the MacDrawable for winPtr's
- * container window.
+ * The return value is the MacDrawable for winPtr's container window.
*
* Side effects:
* None.
@@ -448,8 +435,8 @@ TkpMakeContainer(
*/
MacDrawable *
-TkMacOSXContainerId(winPtr)
- TkWindow *winPtr; /* Tk's structure for an embedded window. */
+TkMacOSXContainerId(
+ TkWindow *winPtr) /* Tk's structure for an embedded window. */
{
Container *containerPtr;
@@ -468,8 +455,8 @@ TkMacOSXContainerId(winPtr)
*
* TkMacOSXGetHostToplevel --
*
- * Given the TkWindow, return the MacDrawable for the outermost
- * toplevel containing it. This will be a real Macintosh window.
+ * Given the TkWindow, return the MacDrawable for the outermost toplevel
+ * containing it. This will be a real Macintosh window.
*
* Results:
* Returns a MacDrawable corresponding to a Macintosh Toplevel
@@ -488,20 +475,18 @@ TkMacOSXGetHostToplevel(
topWinPtr = winPtr->privatePtr->toplevel->winPtr;
if (!Tk_IsEmbedded(topWinPtr)) {
- return winPtr->privatePtr->toplevel;
- } else {
- contWinPtr = TkpGetOtherWindow(topWinPtr);
+ return winPtr->privatePtr->toplevel;
+ }
+ contWinPtr = TkpGetOtherWindow(topWinPtr);
- /*
- * TODO: Here we should handle out of process embedding.
- */
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
- if (contWinPtr != NULL) {
- return TkMacOSXGetHostToplevel(contWinPtr);
- } else {
- return None;
- }
+ if (contWinPtr == NULL) {
+ return None;
}
+ return TkMacOSXGetHostToplevel(contWinPtr);
}
/*
@@ -509,10 +494,10 @@ TkMacOSXGetHostToplevel(
*
* TkpClaimFocus --
*
- * This procedure is invoked when someone asks for the input focus
- * to be put on a window in an embedded application, but the
- * application doesn't currently have the focus. It requests the
- * input focus from the container application.
+ * This procedure is invoked when someone asks for the input focus to be
+ * put on a window in an embedded application, but the application
+ * doesn't currently have the focus. It requests the input focus from the
+ * container application.
*
* Results:
* None.
@@ -525,11 +510,11 @@ TkMacOSXGetHostToplevel(
void
TkpClaimFocus(
- TkWindow *topLevelPtr, /* Top-level window containing desired
- * focus window; should be embedded. */
- int force) /* One means that the container should
- * claim the focus if it doesn't
- * currently have it. */
+ TkWindow *topLevelPtr, /* Top-level window containing desired focus
+ * window; should be embedded. */
+ int force) /* One means that the container should claim
+ * the focus if it doesn't currently have
+ * it. */
{
XEvent event;
Container *containerPtr;
@@ -544,7 +529,6 @@ TkpClaimFocus(
/* Empty loop body. */
}
-
event.xfocus.type = FocusIn;
event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display);
event.xfocus.send_event = 1;
@@ -560,9 +544,8 @@ TkpClaimFocus(
*
* TkpTestembedCmd --
*
- * This procedure implements the "testembed" command. It returns
- * some or all of the information in the list pointed to by
- * firstContainerPtr.
+ * This procedure implements the "testembed" command. It returns some or
+ * all of the information in the list pointed to by firstContainerPtr.
*
* Results:
* A standard Tcl result.
@@ -596,13 +579,11 @@ TkpTestembedCmd(
Tcl_DStringStartSublist(&dString);
if (containerPtr->parent == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->parent);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->parent);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->parentPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -612,13 +593,11 @@ TkpTestembedCmd(
}
if (containerPtr->embedded == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->embedded);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->embedded);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->embeddedPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -637,13 +616,13 @@ TkpTestembedCmd(
*
* TkpRedirectKeyEvent --
*
- * This procedure is invoked when a key press or release event
- * arrives for an application that does not believe it owns the
- * input focus. This can happen because of embedding; for example,
- * X can send an event to an embedded application when the real
- * focus window is in the container application and is an ancestor
- * of the container. This procedure's job is to forward the event
- * back to the application where it really belongs.
+ * This procedure is invoked when a key press or release event arrives
+ * for an application that does not believe it owns the input focus. This
+ * can happen because of embedding; for example, X can send an event to
+ * an embedded application when the real focus window is in the container
+ * application and is an ancestor of the container. This procedure's job
+ * is to forward the event back to the application where it really
+ * belongs.
*
* Results:
* None.
@@ -658,8 +637,8 @@ void
TkpRedirectKeyEvent(
TkWindow *winPtr, /* Window to which the event was originally
* reported. */
- XEvent *eventPtr) /* X event to redirect (should be KeyPress
- * or KeyRelease). */
+ XEvent *eventPtr) /* X event to redirect (should be KeyPress or
+ * KeyRelease). */
{
}
@@ -668,13 +647,13 @@ TkpRedirectKeyEvent(
*
* TkpGetOtherWindow --
*
- * If both the container and embedded window are in the same
- * process, this procedure will return either one, given the other.
+ * If both the container and embedded window are in the same process,
+ * this procedure will return either one, given the other.
*
* Results:
* If winPtr is a container, the return value is the token for the
- * embedded window, and vice versa. If the "other" window isn't in
- * this process, NULL is returned.
+ * embedded window, and vice versa. If the "other" window isn't in this
+ * process, NULL is returned.
*
* Side effects:
* None.
@@ -684,14 +663,14 @@ TkpRedirectKeyEvent(
TkWindow *
TkpGetOtherWindow(
- TkWindow *winPtr) /* Tk's structure for a container or
- * embedded window. */
+ TkWindow *winPtr) /* Tk's structure for a container or embedded
+ * window. */
{
Container *containerPtr;
/*
- * TkpGetOtherWindow returns NULL if both windows are not
- * in the same process...
+ * TkpGetOtherWindow returns NULL if both windows are not in the same
+ * process...
*/
if (!(winPtr->flags & TK_BOTH_HALVES)) {
@@ -733,7 +712,7 @@ EmbeddedEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
if (eventPtr->type == DestroyNotify) {
EmbedWindowDeleted(winPtr);
@@ -746,19 +725,19 @@ EmbeddedEventProc(
* ContainerEventProc --
*
* This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for the children of a container
- * window. It forwards relevant information, such as geometry
- * requests, from the events into the container's application.
+ * useful events are received for the children of a container window. It
+ * forwards relevant information, such as geometry requests, from the
+ * events into the container's application.
*
- * NOTE: on the Mac, only the DestroyNotify branch is ever taken.
- * We don't synthesize the other events.
+ * NOTE: on the Mac, only the DestroyNotify branch is ever taken. We
+ * don't synthesize the other events.
*
* Results:
* None.
*
* Side effects:
- * Depends on the event. For example, when ConfigureRequest events
- * occur, geometry information gets set for the container window.
+ * Depends on the event. For example, when ConfigureRequest events occur,
+ * geometry information gets set for the container window.
*
*----------------------------------------------------------------------
*/
@@ -768,18 +747,18 @@ ContainerEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
/*
- * Ignore any X protocol errors that happen in this procedure
- * (almost any operation could fail, for example, if the embedded
- * application has deleted its window).
+ * Ignore any X protocol errors that happen in this procedure (almost any
+ * operation could fail, for example, if the embedded application has
+ * deleted its window).
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, NULL);
/*
* Find the Container structure associated with the parent window.
@@ -795,10 +774,9 @@ ContainerEventProc(
if (eventPtr->type == CreateNotify) {
/*
- * A new child window has been created in the container. Record
- * its id in the Container structure (if more than one child is
- * created, just remember the last one and ignore the earlier
- * ones).
+ * A new child window has been created in the container. Record its id
+ * in the Container structure (if more than one child is created, just
+ * remember the last one and ignore the earlier ones).
*/
containerPtr->embedded = eventPtr->xcreatewindow.window;
@@ -806,14 +784,13 @@ ContainerEventProc(
if ((eventPtr->xconfigurerequest.x != 0)
|| (eventPtr->xconfigurerequest.y != 0)) {
/*
- * The embedded application is trying to move itself, which
- * isn't legal. At this point, the window hasn't actually
- * moved, but we need to send it a ConfigureNotify event to
- * let it know that its request has been denied. If the
- * embedded application was also trying to resize itself, a
- * ConfigureNotify will be sent by the geometry management
- * code below, so we don't need to do anything. Otherwise,
- * generate a synthetic event.
+ * The embedded application is trying to move itself, which isn't
+ * legal. At this point, the window hasn't actually moved, but we
+ * need to send it a ConfigureNotify event to let it know that its
+ * request has been denied. If the embedded application was also
+ * trying to resize itself, a ConfigureNotify will be sent by the
+ * geometry management code below, so we don't need to do
+ * anything. Otherwise, generate a synthetic event.
*/
if ((eventPtr->xconfigurerequest.width == winPtr->changes.width)
@@ -828,8 +805,8 @@ ContainerEventProc(
} else if (eventPtr->type == MapRequest) {
/*
* The embedded application's map request was ignored and simply
- * passed on to us, so we have to map the window for it to appear
- * on the screen.
+ * passed on to us, so we have to map the window for it to appear on
+ * the screen.
*/
XMapWindow(eventPtr->xmaprequest.display,
@@ -849,11 +826,10 @@ ContainerEventProc(
*
* EmbedStructureProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * a container window owned by this application gets resized
- * (and also at several other times that we don't care about).
- * This procedure reflects the size change in the embedded
- * window that corresponds to the container.
+ * This procedure is invoked by the Tk event dispatcher when a container
+ * window owned by this application gets resized (and also at several
+ * other times that we don't care about). This procedure reflects the
+ * size change in the embedded window that corresponds to the container.
*
* Results:
* None.
@@ -869,7 +845,7 @@ EmbedStructureProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
Tk_ErrorHandler errHandler;
if (eventPtr->type == ConfigureNotify) {
@@ -880,12 +856,10 @@ EmbedStructureProc(
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, NULL);
Tk_MoveResizeWindow((Tk_Window) containerPtr->embeddedPtr, 0, 0,
- (unsigned int) Tk_Width(
- (Tk_Window) containerPtr->parentPtr),
- (unsigned int) Tk_Height(
- (Tk_Window) containerPtr->parentPtr));
+ (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr),
+ (unsigned) Tk_Height((Tk_Window)containerPtr->parentPtr));
Tk_DeleteErrorHandler(errHandler);
}
} else if (eventPtr->type == DestroyNotify) {
@@ -898,10 +872,10 @@ EmbedStructureProc(
*
* EmbedActivateProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * Activate and Deactivate events occur for a container window owned
- * by this application. It is responsible for forwarding an activate
- * event down into the embedded toplevel.
+ * This procedure is invoked by the Tk event dispatcher when Activate and
+ * Deactivate events occur for a container window owned by this
+ * application. It is responsible for forwarding an activate event down
+ * into the embedded toplevel.
*
* Results:
* None.
@@ -917,7 +891,7 @@ EmbedActivateProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
if (containerPtr->embeddedPtr != NULL) {
if (eventPtr->type == ActivateNotify) {
@@ -933,11 +907,10 @@ EmbedActivateProc(
*
* EmbedFocusProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * FocusIn and FocusOut events occur for a container window owned
- * by this application. It is responsible for moving the focus
- * back and forth between a container application and an embedded
- * application.
+ * This procedure is invoked by the Tk event dispatcher when FocusIn and
+ * FocusOut events occur for a container window owned by this
+ * application. It is responsible for moving the focus back and forth
+ * between a container application and an embedded application.
*
* Results:
* None.
@@ -953,37 +926,37 @@ EmbedFocusProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
Display *display;
XEvent event;
if (containerPtr->embeddedPtr != NULL) {
- display = Tk_Display(containerPtr->parentPtr);
+ display = Tk_Display(containerPtr->parentPtr);
event.xfocus.serial = LastKnownRequestProcessed(display);
event.xfocus.send_event = false;
event.xfocus.display = display;
event.xfocus.mode = NotifyNormal;
event.xfocus.window = containerPtr->embedded;
- if (eventPtr->type == FocusIn) {
- /*
- * The focus just arrived at the container. Change the X focus
- * to move it to the embedded application, if there is one.
- * Ignore X errors that occur during this operation (it's
- * possible that the new focus window isn't mapped).
- */
+ if (eventPtr->type == FocusIn) {
+ /*
+ * The focus just arrived at the container. Change the X focus to
+ * move it to the embedded application, if there is one. Ignore X
+ * errors that occur during this operation (it's possible that the
+ * new focus window isn't mapped).
+ */
event.xfocus.detail = NotifyNonlinear;
event.xfocus.type = FocusIn;
-
} else if (eventPtr->type == FocusOut) {
- /* When the container gets a FocusOut event, it has to tell the embedded app
- * that it has lost the focus.
- */
+ /*
+ * When the container gets a FocusOut event, it has to tell the
+ * embedded app that it has lost the focus.
+ */
event.xfocus.type = FocusOut;
event.xfocus.detail = NotifyNonlinear;
- }
+ }
Tk_QueueWindowEvent(&event, TCL_QUEUE_MARK);
}
@@ -994,10 +967,10 @@ EmbedFocusProc(
*
* EmbedGeometryRequest --
*
- * This procedure is invoked when an embedded application requests
- * a particular size. It processes the request (which may or may
- * not actually honor the request) and reflects the results back
- * to the embedded application.
+ * This procedure is invoked when an embedded application requests a
+ * particular size. It processes the request (which may or may not
+ * actually honor the request) and reflects the results back to the
+ * embedded application.
*
* NOTE: On the Mac, this is a stub, since we don't synthesize
* ConfigureRequest events.
@@ -1006,10 +979,10 @@ EmbedFocusProc(
* None.
*
* Side effects:
- * If we deny the child's size change request, a Configure event
- * is synthesized to let the child know how big it ought to be.
- * Events get processed while we're waiting for the geometry
- * managers to do their thing.
+ * If we deny the child's size change request, a Configure event is
+ * synthesized to let the child know how big it ought to be. Events get
+ * processed while we're waiting for the geometry managers to do their
+ * thing.
*
*----------------------------------------------------------------------
*/
@@ -1022,13 +995,13 @@ EmbedGeometryRequest(
TkWindow *winPtr = containerPtr->parentPtr;
/*
- * Forward the requested size into our geometry management hierarchy
- * via the container window. We need to send a Configure event back
- * to the embedded application if we decide not to honor its
- * request; to make this happen, process all idle event handlers
- * synchronously here (so that the geometry managers have had a
- * chance to do whatever they want to do), and if the window's size
- * didn't change then generate a configure event.
+ * Forward the requested size into our geometry management hierarchy via
+ * the container window. We need to send a Configure event back to the
+ * embedded application if we decide not to honor its request; to make
+ * this happen, process all idle event handlers synchronously here (so
+ * that the geometry managers have had a chance to do whatever they want
+ * to do), and if the window's size didn't change then generate a
+ * configure event.
*/
Tk_GeometryRequest((Tk_Window) winPtr, width, height);
@@ -1046,13 +1019,12 @@ EmbedGeometryRequest(
*
* EmbedSendConfigure --
*
- * This is currently a stub. It is called to notify an
- * embedded application of its current size and location. This
- * procedure is called when the embedded application made a
- * geometry request that we did not grant, so that the embedded
- * application knows that its geometry didn't change after all.
- * It is a response to ConfigureRequest events, which we do not
- * currently synthesize on the Mac
+ * This is currently a stub. It is called to notify an embedded
+ * application of its current size and location. This procedure is called
+ * when the embedded application made a geometry request that we did not
+ * grant, so that the embedded application knows that its geometry didn't
+ * change after all. It is a response to ConfigureRequest events, which
+ * we do not currently synthesize on the Mac
*
* Results:
* None.
@@ -1074,9 +1046,9 @@ EmbedSendConfigure(
*
* EmbedWindowDeleted --
*
- * This procedure is invoked when a window involved in embedding
- * (as either the container or the embedded application) is
- * destroyed. It cleans up the Container structure for the window.
+ * This procedure is invoked when a window involved in embedding (as
+ * either the container or the embedded application) is destroyed. It
+ * cleans up the Container structure for the window.
*
* Results:
* None.
@@ -1095,16 +1067,14 @@ EmbedWindowDeleted(
Container *containerPtr, *prevPtr;
/*
- * Find the Container structure for this window. Delete the
- * information about the embedded application and free the container's
- * record.
+ * Find the Container structure for this window. Delete the information
+ * about the embedded application and free the container's record.
*/
prevPtr = NULL;
containerPtr = firstContainerPtr;
while (1) {
if (containerPtr->embeddedPtr == winPtr) {
-
/*
* We also have to destroy our parent, to clean up the container.
* Fabricate an event to do this.
@@ -1115,20 +1085,18 @@ EmbedWindowDeleted(
XEvent event;
event.xany.serial =
- Tk_Display(containerPtr->parentPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(containerPtr->parentPtr);
-
- event.xany.type = DestroyNotify;
- event.xany.window = containerPtr->parent;
- event.xdestroywindow.event = containerPtr->parent;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD);
-
+ Tk_Display(containerPtr->parentPtr)->request;
+ event.xany.send_event = False;
+ event.xany.display = Tk_Display(containerPtr->parentPtr);
+
+ event.xany.type = DestroyNotify;
+ event.xany.window = containerPtr->parent;
+ event.xdestroywindow.event = containerPtr->parent;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD);
}
containerPtr->embedded = None;
containerPtr->embeddedPtr = NULL;
-
break;
}
if (containerPtr->parentPtr == winPtr) {
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index b09e62e..1cf8951 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -2,261 +2,264 @@
* tkMacOSXFont.c --
*
* Contains the Macintosh implementation of the platform-independant
- * font package interface.
+ * font package interface. This version uses ATSU instead of Quickdraw.
+ *
+ * Copyright 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de
+ * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * Some functions were originally copied verbatim from the QuickDraw version
+ * of tkMacOSXFont.c, which had these copyright notices:
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * Todos:
+ *
+ * - Get away from Font Manager and Quickdraw functions as much as possible,
+ * replace with ATS functions instead.
+ *
+ * - Use Font Manager functions to translate ids from ATS to Font Manager
+ * instead of just assuming that they are the same.
+ *
+ * - Get a second font register going for fonts that are not assigned to a
+ * font family by the OS. On my system I have 27 fonts of that type,
+ * Hebrew, Arabic and Hindi fonts that actually come with the system.
+ * FMGetFontFamilyInstanceFromFont() returns -981 (kFMInvalidFontFamilyErr)
+ * for these and they are not listed when enumerating families, but they
+ * are when enumerating fonts directly. The problem that the OS sees may
+ * be that at least some of them do not contain any Latin characters. Note
+ * that such fonts can not be used for controls, because controls
+ * definitely require a family id (this assertion needs testing).
*/
#include "tkMacOSXPrivate.h"
#include "tkMacOSXFont.h"
-#include "tclInt.h" /* for Tcl_CreateNamespace() */
-
/*
- * Dealing with pascal strings.
- */
-
-#ifndef StrLength
-#define StrLength(s) (*((unsigned char *) (s)))
-#endif
-#ifndef StrBody
-#define StrBody(s) ((char *) (s) + 1)
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_FONTS
#endif
-#define pstrcmp(s1, s2) RelString((s1), (s2), 1, 1)
-#define pstrcasecmp(s1, s2) RelString((s1), (s2), 0, 1)
+*/
/*
- * The preferred font encodings.
+ * Problem: The sum of two parts is not the same as the whole. In particular
+ * the width of two separately measured strings will usually be larger than
+ * the width of them pasted together. Tk has a design bug here, because it
+ * generally assumes that this kind of arithmetic works.
+ * To workaround this, #define TK_MAC_COALESCE_LINE to 1 below, we then avoid
+ * lines that tremble and shiver while the cursor passes through them by
+ * undercutting the system and behind the scenes pasting strings together that
+ * look like they are on the same line and adjacent and that are drawn with
+ * the same font. To do this we need some global data.
*/
-
-static const char *encodingList[] = {
- "macRoman", "macJapan", NULL
-};
+#define TK_MAC_COALESCE_LINE 0
/*
- * The following structures are used to map the script/language codes of a
- * font to the name that should be passed to Tcl_GetTextEncoding() to obtain
- * the encoding for that font. The set of numeric constants is fixed and
- * defined by Apple.
+ * The following structure represents our Macintosh-specific implementation
+ * of a font object.
*/
-static TkStateMap scriptMap[] = {
- {smRoman, "macRoman"},
- {smJapanese, "macJapan"},
- {smTradChinese, "macChinese"},
- {smKorean, "macKorean"},
- {smArabic, "macArabic"},
- {smHebrew, "macHebrew"},
- {smGreek, "macGreek"},
- {smCyrillic, "macCyrillic"},
- {smRSymbol, "macRSymbol"},
- {smDevanagari, "macDevanagari"},
- {smGurmukhi, "macGurmukhi"},
- {smGujarati, "macGujarati"},
- {smOriya, "macOriya"},
- {smBengali, "macBengali"},
- {smTamil, "macTamil"},
- {smTelugu, "macTelugu"},
- {smKannada, "macKannada"},
- {smMalayalam, "macMalayalam"},
- {smSinhalese, "macSinhalese"},
- {smBurmese, "macBurmese"},
- {smKhmer, "macKhmer"},
- {smThai, "macThailand"},
- {smLaotian, "macLaos"},
- {smGeorgian, "macGeorgia"},
- {smArmenian, "macArmenia"},
- {smSimpChinese, "macSimpChinese"},
- {smTibetan, "macTIbet"},
- {smMongolian, "macMongolia"},
- {smGeez, "macEthiopia"},
- {smEastEurRoman, "macCentEuro"},
- {smVietnamese, "macVietnam"},
- {smExtArabic, "macSindhi"},
- {0, NULL}
-};
+typedef struct {
+ TkFont font; /* Stuff used by generic font package. Must
+ * be first in structure. */
-static TkStateMap romanMap[] = {
- {langCroatian, "macCroatian"},
- {langSlovenian, "macCroatian"},
- {langIcelandic, "macIceland"},
- {langRomanian, "macRomania"},
- {langTurkish, "macTurkish"},
- {langGreek, "macGreek"},
- {0, NULL}
-};
+ /*
+ * The ATSU view of the font and other text properties. Used for drawing
+ * and measuring.
+ */
-static TkStateMap cyrillicMap[] = {
- {langUkrainian, "macUkraine"},
- {langBulgarian, "macBulgaria"},
- {0, NULL}
-};
+ ATSUFontID atsuFontId; /* == FMFont. */
+ ATSUTextLayout atsuLayout; /* ATSU layout object, representing the whole
+ * text that ATSU sees with some option
+ * bits. */
+ ATSUStyle atsuStyle; /* ATSU style object, representing a run of
+ * text with the same properties. */
+
+ /*
+ * The QuickDraw view of the font. Used to configure controls.
+ */
+
+ FMFontFamily qdFont; /* == FMFontFamilyId, Carbon replacement for
+ * QD face numbers. */
+ short qdSize; /* Font size in points. */
+ short qdStyle; /* QuickDraw style bits. */
+} MacFont;
/*
- * The following structure represents a font family. It is assumed that
- * all screen fonts constructed from the same "font family" share certain
- * properties; all screen fonts with the same "font family" point to a
- * shared instance of this structure. The most important shared property
- * is the character existence metrics, used to determine if a screen font
- * can display a given Unicode character.
- *
- * Under Macintosh, a "font family" is uniquely identified by its face number.
+ * Information about font families, initialized at startup time. Font
+ * families are described by a mapping from UTF-8 names to MacOS font family
+ * IDs. The whole list is kept as the sorted array "familyList", allocated
+ * with ckrealloc().
+ *
+ * Note: This would have been easier, if we could just have used Tcl hash
+ * arrays. Unfortunately there seems to be no pre-packaged
+ * non-case-sensitive version of that available.
*/
+typedef struct {
+ const char * name;
+ FMFontFamily familyId;
+} MacFontFamily;
-#define FONTMAP_SHIFT 10
+static MacFontFamily * familyList = NULL;
+static int
+ familyListNextFree = 0, /* The next free slot in familyList. */
+ familyListMaxValid = 0, /* The top of the sorted area. */
+ familyListSize = 0; /* The size of the whole array. */
-#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar) * 8 - FONTMAP_SHIFT))
-#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
+/*
+ * A simple one-shot sub-allocator for fast and efficient allocation of
+ * strings. Used by the familyList array for the names. These strings are
+ * only allocated once at startup and never freed. If you ever need to
+ * re-initialize this, you can just ckfree() all the StringBlocks in the list
+ * and start over.
+ */
-typedef struct FontFamily {
- struct FontFamily *nextPtr; /* Next in list of all known font families. */
- int refCount; /* How many SubFonts are referring to this
- * FontFamily. When the refCount drops to
- * zero, this FontFamily may be freed. */
- /*
- * Key.
- */
+#define STRING_BLOCK_MAX (1024-8) /* Make sizeof(StringBlock) ==
+ * 1024. */
+typedef struct StringBlock {
+ struct StringBlock *next; /* Starting from "stringMemory" these
+ * blocks form a linked list. */
+ int nextFree; /* Top of the used area in the
+ * "strings" member. */
+ char strings[STRING_BLOCK_MAX]; /* The actual memory managed here. */
+} StringBlock;
+
+static StringBlock *stringMemory = NULL;
+
+#if TK_MAC_COALESCE_LINE
+static Tcl_DString currentLine; /* The current line as seen so far. This
+ * contains a Tcl_UniChar DString. */
+static int
+ currentY = -1, /* The Y position (row in pixels) of the
+ * current line. */
+ currentLeft = -1, /* The left edge (pixels) of the current
+ * line. */
+ currentRight = -1; /* The right edge (pixels) of the current
+ * line. */
+static const MacFont *currentFontPtr = NULL;
+ /* The font of the current line. */
+#endif /* TK_MAC_COALESCE_LINE */
+
+static int antialiasedTextEnabled;
- FMFontFamily faceNum; /* Unique face number key for this FontFamily. */
+/*
+ * The names for our "native" fonts.
+ */
- /*
- * Derived properties.
- */
+#define SYSTEMFONT_NAME "system"
+#define APPLFONT_NAME "application"
+#define MENUITEMFONT_NAME "menu"
+
+struct SystemFontMapEntry {
+ const ThemeFontID id;
+ const char *systemName;
+ const char *tkName;
+ const char *tkName1;
+};
- Tcl_Encoding encoding; /* Encoding for this font family. */
- int isSymbolFont; /* Non-zero if this is a symbol family. */
- int isMultiByteFont; /* Non-zero if this is a multi-byte family. */
- char typeTable[256]; /* Table that identfies all lead bytes for a
- * multi-byte family, used when measuring chars.
- * If a byte is a lead byte, the value at the
- * corresponding position in the typeTable is 1,
- * otherwise 0. If this is a single-byte font,
- * all entries are 0. */
- char *fontMap[FONTMAP_PAGES];
- /* Two-level sparse table used to determine
- * quickly if the specified character exists.
- * As characters are encountered, more pages
- * in this table are dynamically added. The
- * contents of each page is a bitmask
- * consisting of FONTMAP_BITSPERPAGE bits,
- * representing whether this font can be used
- * to display the given character at the
- * corresponding bit position. The high bits
- * of the character are used to pick which
- * page of the table is used. */
-} FontFamily;
+#define ThemeFont(n, ...) { kTheme##n##Font, "system" #n "Font", ##__VA_ARGS__ }
+static const struct SystemFontMapEntry systemFontMap[] = {
+ ThemeFont(System, "TkDefaultFont", "TkIconFont"),
+ ThemeFont(EmphasizedSystem, "TkCaptionFont"),
+ ThemeFont(SmallSystem, "TkHeadingFont", "TkTooltipFont"),
+ ThemeFont(SmallEmphasizedSystem),
+ ThemeFont(Application, "TkTextFont"),
+ ThemeFont(Label, "TkSmallCaptionFont"),
+ ThemeFont(Views),
+ ThemeFont(MenuTitle),
+ ThemeFont(MenuItem, "TkMenuFont"),
+ ThemeFont(MenuItemMark),
+ ThemeFont(MenuItemCmdKey),
+ ThemeFont(WindowTitle),
+ ThemeFont(PushButton),
+ ThemeFont(UtilityWindowTitle),
+ ThemeFont(AlertHeader),
+ ThemeFont(Toolbar),
+ ThemeFont(MiniSystem),
+ { kThemeSystemFontDetail, "systemDetailSystemFont" },
+ { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont" },
+ { -1, NULL }
+};
+#undef ThemeFont
/*
- * The following structure encapsulates an individual screen font. A font
- * object is made up of however many SubFonts are necessary to display a
- * stream of multilingual characters.
+ * Procedures used only in this file.
*/
-typedef struct SubFont {
- char **fontMap; /* Pointer to font map from the FontFamily,
- * cached here to save a dereference. */
- FontFamily *familyPtr; /* The FontFamily for this SubFont. */
-} SubFont;
+static void LayoutSetString(const MacFont *fontPtr,
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ const UniChar * uchars, int ulen);
/*
- * The following structure represents Macintosh's implementation of a font
- * object.
+ * The actual workers.
*/
-#define SUBFONT_SPACE 3
+static int MeasureStringWidth(const MacFont *fontPtr, int start, int end);
-typedef struct MacFont {
- TkFont font; /* Stuff used by generic font package. Must
- * be first in structure. */
- SubFont staticSubFonts[SUBFONT_SPACE];
- /* Builtin space for a limited number of
- * SubFonts. */
- int numSubFonts; /* Length of following array. */
- SubFont *subFontArray; /* Array of SubFonts that have been loaded
- * in order to draw/measure all the characters
- * encountered by this font so far. All fonts
- * start off with one SubFont initialized by
- * AllocFont() from the original set of font
- * attributes. Usually points to
- * staticSubFonts, but may point to malloced
- * space if there are lots of SubFonts. */
-
- short size; /* Font size in pixels, constructed from
- * font attributes. */
- short style; /* Style bits, constructed from font
- * attributes. */
-} MacFont;
+#if TK_MAC_COALESCE_LINE
+static const Tcl_UniChar *UpdateLineBuffer(const MacFont *fontPtr,
+ const TkMacOSXDrawingContext *drawingContextPtr, const char *source,
+ int numBytes, int x, int y, int * offset);
+#endif /* TK_MAC_COALESCE_LINE */
/*
- * The following structure is used to map between the UTF-8 name for a font and
- * the name that the Macintosh uses to refer to the font, in order to determine
- * if a font exists. The Macintosh names for fonts are stored in the encoding
- * of the font itself.
+ * Initialization and setup of a font data structure.
*/
-typedef struct FontNameMap {
- Tk_Uid utfName; /* The name of the font in UTF-8. */
- StringPtr nativeName; /* The name of the font in the font's encoding. */
- FMFontFamily faceNum; /* Unique face number for this font. */
-} FontNameMap;
+static const char *FamilyNameForFamilyID(FMFontFamily familyId);
+static void InitFont(FMFontFamily familyId, const char *familyName,
+ int size, int qdStyle, MacFont *fontPtr);
+static void InitATSUObjects(FMFontFamily familyId, short qdsize, short qdStyle,
+ ATSUFontID *fontIdPtr, ATSUTextLayout *layoutPtr, ATSUStyle *stylePtr);
+static void InitATSUStyle(ATSUFontID fontId, short ptSize, short qdStyle,
+ ATSUStyle style);
+static void SetFontFeatures(ATSUFontID fontId, int fixed, short size,
+ ATSUStyle style);
+static void AdjustFontHeight(MacFont *fontPtr);
+static void InitATSULayout(const TkMacOSXDrawingContext *drawingContextPtr,
+ ATSUTextLayout layout, int fixed);
+static void ReleaseFont(MacFont *fontPtr);
/*
- * The list of font families that are currently loaded. As screen fonts
- * are loaded, this list grows to hold information about what characters
- * exist in each font family.
+ * Finding fonts by name.
*/
-static FontFamily *fontFamilyList = NULL;
+static const MacFontFamily *FindFontFamilyOrAlias(const char *name);
+static const MacFontFamily *FindFontFamilyOrAliasOrFallback(const char *name);
/*
- * Information cached about the system at startup time.
+ * Doing interesting things with font families and fonts.
*/
-static FontNameMap *gFontNameMap = NULL;
-static GWorldPtr gWorld = NULL;
+static void InitFontFamilies(void);
+static OSStatus GetFontFamilyName(FMFontFamily fontFamily, char *name,
+ int numBytes);
/*
- * The names for our "native" fonts.
+ * Accessor functions and internal utilities for the font family list.
*/
-#define SYSTEMFONT_NAME "system"
-#define APPLFONT_NAME "application"
-#define MENUITEMFONT_NAME "menu"
+static const MacFontFamily *AddFontFamily(const char *name,
+ FMFontFamily familyId);
+static const MacFontFamily *FindFontFamily(const char *name);
+static Tcl_Obj *EnumFontFamilies(void);
-/*
- * Procedures used only in this file.
- */
+static OSStatus FontFamilyEnumCallback(ATSFontFamilyRef family, void *refCon);
+static void SortFontFamilies(void);
+static int CompareFontFamilies(const void *vp1, const void *vp2);
+static const char *AddString(const char *in);
-static FontFamily * AllocFontFamily(const MacFont *fontPtr, int family);
-static SubFont * CanUseFallback(MacFont *fontPtr, const char *fallbackName, int ch, SubFont **fixSubFontPtrPtr);
-static SubFont * CanUseFallbackWithAliases(MacFont *fontPtr, const char *faceName, int ch, Tcl_DString *nameTriedPtr, SubFont **fixSubFontPtrPtr);
-static SubFont * FindSubFontForChar(MacFont *fontPtr, int ch, SubFont **fixSubFontPtrPtr);
-static void FontMapInsert(SubFont *subFontPtr, int ch);
-static void FontMapLoadPage(SubFont *subFontPtr, int row);
-static int FontMapLookup(SubFont *subFontPtr, int ch);
-static void FreeFontFamily(FontFamily *familyPtr);
-static void InitFont(Tk_Window tkwin, int family, unsigned char *familyName, int size, int style, MacFont *fontPtr);
-static void InitSubFont(const MacFont *fontPtr, int family, SubFont *subFontPtr);
-static void MultiFontDrawText(MacFont *fontPtr, const char *source, int numBytes, int x, int y);
-static void ReleaseFont(MacFont *fontPtr);
-static void ReleaseSubFont(SubFont *subFontPtr);
-static int SeenName(const char *name, Tcl_DString *dsPtr);
-
-static const char * BreakLine(FontFamily *familyPtr, int flags, const char *source, int numBytes, int *widthPtr);
-static int GetFamilyNum(const char *faceName, short *familyPtr);
-static int GetFamilyOrAliasNum(const char *faceName, short *familyPtr);
-static Tcl_Encoding GetFontEncoding(int faceNum, int allowSymbol, int *isSymbolPtr);
-static Tk_Uid GetUtfFaceName(StringPtr faceNameStr);
static OSStatus GetThemeFontAndFamily(const ThemeFontID themeFontId,
FMFontFamily *fontFamily, unsigned char *fontName, SInt16 *fontSize,
Style *fontStyle);
+static void InitSystemFonts(TkMainInfo *mainPtr);
+static int CreateNamedSystemFont(Tcl_Interp *interp, Tk_Window tkwin,
+ const char* name, TkFontAttributes *faPtr);
/*
@@ -272,7 +275,7 @@ static OSStatus GetThemeFontAndFamily(const ThemeFontID themeFontId,
* None.
*
* Side effects:
- * See comments below.
+ * Initialization of variables local to this file.
*
*-------------------------------------------------------------------------
*/
@@ -281,107 +284,104 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- FMFontFamilyIterator fontFamilyIterator;
- FMFontFamily fontFamily;
- FontNameMap *tmpFontNameMap, *newFontNameMap, *mapPtr;
- int i, j, numFonts, fontMapOffset, isSymbol;
- Str255 nativeName;
- Tcl_DString ds;
- Tcl_Encoding encoding;
- Tcl_Encoding *encodings;
-
- if (gWorld == NULL) {
- Rect rect = {0, 0, 1, 1};
+ InitFontFamilies();
+ InitSystemFonts(mainPtr);
- SetFractEnable(0);
- /*
- * Used for saving and restoring state while drawing and measuring.
- */
- if (ChkErr(NewGWorld, &gWorld, 32, &rect, NULL, NULL, 0
-#ifdef __LITTLE_ENDIAN__
- | kNativeEndianPixMap
+#if TK_MAC_COALESCE_LINE
+ Tcl_DStringInit(&currentLine);
#endif
- ) != noErr) {
- Tcl_Panic("TkpFontPkgInit: NewGWorld failed");
- }
- /*
- * The name of each font is stored in the encoding of that font.
- * How would we translate a name from UTF-8 into the native encoding
- * of the font unless we knew the encoding of that font? We can't.
- * So, precompute the UTF-8 and native names of all fonts on the
- * system. The when the user asks for font by its UTF-8 name, we
- * lookup the name in that table and really ask for the font by its
- * native name. Any unknown UTF-8 names will be mapped to the system
- * font.
- */
- FMCreateFontFamilyIterator(NULL, NULL, kFMDefaultOptions, &fontFamilyIterator);
- numFonts = 0;
- while (FMGetNextFontFamily(&fontFamilyIterator, &fontFamily) != kFMIterationCompleted) {
- numFonts++;
- }
- tmpFontNameMap = (FontNameMap *) ckalloc(sizeof(FontNameMap) * numFonts);
- encodings = (Tcl_Encoding *) ckalloc(sizeof(Tcl_Encoding) * numFonts);
- mapPtr = tmpFontNameMap;
- FMResetFontFamilyIterator(NULL, NULL, kFMDefaultOptions, &fontFamilyIterator);
- i = 0;
- while (FMGetNextFontFamily(&fontFamilyIterator, &fontFamily) != kFMIterationCompleted) {
- mapPtr->faceNum = fontFamily;
- encodings[i] = GetFontEncoding(mapPtr->faceNum, 0, &isSymbol);
- FMGetFontFamilyName(fontFamily, nativeName );
- Tcl_ExternalToUtfDString(encodings[i], StrBody(nativeName), StrLength(nativeName), &ds);
- mapPtr->utfName = Tk_GetUid(Tcl_DStringValue(&ds));
- mapPtr->nativeName = (StringPtr) ckalloc(StrLength(nativeName) + 1);
- memcpy(mapPtr->nativeName, nativeName, StrLength(nativeName) + 1);
- Tcl_DStringFree(&ds);
- mapPtr++;
- i++;
- }
- FMDisposeFontFamilyIterator(&fontFamilyIterator);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * InitSystemFonts --
+ *
+ * Initialize named system fonts.
+ *
+ * Results:
+ *
+ * None.
+ *
+ * Side effects:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
- /*
- * Reorder FontNameMap so fonts with the preferred encodings are at
- * the front of the list. The relative order of fonts that all have
- * the same encoding is preserved. Fonts with unknown encodings get
- * stuck at the end.
- */
- newFontNameMap = (FontNameMap *) ckalloc(sizeof(FontNameMap) * (numFonts + 1));
- fontMapOffset = 0;
- for (i = 0; encodingList[i] != NULL; i++) {
- encoding = Tcl_GetEncoding(NULL, encodingList[i]);
- if (encoding == NULL) {
- continue;
- }
- for (j = 0; j < numFonts; j++) {
- if (encodings[j] == encoding) {
- newFontNameMap[fontMapOffset] = tmpFontNameMap[j];
- fontMapOffset++;
- Tcl_FreeEncoding(encodings[j]);
- tmpFontNameMap[j].utfName = NULL;
- }
+static void
+InitSystemFonts(
+ TkMainInfo *mainPtr)
+{
+ Tcl_Interp *interp = mainPtr->interp;
+ Tk_Window tkwin = (Tk_Window) mainPtr->winPtr;
+ const struct SystemFontMapEntry *systemFont = systemFontMap;
+ TkFontAttributes fa;
+
+ /* force this for now */
+ if (!mainPtr->winPtr->mainPtr) {
+ mainPtr->winPtr->mainPtr = mainPtr;
+ }
+ TkInitFontAttributes(&fa);
+ while (systemFont->systemName) {
+ Str255 fontName;
+ SInt16 fontSize;
+ Style fontStyle;
+
+ if (GetThemeFont(systemFont->id, smSystemScript, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ CopyPascalStringToC(fontName, (char*)fontName);
+ fa.family = Tk_GetUid((char*)fontName);
+ fa.size = fontSize;
+ fa.weight = (fontStyle & bold) ? TK_FW_BOLD : TK_FW_NORMAL;
+ fa.slant = (fontStyle & italic) ? TK_FS_ITALIC : TK_FS_ROMAN;
+ fa.underline = ((fontStyle & underline) != 0);
+ CreateNamedSystemFont(interp, tkwin, systemFont->systemName, &fa);
+ if (systemFont->tkName) {
+ CreateNamedSystemFont(interp, tkwin, systemFont->tkName, &fa);
}
- Tcl_FreeEncoding(encoding);
- }
- for (i = 0; i < numFonts; i++) {
- if (tmpFontNameMap[i].utfName != NULL) {
- newFontNameMap[fontMapOffset] = tmpFontNameMap[i];
- fontMapOffset++;
- Tcl_FreeEncoding(encodings[i]);
+ if (systemFont->tkName1) {
+ CreateNamedSystemFont(interp, tkwin, systemFont->tkName1, &fa);
}
}
- if (fontMapOffset != numFonts) {
- Tcl_Panic("TkpFontPkgInit: unexpected number of fonts");
- }
-
- mapPtr = &newFontNameMap[numFonts];
- mapPtr->utfName = NULL;
- mapPtr->nativeName = NULL;
- mapPtr->faceNum = 0;
-
- ckfree((char *) tmpFontNameMap);
- ckfree((char *) encodings);
-
- gFontNameMap = newFontNameMap;
+ systemFont++;
}
+ fa.family = Tk_GetUid("monaco");
+ fa.size = 11;
+ fa.weight = TK_FW_NORMAL;
+ fa.slant = TK_FS_ROMAN;
+ fa.underline = 0;
+ CreateNamedSystemFont(interp, tkwin, "TkFixedFont", &fa);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * CreateNamedSystemFont --
+ *
+ * Register a system font with the Tk named font mechanism.
+ *
+ * Results:
+ *
+ * Result from TkCreateNamedFont().
+ *
+ * Side effects:
+ *
+ * A new named font is added to the Tk font registry.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int
+CreateNamedSystemFont(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ const char* name,
+ TkFontAttributes *faPtr)
+{
+ TkDeleteNamedFont(NULL, tkwin, name);
+ return TkCreateNamedFont(interp, tkwin, name, faPtr);
}
/*
@@ -445,14 +445,14 @@ GetThemeFontAndFamily(
TkFont *
TkpGetNativeFont(
Tk_Window tkwin, /* For display where font will be used. */
- CONST char *name) /* Platform-specific font name. */
+ const char *name) /* Platform-specific font name. */
{
ThemeFontID themeFontId;
FMFontFamily fontFamily;
Str255 fontName;
SInt16 fontSize;
Style fontStyle;
- MacFont * fontPtr;
+ MacFont *fontPtr;
if (strcmp(name, SYSTEMFONT_NAME) == 0) {
themeFontId = kThemeSystemFont;
@@ -467,9 +467,10 @@ TkpGetNativeFont(
&fontStyle) != noErr) {
return NULL;
}
+ CopyPascalStringToC(fontName, (char*)fontName);
fontPtr = (MacFont *) ckalloc(sizeof(MacFont));
- InitFont(tkwin, fontFamily, fontName, fontSize, fontStyle, fontPtr);
+ InitFont(fontFamily, (char*)fontName, fontSize, fontStyle, fontPtr);
return (TkFont *) fontPtr;
}
@@ -512,56 +513,35 @@ TkpGetFontFromAttributes(
* will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin, /* For display where font will be used. */
- CONST TkFontAttributes *faPtr)
+ const TkFontAttributes *faPtr)
/* Set of attributes to match. */
{
- short faceNum, style;
- int i, j;
- const char *faceName, *fallback;
- char ***fallbacks;
+ short qdStyle;
+ FMFontFamily familyId;
+ const char *name;
+ const MacFontFamily *familyPtr;
MacFont *fontPtr;
- /*
- * Algorithm to get the closest font to the one requested.
- *
- * try fontname
- * try all aliases for fontname
- * foreach fallback for fontname
- * try the fallback
- * try all aliases for the fallback
- */
+ familyId = GetAppFont();
+ name = NULL;
+ qdStyle = 0;
- faceNum = 0;
- faceName = faPtr->family;
- if (faceName != NULL) {
- if (GetFamilyOrAliasNum(faceName, &faceNum) != 0) {
- goto found;
- }
- fallbacks = TkFontGetFallbacks();
- for (i = 0; fallbacks[i] != NULL; i++) {
- for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
- if (strcasecmp(faceName, fallback) == 0) {
- for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
- if (GetFamilyOrAliasNum(fallback, &faceNum)) {
- goto found;
- }
- }
- }
- break;
- }
+ if (faPtr->family != NULL) {
+ familyPtr = FindFontFamilyOrAliasOrFallback(faPtr->family);
+ if (familyPtr != NULL) {
+ name = familyPtr->name;
+ familyId = familyPtr->familyId;
}
}
-found:
- style = 0;
if (faPtr->weight != TK_FW_NORMAL) {
- style |= bold;
+ qdStyle |= bold;
}
if (faPtr->slant != TK_FS_ROMAN) {
- style |= italic;
+ qdStyle |= italic;
}
if (faPtr->underline) {
- style |= underline;
+ qdStyle |= underline;
}
if (tkFontPtr == NULL) {
fontPtr = (MacFont *) ckalloc(sizeof(MacFont));
@@ -569,7 +549,8 @@ found:
fontPtr = (MacFont *) tkFontPtr;
ReleaseFont(fontPtr);
}
- InitFont(tkwin, faceNum, NULL, faPtr->size, style, fontPtr);
+ InitFont(familyId, name, TkFontGetPoints(tkwin, faPtr->size),
+ qdStyle, fontPtr);
return (TkFont *) fontPtr;
}
@@ -623,14 +604,7 @@ TkpGetFontFamilies(
Tcl_Interp *interp, /* Interp to hold result. */
Tk_Window tkwin) /* For display to query. */
{
- FontNameMap *mapPtr;
- Tcl_Obj *resultPtr, *strPtr;
-
- resultPtr = Tcl_GetObjResult(interp);
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- strPtr = Tcl_NewStringObj(mapPtr->utfName, -1);
- Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
- }
+ Tcl_SetObjResult(interp, EnumFontFamilies());
}
/*
@@ -656,31 +630,168 @@ TkpGetSubFonts(
Tcl_Interp *interp, /* Interp to hold result. */
Tk_Font tkfont) /* Font object to query. */
{
- int i;
- Tcl_Obj *resultPtr, *strPtr;
- MacFont *fontPtr;
- FontFamily *familyPtr;
- Str255 nativeName;
+ /* We don't know much about our fallback fonts, ATSU does all that for
+ * us. We could use ATSUMatchFont to implement this function. But as
+ * the information is only used for testing, such an effort seems not
+ * very useful. */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetFontAttrsForChar --
+ *
+ * Retrieve the font attributes of the actual font used to render a
+ * given character.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The font attributes are stored in *faPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetFontAttrsForChar(
+ Tk_Window tkwin, /* Window on the font's display */
+ Tk_Font tkfont, /* Font to query */
+ Tcl_UniChar c, /* Character of interest */
+ TkFontAttributes* faPtr) /* Output: Font attributes */
+{
+ const MacFont * fontPtr = (const MacFont *) tkfont;
+ UniChar uchar = c;
+ TkMacOSXDrawingContext drawingContext;
+ OSStatus err;
+ ATSUFontID fontId;
+ UniCharArrayOffset changedOffset;
+ UniCharCount changedLength;
- resultPtr = Tcl_GetObjResult(interp);
- fontPtr = (MacFont *) tkfont;
- for (i = 0; i < fontPtr->numSubFonts; i++) {
- familyPtr = fontPtr->subFontArray[i].familyPtr;
- GetFontName(familyPtr->faceNum, nativeName);
- strPtr = Tcl_NewStringObj(GetUtfFaceName(nativeName), -1);
- Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
+ /*
+ * Most of the attributes are just copied from the base font. This
+ * assumes that all fonts can have all attributes.
+ */
+
+ *faPtr = fontPtr->font.fa;
+
+ /*
+ * But the name of the actual font may still differ, so we activate the
+ * string as an ATSU layout and ask ATSU about the fallback.
+ */
+ if (!TkMacOSXSetupDrawingContext(Tk_WindowId(tkwin), NULL, 1,
+ &drawingContext)) {
+ Tcl_Panic("TkpGetFontAttrsForChar: drawingContext not setup");
+ }
+
+ LayoutSetString(fontPtr, &drawingContext, &uchar, 1);
+
+ fontId = fontPtr->atsuFontId;
+ err = ATSUMatchFontsToText(
+ fontPtr->atsuLayout, 0, 1,
+ &fontId, &changedOffset, &changedLength);
+ if (err != kATSUFontsMatched && err != noErr) {
+ TkMacOSXDbgMsg("Can't match \\u%04X", (unsigned) c);
+ }
+
+ if (err == kATSUFontsMatched) {
+ /*
+ * A fallback was used and the actual font is in fontId. Determine
+ * the name.
+ */
+
+ FMFontFamily fontFamilyId;
+ FMFontStyle fontStyle;
+ int i;
+
+ err = ChkErr(FMGetFontFamilyInstanceFromFont, fontId, &fontFamilyId,
+ &fontStyle);
+ if (err == noErr) {
+ /*
+ * Find the canonical name in our global list.
+ */
+
+ for (i=0; i<familyListMaxValid; ++i) {
+ if (fontFamilyId == familyList[i].familyId) {
+ faPtr->family = familyList[i].name;
+ break;
+ }
+ }
+ if (i >= familyListMaxValid) {
+ TkMacOSXDbgMsg("Can't find font %d for \\u%04X", fontFamilyId,
+ (unsigned) c);
+ }
+ }
}
+
+ TkMacOSXRestoreDrawingContext(&drawingContext);
}
/*
*---------------------------------------------------------------------------
*
- * Tk_MeasureChars --
+ * Tk_MeasureChars --
+ *
+ * Determine the number of characters from the string that will fit in
+ * the given horizontal span. The measurement is done under the
+ * assumption that Tk_DrawChars() will be used to actually display the
+ * characters.
*
- * Determine the number of characters from the string that will fit
- * in the given horizontal span. The measurement is done under the
- * assumption that Tk_DrawChars() will be used to actually display
- * the characters.
+ * With ATSUI we need the line context to do this right, so we have the
+ * actual implementation in TkpMeasureCharsInContext().
+ *
+ * Results:
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
+ *
+ * Side effects:
+ * None.
+ *
+ * Todo:
+ * Effects of the "flags" parameter are untested.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+Tk_MeasureChars(
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
+ * permissible line length; don't consider any
+ * character that would cross this x-position.
+ * If < 0, then line length is unbounded and
+ * the flags argument is ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fit on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ return TkpMeasureCharsInContext(tkfont, source, numBytes, 0, numBytes,
+ maxLength, flags, lengthPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpMeasureCharsInContext --
+ *
+ * Determine the number of bytes from the string that will fit in the
+ * given horizontal span. The measurement is done under the assumption
+ * that TkpDrawCharsInContext() will be used to actually display the
+ * characters.
+ *
+ * This one is almost the same as Tk_MeasureChars(), but with access to
+ * all the characters on the line for context.
*
* Results:
* The return value is the number of bytes from source that
@@ -695,150 +806,292 @@ TkpGetSubFonts(
*/
int
-Tk_MeasureChars(
+TkpMeasureCharsInContext(
Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char * source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
- int numBytes, /* Maximum number of bytes to consider
- * from source string. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string in all. */
+ int rangeStart, /* Index of first byte to measure. */
+ int rangeLength, /* Length of range to measure in bytes. */
int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length; don't consider any
- * character that would cross this
- * x-position. If < 0, then line length is
- * unbounded and the flags argument is
- * ignored. */
+ * character that would cross this x-position.
+ * If < 0, then line length is unbounded and
+ * the flags argument is ignored. */
int flags, /* Various flag bits OR-ed together:
* TK_PARTIAL_OK means include the last char
- * which only partially fit on this line.
+ * which only partially fits on this line.
* TK_WHOLE_WORDS means stop on a word
- * boundary, if possible.
- * TK_AT_LEAST_ONE means return at least one
- * character even if no characters fit. */
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even
+ * if no characters fit. If TK_WHOLE_WORDS
+ * and TK_AT_LEAST_ONE are set and the first
+ * word doesn't fit, we return at least one
+ * character or whatever characters fit into
+ * maxLength. TK_ISOLATE_END means that the
+ * last character should not be considered in
+ * context with the rest of the string (used
+ * for breaking lines). */
int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
- MacFont *fontPtr;
- SubFont *thisSubFontPtr, *lastSubFontPtr;
- CGrafPtr savePort;
- Boolean portChanged;
- int curX, curByte;
+ const MacFont *fontPtr = (const MacFont *) tkfont;
+ int curX = -1, curByte = 0;
+ UniChar *uchars;
+ int ulen;
+ UniCharArrayOffset urstart, urlen, urend;
+ Tcl_DString ucharBuffer;
+ int forceCharacterMode = 0;
/*
- * According to "Inside Macintosh: Text", the Macintosh may
- * automatically substitute
- * ligatures or context-sensitive presentation forms when
- * measuring/displaying text within a font run. We cannot safely
- * measure individual characters and add up the widths w/o errors.
- * However, if we convert a range of text from UTF-8 to, say,
- * Shift-JIS, and get the offset into the Shift-JIS string as to
- * where a word or line break would occur, then can we map that
- * number back to UTF-8?
+ * Sanity checks.
*/
- fontPtr = (MacFont *) tkfont;
+ if (rangeStart < 0 || (rangeStart+rangeLength) > numBytes) {
+ TkMacOSXDbgMsg("Bad parameters");
+ *lengthPtr = 0;
+ return 0;
+ }
- portChanged = QDSwapPort(gWorld, &savePort);
+ /*
+ * Get simple no-brainers out of the way.
+ */
- TextSize(fontPtr->size);
- TextFace(fontPtr->style);
+ if (rangeLength == 0 || (maxLength == 0 && !(flags & TK_AT_LEAST_ONE))) {
+ *lengthPtr = 0;
+ return 0;
+ }
- lastSubFontPtr = &fontPtr->subFontArray[0];
+ Tcl_DStringInit(&ucharBuffer);
+ uchars = Tcl_UtfToUniCharDString(source, numBytes, &ucharBuffer);
+ ulen = Tcl_DStringLength(&ucharBuffer) / sizeof(Tcl_UniChar);
+ LayoutSetString(fontPtr, NULL, uchars, ulen);
- if (numBytes == 0) {
- curX = 0;
- curByte = 0;
- } else if (maxLength < 0) {
- const char *p, *end, *next;
- Tcl_UniChar ch;
- FontFamily *familyPtr;
- Tcl_DString runString;
+ urstart = Tcl_NumUtfChars(source, rangeStart);
+ urlen = Tcl_NumUtfChars(source+rangeStart,rangeLength);
+ urend = urstart + urlen;
+
+ if (maxLength < 0) {
+ curX = MeasureStringWidth(fontPtr, urstart, urend);
+ curByte = rangeLength;
+ } else {
+ UniCharArrayOffset offset = 0;
+ OSStatus err;
/*
- * A three step process:
- * 1. Find a contiguous range of characters that can all be
- * represented by a single screen font.
- * 2. Convert those chars to the encoding of that font.
- * 3. Measure converted chars.
+ * Have some upper limit on the size actually used.
*/
- curX = 0;
- end = source + numBytes;
- for (p = source; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
- if (thisSubFontPtr != lastSubFontPtr) {
- familyPtr = lastSubFontPtr->familyPtr;
- TextFont(familyPtr->faceNum);
- Tcl_UtfToExternalDString(familyPtr->encoding, source,
- p - source, &runString);
- curX += TextWidth(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
- lastSubFontPtr = thisSubFontPtr;
- source = p;
+ if (maxLength > 32767) {
+ maxLength = 32767;
+ }
+
+ offset = urstart;
+ err = noErr;
+
+ if (maxLength > 1) {
+ /*
+ * Let the system do some work by calculating a line break.
+ *
+ * Somehow ATSUBreakLine seems to assume that it needs at least
+ * one pixel padding. So we add one to the limit. Note also
+ * that ATSUBreakLine sometimes runs into an endless loop when
+ * the third parameter is equal or less than IntToFixed(2), so we
+ * need at least IntToFixed(3) (at least that's the current state
+ * of my knowledge).
+ */
+
+ err = ATSUBreakLine(fontPtr->atsuLayout, urstart,
+ IntToFixed(maxLength+1), false, /* !iUseAsSoftLineBreak */
+ &offset);
+
+ /*
+ * There is no way to signal an error from this routine, so we
+ * use predefined offset=urstart and otherwise ignore the
+ * possibility.
+ */
+
+ if ((err != noErr) && (err != kATSULineBreakInWord)) {
+ TkMacOSXDbgMsg("ATSUBreakLine failed: %ld for '%.*s'", err,
+ rangeLength, source+rangeStart);
+ }
+
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("measure: '%.*s', break offset=%ld, errcode=%ld",
+ rangeLength, source+rangeStart, offset, err);
+#endif
+
+ /*
+ * ATSUBreakLine includes the whitespace that separates words,
+ * but we don't want that. Besides, ATSUBreakLine thinks that
+ * spaces don't occupy pixels at the end of the break, which is
+ * also something we like to decide for ourself.
+ */
+
+ while ((offset > urstart) && (uchars[offset-1] == ' ')) {
+ offset--;
}
- p = next;
}
- familyPtr = lastSubFontPtr->familyPtr;
- TextFont(familyPtr->faceNum);
- Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source,
- &runString);
- curX += TextWidth(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
- curByte = numBytes;
- } else {
- const char *p, *end, *next, *sourceOrig;
- int widthLeft;
- Tcl_UniChar ch;
- const char *rest = NULL;
/*
- * How many chars will fit in the space allotted?
+ * Fix up left-overs for the TK_WHOLE_WORDS case.
*/
- if (maxLength > 32767) {
- maxLength = 32767;
+ if (flags & TK_WHOLE_WORDS) {
+ if ((flags & TK_AT_LEAST_ONE) && ((offset == urstart)
+ || ((offset != urend) && (uchars[offset] != ' ')))) {
+ /*
+ * With TK_AT_LEAST_ONE, if we are the the start of the
+ * range, we need to add at least one character. If we are
+ * not at the end of a word, we must be in the middle of the
+ * first word still and we want to just use what we have so
+ * far. In both cases we still need to find the right
+ * character boundary, so we set a flag that gets us into the
+ * code for character mode below.
+ */
+
+ forceCharacterMode = 1;
+
+ } else {
+ /*
+ * If we are not at the end of a word, we must be in the
+ * middle of the first word still. Return 0.
+ */
+
+ if ((offset != urend) && (uchars[offset] != ' ')) {
+ offset = urstart;
+ curX = 0;
+ }
+ }
}
- widthLeft = maxLength;
- sourceOrig = source;
- end = source + numBytes;
- for (p = source; p < end; p = next) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
- if (thisSubFontPtr != lastSubFontPtr) {
- if (p > source) {
- rest = BreakLine(lastSubFontPtr->familyPtr, flags, source,
- p - source, &widthLeft);
- flags &= ~TK_AT_LEAST_ONE;
- if (rest != NULL) {
- p = source;
+ if (offset > urend) {
+ offset = urend;
+ }
+
+ /*
+ * If "flags" says that we don't actually want a word break, we need
+ * to find the next character break ourself, as ATSUBreakLine will
+ * only give us word breaks. Do a simple linear search.
+ *
+ * Even do this, if ATSUBreakLine returned kATSULineBreakInWord,
+ * because we have not accounted correctly for all of the flags yet,
+ * like TK_AT_LEAST_ONE.
+ */
+
+ if ((!(flags & TK_WHOLE_WORDS) || forceCharacterMode) && (offset <= urend)) {
+ UniCharArrayOffset lastOffset = offset;
+ UniCharArrayOffset nextoffset;
+ int lastX = -1;
+ int wantonemorechar = -1; /* undecided */
+
+ while (offset <= urend) {
+ if (flags & TK_ISOLATE_END) {
+ LayoutSetString(fontPtr, NULL, uchars, offset);
+ }
+ curX = MeasureStringWidth(fontPtr, urstart, offset);
+
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("measure: '%.*s', try until=%ld, width=%d",
+ rangeLength, source+rangeStart, offset, curX);
+#endif
+
+ if (curX > maxLength) {
+ /*
+ * Even if we are over the limit, we may want another
+ * character in some situations. Than we keep looking
+ * for one more character.
+ */
+
+ if (wantonemorechar == -1) {
+ wantonemorechar = ((flags & TK_AT_LEAST_ONE) &&
+ (lastOffset == urstart)) ||
+ ((flags & TK_PARTIAL_OK) &&
+ (lastX != maxLength));
+ if (!wantonemorechar) {
+ break;
+ }
+ lastX = curX;
+ }
+
+ /*
+ * There may belong combining marks to this character.
+ * Wait for a new curX to collect them all.
+ */
+
+ if (lastX != curX) {
break;
}
}
- lastSubFontPtr = thisSubFontPtr;
- source = p;
+
+ /*
+ * Save this position, so we can come back to it.
+ */
+
+ lastX = curX;
+ lastOffset = offset;
+
+ /*
+ * Increment offset by one character, taking combining marks
+ * into account.
+ */
+
+ if (offset >= urend) {
+ break;
+ }
+ nextoffset = 0;
+ if (flags & TK_ISOLATE_END) {
+ LayoutSetString(fontPtr, NULL, uchars, ulen);
+ }
+ err = ChkErr(ATSUNextCursorPosition, fontPtr->atsuLayout,
+ offset, kATSUByCluster, &nextoffset);
+ if (err != noErr) {
+ break;
+ }
+ if (nextoffset <= offset) {
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("ATSUNextCursorPosition: Can't move further"
+ " (shouldn't happen, bad data?)");
+#endif
+ break;
+ }
+
+ offset = nextoffset;
}
- }
- if (p > source) {
- rest = BreakLine(lastSubFontPtr->familyPtr, flags, source, p - source,
- &widthLeft);
+ /*
+ * We have overshot one character, so backup one position.
+ */
+
+ curX = lastX;
+ offset = lastOffset;
}
- if (rest == NULL) {
- curByte = numBytes;
- } else {
- curByte = rest - sourceOrig;
+ if (curX < 0) {
+ if (flags & TK_ISOLATE_END) {
+ LayoutSetString(fontPtr, NULL, uchars, offset);
+ }
+ curX = MeasureStringWidth(fontPtr, urstart, offset);
}
- curX = maxLength - widthLeft;
- }
- if (portChanged) {
- QDSwapPort(savePort, NULL);
+ curByte = Tcl_UtfAtIndex(source, offset) - source;
+ curByte -= rangeStart;
}
+ Tcl_DStringFree(&ucharBuffer);
+
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("measure: '%.*s', maxLength=%d, flags=%s%s%s%s "
+ "-> width=%d, bytes=%d",
+ rangeLength, source+rangeStart, maxLength,
+ flags & TK_PARTIAL_OK ? "partialOk " : "",
+ flags & TK_WHOLE_WORDS ? "wholeWords " : "",
+ flags & TK_AT_LEAST_ONE ? "atLeastOne " : "",
+ flags & TK_ISOLATE_END ? "isolateEnd " : "",
+ curX, curByte);
+#endif
+
*lengthPtr = curX;
return curByte;
}
@@ -846,151 +1099,51 @@ Tk_MeasureChars(
/*
*---------------------------------------------------------------------------
*
- * BreakLine --
+ * Tk_DrawChars --
+ *
+ * Draw a string of characters on the screen.
*
- * Determine where the given line of text should be broken so that it
- * fits in the specified range. Before calling this function, the
- * font values and graphics port must be set.
+ * With ATSUI we need the line context to do this right, so we have the
+ * actual implementation in TkpDrawCharsInContext().
*
* Results:
- * The return value is NULL if the specified range is larger that the
- * space the text needs, and *widthLeftPtr is filled with how much
- * space is left in the range after measuring the whole text buffer.
- * Otherwise, the return value is a pointer into the text buffer that
- * indicates where the line should be broken (up to, but not including
- * that character), and *widthLeftPtr is filled with how much space is
- * left in the range after measuring up to that character.
+ * None.
*
* Side effects:
- * None.
+ * Information gets drawn on the screen.
*
*---------------------------------------------------------------------------
*/
-static const char *
-BreakLine(
- FontFamily *familyPtr, /* FontFamily that describes the font values
- * that are already selected into the graphics
- * port. */
- int flags, /* Various flag bits OR-ed together:
- * TK_PARTIAL_OK means include the last char
- * which only partially fit on this line.
- * TK_WHOLE_WORDS means stop on a word
- * boundary, if possible.
- * TK_AT_LEAST_ONE means return at least one
- * character even if no characters fit. */
- const char *source, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. */
- int numBytes, /* Maximum number of bytes to consider
- * from source string. */
- int *widthLeftPtr) /* On input, specifies size of range into
- * which characters from source buffer should
- * be fit. On output, filled with how much
- * space is left after fitting as many
- * characters as possible into the range.
- * Result may be negative if TK_AT_LEAST_ONE
- * was specified in the flags argument. */
+void
+Tk_DrawChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn; must
+ * be the same as font used in GC. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ int x, int y) /* Coordinates at which to place origin of the
+ * string when drawing. */
{
- Fixed pixelWidth, widthLeft;
- StyledLineBreakCode breakCode;
- Tcl_DString runString;
- long textOffset;
- Boolean leadingEdge;
- Point point;
- int charOffset, thisCharWasDoubleByte;
- char *p, *end, *typeTable;
-
- TextFont(familyPtr->faceNum);
- Tcl_UtfToExternalDString(familyPtr->encoding, source, numBytes,
- &runString);
- pixelWidth = IntToFixed(*widthLeftPtr) + 1;
- if (flags & TK_WHOLE_WORDS) {
- textOffset = (flags & TK_AT_LEAST_ONE);
- widthLeft = pixelWidth;
- breakCode = StyledLineBreak(Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString), 0, Tcl_DStringLength(&runString),
- 0, &widthLeft, &textOffset);
- if (breakCode != smBreakOverflow) {
- /*
- * StyledLineBreak includes all the space characters at the end of
- * line that we want to suppress.
- */
-
- textOffset = VisibleLength(Tcl_DStringValue(&runString), textOffset);
- goto getoffset;
- }
- } else {
- point.v = 1;
- point.h = 1;
- textOffset = PixelToChar(Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString), 0, pixelWidth, &leadingEdge,
- &widthLeft, smOnlyStyleRun, point, point);
- if (FixedToInt(widthLeft) < 0) {
- goto getoffset;
- }
- }
- *widthLeftPtr = FixedToInt(widthLeft);
- Tcl_DStringFree(&runString);
- return NULL;
-
- /*
- * The conversion routine that converts UTF-8 to the target encoding
- * must map one UTF-8 character to exactly one encoding-specific
- * character, so that the following algorithm works:
- *
- * 1. Get byte offset of where line should be broken.
- * 2. Get char offset corresponding to that byte offset.
- * 3. Map that char offset to byte offset in UTF-8 string.
- */
-
- getoffset:
- thisCharWasDoubleByte = 0;
- if (familyPtr->isMultiByteFont == 0) {
- charOffset = textOffset;
- } else {
- charOffset = 0;
- typeTable = familyPtr->typeTable;
-
- p = Tcl_DStringValue(&runString);
- end = p + textOffset;
- thisCharWasDoubleByte = typeTable[*((unsigned char *) p)];
- for ( ; p < end; p++) {
- thisCharWasDoubleByte = typeTable[*((unsigned char *) p)];
- p += thisCharWasDoubleByte;
- charOffset++;
- }
- }
-
- if ((flags & TK_WHOLE_WORDS) == 0) {
- if ((flags & TK_PARTIAL_OK) && (leadingEdge != 0)) {
- textOffset += thisCharWasDoubleByte;
- textOffset++;
- charOffset++;
- } else if (((flags & TK_PARTIAL_OK) == 0) && (leadingEdge == 0)) {
- textOffset -= thisCharWasDoubleByte;
- textOffset--;
- charOffset--;
- }
- }
- if ((textOffset == 0) && (Tcl_DStringLength(&runString) > 0)
- && (flags & TK_AT_LEAST_ONE)) {
- p = Tcl_DStringValue(&runString);
- textOffset += familyPtr->typeTable[*((unsigned char *) p)];
- textOffset++;
- charOffset++;
- }
- *widthLeftPtr = FixedToInt(pixelWidth)
- - TextWidth(Tcl_DStringValue(&runString), 0, textOffset);
- Tcl_DStringFree(&runString);
- return Tcl_UtfAtIndex(source, charOffset);
+ TkpDrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
+ 0, numBytes, x, y);
}
/*
*---------------------------------------------------------------------------
*
- * Tk_DrawChars --
+ * TkpDrawCharsInContext --
*
- * Draw a string of characters on the screen.
+ * Draw a string of characters on the screen like Tk_DrawChars(), with
+ * access to all the characters on the line for context.
*
* Results:
* None.
@@ -998,17 +1151,20 @@ BreakLine(
* Side effects:
* Information gets drawn on the screen.
*
+ * Todo:
+ * Stippled text drawing.
+ *
*---------------------------------------------------------------------------
*/
void
-Tk_DrawChars(
+TkpDrawCharsInContext(
Display *display, /* Display on which to draw. */
Drawable drawable, /* Window or pixmap in which to draw. */
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn; must
* be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char * source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
@@ -1016,151 +1172,214 @@ Tk_DrawChars(
* stripped out, they will be displayed as
* regular printing characters. */
int numBytes, /* Number of bytes in string. */
+ int rangeStart, /* Index of first byte to draw. */
+ int rangeLength, /* Length of range to draw in bytes. */
int x, int y) /* Coordinates at which to place origin of the
- * string when drawing. */
+ * whole (not just the range) string when
+ * drawing. */
{
+ const MacFont * fontPtr = (const MacFont *) tkfont;
MacDrawable *macWin = (MacDrawable *) drawable;
- MacFont *fontPtr = (MacFont *) tkfont;
+ Fixed fx, fy;
+ int ulen, urstart, urlen;
+ const UniChar * uchars;
+ int lineOffset;
TkMacOSXDrawingContext drawingContext;
+#if !TK_MAC_COALESCE_LINE
+ Tcl_DString runString;
+#endif
- if (!TkMacOSXSetupDrawingContext(drawable, gc, 0, &drawingContext)) {
+ if (!TkMacOSXSetupDrawingContext(drawable, gc, tkMacOSXUseCGDrawing,
+ &drawingContext)) {
return;
}
+
#if 0
/*
- * Stippled QD text drawing only kind of works and is ugly, so disable it
- * for now:
+ * TODO: implement stippled text drawing
*/
+
if ((gc->fill_style == FillStippled
|| gc->fill_style == FillOpaqueStippled)
&& gc->stipple != None) {
- TkMacOSXDrawingContext pixmapDrawingContext;
- BitMapPtr stippleMap;
- Pixmap pixmap;
- Pattern white;
- Rect bounds = drawingContext.portBounds;
-
- OffsetRect(&bounds, macWin->xOff + x, 0);
- stippleMap = TkMacOSXMakeStippleMap(drawable, gc->stipple);
- pixmap = Tk_GetPixmap(display, drawable,
- stippleMap->bounds.right, stippleMap->bounds.bottom, 0);
- if (!TkMacOSXSetupDrawingContext(pixmap, gc, 0,
- &pixmapDrawingContext)) {
- return;
- }
- GetQDGlobalsWhite(&white);
- FillRect(&stippleMap->bounds, &white);
- MultiFontDrawText(fontPtr, source, numBytes, 0, macWin->yOff + y);
- TkMacOSXRestoreDrawingContext(&pixmapDrawingContext);
- CopyDeepMask(GetPortBitMapForCopyBits(TkMacOSXGetDrawablePort(pixmap)),
- stippleMap, GetPortBitMapForCopyBits(
- TkMacOSXGetDrawablePort(drawable)), &stippleMap->bounds,
- &stippleMap->bounds, &bounds, srcOr, NULL);
-
- /* TODO: this doesn't work quite right - it does a blend. You can't
- * draw white text when you have a stipple.
- */
-
- Tk_FreePixmap(display, pixmap);
- ckfree(stippleMap->baseAddr);
- ckfree((char *)stippleMap);
- } else
+ #error Stippling not implemented
+ }
#endif
- {
- MultiFontDrawText(fontPtr, source, numBytes, macWin->xOff + x,
- macWin->yOff + y);
+
+ x += macWin->xOff;
+ y += macWin->yOff;
+ /* Turn the y coordinate upside-down for Quarz drawing. */
+ if (drawingContext.context) {
+ CGContextConcatCTM(drawingContext.context, CGAffineTransformMake(1.0,
+ 0.0, 0.0, -1.0, 0.0, drawingContext.portBounds.bottom -
+ drawingContext.portBounds.top));
+ y = drawingContext.portBounds.bottom -
+ drawingContext.portBounds.top - y;
}
+ fy = IntToFixed(y);
+
+#if TK_MAC_COALESCE_LINE
+ UpdateLineBuffer(
+ fontPtr, &drawingContext, source, numBytes, x, y, &lineOffset);
+
+ fx = IntToFixed(currentLeft);
+
+ uchars = (const Tcl_UniChar*) Tcl_DStringValue(&currentLine);
+ ulen = Tcl_DStringLength(&currentLine) / sizeof(uchars[0]);
+#else
+ lineOffset = 0;
+ fx = IntToFixed(x);
+
+ Tcl_DStringInit(&runString);
+ uchars = Tcl_UtfToUniCharDString(source, numBytes, &runString);
+ ulen = Tcl_DStringLength(&runString) / sizeof(uchars[0]);
+
+ LayoutSetString(fontPtr, &drawingContext, uchars, ulen);
+#endif
+
+ urstart = Tcl_NumUtfChars(source, rangeStart);
+ urlen = Tcl_NumUtfChars(source+rangeStart,rangeLength);
+
+ ChkErr(ATSUDrawText, fontPtr->atsuLayout, lineOffset+urstart, urlen, fx,
+ fy);
+
+#if !TK_MAC_COALESCE_LINE
+ Tcl_DStringFree(&runString);
+#endif
+
TkMacOSXRestoreDrawingContext(&drawingContext);
}
/*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
- * MultiFontDrawText --
+ * MeasureStringWidth --
*
- * Helper function for Tk_DrawChars. Draws characters, using the
- * various screen fonts in fontPtr to draw multilingual characters.
- * Note: No bidirectional support.
+ * Low-level measuring of strings.
*
* Results:
+ * The width of the string in pixels.
+ *
+ * Side effects:
* None.
*
+ * Assumptions:
+ * fontPtr->atsuLayout is setup with the actual string data to measure.
+ *
+ *---------------------------------------------------------------------------
+ */
+static int
+MeasureStringWidth(
+ const MacFont *fontPtr, /* Contains font, ATSU layout and string data
+ * to measure. */
+ int start, int end) /* Start and end positions to measure in that
+ * string. */
+{
+ /*
+ * This implementation of measuring via ATSUGetGlyphBounds() does not
+ * quite conform with the specification given for [font measure]:
+ *
+ * The return value is the total width in pixels of text, not
+ * including the extra pixels used by highly exagerrated characters
+ * such as cursive "f".
+ *
+ * Instead the result of ATSUGetGlyphBounds() *does* include these
+ * "extra pixels".
+ */
+
+ ATSTrapezoid bounds;
+ ItemCount numBounds;
+
+ if (end <= start) {
+ return 0;
+ }
+
+ bounds.upperRight.x = bounds.upperLeft.x = 0;
+ ChkErr(ATSUGetGlyphBounds, fontPtr->atsuLayout, 0, 0, start, end-start,
+ kATSUseFractionalOrigins, 1, &bounds, &numBounds);
+#ifdef TK_MAC_DEBUG_FONTS
+ if (numBounds < 1 || numBounds > 1) {
+ TkMacOSXDbgMsg("ATSUGetGlyphBounds: %s output",
+ numBounds < 1 ? "No " : "More");
+ }
+#endif
+
+ return FixedToInt(bounds.upperRight.x - bounds.upperLeft.x);
+}
+
+#if TK_MAC_COALESCE_LINE
+/*
+ *-------------------------------------------------------------------------
+ *
+ * UpdateLineBuffer --
+ *
+ * See the general dicussion of TK_MAC_COALESCE_LINE on the header
+ * pages. This function maintains the data for this feature.
+ *
+ * Results:
+ *
+ * The Tcl_UniChar string of the whole line as seen so far.
+ *
* Side effects:
- * Information gets drawn on the screen.
- * Contents of fontPtr may be modified if more subfonts were loaded
- * in order to draw all the multilingual characters in the given
- * string.
+ * "*offset" is filled with the index of the first new character in
+ * "currentLine". The globals currentLine, currentY, currentLeft,
+ * currentRight and currentFontPtr are updated as necessary.
+ *
+ * The currentLine string is set as the current text in
+ * fontPtr->atsuLayout (see LayoutSetString()).
*
*-------------------------------------------------------------------------
*/
-static void
-MultiFontDrawText(
- MacFont *fontPtr, /* Contains set of fonts to use when drawing
- * following string. */
- const char *source, /* Potentially multilingual UTF-8 string. */
- int numBytes, /* Length of string in bytes. */
- int x, int y) /* Coordinates at which to place origin *
- * of string when drawing. */
+static const Tcl_UniChar *
+UpdateLineBuffer(
+ const MacFont *fontPtr, /* The font to be used for the new piece of
+ * text. */
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ /* The Quarz drawing parameters. Needed for
+ * measuring the new piece. */
+ const char *source, /* A new piece of line to be added. */
+ int numBytes, /* Length of the new piece. */
+ int x, int y, /* Position of the new piece in the window. */
+ int *offset) /* Filled with the offset of the new piece in
+ * currentLine. */
{
- SubFont *thisSubFontPtr, *lastSubFontPtr;
- FontFamily *familyPtr;
- Tcl_DString runString;
- const char *p, *end, *next;
- Tcl_UniChar ch;
-
- TextSize(fontPtr->size);
- TextFace(fontPtr->style);
-
- lastSubFontPtr = &fontPtr->subFontArray[0];
-
- end = source + numBytes;
- for (p = source; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
- if (thisSubFontPtr != lastSubFontPtr) {
- if (p > source) {
- familyPtr = lastSubFontPtr->familyPtr;
- TextFont(familyPtr->faceNum);
- Tcl_UtfToExternalDString(familyPtr->encoding, source,
- p - source, &runString);
- MoveTo((short) x, (short) y);
- DrawText(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- x += TextWidth(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
- source = p;
- }
- lastSubFontPtr = thisSubFontPtr;
- }
- p = next;
- }
- if (p > source) {
- familyPtr = lastSubFontPtr->familyPtr;
- TextFont(familyPtr->faceNum);
- Tcl_UtfToExternalDString(familyPtr->encoding, source,
- p - source, &runString);
- MoveTo((short) x, (short) y);
- DrawText(Tcl_DStringValue(&runString), 0,
- Tcl_DStringLength(&runString));
- Tcl_DStringFree(&runString);
+ const Tcl_UniChar * uchars;
+ int ulen;
+
+ if (y != currentY
+ || x < currentRight-1 || x > currentRight+2
+ || currentFontPtr != fontPtr) {
+ Tcl_DStringFree(&currentLine);
+ Tcl_DStringInit(&currentLine);
+ currentY = y;
+ currentLeft = x;
+ currentFontPtr = fontPtr;
+ *offset = 0;
+ } else {
+ *offset = Tcl_DStringLength(&currentLine) / 2;
}
+
+ Tcl_UtfToUniCharDString(source, numBytes, &currentLine);
+ uchars = (const Tcl_UniChar*) Tcl_DStringValue(&currentLine);
+ ulen = Tcl_DStringLength(&currentLine) / sizeof(*uchars);
+ LayoutSetString(fontPtr, drawingContextPtr, uchars, ulen);
+ currentRight = x + MeasureStringWidth(fontPtr, *offset, ulen);
+
+ return uchars;
}
+#endif /* TK_MAC_COALESCE_LINE */
/*
*---------------------------------------------------------------------------
*
- * TkMacOSXIsCharacterMissing --
+ * FamilyNameForFamilyID --
*
- * Given a tkFont and a character determines whether the character has
- * a glyph defined in the font or not. Note that this is potentially
- * not compatible with Mac OS 8 as it looks at the font handle
- * structure directly. Looks into the character array of the font
- * handle to determine whether the glyph is defined or not.
+ * Helper for InitFont() and TkMacOSXFontDescriptionForFMFontInfo().
+ * Retrieves font family names for a given font family ID.
*
* Results:
- * Returns a 1 if the character is missing, a 0 if it is not.
+ * Font family name or NULL.
*
* Side effects:
* None.
@@ -1168,17 +1387,29 @@ MultiFontDrawText(
*---------------------------------------------------------------------------
*/
-int
-TkMacOSXIsCharacterMissing(
- Tk_Font tkfont, /* The font we are looking in. */
- unsigned int searchChar) /* The character we are looking for. */
+static const char *
+FamilyNameForFamilyID(
+ FMFontFamily familyId)
{
- /*
- * For some reason, FMSwapFont always returns a NULL font handle under OS X
- * Until we figure this one out, return 0;
- */
+ OSStatus err;
+ char name[256] = "";
+ const MacFontFamily * familyPtr = NULL;
- return 0;
+ err = ChkErr(GetFontFamilyName, familyId, name, sizeof(name));
+ if (err == noErr) {
+ /*
+ * We find the canonical font name, so we can avoid unnecessary
+ * memory management.
+ */
+
+ familyPtr = FindFontFamily(name);
+#ifdef TK_MAC_DEBUG_FONTS
+ if (!familyPtr) {
+ TkMacOSXDbgMsg("Font family '%s' not found", name);
+ }
+#endif
+ }
+ return familyPtr ? familyPtr->name : NULL;
}
/*
@@ -1187,12 +1418,12 @@ TkMacOSXIsCharacterMissing(
* InitFont --
*
* Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Initializes the memory for a MacFont that wraps the platform-specific
- * data.
+ * Initializes the memory for a MacFont that wraps the
+ * platform-specific data.
*
- * The caller is responsible for initializing the fields of the
- * TkFont that are used exclusively by the generic TkFont code, and
- * for releasing those fields before calling TkpDeleteFont().
+ * The caller is responsible for initializing the fields of the TkFont
+ * that are used exclusively by the generic TkFont code, and for
+ * releasing those fields before calling TkpDeleteFont().
*
* Results:
* Fills the MacFont structure.
@@ -1205,784 +1436,893 @@ TkMacOSXIsCharacterMissing(
static void
InitFont(
- Tk_Window tkwin, /* For display where font will be used. */
- int faceNum, /* Macintosh font number. */
- unsigned char *familyName, /* The font family name or NULL. */
- int size, /* Point size for Macintosh font. */
- int style, /* Macintosh style bits. */
- MacFont *fontPtr) /* Filled with information constructed from
- * the above arguments. */
+ FMFontFamily familyId, /* The font family to initialize for. */
+ const char * familyName, /* The font family name, if known. Otherwise
+ * this can be NULL. */
+ int size, /* Point size for the font. */
+ int qdStyle, /* QuickDraw style bits. */
+ MacFont * fontPtr) /* Filled with information constructed from the
+ * above arguments. */
{
- Str255 nativeName;
FontInfo fi;
- TkFontAttributes *faPtr;
- TkFontMetrics *fmPtr;
- CGrafPtr savePort;
- Boolean portChanged;
- short pixels;
+ TkFontAttributes * faPtr;
+ TkFontMetrics * fmPtr;
+ int periodWidth, wWidth;
if (size == 0) {
- size = -GetDefFontSize();
+ size = GetDefFontSize();
}
- pixels = (short) TkFontGetPixels(tkwin, size);
-
- portChanged = QDSwapPort(gWorld, &savePort);
- TextFont(faceNum);
- TextSize(pixels);
- TextFace(style);
-
- GetFontInfo(&fi);
+ ChkErr(FetchFontInfo, familyId, size, qdStyle, &fi);
if (!familyName) {
- GetFontName(faceNum, nativeName);
- familyName = nativeName;
+ familyName = FamilyNameForFamilyID(familyId);
}
- fontPtr->font.fid = (Font) fontPtr;
+
+ fontPtr->font.fid = (Font) fontPtr;
faPtr = &fontPtr->font.fa;
- faPtr->family = GetUtfFaceName(familyName);
- faPtr->size = TkFontGetPoints(tkwin, size);
- faPtr->weight = (style & bold) ? TK_FW_BOLD : TK_FW_NORMAL;
- faPtr->slant = (style & italic) ? TK_FS_ITALIC : TK_FS_ROMAN;
- faPtr->underline = ((style & underline) != 0);
+ faPtr->family = familyName;
+ faPtr->size = size;
+ faPtr->weight = (qdStyle & bold) ? TK_FW_BOLD : TK_FW_NORMAL;
+ faPtr->slant = (qdStyle & italic) ? TK_FS_ITALIC : TK_FS_ROMAN;
+ faPtr->underline = ((qdStyle & underline) != 0);
faPtr->overstrike = 0;
fmPtr = &fontPtr->font.fm;
- fmPtr->ascent = fi.ascent;
+
+ /*
+ * Note: Macs measure the line height as ascent + descent +
+ * leading. Leading as a separate entity does not exist in X11
+ * and Tk. We add it to the ascent at the moment, because adding
+ * it to the descent, as the Mac docs would indicate, would change
+ * the position of self-drawn underlines.
+ */
+
+ fmPtr->ascent = fi.ascent + fi.leading;
fmPtr->descent = fi.descent;
fmPtr->maxWidth = fi.widMax;
- fmPtr->fixed = (CharWidth('i') == CharWidth('w'));
- fontPtr->size = pixels;
- fontPtr->style = (short) style;
+ fontPtr->qdFont = familyId;
+ fontPtr->qdSize = size;
+ fontPtr->qdStyle = (short) qdStyle;
- fontPtr->numSubFonts = 1;
- fontPtr->subFontArray = fontPtr->staticSubFonts;
- InitSubFont(fontPtr, faceNum, &fontPtr->subFontArray[0]);
+ InitATSUObjects(familyId, size, qdStyle, &fontPtr->atsuFontId,
+ &fontPtr->atsuLayout, &fontPtr->atsuStyle);
- if (portChanged) {
- QDSwapPort(savePort, NULL);
- }
+ Tk_MeasureChars((Tk_Font)fontPtr, ".", 1, -1, 0, &periodWidth);
+ Tk_MeasureChars((Tk_Font)fontPtr, "W", 1, -1, 0, &wWidth);
+ fmPtr->fixed = periodWidth == wWidth;
+
+ SetFontFeatures(fontPtr->atsuFontId, fmPtr->fixed, size,
+ fontPtr->atsuStyle);
+
+ AdjustFontHeight(fontPtr);
}
/*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
- * ReleaseFont --
+ * InitATSUObjects --
*
- * Called to release the Macintosh-specific contents of a TkFont.
- * The caller is responsible for freeing the memory used by the
- * font itself.
+ * Helper for InitFont(). Initializes the ATSU data handles for a
+ * MacFont.
*
* Results:
- * None.
+ * Sets up all we know and can do at this point in time in fontIdPtr,
+ * layoutPtr and stylePtr.
*
* Side effects:
- * Memory is freed.
+ * Allocates data structures inside of ATSU.
*
*---------------------------------------------------------------------------
*/
static void
-ReleaseFont(
- MacFont *fontPtr) /* The font to delete. */
+InitATSUObjects(
+ FMFontFamily familyId, /* The font family to use. */
+ short ptSize, short qdStyles,
+ /* The additional font parameters. */
+ ATSUFontID *fontIdPtr, /* Filled with the font id. */
+ ATSUTextLayout *layoutPtr, /* Filled with the ATSU layout handle. */
+ ATSUStyle *stylePtr) /* Filled with the ATSU style handle,
+ * configured with all parameters. */
{
- int i;
+ FMFontStyle stylesDone, stylesLeft;
- for (i = 0; i < fontPtr->numSubFonts; i++) {
- ReleaseSubFont(&fontPtr->subFontArray[i]);
- }
- if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
- }
+ /*
+ * Defaults in case of error.
+ */
+
+ *fontIdPtr = GetAppFont();
+ *stylePtr = 0;
+ *layoutPtr = 0;
+
+ /*
+ * Generate a font id from family id and QD style bits.
+ */
+
+ ChkErr(FMGetFontFromFontFamilyInstance, familyId, qdStyles, fontIdPtr,
+ &stylesDone);
+
+ /*
+ * We see what style bits are left and tell ATSU to synthesize what's
+ * left like QD does it.
+ */
+
+ stylesLeft = qdStyles & ~(unsigned)stylesDone;
+
+ /*
+ * Create the style and set its attributes.
+ */
+
+ ChkErr(ATSUCreateStyle, stylePtr);
+ InitATSUStyle(*fontIdPtr, ptSize, stylesLeft, *stylePtr);
+
+ /*
+ * Create the layout. Note: We can't set the layout attributes here,
+ * because the text and the style must be set first.
+ */
+
+ ChkErr(ATSUCreateTextLayout, layoutPtr);
+ /*InitATSULayout(*layoutPtr);*/
}
/*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
- * InitSubFont --
+ * InitATSUStyle --
*
- * Wrap a screen font and load the FontFamily that represents
- * it. Used to prepare a SubFont so that characters can be mapped
- * from UTF-8 to the charset of the font.
+ * Helper for InitATSUObjects(). Initializes the ATSU style for a
+ * MacFont.
*
* Results:
- * The subFontPtr is filled with information about the font.
+ * Sets up all parameters needed for an ATSU style.
*
* Side effects:
- * None.
+ * Allocates data structures for the style inside of ATSU.
*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*/
static void
-InitSubFont(
- const MacFont *fontPtr, /* Font object in which the SubFont will be
- * used. */
- int faceNum, /* The font number. */
- SubFont *subFontPtr) /* Filled with SubFont constructed from
- * above attributes. */
+InitATSUStyle(
+ ATSUFontID fontId, /* The font id to use. */
+ short ptSize, short qdStyles,
+ /* Additional font parameters. */
+ ATSUStyle style) /* The style handle to configure. */
{
- subFontPtr->familyPtr = AllocFontFamily(fontPtr, faceNum);
- subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
+ /*
+ * Attributes for the style.
+ */
+
+ Fixed fsize = IntToFixed(ptSize);
+ Boolean
+ isBold = (qdStyles&bold) != 0,
+ isUnderline = (qdStyles&underline) != 0,
+ isItalic = (qdStyles&italic) != 0;
+
+ ATSStyleRenderingOptions options =
+ antialiasedTextEnabled == -1 ? kATSStyleNoOptions :
+ antialiasedTextEnabled == 0 ? kATSStyleNoAntiAliasing :
+ kATSStyleApplyAntiAliasing;
+
+ static const ATSUAttributeTag styleTags[] = {
+ kATSUFontTag, kATSUSizeTag,
+ kATSUQDBoldfaceTag, kATSUQDItalicTag, kATSUQDUnderlineTag,
+ kATSUStyleRenderingOptionsTag,
+ };
+ static const ByteCount styleSizes[] = {
+ sizeof(ATSUFontID), sizeof(Fixed),
+ sizeof(Boolean), sizeof(Boolean), sizeof(Boolean),
+ sizeof(ATSStyleRenderingOptions),
+ };
+ const ATSUAttributeValuePtr styleValues[] = {
+ &fontId, &fsize,
+ &isBold, &isItalic, &isUnderline,
+ &options,
+ };
+
+ ChkErr(ATSUSetAttributes, style, sizeof(styleTags)/sizeof(styleTags[0]),
+ styleTags, styleSizes, styleValues);
}
/*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
- * ReleaseSubFont --
+ * SetFontFeatures --
*
- * Called to release the contents of a SubFont. The caller is
- * responsible for freeing the memory used by the SubFont itself.
+ * Helper for InitFont(). Request specific font features of the ATSU
+ * style object for a MacFont.
*
* Results:
* None.
*
* Side effects:
- * Memory and resources are freed.
+ * Specific font features are enabled on the ATSU style object.
*
*---------------------------------------------------------------------------
*/
static void
-ReleaseSubFont(
- SubFont *subFontPtr) /* The SubFont to delete. */
+SetFontFeatures(
+ ATSUFontID fontId, /* The font id to use. */
+ int fixed, /* Is this a fixed font? */
+ short size, /* Size of the font */
+ ATSUStyle style) /* The style handle to configure. */
{
- FreeFontFamily(subFontPtr->familyPtr);
+ /*
+ * Don't use the standard latin ligatures, if this is determined to be a
+ * fixed-width font.
+ */
+
+ static const ATSUFontFeatureType fixed_featureTypes[] = {
+ kLigaturesType, kLigaturesType
+ };
+ static const ATSUFontFeatureSelector fixed_featureSelectors[] = {
+ kCommonLigaturesOffSelector, kRareLigaturesOffSelector
+ };
+
+ if (fixed) {
+ ChkErr(ATSUSetFontFeatures, style, sizeof(fixed_featureTypes) /
+ sizeof(fixed_featureTypes[0]), fixed_featureTypes,
+ fixed_featureSelectors);
+ if (size <= 10) {
+ /*
+ * Disable antialiasing of fixed-width fonts with sizes <= 10
+ */
+
+ const ATSStyleRenderingOptions options = kATSStyleNoAntiAliasing;
+ const ATSUAttributeTag styleTag = kATSUStyleRenderingOptionsTag;
+ const ByteCount styleSize = sizeof(ATSStyleRenderingOptions);
+ const ConstATSUAttributeValuePtr styleValue = &options;
+
+ ChkErr(ATSUSetAttributes, style, 1, &styleTag, &styleSize,
+ (ATSUAttributeValuePtr*) &styleValue);
+ }
+ }
}
/*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
- * AllocFontFamily --
+ * AdjustFontHeight --
*
- * Find the FontFamily structure associated with the given font
- * family. The information should be stored by the caller in a
- * SubFont and used when determining if that SubFont supports a
- * character.
+ * Helper for InitFont(). Check font height against some real world
+ * examples.
*
* Results:
- * A pointer to a FontFamily. The reference count in the FontFamily
- * is automatically incremented. When the SubFont is released, the
- * reference count is decremented. When no SubFont is using this
- * FontFamily, it may be deleted.
+ * None.
*
* Side effects:
- * A new FontFamily structure will be allocated if this font family
- * has not been seen.
+ * The metrics in fontPtr->font.fm are adjusted so that typical combined
+ * characters fit into ascent+descent.
*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*/
-static FontFamily *
-AllocFontFamily(
- const MacFont *fontPtr, /* Font object in which the FontFamily will
- * be used. */
- int faceNum) /* The font number. */
+static void
+AdjustFontHeight(
+ MacFont * fontPtr)
{
- FontFamily *familyPtr;
- int i;
-
- familyPtr = fontFamilyList;
- for (; familyPtr != NULL; familyPtr = familyPtr->nextPtr) {
- if (familyPtr->faceNum == faceNum) {
- familyPtr->refCount++;
- return familyPtr;
- }
- }
-
- familyPtr = (FontFamily *) ckalloc(sizeof(FontFamily));
- memset(familyPtr, 0, sizeof(FontFamily));
- familyPtr->nextPtr = fontFamilyList;
- fontFamilyList = familyPtr;
-
/*
- * Set key for this FontFamily.
+ * The standard values for ascent, descent and leading as determined in
+ * InitFont do not take composition into account, they are designed for
+ * plain ASCII characters. This code measures the actual size of some
+ * typical composed characters from the Latin-1 range and corrects these
+ * factors, especially the ascent.
+ *
+ * A font requested with a pixel size may thus have a larger line height
+ * than requested.
+ *
+ * An alternative would be to instruct ATSU to shrink oversized combined
+ * characters. I think I have seen that feature somewhere, but I can't
+ * find it now [BR].
*/
- familyPtr->faceNum = faceNum;
+ static const UniChar chars[]
+ /* Auml, Aacute, Acirc, Atilde, Ccedilla */
+ = {0x00C4, 0x00C1, 0x00C2, 0x00C3, 0x00C7};
+ static const int charslen = sizeof(chars) / sizeof(chars[0]);
+ Rect size;
+ OSStatus err;
- /*
- * An initial refCount of 2 means that FontFamily information will
- * persist even when the SubFont that loaded the FontFamily is released.
- * Change it to 1 to cause FontFamilies to be unloaded when not in use.
- */
+ LayoutSetString(fontPtr, NULL, chars, charslen);
- familyPtr->refCount = 2;
- familyPtr->encoding = GetFontEncoding(faceNum, 1, &familyPtr->isSymbolFont);
- familyPtr->isMultiByteFont = 0;
- FillParseTable(familyPtr->typeTable, FontToScript(faceNum));
- for (i = 0; i < 256; i++) {
- if (familyPtr->typeTable[i] != 0) {
- familyPtr->isMultiByteFont = 1;
- break;
+ size.top = size.bottom = 0;
+ err = ChkErr(ATSUMeasureTextImage, fontPtr->atsuLayout, 0, charslen, 0, 0,
+ &size);
+
+ if (err == noErr) {
+ TkFontMetrics * fmPtr = &fontPtr->font.fm;
+ int ascent = -size.top;
+ int descent = size.bottom;
+
+ if (ascent > fmPtr->ascent) {
+ fmPtr->ascent = ascent;
+ }
+ if (descent > fmPtr->descent) {
+ fmPtr->descent = descent;
}
}
- return familyPtr;
}
/*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
- * FreeFontFamily --
+ * InitATSULayout --
*
- * Called to free a FontFamily when the SubFont is finished using it.
- * Frees the contents of the FontFamily and the memory used by the
- * FontFamily itself.
+ * Helper for LayoutSetString(). Initializes the ATSU layout
+ * object for a MacFont and a specific string.
*
* Results:
- * None.
+ * Sets up all parameters needed for an ATSU layout object.
*
* Side effects:
- * None.
+ * Allocates data structures for the layout object inside of ATSU.
*
- *-------------------------------------------------------------------------
+ * Assumptions:
+ * The actual string data and style information is already set by
+ * ATSUSetTextPointerLocation() and ATSUSetRunStyle() (see
+ * LayoutSetString()).
+ *
+ *---------------------------------------------------------------------------
*/
static void
-FreeFontFamily(
- FontFamily *familyPtr) /* The FontFamily to delete. */
+InitATSULayout(
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ /* Specifies the CGContext to use. */
+ ATSUTextLayout layout, /* The layout object to configure. */
+ int fixed) /* Is this a fixed font? */
{
- FontFamily **familyPtrPtr;
- int i;
+ /*
+ * Attributes for the layout.
+ */
- if (familyPtr == NULL) {
- return;
- }
- familyPtr->refCount--;
- if (familyPtr->refCount > 0) {
- return;
- }
- Tcl_FreeEncoding(familyPtr->encoding);
- for (i = 0; i < FONTMAP_PAGES; i++) {
- if (familyPtr->fontMap[i] != NULL) {
- ckfree((char *) familyPtr->fontMap[i]);
- }
- }
+ ATSLineLayoutOptions layoutOptions = 0
+#if TK_MAC_COALESCE_LINE
+ /*
+ * Options to use unconditionally when we try to do coalescing.
+ */
+ | kATSLineDisableAllLayoutOperations
+ | kATSLineFractDisable
+ | kATSLineUseDeviceMetrics
+#endif
+ ;
+ CGContextRef context = drawingContextPtr ?
+ drawingContextPtr->context : NULL;
+
+ static const ATSUAttributeTag layoutTags[] = {
+ kATSUCGContextTag,
+ kATSULineLayoutOptionsTag,
+ };
+ static const ByteCount layoutSizes[] = {
+ sizeof(CGContextRef),
+ sizeof(ATSLineLayoutOptions),
+ };
+ const ATSUAttributeValuePtr layoutValues[] = {
+ &context,
+ &layoutOptions,
+ };
/*
- * Delete from list.
+ * Ensure W(abcdefg) == W(a)*7 for fixed fonts (Latin scripts only).
*/
- for (familyPtrPtr = &fontFamilyList; ; ) {
- if (*familyPtrPtr == familyPtr) {
- *familyPtrPtr = familyPtr->nextPtr;
- break;
- }
- familyPtrPtr = &(*familyPtrPtr)->nextPtr;
+ if (fixed) {
+ layoutOptions |= kATSLineFractDisable | kATSLineUseDeviceMetrics;
}
- ckfree((char *) familyPtr);
+ ChkErr(ATSUSetLayoutControls, layout, sizeof(layoutTags) /
+ sizeof(layoutTags[0]), layoutTags, layoutSizes, layoutValues);
+ ChkErr(ATSUSetTransientFontMatching, layout, true);
}
/*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
- * FindSubFontForChar --
+ * LayoutSetString --
*
- * Determine which physical screen font is necessary to use to
- * display the given character. If the font object does not have
- * a screen font that can display the character, another screen font
- * may be loaded into the font object, following a set of preferred
- * fallback rules.
+ * Setup the MacFont for a specific string.
*
* Results:
- * The return value is the SubFont to use to display the given
- * character.
+ * Sets up all parameters so that ATSU can work with the objects in
+ * MacFont.
*
* Side effects:
- * The contents of fontPtr are modified to cache the results
- * of the lookup and remember any SubFonts that were dynamically
- * loaded. The table of SubFonts might be extended, and if a non-NULL
- * reference to a subfont pointer is available, it is updated if it
- * previously pointed into the old subfont table.
+ * Sets parameters on the layout object fontPtr->atsuLayout.
*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*/
-static SubFont *
-FindSubFontForChar(
- MacFont *fontPtr, /* The font object with which the character
- * will be displayed. */
- int ch, /* The Unicode character to be displayed. */
- SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
- * reallocate our subfont table. */
+void
+LayoutSetString(
+ const MacFont *fontPtr, /* The fontPtr to configure. */
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ /* For the CGContext to be used.*/
+ const UniChar *uchars, int ulen)
+ /* The UniChar string to set into
+ * fontPtr->atsuLayout. */
{
- int i, j, k;
- const char *fallbackName;
- char **aliases;
- SubFont *subFontPtr;
- FontNameMap *mapPtr;
- Tcl_DString faceNames;
- char ***fontFallbacks;
- char **anyFallbacks;
-
- if (FontMapLookup(&fontPtr->subFontArray[0], ch)) {
- return &fontPtr->subFontArray[0];
- }
-
- for (i = 1; i < fontPtr->numSubFonts; i++) {
- if (FontMapLookup(&fontPtr->subFontArray[i], ch)) {
- return &fontPtr->subFontArray[i];
- }
- }
+ ChkErr(ATSUSetTextPointerLocation, fontPtr->atsuLayout, uchars,
+ kATSUFromTextBeginning, ulen, ulen);
/*
- * Keep track of all face names that we check, so we don't check some
- * name multiple times if it can be reached by multiple paths.
+ * Styles can only be set after the text is set.
*/
- Tcl_DStringInit(&faceNames);
+ ChkErr(ATSUSetRunStyle, fontPtr->atsuLayout, fontPtr->atsuStyle,
+ kATSUFromTextBeginning, kATSUToTextEnd);
- aliases = TkFontGetAliasList(fontPtr->font.fa.family);
+ /*
+ * Layout attributes can only be set after the styles are set.
+ */
- subFontPtr = NULL;
- fontFallbacks = TkFontGetFallbacks();
- for (i = 0; fontFallbacks[i] != NULL; i++) {
- for (j = 0; fontFallbacks[i][j] != NULL; j++) {
- fallbackName = fontFallbacks[i][j];
- if (strcasecmp(fallbackName, fontPtr->font.fa.family) == 0) {
- /*
- * If the base font has a fallback...
- */
+ InitATSULayout(drawingContextPtr, fontPtr->atsuLayout,
+ fontPtr->font.fm.fixed);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * ReleaseFont --
+ *
+ * Called to release the Macintosh-specific contents of a TkFont. The
+ * caller is responsible for freeing the memory used by the font
+ * itself.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Memory is freed.
+ *
+ *---------------------------------------------------------------------------
+ */
- goto tryfallbacks;
- } else if (aliases != NULL) {
- /*
- * Or if an alias for the base font has a fallback...
- */
+static void
+ReleaseFont(
+ MacFont *fontPtr) /* The font to delete. */
+{
+ ATSUDisposeTextLayout(fontPtr->atsuLayout);
+ ATSUDisposeStyle(fontPtr->atsuStyle);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FindFontFamilyOrAlias, FindFontFamilyOrAliasOrFallback --
+ *
+ * Determine if any physical screen font exists on the system with the
+ * given family name. If the family exists, then it should be possible
+ * to construct some physical screen font with that family name.
+ *
+ * FindFontFamilyOrAlias also considers font aliases as determined by
+ * TkFontGetAliasList().
+ *
+ * FindFontFamilyOrAliasOrFallback also considers font aliases as
+ * determined by TkFontGetFallbacks().
+ *
+ * The overall algorithm to get the closest font to the one requested is
+ * this:
+ *
+ * try fontname
+ * try all aliases for fontname
+ * foreach fallback for fontname
+ * try the fallback
+ * try all aliases for the fallback
+ *
+ * Results:
+ *
+ * The return value is NULL if the specified font family does not exist,
+ * a valid MacFontFamily* otherwise.
+ *
+ * Side effects:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
- for (k = 0; aliases[k] != NULL; k++) {
- if (strcasecmp(aliases[k], fallbackName) == 0) {
- goto tryfallbacks;
- }
- }
- }
- }
- continue;
+static const MacFontFamily *
+FindFontFamilyOrAlias(
+ const char *name) /* Name or alias name of the font to find. */
+{
+ const MacFontFamily * familyPtr;
+ char ** aliases;
+ int i;
- /*
- * ...then see if we can use one of the fallbacks, or an
- * alias for one of the fallbacks.
- */
+ familyPtr = FindFontFamily(name);
+ if (familyPtr != NULL) {
+ return familyPtr;
+ }
- tryfallbacks:
- for (j = 0; fontFallbacks[i][j] != NULL; j++) {
- fallbackName = fontFallbacks[i][j];
- subFontPtr = CanUseFallbackWithAliases(fontPtr, fallbackName,
- ch, &faceNames, fixSubFontPtrPtr);
- if (subFontPtr != NULL) {
- goto end;
+ aliases = TkFontGetAliasList(name);
+ if (aliases != NULL) {
+ for (i = 0; aliases[i] != NULL; i++) {
+ familyPtr = FindFontFamily(aliases[i]);
+ if (familyPtr != NULL) {
+ return familyPtr;
}
}
}
+ return NULL;
+}
+
+static const MacFontFamily *
+FindFontFamilyOrAliasOrFallback(
+ const char *name) /* Name or alias name of the font to find. */
+{
+ const MacFontFamily * familyPtr;
+ const char * fallback;
+ char *** fallbacks;
+ int i, j;
- /*
- * See if we can use something from the global fallback list.
- */
-
- anyFallbacks = TkFontGetGlobalClass();
- for (i = 0; anyFallbacks[i] != NULL; i++) {
- fallbackName = anyFallbacks[i];
- subFontPtr = CanUseFallbackWithAliases(fontPtr, fallbackName, ch,
- &faceNames, fixSubFontPtrPtr);
- if (subFontPtr != NULL) {
- goto end;
- }
+ familyPtr = FindFontFamilyOrAlias(name);
+ if (familyPtr != NULL) {
+ return familyPtr;
}
-
- /*
- * Try all face names available in the whole system until we
- * find one that can be used.
- */
-
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- fallbackName = mapPtr->utfName;
- if (SeenName(fallbackName, &faceNames) == 0) {
- subFontPtr = CanUseFallback(fontPtr, fallbackName, ch,
- fixSubFontPtrPtr);
- if (subFontPtr != NULL) {
- goto end;
+ fallbacks = TkFontGetFallbacks();
+ for (i = 0; fallbacks[i] != NULL; i++) {
+ for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
+ if (strcasecmp(name, fallback) == 0) {
+ for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
+ familyPtr = FindFontFamilyOrAlias(fallback);
+ if (familyPtr != NULL) {
+ return familyPtr;
+ }
+ }
}
+ break; /* benny: This "break" is a carry-over from
+ * tkMacOSXFont.c, but what is actually its purpose
+ * ???? */
}
}
- end:
- Tcl_DStringFree(&faceNames);
- if (subFontPtr == NULL) {
- /*
- * No font can display this character. We will use the base font
- * and have it display the "unknown" character.
- */
+ /*
+ * FIXME: We would have liked to recover by re-enumerating fonts. But
+ * that doesn't work, because Carbon seems to cache the inital list of
+ * fonts. Fonts newly installed don't show up with
+ * FMCreateFontFamilyIterator()/FMGetNextFontFamily() without a restart
+ * of the app. Similar problem with fonts removed.
+ */
- subFontPtr = &fontPtr->subFontArray[0];
- FontMapInsert(subFontPtr, ch);
- }
- return subFontPtr;
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("Font family '%s' not found", name);
+#endif
+
+ return NULL;
}
/*
*-------------------------------------------------------------------------
*
- * FontMapLookup --
+ * InitFontFamilies --
*
- * See if the screen font can display the given character.
+ * Helper to TkpFontPkgInit. Use the Font Manager to fill in the
+ * familyList global array.
*
* Results:
- * The return value is 0 if the screen font cannot display the
- * character, non-zero otherwise.
+ *
+ * None.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ *
+ * Allocates memory.
*
*-------------------------------------------------------------------------
*/
-static int
-FontMapLookup(
- SubFont *subFontPtr, /* Contains font mapping cache to be queried
- * and possibly updated. */
- int ch) /* Character to be tested. */
+static void
+InitFontFamilies(void)
{
- int row, bitOffset;
+ FMFontFamily fontFamily;
+ Str255 fontName;
+ SInt16 fontSize;
+ Style fontStyle;
- row = ch >> FONTMAP_SHIFT;
- if (subFontPtr->fontMap[row] == NULL) {
- FontMapLoadPage(subFontPtr, row);
+ /*
+ * Has this been called before?
+ */
+
+ if (familyListNextFree > 0) {
+ return;
+ }
+
+ ChkErr(ATSFontFamilyApplyFunction, FontFamilyEnumCallback,NULL);
+
+ if (GetThemeFontAndFamily(kThemeSystemFont, &fontFamily, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ AddFontFamily(SYSTEMFONT_NAME, fontFamily);
+ }
+ if (GetThemeFontAndFamily(kThemeApplicationFont, &fontFamily, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ AddFontFamily(APPLFONT_NAME, fontFamily);
+ }
+ if (GetThemeFontAndFamily(kThemeMenuItemFont, &fontFamily, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ AddFontFamily(MENUITEMFONT_NAME, fontFamily);
}
- bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
- return (subFontPtr->fontMap[row][bitOffset >> 3] >> (bitOffset & 7)) & 1;
+
+ SortFontFamilies();
}
/*
*-------------------------------------------------------------------------
*
- * FontMapInsert --
+ * FontFamilyEnumCallback --
*
- * Tell the font mapping cache that the given screen font should be
- * used to display the specified character. This is called when no
- * font on the system can be be found that can display that
- * character; we lie to the font and tell it that it can display
- * the character, otherwise we would end up re-searching the entire
- * fallback hierarchy every time that character was seen.
+ * Callback for ATSFontFamilyApplyFunction().
*
* Results:
- * None.
+ *
+ * noErr.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ *
+ * None.
*
*-------------------------------------------------------------------------
*/
-static void
-FontMapInsert(
- SubFont *subFontPtr, /* Contains font mapping cache to be
- * updated. */
- int ch) /* Character to be added to cache. */
+static OSStatus
+FontFamilyEnumCallback(
+ ATSFontFamilyRef family,
+ void *refCon)
{
- int row, bitOffset;
+ OSStatus err;
+ char name[260] = "";
- row = ch >> FONTMAP_SHIFT;
- if (subFontPtr->fontMap[row] == NULL) {
- FontMapLoadPage(subFontPtr, row);
+ (void) refCon;
+
+ err = ChkErr(GetFontFamilyName, family, name, sizeof(name));
+ if (err == noErr) {
+ AddFontFamily(name, family);
}
- bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
- subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
+
+ return noErr;
}
/*
*-------------------------------------------------------------------------
*
- * FontMapLoadPage --
+ * GetFontFamilyName --
*
- * Load information about all the characters on a given page.
- * This information consists of one bit per character that indicates
- * whether the associated HFONT can (1) or cannot (0) display the
- * characters on the page.
+ * Use the Font Manager to get the name of a given FMFontfamily. This
+ * currently gets the standard, non-localized QuickDraw name. Other
+ * names would be possible, see docs for ATSUFindFontName for a
+ * selection. The MacOSX font selector seems to use the localized
+ * family name given by ATSUFindFontName(kFontFamilyName), but that API
+ * doesn't give us a name at all for some fonts.
*
* Results:
- * None.
+ * An OS error code, noErr on success. name is filled with the
+ * resulting name.
*
* Side effects:
- * Mempry allocated.
+ * None.
*
*-------------------------------------------------------------------------
*/
-static void
-FontMapLoadPage(
- SubFont *subFontPtr, /* Contains font mapping cache to be
- * updated. */
- int row) /* Index of the page to be loaded into
- * the cache. */
+
+static OSStatus
+GetFontFamilyName(
+ FMFontFamily fontFamily, /* The font family for which to find the
+ * name. */
+ char * name, int numBytes) /* Filled with the result. */
{
- FMInput fm;
- FMOutPtr fmOut;
- int i, end, bitOffset, isMultiByteFont;
- char src[TCL_UTF_MAX];
- unsigned char buf[16];
- int srcRead, dstWrote;
- Tcl_Encoding encoding;
- Handle fHandle = NULL;
-
- subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
- memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
-
- encoding = subFontPtr->familyPtr->encoding;
-
- fm.family = subFontPtr->familyPtr->faceNum;
- fm.size = 12;
- fm.face = 0;
- fm.needBits = 0;
- fm.device = 0;
- fm.numer.h = 1;
- fm.numer.v = 1;
- fm.denom.h = 1;
- fm.denom.v = 1;
+ OSStatus err;
+ Str255 nativeName;
+ CFStringRef cfString;
+ TextEncoding encoding;
+ ScriptCode nameencoding;
+
+ nativeName[0] = 0;
+ name[0] = 0;
+ err = ChkErr(FMGetFontFamilyName, fontFamily, nativeName);
+ if (err != noErr) {
+ return err;
+ }
-/*
- * For some reason, FMSwapFont alywas returns a structure where the returned font handle
- * is NULL. Until we figure this one out, assume all characters are allowed
- */
+ /*
+ * QuickDraw font names are encoded with the script that the font uses.
+ * So we determine that encoding and than we reencode the name. We
+ * pre-set the encoding with the default value, so we do not need to
+ * check result codes here.
+ */
- fmOut = FMSwapFont(&fm);
- fHandle = fmOut->fontHandle;
- isMultiByteFont = subFontPtr->familyPtr->isMultiByteFont;
+ encoding = kTextEncodingMacRoman;
+ ChkErr(FMGetFontFamilyTextEncoding, fontFamily, &encoding);
+ nameencoding = encoding;
+ ChkErr(RevertTextEncodingToScriptInfo, encoding, &nameencoding, NULL,
+ NULL);
- /*
- * Found an outline font which has very complex font record.
- * Let's just assume *ALL* the characters are allowed.
- */
+ /*
+ * Note: We could use Tcl facilities to do the re-encoding here. We'd
+ * have to maintain tables to map OS encoding codes to Tcl encoding names
+ * like tkMacOSXFont.c did. Using native re-encoding directly instead is
+ * a lot easier and future-proof than that. There is one snag, though: I
+ * have seen CFStringGetCString() crash with invalid encoding ids. But
+ * than if that happens it would be a bug in
+ * FMGetFontFamilyTextEncoding() or RevertTextEncodingToScriptInfo().
+ * Another problem is that users have seen CFStringCreate return null
+ * (Bug #2548661). This is due to font names with a bad encoding.
+ */
- end = (row + 1) << FONTMAP_SHIFT;
- for (i = row << FONTMAP_SHIFT; i < end; i++) {
- if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i,
- src),
- TCL_ENCODING_STOPONERROR, NULL, (char *) buf,
- sizeof(buf),
- &srcRead, &dstWrote, NULL) == TCL_OK) {
- bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
- subFontPtr->fontMap[row][bitOffset >> 3] |= 1
- << (bitOffset & 7);
- }
- }
+ cfString = CFStringCreateWithPascalStringNoCopy(
+ NULL, nativeName, nameencoding, kCFAllocatorNull);
+ if (cfString == NULL) {
+ TkMacOSXDbgMsg("CFStringCreate: "
+ "'%.*s' could not be decoded with encoding %d",
+ nativeName[0], nativeName+1, (int) nameencoding);
+ return kTextMalformedInputErr;
+ }
+
+ CFStringGetCString(cfString, name, numBytes, kCFStringEncodingUTF8);
+ CFRelease(cfString);
+
+ return noErr;
}
/*
- *---------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*
- * CanUseFallbackWithAliases --
+ * FindFontFamily --
*
- * Helper function for FindSubFontForChar. Determine if the
- * specified face name (or an alias of the specified face name)
- * can be used to construct a screen font that can display the
- * given character.
+ * Find the font family with the given name in the global familyList.
+ * Uses bsearch() for convenient access. Comparision is done
+ * non-case-sensitively with CompareFontFamilies() which see.
*
* Results:
- * See CanUseFallback().
+ *
+ * MacFontFamily: A pair of family id and the actual name registered for
+ * the font.
*
* Side effects:
- * If the name and/or one of its aliases was rejected, the
- * rejected string is recorded in nameTriedPtr so that it won't
- * be tried again. The table of SubFonts might be extended, and if
- * a non-NULL reference to a subfont pointer is available, it is
- * updated if it previously pointed into the old subfont table.
*
- *---------------------------------------------------------------------------
+ * None.
+ *
+ * Assumption:
+ *
+ * Requires the familyList array to be sorted.
+ *
+ *-------------------------------------------------------------------------
*/
-static SubFont *
-CanUseFallbackWithAliases(
- MacFont *fontPtr, /* The font object that will own the new
- * screen font. */
- const char *faceName, /* Desired face name for new screen font. */
- int ch, /* The Unicode character that the new
- * screen font must be able to display. */
- Tcl_DString *nameTriedPtr, /* Records face names that have already
- * been tried. It is possible for the same
- * face name to be queried multiple times when
- * trying to find a suitable screen font. */
- SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
- * reallocate our subfont table. */
+static const MacFontFamily *
+FindFontFamily(
+ const char *name) /* The family name. Note: Names are compared
+ * non-case-sensitive. */
{
- SubFont *subFontPtr;
- char **aliases;
- int i;
+ const MacFontFamily key = {name,-1};
- if (SeenName(faceName, nameTriedPtr) == 0) {
- subFontPtr = CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr);
- if (subFontPtr != NULL) {
- return subFontPtr;
- }
- }
- aliases = TkFontGetAliasList(faceName);
- if (aliases != NULL) {
- for (i = 0; aliases[i] != NULL; i++) {
- if (SeenName(aliases[i], nameTriedPtr) == 0) {
- subFontPtr = CanUseFallback(fontPtr, aliases[i], ch,
- fixSubFontPtrPtr);
- if (subFontPtr != NULL) {
- return subFontPtr;
- }
- }
- }
+ if(familyListMaxValid <= 0) {
+ return NULL;
}
- return NULL;
+
+ return bsearch(&key, familyList, familyListMaxValid, sizeof(*familyList),
+ CompareFontFamilies);
}
/*
- *---------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*
- * SeenName --
+ * EnumFontFamilies --
*
- * Used to determine we have already tried and rejected the given
- * face name when looking for a screen font that can support some
- * Unicode character.
+ * Create a Tcl list with the registered names in the global familyList.
*
* Results:
- * The return value is 0 if this face name has not already been seen,
- * non-zero otherwise.
+ * A Tcl list of names.
*
* Side effects:
* None.
*
- *---------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
-static int
-SeenName(
- const char *name, /* The name to check. */
- Tcl_DString *dsPtr) /* Contains names that have already been
- * seen. */
+static Tcl_Obj *
+EnumFontFamilies(void)
{
- const char *seen, *end;
+ int i;
+ Tcl_Obj * tclList;
- seen = Tcl_DStringValue(dsPtr);
- end = seen + Tcl_DStringLength(dsPtr);
- while (seen < end) {
- if (strcasecmp(seen, name) == 0) {
- return 1;
- }
- seen += strlen(seen) + 1;
+ tclList = Tcl_NewListObj(0, NULL);
+ for (i=0; i<familyListMaxValid; ++i) {
+ Tcl_ListObjAppendElement(NULL, tclList,
+ Tcl_NewStringObj(familyList[i].name, -1));
}
- Tcl_DStringAppend(dsPtr, (char *) name, (int) (strlen(name) + 1));
- return 0;
+
+ return tclList;
}
/*
*-------------------------------------------------------------------------
*
- * CanUseFallback --
+ * AddFontFamily --
*
- * If the specified physical screen font has not already been loaded
- * into the font object, determine if the specified physical screen
- * font can display the given character.
+ * Register a font family in familyList. Until SortFontFamilies() is
+ * called, this is not actually available for FindFontFamily().
*
* Results:
- * The return value is a pointer to a newly allocated SubFont, owned
- * by the font object. This SubFont can be used to display the given
- * character. The SubFont represents the screen font with the base set
- * of font attributes from the font object, but using the specified
- * font name. NULL is returned if the font object already holds
- * a reference to the specified physical font or if the specified
- * physical font cannot display the given character.
+ *
+ * MacFontFamily: The new pair of family id and the actual name
+ * registered for the font.
*
* Side effects:
- * The font object's subFontArray is updated to contain a reference
- * to the newly allocated SubFont. The table of SubFonts might be
- * extended, and if a non-NULL reference to a subfont pointer is
- * available, it is updated if it previously pointed into the old
- * subfont table.
+ *
+ * New entry in familyList and familyListNextFree updated.
*
*-------------------------------------------------------------------------
*/
-static SubFont *
-CanUseFallback(
- MacFont *fontPtr, /* The font object that will own the new
- * screen font. */
- const char *faceName, /* Desired face name for new screen font. */
- int ch, /* The Unicode character that the new
- * screen font must be able to display. */
- SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
- * reallocate our subfont table. */
+static const MacFontFamily *
+AddFontFamily(
+ const char *name, /* Font family name to register. */
+ FMFontFamily familyId) /* Font family id to register. */
{
- int i;
- SubFont subFont;
- short faceNum;
-
- if (GetFamilyNum(faceName, &faceNum) == 0) {
- return NULL;
- }
-
- /*
- * Skip all fonts we've already used.
- */
+ MacFontFamily * familyPtr;
- for (i = 0; i < fontPtr->numSubFonts; i++) {
- if (faceNum == fontPtr->subFontArray[i].familyPtr->faceNum) {
- return NULL;
- }
+ if (familyListNextFree >= familyListSize) {
+ familyListSize += 100;
+ familyList = (MacFontFamily *) ckrealloc((void*) familyList,
+ familyListSize * sizeof(*familyList));
}
- /*
- * Load this font and see if it has the desired character.
- */
+ familyPtr = familyList + familyListNextFree;
+ ++familyListNextFree;
- InitSubFont(fontPtr, faceNum, &subFont);
- if (((ch < 256) && (subFont.familyPtr->isSymbolFont))
- || (FontMapLookup(&subFont, ch) == 0)) {
- ReleaseSubFont(&subFont);
- return NULL;
- }
+ familyPtr->name = AddString(name);
+ familyPtr->familyId = familyId;
- if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
- SubFont *newPtr = (SubFont *) ckalloc(sizeof(SubFont)
- * (fontPtr->numSubFonts + 1));
- memcpy((char *) newPtr, fontPtr->subFontArray,
- fontPtr->numSubFonts * sizeof(SubFont));
- if (fixSubFontPtrPtr != NULL) {
- /*
- * Fix up the variable pointed to by fixSubFontPtrPtr so it
- * still points into the live array. [Bug 618872]
- */
+ return familyPtr;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * SortFontFamilies --
+ *
+ * Sort the entries in familyList. Only after calling
+ * SortFontFamilies(), the new families registered with AddFontFamily()
+ * are actually available for FindFontFamily(), because FindFontFamily()
+ * requires the array to be sorted.
+ *
+ * Results:
+ *
+ * None.
+ *
+ * Side effects:
+ *
+ * familyList is sorted and familyListMaxValid is updated.
+ *
+ *-------------------------------------------------------------------------
+ */
- *fixSubFontPtrPtr =
- newPtr + (*fixSubFontPtrPtr - fontPtr->subFontArray);
- }
- if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
- }
- fontPtr->subFontArray = newPtr;
+static void
+SortFontFamilies(void)
+{
+ if (familyListNextFree > 0) {
+ qsort(familyList, familyListNextFree, sizeof(*familyList),
+ CompareFontFamilies);
}
- fontPtr->subFontArray[fontPtr->numSubFonts] = subFont;
- fontPtr->numSubFonts++;
- return &fontPtr->subFontArray[fontPtr->numSubFonts - 1];
+ familyListMaxValid = familyListNextFree;
}
/*
*-------------------------------------------------------------------------
*
- * GetFamilyNum --
+ * CompareFontFamilies --
*
- * Determines if any physical screen font exists on the system with
- * the given family name. If the family exists, then it should be
- * possible to construct some physical screen font with that family
- * name.
+ * Comparison function used by SortFontFamilies() and FindFontFamily().
*
* Results:
- * The return value is 0 if the specified font family does not exist,
- * non-zero otherwise. *faceNumPtr is filled with the unique face
- * number that identifies the screen font, or 0 if the font family
- * did not exist.
+ * Result as required to generate a stable sort order for bsearch() and
+ * qsort(). The ordering is not case-sensitive as far as
+ * Tcl_UtfNcasecmp() (which see) can provide that.
+ *
+ * Note: It would be faster to compare first the length and the actual
+ * strings only as a tie-breaker, but than the ordering wouldn't look so
+ * pretty in [font families] ;-).
*
* Side effects:
* None.
@@ -1991,148 +2331,101 @@ CanUseFallback(
*/
static int
-GetFamilyNum(
- const char *faceName, /* UTF-8 name of font family to query. */
- short *faceNumPtr) /* Filled with font number for above family. */
+CompareFontFamilies(
+ const void * vp1,
+ const void * vp2)
{
- FontNameMap *mapPtr;
+ const char * name1;
+ const char * name2;
+ int len1, len2, diff;
- if (faceName != NULL) {
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- if (strcasecmp(faceName, mapPtr->utfName) == 0) {
- *faceNumPtr = mapPtr->faceNum;
- return 1;
- }
- }
- }
- *faceNumPtr = 0;
- return 0;
-}
+ name1 = ((const MacFontFamily *) vp1)->name;
+ name2 = ((const MacFontFamily *) vp2)->name;
-static int
-GetFamilyOrAliasNum(
- const char *faceName, /* UTF-8 name of font family to query. */
- short *faceNumPtr) /* Filled with font number for above family. */
-{
- char **aliases;
- int i;
+ len1 = Tcl_NumUtfChars(name1, -1);
+ len2 = Tcl_NumUtfChars(name2, -1);
- if (GetFamilyNum(faceName, faceNumPtr) != 0) {
- return 1;
- }
- aliases = TkFontGetAliasList(faceName);
- if (aliases != NULL) {
- for (i = 0; aliases[i] != NULL; i++) {
- if (GetFamilyNum(aliases[i], faceNumPtr) != 0) {
- return 1;
- }
- }
- }
- return 0;
+ diff = Tcl_UtfNcasecmp(name1, name2, len1<len2 ? len1 : len2);
+
+ return diff == 0 ? len1-len2 : diff;
}
/*
*-------------------------------------------------------------------------
*
- * GetUtfFaceName --
+ * AddString --
*
- * Given the native name for a Macintosh font (in which the name of
- * the font is in the encoding of the font itself), return the UTF-8
- * name that corresponds to that font. The specified font name must
- * refer to a font that actually exists on the machine.
- *
- * This function is used to obtain the UTF-8 name when querying the
- * properties of a Macintosh font object.
+ * Helper for AddFontFamily(). Allocates a string in the one-shot
+ * allocator.
*
* Results:
- * The return value is a pointer to the UTF-8 of the specified font.
+ * A duplicated string in the one-shot allocator.
*
* Side effects:
- * None.
+ * May allocate a new memory block.
*
- *------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
-static Tk_Uid
-GetUtfFaceName(
- StringPtr nativeName) /* Pascal name for font in native encoding. */
+static const char *
+AddString(
+ const char *in) /* String to add, zero-terminated. */
{
- FontNameMap *mapPtr;
+ int len;
+ char *result;
- for (mapPtr = gFontNameMap; mapPtr->utfName != NULL; mapPtr++) {
- if (pstrcmp(nativeName, mapPtr->nativeName) == 0) {
- return mapPtr->utfName;
- }
+ len = strlen(in) +1;
+
+ if (stringMemory == NULL
+ || (stringMemory->nextFree+len) > STRING_BLOCK_MAX) {
+ StringBlock * newblock = (StringBlock *) ckalloc(sizeof(StringBlock));
+
+ newblock->next = stringMemory;
+ newblock->nextFree = 0;
+ stringMemory = newblock;
}
- Tcl_Panic("GetUtfFaceName: unexpected nativeName");
- return NULL;
+
+ result = stringMemory->strings + stringMemory->nextFree;
+ stringMemory->nextFree += len;
+
+ memcpy(result, in, len);
+
+ return result;
}
/*
- *------------------------------------------------------------------------
- *
- * GetFontEncoding --
+ *---------------------------------------------------------------------------
*
- * Return a string that can be passed to Tcl_GetTextEncoding() and
- * used to convert bytes from UTF-8 into the encoding of the
- * specified font.
+ * TkMacOSXIsCharacterMissing --
*
- * The desired encoding to use to convert the name of a symbolic
- * font into UTF-8 is macRoman, while the desired encoding to use
- * to convert bytes in a symbolic font to UTF-8 is the corresponding
- * symbolic encoding. Due to this dual interpretatation of symbolic
- * fonts, the caller can specify what type of encoding to return
- * should the specified font be symbolic.
+ * Given a tkFont and a character determine whether the character has
+ * a glyph defined in the font or not.
*
* Results:
- * The return value is a string that specifies the font's encoding.
- * If the font's encoding could not be identified, NULL is returned.
+ * Returns a 1 if the character is missing, a 0 if it is not.
*
* Side effects:
* None.
*
- *------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*/
-static Tcl_Encoding
-GetFontEncoding(
- int faceNum, /* Macintosh font number. */
- int allowSymbol, /* If non-zero, then the encoding string
- * for symbol fonts will be the corresponding
- * symbol encoding. Otherwise, the encoding
- * string for symbol fonts will be
- * "macRoman". */
- int *isSymbolPtr) /* Filled with non-zero if this font is a
- * symbol font, 0 otherwise. */
+int
+TkMacOSXIsCharacterMissing(
+ Tk_Font tkfont, /* The font we are looking in. */
+ unsigned int searchChar) /* The character we are looking for. */
{
- Str255 faceName;
- int script, lang;
- char *name;
-
- if (allowSymbol != 0) {
- GetFontName(faceNum, faceName);
- if (pstrcasecmp(faceName, "\psymbol") == 0) {
- *isSymbolPtr = 1;
- return Tcl_GetEncoding(NULL, "symbol");
- }
- if (pstrcasecmp(faceName, "\pzapf dingbats") == 0) {
- *isSymbolPtr = 1;
- return Tcl_GetEncoding(NULL, "macDingbats");
- }
- }
- *isSymbolPtr = 0;
- script = FontToScript(faceNum);
- lang = GetScriptVariable(script, smScriptLang);
- name = NULL;
- if (script == smRoman) {
- name = TkFindStateString(romanMap, lang);
- } else if (script == smCyrillic) {
- name = TkFindStateString(cyrillicMap, lang);
- }
- if (name == NULL) {
- name = TkFindStateString(scriptMap, script);
- }
- return Tcl_GetEncoding(NULL, name);
+ /* Background: This function is private and only used in
+ * tkMacOSXMenu.c:FindMarkCharacter().
+ *
+ * We could use ATSUMatchFont() to implement. We'd have to change the
+ * definition of the encoding of the parameter searchChar from MacRoman
+ * to UniChar for that.
+ *
+ * The system uses font fallback for controls, so we don't really need
+ * this. */
+
+ return 0;
}
/*
@@ -2154,17 +2447,16 @@ GetFontEncoding(
void
TkMacOSXInitControlFontStyle(
- Tk_Font tkfont,
- ControlFontStylePtr fsPtr)
+ Tk_Font tkfont, /* Tk font object to use for the control. */
+ ControlFontStylePtr fsPtr) /* The style object to configure. */
{
- MacFont *fontPtr = (MacFont *) tkfont;
- FontFamily *lastFamilyPtr = fontPtr->subFontArray[0].familyPtr;
+ const MacFont * fontPtr = (MacFont *) tkfont;
fsPtr->flags = kControlUseFontMask | kControlUseSizeMask |
kControlUseFaceMask | kControlUseJustMask;
- fsPtr->font = lastFamilyPtr->faceNum;
- fsPtr->size = fontPtr->size;
- fsPtr->style = fontPtr->style;
+ fsPtr->font = fontPtr->qdFont;
+ fsPtr->size = fontPtr->qdSize;
+ fsPtr->style = fontPtr->qdStyle;
fsPtr->just = teCenter;
}
@@ -2173,72 +2465,55 @@ TkMacOSXInitControlFontStyle(
*
* TkMacOSXUseAntialiasedText --
*
- * Enables or disables application-wide use of quickdraw
- * antialiased text (where available).
- * Sets up a linked tcl global boolean variable with write trace
- * to allow disabling of antialiased text from tcl.
+ * Enables or disables application-wide use of antialiased text (where
+ * available). Sets up a linked Tcl global variable to allow
+ * disabling of antialiased text from tcl.
+ * The possible values for this variable are:
+ *
+ * -1 - Use system default as configurable in "System Prefs" -> "General".
+ * 0 - Unconditionally disable antialiasing.
+ * 1 - Unconditionally enable antialiasing.
*
* Results:
- * TCL_OK if facility was sucessfully enabled/disabled.
- * TCL_ERROR if an error occurred or if facility is not available.
+ *
+ * TCL_OK.
*
* Side effects:
+ *
* None.
*
*----------------------------------------------------------------------
*/
-static int TkMacOSXAntialiasedTextEnabled = FALSE;
-
-static char *
-TkMacOSXAntialiasedTextVariableProc(
- ClientData clientData,
- Tcl_Interp *interp,
- const char *name1,
- const char *name2,
- int flags)
-{
- TkMacOSXUseAntialiasedText(interp, TkMacOSXAntialiasedTextEnabled);
- return (char *) NULL;
-}
-
-int
+MODULE_SCOPE int
TkMacOSXUseAntialiasedText(
- Tcl_Interp *interp,
- int enable)
+ Tcl_Interp * interp, /* The Tcl interpreter to receive the
+ * variable.*/
+ int enable) /* Initial value. */
{
static Boolean initialized = FALSE;
- static UInt32 (*swaptextflags)(UInt32) = NULL;
- if(!initialized) {
- swaptextflags = TkMacOSXGetNamedSymbol("QD", "_QDSwapTextFlags");
- if (!swaptextflags) {
- swaptextflags = TkMacOSXGetNamedSymbol("QD", "_SwapQDTextFlags");
- }
+ if (!initialized) {
initialized = TRUE;
- TkMacOSXAntialiasedTextEnabled = (swaptextflags ? enable : FALSE);
if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) {
Tcl_ResetResult(interp);
}
- if (Tcl_TraceVar(interp, "::tk::mac::antialiasedtext",
- TCL_GLOBAL_ONLY | TCL_TRACE_WRITES,
- TkMacOSXAntialiasedTextVariableProc, NULL) != TCL_OK) {
- Tcl_ResetResult(interp);
- }
if (Tcl_LinkVar(interp, "::tk::mac::antialiasedtext",
- (char *) &TkMacOSXAntialiasedTextEnabled,
- TCL_LINK_BOOLEAN) != TCL_OK) {
+ (char *) &antialiasedTextEnabled,
+ TCL_LINK_INT) != TCL_OK) {
Tcl_ResetResult(interp);
}
}
- if (swaptextflags) {
- swaptextflags(enable ? kQDUseCGTextRendering | kQDUseCGTextMetrics
- : kQDUseTrueTypeScalerGlyphs);
- TkMacOSXAntialiasedTextEnabled = enable;
- return TCL_OK;
- } else {
- TkMacOSXAntialiasedTextEnabled = FALSE;
- return TCL_ERROR;
- }
+ antialiasedTextEnabled = enable;
+ return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 985c85f..14ce7d9 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -1,61 +1,60 @@
/*
* tkMacOSXHLEvents.c --
*
- * Implements high level event support for the Macintosh. Currently,
- * the only event that really does anything is the Quit event.
+ * Implements high level event support for the Macintosh. Currently, the
+ * only event that really does anything is the Quit event.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
/*
- * This is a Tcl_Event structure that the Quit AppleEvent handler
- * uses to schedule the ReallyKillMe function.
+ * This is a Tcl_Event structure that the Quit AppleEvent handler uses to
+ * schedule the ReallyKillMe function.
*/
typedef struct KillEvent {
- Tcl_Event header; /* Information that is standard for
- * all events. */
- Tcl_Interp *interp; /* Interp that was passed to the
- * Quit AppleEvent */
+ Tcl_Event header; /* Information that is standard for all
+ * events. */
+ Tcl_Interp *interp; /* Interp that was passed to the Quit
+ * AppleEvent */
} KillEvent;
/*
* Static functions used only in this file.
*/
-static OSErr QuitHandler(const AppleEvent * event, AppleEvent * reply,
- long handlerRefcon);
-static OSErr OappHandler(const AppleEvent * event, AppleEvent * reply,
- long handlerRefcon);
-static OSErr RappHandler(const AppleEvent * event, AppleEvent * reply,
- long handlerRefcon);
-static OSErr OdocHandler(const AppleEvent * event, AppleEvent * reply,
- long handlerRefcon);
-static OSErr PrintHandler(const AppleEvent * event, AppleEvent * reply,
- long handlerRefcon);
-static OSErr ScriptHandler(const AppleEvent * event, AppleEvent * reply,
- long handlerRefcon);
-static OSErr PrefsHandler(const AppleEvent * event, AppleEvent * reply,
- long handlerRefcon);
-
-static int MissedAnyParameters(const AppleEvent *theEvent);
-static int ReallyKillMe(Tcl_Event *eventPtr, int flags);
-static OSStatus FSRefToDString(const FSRef *fsref, Tcl_DString *ds);
+static OSErr QuitHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr OappHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr RappHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr OdocHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr PrintHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr ScriptHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr PrefsHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static int MissedAnyParameters(const AppleEvent *theEvent);
+static int ReallyKillMe(Tcl_Event *eventPtr, int flags);
+static OSStatus FSRefToDString(const FSRef *fsref, Tcl_DString *ds);
/*
*----------------------------------------------------------------------
*
* TkMacOSXInitAppleEvents --
*
- * Initilize the Apple Events on the Macintosh. This registers the
- * core event handlers.
+ * Initilize the Apple Events on the Macintosh. This registers the core
+ * event handlers.
*
* Results:
* None.
@@ -68,10 +67,11 @@ static OSStatus FSRefToDString(const FSRef *fsref, Tcl_DString *ds);
void
TkMacOSXInitAppleEvents(
- Tcl_Interp *interp) /* Interp to handle basic events. */
+ Tcl_Interp *interp) /* Interp to handle basic events. */
{
- AEEventHandlerUPP OappHandlerUPP, RappHandlerUPP, OdocHandlerUPP,
- PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP, PrefsHandlerUPP;
+ AEEventHandlerUPP OappHandlerUPP, RappHandlerUPP, OdocHandlerUPP;
+ AEEventHandlerUPP PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP;
+ AEEventHandlerUPP PrefsHandlerUPP;
static Boolean initialized = FALSE;
if (!initialized) {
@@ -80,6 +80,7 @@ TkMacOSXInitAppleEvents(
/*
* Install event handlers for the core apple events.
*/
+
QuitHandlerUPP = NewAEEventHandlerUPP(QuitHandler);
ChkErr(AEInstallEventHandler, kCoreEventClass, kAEQuitApplication,
QuitHandlerUPP, (long) interp, false);
@@ -107,7 +108,7 @@ TkMacOSXInitAppleEvents(
if (interp) {
ScriptHandlerUPP = NewAEEventHandlerUPP(ScriptHandler);
ChkErr(AEInstallEventHandler, kAEMiscStandards, kAEDoScript,
- ScriptHandlerUPP, (long) interp, false);
+ ScriptHandlerUPP, (long) interp, false);
}
}
}
@@ -151,10 +152,10 @@ TkMacOSXDoHLEvent(
*----------------------------------------------------------------------
*/
-OSErr
+static OSErr
QuitHandler(
- const AppleEvent * event,
- AppleEvent * reply,
+ const AppleEvent *event,
+ AppleEvent *reply,
long handlerRefcon)
{
Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
@@ -162,10 +163,11 @@ QuitHandler(
if (interp) {
/*
- * Call the exit command from the event loop, since you are not supposed
- * to call ExitToShell in an Apple Event Handler. We put this at the head
- * of Tcl's event queue because this message usually comes when the Mac is
- * shutting down, and we want to kill the shell as quickly as possible.
+ * Call the exit command from the event loop, since you are not
+ * supposed to call ExitToShell in an Apple Event Handler. We put this
+ * at the head of Tcl's event queue because this message usually comes
+ * when the Mac is shutting down, and we want to kill the shell as
+ * quickly as possible.
*/
eventPtr = (KillEvent *) ckalloc(sizeof(KillEvent));
@@ -193,18 +195,20 @@ QuitHandler(
*----------------------------------------------------------------------
*/
-OSErr
+static OSErr
OappHandler(
- const AppleEvent * event,
- AppleEvent * reply,
+ const AppleEvent *event,
+ AppleEvent *reply,
long handlerRefcon)
{
Tcl_CmdInfo dummy;
Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
if (interp &&
- Tcl_GetCommandInfo(interp, "::tk::mac::OpenApplication", &dummy)) {
- Tcl_GlobalEval(interp, "::tk::mac::OpenApplication");
+ Tcl_GetCommandInfo(interp, "::tk::mac::OpenApplication", &dummy)){
+ if (Tcl_GlobalEval(interp, "::tk::mac::OpenApplication") != TCL_OK) {
+ Tcl_BackgroundError(interp);
+ }
}
return noErr;
}
@@ -225,10 +229,10 @@ OappHandler(
*----------------------------------------------------------------------
*/
-OSErr
+static OSErr
RappHandler(
- const AppleEvent * event,
- AppleEvent * reply,
+ const AppleEvent *event,
+ AppleEvent *reply,
long handlerRefcon)
{
Tcl_CmdInfo dummy;
@@ -236,9 +240,11 @@ RappHandler(
ProcessSerialNumber thePSN = {0, kCurrentProcess};
OSStatus err = ChkErr(SetFrontProcess, &thePSN);
- if (interp &&
- Tcl_GetCommandInfo(interp, "::tk::mac::ReopenApplication", &dummy)) {
- Tcl_GlobalEval(interp, "::tk::mac::ReopenApplication");
+ if (interp && Tcl_GetCommandInfo(interp,
+ "::tk::mac::ReopenApplication", &dummy)) {
+ if (Tcl_GlobalEval(interp, "::tk::mac::ReopenApplication") != TCL_OK){
+ Tcl_BackgroundError(interp);
+ }
}
return err;
}
@@ -248,8 +254,8 @@ RappHandler(
*
* PrefsHandler --
*
- * This is the 'pref' core Apple event handler.
- * Called when the user selects 'Preferences...' in MacOS X
+ * This is the 'pref' core Apple event handler. Called when the user
+ * selects 'Preferences...' in MacOS X
*
* Results:
* None.
@@ -260,18 +266,20 @@ RappHandler(
*----------------------------------------------------------------------
*/
-OSErr
+static OSErr
PrefsHandler(
- const AppleEvent * event,
- AppleEvent * reply,
+ const AppleEvent *event,
+ AppleEvent *reply,
long handlerRefcon)
{
Tcl_CmdInfo dummy;
Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
if (interp &&
- Tcl_GetCommandInfo(interp, "::tk::mac::ShowPreferences", &dummy)) {
- Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences");
+ Tcl_GetCommandInfo(interp, "::tk::mac::ShowPreferences", &dummy)){
+ if (Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences") != TCL_OK) {
+ Tcl_BackgroundError(interp);
+ }
}
return noErr;
}
@@ -292,75 +300,75 @@ PrefsHandler(
*----------------------------------------------------------------------
*/
-OSErr
+static OSErr
OdocHandler(
- const AppleEvent * event,
- AppleEvent * reply,
+ const AppleEvent *event,
+ AppleEvent *reply,
long handlerRefcon)
{
Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
AEDescList fileSpecList;
FSRef file;
- OSStatus err;
DescType type;
Size actual;
- long count;
+ long count, index;
AEKeyword keyword;
- long index;
- Tcl_DString command;
- Tcl_DString pathName;
+ Tcl_DString command, pathName;
Tcl_CmdInfo dummy;
/*
- * Don't bother if we don't have an interp or
- * the open document procedure doesn't exist.
+ * Don't bother if we don't have an interp or the open document procedure
+ * doesn't exist.
*/
- if ((interp == NULL) ||
- (Tcl_GetCommandInfo(interp, "::tk::mac::OpenDocument", &dummy)) == 0) {
- return noErr;
+ if (!interp ||
+ !Tcl_GetCommandInfo(interp, "::tk::mac::OpenDocument", &dummy)) {
+ return noErr;
}
/*
- * If we get any errors wil retrieving our parameters
- * we just return with no error.
+ * If we get any errors while retrieving our parameters we just return with
+ * no error.
*/
- err = ChkErr(AEGetParamDesc, event, keyDirectObject, typeAEList,
- &fileSpecList);
- if (err != noErr) {
+ if (ChkErr(AEGetParamDesc, event, keyDirectObject, typeAEList,
+ &fileSpecList) != noErr) {
return noErr;
}
-
- err = MissedAnyParameters(event);
- if (err != noErr) {
+ if (MissedAnyParameters(event) != noErr) {
return noErr;
}
-
- err = ChkErr(AECountItems, &fileSpecList, &count);
- if (err != noErr) {
+ if (ChkErr(AECountItems, &fileSpecList, &count) != noErr) {
return noErr;
}
+ /*
+ * Convert our parameters into a script to evaluate, skipping things that
+ * we can't handle right.
+ */
+
Tcl_DStringInit(&command);
Tcl_DStringAppend(&command, "::tk::mac::OpenDocument", -1);
for (index = 1; index <= count; index++) {
- err = ChkErr(AEGetNthPtr, &fileSpecList, index, typeFSRef,
- &keyword, &type, (Ptr) &file, sizeof(FSRef), &actual);
- if ( err != noErr ) {
+ if (ChkErr(AEGetNthPtr, &fileSpecList, index, typeFSRef, &keyword,
+ &type, (Ptr) &file, sizeof(FSRef), &actual) != noErr) {
continue;
}
- err = ChkErr(FSRefToDString, &file, &pathName);
- if (err == noErr) {
+ if (ChkErr(FSRefToDString, &file, &pathName) == noErr) {
Tcl_DStringAppendElement(&command, Tcl_DStringValue(&pathName));
Tcl_DStringFree(&pathName);
}
}
- Tcl_EvalEx(interp, Tcl_DStringValue(&command), Tcl_DStringLength(&command),
- TCL_EVAL_GLOBAL);
+ /*
+ * Now handle the event by evaluating a script.
+ */
+ if (Tcl_EvalEx(interp, Tcl_DStringValue(&command),
+ Tcl_DStringLength(&command), TCL_EVAL_GLOBAL) != TCL_OK) {
+ Tcl_BackgroundError(interp);
+ }
Tcl_DStringFree(&command);
return noErr;
}
@@ -381,7 +389,7 @@ OdocHandler(
*----------------------------------------------------------------------
*/
-OSErr
+static OSErr
PrintHandler(
const AppleEvent * event,
AppleEvent * reply,
@@ -390,66 +398,61 @@ PrintHandler(
Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
AEDescList fileSpecList;
FSRef file;
- OSStatus err;
DescType type;
Size actual;
- long count;
+ long count, index;
AEKeyword keyword;
- long index;
- Tcl_DString command;
- Tcl_DString pathName;
+ Tcl_DString command, pathName;
Tcl_CmdInfo dummy;
/*
- * Don't bother if we don't have an interp or
- * the print document procedure doesn't exist.
+ * Don't bother if we don't have an interp or the print document procedure
+ * doesn't exist.
*/
- if ((interp == NULL) ||
- (Tcl_GetCommandInfo(interp, "::tk::mac::PrintDocument", &dummy)) == 0) {
- return noErr;
+ if (!interp ||
+ !Tcl_GetCommandInfo(interp, "::tk::mac::PrintDocument", &dummy)) {
+ return noErr;
}
/*
- * If we get any errors wil retrieving our parameters
- * we just return with no error.
+ * If we get any errors while retrieving our parameters we just return with
+ * no error.
*/
- err = ChkErr(AEGetParamDesc, event, keyDirectObject, typeAEList,
- &fileSpecList);
- if (err != noErr) {
+ if (ChkErr(AEGetParamDesc, event, keyDirectObject, typeAEList,
+ &fileSpecList) != noErr) {
return noErr;
}
-
- err = ChkErr(MissedAnyParameters, event);
- if (err != noErr) {
+ if (ChkErr(MissedAnyParameters, event) != noErr) {
return noErr;
}
-
- err = ChkErr(AECountItems, &fileSpecList, &count);
- if (err != noErr) {
+ if (ChkErr(AECountItems, &fileSpecList, &count) != noErr) {
return noErr;
}
Tcl_DStringInit(&command);
Tcl_DStringAppend(&command, "::tk::mac::PrintDocument", -1);
for (index = 1; index <= count; index++) {
- err = ChkErr(AEGetNthPtr, &fileSpecList, index, typeFSRef, &keyword,
- &type, (Ptr) &file, sizeof(FSRef), &actual);
- if ( err != noErr ) {
+ if (ChkErr(AEGetNthPtr, &fileSpecList, index, typeFSRef, &keyword,
+ &type, (Ptr) &file, sizeof(FSRef), &actual) != noErr) {
continue;
}
- err = ChkErr(FSRefToDString, &file, &pathName);
- if (err == noErr) {
+ if (ChkErr(FSRefToDString, &file, &pathName) == noErr) {
Tcl_DStringAppendElement(&command, Tcl_DStringValue(&pathName));
Tcl_DStringFree(&pathName);
}
}
- Tcl_EvalEx(interp, Tcl_DStringValue(&command), Tcl_DStringLength(&command),
- TCL_EVAL_GLOBAL);
+ /*
+ * Now handle the event by evaluating a script.
+ */
+ if (Tcl_EvalEx(interp, Tcl_DStringValue(&command),
+ Tcl_DStringLength(&command), TCL_EVAL_GLOBAL) != TCL_OK) {
+ Tcl_BackgroundError(interp);
+ }
Tcl_DStringFree(&command);
return noErr;
}
@@ -470,23 +473,24 @@ PrintHandler(
*----------------------------------------------------------------------
*/
-OSErr
+static OSErr
ScriptHandler(
- const AppleEvent * event,
- AppleEvent * reply,
+ const AppleEvent *event,
+ AppleEvent *reply,
long handlerRefcon)
{
OSStatus theErr;
AEDescList theDesc;
+ Size size;
int tclErr = -1;
- Tcl_Interp *interp;
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
char errString[128];
- interp = (Tcl_Interp *) handlerRefcon;
-
/*
- * The do script event receives one parameter that should be data or a file.
+ * The do script event receives one parameter that should be data or a
+ * file.
*/
+
theErr = AEGetParamDesc(event, keyDirectObject, typeWildCard,
&theDesc);
if (theErr != noErr) {
@@ -495,73 +499,81 @@ ScriptHandler(
theErr = AEPutParamPtr(reply, keyErrorString, typeChar, errString,
strlen(errString));
} else if (MissedAnyParameters(event)) {
+ /*
+ * Return error if parameter is missing.
+ */
+
sprintf(errString, "AEDoScriptHandler: extra parameters");
AEPutParamPtr(reply, keyErrorString, typeChar, errString,
strlen(errString));
theErr = -1771;
- } else {
- Size size;
+ } else if (theDesc.descriptorType == (DescType) typeAlias &&
+ AEGetParamPtr(event, keyDirectObject, typeFSRef, NULL, NULL,
+ 0, &size) == noErr && size == sizeof(FSRef)) {
+ /*
+ * We've had a file sent to us. Source it.
+ */
- if (theDesc.descriptorType == (DescType)typeAlias &&
- AEGetParamPtr(event, keyDirectObject, typeFSRef, NULL, NULL,
- 0, &size) == noErr && size == sizeof(FSRef)) {
- FSRef file;
+ FSRef file;
+ theErr = AEGetParamPtr(event, keyDirectObject, typeFSRef, NULL, &file,
+ size, NULL);
+ if (theErr == noErr) {
+ Tcl_DString scriptName;
- theErr = AEGetParamPtr(event, keyDirectObject, typeFSRef, NULL,
- &file, size, NULL);
+ theErr = FSRefToDString(&file, &scriptName);
if (theErr == noErr) {
- Tcl_DString scriptName;
-
- theErr = FSRefToDString(&file, &scriptName);
- if (theErr == noErr) {
- tclErr = Tcl_EvalFile(interp,
- Tcl_DStringValue(&scriptName));
- Tcl_DStringFree(&scriptName);
- }
+ tclErr = Tcl_EvalFile(interp, Tcl_DStringValue(&scriptName));
+ Tcl_DStringFree(&scriptName);
} else {
sprintf(errString, "AEDoScriptHandler: file not found");
- AEPutParamPtr(reply, keyErrorString, typeChar,
- errString, strlen(errString));
+ AEPutParamPtr(reply, keyErrorString, typeChar, errString,
+ strlen(errString));
}
- } else if (AEGetParamPtr(event, keyDirectObject, typeUTF8Text, NULL,
- NULL, 0, &size) == noErr && size) {
- char *data = ckalloc(size + 1);
+ }
+ } else if (AEGetParamPtr(event, keyDirectObject, typeUTF8Text, NULL, NULL,
+ 0, &size) == noErr && size) {
+ /*
+ * We've had some data sent to us. Evaluate it.
+ */
- theErr = AEGetParamPtr(event, keyDirectObject, typeUTF8Text, NULL,
- data, size, NULL);
- if (theErr == noErr) {
- tclErr = Tcl_EvalEx(interp, data, size, TCL_EVAL_GLOBAL);
- }
- } else {
- sprintf(errString,
- "AEDoScriptHandler: invalid script type '%-4.4s', "
- "must be 'alis' or coercable to 'utf8'",
- (char *)(&theDesc.descriptorType));
- AEPutParamPtr(reply, keyErrorString, typeChar,
- errString, strlen(errString));
- theErr = -1770;
+ char *data = ckalloc(size + 1);
+ theErr = AEGetParamPtr(event, keyDirectObject, typeUTF8Text, NULL, data,
+ size, NULL);
+ if (theErr == noErr) {
+ tclErr = Tcl_EvalEx(interp, data, size, TCL_EVAL_GLOBAL);
}
+ } else {
+ /*
+ * Umm, don't recognize what we've got...
+ */
+
+ sprintf(errString, "AEDoScriptHandler: invalid script type '%-4.4s', "
+ "must be 'alis' or coercable to 'utf8'",
+ (char*) &theDesc.descriptorType);
+ AEPutParamPtr(reply, keyErrorString, typeChar, errString,
+ strlen(errString));
+ theErr = -1770;
}
/*
* If we actually go to run Tcl code - put the result in the reply.
*/
+
if (tclErr >= 0) {
- if (tclErr == TCL_OK) {
- AEPutParamPtr(reply, keyDirectObject, typeChar,
- Tcl_GetStringResult(interp),
- strlen(Tcl_GetStringResult(interp)));
+ int reslen;
+ const char *result =
+ Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &reslen);
+
+ if (tclErr == TCL_OK) {
+ AEPutParamPtr(reply, keyDirectObject, typeChar, result, reslen);
} else {
- AEPutParamPtr(reply, keyErrorString, typeChar,
- Tcl_GetStringResult(interp),
- strlen(Tcl_GetStringResult(interp)));
- AEPutParamPtr(reply, keyErrorNumber, typeSInt32,
- (Ptr) &tclErr, sizeof(int));
+ AEPutParamPtr(reply, keyErrorString, typeChar, result, reslen);
+ AEPutParamPtr(reply, keyErrorNumber, typeSInt32, (Ptr) &tclErr,
+ sizeof(int));
}
}
AEDisposeDesc(&theDesc);
-
return theErr;
}
@@ -570,8 +582,8 @@ ScriptHandler(
*
* ReallyKillMe --
*
- * This proc tries to kill the shell by running exit,
- * called from an event scheduled by the "Quit" AppleEvent handler.
+ * This proc tries to kill the shell by running exit, called from an
+ * event scheduled by the "Quit" AppleEvent handler.
*
* Results:
* Runs the "exit" command which might kill the shell.
@@ -589,10 +601,14 @@ ReallyKillMe(
{
Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp;
Tcl_CmdInfo dummy;
- if (Tcl_GetCommandInfo(interp, "::tk::mac::Quit", &dummy)) {
- Tcl_GlobalEval(interp, "::tk::mac::Quit");
- } else {
- Tcl_GlobalEval(interp, "exit");
+ int quit = Tcl_GetCommandInfo(interp, "::tk::mac::Quit", &dummy);
+
+ if (Tcl_GlobalEval(interp, quit ? "::tk::mac::Quit" : "exit") != TCL_OK) {
+ /*
+ * Should be never reached...
+ */
+
+ Tcl_BackgroundError(interp);
}
return 1;
}
@@ -613,7 +629,7 @@ ReallyKillMe(
*----------------------------------------------------------------------
*/
-int
+static int
MissedAnyParameters(
const AppleEvent *theEvent)
{
@@ -643,7 +659,7 @@ MissedAnyParameters(
*----------------------------------------------------------------------
*/
-OSStatus
+static OSStatus
FSRefToDString(
const FSRef *fsref,
Tcl_DString *ds)
@@ -657,3 +673,11 @@ FSRefToDString(
}
return err;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 38471ad..47c8c18 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -6,15 +6,15 @@
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2005-2008 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
-#include "tclInt.h" /* for Tcl{G,S}etStartupScriptFileName() */
+#include "tclInt.h" /* for Tcl_GetStartupScript() & Tcl_SetStartupScript() */
#include <sys/stat.h>
#include <sys/utsname.h>
@@ -22,25 +22,20 @@
#include <mach-o/getsect.h>
/*
- * The Init script (common to Windows and Unix platforms) is
- * defined in tkInitScript.h
+ * Define the following to 0 to not attempt to use an undocumented SPI to
+ * notify the window server that an unbundled executable is a full GUI
+ * application after loading Tk.
*/
-#include "tkInitScript.h"
-/*
- * Define the following to 0 to not attempt to use an undocumented SPI
- * to notify the window server that an unbundled executable is a full
- * GUI application after loading Tk.
- */
#ifndef MAC_OSX_TK_USE_CPS_SPI
#define MAC_OSX_TK_USE_CPS_SPI 1
#endif
/*
* The following structures are used to map the script/language codes of a
- * font to the name that should be passed to Tcl_GetEncoding() to obtain
- * the encoding for that font. The set of numeric constants is fixed and
- * defined by Apple.
+ * font to the name that should be passed to Tcl_GetEncoding() to obtain the
+ * encoding for that font. The set of numeric constants is fixed and defined
+ * by Apple.
*/
typedef struct Map {
@@ -87,13 +82,13 @@ static Map scriptMap[] = {
Tcl_Encoding TkMacOSXCarbonEncoding = NULL;
/*
- * If the App is in an App package, then we want to add the Scripts
- * directory to the auto_path.
+ * If the App is in an App package, then we want to add the Scripts directory
+ * to the auto_path.
*/
+
static char scriptPath[PATH_MAX + 1] = "";
float tkMacOSXToolboxVersionNumber = 0;
-
/*
*----------------------------------------------------------------------
@@ -104,8 +99,8 @@ float tkMacOSXToolboxVersionNumber = 0;
* tk_library variable.
*
* Results:
- * Returns a standard Tcl result. Leaves an error message or result
- * in the interp's result.
+ * Returns a standard Tcl result. Leaves an error message or result in
+ * the interp's result.
*
* Side effects:
* Sets "tk_library" Tcl variable, runs "tk.tcl" script.
@@ -123,9 +118,9 @@ TkpInit(
Tk_MacOSXSetupTkNotifier();
/*
- * Since it is possible for TkInit to be called multiple times
- * and we don't want to do the following initialization multiple times
- * we protect against doing it more than once.
+ * Since it is possible for TkInit to be called multiple times and we
+ * don't want to do the following initialization multiple times we protect
+ * against doing it more than once.
*/
if (!initialized) {
@@ -134,7 +129,7 @@ TkpInit(
CFURLRef bundleUrl = NULL;
CFStringEncoding encoding;
const char *encodingStr = NULL;
- int i;
+ int i;
struct utsname name;
long osVersion = 0;
@@ -149,7 +144,7 @@ TkpInit(
}
if (osVersion && osVersion < (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10) {
Tcl_Panic("Mac OS X 10.%d or later required !",
- (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10);
+ (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10);
}
TK_IF_MAC_OS_X_API (3, &kHIToolboxVersionNumber,
tkMacOSXToolboxVersionNumber = kHIToolboxVersionNumber;
@@ -178,7 +173,7 @@ TkpInit(
"com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 1, PATH_MAX,
tkLibPath) != TCL_OK)
#endif
- {
+ {
/* Tk.framework not found, check if resource file is open */
Handle rsrc = Get1NamedResource('CURS', "\phand");
if (rsrc) {
@@ -198,7 +193,7 @@ TkpInit(
image = _dyld_get_image_header(i);
if (image) {
data = getsectdatafromheader(image, SEG_TEXT,
- "__tk_rsrc", (void*)&size);
+ "__tk_rsrc", (void *) &size);
if (data) {
data += _dyld_get_image_vmaddr_slide(i);
break;
@@ -226,7 +221,7 @@ TkpInit(
if (write(fd, data, size) == -1) {
break;
}
- if(ChkErr(FSPathMakeRef, (unsigned char*)fileName, &ref,
+ if(ChkErr(FSPathMakeRef, (unsigned char *) fileName, &ref,
NULL) != noErr) {
break;
}
@@ -264,11 +259,14 @@ TkpInit(
* executable's url and compare the resulting url with the main
* bundle url.
*/
+
int j = 3;
CFURLRef url = CFBundleCopyExecutableURL(bundleRef);
+
while (url && j--) {
- CFURLRef parent = CFURLCreateCopyDeletingLastPathComponent(NULL,
- url);
+ CFURLRef parent =
+ CFURLCreateCopyDeletingLastPathComponent(NULL, url);
+
CFRelease(url);
url = parent;
}
@@ -279,8 +277,11 @@ TkpInit(
CFRelease(bundleUrl);
}
- /* If we are not a bundled executable, notify the window server that
- * we are a foregroundable app. */
+ /*
+ * If we are not a bundled executable, notify the window server that
+ * we are a foregroundable app.
+ */
+
if (!bundledExecutable) {
OSStatus err = procNotFound;
ProcessSerialNumber psn = { 0, kCurrentProcess };
@@ -297,6 +298,7 @@ TkpInit(
* server. Load the SPI symbol dynamically, so that we don't
* break if it ever disappears or changes its name.
*/
+
TkMacOSXInitNamedSymbol(CoreGraphics, OSStatus,
CPSEnableForegroundOperation, ProcessSerialNumberPtr);
if (CPSEnableForegroundOperation) {
@@ -309,7 +311,7 @@ TkpInit(
TkMacOSXInitAppleEvents(interp);
TkMacOSXInitCarbonEvents(interp);
TkMacOSXInitMenus(interp);
- TkMacOSXUseAntialiasedText(interp, TRUE);
+ TkMacOSXUseAntialiasedText(interp, -1);
TkMacOSXInitCGDrawing(interp, TRUE, 0);
TkMacOSXInitKeyboard(interp);
@@ -330,17 +332,15 @@ TkpInit(
TkMacOSXCarbonEncoding = Tcl_GetEncoding(NULL, NULL);
}
-#if 0
/*
- * FIXME: Close stdin & stdout for remote debugging otherwise we
- * will fight with gdb for stdin & stdout
+ * FIXME: Close stdin & stdout for remote debugging otherwise we will
+ * fight with gdb for stdin & stdout
*/
if (getenv("XCNOSTDIN") != NULL) {
close(0);
close(1);
}
-#endif
/*
* If we don't have a TTY and stdin is a special character file of
@@ -362,7 +362,7 @@ TkpInit(
* and tcl_interactive hasn't been set already.
*/
- if (TclGetStartupScriptFileName() == NULL) {
+ if (Tcl_GetStartupScript(NULL) == NULL) {
const char *intvar = Tcl_GetVar(interp,
"tcl_interactive", TCL_GLOBAL_ONLY);
@@ -387,7 +387,7 @@ TkpInit(
TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
}
- return Tcl_EvalEx(interp, initScript, -1, TCL_EVAL_GLOBAL);
+ return TCL_OK;
}
/*
@@ -395,9 +395,9 @@ TkpInit(
*
* TkpGetAppName --
*
- * Retrieves the name of the current application from a platform
- * specific location. For Unix, the application name is the tail
- * of the path contained in the tcl variable argv0.
+ * Retrieves the name of the current application from a platform specific
+ * location. For Unix, the application name is the tail of the path
+ * contained in the tcl variable argv0.
*
* Results:
* Returns the application name in the given Tcl_DString.
@@ -432,8 +432,8 @@ TkpGetAppName(
*
* TkpDisplayWarning --
*
- * This routines is called from Tk_Main to display warning
- * messages that occur during startup.
+ * This routines is called from Tk_Main to display warning messages that
+ * occur during startup.
*
* Results:
* None.
@@ -450,6 +450,7 @@ TkpDisplayWarning(
CONST char *title) /* Title of warning. */
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
+
if (errChannel) {
Tcl_WriteChars(errChannel, title, -1);
Tcl_WriteChars(errChannel, ": ", 2);
@@ -463,19 +464,17 @@ TkpDisplayWarning(
*
* TkMacOSXDefaultStartupScript --
*
- *
- * On MacOS X, we look for a file in the Resources/Scripts
- * directory called AppMain.tcl and if found, we set argv[1] to
- * that, so that the rest of the code will find it, and add the
- * Scripts folder to the auto_path. If we don't find the startup
- * script, we just bag it, assuming the user is starting up some
- * other way.
+ * On MacOS X, we look for a file in the Resources/Scripts directory
+ * called AppMain.tcl and if found, we set argv[1] to that, so that the
+ * rest of the code will find it, and add the Scripts folder to the
+ * auto_path. If we don't find the startup script, we just bag it,
+ * assuming the user is starting up some other way.
*
* Results:
* None.
*
* Side effects:
- * TclSetStartupScriptFileName() called when AppMain.tcl found.
+ * Tcl_SetStartupScript() called when AppMain.tcl found.
*
*----------------------------------------------------------------------
*/
@@ -488,24 +487,21 @@ TkMacOSXDefaultStartupScript(void)
bundleRef = CFBundleGetMainBundle();
if (bundleRef != NULL) {
- CFURLRef appMainURL;
- appMainURL = CFBundleCopyResourceURL(bundleRef,
- CFSTR("AppMain"),
- CFSTR("tcl"),
- CFSTR("Scripts"));
+ CFURLRef appMainURL = CFBundleCopyResourceURL(bundleRef,
+ CFSTR("AppMain"), CFSTR("tcl"), CFSTR("Scripts"));
if (appMainURL != NULL) {
CFURLRef scriptFldrURL;
char startupScript[PATH_MAX + 1];
if (CFURLGetFileSystemRepresentation (appMainURL, true,
- (unsigned char*) startupScript, PATH_MAX)) {
- TclSetStartupScriptFileName(startupScript);
- scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(
- NULL, appMainURL);
+ (unsigned char *) startupScript, PATH_MAX)) {
+ Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL);
+ scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL,
+ appMainURL);
if (scriptFldrURL != NULL) {
- CFURLGetFileSystemRepresentation(scriptFldrURL,
- true, (unsigned char*) scriptPath, PATH_MAX);
+ CFURLGetFileSystemRepresentation(scriptFldrURL, true,
+ (unsigned char *) scriptPath, PATH_MAX);
CFRelease(scriptFldrURL);
}
}
@@ -519,11 +515,9 @@ TkMacOSXDefaultStartupScript(void)
*
* TkMacOSXGetNamedSymbol --
*
- *
- * Dynamically acquire address of a named symbol from a loaded
- * dynamic library, so that we can use API that may not be
- * available on all OS versions.
- * If module is non-NULL and not the empty string, use twolevel
+ * Dynamically acquire address of a named symbol from a loaded dynamic
+ * library, so that we can use API that may not be available on all OS
+ * versions. If module is non-NULL and not the empty string, use twolevel
* namespace lookup.
*
* Results:
@@ -541,18 +535,68 @@ TkMacOSXGetNamedSymbol(
const char* symbol)
{
NSSymbol nsSymbol = NULL;
+
if (module && *module) {
- if(NSIsSymbolNameDefinedWithHint(symbol, module)) {
+ if (NSIsSymbolNameDefinedWithHint(symbol, module)) {
nsSymbol = NSLookupAndBindSymbolWithHint(symbol, module);
}
} else {
- if(NSIsSymbolNameDefined(symbol)) {
+ if (NSIsSymbolNameDefined(symbol)) {
nsSymbol = NSLookupAndBindSymbol(symbol);
}
}
- if (nsSymbol) {
- return NSAddressOfSymbol(nsSymbol);
- } else {
+
+ if (!nsSymbol) {
return NULL;
}
+ return NSAddressOfSymbol(nsSymbol);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetStringObjFromCFString --
+ *
+ * Get a string object from a CFString as efficiently as possible.
+ *
+ * Results:
+ * New string object or NULL if conversion failed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE Tcl_Obj*
+TkMacOSXGetStringObjFromCFString(
+ CFStringRef str)
+{
+ Tcl_Obj *obj = NULL;
+ const char *c = CFStringGetCStringPtr(str, kCFStringEncodingUTF8);
+
+ if (c) {
+ obj = Tcl_NewStringObj(c, -1);
+ } else {
+ CFRange all = CFRangeMake(0, CFStringGetLength(str));
+ CFIndex len;
+
+ if (CFStringGetBytes(str, all, kCFStringEncodingUTF8, 0, false, NULL,
+ 0, &len) > 0 && len < INT_MAX) {
+ obj = Tcl_NewObj();
+ Tcl_SetObjLength(obj, len);
+ CFStringGetBytes(str, all, kCFStringEncodingUTF8, 0, false,
+ (UInt8*) obj->bytes, len, NULL);
+ }
+ }
+ return obj;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index eeb0b2f..da9bfab 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -123,6 +123,17 @@ MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler;
#define TK_BOTH_CHANGED 3
/*
+ * Defines for tkTextDisp.c
+ */
+
+#define TK_LAYOUT_WITH_BASE_CHUNKS 1
+#define TK_DRAW_IN_CONTEXT 1
+
+#if !TK_DRAW_IN_CONTEXT
+MODULE_SCOPE int TkMacOSXCompareColors(unsigned long c1, unsigned long c2);
+#endif
+
+/*
* Globals shared among TkAqua.
*/
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 6fa14e5..e599fe3 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -494,6 +494,7 @@ InitKeyEvent(
return -1;
}
+ memset(eventPtr, 0, sizeof(XEvent));
eventPtr->xany.send_event = false;
eventPtr->xany.serial = Tk_Display(tkwin)->request;
@@ -1074,6 +1075,7 @@ XUngrabKeyboard(
* Side effects:
* None.
*
+ *----------------------------------------------------------------------
*/
Tk_Window
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index dbd4b6b..ca4fe34 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -191,7 +191,7 @@ TkpDisplayMenuButton(
bzero(&params, sizeof(params));
ComputeMenuButtonControlParams(butPtr, &params);
if (
-#if 0
+#ifdef TK_REBUILD_TOPLEVEL
(winPtr->flags & TK_REBUILD_TOPLEVEL) ||
#endif
bcmp(&params,&mbPtr->params,sizeof(params))) {
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index a099612..85213ab 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -58,6 +58,9 @@
# include <time.h>
# endif
#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index d054e1c..0059038 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -34,6 +34,7 @@
#define kThemeBackgroundMetal 6
#define kThemeIncDecButtonSmall 21
#define kThemeIncDecButtonMini 22
+ #define kThemeComboBox 16
#define kThemeMiniSystemFont 109
#define kAppearancePartUpButton 20
#define kAppearancePartDownButton 21
@@ -61,7 +62,7 @@
#else
#define kCGBitmapByteOrder32Host (2 << 12)
#endif
- #endif
+#endif
/* Define constants only available on Mac OS X 10.5 or later */
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
#define kWindowUnifiedTitleAndToolbarAttribute (1L << 7)
@@ -332,5 +333,6 @@ MODULE_SCOPE void TkMacOSXBringWindowForward(WindowRef wRef);
MODULE_SCOPE WindowRef TkMacOSXDrawableWindow(Drawable drawable);
MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
+MODULE_SCOPE Tcl_Obj* TkMacOSXGetStringObjFromCFString(CFStringRef str);
#endif /* _TKMACPRIV */
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 2b5f094..820bec3 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -649,7 +649,7 @@ ThumbActionProc(ControlRef theControl, ControlPartCode partCode)
* for the display to update.
*/
- sprintf(valueString, "%g", newFirstFraction);
+ Tcl_PrintDouble(NULL, newFirstFraction, valueString);
Tcl_DStringSetLength(&cmdString, 0);
Tcl_DStringAppend(&cmdString, scrollPtr->command,
scrollPtr->commandSize);
@@ -691,8 +691,8 @@ ScrollbarActionProc(
ControlRef theControl, /* Handle to scrollbat control */
ControlPartCode partCode) /* Part of scrollbar that was "hit" */
{
- TkScrollbar *scrollPtr = (TkScrollbar *)(intptr_t)GetControlReference(
- theControl);
+ TkScrollbar *scrollPtr = (TkScrollbar *)(intptr_t)
+ GetControlReference(theControl);
MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr;
Tcl_DString cmdString;
@@ -700,7 +700,7 @@ ScrollbarActionProc(
Tcl_DStringAppend(&cmdString, scrollPtr->command,
scrollPtr->commandSize);
- if ( partCode == kAppearancePartUpButton ||
+ if (partCode == kAppearancePartUpButton ||
partCode == kAppearancePartDownButton ) {
Tcl_DStringAppendElement(&cmdString, "scroll");
Tcl_DStringAppendElement(&cmdString,
@@ -715,16 +715,16 @@ ScrollbarActionProc(
} else if (partCode == kAppearancePartIndicator) {
char valueString[TCL_DOUBLE_SPACE];
- sprintf(valueString, "%g",
+ Tcl_PrintDouble(NULL,
(GetControl32BitValue(macScrollPtr->sbHandle) -
- MIN_SCROLLBAR_VALUE) / SCROLLBAR_SCALING_VALUE);
+ MIN_SCROLLBAR_VALUE) / SCROLLBAR_SCALING_VALUE, valueString);
Tcl_DStringAppendElement(&cmdString, "moveto");
Tcl_DStringAppendElement(&cmdString, valueString);
}
- Tcl_Preserve((ClientData) scrollPtr->interp);
+ Tcl_Preserve(scrollPtr->interp);
Tcl_EvalEx(scrollPtr->interp, Tcl_DStringValue(&cmdString),
Tcl_DStringLength(&cmdString), TCL_EVAL_GLOBAL);
- Tcl_Release((ClientData) scrollPtr->interp);
+ Tcl_Release(scrollPtr->interp);
Tcl_DStringFree(&cmdString);
TkMacOSXRunTclEventLoop();
}
@@ -754,11 +754,11 @@ ScrollbarBindProc(
Tk_Window tkwin, /* Target window for event. */
KeySym keySym) /* The KeySym if a key event. */
{
- TkWindow *winPtr = (TkWindow*)tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkScrollbar *scrollPtr = (TkScrollbar *) winPtr->instanceData;
MacScrollbar *macScrollPtr = (MacScrollbar *) winPtr->instanceData;
- Tcl_Preserve((ClientData)scrollPtr);
+ Tcl_Preserve(scrollPtr);
macScrollPtr->macFlags |= IN_MODAL_LOOP;
if (eventPtr->type == ButtonPress) {
@@ -770,10 +770,11 @@ ScrollbarBindProc(
Window window;
/*
- * To call Macintosh control routines we must have the port
- * set to the window containing the control. We will then test
- * which part of the control was hit and act accordingly.
+ * To call Macintosh control routines we must have the port set to the
+ * window containing the control. We will then test which part of the
+ * control was hit and act accordingly.
*/
+
destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scrollPtr->tkwin));
portChanged = QDSwapPort(destPort, &savePort);
TkMacOSXSetUpClippingRgn(Tk_WindowId(scrollPtr->tkwin));
@@ -785,9 +786,10 @@ ScrollbarBindProc(
TkMacOSXTrackingLoop(1);
if (part == kAppearancePartIndicator && scrollPtr->jump == false) {
/*
- * Case 1: In thumb, no jump scrolling. Call track control
- * with the thumb action proc which will do most of the work.
+ * Case 1: In thumb, no jump scrolling. Call track control with
+ * the thumb action proc which will do most of the work.
*/
+
mouseDownPoint.h = where.h;
mouseDownPoint.v = where.v;
part = HandleControlClick(macScrollPtr->sbHandle, where,
@@ -795,18 +797,20 @@ ScrollbarBindProc(
} else if (part == kAppearancePartIndicator) {
/*
* Case 2: in thumb with jump scrolling. Call HandleControlClick
- * with a NULL action proc. Use the new value of the control
- * to set update the control.
+ * with a NULL action proc. Use the new value of the control to
+ * set update the control.
*/
+
part = HandleControlClick(macScrollPtr->sbHandle, where,
TkMacOSXModifierState(), NULL);
if (part == kAppearancePartIndicator) {
Tcl_DString cmdString;
char valueString[TCL_DOUBLE_SPACE];
- sprintf(valueString, "%g",
+ Tcl_PrintDouble(NULL,
(GetControl32BitValue(macScrollPtr->sbHandle) -
- MIN_SCROLLBAR_VALUE) / SCROLLBAR_SCALING_VALUE);
+ MIN_SCROLLBAR_VALUE) / SCROLLBAR_SCALING_VALUE,
+ valueString);
Tcl_DStringInit(&cmdString);
Tcl_DStringAppend(&cmdString, scrollPtr->command,
strlen(scrollPtr->command));
@@ -814,10 +818,10 @@ ScrollbarBindProc(
Tcl_DStringAppendElement(&cmdString, valueString);
interp = scrollPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
Tcl_EvalEx(interp, Tcl_DStringValue(&cmdString),
Tcl_DStringLength(&cmdString), TCL_EVAL_GLOBAL);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
Tcl_DStringFree(&cmdString);
TkMacOSXRunTclEventLoop();
}
@@ -827,12 +831,15 @@ ScrollbarBindProc(
* HandleControlClick with the scrollActionProc which will do
* most all the work.
*/
+
HandleControlClick(macScrollPtr->sbHandle, where,
TkMacOSXModifierState(), scrollActionProc);
+
/*
* Workaround for Carbon bug where the scrollbar down arrow
* sometimes gets "stuck" after the mousebutton has been released.
*/
+
if (scrollPtr->tkwin) {
TkMacOSXSetUpClippingRgn(Tk_WindowId(scrollPtr->tkwin));
}
@@ -860,7 +867,7 @@ ScrollbarBindProc(
macScrollPtr->sbHandle = NULL;
}
macScrollPtr->macFlags &= ~IN_MODAL_LOOP;
- Tcl_Release((ClientData)scrollPtr);
+ Tcl_Release(scrollPtr);
return TCL_OK;
}
diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c
index 39c4cf0..a8077cb 100644
--- a/macosx/tkMacOSXSend.c
+++ b/macosx/tkMacOSXSend.c
@@ -1,173 +1,169 @@
/*
* tkMacOSXSend.c --
*
- * This file provides procedures that implement the "send"
- * command, allowing commands to be passed from interpreter
- * to interpreter. This current implementation for the Mac
- * has most functionality stubed out.
- *
- * The current plan, which we have not had time to implement, is
- * for the first Wish app to create a gestalt of type 'WIsH'.
- * This gestalt will point to a table, in system memory, of
- * Tk apps. Each Tk app, when it starts up, will register their
- * name, and process ID, in this table. This will allow us to
- * implement "tk appname".
- *
- * Then the send command will look up the process id of the target
- * app in this table, and send an AppleEvent to that process. The
- * AppleEvent handler is much like the do script handler, except that
- * you have to specify the name of the tk app as well, since there may
- * be many interps in one wish app, and you need to send it to the
- * right one.
- *
- * Implementing this has been on our list of things to do, but what
- * with the demise of Tcl at Sun, and the lack of resources at
- * Scriptics it may not get done for awhile. So this sketch is
- * offered for the brave to attempt if they need the functionality...
+ * This file provides procedures that implement the "send" command,
+ * allowing commands to be passed from interpreter to interpreter. This
+ * current implementation for the Mac has most functionality stubed out.
+ *
+ * The current plan, which we have not had time to implement, is for the
+ * first Wish app to create a gestalt of type 'WIsH'. This gestalt will
+ * point to a table, in system memory, of Tk apps. Each Tk app, when it
+ * starts up, will register their name, and process ID, in this table.
+ * This will allow us to implement "tk appname".
+ *
+ * Then the send command will look up the process id of the target app in
+ * this table, and send an AppleEvent to that process. The AppleEvent
+ * handler is much like the do script handler, except that you have to
+ * specify the name of the tk app as well, since there may be many
+ * interps in one wish app, and you need to send it to the right one.
+ *
+ * Implementing this has been on our list of things to do, but what with
+ * the demise of Tcl at Sun, and the lack of resources at Scriptics it
+ * may not get done for awhile. So this sketch is offered for the brave
+ * to attempt if they need the functionality...
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXInt.h"
/*
- * The following structure is used to keep track of the
- * interpreters registered by this process.
+ * The following structure is used to keep track of the interpreters
+ * registered by this process.
*/
typedef struct RegisteredInterp {
char *name; /* Interpreter's name (malloc-ed). */
- Tcl_Interp *interp; /* Interpreter associated with
- * name. */
+ Tcl_Interp *interp; /* Interpreter associated with name. */
struct RegisteredInterp *nextPtr;
- /* Next in list of names associated
- * with interps in this process.
- * NULL means end of list. */
+ /* Next in list of names associated with
+ * interps in this process. NULL means end of
+ * list. */
} RegisteredInterp;
/*
- * A registry of all interpreters for a display is kept in a
- * property "InterpRegistry" on the root window of the display.
- * It is organized as a series of zero or more concatenated strings
- * (in no particular order), each of the form
+ * A registry of all interpreters for a display is kept in a property
+ * "InterpRegistry" on the root window of the display. It is organized as a
+ * series of zero or more concatenated strings (in no particular order), each
+ * of the form
* window space name '\0'
- * where "window" is the hex id of the comm. window to use to talk
- * to an interpreter named "name".
+ * where "window" is the hex id of the comm. window to use to talk to an
+ * interpreter named "name".
*
- * When the registry is being manipulated by an application (e.g. to
- * add or remove an entry), it is loaded into memory using a structure
- * of the following type:
+ * When the registry is being manipulated by an application (e.g. to add or
+ * remove an entry), it is loaded into memory using a structure of the
+ * following type:
*/
typedef struct NameRegistry {
TkDisplay *dispPtr; /* Display from which the registry was
* read. */
- int locked; /* Non-zero means that the display was
- * locked when the property was read in. */
- int modified; /* Non-zero means that the property has
- * been modified, so it needs to be written
- * out when the NameRegistry is closed. */
+ int locked; /* Non-zero means that the display was locked
+ * when the property was read in. */
+ int modified; /* Non-zero means that the property has been
+ * modified, so it needs to be written out
+ * when the NameRegistry is closed. */
unsigned long propLength; /* Length of the property, in bytes. */
- char *property; /* The contents of the property, or NULL
- * if none. See format description above;
- * this is *not* terminated by the first
- * null character. Dynamically allocated. */
+ char *property; /* The contents of the property, or NULL if
+ * none. See format description above; this is
+ * *not* terminated by the first null
+ * character. Dynamically allocated. */
int allocedByX; /* Non-zero means must free property with
* XFree; zero means use ckfree. */
} NameRegistry;
-static int initialized = false; /* A flag to denote if we have initialized yet. */
+static int initialized = false; /* A flag to denote if we have initialized
+ * yet. */
static RegisteredInterp *interpListPtr = NULL;
-/* List of all interpreters
- * registered by this process. */
-
- /*
- * The information below is used for communication between processes
- * during "send" commands. Each process keeps a private window, never
- * even mapped, with one property, "Comm". When a command is sent to
- * an interpreter, the command is appended to the comm property of the
- * communication window associated with the interp's process. Similarly,
- * when a result is returned from a sent command, it is also appended
- * to the comm property.
- *
- * Each command and each result takes the form of ASCII text. For a
- * command, the text consists of a zero character followed by several
- * null-terminated ASCII strings. The first string consists of the
- * single letter "c". Subsequent strings have the form "option value"
- * where the following options are supported:
- *
- * -r commWindow serial
- *
- * This option means that a response should be sent to the window
- * whose X identifier is "commWindow" (in hex), and the response should
- * be identified with the serial number given by "serial" (in decimal).
- * If this option isn't specified then the send is asynchronous and
- * no response is sent.
- *
- * -n name
- * "Name" gives the name of the application for which the command is
- * intended. This option must be present.
- *
- * -s script
- *
- * "Script" is the script to be executed. This option must be present.
- *
- * The options may appear in any order. The -n and -s options must be
- * present, but -r may be omitted for asynchronous RPCs. For compatibility
- * with future releases that may add new features, there may be additional
- * options present; as long as they start with a "-" character, they will
- * be ignored.
- *
- * A result also consists of a zero character followed by several null-
- * terminated ASCII strings. The first string consists of the single
- * letter "r". Subsequent strings have the form "option value" where
- * the following options are supported:
- *
- * -s serial
- *
- * Identifies the command for which this is the result. It is the
- * same as the "serial" field from the -s option in the command. This
- * option must be present.
- *
- * -c code
- *
- * "Code" is the completion code for the script, in decimal. If the
- * code is omitted it defaults to TCL_OK.
- *
- * -r result
- *
- * "Result" is the result string for the script, which may be either
- * a result or an error message. If this field is omitted then it
- * defaults to an empty string.
- *
- * -i errorInfo
- *
- * "ErrorInfo" gives a string with which to initialize the errorInfo
- * variable. This option may be omitted; it is ignored unless the
- * completion code is TCL_ERROR.
- *
- * -e errorCode
- *
- * "ErrorCode" gives a string with with to initialize the errorCode
- * variable. This option may be omitted; it is ignored unless the
- * completion code is TCL_ERROR.
- *
- * Options may appear in any order, and only the -s option must be
- * present. As with commands, there may be additional options besides
- * these; unknown options are ignored.
- */
-
- /*
- * Maximum size property that can be read at one time by
- * this module:
- */
+ /* List of all interpreters registered by this
+ * process. */
+
+/*
+ * The information below is used for communication between processes during
+ * "send" commands. Each process keeps a private window, never even mapped,
+ * with one property, "Comm". When a command is sent to an interpreter, the
+ * command is appended to the comm property of the communication window
+ * associated with the interp's process. Similarly, when a result is returned
+ * from a sent command, it is also appended to the comm property.
+ *
+ * Each command and each result takes the form of ASCII text. For a command,
+ * the text consists of a zero character followed by several null-terminated
+ * ASCII strings. The first string consists of the single letter "c".
+ * Subsequent strings have the form "option value" where the following options
+ * are supported:
+ *
+ * -r commWindow serial
+ *
+ * This option means that a response should be sent to the window whose X
+ * identifier is "commWindow" (in hex), and the response should be
+ * identified with the serial number given by "serial" (in decimal). If
+ * this option isn't specified then the send is asynchronous and no
+ * response is sent.
+ *
+ * -n name
+ *
+ * "Name" gives the name of the application for which the command is
+ * intended. This option must be present.
+ *
+ * -s script
+ *
+ * "Script" is the script to be executed. This option must be present.
+ *
+ * The options may appear in any order. The -n and -s options must be present,
+ * but -r may be omitted for asynchronous RPCs. For compatibility with future
+ * releases that may add new features, there may be additional options
+ * present; as long as they start with a "-" character, they will be ignored.
+ *
+ *
+ * A result also consists of a zero character followed by several null-
+ * terminated ASCII strings. The first string consists of the single letter
+ * "r". Subsequent strings have the form "option value" where the following
+ * options are supported:
+ *
+ * -s serial
+ *
+ * Identifies the command for which this is the result. It is the same as
+ * the "serial" field from the -s option in the command. This option must
+ * be present.
+ *
+ * -c code
+ *
+ * "Code" is the completion code for the script, in decimal. If the code
+ * is omitted it defaults to TCL_OK.
+ *
+ * -r result
+ *
+ * "Result" is the result string for the script, which may be either a
+ * result or an error message. If this field is omitted then it defaults
+ * to an empty string.
+ *
+ * -i errorInfo
+ *
+ * "ErrorInfo" gives a string with which to initialize the errorInfo
+ * variable. This option may be omitted; it is ignored unless the
+ * completion code is TCL_ERROR.
+ *
+ * -e errorCode
+ *
+ * "ErrorCode" gives a string with with to initialize the errorCode
+ * variable. This option may be omitted; it is ignored unless the
+ * completion code is TCL_ERROR.
+ *
+ * Options may appear in any order, and only the -s option must be present. As
+ * with commands, there may be additional options besides these; unknown
+ * options are ignored.
+ */
+
+/*
+ * Maximum size property that can be read at one time by this module:
+ */
#define MAX_PROP_WORDS 100000
@@ -176,7 +172,6 @@ static RegisteredInterp *interpListPtr = NULL;
*/
static int SendInit(Tcl_Interp *interp);
-
/*
*--------------------------------------------------------------
@@ -184,34 +179,33 @@ static int SendInit(Tcl_Interp *interp);
* Tk_SetAppName --
*
* This procedure is called to associate an ASCII name with a Tk
- * application. If the application has already been named, the
- * name replaces the old one.
+ * application. If the application has already been named, the name
+ * replaces the old one.
*
* Results:
- * The return value is the name actually given to the application.
- * This will normally be the same as name, but if name was already
- * in use for an application then a name of the form "name #2" will
- * be chosen, with a high enough number to make the name unique.
+ * The return value is the name actually given to the application. This
+ * will normally be the same as name, but if name was already in use for
+ * an application then a name of the form "name #2" will be chosen, with
+ * a high enough number to make the name unique.
*
* Side effects:
- * Registration info is saved, thereby allowing the "send" command
- * to be used later to invoke commands in the application. In
- * addition, the "send" command is created in the application's
- * interpreter. The registration will be removed automatically
- * if the interpreter is deleted or the "send" command is removed.
+ * Registration info is saved, thereby allowing the "send" command to be
+ * used later to invoke commands in the application. In addition, the
+ * "send" command is created in the application's interpreter. The
+ * registration will be removed automatically if the interpreter is
+ * deleted or the "send" command is removed.
*
*--------------------------------------------------------------
*/
CONST char *
Tk_SetAppName(
- Tk_Window tkwin, /* Token for any window in the application
- * to be named: it is just used to identify
- * the application and the display. */
- CONST char *name) /* The name that will be used to
- * refer to the interpreter in later
- * "send" commands. Must be globally
- * unique. */
+ Tk_Window tkwin, /* Token for any window in the application to
+ * be named: it is just used to identify the
+ * application and the display. */
+ CONST char *name) /* The name that will be used to refer to the
+ * interpreter in later "send" commands. Must
+ * be globally unique. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
Tcl_Interp *interp = winPtr->mainPtr->interp;
@@ -227,9 +221,9 @@ Tk_SetAppName(
}
/*
- * See if the application is already registered; if so, remove its
- * current name from the registry. The deletion of the command
- * will take care of disposing of this entry.
+ * See if the application is already registered; if so, remove its current
+ * name from the registry. The deletion of the command will take care of
+ * disposing of this entry.
*/
for (riPtr = interpListPtr, prevPtr = NULL; riPtr != NULL;
@@ -245,10 +239,9 @@ Tk_SetAppName(
}
/*
- * Pick a name to use for the application. Use "name" if it's not
- * already in use. Otherwise add a suffix such as " #2", trying
- * larger and larger numbers until we eventually find one that is
- * unique.
+ * Pick a name to use for the application. Use "name" if it's not already
+ * in use. Otherwise add a suffix such as " #2", trying larger and larger
+ * numbers until we eventually find one that is unique.
*/
actualName = name;
@@ -299,8 +292,7 @@ Tk_SetAppName(
* TODO: DeleteProc
*/
- Tcl_CreateObjCommand(interp, "send", Tk_SendObjCmd,
- (ClientData) riPtr, NULL);
+ Tcl_CreateObjCommand(interp, "send", Tk_SendObjCmd, riPtr, NULL);
if (Tcl_IsSafe(interp)) {
Tcl_HideCommand(interp, "send", "send");
}
@@ -314,8 +306,8 @@ Tk_SetAppName(
*
* Tk_SendObjCmd --
*
- * This procedure is invoked to process the "send" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "send" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -373,11 +365,10 @@ Tk_SendObjCmd(
resultPtr = Tcl_GetObjResult(interp);
/*
- * See if the target interpreter is local. If so, execute
- * the command directly without going through the DDE server.
- * The only tricky thing is passing the result from the target
- * interpreter to the invoking interpreter. Watch out: they
- * could be the same!
+ * See if the target interpreter is local. If so, execute the command
+ * directly without going through the DDE server. The only tricky thing is
+ * passing the result from the target interpreter to the invoking
+ * interpreter. Watch out: they could be the same!
*/
for (riPtr = interpListPtr; (riPtr != NULL)
@@ -385,29 +376,29 @@ Tk_SendObjCmd(
/*
* Empty loop body.
*/
-
}
if (riPtr != NULL) {
/*
- * This command is to a local interp. No need to go through
- * the server.
+ * This command is to a local interp. No need to go through the
+ * server.
*/
Tcl_Interp *localInterp;
- Tcl_Preserve((ClientData) riPtr);
+ Tcl_Preserve(riPtr);
localInterp = riPtr->interp;
- Tcl_Preserve((ClientData) localInterp);
+ Tcl_Preserve(localInterp);
if (firstArg == (objc - 1)) {
/*
- * This might be one of those cases where the new
- * parser is faster.
+ * This might be one of those cases where the new parser is
+ * faster.
*/
- result = Tcl_EvalObjEx(localInterp, objv[firstArg], TCL_EVAL_DIRECT);
+ result = Tcl_EvalObjEx(localInterp, objv[firstArg],
+ TCL_EVAL_DIRECT);
} else {
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
+ listObjPtr = Tcl_NewListObj(0, NULL);
for (i = firstArg; i < objc; i++) {
Tcl_ListObjAppendList(interp, listObjPtr, objv[i]);
}
@@ -423,9 +414,9 @@ Tk_SendObjCmd(
* An error occurred, so transfer error information from the
* destination interpreter back to our interpreter. Must clear
* interp's result before calling Tcl_AddErrorInfo, since
- * Tcl_AddErrorInfo will store the interp's result in errorInfo
- * before appending riPtr's $errorInfo; we've already got
- * everything we need in riPtr's $errorInfo.
+ * Tcl_AddErrorInfo will store the interp's result in
+ * errorInfo before appending riPtr's $errorInfo; we've
+ * already got everything we need in riPtr's $errorInfo.
*/
Tcl_ResetResult(interp);
@@ -437,12 +428,12 @@ Tk_SendObjCmd(
}
Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
}
- Tcl_Release((ClientData) riPtr);
- Tcl_Release((ClientData) localInterp);
+ Tcl_Release(riPtr);
+ Tcl_Release(localInterp);
} else {
/*
- * TODO: This is a non-local request. Send the script to the server and
- * poll it for a result.
+ * TODO: This is a non-local request. Send the script to the server
+ * and poll it for a result.
*/
}
@@ -454,15 +445,14 @@ Tk_SendObjCmd(
*
* TkGetInterpNames --
*
- * This procedure is invoked to fetch a list of all the
- * interpreter names currently registered for the display
- * of a particular window.
+ * This procedure is invoked to fetch a list of all the interpreter names
+ * currently registered for the display of a particular window.
*
* Results:
- * A standard Tcl return value. Interp->result will be set
- * to hold a list of all the interpreter names defined for
- * tkwin's display. If an error occurs, then TCL_ERROR
- * is returned and interp->result will hold an error message.
+ * A standard Tcl return value. Interp->result will be set to hold a list
+ * of all the interpreter names defined for tkwin's display. If an error
+ * occurs, then TCL_ERROR is returned and interp->result will hold an
+ * error message.
*
* Side effects:
* None.
@@ -473,13 +463,13 @@ Tk_SendObjCmd(
int
TkGetInterpNames(
Tcl_Interp *interp, /* Interpreter for returning a result. */
- Tk_Window tkwin) /* Window whose display is to be used
- * for the lookup. */
+ Tk_Window tkwin) /* Window whose display is to be used for the
+ * lookup. */
{
Tcl_Obj *listObjPtr;
RegisteredInterp *riPtr;
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
+ listObjPtr = Tcl_NewListObj(0, NULL);
riPtr = interpListPtr;
while (riPtr != NULL) {
Tcl_ListObjAppendElement(interp, listObjPtr,
@@ -496,9 +486,8 @@ TkGetInterpNames(
*
* SendInit --
*
- * This procedure is called to initialize the
- * communication channels for sending commands and
- * receiving results.
+ * This procedure is called to initialize the communication channels for
+ * sending commands and receiving results.
*
* Results:
* None.
@@ -511,8 +500,8 @@ TkGetInterpNames(
static int
SendInit(
- Tcl_Interp *interp) /* Interpreter to use for error reporting
- * (no errors are ever returned, but the
+ Tcl_Interp *interp) /* Interpreter to use for error reporting (no
+ * errors are ever returned, but the
* interpreter is needed anyway). */
{
return TCL_OK;
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 6f31a99..3c93feb 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -1441,3 +1441,12 @@ Tk_FreePixmap(
}
ckfree((char *) macPix);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 7b95a2e..2cb2255 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -2,16 +2,16 @@
* tkMacOSXWm.c --
*
* This module takes care of the interactions between a Tk-based
- * application and the window manager. Among other things, it
- * implements the "wm" command and passes geometry information
- * to the window manager.
+ * application and the window manager. Among other things, it implements
+ * the "wm" command and passes geometry information to the window
+ * manager.
*
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
@@ -30,13 +30,13 @@
* Data for [wm attributes] command:
*/
typedef enum {
- WMATT_ALPHA, WMATT_FULLSCREEN, WMATT_MODIFIED,/* WMATT_NOTIFY,*/
+ WMATT_ALPHA, WMATT_FULLSCREEN, WMATT_MODIFIED, WMATT_NOTIFY,
WMATT_TITLEPATH, WMATT_TOPMOST, WMATT_TRANSPARENT,
_WMATT_LAST_ATTRIBUTE
} WmAttribute;
static const char *WmAttributeNames[] = {
- "-alpha", "-fullscreen", "-modified",/* "-notify",*/
+ "-alpha", "-fullscreen", "-modified", "-notify",
"-titlepath", "-topmost", "-transparent",
NULL
};
@@ -50,34 +50,31 @@ static const char *WmAttributeNames[] = {
TkMacOSXWindowList *tkMacOSXWindowListPtr = NULL;
/*
- * The variable below is used to enable or disable tracing in this
- * module. If tracing is enabled, then information is printed on
- * standard output about interesting interactions with the window
- * manager.
+ * The variable below is used to enable or disable tracing in this module. If
+ * tracing is enabled, then information is printed on standard output about
+ * interesting interactions with the window manager.
*/
static int wmTracing = 0;
/*
- * The following structure is the official type record for geometry
- * management of top-level windows.
+ * The following structure is the official type record for geometry management
+ * of top-level windows.
*/
static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
-static /* const */ Tk_GeomMgr wmMgrType = {
- "wm", /* name */
- TopLevelReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
+static const Tk_GeomMgr wmMgrType = {
+ "wm", /* name */
+ TopLevelReqProc, /* requestProc */
+ NULL, /* lostSlaveProc */
};
/*
* The following keeps state for Aqua dock icon bounce notification.
*/
-#if 0
static int tkMacOSXWmAttrNotifyVal = 0;
-#endif
/*
* Hash table for Mac Window -> TkWindow mapping.
@@ -113,10 +110,8 @@ static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
-#if 0
static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
-#endif
static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp,
@@ -139,10 +134,8 @@ static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
-#if 0
static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-#endif
static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp,
@@ -177,19 +170,15 @@ static void ApplyMasterOverrideChanges(TkWindow *winPtr, WindowRef macWindow);
static WindowGroupRef WmGetWindowGroup(TkWindow *winPtr);
static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr);
static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr);
-#if 0
static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin);
-#endif
-
/*
*----------------------------------------------------------------------
*
* TkWmNewWindow --
*
- * This procedure is invoked whenever a new top-level
- * window is created. Its job is to initialize the WmInfo
- * structure for the window.
+ * This procedure is invoked whenever a new top-level window is created.
+ * Its job is to initialize the WmInfo structure for the window.
*
* Results:
* None.
@@ -204,9 +193,8 @@ void
TkWmNewWindow(
TkWindow *winPtr) /* Newly-created top-level window. */
{
- WmInfo *wmPtr;
+ WmInfo *wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
- wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
wmPtr->winPtr = winPtr;
wmPtr->reparent = None;
wmPtr->titleUid = NULL;
@@ -239,9 +227,9 @@ TkWmNewWindow(
wmPtr->x = winPtr->changes.x;
wmPtr->y = winPtr->changes.y;
wmPtr->parentWidth = winPtr->changes.width
- + 2*winPtr->changes.border_width;
+ + 2*winPtr->changes.border_width;
wmPtr->parentHeight = winPtr->changes.height
- + 2*winPtr->changes.border_width;
+ + 2*winPtr->changes.border_width;
wmPtr->xInParent = 0;
wmPtr->yInParent = 0;
wmPtr->cmapList = NULL;
@@ -265,16 +253,16 @@ TkWmNewWindow(
UpdateVRootGeometry(wmPtr);
/*
- * Tk must monitor structure events for top-level windows, in order
- * to detect size and position changes caused by window managers.
+ * Tk must monitor structure events for top-level windows, in order to
+ * detect size and position changes caused by window managers.
*/
Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask,
- TopLevelEventProc, (ClientData) winPtr);
+ TopLevelEventProc, winPtr);
/*
- * Arrange for geometry requests to be reflected from the window
- * to the window manager.
+ * Arrange for geometry requests to be reflected from the window to the
+ * window manager.
*/
Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
@@ -285,28 +273,28 @@ TkWmNewWindow(
*
* TkWmMapWindow --
*
- * This procedure is invoked to map a top-level window. This
- * module gets a chance to update all window-manager-related
- * information in properties before the window manager sees
- * the map event and checks the properties. It also gets to
- * decide whether or not to even map the window after all.
+ * This procedure is invoked to map a top-level window. This module gets
+ * a chance to update all window-manager-related information in
+ * properties before the window manager sees the map event and checks the
+ * properties. It also gets to decide whether or not to even map the
+ * window after all.
*
* Results:
* None.
*
* Side effects:
- * Properties of winPtr may get updated to provide up-to-date
- * information to the window manager. The window may also get
- * mapped, but it may not be if this procedure decides that
- * isn't appropriate (e.g. because the window is withdrawn).
+ * Properties of winPtr may get updated to provide up-to-date information
+ * to the window manager. The window may also get mapped, but it may not
+ * be if this procedure decides that isn't appropriate (e.g. because the
+ * window is withdrawn).
*
*----------------------------------------------------------------------
*/
void
TkWmMapWindow(
- TkWindow *winPtr) /* Top-level window that's about to
- * be mapped. */
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -316,6 +304,7 @@ TkWmMapWindow(
/*
* Create the underlying Mac window for this Tk window.
*/
+
if (!TkMacOSXHostToplevelExists(winPtr)) {
TkMacOSXMakeRealWindowExist(winPtr);
}
@@ -327,9 +316,8 @@ TkWmMapWindow(
TK_LOCATION_CHANGED);
/*
- * This is the first time this window has ever been mapped.
- * Store all the window-manager-related information for the
- * window.
+ * This is the first time this window has ever been mapped. Store all
+ * the window-manager-related information for the window.
*/
if (wmPtr->titleUid == NULL) {
@@ -363,11 +351,12 @@ TkWmMapWindow(
/*
* Update geometry information.
*/
+
wmPtr->flags |= WM_ABOUT_TO_MAP;
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
wmPtr->flags &= ~WM_ABOUT_TO_MAP;
/*
@@ -382,8 +371,8 @@ TkWmMapWindow(
*
* TkWmUnmapWindow --
*
- * This procedure is invoked to unmap a top-level window.
- * On the Macintosh all we do is call XUnmapWindow.
+ * This procedure is invoked to unmap a top-level window. On the
+ * Macintosh all we do is call XUnmapWindow.
*
* Results:
* None.
@@ -396,8 +385,8 @@ TkWmMapWindow(
void
TkWmUnmapWindow(
- TkWindow *winPtr) /* Top-level window that's about to
- * be mapped. */
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
XUnmapWindow(winPtr->display, winPtr->window);
}
@@ -407,9 +396,8 @@ TkWmUnmapWindow(
*
* TkWmDeadWindow --
*
- * This procedure is invoked when a top-level window is
- * about to be deleted. It cleans up the wm-related data
- * structures for the window.
+ * This procedure is invoked when a top-level window is about to be
+ * deleted. It cleans up the wm-related data structures for the window.
*
* Results:
* None.
@@ -459,7 +447,7 @@ TkWmDeadWindow(
protPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr->nextPtr;
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
}
if (wmPtr->cmdArgv != NULL) {
ckfree((char *) wmPtr->cmdArgv);
@@ -468,7 +456,7 @@ TkWmDeadWindow(
ckfree((char *) wmPtr->clientMachine);
}
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
ckfree((char *) wmPtr);
winPtr->wmInfoPtr = NULL;
@@ -479,11 +467,10 @@ TkWmDeadWindow(
*
* TkWmSetClass --
*
- * This procedure is invoked whenever a top-level window's
- * class is changed. If the window has been mapped then this
- * procedure updates the window manager property for the
- * class. If the window hasn't been mapped, the update is
- * deferred until just before the first mapping.
+ * This procedure is invoked whenever a top-level window's class is
+ * changed. If the window has been mapped then this procedure updates the
+ * window manager property for the class. If the window hasn't been
+ * mapped, the update is deferred until just before the first mapping.
*
* Results:
* None.
@@ -506,8 +493,8 @@ TkWmSetClass(
*
* Tk_WmObjCmd --
*
- * This procedure is invoked to process the "wm" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -529,21 +516,21 @@ Tk_WmObjCmd(
Tk_Window tkwin = (Tk_Window) clientData;
static const char *optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
- "command", "deiconify", "focusmodel",/* "forget",*/
+ "command", "deiconify", "focusmodel", "forget",
"frame", "geometry", "grid", "group",
"iconbitmap", "iconify", "iconmask", "iconname",
"iconphoto", "iconposition", "iconwindow",
- /*"manage", */"maxsize", "minsize", "overrideredirect",
+ "manage", "maxsize", "minsize", "overrideredirect",
"positionfrom", "protocol", "resizable", "sizefrom",
"stackorder", "state", "title", "transient",
"withdraw", NULL };
enum options {
WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
- WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL,/* WMOPT_FORGET,*/
+ WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET,
WMOPT_FRAME, WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP,
WMOPT_ICONBITMAP, WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME,
WMOPT_ICONPHOTO, WMOPT_ICONPOSITION, WMOPT_ICONWINDOW,
- /*WMOPT_MANAGE, */WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
+ WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
WMOPT_WITHDRAW };
@@ -552,7 +539,7 @@ Tk_WmObjCmd(
TkWindow *winPtr;
if (objc < 2) {
-wrongNumArgs:
+ wrongNumArgs:
Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
return TCL_ERROR;
}
@@ -572,7 +559,7 @@ wrongNumArgs:
}
if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -585,84 +572,77 @@ wrongNumArgs:
return TCL_ERROR;
}
if (!Tk_IsTopLevel(winPtr)
-#if 0
- && (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)
-#endif
- ) {
+ && (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
"\" isn't a top-level window", NULL);
return TCL_ERROR;
}
switch ((enum options) index) {
- case WMOPT_ASPECT:
- return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ATTRIBUTES:
- return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_CLIENT:
- return WmClientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COLORMAPWINDOWS:
- return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COMMAND:
- return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_DEICONIFY:
- return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FOCUSMODEL:
- return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
-#if 0
- case WMOPT_FORGET:
- return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
-#endif
- case WMOPT_FRAME:
- return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GEOMETRY:
- return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GRID:
- return WmGridCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GROUP:
- return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONBITMAP:
- return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONIFY:
- return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONMASK:
- return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONNAME:
- return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPHOTO:
- return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPOSITION:
- return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONWINDOW:
- return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
-#if 0
- case WMOPT_MANAGE:
- return WmManageCmd(tkwin, winPtr, interp, objc, objv);
-#endif
- case WMOPT_MAXSIZE:
- return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MINSIZE:
- return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_OVERRIDEREDIRECT:
- return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_POSITIONFROM:
- return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_PROTOCOL:
- return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_RESIZABLE:
- return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_SIZEFROM:
- return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STACKORDER:
- return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STATE:
- return WmStateCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TITLE:
- return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TRANSIENT:
- return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_WITHDRAW:
- return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ASPECT:
+ return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ATTRIBUTES:
+ return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_CLIENT:
+ return WmClientCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_COLORMAPWINDOWS:
+ return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_COMMAND:
+ return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_DEICONIFY:
+ return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FOCUSMODEL:
+ return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FORGET:
+ return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FRAME:
+ return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GEOMETRY:
+ return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GRID:
+ return WmGridCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GROUP:
+ return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONBITMAP:
+ return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONIFY:
+ return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONMASK:
+ return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONNAME:
+ return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPHOTO:
+ return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPOSITION:
+ return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONWINDOW:
+ return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MANAGE:
+ return WmManageCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MAXSIZE:
+ return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MINSIZE:
+ return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_OVERRIDEREDIRECT:
+ return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_POSITIONFROM:
+ return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_PROTOCOL:
+ return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_RESIZABLE:
+ return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_SIZEFROM:
+ return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_STACKORDER:
+ return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_STATE:
+ return WmStateCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_TITLE:
+ return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_TRANSIENT:
+ return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_WITHDRAW:
+ return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
}
/* This should not happen */
@@ -674,8 +654,8 @@ wrongNumArgs:
*
* WmAspectCmd --
*
- * This procedure is invoked to process the "wm aspect" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm aspect" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -717,15 +697,14 @@ WmAspectCmd(
wmPtr->sizeHintsFlags &= ~PAspect;
} else {
if ((Tcl_GetIntFromObj(interp, objv[3], &numer1) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) {
return TCL_ERROR;
}
if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
- (denom2 <= 0)) {
- Tcl_SetResult(interp, "aspect number can't be <= 0",
- TCL_STATIC);
+ (denom2 <= 0)) {
+ Tcl_SetResult(interp, "aspect number can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
wmPtr->minAspect.x = numer1;
@@ -744,17 +723,19 @@ WmAspectCmd(
*
* WmSetAttribute --
*
- * Helper routine for WmAttributesCmd. Sets the value
- * of the specified attribute.
+ * Helper routine for WmAttributesCmd. Sets the value of the specified
+ * attribute.
*
* Returns:
*
- * TCL_OK if successful, TCL_ERROR otherwise. In case of an
- * error, leaves a message in the interpreter's result.
+ * TCL_OK if successful, TCL_ERROR otherwise. In case of an error, leaves
+ * a message in the interpreter's result.
*
*----------------------------------------------------------------------
*/
-static int WmSetAttribute(
+
+static int
+WmSetAttribute(
TkWindow *winPtr, /* Toplevel to work with */
WindowRef macWindow,
Tcl_Interp *interp, /* Current interpreter */
@@ -765,154 +746,150 @@ static int WmSetAttribute(
int boolean;
switch (attribute) {
- case WMATT_ALPHA: {
- double dval;
+ case WMATT_ALPHA: {
+ double dval;
- if (Tcl_GetDoubleFromObj(interp, value, &dval) != TCL_OK) {
- return TCL_ERROR;
- }
- /*
- * The user should give (transparent) 0 .. 1.0 (opaque)
- */
- if (dval < 0.0) {
- dval = 0.0;
- } else if (dval > 1.0) {
- dval = 1.0;
- }
- ChkErr(SetWindowAlpha, macWindow, dval);
- break;
+ if (Tcl_GetDoubleFromObj(interp, value, &dval) != TCL_OK) {
+ return TCL_ERROR;
}
- case WMATT_FULLSCREEN:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
- }
- if (boolean != ((wmPtr->flags & WM_FULLSCREEN) != 0)) {
- if(TkMacOSXMakeFullscreen(winPtr, macWindow, boolean, interp)
- != TCL_OK) {
- return TCL_ERROR;
- }
- }
- break;
- case WMATT_MODIFIED:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
- }
- if (boolean != IsWindowModified(macWindow)) {
- ChkErr(SetWindowModified, macWindow, boolean);
- }
- break;
-#if 0
- case WMATT_NOTIFY:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+
+ /*
+ * The user should give (transparent) 0 .. 1.0 (opaque)
+ */
+
+ if (dval < 0.0) {
+ dval = 0.0;
+ } else if (dval > 1.0) {
+ dval = 1.0;
+ }
+ ChkErr(SetWindowAlpha, macWindow, dval);
+ break;
+ }
+ case WMATT_FULLSCREEN:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_FULLSCREEN) != 0)) {
+ if (TkMacOSXMakeFullscreen(winPtr, macWindow, boolean, interp)
+ != TCL_OK) {
return TCL_ERROR;
}
- if (boolean == !tkMacOSXWmAttrNotifyVal) {
- static NMRec notifyRec;
-
- if (boolean) {
- bzero(&notifyRec, sizeof(notifyRec));
- notifyRec.qType = nmType;
- notifyRec.nmMark = 1;
- ChkErr(NMInstall, &notifyRec);
- } else {
- ChkErr(NMRemove, &notifyRec);
- }
- tkMacOSXWmAttrNotifyVal = boolean;
- }
- break;
-#endif
- case WMATT_TITLEPATH: {
- const char *path;
- OSStatus err;
-
- path = Tcl_FSGetNativePath(value);
- if (path && *path) {
- FSRef ref;
- Boolean d;
-
- err = ChkErr(FSPathMakeRef, (const unsigned char*) path, &ref,
- &d);
- if (err == noErr) {
- TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
- err = ChkErr(HIWindowSetProxyFSRef, macWindow, &ref);
- ) TK_ELSE_MAC_OS_X (4,
- AliasHandle alias;
-
- err = ChkErr(FSNewAlias, NULL, &ref, &alias);
- if (err == noErr) {
- err = ChkErr(SetWindowProxyAlias, macWindow,
- alias);
- DisposeHandle((Handle) alias);
- }
- ) TK_ENDIF
- }
- } else {
- int len;
+ }
+ break;
+ case WMATT_MODIFIED:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != IsWindowModified(macWindow)) {
+ ChkErr(SetWindowModified, macWindow, boolean);
+ }
+ break;
+ case WMATT_NOTIFY:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean == !tkMacOSXWmAttrNotifyVal) {
+ static NMRec notifyRec;
- Tcl_GetStringFromObj(value, &len);
- if (!len) {
- err = ChkErr(RemoveWindowProxy, macWindow);
- } else {
- err = fnfErr;
- }
- }
- if (err != noErr) {
- return TCL_ERROR;
+ if (boolean) {
+ bzero(&notifyRec, sizeof(notifyRec));
+ notifyRec.qType = nmType;
+ notifyRec.nmMark = 1;
+ ChkErr(NMInstall, &notifyRec);
+ } else {
+ ChkErr(NMRemove, &notifyRec);
}
- break;
+ tkMacOSXWmAttrNotifyVal = boolean;
}
- case WMATT_TOPMOST: {
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
+ break;
+ case WMATT_TITLEPATH: {
+ const char *path = Tcl_FSGetNativePath(value);
+ OSStatus err;
+
+ if (path && *path) {
+ FSRef ref;
+ Boolean d;
+
+ err = ChkErr(FSPathMakeRef, (const unsigned char*)path, &ref, &d);
+ if (err == noErr) {
+ TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
+ err = ChkErr(HIWindowSetProxyFSRef, macWindow, &ref);
+ ) TK_ELSE_MAC_OS_X (4,
+ AliasHandle alias;
+
+ err = ChkErr(FSNewAlias, NULL, &ref, &alias);
+ if (err == noErr) {
+ err = ChkErr(SetWindowProxyAlias, macWindow, alias);
+ DisposeHandle((Handle) alias);
+ }
+ ) TK_ENDIF
}
- if (boolean != ((wmPtr->flags & WM_TOPMOST) != 0)) {
- WindowGroupRef group;
+ } else {
+ int len;
- if (boolean) {
- wmPtr->flags |= WM_TOPMOST;
- } else {
- wmPtr->flags &= ~WM_TOPMOST;
- }
- group = WmGetWindowGroup(winPtr);
- if (group && group != GetWindowGroup(macWindow)) {
- ChkErr(SetWindowGroup, macWindow, group);
- }
+ Tcl_GetStringFromObj(value, &len);
+ if (!len) {
+ err = ChkErr(RemoveWindowProxy, macWindow);
+ } else {
+ err = fnfErr;
}
- break;
}
- case WMATT_TRANSPARENT:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
+ if (err != noErr) {
+ return TCL_ERROR;
+ }
+ break;
+ }
+ case WMATT_TOPMOST:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_TOPMOST) != 0)) {
+ WindowGroupRef group;
+
+ if (boolean) {
+ wmPtr->flags |= WM_TOPMOST;
+ } else {
+ wmPtr->flags &= ~WM_TOPMOST;
}
- if (boolean != ((wmPtr->flags & WM_TRANSPARENT) != 0)) {
- WindowAttributes oldAttributes = wmPtr->attributes;
-
- if (boolean) {
- wmPtr->flags |= WM_TRANSPARENT;
- wmPtr->attributes |= kWindowNoShadowAttribute;
- TK_IF_MAC_OS_X_API (3, HIWindowChangeFeatures,
- UInt32 features;
-
- ChkErr(GetWindowFeatures, macWindow, &features);
- if (features & kWindowIsOpaque) {
- ChkErr(HIWindowChangeFeatures, macWindow, 0,
- kWindowIsOpaque);
- }
- ) TK_ENDIF
- } else {
- wmPtr->flags &= ~WM_TRANSPARENT;
- wmPtr->attributes &= ~kWindowNoShadowAttribute;
- }
- ApplyWindowClassAttributeChanges(winPtr, macWindow,
- wmPtr->macClass, oldAttributes, 1);
- ChkErr(ReshapeCustomWindow, macWindow);
- TkMacOSXInvalidateWindow((MacDrawable *)(winPtr->window),
- TK_PARENT_WINDOW);
+ group = WmGetWindowGroup(winPtr);
+ if (group && group != GetWindowGroup(macWindow)) {
+ ChkErr(SetWindowGroup, macWindow, group);
}
- break;
- case _WMATT_LAST_ATTRIBUTE:
- default:
+ }
+ break;
+ case WMATT_TRANSPARENT:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_TRANSPARENT) != 0)) {
+ WindowAttributes oldAttributes = wmPtr->attributes;
+
+ if (boolean) {
+ wmPtr->flags |= WM_TRANSPARENT;
+ wmPtr->attributes |= kWindowNoShadowAttribute;
+ TK_IF_MAC_OS_X_API (3, HIWindowChangeFeatures,
+ UInt32 features;
+
+ ChkErr(GetWindowFeatures, macWindow, &features);
+ if (features & kWindowIsOpaque) {
+ ChkErr(HIWindowChangeFeatures, macWindow, 0,
+ kWindowIsOpaque);
+ }
+ ) TK_ENDIF
+ } else {
+ wmPtr->flags &= ~WM_TRANSPARENT;
+ wmPtr->attributes &= ~kWindowNoShadowAttribute;
+ }
+ ApplyWindowClassAttributeChanges(winPtr, macWindow,
+ wmPtr->macClass, oldAttributes, 1);
+ ChkErr(ReshapeCustomWindow, macWindow);
+ TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window,
+ TK_PARENT_WINDOW);
+ }
+ break;
+ case _WMATT_LAST_ATTRIBUTE:
+ default:
+ return TCL_ERROR;
}
return TCL_OK;
}
@@ -922,12 +899,14 @@ static int WmSetAttribute(
*
* WmGetAttribute --
*
- * Helper routine for WmAttributesCmd. Returns the current value
- * of the specified attribute.
+ * Helper routine for WmAttributesCmd. Returns the current value of the
+ * specified attribute.
*
*----------------------------------------------------------------------
*/
-static Tcl_Obj *WmGetAttribute(
+
+static Tcl_Obj *
+WmGetAttribute(
TkWindow *winPtr, /* Toplevel to work with */
WindowRef macWindow,
WmAttribute attribute) /* Code of attribute to get */
@@ -936,59 +915,56 @@ static Tcl_Obj *WmGetAttribute(
Tcl_Obj *result = NULL;
switch (attribute) {
- case WMATT_ALPHA: {
- float fval = 1.0;
-
- ChkErr(GetWindowAlpha, macWindow, &fval);
- result = Tcl_NewDoubleObj(fval);
- break;
- }
- case WMATT_FULLSCREEN:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN);
- break;
- case WMATT_MODIFIED:
- result = Tcl_NewBooleanObj(IsWindowModified(macWindow));
- break;
-#if 0
- case WMATT_NOTIFY:
- result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal);
- break;
-#endif
- case WMATT_TITLEPATH: {
- FSRef ref;
- UInt8 path[PATH_MAX+1];
- OSStatus err;
-
- TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
- err = ChkErr(HIWindowGetProxyFSRef, macWindow, &ref);
- ) TK_ELSE_MAC_OS_X (4,
- Boolean wasChanged;
- AliasHandle alias;
-
- err = ChkErr(GetWindowProxyAlias, macWindow, &alias);
- if (err == noErr) {
- err = ChkErr(FSResolveAlias, NULL, alias, &ref,
- &wasChanged);
- }
- ) TK_ENDIF
+ case WMATT_ALPHA: {
+ float fval = 1.0;
+
+ ChkErr(GetWindowAlpha, macWindow, &fval);
+ result = Tcl_NewDoubleObj(fval);
+ break;
+ }
+ case WMATT_FULLSCREEN:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN);
+ break;
+ case WMATT_MODIFIED:
+ result = Tcl_NewBooleanObj(IsWindowModified(macWindow));
+ break;
+ case WMATT_NOTIFY:
+ result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal);
+ break;
+ case WMATT_TITLEPATH: {
+ FSRef ref;
+ UInt8 path[PATH_MAX+1];
+ OSStatus err;
+
+ TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
+ err = ChkErr(HIWindowGetProxyFSRef, macWindow, &ref);
+ ) TK_ELSE_MAC_OS_X (4,
+ Boolean wasChanged;
+ AliasHandle alias;
+
+ err = ChkErr(GetWindowProxyAlias, macWindow, &alias);
if (err == noErr) {
- err = ChkErr(FSRefMakePath, &ref, path, PATH_MAX);
- }
- if (err != noErr) {
- *path = 0;
+ err = ChkErr(FSResolveAlias, NULL, alias, &ref, &wasChanged);
}
- result = Tcl_NewStringObj((char*) path, -1);
- break;
+ ) TK_ENDIF
+ if (err == noErr) {
+ err = ChkErr(FSRefMakePath, &ref, path, PATH_MAX);
}
- case WMATT_TOPMOST:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST);
- break;
- case WMATT_TRANSPARENT:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
- break;
- case _WMATT_LAST_ATTRIBUTE:
- default:
- break;
+ if (err != noErr) {
+ *path = 0;
+ }
+ result = Tcl_NewStringObj((char*) path, -1);
+ break;
+ }
+ case WMATT_TOPMOST:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST);
+ break;
+ case WMATT_TRANSPARENT:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
+ break;
+ case _WMATT_LAST_ATTRIBUTE:
+ default:
+ break;
}
return result;
}
@@ -1070,8 +1046,8 @@ WmAttributesCmd(
*
* WmClientCmd --
*
- * This procedure is invoked to process the "wm client" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm client" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1115,8 +1091,7 @@ WmClientCmd(
if (wmPtr->clientMachine != NULL) {
ckfree((char *) wmPtr->clientMachine);
}
- wmPtr->clientMachine = (char *)
- ckalloc((unsigned) (length + 1));
+ wmPtr->clientMachine = ckalloc((unsigned) length + 1);
strcpy(wmPtr->clientMachine, argv3);
return TCL_OK;
}
@@ -1126,9 +1101,8 @@ WmClientCmd(
*
* WmColormapwindowsCmd --
*
- * This procedure is invoked to process the "wm colormapwindows"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm colormapwindows" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1173,11 +1147,10 @@ WmColormapwindowsCmd(
return TCL_ERROR;
}
cmapList = (TkWindow **) ckalloc((unsigned)
- ((windowObjc+1)*sizeof(TkWindow*)));
+ ((windowObjc+1) * sizeof(TkWindow*)));
for (i = 0; i < windowObjc; i++) {
if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
- (Tk_Window *) &winPtr2) != TCL_OK)
- {
+ (Tk_Window *) &winPtr2) != TCL_OK) {
ckfree((char *) cmapList);
return TCL_ERROR;
}
@@ -1204,9 +1177,8 @@ WmColormapwindowsCmd(
wmPtr->cmapCount = windowObjc;
/*
- * On the Macintosh all of this is just an excercise
- * in compatability as we don't support colormaps. If
- * we did they would be installed here.
+ * On the Macintosh all of this is just an excercise in compatability as
+ * we don't support colormaps. If we did they would be installed here.
*/
return TCL_OK;
@@ -1248,8 +1220,7 @@ WmCommandCmd(
}
if (objc == 3) {
if (wmPtr->cmdArgv != NULL) {
- Tcl_SetResult(interp,
- Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
+ Tcl_SetResult(interp, Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
TCL_DYNAMIC);
}
return TCL_OK;
@@ -1299,6 +1270,7 @@ WmDeiconifyCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
@@ -1361,7 +1333,7 @@ WmFocusmodelCmd(
}
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ACTIVE) {
@@ -1371,7 +1343,6 @@ WmFocusmodelCmd(
}
return TCL_OK;
}
-#if 0
/*
*----------------------------------------------------------------------
@@ -1391,15 +1362,15 @@ WmFocusmodelCmd(
*/
static int
-WmForgetCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel or Frame to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmForgetCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
#if 1
- Tcl_AppendResult(interp, "wm forget is not yet supported", (char*)NULL);
+ Tcl_AppendResult(interp, "wm forget is not yet supported", NULL);
return TCL_ERROR;
#else
register Tk_Window frameWin = (Tk_Window)winPtr;
@@ -1413,8 +1384,8 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv)
Tk_UnmapWindow(frameWin);
if (destPort != NULL) {
- WindowRef winRef;
- winRef = GetWindowFromPort(destPort);
+ WindowRef winRef = GetWindowFromPort(destPort);
+
TkMacOSXUnregisterMacWindow(winRef);
DisposeWindow(winRef);
}
@@ -1424,7 +1395,8 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv)
RemapWindows(winPtr, macWin);
TkWmDeadWindow(winPtr);
- winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ winPtr->flags &=
+ ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
TkMapTopFrame(frameWin);
} else {
@@ -1433,15 +1405,14 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv)
return TCL_OK;
#endif
}
-#endif
/*
*----------------------------------------------------------------------
*
* WmFrameCmd --
*
- * This procedure is invoked to process the "wm frame" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm frame" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1525,8 +1496,8 @@ WmGeometryCmd(
width = winPtr->changes.width;
height = winPtr->changes.height;
}
- sprintf(buf, "%dx%d%c%d%c%d", width, height, xSign, wmPtr->x,
- ySign, wmPtr->y);
+ sprintf(buf, "%dx%d%c%d%c%d",
+ width, height, xSign, wmPtr->x, ySign, wmPtr->y);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -1545,8 +1516,8 @@ WmGeometryCmd(
*
* WmGridCmd --
*
- * This procedure is invoked to process the "wm grid" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm grid" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1586,8 +1557,8 @@ WmGridCmd(
}
if (*Tcl_GetString(objv[3]) == '\0') {
/*
- * Turn off gridding and reset the width and height
- * to make sense as ungridded numbers.
+ * Turn off gridding and reset the width and height to make sense as
+ * ungridded numbers.
*/
wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
@@ -1601,9 +1572,9 @@ WmGridCmd(
wmPtr->heightInc = 1;
} else {
if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[6], &heightInc)!=TCL_OK)) {
return TCL_ERROR;
}
if (reqWidth < 0) {
@@ -1635,8 +1606,8 @@ WmGridCmd(
*
* WmGroupCmd --
*
- * This procedure is invoked to process the "wm group" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm group" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1850,8 +1821,7 @@ WmIconmaskCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & IconMaskHint) {
- Tcl_SetResult(interp,
- (char*)Tk_NameOfBitmap(winPtr->display,
+ Tcl_SetResult(interp, (char *) Tk_NameOfBitmap(winPtr->display,
wmPtr->hints.icon_mask), TCL_STATIC);
}
return TCL_OK;
@@ -1907,8 +1877,7 @@ WmIconnameCmd(
return TCL_ERROR;
}
if (objc == 3) {
- Tcl_SetResult(interp,
- (char*)((wmPtr->iconName != NULL) ?
+ Tcl_SetResult(interp, (char *) ((wmPtr->iconName != NULL) ?
wmPtr->iconName : ""), TCL_STATIC);
return TCL_OK;
} else {
@@ -1916,7 +1885,7 @@ WmIconnameCmd(
ckfree((char *) wmPtr->iconName);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc((unsigned) (length + 1));
+ wmPtr->iconName = ckalloc((unsigned) length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
@@ -1930,10 +1899,9 @@ WmIconnameCmd(
*
* WmIconphotoCmd --
*
- * This procedure is invoked to process the "wm iconphoto"
- * Tcl command.
- * See the user documentation for details on what it does.
- * Not yet implemented for OS X.
+ * This procedure is invoked to process the "wm iconphoto" Tcl command.
+ * See the user documentation for details on what it does. Not yet
+ * implemented for OS X.
*
* Results:
* A standard Tcl result.
@@ -1968,10 +1936,12 @@ WmIconphotoCmd(
return TCL_ERROR;
}
}
+
/*
* Iterate over all images to retrieve their sizes, in order to allocate a
* buffer large enough to hold all images.
*/
+
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
if (photo == NULL) {
@@ -1981,10 +1951,12 @@ WmIconphotoCmd(
}
Tk_PhotoGetSize(photo, &width, &height);
}
+
/*
- * This requires implementation for OS X, but we silently return
- * for now.
+ * TODO: This requires implementation for OS X, but we silently return for
+ * now.
*/
+
return TCL_OK;
}
@@ -1993,9 +1965,8 @@ WmIconphotoCmd(
*
* WmIconpositionCmd --
*
- * This procedure is invoked to process the "wm iconposition"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm iconposition" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2127,15 +2098,14 @@ WmIconwindowCmd(
}
return TCL_OK;
}
-#if 0
/*
*----------------------------------------------------------------------
*
* WmManageCmd --
*
- * This procedure is invoked to process the "wm manage" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm manage" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2155,7 +2125,7 @@ WmManageCmd(
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
#if 1
- Tcl_AppendResult(interp, "wm manage is not yet supported", (char*)NULL);
+ Tcl_AppendResult(interp, "wm manage is not yet supported", NULL);
return TCL_ERROR;
#else
register Tk_Window frameWin = (Tk_Window)winPtr;
@@ -2165,6 +2135,12 @@ WmManageCmd(
if (!Tk_IsTopLevel(frameWin)) {
MacDrawable *macWin = (MacDrawable *) winPtr->window;
+ if (!Tk_IsManageable(frameWin)) {
+ Tcl_AppendResult(interp, "window \"",
+ Tk_PathName(frameWin), "\" is not manageable: must be "
+ "a frame, labelframe or toplevel", NULL);
+ return TCL_ERROR;
+ }
TkFocusSplit(winPtr);
Tk_UnmapWindow(frameWin);
if (wmPtr == NULL) {
@@ -2181,15 +2157,15 @@ WmManageCmd(
macWin->grafPtr = NULL;
macWin->toplevel = macWin;
RemapWindows(winPtr, macWin);
- winPtr->flags |= (TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
- TkMapTopFrame (frameWin);
+ winPtr->flags |=
+ (TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ TkMapTopFrame(frameWin);
} else if (Tk_IsTopLevel(frameWin)) {
/* Already managed by wm - ignore it */
}
return TCL_OK;
#endif
}
-#endif
/*
*----------------------------------------------------------------------
@@ -2283,7 +2259,7 @@ WmMinsizeCmd(
return TCL_OK;
}
if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
return TCL_ERROR;
}
wmPtr->minWidth = width;
@@ -2298,9 +2274,8 @@ WmMinsizeCmd(
*
* WmOverrideredirectCmd --
*
- * This procedure is invoked to process the "wm overrideredirect"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm overrideredirect" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2389,7 +2364,7 @@ WmPositionfromCmd(
wmPtr->sizeHintsFlags &= ~(USPosition|PPosition);
} else {
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -2444,6 +2419,7 @@ WmProtocolCmd(
/*
* Return a list of all defined protocols for the window.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
Tcl_AppendElement(interp,
@@ -2468,9 +2444,8 @@ WmProtocolCmd(
}
/*
- * Delete any current protocol handler, then create a new
- * one with the specified command, unless the command is
- * empty.
+ * Delete any current protocol handler, then create a new one with the
+ * specified command, unless the command is empty.
*/
for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL;
@@ -2481,7 +2456,7 @@ WmProtocolCmd(
} else {
prevPtr->nextPtr = protPtr->nextPtr;
}
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
break;
}
}
@@ -2569,7 +2544,7 @@ WmResizableCmd(
}
WmUpdateGeom(wmPtr, winPtr);
ApplyWindowClassAttributeChanges(winPtr, NULL, wmPtr->macClass,
- oldAttributes, 1);
+ oldAttributes, 1);
return TCL_OK;
}
@@ -2622,7 +2597,7 @@ WmSizefromCmd(
wmPtr->sizeHintsFlags &= ~(USSize|PSize);
} else {
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -2679,13 +2654,13 @@ WmStackorderCmd(
windows = TkWmStackorderToplevel(winPtr);
if (windows == NULL) {
Tcl_Panic("TkWmStackorderToplevel failed");
- } else {
- for (window_ptr = windows; *window_ptr ; window_ptr++) {
- Tcl_AppendElement(interp, (*window_ptr)->pathName);
- }
- ckfree((char *) windows);
- return TCL_OK;
}
+
+ for (window_ptr = windows; *window_ptr ; window_ptr++) {
+ Tcl_AppendElement(interp, (*window_ptr)->pathName);
+ }
+ ckfree((char *) windows);
+ return TCL_OK;
} else {
TkWindow *winPtr2;
int index1=-1, index2=-1, result;
@@ -2714,9 +2689,8 @@ WmStackorderCmd(
}
/*
- * Lookup stacking order of all toplevels that are children
- * of "." and find the position of winPtr and winPtr2
- * in the stacking order.
+ * Lookup stacking order of all toplevels that are children of "." and
+ * find the position of winPtr and winPtr2 in the stacking order.
*/
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
@@ -2726,21 +2700,25 @@ WmStackorderCmd(
return TCL_ERROR;
} else {
for (window_ptr = windows; *window_ptr ; window_ptr++) {
- if (*window_ptr == winPtr)
+ if (*window_ptr == winPtr) {
index1 = (window_ptr - windows);
- if (*window_ptr == winPtr2)
+ }
+ if (*window_ptr == winPtr2) {
index2 = (window_ptr - windows);
+ }
}
- if (index1 == -1)
+ if (index1 == -1) {
Tcl_Panic("winPtr window not found");
- if (index2 == -1)
+ }
+ if (index2 == -1) {
Tcl_Panic("winPtr2 window not found");
+ }
ckfree((char *) windows);
}
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ISABOVE) {
@@ -2759,8 +2737,8 @@ WmStackorderCmd(
*
* WmStateCmd --
*
- * This procedure is invoked to process the "wm state" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm state" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2841,18 +2819,18 @@ WmStateCmd(
ZoomState : NormalState);
}
switch (wmPtr->hints.initial_state) {
- case NormalState:
- Tcl_SetResult(interp, "normal", TCL_STATIC);
- break;
- case IconicState:
- Tcl_SetResult(interp, "iconic", TCL_STATIC);
- break;
- case WithdrawnState:
- Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
- break;
- case ZoomState:
- Tcl_SetResult(interp, "zoomed", TCL_STATIC);
- break;
+ case NormalState:
+ Tcl_SetResult(interp, "normal", TCL_STATIC);
+ break;
+ case IconicState:
+ Tcl_SetResult(interp, "iconic", TCL_STATIC);
+ break;
+ case WithdrawnState:
+ Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
+ break;
+ case ZoomState:
+ Tcl_SetResult(interp, "zoomed", TCL_STATIC);
+ break;
}
}
}
@@ -2864,8 +2842,8 @@ WmStateCmd(
*
* WmTitleCmd --
*
- * This procedure is invoked to process the "wm title" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm title" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3043,7 +3021,7 @@ WmInfo *wmPtr;
TkWindow *winPtr;
{
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3054,33 +3032,33 @@ TkWindow *winPtr;
* Tk_SetGrid --
*
* This procedure is invoked by a widget when it wishes to set a grid
- * coordinate system that controls the size of a top-level window.
- * It provides a C interface equivalent to the "wm grid" command and
- * is usually asscoiated with the -setgrid option.
+ * coordinate system that controls the size of a top-level window. It
+ * provides a C interface equivalent to the "wm grid" command and is
+ * usually asscoiated with the -setgrid option.
*
* Results:
* None.
*
* Side effects:
- * Grid-related information will be passed to the window manager, so
- * that the top-level window associated with tkwin will resize on
- * even grid units. If some other window already controls gridding
- * for the top-level window then this procedure call has no effect.
+ * Grid-related information will be passed to the window manager, so that
+ * the top-level window associated with tkwin will resize on even grid
+ * units. If some other window already controls gridding for the
+ * top-level window then this procedure call has no effect.
*
*----------------------------------------------------------------------
*/
void
Tk_SetGrid(
- Tk_Window tkwin, /* Token for window. New window mgr info
- * will be posted for the top-level window
+ Tk_Window tkwin, /* Token for window. New window mgr info will
+ * be posted for the top-level window
* associated with this window. */
- int reqWidth, /* Width (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int reqHeight, /* Height (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int widthInc, int heightInc)/* Pixel increments corresponding to a
- * change of one grid unit. */
+ int reqWidth, /* Width (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int reqHeight, /* Height (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int widthInc, int heightInc)/* Pixel increments corresponding to a change
+ * of one grid unit. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
@@ -3120,15 +3098,15 @@ Tk_SetGrid(
}
/*
- * If gridding was previously off, then forget about any window
- * size requests made by the user or via "wm geometry": these are
- * in pixel units and there's no easy way to translate them to
- * grid units since the new requested size of the top-level window in
- * pixels may not yet have been registered yet (it may filter up
- * the hierarchy in DoWhenIdle handlers). However, if the window
- * has never been mapped yet then just leave the window size alone:
- * assume that it is intended to be in grid units but just happened
- * to have been specified before this procedure was called.
+ * If gridding was previously off, then forget about any window size
+ * requests made by the user or via "wm geometry": these are in pixel
+ * units and there's no easy way to translate them to grid units since the
+ * new requested size of the top-level window in pixels may not yet have
+ * been registered yet (it may filter up the hierarchy in DoWhenIdle
+ * handlers). However, if the window has never been mapped yet then just
+ * leave the window size alone: assume that it is intended to be in grid
+ * units but just happened to have been specified before this procedure
+ * was called.
*/
if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3137,8 +3115,8 @@ Tk_SetGrid(
}
/*
- * Set the new gridding information, and start the process of passing
- * all of this information to the window manager.
+ * Set the new gridding information, and start the process of passing all
+ * of this information to the window manager.
*/
wmPtr->gridWin = tkwin;
@@ -3149,7 +3127,7 @@ Tk_SetGrid(
wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3159,16 +3137,15 @@ Tk_SetGrid(
*
* Tk_UnsetGrid --
*
- * This procedure cancels the effect of a previous call
- * to Tk_SetGrid.
+ * This procedure cancels the effect of a previous call to Tk_SetGrid.
*
* Results:
* None.
*
* Side effects:
* If tkwin currently controls gridding for its top-level window,
- * gridding is cancelled for that top-level window; if some other
- * window controls gridding then this procedure has no effect.
+ * gridding is cancelled for that top-level window; if some other window
+ * controls gridding then this procedure has no effect.
*
*----------------------------------------------------------------------
*/
@@ -3207,7 +3184,7 @@ Tk_UnsetGrid(
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3224,8 +3201,8 @@ Tk_UnsetGrid(
* None.
*
* Side effects:
- * Tk's internal data structures for the window get modified to
- * reflect the structural change.
+ * Tk's internal data structures for the window get modified to reflect
+ * the structural change.
*
*----------------------------------------------------------------------
*/
@@ -3235,7 +3212,7 @@ TopLevelEventProc(
ClientData clientData, /* Window for which event occurred. */
XEvent *eventPtr) /* Event that just happened. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
winPtr->wmInfoPtr->flags |= WM_VROOT_OFFSET_STALE;
if (eventPtr->type == DestroyNotify) {
@@ -3249,7 +3226,7 @@ TopLevelEventProc(
*/
Tk_ErrorHandler handler = Tk_CreateErrorHandler(winPtr->display,
- -1, -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, -1, NULL, NULL);
Tk_DestroyWindow((Tk_Window) winPtr);
Tk_DeleteErrorHandler(handler);
}
@@ -3266,15 +3243,15 @@ TopLevelEventProc(
*
* TopLevelReqProc --
*
- * This procedure is invoked by the geometry manager whenever
- * the requested size for a top-level window is changed.
+ * This procedure is invoked by the geometry manager whenever the
+ * requested size for a top-level window is changed.
*
* Results:
* None.
*
* Side effects:
- * Arrange for the window to be resized to satisfy the request
- * (this happens as a when-idle action).
+ * Arrange for the window to be resized to satisfy the request (this
+ * happens as a when-idle action).
*
*----------------------------------------------------------------------
*/
@@ -3291,7 +3268,7 @@ TopLevelReqProc(
wmPtr = winPtr->wmInfoPtr;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3301,19 +3278,18 @@ TopLevelReqProc(
*
* UpdateGeometryInfo --
*
- * This procedure is invoked when a top-level window is first
- * mapped, and also as a when-idle procedure, to bring the
- * geometry and/or position of a top-level window back into
- * line with what has been requested by the user and/or widgets.
- * This procedure doesn't return until the window manager has
- * responded to the geometry change.
+ * This procedure is invoked when a top-level window is first mapped, and
+ * also as a when-idle procedure, to bring the geometry and/or position
+ * of a top-level window back into line with what has been requested by
+ * the user and/or widgets. This procedure doesn't return until the
+ * window manager has responded to the geometry change.
*
* Results:
* None.
*
* Side effects:
- * The window's size and location may change, unless the WM prevents
- * that from happening.
+ * The window's size and location may change, unless the WM prevents that
+ * from happening.
*
*----------------------------------------------------------------------
*/
@@ -3322,7 +3298,7 @@ static void
UpdateGeometryInfo(
ClientData clientData) /* Pointer to the window's record. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, min, max;
unsigned long serial;
@@ -3334,14 +3310,12 @@ UpdateGeometryInfo(
}
/*
- * Compute the new size for the top-level window. See the
- * user documentation for details on this, but the size
- * requested depends on (a) the size requested internally
- * by the window's widgets, (b) the size requested by the
- * user in a "wm geometry" command or via wm-based interactive
- * resizing (if any), and (c) whether or not the window is
- * gridded. Don't permit sizes <= 0 because this upsets
- * the X server.
+ * Compute the new size for the top-level window. See the user
+ * documentation for details on this, but the size requested depends on
+ * (a) the size requested internally by the window's widgets, (b) the size
+ * requested by the user in a "wm geometry" command or via wm-based
+ * interactive resizing (if any), and (c) whether or not the window is
+ * gridded. Don't permit sizes <= 0 because this upsets the X server.
*/
if (wmPtr->width == -1) {
@@ -3416,10 +3390,10 @@ UpdateGeometryInfo(
/*
* Compute the new position for the upper-left pixel of the window's
- * decorative frame. This is tricky, because we need to include the
- * border widths supplied by a reparented parent in this calculation,
- * but can't use the parent's current overall size since that may
- * change as a result of this code.
+ * decorative frame. This is tricky, because we need to include the border
+ * widths supplied by a reparented parent in this calculation, but can't
+ * use the parent's current overall size since that may change as a result
+ * of this code.
*/
if (wmPtr->flags & WM_NEGATIVE_X) {
@@ -3436,10 +3410,10 @@ UpdateGeometryInfo(
}
/*
- * If the window's size is going to change and the window is
- * supposed to not be resizable by the user, then we have to
- * update the size hints. There may also be a size-hint-update
- * request pending from somewhere else, too.
+ * If the window's size is going to change and the window is supposed to
+ * not be resizable by the user, then we have to update the size hints.
+ * There may also be a size-hint-update request pending from somewhere
+ * else, too.
*/
if (((width != winPtr->changes.width)
@@ -3453,22 +3427,21 @@ UpdateGeometryInfo(
}
/*
- * Reconfigure the window if it isn't already configured correctly.
- * A few tricky points:
+ * Reconfigure the window if it isn't already configured correctly. A few
+ * tricky points:
*
- * 1. If the window is embedded and the container is also in this
- * process, don't actually reconfigure the window; just pass the
- * desired size on to the container. Also, zero out any position
- * information, since embedded windows are not allowed to move.
- * 2. Sometimes the window manager will give us a different size
- * than we asked for (e.g. mwm has a minimum size for windows), so
- * base the size check on what we *asked for* last time, not what we
- * got.
- * 3. Don't move window unless a new position has been requested for
- * it. This is because of "features" in some window managers (e.g.
- * twm, as of 4/24/91) where they don't interpret coordinates
- * according to ICCCM. Moving a window to its current location may
- * cause it to shift position on the screen.
+ * 1. If the window is embedded and the container is also in this process,
+ * don't actually reconfigure the window; just pass the desired size on
+ * to the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
+ * 2. Sometimes the window manager will give us a different size than we
+ * asked for (e.g. mwm has a minimum size for windows), so base the
+ * size check on what we *asked for* last time, not what we got.
+ * 3. Don't move window unless a new position has been requested for it.
+ * This is because of "features" in some window managers (e.g. twm, as
+ * of 4/24/91) where they don't interpret coordinates according to
+ * ICCCM. Moving a window to its current location may cause it to shift
+ * position on the screen.
*/
if (Tk_IsEmbedded(winPtr)) {
@@ -3482,9 +3455,9 @@ UpdateGeometryInfo(
/*
* This window is embedded and the container is also in this
* process, so we don't need to do anything special about the
- * geometry, except to make sure that the desired size is known
- * by the container. Also, zero out any position information,
- * since embedded windows are not allowed to move.
+ * geometry, except to make sure that the desired size is known by
+ * the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
*/
wmPtr->x = wmPtr->y = 0;
@@ -3524,9 +3497,8 @@ UpdateGeometryInfo(
*
* UpdateSizeHints --
*
- * This procedure is called to update the window manager's
- * size hints information from the information in a WmInfo
- * structure.
+ * This procedure is called to update the window manager's size hints
+ * information from the information in a WmInfo structure.
*
* Results:
* None.
@@ -3544,8 +3516,6 @@ UpdateSizeHints(
WmInfo *wmPtr = winPtr->wmInfoPtr;
wmPtr->flags &= ~WM_UPDATE_SIZE_HINTS;
-
- return;
}
/*
@@ -3553,13 +3523,12 @@ UpdateSizeHints(
*
* ParseGeometry --
*
- * This procedure parses a geometry string and updates
- * information used to control the geometry of a top-level
- * window.
+ * This procedure parses a geometry string and updates information used
+ * to control the geometry of a top-level window.
*
* Results:
- * A standard Tcl return value, plus an error message in
- * the interp's result if an error occurs.
+ * A standard Tcl return value, plus an error message in the interp's
+ * result if an error occurs.
*
* Side effects:
* The size and/or location of winPtr may change.
@@ -3572,8 +3541,8 @@ ParseGeometry(
Tcl_Interp *interp, /* Used for error reporting. */
char *string, /* String containing new geometry. Has the
* standard form "=wxh+x+y". */
- TkWindow *winPtr) /* Pointer to top-level window whose
- * geometry is to be changed. */
+ TkWindow *winPtr) /* Pointer to top-level window whose geometry
+ * is to be changed. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, flags;
@@ -3589,9 +3558,9 @@ ParseGeometry(
}
/*
- * Parse the width and height, if they are present. Don't
- * actually update any of the fields of wmPtr until we've
- * successfully parsed the entire geometry string.
+ * Parse the width and height, if they are present. Don't actually update
+ * any of the fields of wmPtr until we've successfully parsed the entire
+ * geometry string.
*/
width = wmPtr->width;
@@ -3645,10 +3614,10 @@ ParseGeometry(
}
/*
- * Assume that the geometry information came from the user,
- * unless an explicit source has been specified. Otherwise
- * most window managers assume that the size hints were
- * program-specified and they ignore them.
+ * Assume that the geometry information came from the user, unless an
+ * explicit source has been specified. Otherwise most window managers
+ * assume that the size hints were program-specified and they ignore
+ * them.
*/
if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
@@ -3658,9 +3627,9 @@ ParseGeometry(
}
/*
- * Everything was parsed OK. Update the fields of *wmPtr and
- * arrange for the appropriate information to be percolated out
- * to the window manager at the next idle moment.
+ * Everything was parsed OK. Update the fields of *wmPtr and arrange for
+ * the appropriate information to be percolated out to the window manager
+ * at the next idle moment.
*/
wmPtr->width = width;
@@ -3680,12 +3649,12 @@ ParseGeometry(
wmPtr->flags = flags;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
return TCL_OK;
-error:
+ error:
Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
return TCL_ERROR;
}
@@ -3695,15 +3664,15 @@ error:
*
* Tk_GetRootCoords --
*
- * Given a token for a window, this procedure traces through the
- * window's lineage to find the (virtual) root-window coordinates
- * corresponding to point (0,0) in the window.
+ * Given a token for a window, this procedure traces through the window's
+ * lineage to find the (virtual) root-window coordinates corresponding to
+ * point (0,0) in the window.
*
* Results:
- * The locations pointed to by xPtr and yPtr are filled in with
- * the root coordinates of the (0,0) point in tkwin. If a virtual
- * root window is in effect for the window, then the coordinates
- * in the virtual root are returned.
+ * The locations pointed to by xPtr and yPtr are filled in with the root
+ * coordinates of the (0,0) point in tkwin. If a virtual root window is
+ * in effect for the window, then the coordinates in the virtual root are
+ * returned.
*
* Side effects:
* None.
@@ -3721,9 +3690,8 @@ Tk_GetRootCoords(
TkWindow *winPtr = (TkWindow *) tkwin;
/*
- * Search back through this window's parents all the way to a
- * top-level window, combining the offsets of each window within
- * its parent.
+ * Search back through this window's parents all the way to a top-level
+ * window, combining the offsets of each window within its parent.
*/
x = y = 0;
@@ -3740,15 +3708,16 @@ Tk_GetRootCoords(
if (otherPtr != NULL) {
/*
- * The container window is in the same application.
- * Query its coordinates.
+ * The container window is in the same application. Query
+ * its coordinates.
*/
+
winPtr = otherPtr;
/*
- * Remember to offset by the container window here,
- * since at the end of this if branch, we will
- * pop out to the container's parent...
+ * Remember to offset by the container window here, since
+ * at the end of this if branch, we will pop out to the
+ * container's parent...
*/
x += winPtr->changes.x + winPtr->changes.border_width;
@@ -3759,12 +3728,12 @@ Tk_GetRootCoords(
if (tkMacOSXEmbedHandler->getOffsetProc != NULL) {
/*
- * We do not require that the changes.x & changes.y for
- * a non-Tk master window be kept up to date. So we
- * first subtract off the possibly bogus values that
- * have been added on at the top of this pass through
- * the loop, and then call out to the getOffsetProc to
- * give us the correct offset.
+ * We do not require that the changes.x & changes.y
+ * for a non-Tk master window be kept up to date. So
+ * we first subtract off the possibly bogus values
+ * that have been added on at the top of this pass
+ * through the loop, and then call out to the
+ * getOffsetProc to give us the correct offset.
*/
x -= winPtr->changes.x + winPtr->changes.border_width;
@@ -3791,14 +3760,14 @@ Tk_GetRootCoords(
*
* Tk_CoordsToWindow --
*
- * This is a Macintosh specific implementation of this function.
- * Given the root coordinates of a point, this procedure returns
- * the token for the top-most window covering that point, if
- * there exists such a window in this application.
+ * This is a Macintosh specific implementation of this function. Given
+ * the root coordinates of a point, this procedure returns the token for
+ * the top-most window covering that point, if there exists such a window
+ * in this application.
*
* Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
* window.
*
* Side effects:
@@ -3809,19 +3778,19 @@ Tk_GetRootCoords(
Tk_Window
Tk_CoordsToWindow(
- int rootX, int rootY, /* Coordinates of point in root window. If
- * a virtual-root window manager is in use,
+ int rootX, int rootY, /* Coordinates of point in root window. If a
+ * virtual-root window manager is in use,
* these coordinates refer to the virtual
* root, not the real root. */
- Tk_Window tkwin) /* Token for any window in application;
- * used to identify the display. */
+ Tk_Window tkwin) /* Token for any window in application; used
+ * to identify the display. */
{
WindowPtr whichWin;
Point where;
Window rootChild;
TkWindow *winPtr, *childPtr;
- TkWindow *nextPtr; /* Coordinates of highest child found so
- * far that contains point. */
+ TkWindow *nextPtr; /* Coordinates of highest child found so far
+ * that contains point. */
int x, y; /* Coordinates in winPtr. */
int tmpx, tmpy, bd;
TkDisplay *dispPtr;
@@ -3844,10 +3813,10 @@ Tk_CoordsToWindow(
}
/*
- * Step 2: work down through the hierarchy underneath this window.
- * At each level, scan through all the children to find the highest
- * one in the stacking order that contains the point. Then repeat
- * the whole process on that child.
+ * Step 2: work down through the hierarchy underneath this window. At each
+ * level, scan through all the children to find the highest one in the
+ * stacking order that contains the point. Then repeat the whole process
+ * on that child.
*/
x = rootX - winPtr->wmInfoPtr->xInParent;
@@ -3914,13 +3883,12 @@ Tk_CoordsToWindow(
* Given a Tk Window, and coordinates of a point relative to that window
* this procedure returns the top-most child of the window (excluding
* toplevels) covering that point, if there exists such a window in this
- * application.
- * It also sets newX, and newY to the coords of the point relative to the
- * window returned.
+ * application. It also sets newX, and newY to the coords of the point
+ * relative to the window returned.
*
* Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
* window. newX and newY are also set to the coords of the point relative
* to the returned window.
*
@@ -3932,15 +3900,15 @@ Tk_CoordsToWindow(
Tk_Window
Tk_TopCoordsToWindow(
- Tk_Window tkwin, /* Token for a Tk Window which defines the;
+ Tk_Window tkwin, /* Token for a Tk Window which defines the
* coordinates for rootX & rootY */
int rootX, int rootY, /* Coordinates of a point in tkWin. */
int *newX, int *newY) /* Coordinates of point in the upperMost child
* of tkWin containing (rootX,rootY) */
{
TkWindow *winPtr, *childPtr;
- TkWindow *nextPtr; /* Coordinates of highest child found so
- * far that contains point. */
+ TkWindow *nextPtr; /* Coordinates of highest child found so far
+ * that contains point. */
int x, y; /* Coordinates in winPtr. */
Window *children; /* Children of winPtr, or NULL. */
@@ -4005,24 +3973,23 @@ Tk_TopCoordsToWindow(
*
* UpdateVRootGeometry --
*
- * This procedure is called to update all the virtual root
- * geometry information in wmPtr.
+ * This procedure is called to update all the virtual root geometry
+ * information in wmPtr.
*
* Results:
* None.
*
* Side effects:
- * The vRootX, vRootY, vRootWidth, and vRootHeight fields in
- * wmPtr are filled with the most up-to-date information.
+ * The vRootX, vRootY, vRootWidth, and vRootHeight fields in wmPtr are
+ * filled with the most up-to-date information.
*
*----------------------------------------------------------------------
*/
static void
UpdateVRootGeometry(
- WmInfo *wmPtr) /* Window manager information to be
- * updated. The wmPtr->vRoot field must
- * be valid. */
+ WmInfo *wmPtr) /* Window manager information to be updated.
+ * The wmPtr->vRoot field must be valid. */
{
TkWindow *winPtr = wmPtr->winPtr;
unsigned int bd, dummy;
@@ -4048,8 +4015,7 @@ UpdateVRootGeometry(
* Refresh the virtual root information if it's out of date.
*/
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL);
status = XGetGeometry(winPtr->display, wmPtr->vRoot,
&dummy2, &wmPtr->vRootX, &wmPtr->vRootY,
&wmPtr->vRootWidth, &wmPtr->vRootHeight, &bd, &dummy);
@@ -4061,7 +4027,7 @@ UpdateVRootGeometry(
Tk_DeleteErrorHandler(handler);
if (status == 0) {
/*
- * The virtual root is gone! Pretend that it never existed.
+ * The virtual root is gone! Pretend that it never existed.
*/
wmPtr->vRoot = None;
@@ -4074,16 +4040,15 @@ UpdateVRootGeometry(
*
* Tk_GetVRootGeometry --
*
- * This procedure returns information about the virtual root
- * window corresponding to a particular Tk window.
+ * This procedure returns information about the virtual root window
+ * corresponding to a particular Tk window.
*
* Results:
- * The values at xPtr, yPtr, widthPtr, and heightPtr are set
- * with the offset and dimensions of the root window corresponding
- * to tkwin. If tkwin is being managed by a virtual root window
- * manager these values correspond to the virtual root window being
- * used for tkwin; otherwise the offsets will be 0 and the
- * dimensions will be those of the screen.
+ * The values at xPtr, yPtr, widthPtr, and heightPtr are set with the
+ * offset and dimensions of the root window corresponding to tkwin. If
+ * tkwin is being managed by a virtual root window manager these values
+ * correspond to the virtual root window being used for tkwin; otherwise
+ * the offsets will be 0 and the dimensions will be those of the screen.
*
* Side effects:
* Vroot window information is refreshed if it is out of date.
@@ -4114,8 +4079,8 @@ Tk_GetVRootGeometry(
wmPtr = winPtr->wmInfoPtr;
/*
- * Make sure that the geometry information is up-to-date, then copy
- * it out to the caller.
+ * Make sure that the geometry information is up-to-date, then copy it out
+ * to the caller.
*/
if (wmPtr->flags & WM_VROOT_OFFSET_STALE) {
@@ -4132,18 +4097,17 @@ Tk_GetVRootGeometry(
*
* Tk_MoveToplevelWindow --
*
- * This procedure is called instead of Tk_MoveWindow to adjust
- * the x-y location of a top-level window. It delays the actual
- * move to a later time and keeps window-manager information
- * up-to-date with the move
+ * This procedure is called instead of Tk_MoveWindow to adjust the x-y
+ * location of a top-level window. It delays the actual move to a later
+ * time and keeps window-manager information up-to-date with the move.
*
* Results:
* None.
*
* Side effects:
* The window is eventually moved so that its upper-left corner
- * (actually, the upper-left corner of the window's decorative
- * frame, if there is one) is at (x,y).
+ * (actually, the upper-left corner of the window's decorative frame, if
+ * there is one) is at (x,y).
*
*----------------------------------------------------------------------
*/
@@ -4151,8 +4115,7 @@ Tk_GetVRootGeometry(
void
Tk_MoveToplevelWindow(
Tk_Window tkwin, /* Window to move. */
- int x, int y) /* New location for window (within
- * parent). */
+ int x, int y) /* New location for window (within parent). */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4171,16 +4134,15 @@ Tk_MoveToplevelWindow(
/*
* If the window has already been mapped, must bring its geometry
- * up-to-date immediately, otherwise an event might arrive from the
- * server that would overwrite wmPtr->x and wmPtr->y and lose the
- * new position.
+ * up-to-date immediately, otherwise an event might arrive from the server
+ * that would overwrite wmPtr->x and wmPtr->y and lose the new position.
*/
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
}
}
@@ -4195,9 +4157,9 @@ Tk_MoveToplevelWindow(
* None.
*
* Side effects:
- * WinPtr gets restacked as specified by aboveBelow and otherPtr.
- * This procedure doesn't return until the restack has taken
- * effect and the ConfigureNotify event for it has been received.
+ * WinPtr gets restacked as specified by aboveBelow and otherPtr. This
+ * procedure doesn't return until the restack has taken effect and the
+ * ConfigureNotify event for it has been received.
*
*----------------------------------------------------------------------
*/
@@ -4207,9 +4169,9 @@ TkWmRestackToplevel(
TkWindow *winPtr, /* Window to restack. */
int aboveBelow, /* Gives relative position for restacking;
* must be Above or Below. */
- TkWindow *otherPtr) /* Window relative to which to restack;
- * if NULL, then winPtr gets restacked
- * above or below *all* siblings. */
+ TkWindow *otherPtr) /* Window relative to which to restack; if
+ * NULL, then winPtr gets restacked above or
+ * below *all* siblings. */
{
WmInfo *wmPtr;
@@ -4220,15 +4182,15 @@ TkWmRestackToplevel(
/*
* Get the mac window. Make sure it exists & is mapped.
*/
+
if (winPtr->window == None) {
Tk_MakeWindowExist((Tk_Window) winPtr);
}
if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
-
/*
- * Can't set stacking order properly until the window is on the
- * screen (mapping it may give it a reparent window), so make sure
- * it's on the screen.
+ * Can't set stacking order properly until the window is on the screen
+ * (mapping it may give it a reparent window), so make sure it's on
+ * the screen.
*/
TkWmMapWindow(winPtr);
@@ -4238,6 +4200,7 @@ TkWmRestackToplevel(
/*
* Get the window in which a raise or lower is in relation to.
*/
+
if (otherPtr != NULL) {
if (otherPtr->window == None) {
Tk_MakeWindowExist((Tk_Window) otherPtr);
@@ -4259,8 +4222,8 @@ TkWmRestackToplevel(
*/
} else if (otherMacWindow == frontWindow || otherMacWindow == NULL) {
/*
- * Raise the window to the top. If the window is visible then
- * we also make it the active window.
+ * Raise the window to the top. If the window is visible then we
+ * also make it the active window.
*/
if (wmPtr->hints.initial_state == WithdrawnState) {
@@ -4303,27 +4266,26 @@ TkWmRestackToplevel(
* TkWmAddToColormapWindows --
*
* This procedure is called to add a given window to the
- * WM_COLORMAP_WINDOWS property for its top-level, if it
- * isn't already there. It is invoked by the Tk code that
- * creates a new colormap, in order to make sure that colormap
- * information is propagated to the window manager by default.
+ * WM_COLORMAP_WINDOWS property for its top-level, if it isn't already
+ * there. It is invoked by the Tk code that creates a new colormap, in
+ * order to make sure that colormap information is propagated to the
+ * window manager by default.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets added to the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * colormaps have been set explicitly with the
- * "wm colormapwindows" command.
+ * WinPtr's window gets added to the WM_COLORMAP_WINDOWS property of its
+ * nearest top-level ancestor, unless the colormaps have been set
+ * explicitly with the "wm colormapwindows" command.
*
*----------------------------------------------------------------------
*/
void
TkWmAddToColormapWindows(
- TkWindow *winPtr) /* Window with a non-default colormap.
- * Should not be a top-level window. */
+ TkWindow *winPtr) /* Window with a non-default colormap. Should
+ * not be a top-level window. */
{
TkWindow *topPtr;
TkWindow **oldPtr, **newPtr;
@@ -4363,14 +4325,13 @@ TkWmAddToColormapWindows(
}
/*
- * Make a new bigger array and use it to reset the property.
- * Automatically add the toplevel itself as the last element
- * of the list.
+ * Make a new bigger array and use it to reset the property. Automatically
+ * add the toplevel itself as the last element of the list.
*/
- newPtr = (TkWindow **) ckalloc((unsigned) ((count+2)*sizeof(TkWindow*)));
+ newPtr = (TkWindow **) ckalloc((unsigned) (count+2)*sizeof(TkWindow *));
if (count > 0) {
- memcpy(newPtr, oldPtr, count * sizeof(TkWindow*));
+ memcpy(newPtr, oldPtr, count * sizeof(TkWindow *));
}
if (count == 0) {
count++;
@@ -4385,9 +4346,8 @@ TkWmAddToColormapWindows(
topPtr->wmInfoPtr->cmapCount = count+1;
/*
- * On the Macintosh all of this is just an excercise
- * in compatability as we don't support colormaps. If
- * we did they would be installed here.
+ * On the Macintosh all of this is just an excercise in compatability as
+ * we don't support colormaps. If we did they would be installed here.
*/
}
@@ -4397,16 +4357,16 @@ TkWmAddToColormapWindows(
* TkWmRemoveFromColormapWindows --
*
* This procedure is called to remove a given window from the
- * WM_COLORMAP_WINDOWS property for its top-level. It is invoked
- * when windows are deleted.
+ * WM_COLORMAP_WINDOWS property for its top-level. It is invoked when
+ * windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * top-level itself is being deleted too.
+ * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS property of
+ * its nearest top-level ancestor, unless the top-level itself is being
+ * deleted too.
*
*----------------------------------------------------------------------
*/
@@ -4424,8 +4384,8 @@ TkWmRemoveFromColormapWindows(
for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
if (topPtr == NULL) {
/*
- * Ancestors have been deleted, so skip the whole operation.
- * Seems like this can't ever happen?
+ * Ancestors have been deleted, so skip the whole operation. Seems
+ * like this can't ever happen?
*/
return;
@@ -4436,16 +4396,15 @@ TkWmRemoveFromColormapWindows(
}
if (topPtr->flags & TK_ALREADY_DEAD) {
/*
- * Top-level is being deleted, so there's no need to cleanup
- * the WM_COLORMAP_WINDOWS property.
+ * Top-level is being deleted, so there's no need to cleanup the
+ * WM_COLORMAP_WINDOWS property.
*/
return;
}
/*
- * Find the window and slide the following ones down to cover
- * it up.
+ * Find the window and slide the following ones down to cover it up.
*/
count = topPtr->wmInfoPtr->cmapCount;
@@ -4469,10 +4428,10 @@ TkWmRemoveFromColormapWindows(
* Fetch the position of the mouse pointer.
*
* Results:
- * *xPtr and *yPtr are filled in with the (virtual) root coordinates
- * of the mouse pointer for tkwin's display. If the pointer isn't
- * on tkwin's screen, then -1 values are returned for both
- * coordinates. The argument tkwin must be a toplevel window.
+ * *xPtr and *yPtr are filled in with the (virtual) root coordinates of
+ * the mouse pointer for tkwin's display. If the pointer isn't on tkwin's
+ * screen, then -1 values are returned for both coordinates. The argument
+ * tkwin must be a toplevel window.
*
* Side effects:
* None.
@@ -4482,8 +4441,8 @@ TkWmRemoveFromColormapWindows(
void
TkGetPointerCoords(
- Tk_Window tkwin, /* Toplevel window that identifies screen
- * on which lookup is to be done. */
+ Tk_Window tkwin, /* Toplevel window that identifies screen on
+ * which lookup is to be done. */
int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
XQueryPointer(NULL, None, NULL, NULL, xPtr, yPtr, NULL, NULL, NULL);
@@ -4494,10 +4453,10 @@ TkGetPointerCoords(
*
* InitialWindowBounds --
*
- * This function calculates the initial bounds for a new Mac
- * toplevel window. Unless the geometry is specified by the user
- * this code will auto place the windows in a cascade diagonially
- * across the main monitor of the Mac.
+ * This function calculates the initial bounds for a new Mac toplevel
+ * window. Unless the geometry is specified by the user this code will
+ * auto place the windows in a cascade diagonially across the main
+ * monitor of the Mac.
*
* Results:
* The bounds are returned in geometry.
@@ -4553,9 +4512,9 @@ InitialWindowBounds(
*
* TkMacOSXResizable --
*
- * This function determines if the passed in window is part of
- * a toplevel window that is resizable. If the window is
- * resizable in the x, y or both directions, true is returned.
+ * This function determines if the passed in window is part of a toplevel
+ * window that is resizable. If the window is resizable in the x, y or
+ * both directions, true is returned.
*
* Results:
* True if resizable, false otherwise.
@@ -4593,10 +4552,10 @@ TkMacOSXResizable(
*
* TkMacOSXGrowToplevel --
*
- * The function is invoked when the user clicks in the grow region
- * of a Tk window. The function will handle the dragging
- * procedure and not return until completed. Finally, the function
- * may place information Tk's event queue is the window was resized.
+ * The function is invoked when the user clicks in the grow region of a
+ * Tk window. The function will handle the dragging procedure and not
+ * return until completed. Finally, the function may place information
+ * Tk's event queue is the window was resized.
*
* Results:
* True if events were placed on event queue, false otherwise.
@@ -4715,8 +4674,8 @@ TkMacOSXGrowToplevel(
*
* TkSetWMName --
*
- * Set the title for a toplevel window. If the window is embedded,
- * do not change the window title.
+ * Set the title for a toplevel window. If the window is embedded, do not
+ * change the window title.
*
* Results:
* None.
@@ -4738,7 +4697,7 @@ TkSetWMName(
return;
}
- title = CFStringCreateWithBytes(NULL, (const unsigned char*) titleUid,
+ title = CFStringCreateWithBytes(NULL, (const unsigned char *) titleUid,
strlen(titleUid), kCFStringEncodingUTF8, false);
if (title) {
WindowRef macWin = TkMacOSXDrawableWindow(winPtr->window);
@@ -4753,8 +4712,8 @@ TkSetWMName(
*
* TkGetTransientMaster --
*
- * If the passed window has the TRANSIENT_FOR property set this
- * will return the master window. Otherwise it will return None.
+ * If the passed window has the TRANSIENT_FOR property set this will
+ * return the master window. Otherwise it will return None.
*
* Results:
* The master window or None.
@@ -4812,10 +4771,9 @@ TkMacOSXGetXWindow(
*
* TkMacOSXIsWindowZoomed --
*
- * Ask Carbon if the given window is in the zoomed out state.
- * Because dragging & growing a window can change the Carbon
- * zoom state, we cannot rely on wmInfoPtr->hints.initial_state
- * for this information.
+ * Ask Carbon if the given window is in the zoomed out state. Because
+ * dragging & growing a window can change the Carbon zoom state, we
+ * cannot rely on wmInfoPtr->hints.initial_state for this information.
*
* Results:
* True if window is zoomed out, false otherwise.
@@ -4872,11 +4830,10 @@ TkMacOSXIsWindowZoomed(
*
* TkMacOSXZoomToplevel --
*
- * The function is invoked when the user clicks in the zoom region
- * of a Tk window or when the window state is set/unset to "zoomed"
- * manually. If the window is to be zoomed (in or out), the window
- * size is changed and events are generated to let Tk know what
- * happened.
+ * The function is invoked when the user clicks in the zoom region of a
+ * Tk window or when the window state is set/unset to "zoomed" manually.
+ * If the window is to be zoomed (in or out), the window size is changed
+ * and events are generated to let Tk know what happened.
*
* Results:
* True if events were placed on event queue, false otherwise.
@@ -4941,13 +4898,12 @@ TkMacOSXZoomToplevel(
}
err = ChkErr(ZoomWindowIdeal, whichWindow, zoomPart, &idealSize);
- if (err == noErr) {
- wmPtr->hints.initial_state =
- (zoomPart == inZoomIn ? NormalState : ZoomState);
- return true;
- } else {
+ if (err != noErr) {
return false;
}
+ wmPtr->hints.initial_state =
+ (zoomPart == inZoomIn ? NormalState : ZoomState);
+ return true;
}
/*
@@ -4956,9 +4912,8 @@ TkMacOSXZoomToplevel(
* TkUnsupported1Cmd --
*
* This procedure is invoked to process the
- * "::tk::unsupported::MacWindowStyle" Tcl command.
- * This command allows you to set the style of decoration
- * for a Macintosh window.
+ * "::tk::unsupported::MacWindowStyle" Tcl command. This command allows
+ * you to set the style of decoration for a Macintosh window.
*
* Results:
* A standard Tcl result.
@@ -4972,11 +4927,10 @@ TkMacOSXZoomToplevel(
/* ARGSUSED */
int
TkUnsupported1ObjCmd(
- ClientData clientData, /* Main window associated with
- * interpreter. */
+ ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj * const objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *subcmds[] = {
"style", NULL
@@ -4984,7 +4938,7 @@ TkUnsupported1ObjCmd(
enum SubCmds {
TKMWS_STYLE
};
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
TkWindow *winPtr;
int index;
@@ -4993,8 +4947,8 @@ TkUnsupported1ObjCmd(
return TCL_ERROR;
}
- winPtr = (TkWindow *) Tk_NameToWindow(interp,
- Tcl_GetString(objv[2]), tkwin);
+ winPtr = (TkWindow *)
+ Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
if (winPtr == NULL) {
return TCL_ERROR;
}
@@ -5026,9 +4980,8 @@ TkUnsupported1ObjCmd(
* WmWinStyle --
*
* This procedure is invoked to process the
- * "::tk::unsupported::MacWindowStyle style" subcommand.
- * This command allows you to set the style of decoration
- * for a Macintosh window.
+ * "::tk::unsupported::MacWindowStyle style" subcommand. This command
+ * allows you to set the style of decoration for a Macintosh window.
*
* Results:
* A standard Tcl result.
@@ -5038,6 +4991,7 @@ TkUnsupported1ObjCmd(
*
*----------------------------------------------------------------------
*/
+
static int
WmWinStyle(
Tcl_Interp *interp, /* Current interpreter. */
@@ -5126,7 +5080,7 @@ WmWinStyle(
if (objc == 3) {
if (wmPtr->style != -1) {
for (i = 0; styleMap[i].strValue != NULL; i++) {
- if (wmPtr->style == (short)(styleMap[i].intValue)) {
+ if (wmPtr->style == (short) styleMap[i].intValue) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj(styleMap[i].strValue, -1));
return TCL_OK;
@@ -5227,8 +5181,8 @@ WmWinStyle(
*
* TkpMakeMenuWindow --
*
- * Configure the window to be either a undecorated pull-down
- * (or pop-up) menu, or as a toplevel floating menu (palette).
+ * Configure the window to be either a undecorated pull-down (or pop-up)
+ * menu, or as a toplevel floating menu (palette).
*
* Results:
* None.
@@ -5242,10 +5196,10 @@ WmWinStyle(
void
TkpMakeMenuWindow(
Tk_Window tkwin, /* New window. */
- int transient) /* 1 means menu is only posted briefly as
- * a popup or pulldown or cascade. 0 means
- * menu is always visible, e.g. as a
- * floating menu. */
+ int transient) /* 1 means menu is only posted briefly as a
+ * popup or pulldown or cascade. 0 means menu
+ * is always visible, e.g. as a floating
+ * menu. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -5265,8 +5219,8 @@ TkpMakeMenuWindow(
*
* TkMacOSXMakeRealWindowExist --
*
- * This function finally creates the real Macintosh window that
- * the Mac actually understands.
+ * This function finally creates the real Macintosh window that the Mac
+ * actually understands.
*
* Results:
* None.
@@ -5416,8 +5370,8 @@ TkMacOSXMakeRealWindowExist(
*
* TkMacOSXRegisterOffScreenWindow --
*
- * This function adds the passed in Off Screen Port to the
- * hash table that maps Mac windows to root X windows.
+ * This function adds the passed in Off Screen Port to the hash table
+ * that maps Mac windows to root X windows.
*
* Results:
* None.
@@ -5452,9 +5406,8 @@ TkMacOSXRegisterOffScreenWindow(
*
* TkMacOSXUnregisterMacWindow --
*
- * Given a macintosh port window, this function removes the
- * association between this window and the root X window that
- * Tk cares about.
+ * Given a macintosh port window, this function removes the association
+ * between this window and the root X window that Tk cares about.
*
* Results:
* None.
@@ -5487,9 +5440,8 @@ TkMacOSXUnregisterMacWindow(
*
* TkMacOSXSetScrollbarGrow --
*
- * Sets a flag for a toplevel window indicating that the passed
- * Tk scrollbar window will display the grow region for the
- * toplevel window.
+ * Sets a flag for a toplevel window indicating that the passed Tk
+ * scrollbar window will display the grow region for the toplevel window.
*
* Results:
* None.
@@ -5521,15 +5473,15 @@ TkMacOSXSetScrollbarGrow(
* TkWmFocusToplevel --
*
* This is a utility procedure invoked by focus-management code. It
- * exists because of the extra wrapper windows that exist under
- * Unix; its job is to map from wrapper windows to the
- * corresponding toplevel windows. On PCs and Macs there are no
- * wrapper windows so no mapping is necessary; this procedure just
- * determines whether a window is a toplevel or not.
+ * exists because of the extra wrapper windows that exist under Unix; its
+ * job is to map from wrapper windows to the corresponding toplevel
+ * windows. On PCs and Macs there are no wrapper windows so no mapping is
+ * necessary; this procedure just determines whether a window is a
+ * toplevel or not.
*
* Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
*
* Side effects:
* None.
@@ -5553,13 +5505,13 @@ TkWmFocusToplevel(
*
* TkpGetWrapperWindow --
*
- * This is a utility procedure invoked by focus-management code. It
- * maps to the wrapper for a top-level, which is just the same
- * as the top-level on Macs and PCs.
+ * This is a utility procedure invoked by focus-management code. It maps
+ * to the wrapper for a top-level, which is just the same as the
+ * top-level on Macs and PCs.
*
* Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
*
* Side effects:
* None.
@@ -5583,8 +5535,8 @@ TkpGetWrapperWindow(
*
* TkpWmSetState --
*
- * Sets the window manager state for the wrapper window of a
- * given toplevel window.
+ * Sets the window manager state for the wrapper window of a given
+ * toplevel window.
*
* Results:
* None.
@@ -5596,9 +5548,9 @@ TkpGetWrapperWindow(
*/
void
-TkpWmSetState(winPtr, state)
- TkWindow *winPtr; /* Toplevel window to operate on. */
- int state; /* One of IconicState, ZoomState, NormalState,
+TkpWmSetState(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int state) /* One of IconicState, ZoomState, NormalState,
* or WithdrawnState. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5615,9 +5567,10 @@ TkpWmSetState(winPtr, state)
Tk_UnmapWindow((Tk_Window) winPtr);
} else if (state == IconicState) {
/*
- * The window always gets unmapped. If we can show the
- * icon version of the window we also collapse it.
+ * The window always gets unmapped. If we can show the icon version of
+ * the window we also collapse it.
*/
+
if (IsWindowCollapsable(macWin) && !IsWindowCollapsed(macWin)) {
CollapseWindow(macWin, true);
}
@@ -5695,9 +5648,9 @@ TkMacOSXWindowClass(
*
* TkMacOSXWindowOffset --
*
- * Determines the x and y offset from the orgin of the toplevel
- * window dressing (the structure region, ie. title bar) and the
- * orgin of the content area.
+ * Determines the x and y offset from the orgin of the toplevel window
+ * dressing (the structure region, i.e. title bar) and the orgin of the
+ * content area.
*
* Results:
* The x & y offset in pixels.
@@ -5730,8 +5683,8 @@ TkMacOSXWindowOffset(
*
* TkpGetMS --
*
- * Return a relative time in milliseconds. It doesn't matter
- * when the epoch was.
+ * Return a relative time in milliseconds. It doesn't matter when the
+ * epoch was.
*
* Results:
* Number of milliseconds.
@@ -5784,15 +5737,14 @@ XSetInputFocus(
*
* TkpChangeFocus --
*
- * This procedure is a stub on the Mac because we always own the
- * focus if we are a front most application.
+ * This procedure is a stub on the Mac because we always own the focus if
+ * we are a front most application.
*
* Results:
- * The return value is the serial number of the command that
- * changed the focus. It may be needed by the caller to filter
- * out focus change events that were queued before the command.
- * If the procedure doesn't actually change the focus then
- * it returns 0.
+ * The return value is the serial number of the command that changed the
+ * focus. It may be needed by the caller to filter out focus change
+ * events that were queued before the command. If the procedure doesn't
+ * actually change the focus then it returns 0.
*
* Side effects:
* None.
@@ -5801,15 +5753,15 @@ XSetInputFocus(
*/
int
-TkpChangeFocus(winPtr, force)
- TkWindow *winPtr; /* Window that is to receive the X focus. */
- int force; /* Non-zero means claim the focus even
- * if it didn't originally belong to
- * topLevelPtr's application. */
+TkpChangeFocus(
+ TkWindow *winPtr, /* Window that is to receive the X focus. */
+ int force) /* Non-zero means claim the focus even if it
+ * didn't originally belong to topLevelPtr's
+ * application. */
{
/*
- * We don't really need to do anything on the Mac. Tk will
- * keep all this state for us.
+ * We don't really need to do anything on the Mac. Tk will keep all this
+ * state for us.
*/
if (winPtr->atts.override_redirect) {
@@ -5817,10 +5769,10 @@ TkpChangeFocus(winPtr, force)
}
/*
- * Remember the current serial number for the X server and issue
- * a dummy server request. This marks the position at which we
- * changed the focus, so we can distinguish FocusIn and FocusOut
- * events on either side of the mark.
+ * Remember the current serial number for the X server and issue a dummy
+ * server request. This marks the position at which we changed the focus,
+ * so we can distinguish FocusIn and FocusOut events on either side of the
+ * mark.
*/
return NextRequest(winPtr->display);
@@ -5831,13 +5783,12 @@ TkpChangeFocus(winPtr, force)
*
* WmStackorderToplevelWrapperMap --
*
- * This procedure will create a table that maps the reparent wrapper
- * X id for a toplevel to the TkWindow structure that is wraps.
- * Tk keeps track of a mapping from the window X id to the TkWindow
- * structure but that does us no good here since we only get the X
- * id of the wrapper window. Only those toplevel windows that are
- * mapped have a position in the stacking order.
- *
+ * This procedure will create a table that maps the reparent wrapper X id
+ * for a toplevel to the TkWindow structure that is wraps. Tk keeps track
+ * of a mapping from the window X id to the TkWindow structure but that
+ * does us no good here since we only get the X id of the wrapper window.
+ * Only those toplevel windows that are mapped have a position in the
+ * stacking order.
*
* Results:
* None.
@@ -5864,7 +5815,7 @@ WmStackorderToplevelWrapperMap(
macWindow = TkMacOSXDrawableWindow(winPtr->window);
hPtr = Tcl_CreateHashEntry(table,
- (const char *) macWindow, &newEntry);
+ (const char *) macWindow, &newEntry);
Tcl_SetHashValue(hPtr, winPtr);
}
@@ -5882,8 +5833,8 @@ WmStackorderToplevelWrapperMap(
* This procedure returns the stack order of toplevel windows.
*
* Results:
- * An array of pointers to tk window objects in stacking order
- * or else NULL if there was an error.
+ * An array of pointers to tk window objects in stacking order or else
+ * NULL if there was an error.
*
* Side effects:
* None.
@@ -5892,8 +5843,8 @@ WmStackorderToplevelWrapperMap(
*/
TkWindow **
-TkWmStackorderToplevel(parentPtr)
- TkWindow *parentPtr; /* Parent toplevel window. */
+TkWmStackorderToplevel(
+ TkWindow *parentPtr) /* Parent toplevel window. */
{
WindowRef frontWindow;
TkWindow *childWinPtr, **windows, **window_ptr;
@@ -5908,12 +5859,12 @@ TkWmStackorderToplevel(parentPtr)
Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
- windows = (TkWindow **) ckalloc((table.numEntries+1)
- * sizeof(TkWindow *));
+ windows = (TkWindow **)
+ ckalloc((table.numEntries+1) * sizeof(TkWindow *));
/*
- * Special cases: If zero or one toplevels were mapped
- * there is no need to enumerate Windows.
+ * Special cases: If zero or one toplevels were mapped there is no need to
+ * enumerate Windows.
*/
switch (table.numEntries) {
@@ -5922,7 +5873,7 @@ TkWmStackorderToplevel(parentPtr)
goto done;
case 1:
hPtr = Tcl_FirstHashEntry(&table, &search);
- windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
+ windows[0] = Tcl_GetHashValue(hPtr);
windows[1] = NULL;
goto done;
}
@@ -5934,20 +5885,21 @@ TkWmStackorderToplevel(parentPtr)
} else {
window_ptr = windows + table.numEntries;
*window_ptr-- = NULL;
- while (frontWindow != NULL) {
- hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
- if (hPtr != NULL) {
- childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
- *window_ptr-- = childWinPtr;
- }
- frontWindow = GetNextWindow(frontWindow);
+ while (frontWindow != NULL) {
+ hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
+ if (hPtr != NULL) {
+ childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
+ *window_ptr-- = childWinPtr;
}
- if (window_ptr != (windows-1))
+ frontWindow = GetNextWindow(frontWindow);
+ }
+ if (window_ptr != (windows-1)) {
Tcl_Panic("num matched toplevel windows does not equal num "
"children");
+ }
}
- done:
+ done:
Tcl_DeleteHashTable(&table);
return windows;
}
@@ -6024,7 +5976,7 @@ ApplyWindowClassAttributeChanges(
}
}
TkMacOSXInvalClipRgns((Tk_Window) winPtr);
- TkMacOSXInvalidateWindow((MacDrawable *)(winPtr->window),
+ TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window,
TK_PARENT_WINDOW);
}
@@ -6032,6 +5984,7 @@ ApplyWindowClassAttributeChanges(
* The change of window class/attributes might have changed the window
* structure widths:
*/
+
GetWindowStructureWidths(macWindow, &strWidths);
wmPtr->xInParent = strWidths.left;
wmPtr->yInParent = strWidths.top;
@@ -6094,7 +6047,7 @@ ApplyMasterOverrideChanges(
WindowGroupRef group;
ApplyWindowClassAttributeChanges(winPtr, macWindow, oldClass,
- oldAttributes, 0);
+ oldAttributes, 0);
if (winPtr->atts.override_redirect && wmPtr->master != None) {
wmPtr->flags |= WM_TOPMOST;
@@ -6135,8 +6088,8 @@ WmGetWindowGroup(
group = GetWindowGroupOfClass(kUtilityWindowClass);
} else if (wmPtr->master != None) {
TkDisplay *dispPtr = TkGetDisplayList();
- TkWindow *masterWinPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display,
- wmPtr->master);
+ TkWindow *masterWinPtr = (TkWindow *)
+ Tk_IdToWindow(dispPtr->display, wmPtr->master);
if (masterWinPtr && masterWinPtr->window != None &&
TkMacOSXHostToplevelExists(masterWinPtr)) {
@@ -6191,9 +6144,11 @@ TkMacOSXMakeFullscreen(
if (fullscreen) {
int screenWidth = WidthOfScreen(Tk_Screen(winPtr));
int screenHeight = HeightOfScreen(Tk_Screen(winPtr));
+
/*
* Check max width and height if set by the user.
*/
+
if ((wmPtr->maxWidth > 0 && wmPtr->maxWidth < screenWidth)
|| (wmPtr->maxHeight > 0 && wmPtr->maxHeight < screenHeight)) {
if (interp) {
@@ -6298,8 +6253,8 @@ TkMacOSXEnterExitFullscreen(
*
* GetMinSize --
*
- * This function computes the current minWidth and minHeight values for
- * a window, taking into account the possibility that they may be
+ * This function computes the current minWidth and minHeight values for a
+ * window, taking into account the possibility that they may be
* defaulted.
*
* Results:
@@ -6333,41 +6288,43 @@ GetMinSize(
*/
switch (wmPtr->macClass) {
- case kDocumentWindowClass:
- case kMovableAlertWindowClass:
- case kMovableModalWindowClass:
- minWidth = 72;
- if (wmPtr->attributes & kWindowResizableAttribute) {
- minHeight = 15;
- }
- if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
- minWidth += 29;
- }
- break;
- case kFloatingWindowClass:
- case kUtilityWindowClass:
- minWidth = 59;
- if (wmPtr->attributes & kWindowResizableAttribute) {
- minHeight = 11;
- }
- if (wmPtr->attributes & kWindowSideTitlebarAttribute) {
- int tmp = minWidth;
- minWidth = minHeight;
- minHeight = tmp;
- } else if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
- minWidth += 29;
- }
- break;
- default:
- if (wmPtr->attributes & kWindowResizableAttribute) {
- minWidth = 15;
- minHeight = 15;
- }
- break;
+ case kDocumentWindowClass:
+ case kMovableAlertWindowClass:
+ case kMovableModalWindowClass:
+ minWidth = 72;
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minHeight = 15;
+ }
+ if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
+ minWidth += 29;
+ }
+ break;
+ case kFloatingWindowClass:
+ case kUtilityWindowClass:
+ minWidth = 59;
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minHeight = 11;
+ }
+ if (wmPtr->attributes & kWindowSideTitlebarAttribute) {
+ int tmp = minWidth;
+
+ minWidth = minHeight;
+ minHeight = tmp;
+ } else if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
+ minWidth += 29;
+ }
+ break;
+ default:
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minWidth = 15;
+ minHeight = 15;
+ }
+ break;
}
if (wmPtr->gridWin != NULL) {
int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc);
+
if (base < 0) {
base = 0;
}
@@ -6393,8 +6350,8 @@ GetMinSize(
*
* GetMaxSize --
*
- * This function computes the current maxWidth and maxHeight values for
- * a window, taking into account the possibility that they may be
+ * This function computes the current maxWidth and maxHeight values for a
+ * window, taking into account the possibility that they may be
* defaulted.
*
* Results:
@@ -6424,6 +6381,7 @@ GetMaxSize(
*maxWidthPtr = wmPtr->maxWidth;
} else {
int maxWidth = maxBounds->right - maxBounds->left - wmPtr->xInParent;
+
if (wmPtr->gridWin != NULL) {
maxWidth = wmPtr->reqGridWidth
+ (maxWidth - winPtr->reqWidth)/wmPtr->widthInc;
@@ -6434,6 +6392,7 @@ GetMaxSize(
*maxHeightPtr = wmPtr->maxHeight;
} else {
int maxHeight = maxBounds->bottom - maxBounds->top - wmPtr->yInParent;
+
if (wmPtr->gridWin != NULL) {
maxHeight = wmPtr->reqGridHeight
+ (maxHeight - winPtr->reqHeight)/wmPtr->heightInc;
@@ -6441,15 +6400,13 @@ GetMaxSize(
*maxHeightPtr = maxHeight;
}
}
-#if 0
/*
*----------------------------------------------------------------------
*
* RemapWindows
*
- * Adjust parent/child relation ships of
- * the given window hierarchy.
+ * Adjust parent/child relation ships of the given window hierarchy.
*
* Results:
* none
@@ -6459,16 +6416,22 @@ GetMaxSize(
*
*----------------------------------------------------------------------
*/
+
static void
-RemapWindows(TkWindow *winPtr, MacDrawable *parentWin)
+RemapWindows(
+ TkWindow *winPtr,
+ MacDrawable *parentWin)
{
TkWindow *childPtr;
- /* Remove the OS specific window.
- * It will get rebuilt when the window gets Mapped.
+ /*
+ * Remove the OS specific window. It will get rebuilt when the window gets
+ * Mapped.
*/
+
if (winPtr->window != None) {
MacDrawable *macWin = (MacDrawable *) winPtr->window;
+
macWin->grafPtr = NULL;
macWin->toplevel = parentWin->toplevel;
winPtr->flags &= ~TK_MAPPED;
@@ -6483,4 +6446,3 @@ RemapWindows(TkWindow *winPtr, MacDrawable *parentWin)
RemapWindows(childPtr, (MacDrawable *) winPtr->window);
}
}
-#endif
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 8bf57fa..a09501b 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -1,30 +1,28 @@
/*
* tkMacOSXXStubs.c --
*
- * This file contains most of the X calls called by Tk. Many of
- * these calls are just stubs and either don't make sense on the
- * Macintosh or thier implamentation just doesn't do anything. Other
- * calls will eventually be moved into other files.
+ * This file contains most of the X calls called by Tk. Many of these
+ * calls are just stubs and either don't make sense on the Macintosh or
+ * their implamentation just doesn't do anything. Other calls will
+ * eventually be moved into other files.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkMacOSXPrivate.h"
#include "tkMacOSXEvent.h"
-#if 0
#include <IOKit/IOKitLib.h>
-#endif
/*
* Because this file is still under major development Debugger statements are
- * used through out this file. The define TCL_DEBUG will decide whether
- * the debugger statements actually call the debugger or not.
+ * used through out this file. The define TCL_DEBUG will decide whether the
+ * debugger statements actually call the debugger or not.
*/
#ifndef TCL_DEBUG
@@ -37,29 +35,32 @@
* Declarations of static variables used in this file.
*/
-static TkDisplay *gMacDisplay = NULL; /* Macintosh display. */
-static const char *macScreenName = ":0"; /* Default name of macintosh display. */
+static TkDisplay *gMacDisplay = NULL;
+ /* Macintosh display. */
+static const char *macScreenName = ":0";
+ /* Default name of macintosh display. */
/*
* Forward declarations of procedures used in this file.
*/
-static XID MacXIdAlloc(Display *display);
-static int DefaultErrorHandler(Display* display, XErrorEvent* err_evt);
+static XID MacXIdAlloc(Display *display);
+static int DefaultErrorHandler(Display *display,
+ XErrorEvent *err_evt);
/*
* Other declarations
*/
-static int DestroyImage(XImage *image);
-static unsigned long ImageGetPixel(XImage *image, int x, int y);
-static int PutPixel(XImage *image, int x, int y, unsigned long pixel);
+static int DestroyImage(XImage *image);
+static unsigned long ImageGetPixel(XImage *image, int x, int y);
+static int PutPixel(XImage *image, int x, int y,
+ unsigned long pixel);
#if 0
-static XImage *SubImage(XImage *image, int x, int y,
- unsigned int width, unsigned int height);
-static int AddPixel(XImage *image, long value);
+static XImage * SubImage(XImage *image, int x, int y,
+ unsigned int width, unsigned int height);
+static int AddPixel(XImage *image, long value);
#endif
-
/*
*----------------------------------------------------------------------
@@ -79,7 +80,8 @@ static int AddPixel(XImage *image, long value);
*/
void
-TkMacOSXDisplayChanged(Display *display)
+TkMacOSXDisplayChanged(
+ Display *display)
{
GDHandle graphicsDevice;
Screen *screen;
@@ -91,17 +93,17 @@ TkMacOSXDisplayChanged(Display *display)
screen = display->screens;
graphicsDevice = GetMainDevice();
- screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
- (*(*graphicsDevice)->gdPMap)->cmpCount;
- screen->height = (*graphicsDevice)->gdRect.bottom -
- (*graphicsDevice)->gdRect.top;
- screen->width = (*graphicsDevice)->gdRect.right -
- (*graphicsDevice)->gdRect.left;
+ screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
+ (*(*graphicsDevice)->gdPMap)->cmpCount;
+ screen->height = (*graphicsDevice)->gdRect.bottom -
+ (*graphicsDevice)->gdRect.top;
+ screen->width = (*graphicsDevice)->gdRect.right -
+ (*graphicsDevice)->gdRect.left;
- screen->mwidth = (screen->width * 254 + 360) / 720;
- screen->mheight = (screen->height * 254 + 360) / 720;
+ screen->mwidth = (screen->width * 254 + 360) / 720;
+ screen->mheight = (screen->height * 254 + 360) / 720;
- maxBounds = (Rect*) screen->ext_data;
+ maxBounds = (Rect *) screen->ext_data;
*maxBounds = bounds;
graphicsDevice = GetDeviceList();
while (graphicsDevice) {
@@ -121,8 +123,8 @@ TkMacOSXDisplayChanged(Display *display)
*
* TkpOpenDisplay --
*
- * Create the Display structure and fill it with device
- * specific information.
+ * Create the Display structure and fill it with device specific
+ * information.
*
* Results:
* Returns a Display structure on success or NULL on failure.
@@ -162,13 +164,13 @@ TkpOpenDisplay(
display->screens = screen;
display->nscreens = 1;
display->default_screen = 0;
- display->display_name = (char*)macScreenName;
+ display->display_name = (char *) macScreenName;
- Gestalt(gestaltQuickdrawVersion, (long*)&display->proto_minor_version);
+ Gestalt(gestaltQuickdrawVersion, (long *) &display->proto_minor_version);
display->proto_major_version = 10;
display->proto_minor_version -= gestaltMacOSXQD;
display->vendor = "Apple";
- Gestalt(gestaltSystemVersion, (long*)&display->release);
+ Gestalt(gestaltSystemVersion, (long *) &display->release);
/*
* These screen bits never change
@@ -177,7 +179,7 @@ TkpOpenDisplay(
screen->display = display;
screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24;
screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24;
- screen->ext_data = (XExtData*) &maxBounds;
+ screen->ext_data = (XExtData *) &maxBounds;
screen->root_visual = (Visual *) ckalloc(sizeof(Visual));
screen->root_visual->visualid = 0;
@@ -191,13 +193,14 @@ TkpOpenDisplay(
/*
* Initialize screen bits that may change
*/
+
TkMacOSXDisplayChanged(display);
gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay));
/*
- * This is the quickest way to make sure that all the *Init
- * flags get properly initialized
+ * This is the quickest way to make sure that all the *Init flags get
+ * properly initialized
*/
bzero(gMacDisplay, sizeof(TkDisplay));
@@ -226,13 +229,14 @@ TkpCloseDisplay(
TkDisplay *displayPtr)
{
Display *display = displayPtr->display;
+
if (gMacDisplay != displayPtr) {
Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
}
gMacDisplay = NULL;
- if (display->screens != (Screen *) NULL) {
- if (display->screens->root_visual != (Visual *) NULL) {
+ if (display->screens != NULL) {
+ if (display->screens->root_visual != NULL) {
ckfree((char *) display->screens->root_visual);
}
ckfree((char *) display->screens);
@@ -245,11 +249,10 @@ TkpCloseDisplay(
*
* TkClipCleanup --
*
- * This procedure is called to cleanup resources associated with
- * claiming clipboard ownership and for receiving selection get
- * results. This function is called in tkWindow.c. This has to be
- * called by the display cleanup function because we still need the
- * access display elements.
+ * This procedure is called to cleanup resources associated with claiming
+ * clipboard ownership and for receiving selection get results. This
+ * function is called in tkWindow.c. This has to be called by the display
+ * cleanup function because we still need the access display elements.
*
* Results:
* None.
@@ -261,12 +264,12 @@ TkpCloseDisplay(
*/
void
-TkClipCleanup(dispPtr)
- TkDisplay *dispPtr; /* display associated with clipboard */
+TkClipCleanup(
+ TkDisplay *dispPtr) /* display associated with clipboard */
{
/*
- * Make sure that the local scrap is transfered to the global
- * scrap if needed.
+ * Make sure that the local scrap is transfered to the global scrap if
+ * needed.
*/
TkSuspendClipboard();
@@ -278,7 +281,7 @@ TkClipCleanup(dispPtr)
dispPtr->windowAtom);
Tk_DestroyWindow(dispPtr->clipWindow);
- Tcl_Release((ClientData) dispPtr->clipWindow);
+ Tcl_Release(dispPtr->clipWindow);
dispPtr->clipWindow = NULL;
}
}
@@ -288,31 +291,31 @@ TkClipCleanup(dispPtr)
*
* MacXIdAlloc --
*
- * This procedure is invoked by Xlib as the resource allocator
- * for a display.
+ * This procedure is invoked by Xlib as the resource allocator for a
+ * display.
*
* Results:
- * The return value is an X resource identifier that isn't currently
- * in use.
+ * The return value is an X resource identifier that isn't currently in
+ * use.
*
* Side effects:
- * The identifier is removed from the stack of free identifiers,
- * if it was previously on the stack.
+ * The identifier is removed from the stack of free identifiers, if it
+ * was previously on the stack.
*
*----------------------------------------------------------------------
*/
static XID
MacXIdAlloc(
- Display *display) /* Display for which to allocate. */
+ Display *display) /* Display for which to allocate. */
{
- static long int cur_id = 100;
- /*
- * Some special XIds are reserved
- * - this is why we start at 100
- */
+ static long int cur_id = 100;
+ /*
+ * Some special XIds are reserved
+ * - this is why we start at 100
+ */
- return ++cur_id;
+ return ++cur_id;
}
/*
@@ -347,8 +350,8 @@ TkpWindowWasRecentlyDeleted(
*
* DefaultErrorHandler --
*
- * This procedure is the default X error handler. Tk uses it's
- * own error handler so this call should never be called.
+ * This procedure is the default X error handler. Tk uses it's own error
+ * handler so this call should never be called.
*
* Results:
* None.
@@ -365,14 +368,14 @@ DefaultErrorHandler(
XErrorEvent* err_evt)
{
/*
- * This call should never be called. Tk replaces
- * it with its own error handler.
+ * This call should never be called. Tk replaces it with its own error
+ * handler.
*/
+
Tcl_Panic("Warning hit bogus error handler!");
return 0;
}
-
char *
XGetAtomName(
Display * display,
@@ -383,7 +386,8 @@ XGetAtomName(
}
int
-_XInitImageFuncPtrs(XImage *image)
+_XInitImageFuncPtrs(
+ XImage *image)
{
return 0;
}
@@ -396,24 +400,25 @@ XSetErrorHandler(
}
Window
-XRootWindow(Display *display, int screen_number)
+XRootWindow(
+ Display *display,
+ int screen_number)
{
display->request++;
return ROOT_ID;
}
int
-XGetGeometry(display, d, root_return, x_return, y_return, width_return,
- height_return, border_width_return, depth_return)
- Display* display;
- Drawable d;
- Window* root_return;
- int* x_return;
- int* y_return;
- unsigned int* width_return;
- unsigned int* height_return;
- unsigned int* border_width_return;
- unsigned int* depth_return;
+XGetGeometry(
+ Display *display,
+ Drawable d,
+ Window *root_return,
+ int *x_return,
+ int *y_return,
+ unsigned int *width_return,
+ unsigned int *height_return,
+ unsigned int *border_width_return,
+ unsigned int *depth_return)
{
TkWindow *winPtr = ((MacDrawable *) d)->winPtr;
@@ -488,8 +493,8 @@ XSizeHints *
XAllocSizeHints(void)
{
/*
- * Always return NULL. Tk code checks to see if NULL
- * is returned & does nothing if it is.
+ * Always return NULL. Tk code checks to see if NULL is returned & does
+ * nothing if it is.
*/
return NULL;
@@ -670,10 +675,11 @@ XForceScreenSaver(
int mode)
{
/*
- * This function is just a no-op. It is defined to
- * reset the screen saver. However, there is no real
- * way to do this on a Mac. Let me know if there is!
+ * This function is just a no-op. It is defined to reset the screen saver.
+ * However, there is no real way to do this on a Mac. Let me know if there
+ * is!
*/
+
display->request++;
}
@@ -727,9 +733,9 @@ XSetClipRectangles(
*
* TkGetServerInfo --
*
- * Given a window, this procedure returns information about
- * the window server for that window. This procedure provides
- * the guts of the "winfo server" command.
+ * Given a window, this procedure returns information about the window
+ * server for that window. This procedure provides the guts of the "winfo
+ * server" command.
*
* Results:
* None.
@@ -742,10 +748,10 @@ XSetClipRectangles(
void
TkGetServerInfo(
- Tcl_Interp *interp, /* The server information is returned in
- * this interpreter's result. */
- Tk_Window tkwin) /* Token for window; this selects a
- * particular display and server. */
+ Tcl_Interp *interp, /* The server information is returned in this
+ * interpreter's result. */
+ Tk_Window tkwin) /* Token for window; this selects a particular
+ * display and server. */
{
char buffer[8 + TCL_INTEGER_SPACE * 2];
char buffer2[TCL_INTEGER_SPACE];
@@ -880,11 +886,15 @@ XGetImage(
if (TkMacOSXGetDrawablePort(d)) {
if (format == ZPixmap) {
if (width > 0 && height > 0) {
- /* Tk_GetPixmap fails for zero width or height */
+ /*
+ * Tk_GetPixmap fails for zero width or height.
+ */
+
pixmap = Tk_GetPixmap(display, d, width, height, depth);
}
if (win) {
XGCValues values;
+
gc = Tk_GetGC(win, 0, &values);
} else {
gc = XCreateGC(display, pixmap, 0, NULL);
@@ -893,18 +903,22 @@ XGetImage(
XCopyArea(display, d, pixmap, gc, x, y, width, height, 0, 0);
}
imagePtr = XCreateImage(display, NULL, depth, format, offset,
- (char*)TkMacOSXGetDrawablePort(pixmap),
- width, height, bitmap_pad, bytes_per_line);
- /* Track Pixmap underlying the XImage in the unused obdata field *
- * so that we can treat XImages coming from XGetImage specially. */
+ (char *) TkMacOSXGetDrawablePort(pixmap),
+ width, height, bitmap_pad, bytes_per_line);
+
+ /*
+ * Track Pixmap underlying the XImage in the unused obdata field
+ * so that we can treat XImages coming from XGetImage specially.
+ */
+
imagePtr->obdata = (XPointer) pixmap;
if (!win) {
XFreeGC(display, gc);
}
} else {
TkpDisplayWarning(
- "XGetImage: only ZPixmap types are implemented",
- "XGetImage Failure");
+ "XGetImage: only ZPixmap types are implemented",
+ "XGetImage Failure");
}
}
return imagePtr;
@@ -968,11 +982,14 @@ ImageGetPixel(
RGBColor cPix;
unsigned long r, g, b, c;
- destPort = (CGrafPtr)image->data;
+ destPort = (CGrafPtr) image->data;
portChanged = QDSwapPort(destPort, &savePort);
GetCPixel(x, y, &cPix);
if (image->obdata) {
- /* Image from XGetImage, 16 bit color values */
+ /*
+ * Image from XGetImage, 16 bit color values.
+ */
+
r = (cPix . red) >> 8;
g = (cPix . green) >> 8;
b = (cPix . blue) >> 8;
@@ -1018,18 +1035,21 @@ PutPixel(
destPort = (CGrafPtr)image->data;
portChanged = QDSwapPort(destPort, &savePort);
- r = (pixel & image->red_mask)>>16;
- g = (pixel & image->green_mask)>>8;
- b = (pixel & image->blue_mask);
+ r = (pixel & image->red_mask)>>16;
+ g = (pixel & image->green_mask)>>8;
+ b = (pixel & image->blue_mask);
if (image->obdata) {
- /* Image from XGetImage, 16 bit color values */
- cPix . red = r << 8;
- cPix . green = g << 8;
- cPix . blue = b << 8;
+ /*
+ * Image from XGetImage, 16 bit color values.
+ */
+
+ cPix.red = r << 8;
+ cPix.green = g << 8;
+ cPix.blue = b << 8;
} else {
- cPix . red = r;
- cPix . green = g;
- cPix . blue = b;
+ cPix.red = r;
+ cPix.green = g;
+ cPix.blue = b;
}
SetCPixel(x, y, &cPix);
if (portChanged) {
@@ -1068,8 +1088,8 @@ AddPixel(
* XSetWindowBackgroundPixmap, XSetWindowBorder, XSetWindowBorderPixmap,
* XSetWindowBorderWidth, XSetWindowColormap
*
- * These functions are all no-ops. They all have equivilent
- * Tk calls that should always be used instead.
+ * These functions are all no-ops. They all have equivalent Tk calls that
+ * should always be used instead.
*
* Results:
* None.
@@ -1193,7 +1213,6 @@ TkGetDefaultScreenName(
#endif
return macScreenName;
}
-#if 0
/*
*----------------------------------------------------------------------
@@ -1203,8 +1222,8 @@ TkGetDefaultScreenName(
* Return the number of milliseconds the user was inactive.
*
* Results:
- * The number of milliseconds the user has been inactive,
- * or -1 if querying the inactive time is not supported.
+ * The number of milliseconds the user has been inactive, or -1 if
+ * querying the inactive time is not supported.
*
* Side effects:
* None.
@@ -1212,13 +1231,15 @@ TkGetDefaultScreenName(
*/
long
-Tk_GetUserInactiveTime(Display *dpy)
+Tk_GetUserInactiveTime(
+ Display *dpy)
{
io_registry_entry_t regEntry;
CFMutableDictionaryRef props = NULL;
CFTypeRef timeObj;
long ret = -1l;
uint64_t time;
+ IOReturn result;
regEntry = IOServiceGetMatchingService(kIOMasterPortDefault,
IOServiceMatching("IOHIDSystem"));
@@ -1227,7 +1248,7 @@ Tk_GetUserInactiveTime(Display *dpy)
return -1l;
}
- IOReturn result = IORegistryEntryCreateCFProperties(regEntry, &props,
+ result = IORegistryEntryCreateCFProperties(regEntry, &props,
kCFAllocatorDefault, 0);
IOObjectRelease(regEntry);
@@ -1245,13 +1266,13 @@ Tk_GetUserInactiveTime(Display *dpy)
CFRangeMake(0, sizeof(time)), (UInt8 *) &time);
/* Convert nanoseconds to milliseconds. */
/* ret /= kMillisecondScale; */
- ret = (long)(time/kMillisecondScale);
+ ret = (long) (time/kMillisecondScale);
} else if (type == CFNumberGetTypeID()) { /* Panther+ */
CFNumberGetValue((CFNumberRef)timeObj,
kCFNumberSInt64Type, &time);
/* Convert nanoseconds to milliseconds. */
/* ret /= kMillisecondScale; */
- ret = (long)(time/kMillisecondScale);
+ ret = (long) (time/kMillisecondScale);
} else {
ret = -1l;
}
@@ -1273,15 +1294,15 @@ Tk_GetUserInactiveTime(Display *dpy)
* none
*
* Side effects:
- * The user inactivity timer of the underlaying windowing system
- * is reset to zero.
+ * The user inactivity timer of the underlaying windowing system is reset
+ * to zero.
*
*----------------------------------------------------------------------
*/
void
-Tk_ResetUserInactiveTime(Display *dpy)
+Tk_ResetUserInactiveTime(
+ Display *dpy)
{
UpdateSystemActivity(UsrActivity);
}
-#endif
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
new file mode 100644
index 0000000..e5ae257
--- /dev/null
+++ b/macosx/ttkMacOSXTheme.c
@@ -0,0 +1,1137 @@
+/*
+ * ttkMacOSXTheme.c --
+ *
+ * Tk theme engine for Mac OSX, using the Appearance Manager API.
+ *
+ * Copyright (c) 2004 Joe English
+ * Copyright (c) 2005 Neil Madden
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * See also:
+ *
+ * <URL: http://developer.apple.com/documentation/Carbon/Reference/
+ * Appearance_Manager/appearance_manager/APIIndex.html >
+ *
+ * Notes:
+ * "Active" means different things in Mac and Tk terminology --
+ * On Aqua, widgets are "Active" if they belong to the foreground window,
+ * "Inactive" if they are in a background window.
+ * Tk uses the term "active" to mean that the mouse cursor
+ * is over a widget; aka "hover", "prelight", or "hot-tracked".
+ * Aqua doesn't use this kind of feedback.
+ *
+ * The QuickDraw/Carbon coordinate system is relative to the
+ * top-level window, not to the Tk_Window. BoxToRect()
+ * accounts for this.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "ttk/ttkTheme.h"
+
+#if !defined(BUILD_tile)
+/*
+ * Use this version in the core:
+ */
+#define BEGIN_DRAWING(d) { \
+ TkMacOSXDrawingContext dc; \
+ if (!TkMacOSXSetupDrawingContext((d), NULL, 0, &dc)) {return;}
+#define END_DRAWING \
+ TkMacOSXRestoreDrawingContext(&dc); }
+#else /* BUILD_tile */
+/*
+ * TkMacOSXSetupDrawingContext is not available to extensions,
+ * need to do this the hard way in Tile:
+ */
+#define BEGIN_DRAWING(d) { \
+ CGrafPtr saveWorld; GDHandle saveDevice; \
+ GetGWorld(&saveWorld, &saveDevice); \
+ SetGWorld(TkMacOSXGetDrawablePort(d), 0); \
+ TkMacOSXSetUpClippingRgn(d);
+#define END_DRAWING \
+ SetGWorld(saveWorld,saveDevice); }
+#endif /* defined(BUILD_TILE) */
+
+#ifdef __LP64__
+#define RangeToFactor(maximum) (((double) (INT_MAX >> 1)) / (maximum))
+#else
+#define RangeToFactor(maximum) (((double) (LONG_MAX >> 1)) / (maximum))
+#endif /* __LP64__ */
+
+/*----------------------------------------------------------------------
+ * +++ Utilities.
+ */
+
+/*
+ * BoxToRect --
+ * Convert a Ttk_Box in Tk coordinates relative to the given Drawable
+ * to a native Rect relative to the containing port.
+ */
+static inline Rect BoxToRect(Drawable d, Ttk_Box b)
+{
+ MacDrawable *md = (MacDrawable*)d;
+ Rect rect;
+
+ rect.top = b.y + md->yOff;
+ rect.left = b.x + md->xOff;
+ rect.bottom = rect.top + b.height;
+ rect.right = rect.left + b.width;
+
+ return rect;
+}
+
+/*
+ * PatternOrigin --
+ * Compute brush pattern origin for a Drawable relative to a Tk_Window.
+ *
+ * Notes: This will only be nonzero if the Drawable is an off-screen pixmap.
+ * See also SF bug #1157739.
+ */
+static Point PatternOrigin(Tk_Window tkwin, Drawable d)
+{
+ MacDrawable *md = (MacDrawable*)d;
+ Rect bounds;
+ Point origin;
+
+ TkMacOSXWinBounds((TkWindow *) tkwin, &bounds);
+ origin.h = md->xOff - bounds.left;
+ origin.v = md->yOff - bounds.top;
+
+ return origin;
+}
+
+/*
+ * DontErase --
+ * No-op ThemeEraseProc, can be passed to DrawThemeButton &c.
+ */
+static void DontErase(
+ const Rect *bounds, UInt32 eraseData, SInt16 depth, Boolean isColorDev)
+{ }
+
+/*
+ * Table mapping Tk states to Appearance manager ThemeStates
+ */
+
+static Ttk_StateTable ThemeStateTable[] = {
+ {kThemeStateUnavailable, TTK_STATE_DISABLED, 0},
+ {kThemeStatePressed, TTK_STATE_PRESSED, 0},
+ {kThemeStateInactive, TTK_STATE_BACKGROUND, 0},
+ {kThemeStateActive, 0, 0}
+/* Others: Not sure what these are supposed to mean.
+ Up/Down have something to do with "little arrow" increment controls...
+ Dunno what a "Rollover" is.
+ NEM: Rollover is TTK_STATE_ACTIVE... but we don't handle that yet, by the
+ looks of things
+ {kThemeStateRollover, 0, 0},
+ {kThemeStateUnavailableInactive, 0, 0}
+ {kThemeStatePressedUp, 0, 0},
+ {kThemeStatePressedDown, 0, 0}
+*/
+};
+
+/*----------------------------------------------------------------------
+ * +++ Button element: Used for elements drawn with DrawThemeButton.
+ */
+
+/*
+ * Extra margins to account for drop shadow.
+ */
+static Ttk_Padding ButtonMargins = {2,2,2,2};
+
+#define NoThemeMetric 0xFFFFFFFF
+
+typedef struct {
+ ThemeButtonKind kind;
+ ThemeMetric heightMetric;
+} ThemeButtonParms;
+
+static ThemeButtonParms
+ PushButtonParms = { kThemePushButton, kThemeMetricPushButtonHeight },
+ CheckBoxParms = { kThemeCheckBox, kThemeMetricCheckBoxHeight },
+ RadioButtonParms = { kThemeRadioButton, kThemeMetricRadioButtonHeight },
+ BevelButtonParms = { kThemeBevelButton, NoThemeMetric },
+ PopupButtonParms = { kThemePopupButton, kThemeMetricPopupButtonHeight },
+ DisclosureParms = { kThemeDisclosureButton, kThemeMetricDisclosureTriangleHeight },
+ ListHeaderParms = { kThemeListHeaderButton, kThemeMetricListHeaderHeight };
+
+static Ttk_StateTable ButtonValueTable[] = {
+ { kThemeButtonMixed, TTK_STATE_ALTERNATE, 0 },
+ { kThemeButtonOn, TTK_STATE_SELECTED, 0 },
+ { kThemeButtonOff, 0, 0 }
+/* Others: kThemeDisclosureRight, kThemeDisclosureDown, kThemeDisclosureLeft */
+};
+
+static Ttk_StateTable ButtonAdornmentTable[] = {
+ { kThemeAdornmentDefault| kThemeAdornmentFocus,
+ TTK_STATE_ALTERNATE| TTK_STATE_FOCUS, 0 },
+ { kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0 },
+ { kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 },
+ { kThemeAdornmentNone, 0, 0 }
+};
+
+/*
+ * computeButtonDrawInfo --
+ * Fill in an appearance manager ThemeButtonDrawInfo record.
+ */
+static ThemeButtonDrawInfo computeButtonDrawInfo(
+ ThemeButtonParms *parms, Ttk_State state)
+{
+ ThemeButtonDrawInfo info;
+
+ info.state = Ttk_StateTableLookup(ThemeStateTable, state);
+ info.value = Ttk_StateTableLookup(ButtonValueTable, state);
+ info.adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state);
+ return info;
+}
+
+static void ButtonElementSizeNoPadding(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ThemeButtonParms *parms = clientData;
+
+ if (parms->heightMetric != NoThemeMetric) {
+ SInt32 height;
+
+ ChkErr(GetThemeMetric, parms->heightMetric, &height);
+ *heightPtr = height;
+ }
+}
+
+static void ButtonElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ThemeButtonParms *parms = clientData;
+ ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, 0);
+ static const Rect scratchBounds = {0, 0, 100, 100};
+ Rect contentBounds;
+
+ ButtonElementSizeNoPadding(
+ clientData, elementRecord, tkwin,
+ widthPtr, heightPtr, paddingPtr);
+
+ /*
+ * To compute internal padding, query the appearance manager
+ * for the content bounds of a dummy rectangle, then use
+ * the difference as the padding.
+ */
+ ChkErr(GetThemeButtonContentBounds,
+ &scratchBounds, parms->kind, &info, &contentBounds);
+
+ paddingPtr->left = contentBounds.left;
+ paddingPtr->top = contentBounds.top;
+ paddingPtr->right = scratchBounds.right - contentBounds.right + 1;
+ paddingPtr->bottom = scratchBounds.bottom - contentBounds.bottom;
+
+ /*
+ * Now add a little extra padding to account for drop shadows.
+ * @@@ SHOULD: call GetThemeButtonBackgroundBounds() instead.
+ */
+
+ *paddingPtr = Ttk_AddPadding(*paddingPtr, ButtonMargins);
+ *widthPtr += Ttk_PaddingWidth(ButtonMargins);
+ *heightPtr += Ttk_PaddingHeight(ButtonMargins);
+}
+
+static void ButtonElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeButtonParms *parms = clientData;
+ ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state);
+ Rect bounds = BoxToRect(d, Ttk_PadBox(b, ButtonMargins));
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton, &bounds, parms->kind, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec ButtonElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ButtonElementSize,
+ ButtonElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Notebook elements.
+ */
+
+static Ttk_StateTable TabStyleTable[] = {
+ { kThemeTabFrontInactive, TTK_STATE_SELECTED|TTK_STATE_BACKGROUND, 0 },
+ { kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND, 0 },
+ { kThemeTabFrontUnavailable, TTK_STATE_DISABLED|TTK_STATE_SELECTED, 0 },
+ { kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED, 0 },
+ { kThemeTabFront, TTK_STATE_SELECTED, 0 },
+ { kThemeTabNonFrontPressed, TTK_STATE_PRESSED, 0 },
+ { kThemeTabNonFront, 0,0 }
+};
+
+/*
+ * Quoth DrawThemeTab() reference manual:
+ * "Small tabs have a height of 16 pixels large tabs have a height of
+ * 21 pixels. (The widths of tabs are variable.) Additionally, the
+ * distance that the tab overlaps the pane must be included in the tab
+ * rectangle this overlap distance is always 3 pixels, although the
+ * 3-pixel overlap is only drawn for the front tab."
+ */
+static const int TAB_HEIGHT = 21;
+static const int TAB_OVERLAP = 3;
+
+static void TabElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1;
+}
+
+static void TabElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeTabStyle tabStyle = Ttk_StateTableLookup(TabStyleTable, state);
+
+ bounds.bottom += TAB_OVERLAP;
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTab, &bounds, tabStyle, kThemeTabNorth, 0, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec TabElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TabElementSize,
+ TabElementDraw
+};
+
+/*
+ * Notebook panes:
+ */
+static void PaneElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ /* Padding determined by trial-and-error */
+ *paddingPtr = Ttk_MakePadding(2, 8, 2, 2);
+}
+
+static void PaneElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTabPane, &bounds, drawState);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec PaneElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ PaneElementSize,
+ PaneElementDraw
+};
+
+/*
+ * Labelframe borders:
+ * Use "primary group box ..."
+ * Quoth DrawThemePrimaryGroup reference:
+ * "The primary group box frame is drawn inside the specified
+ * rectangle and is a maximum of 2 pixels thick."
+ *
+ * "Maximum of 2 pixels thick" is apparently a lie;
+ * looks more like 4 to me with shading.
+ */
+static void GroupElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *paddingPtr = Ttk_UniformPadding(4);
+}
+
+static void GroupElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemePrimaryGroup, &bounds, drawState);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec GroupElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ GroupElementSize,
+ GroupElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Entry element --
+ * 3 pixels padding for focus rectangle
+ * 2 pixels padding for EditTextFrame
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+} EntryElement;
+
+static Ttk_ElementOptionSpec EntryElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(EntryElement,backgroundObj), "white" },
+ {0}
+};
+
+static void EntryElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *paddingPtr = Ttk_UniformPadding(5);
+}
+
+static void EntryElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ EntryElement *e = elementRecord;
+ Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,e->backgroundObj);
+ Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3));
+ Rect bounds = BoxToRect(d, inner);
+ ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+
+ /*
+ * Erase w/background color:
+ */
+ XFillRectangle(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
+ inner.x,inner.y, inner.width, inner.height);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeEditTextFrame, &bounds, drawState);
+ if (state & TTK_STATE_FOCUS) {
+ ChkErr(DrawThemeFocusRect, &bounds, 1);
+ }
+ END_DRAWING
+}
+
+static Ttk_ElementSpec EntryElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(EntryElement),
+ EntryElementOptions,
+ EntryElementSize,
+ EntryElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Combobox:
+ *
+ * NOTES:
+ * kThemeMetricComboBoxLargeDisclosureWidth -> 17
+ * Padding and margins guesstimated by trial-and-error.
+ */
+
+static Ttk_Padding ComboboxPadding = { 2, 3, 17, 1 };
+static Ttk_Padding ComboboxMargins = { 3, 3, 4, 4 };
+
+static void ComboboxElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *widthPtr = 0;
+ *heightPtr = 0;
+ *paddingPtr = Ttk_AddPadding(ComboboxMargins, ComboboxPadding);
+}
+
+static void ComboboxElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeButtonParms *parms = clientData;
+ ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state);
+ Rect bounds = BoxToRect(d, Ttk_PadBox(b, ComboboxMargins));
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton,
+ &bounds, kThemeComboBox, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec ComboboxElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ComboboxElementSize,
+ ComboboxElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Spinbuttons.
+ *
+ * From Apple HIG, part III, section "Controls", "The Stepper Control":
+ * there should be 2 pixels of space between the stepper control
+ * (AKA IncDecButton, AKA "little arrows") and the text field it modifies.
+ */
+
+static Ttk_Padding SpinbuttonMargins = {2,0,2,0};
+static void SpinButtonElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SInt32 s;
+
+ ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s);
+ *widthPtr = s + Ttk_PaddingWidth(SpinbuttonMargins);
+ ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s);
+ *heightPtr = s + Ttk_PaddingHeight(SpinbuttonMargins);
+}
+
+static void SpinButtonElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, Ttk_PadBox(b, SpinbuttonMargins));
+ ThemeButtonDrawInfo info;
+
+ /* @@@ can't currently distinguish PressedUp (== Pressed) from PressedDown;
+ * ignore this bit for now [see #2219588]
+ */
+ info.state = Ttk_StateTableLookup(ThemeStateTable,
+ state & ~TTK_STATE_PRESSED);
+ info.value = Ttk_StateTableLookup(ButtonValueTable, state);
+ info.adornment = kThemeAdornmentNone;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton,
+ &bounds, kThemeIncDecButton, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec SpinButtonElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SpinButtonElementSize,
+ SpinButtonElementDraw
+};
+
+
+/*----------------------------------------------------------------------
+ * +++ DrawThemeTrack-based elements --
+ * Progress bars and scales. (See also: <<NOTE-TRACKS>>)
+ */
+
+static Ttk_StateTable ThemeTrackEnableTable[] = {
+ { kThemeTrackDisabled, TTK_STATE_DISABLED, 0 },
+ { kThemeTrackInactive, TTK_STATE_BACKGROUND, 0 },
+ { kThemeTrackActive, 0, 0 }
+ /* { kThemeTrackNothingToScroll, ?, ? }, */
+};
+
+typedef struct { /* TrackElement client data */
+ ThemeTrackKind kind;
+ SInt32 thicknessMetric;
+} TrackElementData;
+
+static TrackElementData ScaleData = {
+ kThemeSlider, kThemeMetricHSliderHeight
+};
+
+typedef struct {
+ Tcl_Obj *fromObj; /* minimum value */
+ Tcl_Obj *toObj; /* maximum value */
+ Tcl_Obj *valueObj; /* current value */
+ Tcl_Obj *orientObj; /* horizontal / vertical */
+} TrackElement;
+
+static Ttk_ElementOptionSpec TrackElementOptions[] = {
+ { "-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,fromObj) },
+ { "-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,toObj) },
+ { "-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,valueObj) },
+ { "-orient", TK_OPTION_STRING, Tk_Offset(TrackElement,orientObj) },
+ {0,0,0}
+};
+
+static void TrackElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TrackElementData *data = clientData;
+ SInt32 size = 24; /* reasonable default ... */
+
+ ChkErr(GetThemeMetric, data->thicknessMetric, &size);
+ *widthPtr = *heightPtr = size;
+}
+
+static void TrackElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ TrackElementData *data = clientData;
+ TrackElement *elem = elementRecord;
+ double from = 0, to = 100, value = 0, factor;
+ int orientation = TTK_ORIENT_HORIZONTAL;
+ ThemeTrackDrawInfo info;
+
+ Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from);
+ Tcl_GetDoubleFromObj(NULL, elem->toObj, &to);
+ Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
+ Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation);
+ factor = RangeToFactor(to - from);
+
+ info.kind = data->kind;
+ info.bounds = BoxToRect(d, b);
+ info.min = (int) from * factor;
+ info.max = (int) to * factor;
+ info.value = (int) value * factor;
+
+ info.attributes = orientation == TTK_ORIENT_HORIZONTAL
+ ? kThemeTrackHorizontal : 0;
+ info.attributes |= kThemeTrackShowThumb;
+ info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state);
+
+ switch (data->kind) {
+ case kThemeProgressBar:
+ info.trackInfo.progress.phase = 0; /* 1-4: animation phase */
+ break;
+ case kThemeSlider:
+ info.trackInfo.slider.pressState = 0; /* @@@ fill this in */
+ info.trackInfo.slider.thumbDir = kThemeThumbPlain;
+ /* kThemeThumbUpward, kThemeThumbDownward, kThemeThumbPlain */
+ break;
+ }
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTrack, &info, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec TrackElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TrackElement),
+ TrackElementOptions,
+ TrackElementSize,
+ TrackElementDraw
+};
+
+/*
+ * Slider element -- <<NOTE-TRACKS>>
+ * Has geometry only. The Scale widget adjusts the position of this element,
+ * and uses it for hit detection. In the Aqua theme, the slider is actually
+ * drawn as part of the trough element.
+ *
+ * Also buggy: The geometry here is a Wild-Assed-Guess; I can't
+ * figure out how to get the Appearance Manager to tell me the
+ * slider size.
+ */
+static void SliderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *widthPtr = *heightPtr = 24;
+}
+
+static Ttk_ElementSpec SliderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SliderElementSize,
+ TtkNullElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Progress bar element (new):
+ *
+ * @@@ NOTE: According to an older revision of the Aqua reference docs,
+ * @@@ the 'phase' field is between 0 and 4. Newer revisions say
+ * @@@ that it can be any UInt8 value.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj; /* horizontal / vertical */
+ Tcl_Obj *valueObj; /* current value */
+ Tcl_Obj *maximumObj; /* maximum value */
+ Tcl_Obj *phaseObj; /* animation phase */
+ Tcl_Obj *modeObj; /* progress bar mode */
+} PbarElement;
+
+static Ttk_ElementOptionSpec PbarElementOptions[] = {
+ { "-orient", TK_OPTION_STRING,
+ Tk_Offset(PbarElement,orientObj), "horizontal" },
+ { "-value", TK_OPTION_DOUBLE,
+ Tk_Offset(PbarElement,valueObj), "0" },
+ { "-maximum", TK_OPTION_DOUBLE,
+ Tk_Offset(PbarElement,maximumObj), "100" },
+ { "-phase", TK_OPTION_INT,
+ Tk_Offset(PbarElement,phaseObj), "0" },
+ { "-mode", TK_OPTION_STRING,
+ Tk_Offset(PbarElement,modeObj), "determinate" },
+ {0,0,0,0}
+};
+
+static void PbarElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SInt32 size = 24; /* @@@ Check HIG for correct default */
+
+ ChkErr(GetThemeMetric, kThemeMetricLargeProgressBarThickness, &size);
+ *widthPtr = *heightPtr = size;
+}
+
+static void PbarElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ PbarElement *pbar = elementRecord;
+ int orientation = TTK_ORIENT_HORIZONTAL;
+ double value = 0, maximum = 100, factor;
+ int phase = 0;
+ ThemeTrackDrawInfo info;
+
+ Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation);
+ Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value);
+ Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum);
+ Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase);
+ factor = RangeToFactor(maximum);
+
+ if (!strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) && value) {
+ info.kind = kThemeIndeterminateBar;
+ } else {
+ info.kind = kThemeProgressBar;
+ }
+ info.bounds = BoxToRect(d, b);
+ info.min = 0;
+ info.max = (int) maximum * factor;
+ info.value = (int) value * factor;
+ info.attributes = orientation == TTK_ORIENT_HORIZONTAL
+ ? kThemeTrackHorizontal : 0;
+ info.attributes |= kThemeTrackShowThumb;
+ info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state);
+ info.trackInfo.progress.phase = phase;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTrack, &info, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec PbarElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(PbarElement),
+ PbarElementOptions,
+ PbarElementSize,
+ PbarElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Separator element.
+ *
+ * DrawThemeSeparator() guesses the orientation of the line from
+ * the width and height of the rectangle, so the same element can
+ * can be used for horizontal, vertical, and general separators.
+ */
+
+static void SeparatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *widthPtr = *heightPtr = 1;
+}
+
+static void SeparatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeDrawState drawState;
+
+ /*
+ * DrawThemeSeparator only supports kThemeStateActive / kThemeStateInactive
+ */
+ state &= TTK_STATE_BACKGROUND;
+ drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeSeparator, &bounds, drawState);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec SeparatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SeparatorElementSize,
+ SeparatorElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Size grip element.
+ */
+static const ThemeGrowDirection sizegripGrowDirection
+ = kThemeGrowRight|kThemeGrowDown;
+
+static void SizegripElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ Point origin = {0, 0};
+ Rect bounds;
+
+ ChkErr(GetThemeStandaloneGrowBoxBounds,
+ origin, sizegripGrowDirection, false, &bounds);
+ *widthPtr = bounds.right - bounds.left;
+ *heightPtr = bounds.bottom - bounds.top;
+}
+
+static void SizegripElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ Rect bounds = BoxToRect(d, b);
+ Point origin = {bounds.top, bounds.left};
+
+ /* Grow box only supports kThemeStateActive, kThemeStateInactive */
+ state &= TTK_STATE_BACKGROUND;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeStandaloneGrowBox,
+ origin, sizegripGrowDirection, false,
+ Ttk_StateTableLookup(ThemeStateTable, state));
+ END_DRAWING
+}
+
+static Ttk_ElementSpec SizegripElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SizegripElementSize,
+ SizegripElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Background and fill elements.
+ *
+ * This isn't quite right: In Aqua, the correct background for
+ * a control depends on what kind of container it belongs to,
+ * and the type of the top-level window.
+ *
+ * Also: patterned backgrounds should be aligned with the coordinate
+ * system of the top-level window. If we're drawing into an
+ * off-screen graphics port this leads to alignment glitches.
+ */
+
+static void FillElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeBrush brush = (state & TTK_STATE_BACKGROUND)
+ ? kThemeBrushModelessDialogBackgroundInactive
+ : kThemeBrushModelessDialogBackgroundActive;
+
+ BEGIN_DRAWING(d)
+ ChkErr(SetThemeBackground, brush, 32, true);
+ QDSetPatternOrigin(PatternOrigin(tkwin, d));
+ EraseRect(&bounds);
+ END_DRAWING
+}
+
+static void BackgroundElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FillElementDraw(
+ clientData, elementRecord, tkwin,
+ d, Ttk_WinBox(tkwin), state);
+}
+
+static Ttk_ElementSpec FillElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ FillElementDraw
+};
+
+static Ttk_ElementSpec BackgroundElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ BackgroundElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ ToolbarBackground element -- toolbar style for frames.
+ *
+ * This is very similar to the normal background element, but uses a
+ * different ThemeBrush in order to get the lighter pinstripe effect
+ * used in toolbars. We use SetThemeBackground() rather than
+ * ApplyThemeBackground() in order to get the right style.
+ *
+ * <URL: http://developer.apple.com/documentation/Carbon/Reference/
+ * Appearance_Manager/appearance_manager/constant_7.html#/
+ * /apple_ref/doc/uid/TP30000243/C005321>
+ *
+ */
+static void ToolbarBackgroundElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeBrush brush = kThemeBrushToolbarBackground;
+ Rect bounds = BoxToRect(d, Ttk_WinBox(tkwin));
+
+ BEGIN_DRAWING(d)
+ ChkErr(SetThemeBackground, brush, 32, true);
+ QDSetPatternOrigin(PatternOrigin(tkwin, d));
+ EraseRect(&bounds);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec ToolbarBackgroundElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ ToolbarBackgroundElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Treeview header
+ * Redefine the header to use a kThemeListHeaderButton.
+ */
+
+static Ttk_StateTable TreeHeaderAdornmentTable[] = {
+ { kThemeAdornmentHeaderButtonSortUp, TTK_STATE_ALTERNATE, 0 },
+ { kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 },
+ { kThemeAdornmentNone, 0, 0 }
+};
+
+static void TreeHeaderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeButtonParms *parms = clientData;
+ Rect bounds = BoxToRect(d, b);
+ ThemeButtonDrawInfo info;
+
+ info.state = Ttk_StateTableLookup(ThemeStateTable, state);
+ info.value = Ttk_StateTableLookup(ButtonValueTable, state);
+ info.adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton, &bounds, parms->kind, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec TreeHeaderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ButtonElementSizeNoPadding,
+ TreeHeaderElementDraw
+};
+
+/*
+ * Disclosure triangle:
+ */
+#define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1
+#define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2
+static Ttk_StateTable DisclosureValueTable[] = {
+ { kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0 },
+ { kThemeDisclosureRight, 0, 0 },
+};
+
+static void DisclosureElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SInt32 s;
+
+ ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s);
+ *widthPtr = s;
+ ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s);
+ *heightPtr = s;
+}
+
+static void DisclosureElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeButtonDrawInfo info;
+
+ if (state & TTK_TREEVIEW_STATE_LEAF) {
+ return;
+ }
+
+ info.state = Ttk_StateTableLookup(ThemeStateTable, state);
+ info.value = Ttk_StateTableLookup(DisclosureValueTable, state);
+ info.adornment = kThemeAdornmentDrawIndicatorOnly;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton,
+ &bounds, kThemeDisclosureTriangle, &info, NULL, DontErase, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec DisclosureElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ DisclosureElementSize,
+ DisclosureElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Widget layouts.
+ */
+
+TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
+
+TTK_LAYOUT("Toolbar",
+ TTK_NODE("Toolbar.background", TTK_FILL_BOTH))
+
+TTK_LAYOUT("TButton",
+ TTK_GROUP("Button.button", TTK_FILL_BOTH,
+ TTK_GROUP("Button.padding", TTK_FILL_BOTH,
+ TTK_NODE("Button.label", TTK_FILL_BOTH))))
+
+TTK_LAYOUT("TRadiobutton",
+ TTK_GROUP("Radiobutton.button", TTK_FILL_BOTH,
+ TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Radiobutton.label", TTK_PACK_LEFT))))
+
+TTK_LAYOUT("TCheckbutton",
+ TTK_GROUP("Checkbutton.button", TTK_FILL_BOTH,
+ TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Checkbutton.label", TTK_PACK_LEFT))))
+
+TTK_LAYOUT("TMenubutton",
+ TTK_GROUP("Menubutton.button", TTK_FILL_BOTH,
+ TTK_GROUP("Menubutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
+
+TTK_LAYOUT("TCombobox",
+ TTK_GROUP("Combobox.button", TTK_PACK_TOP|TTK_FILL_X,
+ TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
+ TTK_NODE("Combobox.textarea", TTK_FILL_X))))
+
+/* Notebook tabs -- no focus ring */
+TTK_LAYOUT("Tab",
+ TTK_GROUP("Notebook.tab", TTK_FILL_BOTH,
+ TTK_GROUP("Notebook.padding", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_NODE("Notebook.label", TTK_EXPAND|TTK_FILL_BOTH))))
+
+/* Progress bars -- track only */
+TTK_LAYOUT("TSpinbox",
+ TTK_NODE("Spinbox.spinbutton", TTK_PACK_RIGHT|TTK_STICK_E)
+ TTK_GROUP("Spinbox.field", TTK_EXPAND|TTK_FILL_X,
+ TTK_NODE("Spinbox.textarea", TTK_EXPAND|TTK_FILL_X)))
+
+TTK_LAYOUT("TProgressbar",
+ TTK_NODE("Progressbar.track", TTK_EXPAND|TTK_FILL_BOTH))
+
+/* Tree heading -- no border, fixed height */
+TTK_LAYOUT("Heading",
+ TTK_NODE("Treeheading.cell", TTK_FILL_X)
+ TTK_NODE("Treeheading.image", TTK_PACK_RIGHT)
+ TTK_NODE("Treeheading.text", 0))
+
+/* Tree items -- omit focus ring */
+TTK_LAYOUT("Item",
+ TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH,
+ TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT)
+ TTK_NODE("Treeitem.image", TTK_PACK_LEFT)
+ TTK_NODE("Treeitem.text", TTK_PACK_LEFT)))
+
+TTK_END_LAYOUT_TABLE
+
+/*----------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+static int AquaTheme_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL);
+
+ if (!themePtr) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Elements:
+ */
+ Ttk_RegisterElementSpec(themePtr, "background", &BackgroundElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Toolbar.background",
+ &ToolbarBackgroundElementSpec, 0);
+
+ Ttk_RegisterElementSpec(themePtr, "Button.button",
+ &ButtonElementSpec, &PushButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Checkbutton.button",
+ &ButtonElementSpec, &CheckBoxParms);
+ Ttk_RegisterElementSpec(themePtr, "Radiobutton.button",
+ &ButtonElementSpec, &RadioButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Toolbutton.border",
+ &ButtonElementSpec, &BevelButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Menubutton.button",
+ &ButtonElementSpec, &PopupButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Spinbox.spinbutton",
+ &SpinButtonElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Combobox.button",
+ &ComboboxElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator",
+ &DisclosureElementSpec, &DisclosureParms);
+ Ttk_RegisterElementSpec(themePtr, "Treeheading.cell",
+ &TreeHeaderElementSpec, &ListHeaderParms);
+
+ Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0);
+
+ Ttk_RegisterElementSpec(themePtr, "Labelframe.border",&GroupElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "Entry.field",&EntryElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "Spinbox.field",&EntryElementSpec,0);
+
+ Ttk_RegisterElementSpec(themePtr, "separator",&SeparatorElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "hseparator",&SeparatorElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "vseparator",&SeparatorElementSpec,0);
+
+ Ttk_RegisterElementSpec(themePtr, "sizegrip",&SizegripElementSpec,0);
+
+ /*
+ * <<NOTE-TRACKS>>
+ * The Progressbar widget adjusts the size of the pbar element.
+ * In the Aqua theme, the appearance manager computes the bar geometry;
+ * we do all the drawing in the ".track" element and leave the .pbar out.
+ */
+ Ttk_RegisterElementSpec(themePtr,"Scale.trough",
+ &TrackElementSpec, &ScaleData);
+ Ttk_RegisterElementSpec(themePtr,"Scale.slider",&SliderElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr,"Progressbar.track", &PbarElementSpec, 0);
+
+ /*
+ * Layouts:
+ */
+ Ttk_RegisterLayouts(themePtr, LayoutTable);
+
+ Tcl_PkgProvide(interp, "ttk::theme::aqua", TTK_VERSION);
+ return TCL_OK;
+}
+
+MODULE_SCOPE
+int Ttk_MacOSXPlatformInit(Tcl_Interp *interp)
+{
+ return AquaTheme_Init(interp);
+}
+
diff --git a/tests/all.tcl b/tests/all.tcl
index 8d33488..7f57dc2 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -9,10 +9,12 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require Tcl 8.4
-package require tcltest 2.1
+package require Tcl 8.5
+package require tcltest 2.2
package require Tk ;# This is the Tk test suite; fail early if no Tk!
-tcltest::configure -testdir [file join [pwd] [file dirname [info script]]]
+tcltest::configure {*}$argv
+tcltest::configure -testdir [file normalize [file dirname [info script]]]
+tcltest::configure -loadfile \
+ [file join [tcltest::testsDirectory] constraints.tcl]
tcltest::configure -singleproc 1
-eval tcltest::configure $argv
tcltest::runAllTests
diff --git a/tests/bell.test b/tests/bell.test
index e7ddeb2..16fea0f 100644
--- a/tests/bell.test
+++ b/tests/bell.test
@@ -6,10 +6,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
test bell-1.1 {bell command} {
@@ -45,18 +42,5 @@ test bell-1.8 {bell command} {
} {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/bgerror.test b/tests/bgerror.test
index d534be8..fa33d31 100644
--- a/tests/bgerror.test
+++ b/tests/bgerror.test
@@ -6,10 +6,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
test bgerror-1.1 {bgerror / tkerror compat} {
@@ -57,18 +54,5 @@ catch {rename tkerror {}}
# to emulate.
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/bind.test b/tests/bind.test
index 6de1fc1..9892fec 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
tk useinputmethods 0
@@ -216,8 +213,6 @@ test bind-5.1 {Tk_CreateBindingTable procedure} {
.b.c bind foo
} {}
-testConstraint testcbind [llength [info commands testcbind]]
-
test bind-6.1 {Tk_DeleteBindTable procedure} {
catch {destroy .b.c}
canvas .b.c
@@ -2054,190 +2049,191 @@ test bind-22.18 {HandleEventGenerate} {
# Bug 411307
list [catch {event gen . <a> -root 98765} msg] $msg
} {1 {bad window name/identifier "98765"}}
-set i 19
foreach check {
- {<Configure> %a {-above .xyz} {{1 {bad window path name ".xyz"}}}}
- {<Configure> %a {-above .b} {[winfo id .b]}}
- {<Configure> %a {-above xyz} {{1 {bad window name/identifier "xyz"}}}}
- {<Configure> %a {-above [winfo id .b]} {[winfo id .b]}}
- {<Key> %b {-above .} {{1 {<Key> event doesn't accept "-above" option}}}}
-
- {<Configure> %B {-borderwidth xyz} {{1 {bad screen distance "xyz"}}}}
- {<Configure> %B {-borderwidth 2i} {[winfo pixels .b.f 2i]}}
- {<Key> %k {-borderwidth 2i} {{1 {<Key> event doesn't accept "-borderwidth" option}}}}
-
- {<Button> %b {-button xyz} {{1 {expected integer but got "xyz"}}}}
- {<Button> %b {-button 1} 1}
- {<ButtonRelease> %b {-button 1} 1}
- {<Key> %k {-button 1} {{1 {<Key> event doesn't accept "-button" option}}}}
-
- {<Expose> %c {-count xyz} {{1 {expected integer but got "xyz"}}}}
- {<Expose> %c {-count 20} 20}
- {<Key> %b {-count 20} {{1 {<Key> event doesn't accept "-count" option}}}}
-
- {<Enter> %d {-detail xyz} {{1 {bad -detail value "xyz": must be NotifyAncestor, NotifyVirtual, NotifyInferior, NotifyNonlinear, NotifyNonlinearVirtual, NotifyPointer, NotifyPointerRoot, or NotifyDetailNone}}}}
- {<FocusIn> %d {-detail NotifyVirtual} {{}}}
- {<Enter> %d {-detail NotifyVirtual} NotifyVirtual}
- {<Key> %k {-detail NotifyVirtual} {{1 {<Key> event doesn't accept "-detail" option}}}}
-
- {<Enter> %f {-focus xyz} {{1 {expected boolean value but got "xyz"}}}}
- {<Enter> %f {-focus 1} 1}
- {<Key> %k {-focus 1} {{1 {<Key> event doesn't accept "-focus" option}}}}
-
- {<Expose> %h {-height xyz} {{1 {bad screen distance "xyz"}}}}
- {<Expose> %h {-height 2i} {[winfo pixels .b.f 2i]}}
- {<Configure> %h {-height 2i} {[winfo pixels .b.f 2i]}}
- {<Key> %k {-height 2i} {{1 {<Key> event doesn't accept "-height" option}}}}
-
- {<Key> %k {-keycode xyz} {{1 {expected integer but got "xyz"}}}}
- {<Key> %k {-keycode 20} 20}
- {<Button> %b {-keycode 20} {{1 {<Button> event doesn't accept "-keycode" option}}}}
-
- {<Key> %K {-keysym xyz} {{1 {unknown keysym "xyz"}}}}
- {<Key> %K {-keysym a} a}
- {<Button> %b {-keysym a} {{1 {<Button> event doesn't accept "-keysym" option}}}}
-
- {<Enter> %m {-mode xyz} {{1 {bad -mode value "xyz": must be NotifyNormal, NotifyGrab, NotifyUngrab, or NotifyWhileGrabbed}}}}
- {<Enter> %m {-mode NotifyNormal} NotifyNormal}
- {<FocusIn> %m {-mode NotifyNormal} {{}}}
- {<Key> %k {-mode NotifyNormal} {{1 {<Key> event doesn't accept "-mode" option}}}}
-
- {<Map> %o {-override xyz} {{1 {expected boolean value but got "xyz"}}}}
- {<Map> %o {-override 1} 1}
- {<Reparent> %o {-override 1} 1}
- {<Configure> %o {-override 1} 1}
- {<Key> %k {-override 1} {{1 {<Key> event doesn't accept "-override" option}}}}
-
- {<Circulate> %p {-place xyz} {{1 {bad -place value "xyz": must be PlaceOnTop, or PlaceOnBottom}}}}
- {<Circulate> %p {-place PlaceOnTop} PlaceOnTop}
- {<Key> %k {-place PlaceOnTop} {{1 {<Key> event doesn't accept "-place" option}}}}
-
- {<Key> %R {-root .xyz} {{1 {bad window path name ".xyz"}}}}
- {<Key> %R {-root .b} {[winfo id .b]}}
- {<Key> %R {-root xyz} {{1 {bad window name/identifier "xyz"}}}}
- {<Key> %R {-root [winfo id .b]} {[winfo id .b]}}
- {<Button> %R {-root .b} {[winfo id .b]}}
- {<ButtonRelease> %R {-root .b} {[winfo id .b]}}
- {<Motion> %R {-root .b} {[winfo id .b]}}
- {<<Paste>> %R {-root .b} {[winfo id .b]}}
- {<Enter> %R {-root .b} {[winfo id .b]}}
- {<Configure> %R {-root .b} {{1 {<Configure> event doesn't accept "-root" option}}}}
-
- {<Key> %X {-rootx xyz} {{1 {bad screen distance "xyz"}}}}
- {<Key> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
- {<Button> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
- {<ButtonRelease> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
- {<Motion> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
- {<<Paste>> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
- {<Enter> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
- {<Configure> %X {-rootx 2i} {{1 {<Configure> event doesn't accept "-rootx" option}}}}
-
- {<Key> %Y {-rooty xyz} {{1 {bad screen distance "xyz"}}}}
- {<Key> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
- {<Button> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
- {<ButtonRelease> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
- {<Motion> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
- {<<Paste>> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
- {<Enter> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
- {<Configure> %Y {-rooty 2i} {{1 {<Configure> event doesn't accept "-rooty" option}}}}
-
- {<Key> %E {-sendevent xyz} {{1 {expected boolean value but got "xyz"}}}}
- {<Key> %E {-sendevent 1} 1}
- {<Key> %E {-sendevent yes} 1}
- {<Key> %E {-sendevent 43} 43}
-
- {<Key> %# {-serial xyz} {{1 {expected integer but got "xyz"}}}}
- {<Key> %# {-serial 100} 100}
-
- {<Key> %s {-state xyz} {{1 {expected integer but got "xyz"}}}}
- {<Key> %s {-state 1} 1}
- {<Button> %s {-state 1025} 1025}
- {<ButtonRelease> %s {-state 1025} 1025}
- {<Motion> %s {-state 1} 1}
- {<<Paste>> %s {-state 1} 1}
- {<Enter> %s {-state 1} 1}
- {<Visibility> %s {-state xyz} {{1 {bad -state value "xyz": must be VisibilityUnobscured, VisibilityPartiallyObscured, or VisibilityFullyObscured}}}}
- {<Visibility> %s {-state VisibilityUnobscured} VisibilityUnobscured}
- {<Configure> %s {-state xyz} {{1 {<Configure> event doesn't accept "-state" option}}}}
-
- {<Key> %S {-subwindow .xyz} {{1 {bad window path name ".xyz"}}}}
- {<Key> %S {-subwindow .b} {[winfo id .b]}}
- {<Key> %S {-subwindow xyz} {{1 {bad window name/identifier "xyz"}}}}
- {<Key> %S {-subwindow [winfo id .b]} {[winfo id .b]}}
- {<Button> %S {-subwindow .b} {[winfo id .b]}}
- {<ButtonRelease> %S {-subwindow .b} {[winfo id .b]}}
- {<Motion> %S {-subwindow .b} {[winfo id .b]}}
- {<<Paste>> %S {-subwindow .b} {[winfo id .b]}}
- {<Enter> %S {-subwindow .b} {[winfo id .b]}}
- {<Configure> %S {-subwindow .b} {{1 {<Configure> event doesn't accept "-subwindow" option}}}}
-
- {<Key> %t {-time xyz} {{1 {expected integer but got "xyz"}}}}
- {<Key> %t {-time 100} 100}
- {<Button> %t {-time 100} 100}
- {<ButtonRelease> %t {-time 100} 100}
- {<Motion> %t {-time 100} 100}
- {<<Paste>> %t {-time 100} 100}
- {<Enter> %t {-time 100} 100}
- {<Property> %t {-time 100} 100}
- {<Configure> %t {-time 100} {{1 {<Configure> event doesn't accept "-time" option}}}}
-
- {<Expose> %w {-width xyz} {{1 {bad screen distance "xyz"}}}}
- {<Expose> %w {-width 2i} {[winfo pixels .b.f 2i]}}
- {<Configure> %w {-width 2i} {[winfo pixels .b.f 2i]}}
- {<Key> %k {-width 2i} {{1 {<Key> event doesn't accept "-width" option}}}}
-
- {<Unmap> %W {-window .xyz} {{1 {bad window path name ".xyz"}}}}
- {<Unmap> %W {-window .b.f} .b.f}
- {<Unmap> %W {-window xyz} {{1 {bad window name/identifier "xyz"}}}}
- {<Unmap> %W {-window [winfo id .b.f]} .b.f}
- {<Unmap> %W {-window .b.f} .b.f}
- {<Map> %W {-window .b.f} .b.f}
- {<Reparent> %W {-window .b.f} .b.f}
- {<Configure> %W {-window .b.f} .b.f}
- {<Gravity> %W {-window .b.f} .b.f}
- {<Circulate> %W {-window .b.f} .b.f}
- {<Key> %W {-window .b.f} {{1 {<Key> event doesn't accept "-window" option}}}}
-
- {<Key> %x {-x xyz} {{1 {bad screen distance "xyz"}}}}
- {<Key> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Button> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<ButtonRelease> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Motion> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<<Paste>> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Enter> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Expose> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Configure> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Gravity> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Reparent> %x {-x 2i} {[winfo pixels .b.f 2i]}}
- {<Map> %x {-x 2i} {{1 {<Map> event doesn't accept "-x" option}}}}
-
- {<Key> %y {-y xyz} {{1 {bad screen distance "xyz"}}}}
- {<Key> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Button> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<ButtonRelease> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Motion> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<<Paste>> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Enter> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Expose> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Configure> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Gravity> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Reparent> %y {-y 2i} {[winfo pixels .b.f 2i]}}
- {<Map> %y {-y 2i} {{1 {<Map> event doesn't accept "-y" option}}}}
-
- {<Key> %k {-xyz 1} {{1 {bad option "-xyz": must be -when, -above, -borderwidth, -button, -count, -delta, -detail, -focus, -height, -keycode, -keysym, -mode, -override, -place, -root, -rootx, -rooty, -sendevent, -serial, -state, -subwindow, -time, -warp, -width, -window, -x, or -y}}}}
+ {bind-22.19 <Configure> %a {-above .xyz} {{1 {bad window path name ".xyz"}}}}
+ {bind-22.20 <Configure> %a {-above .b} {[winfo id .b]}}
+ {bind-22.21 <Configure> %a {-above xyz} {{1 {bad window name/identifier "xyz"}}}}
+ {bind-22.22 <Configure> %a {-above [winfo id .b]} {[winfo id .b]}}
+ {bind-22.23 <Key> %b {-above .} {{1 {<Key> event doesn't accept "-above" option}}}}
+
+ {bind-22.24 <Configure> %B {-borderwidth xyz} {{1 {bad screen distance "xyz"}}}}
+ {bind-22.25 <Configure> %B {-borderwidth 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.26 <Key> %k {-borderwidth 2i} {{1 {<Key> event doesn't accept "-borderwidth" option}}}}
+
+ {bind-22.27 <Button> %b {-button xyz} {{1 {expected integer but got "xyz"}}}}
+ {bind-22.28 <Button> %b {-button 1} 1}
+ {bind-22.29 <ButtonRelease> %b {-button 1} 1}
+ {bind-22.30 <Key> %k {-button 1} {{1 {<Key> event doesn't accept "-button" option}}}}
+
+ {bind-22.31 <Expose> %c {-count xyz} {{1 {expected integer but got "xyz"}}}}
+ {bind-22.32 <Expose> %c {-count 20} 20}
+ {bind-22.33 <Key> %b {-count 20} {{1 {<Key> event doesn't accept "-count" option}}}}
+
+ {bind-22.34 <Enter> %d {-detail xyz} {{1 {bad -detail value "xyz": must be NotifyAncestor, NotifyVirtual, NotifyInferior, NotifyNonlinear, NotifyNonlinearVirtual, NotifyPointer, NotifyPointerRoot, or NotifyDetailNone}}}}
+ {bind-22.35 <FocusIn> %d {-detail NotifyVirtual} {{}}}
+ {bind-22.36 <Enter> %d {-detail NotifyVirtual} NotifyVirtual}
+ {bind-22.37 <Key> %k {-detail NotifyVirtual} {{1 {<Key> event doesn't accept "-detail" option}}}}
+
+ {bind-22.38 <Enter> %f {-focus xyz} {{1 {expected boolean value but got "xyz"}}}}
+ {bind-22.39 <Enter> %f {-focus 1} 1}
+ {bind-22.40 <Key> %k {-focus 1} {{1 {<Key> event doesn't accept "-focus" option}}}}
+
+ {bind-22.41 <Expose> %h {-height xyz} {{1 {bad screen distance "xyz"}}}}
+ {bind-22.42 <Expose> %h {-height 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.43 <Configure> %h {-height 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.44 <Key> %k {-height 2i} {{1 {<Key> event doesn't accept "-height" option}}}}
+
+ {bind-22.45 <Key> %k {-keycode xyz} {{1 {expected integer but got "xyz"}}}}
+ {bind-22.46 <Key> %k {-keycode 20} 20}
+ {bind-22.47 <Button> %b {-keycode 20} {{1 {<Button> event doesn't accept "-keycode" option}}}}
+
+ {bind-22.48 <Key> %K {-keysym xyz} {{1 {unknown keysym "xyz"}}}}
+ {bind-22.49 <Key> %K {-keysym a} a}
+ {bind-22.50 <Button> %b {-keysym a} {{1 {<Button> event doesn't accept "-keysym" option}}}}
+
+ {bind-22.51 <Enter> %m {-mode xyz} {{1 {bad -mode value "xyz": must be NotifyNormal, NotifyGrab, NotifyUngrab, or NotifyWhileGrabbed}}}}
+ {bind-22.52 <Enter> %m {-mode NotifyNormal} NotifyNormal}
+ {bind-22.53 <FocusIn> %m {-mode NotifyNormal} {{}}}
+ {bind-22.54 <Key> %k {-mode NotifyNormal} {{1 {<Key> event doesn't accept "-mode" option}}}}
+
+ {bind-22.55 <Map> %o {-override xyz} {{1 {expected boolean value but got "xyz"}}}}
+ {bind-22.56 <Map> %o {-override 1} 1}
+ {bind-22.57 <Reparent> %o {-override 1} 1}
+ {bind-22.58 <Configure> %o {-override 1} 1}
+ {bind-22.59 <Key> %k {-override 1} {{1 {<Key> event doesn't accept "-override" option}}}}
+
+ {bind-22.60 <Circulate> %p {-place xyz} {{1 {bad -place value "xyz": must be PlaceOnTop, or PlaceOnBottom}}}}
+ {bind-22.61 <Circulate> %p {-place PlaceOnTop} PlaceOnTop}
+ {bind-22.62 <Key> %k {-place PlaceOnTop} {{1 {<Key> event doesn't accept "-place" option}}}}
+
+ {bind-22.63 <Key> %R {-root .xyz} {{1 {bad window path name ".xyz"}}}}
+ {bind-22.64 <Key> %R {-root .b} {[winfo id .b]}}
+ {bind-22.65 <Key> %R {-root xyz} {{1 {bad window name/identifier "xyz"}}}}
+ {bind-22.66 <Key> %R {-root [winfo id .b]} {[winfo id .b]}}
+ {bind-22.67 <Button> %R {-root .b} {[winfo id .b]}}
+ {bind-22.68 <ButtonRelease> %R {-root .b} {[winfo id .b]}}
+ {bind-22.69 <Motion> %R {-root .b} {[winfo id .b]}}
+ {bind-22.70 <<Paste>> %R {-root .b} {[winfo id .b]}}
+ {bind-22.71 <Enter> %R {-root .b} {[winfo id .b]}}
+ {bind-22.72 <Configure> %R {-root .b} {{1 {<Configure> event doesn't accept "-root" option}}}}
+
+ {bind-22.73 <Key> %X {-rootx xyz} {{1 {bad screen distance "xyz"}}}}
+ {bind-22.74 <Key> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.75 <Button> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.76 <ButtonRelease> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.77 <Motion> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.78 <<Paste>> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.79 <Enter> %X {-rootx 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.80 <Configure> %X {-rootx 2i} {{1 {<Configure> event doesn't accept "-rootx" option}}}}
+
+ {bind-22.81 <Key> %Y {-rooty xyz} {{1 {bad screen distance "xyz"}}}}
+ {bind-22.82 <Key> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.83 <Button> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.84 <ButtonRelease> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.85 <Motion> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.86 <<Paste>> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.87 <Enter> %Y {-rooty 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.88 <Configure> %Y {-rooty 2i} {{1 {<Configure> event doesn't accept "-rooty" option}}}}
+
+ {bind-22.89 <Key> %E {-sendevent xyz} {{1 {expected boolean value but got "xyz"}}}}
+ {bind-22.90 <Key> %E {-sendevent 1} 1}
+ {bind-22.91 <Key> %E {-sendevent yes} 1}
+ {bind-22.92 <Key> %E {-sendevent 43} 43}
+
+ {bind-22.93 <Key> %# {-serial xyz} {{1 {expected integer but got "xyz"}}}}
+ {bind-22.94 <Key> %# {-serial 100} 100}
+
+ {bind-22.95 <Key> %s {-state xyz} {{1 {expected integer but got "xyz"}}}}
+ {bind-22.96 <Key> %s {-state 1} 1}
+ {bind-22.97 <Button> %s {-state 1025} 1025}
+ {bind-22.98 <ButtonRelease> %s {-state 1025} 1025}
+ {bind-22.99 <Motion> %s {-state 1} 1}
+ {bind-22.100 <<Paste>> %s {-state 1} 1}
+ {bind-22.101 <Enter> %s {-state 1} 1}
+ {bind-22.102 <Visibility> %s {-state xyz} {{1 {bad -state value "xyz": must be VisibilityUnobscured, VisibilityPartiallyObscured, or VisibilityFullyObscured}}}}
+ {bind-22.103 <Visibility> %s {-state VisibilityUnobscured} VisibilityUnobscured}
+ {bind-22.104 <Configure> %s {-state xyz} {{1 {<Configure> event doesn't accept "-state" option}}}}
+
+ {bind-22.105 <Key> %S {-subwindow .xyz} {{1 {bad window path name ".xyz"}}}}
+ {bind-22.106 <Key> %S {-subwindow .b} {[winfo id .b]}}
+ {bind-22.107 <Key> %S {-subwindow xyz} {{1 {bad window name/identifier "xyz"}}}}
+ {bind-22.108 <Key> %S {-subwindow [winfo id .b]} {[winfo id .b]}}
+ {bind-22.109 <Button> %S {-subwindow .b} {[winfo id .b]}}
+ {bind-22.110 <ButtonRelease> %S {-subwindow .b} {[winfo id .b]}}
+ {bind-22.111 <Motion> %S {-subwindow .b} {[winfo id .b]}}
+ {bind-22.112 <<Paste>> %S {-subwindow .b} {[winfo id .b]}}
+ {bind-22.113 <Enter> %S {-subwindow .b} {[winfo id .b]}}
+ {bind-22.114 <Configure> %S {-subwindow .b} {{1 {<Configure> event doesn't accept "-subwindow" option}}}}
+
+ {bind-22.115 <Key> %t {-time xyz} {{1 {expected integer but got "xyz"}}}}
+ {bind-22.116 <Key> %t {-time 100} 100}
+ {bind-22.117 <Button> %t {-time 100} 100}
+ {bind-22.118 <ButtonRelease> %t {-time 100} 100}
+ {bind-22.119 <Motion> %t {-time 100} 100}
+ {bind-22.120 <<Paste>> %t {-time 100} 100}
+ {bind-22.121 <Enter> %t {-time 100} 100}
+ {bind-22.122 <Property> %t {-time 100} 100}
+ {bind-22.123 <Configure> %t {-time 100} {{1 {<Configure> event doesn't accept "-time" option}}}}
+
+ {bind-22.124 <Expose> %w {-width xyz} {{1 {bad screen distance "xyz"}}}}
+ {bind-22.125 <Expose> %w {-width 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.126 <Configure> %w {-width 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.127 <Key> %k {-width 2i} {{1 {<Key> event doesn't accept "-width" option}}}}
+
+ {bind-22.128 <Unmap> %W {-window .xyz} {{1 {bad window path name ".xyz"}}}}
+ {bind-22.129 <Unmap> %W {-window .b.f} .b.f}
+ {bind-22.130 <Unmap> %W {-window xyz} {{1 {bad window name/identifier "xyz"}}}}
+ {bind-22.131 <Unmap> %W {-window [winfo id .b.f]} .b.f}
+ {bind-22.132 <Unmap> %W {-window .b.f} .b.f}
+ {bind-22.133 <Map> %W {-window .b.f} .b.f}
+ {bind-22.134 <Reparent> %W {-window .b.f} .b.f}
+ {bind-22.135 <Configure> %W {-window .b.f} .b.f}
+ {bind-22.136 <Gravity> %W {-window .b.f} .b.f}
+ {bind-22.137 <Circulate> %W {-window .b.f} .b.f}
+ {bind-22.138 <Key> %W {-window .b.f} {{1 {<Key> event doesn't accept "-window" option}}}}
+
+ {bind-22.139 <Key> %x {-x xyz} {{1 {bad screen distance "xyz"}}}}
+ {bind-22.140 <Key> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.141 <Button> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.142 <ButtonRelease> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.143 <Motion> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.144 <<Paste>> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.145 <Enter> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.146 <Expose> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.147 <Configure> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.148 <Gravity> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.149 <Reparent> %x {-x 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.150 <Map> %x {-x 2i} {{1 {<Map> event doesn't accept "-x" option}}}}
+
+ {bind-22.151 <Key> %y {-y xyz} {{1 {bad screen distance "xyz"}}}}
+ {bind-22.152 <Key> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.153 <Button> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.154 <ButtonRelease> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.155 <Motion> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.156 <<Paste>> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.157 <Enter> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.158 <Expose> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.159 <Configure> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.160 <Gravity> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.161 <Reparent> %y {-y 2i} {[winfo pixels .b.f 2i]}}
+ {bind-22.162 <Map> %y {-y 2i} {{1 {<Map> event doesn't accept "-y" option}}}}
+
+ {bind-22.163 <Key> %k {-xyz 1} {{1 {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}}}}
} {
- set event [lindex $check 0]
- test bind-22.$i "HandleEventGenerate: options $event [lindex $check 2]" {
+ lassign $check name event substitution generator result
+ test $name "HandleEventGenerate: options $event $generator" {
setup
- bind .b.f $event "lappend x [lindex $check 1]"
+ bind .b.f $event "lappend x $substitution"
set x {}
- if [catch {eval event gen .b.f $event [lindex $check 2]} msg] {
+ if [catch {eval event gen .b.f $event $generator} msg] {
set x [list 1 $msg]
}
set x
- } [eval set x [lindex $check 3]]
- incr i
+ } [eval set x $result]
}
+# Note that the -data option is tested in bind-32.* because it has
+# more demanding requirements in memory handling
+
test bind-23.1 {GetVirtualEventUid procedure} {
list [catch {event info <<asd} msg] $msg
} {1 {virtual event "<<asd" is badly formed}}
@@ -2369,114 +2365,106 @@ test bind-24.14 {FindSequence procedure: no binding} {
list [catch {.b.f bind $i <a>} msg] $msg
} {0 {}}
-test bind-25.1 {ParseEventDescription procedure} {
- list [catch {bind .b \x7 test} msg] $msg
-} {1 {bad ASCII character 0x7}}
-test bind-25.2 {ParseEventDescription procedure} {
- list [catch {bind .b "\x7f" test} msg] $msg
-} {1 {bad ASCII character 0x7f}}
-test bind-25.3 {ParseEventDescription procedure} {
- list [catch {bind .b "\x4" test} msg] $msg
-} {1 {bad ASCII character 0x4}}
-test bind-25.4 {ParseEventDescription procedure} {
+test bind-25.1 {ParseEventDescription procedure} -setup {
setup
+} -body {
bind .b.f a test
bind .b.f a
-} {test}
-test bind-25.5 {ParseEventDescription procedure: virtual} {
- list [catch {bind .b <<>> foo} msg] $msg
-} {1 {virtual event "<<>>" is badly formed}}
-test bind-25.6 {ParseEventDescription procedure: virtual} {
- list [catch {bind .b <<Paste foo} msg] $msg
-} {1 {missing ">" in virtual binding}}
-test bind-25.7 {ParseEventDescription procedure: virtual} {
- list [catch {bind .b <<Paste> foo} msg] $msg
-} {1 {missing ">" in virtual binding}}
-test bind-25.8 {ParseEventDescription procedure: correctly terminate virtual} {
- list [catch {bind .b <<Paste>>h foo} msg] $msg
-} {1 {virtual events may not be composed}}
-test bind-25.9 {ParseEventDescription procedure} {
- list [catch {bind .b <> test} msg] $msg
-} {1 {no event type or button # or keysym}}
-test bind-25.10 {ParseEventDescription procedure: misinterpreted modifier} {
+} -result test
+test bind-25.2 {ParseEventDescription procedure: misinterpreted modifier} -setup {
button .x
+} -body {
bind .x <Control-M> a
bind .x <M-M> b
- set x [lsort [bind .x]]
+ lsort [bind .x]
+} -cleanup {
destroy .x
- set x
-} {<Control-Key-M> <Meta-Key-M>}
-test bind-25.11 {ParseEventDescription procedure} {
+} -result {<Control-Key-M> <Meta-Key-M>}
+test bind-25.3 {ParseEventDescription procedure} -setup {
catch {destroy .b.f}
frame .b.f -class Test -width 150 -height 100
+} -body {
bind .b.f <a---> {nothing}
bind .b.f
-} a
-test bind-25.12 {ParseEventDescription procedure} {
- list [catch {bind .b <a-- test} msg] $msg
-} {1 {missing ">" in binding}}
-test bind-25.13 {ParseEventDescription procedure} {
- list [catch {bind .b <a-b> test} msg] $msg
-} {1 {extra characters after detail in binding}}
-test bind-25.14 {ParseEventDescription} {
- setup
- list [catch {bind .b <<abc {puts hi}} msg] $msg
-} {1 {missing ">" in virtual binding}}
-test bind-25.15 {ParseEventDescription} {
- setup
- list [catch {bind .b <<abc> {puts hi}} msg] $msg
-} {1 {missing ">" in virtual binding}}
-test bind-25.16 {ParseEventDescription} {
+} -result a
+test bind-25.4 {ParseEventDescription} -setup {
setup
+} -body {
bind .b <<Shift-Paste>> {puts hi}
bind .b
-} {<<Shift-Paste>>}
-test bind-25.17 {ParseEventDescription} {
- setup
- list [catch {event add <<xyz>> <<abc>>} msg] $msg
-} {1 {virtual event not allowed in definition of another virtual event}}
-set i 1
-foreach check {
- {{<Control- a>} <Control-Key-a>}
- {<Shift-a> <Shift-Key-a>}
- {<Lock-a> <Lock-Key-a>}
- {<Meta---a> <Meta-Key-a>}
- {<M-a> <Meta-Key-a>}
- {<Alt-a> <Alt-Key-a>}
- {<B1-a> <B1-Key-a>}
- {<B2-a> <B2-Key-a>}
- {<B3-a> <B3-Key-a>}
- {<B4-a> <B4-Key-a>}
- {<B5-a> <B5-Key-a>}
- {<Button1-a> <B1-Key-a>}
- {<Button2-a> <B2-Key-a>}
- {<Button3-a> <B3-Key-a>}
- {<Button4-a> <B4-Key-a>}
- {<Button5-a> <B5-Key-a>}
- {<M1-a> <Mod1-Key-a>}
- {<M2-a> <Mod2-Key-a>}
- {<M3-a> <Mod3-Key-a>}
- {<M4-a> <Mod4-Key-a>}
- {<M5-a> <Mod5-Key-a>}
- {<Mod1-a> <Mod1-Key-a>}
- {<Mod2-a> <Mod2-Key-a>}
- {<Mod3-a> <Mod3-Key-a>}
- {<Mod4-a> <Mod4-Key-a>}
- {<Mod5-a> <Mod5-Key-a>}
- {<Double-a> <Double-Key-a>}
- {<Triple-a> <Triple-Key-a>}
- {{<Double 1>} <Double-Button-1>}
- {<Triple-1> <Triple-Button-1>}
- {{<M1-M2 M3-M4 B1-Control-a>} <Control-B1-Mod1-Mod2-Mod3-Mod4-Key-a>}
+} -result {<<Shift-Paste>>}
+# Assorted error cases in event sequence parsing
+foreach {testname testinfo} {
+ bind-25.5 {\x7 {bad ASCII character 0x7}}
+ bind-25.6 {\x7f {bad ASCII character 0x7f}}
+ bind-25.7 {\x4 {bad ASCII character 0x4}}
+ bind-25.8 {<<>> {virtual event "<<>>" is badly formed}}
+ bind-25.9 {<<Paste {missing ">" in virtual binding}}
+ bind-25.10 {<<Paste> {missing ">" in virtual binding}}
+ bind-25.11 {<<Paste>>h {virtual events may not be composed}}
+ bind-25.12 {<> "no event type or button # or keysym"}
+ bind-25.13 {<a-- {missing ">" in binding}}
+ bind-25.14 {<a-b> {extra characters after detail in binding}}
+ bind-25.15 {<<abc {missing ">" in virtual binding}}
+ bind-25.16 {<<abc> {missing ">" in virtual binding}}
+} {
+ lassign $testinfo sequence errorMessage
+ test $testname {ParseEventDescription procedure error cases} \
+ -setup { setup } \
+ -body [list bind .b $sequence {puts hi}] \
+ -returnCodes error -result $errorMessage
+}
+test bind-25.17 {ParseEventDescription} -setup {
+ setup
+} -returnCodes error -body {
+ event add <<xyz>> <<abc>>
+} -result {virtual event not allowed in definition of another virtual event}
+# Modifier canonicalization tests
+foreach {name check} {
+ bind-25.18 {{<Control- a>} <Control-Key-a>}
+ bind-25.19 {<Shift-a> <Shift-Key-a>}
+ bind-25.20 {<Lock-a> <Lock-Key-a>}
+ bind-25.21 {<Meta---a> <Meta-Key-a>}
+ bind-25.22 {<M-a> <Meta-Key-a>}
+ bind-25.23 {<Alt-a> <Alt-Key-a>}
+ bind-25.24 {<B1-a> <B1-Key-a>}
+ bind-25.25 {<B2-a> <B2-Key-a>}
+ bind-25.26 {<B3-a> <B3-Key-a>}
+ bind-25.27 {<B4-a> <B4-Key-a>}
+ bind-25.28 {<B5-a> <B5-Key-a>}
+ bind-25.29 {<Button1-a> <B1-Key-a>}
+ bind-25.30 {<Button2-a> <B2-Key-a>}
+ bind-25.31 {<Button3-a> <B3-Key-a>}
+ bind-25.32 {<Button4-a> <B4-Key-a>}
+ bind-25.33 {<Button5-a> <B5-Key-a>}
+ bind-25.34 {<M1-a> <Mod1-Key-a>}
+ bind-25.35 {<M2-a> <Mod2-Key-a>}
+ bind-25.36 {<M3-a> <Mod3-Key-a>}
+ bind-25.37 {<M4-a> <Mod4-Key-a>}
+ bind-25.38 {<M5-a> <Mod5-Key-a>}
+ bind-25.39 {<Mod1-a> <Mod1-Key-a>}
+ bind-25.40 {<Mod2-a> <Mod2-Key-a>}
+ bind-25.41 {<Mod3-a> <Mod3-Key-a>}
+ bind-25.42 {<Mod4-a> <Mod4-Key-a>}
+ bind-25.43 {<Mod5-a> <Mod5-Key-a>}
+ bind-25.44 {<Double-a> <Double-Key-a>}
+ bind-25.45 {<Triple-a> <Triple-Key-a>}
+ bind-25.46 {{<Double 1>} <Double-Button-1>}
+ bind-25.47 {<Triple-1> <Triple-Button-1>}
+ bind-25.48 {{<M1-M2 M3-M4 B1-Control-a>}
+ <Control-B1-Mod1-Mod2-Mod3-Mod4-Key-a>}
+ bind-25.49 {<Extended-Return> <Extended-Key-Return>}
} {
- test bind-25.$i {modifier names} {
+ lassign $check shortBind longBind
+ test $name {modifier names} -setup {
catch {destroy .b.f}
frame .b.f -class Test -width 150 -height 100
- bind .b.f [lindex $check 0] foo
+ } -body {
+ bind .b.f $shortBind foo
bind .b.f
- } [lindex $check 1]
- bind .b.f [lindex $check 1] {}
- incr i
+ } -result $longBind -cleanup {
+ bind .b.f [lindex $check 1] {}
+ }
}
foreach event [bind Test] {
@@ -2504,72 +2492,97 @@ test bind-26.3 {event names} {
destroy .b.f
set x
} {<Destroy> destroyed}
-set i 4
foreach check {
- {Motion Motion}
- {Button Button}
- {ButtonPress Button}
- {ButtonRelease ButtonRelease}
- {Colormap Colormap}
- {Enter Enter}
- {Leave Leave}
- {Expose Expose}
- {Key Key}
- {KeyPress Key}
- {KeyRelease KeyRelease}
- {Property Property}
- {Visibility Visibility}
- {Activate Activate}
- {Deactivate Deactivate}
+ {bind-26.4 Motion Motion}
+ {bind-26.5 Button Button}
+ {bind-26.6 ButtonPress Button}
+ {bind-26.7 ButtonRelease ButtonRelease}
+ {bind-26.8 Colormap Colormap}
+ {bind-26.9 Enter Enter}
+ {bind-26.10 Leave Leave}
+ {bind-26.11 Expose Expose}
+ {bind-26.12 Key Key}
+ {bind-26.13 KeyPress Key}
+ {bind-26.14 KeyRelease KeyRelease}
+ {bind-26.15 Property Property}
+ {bind-26.16 Visibility Visibility}
+ {bind-26.17 Activate Activate}
+ {bind-26.18 Deactivate Deactivate}
} {
- set event [lindex $check 0]
- test bind-26.$i {event names} {
+ lassign $check name event canonicalEvent
+ test $name "event names: $event" {
setup
bind .b.f <$event> "set x {event $event}"
set x xyzzy
event gen .b.f <$event>
list $x [bind .b.f]
- } [list "event $event" <[lindex $check 1]>]
- incr i
+ } [list "event $event" <$canonicalEvent>]
}
+# These events require an extra argument to [event generate]
foreach check {
- {Circulate Circulate}
- {Configure Configure}
- {Gravity Gravity}
- {Map Map}
- {Reparent Reparent}
- {Unmap Unmap}
+ {bind-26.19 Circulate Circulate}
+ {bind-26.20 Configure Configure}
+ {bind-26.21 Gravity Gravity}
+ {bind-26.22 Map Map}
+ {bind-26.23 Reparent Reparent}
+ {bind-26.24 Unmap Unmap}
} {
- set event [lindex $check 0]
- test bind-26.$i {event names} {
+ lassign $check name event canonicalEvent
+ test $name "event names: $event" {
setup
bind .b.f <$event> "set x {event $event}"
set x xyzzy
event gen .b.f <$event> -window .b.f
list $x [bind .b.f]
- } [list "event $event" <[lindex $check 1]>]
- incr i
+ } [list "event $event" <$canonicalEvent>]
}
-
test bind-27.1 {button names} {
list [catch {bind .b <Expose-1> foo} msg] $msg
} {1 {specified button "1" for non-button event}}
test bind-27.2 {button names} {
list [catch {bind .b <Button-6> foo} msg] $msg
} {1 {specified keysym "6" for non-key event}}
-set i 3
-foreach button {1 2 3 4 5} {
- test bind-27.$i {button names} {
- setup
- bind .b.f <Button-$button> "lappend x \"button $button\""
- set x [bind .b.f]
- event gen .b.f <Button-$button>
- event gen .b.f <ButtonRelease-$button>
- set x
- } [list <Button-$button> "button $button"]
- incr i
-}
+test bind-27.3 {button names} {
+ setup
+ bind .b.f <Button-1> {lappend x "button 1"}
+ set x [bind .b.f]
+ event gen .b.f <Button-1>
+ event gen .b.f <ButtonRelease-1>
+ set x
+} {<Button-1> {button 1}}
+test bind-27.4 {button names} {
+ setup
+ bind .b.f <Button-2> {lappend x "button 2"}
+ set x [bind .b.f]
+ event gen .b.f <Button-2>
+ event gen .b.f <ButtonRelease-2>
+ set x
+} {<Button-2> {button 2}}
+test bind-27.5 {button names} {
+ setup
+ bind .b.f <Button-3> {lappend x "button 3"}
+ set x [bind .b.f]
+ event gen .b.f <Button-3>
+ event gen .b.f <ButtonRelease-3>
+ set x
+} {<Button-3> {button 3}}
+test bind-27.6 {button names} {
+ setup
+ bind .b.f <Button-4> {lappend x "button 4"}
+ set x [bind .b.f]
+ event gen .b.f <Button-4>
+ event gen .b.f <ButtonRelease-4>
+ set x
+} {<Button-4> {button 4}}
+test bind-27.7 {button names} {
+ setup
+ bind .b.f <Button-5> {lappend x "button 5"}
+ set x [bind .b.f]
+ event gen .b.f <Button-5>
+ event gen .b.f <ButtonRelease-5>
+ set x
+} {<Button-5> {button 5}}
test bind-28.1 {keysym names} {
list [catch {bind .b <Expose-a> foo} msg] $msg
@@ -2586,46 +2599,41 @@ test bind-28.4 {keysym names} {
bind .b.f <a> foo
bind .b.f
} a
-set i 5
foreach check {
- {a 0 a}
- {space 0 <Key-space>}
- {Return 0 <Key-Return>}
- {X 1 X}
+ {bind-28.5 a 0 a}
+ {bind-28.6 space 0 <Key-space>}
+ {bind-28.7 Return 0 <Key-Return>}
+ {bind-28.8 X 1 X}
} {
- set keysym [lindex $check 0]
- test bind-28.$i {keysym names} {
+ lassign $check name keysym state result
+ test $name {keysym names} {
setup
bind .b.f <Key-$keysym> "lappend x \"keysym $keysym\""
bind .b.f <Key-x> "lappend x {bad binding match}"
set x [lsort [bind .b.f]]
- event gen .b.f <Key-$keysym> -state [lindex $check 1]
+ event gen .b.f <Key-$keysym> -state $state
set x
- } [concat [lsort "x [lindex $check 2]"] "{keysym $keysym}"]
- incr i
+ } [concat [lsort "x $result"] "{keysym $keysym}"]
}
test bind-29.1 {dummy test to help ensure proper numbering} {} {}
setup
bind .b.f <KeyPress> {set x %K}
-set i 2
foreach check {
- {a 0 a}
- {x 1 X}
- {x 2 X}
- {space 0 space}
- {F1 1 F1}
+ {bind-29.2 a 0 a}
+ {bind-29.3 x 1 X}
+ {bind-29.4 x 2 X}
+ {bind-29.5 space 0 space}
+ {bind-29.6 F1 1 F1}
} {
- test bind-29.$i {GetKeySym procedure} {nonPortable} {
+ lassign $check name keysym state result
+ test $name {GetKeySym procedure} nonPortable {
set x nothing
- event gen .b.f <KeyPress> -keysym [lindex $check 0] \
- -state [lindex $check 1]
+ event gen .b.f <KeyPress> -keysym $keysym -state $state
set x
- } [lindex $check 2]
- incr i
+ } $result
}
-
proc bgerror msg {
global x errorInfo
set x [list $msg $errorInfo]
@@ -2673,7 +2681,7 @@ test bind-31.2 {MouseWheel events} {
event gen .b.f <MouseWheel> -delta 120
set x
} {120}
-test bind-31.2 {MouseWheel events} {
+test bind-31.3 {MouseWheel events} {
setup
set x {}
bind .b.f <MouseWheel> {set x "%D %x %y"}
@@ -2681,8 +2689,64 @@ test bind-31.2 {MouseWheel events} {
set x
} {240 10 30}
+test bind-32.1 {virtual event user_data field - bad generation} {
+ setup
+ # Check no confusion, since Focus events use %d for something else
+ list [catch {event gen .b.f <FocusIn> -data foo} msg] $msg
+} {1 {<FocusIn> event doesn't accept "-data" option}}
+test bind-32.2 {virtual event user_data field - NULL, synch} {
+ setup
+ set x {}
+ bind .b.f <<TestUserData>> {set x "TestUserData >%d<"}
+ event gen .b.f <<TestUserData>>
+ set x
+} {TestUserData >{}<}
+test bind-32.3 {virtual event user_data field - shared, synch} {
+ setup
+ set x {}
+ bind .b.f <<TestUserData>> {set x "TestUserData >%d<"}
+ event gen .b.f <<TestUserData>> -data "foo bar"
+ set x
+} {TestUserData >foo bar<}
+test bind-32.4 {virtual event user_data field - unshared, synch} {
+ setup
+ set x {}
+ bind .b.f <<TestUserData>> {set x "TestUserData >%d<"}
+ event gen .b.f <<TestUserData>> -data [string index abc 1]
+ set x
+} {TestUserData >b<}
+# Note that asynch event handling can only really catch any potential
+# extra errors when used in combination with a tool like Purify or
+# Valgrind. Such testing is rarely done, but at least any problem with
+# reference handling will eventually show up with these tests...
+test bind-32.5 {virtual event user_data field - NULL, asynch} {
+ setup
+ set x {}
+ bind .b.f <<TestUserData>> {set x "TestUserData >%d<"}
+ event gen .b.f <<TestUserData>> -when head
+ list $x [update] $x
+} {{} {} {TestUserData >{}<}}
+test bind-32.6 {virtual event user_data field - shared, asynch} {
+ setup
+ set x {}
+ bind .b.f <<TestUserData>> {set x "TestUserData >%d<"}
+ event gen .b.f <<TestUserData>> -data "foo bar" -when head
+ list $x [update] $x
+} {{} {} {TestUserData >foo bar<}}
+test bind-32.7 {virtual event user_data field - unshared, asynch} {
+ setup
+ set x {}
+ bind .b.f <<TestUserData>> {set x "TestUserData >%d<"}
+ event gen .b.f <<TestUserData>> -data [string index abc 1] -when head
+ list $x [update] $x
+} {{} {} {TestUserData >b<}}
+
destroy .b
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/tests/bitmap.test b/tests/bitmap.test
index e79866a..6e2255c 100644
--- a/tests/bitmap.test
+++ b/tests/bitmap.test
@@ -7,14 +7,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint testbitmap [llength [info commands testbitmap]]
-
test bitmap-1.1 {Tk_AllocBitmapFromObj - converting internal reps} testbitmap {
set x gray25
lindex $x 0
@@ -92,18 +87,5 @@ test bitmap-4.1 {FreeBitmapObjProc} testbitmap {
destroy .t
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/border.test b/tests/border.test
index e38502a..30aed91 100644
--- a/tests/border.test
+++ b/tests/border.test
@@ -6,14 +6,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint testborder [llength [info commands testborder]]
-
if {[testConstraint pseudocolor8]} {
toplevel .t -visual {pseudocolor 8} -colormap new
wm geom .t +0+0
@@ -129,31 +124,31 @@ test border-4.1 {FreeBorderObjProc} testborder {
catch {destroy .b}
button .b
-test get-2.1 {Tk_GetReliefFromObj} {
+test border-5.1 {Tk_GetReliefFromObj} {
.b configure -relief flat
.b cget -relief
} {flat}
-test get-2.2 {Tk_GetReliefFromObj} {
+test border-5.2 {Tk_GetReliefFromObj} {
.b configure -relief groove
.b cget -relief
} {groove}
-test get-2.3 {Tk_GetReliefFromObj} {
+test border-5.3 {Tk_GetReliefFromObj} {
.b configure -relief raised
.b cget -relief
} {raised}
-test get-2.3 {Tk_GetReliefFromObj} {
+test border-5.4 {Tk_GetReliefFromObj} {
.b configure -relief ridge
.b cget -relief
} {ridge}
-test get-2.3 {Tk_GetReliefFromObj} {
+test border-5.5 {Tk_GetReliefFromObj} {
.b configure -relief solid
.b cget -relief
} {solid}
-test get-2.3 {Tk_GetReliefFromObj} {
+test border-5.6 {Tk_GetReliefFromObj} {
.b configure -relief sunken
.b cget -relief
} {sunken}
-test get-2.4 {Tk_GetReliefFromObj - error} {
+test border-5.7 {Tk_GetReliefFromObj - error} {
list [catch {.b configure -relief upanddown} msg] $msg
} {1 {bad relief "upanddown": must be flat, groove, raised, ridge, solid, or sunken}}
@@ -162,18 +157,5 @@ if {[testConstraint pseudocolor8]} {
}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/button.test b/tests/button.test
index c1bfb46..927aac0 100644
--- a/tests/button.test
+++ b/tests/button.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
proc bogusTrace args {
@@ -43,7 +40,9 @@ foreach test {
{unknown color name "non-existent"} {1 1 1 1}}
{-activeforeground #ff0000 #ff0000 non-existent
{unknown color name "non-existent"} {1 1 1 1}}
- {-anchor nw nw bogus {bad anchor "bogus": must be n, ne, e, se, s, sw, w, nw, or center} {1 1 1 1}}
+ {-anchor nw nw bogus
+ {bad anchor "bogus": must be n, ne, e, se, s, sw, w, nw, or center}
+ {1 1 1 1}}
{-background #ff0000 #ff0000 non-existent
{unknown color name "non-existent"} {1 1 1 1}}
{-bd 4 4 badValue {bad screen distance "badValue"} {1 1 1 1}}
@@ -53,7 +52,9 @@ foreach test {
{1 1 1 1}}
{-borderwidth 1.3 1.3 badValue {bad screen distance "badValue"} {1 1 1 1}}
{-command "set x" {set x} {} {} {0 1 1 1}}
- {-compound left left bogus {bad compound "bogus": must be bottom, center, left, none, right, or top} {1 1 1 1}}
+ {-compound left left bogus
+ {bad compound "bogus": must be bottom, center, left, none, right, or top}
+ {1 1 1 1}}
{-cursor arrow arrow badValue {bad cursor spec "badValue"} {1 1 1 1}}
{-default active active huh?
{bad default "huh?": must be active, disabled, or normal}
@@ -73,51 +74,70 @@ foreach test {
{-image image1 image1 bogus {image "bogus" doesn't exist} {1 1 1 1}}
{-indicatoron yes 1 no_way {expected boolean value but got "no_way"}
{0 0 1 1}}
- {-justify right right bogus {bad justification "bogus": must be left, right, or center} {1 1 1 1}}
- {-offrelief flat flat 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} {0 0 1 1}}
+ {-justify right right bogus
+ {bad justification "bogus": must be left, right, or center}
+ {1 1 1 1}}
+ {-offrelief flat flat 1.5
+ {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}
+ {0 0 1 1}}
{-offvalue lousy lousy {} {} {0 0 1 0}}
- {-offvalue fantastic fantastic {} {} {0 0 1 0}}
- {-overrelief "" "" 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} {0 1 1 1}}
+ {-onvalue fantastic fantastic {} {} {0 0 1 0}}
+ {-overrelief "" "" 1.5
+ {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}
+ {0 1 1 1}}
{-padx 12m 12m 420x {bad screen distance "420x"} {1 1 1 1}}
{-pady 12m 12m 420x {bad screen distance "420x"} {1 1 1 1}}
{-repeatdelay 100 100 foo {expected integer but got "foo"} {0 1 0 0}}
{-repeatinterval 100 100 foo {expected integer but got "foo"} {0 1 0 0}}
- {-relief flat flat 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} {1 1 1 1}}
+ {-relief flat flat 1.5
+ {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}
+ {1 1 1 1}}
{-selectcolor #110022 #110022 bogus {unknown color name "bogus"} {0 0 1 1}}
{-selectimage image1 image1 bogus {image "bogus" doesn't exist} {0 0 1 1}}
- {-state normal normal bogus {bad state "bogus": must be active, disabled, or normal} {1 1 1 1}}
+ {-state normal normal bogus
+ {bad state "bogus": must be active, disabled, or normal}
+ {1 1 1 1}}
{-takefocus "any string" "any string" {} {} {1 1 1 1}}
{-text "Sample text" {Sample text} {} {} {1 1 1 1}}
{-textvariable i i {} {} {1 1 1 1}}
+ {-tristateimage image1 image1 bogus {image "bogus" doesn't exist}
+ {0 0 1 1}}
+ {-tristatevalue unknowable unknowable {} {} {0 0 1 1}}
{-underline 5 5 3p {expected integer but got "3p"} {1 1 1 1}}
{-value anyString anyString {} {} {0 0 0 1}}
{-width 402 402 3p {expected integer but got "3p"} {1 1 1 1}}
{-wraplength 100 100 6x {bad screen distance "6x"} {1 1 1 1}}
} {
- set name [lindex $test 0]
- set classes [lindex $test 5]
- foreach w {.l .b .c .r} hasOption [lindex $test 5] {
- if $hasOption {
- test button-1.$i {configuration options} testImageType {
- $w configure $name [lindex $test 1]
- lindex [$w configure $name] 4
- } [lindex $test 2]
+ lassign $test name value okResult badValue badResult classes
+ foreach w {.l .b .c .r} hasOption $classes {
+ set classname [winfo class $w]
+ if {$hasOption} {
+ test button-1.$i "configuration option $name for $classname" \
+ -constraints testImageType -body "
+ $w configure $name [list $value]
+ lindex \[$w configure $name] 4
+ " -result $okResult
incr i
- if {[lindex $test 3] != ""} {
- test button-1.$i {configuration options} testImageType {
- list [catch {$w configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test button-1.$i "configuration option $name for $classname" \
+ -constraints testImageType \
+ -body [list $w configure $name $badValue] \
+ -returnCodes error -result $badResult
+ incr i
}
$w configure $name [lindex [$w configure $name] 3]
} else {
- test button-1.$i {configuration options} testImageType {
- list [catch {$w configure $name [lindex $test 1]} msg] $msg
- } "1 {unknown option \"$name\"}"
+ test button-1.$i "configuration option $name for $classname" \
+ -constraints testImageType \
+ -body [list $w configure $name $value] \
+ -returnCodes error -result "unknown option \"$name\""
+ incr i
}
}
- incr i
}
test button-1.$i {configuration options} {
+ # Additional check to make sure that -selectcolor may be empty in
+ # checkbox widgets
.c configure -selectcolor {}
} {}
@@ -216,7 +236,7 @@ test button-4.13 {ButtonWidgetCmd procedure, "cget" option} {
} {1 {unknown option "-onvalue"}}
test button-4.14 {ButtonWidgetCmd procedure, "configure" option} {
llength [.c configure]
-} {39}
+} {41}
test button-4.15 {ButtonWidgetCmd procedure, "configure" option} {
list [catch {.b configure -gorp} msg] $msg
} {1 {unknown option "-gorp"}}
@@ -254,23 +274,25 @@ test button-4.23 {ButtonWidgetCmd procedure, "deselect" option} {
.r deselect
set value2
} {}
-test button-4.24 {ButtonWidgetCmd procedure, "deselect" option} {
+test button-4.24 {ButtonWidgetCmd procedure, "deselect" option} -body {
set value 1
trace variable value w bogusTrace
set result [list [catch {.c deselect} msg] $msg $errorInfo $value]
trace vdelete value w bogusTrace
set result
-} {1 {can't set "value": trace aborted} {can't set "value": trace aborted
+} -match glob -result {1 {can't set "value": trace aborted} {*trace aborted
while executing
+*
".c deselect"} 0}
-test button-4.25 {ButtonWidgetCmd procedure, "deselect" option} {
+test button-4.25 {ButtonWidgetCmd procedure, "deselect" option} -body {
set value2 red
trace variable value2 w bogusTrace
set result [list [catch {.r deselect} msg] $msg $errorInfo $value2]
trace vdelete value2 w bogusTrace
set result
-} {1 {can't set "value2": trace aborted} {can't set "value2": trace aborted
+} -match glob -result {1 {can't set "value2": trace aborted} {*trace aborted
while executing
+*
".r deselect"} {}}
test button-4.26 {ButtonWidgetCmd procedure, "flash" option} {
list [catch {.b flash foo} msg] $msg
@@ -341,14 +363,15 @@ test button-4.41 {ButtonWidgetCmd procedure, "select" option} {
.r select
set value2
} {red}
-test button-4.42 {ButtonWidgetCmd procedure, "select" option} {
+test button-4.42 {ButtonWidgetCmd procedure, "select" option} -body {
set value2 yellow
trace variable value2 w bogusTrace
set result [list [catch {.r select} msg] $msg $errorInfo $value2]
trace vdelete value2 w bogusTrace
set result
-} {1 {can't set "value2": trace aborted} {can't set "value2": trace aborted
+} -match glob -result {1 {can't set "value2": trace aborted} {*trace aborted
while executing
+*
".r select"} red}
test button-4.43 {ButtonWidgetCmd procedure, "toggle" option} {
list [catch {.l toggle} msg] $msg
@@ -372,25 +395,27 @@ test button-4.47 {ButtonWidgetCmd procedure, "toggle" option} {
.c toggle
lappend result $value
} {sunshine rain sunshine}
-test button-4.48 {ButtonWidgetCmd procedure, "toggle" option} {
+test button-4.48 {ButtonWidgetCmd procedure, "toggle" option} -body {
.c configure -onvalue xyz -offvalue abc
set value xyz
trace variable value w bogusTrace
set result [list [catch {.c toggle} msg] $msg $errorInfo $value]
trace vdelete value w bogusTrace
set result
-} {1 {can't set "value": trace aborted} {can't set "value": trace aborted
+} -match glob -result {1 {can't set "value": trace aborted} {*trace aborted
while executing
+*
".c toggle"} abc}
-test button-4.49 {ButtonWidgetCmd procedure, "toggle" option} {
+test button-4.49 {ButtonWidgetCmd procedure, "toggle" option} -body {
.c configure -onvalue xyz -offvalue abc
set value abc
trace variable value w bogusTrace
set result [list [catch {.c toggle} msg] $msg $errorInfo $value]
trace vdelete value w bogusTrace
set result
-} {1 {can't set "value": trace aborted} {can't set "value": trace aborted
+} -match glob -result {1 {can't set "value": trace aborted} {*trace aborted
while executing
+*
".c toggle"} xyz}
test button-4.50 {ButtonWidgetCmd procedure, "toggle" option} {
catch {unset value}; set value(1) 1;
@@ -430,7 +455,7 @@ test button-6.2 {ConfigureButton - textvariable trace} {
set x New
lindex [.b1 configure -text] 4
} {From-y}
-test button-6.2 {ConfigureButton - variable traces} {
+test button-6.2a {ConfigureButton - variable traces} {
catch {destroy .b1}
catch {unset x}
checkbutton .b1 -variable x
@@ -626,7 +651,7 @@ test button-9.4 {TkInvokeButton procedure} {
.b1 invoke
lappend result $x
} {0 red red}
-test button-9.5 {TkInvokeButton procedure} {
+test button-9.5 {TkInvokeButton procedure} -body {
catch {destroy .b1}
radiobutton .b1 -variable x -value red
set x green
@@ -634,8 +659,9 @@ test button-9.5 {TkInvokeButton procedure} {
set result [list [catch {.b1 invoke} msg] $msg $errorInfo $x]
trace vdelete x w bogusTrace
set result
-} {1 {can't set "x": trace aborted} {can't set "x": trace aborted
+} -match glob -result {1 {can't set "x": trace aborted} {*trace aborted
while executing
+*
".b1 invoke"} red}
test button-9.6 {TkInvokeButton procedure} {
deleteWindows
@@ -806,5 +832,5 @@ deleteWindows
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/canvImg.test b/tests/canvImg.test
index 083c5c0..1dffc5e 100644
--- a/tests/canvImg.test
+++ b/tests/canvImg.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
eval image delete [image names]
@@ -129,13 +126,14 @@ test canvImg-5.1 {DeleteImage procedure} testImageType {
.c delete all
.c create image 50 100 -image xyzzy -tags i1
update
+ set names [lsort [image names]]
image delete xyzzy
set z {}
- set names [lsort [image names]]
+ set names2 [lsort [image names]]
.c delete i1
update
- list $names $z [lsort [image names]]
-} {{foo foo2 xyzzy} {} {foo foo2}}
+ list $names $names2 $z [lsort [image names]]
+} {{foo foo2 xyzzy} {foo foo2} {} {foo foo2}}
test canvImg-5.2 {DeleteImage procedure (don't delete non-existent image)} {
.c delete all
.c create image 50 100 -tags i1
@@ -225,37 +223,36 @@ test canvImg-7.2 {DisplayImage procedure, no image} {
update
} {}
-set i 1
.c delete all
if {[testConstraint testImageType]} {
.c create image 50 100 -image foo -tags image -anchor nw
}
.c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {}
foreach check {
- {{50 70 80 81} {70 90} {rect}}
- {{50 70 80 79} {70 90} {image}}
- {{99 70 110 81} {90 90} {rect}}
- {{101 70 110 79} {90 90} {image}}
- {{99 100 110 115} {90 110} {rect}}
- {{101 100 110 115} {90 110} {image}}
- {{99 134 110 145} {90 125} {rect}}
- {{101 136 110 145} {90 125} {image}}
- {{50 134 80 145} {70 125} {rect}}
- {{50 136 80 145} {70 125} {image}}
- {{20 134 31 145} {40 125} {rect}}
- {{20 136 29 145} {40 125} {image}}
- {{20 100 31 115} {40 110} {rect}}
- {{20 100 29 115} {40 110} {image}}
- {{20 70 31 80} {40 90} {rect}}
- {{20 70 29 79} {40 90} {image}}
- {{60 70 69 109} {70 110} {image}}
- {{60 70 71 111} {70 110} {rect}}
+ {canvImg-8.1 {50 70 80 81} {70 90} rect}
+ {canvImg-8.2 {50 70 80 79} {70 90} image}
+ {canvImg-8.3 {99 70 110 81} {90 90} rect}
+ {canvImg-8.4 {101 70 110 79} {90 90} image}
+ {canvImg-8.5 {99 100 110 115} {90 110} rect}
+ {canvImg-8.6 {101 100 110 115} {90 110} image}
+ {canvImg-8.7 {99 134 110 145} {90 125} rect}
+ {canvImg-8.8 {101 136 110 145} {90 125} image}
+ {canvImg-8.9 {50 134 80 145} {70 125} rect}
+ {canvImg-8.10 {50 136 80 145} {70 125} image}
+ {canvImg-8.11 {20 134 31 145} {40 125} rect}
+ {canvImg-8.12 {20 136 29 145} {40 125} image}
+ {canvImg-8.13 {20 100 31 115} {40 110} rect}
+ {canvImg-8.14 {20 100 29 115} {40 110} image}
+ {canvImg-8.15 {20 70 31 80} {40 90} rect}
+ {canvImg-8.16 {20 70 29 79} {40 90} image}
+ {canvImg-8.17 {60 70 69 109} {70 110} image}
+ {canvImg-8.18 {60 70 71 111} {70 110} rect}
} {
- test canvImg-8.$i {ImageToPoint procedure} testImageType {
- eval .c coords rect [lindex $check 0]
- .c gettags [eval .c find closest [lindex $check 1]]
- } [lindex $check 2]
- incr i
+ lassign $check name rectCoords testPoint result
+ test $name {ImageToPoint procedure} testImageType {
+ .c coords rect {*}$rectCoords
+ .c gettags [.c find closest {*}$testPoint]
+ } $result
}
.c delete all
@@ -390,18 +387,5 @@ test canvImg-11.3 {ImageChangedProc procedure} testImageType {
} {{foo2 display 0 0 20 40 50 40}}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/canvPs.test b/tests/canvPs.test
index 387a447..f2df447 100644
--- a/tests/canvPs.test
+++ b/tests/canvPs.test
@@ -7,50 +7,66 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
-
canvas .c -width 400 -height 300 -bd 2 -relief sunken
.c create rectangle 20 20 80 80 -fill red
pack .c
update
-test canvPs-1.1 {test writing to a file} {unixOrPc} {
- removeFile foo.ps
- .c postscript -file foo.ps
- file exists foo.ps
-} 1
-test canvPs-1.2 {test writing to a file, idempotency} {unixOrPc} {
+test canvPs-1.1 {test writing to a file} -constraints {
+ unixOrPc
+} -setup {
+ set foo [makeFile {} foo.ps]
+} -body {
+ .c postscript -file $foo
+ file exists $foo
+} -cleanup {
removeFile foo.ps
- removeFile bar.ps
- .c postscript -file foo.ps
- .c postscript -file bar.ps
+} -result 1
+test canvPs-1.2 {test writing to a file, idempotency} -constraints {
+ unixOrPc
+} -setup {
+ set foo [makeFile {} foo.ps]
+ set bar [makeFile {} bar.ps]
+} -body {
+ .c postscript -file $foo
+ .c postscript -file $bar
set status ok
- if {[file size bar.ps] != [file size foo.ps]} {
+ if {[file size $bar] != [file size $foo]} {
set status broken
}
set status
-} ok
-
-test canvPs-2.1 {test writing to a channel} {unixOrPc} {
+} -cleanup {
removeFile foo.ps
- set chan [open foo.ps w]
+ removeFile bar.ps
+} -result ok
+
+test canvPs-2.1 {test writing to a channel} -constraints {
+ unixOrPc
+} -setup {
+ set foo [makeFile {} foo.ps]
+ file delete $foo
+} -body {
+ set chan [open $foo w]
fconfigure $chan -translation lf
.c postscript -channel $chan
close $chan
- file exists foo.ps
-} 1
-test canvPs-2.2 {test writing to channel, idempotency} {unixOrPc} {
+ file exists $foo
+} -cleanup {
removeFile foo.ps
- removeFile bar.ps
- set c1 [open foo.ps w]
- set c2 [open bar.ps w]
+} -result 1
+test canvPs-2.2 {test writing to channel, idempotency} -constraints {
+ unixOrPc
+} -setup {
+ set foo [makeFile {} foo.ps]
+ set bar [makeFile {} bar.ps]
+ file delete $foo
+ file delete $bar
+} -body {
+ set c1 [open $foo w]
+ set c2 [open $bar w]
fconfigure $c1 -translation lf
fconfigure $c2 -translation lf
.c postscript -channel $c1
@@ -58,42 +74,65 @@ test canvPs-2.2 {test writing to channel, idempotency} {unixOrPc} {
close $c1
close $c2
set status ok
- if {[file size bar.ps] != [file size foo.ps]} {
+ if {[file size $bar] != [file size $foo]} {
set status broken
}
set status
-} ok
-test canvPs-2.3 {test writing to channel and file, same output} {unixOnly} {
+} -cleanup {
removeFile foo.ps
removeFile bar.ps
- set c1 [open foo.ps w]
+} -result ok
+test canvPs-2.3 {test writing to channel and file, same output} -constraints {
+ unix
+} -setup {
+ set foo [makeFile {} foo.ps]
+ set bar [makeFile {} bar.ps]
+ file delete $foo
+ file delete $bar
+} -body {
+ set c1 [open $foo w]
fconfigure $c1 -translation lf
.c postscript -channel $c1
close $c1
- .c postscript -file bar.ps
+ .c postscript -file $bar
set status ok
- if {[file size foo.ps] != [file size bar.ps]} {
+ if {[file size $foo] != [file size $bar]} {
set status broken
}
set status
-} ok
-test canvPs-2.4 {test writing to channel and file, same output} {pcOnly} {
+} -cleanup {
removeFile foo.ps
removeFile bar.ps
- set c1 [open foo.ps w]
+} -result ok
+test canvPs-2.4 {test writing to channel and file, same output} -constraints {
+ win
+} -setup {
+ set foo [makeFile {} foo.ps]
+ set bar [makeFile {} bar.ps]
+ file delete $foo
+ file delete $bar
+} -body {
+ set c1 [open $foo w]
fconfigure $c1 -translation crlf
.c postscript -channel $c1
close $c1
- .c postscript -file bar.ps
+ .c postscript -file $bar
set status ok
- if {[file size foo.ps] != [file size bar.ps]} {
+ if {[file size $foo] != [file size $bar]} {
set status broken
}
set status
-} ok
-
-test canvPs-3.1 {test ps generation with an embedded window} {notAqua} {
+} -cleanup {
+ removeFile foo.ps
removeFile bar.ps
+} -result ok
+
+test canvPs-3.1 {test ps generation with an embedded window} -setup {
+ set bar [makeFile {} bar.ps]
+ file delete $bar
+} -constraints {
+ notAqua
+} -body {
destroy .c
pack [canvas .c -width 200 -height 200 -background white]
.c create rect 20 20 150 150 -tags rect0 -dash . -width 2
@@ -101,26 +140,32 @@ test canvPs-3.1 {test ps generation with an embedded window} {notAqua} {
-dash {4 4} -stipple question -outline red -fill green
image create photo logo \
- -file [file join $tk_library images pwrdLogo150.gif]
+ -file [file join [file dirname [info script]] pwrdLogo150.gif]
.c create image 200 50 -image logo -anchor nw
entry .c.e -background pink -foreground blue -width 14
.c.e insert 0 "we gonna be postscripted"
.c create window 50 180 -anchor nw -window .c.e
update
- .c postscript -file bar.ps
- file exists bar.ps
-} 1
-test canvPs-3.2 {test ps generation with an embedded window not mapped} {} {
+ .c postscript -file $bar
+ file exists $bar
+} -cleanup {
removeFile bar.ps
+} -result 1
+test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup {
+ set bar [makeFile {} bar.ps]
+ file delete $bar
+} -body {
destroy .c
pack [canvas .c -width 200 -height 200 -background white]
entry .c.e -background pink -foreground blue -width 14
.c.e insert 0 "we gonna be postscripted"
.c create window 50 180 -anchor nw -window .c.e
- .c postscript -file bar.ps
- file exists bar.ps
-} 1
+ .c postscript -file $bar
+ file exists $bar
+} -cleanup {
+ removeFile bar.ps
+} -result 1
test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} {} {
destroy .c
@@ -130,8 +175,7 @@ test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498
} 0
# cleanup
-removeFile foo.ps
-removeFile bar.ps
+unset -nocomplain foo bar
deleteWindows
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/canvPsBmap.tcl b/tests/canvPsBmap.tcl
index 9bd5f9d..4a7a7e2 100644
--- a/tests/canvPsBmap.tcl
+++ b/tests/canvPsBmap.tcl
@@ -23,48 +23,50 @@ pack .t.bot.print .t.bot.quit -side left -pady 1m -expand 1
canvas $c -width 6i -height 6i -bd 2 -relief sunken
pack $c -expand yes -fill both -padx 2m -pady 2m
+set canvPsBmapImageDir [file join [file dirname [info script]] images]
+
$c create bitmap 0.5i 0.5i \
- -bitmap @[file join $tk_library demos/images/flagdown.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir flagdown.xbm] \
-background {} -foreground black -anchor nw
$c create rect 0.47i 0.47i 0.53i 0.53i -fill {} -outline black
$c create bitmap 3.0i 0.5i \
- -bitmap @[file join $tk_library demos/images/flagdown.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir flagdown.xbm] \
-background {} -foreground black -anchor n
$c create rect 2.97i 0.47i 3.03i 0.53i -fill {} -outline black
$c create bitmap 5.5i 0.5i \
- -bitmap @[file join $tk_library demos/images/flagdown.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir flagdown.xbm] \
-background black -foreground white -anchor ne
$c create rect 5.47i 0.47i 5.53i 0.53i -fill {} -outline black
$c create bitmap 0.5i 3.0i \
- -bitmap @[file join $tk_library demos/images/face.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir face.xbm] \
-background {} -foreground black -anchor w
$c create rect 0.47i 2.97i 0.53i 3.03i -fill {} -outline black
$c create bitmap 3.0i 3.0i \
- -bitmap @[file join $tk_library demos/images/face.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir face.xbm] \
-background {} -foreground black -anchor center
$c create rect 2.97i 2.97i 3.03i 3.03i -fill {} -outline black
$c create bitmap 5.5i 3.0i \
- -bitmap @[file join $tk_library demos/images/face.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir face.xbm] \
-background blue -foreground black -anchor e
$c create rect 5.47i 2.97i 5.53i 3.03i -fill {} -outline black
$c create bitmap 0.5i 5.5i \
- -bitmap @[file join $tk_library demos/images/flagup.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir flagup.xbm] \
-background black -foreground white -anchor sw
$c create rect 0.47i 5.47i 0.53i 5.53i -fill {} -outline black
$c create bitmap 3.0i 5.5i \
- -bitmap @[file join $tk_library demos/images/flagup.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir flagup.xbm] \
-background green -foreground white -anchor s
$c create rect 2.97i 5.47i 3.03i 5.53i -fill {} -outline black
$c create bitmap 5.5i 5.5i \
- -bitmap @[file join $tk_library demos/images/flagup.bmp] \
+ -bitmap @[file join $canvPsBmapImageDir flagup.xbm] \
-background {} -foreground black -anchor se
$c create rect 5.47i 5.47i 5.53i 5.53i -fill {} -outline black
diff --git a/tests/canvPsImg.tcl b/tests/canvPsImg.tcl
index 30cef31..c06aeaa 100644
--- a/tests/canvPsImg.tcl
+++ b/tests/canvPsImg.tcl
@@ -67,9 +67,11 @@ foreach l { monochrome gray color } {
pack .t.$l -in .t.top.r -anchor w
}
-set BitmapImage [image create bitmap -file $tk_library/demos/images/face.bmp \
+set BitmapImage [image create bitmap \
+ -file [file join [file dirname [info script]] face.xbm] \
-background white -foreground black]
-set PhotoImage [image create photo -file $tk_library/demos/images/teapot.ppm]
+set PhotoImage [image create photo \
+ -file [file join [file dirname [info script]] teapot.ppm]]
BuildTestImage
diff --git a/tests/canvRect.test b/tests/canvRect.test
index 94fd425..b6c828e 100644
--- a/tests/canvRect.test
+++ b/tests/canvRect.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
canvas .c -width 400 -height 300 -bd 2 -relief sunken
@@ -23,22 +20,27 @@ update
set i 1
.c create rectangle 20 20 80 80 -tag test
foreach test {
- {-fill #ff0000 #ff0000 non-existent {unknown color name "non-existent"}}
- {-outline #123456 #123456 bad_color {unknown color name "bad_color"}}
- {-stipple gray50 gray50 bogus {bitmap "bogus" not defined}}
- {-tags {test a b c} {test a b c} {} {}}
- {-width 6.0 6.0 abc {bad screen distance "abc"}}
+ {-fill #ff0000 #ff0000
+ non-existent {unknown color name "non-existent"}}
+ {-outline #123456 #123456
+ bad_color {unknown color name "bad_color"}}
+ {-stipple gray50 gray50
+ bogus {bitmap "bogus" not defined}}
+ {-tags {test a b c} {test a b c}
+ {} {}}
+ {-width 6.0 6.0
+ abc {bad screen distance "abc"}}
} {
- set name [lindex $test 0]
- test canvRect-1.$i {configuration options} {
- .c itemconfigure test $name [lindex $test 1]
+ lassign $test name goodValue goodResult badValue badResult
+ test canvRect-1.$i "configuration options: good value for $name" {
+ .c itemconfigure test $name $goodValue
list [lindex [.c itemconfigure test $name] 4] [.c itemcget test $name]
- } [list [lindex $test 2] [lindex $test 2]]
+ } [list $goodResult $goodResult]
incr i
- if {[lindex $test 3] != ""} {
- test canvRect-1.$i {configuration options} {
- list [catch {.c itemconfigure test $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test canvRect-1.$i "configuration options: bad value for $name" -body {
+ .c itemconfigure test $name $badValue
+ } -returnCodes error -result $badResult
}
incr i
}
@@ -322,18 +324,5 @@ end
}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/canvText.test b/tests/canvText.test
index 9566769..070011b 100644
--- a/tests/canvText.test
+++ b/tests/canvText.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
canvas .c -width 400 -height 300 -bd 2 -relief sunken
@@ -34,18 +31,19 @@ foreach test {
{-stipple gray50 gray50 xyz {bitmap "xyz" not defined}}
{-tags {test a b c} {test a b c} {} {}}
{-text xyz xyz {} {}}
+ {-underline 0 0 xyz {expected integer but got "xyz"}}
{-width 6 6 xyz {bad screen distance "xyz"}}
} {
- set name [lindex $test 0]
- test canvText-1.$i {configuration options} {
- .c itemconfigure test $name [lindex $test 1]
+ lassign $test name goodValue goodResult badValue badResult
+ test canvText-1.$i "configuration options: good value for $name" {
+ .c itemconfigure test $name $goodValue
list [lindex [.c itemconfigure test $name] 4] [.c itemcget test $name]
- } [list [lindex $test 2] [lindex $test 2]]
+ } [list $goodResult $goodResult]
incr i
- if {[lindex $test 3] != ""} {
- test canvText-1.$i {configuration options} {
- list [catch {.c itemconfigure test $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test canvText-1.$i "configuration options: bad value for $name" -body {
+ .c itemconfigure test $name $badValue
+ } -returnCodes error -result $badResult
}
incr i
}
@@ -402,7 +400,7 @@ test canvText-9.15 {TextInsert procedure: cursor doesn't move} {
.c dchars test 7 9
.c index test insert
} {5}
-
+
test canvText-10.1 {TextToPoint procedure} {
.c coords test 0 0
.c itemconfig test -text 0 -anchor center
@@ -423,15 +421,15 @@ test canvText-11.2 {TextToArea procedure} {
test canvText-12.1 {ScaleText procedure} {
.c coords test 100 100
.c scale all 50 50 2 2
- .c coords test
-} {150.0 150.0}
+ format {%.6g %.6g} {*}[.c coords test]
+} {150 150}
test canvText-13.1 {TranslateText procedure} {
.c coords test 100 100
.c move all 10 10
- .c coords test
-} {110.0 110.0}
-
+ format {%.6g %.6g} {*}[.c coords test]
+} {110 110}
+
.c itemconfig test -text "abcdefghijklmno" -anchor nw
.c select from test 5
.c select to test 8
@@ -458,6 +456,9 @@ test canvText-14.4 {GetTextIndex procedure: select error} {
test canvText-14.5 {GetTextIndex procedure: bad int or unknown index} {
list [catch {.c index test xyz} msg] $msg
} {1 {bad index "xyz"}}
+test canvText-14.6 {select clear errors} -body {
+ .c select clear test
+} -returnCodes error -result "wrong \# args: should be \".c select clear\""
test canvText-15.1 {SetTextCursor procedure} {
.c itemconfig -text "abcdefg"
@@ -480,7 +481,7 @@ test canvText-17.1 {TextToPostscript procedure} {
.c delete all
.c config -height 300 -highlightthickness 0 -bd 0
update
- .c create text 100 100 -tags test
+ .c create text 100 100 -tags test
.c itemconfig test -font $font -text "00000000" -width [expr 3*$ax]
.c itemconfig test -anchor n -fill black
set x [.c postscript]
@@ -491,7 +492,7 @@ test canvText-17.1 {TextToPostscript procedure} {
\[(000)\]
\[(000)\]
\[(00)\]
-] $ay -0.5 0 0 false DrawText
+] $ay -0.5 0.0 0 false DrawText
grestore
restore showpage
@@ -561,7 +562,7 @@ test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} {
+ ([font measure {Arial 28 bold} "Y"] / 2)}]
set y1 [expr {18 + ($metrics(-linespace) / 2)}]
set y2 [expr {160 + ($metrics(-linespace) / 2)}]
-
+
lappend results [$c index tbox1 @$x,$y1]
lappend results [$c index tbox2 @$x,$y2]
@@ -570,18 +571,5 @@ test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} {
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/canvWind.test b/tests/canvWind.test
index 6911341..9844ff0 100644
--- a/tests/canvWind.test
+++ b/tests/canvWind.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
test canvWind-1.1 {DisplayWinItem, windows off-screen vertically} {
@@ -128,18 +125,5 @@ test canvWind-1.4 {DisplayWinItem, windows off-screen horizontally} {
catch {destroy .t}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/canvas.test b/tests/canvas.test
index cc711db..6fea894 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# XXX - This test file is woefully incomplete. At present, only a
@@ -20,56 +17,64 @@ canvas .c
pack .c
update
set i 1
-foreach test {
- {-background #ff0000 #ff0000 non-existent
- {unknown color name "non-existent"}}
- {-bg #ff0000 #ff0000 non-existent {unknown color name "non-existent"}}
- {-bd 4 4 badValue {bad screen distance "badValue"}}
- {-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
- {-closeenough 24 24.0 bogus {expected floating-point number but got "bogus"}}
- {-confine true 1 silly {expected boolean value but got "silly"}}
- {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
- {-height 2.1 2 x42 {bad screen distance "x42"}}
- {-highlightbackground #112233 #112233 ugly {unknown color name "ugly"}}
- {-highlightcolor #110022 #110022 bogus {unknown color name "bogus"}}
- {-highlightthickness 18 18 badValue {bad screen distance "badValue"}}
- {-insertbackground #110022 #110022 bogus {unknown color name "bogus"}}
- {-insertborderwidth 1.3 1 2.6x {bad screen distance "2.6x"}}
- {-insertofftime 100 100 3.2 {expected integer but got "3.2"}}
- {-insertontime 100 100 3.2 {expected integer but got "3.2"}}
- {-insertwidth 1.3 1 6x {bad screen distance "6x"}}
- {-relief groove groove 1.5 {bad relief type "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
- {-selectbackground #110022 #110022 bogus {unknown color name "bogus"}}
- {-selectborderwidth 1.3 1 badValue {bad screen distance "badValue"}}
- {-selectforeground #654321 #654321 bogus {unknown color name "bogus"}}
- {-takefocus "any string" "any string" {} {}}
- {-width 402 402 xyz {bad screen distance "xyz"}}
- {-xscrollcommand {Some command} {Some command} {} {}}
- {-yscrollcommand {Another command} {Another command} {} {}}
+foreach {testname testinfo} {
+ canvas-1.1 {-background #ff0000 #ff0000
+ non-existent {unknown color name "non-existent"}}
+ canvas-1.2 {-bg #ff0000 #ff0000
+ non-existent {unknown color name "non-existent"}}
+ canvas-1.3 {-bd 4 4 badValue {bad screen distance "badValue"}}
+ canvas-1.4 {-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
+ canvas-1.5 {-closeenough 24 24.0
+ bogus {expected floating-point number but got "bogus"}}
+ canvas-1.6 {-confine true 1 silly {expected boolean value but got "silly"}}
+ canvas-1.7 {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
+ canvas-1.8 {-height 2.1 2 x42 {bad screen distance "x42"}}
+ canvas-1.9 {-highlightbackground #112233 #112233
+ ugly {unknown color name "ugly"}}
+ canvas-1.10 {-highlightcolor #110022 #110022
+ bogus {unknown color name "bogus"}}
+ canvas-1.11 {-highlightthickness 18 18
+ badValue {bad screen distance "badValue"}}
+ canvas-1.12 {-insertbackground #110022 #110022
+ bogus {unknown color name "bogus"}}
+ canvas-1.13 {-insertborderwidth 1.3 1 2.6x {bad screen distance "2.6x"}}
+ canvas-1.14 {-insertofftime 100 100 3.2 {expected integer but got "3.2"}}
+ canvas-1.15 {-insertontime 100 100 3.2 {expected integer but got "3.2"}}
+ canvas-1.16 {-insertwidth 1.3 1 6x {bad screen distance "6x"}}
+ canvas-1.17 {-relief groove groove
+ 1.5 {bad relief type "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
+ canvas-1.18 {-selectbackground #110022 #110022
+ bogus {unknown color name "bogus"}}
+ canvas-1.19 {-selectborderwidth 1.3 1
+ badValue {bad screen distance "badValue"}}
+ canvas-1.20 {-selectforeground #654321 #654321
+ bogus {unknown color name "bogus"}}
+ canvas-1.21 {-takefocus "any string" "any string" {} {}}
+ canvas-1.22 {-width 402 402 xyz {bad screen distance "xyz"}}
+ canvas-1.23 {-xscrollcommand {Some command} {Some command} {} {}}
+ canvas-1.24 {-yscrollcommand {Another command} {Another command} {} {}}
} {
- set name [lindex $test 0]
- test canvas-1.$i {configuration options} {
- .c configure $name [lindex $test 1]
+ lassign $testinfo name goodValue goodResult badValue badResult
+ test $testname-good "configuration options: good value for $name" {
+ .c configure $name $goodValue
lindex [.c configure $name] 4
- } [lindex $test 2]
+ } $goodResult
incr i
- if {[lindex $test 3] != ""} {
- test canvas-1.$i {configuration options} {
- list [catch {.c configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test $testname-bad "configuration options: bad value for $name" -body {
+ .c configure $name $badValue
+ } -returnCodes error -result $badResult
}
.c configure $name [lindex [.c configure $name] 3]
incr i
}
-
-test canvas-1.40 {configure throws error on bad option} {
+test canvas-1.25 {configure throws error on bad option} {
set res [list [catch {.c configure -gorp foo}]]
.c create rect 10 10 100 100
lappend res [catch {.c configure -gorp foo}]
set res
} [list 1 1]
-
catch {destroy .c}
canvas .c -width 60 -height 40 -scrollregion {0 0 200 150} -bd 0 \
-highlightthickness 0
@@ -92,7 +97,7 @@ test canvas-2.3 {CanvasWidgetCmd, xview option} {
.c xview scroll 2 units
update
lappend x [.c xview]
-} {{0 0.3} {0.4 0.7}}
+} {{0.0 0.3} {0.4 0.7}}
test canvas-2.4 {CanvasWidgetCmd, xview option} {nonPortable} {
# This test gives slightly different results on platforms such
# as NetBSD. I don't know why...
@@ -118,7 +123,7 @@ test canvas-3.1 {CanvasWidgetCmd, yview option} {
.c yview scroll 3 units
update
lappend x [.c yview]
-} {{0 0.5} {0.1875 0.6875}}
+} {{0.0 0.5} {0.1875 0.6875}}
test canvas-3.2 {CanvasWidgetCmd, yview option} {
.c configure -xscrollincrement 40 -yscrollincrement 0
.c yview moveto 0
@@ -127,7 +132,7 @@ test canvas-3.2 {CanvasWidgetCmd, yview option} {
.c yview scroll 2 units
update
lappend x [.c yview]
-} {{0 0.5} {0.1 0.6}}
+} {{0.0 0.5} {0.1 0.6}}
test canvas-4.1 {ButtonEventProc procedure} {
deleteWindows
@@ -190,20 +195,22 @@ test canvas-6.5 {CanvasSetOrigin procedure} {
.c canvasy 0
} {55.0}
-set l [interp hidden]
deleteWindows
-test canvas-7.1 {canvas widget vs hidden commands} {
+set l [lsort [interp hidden]]
+test canvas-7.1 {canvas widget vs hidden commands} -setup {
catch {destroy .c}
+} -body {
canvas .c
interp hide {} .c
destroy .c
- list [winfo children .] [interp hidden]
-} [list {} $l]
+ list [winfo children .] [lsort [interp hidden]]
+} -result [list {} $l]
-test canvas-8.1 {canvas arc bbox} {
+test canvas-8.1 {canvas arc bbox} -setup {
catch {destroy .c}
canvas .c
+} -body {
.c create arc -100 10 100 210 -start 10 -extent 50 -style arc -tags arc1
set arcBox [.c bbox arc1]
.c create arc 100 10 300 210 -start 10 -extent 50 -style chord -tags arc2
@@ -211,21 +218,23 @@ test canvas-8.1 {canvas arc bbox} {
.c create arc 300 10 500 210 -start 10 -extent 50 -style pieslice -tags arc3
set pieBox [.c bbox arc3]
list $arcBox $coordBox $pieBox
-} {{48 21 100 94} {248 21 300 94} {398 21 500 112}}
-test canvas-9.1 {canvas id creation and deletion} {
+} -result {{48 21 100 94} {248 21 300 94} {398 21 500 112}}
+
+test canvas-9.1 {canvas id creation and deletion} -setup {
+ catch {destroy .c}
+ canvas .c
+} -body {
# With Tk 8.0.4 the ids are now stored in a hash table. You
# can use this test as a performance test with older versions
# by changing the value of size.
set size 15
- catch {destroy .c}
- set c [canvas .c]
for {set i 0} {$i < $size} {incr i} {
set x [expr {-10 + 3*$i}]
for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
- $c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \
+ .c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \
-outline black -fill blue -tags rect
- $c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \
+ .c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \
-anchor center -tags text
}
}
@@ -234,136 +243,150 @@ test canvas-9.1 {canvas id creation and deletion} {
# table changes.
set time [lindex [time {
- foreach id [$c find withtag all] {
- $c lower $id
- $c raise $id
- $c find withtag $id
- $c bind <Return> $id {}
- $c delete $id
+ foreach id [.c find withtag all] {
+ .c lower $id
+ .c raise $id
+ .c find withtag $id
+ .c bind <Return> $id {}
+ .c delete $id
}
}] 0]
set x ""
-} {}
-test canvas-10.1 {find items using tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 60 40 80 -fill yellow -tag [list b a]
- .c create oval 20 100 40 120 -fill green -tag [list c b]
- .c create oval 20 140 40 160 -fill blue -tag [list b]
- .c create oval 20 180 40 200 -fill bisque -tag [list a d e]
- .c create oval 20 220 40 240 -fill bisque -tag b
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- set res {}
- lappend res [.c find withtag {!a}]
- lappend res [.c find withtag {b&&c}]
- lappend res [.c find withtag {b||c}]
- lappend res [.c find withtag {a&&!b}]
- lappend res [.c find withtag {!b&&!c}]
- lappend res [.c find withtag {d&&a&&c&&b}]
- lappend res [.c find withtag {b^a}]
- lappend res [.c find withtag {(a&&!b)||(!a&&b)}]
- lappend res [.c find withtag { ( a && ! b ) || ( ! a && b ) }]
- lappend res [.c find withtag {a&&!(c||d)}]
- lappend res [.c find withtag {d&&"tag with spaces"}]
- lappend res [.c find withtag "tag with spaces"]
-} {{3 4 6 7} {1 3} {1 2 3 4 6} 5 {5 7} 1 {3 4 5 6} {3 4 5 6} {3 4 5 6} 2 7 7}
-test canvas-10.2 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {&&c}} err
- set err
-} {Unexpected operator in tag search expression}
-test canvas-10.3 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {!!c}} err
- set err
-} {Too many '!' in tag search expression}
-test canvas-10.4 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {b||}} err
- set err
-} {Missing tag in tag search expression}
-test canvas-10.5 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {b&&(c||)}} err
- set err
-} {Unexpected operator in tag search expression}
-test canvas-10.6 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {d&&""}} err
- set err
-} {Null quoted tag string in tag search expression}
-test canvas-10.7 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag "d&&\"tag with spaces"} err
- set err
-} {Missing endquote in tag search expression}
-test canvas-10.8 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {a&&"tag with spaces"z}} err
- set err
-} {Invalid boolean operator in tag search expression}
-test canvas-10.9 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {a&&b&c}} err
- set err
-} {Singleton '&' in tag search expression}
-test canvas-10.10 {check errors from tag expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list a b c d]
- .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
- catch {.c find withtag {a||b|c}} err
- set err
-} {Singleton '|' in tag search expression}
-test canvas-10.11 {backward compatility - strange tags that are not expressions} {
- catch {destroy .c}
- canvas .c
- .c create oval 20 20 40 40 -fill red -tag [list { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }]
- .c find withtag { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }
-} {1}
-test canvas-10.12 {multple events bound to same tag expr} {
- catch {destroy .c}
- canvas .c
- .c bind {a && b} <Enter> {puts Enter}
- .c bind {a && b} <Leave> {puts Leave}
-} {}
+} -result {}
+test canvas-10.1 {find items using tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+} -body {
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 60 40 80 -fill yellow -tag [list b a]
+ .c create oval 20 100 40 120 -fill green -tag [list c b]
+ .c create oval 20 140 40 160 -fill blue -tag [list b]
+ .c create oval 20 180 40 200 -fill bisque -tag [list a d e]
+ .c create oval 20 220 40 240 -fill bisque -tag b
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ set res {}
+ lappend res [.c find withtag {!a}]
+ lappend res [.c find withtag {b&&c}]
+ lappend res [.c find withtag {b||c}]
+ lappend res [.c find withtag {a&&!b}]
+ lappend res [.c find withtag {!b&&!c}]
+ lappend res [.c find withtag {d&&a&&c&&b}]
+ lappend res [.c find withtag {b^a}]
+ lappend res [.c find withtag {(a&&!b)||(!a&&b)}]
+ lappend res [.c find withtag { ( a && ! b ) || ( ! a && b ) }]
+ lappend res [.c find withtag {a&&!(c||d)}]
+ lappend res [.c find withtag {d&&"tag with spaces"}]
+ lappend res [.c find withtag "tag with spaces"]
+} -result {{3 4 6 7} {1 3} {1 2 3 4 6} 5 {5 7} 1 {3 4 5 6} {3 4 5 6} {3 4 5 6} 2 7 7}
+test canvas-10.2 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {&&c}
+} -returnCodes error -result {Unexpected operator in tag search expression}
+test canvas-10.3 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {!!c}
+} -returnCodes error -result {Too many '!' in tag search expression}
+test canvas-10.4 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {b||}
+} -returnCodes error -result {Missing tag in tag search expression}
+test canvas-10.5 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {b&&(c||)}
+} -returnCodes error -result {Unexpected operator in tag search expression}
+test canvas-10.6 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {d&&""}
+} -returnCodes error -result {Null quoted tag string in tag search expression}
+test canvas-10.7 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag "d&&\"tag with spaces"
+} -returnCodes error -result {Missing endquote in tag search expression}
+test canvas-10.8 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {a&&"tag with spaces"z}
+} -returnCodes error -result {Invalid boolean operator in tag search expression}
+test canvas-10.9 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {a&&b&c}
+} -returnCodes error -result {Singleton '&' in tag search expression}
+test canvas-10.10 {check errors from tag expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+} -body {
+ .c find withtag {a||b|c}
+} -returnCodes error -result {Singleton '|' in tag search expression}
+test canvas-10.11 {backward compatility - strange tags that are not expressions} -setup {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }]
+} -body {
+ .c find withtag { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }
+} -result 1
+test canvas-10.12 {multple events bound to same tag expr} -setup {
+ catch {destroy .c}
+ canvas .c
+} -body {
+ .c bind {a && b} <Enter> {puts Enter}
+ .c bind {a && b} <Leave> {puts Leave}
+} -result {}
+test canvas-10.13 {more long tag searches; Bug 2931374} -setup {
+ catch {destroy .c}
+ canvas .c
+} -body {
+ .c find withtag {(A&&B&&C&&D)&&area&&!text}
+ # memory errors on failure
+} -cleanup {
+ destroy .c
+} -result {}
-test canvas-11.1 {canvas poly fill check, bug 5783} {
- # This would crash in 8.3.0 and 8.3.1
+test canvas-11.1 {canvas poly fill check, bug 5783} -setup {
destroy .c
pack [canvas .c]
+} -body {
+ # This would crash in 8.3.0 and 8.3.1
.c create polygon 0 0 100 100 200 50 \
-fill {} -stipple gray50 -outline black
-} 1
-test canvas-11.2 {canvas poly overlap fill check, bug 226357} {
+} -result 1
+test canvas-11.2 {canvas poly overlap fill check, bug 226357} -setup {
destroy .c
pack [canvas .c]
+} -body {
set result {}
.c create poly 30 30 90 90 30 90 90 30
lappend result [.c find over 40 40 45 45]; # rect region inc. edge
@@ -379,7 +402,7 @@ test canvas-11.2 {canvas poly overlap fill check, bug 226357} {
lappend result [.c find over 45 50 45 50]; # outside poly
.c itemconfig 1 -width 8
lappend result [.c find over 45 50 45 50]; # outside poly
-} {1 1 {} 1 {} 1 1 {} 1 {} 1}
+} -result {1 1 {} 1 {} 1 1 {} 1 {} 1}
test canvas-11.3 {canvas poly dchars, bug 3291543} {
# This would crash
destroy .c
@@ -389,25 +412,27 @@ test canvas-11.3 {canvas poly dchars, bug 3291543} {
.c coords 1
} {}
-test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} {
+test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} -setup {
destroy .c
pack [canvas .c]
+} -body {
set qx [expr {1.+1.}]
# qx has type double and no string representation
.c scale all $qx 0 1. 1.
# qx has now type MMRep and no string representation
list $qx [string length $qx]
-} {2.0 3}
-test canvas-12.2 {canvas mm obj, patch SF-403327, 102471} {
+} -result {2.0 3}
+test canvas-12.2 {canvas mm obj, patch SF-403327, 102471} -setup {
destroy .c
pack [canvas .c]
+} -body {
set val 10
incr val
# qx has type double and no string representation
.c scale all $val 0 1 1
# qx has now type MMRep and no string representation
incr val
-} {12}
+} -result 12
proc kill_canvas {w} {
destroy $w
@@ -433,55 +458,87 @@ test canvas-13.1 {canvas delete during event, SF bug-228024} {
set ::x
} okokokokokokokokokokokokokokokokokokokokokokokokokokokokokok
-test canvas-14.1 {canvas scan SF bug 581560} {
- destroy .c; canvas .c
- list [catch {.c scan} msg] $msg
-} {1 {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}}
-test canvas-14.2 {canvas scan} {
- destroy .c; canvas .c
- list [catch {.c scan bogus} msg] $msg
-} {1 {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}}
-test canvas-14.3 {canvas scan} {
- destroy .c; canvas .c
- list [catch {.c scan mark} msg] $msg
-} {1 {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}}
-test canvas-14.4 {canvas scan} {
- destroy .c; canvas .c
- list [catch {.c scan mark 10 10} msg] $msg
-} {0 {}}
-test canvas-14.5 {canvas scan} {
- destroy .c; canvas .c
- list [catch {.c scan mark 10 10 5} msg] $msg
-} {1 {wrong # args: should be ".c scan mark x y"}}
-test canvas-14.6 {canvas scan} {
- destroy .c; canvas .c
- list [catch {.c scan dragto 10 10 5} msg] $msg
-} {0 {}}
+test canvas-14.1 {canvas scan SF bug 581560} -setup {
+ destroy .c
+ canvas .c
+} -body {
+ .c scan
+} -returnCodes error -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
+test canvas-14.2 {canvas scan} -setup {
+ destroy .c
+ canvas .c
+} -body {
+ .c scan bogus
+} -returnCodes error -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
+test canvas-14.3 {canvas scan} -setup {
+ destroy .c
+ canvas .c
+} -body {
+ .c scan mark
+} -returnCodes error -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
+test canvas-14.4 {canvas scan} -setup {
+ destroy .c
+ canvas .c
+} -body {
+ .c scan mark 10 10
+} -result {}
+test canvas-14.5 {canvas scan} -setup {
+ destroy .c
+ canvas .c
+} -body {
+ .c scan mark 10 10 5
+} -returnCodes error -result {wrong # args: should be ".c scan mark x y"}
+test canvas-14.6 {canvas scan} -setup {
+ destroy .c
+ canvas .c
+} -body {
+ .c scan dragto 10 10 5
+} -result {}
set i 0
proc create {w type args} {
eval [list $w create $type] $args
}
foreach type {arc bitmap image line oval polygon rect text window} {
- test canvas-15.[incr i] "basic types check: $type" {
- destroy .c; canvas .c
- list [catch {.c create $type} msg] $msg
- } [format {1 {wrong # args: should be ".c create %s coords ?arg arg ...?"}} $type]
- test canvas-15.[incr i] "basic coords check: $type" {
- destroy .c; canvas .c
- list [catch {.c create $type 0} msg] \
- [string match "wrong # coordinates: expected*" $msg]
- } {1 1}
+ incr i
+ test canvas-15.$i "basic types check: $type requires coords" -setup {
+ destroy .c
+ canvas .c
+ } -body {
+ .c create $type
+ } -returnCodes error -result [format {wrong # args: should be ".c create %s coords ?arg arg ...?"} $type]
+ incr i
+ test canvas-15.$i "basic coords check: $type coords are paired" -setup {
+ destroy .c
+ canvas .c
+ } -match glob -body {
+ .c create $type 0
+ } -returnCodes error -result "wrong # coordinates: expected*"
}
-test canvas-16.1 {arc coords check} {
- destroy .c; canvas .c
+test canvas-16.1 {arc coords check} -setup {
+ destroy .c
+ canvas .c
+} -body {
set id [.c create arc {0 10 20 30} -start 33]
.c itemcget $id -start
-} {33.0}
+} -result {33.0}
+
+test canvas-17.1 {default smooth method handling} -setup {
+ destroy .c
+ canvas .c
+} -body {
+ set id [.c create line {0 0 1 1 2 2 3 3 4 4 5 5 6 6}]
+ set result [.c itemcget $id -smooth]
+ foreach smoother {yes 1 bezier raw r b} {
+ .c itemconfigure $id -smooth $smoother
+ lappend result [.c itemcget $id -smooth]
+ }
+ set result
+} -result {0 true true true raw raw true}
destroy .c
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/choosedir.test b/tests/choosedir.test
index 94dbf90..01a319f 100644
--- a/tests/choosedir.test
+++ b/tests/choosedir.test
@@ -6,14 +6,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeDirectory
-
#----------------------------------------------------------------------
#
# Procedures needed by this test file
@@ -83,32 +78,31 @@ proc SendButtonPress {parent btn type} {
#
#----------------------------------------------------------------------
# Make a dir for us to rely on for tests
-makeDirectory choosedirTest
-set dir [pwd]
+set real [makeDirectory choosedirTest]
+set dir [file dirname $real]
set fake [file join $dir non-existant]
-set real [file join $dir choosedirTest]
set parent .
foreach opt {-initialdir -mustexist -parent -title} {
- test choosedir-1.1 "tk_chooseDirectory command" unixOnly {
+ test choosedir-1.1$opt "tk_chooseDirectory command" unix {
list [catch {tk_chooseDirectory $opt} msg] $msg
} [list 1 "value for \"$opt\" missing"]
}
-test choosedir-1.2 "tk_chooseDirectory command" unixOnly {
+test choosedir-1.2 "tk_chooseDirectory command" unix {
list [catch {tk_chooseDirectory -foo bar} msg] $msg
} [list 1 "bad option \"-foo\": must be -initialdir, -mustexist, -parent, or -title"]
-test choosedir-1.3 "tk_chooseDirectory command" unixOnly {
+test choosedir-1.3 "tk_chooseDirectory command" unix {
list [catch {tk_chooseDirectory -parent foo.bar} msg] $msg
} {1 {bad window path name "foo.bar"}}
-test choosedir-2.1 "tk_chooseDirectory command, cancel gives null" {unixOnly} {
+test choosedir-2.1 "tk_chooseDirectory command, cancel gives null" {unix notAqua} {
ToPressButton $parent cancel
tk_chooseDirectory -title "Press Cancel" -parent $parent
} ""
-test choosedir-3.1 "tk_chooseDirectory -mustexist 1" {unixOnly} {
+test choosedir-3.1 "tk_chooseDirectory -mustexist 1" {unix notAqua} {
# first enter a bogus dirname, then enter a real one.
ToEnterDirsByKey $parent [list $fake $real $real]
set result [tk_chooseDirectory \
@@ -116,23 +110,23 @@ test choosedir-3.1 "tk_chooseDirectory -mustexist 1" {unixOnly} {
-parent $parent -mustexist 1]
set result
} $real
-test choosedir-3.2 "tk_chooseDirectory -mustexist 0" {unixOnly} {
+test choosedir-3.2 "tk_chooseDirectory -mustexist 0" {unix notAqua} {
ToEnterDirsByKey $parent [list $fake $fake]
tk_chooseDirectory -title "Enter \"$fake\", press OK" \
-parent $parent -mustexist 0
} $fake
-test choosedir-4.1 "tk_chooseDirectory command, initialdir" {unixOnly} {
+test choosedir-4.1 "tk_chooseDirectory command, initialdir" {unix notAqua} {
ToPressButton $parent ok
tk_chooseDirectory -title "Press Ok" -parent $parent -initialdir $real
} $real
-test choosedir-4.2 "tk_chooseDirectory command, initialdir" {unixOnly} {
+test choosedir-4.2 "tk_chooseDirectory command, initialdir" {unix notAqua} {
ToEnterDirsByKey $parent [list $fake $fake]
tk_chooseDirectory \
-title "Enter \"$fake\" and press Ok" \
-parent $parent -initialdir $real
} $fake
-test choosedir-4.3 "tk_chooseDirectory, -initialdir {}" {unixOnly} {
+test choosedir-4.3 "tk_chooseDirectory, -initialdir {}" {unix notAqua} {
catch {unset ::tk::dialog::file::__tk_choosedir}
ToPressButton $parent ok
tk_chooseDirectory \
@@ -140,12 +134,13 @@ test choosedir-4.3 "tk_chooseDirectory, -initialdir {}" {unixOnly} {
-parent $parent -initialdir ""
} [pwd]
-test choosedir-5.1 "tk_chooseDirectory, handles {} entry text" {unixOnly} {
+test choosedir-5.1 "tk_chooseDirectory, handles {} entry text" {unix notAqua} {
ToEnterDirsByKey $parent [list "" $real $real]
tk_chooseDirectory -title "Clear entry, Press OK; Enter $real, press OK" \
-parent $parent
} $real
# cleanup
-::tcltest::cleanupTests
+removeDirectory choosedirTest
+cleanupTests
return
diff --git a/tests/clipboard.test b/tests/clipboard.test
index e84a820..37e45a3 100644
--- a/tests/clipboard.test
+++ b/tests/clipboard.test
@@ -12,10 +12,7 @@
#
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# set up a very large buffer to test INCR retrievals
@@ -164,14 +161,14 @@ test clipboard-6.1 {Tk_ClipboardAppend procedure} {
clipboard get
} msg] $msg
} {0 {first chunk second chunk}}
-test clipboard-6.2 {Tk_ClipboardAppend procedure} {unixOnly} {
+test clipboard-6.2 {Tk_ClipboardAppend procedure} unix {
setupbg
clipboard clear
clipboard append -f INTEGER -t TEST "16"
set result [dobg {clipboard get TEST}]
cleanupbg
set result
-} {0x10}
+} {0x10 }
test clipboard-6.3 {Tk_ClipboardAppend procedure} {
clipboard clear
clipboard append -f INTEGER -t TEST "16"
@@ -243,18 +240,5 @@ test clipboard-7.16 {Tk_ClipboardCmd procedure} {
} {0 {} -type}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/clrpick.test b/tests/clrpick.test
index cd4907a..8b3769e 100644
--- a/tests/clrpick.test
+++ b/tests/clrpick.test
@@ -6,12 +6,43 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
+if {[testConstraint defaultPseudocolor8]} {
+ # let's soak up a bunch of colors...so that
+ # machines with small color palettes still fail.
+ # some tests will be skipped if there are no more colors
+ set numcolors 32
+ testConstraint colorsLeftover 1
+ set i 0
+ canvas .c
+ pack .c -expand 1 -fill both
+ while {$i<$numcolors} {
+ set color \#[format "%02x%02x%02x" $i [expr $i+1] [expr $i+3]]
+ .c create rectangle [expr 10+$i] [expr 10+$i] [expr 50+$i] [expr 50+$i] -fill $color -outline $color
+ incr i
+ }
+ set i 0
+ while {$i<$numcolors} {
+ set color [.c itemcget $i -fill]
+ if {$color != ""} {
+ foreach {r g b} [winfo rgb . $color] {}
+ set r [expr $r/256]
+ set g [expr $g/256]
+ set b [expr $b/256]
+ if {"$color" != "#[format %02x%02x%02x $r $g $b]"} {
+ testConstraint colorsLeftover 0
+ }
+ }
+ .c delete $i
+ incr i
+ }
+ destroy .c
+} else {
+ testConstraint colorsLeftover 0
+}
+
test clrpick-1.1 {tk_chooseColor command} {
list [catch {tk_chooseColor -foo} msg] $msg
} {1 {bad option "-foo": must be -initialcolor, -parent, or -title}}
@@ -21,38 +52,30 @@ regsub -all , $msg "" options
regsub \"-foo\" $options "" options
foreach option $options {
- if {[string index $option 0] == "-"} {
- test clrpick-1.2 {tk_chooseColor command} {
- list [catch {tk_chooseColor $option} msg] $msg
- } [list 1 "value for \"$option\" missing"]
+ if {[string index $option 0] eq "-"} {
+ test clrpick-1.2$option {tk_chooseColor command} -body {
+ tk_chooseColor $option
+ } -returnCodes error -result "value for \"$option\" missing"
}
}
test clrpick-1.3 {tk_chooseColor command} {
list [catch {tk_chooseColor -foo bar} msg] $msg
} {1 {bad option "-foo": must be -initialcolor, -parent, or -title}}
-
test clrpick-1.4 {tk_chooseColor command} {
list [catch {tk_chooseColor -initialcolor} msg] $msg
} {1 {value for "-initialcolor" missing}}
-
test clrpick-1.5 {tk_chooseColor command} {
list [catch {tk_chooseColor -parent foo.bar} msg] $msg
} {1 {bad window path name "foo.bar"}}
-
test clrpick-1.6 {tk_chooseColor command} {
list [catch {tk_chooseColor -initialcolor badbadbaadcolor} msg] $msg
} {1 {unknown color name "badbadbaadcolor"}}
-
test clrpick-1.7 {tk_chooseColor command} {
list [catch {tk_chooseColor -initialcolor ##badbadbaadcolor} msg] $msg
} {1 {invalid color name "##badbadbaadcolor"}}
-if {[info commands tk::dialog::color::] == ""} {
- set isNative 1
-} else {
- set isNative 0
-}
+set isNative [expr {[info commands tk::dialog::color::] eq ""}]
proc ToPressButton {parent btn} {
global isNative
@@ -130,37 +153,6 @@ set verylongstring $verylongstring$verylongstring
#set verylongstring $verylongstring$verylongstring
#set verylongstring $verylongstring$verylongstring
-# let's soak up a bunch of colors...so that
-# machines with small color palettes still fail.
-# some tests will be skipped if there are no more colors
-set numcolors 32
-testConstraint colorsLeftover 1
-set i 0
-canvas .c
-pack .c -expand 1 -fill both
-while {$i<$numcolors} {
- set color \#[format "%02x%02x%02x" $i [expr $i+1] [expr $i+3]]
- .c create rectangle [expr 10+$i] [expr 10+$i] [expr 50+$i] [expr 50+$i] -fill $color -outline $color
- incr i
-}
-set i 0
-while {$i<$numcolors} {
- set color [.c itemcget $i -fill]
- if {$color != ""} {
- foreach {r g b} [winfo rgb . $color] {}
- set r [expr $r/256]
- set g [expr $g/256]
- set b [expr $b/256]
- if {"$color" != "#[format %02x%02x%02x $r $g $b]"} {
- testConstraint colorsLeftover 0
- }
- }
- .c delete $i
- incr i
-}
-
-destroy .c
-
set color #404040
test clrpick-2.1 {tk_chooseColor command} \
{nonUnixUserInteraction colorsLeftover} {
@@ -168,25 +160,18 @@ test clrpick-2.1 {tk_chooseColor command} \
tk_chooseColor -title "Press Ok $verylongstring" -initialcolor $color \
-parent $parent
} "$color"
-
set color #808040
test clrpick-2.2 {tk_chooseColor command} \
{nonUnixUserInteraction colorsLeftover} {
- if {$tcl_platform(platform) == "macintosh"} {
- set colors "32768 32768 16384"
- } else {
- set colors "128 128 64"
- }
+ set colors "128 128 64"
ToChooseColorByKey $parent 128 128 64
tk_chooseColor -parent $parent -title "choose $colors"
} "$color"
-
test clrpick-2.3 {tk_chooseColor command} \
{nonUnixUserInteraction colorsLeftover} {
ToPressButton $parent ok
tk_chooseColor -parent $parent -title "Press OK"
} "$color"
-
test clrpick-2.4 {tk_chooseColor command} {nonUnixUserInteraction} {
ToPressButton $parent cancel
tk_chooseColor -parent $parent -title "Press Cancel"
@@ -204,7 +189,7 @@ test clrpick-3.2 {tk_chooseColor: background events} {nonUnixUserInteraction} {
tk_chooseColor -parent $parent -title "Press Cancel"
} ""
-test clrpick-4.1 {tk_chooseColor: screen is inherited from parent} unixOnly {
+test clrpick-4.1 {tk_chooseColor: screen is inherited from parent} {unix notAqua} {
after 50 {set ::scr [winfo screen .__tk__color]}
ToPressButton $parent cancel
tk_chooseColor -parent $parent
@@ -212,5 +197,5 @@ test clrpick-4.1 {tk_chooseColor: screen is inherited from parent} unixOnly {
} [winfo screen $parent]
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/cmds.test b/tests/cmds.test
index 8cf81e6..f630209 100644
--- a/tests/cmds.test
+++ b/tests/cmds.test
@@ -6,10 +6,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
update
@@ -41,18 +38,5 @@ test cmds-1.5 {tkwait visibility, window gets deleted} {
} {1 {window ".f.b" was deleted before its visibility changed} deleted}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/color.test b/tests/color.test
index 27ec152..6b31df7 100644
--- a/tests/color.test
+++ b/tests/color.test
@@ -6,14 +6,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint testcolor [llength [info commands testcolor]]
-
# cname --
# Returns a proper name for a color, given its intensities.
#
@@ -270,5 +265,5 @@ test color-4.1 {FreeColorObjProc} colorsFree {
destroy .t
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/config.test b/tests/config.test
index 1f19ee6..0d1e0e1 100644
--- a/tests/config.test
+++ b/tests/config.test
@@ -7,14 +7,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint testobjconfig [llength [info commands testobjconfig]]
-
proc killTables {} {
# Note: it's important to delete chain2 before chain1, because
# chain2 depends on chain1. If chain1 is deleted first, the
@@ -891,5 +886,5 @@ deleteWindows
if {[testConstraint testobjconfig]} {
killTables
}
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index f131ff8..843ee4d 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -23,10 +23,25 @@ package require tcltest 2.1
namespace eval tk {
namespace eval test {
+
+ namespace export loadTkCommand
+ proc loadTkCommand {} {
+ set tklib {}
+ foreach pair [info loaded {}] {
+ foreach {lib pfx} $pair break
+ if {$pfx eq "Tk"} {
+ set tklib $lib
+ break
+ }
+ }
+ return [list load $tklib Tk]
+ }
+
namespace eval bg {
# Manage a background process.
# Replace with slave interp or thread?
namespace import ::tcltest::interpreter
+ namespace import ::tk::test::loadTkCommand
namespace export setup cleanup do
proc cleanup {} {
@@ -52,6 +67,8 @@ namespace eval tk {
error "unexpected output from\
background process: \"$data\""
}
+ puts $fd [loadTkCommand]
+ flush $fd
fileevent $fd readable [namespace code Ready]
}
proc Ready {} {
@@ -129,16 +146,40 @@ namespace import -force tk::test::*
namespace import -force tcltest::testConstraint
testConstraint notAqua [expr {[tk windowingsystem] ne "aqua"}]
testConstraint aqua [expr {[tk windowingsystem] eq "aqua"}]
+testConstraint nonwin [expr {[tk windowingsystem] ne "win32"}]
testConstraint userInteraction 0
-testConstraint nonUnixUserInteraction [expr {[testConstraint userInteraction]
- || [testConstraint unix]}]
-testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)]
-testConstraint noExceed [expr {![testConstraint unix]
- || [catch {font actual "\{xyz"}]}]
+testConstraint nonUnixUserInteraction [expr {
+ [testConstraint userInteraction] ||
+ ([testConstraint unix] && [testConstraint notAqua])
+}]
+testConstraint haveDISPLAY [info exists env(DISPLAY)]
+testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)]
+testConstraint noExceed [expr {
+ ![testConstraint unix] || [catch {font actual "\{xyz"}]
+}]
+
+# constraints for testing facilities defined in the tktest executable...
testConstraint testImageType [expr {[lsearch [image types] test] >= 0}]
-testConstraint testembed [llength [info commands testembed]]
-testConstraint testwrapper [llength [info commands testwrapper]]
-testConstraint testfont [llength [info commands testfont]]
+testConstraint testOldImageType [expr {[lsearch [image types] oldtest] >= 0}]
+testConstraint testbitmap [llength [info commands testbitmap]]
+testConstraint testborder [llength [info commands testborder]]
+testConstraint testcbind [llength [info commands testcbind]]
+testConstraint testclipboard [llength [info commands testclipboard]]
+testConstraint testcolor [llength [info commands testcolor]]
+testConstraint testcursor [llength [info commands testcursor]]
+testConstraint testembed [llength [info commands testembed]]
+testConstraint testfont [llength [info commands testfont]]
+testConstraint testmakeexist [llength [info commands testmakeexist]]
+testConstraint testmenubar [llength [info commands testmenubar]]
+testConstraint testmenubar [llength [info commands testmenubar]]
+testConstraint testmetrics [llength [info commands testmetrics]]
+testConstraint testobjconfig [llength [info commands testobjconfig]]
+testConstraint testsend [llength [info commands testsend]]
+testConstraint testtext [llength [info commands testtext]]
+testConstraint testwinevent [llength [info commands testwinevent]]
+testConstraint testwrapper [llength [info commands testwrapper]]
+
+# constraint to see what sort of fonts are available
testConstraint fonts 1
destroy .e
entry .e -width 0 -font {Helvetica -12} -bd 1
@@ -157,11 +198,28 @@ destroy .t
if {![string match {{22 3 6 15} {31 18 [34] 15}} $x]} {
testConstraint fonts 0
}
-testConstraint pseudocolor8 [expr {([catch {
- toplevel .t -visual {pseudocolor 8} -colormap new
- }] == 0) && ([winfo depth .t] == 8)}]
+testConstraint textfonts [expr {
+ [testConstraint fonts] || $tcl_platform(platform) eq "windows"
+}]
+
+# constraints for the visuals available..
+testConstraint pseudocolor8 [expr {
+ ([catch {
+ toplevel .t -visual {pseudocolor 8} -colormap new
+ }] == 0) && ([winfo depth .t] == 8)
+}]
destroy .t
-testConstraint haveTruecolor24 [expr {[lsearch [winfo visualsavailable .] {truecolor 24}] != -1}]
+testConstraint haveTruecolor24 [expr {
+ [lsearch -exact [winfo visualsavailable .] {truecolor 24}] >= 0
+}]
+testConstraint haveGrayscale8 [expr {
+ [lsearch -exact [winfo visualsavailable .] {grayscale 8}] >= 0
+}]
+testConstraint defaultPseudocolor8 [expr {
+ ([winfo visual .] eq "pseudocolor") && ([winfo depth .] == 8)
+}]
+
+# constraint based on whether our display is secure
setupbg
set app [dobg {tk appname}]
testConstraint secureserver 0
@@ -177,6 +235,14 @@ cleanupbg
eval tcltest::configure $argv
namespace import -force tcltest::test
+namespace import -force tcltest::makeFile
+namespace import -force tcltest::removeFile
+namespace import -force tcltest::makeDirectory
+namespace import -force tcltest::removeDirectory
+namespace import -force tcltest::interpreter
+namespace import -force tcltest::testsDirectory
+namespace import -force tcltest::cleanupTests
+namespace import -force tcltest::bytestring
deleteWindows
wm geometry . {}
diff --git a/tests/cursor.test b/tests/cursor.test
index 3624b62..539e933 100644
--- a/tests/cursor.test
+++ b/tests/cursor.test
@@ -7,14 +7,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint testcursor [llength [info commands testcursor]]
-
test cursor-1.1 {Tk_AllocCursorFromObj - converting internal reps} {testcursor} {
set x watch
lindex $x 0
@@ -79,19 +74,19 @@ set wincur(data_octal) {
}
set wincur(data_binary) {}
foreach wincur(num) $wincur(data_octal) {
- append wincur(data_binary) [binary format c 0$wincur(num)]
+ append wincur(data_binary) [binary format c [scan $wincur(num) %o]]
}
-set wincur(dir) [::tcltest::makeDirectory {dir with spaces}]
-set wincur(file) [::tcltest::makeFile $wincur(data_binary) "test file.cur" $wincur(dir)]
-test cursor-2.3 {Tk_GetCursor procedure: cursor specs are lists} {pcOnly} {
+set wincur(dir) [makeDirectory {dir with spaces}]
+set wincur(file) [makeFile $wincur(data_binary) "test file.cur" $wincur(dir)]
+test cursor-2.3 {Tk_GetCursor procedure: cursor specs are lists} win {
destroy .b1
button .b1 -cursor [list @$wincur(file)]
} {.b1}
-test cursor-2.4 {Tk_GetCursor procedure: cursor specs are lists} {pcOnly} {
+test cursor-2.4 {Tk_GetCursor procedure: cursor specs are lists} win {
destroy .b1
button .b1 -cursor @[regsub -all {[][ \\{}""$#]} $wincur(file) {\\&}]
} {.b1}
-::tcltest::removeDirectory $wincur(dir)
+removeDirectory $wincur(dir)
unset wincur
test cursor-3.1 {Tk_FreeCursorFromObj - reference counts} {testcursor} {
@@ -132,157 +127,187 @@ test cursor-4.1 {FreeCursorObjProc} {testcursor} {
# -------------------------------------------------------------------------
-test cursor-5.1 {assert consistent cursor configuration command} \
- -setup { button .b } \
- -body {
- list [catch {.b configure -cursor {watch red black}} msg] $msg
- } \
- -cleanup {destroy .b} \
- -result {0 {}}
+test cursor-5.1 {assert consistent cursor configuration command} -setup {
+ button .b
+} -body {
+ .b configure -cursor {watch red black}
+} -cleanup {
+ destroy .b
+} -result {}
# -------------------------------------------------------------------------
# Check for the standard set of cursors.
-set n 0
-foreach cursor {
- X_cursor
- arrow
- based_arrow_down
- based_arrow_up
- boat
- bogosity
- bottom_left_corner
- bottom_right_corner
- bottom_side
- bottom_tee
- box_spiral
- center_ptr
- circle
- clock
- coffee_mug
- cross
- cross_reverse
- crosshair
- diamond_cross
- dot
- dotbox
- double_arrow
- draft_large
- draft_small
- draped_box
- exchange
- fleur
- gobbler
- gumby
- hand1
- hand2
- heart
- icon
- iron_cross
- left_ptr
- left_side
- left_tee
- leftbutton
- ll_angle
- lr_angle
- man
- middlebutton
- mouse
- pencil
- pirate
- plus
- question_arrow
- right_ptr
- right_side
- right_tee
- rightbutton
- rtl_logo
- sailboat
- sb_down_arrow
- sb_h_double_arrow
- sb_left_arrow
- sb_right_arrow
- sb_up_arrow
- sb_v_double_arrow
- shuttle
- sizing
- spider
- spraycan
- star
- target
- tcross
- top_left_arrow
- top_left_corner
- top_right_corner
- top_side
- top_tee
- trek
- ul_angle
- umbrella
- ur_angle
- watch
- xterm
+foreach {testName cursor} {
+ cursor-6.1 X_cursor
+ cursor-6.2 arrow
+ cursor-6.3 based_arrow_down
+ cursor-6.4 based_arrow_up
+ cursor-6.5 boat
+ cursor-6.6 bogosity
+ cursor-6.7 bottom_left_corner
+ cursor-6.8 bottom_right_corner
+ cursor-6.9 bottom_side
+ cursor-6.10 bottom_tee
+ cursor-6.11 box_spiral
+ cursor-6.12 center_ptr
+ cursor-6.13 circle
+ cursor-6.14 clock
+ cursor-6.15 coffee_mug
+ cursor-6.16 cross
+ cursor-6.17 cross_reverse
+ cursor-6.18 crosshair
+ cursor-6.19 diamond_cross
+ cursor-6.20 dot
+ cursor-6.21 dotbox
+ cursor-6.22 double_arrow
+ cursor-6.23 draft_large
+ cursor-6.24 draft_small
+ cursor-6.25 draped_box
+ cursor-6.26 exchange
+ cursor-6.27 fleur
+ cursor-6.28 gobbler
+ cursor-6.29 gumby
+ cursor-6.30 hand1
+ cursor-6.31 hand2
+ cursor-6.32 heart
+ cursor-6.33 icon
+ cursor-6.34 iron_cross
+ cursor-6.35 left_ptr
+ cursor-6.36 left_side
+ cursor-6.37 left_tee
+ cursor-6.38 leftbutton
+ cursor-6.39 ll_angle
+ cursor-6.40 lr_angle
+ cursor-6.41 man
+ cursor-6.42 middlebutton
+ cursor-6.43 mouse
+ cursor-6.44 pencil
+ cursor-6.45 pirate
+ cursor-6.46 plus
+ cursor-6.47 question_arrow
+ cursor-6.48 right_ptr
+ cursor-6.49 right_side
+ cursor-6.50 right_tee
+ cursor-6.51 rightbutton
+ cursor-6.52 rtl_logo
+ cursor-6.53 sailboat
+ cursor-6.54 sb_down_arrow
+ cursor-6.55 sb_h_double_arrow
+ cursor-6.56 sb_left_arrow
+ cursor-6.57 sb_right_arrow
+ cursor-6.58 sb_up_arrow
+ cursor-6.59 sb_v_double_arrow
+ cursor-6.60 shuttle
+ cursor-6.61 sizing
+ cursor-6.62 spider
+ cursor-6.63 spraycan
+ cursor-6.64 star
+ cursor-6.65 target
+ cursor-6.66 tcross
+ cursor-6.67 top_left_arrow
+ cursor-6.68 top_left_corner
+ cursor-6.69 top_right_corner
+ cursor-6.70 top_side
+ cursor-6.71 top_tee
+ cursor-6.72 trek
+ cursor-6.73 ul_angle
+ cursor-6.74 umbrella
+ cursor-6.75 ur_angle
+ cursor-6.76 watch
+ cursor-6.77 xterm
} {
- test cursor-6.$n {check cursor $cursor} \
- -setup {button .b -text $cursor} \
- -body {
- list [catch {.b configure -cursor $cursor} msg] $msg
- } \
- -cleanup {destroy .b} \
- -result {0 {}}
- incr n
+ test $testName "check cursor-font cursor $cursor" -setup {
+ button .b -text $cursor
+ } -body {
+ .b configure -cursor $cursor
+ } -cleanup {
+ destroy .b
+ } -result {}
}
-unset n
+
+# Test cursor named "none", it is not defined in
+# the X cursor table. It is defined in a Tk specific
+# table of named cursors and should be available on
+# all platforms.
+
+test cursor-6.80 {} -setup {
+ button .b -text CButton
+} -body {
+ .b configure -cursor none
+ .b cget -cursor
+} -cleanup {
+ destroy .b
+} -result none
+
+test cursor-6.81 {} -setup {
+ button .b -text CButton
+} -body {
+ .b configure -cursor none
+ .b configure -cursor {}
+ .b cget -cursor
+} -cleanup {
+ destroy .b
+} -result {}
+
+test cursor-6.82 {} -setup {
+ button .b -text CButton
+} -body {
+ .b configure -cursor none
+ .b configure -cursor {}
+ .b configure -cursor none
+ .b cget -cursor
+} -cleanup {
+ destroy .b
+} -result none
+
+test cursor-6.83 {} -setup {
+ button .b -text CButton
+} -body {
+ # Setting fg and bg does nothing for the none cursor
+ # because it displays no fg or bg pixels.
+ set results [list]
+ .b configure -cursor none
+ lappend results [.b cget -cursor]
+ .b configure -cursor {none blue}
+ lappend results [.b cget -cursor]
+ .b configure -cursor {none blue green}
+ lappend results [.b cget -cursor]
+ .b configure -cursor {}
+ lappend results [.b cget -cursor]
+ set results
+} -cleanup {
+ destroy .b
+ unset results
+} -result {none {none blue} {none blue green} {}}
# -------------------------------------------------------------------------
# Check the Windows specific cursors
-set n 0
-foreach cursor {
- no
- starting
- size
- size_ne_sw
- size_ns
- size_nw_se
- size_we
- uparrow
- wait
-} {
- test cursor-7.$n {check cursor $cursor} \
- -constraints {pcOnly} \
- -setup {button .b -text $cursor} \
- -body {
- list [catch {.b configure -cursor $cursor} msg] $msg
- } \
- -cleanup {destroy .b} \
- -result {0 {}}
- incr n
-}
-unset n
-# -------------------------------------------------------------------------
-# Check the Mac specific cursors
-set n 0
-foreach cursor {
- text
- cross-hair
+foreach {testName cursor} {
+ cursor-7.1 no
+ cursor-7.2 starting
+ cursor-7.3 size
+ cursor-7.4 size_ne_sw
+ cursor-7.5 size_ns
+ cursor-7.6 size_nw_se
+ cursor-7.7 size_we
+ cursor-7.8 uparrow
+ cursor-7.9 wait
} {
- test cursor-8.$n {check cursor $cursor} \
- -constraints {macOnly} \
- -setup {button .b -text $cursor} \
- -body {
- list [catch {.b configure -cursor $cursor} msg] $msg
- } \
- -cleanup {destroy .b} \
- -result {0 {}}
- incr n
+ test $testName "check Windows cursor $cursor" -constraints win -setup {
+ button .b -text $cursor
+ } -body {
+ .b configure -cursor $cursor
+ } -cleanup {
+ destroy .b
+ } -result {}
}
-unset n
# -------------------------------------------------------------------------
destroy .t
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/dialog.test b/tests/dialog.test
index 53c10c0..f47296e 100644
--- a/tests/dialog.test
+++ b/tests/dialog.test
@@ -2,15 +2,12 @@
# It is organized in the standard fashion for Tcl tests.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-test dialog-1.1 {tk_dialog command} {
+test dialog-1.1 {tk_dialog command} -body {
list [catch {tk_dialog} msg] $msg
-} {1 {wrong # args: should be "tk_dialog w title text bitmap default args"}}
+} -match glob -result {1 {wrong # args: should be "tk_dialog w title text bitmap default *"}}
test dialog-1.2 {tk_dialog command} {
list [catch {tk_dialog foo foo foo foo foo} msg] $msg
} {1 {bad window path name "foo"}}
@@ -57,5 +54,5 @@ test dialog-2.2 {tk_dialog operation} {
set res
} {-1}
-tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/earth.gif b/tests/earth.gif
new file mode 100644
index 0000000..2c229eb
--- /dev/null
+++ b/tests/earth.gif
Binary files differ
diff --git a/tests/embed.test b/tests/embed.test
index d3c0753..bac2675 100644
--- a/tests/embed.test
+++ b/tests/embed.test
@@ -5,12 +5,11 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
+global tcl_platform
+
test embed-1.1 {TkpUseWindow procedure, bad window identifier} {
deleteWindows
list [catch {toplevel .t -use xyz} msg] $msg
@@ -29,21 +28,43 @@ test embed-1.3 {CreateFrame procedure, both -use and
-container 1} msg] $msg
} {1 {A window cannot have both the -use and the -container option set.}}
-test embed-1.4 {TkpUseWindow procedure, -container must be set} {
+if {$tcl_platform(platform) == "windows"} {
+
+# testing window embedding for Windows platform
+
+test embed-1.4.win {TkpUseWindow procedure, -container must be set} {
+ deleteWindows
+ toplevel .container
+ list [catch {toplevel .embd -use [winfo id .container]} err] $err
+} {1 {the window to use is not a Tk container}}
+
+test embed-1.5.win {TkpUseWindow procedure, -container must be set} {
+ deleteWindows
+ frame .container
+ list [catch {toplevel .embd -use [winfo id .container]} err] $err
+} {1 {the window to use is not a Tk container}}
+
+} else {
+
+# testing window embedding for other platforms
+
+test embed-1.4.nonwin {TkpUseWindow procedure, -container must be set} {
deleteWindows
toplevel .container
list [catch {toplevel .embd -use [winfo id .container]} err] $err
} {1 {window ".container" doesn't have -container option set}}
-test embed-1.5 {TkpUseWindow procedure, -container must be set} {
+test embed-1.5.nonwin {TkpUseWindow procedure, -container must be set} {
deleteWindows
frame .container
list [catch {toplevel .embd -use [winfo id .container]} err] $err
} {1 {window ".container" doesn't have -container option set}}
+}
# FIXME: test cases common to unixEmbed.test and macEmbed.test should
# be moved here.
-tcltest::cleanupTests
+cleanupTests
return
+
diff --git a/tests/entry.test b/tests/entry.test
index 9c55483..ffdbf45 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
proc scroll args {
@@ -82,16 +79,16 @@ foreach test {
{-width 402 402 3p {expected integer but got "3p"}}
{-xscrollcommand {Some command} {Some command} {} {}}
} {
- set name [lindex $test 0]
+ lassign $test name goodValue goodResult badValue badResult
test entry-1.$i {configuration options} {
- .e configure $name [lindex $test 1]
+ .e configure $name $goodValue
list [lindex [.e configure $name] 4] [.e cget $name]
- } [list [lindex $test 2] [lindex $test 2]]
+ } [list $goodResult $goodResult]
incr i
- if {[lindex $test 3] != ""} {
- test entry-1.$i {configuration options} {
- list [catch {.e configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test entry-1.$i {configuration options} -body {
+ .e configure $name $badValue
+ } -returnCodes error -result $badResult
}
.e configure $name [lindex [.e configure $name] 3]
incr i
@@ -250,7 +247,7 @@ test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} {
.e configure -state normal
.e get
} {01234567890}
-test entry-3.27 {EntryWidgetCmd procedure, "delete" widget command} {
+test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} {
.e delete 0 end
.e insert end "01234567890"
.e configure -state readonly
@@ -314,7 +311,7 @@ test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} {
.e configure -state normal
.e get
} {01234567890}
-test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} {
+test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} {
.e delete 0 end
.e insert end "01234567890"
.e configure -state readonly
@@ -451,7 +448,7 @@ test entry-3.64 {EntryWidgetCmd procedure, "selection" widget command} {
.e configure -state normal
list [.e index sel.first] [.e index sel.last]
} {0 10}
-test entry-3.64 {EntryWidgetCmd procedure, "selection" widget command} {
+test entry-3.64a {EntryWidgetCmd procedure, "selection" widget command} {
.e delete 0 end
.e insert end 0123456789
.e selection range 0 end
@@ -463,13 +460,13 @@ test entry-3.64 {EntryWidgetCmd procedure, "selection" widget command} {
.e delete 0 end
.e insert end "This is quite a long text string, so long that it "
.e insert end "runs off the end of the window quite a bit."
-test entry-3.64 {EntryWidgetCmd procedure, "selection to" widget command} {
+test entry-3.64b {EntryWidgetCmd procedure, "selection to" widget command} {
list [catch {.e select to 2 3} msg] $msg
} {1 {wrong # args: should be ".e selection to index"}}
test entry-3.65 {EntryWidgetCmd procedure, "xview" widget command} {
.e xview 5
- .e xview
-} {0.0537634 0.268817}
+ format {%.7f %.7f} {*}[.e xview]
+} {0.0537634 0.2688172}
test entry-3.66 {EntryWidgetCmd procedure, "xview" widget command} {
list [catch {.e xview gorp} msg] $msg
} {1 {bad entry index "gorp"}}
@@ -477,7 +474,7 @@ test entry-3.67 {EntryWidgetCmd procedure, "xview" widget command} {
.e xview 0
.e icursor 10
.e xview insert
- .e xview
+ format {%.6f %.6f} {*}[.e xview]
} {0.107527 0.322581}
test entry-3.68 {EntryWidgetCmd procedure, "xview" widget command} {
list [catch {.e xview moveto foo bar} msg] $msg
@@ -487,8 +484,8 @@ test entry-3.69 {EntryWidgetCmd procedure, "xview" widget command} {
} {1 {expected floating-point number but got "foo"}}
test entry-3.70 {EntryWidgetCmd procedure, "xview" widget command} {
.e xview moveto 0.5
- .e xview
-} {0.505376 0.72043}
+ format {%.6f %.6f} {*}[.e xview]
+} {0.505376 0.720430}
test entry-3.71 {EntryWidgetCmd procedure, "xview" widget command} {
list [catch {.e xview scroll 24} msg] $msg
} {1 {wrong # args: should be ".e xview scroll number units|pages"}}
@@ -498,13 +495,13 @@ test entry-3.72 {EntryWidgetCmd procedure, "xview" widget command} {
test entry-3.73 {EntryWidgetCmd procedure, "xview" widget command} {
.e xview moveto 0
.e xview scroll 1 pages
- .e xview
+ format {%.6f %.6f} {*}[.e xview]
} {0.193548 0.408602}
test entry-3.74 {EntryWidgetCmd procedure, "xview" widget command} {
.e xview moveto .9
update
.e xview scroll -2 p
- .e xview
+ format {%.6f %.6f} {*}[.e xview]
} {0.397849 0.612903}
test entry-3.75 {EntryWidgetCmd procedure, "xview" widget command} {
.e xview 30
@@ -542,12 +539,12 @@ test entry-3.81 {EntryWidgetCmd procedure, "xview" widget command} {
set x {}
.e xview moveto .1
- lappend x [lindex [.e xview] 0]
+ lappend x [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .11
- lappend x [lindex [.e xview] 0]
+ lappend x [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .12
- lappend x [lindex [.e xview] 0]
-} {0.0957447 0.106383 0.117021}
+ lappend x [format {%.6f} [lindex [.e xview] 0]]
+} {0.095745 0.106383 0.117021}
test entry-3.82 {EntryWidgetCmd procedure} {
list [catch {.e gorp} msg] $msg
} {1 {bad option "gorp": must be bbox, cget, configure, delete, get, icursor, index, insert, scan, selection, validate, or xview}}
@@ -639,8 +636,8 @@ test entry-5.7 {ConfigureEntry procedure} {
.e insert end "01234567890"
update
.e configure -width 5
- set scrollInfo
-} {0 0.363636}
+ format {%.6f %.6f} {*}$scrollInfo
+} {0.000000 0.363636}
test entry-5.8 {ConfigureEntry procedure} {fonts} {
catch {destroy .e}
entry .e -width 0
@@ -674,7 +671,7 @@ test entry-5.11 {ConfigureEntry procedure} {
pack [entry .e -font {{open look glyph}}]
.e scan dragto 30
update
-} {}
+} {}
# No tests for DisplayEntry.
@@ -754,7 +751,7 @@ test entry-6.9 {EntryComputeGeometry procedure} {fonts} {
update
list [winfo reqwidth .e] [winfo reqheight .e]
} {25 39}
-test entry-6.10 {EntryComputeGeometry procedure} {unixOnly fonts} {
+test entry-6.10 {EntryComputeGeometry procedure} {unix fonts} {
catch {destroy .e}
entry .e -bd 1 -relief raised -width 0 -show .
.e insert 0 12345
@@ -766,7 +763,7 @@ test entry-6.10 {EntryComputeGeometry procedure} {unixOnly fonts} {
.e configure -show ""
lappend x [winfo reqwidth .e]
} {23 53 43}
-test entry-6.11 {EntryComputeGeometry procedure} {pcOnly} {
+test entry-6.11 {EntryComputeGeometry procedure} win {
catch {destroy .e}
entry .e -bd 1 -relief raised -width 0 -show . -font {helvetica 12}
.e insert 0 12345
@@ -791,15 +788,15 @@ test entry-7.1 {InsertChars procedure} {
.e insert 0 abcde
.e insert 2 XXX
update
- list [.e get] $contents $scrollInfo
-} {abXXXcde abXXXcde {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abXXXcde abXXXcde {0.000000 1.000000}}
test entry-7.2 {InsertChars procedure} {
.e delete 0 end
.e insert 0 abcde
.e insert 500 XXX
update
- list [.e get] $contents $scrollInfo
-} {abcdeXXX abcdeXXX {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abcdeXXX abcdeXXX {0.000000 1.000000}}
test entry-7.3 {InsertChars procedure} {
.e delete 0 end
.e insert 0 0123456789
@@ -885,22 +882,22 @@ test entry-8.1 {DeleteChars procedure} {
.e insert 0 abcde
.e delete 2 4
update
- list [.e get] $contents $scrollInfo
-} {abe abe {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abe abe {0.000000 1.000000}}
test entry-8.2 {DeleteChars procedure} {
.e delete 0 end
.e insert 0 abcde
.e delete -2 2
update
- list [.e get] $contents $scrollInfo
-} {cde cde {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {cde cde {0.000000 1.000000}}
test entry-8.3 {DeleteChars procedure} {
.e delete 0 end
.e insert 0 abcde
.e delete 3 1000
update
- list [.e get] $contents $scrollInfo
-} {abc abc {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abc abc {0.000000 1.000000}}
test entry-8.4 {DeleteChars procedure} {
.e delete 0 end
.e insert 0 0123456789abcde
@@ -1196,26 +1193,26 @@ test entry-13.9 {GetEntryIndex procedure} {
list [.e index sel.first] [.e index sel.last]
} {1 6}
selection clear .e
-test entry-13.10 {GetEntryIndex procedure} {unixOnly} {
+test entry-13.10 {GetEntryIndex procedure} unix {
# On unix, when selection is cleared, entry widget's internal
# selection range is reset.
list [catch {.e index sel.first} msg] $msg
} {1 {selection isn't in widget .e}}
-test entry-13.11 {GetEntryIndex procedure} {macOrPc} {
+test entry-13.11 {GetEntryIndex procedure} win {
# On mac and pc, when selection is cleared, entry widget remembers
# last selected range. When selection ownership is restored to
# entry, the old range will be rehighlighted.
list [catch {selection get}] [.e index sel.first]
} {1 1}
-test entry-13.12 {GetEntryIndex procedure} {unixOnly} {
+test entry-13.12 {GetEntryIndex procedure} unix {
list [catch {.e index sbogus} msg] $msg
} {1 {selection isn't in widget .e}}
-test entry-13.13 {GetEntryIndex procedure} {macOrPc} {
+test entry-13.13 {GetEntryIndex procedure} win {
list [catch {.e index sbogus} msg] $msg
} {1 {bad entry index "sbogus"}}
-test entry-13.14 {GetEntryIndex procedure} {macOrPc} {
+test entry-13.14 {GetEntryIndex procedure} win {
list [catch {selection get}] [catch {.e index sbogus}]
} {1 1}
test entry-13.15 {GetEntryIndex procedure} {
@@ -1314,25 +1311,25 @@ update
test entry-16.1 {EntryVisibleRange procedure} {fonts} {
.e delete 0 end
.e insert 0 .............................
- .e xview
-} {0 0.827586}
-test entry-15.2 {EntryVisibleRange procedure} {unixOnly fonts} {
+ format {%.6f %.6f} {*}[.e xview]
+} {0.000000 0.827586}
+test entry-16.2 {EntryVisibleRange procedure} {unix fonts} {
.e configure -show X
.e delete 0 end
.e insert 0 .............................
- .e xview
-} {0 0.275862}
-test entry-15.3 {EntryVisibleRange procedure} {pcOnly} {
+ format {%.6f %.6f} {*}[.e xview]
+} {0.000000 0.275862}
+test entry-16.3 {EntryVisibleRange procedure} win {
.e configure -show .
.e delete 0 end
.e insert 0 XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- .e xview
-} {0 0.827586}
+ format {%.6f %.6f} {*}[.e xview]
+} {0.000000 0.827586}
.e configure -show ""
-test entry-15.4 {EntryVisibleRange procedure} {
+test entry-16.4 {EntryVisibleRange procedure} {
.e delete 0 end
- .e xview
-} {0 1}
+ format {%.6f %.6f} {*}[.e xview]
+} {0.000000 1.000000}
catch {destroy .e}
entry .e -width 10 -xscrollcommand scroll -font $fixed
@@ -1342,21 +1339,21 @@ test entry-17.1 {EntryUpdateScrollbar procedure} {
.e delete 0 end
.e insert 0 123
update
- set scrollInfo
-} {0 1}
+ format {%.6f %.6f} {*}$scrollInfo
+} {0.000000 1.000000}
test entry-17.2 {EntryUpdateScrollbar procedure} {
.e delete 0 end
.e insert 0 0123456789abcdef
.e xview 3
update
- set scrollInfo
-} {0.1875 0.8125}
+ format {%.6f %.6f} {*}$scrollInfo
+} {0.187500 0.812500}
test entry-17.3 {EntryUpdateScrollbar procedure} {
.e delete 0 end
.e insert 0 abcdefghijklmnopqrs
.e xview 6
update
- set scrollInfo
+ format {%.6f %.6f} {*}$scrollInfo
} {0.315789 0.842105}
test entry-17.4 {EntryUpdateScrollbar procedure} {
destroy .e
@@ -1371,7 +1368,7 @@ test entry-17.4 {EntryUpdateScrollbar procedure} {
list $x $errorInfo
} {{invalid command name "thisisnotacommand"} {invalid command name "thisisnotacommand"
while executing
-"thisisnotacommand 0 1"
+"thisisnotacommand 0.0 1.0"
(horizontal scrolling command executed by .e)}}
set l [interp hidden]
@@ -1631,5 +1628,5 @@ destroy .e
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/event.test b/tests/event.test
index f6f30df..fa75610 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# XXX This test file is woefully incomplete. Right now it only tests
@@ -19,7 +16,7 @@ tcltest::loadTestedCommands
# Setup table used to query key events.
-proc _init_keypress_lookup { } {
+proc _init_keypress_lookup {} {
global keypress_lookup
scan A %c start
@@ -46,43 +43,47 @@ proc _init_keypress_lookup { } {
set keypress_lookup($l) $l
}
+ # Most punctuation
+ array set keypress_lookup {
+ ! exclam
+ % percent
+ & ampersand
+ ( parenleft
+ ) parenright
+ * asterisk
+ + plus
+ , comma
+ - minus
+ . period
+ / slash
+ : colon
+ < less
+ = equal
+ > greater
+ ? question
+ @ at
+ ^ asciicircum
+ _ underscore
+ | bar
+ ~ asciitilde
+ ' apostrophe
+ }
+ # Characters with meaning to Tcl...
array set keypress_lookup [list \
- " " space \
- ! exclam \
- \" quotedbl \
- \# numbersign \
- \$ dollar \
- % percent \
- & ampersand \
- ( parenleft \
- ) parenright \
- * asterisk \
- + plus \
- , comma \
- - minus \
- . period \
- / slash \
- : colon \
- \; semicolon \
- < less \
- = equal \
- > greater \
- ? question \
- @ at \
- \[ bracketleft \
- \\ backslash \
- \] bracketright \
- ^ asciicircum \
- _ underscore \
- \{ braceleft \
- | bar \
- \} braceright \
- ~ asciitilde \
- ' apostrophe \
- "\n" Return]
+ \" quotedbl \
+ \# numbersign \
+ \$ dollar \
+ \; semicolon \
+ \[ bracketleft \
+ \\ backslash \
+ \] bracketright \
+ \{ braceleft \
+ \} braceright \
+ " " space \
+ "\n" Return \
+ "\t" Tab]
}
-
# Lookup an event in the keypress table.
# For example:
# Q -> Q
@@ -91,7 +92,7 @@ proc _init_keypress_lookup { } {
# Delete -> Delete
# Escape -> Escape
-proc _keypress_lookup { char } {
+proc _keypress_lookup {char} {
global keypress_lookup
if {! [info exists keypress_lookup]} {
@@ -109,10 +110,9 @@ proc _keypress_lookup { char } {
}
}
-
# Lookup and generate a pair of KeyPress and KeyRelease events
-proc _keypress { win key } {
+proc _keypress {win key} {
set keysym [_keypress_lookup $key]
# Force focus to the window before delivering
@@ -134,7 +134,7 @@ proc _keypress { win key } {
# Call _keypress for each character in the given string
-proc _keypress_string { win string } {
+proc _keypress_string {win string} {
foreach letter [split $string ""] {
_keypress $win $letter
}
@@ -142,7 +142,7 @@ proc _keypress_string { win string } {
# Delay script execution for a given amount of time
-proc _pause { {msecs 1000} } {
+proc _pause {{msecs 1000}} {
global _pause
if {! [info exists _pause(number)]} {
@@ -159,7 +159,7 @@ proc _pause { {msecs 1000} } {
# Helper proc to convert index to x y position
-proc _text_ind_to_x_y { text ind } {
+proc _text_ind_to_x_y {text ind} {
set bbox [$text bbox $ind]
if {[llength $bbox] != 4} {
error "got bbox \{$bbox\} from $text, index $ind"
@@ -171,7 +171,7 @@ proc _text_ind_to_x_y { text ind } {
# Return selection only if owned by the given widget
-proc _get_selection { widget } {
+proc _get_selection {widget} {
if {[string compare $widget [selection own]] != 0} {
return ""
}
@@ -200,7 +200,6 @@ test event-1.1 {Tk_HandleEvent procedure, filter events for dead windows} {
destroy .b
set x
} {destroy}
-
test event-1.2 {event generate <Alt-z>} {
catch {destroy .e}
catch {unset ::event12result}
@@ -213,9 +212,7 @@ test event-1.2 {event generate <Alt-z>} {
set ::event12result
} 1
-
-
-test event-keypress-1.1 { type into entry widget and hit Return } {
+test event-2.1(keypress) {type into entry widget and hit Return} {
destroy .t
set t [toplevel .t]
set e [entry $t.e]
@@ -226,9 +223,7 @@ test event-keypress-1.1 { type into entry widget and hit Return } {
_keypress_string $e HELLO\n
list [$e get] $return_binding
} {HELLO 1}
-
-
-test event-keypress-1.2 { type into entry widget and then delete some text } {
+test event-2.2(keypress) {type into entry widget and then delete some text} {
destroy .t
set t [toplevel .t]
set e [entry $t.e]
@@ -239,9 +234,8 @@ test event-keypress-1.2 { type into entry widget and then delete some text } {
_keypress $e BackSpace
$e get
} MEL
-
-test event-keypress-1.3 { type into entry widget, triple click,
- hit Delete key, and then type some more } {
+test event-2.3(keypress) {type into entry widget, triple click,\
+ hit Delete key, and then type some more} {
destroy .t
set t [toplevel .t]
set e [entry $t.e]
@@ -263,9 +257,7 @@ test event-keypress-1.3 { type into entry widget, triple click,
_keypress_string $e UP
lappend result [$e get]
} {JUMP UP}
-
-
-test event-keypress-1.4 { type into text widget and hit Return } {
+test event-1.4(keypress) {type into text widget and hit Return} {
destroy .t
set t [toplevel .t]
set e [text $t.e]
@@ -276,8 +268,7 @@ test event-keypress-1.4 { type into text widget and hit Return } {
_keypress_string $e HELLO\n
list [$e get 1.0 end] $return_binding
} [list "HELLO\n\n" 1]
-
-test event-keypress-1.5 { type into text widget and then delete some text } {
+test event-2.5(keypress) {type into text widget and then delete some text} {
destroy .t
set t [toplevel .t]
set e [text $t.e]
@@ -288,9 +279,8 @@ test event-keypress-1.5 { type into text widget and then delete some text } {
_keypress $e BackSpace
$e get 1.0 1.end
} MEL
-
-test event-keypress-1.6 { type into text widget, triple click,
- hit Delete key, and then type some more } {
+test event-2.6(keypress) {type into text widget, triple click,\
+ hit Delete key, and then type some more} {
destroy .t
set t [toplevel .t]
set e [text $t.e]
@@ -313,10 +303,8 @@ test event-keypress-1.6 { type into text widget, triple click,
lappend result [$e get 1.0 1.end]
} {JUMP UP}
-
-
-test event-click-drag-1.1 { click and drag in a text widget, this
- tests tkTextSelectTo in text.tcl } {
+test event-3.1(click-drag) {click and drag in a text widget, this tests\
+ tkTextSelectTo in text.tcl} {
destroy .t
set t [toplevel .t]
set e [text $t.e]
@@ -379,12 +367,8 @@ test event-click-drag-1.1 { click and drag in a text widget, this
lappend result [_get_selection $e]
} {{A Tcl/Tk selection test!} 1.6 1.18 {Tk selection} 1.2 {Tcl/Tk selection}}
-
-
-
-
-test event-click-drag-1.2 { click and drag in an entry widget, this
- tests tkEntryMouseSelect in entry.tcl } {
+test event-3.2(click-drag) {click and drag in an entry widget, this\
+ tests tkEntryMouseSelect in entry.tcl} {
destroy .t
set t [toplevel .t]
set e [entry $t.e]
@@ -448,10 +432,8 @@ test event-click-drag-1.2 { click and drag in an entry widget, this
} {{A Tcl/Tk selection!} 6 18 {Tk selection} 2 {Tcl/Tk selection}}
-
-
-test event-double-click-drag-1.1 { click down, click up, click down again,
- then drag in a text widget } {
+test event-4.1(double-click-drag) {click down, click up, click down again,\
+ then drag in a text widget} {
destroy .t
set t [toplevel .t]
set e [text $t.e]
@@ -476,7 +458,7 @@ test event-double-click-drag-1.1 { click down, click up, click down again,
set result [list]
lappend result [_get_selection $e]
- # Insert cursor should be at end of "select"
+ # Insert cursor should be at beginning of "select"
lappend result [$e index insert]
# Move mouse one character to the left
@@ -516,12 +498,9 @@ test event-double-click-drag-1.1 { click down, click up, click down again,
lappend result [$e index insert]
set result
-} {select 1.11 1.7 select 1.4 { select} {Word select} 1.2}
-
-
-
-test event-double-click-drag-1.2 { click down, click up, click down again,
- then drag in an entry widget } {
+} {select 1.5 1.7 select 1.4 { select} {Word select} 1.2}
+test event-4.2(double-click-drag) {click down, click up, click down again,\
+ then drag in an entry widget} {
destroy .t
set t [toplevel .t]
set e [entry $t.e]
@@ -588,9 +567,8 @@ test event-double-click-drag-1.2 { click down, click up, click down again,
set result
} {select 11 7 select 4 { select} {Word select} 2}
-
-test event-triple-click-drag-1.1 { Triple click and drag across lines in
- a text widget, this should extend the selection to the new line } {
+test event-5.1(triple-click-drag) {Triple click and drag across lines in\
+ a text widget, this should extend the selection to the new line} {
destroy .t
set t [toplevel .t]
set e [text $t.e]
@@ -647,10 +625,10 @@ test event-triple-click-drag-1.1 { Triple click and drag across lines in
} [list "LINE THREE\n" "LINE TWO\nLINE THREE\n" \
"LINE ONE\nLINE TWO\nLINE THREE\n"]
-test event-button-state-1.1 { button press in a window that is then
- destroyed, when the mouse is moved into another window it
- should not generate a <B1-motion> event since the mouse
- was not pressed down in that window. } {
+test event-6.1(button-state) {button press in a window that is then\
+ destroyed, when the mouse is moved into another window it\
+ should not generate a <B1-motion> event since the mouse\
+ was not pressed down in that window} {
destroy .t
set t [toplevel .t]
@@ -663,6 +641,133 @@ test event-button-state-1.1 { button press in a window that is then
set motion
} nomotion
+test event-7.1(double-click) {A double click on a lone character
+ in a text widget should select that character} {
+ destroy .t
+ set t [toplevel .t]
+ set e [text $t.e]
+ pack $e
+ tkwait visibility $e
+ focus -force $e
+ _keypress_string $e "On A letter"
+
+ set anchor 1.3
+
+ # Get x,y coords just inside the left
+ # and right hand side of the letter A
+ foreach {x1 y1 width height} [$e bbox $anchor] break
+
+ set middle_y [expr {$y1 + ($height / 2)}]
+
+ set left_x [expr {$x1 + 2}]
+ set left_y $middle_y
+
+ set right_x [expr {($x1 + $width) - 2}]
+ set right_y $middle_y
+
+ # Double click near left hand egde of the letter A
+
+ event generate $e <Enter>
+ event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $left_x -y $left_y
+ _pause 50
+ event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $left_x -y $left_y
+ _pause 50
+
+ set result [list]
+ lappend result [$e index insert]
+ lappend result [_get_selection $e]
+
+ # Clear selection by clicking at 0,0
+
+ event generate $e <ButtonPress-1> -x 0 -y 0
+ _pause 50
+ event generate $e <ButtonRelease-1> -x 0 -y 0
+ _pause 50
+
+ # Double click near right hand edge of the letter A
+
+ event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $right_x -y $right_y
+ _pause 50
+ event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $right_x -y $right_y
+ _pause 50
+
+ lappend result [$e index insert]
+ lappend result [_get_selection $e]
+
+ set result
+} {1.3 A 1.3 A}
+test event-7.2(double-click) {A double click on a lone character\
+ in an entry widget should select that character} {knownBug} {
+ destroy .t
+ set t [toplevel .t]
+ set e [entry $t.e]
+ pack $e
+ tkwait visibility $e
+ focus -force $e
+ _keypress_string $e "On A letter"
+
+ set anchor 3
+
+ # Get x,y coords just inside the left
+ # and right hand side of the letter A
+ foreach {x1 y1 width height} [$e bbox $anchor] break
+
+ set middle_y [expr {$y1 + ($height / 2)}]
+
+ set left_x [expr {$x1 + 2}]
+ set left_y $middle_y
+
+ set right_x [expr {($x1 + $width) - 2}]
+ set right_y $middle_y
+
+ # Double click near left hand egde of the letter A
+
+ event generate $e <Enter>
+ event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $left_x -y $left_y
+ _pause 50
+ event generate $e <ButtonPress-1> -x $left_x -y $left_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $left_x -y $left_y
+ _pause 50
+
+ set result [list]
+ lappend result [$e index insert]
+ lappend result [_get_selection $e]
+
+ # Clear selection by clicking at 0,0
+
+ event generate $e <ButtonPress-1> -x 0 -y 0
+ _pause 50
+ event generate $e <ButtonRelease-1> -x 0 -y 0
+ _pause 50
+
+ # Double click near right hand edge of the letter A
+
+ event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $right_x -y $right_y
+ _pause 50
+ event generate $e <ButtonPress-1> -x $right_x -y $right_y
+ _pause 50
+ event generate $e <ButtonRelease-1> -x $right_x -y $right_y
+ _pause 50
+
+ lappend result [$e index insert]
+ lappend result [_get_selection $e]
+
+ set result
+} {3 A 4 A}
+
# cleanup
destroy .t
@@ -675,6 +780,5 @@ rename _pause {}
rename _text_ind_to_x_y {}
rename _get_selection {}
-::tcltest::cleanupTests
+cleanupTests
return
-
diff --git a/tests/face.xbm b/tests/face.xbm
new file mode 100644
index 0000000..03d829f
--- /dev/null
+++ b/tests/face.xbm
@@ -0,0 +1,173 @@
+#define face_width 108
+#define face_height 144
+#define face_x_hot 48
+#define face_y_hot 80
+static char face_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09,
+ 0x20, 0x80, 0x24, 0x05, 0x00, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x88,
+ 0x24, 0x20, 0x80, 0x24, 0x00, 0x00, 0x00, 0x10, 0x80, 0x04, 0x00, 0x01,
+ 0x00, 0x01, 0x40, 0x0a, 0x09, 0x00, 0x92, 0x04, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x10, 0x40, 0x12, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x84,
+ 0x24, 0x40, 0x22, 0xa8, 0x02, 0x14, 0x84, 0x92, 0x40, 0x42, 0x12, 0x04,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x52, 0x11, 0x00, 0x12, 0x00,
+ 0x40, 0x02, 0x00, 0x20, 0x00, 0x08, 0x00, 0xaa, 0x02, 0x54, 0x85, 0x24,
+ 0x00, 0x10, 0x12, 0x00, 0x00, 0x81, 0x44, 0x00, 0x90, 0x5a, 0x00, 0xea,
+ 0x1b, 0x00, 0x80, 0x40, 0x40, 0x02, 0x00, 0x08, 0x00, 0x20, 0xa2, 0x05,
+ 0x8a, 0xb4, 0x6e, 0x45, 0x12, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10, 0x02,
+ 0xa8, 0x92, 0x00, 0xda, 0x5f, 0x10, 0x00, 0x10, 0xa1, 0x04, 0x20, 0x41,
+ 0x02, 0x00, 0x5a, 0x25, 0xa0, 0xff, 0xfb, 0x05, 0x41, 0x02, 0x04, 0x00,
+ 0x00, 0x08, 0x40, 0x80, 0xec, 0x9b, 0xec, 0xfe, 0x7f, 0x01, 0x04, 0x20,
+ 0x90, 0x02, 0x04, 0x00, 0x08, 0x20, 0xfb, 0x2e, 0xf5, 0xff, 0xff, 0x57,
+ 0x00, 0x04, 0x02, 0x00, 0x00, 0x20, 0x01, 0xc1, 0x6e, 0xab, 0xfa, 0xff,
+ 0xff, 0x05, 0x90, 0x20, 0x48, 0x02, 0x00, 0x04, 0x20, 0xa8, 0xdf, 0xb5,
+ 0xfe, 0xff, 0xff, 0x0b, 0x01, 0x00, 0x01, 0x00, 0x80, 0x80, 0x04, 0xe0,
+ 0xbb, 0xef, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x04, 0x48, 0x02, 0x00, 0x20,
+ 0x80, 0xf4, 0x6f, 0xfb, 0xff, 0xff, 0xff, 0x20, 0x90, 0x40, 0x02, 0x00,
+ 0x00, 0x04, 0x08, 0xb8, 0xf6, 0xff, 0xff, 0xdf, 0xbe, 0x12, 0x45, 0x10,
+ 0x90, 0x04, 0x90, 0x00, 0x22, 0xfa, 0xff, 0xff, 0xff, 0xbb, 0xd7, 0xe9,
+ 0x3a, 0x02, 0x02, 0x00, 0x04, 0x90, 0x80, 0xfe, 0xdf, 0xf6, 0xb7, 0xef,
+ 0xbe, 0x56, 0x57, 0x40, 0x48, 0x09, 0x00, 0x04, 0x00, 0xfa, 0xf5, 0xdf,
+ 0xed, 0x5a, 0xd5, 0xea, 0xbd, 0x09, 0x00, 0x00, 0x40, 0x00, 0x92, 0xfe,
+ 0xbf, 0x7d, 0xb7, 0x6a, 0x55, 0xbf, 0xf7, 0x02, 0x11, 0x01, 0x00, 0x91,
+ 0x00, 0xff, 0xff, 0xaf, 0x55, 0x55, 0x5b, 0xeb, 0xef, 0x22, 0x04, 0x04,
+ 0x04, 0x00, 0xa4, 0xff, 0xf7, 0xad, 0xaa, 0xaa, 0xaa, 0xbe, 0xfe, 0x03,
+ 0x20, 0x00, 0x10, 0x44, 0x80, 0xff, 0x7f, 0x55, 0x12, 0x91, 0x2a, 0xeb,
+ 0xbf, 0x0b, 0x82, 0x02, 0x00, 0x00, 0xd1, 0x7f, 0xdf, 0xa2, 0xa4, 0x54,
+ 0x55, 0xfd, 0xfd, 0x47, 0x08, 0x08, 0x00, 0x21, 0xe4, 0xff, 0x37, 0x11,
+ 0x09, 0xa5, 0xaa, 0xb6, 0xff, 0x0d, 0x80, 0x00, 0x00, 0x04, 0xd0, 0xff,
+ 0x4f, 0x44, 0x20, 0x48, 0x55, 0xfb, 0xff, 0x27, 0x11, 0x02, 0x40, 0x40,
+ 0xe2, 0xfb, 0x15, 0x11, 0x4a, 0x55, 0x4a, 0x7d, 0xf7, 0x0f, 0x00, 0x00,
+ 0x04, 0x08, 0xf8, 0xdf, 0x52, 0x44, 0x01, 0x52, 0xb5, 0xfa, 0xff, 0x0f,
+ 0x49, 0x02, 0x00, 0x02, 0xe9, 0xf6, 0x0a, 0x11, 0xa4, 0x88, 0x4a, 0x6d,
+ 0xff, 0x5f, 0x00, 0x00, 0x10, 0x20, 0xf0, 0x2f, 0x21, 0x44, 0x10, 0x52,
+ 0xb5, 0xfa, 0xff, 0x0f, 0x44, 0x04, 0x80, 0x08, 0xf8, 0xab, 0x8a, 0x00,
+ 0x81, 0xa4, 0xd4, 0xd6, 0xfe, 0x2f, 0x00, 0x00, 0x04, 0x40, 0xb5, 0x2d,
+ 0x21, 0x08, 0x04, 0x90, 0xaa, 0xfa, 0xff, 0x1f, 0x11, 0x01, 0x00, 0x04,
+ 0xf0, 0x57, 0x0a, 0x22, 0x40, 0x4a, 0xda, 0x5e, 0xfb, 0x1f, 0x40, 0x00,
+ 0x40, 0x20, 0xba, 0x95, 0x90, 0x00, 0x01, 0xa0, 0xaa, 0xea, 0xff, 0x5f,
+ 0x02, 0x02, 0x00, 0x01, 0xe8, 0x57, 0x05, 0x00, 0x00, 0x12, 0xd5, 0xfe,
+ 0xfd, 0x1f, 0x48, 0x00, 0x04, 0x48, 0x7a, 0x95, 0x08, 0x02, 0x10, 0x40,
+ 0xaa, 0x55, 0xf7, 0x1f, 0x00, 0x09, 0x20, 0x00, 0xf8, 0x57, 0x22, 0x10,
+ 0x00, 0x28, 0xa9, 0xfa, 0xff, 0x5f, 0x02, 0x00, 0x00, 0x49, 0xdd, 0x29,
+ 0x01, 0x00, 0x80, 0x80, 0xaa, 0xd7, 0xff, 0x0f, 0x10, 0x00, 0x08, 0x00,
+ 0xf8, 0x96, 0x08, 0x00, 0x00, 0x20, 0x54, 0xfa, 0xee, 0x3f, 0x81, 0x04,
+ 0x40, 0x24, 0xfe, 0x55, 0x82, 0x00, 0x00, 0x82, 0xd2, 0xad, 0xff, 0x0f,
+ 0x08, 0x00, 0x04, 0x80, 0x6c, 0x97, 0x00, 0x00, 0x02, 0x20, 0xa9, 0xf6,
+ 0xdf, 0x5f, 0x00, 0x02, 0x20, 0x09, 0xfa, 0x49, 0x12, 0x00, 0x20, 0x84,
+ 0x54, 0xdb, 0xfe, 0x1f, 0x91, 0x00, 0x00, 0x00, 0xf8, 0x2b, 0x00, 0x20,
+ 0x00, 0x40, 0xa4, 0xf6, 0xbb, 0x1f, 0x04, 0x00, 0x44, 0x92, 0x7e, 0x95,
+ 0x02, 0x00, 0x00, 0x89, 0xaa, 0xdd, 0xff, 0x1f, 0x20, 0x09, 0x10, 0x00,
+ 0xf4, 0x57, 0x20, 0x01, 0x08, 0x20, 0xa9, 0x76, 0xff, 0x5f, 0x02, 0x00,
+ 0x00, 0x21, 0xfc, 0x4a, 0x05, 0x00, 0x01, 0x80, 0x54, 0xdb, 0xff, 0x1e,
+ 0x08, 0x02, 0x04, 0x08, 0xf9, 0x2b, 0x00, 0x00, 0x40, 0x28, 0xd2, 0xf6,
+ 0xff, 0xbf, 0x80, 0x00, 0x90, 0x00, 0xbc, 0x92, 0x08, 0x10, 0x00, 0x82,
+ 0x54, 0xdb, 0xff, 0x1f, 0x20, 0x00, 0x00, 0x44, 0xf9, 0x55, 0x02, 0x01,
+ 0x00, 0x20, 0xaa, 0xbd, 0xfd, 0x3f, 0x08, 0x04, 0x04, 0x10, 0xf4, 0x2a,
+ 0x01, 0x00, 0x22, 0x80, 0xd4, 0xf6, 0xff, 0x5f, 0x82, 0x00, 0x40, 0x02,
+ 0xf8, 0x55, 0x20, 0x00, 0x00, 0x50, 0x6a, 0xdf, 0xfe, 0x3f, 0x00, 0x00,
+ 0x00, 0x48, 0xe9, 0x4a, 0x05, 0x08, 0x00, 0xa5, 0xd5, 0xf5, 0xff, 0x3f,
+ 0x10, 0x01, 0x10, 0x01, 0xb0, 0xab, 0x92, 0x02, 0x40, 0xf8, 0xbf, 0xde,
+ 0xfe, 0x5f, 0x02, 0x04, 0x04, 0x48, 0xfa, 0xd4, 0x6f, 0x20, 0x84, 0xef,
+ 0xff, 0xfb, 0xff, 0x1f, 0x20, 0x00, 0x00, 0x00, 0xe0, 0xed, 0xbf, 0x0b,
+ 0xa1, 0x7e, 0xff, 0xbf, 0xfd, 0x5f, 0x04, 0x01, 0x20, 0x49, 0xd2, 0xfb,
+ 0xfe, 0x55, 0xd4, 0xff, 0xff, 0xf6, 0xff, 0x07, 0x00, 0x04, 0x00, 0x00,
+ 0xc0, 0xaa, 0xfb, 0x2b, 0xa2, 0xfe, 0xff, 0xdf, 0xee, 0x1f, 0x91, 0x00,
+ 0x82, 0xa4, 0xa4, 0xf5, 0xff, 0x57, 0xd5, 0xff, 0xbf, 0xfd, 0xff, 0x4d,
+ 0x00, 0x00, 0x20, 0x00, 0x88, 0x5b, 0xff, 0x2f, 0x69, 0xff, 0xff, 0xdb,
+ 0xfe, 0x1f, 0x24, 0x02, 0x00, 0x49, 0xa2, 0xd6, 0xff, 0x5f, 0xea, 0xff,
+ 0x7f, 0x7f, 0x7f, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x40, 0xab, 0xf7, 0xbb,
+ 0xf0, 0xdf, 0xff, 0xd5, 0xff, 0xbf, 0x82, 0x04, 0x42, 0x24, 0x91, 0xd5,
+ 0xaa, 0xae, 0xd4, 0xaa, 0x52, 0x7b, 0xff, 0x15, 0x08, 0x00, 0x00, 0x01,
+ 0x04, 0x55, 0xd5, 0x55, 0x70, 0x5b, 0x75, 0xdd, 0xdf, 0x1f, 0x40, 0x00,
+ 0x08, 0x48, 0xa0, 0x4a, 0xa9, 0x56, 0xea, 0x56, 0xad, 0x6a, 0x7d, 0x9b,
+ 0x04, 0x01, 0x00, 0x02, 0x42, 0x2a, 0xd5, 0xaa, 0xa8, 0xaa, 0xaa, 0xfa,
+ 0xdf, 0x2f, 0x10, 0x04, 0x22, 0x48, 0x08, 0x45, 0x2a, 0x15, 0x68, 0x55,
+ 0x55, 0xd7, 0x76, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x40, 0x2a, 0x80, 0xa0,
+ 0xb2, 0x09, 0x48, 0xb9, 0xdf, 0x17, 0x22, 0x01, 0x00, 0x24, 0x45, 0x8a,
+ 0x24, 0x4a, 0x54, 0x51, 0x91, 0xf6, 0x6e, 0x4b, 0x00, 0x04, 0x90, 0x00,
+ 0x80, 0x52, 0x00, 0x20, 0x69, 0x05, 0xa4, 0xaa, 0xff, 0x1e, 0x48, 0x00,
+ 0x02, 0x92, 0x08, 0x05, 0x81, 0x94, 0xd4, 0x92, 0x40, 0xfd, 0xb6, 0x8b,
+ 0x00, 0x01, 0x40, 0x00, 0x82, 0x54, 0x00, 0x48, 0x68, 0x05, 0x90, 0xa4,
+ 0xef, 0x06, 0x24, 0x00, 0x08, 0x12, 0x10, 0x05, 0x00, 0x10, 0xb5, 0x01,
+ 0x42, 0xfb, 0xbf, 0x43, 0x00, 0x09, 0x00, 0x40, 0x81, 0xa8, 0x08, 0x4a,
+ 0xaa, 0x96, 0x90, 0xac, 0x6d, 0x15, 0x22, 0x00, 0x20, 0x09, 0x04, 0x15,
+ 0x80, 0x28, 0xdc, 0x01, 0x24, 0xfb, 0xbf, 0x01, 0x80, 0x04, 0x09, 0x00,
+ 0x40, 0x48, 0x02, 0x45, 0xb2, 0x2e, 0x41, 0x6d, 0xef, 0x05, 0x11, 0x00,
+ 0x40, 0x52, 0x02, 0x15, 0x29, 0x2a, 0xac, 0x42, 0x54, 0xfb, 0x3b, 0x51,
+ 0x84, 0x00, 0x08, 0x00, 0x20, 0x54, 0x80, 0x05, 0xb5, 0x3d, 0xa2, 0xb6,
+ 0xdf, 0x00, 0x20, 0x04, 0x20, 0x49, 0x89, 0xa8, 0x6a, 0x29, 0xac, 0xd6,
+ 0x54, 0xff, 0x3f, 0x84, 0x00, 0x01, 0x04, 0x10, 0x00, 0x94, 0xa8, 0x56,
+ 0xda, 0x5f, 0xab, 0xd5, 0x1e, 0x10, 0x48, 0x00, 0x90, 0x82, 0x48, 0xa8,
+ 0xb2, 0xac, 0xfd, 0x55, 0xd5, 0xfe, 0x9f, 0x80, 0x00, 0x0a, 0x02, 0x08,
+ 0x02, 0x55, 0x5a, 0x75, 0xff, 0xaf, 0xb6, 0xf7, 0x2d, 0x12, 0x92, 0x00,
+ 0x10, 0x20, 0x10, 0xa8, 0x54, 0xd5, 0xbf, 0x5d, 0xad, 0xdd, 0x0f, 0x00,
+ 0x00, 0x04, 0x40, 0x09, 0x84, 0xa8, 0xaa, 0x5a, 0xed, 0xeb, 0x6a, 0xff,
+ 0x9f, 0xa4, 0x24, 0x01, 0x02, 0xa0, 0x20, 0x50, 0x55, 0xd5, 0xbe, 0xae,
+ 0xad, 0xfd, 0x16, 0x00, 0x10, 0x04, 0x20, 0x0a, 0x08, 0xb4, 0xaa, 0x95,
+ 0xaa, 0x7b, 0xb7, 0xdb, 0x5f, 0x92, 0x04, 0x01, 0x84, 0x20, 0x21, 0x51,
+ 0xd5, 0x2a, 0xa9, 0xee, 0xd5, 0xfe, 0x0d, 0x00, 0x20, 0x04, 0x10, 0x00,
+ 0x08, 0x50, 0xe9, 0xd7, 0xd4, 0xfb, 0xb5, 0xff, 0x9f, 0x24, 0x09, 0x01,
+ 0x42, 0x4a, 0xa2, 0x64, 0xd5, 0x55, 0x7b, 0x7f, 0xda, 0x7d, 0x4f, 0x00,
+ 0x20, 0x04, 0x00, 0x80, 0x00, 0xa0, 0x2a, 0x13, 0x84, 0x6a, 0x55, 0xff,
+ 0x1d, 0x48, 0x8a, 0x00, 0x94, 0x24, 0x8a, 0xc8, 0xaa, 0x42, 0x20, 0x5d,
+ 0xf5, 0xff, 0x5f, 0x01, 0x00, 0x02, 0x01, 0x00, 0x20, 0xa2, 0x4a, 0x1a,
+ 0x82, 0x56, 0xda, 0xbd, 0x3f, 0x92, 0x92, 0x00, 0x90, 0x92, 0x00, 0x40,
+ 0x95, 0x6a, 0xf4, 0x55, 0x6d, 0xff, 0xd6, 0x00, 0x00, 0x0a, 0x04, 0x20,
+ 0x14, 0x49, 0x4b, 0xaa, 0xaa, 0x56, 0xf5, 0xff, 0xbf, 0xab, 0xa4, 0x00,
+ 0x20, 0x89, 0x40, 0x80, 0xaa, 0xaa, 0xaa, 0xaa, 0xde, 0xbf, 0xeb, 0x03,
+ 0x00, 0x02, 0x04, 0x02, 0x0a, 0x10, 0x2b, 0x2a, 0x55, 0x5b, 0xf5, 0xff,
+ 0xd7, 0x2f, 0x92, 0x00, 0x10, 0x28, 0x21, 0x01, 0x56, 0x95, 0xa0, 0x56,
+ 0xdf, 0xef, 0xea, 0x87, 0x40, 0x0a, 0x42, 0x41, 0x00, 0x90, 0xaa, 0x52,
+ 0xb6, 0xad, 0xfa, 0xff, 0xd5, 0x2f, 0x14, 0x00, 0x00, 0x04, 0x95, 0x04,
+ 0xaa, 0xac, 0x55, 0x6b, 0xff, 0xb7, 0xea, 0x9f, 0x40, 0x02, 0x28, 0x51,
+ 0x00, 0x40, 0x58, 0xd5, 0xda, 0xd6, 0x6e, 0x7f, 0xf9, 0x3f, 0x12, 0x04,
+ 0x02, 0x04, 0x49, 0x25, 0x55, 0xaa, 0x77, 0xab, 0xff, 0x2b, 0xfd, 0x3f,
+ 0x48, 0x01, 0x20, 0x41, 0x00, 0x00, 0x58, 0xa9, 0xda, 0xea, 0xfd, 0xaf,
+ 0xfa, 0xff, 0x02, 0x04, 0x08, 0x14, 0x29, 0x49, 0x52, 0x55, 0x55, 0x55,
+ 0xff, 0x8d, 0xfe, 0x3f, 0xa8, 0x00, 0x02, 0x41, 0x00, 0x02, 0xa0, 0xa2,
+ 0xaa, 0xea, 0xff, 0x53, 0xfd, 0xff, 0x02, 0x04, 0x50, 0x04, 0x25, 0xa8,
+ 0x54, 0x49, 0x52, 0xb5, 0xbf, 0x8a, 0xfe, 0xff, 0xa9, 0x08, 0x04, 0x50,
+ 0x80, 0x02, 0xa1, 0x2a, 0x95, 0xea, 0xff, 0xa1, 0xff, 0xff, 0x03, 0x02,
+ 0x90, 0x02, 0x09, 0x08, 0x44, 0x49, 0x52, 0xbd, 0x7f, 0xca, 0xff, 0xff,
+ 0x2b, 0x09, 0x04, 0x48, 0x40, 0x82, 0x90, 0x56, 0xa9, 0xf6, 0xbf, 0xd0,
+ 0xff, 0xff, 0x47, 0x00, 0x50, 0x02, 0x15, 0x11, 0x40, 0x95, 0xaa, 0xfd,
+ 0x2f, 0xe9, 0xff, 0xff, 0x8f, 0x0a, 0x84, 0x50, 0x40, 0x84, 0x14, 0xaa,
+ 0x6a, 0xff, 0x5f, 0xf2, 0xff, 0xff, 0x7f, 0x00, 0x10, 0x02, 0x09, 0x10,
+ 0x40, 0x7d, 0xf7, 0xff, 0x0b, 0xfc, 0xff, 0xff, 0xaf, 0x02, 0x84, 0x50,
+ 0x42, 0x85, 0x12, 0xd0, 0xdd, 0xff, 0xa7, 0xf2, 0xff, 0xff, 0xff, 0x04,
+ 0x00, 0x0a, 0x08, 0x10, 0x48, 0xf8, 0xff, 0xff, 0x0a, 0xfe, 0xff, 0xff,
+ 0x7f, 0x03, 0xa4, 0x80, 0xa2, 0x8a, 0x02, 0x68, 0xff, 0xff, 0x52, 0xfd,
+ 0xff, 0xff, 0xff, 0x07, 0x00, 0x2a, 0x08, 0x20, 0x28, 0xdc, 0xff, 0x5f,
+ 0x05, 0xff, 0xff, 0xff, 0xff, 0x0d, 0x92, 0x40, 0x22, 0x09, 0x02, 0xea,
+ 0xfb, 0xaf, 0x48, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x12, 0x81, 0xa0,
+ 0x48, 0x9c, 0x6e, 0x93, 0xa2, 0xff, 0xff, 0xff, 0xff, 0x07, 0xa8, 0x40,
+ 0x28, 0x0a, 0x02, 0x74, 0xb5, 0x45, 0x81, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x02, 0x0a, 0x81, 0x20, 0x08, 0xae, 0xaa, 0x90, 0xe8, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x90, 0x40, 0x28, 0x88, 0x12, 0x58, 0x15, 0x50, 0xd0, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x44, 0x0a, 0x41, 0x21, 0x08, 0xae, 0x04, 0x14,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x40, 0x14, 0x88, 0x04, 0xba,
+ 0x02, 0x28, 0xe8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x42, 0x15, 0x41, 0x21,
+ 0x05, 0xad, 0x00, 0x05, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x40,
+ 0x24, 0x8a, 0x0e, 0x36, 0x00, 0x0a, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x42, 0x25, 0x90, 0xd0, 0x8b, 0xc2, 0x41, 0x05, 0xfc, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x10, 0x08, 0x05, 0xe8, 0x8e, 0x58, 0x80, 0x02, 0xfa, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x4a, 0x20, 0xa8, 0xba, 0x0b, 0x2b, 0x51, 0x01,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x8a, 0x02, 0xe8, 0xaf, 0x84,
+ 0x90, 0x04, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x52, 0x21, 0x54, 0xbf,
+ 0x1f, 0x15, 0xa5, 0x02, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x08,
+ 0x01, 0xfa, 0xb6, 0xa4, 0x52, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x4a, 0xa2, 0x54, 0xef, 0x5f, 0x4b, 0xa4, 0x80, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x80, 0x10, 0x82, 0xfe, 0xbf, 0x92, 0x52, 0x42, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x12, 0x42, 0xa8, 0xbf, 0x1f, 0x24, 0x80, 0xa0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x84, 0x28, 0x8a, 0xf7, 0x37, 0x80,
+ 0x52, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x82, 0xe0, 0xff,
+ 0x1f, 0x00, 0x20, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x84, 0x28,
+ 0xca, 0xff, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x10, 0x42, 0xf0, 0xfd, 0x1b, 0x00, 0x50, 0xf0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0xa4, 0x10, 0xc5, 0xff, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x00, 0x22, 0xf8, 0xff, 0x0e, 0x00, 0x00, 0xf0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xaa, 0x88, 0xe2, 0xff, 0x0f, 0x10,
+ 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x25, 0xfa, 0xff,
+ 0x0f, 0x01, 0x11, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xfb,
+ 0xfb, 0xff, 0x7f, 0x5d, 0xd5, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f};
diff --git a/tests/filebox.test b/tests/filebox.test
index 353cc97..7b9fa2c 100644
--- a/tests/filebox.test
+++ b/tests/filebox.test
@@ -7,14 +7,22 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
+test fileDialog-0.1 {GetFileName: file types: MakeFilter() fails} {
+ # MacOS type that is too long
+
+ set res [list [catch {tk_getSaveFile -filetypes {{"foo" .foo {\0\0\0\0\0}}}} msg] $msg]
+ regsub -all "\0" $res {\\0}
+} {1 {bad Macintosh file type "\0\0\0\0\0"}}
+test fileDialog-0.2 {GetFileName: file types: MakeFilter() fails} {
+ # MacOS type that is too short, but looks ok in utf (4 bytes).
+
+ set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {\0\0}}}} msg]
+ regsub -all "\0" $msg {\\0} msg
+ list $x $msg
+} {1 {bad Macintosh file type "\0\0"}}
set tk_strictMotif_old $tk_strictMotif
@@ -102,8 +110,8 @@ if {$tcl_platform(platform) == "unix"} {
set modes 1
}
-set unknownOptionsMsg(tk_getOpenFile) {1 {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, or -title}}
-set unknownOptionsMsg(tk_getSaveFile) {1 {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -parent, or -title}}
+set unknownOptionsMsg(tk_getOpenFile) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable}
+set unknownOptionsMsg(tk_getSaveFile) {bad option "-foo": must be -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -parent, -title, or -typevariable}
set tmpFile "filebox.tmp"
makeFile {
@@ -130,12 +138,11 @@ array set filters {
}
foreach mode $modes {
-
#
# Test both the motif version and the "tk" version of the file dialog
# box on Unix.
#
- # Note that this can use the same test number twice!
+ # Note that this means that test names are unusually complex.
#
set addedExtensions {}
@@ -148,46 +155,42 @@ foreach mode $modes {
}
}
- test filebox-1.1 "tk_getOpenFile command" {
- list [catch {tk_getOpenFile -foo} msg] $msg
- } $unknownOptionsMsg(tk_getOpenFile)
+ test filebox-1.1-$mode "tk_getOpenFile command" -body {
+ tk_getOpenFile -foo
+ } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile)
catch {tk_getOpenFile -foo 1} msg
regsub -all , $msg "" options
regsub \"-foo\" $options "" options
foreach option $options {
- if {[string index $option 0] == "-"} {
- test filebox-1.2 "tk_getOpenFile command" {
- list [catch {tk_getOpenFile $option} msg] $msg
- } [list 1 "value for \"$option\" missing"]
+ if {[string index $option 0] eq "-"} {
+ test filebox-1.2-$mode$option "tk_getOpenFile command" -body {
+ tk_getOpenFile $option
+ } -returnCodes error -result "value for \"$option\" missing"
}
}
-
- test filebox-1.3 "tk_getOpenFile command" {
- list [catch {tk_getOpenFile -foo bar} msg] $msg
- } $unknownOptionsMsg(tk_getOpenFile)
-
- test filebox-1.4 "tk_getOpenFile command" {
- list [catch {tk_getOpenFile -initialdir} msg] $msg
- } {1 {value for "-initialdir" missing}}
-
- test filebox-1.5 "tk_getOpenFile command" {
- list [catch {tk_getOpenFile -parent foo.bar} msg] $msg
- } {1 {bad window path name "foo.bar"}}
-
- test filebox-1.6 "tk_getOpenFile command" {
- list [catch {tk_getOpenFile -filetypes {Foo}} msg] $msg
- } {1 {bad file type "Foo", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"}}
-
- if {[info commands tk::MotifFDialog] == "" && [info commands ::tk::dialog::file::] == ""} {
- set isNative 1
- } else {
- set isNative 0
- }
-
+
+ test filebox-1.3-$mode "tk_getOpenFile command" -body {
+ tk_getOpenFile -foo bar
+ } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile)
+ test filebox-1.4-$mode "tk_getOpenFile command" -body {
+ tk_getOpenFile -initialdir
+ } -returnCodes error -result {value for "-initialdir" missing}
+ test filebox-1.5-$mode "tk_getOpenFile command" -body {
+ tk_getOpenFile -parent foo.bar
+ } -returnCodes error -result {bad window path name "foo.bar"}
+ test filebox-1.6-$mode "tk_getOpenFile command" -body {
+ tk_getOpenFile -filetypes {Foo}
+ } -returnCodes error -result {bad file type "Foo", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"}
+
+ set isNative [expr {
+ [info commands ::tk::MotifFDialog] eq "" &&
+ [info commands ::tk::dialog::file::] eq ""
+ }]
+
set parent .
-
+
set verylongstring longstring:
set verylongstring $verylongstring$verylongstring
set verylongstring $verylongstring$verylongstring
@@ -200,111 +203,125 @@ foreach mode $modes {
# set verylongstring $verylongstring$verylongstring
set color #404040
- test filebox-2.1 "tk_getOpenFile command" {nonUnixUserInteraction} {
+ test filebox-2.1-$mode "tk_getOpenFile command" nonUnixUserInteraction {
ToPressButton $parent cancel
tk_getOpenFile -title "Press Cancel ($verylongstring)" -parent $parent
} ""
-
+
set fileName $tmpFile
- set fileDir [pwd]
+ set fileDir [tcltest::temporaryDirectory]
set pathName [file join $fileDir $fileName]
-
- test filebox-2.2 "tk_getOpenFile command" {nonUnixUserInteraction} {
+
+ test filebox-2.2-$mode "tk_getOpenFile command" nonUnixUserInteraction {
ToPressButton $parent ok
set choice [tk_getOpenFile -title "Press Ok" \
- -parent $parent -initialfile $fileName -initialdir $fileDir]
+ -parent $parent -initialfile $fileName -initialdir $fileDir]
} $pathName
-
- test filebox-2.3 "tk_getOpenFile command" {nonUnixUserInteraction} {
+ test filebox-2.3-$mode "tk_getOpenFile command" nonUnixUserInteraction {
ToEnterFileByKey $parent $fileName $fileDir
set choice [tk_getOpenFile -title "Enter \"$fileName\" and press Ok" \
- -parent $parent -initialdir $fileDir]
+ -parent $parent -initialdir $fileDir]
} $pathName
-
- test filebox-2.4 "tk_getOpenFile command" {nonUnixUserInteraction} {
+ test filebox-2.4-$mode "tk_getOpenFile command" nonUnixUserInteraction {
+ cd $fileDir
ToPressButton $parent ok
set choice [tk_getOpenFile -title "Enter \"$fileName\" and press Ok" \
- -parent $parent -initialdir . \
- -initialfile $fileName]
+ -parent $parent -initialdir . -initialfile $fileName]
} $pathName
-
- test filebox-2.5 "tk_getOpenFile command" {nonUnixUserInteraction} {
+ test filebox-2.5-$mode "tk_getOpenFile command" nonUnixUserInteraction {
ToPressButton $parent ok
set choice [tk_getOpenFile -title "Enter \"$fileName\" and press Ok" \
- -parent $parent -initialdir /badpath \
- -initialfile $fileName]
+ -parent $parent -initialdir /badpath -initialfile $fileName]
} $pathName
-
- test filebox-2.6 "tk_getOpenFile command" {nonUnixUserInteraction} {
+ test filebox-2.6-$mode "tk_getOpenFile command" -setup {
toplevel .t1; toplevel .t2
wm geometry .t1 +0+0
wm geometry .t2 +0+0
- ToPressButton .t1 ok
+ } -constraints nonUnixUserInteraction -body {
set choice {}
+ ToPressButton .t1 ok
lappend choice [tk_getOpenFile \
- -title "Enter \"$fileName\" and press Ok" \
- -parent .t1 -initialdir $fileDir \
- -initialfile $fileName]
+ -title "Enter \"$fileName\" and press Ok" \
+ -parent .t1 -initialdir $fileDir \
+ -initialfile $fileName]
ToPressButton .t2 ok
lappend choice [tk_getOpenFile \
- -title "Enter \"$fileName\" and press Ok" \
- -parent .t2 -initialdir $fileDir \
- -initialfile $fileName]
+ -title "Enter \"$fileName\" and press Ok" \
+ -parent .t2 -initialdir $fileDir \
+ -initialfile $fileName]
ToPressButton .t1 ok
lappend choice [tk_getOpenFile \
- -title "Enter \"$fileName\" and press Ok" \
- -parent .t1 -initialdir $fileDir \
- -initialfile $fileName]
+ -title "Enter \"$fileName\" and press Ok" \
+ -parent .t1 -initialdir $fileDir \
+ -initialfile $fileName]
+ } -result [list $pathName $pathName $pathName] -cleanup {
destroy .t1
destroy .t2
- set choice
- } [list $pathName $pathName $pathName]
+ }
foreach x [lsort -integer [array names filters]] {
- test filebox-3.$x "tk_getOpenFile command" {nonUnixUserInteraction} {
- ToPressButton $parent ok
- set choice [tk_getOpenFile -title "Press Ok" -filetypes $filters($x)\
- -parent $parent -initialfile $fileName -initialdir $fileDir]
+ test filebox-3.$x-$mode "tk_getOpenFile command" nonUnixUserInteraction {
+ ToPressButton $parent ok
+ set choice [tk_getOpenFile -title "Press Ok" \
+ -filetypes $filters($x) -parent $parent \
+ -initialfile $fileName -initialdir $fileDir]
} $pathName
}
+ foreach {x res} [list 1 "-unset-" 2 "Text files"] {
+ set t [expr {$x + [llength [array names filters]]}]
+ test filebox-3.$t-$mode "tk_getOpenFile command" nonUnixUserInteraction {
+ catch {unset tv}
+ catch {unset typeName}
+ ToPressButton $parent ok
+ if {[info exists tv]} {
+ } else {
+ }
+ set choice [tk_getOpenFile -title "Press Ok" \
+ -filetypes $filters($x) -parent $parent \
+ -initialfile $fileName -initialdir $fileDir \
+ -typevariable tv]
+ if {[info exists tv]} {
+ regexp {^(.*) \(.*\)$} $tv dummy typeName
+ } else {
+ set typeName "-unset-"
+ }
+ set typeName
+ } $res
+ }
- test filebox-4.1 "tk_getSaveFile command" {
- list [catch {tk_getSaveFile -foo} msg] $msg
- } $unknownOptionsMsg(tk_getSaveFile)
+ test filebox-4.1-$mode "tk_getSaveFile command" -body {
+ tk_getSaveFile -foo
+ } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile)
catch {tk_getSaveFile -foo 1} msg
regsub -all , $msg "" options
regsub \"-foo\" $options "" options
foreach option $options {
- if {[string index $option 0] == "-"} {
- test filebox-4.2 "tk_getSaveFile command" {
- list [catch {tk_getSaveFile $option} msg] $msg
- } [list 1 "value for \"$option\" missing"]
+ if {[string index $option 0] eq "-"} {
+ test filebox-4.2-$mode$option "tk_getSaveFile command" -body {
+ tk_getSaveFile $option
+ } -returnCodes error -result "value for \"$option\" missing"
}
}
- test filebox-4.3 "tk_getSaveFile command" {
- list [catch {tk_getSaveFile -foo bar} msg] $msg
- } $unknownOptionsMsg(tk_getSaveFile)
-
- test filebox-4.4 "tk_getSaveFile command" {
- list [catch {tk_getSaveFile -initialdir} msg] $msg
- } {1 {value for "-initialdir" missing}}
-
- test filebox-4.5 "tk_getSaveFile command" {
- list [catch {tk_getSaveFile -parent foo.bar} msg] $msg
- } {1 {bad window path name "foo.bar"}}
-
- test filebox-4.6 "tk_getSaveFile command" {
- list [catch {tk_getSaveFile -filetypes {Foo}} msg] $msg
- } {1 {bad file type "Foo", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"}}
-
- if {[info commands tk::MotifFDialog] == "" && [info commands ::tk::dialog::file::] == ""} {
- set isNative 1
- } else {
- set isNative 0
- }
+ test filebox-4.3-$mode "tk_getSaveFile command" -body {
+ tk_getSaveFile -foo bar
+ } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile)
+ test filebox-4.4-$mode "tk_getSaveFile command" -body {
+ tk_getSaveFile -initialdir
+ } -returnCodes error -result {value for "-initialdir" missing}
+ test filebox-4.5-$mode "tk_getSaveFile command" -body {
+ tk_getSaveFile -parent foo.bar
+ } -returnCodes error -result {bad window path name "foo.bar"}
+ test filebox-4.6-$mode "tk_getSaveFile command" -body {
+ tk_getSaveFile -filetypes {Foo}
+ } -returnCodes error -result {bad file type "Foo", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"}
+
+ set isNative [expr {
+ [info commands ::tk::MotifFDialog] eq "" &&
+ [info commands ::tk::dialog::file::] eq ""
+ }]
set parent .
@@ -320,7 +337,7 @@ foreach mode $modes {
# set verylongstring $verylongstring$verylongstring
set color #404040
- test filebox-5.1 "tk_getSaveFile command" {nonUnixUserInteraction} {
+ test filebox-5.1-$mode "tk_getSaveFile command" nonUnixUserInteraction {
ToPressButton $parent cancel
tk_getSaveFile -title "Press Cancel ($verylongstring)" -parent $parent
} ""
@@ -329,65 +346,122 @@ foreach mode $modes {
set fileDir [pwd]
set pathName [file join [pwd] $fileName]
- test filebox-5.2 "tk_getSaveFile command" {nonUnixUserInteraction} {
+ test filebox-5.2-$mode "tk_getSaveFile command" nonUnixUserInteraction {
ToPressButton $parent ok
set choice [tk_getSaveFile -title "Press Ok" \
-parent $parent -initialfile $fileName -initialdir $fileDir]
} $pathName
-
- test filebox-5.3 "tk_getSaveFile command" {nonUnixUserInteraction} {
+ test filebox-5.3-$mode "tk_getSaveFile command" nonUnixUserInteraction {
ToEnterFileByKey $parent $fileName $fileDir
set choice [tk_getSaveFile -title "Enter \"$fileName\" and press Ok" \
-parent $parent -initialdir $fileDir]
} $pathName
-
- test filebox-5.4 "tk_getSaveFile command" {nonUnixUserInteraction} {
+ test filebox-5.4-$mode "tk_getSaveFile command" nonUnixUserInteraction {
ToPressButton $parent ok
set choice [tk_getSaveFile -title "Enter \"$fileName\" and press Ok" \
- -parent $parent -initialdir . \
- -initialfile $fileName]
+ -parent $parent -initialdir . -initialfile $fileName]
} $pathName
-
- test filebox-5.5 "tk_getSaveFile command" {nonUnixUserInteraction} {
+ test filebox-5.5-$mode "tk_getSaveFile command" nonUnixUserInteraction {
ToPressButton $parent ok
set choice [tk_getSaveFile -title "Enter \"$fileName\" and press Ok" \
- -parent $parent -initialdir /badpath \
- -initialfile $fileName]
+ -parent $parent -initialdir /badpath -initialfile $fileName]
} $pathName
- test filebox-5.6 "tk_getSaveFile command" {nonUnixUserInteraction} {
+ test filebox-5.6-$mode "tk_getSaveFile command" -setup {
toplevel .t1; toplevel .t2
wm geometry .t1 +0+0
wm geometry .t2 +0+0
- ToPressButton .t1 ok
+ } -constraints nonUnixUserInteraction -body {
set choice {}
+ ToPressButton .t1 ok
lappend choice [tk_getSaveFile \
-title "Enter \"$fileName\" and press Ok" \
- -parent .t1 -initialdir $fileDir \
- -initialfile $fileName]
+ -parent .t1 -initialdir $fileDir -initialfile $fileName]
ToPressButton .t2 ok
lappend choice [tk_getSaveFile \
-title "Enter \"$fileName\" and press Ok" \
- -parent .t2 -initialdir $fileDir \
- -initialfile $fileName]
+ -parent .t2 -initialdir $fileDir -initialfile $fileName]
ToPressButton .t1 ok
lappend choice [tk_getSaveFile \
-title "Enter \"$fileName\" and press Ok" \
- -parent .t1 -initialdir $fileDir \
- -initialfile $fileName]
+ -parent .t1 -initialdir $fileDir -initialfile $fileName]
+ } -result [list $pathName $pathName $pathName] -cleanup {
destroy .t1
destroy .t2
- set choice
- } [list $pathName $pathName $pathName]
+ }
foreach x [lsort -integer [array names filters]] {
- test filebox-6.$x "tk_getSaveFile command" {nonUnixUserInteraction} {
+ test filebox-6.$x-$mode "tk_getSaveFile command" nonUnixUserInteraction {
ToPressButton $parent ok
- set choice [tk_getSaveFile -title "Press Ok" -filetypes $filters($x)\
- -parent $parent -initialfile $fileName -initialdir $fileDir]
+ set choice [tk_getSaveFile -title "Press Ok" \
+ -filetypes $filters($x) -parent $parent \
+ -initialfile $fileName -initialdir $fileDir]
} $pathName[lindex $addedExtensions $x]
}
+ if {!$mode} {
+
+ test filebox-7.1-$mode "tk_getOpenFile - directory not readable" \
+ -constraints nonUnixUserInteraction \
+ -setup {
+ rename ::tk_messageBox ::saved_messageBox
+ set ::gotmessage {}
+ proc tk_messageBox args {
+ set ::gotmessage $args
+ }
+ toplevel .t1
+ file mkdir [file join $fileDir NOTREADABLE]
+ file attributes [file join $fileDir NOTREADABLE] \
+ -permissions 300
+ } \
+ -cleanup {
+ rename ::tk_messageBox {}
+ rename ::saved_messageBox ::tk_messageBox
+ unset ::gotmessage
+ destroy .t1
+ file delete -force [file join $fileDir NOTREADABLE]
+ } \
+ -body {
+ ToEnterFileByKey .t1 NOTREADABLE $fileDir
+ ToPressButton .t1 ok
+ ToPressButton .t1 cancel
+ tk_getOpenFile -parent .t1 \
+ -title "Please select the NOTREADABLE directory" \
+ -initialdir $fileDir
+ set gotmessage
+ } \
+ -match glob \
+ -result "*NOTREADABLE*"
+
+ test filebox-7.2-$mode "tk_getOpenFile - bad file name" \
+ -constraints nonUnixUserInteraction \
+ -setup {
+ rename ::tk_messageBox ::saved_messageBox
+ set ::gotmessage {}
+ proc tk_messageBox args {
+ set ::gotmessage $args
+ }
+ toplevel .t1
+ } \
+ -cleanup {
+ rename ::tk_messageBox {}
+ rename ::saved_messageBox ::tk_messageBox
+ unset ::gotmessage
+ destroy .t1
+ } \
+ -body {
+ ToEnterFileByKey .t1 RUBBISH $fileDir
+ ToPressButton .t1 ok
+ ToPressButton .t1 cancel
+ tk_getOpenFile -parent .t1 \
+ -title "Please enter RUBBISH as a file name" \
+ -initialdir $fileDir
+ set gotmessage
+ } \
+ -match glob \
+ -result "*RUBBISH*"
+ }
+
# The rest of the tests need to be executed on Unix only.
# The test whether the dialog box widgets were implemented correctly.
# These tests are not
@@ -397,5 +471,6 @@ foreach mode $modes {
set tk_strictMotif $tk_strictMotif_old
# cleanup
-::tcltest::cleanupTests
+removeFile filebox.tmp
+cleanupTests
return
diff --git a/tests/flagdown.xbm b/tests/flagdown.xbm
new file mode 100644
index 0000000..55abc51
--- /dev/null
+++ b/tests/flagdown.xbm
@@ -0,0 +1,27 @@
+#define flagdown_width 48
+#define flagdown_height 48
+static char flagdown_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe1, 0x00, 0x00,
+ 0x00, 0x00, 0x70, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00,
+ 0x00, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04,
+ 0x00, 0x00, 0x03, 0x00, 0x06, 0x06, 0x00, 0x80, 0x01, 0x00, 0x06, 0x07,
+ 0x00, 0xc0, 0x1f, 0x00, 0x87, 0x07, 0x00, 0xe0, 0x7f, 0x80, 0xc7, 0x07,
+ 0x00, 0x70, 0xe0, 0xc0, 0xe5, 0x07, 0x00, 0x38, 0x80, 0xe1, 0x74, 0x07,
+ 0x00, 0x18, 0x80, 0x71, 0x3c, 0x07, 0x00, 0x0c, 0x00, 0x3b, 0x1e, 0x03,
+ 0x00, 0x0c, 0x00, 0x1f, 0x0f, 0x00, 0x00, 0x86, 0x1f, 0x8e, 0x07, 0x00,
+ 0x00, 0x06, 0x06, 0xc6, 0x05, 0x00, 0x00, 0x06, 0x00, 0xc6, 0x05, 0x00,
+ 0x00, 0x06, 0x00, 0xc6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00,
+ 0x7f, 0x06, 0x00, 0x06, 0xe4, 0xff, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00,
+ 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x06, 0x00,
+ 0x00, 0x06, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00,
+ 0x00, 0x06, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x06, 0x00, 0x66, 0x00, 0x00,
+ 0x00, 0x06, 0x00, 0x36, 0x00, 0x00, 0x00, 0x06, 0x00, 0x3e, 0x00, 0x00,
+ 0x00, 0xfe, 0xff, 0x2f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x27, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0xf7, 0xbf, 0x8e, 0xfc, 0xdf, 0xf8, 0x9d, 0xeb, 0x9b, 0x76, 0xd2, 0x7a,
+ 0x46, 0x30, 0xe2, 0x0f, 0xe1, 0x47, 0x55, 0x84, 0x48, 0x11, 0x84, 0x19};
diff --git a/tests/flagup.xbm b/tests/flagup.xbm
new file mode 100644
index 0000000..6eb0d84
--- /dev/null
+++ b/tests/flagup.xbm
@@ -0,0 +1,27 @@
+#define flagup_width 48
+#define flagup_height 48
+static char flagup_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xef, 0x6a, 0x00,
+ 0x00, 0x00, 0xc0, 0x7b, 0x75, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x6a, 0x00,
+ 0x00, 0x00, 0x30, 0x60, 0x75, 0x00, 0x00, 0x00, 0x18, 0xe0, 0x7f, 0x00,
+ 0x00, 0x00, 0x0c, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x04, 0x00,
+ 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x06, 0x00,
+ 0x00, 0xc0, 0x1f, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0xe0, 0x07, 0x00,
+ 0x00, 0x70, 0xe0, 0xe0, 0x05, 0x00, 0x00, 0x38, 0x80, 0xe1, 0x04, 0x00,
+ 0x00, 0x18, 0x80, 0xf1, 0x04, 0x00, 0x00, 0x0c, 0x00, 0xfb, 0x04, 0x00,
+ 0x00, 0x0c, 0x00, 0xff, 0x04, 0x00, 0x00, 0x86, 0x1f, 0xee, 0x04, 0x00,
+ 0x00, 0x06, 0x06, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00,
+ 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x66, 0x04, 0x00,
+ 0x7f, 0x56, 0x52, 0x06, 0xe4, 0xff, 0x00, 0x76, 0x55, 0x06, 0x04, 0x00,
+ 0x00, 0x56, 0x57, 0x06, 0x04, 0x00, 0x00, 0x56, 0x55, 0x06, 0x06, 0x00,
+ 0x00, 0x56, 0xd5, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00,
+ 0x54, 0x06, 0x00, 0xc6, 0x54, 0x55, 0xaa, 0x06, 0x00, 0x66, 0xaa, 0x2a,
+ 0x54, 0x06, 0x00, 0x36, 0x55, 0x55, 0xaa, 0x06, 0x00, 0xbe, 0xaa, 0x2a,
+ 0x54, 0xfe, 0xff, 0x6f, 0x55, 0x55, 0xaa, 0xfc, 0xff, 0xa7, 0xaa, 0x2a,
+ 0x54, 0x01, 0x88, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
+ 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
+ 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
+ 0x54, 0x55, 0x8d, 0x50, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa8, 0xaa, 0x2a,
+ 0x54, 0x55, 0x95, 0x54, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a,
+ 0x54, 0x55, 0x55, 0x55, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/tests/focus.test b/tests/focus.test
index 474f49a..5cc3abe 100644
--- a/tests/focus.test
+++ b/tests/focus.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
button .b -text .b -relief raised -bd 2
@@ -71,35 +68,35 @@ bind all <KeyPress> {
append focusInfo "press %W %K"
}
-test focus-1.1 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.1 {Tk_FocusCmd procedure} unix {
focusClear
focus
} {}
-test focus-1.2 {Tk_FocusCmd procedure} {unixOnly altDisplay} {
+test focus-1.2 {Tk_FocusCmd procedure} {unix altDisplay} {
focus .alt.b
focus
} {}
-test focus-1.3 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.3 {Tk_FocusCmd procedure} unix {
focusClear
focus .t.b3
focus
} {}
-test focus-1.4 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.4 {Tk_FocusCmd procedure} unix {
list [catch {focus ""} msg] $msg
} {0 {}}
-test focus-1.5 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.5 {Tk_FocusCmd procedure} unix {
focusClear
focus -force .t
focus .t.b3
focus
} {.t.b3}
-test focus-1.6 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.6 {Tk_FocusCmd procedure} unix {
list [catch {focus .gorp} msg] $msg
} {1 {bad window path name ".gorp"}}
-test focus-1.7 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.7 {Tk_FocusCmd procedure} unix {
list [catch {focus .gorp a} msg] $msg
} {1 {bad option ".gorp": must be -displayof, -force, or -lastfor}}
-test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} {unixOnly} {
+test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} unix {
toplevel .t2
wm geom .t2 +10+10
frame .t2.f -width 200 -height 100 -bd 2 -relief raised
@@ -118,73 +115,73 @@ test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} {unixOnly} {
destroy .t2
set x
} {.t2.f2 .t2 .t2}
-test focus-1.9 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.9 {Tk_FocusCmd procedure, -displayof option} unix {
list [catch {focus -displayof} msg] $msg
} {1 {wrong # args: should be "focus -displayof window"}}
-test focus-1.10 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.10 {Tk_FocusCmd procedure, -displayof option} unix {
list [catch {focus -displayof a b} msg] $msg
} {1 {wrong # args: should be "focus -displayof window"}}
-test focus-1.11 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.11 {Tk_FocusCmd procedure, -displayof option} unix {
list [catch {focus -displayof .lousy} msg] $msg
} {1 {bad window path name ".lousy"}}
-test focus-1.12 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.12 {Tk_FocusCmd procedure, -displayof option} unix {
focusClear
focus .t
focus -displayof .t.b3
} {}
-test focus-1.13 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.13 {Tk_FocusCmd procedure, -displayof option} unix {
focusClear
focus -force .t
focus -displayof .t.b3
} {.t}
-test focus-1.14 {Tk_FocusCmd procedure, -displayof option} {unixOnly altDisplay} {
+test focus-1.14 {Tk_FocusCmd procedure, -displayof option} {unix altDisplay} {
focus -force .alt.c
focus -displayof .alt
} {.alt.c}
-test focus-1.15 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.15 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force} msg] $msg
} {1 {wrong # args: should be "focus -force window"}}
-test focus-1.16 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.16 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force a b} msg] $msg
} {1 {wrong # args: should be "focus -force window"}}
-test focus-1.17 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.17 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force foo} msg] $msg
} {1 {bad window path name "foo"}}
-test focus-1.18 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.18 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force ""} msg] $msg
} {0 {}}
-test focus-1.19 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.19 {Tk_FocusCmd procedure, -force option} unix {
focusClear
focus .t.b1
set x [list [focus]]
focus -force .t.b1
lappend x [focus]
} {{} .t.b1}
-test focus-1.20 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.20 {Tk_FocusCmd procedure, -lastfor option} unix {
list [catch {focus -lastfor} msg] $msg
} {1 {wrong # args: should be "focus -lastfor window"}}
-test focus-1.21 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.21 {Tk_FocusCmd procedure, -lastfor option} unix {
list [catch {focus -lastfor 1 2} msg] $msg
} {1 {wrong # args: should be "focus -lastfor window"}}
-test focus-1.22 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.22 {Tk_FocusCmd procedure, -lastfor option} unix {
list [catch {focus -lastfor who_knows?} msg] $msg
} {1 {bad window path name "who_knows?"}}
-test focus-1.23 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.23 {Tk_FocusCmd procedure, -lastfor option} unix {
focus .b
focus .t.b1
list [focus -lastfor .] [focus -lastfor .t.b3]
} {.b .t.b1}
-test focus-1.24 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.24 {Tk_FocusCmd procedure, -lastfor option} unix {
destroy .t
focusSetup
update
focus -lastfor .t.b2
} {.t}
-test focus-1.25 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.25 {Tk_FocusCmd procedure} unix {
list [catch {focus -unknown} msg] $msg
} {1 {bad option "-unknown": must be -displayof, -force, or -lastfor}}
-test focus-2.1 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper} {
+test focus-2.1 {TkFocusFilterEvent procedure} {unix nonPortable testwrapper} {
focus -force .b
destroy .t
focusSetup
@@ -194,7 +191,7 @@ test focus-2.1 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper}
-sendevent 0x54217567
list $focusInfo
} {{}}
-test focus-2.2 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper} {
+test focus-2.2 {TkFocusFilterEvent procedure} {unix nonPortable testwrapper} {
focus -force .b
destroy .t
focusSetup
@@ -204,7 +201,7 @@ test focus-2.2 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper}
list $focusInfo [focus]
} {{in .t NotifyAncestor
} .b}
-test focus-2.3 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper} {
+test focus-2.3 {TkFocusFilterEvent procedure} {unix nonPortable testwrapper} {
focus -force .b
destroy .t
focusSetup
@@ -218,7 +215,7 @@ out . NotifyNonlinearVirtual
in .t NotifyNonlinear
} .t}
test focus-2.4 {TkFocusFilterEvent procedure, FocusIn events} \
- {unixOnly nonPortable testwrapper} {
+ {unix nonPortable testwrapper} {
set result {}
focus .t.b1
# Important to end with NotifyAncestor, which is an
@@ -249,7 +246,7 @@ in .t NotifyNonlinearVirtual
in .t.b1 NotifyNonlinear
}}
test focus-2.5 {TkFocusFilterEvent procedure, creating FocusInfo struct} \
- {unixOnly nonPortable testwrapper} {
+ {unix nonPortable testwrapper} {
focusSetup
focus .t.b1
update
@@ -260,7 +257,7 @@ in .t NotifyNonlinearVirtual
in .t.b1 NotifyNonlinear
} .t.b1}
test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus .t.b1
focus .
update
@@ -271,7 +268,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} \
list $x $focusInfo
} {.t.b1 {press .t.b1 x}}
test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear
NotifyNonlinearVirtual NotifyPointer NotifyPointerRoot
@@ -284,19 +281,19 @@ test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} \
set result
} {{} .t.b1 {} {} .t.b1 .t.b1 {}}
test focus-2.8 {TkFocusFilterEvent procedure, FocusOut events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus -force .t.b1
event gen .t.b1 <FocusOut> -detail NotifyAncestor
focus
} {.t.b1}
test focus-2.9 {TkFocusFilterEvent procedure, FocusOut events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus .t.b1
event gen [testwrapper .] <FocusOut> -detail NotifyAncestor
focus
} {}
test focus-2.10 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
focusClear
@@ -311,7 +308,7 @@ test focus-2.10 {TkFocusFilterEvent procedure, Enter events} \
set result
} {.t.b1 {} .t.b1 .t.b1 .t.b1}
test focus-2.11 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focusClear
set focusInfo {}
event gen [testwrapper .t] <Enter> -detail NotifyAncestor
@@ -319,7 +316,7 @@ test focus-2.11 {TkFocusFilterEvent procedure, Enter events} \
set focusInfo
} {}
test focus-2.12 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus -force .b
update
set focusInfo {}
@@ -328,7 +325,7 @@ test focus-2.12 {TkFocusFilterEvent procedure, Enter events} \
set focusInfo
} {}
test focus-2.13 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus .t.b1
focusClear
event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1
@@ -338,7 +335,7 @@ test focus-2.13 {TkFocusFilterEvent procedure, Enter events} \
} {in .t NotifyVirtual
in .t.b1 NotifyAncestor
}
-test focus-2.14 {TkFocusFilterEvent procedure, Enter events, ignore errors when setting focus due to implicit focus} {unixOnly testwrapper} {
+test focus-2.14 {TkFocusFilterEvent procedure, Enter events, ignore errors when setting focus due to implicit focus} {unix testwrapper} {
focusClear
catch {destroy .t2}
toplevel .t2
@@ -350,7 +347,7 @@ test focus-2.14 {TkFocusFilterEvent procedure, Enter events, ignore errors when
destroy .t2
} {}
test focus-2.15 {TkFocusFilterEvent procedure, Leave events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear
@@ -365,7 +362,7 @@ test focus-2.15 {TkFocusFilterEvent procedure, Leave events} \
set result
} {{} .t.b1 {} {} {}}
test focus-2.16 {TkFocusFilterEvent procedure, Leave events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1
@@ -378,7 +375,7 @@ test focus-2.16 {TkFocusFilterEvent procedure, Leave events} \
out .t NotifyVirtual
}
test focus-2.17 {TkFocusFilterEvent procedure, Leave events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1
@@ -393,7 +390,7 @@ out .t NotifyVirtual
} {}}
test focus-3.1 {SetFocus procedure, create record on focus} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
toplevel .t2 -width 250 -height 100
wm geometry .t2 +0+0
update
@@ -405,8 +402,7 @@ catch {destroy .t2}
# This test produces no result, but it will generate a protocol
# error if Tk forgets to make the window exist before focussing
# on it.
-test focus-3.2 {SetFocus procedure, making window exist} \
- {unixOnly testwrapper} {
+test focus-3.2 {SetFocus procedure, making window exist} {unix testwrapper} {
update
button .b2 -text "Another button"
focus .b2
@@ -417,13 +413,13 @@ update
# The following test doesn't produce a check-able result, but if
# there are bugs it may generate an X protocol error.
test focus-3.3 {SetFocus procedure, delaying claim of X focus} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focusSetup
focus -force .t.b2
update
} {}
test focus-3.4 {SetFocus procedure, delaying claim of X focus} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focusSetup
wm withdraw .t
focus -force .t.b2
@@ -436,8 +432,7 @@ test focus-3.4 {SetFocus procedure, delaying claim of X focus} \
wm deiconify .t
} {}
catch {destroy .t2}
-test focus-3.5 {SetFocus procedure, generating events} \
- {unixOnly testwrapper} {
+test focus-3.5 {SetFocus procedure, generating events} {unix testwrapper} {
focusSetup
focusClear
set focusInfo {}
@@ -447,8 +442,7 @@ test focus-3.5 {SetFocus procedure, generating events} \
} {in .t NotifyVirtual
in .t.b2 NotifyAncestor
}
-test focus-3.6 {SetFocus procedure, generating events} \
- {unixOnly testwrapper} {
+test focus-3.6 {SetFocus procedure, generating events} {unix testwrapper} {
focusSetup
focus -force .b
update
@@ -462,7 +456,7 @@ in .t NotifyNonlinearVirtual
in .t.b2 NotifyNonlinear
}
test focus-3.7 {SetFocus procedure, generating events} \
- {unixOnly nonPortable testwrapper} {
+ {unix nonPortable testwrapper} {
# Non-portable because some platforms generate extra events.
focusSetup
@@ -473,7 +467,7 @@ test focus-3.7 {SetFocus procedure, generating events} \
set focusInfo
} {}
-test focus-4.1 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
+test focus-4.1 {TkFocusDeadWindow procedure} {unix testwrapper} {
focusSetup
update
focus -force .b
@@ -481,7 +475,7 @@ test focus-4.1 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
destroy .t
focus
} {.b}
-test focus-4.2 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
+test focus-4.2 {TkFocusDeadWindow procedure} {unix testwrapper} {
focusSetup
update
focus -force .t.b2
@@ -495,7 +489,7 @@ test focus-4.2 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
# Non-portable due to wm-specific redirection of input focus when
# windows are deleted:
-test focus-4.3 {TkFocusDeadWindow procedure} {unixOnly nonPortable testwrapper} {
+test focus-4.3 {TkFocusDeadWindow procedure} {unix nonPortable testwrapper} {
focusSetup
update
focus .t
@@ -504,7 +498,7 @@ test focus-4.3 {TkFocusDeadWindow procedure} {unixOnly nonPortable testwrapper}
update
focus
} {}
-test focus-4.4 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
+test focus-4.4 {TkFocusDeadWindow procedure} {unix testwrapper} {
focusSetup
focus -force .t.b2
update
@@ -517,7 +511,7 @@ test focus-4.4 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
setupbg
test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} \
- {unixOnly testwrapper secureserver} {
+ {unix testwrapper secureserver} {
focusSetup
focus -force .t
update
@@ -537,7 +531,7 @@ cleanupbg
fixfocus
test focus-6.1 {miscellaneous - embedded application in same process} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
eval interp delete [interp slaves]
catch {destroy .t}
toplevel .t
@@ -587,7 +581,7 @@ test focus-6.1 {miscellaneous - embedded application in same process} \
set result
} {{.t.f2.e1 {} {focus out .t.f2.e1 NotifyNonlinear} {focus out .t.f2 NotifyNonlinearVirtual} {focus in .t.f1 NotifyNonlinear} | {focus out .t.f1 NotifyNonlinear} {focus in .t.f2 NotifyNonlinearVirtual} {focus in .t.f2.e1 NotifyNonlinear}} {{focus in . NotifyVirtual} {focus in .e1 NotifyAncestor} | {focus out .e1 NotifyAncestor} {focus out . NotifyVirtual}}}
test focus-6.2 {miscellaneous - embedded application in different process} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
eval interp delete [interp slaves]
catch {destroy .t}
setupbg
@@ -641,18 +635,5 @@ bind all <FocusIn> {}
bind all <FocusOut> {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/focusTcl.test b/tests/focusTcl.test
index efeab92..1f5eed5 100644
--- a/tests/focusTcl.test
+++ b/tests/focusTcl.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
proc setup1 w {
@@ -277,18 +274,5 @@ bind Frame <Key> {}
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/font.test b/tests/font.test
index 643cc79..34e4b83 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
catch {destroy .b}
@@ -49,11 +46,14 @@ proc csetup {{str ""}} {
setup
-case $tcl_platform(platform) {
- unix {set fixed "fixed"}
- windows {set fixed "courier 12"}
- macintosh {set fixed "monaco 9"}
+case [tk windowingsystem] {
+ x11 {set fixed "fixed"}
+ win32 {set fixed "courier 12"}
+ classic -
+ aqua {set fixed "monaco 9"}
}
+
+
set times [font actual {times 0} -family]
test font-1.1 {TkFontPkgInit} {
@@ -113,11 +113,11 @@ test font-4.1 {font command: actual: arguments} {
test font-4.2 {font command: actual: arguments} {
# (objc < 3)
list [catch {font actual} msg] $msg
-} {1 {wrong # args: should be "font actual font ?-displayof window? ?option?"}}
+} {1 {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}}
test font-4.3 {font command: actual: arguments} {
# (objc - skip > 4) when skip == 0
list [catch {font actual xyz abc def} msg] $msg
-} {1 {wrong # args: should be "font actual font ?-displayof window? ?option?"}}
+} {1 {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}}
test font-4.4 {font command: actual: displayof specified, so skip to next} {
catch {font actual xyz -displayof . -size}
} {0}
@@ -127,7 +127,7 @@ test font-4.5 {font command: actual: displayof specified, so skip to next} {
test font-4.6 {font command: actual: arguments} {
# (objc - skip > 4) when skip == 2
list [catch {font actual xyz -displayof . abc def} msg] $msg
-} {1 {wrong # args: should be "font actual font ?-displayof window? ?option?"}}
+} {1 {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}}
test font-4.7 {font command: actual: arguments} {noExceed} {
# (tkfont == NULL)
list [catch {font actual "\{xyz"} msg] $msg
@@ -136,11 +136,11 @@ test font-4.8 {font command: actual: all attributes} {
# not (objc > 3) so objPtr = NULL
lindex [font actual {-family times}] 0
} {-family}
-test font-4.9 {font command: actual} {macOrUnix noExceed} {
+test font-4.9 {font command: actual} {unix noExceed} {
# (objc > 3) so objPtr = objv[3 + skip]
string tolower [font actual {-family times} -family]
} {times}
-test font-4.10 {font command: actual} {pcOnly} {
+test font-4.10 {font command: actual} win {
# (objc > 3) so objPtr = objv[3 + skip]
font actual {-family times} -family
} {Times New Roman}
@@ -307,8 +307,8 @@ test font-8.4 {font command: families} {
test font-9.1 {font command: measure: arguments} {
# (skip < 0)
- list [catch {font measure xyz -displayof} msg] $msg
-} {1 {value for "-displayof" missing}}
+ list [catch {expr {[font measure xyz -displayof]>0}} msg] $msg
+} {0 1}
test font-9.2 {font command: measure: arguments} {
# (objc - skip != 4)
list [catch {font measure} msg] $msg
@@ -325,6 +325,15 @@ test font-9.5 {font command: measure} {
# Tk_TextWidth()
expr [font measure $fixed "abcdefg"]==[font measure $fixed "a"]*7
} {1}
+test font-9.6 {font command: measure -d} {
+ list [catch {expr {[font measure $fixed -d] > 0}} msg] $msg
+} {0 1}
+test font-9.7 {font command: measure -d with -displayof} {
+ list [catch {expr {[font measure $fixed -displayof . -d] > 0}} msg] $msg
+} {0 1}
+test font-9.8 {font command: measure: arguments} {
+ list [catch {font measure $fixed -displayof .} msg] $msg
+} {1 {wrong # args: should be "font measure font ?-displayof window? text"}}
test font-10.1 {font command: metrics: arguments} {
list [catch {font metrics xyz -displayof} msg] $msg
@@ -498,21 +507,16 @@ test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} {
setup
.b.f config -font {times 20}
} {}
-test font-15.7 {Tk_AllocFontFromObj procedure: get native font} {unixOnly} {
+test font-15.7 {Tk_AllocFontFromObj procedure: get native font} unix {
# not (fontPtr == NULL)
setup
.b.f config -font fixed
} {}
-test font-15.8 {Tk_AllocFontFromObj procedure: get native font} {pcOnly} {
+test font-15.8 {Tk_AllocFontFromObj procedure: get native font} win {
# not (fontPtr == NULL)
setup
.b.f config -font oemfixed
} {}
-test font-15.9 {Tk_AllocFontFromObj procedure: get native font} {macOnly} {
- # not (fontPtr == NULL)
- setup
- .b.f config -font application
-} {}
test font-15.10 {Tk_AllocFontFromObj procedure: get attribute font} {
# (fontPtr == NULL)
list [catch {.b.f config -font {xxx yyy zzz}} msg] $msg
@@ -649,7 +653,7 @@ proc psfontname {name} {
set start [string first "gsave" $post]
return [string range $post [expr $start+7] end]
}
-test font-21.1 {Tk_PostscriptFontName procedure: native} {unixOnly} {
+test font-21.1 {Tk_PostscriptFontName procedure: native} unix {
set x [font actual {{itc avant garde} 10} -family]
if {[string match *avant*garde $x]} {
psfontname "{itc avant garde} 10"
@@ -657,25 +661,16 @@ test font-21.1 {Tk_PostscriptFontName procedure: native} {unixOnly} {
set x {AvantGarde-Book}
}
} {AvantGarde-Book}
-test font-21.2 {Tk_PostscriptFontName procedure: native} {pcOnly} {
+test font-21.2 {Tk_PostscriptFontName procedure: native} win {
psfontname "arial 10"
} {Helvetica}
-test font-21.3 {Tk_PostscriptFontName procedure: native} {pcOnly} {
+test font-21.3 {Tk_PostscriptFontName procedure: native} win {
psfontname "{times new roman} 10"
} {Times-Roman}
-test font-21.4 {Tk_PostscriptFontName procedure: native} {pcOnly} {
+test font-21.4 {Tk_PostscriptFontName procedure: native} win {
psfontname "{courier new} 10"
} {Courier}
-test font-21.5 {Tk_PostscriptFontName procedure: native} {macOnly} {
- psfontname "geneva 10"
-} {Helvetica}
-test font-21.6 {Tk_PostscriptFontName procedure: native} {macOnly} {
- psfontname "{new york} 10"
-} {Times-Roman}
-test font-21.7 {Tk_PostscriptFontName procedure: native} {macOnly} {
- psfontname "monaco 10"
-} {Courier}
-test font-21.8 {Tk_PostscriptFontName procedure: spaces} {unixOnly} {
+test font-21.8 {Tk_PostscriptFontName procedure: spaces} unix {
set x [font actual {{lucida bright} 10} -family]
if {[string match lucida*bright $x]} {
psfontname "{lucida bright} 10"
@@ -683,80 +678,75 @@ test font-21.8 {Tk_PostscriptFontName procedure: spaces} {unixOnly} {
set x {LucidaBright}
}
} {LucidaBright}
-test font-21.9 {Tk_PostscriptFontName procedure: spaces} {unixOnly} {
+test font-21.9 {Tk_PostscriptFontName procedure: spaces} unix {
psfontname "{new century schoolbook} 10"
} {NewCenturySchlbk-Roman}
set i 10
foreach p {
- {"avantgarde" AvantGarde-Book AvantGarde-Demi AvantGarde-BookOblique AvantGarde-DemiOblique}
- {"bookman" Bookman-Light Bookman-Demi Bookman-LightItalic Bookman-DemiItalic}
- {"courier" Courier Courier-Bold Courier-Oblique Courier-BoldOblique}
- {"helvetica" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
- {"new century schoolbook" NewCenturySchlbk-Roman NewCenturySchlbk-Bold NewCenturySchlbk-Italic NewCenturySchlbk-BoldItalic}
- {"palatino" Palatino-Roman Palatino-Bold Palatino-Italic Palatino-BoldItalic}
- {"symbol" Symbol Symbol Symbol Symbol}
- {"times" Times-Roman Times-Bold Times-Italic Times-BoldItalic}
- {"zapfchancery" ZapfChancery-MediumItalic ZapfChancery-MediumItalic ZapfChancery-MediumItalic ZapfChancery-MediumItalic}
- {"zapfdingbats" ZapfDingbats ZapfDingbats ZapfDingbats ZapfDingbats}
+ {font-21.10 "avantgarde"
+ AvantGarde-Book AvantGarde-Demi
+ AvantGarde-BookOblique AvantGarde-DemiOblique}
+ {font-21.11 "bookman"
+ Bookman-Light Bookman-Demi Bookman-LightItalic Bookman-DemiItalic}
+ {font-21.12 "courier"
+ Courier Courier-Bold Courier-Oblique Courier-BoldOblique}
+ {font-21.13 "helvetica"
+ Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
+ {font-21.14 "new century schoolbook"
+ NewCenturySchlbk-Roman NewCenturySchlbk-Bold
+ NewCenturySchlbk-Italic NewCenturySchlbk-BoldItalic}
+ {font-21.15 "palatino"
+ Palatino-Roman Palatino-Bold Palatino-Italic Palatino-BoldItalic}
+ {font-21.16 "symbol"
+ Symbol Symbol Symbol Symbol}
+ {font-21.17 "times"
+ Times-Roman Times-Bold Times-Italic Times-BoldItalic}
+ {font-21.18 "zapfchancery"
+ ZapfChancery-MediumItalic ZapfChancery-MediumItalic
+ ZapfChancery-MediumItalic ZapfChancery-MediumItalic}
+ {font-21.19 "zapfdingbats"
+ ZapfDingbats ZapfDingbats ZapfDingbats ZapfDingbats}
} {
- test font-21.$i {Tk_PostscriptFontName procedure: exhaustive} {unixOnly} {
- set family [lindex $p 0]
+ set values [lassign $p testName family]
+ test $testName {Tk_PostscriptFontName procedure: exhaustive} unix {
set x {}
- set i 1
+ set j 0
foreach slant {roman italic} {
foreach weight {normal bold} {
set name [list $family 12 $slant $weight]
if {[font actual $name -family] == $family} {
lappend x [psfontname $name]
} else {
- lappend x [lindex $p $i]
+ lappend x [lindex $values $j]
}
- incr i
+ incr j
}
}
- incr i
set x
- } [lrange $p 1 end]
+ } $values
}
foreach p {
- {"arial" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
- {"courier new" Courier Courier-Bold Courier-Oblique Courier-BoldOblique}
- {"helvetica" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
- {"symbol" Symbol Symbol-Bold Symbol-Italic Symbol-BoldItalic}
- {"times new roman" Times-Roman Times-Bold Times-Italic Times-BoldItalic}
+ {font-21.20 "arial"
+ Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
+ {font-21.21 "courier new"
+ Courier Courier-Bold Courier-Oblique Courier-BoldOblique}
+ {font-21.22 "helvetica"
+ Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
+ {font-21.23 "symbol"
+ Symbol Symbol-Bold Symbol-Italic Symbol-BoldItalic}
+ {font-21.24 "times new roman"
+ Times-Roman Times-Bold Times-Italic Times-BoldItalic}
} {
- test font-21.$i {Tk_PostscriptFontName procedure: exhaustive} {pcOnly} {
- set family [lindex $p 0]
+ set values [lassign $p testName family]
+ test $testName {Tk_PostscriptFontName procedure: exhaustive} win {
set x {}
foreach slant {roman italic} {
foreach weight {normal bold} {
lappend x [psfontname [list $family 12 "$slant $weight"]]
}
}
- incr i
- set x
- } [lrange $p 1 end]
-}
-foreach p {
- {"courier" Courier Courier-Bold Courier-Oblique Courier-BoldOblique}
- {"geneva" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
- {"helvetica" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique}
- {"monaco" Courier Courier-Bold Courier-Oblique Courier-BoldOblique}
- {"new york" Times-Roman Times-Bold Times-Italic Times-BoldItalic}
- {"symbol" Symbol Symbol-Bold Symbol-Italic Symbol-BoldItalic}
- {"times" Times-Roman Times-Bold Times-Italic Times-BoldItalic}
-} {
- test font-21.$i {Tk_PostscriptFontName procedure: exhaustive} {macOnly} {
- set family [lindex $p 0]
- set x {}
- foreach slant {roman italic} {
- foreach weight {normal bold} {
- lappend x [psfontname [list $family 12 $slant $weight]]
- }
- }
- incr i
set x
- } [lrange $p 1 end]
+ } $values
}
test font-22.1 {Tk_TextWidth procedure} {
@@ -1152,48 +1142,47 @@ test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} {
test font-33.1 {Tk_TextWidth procedure} {
} {}
-test font-33.2 {ConfigAttributesObj procedure: arguments} {
+test font-34.1 {ConfigAttributesObj procedure: arguments} {
# (Tcl_GetIndexFromObj() != TCL_OK)
setup
list [catch {font create xyz -xyz} msg] $msg
} {1 {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike}}
-test font-34.1 {ConfigAttributesObj procedure: arguments} {
+test font-34.2 {ConfigAttributesObj procedure: arguments} {
# (objc & 1)
setup
list [catch {font create xyz -family} msg] $msg
} {1 {value for "-family" option missing}}
-set i 3
foreach p {
- {family xyz times}
- {size 20 40}
- {weight normal bold}
- {slant roman italic}
- {underline 0 1}
- {overstrike 0 1}
+ {font-34.3 family xyz times}
+ {font-34.4 size 20 40}
+ {font-34.5 weight normal bold}
+ {font-34.6 slant roman italic}
+ {font-34.7 underline 0 1}
+ {font-34.8 overstrike 0 1}
} {
- set opt [lindex $p 0]
- test font-34.$i "ConfigAttributesObj procedure: $opt" {
+ lassign $p testName opt val1 val2
+ test $testName "ConfigAttributesObj procedure: $opt" {
setup
set x {}
- font create xyz -$opt [lindex $p 1]
+ font create xyz -$opt $val1
lappend x [font config xyz -$opt]
- font config xyz -$opt [lindex $p 2]
+ font config xyz -$opt $val2
lappend x [font config xyz -$opt]
- } [lrange $p 1 2]
- incr i
+ } [list $val1 $val2]
}
foreach p {
- {size xyz {1 {expected integer but got "xyz"}}}
- {weight xyz {1 {bad -weight value "xyz": must be normal, or bold}}}
- {slant xyz {1 {bad -slant value "xyz": must be roman, or italic}}}
- {underline xyz {1 {expected boolean value but got "xyz"}}}
- {overstrike xyz {1 {expected boolean value but got "xyz"}}}
+ {font-34.9 size xyz {expected integer but got "xyz"}}
+ {font-34.10 weight xyz {bad -weight value "xyz": must be normal, or bold}}
+ {font-34.11 slant xyz {bad -slant value "xyz": must be roman, or italic}}
+ {font-34.12 underline xyz {expected boolean value but got "xyz"}}
+ {font-34.13 overstrike xyz {expected boolean value but got "xyz"}}
} {
- test font-34.$i "ConfigAttributesObj procedure: [lindex $p 0]" {
+ lassign $p testName opt val result
+ test $testName "ConfigAttributesObj procedure: $opt" -setup {
setup
- list [catch {font create xyz -[lindex $p 0] [lindex $p 1]} msg] $msg
- } [lindex $p 2]
- incr i
+ } -body {
+ font create xyz -$opt $val
+ } -returnCodes error -result $result
}
test font-35.1 {GetAttributeInfoObj procedure: one attribute} {
@@ -1202,12 +1191,14 @@ test font-35.1 {GetAttributeInfoObj procedure: one attribute} {
font create xyz -family xyz
font config xyz -family
} {xyz}
+
test font-36.1 {GetAttributeInfoObj procedure: unknown attribute} {
# (Tcl_GetIndexFromObj() != TCL_OK)
setup
font create xyz
list [catch {font config xyz -xyz} msg] $msg
} {1 {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike}}
+
test font-37.1 {GetAttributeInfoObj procedure: all attributes} {
# not (objPtr != NULL)
setup
@@ -1216,19 +1207,20 @@ test font-37.1 {GetAttributeInfoObj procedure: all attributes} {
} {-family xyz -size 0 -weight normal -slant roman -underline 0 -overstrike 0}
set i 4
foreach p {
- {family xyz xyz}
- {size 20 20}
- {weight normal normal}
- {slant italic italic}
- {underline yes 1}
- {overstrike false 0}
+ {font-37.2 family xyz xyz}
+ {font-37.3 size 20 20}
+ {font-37.4 weight normal normal}
+ {font-37.5 slant italic italic}
+ {font-37.6 underline yes 1}
+ {font-37.7 overstrike false 0}
} {
- test font-31.$i "GetAttributeInfo procedure: [lindex $p 0]" {
+ lassign $p testName opt val expected
+ test $testName "GetAttributeInfo procedure: $opt" -setup {
setup
- font create xyz -[lindex $p 0] [lindex $p 1]
- font config xyz -[lindex $p 0]
- } [lindex $p 2]
- incr i
+ } -body {
+ font create xyz -$opt $val
+ font config xyz -$opt
+ } -result $expected
}
# In tests below, one field is set to "xyz" so that font name doesn't
@@ -1267,15 +1259,18 @@ test font-38.9 {ParseFontNameObj procedure: arguments} {
test font-38.10 {ParseFontNameObj procedure: arguments} {
list [catch {font actual {times xyz xyz}} msg] $msg
} {1 {expected integer but got "xyz"}}
-test font-38.11 {ParseFontNameObj procedure: stylelist loop} {macOnly} {
- lrange [font actual {times 12 bold italic overstrike underline}] 4 end
-} {-weight bold -slant italic -underline 1 -overstrike 0}
test font-38.12 {ParseFontNameObj procedure: stylelist loop} {unixOrPc} {
lrange [font actual {times 12 bold italic overstrike underline}] 4 end
} {-weight bold -slant italic -underline 1 -overstrike 1}
test font-38.13 {ParseFontNameObj procedure: stylelist error} {
list [catch {font actual {times 12 bold xyz}} msg] $msg
} {1 {unknown font style "xyz"}}
+test font-38.14 "ParseFontNameObj: options with hyphenated family: bug #2791352" -body {
+ font actual {-family sans-serif -size 12 -weight bold -slant roman -underline 0 -overstrike 0}
+} -returnCodes ok -result [font actual {sans-serif 12 bold}]
+test font-38.15 "ParseFontNameObj: bug #2791352" -body {
+ font actual {-invalidfont 8 bold}
+} -returnCodes error -match glob -result {bad option "-invalidfont": *}
test font-39.1 {NewChunk procedure: test realloc} {
.b.f config -text "xxx\nxxx\txxx\nxxx\t\t\t"
@@ -1344,35 +1339,48 @@ tk scaling $oldscale
test font-45.1 {TkFontGetAliasList: no match} {
font actual {snarky 10} -family
} [font actual {-size 10} -family]
-test font-45.2 {TkFontGetAliasList: match} {macOnly} {
- # Result could be either "Times" or "New York"
- font actual {{times new roman} 10} -family
-} [font actual {times 10} -family]
-test font-45.3 {TkFontGetAliasList: match} {pcOnly} {
+test font-45.3 {TkFontGetAliasList: match} win {
font actual {times 10} -family
} {Times New Roman}
-test font-45.4 {TkFontGetAliasList: match} {unixOnly noExceed} {
+test font-45.4 {TkFontGetAliasList: match} {unix noExceed} {
# can fail on Unix systems that have a real "times new roman" font
font actual {{times new roman} 10} -family
} [font actual {times 10} -family]
+test font-46.1 {font actual, with character, no option, no --} \
+ -body {
+ font actual {times 10} a
+ } \
+ -match glob \
+ -result [list -family [font actual {times 10} -family] -size *\
+ -slant roman -underline 0 -overstrike 0]
+
+test font-46.2 {font actual, with character introduced by --} \
+ -body {
+ font actual {times 10} -- -
+ } \
+ -match glob \
+ -result [list -family [font actual {times 10} -family] -size *\
+ -slant roman -underline 0 -overstrike 0]
+
+test font-46.3 {font actual, with character and option} {
+ font actual {times 10} -family a
+} [font actual {times 10} -family]
+
+test font-46.4 {font actual, with character, option and --} {
+ font actual {times 10} -family -- -
+} [font actual {times 10} -family]
+
+test font-46.5 {font actual, too many chars} {
+ list [catch {
+ font actual {times 10} 123456789012345678901234567890123456789012345678901
+ } result] $result
+} {1 {expected a single character but got "1234567890123456789012345678901234567..."}}
+
setup
destroy .b
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/frame.test b/tests/frame.test
index 07258da..affdac6 100644
--- a/tests/frame.test
+++ b/tests/frame.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# eatColors --
@@ -121,23 +118,22 @@ foreach test {
{-takefocus "any string" "any string" {} {}}
{-width 32 32 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
+ lassign $test opt goodValue goodResult badValue badResult
test frame-1.$i {frame configuration options} {
- .f configure $name [lindex $test 1]
- lindex [.f configure $name] 4
- } [lindex $test 2]
+ .f configure $opt $goodValue
+ lindex [.f configure $opt] 4
+ } $goodResult
incr i
- if {[lindex $test 3] != ""} {
- test frame-1.$i {frame configuration options} {
- list [catch {.f configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test frame-1.$i {frame configuration options} -body {
+ .f configure $opt $badValue
+ } -returnCodes error -result $badResult
}
- .f configure $name [lindex [.f configure $name] 3]
+ .f configure $opt [lindex [.f configure $opt] 3]
incr i
}
destroy .f
-set i 1
test frame-2.1 {toplevel configuration options} {
catch {destroy .t}
toplevel .t -width 200 -height 100 -class NewClass
@@ -152,7 +148,7 @@ test frame-2.2 {toplevel configuration options} {
} {{-colormap colormap Colormap {} new} 1 {can't modify -colormap option after widget is created}}
test frame-2.3 {toplevel configuration options} {
catch {destroy .t}
- toplevel .t -width 200 -height 100 -colormap {} -use {}
+ toplevel .t -width 200 -height 100
wm geometry .t +0+0
list [catch {.t configure -container 1} msg] $msg [.t configure -container]
} {1 {can't modify -container option after widget is created} {-container container Container 0 0}}
@@ -161,12 +157,22 @@ test frame-2.4 {toplevel configuration options} {
list [catch {toplevel .t -width 200 -height 100 -colormap bogus} msg] $msg
} {1 {bad window path name "bogus"}}
set default "[winfo visual .] [winfo depth .]"
+if {$tcl_platform(platform) == "windows"} {
+test frame-2.5 {toplevel configuration options} {
+ catch {destroy .t}
+ toplevel .t -width 200 -height 100
+ wm geometry .t +0+0
+ list [catch {.t configure -use 0x44022} msg] $msg [.t configure -use]
+} {1 {window "0x44022" doesn't exist} {-use use Use {} {}}}
+} else {
test frame-2.5 {toplevel configuration options} {
catch {destroy .t}
toplevel .t -width 200 -height 100
wm geometry .t +0+0
list [catch {.t configure -use 0x44022} msg] $msg [.t configure -use]
} {1 {can't modify -use option after widget is created} {-use use Use {} {}}}
+}
+
test frame-2.6 {toplevel configuration options} {
catch {destroy .t}
toplevel .t -width 200 -height 100 -visual default
@@ -177,15 +183,14 @@ test frame-2.7 {toplevel configuration options} {
catch {destroy .t}
list [catch {toplevel .t -width 200 -height 100 -visual who_knows?} msg] $msg
} {1 {unknown or ambiguous visual name "who_knows?": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, truecolor, or default}}
-if [info exists env(DISPLAY)] {
- test frame-2.8 {toplevel configuration options} {
- catch {destroy .t}
- toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
- wm geometry .t +0+0
- list [.t configure -screen] \
- [catch {.t configure -screen another} msg] $msg
- } [list [list -screen screen Screen {} $env(DISPLAY)] 1 {can't modify -screen option after widget is created}]
-}
+test frame-2.8 {toplevel configuration options} haveDISPLAY {
+ catch {destroy .t}
+ toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
+ wm geometry .t +0+0
+ set cfg [string compare [.t configure -screen] \
+ "-screen screen Screen {} $env(DISPLAY)"]
+ list $cfg [catch {.t configure -screen another} msg] $msg
+} {0 1 {can't modify -screen option after widget is created}}
test frame-2.9 {toplevel configuration options} {
catch {destroy .t}
list [catch {toplevel .t -width 200 -height 100 -screen bogus} msg] $msg
@@ -235,39 +240,41 @@ foreach test {
{-relief ridge ridge badValue {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}}
{-width 32 32 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
+ lassign $test opt goodValue goodResult badValue badResult
test frame-2.$i {toplevel configuration options} {
- .t configure $name [lindex $test 1]
- lindex [.t configure $name] 4
- } [lindex $test 2]
+ .t configure $opt $goodValue
+ lindex [.t configure $opt] 4
+ } $goodResult
incr i
- if {[lindex $test 3] != ""} {
- test frame-2.$i {toplevel configuration options} {
- list [catch {.t configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test frame-2.$i {toplevel configuration options} -body {
+ .t configure $opt $badValue
+ } -returnCodes error -result $badResult
}
- .t configure $name [lindex [.t configure $name] 3]
+ .t configure $opt [lindex [.t configure $opt] 3]
incr i
}
-test frame-3.1 {TkCreateFrame procedure} {
- list [catch frame msg] $msg
-} {1 {wrong # args: should be "frame pathName ?options?"}}
-test frame-3.2 {TkCreateFrame procedure} {
+test frame-3.1 {TkCreateFrame procedure} -body {
+ frame
+} -returnCodes error -result {wrong # args: should be "frame pathName ?options?"}
+test frame-3.2 {TkCreateFrame procedure} -setup {
catch {destroy .f}
frame .f
- set result [.f configure -class]
+} -body {
+ .f configure -class
+} -cleanup {
destroy .f
- set result
-} {-class class Class Frame Frame}
-test frame-3.3 {TkCreateFrame procedure} {
+} -result {-class class Class Frame Frame}
+test frame-3.3 {TkCreateFrame procedure} -setup {
catch {destroy .t}
toplevel .t
wm geometry .t +0+0
- set result [.t configure -class]
+} -body {
+ .t configure -class
+} -cleanup {
destroy .t
- set result
-} {-class class Class Toplevel Toplevel}
+} -result {-class class Class Toplevel Toplevel}
test frame-3.4 {TkCreateFrame procedure} {
catch {destroy .t}
toplevel .t -width 350 -class NewClass -bg black -visual default -height 90
@@ -311,141 +318,148 @@ test frame-3.8 {TkCreateFrame procedure} {
option clear
list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4]
} {Silly #122334}
-test frame-3.9 {TkCreateFrame procedure, -use option} unixOnly {
+test frame-3.9 {TkCreateFrame procedure, -use option} -setup {
catch {destroy .t}
catch {destroy .x}
+} -constraints unix -body {
toplevel .t -container 1 -width 300 -height 120
wm geometry .t +0+0
toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green
tkwait visibility .x
- set result "[expr [winfo rootx .x] - [winfo rootx .t]] [expr [winfo rooty .x] - [winfo rooty .t]] [winfo width .t] [winfo height .t]"
+ list [expr {[winfo rootx .x] - [winfo rootx .t]}] \
+ [expr {[winfo rooty .x] - [winfo rooty .t]}] \
+ [winfo width .t] [winfo height .t]
+} -cleanup {
destroy .t
- set result
-} {0 0 140 300}
-test frame-3.10 {TkCreateFrame procedure, -use option} unixOnly {
+} -result {0 0 140 300}
+test frame-3.10 {TkCreateFrame procedure, -use option} -setup {
catch {destroy .t}
catch {destroy .x}
+} -constraints unix -body {
toplevel .t -container 1 -width 300 -height 120
wm geometry .t +0+0
option add *x.use [winfo id .t]
toplevel .x -width 140 -height 300 -bg green
tkwait visibility .x
- set result "[expr [winfo rootx .x] - [winfo rootx .t]] [expr [winfo rooty .x] - [winfo rooty .t]] [winfo width .t] [winfo height .t]"
- destroy .t
+ list [expr {[winfo rootx .x] - [winfo rootx .t]}] \
+ [expr {[winfo rooty .x] - [winfo rooty .t]}] \
+ [winfo width .t] [winfo height .t]
+} -cleanup {
+ destroy .t
option clear
- set result
-} {0 0 140 300}
+} -result {0 0 140 300}
-# The tests below require specific display characteristics. Even so,
-# they are non-portable: some machines don't seem to ever run out of
+# The tests below require specific display characteristics (i.e. that
+# they are run on a pseudocolor display of depth 8). Even so, they
+# are non-portable: some machines don't seem to ever run out of
# colors.
-if {([winfo visual .] == "pseudocolor") && ([winfo depth .] == 8)} {
+if {[testConstraint defaultPseudocolor8]} {
eatColors .t1
- test frame-3.11 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- toplevel .t -width 300 -height 200 -bg #475601
- wm geometry .t +0+0
- update
- colorsFree .t
- } {0}
- test frame-3.12 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- toplevel .t -width 300 -height 200 -bg #475601 -colormap new
- wm geometry .t +0+0
- update
- colorsFree .t
- } {1}
- test frame-3.13 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- option add *t.class Toplevel2
- option add *Toplevel2.colormap new
- toplevel .t -width 300 -height 200 -bg #475601
- wm geometry .t +0+0
- update
- option clear
- colorsFree .t
- } {1}
- test frame-3.14 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- option add *t.class Toplevel3
- option add *Toplevel3.Colormap new
- toplevel .t -width 300 -height 200 -bg #475601 -colormap new
- wm geometry .t +0+0
- update
- option clear
- colorsFree .t
- } {1}
- test frame-3.15 {TkCreateFrame procedure, -use and -colormap} {unixOnly nonPortable} {
- catch {destroy .t}
- catch {destroy .x}
- toplevel .t -container 1 -width 300 -height 120
- wm geometry .t +0+0
- toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green -colormap new
- tkwait visibility .x
- set result "[colorsFree .t] [colorsFree .x]"
- destroy .t
- set result
- } {0 1}
- test frame-3.16 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- toplevel .t -width 300 -height 200 -bg #475601 -visual default
- wm geometry .t +0+0
- update
- colorsFree .t
- } {0}
- test frame-3.17 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- toplevel .t -width 300 -height 200 -bg #475601 -visual default \
- -colormap new
- wm geometry .t +0+0
- update
- colorsFree .t
- } {1}
- if {[lsearch -exact [winfo visualsavailable .] {grayscale 8}] >= 0} {
- test frame-3.18 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- toplevel .t -visual {grayscale 8} -width 300 -height 200 \
- -bg #434343
- wm geometry .t +0+0
- update
- colorsFree .t 131 131 131
- } {1}
- test frame-3.19 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- option add *t.class T4
- option add *T4.visual {grayscale 8}
- toplevel .t -width 300 -height 200 -bg #434343
- wm geometry .t +0+0
- update
- option clear
- list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
- } {1 {grayscale 8}}
- test frame-3.20 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- set x ok
- option add *t.class T5
- option add *T5.Visual {grayscale 8}
- toplevel .t -width 300 -height 200 -bg #434343
- wm geometry .t +0+0
- update
- option clear
- list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
- } {1 {grayscale 8}}
- test frame-3.21 {TkCreateFrame procedure} {nonPortable} {
- catch {destroy .t}
- set x ok
- toplevel .t -visual {grayscale 8} -width 300 -height 200 \
- -bg #434343
- wm geometry .t +0+0
- update
- colorsFree .t 131 131 131
- } {1}
- }
+}
+test frame-3.11 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t}
+ toplevel .t -width 300 -height 200 -bg #475601
+ wm geometry .t +0+0
+ update
+ colorsFree .t
+} {0}
+test frame-3.12 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t}
+ toplevel .t -width 300 -height 200 -bg #475601 -colormap new
+ wm geometry .t +0+0
+ update
+ colorsFree .t
+} {1}
+test frame-3.13 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t}
+ option add *t.class Toplevel2
+ option add *Toplevel2.colormap new
+ toplevel .t -width 300 -height 200 -bg #475601
+ wm geometry .t +0+0
+ update
+ option clear
+ colorsFree .t
+} {1}
+test frame-3.14 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t}
+ option add *t.class Toplevel3
+ option add *Toplevel3.Colormap new
+ toplevel .t -width 300 -height 200 -bg #475601 -colormap new
+ wm geometry .t +0+0
+ update
+ option clear
+ colorsFree .t
+} {1}
+test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -setup {
+ catch {destroy .t}
+ catch {destroy .x}
+} -constraints {defaultPseudocolor8 unix nonPortable} -body {
+ toplevel .t -container 1 -width 300 -height 120
+ wm geometry .t +0+0
+ toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green -colormap new
+ tkwait visibility .x
+ list [colorsFree .t] [colorsFree .x]
+} -cleanup {
+ destroy .t
+} -result {0 1}
+test frame-3.16 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t}
+ toplevel .t -width 300 -height 200 -bg #475601 -visual default
+ wm geometry .t +0+0
+ update
+ colorsFree .t
+} {0}
+test frame-3.17 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t}
+ toplevel .t -width 300 -height 200 -bg #475601 -visual default \
+ -colormap new
+ wm geometry .t +0+0
+ update
+ colorsFree .t
+} {1}
+test frame-3.18 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} {
+ catch {destroy .t}
+ toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
+ wm geometry .t +0+0
+ update
+ colorsFree .t 131 131 131
+} {1}
+test frame-3.19 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} {
+ catch {destroy .t}
+ option add *t.class T4
+ option add *T4.visual {grayscale 8}
+ toplevel .t -width 300 -height 200 -bg #434343
+ wm geometry .t +0+0
+ update
+ option clear
+ list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
+} {1 {grayscale 8}}
+test frame-3.20 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} {
+ catch {destroy .t}
+ set x ok
+ option add *t.class T5
+ option add *T5.Visual {grayscale 8}
+ toplevel .t -width 300 -height 200 -bg #434343
+ wm geometry .t +0+0
+ update
+ option clear
+ list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
+} {1 {grayscale 8}}
+test frame-3.21 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} {
+ catch {destroy .t}
+ set x ok
+ toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
+ wm geometry .t +0+0
+ update
+ colorsFree .t 131 131 131
+} {1}
+if {[testConstraint defaultPseudocolor8]} {
destroy .t1
}
-test frame-3.22 {TkCreateFrame procedure, default dimensions} {
+test frame-3.22 {TkCreateFrame procedure, default dimensions} -setup {
catch {destroy .t}
+} -body {
toplevel .t
wm geometry .t +0+0
update
@@ -454,20 +468,20 @@ test frame-3.22 {TkCreateFrame procedure, default dimensions} {
pack .t.f
update
lappend result [winfo reqwidth .t.f] [winfo reqheight .t.f]
+} -cleanup {
destroy .t
- set result
-} {200 200 1 1}
-test frame-3.23 {TkCreateFrame procedure} {
+} -result {200 200 1 1}
+test frame-3.23 {TkCreateFrame procedure} -setup {
catch {destroy .f}
- list [catch {frame .f -gorp glob} msg] $msg
-} {1 {unknown option "-gorp"}}
-test frame-3.24 {TkCreateFrame procedure} {
+} -body {
+ frame .f -gorp glob
+} -returnCodes error -result {unknown option "-gorp"}
+test frame-3.24 {TkCreateFrame procedure} -setup {
catch {destroy .t}
- list [catch {
- toplevel .t -width 300 -height 200 -colormap new -bogus option
- wm geometry .t +0+0
- } msg] $msg
-} {1 {unknown option "-bogus"}}
+} -body {
+ toplevel .t -width 300 -height 200 -colormap new -bogus option
+ wm geometry .t +0+0
+} -returnCodes error -result {unknown option "-bogus"}
test frame-4.1 {TkCreateFrame procedure} {
catch {destroy .f}
@@ -777,16 +791,16 @@ foreach test {
{-text "any string" "any string" {} {}}
{-width 32 32 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
+ lassign $test name goodValue goodResult badValue badResult
test frame-13.$i {labelframe configuration options} {
- .f configure $name [lindex $test 1]
+ .f configure $name $goodValue
lindex [.f configure $name] 4
- } [lindex $test 2]
+ } $goodResult
incr i
- if {[lindex $test 3] != ""} {
- test frame-13.$i {labelframe configuration options} {
- list [catch {.f configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test frame-13.$i {labelframe configuration options} -body {
+ .f configure $name $badValue
+ } -returnCodes error -result $badResult
}
.f configure $name [lindex [.f configure $name] 3]
incr i
@@ -796,7 +810,7 @@ destroy .f
test frame-14.1 {labelframe labelwidget option} {
# Test that label is moved in stacking order
destroy .f .l
- label .l -text Mupp
+ label .l -text Mupp -font {helvetica 8}
labelframe .f -labelwidget .l
pack .f
frame .f.f -width 50 -height 50
@@ -897,5 +911,6 @@ rename eatColors {}
rename colorsFree {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
+
diff --git a/tests/geometry.test b/tests/geometry.test
index 9b3f253..04ab578 100644
--- a/tests/geometry.test
+++ b/tests/geometry.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
wm geometry . 300x300
@@ -248,18 +245,5 @@ test geometry-4.10 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} {
catch {destroy .t}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/get.test b/tests/get.test
index 66d0b2c..d3a4228 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
button .b
@@ -77,18 +74,5 @@ test get-2.4 {Tk_GetJustifyFromObj - error} {
} {1 {bad justification "stupid": must be left, right, or center}}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/grab.test b/tests/grab.test
index 35ac8cc..2f4f73b 100644
--- a/tests/grab.test
+++ b/tests/grab.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# There's currently no way to test the actual grab effect, per se,
@@ -179,5 +176,5 @@ test grab-5.2 {Tk_GrabObjCmd, grab set} {
set result
} [list "." "global"]
-tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/grid.test b/tests/grid.test
index eb8cfe1..fee81b5 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -6,10 +6,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# helper routine to return "." to a sane state after a test
@@ -35,6 +32,7 @@ proc grid_reset {{test ?} {top .}} {
grid rowconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform ""
}
grid propagate . 1
+ grid anchor . nw
update
}
@@ -47,7 +45,7 @@ test grid-1.1 {basic argument checking} {
test grid-1.2 {basic argument checking} {
list [catch {grid foo bar} msg] $msg
-} {1 {bad option "foo": must be bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}}
+} {1 {bad option "foo": must be anchor, bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}}
test grid-1.3 {basic argument checking} {
button .b
@@ -164,7 +162,7 @@ grid_reset 3.2
test grid-3.3 {configure: basic argument checking} {
button .b
list [catch {grid .b -row -1} msg] $msg
-} {1 {bad grid value "-1": must be a non-negative integer}}
+} {1 {bad row value "-1": must be a non-negative integer}}
grid_reset 3.3
test grid-3.4 {configure: basic argument checking} {
@@ -583,7 +581,7 @@ grid_reset 10.3
test grid-10.4 {column/row configure} {
list [catch {grid columnconfigure . nine -weight} msg] $msg
-} {1 {expected integer but got "nine"}}
+} {1 {expected integer but got "nine" (when retreiving options only integer indices are allowed)}}
grid_reset 10.4
test grid-10.5 {column/row configure} {
@@ -688,6 +686,69 @@ test grid-10.20 {column/row configure} {
} {foo}
grid_reset 10.20
+test grid-10.21 {column/row configure} {
+ list [catch {grid columnconfigure . .b -weight 1} msg] $msg
+} {1 {grid columnconfigure: illegal index ".b"}}
+grid_reset 10.21
+
+test grid-10.22 {column/row configure} {
+ button .b
+ list [catch {grid columnconfigure . .b -weight 1} msg] $msg
+} {1 {grid columnconfigure: the window ".b" is not managed by "."}}
+grid_reset 10.22
+
+test grid-10.23 {column/row configure} {
+ button .b
+ grid .b -column 1 -columnspan 2
+ grid columnconfigure . .b -weight 1
+ set res {}
+ foreach i {0 1 2 3} {
+ lappend res [grid columnconfigure . $i -weight]
+ }
+ set res
+} {0 1 1 0}
+grid_reset 10.23
+
+test grid-10.24 {column/row configure} {
+ button .b
+ button .c
+ button .d
+ grid .b -column 1 -columnspan 2
+ grid .c -column 2 -columnspan 3
+ grid .d -column 4 -columnspan 2
+ grid columnconfigure . {.b .d} -weight 1
+ grid columnconfigure . .c -weight 2
+ set res {}
+ foreach i {0 1 2 3 4 5 6} {
+ lappend res [grid columnconfigure . $i -weight]
+ }
+ set res
+} {0 1 2 2 2 1 0}
+grid_reset 10.24
+
+test grid-10.25 {column/row configure} {
+ button .b
+ button .c
+ button .d
+ grid .b -row 1 -rowspan 2
+ grid .c -row 2 -rowspan 3
+ grid .d -row 4 -rowspan 2
+ grid rowconfigure . {7 all} -weight 1
+ grid rowconfigure . {1 .d} -weight 2
+ set res {}
+ foreach i {0 1 2 3 4 5 6 7} {
+ lappend res [grid rowconfigure . $i -weight]
+ }
+ set res
+} {0 2 1 1 2 2 0 1}
+grid_reset 10.25
+
+test grid-10.26 {column/row configure} {
+ button .b
+ grid columnconfigure .b 0
+} {-minsize 0 -pad 0 -uniform {} -weight 0}
+grid_reset 10.26
+
test grid-10.30 {column/row configure - no indices} {
# Bug 1422430
set t [toplevel .test]
@@ -711,6 +772,33 @@ test grid-10.33 {column/row configure - invalid indices} {
list [catch {grid rowconfigure . {0 1 2} -weight} msg] $msg
} {1 {grid rowconfigure: must specify a single element on retrieval}}
+test grid-10.34 {column/row configure - empty 'all' configure} {
+ # Bug 1422430
+ set t [toplevel .test]
+ grid rowconfigure $t all -weight 1
+ destroy $t
+} {}
+
+test grid-10.35 {column/row configure} {
+ # Test that no lingering message is there
+ frame .f
+ set res [grid columnconfigure .f all -weight 1]
+ append res [grid columnconfigure .f {0 all} -weight 1]
+ frame .f.f
+ grid .f.f
+ append res [grid columnconfigure .f {.f.f} -weight 1]
+ append res [grid columnconfigure .f {.f.f 1} -weight 1]
+ append res [grid columnconfigure .f {2 .f.f} -weight 1]
+ destroy .f
+ set res
+} {}
+grid_reset 10.35
+
+test grid-10.36 {column/row configure} {
+ list [catch {grid columnconfigure . all} msg] $msg
+} {1 {expected integer but got "all" (when retreiving options only integer indices are allowed)}}
+grid_reset 10.36
+
test grid-10.37 {column/row configure} {
list [catch {grid columnconfigure . 100000} msg] $msg
} {0 {-minsize 0 -pad 0 -uniform {} -weight 0}}
@@ -722,14 +810,11 @@ test grid-10.38 {column/row configure} -body {
# Test different combinations of row/column overflow
frame .f
set res {}
- grid .f -column 0 -columnspan 1 -row 0 -rowspan 1
lappend res [catch {grid .f -row 10 -column 9999} msg] $msg ; update
lappend res [catch {grid .f -row 9999 -column 10} msg] $msg ; update
lappend res [catch {grid .f -columnspan 2 -column 9998} msg] $msg ; update
lappend res [catch {grid .f -rowspan 2 -row 9998} msg] $msg ; update
- grid .f -column 0 -columnspan 1 -row 0 -rowspan 1
lappend res [catch {grid .f -column 9998 -columnspan 2} msg] $msg ; update
- grid .f -column 0 -columnspan 1 -row 0 -rowspan 1
lappend res [catch {grid .f -row 9998 -rowspan 2} msg] $msg ; update
set res
} -cleanup {destroy .f} -result [lrange {
@@ -748,8 +833,7 @@ test grid-10.39 {column/row configure} -body {
frame .g
set res {}
grid .f -row 9998 -column 0
- lappend res [catch {grid ^ .g} msg] $msg ; update
- grid forget .g
+ lappend res [catch {grid ^ -in .} msg] $msg ; update
lappend res [catch {grid .g} msg] $msg ; update
grid forget .f .g
lappend res [catch {grid .f - -column 9998} msg] $msg ; update
@@ -966,6 +1050,41 @@ test grid-11.17 {default widget placement} {
} {100 50 100}
grid_reset 11.17
+test grid-11.18 {default widget placement} {
+ foreach l {a b c d e} {
+ frame .$l -width 50 -height 50
+ }
+ grid .a .b .c .d -sticky news
+ grid ^ ^ ^ x -in . ;# ^ and no child should work with -in.
+ grid rowconfigure . {0 1} -uniform a
+ update
+ set res ""
+ lappend res [winfo height .a]
+ lappend res [winfo height .b]
+ lappend res [winfo height .c]
+ lappend res [winfo height .d]
+} {100 100 100 50}
+grid_reset 11.18
+
+test grid-11.19 {default widget placement} {
+ foreach l {a b c d e} {
+ frame .$l -width 50 -height 50
+ }
+ grid .a .b -sticky news
+ grid .c .d -sticky news
+ grid ^ -in . -row 2
+ grid x ^ -in . -row 1
+
+ grid rowconfigure . {0 1 2} -uniform a
+ update
+ set res ""
+ lappend res [winfo height .a]
+ lappend res [winfo height .b]
+ lappend res [winfo height .c]
+ lappend res [winfo height .d]
+} {50 100 100 50}
+grid_reset 11.19
+
test grid-12.1 {-sticky} {
catch {unset data}
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
@@ -1021,6 +1140,14 @@ test grid-13.1 {-in} {
} {1 {Window can't be managed in itself}}
grid_reset 13.1
+test grid-13.1.1 {-in} {
+ frame .f -bg red
+ list [winfo manager .f] \
+ [catch {grid .f -in .f} err] $err \
+ [winfo manager .f]
+} {{} 1 {Window can't be managed in itself} {}}
+grid_reset 13.1.1
+
test grid-13.2 {-in} {
frame .f -bg red
list [catch "grid .f -in .bad" msg] $msg
@@ -1268,6 +1395,7 @@ test grid-16.1 {layout centering} {
grid .$i -row $i -column $i -sticky nswe
}
grid propagate . 0
+ grid anchor . center
. configure -width 300 -height 250
update
grid bbox .
@@ -1419,7 +1547,7 @@ test grid-16.8 {layout internal constraints} {
append a "[winfo x .$i] "
}
set a
-} {0 30 70 250 280 , 0 30 130 230 260 , 0 30 113 197 280 , 0 30 60 90 120 }
+} {0 30 130 230 280 , 0 30 130 230 260 , 0 30 113 196 280 , 0 30 60 90 120 }
grid_reset 16.8
test grid-16.9 {layout uniform} {
@@ -1484,7 +1612,7 @@ test grid-16.12 {layout uniform (grow)} {
grid .f1 .f2 .f3 .f4 -sticky news
grid columnconfigure . {0 1 2} -uniform a
# Put weight 2 on the biggest in the group to see that the groups
- # adapts to one of the smaller.
+ # adapt to one of the smaller.
grid columnconfigure . 2 -weight 2
grid columnconfigure . {0 3} -weight 1
update
@@ -1501,7 +1629,113 @@ test grid-16.12 {layout uniform (grow)} {
{0 0 70 95} {70 0 50 95} {120 0 140 95} {260 0 90 95}]
grid_reset 16.12
-test grid-16.13 {layout weights (shrinking at minsize)} {
+test grid-16.13 {layout span} {
+ frame .f1 -width 24 -height 20
+ frame .f2 -width 38 -height 20
+ frame .f3 -width 150 -height 20
+
+ grid .f1 - - .f2
+ grid .f3 - - -
+
+ set res {}
+ foreach w {{0 1 0 0} {0 0 1 0} {1 3 4 0} {1 2 1 2} {1 1 1 12}} {
+ for {set c 0} {$c < 4} {incr c} {
+ grid columnconfigure . $c -weight [lindex $w $c]
+ }
+ update
+ set res2 {}
+ for {set c 0} {$c <= 4} {incr c} {
+ lappend res2 [lindex [grid bbox . $c 0] 2]
+ }
+ lappend res $res2
+ }
+ set res
+ # The last result below should ideally be 8 8 8 126 but the current
+ # implementation is not exact enough.
+} [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 14 42 56 38 0] \
+ [list 18 38 18 76 0] [list 7 8 9 126 0]]
+grid_reset 16.13
+
+test grid-16.14 {layout span} {
+ frame .f1 -width 110 -height 20
+ frame .f2 -width 38 -height 20
+ frame .f3 -width 150 -height 20
+
+ grid .f1 - - .f2
+ grid .f3 - - -
+
+ set res {}
+ foreach w {{0 1 0 0} {0 0 1 0} {1 3 4 0} {1 2 1 3} {1 1 1 12}} {
+ for {set c 0} {$c < 4} {incr c} {
+ grid columnconfigure . $c -weight [lindex $w $c]
+ }
+ update
+ set res2 {}
+ for {set c 0} {$c <= 4} {incr c} {
+ lappend res2 [lindex [grid bbox . $c 0] 2]
+ }
+ lappend res $res2
+ }
+ set res
+} [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 14 42 56 38 0] \
+ [list 27 55 28 40 0] [list 36 37 37 40 0]]
+grid_reset 16.14
+
+test grid-16.15 {layout span} {
+ frame .f1 -width 24 -height 20
+ frame .f2 -width 38 -height 20
+ frame .f3 -width 150 -height 20
+
+ grid .f1 - - .f2
+ grid x .f3 - -
+
+ set res {}
+ foreach w {{0 1 0 0} {0 0 1 0} {1 0 1 0} {0 0 0 0} {1 0 0 6}} {
+ for {set c 0} {$c < 4} {incr c} {
+ grid columnconfigure . $c -weight [lindex $w $c]
+ }
+ update
+ set res2 {}
+ for {set c 0} {$c <= 4} {incr c} {
+ lappend res2 [lindex [grid bbox . $c 0] 2]
+ }
+ lappend res $res2
+ }
+ set res
+} [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 0 0 112 38 0] \
+ [list 0 37 37 76 0] [list 0 12 12 126 0]]
+grid_reset 16.15
+
+test grid-16.16 {layout span} {
+ frame .f1 -width 64 -height 20
+ frame .f2 -width 38 -height 20
+ frame .f3 -width 150 -height 20
+ frame .f4 -width 15 -height 20
+ frame .f5 -width 18 -height 20
+ frame .f6 -width 20 -height 20
+
+ grid .f1 - x .f2
+ grid .f3 - - -
+ grid .f4 .f5 .f6
+
+ set res {}
+ foreach w {{1 1 5 1} {0 0 1 0} {1 3 4 0} {1 2 1 2} {1 1 1 12}} {
+ for {set c 0} {$c < 4} {incr c} {
+ grid columnconfigure . $c -weight [lindex $w $c]
+ }
+ update
+ set res2 {}
+ for {set c 0} {$c <= 4} {incr c} {
+ lappend res2 [lindex [grid bbox . $c 0] 2]
+ }
+ lappend res $res2
+ }
+ set res
+} [list [list 30 34 43 43 0] [list 30 34 48 38 0] [list 22 42 48 38 0] \
+ [list 25 39 29 57 0] [list 30 34 22 64 0]]
+grid_reset 16.16
+
+test grid-16.17 {layout weights (shrinking at minsize)} {
foreach i {0 1 2 3} {
frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
grid .$i -row $i -column $i -sticky nswe
@@ -1522,8 +1756,33 @@ test grid-16.13 {layout weights (shrinking at minsize)} {
}
set a
} {25-25-1 25-25-1 100-75-1 100-75-1 25-25-0 25-25-0 100-75-1 100-75-1}
-grid_reset 16.13
+grid_reset 16.17
+test grid-16.18 {layout span} {
+ frame .f1 -width 30 -height 20
+ frame .f2 -width 166 -height 20
+ frame .f3 -width 39 -height 20
+ frame .f4 -width 10 -height 20
+
+ grid .f1 .f3 -
+ grid .f2 - .f4
+ grid columnconfigure . 0 -weight 1
+
+ set res {}
+ foreach w {{1 0 0} {0 1 0} {0 0 1}} {
+ for {set c 0} {$c < 3} {incr c} {
+ grid columnconfigure . $c -weight [lindex $w $c]
+ }
+ update
+ set res2 {}
+ for {set c 0} {$c <= 2} {incr c} {
+ lappend res2 [lindex [grid bbox . $c 0] 2]
+ }
+ lappend res $res2
+ }
+ set res
+} [list [list 137 29 10] [list 30 136 10] [list 98 68 10]]
+grid_reset 16.18
test grid-17.1 {forget and pending idle handlers} {
# This test is intended to detect a crash caused by a failure to remove
@@ -1616,6 +1875,141 @@ test grid-20.2 {recalculate size after removal (forget)} {
} {1 1}
grid_reset 20.2
+test grid-21.1 {anchor} {
+ list [catch {grid anchor . 1 xxx} msg] $msg
+} {1 {wrong # args: should be "grid anchor window ?anchor?"}}
+grid_reset 21.1
+
+test grid-21.2 {anchor} {
+ list [catch {grid anchor .} msg] $msg
+} {0 nw}
+grid_reset 21.2
+
+test grid-21.3 {anchor} {
+ list [catch {grid anchor . se;grid anchor .} msg] $msg
+} {0 se}
+grid_reset 21.3
+
+test grid-21.4 {anchor} {
+ list [catch {grid anchor .x} msg] $msg
+} {1 {bad window path name ".x"}}
+grid_reset 21.4
+
+test grid-21.5 {anchor} {
+ list [catch {grid anchor . x} msg] $msg
+} {1 {bad anchor "x": must be n, ne, e, se, s, sw, w, nw, or center}}
+grid_reset 21.5
+
+test grid-21.6 {anchor} {
+ foreach i {0 1 2} {
+ frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
+ }
+ grid propagate . 0
+ . configure -width 300 -height 250
+
+ set res {}
+ foreach a {n ne e se s sw w nw center} {
+ grid anchor . $a
+ update
+ lappend res [grid bbox .]
+ }
+ set res
+} [list {37 0 225 150} {75 0 225 150} {75 50 225 150} {75 100 225 150} \
+ {37 100 225 150} {0 100 225 150} {0 50 225 150} {0 0 225 150} \
+ {37 50 225 150}]
+grid_reset 21.6
+
+test grid-21.7 {anchor} {
+ # Test with a non-symmetric internal border.
+ # This only tests vertically, there is currently no way to get
+ # it assymetric horizontally.
+ labelframe .f -bd 0
+ frame .f.x -width 20 -height 20
+ .f configure -labelwidget .f.x
+ pack .f -fill both -expand 1
+
+ foreach i {0 1 2} {
+ frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
+ grid .$i -in .f -row $i -column $i -sticky nswe
+ }
+ pack propagate . 0
+ grid propagate .f 0
+ . configure -width 300 -height 250
+
+ set res {}
+ foreach a {n ne e se s sw w nw center} {
+ grid anchor .f $a
+ update
+ lappend res [grid bbox .f]
+ }
+ pack propagate . 1 ; wm geometry . {}
+ set res
+} [list {37 20 225 150} {75 20 225 150} {75 60 225 150} {75 100 225 150} \
+ {37 100 225 150} {0 100 225 150} {0 60 225 150} {0 20 225 150} \
+ {37 60 225 150}]
+grid_reset 21.7
+
+test grid-22.1 {remove: basic argument checking} {
+ list [catch {grid remove foo} msg] $msg
+} {1 {bad window path name "foo"}}
+
+test grid-22.2 {remove} {
+ button .c
+ grid [button .b]
+ set a [grid slaves .]
+ grid remove .b .c
+ lappend a [grid slaves .]
+ set a
+} {.b {}}
+grid_reset 22.2
+
+test grid-22.3 {remove} {
+ button .c
+ grid .c -row 2 -column 2 -rowspan 2 -columnspan 2 -padx 3 -pady 4 -sticky ns
+ grid remove .c
+ grid .c -row 0 -column 0
+ grid info .c
+} {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx 3 -pady 4 -sticky ns}
+grid_reset 22.3
+
+test grid-22.3.1 {remove} {
+ frame .a
+ button .c
+ grid .c -in .a -row 2 -column 2 -rowspan 2 -columnspan 2 -padx {3 5} -pady {4 7} -sticky ns
+ grid remove .c
+ grid .c -row 0 -column 0
+ grid info .c
+} {-in .a -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns}
+grid_reset 22.3.1
+
+test grid-22.4 {remove, calling Tk_UnmaintainGeometry} {
+ frame .f -bd 2 -relief raised
+ place .f -x 10 -y 20 -width 200 -height 100
+ frame .f2 -width 50 -height 30 -bg red
+ grid .f2 -in .f
+ update
+ set x [winfo ismapped .f2]
+ grid remove .f2
+ place .f -x 30
+ update
+ lappend x [winfo ismapped .f2]
+} {1 0}
+grid_reset 22.4
+
+test grid-22.5 {remove} {
+ frame .a
+ button .c
+ grid .c -in .a -row 2 -column 2 -rowspan 2 -columnspan 2 -padx {3 5} -pady {4 7} -sticky ns
+ grid remove .c
+ # If .a was destroyed while remembered by the removed .c, make sure it
+ # is ignored.
+ destroy .a
+ grid .c -row 0 -column 0
+ grid info .c
+} {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns}
+grid_reset 22.5
+
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/id.test b/tests/id.test
index 670f27f..de0d965 100644
--- a/tests/id.test
+++ b/tests/id.test
@@ -7,13 +7,10 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-test id-1.1 {WindowIdCleanup, delaying window release} {unixOnly testwrapper} {
+test id-1.1 {WindowIdCleanup, delaying window release} {unix testwrapper} {
bind all <Destroy> {lappend x %W}
catch {unset map}
frame .f
@@ -90,18 +87,5 @@ test id-1.1 {WindowIdCleanup, delaying window release} {unixOnly testwrapper} {
bind all <Destroy> {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/image.test b/tests/image.test
index 2430b6e..c6c4f8a 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -8,15 +8,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-
-namespace import -force tcltest::interpreter
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
+namespace import -force ::tk::test::loadTkCommand
eval image delete [image names]
canvas .c -highlightthickness 2
@@ -72,26 +66,30 @@ test image-1.9 {Tk_ImageCmd procedure, "create" option} testImageType {
list [catch {image create test -badName foo} msg] $msg [image names]
} {1 {bad option name "-badName"} {}}
test image-1.10 {Tk_ImageCmd procedure, "create" option with same name as main window} {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
update
puts [list [catch {image create photo .} msg] $msg]
exit
- } script]
+ }
+ set script [makeFile $code script]
set x [list [catch {exec [interpreter] <$script} msg] $msg]
removeFile script
set x
} {0 {1 {images may not be named the same as the main window}}}
test image-1.11 {Tk_ImageCmd procedure, "create" option with same name as main window after renaming} {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
update
puts [list [catch {rename . foo;image create photo foo} msg] $msg]
exit
- } script]
+ }
+ set script [makeFile $code script]
set x [list [catch {exec [interpreter] <$script} msg] $msg]
removeFile script
set x
} {0 {1 {images may not be named the same as the main window}}}
-test image-1.11 {Tk_ImageCmd, "create" option: do not generated command name in use} -setup {
+test image-1.12 {Tk_ImageCmd, "create" option: do not generated command name in use} -setup {
set i [image create bitmap]
regexp {^image(\d+)$} $i -> serial
incr serial
@@ -175,15 +173,25 @@ test image-5.5 {Tk_ImageCmd procedure, "type" option} testImageType {
image create test myimage
.c create image 50 50 -image myimage
image delete myimage
+ list [catch {image type myimage} msg] $msg
+} {1 {image "myimage" doesn't exist}}
+test image-5.6 {Tk_ImageCmd procedure, "type" option} testOldImageType {
+ image create oldtest myimage
image type myimage
-} {}
+} {oldtest}
+test image-5.7 {Tk_ImageCmd procedure, "type" option} testOldImageType {
+ image create oldtest myimage
+ .c create image 50 50 -image myimage
+ image delete myimage
+ list [catch {image type myimage} msg] $msg
+} {1 {image "myimage" doesn't exist}}
test image-6.1 {Tk_ImageCmd procedure, "types" option} {
list [catch {image types x} msg] $msg
} {1 {wrong # args: should be "image types"}}
test image-6.2 {Tk_ImageCmd procedure, "types" option} testImageType {
lsort [image types]
-} {bitmap photo test}
+} {bitmap oldtest photo test}
test image-7.1 {Tk_ImageCmd procedure, "width" option} {
list [catch {image width} msg] $msg
@@ -271,16 +279,17 @@ test image-11.2 {Tk_FreeImage procedure} testImageType {
eval image delete [image names]
image create test foo -variable x
.c create image 50 50 -image foo -tags i1
+ set names [image names]
image delete foo
update
- set names [image names]
+ set names2 [image names]
set x {}
.c delete i1
pack forget .c
pack .c
update
- list $names [image names] $x
-} {foo {} {}}
+ list $names $names2 [image names] $x
+} {foo {} {} {}}
# Non-portable, apparently due to differences in rounding:
@@ -373,10 +382,28 @@ test image-13.2 {DeleteImage procedure} testImageType {
.c create image 90 100 -image foo -tags i2
set x {}
image delete foo
- lappend x | [image names] |
+ lappend x | [image names] | [catch {image delete foo} msg] | $msg | [image names] |
+} {{foo free} {foo free} {foo delete} | {} | 1 | {image "foo" doesn't exist} | {} |}
+
+test image-13.3 {Tk_SizeOfImage procedure} testOldImageType {
+ eval image delete [image names]
+ image create oldtest foo -variable x
+ set result [list [image width foo] [image height foo]]
+ foo changed 0 0 0 0 85 60
+ lappend result [image width foo] [image height foo]
+} {30 15 85 60}
+
+test image-13.4 {DeleteImage procedure} testOldImageType {
+ .c delete all
+ eval image delete [image names]
+ image create oldtest foo -variable x
+ .c create image 50 50 -image foo -tags i1
+ .c create image 90 100 -image foo -tags i2
+ set x {}
image delete foo
- lappend x | [image names] |
-} {{foo free} {foo free} {foo delete} | foo | | foo |}
+ lappend x | [image names] | [catch {image delete foo} msg] | $msg | [image names] |
+} {{foo free} {foo free} {foo delete} | {} | 1 | {image "foo" doesn't exist} | {} |}
+
catch {image delete hidden}
set l [image names]
@@ -389,10 +416,24 @@ test image-14.1 {image command vs hidden commands} {
image delete hidden
list [image names] [interp hidden]
} [list $l $h]
+
+eval image delete [image names]
+test image-15.1 {deleting image does not make widgets forget about it} {
+ .c delete all
+ image create photo foo -width 10 -height 10
+ .c create image 10 10 -image foo -tags i1 -anchor nw
+ update
+ set x [.c bbox i1]
+ lappend x [image names]
+ image delete foo
+ lappend x [image names]
+ image create photo foo -width 20 -height 20
+ lappend x [.c bbox i1] [image names]
+} {10 10 20 20 foo {} {10 10 30 30} foo}
destroy .c
eval image delete [image names]
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/imgBmap.test b/tests/imgBmap.test
index 06d8265..edbb8c3 100644
--- a/tests/imgBmap.test
+++ b/tests/imgBmap.test
@@ -8,15 +8,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
-
set data1 {#define foo_width 16
#define foo_height 16
#define foo_x_hot 3
@@ -471,18 +465,5 @@ destroy .c
eval image delete [image names]
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/imgPPM.test b/tests/imgPPM.test
index 160f2f2..a9e9dc0 100644
--- a/tests/imgPPM.test
+++ b/tests/imgPPM.test
@@ -7,17 +7,13 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
-
eval image delete [image names]
+# Note that we do not use [tcltest::makeFile] because it is
+# only suitable for text files
proc put {file data} {
set f [open $file w]
fconfigure $f -translation lf
@@ -72,8 +68,8 @@ test imgPPM-2.1 {FileWritePPM procedure} {
} {1 {couldn't open "not_a_dir/bar/baz/gorp": no such file or directory} {posix enoent {no such file or directory}}}
test imgPPM-2.2 {FileWritePPM procedure} {
catch {unset data}
- p1 write -format ppm test2.ppm
- set fd [open test2.ppm]
+ p1 write -format ppm test.ppm
+ set fd [open test.ppm]
set data [read $fd]
close $fd
set data
@@ -161,23 +157,9 @@ test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} \
-returnCodes error \
-result {truncated PPM data}
-removeFile test.ppm
-removeFile test2.ppm
eval image delete [image names]
# cleanup
-::tcltest::cleanupTests
+catch {file delete test.ppm}
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index 79fede0..d4118b0 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -10,15 +10,9 @@
# Author: Paul Mackerras (paulus@cs.anu.edu.au)
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
-
eval image delete [image names]
canvas .c
@@ -27,20 +21,11 @@ update
set README [makeFile {
README -- Tk test suite design document.
-} README-imgPhotot]
+} README-imgPhoto]
# find the teapot.ppm file for use in these tests
-# first look in $tk_library/demos/images/teapot.ppm
-# then look in <this file>/../../library/demos/images/teapot.ppm
-testConstraint hasTeapotPhoto 1
-set teapotPhotoFile [file join $tk_library demos images teapot.ppm]
-if {![file exists $teapotPhotoFile]} {
- set newLib [file dirname [testsDirectory]]
- set teapotPhotoFile [file join $newLib library demos images teapot.ppm]
- if {![file exists $teapotPhotoFile]} {
- testConstraint hasTeapotPhoto
- }
-}
+set teapotPhotoFile [file join [file dirname [info script]] teapot.ppm]
+testConstraint hasTeapotPhoto [file exists $teapotPhotoFile]
test imgPhoto-1.1 {options for photo images} {
image create photo p1 -width 79 -height 83
@@ -412,7 +397,7 @@ proc checkImgTransLoopResetSet {img width height} {
}
return $result
}
-test imgPhoto-4.68 {ImgPhotoCmd procedure: transparency set option} {
+test imgPhoto-4.67a {ImgPhotoCmd procedure: transparency set option} {
checkImgTransLoopResetSet p1 3 3
} {0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 2 1 0 1 1 1 2 2 0 2 1 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 1 1 0 1 1 1 2 2 0 2 1 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 1 0 2 1 1 1 2 2 0 2 1 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 1 0 2 1 0 1 2 2 0 2 1 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 1 0 2 1 0 1 1 2 0 2 1 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 1 0 2 1 0 1 1 1 2 2 1 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 2 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 . 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 , 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 .}
catch {rename checkImgTransLoopSetReset {}}
@@ -571,7 +556,7 @@ test imgPhoto-12.1 {Tk_PhotoPutZoomedBlock} hasTeapotPhoto {
} {{19 92 192} {169 117 90} 512 512 {19 92 192}}
test imgPhoto-13.1 {check separation of images in different interpreters} {
- eval image delete [image names]
+ image delete {*}[image names]
set data {
R0lGODlhQgBkAPUAANbWxs7Wxs7OxsbOxsbGxsbGvb3Gvca9vcDAwL21vbW1vbW1tbWtta2t
ta2ltaWltaWlraWctaWcrZycrZyUrZSUrZSMrZSMpYyMrYyMpYyEpYSEpYR7pYR7nHp7pYRz
@@ -614,7 +599,6 @@ test imgPhoto-13.1 {check separation of images in different interpreters} {
interp delete x2
} {}
-
test imgPhoto-14.1 {GIF writes work correctly} {
set data "R0lGODlhYwA5APcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgAysnGy8hKzM
hASs3MTcjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
@@ -657,10 +641,10 @@ test imgPhoto-14.2 {GIF -index handler buffer sizing} -setup {
# Bug 1458234 makes this crash when trying to access buffers of the
# wrong size, caused when the initial frame is not the largest frame.
set data {
- R0lGODlhIAAgAKEAAPkOSQsi7////////yH/C05FVFNDQVBFMi4wAwEAAAAh
- +QQJMgAAACwGAAYAFAAUAAACEYyPqcvtD6OctNqLs968+68VACH5BAkyAAEA
- LAMAAwAaABoAAAI0jH+gq+gfmFzQzUsr3gBybn1gIm5kaUaoubbuC8fyTNel
- Ohv1CSO533u8KrgbUfc5Ci/EAgA7
+ R0lGODlhIAAgAKEAAPkOSQsi7////////yH/C05FVFNDQVBFMi4wAwEAAAAh
+ +QQJMgAAACwGAAYAFAAUAAACEYyPqcvtD6OctNqLs968+68VACH5BAkyAAEA
+ LAMAAwAaABoAAAI0jH+gq+gfmFzQzUsr3gBybn1gIm5kaUaoubbuC8fyTNel
+ Ohv1CSO533u8KrgbUfc5Ci/EAgA7
}
$i configure -data $data -format {gif -index 2}
} -cleanup {
@@ -728,5 +712,5 @@ eval image delete [image names]
# cleanup
removeFile README-imgPhoto
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/listbox.test b/tests/listbox.test
index fd8603d..25bc606 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -7,17 +7,14 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
set fixed {Courier -12}
-proc record args {
+proc record {name args} {
global log
- lappend log $args
+ lappend log [format {%s %.6g %.6g} $name {*}$args]
}
proc getsize w {
@@ -477,7 +474,7 @@ test listbox-3.78 {ListboxWidgetCmd procedure, "scan" option} {fonts} {
.t.l scan mark 100 140
.t.l scan dragto 90 137
update
- list [.t.l xview] [.t.l yview]
+ list [format {%.6g %.6g} {*}[.t.l xview]] [format {%.6g %.6g} {*}[.t.l yview]]
} {{0.249364 0.427481} {0.0714286 0.428571}}
test listbox-3.79 {ListboxWidgetCmd procedure, "scan" option} {
list [catch {.l scan foo 2 4} msg] $msg
@@ -629,7 +626,7 @@ test listbox-3.114 {ListboxWidgetCmd procedure, "xview" option} {
catch {destroy .l2}
listbox .l2
update
- .l2 xview
+ format {%.6g %.6g} {*}[.l2 xview]
} {0 1}
test listbox-3.115 {ListboxWidgetCmd procedure, "xview" option} {
catch {destroy .l}
@@ -637,7 +634,7 @@ test listbox-3.115 {ListboxWidgetCmd procedure, "xview" option} {
.l insert 0 a b c d e f g h i j k l m n o p q r s t
pack .l
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0 1}
catch {destroy .l}
listbox .l -width 10 -height 5 -font $fixed
@@ -647,7 +644,7 @@ pack .l
update
test listbox-3.116 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 4
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.08 0.28}
test listbox-3.117 {ListboxWidgetCmd procedure, "xview" option} {
list [catch {.l xview foo} msg] $msg
@@ -659,19 +656,19 @@ test listbox-3.119 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 0
.l xview moveto .4
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.4 0.6}
test listbox-3.120 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 0
.l xview scroll 2 units
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.04 0.24}
test listbox-3.121 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 30
.l xview scroll -1 pages
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.44 0.64}
test listbox-3.122 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l configure -width 1
@@ -679,14 +676,14 @@ test listbox-3.122 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 30
.l xview scroll -4 pages
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.52 0.54}
test listbox-3.123 {ListboxWidgetCmd procedure, "yview" option} {
catch {destroy .l}
listbox .l
pack .l
update
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0 1}
test listbox-3.124 {ListboxWidgetCmd procedure, "yview" option} {
catch {destroy .l}
@@ -694,7 +691,7 @@ test listbox-3.124 {ListboxWidgetCmd procedure, "yview" option} {
.l insert 0 el1
pack .l
update
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0 1}
catch {destroy .l}
listbox .l -width 10 -height 5 -font $fixed
@@ -704,11 +701,11 @@ update
test listbox-3.125 {ListboxWidgetCmd procedure, "yview" option} {
.l yview 4
update
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.2 0.45}
test listbox-3.126 {ListboxWidgetCmd procedure, "yview" option, partial last line} {
mkPartial
- .partial.l yview
+ format {%.6g %.6g} {*}[.partial.l yview]
} {0 0.266667}
test listbox-3.127 {ListboxWidgetCmd procedure, "xview" option} {
list [catch {.l yview foo} msg] $msg
@@ -719,24 +716,24 @@ test listbox-3.128 {ListboxWidgetCmd procedure, "xview" option} {
test listbox-3.129 {ListboxWidgetCmd procedure, "xview" option} {
.l yview 0
.l yview moveto .31
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.3 0.55}
test listbox-3.130 {ListboxWidgetCmd procedure, "xview" option} {
.l yview 2
.l yview scroll 2 pages
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.4 0.65}
test listbox-3.131 {ListboxWidgetCmd procedure, "xview" option} {
.l yview 10
.l yview scroll -3 units
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.35 0.6}
test listbox-3.132 {ListboxWidgetCmd procedure, "xview" option} {
.l configure -height 2
update
.l yview 15
.l yview scroll -4 pages
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.55 0.65}
test listbox-3.133 {ListboxWidgetCmd procedure, "xview" option} {
list [catch {.l whoknows} msg] $msg
@@ -944,6 +941,7 @@ test listbox-4.18 {ConfigureListbox, no listvar -> bad listvar} {
"unmatched open quote in list: invalid -listvariable value"]
test listbox-4.19 {ConfigureListbox, no listvar -> bad non-existent listvar} {
catch {destroy .l}
+ unset -nocomplain ::foo
listbox .l -listvar foo
.l insert end a b c d
catch {.l configure -listvar ::zoo::bar::foo} result
@@ -1107,7 +1105,7 @@ test listbox-6.14 {InsertEls procedure, check selection update} {
.l2 insert 0 a
.l2 curselection
} [list 3 4 5]
-test listbox-6.15 {InsertEls procedure, lost namespaced listvar, bug 1424513} {
+test listbox-6.15 {InsertEls procedure, lost namespaced listvar} {
destroy .l2
namespace eval test { variable foo {a b} }
listbox .l2 -listvar ::test::foo
@@ -1302,7 +1300,7 @@ test listbox-8.2 {ListboxEventProc procedure} {fonts} {
update
place .l -width 50 -height 80
update
- list [.l xview] [.l yview]
+ list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0 0.222222} {0 0.333333}}
test listbox-8.3 {ListboxEventProc procedure} {
deleteWindows
@@ -1445,7 +1443,7 @@ test listbox-11.3 {ChangeListboxView procedure} {
set log {}
.l yview 2
update
- list [.l yview] $log
+ list [format {%.6g %.6g} {*}[.l yview]] $log
} {{0.2 0.7} {{y 0.2 0.7}}}
test listbox-11.4 {ChangeListboxView procedure} {
catch {destroy .l}
@@ -1456,7 +1454,7 @@ test listbox-11.4 {ChangeListboxView procedure} {
set log {}
.l yview 8
update
- list [.l yview] $log
+ list [format {%.6g %.6g} {*}[.l yview]] $log
} {{0.5 1} {{y 0.5 1}}}
test listbox-11.5 {ChangeListboxView procedure} {
catch {destroy .l}
@@ -1468,7 +1466,7 @@ test listbox-11.5 {ChangeListboxView procedure} {
set log {}
.l yview 3
update
- list [.l yview] $log
+ list [format {%.6g %.6g} {*}[.l yview]] $log
} {{0.3 0.8} {}}
test listbox-11.6 {ChangeListboxView procedure, partial last line} {
mkPartial
@@ -1485,13 +1483,13 @@ test listbox-12.1 {ChangeListboxOffset procedure} {fonts} {
set log {}
.l xview 99
update
- list [.l xview] $log
+ list [format {%.6g %.6g} {*}[.l xview]] $log
} {{0.9 1} {{x 0.9 1}}}
test listbox-12.2 {ChangeListboxOffset procedure} {fonts} {
set log {}
.l xview moveto -.25
update
- list [.l xview] $log
+ list [format {%.6g %.6g} {*}[.l xview]] $log
} {{0 0.1} {{x 0 0.1}}}
test listbox-12.3 {ChangeListboxOffset procedure} {fonts} {
.l xview 10
@@ -1499,7 +1497,7 @@ test listbox-12.3 {ChangeListboxOffset procedure} {fonts} {
set log {}
.l xview 10
update
- list [.l xview] $log
+ list [format {%.6g %.6g} {*}[.l xview]] $log
} {{0.1 0.2} {}}
catch {destroy .l}
@@ -1516,7 +1514,7 @@ test listbox-13.1 {ListboxScanTo procedure} {fonts} {
.l scan mark 10 20
.l scan dragto [expr 10-$width] [expr 20-$height]
update
- list [.l xview] [.l yview]
+ list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0.2 0.4} {0.5 0.75}}
test listbox-13.2 {ListboxScanTo procedure} {fonts} {
.l yview 5
@@ -1524,10 +1522,10 @@ test listbox-13.2 {ListboxScanTo procedure} {fonts} {
.l scan mark 10 20
.l scan dragto 20 40
update
- set x [list [.l xview] [.l yview]]
+ set x [list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]]
.l scan dragto [expr 20-$width] [expr 40-$height]
update
- lappend x [.l xview] [.l yview]
+ lappend x [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0 0.2} {0 0.25} {0.2 0.4} {0.5 0.75}}
test listbox-13.3 {ListboxScanTo procedure} {fonts} {
.l yview moveto 1.0
@@ -1535,10 +1533,10 @@ test listbox-13.3 {ListboxScanTo procedure} {fonts} {
.l scan mark 10 20
.l scan dragto 5 10
update
- set x [list [.l xview] [.l yview]]
+ set x [list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]]
.l scan dragto [expr 5+$width] [expr 10+$height]
update
- lappend x [.l xview] [.l yview]
+ lappend x [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0.8 1} {0.75 1} {0.64 0.84} {0.25 0.5}}
test listbox-14.1 {NearestListboxElement procedure, partial last line} {
@@ -1723,7 +1721,7 @@ test listbox-18.3 {ListboxUpdateVScrollbar procedure} {
set x
} {{{invalid command name "gorp"}} {invalid command name "gorp"
while executing
-"gorp 0 1"
+"gorp 0.0 1.0"
(vertical scrolling command executed by listbox)}}
if {[info exists bgerror]} {
rename bgerror {}
@@ -1755,7 +1753,7 @@ test listbox-19.2 {ListboxUpdateVScrollbar procedure} {
set x
} {{{invalid command name "bogus"}} {invalid command name "bogus"
while executing
-"bogus 0 1"
+"bogus 0.0 1.0"
(horizontal scrolling command executed by listbox)}}
set l [interp hidden]
@@ -1877,7 +1875,7 @@ test listbox-21.12 {ListboxListVarProc, cleanup item attributes} {
set x [list 0 1 2 3 4 5 6]
.l itemcget end -fg
} {}
-test listbox-21.12 {ListboxListVarProc, cleanup item attributes} {
+test listbox-21.12a {ListboxListVarProc, cleanup item attributes} {
catch {destroy .l}
set x [list a b c d e f g]
listbox .l -listvar x
@@ -1925,12 +1923,12 @@ test listbox-21.16 {ListboxListVarProc, update vertical scrollbar} {
.l yview scroll 3 units
update
set result {}
- lappend result [.l yview]
+ lappend result [format {%.6g %.6g} {*}[.l yview]]
set x [lreplace $x 3 3]
set x [lreplace $x 3 3]
set x [lreplace $x 3 3]
update
- lappend result [.l yview]
+ lappend result [format {%.6g %.6g} {*}[.l yview]]
set result
} [list {0.5 1} {0 1}]
@@ -2043,7 +2041,7 @@ test listbox-24.3 {itemcget} {
catch {.l itemcget 0} result
set result
} {wrong # args: should be ".l itemcget index option"}
-test listbox-24.3 {itemcget, itemcg shortcut} {
+test listbox-24.4 {itemcget, itemcg shortcut} {
catch {destroy .l}
listbox .l
.l insert end a b c d
@@ -2127,20 +2125,25 @@ test listbox-27.1 {widget deletion while active} {
} 0
test listbox-28.1 {listbox -activestyle} {
- catch {destroy .l}
+ destroy .l
listbox .l -activ non
.l cget -activestyle
} none
-test listbox-28.2 {listbox -activestyle} {
- catch {destroy .l}
+test listbox-28.2-nonwin {listbox -activestyle} {nonwin} {
+ destroy .l
+ listbox .l
+ .l cget -activestyle
+} dotbox
+test listbox-28.2-win {listbox -activestyle} {win} {
+ destroy .l
listbox .l
.l cget -activestyle
} underline
test listbox-28.3 {listbox -activestyle} {
- catch {destroy .l}
- listbox .l -activestyle dot
+ destroy .l
+ listbox .l -activestyle und
.l cget -activestyle
-} dotbox
+} underline
test listbox-29.1 {listbox selection behavior, -state disabled} {
destroy .l
@@ -2160,5 +2163,5 @@ deleteWindows
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/macEmbed.test b/tests/macEmbed.test
deleted file mode 100644
index 81757fc..0000000
--- a/tests/macEmbed.test
+++ /dev/null
@@ -1,267 +0,0 @@
-# This file is a Tcl script to test out the procedures in the file
-# tkMacEmbed.c. It is organized in the standard fashion for Tcl
-# tests.
-#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# All rights reserved.
-
-package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
-tcltest::loadTestedCommands
-
-test macEmbed-1.1 {TkpUseWindow procedure, bad window identifier} {macOnly} {
- catch {destroy .t}
- list [catch {toplevel .t -use xyz} msg] $msg
-} {1 {expected integer but got "xyz"}}
-test macEmbed-1.2 {TkpUseWindow procedure, bad window identifier} {macOnly} {
- catch {destroy .t}
- list [catch {toplevel .t -use 47} msg] $msg
-} {1 {The window ID 47 does not correspond to a valid Tk Window.}}
-
-test macEmbed-1.3 {TkpUseWindow procedure, creating Container records} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- frame .f2 -container 1 -width 200 -height 50
- pack .f1 .f2
- set w [winfo id .f1]
- toplevel .t -use $w
- list [testembed] [expr [lindex [lindex [testembed all] 1] 0] - $w]
-} {{{XXX .f2 {} {}} {XXX .f1 XXX .t}} 0}
-test macEmbed-1.4 {TkpUseWindow procedure, creating Container records} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- frame .f2 -container 1 -width 200 -height 50
- pack .f1 .f2
- set w1 [winfo id .f1]
- set w2 [winfo id .f2]
- toplevel .t1 -use $w1
- toplevel .t2 -use $w2
- testembed
-} {{XXX .f2 XXX .t2} {XXX .f1 XXX .t1}}
-
-# Can't think of any way to test the procedures TkpMakeWindow,
-# TkpMakeContainer, or EmbedErrorProc.
-
-test macEmbed-2.1 {EmbeddedEventProc procedure} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- toplevel .t1 -use $w1
- testembed
- destroy .t1
- update
- testembed
-} {}
-test macEmbed-2.2 {EmbeddedEventProc procedure} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- toplevel .t1 -use [winfo id .f1]
- update
- destroy .f1
- testembed
-} {}
-test macEmbed-2.3 {EmbeddedEventProc procedure} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- toplevel .t1 -use [winfo id .f1]
- update
- destroy .t1
- update
- list [testembed] [winfo children .]
-} {{} {}}
-
-test macEmbed-3.1 {EmbeddedEventProc procedure, detect creation} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- set x [testembed]
- toplevel .t1 -use $w1
- wm withdraw .t1
- list $x [testembed]
-} {{{XXX .f1 {} {}}} {{XXX .f1 XXX .t1}}}
-test macEmbed-3.2 {EmbeddedEventProc procedure, disallow position changes} \
- {macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- toplevel .t1 -use $w1 -bd 2 -relief raised
- update
- wm geometry .t1 +30+40
- update
- wm geometry .t1
-} {200x200+0+0}
-test macEmbed-3.3 {EmbeddedEventProc procedure, disallow position changes} \
- {macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- toplevel .t1 -use $w1
- update
- wm geometry .t1 300x100+30+40
- update
- wm geometry .t1
-} {300x100+0+0}
-test macEmbed-3.4 {EmbeddedEventProc procedure, geometry requests} {macOnly} {
- deleteWindows
- toplevel .t1 -container 1 -width 200 -height 50
- set w1 [winfo id .t1]
- toplevel .t2 -use $w1
- update
- .t1 configure -width 300 -height 80
- update
- list [winfo width .t1] [winfo height .t1] [wm geometry .t2]
-} {300 80 300x80+0+0}
-test macEmbed-3.5 {EmbeddedEventProc procedure, map requests} {macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- toplevel .t1 -use $w1
- set x unmapped
- bind .t1 <Map> {set x mapped}
- update
- after 100
- update
- set x
-} {mapped}
-test macEmbed-3.6 {EmbeddedEventProc procedure, destroy events} {macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- bind .f1 <Destroy> {set x dead}
- set x alive
- toplevel .t1 -use $w1
- update
- destroy .t1
- update
- list $x [winfo exists .f1]
-} {dead 0}
-
-test macEmbed-4.1 {EmbedStructureProc procedure, configure events} {macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- toplevel .t1 -use $w1
- update
- .t1 configure -width 180 -height 100
- update
- winfo geometry .t1
-} {180x100+0+0}
-test macEmbed-4.2 {EmbedStructureProc procedure, destroy events} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- toplevel .t1 -use $w1
- update
- set x [testembed]
- destroy .f1
- list $x [testembed]
-} {{{XXX .f1 XXX .t1}} {}}
-
-# Can't think up any tests for TkpGetOtherWindow procedure.
-
-test unixEmbed-5.1 {TkpClaimFocus procedure} {macOnly tempNotMac} {
- catch {interp delete child}
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- frame .f2 -width 200 -height 50
- pack .f1 .f2
- interp create child
- child eval "set argv {-use [winfo id .f1]}"
- load {} Tk child
- child eval {
- . configure -bd 2 -highlightthickness 2 -relief sunken
- }
- focus -force .f2
- update
- list [child eval {
- focus .
- set x [list [focus]]
- update
- lappend x [focus]
- }] [focus]
-} {{{} .} .f1}
-catch {interp delete child}
-
-test macEmbed-6.1 {EmbedWindowDeleted procedure, check parentPtr} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- frame .f2 -container 1 -width 200 -height 50
- frame .f3 -container 1 -width 200 -height 50
- frame .f4 -container 1 -width 200 -height 50
- pack .f1 .f2 .f3 .f4
- set x {}
- lappend x [testembed]
- foreach w {.f3 .f4 .f1 .f2} {
- destroy $w
- lappend x [testembed]
- }
- set x
-} {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}}
-test macEmbed-6.2 {EmbedWindowDeleted procedure, check embeddedPtr} {testembed macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- set w1 [winfo id .f1]
- toplevel .t1 -use $w1 -highlightthickness 2 -bd 2 -relief sunken
- set x {}
- lappend x [testembed]
- destroy .t1
- update
- lappend x [testembed]
-} {{{XXX .f1 XXX .t1}} {}}
-
-test macEmbed-7.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} {macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- toplevel .t1 -use [winfo id .f1] -width 150 -height 80
- update
- wm geometry .t1 +40+50
- update
- wm geometry .t1
-} {150x80+0+0}
-test macEmbed-7.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} {macOnly} {
- deleteWindows
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
- toplevel .t1 -use [winfo id .f1] -width 150 -height 80
- update
- wm geometry .t1 70x300+10+20
- update
- wm geometry .t1
-} {70x300+0+0}
-
-
-
-deleteWindows
-
-# cleanup
-::tcltest::cleanupTests
-return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/macFont.test b/tests/macFont.test
deleted file mode 100644
index 88c1a96..0000000
--- a/tests/macFont.test
+++ /dev/null
@@ -1,284 +0,0 @@
-# This file is a Tcl script to test out the procedures in tkMacFont.c.
-# It is organized in the standard fashion for Tcl tests.
-#
-# Some of these tests are visually oriented and cannot be checked
-# programmatically (such as "does an underlined font appear to be
-# underlined?"); these tests attempt to exercise the code in question,
-# but there are no results that can be checked.
-#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# All rights reserved.
-
-package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
-tcltest::loadTestedCommands
-
-catch {destroy .b}
-toplevel .b
-update idletasks
-
-set courier {Courier 12}
-set cx [font measure $courier 0]
-
-set fixed {Monaco 12}
-label .b.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left -text "0" -font $fixed
-pack .b.l
-canvas .b.c -closeenough 0
-
-set t [.b.c create text 0 0 -anchor nw -just left -font $courier]
-pack .b.c
-update
-
-set ax [winfo reqwidth .b.l]
-set ay [winfo reqheight .b.l]
-proc getsize {} {
- update
- return "[winfo reqwidth .b.l] [winfo reqheight .b.l]"
-}
-
-testConstraint gothic 0
-set gothic {gothic 12}
-set mx [font measure $gothic \u4e4e]
-if {[font actual $gothic -family] != [font actual system -family]} {
- testConstraint gothic 1
-}
-
-test macFont-1.1 {TkpFontPkgInit} {macOnly} {
-} {}
-
-test macfont-2.1 {TkpGetNativeFont: not native} {macOnly} {
- list [catch {font measure {} xyz} msg] $msg
-} {1 {font "" doesn't exist}}
-test macFont-2.2 {TkpGetNativeFont: native} {macOnly} {
- font measure system "0"
- font measure application "0"
- set x {}
-} {}
-
-test macFont-3.1 {TkpGetFontFromAttributes: no family} {macOnly} {
- font actual {-underline 1} -family
-} [font actual system -family]
-test macFont-3.2 {TkpGetFontFromAttributes: long family name} {macOnly} {
- set x "12345678901234567890123456789012345678901234567890"
- set x "$x$x$x$x$x$x"
- font actual "-family $x" -family
-} [font actual system -family]
-test macFont-3.3 {TkpGetFontFromAttributes: family} {macOnly} {
- font actual {-family Courier} -family
-} {Courier}
-test macFont-3.4 {TkpGetFontFromAttributes: Times fonts} {macOnly} {
- set x {}
- lappend x [font actual {-family "Times"} -family]
- lappend x [font actual {-family "Times New Roman"} -family]
-} {Times Times}
-test macFont-3.5 {TkpGetFontFromAttributes: Courier fonts} {macOnly} {
- set x {}
- lappend x [font actual {-family "Courier"} -family]
- lappend x [font actual {-family "Courier New"} -family]
-} {Courier Courier}
-test macFont-3.6 {TkpGetFontFromAttributes: Helvetica fonts} {macOnly} {
- set x {}
- lappend x [font actual {-family "Geneva"} -family]
- lappend x [font actual {-family "Helvetica"} -family]
- lappend x [font actual {-family "Arial"} -family]
-} {Geneva Helvetica Helvetica}
-test macFont-3.7 {TkpGetFontFromAttributes: try aliases} {macOnly} {
- font actual {arial 10} -family
-} {Helvetica}
-test macFont-3.8 {TkpGetFontFromAttributes: try fallbacks} {macOnly} {
- font actual {{ms sans serif} 10} -family
-} {Chicago}
-test macFont-3.9 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-weight normal} -weight
-} {normal}
-test macFont-3.10 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-weight bold} -weight
-} {bold}
-test macFont-3.11 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-slant roman} -slant
-} {roman}
-test macFont-3.12 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-slant italic} -slant
-} {italic}
-test macFont-3.13 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-underline false} -underline
-} {0}
-test macFont-3.14 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-underline true} -underline
-} {1}
-test macFont-3.15 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-overstrike false} -overstrike
-} {0}
-test macFont-3.16 {TkpGetFontFromAttributes: styles} {macOnly} {
- font actual {-overstrike true} -overstrike
-} {0}
-
-test macFont-4.1 {TkpDeleteFont} {macOnly} {
- font actual {-family xyz}
- set x {}
-} {}
-
-test macFont-5.1 {TkpGetFontFamilies} {macOnly} {
- expr {[lsearch [font families] Geneva] > 0}
-} {1}
-
-test macFont-6.1 {TkpGetSubFonts} {testfont gothic macOnly} {
- .b.l config -text "abc\u4e4e"
- update
- set x [testfont subfonts $fixed]
-} "Monaco [font actual $gothic -family]"
-
-test macFont-7.1 {Tk_MeasureChars: unbounded right margin} {macOnly} {
- .b.l config -wrap 0 -text "000000"
- getsize
-} "[expr $ax*6] $ay"
-test macFont-7.2 {Tk_MeasureChars: static width buffer exceeded} {macOnly} {
- .b.l config -wrap 100000 -text "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
- getsize
-} "[expr $ax*256] $ay"
-test macFont-7.3 {Tk_MeasureChars: all chars did fit} {macOnly} {
- .b.l config -wrap [expr $ax*10] -text "00000000"
- getsize
-} "[expr $ax*8] $ay"
-test macFont-7.4 {Tk_MeasureChars: not all chars fit} {macOnly} {
- .b.l config -wrap [expr $ax*6] -text "00000000"
- getsize
-} "[expr $ax*6] [expr $ay*2]"
-test macFont-7.5 {Tk_MeasureChars: already saw space in line} {macOnly} {
- .b.l config -wrap [expr $ax*12] -text "000000 0000000"
- getsize
-} "[expr $ax*7] [expr $ay*2]"
-test macFont-7.6 {Tk_MeasureChars: internal spaces significant} {macOnly} {
- .b.l config -wrap [expr $ax*12] -text "000 00 00000"
- getsize
-} "[expr $ax*7] [expr $ay*2]"
-test macFont-7.7 {Tk_MeasureChars: include last partial char} {macOnly} {
- .b.c dchars $t 0 end
- .b.c insert $t 0 "0000"
- .b.c index $t @[expr int($ax*2.5)],1
-} {2}
-test macFont-7.8 {Tk_MeasureChars: at least one char on line} { macOnly} {
- .b.l config -text "000000" -wrap 1
- getsize
-} "$ax [expr $ay*6]"
-test macFont-7.9 {Tk_MeasureChars: whole words} {macOnly} {
- .b.l config -wrap [expr $ax*8] -text "000000 0000"
- getsize
-} "[expr $ax*6] [expr $ay*2]"
-test macFont-7.10 {Tk_MeasureChars: make first part of word fit} {macOnly} {
- .b.l config -wrap [expr $ax*12] -text "0000000000000000"
- getsize
-} "[expr $ax*12] [expr $ay*2]"
-test macFont-7.11 {Tk_MeasureChars: numBytes == 0} {macOnly} {
- font measure system {}
-} {0}
-test macFont-7.12 {Tk_MeasureChars: maxLength < 0} {macOnly} {
- font measure $courier abcd
-} "[expr $cx*4]"
-test macFont-7.13 {Tk_MeasureChars: loop on each char} {macOnly} {
- font measure $courier abcd
-} "[expr $cx*4]"
-test macFont-7.14 {Tk_MeasureChars: p == end} {macOnly} {
- font measure $courier abcd
-} "[expr $cx*4]"
-test macFont-7.15 {Tk_MeasureChars: p > end} {macOnly} {
- font measure $courier abc\xc2
-} "[expr $cx*4]"
-test macFont-7.16 {Tk_MeasureChars: thisFamilyPtr != lastFamilyPtr} {gothic macOnly} {
- font measure $courier abc\u4e4edef
-} [expr $cx*6+$mx]
-test macFont-7.17 {Tk_MeasureChars: measure no chars (in loop)} {gothic macOnly} {
- font measure $courier \u4e4edef
-} [expr $mx+$cx*3]
-test macFont-7.18 {Tk_MeasureChars: final measure} {gothic macOnly} {
- font measure $courier \u4e4edef
-} [expr $mx+$cx*3]
-test macFont-7.19 {Tk_MeasureChars: final measure (no chars)} {gothic macOnly} {
- font measure $courier \u4e4e
-} [expr $mx]
-test macFont-7.20 {Tk_MeasureChars: maxLength >= 0} {macOnly} {
- .b.l config -wrap [expr $ax*8] -text "000"
- getsize
-} "[expr $ax*3] $ay"
-test macFont-7.21 {Tk_MeasureChars: loop on each char} {macOnly} {
- .b.l config -wrap [expr $ax*8] -text "000"
- getsize
-} "[expr $ax*3] $ay"
-test macFont-7.22 {Tk_MeasureChars: p == end} {macOnly} {
- .b.l config -wrap [expr $ax*8] -text "000"
- getsize
-} "[expr $ax*3] $ay"
-test macFont-7.23 {Tk_MeasureChars: p > end} {macOnly} {
- .b.l config -wrap [expr $ax*8] -text "00\xc2"
- getsize
-} "[expr $ax*3] $ay"
-test macFont-7.24 {Tk_MeasureChars: thisFamilyPtr != lastFamilyPtr} {gothic macOnly} {
- .b.l config -wrap [expr $ax*8] -text "00\u4e4e00"
- getsize
-} "[expr $ax*4+$mx] $ay"
-test macFont-7.25 {Tk_MeasureChars: measure no chars (in loop)} {gothic macOnly} {
- .b.l config -wrap [expr $ax*8] -text "\u4e4e00"
- getsize
-} "[expr $mx+$ax*2] $ay"
-test macFont-7.26 {Tk_MeasureChars: rest == NULL} {gothic macOnly} {
- .b.l config -wrap [expr $ax*20] -text "000000\u4e4e\u4e4e00"
- getsize
-} "[expr $ax*8+$mx*2] $ay"
-test macFont-7.27 {Tk_MeasureChars: rest != NULL in first segment} {gothic macOnly} {
- .b.l config -wrap [expr $ax*5] -text "000000\u4e4e\u4e4f00"
- getsize
-} "[expr $ax*5] [expr $ay*3]"
-test macFont-7.28 {Tk_MeasureChars: rest != NULL in next segment} {gothic macOnly} {
- # even some of the "0"s would fit after \u4e4d, they should all wrap to next line.
- .b.l config -wrap [expr $ax*8] -text "\u4e4d\u4e4d000000\u4e4e\u4e4f00"
- getsize
-} "[expr $ax*6+$mx] [expr $ay*3]"
-test macFont-7.29 {Tk_MeasureChars: final measure} {gothic macOnly} {
- .b.l config -wrap [expr $ax*8] -text "\u4e4e00"
- getsize
-} "[expr $mx+$ax*2] $ay"
-test macFont-7.30 {Tk_MeasureChars: final measure (no chars)} {gothic macOnly} {
- .b.l config -wrap [expr $ax*8] -text "\u4e4e"
- getsize
-} "$mx $ay"
-test macFont-7.31 {Tk_MeasureChars: rest == NULL} {macOnly} {
- .b.l config -wrap [expr $ax*1000] -text 0000
- getsize
-} "[expr $ax*4] $ay"
-test macFont-7.32 {Tk_MeasureChars: rest != NULL} {macOnly} {
- .b.l config -wrap [expr $ax*6] -text "00000000"
- getsize
-} "[expr $ax*6] [expr $ay*2]"
-
-test macFont-8.1 {Tk_DrawChars procedure} {macOnly} {
- .b.l config -text "a"
- update
-} {}
-
-test macFont-9.1 {AllocMacFont: use old font} {macOnly} {
- font create xyz
- button .c -font xyz
- font configure xyz -family times
- update
- destroy .c
- font delete xyz
-} {}
-test macFont-9.2 {AllocMacFont: extract info from style} {macOnly} {
- font actual {Monaco 9 bold italic underline overstrike}
-} {-family Monaco -size 9 -weight bold -slant italic -underline 1 -overstrike 0}
-test macFont-9.3 {AllocMacFont: extract text metrics} {macOnly} {
- font metric {Geneva 10} -fixed
-} {0}
-test macFont-9.4 {AllocMacFont: extract text metrics} {macOnly} {
- font metric "Monaco 9" -fixed
-} {1}
-
-destroy .b
-
-# cleanup
-::tcltest::cleanupTests
-return
diff --git a/tests/macMenu.test b/tests/macMenu.test
deleted file mode 100644
index 0de0f51..0000000
--- a/tests/macMenu.test
+++ /dev/null
@@ -1,1547 +0,0 @@
-# This file is a Tcl script to test menus in Tk. It is
-# organized in the standard fashion for Tcl tests. This
-# file tests the Macintosh-specific features of the menu
-# system.
-#
-# Copyright (c) 1995-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# All rights reserved.
-
-package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
-tcltest::loadTestedCommands
-
-test macMenu-1.0 {TkMacUseMenuID} {macOnly} {
- # Can't really test TkMacUseMenuID; it's only called on startup.
-} {}
-
-test macMenu-2.1 {GetNewID} {macOnly} {
- catch {destroy .m1}
- list [catch {menu .m1} msg] $msg [destroy .m1]
-} {0 .m1 {}}
-test macMenu-2.2 {GetNewID - cascade menu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m2
- list [catch {menu .m2} msg] $msg [destroy .m1] [destroy .m2]
-} {0 .m2 {} {}}
-test macMenu-2.3 {GetNewID - running out of ids} {macOnly} {
- deleteWindows
- menu .menu
- for {set i 0} {$i < 230} {incr i} {
- menu .m$i
- .menu add cascade -label ".m$i" -menu .m$i
- }
- menu .breaker
- list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows]
-} {1 {No more menus can be allocated.} {}}
-
-test macMenu-3.1 {FreeID} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {destroy .m1} msg] $msg
-} {0 {}}
-
-# No way to test running out of ids in TkpNewPlatformMenu
-test macMenu-4.1 {TkpNewMenu} {macOnly} {
- catch {destroy .m1}
- list [catch {menu .m1} msg] $msg [catch {destroy .m1} msg2] $msg2
-} {0 .m1 0 {}}
-test macMenu-4.2 {TkpNewMenu - checking for help menu when one is there} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- menu .m1
- menu .m1.help -tearoff 0
- .m1.help add command -label Test
- . configure -menu .m1
- raise .
- update
- list [catch {menu .m2} msg] $msg [destroy .m1] [destroy .m2] [. configure -menu ""]
-} {0 .m2 {} {} {}}
-test macMenu-4.3 {TkpNewMenu - menubar set but different interp} {macOnly} {
- catch {interp delete testinterp}
- catch {destroy .m1}
- interp create testinterp
- load {} Tk testinterp
- interp eval testinterp {raise .}
- interp eval testinterp {menu .m1}
- interp eval testinterp {. configure -menu .m1}
- interp eval testinterp {update}
- list [catch {menu .m1} msg] $msg [destroy .m1] [interp delete testinterp]
-} {0 .m1 {} {}}
-test macMenu-4.4 {TkpNewMenu - menubar set but new menu has different parent} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- menu .m1 -tearoff 0
- .m1 add cascade -menu .m1.help
- menu .m2
- .m2 add cascade -menu .m2.help
- . configure -menu .m1
- raise .
- update
- list [catch {menu .m2.help} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .m2]
-} {0 .m2.help {} {} {}}
-test macMenu-4.5 {TkpNewMenu - menubar set, same parent, not .help} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add cascade -menu .m1.help
- . configure -menu .m1
- raise .
- update
- list [catch {menu .m1.foo} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 .m1.foo {} {}}
-test macMenu-4.6 {TkpNewMenu - creating the help menu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add cascade -menu .m1.help
- . configure -menu .m1
- raise .
- update
- list [catch {menu .m1.help} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 .m1.help {} {}}
-
-test macMenu-5.1 {TkpDestroyMenu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {destroy .m1} msg] $msg
-} {0 {}}
-test macMenu-5.2 {TkpDestroyMenu - help menu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add cascade -menu .m1.help
- . configure -menu .m1
- menu .m1.help
- raise .
- update
- list [catch {destroy .m1.help} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-5.3 {TkpDestroyMenu - idle handler pending} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label test
- list [catch {destroy .m1} msg] $msg
-} {0 {}}
-test macMenu-5.4 {TkpDestroyMenu - idle handler not pending} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label test
- update idletasks
- list [catch {destroy .m1} msg] $msg
-} {0 {}}
-
-test macMenu-6.1 {SetMenuCascade} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- menu .m1
- menu .m2
- list [catch {.m2 add cascade -menu .m1} msg] $msg [destroy .m1 .m2]
-} {0 {} {}}
-test macMenu-6.2 {SetMenuCascade - running out of ids} {macOnly} {
- deleteWindows
- menu .menu
- for {set i 0} {$i < 230} {incr i} {
- menu .m$i
- .menu add cascade -label ".m$i" -menu .m$i
- }
- menu .breaker
- list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows]
-} {1 {No more menus can be allocated.} {}}
-
-test macMenu-7.1 {TkpDestroyMenuEntry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "test"
- list [catch {.m1 delete 1} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-7.2 {TkpDestroyMenuEntry - help menu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.help
- menu .m1.help -tearoff 0
- .m1.help add command -label "test"
- . configure -menu .m1
- raise .
- update
- list [catch {.m1.help delete test} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-
-test macMenu-8.1 {GetEntryText} {macOnly} {
- catch {destroy .m1}
- list [catch {menu .m1} msg] $msg [destroy .m1]
-} {0 .m1 {}}
-test macMenu-8.2 {GetEntryText} {macOnly testImageType} {
- catch {destroy .m1}
- catch {image delete image1}
- menu .m1
- image create test image1
- list [catch {.m1 add command -image image1} msg] $msg [destroy .m1] [image delete image1]
-} {0 {} {} {}}
-test macMenu-8.3 {GetEntryText} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -bitmap questhead} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.4 {GetEntryText} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.5 {GetEntryText} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "foo"
- list [catch {.m1 add command -label "foo"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.6 {GetEntryText} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label "This is a very long string. 9012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890"} \
- msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.7 {GetEntryText - elipses character} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label "foo..."} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.8 {GetEntryText - false elipses character} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label "foo."} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.9 {GetEntryText - false elipses character} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label "foo.."} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.10 {GetEntryText - false elipses character} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label "foo.b"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-8.11 {GetEntryText - false elipses character} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label "foo..b"} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-
-# test macMenu-9.1 - assumes some fonts
-test macMenu-9.1 {FindMarkCharacter} {macOnly} {
- catch {destroy .m1}
- menu .m1 -font "Helvetica 12" -tearoff 0
- .m1 add checkbutton -label test
- .m1 invoke test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-# All standard fonts have "¥" defined. We can't test further.
-
-test macMenu-10.1 {SetMenuIndicator - cascade entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add cascade -label foo} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-10.2 {SetMenuIndicator - not radio or checkbutton} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label foo} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-10.3 {SetMenuIndicator - indiatorOn false} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add checkbutton -label foo -indicatoron 0} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-10.4 {SetMenuIndicator - entry not selected} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add checkbutton -label foo} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-10.5 {SetMenuIndicator - checkbutton} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label foo
- list [catch {.m1 invoke foo} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-10.6 {SetMenuIndicator - radio button} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add radiobutton -label foo
- list [catch {.m1 invoke foo} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-test macMenu-11.1 {SetMenuTitle} {macOnly} {
- catch {destroy .m1}
- catch {destroy .container}
- menu .container
- menu .m1
-#previous title is .m1
- .container add cascade -label "File" -menu .m1
- list [catch {. configure -menu .container} msg] $msg [. configure -menu ""] [destroy .container .m1]
-} {0 {} {} {}}
-test macMenu-11.2 {SetMenuTitle} {macOnly} {
- menu .container
- menu .m1
- . configure -menu ""
-#previous title is .m1
- .container add cascade -label "F" -menu .m1
- list [catch {. configure -menu .container} msg] $msg [. configure -menu ""] [destroy .container .m1]
-} {0 {} {} {}}
-
-test macMenu-12.1 {TkpConfigureMenuEntry} {macOnly} {
- catch {destroy .m1}
- . configure -menu ""
- menu .m1
- .m1 add cascade -menu .m3
- list [catch {.m1 entryconfigure 1 -menu .m2} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.2 {TkpConfigureMenuEntry} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- . configure -menu ""
- menu .m1
- .m1 add cascade -menu .m3
- menu .m2
- list [catch {.m1 entryconfigure 1 -menu .m2} msg] $msg [destroy .m1 .m2]
-} {0 {} {}}
-test macMenu-12.3 {TkpConfigureMenuEntry - running out of ids} {macOnly} {
- deleteWindows
- menu .menu
- for {set i 0} {$i < 230} {incr i} {
- menu .m$i
- .menu add cascade -label ".m$i" -menu .m$i
- }
- menu .breaker
- list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows]
-} {1 {No more menus can be allocated.} {}}
-test macMenu-12.4 {TkpConfigureMenuEntry - Control} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Control+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.5 {TkpConfigureMenuEntry - Ctrl} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Ctrl+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.6 {TkpConfigureMenuEntry - Shift} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Shift+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.7 {TkpConfigureMenuEntry - Option} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Opt+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.8 {TkpConfigureMenuEntry - Command} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Command+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.9 {TkpConfigureMenuEntry - Cmd} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Cmd+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.10 {TkpConfigureMenuEntry - Alt} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Alt+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.11 {TkpConfigureMenuEntry - Meta} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Meta+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.12 {TkpConfigureMenuEntry - Two modifiers} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Cmd+Shift+S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.13 {TkpConfigureMenuEntry - dash instead of plus} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -accel "Command-S"} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.14 {TkpConfigureMenuEntry - idler pending} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label test
- list [catch {.m1 entryconfigure test -label test2} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-12.15 {TkpConfigureMenuEntry - idler not pending} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label test
- update idletasks
- list [catch {.m1 entryconfigure test -label test2} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-test macMenu-13.1 {ReconfigureIndividualMenu - getting rid of zero items} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.2 {ReconfigureIndividualMenu - getting rid of one item} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label test
- update idletasks
- .m1 delete test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.3 {ReconfigureIndividualMenu - getting rid of more than one} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label test
- .m1 add command -label test2
- update idletasks
- .m1 entryconfigure test2 -label "test two"
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.4 {ReconfigureIndividualMenu - separator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add separator
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.5 {ReconfigureIndividualMenu - disabled} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command
- .m1 entryconfigure 1 -state disabled
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.6 {ReconfigureIndividualMenu - active} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command
- .m1 entryconfigure 1 -state active
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.7 {ReconfigureIndividualMenu - checkbutton not checked} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.8 {ReconfigureIndividualMenu - checkbutton - indicator off} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label test -indicatoron 0
- .m1 invoke test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.9 {ReconfigureIndividualMenu - checkbutton on} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label test
- .m1 invoke test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.10 {ReconfigureIndividualMenu - radiobutton not checked} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add radiobutton -label test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.11 {ReconfigureIndividualMenu - radiobutton - indicator off} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add radiobutton -label test -indicatoron 0
- .m1 invoke test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.12 {ReconfigureIndividualMenu - radiobutton on} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add radiobutton -label test
- .m1 invoke test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.13 {ReconfigureIndividualMenu} {macOnly} {
- catch {destroy .m1}
- . configure -menu ""
- menu .m1
- .m1 add cascade -menu .m3
- .m1 entryconfigure 1 -menu .m2
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.14 {ReconfigureIndividualMenu} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- . configure -menu ""
- menu .m1
- .m1 add cascade -menu .m3
- menu .m2
- .m1 entryconfigure 1 -menu .m2
- list [catch {update idletasks} msg] $msg [destroy .m1 .m2]
-} {0 {} {}}
-test macMenu-13.15 {ReconfigureIndividualMenu - accelerator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -accel "Command-S"
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.16 {ReconfigureIndividualMenu - parent is disabled} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -label .m1.edit -label "Edit" -state disabled
- menu .m1.edit
- .m1.edit add command -label foo
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-13.17 {ReconfigureIndividualMenu - disabling parent} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -label .m1.edit -label Edit
- menu .m1.edit
- .m1.edit add command -label foo
- .m1 entryconfigure Edit -state disabled
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-test macMenu-14.1 {ReconfigureMacintoshMenu - normal menu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label test
- list [catch {update idletasks} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-14.2 {ReconfigureMacintoshMenu - apple menu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.apple
- menu .m1.apple -tearoff 0
- .m1.apple add command -label test
- . configure -menu .m1
- raise .
- list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-14.3 {ReconfigureMacintoshMenu - help menu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.help
- menu .m1.help -tearoff 0
- .m1.help add command -label test
- . configure -menu .m1
- raise .
- list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-14.4 {ReconfigureMacintoshMenu - menubar} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.file -label "foo"
- menu .m1.file
- . configure -menu .m1
- raise .
- .m1 entryconfigure foo -label "File"
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-
-test macMenu-15.1 {CompleteIdlers - no idle pending} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label test
- update idletasks
- list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-15.2 {CompleteIdlers - idle pending} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label test
- list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-15.3 {CompleteIdlers - recursive} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.m2 -label test
- menu .m1.m2
- .m1.m2 add command -label test
- list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-#Don't know how to generate nested post menus
-test macMenu-16.1 {TkpPostMenu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -postcommand "destroy .m1"
- list [catch {.m1 post 40 40} msg] $msg
-} {0 {}}
-test macMenu-16.2 {TkpPostMenu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -postcommand "blork"
- list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
-} {1 {invalid command name "blork"} {}}
-# We need to write the interactive test for menu posting.
-
-test macMenu-17.1 {TkpMenuNewEntry - no idle pending} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [catch {.m1 add command -label test} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-17.2 {TkpMenuNewEntry - idle pending} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label test
- list [catch {.m1 add command -label test2} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-test macMenu-18.1 {DrawMenuBarWhenIdle} {macOnly} {
- catch {destroy .m1}
- . configure -menu ""
- menu .m1
- . configure -menu .m1
- list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.2 {DrawMenuBarWhenIdle - clearing old apple menu out} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.apple
- menu .m1.apple
- .m1.apple add command -label test
- . configure -menu .m1
- raise .
- update
- . configure -menu ""
- raise .
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-18.3 {DrawMenuBarWhenIdle - clearing out old help menu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.help
- menu .m1.help
- .m1.help add command -label test
- . configure -menu .m1
- raise .
- update
- . configure -menu ""
- raise .
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-18.4 {DrawMenuBarWhenIdle - menu not there} {macOnly} {
- catch {destroy .m1}
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""]
-} {0 {} {}}
-test macMenu-18.5 {DrawMenuBarWhenIdle - menu there} {macOnly} {
- catch {destroy .m1}
- menu .m1
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.6 {DrawMenuBarWhenIdle - no apple menu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.7 {DrawMenuBarWhenIdle - apple menu references but not there} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.apple
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.8 {DrawMenuBarWhenIdle - apple menu there} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.apple
- menu .m1.apple
- .m1.apple add command -label test
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.9 {DrawMenuBarWhenIdle - apple menu there; no idle handler} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.apple
- menu .m1.apple
- .m1.apple add command -label test
- . configure -menu .m1
- raise .
- update idletasks
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.10 {DrawMenuBarWhenIdle - no help menu} {macOnly} {
- catch {destroy .m1}
- menu .m1
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.11 {DrawMenuBarWhenIdle - help menu referenced but not there} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.help
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.12 {DrawMenuBarWhenIdle - help menu there} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.help
- menu .m1.help
- .m1.help add command -label test
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.13 {DrawMenuBarWhenIdle - help menu there - no idlers} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.help
- menu .m1.help
- .m1.help add command -label test
- . configure -menu .m1
- raise .
- update idletasks
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-# Can't generate no menubar clone
-test macMenu-18.14 {DrawMenuBarWhenIdle - apple and help menus in tearoff menubar} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -menu .m1.apple
- .m1 add cascade -menu .m1.help
- menu .m1.apple
- menu .m1.help
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.15 {DrawMenuBarWhenIdle - apple and help menus in non-tearoff menubar} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add cascade -menu .m1.apple
- .m1 add cascade -menu .m1.help
- menu .m1.apple
- menu .m1.help
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.16 {DrawMenuBarWhenIdle - no apple menu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.17 {DrawMenuBarWhenIdle - apple menu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- . configure -menu .m1
- .m1 add cascade -menu .m1.apple
- menu .m1.apple
- .m1.apple add cascade -label test -menu .m1.apple.test
- menu .m1.apple.test
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.18 {DrawMenuBarWhenIdle - big for loop} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- menu .m1.apple -tearoff 0
- menu .m1.help -tearoff 0
- menu .m1.foo -tearoff 0
- .m1 add cascade -menu .m1.apple
- .m1 add cascade -menu .m1.help
- .m1 add cascade -label Foo -menu .m1.foo
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-18.19 {DrawMenuBarWhenIdle = disabled menu} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- menu .m1.edit -tearoff 0
- .m1 add cascade -menu .m1.edit -label Edit
- . configure -menu .m1
- raise .
- .m1 entryconfigure Edit -state disabled
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-
-test macMenu-19.1 {RecursivelyInsertMenu} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- catch {destroy .main}
- catch {destroy .t2}
- toplevel .t2 -menu .main
- wm geometry .t2 +0+0
- menu .main
- .main add cascade -menu .m1 -label ".m1"
- menu .m1
- .m1 add command -label "Test 2"
- .m1 add cascade -label ".m2" -menu .m2
- menu .m2
- .m2 add command -label "Test 3"
- list [catch {raise .t2} msg] $msg [destroy .t2 .main .m1 .m2]
-} {0 {} {}}
-test macMenu-19.2 {RecursivelyInsertMenu} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- catch {destroy .main}
- catch {destroy .t2}
- toplevel .t2 -menu .main
- wm geometry .t2 +0+0
- menu .main
- .main add cascade -menu .m1 -label ".m1"
- menu .m1
- .m1 add command -label "Test 2"
- .m1 add cascade -label ".m2" -menu .m2
- menu .m2
- .m2 add command -label "Test 3"
- list [catch {raise .t2} msg] $msg [destroy .t2 .main .m1 .m2]
-} {0 {} {}}
-
-test macMenu-20.1 {SetDefaultMenuBar} {macOnly} {
- . configure -menu ""
- raise .
- list [catch {update} msg] $msg
-} {0 {}}
-
-test macMenu-21.1 {TkpSetMainMenubar - not front window} {macOnly} {
- catch {destroy .m1}
- catch {destroy .t2}
- toplevel .t2
- wm geometry .t2 +50+50
- menu .m1
- raise .
- update
- list [catch {.t2 configure -menu .m1} msg] $msg [destroy .t2] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-21.2 {TkpSetMainMenubar - menu null} {macOnly} {
- . configure -menu ""
- raise .
- list [catch {update} msg] $msg
-} {0 {}}
-test macMenu-21.3 {TkpSetMainMenubar - different interps} {macOnly} {
- catch {destroy .m1}
- catch {interp delete testinterp}
- interp create testinterp
- load {} Tk testinterp
- menu .m1
- . configure -menu .m1
- raise .
- update
- interp eval testinterp {menu .m1}
- interp eval testinterp {. configure -menu .m1}
- interp eval testinterp {raise .}
- list [catch {interp eval testinterp {update}} msg] $msg [interp delete testinterp] [. configure -menu ""] [destroy .m1]
-} {0 {} {} {} {}}
-test macMenu-21.4 {TkpSetMainMenubar - different windows} {macOnly} {
- catch {destroy .m1}
- catch {destroy .t2}
- menu .m1
- . configure -menu .m1
- toplevel .t2
- wm geometry .t2 +50+50
- .t2 configure -menu .m1
- raise .
- update
- raise .t2
- list [catch {update} msg] $msg [destroy .t2] [. configure -menu ""] [destroy .m1]
-} {0 {} {} {} {}}
-test macMenu-21.5 {TkpSetMainMenubar - old menu was null} {macOnly} {
- catch {destroy .m1}
- . configure -menu ""
- update
- menu .m1
- . configure -menu .m1
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-test macMenu-21.6 {TkpSetMainMenubar - old menu different} {macOnly} {
- catch {destroy .m1}
- catch {destroy .m2}
- menu .m1
- menu .m2
- . configure -menu .m1
- raise .
- update
- . configure -menu .m2
- raise .
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .m2]
-} {0 {} {} {} {}}
-test macMenu-21.7 {TkpSetMainMenubar - child window NULL - parent window now} {macOnly} {
- catch {destroy .m1}
- catch {destroy .t2}
- toplevel .t2
- menu .m1
- .m1 add cascade -label Foo -menu .m1.foo
- menu .m1.foo
- .m1.foo add command -label foo
- . configure -menu .m1
- raise .t2
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .t2]
-} {0 {} {} {} {}}
-test macMenu-21.8 {TkpSetMainMenubar - tearoff window} {macOnly} {
- catch {destroy .t2}
- toplevel .t2 -menu .t2.m1
- menu .t2.m1
- .t2.m1 add cascade -label File -menu .t2.m1.foo
- menu .t2.m1.foo
- .t2.m1.foo add command -label foo
- raise .t2
- tk::TearOffMenu .t2.m1.foo 100 100
- list [catch {update} msg] $msg [destroy .t2]
-} {0 {} {}}
-
-test macMenu-22.1 {TkSetWindowMenuBar} {macOnly} {
-} {}
-
-test macMenu-23.1 {TkMacDispatchMenuEvent} {macOnly} {
- # needs to be interactive.
-} {}
-
-test macMenu-24.1 {GetMenuIndicatorGeometry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label foo
- .m1 invoke foo
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-
-test macMenu-25.1 {GetMenuAccelGeometry - cascade entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -label foo
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.2 {GetMenuAccelGeometry - no accel} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.3 {GetMenuAccelGeometry - no special chars - arbitrary string} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -accel "Test"
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.4 {GetMenuAccelGeometry - Command} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Cmd+S"
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.5 {GetMenuAccelGeometry - Control} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Ctrl+S"
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.6 {GetMenuAccelGeometry - Shift} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Shift+S"
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.7 {GetMenuAccelGeometry - Option} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Opt+S"
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.8 {GetMenuAccelGeometry - Combination} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Cmd+Shift+S"
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-test macMenu-25.9 {GetMenuAccelGeometry - extra text} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Command+Delete"
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-
-test macMenu-26.1 {GetTearoffEntryGeometry} {macOnly} {
- # can't call this on power mac.
-} {}
-
-test macMenu-27.1 {GetMenuSeparatorGeometry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add separator
- list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
-} {0 {}}
-
-test macMenu-28.1 {DrawMenuEntryIndicator - non-checkbutton} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-28.2 {DrawMenuEntryIndicator - indicator off} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label foo -indicatoron 0
- .m1 invoke foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-28.3 {DrawMenuEntryIndicator - not selected} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-28.4 {DrawMenuEntryIndicator - checkbutton} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label foo
- .m1 invoke foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-28.5 {DrawMenuEntryIndicator - radiobutton} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add radiobutton -label foo
- .m1 invoke foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-# Cannot reproduce resources missing or color allocation failing easily.
-test macMenu-29.1 {DrawSICN} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Cmd+S"
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-# Cannot reproduce resources missing
-test macMenu-30.1 {DrawMenuEntryAccelerator - cascade entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-30.2 {DrawMenuEntryAccelerator - no accel string} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-30.3 {DrawMenuEntryAccelerator - random accel string} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-30.4 {DrawMenuEntryAccelerator - Command} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Cmd+S"
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-30.5 {DrawMenuEntryAccelerator - Option} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Opt+S"
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-30.6 {DrawMenuEntryAccelerator - Shift} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Shift+S"
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-30.7 {DrawMenuEntryAccelerator - Control} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Ctrl+S"
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-test macMenu-30.8 {DrawMenuEntryAccelerator - combination} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -accel "Cmd+Shift+S"
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-test macMenu-31.1 {DrawMenuSeparator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add separator
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-test macMenu-32.1 {TkpDrawMenuEntryLabel} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [catch {update} msg] $msg [destroy .m1]
-} {0 {} {}}
-
-test macMenu-33.1 {MenuDefProc - No way to test automatically.} {} {}
-test macMenu-34.1 {TkMacHandleTearoffMenu - no way to test automatically} {} {}
-test macMenu-35.1 {TkpInitializeMenuBindings - nothing to do} {} {}
-
-test macMenu-36.1 {TkpComputeMenubarGeometry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -label foo
- . configure -menu .m1
- list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
-} {0 {} {} {}}
-
-test macMenu-37.1 {DrawTearoffEntry - can't do automatically} {} {}
-test macMenu-38.1 {TkMacSetHelpMenuItemCount - called at boot time} {} {}
-test macMenu-39.1 {TkMacMenuClick - can't do automatically} {} {}
-
-test macMenu-40.1 {TkpDrawMenuEntry - gc for active and not strict motif} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -activeforeground red
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.3 {TkpDrawMenuEntry - gc for active and strict motif} {macOnly} {
- catch {destroy .m1}
- menu .m1
- set tk_strictMotif 1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1] [set tk_strictMotif 0]
-} {{} {} 0}
-test macMenu-40.4 {TkpDrawMenuEntry - gc for disabled with disabledfg and custom entry} {macOnly} {
- catch {destroy .m1}
- menu .m1 -disabledforeground blue
- .m1 add command -label foo -state disabled -background red
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.5 {TkpDrawMenuEntry - gc for disabled with disabledFg} {macOnly} {
- catch {destroy .m1}
- menu .m1 -disabledforeground blue
- .m1 add command -label foo -state disabled
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.6 {TkpDrawMenuEntry - gc for disabled - no disabledFg} {macOnly} {
- catch {destroy .m1}
- menu .m1 -disabledforeground ""
- .m1 add command -label foo -state disabled
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.7 {TkpDrawMenuEntry - gc for normal - custom entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -foreground red
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.8 {TkpDrawMenuEntry - gc for normal} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.9 {TkpDrawMenuEntry - gc for indicator - custom entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label foo -selectcolor orange
- .m1 invoke 1
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.10 {TkpDrawMenuEntry - gc for indicator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label foo
- .m1 invoke 1
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.11 {TkpDrawMenuEntry - border - custom entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -activebackground green
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.12 {TkpDrawMenuEntry - border} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.13 {TkpDrawMenuEntry - active border - strict motif} {macOnly} {
- catch {destroy .m1}
- set tk_strictMotif 1
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1] [set tk_strictMotif 0]
-} {{} {} 0}
-test macMenu-40.14 {TkpDrawMenuEntry - active border - custom entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -activeforeground yellow
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.15 {TkpDrawMenuEntry - active border} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- .m1 entryconfigure 1 -state active
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.16 {TkpDrawMenuEntry - font - custom entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo -font "Helvectica 72"
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.17 {TkpDrawMenuEntry - font} {macOnly} {
- catch {destroy .m1}
- menu .m1 -font "Courier 72"
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.18 {TkpDrawMenuEntry - separator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add separator
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.19 {TkpDrawMenuEntry - standard} {macOnly} {
- catch {destroy .mb}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.20 {TkpDrawMenuEntry - disabled cascade item} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add cascade -label File -menu .m1.file
- menu .m1.file
- .m1.file add command -label foo
- .m1 entryconfigure File -state disabled
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.21 {TkpDrawMenuEntry - indicator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label macMenu-40.20
- .m1 invoke 0
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-40.22 {TkpDrawMenuEntry - indicator - hideMargin} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label macMenu-40.21 -hidemargin 1
- .m1 invoke 0
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-
-test macMenu-41.1 {TkpComputeStandardMenuGeometry - no entries} {macOnly} {
- catch {destroy .m1}
- menu .m1
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.2 {TkpComputeStandardMenuGeometry - one entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "one"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.3 {TkpComputeStandardMenuGeometry - more than one entry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "one"
- .m1 add command -label "two"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.4 {TkpComputeStandardMenuGeometry - separator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add separator
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.5 {TkpComputeStandardMenuGeometry - standard label geometry} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "test"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.6 {TkpComputeStandardMenuGeometry - different font for entry} {macOnly} {
- catch {destroy .m1}
- menu .m1 -font "Helvetica 12"
- .m1 add command -label "test" -font "Courier 12"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.7 {TkpComputeStandardMenuGeometry - second entry larger} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "test"
- .m1 add command -label "test test"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.8 {TkpComputeStandardMenuGeometry - first entry larger} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "test test"
- .m1 add command -label "test"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.9 {TkpComputeStandardMenuGeometry - accelerator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "test" -accel "Ctrl+S"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.10 {TkpComputeStandardMenuGeometry - second accel larger} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "test" -accel "1"
- .m1 add command -label "test" -accel "1 1"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.11 {TkpComputeStandardMenuGeometry - second accel smaller} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "test" -accel "1 1"
- .m1 add command -label "test" -accel "1"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.12 {TkpComputeStandardMenuGeometry - indicator} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label test
- .m1 invoke 1
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.13 {TkpComputeStandardMenuGeometry - second indicator less or equal } {macOnly testImageType} {
- catch {destroy .m1}
- catch {image delete image1}
- image create test image1
- menu .m1
- .m1 add checkbutton -image image1
- .m1 invoke 1
- .m1 add checkbutton -label test
- .m1 invoke 2
- list [update idletasks] [destroy .m1] [image delete image1]
-} {{} {} {}}
-test macMenu-41.14 {TkpComputeStandardMenuGeometry - hidden margin} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add checkbutton -label macMenu-41.15 -hidemargin 1
- .m1 invoke macMenu-41.15
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.15 {TkpComputeStandardMenuGeometry - zero sized menus} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.16 {TkpComputeStandardMenuGeometry - first column bigger} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label one
- .m1 add command -label two
- .m1 add command -label three -columnbreak 1
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.17 {TkpComputeStandardMenuGeometry - second column bigger} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label one
- .m1 add command -label two -columnbreak 1
- .m1 add command -label three
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.18 {TkpComputeStandardMenuGeometry - three columns} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label one
- .m1 add command -label two -columnbreak 1
- .m1 add command -label three
- .m1 add command -label four
- .m1 add command -label five -columnbreak 1
- .m1 add command -label six
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.19 {TkpComputeStandardMenuGeometry - entry without accel long} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label "This is a long item with no accel."
- .m1 add command -label foo -accel "Cmd+S"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-41.20 {TkpComputeStandardMenuGeometry - entry with accel long} {macOnly} {
- catch {destroy .m1}
- menu .m1 -tearoff 0
- .m1 add command -label foo
- .m1 add command -label "This is a long label with an accel." -accel "Cmd+W"
- list [update idletasks] [destroy .m1]
-} {{} {}}
-
-test macMenu-42.1 {DrawMenuEntryLabel - setting indicatorSpace} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "foo"
- set tearoff [tk::TearOffMenu .m1]
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-42.2 {DrawMenuEntryLabel - drawing image} {macOnly testImageType} {
- catch {destroy .m1}
- catch {image delete image1}
- image create test image1
- menu .m1
- .m1 add command -image image1
- set tearoff [tk::TearOffMenu .m1]
- list [update idletasks] [destroy .m1] [image delete image1]
-} {{} {} {}}
-test macMenu-42.3 {DrawMenuEntryLabel - drawing select image} {macOnly testImageType} {
- catch {destroy .m1}
- catch {eval image delete [image names]}
- image create test image1
- image create test image2
- menu .m1
- .m1 add checkbutton -image image1 -selectimage image2
- .m1 invoke 1
- set tearoff [tk::TearOffMenu .m1]
- list [update idletasks] [destroy .m1] [eval image delete [image names]]
-} {{} {} {}}
-test macMenu-42.4 {DrawMenuEntryLabel - drawing a bitmap} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -bitmap questhead
- set tearoff [tk::TearOffMenu .m1]
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-42.5 {DrawMenuEntryLabel - drawing null label} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command
- set tearoff [tk::TearOffMenu .m1]
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-42.6 {DrawMenuEntryLabel - drawing real label} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "This is a long label" -underline 3
- set tearoff [tk::TearOffMenu .m1]
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-42.7 {DrawMenuEntryLabel - drawing disabled label} {macOnly} {
- catch {destroy .m1}
- menu .m1 -disabledforeground ""
- .m1 add command -label "This is a long label" -state disabled
- set tearoff [tk::TearOffMenu .m1]
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-42.8 {DrawMenuEntryLabel - disabled images} {macOnly testImageType} {
- catch {destroy .m1}
- catch {image delete image1}
- image create test image1
- menu .m1
- .m1 add command -image image1 -state disabled
- set tearoff [tk::TearOffMenu .m1 100 100]
- list [update idletasks] [destroy .m1] [image delete image1]
-} {{} {} {}}
-
-test macMenu-43.1 {GetMenuLabelGeometry - image} {macOnly testImageType} {
- catch {destroy .m1}
- catch {image delete image1}
- menu .m1
- image create test image1
- .m1 add command -image image1
- list [update idletasks] [destroy .m1] [image delete image1]
-} {{} {} {}}
-test macMenu-43.2 {GetMenuLabelGeometry - bitmap} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -bitmap questhead
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-43.3 {GetMenuLabelGeometry - no text} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command
- list [update idletasks] [destroy .m1]
-} {{} {}}
-test macMenu-43.4 {GetMenuLabelGeometry - text} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label "This is a test."
- list [update idletasks] [destroy .m1]
-} {{} {}}
-
-test macMenu-44.1 {DrawMenuEntryBackground} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- list [update] [destroy .m1]
-} {{} {}}
-test macMenu-44.2 {DrawMenuEntryBackground} {macOnly} {
- catch {destroy .m1}
- menu .m1
- .m1 add command -label foo
- set tearoff [tk::TearOffMenu .m1 40 40]
- $tearoff activate 0
- list [update] [destroy .m1]
-} {{} {}}
-
-test macMenu-45.1 {TkpMenuInit - called at boot time} {macOnly} {
-} {}
-
-# cleanup
-deleteWindows
-::tcltest::cleanupTests
-return
diff --git a/tests/macWinMenu.test b/tests/macWinMenu.test
deleted file mode 100644
index 42ecd90..0000000
--- a/tests/macWinMenu.test
+++ /dev/null
@@ -1,103 +0,0 @@
-# This file is a Tcl script to test menus in Tk. It is
-# organized in the standard fashion for Tcl tests. It tests
-# the common implementation of Macintosh and Windows menus.
-#
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# All rights reserved.
-
-package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
-tcltest::loadTestedCommands
-
-test macWinMenu-1.1 {PreprocessMenu} {macOrPc nonUnixUserInteraction} {
- catch {destroy .m1}
- menu .m1 -postcommand "destroy .m1"
- .m1 add command -label "macWinMenu-1.1: Hit Escape"
- list [catch {.m1 post 40 40} msg] $msg
-} {0 {}}
-test macWinMenu-1.2 {PreprocessMenu} {macOrPc nonUnixUserInteraction} {
- catch {destroy .m1}
- catch {destroy .m2}
- set foo1 foo
- set foo2 foo
- menu .m1 -postcommand "set foo1 .m1"
- .m1 add cascade -menu .m2 -label "macWinMenu-1.2: Hit Escape"
- menu .m2 -postcommand "set foo2 .m2"
- update idletasks
- list [catch {.m1 post 40 40} msg] $msg [set foo1] [set foo2] \
- [destroy .m1 .m2] [catch {unset foo1}] [catch {unset foo2}]
-} {0 .m2 .m1 .m2 {} 0 0}
-
-test macWinMenu-1.3 {PreprocessMenu} {macOrPc nonUnixUserInteraction} {
- catch {destroy .l1}
- catch {destroy .m1}
- catch {destroy .m2}
- catch {destroy .m3}
- label .l1 -text "Preparing menus..."
- pack .l1
- update idletasks
- menu .m1 -postcommand ".l1 configure -text \"Destroying .m1...\"; update idletasks; destroy .m1"
- menu .m2 -postcommand ".l1 configure -text \"Destroying .m2...\"; update idletasks; destroy .m2"
- menu .m3 -postcommand ".l1 configure -text \"Destroying .m3...\"; update idletasks; destroy .m3"
- .m1 add cascade -menu .m2 -label "macWinMenu-1.3: Hit Escape (.m2)"
- .m1 add cascade -menu .m3 -label ".m3"
- update idletasks
- list [catch {.m1 post 40 40} msg] $msg [destroy .l1 .m2 .m3]
-} {0 {} {}}
-test macWinMenu-1.4 {PreprocessMenu} {macOrPc} {
- catch {destroy .l1}
- catch {destroy .m1}
- catch {destroy .m2}
- catch {destroy .m3}
- catch {destroy .m4}
- label .l1 -text "Preparing menus..."
- pack .l1
- update idletasks
- menu .m1 -postcommand ".l1 configure -text \"Destroying .m1...\"; update idletasks; destroy .m1"
- .m1 add cascade -menu .m2 -label "macWinMenu-1.4: Hit Escape (.m2)"
- .m1 add cascade -menu .m3 -label ".m3"
- menu .m2 -postcommand ".l1 configure -text \"Destroying .m2...\"; update idletasks; destroy .m2"
- .m2 add cascade -menu .m4 -label ".m4"
- menu .m3 -postcommand ".l1 configure -text \"Destroying .m3...\"; update idletasks; destroy .m3"
- menu .m4 -postcommand ".l1 configure -text \"Destroying .m4...\"; update idletasks; destroy .m4"
- update idletasks
- list [catch {.m1 post 40 40} msg] $msg [destroy .l1 .m2 .m3 .m4]
-} {0 {} {}}
-test macWinMenu-1.5 {PreprocessMenu} {macOrPc} {
- catch {destroy .m1}
- catch {destroy .m2}
- menu .m1
- .m1 add cascade -menu .m2 -label "You may need to hit Escape to get this menu to go away."
- menu .m2 -postcommand glorp
- list [catch {.m1 post 40 40} msg] $msg [destroy .m1 .m2]
-} {1 {invalid command name "glorp"} {}}
-
-test macWinMenu-2.1 {TkPreprocessMenu} {macOrPc nonUnixUserInteraction} {
- catch {destroy .m1}
- set foo test
- menu .m1 -postcommand "set foo 2.1"
- .m1 add command -label "macWinMenu-2.1: Hit Escape"
- list [catch {.m1 post 40 40} msg] $msg [set foo] [destroy .m1] [unset foo]
-} {0 2.1 2.1 {} {}}
-
-# cleanup
-deleteWindows
-::tcltest::cleanupTests
-return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/macscrollbar.test b/tests/macscrollbar.test
deleted file mode 100644
index c8cc214..0000000
--- a/tests/macscrollbar.test
+++ /dev/null
@@ -1,93 +0,0 @@
-# This file is a Tcl script to test out scrollbar widgets and
-# the "scrollbar" command of Tk. This file only tests Macintosh
-# specific features. It is organized in the standard fashion for
-# Tcl tests.
-#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# All rights reserved.
-
-package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
-tcltest::loadTestedCommands
-
-update
-
-# Tests for display and layout
-wm geometry . 50x300
-scrollbar .s
-pack .s -fill y -expand 1
-update
-test macscroll-1.1 {TkpDisplayScrollbar procedure} {macOnly} {
- list [.s configure -width] [.s configure -bd]
-} {{-width width Width 16 16} {-borderwidth borderWidth BorderWidth 0 0}}
-test macscroll-1.2 {TkpDisplayScrollbar procedure} {macOnly} {
- # Exercise drawing 3D relief
- pack .s -fill y -expand 1 -anchor center
- .s configure -bd 4
- update
- focus .s
- update
-} {}
-test macscroll-1.3 {TkpDisplayScrollbar procedure} {macOnly} {
- pack .s -fill y -expand 1 -anchor e
- update
- set x [.s configure -width]
- pack .s -fill y -expand 1 -anchor w
- update
- list [.s configure -width] $x
-} {{-width width Width 16 16} {-width width Width 16 16}}
-test macscroll-1.4 {TkpDisplayScrollbar procedure} {macOnly} {
- wm geometry . 300x50
- .s configure -bd 0 -orient horizontal
- pack .s -fill x -expand 1 -anchor center
- update
- set x [.s configure -width]
- pack .s -fill x -expand 1 -anchor n
- update
- set y [.s configure -width]
- pack .s -fill x -expand 1 -anchor s
- update
- list [.s configure -width] $x $y
-} {{-width width Width 16 16} {-width width Width 16 16} {-width width Width 16 16}}
-test macscroll-1.5 {TkpDisplayScrollbar procedure} {macOnly} {
- wm geometry . 300x16
- .s configure -bd 0 -orient horizontal
- pack .s -fill x -expand 1 -anchor s
- update
- wm geometry . 300x15
- update
- wm geometry . 300x14
- update
-} {}
-test macscroll-1.6 {TkpDisplayScrollbar procedure} {macOnly} {
- # Check the drawing of the resize hack
- wm geometry . 20x300
- wm resizable . 1 1
- .s configure -bd 0 -orient vertical
- pack .s -fill y -expand 1 -anchor e
- update
- set x [.s identify 12 295]
- wm resizable . 0 0
- update
- set y [.s identify 12 295]
- wm resizable . 1 1
- pack .s -fill y -expand 1 -anchor center
- update
- list $x $y [.s identify 12 295]
-} {{} arrow2 arrow2}
-test macscroll-1.7 {TkpDisplayScrollbar procedure} {macOnly} {
- wm geometry . 300x300
- pack .s -fill y -expand 1 -anchor e
- catch {destroy .s2}
- scrollbar .s2 -orient horizontal
- place .s2 -x 0 -y 284 -width 300
-} {}
-
-deleteWindows
-# cleanup
-::tcltest::cleanupTests
-return
diff --git a/tests/main.test b/tests/main.test
index 3799be7..1d33fbb 100644
--- a/tests/main.test
+++ b/tests/main.test
@@ -9,28 +9,93 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::interpreter
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
-
-test main-1.1 {StdinProc} {unix} {
+test main-1.1 {StdinProc} -constraints stdio -setup {
set script [makeFile {
close stdin; exit
} script]
- if {[catch {exec [interpreter] <$script} msg]} {
- set error 1
- } else {
- set error 0
- }
+} -body {
+ list [catch {exec [interpreter] <$script} msg] $msg
+} -cleanup {
removeFile script
- list $error $msg
-} {0 {}}
+} -result {0 {}}
+
+test main-2.1 {Tk_MainEx: -encoding option} -constraints {
+ stdio
+ } -setup {
+ set script [makeFile {} script]
+ file delete $script
+ set f [open $script w]
+ fconfigure $f -encoding utf-8
+ puts $f {puts [list $argv0 $argv $tcl_interactive]}
+ puts -nonewline $f {puts [string equal \u20ac }
+ puts $f "\u20ac]; exit"
+ close $f
+ catch {set f [open "|[list [interpreter] -encoding utf-8 script]" r]}
+ } -body {
+ read $f
+ } -cleanup {
+ close $f
+ removeFile script
+ } -result [list script {} 0]\n1\n
+
+test main-2.2 {Tk_MainEx: -encoding option} -constraints {
+ stdio
+ } -setup {
+ set script [makeFile {} script]
+ file delete $script
+ set f [open $script w]
+ fconfigure $f -encoding utf-8
+ puts $f {puts [list $argv0 $argv $tcl_interactive]}
+ puts -nonewline $f {puts [string equal \u20ac }
+ puts $f "\u20ac]; exit"
+ close $f
+ catch {set f [open "|[list [interpreter] -encoding ascii script]" r]}
+ } -body {
+ read $f
+ } -cleanup {
+ close $f
+ removeFile script
+ } -result [list script {} 0]\n0\n
+
+ # Procedure to simulate interactive typing of commands, line by line
+ proc type {chan script} {
+ foreach line [split $script \n] {
+ if {[catch {
+ puts $chan $line
+ flush $chan
+ }]} {
+ return
+ }
+ # Grrr... Behavior depends on this value.
+ after 1000
+ }
+ }
+
+test main-2.3 {Tk_MainEx: -encoding option} -constraints {
+ stdio
+ } -setup {
+ set script [makeFile {} script]
+ file delete $script
+ set f [open $script w]
+ fconfigure $f -encoding utf-8
+ puts $f {puts [list $argv0 $argv $tcl_interactive]}
+ puts -nonewline $f {puts [string equal \u20ac }
+ puts $f "\u20ac]"
+ close $f
+ catch {set f [open "|[list [interpreter] -enc utf-8 script]" r+]}
+ } -body {
+ type $f {
+ puts $argv
+ exit
+ }
+ list [catch {gets $f} line] $line
+ } -cleanup {
+ close $f
+ removeFile script
+ } -result {0 {-enc utf-8 script}}
test main-3.1 {Tk_ParseArgv: -help option} -constraints unix -body {
# Run only on unix as Win32 pops up native dialog
@@ -57,5 +122,5 @@ test main-3.3 {Tk_ParseArgv: -help option} -setup {
} -match glob -result {1 {Command-specific options:*}}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/menu.test b/tests/menu.test
index 98978c5..3cb47c3 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -6,12 +6,13 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
+# find the earth.gif file for use in these tests
+set earthPhotoFile [file join [file dirname [info script]] earth.gif]
+testConstraint hasEarthPhoto [file exists $earthPhotoFile]
+
test menu-1.1 {Tk_MenuCmd procedure} {
list [catch menu msg] $msg
} {1 {wrong # args: should be "menu pathName ?options?"}}
@@ -196,7 +197,9 @@ menu .m2
.m1 add separator
.m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
.m1 add radiobutton -label "radiobutton" -variable radio
-image create photo image1 -file [file join $tk_library demos images earth.gif]
+if {[testConstraint hasEarthPhoto]} {
+ image create photo image1 -file $earthPhotoFile
+}
foreach configTest {
{-activebackground
@@ -489,7 +492,9 @@ foreach configTest {
set options [lindex $attempt 1]
foreach item {0 1 2 3 4 5} {
catch {unset msg}
- test menu-2.$i [list entry configuration options $name $item $value [.m1 type $item]] {
+ # OK, it's an overeager constraint, but it should also
+ # normally hold anyway
+ test menu-2.$i [list entry configuration options $name $item $value [.m1 type $item]] hasEarthPhoto {
set result [catch {.m1 entryconfigure $item $name $value} msg]
if {$result == 1} {
set msg
@@ -502,7 +507,9 @@ foreach configTest {
}
}
-image delete image1
+if {[testConstraint hasEarthPhoto]} {
+ image delete image1
+}
destroy .m1
destroy .m2
@@ -672,6 +679,17 @@ test menu-3.29 {MenuWidgetCmd procedure, "delete" option} {
.m1 activate 3
list [catch {.m1 delete 1} msg] $msg [destroy .m1]
} {0 {} {}}
+test menu-3.29+1 {MenuWidgetCmd, "delete", Bug 220950} -setup {
+ destroy .m1
+} -body {
+ menu .m1
+ .m1 add command -label "bogus"
+ .m1 add command -label "ok"
+ .m1 delete 10 20
+ .m1 entrycget last -label
+} -cleanup {
+ destroy .m1
+} -result ok
test menu-3.30 {MenuWidgetCmd procedure, "entrycget" option} {
catch {destroy .m1}
menu .m1
@@ -888,7 +906,7 @@ test menu-3.67 {MenuWidgetCmd procedure, bad option} {
catch {destroy .m1}
menu .m1
list [catch {.m1 foo} msg] $msg [destroy .m1]
-} {1 {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, or yposition} {}}
+} {1 {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, xposition, or yposition} {}}
test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} {
set t .t
set m1 .t.m1
@@ -908,6 +926,23 @@ test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} {
destroy $t;
set l;
} {1 1}
+test menu-3.69 {MenuWidgetCmd procedure, "xposition" option} -setup {
+ catch {destroy .m1}
+ menu .m1
+} -body {
+ .m1 xposition
+} -cleanup {
+ destroy .m1
+} -returnCodes error -result {wrong # args: should be ".m1 xposition index"}
+test menu-3.70 {MenuWidgetCmd procedure, "xposition" option} -setup {
+ catch {destroy .m1}
+ menu .m1
+} -body {
+ .m1 xposition 1
+ subst {} ;# just checking that the xposition does not produce an error...
+} -cleanup {
+ destroy .m1
+} -result {}
test menu-4.1 {TkInvokeMenu: disabled} {
catch {destroy .m1}
@@ -1345,10 +1380,10 @@ test menu-8.1 {DestroyMenuEntry} {
.m1 add cascade -menu .m2
list [catch {.m1 delete 1} msg] $msg [destroy .m1 .m2]
} {0 {} {}}
-test menu-8.2 {DestroyMenuEntry} {
+test menu-8.2 {DestroyMenuEntry} hasEarthPhoto {
catch {image delete image1a}
catch {destroy .m1}
- image create photo image1a -file [file join $tk_library demos images earth.gif]
+ image create photo image1a -file $earthPhotoFile
menu .m1
.m1 add command -image image1a
list [catch {.m1 delete 1} msg] $msg [destroy .m1] [image delete image1a]
@@ -1597,32 +1632,32 @@ test menu-11.18 {ConfigureMenuEntry} testImageType {
image create test image1
list [catch {.m1 entryconfigure 1 -image image1} msg] $msg [destroy .m1] [image delete image1]
} {0 {} {} {}}
-test menu-11.19 {ConfigureMenuEntry} testImageType {
+test menu-11.19 {ConfigureMenuEntry} {testImageType hasEarthPhoto} {
catch {destroy .m1}
catch {image delete image1}
catch {image delete image2}
image create test image1
- image create photo image2 -file [file join $tk_library demos images earth.gif]
+ image create photo image2 -file $earthPhotoFile
menu .m1
.m1 add command -image image1
list [catch {.m1 entryconfigure 1 -image image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
} {0 {} {} {} {}}
-test menu-11.20 {ConfigureMenuEntry} testImageType {
+test menu-11.20 {ConfigureMenuEntry} {testImageType hasEarthPhoto} {
catch {destroy .m1}
catch {image delete image1}
catch {image delete image2}
- image create photo image1 -file [file join $tk_library demos images earth.gif]
+ image create photo image1 -file $earthPhotoFile
image create test image2
menu .m1
.m1 add checkbutton -image image1
list [catch {.m1 entryconfigure 1 -selectimage image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
} {0 {} {} {} {}}
-test menu-11.21 {ConfigureMenuEntry} testImageType {
+test menu-11.21 {ConfigureMenuEntry} {testImageType hasEarthPhoto} {
catch {destroy .m1}
catch {image delete image1}
catch {image delete image2}
catch {image delete image3}
- image create photo image1 -file [file join $tk_library demos images earth.gif]
+ image create photo image1 -file $earthPhotoFile
image create test image2
image create test image3
menu .m1
@@ -2042,23 +2077,23 @@ test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} {
catch {destroy .m2}
menu .m1
list [catch {.m1 clone .m2} msg] $msg [destroy .m1]
- } {0 {} {}}
- test menu-20.7 {CloneMenu - hooking up bookeeping ptrs - multiple children} {
+} {0 {} {}}
+test menu-20.7 {CloneMenu - hooking up bookeeping ptrs - multiple children} {
catch {destroy .m1}
catch {destroy .m2}
catch {destroy .m3}
menu .m1
.m1 clone .m2
list [catch {.m1 clone .m3} msg] $msg [destroy .m1]
- } {0 {} {}}
- test menu-20.8 {CloneMenu - cascade entries} {
+} {0 {} {}}
+test menu-20.8 {CloneMenu - cascade entries} {
catch {destroy .m1}
catch {destroy .foo}
menu .m1
.m1 add cascade -menu .m2
list [catch {.m1 clone .foo} msg] $msg [destroy .m1]
- } {0 {} {}}
- test menu-20.9 {CloneMenu - cascades entries} {
+} {0 {} {}}
+test menu-20.9 {CloneMenu - cascades entries} {
catch {destroy .m1}
catch {destroy .m2}
catch {destroy .foo}
@@ -2066,7 +2101,7 @@ test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} {
.m1 add cascade -menu .m2
menu .m2
list [catch {.m1 clone .foo} msg] $msg [destroy .m1 .m2]
- } {0 {} {}}
+} {0 {} {}}
test menu-20.10 {CloneMenu - tearoff fields} {
catch {destroy .m1}
catch {destroy .m2}
@@ -2107,6 +2142,38 @@ test menu-22.2 {GetIndexFromCoords} {
.m1 configure -tearoff 0
list [catch {.m1 index @5,5} msg] $msg [destroy .m1]
} {0 0 {}}
+test menu-22.3 {GetIndexFromCoords: mapped window, y only} unix {
+ catch {destroy .m1}
+ menu .m1
+ .m1 add command -label "test"
+ .m1 configure -tearoff 0
+ tk_popup .m1 0 0
+ tkwait visibility .m1
+ list [catch {.m1 index @5} msg] $msg [destroy .m1]
+} {0 0 {}}
+test menu-22.4 {GetIndexFromCoords: mapped window x,y} unix {
+ catch {destroy .m1}
+ menu .m1
+ .m1 add command -label "test"
+ .m1 configure -tearoff 0
+ tk_popup .m1 0 0
+ tkwait visibility .m1
+ update
+ set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
+ list [catch {.m1 index @$x,5} msg] $msg [destroy .m1]
+} {0 0 {}}
+test menu-22.5 {GetIndexFromCoords: mapped wide window} unix {
+ catch {destroy .m1}
+ menu .m1
+ .m1 add command -label "test"
+ .m1 configure -tearoff 0
+ tk_popup .m1 0 0
+ tkwait visibility .m1
+ wm geometry .m1 200x100
+ update
+ set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
+ list [catch {.m1 index @$x,5} msg] $msg [destroy .m1]
+} {0 0 {}}
test menu-23.1 {RecursivelyDeleteMenu} {
catch {destroy .m1}
@@ -2496,5 +2563,5 @@ test menu-36.1 {menu -underline string overruns Bug 1599877} {} {
# cleanup
deleteWindows
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/menuDraw.test b/tests/menuDraw.test
index 945ac3f..225223c 100644
--- a/tests/menuDraw.test
+++ b/tests/menuDraw.test
@@ -6,10 +6,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
test menuDraw-1.1 {TkMenuInitializeDrawingFields} {
@@ -164,7 +161,7 @@ test menuDraw-7.2 {TkEventuallyRecomputeMenu - update pending} {
} {{} {}}
-test menuDraw-8.1 {TkRecomputeMenu} {pcOnly userInteraction} {
+test menuDraw-8.1 {TkRecomputeMenu} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 configure -postcommand [.m1 add command -label foo]
@@ -255,7 +252,7 @@ test menuDraw-11.3 {TkMenuSelectImageProc - entry not selected} testImageType {
} {{} {} {}}
#Don't know how to test missing tkwin in DisplayMenu
-test menuDraw-12.1 {DisplayMenu - menubar background} {unixOnly} {
+test menuDraw-12.1 {DisplayMenu - menubar background} unix {
catch {destroy .m1}
menu .m1
.m1 add cascade -label foo -menu .m2
@@ -313,7 +310,7 @@ test menuDraw.12.7 {DisplayMenu - three columns} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test menuDraw-12.6 {Display menu - testing for extra space and menubars} {unixOnly} {
+test menuDraw-12.6 {Display menu - testing for extra space and menubars} unix {
catch {destroy .m1}
menu .m1
.m1 add cascade -label foo
@@ -347,14 +344,6 @@ test menuDraw-13.2 {TkMenuEventProc - ConfigureNotify} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [wm geometry $tearoff 200x100] [update] [destroy .m1]
} {{} {} {}}
-test menuDraw-13.3 {TkMenuEventProc - ActivateNotify} {macOnly} {
- catch {destroy .t2}
- toplevel .t2 -menu .t2.m1
- menu .t2.m1
- .t2.m1 add command -label foo
- tk::TearOffMenu .t2.m1 40 40
- list [catch {update} msg] $msg [destroy .t2]
-} {0 {} {}}
# Testing deletes is hard, and I am going to do my best. Don't know how
# to test the case where we have already cleared the tkwin field in the
# menuPtr.
@@ -431,7 +420,7 @@ test menuDraw-15.6 {TkPostTearoffMenu - tearoff off right} {
} {0 {}}
-test menuDraw-16.1 {TkPostSubmenu} {unixOnly} {
+test menuDraw-16.1 {TkPostSubmenu} nonUnixUserInteraction {
catch {destroy .m1}
catch {destroy .m2}
menu .m1
@@ -442,7 +431,7 @@ test menuDraw-16.1 {TkPostSubmenu} {unixOnly} {
$tearoff postcascade 0
list [$tearoff postcascade 0] [destroy .m1] [destroy .m2]
} {{} {} {}}
-test menuDraw-16.2 {TkPostSubMenu} {unixOnly} {
+test menuDraw-16.2 {TkPostSubMenu} nonUnixUserInteraction {
catch {destroy .m1}
catch {destroy .m2}
catch {destroy .m3}
@@ -470,7 +459,7 @@ test menuDraw-16.4 {TkPostSubMenu} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [$tearoff postcascade 0] [destroy .m1]
} {{} {}}
-test menuDraw-16.5 {TkPostSubMenu} {unixOnly} {
+test menuDraw-16.5 {TkPostSubMenu} unix {
catch {destroy .m1}
catch {destroy .m2}
menu .m1
@@ -479,7 +468,7 @@ test menuDraw-16.5 {TkPostSubMenu} {unixOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [catch {$tearoff postcascade test} msg] $msg [destroy .m1] [destroy .m2]
} {1 {invalid command name "glorp"} {} {}}
-test menuDraw-16.6 {TkPostSubMenu} {pcOnly userInteraction} {
+test menuDraw-16.6 {TkPostSubMenu} {win userInteraction} {
catch {destroy .m1}
catch {destroy .m2}
menu .m1
@@ -490,7 +479,7 @@ test menuDraw-16.6 {TkPostSubMenu} {pcOnly userInteraction} {
list [$tearoff postcascade 0] [destroy .m1] [destroy .m2]
} {{} {} {}}
-test menuDraw-17.1 {AdjustMenuCoords - menubar} {unixOnly} {
+test menuDraw-17.1 {AdjustMenuCoords - menubar} unix {
catch {destroy .m1}
catch {destroy .m2}
menu .m1 -tearoff 0
@@ -505,7 +494,7 @@ test menuDraw-17.1 {AdjustMenuCoords - menubar} {unixOnly} {
}
list [$w postcascade 0] [. configure -menu ""] [destroy .m1] [destroy .m2]
} {{} {} {} {}}
-test menuDraw-17.2 {AdjustMenuCoords - menu} {pcOnly userInteraction} {
+test menuDraw-17.2 {AdjustMenuCoords - menu} {win userInteraction} {
catch {destroy .m1}
catch {destroy .m2}
menu .m1
@@ -518,18 +507,5 @@ test menuDraw-17.2 {AdjustMenuCoords - menu} {pcOnly userInteraction} {
# cleanup
deleteWindows
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/menubut.test b/tests/menubut.test
index 14a03a1..3dfa1b5 100644
--- a/tests/menubut.test
+++ b/tests/menubut.test
@@ -11,10 +11,7 @@
# XXX but many procedures have no tests.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Create entries in the option database to be sure that geometry options
@@ -303,7 +300,7 @@ test menubutton-7.13 {ComputeMenuButtonGeometry procedure} {nonPortable fonts} {
pack .mb
list [winfo reqwidth .mb] [winfo reqheight .mb]
} {78 28}
-test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {testImageType unixOnly nonPortable} {
+test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {testImageType unix nonPortable} {
# The following test is non-portable because the indicator's pixel
# size varies to maintain constant absolute size.
@@ -313,7 +310,7 @@ test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {testImageType unixOn
pack .mb
list [winfo reqwidth .mb] [winfo reqheight .mb]
} {64 23}
-test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {testImageType pcOnly nonPortable} {
+test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {testImageType win nonPortable} {
# The following test is non-portable because the indicator's pixel
# size varies to maintain constant absolute size.
@@ -340,18 +337,5 @@ deleteWindows
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/message.test b/tests/message.test
index 1d6e626..93344c4 100644
--- a/tests/message.test
+++ b/tests/message.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
option add *Message.borderWidth 2
@@ -119,5 +116,5 @@ test message-3.7 {MessageWidgetObjCmd procedure, "configure"} {
} {4}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/msgbox.test b/tests/msgbox.test
index b15c61d..ec98c89 100644
--- a/tests/msgbox.test
+++ b/tests/msgbox.test
@@ -6,28 +6,25 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
test msgbox-1.1 {tk_messageBox command} {
list [catch {tk_messageBox -foo} msg] $msg
-} {1 {bad option "-foo": must be -default, -icon, -message, -parent, -title, or -type}}
+} {1 {bad option "-foo": must be -default, -detail, -icon, -message, -parent, -title, or -type}}
test msgbox-1.2 {tk_messageBox command} {
list [catch {tk_messageBox -foo bar} msg] $msg
-} {1 {bad option "-foo": must be -default, -icon, -message, -parent, -title, or -type}}
+} {1 {bad option "-foo": must be -default, -detail, -icon, -message, -parent, -title, or -type}}
catch {tk_messageBox -foo bar} msg
regsub -all , $msg "" options
regsub \"-foo\" $options "" options
foreach option $options {
- if {[string index $option 0] == "-"} {
- test msgbox-1.3 {tk_messageBox command} {
- list [catch {tk_messageBox $option} msg] $msg
- } [list 1 "value for \"$option\" missing"]
+ if {[string index $option 0] eq "-"} {
+ test msgbox-1.3$option {tk_messageBox command} -body {
+ tk_messageBox $option
+ } -returnCodes error -result "value for \"$option\" missing"
}
}
@@ -67,11 +64,7 @@ test msgbox-1.10 {tk_messageBox command} {
list [catch {tk_messageBox -parent foo.bar} msg] $msg
} {1 {bad window path name "foo.bar"}}
-if {[info commands tk::MessageBox] == ""} {
- set isNative 1
-} else {
- set isNative 0
-}
+set isNative [expr {[info commands tk::MessageBox] == ""}]
proc ChooseMsg {parent btn} {
global isNative
@@ -133,35 +126,35 @@ foreach spec $specs {
set buttons [lindex $spec 3]
set button [lindex $buttons 0]
- test msgbox-2.$count {tk_messageBox command} {nonUnixUserInteraction} {
+ test msgbox-2.$count {tk_messageBox command} nonUnixUserInteraction {
ChooseMsg $parent $button
tk_messageBox -title Hi -message "Please press $button" \
- -type $type
+ -type $type
} $button
incr count
foreach icon {warning error info question} {
test msgbox-2.$count {tk_messageBox command -icon option} \
- {nonUnixUserInteraction} {
+ nonUnixUserInteraction {
ChooseMsg $parent $button
tk_messageBox -title Hi -message "Please press $button" \
- -type $type -icon $icon
+ -type $type -icon $icon
} $button
incr count
}
foreach button $buttons {
- test msgbox-2.$count {tk_messageBox command} {nonUnixUserInteraction} {
+ test msgbox-2.$count {tk_messageBox command} nonUnixUserInteraction {
ChooseMsg $parent $button
tk_messageBox -title Hi -message "Please press $button" \
- -type $type -default $button
+ -type $type -default $button
} "$button"
incr count
}
}
# These tests will hang your test suite if they fail.
-test msgbox-3.1 {tk_messageBox handles withdrawn parent} {nonUnixUserInteraction} {
+test msgbox-3.1 {tk_messageBox handles withdrawn parent} nonUnixUserInteraction {
wm withdraw .
ChooseMsg . "ok"
tk_messageBox -title Hi -message "Please press ok" \
@@ -169,14 +162,14 @@ test msgbox-3.1 {tk_messageBox handles withdrawn parent} {nonUnixUserInteraction
} "ok"
wm deiconify .
-test msgbox-3.2 {tk_messageBox handles iconified parent} {nonUnixUserInteraction} {
+test msgbox-3.2 {tk_messageBox handles iconified parent} nonUnixUserInteraction {
wm iconify .
ChooseMsg . "ok"
tk_messageBox -title Hi -message "Please press ok" \
-type ok -default ok
} "ok"
-wm deiconify .
+wm deiconify .
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/obj.test b/tests/obj.test
index e6eac27..25bd70f 100644
--- a/tests/obj.test
+++ b/tests/obj.test
@@ -6,10 +6,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
test obj-1.1 {TkGetPixelsFromObj} {
@@ -29,19 +26,5 @@ test obj-4.1 {SetPixelFromAny} {
deleteWindows
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/oldpack.test b/tests/oldpack.test
index 694bb94..2f9b979 100644
--- a/tests/oldpack.test
+++ b/tests/oldpack.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# First, test a single window packed in various ways in a parent
@@ -32,22 +29,22 @@ frame .pack.violet -width 80 -height 20
label .pack.violet.l -text P -bd 2 -relief raised
place .pack.violet.l -relwidth 1.0 -relheight 1.0
-test pack-1.1 {basic positioning} {
+test oldpack-1.1 {basic positioning} {
pack ap .pack .pack.red top
update
winfo geometry .pack.red
} 10x20+45+0
-test pack-1.2 {basic positioning} {
+test oldpack-1.2 {basic positioning} {
pack append .pack .pack.red bottom
update
winfo geometry .pack.red
} 10x20+45+80
-test pack-1.3 {basic positioning} {
+test oldpack-1.3 {basic positioning} {
pack append .pack .pack.red left
update
winfo geometry .pack.red
} 10x20+0+40
-test pack-1.4 {basic positioning} {
+test oldpack-1.4 {basic positioning} {
pack append .pack .pack.red right
update
winfo geometry .pack.red
@@ -56,22 +53,22 @@ test pack-1.4 {basic positioning} {
# Try adding padding around the window and make sure that the
# window gets a larger frame.
-test pack-2.1 {padding} {
+test oldpack-2.1 {padding} {
pack append .pack .pack.red {t padx 20}
update
winfo geometry .pack.red
} 10x20+45+0
-test pack-2.2 {padding} {
+test oldpack-2.2 {padding} {
pack append .pack .pack.red {top pady 20}
update
winfo geometry .pack.red
} 10x20+45+10
-test pack-2.3 {padding} {
+test oldpack-2.3 {padding} {
pack append .pack .pack.red {l padx 20}
update
winfo geometry .pack.red
} 10x20+10+40
-test pack-2.4 {padding} {
+test oldpack-2.4 {padding} {
pack append .pack .pack.red {left pady 20}
update
winfo geometry .pack.red
@@ -81,102 +78,102 @@ test pack-2.4 {padding} {
# make sure they all work. Try two differenet frame locations,
# to make sure that frame offsets are being added in correctly.
-test pack-3.1 {framing} {
+test oldpack-3.1 {framing} {
pack append .pack .pack.red {b padx 20 pady 30}
update
winfo geometry .pack.red
} 10x20+45+65
-test pack-3.2 {framing} {
+test oldpack-3.2 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 fr n}
update
winfo geometry .pack.red
} 10x20+45+50
-test pack-3.3 {framing} {
+test oldpack-3.3 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame ne}
update
winfo geometry .pack.red
} 10x20+90+50
-test pack-3.4 {framing} {
+test oldpack-3.4 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame e}
update
winfo geometry .pack.red
} 10x20+90+65
-test pack-3.5 {framing} {
+test oldpack-3.5 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame se}
update
winfo geometry .pack.red
} 10x20+90+80
-test pack-3.6 {framing} {
+test oldpack-3.6 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame s}
update
winfo geometry .pack.red
} 10x20+45+80
-test pack-3.7 {framing} {
+test oldpack-3.7 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame sw}
update
winfo geometry .pack.red
} 10x20+0+80
-test pack-3.8 {framing} {
+test oldpack-3.8 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame w}
update
winfo geometry .pack.red
} 10x20+0+65
-test pack-3.9 {framing} {
+test oldpack-3.9 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame nw}
update
winfo geometry .pack.red
} 10x20+0+50
-test pack-3.10 {framing} {
+test oldpack-3.10 {framing} {
pack append .pack .pack.red {bottom padx 20 pady 30 frame c}
update
winfo geometry .pack.red
} 10x20+45+65
-test pack-3.11 {framing} {
+test oldpack-3.11 {framing} {
pack append .pack .pack.red {r padx 20 pady 30}
update
winfo geometry .pack.red
} 10x20+80+40
-test pack-3.12 {framing} {
+test oldpack-3.12 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame n}
update
winfo geometry .pack.red
} 10x20+80+0
-test pack-3.13 {framing} {
+test oldpack-3.13 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame ne}
update
winfo geometry .pack.red
} 10x20+90+0
-test pack-3.14 {framing} {
+test oldpack-3.14 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame e}
update
winfo geometry .pack.red
} 10x20+90+40
-test pack-3.15 {framing} {
+test oldpack-3.15 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame se}
update
winfo geometry .pack.red
} 10x20+90+80
-test pack-3.16 {framing} {
+test oldpack-3.16 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame s}
update
winfo geometry .pack.red
} 10x20+80+80
-test pack-3.17 {framing} {
+test oldpack-3.17 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame sw}
update
winfo geometry .pack.red
} 10x20+70+80
-test pack-3.18 {framing} {
+test oldpack-3.18 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame w}
update
winfo geometry .pack.red
} 10x20+70+40
-test pack-3.19 {framing} {
+test oldpack-3.19 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame nw}
update
winfo geometry .pack.red
} 10x20+70+0
-test pack-3.20 {framing} {
+test oldpack-3.20 {framing} {
pack append .pack .pack.red {right padx 20 pady 30 frame center}
update
winfo geometry .pack.red
@@ -185,32 +182,32 @@ test pack-3.20 {framing} {
# Try out various filling combinations in a couple of different
# frame locations.
-test pack-4.1 {filling} {
+test oldpack-4.1 {filling} {
pack append .pack .pack.red {bottom padx 20 pady 30 fillx}
update
winfo geometry .pack.red
} 100x20+0+65
-test pack-4.2 {filling} {
+test oldpack-4.2 {filling} {
pack append .pack .pack.red {bottom padx 20 pady 30 filly}
update
winfo geometry .pack.red
} 10x50+45+50
-test pack-4.3 {filling} {
+test oldpack-4.3 {filling} {
pack append .pack .pack.red {bottom padx 20 pady 30 fill}
update
winfo geometry .pack.red
} 100x50+0+50
-test pack-4.4 {filling} {
+test oldpack-4.4 {filling} {
pack append .pack .pack.red {right padx 20 pady 30 fillx}
update
winfo geometry .pack.red
} 30x20+70+40
-test pack-4.5 {filling} {
+test oldpack-4.5 {filling} {
pack append .pack .pack.red {right padx 20 pady 30 filly}
update
winfo geometry .pack.red
} 10x100+80+0
-test pack-4.6 {filling} {
+test oldpack-4.6 {filling} {
pack append .pack .pack.red {right padx 20 pady 30 fill}
update
winfo geometry .pack.red
@@ -224,55 +221,55 @@ test pack-4.6 {filling} {
pack append .pack .pack.red top .pack.green top .pack.blue top \
.pack.violet top
update
-test pack-5.1 {multiple windows} {winfo geometry .pack.red} 10x20+45+0
-test pack-5.2 {multiple windows} {winfo geometry .pack.green} 30x40+35+20
-test pack-5.3 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60
-test pack-5.4 {multiple windows} {winfo ismapped .pack.violet} 0
+test oldpack-5.1 {multiple windows} {winfo geometry .pack.red} 10x20+45+0
+test oldpack-5.2 {multiple windows} {winfo geometry .pack.green} 30x40+35+20
+test oldpack-5.3 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60
+test oldpack-5.4 {multiple windows} {winfo ismapped .pack.violet} 0
pack b .pack.blue .pack.violet top
update
-test pack-5.5 {multiple windows} {winfo ismapped .pack.violet} 1
-test pack-5.6 {multiple windows} {winfo geometry .pack.violet} 80x20+10+60
-test pack-5.7 {multiple windows} {winfo geometry .pack.blue} 40x20+30+80
+test oldpack-5.5 {multiple windows} {winfo ismapped .pack.violet} 1
+test oldpack-5.6 {multiple windows} {winfo geometry .pack.violet} 80x20+10+60
+test oldpack-5.7 {multiple windows} {winfo geometry .pack.blue} 40x20+30+80
pack after .pack.blue .pack.red top
update
-test pack-5.8 {multiple windows} {winfo geometry .pack.green} 30x40+35+0
-test pack-5.9 {multiple windows} {winfo geometry .pack.violet} 80x20+10+40
-test pack-5.10 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60
-test pack-5.11 {multiple windows} {winfo ismapped .pack.red} 0
+test oldpack-5.8 {multiple windows} {winfo geometry .pack.green} 30x40+35+0
+test oldpack-5.9 {multiple windows} {winfo geometry .pack.violet} 80x20+10+40
+test oldpack-5.10 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60
+test oldpack-5.11 {multiple windows} {winfo ismapped .pack.red} 0
pack before .pack.green .pack.red right .pack.blue left
update
-test pack-5.12 {multiple windows} {winfo ismapped .pack.red} 1
-test pack-5.13 {multiple windows} {winfo geometry .pack.red} 10x20+90+40
-test pack-5.14 {multiple windows} {winfo geometry .pack.blue} 40x40+0+30
-test pack-5.15 {multiple windows} {winfo geometry .pack.green} 30x40+50+0
-test pack-5.16 {multiple windows} {winfo geometry .pack.violet} 50x20+40+40
+test oldpack-5.12 {multiple windows} {winfo ismapped .pack.red} 1
+test oldpack-5.13 {multiple windows} {winfo geometry .pack.red} 10x20+90+40
+test oldpack-5.14 {multiple windows} {winfo geometry .pack.blue} 40x40+0+30
+test oldpack-5.15 {multiple windows} {winfo geometry .pack.green} 30x40+50+0
+test oldpack-5.16 {multiple windows} {winfo geometry .pack.violet} 50x20+40+40
pack append .pack .pack.violet left .pack.green bottom .pack.red bottom \
.pack.blue bottom
update
-test pack-5.17 {multiple windows} {winfo geometry .pack.violet} 80x20+0+40
-test pack-5.18 {multiple windows} {winfo geometry .pack.green} 20x40+80+60
-test pack-5.19 {multiple windows} {winfo geometry .pack.red} 10x20+85+40
-test pack-5.20 {multiple windows} {winfo geometry .pack.blue} 20x40+80+0
+test oldpack-5.17 {multiple windows} {winfo geometry .pack.violet} 80x20+0+40
+test oldpack-5.18 {multiple windows} {winfo geometry .pack.green} 20x40+80+60
+test oldpack-5.19 {multiple windows} {winfo geometry .pack.red} 10x20+85+40
+test oldpack-5.20 {multiple windows} {winfo geometry .pack.blue} 20x40+80+0
pack after .pack.blue .pack.blue top .pack.red right .pack.green right \
.pack.violet right
update
-test pack-5.21 {multiple windows} {winfo geometry .pack.blue} 40x40+30+0
-test pack-5.22 {multiple windows} {winfo geometry .pack.red} 10x20+90+60
-test pack-5.23 {multiple windows} {winfo geometry .pack.green} 30x40+60+50
-test pack-5.24 {multiple windows} {winfo geometry .pack.violet} 60x20+0+60
+test oldpack-5.21 {multiple windows} {winfo geometry .pack.blue} 40x40+30+0
+test oldpack-5.22 {multiple windows} {winfo geometry .pack.red} 10x20+90+60
+test oldpack-5.23 {multiple windows} {winfo geometry .pack.green} 30x40+60+50
+test oldpack-5.24 {multiple windows} {winfo geometry .pack.violet} 60x20+0+60
pack after .pack.blue .pack.red left .pack.green left .pack.violet left
update
-test pack-5.25 {multiple windows} {winfo geometry .pack.blue} 40x40+30+0
-test pack-5.26 {multiple windows} {winfo geometry .pack.red} 10x20+0+60
-test pack-5.27 {multiple windows} {winfo geometry .pack.green} 30x40+10+50
-test pack-5.28 {multiple windows} {winfo geometry .pack.violet} 60x20+40+60
+test oldpack-5.25 {multiple windows} {winfo geometry .pack.blue} 40x40+30+0
+test oldpack-5.26 {multiple windows} {winfo geometry .pack.red} 10x20+0+60
+test oldpack-5.27 {multiple windows} {winfo geometry .pack.green} 30x40+10+50
+test oldpack-5.28 {multiple windows} {winfo geometry .pack.violet} 60x20+40+60
pack append .pack .pack.violet left .pack.green left .pack.blue left \
.pack.red left
update
-test pack-5.29 {multiple windows} {winfo geometry .pack.violet} 80x20+0+40
-test pack-5.30 {multiple windows} {winfo geometry .pack.green} 20x40+80+30
-test pack-5.31 {multiple windows} {winfo ismapped .pack.blue} 0
-test pack-5.32 {multiple windows} {winfo ismapped .pack.red} 0
+test oldpack-5.29 {multiple windows} {winfo geometry .pack.violet} 80x20+0+40
+test oldpack-5.30 {multiple windows} {winfo geometry .pack.green} 20x40+80+30
+test oldpack-5.31 {multiple windows} {winfo ismapped .pack.blue} 0
+test oldpack-5.32 {multiple windows} {winfo ismapped .pack.red} 0
# Test the ability of the packer to propagate geometry information
@@ -284,25 +281,25 @@ test pack-5.32 {multiple windows} {winfo ismapped .pack.red} 0
pack append .pack .pack.red top .pack.green top .pack.blue top \
.pack.violet top
update
-test pack-6.1 {geometry propagation} {winfo reqwidth .pack} 80
-test pack-6.2 {geometry propagation} {winfo reqheight .pack} 120
+test oldpack-6.1 {geometry propagation} {winfo reqwidth .pack} 80
+test oldpack-6.2 {geometry propagation} {winfo reqheight .pack} 120
destroy .pack.violet
update
-test pack-6.3 {geometry propagation} {winfo reqwidth .pack} 40
-test pack-6.4 {geometry propagation} {winfo reqheight .pack} 100
+test oldpack-6.3 {geometry propagation} {winfo reqwidth .pack} 40
+test oldpack-6.4 {geometry propagation} {winfo reqheight .pack} 100
frame .pack.violet -width 80 -height 20 -bg violet
label .pack.violet.l -text P -bd 2 -relief raised
place .pack.violet.l -relwidth 1.0 -relheight 1.0
pack append .pack .pack.red left .pack.green right .pack.blue bottom \
.pack.violet top
update
-test pack-6.5 {geometry propagation} {winfo reqwidth .pack} 120
-test pack-6.6 {geometry propagation} {winfo reqheight .pack} 60
+test oldpack-6.5 {geometry propagation} {winfo reqwidth .pack} 120
+test oldpack-6.6 {geometry propagation} {winfo reqheight .pack} 60
pack append .pack .pack.violet top .pack.green top .pack.blue left \
.pack.red left
update
-test pack-6.7 {geometry propagation} {winfo reqwidth .pack} 80
-test pack-6.8 {geometry propagation} {winfo reqheight .pack} 100
+test oldpack-6.7 {geometry propagation} {winfo reqwidth .pack} 80
+test oldpack-6.8 {geometry propagation} {winfo reqheight .pack} 100
# Test the "expand" option, and make sure space is evenly divided
# when several windows request expansion.
@@ -310,21 +307,21 @@ test pack-6.8 {geometry propagation} {winfo reqheight .pack} 100
pack append .pack .pack.violet top .pack.green {left e} \
.pack.blue {left expand} .pack.red {left expand}
update
-test pack-7.1 {multiple expanded windows} {
+test oldpack-7.1 {multiple expanded windows} {
pack append .pack .pack.violet top .pack.green {left e} \
.pack.blue {left expand} .pack.red {left expand}
update
list [winfo geometry .pack.green] [winfo geometry .pack.blue] \
[winfo geometry .pack.red]
} {30x40+3+40 40x40+39+40 10x20+86+50}
-test pack-7.2 {multiple expanded windows} {
+test oldpack-7.2 {multiple expanded windows} {
pack append .pack .pack.green left .pack.violet {bottom expand} \
.pack.blue {bottom expand} .pack.red {bottom expand}
update
list [winfo geometry .pack.violet] [winfo geometry .pack.blue] \
[winfo geometry .pack.red]
} {70x20+30+77 40x40+45+30 10x20+60+3}
-test pack-7.3 {multiple expanded windows} {
+test oldpack-7.3 {multiple expanded windows} {
foreach i [winfo child .pack] {
pack unpack $i
}
@@ -334,7 +331,7 @@ test pack-7.3 {multiple expanded windows} {
list [winfo geometry .pack.green] [winfo geometry .pack.red] \
[winfo geometry .pack.blue]
} {40x100+0+0 20x100+40+0 40x40+60+0}
-test pack-7.4 {multiple expanded windows} {
+test oldpack-7.4 {multiple expanded windows} {
foreach i [winfo child .pack] {
pack unpack $i
}
@@ -344,7 +341,7 @@ test pack-7.4 {multiple expanded windows} {
list [winfo geometry .pack.red] [winfo geometry .pack.violet] \
[winfo geometry .pack.blue]
} {10x20+45+5 80x20+10+35 40x40+60+60}
-test pack-7.5 {multiple expanded windows} {
+test oldpack-7.5 {multiple expanded windows} {
foreach i [winfo child .pack] {
pack unpack $i
}
@@ -352,7 +349,7 @@ test pack-7.5 {multiple expanded windows} {
update
list [winfo geometry .pack.green] [winfo geometry .pack.red]
} {30x40+70+60 10x20+30+40}
-test pack-7.6 {multiple expanded windows} {
+test oldpack-7.6 {multiple expanded windows} {
foreach i [winfo child .pack] {
pack unpack $i
}
@@ -367,116 +364,116 @@ test pack-7.6 {multiple expanded windows} {
# Syntax errors on pack commands
-test pack-8.1 {syntax errors} {
+test oldpack-8.1 {syntax errors} {
set msg ""
set result [catch {pack} msg]
concat $result $msg
} {1 wrong # args: should be "pack option arg ?arg ...?"}
-test pack-8.2 {syntax errors} {
+test oldpack-8.2 {syntax errors} {
set msg ""
set result [catch {pack append} msg]
concat $result $msg
} {1 wrong # args: should be "pack option arg ?arg ...?"}
-test pack-8.3 {syntax errors} {
+test oldpack-8.3 {syntax errors} {
set msg ""
set result [catch {pack gorp foo} msg]
concat $result $msg
} {1 bad option "gorp": must be configure, forget, info, propagate, or slaves}
-test pack-8.4 {syntax errors} {
+test oldpack-8.4 {syntax errors} {
set msg ""
set result [catch {pack a .pack} msg]
concat $result $msg
} {1 bad option "a": must be configure, forget, info, propagate, or slaves}
-test pack-8.5 {syntax errors} {
+test oldpack-8.5 {syntax errors} {
set msg ""
set result [catch {pack after foobar} msg]
concat $result $msg
} {1 bad window path name "foobar"}
-test pack-8.6 {syntax errors} {
+test oldpack-8.6 {syntax errors} {
frame .pack.yellow -bg yellow
set msg ""
set result [catch {pack after .pack.yellow} msg]
destroy .pack.yellow
concat $result $msg
} {1 window ".pack.yellow" isn't packed}
-test pack-8.7 {syntax errors} {
+test oldpack-8.7 {syntax errors} {
set msg ""
set result [catch {pack append foobar} msg]
concat $result $msg
} {1 bad window path name "foobar"}
-test pack-8.8 {syntax errors} {
+test oldpack-8.8 {syntax errors} {
set msg ""
set result [catch {pack before foobar} msg]
concat $result $msg
} {1 bad window path name "foobar"}
-test pack-8.9 {syntax errors} {
+test oldpack-8.9 {syntax errors} {
frame .pack.yellow -bg yellow
set msg ""
set result [catch {pack before .pack.yellow} msg]
destroy .pack.yellow
concat $result $msg
} {1 window ".pack.yellow" isn't packed}
-test pack-8.10 {syntax errors} {
+test oldpack-8.10 {syntax errors} {
set msg ""
set result [catch {pack info .pack help} msg]
concat $result $msg
} {1 wrong # args: should be "pack info window"}
-test pack-8.11 {syntax errors} {
+test oldpack-8.11 {syntax errors} {
set msg ""
set result [catch {pack info foobar} msg]
concat $result $msg
} {1 bad window path name "foobar"}
-test pack-8.12 {syntax errors} {
+test oldpack-8.12 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue} msg]
concat $result $msg
} {1 wrong # args: window ".pack.blue" should be followed by options}
-test pack-8.13 {syntax errors} {
+test oldpack-8.13 {syntax errors} {
set msg ""
set result [catch {pack append . .pack.blue top} msg]
concat $result $msg
} {1 can't pack .pack.blue inside .}
-test pack-8.14 {syntax errors} {
+test oldpack-8.14 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue f} msg]
concat $result $msg
} {1 bad option "f": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame}
-test pack-8.15 {syntax errors} {
+test oldpack-8.15 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue pad} msg]
concat $result $msg
} {1 bad option "pad": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame}
-test pack-8.16 {syntax errors} {
+test oldpack-8.16 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue {frame south}} msg]
concat $result $msg
} {1 bad anchor "south": must be n, ne, e, se, s, sw, w, nw, or center}
-test pack-8.17 {syntax errors} {
+test oldpack-8.17 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue {padx -2}} msg]
concat $result $msg
} {1 bad pad value "-2": must be positive screen distance}
-test pack-8.18 {syntax errors} {
+test oldpack-8.18 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue {padx}} msg]
concat $result $msg
} {1 wrong # args: "padx" option must be followed by screen distance}
-test pack-8.19 {syntax errors} {
+test oldpack-8.19 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue {pady -2}} msg]
concat $result $msg
} {1 bad pad value "-2": must be positive screen distance}
-test pack-8.20 {syntax errors} {
+test oldpack-8.20 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue {pady}} msg]
concat $result $msg
} {1 wrong # args: "pady" option must be followed by screen distance}
-test pack-8.21 {syntax errors} {
+test oldpack-8.21 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue "\{abc"} msg]
concat $result $msg
} {1 unmatched open brace in list}
-test pack-8.22 {syntax errors} {
+test oldpack-8.22 {syntax errors} {
set msg ""
set result [catch {pack append .pack .pack.blue frame} msg]
concat $result $msg
@@ -484,21 +481,21 @@ test pack-8.22 {syntax errors} {
# Test "pack info" command output.
-test pack-9.1 {information output} {
+test oldpack-9.1 {information output} {
pack append .pack .pack.blue {top fillx frame n} \
.pack.red {bottom filly frame s} .pack.green {left fill frame w} \
.pack.violet {right expand frame e}
list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
[pack info .pack.green] [pack info .pack.violet]
} {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor n -expand 0 -fill x -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor s -expand 0 -fill y -ipadx 0 -ipady 0 -padx 0 -pady 0 -side bottom} {-in .pack -anchor w -expand 0 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left} {-in .pack -anchor e -expand 1 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side right}}
-test pack-9.2 {information output} {
+test oldpack-9.2 {information output} {
pack append .pack .pack.blue {padx 10 frame nw} \
.pack.red {pady 20 frame ne} .pack.green {frame se} \
.pack.violet {frame sw}
list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
[pack info .pack.green] [pack info .pack.violet]
} {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor nw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 5 -pady 0 -side top} {-in .pack -anchor ne -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 10 -side top} {-in .pack -anchor se -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor sw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}}
-test pack-9.3 {information output} {
+test oldpack-9.3 {information output} {
pack append .pack .pack.blue {frame center} .pack.red {frame center} \
.pack.green {frame c} .pack.violet {frame c}
list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
@@ -508,18 +505,5 @@ test pack-9.3 {information output} {
catch {destroy .pack}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/option.test b/tests/option.test
index 0cc2d14..49d2975 100644
--- a/tests/option.test
+++ b/tests/option.test
@@ -7,14 +7,10 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
+testConstraint appNameIsTktest [expr {[winfo name .] eq "tktest"}]
catch {destroy .op1}
catch {destroy .op2}
@@ -197,9 +193,7 @@ test option-15.1 {database files} {
} {1 {couldn't open "non-existent": no such file or directory}}
option read $option1
test option-15.2 {database files} {option get . x1 color} blue
-if {$appName == "tktest"} {
- test option-15.3 {database files} {option get . x2 color} green
-}
+test option-15.3 {database files} appNameIsTktest {option get . x2 color} green
test option-15.4 {database files} {option get . x3 color} purple
test option-15.5 {database files} {option get . {x 4} color} brown
test option-15.6 {database files} {option get . x6 color} {}
@@ -229,18 +223,5 @@ catch {destroy .op1}
catch {destroy .op2}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/pack.test b/tests/pack.test
index 1784b97..edb9f18 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Utility procedures:
@@ -133,7 +130,7 @@ test pack-2.11 {x padding and filling} {
test pack-2.12 {x padding and filling} {
pack1 -side top -ipadx 5 -padx 10 -fill x
} {280x40+10+0 300x160+0+40}
-test pack-2.12 {x padding and filling} {
+test pack-2.12a {x padding and filling} {
pack1 -side top -ipadx 5 -padx {5 15} -fill x
} {280x40+5+0 300x160+0+40}
set pad [winfo pixels .pack 1c]
@@ -613,6 +610,12 @@ test pack-10.2 {retaining/clearing configuration state} {
pack .pack.a -pady 14
pack info .pack.a
} {-in .pack -anchor n -expand 1 -fill both -ipadx 3 -ipady 4 -padx 1 -pady 14 -side bottom}
+test pack-10.3 {bad -in window does not change master} {
+ pack forget .pack.a .pack.b .pack.c .pack.d
+ list [winfo manager .pack.a] \
+ [catch {pack .pack.a -in .pack.a} err] $err \
+ [winfo manager .pack.a]
+} {{} 1 {can't pack .pack.a inside itself} {}}
test pack-11.1 {info option} {
pack4 -in .pack
@@ -1103,5 +1106,5 @@ foreach i {pack1 pack2 pack3 pack4} {
}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/panedwindow.test b/tests/panedwindow.test
index 243da98..c7d84b8 100644
--- a/tests/panedwindow.test
+++ b/tests/panedwindow.test
@@ -7,73 +7,84 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
set i 1
panedwindow .p
-foreach test {
- {-background "#ff0000" "#ff0000" non-existent
- {unknown color name "non-existent"}}
- {-bd 4 4 badValue {bad screen distance "badValue"}}
- {-bg "#ff0000" "#ff0000" non-existent {unknown color name "non-existent"}}
- {-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
- {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
- {-handlesize 20 20 badValue {bad screen distance "badValue"}}
- {-height 20 20 badValue {bad screen distance "badValue"}}
- {-opaqueresize true 1 foo {expected boolean value but got "foo"}}
- {-orient horizontal horizontal badValue
- {bad orient "badValue": must be horizontal or vertical}}
- {-relief groove groove 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
- {-sashcursor arrow arrow badValue {bad cursor spec "badValue"}}
- {-sashpad 1.3 1 badValue {bad screen distance "badValue"}}
- {-sashrelief groove groove 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
- {-sashwidth 10 10 badValue {bad screen distance "badValue"}}
- {-showhandle true 1 foo {expected boolean value but got "foo"}}
- {-width 402 402 badValue {bad screen distance "badValue"}}
+foreach {testName testData} {
+ panedwindow-1.1 {-background
+ "#ff0000" "#ff0000" non-existent {unknown color name "non-existent"}}
+ panedwindow-1.2 {-bd
+ 4 4 badValue {bad screen distance "badValue"}}
+ panedwindow-1.3 {-bg
+ "#ff0000" "#ff0000" non-existent {unknown color name "non-existent"}}
+ panedwindow-1.4 {-borderwidth
+ 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1.5 {-cursor
+ arrow arrow badValue {bad cursor spec "badValue"}}
+ panedwindow-1.6 {-handlesize
+ 20 20 badValue {bad screen distance "badValue"}}
+ panedwindow-1.7 {-height
+ 20 20 badValue {bad screen distance "badValue"}}
+ panedwindow-1.8 {-opaqueresize
+ true 1 foo {expected boolean value but got "foo"}}
+ panedwindow-1.9 {-orient
+ horizontal horizontal
+ badValue {bad orient "badValue": must be horizontal or vertical}}
+ panedwindow-1.10 {-relief
+ groove groove
+ 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
+ panedwindow-1.11 {-sashcursor
+ arrow arrow badValue {bad cursor spec "badValue"}}
+ panedwindow-1.12 {-sashpad
+ 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1.13 {-sashrelief
+ groove groove
+ 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
+ panedwindow-1.14 {-sashwidth
+ 10 10 badValue {bad screen distance "badValue"}}
+ panedwindow-1.15 {-showhandle
+ true 1 foo {expected boolean value but got "foo"}}
+ panedwindow-1.16 {-width
+ 402 402 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
- test panedwindow-1.$i {configuration options} {
- .p configure $name [lindex $test 1]
- list [lindex [.p configure $name] 4] [.p cget $name]
- } [list [lindex $test 2] [lindex $test 2]]
- incr i
- if {[lindex $test 3] != ""} {
- test panedwindow-1.$i {configuration options} {
- list [catch {.p configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
- }
- .p configure $name [lindex [.p configure $name] 3]
- incr i
+ lassign $testData optionName goodIn goodOut badIn badOut
+ test ${testName}(good) "configuration options: $optionName" {
+ .p configure $optionName $goodIn
+ list [lindex [.p configure $optionName] 4] [.p cget $optionName]
+ } [list $goodOut $goodOut]
+ test ${testName}(bad) "configuration options: $optionName" -body {
+ .p configure $optionName $badIn
+ } -returnCodes error -result $badOut
+ # Reset to default
+ .p configure $optionName [lindex [.p configure $optionName] 3]
}
.p add [button .b]
.p add [button .c]
-foreach test {
- {-after .c .c badValue {bad window path name "badValue"}}
- {-before .c .c badValue {bad window path name "badValue"}}
- {-height 10 10 badValue {bad screen distance "badValue"}}
- {-minsize 10 10 badValue {bad screen distance "badValue"}}
- {-padx 1.3 1 badValue {bad screen distance "badValue"}}
- {-pady 1.3 1 badValue {bad screen distance "badValue"}}
- {-sticky nsew nesw abcd {bad stickyness value "abcd": must be a string containing zero or more of n, e, s, and w}}
- {-width 10 10 badValue {bad screen distance "badValue"}}
+foreach {testName testData} {
+ panedwindow-1a.1 {-after .c .c badValue {bad window path name "badValue"}}
+ panedwindow-1a.2 {-before .c .c badValue {bad window path name "badValue"}}
+ panedwindow-1a.3 {-height 10 10 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.4 {-hide false 0 foo {expected boolean value but got "foo"}}
+ panedwindow-1a.5 {-minsize 10 10 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.6 {-padx 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.7 {-pady 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.8 {-sticky nsew nesw abcd {bad stickyness value "abcd": must be a string containing zero or more of n, e, s, and w}}
+ panedwindow-1a.9 {-stretch alw always foo {bad stretch "foo": must be always, first, last, middle, or never}}
+ panedwindow-1a.10 {-width 10 10 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
- test panedwindow-1.$i {configuration options} {
- .p paneconfigure .b $name [lindex $test 1]
- list [lindex [.p paneconfigure .b $name] 4] [.p panecget .b $name]
- } [list [lindex $test 2] [lindex $test 2]]
- incr i
- if {[lindex $test 3] != ""} {
- test panedwindow-1.$i {configuration options} {
- list [catch {.p paneconfigure .b $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
- }
- .p paneconfigure .b $name [lindex [.p paneconfigure .b $name] 3]
- incr i
+ lassign $testData optionName goodIn goodOut badIn badOut
+ test ${testName}(good) "configuration options: $optionName" {
+ .p paneconfigure .b $optionName $goodIn
+ list [lindex [.p paneconfigure .b $optionName] 4] \
+ [.p panecget .b $optionName]
+ } [list $goodOut $goodOut]
+ test ${testName}(bad) "configuration options: $optionName" -body {
+ .p paneconfigure .b $optionName $badIn
+ } -returnCodes error -result $badOut
+ # Reset to default
+ .p paneconfig .b $optionName [lindex [.p paneconfig .b $optionName] 3]
}
destroy .p .b .c
@@ -1936,7 +1947,7 @@ test panedwindow-22.16 {ArrangePanes, last pane grows} {
[winfo width .f4] [winfo width .p]
}
-cleanup {destroy .p .f1 .f2 .f3 .f4}
- -result {50 150 1 1 222 50 150 1 78 300}
+ -result {50 150 1 1 211 50 150 1 89 300}
}
@@ -2246,6 +2257,178 @@ test panedwindow-24.28 {ConfigurePanes, restrict possible panes} {
destroy .f .f.f .f.f.f .f.f.f.p .b
set result
} [list 0 ""]
+test panedwindow-24.29.1 {ConfigurePanes, -hide works} {
+ -body {
+ panedwindow .p -showhandle false
+ frame .f1 -width 40 -height 100 -bg red
+ frame .f2 -width 40 -height 100 -bg white
+ frame .f3 -width 40 -height 100 -bg blue
+ frame .f4 -width 40 -height 100 -bg green
+ .p add .f1 .f2 .f3 .f4
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo ismapped .f1] [winfo ismapped .f2] \
+ [winfo ismapped .f3] [winfo ismapped .f4]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4] [winfo width .p]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo ismapped .f1] [winfo ismapped .f2] \
+ [winfo ismapped .f3] [winfo ismapped .f4]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4] [winfo width .p]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3 .f4}
+ -result {1 1 1 1 40 40 40 40 171 1 0 1 1 40 40 40 40 128}
+}
+test panedwindow-24.29.2 {ConfigurePanes, -hide works} {
+ -body {
+ panedwindow .p -showhandle false -width 130 -height 100
+ frame .f1 -width 40 -bg red
+ frame .f2 -width 40 -bg white
+ frame .f3 -width 40 -bg blue
+ frame .f4 -width 40 -bg green
+ .p add .f1 .f2 .f3 .f4
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo ismapped .f1] [winfo ismapped .f2] \
+ [winfo ismapped .f3] [winfo ismapped .f4]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4] [winfo width .p]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo ismapped .f1] [winfo ismapped .f2] \
+ [winfo ismapped .f3] [winfo ismapped .f4]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4] [winfo width .p]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3 .f4}
+ -result {1 1 1 0 39 40 40 1 130 1 0 1 1 40 40 40 42 130}
+}
+test panedwindow-24.29.3 {ConfigurePanes, -hide works, last pane stretches} {
+ -body {
+ panedwindow .p -showhandle false -width 200 -height 200 -borderwidth 0
+ frame .f1 -width 50 -bg red
+ frame .f2 -width 50 -bg green
+ frame .f3 -width 50 -bg blue
+ .p add .f1 .f2 .f3
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3}
+ -result {50 50 94 50 50 147}
+}
+test panedwindow-24.29.4 {ConfigurePanes, -hide works, last pane stretches} {
+ -body {
+ panedwindow .p -showhandle false -width 200 -height 200 \
+ -borderwidth 0 -orient vertical
+ frame .f1 -height 50 -bg red
+ frame .f2 -height 50 -bg green
+ frame .f3 -height 50 -bg blue
+ .p add .f1 .f2 .f3
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo height .f1] [winfo height .f2] [winfo height .f3]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo height .f1] [winfo height .f2] [winfo height .f3]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3}
+ -result {50 50 94 50 50 147}
+}
+
+test panedwindow-24.30 {ConfigurePanes, -stretch first} {
+ -body {
+ panedwindow .p -showhandle false -height 100 -width 182
+ frame .f1 -width 40 -bg red
+ frame .f2 -width 40 -bg white
+ frame .f3 -width 40 -bg blue
+ frame .f4 -width 40 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch first
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3 .f4}
+ -result {51 40 40 40 94 40 40 40}
+}
+test panedwindow-24.31 {ConfigurePanes, -stretch middle} {
+ -body {
+ panedwindow .p -showhandle false -height 100 -width 182
+ frame .f1 -width 40 -bg red
+ frame .f2 -width 40 -bg white
+ frame .f3 -width 40 -bg blue
+ frame .f4 -width 40 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch middle
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3 .f4}
+ -result {40 45 46 40 40 45 94 40}
+}
+test panedwindow-24.32 {ConfigurePanes, -stretch always} {
+ -body {
+ panedwindow .p -showhandle false -height 100 -width 182
+ frame .f1 -width 40 -bg red
+ frame .f2 -width 40 -bg white
+ frame .f3 -width 40 -bg blue
+ frame .f4 -width 40 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch always
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3 .f4}
+ -result {42 43 43 43 58 43 58 58}
+}
+test panedwindow-24.33 {ConfigurePanes, -stretch never} {
+ -body {
+ panedwindow .p -showhandle false -height 100 -width 182
+ frame .f1 -width 40 -bg red
+ frame .f2 -width 40 -bg white
+ frame .f3 -width 40 -bg blue
+ frame .f4 -width 40 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch never
+ pack .p
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \
+ [winfo width .f4]
+ }
+ -cleanup {destroy .p .f1 .f2 .f3 .f4}
+ -result {40 40 40 40 40 40 40 40}
+}
test panedwindow-25.1 {Unlink, remove a paned with -before/-after refs} {
# Bug 928413
@@ -2587,5 +2770,5 @@ test panedwindow-30.2 {display on depths other than the default one} {
}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/place.test b/tests/place.test
index 112cc78..ac2ece7 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -6,10 +6,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Used for constraining memory leak tests
@@ -88,6 +85,12 @@ test place-4.1 {ConfigureSlave procedure, bad -in options} {
} [list 1 "can't place .t.f2 relative to itself"]
test place-4.2 {ConfigureSlave procedure, bad -in option} {
place forget .t.f2
+ list [winfo manager .t.f2] \
+ [catch {place .t.f2 -in .t.f2} err] $err \
+ [winfo manager .t.f2]
+} {{} 1 {can't place .t.f2 relative to itself} {}}
+test place-4.3 {ConfigureSlave procedure, bad -in option} {
+ place forget .t.f2
list [catch {place .t.f2 -in .} msg] $msg
} [list 1 "can't place .t.f2 relative to ."]
@@ -422,5 +425,5 @@ test place-14.1 {memory leak testing} -setup {
catch {destroy .t}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/pwrdLogo150.gif b/tests/pwrdLogo150.gif
new file mode 100644
index 0000000..89eec7c
--- /dev/null
+++ b/tests/pwrdLogo150.gif
Binary files differ
diff --git a/tests/raise.test b/tests/raise.test
index 33bddda..a17fa2e 100644
--- a/tests/raise.test
+++ b/tests/raise.test
@@ -9,14 +9,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint testmakeexist [llength [info commands testmakeexist]]
-
# Procedure to create a bunch of overlapping windows, which should
# make it easy to detect differences in order.
@@ -288,18 +283,5 @@ test raise-7.8 {errors in raise/lower commands} {
deleteWindows
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/safe.test b/tests/safe.test
index 10c8b29..3e9f716 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
## NOTE: Any time tests fail here with an error like:
@@ -35,16 +32,14 @@ tcltest::loadTestedCommands
# The set of hidden commands is platform dependent:
-if {"$tcl_platform(platform)" == "macintosh"} {
- set hidden_cmds {beep bell cd clipboard echo encoding exit fconfigure file glob grab load ls menu open pwd selection send socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile toplevel wm}
-} elseif {"$tcl_platform(platform)" == "windows"} {
- set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel wm}
+if {[string equal $tcl_platform(platform) "windows"]} {
+ set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel unload wm}
} else {
- set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source toplevel wm}
+ set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source toplevel unload wm}
}
set saveAutoPath $::auto_path
-set ::auto_path [list [info library] $::tk_library]
+set auto_path [list [info library] $::tk_library]
test safe-1.1 {Safe Tk loading into an interpreter} {
catch {safe::interpDelete a}
@@ -217,5 +212,5 @@ test safe-7.1 {canvas printing} {
# cleanup
set ::auto_path $saveAutoPath
unset hidden_cmds
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/scale.test b/tests/scale.test
index ae36982..657f668 100644
--- a/tests/scale.test
+++ b/tests/scale.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Create entries in the option database to be sure that geometry options
@@ -79,7 +76,7 @@ foreach test {
lindex [.s configure $name] 4
} [lindex $test 2]
incr i
- if {[lindex $test 3] != ""} {
+ if {[lindex $test 3] ne ""} {
test scale-1.$i {configuration options} {
list [catch {.s configure $name [lindex $test 3]} msg] $msg
} [list 1 [lindex $test 4]]
@@ -869,5 +866,5 @@ catch {destroy .s}
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index c410c68..5d4334f 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -8,18 +8,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-## testmetrics is a win/mac only test command
-##
-testConstraint testmetrics [llength [info commands testmetrics]]
-
-update
-
proc scroll args {
global scrollInfo
set scrollInfo $args
@@ -91,43 +82,45 @@ foreach test {
{-troughcolor #432 #432 lousy {unknown color name "lousy"}}
{-width 32 32 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
- test scrollbar-1.1 {configuration options} {
- .s configure $name [lindex $test 1]
- lindex [.s configure $name] 4
- } [lindex $test 2]
+ lassign $test name value okResult badValue badResult
+ # Assume $name is plain; true of all our in-use options!
+ test scrollbar-1.$i {configuration options} \
+ ".s configure $name [list $value]; .s cget $name" $okResult
incr i
- if {[lindex $test 3] != ""} {
- test scrollbar-1.2 {configuration options} {
- list [catch {.s configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
+ if {$badValue ne ""} {
+ test scrollbar-1.$i {configuration options} \
+ -body [list .s configure $name $badValue] \
+ -returnCodes error -result $badResult
+ incr i
}
.s configure $name [lindex [.s configure $name] 3]
- incr i
}
destroy .s
-test scrollbar-2.1 {Tk_ScrollbarCmd procedure} {
- list [catch {scrollbar} msg] $msg
-} {1 {wrong # args: should be "scrollbar pathName ?options?"}}
-test scrollbar-2.2 {Tk_ScrollbarCmd procedure} {
- list [catch {scrollbar gorp} msg] $msg
-} {1 {bad window path name "gorp"}}
-test scrollbar-2.3 {Tk_ScrollbarCmd procedure} {
+test scrollbar-2.1 {Tk_ScrollbarCmd procedure} -returnCodes error -body {
+ scrollbar
+} -result {wrong # args: should be "scrollbar pathName ?options?"}
+test scrollbar-2.2 {Tk_ScrollbarCmd procedure} -body {
+ scrollbar gorp
+} -returnCodes error -result {bad window path name "gorp"}
+test scrollbar-2.3 {Tk_ScrollbarCmd procedure} -setup {
scrollbar .s
- set x "[winfo class .s] [info command .s]"
+} -body {
+ list [winfo class .s] [info command .s]
+} -cleanup {
destroy .s
- set x
-} {Scrollbar .s}
+} -result {Scrollbar .s}
test scrollbar-2.4 {Tk_ScrollbarCmd procedure} {
list [catch {scrollbar .s -gorp blah} msg] $msg [winfo exists .s] \
[info command .s]
} {1 {unknown option "-gorp"} 0 {}}
-test scrollbar-2.5 {Tk_ScrollbarCmd procedure} {
- set x [scrollbar .s]
+test scrollbar-2.5 {Tk_ScrollbarCmd procedure} -setup {
+ catch {destroy .s}
+} -body {
+ scrollbar .s
+} -cleanup {
destroy .s
- set x
-} {.s}
+} -result .s
scrollbar .s -orient vertical -command scroll -highlightthickness 2 -bd 2
pack .s -side right -fill y
@@ -168,18 +161,24 @@ test scrollbar-3.10 {ScrollbarWidgetCmd procedure, "cget" option} {
list [catch {.s cget -orient} msg] $msg
} {0 vertical}
scrollbar .s2
-test scrollbar-3.11 {ScrollbarWidgetCmd procedure, "cget" option} {pcOnly} {
- list [catch {.s2 cget -bd} msg] $msg
-} {0 0}
-test scrollbar-3.12 {ScrollbarWidgetCmd procedure, "cget" option} {macOrUnix} {
- list [catch {.s2 cget -bd} msg] $msg
-} {0 2}
-test scrollbar-3.13 {ScrollbarWidgetCmd procedure, "cget" option} {pcOnly} {
- list [catch {.s2 cget -highlightthickness} msg] $msg
-} {0 0}
-test scrollbar-3.14 {ScrollbarWidgetCmd procedure, "cget" option} {macOrUnix} {
- list [catch {.s2 cget -highlightthickness} msg] $msg
-} {0 1}
+test scrollbar-3.11 {ScrollbarWidgetCmd procedure, "cget" option} {
+ expr {[.s2 cget -bd] == [lindex [.s2 configure -bd] 3]}
+} 1
+test scrollbar-3.12 {ScrollbarWidgetCmd procedure, "cget" option} emptyTest {
+ # empty test; duplicated scrollbar-3.11
+} {}
+test scrollbar-3.12.1 {ScrollbarWidgetCmd procedure, "cget" option} emptyTest {
+ # empty test; duplicated scrollbar-3.11
+} {}
+test scrollbar-3.13 {ScrollbarWidgetCmd procedure, "cget" option} {
+ expr {[.s2 cget -highlightthickness] == [lindex [.s2 configure -highlightthickness] 3]}
+} 1
+test scrollbar-3.14 {ScrollbarWidgetCmd procedure, "cget" option} emptyTest {
+ # empty test; duplicated scrollbar-3.13
+} {}
+test scrollbar-3.14.1 {ScrollbarWidgetCmd procedure, "cget" option} emptyTest {
+ # empty test; duplicated scrollbar-3.13
+} {}
destroy .s2
test scrollbar-3.15 {ScrollbarWidgetCmd procedure, "configure" option} {
llength [.s configure]
@@ -215,13 +214,13 @@ test scrollbar-3.24 {ScrollbarWidgetCmd procedure, "delta" option} {
list [catch {.s delta 18 xxyz} msg] $msg
} {1 {expected integer but got "xxyz"}}
test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} {
- .s delta 20 0
+ format {%.6g} [.s delta 20 0]
} {0}
test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} {
- .s delta 0 20
+ format {%.6g} [.s delta 0 20]
} [format %.6g [expr 20.0/([getTroughSize .s]-1)]]
test scrollbar-3.27 {ScrollbarWidgetCmd procedure, "delta" option} {
- .s delta 0 -20
+ format {%.6g} [.s delta 0 -20]
} [format %.6g [expr -20.0/([getTroughSize .s]-1)]]
test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} {
toplevel .t -width 250 -height 100
@@ -229,8 +228,8 @@ test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} {
scrollbar .t.s -orient horizontal -borderwidth 2
place .t.s -width 201
update
- set result [list [.t.s delta 0 20] \
- [.t.s delta [expr [getTroughSize .t.s] - 1] 0]]
+ set result [list [format {%.6g} [.t.s delta 0 20]] \
+ [format {%.6g} [.t.s delta [expr [getTroughSize .t.s] - 1] 0]]]
destroy .t
set result
} {0 1}
@@ -247,32 +246,30 @@ test scrollbar-3.32 {ScrollbarWidgetCmd procedure, "fraction" option} {
list [catch {.s fraction 24 bogus} msg] $msg
} {1 {expected integer but got "bogus"}}
test scrollbar-3.33 {ScrollbarWidgetCmd procedure, "fraction" option} {
- .s fraction 0 0
+ format {%.6g} [.s fraction 0 0]
} {0}
test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} {
- .s fraction 0 1000
+ format {%.6g} [.s fraction 0 1000]
} {1}
test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
- .s fraction 4 21
+ format {%.6g} [.s fraction 4 21]
} [format %.6g [expr (21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
/([getTroughSize .s] - 1)]]
-test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {unixOnly} {
- .s fraction 4 179
+test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} unix {
+ format {%.6g} [.s fraction 4 179]
} {1}
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
- .s fraction 4 [expr 200 - [testmetrics cyvscroll .s]]
+ format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s]]]
} {1}
-test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {unixOnly} {
- .s fraction 4 178
+test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} unix {
+ format {%.6g} [.s fraction 4 178]
} {0.993711}
-test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics pcOnly} {
- expr [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s] - 2]] \
+test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} {
+ expr \
+ [format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s] - 2]]] \
== [format %g [expr (200.0 - [testmetrics cyvscroll .s]*2 - 2) \
/ ($height - 1 - [testmetrics cyvscroll .s]*2)]]
} 1
-test scrollbar-3.40 {ScrollbarWidgetCmd procedure, "fraction" option} {macOnly} {
- .s fraction 4 178
-} {0.97006}
toplevel .t -width 250 -height 100
wm geom .t +0+0
@@ -281,7 +278,7 @@ place .t.s -width 201
update
test scrollbar-3.41 {ScrollbarWidgetCmd procedure, "fraction" option} {
- .t.s fraction 100 0
+ format {%.6g} [.t.s fraction 100 0]
} {0.5}
if {[testConstraint testmetrics]} {
place configure .t.s -width [expr 2*[testmetrics cxhscroll .t.s]+1]
@@ -290,7 +287,7 @@ if {[testConstraint testmetrics]} {
}
update
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} {
- .t.s fraction 100 0
+ format {%.6g} [.t.s fraction 100 0]
} {0}
destroy .t
test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} {
@@ -336,10 +333,7 @@ test scrollbar-3.53 {ScrollbarWidgetCmd procedure, "identify" option} {
test scrollbar-3.54 {ScrollbarWidgetCmd procedure, "identify" option} {unixOrPc} {
.s identify 5 195
} {arrow2}
-test scrollbar-3.55 {ScrollbarWidgetCmd procedure, "identify" option} {macOnly} {
- .s identify 5 195
-} {}
-test scrollbar-3.56 {ScrollbarWidgetCmd procedure, "identify" option} {unixOnly} {
+test scrollbar-3.56 {ScrollbarWidgetCmd procedure, "identify" option} unix {
.s identify 0 0
} {}
test scrollbar-3.57 {ScrollbarWidgetCmd procedure, "set" option} {
@@ -436,22 +430,17 @@ scrollbar .s -orient vertical -relief sunken -bd 2 -highlightthickness 2
pack .s -side left -fill y
.s set .2 .4
update
-test scrollbar-6.1 {ScrollbarPosition procedure} {unixOnly} {
+
+test scrollbar-6.1 {ScrollbarPosition procedure} unix {
.s identify 8 3
} {}
-test scrollbar-6.2 {ScrollbarPosition procedure} {macOnly} {
- .s identify 8 3
-} {arrow1}
-test scrollbar-6.3 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.3 {ScrollbarPosition procedure} unix {
.s identify 8 196
} {}
-test scrollbar-6.4 {ScrollbarPosition procedure} {unixOnly} {
+test scrollbar-6.4 {ScrollbarPosition procedure} unix {
.s identify 3 100
} {}
-test scrollbar-6.5 {ScrollbarPosition procedure} {macOnly} {
- .s identify 3 100
-} {trough2}
-test scrollbar-6.6 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.6 {ScrollbarPosition procedure} unix {
.s identify 19 100
} {}
test scrollbar-6.7 {ScrollbarPosition procedure} {
@@ -466,66 +455,56 @@ test scrollbar-6.9 {ScrollbarPosition procedure} {
test scrollbar-6.10 {ScrollbarPosition procedure} {
.s identify [winfo width .s] [expr [winfo height .s] / 2]
} {}
-
-test scrollbar-6.11 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.11 {ScrollbarPosition procedure} unix {
.s identify 8 4
} {arrow1}
-test scrollbar-6.12 {ScrollbarPosition procedure} {unixOnly} {
+test scrollbar-6.12 {ScrollbarPosition procedure} unix {
.s identify 8 19
} {arrow1}
-test scrollbar-6.13 {ScrollbarPosition procedure} {macOnly} {
- .s identify 8 19
-} {trough1}
-test scrollbar-6.14 {ScrollbarPosition procedure} {pcOnly} {
+test scrollbar-6.14 {ScrollbarPosition procedure} win {
.s identify [expr [winfo width .s] / 2] 0
} {arrow1}
-test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr [winfo width .s] / 2] [expr [testmetrics cyvscroll .s] - 1]
} {arrow1}
-
-test scrollbar-6.16 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.16 {ScrollbarPosition procedure} unix {
.s identify 8 20
} {trough1}
-test scrollbar-6.17 {ScrollbarPosition procedure} {macOrUnix nonPortable} {
+test scrollbar-6.17 {ScrollbarPosition procedure} {unix nonPortable} {
# Don't know why this is non-portable, but it doesn't work on
# some platforms.
.s identify 8 51
} {trough1}
-test scrollbar-6.18 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.18 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr [winfo width .s] / 2] [testmetrics cyvscroll .s]
} {trough1}
-test scrollbar-6.19 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.19 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr [winfo width .s] / 2] [expr int(.2 / [.s delta 0 1]) \
+ [testmetrics cyvscroll .s] - 1]
} {trough1}
-
-test scrollbar-6.20 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.20 {ScrollbarPosition procedure} unix {
.s identify 8 52
} {slider}
-test scrollbar-6.21 {ScrollbarPosition procedure} {macOrUnix nonPortable} {
+test scrollbar-6.21 {ScrollbarPosition procedure} {unix nonPortable} {
# Don't know why this is non-portable, but it doesn't work on
# some platforms.
.s identify 8 83
} {slider}
-test scrollbar-6.22 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.22 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr [winfo width .s] / 2] \
[expr int(.2 / [.s delta 0 1] + 0.5) + [testmetrics cyvscroll .s]]
} {slider}
-test scrollbar-6.23 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.23 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \
- + [testmetrics cyvscroll -s] - 1]
+ + [testmetrics cyvscroll .s] - 1]
} {slider}
-
-test scrollbar-6.24 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.24 {ScrollbarPosition procedure} unix {
.s identify 8 84
} {trough2}
-test scrollbar-6.25 {ScrollbarPosition procedure} {unixOnly} {
+test scrollbar-6.25 {ScrollbarPosition procedure} unix {
.s identify 8 179
} {trough2}
-test scrollbar-6.26 {ScrollbarPosition procedure} {macOnly} {
- .s identify 8 179
-} {arrow2}
-test scrollbar-6.27 {ScrollbarPosition procedure} {testmetrics pcOnly knownBug} {
+test scrollbar-6.27 {ScrollbarPosition procedure} {testmetrics win knownBug} {
# This asks for 8,21, which is actually the slider, but there is a
# bug in that GetSystemMetrics(SM_CYVTHUMB) actually returns a value
# that is larger than the thumb displayed, skewing the ability to
@@ -533,41 +512,33 @@ test scrollbar-6.27 {ScrollbarPosition procedure} {testmetrics pcOnly knownBug}
.s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \
+ [testmetrics cyvscroll .s]]
} {trough2}
-test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr [winfo width .s] / 2] [expr [winfo height .s] \
- [testmetrics cyvscroll .s] - 1]
} {trough2}
-
-test scrollbar-6.29 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.29 {ScrollbarPosition procedure} unix {
.s identify 8 180
} {arrow2}
-test scrollbar-6.30 {ScrollbarPosition procedure} {unixOnly} {
+test scrollbar-6.30 {ScrollbarPosition procedure} unix {
.s identify 8 195
} {arrow2}
-test scrollbar-6.31 {ScrollbarPosition procedure} {macOnly} {
- .s identify 8 195
-} {}
-test scrollbar-6.32 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.32 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr [winfo width .s] / 2] [expr [winfo height .s] \
- [testmetrics cyvscroll .s]]
} {arrow2}
-test scrollbar-6.33 {ScrollbarPosition procedure} {pcOnly} {
+test scrollbar-6.33 {ScrollbarPosition procedure} win {
.s identify [expr [winfo width .s] / 2] [expr [winfo height .s] - 1]
} {arrow2}
-
-test scrollbar-6.34 {ScrollbarPosition procedure} {macOrUnix} {
+test scrollbar-6.34 {ScrollbarPosition procedure} unix {
.s identify 4 100
} {trough2}
-test scrollbar-6.35 {ScrollbarPosition procedure} {unixOnly} {
+test scrollbar-6.35 {ScrollbarPosition procedure} unix {
.s identify 18 100
} {trough2}
-test scrollbar-6.36 {ScrollbarPosition procedure} {macOnly} {
- .s identify 18 100
-} {}
-test scrollbar-6.37 {ScrollbarPosition procedure} {pcOnly} {
+test scrollbar-6.37 {ScrollbarPosition procedure} win {
.s identify 0 100
} {trough2}
-test scrollbar-6.38 {ScrollbarPosition procedure} {pcOnly} {
+test scrollbar-6.38 {ScrollbarPosition procedure} win {
.s identify [expr [winfo width .s] - 1] 100
} {trough2}
@@ -578,29 +549,24 @@ scrollbar .t.s -orient horizontal -relief sunken -bd 2 -highlightthickness 2
place .t.s -width 200
.t.s set .2 .4
update
-test scrollbar-6.39 {ScrollbarPosition procedure} {macOrUnix} {
+
+test scrollbar-6.39 {ScrollbarPosition procedure} unix {
.t.s identify 4 8
} {arrow1}
-test scrollbar-6.40 {ScrollbarPosition procedure} {pcOnly} {
+test scrollbar-6.40 {ScrollbarPosition procedure} win {
.t.s identify 0 [expr [winfo height .t.s] / 2]
} {arrow1}
-test scrollbar-6.41 {ScrollbarPosition procedure} {unixOnly} {
+test scrollbar-6.41 {ScrollbarPosition procedure} unix {
.t.s identify 82 8
} {slider}
-test scrollbar-6.42 {ScrollbarPosition procedure} {macOnly} {
- .t.s identify 82 8
-} {}
-test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics pcOnly} {
+test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} {
.t.s identify [expr int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] \
- 1] [expr [winfo height .t.s] / 2]
} {slider}
-test scrollbar-6.44 {ScrollbarPosition procedure} {unixOnly} {
+test scrollbar-6.44 {ScrollbarPosition procedure} unix {
.t.s identify 100 18
} {trough2}
-test scrollbar-6.45 {ScrollbarPosition procedure} {macOnly} {
- .t.s identify 100 18
-} {}
-test scrollbar-6.46 {ScrollbarPosition procedure} {pcOnly} {
+test scrollbar-6.46 {ScrollbarPosition procedure} win {
.t.s identify 100 [expr [winfo height .t.s] - 1]
} {trough2}
@@ -619,6 +585,7 @@ wm geometry .t +0+0
test scrollbar-8.1 {TkScrollbarEventProc: recursive deletion} {
proc doit {args} { destroy .t.f }
proc bgerror {args} {}
+ destroy .t.f
frame .t.f
scrollbar .t.f.s -command doit
pack .t.f -fill both -expand 1
@@ -637,6 +604,7 @@ test scrollbar-8.1 {TkScrollbarEventProc: recursive deletion} {
test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} {
proc doit {args} { destroy .t.f.s }
proc bgerror {args} {}
+ destroy .t.f
frame .t.f
scrollbar .t.f.s -command doit
pack .t.f -fill both -expand 1
@@ -668,18 +636,5 @@ catch {destroy .s}
catch {destroy .t}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/select.test b/tests/select.test
index 602d88d..8cbfd39 100644
--- a/tests/select.test
+++ b/tests/select.test
@@ -12,13 +12,10 @@
#
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::interpreter
+namespace import -force ::tk::test:loadTkCommand
global longValue selValue selInfo
@@ -130,13 +127,13 @@ test select-1.3 {Tk_CreateSelHandler procedure} {
set selInfo ""
list [selection get TEST] $selInfo
} {{Test value} {TEST 0 4000}}
-test select-1.4.1 {Tk_CreateSelHandler procedure} {unixOnly} {
+test select-1.4.1 {Tk_CreateSelHandler procedure} unix {
setup
selection handle .f1 {handler TEST} TEST
selection handle .f1 {handler STRING}
lsort [selection get TARGETS]
} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}
-test select-1.4.2 {Tk_CreateSelHandler procedure} {macOrPc} {
+test select-1.4.2 {Tk_CreateSelHandler procedure} win {
setup
selection handle .f1 {handler TEST} TEST
selection handle .f1 {handler STRING}
@@ -151,7 +148,7 @@ test select-1.5 {Tk_CreateSelHandler procedure} {
set selInfo ""
list [selection get] $selInfo
} {{} {STRING 0 4000}}
-test select-1.6.1 {Tk_CreateSelHandler procedure} {unixOnly} {
+test select-1.6.1 {Tk_CreateSelHandler procedure} unix {
global selValue selInfo
setup
selection handle .f1 {handler TEST} TEST
@@ -164,7 +161,7 @@ test select-1.6.1 {Tk_CreateSelHandler procedure} {unixOnly} {
selection get -type TEST
list [set selInfo] [lsort [selection get TARGETS]]
} {{STRING 0 4000 TEST 0 4000 TEST2 0 4000} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}}
-test select-1.6.2 {Tk_CreateSelHandler procedure} {macOrPc} {
+test select-1.6.2 {Tk_CreateSelHandler procedure} win {
global selValue selInfo
setup
selection handle .f1 {handler TEST} TEST
@@ -177,21 +174,21 @@ test select-1.6.2 {Tk_CreateSelHandler procedure} {macOrPc} {
selection get -type TEST
list [set selInfo] [lsort [selection get TARGETS]]
} {{STRING 0 4000 TEST 0 4000 TEST2 0 4000} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-1.7.1 {Tk_CreateSelHandler procedure} {unixOnly} {
+test select-1.7.1 {Tk_CreateSelHandler procedure} unix {
setup
selection own -selection CLIPBOARD .f1
selection handle -selection CLIPBOARD .f1 {handler TEST} TEST
selection handle -selection PRIMARY .f1 {handler TEST2} STRING
list [lsort [selection get -selection PRIMARY TARGETS]] \
- [lsort [selection get -selection CLIPBOARD TARGETS]]
+ [lsort [selection get -selection CLIPBOARD TARGETS]]
} {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-1.7.2 {Tk_CreateSelHandler procedure} {macOrPc} {
+test select-1.7.2 {Tk_CreateSelHandler procedure} win {
setup
selection own -selection CLIPBOARD .f1
selection handle -selection CLIPBOARD .f1 {handler TEST} TEST
selection handle -selection PRIMARY .f1 {handler TEST2} STRING
list [lsort [selection get -selection PRIMARY TARGETS]] \
- [lsort [selection get -selection CLIPBOARD TARGETS]]
+ [lsort [selection get -selection CLIPBOARD TARGETS]]
} {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
test select-1.8 {Tk_CreateSelHandler procedure} {
setup
@@ -201,56 +198,56 @@ test select-1.8 {Tk_CreateSelHandler procedure} {
##############################################################################
-test select-2.1 {Tk_DeleteSelHandler procedure} {unixOnly} {
+test select-2.1 {Tk_DeleteSelHandler procedure} unix {
setup
- selection handle .f1 {handler STRING}
- selection handle -type TEST .f1 {handler TEST}
- selection handle -type USER .f1 {handler USER}
+ selection handle .f1 {handler STRING}
+ selection handle -type TEST .f1 {handler TEST}
+ selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type TEST .f1 {}
lappend result [lsort [selection get TARGETS]]
} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING} {MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING}}
-test select-2.2 {Tk_DeleteSelHandler procedure} {unixOnly} {
+test select-2.2 {Tk_DeleteSelHandler procedure} unix {
setup
- selection handle .f1 {handler STRING}
- selection handle -type TEST .f1 {handler TEST}
- selection handle -type USER .f1 {handler USER}
+ selection handle .f1 {handler STRING}
+ selection handle -type TEST .f1 {handler TEST}
+ selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type USER .f1 {}
lappend result [lsort [selection get TARGETS]]
} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}}
-test select-2.3 {Tk_DeleteSelHandler procedure} {unixOnly} {
+test select-2.3 {Tk_DeleteSelHandler procedure} unix {
setup
selection own -selection CLIPBOARD .f1
- selection handle -selection PRIMARY .f1 {handler STRING}
- selection handle -selection CLIPBOARD .f1 {handler STRING}
+ selection handle -selection PRIMARY .f1 {handler STRING}
+ selection handle -selection CLIPBOARD .f1 {handler STRING}
selection handle -selection CLIPBOARD .f1 {}
list [lsort [selection get TARGETS]] \
[lsort [selection get -selection CLIPBOARD TARGETS]]
} {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-2.4 {Tk_DeleteSelHandler procedure} {macOrPc} {
+test select-2.4 {Tk_DeleteSelHandler procedure} win {
setup
- selection handle .f1 {handler STRING}
- selection handle -type TEST .f1 {handler TEST}
- selection handle -type USER .f1 {handler USER}
+ selection handle .f1 {handler STRING}
+ selection handle -type TEST .f1 {handler TEST}
+ selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type TEST .f1 {}
lappend result [lsort [selection get TARGETS]]
} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER} {MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW USER}}
-test select-2.5 {Tk_DeleteSelHandler procedure} {macOrPc} {
+test select-2.5 {Tk_DeleteSelHandler procedure} win {
setup
- selection handle .f1 {handler STRING}
- selection handle -type TEST .f1 {handler TEST}
- selection handle -type USER .f1 {handler USER}
+ selection handle .f1 {handler STRING}
+ selection handle -type TEST .f1 {handler TEST}
+ selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type USER .f1 {}
lappend result [lsort [selection get TARGETS]]
} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-2.6 {Tk_DeleteSelHandler procedure} {macOrPc} {
+test select-2.6 {Tk_DeleteSelHandler procedure} win {
setup
selection own -selection CLIPBOARD .f1
- selection handle -selection PRIMARY .f1 {handler STRING}
- selection handle -selection CLIPBOARD .f1 {handler STRING}
+ selection handle -selection PRIMARY .f1 {handler STRING}
+ selection handle -selection CLIPBOARD .f1 {handler STRING}
selection handle -selection CLIPBOARD .f1 {}
list [lsort [selection get TARGETS]] \
[lsort [selection get -selection CLIPBOARD TARGETS]]
@@ -259,7 +256,7 @@ test select-2.7 {Tk_DeleteSelHandler procedure} {
setup
selection handle .f1 {handler STRING}
list [selection handle .f1 {}] [selection handle .f1 {}]
-} {{} {}}
+} {{} {}}
##############################################################################
@@ -306,7 +303,7 @@ test select-3.6 {Tk_OwnSelection procedure} {
selection clear .f1
lappend result $lostSel
} {owned lost2}
-test select-3.7 {Tk_OwnSelection procedure} {unixOnly} {
+test select-3.7 {Tk_OwnSelection procedure} unix {
global lostSel
setup
setupbg
@@ -332,7 +329,6 @@ test select-3.9 {Tk_OwnSelection procedure} {
selection own -selection CLIPBOARD -command { destroy .f2 } .f1
selection own -selection CLIPBOARD .f2
} {}
-
# multiple display tests
test select-3.10 {Tk_OwnSelection procedure} {altDisplay} {
setup .f1
@@ -370,7 +366,7 @@ test select-4.3 {Tk_ClearSelection procedure} {
setup
list [selection clear .f1] [selection clear .f1]
} {{} {}}
-test select-4.4 {Tk_ClearSelection procedure} {unixOnly} {
+test select-4.4 {Tk_ClearSelection procedure} unix {
global lostSel
setup
setupbg
@@ -383,7 +379,6 @@ test select-4.4 {Tk_ClearSelection procedure} {unixOnly} {
cleanupbg
lappend result [selection own]
} {{} {}}
-
# multiple display tests
test select-4.5 {Tk_ClearSelection procedure} {altDisplay} {
global lostSel lostSel2
@@ -398,7 +393,7 @@ test select-4.5 {Tk_ClearSelection procedure} {altDisplay} {
update
list $lostSel $lostSel2
} {owned lost2}
-test select-4.6 {Tk_ClearSelection procedure} {unixOnly altDisplay} {
+test select-4.6 {Tk_ClearSelection procedure} {unix altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
setupbg
@@ -477,7 +472,7 @@ test select-5.8 {Tk_GetSelection procedure} {
selection handle .f1 {weirdHandler STRING}
list [selection get] $selInfo [catch {selection get} msg] $msg
} "$longValue {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000} 1 {PRIMARY selection doesn't exist or form \"STRING\" not defined}"
-test select-5.9 {Tk_GetSelection procedure} {unixOnly} {
+test select-5.9 {Tk_GetSelection procedure} unix {
setup
setupbg
selection handle -selection PRIMARY .f1 {handler TEST} TEST
@@ -489,7 +484,7 @@ test select-5.9 {Tk_GetSelection procedure} {unixOnly} {
cleanupbg
lappend result $selInfo
} {{Test value} {TEST 0 4000}}
-test select-5.10 {Tk_GetSelection procedure} {unixOnly} {
+test select-5.10 {Tk_GetSelection procedure} unix {
setup
setupbg
selection handle -selection PRIMARY .f1 {handler TEST} TEST
@@ -502,9 +497,7 @@ test select-5.10 {Tk_GetSelection procedure} {unixOnly} {
cleanupbg
lappend result $selInfo
} {{selection owner didn't respond} {}}
-
# multiple display tests
-
test select-5.11 {Tk_GetSelection procedure} {altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
@@ -531,7 +524,7 @@ test select-5.12 {Tk_GetSelection procedure} {altDisplay} {
lappend result [catch {selection get -displayof .f2 TEST} msg] $msg \
$selInfo
} {0 {Test value} {TEST 0 4000} 1 {PRIMARY selection doesn't exist or form "TEST" not defined} {}}
-test select-5.13 {Tk_GetSelection procedure} {unixOnly altDisplay} {
+test select-5.13 {Tk_GetSelection procedure} {unix altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
setupbg
@@ -549,7 +542,7 @@ test select-5.13 {Tk_GetSelection procedure} {unixOnly altDisplay} {
cleanupbg
lappend result $selInfo
} {{Test value} {Test value2} {TEST2 0 4000 TEST 0 4000}}
-test select-5.14 {Tk_GetSelection procedure} {unixOnly altDisplay} {
+test select-5.14 {Tk_GetSelection procedure} {unix altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
setupbg
@@ -573,7 +566,6 @@ test select-5.14 {Tk_GetSelection procedure} {unixOnly altDisplay} {
test select-6.1 {Tk_SelectionCmd procedure} {
list [catch {selection} cmd] $cmd
} {1 {wrong # args: should be "selection option ?arg arg ...?"}}
-
# selection clear
test select-6.2 {Tk_SelectionCmd procedure} {
list [catch {selection clear -selection} cmd] $cmd
@@ -629,7 +621,6 @@ test select-6.11 {Tk_SelectionCmd procedure} {
test select-6.12 {Tk_SelectionCmd procedure} {
list [catch {selection clear foo bar} cmd] $cmd
} {1 {wrong # args: should be "selection clear ?options?"}}
-
# selection get
test select-6.13 {Tk_SelectionCmd procedure} {
list [catch {selection get -selection} cmd] $cmd
@@ -683,7 +674,6 @@ test select-6.21 {Tk_SelectionCmd procedure} {
set selInfo ""
list [selection get TEST] $selInfo
} {{Test value} {TEST 0 4000}}
-
# selection handle
# most of the handle section has been covered earlier
test select-6.22 {Tk_SelectionCmd procedure} {
@@ -715,7 +705,6 @@ test select-6.29 {Tk_SelectionCmd procedure} {
catch { destroy .f2 }
list [catch {selection handle .f2 dummy} cmd] $cmd
} {1 {bad window path name ".f2"}}
-
# selection own
test select-6.30 {Tk_SelectionCmd procedure} {
list [catch {selection own -selection} cmd] $cmd
@@ -758,57 +747,55 @@ test select-6.37 {Tk_SelectionCmd procedure} {
test select-6.38 {Tk_SelectionCmd procedure} {
list [catch {selection own foo bar baz} cmd] $cmd
} {1 {wrong # args: should be "selection own ?options? ?window?"}}
-
test select-6.39 {Tk_SelectionCmd procedure} {
list [catch {selection foo} cmd] $cmd
} {1 {bad option "foo": must be clear, get, handle, or own}}
##############################################################################
- # This test is non-portable because some old X11/News servers ignore
- # a selection request when the window doesn't exist, which causes a
- # different error message.
-
- test select-7.1 {TkSelDeadWindow procedure} {nonPortable} {
- setup
- selection handle .f1 { handler TEST }
- set result [selection own]
- destroy .f1
- lappend result [selection own] [catch { selection get } msg] $msg
- } {.f1 {} 1 {PRIMARY selection doesn't exist or form "STRING" not defined}}
+# This test is non-portable because some old X11/News servers ignore
+# a selection request when the window doesn't exist, which causes a
+# different error message.
+test select-7.1 {TkSelDeadWindow procedure} nonPortable {
+ setup
+ selection handle .f1 { handler TEST }
+ set result [selection own]
+ destroy .f1
+ lappend result [selection own] [catch {selection get} msg] $msg
+} {.f1 {} 1 {PRIMARY selection doesn't exist or form "STRING" not defined}}
##############################################################################
# Check reentrancy on losing selection
-test select-8.1 {TkSelEventProc procedure} {unixOnly} {
+test select-8.1 {TkSelEventProc procedure} -constraints unix -setup {
setup
setupbg
- selection own -selection CLIPBOARD -command { destroy .f1 } .f1
+} -body {
+ selection own -selection CLIPBOARD -command {destroy .f1} .f1
update
- set result [dobg {selection own -selection CLIPBOARD .}]
+ dobg {selection own -selection CLIPBOARD .}
+} -cleanup {
cleanupbg
- set result
-} {}
+} -result {}
##############################################################################
-test select-9.1 {SelCvtToX and SelCvtFromX procedures} {unixOnly} {
- global selValue selInfo
+test select-9.1 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
+} -constraints unix -body {
set selValue "1024"
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
- .f1 {handler TEST}
+ .f1 {handler TEST}
update
set result ""
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} {0x400 {TEST 0 4000}}
-test select-9.2 {SelCvtToX and SelCvtFromX procedures} {unixOnly} {
- global selValue selInfo
+} -result {{0x400 } {TEST 0 4000}}
+test select-9.2 {SelCvtToX and SelCvtFromX procedures} unix {
setup
setupbg
set selValue "1024 0xffff 2048 -2 "
@@ -819,9 +806,8 @@ test select-9.2 {SelCvtToX and SelCvtFromX procedures} {unixOnly} {
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} {{0x400 0xffff 0x800 0xfffffffe} {TEST 0 4000}}
-test select-9.3 {SelCvtToX and SelCvtFromX procedures} {unixOnly} {
- global selValue selInfo
+} {{0x400 0xffff 0x800 0xfffffffe } {TEST 0 4000}}
+test select-9.3 {SelCvtToX and SelCvtFromX procedures} unix {
setup
setupbg
set selValue " "
@@ -832,9 +818,8 @@ test select-9.3 {SelCvtToX and SelCvtFromX procedures} {unixOnly} {
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} {{} {TEST 0 4000}}
-test select-9.4 {SelCvtToX and SelCvtFromX procedures} {unixOnly} {
- global selValue selInfo
+} {{ } {TEST 0 4000}}
+test select-9.4 {SelCvtToX and SelCvtFromX procedures} unix {
setup
setupbg
set selValue "16 foobar 32"
@@ -845,7 +830,7 @@ test select-9.4 {SelCvtToX and SelCvtFromX procedures} {unixOnly} {
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} {{0x10 0x0 0x20} {TEST 0 4000}}
+} {{0x10 0x0 0x20 } {TEST 0 4000}}
test select-9.5 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
@@ -867,14 +852,14 @@ test select-9.5 {SelCvtToX and SelCvtFromX procedures} -setup {
# note, we are not testing MULTIPLE style selections
# most control paths have been exercised above
-test select-10.1 {ConvertSelection procedure, race with selection clear} {unixOnly} {
+test select-10.1 {ConvertSelection procedure, race with selection clear} unix {
setup
proc Ready {fd} {
variable x
lappend x [gets $fd]
}
set fd [open "|[list [interpreter] -geometry +0+0 -name tktest]" r+]
- puts $fd "puts foo; flush stdout"
+ puts $fd "puts foo; [loadTkCommand]; flush stdout"
flush $fd
gets $fd
fileevent $fd readable [list Ready $fd]
@@ -890,10 +875,12 @@ test select-10.1 {ConvertSelection procedure, race with selection clear} {unixOn
vwait [namespace which -variable x]
puts $fd {exit}
flush $fd
- close $fd
+ # Don't understand why, but the [loadTkCommand] above causes
+ # a "broken pipe" error when Tk was actually [load]ed in the child.
+ catch {close $fd}
lappend x $selInfo
} {{1 PRIMARY selection doesn't exist or form "STRING" not defined} {}}
-test select-10.2 {ConvertSelection procedure} {unixOnly} {
+test select-10.2 {ConvertSelection procedure} unix {
setup
setupbg
set selValue [string range $longValue 0 3999]
@@ -904,7 +891,7 @@ test select-10.2 {ConvertSelection procedure} {unixOnly} {
cleanupbg
lappend result $selInfo
} [list [string range $longValue 0 3999] {STRING 0 4000 STRING 4000 4000 STRING 0 4000 STRING 4000 4000}]
-test select-10.3 {ConvertSelection procedure} {unixOnly} {
+test select-10.3 {ConvertSelection procedure} unix {
setup
setupbg
selection handle .f1 ERROR errHandler
@@ -915,7 +902,7 @@ test select-10.3 {ConvertSelection procedure} {unixOnly} {
} {{PRIMARY selection doesn't exist or form "ERROR" not defined}}
# testing timers
# This one hangs in Exceed
-test select-10.4 {ConvertSelection procedure} {unixOnly noExceed} {
+test select-10.4 {ConvertSelection procedure} {unix noExceed} {
setup
setupbg
set selValue $longValue
@@ -927,7 +914,7 @@ test select-10.4 {ConvertSelection procedure} {unixOnly noExceed} {
cleanupbg
lappend result $selInfo
} {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}}
-test select-10.5 {ConvertSelection procedure, reentrancy issues} {unixOnly} {
+test select-10.5 {ConvertSelection procedure, reentrancy issues} unix {
setup
setupbg
set selValue "Test value"
@@ -939,7 +926,7 @@ test select-10.5 {ConvertSelection procedure, reentrancy issues} {unixOnly} {
cleanupbg
lappend result $selInfo
} {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000}}
-test select-10.6 {ConvertSelection procedure, reentrancy issues} {unixOnly} {
+test select-10.6 {ConvertSelection procedure, reentrancy issues} unix {
proc weirdHandler {type offset count} {
destroy .f1
handler $type $offset $count
@@ -958,7 +945,7 @@ test select-10.6 {ConvertSelection procedure, reentrancy issues} {unixOnly} {
##############################################################################
# testing reentrancy
-test select-11.1 {TkSelPropProc procedure} {unixOnly} {
+test select-11.1 {TkSelPropProc procedure} unix {
setup
setupbg
set selValue $longValue
@@ -975,15 +962,15 @@ test select-11.1 {TkSelPropProc procedure} {unixOnly} {
##############################################################################
# Note, this assumes we are using CurrentTtime
-test select-12.1 {DefaultSelection procedure} {unixOnly} {
+test select-12.1 {DefaultSelection procedure} unix {
setup
set result [selection get -type TIMESTAMP]
setupbg
lappend result [dobg {selection get -type TIMESTAMP}]
cleanupbg
set result
-} {0x0 0x0}
-test select-12.2 {DefaultSelection procedure} {unixOnly} {
+} {0x0 {0x0 }}
+test select-12.2 {DefaultSelection procedure} unix {
setup
set result [lsort [list [selection get -type TARGETS]]]
setupbg
@@ -991,7 +978,7 @@ test select-12.2 {DefaultSelection procedure} {unixOnly} {
cleanupbg
set result
} {{MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-12.3 {DefaultSelection procedure} {unixOnly} {
+test select-12.3 {DefaultSelection procedure} unix {
setup
selection handle .f1 {handler TEST} TEST
set result [list [lsort [selection get -type TARGETS]]]
@@ -1000,7 +987,7 @@ test select-12.3 {DefaultSelection procedure} {unixOnly} {
cleanupbg
set result
} {{MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-12.4 {DefaultSelection procedure} {unixOnly} {
+test select-12.4 {DefaultSelection procedure} unix {
setup
set result ""
lappend result [selection get -type TK_APPLICATION]
@@ -1009,7 +996,7 @@ test select-12.4 {DefaultSelection procedure} {unixOnly} {
cleanupbg
set result
} [list [winfo name .] [winfo name .]]
-test select-12.5 {DefaultSelection procedure} {unixOnly} {
+test select-12.5 {DefaultSelection procedure} unix {
setup
set result [selection get -type TK_WINDOW]
setupbg
@@ -1018,7 +1005,6 @@ test select-12.5 {DefaultSelection procedure} {unixOnly} {
set result
} {.f1 .f1}
test select-12.6 {DefaultSelection procedure} {
- global selValue selInfo
setup
selection handle .f1 {handler TARGETS.f1} TARGETS
set selValue "Targets value"
@@ -1028,7 +1014,7 @@ test select-12.6 {DefaultSelection procedure} {
lappend result [selection get TARGETS]
} {{Targets value} {TARGETS.f1 0 4000} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-13.1 {SelectionSize procedure, handler deleted} {unixOnly} {
+test select-13.1 {SelectionSize procedure, handler deleted} unix {
proc badHandler {path type offset count} {
global selValue selInfo abortCount
incr abortCount -1
@@ -1057,18 +1043,5 @@ test select-13.1 {SelectionSize procedure, handler deleted} {unixOnly} {
catch {rename weirdHandler {}}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/send.test b/tests/send.test
index 2614427..d3fce3b 100644
--- a/tests/send.test
+++ b/tests/send.test
@@ -11,14 +11,10 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
testConstraint xhost [llength [auto_execok xhost]]
-testConstraint testsend [llength [info commands testsend]]
# Compute a script that will load Tk into a child interpreter.
@@ -624,5 +620,5 @@ catch {
rename newApp {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 7b7da12..0fe1c33 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -5,10 +5,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
proc scroll args {
@@ -446,8 +443,8 @@ test spinbox-3.64 {SpinboxWidgetCmd procedure, "selection to" widget command} {
} {1 {wrong # args: should be ".e selection to index"}}
test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} {
.e xview 5
- .e xview
-} {0.0537634 0.268817}
+ format {%.6f %.6f} {*}[.e xview]
+} {0.053763 0.268817}
test spinbox-3.66 {SpinboxWidgetCmd procedure, "xview" widget command} {
list [catch {.e xview gorp} msg] $msg
} {1 {bad spinbox index "gorp"}}
@@ -455,7 +452,7 @@ test spinbox-3.67 {SpinboxWidgetCmd procedure, "xview" widget command} {
.e xview 0
.e icursor 10
.e xview insert
- .e xview
+ format {%.6f %.6f} {*}[.e xview]
} {0.107527 0.322581}
test spinbox-3.68 {SpinboxWidgetCmd procedure, "xview" widget command} {
list [catch {.e xview moveto foo bar} msg] $msg
@@ -465,7 +462,7 @@ test spinbox-3.69 {SpinboxWidgetCmd procedure, "xview" widget command} {
} {1 {expected floating-point number but got "foo"}}
test spinbox-3.70 {SpinboxWidgetCmd procedure, "xview" widget command} {
.e xview moveto 0.5
- .e xview
+ format {%.6f %.6f} {*}[.e xview]
} {0.505376 0.72043}
test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} {
list [catch {.e xview scroll 24} msg] $msg
@@ -476,13 +473,13 @@ test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} {
test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} {
.e xview moveto 0
.e xview scroll 1 pages
- .e xview
+ format {%.6f %.6f} {*}[.e xview]
} {0.193548 0.408602}
test spinbox-3.74 {SpinboxWidgetCmd procedure, "xview" widget command} {
.e xview moveto .9
update
.e xview scroll -2 p
- .e xview
+ format {%.6f %.6f} {*}[.e xview]
} {0.397849 0.612903}
test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} {
.e xview 30
@@ -520,12 +517,12 @@ test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} {
set x {}
.e xview moveto .1
- lappend x [lindex [.e xview] 0]
+ lappend x [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .11
- lappend x [lindex [.e xview] 0]
+ lappend x [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .12
- lappend x [lindex [.e xview] 0]
-} {0.0957447 0.106383 0.117021}
+ lappend x [format {%.6f} [lindex [.e xview] 0]]
+} {0.095745 0.106383 0.117021}
test spinbox-3.82 {SpinboxWidgetCmd procedure} {
list [catch {.e gorp} msg] $msg
} {1 {bad option "gorp": must be bbox, cget, configure, delete, get, icursor, identify, index, insert, invoke, scan, selection, set, validate, or xview}}
@@ -604,8 +601,8 @@ test spinbox-5.7 {ConfigureSpinbox procedure} {
.e insert end "01234567890"
update
.e configure -width 5
- set scrollInfo
-} {0 0.363636}
+ format {%.6f %.6f} {*}$scrollInfo
+} {0.000000 0.363636}
test spinbox-5.8 {ConfigureSpinbox procedure} {fonts} {
catch {destroy .e}
spinbox .e -width 0
@@ -729,15 +726,15 @@ test spinbox-7.1 {InsertChars procedure} {
.e insert 0 abcde
.e insert 2 XXX
update
- list [.e get] $contents $scrollInfo
-} {abXXXcde abXXXcde {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abXXXcde abXXXcde {0.000000 1.000000}}
test spinbox-7.2 {InsertChars procedure} {
.e delete 0 end
.e insert 0 abcde
.e insert 500 XXX
update
- list [.e get] $contents $scrollInfo
-} {abcdeXXX abcdeXXX {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abcdeXXX abcdeXXX {0.000000 1.000000}}
test spinbox-7.3 {InsertChars procedure} {
.e delete 0 end
.e insert 0 0123456789
@@ -823,22 +820,22 @@ test spinbox-8.1 {DeleteChars procedure} {
.e insert 0 abcde
.e delete 2 4
update
- list [.e get] $contents $scrollInfo
-} {abe abe {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abe abe {0.000000 1.000000}}
test spinbox-8.2 {DeleteChars procedure} {
.e delete 0 end
.e insert 0 abcde
.e delete -2 2
update
- list [.e get] $contents $scrollInfo
-} {cde cde {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {cde cde {0.000000 1.000000}}
test spinbox-8.3 {DeleteChars procedure} {
.e delete 0 end
.e insert 0 abcde
.e delete 3 1000
update
- list [.e get] $contents $scrollInfo
-} {abc abc {0 1}}
+ list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
+} {abc abc {0.000000 1.000000}}
test spinbox-8.4 {DeleteChars procedure} {
.e delete 0 end
.e insert 0 0123456789abcde
@@ -1134,26 +1131,26 @@ test spinbox-13.9 {GetSpinboxIndex procedure} {
list [.e index sel.first] [.e index sel.last]
} {1 6}
selection clear .e
-test spinbox-13.10 {GetSpinboxIndex procedure} {unixOnly} {
+test spinbox-13.10 {GetSpinboxIndex procedure} unix {
# On unix, when selection is cleared, spinbox widget's internal
# selection range is reset.
list [catch {.e index sel.first} msg] $msg
} {1 {selection isn't in widget .e}}
-test spinbox-13.11 {GetSpinboxIndex procedure} {macOrPc} {
+test spinbox-13.11 {GetSpinboxIndex procedure} win {
# On mac and pc, when selection is cleared, spinbox widget remembers
# last selected range. When selection ownership is restored to
# spinbox, the old range will be rehighlighted.
list [catch {selection get}] [.e index sel.first]
} {1 1}
-test spinbox-13.12 {GetSpinboxIndex procedure} {unixOnly} {
+test spinbox-13.12 {GetSpinboxIndex procedure} unix {
list [catch {.e index sbogus} msg] $msg
} {1 {selection isn't in widget .e}}
-test spinbox-13.13 {GetSpinboxIndex procedure} {macOrPc} {
+test spinbox-13.13 {GetSpinboxIndex procedure} win {
list [catch {.e index sbogus} msg] $msg
} {1 {bad spinbox index "sbogus"}}
-test spinbox-13.14 {GetSpinboxIndex procedure} {macOrPc} {
+test spinbox-13.14 {GetSpinboxIndex procedure} win {
list [catch {selection get}] [catch {.e index sbogus}]
} {1 1}
test spinbox-13.15 {GetSpinboxIndex procedure} {
@@ -1237,12 +1234,12 @@ update
test spinbox-16.1 {SpinboxVisibleRange procedure} {fonts} {
.e delete 0 end
.e insert 0 .............................
- .e xview
-} {0 0.827586}
-test spinbox-15.4 {SpinboxVisibleRange procedure} {
+ format {%.6f %.6f} {*}[.e xview]
+} {0.000000 0.827586}
+test spinbox-16.2 {SpinboxVisibleRange procedure} {
.e delete 0 end
- .e xview
-} {0 1}
+ format {%.6f %.6f} {*}[.e xview]
+} {0.000000 1.000000}
catch {destroy .e}
spinbox .e -width 10 -xscrollcommand scroll -font $fixed
@@ -1252,21 +1249,21 @@ test spinbox-17.1 {SpinboxUpdateScrollbar procedure} {
.e delete 0 end
.e insert 0 123
update
- set scrollInfo
-} {0 1}
+ format {%.6f %.6f} {*}$scrollInfo
+} {0.000000 1.000000}
test spinbox-17.2 {SpinboxUpdateScrollbar procedure} {
.e delete 0 end
.e insert 0 0123456789abcdef
.e xview 3
update
- set scrollInfo
-} {0.1875 0.8125}
+ format {%.6f %.6f} {*}$scrollInfo
+} {0.187500 0.812500}
test spinbox-17.3 {SpinboxUpdateScrollbar procedure} {
.e delete 0 end
.e insert 0 abcdefghijklmnopqrs
.e xview 6
update
- set scrollInfo
+ format {%.6f %.6f} {*}$scrollInfo
} {0.315789 0.842105}
test spinbox-17.4 {SpinboxUpdateScrollbar procedure} {
destroy .e
@@ -1282,7 +1279,7 @@ test spinbox-17.4 {SpinboxUpdateScrollbar procedure} {
list $x $errorInfo
} {{invalid command name "thisisnotacommand"} {invalid command name "thisisnotacommand"
while executing
-"thisisnotacommand 0 1"
+"thisisnotacommand 0.0 1.0"
(horizontal scrolling command executed by .e)}}
set l [interp hidden]
@@ -1598,5 +1595,5 @@ catch {unset ::e ::vVals}
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/teapot.ppm b/tests/teapot.ppm
new file mode 100644
index 0000000..b8ab85f
--- /dev/null
+++ b/tests/teapot.ppm
@@ -0,0 +1,31 @@
+P6
+256 256
+255
+\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[7 eOLjQLmSMoTMnSMlRMhPL_9 \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀnSMtVMzYN~[N~[N\N\O€\O€]O€]O€]O€]O€\O€\O}[NyYNtVM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-wXN}[N€]O„^O†_O†`O‡`Oˆ`Oˆ`OˆaO‰aO‰aO‰aO‰aO‰aO‰aOˆaOˆ`O†_Oƒ^O\N \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀaMLyYN…_O‰aP‹bPcPŽcPŽdPŽdPdPdPdPdPdPdPdPeP‘eP’eP’eP‘ePdPcP…_OpUM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀwXN…_OdP“fP•gQ–hQ˜hQ˜iQ™iQ™iQšiQšiQšjQ›jQ›jQœjQœjQœjQœjQœjQ›jQœjQ™iQ“fP‡`O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJiQL‹bP—hQkQ¡mR¤nR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¦pR¨pS©qSªqS«rS¬rS«rS©qS¤oRœjQ€]O\KK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀfOLrUMcPŸlR©qS¯tS²uTµwT·xT¸xT¹yTºyT»zT»zU¼zU¼zU¼zU»zUºyT¸xT¶wT¯tS¡mR‰aOhPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àa0 cNLqUM€\O”fQ¦pS²wVºzV¿|VÂ}VÄVÆVÇ€VÉ‚WÌ…[Õeæ w÷³‹êª…Ĉg§qT“fQ{ZNYIK9\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀO1{G#‘JkRMqUMtVN–iS¨v\·€d¹bµzZ±vU°uT®sSªqS¤nRœjQ’eP„^OrUMHh>!T4\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-V5wE"~I#†M%U+¥e7²l:°g2®b*­a(­`(©^(¥])¡^-›]1ŠS,qC$`9 R3G-\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@)J/i>!pA"tD"wF$yH&xH&tE$wE#yG%}M+ƒT4S5mE*Z7!K/B*;'\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‰aO¦oR½{UÇ€VÏ…X<(F-a: e<!h>!j@#k@$h>"d<!c=$hD-fF2[<)K0@);'5$Ë‚VÇ€V¿|U_LKYIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À…_O·xTÉ‚Wó«€ûµ‹Ö’k¼|X×>µf-¨^(¡Z'šW&–T&œN>)F-J/b; g>#nD(jB&c<!b=%jH2_A/I0!<(8&5$”J¥Y’S%8&;'?)E,<:HA=HE?IJAISFJYIKXIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À£nRÁ}UܘqÊŠe±vU²e,™V&¥V†C €@ |> y< u: r9 o7 l6
+j5
+h4
+g3
+5$D,K/b; h>"wM1tK.e="a<#cA,U8&E-<(9&.!a0 b1 c1    
+
++3#@)46G<:HMCIXHK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀU*´vT¿~X¸{YÃk+›W&‰N$|> u: p8 k5
+f3
+a0 _/ ]. [- I¡\*ª_(‘LkRMmSMmSMnSMnSMD,R3W5mA"|O0|P1j?"c<!a=%Y7"N1F,;'NCJNCJNDJODJODJODJh>!a: X/K%
+g3
+a0 Z- \/ T*Q(ŠHµm8kRMmSMnTMoTMpTMpUM15G15G05G04G04GpUMpTM5^9 d<!yF#O+€N,rC#qB"pB#k?"a: Z7 6ODJPDJPEJQEJQEJREJREJREJRFJSFJSFJSFJSFJe<!X/
+^/ V+Q(L&I$r9  TlRMnSM46G47G47G46G46G46G46G46G36G36G25G25G15G04G/4F.3F
+
+X&pUMuWMwXNxXN<:H<:H<:H<:H<;H<;H<;H<;H=;H=;H=;H=;H>;H>;H?<H@<HA=HC>HG@ILBIREJ[JKcNLjQL§pR±uTºzUÃ~VÈWË‚XÖŽcäsÒŽe¼{V²vT¨pSžkR•gQŒbP†_O‚^O]O€\O€\O€\O€\O€]O]O]O]O]O]O]O]O]O]O]O€\O€\O~\N}[N|ZNxXN•T%H$
+›W&rVMvWNyYNzYN|ZN}[N}[N><H?<H?<H?<H?<H?<H@<H@<H@<HA=HA=HB=HC>HE?IG@IIAIKBIODJSFJWHK—hQŸlR§pR°b(¾i*Én+Ù|7Û|6Ïr,Íq+Êp-Ãl+»g)±b(®sS§pS lRšiQ•gQePcPŠaPˆaO‡`O‡`O†_O†_O…_O…_O…_O…_O…_O…_O…_O„_O„^O„^Oƒ^Oƒ^O‚]O]O€\O~[N{ZN•T%
+
+ 
+@%<-$G?@…pfdNLuWM\NdNL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀTFJvWN‰aP./01„E}[N]O…_Oˆ`O‰aP‹bPŒbPcPcPŽcPdPdPdPeP‘eP’eP’eP“fP“fQ”fQ•gQ•gQ–gQ–hQ—hQ˜hQ™iQšiQ›jQœjQkQkRžlRŸlRžY&¤\'¨^'µ^½bÀcÃeÇi ÄgÀc½b¼a¹`µ^´]¯X¢[' Z'žY&¢mR¡mR¡mR lRŸlRŸlRžkRkQœkQœjQ›jQšjQšiQ™iQ™iQ˜iQ˜hQ—hQ—hQ—hQ–gQ–gQ•gQ•gQ•gQ”fQ”fQ“fQ“fP’eP‘ePdPcP‰aP—O
+ B\À\À\À\À\À\À\À\À\À\À%7!!C*F#P) {dYœze»p€\OgPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ`LKvWNŠaPm6
+ 
+$5 ¬`(¶e)£nRœjQƒ^OJAI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXIK^KKdNLhPLuWM‚]OŒbP”fQeP m6
+†`OŽcP“fQ—hQ˜hQ™iQšiQšjQ›jQ›jQ›jQœjQœjQœjQœkQkQkQkRžkRžkRžkRžlRŸlRŸlRŸlR lR lR lR¡mR¡mR¡mR¡mRºg)³c(²c(±b(­V¿cÂeÅi!Åi!Àd¼bº`¹`·_·_¶^¢Q§]'ª_(­`(¹f)£nR£nR£nR£nR£nR£nR£nR¢nR¢nR¢nR¢nR¢nR¢nR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢nR¢mR¢mR£nR¢mR¢mR¡mR mRkR—hQˆGa0 ŠbP mRœjQ“fQ‰aP}[NrUMmSM…L$\À\À\À\À\À\À\À\À B B #C, 8&H.Z7 §pR›jQ{ZN\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀQEJ[JK`LKdNLhQLqUM{ZN…_OŽcP–gQ—hQ
+‹bP‘eP–hQšiQ›jQœjQkQkQkRžkRžkRžlRžlRŸlRŸlRŸlRŸlRŸlR lR lR lR mR¡mR¡mR¡mR¡mR¡mR¢mR¢mR¢mR¢nR£nRÀj*ºg)·e)¶d)Âd°XÅgÅhÂe¿c½b½b¾bªU­`(®a(¯a(³c(¾i*¤oR¤oR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤oR¤oR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¥oR¥oR¤nR¡mR›jQŽQ%Z- œjQ£nRŸlR—hQŽdP…_OuWMpTMnSMkRLa: \À\À\À\À\À\À\À B B&D2 @*S6#G@IPDJ˜hQmSM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ]KKbMLeOLiQLlRMvWN\OˆaO‘eP—hQœjQ•gQ
+!C+E'0F.4F7%8%U/lG.SFJZIK]KKZIKB=H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀREJZJK`LKdNLgPLjQLlRMnSMpTMqUMtWMxXN{ZN~[N]O„^O†`O‰aO‹bPdP•gQ™iQœkQ lR¤nR§pSªrS­sS¯tT²uT´vT¶wT·xT¹yT¹yTºyTºyT¹yT¶xT´vT¬rS¢nR—hQ¿|U¿|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ}UÀ}UÁ}UÁ}UÁ}UÁ}UÂ}UÂ~UÃ~UÃ~VÃ~VÄVÅ€WÆX®a(ŸlRªrS´vT¸yT¼zU¾|UÁ~VÃXÆ‚[Ɇ_΋dÓ‘jÔ“mÔ“nБlÊŒhĆd½_¶{[°vWªsU¦pS¢nRžkRšiQ˜hQ•gQ“fQ‘ePdPŒbP‰aO†_Oƒ^O€\O|ZNxXNsVMpTMnTMmSMjQL€C B)D&/F-3F47G6%>" Y7 kA$YIK]KK^KKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ\KKbMLeOLhPLkRLmSMnTMpTMrUMuWNyYN|ZN\N‚]O„_O‡`OŠaPŒbPŽcPeP“fP—hQ›jQžlR¢nR¥oS©qT¬sT¯uU²vU´wV¶xV¸yV¹yUºzU»zU¼{U½{U¾{U¾|U¿|U¿|U¿|U¿|U¾{U½{U¼{U¼zU»zTºyT¹yT¸xTµwT³vT´vT´vT´vT´wT´wTµwT·xT¹yTºzT¼zU½{U¾{U¿|UÀ|UÂ}UÄVÅ€WÇ‚YÉ„\͈_ÑŒdÙ”láuç£|쩂ſt명æ¦ÞŸ{Õ—sËŽl†d¹^³yZ­uW¨qU¤oSŸlRžkRœjQšiQ˜hQ–gQ”fQ‘ePdPcPŠaP‡`O„^O]O}[NyYNuWMpTMoTMmSMkRLgPL&D#.E,3F46G;'<(D"iB(VGJ]KK`LK[JKB>H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^LKcNLfOLiQLkRMmSMoTMqUMsVMvXNzYN}[N€\O‚^O…_Oˆ`OŠaPŒcPdP‘eP“fQ•gQ—hQ™iQkR mS¤oT¨rU¬tW°wY´zZ¸}\»]¾€^À^Á‚^‚^Â\Á€ZÁYÁXÁ~WÁ~WÂ~VÂ~VÂ~VÃ~VÃ~UÃ~UÄ~UÄ~UÄUÄUÅVÅVÅVÅVÆVÆ€VÆ€VÇ€WÇWÈ‚XɃZË…[͇^ЊaÓdØ’iÜ—nâtè£zî©ó¯‡ø´û¸‘üº“û¹“÷¶ñ±Œé©…à¡~Ö˜vËmÇf»€`´z[®vX©rU¥pT£oS¢nS lRžkRœkRšjQ˜iQ–hQ”fQ’ePdPcP‹bPˆ`O…_O‚]O~[NzYNvWNpTMoTMnSMkRMhQLo7 ,2F36G99HC+@ ]8 nA"\JK`ML_LKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMpTMqUMtVMwXNzZN}[N€]Oƒ^O†_OˆaO‹bPcPdP‘eP“fQ•gQ—hQ™iQ›jRžlR mS£oU§rW¬vZ²{]¹€a¿…fÅŠjËnГqÓ•sÕ–sÕ–rÕ–qÕ”oÓ’mÑjÏgÍŠcˈaɆ^È„\Ç‚[ÆYÅ€XÅ€WÅWÅWÅVÅVÅWÅ€WÆ€WÇXÈ‚YɃ[Ê…\͇_ÏŠaÒeÕ‘hÙ•mÝ™qávä¡zç¤}꧀멃몄騃奀ߠ|Ù›wÓ•rÌmƉh¿„c¸~^²yZ®vX¬tWªsV¨qU¦pT¤oS¢nS mRžlRœkR›jQ™iQ—hQ•gQ“fPePŽcP‹bPˆaO…_O‚^O\N{ZNwXNsVMoTMnSMlRMiQL~I#26G99G?<HA*E$ i@$ZIKaMLbML[JK;:H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀWHJ]KKbMLeOLhPLjRLlSMnTMpTMrUMuWMxXN{ZN~\N]O„^O†`O‰aO‹bPŽcPdP’eP”fQ–gQ˜hQšiQœkRžlS mT£oU¦rWªuZ¯y]´~aºƒfŠlË’sÔšzÜ¡€ã§†è«‰ë®‹í¯Œí®‹ë¬ˆè¨„ã£~ßžyÚ™tÖ•oÒjÎŒfˈbÈ…_ƃ\ÅZÄ€YÃXÂWÂ~WÂ~WÂ~WÃXÀXÄ€YÅZƃ\Ç…^Ɇ`ˈbÌŠdÍ‹fÎgÎŽiÎŽjÎŽjÍŽjËŒiljgÆd¿ƒaº^¸}]¶|\´{[²yZ°xY®vX¬tWªsV¨qU¦pT¤oS¢nS mRžlRkR›jQ™iQ—hQ•gQ“fP‘ePŽdPŒbP‰aO†_Oƒ^O€\O|ZNxXNtVMpTMnSMmSMjQLgPL99G?<HG-E&b;!YIK`MLdOM`LKNCJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀŸlRºyTÄ~UÊ‚XʃYÄXº{W­tUšW'¢[(—hQ lRcP€\OhQL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^LKcNLfOLiQLkRLmSMoTMqUMrVMvWNyYN|ZN\N‚]O„_O‡`O‰aPŒbPŽcPdP’fP”gQ–hQ˜iQšjRœkRžlS¡nT¤pU§sW«vZ°z]µb»„gŠlÉ‘sИyØžÞ¤…ã©Šè­ì±ï³‘ﳑ뭊穅⣀ݞzؘtÒ“nÎiɉdÆ…`Â]Á€[¿~Y¾}X½|W½|V¼{V¼{V¼{V¼{V¼{V¼|W¼|W½}X½}Y½~Z½~Z¼~Z»}[º}[º}[º~\º~\º~]º~]¹~]¸~]·}]¶|\´z[²yZ°wY®vX¬tWªsV¨rU¦pT¤oS¢nS mRŸlRkR›jQšiQ˜hQ–gQ“fQ‘ePdPŒcPŠaP‡`O„^O]O}[NyYNuWNpTMnTMmSMkRLhPL|H$D>IQ2P+XHK_LLfQOcNLXIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À©qSºyTÃ~VΈ`遲ޜv¾€]ªqS–LŽG|> g3
+S)?*%.—hQ—hQ‘eP‡`OuWM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMoTMqUMsVMwXNzYN}[N€\O‚^O…_O‡`OŠaPŒbPŽdP‘eP“fP•gQ—hQ˜iQšjRœkRŸlS¡nT¤pV§sX«vZ°z^¶b¼…gËmÊ’sјzØŸ€Þ¤…ã©Šè­ê¯ë°ê¯Žè¬‹å¨‡à¤‚Ûž|Ö™wÑ“qÌŽlljgÃ…bÀ‚_½\»}Zº{X¹zW¸yV·yU·xU·xU·xT·xT·xU·xU·xU·yV·yV·yW¸zW¸{X¹{Y¹|Zº}[º}[º}\º~\¹~]¹~]¸}]·|\µ{\´z[²yZ°wY®vX¬tWªsV¨rU¦pT¤oS¢nS¡mRŸlRkRœjQšiQ˜hQ–gQ”fQ’ePdPcPŠbP‡`O…_O‚]O~[NzZNvWNrUMoTMmSMlRMiQLeOLJAIJ(h>!]KKfQOgQN_LKD>I\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À™iQ°tS¸yT¼{UÂYÎŒeï­ˆô´Õ—u¶|\ Z'™LˆD |>
+
+ &3#.$-% .% .& /&!,#,#@70A71XNHXNHWNHWNHZRLYQLYQLXQLWQLWPLUOLSNLQMKOLJMJJ0//.-.,,-&(+"(!'
+ %' %$#" ! !$ 
diff --git a/tests/text.test b/tests/text.test
index bf70658..17fcf29 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -7,11 +7,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
+namespace import -force tcltest::test
# Create entries in the option database to be sure that geometry options
# like border width have predictable values.
@@ -54,6 +52,7 @@ foreach test {
{-background #ff00ff #ff00ff <gorp>}
{-bd 4 4 foo}
{-bg blue blue #xx}
+ {-blockcursor 0 0 xx}
{-borderwidth 7 7 ++}
{-cursor watch watch lousy}
{-exportselection no 0 maybe}
@@ -64,6 +63,7 @@ foreach test {
{-highlightbackground #123 #123 bogus}
{-highlightcolor #234 #234 bogus}
{-highlightthickness -2 0 bad}
+ {-inactiveselectbackground #ffff01234567 #ffff01234567 bogus}
{-insertbackground green green <bogus>}
{-insertborderwidth 45 45 bogus}
{-insertofftime 100 100 2.4}
@@ -84,6 +84,7 @@ foreach test {
{-spacing3 -10 0 bogus}
{-state d disabled foo}
{-tabs {1i 2i 3i 4i} {1i 2i 3i 4i} bad_tabs}
+ {-tabstyle wordprocessor wordprocessor garbage}
{-undo 1 1 eh}
{-width 73 73 2.4}
{-wrap w word bad_wrap}
@@ -113,7 +114,7 @@ test text-1.[incr i] {text options} {
lappend result [lindex $i 4]
}
set result
-} {1 blue {} {} 7 watch 0 {} fixed #012 5 #123 #234 0 green 45 100 47 2 5 3 82 raised #ffff01234567 21 yellow 0 0 0 0 disabled {1i 2i 3i 4i} {any old thing} 1 73 word {x scroll command} {test command}}
+} {1 blue {} {} 0 7 watch {} 0 {} fixed #012 5 #123 #234 0 #ffff01234567 green 45 100 47 2 5 3 82 raised #ffff01234567 21 yellow 0 0 0 0 {} disabled {1i 2i 3i 4i} wordprocessor {any old thing} 1 73 word {x scroll command} {test command}}
test text-2.1 {Tk_TextCmd procedure} {
list [catch {text} msg] $msg
@@ -130,10 +131,10 @@ test text-2.4 {Tk_TextCmd procedure} {
list [catch {text .t2 -bd 2 -fg red} msg] $msg \
[lindex [.t2 config -bd] 4] [lindex [.t2 config -fg] 4]
} {0 .t2 2 red}
-if {$tcl_platform(platform) == "macintosh"} {
- set relief solid
-} elseif {$tcl_platform(platform) == "windows"} {
+if {$tcl_platform(platform) == "windows"} {
set relief flat
+} elseif {[tk windowingsystem] eq "aqua"} {
+ set relief solid
} else {
set relief raised
}
@@ -152,7 +153,7 @@ test text-3.1 {TextWidgetCmd procedure, basics} {
} {1 {wrong # args: should be ".t option ?arg arg ...?"}}
test text-3.2 {TextWidgetCmd procedure} {
list [catch {.t gorp 1.0 z 1.2} msg] $msg
-} {1 {bad option "gorp": must be bbox, cget, compare, configure, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, scan, search, see, tag, window, xview, or yview}}
+} {1 {bad option "gorp": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, replace, scan, search, see, tag, window, xview, or yview}}
test text-4.1 {TextWidgetCmd procedure, "bbox" option} {
list [catch {.t bbox} msg] $msg
@@ -220,7 +221,7 @@ test text-6.13 {TextWidgetCmd procedure, "compare" option} {
} {1 {bad comparison operator "z": must be <, <=, ==, >=, >, or !=}}
test text-6.14 {TextWidgetCmd procedure, "compare" option} {
list [catch {.t co 1.0 z 1.2} msg] $msg
-} {1 {bad option "co": must be bbox, cget, compare, configure, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, scan, search, see, tag, window, xview, or yview}}
+} {1 {ambiguous option "co": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, replace, scan, search, see, tag, window, xview, or yview}}
# "configure" option is already covered above
@@ -229,7 +230,7 @@ test text-7.1 {TextWidgetCmd procedure, "debug" option} {
} {1 {wrong # args: should be ".t debug boolean"}}
test text-7.2 {TextWidgetCmd procedure, "debug" option} {
list [catch {.t de 0 1} msg] $msg
-} {1 {bad option "de": must be bbox, cget, compare, configure, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, scan, search, see, tag, window, xview, or yview}}
+} {1 {ambiguous option "de": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, replace, scan, search, see, tag, window, xview, or yview}}
test text-7.3 {TextWidgetCmd procedure, "debug" option} {
.t debug true
.t deb
@@ -322,12 +323,119 @@ test text-8.16 {TextWidgetCmd procedure, "delete" option} {
.t delete 2.0 2.6 2.2 2.4
.t get 1.0 end-1c
} foo\nghijklm
+.t delete 1.0 end; .t insert 1.0 $prevtext
+test text-8.17 {TextWidgetCmd procedure, "replace" option} {
+ list [catch {.t replace 1.3 2.3} err] $err
+} {1 {wrong # args: should be ".t replace index1 index2 chars ?tagList chars tagList ...?"}}
+test text-8.18 {TextWidgetCmd procedure, "replace" option} {
+ list [catch {.t replace 3.1 2.3 foo} err] $err
+} {1 {Index "2.3" before "3.1" in the text}}
+test text-8.19 {TextWidgetCmd procedure, "replace" option} {
+ list [catch {.t replace 2.1 2.3 foo} err] $err
+} {0 {}}
+.t delete 1.0 end; .t insert 1.0 $prevtext
+test text-8.20 {TextWidgetCmd procedure, "replace" option with undo} {
+ .t configure -undo 0
+ .t configure -undo 1
+ # Ensure it is treated as a single undo action
+ .t replace 2.1 2.3 foo
+ .t edit undo
+ .t configure -undo 0
+ string equal [.t get 1.0 end-1c] $prevtext
+} {1}
+test text-8.21 {TextWidgetCmd procedure, "replace" option with undo} {
+ .t configure -undo 0
+ .t configure -undo 1
+ .t replace 2.1 2.3 foo
+ # Ensure we can override a text widget and intercept undo
+ # actions. If in the future a different mechanism is available
+ # to do this, then we should be able to change this test. The
+ # behaviour tested for here is not, strictly speaking, documented.
+ rename .t test.t
+ set res {}
+ proc .t {args} { lappend ::res $args ; uplevel 1 test.t $args }
+ .t edit undo
+ rename .t {}
+ rename test.t .t
+ .t configure -undo 0
+ set res
+} {{edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} {insert 2.1 ef} {mark set insert 2.3} {see insert}}
+test text-8.22 {TextWidgetCmd procedure, "replace" option with undo} {
+ .t configure -undo 0
+ .t configure -undo 1
+ # Ensure that undo (even composite undo like 'replace')
+ # works when the widget shows nothing useful.
+ .t replace 2.1 2.3 foo
+ .t configure -start 1 -end 1
+ .t edit undo
+ .t configure -start {} -end {}
+ .t configure -undo 0
+ if {![string equal [.t get 1.0 end-1c] $prevtext]} {
+ set res [list [.t get 1.0 end-1c] ne $prevtext]
+ } else {
+ set res 1
+ }
+} {1}
+.t delete 1.0 end; .t insert 1.0 $prevtext
+test text-8.23 {TextWidgetCmd procedure, "replace" option with peers, undo} {
+ .t configure -undo 0
+ .t configure -undo 1
+ .t peer create .tt -undo 1
+ # Ensure that undo (even composite undo like 'replace')
+ # works when the the event took place in one peer, which
+ # is then deleted, before the undo takes place in another peer.
+ .tt replace 2.1 2.3 foo
+ .tt configure -start 1 -end 1
+ destroy .tt
+ .t edit undo
+ .t configure -start {} -end {}
+ .t configure -undo 0
+ if {![string equal [.t get 1.0 end-1c] $prevtext]} {
+ set res [list [.t get 1.0 end-1c] ne $prevtext]
+ } else {
+ set res 1
+ }
+} {1}
+.t delete 1.0 end; .t insert 1.0 $prevtext
+test text-8.24 {TextWidgetCmd procedure, "replace" option with peers, undo} {
+ .t configure -undo 0
+ .t configure -undo 1
+ .t peer create .tt -undo 1
+ # Ensure that undo (even composite undo like 'replace')
+ # works when the the event took place in one peer, which
+ # is then deleted, before the undo takes place in another peer
+ # which isn't showing everything.
+ .tt replace 2.1 2.3 foo
+ set res [.tt get 2.1 2.4]
+ .tt configure -start 1 -end 1
+ destroy .tt
+ .t configure -start 3 -end 4
+ # msg will actually be set to a silently ignored error message here,
+ # (that the .tt command doesn't exist), but that is not important.
+ lappend res [catch {.t edit undo} msg]
+ .t configure -undo 0
+ .t configure -start {} -end {}
+ if {![string equal [.t get 1.0 end-1c] $prevtext]} {
+ lappend res [list [.t get 1.0 end-1c] ne $prevtext]
+ } else {
+ lappend res 1
+ }
+} {foo 0 1}
+test text-8.25 {TextWidgetCmd procedure, "replace" option crash} -setup {
+ destroy .tt
+} -body {
+ text .tt
+ .tt insert 0.0 foo\n
+ .tt replace end-1l end bar
+} -cleanup {
+ destroy .tt
+} -result {}
.t delete 1.0 end; .t insert 1.0 $prevtext
test text-9.1 {TextWidgetCmd procedure, "get" option} {
list [catch {.t get} msg] $msg
-} {1 {wrong # args: should be ".t get index1 ?index2 ...?"}}
+} {1 {wrong # args: should be ".t get ?-displaychars? ?--? index1 ?index2 ...?"}}
test text-9.2 {TextWidgetCmd procedure, "get" option} {
list [catch {.t get a b c} msg] $msg
} {1 {bad text index "a"}}
@@ -377,9 +485,341 @@ test text-9.15 {TextWidgetCmd procedure, "get" option} {
.t get 5.2 5.4 5.4 5.5 end-3c end
} {{y } G { 7
}}
+test text-9.16 {TextWidgetCmd procedure, "get" option} {
+ .t get 5.2 5.3 5.4 5.3
+} {y}
test text-9.17 {TextWidgetCmd procedure, "get" option} {
+ .t index "5.2 +3 indices"
+} {5.5}
+test text-9.17a {TextWidgetCmd procedure, "get" option} {
+ .t index "5.2 +3chars"
+} {5.5}
+test text-9.17b {TextWidgetCmd procedure, "get" option} {
+ .t index "5.2 +3displayindices"
+} {5.5}
+.t tag configure elide -elide 1
+.t tag add elide 5.2 5.4
+test text-9.18 {TextWidgetCmd procedure, "get" option} {
list [catch {.t get 5.2 5.4 5.5 foo} msg] $msg
} {1 {bad text index "foo"}}
+test text-9.19 {TextWidgetCmd procedure, "get" option} {
+ .t get 5.2 5.4 5.4 5.5 end-3c end
+} {{y } G { 7
+}}
+test text-9.20 {TextWidgetCmd procedure, "get" option} {
+ .t get -displaychars 5.2 5.4 5.4 5.5 end-3c end
+} {{} G { 7
+}}
+test text-9.21 {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.1 +4indices"] [.t index "5.1+4d indices"]
+} {5.5 5.7}
+test text-9.22 {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.1 +4a chars"] [.t index "5.1+4d chars"]
+} {5.5 5.7}
+test text-9.23 {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.5 -4indices"] [.t index "5.7-4d indices"]
+} {5.1 5.1}
+test text-9.24 {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.5 -4a chars"] [.t index "5.7-4d chars"]
+} {5.1 5.1}
+.t window create 5.4
+test text-9.25 {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.1 +4indices"] [.t index "5.1+4d indices"]
+} {5.5 5.7}
+test text-9.25a {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.1 +4a chars"] [.t index "5.1+4d chars"]
+} {5.6 5.8}
+test text-9.26 {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.5 -4indices"] [.t index "5.7-4d indices"]
+} {5.1 5.1}
+test text-9.26a {TextWidgetCmd procedure, "get" option} {
+ list [.t index "5.6 -4a chars"] [.t index "5.8-4d chars"]
+} {5.1 5.1}
+.t delete 5.4
+.t tag add elide 5.5 5.6
+test text-9.27 {TextWidgetCmd procedure, "get" option} {
+ .t get -displaychars 5.2 5.8
+} {Grl}
+.t tag delete elide
+.t mark unset a
+.t mark unset b
+.t mark unset c
+test text-9.2.1 {TextWidgetCmd procedure, "count" option} {
+ list [catch {.t count} msg] $msg
+} {1 {wrong # args: should be ".t count ?options? index1 index2"}}
+test text-9.2.2.1 {TextWidgetCmd procedure, "count" option} {
+ list [catch {.t count blah 1.0 2.0} msg] $msg
+} {1 {bad option "blah" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}}
+test text-9.2.2 {TextWidgetCmd procedure, "count" option} {
+ list [catch {.t count a b} msg] $msg
+} {1 {bad text index "a"}}
+test text-9.2.3 {TextWidgetCmd procedure, "count" option} {
+ list [catch {.t count @q 3.1} msg] $msg
+} {1 {bad text index "@q"}}
+test text-9.2.4 {TextWidgetCmd procedure, "count" option} {
+ list [catch {.t count 3.1 @r} msg] $msg
+} {1 {bad text index "@r"}}
+test text-9.2.5 {TextWidgetCmd procedure, "count" option} {
+ .t count 5.7 5.3
+} {-4}
+test text-9.2.6 {TextWidgetCmd procedure, "count" option} {
+ .t count 5.3 5.5
+} {2}
+test text-9.2.7 {TextWidgetCmd procedure, "count" option} {
+ .t count 5.3 end
+} {29}
+.t mark set a 5.3
+.t mark set b 5.3
+.t mark set c 5.5
+test text-9.2.8 {TextWidgetCmd procedure, "count" option} {
+ .t count 5.2 5.7
+} {5}
+test text-9.2.9 {TextWidgetCmd procedure, "count" option} {
+ .t count 5.2 5.3
+} {1}
+test text-9.2.10 {TextWidgetCmd procedure, "count" option} {
+ .t count 5.2 5.4
+} {2}
+test text-9.2.17 {TextWidgetCmd procedure, "count" option} {
+ list [catch {.t count 5.2 foo} msg] $msg
+} {1 {bad text index "foo"}}
+.t tag configure elide -elide 1
+.t tag add elide 2.2 3.4
+.t tag add elide 4.0 4.1
+test text-9.2.18 {TextWidgetCmd procedure, "count" option} {
+ .t count -displayindices 2.0 3.0
+} {2}
+test text-9.2.19 {TextWidgetCmd procedure, "count" option} {
+ .t count -displayindices 2.2 3.0
+} {0}
+test text-9.2.20 {TextWidgetCmd procedure, "count" option} {
+ .t count -displayindices 2.0 4.2
+} {5}
+# Create one visible and one invisible window
+frame .t.w1
+frame .t.w2
+.t mark set a 2.2
+# Creating this window here means that the elidden text
+# now starts at 2.3, but 'a' is automatically moved to 2.3
+.t window create 2.1 -window .t.w1
+.t window create 3.1 -window .t.w2
+test text-9.2.21 {TextWidgetCmd procedure, "count" option} {
+ .t count -displayindices 2.0 3.0
+} {3}
+test text-9.2.22 {TextWidgetCmd procedure, "count" option} {
+ .t count -displayindices 2.2 3.0
+} {1}
+test text-9.2.23 {TextWidgetCmd procedure, "count" option} {
+ .t count -displayindices a 3.0
+} {0}
+test text-9.2.24 {TextWidgetCmd procedure, "count" option} {
+ .t count -displayindices 2.0 4.2
+} {6}
+test text-9.2.25 {TextWidgetCmd procedure, "count" option} {
+ .t count -displaychars 2.0 3.0
+} {2}
+test text-9.2.26 {TextWidgetCmd procedure, "count" option} {
+ .t count -displaychars 2.2 3.0
+} {1}
+test text-9.2.27 {TextWidgetCmd procedure, "count" option} {
+ .t count -displaychars a 3.0
+} {0}
+test text-9.2.28 {TextWidgetCmd procedure, "count" option} {
+ .t count -displaychars 2.0 4.2
+} {5}
+test text-9.2.29 {TextWidgetCmd procedure, "count" option} {
+ list [.t count -indices 2.2 3.0] [.t count 2.2 3.0]
+} {10 10}
+test text-9.2.30 {TextWidgetCmd procedure, "count" option} {
+ list [.t count -indices a 3.0] [.t count a 3.0]
+} {9 9}
+test text-9.2.31 {TextWidgetCmd procedure, "count" option} {
+ .t count -indices 2.0 4.2
+} {21}
+test text-9.2.32 {TextWidgetCmd procedure, "count" option} {
+ .t count -chars 2.2 3.0
+} {10}
+test text-9.2.33 {TextWidgetCmd procedure, "count" option} {
+ .t count -chars a 3.0
+} {9}
+test text-9.2.34 {TextWidgetCmd procedure, "count" option} {
+ .t count -chars 2.0 4.2
+} {19}
+destroy .t.w1
+destroy .t.w2
+set current [.t get 1.0 end-1c]
+.t delete 1.0 end
+.t insert end [string repeat "abcde " 50]\n
+.t insert end [string repeat "fghij " 50]\n
+.t insert end [string repeat "klmno " 50]
+test text-9.2.35 {TextWidgetCmd procedure, "count" option} {
+ .t count -lines 1.0 end
+} {3}
+test text-9.2.36 {TextWidgetCmd procedure, "count" option} {
+ .t count -lines end 1.0
+} {-3}
+test text-9.2.37 {TextWidgetCmd procedure, "count" option} {
+ list [catch {.t count -lines 1.0 2.0 3.0} res] $res
+} {1 {bad option "1.0" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}}
+test text-9.2.38 {TextWidgetCmd procedure, "count" option} {
+ .t count -lines end end
+} {0}
+test text-9.2.39 {TextWidgetCmd procedure, "count" option} {
+ .t count -lines 1.5 2.5
+} {1}
+test text-9.2.40 {TextWidgetCmd procedure, "count" option} {
+ .t count -lines 2.5 "2.5 lineend"
+} {0}
+test text-9.2.41 {TextWidgetCmd procedure, "count" option} {
+ .t count -lines 2.7 "1.0 lineend"
+} {-1}
+test text-9.2.42 {TextWidgetCmd procedure, "count" option} {
+ set old_wrap [.t cget -wrap]
+ .t configure -wrap none
+ set res [.t count -displaylines 1.0 end]
+ .t configure -wrap $old_wrap
+ set res
+} {3}
+test text-9.2.43 {TextWidgetCmd procedure, "count" option} {
+ .t count -lines -chars -indices -displaylines 1.0 end
+} {3 903 903 45}
+.t configure -wrap none
+
+# Newer tags are higher priority
+.t tag configure elide1 -elide 0
+.t tag configure elide2 -elide 1
+.t tag configure elide3 -elide 0
+.t tag configure elide4 -elide 1
+
+test text-0.2.44.0 {counting with tag priority eliding} {
+ .t delete 1.0 end
+ .t insert end "hello"
+ list [.t count -displaychars 1.0 1.0] \
+ [.t count -displaychars 1.0 1.1] \
+ [.t count -displaychars 1.0 1.2] \
+ [.t count -displaychars 1.0 1.3] \
+ [.t count -displaychars 1.0 1.4] \
+ [.t count -displaychars 1.0 1.5] \
+ [.t count -displaychars 1.0 1.6] \
+ [.t count -displaychars 1.0 2.6] \
+} {0 1 2 3 4 5 5 6}
+test text-0.2.44 {counting with tag priority eliding} {
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide1 1.2 1.4
+ .t count -displaychars 1.0 1.5
+} {5}
+test text-0.2.45 {counting with tag priority eliding} {
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide2 1.2 1.4
+ .t count -displaychars 1.0 1.5
+} {3}
+test text-0.2.46 {counting with tag priority eliding} {
+ set res {}
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide2 1.2 1.4
+ .t tag add elide1 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide1 1.2 1.4
+ .t tag add elide2 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+} {3 3}
+test text-0.2.47 {counting with tag priority eliding} {
+ set res {}
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide2 1.2 1.4
+ .t tag add elide3 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide3 1.2 1.4
+ .t tag add elide3 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+} {5 5}
+test text-0.2.48 {counting with tag priority eliding} {
+ set res {}
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide2 1.2 1.4
+ .t tag add elide3 1.2 1.4
+ .t tag add elide4 1.2 1.4
+ .t tag add elide1 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide1 1.2 1.4
+ .t tag add elide4 1.2 1.4
+ .t tag add elide2 1.2 1.4
+ .t tag add elide3 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+} {3 3}
+test text-0.2.49 {counting with tag priority eliding} {
+ set res {}
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide2 1.2 1.4
+ .t tag add elide3 1.2 1.4
+ .t tag add elide1 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide1 1.2 1.4
+ .t tag add elide2 1.2 1.4
+ .t tag add elide3 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+} {5 5}
+test text-0.2.50 {counting with tag priority eliding} {
+ set res {}
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide2 1.0 1.5
+ .t tag add elide1 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+ lappend res [.t count -displaychars 1.1 1.5]
+ lappend res [.t count -displaychars 1.2 1.5]
+ lappend res [.t count -displaychars 1.3 1.5]
+ .t delete 1.0 end
+ .t insert end "hello"
+ .t tag add elide1 1.0 1.5
+ .t tag add elide2 1.2 1.4
+ lappend res [.t count -displaychars 1.0 1.5]
+ lappend res [.t count -displaychars 1.1 1.5]
+ lappend res [.t count -displaychars 1.2 1.5]
+ lappend res [.t count -displaychars 1.3 1.5]
+} {0 0 0 0 3 2 1 1}
+test text-0.2.51 {counting with tag priority eliding} {
+ set res {}
+ .t delete 1.0 end
+ .t tag configure WELCOME -elide 1
+ .t tag configure SYSTEM -elide 0
+ .t tag configure TRAFFIC -elide 1
+ .t insert end "\n" {SYSTEM TRAFFIC}
+ .t insert end "\n" WELCOME
+ lappend res [.t count -displaychars 1.0 end]
+ lappend res [.t count -displaychars 1.0 end-1c]
+ lappend res [.t count -displaychars 1.0 1.2]
+ lappend res [.t count -displaychars 2.0 end]
+ lappend res [.t count -displaychars 2.0 end-1c]
+ lappend res [.t index "1.0 +1 indices"]
+ lappend res [.t index "1.0 +1 display indices"]
+ lappend res [.t index "1.0 +1 display chars"]
+ lappend res [.t index end]
+ lappend res [.t index "end -1 indices"]
+ lappend res [.t index "end -1 display indices"]
+ lappend res [.t index "end -1 display chars"]
+ lappend res [.t index "end -2 indices"]
+ lappend res [.t index "end -2 display indices"]
+ lappend res [.t index "end -2 display chars"]
+} {1 0 0 1 0 2.0 4.0 4.0 4.0 3.0 3.0 3.0 2.0 1.0 1.0}
+
+.t delete 1.0 end
+.t insert end $current
+unset current
test text-10.1 {TextWidgetCmd procedure, "index" option} {
list [catch {.t index} msg] $msg
@@ -389,7 +829,7 @@ test text-10.2 {TextWidgetCmd procedure, "index" option} {
} {1 {wrong # args: should be ".t index index"}}
test text-10.3 {TextWidgetCmd procedure, "index" option} {
list [catch {.t in a b} msg] $msg
-} {1 {bad option "in": must be bbox, cget, compare, configure, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, scan, search, see, tag, window, xview, or yview}}
+} {1 {ambiguous option "in": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, replace, scan, search, see, tag, window, xview, or yview}}
test text-10.4 {TextWidgetCmd procedure, "index" option} {
list [catch {.t index @xyz} msg] $msg
} {1 {bad text index "@xyz"}}
@@ -452,7 +892,7 @@ test text-11.10 {TextWidgetCmd procedure, "insert" option} {
test text-12.1 {ConfigureText procedure} {
list [catch {.t2 configure -state foobar} msg] $msg
-} {1 {bad state value "foobar": must be normal or disabled}}
+} {1 {bad state "foobar": must be disabled or normal}}
test text-12.2 {ConfigureText procedure} {
.t2 configure -spacing1 -2 -spacing2 1 -spacing3 1
list [.t2 cget -spacing1] [.t2 cget -spacing2] [.t2 cget -spacing3]
@@ -480,7 +920,7 @@ test text-12.6 {ConfigureText procedure} {
} {}
test text-12.7 {ConfigureText procedure} {
list [catch {.t2 configure -wrap bogus} msg] $msg
-} {1 {bad wrap mode "bogus": must be char, none, or word}}
+} {1 {bad wrap "bogus": must be char, none, or word}}
test text-12.8 {ConfigureText procedure} {
.t2 configure -selectborderwidth 17 -selectforeground #332211 \
-selectbackground #abc
@@ -538,7 +978,6 @@ test text-12.15 {ConfigureText procedure} {
test text-12.16 {ConfigureText procedure} {fonts} {
# This test is non-portable because the window size will vary depending
# on the font size, which can vary.
-
catch {destroy .t2}
toplevel .t2
text .t2.t -width 20 -height 10
@@ -552,7 +991,6 @@ test text-12.17 {ConfigureText procedure} {
# was a certain minimum size and it was interfering with the size
# requested by the -setgrid. The "overrideredirect" gets rid of the
# titlebar so the toplevel can shrink to the appropriate size.
-
catch {destroy .t2}
toplevel .t2
wm overrideredirect .t2 1
@@ -567,7 +1005,6 @@ test text-12.18 {ConfigureText procedure} {
# was a certain minimum size and it was interfering with the size
# requested by the -setgrid. The "overrideredirect" gets rid of the
# titlebar so the toplevel can shrink to the appropriate size.
-
catch {destroy .t2}
toplevel .t2
wm overrideredirect .t2 1
@@ -900,7 +1337,7 @@ test text-18.5 {TextFetchSelection procedure, long selections} {
selection get
} $x\n
-test text-19.1 {TkTextLostSelection procedure} {unixOnly} {
+test text-19.1 {TkTextLostSelection procedure} unix {
catch {destroy .t2}
text .t2
.t2 insert 1.0 "abc\ndef\nghijk\n1234"
@@ -908,7 +1345,7 @@ test text-19.1 {TkTextLostSelection procedure} {unixOnly} {
.t.e select to 1
.t2 tag ranges sel
} {}
-test text-19.2 {TkTextLostSelection procedure} {macOrPc} {
+test text-19.2 {TkTextLostSelection procedure} win {
catch {destroy .t2}
text .t2
.t2 insert 1.0 "abc\ndef\nghijk\n1234"
@@ -933,10 +1370,13 @@ test text-19.3 {TkTextLostSelection procedure} {
.t insert end "xxyz xyz x. the\nfoo -forward bar xxxxx BaR foo\nxyz xxyzx"
test text-20.1 {TextSearchCmd procedure, argument parsing} {
list [catch {.t search -} msg] $msg
-} {1 {bad switch "-": must be --, -backward, -count, -elide, -exact, -forward, -nocase, or -regexp}}
+} {1 {bad switch "-": must be --, -all, -backward, -count, -elide, -exact, -forward, -nocase, -nolinestop, -overlap, -regexp, or -strictlimits}}
test text-20.2 {TextSearchCmd procedure, -backwards option} {
.t search -backwards xyz 1.4
} {1.1}
+test text-20.2.1 {TextSearchCmd procedure, -all option} {
+ .t search -all xyz 1.4
+} {1.5 3.0 3.5 1.1}
test text-20.3 {TextSearchCmd procedure, -forwards option} {
.t search -forwards xyz 1.4
} {1.5}
@@ -956,9 +1396,19 @@ test text-20.7 {TextSearchCmd procedure, -count option} {
test text-20.8 {TextSearchCmd procedure, -nocase option} {
list [.t search -nocase BaR 1.1] [.t search BaR 1.1]
} {2.13 2.23}
-test text-20.9 {TextSearchCmd procedure, -nocase option} {
- .t search -n BaR 1.1
+test text-20.9 {TextSearchCmd procedure, -n ambiguous option} {
+ list [catch {.t search -n BaR 1.1} msg] $msg
+} {1 {bad switch "-n": must be --, -all, -backward, -count, -elide, -exact, -forward, -nocase, -nolinestop, -overlap, -regexp, or -strictlimits}}
+test text-20.9.1 {TextSearchCmd procedure, -nocase option} {
+ .t search -noc BaR 1.1
} {2.13}
+test text-20.9.2 {TextSearchCmd procedure, -nolinestop option} {
+ list [catch {.t search -nolinestop BaR 1.1} msg] $msg
+} {1 {the "-nolinestop" option requires the "-regexp" option to be present}}
+test text-20.9.3 {TextSearchCmd procedure, -nolinestop option} {
+ set msg ""
+ list [.t search -nolinestop -regexp -count msg e.*o 1.1] $msg
+} {1.14 32}
test text-20.10 {TextSearchCmd procedure, -- option} {
.t search -- -forward 1.0
} {2.4}
@@ -1007,15 +1457,15 @@ test text-20.23 {TextSearchCmd procedure, extract line contents} {
test text-20.24 {TextSearchCmd procedure, stripping newlines} {
.t search the\n 1.0
} {1.12}
-test text-20.25 {TextSearchCmd procedure, stripping newlines} {
+test text-20.25 {TextSearchCmd procedure, handling newlines} {
.t search -regexp the\n 1.0
-} {}
+} {1.12}
test text-20.26 {TextSearchCmd procedure, stripping newlines} {
.t search -regexp {the$} 1.0
} {1.12}
-test text-20.27 {TextSearchCmd procedure, stripping newlines} {
+test text-20.27 {TextSearchCmd procedure, handling newlines} {
.t search -regexp \n 1.0
-} {}
+} {1.15}
test text-20.28 {TextSearchCmd procedure, line case conversion} {
list [.t search -nocase bar 2.18] [.t search bar 2.18]
} {2.23 2.13}
@@ -1040,7 +1490,7 @@ test text-20.34 {TextSearchCmd procedure, firstChar and lastChar} {
test text-20.35 {TextSearchCmd procedure, firstChar and lastChar} {
.t search {} end
} {1.0}
-test text-20.36 {TextSearchCmd procedure, regexp finds empty lines} {
+test text-20.35a {TextSearchCmd procedure, regexp finds empty lines} {
# Test for fix of bug #1643
.t insert end "\n"
tk::TextSetCursor .t 4.0
@@ -1100,10 +1550,16 @@ test text-20.47 {TextSearchCmd procedure, checking stopIndex} {
} {{} 2.13 2.13 {}}
test text-20.48 {TextSearchCmd procedure, checking stopIndex} {
list [.t search -backwards bar 2.20 2.13] \
- [.t search -backwards bar 2.20 2.14] \
- [.t search -backwards bar 2.14 2.13] \
- [.t search -backwards bar 2.13 2.13]
+ [.t search -backwards bar 2.20 2.14] \
+ [.t search -backwards bar 2.14 2.13] \
+ [.t search -backwards bar 2.13 2.13]
} {2.13 {} 2.13 {}}
+test text-20.48.1 {TextSearchCmd procedure, checking stopIndex} {
+ list [.t search -backwards -strict bar 2.20 2.13] \
+ [.t search -backwards -strict bar 2.20 2.14] \
+ [.t search -backwards -strict bar 2.14 2.13] \
+ [.t search -backwards -strict bar 2.13 2.13]
+} {2.13 {} {} {}}
test text-20.49 {TextSearchCmd procedure, embedded windows and index/count} {
frame .t.f1 -width 20 -height 20 -relief raised -bd 2
frame .t.f2 -width 20 -height 20 -relief raised -bd 2
@@ -1162,7 +1618,9 @@ test text-20.61 {TextSearchCmd procedure, special cases} {
test text-20.62 {TextSearchCmd, freeing copy of pattern} {
# This test doesn't return a result, but it will generate
# a core leak if the pattern copy isn't properly freed.
-
+ # (actually in Tk 8.5 objectification means there is no
+ # longer a copy of the pattern, but we leave this test in
+ # anyway).
set p abcdefg1234567890
set p $p$p$p$p$p$p$p$p
set p $p$p$p$p$p
@@ -1188,7 +1646,6 @@ test text-20.65 {TextSearchCmd, unicode with non-text segments} {
destroy .b1
set result
} {1.3 3}
-
test text-20.66 {TextSearchCmd, hidden text does not affect match index} {
deleteWindows
pack [text .t2]
@@ -1217,7 +1674,6 @@ test text-20.69 {TextSearchCmd, hidden text does not affect match index} {
.t2 tag add hidden 2.0 3.0
.t2 search boo 1.0
} 3.3
-
test text-20.70 {TextSearchCmd, -regexp -nocase searches} {
catch {destroy .t}
pack [text .t]
@@ -1242,11 +1698,1075 @@ test text-20.72 {TextSearchCmd, -regexp -nocase searches} {
destroy .t
set res
} 1.0
-
+test text-20.73 {TextSearchCmd, hidden text and start index} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search bar 1.3
+} 1.3
+test text-20.74 {TextSearchCmd, hidden text shouldn't influence start index} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.0 1.2
+ .t2 search bar 1.3
+} 1.3
+test text-20.75 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ list [.t2 search -count foo foar 1.3] $foo
+} {1.0 6}
+test text-20.75.1 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ list \
+ [.t2 search -strict -count foo foar 1.3] \
+ [.t2 search -strict -count foo foar 2.3] $foo
+} {{} 1.0 6}
+test text-20.76 {TextSearchCmd, hidden text and start index} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -regexp bar 1.3
+} 1.3
+test text-20.77 {TextSearchCmd, hidden text shouldn't influence start index} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.0 1.2
+ .t2 search -regexp bar 1.3
+} 1.3
+test text-20.78 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ list [.t2 search -regexp -count foo foar 1.3] $foo
+} {1.0 6}
+test text-20.78.1 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ list [.t2 search -count foo foar 1.3] $foo
+} {1.0 6}
+test text-20.78.2 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ .t2 search -strict -count foo foar 1.3
+} {}
+test text-20.78.3 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ .t2 tag add hidden 2.2 2.4
+ list [.t2 search -regexp -all -count foo foar 1.3] $foo
+} {{2.0 3.0 1.0} {6 4 6}}
+test text-20.78.4 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ .t2 tag add hidden 2.2 2.4
+ list [.t2 search -all -count foo foar 1.3] $foo
+} {{2.0 3.0 1.0} {6 4 6}}
+test text-20.78.5 {TextSearchCmd, hidden text inside match must count in length} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoar"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.2 1.4
+ .t2 tag add hidden 2.2 2.4
+ list [.t2 search -strict -all -count foo foar 1.3] $foo
+} {{2.0 3.0} {6 4}}
+test text-20.78.6 {TextSearchCmd, single line with -all} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end " X\n X\n X\n X\n X\n X\n"
+ .t2 search -all -regexp { +| *\n} 1.0 end
+} {1.0 1.2 2.0 2.2 3.0 3.2 4.0 4.2 5.0 5.2 6.0 6.2 7.0}
+test text-20.79 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -count foo foobar\nfoo 1.0] $foo
+} {1.0 10}
+test text-20.80 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -count foo bar\nfoo 1.0] $foo
+} {1.3 7}
+test text-20.81 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -count foo \nfoo 1.0] $foo
+} {1.6 4}
+test text-20.82 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -count foo bar\nfoobar\nfoo 1.0] $foo
+} {1.3 14}
+test text-20.83 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -count foo bar\nfoobar\nfoobanearly 1.0
+} {}
+test text-20.84 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -regexp -count foo foobar\nfoo 1.0] $foo
+} {1.0 10}
+test text-20.85 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -regexp -count foo bar\nfoo 1.0] $foo
+} {1.3 7}
+test text-20.86 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -regexp -count foo \nfoo 1.0] $foo
+} {1.6 4}
+test text-20.87 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -regexp -count foo bar\nfoobar\nfoo 1.0] $foo
+} {1.3 14}
+test text-20.88 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -regexp -count foo bar\nfoobar\nfoobanearly 1.0
+} {}
+test text-20.89 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfaoobar\nfoobar"
+ .t2 search -regexp -count foo bar\nfoo 1.0
+} {2.4}
+test text-20.90 {TextSearchCmd, multiline matching end of window} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfaoobar\nfoobar"
+ .t2 search -regexp -count foo bar\nfoobar\n\n 1.0
+} {}
+test text-20.91 {TextSearchCmd, multiline matching end of window} {
+ deleteWindows
+ pack [text .t2]
+ .t2 search "\n\n" 1.0
+} {}
+test text-20.92 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -count foo foobar\nfoo end] $foo
+} {2.0 10}
+test text-20.93 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -count foo bar\nfoo 1.0] $foo
+} {2.3 7}
+test text-20.94 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -count foo \nfoo 1.0] $foo
+} {2.6 4}
+test text-20.95 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -count foo bar\nfoobar\nfoo 1.0] $foo
+} {1.3 14}
+test text-20.96 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -backwards -count foo bar\nfoobar\nfoobanearly 1.0
+} {}
+test text-20.97 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -regexp -count foo foobar\nfoo end] $foo
+} {2.0 10}
+test text-20.97.1 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -regexp -count foo foobar\nfo end] $foo
+} {2.0 9}
+test text-20.98 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -regexp -count foo bar\nfoo 1.0] $foo
+} {2.3 7}
+test text-20.99 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -regexp -count foo \nfoo 1.0] $foo
+} {2.6 4}
+test text-20.100 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ list [.t2 search -backwards -regexp -count foo bar\nfoobar\nfoo 1.0] $foo
+} {1.3 14}
+test text-20.101 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -backwards -regexp -count foo bar\nfoobar\nfoobanearly 1.0
+} {}
+test text-20.102 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfaoobar\nfoobar"
+ .t2 search -backwards -regexp -count foo bar\nfoo 1.0
+} {2.4}
+test text-20.103 {TextSearchCmd, multiline matching end of window} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfaoobar\nfoobar"
+ .t2 search -backwards -regexp -count foo bar\nfoobar\n\n 1.0
+} {}
+test text-20.104 {TextSearchCmd, multiline matching end of window} {
+ deleteWindows
+ pack [text .t2]
+ .t2 search -backwards "\n\n" 1.0
+} {}
+test text-20.105 {TextSearchCmd, multiline regexp matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 { Tcl_Obj *objPtr));
+static Tcl_Obj* FSNormalizeAbsolutePath
+ _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj *pathPtr));}
+ set markExpr "^(\[A-Za-z0-9~_\]+\[ \t\n\r\]*\\(|(\[^ \t\(#\n\r/@:\*\]\[^=\(\r\n\]*\[ \t\]+\\*?)?"
+ append markExpr "(\[A-Za-z0-9~_\]+(<\[^>\]*>)?(::)?(\[A-Za-z0-9~_\]+::)*\[-A-Za-z0-9~_+ <>\|\\*/\]+|\[A-Za-z0-9~_\]+)"
+ append markExpr "\[ \n\t\r\]*\\()"
+ .t2 search -forwards -regexp $markExpr 1.41 end
+} {}
+test text-20.106 {TextSearchCmd, multiline regexp matching} {
+ # Practical example which used to crash Tk, but only after the
+ # search is complete. This is memory corruption caused by
+ # a bug in Tcl's handling of string objects.
+ # (Tcl bug 635200)
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 {static int SetFsPathFromAny _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *objPtr));
+static Tcl_Obj* FSNormalizeAbsolutePath
+ _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj *pathPtr));}
+ set markExpr "^(\[A-Za-z0-9~_\]+\[ \t\n\r\]*\\(|(\[^ \t\(#\n\r/@:\*\]\[^=\(\r\n\]*\[ \t\]+\\*?)?"
+ append markExpr "(\[A-Za-z0-9~_\]+(<\[^>\]*>)?(::)?(\[A-Za-z0-9~_\]+::)*\[-A-Za-z0-9~_+ <>\|\\*/\]+|\[A-Za-z0-9~_\]+)"
+ append markExpr "\[ \n\t\r\]*\\()"
+ .t2 search -forwards -regexp $markExpr 1.41 end
+} {}
+test text-20.107 {TextSearchCmd, multiline regexp matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 {
+static int SetFsPathFromAny _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj *objPtr));
+static Tcl_Obj* FSNormalizeAbsolutePath
+ _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj *pathPtr));}
+ set markExpr "^(\[A-Za-z0-9~_\]+\[ \t\n\r\]*\\(|(\[^ \t\(#\n\r/@:\*\]\[^=\(\r\n\]*\[ \t\]+\\*?)?"
+ append markExpr "(\[A-Za-z0-9~_\]+(<\[^>\]*>)?(::)?(\[A-Za-z0-9~_\]+::)*\[-A-Za-z0-9~_+ <>\|\\*/\]+|\[A-Za-z0-9~_\]+)"
+ append markExpr "\[ \n\t\r\]*\\()"
+ .t2 search -backwards -all -regexp $markExpr end
+} {2.0}
+test text-20.108 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -all -regexp -count foo bar\nfoo 1.0
+} {1.3 2.3}
+test text-20.109 {TextSearchCmd, multiline matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -all -backwards -regexp -count foo bar\nfoo 1.0
+} {2.3 1.3}
+test text-20.110 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -- "blah" 3.3 1.3
+} {}
+test text-20.111 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "foobar\nfoobar\nfoobar"
+ .t2 search -backwards -- "blah" 1.3 3.3
+} {}
+test text-20.112 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "if (stringPtr->uallocated > 0) \{x"
+ .t2 search -backwards -regexp -- "\[\]\")\}\[(\{\]" "1.32" 1.0
+} {1.31}
+test text-20.113 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "if (stringPtr->uallocated > 0) \{x"
+ .t2 search -regexp -- "\[\]\")\}\[(\{\]" 1.30 "1.0 lineend"
+} {1.31}
+test text-20.114 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "if (stringPtr->uallocated > 0) \{x"
+ .t2 search -backwards -all -regexp -- "\[\]\")\}\[(\{\]" "1.32" 1.0
+} {1.31 1.29 1.3}
+test text-20.115 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "if (stringPtr->uallocated > 0) \{x"
+ .t2 search -all -regexp -- "\[\]\")\}\[(\{\]" 1.0 "1.0 lineend"
+} {1.3 1.29 1.31}
+test text-20.116 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "if (stringPtr->uallocated > 0) \{x"
+ .t2 search -backwards -- "\{" "1.32" 1.0
+} {1.31}
+test text-20.117 {TextSearchCmd, wrapping and limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert end "if (stringPtr->uallocated > 0) \{x"
+ .t2 search -- "\{" 1.30 "1.0 lineend"
+} {1.31}
+test text-20.118 {TextSearchCmd, multiline regexp matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 {
+
+void
+Tcl_SetObjLength(objPtr, length)
+ register Tcl_Obj *objPtr; /* Pointer to object. This object must
+ * not currently be shared. */
+ register int length; /* Number of bytes desired for string
+ * representation of object, not including
+ * terminating null byte. */
+\{
+ char *new;
+}
+ set markExpr "^(\[A-Za-z0-9~_\]+\[ \t\n\r\]*\\(|(\[^ \t\(#\n\r/@:\*\]\[^=\(\r\n\]*\[ \t\]+\\*?)?"
+ append markExpr "(\[A-Za-z0-9~_\]+(<\[^>\]*>)?(::)?(\[A-Za-z0-9~_\]+::)*\[-A-Za-z0-9~_+ <>\|\\*/\]+|\[A-Za-z0-9~_\]+)"
+ append markExpr "\[ \n\t\r\]*\\()"
+ .t2 search -all -regexp -- $markExpr 1.0
+} {4.0}
+test text-20.119 {TextSearchCmd, multiline regexp matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ set markExpr {^[a-z]+}
+ # This should not match, and should not wrap
+ .t2 search -regexp -- $markExpr end end
+} {}
+test text-20.120 {TextSearchCmd, multiline regexp matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ set markExpr {^[a-z]+}
+ # This should not match, and should not wrap
+ .t2 search -regexp -- $markExpr end+10c end
+} {}
+test text-20.121 {TextSearchCmd, multiline regexp matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ set markExpr {^[a-z]+}
+ # This should not match, and should not wrap
+ .t2 search -regexp -backwards -- $markExpr 1.0 1.0
+} {}
+test text-20.122 {TextSearchCmd, regexp linestop} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ .t2 search -regexp -- {i.*x} 1.0
+} {2.6}
+test text-20.123 {TextSearchCmd, multiline regexp nolinestop matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ .t2 search -regexp -nolinestop -- {i.*x} 1.0
+} {1.1}
+test text-20.124 {TextSearchCmd, regexp linestop} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ .t2 search -regexp -all -overlap -- {i.*x} 1.0
+} {2.6}
+test text-20.124.1 {TextSearchCmd, regexp linestop} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ .t2 search -regexp -all -- {i.*x} 1.0
+} {2.6}
+test text-20.125 {TextSearchCmd, multiline regexp nolinestop matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ list [.t2 search -regexp -all -overlap -count c -nolinestop -- {i.*x} 1.0] $c
+} {{1.1 2.6} {26 10}}
+test text-20.125.1 {TextSearchCmd, multiline regexp nolinestop matching} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "first line\nlast line of text"
+ list [.t2 search -regexp -all -count c -nolinestop -- {i.*x} 1.0] $c
+} {1.1 26}
+test text-20.126 {TextSearchCmd, stop at end of line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " \t\n last line of text"
+ .t2 search -regexp -nolinestop -- {[^ \t]} 1.0
+} {1.3}
+test text-20.127 {TextSearchCmd, overlapping all matches} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde abcde"
+ list [.t2 search -regexp -all -overlap -count c -- {\w+} 1.0] $c
+} {{1.0 1.6} {5 5}}
+test text-20.127.1 {TextSearchCmd, non-overlapping all matches} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde abcde"
+ list [.t2 search -regexp -all -count c -- {\w+} 1.0] $c
+} {{1.0 1.6} {5 5}}
+test text-20.128 {TextSearchCmd, stop at end of line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde abcde"
+ list [.t2 search -backwards -regexp -all -count c -- {\w+} 1.0] $c
+} {{1.6 1.0} {5 5}}
+test text-20.129 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ list [.t2 search -backwards -regexp -count c -- {Z\w+} 1.21 1.5] $c
+} {1.8 8}
+test text-20.130 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ list [.t2 search -backwards -all -overlap -regexp -count c -- {Z\w+} 1.21 1.5] $c
+} {1.8 8}
+test text-20.130.1 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ list [.t2 search -backwards -all -regexp -count c -- {Z\w+} 1.21 1.5] $c
+} {1.8 8}
+test text-20.131 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ list [.t2 search -backwards -overlap -all -regexp -count c -- {Z\w+} 1.21 1.1] $c
+} {1.4 12}
+test text-20.131.1 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ list [.t2 search -backwards -overlap -all -regexp -count c -- {Z[^Z]+Z} 1.21 1.1] $c
+} {{1.8 1.4} {5 5}}
+test text-20.131.2 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ list [.t2 search -backwards -all -regexp -count c -- {Z\w+} 1.21 1.1] $c
+} {1.4 12}
+test text-20.132 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again\n"
+ list [.t2 search -backwards -all -overlap -regexp -count c -- {Z\w+} 2.21 1.5] $c
+} {{2.4 1.8} {12 8}}
+test text-20.132.1 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again\n"
+ list [.t2 search -backwards -all -regexp -count c -- {Z\w+} 2.21 1.5] $c
+} {{2.4 1.8} {12 8}}
+test text-20.133 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again\n"
+ list [.t2 search -backwards -overlap -all -regexp -count c -- {Z\w+} 2.21 1.1] $c
+} {{2.4 1.4} {12 12}}
+test text-20.133.1 {TextSearchCmd, backwards search stop index } {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again"
+ .t2 insert 1.0 "bla ZabcZdefZghi and some text again\n"
+ list [.t2 search -backwards -all -regexp -count c -- {Z\w+} 2.21 1.1] $c
+} {{2.4 1.4} {12 12}}
+test text-20.134 {TextSearchCmd, search -all example} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 {
+
+See the package: supersearch for more information.
+
+
+See the package: incrementalSearch for more information.
+
+package: Brws .
+
+
+See the package: marks for more information.
+
+}
+ set pat {package: ([a-zA-Z0-9][-a-zA-Z0-9._+#/]*)}
+ list [.t2 search -nolinestop -regexp -nocase -all -forwards \
+ -count c -- $pat 1.0 end] $c
+} {{3.8 6.8 8.0 11.8} {20 26 13 14}}
+test text-20.135 {TextSearchCmd, backwards search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foobarfoobaaaaaaaaaaarfoo"
+ .t2 search -backwards -regexp {fooba+rfoo} end
+} {1.6}
+test text-20.135.1 {TextSearchCmd, backwards search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foobarfoobaaaaaaaaaaarfoo"
+ .t2 search -backwards -overlap -all -regexp {fooba+rfoo} end
+} {1.6 1.0}
+test text-20.135.2 {TextSearchCmd, backwards search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foobarfoobaaaaaaaaaaarfoo"
+ .t2 search -backwards -all -regexp {fooba+rfoo} end
+} {1.6}
+test text-20.135.3 {TextSearchCmd, forwards search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foobarfoobaaaaaaaaaaarfoo"
+ .t2 search -all -overlap -regexp {fooba+rfoo} end
+} {1.0 1.6}
+test text-20.135.4 {TextSearchCmd, forwards search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foobarfoobaaaaaaaaaaarfoo"
+ .t2 search -all -regexp {fooba+rfoo} end
+} {1.0}
+test text-20.136 {TextSearchCmd, forward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abababab"
+ .t2 search -exact -overlap -all {abab} 1.0
+} {1.0 1.2 1.4}
+test text-20.136.1 {TextSearchCmd, forward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abababab"
+ .t2 search -exact -all {abab} 1.0
+} {1.0 1.4}
+test text-20.137 {TextSearchCmd, backward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "ababababab"
+ .t2 search -exact -overlap -backwards -all {abab} end
+} {1.6 1.4 1.2 1.0}
+test text-20.137.1 {TextSearchCmd, backward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "ababababab"
+ .t2 search -exact -backwards -all {abab} end
+} {1.6 1.2}
+test text-20.137.2 {TextSearchCmd, backward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abababababab"
+ .t2 search -exact -backwards -all {abab} end
+} {1.8 1.4 1.0}
+test text-20.138 {TextSearchCmd, forward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foo\nbar\nfoo\nbar\nfoo\nbar\nfoo\n"
+ .t2 search -exact -overlap -all "foo\nbar\nfoo" 1.0
+} {1.0 3.0 5.0}
+test text-20.138.1 {TextSearchCmd, forward exact search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foo\nbar\nfoo\nbar\nfoo\nbar\nfoo\n"
+ .t2 search -exact -all "foo\nbar\nfoo" 1.0
+} {1.0 5.0}
+test text-20.139 {TextSearchCmd, backward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foo\nbar\nfoo\nbar\nfoo\nbar\nfoo\n"
+ .t2 search -exact -overlap -backward -all "foo\nbar\nfoo" end
+} {5.0 3.0 1.0}
+test text-20.140 {TextSearchCmd, backward exact search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foo\nbar\nfoo\nbar\nfoo\nbar\nfoo\n"
+ .t2 search -exact -backward -all "foo\nbar\nfoo" end
+} {5.0 1.0}
+test text-20.141 {TextSearchCmd, backward exact search overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foo\nbar\nfoo\nbar\nfoo\nbar\nfoo\n"
+ .t2 search -regexp -backward -overlap -all "foo\nbar\nfoo" end
+} {5.0 3.0 1.0}
+test text-20.142 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "foo\nbar\nfoo\nbar\nfoo\nbar\nfoo\n"
+ .t2 search -regexp -backward -all "foo\nbar\nfoo" end
+} {5.0 1.0}
+test text-20.142a {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -- {(\$)?[\w:_]+} 1.9
+} {1.7}
+test text-20.143 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -- {(\$)?[\w:_]+} 1.9 1.5
+} {1.7}
+test text-20.144 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -- {(\$)?[\w:_]+} 1.9 1.7
+} {1.7}
+test text-20.145 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -- {(\$)?[\w:_]+} 1.9 1.8
+} {1.8}
+test text-20.146 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -all -- {(\$)?[\w:_]+} 1.9 1.3
+} {1.7 1.3}
+test text-20.147 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -all -- {(\$)?[\w:_]+} 1.9 1.13
+} {}
+test text-20.148 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -all -- {(\$)?[\w:_]+} 2.0 1.3
+} {1.12 1.7 1.3}
+test text-20.149 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 " aasda asdj werwer"
+ .t2 search -regexp -backward -all -- {(\$)?[\w:_]+} 1.3
+} {1.1 1.12 1.7 1.3}
+test text-20.150 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\n"
+ .t2 search -regexp -backward -all -- {(\w+\n)+} end
+} {1.0}
+test text-20.151 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\n"
+ .t2 search -regexp -backward -all -- {(\w+\n)+} end 1.5
+} {2.0}
+test text-20.152 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ .t2 search -regexp -backward -all -- {(\w+\n\w)+} end 1.5
+} {2.0}
+test text-20.153 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -all -count foo -- {(\w+\n)+} 1.0] $foo
+} {1.0 20}
+test text-20.154 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ set res {}
+ lappend res \
+ [list [.t2 search -regexp -all -count foo -- {(\w+\n)+} 1.0] $foo] \
+ [list [.t2 search -regexp -all -count foo -- {(\w+)+} 1.0] $foo]
+} {{1.0 20} {{1.0 2.0 3.0 4.0} {5 5 5 1}}}
+test text-20.155 {TextSearchCmd, regexp search greedy} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -all -nolinestop -count foo -- {.*} 1.0] $foo
+} {1.0 20}
+test text-20.156 {TextSearchCmd, regexp search greedy} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -all -count foo -- {.*} 1.0] $foo
+} {{1.0 2.0 3.0 4.0} {5 5 5 1}}
+test text-20.157 {TextSearchCmd, regexp search greedy multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -count foo -- {(\w+\n\w)+} 1.0] $foo
+} {1.0 19}
+test text-20.158 {TextSearchCmd, regexp search greedy multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -backwards -count foo -- {(\w+\n\w)+} end] $foo
+} {1.0 19}
+test text-20.159 {TextSearchCmd, regexp search greedy multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -all -backwards -count foo -- {(\w+\n\w)+} end] $foo
+} {1.0 19}
+test text-20.160 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ .t2 search -regexp -backward -all -- {(\w+\n\w)+} end 1.5
+} {2.0}
+test text-20.161 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ .t2 search -regexp -backward -all -- {(\w+\n\w)+} end 1.3
+} {1.3}
+test text-20.162 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -forward -count foo -- {(\w+\n\w)+} 1.3] $foo
+} {1.3 16}
+test text-20.163 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -forward -all -count foo -- {(\w+\n\w)+} 1.3] $foo
+ # This result is somewhat debatable -- the two results do overlap,
+ # but only because the search has totally wrapped around back to
+ # the start.
+} {{1.3 1.0} {16 19}}
+test text-20.164 {TextSearchCmd, backward regexp search no-overlaps} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "abcde\nabcde\nabcde\na"
+ list [.t2 search -regexp -forward -all -count foo -- {(\w+\n\w)+} 1.0 1.3] $foo
+} {1.0 19}
+test text-20.165 {TextSearchCmd, regexp search multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\naaaa\nbbbb\n"
+ list [.t2 search -regexp -forward -all -count foo -- {(a+\n(b+\n))+} 1.0] $foo
+} {1.0 20}
+test text-20.166 {TextSearchCmd, regexp search complex cases} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\naaaa\nbbbb\n"
+ list [.t2 search -regexp -forward -all -count foo \
+ -- {(a+\n(b+\n))+} 1.0] $foo
+} {1.0 20}
+test text-20.167 {TextSearchCmd, regexp search multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\ncccc\nbbbb\naaaa\n"
+ set foo {}
+ list [.t2 search -regexp -forward -all -count foo \
+ -- {(b+\nc+\nb+)\na+} 1.0] $foo
+} {2.0 19}
+test text-20.168 {TextSearchCmd, regexp search multi-line} {knownBug} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\ncccc\nbbbb\naaaa\n"
+ set foo {}
+ list [.t2 search -regexp -forward -all -count foo \
+ -- {(a+|b+\nc+\nb+)\na+} 1.0] $foo
+} {2.0 19}
+test text-20.169 {TextSearchCmd, regexp search multi-line} {knownBug} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\ncccc\nbbbb\naaaa\n"
+ set foo {}
+ list [.t2 search -regexp -forward -all -count foo \
+ -- {(a+|b+\nc+\nb+)+\na+} 1.0] $foo
+} {2.0 19}
+test text-20.170 {TextSearchCmd, regexp search multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\ncccc\nbbbb\naaaa\n"
+ set foo {}
+ list [.t2 search -regexp -forward -all -count foo \
+ -- {((a+|b+\nc+\nb+)+\n)+a+} 1.0] $foo
+} {1.0 24}
+test text-20.171 {TextSearchCmd, regexp search multi-line} {knownBug} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\nbbbb\nbbbb\nbbbb\n"
+ list [.t2 search -regexp -backward -all -count foo \
+ -- {b+\n|a+\n(b+\n)+} end] $foo
+} {1.0 25}
+test text-20.172 {TextSearchCmd, regexp search multi-line} {knownBug} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aaaa\nbbbb\nbbbb\nbbbb\nbbbb\n"
+ .t2 search -regexp -backward -- {b+\n|a+\n(b+\n)+} end
+ # Should match at 1.0 for a true greedy match
+} {1.0}
+test text-20.172.1 {TextSearchCmd, regexp search multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "line0\nline1\nline1\nline1\nline1\nline2\nline2\nline2\nline3\n"
+ .t2 search -nolinestop -regexp -nocase -forwards -- {^(.*)\n(\1\n)+} 1.0 end
+ # Matches at 6.0 currently
+} {2.0}
+test text-20.173 {TextSearchCmd, regexp search multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "\naaaxxx\nyyy\n"
+ set res {}
+ lappend res [.t2 search -count c -regexp -- {x*\ny*} 2.0] $c
+ lappend res [.t2 search -count c -regexp -- {x*\ny*} 2.1] $c
+ set res
+} {2.3 7 2.3 7}
+test text-20.174 {TextSearchCmd, regexp search multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "\naaa\n\n\n\n\nxxx\n"
+ set res {}
+ lappend res [.t2 search -count c -regexp -- {\n+} 2.0] $c
+ lappend res [.t2 search -count c -regexp -- {\n+} 2.1] $c
+ set res
+} {2.3 5 2.3 5}
+test text-20.175 {TextSearchCmd, regexp search multi-line} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "\naaa\n\n\t \n\t\t\t \n\nxxx\n"
+ set res {}
+ lappend res [.t2 search -count c -regexp -- {(\n+(\t+ *)*)+} 2.0] $c
+ set res
+} {2.3 13}
+test text-20.176 {TextSearchCmd, empty search range} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\na\na\n"
+ .t2 search -- a 2.0 1.0
+} {}
+test text-20.177 {TextSearchCmd, empty search range} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\na\na\n"
+ .t2 search -backwards -- a 1.0 2.0
+} {}
+test text-20.178 {TextSearchCmd, empty search range} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\na\na\n"
+ .t2 search -- a 1.0 1.0
+} {}
+test text-20.179 {TextSearchCmd, empty search range} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\na\na\n"
+ .t2 search -backwards -- a 2.0 2.0
+} {}
+test text-20.180 {TextSearchCmd, elide up to match} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\nb\nc"
+ .t2 tag configure e -elide 1
+ set res {}
+ lappend res [.t2 search -regexp a 1.0]
+ lappend res [.t2 search -regexp b 1.0]
+ lappend res [.t2 search -regexp c 1.0]
+ .t2 tag add e 1.0 2.0
+ lappend res [.t2 search -regexp a 1.0]
+ lappend res [.t2 search -regexp b 1.0]
+ lappend res [.t2 search -regexp c 1.0]
+ lappend res [.t2 search -elide -regexp a 1.0]
+ lappend res [.t2 search -elide -regexp b 1.0]
+ lappend res [.t2 search -elide -regexp c 1.0]
+} {1.0 2.0 3.0 {} 2.0 3.0 1.0 2.0 3.0}
+test text-20.181 {TextSearchCmd, elide up to match, backwards} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\nb\nc"
+ .t2 tag configure e -elide 1
+ set res {}
+ lappend res [.t2 search -backward -regexp a 1.0]
+ lappend res [.t2 search -backward -regexp b 1.0]
+ lappend res [.t2 search -backward -regexp c 1.0]
+ .t2 tag add e 1.0 2.0
+ lappend res [.t2 search -backward -regexp a 1.0]
+ lappend res [.t2 search -backward -regexp b 1.0]
+ lappend res [.t2 search -backward -regexp c 1.0]
+ lappend res [.t2 search -backward -elide -regexp a 1.0]
+ lappend res [.t2 search -backward -elide -regexp b 1.0]
+ lappend res [.t2 search -backward -elide -regexp c 1.0]
+} {1.0 2.0 3.0 {} 2.0 3.0 1.0 2.0 3.0}
+test text-20.182 {TextSearchCmd, elide up to match} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\nb\nc"
+ .t2 tag configure e -elide 1
+ set res {}
+ lappend res [.t2 search a 1.0]
+ lappend res [.t2 search b 1.0]
+ lappend res [.t2 search c 1.0]
+ .t2 tag add e 1.0 2.0
+ lappend res [.t2 search a 1.0]
+ lappend res [.t2 search b 1.0]
+ lappend res [.t2 search c 1.0]
+ lappend res [.t2 search -elide a 1.0]
+ lappend res [.t2 search -elide b 1.0]
+ lappend res [.t2 search -elide c 1.0]
+} {1.0 2.0 3.0 {} 2.0 3.0 1.0 2.0 3.0}
+test text-20.183 {TextSearchCmd, elide up to match, backwards} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "a\nb\nc"
+ .t2 tag configure e -elide 1
+ set res {}
+ lappend res [.t2 search -backward a 1.0]
+ lappend res [.t2 search -backward b 1.0]
+ lappend res [.t2 search -backward c 1.0]
+ .t2 tag add e 1.0 2.0
+ lappend res [.t2 search -backward a 1.0]
+ lappend res [.t2 search -backward b 1.0]
+ lappend res [.t2 search -backward c 1.0]
+ lappend res [.t2 search -backward -elide a 1.0]
+ lappend res [.t2 search -backward -elide b 1.0]
+ lappend res [.t2 search -backward -elide c 1.0]
+} {1.0 2.0 3.0 {} 2.0 3.0 1.0 2.0 3.0}
+test text-20.184 {TextSearchCmd, elide up to match} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aa\nbb\ncc"
+ .t2 tag configure e -elide 1
+ set res {}
+ lappend res [.t2 search ab 1.0]
+ lappend res [.t2 search bc 1.0]
+ .t2 tag add e 1.1 2.1
+ lappend res [.t2 search ab 1.0]
+ lappend res [.t2 search b 1.0]
+ .t2 tag remove e 1.0 end
+ .t2 tag add e 2.1 3.1
+ lappend res [.t2 search bc 1.0]
+ lappend res [.t2 search c 1.0]
+ .t2 tag remove e 1.0 end
+ .t2 tag add e 2.1 3.0
+ lappend res [.t2 search bc 1.0]
+ lappend res [.t2 search c 1.0]
+} {{} {} 1.0 2.1 2.0 3.1 2.0 3.0}
+test text-20.185 {TextSearchCmd, elide up to match} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "aa\nbb\ncc"
+ .t2 tag configure e -elide 1
+ set res {}
+ lappend res [.t2 search -regexp ab 1.0]
+ lappend res [.t2 search -regexp bc 1.0]
+ .t2 tag add e 1.1 2.1
+ lappend res [.t2 search -regexp ab 1.0]
+ lappend res [.t2 search -regexp b 1.0]
+ .t2 tag remove e 1.0 end
+ .t2 tag add e 2.1 3.1
+ lappend res [.t2 search -regexp bc 1.0]
+ lappend res [.t2 search -regexp c 1.0]
+ .t2 tag remove e 1.0 end
+ .t2 tag add e 2.1 3.0
+ lappend res [.t2 search -regexp bc 1.0]
+ lappend res [.t2 search -regexp c 1.0]
+} {{} {} 1.0 2.1 2.0 3.1 2.0 3.0}
+test text-20.186 {TextSearchCmd, strict limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -strictlimits -- "world" 1.3 1.8
+} {}
+test text-20.187 {TextSearchCmd, strict limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -strictlimits -- "world" 1.3 1.10
+} {}
+test text-20.188 {TextSearchCmd, strict limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -strictlimits -- "world" 1.3 1.11
+} {1.6}
+test text-20.189 {TextSearchCmd, strict limits backwards} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -strictlimits -backward -- "world" 2.3 1.8
+} {}
+test text-20.190 {TextSearchCmd, strict limits backwards} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -strictlimits -backward -- "world" 2.3 1.6
+} {1.6}
+test text-20.191 {TextSearchCmd, strict limits backwards} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -strictlimits -backward -- "world" 2.3 1.7
+} {}
+test text-20.192 {TextSearchCmd, strict limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -regexp -strictlimits -- "world" 1.3 1.8
+} {}
+test text-20.193 {TextSearchCmd, strict limits} {
+ deleteWindows
+ pack [text .t2]
+ .t2 insert 1.0 "Hello world!\nThis is a test\n"
+ .t2 search -regexp -strictlimits -backward -- "world" 2.3 1.8
+} {}
+
deleteWindows
text .t2 -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
pack .t2
.t2 insert end "1\t2\t3\t4\t55.5"
+
test text-21.1 {TkTextGetTabs procedure} {
list [catch {.t2 configure -tabs "\{{}"} msg] $msg
} {1 {unmatched open brace in list}}
@@ -1298,7 +2818,7 @@ test text-22.3 {TextDumpCmd procedure, bad args} {
} {1 {Usage: .t dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?}}
test text-22.4 {TextDumpCmd procedure, bad args} {
list [catch {.t dump -bogus} msg] $msg
-} {1 {Usage: .t dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?}}
+} {1 {bad option "-bogus": must be -all, -command, -image, -mark, -tag, -text, or -window}}
test text-22.5 {TextDumpCmd procedure, bad args} {
list [catch {.t dump bogus} msg] $msg
} {1 {bad text index "bogus"}}
@@ -1318,12 +2838,10 @@ test text-22.9 {TextDumpCmd procedure, same indices} {
test text-22.10 {TextDumpCmd procedure, negative range} {
.t dump 1.5 1.0
} {}
-
.t delete 1.0 end
.t insert end "Line One\nLine Two\nLine Three\nLine Four"
.t mark set insert 1.0
.t mark set current 1.0
-
test text-22.11 {TextDumpCmd procedure, stop at begin-line} {
.t dump -text 1.0 2.0
} {text {Line One
@@ -1333,7 +2851,6 @@ test text-22.12 {TextDumpCmd procedure, span multiple lines} {
} {text {One
} 1.5 text {Line Two
} 2.0 text {Line Three} 3.0}
-
.t tag add x 2.0 2.end
.t tag add y 1.0 end
.t mark set m 2.4
@@ -1351,7 +2868,6 @@ test text-22.15 {TextDumpCmd procedure, tags only} {
test text-22.16 {TextDumpCmd procedure, tags only} {
.t dump -tag 1.0 end
} {tagon y 1.0 tagon x 2.0 tagoff x 2.8 tagoff y 5.0}
-
.t mark set insert 1.0
.t mark set current 1.0
test text-22.17 {TextDumpCmd procedure, marks only} {
@@ -1366,7 +2882,6 @@ test text-22.19 {TextDumpCmd procedure, marks only} {
test text-22.20 {TextDumpCmd procedure, marks only} {
.t dump -mark 1.0 end
} {mark current 1.0 mark insert 1.0 mark m 2.4 mark n 4.0 mark END 5.0}
-
button .hello -text Hello
.t window create 3.end -window .hello
for {set i 0} {$i < 100} {incr i} {
@@ -1379,7 +2894,6 @@ test text-22.21 {TextDumpCmd procedure, windows only} {
test text-22.22 {TextDumpCmd procedure, windows only} {
.t dump -window 5.0 end
} {window {} 100.0}
-
.t delete 1.0 end
eval {.t mark unset} [.t mark names]
.t insert end "Line One\nLine Two\nLine Three\nLine Four"
@@ -1420,6 +2934,15 @@ test text-22.26 {TextDumpCmd procedure, unicode characters} {
.t insert 1.0 abc\xb1\xb1\xb1
.t dump -all 1.0 2.0
} "text abc\xb1\xb1\xb1 1.0 mark insert 1.6 mark current 1.6 text {\n} 1.6"
+test text-22.27 {TextDumpCmd procedure, peer present} -setup {
+ destroy .t
+} -body {
+ text .t
+ .t peer create .t.t
+ .t dump -all 1.0 end
+} -cleanup {
+ destroy .t
+} -result "mark insert 1.0 mark current 1.0 text {\n} 1.0"
set l [interp hidden]
deleteWindows
@@ -1448,11 +2971,9 @@ test text-24.1 {bug fix - 1642} {
test text-25.1 {TextEditCmd procedure, argument parsing} {
list [catch {.t edit} msg] $msg
} {1 {wrong # args: should be ".t edit option ?arg arg ...?"}}
-
test text-25.2 {TextEditCmd procedure, argument parsing} {
list [catch {.t edit gorp} msg] $msg
-} {1 {bad edit option "gorp": must be modified, redo, reset, separator or undo}}
-
+} {1 {bad edit option "gorp": must be modified, redo, reset, separator, or undo}}
test text-25.3 {TextEditUndo procedure, undoing changes} {
catch {destroy .t}
text .t -undo 1
@@ -1463,7 +2984,6 @@ test text-25.3 {TextEditUndo procedure, undoing changes} {
.t edit undo
.t get 1.0 end
} "line\n\n"
-
test text-25.4 {TextEditRedo procedure, redoing changes} {
catch {destroy .t}
text .t -undo 1
@@ -1475,7 +2995,6 @@ test text-25.4 {TextEditRedo procedure, redoing changes} {
.t edit redo
.t get 1.0 end
} "line\nshould be back after redo\n\n"
-
test text-25.5 {TextEditUndo procedure, resetting stack} {
catch {destroy .t}
text .t -undo 1
@@ -1487,7 +3006,6 @@ test text-25.5 {TextEditUndo procedure, resetting stack} {
catch {.t edit undo} msg
set msg
} "nothing to undo"
-
test text-25.6 {TextEditCmd procedure, insert separator} {
catch {destroy .t}
text .t -undo 1
@@ -1498,7 +3016,6 @@ test text-25.6 {TextEditCmd procedure, insert separator} {
.t edit undo
.t get 1.0 end
} "line 1\n\n"
-
test text-25.7 {-autoseparators configuration option} {
catch {destroy .t}
text .t -undo 1 -autoseparators 0
@@ -1509,7 +3026,6 @@ test text-25.7 {-autoseparators configuration option} {
.t edit undo
.t get 1.0 end
} "\n"
-
test text-25.8 {TextEditCmd procedure, modified flag} {
catch {destroy .t}
text .t
@@ -1517,7 +3033,6 @@ test text-25.8 {TextEditCmd procedure, modified flag} {
.t insert end "line 1\n"
.t edit modified
} {1}
-
test text-25.9 {TextEditCmd procedure, reset modified flag} {
catch {destroy .t}
text .t
@@ -1526,7 +3041,6 @@ test text-25.9 {TextEditCmd procedure, reset modified flag} {
.t edit modified 0
.t edit modified
} {0}
-
test text-25.10 {TextEditCmd procedure, set modified flag} {
catch {destroy .t}
text .t
@@ -1549,7 +3063,6 @@ test text-25.10.1 {TextEditCmd procedure, set modified flag repeat} {
update idletasks
lappend ::retval [.t edit modified]
} {0 modified 1 1}
-
test text-25.11 {<<Modified>> virtual event} {
set ::retval unmodified
catch {destroy .t}
@@ -1580,7 +3093,6 @@ test text-25.11.2 {<<Modified>> virtual event - delete before Modified} {
.t delete 1.0 1.2
set ::retval
} {thing special}
-
test text-25.12 {<<Selection>> virtual event} {
set ::retval no_selection
catch {destroy .t}
@@ -1592,7 +3104,6 @@ test text-25.12 {<<Selection>> virtual event} {
.t tag add sel 1.0 1.1
set ::retval
} {selection_changed}
-
test text-25.13 {-maxundo configuration option} {
catch {destroy .t}
text .t -undo 1 -autoseparators 1 -maxundo 2
@@ -1605,19 +3116,15 @@ test text-25.13 {-maxundo configuration option} {
catch {.t edit undo}
.t get 1.0 end
} "line 1\n\n"
-
-test text-25.14 {undo with space-based path} {
- set t {.t e x t}
- destroy $t
- text $t -undo 1
- $t insert end "line 1\n"
- $t delete 1.4 1.6
- $t insert end "line 2\n"
- $t edit undo
- $t edit undo
- $t get 1.0 end
-} "line 1\n\n"
-
+test text-25.15 {bug fix 1536735 - undo with empty text} {
+ catch {destroy .t}
+ text .t -undo 1
+ set r [.t edit modified]
+ .t delete 1.0
+ lappend r [.t edit modified]
+ lappend r [catch {.t edit undo}]
+ lappend r [.t edit modified]
+} {0 0 1 0}
test text-25.18 {patch 1469210 - inserting after undo} -setup {
destroy .t
} -body {
@@ -1637,9 +3144,548 @@ test text-26.1 {bug fix - 624372, ControlUtfProc long lines} {
.t insert end [string repeat "\1" 500]
} {}
+test text-27.1 {tabs - must be positive and must be increasing} {
+ destroy .t
+ pack [text .t -wrap none]
+ list [catch {.t configure -tabs {0}} msg] $msg
+} {1 {tab stop "0" is not at a positive distance}}
+test text-27.2 {tabs - must be positive and must be increasing} {
+ destroy .t
+ pack [text .t -wrap none]
+ list [catch {.t configure -tabs {-5}} msg] $msg
+} {1 {tab stop "-5" is not at a positive distance}}
+test text-27.3 {tabs - must be positive and must be increasing} {knownBug} {
+ # This bug will be fixed in Tk 9.0, when we can allow a minor
+ # incompatibility with Tk 8.x
+ destroy .t
+ pack [text .t -wrap none]
+ list [catch {.t configure -tabs {10c 5c}} msg] $msg
+} {1 {tabs must be monotonically increasing, but "5c" is smaller than or equal to the previous tab}}
+test text-27.4 {tabs - must be positive and must be increasing} {
+ destroy .t
+ pack [text .t -wrap none]
+ .t insert end "a\tb\tc\td\te"
+ catch {.t configure -tabs {10c 5c}}
+ update ; update ; update
+ # This test must simply not go into an infinite loop to succeed
+ set result 1
+} {1}
+
+test text-28.0 {repeated insert and scroll} {
+ foreach subcmd {
+ {moveto 1}
+ {scroll 1 pages}
+ {scroll 100 pixels}
+ {scroll 10 units}
+ } {
+ destroy .t
+ pack [text .t]
+ for {set i 0} {$i < 30} {incr i} {
+ .t insert end "blabla\n"
+ eval .t yview $subcmd
+ }
+ }
+ # This test must simply not crash to succeed
+ set result 1
+} {1}
+
+test text-29.0 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ pack [.t peer create .tt.t]
+ destroy .t .tt
+} {}
+test text-29.1 {peer widgets} {
+ destroy .t .t1 .t2
+ toplevel .t1
+ toplevel .t2
+ pack [text .t]
+ pack [.t peer create .t1.t]
+ pack [.t peer create .t2.t]
+ .t insert end "abcd\nabcd"
+ update
+ destroy .t1
+ update
+ .t insert end "abcd\nabcd"
+ update
+ destroy .t .t2
+ update
+} {}
+test text-29.2 {peer widgets} {
+ destroy .t .t1 .t2
+ toplevel .t1
+ toplevel .t2
+ pack [text .t]
+ pack [.t peer create .t1.t]
+ pack [.t peer create .t2.t]
+ .t insert end "abcd\nabcd"
+ update
+ destroy .t
+ update
+ .t2.t insert end "abcd\nabcd"
+ update
+ destroy .t .t2
+ update
+} {}
+test text-29.3 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ pack [.t peer create .tt.t -start 5 -end 11]
+ update
+ destroy .t .tt
+} {}
+test text-29.4 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ pack [.t peer create .tt.t -start 5 -end 11]
+ pack [.tt.t peer create .tt.t2]
+ set res [list [.tt.t index end] [.tt.t2 index end]]
+ update
+ destroy .t .tt
+ set res
+} {7.0 7.0}
+test text-29.4.1 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ pack [.t peer create .tt.t -start 5 -end 11]
+ pack [.tt.t peer create .tt.t2 -start {} -end {}]
+ set res [list [.tt.t index end] [.tt.t2 index end]]
+ update
+ destroy .t .tt
+ set res
+} {7.0 21.0}
+test text-29.5 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ pack [.t peer create .tt.t -start 5 -end 11]
+ update ; update
+ set p1 [.tt.t count -update -ypixels 1.0 end]
+ set p2 [.t count -update -ypixels 5.0 11.0]
+ if {$p1 == $p2} {
+ set res "ok"
+ } else {
+ set res "$p1 and $p2 not equal"
+ }
+ destroy .t .tt
+ set res
+} {ok}
+test text-29.6 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ pack [.t peer create .tt.t -start 5 -end 11]
+ update ; update
+ .t delete 3.0 6.0
+ set res [.tt.t index end]
+ destroy .t .tt
+ set res
+} {6.0}
+test text-29.7 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ pack [.t peer create .tt.t -start 5 -end 11]
+ update ; update
+ .t delete 8.0 12.0
+ set res [.tt.t index end]
+ destroy .t .tt
+ set res
+} {4.0}
+test text-29.8 {peer widgets} {
+ destroy .t .tt
+ toplevel .tt
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ pack [.t peer create .tt.t -start 5 -end 11]
+ update ; update
+ .t delete 3.0 13.0
+ set res [.tt.t index end]
+ destroy .t .tt
+ set res
+} {1.0}
+test text-29.9 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ .t tag add sel 1.0 end-1c
+ set res {}
+ lappend res [.t tag ranges sel]
+ .t configure -start 10 -end 20
+ lappend res [.t tag ranges sel]
+ destroy .t
+ set res
+} {{1.0 100.0} {1.0 11.0}}
+test text-29.10 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ .t tag add sel 1.0 end-1c
+ set res {}
+ lappend res [.t tag ranges sel]
+ .t configure -start 11
+ lappend res [.t tag ranges sel]
+ destroy .t
+ set res
+} {{1.0 100.0} {1.0 90.0}}
+test text-29.11 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ .t tag add sel 1.0 end-1c
+ set res {}
+ lappend res [.t tag ranges sel]
+ .t configure -end 90
+ lappend res [.t tag ranges sel]
+ destroy .t
+ set res
+} {{1.0 100.0} {1.0 90.0}}
+test text-29.12 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ .t tag add sel 1.0 3.0 5.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
+ set res {}
+ lappend res [.t tag prevrange sel 1.0]
+ .t configure -start 6 -end 12
+ lappend res [.t tag ranges sel]
+ lappend res "next" [.t tag nextrange sel 4.0] \
+ [.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
+ [.t tag nextrange sel 7.0]
+ lappend res "prev" [.t tag prevrange sel 1.0] \
+ [.t tag prevrange sel 2.0] [.t tag prevrange sel 3.0] \
+ [.t tag prevrange sel 4.0]
+ destroy .t
+ set res
+} {{} {1.0 2.0 4.0 6.0} next {4.0 6.0} {} {} {} prev {} {1.0 2.0} {1.0 2.0} {1.0 2.0}}
+test text-29.13 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ .t tag add sel 1.0 3.0 9.0 11.0 13.0 15.0 17.0 19.0
+ set res {}
+ .t configure -start 6 -end 12
+ lappend res [.t tag ranges sel]
+ lappend res "next" [.t tag nextrange sel 4.0] \
+ [.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
+ [.t tag nextrange sel 7.0]
+ lappend res "prev" [.t tag prevrange sel 1.0] \
+ [.t tag prevrange sel 2.0] [.t tag prevrange sel 3.0] \
+ [.t tag prevrange sel 4.0]
+ destroy .t
+ set res
+} {{4.0 6.0} next {4.0 6.0} {} {} {} prev {} {} {} {}}
+test text-29.14 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ .t tag add sel 1.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
+ set res {}
+ .t configure -start 6 -end 12
+ lappend res [.t tag ranges sel]
+ lappend res "next" [.t tag nextrange sel 4.0] \
+ [.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
+ [.t tag nextrange sel 7.0]
+ lappend res "prev" [.t tag prevrange sel 1.0] \
+ [.t tag prevrange sel 2.0] [.t tag prevrange sel 3.0] \
+ [.t tag prevrange sel 4.0]
+ destroy .t
+ set res
+} {{1.0 2.0 4.0 6.0} next {4.0 6.0} {} {} {} prev {} {1.0 2.0} {1.0 2.0} {1.0 2.0}}
+test text-29.15 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ set res {}
+ .t tag add sel 1.0 11.0
+ lappend res [.t tag ranges sel]
+ lappend res [catch {.t configure -start 15 -end 10}]
+ lappend res [.t tag ranges sel]
+ .t configure -start 6 -end 12
+ lappend res [.t tag ranges sel]
+ .t configure -start {} -end {}
+ lappend res [.t tag ranges sel]
+ destroy .t
+ set res
+} {{1.0 11.0} 1 {1.0 11.0} {1.0 6.0} {1.0 11.0}}
+test text-29.16 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ set res {}
+ .t tag add sel 1.0 11.0
+ lappend res [.t index sel.first]
+ lappend res [.t index sel.last]
+ destroy .t
+ set res
+} {1.0 11.0}
+test text-29.17 {peer widgets} {
+ destroy .t
+ pack [text .t]
+ for {set i 1} {$i < 20} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ set res {}
+ .t tag delete sel
+ set res [list [catch {.t index sel.first} msg] $msg]
+ destroy .t
+ set res
+} {1 {text doesn't contain any characters tagged with "sel"}}
+
+proc makeText {} {
+ set w .g
+ set font "Times 11"
+ destroy .g
+ toplevel .g
+ frame $w.f -highlightthickness 2 -borderwidth 2 -relief sunken
+ set t $w.f.text
+ text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font -width 70 \
+ -height 35 -wrap word -highlightthickness 0 -borderwidth 0
+ pack $t -expand yes -fill both
+ scrollbar $w.scroll -command "$t yview"
+ pack $w.scroll -side right -fill y
+ pack $w.f -expand yes -fill both
+ $t tag configure center -justify center -spacing1 5m -spacing3 5m
+ $t tag configure buttons -lmargin1 1c -lmargin2 1c -rmargin 1c \
+ -spacing1 3m -spacing2 0 -spacing3 0
+ for {set i 0} {$i < 40} {incr i} {
+ $t insert end "${i}word "
+ }
+ return $t
+}
+
+test text-30.1 {line heights on creation} {
+ set w [makeText]
+ update ; after 1000 ; update
+ set before [$w count -ypixels 1.0 2.0]
+ $w insert 1.0 "a"
+ update
+ set after [$w count -ypixels 1.0 2.0]
+ destroy .g
+ if {$before != $after} {
+ set res "Count changed: $before $after"
+ } else {
+ set res "ok"
+ }
+} {ok}
+
+destroy .t
+text .t
+test text-31.1 {TextWidgetCmd procedure, "peer" option} {
+ list [catch {.t peer foo 1} msg] $msg
+} {1 {bad peer option "foo": must be create or names}}
+test text-31.2 {TextWidgetCmd procedure, "peer" option} {
+ list [catch {.t peer names foo} msg] $msg
+} {1 {wrong # args: should be ".t peer names"}}
+test text-31.3 {TextWidgetCmd procedure, "peer" option} {
+ list [catch {.t p names} msg] $msg
+} {0 {}}
+test text-31.4 {TextWidgetCmd procedure, "peer" option} {
+ .t peer names
+} {}
+test text-31.5 {TextWidgetCmd procedure, "peer" option} {
+ list [catch {.t peer create foo} msg] $msg
+} {1 {bad window path name "foo"}}
+test text-31.6 {TextWidgetCmd procedure, "peer" option} {
+ .t peer create .t2
+ set res {}
+ lappend res [.t peer names]
+ lappend res [.t2 peer names]
+ destroy .t2
+ lappend res [.t peer names]
+} {.t2 .t {}}
+test text-31.7 {peer widget -start, -end} {
+ set res [list [catch {.t configure -start 10 -end 5} msg] $msg]
+ .t configure -start {} -end {}
+ set res
+} {0 {}}
+test text-31.8 {peer widget -start, -end} {
+ .t delete 1.0 end
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ list [catch {.t configure -start 10 -end 5} msg] $msg
+} {1 {-startline must be less than or equal to -endline}}
+test text-31.9 {peer widget -start, -end} {
+ .t delete 1.0 end
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ set res [list [catch {.t configure -start 5 -end 10} msg] $msg]
+ .t configure -start {} -end {}
+ set res
+} {0 {}}
+test text-31.10 {peer widget -start, -end} {
+ .t delete 1.0 end
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ set res [.t index end]
+ lappend res [catch {.t configure -start 5 -end 10 -tab foo}]
+ lappend res [.t index end]
+ lappend res [catch {.t configure -tab foo -start 15 -end 20}]
+ lappend res [.t index end]
+ .t configure -start {} -end {}
+ lappend res [.t index end]
+ set res
+} {101.0 1 101.0 1 101.0 101.0}
+test text-31.11 {peer widget -start, -end} {
+ .t delete 1.0 end
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ set res [.t index end]
+ lappend res [catch {.t configure -start 5 -end 15}]
+ lappend res [.t index end]
+ lappend res [catch {.t configure -start 10 -end 40}]
+ lappend res [.t index end]
+ .t configure -start {} -end {}
+ lappend res [.t index end]
+ set res
+} {101.0 0 11.0 0 31.0 101.0}
+
+test text-32.1 {peer widget -start, -end and selection} {
+ .t delete 1.0 end
+ for {set i 1} {$i < 100} {incr i} {
+ .t insert end "Line $i\n"
+ }
+ .t tag add sel 10.0 20.0
+ set res {}
+ lappend res [.t tag ranges sel]
+ .t configure -start 5 -end 30
+ lappend res [.t tag ranges sel]
+ .t configure -start 5 -end 15
+ lappend res [.t tag ranges sel]
+ .t configure -start 15 -end 30
+ lappend res [.t tag ranges sel]
+ .t configure -start 15 -end 16
+ lappend res [.t tag ranges sel]
+ .t configure -start 25 -end 30
+ lappend res [.t tag ranges sel]
+ .t configure -start {} -end {}
+ lappend res [.t tag ranges sel]
+ set res
+} {{10.0 20.0} {6.0 16.0} {6.0 11.0} {1.0 6.0} {1.0 2.0} {} {10.0 20.0}}
+
+test text-33.1 {widget dump -command alters tags} {
+ .t delete 1.0 end
+ .t insert end "abc\n" a "---" {} "def" b " \n" {} "ghi\n" c
+ .t tag configure b -background red
+ proc Dumpy {key value index} {
+ #puts "KK: $key, $value"
+ .t tag add $value [list $index linestart] [list $index lineend]
+ }
+ .t dump -all -command Dumpy 1.0 end
+ set result "ok"
+} {ok}
+test text-33.2 {widget dump -command makes massive changes} {
+ .t delete 1.0 end
+ .t insert end "abc\n" a "---" {} "def" b " \n" {} "ghi\n" c
+ .t tag configure b -background red
+ proc Dumpy {key value index} {
+ #puts "KK: $key, $value"
+ .t delete 1.0 end
+ }
+ .t dump -all -command Dumpy 1.0 end
+ set result "ok"
+} {ok}
+test text-33.3 {widget dump -command destroys widget} {
+ .t delete 1.0 end
+ .t insert end "abc\n" a "---" {} "def" b " \n" {} "ghi\n" c
+ .t tag configure b -background red
+ proc Dumpy {key value index} {
+ #puts "KK: $key, $value"
+ destroy .t
+ }
+ .t dump -all -command Dumpy 1.0 end
+ set result "ok"
+} {ok}
+
deleteWindows
option clear
+test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup {
+ proc bgerror {m} {set ::my_error $m}
+ set ::my_error {}
+ pack [set w [text .t-1]]
+} -body {
+ tkwait visibility $w
+ event generate $w <1>
+ event generate $w <1>
+ update
+ set ::my_error
+} -cleanup {
+ destroy .t-1
+} -result {}
+
+test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup {
+ proc bgerror {m} {set ::my_error $m}
+ set ::my_error {}
+ pack [set w [text .t+1]]
+} -body {
+ tkwait visibility $w
+ event generate $w <1>
+ event generate $w <1>
+ update
+ set ::my_error
+} -cleanup {
+ destroy $w
+} -result {}
+
+test text-36.3 "bug #1777362: event handling with hyphenated windows" -setup {
+ proc bgerror {m} {set ::my_error $m}
+ set ::my_error {}
+ pack [set w [text .t*1]]
+} -body {
+ tkwait visibility $w
+ event generate $w <1>
+ event generate $w <1>
+ update
+ set ::my_error
+} -cleanup {
+ destroy $w
+} -result {}
+
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/textBTree.test b/tests/textBTree.test
index c3ae6e6..3a89e55 100644
--- a/tests/textBTree.test
+++ b/tests/textBTree.test
@@ -9,10 +9,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
catch {destroy .t}
@@ -897,18 +894,5 @@ test btree-18.9 {tag search back, large complex btree spans} {
destroy .t
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 0b3d385..8e99eff 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -7,15 +7,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-
-namespace import -force tcltest::interpreter
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
+namespace import -force tcltest::test
# The procedure below is used as the scrolling command for the text;
# it just saves the scrolling information in a variable "scrollInfo".
@@ -42,15 +36,33 @@ option add *Text.highlightThickness 2
# because some window managers don't allow the overall width of a window
# to get very narrow.
+catch {destroy .f .t}
frame .f -width 100 -height 20
pack append . .f left
set fixedFont {Courier -12}
+# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics $fixedFont -linespace]
+# 7 on all platforms
set fixedWidth [font measure $fixedFont m]
+# 12 on XP
+set fixedAscent [font metrics $fixedFont -ascent]
+set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP
set varFont {Times -14}
+# 16 on XP, 15 on Solaris 8
+set varHeight [font metrics $varFont -linespace]
+# 13 on XP
+set varAscent [font metrics $varFont -ascent]
+set varDiff [expr {$varHeight - 15}] ;# 1 on XP
+
set bigFont {Helvetica -24}
+# 27 on XP, 27 on Solaris 8
+set bigHeight [font metrics $bigFont -linespace]
+# 21 on XP
+set bigAscent [font metrics $bigFont -ascent]
+set ascentDiff [expr {$bigAscent - $fixedAscent}]
+
text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll
pack append . .t {top expand fill}
.t tag configure big -font $bigFont
@@ -76,6 +88,106 @@ update
if {([winfo rooty .] < 50) || ([winfo rootx .] < 50)} {
wm geom . +50+50
}
+
+test textDisp-0.1 {double tag elide transition} {
+ # Example from tkchat crash. For some reason can only
+ # get this test case to crash when first.
+ catch {destroy .top}
+ pack [text .top]
+
+ foreach val {0 1 2 3} {
+ .top insert 1.0 "hello\n"
+ .top tag configure tag$val
+ .top tag add tag$val 1.0 2.0
+ set ::Options(tag$val) 0
+ }
+
+ proc DoVis {tag} {
+ .top tag config $tag -elide $::Options($tag)
+ }
+
+ proc NickVis {val} {
+ foreach t [array names ::Options ] {
+ if {$::Options($t) != $val} {
+ set ::Options($t) $val
+ DoVis $t
+ }
+ }
+ }
+ NickVis 1
+ unset ::Options
+ destroy .top
+} {}
+
+test textDisp-0.2 {double tag elide transition} {
+ # Example from tkchat crash. For some reason can only
+ # get this test case to crash when first.
+ catch {destroy .top}
+ pack [text .top]
+
+ foreach val {0 1 2 3} {
+ .top insert 1.0 "hello"
+ .top tag configure tag$val
+ .top tag add tag$val 1.0 1.5
+ set ::Options(tag$val) 0
+ }
+
+ proc DoVis {tag} {
+ .top tag config $tag -elide $::Options($tag)
+ }
+
+ proc NickVis {val} {
+ foreach t [array names ::Options ] {
+ if {$::Options($t) != $val} {
+ set ::Options($t) $val
+ DoVis $t
+ }
+ }
+ }
+ NickVis 1
+ unset ::Options
+ destroy .top
+} {}
+
+test textDisp-0.3 {double tag elide transition} {
+ catch {destroy .txt}
+ pack [text .txt]
+ # Note that TRAFFIC should have a higher priority than SYSTEM
+ # in terms of the tag effects.
+ .txt tag configure SYSTEM -elide 0
+ .txt tag configure TRAFFIC -elide 1
+ .txt insert end "\n" {TRAFFIC SYSTEM}
+ update
+ destroy .txt
+} {}
+
+test textDisp-0.4 {double tag elide transition} {
+ catch {destroy .txt}
+ pack [text .txt]
+ # Note that TRAFFIC should have a higher priority than SYSTEM
+ # in terms of the tag effects.
+ .txt tag configure SYSTEM -elide 0
+ .txt tag configure TRAFFIC -elide 1
+ .txt insert end "\n" {SYSTEM TRAFFIC}
+ # Crash was here.
+ update
+ destroy .txt
+} {}
+
+test textDisp-0.5 {double tag elide transition} {
+ catch {destroy .txt}
+ pack [text .txt]
+ .txt tag configure WELCOME -elide 1
+ .txt tag configure SYSTEM -elide 0
+ .txt tag configure TRAFFIC -elide 1
+
+ .txt insert end "\n" {SYSTEM TRAFFIC}
+ .txt insert end "\n" WELCOME
+ # Crash was here.
+ update
+ destroy .txt
+} {}
+
test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
.t delete 1.0 end
.t insert 1.0 "x\ty"
@@ -94,9 +206,9 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
.t tag raise x
update idletasks
lappend x [lindex [.t bbox 1.2] 0]
-} {75 55 55}
+} [list 75 55 55]
.t tag delete x y z
-test textDisp-1.2 {GetStyle procedure, wrapmode} {fonts} {
+test textDisp-1.2 {GetStyle procedure, wrapmode} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcd\nefg hijkl mnop qrstuv wxyz"
@@ -109,7 +221,7 @@ test textDisp-1.2 {GetStyle procedure, wrapmode} {fonts} {
lappend result [.t bbox 2.20]
.t tag add y 1.end 2.2
lappend result [.t bbox 2.20]
-} {{5 31 7 13} {40 31 7 13} {}}
+} [list [list 5 [expr {5+2*$fixedHeight}] 7 $fixedHeight] [list 40 [expr {5+2*$fixedHeight}] 7 $fixedHeight] {}]
.t tag delete x y
test textDisp-2.1 {LayoutDLine, basics} {
@@ -118,49 +230,49 @@ test textDisp-2.1 {LayoutDLine, basics} {
.t insert 1.0 "This is some sample text for testing."
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list [expr 5 + $fixedWidth * 19] 5 $fixedWidth $fixedHeight] [list 5 [expr 5 + $fixedHeight] $fixedWidth $fixedHeight]]
-test textDisp-2.2 {LayoutDLine, basics} {fonts} {
+test textDisp-2.2 {LayoutDLine, basics} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "This isx some sample text for testing."
list [.t bbox 1.19] [.t bbox 1.20]
-} {{138 5 7 13} {5 18 7 13}}
-test textDisp-2.3 {LayoutDLine, basics} {fonts} {
+} [list [list 138 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-2.3 {LayoutDLine, basics} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "This isxxx some sample text for testing."
list [.t bbox 1.19] [.t bbox 1.20]
-} {{138 5 7 13} {5 18 7 13}}
-test textDisp-2.4 {LayoutDLine, word wrap} {fonts} {
+} [list [list 138 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-2.4 {LayoutDLine, word wrap} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This is some sample text for testing."
list [.t bbox 1.19] [.t bbox 1.20]
-} {{138 5 7 13} {5 18 7 13}}
-test textDisp-2.5 {LayoutDLine, word wrap} {fonts} {
+} [list [list 138 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-2.5 {LayoutDLine, word wrap} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This isx some sample text for testing."
list [.t bbox 1.13] [.t bbox 1.14] [.t bbox 1.19]
-} {{96 5 49 13} {5 18 7 13} {40 18 7 13}}
-test textDisp-2.6 {LayoutDLine, word wrap} {fonts} {
+} [list [list 96 5 49 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 40 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-2.6 {LayoutDLine, word wrap} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This isxxx some sample text for testing."
list [.t bbox 1.15] [.t bbox 1.16]
-} {{110 5 35 13} {5 18 7 13}}
-test textDisp-2.7 {LayoutDLine, marks and tags} {fonts} {
+} [list [list 110 5 35 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-2.7 {LayoutDLine, marks and tags} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This isxxx some sample text for testing."
.t tag add foo 1.4 1.6
.t mark set insert 1.8
list [.t bbox 1.2] [.t bbox 1.5] [.t bbox 1.11]
-} {{19 5 7 13} {40 5 7 13} {82 5 7 13}}
+} [list [list 19 5 7 $fixedHeight] [list 40 5 7 $fixedHeight] [list 82 5 7 $fixedHeight]]
foreach m [.t mark names] {
catch {.t mark unset $m}
}
scan [wm geom .] %dx%d width height
-test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {fonts} {
+test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {textfonts} {
wm geom . [expr $width+1]x$height
update
.t configure -wrap char
@@ -168,16 +280,16 @@ test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {fonts} {
.t insert 1.0 "This isxx some sample text for testing."
.t mark set foo 1.20
list [.t bbox 1.19] [.t bbox 1.20]
-} {{138 5 8 13} {5 18 7 13}}
+} [list [list 138 5 8 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
wm geom . {}
update
-test textDisp-2.9 {LayoutDLine, marks and tags} {fonts} {
+test textDisp-2.9 {LayoutDLine, marks and tags} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This is a very_very_long_word_that_wraps."
list [.t bbox 1.9] [.t bbox 1.10] [.t bbox 1.25]
-} {{68 5 77 13} {5 18 7 13} {110 18 7 13}}
-test textDisp-2.10 {LayoutDLine, marks and tags} {fonts} {
+} [list [list 68 5 77 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 110 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-2.10 {LayoutDLine, marks and tags} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This is a very_very_long_word_that_wraps."
@@ -186,14 +298,14 @@ test textDisp-2.10 {LayoutDLine, marks and tags} {fonts} {
.t tag add foo 1.17
.t tag add foo 1.19
list [.t bbox 1.9] [.t bbox 1.10] [.t bbox 1.25]
-} {{68 5 77 13} {5 18 7 13} {110 18 7 13}}
-test textDisp-2.11 {LayoutDLine, newline width} {fonts} {
+} [list [list 68 5 77 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 110 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-2.11 {LayoutDLine, newline width} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a\nbb\nccc\ndddd"
list [.t bbox 2.2] [.t bbox 3.3]
-} {{19 18 126 13} {26 31 119 13}}
-test textDisp-2.12 {LayoutDLine, justification} {fonts} {
+} [list [list 19 [expr {$fixedDiff + 18}] 126 $fixedHeight] [list 26 [expr {2*$fixedDiff + 31}] 119 $fixedHeight]]
+test textDisp-2.12 {LayoutDLine, justification} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "\na\nbb\nccc\ndddd"
@@ -201,8 +313,8 @@ test textDisp-2.12 {LayoutDLine, justification} {fonts} {
.t tag add x 1.0 end
.t tag add y 3.0 3.2
list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 4.0] [.t bbox 4.2]
-} {{75 5 70 13} {71 18 7 13} {64 44 7 13} {78 44 7 13}}
-test textDisp-2.13 {LayoutDLine, justification} {fonts} {
+} [list [list 75 5 70 $fixedHeight] [list 71 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 64 [expr {3*$fixedDiff + 44}] 7 $fixedHeight] [list 78 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+test textDisp-2.13 {LayoutDLine, justification} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "\na\nbb\nccc\ndddd"
@@ -210,8 +322,8 @@ test textDisp-2.13 {LayoutDLine, justification} {fonts} {
.t tag add x 1.0 end
.t tag add y 3.0 3.2
list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 4.0] [.t bbox 4.2]
-} {{145 5 0 13} {138 18 7 13} {124 44 7 13} {138 44 7 13}}
-test textDisp-2.14 {LayoutDLine, justification} {fonts} {
+} [list [list 145 5 0 $fixedHeight] [list 138 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 124 [expr {3*$fixedDiff + 44}] 7 $fixedHeight] [list 138 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+test textDisp-2.14 {LayoutDLine, justification} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "\na\nbb\nccc\ndddd"
@@ -221,8 +333,8 @@ test textDisp-2.14 {LayoutDLine, justification} {fonts} {
.t tag add y 3.0 4.0
.t tag raise y
list [.t bbox 2.0] [.t bbox 3.0] [.t bbox 3.end] [.t bbox 4.0]
-} {{71 18 7 13} {131 31 7 13} {145 31 0 13} {5 44 7 13}}
-test textDisp-2.15 {LayoutDLine, justification} {fonts} {
+} [list [list 71 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 131 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 145 [expr {2*$fixedDiff + 31}] 0 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+test textDisp-2.15 {LayoutDLine, justification} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "\na\nbb\nccc\ndddd"
@@ -232,8 +344,8 @@ test textDisp-2.15 {LayoutDLine, justification} {fonts} {
.t tag add y 3.0 4.0
.t tag lower y
list [.t bbox 2.0] [.t bbox 3.0] [.t bbox 3.end] [.t bbox 4.0]
-} {{71 18 7 13} {68 31 7 13} {82 31 63 13} {5 44 7 13}}
-test textDisp-2.16 {LayoutDLine, justification} {fonts} {
+} [list [list 71 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 68 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 82 [expr {2*$fixedDiff + 31}] 63 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+test textDisp-2.16 {LayoutDLine, justification} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
@@ -241,16 +353,16 @@ test textDisp-2.16 {LayoutDLine, justification} {fonts} {
.t tag add x 1.1 1.20
.t tag add x 1.21 1.end
list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
-} {{5 5 7 13} {5 18 7 13} {43 31 7 13} {5 44 7 13}}
-test textDisp-2.17 {LayoutDLine, justification} {fonts} {
+} [list [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 43 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+test textDisp-2.17 {LayoutDLine, justification} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
.t tag configure x -justify center
.t tag add x 1.20
list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
-} {{5 5 7 13} {19 18 7 13} {5 31 7 13} {5 44 7 13}}
-test textDisp-2.18 {LayoutDLine, justification} {fonts} {
+} [list [list 5 5 7 $fixedHeight] [list 19 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+test textDisp-2.18 {LayoutDLine, justification} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert 1.0 "Lots of long words, enough to extend out of the window\n"
@@ -261,18 +373,18 @@ test textDisp-2.18 {LayoutDLine, justification} {fonts} {
.t tag add y 3.0
.t xview scroll 5 units
list [.t bbox 2.0] [.t bbox 3.0]
-} {{26 18 7 13} {40 31 7 13}}
+} [list [list 26 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 40 [expr {2*$fixedDiff + 31}] 7 $fixedHeight]]
.t tag delete x
.t tag delete y
-test textDisp-2.19 {LayoutDLine, margins} {fonts} {
+test textDisp-2.19 {LayoutDLine, margins} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
.t tag configure x -lmargin1 20 -lmargin2 40 -rmargin 15
.t tag add x 1.0 end
list [.t bbox 1.0] [.t bbox 1.12] [.t bbox 1.13] [.t bbox 2.0]
-} {{25 5 7 13} {109 5 36 13} {45 18 7 13} {25 70 7 13}}
-test textDisp-2.20 {LayoutDLine, margins} {fonts} {
+} [list [list 25 5 7 $fixedHeight] [list 109 5 36 $fixedHeight] [list 45 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 25 [expr {5*$fixedDiff + 70}] 7 $fixedHeight]]
+test textDisp-2.20 {LayoutDLine, margins} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
@@ -282,18 +394,18 @@ test textDisp-2.20 {LayoutDLine, margins} {fonts} {
.t tag add x 1.0 end
.t tag add y 1.13
list [.t bbox 1.0] [.t bbox 1.13] [.t bbox 1.30] [.t bbox 2.0]
-} {{25 5 7 13} {10 18 7 13} {15 31 7 13} {25 44 7 13}}
-test textDisp-2.21 {LayoutDLine, margins} {fonts} {
+} [list [list 25 5 7 $fixedHeight] [list 10 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 15 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 25 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+test textDisp-2.21 {LayoutDLine, margins} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "Sample text"
.t tag configure x -lmargin1 80 -lmargin2 80 -rmargin 100
.t tag add x 1.0 end
list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 1.2]
-} {{85 5 60 13} {85 18 60 13} {85 31 60 13}}
+} [list [list 85 5 60 $fixedHeight] [list 85 [expr {$fixedDiff + 18}] 60 $fixedHeight] [list 85 [expr {2*$fixedDiff + 31}] 60 $fixedHeight]]
.t tag delete x
.t tag delete y
-test textDisp-2.22 {LayoutDLine, spacing options} {fonts} {
+test textDisp-2.22 {LayoutDLine, spacing options} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t tag delete x y
@@ -318,9 +430,9 @@ test textDisp-2.22 {LayoutDLine, spacing options} {fonts} {
set i [.t dlineinfo 3.0]
set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
list $b1 $b2 $b3 $b4
-} {2 7 10 15}
+} [list 2 7 10 15]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
-test textDisp-2.23 {LayoutDLine, spacing options} {fonts} {
+test textDisp-2.23 {LayoutDLine, spacing options} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t tag delete x y
@@ -350,9 +462,9 @@ test textDisp-2.23 {LayoutDLine, spacing options} {fonts} {
set i [.t dlineinfo 3.0]
set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
list $b1 $b2 $b3 $b4
-} {1 5 13 16}
+} [list 1 5 13 16]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
-test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {fonts} {
+test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} {
.t delete 1.0 end
.t tag delete x y
.t tag configure x -tabs 70
@@ -362,53 +474,53 @@ test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {fonts} {
.t tag add y 1.1 end
lindex [.t bbox 1.3] 0
} {75}
-test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} {fonts} {
+test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} {textfonts} {
.t delete 1.0 end
.t tag delete x
- .t tag configure x -tabs {30 60 90 120}
+ .t tag configure x -tabs [list 30 60 90 120]
.t insert 1.0 "a\tb\tc\td\te"
.t mark set dummy1 1.1
.t mark set dummy2 1.2
.t tag add x 1.0 end
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \
[lindex [.t bbox 1.6] 0] [lindex [.t bbox 1.8] 0]
-} {35 65 95 125}
-test textDisp-2.26 {LayoutDLine, tabs, breaking chunks at tabs} {fonts} {
+} [list 35 65 95 125]
+test textDisp-2.26 {LayoutDLine, tabs, breaking chunks at tabs} {textfonts} {
.t delete 1.0 end
.t tag delete x
- .t tag configure x -tabs {30 60 90 120} -justify right
+ .t tag configure x -tabs [list 30 60 90 120] -justify right
.t insert 1.0 "a\tb\tc\td\te"
.t mark set dummy1 1.1
.t mark set dummy2 1.2
.t tag add x 1.0 end
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \
[lindex [.t bbox 1.6] 0] [lindex [.t bbox 1.8] 0]
-} {117 124 131 138}
-test textDisp-2.27 {LayoutDLine, tabs, calling AdjustForTab} {fonts} {
+} [list 117 124 131 138]
+test textDisp-2.27 {LayoutDLine, tabs, calling AdjustForTab} {textfonts} {
.t delete 1.0 end
.t tag delete x
- .t tag configure x -tabs {30 60}
+ .t tag configure x -tabs [list 30 60]
.t insert 1.0 "a\tb\tcd"
.t tag add x 1.0 end
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0]
-} {35 65}
-test textDisp-2.28 {LayoutDLine, tabs, running out of space in dline} {fonts} {
+} [list 35 65]
+test textDisp-2.28 {LayoutDLine, tabs, running out of space in dline} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "a\tb\tc\td"
.t bbox 1.6
-} {5 18 7 13}
-test textDisp-2.29 {LayoutDLine, tabs, running out of space in dline} {fonts} {
+} [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]
+test textDisp-2.29 {LayoutDLine, tabs, running out of space in dline} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "a\tx\tabcd"
.t bbox 1.4
-} {117 5 7 13}
-test textDisp-2.30 {LayoutDLine, tabs, running out of space in dline} {fonts} {
+} [list 117 5 7 $fixedHeight]
+test textDisp-2.30 {LayoutDLine, tabs, running out of space in dline} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "a\tx\tabc"
.t bbox 1.4
-} {117 5 7 13}
+} [list 117 5 7 $fixedHeight]
-test textDisp-3.1 {different character sizes} {fonts} {
+test textDisp-3.1 {different character sizes} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert end "Some sample text, including both large\n"
@@ -417,10 +529,9 @@ test textDisp-3.1 {different character sizes} {fonts} {
.t tag add big 1.5 1.10
.t tag add big 2.11 2.14
list [.t bbox 1.1] [.t bbox 1.6] [.t dlineinfo 1.0] [.t dlineinfo 3.0]
-} {{12 17 7 13} {52 5 13 27} {5 5 114 27 22} {5 85 35 13 10}}
-
+} [list [list 12 [expr {5+$ascentDiff}] 7 $fixedHeight] [list 52 5 13 27] [list 5 5 114 27 [font metrics $bigFont -ascent]] [list 5 [expr {2* $fixedDiff + 85}] 35 $fixedHeight [expr {$fixedDiff + 10}]]]
.t configure -wrap char
-test textDisp-4.1 {UpdateDisplayInfo, basic} {fonts} {
+test textDisp-4.1 {UpdateDisplayInfo, basic} {textfonts} {
.t delete 1.0 end
.t insert end "Line 1\nLine 2\nLine 3\n"
update
@@ -428,8 +539,8 @@ test textDisp-4.1 {UpdateDisplayInfo, basic} {fonts} {
.t insert 2.0 "New Line 2"
update
list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 3.0] $tk_textRelayout
-} {{5 5 7 13} {5 18 7 13} {5 31 7 13} 2.0}
-test textDisp-4.2 {UpdateDisplayInfo, re-use tail of text line} {fonts} {
+} [list [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] 2.0]
+test textDisp-4.2 {UpdateDisplayInfo, re-use tail of text line} {textfonts} {
.t delete 1.0 end
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
update
@@ -438,8 +549,8 @@ test textDisp-4.2 {UpdateDisplayInfo, re-use tail of text line} {fonts} {
.t insert 2.0 X
update
list [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout
-} {{5 18 7 13} {12 31 7 13} {5 44 7 13} {2.0 2.20}}
-test textDisp-4.3 {UpdateDisplayInfo, tail of text line shifts} {fonts} {
+} [list [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 12 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight] {2.0 2.20}]
+test textDisp-4.3 {UpdateDisplayInfo, tail of text line shifts} {textfonts} {
.t delete 1.0 end
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
update
@@ -447,16 +558,19 @@ test textDisp-4.3 {UpdateDisplayInfo, tail of text line shifts} {fonts} {
.t delete 2.2
update
list [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout
-} {{5 18 7 13} {5 31 7 13} {5 44 7 13} {2.0 2.20}}
+} [list [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight] {2.0 2.20}]
.t mark unset x
-test textDisp-4.4 {UpdateDisplayInfo, wrap-mode "none"} {fonts} {
+test textDisp-4.4 {UpdateDisplayInfo, wrap-mode "none"} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
update
list [.t bbox 2.0] [.t bbox 2.25] [.t bbox 3.0] $tk_textRelayout
-} {{5 18 7 13} {} {5 31 7 13} {1.0 2.0 3.0}}
-test textDisp-4.5 {UpdateDisplayInfo, tiny window} {fonts} {
+} [list [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] {} [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] {1.0 2.0 3.0}]
+test textDisp-4.5 {UpdateDisplayInfo, tiny window} {textfonts} {
+ if {$tcl_platform(platform) == "windows"} {
+ wm overrideredirect . 1
+ }
wm geom . 103x$height
update
.t configure -wrap none
@@ -464,7 +578,10 @@ test textDisp-4.5 {UpdateDisplayInfo, tiny window} {fonts} {
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
update
list [.t bbox 2.0] [.t bbox 2.1] [.t bbox 3.0] $tk_textRelayout
-} {{5 18 1 13} {} {5 31 1 13} {1.0 2.0 3.0}}
+} [list [list 5 [expr {$fixedDiff + 18}] 1 $fixedHeight] {} [list 5 [expr {2*$fixedDiff + 31}] 1 $fixedHeight] {1.0 2.0 3.0}]
+if {$tcl_platform(platform) == "windows"} {
+ wm overrideredirect . 0
+}
test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
# This test was failing on Windows because the title bar on .
# was a certain minimum size and it was interfering with the size
@@ -488,7 +605,7 @@ test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
wm overrideredirect . 0
update
set x
-} {{5 5 1 1} {} 1.0}
+} [list [list 5 5 1 1] {} 1.0]
catch {destroy .f2}
.t configure -borderwidth 0 -wrap char
wm geom . {}
@@ -524,14 +641,14 @@ test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} {
update
set x [list [.t index @0,0] $tk_textRelayout $tk_textRedraw]
} {1.0 {5.0 4.0 3.0 2.0 1.0} {1.0 2.0 3.0 4.0 5.0 eof}}
-test textDisp-4.9 {UpdateDisplayInfo, filling in extra vertical space} {fonts} {
+test textDisp-4.9 {UpdateDisplayInfo, filling in extra vertical space} {textfonts} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
.t yview 16.0
update
.t delete 15.0 end
list [.t bbox 7.0] [.t bbox 12.0]
-} {{3 29 7 13} {3 94 7 13}}
+} [list [list 3 [expr {2*$fixedDiff + 29}] 7 $fixedHeight] [list 3 [expr {7*$fixedDiff + 94}] 7 $fixedHeight]]
test textDisp-4.10 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
@@ -552,7 +669,7 @@ test textDisp-4.11 {UpdateDisplayInfo, filling in extra vertical space} {
} {6.40 {13.0 7.0 6.80 6.60 6.40} {6.40 6.60 6.80 7.0 13.0}}
test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
- .t insert end "1\n2\n3\n4\n5\n7\n8\n9\n10\n11\n12\n13"
+ .t insert end "1\n2\n3\n4\n5\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16"
button .b -text "Test" -bd 2 -highlightthickness 2
.t window create 3.end -window .b
.t yview moveto 1
@@ -602,7 +719,7 @@ test textDisp-4.16 {UpdateDisplayInfo, special handling for top/bottom lines} {
update
list $tk_textRelayout $tk_textRedraw
} {{2.0 3.0} {2.0 3.0}}
-test textDisp-4.17 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
+test textDisp-4.17 {UpdateDisplayInfo, horizontal scrolling} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
@@ -612,8 +729,8 @@ test textDisp-4.17 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
update
list $tk_textRelayout $tk_textRedraw [.t bbox 2.0] [.t bbox 2.5] \
[.t bbox 2.23]
-} {{} {1.0 2.0 3.0 4.0} {} {17 16 7 13} {}}
-test textDisp-4.18 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
+} [list {} {1.0 2.0 3.0 4.0} {} [list 17 [expr {$fixedDiff + 16}] 7 $fixedHeight] {}]
+test textDisp-4.18 {UpdateDisplayInfo, horizontal scrolling} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
@@ -622,8 +739,8 @@ test textDisp-4.18 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
.t xview scroll 100 units
update
list $tk_textRelayout $tk_textRedraw [.t bbox 2.25]
-} {{} {1.0 2.0 3.0 4.0} {10 16 7 13}}
-test textDisp-4.19 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
+} [list {} {1.0 2.0 3.0 4.0} [list 10 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-4.19 {UpdateDisplayInfo, horizontal scrolling} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
@@ -633,8 +750,8 @@ test textDisp-4.19 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
.t xview scroll -10 units
update
list $tk_textRelayout $tk_textRedraw [.t bbox 2.5]
-} {{} {1.0 2.0 3.0 4.0} {38 16 7 13}}
-test textDisp-4.20 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
+} [list {} {1.0 2.0 3.0 4.0} [list 38 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-4.20 {UpdateDisplayInfo, horizontal scrolling} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
@@ -645,8 +762,8 @@ test textDisp-4.20 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
.t delete 2.30 2.44
update
list $tk_textRelayout $tk_textRedraw [.t bbox 2.25]
-} {2.0 {1.0 2.0 3.0 4.0} {108 16 7 13}}
-test textDisp-4.21 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
+} [list 2.0 {1.0 2.0 3.0 4.0} [list 108 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-4.21 {UpdateDisplayInfo, horizontal scrolling} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
@@ -657,7 +774,7 @@ test textDisp-4.21 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
update
list $tk_textRelayout $tk_textRedraw
} {{} {}}
-test textDisp-4.22 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} {fonts} {
+test textDisp-4.22 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
@@ -666,8 +783,8 @@ test textDisp-4.22 {UpdateDisplayInfo, no horizontal scrolling except for -wrap
update
.t configure -wrap word
list [.t bbox 2.0] [.t bbox 2.16]
-} {{3 16 7 13} {10 29 7 13}}
-test textDisp-4.23 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} {fonts} {
+} [list [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 10 [expr {2*$fixedDiff + 29}] 7 $fixedHeight]]
+test textDisp-4.23 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
@@ -676,9 +793,8 @@ test textDisp-4.23 {UpdateDisplayInfo, no horizontal scrolling except for -wrap
update
.t configure -wrap char
list [.t bbox 2.0] [.t bbox 2.16]
-} {{3 16 7 13} {115 16 7 13}}
-
-test textDisp-5.1 {DisplayDLine, handling of spacing} {fonts} {
+} [list [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 115 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-5.1 {DisplayDLine, handling of spacing} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijkl\nmnopqrstuvwzyz"
@@ -695,7 +811,7 @@ test textDisp-5.1 {DisplayDLine, handling of spacing} {fonts} {
update
list [winfo geometry .t.f1] [winfo geometry .t.f2] \
[winfo geometry .t.f3] [winfo geometry .t.f4]
-} {10x4+24+11 10x4+55+15 10x4+10+43 10x4+76+40}
+} [list 10x4+24+11 10x4+55+[expr {$fixedDiff/2 + 15}] 10x4+10+[expr {2*$fixedDiff + 43}] 10x4+76+[expr {2*$fixedDiff + 40}]]
.t tag delete spacing
# Although the following test produces a useful result, its main
@@ -709,7 +825,7 @@ test textDisp-5.2 {DisplayDLine, line resizes during display} {
.t window create insert -window .t.f
update
list [winfo width .t.f] [winfo height .t.f]
-} {30 30}
+} [list 30 30]
.t configure -wrap char
test textDisp-6.1 {scrolling in DisplayText, scroll up} {
@@ -775,7 +891,7 @@ test textDisp-6.5 {scrolling in DisplayText, scroll source obscured} {nonPortabl
destroy .f2
list $tk_textRelayout $tk_textRedraw
} {{1.0 9.0 10.0} {1.0 4.0 5.0 9.0 10.0}}
-test textDisp-6.6 {scrolling in DisplayText, Expose events after scroll} {unixOnly nonPortable} {
+test textDisp-6.6 {scrolling in DisplayText, Expose events after scroll} {unix nonPortable} {
# this test depends on all of the expose events being handled at once
.t configure -wrap char
frame .f2 -bg #ff0000
@@ -796,9 +912,9 @@ test textDisp-6.6 {scrolling in DisplayText, Expose events after scroll} {unixOn
test textDisp-6.7 {DisplayText, vertical scrollbar updates} {
.t configure -wrap char
.t delete 1.0 end
- update
+ update ; .t count -update -ypixels 1.0 end ; update
set scrollInfo
-} {0 1}
+} {0.0 1.0}
test textDisp-6.8 {DisplayText, vertical scrollbar updates} {
.t configure -wrap char
.t delete 1.0 end
@@ -808,9 +924,9 @@ test textDisp-6.8 {DisplayText, vertical scrollbar updates} {
foreach i {2 3 4 5 6 7 8 9 10 11 12 13} {
.t insert end "\nLine $i"
}
- update
+ update ; .t count -update -ypixels 1.0 end ; update
set scrollInfo
-} {0 0.769231}
+} [list 0.0 [expr {10.0/13}]]
.t configure -yscrollcommand {} -xscrollcommand scroll
test textDisp-6.9 {DisplayText, horizontal scrollbar updates} {
.t configure -wrap none
@@ -822,7 +938,7 @@ test textDisp-6.9 {DisplayText, horizontal scrollbar updates} {
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx
update
set scrollInfo
-} {0 0.363636}
+} [list 0.0 [expr {4.0/11}]]
# The following group of tests is marked non-portable because
# they result in a lot of extra redisplay under Ultrix. I don't
@@ -907,7 +1023,7 @@ test textDisp-7.8 {TkTextRedrawRegion} {nonPortable} {
} {{} {borders 4.0 5.0 6.0 7.0 eof}}
.t configure -bd 0
-test textDisp-8.1 {TkTextChanged: redisplay whole lines} {fonts} {
+test textDisp-8.1 {TkTextChanged: redisplay whole lines} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is so long that it wraps around, two times"
@@ -918,7 +1034,7 @@ test textDisp-8.1 {TkTextChanged: redisplay whole lines} {fonts} {
.t delete 2.36 2.38
update
list $tk_textRelayout $tk_textRedraw [.t bbox 2.32]
-} {{2.0 2.18 2.38} {2.0 2.18 2.38} {101 29 7 13}}
+} [list {2.0 2.18 2.38} {2.0 2.18 2.38} [list 101 [expr {2*$fixedDiff + 29}] 7 $fixedHeight]]
.t configure -wrap char
test textDisp-8.2 {TkTextChanged, redisplay whole lines} {
.t delete 1.0 end
@@ -1025,10 +1141,12 @@ test textDisp-8.11 {TkTextChanged, scrollbar notification when changes are off-s
update
set scrollInfo ""
.t insert end "a\nb\nc\n"
- update
+ # We need to wait for our asychronous callbacks to update the
+ # scrollbar
+ update ; .t count -update -ypixels 1.0 end ; update
.t configure -yscrollcommand ""
set scrollInfo
-} {0 0.625}
+} {0.0 0.625}
test textDisp-9.1 {TkTextRedrawTag} {
.t configure -wrap char
@@ -1039,7 +1157,7 @@ test textDisp-9.1 {TkTextRedrawTag} {
update
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.18} {2.0 2.18}}
-test textDisp-9.2 {TkTextRedrawTag} {fonts} {
+test textDisp-9.2 {TkTextRedrawTag} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
@@ -1098,7 +1216,7 @@ test textDisp-9.7 {TkTextRedrawTag} {
update
set tk_textRedraw
} {2.0 2.20 eof}
-test textDisp-9.8 {TkTextRedrawTag} {fonts} {
+test textDisp-9.8 {TkTextRedrawTag} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
@@ -1108,7 +1226,7 @@ test textDisp-9.8 {TkTextRedrawTag} {fonts} {
update
set tk_textRedraw
} {2.0 2.17}
-test textDisp-9.9 {TkTextRedrawTag} {fonts} {
+test textDisp-9.9 {TkTextRedrawTag} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
@@ -1150,6 +1268,7 @@ test textDisp-10.1 {TkTextRelayoutWindow} {
list $tk_textRelayout $tk_textRedraw
} {{1.0 2.0 2.20 3.0 3.20 4.0} {borders 1.0 2.0 2.20 3.0 3.20 4.0 eof}}
.t configure -bg [lindex [.t configure -bg] 3]
+catch {destroy .top}
test textDisp-10.2 {TkTextRelayoutWindow} {
toplevel .top -width 300 -height 200
wm geometry .top +0+0
@@ -1214,12 +1333,12 @@ test textDisp-11.6 {TkTextSetYView} {
} {28.0 {28.0 29.0}}
test textDisp-11.7 {TkTextSetYView} {
.t yview 30.0
- update
+ update ; update
set tk_textRedraw {}
.t yview -pickplace 26.0
update
list [.t index @0,0] $tk_textRedraw
-} {22.0 {22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0}}
+} {21.0 {21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0}}
test textDisp-11.8 {TkTextSetYView} {
.t yview 30.0
update
@@ -1235,7 +1354,7 @@ test textDisp-11.9 {TkTextSetYView} {
.t yview -pickplace 43.0
update
list [.t index @0,0] $tk_textRedraw
-} {39.0 {40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0}}
+} {38.0 {40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0}}
test textDisp-11.10 {TkTextSetYView} {
.t yview 30.0
update
@@ -1262,7 +1381,7 @@ test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} {
list [.t index @0,0] $tk_textRedraw
} {2.0 10.20}
.t delete 10.0 11.0
-test textDisp-11.13 {TkTestSetYView, partially-visible last line} {
+test textDisp-11.13 {TkTestSetYView, partially visible last line} {
catch {destroy .top}
toplevel .top
wm geometry .top +0+0
@@ -1281,8 +1400,10 @@ test textDisp-11.13 {TkTestSetYView, partially-visible last line} {
set tk_textRedraw {}
.top.t see 5.0
update
+ # Note, with smooth scrolling, the results of this test
+ # have changed, and the old '2.0 {5.0 6.0}' is quite wrong.
list [.top.t index @0,0] $tk_textRedraw
-} {2.0 {5.0 6.0}}
+} {1.0 5.0}
catch {destroy .top}
toplevel .top
wm geometry .top +0+0
@@ -1304,7 +1425,8 @@ test textDisp-11.15 {TkTextSetYView, only a few lines visible} {
update
.top.t see 11.0
.top.t index @0,0
-} {10.0}
+ # Thie index 9.0 should be just visible by a couple of pixels
+} {9.0}
test textDisp-11.16 {TkTextSetYView, only a few lines visible} {
.top.t yview 8.0
update
@@ -1316,7 +1438,8 @@ test textDisp-11.17 {TkTextSetYView, only a few lines visible} {
update
.top.t see 4.0
.top.t index @0,0
-} {3.0}
+ # Thie index 2.0 should be just visible by a couple of pixels
+} {2.0}
destroy .top
.t configure -wrap word
@@ -1328,21 +1451,21 @@ test textDisp-12.1 {MeasureUp} {
.t yview -pickplace 52.0
update
.t index @0,0
-} {50.0}
+} {49.0}
test textDisp-12.2 {MeasureUp} {
.t yview 100.0
update
.t yview -pickplace 53.0
update
.t index @0,0
-} {50.15}
+} {50.0}
test textDisp-12.3 {MeasureUp} {
.t yview 100.0
update
.t yview -pickplace 50.10
update
.t index @0,0
-} {46.0}
+} {45.0}
.t configure -wrap none
test textDisp-12.4 {MeasureUp} {
.t yview 100.0
@@ -1350,14 +1473,14 @@ test textDisp-12.4 {MeasureUp} {
.t yview -pickplace 53.0
update
.t index @0,0
-} {49.0}
+} {48.0}
test textDisp-12.5 {MeasureUp} {
.t yview 100.0
update
.t yview -pickplace 50.10
update
.t index @0,0
-} {46.0}
+} {45.0}
.t configure -wrap none
.t delete 1.0 end
@@ -1399,14 +1522,16 @@ test textDisp-13.6 {TkTextSeeCmd procedure} {
set x [.t index @0,0]
.t configure -wrap none
set x
-} {28.0}
-test textDisp-13.7 {TkTextSeeCmd procedure} {fonts} {
+} {27.0}
+test textDisp-13.7 {TkTextSeeCmd procedure} {textfonts} {
.t xview moveto 0
.t yview moveto 0
.t tag add sel 30.20
.t tag add sel 30.40
update
.t see 30.50
+ .t yview 25.0
+ .t see 30.50
set x [list [.t bbox 30.50]]
.t see 30.39
lappend x [.t bbox 30.39]
@@ -1414,8 +1539,8 @@ test textDisp-13.7 {TkTextSeeCmd procedure} {fonts} {
lappend x [.t bbox 30.38]
.t see 30.20
lappend x [.t bbox 30.20]
-} {{73 55 7 13} {3 55 7 13} {3 55 7 13} {73 55 7 13}}
-test textDisp-13.8 {TkTextSeeCmd procedure} {fonts} {
+} [list [list 73 [expr {5*$fixedDiff + 68}] 7 $fixedHeight] [list 3 [expr {5*$fixedDiff + 68}] 7 $fixedHeight] [list 3 [expr {5*$fixedDiff + 68}] 7 $fixedHeight] [list 73 [expr {5*$fixedDiff + 68}] 7 $fixedHeight]]
+test textDisp-13.8 {TkTextSeeCmd procedure} {textfonts} {
.t xview moveto 0
.t yview moveto 0
.t tag add sel 30.20
@@ -1429,8 +1554,8 @@ test textDisp-13.8 {TkTextSeeCmd procedure} {fonts} {
lappend x [.t bbox 30.65]
.t see 30.90
lappend x [.t bbox 30.90]
-} {{73 55 7 13} {136 55 7 13} {136 55 7 13} {73 55 7 13}}
-test textDisp-13.9 {TkTextSeeCmd procedure} {fonts} {
+} [list [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight]]
+test textDisp-13.9 {TkTextSeeCmd procedure} {textfonts} {
wm geom . [expr $width-2]x$height
.t xview moveto 0
.t yview moveto 0
@@ -1445,7 +1570,7 @@ test textDisp-13.9 {TkTextSeeCmd procedure} {fonts} {
lappend x [.t bbox 30.65]
.t see 30.90
lappend x [.t bbox 30.90]
-} {{80 55 7 13} {136 55 7 13} {136 55 7 13} {80 55 7 13}}
+} [list [list 74 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 138 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 138 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 74 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight]]
test textDisp-13.10 {TkTextSeeCmd procedure} {} {
# SF Bug 641778
set w .tsee
@@ -1468,7 +1593,7 @@ test textDisp-14.1 {TkTextXviewCmd procedure} {
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
.t xview moveto .5
.t xview
-} {0.5 0.857143}
+} [list 0.5 [expr {6./7.}]]
.t configure -wrap char
test textDisp-14.2 {TkTextXviewCmd procedure} {
.t delete 1.0 end
@@ -1477,7 +1602,7 @@ test textDisp-14.2 {TkTextXviewCmd procedure} {
.t insert end "xxxxx\n"
.t insert end "xxxx"
.t xview
-} {0 1}
+} {0.0 1.0}
.t configure -wrap none
test textDisp-14.3 {TkTextXviewCmd procedure} {
.t delete 1.0 end
@@ -1486,7 +1611,7 @@ test textDisp-14.3 {TkTextXviewCmd procedure} {
.t insert end "xxxxx\n"
.t insert end "xxxx"
.t xview
-} {0 1}
+} {0.0 1.0}
test textDisp-14.4 {TkTextXviewCmd procedure} {
list [catch {.t xview moveto} msg] $msg
} {1 {wrong # args: should be ".t xview moveto fraction"}}
@@ -1503,7 +1628,7 @@ test textDisp-14.7 {TkTextXviewCmd procedure} {
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
.t xview moveto .3
.t xview
-} {0.303571 0.660714}
+} [list [expr {118.0/392}] [expr {258.0/392}]]
test textDisp-14.8 {TkTextXviewCmd procedure} {
.t delete 1.0 end
.t insert end xxxxxxxxx\n
@@ -1511,7 +1636,7 @@ test textDisp-14.8 {TkTextXviewCmd procedure} {
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
.t xview moveto -.4
.t xview
-} {0 0.357143}
+} [list 0.0 [expr {5.0/14}]]
test textDisp-14.9 {TkTextXviewCmd procedure} {
.t delete 1.0 end
.t insert end xxxxxxxxx\n
@@ -1519,13 +1644,13 @@ test textDisp-14.9 {TkTextXviewCmd procedure} {
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
.t xview m 1.4
.t xview
-} {0.642857 1}
+} [list [expr {9.0/14}] 1.0]
test textDisp-14.10 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll a} msg] $msg
-} {1 {wrong # args: should be ".t xview scroll number units|pages"}}
+} {1 {wrong # args: should be ".t xview scroll number units|pages|pixels"}}
test textDisp-14.11 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll a b c} msg] $msg
-} {1 {wrong # args: should be ".t xview scroll number units|pages"}}
+} {1 {wrong # args: should be ".t xview scroll number units|pages|pixels"}}
test textDisp-14.12 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll gorp units} msg] $msg
} {1 {expected integer but got "gorp"}}
@@ -1535,9 +1660,9 @@ test textDisp-14.13 {TkTextXviewCmd procedure} {
.t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n"
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
.t xview moveto 0
- .t xview scroll 2 p
+ .t xview scroll 2 pa
set x [.t index @0,22]
- .t xview scroll -1 p
+ .t xview scroll -1 pa
lappend x [.t index @0,22]
.t xview scroll -2 pages
lappend x [.t index @0,22]
@@ -1559,10 +1684,10 @@ test textDisp-14.14 {TkTextXviewCmd procedure} {
} {2.21 2.20 2.99 2.84}
test textDisp-14.15 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll 14 globs} msg] $msg
-} {1 {bad argument "globs": must be units or pages}}
+} {1 {bad argument "globs": must be units, pages, or pixels}}
test textDisp-14.16 {TkTextXviewCmd procedure} {
list [catch {.t xview flounder} msg] $msg
-} {1 {unknown option "flounder": must be moveto or scroll}}
+} {1 {bad option "flounder": must be moveto or scroll}}
.t configure -wrap char
.t delete 1.0 end
@@ -1615,6 +1740,36 @@ test textDisp-15.7 {ScrollByLines procedure, scrolling forwards} {
.t index @0,0
} {50.40}
+test textDisp-15.8 {Scrolling near end of window} {
+ set textheight 12
+ set textwidth 30
+
+ toplevel .tf
+ frame .tf.f -relief sunken -borderwidth 2
+ pack .tf.f -padx 10 -pady 10
+
+ text .tf.f.t -font {Courier 9} -height $textheight \
+ -width $textwidth -yscrollcommand ".tf.f.sb set"
+ scrollbar .tf.f.sb -command ".tf.f.t yview"
+ pack .tf.f.t -side left -expand 1 -fill both
+ pack .tf.f.sb -side right -fill y
+
+ .tf.f.t tag configure Header -font {Helvetica 14 bold italic} \
+ -wrap word -spacing1 12 -spacing3 4
+
+ .tf.f.t insert end "Foo" Header
+ for {set i 1} {$i < $textheight} {incr i} {
+ .tf.f.t insert end "\nLine $i"
+ }
+ update ; after 1000 ; update
+ # Should scroll and should not crash!
+ .tf.f.t yview scroll 1 unit
+ # Check that it has scrolled
+ set res [.tf.f.t index @0,[expr [winfo height .tf.f.t] - 15]]
+ destroy .tf
+ set res
+} {12.0}
+
.t configure -wrap char
.t delete 1.0 end
.t insert insert "Line 1"
@@ -1624,16 +1779,16 @@ for {set i 2} {$i <= 200} {incr i} {
.t tag add big 100.0 105.0
.t insert 151.end { has a lot of extra text, so that it wraps around on the screen several times over.}
.t insert 153.end { also has enoug extra text to wrap.}
-update
+update ; .t count -update -ypixels 1.0 end
test textDisp-16.1 {TkTextYviewCmd procedure} {
.t yview 21.0
set x [.t yview]
.t yview 1.0
- set x
-} {0.1 0.15}
+ list [expr {int([lindex $x 0]*100)}] [expr {int ([lindex $x 1] * 100)}]
+} {9 14}
test textDisp-16.2 {TkTextYviewCmd procedure} {
list [catch {.t yview 2 3} msg] $msg
-} {1 {unknown option "2": must be moveto or scroll}}
+} {1 {bad option "2": must be moveto or scroll}}
test textDisp-16.3 {TkTextYviewCmd procedure} {
list [catch {.t yview -pickplace} msg] $msg
} {1 {wrong # args: should be ".t yview -pickplace lineNum|index"}}
@@ -1642,7 +1797,7 @@ test textDisp-16.4 {TkTextYviewCmd procedure} {
} {1 {wrong # args: should be ".t yview -pickplace lineNum|index"}}
test textDisp-16.5 {TkTextYviewCmd procedure} {
list [catch {.t yview -bogus 2} msg] $msg
-} {1 {unknown option "-bogus": must be moveto or scroll}}
+} {1 {bad option "-bogus": must be moveto or scroll}}
test textDisp-16.6 {TkTextYviewCmd procedure, integer position} {
.t yview 100.0
update
@@ -1666,7 +1821,7 @@ test textDisp-16.10 {TkTextYviewCmd procedure, "moveto" option} {
test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} {
.t yview moveto 0.5
.t index @0,0
-} {101.0}
+} {103.0}
test textDisp-16.12 {TkTextYviewCmd procedure, "moveto" option} {
.t yview moveto -1
.t index @0,0
@@ -1678,20 +1833,22 @@ test textDisp-16.13 {TkTextYviewCmd procedure, "moveto" option} {
test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} {
.t yview moveto .75
.t index @0,0
-} {151.0}
+} {151.60}
test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} {
.t yview moveto .752
.t index @0,0
-} {151.20}
-test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} {
- .t yview moveto .754
+} {151.60}
+test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} {textfonts} {
+ set count [expr {5 * $bigHeight + 150 * $fixedHeight}]
+ set extra [expr {0.04 * double($fixedDiff * 150) / double($count)}]
+ .t yview moveto [expr {.753 - $extra}]
.t index @0,0
} {151.60}
test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} {
.t yview moveto .755
.t index @0,0
-} {152.0}
-test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} {fonts} {
+} {151.80}
+test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} {textfonts} {
catch {destroy .top1}
toplevel .top1
wm geometry .top1 +0+0
@@ -1704,15 +1861,18 @@ test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} {fonts} {
set result [.top1.t yview]
destroy .top1
set result
-} {0.333333 0.833333}
+} [list [expr {1.0/3}] [expr {5.0/6}]]
test textDisp-16.19 {TkTextYviewCmd procedure, "scroll" option} {
list [catch {.t yview scroll a} msg] $msg
-} {1 {wrong # args: should be ".t yview scroll number units|pages"}}
+} {1 {wrong # args: should be ".t yview scroll number units|pages|pixels"}}
test textDisp-16.20 {TkTextYviewCmd procedure, "scroll" option} {
list [catch {.t yview scroll a b c} msg] $msg
-} {1 {wrong # args: should be ".t yview scroll number units|pages"}}
+} {1 {wrong # args: should be ".t yview scroll number units|pages|pixels"}}
test textDisp-16.21 {TkTextYviewCmd procedure, "scroll" option} {
list [catch {.t yview scroll badInt bogus} msg] $msg
+} {1 {bad argument "bogus": must be units, pages, or pixels}}
+test textDisp-16.21.2 {TkTextYviewCmd procedure, "scroll" option} {
+ list [catch {.t yview scroll badInt units} msg] $msg
} {1 {expected integer but got "badInt"}}
test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} {
.t yview 50.0
@@ -1720,16 +1880,19 @@ test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} {
.t yview scroll -1 pages
.t index @0,0
} {42.0}
+test textDisp-16.22.1 {TkTextYviewCmd procedure, "scroll" option, back pages} {
+ list [catch {.t yview scroll -3 p} res] $res
+} {1 {ambiguous argument "p": must be units, pages, or pixels}}
test textDisp-16.23 {TkTextYviewCmd procedure, "scroll" option, back pages} {
.t yview 50.0
update
- .t yview scroll -3 p
+ .t yview scroll -3 pa
.t index @0,0
} {26.0}
test textDisp-16.24 {TkTextYviewCmd procedure, "scroll" option, back pages} {
.t yview 5.0
update
- .t yview scroll -3 p
+ .t yview scroll -3 pa
.t index @0,0
} {1.0}
test textDisp-16.25 {TkTextYviewCmd procedure, "scroll" option, back pages} {
@@ -1755,12 +1918,16 @@ test textDisp-16.27 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
.t yview scroll 2 pages
.t index @0,0
} {66.0}
-test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {fonts} {
+test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {textfonts} {
.t yview 98.0
update
.t yview scroll 1 page
- .t index @0,0
-} {103.0}
+ set res [expr int([.t index @0,0])]
+ if {$fixedDiff > 1} {
+ incr res -1
+ }
+ set res
+} {102}
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
.t configure -height 1
update
@@ -1786,10 +1953,71 @@ test textDisp-16.31 {TkTextYviewCmd procedure, "scroll units" option} {
} {151.40}
test textDisp-16.32 {TkTextYviewCmd procedure} {
list [catch {.t yview scroll 12 bogoids} msg] $msg
-} {1 {bad argument "bogoids": must be units or pages}}
+} {1 {bad argument "bogoids": must be units, pages, or pixels}}
test textDisp-16.33 {TkTextYviewCmd procedure} {
list [catch {.t yview bad_arg 1 2} msg] $msg
-} {1 {unknown option "bad_arg": must be moveto or scroll}}
+} {1 {bad option "bad_arg": must be moveto or scroll}}
+test textDisp-16.34 {TkTextYviewCmd procedure} {
+ set res {}
+ .t yview 1.0
+ lappend res [format %.12g [expr {[lindex [.t yview] 0]
+ * [.t count -ypixels 1.0 end]}]]
+ .t yview scroll 1 pixels
+ lappend res [format %.12g [expr {[lindex [.t yview] 0]
+ * [.t count -ypixels 1.0 end]}]]
+ .t yview scroll 1 pixels
+ lappend res [format %.12g [expr {[lindex [.t yview] 0]
+ * [.t count -ypixels 1.0 end]}]]
+ .t yview scroll 1 pixels
+ lappend res [format %.12g [expr {[lindex [.t yview] 0]
+ * [.t count -ypixels 1.0 end]}]]
+ .t yview scroll 1 pixels
+ lappend res [format %.12g [expr {[lindex [.t yview] 0]
+ * [.t count -ypixels 1.0 end]}]]
+ .t yview scroll 1 pixels
+ lappend res [format %.12g [expr {[lindex [.t yview] 0]
+ * [.t count -ypixels 1.0 end]}]]
+} {0 1 2 3 4 5}
+test textDisp-16.35 {TkTextYviewCmd procedure} {
+ set res {}
+ .t yview 1.0
+ lappend res [expr {round([lindex [.t yview] 0] * [.t count -ypixels 1.0 end])}]
+ .t yview scroll 13 pixels
+ lappend res [expr {round([lindex [.t yview] 0] * [.t count -ypixels 1.0 end])}]
+ .t yview scroll -4 pixels
+ lappend res [expr {round([lindex [.t yview] 0] * [.t count -ypixels 1.0 end])}]
+ .t yview scroll -9 pixels
+ lappend res [expr {round([lindex [.t yview] 0] * [.t count -ypixels 1.0 end])}]
+} {0 13 9 0}
+test textDisp-16.36 {TkTextYviewCmd procedure} {
+ set res {}
+ .t yview 1.0
+ .t yview scroll 5 pixels
+ .t yview scroll -1 pages
+ lappend res [expr {[lindex [.t yview] 0] * [.t count -ypixels 1.0 end]}]
+ .t yview scroll 5 pixels
+ .t yview scroll -1 units
+ lappend res [expr {[lindex [.t yview] 0] * [.t count -ypixels 1.0 end]}]
+} {0.0 0.0}
+test textDisp-16.37 {TkTextYviewCmd procedure} {
+ list [catch {.t yview scroll 1.3 pixels} msg] $msg
+} {0 {}}
+test textDisp-16.38 {TkTextYviewCmd procedure} {
+ list [catch {.t yview scroll 1.3blah pixels} msg] $msg
+} {1 {bad screen distance "1.3blah"}}
+test textDisp-16.39 {TkTextYviewCmd procedure} {
+ list [catch {.t yview scroll 1.3i pixels} msg] $msg
+} {0 {}}
+test textDisp-16.40 {text count -xpixels} {
+ set res {}
+ lappend res [.t count -xpixels 1.0 1.5] \
+ [.t count -xpixels 1.5 1.0] \
+ [.t count -xpixels 1.0 13.0] \
+ [.t count -xpixels 1.0 "1.0 displaylineend"] \
+ [.t count -xpixels 1.0 "1.0 lineend"] \
+ [.t count -xpixels 1.0 "1.0 displaylineend"] \
+ [.t count -xpixels 1.0 end]
+} {35 -35 0 42 42 42 0}
.t delete 1.0 end
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -1812,14 +2040,14 @@ test textDisp-17.4 {TkTextScanCmd procedure} {
test textDisp-17.5 {TkTextScanCmd procedure} {
list [catch {.t scan stupid 123 456} msg] $msg
} {1 {bad scan option "stupid": must be mark or dragto}}
-test textDisp-17.6 {TkTextScanCmd procedure} {fonts} {
+test textDisp-17.6 {TkTextScanCmd procedure} {textfonts} {
.t yview 1.0
.t xview moveto 0
.t scan mark 40 60
.t scan dragto 35 55
.t index @0,0
} {4.7}
-test textDisp-17.7 {TkTextScanCmd procedure} {fonts} {
+test textDisp-17.7 {TkTextScanCmd procedure} {textfonts} {
.t yview 10.0
.t xview moveto 0
.t xview scroll 20 units
@@ -1827,10 +2055,10 @@ test textDisp-17.7 {TkTextScanCmd procedure} {fonts} {
.t scan dragto -5 65
.t index @0,0
set x [.t index @0,0]
- .t scan dragto 0 70
+ .t scan dragto 0 [expr {70 + $fixedDiff}]
list $x [.t index @0,0]
-} {7.13 3.6}
-test textDisp-17.8 {TkTextScanCmd procedure} {fonts} {
+} {6.12 2.5}
+test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} {
.t yview 1.0
.t xview moveto 0
.t scan mark 0 60
@@ -1838,25 +2066,24 @@ test textDisp-17.8 {TkTextScanCmd procedure} {fonts} {
.t scan dragto 25 95
.t index @0,0
} {4.7}
-test textDisp-17.9 {TkTextScanCmd procedure} {fonts} {
+test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} {
.t yview end
.t xview moveto 0
.t xview scroll 100 units
.t scan mark 90 60
.t scan dragto 10 0
- .t scan dragto 15 5
+ .t scan dragto 14 5
.t index @0,0
} {18.44}
.t configure -wrap word
-test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} {fonts} {
+test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} {textfonts} {
.t yview 10.0
.t scan mark -10 60
.t scan dragto -5 65
set x [.t index @0,0]
- .t scan dragto 0 70
+ .t scan dragto 0 [expr {70 + $fixedDiff}]
list $x [.t index @0,0]
-} {9.31 8.47}
-
+} {9.15 8.31}
.t configure -xscrollcommand scroll -yscrollcommand {}
test textDisp-18.1 {GetXView procedure} {
.t configure -wrap none
@@ -1866,7 +2093,7 @@ test textDisp-18.1 {GetXView procedure} {
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx
update
set scrollInfo
-} {0 0.363636}
+} [list 0.0 [expr {4.0/11}]]
test textDisp-18.2 {GetXView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -1875,13 +2102,13 @@ test textDisp-18.2 {GetXView procedure} {
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx
update
set scrollInfo
-} {0 1}
+} {0.0 1.0}
test textDisp-18.3 {GetXView procedure} {
.t configure -wrap none
.t delete 1.0 end
update
set scrollInfo
-} {0 1}
+} {0.0 1.0}
test textDisp-18.4 {GetXView procedure} {
.t configure -wrap none
.t delete 1.0 end
@@ -1890,7 +2117,7 @@ test textDisp-18.4 {GetXView procedure} {
.t insert end xxxxxxxxxxxxxxxxx
update
set scrollInfo
-} {0 1}
+} {0.0 1.0}
test textDisp-18.5 {GetXView procedure} {
.t configure -wrap none
.t delete 1.0 end
@@ -1900,7 +2127,7 @@ test textDisp-18.5 {GetXView procedure} {
.t xview scroll 31 units
update
set scrollInfo
-} {0.563636 0.927273}
+} [list [expr {31.0/55}] [expr {51.0/55}]]
test textDisp-18.6 {GetXView procedure} {
.t configure -wrap none
.t delete 1.0 end
@@ -1921,7 +2148,7 @@ test textDisp-18.6 {GetXView procedure} {
.t configure -wrap none
update
lappend x $scrollInfo
-} {{0.553571 0.910714} {0 1} {0 1} {0 0.357143}}
+} [list [list [expr {31.0/56}] [expr {51.0/56}]] {0.0 1.0} {0.0 1.0} [list 0.0 [expr {5.0/14}]]]
test textDisp-18.7 {GetXView procedure} {
.t configure -wrap none
.t delete 1.0 end
@@ -1953,7 +2180,7 @@ test textDisp-18.8 {GetXView procedure} {
"error "scrolling error""
(procedure "scrollError" line 2)
invoked from within
-"scrollError 0 1"
+"scrollError 0.0 1.0"
(horizontal scrolling command executed by text)}}
catch {rename bgerror {}}
catch {rename bogus {}}
@@ -1965,7 +2192,7 @@ test textDisp-19.1 {GetYView procedure} {
.t delete 1.0 end
update
set scrollInfo
-} {0 1}
+} {0.0 1.0}
test textDisp-19.2 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -1978,7 +2205,7 @@ test textDisp-19.2 {GetYView procedure} {
test textDisp-19.3 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
- update
+ update; after 10 ; update
set scrollInfo "unchanged"
.t insert 1.0 "Line 1\nLine 2 is so long that it wraps around\nLine 3"
update
@@ -1995,7 +2222,7 @@ test textDisp-19.4 {GetYView procedure} {
}
update
set scrollInfo
-} {0 0.769231}
+} [list 0.0 [expr {70.0/91}]]
test textDisp-19.5 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2004,9 +2231,9 @@ test textDisp-19.5 {GetYView procedure} {
.t insert end "\nLine $i"
}
.t insert 2.end " is really quite long; in fact it's so long that it wraps three times"
- update
+ update ; after 100
set x $scrollInfo
-} {0 0.538462}
+} {0.0 0.625}
test textDisp-19.6 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2018,7 +2245,7 @@ test textDisp-19.6 {GetYView procedure} {
.t yview 4.0
update
set x $scrollInfo
-} {0.230769 1}
+} {0.375 1.0}
test textDisp-19.7 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2028,9 +2255,9 @@ test textDisp-19.7 {GetYView procedure} {
}
.t insert 2.end " is really quite long; in fact it's so long that it wraps three times"
.t yview 2.26
- update
+ update; after 1; update
set x $scrollInfo
-} {0.097166 0.692308}
+} {0.125 0.75}
test textDisp-19.8 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2041,8 +2268,9 @@ test textDisp-19.8 {GetYView procedure} {
.t insert 10.end " is really quite long; in fact it's so long that it wraps three times"
.t yview 2.0
update
+ .t count -update -ypixels 1.0 end
set x $scrollInfo
-} {0.0769231 0.732268}
+} {0.0625 0.6875}
test textDisp-19.9 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2053,7 +2281,7 @@ test textDisp-19.9 {GetYView procedure} {
.t yview 3.0
update
set scrollInfo
-} {0.133333 0.8}
+} [list [expr {4.0/30}] 0.8]
test textDisp-19.10 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2064,7 +2292,29 @@ test textDisp-19.10 {GetYView procedure} {
.t yview 11.0
update
set scrollInfo
-} {0.333333 1}
+} [list [expr {1.0/3}] 1.0]
+test textDisp-19.10.1 {Widget manipulation causes height miscount} {
+ .t configure -wrap char
+ .t delete 1.0 end
+ .t insert 1.0 "Line 1"
+ foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
+ .t insert end "\nLine $i"
+ }
+ .t yview 11.0
+ update
+ .t configure -wrap word
+ .t delete 1.0 end
+ .t insert 1.0 "Line 1"
+ foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
+ .t insert end "\nLine $i"
+ }
+ .t insert end "\nThis last line wraps around four "
+ .t insert end "times with a bit left on the last line."
+ .t yview insert
+ update
+ .t count -update -ypixels 1.0 end
+ set scrollInfo
+} {0.5 1.0}
test textDisp-19.11 {GetYView procedure} {
.t configure -wrap word
.t delete 1.0 end
@@ -2076,34 +2326,163 @@ test textDisp-19.11 {GetYView procedure} {
.t insert end "times with a bit left on the last line."
.t yview insert
update
+ .t count -update -ypixels 1.0 end
set scrollInfo
-} {0.625 1}
+} {0.5 1.0}
+test textDisp-19.11.2 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 1.0 end
+} {20}
+test textDisp-19.11.3 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines end 1.0
+} {-20}
+test textDisp-19.11.4 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 1.1 1.3
+} {0}
+test textDisp-19.11.5 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 16.0 16.1
+} {0}
+test textDisp-19.11.5.1 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 16.0 16.5
+} {0}
+test textDisp-19.11.6 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 16.0 16.20
+} {1}
+test textDisp-19.11.7 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 16.0 16.40
+} {2}
+test textDisp-19.11.8 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines "16.0 displaylineend +1c" "16.0 lineend"
+} {3}
+test textDisp-19.11.9 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 16.0 "16.0 lineend"
+} {4}
+test textDisp-19.11.10 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 16.0 "16.0 +4displaylines"
+} {4}
+test textDisp-19.11.11 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines 16.0 "16.0 +2displaylines"
+} {2}
+test textDisp-19.11.12 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t count -displaylines "16.0 +1displayline" "16.0 +2displaylines -1c"
+} {0}
+.t tag configure elide -elide 1
+test textDisp-19.11.13 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "16.0 +1displaylines" "16.0 +1displaylines +6c"
+ .t count -displaylines 16.0 "16.0 +4displaylines"
+} {4}
+test textDisp-19.11.14 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "16.0 +1displaylines" "16.0 +1displaylines displaylineend"
+ .t count -displaylines 16.0 "16.0 +4displaylines"
+} {4}
+test textDisp-19.11.15 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
+ .t count -displaylines 16.0 "16.0 +4displaylines -1c"
+} {3}
+test textDisp-19.11.15a {TextWidgetCmd procedure, "count -displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
+ .t count -displaylines 16.0 "16.0 +4displaylines"
+} {4}
+test textDisp-19.11.16 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "12.0" "14.0"
+ .t count -displaylines 12.0 16.0
+} {2}
+test textDisp-19.11.17 {TextWidgetCmd procedure, "index +displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "12.0" "14.0"
+ list [.t index "11.5 +2d lines"] \
+ [.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
+ [.t index "13.0 +2d lines"] [.t index "13.1 +3d lines"] \
+ [.t index "13.0 +4d lines"]
+} {15.5 16.0 15.0 16.0 16.15 16.33}
+test textDisp-19.11.18 {TextWidgetCmd procedure, "index +displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "12.0" "14.0"
+ list [.t index "15.5 -2d lines"] \
+ [.t index "16.0 -2d lines"] [.t index "15.0 -2d lines"] \
+ [.t index "16.0 -3d lines"] [.t index "16.17 -4d lines"] \
+ [.t index "16.36 -5d lines"]
+} {11.5 14.0 11.0 11.0 11.2 11.3}
+test textDisp-19.11.19 {TextWidgetCmd procedure, "count -displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "12.0" "16.0 +1displaylines"
+ .t count -displaylines 12.0 17.0
+} {4}
+test textDisp-19.11.20 {TextWidgetCmd procedure, "index +displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "12.0" "16.0 +1displaylines"
+ list [.t index "11.5 +2d lines"] \
+ [.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
+ [.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \
+ [.t index "13.0 +4d lines"]
+} {16.38 16.50 16.33 16.50 16.67 17.0}
+test textDisp-19.11.21 {TextWidgetCmd procedure, "index +displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "12.0" "16.0 +1displaylines"
+ list [.t index "16.38 -2d lines"] \
+ [.t index "16.50 -3d lines"] [.t index "16.33 -2d lines"] \
+ [.t index "16.53 -4d lines"] [.t index "16.69 -4d lines"] \
+ [.t index "17.1 -5d lines"]
+} {11.5 11.0 11.0 10.3 11.2 11.0}
+test textDisp-19.11.22 {TextWidgetCmd procedure, "index +displaylines"} {
+ .t tag remove elide 1.0 end
+ list [.t index "end +5d lines"] \
+ [.t index "end -3d lines"] [.t index "1.0 -2d lines"] \
+ [.t index "1.0 +4d lines"] [.t index "1.0 +50d lines"] \
+ [.t index "end -50d lines"]
+} {17.0 16.33 1.0 5.0 17.0 1.0}
+test textDisp-19.11.23 {TextWidgetCmd procedure, "index +displaylines"} {
+ .t tag remove elide 1.0 end
+ .t tag add elide "12.3" "16.0 +1displaylines"
+ list [.t index "11.5 +1d lines"] [.t index "11.5 +2d lines"] \
+ [.t index "12.0 +1d lines"] \
+ [.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
+ [.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \
+ [.t index "13.0 +4d lines"]
+} {16.17 16.33 16.28 16.46 16.28 16.49 16.65 17.0}
+.t tag remove elide 1.0 end
+test textDisp-19.11.24 {TextWidgetCmd procedure, "index +/-displaylines"} {
+ list [.t index "11.5 + -1 display lines"] \
+ [.t index "11.5 + +1 disp lines"] \
+ [.t index "11.5 - -1 disp lines"] \
+ [.t index "11.5 - +1 disp lines"] \
+ [.t index "11.5 -1 disp lines"] \
+ [.t index "11.5 +1 disp lines"] \
+ [.t index "11.5 +0 disp lines"]
+} {10.5 12.5 12.5 10.5 10.5 12.5 11.5}
+.t tag remove elide 1.0 end
test textDisp-19.12 {GetYView procedure, partially visible last line} {
catch {destroy .top}
toplevel .top
wm geometry .top +0+0
- text .top.t -width 40 -height 5
+ text .top.t -width 40 -height 5 -font $fixedFont
pack .top.t -expand yes -fill both
.top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5"
- update
+ # Need to wait for asychronous calculations to complete.
+ update ; after 10
scan [wm geom .top] %dx%d twidth theight
wm geom .top ${twidth}x[expr $theight - 3]
update
.top.t yview
-} {0 0.8}
-test textDisp-19.13 {GetYView procedure, partially visible last line} {fonts} {
+} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
+test textDisp-19.13 {GetYView procedure, partially visible last line} {textfonts} {
catch {destroy .top}
toplevel .top
wm geometry .top +0+0
- text .top.t -width 40 -height 5
+ text .top.t -width 40 -height 5 -font $fixedFont
pack .top.t -expand yes -fill both
.top.t insert end "Line 1\nLine 2\nLine 3\nLine 4 has enough text to wrap around at least once"
- update
+ # Need to wait for asychronous calculations to complete.
+ update ; after 10
scan [wm geom .top] %dx%d twidth theight
wm geom .top ${twidth}x[expr $theight - 3]
update
.top.t yview
-} {0 0.942308}
+} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
catch {destroy .top}
test textDisp-19.14 {GetYView procedure} {
.t configure -wrap word
@@ -2114,7 +2493,9 @@ test textDisp-19.14 {GetYView procedure} {
}
.t insert end "\nThis last line wraps around four "
.t insert end "times with a bit left on the last line."
- update
+ # Need to update so everything is calculated.
+ update ; .t count -update -ypixels 1.0 end
+ update ; after 10 ; update
set scrollInfo "unchanged"
.t mark set insert 3.0
.t tag configure x -background red
@@ -2148,9 +2529,29 @@ test textDisp-19.15 {GetYView procedure} {
"error "scrolling error""
(procedure "scrollError" line 2)
invoked from within
-"scrollError 0 1"
+"scrollError 0.0 1.0"
(vertical scrolling command executed by text)} NONE}
+test textDisp-19.16 {count -ypixels} {
+ .t configure -wrap word
+ .t delete 1.0 end
+ .t insert 1.0 "Line 1"
+ foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
+ .t insert end "\nLine $i"
+ }
+ .t insert end "\nThis last line wraps around four "
+ .t insert end "times with a bit left on the last line."
+ # Need to update so everything is calculated.
+ update ; .t count -update -ypixels 1.0 end ; update
+ set res {}
+ lappend res \
+ [.t count -ypixels 1.0 end] \
+ [.t count -update -ypixels 1.0 end] \
+ [.t count -ypixels 15.0 16.0] \
+ [.t count -ypixels 15.0 "16.0 displaylineend +1c"] \
+ [.t count -ypixels 16.0 "16.0 displaylineend +1c"] \
+ [.t count -ypixels "16.0 +1 displaylines" "16.0 +4 displaylines +3c"]
+} [list [expr {260 + 20 * $fixedDiff}] [expr {260 + 20 * $fixedDiff}] $fixedHeight [expr {2*$fixedHeight}] $fixedHeight [expr {3*$fixedHeight}]]
.t delete 1.0 end
.t insert end "Line 1"
for {set i 2} {$i <= 200} {incr i} {
@@ -2159,46 +2560,46 @@ for {set i 2} {$i <= 200} {incr i} {
.t configure -wrap word
.t delete 50.0 51.0
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
-test textDisp-20.1 {FindDLine} {fonts} {
+test textDisp-20.1 {FindDLine} {textfonts} {
.t yview 48.0
list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \
[.t dlineinfo 58.0]
-} {{} {} {3 16 49 13 10} {}}
-test textDisp-20.2 {FindDLine} {fonts} {
+} [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+test textDisp-20.2 {FindDLine} {textfonts} {
.t yview 100.0
.t yview -pickplace 53.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.15]
-} {{} {} {3 3 140 13 10}}
-test textDisp-20.3 {FindDLine} {fonts} {
+} [list [list 3 [expr {-1 - $fixedDiff/2}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
+test textDisp-20.3 {FindDLine} {textfonts} {
.t yview 100.0
.t yview 49.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 57.0]
-} {{3 16 105 13 10} {3 29 140 13 10} {}}
-test textDisp-20.4 {FindDLine} {fonts} {
+} [list [list 3 [expr {$fixedDiff + 16}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+test textDisp-20.4 {FindDLine} {textfonts} {
.t yview 100.0
.t yview 42.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
-} {{3 107 105 13 10} {3 120 140 13 10} {}}
+} [list [list 3 [expr {8*$fixedDiff + 107}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
.t config -wrap none
-test textDisp-20.5 {FindDLine} {fonts} {
+test textDisp-20.5 {FindDLine} {textfonts} {
.t yview 100.0
.t yview 48.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
-} {{3 29 371 13 10} {3 29 371 13 10} {3 29 371 13 10}}
+} [list [list 3 [expr {3+2*$fixedHeight}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {3+2*$fixedHeight}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {3+2*$fixedHeight}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
.t config -wrap word
-test textDisp-21.1 {TkTextPixelIndex} {fonts} {
+test textDisp-21.1 {TkTextPixelIndex} {textfonts} {
.t yview 48.0
list [.t index @-10,-10] [.t index @6,6] [.t index @22,6] \
- [.t index @102,6] [.t index @38,55] [.t index @44,67]
+ [.t index @102,6] [.t index @38,[expr {$fixedHeight * 4 + 3}]] [.t index @44,67]
} {48.0 48.0 48.2 48.7 50.40 50.40}
.t insert end \n
-test textDisp-21.2 {TkTextPixelIndex} {fonts} {
+test textDisp-21.2 {TkTextPixelIndex} {textfonts} {
.t yview 195.0
- list [.t index @11,70] [.t index @11,84] [.t index @11,102] \
+ list [.t index @11,[expr {$fixedHeight * 5 + 5}]] [.t index @11,[expr {$fixedHeight * 6 + 5}]] [.t index @11,[expr {$fixedHeight * 7 + 5}]] \
[.t index @11,1002]
} {197.1 198.1 199.1 201.0}
-test textDisp-21.3 {TkTextPixelIndex, horizontal scrolling} {fonts} {
+test textDisp-21.3 {TkTextPixelIndex, horizontal scrolling} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "12345\n"
@@ -2206,6 +2607,31 @@ test textDisp-21.3 {TkTextPixelIndex, horizontal scrolling} {fonts} {
.t xview scroll 2 units
list [.t index @-5,7] [.t index @5,7] [.t index @33,20]
} {1.2 1.2 2.6}
+test textDisp-21.4 {count -displaylines regression} {
+ set message {
+ QOTW: "C/C++, which is used by 16% of users, is the most popular programming language, but Tcl, used by 0%, seems to be the language of choice for the highest scoring users."
+(new line)
+Use the Up (cursor) key to scroll up one line at a time. At the second press, the cursor either gets locked or jumps several lines.
+
+Connect with Tkcon. The command
+.u count -displaylines \
+3.10 2.173
+should give answer -1; it gives me 5.
+
+Using 8.5a4 (ActiveState beta 4) under Linux. No problem with ActiveState beta 3.
+}
+
+toplevel .tt
+pack [text .tt.u] -side right
+.tt.u configure -width 30 -height 27 -wrap word -bg #FFFFFF
+.tt.u insert end $message
+.tt.u mark set insert 3.10
+tkwait visibility .tt.u
+set res [.tt.u count -displaylines 3.10 2.173]
+destroy .tt
+unset message
+set res
+} {-1}
.t delete 1.0 end
.t insert end "Line 1"
@@ -2217,57 +2643,57 @@ for {set i 2} {$i <= 200} {incr i} {
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
update
.t tag add x 50.1
-test textDisp-22.1 {TkTextCharBbox} {fonts} {
+test textDisp-22.1 {TkTextCharBbox} {textfonts} {
.t config -wrap word
.t yview 48.0
list [.t bbox 47.2] [.t bbox 48.0] [.t bbox 50.5] [.t bbox 50.40] \
[.t bbox 58.0]
-} {{} {3 3 7 13} {38 29 7 13} {38 55 7 13} {}}
-test textDisp-22.2 {TkTextCharBbox} {fonts} {
+} [list {} [list 3 3 7 $fixedHeight] [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] [list 38 [expr {3+4*$fixedHeight}] 7 $fixedHeight] {}]
+test textDisp-22.2 {TkTextCharBbox} {textfonts} {
.t config -wrap none
.t yview 48.0
list [.t bbox 50.5] [.t bbox 50.40] [.t bbox 57.0]
-} {{38 29 7 13} {} {3 120 7 13}}
-test textDisp-22.3 {TkTextCharBbox, cut-off lines} {fonts} {
+} [list [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] {} [list 3 [expr {3+9*$fixedHeight}] 7 $fixedHeight]]
+test textDisp-22.3 {TkTextCharBbox, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
wm geom . ${width}x[expr $height-1]
update
list [.t bbox 19.1] [.t bbox 20.1]
-} {{10 120 7 13} {10 133 7 3}}
-test textDisp-22.4 {TkTextCharBbox, cut-off lines} {fonts} {
+} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 3]]
+test textDisp-22.4 {TkTextCharBbox, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
wm geom . ${width}x[expr $height+1]
update
list [.t bbox 19.1] [.t bbox 20.1]
-} {{10 120 7 13} {10 133 7 5}}
-test textDisp-22.5 {TkTextCharBbox, cut-off char} {fonts} {
+} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 5]]
+test textDisp-22.5 {TkTextCharBbox, cut-off char} {textfonts} {
.t config -wrap none
.t yview 10.0
wm geom . [expr $width-95]x$height
update
.t bbox 15.6
-} {45 68 7 13}
-test textDisp-22.6 {TkTextCharBbox, line visible but not char} {fonts} {
+} [list 45 [expr {3+5*$fixedHeight}] 7 $fixedHeight]
+test textDisp-22.6 {TkTextCharBbox, line visible but not char} {textfonts} {
.t config -wrap char
.t yview 10.0
.t tag add big 20.2 20.5
wm geom . ${width}x[expr $height+3]
update
list [.t bbox 19.1] [.t bbox 20.1] [.t bbox 20.2]
-} {{10 120 7 13} {} {17 133 14 7}}
+} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] {} [list 17 [expr {3+10*$fixedHeight}] 14 7]]
wm geom . {}
update
-test textDisp-22.7 {TkTextCharBbox, different character sizes} {fonts} {
+test textDisp-22.7 {TkTextCharBbox, different character sizes} {textfonts} {
.t config -wrap char
.t yview 10.0
.t tag add big 12.2 12.5
update
list [.t bbox 12.1] [.t bbox 12.2]
-} {{10 41 7 13} {17 29 14 27}}
+} [list [list 10 [expr {3 + 2*$fixedHeight + $ascentDiff}] 7 $fixedHeight] [list 17 [expr {3+ 2*$fixedHeight}] 14 27]]
.t tag remove big 1.0 end
-test textDisp-22.8 {TkTextCharBbox, horizontal scrolling} {fonts} {
+test textDisp-22.8 {TkTextCharBbox, horizontal scrolling} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert end "12345\n"
@@ -2275,8 +2701,8 @@ test textDisp-22.8 {TkTextCharBbox, horizontal scrolling} {fonts} {
.t xview scroll 4 units
list [.t bbox 1.3] [.t bbox 1.4] [.t bbox 2.3] [.t bbox 2.4] \
[.t bbox 2.23] [.t bbox 2.24]
-} {{} {3 3 7 13} {} {3 16 7 13} {136 16 7 13} {}}
-test textDisp-22.9 {TkTextCharBbox, handling of spacing} {fonts} {
+} [list {} [list 3 3 7 $fixedHeight] {} [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 136 [expr {$fixedDiff + 16}] 7 $fixedHeight] {}]
+test textDisp-22.9 {TkTextCharBbox, handling of spacing} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijkl\nmnopqrstuvwzyz"
@@ -2293,7 +2719,7 @@ test textDisp-22.9 {TkTextCharBbox, handling of spacing} {fonts} {
update
list [.t bbox .t.f1] [.t bbox .t.f2] [.t bbox .t.f3] [.t bbox .t.f4] \
[.t bbox 1.1] [.t bbox 2.9]
-} {{24 11 10 4} {55 15 10 4} {10 43 10 4} {76 40 10 4} {10 11 7 13} {69 34 7 13}}
+} [list [list 24 11 10 4] [list 55 [expr {$fixedDiff/2 + 15}] 10 4] [list 10 [expr {2*$fixedDiff + 43}] 10 4] [list 76 [expr {2*$fixedDiff + 40}] 10 4] [list 10 11 7 $fixedHeight] [list 69 [expr {$fixedDiff + 34}] 7 $fixedHeight]]
.t tag delete spacing
.t delete 1.0 end
@@ -2305,42 +2731,42 @@ for {set i 2} {$i <= 200} {incr i} {
.t delete 50.0 51.0
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
update
-test textDisp-23.1 {TkTextDLineInfo} {fonts} {
+test textDisp-23.1 {TkTextDLineInfo} {textfonts} {
.t config -wrap word
.t yview 48.0
list [.t dlineinfo 47.3] [.t dlineinfo 48.0] [.t dlineinfo 50.40] \
[.t dlineinfo 56.0]
-} {{} {3 3 49 13 10} {3 55 126 13 10} {}}
-test textDisp-23.2 {TkTextDLineInfo} {fonts} {
+} [list {} [list 3 3 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {4*$fixedDiff + 55}] 126 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+test textDisp-23.2 {TkTextDLineInfo} {textfonts} {
.t config -bd 4 -wrap word
update
.t yview 48.0
.t dlineinfo 50.40
-} {7 59 126 13 10}
+} [list 7 [expr {4*$fixedDiff + 59}] 126 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]
.t config -bd 0
-test textDisp-23.3 {TkTextDLineInfo} {fonts} {
+test textDisp-23.3 {TkTextDLineInfo} {textfonts} {
.t config -wrap none
update
.t yview 48.0
list [.t dlineinfo 50.40] [.t dlineinfo 57.3]
-} {{3 29 371 13 10} {3 120 49 13 10}}
-test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {fonts} {
+} [list [list 3 [expr {2*$fixedDiff + 29}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
+test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
wm geom . ${width}x[expr $height-1]
update
list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
-} {{3 120 49 13 10} {3 133 49 3 10}}
-test textDisp-23.5 {TkTextDLineInfo, cut-off lines} {fonts} {
+} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 3 [expr {$fixedDiff + 10}]]]
+test textDisp-23.5 {TkTextDLineInfo, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
wm geom . ${width}x[expr $height+1]
update
list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
-} {{3 120 49 13 10} {3 133 49 5 10}}
+} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 5 [expr {$fixedDiff + 10}]]]
wm geom . {}
update
-test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} {fonts} {
+test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} {textfonts} {
.t config -wrap none
.t delete 1.0 end
.t insert end "First line\n"
@@ -2349,9 +2775,9 @@ test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} {fonts} {
.t xview scroll 6 units
update
list [.t dlineinfo 1.0] [.t dlineinfo 2.0] [.t dlineinfo 3.0]
-} {{-39 3 70 13 10} {-39 16 364 13 10} {-39 29 35 13 10}}
+} [list [list -39 3 70 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list -39 [expr {$fixedDiff + 16}] 364 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list -39 [expr {2*$fixedDiff + 29}] 35 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
.t xview moveto 0
-test textDisp-23.7 {TkTextDLineInfo, centering} {fonts} {
+test textDisp-23.7 {TkTextDLineInfo, centering} {textfonts} {
.t config -wrap word
.t delete 1.0 end
.t insert end "First line\n"
@@ -2362,88 +2788,88 @@ test textDisp-23.7 {TkTextDLineInfo, centering} {fonts} {
.t tag add x 1.0
.t tag add y 3.0
list [.t dlineinfo 1.0] [.t dlineinfo 2.0] [.t dlineinfo 3.0]
-} {{38 3 70 13 10} {3 16 119 13 10} {108 55 35 13 10}}
+} [list [list 38 3 70 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {$fixedDiff + 16}] 119 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 108 [expr {4*$fixedDiff + 55}] 35 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
.t tag delete x y
-test textDisp-24.1 {TkTextCharLayoutProc} {fonts} {
+test textDisp-24.1 {TkTextCharLayoutProc} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 7 13} {3 16 7 13}}
-test textDisp-24.2 {TkTextCharLayoutProc} {fonts} {
+} [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.2 {TkTextCharLayoutProc} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
wm geom . [expr $width+1]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 12 13} {3 16 7 13}}
-test textDisp-24.3 {TkTextCharLayoutProc} {fonts} {
+} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.3 {TkTextCharLayoutProc} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
wm geom . [expr $width-1]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 10 13} {3 16 7 13}}
-test textDisp-24.4 {TkTextCharLayoutProc, newline not visible} {fonts} {
+} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.4 {TkTextCharLayoutProc, newline not visible} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 01234567890123456789\n012345678901234567890
wm geom . {}
update
list [.t bbox 1.19] [.t bbox 1.20] [.t bbox 2.20]
-} {{136 3 7 13} {143 3 0 13} {3 29 7 13}}
-test textDisp-24.5 {TkTextCharLayoutProc, char doesn't fit, newline not visible} {fonts} {
+} [list [list 136 3 7 $fixedHeight] [list 143 3 0 $fixedHeight] [list 3 [expr {2*$fixedDiff + 29}] 7 $fixedHeight]]
+test textDisp-24.5 {TkTextCharLayoutProc, char doesn't fit, newline not visible} {unix textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 0\n1\n
wm geom . 110x$height
update
list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 2.0]
-} {{3 3 4 13} {7 3 0 13} {3 16 4 13}}
-test textDisp-24.6 {TkTextCharLayoutProc, line ends with space} {fonts} {
+} [list [list 3 3 4 $fixedHeight] [list 7 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 4 $fixedHeight]]
+test textDisp-24.6 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
wm geom . {}
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 7 13} {3 16 7 13}}
-test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {fonts} {
+} [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
wm geom . [expr $width+1]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 12 13} {3 16 7 13}}
-test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} {fonts} {
+} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
wm geom . [expr $width-1]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 10 13} {3 16 7 13}}
-test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} {fonts} {
+} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
wm geom . [expr $width-6]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 5 13} {3 16 7 13}}
-test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} {fonts} {
+} [list [list 136 3 5 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
wm geom . [expr $width-7]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 4 13} {3 16 7 13}}
-test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't quite fit} {fonts} {
+} [list [list 136 3 4 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't quite fit} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "01234567890123456789 \nabcdefg"
@@ -2453,72 +2879,78 @@ test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't qui
lappend result [.t bbox 1.21] [.t bbox 2.0]
.t mark set insert 1.21
lappend result [.t bbox 1.21] [.t bbox 2.0]
-} {{145 3 0 13} {3 16 7 13} {145 3 0 13} {3 16 7 13}}
-test textDisp-24.12 {TkTextCharLayoutProc, tab causes wrap} {fonts} {
+} [list [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.12 {TkTextCharLayoutProc, tab causes wrap} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghi"
.t mark set insert 1.4
.t insert insert \t\t\t
list [.t bbox {insert -1c}] [.t bbox insert]
-} {{115 3 30 13} {3 16 7 13}}
-test textDisp-24.13 {TkTextCharLayoutProc, -wrap none} {fonts} {
+} [list [list 115 3 30 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.13 {TkTextCharLayoutProc, -wrap none} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
wm geom . {}
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 7 13} {}}
-test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {fonts} {
+} [list [list 136 3 7 $fixedHeight] {}]
+test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
wm geom . [expr $width+1]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 7 13} {143 3 5 13}}
-test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {fonts} {
+} [list [list 136 3 7 $fixedHeight] [list 143 3 5 $fixedHeight]]
+test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
wm geom . [expr $width-1]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 7 13} {143 3 3 13}}
-test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {fonts} {
+} [list [list 136 3 7 $fixedHeight] [list 143 3 3 $fixedHeight]]
+test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {textfonts} {
+ if {$tcl_platform(platform) == "windows"} {
+ wm overrideredirect . 1
+ }
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
wm geom . 103x$height
update
list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 1.2]
-} {{3 3 1 13} {3 16 1 13} {3 29 1 13}}
-test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} {fonts} {
+} [list [list 3 3 1 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 1 $fixedHeight] [list 3 [expr {2*$fixedDiff + 29}] 1 $fixedHeight]]
+if {$tcl_platform(platform) == "windows"} {
+ wm overrideredirect . 0
+}
+test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This is a line that wraps around"
wm geom . {}
update
list [.t bbox 1.19] [.t bbox 1.20]
-} {{136 3 7 13} {3 16 7 13}}
-test textDisp-24.18 {TkTextCharLayoutProc, -wrap word} {fonts} {
+} [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.18 {TkTextCharLayoutProc, -wrap word} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "xThis is a line that wraps around"
wm geom . {}
update
list [.t bbox 1.14] [.t bbox 1.15] [.t bbox 1.16]
-} {{101 3 7 13} {108 3 35 13} {3 16 7 13}}
-test textDisp-24.19 {TkTextCharLayoutProc, -wrap word} {fonts} {
+} [list [list 101 3 7 $fixedHeight] [list 108 3 35 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+test textDisp-24.19 {TkTextCharLayoutProc, -wrap word} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "xxThis is a line that wraps around"
wm geom . {}
update
list [.t bbox 1.14] [.t bbox 1.15] [.t bbox 1.16]
-} {{101 3 7 13} {108 3 7 13} {115 3 28 13}}
-test textDisp-24.20 {TkTextCharLayoutProc, vertical offset} {fonts} {
+} [list [list 101 3 7 $fixedHeight] [list 108 3 7 $fixedHeight] [list 115 3 28 $fixedHeight]]
+test textDisp-24.20 {TkTextCharLayoutProc, vertical offset} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2\nLine 3"
@@ -2531,18 +2963,18 @@ test textDisp-24.20 {TkTextCharLayoutProc, vertical offset} {fonts} {
lappend result [.t bbox 2.1] [.t dlineinfo 2.1]
.t tag delete up
set result
-} {{10 16 7 13} {3 16 42 13 10} {10 16 7 13} {3 16 42 19 16} {10 18 7 13} {3 16 42 15 10}}
+} [list [list 10 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 42 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 10 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 42 [expr {$fixedDiff + 19}] [expr {$fixedDiff + 16}]] [list 10 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 42 [expr {$fixedDiff + 15}] [expr {$fixedDiff + 10}]]]
.t configure -width 30
update
-test textDisp-24.21 {TkTextCharLayoutProc, word breaks} {fonts} {
+test textDisp-24.21 {TkTextCharLayoutProc, word breaks} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "Sample text xxxxxxx yyyyy zzzzzzz qqqqq rrrr ssss tt u vvvvv"
frame .t.f -width 30 -height 20 -bg black
.t window create 1.36 -window .t.f
.t bbox 1.26
-} {3 19 7 13}
-test textDisp-24.22 {TkTextCharLayoutProc, word breaks} {fonts} {
+} [list 3 [expr {$fixedDiff/2 + 19}] 7 $fixedHeight]
+test textDisp-24.22 {TkTextCharLayoutProc, word breaks} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
frame .t.f -width 30 -height 20 -bg black
@@ -2550,8 +2982,8 @@ test textDisp-24.22 {TkTextCharLayoutProc, word breaks} {fonts} {
.t window create end -window .t.f
.t insert end "zzzzzzz qqqqq rrrr ssss tt u vvvvv"
.t bbox 1.28
-} {33 19 7 13}
-test textDisp-24.23 {TkTextCharLayoutProc, word breaks} {fonts} {
+} [list 33 [expr {$fixedDiff/2 + 19}] 7 $fixedHeight]
+test textDisp-24.23 {TkTextCharLayoutProc, word breaks} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
frame .t.f -width 30 -height 20 -bg black
@@ -2560,36 +2992,45 @@ test textDisp-24.23 {TkTextCharLayoutProc, word breaks} {fonts} {
.t window create end -window .t.f
.t insert end "u vvvvv"
.t bbox .t.f
-} {3 29 30 20}
+} [list 3 [expr {2*$fixedDiff + 29}] 30 20]
catch {destroy .t.f}
.t configure -width 20
update
-test textDisp-24.24 {TkTextCharLayoutProc, justification and tabs} {fonts} {
+test textDisp-24.24 {TkTextCharLayoutProc, justification and tabs} {textfonts} {
.t delete 1.0 end
.t tag configure x -justify center
.t insert 1.0 aa\tbb\tcc\tdd\t
.t tag add x 1.0 end
list [.t bbox 1.0] [.t bbox 1.10]
-} {{45 3 7 13} {94 3 7 13}}
+} [list [list 45 3 7 $fixedHeight] [list 94 3 7 $fixedHeight]]
.t configure -width 40 -bd 0 -relief flat -highlightthickness 0 -padx 0 \
-tabs 100
update
-test textDisp-25.1 {CharBboxProc procedure, check tab width} {fonts} {
+test textDisp-25.1 {CharBboxProc procedure, check tab width} {textfonts} {
.t delete 1.0 end
.t insert 1.0 abc\td\tfgh
list [.t bbox 1.3] [.t bbox 1.5] [.t bbox 1.6]
-} {{21 1 79 13} {107 1 93 13} {200 1 7 13}}
+} [list [list 21 1 79 $fixedHeight] [list 107 1 93 $fixedHeight] [list 200 1 7 $fixedHeight]]
.t configure -width 40 -bd 0 -relief flat -highlightthickness 0 -padx 0 \
-tabs {}
update
-test textDisp-26.1 {AdjustForTab procedure, no tabs} {fonts} {
+test textDisp-26.1 {AdjustForTab procedure, no tabs} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\tbcdefghij\tc\td
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.12] 0] \
[lindex [.t bbox 1.14] 0]
-} {56 168 224}
+} [list 56 126 168]
+test textDisp-26.1.2 {AdjustForTab procedure, no tabs} {textfonts} {
+ .t delete 1.0 end
+ .t insert 1.0 a\tbcdefghij\tc\td
+ .t configure -tabstyle wordprocessor
+ set res [list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.12] 0] \
+ [lindex [.t bbox 1.14] 0]]
+ .t configure -tabstyle tabular
+ set res
+} [list 56 168 224]
test textDisp-26.2 {AdjustForTab procedure, not enough tabs specified} {
.t delete 1.0 end
.t insert 1.0 a\tb\tc\td
@@ -2598,7 +3039,7 @@ test textDisp-26.2 {AdjustForTab procedure, not enough tabs specified} {
.t tag add x 1.0 end
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \
[lindex [.t bbox 1.6] 0]
-} {40 80 120}
+} [list 40 80 120]
test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} {
.t delete 1.0 end
.t insert 1.0 a\tb\tc\td\te
@@ -2609,7 +3050,7 @@ test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} {
[expr [lindex [.t bbox 1.4] 0] + [lindex [.t bbox 1.4] 2]] \
[expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]] \
[expr [lindex [.t bbox 1.8] 0] + [lindex [.t bbox 1.8] 2]]
-} {40 70 100 130}
+} [list 40 70 100 130]
test textDisp-26.4 {AdjustForTab procedure, different alignments} {
.t delete 1.0 end
.t insert 1.0 a\tbc\tde\tfg\thi
@@ -2621,7 +3062,7 @@ test textDisp-26.4 {AdjustForTab procedure, different alignments} {
.t tag add y 1.8
list [lindex [.t bbox 1.3] 0] [lindex [.t bbox 1.5] 0] \
[lindex [.t bbox 1.10] 0]
-} {40 80 130}
+} [list 40 80 130]
test textDisp-26.5 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.234
@@ -2700,7 +3141,7 @@ test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
update
lindex [.t bbox 1.5] 0
} {120}
-test textDisp-26.13 {AdjustForTab procedure, not enough space} {fonts} {
+test textDisp-26.13 {AdjustForTab procedure, not enough space} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "abc\txyz\tqrs\txyz\t0"
.t tag delete x
@@ -2708,97 +3149,190 @@ test textDisp-26.13 {AdjustForTab procedure, not enough space} {fonts} {
.t tag add x 1.0 end
list [lindex [.t bbox 1.4] 0] [lindex [.t bbox 1.8] 0] \
[lindex [.t bbox 1.12] 0] [lindex [.t bbox 1.16] 0]
-} {28 56 84 120}
+} [list 28 56 84 120]
+test textDisp-26.13.2 {AdjustForTab procedure, not enough space} {textfonts} {
+ .t delete 1.0 end
+ .t insert 1.0 "abc\txyz\tqrs\txyz\t0"
+ .t tag delete x
+ .t tag configure x -tabs {10 30 center 50 right 120} -tabstyle wordprocessor
+ .t tag add x 1.0 end
+ set res [list [lindex [.t bbox 1.4] 0] [lindex [.t bbox 1.8] 0] \
+ [lindex [.t bbox 1.12] 0] [lindex [.t bbox 1.16] 0]]
+ .t tag configure x -tabstyle tabular
+ set res
+} [list 28 56 120 190]
+test textDisp-26.14 {AdjustForTab procedure, not enough space} {textfonts} {
+ .t delete 1.0 end
+ .t insert end "a \tb \tc \td \te \tf \tg\n"
+ .t insert end "Watch the \tX and the \t\t\tY\n"
+ .t tag configure moop -tabs [expr {8*$fixedWidth}]
+ .t insert end "Watch the \tX and the \t\t\tY\n" moop
+ list [lindex [.t bbox 2.11] 0] [lindex [.t bbox 2.24] 0] \
+ [lindex [.t bbox 3.11] 0] [lindex [.t bbox 3.24] 0]
+} [list 77 224 77 224]
+test textDisp-26.14.2 {AdjustForTab procedure, not enough space} {textfonts} {
+ .t delete 1.0 end
+ .t configure -tabstyle wordprocessor
+ .t insert end "a \tb \tc \td \te \tf \tg\n"
+ .t insert end "Watch the \tX and the \t\t\tY\n"
+ .t tag configure moop -tabs [expr {8*$fixedWidth}]
+ .t insert end "Watch the \tX and the \t\t\tY\n" moop
+ set res [list [lindex [.t bbox 2.11] 0] [lindex [.t bbox 2.24] 0] \
+ [lindex [.t bbox 3.11] 0] [lindex [.t bbox 3.24] 0]]
+ .t configure -tabstyle tabular
+ set res
+} [list 112 56 112 56]
.t configure -width 20 -bd 2 -highlightthickness 2 -relief sunken -tabs {} \
-wrap char
update
-test textDisp-27.1 {SizeOfTab procedure, old-style tabs} {fonts} {
+test textDisp-27.1 {SizeOfTab procedure, old-style tabs} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\tbcdefghij\tc\td
list [.t bbox 1.2] [.t bbox 1.10] [.t bbox 1.12]
-} {{60 5 7 13} {116 5 7 13} {4 18 7 13}}
-test textDisp-27.2 {SizeOfTab procedure, choosing tabX and alignment} {fonts} {
+} [list [list 60 5 7 $fixedHeight] [list 116 5 7 $fixedHeight] [list 130 5 7 $fixedHeight]]
+test textDisp-27.1.1 {SizeOfTab procedure, old-style tabs} {textfonts} {
+ .t delete 1.0 end
+ .t insert 1.0 a\tbcdefghij\tc\td
+ .t configure -tabstyle wordprocessor
+ set res [list [.t bbox 1.2] [.t bbox 1.10] [.t bbox 1.12]]
+ .t configure -tabstyle tabular
+ set res
+} [list [list 60 5 7 $fixedHeight] [list 116 5 7 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.2 {SizeOfTab procedure, choosing tabX and alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\tbcd
.t tag delete x
.t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.3] [.t bbox 1.4]
-} {{131 5 13 13} {4 18 7 13}}
-test textDisp-27.3 {SizeOfTab procedure, choosing tabX and alignment} {fonts} {
+} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.3 {SizeOfTab procedure, choosing tabX and alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\t\t\tbcd
.t tag delete x
.t tag configure x -tabs 40
.t tag add x 1.0 end
list [.t bbox 1.5] [.t bbox 1.6]
-} {{131 5 13 13} {4 18 7 13}}
-test textDisp-27.4 {SizeOfTab procedure, choosing tabX and alignment} {fonts} {
+} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.4 {SizeOfTab procedure, choosing tabX and alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\t\t\tbcd
.t tag delete x
.t tag configure x -tabs {20 center 70 left}
.t tag add x 1.0 end
list [.t bbox 1.5] [.t bbox 1.6]
-} {{131 5 13 13} {4 18 7 13}}
-test textDisp-27.5 {SizeOfTab procedure, center alignment} {fonts} {
+} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.5 {SizeOfTab procedure, center alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\txyzzyabc
.t tag delete x
.t tag configure x -tabs {120 center}
.t tag add x 1.0 end
list [.t bbox 1.6] [.t bbox 1.7]
-} {{135 5 9 13} {4 18 7 13}}
-test textDisp-27.6 {SizeOfTab procedure, center alignment} {fonts} {
+} [list [list 135 5 9 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.6 {SizeOfTab procedure, center alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\txyzzyabc
.t tag delete x
.t tag configure x -tabs {150 center}
.t tag add x 1.0 end
list [.t bbox 1.6] [.t bbox 1.7]
-} {{32 18 7 13} {39 18 7 13}}
-test textDisp-27.7 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} {fonts} {
+} [list [list 32 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 39 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.7 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} {textfonts} {
+ .t delete 1.0 end
+ set cm [winfo fpixels .t 1c]
+ .t configure -tabs {1c 2c center 3c 4c 5c 6c 7c 8c} -wrap none -width 40
+ .t insert 1.0 a\tb\tc\td\te\n012345678934567890a\tbb\tcc\tdd
+ set width [expr {$fixedWidth * 19}]
+ set tab $cm
+ while {$tab < $width} {
+ set tab [expr {$tab + $cm}]
+ }
+ # Now we've calculated to the end of the tab after 'a', add one
+ # more for 'bb\t' and we're there, with 4 for the border. Since
+ # Tk_GetPixelsFromObj uses the standard 'int(0.5 + float)' rounding,
+ # so must we.
+ set tab [expr {4 + int(0.5 + $tab + $cm)}]
+ update
+ set res [.t bbox 2.23]
+ lset res 0 [expr {[lindex $res 0] - $tab}]
+ set res
+} [list -28 [expr {$fixedDiff + 18}] 7 $fixedHeight]
+test textDisp-27.7.1 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} {textfonts} {
.t delete 1.0 end
- .t configure -tabs {1c 2c center 3c 4c} -wrap none -width 40
+ .t configure -tabstyle wordprocessor
+ set cm [winfo fpixels .t 1c]
+ .t configure -tabs {1c 2c center 3c 4c 5c 6c 7c 8c} -wrap none -width 40
.t insert 1.0 a\tb\tc\td\te\n012345678934567890a\tbb\tcc\tdd
+ set width [expr {$fixedWidth * 19}]
+ set tab $cm
+ while {$tab < $width} {
+ set tab [expr {$tab + $cm}]
+ }
+ # Now we've calculated to the end of the tab after 'a', add one
+ # more for 'bb\t' and we're there, with 4 for the border. Since
+ # Tk_GetPixelsFromObj uses the standard 'int(0.5 + float)' rounding,
+ # so must we.
+ set tab [expr {4 + int(0.5 + $tab + $cm)}]
+ update
+ set res [.t bbox 2.23]
+ .t configure -tabstyle tabular
+ lset res 0 [expr {[lindex $res 0] - $tab}]
+ set res
+} [list 0 [expr {$fixedDiff + 18}] 7 $fixedHeight]
+test textDisp-27.7.2 {SizeOfTab procedure, fractional tab interpolation problem} {
+ .t delete 1.0 end
+ set interpolatetab {1c 2c}
+ set precisetab {}
+ for {set i 1} {$i < 20} {incr i} {
+ lappend precisetab "${i}c"
+ }
+ .t configure -tabs $interpolatetab -wrap none -width 150
+ .t insert 1.0 [string repeat "a\t" 20]
update
- .t bbox 2.24
-} {172 18 7 13}
+ set res [.t bbox 1.20]
+ # Now, Tk's interpolated tabs should be the same as
+ # non-interpolated.
+ .t configure -tabs $precisetab
+ update
+ expr {[lindex $res 0] - [lindex [.t bbox 1.20] 0]}
+} {0}
+
.t configure -wrap char -tabs {} -width 20
update
-test textDisp-27.8 {SizeOfTab procedure, right alignment} {fonts} {
+test textDisp-27.8 {SizeOfTab procedure, right alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\t\txyzzyabc
.t tag delete x
.t tag configure x -tabs {100 left 140 right}
.t tag add x 1.0 end
list [.t bbox 1.6] [.t bbox 1.7]
-} {{137 5 7 13} {4 18 7 13}}
-test textDisp-27.9 {SizeOfTab procedure, left alignment} {fonts} {
+} [list [list 137 5 7 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.9 {SizeOfTab procedure, left alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\txyzzyabc
.t tag delete x
.t tag configure x -tabs {120}
.t tag add x 1.0 end
list [.t bbox 1.3] [.t bbox 1.4]
-} {{131 5 13 13} {4 18 7 13}}
-test textDisp-27.10 {SizeOfTab procedure, numeric alignment} {fonts} {
+} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.10 {SizeOfTab procedure, numeric alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\t123.4
.t tag delete x
.t tag configure x -tabs {120 numeric}
.t tag add x 1.0 end
list [.t bbox 1.3] [.t bbox 1.4]
-} {{117 5 27 13} {4 18 7 13}}
-test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a space} {fonts} {
+} [list [list 117 5 27 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a space} {textfonts} {
.t delete 1.0 end
.t insert 1.0 abc\tdefghijklmnopqrst
.t tag delete x
.t tag configure x -tabs {120}
.t tag add x 1.0 end
list [.t bbox 1.5] [.t bbox 1.6]
-} {{131 5 13 13} {4 18 7 13}}
+} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
proc bizarre_scroll args {
.t2.t delete 5.0 end
@@ -2818,7 +3352,7 @@ test textDisp-28.1 {"yview" option with bizarre scroll command} {
lappend result [.t2.t index @0,0]
} {6.0 1.0}
-test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {fonts} {
+test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
@@ -2832,8 +3366,8 @@ test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {fonts} {
.t2.t window create 1.1 -window .t2.t.f
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
-} {{0 0.466667} 300x50+5+18 {12 68 7 13}}
-test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {fonts} {
+} [list [list 0.0 [expr {14.0/30}]] 300x50+5+[expr {$fixedDiff + 18}] [list 12 [expr {$fixedDiff + 68}] 7 $fixedHeight]]
+test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
@@ -2848,8 +3382,99 @@ test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {fonts} {
.t2.t xview scroll 1 unit
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
-} {{0.0233333 0.49} 300x50+-2+18 {5 68 7 13}}
-test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {fonts} {
+} [list [list [expr {7.0/300}] 0.49] 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]]
+test textDisp-29.2.1 {miscellaneous: lines wrap but are still too long} {textfonts} {
+ catch {destroy .t2}
+ toplevel .t2
+ wm geometry .t2 +0+0
+ text .t2.t -width 20 -height 10 -font $fixedFont \
+ -wrap none -xscrollcommand ".t2.s set"
+ pack .t2.t -side top
+ scrollbar .t2.s -orient horizontal -command ".t2.t xview"
+ pack .t2.s -side bottom -fill x
+ .t2.t insert end 1\n
+ .t2.t insert end [string repeat "abc" 30]
+ .t2.t xview scroll 5 unit
+ update
+ .t2.t xview
+} [list [expr {5.0/90}] [expr {25.0/90}]]
+test textDisp-29.2.2 {miscellaneous: lines wrap but are still too long} {textfonts} {
+ catch {destroy .t2}
+ toplevel .t2
+ wm geometry .t2 +0+0
+ text .t2.t -width 20 -height 10 -font $fixedFont \
+ -wrap char -xscrollcommand ".t2.s set"
+ pack .t2.t -side top
+ scrollbar .t2.s -orient horizontal -command ".t2.t xview"
+ pack .t2.s -side bottom -fill x
+ .t2.t insert end 123
+ frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
+ .t2.t window create 1.1 -window .t2.t.f
+ .t2.t xview scroll 2 unit
+ update
+ list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
+} [list [list [expr {14.0/300}] [expr {154.0/300}]] 300x50+-9+[expr {$fixedDiff + 18}] {}]
+test textDisp-29.2.3 {miscellaneous: lines wrap but are still too long} {textfonts} {
+ catch {destroy .t2}
+ toplevel .t2
+ wm geometry .t2 +0+0
+ text .t2.t -width 20 -height 10 -font $fixedFont \
+ -wrap char -xscrollcommand ".t2.s set"
+ pack .t2.t -side top
+ scrollbar .t2.s -orient horizontal -command ".t2.t xview"
+ pack .t2.s -side bottom -fill x
+ .t2.t insert end 123
+ frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
+ .t2.t window create 1.1 -window .t2.t.f
+ .t2.t xview scroll 7 pixels
+ update
+ list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
+} [list [list [expr {7.0/300}] 0.49] 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]]
+test textDisp-29.2.4 {miscellaneous: lines wrap but are still too long} {textfonts} {
+ catch {destroy .t2}
+ toplevel .t2
+ wm geometry .t2 +0+0
+ text .t2.t -width 20 -height 10 -font $fixedFont \
+ -wrap char -xscrollcommand ".t2.s set"
+ pack .t2.t -side top
+ scrollbar .t2.s -orient horizontal -command ".t2.t xview"
+ pack .t2.s -side bottom -fill x
+ .t2.t insert end 123
+ frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
+ .t2.t window create 1.1 -window .t2.t.f
+ .t2.t xview scroll 17 pixels
+ update
+ list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
+} [list [list [expr {17.0/300}] [expr {157.0/300}]] 300x50+-12+[expr {$fixedDiff + 18}] {}]
+test textDisp-29.2.5 {miscellaneous: can show last character} {
+ catch {destroy .t2}
+ toplevel .t2
+ wm geometry .t2 121x141+200+200
+ text .t2.t -width 5 -height 5 -font {Arial 10} \
+ -wrap none -xscrollcommand ".t2.s set" \
+ -bd 2 -highlightthickness 0 -padx 1
+ .t2.t insert end "WWWWWWWWWWWWi"
+ scrollbar .t2.s -orient horizontal -command ".t2.t xview"
+ grid .t2.t -row 0 -column 0 -sticky nsew
+ grid .t2.s -row 1 -column 0 -sticky ew
+ grid columnconfigure .t2 0 -weight 1
+ grid rowconfigure .t2 0 -weight 1
+ grid rowconfigure .t2 1 -weight 0
+ update ; update
+ set xv [.t2.t xview]
+ set xd [expr {[lindex $xv 1] - [lindex $xv 0]}]
+ .t2.t xview moveto [expr {1.0-$xd}]
+ set iWidth [lindex [.t2.t bbox end-2c] 2]
+ .t2.t xview scroll 2 units
+ set iWidth2 [lindex [.t2.t bbox end-2c] 2]
+
+ if {($iWidth == $iWidth2) && $iWidth >= 2} {
+ set result "correct"
+ } else {
+ set result "last character is not completely visible when it should be"
+ }
+} {correct}
+test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
@@ -2865,9 +3490,337 @@ test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {fonts} {
.t2.t xview scroll 200 units
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
-} {{0.536667 1} 300x50+-156+18 {}}
+} [list [list [expr {16.0/30}] 1.0] 300x50+-155+[expr {$fixedDiff + 18}] {}]
+test textDisp-30.1 {elidden text joining multiple logical lines} {
+ .t2.t delete 1.0 end
+ .t2.t insert 1.0 "1111\n2222\n3333"
+ .t2.t tag configure elidden -elide 1 -background red
+ .t2.t tag add elidden 1.2 3.2
+ .t2.t count -displaylines 1.0 end
+} {1}
+test textDisp-30.2 {elidden text joining multiple logical lines} {
+ .t2.t delete 1.0 end
+ .t2.t insert 1.0 "1111\n2222\n3333"
+ .t2.t tag configure elidden -elide 1 -background red
+ .t2.t tag add elidden 1.2 2.2
+ .t2.t count -displaylines 1.0 end
+} {2}
+catch {destroy .t2}
+
+.t configure -height 1
+update
+
+test textDisp-31.1 {line embedded window height update} {
+ set res {}
+ .t delete 1.0 end
+ .t insert end "abcd\nefgh\nijkl\nmnop\nqrst\nuvwx\nyx"
+ frame .t.f -background red -width 100 -height 100
+ .t window create 3.0 -window .t.f
+ lappend res [.t count -update -ypixels 1.0 end]
+ .t.f configure -height 10
+ lappend res [.t count -ypixels 1.0 end]
+ lappend res [.t count -update -ypixels 1.0 end]
+ set res
+} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]]
+
+test textDisp-31.2 {line update index shifting} {
+ set res {}
+ .t.f configure -height 100
+ update
+ lappend res [.t count -update -ypixels 1.0 end]
+ .t.f configure -height 10
+ .t insert 1.0 "abc\n"
+ .t insert 1.0 "abc\n"
+ lappend res [.t count -ypixels 1.0 end]
+ lappend res [.t count -update -ypixels 1.0 end]
+ .t.f configure -height 100
+ .t delete 1.0 3.0
+ lappend res [.t count -ypixels 1.0 end]
+ lappend res [.t count -update -ypixels 1.0 end]
+ set res
+} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
+
+test textDisp-31.3 {line update index shifting} {
+ # Should do exactly the same as the above, as long
+ # as we are correctly tagging the correct lines for
+ # recalculation. The 'update' and 'delay' must be
+ # long enough to ensure all asynchronous updates
+ # have been performed.
+ set res {}
+ .t.f configure -height 100
+ update
+ lappend res [.t count -update -ypixels 1.0 end]
+ .t.f configure -height 10
+ .t insert 1.0 "abc\n"
+ .t insert 1.0 "abc\n"
+ lappend res [.t count -ypixels 1.0 end]
+ update ; after 1000 ; update
+ lappend res [.t count -ypixels 1.0 end]
+ .t.f configure -height 100
+ .t delete 1.0 3.0
+ lappend res [.t count -ypixels 1.0 end]
+ update ; after 1000 ; update
+ lappend res [.t count -ypixels 1.0 end]
+ set res
+} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
+
+test textDisp-31.4 {line embedded image height update} {
+ set res {}
+ image create photo textest -height 100 -width 10
+ .t delete 3.0
+ .t image create 3.0 -image textest
+ update
+ lappend res [.t count -update -ypixels 1.0 end]
+ textest configure -height 10
+ lappend res [.t count -ypixels 1.0 end]
+ lappend res [.t count -update -ypixels 1.0 end]
+ set res
+} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]]
+
+test textDisp-31.5 {line update index shifting} {
+ set res {}
+ textest configure -height 100
+ update ; after 1000 ; update
+ lappend res [.t count -update -ypixels 1.0 end]
+ textest configure -height 10
+ .t insert 1.0 "abc\n"
+ .t insert 1.0 "abc\n"
+ lappend res [.t count -ypixels 1.0 end]
+ lappend res [.t count -update -ypixels 1.0 end]
+ textest configure -height 100
+ .t delete 1.0 3.0
+ lappend res [.t count -ypixels 1.0 end]
+ lappend res [.t count -update -ypixels 1.0 end]
+ set res
+} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
+
+test textDisp-31.6 {line update index shifting} {
+ # Should do exactly the same as the above, as long
+ # as we are correctly tagging the correct lines for
+ # recalculation. The 'update' and 'delay' must be
+ # long enough to ensure all asynchronous updates
+ # have been performed.
+ set res {}
+ textest configure -height 100
+ update ; after 1000 ; update
+ lappend res [.t count -update -ypixels 1.0 end]
+ textest configure -height 10
+ .t insert 1.0 "abc\n"
+ .t insert 1.0 "abc\n"
+ lappend res [.t count -ypixels 1.0 end]
+ update ; after 1000 ; update
+ lappend res [.t count -ypixels 1.0 end]
+ textest configure -height 100
+ .t delete 1.0 3.0
+ lappend res [.t count -ypixels 1.0 end]
+ update ; after 1000 ; update
+ lappend res [.t count -ypixels 1.0 end]
+ set res
+} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
-test textDisp-33.5 {bold or italic fonts} {winOnly} {
+test textDisp-31.7 {line update index shifting, elided} {
+ # The 'update' and 'delay' must be long enough to ensure all
+ # asynchronous updates have been performed.
+ set res {}
+ .t delete 1.0 end
+ lappend res [.t count -update -ypixels 1.0 end]
+ .t insert 1.0 "abc\nabc"
+ .t insert 1.0 "abc\n"
+ lappend res [.t count -update -ypixels 1.0 end]
+ .t tag configure elide -elide 1
+ .t tag add elide 1.3 2.1
+ lappend res [.t count -ypixels 1.0 end]
+ update ; after 1000 ; update
+ lappend res [.t count -ypixels 1.0 end]
+ .t delete 1.0 3.0
+ lappend res [.t count -ypixels 1.0 end]
+ update ; after 1000 ; update
+ lappend res [.t count -ypixels 1.0 end]
+ set res
+} [list [expr {$fixedHeight * 1}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 2}] [expr {$fixedHeight * 1}] [expr {$fixedHeight * 1}]]
+
+test textDisp-32.0 {everything elided} {
+ # Must not crash
+ pack [text .tt]
+ .tt insert 0.0 HELLO
+ .tt tag configure HIDE -elide 1
+ .tt tag add HIDE 0.0 end
+ update ; update ; update ; update
+ destroy .tt
+} {}
+test textDisp-32.1 {everything elided} {
+ # Must not crash
+ pack [text .tt]
+ update
+ .tt insert 0.0 HELLO
+ update
+ .tt tag configure HIDE -elide 1
+ update
+ .tt tag add HIDE 0.0 end
+ update ; update ; update ; update
+ destroy .tt
+} {}
+test textDisp-32.2 {elide and tags} {
+ pack [text .tt -height 30 -width 100 -bd 0 \
+ -highlightthickness 0 -padx 0]
+ .tt insert end \
+ {test text using tags 1 and 3 } \
+ {testtag1 testtag3} \
+ {[this bit here uses tags 2 and 3]} \
+ {testtag2 testtag3}
+ update
+ # indent left margin of tag 1 by 20 pixels
+ # text should be indented
+ .tt tag configure testtag1 -lmargin1 20 ; update
+ #1
+ set res {}
+ lappend res [list [.tt index "1.0 + 0 displaychars"] \
+ [lindex [.tt bbox 1.0] 0] \
+ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]]
+ # hide tag 1, remaining text should not be indented, since
+ # the indented tag and character is hidden.
+ .tt tag configure testtag1 -elide 1 ; update
+ #2
+ lappend res [list [.tt index "1.0 + 0 displaychars"] \
+ [lindex [.tt bbox 1.0] 0] \
+ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]]
+ # reset
+ .tt tag configure testtag1 -lmargin1 0
+ .tt tag configure testtag1 -elide 0
+ # indent left margin of tag 2 by 20 pixels
+ # text should not be indented, since tag1 has lmargin1 of 0.
+ .tt tag configure testtag2 -lmargin1 20 ; update
+ #3
+ lappend res [list [.tt index "1.0 + 0 displaychars"] \
+ [lindex [.tt bbox 1.0] 0] \
+ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]]
+ # hide tag 1, remaining text should now be indented, but
+ # the bbox of 1.0 should have zero width and zero indent,
+ # since it is elided at that position.
+ .tt tag configure testtag1 -elide 1 ; update
+ #4
+ lappend res [list [.tt index "1.0 + 0 displaychars"] \
+ [lindex [.tt bbox 1.0] 0] \
+ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]]
+ # reset
+ .tt tag configure testtag2 -lmargin1 {}
+ .tt tag configure testtag1 -elide 0
+ # indent left margin of tag 3 by 20 pixels
+ # text should be indented, since this tag takes
+ # precedence over testtag1, and is applied to the
+ # start of the text.
+ .tt tag configure testtag3 -lmargin1 20 ; update
+ #5
+ lappend res [list [.tt index "1.0 + 0 displaychars"] \
+ [lindex [.tt bbox 1.0] 0] \
+ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]]
+ # hide tag 1, remaining text should still be indented,
+ # since it still has testtag3 on it. Again the
+ # bbox of 1.0 should have 0.
+ .tt tag configure testtag1 -elide 1 ; update
+ #6
+ lappend res [list [.tt index "1.0 + 0 displaychars"] \
+ [lindex [.tt bbox 1.0] 0] \
+ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]]
+ .tt tag configure testtag3 -lmargin1 {} -elide 0
+ .tt tag configure testtag1 -elide 1 -lmargin1 20
+ #7
+ lappend res [list [.tt index "1.0 + 0 displaychars"] \
+ [lindex [.tt bbox 1.0] 0] \
+ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]]
+ destroy .tt
+ set res
+} {{1.0 20 20} {1.29 0 0} {1.0 0 0} {1.29 0 20}\
+ {1.0 20 20} {1.29 0 20} {1.0 20 20}}
+test textDisp-32.3 "NULL undisplayProc problems: #1791052" -setup {
+ set img [image create photo -data {
+ R0lGODlhEgASANUAAAAAAP/////iHP/mIPrWDPraEP/eGPfOAPbKAPbOBPrS
+ CP/aFPbGAPLCAPLGAN62ANauAMylAPbCAPW/APK+AN6uALKNAPK2APK5ANal
+ AOyzArGHBZp3B+6uAHFVBFVACO6qAOqqAOalAMGMAbF+Am1QBG5QBeuiAOad
+ AM6NAJ9vBW1MBFlACFQ9CVlBCuaZAOKVANyVAZlpBMyFAKZtBJVhBEAUEP//
+ /wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADcALAAAAAASABIAAAa+
+ wJtw+Ckah0iiZwNhODKk0icp/HAShEKBoEBgVFOkK0Iw2GyCs+BAGbGIlrIt
+ EJjXBYgL6X3zJMx1Z2d3EyEmNx9xaYGCdwgaNEUPBYt0do4XKUUOlAOCnmcD
+ CwcXMZsEAgOqq6oLBY+mHxUKBqysCwQSIDNFJAidtgKjFyeRfRQHB2ipAmZs
+ IDArVSTIyoI2bB0oxkIsIxcNyeIXICh7SR8yIhoXFxogJzE1YegrNCkoLzM0
+ K/RUiEY+tKASBAA7
+ }]
+ destroy .tt
+} -body {
+ text .tt
+ .tt tag configure emoticon -elide 1
+ .tt insert end X
+ .tt mark set MSGLEFT "end - 1 char"
+ .tt mark gravity MSGLEFT left
+ .tt insert end ":)" emoticon
+ .tt image create end -image $img
+ pack .tt
+ update; update; update
+} -cleanup {
+ image delete $img
+ destroy .tt
+}
+
+test textDisp-33.0 {one line longer than fits in the widget} {
+ pack [text .tt -wrap char]
+ .tt insert 1.0 [string repeat "more wrap + " 300]
+ update ; update ; update
+ .tt see 1.0
+ lindex [.tt yview] 0
+} {0.0}
+test textDisp-33.1 {one line longer than fits in the widget} {
+ destroy .tt
+ pack [text .tt -wrap char]
+ .tt insert 1.0 [string repeat "more wrap + " 300]
+ update ; update ; update
+ .tt yview "1.0 +1 displaylines"
+ if {[lindex [.tt yview] 0] > 0.1} {
+ set result "window should be scrolled to the top"
+ } else {
+ set result "ok"
+ }
+} {ok}
+test textDisp-33.2 {one line longer than fits in the widget} {
+ destroy .tt
+ pack [text .tt -wrap char]
+ .tt debug 1
+ set tk_textHeightCalc ""
+ .tt insert 1.0 [string repeat "more wrap + " 1]
+ after 100 ; update
+ # Nothing should have been recalculated.
+ set tk_textHeightCalc
+} {}
+test textDisp-33.3 {one line longer than fits in the widget} {
+ destroy .tt
+ pack [text .tt -wrap char]
+ .tt debug 1
+ set tk_textHeightCalc ""
+ .tt insert 1.0 [string repeat "more wrap + " 300]
+ update ; .tt count -update -ypixels 1.0 end ; update
+ # Each line should have been recalculated just once
+ .tt debug 0
+ expr {[llength $tk_textHeightCalc] == [.tt count -displaylines 1.0 end]}
+} {1}
+test textDisp-33.4 {one line longer than fits in the widget} {
+ destroy .tt
+ pack [text .tt -wrap char]
+ .tt debug 1
+ set tk_textHeightCalc ""
+ .tt insert 1.0 [string repeat "more wrap + " 300]
+ update ; update ; update
+ set idx [.tt index "1.0 + 1 displaylines"]
+ .tt yview $idx
+ if {[lindex [.tt yview] 0] > 0.1} {
+ set result "window should be scrolled to the top"
+ } else {
+ set result "ok"
+ }
+ set idx [.tt index "1.0 + 1 displaylines"]
+ .tt debug 0
+ set result
+} {ok}
+destroy .tt
+test textDisp-33.5 {bold or italic fonts} win {
destroy .tt
pack [text .tt -wrap char -font {{MS Sans Serif} 15}]
font create no -family [lindex [.tt cget -font] 0] -size 24
@@ -2891,9 +3844,33 @@ test textDisp-33.5 {bold or italic fonts} {winOnly} {
} {italic font measurement ok}
destroy .tt
+test textDisp-34.1 {Text widgets multi-scrolling problem: Bug 2677890} -setup {
+ pack [text .t1 -width 10 -yscrollcommand {.sy set}] \
+ [ttk::scrollbar .sy -orient vertical -command {.t1 yview}] \
+ -side left -fill both
+ bindtags .sy {}; # No clicky!
+ set txt ""
+ for {set i 0} {$i < 99} {incr i} {
+ lappend txt "$i" [list pc $i] "\n" ""
+ }
+ set result {}
+} -body {
+ .t1 insert end {*}$txt
+ update
+ lappend result [.sy get]
+ .t1 replace 6.0 6.0+1c "*"
+ lappend result [.sy get]
+ after 0 {lappend result [.sy get]}
+ after 1000 {lappend result [.sy get]}
+ vwait result;vwait result
+ return $result
+} -cleanup {
+ destroy .t1 .sy
+} -result {{0.0 1.0} {0.0 1.0} {0.0 1.0} {0.0 0.24}}
+
deleteWindows
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/textImage.test b/tests/textImage.test
index e6bdda2..bb5909c 100644
--- a/tests/textImage.test
+++ b/tests/textImage.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# One time setup. Create a font to insure the tests are font metric invariant.
@@ -33,7 +30,7 @@ test textImage-1.2 {basic argument checking} {
text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0
pack .t
list [catch {.t image c} msg] $msg
-} {1 {bad image option "c": must be cget, configure, create, or names}}
+} {1 {ambiguous option "c": must be cget, configure, create, or names}}
test textImage-1.3 {cget argument checking} {
catch {destroy .t}
@@ -133,7 +130,7 @@ test textImage-1.14 {basic argument checking} {
text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0
pack .t
list [catch {.t image huh} msg] $msg
-} {1 {bad image option "huh": must be cget, configure, create, or names}}
+} {1 {bad option "huh": must be cget, configure, create, or names}}
test textImage-1.15 {align argument checking} {
catch {
@@ -144,7 +141,7 @@ test textImage-1.15 {align argument checking} {
text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0
pack .t
list [catch {.t image create end -image small -align wrong} msg] $msg
-} {1 {bad alignment "wrong": must be baseline, bottom, center, or top}}
+} {1 {bad align "wrong": must be baseline, bottom, center, or top}}
test textImage-1.16 {configure} {
catch {
@@ -303,7 +300,9 @@ test textImage-4.2 {alignment checking - baseline} {
.t image create end -image small -align baseline
.t insert end test
set result ""
- foreach size {10 15 20 30} {
+ # Sizes larger than 25 can be too big and lead to a negative 'norm',
+ # at least on Windows XP with certain settings.
+ foreach size {10 15 20 25} {
font configure test_font2 -size $size
array set Metrics [font metrics test_font2]
update
@@ -317,7 +316,7 @@ test textImage-4.2 {alignment checking - baseline} {
font delete test_font2
unset Metrics
set result
-} {{10 0} {15 0} {20 0} {30 0}}
+} {{10 0} {15 0} {20 0} {25 0}}
test textImage-4.3 {alignment and padding checking} {fonts} {
catch {
@@ -342,25 +341,30 @@ test textImage-4.3 {alignment and padding checking} {fonts} {
}
set result
} {{default:55 22 5 5} {top:55 10 5 5} {bottom:55 35 5 5} {center:55 22 5 5} {baseline:55 22 5 5}}
-# cleanup
+test textImage-5.0 {peer widget images} {
+ catch {
+ image create photo small -width 5 -height 5
+ small put red -to 0 0 4 4
+ image create photo large -width 50 -height 50
+ large put green -to 0 0 50 50
+ }
+ catch {destroy .t .tt}
+ pack [text .t]
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t image create end -image large
+ .t image create end -image small -padx 5 -pady 10
+ .t insert end test
+ update
+ destroy .t .tt
+} {}
+
+# cleanup
catch {destroy .t}
foreach image [image names] {image delete $image}
font delete test_font
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 0337fca..6341b6d 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -7,14 +7,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-
-# Some tests require the testtext command
-testConstraint testtext [llength [info commands testtext]]
+namespace import -force tcltest::test
catch {destroy .t}
text .t -font {Courier -12} -width 20 -height 10
@@ -646,7 +641,7 @@ test textIndex-15.15 {StartEnd} {
list [catch {.t index {2.12 word}} msg] $msg
} {1 {bad text index "2.12 word"}}
-test testIndex-16.1 {TkTextPrintIndex} {
+test textIndex-16.1 {TkTextPrintIndex} {
set t [text .t2]
$t insert end \n
$t window create end -window [button $t.b]
@@ -655,8 +650,7 @@ test testIndex-16.1 {TkTextPrintIndex} {
catch {destroy $t}
} 0
-
-test testIndex-16.2 {TkTextPrintIndex} {
+test textIndex-16.2 {TkTextPrintIndex} {
set t [text .t2]
$t insert end \n
$t window create end -window [button $t.b]
@@ -665,6 +659,231 @@ test testIndex-16.2 {TkTextPrintIndex} {
catch {destroy $t}
} 0
+test textIndex-17.1 {Object indices} {
+ set res {}
+ set t [text .t2 -height 20]
+ for {set i 0} {$i < 100} {incr i} {
+ $t insert end $i\n
+ }
+ pack $t
+ update
+ set idx @0,0
+ lappend res $idx [$t index $idx]
+ $t yview scroll 2 pages
+ lappend res $idx [$t index $idx]
+ catch {destroy $t}
+ unset i
+ unset idx
+ list $res
+} {{@0,0 1.0 @0,0 37.0}}
+
+test textIndex-18.1 {Object indices don't cache mark names} {
+ set res {}
+ text .t2
+ .t2 insert 1.0 1234\n1234\n1234
+ set pos "insert"
+ lappend res [.t2 index $pos]
+ .t2 mark set $pos 3.0
+ lappend res [.t2 index $pos]
+ .t2 mark set $pos 1.0
+ lappend res [.t2 index $pos]
+ catch {destroy .t2}
+ set res
+} {3.4 3.0 1.0}
+
+frame .f -width 100 -height 20
+pack append . .f left
+
+set fixedFont {Courier -12}
+set fixedHeight [font metrics $fixedFont -linespace]
+set fixedWidth [font measure $fixedFont m]
+
+set varFont {Times -14}
+set bigFont {Helvetica -24}
+destroy .t
+text .t -font $fixedFont -width 20 -height 10 -wrap char
+pack append . .t {top expand fill}
+.t tag configure big -font $bigFont
+.t debug on
+wm geometry . {}
+
+# The statements below reset the main window; it's needed if the window
+# manager is mwm to make mwm forget about a previous minimum size setting.
+
+wm withdraw .
+wm minsize . 1 1
+wm positionfrom . user
+wm deiconify .
+update
+
+# Some window managers (like olwm under SunOS 4.1.3) misbehave in a way
+# that tends to march windows off the top and left of the screen. If
+# this happens, some tests will fail because parts of the window will
+# not need to be displayed (because they're off-screen). To keep this
+# from happening, move the window if it's getting near the left or top
+# edges of the screen.
+
+if {([winfo rooty .] < 50) || ([winfo rootx .] < 50)} {
+ wm geom . +50+50
+}
+
+set str [string repeat "hello " 20]
+
+.t insert end "$str one two three four five six seven height nine ten\n"
+.t insert end "$str one two three four five six seven height nine ten\n"
+.t insert end "$str one two three four five six seven height nine ten\n"
+
+test textIndex-19.1 {Display lines} {
+ .t index "2.7 displaylinestart"
+} {2.0}
+
+test textIndex-19.2 {Display lines} {
+ .t index "2.7 displaylineend"
+} {2.19}
+
+test textIndex-19.3 {Display lines} {
+ .t index "2.30 displaylinestart"
+} {2.20}
+
+test textIndex-19.4 {Display lines} {
+ .t index "2.30 displaylineend"
+} {2.39}
+
+test textIndex-19.5 {Display lines} {
+ .t index "2.40 displaylinestart"
+} {2.40}
+
+test textIndex-19.6 {Display lines} {
+ .t index "2.40 displaylineend"
+} {2.59}
+
+test textIndex-19.7 {Display lines} {
+ .t index "2.7 +1displaylines"
+} {2.27}
+
+test textIndex-19.8 {Display lines} {
+ .t index "2.7 -1displaylines"
+} {1.167}
+
+test textIndex-19.9 {Display lines} {
+ .t index "2.30 +1displaylines"
+} {2.50}
+
+test textIndex-19.10 {Display lines} {
+ .t index "2.30 -1displaylines"
+} {2.10}
+
+test textIndex-19.11 {Display lines} {
+ .t index "2.40 +1displaylines"
+} {2.60}
+
+test textIndex-19.12 {Display lines} {
+ .t index "2.40 -1displaylines"
+} {2.20}
+
+test textIndex-19.13 {Display lines} {
+ destroy .t
+ text .txt -height 1 -wrap word -yscroll ".sbar set" -width 400
+ scrollbar .sbar -command ".txt yview"
+ grid .txt .sbar -sticky news
+ grid configure .sbar -sticky ns
+ grid rowconfigure . 0 -weight 1
+ grid columnconfigure . 0 -weight 1
+ .txt configure -width 10
+ .txt tag config STAMP -elide 1
+ .txt tag config NICK-tick -elide 0
+ .txt insert end "+++++ Loading History ++++++++++++++++\n"
+ .txt mark set HISTORY {2.0 - 1 line}
+ .txt insert HISTORY { } STAMP
+ .txt insert HISTORY {tick } {NICK NICK-tick}
+ .txt insert HISTORY "\n" {NICK NICK-tick}
+ .txt insert HISTORY {[23:51] } STAMP
+ .txt insert HISTORY "\n" {NICK NICK-tick}
+ # Must not crash
+ .txt index "2.0 - 2 display lines"
+ destroy .txt .sbar
+} {}
+
+proc text_test_word {startend chars start} {
+ destroy .t
+ text .t
+ .t insert end $chars
+ if {[regexp {end} $start]} {
+ set start [.t index "${start}chars -2c"]
+ } else {
+ set start [.t index "1.0 + ${start}chars"]
+ }
+ if {[.t compare $start >= "end-1c"]} {
+ set start "end-2c"
+ }
+ set res [.t index "$start $startend"]
+ .t count 1.0 $res
+}
+
+# Following tests copied from tests from string wordstart/end in Tcl
+
+test textIndex-21.4 {text index wordend} {
+ text_test_word wordend abc. -1
+} 3
+test textIndex-21.5 {text index wordend} {
+ text_test_word wordend abc. 100
+} 4
+test textIndex-21.6 {text index wordend} {
+ text_test_word wordend "word_one two three" 2
+} 8
+test textIndex-21.7 {text index wordend} {
+ text_test_word wordend "one .&# three" 5
+} 6
+test textIndex-21.8 {text index wordend} {
+ text_test_word worde "x.y" 0
+} 1
+test textIndex-21.9 {text index wordend} {
+ text_test_word worde "x.y" end-1
+} 2
+test textIndex-21.10 {text index wordend, unicode} {
+ text_test_word wordend "xyz\u00c7de fg" 0
+} 6
+test textIndex-21.11 {text index wordend, unicode} {
+ text_test_word wordend "xyz\uc700de fg" 0
+} 6
+test textIndex-21.12 {text index wordend, unicode} {
+ text_test_word wordend "xyz\u203fde fg" 0
+} 6
+test textIndex-21.13 {text index wordend, unicode} {
+ text_test_word wordend "xyz\u2045de fg" 0
+} 3
+test textIndex-21.14 {text index wordend, unicode} {
+ text_test_word wordend "\uc700\uc700 abc" 8
+} 6
+
+test textIndex-22.5 {text index wordstart} {
+ text_test_word wordstart "one two three_words" 400
+} 8
+test textIndex-22.6 {text index wordstart} {
+ text_test_word wordstart "one two three_words" 2
+} 0
+test textIndex-22.7 {text index wordstart} {
+ text_test_word wordstart "one two three_words" -2
+} 0
+test textIndex-22.8 {text index wordstart} {
+ text_test_word wordstart "one .*&^ three" 6
+} 6
+test textIndex-22.9 {text index wordstart} {
+ text_test_word wordstart "one two three" 4
+} 4
+test textIndex-22.10 {text index wordstart} {
+ text_test_word wordstart "one two three" end-5
+} 7
+test textIndex-22.11 {text index wordstart, unicode} {
+ text_test_word wordstart "one tw\u00c7o three" 7
+} 4
+test textIndex-22.12 {text index wordstart, unicode} {
+ text_test_word wordstart "ab\uc700\uc700 cdef ghi" 12
+} 10
+test textIndex-22.13 {text index wordstart, unicode} {
+ text_test_word wordstart "\uc700\uc700 abc" 8
+} 3
+
test textIndex-23.1 {text paragraph start} {
pack [text .t2]
.t2 insert end " Text"
@@ -676,21 +895,19 @@ test textIndex-23.1 {text paragraph start} {
set res
} {2.0 1.1 1.1}
+test textIndex-24.1 {text mark prev} {
+ pack [text .t2]
+ .t2 insert end [string repeat "1 2 3 4 5 6 7 8 9 0\n" 12]
+ .t2 mark set 1.0 10.0
+ update
+ # then this crash Tk:
+ set res [.t2 mark previous 10.10]
+ destroy .t2
+ set res
+} {1.0}
+
# cleanup
rename textimage {}
catch {destroy .t}
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/textMark.test b/tests/textMark.test
index a95edd0..c2810cc 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -7,16 +7,14 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
catch {destroy .t}
-testConstraint courier12 [expr {[catch {
- text .t -font {Courier 12} -width 20 -height 10
- }] == 0}]
+text .t -width 20 -height 10
+testConstraint haveCourier12 [expr {[catch {
+ .t configure -font {Courier 12}
+}] == 0}]
pack append . .t {top expand fill}
update
.t debug on
@@ -39,83 +37,83 @@ bOy GIrl .#@? x_yz
!@#$%
Line 7"
-test textMark-1.1 {TkTextMarkCmd - missing option} courier12 {
+test textMark-1.1 {TkTextMarkCmd - missing option} haveCourier12 {
list [catch {.t mark} msg] $msg
} {1 {wrong # args: should be ".t mark option ?arg arg ...?"}}
-test textMark-1.2 {TkTextMarkCmd - bogus option} courier12 {
+test textMark-1.2 {TkTextMarkCmd - bogus option} haveCourier12 {
list [catch {.t mark gorp} msg] $msg
} {1 {bad mark option "gorp": must be gravity, names, next, previous, set, or unset}}
-test textMark-1.3 {TkTextMarkCmd - "gravity" option} courier12 {
+test textMark-1.3 {TkTextMarkCmd - "gravity" option} haveCourier12 {
list [catch {.t mark gravity foo} msg] $msg
} {1 {there is no mark named "foo"}}
-test textMark-1.4 {TkTextMarkCmd - "gravity" option} courier12 {
+test textMark-1.4 {TkTextMarkCmd - "gravity" option} haveCourier12 {
.t mark unset x
.t mark set x 1.3
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} {right 1.4}
-test textMark-1.5 {TkTextMarkCmd - "gravity" option} courier12 {
+test textMark-1.5 {TkTextMarkCmd - "gravity" option} haveCourier12 {
.t mark unset x
.t mark set x 1.3
.t mark g x left
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} {left 1.3}
-test textMark-1.6 {TkTextMarkCmd - "gravity" option} courier12 {
+test textMark-1.6 {TkTextMarkCmd - "gravity" option} haveCourier12 {
.t mark unset x
.t mark set x 1.3
.t mark gravity x right
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} {right 1.4}
-test textMark-1.7 {TkTextMarkCmd - "gravity" option} courier12 {
+test textMark-1.7 {TkTextMarkCmd - "gravity" option} haveCourier12 {
list [catch {.t mark gravity x gorp} msg] $msg
} {1 {bad mark gravity "gorp": must be left or right}}
-test textMark-1.8 {TkTextMarkCmd - "gravity" option} courier12 {
+test textMark-1.8 {TkTextMarkCmd - "gravity" option} haveCourier12 {
list [catch {.t mark gravity} msg] $msg
} {1 {wrong # args: should be ".t mark gravity markName ?gravity?"}}
-test textMark-2.1 {TkTextMarkCmd - "names" option} courier12 {
+test textMark-2.1 {TkTextMarkCmd - "names" option} haveCourier12 {
list [catch {.t mark names 2} msg] $msg
} {1 {wrong # args: should be ".t mark names"}}
.t mark unset x
-test textMark-2.2 {TkTextMarkCmd - "names" option} courier12 {
- lsort [.t mark n]
+test textMark-2.2 {TkTextMarkCmd - "names" option} haveCourier12 {
+ lsort [.t mark na]
} {current insert}
-test textMark-2.3 {TkTextMarkCmd - "names" option} courier12 {
+test textMark-2.3 {TkTextMarkCmd - "names" option} haveCourier12 {
.t mark set a 1.1
.t mark set "b c" 2.3
lsort [.t mark names]
} {a {b c} current insert}
-test textMark-3.1 {TkTextMarkCmd - "set" option} courier12 {
+test textMark-3.1 {TkTextMarkCmd - "set" option} haveCourier12 {
list [catch {.t mark set a} msg] $msg
} {1 {wrong # args: should be ".t mark set markName index"}}
-test textMark-3.2 {TkTextMarkCmd - "set" option} courier12 {
+test textMark-3.2 {TkTextMarkCmd - "set" option} haveCourier12 {
list [catch {.t mark s a b c} msg] $msg
} {1 {wrong # args: should be ".t mark set markName index"}}
-test textMark-3.3 {TkTextMarkCmd - "set" option} courier12 {
+test textMark-3.3 {TkTextMarkCmd - "set" option} haveCourier12 {
list [catch {.t mark set a @x} msg] $msg
} {1 {bad text index "@x"}}
-test textMark-3.4 {TkTextMarkCmd - "set" option} courier12 {
+test textMark-3.4 {TkTextMarkCmd - "set" option} haveCourier12 {
.t mark set a 1.2
.t index a
} 1.2
-test textMark-3.5 {TkTextMarkCmd - "set" option} courier12 {
+test textMark-3.5 {TkTextMarkCmd - "set" option} haveCourier12 {
.t mark set a end
.t index a
} {8.0}
-test textMark-4.1 {TkTextMarkCmd - "unset" option} courier12 {
+test textMark-4.1 {TkTextMarkCmd - "unset" option} haveCourier12 {
list [catch {.t mark unset} msg] $msg
} {0 {}}
-test textMark-4.2 {TkTextMarkCmd - "unset" option} courier12 {
+test textMark-4.2 {TkTextMarkCmd - "unset" option} haveCourier12 {
.t mark set a 1.2
.t mark set b 2.3
.t mark unset a b
list [catch {.t index a} msg] $msg [catch {.t index b} msg2] $msg2
} {1 {bad text index "a"} 1 {bad text index "b"}}
-test textMark-4.3 {TkTextMarkCmd - "unset" option} courier12 {
+test textMark-4.3 {TkTextMarkCmd - "unset" option} haveCourier12 {
.t mark set a 1.2
.t mark set b 2.3
.t mark set 49ers 3.1
@@ -123,14 +121,14 @@ test textMark-4.3 {TkTextMarkCmd - "unset" option} courier12 {
lsort [.t mark names]
} {current insert}
-test textMark-5.1 {TkTextMarkCmd - miscellaneous} courier12 {
+test textMark-5.1 {TkTextMarkCmd - miscellaneous} haveCourier12 {
list [catch {.t mark} msg] $msg
} {1 {wrong # args: should be ".t mark option ?arg arg ...?"}}
-test textMark-5.2 {TkTextMarkCmd - miscellaneous} courier12 {
+test textMark-5.2 {TkTextMarkCmd - miscellaneous} haveCourier12 {
list [catch {.t mark foo} msg] $msg
} {1 {bad mark option "foo": must be gravity, names, next, previous, set, or unset}}
-test textMark-6.1 {TkTextMarkSegToIndex} courier12 {
+test textMark-6.1 {TkTextMarkSegToIndex} haveCourier12 {
.t mark set a 1.2
.t mark set b 1.2
.t mark set c 1.2
@@ -139,79 +137,79 @@ test textMark-6.1 {TkTextMarkSegToIndex} courier12 {
} {1.2 1.2 1.2 1.4}
catch {eval {.t mark unset} [.t mark names]}
-test textMark-7.1 {MarkFindNext - invalid mark name} courier12 {
+test textMark-7.1 {MarkFindNext - invalid mark name} haveCourier12 {
catch {.t mark next bogus} x
set x
} {bad text index "bogus"}
-test textMark-7.2 {MarkFindNext - marks at same location} courier12 {
+test textMark-7.2 {MarkFindNext - marks at same location} haveCourier12 {
.t mark set insert 2.0
.t mark set current 2.0
.t mark next current
} {insert}
-test textMark-7.3 {MarkFindNext - numerical starting mark} courier12 {
+test textMark-7.3 {MarkFindNext - numerical starting mark} haveCourier12 {
.t mark set current 1.0
.t mark set insert 1.0
.t mark next 1.0
} {insert}
-test textMark-7.4 {MarkFindNext - mark on the same line} courier12 {
+test textMark-7.4 {MarkFindNext - mark on the same line} haveCourier12 {
.t mark set current 1.0
.t mark set insert 1.1
.t mark next current
} {insert}
-test textMark-7.5 {MarkFindNext - mark on the next line} courier12 {
+test textMark-7.5 {MarkFindNext - mark on the next line} haveCourier12 {
.t mark set current 1.end
.t mark set insert 2.0
.t mark next current
} {insert}
-test textMark-7.6 {MarkFindNext - mark far away} courier12 {
+test textMark-7.6 {MarkFindNext - mark far away} haveCourier12 {
.t mark set current 1.2
.t mark set insert 7.0
.t mark next current
} {insert}
-test textMark-7.7 {MarkFindNext - mark on top of end} courier12 {
+test textMark-7.7 {MarkFindNext - mark on top of end} haveCourier12 {
.t mark set current end
.t mark next end
} {current}
-test textMark-7.8 {MarkFindNext - no next mark} courier12 {
+test textMark-7.8 {MarkFindNext - no next mark} haveCourier12 {
.t mark set current 1.0
.t mark set insert 3.0
.t mark next insert
} {}
-test textMark-8.1 {MarkFindPrev - invalid mark name} courier12 {
+test textMark-8.1 {MarkFindPrev - invalid mark name} haveCourier12 {
catch {.t mark prev bogus} x
set x
} {bad text index "bogus"}
-test textMark-8.2 {MarkFindPrev - marks at same location} courier12 {
+test textMark-8.2 {MarkFindPrev - marks at same location} haveCourier12 {
.t mark set insert 2.0
.t mark set current 2.0
.t mark prev insert
} {current}
-test textMark-8.3 {MarkFindPrev - numerical starting mark} courier12 {
+test textMark-8.3 {MarkFindPrev - numerical starting mark} haveCourier12 {
.t mark set current 1.0
.t mark set insert 1.0
.t mark prev 1.1
} {current}
-test textMark-8.4 {MarkFindPrev - mark on the same line} courier12 {
+test textMark-8.4 {MarkFindPrev - mark on the same line} haveCourier12 {
.t mark set current 1.0
.t mark set insert 1.1
.t mark prev insert
} {current}
-test textMark-8.5 {MarkFindPrev - mark on the previous line} courier12 {
+test textMark-8.5 {MarkFindPrev - mark on the previous line} haveCourier12 {
.t mark set current 1.end
.t mark set insert 2.0
.t mark prev insert
} {current}
-test textMark-8.6 {MarkFindPrev - mark far away} courier12 {
+test textMark-8.6 {MarkFindPrev - mark far away} haveCourier12 {
.t mark set current 1.2
.t mark set insert 7.0
.t mark prev insert
} {current}
-test textMark-8.7 {MarkFindPrev - mark on top of end} courier12 {
+test textMark-8.7 {MarkFindPrev - mark on top of end} haveCourier12 {
.t mark set insert 3.0
.t mark set current end
.t mark prev end
} {insert}
-test textMark-8.8 {MarkFindPrev - no previous mark} courier12 {
+test textMark-8.8 {MarkFindPrev - no previous mark} haveCourier12 {
.t mark set current 1.0
.t mark set insert 3.0
.t mark prev current
@@ -220,18 +218,5 @@ test textMark-8.8 {MarkFindPrev - no previous mark} courier12 {
catch {destroy .t}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/textTag.test b/tests/textTag.test
index fc4ed04..b112fc2 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -7,17 +7,15 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
+namespace import -force tcltest::test
catch {destroy .t}
-testConstraint courier12 [expr {[catch {
- text .t -font {Courier 12} -width 20 -height 10
- }] == 0}]
-
+text .t -width 20 -height 10
+testConstraint haveCourier12 [expr {[catch {
+ .t configure -font {Courier 12}
+}] == 0}]
pack append . .t {top expand fill}
update
.t debug on
@@ -84,219 +82,219 @@ foreach test {
{expected boolean value but got "stupid"}}
} {
set name [lindex $test 0]
- test textTag-1.$i {tag configuration options} courier12 {
+ test textTag-1.$i {tag configuration options} haveCourier12 {
.t tag configure x $name [lindex $test 1]
.t tag cget x $name
} [lindex $test 2]
incr i
if {[lindex $test 3] != ""} {
- test textTag-1.$i {configuration options} courier12 {
+ test textTag-1.$i {configuration options} haveCourier12 {
list [catch {.t tag configure x $name [lindex $test 3]} msg] $msg
} [list 1 [lindex $test 4]]
}
.t tag configure x $name [lindex [.t tag configure x $name] 3]
incr i
}
-test textTag-2.1 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.1 {TkTextTagCmd - "add" option} haveCourier12 {
list [catch {.t tag} msg] $msg
} {1 {wrong # args: should be ".t tag option ?arg arg ...?"}}
-test textTag-2.2 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.2 {TkTextTagCmd - "add" option} haveCourier12 {
list [catch {.t tag gorp} msg] $msg
-} {1 {bad tag option "gorp": must be add, bind, cget, configure, delete, lower, names, nextrange, raise, ranges, or remove}}
-test textTag-2.3 {TkTextTagCmd - "add" option} courier12 {
+} {1 {bad tag option "gorp": must be add, bind, cget, configure, delete, lower, names, nextrange, prevrange, raise, ranges, or remove}}
+test textTag-2.3 {TkTextTagCmd - "add" option} haveCourier12 {
list [catch {.t tag add foo} msg] $msg
} {1 {wrong # args: should be ".t tag add tagName index1 ?index2 index1 index2 ...?"}}
-test textTag-2.4 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.4 {TkTextTagCmd - "add" option} haveCourier12 {
list [catch {.t tag add x gorp} msg] $msg
} {1 {bad text index "gorp"}}
-test textTag-2.5 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.5 {TkTextTagCmd - "add" option} haveCourier12 {
list [catch {.t tag add x 1.2 gorp} msg] $msg
} {1 {bad text index "gorp"}}
-test textTag-2.6 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.6 {TkTextTagCmd - "add" option} haveCourier12 {
.t tag add sel 3.2 3.4
.t tag add sel 3.2 3.0
.t tag ranges sel
} {3.2 3.4}
-test textTag-2.7 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.7 {TkTextTagCmd - "add" option} haveCourier12 {
.t tag add x 1.0 1.end
.t tag ranges x
} {1.0 1.6}
-test textTag-2.8 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.8 {TkTextTagCmd - "add" option} haveCourier12 {
.t tag remove x 1.0 end
.t tag add x 1.2
.t tag ranges x
} {1.2 1.3}
-test textTag-2.9 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.9 {TkTextTagCmd - "add" option} haveCourier12 {
.t.e select from 0
.t.e select to 4
.t tag add sel 3.2 3.4
selection get
} 34
-test textTag-2.11 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.11 {TkTextTagCmd - "add" option} haveCourier12 {
.t.e select from 0
.t.e select to 4
.t configure -exportselection 0
.t tag add sel 3.2 3.4
selection get
} Text
-test textTag-2.12 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.12 {TkTextTagCmd - "add" option} haveCourier12 {
.t tag remove sel 1.0 end
.t tag add sel 1.1 1.5 2.4 3.1 4.2 4.4
.t tag ranges sel
} {1.1 1.5 2.4 3.1 4.2 4.4}
-test textTag-2.13 {TkTextTagCmd - "add" option} courier12 {
+test textTag-2.13 {TkTextTagCmd - "add" option} haveCourier12 {
.t tag remove sel 1.0 end
.t tag add sel 1.1 1.5 2.4
.t tag ranges sel
} {1.1 1.5 2.4 2.5}
catch {.t tag delete x}
-test textTag-3.1 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.1 {TkTextTagCmd - "bind" option} haveCourier12 {
list [catch {.t tag bind} msg] $msg
} {1 {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}}
-test textTag-3.2 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.2 {TkTextTagCmd - "bind" option} haveCourier12 {
list [catch {.t tag bind 1 2 3 4} msg] $msg
} {1 {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}}
-test textTag-3.3 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.3 {TkTextTagCmd - "bind" option} haveCourier12 {
.t tag bind x <Enter> script1
.t tag bind x <Enter>
} script1
-test textTag-3.4 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.4 {TkTextTagCmd - "bind" option} haveCourier12 {
list [catch {.t tag bind x <Gorp> script2} msg] $msg
} {1 {bad event type or keysym "Gorp"}}
-test textTag-3.5 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.5 {TkTextTagCmd - "bind" option} haveCourier12 {
.t tag delete x
.t tag bind x <Enter> script1
list [catch {.t tag bind x <FocusIn> script2} msg] $msg [.t tag bind x]
} {1 {requested illegal events; only key, button, motion, enter, leave, and virtual events may be used} <Enter>}
-test textTag-3.6 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.6 {TkTextTagCmd - "bind" option} haveCourier12 {
.t tag delete x
.t tag bind x <Enter> script1
.t tag bind x <Leave> script2
.t tag bind x a xyzzy
list [lsort [.t tag bind x]] [.t tag bind x <Enter>] [.t tag bind x a]
} {{<Enter> <Leave> a} script1 xyzzy}
-test textTag-3.7 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.7 {TkTextTagCmd - "bind" option} haveCourier12 {
.t tag delete x
.t tag bind x <Enter> script1
.t tag bind x <Enter> +script2
.t tag bind x <Enter>
} {script1
script2}
-test textTag-3.7 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.7a {TkTextTagCmd - "bind" option} haveCourier12 {
.t tag delete x
list [catch {.t tag bind x <Enter>} msg] $msg
} {0 {}}
-test textTag-3.8 {TkTextTagCmd - "bind" option} courier12 {
+test textTag-3.8 {TkTextTagCmd - "bind" option} haveCourier12 {
.t tag delete x
list [catch {.t tag bind x <} msg] $msg
} {1 {no event type or button # or keysym}}
-test textTag-4.1 {TkTextTagCmd - "cget" option} courier12 {
+test textTag-4.1 {TkTextTagCmd - "cget" option} haveCourier12 {
list [catch {.t tag cget a} msg] $msg
} {1 {wrong # args: should be ".t tag cget tagName option"}}
-test textTag-4.2 {TkTextTagCmd - "cget" option} courier12 {
+test textTag-4.2 {TkTextTagCmd - "cget" option} haveCourier12 {
list [catch {.t tag cget a b c} msg] $msg
} {1 {wrong # args: should be ".t tag cget tagName option"}}
-test textTag-4.3 {TkTextTagCmd - "cget" option} courier12 {
+test textTag-4.3 {TkTextTagCmd - "cget" option} haveCourier12 {
.t tag delete foo
list [catch {.t tag cget foo bar} msg] $msg
} {1 {tag "foo" isn't defined in text widget}}
-test textTag-4.4 {TkTextTagCmd - "cget" option} courier12 {
+test textTag-4.4 {TkTextTagCmd - "cget" option} haveCourier12 {
list [catch {.t tag cget sel bogus} msg] $msg
} {1 {unknown option "bogus"}}
-test textTag-4.5 {TkTextTagCmd - "cget" option} courier12 {
+test textTag-4.5 {TkTextTagCmd - "cget" option} haveCourier12 {
.t tag delete x
.t tag configure x -background red
list [catch {.t tag cget x -background} msg] $msg
} {0 red}
-test textTag-5.1 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.1 {TkTextTagCmd - "configure" option} haveCourier12 {
list [catch {.t tag configure} msg] $msg
} {1 {wrong # args: should be ".t tag configure tagName ?option? ?value? ?option value ...?"}}
-test textTag-5.2 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.2 {TkTextTagCmd - "configure" option} haveCourier12 {
list [catch {.t tag configure x -foo} msg] $msg
} {1 {unknown option "-foo"}}
-test textTag-5.3 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.3 {TkTextTagCmd - "configure" option} haveCourier12 {
list [catch {.t tag configure x -background red -underline} msg] $msg
} {1 {value for "-underline" missing}}
-test textTag-5.4 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.4 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
.t tag configure x -underline yes
.t tag configure x -underline
} {-underline {} {} {} yes}
-test textTag-5.5 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.5 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
.t tag configure x -overstrike on
.t tag cget x -overstrike
} {on}
-test textTag-5.6 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.6 {TkTextTagCmd - "configure" option} haveCourier12 {
list [catch {.t tag configure x -overstrike foo} msg] $msg
} {1 {expected boolean value but got "foo"}}
-test textTag-5.7 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.7 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -underline stupid} msg] $msg
} {1 {expected boolean value but got "stupid"}}
-test textTag-5.8 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.8 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
.t tag configure x -justify left
.t tag configure x -justify
} {-justify {} {} {} left}
-test textTag-5.9 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.9 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -justify bogus} msg] $msg
} {1 {bad justification "bogus": must be left, right, or center}}
-test textTag-5.10 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.10 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -justify fill} msg] $msg
} {1 {bad justification "fill": must be left, right, or center}}
-test textTag-5.11 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.11 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
.t tag configure x -offset 2
.t tag configure x -offset
} {-offset {} {} {} 2}
-test textTag-5.12 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.12 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -offset 1.0q} msg] $msg
} {1 {bad screen distance "1.0q"}}
-test textTag-5.13 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.13 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
.t tag configure x -lmargin1 2 -lmargin2 4 -rmargin 5
list [.t tag configure x -lmargin1] [.t tag configure x -lmargin2] \
[.t tag configure x -rmargin]
} {{-lmargin1 {} {} {} 2} {-lmargin2 {} {} {} 4} {-rmargin {} {} {} 5}}
-test textTag-5.14 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.14 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -lmargin1 2.0x} msg] $msg
} {1 {bad screen distance "2.0x"}}
-test textTag-5.15 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.15 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -lmargin2 gorp} msg] $msg
} {1 {bad screen distance "gorp"}}
-test textTag-5.16 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.16 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -rmargin 140.1.1} msg] $msg
} {1 {bad screen distance "140.1.1"}}
.t tag delete x
-test textTag-5.17 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.17 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
.t tag configure x -spacing1 2 -spacing2 4 -spacing3 6
list [.t tag configure x -spacing1] [.t tag configure x -spacing2] \
[.t tag configure x -spacing3]
} {{-spacing1 {} {} {} 2} {-spacing2 {} {} {} 4} {-spacing3 {} {} {} 6}}
-test textTag-5.18 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.18 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -spacing1 2.0x} msg] $msg
} {1 {bad screen distance "2.0x"}}
-test textTag-5.19 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.19 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -spacing1 lousy} msg] $msg
} {1 {bad screen distance "lousy"}}
-test textTag-5.20 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.20 {TkTextTagCmd - "configure" option} haveCourier12 {
.t tag delete x
list [catch {.t tag configure x -spacing1 4.2.3} msg] $msg
} {1 {bad screen distance "4.2.3"}}
-test textTag-5.21 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.21 {TkTextTagCmd - "configure" option} haveCourier12 {
.t configure -selectborderwidth 2 -selectforeground blue \
-selectbackground black
.t tag configure sel -borderwidth 4 -foreground green -background yellow
@@ -306,19 +304,19 @@ test textTag-5.21 {TkTextTagCmd - "configure" option} courier12 {
}
set x
} {4 green yellow}
-test textTag-5.22 {TkTextTagCmd - "configure" option} courier12 {
+test textTag-5.22 {TkTextTagCmd - "configure" option} haveCourier12 {
.t configure -selectborderwidth 20
.t tag configure sel -borderwidth {}
.t cget -selectborderwidth
} {}
-test textTag-6.1 {TkTextTagCmd - "delete" option} courier12 {
+test textTag-6.1 {TkTextTagCmd - "delete" option} haveCourier12 {
list [catch {.t tag delete} msg] $msg
-} {1 {wrong # args: should be ".t tag delete tagName tagName ..."}}
-test textTag-6.2 {TkTextTagCmd - "delete" option} courier12 {
+} {1 {wrong # args: should be ".t tag delete tagName ?tagName ...?"}}
+test textTag-6.2 {TkTextTagCmd - "delete" option} haveCourier12 {
list [catch {.t tag delete zork} msg] $msg
} {0 {}}
-test textTag-6.3 {TkTextTagCmd - "delete" option} courier12 {
+test textTag-6.3 {TkTextTagCmd - "delete" option} haveCourier12 {
.t tag delete x
.t tag config x -background black
.t tag config y -foreground white
@@ -326,14 +324,14 @@ test textTag-6.3 {TkTextTagCmd - "delete" option} courier12 {
.t tag delete y z
lsort [.t tag names]
} {sel x}
-test textTag-6.4 {TkTextTagCmd - "delete" option} courier12 {
+test textTag-6.4 {TkTextTagCmd - "delete" option} haveCourier12 {
.t tag config x -background black
.t tag config y -foreground white
.t tag config z -background black
eval .t tag delete [.t tag names]
.t tag names
} {sel}
-test textTag-6.5 {TkTextTagCmd - "delete" option} courier12 {
+test textTag-6.5 {TkTextTagCmd - "delete" option} haveCourier12 {
.t tag bind x <Enter> foo
.t tag delete x
.t tag configure x -background black
@@ -347,39 +345,39 @@ proc tagsetup {} {
.t tag configure $i -background black
}
}
-test textTag-7.1 {TkTextTagCmd - "lower" option} courier12 {
+test textTag-7.1 {TkTextTagCmd - "lower" option} haveCourier12 {
list [catch {.t tag lower} msg] $msg
} {1 {wrong # args: should be ".t tag lower tagName ?belowThis?"}}
-test textTag-7.2 {TkTextTagCmd - "lower" option} courier12 {
+test textTag-7.2 {TkTextTagCmd - "lower" option} haveCourier12 {
list [catch {.t tag lower foo} msg] $msg
} {1 {tag "foo" isn't defined in text widget}}
-test textTag-7.3 {TkTextTagCmd - "lower" option} courier12 {
+test textTag-7.3 {TkTextTagCmd - "lower" option} haveCourier12 {
list [catch {.t tag lower sel bar} msg] $msg
} {1 {tag "bar" isn't defined in text widget}}
-test textTag-7.4 {TkTextTagCmd - "lower" option} courier12 {
+test textTag-7.4 {TkTextTagCmd - "lower" option} haveCourier12 {
tagsetup
.t tag lower c
.t tag names
} {c sel a b d}
-test textTag-7.5 {TkTextTagCmd - "lower" option} courier12 {
+test textTag-7.5 {TkTextTagCmd - "lower" option} haveCourier12 {
tagsetup
.t tag lower d b
.t tag names
} {sel a d b c}
-test textTag-7.6 {TkTextTagCmd - "lower" option} courier12 {
+test textTag-7.6 {TkTextTagCmd - "lower" option} haveCourier12 {
tagsetup
.t tag lower a c
.t tag names
} {sel b a c d}
-test textTag-8.1 {TkTextTagCmd - "names" option} courier12 {
+test textTag-8.1 {TkTextTagCmd - "names" option} haveCourier12 {
list [catch {.t tag names a b} msg] $msg
} {1 {wrong # args: should be ".t tag names ?index?"}}
-test textTag-8.2 {TkTextTagCmd - "names" option} courier12 {
+test textTag-8.2 {TkTextTagCmd - "names" option} haveCourier12 {
tagsetup
.t tag names
} {sel a b c d}
-test textTag-8.3 {TkTextTagCmd - "names" option} courier12 {
+test textTag-8.3 {TkTextTagCmd - "names" option} haveCourier12 {
tagsetup
.t tag add "a b" 2.1 2.6
.t tag add c 2.4 2.7
@@ -390,148 +388,148 @@ test textTag-8.3 {TkTextTagCmd - "names" option} courier12 {
.t tag add x 2.3 2.5
.t tag add x 2.9 3.1
.t tag add x 7.2
-test textTag-9.1 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.1 {TkTextTagCmd - "nextrange" option} haveCourier12 {
list [catch {.t tag nextrange x} msg] $msg
} {1 {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}}
-test textTag-9.2 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.2 {TkTextTagCmd - "nextrange" option} haveCourier12 {
list [catch {.t tag nextrange x 1 2 3} msg] $msg
} {1 {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}}
-test textTag-9.3 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.3 {TkTextTagCmd - "nextrange" option} haveCourier12 {
list [catch {.t tag nextrange foo 1.0} msg] $msg
} {0 {}}
-test textTag-9.4 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.4 {TkTextTagCmd - "nextrange" option} haveCourier12 {
list [catch {.t tag nextrange x foo} msg] $msg
} {1 {bad text index "foo"}}
-test textTag-9.5 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.5 {TkTextTagCmd - "nextrange" option} haveCourier12 {
list [catch {.t tag nextrange x 1.0 bar} msg] $msg
} {1 {bad text index "bar"}}
-test textTag-9.6 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.6 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 1.0
} {2.3 2.5}
-test textTag-9.7 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.7 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 2.2
} {2.3 2.5}
-test textTag-9.8 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.8 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 2.3
} {2.3 2.5}
-test textTag-9.9 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.9 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 2.4
} {2.9 3.1}
-test textTag-9.10 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.10 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 2.4 2.9
} {}
-test textTag-9.11 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.11 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 2.4 2.10
} {2.9 3.1}
-test textTag-9.12 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.12 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 2.4 2.11
} {2.9 3.1}
-test textTag-9.13 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.13 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 7.0
} {7.2 7.3}
-test textTag-9.14 {TkTextTagCmd - "nextrange" option} courier12 {
+test textTag-9.14 {TkTextTagCmd - "nextrange" option} haveCourier12 {
.t tag nextrange x 7.3
} {}
-test textTag-10.1 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.1 {TkTextTagCmd - "prevrange" option} haveCourier12 {
list [catch {.t tag prevrange x} msg] $msg
} {1 {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"}}
-test textTag-10.2 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.2 {TkTextTagCmd - "prevrange" option} haveCourier12 {
list [catch {.t tag prevrange x 1 2 3} msg] $msg
} {1 {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"}}
-test textTag-10.3 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.3 {TkTextTagCmd - "prevrange" option} haveCourier12 {
list [catch {.t tag prevrange foo end} msg] $msg
} {0 {}}
-test textTag-10.4 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.4 {TkTextTagCmd - "prevrange" option} haveCourier12 {
list [catch {.t tag prevrange x foo} msg] $msg
} {1 {bad text index "foo"}}
-test textTag-10.5 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.5 {TkTextTagCmd - "prevrange" option} haveCourier12 {
list [catch {.t tag prevrange x end bar} msg] $msg
} {1 {bad text index "bar"}}
-test textTag-10.6 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.6 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x end
} {7.2 7.3}
-test textTag-10.7 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.7 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 2.4
} {2.3 2.5}
-test textTag-10.8 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.8 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 2.5
} {2.3 2.5}
-test textTag-10.9 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.9 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 2.9
} {2.3 2.5}
-test textTag-10.10 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.10 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 2.9 2.6
} {}
-test textTag-10.11 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.11 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 2.9 2.5
} {}
-test textTag-10.12 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.12 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 2.9 2.3
} {2.3 2.5}
-test textTag-10.13 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.13 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 7.0
} {2.9 3.1}
-test textTag-10.14 {TkTextTagCmd - "prevrange" option} courier12 {
+test textTag-10.14 {TkTextTagCmd - "prevrange" option} haveCourier12 {
.t tag prevrange x 2.3
} {}
-test textTag-11.1 {TkTextTagCmd - "raise" option} courier12 {
+test textTag-11.1 {TkTextTagCmd - "raise" option} haveCourier12 {
list [catch {.t tag raise} msg] $msg
} {1 {wrong # args: should be ".t tag raise tagName ?aboveThis?"}}
-test textTag-11.2 {TkTextTagCmd - "raise" option} courier12 {
+test textTag-11.2 {TkTextTagCmd - "raise" option} haveCourier12 {
list [catch {.t tag raise foo} msg] $msg
} {1 {tag "foo" isn't defined in text widget}}
-test textTag-11.3 {TkTextTagCmd - "raise" option} courier12 {
+test textTag-11.3 {TkTextTagCmd - "raise" option} haveCourier12 {
list [catch {.t tag raise sel bar} msg] $msg
} {1 {tag "bar" isn't defined in text widget}}
-test textTag-11.4 {TkTextTagCmd - "raise" option} courier12 {
+test textTag-11.4 {TkTextTagCmd - "raise" option} haveCourier12 {
tagsetup
.t tag raise c
.t tag names
} {sel a b d c}
-test textTag-11.5 {TkTextTagCmd - "raise" option} courier12 {
+test textTag-11.5 {TkTextTagCmd - "raise" option} haveCourier12 {
tagsetup
.t tag raise d b
.t tag names
} {sel a b d c}
-test textTag-11.6 {TkTextTagCmd - "raise" option} courier12 {
+test textTag-11.6 {TkTextTagCmd - "raise" option} haveCourier12 {
tagsetup
.t tag raise a c
.t tag names
} {sel b c a d}
-test textTag-12.1 {TkTextTagCmd - "ranges" option} courier12 {
+test textTag-12.1 {TkTextTagCmd - "ranges" option} haveCourier12 {
list [catch {.t tag ranges} msg] $msg
} {1 {wrong # args: should be ".t tag ranges tagName"}}
-test textTag-12.2 {TkTextTagCmd - "ranges" option} courier12 {
+test textTag-12.2 {TkTextTagCmd - "ranges" option} haveCourier12 {
.t tag delete x
.t tag ranges x
} {}
-test textTag-12.3 {TkTextTagCmd - "ranges" option} courier12 {
+test textTag-12.3 {TkTextTagCmd - "ranges" option} haveCourier12 {
.t tag delete x
.t tag add x 2.2
.t tag add x 2.7 4.15
.t tag add x 5.2 5.5
.t tag ranges x
} {2.2 2.3 2.7 4.6 5.2 5.5}
-test textTag-12.4 {TkTextTagCmd - "ranges" option} courier12 {
+test textTag-12.4 {TkTextTagCmd - "ranges" option} haveCourier12 {
.t tag delete x
.t tag add x 1.0 3.0
.t tag add x 4.0 end
.t tag ranges x
} {1.0 3.0 4.0 8.0}
-test textTag-13.1 {TkTextTagCmd - "remove" option} courier12 {
+test textTag-13.1 {TkTextTagCmd - "remove" option} haveCourier12 {
list [catch {.t tag remove} msg] $msg
} {1 {wrong # args: should be ".t tag remove tagName index1 ?index2 index1 index2 ...?"}}
-test textTag-13.2 {TkTextTagCmd - "remove" option} courier12 {
+test textTag-13.2 {TkTextTagCmd - "remove" option} haveCourier12 {
.t tag delete x
.t tag add x 2.2 2.11
.t tag remove x 2.3 2.7
.t tag ranges x
} {2.2 2.3 2.7 2.11}
-test textTag-13.3 {TkTextTagCmd - "remove" option} courier12 {
+test textTag-13.3 {TkTextTagCmd - "remove" option} haveCourier12 {
.t configure -exportselection 1
.t tag remove sel 1.0 end
.t tag add sel 2.4 3.3
@@ -541,14 +539,14 @@ test textTag-13.3 {TkTextTagCmd - "remove" option} courier12 {
} Text
.t tag delete x a b c d
-test textTag-14.1 {SortTags} courier12 {
+test textTag-14.1 {SortTags} haveCourier12 {
foreach i {a b c d} {
.t tag add $i 2.0 2.2
}
.t tag names 2.1
} {a b c d}
.t tag delete a b c d
-test textTag-14.2 {SortTags} courier12 {
+test textTag-14.2 {SortTags} haveCourier12 {
foreach i {a b c d} {
.t tag configure $i -background black
}
@@ -558,13 +556,13 @@ test textTag-14.2 {SortTags} courier12 {
.t tag names 2.1
} {a b c d}
.t tag delete x a b c d
-test textTag-14.3 {SortTags} courier12 {
+test textTag-14.3 {SortTags} haveCourier12 {
for {set i 0} {$i < 30} {incr i} {
.t tag add x$i 2.0 2.2
}
.t tag names 2.1
} {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}
-test textTag-14.4 {SortTags} courier12 {
+test textTag-14.4 {SortTags} haveCourier12 {
for {set i 0} {$i < 30} {incr i} {
.t tag configure x$i -background black
}
@@ -587,7 +585,7 @@ set c [.t bbox 4.3]
set x3 [expr [lindex $c 0] + [lindex $c 2]/2]
set y3 [expr [lindex $c 1] + [lindex $c 3]/2]
-test textTag-15.1 {TkTextBindProc} courier12 {
+test textTag-15.1 {TkTextBindProc} haveCourier12 {
bind .t <ButtonRelease> {lappend x up}
.t tag bind x <ButtonRelease> {lappend x x-up}
.t tag bind y <ButtonRelease> {lappend x y-up}
@@ -606,7 +604,7 @@ test textTag-15.1 {TkTextBindProc} courier12 {
bind .t <ButtonRelease> {}
set x
} {x-up up up y-up up}
-test textTag-15.2 {TkTextBindProc} courier12 {
+test textTag-15.2 {TkTextBindProc} haveCourier12 {
catch {.t tag delete x}
catch {.t tag delete y}
.t tag bind x <Enter> {lappend x x-enter}
@@ -630,7 +628,7 @@ test textTag-15.2 {TkTextBindProc} courier12 {
event gen .t <ButtonRelease> -x $x3 -y $y3
set x
} {x-enter | x-down | | x-up x-leave y-enter}
-test textTag-15.3 {TkTextBindProc} courier12 {
+test textTag-15.3 {TkTextBindProc} haveCourier12 {
catch {.t tag delete x}
catch {.t tag delete y}
.t tag bind x <Enter> {lappend x x-enter}
@@ -663,7 +661,7 @@ foreach tag [.t tag names] {
catch {.t tag delete $tag}
}
.t tag configure big -font $bigFont
-test textTag-16.1 {TkTextPickCurrent procedure} courier12 {
+test textTag-16.1 {TkTextPickCurrent procedure} haveCourier12 {
event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
set x [.t index current]
event gen .t <Motion> -x $x2 -y $y2
@@ -679,7 +677,7 @@ test textTag-16.1 {TkTextPickCurrent procedure} courier12 {
event gen .t <ButtonRelease-1> -state 0x100 -x $x3 -y $y3
lappend x [.t index current]
} {2.1 3.2 3.2 3.2 3.2 3.2 4.3}
-test textTag-16.2 {TkTextPickCurrent procedure} courier12 {
+test textTag-16.2 {TkTextPickCurrent procedure} haveCourier12 {
event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
event gen .t <Motion> -x $x2 -y $y2
set x [.t index current]
@@ -692,7 +690,7 @@ foreach i {a b c d} {
.t tag bind $i <Enter> "lappend x enter-$i"
.t tag bind $i <Leave> "lappend x leave-$i"
}
-test textTag-16.3 {TkTextPickCurrent procedure} courier12 {
+test textTag-16.3 {TkTextPickCurrent procedure} haveCourier12 {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -710,7 +708,7 @@ test textTag-16.3 {TkTextPickCurrent procedure} courier12 {
event gen .t <Motion> -x $x3 -y $y3
set x
} {enter-a enter-b | leave-b enter-c | leave-a leave-c}
-test textTag-16.4 {TkTextPickCurrent procedure} courier12 {
+test textTag-16.4 {TkTextPickCurrent procedure} haveCourier12 {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -730,7 +728,7 @@ test textTag-16.4 {TkTextPickCurrent procedure} courier12 {
foreach i {a b c d} {
.t tag delete $i
}
-test textTag-16.5 {TkTextPickCurrent procedure} courier12 {
+test textTag-16.5 {TkTextPickCurrent procedure} haveCourier12 {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -740,7 +738,7 @@ test textTag-16.5 {TkTextPickCurrent procedure} courier12 {
event gen .t <Motion> -x $x2 -y $y2
.t index current
} {3.2}
-test textTag-16.6 {TkTextPickCurrent procedure} courier12 {
+test textTag-16.6 {TkTextPickCurrent procedure} haveCourier12 {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -751,7 +749,7 @@ test textTag-16.6 {TkTextPickCurrent procedure} courier12 {
update
.t index current
} {3.1}
-test textTag-16.7 {TkTextPickCurrent procedure} courier12 {
+test textTag-16.7 {TkTextPickCurrent procedure} haveCourier12 {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -762,21 +760,43 @@ test textTag-16.7 {TkTextPickCurrent procedure} courier12 {
.t index current
} {3.1}
-catch {destroy .t}
-
-# cleanup
-::tcltest::cleanupTests
-return
-
-
-
-
-
-
-
-
-
+test textTag-17.1 {insert procedure inserts tags} {
+ .t delete 1.0 end
+ # Objectification of the text widget had a problem
+ # with inserting tags when using 'end'. Check that
+ # bug has been fixed.
+ .t insert end abcd {x} \n {} efgh {y} \n {}
+ .t dump -tag 1.0 end
+} {tagon x 1.0 tagoff x 1.4 tagon y 2.0 tagoff y 2.4}
+catch {destroy .t}
+test textTag-18.1 {TkTextPickCurrent tag bindings} {
+ text .t -width 30 -height 4 -relief sunken -borderwidth 10 \
+ -highlightthickness 10 -pady 2
+ pack .t
+
+ .t insert end " Tag here " TAG " no tag here"
+ .t tag configure TAG -borderwidth 4 -relief raised
+ .t tag bind TAG <Enter> {lappend res "%x %y tag-Enter"}
+ .t tag bind TAG <Leave> {lappend res "%x %y tag-Leave"}
+ bind .t <Enter> {lappend res Enter}
+ bind .t <Leave> {lappend res Leave}
+
+ set res {}
+ # Bindings must not trigger on the widget border, only over
+ # the actual tagged characters themselves.
+ event gen .t <Motion> -warp 1 -x 0 -y 0 ; update
+ event gen .t <Motion> -warp 1 -x 10 -y 10 ; update
+ event gen .t <Motion> -warp 1 -x 25 -y 25 ; update
+ event gen .t <Motion> -warp 1 -x 20 -y 20 ; update
+ event gen .t <Motion> -warp 1 -x 10 -y 10 ; update
+ event gen .t <Motion> -warp 1 -x 25 -y 25 ; update
+ set res
+} {Enter {25 25 tag-Enter} {20 20 tag-Leave} {25 25 tag-Enter}}
+catch {destroy .t}
+# cleanup
+cleanupTests
+return
diff --git a/tests/textWind.test b/tests/textWind.test
index 66e239d..79dca50 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Create entries in the option database to be sure that geometry options
@@ -20,17 +17,26 @@ option add *Text.borderWidth 2
option add *Text.highlightThickness 2
option add *Text.font {Courier -12}
+set fixedFont {Courier -12}
+# 15 on XP, 13 on Solaris 8
+set fixedHeight [font metrics $fixedFont -linespace]
+# 7 on all platforms
+set fixedWidth [font measure $fixedFont m]
+# 12 on XP
+set fixedAscent [font metrics $fixedFont -ascent]
+set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP
+
+catch {destroy .f}
+catch {destroy .t}
+catch {destroy .t2}
+
text .t -width 30 -height 6 -bd 2 -highlightthickness 2
pack append . .t {top expand fill}
update
.t debug on
wm geometry . {}
-if {[winfo depth .t] > 1} {
- set color green
-} else {
- set color black
-}
-
+set color [expr {[winfo depth .t] > 1 ? "green" : "black"}]
+
# The statements below reset the main window; it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.
@@ -182,13 +188,14 @@ test textWind-2.18 {TkTextWindowCmd procedure} {
} {1 {unknown option "-gorp"} 0 1.0 1}
test textWind-2.19 {TkTextWindowCmd procedure} {
.t delete 1.0 end
+ catch {destroy .f}
frame .f -width 10 -height 6 -bg $color
list [catch {.t window create 1.0 -gorp -window .f stupid} msg] $msg \
[winfo exists .f] [.t index 1.end] [catch {.t index .f}]
} {1 {unknown option "-gorp"} 1 1.0 1}
test textWind-2.20 {TkTextWindowCmd procedure} {
list [catch {.t window c} msg] $msg
-} {1 {bad window option "c": must be cget, configure, create, or names}}
+} {1 {ambiguous window option "c": must be cget, configure, create, or names}}
destroy .f
test textWind-2.21 {TkTextWindowCmd procedure, "names" option} {
list [catch {.t window names foo} msg] $msg
@@ -305,7 +312,7 @@ test textWind-4.5 {AlignParseProc and AlignPrintProc procedures} {
.t window configure 1.0 -align top
list [catch {.t window configure 1.0 -align gorp} msg] $msg \
[.t window configure 1.0 -align]
-} {1 {bad alignment "gorp": must be baseline, bottom, center, or top} {-align {} {} center top}}
+} {1 {bad align "gorp": must be baseline, bottom, center, or top} {-align {} {} center top}}
test textWind-5.1 {EmbWinStructureProc procedure} {fonts} {
.t delete 1.0 end
@@ -348,7 +355,7 @@ test textWind-6.1 {EmbWinRequestProc procedure} {fonts} {
lappend result [.t bbox 1.2] [.t bbox 1.3]
} {{19 5 10 20} {29 8 7 13} {19 5 25 30} {44 13 7 13}}
-test textWind-7.1 {EmbWinLostSlaveProc procedure} {fonts} {
+test textWind-7.1 {EmbWinLostSlaveProc procedure} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
frame .f -width 10 -height 20 -bg $color
@@ -357,8 +364,8 @@ test textWind-7.1 {EmbWinLostSlaveProc procedure} {fonts} {
place .f -in .t -x 100 -y 50
update
list [winfo geom .f] [.t bbox 1.2]
-} {10x20+104+54 {19 11 0 0}}
-test textWind-7.2 {EmbWinLostSlaveProc procedure} {fonts} {
+} [list 10x20+105+55 [list 19 [expr {11+$fixedDiff/2}] 0 0]]
+test textWind-7.2 {EmbWinLostSlaveProc procedure} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
frame .t.f -width 10 -height 20 -bg $color
@@ -367,7 +374,7 @@ test textWind-7.2 {EmbWinLostSlaveProc procedure} {fonts} {
place .t.f -x 100 -y 50
update
list [winfo geom .t.f] [.t bbox 1.2]
-} {10x20+104+54 {19 11 0 0}}
+} [list 10x20+105+55 [list 19 [expr {11+$fixedDiff/2}] 0 0]]
catch {destroy .f}
catch {destroy .t.f}
@@ -400,12 +407,13 @@ proc bgerror args {
test textWind-10.1 {EmbWinLayoutProc procedure} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
+ destroy .f
.t window create 1.5 -create {
frame .f -width 10 -height 20 -bg $color
}
update
- list [winfo exists .f] [winfo geom .f] [.t index .f]
-} {1 10x20+40+5 1.5}
+ list [winfo exists .f] [winfo width .f] [winfo height .f] [.t index .f]
+} {1 10 20 1.5}
test textWind-10.2 {EmbWinLayoutProc procedure, error in creating window} {fonts} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
@@ -426,40 +434,85 @@ test textWind-10.3 {EmbWinLayoutProc procedure, error in creating window} {fonts
update
list $msg [.t bbox 1.5]
} {{{bad window path name "gorp"}} {40 11 0 0}}
-test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} {fonts} {
+proc bgerror args {
+ global msg
+ if {[lsearch -exact $msg $args] == -1} {
+ lappend msg $args
+ }
+}
+test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
+ catch {destroy .t.f}
+ set msg {}
+ after idle {
+ .t window create 1.5 -create {
+ frame .t.f
+ frame .t.f.f -width 10 -height 20 -bg $color
+ }
+ }
+ set count 0
+ while {([llength $msg] < 2) && ($count < 100)} {
+ update ; incr count; .t bbox 1.5 ; after 10
+ }
+ lappend msg [.t bbox 1.5] [winfo exists .t.f.f]
+} [list {{can't embed .t.f.f relative to .t}} {{window name "f" already exists in parent}} [list 40 [expr {11+$fixedDiff/2}] 0 0] 1]
+test textWind-10.4.1 {EmbWinLayoutProc procedure, error in creating window} {textfonts} {
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ catch {destroy .t.f}
.t window create 1.5 -create {
frame .t.f
frame .t.f.f -width 10 -height 20 -bg $color
}
- set msg xyzzy
- update
- list $msg [.t bbox 1.5] [winfo exists .t.f.f]
-} {{{can't embed .t.f.f relative to .t}} {40 11 0 0} 1}
+ set msg {}
+ update idletasks
+ lappend msg [winfo exists .t.f.f]
+} [list {{can't embed .t.f.f relative to .t}} 1]
catch {destroy .t.f}
-test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} {fonts} {
+test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
.t window create 1.5 -create {
concat .t
}
- set msg xyzzy
+ set msg {}
update
- list $msg [.t bbox 1.5]
-} {{{can't embed .t relative to .t}} {40 11 0 0}}
-test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} {fonts} {
+ lappend msg [.t bbox 1.5]
+} [list {{can't embed .t relative to .t}} [list 40 [expr {11+$fixedDiff/2}] 0 0]]
+test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
+ catch {destroy .t2}
.t window create 1.5 -create {
toplevel .t2 -width 100 -height 150
wm geom .t2 +0+0
concat .t2
}
- set msg xyzzy
+ set msg {}
update
- list $msg [.t bbox 1.5]
-} {{{can't embed .t2 relative to .t}} {40 11 0 0}}
+ lappend msg [.t bbox 1.5]
+} [list {{can't embed .t2 relative to .t}} {{window name "t2" already exists in parent}} [list 40 [expr {11+$fixedDiff/2}] 0 0]]
+test textWind-10.6.1 {EmbWinLayoutProc procedure, error in creating window} {
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ catch {destroy .t2}
+ .t window create 1.5 -create {
+ toplevel .t2 -width 100 -height 150
+ wm geom .t2 +0+0
+ concat .t2
+ }
+ set msg {}
+ update
+ set i 0
+ while {[llength $msg] == 1 && [incr i] < 200} { update }
+ set msg
+} {{{can't embed .t2 relative to .t}} {{window name "t2" already exists in parent}}}
+
+proc bgerror args {
+ global msg
+ set msg $args
+}
test textWind-10.7 {EmbWinLayoutProc procedure, steal window from self} {
.t delete 1.0 end
.t insert 1.0 ABCDEFGHIJKLMNOP
@@ -627,7 +680,7 @@ test textWind-13.1 {EmbWinBboxProc procedure} {
update
list [winfo geom .f] [.t bbox .f]
} {5x5+21+6 {21 6 5 5}}
-test textWind-13.2 {EmbWinBboxProc procedure} {
+test textWind-13.2 {EmbWinBboxProc procedure} {fonts} {
.t delete 1.0 end
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
@@ -683,7 +736,7 @@ test textWind-13.8 {EmbWinBboxProc procedure} {fonts} {
update
list [winfo geom .f] [.t bbox .f]
} {5x11+21+6 {21 6 5 11}}
-test textWind-13.9 {EmbWinBboxProc procedure, spacing options} {
+test textWind-13.9 {EmbWinBboxProc procedure, spacing options} {fonts} {
.t configure -spacing1 5 -spacing3 2
.t delete 1.0 end
.t insert 1.0 "Some sample text"
@@ -733,7 +786,7 @@ test textWind-14.3 {EmbWinDelayedUnmap procedure} {
update
.t yview 2.0
set result [winfo ismapped .f]
- update
+ update ; after 10
list $result [winfo ismapped .f]
} {1 0}
test textWind-14.4 {EmbWinDelayedUnmap procedure} {
@@ -814,22 +867,165 @@ test textWind-16.4 {EmbWinTextStructureProc procedure} {
} {1 {47 5 30 20}}
pack .t
-catch {destroy .t}
-option clear
-
-# cleanup
-::tcltest::cleanupTests
-return
-
-
+test textWind-17.1 {peer widgets and embedded windows} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert end "Line 1"
+ frame .f -width 20 -height 10 -bg blue
+ .t window create 1.3 -window .f
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ update ; update
+ destroy .t .tt
+ winfo exists .f
+} {0}
+test textWind-17.2 {peer widgets and embedded windows} {
+ catch {destroy .t .f}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert end "Line 1\nLine 2"
+ frame .f -width 20 -height 10 -bg blue
+ .t window create 1.4 -window .f
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ update ; update
+ destroy .t
+ .tt.t insert 1.0 "foo"
+ update
+ destroy .tt
+} {}
+test textWind-17.3 {peer widget and -create} {
+ catch {destroy .t}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ update ; update
+ .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
+ update
+ destroy .t .tt
+} {}
+test textWind-17.4 {peer widget deleted one window shouldn't delete others} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
+ update ; update
+ destroy .tt
+ set res {}
+ lappend res [.t get 1.2]
+ update
+ lappend res [.t get 1.2]
+} {{} {}}
+test textWind-17.5 {peer widget window configuration} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
+ update ; update
+ set res [list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]]
+ destroy .tt .t
+ set res
+} {.t.f .tt.t.f}
+test textWind-17.6 {peer widget window configuration} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
+ update ; update
+ set res [list [.t window configure 1.2 -window] \
+ [.tt.t window configure 1.2 -window]]
+ destroy .tt .t
+ set res
+} {{-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
+test textWind-17.7 {peer widget window configuration} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
+ update ; update
+ set res [list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]]
+ destroy .tt .t
+ set res
+} {.t.f {}}
+test textWind-17.8 {peer widget window configuration} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
+ update ; update
+ set res [list [.t window configure 1.2 -window] \
+ [.tt.t window configure 1.2 -window]]
+ destroy .tt .t
+ set res
+} {{-window {} {} {} .t.f} {-window {} {} {} {}}}
+test textWind-17.8a {peer widget window configuration} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
+ update ; update
+ .tt.t window configure 1.2 -window [frame .tt.t.f -width 10 -height 20 -bg red]
+ set res [list [.t window configure 1.2 -window] \
+ [.tt.t window configure 1.2 -window]]
+ destroy .tt .t
+ set res
+} {{-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
+test textWind-17.9 {peer widget window configuration} {
+ catch {destroy .t .tt}
+ pack [text .t]
+ .t delete 1.0 end
+ .t insert 1.0 "Some sample text"
+ toplevel .tt
+ pack [.t peer create .tt.t]
+ .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
+ .tt.t window create 1.2 -window [frame .tt.t.f -width 25 -height 20 -bg blue]
+ update ; update
+ .t window configure 1.2 -create \
+ {destroy %W.f ; frame %W.f -width 50 -height 7 -bg red}
+ .tt.t window configure 1.2 -window {}
+ .t window configure 1.2 -window {}
+ set res [list [.t window configure 1.2 -window] \
+ [.tt.t window configure 1.2 -window]]
+ update
+ lappend res [.t window configure 1.2 -window] \
+ [.tt.t window configure 1.2 -window]
+ destroy .tt .t
+ set res
+} {{-window {} {} {} {}} {-window {} {} {} {}} {-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
+catch {destroy .t}
+option clear
+# cleanup
+cleanupTests
+return
diff --git a/tests/tk.test b/tests/tk.test
index 261b97e..02b4257 100644
--- a/tests/tk.test
+++ b/tests/tk.test
@@ -6,18 +6,15 @@
# Copyright (c) 2002 ActiveState Corporation.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-test tk-1.1 {tk command: general} {
- list [catch {tk} msg] $msg
-} {1 {wrong # args: should be "tk option ?arg?"}}
-test tk-1.2 {tk command: general} {
- list [catch {tk xyz} msg] $msg
-} {1 {bad option "xyz": must be appname, caret, scaling, useinputmethods, or windowingsystem}}
+test tk-1.1 {tk command: general} \
+ -body {tk} -returnCodes 1 \
+ -result {wrong # args: should be "tk option ?arg?"}
+test tk-1.2 {tk command: general} \
+ -body {tk xyz} -returnCodes 1 \
+ -result {bad option "xyz": must be appname, caret, scaling, useinputmethods, windowingsystem, or inactive}
set appname [tk appname]
test tk-2.1 {tk command: appname} {
@@ -26,7 +23,7 @@ test tk-2.1 {tk command: appname} {
test tk-2.2 {tk command: appname} {
tk appname foobazgarply
} {foobazgarply}
-test tk-2.3 {tk command: appname} {unixOnly} {
+test tk-2.3 {tk command: appname} unix {
tk appname bazfoogarply
expr {[lsearch -exact [winfo interps] [tk appname]] >= 0}
} {1}
@@ -95,7 +92,7 @@ test tk-4.4 {tk command: useinputmethods: set new} {
test tk-4.5 {tk command: useinputmethods: set new} {
list [catch {tk useinputmethods -displayof . xyz} msg] $msg
} {1 {expected boolean value but got "xyz"}}
-test tk-4.6 {tk command: useinputmethods: set new} {unixOnly} {
+test tk-4.6 {tk command: useinputmethods: set new} unix {
# This isn't really a test, but more of a check...
# The answer is what was given, because we may be on a Unix
# system that doesn't have the XIM stuff
@@ -104,7 +101,7 @@ test tk-4.6 {tk command: useinputmethods: set new} {unixOnly} {
}
set useim
} $useim
-test tk-4.7 {tk command: useinputmethods: set new} {macOrPc} {
+test tk-4.7 {tk command: useinputmethods: set new} win {
# Mac and Windows don't have X Input Methods, so this should
# always return 0
tk useinputmethods 1
@@ -130,6 +127,38 @@ test tk-5.6 {tk caret} {
list [catch {tk caret . -x 20 -y 25 -h 30; tk caret . -hei} msg] $msg
} {0 30}
+# tk inactive
+test tk-6.1 {tk inactive} -body {
+ string is integer [tk inactive]
+} -result 1
+test tk-6.2 {tk inactive reset} -body {
+ catch {tk inactive reset}
+} -result 0
+test tk-6.3 {tk inactive wrong argument} -body {
+ tk inactive foo
+} -returnCodes 1 -result {bad option "foo": must be reset}
+test tk-6.4 {tk inactive too many arguments} -body {
+ tk inactive reset foo
+} -returnCodes 1 -result {wrong # args: should be "tk inactive ?-displayof window? ?reset?"}
+test tk-6.5 {tk inactive} -body {
+ tk inactive reset
+ update
+ after 100
+ set i [tk inactive]
+ expr {$i == -1 || ( $i > 90 && $i < 200 )}
+} -result 1
+
+# tk inactive in safe interpreters
+safe::interpCreate foo
+safe::loadTk foo
+test tk-7.1 {tk inactive in a safe interpreter} -body {
+ foo eval {tk inactive}
+} -result -1
+test tk-7.2 {tk inactive reset in a safe interpreter} -body {
+ foo eval {tk inactive reset}
+} -returnCodes 1 -result {resetting the user inactivity timer is not allowed in a safe interpreter}
+::safe::interpDelete foo
+
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl
new file mode 100644
index 0000000..da2e316
--- /dev/null
+++ b/tests/ttk/all.tcl
@@ -0,0 +1,21 @@
+# all.tcl --
+#
+# This file contains a top-level script to run all of the ttk
+# tests. Execute it by invoking "source all.tcl" when running tktest
+# in this directory.
+#
+# Copyright (c) 2007 by the Tk developers.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+package require Tcl 8.5
+package require tcltest 2.2
+package require Tk ;# This is the Tk test suite; fail early if no Tk!
+tcltest::configure {*}$argv
+tcltest::configure -testdir [file normalize [file dirname [info script]]]
+tcltest::configure -loadfile \
+ [file join [file dirname [tcltest::testsDirectory]] constraints.tcl]
+tcltest::configure -singleproc 1
+tcltest::runAllTests
+
diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test
new file mode 100644
index 0000000..e18ff32
--- /dev/null
+++ b/tests/ttk/checkbutton.test
@@ -0,0 +1,48 @@
+#
+# ttk::checkbutton widget tests.
+#
+
+package require Tk
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test checkbutton-1.1 "Checkbutton check" -body {
+ pack [ttk::checkbutton .cb -text "TCheckbutton" -variable cb]
+}
+test checkbutton-1.2 "Checkbutton invoke" -body {
+ .cb invoke
+ list [set ::cb] [.cb instate selected]
+} -result [list 1 1]
+test checkbutton-1.3 "Checkbutton reinvoke" -body {
+ .cb invoke
+ list [set ::cb] [.cb instate selected]
+} -result [list 0 0]
+
+test checkbutton-1.4 "Checkbutton variable" -body {
+ set result []
+ set ::cb 1
+ lappend result [.cb instate selected]
+ set ::cb 0
+ lappend result [.cb instate selected]
+} -result {1 0}
+
+test checkbutton-1.5 "Unset checkbutton variable" -body {
+ set result []
+ unset ::cb
+ lappend result [.cb instate alternate] [info exists ::cb]
+ set ::cb 1
+ lappend result [.cb instate alternate] [info exists ::cb]
+} -result {1 0 0 1}
+
+# See #1257319
+test checkbutton-1.6 "Checkbutton default variable" -body {
+ destroy .cb ; unset -nocomplain {} ; set result [list]
+ ttk::checkbutton .cb -onvalue on -offvalue off
+ lappend result [.cb cget -variable] [info exists .cb] [.cb state]
+ .cb invoke
+ lappend result [info exists .cb] [set .cb] [.cb state]
+ .cb invoke
+ lappend result [info exists .cb] [set .cb] [.cb state]
+} -result [list .cb 0 alternate 1 on selected 1 off {}]
+
+tcltest::cleanupTests
diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test
new file mode 100644
index 0000000..43f3cf1
--- /dev/null
+++ b/tests/ttk/combobox.test
@@ -0,0 +1,68 @@
+#
+# ttk::combobox widget tests
+#
+
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test combobox-1.0 "Combobox tests -- setup" -body {
+ ttk::combobox .cb
+} -result .cb
+
+test combobox-1.1 "Bad -values list" -body {
+ .cb configure -values "bad \{list"
+} -result "unmatched open brace in list" -returnCodes 1
+
+test combobox-1.end "Combobox tests -- cleanup" -body {
+ destroy .cb
+}
+
+test combobox-2.0 "current command" -body {
+ ttk::combobox .cb -values [list a b c d e a]
+ .cb current
+} -result -1
+
+test combobox-2.1 "current -- set index" -body {
+ .cb current 5
+ .cb get
+} -result a
+
+test combobox-2.2 "current -- change -values" -body {
+ .cb configure -values [list c b a d e]
+ .cb current
+} -result 2
+
+test combobox-2.3 "current -- change value" -body {
+ .cb set "b"
+ .cb current
+} -result 1
+
+test combobox-2.4 "current -- value not in list" -body {
+ .cb set "z"
+ .cb current
+} -result -1
+
+test combobox-2.end "Cleanup" -body { destroy .cb }
+
+
+test combobox-1890211 "ComboboxSelected event after listbox unposted" -body {
+ # whitebox test...
+ pack [ttk::combobox .cb -values [list a b c]]
+ set result [list]
+ bind .cb <<ComboboxSelected>> {
+ lappend result Event [winfo ismapped .cb.popdown] [.cb get]
+ }
+ lappend result Start 0 [.cb get]
+ ttk::combobox::Post .cb
+ lappend result Post [winfo ismapped .cb.popdown] [.cb get]
+ .cb.popdown.f.l selection clear 0 end; .cb.popdown.f.l selection set 1
+ ttk::combobox::LBSelected .cb.popdown.f.l
+ lappend result Select [winfo ismapped .cb.popdown] [.cb get]
+ update
+ set result
+} -result [list Start 0 {} Post 1 {} Select 0 b Event 0 b] -cleanup {
+ destroy .cb
+}
+
+tcltest::cleanupTests
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
new file mode 100644
index 0000000..0c2f0be
--- /dev/null
+++ b/tests/ttk/entry.test
@@ -0,0 +1,283 @@
+#
+# Tile package: entry widget tests
+#
+
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+variable scrollInfo
+proc scroll args {
+ global scrollInfo
+ set scrollInfo $args
+}
+
+# Some of the tests raise background errors;
+# override default bgerror to catch them.
+#
+variable bgerror ""
+proc bgerror {error} {
+ variable bgerror $error
+ variable bgerrorInfo $::errorInfo
+ variable bgerrorCode $::errorCode
+}
+
+#
+test entry-1.1 "Create entry widget" -body {
+ ttk::entry .e
+} -result .e
+
+test entry-1.2 "Insert" -body {
+ .e insert end abcde
+ .e get
+} -result abcde
+
+test entry-1.3 "Selection" -body {
+ .e selection range 1 3
+ selection get
+} -result bc
+
+test entry-1.4 "Delete" -body {
+ .e delete 1 3
+ .e get
+} -result ade
+
+test entry-1.5 "Deletion - insert cursor" -body {
+ .e insert end abcde
+ .e icursor 0
+ .e delete 0 end
+ .e index insert
+} -result 0
+
+test entry-1.6 "Deletion - insert cursor at end" -body {
+ .e insert end abcde
+ .e icursor end
+ .e delete 0 end
+ .e index insert
+} -result 0
+
+test entry-1.7 "Deletion - insert cursor in the middle " -body {
+ .e insert end abcde
+ .e icursor 3
+ .e delete 0 end
+ .e index insert
+} -result 0
+
+test entry-1.done "Cleanup" -body { destroy .e }
+
+# Scrollbar tests.
+
+test entry-2.1 "Create entry before scrollbar" -body {
+ pack [ttk::entry .te -xscrollcommand [list .tsb set]] \
+ -expand true -fill both
+ pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \
+ -expand false -fill x
+} -cleanup {destroy .te .tsb}
+
+test entry-2.2 "Initial scroll position" -body {
+ ttk::entry .e -font fixed -width 5 -xscrollcommand scroll
+ .e insert end "0123456789"
+ pack .e; update
+ set scrollInfo
+} -result {0.0 0.5} -cleanup { destroy .e }
+# NOTE: result can vary depending on font.
+
+# Bounding box / scrolling tests.
+test entry-3.0 "Series 3 setup" -body {
+ ttk::style theme use default
+ variable fixed fixed
+ variable cw [font measure $fixed a]
+ variable ch [font metrics $fixed -linespace]
+ variable bd 2 ;# border + padding
+ variable ux [font measure $fixed \u4e4e]
+
+ pack [ttk::entry .e -font $fixed -width 20]
+ update
+}
+
+test entry-3.1 "bbox widget command" -body {
+ .e delete 0 end
+ .e bbox 0
+} -result [list $bd $bd 0 $ch]
+
+test entry-3.2 "xview" -body {
+ .e delete 0 end;
+ .e insert end [string repeat "0" 40]
+ update idletasks
+ set result [.e xview]
+} -result {0.0 0.5}
+
+test entry-3.last "Series 3 cleanup" -body {
+ destroy .e
+}
+
+# Selection tests:
+
+test entry-4.0 "Selection test - setup" -body {
+ ttk::entry .e
+ .e insert end asdfasdf
+ .e selection range 0 end
+}
+
+test entry-4.1 "Selection test" -body {
+ selection get
+} -result asdfasdf
+
+test entry-4.2 "Disable -exportselection" -body {
+ .e configure -exportselection false
+ selection get
+} -returnCodes error -result "PRIMARY selection doesn't exist*" -match glob
+
+test entry-4.3 "Reenable -exportselection" -body {
+ .e configure -exportselection true
+ selection get
+} -result asdfasdf
+
+test entry-4.4 "Force selection loss" -body {
+ selection own .
+ .e index sel.first
+} -returnCodes error -result "selection isn't in widget .e"
+
+test entry-4.5 "Allow selection changes if readonly" -body {
+ .e delete 0 end
+ .e insert end 0123456789
+ .e selection range 0 end
+ .e configure -state readonly
+ .e selection range 2 4
+ .e configure -state normal
+ list [.e index sel.first] [.e index sel.last]
+} -result {2 4}
+
+test entry-4.6 "Disallow selection changes if disabled" -body {
+ .e delete 0 end
+ .e insert end 0123456789
+ .e selection range 0 end
+ .e configure -state disabled
+ .e selection range 2 4
+ .e configure -state normal
+ list [.e index sel.first] [.e index sel.last]
+} -result {0 10}
+
+test entry-4.7 {sel.first and sel.last gravity} -body {
+ set result [list]
+ .e delete 0 end
+ .e insert 0 0123456789
+ .e select range 2 6
+ .e insert 2 XXX
+ lappend result [.e index sel.first] [.e index sel.last]
+ .e insert 6 YYY
+ lappend result [.e index sel.first] [.e index sel.last] [.e get]
+} -result {5 9 5 12 01XXX2YYY3456789}
+
+# Self-destruct tests.
+
+test entry-5.1 {widget deletion while active} -body {
+ destroy .e
+ pack [ttk::entry .e]
+ update
+ .e config -xscrollcommand { destroy .e }
+ update idletasks
+ winfo exists .e
+} -result 0
+
+# TODO: test killing .e in -validatecommand, -invalidcommand, variable trace;
+
+
+# -textvariable tests.
+
+test entry-6.1 {Update linked variable in write trace} -body {
+ proc override args {
+ global x
+ set x "Overridden!"
+ }
+ catch {destroy .e}
+ set x ""
+ trace variable x w override
+ ttk::entry .e -textvariable x
+ .e insert 0 "Some text"
+ set result [list $x [.e get]]
+ set result
+} -result {Overridden! Overridden!} -cleanup {
+ unset x
+ rename override {}
+ destroy .e
+}
+
+test entry-6.2 {-textvariable tests} -body {
+ set result [list]
+ ttk::entry .e -textvariable x
+ set x "text"
+ lappend result [.e get]
+ unset x
+ lappend result [.e get]
+ .e insert end "newtext"
+ lappend result [.e get] [set x]
+} -result [list "text" "" "newtext" "newtext"] -cleanup {
+ destroy .e
+ unset -nocomplain x
+}
+
+test entry-7.1 {Bad style options} -body {
+ ttk::style theme create entry-7.1 -settings {
+ ttk::style configure TEntry -foreground BadColor
+ ttk::style map TEntry -foreground {readonly AnotherBadColor}
+ ttk::style map TEntry -font {readonly ABadFont}
+ ttk::style map TEntry \
+ -selectbackground {{} BadColor} \
+ -selectforeground {{} BadColor} \
+ -insertcolor {{} BadColor}
+ }
+ pack [ttk::entry .e -text "Don't crash"]
+ ttk::style theme use entry-7.1
+ update
+ .e selection range 0 end
+ update
+ .e state readonly;
+ update
+} -cleanup { destroy .e ; ttk::style theme use default }
+
+test entry-8.1 "Unset linked variable" -body {
+ variable foo "bar"
+ pack [ttk::entry .e -textvariable foo]
+ unset foo
+ .e insert end "baz"
+ list [.e cget -textvariable] [.e get] [set foo]
+} -result [list foo "baz" "baz"] -cleanup { destroy .e }
+
+test entry-8.2 "Unset linked variable by deleting namespace" -body {
+ namespace eval ::test { variable foo "bar" }
+ pack [ttk::entry .e -textvariable ::test::foo]
+ namespace delete ::test
+ .e insert end "baz" ;# <== error here
+ list [.e cget -textvariable] [.e get] [set foo]
+} -returnCodes error -result "*parent namespace doesn't exist*" -match glob
+# '-result [list ::test::foo "baz" "baz"]' would also be sensible,
+# but Tcl namespaces don't work that way.
+
+test entry-8.2a "Followup to test 8.2" -body {
+ .e cget -textvariable
+} -result ::test::foo -cleanup { destroy .e }
+# For 8.2a, -result {} would also be sensible.
+
+test entry-9.1 "Index range invariants" -setup {
+ # See bug#1721532 for discussion
+ proc entry-9.1-trace {n1 n2 op} {
+ set ::V NO!
+ }
+ variable V
+ trace add variable V write entry-9.1-trace
+ ttk::entry .e -textvariable V
+} -body {
+ set result [list]
+ .e insert insert a ; lappend result [.e index insert] [.e index end]
+ .e insert insert b ; lappend result [.e index insert] [.e index end]
+ .e insert insert c ; lappend result [.e index insert] [.e index end]
+ .e insert insert d ; lappend result [.e index insert] [.e index end]
+ .e insert insert e ; lappend result [.e index insert] [.e index end]
+ set result
+} -result [list 1 3 2 3 3 3 3 3 3 3] -cleanup {
+ unset V
+ destroy .e
+}
+
+tcltest::cleanupTests
diff --git a/tests/ttk/image.test b/tests/ttk/image.test
new file mode 100644
index 0000000..a55f7f8
--- /dev/null
+++ b/tests/ttk/image.test
@@ -0,0 +1,50 @@
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test image-1.1 "Bad image element" -body {
+ ttk::style element create BadImage image badimage
+} -returnCodes error -result {image "badimage" doesn't exist}
+
+test image-1.2 "Duplicate element" -setup {
+ image create photo test.element -width 10 -height 10
+ ttk::style element create testElement image test.element
+} -body {
+ ttk::style element create testElement image test.element
+} -returnCodes 1 -result "Duplicate element testElement"
+
+test image-2.0 "Deletion of displayed image (label)" -setup {
+ image create photo test.image -width 10 -height 10
+} -body {
+ pack [set w [ttk::label .ttk_image20 -image test.image]]
+ tkwait visibility $w
+ image delete test.image
+ update
+} -cleanup {
+ destroy .ttk_image20
+} -result {}
+
+test image-2.1 "Deletion of displayed image (checkbutton)" -setup {
+ image create photo test.image -width 10 -height 10
+} -body {
+ pack [set w [ttk::checkbutton .ttk_image21 -image test.image]]
+ tkwait visibility $w
+ image delete test.image
+ update
+} -cleanup {
+ destroy .ttk_image21
+} -result {}
+
+test image-2.2 "Deletion of displayed image (radiobutton)" -setup {
+ image create photo test.image -width 10 -height 10
+} -body {
+ pack [set w [ttk::radiobutton .ttk_image22 -image test.image]]
+ tkwait visibility $w
+ image delete test.image
+ update
+} -cleanup {
+ destroy .ttk_image22
+} -result {}
+
+#
+tcltest::cleanupTests
diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test
new file mode 100644
index 0000000..28b4d2e
--- /dev/null
+++ b/tests/ttk/labelframe.test
@@ -0,0 +1,130 @@
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test labelframe-1.0 "Setup" -body {
+ pack [ttk::labelframe .lf] -expand true -fill both
+}
+
+test labelframe-2.1 "Can't use indirect descendant as labelwidget" -body {
+ ttk::frame .lf.t
+ ttk::checkbutton .lf.t.cb
+ .lf configure -labelwidget .lf.t.cb
+} -returnCodes 1 -result "can't *" -match glob \
+ -cleanup { destroy .lf.t } ;
+
+test labelframe-2.2 "Can't use toplevel as labelwidget" -body {
+ toplevel .lf.t
+ .lf configure -labelwidget .lf.t
+} -returnCodes 1 -result "can't *" -match glob \
+ -cleanup { destroy .lf.t } ;
+
+test labelframe-2.3 "Can't use non-windows as -labelwidget" -body {
+ .lf configure -labelwidget BogusWindowName
+} -returnCodes 1 -result {bad window path name "BogusWindowName"}
+
+test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body {
+ .lf configure -labelwidget .nosuchwindow
+} -returnCodes 1 -result {bad window path name ".nosuchwindow"}
+
+
+###
+# See also series labelframe-4.x
+#
+test labelframe-3.1 "Add child slave" -body {
+ checkbutton .lf.cb -text "abcde"
+ .lf configure -labelwidget .lf.cb
+ list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
+} -result [list 1 labelframe]
+
+test labelframe-3.2 "Remove child slave" -body {
+ .lf configure -labelwidget {}
+ list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
+} -result [list 0 {}]
+
+test labelframe-3.3 "Re-add child slave" -body {
+ .lf configure -labelwidget .lf.cb
+ list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
+} -result [list 1 labelframe]
+
+test labelframe-3.4 "Re-manage child slave" -body {
+ pack .lf.cb -side right
+ list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] [.lf cget -labelwidget]
+} -result [list 1 pack {}]
+
+test labelframe-3.5 "Re-add child slave" -body {
+ .lf configure -labelwidget .lf.cb
+ list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
+} -result [list 1 labelframe]
+
+test labelframe-3.6 "Destroy child slave" -body {
+ destroy .lf.cb
+ .lf cget -labelwidget
+} -result {}
+
+###
+# Re-run series labelframe-3.x with nonchild slaves.
+#
+# @@@ ODDITY, 14 Nov 2005:
+# @@@ labelframe-4.1 fails if .cb is a [checkbutton],
+# @@@ but seems to succeed if it's some other widget class.
+# @@@ I suspect a race condition; unable to track it down ATM.
+#
+# @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc
+# @@@ (see manager.c r1.11). There's still probably a race condition in here.
+#
+test labelframe-4.1 "Add nonchild slave" -body {
+ checkbutton .cb -text "abcde"
+ .lf configure -labelwidget .cb
+ update
+ list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb]
+
+} -result [list 1 1 labelframe]
+
+test labelframe-4.2 "Remove nonchild slave" -body {
+ .lf configure -labelwidget {}
+ update;
+ list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb]
+} -result [list 0 0 {}]
+
+test labelframe-4.3 "Re-add nonchild slave" -body {
+ .lf configure -labelwidget .cb
+ list [update; winfo viewable .cb] [winfo manager .cb]
+} -result [list 1 labelframe]
+
+test labelframe-4.4 "Re-manage nonchild slave" -body {
+ pack .cb -side right
+ list [update; winfo viewable .cb] \
+ [winfo manager .cb] \
+ [.lf cget -labelwidget]
+} -result [list 1 pack {}]
+
+test labelframe-4.5 "Re-add nonchild slave" -body {
+ .lf configure -labelwidget .cb
+ list [update; winfo viewable .cb] \
+ [winfo manager .cb] \
+ [.lf cget -labelwidget]
+} -result [list 1 labelframe .cb]
+
+test labelframe-4.6 "Destroy nonchild slave" -body {
+ destroy .cb
+ .lf cget -labelwidget
+} -result {}
+
+test labelframe-5.0 "Cleanup" -body {
+ destroy .lf
+}
+
+# 1342876 -- labelframe should raise sibling -labelwidget above self.
+#
+test labelframe-6.1 "Stacking order" -body {
+ toplevel .t
+ pack [ttk::checkbutton .t.x1]
+ pack [ttk::labelframe .t.lf -labelwidget [ttk::label .t.lb]]
+ pack [ttk::checkbutton .t.x2]
+ winfo children .t
+} -cleanup {
+ destroy .t
+} -result [list .t.x1 .t.lf .t.lb .t.x2]
+
+tcltest::cleanupTests
diff --git a/tests/ttk/layout.test b/tests/ttk/layout.test
new file mode 100644
index 0000000..814e1d9
--- /dev/null
+++ b/tests/ttk/layout.test
@@ -0,0 +1,25 @@
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test layout-1.1 "Size computations for mixed-orientation layouts" -body {
+ ttk::style theme use default
+
+ set block [image create photo -width 10 -height 10]
+ ttk::style element create block image $block
+ ttk::style layout Blocks {
+ border -children { block } -side left
+ border -children { block } -side top
+ border -children { block } -side bottom
+ }
+ ttk::style configure Blocks -borderwidth 1 -relief raised
+ ttk::button .b -style Blocks
+
+ pack .b -expand true -fill both
+
+ list [winfo reqwidth .b] [winfo reqheight .b]
+
+} -cleanup { destroy .b } -result [list 24 24]
+
+
+tcltest::cleanupTests
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
new file mode 100644
index 0000000..cdce020
--- /dev/null
+++ b/tests/ttk/notebook.test
@@ -0,0 +1,493 @@
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test notebook-1.0 "Setup" -body {
+ ttk::notebook .nb
+} -result .nb
+
+#
+# Error handling tests:
+#
+test notebook-1.1 "Cannot add ancestor" -body {
+ .nb add .
+} -returnCodes error -result "*" -match glob
+
+proc inoperative {args} {}
+
+inoperative test notebook-1.2 "Cannot add siblings" -body {
+ # This is legal now
+ .nb add [frame .sibling]
+} -returnCodes error -result "*" -match glob
+
+test notebook-1.3 "Cannot add toplevel" -body {
+ .nb add [toplevel .nb.t]
+} -cleanup {
+ destroy .t.nb
+} -returnCodes 1 -match glob -result "can't add .nb.t*"
+
+test notebook-1.4 "Try to select bad tab" -body {
+ .nb select @6000,6000
+} -returnCodes 1 -match glob -result "* not found"
+
+#
+# Now add stuff:
+#
+test notebook-2.0 "Add children" -body {
+ pack .nb -expand true -fill both
+ .nb add [frame .nb.foo] -text "Foo"
+ pack [label .nb.foo.l -text "Foo"]
+
+ .nb add [frame .nb.bar -relief raised -borderwidth 2] -text "Bar"
+ pack [label .nb.bar.l -text "Bar"]
+
+ .nb tabs
+} -result [list .nb.foo .nb.bar]
+
+test notebook-2.1 "select pane" -body {
+ .nb select .nb.foo
+ update
+ list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current]
+} -result [list 1 0 0]
+
+test notebook-2.2 "select another pane" -body {
+ .nb select 1
+ update
+ list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current]
+} -result [list 0 1 1]
+
+test notebook-2.3 "tab - get value" -body {
+ .nb tab .nb.foo -text
+} -result "Foo"
+
+test notebook-2.4 "tab - set value" -body {
+ .nb tab .nb.foo -text "Changed Foo"
+ .nb tab .nb.foo -text
+} -result "Changed Foo"
+
+test notebook-2.5 "tab - get all options" -body {
+ .nb tab .nb.foo
+} -result [list \
+ -padding 0 -sticky nsew \
+ -state normal -text "Changed Foo" -image "" -compound none -underline -1]
+
+test notebook-4.1 "Test .nb index end" -body {
+ .nb index end
+} -result 2
+
+test notebook-4.2 "'end' is not a selectable index" -body {
+ .nb select end
+} -returnCodes error -result "*" -match glob
+
+test notebook-4.3 "Select index out of range" -body {
+ .nb select 2
+} -returnCodes error -result "*" -match glob
+
+test notebook-4.4 "-padding option" -body {
+ .nb configure -padding "5 5 5 5"
+}
+
+test notebook-4.end "Cleanup test suite 1-4.*" -body { destroy .nb }
+
+test notebook-5.1 "Virtual events" -body {
+ toplevel .t
+ set ::events [list]
+ bind .t <<NotebookTabChanged>> { lappend events changed %W }
+
+ pack [set nb [ttk::notebook .t.nb]] -expand true -fill both; update
+ $nb add [frame $nb.f1]
+ $nb add [frame $nb.f2]
+ $nb add [frame $nb.f3]
+
+ $nb select $nb.f1
+ update; set events
+} -result [list changed .t.nb]
+
+test notebook-5.2 "Virtual events, continued" -body {
+ set events [list]
+ $nb select $nb.f3
+ update ; set events
+} -result [list changed .t.nb]
+# OR: [list deselected .t.nb.f1 selected .t.nb.f3 changed .t.nb]
+
+test notebook-5.3 "Disabled tabs" -body {
+ set events [list]
+ $nb tab $nb.f2 -state disabled
+ $nb select $nb.f2
+ update
+ list $events [$nb index current]
+} -result [list [list] 2]
+
+test notebook-5.4 "Reenable tab" -body {
+ set events [list]
+ $nb tab $nb.f2 -state normal
+ $nb select $nb.f2
+ update
+ list $events [$nb index current]
+} -result [list [list changed .t.nb] 1]
+
+test notebook-5.end "Virtual events, cleanup" -body { destroy .t }
+
+test notebook-6.0 "Select hidden tab" -setup {
+ set nb [ttk::notebook .nb]
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ $nb tab $nb.f1 -state hidden
+ lappend result [$nb tab $nb.f1 -state]
+ $nb select $nb.f1
+ lappend result [$nb tab $nb.f1 -state]
+} -result [list hidden normal]
+
+test notebook-6.1 "Hide selected tab" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ $nb hide $nb.f2
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ update idletasks; lappend result [winfo ismapped $nb.f3]
+} -result [list 1 1 2 0 1]
+
+# See 1370833
+test notebook-6.2 "Forget selected tab" -setup {
+ ttk::notebook .n
+ pack .n
+ label .n.l -text abc
+ .n add .n.l
+} -body {
+ update
+ after 100
+ .n forget .n.l
+ update ;# Yowch!
+} -cleanup {
+ destroy .n
+} -result {}
+
+test notebook-6.3 "Hide first tab when it's the current" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f1
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f1]
+ $nb hide $nb.f1
+ lappend result [$nb index current] [winfo ismapped $nb.f1]
+} -result [list 0 1 1 0]
+
+test notebook-6.4 "Forget first tab when it's the current" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f1
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f1]
+ $nb forget $nb.f1
+ lappend result [$nb index current] [winfo ismapped $nb.f1]
+} -result [list 0 1 0 0]
+
+test notebook-6.5 "Hide last tab when it's the current" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f3
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f3]
+ $nb hide $nb.f3
+ lappend result [$nb index current] [winfo ismapped $nb.f3]
+} -result [list 2 1 1 0]
+
+test notebook-6.6 "Forget a middle tab when it's the current" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ $nb forget $nb.f2
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+} -result [list 1 1 1 0]
+
+test notebook-6.7 "Hide a middle tab when it's the current" -setup {
+ pack [set nb [ttk::notebook .nb]]; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ $nb hide $nb.f2
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+} -result [list 1 1 2 0]
+
+test notebook-6.8 "Forget a non-current tab < current" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ $nb forget $nb.f1
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+} -result [list 1 1 0 1]
+
+test notebook-6.9 "Hide a non-current tab < current" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ $nb hide $nb.f1
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+} -result [list 1 1 1 1]
+
+test notebook-6.10 "Forget a non-current tab > current" -setup {
+ pack [set nb [ttk::notebook .nb]] ; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ $nb forget $nb.f3
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+} -result [list 1 1 1 1]
+
+test notebook-6.11 "Hide a non-current tab > current" -setup {
+ pack [set nb [ttk::notebook .nb]]; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+ $nb hide $nb.f3
+ lappend result [$nb index current] [winfo ismapped $nb.f2]
+} -result [list 1 1 1 1]
+
+test notebook-6.12 "Hide and re-add a tab" -setup {
+ pack [set nb [ttk::notebook .nb]]; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [$nb tab $nb.f2 -state]
+ $nb hide $nb.f2
+ lappend result [$nb index current] [$nb tab $nb.f2 -state]
+ $nb add $nb.f2
+ lappend result [$nb index current] [$nb tab $nb.f2 -state]
+} -result [list 1 normal 2 hidden 2 normal]
+
+#
+# Insert:
+#
+unset nb
+test notebook-7.0 "insert - setup" -body {
+ pack [ttk::notebook .nb]
+ for {set i 0} {$i < 5} {incr i} {
+ .nb add [ttk::frame .nb.f$i] -text "$i"
+ }
+ .nb select .nb.f1
+ list [.nb index current] [.nb tabs]
+} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]
+
+test notebook-7.1 "insert - move backwards" -body {
+ .nb insert 1 3
+ list [.nb index current] [.nb tabs]
+} -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]]
+
+test notebook-7.2 "insert - move backwards again" -body {
+ .nb insert 1 3
+ list [.nb index current] [.nb tabs]
+} -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]]
+
+test notebook-7.3 "insert - move backwards again" -body {
+ .nb insert 1 3
+ list [.nb index current] [.nb tabs]
+} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]
+
+test notebook-7.4 "insert - move forwards" -body {
+ .nb insert 3 1
+ list [.nb index current] [.nb tabs]
+} -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]]
+
+test notebook-7.5 "insert - move forwards again" -body {
+ .nb insert 3 1
+ list [.nb index current] [.nb tabs]
+} -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]]
+
+test notebook-7.6 "insert - move forwards again" -body {
+ .nb insert 3 1
+ list [.nb index current] [.nb tabs]
+} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]
+
+test notebook-7.7a "insert - current tab undisturbed" -body {
+ .nb select 0
+ .nb insert 3 1
+ .nb index current
+} -result 0
+
+test notebook-7.7b "insert - current tab undisturbed" -body {
+ .nb select 0
+ .nb insert 1 3
+ .nb index current
+} -result 0
+
+test notebook-7.7c "insert - current tab undisturbed" -body {
+ .nb select 4
+ .nb insert 3 1
+ .nb index current
+} -result 4
+
+test notebook-7.7d "insert - current tab undisturbed" -body {
+ .nb select 4
+ .nb insert 1 3
+ .nb index current
+} -result 4
+
+test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body {
+ .nb select .nb.f0
+ foreach i {0 1 2 3 4} {
+ .nb insert $i .nb.f$i
+ }
+
+ foreach i {0 1 2 3 4} {
+ .nb select .nb.f$i
+ foreach j {0 1 2 3 4} {
+ foreach k {0 1 2 3 4} {
+ .nb insert $j $k
+ set current [lindex [.nb tabs] [.nb index current]]
+ if {$current != ".nb.f$i"} {
+ error "($i,$j,$k) current = $current"
+ }
+ .nb insert $k $j
+ if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
+ error "swap $j $k; swap $k $j => [.nb tabs]"
+ }
+ }
+ }
+ }
+ .nb tabs
+} -result [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]
+
+test notebook-7.8b "insert new - current tab undisturbed - exhaustive" -body {
+ foreach i {0 1 2 3 4} {
+ .nb select .nb.f$i
+ foreach j {0 1 2 3 4} {
+.nb select .nb.f$i
+ .nb insert $j [frame .nb.newf]
+ set current [lindex [.nb tabs] [.nb index current]]
+ if {$current != ".nb.f$i"} {
+ puts stderr "new tab at $j, current = $current, expect .nb.f$i"
+ }
+ destroy .nb.newf
+ if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
+ error "tabs disturbed"
+ }
+ }
+ }
+}
+
+test notebook-7.end "insert - cleanup" -body {
+ destroy .nb
+}
+
+test notebook-1817596-1 "insert should autoselect first tab" -body {
+ pack [ttk::notebook .nb]
+ list \
+ [.nb insert end [ttk::label .nb.l1 -text One] -text One] \
+ [.nb select] \
+ ;
+} -result [list "" .nb.l1] -cleanup { destroy .nb }
+
+test notebook-1817596-2 "error in insert should have no effect" -body {
+ pack [ttk::notebook .nb]
+ .nb insert end [ttk::label .nb.l1]
+ .nb insert end [ttk::label .nb.l2]
+ list \
+ [catch { .nb insert .l2 0 -badoption badvalue } err] \
+ [.nb tabs] \
+} -result [list 1 [list .nb.l1 .nb.l2]] -cleanup { destroy .nb }
+
+test notebook-1817596-3 "insert/configure" -body {
+ pack [ttk::notebook .nb]
+ .nb insert end [ttk::label .nb.l0] -text "L0"
+ .nb insert end [ttk::label .nb.l1] -text "L1"
+ .nb insert end [ttk::label .nb.l2] -text "XX"
+ .nb insert 0 2 -text "L2"
+
+ list [.nb tabs] [.nb tab 0 -text] [.nb tab 1 -text] [.nb tab 2 -text]
+
+} -result [list [list .nb.l2 .nb.l0 .nb.l1] L2 L0 L1] -cleanup { destroy .nb }
+
+
+# See #1343984
+test notebook-1343984-1 "don't autoselect on destroy - setup" -body {
+ ttk::notebook .nb
+ set ::history [list]
+ bind TestFrame <Map> { lappend history MAP %W }
+ bind TestFrame <Destroy> { lappend history DESTROY %W }
+ .nb add [ttk::frame .nb.frame1 -class TestFrame] -text "Frame 1"
+ .nb add [ttk::frame .nb.frame2 -class TestFrame] -text "Frame 2"
+ .nb add [ttk::frame .nb.frame3 -class TestFrame] -text "Frame 3"
+ pack .nb -fill both -expand 1
+ update
+ set ::history
+} -result [list MAP .nb.frame1]
+
+test notebook-1343984-2 "don't autoselect on destroy" -body {
+ set ::history [list]
+ destroy .nb
+ update
+ set ::history
+} -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3]
+
+tcltest::cleanupTests
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test
new file mode 100644
index 0000000..7fe5c87
--- /dev/null
+++ b/tests/ttk/panedwindow.test
@@ -0,0 +1,291 @@
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+proc propagate-geometry {} { update idletasks }
+
+# Basic sanity checks:
+#
+test panedwindow-1.0 "Setup" -body {
+ ttk::panedwindow .pw
+} -result .pw
+
+test panedwindow-1.1 "Make sure empty panedwindow doesn't crash" -body {
+ pack .pw -expand true -fill both
+ update
+}
+
+test panedwindow-1.2 "Add a pane" -body {
+ .pw add [ttk::frame .pw.f1]
+ winfo manager .pw.f1
+} -result "panedwindow"
+
+test panedwindow-1.3 "Steal pane" -body {
+ pack .pw.f1 -side bottom
+ winfo manager .pw.f1
+} -result "pack"
+
+test panedwindow-1.4 "Make sure empty panedwindow still doesn't crash" -body {
+ update
+}
+
+test panedwindow-1.5 "Remanage pane" -body {
+ #XXX .pw insert 0 .pw.f1
+ .pw add .pw.f1
+ winfo manager .pw.f1
+} -result "panedwindow"
+
+test panedwindow-1.6 "Forget pane" -body {
+ .pw forget .pw.f1
+ winfo manager .pw.f1
+} -result ""
+
+test panedwindow-1.7 "Make sure empty panedwindow still still doesn't crash" -body {
+ update
+}
+
+test panedwindow-1.8 "Re-forget pane" -body {
+ .pw forget .pw.f1
+} -returnCodes 1 -result ".pw.f1 is not managed by .pw"
+
+test panedwindow-1.end "Cleanup" -body {
+ destroy .pw
+}
+
+# Resize behavior:
+#
+test panedwindow-2.1 "..." -body {
+ ttk::panedwindow .pw -orient horizontal
+
+ .pw add [listbox .pw.l1]
+ .pw add [listbox .pw.l2]
+ .pw add [listbox .pw.l3]
+ .pw add [listbox .pw.l4]
+
+ pack .pw -expand true -fill both
+ update
+ set w1 [winfo width .]
+
+ # This should make the window shrink:
+ destroy .pw.l2
+
+ update
+ set w2 [winfo width .]
+
+ expr {$w2 < $w1}
+} -result 1
+
+test panedwindow-2.2 "..., cont'd" -body {
+
+ # This should keep the window from shrinking:
+ wm geometry . [wm geometry .]
+
+ set rw2 [winfo reqwidth .pw]
+
+ destroy .pw.l1
+ update
+
+ set w3 [winfo width .]
+ set rw3 [winfo reqwidth .pw]
+
+ expr {$w3 == $w2 && $rw3 < $rw2}
+ # problem: [winfo reqwidth] shrinks, but sashes haven't moved
+ # since we haven't gotten a ConfigureNotify.
+ # How to (a) check for this, and (b) fix it?
+} -result 1
+
+test panedwindow-2.3 "..., cont'd" -body {
+
+ .pw add [listbox .pw.l5]
+ update
+ set rw4 [winfo reqwidth .pw]
+
+ expr {$rw4 > $rw3}
+} -result 1
+
+test panedwindow-2.end "Cleanup" -body { destroy .pw }
+
+#
+# ...
+#
+test panedwindow-3.0 "configure pane" -body {
+ ttk::panedwindow .pw
+ .pw add [listbox .pw.lb1]
+ .pw add [listbox .pw.lb2]
+ .pw pane 1 -weight 2
+ .pw pane 1 -weight
+} -result 2
+
+test panedwindow-3.1 "configure pane -- errors" -body {
+ .pw pane 1 -weight -4
+} -returnCodes 1 -match glob -result "-weight must be nonnegative"
+
+test panedwindow-3.2 "add pane -- errors" -body {
+ .pw add [ttk::label .pw.l] -weight -1
+} -returnCodes 1 -match glob -result "-weight must be nonnegative"
+
+
+test panedwindow-3.end "cleanup" -body { destroy .pw }
+
+
+test panedwindow-4.1 "forget" -body {
+ pack [ttk::panedwindow .pw -orient vertical] -expand true -fill both
+ .pw add [label .pw.l1 -text "L1"]
+ .pw add [label .pw.l2 -text "L2"]
+ .pw add [label .pw.l3 -text "L3"]
+ .pw add [label .pw.l4 -text "L4"]
+
+ update
+
+ .pw forget .pw.l1
+ .pw forget .pw.l2
+ .pw forget .pw.l3
+ .pw forget .pw.l4
+ update
+}
+
+test panedwindow-4.2 "forget forgotten" -body {
+ .pw forget .pw.l1
+} -returnCodes 1 -result ".pw.l1 is not managed by .pw"
+
+# checkorder $winlist --
+# Ensure that Y coordinates windows in $winlist are strictly increasing.
+#
+proc checkorder {winlist} {
+ set pos -1
+ set positions [list]
+ foreach win $winlist {
+ lappend positions [set nextpos [winfo y $win]]
+ if {$nextpos <= $pos} {
+ error "window $win out of order ($positions)"
+ }
+ set pos $nextpos
+ }
+}
+
+test panedwindow-4.3 "insert command" -body {
+ .pw insert end .pw.l1
+ .pw insert end .pw.l3
+ .pw insert 1 .pw.l2
+ .pw insert end .pw.l4
+
+ update;
+ checkorder {.pw.l1 .pw.l2 .pw.l3 .pw.l4}
+}
+
+test panedwindow-4.END "cleanup" -body {
+ destroy .pw
+}
+
+# See #1292219
+
+test panedwindow-5.1 "Propagate Map/Unmap state to children" -body {
+ set result [list]
+ pack [ttk::panedwindow .pw]
+ .pw add [ttk::button .pw.b]
+ update
+
+ lappend result [winfo ismapped .pw] [winfo ismapped .pw.b]
+
+ pack forget .pw
+ update
+ lappend result [winfo ismapped .pw] [winfo ismapped .pw.b]
+
+ set result
+} -result [list 1 1 0 0] -cleanup {
+ destroy .pw
+}
+
+### sashpos tests.
+#
+proc sashpositions {pw} {
+ set positions [list]
+ set npanes [llength [winfo children $pw]]
+ for {set i 0} {$i < $npanes - 1} {incr i} {
+ lappend positions [$pw sashpos $i]
+ }
+ return $positions
+}
+
+test paned-sashpos-setup "Setup for sash position test" -body {
+ ttk::style theme use default
+ ttk::style configure -sashthickness 5
+
+ ttk::panedwindow .pw
+ .pw add [frame .pw.f1 -width 20 -height 20]
+ .pw add [frame .pw.f2 -width 20 -height 20]
+ .pw add [frame .pw.f3 -width 20 -height 20]
+ .pw add [frame .pw.f4 -width 20 -height 20]
+
+ propagate-geometry
+ list [winfo reqwidth .pw] [winfo reqheight .pw]
+} -result [list 20 [expr {20*4 + 5*3}]]
+
+test paned-sashpos-attempt-restore "Attempt to set sash positions" -body {
+ # This is not expected to succeed, since .pw isn't large enough yet.
+ #
+ .pw sashpos 0 30
+ .pw sashpos 1 60
+ .pw sashpos 2 90
+
+ list [winfo reqwidth .pw] [winfo reqheight .pw] [sashpositions .pw]
+} -result [list 20 95 [list 0 5 10]]
+
+test paned-sashpos-restore "Set height then sash positions" -body {
+ # Setting sash positions after setting -height _should_ succeed.
+ #
+ .pw configure -height 120
+ .pw sashpos 0 30
+ .pw sashpos 1 60
+ .pw sashpos 2 90
+ list [winfo reqwidth .pw] [winfo reqheight .pw] [sashpositions .pw]
+} -result [list 20 120 [list 30 60 90]]
+
+test paned-sashpos-cleanup "Clean up" -body { destroy .pw }
+
+test paned-propagation-setup "Setup." -body {
+ ttk::style theme use default
+ ttk::style configure -sashthickness 5
+ wm geometry . {}
+ ttk::panedwindow .pw -orient vertical
+
+ frame .pw.f1 -width 100 -height 50
+ frame .pw.f2 -width 100 -height 50
+
+ list [winfo reqwidth .pw.f1] [winfo reqheight .pw.f1]
+} -result [list 100 50]
+
+test paned-propagation-1 "Initial request size" -body {
+ .pw add .pw.f1
+ .pw add .pw.f2
+ propagate-geometry
+ list [winfo reqwidth .pw] [winfo reqheight .pw]
+} -result [list 100 105]
+
+test paned-propagation-2 "Slave change before map" -body {
+ .pw.f1 configure -width 200 -height 100
+ propagate-geometry
+ list [winfo reqwidth .pw] [winfo reqheight .pw]
+} -result [list 200 155]
+
+test paned-propagation-3 "Map window" -body {
+ pack .pw -expand true -fill both
+ update
+ list [winfo width .pw] [winfo height .pw] [.pw sashpos 0]
+} -result [list 200 155 100]
+
+test paned-propagation-4 "Slave change after map, off-axis" -body {
+ .pw.f1 configure -width 100 ;# should be granted
+ propagate-geometry
+ list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0]
+} -result [list 100 155 100]
+
+test paned-propagation-5 "Slave change after map, on-axis" -body {
+ .pw.f1 configure -height 50 ;# should be denied
+ propagate-geometry
+ list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0]
+} -result [list 100 155 100]
+
+test paned-propagation-cleanup "Clean up." -body { destroy .pw }
+
+tcltest::cleanupTests
diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test
new file mode 100644
index 0000000..b9add86
--- /dev/null
+++ b/tests/ttk/progressbar.test
@@ -0,0 +1,85 @@
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+
+test progressbar-1.1 "Setup" -body {
+ ttk::progressbar .pb
+} -result .pb
+
+test progressbar-1.2 "Linked variable" -body {
+ set PB 50
+ .pb configure -variable PB
+ .pb cget -value
+} -result 50
+
+test progressbar-1.3 "Change linked variable" -body {
+ set PB 80
+ .pb cget -value
+} -result 80
+
+test progressbar-1.4 "Set linked variable to bad value" -body {
+ set PB "bogus"
+ .pb instate invalid
+} -result 1
+
+test progressbar-1.4.1 "Set linked variable back to a good value" -body {
+ set PB 80
+ .pb instate invalid
+} -result 0
+
+test progressbar-1.5 "Set -variable to illegal variable" -body {
+ set BAD "bogus"
+ .pb configure -variable BAD
+ .pb instate invalid
+} -result 1
+
+test progressbar-1.6 "Unset -variable" -body {
+ unset -nocomplain UNSET
+ .pb configure -variable UNSET
+ .pb instate disabled
+} -result 1
+
+test progressbar-2.0 "step command" -body {
+ .pb configure -variable {} ;# @@@
+ .pb configure -value 5 -maximum 10 -mode determinate
+ .pb step
+ .pb cget -value
+} -result 6.0
+
+test progressbar-2.1 "step command, with stepamount" -body {
+ .pb step 3
+ .pb cget -value
+} -result 9.0
+
+test progressbar-2.2 "step wraps at -maximum in determinate mode" -body {
+ .pb step
+ .pb cget -value
+} -result 0.0
+
+test progressbar-2.3 "step doesn't wrap in indeterminate mode" -body {
+ .pb configure -value 8 -maximum 10 -mode indeterminate
+ .pb step
+ .pb step
+ .pb step
+ .pb cget -value
+} -result 11.0
+
+test progressbar-2.4 "step with linked variable" -body {
+ .pb configure -variable PB ;# @@@
+ set PB 5
+ .pb step
+ set PB
+} -result 6.0
+
+test progressbar-2.5 "error in write trace" -body {
+ trace variable PB w { error "YIPES!" ;# }
+ .pb step
+ set PB ;# NOTREACHED
+} -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!"
+
+test progressbar-end "Cleanup" -body {
+ destroy .pb
+}
+
+tcltest::cleanupTests
diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test
new file mode 100644
index 0000000..ba02954
--- /dev/null
+++ b/tests/ttk/radiobutton.test
@@ -0,0 +1,48 @@
+#
+# ttk::radiobutton widget tests.
+#
+
+package require Tk
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test radiobutton-1.1 "Radiobutton check" -body {
+ pack \
+ [ttk::radiobutton .rb1 -text "One" -variable choice -value 1] \
+ [ttk::radiobutton .rb2 -text "Two" -variable choice -value 2] \
+ [ttk::radiobutton .rb3 -text "Three" -variable choice -value 3] \
+ ;
+}
+test radiobutton-1.2 "Radiobutton invoke" -body {
+ .rb1 invoke
+ set ::choice
+} -result 1
+
+test radiobutton-1.3 "Radiobutton state" -body {
+ .rb1 instate selected
+} -result 1
+
+test radiobutton-1.4 "Other radiobutton invoke" -body {
+ .rb2 invoke
+ set ::choice
+} -result 2
+
+test radiobutton-1.5 "Other radiobutton state" -body {
+ .rb2 instate selected
+} -result 1
+
+test radiobutton-1.6 "First radiobutton state" -body {
+ .rb1 instate selected
+} -result 0
+
+test radiobutton-1.7 "Unset radiobutton variable" -body {
+ unset ::choice
+ list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate]
+} -result {0 1 1}
+
+test radiobutton-1.8 "Reset radiobutton variable" -body {
+ set ::choice 2
+ list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate]
+} -result {1 0 0}
+
+tcltest::cleanupTests
diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test
new file mode 100644
index 0000000..0464273
--- /dev/null
+++ b/tests/ttk/scrollbar.test
@@ -0,0 +1,69 @@
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}]
+
+test scrollbar-swapout-1 "Use core scrollbars on OSX..." -constraints {
+ coreScrollbar
+} -body {
+ ttk::scrollbar .sb -command "yadda"
+ list [winfo class .sb] [.sb cget -command]
+} -result [list Scrollbar yadda] -cleanup {
+ destroy .sb
+}
+
+test scrollbar-swapout-2 "... unless -style is specified ..." -constraints {
+ coreScrollbar
+} -body {
+ ttk::style layout Vertical.Custom.TScrollbar \
+ [ttk::style layout Vertical.TScrollbar] ; # See #1833339
+ ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar
+ list [winfo class .sb] [.sb cget -command] [.sb cget -style]
+} -result [list TScrollbar yadda Custom.TScrollbar] -cleanup {
+ destroy .sb
+}
+
+test scrollbar-swapout-3 "... or -class." -constraints {
+ coreScrollbar
+} -body {
+ ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar
+ list [winfo class .sb] [.sb cget -command]
+} -result [list Custom.TScrollbar yadda] -cleanup {
+ destroy .sb
+}
+
+test scrollbar-1.0 "Setup" -body {
+ ttk::scrollbar .tsb
+} -result .tsb
+
+test scrollbar-1.1 "Set method" -body {
+ .tsb set 0.2 0.4
+ .tsb get
+} -result [list 0.2 0.4]
+
+test scrollbar-1.2 "Set orientation" -body {
+ .tsb configure -orient vertical
+ set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb]
+ expr {$h > $w}
+} -result 1
+
+test scrollbar-1.3 "Change orientation" -body {
+ .tsb configure -orient horizontal
+ set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb]
+ expr {$h < $w}
+} -result 1
+
+#
+# Scale tests:
+#
+
+test scale-1.0 "Self-destruction" -body {
+ trace variable v w { destroy .s ;# }
+ ttk::scale .s -variable v
+ pack .s ; update
+ .s set 1 ; update
+} -returnCodes 1 -match glob -result "*"
+
+tcltest::cleanupTests
+
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
new file mode 100644
index 0000000..3397e37
--- /dev/null
+++ b/tests/ttk/spinbox.test
@@ -0,0 +1,280 @@
+#
+# ttk::spinbox widget tests
+#
+
+package require Tk
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test spinbox-1.0 "Spinbox tests -- setup" -body {
+ ttk::spinbox .sb
+} -cleanup { destroy .sb } -result .sb
+
+test spinbox-1.1 "Bad -values list" -setup {
+ ttk::spinbox .sb
+} -body {
+ .sb configure -values "bad \{list"
+} -cleanup {
+ destroy .sb
+} -returnCodes error -result "unmatched open brace in list"
+
+test spinbox-1.3.1 "get retrieves value" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb set 50
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result 50
+
+test spinbox-1.3.2 "get retrieves value" -setup {
+ ttk::spinbox .sb -from 0 -to 100 -values 55
+} -body {
+ .sb set 55
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result 55
+
+test spinbox-1.4.1 "set changes value" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb set 33
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result 33
+
+test spinbox-1.4.2 "set changes value" -setup {
+ ttk::spinbox .sb -from 0 -to 100 -values 55
+} -body {
+ .sb set 33
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result 33
+
+
+test spinbox-1.6.1 "insert start" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb set 5
+ .sb insert 0 4
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result 45
+
+test spinbox-1.6.2 "insert end" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb set 5
+ .sb insert end 4
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result 54
+
+test spinbox-1.6.3 "insert invalid index" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb set 5
+ .sb insert 100 4
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result 54
+
+test spinbox-1.7.1 "-command option: set doesnt fire" -setup {
+ ttk::spinbox .sb -from 0 -to 100 -command {set ::spinbox_test 1}
+} -body {
+ set ::spinbox_test 0
+ .sb set 50
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+} -result 0
+
+test spinbox-1.7.2 "-command option: button handler will fire" -setup {
+ ttk::spinbox .sb -from 0 -to 100 -command {set ::spinbox_test 1}
+} -body {
+ set ::spinbox_test 0
+ .sb set 50
+ event generate .sb <<Increment>>
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+} -result 1
+
+test spinbox-1.8.1 "option -validate" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb configure -validate all
+ .sb cget -validate
+} -cleanup {
+ destroy .sb
+} -result {all}
+
+test spinbox-1.8.2 "option -validate" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb configure -validate key
+ .sb configure -validate focus
+ .sb configure -validate focusin
+ .sb configure -validate focusout
+ .sb configure -validate none
+ .sb cget -validate
+} -cleanup {
+ destroy .sb
+} -result {none}
+
+test spinbox-1.8.3 "option -validate" -setup {
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb configure -validate bogus
+} -cleanup {
+ destroy .sb
+} -returnCodes error -result {bad validate "bogus": must be all, key, focus, focusin, focusout, or none}
+
+test spinbox-1.8.4 "-validate option: " -setup {
+ set ::spinbox_test {}
+ ttk::spinbox .sb -from 0 -to 100
+} -body {
+ .sb configure -validate all -validatecommand {lappend ::spinbox_test %P}
+ pack .sb
+ .sb set 50
+ focus .sb
+ after 100 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+} -result {50}
+
+
+test spinbox-2.0 "current command -- unset should be 0" -constraints nyi -setup {
+ ttk::spinbox .sb -values [list a b c d e a]
+} -body {
+ .sb current
+} -cleanup {
+ destroy .sb
+} -result 0
+# @@@ for combobox, this is -1.
+
+test spinbox-2.1 "current command -- set index" -constraints nyi -setup {
+ ttk::spinbox .sb -values [list a b c d e a]
+} -body {
+ .sb current 5
+ .sb get
+} -cleanup {
+ destroy .sb
+} -result a
+
+test spinbox-2.2 "current command -- change -values" -constraints nyi -setup {
+ ttk::spinbox .sb -values [list a b c d e a]
+} -body {
+ .sb current 5
+ .sb configure -values [list c b a d e]
+ .sb current
+} -cleanup {
+ destroy .sb
+} -result 2
+
+test spinbox-2.3 "current command -- change value" -constraints nyi -setup {
+ ttk::spinbox .sb -values [list c b a d e]
+} -body {
+ .sb current 2
+ .sb set "b"
+ .sb current
+} -cleanup {
+ destroy .sb
+} -result 1
+
+test spinbox-2.4 "current command -- value not in list" -constraints nyi -setup {
+ ttk::spinbox .sb -values [list c b a d e]
+} -body {
+ .sb current 2
+ .sb set "z"
+ .sb current
+} -cleanup {
+ destroy .sb
+} -result -1
+
+# nostomp: NB intentional difference between ttk::spinbox and tk::spinbox;
+# see also #1439266
+#
+test spinbox-nostomp-1 "don't stomp on -variable (init; -from/to)" -body {
+ set SBV 55
+ ttk::spinbox .sb -textvariable SBV -from 0 -to 100 -increment 5
+ list $SBV [.sb get]
+} -cleanup {
+ unset SBV
+ destroy .sb
+} -result [list 55 55]
+
+test spinbox-nostomp-2 "don't stomp on -variable (init; -values)" -body {
+ set SBV Apr
+ ttk::spinbox .sb -textvariable SBV -values {Jan Feb Mar Apr May Jun Jul Aug}
+ list $SBV [.sb get]
+} -cleanup {
+ unset SBV
+ destroy .sb
+} -result [list Apr Apr]
+
+test spinbox-nostomp-3 "don't stomp on -variable (configure; -from/to)" -body {
+ set SBV 55
+ ttk::spinbox .sb
+ .sb configure -textvariable SBV -from 0 -to 100 -increment 5
+ list $SBV [.sb get]
+} -cleanup {
+ unset SBV
+ destroy .sb
+} -result [list 55 55]
+
+test spinbox-nostomp-4 "don't stomp on -variable (configure; -values)" -body {
+ set SBV Apr
+ ttk::spinbox .sb
+ .sb configure -textvariable SBV -values {Jan Feb Mar Apr May Jun Jul Aug}
+ list $SBV [.sb get]
+} -cleanup {
+ unset SBV
+ destroy .sb
+} -result [list Apr Apr]
+
+test spinbox-dieoctaldie-1 "Cope with leading zeros" -body {
+ # See SF#2358545 -- ttk::spinbox also affected
+ set secs 07
+ ttk::spinbox .sb -from 0 -to 59 -format %02.0f -textvariable secs
+
+ set result [list $secs]
+ event generate .sb <<Increment>>; lappend result $secs
+ event generate .sb <<Increment>>; lappend result $secs
+ event generate .sb <<Increment>>; lappend result $secs
+ event generate .sb <<Increment>>; lappend result $secs
+
+ event generate .sb <<Decrement>>; lappend result $secs
+ event generate .sb <<Decrement>>; lappend result $secs
+ event generate .sb <<Decrement>>; lappend result $secs
+ event generate .sb <<Decrement>>; lappend result $secs
+
+ set result
+} -result [list 07 08 09 10 11 10 09 08 07] -cleanup {
+ destroy .sb
+ unset secs
+}
+
+test spinbox-dieoctaldie-2 "Cope with general bad input" -body {
+ set result [list]
+ ttk::spinbox .sb -from 0 -to 100 -format %03.0f
+ .sb set asdfasdf ; lappend result [.sb get]
+ event generate .sb <<Increment>> ; lappend result [.sb get]
+ .sb set asdfasdf ; lappend result [.sb get]
+ event generate .sb <<Decrement>> ; lappend result [.sb get]
+} -result [list asdfasdf 000 asdfasdf 000] -cleanup {
+ destroy .sb
+}
+
+tcltest::cleanupTests
+
+# Local variables:
+# mode: tcl
+# End:
diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test
new file mode 100644
index 0000000..7f26e2f
--- /dev/null
+++ b/tests/ttk/treetags.test
@@ -0,0 +1,221 @@
+
+package require Tk
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+### treeview tag invariants:
+#
+
+proc assert {expr {message ""}} {
+ if {![uplevel 1 [list expr $expr]]} {
+ error "PANIC: $message ($expr failed)"
+ }
+}
+proc in {e l} { expr {[lsearch -exact $l $e] >= 0} }
+
+proc itemConstraints {tv item} {
+ # $tag in [$tv item $item -tags] <==> [$tv tag has $tag $item]
+ foreach tag [$tv item $item -tags] {
+ assert {[in $item [$tv tag has $tag]]}
+ }
+ foreach child [$tv children $item] {
+ itemConstraints $tv $child
+ }
+}
+
+proc treeConstraints {tv} {
+ # $item in [$tv tag has $tag] <==> [$tv tag has $tag $item]
+ #
+ foreach tag [$tv tag names] {
+ foreach item [$tv tag has $tag] {
+ assert {[in $tag [$tv item $item -tags]]}
+ }
+ }
+
+ itemConstraints $tv {}
+}
+#
+###
+
+test treetags-1.0 "Setup" -body {
+ set tv [ttk::treeview .tv]
+ .tv insert {} end -id item1 -text "Item 1"
+ pack .tv
+} -cleanup {
+ treeConstraints $tv
+}
+
+test treetags-1.1 "Bad tag list" -body {
+ $tv item item1 -tags {bad {list}here bad}
+ $tv item item1 -tags
+} -returnCodes error -result "list element in braces *" -match glob
+
+test treetags-1.2 "Good tag list" -body {
+ $tv item item1 -tags tag1
+ $tv item item1 -tags
+} -cleanup {
+ assert {[$tv tag has tag1 item1]}
+ treeConstraints $tv
+} -result [list tag1]
+
+test treetags-1.3 "tag has - test" -body {
+ $tv insert {} end -id item2 -text "Item 2" -tags tag2
+ set result [list]
+ foreach item {item1 item2} {
+ foreach tag {tag1 tag2 tag3} {
+ lappend result $item $tag [$tv tag has $tag $item]
+ }
+ }
+ set result
+} -cleanup {
+ treeConstraints $tv
+} -result [list \
+ item1 tag1 1 item1 tag2 0 item1 tag3 0 \
+ item2 tag1 0 item2 tag2 1 item2 tag3 0 ]
+
+test treetags-1.4 "tag has - query" -body {
+ list [$tv tag has tag1] [$tv tag has tag2] [$tv tag has tag3]
+} -cleanup {
+ treeConstraints $tv
+} -result [list [list item1] [list item2] [list]]
+
+test treetags-1.5 "tag add" -body {
+ $tv tag add tag3 {item1 item2}
+ list [$tv tag has tag1] [$tv tag has tag2] [$tv tag has tag3]
+} -cleanup {
+ treeConstraints $tv
+} -result [list [list item1] [list item2] [list item1 item2]]
+
+test treetags-1.6 "tag remove - list" -body {
+ $tv tag remove tag3 {item1 item2}
+ list [$tv tag has tag1] [$tv tag has tag2] [$tv tag has tag3]
+} -cleanup {
+ treeConstraints $tv
+} -result [list [list item1] [list item2] [list]]
+
+test treetags-1.7 "tag remove - all items" -body {
+ $tv tag remove tag1
+ list [$tv tag has tag1] [$tv tag has tag2] [$tv tag has tag3]
+} -cleanup {
+ treeConstraints $tv
+} -result [list [list] [list item2] [list]]
+
+test treetags-1.8 "tag names" -body {
+ lsort [$tv tag names]
+} -result [list tag1 tag2 tag3]
+
+test treetags-1.9 "tag names - tag added to item" -body {
+ $tv item item1 -tags tag4
+ lsort [$tv tag names]
+} -result [list tag1 tag2 tag3 tag4]
+
+test treetags-1.10 "tag names - tag configured" -body {
+ $tv tag configure tag5
+ lsort [$tv tag names]
+} -result [list tag1 tag2 tag3 tag4 tag5]
+
+test treetags-1.end "cleanup" -body {
+ $tv item item1 -tags tag1
+ $tv item item2 -tags tag2
+ list [$tv tag has tag1] [$tv tag has tag2] [$tv tag has tag3]
+} -cleanup {
+ treeConstraints $tv
+} -result [list [list item1] [list item2] [list]]
+
+test treetags-2.0 "tag bind" -body {
+ $tv tag bind tag1 <KeyPress> {set ::KEY %A}
+ $tv tag bind tag1 <KeyPress>
+} -cleanup {
+ treeConstraints $tv
+} -result {set ::KEY %A}
+
+test treetags-2.1 "Events delivered to tags" -body {
+ focus -force $tv ; update ;# needed so [event generate] delivers KeyPress
+ $tv focus item1
+ event generate $tv <KeyPress-a>
+ set ::KEY
+} -cleanup {
+ treeConstraints $tv
+} -result a
+
+test treetags-2.2 "Events delivered to correct tags" -body {
+ $tv tag bind tag2 <KeyPress> [list set ::KEY2 %A]
+
+ $tv focus item1
+ event generate $tv <KeyPress-b>
+ $tv focus item2
+ event generate $tv <KeyPress-c>
+
+ list $::KEY $::KEY2
+} -cleanup {
+ treeConstraints $tv
+} -result [list b c]
+
+test treetags-2.3 "Virtual events delivered to focus item" -body {
+ set ::bong 0
+ $tv tag bind tag2 <<Bing>> { incr bong }
+ $tv focus item2
+ event generate $tv <<Bing>>
+ $tv focus item1
+ event generate $tv <<Bing>>
+ set bong
+} -cleanup {
+ treeConstraints $tv
+} -result 1
+
+test treetags-2.4 "Bad events" -body {
+ $tv tag bind bad <Enter> { puts "Entered!" }
+} -returnCodes 1 -result "unsupported event <Enter>*" -match glob
+
+test treetags-3.0 "tag configure - set" -body {
+ $tv tag configure tag1 -foreground blue -background red
+} -cleanup {
+ treeConstraints $tv
+} -result {}
+
+test treetags-3.1 "tag configure - get" -body {
+ $tv tag configure tag1 -foreground
+} -cleanup {
+ treeConstraints $tv
+} -result blue
+
+# @@@ fragile test
+test treetags-3.2 "tag configure - enumerate" -body {
+ $tv tag configure tag1
+} -cleanup {
+ treeConstraints $tv
+} -result [list \
+ -text {} -image {} -anchor {} -background red -foreground blue -font {} \
+]
+
+# The next test exercises tag resource management.
+# If options are not properly freed, the message:
+# Test file error: "Font times 20 still in cache."
+# will show up on stderr at program exit.
+#
+test treetags-3.3 "tag configure - set font" -body {
+ $tv tag configure tag2 -font {times 20}
+}
+
+test treetags-3.4 "stomp tags in tag binding procedure" -body {
+ set result [list]
+ $tv tag bind rm1 <<Remove>> { lappend ::result rm1 [%W focus] <<Remove>> }
+ $tv tag bind rm2 <<Remove>> {
+ lappend ::result rm2 [%W focus] <<Remove>>
+ %W item [%W focus] -tags {tag1}
+ }
+ $tv tag bind rm3 <<Remove>> { lappend ::result rm3 [%W focus] <<Remove>> }
+
+ $tv item item1 -tags {rm1 rm2 rm3}
+ $tv focus item1
+ event generate $tv <<Remove>>
+ set result
+} -cleanup {
+ treeConstraints $tv
+} -result [list rm1 item1 <<Remove>> rm2 item1 <<Remove>> rm3 item1 <<Remove>>]
+
+#
+
+test treetags-end "Cleanup" -body { destroy $tv }
+
+tcltest::cleanupTests
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
new file mode 100644
index 0000000..d8bc65d
--- /dev/null
+++ b/tests/ttk/treeview.test
@@ -0,0 +1,639 @@
+#
+# [7Jun2005] TO CHECK: [$tv see {}] -- shouldn't work (at least, shouldn't do
+# what it currently does)
+#
+
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+# consistencyCheck --
+# Traverse the tree to make sure the item data structures
+# are properly linked.
+#
+# Since [$tv children] follows ->next links and [$tv index]
+# follows ->prev links, this should cover all invariants.
+#
+proc consistencyCheck {tv {item {}}} {
+ set i 0;
+ foreach child [$tv children $item] {
+ assert {[$tv parent $child] == $item} "parent $child = $item"
+ assert {[$tv index $child] == $i} "index $child [$tv index $child]=$i"
+ incr i
+ consistencyCheck $tv $child
+ }
+}
+
+proc assert {expr {message ""}} {
+ if {![uplevel 1 [list expr $expr]]} {
+ set error "PANIC! PANIC! PANIC: $message ($expr failed)"
+ puts stderr $error
+ error $error
+ }
+}
+
+test treeview-0 "treeview test - setup" -body {
+ ttk::treeview .tv -columns {a b c}
+ pack .tv -expand true -fill both
+ update
+}
+
+test treeview-1.1 "columns" -body {
+ .tv configure -columns {a b c}
+}
+
+test treeview-1.2 "Bad columns" -body {
+ #.tv configure -columns {illegal "list"value}
+ ttk::treeview .badtv -columns {illegal "list"value}
+} -returnCodes 1 -result "list element in quotes followed by*" -match glob
+
+test treeview-1.3 "bad displaycolumns" -body {
+ .tv configure -displaycolumns {a b d}
+} -returnCodes 1 -result "Invalid column index d"
+
+test treeview-1.4 "more bad displaycolumns" -body {
+ .tv configure -displaycolumns {1 2 3}
+} -returnCodes 1 -result "Column index 3 out of bounds"
+
+test treeview-1.5 "Don't forget to check negative numbers" -body {
+ .tv configure -displaycolumns {1 -2 3}
+} -returnCodes 1 -result "Column index -2 out of bounds"
+
+# Item creation.
+#
+test treeview-2.1 "insert -- not enough args" -body {
+ .tv insert
+} -returnCodes 1 -result "wrong # args: *" -match glob
+
+test treeview-2.3 "insert -- bad integer index" -body {
+ .tv insert {} badindex
+} -returnCodes 1 -result "expected integer *" -match glob
+
+test treeview-2.4 "insert -- bad parent node" -body {
+ .tv insert badparent end
+} -returnCodes 1 -result "Item badparent not found" -match glob
+
+test treeview-2.5 "insert -- finaly insert a node" -body {
+ .tv insert {} end -id newnode -text "New node"
+} -result newnode
+
+test treeview-2.6 "insert -- make sure node was inserted" -body {
+ .tv children {}
+} -result [list newnode]
+
+test treeview-2.7 "insert -- prevent duplicate node names" -body {
+ .tv insert {} end -id newnode
+} -returnCodes 1 -result "Item newnode already exists"
+
+test treeview-2.8 "insert -- new node at end" -body {
+ .tv insert {} end -id lastnode
+ consistencyCheck .tv
+ .tv children {}
+} -result [list newnode lastnode]
+
+consistencyCheck .tv
+
+test treeview-2.9 "insert -- new node at beginning" -body {
+ .tv insert {} 0 -id firstnode
+ consistencyCheck .tv
+ .tv children {}
+} -result [list firstnode newnode lastnode]
+
+test treeview-2.10 "insert -- one more node" -body {
+ .tv insert {} 2 -id onemore
+ consistencyCheck .tv
+ .tv children {}
+} -result [list firstnode newnode onemore lastnode]
+
+test treeview-2.11 "insert -- and another one" -body {
+ .tv insert {} 2 -id anotherone
+ consistencyCheck .tv
+ .tv children {}
+} -result [list firstnode newnode anotherone onemore lastnode]
+
+test treeview-2.12 "insert -- one more at end" -body {
+ .tv insert {} end -id newlastone
+ consistencyCheck .tv
+ .tv children {}
+} -result [list firstnode newnode anotherone onemore lastnode newlastone]
+
+test treeview-2.13 "insert -- one more at beginning" -body {
+ .tv insert {} 0 -id newfirstone
+ consistencyCheck .tv
+ .tv children {}
+} -result [list newfirstone firstnode newnode anotherone onemore lastnode newlastone]
+
+test treeview-2.14 "insert -- bad options" -body {
+ .tv insert {} end -badoption foo
+} -returnCodes 1 -result {unknown option "-badoption"}
+
+test treeview-2.15 "insert -- at position 0 w/no children" -body {
+ .tv insert newnode 0 -id newnode.n2 -text "Foo"
+ .tv children newnode
+} -result newnode.n2 ;# don't crash
+
+test treeview-2.16 "insert -- insert way past end" -body {
+ .tv insert newnode 99 -id newnode.n3 -text "Foo"
+ consistencyCheck .tv
+ .tv children newnode
+} -result [list newnode.n2 newnode.n3]
+
+test treeview-2.17 "insert -- insert before beginning" -body {
+ .tv insert newnode -1 -id newnode.n1 -text "Foo"
+ consistencyCheck .tv
+ .tv children newnode
+} -result [list newnode.n1 newnode.n2 newnode.n3]
+
+###
+#
+test treeview-3.1 "parent" -body {
+ .tv parent newnode.n1
+} -result newnode
+test treeview-3.2 "parent - top-level node" -body {
+ .tv parent newnode
+} -result {}
+test treeview-3.3 "parent - root node" -body {
+ .tv parent {}
+} -result {}
+test treeview-3.4 "index" -body {
+ list [.tv index newnode.n3] [.tv index newnode.n2] [.tv index newnode.n1]
+} -result [list 2 1 0]
+test treeview-3.5 "index - exhaustive test" -body {
+ set result [list]
+ foreach item [.tv children {}] {
+ lappend result [.tv index $item]
+ }
+ set result
+} -result [list 0 1 2 3 4 5 6]
+
+test treeview-3.6 "detach" -body {
+ .tv detach newnode
+ consistencyCheck .tv
+ .tv children {}
+} -result [list newfirstone firstnode anotherone onemore lastnode newlastone]
+# XREF: treeview-2.13
+
+test treeview-3.7 "detach didn't screw up internal links" -body {
+ consistencyCheck .tv
+ set result [list]
+ foreach item [.tv children {}] {
+ lappend result [.tv index $item]
+ }
+ set result
+} -result [list 0 1 2 3 4 5]
+
+test treeview-3.8 "detached node has no parent, index 0" -body {
+ list [.tv parent newnode] [.tv index newnode]
+} -result [list {} 0]
+# @@@ Can't distinguish detached nodes from first root node
+
+test treeview-3.9 "detached node's children undisturbed" -body {
+ .tv children newnode
+} -result [list newnode.n1 newnode.n2 newnode.n3]
+
+test treeview-3.10 "detach is idempotent" -body {
+ .tv detach newnode
+ consistencyCheck .tv
+ .tv children {}
+} -result [list newfirstone firstnode anotherone onemore lastnode newlastone]
+
+test treeview-3.11 "Can't detach root item" -body {
+ .tv detach [list {}]
+ update
+ consistencyCheck .tv
+} -returnCodes 1 -result "Cannot detach root item"
+consistencyCheck .tv
+
+test treeview-3.12 "Reattach" -body {
+ .tv move newnode {} end
+ consistencyCheck .tv
+ .tv children {}
+} -result [list newfirstone firstnode anotherone onemore lastnode newlastone newnode]
+
+# Bug # ?????
+test treeview-3.13 "Re-reattach" -body {
+ .tv move newnode {} end
+ consistencyCheck .tv
+ .tv children {}
+} -result [list newfirstone firstnode anotherone onemore lastnode newlastone newnode]
+
+catch {
+ .tv insert newfirstone end -id x1
+ .tv insert newfirstone end -id x2
+ .tv insert newfirstone end -id x3
+}
+
+test treeview-3.14 "Duplicated entry in children list" -body {
+ .tv children newfirstone [list x3 x1 x2 x3]
+ # ??? Maybe this should raise an error?
+ consistencyCheck .tv
+ .tv children newfirstone
+} -result [list x3 x1 x2]
+
+test treeview-3.14.1 "Duplicated entry in children list" -body {
+ .tv children newfirstone [list x1 x2 x3 x3 x2 x1]
+ consistencyCheck .tv
+ .tv children newfirstone
+} -result [list x1 x2 x3]
+
+test treeview-3.15 "Consecutive duplicate entries in children list" -body {
+ .tv children newfirstone [list x1 x2 x2 x3]
+ consistencyCheck .tv
+ .tv children newfirstone
+} -result [list x1 x2 x3]
+
+test treeview-3.16 "Insert child after self" -body {
+ .tv move x2 newfirstone 1
+ consistencyCheck .tv
+ .tv children newfirstone
+} -result [list x1 x2 x3]
+
+test treeview-3.17 "Insert last child after self" -body {
+ .tv move x3 newfirstone 2
+ consistencyCheck .tv
+ .tv children newfirstone
+} -result [list x1 x2 x3]
+
+test treeview-3.18 "Insert last child after end" -body {
+ .tv move x3 newfirstone 3
+ consistencyCheck .tv
+ .tv children newfirstone
+} -result [list x1 x2 x3]
+
+test treeview-4.1 "opened - initial state" -body {
+ .tv item newnode -open
+} -result 0
+test treeview-4.2 "opened - open node" -body {
+ .tv item newnode -open 1
+ .tv item newnode -open
+} -result 1
+test treeview-4.3 "opened - closed node" -body {
+ .tv item newnode -open 0
+ .tv item newnode -open
+} -result 0
+
+test treeview-5.1 "item -- error checks" -body {
+ .tv item newnode -text "Bad values" -values "{bad}list"
+} -returnCodes 1 -result "list element in braces followed by*" -match glob
+
+test treeview-5.2 "item -- error leaves options unchanged " -body {
+ .tv item newnode -text
+} -result "New node"
+
+test treeview-5.3 "Heading" -body {
+ .tv heading #0 -text "Heading"
+}
+
+test treeview-5.4 "get cell" -body {
+ set l [list a b c]
+ .tv item newnode -values $l
+ .tv set newnode 1
+} -result b
+
+test treeview-5.5 "set cell" -body {
+ .tv set newnode 1 XXX
+ .tv item newnode -values
+} -result [list a XXX c]
+
+test treeview-5.6 "set illegal cell" -body {
+ .tv set newnode #0 YYY
+} -returnCodes 1 -result "Display column #0 cannot be set"
+
+test treeview-5.7 "set illegal cell" -body {
+ .tv set newnode 3 YY ;# 3 == current #columns
+} -returnCodes 1 -result "Column index 3 out of bounds"
+
+test treeview-5.8 "set display columns" -body {
+ .tv configure -displaycolumns [list 2 1 0]
+ .tv set newnode #1 X
+ .tv set newnode #2 Y
+ .tv set newnode #3 Z
+ .tv item newnode -values
+} -result [list Z Y X]
+
+test treeview-5.9 "display columns part 2" -body {
+ list [.tv column #1 -id] [.tv column #2 -id] [.tv column #3 -id]
+} -result [list c b a]
+
+test treeview-5.10 "cannot set column -id" -body {
+ .tv column #1 -id X
+} -returnCodes 1 -result "Attempt to change read-only option"
+
+test treeview-5.11 "get" -body {
+ .tv set newnode #1
+} -result X
+
+test treeview-5.12 "get dictionary" -body {
+ .tv set newnode
+} -result [list a Z b Y c X]
+
+test treeview-5.13 "get, no value" -body {
+ set newitem [.tv insert {} end]
+ set result [.tv set $newitem #1]
+ .tv delete $newitem
+ set result
+} -result {}
+
+
+test treeview-6.1 "deletion - setup" -body {
+ .tv insert {} end -id dtest
+ foreach id [list a b c d e] {
+ .tv insert dtest end -id $id
+ }
+ .tv children dtest
+} -result [list a b c d e]
+
+test treeview-6.1.1 "delete" -body {
+ .tv delete b
+ consistencyCheck .tv
+ list [.tv exists b] [.tv children dtest]
+} -result [list 0 [list a c d e]]
+
+consistencyCheck .tv
+
+test treeview-6.2 "delete - duplicate items in list" -body {
+ .tv delete [list a e a e]
+ consistencyCheck .tv
+ .tv children dtest
+} -result [list c d]
+
+test treeview-6.3 "delete - descendants removed" -body {
+ .tv insert c end -id c1
+ .tv insert c end -id c2
+ .tv insert c1 end -id c11
+ consistencyCheck .tv
+ .tv delete c
+ consistencyCheck .tv
+ list [.tv exists c] [.tv exists c1] [.tv exists c2] [.tv exists c11]
+} -result [list 0 0 0 0]
+
+test treeview-6.4 "delete - delete parent and descendants" -body {
+ .tv insert dtest end -id c
+ .tv insert c end -id c1
+ .tv insert c end -id c2
+ .tv insert c1 end -id c11
+ consistencyCheck .tv
+ .tv delete [list c c1 c2 c11]
+ consistencyCheck .tv
+ list [.tv exists c] [.tv exists c1] [.tv exists c2] [.tv exists c11]
+} -result [list 0 0 0 0]
+
+test treeview-6.5 "delete - delete descendants and parent" -body {
+ .tv insert dtest end -id c
+ .tv insert c end -id c1
+ .tv insert c end -id c2
+ .tv insert c1 end -id c11
+ consistencyCheck .tv
+ .tv delete [list c11 c1 c2 c]
+ consistencyCheck .tv
+ list [.tv exists c] [.tv exists c1] [.tv exists c2] [.tv exists c11]
+} -result [list 0 0 0 0]
+
+test treeview-6.6 "delete - end" -body {
+ consistencyCheck .tv
+ .tv children dtest
+} -result [list d]
+
+test treeview-7.1 "move" -body {
+ .tv insert d end -id d1
+ .tv insert d end -id d2
+ .tv insert d end -id d3
+ .tv move d3 d 0
+ consistencyCheck .tv
+ .tv children d
+} -result [list d3 d1 d2]
+
+test treeview-7.2 "illegal move" -body {
+ .tv move d d2 end
+} -returnCodes 1 -result "Cannot insert d as a descendant of d2"
+
+test treeview-7.3 "illegal move has no effect" -body {
+ consistencyCheck .tv
+ .tv children d
+} -result [list d3 d1 d2]
+
+test treeview-7.4 "Replace children" -body {
+ .tv children d [list d3 d2 d1]
+ consistencyCheck .tv
+ .tv children d
+} -result [list d3 d2 d1]
+
+test treeview-7.5 "replace children - precondition" -body {
+ # Just check to make sure the test suite so far has left
+ # us in the state we expect to be in:
+ list [.tv parent newnode] [.tv children newnode]
+} -result [list {} [list newnode.n1 newnode.n2 newnode.n3]]
+
+test treeview-7.6 "Replace children - illegal move" -body {
+ .tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3]
+} -returnCodes 1 -result "Cannot insert newnode.n1 as a descendant of newnode.n1"
+
+consistencyCheck .tv
+
+test treeview-8.0 "Selection set" -body {
+ .tv selection set [list newnode.n1 newnode.n3 newnode.n2]
+ .tv selection
+} -result [list newnode.n1 newnode.n2 newnode.n3]
+
+test treeview-8.1 "Selection add" -body {
+ .tv selection add [list newnode]
+ .tv selection
+} -result [list newnode newnode.n1 newnode.n2 newnode.n3]
+
+test treeview-8.2 "Selection toggle" -body {
+ .tv selection toggle [list newnode.n2 d3]
+ .tv selection
+} -result [list newnode newnode.n1 newnode.n3 d3]
+
+test treeview-8.3 "Selection remove" -body {
+ .tv selection remove [list newnode.n2 d3]
+ .tv selection
+} -result [list newnode newnode.n1 newnode.n3]
+
+test treeview-8.4 "Selection - clear" -body {
+ .tv selection set {}
+ .tv selection
+} -result {}
+
+test treeview-8.5 "Selection - bad operation" -body {
+ .tv selection badop foo
+} -returnCodes 1 -match glob -result {bad selection operation "badop": must be *}
+
+### NEED: more tests for see/yview/scrolling
+
+proc scrollcallback {args} {
+ set ::scrolldata $args
+}
+test treeview-9.0 "scroll callback - empty tree" -body {
+ .tv configure -yscrollcommand scrollcallback
+ .tv delete [.tv children {}]
+ update
+ set ::scrolldata
+} -result [list 0.0 1.0]
+
+### identify tests:
+#
+proc identify* {tv comps args} {
+ foreach {x y} $args {
+ foreach comp $comps {
+ lappend result [$tv identify $comp $x $y]
+ }
+ }
+ return $result
+}
+
+# get list of column IDs from list of display column ids.
+#
+proc columnids {tv dcols} {
+ set result [list]
+ foreach dcol $dcols {
+ if {[catch {
+ lappend result [$tv column $dcol -id]
+ }]} {
+ lappend result ERROR
+ }
+ }
+ return $result
+}
+
+test treeview-identify-setup "identify series - setup" -body {
+ destroy .tv
+ ttk::setTheme default
+ ttk::treeview .tv -columns [list A B C]
+ .tv insert {} end -id branch -text branch -open true
+ .tv insert branch end -id item1 -text item1
+ .tv insert branch end -id item2 -text item2
+ .tv insert branch end -id item3 -text item3
+
+ .tv column #0 -width 50 ;# 0-50
+ .tv column A -width 50 ;# 50-100
+ .tv column B -width 50 ;# 100-150
+ .tv column C -width 50 ;# 150-200 (plus slop for margins)
+
+ wm geometry . {} ; pack .tv ; update
+}
+
+test treeview-identify-1 "identify heading" -body {
+ .tv configure -show {headings tree}
+ update idletasks
+ identify* .tv {region column} 10 10
+} -result [list heading #0]
+
+test treeview-identify-2 "identify columns" -body {
+ .tv configure -displaycolumns #all
+ update idletasks
+ columnids .tv [identify* .tv column 25 10 75 10 125 10 175 10]
+} -result [list {} A B C]
+
+test treeview-identify-3 "reordered columns" -body {
+ .tv configure -displaycolumns {B A C}
+ update idletasks
+ columnids .tv [identify* .tv column 25 10 75 10 125 10 175 10]
+} -result [list {} B A C]
+
+test treeview-identify-4 "no tree column" -body {
+ .tv configure -displaycolumns #all -show {headings}
+ update idletasks
+ identify* .tv {region column} 25 10 75 10 125 10 175 10
+} -result [list heading #1 heading #2 heading #3 nothing {}]
+
+# Item height in default theme is 20px
+test treeview-identify-5 "vertical scan - no headings" -body {
+ .tv configure -displaycolumns #all -show {tree}
+ update idletasks
+ identify* .tv {region item} 25 10 25 30 25 50 25 70 25 90
+} -result [list tree branch tree item1 tree item2 tree item3 nothing {}]
+
+test treeview-identify-6 "vertical scan - with headings" -body {
+ .tv configure -displaycolumns #all -show {tree headings}
+ update idletasks
+ identify* .tv {region item} 25 10 25 30 25 50 25 70 25 90
+} -result [list heading {} tree branch tree item1 tree item2 tree item3]
+
+test treeview-identify-7 "vertical scan - headings, no tree" -body {
+ .tv configure -displaycolumns #all -show {headings}
+ update idletasks
+ identify* .tv {region item} 25 10 25 30 25 50 25 70 25 90
+} -result [list heading {} cell branch cell item1 cell item2 cell item3]
+
+# In default theme, -indent and -itemheight both 20px
+# Disclosure element name is "Treeitem.indicator"
+set disclosure "*.indicator"
+test treeview-identify-8 "identify element" -body {
+ .tv configure -show {tree}
+ .tv insert branch 0 -id branch2 -open true
+ .tv insert branch2 0 -id branch3 -open true
+ .tv insert branch3 0 -id leaf3
+ update idletasks;
+ identify* .tv {item element} 10 10 30 30 50 50
+} -match glob -result [list \
+ branch $disclosure branch2 $disclosure branch3 $disclosure]
+
+# See #2381555
+test treeview-identify-9 "identify works when horizontally scrolled" -setup {
+ .tv configure -show {tree headings}
+ foreach column {#0 A B C} {
+ .tv column $column -stretch 0 -width 50
+ }
+ place .tv -x 0 -y 0 -width 100
+} -body {
+ set result [list]
+ foreach xoffs {0 50 100} {
+ .tv xview $xoffs ; update
+ lappend result [identify* .tv {region column} 10 10 60 10]
+ }
+ set result
+} -result [list \
+ [list heading #0 heading #1] \
+ [list heading #1 heading #2] \
+ [list heading #2 heading #3] ]
+
+test treeview-identify-cleanup "identify - cleanup" -body {
+ destroy .tv
+}
+
+### NEED: tests for focus item, selection
+
+### Misc. tests:
+
+destroy .tv
+test treeview-10.1 "Root node properly initialized (#1541739)" -setup {
+ ttk::treeview .tv
+ .tv insert {} end -id a
+ .tv see a
+} -cleanup {
+ destroy .tv
+}
+
+test treeview-3006842 "Null bindings" -setup {
+ ttk::treeview .tv -show tree
+} -body {
+ .tv tag bind empty <ButtonPress-1> {}
+ .tv insert {} end -text "Click me" -tags empty
+ event generate .tv <ButtonPress-1> -x 10 -y 10
+ .tv tag bind empty
+} -result {} -cleanup {
+ destroy .tv
+}
+
+test treeview-3085489-1 "tag add, no -tags" -setup {
+ ttk::treeview .tv
+} -body {
+ set item [.tv insert {} end]
+ .tv tag add foo $item
+ .tv item $item -tags
+} -cleanup {
+ destroy .tv
+} -result [list foo]
+
+test treeview-3085489-2 "tag remove, no -tags" -setup {
+ ttk::treeview .tv
+} -body {
+ set item [.tv insert {} end]
+ .tv tag remove foo $item
+ .tv item $item -tags
+} -cleanup {
+ destroy .tv
+} -result [list]
+
+tcltest::cleanupTests
diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test
new file mode 100644
index 0000000..def709e
--- /dev/null
+++ b/tests/ttk/ttk.test
@@ -0,0 +1,651 @@
+
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+proc skip args {}
+proc ok {} { return }
+
+variable widgetClasses {
+ button checkbutton radiobutton menubutton label entry
+ frame labelframe scrollbar
+ notebook progressbar combobox separator
+ panedwindow treeview sizegrip
+ scale
+}
+
+proc bgerror {error} {
+ variable bgerror $error
+ variable bgerrorInfo $::errorInfo
+ variable bgerrorCode $::errorCode
+}
+
+# Self-destruct tests.
+# Do these early, so any memory corruption has a longer time to cause a crash.
+#
+proc selfdestruct {w args} {
+ destroy $w
+}
+test ttk-6.1 "Self-destructing checkbutton" -body {
+ pack [ttk::checkbutton .sd -text "Self-destruction" -variable ::sd]
+ trace variable sd w [list selfdestruct .sd]
+ update
+ .sd invoke
+} -returnCodes 1
+test ttk-6.2 "Checkbutton self-destructed" -body {
+ winfo exists .sd
+} -result 0
+
+# test ttk-6.3 not applicable [see #2175411]
+
+test ttk-6.4 "Destroy widget in configure" -setup {
+ set OUCH ouch
+ trace variable OUCH r { kill.b }
+ proc kill.b {args} { destroy .b }
+} -cleanup {
+ unset OUCH
+} -body {
+ pack [ttk::checkbutton .b]
+ set rc [catch { .b configure -variable OUCH } msg]
+ list $rc $msg [winfo exists .b] [info commands .b]
+} -result [list 1 "Widget has been destroyed" 0 {}]
+
+test ttk-6.5 "Clean up -textvariable traces" -body {
+ foreach class {ttk::button ttk::checkbutton ttk::radiobutton} {
+ $class .b1 -textvariable V
+ set V "asdf"
+ destroy .b1
+ set V ""
+ }
+}
+
+test ttk-6.6 "Bad color spec in styles" -body {
+ pack [ttk::button .b1 -text Hi!]
+ ttk::style configure TButton -foreground badColor
+ event generate .b1 <Expose>
+ update
+ ttk::style configure TButton -foreground black
+ destroy .b1
+ set ::bgerror
+} -result {unknown color name "badColor"}
+
+test ttk-6.7 "Basic destruction test" -body {
+ foreach widget $widgetClasses {
+ ttk::$widget .w
+ pack .w
+ destroy .w
+ }
+}
+
+test ttk-6.8 "Button command removes itself" -body {
+ ttk::button .b -command ".b configure -command {}; set ::A {it worked}"
+ .b invoke
+ destroy .b
+ set ::A
+} -result {it worked}
+
+test ttk-6.9 "Bad font spec in styles" -setup {
+ ttk::style theme create badfont -settings {
+ ttk::style configure . -font {Helvetica 12 Bogus}
+ }
+ ttk::style theme use badfont
+} -cleanup {
+ ttk::style theme use default
+} -body {
+ pack [ttk::label .l -text Hi! -font {}]
+ event generate .l <Expose>
+ update
+ destroy .l
+ set ::bgerror
+} -result {unknown font style "Bogus"}
+
+test ttk-construction-failure-1 "Excercise construction failure path" -setup {
+ option add *TLabel.cursor badCursor 1
+} -cleanup {
+ option add *TLabel.cursor {} 1
+} -body {
+ catch {ttk::label .l} errmsg
+ list $errmsg [info commands .l] [winfo exists .l]
+} -result [list {bad cursor spec "badCursor"} {} 0]
+
+test ttk-construction-failure-2 "Destroy widget in constructor" -setup {
+ set OUCH ouch
+ trace variable OUCH r { kill.b }
+ proc kill.b {args} { destroy .b }
+} -cleanup {
+ unset OUCH
+} -body {
+ list \
+ [catch { ttk::checkbutton .b -variable OUCH } msg] \
+ $msg \
+ [winfo exists .b] \
+ [info commands .b] \
+ ;
+} -result [list 1 "Widget has been destroyed" 0 {}]
+
+test ttk-selfdestruct-ok-1 "Intentional self-destruction" -body {
+ # see #2298720
+ toplevel .t
+ ttk::button .t.b -command [list destroy .t]
+ .t.b invoke
+ list [winfo exists .t] [winfo exists .t.b]
+} -result [list 0 0]
+
+#
+# Basic tests.
+#
+test ttk-1.1 "Create button" -body {
+ pack [ttk::button .t] -expand true -fill both
+ update
+}
+
+test ttk-1.2 "Check style" -body {
+ .t cget -style
+} -result {}
+
+test ttk-1.3 "Set bad style" -body {
+ .t configure -style "nosuchstyle"
+} -returnCodes 1 -result {Layout nosuchstyle not found}
+
+test ttk-1.4 "Original style preserved" -body {
+ .t cget -style
+} -result ""
+
+proc checkstate {w} {
+ foreach statespec {
+ {!active !disabled}
+ {!active disabled}
+ {active !disabled}
+ {active disabled}
+ active
+ disabled
+ } {
+ lappend result [$w instate $statespec]
+ }
+ set result
+}
+
+# NB: this will fail if the top-level window pops up underneath the cursor
+test ttk-2.0 "Check state" -body {
+ checkstate .t
+} -result [list 1 0 0 0 0 0]
+
+test ttk-2.1 "Change state" -body {
+ .t state active
+} -result !active
+
+test ttk-2.2 "Check state again" -body {
+ checkstate .t
+} -result [list 0 0 1 0 1 0]
+
+test ttk-2.3 "Change state again" -body {
+ .t state {!active disabled}
+} -result {active !disabled}
+
+test ttk-2.4 "Check state again" -body {
+ checkstate .t
+} -result [list 0 1 0 0 0 1]
+
+test ttk-2.5 "Change state again" -body {
+ .t state !disabled
+} -result {disabled}
+
+test ttk-2.6 "instate scripts, false" -body {
+ set x 0
+ .t instate disabled { set x 1 }
+ set x
+} -result 0
+
+test ttk-2.7 "instate scripts, true" -body {
+ set x 0
+ .t instate !disabled { set x 1 }
+ set x
+} -result 1
+
+test ttk-2.8 "bug 3223850: button state disabled during click" -setup {
+ destroy .b
+ set ttk28 {}
+ pack [ttk::button .b -command {set ::ttk28 failed}]
+} -body {
+ bind .b <ButtonPress-1> {after 0 {.b configure -state disabled}}
+ after 1 {event generate .b <ButtonPress-1>}
+ after 20 {event generate .b <ButtonRelease-1>}
+ set aid [after 100 {set ::ttk28 [.b instate {disabled !pressed}]}]
+ vwait ::ttk28
+ after cancel $aid
+ set ttk28
+} -cleanup {
+ destroy .b
+ unset -nocomplain ttk28 aid
+} -result 1
+
+foreach wc $widgetClasses {
+ test ttk-coreoptions-$wc "$wc has all core options" -body {
+ ttk::$wc .w
+ foreach option {
+ -class
+ -style
+ -cursor
+ -takefocus
+ } {
+ .w cget $option
+ }
+ destroy .w
+ }
+}
+
+# misc. error detection
+test ttk-3.0 "Bad option" -body {
+ ttk::button .bad -badoption foo
+} -returnCodes 1 -result {unknown option "-badoption"} -match glob
+
+test ttk-3.1 "Make sure widget command not created" -body {
+ .bad state disabled
+} -returnCodes 1 -result {invalid command name ".bad"} -match glob
+
+test ttk-3.2 "Propagate errors from variable traces" -body {
+ set A 0
+ trace add variable A write {error "failure" ;# }
+ ttk::checkbutton .cb -variable A
+ .cb invoke
+} -cleanup {
+ unset ::A ; destroy .cb
+} -returnCodes error -result {can't set "A": failure}
+
+test ttk-3.3 "Constructor failure with cursor" -body {
+ ttk::button .b -cursor bottom_right_corner -style BadStyle
+} -returnCodes 1 -result "Layout BadStyle not found"
+
+test ttk-3.4 "SF#2009213" -body {
+ ttk::style configure TScale -sliderrelief {}
+ pack [ttk::scale .s]
+ update
+} -cleanup {
+ ttk::style configure TScale -sliderrelief raised
+ destroy .s
+}
+
+# Test resource allocation
+# (@@@ "-font" is a compatibility option now, so tests 4.1-4.3
+# don't really test anything useful at the moment.)
+#
+
+test ttk-4.0 "Setup" -body {
+ catch { destroy .t }
+ pack [ttk::label .t -text "Button 1"]
+ testConstraint fontOption [expr ![catch { set prevFont [.t cget -font] }]]
+ ok
+}
+
+test ttk-4.1 "Change font" -constraints fontOption -body {
+ .t configure -font "Helvetica 18 bold"
+}
+test ttk-4.2 "Check font" -constraints fontOption -body {
+ .t cget -font
+} -result "Helvetica 18 bold"
+
+test ttk-4.3 "Restore font" -constraints fontOption -body {
+ .t configure -font $prevFont
+}
+
+test ttk-4.4 "Bad resource specifications" -body {
+ ttk::style theme settings alt {
+ ttk::style configure TButton -font {Bad font}
+ # @@@ it would be best to raise an error at this point,
+ # @@@ but that's not really feasible in the current framework.
+ }
+ pack [ttk::button .tb1 -text "Ouch"]
+ ttk::style theme use alt
+ update;
+ # As long as we haven't crashed, everything's OK
+ ttk::style theme settings alt {
+ ttk::style configure TButton -font TkDefaultFont
+ }
+ ttk::style theme use default
+ destroy .tb1
+}
+
+#
+# -compound tests:
+#
+variable iconData \
+{R0lGODlhIAAgAKIAANnZ2YQAAP8AAISEhP///////////////yH5BAEAAAAALAAAAAAgACAA
+AAP/CLoMGLqKoMvtGIqiqxEYCLrcioGiyxwIusyBgaLLLRiBoMsQKLrcjYGgu4Giy+2CAkFX
+A0WX2wXFIOgGii7trkCEohsDCACBoktEKLpKhISiGwAIECiqSKooukiqKKoxgACBooukKiIo
+SKooujGDECi6iqQqsopEV2MQAkV3kXQZRXdjEAJFl5F0FUWXY3ACRZcFSRdFlyVwJlB0WZB0
+UXRZAmcCRZeRdBVFl2NwAkV3kXQZRXdjcAJFV5FURVaR6GoMDgSKLpKqiKAgqaLoxgwOBIoq
+kiqKLpIqimrM4ECg6BIRiq4SIaHoxgyCBoou7a5AhKIbMzgAAIGiy+2CTWJmBhAAAkWX2wXF
+zCDoBooud2PMDIKuRqDocgtGzMwg6O4Eii5z4Kgi6DIMhqLoagQGjiqCLvPgYOgqji6CLrfi
+6DIj6HI7jq4i6DIkADs=}
+
+variable compoundStrings {text image center top bottom left right none}
+
+if {0} {
+ proc now {} { set ::now [clock clicks -milliseconds] }
+ proc tick {} { puts -nonewline stderr "+" ; flush stderr }
+ proc tock {} {
+ set then $::now; set ::now [clock clicks -milliseconds]
+ puts stderr " [expr {$::now - $then}] ms"
+ }
+} else {
+ proc now {} {} ; proc tick {} {} ; proc tock {} {}
+}
+
+now ; tick
+test ttk-8.0 "Setup for 8.X" -body {
+ ttk::button .ctb
+ image create photo icon -data $::iconData;
+ pack .ctb
+}
+tock
+
+now
+test ttk-8.1 "Test -compound options" -body {
+ # Exhaustively test each combination.
+ # Main goal is to make sure no code paths crash.
+ foreach image {icon ""} {
+ foreach text {"Hi!" ""} {
+ foreach compound $::compoundStrings {
+ .ctb configure -image $image -text $text -compound $compound
+ update; tick
+ }
+ }
+ }
+}
+tock
+
+test ttk-8.2 "Test -compound options with regular button" -body {
+ button .rtb
+ pack .rtb
+
+ foreach image {"" icon} {
+ foreach text {"Hi!" ""} {
+ foreach compound [lrange $::compoundStrings 2 end] {
+ .rtb configure -image $image -text $text -compound $compound
+ update; tick
+ }
+ }
+ }
+}
+tock
+
+test ttk-8.3 "Rerun test 8.1" -body {
+ foreach image {icon ""} {
+ foreach text {"Hi!" ""} {
+ foreach compound $::compoundStrings {
+ .ctb configure -image $image -text $text -compound $compound
+ update; tick
+ }
+ }
+ }
+}
+tock
+
+test ttk-8.4 "ImageChanged" -body {
+ ttk::button .b -image icon
+ icon blank
+} -cleanup { destroy .b }
+
+#------------------------------------------------------------------------
+
+test ttk-9.1 "Traces on nonexistant namespaces" -body {
+ ttk::checkbutton .tcb -variable foo::bar
+} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
+
+test ttk-9.2 "Traces on nonexistant namespaces II" -body {
+ ttk::checkbutton .tcb -variable X
+ .tcb configure -variable foo::bar
+} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
+
+test ttk-9.3 "Restore saved options on configure error" -body {
+ .tcb cget -variable
+} -result X
+
+test ttk-9.4 "Textvariable tests" -body {
+ set tcbLabel "Testing..."
+ .tcb configure -textvariable tcbLabel
+ .tcb cget -text
+} -result "Testing..."
+
+# Changing -text has no effect if there is a linked -textvariable.
+# Compatible with core widget.
+test ttk-9.5 "Change -text" -body {
+ .tcb configure -text "Changed -text"
+ .tcb cget -text
+} -result "Testing..."
+
+# Unset -textvariable clears the text.
+# NOTE: this is different from core widgets, which automagically reinitalize
+# the -textvariable to the last value of -text.
+#
+test ttk-9.6 "Unset -textvariable" -body {
+ unset tcbLabel
+ list [info exists tcbLabel] [.tcb cget -text]
+} -result [list 0 ""]
+
+test ttk-9.7 "Unset textvariable, comparison" -body {
+#
+# NB: ttk::label behaves differently from the standard label here;
+# NB: this is on purpose: I believe the standard behaviour is the Wrong Thing
+#
+ unset -nocomplain V1 V2
+ label .l -text Foo ; ttk::label .tl -text Foo
+
+ .l configure -textvariable V1 ; .tl configure -textvariable V2
+ list [set V1] [info exists V2]
+} -cleanup { destroy .l .tl } -result [list Foo 0]
+
+test ttk-9.8 "-textvariable overrides -text" -body {
+ ttk::label .tl -textvariable TV
+ set TV Foo
+ .tl configure -text Bar
+ .tl cget -text
+} -cleanup { destroy .tl } -result "Foo"
+
+#
+# Frame widget tests:
+#
+
+test ttk-10.1 "ttk::frame -class resource" -body {
+ ttk::frame .f -class Foo
+} -result .f
+
+test ttk-10.2 "Check widget class" -body {
+ winfo class .f
+} -result Foo
+
+test ttk-10.3 "Check class resource" -body {
+ .f cget -class
+} -result Foo
+
+test ttk-10.4 "Try to modify class resource" -body {
+ .f configure -class Bar
+} -returnCodes 1 -match glob -result "*read-only option*"
+
+test ttk-10.5 "Check class resource again" -body {
+ .f cget -class
+} -result Foo
+
+test ttk-11.1 "-state test, setup" -body {
+ ttk::button .b
+ .b instate disabled
+} -result 0
+
+test ttk-11.2 "-state test, disable" -body {
+ .b configure -state disabled
+ .b instate disabled
+} -result 1
+
+test ttk-11.3 "-state test, reenable" -body {
+ .b configure -state normal
+ .b instate disabled
+} -result 0
+
+test ttk-11.4 "-state test, unrecognized -state value" -body {
+ .b configure -state bogus
+ .b state
+} -result [list]
+
+test ttk-11.5 "-state test, 'active'" -body {
+ .b configure -state active
+ .b state
+} -result [list active] -cleanup { .b state !active }
+
+test ttk-11.6 "-state test, 'readonly'" -body {
+ .b configure -state readonly
+ .b state
+} -result [list readonly] -cleanup { .b state !readonly }
+
+test ttk-11.7 "-state test, cleanup" -body {
+ destroy .b
+}
+
+test ttk-12.1 "-cursor option" -body {
+ ttk::button .b
+ .b cget -cursor
+} -result {}
+
+test ttk-12.2 "-cursor option" -body {
+ .b configure -cursor arrow
+ .b cget -cursor
+} -result arrow
+
+test ttk-12.3 "-borderwidth frame option" -body {
+ destroy .t
+ toplevel .t
+ raise .t
+ pack [set t [ttk::frame .t.f]] -expand true -fill x ;
+ pack [ttk::label $t.l -text "ASDF QWERTY"] -expand true -fill both
+ foreach theme {default alt} {
+ ttk::style theme use $theme
+ foreach relief {flat raised sunken ridge groove solid} {
+ $t configure -relief $relief
+ for {set i 5} {$i >= 0} {incr i -1} {
+ $t configure -borderwidth $i
+ update
+ }
+ }
+ }
+}
+
+test ttk-12.4 "-borderwidth frame option" -body {
+ .t.f configure -relief raised
+ .t.f configure -borderwidth 1
+ ttk::style theme use alt
+ update
+}
+
+test ttk-13.1 "Custom styles -- bad -style option" -body {
+ ttk::button .tb1 -style badstyle
+} -returnCodes 1 -result "*badstyle not found*" -match glob
+
+test ttk-13.4 "Custom styles -- bad -style option" -body {
+ ttk::button .tb1
+ .tb1 configure -style badstyle
+} -cleanup {
+ destroy .tb1
+} -returnCodes 1 -result "*badstyle not found*" -match glob
+
+test ttk-13.5 "Custom layouts -- missing element definition" -body {
+ ttk::style layout badstyle {
+ NoSuchElement
+ }
+ ttk::button .tb1 -style badstyle
+} -cleanup {
+ destroy .tb1
+} -result .tb1
+# @@@ Should: signal an error, possibly a background error.
+
+#
+# See #793909
+#
+
+test ttk-14.1 "-variable in nonexistant namespace" -body {
+ ttk::checkbutton .tw -variable ::nsn::foo
+} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+ -match glob -cleanup { destroy .tw }
+
+test ttk-14.2 "-textvariable in nonexistant namespace" -body {
+ ttk::label .tw -textvariable ::nsn::foo
+} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+ -match glob -cleanup { destroy .tw }
+
+test ttk-14.3 "-textvariable in nonexistant namespace" -body {
+ ttk::entry .tw -textvariable ::nsn::foo
+} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+ -match glob -cleanup { destroy .tw }
+
+test ttk-15.1 {Bug 3062331} -setup {
+ destroy .b
+} -body {
+ set Y {}
+ ttk::button .b -textvariable Y
+ trace variable Y u "destroy .b; #"
+ unset Y
+} -cleanup {
+ destroy .b
+} -result {}
+
+test ttk-15.2 {Bug 3341056} -setup {
+ proc foo {} {
+ destroy .lf
+ ttk::labelframe .lf
+ ttk::checkbutton .lf.cb -text xxx
+ }
+} -body {
+ ttk::button .b -text xxx -command foo
+ .b invoke
+ .b invoke
+ .lf.cb invoke
+ destroy .b
+} -cleanup {
+ rename foo {}
+ destroy .lf
+} -result {}
+
+## Test ensemble processing:
+#
+# (See also: SF#2021443)
+#
+proc wrong#args {args} {
+ return "wrong # args: should be \"$args\""
+}
+proc wrong#varargs {varpart args} {
+ set usage $args
+ append usage " ?$varpart ...?"
+ return "wrong # args: should be \"$usage\""
+}
+
+test ttk-ensemble-0 "style element create: insufficient args" -body {
+ ttk::style
+} -returnCodes 1 -result \
+ [wrong#varargs arg ttk::style option]
+
+test ttk-ensemble-1 "style element create: insufficient args" -body {
+ ttk::style element
+} -returnCodes 1 -result \
+ [wrong#varargs arg ttk::style element option]
+
+test ttk-ensemble-2 "style element create: insufficient args" -body {
+ ttk::style element create
+} -returnCodes 1 -result \
+ [wrong#varargs {-option value} ttk::style element create name type]
+
+test ttk-ensemble-3 "style element create: insufficient args" -body {
+ ttk::style element create plain.background
+} -returnCodes 1 -result \
+ [wrong#varargs {-option value} ttk::style element create name type]
+
+test ttk-ensemble-4 "style element create: insufficient args" -body {
+ ttk::style element create plain.background from
+} -returnCodes 1 -result [wrong#args theme ?element?]
+
+test ttk-ensemble-5 "style element create: valid" -body {
+ ttk::style element create plain.background from default
+} -returnCodes 0 -result ""
+
+eval destroy [winfo children .]
+
+tcltest::cleanupTests
+
+#*EOF*
diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test
new file mode 100644
index 0000000..417deac
--- /dev/null
+++ b/tests/ttk/validate.test
@@ -0,0 +1,277 @@
+##
+## Entry widget validation tests
+## Derived from core test suite entry-19.1 through entry-19.20
+##
+
+package require Tk 8.5
+package require tcltest 2.1
+namespace import -force tcltest::*
+
+loadTestedCommands
+
+testConstraint ttkEntry 1
+testConstraint coreEntry [expr {![testConstraint ttkEntry]}]
+
+eval tcltest::configure $argv
+
+test validate-0.0 "Setup" -constraints ttkEntry -body {
+ rename entry {}
+ interp alias {} entry {} ttk::entry
+ return;
+}
+
+test validate-0.1 "More setup" -body {
+ destroy .e
+ catch {unset ::e}
+ catch {unset ::vVals}
+ entry .e -validate all \
+ -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -invalidcommand bell \
+ -textvariable ::e \
+ ;
+ pack .e
+ proc doval {W d i P s S v V} {
+ set ::vVals [list $W $d $i $P $s $S $v $V]
+ return 1
+ }
+}
+
+# The validation tests build each one upon the previous, so cascading
+# failures aren't good
+#
+test validate-1.1 {entry widget validation - insert} -body {
+ .e insert 0 a
+ set ::vVals
+} -result {.e 1 0 a {} a all key}
+
+test validate-1.2 {entry widget validation - insert} -body {
+ .e insert 1 b
+ set ::vVals
+} -result {.e 1 1 ab a b all key}
+
+test validate-1.3 {entry widget validation - insert} -body {
+ .e insert end c
+ set ::vVals
+} -result {.e 1 2 abc ab c all key}
+
+test validate-1.4 {entry widget validation - insert} -body {
+ .e insert 1 123
+ list $::vVals $::e
+} -result {{.e 1 1 a123bc abc 123 all key} a123bc}
+
+test validate-1.5 {entry widget validation - delete} -body {
+ .e delete 2
+ set ::vVals
+} -result {.e 0 2 a13bc a123bc 2 all key}
+
+test validate-1.6 {entry widget validation - delete} -body {
+ .e configure -validate key
+ .e delete 1 3
+ set ::vVals
+} -result {.e 0 1 abc a13bc 13 key key}
+
+test validate-1.7 {entry widget validation - vmode focus} -body {
+ set ::vVals {}
+ .e configure -validate focus
+ .e insert end d
+ set ::vVals
+} -result {}
+
+test validate-1.8 {entry widget validation - vmode focus} -body {
+ focus -force .e
+ # update necessary to process FocusIn event
+ update
+ set ::vVals
+} -result {.e -1 -1 abcd abcd {} focus focusin}
+
+test validate-1.9 {entry widget validation - vmode focus} -body {
+ focus -force .
+ # update necessary to process FocusOut event
+ update
+ set ::vVals
+} -result {.e -1 -1 abcd abcd {} focus focusout}
+
+.e configure -validate all
+test validate-1.10 {entry widget validation - vmode all} -body {
+ focus -force .e
+ # update necessary to process FocusIn event
+ update
+ set ::vVals
+} -result {.e -1 -1 abcd abcd {} all focusin}
+
+test validate-1.11 {entry widget validation} -body {
+ focus -force .
+ # update necessary to process FocusOut event
+ update
+ set ::vVals
+} -result {.e -1 -1 abcd abcd {} all focusout}
+.e configure -validate focusin
+
+test validate-1.12 {entry widget validation} -body {
+ focus -force .e
+ # update necessary to process FocusIn event
+ update
+ set ::vVals
+} -result {.e -1 -1 abcd abcd {} focusin focusin}
+
+test validate-1.13 {entry widget validation} -body {
+ set ::vVals {}
+ focus -force .
+ # update necessary to process FocusOut event
+ update
+ set ::vVals
+} -result {}
+.e configure -validate focuso
+
+test validate-1.14 {entry widget validation} -body {
+ focus -force .e
+ # update necessary to process FocusIn event
+ update
+ set ::vVals
+} -result {}
+
+test validate-1.15 {entry widget validation} -body {
+ focus -force .
+ # update necessary to process FocusOut event
+ update
+ set ::vVals
+} -result {.e -1 -1 abcd abcd {} focusout focusout}
+
+# DIFFERENCE: core entry temporarily sets "-validate all", ttk::entry doesn't.
+test validate-1.16 {entry widget validation} -body {
+ .e configure -validate all
+ list [.e validate] $::vVals
+} -result {1 {.e -1 -1 abcd abcd {} all forced}}
+
+# DIFFERENCE: ttk::entry does not perform validation when setting the -variable
+test validate-1.17 {entry widget validation} -constraints coreEntry -body {
+ .e configure -validate all
+ set ::e newdata
+ list [.e cget -validate] $::vVals
+} -result {all {.e -1 -1 newdata abcd {} all forced}}
+
+proc doval {W d i P s S v V} {
+ set ::vVals [list $W $d $i $P $s $S $v $V]
+ return 0
+}
+
+test validate-1.18 {entry widget validation} -constraints coreEntry -body {
+ .e configure -validate all
+ set ::e nextdata
+ list [.e cget -validate] $::vVals
+} -result {none {.e -1 -1 nextdata newdata {} all forced}}
+# DIFFERENCE: ttk::entry doesn't validate when setting linked -variable
+# DIFFERENCE: ttk::entry doesn't disable validation
+
+proc doval {W d i P s S v V} {
+ set ::vVals [list $W $d $i $P $s $S $v $V]
+ set ::e mydata
+ return 1
+}
+
+## This sets validate to none because it shows that we prevent a possible
+## loop condition in the validation, when the entry textvar is also set
+test validate-1.19 {entry widget validation} -constraints coreEntry -body {
+ .e configure -validate all
+ .e validate
+ list [.e cget -validate] [.e get] $::vVals
+} -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
+
+## This leaves validate alone because we trigger validation through the
+## textvar (a write trace), and the write during validation triggers
+## nothing (by definition of avoiding loops on var traces). This is
+## one of those "dangerous" conditions where the user will have a
+## different value in the entry widget shown as is in the textvar.
+
+# DIFFERENCE: ttk entry doesn't get out of sync w/textvar
+test validate-1.20 {entry widget validation} -constraints coreEntry -body {
+ .e configure -validate all
+ set ::e testdata
+ list [.e cget -validate] [.e get] $::e $::vVals
+} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
+
+#
+# New tests, -JE:
+#
+proc doval {W d i P s S v V} {
+ set ::vVals [list $W $d $i $P $s $S $v $V]
+ .e delete 0 end;
+ .e insert end dovaldata
+ return 0
+}
+test validate-2.1 "Validation script changes value" -body {
+ .e configure -validate none
+ set ::e testdata
+ .e configure -validate all
+ .e validate
+ list [.e get] $::e $::vVals
+} -result {dovaldata dovaldata {.e -1 -1 testdata testdata {} all forced}}
+# DIFFERENCE: core entry disables validation, ttk entry does not.
+
+destroy .e
+catch {unset ::e ::vVals}
+
+# See bug #1236979
+
+test validate-2.2 "configure in -validatecommand" -body {
+ proc validate-2.2 {win str} {
+ $win configure -foreground black
+ return 1
+ }
+ ttk::entry .e -textvariable var -validatecommand {validate-2.2 %W %P}
+ .e validate
+} -result 1 -cleanup { destroy .e }
+
+
+### invalid state behavior
+#
+
+test validate-3.0 "Setup" -body {
+ set ::E "123"
+ ttk::entry .e \
+ -validatecommand {string is integer -strict %P} \
+ -validate all \
+ -textvariable ::E \
+ ;
+ return [list [.e get] [.e state]]
+} -result [list 123 {}]
+
+test validate-3.1 "insert - valid" -body {
+ .e insert end "4"
+ return [list [.e get] [.e state]]
+} -result [list 1234 {}]
+
+test validate-3.2 "insert - invalid" -body {
+ .e insert end "X"
+ return [list [.e get] [.e state]]
+} -result [list 1234 {}]
+
+test validate-3.3 "force invalid value" -body {
+ append ::E "XY"
+ return [list [.e get] [.e state]]
+} -result [list 1234XY {}]
+
+test validate-3.4 "revalidate" -body {
+ return [list [.e validate] [.e get] [.e state]]
+} -result [list 0 1234XY {invalid}]
+
+testConstraint NA 0
+# the next two tests (used to) exercise validation lockout protection --
+# if the widget is currently invalid, all edits are allowed.
+# This behavior is currently disabled.
+#
+test validate-3.5 "all edits allowed while invalid" -constraints NA -body {
+ .e delete 4
+ return [list [.e get] [.e state]]
+} -result [list 1234Y {invalid}]
+
+test validate-3.6 "...until the value becomes valid" -constraints NA -body {
+ .e delete 4
+ return [list [.e get] [.e state]]
+} -result [list 1234 {}]
+
+test validate-3.last "Cleanup" -body { destroy .e }
+
+
+###
+tcltest::cleanupTests
diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test
new file mode 100644
index 0000000..bb88fef
--- /dev/null
+++ b/tests/ttk/vsapi.test
@@ -0,0 +1,47 @@
+# -*- tcl -*-
+#
+
+package require Tk 8.5
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+testConstraint xpnative \
+ [expr {[lsearch -exact [ttk::style theme names] xpnative] != -1}]
+
+test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints {xpnative} -body {
+ ttk::style element create smallclose vsapi \
+ WINDOW 19 {disabled 4 pressed 3 active 2 {} 1}
+ ttk::style layout CloseButton {CloseButton.smallclose -sticky news}
+ ttk::button .b -style CloseButton
+ pack .b -expand true -fill both
+ list [winfo reqwidth .b] [winfo reqheight .b]
+} -cleanup { destroy .b } -result [list 13 13]
+
+test vsapi-1.2 "EXPLORERBAR EBP_HEADERPIN" -constraints {xpnative} -body {
+ ttk::style element create pin vsapi \
+ EXPLORERBAR 3 {
+ {pressed !selected} 3
+ {active !selected} 2
+ {pressed selected} 6
+ {active selected} 5
+ {selected} 4
+ {} 1
+ }
+ ttk::style layout Explorer.Pin {Explorer.Pin.pin -sticky news}
+ ttk::checkbutton .pin -style Explorer.Pin
+ pack .pin -expand true -fill both
+ list [winfo reqwidth .pin] [winfo reqheight .pin]
+} -cleanup { destroy .pin } -result [list 16 16]
+
+test vsapi-1.3 "EXPLORERBAR EBP_HEADERCLOSE" -constraints {xpnative} -body {
+ ttk::style element create headerclose vsapi \
+ EXPLORERBAR 2 {pressed 3 active 2 {} 1}
+ ttk::style layout Explorer.CloseButton {
+ Explorer.CloseButton.headerclose -sticky news
+ }
+ ttk::button .b -style Explorer.CloseButton
+ pack .b -expand true -fill both
+ list [winfo reqwidth .b] [winfo reqheight .b]
+} -cleanup { destroy .b } -result [list 16 16]
+
+tcltest::cleanupTests
diff --git a/tests/unixButton.test b/tests/unixButton.test
index 77c1112..a51e259 100644
--- a/tests/unixButton.test
+++ b/tests/unixButton.test
@@ -9,10 +9,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Create entries in the option database to be sure that geometry options
@@ -193,5 +190,5 @@ test unixbutton-2.1 {disabled coloring check, bug 669595} unix {
deleteWindows
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index 46191a7..1e8f03b 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
setupbg
@@ -200,7 +197,7 @@ test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} unix {
update
wm geometry .t2
} {200x200+0+0}
-test unixEmbed-3.2 {ContainerEventProc procedure, disallow position changes} unix {
+test unixEmbed-3.2a {ContainerEventProc procedure, disallow position changes} unix {
deleteWindows
frame .f1 -container 1 -width 200 -height 50
pack .f1
@@ -558,18 +555,5 @@ test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} unix
# cleanup
deleteWindows
cleanupbg
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/unixFont.test b/tests/unixFont.test
index f703ae0..27826d4 100644
--- a/tests/unixFont.test
+++ b/tests/unixFont.test
@@ -13,29 +13,30 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint hasArial 1
-testConstraint hasCourierNew 1
-testConstraint hasTimesNew 1
-set xlsf [auto_execok xlsfonts]
-if {[llength $xlsf]} {
- foreach {constraint font} {
- hasArial arial
- hasCourierNew "courier new"
- hasTimesNew "times new roman"
- } {
- if {![catch {eval exec $xlsf [list *-$font-*]} res]
- && ![string match *unmatched* $res]} {
- # Newer Unix systems have more default fonts installed,
- # so we can't rely on fallbacks for fonts to need to
- # fall back on anything.
- testConstraint $constraint 0
+if {[tk windowingsystem] eq "x11"} {
+ set xlsf [auto_execok xlsfonts]
+}
+foreach {constraint font} {
+ hasArial arial
+ hasCourierNew "courier new"
+ hasTimesNew "times new roman"
+} {
+ if {[tk windowingsystem] eq "x11"} {
+ testConstraint $constraint 1
+ if {[llength $xlsf]} {
+ if {![catch {eval exec $xlsf [list *-$font-*]} res]
+ && ![string match *unmatched* $res]} {
+ # Newer Unix systems have more default fonts installed,
+ # so we can't rely on fallbacks for fonts to need to
+ # fall back on anything.
+ testConstraint $constraint 0
+ }
}
+ } else {
+ testConstraint $constraint 0
}
}
@@ -313,18 +314,5 @@ test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} unix {
} {0 1 1 1 1 2}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/unixMenu.test b/tests/unixMenu.test
index a43f6f5..802a7c2 100644
--- a/tests/unixMenu.test
+++ b/tests/unixMenu.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
test unixMenu-1.1 {TkpNewMenu - normal menu} unix {
@@ -304,7 +301,7 @@ test unixMenu-17.1 {GetMenuSeparatorGeometry} unix {
list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
-test unixMenu-18.1 {GetTearoffEntryGeometry} unix {
+test unixMenu-18.1 {GetTearoffEntryGeometry} {unix nonUnixUserInteraction} {
catch {destroy .m1}
menubutton .mb -text "test" -menu .mb.m
menu .mb.m
@@ -554,7 +551,7 @@ test unixMenu-20.1 {DrawTearoffEntry - menubar} unix {
. configure -menu .m1
list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test unixMenu-20.2 {DrawTearoffEntry - non-menubar} unix {
+test unixMenu-20.2 {DrawTearoffEntry - non-menubar} {unix nonUnixUserInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
@@ -820,7 +817,7 @@ test unixMenu-25.4 {TkpComputeStandardMenuGeometry - separator} unix {
.m1 add separator
list [update idletasks] [destroy .m1]
} {{} {}}
-test unixMenu-25.5 {TkpComputeStandardMenuGeometry - tearoff entry} {unixOnly} {
+test unixMenu-25.5 {TkpComputeStandardMenuGeometry - tearoff entry} {unix nonUnixUserInteraction} {
catch {destroy .m1}
menubutton .mb -text "test" -menu .mb.m
menu .mb.m
@@ -893,7 +890,7 @@ test unixMenu-25.14 {TkpComputeStandardMenuGeometry - second indicator less or e
.m1 invoke 2
list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}
-test unixMenu-25.15 {TkpComputeStandardMenuGeometry - second indicator larger } {unixOnly testImageType} {
+test unixMenu-25.15 {TkpComputeStandardMenuGeometry - second indicator larger } {unix testImageType} {
catch {destroy .m1}
catch {image delete image1}
image create test image1
@@ -947,5 +944,5 @@ test unixMenu-26.1 {TkpMenuInit - nothing to do} {} {}
# cleanup
deleteWindows
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/unixSelect.test b/tests/unixSelect.test
index cfb98ea..c3ed11d 100644
--- a/tests/unixSelect.test
+++ b/tests/unixSelect.test
@@ -10,10 +10,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
global longValue selValue selInfo
@@ -107,7 +104,7 @@ foreach i {a b c d e f g j h i j k l m o p q r s t u v w x y z} {
append longValue A$j B$j C$j D$j E$j F$j G$j H$j I$j K$j L$j M$j N$j
}
-test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} {unixOnly} {
+test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} unix {
setupbg
entry .e
pack .e
@@ -119,7 +116,7 @@ test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} {unixOnly} {
destroy .e
set result
} {5}
-test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} {unixOnly} {
+test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -131,7 +128,7 @@ test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} {
list [string equal \u00fc? $x] \
[string length $x] [string bytelength $x]
} {1 2 3}
-test unixSelect-1.4 {TkSelGetSelection procedure: simple i18n text, iso2022} {unixOnly} {
+test unixSelect-1.4 {TkSelGetSelection procedure: simple i18n text, iso2022} unix {
setupbg
setup
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
@@ -147,7 +144,7 @@ test unixSelect-1.4 {TkSelGetSelection procedure: simple i18n text, iso2022} {un
cleanupbg
lappend result $selInfo
} {1 2 4 {COMPOUND_TEXT 0 4000}}
-test unixSelect-1.5 {TkSelGetSelection procedure: INCR i18n text, iso2022} {unixOnly} {
+test unixSelect-1.5 {TkSelGetSelection procedure: INCR i18n text, iso2022} unix {
# This test is subtle. The selection ends up getting fetched twice by
# Tk: once to compute the length, and again to actually send the data.
@@ -170,7 +167,7 @@ test unixSelect-1.5 {TkSelGetSelection procedure: INCR i18n text, iso2022} {unix
cleanupbg
lappend result $selInfo
} {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}}
-test unixSelect-1.6 {TkSelGetSelection procedure: simple i18n text, iso2022} {unixOnly} {
+test unixSelect-1.6 {TkSelGetSelection procedure: simple i18n text, iso2022} unix {
setupbg
setup
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
@@ -186,7 +183,7 @@ test unixSelect-1.6 {TkSelGetSelection procedure: simple i18n text, iso2022} {un
cleanupbg
lappend result $selInfo
} {1 2 4 {COMPOUND_TEXT 0 4000}}
-test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
+test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} unix {
setupbg
dobg "entry .e; pack .e; update
.e insert 0 \[encoding convertfrom identity \\u00fcber\]$longValue
@@ -195,7 +192,7 @@ test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
cleanupbg
set result
} [expr {5 + [string bytelength $longValue]}]
-test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
+test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -207,7 +204,7 @@ test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
list [string equal [string repeat x 3999]\u00fc $x] \
[string length $x] [string bytelength $x]
} {1 4000 4001}
-test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
+test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -219,7 +216,7 @@ test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
list [string equal \u00fc[string repeat x 3999] $x] \
[string length $x] [string bytelength $x]
} {1 4000 4001}
-test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
+test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -234,7 +231,7 @@ test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} {
# Now some tests to make sure that the right thing is done when
# transferring UTF8 selections, to prevent [Bug 614650] and its ilk
# from rearing its ugly head again.
-test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} {
+test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -246,7 +243,7 @@ test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixO
list [string equal [string repeat x 3999]\u00fc $x] \
[string length $x] [string bytelength $x]
} {1 4000 4001}
-test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} {
+test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -258,7 +255,7 @@ test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixO
list [string equal \u00fc[string repeat x 3999] $x] \
[string length $x] [string bytelength $x]
} {1 4000 4001}
-test unixSelect-1.13 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} {
+test unixSelect-1.13 {TkSelGetSelection procedure: INCR i18n text, utf-8} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -270,7 +267,7 @@ test unixSelect-1.13 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixO
list [string equal [string repeat x 3999]\u00fc[string repeat x 4000] $x] \
[string length $x] [string bytelength $x]
} {1 8000 8001}
-test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} {unixOnly} {
+test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} unix {
setupbg
entry .e
pack .e
@@ -282,7 +279,7 @@ test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} {uni
destroy .e
set result
} {5}
-test unixSelect-1.15 {TkSelGetSelection procedure: simple i18n text, utf-8} {unixOnly} {
+test unixSelect-1.15 {TkSelGetSelection procedure: simple i18n text, utf-8} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -294,7 +291,7 @@ test unixSelect-1.15 {TkSelGetSelection procedure: simple i18n text, utf-8} {uni
list [string equal \u00fc\u0444 $x] \
[string length $x] [string bytelength $x]
} {1 2 4}
-test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} {
+test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -306,7 +303,7 @@ test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixO
list [string equal [string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
[string length $x] [string bytelength $x]
} {1 2121 4221}
-test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} {
+test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} unix {
setupbg
dobg {
entry .e; pack .e; update
@@ -318,7 +315,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixO
list [string equal i[string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
[string length $x] [string bytelength $x]
} {1 2122 4222}
-test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} {
+test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} unix {
setupbg
dobg {
text .t; pack .t; update
@@ -332,7 +329,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixO
list [string equal [string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
[string length $x] [string bytelength $x]
} {1 2121 4221}
-test unixSelect-1.19 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} {
+test unixSelect-1.19 {TkSelGetSelection procedure: INCR i18n text, utf-8} unix {
setupbg
dobg {
text .t; pack .t; update
@@ -346,7 +343,7 @@ test unixSelect-1.19 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixO
list [string equal i[string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
[string length $x] [string bytelength $x]
} {1 2122 4222}
-test unixSelect-1.20 {Automatic UTF8_STRING support for selection handle} {unixOnly} {
+test unixSelect-1.20 {Automatic UTF8_STRING support for selection handle} unix {
# See Bug #666346 "Selection handling crashes under KDE 3.0"
label .l
selection handle .l [list handler STRING]
@@ -358,5 +355,5 @@ test unixSelect-1.20 {Automatic UTF8_STRING support for selection handle} {unixO
} "This is the selection value"
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 60cd9d9..d579fc7 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -8,15 +8,10 @@
# All rights reserved.
package require tcltest 2.2
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::interpreter
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
+namespace import -force ::tk::test:loadTkCommand
proc sleep ms {
global x
@@ -37,7 +32,7 @@ proc makeToplevels {} {
set i 1
foreach geom {+20+80 +80+20 +0+0} {
- catch {destroy .t}
+ destroy .t
test unixWm-1.$i {initial window position} unix {
toplevel .t -width 200 -height 150
wm geom .t $geom
@@ -53,7 +48,7 @@ foreach geom {+20+80 +80+20 +0+0} {
# this just makes sure that things are consistent between moves.
set i 1
-catch {destroy .t}
+destroy .t
toplevel .t -width 100 -height 150
wm geom .t +200+200
update
@@ -102,7 +97,7 @@ foreach geom {+20+80 +100+40 +0+0} {
}
test unixWm-5.1 {compounded state changes} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 100
wm geometry .t +100+100
update
@@ -111,7 +106,7 @@ test unixWm-5.1 {compounded state changes} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {1 normal}
test unixWm-5.2 {compounded state changes} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 100
wm geometry .t +100+100
update
@@ -121,7 +116,7 @@ test unixWm-5.2 {compounded state changes} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {0 withdrawn}
test unixWm-5.3 {compounded state changes} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 100
wm geometry .t +100+100
update
@@ -132,7 +127,7 @@ test unixWm-5.3 {compounded state changes} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {1 normal}
test unixWm-5.4 {compounded state changes} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 100
wm geometry .t +100+100
update
@@ -142,7 +137,7 @@ test unixWm-5.4 {compounded state changes} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {0 iconic}
test unixWm-5.5 {compounded state changes} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 100
wm geometry .t +100+100
update
@@ -151,7 +146,7 @@ test unixWm-5.5 {compounded state changes} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {0 withdrawn}
test unixWm-5.6 {compounded state changes} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 100
wm geometry .t +100+100
update
@@ -161,7 +156,7 @@ test unixWm-5.6 {compounded state changes} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {1 normal}
test unixWm-5.7 {compounded state changes} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 100
wm geometry .t +100+100
update
@@ -170,7 +165,7 @@ test unixWm-5.7 {compounded state changes} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {0 iconic}
-catch {destroy .t}
+destroy .t
toplevel .t -width 200 -height 100
wm geom .t +10+10
wm minsize .t 1 1
@@ -221,7 +216,7 @@ test unixWm-6.4 {size changes} {unix nonPortable userInteraction} {
sleep 200
test unixWm-6.5 {window initially iconic} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 30
wm geometry .t +0+0
wm title .t 2
@@ -232,7 +227,7 @@ test unixWm-6.5 {window initially iconic} {unix nonPortable} {
list [winfo ismapped .t] [wm state .t]
} {1 normal}
-catch {destroy .m}
+destroy .m
toplevel .m
wm overrideredirect .m 1
foreach i {{Test label} Another {Yet another} {Last label}} j {1 2 3} {
@@ -253,11 +248,11 @@ test unixWm-7.3 {override_redirect and Tk_MoveTopLevelWindow} unix {
list [winfo ismapped .m]
} 0
destroy .m
-catch {destroy .t}
+destroy .t
test unixWm-8.1 {icon windows} unix {
- catch {destroy .t}
- catch {destroy .icon}
+ destroy .t
+ destroy .icon
toplevel .t -width 100 -height 30
wm geometry .t +0+0
toplevel .icon -width 50 -height 50 -bg red
@@ -265,18 +260,18 @@ test unixWm-8.1 {icon windows} unix {
list [catch {wm withdraw .icon} msg] $msg
} {1 {can't withdraw .icon: it is an icon for .t}}
test unixWm-8.2 {icon windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 30
list [catch {wm iconwindow} msg] $msg
} {1 {wrong # args: should be "wm option window ?arg ...?"}}
test unixWm-8.3 {icon windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 30
list [catch {wm iconwindow .t b c} msg] $msg
} {1 {wrong # args: should be "wm iconwindow window ?pathName?"}}
test unixWm-8.4 {icon windows} unix {
- catch {destroy .t}
- catch {destroy .icon}
+ destroy .t
+ destroy .icon
toplevel .t -width 100 -height 30
wm geom .t +0+0
set result [wm iconwindow .t]
@@ -292,19 +287,19 @@ test unixWm-8.4 {icon windows} unix {
lappend result [winfo ismapped .t] [winfo ismapped .icon]
} {.icon icon {} withdrawn 1 0 0 0}
test unixWm-8.5 {icon windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 30
list [catch {wm iconwindow .t .gorp} msg] $msg
} {1 {bad window path name ".gorp"}}
test unixWm-8.6 {icon windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 30
frame .t.icon -width 50 -height 50 -bg red
list [catch {wm iconwindow .t .t.icon} msg] $msg
} {1 {can't use .t.icon as icon window: not at top level}}
test unixWm-8.7 {icon windows} unix {
- catch {destroy .t}
- catch {destroy .icon}
+ destroy .t
+ destroy .icon
toplevel .t -width 100 -height 30
wm geom .t +0+0
toplevel .icon -width 50 -height 50 -bg red
@@ -314,10 +309,10 @@ test unixWm-8.7 {icon windows} unix {
wm iconwindow .t .icon2
lappend result [wm iconwindow .t] [wm state .icon] [wm state .icon2]
} {.icon icon normal .icon2 withdrawn icon}
-catch {destroy .icon2}
+destroy .icon2
test unixWm-8.8 {icon windows} unix {
- catch {destroy .t}
- catch {destroy .icon}
+ destroy .t
+ destroy .icon
toplevel .icon -width 50 -height 50 -bg red
wm geom .icon +0+0
update
@@ -333,8 +328,8 @@ test unixWm-8.9 {icon windows} {unix nonPortable} {
# This test is non-portable because some window managers will
# destroy an icon window when it's associated window is destroyed.
- catch {destroy .t}
- catch {destroy .icon}
+ destroy .t
+ destroy .icon
toplevel .t -width 100 -height 30
toplevel .icon -width 50 -height 50 -bg red
wm geom .t +0+0
@@ -376,7 +371,7 @@ test unixWm-8.10.2 {test for memory leaks} unix {
} 1
test unixWm-9.1 {TkWmMapWindow procedure, client property} {unix testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 50
wm geom .t +0+0
wm client .t Test_String
@@ -384,7 +379,7 @@ test unixWm-9.1 {TkWmMapWindow procedure, client property} {unix testwrapper} {
testprop [testwrapper .t] WM_CLIENT_MACHINE
} {Test_String}
test unixWm-9.2 {TkWmMapWindow procedure, command property} {unix testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 50
wm geom .t +0+0
wm command .t "test command"
@@ -394,7 +389,7 @@ test unixWm-9.2 {TkWmMapWindow procedure, command property} {unix testwrapper} {
command
}
test unixWm-9.3 {TkWmMapWindow procedure, iconic windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 300 -bg blue
wm geom .t +0+0
wm iconify .t
@@ -402,7 +397,7 @@ test unixWm-9.3 {TkWmMapWindow procedure, iconic windows} unix {
winfo ismapped .t
} {0}
test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix {
- catch {destroy .t}
+ destroy .t
sleep 500
toplevel .t -width 100 -height 50 -bg blue
wm iconwindow . .t
@@ -410,17 +405,15 @@ test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix {
set result [winfo ismapped .t]
} {0}
test unixWm-9.5 {TkWmMapWindow procedure, normal windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 20
wm geom .t +0+0
update
winfo ismapped .t
} {1}
-testConstraint testmenubar [llength [info commands testmenubar]]
-
test unixWm-10.1 {TkWmDeadWindow procedure, canceling UpdateGeometry idle handler} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 50
wm geom .t +0+0
update
@@ -428,8 +421,8 @@ test unixWm-10.1 {TkWmDeadWindow procedure, canceling UpdateGeometry idle handle
destroy .t
} {}
test unixWm-10.2 {TkWmDeadWindow procedure, destroying menubar} {unix testmenubar} {
- catch {destroy .t}
- catch {destroy .f}
+ destroy .t
+ destroy .f
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -452,13 +445,13 @@ test unixWm-11.3 {Tk_WmCmd procedure, miscellaneous errors} unix {
list [catch {wm iconify bogus} msg] $msg
} {1 {bad window path name "bogus"}}
test unixWm-11.4 {Tk_WmCmd procedure, miscellaneous errors} unix {
- catch {destroy .b}
+ destroy .b
button .b -text hello
list [catch {wm geometry .b} msg] $msg
} {1 {window ".b" isn't a top-level window}}
-catch {destroy .t}
-catch {destroy .icon}
+destroy .t
+destroy .icon
toplevel .t -width 100 -height 50
wm geom .t +0+0
@@ -517,7 +510,7 @@ test unixWm-13.2 {Tk_WmCmd procedure, "client" option} {unix testwrapper} {
lappend result [wm client .t] [testprop [testwrapper .t] WM_CLIENT_MACHINE]
} {{} Test_String New {} {}}
test unixWm-13.3 {Tk_WmCmd procedure, "client" option, unmapped window} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm client .t2 Test_String
wm client .t2 {}
@@ -529,7 +522,7 @@ test unixWm-14.1 {Tk_WmCmd procedure, "colormapwindows" option} unix {
list [catch {wm colormapwindows .t 12 13} msg] $msg
} {1 {wrong # args: should be "wm colormapwindows window ?windowList?"}}
test unixWm-14.2 {Tk_WmCmd procedure, "colormapwindows" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 200 -height 200 -colormap new
wm geom .t2 +0+0
frame .t2.a -width 100 -height 30
@@ -549,7 +542,7 @@ test unixWm-14.4 {Tk_WmCmd procedure, "colormapwindows" option} unix {
list [catch {wm colormapwindows . foo} msg] $msg
} {1 {bad window path name "foo"}}
test unixWm-14.5 {Tk_WmCmd procedure, "colormapwindows" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 200 -height 200 -colormap new
wm geom .t2 +0+0
frame .t2.a -width 100 -height 30
@@ -560,7 +553,7 @@ test unixWm-14.5 {Tk_WmCmd procedure, "colormapwindows" option} unix {
wm colormapwindows .t2
} {.t2.c .t2 .t2.a}
test unixWm-14.6 {Tk_WmCmd procedure, "colormapwindows" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 200 -height 200
wm geom .t2 +0+0
frame .t2.a -width 100 -height 30
@@ -571,14 +564,14 @@ test unixWm-14.6 {Tk_WmCmd procedure, "colormapwindows" option} unix {
wm colormapwindows .t2
} {.t2.b .t2.a}
test unixWm-14.7 {Tk_WmCmd procedure, "colormapwindows" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 200 -height 200 -colormap new
wm geom .t2 +0+0
set x [wm colormapwindows .t2]
wm colormapwindows .t2 {}
list $x [wm colormapwindows .t2]
} {{} {}}
-catch {destroy .t2}
+destroy .t2
test unixWm-15.1 {Tk_WmCmd procedure, "command" option} unix {
list [catch {wm command .t 12 13} msg] $msg
@@ -599,7 +592,7 @@ test unixWm-15.3 {Tk_WmCmd procedure, "command" option} {unix testwrapper} {
command
} {new command} {} {}}
test unixWm-15.4 {Tk_WmCmd procedure, "command" option, window not mapped} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 +0+0
wm command .t2 "test command"
@@ -615,7 +608,7 @@ test unixWm-16.1 {Tk_WmCmd procedure, "deiconify" option} unix {
list [catch {wm deiconify .t 12} msg] $msg
} {1 {wrong # args: should be "wm deiconify window"}}
test unixWm-16.2 {Tk_WmCmd procedure, "deiconify" option} unix {
- catch {destroy .icon}
+ destroy .icon
toplevel .icon -width 50 -height 50 -bg red
wm iconwindow .t .icon
set result [list [catch {wm deiconify .icon} msg] $msg]
@@ -653,7 +646,7 @@ test unixWm-18.2 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
expr [wm frame .t] == [winfo id .t]
} {0}
test unixWm-18.3 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 +0+0
wm overrideredirect .t2 1
@@ -677,7 +670,7 @@ test unixWm-19.3 {Tk_WmCmd procedure, "geometry" option} {unix nonPortable} {
wm geometry .t
} {100x50+10-4}
test unixWm-19.4 {Tk_WmCmd procedure, "geometry" option} {unix nonPortable} {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 -5+10
listbox .t2.l -width 30 -height 12 -setgrid 1
@@ -696,7 +689,7 @@ test unixWm-19.5 {Tk_WmCmd procedure, "geometry" option} {unix nonPortable} {
update
lappend result [wm geometry .t]
} {150x300+5+6 100x50+5+6}
-test unixWm-19.6 {Tk_WmCmd procedure, "geometry" option} {unix} {
+test unixWm-19.6 {Tk_WmCmd procedure, "geometry" option} unix {
list [catch {wm geometry .t qrs} msg] $msg
} {1 {bad geometry specifier "qrs"}}
@@ -739,8 +732,8 @@ test unixWm-20.11 {Tk_WmCmd procedure, "grid" option} unix {
list [catch {wm grid .t 10 11 12 -1} msg] $msg
} {1 {heightInc can't be <= 0}}
-catch {destroy .t}
-catch {destroy .icon}
+destroy .t
+destroy .icon
toplevel .t -width 100 -height 50
wm geom .t +0+0
update
@@ -764,7 +757,7 @@ test unixWm-21.3 {Tk_WmCmd procedure, "group" option} {unix testwrapper} {
lappend result [wm group .t] $bit
} {{} . 0x40 {} 0x0}
test unixWm-21.4 {Tk_WmCmd procedure, "group" option, make window exist} {unix testwrapper} {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 +0+0
wm group .t .t2
@@ -774,8 +767,8 @@ test unixWm-21.4 {Tk_WmCmd procedure, "group" option, make window exist} {unix t
set result
} {0}
test unixWm-21.5 {Tk_WmCmd procedure, "group" option, create leader wrapper} {unix testwrapper} {
- catch {destroy .t2}
- catch {destroy .t3}
+ destroy .t2
+ destroy .t3
toplevel .t2 -width 120 -height 300
wm geometry .t2 +0+0
toplevel .t3 -width 120 -height 300
@@ -810,7 +803,7 @@ test unixWm-23.1 {Tk_WmCmd procedure, "iconify" option} unix {
list [catch {wm iconify .t 12} msg] $msg
} {1 {wrong # args: should be "wm iconify window"}}
test unixWm-23.2 {Tk_WmCmd procedure, "iconify" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm overrideredirect .t2 1
set result [list [catch {wm iconify .t2} msg] $msg]
@@ -818,7 +811,7 @@ test unixWm-23.2 {Tk_WmCmd procedure, "iconify" option} unix {
set result
} {1 {can't iconify ".t2": override-redirect flag is set}}
test unixWm-23.3 {Tk_WmCmd procedure, "iconify" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 +0+0
wm transient .t2 .t
@@ -827,7 +820,7 @@ test unixWm-23.3 {Tk_WmCmd procedure, "iconify" option} unix {
set result
} {1 {can't iconify ".t2": it is a transient}}
test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 +0+0
wm iconwindow .t .t2
@@ -836,7 +829,7 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix {
set result
} {1 {can't iconify .t2: it is an icon for .t}}
test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 +0+0
update
@@ -847,7 +840,7 @@ test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix {
set result
} {0}
test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 -0+0
update
@@ -880,7 +873,7 @@ test unixWm-24.3 {Tk_WmCmd procedure, "iconmask" option} unix {
test unixWm-25.1 {Tk_WmCmd procedure, "iconname" option} unix {
list [catch {wm icon .t} msg] $msg
-} {1 {ambiguous option "icon": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw}}
+} {1 {ambiguous option "icon": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw}}
test unixWm-25.2 {Tk_WmCmd procedure, "iconname" option} unix {
list [catch {wm iconname .t 12 13} msg] $msg
} {1 {wrong # args: should be "wm iconname window ?newName?"}}
@@ -922,7 +915,7 @@ test unixWm-27.1 {Tk_WmCmd procedure, "iconwindow" option} unix {
list [catch {wm iconwindow .t 12 13} msg] $msg
} {1 {wrong # args: should be "wm iconwindow window ?pathName?"}}
test unixWm-27.2 {Tk_WmCmd procedure, "iconwindow" option} {unix testwrapper} {
- catch {destroy .icon}
+ destroy .icon
toplevel .icon -width 50 -height 50 -bg green
set result {}
lappend result [wm iconwindow .t]
@@ -942,16 +935,16 @@ test unixWm-27.3 {Tk_WmCmd procedure, "iconwindow" option} unix {
list [catch {wm iconwindow .t bogus} msg] $msg
} {1 {bad window path name "bogus"}}
test unixWm-27.4 {Tk_WmCmd procedure, "iconwindow" option} unix {
- catch {destroy .b}
+ destroy .b
button .b -text Help
set result [list [catch {wm iconwindow .t .b} msg] $msg]
destroy .b
set result
} {1 {can't use .b as icon window: not at top level}}
test unixWm-27.5 {Tk_WmCmd procedure, "iconwindow" option} unix {
- catch {destroy .icon}
+ destroy .icon
toplevel .icon -width 50 -height 50 -bg green
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
wm geom .t2 -0+0
wm iconwindow .t2 .icon
@@ -961,8 +954,8 @@ test unixWm-27.5 {Tk_WmCmd procedure, "iconwindow" option} unix {
set result
} {1 {.icon is already an icon for .t2}}
test unixWm-27.6 {Tk_WmCmd procedure, "iconwindow" option, changing icons} unix {
- catch {destroy .icon}
- catch {destroy .icon2}
+ destroy .icon
+ destroy .icon2
toplevel .icon -width 50 -height 50 -bg green
toplevel .icon2 -width 50 -height 50 -bg red
set result {}
@@ -974,7 +967,7 @@ test unixWm-27.6 {Tk_WmCmd procedure, "iconwindow" option, changing icons} unix
set result
} {icon normal withdrawn icon}
test unixWm-27.7 {Tk_WmCmd procedure, "iconwindow" option, withdrawing icon} unix {
- catch {destroy .icon}
+ destroy .icon
toplevel .icon -width 50 -height 50 -bg green
wm geometry .icon +0+0
update
@@ -986,38 +979,85 @@ test unixWm-27.7 {Tk_WmCmd procedure, "iconwindow" option, withdrawing icon} uni
set result
} {normal 1 icon 0}
-test unixWm-28.1 {Tk_WmCmd procedure, "maxsize" option} {nonPortable} {
- wm maxsize .t
-} {1137 870}
+destroy .t
+destroy .icon
+toplevel .t -width 100 -height 50
+wm geom .t +0+0
+update
-test unixWm-28.2 {Tk_WmCmd procedure, "maxsize" option} {nonPortable} {
- # Not portable, because some window managers let applications override
- # minsize and maxsize.
+test unixWm-28.1 {Tk_WmCmd procedure, "maxsize" option, setting the
+ maxsize should update WM_NORMAL_HINTS} {testwrapper} {
+ destroy .t
+ toplevel .t
+ wm maxsize .t 300 300
+ update
+ set hints [testprop [testwrapper .t] WM_NORMAL_HINTS]
+ format {%d %d} [lindex $hints 7] [lindex $hints 8]
+} {300 300}
- wm maxsize .t 200 150
- wm geom .t 300x200
+test unixWm-28.2 {Tk_WmCmd procedure, "maxsize" option, setting the
+ maxsize to a value smaller than the current size should
+ set the maxsize in WM_NORMAL_HINTS} {testwrapper} {
+ destroy .t
+ toplevel .t
+ wm geom .t 400x400
+ wm maxsize .t 300 300
update
- list [winfo width .t] [winfo height .t]
-} {200 150}
+ set hints [testprop [testwrapper .t] WM_NORMAL_HINTS]
+ format {%d %d} [lindex $hints 7] [lindex $hints 8]
+} {300 300}
-catch {destroy .t}
-catch {destroy .icon}
-toplevel .t -width 100 -height 50
-wm geom .t +0+0
-update
+test unixWm-28.3 {Tk_WmCmd procedure, "maxsize" option, setting the
+ maxsize to a value smaller than the current size should
+ set the maxsize in WM_NORMAL_HINTS even if the
+ interactive resizable flag is set to 0} {testwrapper} {
+ destroy .t
+ toplevel .t
+ wm geom .t 400x400
+ wm resizable .t 0 0
+ wm maxsize .t 300 300
+ update
+ set hints [testprop [testwrapper .t] WM_NORMAL_HINTS]
+ format {%d %d} [lindex $hints 7] [lindex $hints 8]
+} {300 300}
-test unixWm-29.1 {Tk_WmCmd procedure, "minsize" option} {nonPortable} {
- # Not portable, because some window managers let applications override
- # minsize and maxsize.
+test unixWm-29.1 {Tk_WmCmd procedure, "minsize" option, setting the
+ minsize should update WM_NORMAL_HINTS} {testwrapper} {
+ destroy .t
+ toplevel .t
+ wm minsize .t 300 300
+ update
+ set hints [testprop [testwrapper .t] WM_NORMAL_HINTS]
+ format {%d %d} [lindex $hints 5] [lindex $hints 6]
+} {300 300}
- wm minsize .t 150 100
- wm geom .t 50x50
+test unixWm-29.2 {Tk_WmCmd procedure, "minsize" option, setting the
+ minsize to a value larger than the current size should
+ set the maxsize in WM_NORMAL_HINTS} {testwrapper} {
+ destroy .t
+ toplevel .t
+ wm geom .t 200x200
+ wm minsize .t 300 300
update
- list [winfo width .t] [winfo height .t]
-} {150 100}
+ set hints [testprop [testwrapper .t] WM_NORMAL_HINTS]
+ format {%d %d} [lindex $hints 5] [lindex $hints 6]
+} {300 300}
-catch {destroy .t}
-catch {destroy .icon}
+test unixWm-29.3 {Tk_WmCmd procedure, "minsize" option, setting the
+ minsize to a value larger than the current size should
+ set the minsize in WM_NORMAL_HINTS even if the
+ interactive resizable flag is set to 0} {testwrapper} {
+ destroy .t
+ toplevel .t
+ wm geom .t 200x200
+ wm resizable .t 0 0
+ wm minsize .t 300 300
+ update
+ set hints [testprop [testwrapper .t] WM_NORMAL_HINTS]
+ format {%d %d} [lindex $hints 5] [lindex $hints 6]
+} {300 300}
+
+destroy .t .icon
toplevel .t -width 100 -height 50
wm geom .t +0+0
update
@@ -1125,7 +1165,7 @@ test unixWm-33.5 {Tk_WmCmd procedure, "resizable" option} unix {
list [catch {wm resizable . 0 gorp} msg] $msg
} {1 {expected boolean value but got "gorp"}}
test unixWm-33.6 {Tk_WmCmd procedure, "resizable" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 200 -height 100
wm geom .t2 +0+0
set result ""
@@ -1169,7 +1209,7 @@ test unixWm-35.2 {Tk_WmCmd procedure, "state" option} unix {
} {1 {wrong # args: should be "wm state window ?state?"}}
test unixWm-35.3 {Tk_WmCmd procedure, "state" option} unix {
set result {}
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 120 -height 300
wm geometry .t2 +0+0
lappend result [wm state .t2]
@@ -1186,7 +1226,7 @@ test unixWm-35.3 {Tk_WmCmd procedure, "state" option} unix {
} {normal normal withdrawn iconic normal}
test unixWm-35.4 {Tk_WmCmd procedure, "state" option} unix {
set result {}
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 120 -height 300
wm geometry .t2 +0+0
lappend result [wm state .t2]
@@ -1216,7 +1256,7 @@ test unixWm-36.2 {Tk_WmCmd procedure, "title" option} {unix testwrapper} {
test unixWm-37.3 {Tk_WmCmd procedure, "transient" option} {unix testwrapper} {
set result {}
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 120 -height 300
wm geometry .t2 +0+0
update
@@ -1232,9 +1272,9 @@ test unixWm-37.3 {Tk_WmCmd procedure, "transient" option} {unix testwrapper} {
set result
} {{} {} .t 0 {} {}}
test unixWm-37.4 {TkWmDeadWindow, destroy on master should clear transient} {unix testwrapper} {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2
- catch {destroy .t3}
+ destroy .t3
toplevel .t3
wm transient .t2 .t3
update
@@ -1243,8 +1283,8 @@ test unixWm-37.4 {TkWmDeadWindow, destroy on master should clear transient} {uni
list [wm transient .t2] [testprop [testwrapper .t2] WM_TRANSIENT_FOR]
} {{} {}}
test unixWm-37.5 {Tk_WmCmd procedure, "transient" option, create master wrapper} {unix testwrapper} {
- catch {destroy .t2}
- catch {destroy .t3}
+ destroy .t2
+ destroy .t3
toplevel .t2 -width 120 -height 300
wm geometry .t2 +0+0
toplevel .t3 -width 120 -height 300
@@ -1260,7 +1300,7 @@ test unixWm-38.1 {Tk_WmCmd procedure, "withdraw" option} unix {
list [catch {wm withdraw .t 1} msg] $msg
} {1 {wrong # args: should be "wm withdraw window"}}
test unixWm-38.2 {Tk_WmCmd procedure, "withdraw" option} unix {
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 120 -height 300
wm geometry .t2 +0+0
wm iconwindow .t .t2
@@ -1278,13 +1318,12 @@ test unixWm-38.3 {Tk_WmCmd procedure, "withdraw" option} unix {
test unixWm-39.1 {Tk_WmCmd procedure, miscellaneous} unix {
list [catch {wm unknown .t} msg] $msg
-} {1 {bad option "unknown": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw}}
+} {1 {bad option "unknown": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw}}
-catch {destroy .t}
-catch {destroy .icon}
+destroy .t .icon
test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on grid} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t
wm geometry .t 30x10+0+0
listbox .t.l -height 20 -width 20 -setgrid 1
@@ -1293,7 +1332,7 @@ test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on gr
wm geometry .t
} {30x10+0+0}
test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already set} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t
wm geometry .t 200x100+0+0
listbox .t.l -height 20 -width 20
@@ -1305,7 +1344,7 @@ test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already
} {20x20+0+0}
test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 400 -height 150
wm geometry .t +0+0
tkwait visibility .t
@@ -1316,7 +1355,7 @@ test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} u
lappend result [winfo width .t] [winfo height .t]
} {400 150 200 300}
test unixWm-41.2 {ConfigureEvent procedure, menubars} {nonPortable testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -1341,7 +1380,7 @@ test unixWm-41.2 {ConfigureEvent procedure, menubars} {nonPortable testmenubar}
[winfo width .t] [winfo height .t]
} {{.t.m: 200x20} {.t: 200x300} 0 0 200 20 0 20 200 300}
test unixWm-41.3 {ConfigureEvent procedure, synthesized Configure events} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 400 -height 150
wm geometry .t +0+0
tkwait visibility .t
@@ -1352,7 +1391,7 @@ test unixWm-41.3 {ConfigureEvent procedure, synthesized Configure events} unix {
set result
} {configured: 400 150}
test unixWm-41.4 {ConfigureEvent procedure, synthesized Configure events} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 400 -height 150
wm geometry .t +0+0
tkwait visibility .t
@@ -1367,7 +1406,7 @@ test unixWm-41.4 {ConfigureEvent procedure, synthesized Configure events} unix {
# out how to exercise these procedures reliably.
test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 400 -height 150
wm geometry .t +0+0
tkwait visibility .t
@@ -1383,7 +1422,7 @@ test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix {
} {unmapped 0 mapped 1}
test unixWm-43.1 {TopLevelReqProc procedure, embedded in same process} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200
wm geom .t +0+0
frame .t.f -container 1 -bd 2 -relief raised
@@ -1401,7 +1440,7 @@ test unixWm-43.1 {TopLevelReqProc procedure, embedded in same process} unix {
} {70 120 70 120}
test unixWm-43.2 {TopLevelReqProc procedure, resize causes window to move} \
{unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200
wm geom .t +0+0
update
@@ -1416,7 +1455,7 @@ test unixWm-43.2 {TopLevelReqProc procedure, resize causes window to move} \
} {-100 50 300 150}
test unixWm-44.1 {UpdateGeometryInfo procedure, width/height computation} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 200
wm geometry .t +30+40
wm overrideredirect .t 1
@@ -1426,7 +1465,7 @@ test unixWm-44.1 {UpdateGeometryInfo procedure, width/height computation} unix {
list [winfo width .t] [winfo height .t]
} {180 20}
test unixWm-44.2 {UpdateGeometryInfo procedure, width/height computation} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm grid .t 5 4 10 12
wm geometry .t +30+40
@@ -1437,7 +1476,7 @@ test unixWm-44.2 {UpdateGeometryInfo procedure, width/height computation} unix {
list [winfo width .t] [winfo height .t]
} {130 36}
test unixWm-44.3 {UpdateGeometryInfo procedure, width/height computation} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm grid .t 5 4 10 12
wm geometry .t +30+40
@@ -1448,7 +1487,7 @@ test unixWm-44.3 {UpdateGeometryInfo procedure, width/height computation} unix {
list [winfo width .t] [winfo height .t]
} {40 132}
test unixWm-44.4 {UpdateGeometryInfo procedure, width/height computation} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 200
wm geometry .t +30+40
wm overrideredirect .t 1
@@ -1458,7 +1497,7 @@ test unixWm-44.4 {UpdateGeometryInfo procedure, width/height computation} unix {
list [winfo width .t] [winfo height .t]
} {300 150}
test unixWm-44.5 {UpdateGeometryInfo procedure, negative width} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm grid .t 18 7 10 12
wm geometry .t +30+40
@@ -1469,7 +1508,7 @@ test unixWm-44.5 {UpdateGeometryInfo procedure, negative width} unix {
list [winfo width .t] [winfo height .t]
} {1 72}
test unixWm-44.6 {UpdateGeometryInfo procedure, negative height} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm grid .t 18 7 10 12
wm geometry .t +30+40
@@ -1480,7 +1519,7 @@ test unixWm-44.6 {UpdateGeometryInfo procedure, negative height} unix {
list [winfo width .t] [winfo height .t]
} {100 1}
-catch {destroy .t}
+destroy .t
toplevel .t -width 80 -height 60
test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix {
wm geometry .t +5-10
@@ -1489,7 +1528,7 @@ test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix {
list [winfo x .t] [winfo y .t]
} [list 5 [expr [winfo screenheight .t] - 70]]
-catch {destroy .t}
+destroy .t
toplevel .t -width 80 -height 60
test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix {
wm geometry .t -30+2
@@ -1497,10 +1536,10 @@ test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix {
tkwait visibility .t
list [winfo x .t] [winfo y .t]
} [list [expr [winfo screenwidth .t] - 110] 2]
-catch {destroy .t}
+destroy .t
test unixWm-44.9 {UpdateGeometryInfo procedure, updating fixed dimensions} {unix testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm resizable .t 0 0
wm geometry .t +0+0
@@ -1512,7 +1551,7 @@ test unixWm-44.9 {UpdateGeometryInfo procedure, updating fixed dimensions} {unix
[expr [lindex $property 7]] [expr [lindex $property 8]]
} {180 20 180 20}
test unixWm-44.10 {UpdateGeometryInfo procedure, menubar changing} testmenubar {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm resizable .t 0 0
wm geometry .t +0+0
@@ -1527,7 +1566,7 @@ test unixWm-44.10 {UpdateGeometryInfo procedure, menubar changing} testmenubar {
} {{} {}}
test unixWm-45.1 {UpdateSizeHints procedure, grid information} {unix testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm grid .t 6 10 10 5
wm minsize .t 2 4
@@ -1540,7 +1579,7 @@ test unixWm-45.1 {UpdateSizeHints procedure, grid information} {unix testwrapper
[expr [lindex $property 9]] [expr [lindex $property 10]]
} {40 30 320 210 10 5}
test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
wm minsize .t 30 40
wm maxsize .t 200 500
@@ -1552,7 +1591,7 @@ test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper} {
[expr [lindex $property 9]] [expr [lindex $property 10]]
} {30 40 200 500 1 1}
test unixWm-45.3 {UpdateSizeHints procedure, grid with menu} {testmenubar testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
frame .t.menu -height 23 -width 50
testmenubar window .t .t.menu
@@ -1568,7 +1607,7 @@ test unixWm-45.3 {UpdateSizeHints procedure, grid with menu} {testmenubar testwr
[expr [lindex $property 9]] [expr [lindex $property 10]]
} {60 40 53 320 233 10 5}
test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 80 -height 60
frame .t.menu -height 23 -width 50
testmenubar window .t .t.menu
@@ -1585,7 +1624,7 @@ test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenub
# I don't know how to test WaitForConfigureNotify.
test unixWm-46.1 {WaitForEvent procedure, use of modal timeout} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200
wm geom .t +0+0
update
@@ -1599,7 +1638,7 @@ test unixWm-46.1 {WaitForEvent procedure, use of modal timeout} unix {
} {no yes}
test unixWm-47.1 {WaitRestrictProc procedure} {unix nonPortable} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200
frame .t.f -bd 2 -relief raised
place .t.f -x 20 -y 30 -width 100 -height 20
@@ -1624,7 +1663,7 @@ test unixWm-47.1 {WaitRestrictProc procedure} {unix nonPortable} {
# I don't know how to test WaitTimeoutProc, WaitForMapNotify, or UpdateHints.
-catch {destroy .t}
+destroy .t
toplevel .t -width 300 -height 200
wm geometry .t +0+0
tkwait visibility .t
@@ -1668,7 +1707,7 @@ test unixWm-48.12 {ParseGeometry procedure} unix {
catch {wm geometry .t +30+-10}
} {0}
test unixWm-48.13 {ParseGeometry procedure, resize causes window to move} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200
wm geom .t +0+0
update
@@ -1683,7 +1722,7 @@ test unixWm-48.13 {ParseGeometry procedure, resize causes window to move} unix {
} {50 -100 150 300}
test unixWm-49.1 {Tk_GetRootCoords procedure} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200
frame .t.f -width 150 -height 100 -bd 2 -relief raised
place .t.f -x 150 -y 120
@@ -1695,7 +1734,7 @@ test unixWm-49.1 {Tk_GetRootCoords procedure} unix {
list [winfo rootx .t.f.f] [winfo rooty .t.f.f]
} {202 192}
test unixWm-49.2 {Tk_GetRootCoords procedure, menubars} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -1785,7 +1824,7 @@ test unixWm-50.3 {
cleanupbg
} -result {{} .x .t .t.f}
test unixWm-50.4 {Tk_CoordsToWindow procedure, window in other application} unix {
- catch {destroy .t}
+ destroy .t
catch {interp delete slave}
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +0+0
@@ -1838,7 +1877,7 @@ test unixWm-50.6 {Tk_CoordsToWindow procedure, embedding within one app.} unix {
[winfo containing [expr $x +250] [expr $y +80]]
} {.t .t2 .t2 .t}
test unixWm-50.7 {Tk_CoordsToWindow procedure, more basics} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 400 -bg green
wm geom .t +0+0
frame .t.f -width 100 -height 200 -bd 2 -relief raised
@@ -1855,7 +1894,7 @@ test unixWm-50.7 {Tk_CoordsToWindow procedure, more basics} unix {
[winfo containing $x [expr $y + 450]]
} {.t .t.f .t.f.f .t {}}
test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 400 -height 300 -bg green
wm geom .t +0+0
frame .t.f -width 200 -height 100 -bd 2 -relief raised
@@ -1872,8 +1911,8 @@ test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix {
[winfo containing [expr $x + 450] $y]
} {.t .t.f .t.f.f .t {}}
test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix {
- catch {destroy .t}
- catch {destroy .t2}
+ destroy .t
+ destroy .t2
sleep 500 ;# Give window manager time to catch up.
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +0+0
@@ -1886,7 +1925,7 @@ test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix {
lappend result [winfo containing 100 100]
} {.t2 .t}
test unixWm-50.10 {Tk_CoordsToWindow procedure, unmapped windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +0+0
frame .t.f -width 150 -height 150 -bd 2 -relief raised
@@ -1956,18 +1995,18 @@ test unixWm-51.5 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable}
} {.raise1 .raise3}
deleteWindows
test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapped} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +0+0
tkwait visibility .t
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 200 -height 200 -bg red
wm geometry .t2 +0+0
winfo containing 100 100
} {.t}
test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix {
foreach w {.t .t2 .t3} {
- catch {destroy $w}
+ destroy $w
toplevel $w -width 200 -height 200 -bg green
wm geometry $w +0+0
}
@@ -1980,12 +2019,12 @@ test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix
lappend result [winfo containing 100 100]
} {.t3 .t}
test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200 -bg green
wm overrideredirect .t 1
wm geometry .t +0+0
tkwait visibility .t
- catch {destroy .t2}
+ destroy .t2
toplevel .t2 -width 200 -height 200 -bg red
wm overrideredirect .t2 1
wm geometry .t2 +0+0
@@ -2006,7 +2045,7 @@ test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix
} {.t2 .t .t2}
test unixWm-51.9 {TkWmRestackToplevel procedure, other window overrideredirect} unix {
foreach w {.t .t2 .t3} {
- catch {destroy $w}
+ destroy $w
toplevel $w -width 200 -height 200 -bg green
wm overrideredirect $w 1
wm geometry $w +0+0
@@ -2049,14 +2088,14 @@ test unixWm-51.13 {TkWmRestackToplevel procedure, don't move window that's alrea
} 1
test unixWm-52.1 {TkWmAddToColormapWindows procedure} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 200 -height 200 -colormap new -relief raised -bd 2
wm geom .t +0+0
update
wm colormap .t
} {}
test unixWm-52.2 {TkWmAddToColormapWindows procedure} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -colormap new -relief raised -bd 2
wm geom .t +0+0
frame .t.f -width 100 -height 100 -colormap new -relief sunken -bd 2
@@ -2065,7 +2104,7 @@ test unixWm-52.2 {TkWmAddToColormapWindows procedure} unix {
wm colormap .t
} {.t.f .t}
test unixWm-52.3 {TkWmAddToColormapWindows procedure} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -colormap new
wm geom .t +0+0
frame .t.f -width 100 -height 100 -colormap new -relief sunken -bd 2
@@ -2076,7 +2115,7 @@ test unixWm-52.3 {TkWmAddToColormapWindows procedure} unix {
wm colormap .t
} {.t.f .t.f2 .t}
test unixWm-52.4 {TkWmAddToColormapWindows procedure} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -colormap new
wm geom .t +0+0
frame .t.f -width 100 -height 100 -colormap new -relief sunken -bd 2
@@ -2090,7 +2129,7 @@ test unixWm-52.4 {TkWmAddToColormapWindows procedure} unix {
} {.t.f}
test unixWm-53.1 {TkWmRemoveFromColormapWindows procedure} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -colormap new
wm geom .t +0+0
frame .t.f -width 100 -height 100 -colormap new -relief sunken -bd 2
@@ -2102,7 +2141,7 @@ test unixWm-53.1 {TkWmRemoveFromColormapWindows procedure} unix {
wm colormap .t
} {.t.f .t}
test unixWm-53.2 {TkWmRemoveFromColormapWindows procedure} unix {
- catch {destroy .t}
+ destroy .t
toplevel .t -colormap new
wm geom .t +0+0
frame .t.f -width 100 -height 100 -colormap new -relief sunken -bd 2
@@ -2115,9 +2154,9 @@ test unixWm-53.2 {TkWmRemoveFromColormapWindows procedure} unix {
wm colormap .t
} {}
-test unixWm-54.1 {TkpMakeMenuWindow procedure, setting save_under} unix {
- catch {destroy .t}
- catch {destroy .m}
+test unixWm-54.1 {TkpMakeMenuWindow procedure, setting save_under} {unix nonUnixUserInteraction} {
+ destroy .t
+ destroy .m
toplevel .t -width 300 -height 200 -bd 2 -relief raised
bind .t <Expose> {set x exposed}
wm geom .t +0+0
@@ -2132,8 +2171,8 @@ test unixWm-54.1 {TkpMakeMenuWindow procedure, setting save_under} unix {
destroy .m
set x
} {no event}
-test unixWm-54.2 {TkpMakeMenuWindow procedure, setting override_redirect} unix {
- catch {destroy .m}
+test unixWm-54.2 {TkpMakeMenuWindow procedure, setting override_redirect} {unix nonUnixUserInteraction} {
+ destroy .m
menu .m
.m add command -label First
.m add command -label Second
@@ -2148,7 +2187,7 @@ test unixWm-54.2 {TkpMakeMenuWindow procedure, setting override_redirect} unix {
# No tests for TkGetPointerCoords, CreateWrapper, or GetMaxSize.
test unixWm-55.1 {TkUnixSetMenubar procedure} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -2160,8 +2199,8 @@ test unixWm-55.1 {TkUnixSetMenubar procedure} {unix testmenubar} {
[expr [winfo rooty .t] - [winfo rooty .t.f]]
} {1 300x30+0+0 0 30}
test unixWm-55.2 {TkUnixSetMenubar procedure, removing menubar} {unix testmenubar} {
- catch {destroy .t}
- catch {destroy .f}
+ destroy .t
+ destroy .f
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -2179,7 +2218,7 @@ test unixWm-55.2 {TkUnixSetMenubar procedure, removing menubar} {unix testmenuba
[expr [winfo rooty .] - [winfo rooty .f]]
} {0 300x30+0+0 0 0 0 0}
test unixWm-55.3 {TkUnixSetMenubar procedure, removing geometry manager} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -2196,7 +2235,7 @@ test unixWm-55.3 {TkUnixSetMenubar procedure, removing geometry manager} {unix t
lappend result [expr [winfo rootx .t] - $x] [expr [winfo rooty .t] - $y]
} {0 0 0 0}
test unixWm-55.4 {TkUnixSetMenubar procedure, toplevel not yet created} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
frame .t.f -width 400 -height 30 -bd 2 -relief raised -bg green
testmenubar window .t .t.f
@@ -2207,8 +2246,8 @@ test unixWm-55.4 {TkUnixSetMenubar procedure, toplevel not yet created} {unix te
[expr [winfo rooty .t] - [winfo rooty .t.f]]
} {1 300x30+0+0 0 30}
test unixWm-55.5 {TkUnixSetMenubar procedure, changing menubar} {unix testmenubar} {
- catch {destroy .t}
- catch {destroy .f}
+ destroy .t
+ destroy .f
toplevel .t -width 300 -height 200 -bd 2 -relief raised
frame .t.f -width 400 -height 30 -bd 2 -relief raised -bg green
wm geom .t +0+0
@@ -2226,7 +2265,7 @@ test unixWm-55.5 {TkUnixSetMenubar procedure, changing menubar} {unix testmenuba
lappend result [expr [winfo rooty .f] - $y]
} {0 1 0 1 0 0}
test unixWm-55.6 {TkUnixSetMenubar procedure, changing menubar to self} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
frame .t.f -width 400 -height 30 -bd 2 -relief raised -bg green
testmenubar window .t .t.f
@@ -2239,8 +2278,8 @@ test unixWm-55.6 {TkUnixSetMenubar procedure, changing menubar to self} {unix te
[expr [winfo rooty .t] - [winfo rooty .t.f]]
} {1 300x30+0+0 0 30}
test unixWm-55.7 {TkUnixSetMenubar procedure, unsetting event handler} {unix testmenubar} {
- catch {destroy .t}
- catch {destroy .f}
+ destroy .t
+ destroy .f
toplevel .t -width 300 -height 200 -bd 2 -relief raised
frame .t.f -width 400 -height 30 -bd 2 -relief raised -bg green
frame .f -width 400 -height 40 -bd 2 -relief raised -bg blue
@@ -2259,7 +2298,7 @@ test unixWm-55.7 {TkUnixSetMenubar procedure, unsetting event handler} {unix tes
} {30 40 40}
test unixWm-56.1 {MenubarDestroyProc procedure} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -2274,7 +2313,7 @@ test unixWm-56.1 {MenubarDestroyProc procedure} {unix testmenubar} {
} {30 0}
test unixWm-57.1 {MenubarReqProc procedure} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -2289,7 +2328,7 @@ test unixWm-57.1 {MenubarReqProc procedure} {unix testmenubar} {
lappend result [expr [winfo rootx .t] - $x] [expr [winfo rooty .t] - $y]
} {0 10 0 100}
test unixWm-57.2 {MenubarReqProc procedure} {unix testmenubar} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 300 -height 200 -bd 2 -relief raised
wm geom .t +0+0
update
@@ -2305,7 +2344,7 @@ test unixWm-57.2 {MenubarReqProc procedure} {unix testmenubar} {
} {0 20 0 1}
test unixWm-58.1 {UpdateCommand procedure, DString gets reallocated} {unix testwrapper} {
- catch {destroy .t}
+ destroy .t
toplevel .t -width 100 -height 50
wm geom .t +0+0
wm command .t "argumentNumber0 argumentNumber1 argumentNumber2 argumentNumber0 argumentNumber3 argumentNumber4 argumentNumber5 argumentNumber6 argumentNumber0 argumentNumber7 argumentNumber8 argumentNumber9 argumentNumber10 argumentNumber0 argumentNumber11 argumentNumber12 argumentNumber13 argumentNumber14 argumentNumber15 argumentNumber16 argumentNumber17 argumentNumber18"
@@ -2351,14 +2390,16 @@ test unixWm-59.1 {exit processing} unix {
list $error $msg
} {0 {}}
test unixWm-59.2 {exit processing} unix {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
interp create x
x eval {set argc 2}
x eval {set argv "-geometry 10x10+0+0"}
x eval {load {} Tk}
update
exit
- } script]
+ }
+ set script [makeFile $code script]
if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
set error 1
} else {
@@ -2368,7 +2409,8 @@ test unixWm-59.2 {exit processing} unix {
list $error $msg
} {0 {}}
test unixWm-59.3 {exit processing} unix {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
interp create x
x eval {set argc 2}
x eval {set argv "-geometry 10x10+0+0"}
@@ -2381,7 +2423,8 @@ test unixWm-59.3 {exit processing} unix {
proc destroy_x {} {interp delete x}
update
exit
- } script]
+ }
+ set script [makeFile $code script]
if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
set error 1
} else {
@@ -2391,16 +2434,42 @@ test unixWm-59.3 {exit processing} unix {
list $error $msg
} {0 {}}
-test unixWm-60.1 {wm attributes} unix {
+#
+# wm attributes tests:
+#
+# NOTE: since [wm attributes] is not guaranteed to have any effect,
+# the only thing we can really test here is the syntax.
+#
+test unixWm-60.1 {wm attributes - test} -constraints unix -body {
destroy .t
toplevel .t
wm attributes .t
-} {-type {}}
-test unixWm-60.2 {wm attributes} unix {
+} -result [list -alpha 1.0 -topmost 0 -zoomed 0 -fullscreen 0 -type {}]
+
+test unixWm-60.2 {wm attributes - test} -constraints unix -body {
+ destroy .t
+ toplevel .t
+ wm attributes .t -topmost
+} -result 0
+
+test unixWm-60.3 {wm attributes - set (unrealized)} -constraints unix -body {
destroy .t
toplevel .t
- list [catch {wm attributes .t -foo} msg] $msg
-} {1 {wrong # args: should be "wm attributes window ?-type list?"}}
+ wm attributes .t -topmost 1
+}
+
+test unixWm-60.4 {wm attributes - set (realized)} -constraints unix -body {
+ destroy .t
+ toplevel .t
+ tkwait visibility .t
+ wm attributes .t -topmost 1
+}
+
+test unixWm-60.5 {wm attributes - bad attribute} -constraints unix -body {
+ destroy .t
+ toplevel .t
+ wm attributes .t -foo
+} -returnCodes 1 -match glob -result {bad attribute "-foo":*}
test unixWm-61.1 {Tk_WmCmd procedure, "iconphoto" option} unix {
list [catch {wm iconph .} msg] $msg
@@ -2415,45 +2484,54 @@ test unixWm-61.2 {Tk_WmCmd procedure, "iconphoto" option} unix {
image delete blank16 blank32
} {}
-test unixWm-62.0 {wm attributes -type void} unix {
+test unixWm-62.0 {wm attributes -type void} -constraints unix -setup {
destroy .t
toplevel .t
- set r [list [catch {wm attributes .t -type {}} err] $err]
+} -body {
+ wm attributes .t -type {}
+} -cleanup {
destroy .t
- set r
-} {0 {}}
-test unixWm-62.1 {wm attributes -type name} unix {
+} -result {}
+
+test unixWm-62.1 {wm attributes -type name} -constraints unix -setup {
destroy .t
toplevel .t
- set r [list [catch {wm attributes .t -type dialog} err] $err]
+} -body {
+ wm attributes .t -type dialog
+} -cleanup {
destroy .t
- set r
-} {0 {}}
-test unixWm-62.1 {wm attributes -type name} unix {
+} -result {}
+
+test unixWm-62.2 {wm attributes -type name} -constraints unix -setup {
destroy .t
toplevel .t
+} -body {
tkwait visibility .t
- set r [list [catch {wm attributes .t -type dialog} err] $err]
+ wm attributes .t -type dialog
+} -cleanup {
destroy .t
- set r
-} {0 {}}
-test unixWm-62.2 {wm attributes -type list} unix {
+} -result {}
+
+test unixWm-62.3 {wm attributes -type list} -constraints unix -setup {
destroy .t
toplevel .t
- set r [list [catch {wm attributes .t -type {xyzzy dialog}} err] $err]
+} -body {
+ wm attributes .t -type {xyzzy dialog}
+} -cleanup {
destroy .t
- set r
-} {0 {}}
-test unixWm-62.2 {wm attributes -type list} unix {
+} -result {}
+
+test unixWm-62.4 {wm attributes -type list} -constraints unix -setup {
destroy .t
toplevel .t
+} -body {
tkwait visibility .t
- set r [list [catch {wm attributes .t -type {xyzzy dialog}} err] $err]
+ wm attributes .t -type {xyzzy dialog}
+} -cleanup {
destroy .t
- set r
-} {0 {}}
+} -result {}
# cleanup
-catch {destroy .t}
-::tcltest::cleanupTests
+destroy .t
+cleanupTests
return
diff --git a/tests/util.test b/tests/util.test
index 66ce26f..86271c5 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
listbox .l -width 20 -height 5 -relief sunken -bd 2
@@ -65,18 +62,5 @@ test util-1.12 {Tk_GetScrollInfo procedure} {
} {1 {unknown option "dropdead": must be moveto or scroll}}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/visual.test b/tests/visual.test
index 3f56e21..1006e18 100644
--- a/tests/visual.test
+++ b/tests/visual.test
@@ -8,10 +8,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
update
@@ -70,43 +67,43 @@ if {[llength $avail] > 1} {
}
}
}
+testConstraint haveOtherVisual [expr {$other ne ""}]
+testConstraint havePseudocolorVisual [string match *pseudocolor* $avail]
+testConstraint haveMultipleVisuals [expr {[llength $avail] > 1}]
test visual-1.1 {Tk_GetVisual, copying from other window} {
list [catch {toplevel .t -visual .foo.bar} msg] $msg
} {1 {bad window path name ".foo.bar"}}
-if {$other != ""} {
- test visual-1.2 {Tk_GetVisual, copying from other window} {nonPortable} {
- catch {destroy .t1}
- catch {destroy .t2}
- toplevel .t1 -width 250 -height 100 -visual $other
- wm geom .t1 +0+0
- toplevel .t2 -width 200 -height 80 -visual .t1
- wm geom .t2 +5+5
- concat "[winfo visual .t2] [winfo depth .t2]"
- } $other
- test visual-1.3 {Tk_GetVisual, copying from other window} {
- catch {destroy .t1}
- catch {destroy .t2}
- toplevel .t1 -width 250 -height 100 -visual $other
- wm geom .t1 +0+0
- toplevel .t2 -width 200 -height 80 -visual .
- wm geom .t2 +5+5
- concat "[winfo visual .t2] [winfo depth .t2]"
- } $default
-
- # Make sure reference count is incremented when copying visual (the
- # following test will cause the colormap to be freed prematurely if
- # the reference count isn't incremented).
- test visual-1.4 {Tk_GetVisual, colormap reference count} {
- catch {destroy .t1}
- catch {destroy .t2}
- toplevel .t1 -width 250 -height 100 -visual $other
- wm geom .t1 +0+0
- set result [list [catch {toplevel .t2 -gorp 80 -visual .t1} msg] $msg]
- update
- set result
- } {1 {unknown option "-gorp"}}
-}
+test visual-1.2 {Tk_GetVisual, copying from other window} {haveOtherVisual nonPortable} {
+ catch {destroy .t1}
+ catch {destroy .t2}
+ toplevel .t1 -width 250 -height 100 -visual $other
+ wm geom .t1 +0+0
+ toplevel .t2 -width 200 -height 80 -visual .t1
+ wm geom .t2 +5+5
+ concat "[winfo visual .t2] [winfo depth .t2]"
+} $other
+test visual-1.3 {Tk_GetVisual, copying from other window} haveOtherVisual {
+ catch {destroy .t1}
+ catch {destroy .t2}
+ toplevel .t1 -width 250 -height 100 -visual $other
+ wm geom .t1 +0+0
+ toplevel .t2 -width 200 -height 80 -visual .
+ wm geom .t2 +5+5
+ concat "[winfo visual .t2] [winfo depth .t2]"
+} $default
+# Make sure reference count is incremented when copying visual (the
+# following test will cause the colormap to be freed prematurely if
+# the reference count isn't incremented).
+test visual-1.4 {Tk_GetVisual, colormap reference count} haveOtherVisual {
+ catch {destroy .t1}
+ catch {destroy .t2}
+ toplevel .t1 -width 250 -height 100 -visual $other
+ wm geom .t1 +0+0
+ set result [list [catch {toplevel .t2 -gorp 80 -visual .t1} msg] $msg]
+ update
+ set result
+} {1 {unknown option "-gorp"}}
test visual-1.5 {Tk_GetVisual, default colormap} {
catch {destroy .t1}
toplevel .t1 -width 250 -height 100 -visual default
@@ -164,7 +161,7 @@ test visual-3.5 {Tk_GetVisual, parsing visual string} {
} msg] $msg
} {1 {expected integer but got "48x"}}
-if {$other != ""} {
+test visual-4.1 {Tk_GetVisual, numerical visual id} -setup {
catch {destroy .t1}
catch {destroy .t2}
catch {destroy .t3}
@@ -174,95 +171,93 @@ if {$other != ""} {
wm geom .t2 +5+5
toplevel .t3 -width 150 -height 250 -visual [winfo visual .t1]
wm geom .t3 +10+10
- test visual-4.1 {Tk_GetVisual, numerical visual id} nonPortable {
- list [winfo visualid .t2] [winfo visualid .t3]
- } [list [winfo visualid .] [winfo visualid .t1]]
+} -constraints {haveOtherVisual nonPortable} -body {
+ set v1 [list [winfo visualid .t2] [winfo visualid .t3]]
+ set v2 [list [winfo visualid .] [winfo visualid .t1]]
+ expr {$v1 eq $v2 ? "OK" : "[list $v1] ne [list $v2]"}
+} -result OK -cleanup {
destroy .t1 .t2 .t3
}
test visual-4.2 {Tk_GetVisual, numerical visual id} {
catch {destroy .t1}
list [catch {toplevel .t1 -visual 12xyz} msg] $msg
-} {1 {bad X identifier for visual: 12xyz"}}
+} {1 {bad X identifier for visual: "12xyz"}}
test visual-4.3 {Tk_GetVisual, numerical visual id} {
catch {destroy .t1}
list [catch {toplevel .t1 -visual 1291673} msg] $msg
} {1 {couldn't find an appropriate visual}}
-if ![string match *pseudocolor* $avail] {
- test visual-5.1 {Tk_GetVisual, no matching visual} {
- catch {destroy .t1}
- list [catch {
- toplevel .t1 -width 250 -height 100 -visual "pseudocolor 8"
- wm geometry .t1 +0+0
- } msg] $msg
- } {1 {couldn't find an appropriate visual}}
-}
-
-if {[string match *pseudocolor* $avail] && ([llength $avail] > 1)} {
- test visual-6.1 {Tk_GetVisual, no matching visual} {nonPortable} {
- catch {destroy .t1}
- toplevel .t1 -width 250 -height 100 -visual "best"
+test visual-5.1 {Tk_GetVisual, no matching visual} !havePseudocolorVisual {
+ catch {destroy .t1}
+ list [catch {
+ toplevel .t1 -width 250 -height 100 -visual "pseudocolor 8"
wm geometry .t1 +0+0
- update
- winfo visual .t1
- } {pseudocolor}
-}
+ } msg] $msg
+} {1 {couldn't find an appropriate visual}}
+
+test visual-6.1 {Tk_GetVisual, no matching visual} {havePseudocolorVisual haveMultipleVisuals nonPortable} {
+ catch {destroy .t1}
+ toplevel .t1 -width 250 -height 100 -visual "best"
+ wm geometry .t1 +0+0
+ update
+ winfo visual .t1
+} {pseudocolor}
# These tests are non-portable due to variations in how many colors
# are already in use on the screen.
-if {([winfo visual .] == "pseudocolor") && ([winfo depth .] == 8)} {
+if {[testConstraint defaultPseudocolor8]} {
eatColors .t1
- test visual-7.1 {Tk_GetColormap, "new"} {nonPortable} {
- toplevel .t2 -width 30 -height 20
- wm geom .t2 +0+0
- update
- colorsFree .t2
- } {0}
- test visual-7.2 {Tk_GetColormap, "new"} {nonPortable} {
- catch {destroy .t2}
- toplevel .t2 -width 30 -height 20 -colormap new
- wm geom .t2 +0+0
- update
- colorsFree .t2
- } {1}
- test visual-7.3 {Tk_GetColormap, copy from other window} {nonPortable} {
- catch {destroy .t2}
- toplevel .t3 -width 400 -height 50 -colormap new
- wm geom .t3 +0+0
- catch {destroy .t2}
- toplevel .t2 -width 30 -height 20 -colormap .t3
- wm geom .t2 +0+0
- update
- destroy .t3
- colorsFree .t2
- } {1}
- test visual-7.4 {Tk_GetColormap, copy from other window} {nonPortable} {
- catch {destroy .t2}
- toplevel .t3 -width 400 -height 50 -colormap new
- wm geom .t3 +0+0
- catch {destroy .t2}
- toplevel .t2 -width 30 -height 20 -colormap .
- wm geom .t2 +0+0
- update
- destroy .t3
- colorsFree .t2
- } {0}
- test visual-7.5 {Tk_GetColormap, copy from other window} {nonPortable} {
- catch {destroy .t1}
- list [catch {toplevel .t1 -width 400 -height 50 \
- -colormap .choke.lots} msg] $msg
- } {1 {bad window path name ".choke.lots"}}
- if {$other != {}} {
- test visual-7.6 {Tk_GetColormap, copy from other window} {nonPortable} {
- catch {destroy .t1}
- catch {destroy .t2}
- toplevel .t1 -width 300 -height 150 -visual $other
- wm geometry .t1 +0+0
- list [catch {toplevel .t2 -width 400 -height 50 \
- -colormap .t1} msg] $msg
- } {1 {can't use colormap for .t1: incompatible visuals}}
- }
+}
+test visual-7.1 {Tk_GetColormap, "new"} {defaultPseudocolor8 nonPortable} {
+ toplevel .t2 -width 30 -height 20
+ wm geom .t2 +0+0
+ update
+ colorsFree .t2
+} {0}
+test visual-7.2 {Tk_GetColormap, "new"} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t2}
+ toplevel .t2 -width 30 -height 20 -colormap new
+ wm geom .t2 +0+0
+ update
+ colorsFree .t2
+} {1}
+test visual-7.3 {Tk_GetColormap, copy from other window} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t2}
+ toplevel .t3 -width 400 -height 50 -colormap new
+ wm geom .t3 +0+0
+ catch {destroy .t2}
+ toplevel .t2 -width 30 -height 20 -colormap .t3
+ wm geom .t2 +0+0
+ update
+ destroy .t3
+ colorsFree .t2
+} {1}
+test visual-7.4 {Tk_GetColormap, copy from other window} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t2}
+ toplevel .t3 -width 400 -height 50 -colormap new
+ wm geom .t3 +0+0
+ catch {destroy .t2}
+ toplevel .t2 -width 30 -height 20 -colormap .
+ wm geom .t2 +0+0
+ update
+ destroy .t3
+ colorsFree .t2
+} {0}
+test visual-7.5 {Tk_GetColormap, copy from other window} {defaultPseudocolor8 nonPortable} {
+ catch {destroy .t1}
+ list [catch {
+ toplevel .t1 -width 400 -height 50 -colormap .choke.lots
+ } msg] $msg
+} {1 {bad window path name ".choke.lots"}}
+test visual-7.6 {Tk_GetColormap, copy from other window} {defaultPseudocolor8 haveOtherVisual nonPortable} {
+ catch {destroy .t1}
+ catch {destroy .t2}
+ toplevel .t1 -width 300 -height 150 -visual $other
+ wm geometry .t1 +0+0
+ list [catch {toplevel .t2 -width 400 -height 50 -colormap .t1} msg] $msg
+} {1 {can't use colormap for .t1: incompatible visuals}}
+if {[testConstraint defaultPseudocolor8]} {
catch {destroy .t1}
catch {destroy .t2}
}
@@ -280,39 +275,24 @@ test visual-8.1 {Tk_FreeColormap procedure} {
destroy .t4
update
} {}
-if {$other != {}} {
- test visual-8.2 {Tk_FreeColormap procedure} {
- deleteWindows
- toplevel .t1 -width 300 -height 180 -visual $other
- wm geometry .t1 +0+0
- foreach i {.t2 .t3 .t4} {
- toplevel $i -width 250 -height 150 -visual $other
- wm geometry $i +0+0
- }
- destroy .t2
- destroy .t3
- destroy .t4
- update
- } {}
-}
+test visual-8.2 {Tk_FreeColormap procedure} haveOtherVisual {
+ deleteWindows
+ toplevel .t1 -width 300 -height 180 -visual $other
+ wm geometry .t1 +0+0
+ foreach i {.t2 .t3 .t4} {
+ toplevel $i -width 250 -height 150 -visual $other
+ wm geometry $i +0+0
+ }
+ destroy .t2
+ destroy .t3
+ destroy .t4
+ update
+} {}
deleteWindows
rename eatColors {}
rename colorsFree {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/visual_bb.test b/tests/visual_bb.test
index 8bab7e4..6b10f76 100644
--- a/tests/visual_bb.test
+++ b/tests/visual_bb.test
@@ -7,14 +7,9 @@
# are kept in separate ".tcl" files in this directory.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::cleanupTests
-
set auto_path ". $auto_path"
wm title . "Visual Tests for Tk"
diff --git a/tests/winButton.test b/tests/winButton.test
index 204bc67..5bf6867 100644
--- a/tests/winButton.test
+++ b/tests/winButton.test
@@ -9,10 +9,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
proc bogusTrace args {
@@ -32,14 +29,14 @@ radiobutton .r -text Radiobutton
pack .l .b .c .r
update
-test winbutton-1.1 {TkpComputeButtonGeometry procedure} {testImageType pcOnly} {
+test winbutton-1.1 {TkpComputeButtonGeometry procedure} {testImageType win} {
deleteWindows
image create test image1
image1 changed 0 0 0 0 60 40
label .b1 -image image1 -bd 4 -padx 0 -pady 2
button .b2 -image image1 -bd 4 -padx 0 -pady 2
- checkbutton .b3 -image image1 -bd 4 -padx 1 -pady 1
- radiobutton .b4 -image image1 -bd 4 -padx 2 -pady 0
+ checkbutton .b3 -image image1 -bd 4 -padx 1 -pady 1 -font {{MS Sans Serif} 8}
+ radiobutton .b4 -image image1 -bd 4 -padx 2 -pady 0 -font {{MS Sans Serif} 8}
pack .b1 .b2 .b3 .b4
update
# with patch 463234 with native L&F enabled, this returns:
@@ -49,12 +46,12 @@ test winbutton-1.1 {TkpComputeButtonGeometry procedure} {testImageType pcOnly} {
[winfo reqwidth .b3] [winfo reqheight .b3] \
[winfo reqwidth .b4] [winfo reqheight .b4]
} {68 48 70 50 90 52 90 52}
-test winbutton-1.2 {TkpComputeButtonGeometry procedure} {pcOnly} {
+test winbutton-1.2 {TkpComputeButtonGeometry procedure} win {
deleteWindows
label .b1 -bitmap question -bd 3 -padx 0 -pady 2
button .b2 -bitmap question -bd 3 -padx 0 -pady 2
- checkbutton .b3 -bitmap question -bd 3 -padx 1 -pady 1
- radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0
+ checkbutton .b3 -bitmap question -bd 3 -padx 1 -pady 1 -font {{MS Sans Serif} 8}
+ radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0 -font {{MS Sans Serif} 8}
pack .b1 .b2 .b3 .b4
update
# with patch 463234 with native L&F enabled, this returns:
@@ -64,7 +61,7 @@ test winbutton-1.2 {TkpComputeButtonGeometry procedure} {pcOnly} {
[winfo reqwidth .b3] [winfo reqheight .b3] \
[winfo reqwidth .b4] [winfo reqheight .b4]
} {23 33 25 35 45 37 45 37}
-test winbutton-1.3 {TkpComputeButtonGeometry procedure} {pcOnly} {
+test winbutton-1.3 {TkpComputeButtonGeometry procedure} win {
deleteWindows
label .b1 -bitmap question -bd 3 -highlightthickness 4
button .b2 -bitmap question -bd 3 -highlightthickness 0
@@ -80,7 +77,7 @@ test winbutton-1.3 {TkpComputeButtonGeometry procedure} {pcOnly} {
[winfo reqwidth .b3] [winfo reqheight .b3] \
[winfo reqwidth .b4] [winfo reqheight .b4]
} {31 41 23 33 27 37 27 37}
-test winbutton-1.4 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
+test winbutton-1.4 {TkpComputeButtonGeometry procedure} {win nonPortable} {
deleteWindows
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
@@ -93,21 +90,21 @@ test winbutton-1.4 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
[winfo reqwidth .b3] [winfo reqheight .b3] \
[winfo reqwidth .b4] [winfo reqheight .b4]
} {58 24 67 33 88 30 90 28}
-test winbutton-1.5 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
+test winbutton-1.5 {TkpComputeButtonGeometry procedure} {win nonPortable} {
deleteWindows
label .l1 -text "This is a long string that will wrap around on several lines.\n\nIt also has a blank line (above)." -wraplength 1.5i -padx 0 -pady 0
pack .l1
update
list [winfo reqwidth .l1] [winfo reqheight .l1]
} {178 84}
-test winbutton-1.6 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
+test winbutton-1.6 {TkpComputeButtonGeometry procedure} {win nonPortable} {
deleteWindows
label .l1 -text "This is a long string without wrapping.\n\nIt also has a blank line (above)." -padx 0 -pady 0
pack .l1
update
list [winfo reqwidth .l1] [winfo reqheight .l1]
} {222 52}
-test winbutton-1.7 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
+test winbutton-1.7 {TkpComputeButtonGeometry procedure} {win nonPortable} {
deleteWindows
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -width 10
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -height 5
@@ -120,7 +117,7 @@ test winbutton-1.7 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
[winfo reqwidth .b3] [winfo reqheight .b3] \
[winfo reqwidth .b4] [winfo reqheight .b4]
} {74 24 67 97 174 46 64 28}
-test winbutton-1.8 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
+test winbutton-1.8 {TkpComputeButtonGeometry procedure} {win nonPortable} {
deleteWindows
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 \
-highlightthickness 4
@@ -136,7 +133,7 @@ test winbutton-1.8 {TkpComputeButtonGeometry procedure} {pcOnly nonPortable} {
[winfo reqwidth .b3] [winfo reqheight .b3] \
[winfo reqwidth .b4] [winfo reqheight .b4]
} {66 32 65 31 69 31 71 29}
-test winbutton-1.9 {TkpComputeButtonGeometry procedure} {pcOnly} {
+test winbutton-1.9 {TkpComputeButtonGeometry procedure} win {
deleteWindows
button .b2 -bitmap question -default normal
list [winfo reqwidth .b2] [winfo reqheight .b2]
@@ -144,5 +141,5 @@ test winbutton-1.9 {TkpComputeButtonGeometry procedure} {pcOnly} {
# cleanup
deleteWindows
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/winClipboard.test b/tests/winClipboard.test
index cc401c6..ec84362 100644
--- a/tests/winClipboard.test
+++ b/tests/winClipboard.test
@@ -11,32 +11,25 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::bytestring
-
# Note that these tests may fail if another application is grabbing the
# clipboard (e.g. an X server)
-testConstraint testclipboard [llength [info commands testclipboard]]
-
-test winClipboard-1.1 {TkSelGetSelection} {pcOnly} {
+test winClipboard-1.1 {TkSelGetSelection} win {
clipboard clear
catch {selection get -selection CLIPBOARD} msg
set msg
} {CLIPBOARD selection doesn't exist or form "STRING" not defined}
-test winClipboard-1.2 {TkSelGetSelection} {pcOnly testclipboard} {
+test winClipboard-1.2 {TkSelGetSelection} {win testclipboard} {
clipboard clear
clipboard append {}
catch {selection get -selection CLIPBOARD} r1
catch {testclipboard} r2
list $r1 $r2
} {{} {}}
-test winClipboard-1.3 {TkSelGetSelection & TkWinClipboardRender} {pcOnly testclipboard} {
+test winClipboard-1.3 {TkSelGetSelection & TkWinClipboardRender} {win testclipboard} {
clipboard clear
clipboard append abcd
update
@@ -44,14 +37,14 @@ test winClipboard-1.3 {TkSelGetSelection & TkWinClipboardRender} {pcOnly testcli
catch {testclipboard} r2
list $r1 $r2
} {abcd abcd}
-test winClipboard-1.4 {TkSelGetSelection & TkWinClipboardRender} {pcOnly testclipboard} {
+test winClipboard-1.4 {TkSelGetSelection & TkWinClipboardRender} {win testclipboard} {
clipboard clear
clipboard append "line 1\nline 2"
catch {selection get -selection CLIPBOARD} r1
catch {testclipboard} r2
list $r1 $r2
} [list "line 1\nline 2" "line 1\r\nline 2"]
-test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} {pcOnly testclipboard} {
+test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} {win testclipboard} {
clipboard clear
clipboard append "line 1\u00c7\nline 2"
catch {selection get -selection CLIPBOARD} r1
@@ -59,7 +52,7 @@ test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} {pcOnly testcli
list $r1 $r2
} [list "line 1\u00c7\nline 2" [bytestring "line 1\u00c7\r\nline 2"]]
-test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} {pcOnly testclipboard} {
+test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} {win testclipboard} {
clipboard clear
clipboard append -type OUR_ACTION "action data"
clipboard append "string data"
@@ -68,7 +61,7 @@ test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} {pcOnly testclip
catch {testclipboard} r2
list $r1 $r2
} [list "action data" "string data"]
-test winClipboard-2.2 {TkSelUpdateClipboard reentrancy problem} {pcOnly testclipboard} {
+test winClipboard-2.2 {TkSelUpdateClipboard reentrancy problem} {win testclipboard} {
clipboard clear
clipboard append -type OUR_ACTION "new data"
clipboard append "more data in string"
@@ -79,5 +72,5 @@ test winClipboard-2.2 {TkSelUpdateClipboard reentrancy problem} {pcOnly testclip
} [list "more data in string" "new data"]
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/winDialog.test b/tests/winDialog.test
index e7d175f..d340aee 100644
--- a/tests/winDialog.test
+++ b/tests/winDialog.test
@@ -1,3 +1,4 @@
+# -*- tcl -*-
# This file is a Tcl script to test the Windows specific behavior of
# the common dialog boxes. It is organized in the standard
# fashion for Tcl tests.
@@ -7,15 +8,18 @@
# Copyright (c) 1998-1999 ActiveState Corporation.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint testwinevent [llength [info commands testwinevent]]
+if {[testConstraint testwinevent]} {
+ catch {testwinevent debug 1}
+}
-catch {testwinevent debug 1}
+# Locale identifier LANG_ENGLISH is 0x09
+testConstraint english [expr {
+ [llength [info commands testwinlocale]]
+ && (([testwinlocale] & 0xff) == 9)
+}]
proc start {arg} {
set ::tk_dialog 0
@@ -46,38 +50,122 @@ proc afterbody {} {
}
proc Click {button} {
+ switch -exact -- $button {
+ ok { set button 1 }
+ cancel { set button 2 }
+ }
testwinevent $::tk_dialog $button WM_LBUTTONDOWN 1 0x000a000b
testwinevent $::tk_dialog $button WM_LBUTTONUP 0 0x000a000b
}
-proc GetText {button} {
- return [testwinevent $::tk_dialog $button WM_GETTEXT]
+proc GetText {id} {
+ switch -exact -- $id {
+ ok { set id 1 }
+ cancel { set id 2 }
+ }
+ return [testwinevent $::tk_dialog $id WM_GETTEXT]
}
-proc SetText {button text} {
- return [testwinevent $::tk_dialog $button WM_SETTEXT $text]
+proc SetText {id text} {
+ return [testwinevent $::tk_dialog $id WM_SETTEXT $text]
}
-test winDialog-1.1 {Tk_ChooseColorObjCmd} {nt} {
-} {}
-
-test winDialog-2.1 {ColorDlgHookProc} {nt} {
+test winDialog-1.1.0 {Tk_ChooseColorObjCmd} -constraints {
+ testwinevent
+} -body {
+ start {tk_chooseColor}
+ then {
+ Click cancel
+ }
+} -result {0}
+test winDialog-1.1.1 {Tk_ChooseColorObjCmd} -constraints {
+ testwinevent
+} -body {
+ start {set clr [tk_chooseColor -initialcolor "#ff9933"]}
+ then {
+ set x [Click cancel]
+ }
+ list $x $clr
+} -result {0 {}}
+test winDialog-1.1.2 {Tk_ChooseColorObjCmd} -constraints {
+ testwinevent
+} -body {
+ start {set clr [tk_chooseColor -initialcolor "#ff9933"]}
+ then {
+ set x [Click ok]
+ }
+ list $x $clr
+} -result [list 0 "#ff9933"]
+test winDialog-1.1.3 {Tk_ChooseColorObjCmd: -title} -constraints {
+ testwinevent
+} -setup {unset -nocomplain a x} -body {
+ set x {}
+ start {set clr [tk_chooseColor -initialcolor "#ff9933" -title "Hello"]}
+ then {
+ if {[catch {
+ array set a [testgetwindowinfo $::tk_dialog]
+ if {[info exists a(text)]} {lappend x $a(text)}
+ } err]} { lappend x $err }
+ lappend x [Click ok]
+ }
+ lappend x $clr
+} -result [list Hello 0 "#ff9933"]
+test winDialog-1.1.4 {Tk_ChooseColorObjCmd: -title} -constraints {
+ testwinevent
+} -setup {unset -nocomplain a x} -body {
+ set x {}
+ start {
+ set clr [tk_chooseColor -initialcolor "#ff9933" \
+ -title "\u041f\u0440\u0438\u0432\u0435\u0442"]
+ }
+ then {
+ if {[catch {
+ array set a [testgetwindowinfo $::tk_dialog]
+ if {[info exists a(text)]} {lappend x $a(text)}
+ } err]} { lappend x $err }
+ lappend x [Click ok]
+ }
+ lappend x $clr
+} -result [list "\u041f\u0440\u0438\u0432\u0435\u0442" 0 "#ff9933"]
+test winDialog-1.1.5 {Tk_ChooseColorObjCmd: -parent} -constraints {
+ testwinevent
+} -setup {unset -nocomplain a x} -body {
+ start {set clr [tk_chooseColor -initialcolor "#ff9933" -parent .]}
+ set x {}
+ then {
+ if {[catch {
+ array set a [testgetwindowinfo $::tk_dialog]
+ if {[info exists a(parent)]} {
+ append x [expr {$a(parent) == [wm frame .]}]
+ }
+ } err]} {lappend x $err}
+ Click ok
+ }
+ list $x $clr
+} -result [list 1 "#ff9933"]
+test winDialog-1.1.6 {Tk_ChooseColorObjCmd: -parent} -constraints {
+ testwinevent
+} -body {
+ tk_chooseColor -initialcolor "#ff9933" -parent .xyzzy12
+} -returnCodes error -match glob -result {bad window path name*}
+
+test winDialog-2.1 {ColorDlgHookProc} {emptyTest nt} {
} {}
-test winDialog-3.1 {Tk_GetOpenFileObjCmd} {nt testwinevent} {
+test winDialog-3.1 {Tk_GetOpenFileObjCmd} {nt testwinevent english} {
start {tk_getOpenFile}
then {
- set x [GetText 2]
- Click 2
+ set x [GetText cancel]
+ Click cancel
}
set x
} {Cancel}
-test winDialog-4.1 {Tk_GetSaveFileObjCmd} {nt testwinevent} {
+test winDialog-4.1 {Tk_GetSaveFileObjCmd} {nt testwinevent english} {
start {tk_getSaveFile}
then {
- set x [GetText 2]
- Click 2
+ set x [GetText cancel]
+ Click cancel
}
set x
} {Cancel}
@@ -90,7 +178,7 @@ test winDialog-5.1 {GetFileName: no arguments} {nt testwinevent} {
} {0}
test winDialog-5.2 {GetFileName: one argument} {nt} {
list [catch {tk_getOpenFile -foo} msg] $msg
-} {1 {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, or -title}}
+} {1 {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable}}
test winDialog-5.4 {GetFileName: many arguments} {nt testwinevent} {
start {tk_getOpenFile -initialdir c:/ -parent . -title test -initialfile foo}
then {
@@ -99,7 +187,7 @@ test winDialog-5.4 {GetFileName: many arguments} {nt testwinevent} {
} {0}
test winDialog-5.5 {GetFileName: Tcl_GetIndexFromObj() != TCL_OK} {nt} {
list [catch {tk_getOpenFile -foo bar -abc} msg] $msg
-} {1 {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, or -title}}
+} {1 {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable}}
test winDialog-5.6 {GetFileName: Tcl_GetIndexFromObj() == TCL_OK} {nt testwinevent} {
start {tk_getOpenFile -title bar}
then {
@@ -117,7 +205,7 @@ test winDialog-5.8 {GetFileName: extension begins with .} {nt testwinevent} {
start {set x [tk_getSaveFile -defaultextension .foo -title Save]}
then {
SetText 0x480 bar
- Click 1
+ Click ok
}
string totitle $x
} [string totitle [file join [pwd] bar.foo]]
@@ -125,7 +213,7 @@ test winDialog-5.9 {GetFileName: extension doesn't begin with .} {nt testwineven
start {set x [tk_getSaveFile -defaultextension foo -title Save]}
then {
SetText 0x480 bar
- Click 1
+ Click ok
}
string totitle $x
} [string totitle [file join [pwd] bar.foo]]
@@ -144,15 +232,19 @@ test winDialog-5.11 {GetFileName: file types: MakeFilter() fails} {nt} {
list [catch {tk_getSaveFile -filetypes {{"foo" .foo FOO}}} msg] $msg
} {1 {bad Macintosh file type "FOO"}}
+if {[info exists ::env(TEMP)]} {
test winDialog-5.12 {GetFileName: initial directory} {nt testwinevent} {
# case FILE_INITDIR:
- start {set x [tk_getSaveFile -initialdir c:/ -initialfile "12x 455" -title Foo]}
+ start {set x [tk_getSaveFile \
+ -initialdir [file normalize $::env(TEMP)] \
+ -initialfile "12x 455" -title Foo]}
then {
- Click 1
+ Click ok
}
set x
-} {C:/12x 455}
+} [file join [file normalize $::env(TEMP)] "12x 455"]
+}
test winDialog-5.13 {GetFileName: initial directory: Tcl_TranslateFilename()} \
{nt} {
# if (Tcl_TranslateFileName(interp, string, &ds) == NULL)
@@ -164,7 +256,7 @@ test winDialog-5.14 {GetFileName: initial file} {nt testwinevent} {
start {set x [tk_getSaveFile -initialfile "12x 456" -title Foo]}
then {
- Click 1
+ Click ok
}
string totitle $x
} [string totitle [file join [pwd] "12x 456"]]
@@ -172,18 +264,17 @@ test winDialog-5.15 {GetFileName: initial file: Tcl_TranslateFileName()} {nt} {
# if (Tcl_TranslateFileName(interp, string, &ds) == NULL)
list [catch {tk_getOpenFile -initialfile ~12x/455} msg] $msg
} {1 {user "12x" doesn't exist}}
-set a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-append a $a
-append a $a
-append a $a
-append a $a
test winDialog-5.16 {GetFileName: initial file: long name} {nt testwinevent} {
- start {set x [tk_getSaveFile -initialfile $a -title Long]}
+ start {
+ set dialogresult [catch {
+ tk_getSaveFile -initialfile [string repeat a 1024] -title Long
+ } x]
+ }
then {
- Click 1
+ Click ok
}
- string totitle $x
-} [string totitle [string range [file join [pwd] $a] 0 257]]
+ list $dialogresult [string match "invalid filename *" $x]
+} {1 1}
test winDialog-5.17 {GetFileName: parent} {nt} {
# case FILE_PARENT:
@@ -200,7 +291,7 @@ test winDialog-5.18 {GetFileName: title} {nt testwinevent} {
start {tk_getOpenFile -title Narf}
then {
- Click 2
+ Click cancel
}
} {0}
test winDialog-5.19 {GetFileName: no filter specified} {nt testwinevent} {
@@ -209,7 +300,7 @@ test winDialog-5.19 {GetFileName: no filter specified} {nt testwinevent} {
start {tk_getOpenFile -title Filter}
then {
set x [GetText 0x470]
- Click 2
+ Click cancel
}
set x
} {All Files (*.*)}
@@ -230,34 +321,55 @@ test winDialog-5.21 {GetFileName: parent HWND already exists} {nt} {
destroy .t
}
} {}
-test winDialog-5.22 {GetFileName: call GetOpenFileName} {nt testwinevent} {
+test winDialog-5.22 {GetFileName: call GetOpenFileName} {nt testwinevent english} {
# winCode = GetOpenFileName(&ofn);
start {tk_getOpenFile -title Open}
then {
- set x [GetText 1]
- Click 2
+ set x [GetText ok]
+ Click cancel
}
set x
} {&Open}
-test winDialog-5.23 {GetFileName: call GetSaveFileName} {nt testwinevent} {
+test winDialog-5.23 {GetFileName: call GetSaveFileName} {nt testwinevent english} {
# winCode = GetSaveFileName(&ofn);
start {tk_getSaveFile -title Save}
then {
- set x [GetText 1]
- Click 2
+ set x [GetText ok]
+ Click cancel
}
set x
} {&Save}
+if {[info exists ::env(TEMP)]} {
test winDialog-5.24 {GetFileName: convert \ to /} {nt testwinevent} {
start {set x [tk_getSaveFile -title Back]}
then {
- SetText 0x480 "c:\\12x 457"
- Click 1
+ SetText 0x480 [file nativename \
+ [file join [file normalize $::env(TEMP)] "12x 457"]]
+ Click ok
}
set x
-} {c:/12x 457}
+} [file join [file normalize $::env(TEMP)] "12x 457"]
+}
+test winDialog-5.25 {GetFileName: file types: MakeFilter() succeeds} {nt} {
+ # MacOS type that is correct, but has embedded nulls.
+
+ start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {\0\0\0\0}}}}]}
+ then {
+ Click cancel
+ }
+ set x
+} {0}
+test winDialog-5.26 {GetFileName: file types: MakeFilter() succeeds} {nt} {
+ # MacOS type that is correct, but has embedded high-bit chars.
+
+ start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {\u2022\u2022\u2022\u2022}}}}]}
+ then {
+ Click cancel
+ }
+ set x
+} {0}
test winDialog-6.1 {MakeFilter} {emptyTest nt} {} {}
@@ -306,7 +418,7 @@ test winDialog-9.7 {Tk_ChooseDirectoryObjCmd: -initialdir} {nt testwinevent} {
start {set x [tk_chooseDirectory -initialdir c:/ -title Foo]}
then {
- Click 1
+ Click ok
}
string tolower [set x]
} {c:/}
@@ -318,8 +430,10 @@ test winDialog-9.8 {Tk_ChooseDirectoryObjCmd:\
list [catch {tk_chooseDirectory -initialdir ~12x/455} msg] $msg
} {1 {user "12x" doesn't exist}}
-catch {testwinevent debug 0}
+if {[testConstraint testwinevent]} {
+ catch {testwinevent debug 0}
+}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/winFont.test b/tests/winFont.test
index 299bc7e..c61d124 100644
--- a/tests/winFont.test
+++ b/tests/winFont.test
@@ -11,10 +11,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
catch {destroy .b}
@@ -42,10 +39,10 @@ proc getsize {} {
return "[winfo reqwidth .b.l] [winfo reqheight .b.l]"
}
-test winfont-1.1 {TkpGetNativeFont procedure: not native} {pcOnly} {
+test winfont-1.1 {TkpGetNativeFont procedure: not native} win {
list [catch {font measure {} xyz} msg] $msg
} {1 {font "" doesn't exist}}
-test winfont-1.2 {TkpGetNativeFont procedure: native} {pcOnly} {
+test winfont-1.2 {TkpGetNativeFont procedure: native} win {
font measure ansifixed 0
font measure ansi 0
font measure device 0
@@ -55,99 +52,99 @@ test winfont-1.2 {TkpGetNativeFont procedure: native} {pcOnly} {
set x {}
} {}
-test winfont-2.1 {TkpGetFontFromAttributes procedure: pointsize} {pcOnly} {
+test winfont-2.1 {TkpGetFontFromAttributes procedure: pointsize} win {
expr [font actual {-size -10} -size]>0
} {1}
-test winfont-2.2 {TkpGetFontFromAttributes procedure: pointsize} {pcOnly} {
+test winfont-2.2 {TkpGetFontFromAttributes procedure: pointsize} win {
expr [font actual {-family Arial} -size]>0
} {1}
-test winfont-2.3 {TkpGetFontFromAttributes procedure: normal weight} {pcOnly} {
+test winfont-2.3 {TkpGetFontFromAttributes procedure: normal weight} win {
font actual {-weight normal} -weight
} {normal}
-test winfont-2.4 {TkpGetFontFromAttributes procedure: bold weight} {pcOnly} {
+test winfont-2.4 {TkpGetFontFromAttributes procedure: bold weight} win {
font actual {-weight bold} -weight
} {bold}
-test winfont-2.5 {TkpGetFontFromAttributes procedure: no family} {pcOnly} {
+test winfont-2.5 {TkpGetFontFromAttributes procedure: no family} win {
catch {expr {[font actual {-size 10} -size]}}
} 0
-test winfont-2.6 {TkpGetFontFromAttributes procedure: family} {pcOnly} {
+test winfont-2.6 {TkpGetFontFromAttributes procedure: family} win {
font actual {-family Arial} -family
} {Arial}
-test winfont-2.7 {TkpGetFontFromAttributes procedure: Times fonts} {pcOnly} {
+test winfont-2.7 {TkpGetFontFromAttributes procedure: Times fonts} win {
set x {}
lappend x [font actual {-family "Times"} -family]
lappend x [font actual {-family "New York"} -family]
lappend x [font actual {-family "Times New Roman"} -family]
} {{Times New Roman} {Times New Roman} {Times New Roman}}
-test winfont-2.8 {TkpGetFontFromAttributes procedure: Courier fonts} {pcOnly} {
+test winfont-2.8 {TkpGetFontFromAttributes procedure: Courier fonts} win {
set x {}
lappend x [font actual {-family "Courier"} -family]
lappend x [font actual {-family "Monaco"} -family]
lappend x [font actual {-family "Courier New"} -family]
} {{Courier New} {Courier New} {Courier New}}
-test winfont-2.9 {TkpGetFontFromAttributes procedure: Helvetica fonts} {pcOnly} {
+test winfont-2.9 {TkpGetFontFromAttributes procedure: Helvetica fonts} win {
set x {}
lappend x [font actual {-family "Helvetica"} -family]
lappend x [font actual {-family "Geneva"} -family]
lappend x [font actual {-family "Arial"} -family]
} {Arial Arial Arial}
-test winfont-2.10 {TkpGetFontFromAttributes procedure: fallback} {pcOnly} {
+test winfont-2.10 {TkpGetFontFromAttributes procedure: fallback} win {
# No way to get it to fail! Any font name is acceptable.
} {}
-test winfont-3.1 {TkpDeleteFont procedure} {pcOnly} {
+test winfont-3.1 {TkpDeleteFont procedure} win {
font actual {-family xyz}
set x {}
} {}
-test winfont-4.1 {TkpGetFontFamilies procedure} {pcOnly} {
+test winfont-4.1 {TkpGetFontFamilies procedure} win {
font families
set x {}
} {}
-test winfont-5.1 {Tk_MeasureChars procedure: unbounded right margin} {pcOnly} {
+test winfont-5.1 {Tk_MeasureChars procedure: unbounded right margin} win {
.b.l config -wrap 0 -text "000000"
getsize
} "[expr $ax*6] $ay"
-test winfont-5.2 {Tk_MeasureChars procedure: static width buffer exceeded} {pcOnly} {
+test winfont-5.2 {Tk_MeasureChars procedure: static width buffer exceeded} win {
.b.l config -wrap 100000 -text "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
getsize
} "[expr $ax*256] $ay"
-test winfont-5.3 {Tk_MeasureChars procedure: all chars did fit} {pcOnly} {
+test winfont-5.3 {Tk_MeasureChars procedure: all chars did fit} win {
.b.l config -wrap [expr $ax*10] -text "00000000"
getsize
} "[expr $ax*8] $ay"
-test winfont-5.4 {Tk_MeasureChars procedure: not all chars fit} {pcOnly} {
+test winfont-5.4 {Tk_MeasureChars procedure: not all chars fit} win {
.b.l config -wrap [expr $ax*6] -text "00000000"
getsize
} "[expr $ax*6] [expr $ay*2]"
-test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} {pcOnly} {
+test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} win {
.b.c dchars $t 0 end
.b.c insert $t 0 "0000"
.b.c index $t @[expr int($cx*2.5)],1
} {2}
-test winfont-5.6 {Tk_MeasureChars procedure: at least one char on line} {pcOnly} {
+test winfont-5.6 {Tk_MeasureChars procedure: at least one char on line} win {
.b.l config -text "000000" -wrap 1
getsize
} "$ax [expr $ay*6]"
-test winfont-5.7 {Tk_MeasureChars procedure: whole words} {pcOnly} {
+test winfont-5.7 {Tk_MeasureChars procedure: whole words} win {
.b.l config -wrap [expr $ax*8] -text "000000 0000"
getsize
} "[expr $ax*6] [expr $ay*2]"
-test winfont-5.8 {Tk_MeasureChars procedure: already saw space in line} {pcOnly} {
+test winfont-5.8 {Tk_MeasureChars procedure: already saw space in line} win {
.b.l config -wrap [expr $ax*12] -text "000000 0000000"
getsize
} "[expr $ax*7] [expr $ay*2]"
-test winfont-5.9 {Tk_MeasureChars procedure: internal spaces significant} {pcOnly} {
+test winfont-5.9 {Tk_MeasureChars procedure: internal spaces significant} win {
.b.l config -wrap [expr $ax*12] -text "000 00 00000"
getsize
} "[expr $ax*7] [expr $ay*2]"
-test winfont-5.10 {Tk_MeasureChars procedure: make first part of word fit} {pcOnly} {
+test winfont-5.10 {Tk_MeasureChars procedure: make first part of word fit} win {
.b.l config -wrap [expr $ax*12] -text "0000000000000000"
getsize
} "[expr $ax*12] [expr $ay*2]"
-test winfont-5.10 {Tk_MeasureChars procedure: check for kerning} \
- {pcOnly nonPortable} {
+test winfont-5.11 {Tk_MeasureChars procedure: check for kerning} \
+ {win nonPortable} {
set font [.b.l cget -font]
.b.l config -font {{MS Sans Serif} 8} -text "W"
set width [winfo reqwidth .b.l]
@@ -156,12 +153,13 @@ test winfont-5.10 {Tk_MeasureChars procedure: check for kerning} \
.b.l config -font $font
expr $x < ($width*10)
} 1
-test winfont-6.1 {Tk_DrawChars procedure: loop test} {pcOnly} {
+
+test winfont-6.1 {Tk_DrawChars procedure: loop test} win {
.b.l config -text "a"
update
} {}
-test winfont-7.1 {AllocFont procedure: use old font} {pcOnly} {
+test winfont-7.1 {AllocFont procedure: use old font} win {
font create xyz
catch {destroy .c}
button .c -font xyz
@@ -170,17 +168,17 @@ test winfont-7.1 {AllocFont procedure: use old font} {pcOnly} {
destroy .c
font delete xyz
} {}
-test winfont-7.2 {AllocFont procedure: extract info from logfont} {pcOnly} {
+test winfont-7.2 {AllocFont procedure: extract info from logfont} win {
font actual {arial 10 bold italic underline overstrike}
} {-family Arial -size 10 -weight bold -slant italic -underline 1 -overstrike 1}
-test winfont-7.3 {AllocFont procedure: extract info from textmetric} {pcOnly} {
+test winfont-7.3 {AllocFont procedure: extract info from textmetric} win {
font metric {arial 10 bold italic underline overstrike} -fixed
} {0}
-test winfont-7.4 {AllocFont procedure: extract info from textmetric} {pcOnly} {
+test winfont-7.4 {AllocFont procedure: extract info from textmetric} win {
font metric systemfixed -fixed
} {1}
# cleanup
destroy .b
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/winMenu.test b/tests/winMenu.test
index f29face..7240bf5 100644
--- a/tests/winMenu.test
+++ b/tests/winMenu.test
@@ -8,29 +8,26 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-test winMenu-1.1 {GetNewID} {pcOnly} {
+test winMenu-1.1 {GetNewID} win {
catch {destroy .m1}
list [catch {menu .m1} msg] $msg [destroy .m1]
} {0 .m1 {}}
# Basically impossible to test menu IDs wrapping.
-test winMenu-2.1 {FreeID} {pcOnly} {
+test winMenu-2.1 {FreeID} win {
catch {destroy .m1}
menu .m1
list [catch {destroy .m1} msg] $msg
} {0 {}}
-test winMenu-3.1 {TkpNewMenu} {pcOnly} {
+test winMenu-3.1 {TkpNewMenu} win {
catch {destroy .m1}
list [catch {menu .m1} msg] $msg [catch {destroy .m1} msg2] $msg2
} {0 .m1 0 {}}
-test winMenu-3.2 {TkpNewMenu} {pcOnly} {
+test winMenu-3.2 {TkpNewMenu} win {
catch {destroy .m1}
. configure -menu ""
menu .m1
@@ -38,12 +35,12 @@ test winMenu-3.2 {TkpNewMenu} {pcOnly} {
list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [catch {destroy .m1} msg2] $msg2
} {0 {} {} 0 {}}
-test winMenu-4.1 {TkpDestroyMenu} {pcOnly} {
+test winMenu-4.1 {TkpDestroyMenu} win {
catch {destroy .m1}
menu .m1
list [catch {destroy .m1} msg] $msg
} {0 {}}
-test winMenu-4.2 {TkpDestroyMenu - help menu} {pcOnly} {
+test winMenu-4.2 {TkpDestroyMenu - help menu} win {
catch {destroy .m1}
menu .m1
.m1 add cascade -menu .m1.system
@@ -51,7 +48,7 @@ test winMenu-4.2 {TkpDestroyMenu - help menu} {pcOnly} {
list [catch {destroy .m1.system} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test winMenu-5.1 {TkpDestroyMenuEntry} {pcOnly} {
+test winMenu-5.1 {TkpDestroyMenuEntry} win {
catch {destroy .m1}
. configure -menu ""
menu .m1
@@ -60,89 +57,89 @@ test winMenu-5.1 {TkpDestroyMenuEntry} {pcOnly} {
list [catch {.m1 delete 1} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.1 {GetEntryText} {pcOnly} {
+test winMenu-6.1 {GetEntryText} win {
catch {destroy .m1}
list [catch {menu .m1} msg] $msg [destroy .m1]
} {0 .m1 {}}
-test winMenu-6.2 {GetEntryText} {testImageType pcOnly} {
+test winMenu-6.2 {GetEntryText} {testImageType win} {
catch {destroy .m1}
catch {image delete image1}
menu .m1
image create test image1
list [catch {.m1 add command -image image1} msg] $msg [destroy .m1] [image delete image1]
} {0 {} {} {}}
-test winMenu-6.3 {GetEntryText} {pcOnly} {
+test winMenu-6.3 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -bitmap questhead} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.4 {GetEntryText} {pcOnly} {
+test winMenu-6.4 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.5 {GetEntryText} {pcOnly} {
+test winMenu-6.5 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "foo"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.6 {GetEntryText} {pcOnly} {
+test winMenu-6.6 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "This string has one & in it"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.7 {GetEntryText} {pcOnly} {
+test winMenu-6.7 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "The & should be underlined." -underline 4} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.8 {GetEntryText} {pcOnly} {
+test winMenu-6.8 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "The * should be underlined." -underline 4} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.9 {GetEntryText} {pcOnly} {
+test winMenu-6.9 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "foo" -accel "bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.10 {GetEntryText} {pcOnly} {
+test winMenu-6.10 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "This string has one & in it" -accel "bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.11 {GetEntryText} {pcOnly} {
+test winMenu-6.11 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "The & should be underlined." -underline 4 -accel "bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.12 {GetEntryText} {pcOnly} {
+test winMenu-6.12 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "The * should be underlined." -underline 4 -accel "bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.13 {GetEntryText} {pcOnly} {
+test winMenu-6.13 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "foo" -accel "&bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.14 {GetEntryText} {pcOnly} {
+test winMenu-6.14 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "This string has one & in it" -accel "&bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.15 {GetEntryText} {pcOnly} {
+test winMenu-6.15 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "The & should be underlined." -underline 4 -accel "&bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-6.16 {GetEntryText} {pcOnly} {
+test winMenu-6.16 {GetEntryText} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command -label "The * should be underlined." -underline 4 -accel "&bar"} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.1 {ReconfigureWindowsMenu - system menu item removal} {pcOnly} {
+test winMenu-7.1 {ReconfigureWindowsMenu - system menu item removal} win {
catch {destroy .m1}
menu .m1
.m1 add cascade -menu .m1.system
@@ -152,7 +149,7 @@ test winMenu-7.1 {ReconfigureWindowsMenu - system menu item removal} {pcOnly} {
.m1.system add command -label bar
list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test winMenu-7.2 {ReconfigureWindowsMenu - menu item removal} {pcOnly} {
+test winMenu-7.2 {ReconfigureWindowsMenu - menu item removal} win {
catch {destroy .m1}
menu .m1
.m1 add command -label Hello
@@ -160,77 +157,77 @@ test winMenu-7.2 {ReconfigureWindowsMenu - menu item removal} {pcOnly} {
.m1 add command -label foo
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.3 {ReconfigureWindowsMenu - zero items} {pcOnly} {
+test winMenu-7.3 {ReconfigureWindowsMenu - zero items} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label Hello
.m1 delete Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.4 {ReconfigureWindowsMenu - one item} {pcOnly} {
+test winMenu-7.4 {ReconfigureWindowsMenu - one item} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.5 {ReconfigureWindowsMenu - two items} {pcOnly} {
+test winMenu-7.5 {ReconfigureWindowsMenu - two items} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label One
.m1 add command -label Two
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.6 {ReconfigureWindowsMenu - separator item} {pcOnly} {
+test winMenu-7.6 {ReconfigureWindowsMenu - separator item} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add separator
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.7 {ReconfigureWindowsMenu - non-text item} {pcOnly} {
+test winMenu-7.7 {ReconfigureWindowsMenu - non-text item} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.8 {ReconfigureWindowsMenu - disabled item} {pcOnly} {
+test winMenu-7.8 {ReconfigureWindowsMenu - disabled item} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label Hello -state disabled
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.9 {ReconfigureWindowsMenu - non-selected checkbutton} {pcOnly} {
+test winMenu-7.9 {ReconfigureWindowsMenu - non-selected checkbutton} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add checkbutton -label Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.10 {ReconfigureWindowsMenu - non-selected radiobutton} {pcOnly} {
+test winMenu-7.10 {ReconfigureWindowsMenu - non-selected radiobutton} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add radiobutton -label Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.11 {ReconfigureWindowsMenu - selected checkbutton} {pcOnly} {
+test winMenu-7.11 {ReconfigureWindowsMenu - selected checkbutton} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add checkbutton -label Hello
.m1 invoke Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.12 {ReconfigureWindowsMenu - selected radiobutton} {pcOnly} {
+test winMenu-7.12 {ReconfigureWindowsMenu - selected radiobutton} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add radiobutton -label Hello
.m1 invoke Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.13 {ReconfigureWindowsMenu - cascade missing} {pcOnly} {
+test winMenu-7.13 {ReconfigureWindowsMenu - cascade missing} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add cascade -label Hello
list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-7.14 {ReconfigureWindowsMenu - cascade} {pcOnly} {
+test winMenu-7.14 {ReconfigureWindowsMenu - cascade} win {
catch {destroy .m1}
catch {destroy .m2}
menu .m1 -tearoff 0
@@ -238,7 +235,7 @@ test winMenu-7.14 {ReconfigureWindowsMenu - cascade} {pcOnly} {
.m1 add cascade -menu .m2 -label Hello
list [catch {update idletasks} msg] $msg [destroy .m1] [destroy .m2]
} {0 {} {} {}}
-test winMenu-7.15 {ReconfigureWindowsMenu - menubar without system menu} {pcOnly} {
+test winMenu-7.15 {ReconfigureWindowsMenu - menubar without system menu} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add cascade -menu .m1.file
@@ -246,7 +243,7 @@ test winMenu-7.15 {ReconfigureWindowsMenu - menubar without system menu} {pcOnly
. configure -menu .m1
list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test winMenu-7.16 {ReconfigureWindowsMenu - system menu already created} {pcOnly} {
+test winMenu-7.16 {ReconfigureWindowsMenu - system menu already created} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add cascade -menu .m1.system
@@ -256,7 +253,7 @@ test winMenu-7.16 {ReconfigureWindowsMenu - system menu already created} {pcOnly
.m1.system add command -label Hello
list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test winMenu-7.17 {ReconfigureWindowsMenu - system menu update pending} {pcOnly} {
+test winMenu-7.17 {ReconfigureWindowsMenu - system menu update pending} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add cascade -menu .m1.system
@@ -264,7 +261,7 @@ test winMenu-7.17 {ReconfigureWindowsMenu - system menu update pending} {pcOnly}
. configure -menu .m1
list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test winMenu-7.18 {ReconfigureWindowsMenu - system menu update not pending} {pcOnly} {
+test winMenu-7.18 {ReconfigureWindowsMenu - system menu update not pending} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add cascade -menu .m1.system
@@ -274,7 +271,7 @@ test winMenu-7.18 {ReconfigureWindowsMenu - system menu update not pending} {pcO
. configure -menu .m1
list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test winMenu-7.19 {ReconfigureWindowsMenu - column break} {pcOnly} {
+test winMenu-7.19 {ReconfigureWindowsMenu - column break} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label one
@@ -283,23 +280,23 @@ test winMenu-7.19 {ReconfigureWindowsMenu - column break} {pcOnly} {
} {0 {} {}}
#Don't know how to generate nested post menus
-test winMenu-8.1 {TkpPostMenu} {pcOnly} {
+test winMenu-8.1 {TkpPostMenu} win {
catch {destroy .m1}
menu .m1 -postcommand "blork"
list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} {1 {invalid command name "blork"} {}}
-test winMenu-8.2 {TkpPostMenu} {pcOnly} {
+test winMenu-8.2 {TkpPostMenu} win {
catch {destroy .m1}
menu .m1 -postcommand "destroy .m1"
list [.m1 post 40 40] [winfo exists .m1]
} {{} 0}
-test winMenu-8.3 {TkpPostMenu - popup menu} {pcOnly userInteraction} {
+test winMenu-8.3 {TkpPostMenu - popup menu} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-8.3: Hit ESCAPE."
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
-test winMenu-8.4 {TkpPostMenu - menu button} {pcOnly userInteraction} {
+test winMenu-8.4 {TkpPostMenu - menu button} {win userInteraction} {
catch {destroy .mb}
menubutton .mb -text test -menu .mb.menu
menu .mb.menu
@@ -307,7 +304,7 @@ test winMenu-8.4 {TkpPostMenu - menu button} {pcOnly userInteraction} {
pack .mb
list [tk::MbPost .mb] [destroy .m1]
} {{} {}}
-test winMenu-8.5 {TkpPostMenu - update not pending} {pcOnly userInteraction} {
+test winMenu-8.5 {TkpPostMenu - update not pending} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-8.5 - Hit ESCAPE."
@@ -315,13 +312,13 @@ test winMenu-8.5 {TkpPostMenu - update not pending} {pcOnly userInteraction} {
list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-9.1 {TkpMenuNewEntry} {pcOnly} {
+test winMenu-9.1 {TkpMenuNewEntry} win {
catch {destroy .m1}
menu .m1
list [catch {.m1 add command} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-10.1 {TkwinMenuProc} {pcOnly userInteraction} {
+test winMenu-10.1 {TkwinMenuProc} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-10.1: Hit ESCAPE."
@@ -329,21 +326,21 @@ test winMenu-10.1 {TkwinMenuProc} {pcOnly userInteraction} {
} {{} {}}
# Can't generate a WM_INITMENU without a Tk menu yet.
-test winMenu-11.1 {TkWinHandleMenuEvent - WM_INITMENU} {pcOnly userInteraction} {
+test winMenu-11.1 {TkWinHandleMenuEvent - WM_INITMENU} {win userInteraction} {
catch {destroy .m1}
catch {unset foo}
menu .m1 -postcommand "set foo test"
.m1 add command -label "winMenu-11.1: Hit ESCAPE."
list [.m1 post 40 40] [set foo] [unset foo] [destroy .m1]
} {test test {} {}}
-test winMenu-11.2 {TkWinHandleMenuEvent - WM_COMMAND} {pcOnly userInteraction} {
+test winMenu-11.2 {TkWinHandleMenuEvent - WM_COMMAND} {win userInteraction} {
catch {destroy .m1}
catch {unset foo}
menu .m1
.m1 add checkbutton -variable foo -label "winMenu-11.2: Please select this menu item."
list [.m1 post 40 40] [update] [set foo] [unset foo] [destroy .m1]
} {{} {} 1 {} {}}
-test winMenu-11.3 {TkWinHandleMenuEvent - WM_COMMAND} {pcOnly userInteraction} {
+test winMenu-11.3 {TkWinHandleMenuEvent - WM_COMMAND} {win userInteraction} {
catch {destroy .m1}
catch {unset foo}
proc bgerror {args} {
@@ -359,33 +356,33 @@ test winMenu-11.3 {TkWinHandleMenuEvent - WM_COMMAND} {pcOnly userInteraction} {
(menu invoke)}} {} {}}
# Can't test WM_MENUCHAR
-test winMenu-11.4 {TkWinHandleMenuEvent - WM_MEASUREITEM} {pcOnly userInteraction} {
+test winMenu-11.4 {TkWinHandleMenuEvent - WM_MEASUREITEM} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-11.3: Hit ESCAPE."
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
-test winMenu-11.5 {TkWinHandleMenuEvent - WM_MEASUREITEM} {pcOnly userInteraction} {
+test winMenu-11.5 {TkWinHandleMenuEvent - WM_MEASUREITEM} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label "winMenu-11.4: Hit ESCAPE" -hidemargin 1
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
-test winMenu-11.6 {TkWinHandleMenuEvent - WM_DRAWITEM} {pcOnly userInteraction} {
+test winMenu-11.6 {TkWinHandleMenuEvent - WM_DRAWITEM} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-11.5: Hit ESCAPE."
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
test winMenu-11.7 {TkWinHandleMenuEvent - WM_DRAWITEM - item disabled} \
- {pcOnly userInteraction} {
+ {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-11.6: Hit ESCAPE." -state disabled
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
test winMenu-11.8 {TkWinHandleMenuEvent - WM_INITMENU - not pending} \
- {pcOnly userInteraction} {
+ {win userInteraction} {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label "winMenu-11.7: Hit ESCAPE"
@@ -393,14 +390,14 @@ test winMenu-11.8 {TkWinHandleMenuEvent - WM_INITMENU - not pending} \
list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-12.1 {TkpSetWindowMenuBar} {pcOnly} {
+test winMenu-12.1 {TkpSetWindowMenuBar} win {
catch {destroy .m1}
. configure -menu ""
menu .m1
.m1 add command -label foo
list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [catch {destroy .m1} msg2] $msg2
} {0 {} {} 0 {}}
-test winMenu-12.2 {TkpSetWindowMenuBar} {pcOnly} {
+test winMenu-12.2 {TkpSetWindowMenuBar} win {
catch {destroy .m1}
. configure -menu ""
menu .m1
@@ -408,7 +405,7 @@ test winMenu-12.2 {TkpSetWindowMenuBar} {pcOnly} {
. configure -menu .m1
list [catch {. configure -menu ""} msg] $msg [catch {destroy .m1} msg2] $msg2
} {0 {} 0 {}}
-test winMenu-12.3 {TkpSetWindowMenuBar - no update pending} {pcOnly} {
+test winMenu-12.3 {TkpSetWindowMenuBar - no update pending} win {
catch {destroy .m1}
. configure -menu ""
menu .m1 -tearoff 0
@@ -417,48 +414,48 @@ test winMenu-12.3 {TkpSetWindowMenuBar - no update pending} {pcOnly} {
list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
-test winMenu-13.1 {TkpSetMainMenubar - nothing to do} {emptyTest pcOnly} {} {}
+test winMenu-13.1 {TkpSetMainMenubar - nothing to do} {emptyTest win} {} {}
-test winMenu-14.1 {GetMenuIndicatorGeometry} {pcOnly} {
+test winMenu-14.1 {GetMenuIndicatorGeometry} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo
list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
-test winMenu-14.2 {GetMenuIndicatorGeometry} {pcOnly} {
+test winMenu-14.2 {GetMenuIndicatorGeometry} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo -hidemargin 1
list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
-test winMenu-15.1 {GetMenuAccelGeometry} {pcOnly} {
+test winMenu-15.1 {GetMenuAccelGeometry} win {
catch {destroy .m1}
menu .m1
.m1 add cascade -label foo -accel Ctrl+U
list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
-test winMenu-15.2 {GetMenuAccelGeometry} {pcOnly} {
+test winMenu-15.2 {GetMenuAccelGeometry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
-test winMenu-15.3 {GetMenuAccelGeometry} {pcOnly} {
+test winMenu-15.3 {GetMenuAccelGeometry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -accel "Ctrl+U"
list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
-test winMenu-16.1 {GetTearoffEntryGeometry} {pcOnly userInteraction} {
+test winMenu-16.1 {GetTearoffEntryGeometry} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-19.1: Hit ESCAPE."
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
-test winMenu-17.1 {GetMenuSeparatorGeometry} {pcOnly} {
+test winMenu-17.1 {GetMenuSeparatorGeometry} win {
catch {destroy .m1}
menu .m1
.m1 add separator
@@ -467,7 +464,7 @@ test winMenu-17.1 {GetMenuSeparatorGeometry} {pcOnly} {
# Currently, the only callers to DrawWindowsSystemBitmap want things
# centered vertically, and either centered or right aligned horizontally.
-test winMenu-18.1 {DrawWindowsSystemBitmap - center aligned} {pcOnly} {
+test winMenu-18.1 {DrawWindowsSystemBitmap - center aligned} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo
@@ -475,7 +472,7 @@ test winMenu-18.1 {DrawWindowsSystemBitmap - center aligned} {pcOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-18.2 {DrawWindowsSystemBitmap - right aligned} {pcOnly} {
+test winMenu-18.2 {DrawWindowsSystemBitmap - right aligned} win {
catch {destroy .m1}
menu .m1
.m1 add cascade -label foo
@@ -484,21 +481,21 @@ test winMenu-18.2 {DrawWindowsSystemBitmap - right aligned} {pcOnly} {
} {{} {}}
test winMenu-19.1 {DrawMenuEntryIndicator - not checkbutton or radiobutton} \
- {pcOnly} {
+ win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-19.2 {DrawMenuEntryIndicator - not selected} {pcOnly} {
+test winMenu-19.2 {DrawMenuEntryIndicator - not selected} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-19.3 {DrawMenuEntryIndicator - checkbutton} {pcOnly} {
+test winMenu-19.3 {DrawMenuEntryIndicator - checkbutton} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo
@@ -506,7 +503,7 @@ test winMenu-19.3 {DrawMenuEntryIndicator - checkbutton} {pcOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-19.4 {DrawMenuEntryIndicator - radiobutton} {pcOnly} {
+test winMenu-19.4 {DrawMenuEntryIndicator - radiobutton} win {
catch {destroy .m1}
menu .m1
.m1 add radiobutton -label foo
@@ -514,7 +511,7 @@ test winMenu-19.4 {DrawMenuEntryIndicator - radiobutton} {pcOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-19.5 {DrawMenuEntryIndicator - disabled} {pcOnly} {
+test winMenu-19.5 {DrawMenuEntryIndicator - disabled} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo
@@ -523,7 +520,7 @@ test winMenu-19.5 {DrawMenuEntryIndicator - disabled} {pcOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-19.6 {DrawMenuEntryIndicator - indicator not on} {pcOnly} {
+test winMenu-19.6 {DrawMenuEntryIndicator - indicator not on} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo -indicatoron 0
@@ -532,29 +529,28 @@ test winMenu-19.6 {DrawMenuEntryIndicator - indicator not on} {pcOnly} {
list [update] [destroy .m1]
} {{} {}}
-test winMenu-20.1 {DrawMenuEntryAccelerator - disabled} {pcOnly} {
+test winMenu-20.1 {DrawMenuEntryAccelerator - disabled} win {
catch {destroy .m1}
menu .m1 -disabledforeground red
.m1 add command -label foo -accel "Ctrl+U" -state disabled
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-20.2 {DrawMenuEntryAccelerator - normal text} {pcOnly} {
+test winMenu-20.2 {DrawMenuEntryAccelerator - normal text} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -accel "Ctrl+U"
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-20.3 {DrawMenuEntryAccelerator - disabled, no disabledforeground} \
- {pcOnly} {
+test winMenu-20.3 {DrawMenuEntryAccelerator - disabled, no disabledforeground} win {
catch {destroy .m1}
menu .m1 -disabledforeground ""
.m1 add command -label foo -accel "Ctrl+U" -state disabled
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-20.4 {DrawMenuEntryAccelerator - cascade, drawArrow true} {pcOnly} {
+test winMenu-20.4 {DrawMenuEntryAccelerator - cascade, drawArrow true} win {
catch {destroy .m1}
menu .m1
.m1 add cascade -label foo
@@ -562,14 +558,14 @@ test winMenu-20.4 {DrawMenuEntryAccelerator - cascade, drawArrow true} {pcOnly}
list [update] [destroy .m1]
} {{} {}}
test winMenu-20.5 {DrawMenuEntryAccelerator - cascade, drawArrow false} \
- {pcOnly userInteraction} {
+ {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add cascade -label "winMenu-23.5: Hit ESCAPE."
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
-test winMenu-21.1 {DrawMenuSeparator} {pcOnly} {
+test winMenu-21.1 {DrawMenuSeparator} win {
catch {destroy .m1}
menu .m1
.m1 add separator
@@ -577,7 +573,7 @@ test winMenu-21.1 {DrawMenuSeparator} {pcOnly} {
list [update] [destroy .m1]
} {{} {}}
-test winMenu-22.1 {DrawMenuUnderline} {pcOnly} {
+test winMenu-22.1 {DrawMenuUnderline} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -underline 0
@@ -586,25 +582,25 @@ test winMenu-22.1 {DrawMenuUnderline} {pcOnly} {
} {{} {}}
test winMenu-23.1 {Don't know how to test MenuKeyBindProc} \
- {pcOnly emptyTest} {} {}
+ {win emptyTest} {} {}
test winMenu-24.1 {TkpInitializeMenuBindings called at boot time} \
- {pcOnly emptyTest} {} {}
+ {win emptyTest} {} {}
-test winMenu-25.1 {DrawMenuEntryLabel - normal} {pcOnly} {
+test winMenu-25.1 {DrawMenuEntryLabel - normal} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-25.2 {DrawMenuEntryLabel - disabled with fg} {pcOnly} {
+test winMenu-25.2 {DrawMenuEntryLabel - disabled with fg} win {
catch {destroy .m1}
menu .m1 -disabledforeground red
.m1 add command -label foo -state disabled
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-25.3 {DrawMenuEntryLabel - disabled with no fg} {pcOnly} {
+test winMenu-25.3 {DrawMenuEntryLabel - disabled with no fg} win {
catch {destroy .m1}
menu .m1 -disabledforeground ""
.m1 add command -label foo -state disabled
@@ -612,27 +608,27 @@ test winMenu-25.3 {DrawMenuEntryLabel - disabled with no fg} {pcOnly} {
list [update] [destroy .m1]
} {{} {}}
-test winMenu-26.1 {TkpComputeMenubarGeometry} {pcOnly} {
+test winMenu-26.1 {TkpComputeMenubarGeometry} win {
catch {destroy .m1}
menu .m1
.m1 add cascade -label File
list [. configure -menu .m1] [. configure -menu ""] [destroy .m1]
} {{} {} {}}
-test winMenu-27.1 {DrawTearoffEntry} {pcOnly userInteraction} {
+test winMenu-27.1 {DrawTearoffEntry} {win userInteraction} {
catch {destroy .m1}
menu .m1
.m1 add command -label "winMenu-24.4: Hit ESCAPE."
list [.m1 post 40 40] [destroy .m1]
} {{} {}}
-test winMenu-28.1 {TkpConfigureMenuEntry - update pending} {pcOnly} {
+test winMenu-28.1 {TkpConfigureMenuEntry - update pending} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label Hello
list [catch {.m1 add command -label Two} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-28.2 {TkpConfigureMenuEntry - update not pending} {pcOnly} {
+test winMenu-28.2 {TkpConfigureMenuEntry - update not pending} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label One
@@ -640,8 +636,7 @@ test winMenu-28.2 {TkpConfigureMenuEntry - update not pending} {pcOnly} {
list [catch {.m1 add command -label Two} msg] $msg [destroy .m1]
} {0 {} {}}
-test winMenu-29.1 {TkpDrawMenuEntry - gc for active and not strict motif} \
- {pcOnly} {
+test winMenu-29.1 {TkpDrawMenuEntry - gc for active and not strict motif} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
@@ -649,8 +644,7 @@ test winMenu-29.1 {TkpDrawMenuEntry - gc for active and not strict motif} \
.m1 entryconfigure 1 -state active
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} \
- {pcOnly} {
+test winMenu-29.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -activeforeground red
@@ -658,7 +652,7 @@ test winMenu-29.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} \
.m1 entryconfigure 1 -state active
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.3 {TkpDrawMenuEntry - gc for active and strict motif} {pcOnly} {
+test winMenu-29.3 {TkpDrawMenuEntry - gc for active and strict motif} win {
catch {destroy .m1}
menu .m1
set tk_strictMotif 1
@@ -669,42 +663,42 @@ test winMenu-29.3 {TkpDrawMenuEntry - gc for active and strict motif} {pcOnly} {
} {{} {} 0}
test winMenu-29.4 \
{TkpDrawMenuEntry - gc for disabled with disabledfg and custom entry} \
- {pcOnly} {
+ win {
catch {destroy .m1}
menu .m1 -disabledforeground blue
.m1 add command -label foo -state disabled -background red
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.5 {TkpDrawMenuEntry - gc for disabled with disabledFg} {pcOnly} {
+test winMenu-29.5 {TkpDrawMenuEntry - gc for disabled with disabledFg} win {
catch {destroy .m1}
menu .m1 -disabledforeground blue
.m1 add command -label foo -state disabled
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.6 {TkpDrawMenuEntry - gc for disabled - no disabledFg} {pcOnly} {
+test winMenu-29.6 {TkpDrawMenuEntry - gc for disabled - no disabledFg} win {
catch {destroy .m1}
menu .m1 -disabledforeground ""
.m1 add command -label foo -state disabled
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.7 {TkpDrawMenuEntry - gc for normal - custom entry} {pcOnly} {
+test winMenu-29.7 {TkpDrawMenuEntry - gc for normal - custom entry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -foreground red
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.8 {TkpDrawMenuEntry - gc for normal} {pcOnly} {
+test winMenu-29.8 {TkpDrawMenuEntry - gc for normal} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.9 {TkpDrawMenuEntry - gc for indicator - custom entry} {pcOnly} {
+test winMenu-29.9 {TkpDrawMenuEntry - gc for indicator - custom entry} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo -selectcolor orange
@@ -712,7 +706,7 @@ test winMenu-29.9 {TkpDrawMenuEntry - gc for indicator - custom entry} {pcOnly}
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.10 {TkpDrawMenuEntry - gc for indicator} {pcOnly} {
+test winMenu-29.10 {TkpDrawMenuEntry - gc for indicator} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label foo
@@ -720,7 +714,7 @@ test winMenu-29.10 {TkpDrawMenuEntry - gc for indicator} {pcOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.11 {TkpDrawMenuEntry - border - custom entry} {pcOnly} {
+test winMenu-29.11 {TkpDrawMenuEntry - border - custom entry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -activebackground green
@@ -728,7 +722,7 @@ test winMenu-29.11 {TkpDrawMenuEntry - border - custom entry} {pcOnly} {
.m1 entryconfigure 1 -state active
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.12 {TkpDrawMenuEntry - border} {pcOnly} {
+test winMenu-29.12 {TkpDrawMenuEntry - border} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
@@ -736,7 +730,7 @@ test winMenu-29.12 {TkpDrawMenuEntry - border} {pcOnly} {
.m1 entryconfigure 1 -state active
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.13 {TkpDrawMenuEntry - active border - strict motif} {pcOnly} {
+test winMenu-29.13 {TkpDrawMenuEntry - active border - strict motif} win {
catch {destroy .m1}
set tk_strictMotif 1
menu .m1
@@ -745,7 +739,7 @@ test winMenu-29.13 {TkpDrawMenuEntry - active border - strict motif} {pcOnly} {
.m1 entryconfigure 1 -state active
list [update] [destroy .m1] [set tk_strictMotif 0]
} {{} {} 0}
-test winMenu-29.14 {TkpDrawMenuEntry - active border - custom entry} {pcOnly} {
+test winMenu-29.14 {TkpDrawMenuEntry - active border - custom entry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -activeforeground yellow
@@ -753,7 +747,7 @@ test winMenu-29.14 {TkpDrawMenuEntry - active border - custom entry} {pcOnly} {
.m1 entryconfigure 1 -state active
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.15 {TkpDrawMenuEntry - active border} {pcOnly} {
+test winMenu-29.15 {TkpDrawMenuEntry - active border} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
@@ -761,35 +755,35 @@ test winMenu-29.15 {TkpDrawMenuEntry - active border} {pcOnly} {
.m1 entryconfigure 1 -state active
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.16 {TkpDrawMenuEntry - font - custom entry} {pcOnly} {
+test winMenu-29.16 {TkpDrawMenuEntry - font - custom entry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo -font "Helvectica 72"
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.17 {TkpDrawMenuEntry - font} {pcOnly} {
+test winMenu-29.17 {TkpDrawMenuEntry - font} win {
catch {destroy .m1}
menu .m1 -font "Courier 72"
.m1 add command -label foo
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.18 {TkpDrawMenuEntry - separator} {pcOnly} {
+test winMenu-29.18 {TkpDrawMenuEntry - separator} win {
catch {destroy .m1}
menu .m1
.m1 add separator
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.19 {TkpDrawMenuEntry - standard} {pcOnly} {
+test winMenu-29.19 {TkpDrawMenuEntry - standard} win {
catch {destroy .mb}
menu .m1
.m1 add command -label foo
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.20 {TkpDrawMenuEntry - disabled cascade item} {pcOnly} {
+test winMenu-29.20 {TkpDrawMenuEntry - disabled cascade item} win {
catch {destroy .m1}
menu .m1
.m1 add cascade -label File -menu .m1.file
@@ -799,7 +793,7 @@ test winMenu-29.20 {TkpDrawMenuEntry - disabled cascade item} {pcOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.21 {TkpDrawMenuEntry - indicator} {pcOnly} {
+test winMenu-29.21 {TkpDrawMenuEntry - indicator} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label winMenu-31.20
@@ -807,7 +801,7 @@ test winMenu-29.21 {TkpDrawMenuEntry - indicator} {pcOnly} {
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-29.22 {TkpDrawMenuEntry - indicator} {pcOnly} {
+test winMenu-29.22 {TkpDrawMenuEntry - indicator} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label winMenu-31.21 -hidemargin 1
@@ -816,7 +810,7 @@ test winMenu-29.22 {TkpDrawMenuEntry - indicator} {pcOnly} {
list [update] [destroy .m1]
} {{} {}}
-test winMenu-30.1 {GetMenuLabelGeometry - image} {testImageType pcOnly} {
+test winMenu-30.1 {GetMenuLabelGeometry - image} {testImageType win} {
catch {destroy .m1}
catch {image delete image1}
menu .m1
@@ -824,33 +818,33 @@ test winMenu-30.1 {GetMenuLabelGeometry - image} {testImageType pcOnly} {
.m1 add command -image image1
list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}
-test winMenu-30.2 {GetMenuLabelGeometry - bitmap} {pcOnly} {
+test winMenu-30.2 {GetMenuLabelGeometry - bitmap} win {
catch {destroy .m1}
menu .m1
.m1 add command -bitmap questhead
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-30.3 {GetMenuLabelGeometry - no text} {pcOnly} {
+test winMenu-30.3 {GetMenuLabelGeometry - no text} win {
catch {destroy .m1}
menu .m1
.m1 add command
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-30.4 {GetMenuLabelGeometry - text} {pcOnly} {
+test winMenu-30.4 {GetMenuLabelGeometry - text} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "This is a test."
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-31.1 {DrawMenuEntryBackground} {pcOnly} {
+test winMenu-31.1 {DrawMenuEntryBackground} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
set tearoff [tk::TearOffMenu .m1 40 40]
list [update] [destroy .m1]
} {{} {}}
-test winMenu-31.2 {DrawMenuEntryBackground} {pcOnly} {
+test winMenu-31.2 {DrawMenuEntryBackground} win {
catch {destroy .m1}
menu .m1
.m1 add command -label foo
@@ -859,31 +853,31 @@ test winMenu-31.2 {DrawMenuEntryBackground} {pcOnly} {
list [update] [destroy .m1]
} {{} {}}
-test winMenu-32.1 {TkpComputeStandardMenuGeometry - no entries} {pcOnly} {
+test winMenu-32.1 {TkpComputeStandardMenuGeometry - no entries} win {
catch {destroy .m1}
menu .m1
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.2 {TkpComputeStandardMenuGeometry - one entry} {pcOnly} {
+test winMenu-32.2 {TkpComputeStandardMenuGeometry - one entry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "one"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.3 {TkpComputeStandardMenuGeometry - more than one entry} {pcOnly} {
+test winMenu-32.3 {TkpComputeStandardMenuGeometry - more than one entry} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "one"
.m1 add command -label "two"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.4 {TkpComputeStandardMenuGeometry - separator} {pcOnly} {
+test winMenu-32.4 {TkpComputeStandardMenuGeometry - separator} win {
catch {destroy .m1}
menu .m1
.m1 add separator
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.5 {TkpComputeStandardMenuGeometry - tearoff entry} {unixOnly} {
+test winMenu-32.5 {TkpComputeStandardMenuGeometry - tearoff entry} {unix nonUnixUserInteraction} {
catch {destroy .m1}
menubutton .mb -text "test" -menu .mb.m
menu .mb.m
@@ -893,55 +887,54 @@ test winMenu-32.5 {TkpComputeStandardMenuGeometry - tearoff entry} {unixOnly} {
list [update] [destroy .mb]
} {{} {}}
test winMenu-32.6 {TkpComputeStandardMenuGeometry - standard label geometry} \
- {pcOnly} {
+ win {
catch {destroy .m1}
menu .m1
.m1 add command -label "test"
list [update idletasks] [destroy .m1]
} {{} {}}
test winMenu-32.7 {TkpComputeStandardMenuGeometry - different font for entry} \
- {pcOnly} {
+ win {
catch {destroy .m1}
menu .m1 -font "Helvetica 12"
.m1 add command -label "test" -font "Courier 12"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.8 {TkpComputeStandardMenuGeometry - second entry larger} \
- {pcOnly} {
+test winMenu-32.8 {TkpComputeStandardMenuGeometry - second entry larger} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "test"
.m1 add command -label "test test"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.9 {TkpComputeStandardMenuGeometry - first entry larger} {pcOnly} {
+test winMenu-32.9 {TkpComputeStandardMenuGeometry - first entry larger} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "test test"
.m1 add command -label "test"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.10 {TkpComputeStandardMenuGeometry - accelerator} {pcOnly} {
+test winMenu-32.10 {TkpComputeStandardMenuGeometry - accelerator} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "test" -accel "Ctrl+S"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.11 {TkpComputeStandardMenuGeometry - second accel larger} {pcOnly} {
+test winMenu-32.11 {TkpComputeStandardMenuGeometry - second accel larger} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "test" -accel "1"
.m1 add command -label "test" -accel "1 1"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.12 {TkpComputeStandardMenuGeometry - second accel smaller} {pcOnly} {
+test winMenu-32.12 {TkpComputeStandardMenuGeometry - second accel smaller} win {
catch {destroy .m1}
menu .m1
.m1 add command -label "test" -accel "1 1"
.m1 add command -label "test" -accel "1"
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.13 {TkpComputeStandardMenuGeometry - indicator} {pcOnly} {
+test winMenu-32.13 {TkpComputeStandardMenuGeometry - indicator} win {
catch {destroy .m1}
menu .m1
.m1 add checkbutton -label test
@@ -950,7 +943,7 @@ test winMenu-32.13 {TkpComputeStandardMenuGeometry - indicator} {pcOnly} {
} {{} {}}
test winMenu-32.14 \
{TkpComputeStandardMenuGeometry - second indicator less or equal} \
- {testImageType pcOnly} {
+ {testImageType win} {
catch {destroy .m1}
catch {image delete image1}
image create test image1
@@ -962,7 +955,7 @@ test winMenu-32.14 \
list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}
test winMenu-32.15 {TkpComputeStandardMenuGeometry - second indicator larger} \
- {testImageType unixOnly} {
+ {testImageType unix} {
catch {destroy .m1}
catch {image delete image1}
image create test image1
@@ -973,14 +966,12 @@ test winMenu-32.15 {TkpComputeStandardMenuGeometry - second indicator larger} \
.m1 invoke 2
list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}
-test winMenu-32.16 {TkpComputeStandardMenuGeometry - zero sized menus} \
- {pcOnly} {
+test winMenu-32.16 {TkpComputeStandardMenuGeometry - zero sized menus} win {
catch {destroy .m1}
menu .m1 -tearoff 0
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.17 {TkpComputeStandardMenuGeometry - first column bigger} \
- {pcOnly} {
+test winMenu-32.17 {TkpComputeStandardMenuGeometry - first column bigger} win {
catch {destroy .m1}
menu .m1
.m1 add command -label one
@@ -989,7 +980,7 @@ test winMenu-32.17 {TkpComputeStandardMenuGeometry - first column bigger} \
list [update idletasks] [destroy .m1]
} {{} {}}
test winMenu-32.18 {TkpComputeStandardMenuGeometry - second column bigger} \
- {pcOnly} {
+ win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label one
@@ -997,7 +988,7 @@ test winMenu-32.18 {TkpComputeStandardMenuGeometry - second column bigger} \
.m1 add command -label three
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-32.19 {TkpComputeStandardMenuGeometry - three columns} {pcOnly} {
+test winMenu-32.19 {TkpComputeStandardMenuGeometry - three columns} win {
catch {destroy .m1}
menu .m1 -tearoff 0
.m1 add command -label one
@@ -1009,14 +1000,14 @@ test winMenu-32.19 {TkpComputeStandardMenuGeometry - three columns} {pcOnly} {
list [update idletasks] [destroy .m1]
} {{} {}}
-test winMenu-33.1 {TkpNotifyTopLevelCreate - no menu yet} {pcOnly} {
+test winMenu-33.1 {TkpNotifyTopLevelCreate - no menu yet} win {
catch {destroy .t2}
catch {destroy .m1}
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
list [update idletasks] [destroy .t2]
} {{} {}}
-test winMenu-33.2 {TkpNotifyTopLevelCreate - menu} {pcOnly} {
+test winMenu-33.2 {TkpNotifyTopLevelCreate - menu} win {
catch {destroy .t2}
catch {destroy .m1}
menu .m1
@@ -1029,9 +1020,9 @@ test winMenu-33.2 {TkpNotifyTopLevelCreate - menu} {pcOnly} {
list [update idletasks] [destroy .m1] [destroy .t2]
} {{} {} {}}
-test winMenu-34.1 {TkpMenuInit called at boot time} {emptyTest pcOnly} {} {}
+test winMenu-34.1 {TkpMenuInit called at boot time} {emptyTest win} {} {}
# cleanup
deleteWindows
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/winMsgbox.test b/tests/winMsgbox.test
new file mode 100644
index 0000000..f467896
--- /dev/null
+++ b/tests/winMsgbox.test
@@ -0,0 +1,297 @@
+# This file is a Tcl script to test the Windows specific message box
+#
+# Copyright (c) 2007 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+package require tcltest 2.1
+eval tcltest::configure $argv
+tcltest::loadTestedCommands
+
+testConstraint getwindowinfo [expr {[llength [info command ::testgetwindowinfo]] > 0}]
+
+if {[testConstraint testwinevent]} {
+ catch {testwinevent debug 1}
+}
+
+proc Click {hwnd button} {
+ testwinevent $hwnd $button WM_COMMAND
+}
+
+proc GetWindowInfo {title button} {
+ global windowInfo
+ set windowInfo {}
+ set hwnd [testfindwindow $title "#32770"]
+ set windowInfo [testgetwindowinfo $hwnd]
+ array set a $windowInfo
+ set childinfo {} ; set childtext ""
+ foreach child $a(children) {
+ lappend childinfo $child [set info [testgetwindowinfo $child]]
+ array set ca $info
+ if {$ca(class) eq "Static"} {
+ append childtext $ca(text)
+ }
+ }
+ set a(children) $childinfo
+ set a(childtext) $childtext
+ set windowInfo [array get a]
+ testwinevent $hwnd $button WM_COMMAND
+}
+
+# -------------------------------------------------------------------------
+
+test winMsgbox-1.0 {tk_messageBox ok} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.0 [pid]"
+ after 100 [list GetWindowInfo $title 2]
+ tk_messageBox -icon info -type ok -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {ok}
+
+test winMsgbox-1.1 {tk_messageBox okcancel} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.1 [pid]"
+ after 100 [list GetWindowInfo $title 1]
+ tk_messageBox -icon info -type okcancel -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {ok}
+
+test winMsgbox-1.2 {tk_messageBox okcancel} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.2 [pid]"
+ after 100 [list GetWindowInfo $title 2]
+ tk_messageBox -icon info -type okcancel -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {cancel}
+
+test winMsgbox-1.3 {tk_messageBox yesno} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.3 [pid]"
+ after 100 [list GetWindowInfo $title 6]
+ tk_messageBox -icon info -type yesno -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {yes}
+
+test winMsgbox-1.4 {tk_messageBox yesno} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.4 [pid]"
+ after 100 [list GetWindowInfo $title 7]
+ tk_messageBox -icon info -type yesno -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {no}
+
+test winMsgbox-1.5 {tk_messageBox abortretryignore} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.5 [pid]"
+ after 100 [list GetWindowInfo $title 3]
+ tk_messageBox -icon info -type abortretryignore -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {abort}
+
+test winMsgbox-1.6 {tk_messageBox abortretryignore} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.6 [pid]"
+ after 100 [list GetWindowInfo $title 4]
+ tk_messageBox -icon info -type abortretryignore -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {retry}
+
+test winMsgbox-1.7 {tk_messageBox abortretryignore} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.7 [pid]"
+ after 100 [list GetWindowInfo $title 5]
+ tk_messageBox -icon info -type abortretryignore -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {ignore}
+
+test winMsgbox-1.8 {tk_messageBox retrycancel} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.8 [pid]"
+ after 100 [list GetWindowInfo $title 4]
+ tk_messageBox -icon info -type retrycancel -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {retry}
+
+test winMsgbox-1.9 {tk_messageBox retrycancel} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.9 [pid]"
+ after 100 [list GetWindowInfo $title 2]
+ tk_messageBox -icon info -type retrycancel -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {cancel}
+
+test winMsgbox-1.10 {tk_messageBox yesnocancel} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.10 [pid]"
+ after 100 [list GetWindowInfo $title 6]
+ tk_messageBox -icon info -type yesnocancel -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {yes}
+
+test winMsgbox-1.11 {tk_messageBox yesnocancel} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.11 [pid]"
+ after 100 [list GetWindowInfo $title 7]
+ tk_messageBox -icon info -type yesnocancel -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {no}
+
+test winMsgbox-1.12 {tk_messageBox yesnocancel} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+} -body {
+ global windowInfo
+ set title "winMsgbox-1.12 [pid]"
+ after 100 [list GetWindowInfo $title 2]
+ tk_messageBox -icon info -type yesnocancel -title $title -message Message
+} -cleanup {
+ wm deiconify .
+} -result {cancel}
+
+# -------------------------------------------------------------------------
+
+test winMsgbox-2.0 {tk_messageBox message} -constraints {win getwindowinfo} -setup {
+ wm iconify .
+ unset -nocomplain info
+} -body {
+ global windowInfo
+ set title "winMsgbox-2.0 [pid]"
+ set message "message"
+ after 100 [list GetWindowInfo $title 2]
+ set r [tk_messageBox -type ok -title $title -message $message]
+ array set info $windowInfo
+ lappend r $info(childtext)
+} -cleanup {
+ wm deiconify .
+} -result [list ok "message"]
+
+test winMsgbox-2.1 {tk_messageBox message (long)} -constraints {
+ win getwindowinfo
+} -setup {
+ wm iconify .
+ unset -nocomplain info
+} -body {
+ global windowInfo
+ set title "winMsgbox-2.1 [pid]"
+ set message [string repeat Ab 80]
+ after 100 [list GetWindowInfo $title 2]
+ set r [tk_messageBox -type ok -title $title -message $message]
+ array set info $windowInfo
+ lappend r $info(childtext)
+} -cleanup {
+ wm deiconify .
+} -result [list ok [string repeat Ab 80]]
+
+test winMsgbox-2.2 {tk_messageBox message (unicode)} -constraints {
+ win getwindowinfo
+} -setup {
+ wm iconify .
+ unset -nocomplain info
+} -body {
+ global windowInfo
+ set title "winMsgbox-2.2 [pid]"
+ set message "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"
+ after 100 [list GetWindowInfo $title 2]
+ set r [tk_messageBox -type ok -title $title -message $message]
+ array set info $windowInfo
+ lappend r $info(childtext)
+} -cleanup {
+ wm deiconify .
+} -result [list ok "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"]
+
+test winMsgbox-2.3 {tk_messageBox message (empty)} -constraints {
+ win getwindowinfo
+} -setup {
+ wm iconify .
+ unset -nocomplain info
+} -body {
+ global windowInfo
+ set title "winMsgbox-2.3 [pid]"
+ after 100 [list GetWindowInfo $title 2]
+ set r [tk_messageBox -type ok -title $title]
+ array set info $windowInfo
+ lappend r $info(childtext)
+} -cleanup {
+ wm deiconify .
+} -result [list ok ""]
+
+test winMsgbox-3.0 {tk_messageBox detail (sourceforge bug #1692927)} -constraints {
+ win getwindowinfo
+} -setup {
+ wm iconify .
+ unset -nocomplain info
+} -body {
+ global windowInfo
+ set title "winMsgbox-3.0 [pid]"
+ after 100 [list GetWindowInfo $title 2]
+ set r [tk_messageBox -type ok -title $title \
+ -message Hello -detail "Pleased to meet you"]
+ array set info $windowInfo
+ lappend r $info(childtext)
+} -cleanup {
+ wm deiconify .
+} -result [list ok "Hello\n\nPleased to meet you"]
+
+test winMsgbox-3.1 {tk_messageBox detail (unicode)} -constraints {
+ win getwindowinfo
+} -setup {
+ wm iconify .
+ unset -nocomplain info
+} -body {
+ global windowInfo
+ set title "winMsgbox-3.1 [pid]"
+ set message "\u041f\u043e\u0438\u0441\u043a"
+ set detail "\u0441\u0442\u0440\u0430\u043d\u0438\u0446"
+ after 100 [list GetWindowInfo $title 2]
+ set r [tk_messageBox -type ok -title $title -message $message -detail $detail]
+ array set info $windowInfo
+ lappend r $info(childtext)
+} -cleanup {
+ wm deiconify .
+} -result [list ok "\u041f\u043e\u0438\u0441\u043a\n\n\u0441\u0442\u0440\u0430\u043d\u0438\u0446"]
+
+# -------------------------------------------------------------------------
+
+if {[testConstraint testwinevent]} {
+ catch {testwinevent debug 0}
+}
+cleanupTests
+return
+
+# Local variables:
+# mode: tcl
+# indent-tabs-mode: nil
+# End:
diff --git a/tests/winSend.test b/tests/winSend.test
index 03f7172..cd130fb 100644
--- a/tests/winSend.test
+++ b/tests/winSend.test
@@ -8,14 +8,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::interpreter
-
# Compute a script that will load Tk into a child interpreter.
foreach pkg [info loaded] {
@@ -39,27 +34,32 @@ proc newApp {name {safe {}}} {
}
set currentInterps [winfo interps]
-if {[testConstraint win] && [llength [info commands send]]} {
-
- if {[catch {exec [interpreter] &}] == 0} {
-
- # Wait until the child application has launched.
- while {[llength [winfo interps]] == [llength $currentInterps]} {}
+if {
+ [testConstraint win] &&
+ [llength [info commands send]] &&
+ [catch {exec [interpreter] &}] == 0
+} then {
+ # Wait until the child application has launched.
+ while {[llength [winfo interps]] == [llength $currentInterps]} {}
- # Now find an interp to send to
- set newInterps [winfo interps]
- foreach interp $newInterps {
- if {[lsearch -exact $currentInterps $interp] < 0} {
- break
- }
+ # Now find an interp to send to
+ set newInterps [winfo interps]
+ foreach interp $newInterps {
+ if {[lsearch -exact $currentInterps $interp] < 0} {
+ break
}
-
- # Now we have found our interpreter we are going to send to.
- # Make sure that it works first.
- testConstraint winSend [expr {[catch {
- send $interp {console hide; update}
- }] == 0}]
}
+
+ # Now we have found our interpreter we are going to send to.
+ # Make sure that it works first.
+ testConstraint winSend [expr {![catch {
+ send $interp {
+ console hide
+ update
+ }
+ }]}]
+} else {
+ testConstraint winSend 0
}
# setting up dde server is done when the first interp is created and
@@ -68,9 +68,7 @@ test winSend-1.1 {Tk_SetAppName - changing name of interp} winSend {
newApp testApp
list [testApp eval tk appname testApp2] [interp delete testApp]
} {testApp2 {}}
-test winSend-1.2 {Tk_SetAppName - changing name - not front of linked list} {
- winSend
-} {
+test winSend-1.2 {Tk_SetAppName - changing name - not front of linked list} winSend {
newApp testApp
newApp testApp2
list [testApp eval tk appname testApp3] [interp delete testApp] [interp delete testApp2]
@@ -99,16 +97,16 @@ test winSend-1.6 {Tk_SetAppName - safe interps} winSend {
test winSend-2.1 {Tk_SendObjCmd - # of args} winSend {
list [catch {send tktest} msg] $msg
} {1 {wrong # args: should be "send ?options? interpName arg ?arg ...?"}}
-test winSend-2.1 {Tk_SendObjCmd: arguments} winSend {
+test winSend-2.1a {Tk_SendObjCmd: arguments} winSend {
list [catch {send -bogus tktest} msg] $msg
} {1 {bad option "-bogus": must be -async, -displayof, or --}}
-test winSend-2.1 {Tk_SendObjCmd: arguments} winSend {
+test winSend-2.1b {Tk_SendObjCmd: arguments} winSend {
list [catch {send -async bogus foo} msg] $msg
} {1 {no registered server named "bogus"}}
-test winSend-2.1 {Tk_SendObjCmd: arguments} winSend {
+test winSend-2.1c {Tk_SendObjCmd: arguments} winSend {
list [catch {send -displayof . bogus foo} msg] $msg
} {1 {no registered server named "bogus"}}
-test winSend-2.1 {Tk_SendObjCmd: arguments} winSend {
+test winSend-2.1d {Tk_SendObjCmd: arguments} winSend {
list [catch {send -- -bogus foo} msg] $msg
} {1 {no registered server named "-bogus"}}
test winSend-2.2 {Tk_SendObjCmd - sending to ourselves} winSend {
@@ -405,6 +403,5 @@ while {[llength $newInterps] != [llength $currentInterps]} {
}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
diff --git a/tests/winWm.test b/tests/winWm.test
index ff537a4..2864418 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -10,10 +10,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Measure the height of a single menu line
@@ -23,17 +20,17 @@ frame .t.f -width 100 -height 50
pack .t.f
menu .t.m
.t.m add command -label "thisisreallylong"
-.t conf -menu .t.m
-wm geom .t -0-0
+.t configure -menu .t.m
+wm geometry .t -0-0
update
set menuheight [winfo y .t]
.t.m add command -label "thisisreallylong"
-wm geom .t -0-0
+wm geometry .t -0-0
update
-set menuheight [expr $menuheight - [winfo y .t]]
+set menuheight [expr {$menuheight - [winfo y .t]}]
destroy .t
-test winWm-1.1 {TkWmMapWindow} {pcOnly} {
+test winWm-1.1 {TkWmMapWindow} win {
toplevel .t
wm override .t 1
wm geometry .t +0+0
@@ -42,7 +39,7 @@ test winWm-1.1 {TkWmMapWindow} {pcOnly} {
destroy .t
set result
} {0 0}
-test winWm-1.2 {TkWmMapWindow} {pcOnly} {
+test winWm-1.2 {TkWmMapWindow} win {
toplevel .t
wm transient .t .
update
@@ -54,16 +51,16 @@ test winWm-1.2 {TkWmMapWindow} {pcOnly} {
destroy .t
set msg
} {can't iconify ".t": it is a transient}
-test winWm-1.3 {TkWmMapWindow} {pcOnly} {
+test winWm-1.3 {TkWmMapWindow} win {
toplevel .t
update
toplevel .t2
update
- set result [expr [winfo x .t] != [winfo x .t2]]
+ set result [expr {[winfo x .t] != [winfo x .t2]}]
destroy .t .t2
set result
} 1
-test winWm-1.4 {TkWmMapWindow} {pcOnly} {
+test winWm-1.4 {TkWmMapWindow} win {
toplevel .t
wm geometry .t +10+10
update
@@ -74,7 +71,7 @@ test winWm-1.4 {TkWmMapWindow} {pcOnly} {
destroy .t .t2
set result
} {10 40}
-test winWm-1.5 {TkWmMapWindow} {pcOnly} {
+test winWm-1.5 {TkWmMapWindow} win {
toplevel .t
wm iconify .t
update
@@ -83,7 +80,7 @@ test winWm-1.5 {TkWmMapWindow} {pcOnly} {
set result
} iconic
-test winWm-2.1 {TkpWmSetState} {pcOnly} {
+test winWm-2.1 {TkpWmSetState} win {
toplevel .t
wm geometry .t 150x50+10+10
update
@@ -97,7 +94,7 @@ test winWm-2.1 {TkpWmSetState} {pcOnly} {
destroy .t
set result
} {normal iconic normal}
-test winWm-2.2 {TkpWmSetState} {pcOnly} {
+test winWm-2.2 {TkpWmSetState} win {
toplevel .t
wm geometry .t 150x50+10+10
update
@@ -114,7 +111,7 @@ test winWm-2.2 {TkpWmSetState} {pcOnly} {
destroy .t
set result
} {normal withdrawn iconic normal}
-test winWm-2.2 {TkpWmSetState} {pcOnly} {
+test winWm-2.3 {TkpWmSetState} win {
toplevel .t
wm geometry .t 150x50+10+10
update
@@ -131,7 +128,7 @@ test winWm-2.2 {TkpWmSetState} {pcOnly} {
destroy .t
set result
} {normal withdrawn iconic normal}
-test winWm-2.4 {TkpWmSetState} {pcOnly} {
+test winWm-2.4 {TkpWmSetState} win {
set result {}
toplevel .t
wm geometry .t 150x50+10+10
@@ -150,7 +147,7 @@ test winWm-2.4 {TkpWmSetState} {pcOnly} {
set result
} {{normal 150x50+10+10} {iconic 150x50+10+10} {iconic 150x50+10+10} {normal 200x50+10+10}}
-test winWm-3.1 {ConfigureTopLevel: window geometry propagation} {pcOnly} {
+test winWm-3.1 {ConfigureTopLevel: window geometry propagation} win {
toplevel .t
wm geometry .t +0+0
button .t.b
@@ -164,38 +161,43 @@ test winWm-3.1 {ConfigureTopLevel: window geometry propagation} {pcOnly} {
update
pack .t.b
update
- set x [expr $x == [winfo x .t.b]]
+ set x [expr {$x == [winfo x .t.b]}]
destroy .t
set x
} 1
-test winWm-4.1 {ConfigureTopLevel: menu resizing} {pcOnly} {
+test winWm-4.1 {ConfigureTopLevel: menu resizing} win {
set result {}
toplevel .t
- frame .t.f -width 150 -height 50 -bg red
+ frame .t.f -width 150 -height 50 -background red
pack .t.f
wm geometry .t -0-0
update
set y [winfo y .t]
menu .t.m
.t.m add command -label foo
- .t conf -menu .t.m
+ .t configure -menu .t.m
update
- set result [expr $y - [winfo y .t]]
+ set result [expr {$y - [winfo y .t]}]
destroy .t
set result
-} [expr $menuheight + 1]
+} [expr {$menuheight + 1}]
-test winWm-5.1 {UpdateGeometryInfo: menu resizing} {pcOnly} {
+# This test works on 8.0p2 but has not worked on anything since 8.2.
+# It would be very strange to have a windows application increase the size
+# of the clientarea when a menu wraps so I believe this test to be wrong.
+# Original result was {50 50 50} new result may depend on the default menu
+# font
+test winWm-5.1 {UpdateGeometryInfo: menu resizing} win {
set result {}
toplevel .t
- frame .t.f -width 150 -height 50 -bg red
+ frame .t.f -width 150 -height 50 -background red
pack .t.f
update
set result [winfo height .t]
menu .t.m
.t.m add command -label foo
- .t conf -menu .t.m
+ .t configure -menu .t.m
update
lappend result [winfo height .t]
.t.m add command -label "thisisreallylong"
@@ -203,25 +205,26 @@ test winWm-5.1 {UpdateGeometryInfo: menu resizing} {pcOnly} {
update
lappend result [winfo height .t]
destroy .t
+
set result
-} {50 50 50}
-test winWm-5.2 {UpdateGeometryInfo: menu resizing} {pcOnly} {
+} {50 50 31}
+test winWm-5.2 {UpdateGeometryInfo: menu resizing} win {
set result {}
toplevel .t
- frame .t.f -width 150 -height 50 -bg red
+ frame .t.f -width 150 -height 50 -background red
pack .t.f
- wm geom .t -0-0
+ wm geometry .t -0-0
update
set y [winfo rooty .t]
lappend result [winfo height .t]
menu .t.m
- .t conf -menu .t.m
+ .t configure -menu .t.m
.t.m add command -label foo
.t.m add command -label "thisisreallylong"
.t.m add command -label "thisisreallylong"
update
lappend result [winfo height .t]
- lappend result [expr $y - [winfo rooty .t]]
+ lappend result [expr {$y - [winfo rooty .t]}]
destroy .t
set result
} {50 50 0}
@@ -230,7 +233,7 @@ test winWm-6.1 {wm attributes} win {
destroy .t
toplevel .t
wm attributes .t
-} {-alpha 1.0 -transparentcolor {} -disabled 0 -toolwindow 0 -topmost 0}
+} {-alpha 1.0 -transparentcolor {} -disabled 0 -fullscreen 0 -toolwindow 0 -topmost 0}
test winWm-6.2 {wm attributes} win {
destroy .t
toplevel .t
@@ -241,7 +244,7 @@ test winWm-6.3 {wm attributes} win {
destroy .t
toplevel .t
list [catch {wm attributes .t -foo} msg] $msg
-} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}}
+} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}}
test winWm-6.4 {wm attributes -alpha} win {
# Expect this to return all 1.0 {} on pre-2K/XP
@@ -307,8 +310,8 @@ test winWm-6.8 {wm attributes -transparentcolor} win {
list [catch {wm attributes .t -tr foo} msg] $msg
} {1 {unknown color name "foo"}}
-test winWm-7.1 {deiconify on an unmapped toplevel
- will raise the window and set the focus} {pcOnly} {
+test winWm-7.1 {deiconify on an unmapped toplevel\
+ will raise the window and set the focus} win {
destroy .t
toplevel .t
lower .t
@@ -318,8 +321,8 @@ test winWm-7.1 {deiconify on an unmapped toplevel
list [wm stackorder .t isabove .] [focus]
} {1 .t}
-test winWm-7.2 {deiconify on an already mapped toplevel
- will raise the window and set the focus} {pcOnly} {
+test winWm-7.2 {deiconify on an already mapped toplevel\
+ will raise the window and set the focus} win {
destroy .t
toplevel .t
lower .t
@@ -365,8 +368,132 @@ test winWm-8.2 {Tk_WmCmd procedure, "iconphoto" option} win {
image delete blank16 blank32
} {}
+test winWm-9.0 "Bug #2799589 - delayed activation of destroyed window" -constraints win -setup {
+ proc winwm90click {w} {
+ if {![winfo ismapped $w]} { update }
+ event generate $w <Enter>
+ focus -force $w
+ event generate $w <ButtonPress-1> -x 5 -y 5
+ event generate $w <ButtonRelease-1> -x 5 -y 5
+ }
+ proc winwm90proc3 {} {
+ global winwm90done winwm90check
+ set w .sd
+ toplevel $w
+ pack [button $w.b -text "OK" -command {set winwm90check 1}]
+ bind $w.b <Map> {after idle {winwm90click %W}}
+ update idletasks
+ tkwait visibility $w
+ grab $w
+ tkwait variable winwm90check
+ grab release $w
+ destroy $w
+ after idle {set winwm90done ok}
+ }
+ proc winwm90proc2 {w} { winwm90proc3; destroy $w }
+ proc winwm90proc1 {w} {
+ toplevel $w
+ pack [button $w.b -text "Do dialog" -command [list winwm90proc2 $w]]
+ bind $w.b <Map> {bind %W <Map> {}; after idle {winwm90click %W}}
+ }
+ destroy .t
+ global winwm90done
+ set winwm90done wait
+ toplevel .t
+} -body {
+ pack [button .t.b -text "Show" -command {winwm90proc1 .tx}]
+ bind .t.b <Map> {bind %W <Map> {}; after idle {winwm90click %W}}
+ after 5000 {set winwm90done timeout}
+ vwait winwm90done
+ set winwm90done
+} -cleanup {
+ foreach cmd {proc1 proc2 proc3 click} {
+ rename winwm90$cmd {}
+ }
+ destroy .tx .t .sd
+} -result {ok}
+
+test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win -setup {
+ proc winwm91click {w} {
+ if {![winfo ismapped $w]} { update }
+ event generate $w <Enter>
+ focus -force $w
+ event generate $w <ButtonPress-1> -x 5 -y 5
+ event generate $w <ButtonRelease-1> -x 5 -y 5
+ }
+ proc winwm91proc3 {} {
+ global winwm91done winwm91check
+ set w .sd
+ toplevel $w
+ pack [button $w.b -text "OK" -command {set winwm91check 1}]
+ bind $w.b <Map> {after idle {winwm91click %W}}
+ update idletasks
+ tkwait visibility $w
+ grab $w
+ tkwait variable winwm91check
+ #skip the release: #grab release $w
+ destroy $w
+ after idle {set winwm91done ok}
+ }
+ proc winwm91proc2 {w} { winwm91proc3; destroy $w }
+ proc winwm91proc1 {w} {
+ toplevel $w
+ pack [button $w.b -text "Do dialog" -command [list winwm91proc2 $w]]
+ bind $w.b <Map> {bind %W <Map> {}; after idle {winwm91click %W}}
+ }
+ destroy .t
+ global winwm91done
+ set winwm91done wait
+ toplevel .t
+} -body {
+ pack [button .t.b -text "Show" -command {winwm91proc1 .tx}]
+ bind .t.b <Map> {bind %W <Map> {}; after idle {winwm91click %W}}
+ after 5000 {set winwm91done timeout}
+ vwait winwm91done
+ set winwm91done
+} -cleanup {
+ foreach cmd {proc1 proc2 proc3 click} {
+ rename winwm91$cmd {}
+ }
+ destroy .tx .t .sd
+} -result {ok}
+
+test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup {
+ destroy .t
+ toplevel .t
+ set winwm92 {}
+ frame .t.f -background blue -height 200 -width 200
+ frame .t.f.x -background red -height 100 -width 100
+} -body {
+ pack .t.f.x
+ pack .t.f
+ set aid [after 1000 {set ::winwm92 timeout}]
+ after 100 {
+ wm manage .t.f
+ wm iconify .t
+ after 100 {
+ wm forget .t.f
+ wm deiconify .t
+ after 100 {
+ pack .t.f
+ after 100 {set ::winwm92 [expr {[winfo rooty .t.f.x] == 0 ? "failed" : "ok"}]}
+ }
+ }
+ }
+ vwait ::winwm92
+ after cancel $aid
+ set winwm92
+} -cleanup {
+ destroy .t.f.x .t.f .t
+ unset -nocomplain winwm92 aid
+} -result ok
+
destroy .t
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
+
+# Local variables:
+# mode: tcl
+# End:
diff --git a/tests/window.test b/tests/window.test
index 8628c7a..2c8f19d 100644
--- a/tests/window.test
+++ b/tests/window.test
@@ -6,15 +6,12 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-namespace import -force tcltest::interpreter
-namespace import -force tcltest::makeFile
-namespace import -force tcltest::removeFile
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-
+testConstraint unthreaded [expr {
+ (![info exist tcl_platform(threaded)] || !$tcl_platform(threaded))
+}]
+namespace import -force ::tk::test::loadTkCommand
update
# XXX This file is woefully incomplete. Right now it only tests
@@ -80,59 +77,84 @@ test window-2.3 {Tk_DestroyWindow procedure, destroy handler deletes parent} {
test window-2.4 {Tk_DestroyWindow, cleanup half dead window at exit} \
unixOrWin {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
update
bind . <Destroy> exit
destroy .
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 {}}
test window-2.5 {Tk_DestroyWindow, cleanup half dead windows at exit} \
unixOrWin {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
toplevel .t
update
bind .t <Destroy> exit
destroy .t
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 {}}
test window-2.6 {Tk_DestroyWindow, cleanup half dead windows at exit} \
unixOrWin {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
toplevel .t
update
bind .t <Destroy> exit
destroy .
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 {}}
test window-2.7 {Tk_DestroyWindow, cleanup half dead windows at exit} \
unixOrWin {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
toplevel .t
toplevel .t.f
update
bind .t.f <Destroy> exit
destroy .
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 {}}
test window-2.8 {Tk_DestroyWindow, cleanup half dead windows at exit} \
unixOrWin {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
toplevel .t1
toplevel .t2
toplevel .t3
@@ -141,30 +163,44 @@ test window-2.8 {Tk_DestroyWindow, cleanup half dead windows at exit} \
bind .t2 <Destroy> {destroy .t1}
bind .t1 <Destroy> {exit 0}
destroy .t3
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 {}}
-test window-2.9 {Tk_DestroyWindow, Destroy bindings evaluated after exit} \
- unixOrWin {
- set script [makeFile {
+# window-2.9 deadlocks threaded Tk [Bug 1715716]
+test window-2.9 {Tk_DestroyWindow, Destroy bindings
+ evaluated after exit} {unixOrWin unthreaded} {
+ set code [loadTkCommand]
+ append code {
toplevel .t1
toplevel .t2
update
bind .t2 <Destroy> {puts "Destroy .t2" ; exit 1}
bind .t1 <Destroy> {puts "Destroy .t1" ; exit 0}
destroy .t2
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 {Destroy .t2
Destroy .t1}}
-test window-2.10 {Tk_DestroyWindow, Destroy binding evaluated once} unixOrWin {
- set script [makeFile {
+test window-2.10 {Tk_DestroyWindow, Destroy binding
+ evaluated once} unixOrWin {
+ set code [loadTkCommand]
+ append code {
update
bind . <Destroy> {
puts "Destroy ."
@@ -172,15 +208,21 @@ test window-2.10 {Tk_DestroyWindow, Destroy binding evaluated once} unixOrWin {
exit 0
}
destroy .
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 {Destroy .}}
test window-2.11 {Tk_DestroyWindow, don't reanimate a half-dead window} \
unixOrWin {
- set script [makeFile {
+ set code [loadTkCommand]
+ append code {
toplevel .t1
toplevel .t2
update
@@ -193,17 +235,19 @@ test window-2.11 {Tk_DestroyWindow, don't reanimate a half-dead window} \
}
bind .t2 <Destroy> {exit}
destroy .t2
- } script]
- set error [catch {exec [interpreter] $script -geometry 10x10+0+0} msg]
+ }
+ set script [makeFile $code script]
+ if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
+ set error 1
+ } else {
+ set error 0
+ }
removeFile script
list $error $msg
} {0 YES}
-# Some tests require the testmenubar command
-testConstraint testmenubar [llength [info commands testmenubar]]
-
test window-3.1 {Tk_MakeWindowExist procedure, stacking order and menubars} \
- {unixOnly testmenubar} {
+ {unix testmenubar} {
catch {destroy .t}
toplevel .t -width 300 -height 200
wm geometry .t +0+0
@@ -214,7 +258,7 @@ test window-3.1 {Tk_MakeWindowExist procedure, stacking order and menubars} \
# If stacking order isn't handle properly, generates an X error.
} {}
test window-3.2 {Tk_MakeWindowExist procedure, stacking order and menubars} \
- {unixOnly testmenubar} {
+ {unix testmenubar} {
catch {destroy .t}
toplevel .t -width 300 -height 200
wm geometry .t +0+0
@@ -241,7 +285,7 @@ test window-4.2 {Tk_NameToWindow procedure} {testmenubar} {
} {0 100x50+10+10}
test window-5.1 {Tk_MakeWindowExist procedure, stacking order and menubars} \
- {unixOnly testmenubar} {
+ {unix testmenubar} {
catch {destroy .t}
toplevel .t -width 300 -height 200
wm geometry .t +0+0
@@ -256,17 +300,5 @@ test window-5.1 {Tk_MakeWindowExist procedure, stacking order and menubars} \
} {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/winfo.test b/tests/winfo.test
index b69de55..4ce87eb 100644
--- a/tests/winfo.test
+++ b/tests/winfo.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# eatColors --
@@ -82,20 +79,16 @@ test winfo-2.7 {"winfo atom" command} {
winfo atomname -displayof . 2
} SECONDARY
-# Some tests require the "pseudocolor" visual class.
-testConstraint pseudocolor [expr { ([winfo depth .] == 8)
- && ([winfo visual .] == "pseudocolor")}]
-
-test winfo-3.1 {"winfo colormapfull" command} {pseudocolor} {
+test winfo-3.1 {"winfo colormapfull" command} defaultPseudocolor8 {
list [catch {winfo colormapfull} msg] $msg
} {1 {wrong # args: should be "winfo colormapfull window"}}
-test winfo-3.2 {"winfo colormapfull" command} {pseudocolor} {
+test winfo-3.2 {"winfo colormapfull" command} defaultPseudocolor8 {
list [catch {winfo colormapfull a b} msg] $msg
} {1 {wrong # args: should be "winfo colormapfull window"}}
-test winfo-3.3 {"winfo colormapfull" command} {pseudocolor} {
+test winfo-3.3 {"winfo colormapfull" command} defaultPseudocolor8 {
list [catch {winfo colormapfull foo} msg] $msg
} {1 {bad window path name "foo"}}
-test winfo-3.4 {"winfo colormapfull" command} {macOrUnix pseudocolor} {
+test winfo-3.4 {"winfo colormapfull" command} {unix defaultPseudocolor8} {
eatColors .t {-colormap new}
set result [list [winfo colormapfull .] [winfo colormapfull .t]]
.t.c delete 34
@@ -113,8 +106,7 @@ toplevel .t -width 550 -height 400
frame .t.f -width 80 -height 60 -bd 2 -relief raised
place .t.f -x 50 -y 50
wm geom .t +0+0
-tkwait visibility .t.f
-
+update
test winfo-4.1 {"winfo containing" command} {
list [catch {winfo containing 22} msg] $msg
} {1 {wrong # args: should be "winfo containing ?-displayof window? rootX rootY"}}
@@ -128,6 +120,7 @@ test winfo-4.4 {"winfo containing" command} {
list [catch {winfo containing -displayof geek 25 30} msg] $msg
} {1 {bad window path name "geek"}}
test winfo-4.5 {"winfo containing" command} {
+ raise .t
winfo containing [winfo rootx .t.f] [winfo rooty .t.f]
} .t.f
test winfo-4.6 {"winfo containing" command} {nonPortable} {
@@ -149,10 +142,10 @@ test winfo-5.2 {"winfo interps" command} {
test winfo-5.3 {"winfo interps" command} {
list [catch {winfo interps -displayof geek} msg] $msg
} {1 {bad window path name "geek"}}
-test winfo-5.4 {"winfo interps" command} {unixOnly} {
+test winfo-5.4 {"winfo interps" command} unix {
expr [lsearch -exact [winfo interps] [tk appname]] >= 0
} {1}
-test winfo-5.5 {"winfo interps" command} {unixOnly} {
+test winfo-5.5 {"winfo interps" command} unix {
expr [lsearch -exact [winfo interps -displayof .] [tk appname]] >= 0
} {1}
@@ -202,7 +195,7 @@ test winfo-7.6 {"winfo pathname" command} {
test winfo-7.7 {"winfo pathname" command} {
winfo pathname -displayof .b [winfo id .]
} {.}
-test winfo-7.8 {"winfo pathname" command} {unixOnly testwrapper} {
+test winfo-7.8 {"winfo pathname" command} {unix testwrapper} {
winfo pathname [testwrapper .]
} {}
@@ -371,5 +364,5 @@ test winfo-14.4 {mapped at idle time} {
deleteWindows
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
diff --git a/tests/wm.test b/tests/wm.test
index 649e3df..15526e7 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -1,21 +1,18 @@
-# This file is a Tcl script to test out Tk's interactions with
-# the window manager, including the "wm" command. It is organized
-# in the standard fashion for Tcl tests.
+# This file is a Tcl script to test out Tk's interactions with the window
+# manager, including the "wm" command. It is organized in the standard fashion
+# for Tcl tests.
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-# This file tests window manager interactions that work across
-# platforms. Window manager tests that only work on a specific
-# platform should be placed in unixWm.test or winWm.test.
+# This file tests window manager interactions that work across platforms.
+# Window manager tests that only work on a specific platform should be placed
+# in unixWm.test or winWm.test.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
wm deiconify .
@@ -30,160 +27,439 @@ proc stdWindow {} {
update
}
-# [raise] and [lower] may return before the window manager
-# has completed the operation. The raiseDelay procedure
-# idles for a while to give the operation a chance to complete.
+# [raise] and [lower] may return before the window manager has completed the
+# operation. The raiseDelay procedure idles for a while to give the operation
+# a chance to complete.
#
proc raiseDelay {} {
after 100; update
}
+# How to carry out a small delay while processing events
-deleteWindows
-stdWindow
-
-test wm-1.1 {Tk_WmObjCmd procedure, miscellaneous errors} {
- list [catch {wm} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+proc eventDelay {{delay 200}} {
+ after $delay "set done 1" ; vwait done
+}
-test wm-1.2 {Tk_WmObjCmd procedure, miscellaneous errors} {
- list [catch {wm foo} msg] $msg
-} {1 {bad option "foo": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw}}
+deleteWindows
-test wm-1.3 {Tk_WmObjCmd procedure, miscellaneous errors} {
- list [catch {wm command} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+##############################################################################
-test wm-1.4 {Tk_WmObjCmd procedure, miscellaneous errors} {
- list [catch {wm aspect bogus} msg] $msg
-} {1 {bad window path name "bogus"}}
+stdWindow
-test wm-1.5 {Tk_WmObjCmd procedure, miscellaneous errors} {
- catch {destroy .b}
+test wm-1.1 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body {
+ wm
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+# Next test will fail every time set of subcommands is changed
+test wm-1.2 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body {
+ wm foo
+} -result {bad option "foo": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw}
+test wm-1.3 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body {
+ wm command
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-1.4 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body {
+ wm aspect bogus
+} -result {bad window path name "bogus"}
+test wm-1.5 {Tk_WmObjCmd procedure, miscellaneous errors} -body {
button .b -text hello
- list [catch {wm geometry .b} msg] $msg
-} {1 {window ".b" isn't a top-level window}}
-
-
-test wm-aspect-1.1 {usage} {
- list [catch {wm aspect} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-aspect-1.2 {usage} {
- list [catch {wm aspect . _} err] $err
-} {1 {wrong # args: should be "wm aspect window ?minNumer minDenom maxNumer maxDenom?"}}
-
-test wm-aspect-1.3 {usage} {
- list [catch {wm aspect . _ _ _} err] $err
-} {1 {wrong # args: should be "wm aspect window ?minNumer minDenom maxNumer maxDenom?"}}
-
-test wm-aspect-1.4 {usage} {
- list [catch {wm aspect . _ _ _ _ _} err] $err
-} {1 {wrong # args: should be "wm aspect window ?minNumer minDenom maxNumer maxDenom?"}}
-
-test wm-aspect-1.5 {usage} {
- list [catch {wm aspect . bad 14 15 16} msg] $msg
-} {1 {expected integer but got "bad"}}
-
-test wm-aspect-1.6 {usage} {
- list [catch {wm aspect . 13 foo 15 16} msg] $msg
-} {1 {expected integer but got "foo"}}
-
-test wm-aspect-1.7 {usage} {
- list [catch {wm aspect . 13 14 bar 16} msg] $msg
-} {1 {expected integer but got "bar"}}
-
-test wm-aspect-1.8 {usage} {
- list [catch {wm aspect . 13 14 15 baz} msg] $msg
-} {1 {expected integer but got "baz"}}
-
-test wm-aspect-1.9 {usage} {
- list [catch {wm aspect . 0 14 15 16} msg] $msg
-} {1 {aspect number can't be <= 0}}
-
-test wm-aspect-1.10 {usage} {
- list [catch {wm aspect . 13 0 15 16} msg] $msg
-} {1 {aspect number can't be <= 0}}
-
-test wm-aspect-1.11 {usage} {
- list [catch {wm aspect . 13 14 0 16} msg] $msg
-} {1 {aspect number can't be <= 0}}
-
-test wm-aspect-1.12 {usage} {
- list [catch {wm aspect . 13 14 15 0} msg] $msg
-} {1 {aspect number can't be <= 0}}
-
-test wm-aspect-2.1 {setting and reading values} {
+ wm geometry .b
+} -returnCodes error -cleanup {
+ destroy .b
+} -result {window ".b" isn't a top-level window}
+
+
+### wm aspect ###
+test wm-aspect-1.1 {usage} -returnCodes error -body {
+ wm aspect
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-aspect-1.2 {usage} -returnCodes error -body {
+ wm aspect . _
+} -result {wrong # args: should be "wm aspect window ?minNumer minDenom maxNumer maxDenom?"}
+test wm-aspect-1.3 {usage} -returnCodes error -body {
+ wm aspect . _ _ _
+} -result {wrong # args: should be "wm aspect window ?minNumer minDenom maxNumer maxDenom?"}
+test wm-aspect-1.4 {usage} -returnCodes error -body {
+ wm aspect . _ _ _ _ _
+} -result {wrong # args: should be "wm aspect window ?minNumer minDenom maxNumer maxDenom?"}
+test wm-aspect-1.5 {usage} -returnCodes error -body {
+ wm aspect . bad 14 15 16
+} -result {expected integer but got "bad"}
+test wm-aspect-1.6 {usage} -returnCodes error -body {
+ wm aspect . 13 foo 15 16
+} -result {expected integer but got "foo"}
+test wm-aspect-1.7 {usage} -returnCodes error -body {
+ wm aspect . 13 14 bar 16
+} -result {expected integer but got "bar"}
+test wm-aspect-1.8 {usage} -returnCodes error -body {
+ wm aspect . 13 14 15 baz
+} -result {expected integer but got "baz"}
+test wm-aspect-1.9 {usage} -returnCodes error -body {
+ wm aspect . 0 14 15 16
+} -result {aspect number can't be <= 0}
+test wm-aspect-1.10 {usage} -returnCodes error -body {
+ wm aspect . 13 0 15 16
+} -result {aspect number can't be <= 0}
+test wm-aspect-1.11 {usage} -returnCodes error -body {
+ wm aspect . 13 14 0 16
+} -result {aspect number can't be <= 0}
+test wm-aspect-1.12 {usage} -returnCodes error -body {
+ wm aspect . 13 14 15 0
+} -result {aspect number can't be <= 0}
+
+test wm-aspect-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm aspect .t]
wm aspect .t 3 4 10 2
lappend result [wm aspect .t]
wm aspect .t {} {} {} {}
lappend result [wm aspect .t]
-} [list {} {3 4 10 2} {}]
-
-
-test wm-attributes-1.1 {usage} {
- list [catch {wm attributes} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+} -result [list {} {3 4 10 2} {}]
+
+
+### wm attributes ###
+test wm-attributes-1.1 {usage} -returnCodes error -body {
+ wm attributes
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-attributes-1.2.1 {usage} -constraints win -returnCodes error -body {
+ # This is the wrong error to output - unix has it right, but it's
+ # not critical.
+ wm attributes . _
+} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
+test wm-attributes-1.2.2 {usage} -constraints win -returnCodes error -body {
+ wm attributes . -alpha 1.0 -disabled
+} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
+test wm-attributes-1.2.3 {usage} -constraints win -returnCodes error -body {
+ # This is the wrong error to output - unix has it right, but it's
+ # not critical.
+ wm attributes . -to
+} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
+test wm-attributes-1.2.4 {usage} -constraints {unix notAqua} -returnCodes error -body {
+ wm attributes . _
+} -result {bad attribute "_": must be -alpha, -topmost, -zoomed, -fullscreen, or -type}
+test wm-attributes-1.2.5 {usage} -constraints aqua -returnCodes error -body {
+ wm attributes . _
+} -result {bad attribute "_": must be -alpha, -modified, -notify, or -titlepath}
+
+
+### wm client ###
+test wm-client-1.1 {usage} -returnCodes error -body {
+ wm client
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-client-1.2 {usage} -returnCodes error -body {
+ wm client . _ _
+} -result {wrong # args: should be "wm client window ?name?"}
+
+test wm-client-2.1 {setting and reading values} -setup {
+ set result {}
+} -body {
+ lappend result [wm client .t]
+ wm client .t Miffo
+ lappend result [wm client .t]
+ wm client .t {}
+ lappend result [wm client .t]
+} -result [list {} Miffo {}]
-test wm-attributes-1.2.1 {usage} {pcOnly} {
- list [catch {wm attributes . _} err] $err
-} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}}
+deleteWindows
-test wm-attributes-1.2.2 {usage} {pcOnly} {
- list [catch {wm attributes . -alpha 1.0 -disabled} err] $err
-} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}}
+test wm-attributes-1.3.0 {default -fullscreen value} -constraints win -body {
+ toplevel .t
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 0
+test wm-attributes-1.3.1 {change -fullscreen before map} -constraints win -body {
+ toplevel .t
+ wm attributes .t -fullscreen 1
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 1
+test wm-attributes-1.3.2 {change -fullscreen before map} -constraints win -body {
+ toplevel .t
+ wm attributes .t -fullscreen 1
+ update
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 1
+test wm-attributes-1.3.3 {change -fullscreen after map} -constraints win -body {
+ toplevel .t
+ update
+ wm attributes .t -fullscreen 1
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 1
+test wm-attributes-1.3.4 {change -fullscreen after map} -setup {
+ set booleans [list]
+} -constraints win -body {
+ toplevel .t
+ update
+ lappend booleans [wm attributes .t -fullscreen]
+ wm attributes .t -fullscreen 1
+ lappend booleans [wm attributes .t -fullscreen]
+ # Query above should not clear fullscreen state
+ lappend booleans [wm attributes .t -fullscreen]
+ wm attributes .t -fullscreen 0
+ lappend booleans [wm attributes .t -fullscreen]
+} -cleanup {
+ deleteWindows
+} -result {0 1 1 0}
+test wm-attributes-1.3.5 {change -fullscreen after map} -setup {
+ set results [list]
+ set normal_geom "301x302+101+102"
+ set fullscreen_geom "[winfo screenwidth .]x[winfo screenheight .]+0+0"
+} -constraints win -body {
+ toplevel .t
+ wm geom .t $normal_geom
+ update
+ lappend results [string equal [wm geom .t] $normal_geom]
+ wm attributes .t -fullscreen 1
+ lappend results [string equal [wm geom .t] $fullscreen_geom]
+ wm attributes .t -fullscreen 0
+ lappend results [string equal [wm geom .t] $normal_geom]
+} -cleanup {
+ deleteWindows
+} -result {1 1 1}
+test wm-attributes-1.3.6 {state change does not change -fullscreen} -constraints win -body {
+ toplevel .t
+ update
+ wm attributes .t -fullscreen 1
+ wm withdraw .t
+ wm deiconify .t
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 1
+test wm-attributes-1.3.7 {state change does not change -fullscreen} -constraints win -body {
+ toplevel .t
+ update
+ wm attributes .t -fullscreen 1
+ wm iconify .t
+ wm deiconify .t
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 1
+test wm-attributes-1.3.8 {override-redirect not compatible with fullscreen attribute} -constraints win -body {
+ toplevel .t
+ update
+ wm overrideredirect .t 1
+ wm attributes .t -fullscreen 1
+} -returnCodes error -cleanup {
+ deleteWindows
+} -result {can't set fullscreen attribute for ".t": override-redirect flag is set}
+test wm-attributes-1.3.9 {max height too small} -constraints win -body {
+ toplevel .t
+ update
+ wm maxsize .t 5000 450
+ wm attributes .t -fullscreen 1
+} -returnCodes error -cleanup {
+ deleteWindows
+} -result {can't set fullscreen attribute for ".t": max width/height is too small}
+test wm-attributes-1.3.10 {max height too small} -constraints win -body {
+ toplevel .t
+ update
+ wm maxsize .t 450 5000
+ wm attributes .t -fullscreen 1
+} -returnCodes error -cleanup {
+ deleteWindows
+} -result {can't set fullscreen attribute for ".t": max width/height is too small}
+test wm-attributes-1.3.11 {another attribute, then -fullscreen} -constraints win -body {
+ toplevel .t
+ update
+ wm attributes .t -alpha 1.0 -fullscreen 1
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 1
+test wm-attributes-1.3.12 {another attribute, then -fullscreen, then another} -constraints win -body {
+ toplevel .t
+ update
+ wm attributes .t -toolwindow 0 -fullscreen 1 -topmost 0
+ wm attributes .t -fullscreen
+} -cleanup {
+ deleteWindows
+} -result 1
-test wm-attributes-1.2.3 {usage} {pcOnly} {
- list [catch {wm attributes . -to} err] $err
-} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}}
+test wm-attributes-1.4.0 {setting/unsetting fullscreen does not change the focus} -setup {
+ set results [list]
+} -constraints win -body {
+ focus -force .
+ toplevel .t
+ lower .t
+ update
+ lappend results [focus]
-test wm-attributes-1.2.4 {usage} {macOrUnix notAqua} {
- list [catch {wm attributes . _} err] $err
-} {1 {wrong # args: should be "wm attributes window ?-type list?"}}
+ wm attributes .t -fullscreen 1
+ eventDelay
+ lappend results [focus]
-test wm-attributes-1.2.5 {usage} {aqua} {
- list [catch {wm attributes . _} err] $err
-} {1 {bad attribute "_": must be -alpha, -modified, or -titlepath}}
+ wm attributes .t -fullscreen 0
+ eventDelay
+ lappend results [focus]
+} -cleanup {
+ deleteWindows
+} -result {. . .}
+test wm-attributes-1.4.1 {setting fullscreen does not generate FocusIn on wrapper create} -setup {
+ catch {unset focusin}
+} -constraints win -body {
+ focus -force .
+ toplevel .t
+ pack [entry .t.e]
+ lower .t
+ bind .t <FocusIn> {lappend focusin %W}
+ eventDelay
-test wm-client-1.1 {usage} {
- list [catch {wm client} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+ lappend focusin 1
+ focus -force .t.e
+ eventDelay
-test wm-client-1.2 {usage} {
- list [catch {wm client . _ _} err] $err
-} {1 {wrong # args: should be "wm client window ?name?"}}
+ lappend focusin 2
+ wm attributes .t -fullscreen 1
+ eventDelay
-test wm-client-2.1 {setting and reading values} {
- set result {}
- lappend result [wm client .t]
- wm client .t Miffo
- lappend result [wm client .t]
- wm client .t {}
- lappend result [wm client .t]
-} [list {} Miffo {}]
+ lappend focusin 3
+ wm attributes .t -fullscreen 0
+ eventDelay
+ lappend focusin final [focus]
+} -cleanup {
+ bind . <FocusIn> {}
+ bind .t <FocusIn> {}
+ deleteWindows
+} -result {1 .t .t.e 2 3 final .t.e}
-test wm-colormapwindows-1.1 {usage} {
- list [catch {wm colormapwindows} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+test wm-attributes-1.5.0 {fullscreen stackorder} -setup {
+ set results [list]
+} -constraints win -body {
+ toplevel .t
+ lappend results [wm stackorder .]
+ eventDelay
+ lappend results [wm stackorder .]
+
+ # Default stacking is on top of other windows on the display. Setting the
+ # fullscreen attribute does not change this.
+ wm attributes .t -fullscreen 1
+ eventDelay
+ lappend results [wm stackorder .]
+} -cleanup {
+ deleteWindows
+} -result {. {. .t} {. .t}}
+test wm-attributes-1.5.1 {fullscreen stackorder} -setup {
+ set results [list]
+} -constraints win -body {
+ toplevel .t
+ lower .t
+ eventDelay
+ lappend results [wm stackorder .]
+
+ # If stacking order is explicitly set, then setting the fullscreen
+ # attribute should not change it.
+ wm attributes .t -fullscreen 1
+ eventDelay
+ lappend results [wm stackorder .]
+} -cleanup {
+ deleteWindows
+} -result {{.t .} {.t .}}
+test wm-attributes-1.5.2 {fullscreen stackorder} -setup {
+ set results [list]
+} -constraints win -body {
+ toplevel .t
+ # lower forces the window to be mapped, it would not be otherwise
+ lower .t
+ lappend results [wm stackorder .]
+
+ # If stacking order is explicitly set for an unmapped window, then setting
+ # the fullscreen attribute should not change it.
+ wm attributes .t -fullscreen 1
+ eventDelay
+ lappend results [wm stackorder .]
+} -cleanup {
+ deleteWindows
+} -result {{.t .} {.t .}}
+test wm-attributes-1.5.3 {fullscreen stackorder} -setup {
+ set results [list]
+} -constraints win -body {
+ toplevel .t
+ eventDelay
+ lappend results [wm stackorder .]
+
+ wm attributes .t -fullscreen 1
+ eventDelay
+ lappend results [wm stackorder .]
+
+ # Unsetting the fullscreen attribute should not change the stackorder.
+ wm attributes .t -fullscreen 0
+ eventDelay
+ lappend results [wm stackorder .]
+} -cleanup {
+ deleteWindows
+} -result {{. .t} {. .t} {. .t}}
+test wm-attributes-1.5.4 {fullscreen stackorder} -setup {
+ set results [list]
+} -constraints win -body {
+ toplevel .t
+ lower .t
+ eventDelay
+ lappend results [wm stackorder .]
+
+ wm attributes .t -fullscreen 1
+ eventDelay
+ lappend results [wm stackorder .]
+
+ # Unsetting the fullscreen attribute should not change the stackorder.
+ wm attributes .t -fullscreen 0
+ eventDelay
+ lappend results [wm stackorder .]
+} -cleanup {
+ deleteWindows
+} -result {{.t .} {.t .} {.t .}}
+test wm-attributes-1.5.5 {fullscreen stackorder} -setup {
+ set results [list]
+} -constraints win -body {
+ toplevel .a
+ toplevel .b
+ toplevel .c
+ raise .a
+ raise .b
+ raise .c
+ eventDelay
+ lappend results [wm stackorder .]
+
+ wm attributes .b -fullscreen 1
+ eventDelay
+ lappend results [wm stackorder .]
+
+ # Unsetting the fullscreen attribute should not change the stackorder.
+ wm attributes .b -fullscreen 0
+ eventDelay
+ lappend results [wm stackorder .]
+} -cleanup {
+ deleteWindows
+} -result {{. .a .b .c} {. .a .b .c} {. .a .b .c}}
-test wm-colormapwindows-1.2 {usage} {
- list [catch {wm colormapwindows . _ _} err] $err
-} {1 {wrong # args: should be "wm colormapwindows window ?windowList?"}}
-test wm-colormapwindows-1.3 {usage} {
- list [catch {wm colormapwindows . "a \{"} msg] $msg
-} {1 {unmatched open brace in list}}
+stdWindow
-test wm-colormapwindows-1.4 {usage} {
- list [catch {wm colormapwindows . foo} msg] $msg
-} {1 {bad window path name "foo"}}
-test wm-colormapwindows-2.1 {reading values} {
- catch {destroy .t2}
+### wm colormapwindows ###
+test wm-colormapwindows-1.1 {usage} -returnCodes error -body {
+ wm colormapwindows
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-colormapwindows-1.2 {usage} -returnCodes error -body {
+ wm colormapwindows . _ _
+} -result {wrong # args: should be "wm colormapwindows window ?windowList?"}
+test wm-colormapwindows-1.3 {usage} -returnCodes error -body {
+ wm colormapwindows . "a \{"
+} -result {unmatched open brace in list}
+test wm-colormapwindows-1.4 {usage} -returnCodes error -body {
+ wm colormapwindows . foo
+} -result {bad window path name "foo"}
+
+test wm-colormapwindows-2.1 {reading values} -body {
toplevel .t2 -width 200 -height 200 -colormap new
wm geom .t2 +0+0
frame .t2.a -width 100 -height 30
@@ -195,10 +471,10 @@ test wm-colormapwindows-2.1 {reading values} {
pack .t2.c -side top
update
list $x [wm colormapwindows .t2]
-} {{.t2.b .t2} {.t2.b .t2.c .t2}}
-
-test wm-colormapwindows-2.2 {setting and reading values} {
- catch {destroy .t2}
+} -cleanup {
+ destroy .t2
+} -result {{.t2.b .t2} {.t2.b .t2.c .t2}}
+test wm-colormapwindows-2.2 {setting and reading values} -body {
toplevel .t2 -width 200 -height 200
wm geom .t2 +0+0
frame .t2.a -width 100 -height 30
@@ -207,84 +483,97 @@ test wm-colormapwindows-2.2 {setting and reading values} {
pack .t2.a .t2.b .t2.c -side top
wm colormapwindows .t2 {.t2.b .t2.a}
wm colormapwindows .t2
-} {.t2.b .t2.a}
-
-
-test wm-command-1.1 {usage} {
- list [catch {wm command} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+} -cleanup {
+ destroy .t2
+} -result {.t2.b .t2.a}
-test wm-command-1.2 {usage} {
- list [catch {wm command . _ _} err] $err
-} {1 {wrong # args: should be "wm command window ?value?"}}
-test wm-command-1.3 {usage} {
- list [catch {wm command . "a \{"} msg] $msg
-} {1 {unmatched open brace in list}}
+### wm command ###
+test wm-command-1.1 {usage} -returnCodes error -body {
+ wm command
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-command-1.2 {usage} -returnCodes error -body {
+ wm command . _ _
+} -result {wrong # args: should be "wm command window ?value?"}
+test wm-command-1.3 {usage} -returnCodes error -body {
+ wm command . "a \{"
+} -result {unmatched open brace in list}
-test wm-command-2.1 {setting and reading values} {
+test wm-command-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm command .t]
wm command .t [list Miffo Foo]
lappend result [wm command .t]
wm command .t {}
lappend result [wm command .t]
-} [list {} [list Miffo Foo] {}]
-
-
-test wm-deiconify-1.1 {usage} {
- list [catch {wm deiconify} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-deiconify-1.2 {usage} {
- list [catch {wm deiconify . _} err] $err
-} {1 {wrong # args: should be "wm deiconify window"}}
-
-test wm-deiconify-1.3 {usage} {
- list [catch {wm deiconify _} err] $err
-} {1 {bad window path name "_"}}
-
-test wm-deiconify-1.4 {usage} {
- catch {destroy .icon}
+} -result [list {} [list Miffo Foo] {}]
+
+
+### wm deiconify ###
+test wm-deiconify-1.1 {usage} -returnCodes error -body {
+ wm deiconify
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-deiconify-1.2 {usage} -returnCodes error -body {
+ wm deiconify . _
+} -result {wrong # args: should be "wm deiconify window"}
+test wm-deiconify-1.3 {usage} -returnCodes error -body {
+ wm deiconify _
+} -result {bad window path name "_"}
+test wm-deiconify-1.4 {usage} -setup {
+ destroy .icon
+} -body {
toplevel .icon -width 50 -height 50 -bg red
wm iconwindow .t .icon
- set result [list [catch {wm deiconify .icon} msg] $msg]
+ wm deiconify .icon
+} -returnCodes error -cleanup {
destroy .icon
- set result
-} {1 {can't deiconify .icon: it is an icon for .t}}
-
-test wm-deiconify-1.5 {usage} {
- catch {destroy .embed}
+} -result {can't deiconify .icon: it is an icon for .t}
+# test embedded window for Windows
+test wm-deiconify-1.5 {usage} -constraints win -setup {
+ destroy .embed
+} -body {
+ frame .t.f -container 1
+ toplevel .embed -use [winfo id .t.f]
+ wm deiconify .embed
+} -returnCodes error -cleanup {
+ destroy .t.f .embed
+} -result {can't deiconify .embed: the container does not support the request}
+# test embedded window for other platforms
+test wm-deiconify-1.6 {usage} -constraints !win -setup {
+ destroy .embed
+} -body {
frame .t.f -container 1
toplevel .embed -use [winfo id .t.f]
- set result [list [catch {wm deiconify .embed} msg] $msg]
+ wm deiconify .embed
+} -returnCodes error -cleanup {
destroy .t.f .embed
- set result
-} {1 {can't deiconify .embed: it is an embedded window}}
+} -result {can't deiconify .embed: it is an embedded window}
-test wm-deiconify-2.1 {a window that has never been mapped
- should not be mapped by a call to deiconify} {
- deleteWindows
+deleteWindows
+test wm-deiconify-2.1 {a window that has never been mapped\
+ should not be mapped by a call to deiconify} -body {
toplevel .t
wm deiconify .t
winfo ismapped .t
-} 0
-
-test wm-deiconify-2.2 {a window that has already been
- mapped should be mapped by deiconify} {
+} -cleanup {
deleteWindows
+} -result 0
+test wm-deiconify-2.2 {a window that has already been\
+ mapped should be mapped by deiconify} -body {
toplevel .t
update idletasks
wm withdraw .t
wm deiconify .t
winfo ismapped .t
-} 1
-
-test wm-deiconify-2.3 {geometry for an unmapped window
- should not be calculated by a call to deiconify,
- it should be done at idle time} {
+} -cleanup {
deleteWindows
+} -result 1
+test wm-deiconify-2.3 {geometry for an unmapped window\
+ should not be calculated by a call to deiconify,\
+ it should be done at idle time} -setup {
set results {}
+} -body {
toplevel .t -width 200 -height 200
lappend results [wm geometry .t]
wm deiconify .t
@@ -292,235 +581,231 @@ test wm-deiconify-2.3 {geometry for an unmapped window
update idletasks
lappend results [lindex [split \
[wm geometry .t] +] 0]
-} {1x1+0+0 1x1+0+0 200x200}
-
-test wm-deiconify-2.4 {invoking destroy after a deiconify
- should not result in a crash because of a callback
- set on the toplevel} {
+} -cleanup {
deleteWindows
+} -result {1x1+0+0 1x1+0+0 200x200}
+test wm-deiconify-2.4 {invoking destroy after a deiconify\
+ should not result in a crash because of a callback\
+ set on the toplevel} -body {
toplevel .t
wm withdraw .t
wm deiconify .t
destroy .t
update
-} {}
-
-
-test wm-focusmodel-1.1 {usage} {
- list [catch {wm focusmodel} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+} -cleanup {
+ deleteWindows
+}
-test wm-focusmodel-1.2 {usage} {
- list [catch {wm focusmodel . _ _} err] $err
-} {1 {wrong # args: should be "wm focusmodel window ?active|passive?"}}
-test wm-focusmodel-1.3 {usage} {
- list [catch {wm focusmodel . bogus} msg] $msg
-} {1 {bad argument "bogus": must be active or passive}}
+### wm focusmodel ###
+test wm-focusmodel-1.1 {usage} -returnCodes error -body {
+ wm focusmodel
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-focusmodel-1.2 {usage} -returnCodes error -body {
+ wm focusmodel . _ _
+} -result {wrong # args: should be "wm focusmodel window ?active|passive?"}
+test wm-focusmodel-1.3 {usage} -returnCodes error -body {
+ wm focusmodel . bogus
+} -result {bad argument "bogus": must be active or passive}
stdWindow
-test wm-focusmodel-2.1 {setting and reading values} {
- set result {}
+test wm-focusmodel-2.1 {setting and reading values} -setup {
+ set result {}
+} -body {
lappend result [wm focusmodel .t]
wm focusmodel .t active
lappend result [wm focusmodel .t]
wm focusmodel .t passive
lappend result [wm focusmodel .t]
- set result
-} {passive active passive}
-
-
-test wm-frame-1.1 {usage} {
- list [catch {wm frame} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-frame-1.2 {usage} {
- list [catch {wm frame . _} err] $err
-} {1 {wrong # args: should be "wm frame window"}}
-
-
-test wm-geometry-1.1 {usage} {
- list [catch {wm geometry} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-geometry-1.2 {usage} {
- list [catch {wm geometry . _ _} err] $err
-} {1 {wrong # args: should be "wm geometry window ?newGeometry?"}}
-
-test wm-geometry-1.3 {usage} {
- list [catch {wm geometry . bogus} msg] $msg
-} {1 {bad geometry specifier "bogus"}}
-
-test wm-geometry-2.1 {setting values} {
+} -result {passive active passive}
+
+
+### wm frame ###
+test wm-frame-1.1 {usage} -returnCodes error -body {
+ wm frame
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-frame-1.2 {usage} -returnCodes error -body {
+ wm frame . _
+} -result {wrong # args: should be "wm frame window"}
+
+
+### wm geometry ###
+test wm-geometry-1.1 {usage} -returnCodes error -body {
+ wm geometry
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-geometry-1.2 {usage} -returnCodes error -body {
+ wm geometry . _ _
+} -result {wrong # args: should be "wm geometry window ?newGeometry?"}
+test wm-geometry-1.3 {usage} -returnCodes error -body {
+ wm geometry . bogus
+} -result {bad geometry specifier "bogus"}
+
+test wm-geometry-2.1 {setting values} -setup {
set result {}
+} -body {
wm geometry .t 150x150+50+50
update
lappend result [wm geometry .t]
wm geometry .t {}
update
lappend result [string equal [wm geometry .t] "150x150+50+50"]
-} [list 150x150+50+50 0]
-
-
-test wm-grid-1.1 {usage} {
- list [catch {wm grid} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-grid-1.2 {usage} {
- list [catch {wm grid . _} err] $err
-} {1 {wrong # args: should be "wm grid window ?baseWidth baseHeight widthInc heightInc?"}}
-
-test wm-grid-1.3 {usage} {
- list [catch {wm grid . _ _ _} err] $err
-} {1 {wrong # args: should be "wm grid window ?baseWidth baseHeight widthInc heightInc?"}}
-
-test wm-grid-1.4 {usage} {
- list [catch {wm grid . _ _ _ _ _} err] $err
-} {1 {wrong # args: should be "wm grid window ?baseWidth baseHeight widthInc heightInc?"}}
-
-test wm-grid-1.5 {usage} {
- list [catch {wm grid . bad 14 15 16} msg] $msg
-} {1 {expected integer but got "bad"}}
-
-test wm-grid-1.6 {usage} {
- list [catch {wm grid . 13 foo 15 16} msg] $msg
-} {1 {expected integer but got "foo"}}
-
-test wm-grid-1.7 {usage} {
- list [catch {wm grid . 13 14 bar 16} msg] $msg
-} {1 {expected integer but got "bar"}}
-
-test wm-grid-1.8 {usage} {
- list [catch {wm grid . 13 14 15 baz} msg] $msg
-} {1 {expected integer but got "baz"}}
-
-test wm-grid-1.9 {usage} {
- list [catch {wm grid . -1 14 15 16} msg] $msg
-} {1 {baseWidth can't be < 0}}
-
-test wm-grid-1.10 {usage} {
- list [catch {wm grid . 13 -1 15 16} msg] $msg
-} {1 {baseHeight can't be < 0}}
-
-test wm-grid-1.11 {usage} {
- list [catch {wm grid . 13 14 -1 16} msg] $msg
-} {1 {widthInc can't be <= 0}}
-
-test wm-grid-1.12 {usage} {
- list [catch {wm grid . 13 14 15 -1} msg] $msg
-} {1 {heightInc can't be <= 0}}
-
-test wm-grid-2.1 {setting and reading values} {
+} -result [list 150x150+50+50 0]
+
+
+### wm grid ###
+test wm-grid-1.1 {usage} -returnCodes error -body {
+ wm grid
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-grid-1.2 {usage} -returnCodes error -body {
+ wm grid . _
+} -result {wrong # args: should be "wm grid window ?baseWidth baseHeight widthInc heightInc?"}
+test wm-grid-1.3 {usage} -returnCodes error -body {
+ wm grid . _ _ _
+} -result {wrong # args: should be "wm grid window ?baseWidth baseHeight widthInc heightInc?"}
+test wm-grid-1.4 {usage} -returnCodes error -body {
+ wm grid . _ _ _ _ _
+} -result {wrong # args: should be "wm grid window ?baseWidth baseHeight widthInc heightInc?"}
+test wm-grid-1.5 {usage} -returnCodes error -body {
+ wm grid . bad 14 15 16
+} -result {expected integer but got "bad"}
+test wm-grid-1.6 {usage} -returnCodes error -body {
+ wm grid . 13 foo 15 16
+} -result {expected integer but got "foo"}
+test wm-grid-1.7 {usage} -returnCodes error -body {
+ wm grid . 13 14 bar 16
+} -result {expected integer but got "bar"}
+test wm-grid-1.8 {usage} -returnCodes error -body {
+ wm grid . 13 14 15 baz
+} -result {expected integer but got "baz"}
+test wm-grid-1.9 {usage} -returnCodes error -body {
+ wm grid . -1 14 15 16
+} -result {baseWidth can't be < 0}
+test wm-grid-1.10 {usage} -returnCodes error -body {
+ wm grid . 13 -1 15 16
+} -result {baseHeight can't be < 0}
+test wm-grid-1.11 {usage} -returnCodes error -body {
+ wm grid . 13 14 -1 16
+} -result {widthInc can't be <= 0}
+test wm-grid-1.12 {usage} -returnCodes error -body {
+ wm grid . 13 14 15 -1
+} -result {heightInc can't be <= 0}
+
+test wm-grid-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm grid .t]
wm grid .t 3 4 10 2
lappend result [wm grid .t]
wm grid .t {} {} {} {}
lappend result [wm grid .t]
-} [list {} {3 4 10 2} {}]
-
-
-test wm-group-1.1 {usage} {
- list [catch {wm group} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+} -result [list {} {3 4 10 2} {}]
-test wm-group-1.2 {usage} {
- list [catch {wm group .t 12 13} msg] $msg
-} {1 {wrong # args: should be "wm group window ?pathName?"}}
-test wm-group-1.3 {usage} {
- list [catch {wm group .t bogus} msg] $msg
-} {1 {bad window path name "bogus"}}
+### wm group ###
+test wm-group-1.1 {usage} -returnCodes error -body {
+ wm group
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-group-1.2 {usage} -returnCodes error -body {
+ wm group .t 12 13
+} -result {wrong # args: should be "wm group window ?pathName?"}
+test wm-group-1.3 {usage} -returnCodes error -body {
+ wm group .t bogus
+} -result {bad window path name "bogus"}
-test wm-group-2.1 {setting and reading values} {
+test wm-group-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm group .t]
wm group .t .
lappend result [wm group .t]
wm group .t {}
lappend result [wm group .t]
-} [list {} . {}]
-
-
-test wm-iconbitmap-1.1 {usage} {
- list [catch {wm iconbitmap} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-iconbitmap-1.2.1 {usage} {macOrUnix} {
- list [catch {wm iconbitmap .t 12 13} msg] $msg
-} {1 {wrong # args: should be "wm iconbitmap window ?bitmap?"}}
-
-test wm-iconbitmap-1.2.2 {usage} {pcOnly} {
- list [catch {wm iconbitmap .t 12 13 14} msg] $msg
-} {1 {wrong # args: should be "wm iconbitmap window ?-default? ?image?"}}
-
-test wm-iconbitmap-1.3 {usage} {pcOnly} {
- list [catch {wm iconbitmap .t 12 13} msg] $msg
-} {1 {illegal option "12" must be "-default"}}
-
-test wm-iconbitmap-1.4 {usage} {
- list [catch {wm iconbitmap .t bad-bitmap} msg] $msg
-} {1 {bitmap "bad-bitmap" not defined}}
-
-test wm-iconbitmap-2.1 {setting and reading values} {
+} -result [list {} . {}]
+
+
+### wm iconbitmap ###
+test wm-iconbitmap-1.1 {usage} -returnCodes error -body {
+ wm iconbitmap
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-iconbitmap-1.2.1 {usage} -constraints unix -returnCodes error -body {
+ wm iconbitmap .t 12 13
+} -result {wrong # args: should be "wm iconbitmap window ?bitmap?"}
+test wm-iconbitmap-1.2.2 {usage} -constraints win -returnCodes error -body {
+ wm iconbitmap .t 12 13 14
+} -result {wrong # args: should be "wm iconbitmap window ?-default? ?image?"}
+test wm-iconbitmap-1.3 {usage} -constraints win -returnCodes error -body {
+ wm iconbitmap .t 12 13
+} -result {illegal option "12" must be "-default"}
+test wm-iconbitmap-1.4 {usage} -returnCodes error -body {
+ wm iconbitmap .t bad-bitmap
+} -result {bitmap "bad-bitmap" not defined}
+
+test wm-iconbitmap-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm iconbitmap .t]
wm iconbitmap .t hourglass
lappend result [wm iconbitmap .t]
wm iconbitmap .t {}
lappend result [wm iconbitmap .t]
-} [list {} hourglass {}]
+} -result [list {} hourglass {}]
-test wm-iconify-1.1 {usage} {
- list [catch {wm iconify} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+### wm iconify ###
+test wm-iconify-1.1 {usage} -returnCodes error -body {
+ wm iconify
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-iconify-1.2 {usage} -returnCodes error -body {
+ wm iconify .t _
+} -result {wrong # args: should be "wm iconify window"}
-test wm-iconify-1.2 {usage} {
- list [catch {wm iconify .t _} msg] $msg
-} {1 {wrong # args: should be "wm iconify window"}}
-
-test wm-iconify-2.1 {Misc errors} {
- catch {destroy .t2}
+destroy .t2
+test wm-iconify-2.1 {Misc errors} -body {
toplevel .t2
wm overrideredirect .t2 1
- set result [list [catch {wm iconify .t2} msg] $msg]
+ wm iconify .t2
+} -returnCodes error -cleanup {
destroy .t2
- set result
-} {1 {can't iconify ".t2": override-redirect flag is set}}
-
-test wm-iconify-2.2 {Misc errors} {
- catch {destroy .t2}
+} -result {can't iconify ".t2": override-redirect flag is set}
+test wm-iconify-2.2 {Misc errors} -body {
toplevel .t2
wm geom .t2 +0+0
wm transient .t2 .t
- set result [list [catch {wm iconify .t2} msg] $msg]
+ wm iconify .t2
+} -returnCodes error -cleanup {
destroy .t2
- set result
-} {1 {can't iconify ".t2": it is a transient}}
-
-test wm-iconify-2.3 {Misc errors} {
- catch {destroy .t2}
+} -result {can't iconify ".t2": it is a transient}
+test wm-iconify-2.3 {Misc errors} -body {
toplevel .t2
wm geom .t2 +0+0
wm iconwindow .t .t2
- set result [list [catch {wm iconify .t2} msg] $msg]
+ wm iconify .t2
+} -returnCodes error -cleanup {
destroy .t2
- set result
-} {1 {can't iconify .t2: it is an icon for .t}}
-
-test wm-iconify-2.4 {Misc errors} {
- catch {destroy .t2}
+} -result {can't iconify .t2: it is an icon for .t}
+# test embedded window for Windows
+test wm-iconify-2.4.1 {Misc errors} -constraints win -setup {
+ destroy .t2
+} -body {
frame .t.f -container 1
toplevel .t2 -use [winfo id .t.f]
- set result [list [catch {wm iconify .t2} msg] $msg]
+ wm iconify .t2
+} -returnCodes error -cleanup {
destroy .t2 .r.f
- set result
-} {1 {can't iconify .t2: it is an embedded window}}
+} -result {can't iconify .t2: the container does not support the request}
+# test embedded window for other platforms
+test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup {
+ destroy .t2
+} -body {
+ frame .t.f -container 1
+ toplevel .t2 -use [winfo id .t.f]
+ wm iconify .t2
+} -returnCodes error -cleanup {
+ destroy .t2 .r.f
+} -result {can't iconify .t2: it is an embedded window}
-test wm-iconify-3.1 {} {
- catch {destroy .t2}
+test wm-iconify-3.1 {iconify behavior} -body {
toplevel .t2
wm geom .t2 -0+0
update
@@ -528,308 +813,433 @@ test wm-iconify-3.1 {} {
wm iconify .t2
update
lappend result [winfo ismapped .t2]
+} -cleanup {
destroy .t2
- set result
-} {1 0}
-
+} -result {1 0}
-test wm-iconmask-1.1 {usage} {
- list [catch {wm iconmask} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-test wm-iconmask-1.2 {usage} {
- list [catch {wm iconmask .t 12 13} msg] $msg
-} {1 {wrong # args: should be "wm iconmask window ?bitmap?"}}
+### wm iconmask ###
+test wm-iconmask-1.1 {usage} -returnCodes error -body {
+ wm iconmask
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-iconmask-1.2 {usage} -returnCodes error -body {
+ wm iconmask .t 12 13
+} -result {wrong # args: should be "wm iconmask window ?bitmap?"}
+test wm-iconmask-1.3 {usage} -returnCodes error -body {
+ wm iconmask .t bad-bitmap
+} -result {bitmap "bad-bitmap" not defined}
-test wm-iconmask-1.3 {usage} {
- list [catch {wm iconmask .t bad-bitmap} msg] $msg
-} {1 {bitmap "bad-bitmap" not defined}}
-
-test wm-iconmask-2.1 {setting and reading values} {
+test wm-iconmask-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm iconmask .t]
wm iconmask .t hourglass
lappend result [wm iconmask .t]
wm iconmask .t {}
lappend result [wm iconmask .t]
-} [list {} hourglass {}]
-
+} -result [list {} hourglass {}]
-test wm-iconname-1.1 {usage} {
- list [catch {wm iconname} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-test wm-iconname-1.2 {usage} {
- list [catch {wm iconname .t 12 13} msg] $msg
-} {1 {wrong # args: should be "wm iconname window ?newName?"}}
+### wm iconname ###
+test wm-iconname-1.1 {usage} -returnCodes error -body {
+ wm iconname
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-iconname-1.2 {usage} -returnCodes error -body {
+ wm iconname .t 12 13
+} -result {wrong # args: should be "wm iconname window ?newName?"}
-test wm-iconname-2.1 {setting and reading values} {
+test wm-iconname-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm iconname .t]
wm iconname .t ThisIconHasAName
lappend result [wm iconname .t]
wm iconname .t {}
lappend result [wm iconname .t]
-} [list {} ThisIconHasAName {}]
-
-
-test wm-iconphoto-1.1 {usage} {
- list [catch {wm iconphoto} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-iconphoto-1.2 {usage} {
- list [catch {wm iconphoto .} msg] $msg
-} {1 {wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"}}
-test wm-iconphoto-1.3 {usage} {
- list [catch {wm iconphoto . notanimage} msg] $msg
-} {1 {can't use "notanimage" as iconphoto: not a photo image}}
-test wm-iconphoto-1.4 {usage} {
+} -result [list {} ThisIconHasAName {}]
+
+
+### wm iconphoto ###
+test wm-iconphoto-1.1 {usage} -returnCodes error -body {
+ wm iconphoto
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-iconphoto-1.2 {usage} -returnCodes error -body {
+ wm iconphoto .
+} -result {wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"}
+test wm-iconphoto-1.3 {usage} -returnCodes error -body {
+ wm iconphoto . notanimage
+} -result {can't use "notanimage" as iconphoto: not a photo image}
+test wm-iconphoto-1.4 {usage} -returnCodes error -body {
# we currently have no return info
- list [catch {wm iconphoto . -default} msg] $msg
-} {1 {wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"}}
+ wm iconphoto . -default
+} -result {wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"}
# All other iconphoto tests are platform specific
-test wm-iconposition-1.1 {usage} {
- list [catch {wm iconposition} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-iconposition-1.2 {usage} {
- list [catch {wm iconposition .t 12} msg] $msg
-} {1 {wrong # args: should be "wm iconposition window ?x y?"}}
-
-test wm-iconposition-1.3 {usage} {
- list [catch {wm iconposition .t 12 13 14} msg] $msg
-} {1 {wrong # args: should be "wm iconposition window ?x y?"}}
-
-test wm-iconposition-1.4 {usage} {
- list [catch {wm iconposition .t bad 13} msg] $msg
-} {1 {expected integer but got "bad"}}
-test wm-iconposition-1.5 {usage} {
- list [catch {wm iconposition .t 13 lousy} msg] $msg
-} {1 {expected integer but got "lousy"}}
-
-test wm-iconposition-2.1 {setting and reading values} {
+### wm iconposition ###
+test wm-iconposition-1.1 {usage} -returnCodes error -body {
+ wm iconposition
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-iconposition-1.2 {usage} -returnCodes error -body {
+ wm iconposition .t 12
+} -result {wrong # args: should be "wm iconposition window ?x y?"}
+test wm-iconposition-1.3 {usage} -returnCodes error -body {
+ wm iconposition .t 12 13 14
+} -result {wrong # args: should be "wm iconposition window ?x y?"}
+test wm-iconposition-1.4 {usage} -returnCodes error -body {
+ wm iconposition .t bad 13
+} -result {expected integer but got "bad"}
+test wm-iconposition-1.5 {usage} -returnCodes error -body {
+ wm iconposition .t 13 lousy
+} -result {expected integer but got "lousy"}
+
+test wm-iconposition-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm iconposition .t]
wm iconposition .t 10 20
lappend result [wm iconposition .t]
wm iconposition .t {} {}
lappend result [wm iconposition .t]
-} [list {} {10 20} {}]
-
-
-test wm-iconwindow-1.1 {usage} {
- list [catch {wm iconwindow} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-iconwindow-1.2 {usage} {
- list [catch {wm iconwindow .t 12 13} msg] $msg
-} {1 {wrong # args: should be "wm iconwindow window ?pathName?"}}
-
-test wm-iconwindow-1.3 {usage} {
- list [catch {wm iconwindow .t bogus} msg] $msg
-} {1 {bad window path name "bogus"}}
-
-test wm-iconwindow-1.4 {usage} {
- catch {destroy .b}
+} -result [list {} {10 20} {}]
+
+
+### wm iconwindow ###
+test wm-iconwindow-1.1 {usage} -returnCodes error -body {
+ wm iconwindow
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-iconwindow-1.2 {usage} -returnCodes error -body {
+ wm iconwindow .t 12 13
+} -result {wrong # args: should be "wm iconwindow window ?pathName?"}
+test wm-iconwindow-1.3 {usage} -returnCodes error -body {
+ wm iconwindow .t bogus
+} -result {bad window path name "bogus"}
+test wm-iconwindow-1.4 {usage} -setup {
+ destroy .b
+} -body {
button .b -text Help
- set result [list [catch {wm iconwindow .t .b} msg] $msg]
+ wm iconwindow .t .b
+} -returnCodes error -cleanup {
destroy .b
- set result
-} {1 {can't use .b as icon window: not at top level}}
-
-test wm-iconwindow-1.5 {usage} {
- catch {destroy .icon}
+} -result {can't use .b as icon window: not at top level}
+test wm-iconwindow-1.5 {usage} -setup {
+ destroy .icon .t2
+} -body {
toplevel .icon -width 50 -height 50 -bg green
- catch {destroy .t2}
toplevel .t2
wm geom .t2 -0+0
wm iconwindow .t2 .icon
- set result [list [catch {wm iconwindow .t .icon} msg] $msg]
- destroy .t2
- destroy .icon
- set result
-} {1 {.icon is already an icon for .t2}}
+ wm iconwindow .t .icon
+} -returnCodes error -cleanup {
+ destroy .t2 .icon
+} -result {.icon is already an icon for .t2}
-test wm-iconwindow-2.1 {setting and reading values} {
+test wm-iconwindow-2.1 {setting and reading values} -setup {
+ destroy .icon
set result {}
+} -body {
lappend result [wm iconwindow .t]
- catch {destroy .icon}
toplevel .icon -width 50 -height 50 -bg green
wm iconwindow .t .icon
lappend result [wm iconwindow .t]
wm iconwindow .t {}
destroy .icon
lappend result [wm iconwindow .t]
-} [list {} .icon {}]
-
-
-test wm-maxsize-1.1 {usage} {
- list [catch {wm maxsize} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-maxsize-1.2 {usage} {
- list [catch {wm maxsize . a} msg] $msg
-} {1 {wrong # args: should be "wm maxsize window ?width height?"}}
-
-test wm-maxsize-1.3 {usage} {
- list [catch {wm maxsize . a b c} msg] $msg
-} {1 {wrong # args: should be "wm maxsize window ?width height?"}}
-
-test wm-maxsize-1.4 {usage} {
- list [catch {wm maxsize . x 100} msg] $msg
-} {1 {expected integer but got "x"}}
-
-test wm-maxsize-1.5 {usage} {
- list [catch {wm maxsize . 100 bogus} msg] $msg
-} {1 {expected integer but got "bogus"}}
-
-test wm-maxsize-1.6 {usage} {
- catch {destroy .t2}
+} -result {{} .icon {}}
+
+
+### wm maxsize ###
+test wm-maxsize-1.1 {usage} -returnCodes error -body {
+ wm maxsize
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-maxsize-1.2 {usage} -returnCodes error -body {
+ wm maxsize . a
+} -result {wrong # args: should be "wm maxsize window ?width height?"}
+test wm-maxsize-1.3 {usage} -returnCodes error -body {
+ wm maxsize . a b c
+} -result {wrong # args: should be "wm maxsize window ?width height?"}
+test wm-maxsize-1.4 {usage} -returnCodes error -body {
+ wm maxsize . x 100
+} -result {expected integer but got "x"}
+test wm-maxsize-1.5 {usage} -returnCodes error -body {
+ wm maxsize . 100 bogus
+} -result {expected integer but got "bogus"}
+test wm-maxsize-1.6 {usage} -setup {
+ destroy .t2
+} -body {
toplevel .t2
- wm maxsize .t2 200 150
- set result [wm maxsize .t2]
+ wm maxsize .t2 300 200
+ wm maxsize .t2
+} -cleanup {
destroy .t2
- set result
-} {200 150}
-
-
-test wm-minsize-1.1 {usage} {
- list [catch {wm minsize} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-minsize-1.2 {usage} {
- list [catch {wm minsize . a} msg] $msg
-} {1 {wrong # args: should be "wm minsize window ?width height?"}}
-
-test wm-minsize-1.3 {usage} {
- list [catch {wm minsize . a b c} msg] $msg
-} {1 {wrong # args: should be "wm minsize window ?width height?"}}
-
-test wm-minsize-1.4 {usage} {
- list [catch {wm minsize . x 100} msg] $msg
-} {1 {expected integer but got "x"}}
-
-test wm-minsize-1.5 {usage} {
- list [catch {wm minsize . 100 bogus} msg] $msg
-} {1 {expected integer but got "bogus"}}
+} -result {300 200}
+test wm-maxsize-1.7 {maxsize must be <= screen size} -setup {
+ destroy .t
+} -body {
+ toplevel .t
+ lassign [wm maxsize .t] t_width t_height
+ set s_width [winfo screenwidth .t]
+ set s_height [winfo screenheight .t]
+ expr {($t_width <= $s_width) && ($t_height <= $s_height)}
+} -cleanup {
+ destroy .t
+} -result 1
-test wm-minsize-1.6 {usage} {
- catch {destroy .t2}
+destroy .t
+test wm-maxsize-2.1 {setting the maxsize to a value smaller\
+ than the current size will resize a toplevel} -body {
+ toplevel .t -width 300 -height 300
+ update
+ wm maxsize .t 200 150
+ # UpdateGeometryInfo invoked at idle
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {200 150}
+test wm-maxsize-2.2 {setting the maxsize to a value smaller\
+ than the current size will resize a gridded toplevel} -body {
+ toplevel .t
+ wm grid .t 0 0 50 50
+ wm geometry .t 6x6
+ update
+ wm maxsize .t 4 3
+ # UpdateGeometryInfo invoked at idle
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {4 3}
+test wm-maxsize-2.3 {attempting to resize to a value\
+ bigger than the current maxsize will set it to the max size} -body {
+ toplevel .t -width 200 -height 200
+ wm maxsize .t 300 250
+ update
+ wm geom .t 400x300
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {300 250}
+test wm-maxsize-2.4 {attempting to resize to a value bigger than the\
+ current maxsize will set it to the max size when gridded} -body {
+ toplevel .t
+ wm grid .t 1 1 50 50
+ wm geom .t 4x4
+ wm maxsize .t 6 5
+ update
+ wm geom .t 8x6
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {6 5}
+test wm-maxsize-2.5 {Use max size if window size is not explicitly set\
+ and the reqWidth/reqHeight are bigger than the max size} -body {
+ toplevel .t
+ pack [frame .t.f -width 400 -height 400]
+ update idletasks
+ set req [list [winfo reqwidth .t] [winfo reqheight .t]]
+ wm maxsize .t 300 300
+ update
+ list $req [lrange [split [wm geom .t] x+] 0 1]
+} -cleanup {
+ destroy .t
+} -result {{400 400} {300 300}}
+
+
+### wm minsize ###
+test wm-minsize-1.1 {usage} -returnCodes error -body {
+ wm minsize
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-minsize-1.2 {usage} -returnCodes error -body {
+ wm minsize . a
+} -result {wrong # args: should be "wm minsize window ?width height?"}
+test wm-minsize-1.3 {usage} -returnCodes error -body {
+ wm minsize . a b c
+} -result {wrong # args: should be "wm minsize window ?width height?"}
+test wm-minsize-1.4 {usage} -returnCodes error -body {
+ wm minsize . x 100
+} -result {expected integer but got "x"}
+test wm-minsize-1.5 {usage} -returnCodes error -body {
+ wm minsize . 100 bogus
+} -result {expected integer but got "bogus"}
+test wm-minsize-1.6 {usage} -setup {
+ destroy .t2
+} -body {
toplevel .t2
- wm minsize .t2 200 150
- set result [wm minsize .t2]
+ wm minsize .t2 300 200
+ wm minsize .t2
+} -cleanup {
destroy .t2
- set result
-} {200 150}
-
-
-test wm-overrideredirect-1.1 {usage} {
- list [catch {wm overrideredirect} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+} -result {300 200}
-test wm-overrideredirect-1.2 {usage} {
- list [catch {wm overrideredirect .t 1 2} msg] $msg
-} {1 {wrong # args: should be "wm overrideredirect window ?boolean?"}}
+test wm-minsize-2.1 {setting the minsize to a value larger\
+ than the current size will resize a toplevel} -body {
+ toplevel .t -width 200 -height 200
+ update
+ wm minsize .t 400 300
+ # UpdateGeometryInfo invoked at idle
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {400 300}
+test wm-minsize-2.2 {setting the minsize to a value larger\
+ than the current size will resize a gridded toplevel} -body {
+ toplevel .t
+ wm grid .t 1 1 50 50
+ wm geom .t 4x4
+ update
+ wm minsize .t 8 8
+ # UpdateGeometryInfo invoked at idle
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {8 8}
+test wm-minsize-2.3 {attempting to resize to a value\
+ smaller than the current minsize will set it to the minsize} -body {
+ toplevel .t -width 400 -height 400
+ wm minsize .t 300 300
+ update
+ wm geom .t 200x200
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {300 300}
+test wm-minsize-2.4 {attempting to resize to a value smaller than the\
+ current minsize will set it to the minsize when gridded} -body {
+ toplevel .t
+ wm grid .t 1 1 50 50
+ wm geom .t 8x8
+ wm minsize .t 6 6
+ update
+ wm geom .t 4x4
+ update
+ lrange [split [wm geom .t] x+] 0 1
+} -cleanup {
+ destroy .t
+} -result {6 6}
+test wm-minsize-2.5 {Use min size if window size is not explicitly set\
+ and the reqWidth/reqHeight are smaller than the min size} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ pack [frame .t.f -width 250 -height 250]
+ update idletasks
+ lappend result [list [winfo reqwidth .t] [winfo reqheight .t]]
+ wm minsize .t 300 300
+ update
+ lappend result [lrange [split [wm geom .t] x+] 0 1]
+} -cleanup {
+ destroy .t
+} -result {{250 250} {300 300}}
-test wm-overrideredirect-1.3 {usage} {
- list [catch {wm overrideredirect .t boo} msg] $msg
-} {1 {expected boolean value but got "boo"}}
+stdWindow
-test wm-overrideredirect-2.1 {setting and reading values} {
+### wm overrideredirect ###
+test wm-overrideredirect-1.1 {usage} -returnCodes error -body {
+ wm overrideredirect
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-overrideredirect-1.2 {usage} -returnCodes error -body {
+ wm overrideredirect .t 1 2
+} -result {wrong # args: should be "wm overrideredirect window ?boolean?"}
+test wm-overrideredirect-1.3 {usage} -returnCodes error -body {
+ wm overrideredirect .t boo
+} -result {expected boolean value but got "boo"}
+
+test wm-overrideredirect-2.1 {setting and reading values} -setup {
set result {}
+} -body {
lappend result [wm overrideredirect .t]
wm overrideredirect .t true
lappend result [wm overrideredirect .t]
wm overrideredirect .t off
lappend result [wm overrideredirect .t]
-} {0 1 0}
-
+} -result {0 1 0}
-test wm-positionfrom-1.1 {usage} {
- list [catch {wm positionfrom} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-test wm-positionfrom-1.2 {usage} {
- list [catch {wm positionfrom .t 1 2} msg] $msg
-} {1 {wrong # args: should be "wm positionfrom window ?user/program?"}}
+### wm positionfrom ###
+test wm-positionfrom-1.1 {usage} -returnCodes error -body {
+ wm positionfrom
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-positionfrom-1.2 {usage} -returnCodes error -body {
+ wm positionfrom .t 1 2
+} -result {wrong # args: should be "wm positionfrom window ?user/program?"}
+test wm-positionfrom-1.3 {usage} -returnCodes error -body {
+ wm positionfrom .t none
+} -result {bad argument "none": must be program or user}
-test wm-positionfrom-1.3 {usage} {
- list [catch {wm positionfrom .t none} msg] $msg
-} {1 {bad argument "none": must be program or user}}
-
-test wm-positionfrom-2.1 {setting and reading values} {
- catch {destroy .t2}
- toplevel .t2
+test wm-positionfrom-2.1 {setting and reading values} -setup {
+ destroy .t2
set result {}
+} -body {
+ toplevel .t2
wm positionfrom .t user
lappend result [wm positionfrom .t]
wm positionfrom .t program
lappend result [wm positionfrom .t]
wm positionfrom .t {}
lappend result [wm positionfrom .t]
+} -cleanup {
destroy .t2
- set result
-} {user program {}}
+} -result {user program {}}
-test wm-protocol-1.1 {usage} {
- list [catch {wm protocol} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+### wm protocol ###
+test wm-protocol-1.1 {usage} -returnCodes error -body {
+ wm protocol
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-protocol-1.2 {usage} -returnCodes error -body {
+ wm protocol .t 1 2 3
+} -result {wrong # args: should be "wm protocol window ?name? ?command?"}
-test wm-protocol-1.2 {usage} {
- list [catch {wm protocol .t 1 2 3} msg] $msg
-} {1 {wrong # args: should be "wm protocol window ?name? ?command?"}}
-
-test wm-protocol-2.1 {setting and reading values} {
+test wm-protocol-2.1 {setting and reading values} -body {
wm protocol .t {foo a} {a b c}
wm protocol .t bar {test script for bar}
- set result [wm protocol .t]
+ wm protocol .t
+} -cleanup {
wm protocol .t {foo a} {}
wm protocol .t bar {}
- set result
-} {bar {foo a}}
-
-test wm-protocol-2.2 {setting and reading values} {
+} -result {bar {foo a}}
+test wm-protocol-2.2 {setting and reading values} -setup {
set result {}
+} -body {
wm protocol .t foo {a b c}
wm protocol .t bar {test script for bar}
lappend result [wm protocol .t foo] [wm protocol .t bar]
wm protocol .t foo {}
wm protocol .t bar {}
lappend result [wm protocol .t foo] [wm protocol .t bar]
-} {{a b c} {test script for bar} {} {}}
-
-test wm-protocol-2.3 {setting and reading values} {
+} -result {{a b c} {test script for bar} {} {}}
+test wm-protocol-2.3 {setting and reading values} -body {
wm protocol .t foo {a b c}
wm protocol .t foo {test script}
- set result [wm protocol .t foo]
+ wm protocol .t foo
+} -cleanup {
wm protocol .t foo {}
- set result
-} {test script}
-
-
-test wm-resizable-1.1 {usage} {
- list [catch {wm resizable} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-resizable-1.2 {usage} {
- list [catch {wm resizable .t 1} msg] $msg
-} {1 {wrong # args: should be "wm resizable window ?width height?"}}
-
-test wm-resizable-1.3 {usage} {
- list [catch {wm resizable .t 1 2 3} msg] $msg
-} {1 {wrong # args: should be "wm resizable window ?width height?"}}
-
-test wm-resizable-1.4 {usage} {
- list [catch {wm resizable .t bad 0} msg] $msg
-} {1 {expected boolean value but got "bad"}}
-
-test wm-resizable-1.5 {usage} {
- list [catch {wm resizable .t 1 bad} msg] $msg
-} {1 {expected boolean value but got "bad"}}
+} -result {test script}
+
+
+### wm resizable ###
+test wm-resizable-1.1 {usage} -returnCodes error -body {
+ wm resizable
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-resizable-1.2 {usage} -returnCodes error -body {
+ wm resizable .t 1
+} -result {wrong # args: should be "wm resizable window ?width height?"}
+test wm-resizable-1.3 {usage} -returnCodes error -body {
+ wm resizable .t 1 2 3
+} -result {wrong # args: should be "wm resizable window ?width height?"}
+test wm-resizable-1.4 {usage} -returnCodes error -body {
+ wm resizable .t bad 0
+} -result {expected boolean value but got "bad"}
+test wm-resizable-1.5 {usage} -returnCodes error -body {
+ wm resizable .t 1 bad
+} -result {expected boolean value but got "bad"}
test wm-resizable-2.1 {setting and reading values} {
wm resizable .t 0 1
@@ -841,17 +1251,16 @@ test wm-resizable-2.1 {setting and reading values} {
} {0 1 {1 0} {1 1}}
-test wm-sizefrom-1.1 {usage} {
- list [catch {wm sizefrom} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-sizefrom-1.2 {usage} {
- list [catch {wm sizefrom .t 1 2} msg] $msg
-} {1 {wrong # args: should be "wm sizefrom window ?user|program?"}}
-
-test wm-sizefrom-1.4 {usage} {
- list [catch {wm sizefrom .t bad} msg] $msg
-} {1 {bad argument "bad": must be program or user}}
+### wm sizefrom ###
+test wm-sizefrom-1.1 {usage} -returnCodes error -body {
+ wm sizefrom
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-sizefrom-1.2 {usage} -returnCodes error -body {
+ wm sizefrom .t 1 2
+} -result {wrong # args: should be "wm sizefrom window ?user|program?"}
+test wm-sizefrom-1.4 {usage} -returnCodes error -body {
+ wm sizefrom .t bad
+} -result {bad argument "bad": must be program or user}
test wm-sizefrom-2.1 {setting and reading values} {
set result [list [wm sizefrom .t]]
@@ -863,250 +1272,236 @@ test wm-sizefrom-2.1 {setting and reading values} {
lappend result [wm sizefrom .t]
} {{} user program {}}
-
-
-test wm-stackorder-1.1 {usage} {
- list [catch {wm stackorder} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-
-test wm-stackorder-1.2 {usage} {
- list [catch {wm stackorder . _} err] $err
-} {1 {wrong # args: should be "wm stackorder window ?isabove|isbelow window?"}}
-
-test wm-stackorder-1.3 {usage} {
- list [catch {wm stackorder . _ _ _} err] $err
-} {1 {wrong # args: should be "wm stackorder window ?isabove|isbelow window?"}}
-
-test wm-stackorder-1.4 {usage} {
- list [catch {wm stackorder . is .} err] $err
-} {1 {ambiguous argument "is": must be isabove or isbelow}}
-
-test wm-stackorder-1.5 {usage} {
- list [catch {wm stackorder _} err] $err
-} {1 {bad window path name "_"}}
-
-test wm-stackorder-1.6 {usage} {
- list [catch {wm stackorder . isabove _} err] $err
-} {1 {bad window path name "_"}}
-
-test wm-stackorder-1.7 {usage} {
- catch {destroy .t}
+destroy .t
+
+### wm stackorder ###
+test wm-stackorder-1.1 {usage} -returnCodes error -body {
+ wm stackorder
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-stackorder-1.2 {usage} -returnCodes error -body {
+ wm stackorder . _
+} -result {wrong # args: should be "wm stackorder window ?isabove|isbelow window?"}
+test wm-stackorder-1.3 {usage} -returnCodes error -body {
+ wm stackorder . _ _ _
+} -result {wrong # args: should be "wm stackorder window ?isabove|isbelow window?"}
+test wm-stackorder-1.4 {usage} -returnCodes error -body {
+ wm stackorder . is .
+} -result {ambiguous argument "is": must be isabove or isbelow}
+test wm-stackorder-1.5 {usage} -returnCodes error -body {
+ wm stackorder _
+} -result {bad window path name "_"}
+test wm-stackorder-1.6 {usage} -returnCodes error -body {
+ wm stackorder . isabove _
+} -result {bad window path name "_"}
+test wm-stackorder-1.7 {usage} -body {
toplevel .t
button .t.b
- list [catch {wm stackorder .t.b} err] $err
-} {1 {window ".t.b" isn't a top-level window}}
-
-test wm-stackorder-1.8 {usage} {
- catch {destroy .t}
+ wm stackorder .t.b
+} -cleanup {
+ destroy .t
+} -returnCodes error -result {window ".t.b" isn't a top-level window}
+test wm-stackorder-1.8 {usage} -body {
toplevel .t
button .t.b
pack .t.b
update
- list [catch {wm stackorder . isabove .t.b} err] $err
-} {1 {window ".t.b" isn't a top-level window}}
-
-test wm-stackorder-1.9 {usage} {
- catch {destroy .t}
+ wm stackorder . isabove .t.b
+} -cleanup {
+ destroy .t
+} -returnCodes error -result {window ".t.b" isn't a top-level window}
+test wm-stackorder-1.9 {usage} -body {
toplevel .t
button .t.b
pack .t.b
update
- list [catch {wm stackorder . isbelow .t.b} err] $err
-} {1 {window ".t.b" isn't a top-level window}}
-
-test wm-stackorder-1.10 {usage, isabove|isbelow toplevels must be mapped} {
- catch {destroy .t}
- toplevel .t ; update
+ wm stackorder . isbelow .t.b
+} -cleanup {
+ destroy .t
+} -returnCodes error -result {window ".t.b" isn't a top-level window}
+test wm-stackorder-1.10 {usage, isabove|isbelow toplevels must be mapped} -body {
+ toplevel .t
+ update
wm withdraw .t
- list [catch {wm stackorder .t isabove .} err] $err
-} {1 {window ".t" isn't mapped}}
-
-test wm-stackorder-1.11 {usage, isabove|isbelow toplevels must be mapped} {
- catch {destroy .t}
- toplevel .t ; update
+ wm stackorder .t isabove .
+} -cleanup {
+ destroy .t
+} -returnCodes error -result {window ".t" isn't mapped}
+test wm-stackorder-1.11 {usage, isabove|isbelow toplevels must be mapped} -body {
+ toplevel .t
+ update
wm withdraw .t
- list [catch {wm stackorder . isbelow .t} err] $err
-} {1 {window ".t" isn't mapped}}
-
-
+ wm stackorder . isbelow .t
+} -cleanup {
+ destroy .t
+} -returnCodes error -result {window ".t" isn't mapped}
deleteWindows
-
-test wm-stackorder-2.1 {} {
- catch {destroy .t}
+test wm-stackorder-2.1 {stacking order} -body {
toplevel .t ; update
wm stackorder .
-} {. .t}
-
-test wm-stackorder-2.2 {} {
- catch {destroy .t}
+} -cleanup {
+ destroy .t
+} -result {. .t}
+test wm-stackorder-2.2 {stacking order} -body {
toplevel .t ; update
raise .
raiseDelay
wm stackorder .
-} {.t .}
-
-test wm-stackorder-2.3 {} {
- catch {destroy .t}
+} -cleanup {
+ destroy .t
+} -result {.t .}
+test wm-stackorder-2.3 {stacking order} -body {
toplevel .t ; update
- catch {destroy .t2}
toplevel .t2 ; update
raise .
raise .t2
raiseDelay
wm stackorder .
-} {.t . .t2}
-
-test wm-stackorder-2.4 {} {
- catch {destroy .t}
+} -cleanup {
+ destroy .t .t2
+} -result {.t . .t2}
+test wm-stackorder-2.4 {stacking order} -body {
toplevel .t ; update
- catch {destroy .t2}
toplevel .t2 ; update
raise .
lower .t2
raiseDelay
wm stackorder .
-} {.t2 .t .}
-
-test wm-stackorder-2.5 {} {
- catch {destroy .parent}
+} -cleanup {
+ destroy .t .t2
+} -result {.t2 .t .}
+test wm-stackorder-2.5 {stacking order} -setup {
+ destroy .parent
+} -body {
toplevel .parent ; update
- catch {destroy .parent.child1}
+ destroy .parent.child1
toplevel .parent.child1 ; update
- catch {destroy .parent.child2}
+ destroy .parent.child2
toplevel .parent.child2 ; update
- catch {destroy .extra}
+ destroy .extra
toplevel .extra ; update
raise .parent
lower .parent.child2
raiseDelay
wm stackorder .parent
-} {.parent.child2 .parent.child1 .parent}
-
-deleteWindows
-
-test wm-stackorder-2.6 {non-toplevel widgets ignored} {
- catch {destroy .t1}
+} -cleanup {
+ deleteWindows
+} -result {.parent.child2 .parent.child1 .parent}
+test wm-stackorder-2.6 {stacking order: non-toplevel widgets ignored} -body {
toplevel .t1
button .t1.b
pack .t1.b
update
wm stackorder .
-} {. .t1}
-
-deleteWindows
-
-test wm-stackorder-2.7 {no children returns self} {
+} -cleanup {
+ destroy .t1
+} -result {. .t1}
+test wm-stackorder-2.7 {stacking order: no children returns self} -setup {
+ deleteWindows
+} -body {
wm stackorder .
-} {.}
+} -result {.}
deleteWindows
-
-test wm-stackorder-3.1 {unmapped toplevel} {
- catch {destroy .t1}
+test wm-stackorder-3.1 {unmapped toplevel} -body {
toplevel .t1 ; update
- catch {destroy .t2}
toplevel .t2 ; update
wm iconify .t1
wm stackorder .
-} {. .t2}
-
-test wm-stackorder-3.2 {unmapped toplevel} {
- catch {destroy .t1}
+} -cleanup {
+ destroy .t1 .t2
+} -result {. .t2}
+test wm-stackorder-3.2 {unmapped toplevel} -body {
toplevel .t1 ; update
- catch {destroy .t2}
toplevel .t2 ; update
wm withdraw .t2
wm stackorder .
-} {. .t1}
-
-test wm-stackorder-3.3 {unmapped toplevel} {
- catch {destroy .t1}
+} -cleanup {
+ destroy .t1 .t2
+} -result {. .t1}
+test wm-stackorder-3.3 {unmapped toplevel} -body {
toplevel .t1 ; update
- catch {destroy .t2}
toplevel .t2 ; update
wm withdraw .t2
wm stackorder .t2
-} {}
-
-test wm-stackorder-3.4 {unmapped toplevel} {
- catch {destroy .t1}
+} -cleanup {
+ destroy .t1 .t2
+} -result {}
+test wm-stackorder-3.4 {unmapped toplevel} -body {
toplevel .t1 ; update
toplevel .t1.t2 ; update
wm withdraw .t1.t2
wm stackorder .t1
-} {.t1}
-
-test wm-stackorder-3.5 {unmapped toplevel} {
- catch {destroy .t1}
+} -cleanup {
+ destroy .t1
+} -result {.t1}
+test wm-stackorder-3.5 {unmapped toplevel} -body {
toplevel .t1 ; update
toplevel .t1.t2 ; update
wm withdraw .t1
wm stackorder .t1
-} {.t1.t2}
-
-test wm-stackorder-3.6 {unmapped toplevel} {
- catch {destroy .t1}
+} -cleanup {
+ destroy .t1
+} -result {.t1.t2}
+test wm-stackorder-3.6 {unmapped toplevel} -body {
toplevel .t1 ; update
toplevel .t1.t2 ; update
toplevel .t1.t2.t3 ; update
wm withdraw .t1.t2
wm stackorder .t1
-} {.t1 .t1.t2.t3}
-
-test wm-stackorder-3.7 {unmapped toplevel, mapped children returned} {
- catch {destroy .t1}
+} -cleanup {
+ destroy .t1
+} -result {.t1 .t1.t2.t3}
+test wm-stackorder-3.7 {unmapped toplevel, mapped children returned} -body {
toplevel .t1 ; update
toplevel .t1.t2 ; update
wm withdraw .t1
wm stackorder .t1
-} {.t1.t2}
-
-test wm-stackorder-3.8 {toplevel mapped in idle callback } {
- catch {destroy .t1}
+} -cleanup {
+ destroy .t1
+} -result {.t1.t2}
+test wm-stackorder-3.8 {toplevel mapped in idle callback} -body {
toplevel .t1
wm stackorder .
-} {.}
-
-
+} -cleanup {
+ destroy .t1
+} -result {.}
deleteWindows
-
-test wm-stackorder-4.1 {wm stackorder isabove|isbelow} {
- catch {destroy .t}
+test wm-stackorder-4.1 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .t
wm stackorder . isabove .t
-} {0}
-
-test wm-stackorder-4.2 {wm stackorder isabove|isbelow} {
- catch {destroy .t}
+} -cleanup {
+ destroy .t
+} -result {0}
+test wm-stackorder-4.2 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .t
wm stackorder . isbelow .t
-} {1}
-
-test wm-stackorder-4.3 {wm stackorder isabove|isbelow} {
- catch {destroy .t}
+} -cleanup {
+ destroy .t
+} -result {1}
+test wm-stackorder-4.3 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .
raiseDelay
wm stackorder .t isa .
-} {0}
-
-test wm-stackorder-4.4 {wm stackorder isabove|isbelow} {
- catch {destroy .t}
+} -cleanup {
+ destroy .t
+} -result {0}
+test wm-stackorder-4.4 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .
raiseDelay
wm stackorder .t isb .
-} {1}
-
+} -cleanup {
+ destroy .t
+} -result {1}
deleteWindows
-test wm-stackorder-5.1 {a menu is not a toplevel} {
- catch {destroy .t}
+test wm-stackorder-5.1 {a menu is not a toplevel} -body {
toplevel .t
menu .t.m -type menubar
.t.m add cascade -label "File"
@@ -1115,117 +1510,122 @@ test wm-stackorder-5.1 {a menu is not a toplevel} {
raise .
raiseDelay
wm stackorder .
-} {.t .}
-
-test wm-stackorder-5.2 {A normal toplevel can't be
- raised above an overrideredirect toplevel } {
- catch {destroy .t}
+} -cleanup {
+ destroy .t
+} -result {.t .}
+test wm-stackorder-5.2 {A normal toplevel can't be\
+ raised above an overrideredirect toplevel} -body {
toplevel .t
wm overrideredirect .t 1
raise .
update
raiseDelay
wm stackorder . isabove .t
-} 0
-
-test wm-stackorder-5.3 {An overrideredirect window
- can be explicitly lowered } {
- catch {destroy .t}
+} -cleanup {
+ destroy .t
+} -result 0
+test wm-stackorder-5.3 {An overrideredirect window\
+ can be explicitly lowered} -body {
toplevel .t
wm overrideredirect .t 1
lower .t
update
raiseDelay
wm stackorder .t isbelow .
-} 1
+} -cleanup {
+ destroy .t
+} -result 1
-test wm-stackorder-6.1 {An embedded toplevel does not
- appear in the stacking order} {
- deleteWindows
+test wm-stackorder-6.1 {An embedded toplevel does not\
+ appear in the stacking order} -body {
toplevel .real -container 1
toplevel .embd -bg blue -use [winfo id .real]
update
wm stackorder .
-} {. .real}
+} -cleanup {
+ deleteWindows
+} -result {. .real}
-stdWindow
-test wm-title-1.1 {usage} {
- list [catch {wm title} msg] $msg
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+stdWindow
-test wm-title-1.2 {usage} {
- list [catch {wm title . 1 2} msg] $msg
-} {1 {wrong # args: should be "wm title window ?newTitle?"}}
+### wm title ###
+test wm-title-1.1 {usage} -returnCodes error -body {
+ wm title
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-title-1.2 {usage} -returnCodes error -body {
+ wm title . 1 2
+} -result {wrong # args: should be "wm title window ?newTitle?"}
-test wm-title-2.1 {setting and reading values} {
+test wm-title-2.1 {setting and reading values} -setup {
destroy .t
+} -body {
toplevel .t
set result [wm title .t]
wm title .t Apa
lappend result [wm title .t]
wm title .t {}
lappend result [wm title .t]
-} {t Apa {}}
+} -result {t Apa {}}
-test wm-transient-1.1 {usage} {
+### wm transient ###
+test wm-transient-1.1 {usage} -returnCodes error -body {
catch {destroy .t} ; toplevel .t
- list [catch {wm transient .t 1 2} msg] $msg
-} {1 {wrong # args: should be "wm transient window ?master?"}}
-
-test wm-transient-1.2 {usage} {
+ wm transient .t 1 2
+} -result {wrong # args: should be "wm transient window ?master?"}
+test wm-transient-1.2 {usage} -returnCodes error -body {
catch {destroy .t} ; toplevel .t
- list [catch {wm transient .t foo} msg] $msg
-} {1 {bad window path name "foo"}}
-
-test wm-transient-1.3 {usage} {
+ wm transient .t foo
+} -result {bad window path name "foo"}
+test wm-transient-1.3 {usage} -returnCodes error -body {
catch {destroy .t} ; toplevel .t
- list [catch {wm transient foo .t} msg] $msg
-} {1 {bad window path name "foo"}}
-
-test wm-transient-1.4 {usage} {
- deleteWindows
+ wm transient foo .t
+} -result {bad window path name "foo"}
+deleteWindows
+test wm-transient-1.4 {usage} -returnCodes error -body {
toplevel .master
toplevel .subject
wm transient .subject .master
- list [catch {wm iconify .subject} msg] $msg
-} {1 {can't iconify ".subject": it is a transient}}
-
-test wm-transient-1.5 {usage} {
+ wm iconify .subject
+} -cleanup {
deleteWindows
+} -result {can't iconify ".subject": it is a transient}
+test wm-transient-1.5 {usage} -returnCodes error -body {
toplevel .icon -bg blue
toplevel .top
wm iconwindow .top .icon
toplevel .dummy
- list [catch {wm transient .icon .dummy} msg] $msg
-} {1 {can't make ".icon" a transient: it is an icon for .top}}
-
-test wm-transient-1.6 {usage} {
+ wm transient .icon .dummy
+} -cleanup {
deleteWindows
+} -result {can't make ".icon" a transient: it is an icon for .top}
+test wm-transient-1.6 {usage} -returnCodes error -body {
toplevel .icon -bg blue
toplevel .top
wm iconwindow .top .icon
toplevel .dummy
- list [catch {wm transient .dummy .icon} msg] $msg
-} {1 {can't make ".icon" a master: it is an icon for .top}}
-
-test wm-transient-1.7 {usage} {
+ wm transient .dummy .icon
+} -cleanup {
deleteWindows
+} -result {can't make ".icon" a master: it is an icon for .top}
+test wm-transient-1.7 {usage} -returnCodes error -body {
toplevel .master
- list [catch {wm transient .master .master} err] $err
-} {1 {can't make ".master" its own master}}
-
-test wm-transient-1.8 {usage} {
+ wm transient .master .master
+} -cleanup {
deleteWindows
+} -result {can't make ".master" its own master}
+test wm-transient-1.8 {usage} -returnCodes error -body {
toplevel .master
frame .master.f
- list [catch {wm transient .master .master.f} err] $err
-} {1 {can't make ".master" its own master}}
-
-test wm-transient-2.1 { basic get/set of master } {
+ wm transient .master .master.f
+} -cleanup {
deleteWindows
- set results [list]
+} -result {can't make ".master" its own master}
+
+test wm-transient-2.1 {basic get/set of master} -setup {
+ set results [list]
+} -body {
toplevel .master
toplevel .subject
lappend results [wm transient .subject]
@@ -1233,22 +1633,21 @@ test wm-transient-2.1 { basic get/set of master } {
lappend results [wm transient .subject]
wm transient .subject {}
lappend results [wm transient .subject]
- set results
-} {{} .master {}}
-
-test wm-transient-2.2 { first toplevel parent of
- non-toplevel master is used } {
+} -cleanup {
deleteWindows
+} -result {{} .master {}}
+test wm-transient-2.2 {first toplevel parent of non-toplevel master is used} -body {
toplevel .master
frame .master.f
toplevel .subject
wm transient .subject .master.f
wm transient .subject
-} {.master}
-
-test wm-transient-3.1 { transient toplevel is withdrawn
- when mapped if master is withdrawn } {
+} -cleanup {
deleteWindows
+} -result {.master}
+
+test wm-transient-3.1 {transient toplevel is withdrawn
+ when mapped if master is withdrawn} -body {
toplevel .master
wm withdraw .master
update
@@ -1256,11 +1655,11 @@ test wm-transient-3.1 { transient toplevel is withdrawn
wm transient .subject .master
update
list [wm state .subject] [winfo ismapped .subject]
-} {withdrawn 0}
-
-test wm-transient-3.2 { already mapped transient toplevel
- takes on withdrawn state of master } {
+} -cleanup {
deleteWindows
+} -result {withdrawn 0}
+test wm-transient-3.2 {already mapped transient toplevel
+ takes on withdrawn state of master} -body {
toplevel .master
wm withdraw .master
update
@@ -1269,30 +1668,29 @@ test wm-transient-3.2 { already mapped transient toplevel
wm transient .subject .master
update
list [wm state .subject] [winfo ismapped .subject]
-} {withdrawn 0}
-
-test wm-transient-3.3 { withdraw/deiconify on the master
- also does a withdraw/deiconify on the transient } {
+} -cleanup {
deleteWindows
+} -result {withdrawn 0}
+test wm-transient-3.3 {withdraw/deiconify on the master
+ also does a withdraw/deiconify on the transient} -setup {
set results [list]
+} -body {
toplevel .master
toplevel .subject
update
wm transient .subject .master
wm withdraw .master
update
- lappend results [wm state .subject] \
- [winfo ismapped .subject]
+ lappend results [wm state .subject] [winfo ismapped .subject]
wm deiconify .master
update
- lappend results [wm state .subject] \
- [winfo ismapped .subject]
- set results
-} {withdrawn 0 normal 1}
-
-test wm-transient-4.1 { transient toplevel is withdrawn
- when mapped if master is iconic } {
+ lappend results [wm state .subject] [winfo ismapped .subject]
+} -cleanup {
deleteWindows
+} -result {withdrawn 0 normal 1}
+
+test wm-transient-4.1 {transient toplevel is withdrawn
+ when mapped if master is iconic} -body {
toplevel .master
wm iconify .master
update
@@ -1300,11 +1698,11 @@ test wm-transient-4.1 { transient toplevel is withdrawn
wm transient .subject .master
update
list [wm state .subject] [winfo ismapped .subject]
-} {withdrawn 0}
-
-test wm-transient-4.2 { already mapped transient toplevel
- is withdrawn if master is iconic } {
+} -cleanup {
deleteWindows
+} -result {withdrawn 0}
+test wm-transient-4.2 {already mapped transient toplevel
+ is withdrawn if master is iconic} -body {
toplevel .master
wm iconify .master
update
@@ -1313,31 +1711,31 @@ test wm-transient-4.2 { already mapped transient toplevel
wm transient .subject .master
update
list [wm state .subject] [winfo ismapped .subject]
-} {withdrawn 0}
-
-test wm-transient-4.3 { iconify/deiconify on the master
- does a withdraw/deiconify on the transient } {
+} -cleanup {
deleteWindows
+} -result {withdrawn 0}
+test wm-transient-4.3 {iconify/deiconify on the master
+ does a withdraw/deiconify on the transient} -setup {
set results [list]
+} -body {
toplevel .master
toplevel .subject
update
wm transient .subject .master
wm iconify .master
update
- lappend results [wm state .subject] \
- [winfo ismapped .subject]
+ lappend results [wm state .subject] [winfo ismapped .subject]
wm deiconify .master
update
- lappend results [wm state .subject] \
- [winfo ismapped .subject]
- set results
-} {withdrawn 0 normal 1}
-
-test wm-transient-5.1 { an error during transient command should not
- cause the map/unmap binding to be deleted } {
+ lappend results [wm state .subject] [winfo ismapped .subject]
+} -cleanup {
deleteWindows
+} -result {withdrawn 0 normal 1}
+
+test wm-transient-5.1 {an error during transient command should not
+ cause the map/unmap binding to be deleted} -setup {
set results [list]
+} -body {
toplevel .master
toplevel .subject
update
@@ -1350,12 +1748,11 @@ test wm-transient-5.1 { an error during transient command should not
wm deiconify .master
update
lappend results [wm state .subject]
- set results
-} {1 withdrawn normal}
-
-test wm-transient-5.2 { remove transient property when master
- is destroyed } {
+} -cleanup {
deleteWindows
+} -result {1 withdrawn normal}
+test wm-transient-5.2 {remove transient property when master
+ is destroyed} -body {
toplevel .master
toplevel .subject
wm transient .subject .master
@@ -1363,21 +1760,22 @@ test wm-transient-5.2 { remove transient property when master
destroy .master
update
wm transient .subject
-} {}
-
-test wm-transient-5.3 { remove transient property from window
- that had never been mapped when master is destroyed } {
+} -cleanup {
deleteWindows
+} -result {}
+test wm-transient-5.3 {remove transient property from window
+ that had never been mapped when master is destroyed} -body {
toplevel .master
toplevel .subject
wm transient .subject .master
destroy .master
wm transient .subject
-} {}
-
-test wm-transient-6.1 { a withdrawn transient does not track
- state changes in the master } {
+} -cleanup {
deleteWindows
+} -result {}
+
+test wm-transient-6.1 {a withdrawn transient does not track
+ state changes in the master} -body {
toplevel .master
toplevel .subject
update
@@ -1388,12 +1786,13 @@ test wm-transient-6.1 { a withdrawn transient does not track
# idle handler should not map the transient
update
wm state .subject
-} {withdrawn}
-
-test wm-transient-6.2 { a withdrawn transient does not track
- state changes in the master } {
- set results [list]
+} -cleanup {
deleteWindows
+} -result {withdrawn}
+test wm-transient-6.2 {a withdrawn transient does not track
+ state changes in the master} -setup {
+ set results [list]
+} -body {
toplevel .master
toplevel .subject
update
@@ -1412,11 +1811,11 @@ test wm-transient-6.2 { a withdrawn transient does not track
# idle handler should map transient
update
lappend results [wm state .subject]
-} {withdrawn normal withdrawn normal}
-
-test wm-transient-6.3 { a withdrawn transient does not track
- state changes in the master } {
+} -cleanup {
deleteWindows
+} -result {withdrawn normal withdrawn normal}
+test wm-transient-6.3 {a withdrawn transient does not track
+ state changes in the master} -body {
toplevel .master
toplevel .subject
update
@@ -1428,265 +1827,467 @@ test wm-transient-6.3 { a withdrawn transient does not track
# idle handler should not map the transient
update
wm state .subject
-} {withdrawn}
+} -cleanup {
+ deleteWindows
+} -result {withdrawn}
# wm-transient-7.*: See SF Tk Bug #592201 "wm transient fails with two masters"
# wm-transient-7.3 through 7.5 all caused panics on Unix in Tk 8.4b1.
# 7.1 and 7.2 added to catch (potential) future errors.
#
-test wm-transient-7.1 {Destroying transient} {
- deleteWindows
- toplevel .t
- toplevel .transient
+test wm-transient-7.1 {Destroying transient} -body {
+ toplevel .t
+ toplevel .transient
wm transient .transient .t
destroy .transient
destroy .t
# OK: the above did not cause a panic.
-} {}
-
-test wm-transient-7.2 {Destroying master} {
+} -cleanup {
deleteWindows
+}
+test wm-transient-7.2 {Destroying master} -body {
toplevel .t
- toplevel .transient
+ toplevel .transient
wm transient .transient .t
destroy .t
- set result [wm transient .transient]
- destroy .transient
- set result
-} {}
-
-test wm-transient-7.3 {Reassign transient, destroy old master} {
+ wm transient .transient
+} -cleanup {
deleteWindows
- toplevel .t1
- toplevel .t2
+} -result {}
+test wm-transient-7.3 {Reassign transient, destroy old master} -body {
+ toplevel .t1
+ toplevel .t2
toplevel .transient
wm transient .transient .t1
wm transient .transient .t2
destroy .t1 ;# Caused panic in 8.4b1
- destroy .t2
+ destroy .t2
destroy .transient
-} {}
-
-test wm-transient-7.4 {Reassign transient, destroy new master} {
+} -cleanup {
deleteWindows
- toplevel .t1
- toplevel .t2
+}
+test wm-transient-7.4 {Reassign transient, destroy new master} -body {
+ toplevel .t1
+ toplevel .t2
toplevel .transient
wm transient .transient .t1
wm transient .transient .t2
destroy .t2 ;# caused panic in 8.4b1
destroy .t1
destroy .transient
-} {}
-
-test wm-transient-7.5 {Reassign transient, destroy transient} {
+} -cleanup {
deleteWindows
- toplevel .t1
- toplevel .t2
+}
+test wm-transient-7.5 {Reassign transient, destroy transient} -body {
+ toplevel .t1
+ toplevel .t2
toplevel .transient
wm transient .transient .t1
wm transient .transient .t2
destroy .transient
destroy .t2 ;# caused panic in 8.4b1
destroy .t1 ;# so did this
-} {}
+} -cleanup {
+ deleteWindows
+}
-test wm-state-1.1 {usage} {
- list [catch {wm state} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
+test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -setup {
+ deleteWindows
+ set result {}
+} -body {
+ # Verifies that transients stay on top of their masters, even if they were
+ # made transients when those masters were withdrawn.
+ toplevel .t1; wm withdraw .t1; update
+ toplevel .t2; wm transient .t2 .t1; update
+ lappend result [winfo ismapped .t1] [winfo ismapped .t2]
+ wm deiconify .t1; update
+ lappend result [winfo ismapped .t1] [winfo ismapped .t2]
+ raise .t1; update
+ lappend result [lsearch -all -inline -glob [wm stackorder .] ".t?"]
+} -cleanup {
+ deleteWindows
+} -result {0 0 1 1 {.t1 .t2}}
-test wm-state-1.2 {usage} {
- list [catch {wm state . _ _} err] $err
-} {1 {wrong # args: should be "wm state window ?state?"}}
-test wm-state-2.1 {initial state} {
- deleteWindows
+### wm state ###
+test wm-state-1.1 {usage} -returnCodes error -body {
+ wm state
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-state-1.2 {usage} -returnCodes error -body {
+ wm state . _ _
+} -result {wrong # args: should be "wm state window ?state?"}
+
+deleteWindows
+test wm-state-2.1 {initial state} -body {
toplevel .t
wm state .t
-} {normal}
-
-test wm-state-2.2 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.2 {state change before map} -body {
toplevel .t
wm state .t withdrawn
wm state .t
-} {withdrawn}
-
-test wm-state-2.3 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {withdrawn}
+test wm-state-2.3 {state change before map} -body {
toplevel .t
wm withdraw .t
wm state .t
-} {withdrawn}
-
-test wm-state-2.4 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {withdrawn}
+test wm-state-2.4 {state change after map} -body {
toplevel .t
update
wm state .t withdrawn
wm state .t
-} {withdrawn}
-
-test wm-state-2.5 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {withdrawn}
+test wm-state-2.5 {state change after map} -body {
toplevel .t
update
wm withdraw .t
wm state .t
-} {withdrawn}
-
-test wm-state-2.6 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {withdrawn}
+test wm-state-2.6 {state change before map} -body {
toplevel .t
wm state .t iconic
wm state .t
-} {iconic}
-
-test wm-state-2.7 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {iconic}
+test wm-state-2.7 {state change before map} -body {
toplevel .t
wm iconify .t
wm state .t
-} {iconic}
-
-test wm-state-2.8 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {iconic}
+test wm-state-2.8 {state change after map} -body {
toplevel .t
update
wm state .t iconic
wm state .t
-} {iconic}
-
-test wm-state-2.9 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {iconic}
+test wm-state-2.9 {state change after map} -body {
toplevel .t
update
wm iconify .t
wm state .t
-} {iconic}
-
-test wm-state-2.10 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {iconic}
+test wm-state-2.10 {state change before map} -body {
toplevel .t
wm withdraw .t
wm state .t normal
wm state .t
-} {normal}
-
-test wm-state-2.11 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.11 {state change before map} -body {
toplevel .t
wm withdraw .t
wm deiconify .t
wm state .t
-} {normal}
-
-test wm-state-2.12 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.12 {state change after map} -body {
toplevel .t
update
wm withdraw .t
wm state .t normal
wm state .t
-} {normal}
-
-test wm-state-2.13 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.13 {state change after map} -body {
toplevel .t
update
wm withdraw .t
wm deiconify .t
wm state .t
-} {normal}
-
-test wm-state-2.14 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.14 {state change before map} -body {
toplevel .t
wm iconify .t
wm state .t normal
wm state .t
-} {normal}
-
-test wm-state-2.15 {state change before map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.15 {state change before map} -body {
toplevel .t
wm iconify .t
wm deiconify .t
wm state .t
-} {normal}
-
-test wm-state-2.16 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.16 {state change after map} -body {
toplevel .t
update
wm iconify .t
wm state .t normal
wm state .t
-} {normal}
-
-test wm-state-2.17 {state change after map} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.17 {state change after map} -body {
toplevel .t
update
wm iconify .t
wm deiconify .t
wm state .t
-} {normal}
-
-test wm-state-2.18 {state change after map} {pcOnly} {
+} -cleanup {
deleteWindows
+} -result {normal}
+test wm-state-2.18 {state change after map} -constraints win -body {
toplevel .t
update
wm state .t zoomed
wm state .t
-} {zoomed}
+} -cleanup {
+ deleteWindows
+} -result {zoomed}
-test wm-withdraw-1.1 {usage} {
- list [catch {wm withdraw} err] $err
-} {1 {wrong # args: should be "wm option window ?arg ...?"}}
-test wm-withdraw-1.2 {usage} {
- list [catch {wm withdraw . _} msg] $msg
-} {1 {wrong # args: should be "wm withdraw window"}}
+### wm withdraw ###
+test wm-withdraw-1.1 {usage} -returnCodes error -body {
+ wm withdraw
+} -result {wrong # args: should be "wm option window ?arg ...?"}
+test wm-withdraw-1.2 {usage} -returnCodes error -body {
+ wm withdraw . _
+} -result {wrong # args: should be "wm withdraw window"}
-test wm-withdraw-2.1 {Misc errors} {
- deleteWindows
+deleteWindows
+test wm-withdraw-2.1 {Misc errors} -body {
toplevel .t
toplevel .t2
wm iconwindow .t .t2
- set result [list [catch {wm withdraw .t2} msg] $msg]
- destroy .t2
- set result
-} {1 {can't withdraw .t2: it is an icon for .t}}
+ wm withdraw .t2
+} -returnCodes error -cleanup {
+ deleteWindows
+} -result {can't withdraw .t2: it is an icon for .t}
-test wm-withdraw-3.1 {} {
- update
+test wm-withdraw-3.1 {} -setup {
set result {}
+} -body {
+ toplevel .t
+ update
wm withdraw .t
lappend result [wm state .t] [winfo ismapped .t]
wm deiconify .t
lappend result [wm state .t] [winfo ismapped .t]
-} {withdrawn 0 normal 1}
+} -cleanup {
+ deleteWindows
+} -result {withdrawn 0 normal 1}
+
-test wm-deletion-epoch-1.1 {Deletion epoch on multiple displays} {altDisplay} {
+### Misc. wm tests ###
+test wm-deletion-epoch-1.1 {Deletion epoch on multiple displays} -constraints altDisplay -body {
# See Tk Bug #671330 "segfault when e.g. deiconifying destroyed window"
- deleteWindows
set w [toplevel .t -screen $env(TK_ALT_DISPLAY)]
wm deiconify $w ;# this caches the WindowRep
destroy .t
- list [catch {wm deiconify $w} msg] $msg
-} {1 {bad window path name ".t"}}
+ wm deiconify $w
+} -returnCodes error -result {bad window path name ".t"} -cleanup {
+ deleteWindows
+}
+
+### Docking test (manage, forget) ###
+test wm-manage-1.1 {managing a frame} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ frame .t.f
+ pack [label .t.f.l -text hello]
+ wm manage .t.f
+ raise .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+} -cleanup {
+ deleteWindows
+} -result {wm .t.f}
+test wm-manage-1.2 {managing a toplevel} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ pack [label .t.l -text hello]
+ wm manage .t
+ raise .t
+ update
+ lappend result [winfo manage .t]
+ lappend result [winfo toplevel .t]
+} -cleanup {
+ deleteWindows
+} -result {wm .t}
+test wm-manage-1.3 {managing a labelframe} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ labelframe .t.f -text Labelframe
+ pack [label .t.f.l -text hello]
+ wm manage .t.f
+ raise .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+} -cleanup {
+ deleteWindows
+} -result {wm .t.f}
+test wm-manage-1.4 {managing a ttk::frame} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ ttk::frame .t.f
+ pack [label .t.f.l -text hello]
+ wm manage .t.f
+ raise .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+} -cleanup {
+ deleteWindows
+} -returnCodes error -result "window \".t.f\" is not manageable: must be a frame, labelframe or toplevel"
+test wm-manage-1.5 {managing a text widget} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ text .t.f
+ .t.f insert end "Manage text\n" {}
+ wm manage .t.f
+ raise .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+} -cleanup {
+ deleteWindows
+} -returnCodes error -result "window \".t.f\" is not manageable: must be a frame, labelframe or toplevel"
+test wm-manage-1.6 {managing a button} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ button .t.f -text Button
+ wm manage .t.f
+ raise .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+} -cleanup {
+ deleteWindows
+} -returnCodes error -result "window \".t.f\" is not manageable: must be a frame, labelframe or toplevel"
+test wm-manage-1.7 {managing a frame} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ frame .t.f
+ pack [label .t.f.l -text Label]
+ pack .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+ wm manage .t.f
+ raise .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+ wm forget .t.f
+ pack .t.f
+ update
+ lappend result [winfo manage .t.f]
+ lappend result [winfo toplevel .t.f]
+} -cleanup {
+ deleteWindows
+} -result {pack .t wm .t.f pack .t}
+test wm-manage-1.8 {unmanaging a toplevel} -setup {
+ set result [list]
+} -body {
+ toplevel .t
+ toplevel .t.t
+ button .t.t.b -text "Manage This"
+ pack .t.t.b
+ update
+ lappend result [winfo manage .t.t]
+ lappend result [winfo toplevel .t.t.b]
+ wm forget .t.t
+ wm forget .t.t ; # second call should be a no-op
+ pack .t.t
+ update
+ lappend result [winfo manage .t.t]
+ lappend result [winfo toplevel .t.t.b]
+ wm manage .t.t
+ wm manage .t.t ; # second call should be a no-op
+ wm deiconify .t.t
+ update
+ lappend result [winfo manage .t.t]
+ lappend result [winfo toplevel .t.t.b]
+} -cleanup {
+ deleteWindows
+} -result {wm .t.t pack .t wm .t.t}
+
+test wm-forget-1.1 "bug #2009788: forget toplevel can cause crash" -body {
+ toplevel .parent
+ toplevel .parent.child
+ wm forget .parent.child
+ winfo exists .parent.child
+} -cleanup {
+ deleteWindows
+} -result {1}
+test wm-forget-1.2 "bug #2009788: forget toplevel can cause crash" -body {
+ toplevel .parent
+ update
+ toplevel .parent.child
+ wm forget .parent.child
+ winfo exists .parent.child
+} -cleanup {
+ deleteWindows
+} -result {1}
+test wm-forget-1.3 "bug #2009788: forget toplevel can cause crash" -body {
+ toplevel .parent
+ toplevel .parent.child
+ wm forget .parent.child
+ wm manage .parent.child
+ winfo exists .parent.child
+} -cleanup {
+ deleteWindows
+} -result {1}
+test wm-forget-1.4 "pack into unmapped toplevel causes crash" -body {
+ toplevel .parent
+ toplevel .parent.child
+ wm forget .parent.child
+ pack [button .parent.child.button -text Hello]
+ after 250 {destroy .parent}
+ tkwait window .parent
+} -cleanup {
+ deleteWindows
+} -result {}
# FIXME:
-# Test delivery of virtual events to the WM. We could check to see
-# if the window was raised after a button click for example.
-# This sort of testing may not be possible.
+# Test delivery of virtual events to the WM. We could check to see if the
+# window was raised after a button click for example. This sort of testing may
+# not be possible.
+##############################################################################
deleteWindows
-tcltest::cleanupTests
+cleanupTests
+catch {unset results}
+catch {unset focusin}
return
-
-
+# Local variables:
+# mode: tcl
+# End:
diff --git a/tests/xmfbox.test b/tests/xmfbox.test
index 43f981c..b60bf48 100644
--- a/tests/xmfbox.test
+++ b/tests/xmfbox.test
@@ -11,10 +11,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
set testPWD [pwd]
@@ -60,14 +57,14 @@ proc cleanup {} {
catch {destroy .foo}
}
-test xmfbox-1.1 {tk::MotifFDialog_Create, -parent switch} {unixOnly} {
+test xmfbox-1.1 {tk::MotifFDialog_Create, -parent switch} unix {
catch {unset foo}
set x [tk::MotifFDialog_Create foo open {-parent .}]
catch {destroy $x}
set x
} .foo
-test xmfbox-1.2 {tk::MotifFDialog_Create, -parent switch} {unixOnly} {
+test xmfbox-1.2 {tk::MotifFDialog_Create, -parent switch} unix {
catch {unset foo}
toplevel .bar
wm geometry .bar +0+0
@@ -77,7 +74,7 @@ test xmfbox-1.2 {tk::MotifFDialog_Create, -parent switch} {unixOnly} {
set x
} .bar.foo
-test xmfbox-2.1 {tk::MotifFDialog_InterpFilter, ~ in dir names} {unixOnly} {
+test xmfbox-2.1 {tk::MotifFDialog_InterpFilter, ~ in dir names} unix {
cleanup
file mkdir ./~nosuchuser1
set x [tk::MotifFDialog_Create foo open {}]
@@ -86,7 +83,7 @@ test xmfbox-2.1 {tk::MotifFDialog_InterpFilter, ~ in dir names} {unixOnly} {
set kk [tk::MotifFDialog_InterpFilter $x]
} [list $testPWD/~nosuchuser1 *]
-test xmfbox-2.2 {tk::MotifFDialog_InterpFilter, ~ in file names} {unixOnly} {
+test xmfbox-2.2 {tk::MotifFDialog_InterpFilter, ~ in file names} unix {
cleanup
close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}]
set x [tk::MotifFDialog_Create foo open {}]
@@ -95,7 +92,7 @@ test xmfbox-2.2 {tk::MotifFDialog_InterpFilter, ~ in file names} {unixOnly} {
set kk [tk::MotifFDialog_InterpFilter $x]
} [list $testPWD ./~nosuchuser1]
-test xmfbox-2.3 {tk::MotifFDialog_Update, ~ in file names} {unixOnly} {
+test xmfbox-2.3 {tk::MotifFDialog_Update, ~ in file names} unix {
cleanup
close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}]
set x [tk::MotifFDialog_Create foo open {}]
@@ -106,7 +103,7 @@ test xmfbox-2.3 {tk::MotifFDialog_Update, ~ in file names} {unixOnly} {
$::tk::dialog::file::foo(fList) get end
} ~nosuchuser1
-test xmfbox-2.4 {tk::MotifFDialog_LoadFile, ~ in file names} {unixOnly} {
+test xmfbox-2.4 {tk::MotifFDialog_LoadFile, ~ in file names} unix {
cleanup
close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}]
set x [tk::MotifFDialog_Create foo open {}]
@@ -114,7 +111,7 @@ test xmfbox-2.4 {tk::MotifFDialog_LoadFile, ~ in file names} {unixOnly} {
expr {$i >= 0}
} 1
-test xmfbox-2.5 {tk::MotifFDialog_BrowseFList, ~ in file names} {unixOnly} {
+test xmfbox-2.5 {tk::MotifFDialog_BrowseFList, ~ in file names} unix {
cleanup
close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}]
set x [tk::MotifFDialog_Create foo open {}]
@@ -125,7 +122,7 @@ test xmfbox-2.5 {tk::MotifFDialog_BrowseFList, ~ in file names} {unixOnly} {
$::tk::dialog::file::foo(sEnt) get
} $testPWD/~nosuchuser1
-test xmfbox-2.6 {tk::MotifFDialog_ActivateFList, ~ in file names} {unixOnly} {
+test xmfbox-2.6 {tk::MotifFDialog_ActivateFList, ~ in file names} unix {
cleanup
close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}]
set x [tk::MotifFDialog_Create foo open {}]
@@ -140,17 +137,5 @@ test xmfbox-2.6 {tk::MotifFDialog_ActivateFList, ~ in file names} {unixOnly} {
# cleanup
cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 27bbb19..0096d27 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -34,6 +34,7 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
+datarootdir = @datarootdir@
mandir = @mandir@
# The following definition can be set to non-null for special systems
@@ -89,11 +90,21 @@ HTML_DIR = @HTML_DIR@
# Directory in which to install html documentation:
HTML_INSTALL_DIR = $(INSTALL_ROOT)$(HTML_DIR)
+# Directory in which to install the configuration file tkConfig.sh:
+CONFIG_INSTALL_DIR = $(INSTALL_ROOT)$(libdir)
+
+# Directory in which to install the demo files:
+DEMO_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY)/demos
+
# The directory containing the Tcl sources and headers appropriate
# for this version of Tk ("srcdir" will be replaced or has already
# been replaced by the configure script):
TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic
+# The directory containing the platform specific Tcl sources and headers
+# appropriate for this version of Tk:
+TCL_PLATFORM_DIR = @TCL_SRC_DIR@/unix
+
# The directory containing the Tcl library archive file appropriate
# for this version of Tk:
TCL_BIN_DIR = @TCL_BIN_DIR@
@@ -101,9 +112,6 @@ TCL_BIN_DIR = @TCL_BIN_DIR@
# The linker flags needed to link in the Tcl library (ex: -ltcl8.2)
TCL_LIB_FLAG = @TCL_LIB_FLAG@
-# Libraries built with optimization switches have this additional extension
-TK_DBGX = @TK_DBGX@
-
# Flag, 1: we're building a shared lib, 0 we're not
TK_SHARED_BUILD = @TK_SHARED_BUILD@
@@ -146,7 +154,7 @@ AQUA_INCLUDES = -I$(MAC_OSX_DIR) -I$(XLIB_DIR)
# Linker switch(es) to use to link with the X11 library archive (the
# configure script will try to set this value automatically, but you
# can override it).
-X11_LIB_SWITCHES = @XLIBSW@
+X11_LIB_SWITCHES = @XLIBSW@ $(XFT_LIBS)
# To turn off the security checks that disallow incoming sends when
@@ -183,7 +191,7 @@ NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED
# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
-SHELL = /bin/sh
+SHELL = @SHELL@
# BUILD_TCLSH is the fully qualified path name of the tclsh shell
# in the Tcl build directory. Test that need to be run in the
@@ -191,7 +199,7 @@ SHELL = /bin/sh
# path. Targets that need an installed tclsh should not depend
# on this variable.
-BUILD_TCLSH = @BUILD_TCLSH@
+BUILD_TCLSH = @BUILD_TCLSH@@EXEEXT@
# TCL_EXE is the name of a tclsh executable that is available *BEFORE*
# running make for the first time. Certain build targets (make genstubs)
@@ -206,7 +214,7 @@ TCL_EXE = @TCLSH_PROG@
# with the distribution, which is slower but guaranteed to work.
INSTALL_STRIP_PROGRAM = -s
-INSTALL_STRIP_LIBRARY = -S -S
+INSTALL_STRIP_LIBRARY = -S -x
INSTALL = @srcdir@/install-sh -c
INSTALL_PROGRAM = ${INSTALL}
@@ -244,15 +252,13 @@ TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
-TK_EXP_FILE = @TK_EXP_FILE@
-TK_BUILD_EXP_FILE = @TK_BUILD_EXP_FILE@
TCL_STUB_FLAGS = @TCL_STUB_FLAGS@
# Libraries to use when linking. This definition is determined by the
# configure script.
-LIBS = @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@
-WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@ @EXTRA_WISH_LIBS@
+LIBS = @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@
+WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @EXTRA_WISH_LIBS@
# The symbols below provide support for dynamic loading and shared
# libraries. See configure.in for a description of what the
@@ -280,6 +286,10 @@ WISH_RSRC_FILE = @WISH_RSRC_FILE@
REZ = @REZ@
REZ_SWITCHES = @REZ_FLAGS@ -i $(GENERIC_DIR) -i $(TCL_GENERIC_DIR)
+# support for Xft:
+XFT_CFLAGS = @XFT_CFLAGS@
+XFT_LIBS = @XFT_LIBS@
+
#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in. You shouldn't normally
@@ -292,9 +302,11 @@ RANLIB = @RANLIB@
SRC_DIR = @srcdir@
TOP_DIR = $(SRC_DIR)/..
GENERIC_DIR = $(TOP_DIR)/generic
-UNIX_DIR = $(SRC_DIR)
+TTK_DIR = $(GENERIC_DIR)/ttk
+UNIX_DIR = $(TOP_DIR)/unix
BMAP_DIR = $(TOP_DIR)/bitmaps
TOOL_DIR = @TCL_SRC_DIR@/tools
+TEST_DIR = $(TOP_DIR)/tests
MAC_OSX_DIR = $(TOP_DIR)/macosx
XLIB_DIR = $(TOP_DIR)/xlib
@@ -304,30 +316,31 @@ XLIB_DIR = $(TOP_DIR)/xlib
# either.
#----------------------------------------------------------------
-# Flags to be passed to installManPage to control whether the manpages
-# should be compressed and linked with softlinks
+# Flags to be passed to installManPage to control how the manpages
+# should be installed (symlinks, compression, package name suffix).
MAN_FLAGS = @MAN_FLAGS@
CC = @CC@
CC_SWITCHES_NO_STUBS = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} -I${TCL_GENERIC_DIR} \
-${@TK_WINDOWINGSYSTEM@_INCLUDES} ${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} \
-${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} ${NO_DEPRECATED_FLAGS} @EXTRA_CC_SWITCHES@
+-I${TCL_PLATFORM_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} ${AC_FLAGS} \
+${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} \
+${NO_DEPRECATED_FLAGS} @EXTRA_CC_SWITCHES@
CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) ${TCL_STUB_FLAGS}
APP_CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @EXTRA_APP_CC_SWITCHES@
-DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} \
--I${BMAP_DIR} \
--I${TCL_GENERIC_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} \
+DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \
+-I${TCL_GENERIC_DIR} -I${TCL_PLATFORM_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} \
${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} \
${KEYSYM_FLAGS} @EXTRA_CC_SWITCHES@
WISH_OBJS = tkAppInit.o
-TKTEST_OBJS = tkTestInit.o tkTest.o tkSquare.o
+TKTEST_OBJS = tkTestInit.o tkTest.o tkSquare.o tkOldTest.o \
+ $(@TK_WINDOWINGSYSTEM@_TKTEST_OBJS)
WIDG_OBJS = tkButton.o tkEntry.o tkFrame.o tkListbox.o \
tkMenu.o tkMenubutton.o tkMenuDraw.o tkMessage.o \
@@ -342,19 +355,32 @@ IMAGE_OBJS = tkImage.o tkImgBmap.o tkImgGIF.o tkImgPPM.o tkImgPhoto.o
TEXT_OBJS = tkText.o tkTextBTree.o tkTextDisp.o tkTextImage.o tkTextIndex.o \
tkTextMark.o tkTextTag.o tkTextWind.o
+# either tkUnixFont.o (default) or tkUnixRFont.o (if --enable-xft)
+#
+FONT_OBJS = @UNIX_FONT_OBJS@
+
GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkClipboard.o \
tkCmds.o tkColor.o tkConfig.o tkConsole.o tkCursor.o tkError.o \
tkEvent.o tkFocus.o tkFont.o tkGet.o tkGC.o tkGeometry.o tkGrab.o \
tkGrid.o tkMain.o tkObj.o tkOldConfig.o tkOption.o tkPack.o tkPlace.o \
tkSelect.o tkStyle.o tkUndo.o tkUtil.o tkVisual.o tkWindow.o
+TTK_OBJS = \
+ ttkBlink.o ttkButton.o ttkCache.o ttkClamTheme.o ttkClassicTheme.o \
+ ttkDefaultTheme.o ttkElements.o ttkEntry.o ttkFrame.o ttkImage.o \
+ ttkInit.o ttkLabel.o ttkLayout.o ttkManager.o ttkNotebook.o \
+ ttkPanedwindow.o ttkProgress.o ttkScale.o ttkScrollbar.o ttkScroll.o \
+ ttkSeparator.o ttkSquare.o ttkState.o \
+ ttkTagSet.o ttkTheme.o ttkTrace.o ttkTrack.o ttkTreeview.o \
+ ttkWidget.o ttkStubInit.o
+
STUB_OBJS = tkStubInit.o tkStubLib.o
-STUB_LIB_OBJS = tkStubLib.o tkStubImg.o
+STUB_LIB_OBJS = tkStubLib.o ttkStubLib.o
X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
- tkUnixFocus.o tkUnixFont.o tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
+ tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
tkUnixSend.o tkUnixWm.o tkUnixXId.o
@@ -365,18 +391,25 @@ AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \
tkMacOSXKeyboard.o tkMacOSXKeyEvent.o tkMacOSXMenu.o \
tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \
tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \
- tkMacOSXSubwindows.o tkMacOSXTest.o tkMacOSXWindowEvent.o \
+ tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \
tkMacOSXWm.o tkMacOSXXStubs.o tkMacOSXCarbonEvents.o \
tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \
- xcolors.o xdraw.o xgc.o ximage.o xutil.o
+ xcolors.o xdraw.o xgc.o ximage.o xutil.o \
+ ttkMacOSXTheme.o
+
+AQUA_TKTEST_OBJS = tkMacOSXTest.o
OBJS = $(GENERIC_OBJS) $(WIDG_OBJS) $(CANV_OBJS) $(IMAGE_OBJS) $(TEXT_OBJS) \
- $(STUB_OBJS) $(@TK_WINDOWINGSYSTEM@_OBJS) @PLAT_OBJS@
+ $(STUB_OBJS) $(TTK_OBJS) \
+ $(@TK_WINDOWINGSYSTEM@_OBJS) @PLAT_OBJS@
TK_DECLS = \
$(GENERIC_DIR)/tk.decls \
$(GENERIC_DIR)/tkInt.decls
+TTK_DECLS = \
+ $(TTK_DIR)/ttk.decls
+
GENERIC_SRCS = \
$(GENERIC_DIR)/tk3d.c $(GENERIC_DIR)/tkArgv.c \
$(GENERIC_DIR)/tkAtom.c $(GENERIC_DIR)/tkBind.c \
@@ -413,10 +446,44 @@ GENERIC_SRCS = \
$(GENERIC_DIR)/tkTextImage.c \
$(GENERIC_DIR)/tkTextIndex.c $(GENERIC_DIR)/tkTextMark.c \
$(GENERIC_DIR)/tkTextTag.c $(GENERIC_DIR)/tkTextWind.c \
- $(GENERIC_DIR)/tkOldConfig.c \
+ $(GENERIC_DIR)/tkOldConfig.c $(GENERIC_DIR)/tkOldTest.c \
$(GENERIC_DIR)/tkSquare.c $(GENERIC_DIR)/tkTest.c \
$(GENERIC_DIR)/tkStubInit.c $(GENERIC_DIR)/tkStubLib.c
+TTK_SRCS = \
+ $(TTK_DIR)/ttkBlink.c \
+ $(TTK_DIR)/ttkButton.c \
+ $(TTK_DIR)/ttkCache.c \
+ $(TTK_DIR)/ttkClamTheme.c \
+ $(TTK_DIR)/ttkClassicTheme.c \
+ $(TTK_DIR)/ttkDefaultTheme.c \
+ $(TTK_DIR)/ttkElements.c \
+ $(TTK_DIR)/ttkEntry.c \
+ $(TTK_DIR)/ttkFrame.c \
+ $(TTK_DIR)/ttkImage.c \
+ $(TTK_DIR)/ttkInit.c \
+ $(TTK_DIR)/ttkLabel.c \
+ $(TTK_DIR)/ttkLayout.c \
+ $(TTK_DIR)/ttkManager.c \
+ $(TTK_DIR)/ttkNotebook.c \
+ $(TTK_DIR)/ttkPanedwindow.c \
+ $(TTK_DIR)/ttkProgress.c \
+ $(TTK_DIR)/ttkScale.c \
+ $(TTK_DIR)/ttkScrollbar.c \
+ $(TTK_DIR)/ttkScroll.c \
+ $(TTK_DIR)/ttkSeparator.c \
+ $(TTK_DIR)/ttkSquare.c \
+ $(TTK_DIR)/ttkState.c \
+ $(TTK_DIR)/ttkTagSet.c \
+ $(TTK_DIR)/ttkTheme.c \
+ $(TTK_DIR)/ttkTrace.c \
+ $(TTK_DIR)/ttkTrack.c \
+ $(TTK_DIR)/ttkTreeview.c \
+ $(TTK_DIR)/ttkWidget.c
+
+TTK_STUB_SRCS = \
+ $(TTK_DIR)/ttkStubInit.c $(TTK_DIR)/ttkStubLib.c
+
X11_SRCS = \
$(UNIX_DIR)/tkAppInit.c $(UNIX_DIR)/tkUnix.c \
$(UNIX_DIR)/tkUnix3d.c \
@@ -426,6 +493,7 @@ X11_SRCS = \
$(UNIX_DIR)/tkUnixDraw.c \
$(UNIX_DIR)/tkUnixEmbed.c $(UNIX_DIR)/tkUnixEvent.c \
$(UNIX_DIR)/tkUnixFocus.c \
+ $(UNIX_DIR)/tkUnixRFont.c \
$(UNIX_DIR)/tkUnixFont.c $(UNIX_DIR)/tkUnixInit.c \
$(UNIX_DIR)/tkUnixKey.c \
$(UNIX_DIR)/tkUnixMenu.c $(UNIX_DIR)/tkUnixMenubu.c \
@@ -454,7 +522,8 @@ AQUA_SRCS = \
$(GENERIC_DIR)/tkFileFilter.c $(GENERIC_DIR)/tkMacWinMenu.c \
$(GENERIC_DIR)/tkPointer.c $(UNIX_DIR)/tkUnix3d.c \
$(UNIX_DIR)/tkUnixScale.c $(XLIB_DIR)/xcolors.c $(XLIB_DIR)/xdraw.c \
- $(XLIB_DIR)/xgc.c $(XLIB_DIR)/ximage.c $(XLIB_DIR)/xutil.c
+ $(XLIB_DIR)/xgc.c $(XLIB_DIR)/ximage.c $(XLIB_DIR)/xutil.c \
+ $(TTK_DIR)/ttkMacOSXTheme.c
SRCS = $(GENERIC_SRCS) $(@TK_WINDOWINGSYSTEM@_SRCS) @PLAT_SRCS@
@@ -472,15 +541,28 @@ AQUA_PRIVATE_HDRS = $(MAC_OSX_DIR)/tkMacOSXPort.h $(MAC_OSX_DIR)/tkMacOSXInt.h
X11_PRIVATE_HDRS = $(UNIX_DIR)/tkUnixPort.h $(UNIX_DIR)/tkUnixInt.h
-HDRS = bltList.h \
- default.h ks_names.h tkPatch.h tk.h tkButton.h tkCanvas.h tkInt.h \
- tkPort.h tkScrollbar.h tkText.h
+# Currently private, eventually public
+TTK_HDRS = $(TTK_DIR)/ttkTheme.h $(TTK_DIR)/ttkDecls.h
+
+PUBLIC_HDRS = $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkDecls.h \
+ $(GENERIC_DIR)/tkPlatDecls.h $(@TK_WINDOWINGSYSTEM@_HDRS)
+
+# The private headers we want installed for install-private-headers
+PRIVATE_HDRS = $(GENERIC_DIR)/tkInt.h $(GENERIC_DIR)/tkIntDecls.h \
+ $(GENERIC_DIR)/tkIntPlatDecls.h $(GENERIC_DIR)/tkPort.h \
+ $(TTK_HDRS) $(@TK_WINDOWINGSYSTEM@_PRIVATE_HDRS)
DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
+SHELL_ENV = \
+ @LD_LIBRARY_PATH_VAR@="`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}"; \
+ export @LD_LIBRARY_PATH_VAR@; \
+ TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
+ TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY;
+
all: binaries libraries doc
-binaries: ${LIB_FILE} ${STUB_LIB_FILE} wish
+binaries: ${LIB_FILE} ${STUB_LIB_FILE} wish@EXEEXT@
libraries:
@@ -521,9 +603,9 @@ tkLibObjs:
objs: ${OBJS}
-wish: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@
+wish@EXEEXT@: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@
${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \
- $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o wish
+ $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o wish@EXEEXT@
# Resetting the LIB_RUNTIME_DIR below is required so that
# the generated tktest executable gets the build directory
@@ -531,12 +613,12 @@ wish: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@
# picking up an already installed version of the Tcl or
# Tk shared libraries.
-tktest: $(TKTEST_OBJS) $(TK_LIB_FILE)
- $(MAKE) tktest-real LIB_RUNTIME_DIR=`pwd`:$(TCL_BIN_DIR)
+tktest@EXEEXT@: $(TKTEST_OBJS) $(TK_LIB_FILE)
+ $(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)"
tktest-real:
${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ \
- $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o tktest
+ $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o tktest@EXEEXT@
# FIXME: This xttest rule seems to be broken in a number of ways.
# It should use CC_SEARCH_FLAGS, it does not include the shared
@@ -554,52 +636,53 @@ xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE)
# args to tcltest, ie:
# % make test TESTFLAGS="-verbose bps -file fileName.test"
-test: tktest
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
- ./tktest $(TOP_DIR)/tests/all.tcl -geometry +0+0 \
- $(TESTFLAGS) $(TCLTESTARGS)
+test: test-classic test-ttk
+
+test-classic: tktest@EXEEXT@
+ $(SHELL_ENV) ./tktest@EXEEXT@ $(TEST_DIR)/all.tcl -geometry +0+0 $(TESTFLAGS)
+
+test-ttk: tktest@EXEEXT@
+ $(SHELL_ENV) ./tktest@EXEEXT@ $(TEST_DIR)/ttk/all.tcl -geometry +0+0 \
+ $(TESTFLAGS)
# Tests with different languages
-testlang: tktest
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
+testlang: tktest@EXEEXT@
+ $(SHELL_ENV) \
for lang in $(LOCALES) ; \
do \
LANG=$(lang); export LANG; \
- ./tktest $(TOP_DIR)/tests/all.tcl -geometry +0+0 \
- $(TESTFLAGS) $(TCLTESTARGS); \
+ ./tktest@EXEEXT@ $(TEST_DIR)/all.tcl -geometry +0+0 \
+ $(TESTFLAGS); \
done
# Useful target to launch a built tktest with the proper path,...
-runtest: tktest
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
- ./tktest
+runtest: tktest@EXEEXT@
+ $(SHELL_ENV) ./tktest@EXEEXT@
# This target can be used to run wish from the build directory
# via `make shell` or `make shell SCRIPT=/tmp/foo.tcl`
-shell: wish
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
- ./wish $(SCRIPT)
+shell: wish@EXEEXT@
+ $(SHELL_ENV) ./wish@EXEEXT@ $(SCRIPT)
+
+demo:
+ $(SHELL_ENV) ./wish@EXEEXT@ $(TOP_DIR)/library/demos/widget
# This target can be used to run wish inside either gdb or insight
-gdb: wish
- @echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}" > gdb.run
+gdb: wish@EXEEXT@
+ @echo "set env @LD_LIBRARY_PATH_VAR@=\"`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}\"" > gdb.run
@echo "set env TCL_LIBRARY=@TCL_SRC_DIR@/library" >> gdb.run
@echo "set env TK_LIBRARY=@TK_SRC_DIR@/library" >> gdb.run
- gdb ./wish --command=gdb.run
+ gdb ./wish@EXEEXT@ --command=gdb.run
rm gdb.run
+VALGRINDARGS=--tool=memcheck --num-callers=8 --leak-resolution=high --leak-check=yes --show-reachable=yes -v
+
+valgrind: tktest@EXEEXT@
+ $(SHELL_ENV) valgrind $(VALGRINDARGS) ./tktest@EXEEXT@ $(TEST_DIR)/all.tcl -geometry +0+0 -singleproc 1 $(TESTFLAGS)
+
+valgrindshell: tktest@EXEEXT@
+ $(SHELL_ENV) valgrind $(VALGRINDARGS) ./tktest@EXEEXT@ $(SCRIPT)
+
INSTALL_TARGETS = install-binaries install-libraries install-demos install-doc @EXTRA_INSTALL@
install: $(INSTALL_TARGETS)
@@ -613,13 +696,14 @@ install-strip:
# some ranlibs write to current directory, and this might not always be
# possible (e.g. if installing as root).
-install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish
- @for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) $(PKG_INSTALL_DIR); \
+install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) wish@EXEEXT@
+ @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" \
+ "$(PKG_INSTALL_DIR)" "$(CONFIG_INSTALL_DIR)" ; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ mkdir -p "$$i"; \
+ chmod 755 "$$i"; \
else true; \
fi; \
done;
@@ -628,26 +712,21 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish
fi
@if test "x$(TK_SHARED_BUILD)" = "x1"; then \
echo "Creating package index $(PKG_INDEX)"; \
- rm -f $(PKG_INDEX); \
+ rm -f "$(PKG_INDEX)"; \
(\
+ echo "if {[catch {package present Tcl 8.5.0}]} { return }";\
relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\
- echo "if {[package vcompare [package provide Tcl] $(TCLVERSION)] != 0} { return }";\
- echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)\
+ echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL)\
[list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\
- ) > $(PKG_INDEX); \
+ ) > "$(PKG_INDEX)"; \
fi
@echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
@@INSTALL_LIB@
- @chmod 555 $(LIB_INSTALL_DIR)/$(LIB_FILE)
- @if test "$(TK_BUILD_EXP_FILE)" != ""; then \
- echo "Installing $(TK_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
- $(INSTALL_DATA) $(TK_BUILD_EXP_FILE) \
- $(LIB_INSTALL_DIR)/$(TK_EXP_FILE); \
- fi
- @echo "Installing wish as $(BIN_INSTALL_DIR)/wish$(VERSION)"
- @$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish$(VERSION)
- @echo "Installing tkConfig.sh to $(LIB_INSTALL_DIR)/"
- @$(INSTALL_DATA) tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh
+ @chmod 555 "$(LIB_INSTALL_DIR)"/$(LIB_FILE)
+ @echo "Installing wish@EXEEXT@ as $(BIN_INSTALL_DIR)/wish$(VERSION)@EXEEXT@"
+ @$(INSTALL_PROGRAM) wish@EXEEXT@ "$(BIN_INSTALL_DIR)"/wish$(VERSION)@EXEEXT@
+ @echo "Installing tkConfig.sh to $(CONFIG_INSTALL_DIR)/"
+ @$(INSTALL_DATA) tkConfig.sh "$(CONFIG_INSTALL_DIR)"/tkConfig.sh
@if test "$(STUB_LIB_FILE)" != "" ; then \
echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \
@INSTALL_STUB_LIB@ ; \
@@ -656,15 +735,15 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish
install-libraries: libraries
@if test "$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)" != ""; then \
- XLIB_INCLUDE_INSTALL_DIR=$(INCLUDE_INSTALL_DIR)/X11; fi; \
- for i in $(INCLUDE_INSTALL_DIR) $${XLIB_INCLUDE_INSTALL_DIR} \
- $(SCRIPT_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)/images \
- $(SCRIPT_INSTALL_DIR)/msgs; \
+ XLIB_INCLUDE_INSTALL_DIR="$(INCLUDE_INSTALL_DIR)"/X11; fi; \
+ for i in "$(INCLUDE_INSTALL_DIR)" "$${XLIB_INCLUDE_INSTALL_DIR}" \
+ "$(SCRIPT_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)"/images \
+ "$(SCRIPT_INSTALL_DIR)"/msgs "$(SCRIPT_INSTALL_DIR)"/ttk; \
do \
- if [ ! -d $$i ] ; then \
+ if [ -n "$$i" -a ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ mkdir -p "$$i"; \
+ chmod 755 "$$i"; \
else true; \
fi; \
done;
@@ -672,108 +751,109 @@ install-libraries: libraries
chmod +x $(SRC_DIR)/install-sh; \
fi
@echo "Installing header files";
- @for i in $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkDecls.h \
- $(GENERIC_DIR)/tkPlatDecls.h $(@TK_WINDOWINGSYSTEM@_HDRS) ; \
+ @for i in $(PUBLIC_HDRS); \
do \
- $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \
+ $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"; \
done;
@list='$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)'; for i in $$list ; \
do \
- $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/X11; \
+ $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"/X11; \
done;
@echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
- @for i in $(TOP_DIR)/library/*.tcl $(GENERIC_DIR)/prolog.ps \
+ @for i in $(TOP_DIR)/library/*.tcl \
$(TOP_DIR)/library/tclIndex $(UNIX_DIR)/tkAppInit.c; \
do \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \
+ done;
+ @echo "Installing library ttk directory";
+ @for i in $(TOP_DIR)/library/ttk/*.tcl; \
+ do \
+ if [ -f $$i ] ; then \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/ttk; \
+ fi; \
done;
@echo "Installing library images directory";
@for i in $(TOP_DIR)/library/images/*; \
do \
if [ -f $$i ] ; then \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/images; \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/images; \
fi; \
done;
@echo "Installing translation directory";
@for i in $(TOP_DIR)/library/msgs/*.msg; \
do \
if [ -f $$i ] ; then \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/msgs; \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/msgs; \
fi; \
done;
install-demos:
- @for i in $(SCRIPT_INSTALL_DIR) \
- $(SCRIPT_INSTALL_DIR)/demos \
- $(SCRIPT_INSTALL_DIR)/demos/images ; \
+ @for i in "$(DEMO_INSTALL_DIR)" "$(DEMO_INSTALL_DIR)"/images ; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ mkdir -p "$$i"; \
+ chmod 755 "$$i"; \
else true; \
fi; \
done;
- @echo "Installing demos to $(SCRIPT_INSTALL_DIR)/demos/";
+ @echo "Installing demos to $(DEMO_INSTALL_DIR)/";
@for i in $(TOP_DIR)/library/demos/*; \
do \
if [ -f $$i ] ; then \
sed -e '3 s|exec wish|exec wish$(VERSION)|' \
- $$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \
+ $$i > "$(DEMO_INSTALL_DIR)"/`basename $$i`; \
fi; \
done;
@for i in $(DEMOPROGS); \
do \
if test $$i = "square"; then \
- rm -f $(SCRIPT_INSTALL_DIR)/demos/$$i; \
+ rm -f "$(DEMO_INSTALL_DIR)"/$$i; \
else \
- chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \
+ chmod 755 "$(DEMO_INSTALL_DIR)"/$$i; \
fi; \
done;
@echo "Installing demo images";
@for i in $(TOP_DIR)/library/demos/images/*; \
do \
if [ -f $$i ] ; then \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
+ $(INSTALL_DATA) $$i "$(DEMO_INSTALL_DIR)"/images; \
fi; \
done;
install-doc:
- @if test ! -x $(UNIX_DIR)/installManPage; then \
- chmod +x $(UNIX_DIR)/installManPage; \
- fi
- @for i in $(MAN_INSTALL_DIR) $(MAN1_INSTALL_DIR) $(MAN3_INSTALL_DIR) $(MANN_INSTALL_DIR) ; \
+ @for i in "$(MAN_INSTALL_DIR)" "$(MAN1_INSTALL_DIR)" "$(MAN3_INSTALL_DIR)" "$(MANN_INSTALL_DIR)" ; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ mkdir -p "$$i"; \
+ chmod 755 "$$i"; \
else true; \
fi; \
done;
@echo "Installing and cross-linking top-level (.1) docs";
@for i in $(TOP_DIR)/doc/*.1; do \
- $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i $(MAN1_INSTALL_DIR); \
+ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MAN1_INSTALL_DIR)"; \
done
@echo "Installing and cross-linking C API (.3) docs";
@for i in $(TOP_DIR)/doc/*.3; do \
- $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i $(MAN3_INSTALL_DIR); \
+ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MAN3_INSTALL_DIR)"; \
done
@echo "Installing and cross-linking command (.n) docs";
@for i in $(TOP_DIR)/doc/*.n; do \
- $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i $(MANN_INSTALL_DIR); \
+ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MANN_INSTALL_DIR)"; \
done
# Optional target to install private headers
install-private-headers: libraries
- @for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \
+ @for i in "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ mkdir -p "$$i"; \
+ chmod 755 "$$i"; \
else true; \
fi; \
done;
@@ -781,26 +861,26 @@ install-private-headers: libraries
chmod +x $(SRC_DIR)/install-sh; \
fi
@echo "Installing private header files";
- @for i in $(GENERIC_DIR)/tkInt.h $(GENERIC_DIR)/tkIntDecls.h \
- $(GENERIC_DIR)/tkIntPlatDecls.h \
- $(@TK_WINDOWINGSYSTEM@_PRIVATE_HDRS); \
+ @for i in $(PRIVATE_HDRS); \
do \
- $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \
+ $(INSTALL_DATA) $$i "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \
done;
- @sed -e 's#\.\./unix/##' $(GENERIC_DIR)/tkPort.h > tkPort.h; \
- $(INSTALL_DATA) tkPort.h $(PRIVATE_INCLUDE_INSTALL_DIR); \
- rm -f tkPort.h
+ @if test -f tkConfig.h; then\
+ $(INSTALL_DATA) tkConfig.h "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \
+ fi;
Makefile: $(UNIX_DIR)/Makefile.in
$(SHELL) config.status
+#tkConfig.h: $(UNIX_DIR)/tkConfig.h.in
+# $(SHELL) config.status
clean:
rm -f *.a *.o libtk* core errs *~ \#* TAGS *.E a.out \
- errors wish tktest lib.exp Tk *.rsrc
+ errors wish@EXEEXT@ tktest@EXEEXT@ lib.exp Tk *.rsrc
distclean: clean
rm -rf Makefile config.status config.cache config.log tkConfig.sh \
- $(PACKAGE).* prototype *.plist Tk.framework
+ $(PACKAGE).* prototype tkConfig.h *.plist Tk.framework
depend:
makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
@@ -813,7 +893,7 @@ depend:
# execute concurrently with the renaming and recompiling of that same object
# file in the target below.
-tkTestInit.o: $(UNIX_DIR)/tkAppInit.c wish
+tkTestInit.o: $(UNIX_DIR)/tkAppInit.c wish@EXEEXT@
@if test -f tkAppInit.o ; then \
rm -f tkAppInit.sav; \
mv tkAppInit.o tkAppInit.sav; \
@@ -1008,6 +1088,9 @@ tkImgPPM.o: $(GENERIC_DIR)/tkImgPPM.c
tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
+tkOldTest.o: $(GENERIC_DIR)/tkOldTest.c
+ $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkOldTest.c
+
tkTest.o: $(GENERIC_DIR)/tkTest.c
$(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkTest.c
@@ -1044,9 +1127,6 @@ tkStubInit.o: $(GENERIC_DIR)/tkStubInit.c
tkStubLib.o: $(GENERIC_DIR)/tkStubLib.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubLib.c
-tkStubImg.o: $(GENERIC_DIR)/tkStubImg.c
- $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubImg.c
-
tkUndo.o: $(GENERIC_DIR)/tkUndo.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkUndo.c
@@ -1083,7 +1163,11 @@ tkUnixFocus.o: $(UNIX_DIR)/tkUnixFocus.c
tkUnixFont.o: $(UNIX_DIR)/tkUnixFont.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixFont.c
-tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
+# NB: tkUnixRFont.o uses nondefault CFLAGS
+tkUnixRFont.o: $(UNIX_DIR)/tkUnixRFont.c
+ $(CC) -c $(CC_SWITCHES) $(XFT_CFLAGS) $(UNIX_DIR)/tkUnixRFont.c
+
+tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c tkConfig.sh
$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(UNIX_DIR)/tkUnixInit.c
@@ -1159,8 +1243,8 @@ tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c
tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
-tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
- $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
+tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c tkConfig.sh
+ $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(MAC_OSX_DIR)/tkMacOSXInit.c
tkMacOSXKeyboard.o: $(MAC_OSX_DIR)/tkMacOSXKeyboard.c
@@ -1187,6 +1271,9 @@ tkMacOSXNotify.o: $(MAC_OSX_DIR)/tkMacOSXNotify.c
tkMacOSXRegion.o: $(MAC_OSX_DIR)/tkMacOSXRegion.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXRegion.c
+tkMacOSXScale.o: $(MAC_OSX_DIR)/tkMacOSXScale.c
+ $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScale.c
+
tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScrlbr.c
@@ -1197,7 +1284,7 @@ tkMacOSXSubwindows.o: $(MAC_OSX_DIR)/tkMacOSXSubwindows.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSubwindows.c
tkMacOSXTest.o: $(MAC_OSX_DIR)/tkMacOSXTest.c
- $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXTest.c
+ $(CC) -c $(APP_CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXTest.c
tkMacOSXWindowEvent.o: $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c
@@ -1232,6 +1319,102 @@ ximage.o: $(XLIB_DIR)/ximage.c
xutil.o: $(XLIB_DIR)/xutil.c
$(CC) -c $(CC_SWITCHES) $(XLIB_DIR)/xutil.c
+ttkBlink.o: $(TTK_DIR)/ttkBlink.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkBlink.c
+
+ttkButton.o: $(TTK_DIR)/ttkButton.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkButton.c
+
+ttkCache.o: $(TTK_DIR)/ttkCache.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkCache.c
+
+ttkClamTheme.o: $(TTK_DIR)/ttkClamTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkClamTheme.c
+
+ttkClassicTheme.o: $(TTK_DIR)/ttkClassicTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkClassicTheme.c
+
+ttkDefaultTheme.o: $(TTK_DIR)/ttkDefaultTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkDefaultTheme.c
+
+ttkElements.o: $(TTK_DIR)/ttkElements.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkElements.c
+
+ttkEntry.o: $(TTK_DIR)/ttkEntry.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkEntry.c
+
+ttkFrame.o: $(TTK_DIR)/ttkFrame.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkFrame.c
+
+ttkImage.o: $(TTK_DIR)/ttkImage.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkImage.c
+
+ttkInit.o: $(TTK_DIR)/ttkInit.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkInit.c
+
+ttkLabel.o: $(TTK_DIR)/ttkLabel.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkLabel.c
+
+ttkLayout.o: $(TTK_DIR)/ttkLayout.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkLayout.c
+
+ttkManager.o: $(TTK_DIR)/ttkManager.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkManager.c
+
+ttkNotebook.o: $(TTK_DIR)/ttkNotebook.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkNotebook.c
+
+ttkPanedwindow.o: $(TTK_DIR)/ttkPanedwindow.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkPanedwindow.c
+
+ttkProgress.o: $(TTK_DIR)/ttkProgress.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkProgress.c
+
+ttkScale.o: $(TTK_DIR)/ttkScale.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkScale.c
+
+ttkScroll.o: $(TTK_DIR)/ttkScroll.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkScroll.c
+
+ttkScrollbar.o: $(TTK_DIR)/ttkScrollbar.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkScrollbar.c
+
+ttkSeparator.o: $(TTK_DIR)/ttkSeparator.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkSeparator.c
+
+ttkSquare.o: $(TTK_DIR)/ttkSquare.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkSquare.c
+
+ttkState.o: $(TTK_DIR)/ttkState.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkState.c
+
+ttkStubInit.o: $(TTK_DIR)/ttkStubInit.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkStubInit.c
+
+ttkStubLib.o: $(TTK_DIR)/ttkStubLib.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkStubLib.c
+
+ttkTagSet.o: $(TTK_DIR)/ttkTagSet.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTagSet.c
+
+ttkTheme.o: $(TTK_DIR)/ttkTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTheme.c
+
+ttkTrace.o: $(TTK_DIR)/ttkTrace.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTrace.c
+
+ttkTrack.o: $(TTK_DIR)/ttkTrack.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTrack.c
+
+ttkTreeview.o: $(TTK_DIR)/ttkTreeview.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTreeview.c
+
+ttkWidget.o: $(TTK_DIR)/ttkWidget.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkWidget.c
+
+ttkMacOSXTheme.o: $(MAC_OSX_DIR)/ttkMacOSXTheme.c
+ $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/ttkMacOSXTheme.c
+
.c.o:
$(CC) -c $(CC_SWITCHES) $<
@@ -1245,9 +1428,15 @@ $(GENERIC_DIR)/tkStubInit.c: $(GENERIC_DIR)/tk.decls \
@echo "Developers may want to run \"make genstubs\" to regenerate."
@echo "This warning can be safely ignored, do not report as a bug!"
+$(TTK_DIR)/ttkStubInit.c: $(TTK_DIR)/ttk.decls
+ @echo "Warning: ttkStubInit.c may be out of date."
+ @echo "Developers may want to run \"make genstubs\" to regenerate."
+ @echo "This warning can be safely ignored, do not report as a bug!"
+
genstubs:
$(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \
$(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls
+ $(TCL_EXE) $(TTK_DIR)/ttkGenStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.decls
#
# Target to check that all exported functions have an entry in the stubs
@@ -1259,7 +1448,7 @@ checkstubs: $(TK_LIB_FILE)
| awk '$$2 ~ /^[TDBCS]$$/ { sub("^_", "", $$3); print $$3 }' \
| sort -n`; do \
match=0; \
- for j in $(TK_DECLS); do \
+ for j in $(TK_DECLS) $(TTK_DECLS); do \
if [ `grep -c "$$i *(" $$j` -gt 0 ]; then \
match=1; \
fi; \
@@ -1275,27 +1464,27 @@ checkuchar:
-egrep isalnum\|isalpha\|iscntrl\|isdigit\|islower\|isprint\|ispunct\|isspace\|isupper\|isxdigit\|toupper\|tolower $(SRCS) | grep -v UCHAR
#
-# Target to make sure that only symbols with "Tk" prefixes are
-# exported.
+# Target to make sure that only symbols with "Tk", "tk", "Ttk", "ttk" or "X"
+# prefixes are exported.
#
checkexports: $(TK_LIB_FILE)
-@nm -p $(TK_LIB_FILE) \
| awk '$$2 ~ /^[TDBCS]$$/ { sub("^_", "", $$3); print $$3 }' \
- | sort -n | grep -E -v '^([Tt]k|_?X)' || true
+ | sort -n | grep -E -v '^([Tt]t?k|_?X)' || true
#
# Target to create a Tk RPM for Linux. Requires that you be on a Linux
# system.
#
-rpm: all /bin/rpm
+rpm: all
rm -f THIS.TCL.SPEC
echo "%define _builddir `pwd`" > THIS.TK.SPEC
echo "%define _rpmdir `pwd`/RPMS" >> THIS.TK.SPEC
cat tk.spec >> THIS.TK.SPEC
mkdir -p RPMS/i386
- rpm -bb THIS.TK.SPEC
+ rpmbuild -bb THIS.TK.SPEC
mv RPMS/i386/*.rpm .
rm -rf RPMS THIS.TK.SPEC
@@ -1310,8 +1499,15 @@ DISTNAME = tk${VERSION}${PATCH_LEVEL}
ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip
DISTDIR = $(DISTROOT)/$(DISTNAME)
TCLDIR = @TCL_SRC_DIR@
-
-dist:
+$(UNIX_DIR)/configure: $(UNIX_DIR)/configure.in $(UNIX_DIR)/tcl.m4 \
+ $(UNIX_DIR)/aclocal.m4
+ cd $(UNIX_DIR); autoconf
+$(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure
+ cd $(MAC_OSX_DIR); autoconf
+$(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure
+ cd $(MAC_OSX_DIR); autoheader; touch $@
+
+dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(MAC_OSX_DIR)/configure genstubs
rm -rf $(DISTDIR)
mkdir -p $(DISTDIR)/unix
cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix
@@ -1320,7 +1516,8 @@ dist:
cp $(UNIX_DIR)/configure $(UNIX_DIR)/configure.in $(UNIX_DIR)/tk.spec \
$(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \
$(UNIX_DIR)/tkConfig.sh.in $(TCLDIR)/unix/install-sh \
- $(UNIX_DIR)/README $(UNIX_DIR)/installManPage $(DISTDIR)/unix
+ $(UNIX_DIR)/README $(UNIX_DIR)/installManPage \
+ $(UNIX_DIR)/tkConfig.h.in $(DISTDIR)/unix
chmod 775 $(DISTDIR)/unix/configure $(DISTDIR)/unix/configure.in
chmod +x $(DISTDIR)/unix/install-sh
mkdir $(DISTDIR)/bitmaps
@@ -1331,13 +1528,16 @@ dist:
fi; \
done;)
mkdir $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/*.c $(GENERIC_DIR)/*.h $(GENERIC_DIR)/prolog.ps \
- $(DISTDIR)/generic
+ cp -p $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic
cp -p $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
cp -p $(GENERIC_DIR)/README $(DISTDIR)/generic
- cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog $(TOP_DIR)/README \
+ cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog \
+ $(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README \
$(TOP_DIR)/license.terms $(DISTDIR)
rm -f $(DISTDIR)/generic/blt*.[ch]
+ mkdir $(DISTDIR)/generic/ttk
+ cp -p $(TTK_DIR)/*.[ch] $(TTK_DIR)/ttk.decls \
+ $(TTK_DIR)/ttkGenStubs.tcl $(DISTDIR)/generic/ttk
mkdir $(DISTDIR)/win
cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win
cp $(TOP_DIR)/win/configure.in \
@@ -1345,46 +1545,39 @@ dist:
$(TOP_DIR)/win/tkConfig.sh.in \
$(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \
$(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.c $(TOP_DIR)/win/*.h $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.bat $(DISTDIR)/win
+ cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/*.bat
cp -p $(TOP_DIR)/win/makefile.* $(DISTDIR)/win
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/makefile.*
cp -p $(TOP_DIR)/win/rules.vc $(DISTDIR)/win
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/rules.vc
cp -p $(TOP_DIR)/win/README $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/lamp.bmp $(DISTDIR)/win
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win
mkdir $(DISTDIR)/win/rc
cp -p $(TOP_DIR)/win/wish.exe.manifest.in $(DISTDIR)/win/
- cp -p $(TOP_DIR)/win/rc/*.rc $(TOP_DIR)/win/rc/*.cur \
- $(TOP_DIR)/win/rc/*.ico $(TOP_DIR)/win/rc/*.bmp \
- $(DISTDIR)/win/rc
+ cp -p $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/rc/*.rc
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/wish.exe.manifest.in
- mkdir $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/tkMacProjects.sea.hqx $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.c $(TOP_DIR)/mac/*.h $(TOP_DIR)/mac/*.r \
- $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/README $(DISTDIR)/mac
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.pch $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.doc $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.tcl $(DISTDIR)/mac
mkdir $(DISTDIR)/macosx
- cp -p $(MAC_OSX_DIR)/Makefile $(MAC_OSX_DIR)/README \
- $(MAC_OSX_DIR)/Wish.icns $(MAC_OSX_DIR)/*.c \
- $(MAC_OSX_DIR)/*.h $(MAC_OSX_DIR)/*.in \
- $(MAC_OSX_DIR)/*.r $(DISTDIR)/macosx
+ cp -p $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \
+ $(MAC_OSX_DIR)/Wish.icns $(MAC_OSX_DIR)/*.[chr] \
+ $(MAC_OSX_DIR)/*.in $(MAC_OSX_DIR)/*.ac \
+ $(MAC_OSX_DIR)/*.xcconfig $(MAC_OSX_DIR)/configure \
+ $(DISTDIR)/macosx
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/macosx
mkdir $(DISTDIR)/macosx/Wish.pbproj
cp -p $(MAC_OSX_DIR)/Wish.pbproj/*.pbx* $(DISTDIR)/macosx/Wish.pbproj
+ mkdir $(DISTDIR)/macosx/Wish.xcode
+ cp -p $(MAC_OSX_DIR)/Wish.xcode/*.pbx* $(DISTDIR)/macosx/Wish.xcode
+ mkdir $(DISTDIR)/macosx/Wish.xcodeproj
+ cp -p $(MAC_OSX_DIR)/Wish.xcodeproj/*.pbx* \
+ $(DISTDIR)/macosx/Wish.xcodeproj
mkdir $(DISTDIR)/compat
cp -p $(TOP_DIR)/license.terms $(TCLDIR)/compat/unistd.h \
$(TCLDIR)/compat/stdlib.h $(TCLDIR)/compat/limits.h \
$(DISTDIR)/compat
mkdir $(DISTDIR)/xlib
- cp -p $(XLIB_DIR)/*.h $(XLIB_DIR)/*.c $(DISTDIR)/xlib
+ cp -p $(XLIB_DIR)/*.[ch] $(DISTDIR)/xlib
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/xlib
mkdir $(DISTDIR)/xlib/X11
cp -p $(XLIB_DIR)/X11/*.h $(DISTDIR)/xlib/X11
@@ -1393,6 +1586,8 @@ dist:
cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \
$(TOP_DIR)/library/tclIndex \
$(DISTDIR)/library
+ mkdir $(DISTDIR)/library/ttk
+ cp -p $(TOP_DIR)/library/ttk/*.tcl $(DISTDIR)/library/ttk
mkdir $(DISTDIR)/library/images
@(cd $(TOP_DIR); for i in library/images/* ; do \
if [ -f $$i ] ; then \
@@ -1407,6 +1602,7 @@ dist:
done;)
mkdir $(DISTDIR)/library/demos
cp -pr $(TOP_DIR)/library/demos/*.tcl \
+ $(TOP_DIR)/library/demos/*.msg \
$(TOP_DIR)/library/demos/tclIndex \
$(TOP_DIR)/library/demos/browse \
$(TOP_DIR)/library/demos/hello $(TOP_DIR)/library/demos/ixset \
@@ -1427,14 +1623,11 @@ dist:
cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \
$(TCLDIR)/doc/man.macros $(DISTDIR)/doc
mkdir $(DISTDIR)/tests
- cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/tests/*.test \
- $(TOP_DIR)/tests/*.tcl $(TOP_DIR)/tests/README \
- $(TOP_DIR)/tests/option.file* $(DISTDIR)/tests
-
-#
-# The following target can only be used for non-patch releases. Use
-# the "allpatch" target below for patch releases.
-#
+ cp -p $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \
+ $(TEST_DIR)/README $(TEST_DIR)/*.{gif,ppm,xbm} \
+ $(TEST_DIR)/option.file* $(DISTDIR)/tests
+ mkdir $(DISTDIR)/tests/ttk
+ cp -p $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk
alldist: dist
rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME)
@@ -1442,23 +1635,6 @@ alldist: dist
gzip -9 $(DISTNAME)-src.tar; zip -qr8 $(ZIPNAME) $(DISTNAME)
#
-# The target below is similar to "alldist" except it works for patch
-# releases. It is needed because patch releases are peculiar: the
-# patch designation appears in the name of the compressed file
-# (e.g. tk8.0p1.tar.gz) but the extracted source directory doesn't
-# include the patch designation (e.g. tk8.0).
-#
-
-allpatch: dist
- rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME)
- mv $(DISTROOT)/tk${VERSION} $(DISTROOT)/old
- mv $(DISTROOT)/$(DISTNAME) $(DISTROOT)/tk${VERSION}
- cd $(DISTROOT); tar cf $(DISTNAME)-src.tar tk${VERSION}; \
- gzip -9 $(DISTNAME)-src.tar; zip -r8 $(ZIPNAME) tk${VERSION}
- mv $(DISTROOT)/tk${VERSION} $(DISTROOT)/$(DISTNAME)
- mv $(DISTROOT)/old $(DISTROOT)/tk${VERSION}
-
-#
# This target creates the HTML folder for Tcl & Tk and places it
# in DISTDIR/html. It uses the tcltk-man2html.tcl tool from
# the Tcl group's tool workspace. It depends on the Tcl & Tk being
@@ -1478,29 +1654,12 @@ html-tk:
BUILD_HTML = \
@if test -f "$(BUILD_TCLSH)"; then \
- @LD_LIBRARY_PATH_VAR@=$(TCL_BIN_DIR):$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TCLSH="$(BUILD_TCLSH)"; else \
+ $(SHELL_ENV) TCLSH="$(BUILD_TCLSH)"; else \
TCLSH="$(TCL_EXE)"; fi ;\
- $${TCLSH} $(TOOL_DIR)/tcltk-man2html.tcl --htmldir=$(HTML_INSTALL_DIR) \
+ "$${TCLSH}" $(TOOL_DIR)/tcltk-man2html.tcl --htmldir="$(HTML_INSTALL_DIR)" \
--srcdir=$(TOP_DIR)/.. $(BUILD_HTML_FLAGS)
#
-# Target to create a Macintosh version of the distribution. This will
-# do a normal distribution and then massage the output to prepare it
-# for moving to the Mac platform. This requires a few scripts and
-# programs found only in the Tcl greoup's tool workspace.
-#
-
-macdist: dist
- rm -f $(DISTDIR)/mac/tkMacProjects.sea.hqx
- $(TCL_EXE) $(TOOL_DIR)/man2html.tcl $(DISTDIR)/tmp ../.. tk$(VERSION)
- mv $(DISTDIR)/tmp/tk$(VERSION) $(DISTDIR)/html
- rm -rf $(DISTDIR)/doc
- rm -rf $(DISTDIR)/tmp
- $(TCL_EXE) $(TOOL_DIR)/cvtEOL.tcl $(DISTDIR)
-
-#
# Targets to build Solaris package of the distribution for the current
# architecture. To build stream packages for both sun4 and i86pc
# architectures:
diff --git a/unix/README b/unix/README
index cafe2c4..ea5c8fe 100644
--- a/unix/README
+++ b/unix/README
@@ -1,153 +1,173 @@
Tk UNIX README
--------------
-This is the directory where you configure, compile, test, and install
-UNIX versions of Tk. This directory also contains source files for Tk
-that are specific to UNIX.
+This is the directory where you configure, compile, test, and install UNIX
+versions of Tk. This directory also contains source files for Tk that are
+specific to UNIX.
The information in this file is maintained at:
http://www.tcl.tk/doc/howto/compile.html
-For information on platforms where Tcl/Tk is known to compile, along
-with any porting notes for getting it to work on those platforms, see:
+For information on platforms where Tcl/Tk is known to compile, along with any
+porting notes for getting it to work on those platforms, see:
http://www.tcl.tk/software/tcltk/platforms.html
-The rest of this file contains instructions on how to do this. The
-release should compile and run either "out of the box" or with trivial
-changes on any UNIX-like system that approximates POSIX, BSD, or System
-V. We know that it runs on workstations from Sun, H-P, DEC, IBM, and
-SGI, as well as PCs running Linux, BSDI, and SCO UNIX. To compile for
-a PC running Windows, see the README file in the directory ../win. To
-compile for Mac OS X, see the README file in the directory ../macosx. To
-compile for a classic Macintosh, see the README file in the directory ../mac.
+The rest of this file contains instructions on how to do this. The release
+should compile and run either "out of the box" or with trivial changes on any
+UNIX-like system that approximates POSIX, BSD, or System V. We know that it
+runs on workstations from Sun, H-P, DEC, IBM, and SGI, as well as PCs running
+Linux, BSDI, and SCO UNIX. To compile for a PC running Windows, see the README
+file in the directory ../win. To compile for MacOSX, see the README file in
+the directory ../macosx.
How To Compile And Install Tk:
------------------------------
(a) Make sure that the Tcl release is present in the directory
- ../../tcl<version> (or else use the "--with-tcl" switch described
- below). This release of Tk will only work with the equivalently
- version Tcl release. Also, be sure that you have configured Tcl before
- you configure Tk.
+ ../../tcl<version> (or else use the "--with-tcl" switch described below).
+ This release of Tk will only work with the equivalently versioned Tcl
+ release. Also, be sure that you have configured Tcl before you configure
+ Tk.
-(b) If you have already compiled Tk once in this directory and are now
+(b) Check for patches as described in ../README.
+
+(c) If you have already compiled Tk once in this directory and are now
preparing to compile again in the same directory but for a different
- platform, type "make distclean" to discard all the configuration
- information computed previously.
-
-(d) Type "./configure". This runs a configuration script created by GNU
- autoconf, which configures Tk for your system and creates a
- Makefile. The configure script allows you to customize the Tk
- configuration for your site; for details on how you can do this,
- type "./configure -help" or refer to the autoconf documentation (not
- included here). Tk's "configure" script supports the following
- special switches in addition to the standard ones:
+ platform, or if you have applied patches, type "make distclean" to discard
+ all the configuration information computed previously.
+
+(d) Type "./configure". This runs a configuration script created by GNU
+ autoconf, which configures Tk for your system and creates a Makefile. The
+ configure script allows you to customize the Tk configuration for your
+ site; for details on how you can do this, type "./configure -help" or
+ refer to the autoconf documentation (not included here). Tk's "configure"
+ script supports the following special switches in addition to the standard
+ ones:
+
--with-tcl=DIR Specifies the directory containing the Tcl
binaries and Tcl's platform-dependent
- configuration information. By default
- the Tcl directory is assumed to be in the
- location given by (a) above.
- --enable-threads If this switch is set, Tk will compile
- itself with multithreading support.
+ configuration information. By default the Tcl
+ directory is assumed to be in the location
+ given by (a) above.
+ --with-x=DIR Tells configure where to find an installation
+ of the X Window System. Not normally needed.
+ --enable-threads If this switch is set, Tk will compile itself
+ with multithreading support.
--enable-shared If this switch is specified, Tk will compile
itself as a shared library if it can figure
- out how to do that on this platform. This
- is the default on platforms where we know
- how to build shared libraries.
+ out how to do that on this platform. This is
+ the default on platforms where we know how to
+ build shared libraries.
--disable-shared If this switch is specified, Tk will compile
itself as a static library.
- --enable-symbols build with debugging symbols By default
- standard debugging symbols are used. You
- can specify the value "mem" to include
+ --disable-rpath Turns off use of the rpath link option on
+ platforms that would otherwise use it.
+ --enable-symbols Build with debugging symbols. By default
+ standard debugging symbols are used. You can
+ specify the value "mem" to include
TCL_MEM_DEBUG memory debugging.
- --disable-symbols build without debugging symbols
- --enable-64bit enable 64bit support (where applicable)
- --disable-64bit disable 64bit support (where applicable)
- --enable-64bit-vis enable 64bit Sparc VIS support
- --disable-64bit-vis disable 64bit Sparc VIS support
+ --disable-symbols Build without debugging symbols
+ --enable-64bit Enable 64bit support (where applicable)
+ --disable-64bit Disable 64bit support (where applicable)
+ --enable-64bit-vis Enable 64bit Sparc VIS support
+ --disable-64bit-vis Disable 64bit Sparc VIS support
+ --disable-xft Disable support for antialiased fonts via the
+ Freetype/xft library. By default, this is
+ switched on whenever the configure script can
+ detect the required libraries.
--enable-man-symlinks Use symlinks for linking the manpages that
should be reachable under several names.
--enable-man-compression=PROG
Compress the manpages using PROG.
- Mac OS X only:
- --enable-framework package Tk as a framework.
- --disable-corefoundation disable use of CoreFoundation API.
- --enable-aqua use Aqua windowingsystem rather than X11,
- requires --enable-corefoundation with tcl & tk.
-
- Note: by default gcc will be used if it can be located on the PATH.
- if you want to use cc instead of gcc, set the CC environment variable
- to "cc" before running configure. It is not safe to change the Makefile
- to use gcc after configure is run.
-
- Note: be sure to use only absolute path names (those starting with "/")
- in the --prefix and --exec-prefix options.
-
-(e) Type "make". This will create a library archive called
- "libtk<version>.a" or "libtk<version>.so" and an interpreter
- application called "wish" that allows you to type Tcl commands
- interactively or execute script files.
-
-(f) If the make fails then you'll have to personalize the Makefile
- for your site or possibly modify the distribution in other ways.
- First check the porting Web page above to see if there are hints
- for compiling on your system. If you need to modify Makefile,
- there are comments at the beginning of it that describe the things
- you might want to change and how to change them.
-
-(g) Type "make install" to install Tk's binaries and script files in
- standard places. You'll need write permission on the installation
- directories to do this. The installation directories are
- determined by the "configure" script and may be specified with
- the --prefix and --exec-prefix options to "configure". See the
- Makefile for information on what directories were chosen; you
- can override these choices by modifying the "prefix" and
- "exec_prefix" variables in the Makefile.
-
-(h) At this point you can play with Tk by invoking the "wish"
- program and typing Tcl commands. However, if you haven't installed
- Tk then you'll first need to set your TK_LIBRARY environment
- variable to hold the full path name of the "library" subdirectory.
- If you haven't installed Tcl either then you'll need to set your
- TCL_LIBRARY environment variable as well (see the Tcl README file
- for information on this). Note that installed versions of wish,
- libtk.a, libtk.so, and the Tk library have a version number in their
- names, such as "wish8.4" or "libtk8.4.so"; to use the installed
- versions, either specify the version number or create a symbolic
- link (e.g. from "wish" to "wish8.4").
+ --enable-man-suffix=STRING
+ Add STRING to the name of each of the manual
+ pages. If specified without giving STRING, the
+ suffix will be "tk".
+
+ Mac OS X only:
+
+ --enable-framework Package Tk as a framework.
+ --disable-corefoundation Disable use of CoreFoundation API.
+ --enable-aqua Use Aqua windowingsystem rather than X11,
+ requires --enable-corefoundation with Tcl and
+ Tk.
+
+ Note: by default gcc will be used if it can be located on the PATH. If you
+ want to use cc instead of gcc, set the CC environment variable to "cc"
+ before running configure. It is not safe to change the Makefile to use gcc
+ after configure is run.
+
+ Note: be sure to use only absolute path names (those starting with "/") in
+ the --prefix and --exec-prefix options.
+
+(e) Type "make". This will create a library archive called "libtk<version>.a"
+ or "libtk<version>.so" and an interpreter application called "wish" that
+ allows you to type Tcl/Tk commands interactively or execute script files.
+ It will also create a stub library archive "libtkstub<version>.a" that
+ developers may link against other C code to produce loadable extensions
+ that call into Tk's public interface routines.
+
+(f) If the make fails then you'll have to personalize the Makefile for your
+ site or possibly modify the distribution in other ways. First check the
+ porting Web page above to see if there are hints for compiling on your
+ system. If you need to modify Makefile, there are comments at the
+ beginning of it that describe the things you might want to change and how
+ to change them.
+
+(g) Type "make install" to install Tk's binaries and script files in standard
+ places. You'll need write permission on the installation directories to do
+ this. The installation directories are determined by the "configure"
+ script and may be specified with the --prefix and --exec-prefix options to
+ "configure". See the Makefile for information on what directories were
+ chosen. You should not override these choices by modifying the Makefile,
+ or by copying files post-install. The installed binaries have embedded
+ within them path values relative to the install directory. If you change
+ your mind about where Tk should be installed, start this procedure over
+ again from step (a) so that the path embedded in the binaries agrees with
+ the install location.
+
+(h) At this point you can play with Tk by running the installed "wish"
+ executable, or via the "make shell" target, and typing Tcl/Tk commands at
+ the interactive prompt.
If you have trouble compiling Tk, see the URL noted above about working
-platforms. It contains information that people have provided about changes
-they had to make to compile Tk in various environments. We're also
-interested in hearing how to change the configuration setup so that Tk
-compiles on additional platforms "out of the box".
+platforms. It contains information that people have provided about changes
+they had to make to compile Tk in various environments. We're also interested
+in hearing how to change the configuration setup so that Tk compiles on
+additional platforms "out of the box".
+
+Note: Do not specify either of the TCL_LIBRARY and TK_LIBRARY environment
+variables in a production installation, as this can cause conflicts between
+different versions of the libraries. Instead, the libraries should have the
+correct locations of their associated script directories built into them.
Test suite
----------
-Tk has a substantial self-test suite, consisting of a set of scripts in
-the subdirectory "tests". To run the test suite just type "make test"
-in this directory. You should then see a printout of the test files
-processed. If any errors occur, you'll see a much more substantial
-printout for each error. In order to avoid false error reports, be sure
-to run the tests with an empty resource database (e.g., remove your
-.Xdefaults file or delete any entries starting with *). Also, don't
-try to do anything else with your display or keyboard while the tests
-are running, or you may get false violations. See the README file in
-the "tests" directory for more information on the test suite.
-
-If the test suite generates errors, most likely they are due to non-
-portable tests that are interacting badly with your system configuration.
-We are gradually eliminating the non-portable tests, but this release
-includes many new tests so there will probably be some portability
-problems. As long as the test suite doesn't core dump, it's probably
-safe to conclude that any errors represent portability problems in the
-test suite and not fundamental flaws with Tk.
+Tk has a substantial self-test suite, consisting of a set of scripts in the
+subdirectory "tests". To run the test suite just type "make test" in this
+directory. You should then see a printout of the test files processed. If any
+errors occur, you'll see a much more substantial printout for each error. In
+order to avoid false error reports, be sure to run the tests with an empty
+resource database (e.g., remove your .Xdefaults file or delete any entries
+starting with *). Also, don't try to do anything else with your display or
+keyboard while the tests are running, or you may get false violations. See the
+README file in the "tests" directory for more information on the test suite.
+
+If the test suite generates errors, most likely they are due to non-portable
+tests that are interacting badly with your system configuration. We are
+gradually eliminating the non-portable tests, but this release includes many
+new tests so there will probably be some portability problems. As long as the
+test suite doesn't core dump, it's probably safe to conclude that any errors
+represent portability problems in the test suite and not fundamental flaws
+with Tk.
There are also a number of visual tests for things such as screen layout,
-Postscript generation, etc. These tests all have to be run by manually
-enabling the "userInteraction" constraint when testing, and the results
-have to be verified visually.. This can be done with
- make test TESTFLAGS="-constraints userInteraction"
-Some tests will present a main window with a bunch of menus, which you can
-use to select various tests.
+Postscript generation, etc. These tests all have to be run by manually
+enabling the "userInteraction" constraint when testing, and the results have
+to be verified visually. This can be done with:
+
+ make test TESTFLAGS="-constraints userInteraction"
+
+Some tests will present a main window with a bunch of menus, which you can use
+to select various tests.
diff --git a/unix/aclocal.m4 b/unix/aclocal.m4
index bc7540d..90d2e39 100644
--- a/unix/aclocal.m4
+++ b/unix/aclocal.m4
@@ -1 +1 @@
-builtin(include,tcl.m4)
+builtin(include,../unix/tcl.m4)
diff --git a/unix/configure b/unix/configure
index 63c762c..a08ada4 100755
--- a/unix/configure
+++ b/unix/configure
@@ -1,59 +1,324 @@
#! /bin/sh
-
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Generated by GNU Autoconf 2.59 for tk 8.5.
#
+# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
-# Defaults:
-ac_help=
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --with-tcl directory containing tcl configuration (tclConfig.sh)"
-ac_help="$ac_help
- --enable-man-symlinks use symlinks for the manpages"
-ac_help="$ac_help
- --enable-man-compression=PROG
- compress the manpages with PROG"
-ac_help="$ac_help
- --enable-man-suffix=STRING
- use STRING as a suffix to manpage file names
- (default: tk)"
-ac_help="$ac_help
- --enable-threads build with threads"
-ac_help="$ac_help
- --enable-shared build and link with shared libraries [--enable-shared]"
-ac_help="$ac_help
- --enable-64bit enable 64bit support (where applicable)"
-ac_help="$ac_help
- --enable-64bit-vis enable 64bit Sparc VIS support"
-ac_help="$ac_help
- --disable-rpath disable rpath support (default: on)"
-ac_help="$ac_help
- --enable-corefoundation use CoreFoundation API [--enable-corefoundation]"
-ac_help="$ac_help
- --disable-load disallow dynamic loading and "load" command"
-ac_help="$ac_help
- --enable-symbols build with debugging symbols [--disable-symbols]"
-ac_help="$ac_help
- --enable-aqua enable Aqua windowingsystem on Mac OS X [--disable-aqua]"
-ac_help="$ac_help
- --with-x use the X Window System"
-ac_help="$ac_help
- --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]"
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='tk'
+PACKAGE_TARNAME='tk'
+PACKAGE_VERSION='8.5'
+PACKAGE_STRING='tk 8.5'
+PACKAGE_BUGREPORT=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCLSH_PROG BUILD_TCLSH MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS RANLIB ac_ct_RANLIB AR ac_ct_AR TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS LDAIX_SRC CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT LIBOBJS XFT_CFLAGS XFT_LIBS UNIX_FONT_OBJS TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_YEAR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_INCLUDE_SPEC TK_BUILD_STUB_LIB_SPEC TK_BUILD_STUB_LIB_PATH TK_SRC_DIR TK_SHARED_BUILD LD_LIBRARY_PATH_VAR TK_BUILD_LIB_SPEC TCL_STUB_FLAGS XINCLUDES XLIBSW LOCALES TK_WINDOWINGSYSTEM TK_PKG_DIR TK_LIBRARY PRIVATE_INCLUDE_DIR HTML_DIR EXTRA_CC_SWITCHES EXTRA_APP_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML EXTRA_WISH_LIBS CFBUNDLELOCALIZATIONS TK_RSRC_FILE WISH_RSRC_FILE LIB_RSRC_FILE APP_RSRC_FILE REZ REZ_FLAGS LTLIBOBJS'
+ac_subst_files=''
# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
exec_prefix=NONE
-host=NONE
no_create=
-nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
@@ -62,10 +327,15 @@ program_transform_name=s,x,x,
silent=
site=
srcdir=
-target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
@@ -79,17 +349,9 @@ oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
ac_prev=
for ac_option
do
-
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
@@ -97,59 +359,59 @@ do
continue
fi
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case "$ac_option" in
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
+ bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
+ ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
+ build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
- datadir="$ac_optarg" ;;
+ datadir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -158,95 +420,47 @@ do
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
+ exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
-host | --host | --hos | --ho)
- ac_prev=host ;;
+ ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
+ host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
+ includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
+ infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
+ libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
+ libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
@@ -255,19 +469,19 @@ EOF
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
+ localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
+ mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
+ | --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -281,26 +495,26 @@ EOF
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
+ oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
+ prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
+ program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
+ program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
@@ -317,7 +531,7 @@ EOF
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
+ program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
@@ -327,7 +541,7 @@ EOF
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
+ sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -338,58 +552,57 @@ EOF
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
+ sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
+ site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
+ srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
+ sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
+ ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
+ target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "with_${ac_package}='$ac_optarg'" ;;
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -400,99 +613,110 @@ EOF
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
+ x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
+ x_libraries=$ac_optarg ;;
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
*)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
fi
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
esac
done
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=../generic/tk.h
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
@@ -502,13 +726,494 @@ else
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures tk 8.5 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+
+X features:
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of tk 8.5:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-man-symlinks use symlinks for the manpages (default: off)
+ --enable-man-compression=PROG
+ compress the manpages with PROG (default: off)
+ --enable-man-suffix=STRING
+ use STRING as a suffix to manpage file names
+ (default: no, tk if enabled without
+ specifying STRING)
+ --enable-threads build with threads (default: off)
+ --enable-shared build and link with shared libraries (default: on)
+ --enable-64bit enable 64bit support (default: off)
+ --enable-64bit-vis enable 64bit Sparc VIS support (default: off)
+ --disable-rpath disable rpath support (default: on)
+ --enable-corefoundation use CoreFoundation API on MacOSX (default: on)
+ --enable-load allow dynamic loading and "load" command (default:
+ on)
+ --enable-symbols build with debugging symbols (default: off)
+ --enable-aqua use Aqua windowingsystem on Mac OS X (default: off)
+ --enable-xss use XScreenSaver for activity timer (default: on)
+ --enable-xft use freetype/fontconfig/xft (default: on)
+ --enable-framework package shared libraries in MacOSX frameworks
+ (default: off)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-tcl directory containing tcl configuration
+ (tclConfig.sh)
+ --with-x use the X Window System
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+tk configure 8.5
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by tk $as_me 8.5, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
@@ -519,49 +1224,123 @@ if test -z "$CONFIG_SITE"; then
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
else
- echo "creating cache $cache_file"
- > $cache_file
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
fi
ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
-TK_VERSION=8.4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TK_VERSION=8.5
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=4
-TK_PATCH_LEVEL=".19"
+TK_MINOR_VERSION=5
+TK_PATCH_LEVEL=".11"
VERSION=${TK_VERSION}
-LOCALES="cs de el en en_gb eo es fr hu it nl pl pt ru"
+LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
#--------------------------------------------------------------------
# Find and load the tclConfig.sh file
@@ -577,32 +1356,35 @@ LOCALES="cs de el en en_gb eo es fr hu it nl pl pt ru"
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
- # Check whether --with-tcl or --without-tcl was given.
+
+# Check whether --with-tcl or --without-tcl was given.
if test "${with_tcl+set}" = set; then
withval="$with_tcl"
- with_tclconfig=${withval}
-fi
-
- echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:588: checking for Tcl configuration" >&5
- if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ with_tclconfig="${withval}"
+fi;
+ echo "$as_me:$LINENO: checking for Tcl configuration" >&5
+echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6
+ if test "${ac_cv_c_tclconfig+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
# First check to see if --with-tcl was specified.
if test x"${with_tclconfig}" != x ; then
case "${with_tclconfig}" in
*/tclConfig.sh )
if test -f "${with_tclconfig}"; then
- echo "configure: warning: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" 1>&2
+ { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
+echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
fi ;;
esac
if test -f "${with_tclconfig}/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
else
- { echo "configure: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
+echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
@@ -672,29 +1454,34 @@ else
fi
done
fi
-
+
fi
if test x"${ac_cv_c_tclconfig}" = x ; then
TCL_BIN_DIR="# no Tcl configs found"
- { echo "configure: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&5
+echo "$as_me: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&2;}
+ { (exit 1); exit 1; }; }
else
no_tcl=
TCL_BIN_DIR="${ac_cv_c_tclconfig}"
- echo "$ac_t""found ${TCL_BIN_DIR}/tclConfig.sh" 1>&6
+ echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
+echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6
fi
fi
- echo $ac_n "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh""... $ac_c" 1>&6
-echo "configure:692: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
+ echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
+echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
- echo "$ac_t""loading" 1>&6
+ echo "$as_me:$LINENO: result: loading" >&5
+echo "${ECHO_T}loading" >&6
. "${TCL_BIN_DIR}/tclConfig.sh"
else
- echo "$ac_t""could not find ${TCL_BIN_DIR}/tclConfig.sh" 1>&6
+ echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
+echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
fi
# eval is required to do the TCL_DBGX substitution
@@ -740,27 +1527,27 @@ echo "configure:692: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-
-
-
-
-
-
-
-
-
-
- echo $ac_n "checking for tclsh""... $ac_c" 1>&6
-echo "configure:760: checking for tclsh" >&5
- if eval "test \"`echo '$''{'ac_cv_path_tclsh'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+
+
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking for tclsh" >&5
+echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
+ if test "${ac_cv_path_tclsh+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
for j in `ls -r $dir/tclsh[8-9]* 2> /dev/null` \
@@ -773,32 +1560,39 @@ else
fi
done
done
-
+
fi
if test -f "$ac_cv_path_tclsh" ; then
TCLSH_PROG="$ac_cv_path_tclsh"
- echo "$ac_t""$TCLSH_PROG" 1>&6
+ echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
+echo "${ECHO_T}$TCLSH_PROG" >&6
else
# It is not an error if an installed version of Tcl can't be located.
TCLSH_PROG=""
- echo "$ac_t""No tclsh found on PATH" 1>&6
+ echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5
+echo "${ECHO_T}No tclsh found on PATH" >&6
fi
-
- echo $ac_n "checking for tclsh in Tcl build directory""... $ac_c" 1>&6
-echo "configure:793: checking for tclsh in Tcl build directory" >&5
+
+ echo "$as_me:$LINENO: checking for tclsh in Tcl build directory" >&5
+echo $ECHO_N "checking for tclsh in Tcl build directory... $ECHO_C" >&6
BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh
- echo "$ac_t""$BUILD_TCLSH" 1>&6
-
+ echo "$as_me:$LINENO: result: $BUILD_TCLSH" >&5
+echo "${ECHO_T}$BUILD_TCLSH" >&6
+
if test "${TCL_VERSION}" != "${TK_VERSION}"; then
- { echo "configure: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
+ { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5
+echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." 1>&2; exit 1; }
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;}
+ { (exit 1); exit 1; }; }
fi
#------------------------------------------------------------------------
@@ -812,54 +1606,57 @@ if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
# Make sure srcdir is fully qualified!
-srcdir=`cd $srcdir ; pwd`
-TK_SRC_DIR=`cd $srcdir/..; pwd`
+srcdir="`cd "$srcdir" ; pwd`"
+TK_SRC_DIR="`cd "$srcdir"/..; pwd`"
#------------------------------------------------------------------------
# Compress and/or soft link the manpages?
#------------------------------------------------------------------------
- echo $ac_n "checking whether to use symlinks for manpages""... $ac_c" 1>&6
-echo "configure:825: checking whether to use symlinks for manpages" >&5
+ echo "$as_me:$LINENO: checking whether to use symlinks for manpages" >&5
+echo $ECHO_N "checking whether to use symlinks for manpages... $ECHO_C" >&6
# Check whether --enable-man-symlinks or --disable-man-symlinks was given.
if test "${enable_man_symlinks+set}" = set; then
enableval="$enable_man_symlinks"
test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"
else
enableval="no"
-fi
-
- echo "$ac_t""$enableval" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
- echo $ac_n "checking whether to compress the manpages""... $ac_c" 1>&6
-echo "configure:837: checking whether to compress the manpages" >&5
+ echo "$as_me:$LINENO: checking whether to compress the manpages" >&5
+echo $ECHO_N "checking whether to compress the manpages... $ECHO_C" >&6
# Check whether --enable-man-compression or --disable-man-compression was given.
if test "${enable_man_compression+set}" = set; then
enableval="$enable_man_compression"
case $enableval in
- yes) { echo "configure: error: missing argument to --enable-man-compression" 1>&2; exit 1; };;
+ yes) { { echo "$as_me:$LINENO: error: missing argument to --enable-man-compression" >&5
+echo "$as_me: error: missing argument to --enable-man-compression" >&2;}
+ { (exit 1); exit 1; }; };;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
esac
else
enableval="no"
-fi
-
- echo "$ac_t""$enableval" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
if test "$enableval" != "no"; then
- echo $ac_n "checking for compressed file suffix""... $ac_c" 1>&6
-echo "configure:853: checking for compressed file suffix" >&5
+ echo "$as_me:$LINENO: checking for compressed file suffix" >&5
+echo $ECHO_N "checking for compressed file suffix... $ECHO_C" >&6
touch TeST
$enableval TeST
Z=`ls TeST* | sed 's/^....//'`
rm -f TeST*
MAN_FLAGS="$MAN_FLAGS --extension $Z"
- echo "$ac_t""$Z" 1>&6
+ echo "$as_me:$LINENO: result: $Z" >&5
+echo "${ECHO_T}$Z" >&6
fi
- echo $ac_n "checking whether to add a package name suffix for the manpages""... $ac_c" 1>&6
-echo "configure:863: checking whether to add a package name suffix for the manpages" >&5
+ echo "$as_me:$LINENO: checking whether to add a package name suffix for the manpages" >&5
+echo $ECHO_N "checking whether to add a package name suffix for the manpages... $ECHO_C" >&6
# Check whether --enable-man-suffix or --disable-man-suffix was given.
if test "${enable_man_suffix+set}" = set; then
enableval="$enable_man_suffix"
@@ -870,11 +1667,11 @@ if test "${enable_man_suffix+set}" = set; then
esac
else
enableval="no"
-fi
+fi;
+ echo "$as_me:$LINENO: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
- echo "$ac_t""$enableval" 1>&6
-
#------------------------------------------------------------------------
@@ -887,214 +1684,659 @@ if test "${CFLAGS+set}" != "set" ; then
CFLAGS=""
fi
-# Extract the first word of "gcc", so it can be a program name with args.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:894: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:924: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
- if test $# -gt 0; then
+ if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:975: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1007: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 1018 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:1023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
+done
+done
+
fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1049: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1054: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+ test -n "$ac_ct_CC" && break
+done
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
else
- GCC=
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1082: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
+ CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
@@ -1108,169 +2350,913 @@ else
CFLAGS=
fi
fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
# limits header checks must come early to prevent
# an autoconf bug that throws errors on configure
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1117: checking how to run the C preprocessor" >&5
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1132 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1149 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1166 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
+ ac_cv_header_stdc=no
fi
rm -f conftest*
+
fi
-rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
fi
rm -f conftest*
- ac_cv_prog_CPP="$CPP"
+
fi
- CPP="$ac_cv_prog_CPP"
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
-ac_safe=`echo "limits.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for limits.h""... $ac_c" 1>&6
-echo "configure:1198: checking for limits.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
else
- cat > conftest.$ac_ext <<EOF
-#line 1203 "configure"
-#include "confdefs.h"
-#include <limits.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
fi
-rm -f conftest*
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_LIMITS_H 1
-EOF
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
-else
- echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
-#define NO_LIMITS_H 1
-EOF
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
fi
-for ac_hdr in unistd.h
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1240: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1245 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
-rm -f conftest*
+
+done
+
+
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for limits.h" >&5
+echo $ECHO_N "checking for limits.h... $ECHO_C" >&6
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5
+echo "${ECHO_T}$ac_cv_header_limits_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking limits.h usability" >&5
+echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <limits.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking limits.h presence" >&5
+echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <limits.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
fi
-done
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: limits.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: limits.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: limits.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to the tk lists. ##
+## ----------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for limits.h" >&5
+echo $ECHO_N "checking for limits.h... $ECHO_C" >&6
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_limits_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5
+echo "${ECHO_T}$ac_cv_header_limits_h" >&6
+
+fi
+if test $ac_cv_header_limits_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIMITS_H 1
+_ACEOF
+
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_LIMITS_H 1
+_ACEOF
+
+fi
+
#--------------------------------------------------------------------
@@ -1278,58 +3264,208 @@ done
# strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------
-echo $ac_n "checking stdlib.h""... $ac_c" 1>&6
-echo "configure:1283: checking stdlib.h" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1285 "configure"
-#include "confdefs.h"
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking stdlib.h usability" >&5
+echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <stdlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking stdlib.h presence" >&5
+echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
-EOF
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: stdlib.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to the tk lists. ##
+## ----------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_stdlib_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
+
+fi
+if test $ac_cv_header_stdlib_h = yes; then
+ tk_ok=1
+else
+ tk_ok=0
+fi
+
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "strtol" >/dev/null 2>&1; then
- rm -rf conftest*
- tk_ok=yes
+ $EGREP "strtol" >/dev/null 2>&1; then
+ :
else
- rm -rf conftest*
- tk_ok=no
+ tk_ok=0
fi
rm -f conftest*
-cat > conftest.$ac_ext <<EOF
-#line 1300 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "strtoul" >/dev/null 2>&1; then
+ $EGREP "strtoul" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
- tk_ok=no
+ tk_ok=0
fi
rm -f conftest*
-cat > conftest.$ac_ext <<EOF
-#line 1314 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "strtod" >/dev/null 2>&1; then
+ $EGREP "strtod" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
- tk_ok=no
+ tk_ok=0
fi
rm -f conftest*
-if test $tk_ok = no; then
- cat >> confdefs.h <<\EOF
+if test $tk_ok = 0; then
+
+cat >>confdefs.h <<\_ACEOF
#define NO_STDLIB_H 1
-EOF
+_ACEOF
fi
-echo "$ac_t""$tk_ok" 1>&6
#------------------------------------------------------------------------
# If we're using GCC, see if the compiler understands -pipe. If so, use it.
@@ -1337,35 +3473,62 @@ echo "$ac_t""$tk_ok" 1>&6
#------------------------------------------------------------------------
if test -z "$no_pipe" && test -n "$GCC"; then
- echo $ac_n "checking if the compiler understands -pipe""... $ac_c" 1>&6
-echo "configure:1342: checking if the compiler understands -pipe" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_pipe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5
+echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6
+if test "${tcl_cv_cc_pipe+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
- cat > conftest.$ac_ext <<EOF
-#line 1349 "configure"
-#include "confdefs.h"
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_cc_pipe=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_pipe=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_pipe=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_pipe" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5
+echo "${ECHO_T}$tcl_cv_cc_pipe" >&6
if test $tcl_cv_cc_pipe = yes; then
CFLAGS="$CFLAGS -pipe"
fi
@@ -1382,8 +3545,7 @@ if test "${enable_threads+set}" = set; then
tcl_ok=$enableval
else
tcl_ok=no
-fi
-
+fi;
if test "${TCL_THREADS}" = 1; then
tcl_threaded_core=1;
@@ -1393,63 +3555,96 @@ fi
TCL_THREADS=1
# USE_THREAD_ALLOC tells us to try the special thread-based
# allocator that significantly reduces lock contention
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define USE_THREAD_ALLOC 1
-EOF
+_ACEOF
+
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
-EOF
+_ACEOF
if test "`uname -s`" = "SunOS" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _POSIX_PTHREAD_SEMANTICS 1
-EOF
+_ACEOF
fi
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _THREAD_SAFE 1
-EOF
+_ACEOF
- echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6
-echo "configure:1416: checking for pthread_mutex_init in -lpthread" >&5
-ac_lib_var=`echo pthread'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1424 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pthread_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthread_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6
+if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "no"; then
@@ -1458,45 +3653,74 @@ fi
# defined. We could alternatively do an AC_TRY_COMPILE with
# pthread.h, but that will work with libpthread really doesn't
# exist, like AIX 4.2. [Bug: 4359]
- echo $ac_n "checking for __pthread_mutex_init in -lpthread""... $ac_c" 1>&6
-echo "configure:1463: checking for __pthread_mutex_init in -lpthread" >&5
-ac_lib_var=`echo pthread'_'__pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5
+echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1471 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char __pthread_mutex_init();
-
-int main() {
-__pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char __pthread_mutex_init ();
+int
+main ()
+{
+__pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pthread___pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthread___pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6
+if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
fi
@@ -1505,132 +3729,219 @@ fi
# The space is needed
THREADS_LIBS=" -lpthread"
else
- echo $ac_n "checking for pthread_mutex_init in -lpthreads""... $ac_c" 1>&6
-echo "configure:1510: checking for pthread_mutex_init in -lpthreads" >&5
-ac_lib_var=`echo pthreads'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6
+if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthreads $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1518 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pthreads_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthreads_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6
+if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "yes"; then
# The space is needed
THREADS_LIBS=" -lpthreads"
else
- echo $ac_n "checking for pthread_mutex_init in -lc""... $ac_c" 1>&6
-echo "configure:1555: checking for pthread_mutex_init in -lc" >&5
-ac_lib_var=`echo c'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6
+if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lc $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1563 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_c_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6
+if test $ac_cv_lib_c_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "no"; then
- echo $ac_n "checking for pthread_mutex_init in -lc_r""... $ac_c" 1>&6
-echo "configure:1597: checking for pthread_mutex_init in -lc_r" >&5
-ac_lib_var=`echo c_r'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6
+if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lc_r $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1605 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_c_r_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_r_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6
+if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "yes"; then
@@ -1638,7 +3949,8 @@ fi
THREADS_LIBS=" -pthread"
else
TCL_THREADS=0
- echo "configure: warning: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." 1>&2
+ { echo "$as_me:$LINENO: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5
+echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;}
fi
fi
fi
@@ -1649,248 +3961,527 @@ fi
ac_saved_libs=$LIBS
LIBS="$LIBS $THREADS_LIBS"
- for ac_func in pthread_attr_setstacksize
+
+for ac_func in pthread_attr_setstacksize
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1656: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1661 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-int main() {
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:1684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
- for ac_func in pthread_atfork
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1711: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1716 "configure"
-#include "confdefs.h"
+ echo "$as_me:$LINENO: checking for pthread_attr_get_np" >&5
+echo $ECHO_N "checking for pthread_attr_get_np... $ECHO_C" >&6
+if test "${ac_cv_func_pthread_attr_get_np+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define pthread_attr_get_np to an innocuous variant, in case <limits.h> declares pthread_attr_get_np.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define pthread_attr_get_np innocuous_pthread_attr_get_np
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
+ which can conflict with char pthread_attr_get_np (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-int main() {
+#undef pthread_attr_get_np
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_attr_get_np ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_pthread_attr_get_np) || defined (__stub___pthread_attr_get_np)
choke me
#else
-$ac_func();
+char (*f) () = pthread_attr_get_np;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:1739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
+int
+main ()
+{
+return f != pthread_attr_get_np;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_pthread_attr_get_np=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_pthread_attr_get_np=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_pthread_attr_get_np" >&5
+echo "${ECHO_T}$ac_cv_func_pthread_attr_get_np" >&6
+if test $ac_cv_func_pthread_attr_get_np = yes; then
+ tcl_ok=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
+ tcl_ok=no
fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
+ if test $tcl_ok = yes ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_ATTR_GET_NP 1
+_ACEOF
+
+ echo "$as_me:$LINENO: checking for pthread_attr_get_np declaration" >&5
+echo $ECHO_N "checking for pthread_attr_get_np declaration... $ECHO_C" >&6
+if test "${tcl_cv_grep_pthread_attr_get_np+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pthread.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "pthread_attr_get_np" >/dev/null 2>&1; then
+ tcl_cv_grep_pthread_attr_get_np=present
else
- echo "$ac_t""no" 1>&6
+ tcl_cv_grep_pthread_attr_get_np=missing
fi
-done
+rm -f conftest*
- LIBS=$ac_saved_libs
- else
- TCL_THREADS=0
- fi
- # Do checking message here to not mess up interleaved configure output
- echo $ac_n "checking for building with threads""... $ac_c" 1>&6
-echo "configure:1769: checking for building with threads" >&5
- if test "${TCL_THREADS}" = 1; then
- cat >> confdefs.h <<\EOF
-#define TCL_THREADS 1
-EOF
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_grep_pthread_attr_get_np" >&5
+echo "${ECHO_T}$tcl_cv_grep_pthread_attr_get_np" >&6
+ if test $tcl_cv_grep_pthread_attr_get_np = missing ; then
- if test "${tcl_threaded_core}" = 1; then
- echo "$ac_t""yes (threaded core)" 1>&6
+cat >>confdefs.h <<\_ACEOF
+#define ATTRGETNP_NOT_DECLARED 1
+_ACEOF
+
+ fi
else
- echo "$ac_t""yes" 1>&6
- fi
- else
- echo "$ac_t""no" 1>&6
- fi
+ echo "$as_me:$LINENO: checking for pthread_getattr_np" >&5
+echo $ECHO_N "checking for pthread_getattr_np... $ECHO_C" >&6
+if test "${ac_cv_func_pthread_getattr_np+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define pthread_getattr_np to an innocuous variant, in case <limits.h> declares pthread_getattr_np.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define pthread_getattr_np innocuous_pthread_getattr_np
-
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pthread_getattr_np (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-#--------------------------------------------------------------------
-# On a few very rare systems, all of the libm.a stuff is
-# already in libc.a. Set compiler flags accordingly.
-# Also, Linux requires the "ieee" library for math to work
-# right (and it must appear before "-lm").
-#--------------------------------------------------------------------
+#undef pthread_getattr_np
-MATH_LIBS=""
-echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:1796: checking for sin" >&5
-if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1801 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char sin(); below. */
-#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char sin();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char pthread_getattr_np ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_sin) || defined (__stub___sin)
+#if defined (__stub_pthread_getattr_np) || defined (__stub___pthread_getattr_np)
choke me
#else
-sin();
+char (*f) () = pthread_getattr_np;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_sin=yes"
+int
+main ()
+{
+return f != pthread_getattr_np;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_pthread_getattr_np=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_pthread_getattr_np=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_pthread_getattr_np" >&5
+echo "${ECHO_T}$ac_cv_func_pthread_getattr_np" >&6
+if test $ac_cv_func_pthread_getattr_np = yes; then
+ tcl_ok=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_sin=no"
-fi
-rm -f conftest*
+ tcl_ok=no
fi
-if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-MATH_LIBS="-lm"
-fi
+ if test $tcl_ok = yes ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_GETATTR_NP 1
+_ACEOF
-echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
-echo "configure:1845: checking for main in -lieee" >&5
-ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_getattr_np declaration" >&5
+echo $ECHO_N "checking for pthread_getattr_np declaration... $ECHO_C" >&6
+if test "${tcl_cv_grep_pthread_getattr_np+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
-LIBS="-lieee $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1853 "configure"
-#include "confdefs.h"
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pthread.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "pthread_getattr_np" >/dev/null 2>&1; then
+ tcl_cv_grep_pthread_getattr_np=present
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ tcl_cv_grep_pthread_getattr_np=missing
fi
rm -f conftest*
-LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- MATH_LIBS="-lieee $MATH_LIBS"
-else
- echo "$ac_t""no" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_grep_pthread_getattr_np" >&5
+echo "${ECHO_T}$tcl_cv_grep_pthread_getattr_np" >&6
+ if test $tcl_cv_grep_pthread_getattr_np = missing ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define GETATTRNP_NOT_DECLARED 1
+_ACEOF
+
+ fi
+ fi
+ fi
+ if test $tcl_ok = no; then
+ # Darwin thread stacksize API
+
+for ac_func in pthread_get_stacksize_np
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
fi
+done
+
+ fi
+ LIBS=$ac_saved_libs
+ else
+ TCL_THREADS=0
+ fi
+ # Do checking message here to not mess up interleaved configure output
+ echo "$as_me:$LINENO: checking for building with threads" >&5
+echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
+ if test "${TCL_THREADS}" = 1; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_THREADS 1
+_ACEOF
+
+ if test "${tcl_threaded_core}" = 1; then
+ echo "$as_me:$LINENO: result: yes (threaded core)" >&5
+echo "${ECHO_T}yes (threaded core)" >&6
+ else
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ fi
+ else
+ echo "$as_me:$LINENO: result: no (default)" >&5
+echo "${ECHO_T}no (default)" >&6
+ fi
+
+
# Add the threads support libraries
LIBS="$LIBS$THREADS_LIBS"
- echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:1886: checking how to build libraries" >&5
+ echo "$as_me:$LINENO: checking how to build libraries" >&5
+echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6
# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
tcl_ok=$enableval
else
tcl_ok=yes
-fi
-
+fi;
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
@@ -1900,14 +4491,17 @@ fi
fi
if test "$tcl_ok" = "yes" ; then
- echo "$ac_t""shared" 1>&6
+ echo "$as_me:$LINENO: result: shared" >&5
+echo "${ECHO_T}shared" >&6
SHARED_BUILD=1
else
- echo "$ac_t""static" 1>&6
+ echo "$as_me:$LINENO: result: static" >&5
+echo "${ECHO_T}static" >&6
SHARED_BUILD=0
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define STATIC_BUILD 1
-EOF
+_ACEOF
fi
@@ -1918,101 +4512,225 @@ EOF
# after SC_ENABLE_SHARED checks the configure switches.
#--------------------------------------------------------------------
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1925: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
+RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
fi
# Step 0.a: Enable 64 bit support?
- echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:1957: checking if 64bit support is requested" >&5
+ echo "$as_me:$LINENO: checking if 64bit support is requested" >&5
+echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6
# Check whether --enable-64bit or --disable-64bit was given.
if test "${enable_64bit+set}" = set; then
enableval="$enable_64bit"
do64bit=$enableval
else
do64bit=no
-fi
-
- echo "$ac_t""$do64bit" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $do64bit" >&5
+echo "${ECHO_T}$do64bit" >&6
# Step 0.b: Enable Solaris 64 bit VIS support?
- echo $ac_n "checking if 64bit Sparc VIS support is requested""... $ac_c" 1>&6
-echo "configure:1971: checking if 64bit Sparc VIS support is requested" >&5
+ echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5
+echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6
# Check whether --enable-64bit-vis or --disable-64bit-vis was given.
if test "${enable_64bit_vis+set}" = set; then
enableval="$enable_64bit_vis"
do64bitVIS=$enableval
else
do64bitVIS=no
+fi;
+ echo "$as_me:$LINENO: result: $do64bitVIS" >&5
+echo "${ECHO_T}$do64bitVIS" >&6
+ # Force 64bit on with VIS
+ if test "$do64bitVIS" = "yes"; then
+ do64bit=yes
fi
- echo "$ac_t""$do64bitVIS" 1>&6
- if test "$do64bitVIS" = "yes"; then
- # Force 64bit on with VIS
- do64bit=yes
- fi
+ # Step 0.c: Check if visibility support is available. Do this here so
+ # that platform specific alternatives can be used below if this fails.
+
+ echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5
+echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6
+if test "${tcl_cv_cc_visibility_hidden+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ extern __attribute__((__visibility__("hidden"))) void f(void);
+ void f(void) {}
+int
+main ()
+{
+f();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_cc_visibility_hidden=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_visibility_hidden=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5
+echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6
+ if test $tcl_cv_cc_visibility_hidden = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define MODULE_SCOPE extern __attribute__((__visibility__("hidden")))
+_ACEOF
+
+
+fi
+
# Step 0.d: Disable -rpath support?
- echo $ac_n "checking if rpath support is requested""... $ac_c" 1>&6
-echo "configure:1990: checking if rpath support is requested" >&5
+ echo "$as_me:$LINENO: checking if rpath support is requested" >&5
+echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6
# Check whether --enable-rpath or --disable-rpath was given.
if test "${enable_rpath+set}" = set; then
enableval="$enable_rpath"
doRpath=$enableval
else
doRpath=yes
-fi
-
- echo "$ac_t""$doRpath" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $doRpath" >&5
+echo "${ECHO_T}$doRpath" >&6
# Step 1: set the variable "system" to hold the name and version number
# for the system.
-
- echo $ac_n "checking system version""... $ac_c" 1>&6
-echo "configure:2006: checking system version" >&5
-if eval "test \"`echo '$''{'tcl_cv_sys_version'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking system version" >&5
+echo $ECHO_N "checking system version... $ECHO_C" >&6
+if test "${tcl_cv_sys_version+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
if test -f /usr/lib/NextStep/software_version; then
tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
else
tcl_cv_sys_version=`uname -s`-`uname -r`
if test "$?" -ne 0 ; then
- echo "configure: warning: can't find uname command" 1>&2
+ { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5
+echo "$as_me: WARNING: can't find uname command" >&2;}
tcl_cv_sys_version=unknown
else
# Special check for weird MP-RAS system (uname returns weird
@@ -2026,61 +4744,94 @@ else
fi
fi
fi
-
-fi
-echo "$ac_t""$tcl_cv_sys_version" 1>&6
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5
+echo "${ECHO_T}$tcl_cv_sys_version" >&6
system=$tcl_cv_sys_version
# Step 2: check for existence of -ldl library. This is needed because
# Linux can use either -ldl or -ldld for dynamic loading.
- echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2041: checking for dlopen in -ldl" >&5
-ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2049 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen();
-
-int main() {
-dlopen()
-; return 0; }
-EOF
-if { (eval echo configure:2060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
have_dl=yes
else
- echo "$ac_t""no" 1>&6
-have_dl=no
+ have_dl=no
fi
# Require ranlib early so we can override it in special cases below.
+ if test x"${SHLIB_VERSION}" = x; then
+ SHLIB_VERSION="1.0"
+fi
+
+
-
# Step 3: set configuration options based on system name and version.
@@ -2088,60 +4839,112 @@ fi
# default to '{$LIBS}' and set to "" on per-platform necessary basis
SHLIB_LD_LIBS='${LIBS}'
LDFLAGS_ORIG="$LDFLAGS"
- TCL_EXPORT_FILE_SUFFIX=""
+ # When ld needs options to work in 64-bit mode, put them in
+ # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
+ # is disabled by the user. [Bug 1016796]
+ LDFLAGS_ARCH=""
UNSHARED_LIB_SUFFIX=""
TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
ECHO_VERSION='`echo ${VERSION}`'
TCL_LIB_VERSIONS_OK=ok
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE=-O
- if test "$GCC" = "yes" ; then
- CFLAGS_WARNING="-Wall -fno-strict-aliasing"
- else
- CFLAGS_WARNING=""
- fi
- TCL_NEEDS_EXP_FILE=0
- TCL_BUILD_EXP_FILE=""
- TCL_EXP_FILE=""
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2110: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ if test "$GCC" = yes; then
+
+ CFLAGS_WARNING="-Wall"
+
+else
+ CFLAGS_WARNING=""
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-AR="$ac_cv_prog_AR"
+AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
fi
- if test "${AR}" = "" ; then
- { echo "configure: error: Required archive tool 'ar' not found on PATH." 1>&2; exit 1; }
- fi
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
PLAT_SRCS=""
+ LDAIX_SRC=""
case $system in
AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
+ if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then
+
# AIX requires the _r compiler when gcc isn't being used
case "${CC}" in
*_r|*_r\ *)
@@ -2152,8 +4955,11 @@ fi
CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
;;
esac
- echo "$ac_t""Using $CC for compiling with threads" 1>&6
- fi
+ echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5
+echo "${ECHO_T}Using $CC for compiling with threads" >&6
+
+fi
+
LIBS="$LIBS -lc"
SHLIB_CFLAGS=""
SHLIB_SUFFIX=".so"
@@ -2161,111 +4967,71 @@ fi
DL_OBJS="tclLoadDl.o"
LD_LIBRARY_PATH_VAR="LIBPATH"
- # Check to enable 64-bit flags for compiler/linker on AIX 4+
- if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
- if test "$GCC" = "yes" ; then
- echo "configure: warning: 64bit mode not supported with GCC on $system" 1>&2
- else
+ # ldAix No longer needed with use of -bexpall/-brtl
+ # but some extensions may still reference it
+ LDAIX_SRC='$(UNIX_DIR)/ldAix'
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = yes; then
+
+ if test "$GCC" = yes; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
+
+else
+
do64bit_ok=yes
CFLAGS="$CFLAGS -q64"
- LDFLAGS="$LDFLAGS -q64"
+ LDFLAGS_ARCH="-q64"
RANLIB="${RANLIB} -X64"
AR="${AR} -X64"
SHLIB_LD_FLAGS="-b64"
- fi
- fi
- if test "`uname -m`" = "ia64" ; then
+fi
+
+
+fi
+
+
+ if test "`uname -m`" = ia64; then
+
# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
# AIX-5 has dl* in libc.so
DL_LIBS=""
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- else
+
+else
+
CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
- fi
+
+fi
+
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- else
- if test "$GCC" = "yes" ; then
- SHLIB_LD="gcc -shared"
- else
- SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- fi
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
- fi
- # AIX v<=4.1 has some different flags than 4.2+
- if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
- LIBOBJS="$LIBOBJS tclLoadAix.o"
- DL_LIBS="-lld"
- fi
+else
- # On AIX <=v4 systems, libbsd.a has to be linked in to support
- # non-blocking file IO. This library has to be linked in after
- # the MATH_LIBS or it breaks the pow() function. The way to
- # insure proper sequencing, is to add it to the tail of MATH_LIBS.
- # This library also supplies gettimeofday.
- #
- # AIX does not have a timezone field in struct tm. When the AIX
- # bsd library is used, the timezone global and the gettimeofday
- # methods are to be avoided for timezone deduction instead, we
- # deduce the timezone by comparing the localtime result on a
- # known GMT value.
-
- echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
-echo "configure:2223: checking for gettimeofday in -lbsd" >&5
-ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lbsd $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2231 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gettimeofday();
-
-int main() {
-gettimeofday()
-; return 0; }
-EOF
-if { (eval echo configure:2242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+ if test "$GCC" = yes; then
+
+ SHLIB_LD='${CC} -shared -Wl,-bexpall'
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- libbsd=yes
else
- echo "$ac_t""no" 1>&6
-libbsd=no
+
+ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
+ LDFLAGS="$LDFLAGS -brtl"
+
fi
- if test $libbsd = yes; then
- MATH_LIBS="$MATH_LIBS -lbsd"
- cat >> confdefs.h <<\EOF
-#define USE_DELTA_FOR_TZ 1
-EOF
+ SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+
+fi
- fi
;;
BeOS*)
SHLIB_CFLAGS="-fPIC"
@@ -2279,44 +5045,72 @@ EOF
# -lsocket, even if the network functions are in -lnet which
# is always linked to, for compatibility.
#-----------------------------------------------------------
- echo $ac_n "checking for inet_ntoa in -lbind""... $ac_c" 1>&6
-echo "configure:2284: checking for inet_ntoa in -lbind" >&5
-ac_lib_var=`echo bind'_'inet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5
+echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6
+if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lbind $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2292 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char inet_ntoa();
-
-int main() {
-inet_ntoa()
-; return 0; }
-EOF
-if { (eval echo configure:2303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char inet_ntoa ();
+int
+main ()
+{
+inet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_bind_inet_ntoa=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_bind_inet_ntoa=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6
+if test $ac_cv_lib_bind_inet_ntoa = yes; then
LIBS="$LIBS -lbind -lsocket"
-else
- echo "$ac_t""no" 1>&6
fi
;;
@@ -2365,106 +5159,171 @@ fi
SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
DL_OBJS="tclLoadDl.o"
DL_LIBS="-lroot"
- echo $ac_n "checking for inet_ntoa in -lnetwork""... $ac_c" 1>&6
-echo "configure:2370: checking for inet_ntoa in -lnetwork" >&5
-ac_lib_var=`echo network'_'inet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for inet_ntoa in -lnetwork" >&5
+echo $ECHO_N "checking for inet_ntoa in -lnetwork... $ECHO_C" >&6
+if test "${ac_cv_lib_network_inet_ntoa+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lnetwork $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2378 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char inet_ntoa();
-
-int main() {
-inet_ntoa()
-; return 0; }
-EOF
-if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char inet_ntoa ();
+int
+main ()
+{
+inet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_network_inet_ntoa=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_network_inet_ntoa=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_network_inet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_network_inet_ntoa" >&6
+if test $ac_cv_lib_network_inet_ntoa = yes; then
LIBS="$LIBS -lnetwork"
-else
- echo "$ac_t""no" 1>&6
fi
;;
HP-UX-*.11.*)
# Use updated header definitions where possible
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _XOPEN_SOURCE_EXTENDED 1
-EOF
+_ACEOF
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _XOPEN_SOURCE 1
-EOF
+_ACEOF
LIBS="$LIBS -lxnet" # Use the XOPEN network library
- if test "`uname -m`" = "ia64" ; then
+ if test "`uname -m`" = ia64; then
+
SHLIB_SUFFIX=".so"
- else
+
+else
+
SHLIB_SUFFIX=".sl"
- fi
- echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:2428: checking for shl_load in -ldld" >&5
-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+fi
+
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2436 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char shl_load();
-
-int main() {
-shl_load()
-; return 0; }
-EOF
-if { (eval echo configure:2447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = yes; then
+
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
DL_OBJS="tclLoadShl.o"
@@ -2473,83 +5332,128 @@ fi
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- if test "$GCC" = "yes" ; then
+
+fi
+
+ if test "$GCC" = yes; then
+
SHLIB_LD='${CC} -shared'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+
+fi
+
# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
#CFLAGS="$CFLAGS +DAportable"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
+ if test "$do64bit" = "yes"; then
+
+ if test "$GCC" = yes; then
+
case `${CC} -dumpmachine` in
hppa64*)
# 64-bit gcc in use. Fix flags for GNU ld.
do64bit_ok=yes
SHLIB_LD='${CC} -shared'
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
;;
*)
- echo "configure: warning: 64bit mode not supported with GCC on $system" 1>&2
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
;;
esac
- else
+
+else
+
do64bit_ok=yes
CFLAGS="$CFLAGS +DD64"
- LDFLAGS="$LDFLAGS +DD64"
- fi
- fi
- ;;
+ LDFLAGS_ARCH="+DD64"
+
+fi
+
+
+fi
+ ;;
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
SHLIB_SUFFIX=".sl"
- echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:2513: checking for shl_load in -ldld" >&5
-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2521 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char shl_load();
-
-int main() {
-shl_load()
-; return 0; }
-EOF
-if { (eval echo configure:2532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = yes; then
+
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
SHLIB_LD_LIBS=""
@@ -2559,29 +5463,21 @@ fi
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- ;;
- IRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- ;;
+
+fi
+ ;;
IRIX-5.*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -shared -rdata_shared"
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+fi
+
;;
IRIX-6.*)
SHLIB_CFLAGS=""
@@ -2589,14 +5485,19 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
+fi
+
+ if test "$GCC" = yes; then
+
CFLAGS="$CFLAGS -mabi=n32"
LDFLAGS="$LDFLAGS -mabi=n32"
- else
+
+else
+
case $system in
IRIX-6.3)
# Use to build 6.2 compatible binaries on 6.3.
@@ -2607,7 +5508,9 @@ fi
;;
esac
LDFLAGS="$LDFLAGS -n32"
- fi
+
+fi
+
;;
IRIX64-6.*)
SHLIB_CFLAGS=""
@@ -2615,23 +5518,34 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+fi
+
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- echo "configure: warning: 64bit mode not supported by gcc" 1>&2
- else
+ if test "$do64bit" = yes; then
+
+ if test "$GCC" = yes; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5
+echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;}
+
+else
+
do64bit_ok=yes
SHLIB_LD="ld -64 -shared -rdata_shared"
CFLAGS="$CFLAGS -64"
- LDFLAGS="$LDFLAGS -64"
- fi
- fi
+ LDFLAGS_ARCH="-64"
+
+fi
+
+
+fi
+
;;
Linux*)
SHLIB_CFLAGS="-fPIC"
@@ -2643,167 +5557,116 @@ fi
# get rid of the warnings.
#CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:2659: checking for dld.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2664 "configure"
-#include "confdefs.h"
-#include <dld.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ if test $doRpath = yes; then
+
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-
- SHLIB_LD="ld -shared"
- DL_OBJS="tclLoadDld.o"
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
-else
- echo "$ac_t""no" 1>&6
+
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "`uname -m`" = "alpha"; then
+ CFLAGS="$CFLAGS -mieee"
fi
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
if test $do64bit = yes; then
- echo $ac_n "checking if compiler accepts -m64 flag""... $ac_c" 1>&6
-echo "configure:2701: checking if compiler accepts -m64 flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_m64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_m64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -m64"
- cat > conftest.$ac_ext <<EOF
-#line 2709 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:2716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_cc_m64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_m64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_m64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_m64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5
+echo "${ECHO_T}$tcl_cv_cc_m64" >&6
if test $tcl_cv_cc_m64 = yes; then
+
CFLAGS="$CFLAGS -m64"
do64bit_ok=yes
- fi
- fi
- # The combo of gcc + glibc has a bug related
- # to inlining of functions like strtod(). The
- # -fno-builtin flag should address this problem
- # but it does not work. The -fno-inline flag
- # is kind of overkill but it works.
- # Disable inlining only when one of the
- # files in compat/*.c is being linked in.
- if test x"${LIBOBJS}" != x ; then
- CFLAGS="$CFLAGS -fno-inline"
- fi
+fi
- # XIM peeking works under XFree86.
- cat >> confdefs.h <<\EOF
-#define PEEK_XCLOSEIM 1
-EOF
+fi
+
+
+ # The combo of gcc + glibc has a bug related to inlining of
+ # functions like strtod(). The -fno-builtin flag should address
+ # this problem but it does not work. The -fno-inline flag is kind
+ # of overkill but it works. Disable inlining only when one of the
+ # files in compat/*.c is being linked in.
+
+ if test x"${USE_COMPAT}" != x; then
+ CFLAGS="$CFLAGS -fno-inline"
+fi
;;
GNU*)
SHLIB_CFLAGS="-fPIC"
SHLIB_SUFFIX=".so"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared'
- DL_OBJS=""
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- else
- ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:2768: checking for dld.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2773 "configure"
-#include "confdefs.h"
-#include <dld.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-
- SHLIB_LD="ld -shared"
- DL_OBJS=""
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
-else
- echo "$ac_t""no" 1>&6
+ SHLIB_LD='${CC} -shared'
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ if test "`uname -m`" = "alpha"; then
+ CFLAGS="$CFLAGS -mieee"
fi
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
;;
Lynx*)
SHLIB_CFLAGS="-fPIC"
@@ -2813,10 +5676,12 @@ fi
DL_OBJS="tclLoadDl.o"
DL_LIBS="-mshared -ldl"
LD_FLAGS="-Wl,--export-dynamic"
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
;;
MP-RAS-02*)
SHLIB_CFLAGS="-K PIC"
@@ -2840,169 +5705,145 @@ fi
LD_SEARCH_FLAGS=""
;;
NetBSD-1.*|FreeBSD-[1-2].*)
- # Not available on all versions: check for include file.
- ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:2847: checking for dlfcn.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2852 "configure"
-#include "confdefs.h"
-#include <dlfcn.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2857: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ if test $doRpath = yes; then
+
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-
- # NetBSD/SPARC needs -fPIC, -fpic will not do.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- echo $ac_n "checking for ELF""... $ac_c" 1>&6
-echo "configure:2885: checking for ELF" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_elf'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking for ELF" >&5
+echo $ECHO_N "checking for ELF... $ECHO_C" >&6
+if test "${tcl_cv_ld_elf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 2891 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#ifdef __ELF__
yes
#endif
-
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "yes" >/dev/null 2>&1; then
tcl_cv_ld_elf=yes
else
- rm -rf conftest*
tcl_cv_ld_elf=no
fi
rm -f conftest*
fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
+echo "${ECHO_T}$tcl_cv_ld_elf" >&6
+ if test $tcl_cv_ld_elf = yes; then
+
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
-echo "$ac_t""$tcl_cv_ld_elf" 1>&6
- if test $tcl_cv_ld_elf = yes; then
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
- else
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- fi
-
else
- echo "$ac_t""no" 1>&6
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
-
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+
fi
- # FreeBSD doesn't handle version numbers with dots.
+ # Ancient FreeBSD doesn't handle version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
arch=`arch -s`
case "$arch" in
m88k|vax)
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ # Equivalent using configure option --disable-load
+ # Step 4 will set the necessary variables
+ DL_OBJS=""
+ SHLIB_LD_LIBS=""
;;
*)
- # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
- case `machine` in
- sparc|sparc64)
- SHLIB_CFLAGS="-fPIC";;
- *)
- SHLIB_CFLAGS="-fpic";;
- esac
- SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- echo $ac_n "checking for ELF""... $ac_c" 1>&6
-echo "configure:2970: checking for ELF" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_elf'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ ;;
+ esac
+ case "$arch" in
+ m88k|vax)
+ CFLAGS_OPTIMIZE="-O1"
+ ;;
+ sh)
+ CFLAGS_OPTIMIZE="-O0"
+ ;;
+ *)
+ CFLAGS_OPTIMIZE="-O2"
+ ;;
+ esac
+ echo "$as_me:$LINENO: checking for ELF" >&5
+echo $ECHO_N "checking for ELF... $ECHO_C" >&6
+if test "${tcl_cv_ld_elf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 2976 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#ifdef __ELF__
yes
#endif
-
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "yes" >/dev/null 2>&1; then
tcl_cv_ld_elf=yes
else
- rm -rf conftest*
tcl_cv_ld_elf=no
fi
rm -f conftest*
fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
+echo "${ECHO_T}$tcl_cv_ld_elf" >&6
+ if test $tcl_cv_ld_elf = yes; then
-echo "$ac_t""$tcl_cv_ld_elf" 1>&6
- if test $tcl_cv_ld_elf = yes; then
- LDFLAGS=-Wl,-export-dynamic
- else
- LDFLAGS=""
- fi
- ;;
- esac
+ LDFLAGS=-Wl,-export-dynamic
+
+else
+ LDFLAGS=""
+fi
+
+ if test "${TCL_THREADS}" = "1"; then
+
+ # On OpenBSD: Compile with -pthread
+ # Don't link with -lpthread
+ LIBS=`echo $LIBS | sed s/-lpthread//`
+ CFLAGS="$CFLAGS -pthread"
+
+fi
# OpenBSD doesn't do version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
NetBSD-*|FreeBSD-[3-4].*)
@@ -3014,16 +5855,21 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -export-dynamic"
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "${TCL_THREADS}" = "1" ; then
+ if test "${TCL_THREADS}" = "1"; then
+
# The -pthread needs to go in the CFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
+
+fi
+
case $system in
FreeBSD-3.*)
# FreeBSD-3 doesn't handle version numbers with dots.
@@ -3042,16 +5888,20 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "${TCL_THREADS}" = "1" ; then
+fi
+
+ if test "${TCL_THREADS}" = "1"; then
+
# The -pthread needs to go in the LDFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- fi
+fi
+
# Version numbers are dot-stripped by system policy.
TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
@@ -3071,270 +5921,498 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6
awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`"
if test $do64bit = yes; then
+
case `arch` in
ppc)
- echo $ac_n "checking if compiler accepts -arch ppc64 flag""... $ac_c" 1>&6
-echo "configure:3078: checking if compiler accepts -arch ppc64 flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_arch_ppc64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_arch_ppc64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
- cat > conftest.$ac_ext <<EOF
-#line 3086 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:3093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_cc_arch_ppc64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_arch_ppc64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_arch_ppc64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_arch_ppc64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5
+echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6
if test $tcl_cv_cc_arch_ppc64 = yes; then
+
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
do64bit_ok=yes
- fi;;
+
+fi
+;;
i386)
- echo $ac_n "checking if compiler accepts -arch x86_64 flag""... $ac_c" 1>&6
-echo "configure:3113: checking if compiler accepts -arch x86_64 flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_arch_x86_64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_arch_x86_64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch x86_64"
- cat > conftest.$ac_ext <<EOF
-#line 3121 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:3128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_cc_arch_x86_64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_arch_x86_64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_arch_x86_64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_arch_x86_64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5
+echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6
if test $tcl_cv_cc_arch_x86_64 = yes; then
+
CFLAGS="$CFLAGS -arch x86_64"
do64bit_ok=yes
- fi;;
+
+fi
+;;
*)
- echo "configure: warning: Don't know how enable 64-bit on architecture `arch`" 1>&2;;
+ { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5
+echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};;
esac
- else
+
+else
+
# Check for combined 32-bit and 64-bit fat build
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
+ if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
+ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then
+
fat_32_64=yes
- fi
+fi
+
+
+fi
+
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
- echo $ac_n "checking if ld accepts -single_module flag""... $ac_c" 1>&6
-echo "configure:3157: checking if ld accepts -single_module flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_single_module'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5
+echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_single_module+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
- cat > conftest.$ac_ext <<EOF
-#line 3165 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
int i;
-; return 0; }
-EOF
-if { (eval echo configure:3172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_ld_single_module=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_ld_single_module=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_single_module=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-
-echo "$ac_t""$tcl_cv_ld_single_module" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5
+echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
if test $tcl_cv_ld_single_module = yes; then
+
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
- fi
+
+fi
+
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
# Don't use -prebind when building for Mac OS X 10.4 or later only:
- test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \
- "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \
+ if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \
+ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then
+
LDFLAGS="$LDFLAGS -prebind"
+fi
+
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
- echo $ac_n "checking if ld accepts -search_paths_first flag""... $ac_c" 1>&6
-echo "configure:3198: checking if ld accepts -search_paths_first flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_search_paths_first'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
+echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_search_paths_first+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- cat > conftest.$ac_ext <<EOF
-#line 3206 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
int i;
-; return 0; }
-EOF
-if { (eval echo configure:3213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_ld_search_paths_first=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_ld_search_paths_first=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_search_paths_first=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-
-echo "$ac_t""$tcl_cv_ld_search_paths_first" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5
+echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6
if test $tcl_cv_ld_search_paths_first = yes; then
+
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- fi
+
+fi
+
+ if test "$tcl_cv_cc_visibility_hidden" != yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define MODULE_SCOPE __private_extern__
+_ACEOF
+
+
+fi
+
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
- PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
- PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
- echo $ac_n "checking whether to use CoreFoundation""... $ac_c" 1>&6
-echo "configure:3236: checking whether to use CoreFoundation" >&5
+
+cat >>confdefs.h <<\_ACEOF
+#define MAC_OSX_TCL 1
+_ACEOF
+
+ PLAT_OBJS='${MAC_OSX_OBJS}'
+ PLAT_SRCS='${MAC_OSX_SRCS}'
+ echo "$as_me:$LINENO: checking whether to use CoreFoundation" >&5
+echo $ECHO_N "checking whether to use CoreFoundation... $ECHO_C" >&6
# Check whether --enable-corefoundation or --disable-corefoundation was given.
if test "${enable_corefoundation+set}" = set; then
enableval="$enable_corefoundation"
tcl_corefoundation=$enableval
else
tcl_corefoundation=yes
-fi
-
- echo "$ac_t""$tcl_corefoundation" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $tcl_corefoundation" >&5
+echo "${ECHO_T}$tcl_corefoundation" >&6
if test $tcl_corefoundation = yes; then
- echo $ac_n "checking for CoreFoundation.framework""... $ac_c" 1>&6
-echo "configure:3248: checking for CoreFoundation.framework" >&5
-if eval "test \"`echo '$''{'tcl_cv_lib_corefoundation'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking for CoreFoundation.framework" >&5
+echo $ECHO_N "checking for CoreFoundation.framework... $ECHO_C" >&6
+if test "${tcl_cv_lib_corefoundation+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_libs=$LIBS
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- # On Tiger there is no 64-bit CF, so remove 64-bit archs
- # from CFLAGS et al. while testing for presence of CF.
- # 64-bit CF is disabled in tclUnixPort.h if necessary.
- eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
- done; fi
+ if test "$fat_32_64" = yes; then
+
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ # On Tiger there is no 64-bit CF, so remove 64-bit
+ # archs from CFLAGS et al. while testing for
+ # presence of CF. 64-bit CF is disabled in
+ # tclUnixPort.h if necessary.
+ eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
+ done
+fi
+
LIBS="$LIBS -framework CoreFoundation"
- cat > conftest.$ac_ext <<EOF
-#line 3262 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
-int main() {
+int
+main ()
+{
CFBundleRef b = CFBundleGetMainBundle();
-; return 0; }
-EOF
-if { (eval echo configure:3269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_lib_corefoundation=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_lib_corefoundation=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_lib_corefoundation=no
fi
-rm -f conftest*
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- eval $v'="$hold_'$v'"'
- done; fi; LIBS=$hold_libs
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$fat_32_64" = yes; then
+
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ eval $v'="$hold_'$v'"'
+ done
fi
-echo "$ac_t""$tcl_cv_lib_corefoundation" 1>&6
+ LIBS=$hold_libs
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation" >&5
+echo "${ECHO_T}$tcl_cv_lib_corefoundation" >&6
if test $tcl_cv_lib_corefoundation = yes; then
+
LIBS="$LIBS -framework CoreFoundation"
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_COREFOUNDATION 1
-EOF
+_ACEOF
+
+
+else
+ tcl_corefoundation=no
+fi
- else
- tcl_corefoundation=no
- fi
if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
- echo $ac_n "checking for 64-bit CoreFoundation""... $ac_c" 1>&6
-echo "configure:3296: checking for 64-bit CoreFoundation" >&5
-if eval "test \"`echo '$''{'tcl_cv_lib_corefoundation_64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking for 64-bit CoreFoundation" >&5
+echo $ECHO_N "checking for 64-bit CoreFoundation... $ECHO_C" >&6
+if test "${tcl_cv_lib_corefoundation_64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
- cat > conftest.$ac_ext <<EOF
-#line 3305 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
-int main() {
+int
+main ()
+{
CFBundleRef b = CFBundleGetMainBundle();
-; return 0; }
-EOF
-if { (eval echo configure:3312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_lib_corefoundation_64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_lib_corefoundation_64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_lib_corefoundation_64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done
fi
-
-echo "$ac_t""$tcl_cv_lib_corefoundation_64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation_64" >&5
+echo "${ECHO_T}$tcl_cv_lib_corefoundation_64" >&6
if test $tcl_cv_lib_corefoundation_64 = no; then
- cat >> confdefs.h <<\EOF
+
+
+cat >>confdefs.h <<\_ACEOF
#define NO_COREFOUNDATION_64 1
-EOF
+_ACEOF
- fi
- fi
- fi
- cat >> confdefs.h <<\EOF
-#define MAC_OSX_TCL 1
-EOF
+ LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
+
+fi
+
+
+fi
+
+
+fi
;;
NEXTSTEP-*)
@@ -3350,9 +6428,10 @@ EOF
OS/390-*)
SHLIB_LD_LIBS=""
CFLAGS_OPTIMIZE="" # Optimizer is buggy
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _OE_SOCKETS 1
-EOF
+_ACEOF
;;
OSF1-1.0|OSF1-1.1|OSF1-1.2)
@@ -3370,11 +6449,14 @@ EOF
OSF1-1.*)
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
SHLIB_CFLAGS="-fPIC"
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD="ld -shared"
- else
+ if test "$SHARED_BUILD" = 1; then
+ SHLIB_LD="ld -shared"
+else
+
SHLIB_LD="ld -non_shared"
- fi
+
+fi
+
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
@@ -3385,35 +6467,51 @@ EOF
OSF1-V*)
# Digital OSF/1
SHLIB_CFLAGS=""
- if test "$SHARED_BUILD" = "1" ; then
+ if test "$SHARED_BUILD" = 1; then
+
SHLIB_LD='ld -shared -expect_unresolved "*"'
- else
+
+else
+
SHLIB_LD='ld -non_shared -expect_unresolved "*"'
- fi
+
+fi
+
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
- CFLAGS="$CFLAGS -mieee"
- else
+fi
+
+ if test "$GCC" = yes; then
+ CFLAGS="$CFLAGS -mieee"
+else
+
CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
- fi
+fi
+
# see pthread_intro(3) for pthread support on osf1, k.furukawa
- if test "${TCL_THREADS}" = "1" ; then
+ if test "${TCL_THREADS}" = 1; then
+
CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
LIBS=`echo $LIBS | sed s/-lpthreads//`
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
LIBS="$LIBS -lpthread -lmach -lexc"
- else
+
+else
+
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
- fi
+
+fi
+
+
+fi
;;
QNX-6*)
@@ -3429,27 +6527,22 @@ EOF
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
- RISCos-*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- ;;
SCO_SV-3.2*)
# Note, dlopen is available only on SCO 3.2.5 and greater. However,
# this test works, since "uname -s" was non-standard in 3.2.4 and
# below.
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
SHLIB_CFLAGS="-fPIC -melf"
LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
- else
+
+else
+
SHLIB_CFLAGS="-Kpic -belf"
LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
- fi
+
+fi
+
SHLIB_LD="ld -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -3483,8 +6576,8 @@ EOF
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
SunOS-5.[0-6])
@@ -3493,81 +6586,114 @@ EOF
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
-EOF
+_ACEOF
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _POSIX_PTHREAD_SEMANTICS 1
-EOF
+_ACEOF
SHLIB_CFLAGS="-KPIC"
-
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
+
+else
+
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+
+fi
+
;;
SunOS-5*)
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
-EOF
+_ACEOF
+
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
#define _POSIX_PTHREAD_SEMANTICS 1
-EOF
+_ACEOF
SHLIB_CFLAGS="-KPIC"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
+ if test "$do64bit" = yes; then
+
arch=`isainfo`
- if test "$arch" = "sparcv9 sparc" ; then
- if test "$GCC" = "yes" ; then
- if test "`gcc -dumpversion | awk -F. '{print $1}'`" -lt "3" ; then
- echo "configure: warning: 64bit mode not supported with GCC < 3.2 on $system" 1>&2
- else
- do64bit_ok=yes
- CFLAGS="$CFLAGS -m64 -mcpu=v9"
- LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
- SHLIB_CFLAGS="-fPIC"
- fi
- else
+ if test "$arch" = "sparcv9 sparc"; then
+
+ if test "$GCC" = yes; then
+
+ if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;}
+
+else
+
do64bit_ok=yes
- if test "$do64bitVIS" = "yes" ; then
- CFLAGS="$CFLAGS -xarch=v9a"
- LDFLAGS="$LDFLAGS -xarch=v9a"
- else
- CFLAGS="$CFLAGS -xarch=v9"
- LDFLAGS="$LDFLAGS -xarch=v9"
- fi
- # Solaris 64 uses this as well
- #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
- fi
- elif test "$arch" = "amd64 i386" ; then
- if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -m64 -mcpu=v9"
+ LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+ SHLIB_CFLAGS="-fPIC"
+
+fi
+
+
+else
+
+ do64bit_ok=yes
+ if test "$do64bitVIS" = yes; then
+
+ CFLAGS="$CFLAGS -xarch=v9a"
+ LDFLAGS_ARCH="-xarch=v9a"
+
+else
+
+ CFLAGS="$CFLAGS -xarch=v9"
+ LDFLAGS_ARCH="-xarch=v9"
+
+fi
+
+ # Solaris 64 uses this as well
+ #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
+
+fi
+
+
+else
+ if test "$arch" = "amd64 i386"; then
+
+ if test "$GCC" = yes; then
+
case $system in
SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*)
do64bit_ok=yes
CFLAGS="$CFLAGS -m64"
LDFLAGS="$LDFLAGS -m64";;
*)
- echo "configure: warning: 64bit mode not supported with GCC on $system" 1>&2;;
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};;
esac
- else
+
+else
+
do64bit_ok=yes
case $system in
SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*)
@@ -3577,21 +6703,201 @@ EOF
CFLAGS="$CFLAGS -xarch=amd64"
LDFLAGS="$LDFLAGS -xarch=amd64";;
esac
- fi
- else
- echo "configure: warning: 64bit mode not supported for $arch" 1>&2
- fi
- fi
+
+fi
+
+
+else
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5
+echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;}
+fi
+
+fi
+
+
+fi
+
+
+ #--------------------------------------------------------------------
+ # On Solaris 5.x i386 with the sunpro compiler we need to link
+ # with sunmath to get floating point rounding control
+ #--------------------------------------------------------------------
+ if test "$GCC" = yes; then
+ use_sunmath=no
+else
+
+ arch=`isainfo`
+ echo "$as_me:$LINENO: checking whether to use -lsunmath for fp rounding control" >&5
+echo $ECHO_N "checking whether to use -lsunmath for fp rounding control... $ECHO_C" >&6
+ if test "$arch" = "amd64 i386"; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ MATH_LIBS="-lsunmath $MATH_LIBS"
+ if test "${ac_cv_header_sunmath_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for sunmath.h" >&5
+echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6
+if test "${ac_cv_header_sunmath_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5
+echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking sunmath.h usability" >&5
+echo $ECHO_N "checking sunmath.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sunmath.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sunmath.h presence" >&5
+echo $ECHO_N "checking sunmath.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sunmath.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sunmath.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sunmath.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sunmath.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sunmath.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sunmath.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sunmath.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to the tk lists. ##
+## ----------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for sunmath.h" >&5
+echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6
+if test "${ac_cv_header_sunmath_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sunmath_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5
+echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6
+
+fi
+
+
+ use_sunmath=yes
+
+else
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ use_sunmath=no
+
+fi
+
+
+fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
+ if test "$GCC" = yes; then
+
+ SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$do64bit_ok" = "yes" ; then
- if test "$arch" = "sparcv9 sparc" ; then
+ if test "$do64bit_ok" = yes; then
+
+ if test "$arch" = "sparcv9 sparc"; then
+
# We need to specify -static-libgcc or we need to
# add the path to the sparv9 libgcc.
SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
@@ -3599,33 +6905,39 @@ EOF
# path, remove so name and append 'sparcv9'
#v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
- elif test "$arch" = "amd64 i386" ; then
+
+else
+ if test "$arch" = "amd64 i386"; then
+
SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
- fi
- fi
- else
+
+fi
+
+fi
+
+
+fi
+
+
+else
+
+ if test "$use_sunmath" = yes; then
+ textmode=textoff
+else
+ textmode=text
+fi
+
case $system in
SunOS-5.[1-9][0-9]*)
- SHLIB_LD='${CC} -G -z text ${LDFLAGS}';;
+ SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
*)
- SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
+ SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
esac
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- fi
- ;;
- ULTRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$GCC" != "yes" ; then
- CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
- fi
+
+fi
+
;;
UNIX_SV* | UnixWare-5*)
SHLIB_CFLAGS="-KPIC"
@@ -3636,210 +6948,97 @@ EOF
DL_LIBS="-ldl"
# Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
# that don't grok the -Bexport option. Test that it does.
- echo $ac_n "checking for ld accepts -Bexport flag""... $ac_c" 1>&6
-echo "configure:3641: checking for ld accepts -Bexport flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_Bexport'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5
+echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_Bexport+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-Bexport"
- cat > conftest.$ac_ext <<EOF
-#line 3649 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
int i;
-; return 0; }
-EOF
-if { (eval echo configure:3656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_ld_Bexport=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_ld_Bexport=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_Bexport=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-
-echo "$ac_t""$tcl_cv_ld_Bexport" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5
+echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6
if test $tcl_cv_ld_Bexport = yes; then
+
LDFLAGS="$LDFLAGS -Wl,-Bexport"
- fi
+
+fi
+
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
esac
- if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
- echo "configure: warning: 64bit support being disabled -- don't know magic for this platform" 1>&2
- fi
+ if test "$do64bit" = yes -a "$do64bit_ok" = no; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5
+echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;}
-
-
-
- # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
- # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
- # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
- # to determine which of several header files defines the a.out file
- # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
- # support only a file format that is more or less version-7-compatible.
- # In particular,
- # - a.out files must begin with `struct exec'.
- # - the N_TXTOFF on the `struct exec' must compute the seek address
- # of the text segment
- # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
- # and a_entry fields.
- # The following compilation should succeed if and only if either sys/exec.h
- # or a.out.h is usable for the purpose.
- #
- # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
- # `struct exec' includes a second header that contains information that
- # duplicates the v7 fields that are needed.
-
- if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
- echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6
-echo "configure:3706: checking sys/exec.h" >&5
-if eval "test \"`echo '$''{'tcl_cv_sysexec_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 3712 "configure"
-#include "confdefs.h"
-#include <sys/exec.h>
-int main() {
-
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
-
-; return 0; }
-EOF
-if { (eval echo configure:3730: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- tcl_cv_sysexec_h=usable
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_sysexec_h=unusable
-fi
-rm -f conftest*
fi
-echo "$ac_t""$tcl_cv_sysexec_h" 1>&6
- if test $tcl_cv_sysexec_h = usable; then
- cat >> confdefs.h <<\EOF
-#define USE_SYS_EXEC_H 1
-EOF
- else
- echo $ac_n "checking a.out.h""... $ac_c" 1>&6
-echo "configure:3750: checking a.out.h" >&5
-if eval "test \"`echo '$''{'tcl_cv_aout_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 3756 "configure"
-#include "confdefs.h"
-#include <a.out.h>
-int main() {
-
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
-
-; return 0; }
-EOF
-if { (eval echo configure:3774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- tcl_cv_aout_h=usable
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_aout_h=unusable
-fi
-rm -f conftest*
-fi
+ if test "$do64bit" = yes -a "$do64bit_ok" = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_DO64BIT 1
+_ACEOF
-echo "$ac_t""$tcl_cv_aout_h" 1>&6
- if test $tcl_cv_aout_h = usable; then
- cat >> confdefs.h <<\EOF
-#define USE_A_OUT_H 1
-EOF
- else
- echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6
-echo "configure:3794: checking sys/exec_aout.h" >&5
-if eval "test \"`echo '$''{'tcl_cv_sysexecaout_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 3800 "configure"
-#include "confdefs.h"
-#include <sys/exec_aout.h>
-int main() {
-
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_midmag == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
-
-; return 0; }
-EOF
-if { (eval echo configure:3818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- tcl_cv_sysexecaout_h=usable
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_sysexecaout_h=unusable
-fi
-rm -f conftest*
fi
-echo "$ac_t""$tcl_cv_sysexecaout_h" 1>&6
- if test $tcl_cv_sysexecaout_h = usable; then
- cat >> confdefs.h <<\EOF
-#define USE_SYS_EXEC_AOUT_H 1
-EOF
- else
- DL_OBJS=""
- fi
- fi
- fi
- fi
- # Step 5: disable dynamic loading if requested via a command-line switch.
+
+ # Step 4: disable dynamic loading if requested via a command-line switch.
# Check whether --enable-load or --disable-load was given.
if test "${enable_load+set}" = set; then
@@ -3847,17 +7046,18 @@ if test "${enable_load+set}" = set; then
tcl_ok=$enableval
else
tcl_ok=yes
+fi;
+ if test "$tcl_ok" = no; then
+ DL_OBJS=""
fi
- if test "$tcl_ok" = "no"; then
- DL_OBJS=""
- fi
- if test "x$DL_OBJS" != "x" ; then
- BUILD_DLTEST="\$(DLTEST_TARGETS)"
- else
- echo "Can't figure out how to do dynamic loading or shared libraries"
- echo "on this system."
+ if test "x$DL_OBJS" != x; then
+ BUILD_DLTEST="\$(DLTEST_TARGETS)"
+else
+
+ { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5
+echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;}
SHLIB_CFLAGS=""
SHLIB_LD=""
SHLIB_SUFFIX=""
@@ -3867,13 +7067,17 @@ fi
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
BUILD_DLTEST=""
- fi
+
+fi
+
+ LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
# If we're running gcc, then change the C flags for compiling shared
# libraries to the right flags for gcc, instead of those for the
# standard manufacturer compiler.
- if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes ; then
+ if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then
+
case $system in
AIX-*) ;;
BSD/OS*) ;;
@@ -3881,526 +7085,924 @@ fi
IRIX*) ;;
NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
Darwin-*) ;;
- RISCos-*) ;;
SCO_SV-3.2*) ;;
- ULTRIX-4.*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
esac
- fi
+fi
- if test "$SHARED_LIB_SUFFIX" = "" ; then
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
- fi
- if test "$UNSHARED_LIB_SUFFIX" = "" ; then
- UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- fi
- if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
+ if test "$SHARED_LIB_SUFFIX" = ""; then
+
+ SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'
+fi
+
+ if test "$UNSHARED_LIB_SUFFIX" = ""; then
+
+ UNSHARED_LIB_SUFFIX='${VERSION}.a'
+fi
+
+
+ if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then
+
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+
+else
+
LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
- if test "$RANLIB" = "" ; then
+ if test "$RANLIB" = ""; then
+
MAKE_LIB='$(STLIB_LD) $@ ${OBJS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+
+else
+
MAKE_LIB='${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
- fi
- fi
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(LIB_FILE))'
+
+fi
+
+
+fi
# Stub lib does not depend on shared/static configuration
- if test "$RANLIB" = "" ; then
+ if test "$RANLIB" = ""; then
+
MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
- else
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
+
+else
+
MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
- fi
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)"/$(STUB_LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(STUB_LIB_FILE))'
+
+fi
+
+
+ # Define TCL_LIBS now that we know what DL_LIBS is.
+ # The trick here is that we don't want to change the value of TCL_LIBS if
+ # it is already set when tclConfig.sh had been loaded by Tk.
+ if test "x${TCL_LIBS}" = x; then
+
+ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"
+fi
+
-
+ # FIXME: This subst was left in only because the TCL_DL_LIBS
+ # entry in tclConfig.sh uses it. It is not clear why someone
+ # would use TCL_DL_LIBS instead of TCL_LIBS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:3959: checking for build with symbols" >&5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define TCL_SHLIB_EXT "${SHLIB_SUFFIX}"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking for build with symbols" >&5
+echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6
# Check whether --enable-symbols or --disable-symbols was given.
if test "${enable_symbols+set}" = set; then
enableval="$enable_symbols"
tcl_ok=$enableval
else
tcl_ok=no
-fi
-
+fi;
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
+ DBGX=""
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_OPTIMIZED 1
+_ACEOF
+
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
- echo "$ac_t""yes (standard debugging)" 1>&6
+ echo "$as_me:$LINENO: result: yes (standard debugging)" >&5
+echo "${ECHO_T}yes (standard debugging)" >&6
fi
fi
-
-
+
+
+ ### FIXME: Surely TCL_CFG_DEBUG should be set to whether we're debugging?
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_DEBUG 1
+_ACEOF
+
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TCL_MEM_DEBUG 1
-EOF
+_ACEOF
fi
- if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
- cat >> confdefs.h <<\EOF
-#define TCL_COMPILE_DEBUG 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define TCL_COMPILE_STATS 1
-EOF
- fi
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- echo "$ac_t""enabled symbols mem compile debugging" 1>&6
+ echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5
+echo "${ECHO_T}enabled symbols mem debugging" >&6
else
- echo "$ac_t""enabled $tcl_ok debugging" 1>&6
+ echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
+echo "${ECHO_T}enabled $tcl_ok debugging" >&6
fi
fi
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Detect what compiler flags to set for 64-bit support.
#--------------------------------------------------------------------
- echo $ac_n "checking for required early compiler flags""... $ac_c" 1>&6
-echo "configure:4020: checking for required early compiler flags" >&5
+ echo "$as_me:$LINENO: checking for required early compiler flags" >&5
+echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6
tcl_flags=""
-
- if eval "test \"`echo '$''{'tcl_cv_flag__isoc99_source'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ if test "${tcl_cv_flag__isoc99_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4027 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
-int main() {
+int
+main ()
+{
char *p = (char *)strtoll; char *q = (char *)strtoull;
-; return 0; }
-EOF
-if { (eval echo configure:4034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_flag__isoc99_source=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 4042 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _ISOC99_SOURCE 1
#include <stdlib.h>
-int main() {
+int
+main ()
+{
char *p = (char *)strtoll; char *q = (char *)strtoull;
-; return 0; }
-EOF
-if { (eval echo configure:4050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_flag__isoc99_source=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_flag__isoc99_source=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__isoc99_source=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _ISOC99_SOURCE 1
-EOF
+_ACEOF
tcl_flags="$tcl_flags _ISOC99_SOURCE"
fi
-
- if eval "test \"`echo '$''{'tcl_cv_flag__largefile64_source'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ if test "${tcl_cv_flag__largefile64_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4077 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
struct stat64 buf; int i = stat64("/", &buf);
-; return 0; }
-EOF
-if { (eval echo configure:4084: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_flag__largefile64_source=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 4092 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _LARGEFILE64_SOURCE 1
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
struct stat64 buf; int i = stat64("/", &buf);
-; return 0; }
-EOF
-if { (eval echo configure:4100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_flag__largefile64_source=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_flag__largefile64_source=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__largefile64_source=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _LARGEFILE64_SOURCE 1
-EOF
+_ACEOF
tcl_flags="$tcl_flags _LARGEFILE64_SOURCE"
fi
-
- if eval "test \"`echo '$''{'tcl_cv_flag__largefile_source64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ if test "${tcl_cv_flag__largefile_source64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4127 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
char *p = (char *)open64;
-; return 0; }
-EOF
-if { (eval echo configure:4134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_flag__largefile_source64=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 4142 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _LARGEFILE_SOURCE64 1
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
char *p = (char *)open64;
-; return 0; }
-EOF
-if { (eval echo configure:4150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_flag__largefile_source64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_flag__largefile_source64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__largefile_source64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _LARGEFILE_SOURCE64 1
-EOF
+_ACEOF
tcl_flags="$tcl_flags _LARGEFILE_SOURCE64"
fi
if test "x${tcl_flags}" = "x" ; then
- echo "$ac_t""none" 1>&6
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
else
- echo "$ac_t""${tcl_flags}" 1>&6
+ echo "$as_me:$LINENO: result: ${tcl_flags}" >&5
+echo "${ECHO_T}${tcl_flags}" >&6
fi
- echo $ac_n "checking for 64-bit integer type""... $ac_c" 1>&6
-echo "configure:4181: checking for 64-bit integer type" >&5
- if eval "test \"`echo '$''{'tcl_cv_type_64bit'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for 64-bit integer type" >&5
+echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6
+ if test "${tcl_cv_type_64bit+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
tcl_cv_type_64bit=none
# See if the compiler knows natively about __int64
- cat > conftest.$ac_ext <<EOF
-#line 4189 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
__int64 value = (__int64) 0;
-; return 0; }
-EOF
-if { (eval echo configure:4196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_type_64bit=__int64
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_type_64bit="long long"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_type_64bit="long long"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
# See if we should use long anyway Note that we substitute in the
# type that is our current guess for a 64-bit type inside this check
# program, so it should be modified only carefully...
- cat > conftest.$ac_ext <<EOF
-#line 4210 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
switch (0) {
case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
}
-; return 0; }
-EOF
-if { (eval echo configure:4219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_type_64bit=${tcl_type_64bit}
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "${tcl_cv_type_64bit}" = none ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TCL_WIDE_INT_IS_LONG 1
-EOF
+_ACEOF
- echo "$ac_t""using long" 1>&6
+ echo "$as_me:$LINENO: result: using long" >&5
+echo "${ECHO_T}using long" >&6
else
- cat >> confdefs.h <<EOF
+
+cat >>confdefs.h <<_ACEOF
#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}
-EOF
+_ACEOF
- echo "$ac_t""${tcl_cv_type_64bit}" 1>&6
+ echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5
+echo "${ECHO_T}${tcl_cv_type_64bit}" >&6
# Now check for auxiliary declarations
- echo $ac_n "checking for struct dirent64""... $ac_c" 1>&6
-echo "configure:4244: checking for struct dirent64" >&5
-if eval "test \"`echo '$''{'tcl_cv_struct_dirent64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 4250 "configure"
-#include "confdefs.h"
+ echo "$as_me:$LINENO: checking for struct dirent64" >&5
+echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6
+if test "${tcl_cv_struct_dirent64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/dirent.h>
-int main() {
+int
+main ()
+{
struct dirent64 p;
-; return 0; }
-EOF
-if { (eval echo configure:4258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_struct_dirent64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_struct_dirent64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_struct_dirent64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_struct_dirent64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5
+echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6
if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_STRUCT_DIRENT64 1
-EOF
+_ACEOF
fi
- echo $ac_n "checking for struct stat64""... $ac_c" 1>&6
-echo "configure:4279: checking for struct stat64" >&5
-if eval "test \"`echo '$''{'tcl_cv_struct_stat64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for struct stat64" >&5
+echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6
+if test "${tcl_cv_struct_stat64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 4285 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
struct stat64 p;
-; return 0; }
-EOF
-if { (eval echo configure:4293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_struct_stat64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_struct_stat64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_struct_stat64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_struct_stat64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5
+echo "${ECHO_T}$tcl_cv_struct_stat64" >&6
if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_STRUCT_STAT64 1
-EOF
+_ACEOF
fi
- for ac_func in open64 lseek64
+
+
+for ac_func in open64 lseek64
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4316: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4321 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-int main() {
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
- echo $ac_n "checking for off64_t""... $ac_c" 1>&6
-echo "configure:4369: checking for off64_t" >&5
- if eval "test \"`echo '$''{'tcl_cv_type_off64_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for off64_t" >&5
+echo $ECHO_N "checking for off64_t... $ECHO_C" >&6
+ if test "${tcl_cv_type_off64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 4375 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
-int main() {
+int
+main ()
+{
off64_t offset;
-; return 0; }
-EOF
-if { (eval echo configure:4383: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_type_off64_t=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_type_off64_t=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_type_off64_t=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
test "x${ac_cv_func_lseek64}" = "xyes" && \
test "x${ac_cv_func_open64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_TYPE_OFF64_T 1
-EOF
+_ACEOF
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
fi
@@ -4409,63 +8011,182 @@ EOF
# Check endianness because we can optimize some operations
#--------------------------------------------------------------------
-echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:4414: checking whether byte ordering is bigendian" >&5
-if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_cv_c_bigendian=unknown
-# See if sys/param.h defines the BYTE_ORDER macro.
-cat > conftest.$ac_ext <<EOF
-#line 4421 "configure"
-#include "confdefs.h"
+echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
+if test "${ac_cv_c_bigendian+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/param.h>
-int main() {
+int
+main ()
+{
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
# It does; now see whether it defined to BIG_ENDIAN or not.
-cat > conftest.$ac_ext <<EOF
-#line 4436 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/param.h>
-int main() {
+int
+main ()
+{
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_bigendian=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_bigendian=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_bigendian=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-if test $ac_cv_c_bigendian = unknown; then
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+# It does not; compile a test program.
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+ # try to guess the endianness by grepping values into an object file
+ ac_cv_c_bigendian=unknown
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+ ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+fi
else
- cat > conftest.$ac_ext <<EOF
-#line 4467 "configure"
-#include "confdefs.h"
-main () {
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+int
+main ()
+{
/* Are we little or big endian? From Harbison&Steele. */
union
{
@@ -4475,29 +8196,50 @@ main () {
u.l = 1;
exit (u.c[sizeof (long) - 1] == 1);
}
-EOF
-if { (eval echo configure:4480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_bigendian=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_bigendian=yes
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
fi
-rm -fr conftest*
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+case $ac_cv_c_bigendian in
+ yes)
-echo "$ac_t""$ac_cv_c_bigendian" 1>&6
-if test $ac_cv_c_bigendian = yes; then
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
#define WORDS_BIGENDIAN 1
-EOF
-
-fi
+_ACEOF
+ ;;
+ no)
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
#------------------------------------------------------------------------
@@ -4512,9 +8254,12 @@ if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
fi
if test "$TCL_PREFIX" != "$prefix"; then
- echo "configure: warning:
+ { echo "$as_me:$LINENO: WARNING:
+ Different --prefix selected for Tk and Tcl!
+ [package require Tk] may not work correctly in tclsh." >&5
+echo "$as_me: WARNING:
Different --prefix selected for Tk and Tcl!
- [package require Tk] may not work correctly in tclsh." 1>&2
+ [package require Tk] may not work correctly in tclsh." >&2;}
fi
#--------------------------------------------------------------------
@@ -4527,71 +8272,102 @@ fi
# special flag.
#--------------------------------------------------------------------
-echo $ac_n "checking for fd_set in sys/types""... $ac_c" 1>&6
-echo "configure:4532: checking for fd_set in sys/types" >&5
-if eval "test \"`echo '$''{'tcl_cv_type_fd_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for fd_set in sys/types" >&5
+echo $ECHO_N "checking for fd_set in sys/types... $ECHO_C" >&6
+if test "${tcl_cv_type_fd_set+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 4538 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
-int main() {
+int
+main ()
+{
fd_set readMask, writeMask;
-; return 0; }
-EOF
-if { (eval echo configure:4545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_type_fd_set=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_type_fd_set=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_type_fd_set=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_type_fd_set" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_type_fd_set" >&5
+echo "${ECHO_T}$tcl_cv_type_fd_set" >&6
tk_ok=$tcl_cv_type_fd_set
if test $tk_ok = no; then
- echo $ac_n "checking for fd_mask in sys/select""... $ac_c" 1>&6
-echo "configure:4561: checking for fd_mask in sys/select" >&5
-if eval "test \"`echo '$''{'tcl_cv_grep_fd_mask'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 4567 "configure"
-#include "confdefs.h"
+ echo "$as_me:$LINENO: checking for fd_mask in sys/select" >&5
+echo $ECHO_N "checking for fd_mask in sys/select... $ECHO_C" >&6
+if test "${tcl_cv_grep_fd_mask+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/select.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "fd_mask" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "fd_mask" >/dev/null 2>&1; then
tcl_cv_grep_fd_mask=present
else
- rm -rf conftest*
tcl_cv_grep_fd_mask=missing
fi
rm -f conftest*
fi
-
-echo "$ac_t""$tcl_cv_grep_fd_mask" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_grep_fd_mask" >&5
+echo "${ECHO_T}$tcl_cv_grep_fd_mask" >&6
if test $tcl_cv_grep_fd_mask = present; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_SELECT_H 1
-EOF
+_ACEOF
tk_ok=yes
fi
fi
if test $tk_ok = no; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define NO_FD_SET 1
-EOF
+_ACEOF
fi
@@ -4599,78 +8375,218 @@ fi
# Find out all about time handling differences.
#------------------------------------------------------------------------------
-for ac_hdr in sys/time.h
+
+for ac_header in sys/time.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4607: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4612 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to the tk lists. ##
+## ----------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
+
done
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4644: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4649 "configure"
-#include "confdefs.h"
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:4658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_time=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_time=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
if test $ac_cv_header_time = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TIME_WITH_SYS_TIME 1
-EOF
+_ACEOF
fi
@@ -4683,68 +8599,118 @@ fi
#--------------------------------------------------------------------
- echo $ac_n "checking for strtod""... $ac_c" 1>&6
-echo "configure:4688: checking for strtod" >&5
-if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for strtod" >&5
+echo $ECHO_N "checking for strtod... $ECHO_C" >&6
+if test "${ac_cv_func_strtod+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4693 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define strtod to an innocuous variant, in case <limits.h> declares strtod.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define strtod innocuous_strtod
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char strtod(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char strtod();
+ which can conflict with char strtod (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-int main() {
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+#undef strtod
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strtod ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_strtod) || defined (__stub___strtod)
choke me
#else
-strtod();
+char (*f) () = strtod;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_strtod=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_strtod=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'strtod`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+int
+main ()
+{
+return f != strtod;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_strtod=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_strtod=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5
+echo "${ECHO_T}$ac_cv_func_strtod" >&6
+if test $ac_cv_func_strtod = yes; then
tcl_strtod=1
else
- echo "$ac_t""no" 1>&6
-tcl_strtod=0
+ tcl_strtod=0
fi
if test "$tcl_strtod" = 1; then
- echo $ac_n "checking for Solaris2.4/Tru64 strtod bugs""... $ac_c" 1>&6
-echo "configure:4738: checking for Solaris2.4/Tru64 strtod bugs" >&5
-if eval "test \"`echo '$''{'tcl_cv_strtod_buggy'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for Solaris2.4/Tru64 strtod bugs" >&5
+echo $ECHO_N "checking for Solaris2.4/Tru64 strtod bugs... $ECHO_C" >&6
+if test "${tcl_cv_strtod_buggy+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
if test "$cross_compiling" = yes; then
tcl_cv_strtod_buggy=buggy
else
- cat > conftest.$ac_ext <<EOF
-#line 4747 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
extern double strtod();
int main() {
@@ -4765,27 +8731,46 @@ else
}
exit(0);
}
-EOF
-if { (eval echo configure:4770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_strtod_buggy=ok
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- tcl_cv_strtod_buggy=buggy
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+tcl_cv_strtod_buggy=buggy
fi
-rm -fr conftest*
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-
-echo "$ac_t""$tcl_cv_strtod_buggy" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_strtod_buggy" >&5
+echo "${ECHO_T}$tcl_cv_strtod_buggy" >&6
if test "$tcl_cv_strtod_buggy" = buggy; then
- LIBOBJS="$LIBOBJS fixstrtod.o"
- cat >> confdefs.h <<\EOF
+ case $LIBOBJS in
+ "fixstrtod.$ac_objext" | \
+ *" fixstrtod.$ac_objext" | \
+ "fixstrtod.$ac_objext "* | \
+ *" fixstrtod.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS fixstrtod.$ac_objext" ;;
+esac
+
+ USE_COMPAT=1
+
+cat >>confdefs.h <<\_ACEOF
#define strtod fixstrtod
-EOF
+_ACEOF
fi
fi
@@ -4796,240 +8781,511 @@ EOF
# they don't exist.
#--------------------------------------------------------------------
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4801: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4806 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
+echo "$as_me:$LINENO: checking for mode_t" >&5
+echo $ECHO_N "checking for mode_t... $ECHO_C" >&6
+if test "${ac_cv_type_mode_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((mode_t *) 0)
+ return 0;
+if (sizeof (mode_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_mode_t=yes
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 4831 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
+ac_cv_type_mode_t=no
fi
-rm -f conftest*
-
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 4849 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
+echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
+echo "${ECHO_T}$ac_cv_type_mode_t" >&6
+if test $ac_cv_type_mode_t = yes; then
:
else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-fi
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
+if test "${ac_cv_type_pid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((pid_t *) 0)
+ return 0;
+if (sizeof (pid_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_pid_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
+ac_cv_type_pid_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6
+if test $ac_cv_type_pid_t = yes; then
:
else
- cat > conftest.$ac_ext <<EOF
-#line 4870 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-EOF
-if { (eval echo configure:4881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+ return 0;
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_size_t=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_type_size_t=no
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+ :
+else
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
fi
-echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:4905: checking for mode_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6
+if test "${ac_cv_type_uid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4910 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_mode_t=yes
+ $EGREP "uid_t" >/dev/null 2>&1; then
+ ac_cv_type_uid_t=yes
else
- rm -rf conftest*
- ac_cv_type_mode_t=no
+ ac_cv_type_uid_t=no
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_type_mode_t" 1>&6
-if test $ac_cv_type_mode_t = no; then
- cat >> confdefs.h <<\EOF
-#define mode_t int
-EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
+echo "${ECHO_T}$ac_cv_type_uid_t" >&6
+if test $ac_cv_type_uid_t = no; then
-fi
+cat >>confdefs.h <<\_ACEOF
+#define uid_t int
+_ACEOF
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4938: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4943 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_pid_t=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define gid_t int
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for intptr_t" >&5
+echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_intptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((intptr_t *) 0)
+ return 0;
+if (sizeof (intptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_intptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_intptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_intptr_t" >&6
+if test $ac_cv_type_intptr_t = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTPTR_T 1
+_ACEOF
+
+else
+
+ echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5
+echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6
+if test "${tcl_cv_intptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ for tcl_cv_intptr_t in "int" "long" "long long" none; do
+ if test "$tcl_cv_intptr_t" != none; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_ok=yes
else
- rm -rf conftest*
- ac_cv_type_pid_t=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+tcl_ok=no
fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&6
-if test $ac_cv_type_pid_t = no; then
- cat >> confdefs.h <<\EOF
-#define pid_t int
-EOF
-
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$tcl_ok" = yes && break; fi
+ done
fi
+echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5
+echo "${ECHO_T}$tcl_cv_intptr_t" >&6
+ if test "$tcl_cv_intptr_t" != none; then
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4971: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4976 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
-else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $tcl_cv_intptr_t
+_ACEOF
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
+ fi
fi
-echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5004: checking for uid_t in sys/types.h" >&5
-if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5009 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "uid_t" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_uid_t=yes
+echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((uintptr_t *) 0)
+ return 0;
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
+if test $ac_cv_type_uintptr_t = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINTPTR_T 1
+_ACEOF
+
+else
+
+ echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5
+echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6
+if test "${tcl_cv_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
+ none; do
+ if test "$tcl_cv_uintptr_t" != none; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_ok=yes
else
- rm -rf conftest*
- ac_cv_type_uid_t=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+tcl_ok=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$tcl_ok" = yes && break; fi
+ done
fi
+echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5
+echo "${ECHO_T}$tcl_cv_uintptr_t" >&6
+ if test "$tcl_cv_uintptr_t" != none; then
-echo "$ac_t""$ac_cv_type_uid_t" 1>&6
-if test $ac_cv_type_uid_t = no; then
- cat >> confdefs.h <<\EOF
-#define uid_t int
-EOF
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t $tcl_cv_uintptr_t
+_ACEOF
- cat >> confdefs.h <<\EOF
-#define gid_t int
-EOF
+ fi
fi
@@ -5038,37 +9294,65 @@ fi
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
-echo $ac_n "checking pw_gecos in struct pwd""... $ac_c" 1>&6
-echo "configure:5043: checking pw_gecos in struct pwd" >&5
-if eval "test \"`echo '$''{'tcl_cv_pwd_pw_gecos'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking pw_gecos in struct pwd" >&5
+echo $ECHO_N "checking pw_gecos in struct pwd... $ECHO_C" >&6
+if test "${tcl_cv_pwd_pw_gecos+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 5049 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <pwd.h>
-int main() {
+int
+main ()
+{
struct passwd pwd; pwd.pw_gecos;
-; return 0; }
-EOF
-if { (eval echo configure:5056: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_pwd_pw_gecos=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_pwd_pw_gecos=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_pwd_pw_gecos=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_pwd_pw_gecos" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_pwd_pw_gecos" >&5
+echo "${ECHO_T}$tcl_cv_pwd_pw_gecos" >&6
if test $tcl_cv_pwd_pw_gecos = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PW_GECOS 1
-EOF
+_ACEOF
fi
@@ -5077,94 +9361,487 @@ fi
#--------------------------------------------------------------------
if test "`uname -s`" = "Darwin" ; then
- echo $ac_n "checking whether to use Aqua""... $ac_c" 1>&6
-echo "configure:5082: checking whether to use Aqua" >&5
+ echo "$as_me:$LINENO: checking whether to use Aqua" >&5
+echo $ECHO_N "checking whether to use Aqua... $ECHO_C" >&6
# Check whether --enable-aqua or --disable-aqua was given.
if test "${enable_aqua+set}" = set; then
enableval="$enable_aqua"
tk_aqua=$enableval
else
tk_aqua=no
-fi
-
+fi;
if test $tk_aqua = yes; then
if test $tcl_corefoundation = no; then
- echo "configure: warning: Aqua can only be used when CoreFoundation is available" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Aqua can only be used when CoreFoundation is available" >&5
+echo "$as_me: WARNING: Aqua can only be used when CoreFoundation is available" >&2;}
tk_aqua=no
fi
if test ! -d /System/Library/Frameworks/Carbon.framework; then
- echo "configure: warning: Aqua can only be used when Carbon is available" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Aqua can only be used when Carbon is available" >&5
+echo "$as_me: WARNING: Aqua can only be used when Carbon is available" >&2;}
tk_aqua=no
fi
if test "`uname -r | awk -F. '{print $1}'`" -lt 6; then
- echo "configure: warning: Aqua requires Mac OS X 10.2 or later" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Aqua requires Mac OS X 10.2 or later" >&5
+echo "$as_me: WARNING: Aqua requires Mac OS X 10.2 or later" >&2;}
tk_aqua=no
fi
fi
- echo "$ac_t""$tk_aqua" 1>&6
+ echo "$as_me:$LINENO: result: $tk_aqua" >&5
+echo "${ECHO_T}$tk_aqua" >&6
if test "$fat_32_64" = yes; then
if test $tk_aqua = no; then
- echo $ac_n "checking for 64-bit X11""... $ac_c" 1>&6
-echo "configure:5109: checking for 64-bit X11" >&5
-if eval "test \"`echo '$''{'tcl_cv_lib_x11_64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for 64-bit X11" >&5
+echo $ECHO_N "checking for 64-bit X11... $ECHO_C" >&6
+if test "${tcl_cv_lib_x11_64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
- cat > conftest.$ac_ext <<EOF
-#line 5120 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/Xlib.h>
-int main() {
+int
+main ()
+{
XrmInitialize();
-; return 0; }
-EOF
-if { (eval echo configure:5127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_cv_lib_x11_64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_lib_x11_64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_lib_x11_64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done
fi
-
-echo "$ac_t""$tcl_cv_lib_x11_64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_lib_x11_64" >&5
+echo "${ECHO_T}$tcl_cv_lib_x11_64" >&6
fi
# remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit
# fat builds if configuration does not support 64-bit.
if test $tk_aqua = yes -o "$tcl_cv_lib_x11_64" = no; then
- echo "configure: warning: Removing 64-bit architectures from compiler & linker flags" 1>&2
+ { echo "$as_me:$LINENO: Removing 64-bit architectures from compiler & linker flags" >&5
+echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;}
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
done
fi
fi
+ if test $tk_aqua = no; then
+ # check if weak linking whole libraries is possible.
+ echo "$as_me:$LINENO: checking if ld accepts -weak-l flag" >&5
+echo $ECHO_N "checking if ld accepts -weak-l flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_weak_l+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-weak-lm"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <math.h>
+int
+main ()
+{
+double f = sin(1.0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_ld_weak_l=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_weak_l=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$hold_ldflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_weak_l" >&5
+echo "${ECHO_T}$tcl_cv_ld_weak_l" >&6
+ fi
+
+for ac_header in AvailabilityMacros.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to the tk lists. ##
+## ----------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
+ echo "$as_me:$LINENO: checking if weak import is available" >&5
+echo $ECHO_N "checking if weak import is available... $ECHO_C" >&6
+if test "${tcl_cv_cc_weak_import+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #endif
+ int rand(void) __attribute__((weak_import));
+
+int
+main ()
+{
+rand();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_cc_weak_import=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_weak_import=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_weak_import" >&5
+echo "${ECHO_T}$tcl_cv_cc_weak_import" >&6
+ if test $tcl_cv_cc_weak_import = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WEAK_IMPORT 1
+_ACEOF
+
+ fi
+ echo "$as_me:$LINENO: checking if Darwin SUSv3 extensions are available" >&5
+echo $ECHO_N "checking if Darwin SUSv3 extensions are available... $ECHO_C" >&6
+if test "${tcl_cv_cc_darwin_c_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #endif
+ #define _DARWIN_C_SOURCE 1
+ #include <sys/cdefs.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_cc_darwin_c_source=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_darwin_c_source=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_darwin_c_source" >&5
+echo "${ECHO_T}$tcl_cv_cc_darwin_c_source" >&6
+ if test $tcl_cv_cc_darwin_c_source = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+ fi
+ fi
else
tk_aqua=no
fi
if test $tk_aqua = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define MAC_OSX_TK 1
-EOF
+_ACEOF
- LIBS="$LIBS -framework Carbon"
+ LIBS="$LIBS -framework Carbon -framework IOKit"
CFLAGS="$CFLAGS -fpascal-strings"
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TK_MAC_DEBUG 1
-EOF
+_ACEOF
fi
else
@@ -5176,21 +9853,17 @@ else
# autoconf macro will return an include directory that contains
# no include files, so double-check its result just to be safe.
#--------------------------------------------------------------------
-
-
- # If we find X, set shell vars x_includes and x_libraries to the
-# paths, otherwise set no_x=yes.
-# Uses ac_ vars as temps to allow command line to override cache and checks.
-# --without-x overrides everything else, but does not touch the cache.
-echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:5187: checking for X" >&5
+
+
+ echo "$as_me:$LINENO: checking for X" >&5
+echo $ECHO_N "checking for X... $ECHO_C" >&6
+
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
withval="$with_x"
- :
-fi
+fi;
# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
if test "x$with_x" = xno; then
# The user explicitly disabled X.
@@ -5200,207 +9873,210 @@ else
# Both variables are already set.
have_x=yes
else
-if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ if test "${ac_cv_have_x+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# One or both of the vars are not set, and there is no cached value.
-ac_x_includes=NO ac_x_libraries=NO
-rm -fr conftestdir
-if mkdir conftestdir; then
- cd conftestdir
+ac_x_includes=no ac_x_libraries=no
+rm -fr conftest.dir
+if mkdir conftest.dir; then
+ cd conftest.dir
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
- cat > Imakefile <<'EOF'
+ cat >Imakefile <<'_ACEOF'
acfindx:
@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
-EOF
+_ACEOF
if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
- test -f $ac_im_libdir/libX11.$ac_extension; then
- ac_im_usrlibdir=$ac_im_libdir; break
+ test -f $ac_im_libdir/libX11.$ac_extension; then
+ ac_im_usrlibdir=$ac_im_libdir; break
fi
done
# Screen out bogus values from the imake configuration. They are
# bogus both because they are the default anyway, and because
# using them would break gcc on systems where it needs fixed includes.
- case "$ac_im_incroot" in
+ case $ac_im_incroot in
/usr/include) ;;
- *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
esac
- case "$ac_im_usrlibdir" in
+ case $ac_im_usrlibdir in
/usr/lib | /lib) ;;
- *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
esac
fi
cd ..
- rm -fr conftestdir
+ rm -fr conftest.dir
fi
-if test "$ac_x_includes" = NO; then
- # Guess where to find include files, by looking for this one X11 .h file.
- test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
-
+# Standard set of common directories for X headers.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ac_x_header_dirs='
+/usr/X11/include
+/usr/X11R6/include
+/usr/X11R5/include
+/usr/X11R4/include
+
+/usr/include/X11
+/usr/include/X11R6
+/usr/include/X11R5
+/usr/include/X11R4
+
+/usr/local/X11/include
+/usr/local/X11R6/include
+/usr/local/X11R5/include
+/usr/local/X11R4/include
+
+/usr/local/include/X11
+/usr/local/include/X11R6
+/usr/local/include/X11R5
+/usr/local/include/X11R4
+
+/usr/X386/include
+/usr/x386/include
+/usr/XFree86/include/X11
+
+/usr/include
+/usr/local/include
+/usr/unsupported/include
+/usr/athena/include
+/usr/local/x11r5/include
+/usr/lpp/Xamples/include
+
+/usr/openwin/include
+/usr/openwin/share/include'
+
+if test "$ac_x_includes" = no; then
+ # Guess where to find include files, by looking for Xlib.h.
# First, try using that file with no special directory specified.
-cat > conftest.$ac_ext <<EOF
-#line 5249 "configure"
-#include "confdefs.h"
-#include <$x_direct_test_include>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
# We can compile using X headers with no special include directory.
ac_x_includes=
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- # Look for the header file in a standard set of common directories.
-# Check X11 before X11Rn because it is often a symlink to the current release.
- for ac_dir in \
- /usr/X11/include \
- /usr/X11R6/include \
- /usr/X11R5/include \
- /usr/X11R4/include \
- \
- /usr/include/X11 \
- /usr/include/X11R6 \
- /usr/include/X11R5 \
- /usr/include/X11R4 \
- \
- /usr/local/X11/include \
- /usr/local/X11R6/include \
- /usr/local/X11R5/include \
- /usr/local/X11R4/include \
- \
- /usr/local/include/X11 \
- /usr/local/include/X11R6 \
- /usr/local/include/X11R5 \
- /usr/local/include/X11R4 \
- \
- /usr/X386/include \
- /usr/x386/include \
- /usr/XFree86/include/X11 \
- \
- /usr/include \
- /usr/local/include \
- /usr/unsupported/include \
- /usr/athena/include \
- /usr/local/x11r5/include \
- /usr/lpp/Xamples/include \
- \
- /usr/openwin/include \
- /usr/openwin/share/include \
- ; \
- do
- if test -r "$ac_dir/$x_direct_test_include"; then
- ac_x_includes=$ac_dir
- break
- fi
- done
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ for ac_dir in $ac_x_header_dirs; do
+ if test -r "$ac_dir/X11/Xlib.h"; then
+ ac_x_includes=$ac_dir
+ break
+ fi
+done
fi
-rm -f conftest*
-fi # $ac_x_includes = NO
+rm -f conftest.err conftest.$ac_ext
+fi # $ac_x_includes = no
-if test "$ac_x_libraries" = NO; then
+if test "$ac_x_libraries" = no; then
# Check for the libraries.
-
- test -z "$x_direct_test_library" && x_direct_test_library=Xt
- test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
-
# See if we find them without any special options.
# Don't add to $LIBS permanently.
- ac_save_LIBS="$LIBS"
- LIBS="-l$x_direct_test_library $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5323 "configure"
-#include "confdefs.h"
-
-int main() {
-${x_direct_test_function}()
-; return 0; }
-EOF
-if { (eval echo configure:5330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- LIBS="$ac_save_LIBS"
+ ac_save_LIBS=$LIBS
+ LIBS="-lX11 $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+int
+main ()
+{
+XrmInitialize ()
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ LIBS=$ac_save_LIBS
# We can link X programs with no special library path.
ac_x_libraries=
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- LIBS="$ac_save_LIBS"
-# First see if replacing the include by lib works.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
- /usr/X11/lib \
- /usr/X11R6/lib \
- /usr/X11R5/lib \
- /usr/X11R4/lib \
- \
- /usr/lib/X11 \
- /usr/lib/X11R6 \
- /usr/lib/X11R5 \
- /usr/lib/X11R4 \
- \
- /usr/local/X11/lib \
- /usr/local/X11R6/lib \
- /usr/local/X11R5/lib \
- /usr/local/X11R4/lib \
- \
- /usr/local/lib/X11 \
- /usr/local/lib/X11R6 \
- /usr/local/lib/X11R5 \
- /usr/local/lib/X11R4 \
- \
- /usr/X386/lib \
- /usr/x386/lib \
- /usr/XFree86/lib/X11 \
- \
- /usr/lib \
- /usr/local/lib \
- /usr/unsupported/lib \
- /usr/athena/lib \
- /usr/local/x11r5/lib \
- /usr/lpp/Xamples/lib \
- /lib/usr/lib/X11 \
- \
- /usr/openwin/lib \
- /usr/openwin/share/lib \
- ; \
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+LIBS=$ac_save_LIBS
+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
+ # Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
- if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+ if test -r $ac_dir/libXt.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
fi
done
done
fi
-rm -f conftest*
-fi # $ac_x_libraries = NO
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
-if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
# Didn't find X anywhere. Cache the known absence of X.
ac_cv_have_x="have_x=no"
else
# Record where we found X for the cache.
ac_cv_have_x="have_x=yes \
- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi
fi
+
fi
eval "$ac_cv_have_x"
fi # $with_x != no
if test "$have_x" != yes; then
- echo "$ac_t""$have_x" 1>&6
+ echo "$as_me:$LINENO: result: $have_x" >&5
+echo "${ECHO_T}$have_x" >&6
no_x=yes
else
# If each of the values was on the command line, it overrides each guess.
@@ -5409,30 +10085,47 @@ else
# Update the cache value to reflect the command line values.
ac_cv_have_x="have_x=yes \
ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
- echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
+ echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
fi
not_really_there=""
if test "$no_x" = ""; then
if test "$x_includes" = ""; then
- cat > conftest.$ac_ext <<EOF
-#line 5420 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/XIntrinsic.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
not_really_there="yes"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
else
if test ! -r $x_includes/X11/Intrinsic.h; then
not_really_there="yes"
@@ -5440,33 +10133,49 @@ rm -f conftest*
fi
fi
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
- echo $ac_n "checking for X11 header files""... $ac_c" 1>&6
-echo "configure:5445: checking for X11 header files" >&5
+ echo "$as_me:$LINENO: checking for X11 header files" >&5
+echo $ECHO_N "checking for X11 header files... $ECHO_C" >&6
found_xincludes="no"
- cat > conftest.$ac_ext <<EOF
-#line 5448 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/Intrinsic.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5453: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
found_xincludes="yes"
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
found_xincludes="no"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
if test "$found_xincludes" = "no"; then
dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
for i in $dirs ; do
if test -r $i/X11/Intrinsic.h; then
- echo "$ac_t""$i" 1>&6
+ echo "$as_me:$LINENO: result: $i" >&5
+echo "${ECHO_T}$i" >&6
XINCLUDES=" -I$i"
found_xincludes="yes"
break
@@ -5480,17 +10189,19 @@ rm -f conftest*
fi
fi
if test "$found_xincludes" = "no"; then
- echo "$ac_t""couldn't find any!" 1>&6
+ echo "$as_me:$LINENO: result: couldn't find any!" >&5
+echo "${ECHO_T}couldn't find any!" >&6
fi
if test "$no_x" = yes; then
- echo $ac_n "checking for X11 libraries""... $ac_c" 1>&6
-echo "configure:5489: checking for X11 libraries" >&5
+ echo "$as_me:$LINENO: checking for X11 libraries" >&5
+echo $ECHO_N "checking for X11 libraries... $ECHO_C" >&6
XLIBSW=nope
dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
for i in $dirs ; do
if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
- echo "$ac_t""$i" 1>&6
+ echo "$as_me:$LINENO: result: $i" >&5
+echo "${ECHO_T}$i" >&6
XLIBSW="-L$i -lX11"
x_libraries="$i"
break
@@ -5504,49 +10215,78 @@ echo "configure:5489: checking for X11 libraries" >&5
fi
fi
if test "$XLIBSW" = nope ; then
- echo $ac_n "checking for XCreateWindow in -lXwindow""... $ac_c" 1>&6
-echo "configure:5509: checking for XCreateWindow in -lXwindow" >&5
-ac_lib_var=`echo Xwindow'_'XCreateWindow | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for XCreateWindow in -lXwindow" >&5
+echo $ECHO_N "checking for XCreateWindow in -lXwindow... $ECHO_C" >&6
+if test "${ac_cv_lib_Xwindow_XCreateWindow+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lXwindow $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5517 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char XCreateWindow();
-
-int main() {
-XCreateWindow()
-; return 0; }
-EOF
-if { (eval echo configure:5528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char XCreateWindow ();
+int
+main ()
+{
+XCreateWindow ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_Xwindow_XCreateWindow=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xwindow_XCreateWindow=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xwindow_XCreateWindow" >&5
+echo "${ECHO_T}$ac_cv_lib_Xwindow_XCreateWindow" >&6
+if test $ac_cv_lib_Xwindow_XCreateWindow = yes; then
XLIBSW=-lXwindow
-else
- echo "$ac_t""no" 1>&6
fi
fi
if test "$XLIBSW" = nope ; then
- echo "$ac_t""could not find any! Using -lX11." 1>&6
+ echo "$as_me:$LINENO: result: could not find any! Using -lX11." >&5
+echo "${ECHO_T}could not find any! Using -lX11." >&6
XLIBSW=-lX11
fi
@@ -5574,13 +10314,6 @@ if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
fi
-# The statement below is very tricky! It actually *evaluates* the
-# string in TCL_CC_SEARCH_FLAGS and TCL_LD_SEARCH_FLAGS which
-# causes a substitution of the variable LIB_RUNTIME_DIR.
-
-eval "CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\""
-eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
-
#--------------------------------------------------------------------
# Check for the existence of various libraries. The order here
# is important, so that then end up in the right order in the
@@ -5600,317 +10333,697 @@ eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
#--------------------------------------------------------------------
if test $tk_aqua = no; then
- echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:5605: checking for main in -lXbsd" >&5
-ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for main in -lXbsd" >&5
+echo $ECHO_N "checking for main in -lXbsd... $ECHO_C" >&6
+if test "${ac_cv_lib_Xbsd_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lXbsd $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5613 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:5620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_Xbsd_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xbsd_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xbsd_main" >&5
+echo "${ECHO_T}$ac_cv_lib_Xbsd_main" >&6
+if test $ac_cv_lib_Xbsd_main = yes; then
LIBS="$LIBS -lXbsd"
-else
- echo "$ac_t""no" 1>&6
fi
fi
-tk_checkBoth=0
-echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5644: checking for connect" >&5
-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5649 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect();
+#--------------------------------------------------------------------
+# One more check related to the X libraries. The standard releases
+# of Ultrix don't support the "xauth" mechanism, so send won't work
+# unless TK_NO_SECURITY is defined. However, there are usually copies
+# of the MIT X server available as well, which do support xauth.
+# Check for the MIT stuff and use it if it exists.
+#
+# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
+# because it can't deal with the "-" in the library name.
+#--------------------------------------------------------------------
-int main() {
+if test -d /usr/include/mit -a $tk_aqua = no; then
+ echo "$as_me:$LINENO: checking MIT X libraries" >&5
+echo $ECHO_N "checking MIT X libraries... $ECHO_C" >&6
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS -I/usr/include/mit"
+ tk_oldLibs=$LIBS
+ LIBS="$LIBS -lX11-mit"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-connect();
-#endif
+ #include <X11/Xlib.h>
-; return 0; }
-EOF
-if { (eval echo configure:5672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_connect=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_connect=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
-if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- tk_checkSocket=0
-else
- echo "$ac_t""no" 1>&6
-tk_checkSocket=1
-fi
+ XOpenDisplay(0);
-if test "$tk_checkSocket" = 1; then
- echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:5694: checking for main in -lsocket" >&5
-ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lsocket $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5702 "configure"
-#include "confdefs.h"
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ XLIBSW="-lX11-mit"
+ XINCLUDES="-I/usr/include/mit"
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:5709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lsocket"
-else
- echo "$ac_t""no" 1>&6
-tk_checkBoth=1
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
fi
-fi
-if test "$tk_checkBoth" = 1; then
+#--------------------------------------------------------------------
+# Check whether the header and library for the XScreenSaver
+# extension are available, and set HAVE_XSS if so.
+# XScreenSaver is needed for Tk_GetUserInactiveTime().
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES"
tk_oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:5735: checking for accept" >&5
-if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5740 "configure"
-#include "confdefs.h"
+ LIBS="$tk_oldLibs $XLIBSW"
+ xss_header_found=no
+ xss_lib_found=no
+ echo "$as_me:$LINENO: checking whether to try to use XScreenSaver" >&5
+echo $ECHO_N "checking whether to try to use XScreenSaver... $ECHO_C" >&6
+ # Check whether --enable-xss or --disable-xss was given.
+if test "${enable_xss+set}" = set; then
+ enableval="$enable_xss"
+ enable_xss=$enableval
+else
+ enable_xss=yes
+fi;
+ if test "$enable_xss" = "no" ; then
+ echo "$as_me:$LINENO: result: $enable_xss" >&5
+echo "${ECHO_T}$enable_xss" >&6
+ else
+ echo "$as_me:$LINENO: result: $enable_xss" >&5
+echo "${ECHO_T}$enable_xss" >&6
+ echo "$as_me:$LINENO: checking for X11/extensions/scrnsaver.h" >&5
+echo $ECHO_N "checking for X11/extensions/scrnsaver.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_scrnsaver_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+
+#include <X11/extensions/scrnsaver.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_X11_extensions_scrnsaver_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_X11_extensions_scrnsaver_h=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_scrnsaver_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_scrnsaver_h" >&6
+if test $ac_cv_header_X11_extensions_scrnsaver_h = yes; then
+
+ xss_header_found=yes
+
+fi
+
+
+ echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo" >&5
+echo $ECHO_N "checking for XScreenSaverQueryInfo... $ECHO_C" >&6
+if test "${ac_cv_func_XScreenSaverQueryInfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define XScreenSaverQueryInfo to an innocuous variant, in case <limits.h> declares XScreenSaverQueryInfo.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define XScreenSaverQueryInfo innocuous_XScreenSaverQueryInfo
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char accept(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char accept();
+ which can conflict with char XScreenSaverQueryInfo (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-int main() {
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+#undef XScreenSaverQueryInfo
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XScreenSaverQueryInfo ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_accept) || defined (__stub___accept)
+#if defined (__stub_XScreenSaverQueryInfo) || defined (__stub___XScreenSaverQueryInfo)
choke me
#else
-accept();
+char (*f) () = XScreenSaverQueryInfo;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:5763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_accept=yes"
+int
+main ()
+{
+return f != XScreenSaverQueryInfo;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_XScreenSaverQueryInfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_XScreenSaverQueryInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_XScreenSaverQueryInfo" >&5
+echo "${ECHO_T}$ac_cv_func_XScreenSaverQueryInfo" >&6
+if test $ac_cv_func_XScreenSaverQueryInfo = yes; then
+ :
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_accept=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'accept`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- tk_checkNsl=0
+ echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXext" >&5
+echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXext... $ECHO_C" >&6
+if test "${ac_cv_lib_Xext_XScreenSaverQueryInfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
-LIBS=$tk_oldLibs
-fi
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXext $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-fi
-echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:5785: checking for gethostbyname" >&5
-if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5790 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname(); below. */
-#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname();
-
-int main() {
+ builtin and then its argument prototype would still apply. */
+char XScreenSaverQueryInfo ();
+int
+main ()
+{
+XScreenSaverQueryInfo ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_Xext_XScreenSaverQueryInfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xext_XScreenSaverQueryInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XScreenSaverQueryInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_Xext_XScreenSaverQueryInfo" >&6
+if test $ac_cv_lib_Xext_XScreenSaverQueryInfo = yes; then
+
+ XLIBSW="$XLIBSW -lXext"
+ xss_lib_found=yes
+
+else
+
+ echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXss" >&5
+echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXss... $ECHO_C" >&6
+if test "${ac_cv_lib_Xss_XScreenSaverQueryInfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXss -lXext $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-gethostbyname();
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XScreenSaverQueryInfo ();
+int
+main ()
+{
+XScreenSaverQueryInfo ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_Xss_XScreenSaverQueryInfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xss_XScreenSaverQueryInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xss_XScreenSaverQueryInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_Xss_XScreenSaverQueryInfo" >&6
+if test $ac_cv_lib_Xss_XScreenSaverQueryInfo = yes; then
+
+ if test "$tcl_cv_ld_weak_l" = yes; then
+ # On Darwin, weak link libXss if possible,
+ # as it is only available on Tiger or later.
+ XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext"
+ else
+ XLIBSW="$XLIBSW -lXss -lXext"
+ fi
+ xss_lib_found=yes
-; return 0; }
-EOF
-if { (eval echo configure:5813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=no"
-fi
-rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:5831: checking for main in -lnsl" >&5
-ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lnsl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5839 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:5846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lnsl"
-else
- echo "$ac_t""no" 1>&6
-fi
+
fi
+ fi
+ if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XSS 1
+_ACEOF
+
+ fi
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+fi
#--------------------------------------------------------------------
-# One more check related to the X libraries. The standard releases
-# of Ultrix don't support the "xauth" mechanism, so send won't work
-# unless TK_NO_SECURITY is defined. However, there are usually copies
-# of the MIT X server available as well, which do support xauth.
-# Check for the MIT stuff and use it if it exists.
-#
-# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
-# because it can't deal with the "-" in the library name.
+# Check for freetype / fontconfig / Xft support.
#--------------------------------------------------------------------
-if test -d /usr/include/mit -a $tk_aqua = no; then
- echo $ac_n "checking MIT X libraries""... $ac_c" 1>&6
-echo "configure:5882: checking MIT X libraries" >&5
- tk_oldCFlags=$CFLAGS
- CFLAGS="$CFLAGS -I/usr/include/mit"
- tk_oldLibs=$LIBS
- LIBS="$LIBS -lX11-mit"
- cat > conftest.$ac_ext <<EOF
-#line 5888 "configure"
-#include "confdefs.h"
-
- #include <X11/Xlib.h>
-
-int main() {
+if test $tk_aqua = no; then
+ echo "$as_me:$LINENO: checking whether to use xft" >&5
+echo $ECHO_N "checking whether to use xft... $ECHO_C" >&6
+ # Check whether --enable-xft or --disable-xft was given.
+if test "${enable_xft+set}" = set; then
+ enableval="$enable_xft"
+ enable_xft=$enableval
+else
+ enable_xft="default"
+fi;
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ if test "$enable_xft" = "no" ; then
+ echo "$as_me:$LINENO: result: $enable_xft" >&5
+echo "${ECHO_T}$enable_xft" >&6
+ else
+ found_xft="yes"
+ XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
+ if test "$found_xft" = "no" ; then
+ found_xft=yes
+ XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no"
+ fi
+ echo "$as_me:$LINENO: result: $found_xft" >&5
+echo "${ECHO_T}$found_xft" >&6
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+ echo "$as_me:$LINENO: checking for X11/Xft/Xft.h" >&5
+echo $ECHO_N "checking for X11/Xft/Xft.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_Xft_Xft_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <X11/Xlib.h>
- XOpenDisplay(0);
-
-; return 0; }
-EOF
-if { (eval echo configure:5899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
-
- echo "$ac_t""yes" 1>&6
- XLIBSW="-lX11-mit"
- XINCLUDES="-I/usr/include/mit"
-
+#include <X11/Xft/Xft.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_X11_Xft_Xft_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_X11_Xft_Xft_h=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xft_Xft_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xft_Xft_h" >&6
+if test $ac_cv_header_X11_Xft_Xft_h = yes; then
+ :
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "$ac_t""no" 1>&6
+
+ found_xft=no
+
fi
-rm -f conftest*
- CFLAGS=$tk_oldCFlags
- LIBS=$tk_oldLibs
+
+
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+
+echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5
+echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6
+if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXft $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XftFontOpen ();
+int
+main ()
+{
+XftFontOpen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_Xft_XftFontOpen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xft_XftFontOpen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5
+echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6
+if test $ac_cv_lib_Xft_XftFontOpen = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXFT 1
+_ACEOF
+
+ LIBS="-lXft $LIBS"
+
+else
+
+ found_xft=no
+
+fi
+
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ if test "$found_xft" = "no" ; then
+ if test "$enable_xft" = "yes" ; then
+ { echo "$as_me:$LINENO: WARNING: Can't find xft configuration, or xft is unusable" >&5
+echo "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;}
+ fi
+ enable_xft=no
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ else
+ enable_xft=yes
+ fi
+ fi
+ if test $enable_xft = "yes" ; then
+ UNIX_FONT_OBJS=tkUnixRFont.o
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XFT 1
+_ACEOF
+
+ else
+ UNIX_FONT_OBJS=tkUnixFont.o
+ fi
+
+
+
fi
#--------------------------------------------------------------------
@@ -5918,66 +11031,66 @@ fi
# #define for __CHAR_UNSIGNED__.
#--------------------------------------------------------------------
-echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:5923: checking whether char is unsigned" >&5
-if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$GCC" = yes; then
- # GCC predefines this symbol on systems where it applies.
-cat > conftest.$ac_ext <<EOF
-#line 5930 "configure"
-#include "confdefs.h"
-#ifdef __CHAR_UNSIGNED__
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_c_char_unsigned=yes
-else
- rm -rf conftest*
- ac_cv_c_char_unsigned=no
-fi
-rm -f conftest*
-else
-if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 5952 "configure"
-#include "confdefs.h"
-/* volatile prevents gcc2 from optimizing the test away on sparcs. */
-#if !defined(__STDC__) || __STDC__ != 1
-#define volatile
-#endif
-main() {
- volatile char c = 255; exit(c < 0);
+echo "$as_me:$LINENO: checking whether char is unsigned" >&5
+echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6
+if test "${ac_cv_c_char_unsigned+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((char) -1) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
}
-EOF
-if { (eval echo configure:5962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_char_unsigned=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_char_unsigned=no
-fi
-rm -fr conftest*
-fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_c_char_unsigned=yes
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5
+echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6
if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define __CHAR_UNSIGNED__ 1
-EOF
+_ACEOF
fi
@@ -5992,10 +11105,8 @@ eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
-# so that the backslashes quoting the DBX braces are dropped.
+# since on some platforms TK_LIB_FILE contains shell escapes.
-# Trick to replace DBGX with TK_DBGX
-DBGX='${TK_DBGX}'
eval "TK_LIB_FILE=${TK_LIB_FILE}"
if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
@@ -6006,7 +11117,7 @@ fi
TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
PRIVATE_INCLUDE_DIR='$(includedir)'
HTML_DIR='$(DISTDIR)/html'
-TK_PKG_DIR='tk$(VERSION)$(TK_DBGX)'
+TK_PKG_DIR='tk$(VERSION)'
TK_RSRC_FILE='tk$(VERSION).rsrc'
WISH_RSRC_FILE='wish$(VERSION).rsrc'
@@ -6016,60 +11127,67 @@ WISH_RSRC_FILE='wish$(VERSION).rsrc'
# up the Tcl library.
if test "`uname -s`" = "Darwin" ; then
-
+
if test "`uname -s`" = "Darwin" ; then
- echo $ac_n "checking how to package libraries""... $ac_c" 1>&6
-echo "configure:6023: checking how to package libraries" >&5
+ echo "$as_me:$LINENO: checking how to package libraries" >&5
+echo $ECHO_N "checking how to package libraries... $ECHO_C" >&6
# Check whether --enable-framework or --disable-framework was given.
if test "${enable_framework+set}" = set; then
enableval="$enable_framework"
enable_framework=$enableval
else
enable_framework=no
-fi
-
+fi;
if test $enable_framework = yes; then
if test $SHARED_BUILD = 0; then
- echo "configure: warning: Frameworks can only be built if --enable-shared is yes" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Frameworks can only be built if --enable-shared is yes" >&5
+echo "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;}
enable_framework=no
fi
if test $tcl_corefoundation = no; then
- echo "configure: warning: Frameworks can only be used when CoreFoundation is available" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Frameworks can only be used when CoreFoundation is available" >&5
+echo "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;}
enable_framework=no
fi
fi
if test $enable_framework = yes; then
- echo "$ac_t""framework" 1>&6
+ echo "$as_me:$LINENO: result: framework" >&5
+echo "${ECHO_T}framework" >&6
FRAMEWORK_BUILD=1
else
if test $SHARED_BUILD = 1; then
- echo "$ac_t""shared library" 1>&6
+ echo "$as_me:$LINENO: result: shared library" >&5
+echo "${ECHO_T}shared library" >&6
else
- echo "$ac_t""static library" 1>&6
+ echo "$as_me:$LINENO: result: static library" >&5
+echo "${ECHO_T}static library" >&6
fi
FRAMEWORK_BUILD=0
fi
fi
TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk '{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}'`"
- TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | grep ^_[^_] > $$f && echo $$f)'
+ TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[^_] > $$f && echo $$f)'
echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'
- EXTRA_APP_CC_SWITCHES='-mdynamic-no-pic'
- tk_config_files="${tk_config_files} Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in"
+ EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
+ ac_config_files="$ac_config_files Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in"
+
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
fi
if test "$FRAMEWORK_BUILD" = "1" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TK_FRAMEWORK 1
-EOF
+_ACEOF
# Construct a fake local framework structure to make linking with
# '-framework Tk' and running of tktest work
-
+ ac_config_commands="$ac_config_commands Tk.framework"
+
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
# override libdir default
@@ -6077,7 +11195,7 @@ EOF
fi
TK_LIB_FILE="Tk"
TK_LIB_FLAG="-framework Tk"
- TK_BUILD_LIB_SPEC="-F`pwd` -framework Tk"
+ TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk"
TK_LIB_SPEC="-F${libdir} -framework Tk"
libdir="${libdir}/Tk.framework/Versions/\${VERSION}"
TK_LIBRARY="${libdir}/Resources/Scripts"
@@ -6088,7 +11206,7 @@ EOF
PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk"
EXTRA_INSTALL="install-private-headers html-tk"
- EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TkTOC.html'
+ EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
if test $tk_aqua = yes; then
@@ -6096,38 +11214,25 @@ EOF
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
bindir="${libdir}/Resources/Wish.app/Contents/MacOS"
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "'\$\(MAC\_OSX_DIR\)'/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
- # Don't use AC_DEFINE for the following as the framework version define
- # needs to go into the Makefile even when using autoheader, so that we
+ # Don't use AC_DEFINE for the following as the framework version define
+ # needs to go into the Makefile even when using autoheader, so that we
# can pick up a potential make override of VERSION. Also, don't put this
# into CFLAGS as it should not go into tkConfig.sh
- EXTRA_CC_SWITCHES='-DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
+ EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
- if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
- if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
- else
- eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
- fi
- TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
- TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
+ if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
+ TK_LIB_FLAG="-ltk${TK_VERSION}"
else
- TK_BUILD_EXP_FILE="lib.exp"
- eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
-
- if test "$GCC" = "yes" ; then
- TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TK_BUILD_EXP_FILE} -L`pwd`"
- TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L`pwd`"
- else
- TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}"
- TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}"
- fi
+ TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
fi
+ TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}"
+ TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
fi
# Support for building the Aqua resource files
@@ -6137,9 +11242,9 @@ if test $tk_aqua = yes; then
REZ=/Developer/Tools/Rez
REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF -ro'
if test "$SHARED_BUILD" = 0; then
- EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) $(LIB_INSTALL_DIR)'
- TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd`/\${TK_RSRC_FILE}"
- TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
+ EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
+ TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
+ TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
else
TK_SHLIB_LD_EXTRAS="$TK_SHLIB_LD_EXTRAS -sectcreate __TEXT __tk_rsrc \${TK_RSRC_FILE}"
fi
@@ -6155,12 +11260,12 @@ eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}"
eval "TK_STUB_LIB_DIR=${libdir}"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}"
else
- eval TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`"
fi
-TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}"
+TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}"
TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}"
TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}"
@@ -6224,359 +11329,1142 @@ TK_SHARED_BUILD=${SHARED_BUILD}
+ ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in"
-
-
-
-CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""
-
-
-tk_config_files="${tk_config_files} Makefile tkConfig.sh"
-trap '' 1 2 15
-cat > confcache <<\EOF
+cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
#
-EOF
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
fi
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+LTLIBOBJS=$ac_ltlibobjs
+
+
+CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
+# configure, is in config.log if it exists.
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
done
-ac_given_srcdir=$srcdir
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
-trap 'rm -fr `echo "${tk_config_files}" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@TCL_VERSION@%$TCL_VERSION%g
-s%@TCL_PATCH_LEVEL@%$TCL_PATCH_LEVEL%g
-s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g
-s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g
-s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g
-s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
-s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
-s%@TCL_STUB_LIB_FILE@%$TCL_STUB_LIB_FILE%g
-s%@TCL_STUB_LIB_FLAG@%$TCL_STUB_LIB_FLAG%g
-s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
-s%@TCLSH_PROG@%$TCLSH_PROG%g
-s%@BUILD_TCLSH@%$BUILD_TCLSH%g
-s%@MAN_FLAGS@%$MAN_FLAGS%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@TCL_THREADS@%$TCL_THREADS%g
-s%@RANLIB@%$RANLIB%g
-s%@AR@%$AR%g
-s%@DL_LIBS@%$DL_LIBS%g
-s%@DL_OBJS@%$DL_OBJS%g
-s%@PLAT_OBJS@%$PLAT_OBJS%g
-s%@PLAT_SRCS@%$PLAT_SRCS%g
-s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
-s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
-s%@CFLAGS_WARNING@%$CFLAGS_WARNING%g
-s%@LDFLAGS_DEBUG@%$LDFLAGS_DEBUG%g
-s%@LDFLAGS_OPTIMIZE@%$LDFLAGS_OPTIMIZE%g
-s%@CC_SEARCH_FLAGS@%$CC_SEARCH_FLAGS%g
-s%@LD_SEARCH_FLAGS@%$LD_SEARCH_FLAGS%g
-s%@STLIB_LD@%$STLIB_LD%g
-s%@SHLIB_LD@%$SHLIB_LD%g
-s%@TCL_SHLIB_LD_EXTRAS@%$TCL_SHLIB_LD_EXTRAS%g
-s%@TK_SHLIB_LD_EXTRAS@%$TK_SHLIB_LD_EXTRAS%g
-s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g
-s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
-s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
-s%@MAKE_LIB@%$MAKE_LIB%g
-s%@MAKE_STUB_LIB@%$MAKE_STUB_LIB%g
-s%@INSTALL_LIB@%$INSTALL_LIB%g
-s%@INSTALL_STUB_LIB@%$INSTALL_STUB_LIB%g
-s%@CFLAGS_DEFAULT@%$CFLAGS_DEFAULT%g
-s%@LDFLAGS_DEFAULT@%$LDFLAGS_DEFAULT%g
-s%@TK_VERSION@%$TK_VERSION%g
-s%@TK_MAJOR_VERSION@%$TK_MAJOR_VERSION%g
-s%@TK_MINOR_VERSION@%$TK_MINOR_VERSION%g
-s%@TK_PATCH_LEVEL@%$TK_PATCH_LEVEL%g
-s%@TK_YEAR@%$TK_YEAR%g
-s%@TK_LIB_FILE@%$TK_LIB_FILE%g
-s%@TK_LIB_FLAG@%$TK_LIB_FLAG%g
-s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g
-s%@TK_STUB_LIB_FILE@%$TK_STUB_LIB_FILE%g
-s%@TK_STUB_LIB_FLAG@%$TK_STUB_LIB_FLAG%g
-s%@TK_STUB_LIB_SPEC@%$TK_STUB_LIB_SPEC%g
-s%@TK_STUB_LIB_PATH@%$TK_STUB_LIB_PATH%g
-s%@TK_INCLUDE_SPEC@%$TK_INCLUDE_SPEC%g
-s%@TK_BUILD_STUB_LIB_SPEC@%$TK_BUILD_STUB_LIB_SPEC%g
-s%@TK_BUILD_STUB_LIB_PATH@%$TK_BUILD_STUB_LIB_PATH%g
-s%@TK_SRC_DIR@%$TK_SRC_DIR%g
-s%@TK_DBGX@%$TK_DBGX%g
-s%@TK_SHARED_BUILD@%$TK_SHARED_BUILD%g
-s%@LD_LIBRARY_PATH_VAR@%$LD_LIBRARY_PATH_VAR%g
-s%@TK_BUILD_LIB_SPEC@%$TK_BUILD_LIB_SPEC%g
-s%@TK_BUILD_EXP_FILE@%$TK_BUILD_EXP_FILE%g
-s%@TK_EXP_FILE@%$TK_EXP_FILE%g
-s%@TCL_STUB_FLAGS@%$TCL_STUB_FLAGS%g
-s%@MATH_LIBS@%$MATH_LIBS%g
-s%@XINCLUDES@%$XINCLUDES%g
-s%@XLIBSW@%$XLIBSW%g
-s%@LOCALES@%$LOCALES%g
-s%@TK_WINDOWINGSYSTEM@%$TK_WINDOWINGSYSTEM%g
-s%@TK_PKG_DIR@%$TK_PKG_DIR%g
-s%@TK_LIBRARY@%$TK_LIBRARY%g
-s%@PRIVATE_INCLUDE_DIR@%$PRIVATE_INCLUDE_DIR%g
-s%@HTML_DIR@%$HTML_DIR%g
-s%@EXTRA_CC_SWITCHES@%$EXTRA_CC_SWITCHES%g
-s%@EXTRA_APP_CC_SWITCHES@%$EXTRA_APP_CC_SWITCHES%g
-s%@EXTRA_INSTALL@%$EXTRA_INSTALL%g
-s%@EXTRA_INSTALL_BINARIES@%$EXTRA_INSTALL_BINARIES%g
-s%@EXTRA_BUILD_HTML@%$EXTRA_BUILD_HTML%g
-s%@EXTRA_WISH_LIBS@%$EXTRA_WISH_LIBS%g
-s%@CFBUNDLELOCALIZATIONS@%$CFBUNDLELOCALIZATIONS%g
-s%@TK_RSRC_FILE@%$TK_RSRC_FILE%g
-s%@WISH_RSRC_FILE@%$WISH_RSRC_FILE%g
-s%@LIB_RSRC_FILE@%$LIB_RSRC_FILE%g
-s%@APP_RSRC_FILE@%$APP_RSRC_FILE%g
-s%@REZ@%$REZ%g
-s%@REZ_FLAGS@%$REZ_FLAGS%g
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ PATH_SEPARATOR=:
fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ as_ln_s='ln -s'
fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by tk $as_me 8.5, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+tk config.status 8.5
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
-EOF
-cat >> $CONFIG_STATUS <<EOF
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Tk-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tk-Info.plist:../macosx/Tk-Info.plist.in" ;;
+ "Wish-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Wish-Info.plist:../macosx/Wish-Info.plist.in" ;;
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;;
+ "tkConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tkConfig.sh:../unix/tkConfig.sh.in" ;;
+ "Tk.framework" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Tk.framework" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@TCL_VERSION@,$TCL_VERSION,;t t
+s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t
+s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t
+s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t
+s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t
+s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t
+s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t
+s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t
+s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t
+s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t
+s,@TCLSH_PROG@,$TCLSH_PROG,;t t
+s,@BUILD_TCLSH@,$BUILD_TCLSH,;t t
+s,@MAN_FLAGS@,$MAN_FLAGS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@TCL_THREADS@,$TCL_THREADS,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@TCL_LIBS@,$TCL_LIBS,;t t
+s,@DL_LIBS@,$DL_LIBS,;t t
+s,@DL_OBJS@,$DL_OBJS,;t t
+s,@PLAT_OBJS@,$PLAT_OBJS,;t t
+s,@PLAT_SRCS@,$PLAT_SRCS,;t t
+s,@LDAIX_SRC@,$LDAIX_SRC,;t t
+s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t
+s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t
+s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t
+s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t
+s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t
+s,@CC_SEARCH_FLAGS@,$CC_SEARCH_FLAGS,;t t
+s,@LD_SEARCH_FLAGS@,$LD_SEARCH_FLAGS,;t t
+s,@STLIB_LD@,$STLIB_LD,;t t
+s,@SHLIB_LD@,$SHLIB_LD,;t t
+s,@TCL_SHLIB_LD_EXTRAS@,$TCL_SHLIB_LD_EXTRAS,;t t
+s,@TK_SHLIB_LD_EXTRAS@,$TK_SHLIB_LD_EXTRAS,;t t
+s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t
+s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t
+s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t
+s,@MAKE_LIB@,$MAKE_LIB,;t t
+s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t
+s,@INSTALL_LIB@,$INSTALL_LIB,;t t
+s,@INSTALL_STUB_LIB@,$INSTALL_STUB_LIB,;t t
+s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t
+s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@XFT_CFLAGS@,$XFT_CFLAGS,;t t
+s,@XFT_LIBS@,$XFT_LIBS,;t t
+s,@UNIX_FONT_OBJS@,$UNIX_FONT_OBJS,;t t
+s,@TK_VERSION@,$TK_VERSION,;t t
+s,@TK_MAJOR_VERSION@,$TK_MAJOR_VERSION,;t t
+s,@TK_MINOR_VERSION@,$TK_MINOR_VERSION,;t t
+s,@TK_PATCH_LEVEL@,$TK_PATCH_LEVEL,;t t
+s,@TK_YEAR@,$TK_YEAR,;t t
+s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t
+s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t
+s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t
+s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t
+s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t
+s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t
+s,@TK_STUB_LIB_PATH@,$TK_STUB_LIB_PATH,;t t
+s,@TK_INCLUDE_SPEC@,$TK_INCLUDE_SPEC,;t t
+s,@TK_BUILD_STUB_LIB_SPEC@,$TK_BUILD_STUB_LIB_SPEC,;t t
+s,@TK_BUILD_STUB_LIB_PATH@,$TK_BUILD_STUB_LIB_PATH,;t t
+s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t
+s,@TK_SHARED_BUILD@,$TK_SHARED_BUILD,;t t
+s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t
+s,@TK_BUILD_LIB_SPEC@,$TK_BUILD_LIB_SPEC,;t t
+s,@TCL_STUB_FLAGS@,$TCL_STUB_FLAGS,;t t
+s,@XINCLUDES@,$XINCLUDES,;t t
+s,@XLIBSW@,$XLIBSW,;t t
+s,@LOCALES@,$LOCALES,;t t
+s,@TK_WINDOWINGSYSTEM@,$TK_WINDOWINGSYSTEM,;t t
+s,@TK_PKG_DIR@,$TK_PKG_DIR,;t t
+s,@TK_LIBRARY@,$TK_LIBRARY,;t t
+s,@PRIVATE_INCLUDE_DIR@,$PRIVATE_INCLUDE_DIR,;t t
+s,@HTML_DIR@,$HTML_DIR,;t t
+s,@EXTRA_CC_SWITCHES@,$EXTRA_CC_SWITCHES,;t t
+s,@EXTRA_APP_CC_SWITCHES@,$EXTRA_APP_CC_SWITCHES,;t t
+s,@EXTRA_INSTALL@,$EXTRA_INSTALL,;t t
+s,@EXTRA_INSTALL_BINARIES@,$EXTRA_INSTALL_BINARIES,;t t
+s,@EXTRA_BUILD_HTML@,$EXTRA_BUILD_HTML,;t t
+s,@EXTRA_WISH_LIBS@,$EXTRA_WISH_LIBS,;t t
+s,@CFBUNDLELOCALIZATIONS@,$CFBUNDLELOCALIZATIONS,;t t
+s,@TK_RSRC_FILE@,$TK_RSRC_FILE,;t t
+s,@WISH_RSRC_FILE@,$WISH_RSRC_FILE,;t t
+s,@LIB_RSRC_FILE@,$LIB_RSRC_FILE,;t t
+s,@APP_RSRC_FILE@,$APP_RSRC_FILE,;t t
+s,@REZ@,$REZ,;t t
+s,@REZ_FLAGS@,$REZ_FLAGS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
-CONFIG_FILES=\${CONFIG_FILES-"${tk_config_files}"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
else
- ac_dir_suffix= ac_dots=
+ cat $tmp/out
+ rm -f $tmp/out
fi
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ Tk.framework ) n=Tk &&
+ f=$n.framework && v=Versions/$VERSION &&
+ rm -rf $f && mkdir -p $f/$v/Resources &&
+ ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
+ ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
+ if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
+ unset n f v
+ ;;
esac
+done
+_ACEOF
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-VERSION=${TK_VERSION} FRAMEWORK_BUILD=${FRAMEWORK_BUILD}
- tk_aqua=${tk_aqua}
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test "$FRAMEWORK_BUILD" = "1" && n=Tk &&
- f=$n.framework && v=Versions/$VERSION &&
- echo "creating $f" && rm -rf $f && mkdir -p $f/$v/Resources &&
- ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
- ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
- if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
- unset n f v
-
-
-exit 0
-EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
diff --git a/unix/configure.in b/unix/configure.in
index b5f2770..996195e 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -3,15 +3,31 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tk installation
dnl to configure the system for the local environment.
-AC_INIT(../generic/tk.h)
-AC_PREREQ(2.13)
-
-TK_VERSION=8.4
+AC_INIT([tk],[8.5])
+AC_PREREQ(2.59)
+
+dnl This is only used when included from macosx/configure.ac
+m4_ifdef([SC_USE_CONFIG_HEADERS], [
+ AC_CONFIG_HEADERS([tkConfig.h:../unix/tkConfig.h.in])
+ AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TK_CONFIG_H -imacros tkConfig.h"])
+ AH_TOP([
+ #ifndef _TKCONFIG
+ #define _TKCONFIG])
+ AH_BOTTOM([
+ /* Undef unused package specific autoheader defines so that we can
+ * include both tclConfig.h and tkConfig.h at the same time: */
+ /* override */ #undef PACKAGE_NAME
+ /* override */ #undef PACKAGE_STRING
+ /* override */ #undef PACKAGE_TARNAME
+ #endif /* _TKCONFIG */])
+])
+
+TK_VERSION=8.5
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=4
-TK_PATCH_LEVEL=".19"
+TK_MINOR_VERSION=5
+TK_PATCH_LEVEL=".11"
VERSION=${TK_VERSION}
-LOCALES="cs de el en en_gb eo es fr hu it nl pl pt ru"
+LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
#--------------------------------------------------------------------
# Find and load the tclConfig.sh file
@@ -40,14 +56,14 @@ if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
# Make sure srcdir is fully qualified!
-srcdir=`cd $srcdir ; pwd`
-TK_SRC_DIR=`cd $srcdir/..; pwd`
+srcdir="`cd "$srcdir" ; pwd`"
+TK_SRC_DIR="`cd "$srcdir"/..; pwd`"
#------------------------------------------------------------------------
# Compress and/or soft link the manpages?
#------------------------------------------------------------------------
-SC_CONFIG_MANPAGES([tk])
+SC_CONFIG_MANPAGES
#------------------------------------------------------------------------
# Standard compiler checks
@@ -64,22 +80,21 @@ AC_PROG_CC
# limits header checks must come early to prevent
# an autoconf bug that throws errors on configure
AC_CHECK_HEADER(limits.h,
- [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
-AC_HAVE_HEADERS(unistd.h)
+ [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
+ [AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
#--------------------------------------------------------------------
# Supply a substitute for stdlib.h if it doesn't define strtol,
# strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------
-AC_MSG_CHECKING(stdlib.h)
-AC_EGREP_HEADER(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
-AC_EGREP_HEADER(strtoul, stdlib.h, , tk_ok=no)
-AC_EGREP_HEADER(strtod, stdlib.h, , tk_ok=no)
-if test $tk_ok = no; then
- AC_DEFINE(NO_STDLIB_H)
+AC_CHECK_HEADER(stdlib.h, tk_ok=1, tk_ok=0)
+AC_EGREP_HEADER(strtol, stdlib.h, , tk_ok=0)
+AC_EGREP_HEADER(strtoul, stdlib.h, , tk_ok=0)
+AC_EGREP_HEADER(strtod, stdlib.h, , tk_ok=0)
+if test $tk_ok = 0; then
+ AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
fi
-AC_MSG_RESULT([$tk_ok])
#------------------------------------------------------------------------
# If we're using GCC, see if the compiler understands -pipe. If so, use it.
@@ -103,17 +118,6 @@ fi
SC_ENABLE_THREADS
-#--------------------------------------------------------------------
-# On a few very rare systems, all of the libm.a stuff is
-# already in libc.a. Set compiler flags accordingly.
-# Also, Linux requires the "ieee" library for math to work
-# right (and it must appear before "-lm").
-#--------------------------------------------------------------------
-
-MATH_LIBS=""
-AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
-AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
-
# Add the threads support libraries
LIBS="$LIBS$THREADS_LIBS"
@@ -129,8 +133,6 @@ SC_CONFIG_CFLAGS
SC_ENABLE_SYMBOLS
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Detect what compiler flags to set for 64-bit support.
#--------------------------------------------------------------------
@@ -181,12 +183,12 @@ if test $tk_ok = no; then
AC_EGREP_HEADER(fd_mask, sys/select.h,
tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)])
if test $tcl_cv_grep_fd_mask = present; then
- AC_DEFINE(HAVE_SYS_SELECT_H)
+ AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include <sys/select.h>?])
tk_ok=yes
fi
fi
if test $tk_ok = no; then
- AC_DEFINE(NO_FD_SET)
+ AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?])
fi
#------------------------------------------------------------------------------
@@ -215,6 +217,38 @@ AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
+AC_CHECK_TYPE([intptr_t], [
+ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [
+ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [
+ for tcl_cv_intptr_t in "int" "long" "long long" none; do
+ if test "$tcl_cv_intptr_t" != none; then
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
+ [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
+ [tcl_ok=yes], [tcl_ok=no])
+ test "$tcl_ok" = yes && break; fi
+ done])
+ if test "$tcl_cv_intptr_t" != none; then
+ AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer
+ type wide enough to hold a pointer.])
+ fi
+])
+AC_CHECK_TYPE([uintptr_t], [
+ AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [
+ AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [
+ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
+ none; do
+ if test "$tcl_cv_uintptr_t" != none; then
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
+ [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
+ [tcl_ok=yes], [tcl_ok=no])
+ test "$tcl_ok" = yes && break; fi
+ done])
+ if test "$tcl_cv_uintptr_t" != none; then
+ AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer
+ type wide enough to hold a pointer.])
+ fi
+])
+
#-------------------------------------------
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
@@ -224,7 +258,7 @@ AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [
[struct passwd pwd; pwd.pw_gecos;],
tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)])
if test $tcl_cv_pwd_pw_gecos = yes; then
- AC_DEFINE(HAVE_PW_GECOS)
+ AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?])
fi
#--------------------------------------------------------------------
@@ -233,7 +267,9 @@ fi
if test "`uname -s`" = "Darwin" ; then
AC_MSG_CHECKING([whether to use Aqua])
- AC_ARG_ENABLE(aqua, [ --enable-aqua enable Aqua windowingsystem on Mac OS X [--disable-aqua]],
+ AC_ARG_ENABLE(aqua,
+ AC_HELP_STRING([--enable-aqua],
+ [use Aqua windowingsystem on Mac OS X (default: off)]),
[tk_aqua=$enableval], [tk_aqua=no])
if test $tk_aqua = yes; then
if test $tcl_corefoundation = no; then
@@ -267,23 +303,71 @@ if test "`uname -s`" = "Darwin" ; then
# remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit
# fat builds if configuration does not support 64-bit.
if test $tk_aqua = yes -o "$tcl_cv_lib_x11_64" = no; then
- AC_MSG_WARN([Removing 64-bit architectures from compiler & linker flags])
+ AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
done
fi
fi
+ if test $tk_aqua = no; then
+ # check if weak linking whole libraries is possible.
+ AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-weak-lm"
+ AC_TRY_LINK([#include <math.h>], [double f = sin(1.0);],
+ tcl_cv_ld_weak_l=yes, tcl_cv_ld_weak_l=no)
+ LDFLAGS=$hold_ldflags])
+ fi
+ AC_CHECK_HEADERS(AvailabilityMacros.h)
+ if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
+ AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ AC_TRY_LINK([
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #endif
+ int rand(void) __attribute__((weak_import));
+ ], [rand();],
+ tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_weak_import = yes; then
+ AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?])
+ fi
+ AC_CACHE_CHECK([if Darwin SUSv3 extensions are available],
+ tcl_cv_cc_darwin_c_source, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #endif
+ #define _DARWIN_C_SOURCE 1
+ #include <sys/cdefs.h>
+ ],,tcl_cv_cc_darwin_c_source=yes, tcl_cv_cc_darwin_c_source=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_darwin_c_source = yes; then
+ AC_DEFINE(_DARWIN_C_SOURCE, 1,
+ [Are Darwin SUSv3 extensions available?])
+ fi
+ fi
else
tk_aqua=no
fi
if test $tk_aqua = yes; then
- AC_DEFINE(MAC_OSX_TK)
- LIBS="$LIBS -framework Carbon"
+ AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?])
+ LIBS="$LIBS -framework Carbon -framework IOKit"
CFLAGS="$CFLAGS -fpascal-strings"
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
- AC_DEFINE(TK_MAC_DEBUG)
+ AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?])
fi
else
#--------------------------------------------------------------------
@@ -320,13 +404,6 @@ if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
fi
-# The statement below is very tricky! It actually *evaluates* the
-# string in TCL_CC_SEARCH_FLAGS and TCL_LD_SEARCH_FLAGS which
-# causes a substitution of the variable LIB_RUNTIME_DIR.
-
-eval "CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\""
-eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
-
#--------------------------------------------------------------------
# Check for the existence of various libraries. The order here
# is important, so that then end up in the right order in the
@@ -349,18 +426,6 @@ if test $tk_aqua = no; then
AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
fi
-tk_checkBoth=0
-AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
-if test "$tk_checkSocket" = 1; then
- AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
-fi
-if test "$tk_checkBoth" = 1; then
- tk_oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
-fi
-AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])])
-
#--------------------------------------------------------------------
# One more check related to the X libraries. The standard releases
# of Ultrix don't support the "xauth" mechanism, so send won't work
@@ -392,6 +457,129 @@ if test -d /usr/include/mit -a $tk_aqua = no; then
fi
#--------------------------------------------------------------------
+# Check whether the header and library for the XScreenSaver
+# extension are available, and set HAVE_XSS if so.
+# XScreenSaver is needed for Tk_GetUserInactiveTime().
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLibs $XLIBSW"
+ xss_header_found=no
+ xss_lib_found=no
+ AC_MSG_CHECKING([whether to try to use XScreenSaver])
+ AC_ARG_ENABLE(xss,
+ AC_HELP_STRING([--enable-xss],
+ [use XScreenSaver for activity timer (default: on)]),
+ [enable_xss=$enableval], [enable_xss=yes])
+ if test "$enable_xss" = "no" ; then
+ AC_MSG_RESULT([$enable_xss])
+ else
+ AC_MSG_RESULT([$enable_xss])
+ AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [
+ xss_header_found=yes
+ ],,[#include <X11/Xlib.h>])
+ AC_CHECK_FUNC(XScreenSaverQueryInfo,,[
+ AC_CHECK_LIB(Xext, XScreenSaverQueryInfo, [
+ XLIBSW="$XLIBSW -lXext"
+ xss_lib_found=yes
+ ], [
+ AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, [
+ if test "$tcl_cv_ld_weak_l" = yes; then
+ # On Darwin, weak link libXss if possible,
+ # as it is only available on Tiger or later.
+ XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext"
+ else
+ XLIBSW="$XLIBSW -lXss -lXext"
+ fi
+ xss_lib_found=yes
+ ],, -lXext)
+ ])
+ ])
+ fi
+ if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then
+ AC_DEFINE(HAVE_XSS, 1, [Is XScreenSaver available?])
+ fi
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+fi
+
+#--------------------------------------------------------------------
+# Check for freetype / fontconfig / Xft support.
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ AC_MSG_CHECKING([whether to use xft])
+ AC_ARG_ENABLE(xft,
+ AC_HELP_STRING([--enable-xft],
+ [use freetype/fontconfig/xft (default: on)]),
+ [enable_xft=$enableval], [enable_xft="default"])
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ if test "$enable_xft" = "no" ; then
+ AC_MSG_RESULT([$enable_xft])
+ else
+ found_xft="yes"
+ dnl make sure package configurator (xft-config or pkg-config
+ dnl says that xft is present.
+ XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
+ if test "$found_xft" = "no" ; then
+ found_xft=yes
+ XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no"
+ fi
+ AC_MSG_RESULT([$found_xft])
+ dnl make sure that compiling against Xft header file doesn't bomb
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+ AC_CHECK_HEADER(X11/Xft/Xft.h, [], [
+ found_xft=no
+ ],[#include <X11/Xlib.h>])
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ dnl make sure that linking against Xft libraries finds freetype
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+ AC_CHECK_LIB(Xft, XftFontOpen, [], [
+ found_xft=no
+ ])
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ dnl print a warning if xft is unusable and was specifically requested
+ if test "$found_xft" = "no" ; then
+ if test "$enable_xft" = "yes" ; then
+ AC_MSG_WARN([Can't find xft configuration, or xft is unusable])
+ fi
+ enable_xft=no
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ else
+ enable_xft=yes
+ fi
+ fi
+ if test $enable_xft = "yes" ; then
+ UNIX_FONT_OBJS=tkUnixRFont.o
+ AC_DEFINE(HAVE_XFT, 1, [Have we turned on XFT (antialiased fonts)?])
+ else
+ UNIX_FONT_OBJS=tkUnixFont.o
+ fi
+ AC_SUBST(XFT_CFLAGS)
+ AC_SUBST(XFT_LIBS)
+ AC_SUBST(UNIX_FONT_OBJS)
+fi
+
+#--------------------------------------------------------------------
# Figure out whether "char" is unsigned. If so, set a
# #define for __CHAR_UNSIGNED__.
#--------------------------------------------------------------------
@@ -408,10 +596,8 @@ eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
-# so that the backslashes quoting the DBX braces are dropped.
+# since on some platforms TK_LIB_FILE contains shell escapes.
-# Trick to replace DBGX with TK_DBGX
-DBGX='${TK_DBGX}'
eval "TK_LIB_FILE=${TK_LIB_FILE}"
if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
@@ -422,7 +608,7 @@ fi
TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
PRIVATE_INCLUDE_DIR='$(includedir)'
HTML_DIR='$(DISTDIR)/html'
-TK_PKG_DIR='tk$(VERSION)$(TK_DBGX)'
+TK_PKG_DIR='tk$(VERSION)'
TK_RSRC_FILE='tk$(VERSION).rsrc'
WISH_RSRC_FILE='wish$(VERSION).rsrc'
@@ -434,29 +620,28 @@ WISH_RSRC_FILE='wish$(VERSION).rsrc'
if test "`uname -s`" = "Darwin" ; then
SC_ENABLE_FRAMEWORK
TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`"
- TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] > $$f && echo $$f)'
+ TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] > $$f && echo $$f)'
echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'
- EXTRA_APP_CC_SWITCHES='-mdynamic-no-pic'
- tk_config_files="${tk_config_files} [Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in]"
+ EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
+ AC_CONFIG_FILES([Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in])
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
fi
if test "$FRAMEWORK_BUILD" = "1" ; then
- AC_DEFINE(TK_FRAMEWORK)
+ AC_DEFINE(TK_FRAMEWORK, 1, [Is Tk built as a framework?])
# Construct a fake local framework structure to make linking with
# '-framework Tk' and running of tktest work
- AC_OUTPUT_COMMANDS([test "$FRAMEWORK_BUILD" = "1" && n=Tk &&
- f=$n.framework && v=Versions/$VERSION &&
- echo "creating $f" && rm -rf $f && mkdir -p $f/$v/Resources &&
- ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
- ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
- if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
- unset n f v
- ], [VERSION=${TK_VERSION} FRAMEWORK_BUILD=${FRAMEWORK_BUILD}
- tk_aqua=${tk_aqua}])
+ AC_CONFIG_COMMANDS([Tk.framework], [n=Tk &&
+ f=$n.framework && v=Versions/$VERSION &&
+ rm -rf $f && mkdir -p $f/$v/Resources &&
+ ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
+ ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
+ if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
+ unset n f v
+ ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua})
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
# override libdir default
@@ -464,7 +649,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
fi
TK_LIB_FILE="Tk"
TK_LIB_FLAG="-framework Tk"
- TK_BUILD_LIB_SPEC="-F`pwd` -framework Tk"
+ TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk"
TK_LIB_SPEC="-F${libdir} -framework Tk"
libdir="${libdir}/Tk.framework/Versions/\${VERSION}"
TK_LIBRARY="${libdir}/Resources/Scripts"
@@ -475,7 +660,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk"
EXTRA_INSTALL="install-private-headers html-tk"
- EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TkTOC.html'
+ EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
if test $tk_aqua = yes; then
@@ -483,7 +668,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
bindir="${libdir}/Resources/Wish.app/Contents/MacOS"
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "'\$\(MAC\_OSX_DIR\)'/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
@@ -491,30 +676,17 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
# needs to go into the Makefile even when using autoheader, so that we
# can pick up a potential make override of VERSION. Also, don't put this
# into CFLAGS as it should not go into tkConfig.sh
- EXTRA_CC_SWITCHES='-DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
+ EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
- if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
- if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
- else
- eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
- fi
- TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
- TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
+ if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
+ TK_LIB_FLAG="-ltk${TK_VERSION}"
else
- TK_BUILD_EXP_FILE="lib.exp"
- eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
-
- if test "$GCC" = "yes" ; then
- TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TK_BUILD_EXP_FILE} -L`pwd`"
- TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L`pwd`"
- else
- TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}"
- TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}"
- fi
+ TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
fi
+ TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}"
+ TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
fi
# Support for building the Aqua resource files
@@ -524,9 +696,9 @@ if test $tk_aqua = yes; then
REZ=/Developer/Tools/Rez
REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF -ro'
if test "$SHARED_BUILD" = 0; then
- EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) $(LIB_INSTALL_DIR)'
- TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd`/\${TK_RSRC_FILE}"
- TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
+ EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
+ TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
+ TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
else
TK_SHLIB_LD_EXTRAS="$TK_SHLIB_LD_EXTRAS -sectcreate __TEXT __tk_rsrc \${TK_RSRC_FILE}"
fi
@@ -542,12 +714,12 @@ eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}"
eval "TK_STUB_LIB_DIR=${libdir}"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}"
else
- eval TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`"
fi
-TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}"
+TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}"
TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}"
TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}"
@@ -579,17 +751,13 @@ AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
AC_SUBST(TK_BUILD_STUB_LIB_PATH)
AC_SUBST(TK_SRC_DIR)
-AC_SUBST(TK_DBGX)
AC_SUBST(TK_SHARED_BUILD)
AC_SUBST(LD_LIBRARY_PATH_VAR)
AC_SUBST(TK_BUILD_LIB_SPEC)
-AC_SUBST(TK_BUILD_EXP_FILE)
-AC_SUBST(TK_EXP_FILE)
AC_SUBST(TCL_STUB_FLAGS)
-AC_SUBST(MATH_LIBS)
AC_SUBST(XINCLUDES)
AC_SUBST(XLIBSW)
AC_SUBST(LOCALES)
@@ -615,7 +783,8 @@ AC_SUBST(APP_RSRC_FILE)
AC_SUBST(REZ)
AC_SUBST(REZ_FLAGS)
-SC_OUTPUT_COMMANDS_PRE
-
-tk_config_files="${tk_config_files} [Makefile tkConfig.sh]"
-AC_OUTPUT([${tk_config_files}])
+AC_CONFIG_FILES([
+ Makefile:../unix/Makefile.in
+ tkConfig.sh:../unix/tkConfig.sh.in
+])
+AC_OUTPUT
diff --git a/unix/install-sh b/unix/install-sh
index a9a1f27..1572b93 100644..100755
--- a/unix/install-sh
+++ b/unix/install-sh
@@ -4,8 +4,6 @@
# install - install a program, script, or datafile
# This comes from X11R5; it is not part of GNU.
#
-# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
-#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
@@ -94,31 +92,31 @@ fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
-if [ -d $dst ]
+if [ -d "$dst" ]
then
- dst="$dst"/`basename $src`
+ dst="$dst/`basename "$src"`"
fi
# Make a temp file name in the proper directory.
-dstdir=`dirname $dst`
-dsttmp=$dstdir/#inst.$$#
+dstdir="`dirname "$dst"`"
+dsttmp="$dstdir"/#inst.$$#
# Move or copy the file name to the temp name
-$doit $instcmd $src $dsttmp
+$doit $instcmd "$src" "$dsttmp"
# and set any options; do chmod last to preserve setuid bits
-if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
-if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
-if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
-if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
+if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; fi
+if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; fi
+if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; fi
+if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; fi
# Now rename the file to the real destination.
-$doit $rmcmd $dst
-$doit $mvcmd $dsttmp $dst
+$doit $rmcmd "$dst"
+$doit $mvcmd "$dsttmp" "$dst"
exit 0
diff --git a/unix/installManPage b/unix/installManPage
index 93fd925..6bdccf0 100755
--- a/unix/installManPage
+++ b/unix/installManPage
@@ -1,12 +1,29 @@
#!/bin/sh
-ZIP=:
+########################################################################
+### Parse Options
+###
+
+Gzip=:
+SymOrLoc=""
+Gz=""
+Suffix=""
+
while true; do
case $1 in
- -s | --symlinks ) S="-s ";;
- -z | --compress ) ZIP=$2; shift ;;
- -e | --extension ) Z=$2; shift ;;
- -s | --suffix ) SUFFIX=$2; shift ;;
+ -s | --symlinks ) SymOrLoc="-s " ;;
+ -z | --compress ) Gzip=$2; shift ;;
+ -e | --extension ) Gz=$2; shift ;;
+ -x | --suffix ) Suffix=$2; shift ;;
+ -*) cat <<EOF
+Unknown option "$1". Supported options:
+ -s Use symbolic links for manpages with multiple names.
+ -z PROG Use PROG to compress manual pages.
+ -e EXT Defines the extension added by -z PROG when compressing.
+ -x SUFF Defines an extra extension suffix to use.
+Option names may not be combined getopt-style.
+EOF
+ exit 1 ;;
*) break ;;
esac
shift
@@ -16,52 +33,84 @@ if test "$#" != 2; then
exit 1
fi
-MANPAGE=$1
-DIR=$2
-test -z "$S" && S="$DIR/"
+########################################################################
+### Parse Required Arguments
+###
+
+ManPage=$1
+Dir=$2
+if test -f $ManPage ; then : ; else
+ echo "source manual page file must exist"
+ exit 1
+fi
+if test -d $Dir ; then : ; else
+ echo "target directory must exist"
+ exit 1
+fi
+test -z "$SymOrLoc" && SymOrLoc="$Dir/"
+
+########################################################################
+### Extract Target Names from Manual Page
+###
# A sed script to parse the alternative names out of a man page.
#
-# /^\\.SH NAME/{ ;# Look for a line, that starts with .SH NAME
-# s/^.*$// ;# Delete the content of this line from the buffer
-# n ;# Read next line
-# s/,//g ;# Remove all commas ...
-# s/\\\ //g ;# .. and backslash-escaped spaces.
-# s/ \\\-.*// ;# Delete from \- to the end of line
-# p ;# print the result
-# q ;# exit
-# }
-#
# Backslashes are trippled in the sed script, because it is in
-# backticks which don't pass backslashes literally.
+# backticks which doesn't pass backslashes literally.
#
-# Please keep the commented version above updated if you
-# change anything to the script below.
-NAMES=`sed -n '
- /^\\.SH NAME/{
- s/^.*$//
+Names=`sed -n '
+# Look for a line, that starts with .SH NAME
+# optionally allow NAME to be surrounded
+# by quotes.
+ /^\.SH NAME/{
+# Read next line
n
+# Remove all commas ...
s/,//g
+# ... and backslash-escaped spaces.
s/\\\ //g
+# Delete from \- to the end of line
s/ \\\-.*//
- p
- q
- }' $MANPAGE`
+# print the result and exit
+ p;q
+ }' $ManPage`
+
+if test -z "$Names" ; then
+ echo "warning: no target names found in $ManPage"
+fi
+
+########################################################################
+### Remaining Set Up
+###
-SECTION=`echo $MANPAGE | sed 's/.*\(.\)$/\1/'`
-SRCDIR=`dirname $MANPAGE`
-FIRST=""
-for f in $NAMES; do
- f=$f.$SECTION$SUFFIX
- if test -z "$FIRST" ; then
- FIRST=$f
- rm -f $DIR/$FIRST $DIR/$FIRST.*
- sed -e "/man\.macros/r $SRCDIR/man.macros" -e "/man\.macros/d" \
- $MANPAGE > $DIR/$FIRST
- chmod 444 $DIR/$FIRST
- $ZIP $DIR/$FIRST
+case $ManPage in
+ *.1) Section=1 ;;
+ *.3) Section=3 ;;
+ *.n) Section=n ;;
+ *) echo "unknown section for $ManPage"
+ exit 2 ;;
+esac
+
+SrcDir=`dirname $ManPage`
+
+########################################################################
+### Process Page to Create Target Pages
+###
+
+First=""
+for Target in $Names; do
+ Target=$Target.$Section$Suffix
+ rm -f $Dir/$Target $Dir/$Target.*
+ if test -z "$First" ; then
+ First=$Target
+ sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \
+ $ManPage > $Dir/$First
+ chmod 444 $Dir/$First
+ $Gzip $Dir/$First
else
- rm -f $DIR/$f $DIR/$f.*
- ln $S$FIRST$Z $DIR/$f$Z
+ ln $SymOrLoc$First$Gz $Dir/$Target$Gz
fi
done
+
+########################################################################
+exit 0
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index b54f7a1..78eacd9 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -27,7 +27,10 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
- AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
+ AC_ARG_WITH(tcl,
+ AC_HELP_STRING([--with-tcl],
+ [directory containing tcl configuration (tclConfig.sh)]),
+ with_tclconfig="${withval}")
AC_MSG_CHECKING([for Tcl configuration])
AC_CACHE_VAL(ac_cv_c_tclconfig,[
@@ -154,7 +157,10 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
if test x"${no_tk}" = x ; then
# we reset no_tk in case something fails here
no_tk=true
- AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
+ AC_ARG_WITH(tk,
+ AC_HELP_STRING([--with-tk],
+ [directory containing tk configuration (tkConfig.sh)]),
+ with_tkconfig="${withval}")
AC_MSG_CHECKING([for Tk configuration])
AC_CACHE_VAL(ac_cv_c_tkconfig,[
@@ -517,7 +523,8 @@ AC_DEFUN([SC_BUILD_TCLSH], [
AC_DEFUN([SC_ENABLE_SHARED], [
AC_MSG_CHECKING([how to build libraries])
AC_ARG_ENABLE(shared,
- [ --enable-shared build and link with shared libraries [--enable-shared]],
+ AC_HELP_STRING([--enable-shared],
+ [build and link with shared libraries (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test "${enable_shared+set}" = set; then
@@ -558,7 +565,8 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
if test "`uname -s`" = "Darwin" ; then
AC_MSG_CHECKING([how to package libraries])
AC_ARG_ENABLE(framework,
- [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]],
+ AC_HELP_STRING([--enable-framework],
+ [package shared libraries in MacOSX frameworks (default: off)]),
[enable_framework=$enableval], [enable_framework=no])
if test $enable_framework = yes; then
if test $SHARED_BUILD = 0; then
@@ -587,9 +595,7 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
#------------------------------------------------------------------------
# SC_ENABLE_THREADS --
#
-# Specify if thread support should be enabled. TCL_THREADS is
-# checked so that if you are compiling an extension against a
-# threaded core, your extension must be compiled threaded as well.
+# Specify if thread support should be enabled
#
# Arguments:
# none
@@ -610,7 +616,9 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
#------------------------------------------------------------------------
AC_DEFUN([SC_ENABLE_THREADS], [
- AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
+ AC_ARG_ENABLE(threads,
+ AC_HELP_STRING([--enable-threads],
+ [build with threads (default: off)]),
[tcl_ok=$enableval], [tcl_ok=no])
if test "${TCL_THREADS}" = 1; then
@@ -672,7 +680,39 @@ AC_DEFUN([SC_ENABLE_THREADS], [
ac_saved_libs=$LIBS
LIBS="$LIBS $THREADS_LIBS"
AC_CHECK_FUNCS(pthread_attr_setstacksize)
- AC_CHECK_FUNCS(pthread_atfork)
+ AC_CHECK_FUNC(pthread_attr_get_np,tcl_ok=yes,tcl_ok=no)
+ if test $tcl_ok = yes ; then
+ AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1,
+ [Do we want a BSD-like thread-attribute interface?])
+ AC_CACHE_CHECK([for pthread_attr_get_np declaration],
+ tcl_cv_grep_pthread_attr_get_np, [
+ AC_EGREP_HEADER(pthread_attr_get_np, pthread.h,
+ tcl_cv_grep_pthread_attr_get_np=present,
+ tcl_cv_grep_pthread_attr_get_np=missing)])
+ if test $tcl_cv_grep_pthread_attr_get_np = missing ; then
+ AC_DEFINE(ATTRGETNP_NOT_DECLARED, 1,
+ [Is pthread_attr_get_np() declared in <pthread.h>?])
+ fi
+ else
+ AC_CHECK_FUNC(pthread_getattr_np,tcl_ok=yes,tcl_ok=no)
+ if test $tcl_ok = yes ; then
+ AC_DEFINE(HAVE_PTHREAD_GETATTR_NP, 1,
+ [Do we want a Linux-like thread-attribute interface?])
+ AC_CACHE_CHECK([for pthread_getattr_np declaration],
+ tcl_cv_grep_pthread_getattr_np, [
+ AC_EGREP_HEADER(pthread_getattr_np, pthread.h,
+ tcl_cv_grep_pthread_getattr_np=present,
+ tcl_cv_grep_pthread_getattr_np=missing)])
+ if test $tcl_cv_grep_pthread_getattr_np = missing ; then
+ AC_DEFINE(GETATTRNP_NOT_DECLARED, 1,
+ [Is pthread_getattr_np declared in <pthread.h>?])
+ fi
+ fi
+ fi
+ if test $tcl_ok = no; then
+ # Darwin thread stacksize API
+ AC_CHECK_FUNCS(pthread_get_stacksize_np)
+ fi
LIBS=$ac_saved_libs
else
TCL_THREADS=0
@@ -687,7 +727,7 @@ AC_DEFUN([SC_ENABLE_THREADS], [
AC_MSG_RESULT([yes])
fi
else
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no (default)])
fi
AC_SUBST(TCL_THREADS)
@@ -719,42 +759,49 @@ AC_DEFUN([SC_ENABLE_THREADS], [
# Sets to $(CFLAGS_OPTIMIZE) if false
# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
# Sets to $(LDFLAGS_OPTIMIZE) if false
-# DBGX Debug library extension
+# DBGX Formerly used as debug library extension;
+# always blank now.
#
#------------------------------------------------------------------------
AC_DEFUN([SC_ENABLE_SYMBOLS], [
AC_MSG_CHECKING([for build with symbols])
- AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
+ AC_ARG_ENABLE(symbols,
+ AC_HELP_STRING([--enable-symbols],
+ [build with debugging symbols (default: off)]),
+ [tcl_ok=$enableval], [tcl_ok=no])
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
+ DBGX=""
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
AC_MSG_RESULT([no])
+ AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
AC_MSG_RESULT([yes (standard debugging)])
fi
fi
AC_SUBST(CFLAGS_DEFAULT)
AC_SUBST(LDFLAGS_DEFAULT)
+ ### FIXME: Surely TCL_CFG_DEBUG should be set to whether we're debugging?
+ AC_DEFINE(TCL_CFG_DEBUG, 1, [Is debugging enabled?])
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
fi
- if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
- AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
- AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
- fi
+ ifelse($1,bccdebug,dnl Only enable 'compile' for the Tcl core itself
+ if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
+ AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
+ AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
+ fi)
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- AC_MSG_RESULT([enabled symbols mem compile debugging])
+ AC_MSG_RESULT([enabled symbols mem ]ifelse($1,bccdebug,[compile ])[debugging])
else
AC_MSG_RESULT([enabled $tcl_ok debugging])
fi
@@ -782,8 +829,8 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
AC_DEFUN([SC_ENABLE_LANGINFO], [
AC_ARG_ENABLE(langinfo,
- [ --enable-langinfo use nl_langinfo if possible to determine
- encoding at startup, otherwise use old heuristic],
+ AC_HELP_STRING([--enable-langinfo],
+ [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
[langinfo_ok=$enableval], [langinfo_ok=yes])
HAVE_LANGINFO=0
@@ -834,15 +881,16 @@ AC_DEFUN([SC_ENABLE_LANGINFO], [
AC_DEFUN([SC_CONFIG_MANPAGES], [
AC_MSG_CHECKING([whether to use symlinks for manpages])
AC_ARG_ENABLE(man-symlinks,
- [ --enable-man-symlinks use symlinks for the manpages],
+ AC_HELP_STRING([--enable-man-symlinks],
+ [use symlinks for the manpages (default: off)]),
test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
enableval="no")
AC_MSG_RESULT([$enableval])
AC_MSG_CHECKING([whether to compress the manpages])
AC_ARG_ENABLE(man-compression,
- [ --enable-man-compression=PROG
- compress the manpages with PROG],
+ AC_HELP_STRING([--enable-man-compression=PROG],
+ [compress the manpages with PROG (default: off)]),
[case $enableval in
yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
no) ;;
@@ -862,11 +910,10 @@ AC_DEFUN([SC_CONFIG_MANPAGES], [
AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
AC_ARG_ENABLE(man-suffix,
- [ --enable-man-suffix=STRING
- use STRING as a suffix to manpage file names
- (default: $1)],
+ AC_HELP_STRING([--enable-man-suffix=STRING],
+ [use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]),
[case $enableval in
- yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
+ yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
esac],
@@ -994,16 +1041,9 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [
# a .a extension whereas shared objects for loadable
# extensions have a .so extension. Defaults to
# ${VERSION}${SHLIB_SUFFIX}.
-# TCL_NEEDS_EXP_FILE -
-# 1 means that an export file is needed to link to a
-# shared library.
-# TCL_EXP_FILE - The name of the installed export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
-# TCL_BUILD_EXP_FILE -
-# The name of the built export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
+# TCL_LIBS -
+# Libs to use when linking Tcl shell or some other
+# shell that includes Tcl libs.
# CFLAGS_DEBUG -
# Flags used when running the compiler in debug mode
# CFLAGS_OPTIMIZE -
@@ -1017,26 +1057,46 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# Step 0.a: Enable 64 bit support?
AC_MSG_CHECKING([if 64bit support is requested])
- AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],
+ AC_ARG_ENABLE(64bit,
+ AC_HELP_STRING([--enable-64bit],
+ [enable 64bit support (default: off)]),
[do64bit=$enableval], [do64bit=no])
AC_MSG_RESULT([$do64bit])
# Step 0.b: Enable Solaris 64 bit VIS support?
AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
- AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],
+ AC_ARG_ENABLE(64bit-vis,
+ AC_HELP_STRING([--enable-64bit-vis],
+ [enable 64bit Sparc VIS support (default: off)]),
[do64bitVIS=$enableval], [do64bitVIS=no])
AC_MSG_RESULT([$do64bitVIS])
-
- if test "$do64bitVIS" = "yes"; then
- # Force 64bit on with VIS
- do64bit=yes
- fi
+ # Force 64bit on with VIS
+ AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
+
+ # Step 0.c: Check if visibility support is available. Do this here so
+ # that platform specific alternatives can be used below if this fails.
+
+ AC_CACHE_CHECK([if compiler supports visibility "hidden"],
+ tcl_cv_cc_visibility_hidden, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ AC_TRY_LINK([
+ extern __attribute__((__visibility__("hidden"))) void f(void);
+ void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
+ tcl_cv_cc_visibility_hidden=no)
+ CFLAGS=$hold_cflags])
+ AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
+ AC_DEFINE(MODULE_SCOPE,
+ [extern __attribute__((__visibility__("hidden")))],
+ [Compiler support for module scope symbols])
+ ])
# Step 0.d: Disable -rpath support?
AC_MSG_CHECKING([if rpath support is requested])
- AC_ARG_ENABLE(rpath,[ --disable-rpath disable rpath support (default: on)],
+ AC_ARG_ENABLE(rpath,
+ AC_HELP_STRING([--disable-rpath],
+ [disable rpath support (default: on)]),
[doRpath=$enableval], [doRpath=yes])
AC_MSG_RESULT([$doRpath])
@@ -1051,6 +1111,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
# Require ranlib early so we can override it in special cases below.
+ AS_IF([test x"${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"])
AC_REQUIRE([AC_PROG_RANLIB])
@@ -1060,34 +1121,28 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# default to '{$LIBS}' and set to "" on per-platform necessary basis
SHLIB_LD_LIBS='${LIBS}'
LDFLAGS_ORIG="$LDFLAGS"
- TCL_EXPORT_FILE_SUFFIX=""
+ # When ld needs options to work in 64-bit mode, put them in
+ # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
+ # is disabled by the user. [Bug 1016796]
+ LDFLAGS_ARCH=""
UNSHARED_LIB_SUFFIX=""
TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
ECHO_VERSION='`echo ${VERSION}`'
TCL_LIB_VERSIONS_OK=ok
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE=-O
- if test "$GCC" = "yes" ; then
- CFLAGS_WARNING="-Wall -fno-strict-aliasing"
- else
- CFLAGS_WARNING=""
- fi
- TCL_NEEDS_EXP_FILE=0
- TCL_BUILD_EXP_FILE=""
- TCL_EXP_FILE=""
-dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
-dnl AC_CHECK_TOOL(AR, ar)
- AC_CHECK_PROG(AR, ar, ar)
- if test "${AR}" = "" ; then
- AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
- fi
+ AS_IF([test "$GCC" = yes], [
+ CFLAGS_WARNING="-Wall"
+ ], [CFLAGS_WARNING=""])
+ AC_CHECK_TOOL(AR, ar)
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
PLAT_SRCS=""
+ LDAIX_SRC=""
case $system in
AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
+ AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
# AIX requires the _r compiler when gcc isn't being used
case "${CC}" in
*_r|*_r\ *)
@@ -1099,7 +1154,7 @@ dnl AC_CHECK_TOOL(AR, ar)
;;
esac
AC_MSG_RESULT([Using $CC for compiling with threads])
- fi
+ ])
LIBS="$LIBS -lc"
SHLIB_CFLAGS=""
SHLIB_SUFFIX=".so"
@@ -1107,68 +1162,47 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
LD_LIBRARY_PATH_VAR="LIBPATH"
- # Check to enable 64-bit flags for compiler/linker on AIX 4+
- if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
- if test "$GCC" = "yes" ; then
+ # ldAix No longer needed with use of -bexpall/-brtl
+ # but some extensions may still reference it
+ LDAIX_SRC='$(UNIX_DIR)/ldAix'
+
+ # Check to enable 64-bit flags for compiler/linker
+ AS_IF([test "$do64bit" = yes], [
+ AS_IF([test "$GCC" = yes], [
AC_MSG_WARN([64bit mode not supported with GCC on $system])
- else
+ ], [
do64bit_ok=yes
CFLAGS="$CFLAGS -q64"
- LDFLAGS="$LDFLAGS -q64"
+ LDFLAGS_ARCH="-q64"
RANLIB="${RANLIB} -X64"
AR="${AR} -X64"
SHLIB_LD_FLAGS="-b64"
- fi
- fi
+ ])
+ ])
- if test "`uname -m`" = "ia64" ; then
+ AS_IF([test "`uname -m`" = ia64], [
# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
# AIX-5 has dl* in libc.so
DL_LIBS=""
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- else
+ ], [
CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
- fi
+ ])
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- else
- if test "$GCC" = "yes" ; then
- SHLIB_LD="gcc -shared"
- else
- SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- fi
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
+ ], [
+ AS_IF([test "$GCC" = yes], [
+ SHLIB_LD='${CC} -shared -Wl,-bexpall'
+ ], [
+ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
+ LDFLAGS="$LDFLAGS -brtl"
+ ])
+ SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
DL_LIBS="-ldl"
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
- fi
-
- # AIX v<=4.1 has some different flags than 4.2+
- if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
- LIBOBJS="$LIBOBJS tclLoadAix.o"
- DL_LIBS="-lld"
- fi
-
- # On AIX <=v4 systems, libbsd.a has to be linked in to support
- # non-blocking file IO. This library has to be linked in after
- # the MATH_LIBS or it breaks the pow() function. The way to
- # insure proper sequencing, is to add it to the tail of MATH_LIBS.
- # This library also supplies gettimeofday.
- #
- # AIX does not have a timezone field in struct tm. When the AIX
- # bsd library is used, the timezone global and the gettimeofday
- # methods are to be avoided for timezone deduction instead, we
- # deduce the timezone by comparing the localtime result on a
- # known GMT value.
-
- AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
- if test $libbsd = yes; then
- MATH_LIBS="$MATH_LIBS -lbsd"
- AC_DEFINE(USE_DELTA_FOR_TZ)
- fi
+ ])
;;
BeOS*)
SHLIB_CFLAGS="-fPIC"
@@ -1237,13 +1271,13 @@ dnl AC_CHECK_TOOL(AR, ar)
AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
LIBS="$LIBS -lxnet" # Use the XOPEN network library
- if test "`uname -m`" = "ia64" ; then
+ AS_IF([test "`uname -m`" = ia64], [
SHLIB_SUFFIX=".so"
- else
+ ], [
SHLIB_SUFFIX=".sl"
- fi
+ ])
AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
+ AS_IF([test "$tcl_ok" = yes], [
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
DL_OBJS="tclLoadShl.o"
@@ -1252,43 +1286,41 @@ dnl AC_CHECK_TOOL(AR, ar)
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- if test "$GCC" = "yes" ; then
+ ])
+ AS_IF([test "$GCC" = yes], [
SHLIB_LD='${CC} -shared'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+ ])
# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
#CFLAGS="$CFLAGS +DAportable"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$do64bit" = "yes"], [
+ AS_IF([test "$GCC" = yes], [
case `${CC} -dumpmachine` in
hppa64*)
# 64-bit gcc in use. Fix flags for GNU ld.
do64bit_ok=yes
SHLIB_LD='${CC} -shared'
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
;;
*)
AC_MSG_WARN([64bit mode not supported with GCC on $system])
;;
esac
- else
+ ], [
do64bit_ok=yes
CFLAGS="$CFLAGS +DD64"
- LDFLAGS="$LDFLAGS +DD64"
- fi
- fi
- ;;
+ LDFLAGS_ARCH="+DD64"
+ ])
+ ]) ;;
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
SHLIB_SUFFIX=".sl"
AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
+ AS_IF([test "$tcl_ok" = yes], [
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
SHLIB_LD_LIBS=""
@@ -1298,29 +1330,16 @@ dnl AC_CHECK_TOOL(AR, ar)
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- ;;
- IRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- ;;
+ ]) ;;
IRIX-5.*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -shared -rdata_shared"
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
;;
IRIX-6.*)
SHLIB_CFLAGS=""
@@ -1328,14 +1347,13 @@ dnl AC_CHECK_TOOL(AR, ar)
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AS_IF([test "$GCC" = yes], [
CFLAGS="$CFLAGS -mabi=n32"
LDFLAGS="$LDFLAGS -mabi=n32"
- else
+ ], [
case $system in
IRIX-6.3)
# Use to build 6.2 compatible binaries on 6.3.
@@ -1346,7 +1364,7 @@ dnl AC_CHECK_TOOL(AR, ar)
;;
esac
LDFLAGS="$LDFLAGS -n32"
- fi
+ ])
;;
IRIX64-6.*)
SHLIB_CFLAGS=""
@@ -1354,23 +1372,22 @@ dnl AC_CHECK_TOOL(AR, ar)
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$do64bit" = yes], [
+ AS_IF([test "$GCC" = yes], [
AC_MSG_WARN([64bit mode not supported by gcc])
- else
+ ], [
do64bit_ok=yes
SHLIB_LD="ld -64 -shared -rdata_shared"
CFLAGS="$CFLAGS -64"
- LDFLAGS="$LDFLAGS -64"
- fi
- fi
+ LDFLAGS_ARCH="-64"
+ ])
+ ])
;;
Linux*)
SHLIB_CFLAGS="-fPIC"
@@ -1382,75 +1399,45 @@ dnl AC_CHECK_TOOL(AR, ar)
# get rid of the warnings.
#CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS="tclLoadDld.o"
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
- if test $do64bit = yes; then
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
+ AS_IF([test $do64bit = yes], [
AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -m64"
AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_m64 = yes; then
+ AS_IF([test $tcl_cv_cc_m64 = yes], [
CFLAGS="$CFLAGS -m64"
do64bit_ok=yes
- fi
- fi
+ ])
+ ])
- # The combo of gcc + glibc has a bug related
- # to inlining of functions like strtod(). The
- # -fno-builtin flag should address this problem
- # but it does not work. The -fno-inline flag
- # is kind of overkill but it works.
- # Disable inlining only when one of the
+ # The combo of gcc + glibc has a bug related to inlining of
+ # functions like strtod(). The -fno-builtin flag should address
+ # this problem but it does not work. The -fno-inline flag is kind
+ # of overkill but it works. Disable inlining only when one of the
# files in compat/*.c is being linked in.
- if test x"${LIBOBJS}" != x ; then
- CFLAGS="$CFLAGS -fno-inline"
- fi
-
- # XIM peeking works under XFree86.
- AC_DEFINE(PEEK_XCLOSEIM)
+ AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
;;
GNU*)
SHLIB_CFLAGS="-fPIC"
SHLIB_SUFFIX=".so"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared'
- DL_OBJS=""
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS=""
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
+ SHLIB_LD='${CC} -shared'
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
;;
Lynx*)
SHLIB_CFLAGS="-fPIC"
@@ -1460,10 +1447,9 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
DL_LIBS="-mshared -ldl"
LD_FLAGS="-Wl,--export-dynamic"
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
;;
MP-RAS-02*)
SHLIB_CFLAGS="-K PIC"
@@ -1487,92 +1473,80 @@ dnl AC_CHECK_TOOL(AR, ar)
LD_SEARCH_FLAGS=""
;;
NetBSD-1.*|FreeBSD-[[1-2]].*)
- # Not available on all versions: check for include file.
- AC_CHECK_HEADER(dlfcn.h, [
- # NetBSD/SPARC needs -fPIC, -fpic will not do.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
- AC_EGREP_CPP(yes, [
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
#ifdef __ELF__
yes
#endif
- ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
- if test $tcl_cv_ld_elf = yes; then
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
- else
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- fi
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ AS_IF([test $tcl_cv_ld_elf = yes], [
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
], [
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
])
- # FreeBSD doesn't handle version numbers with dots.
+ # Ancient FreeBSD doesn't handle version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
arch=`arch -s`
case "$arch" in
m88k|vax)
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ # Equivalent using configure option --disable-load
+ # Step 4 will set the necessary variables
+ DL_OBJS=""
+ SHLIB_LD_LIBS=""
;;
*)
- # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
- case `machine` in
- sparc|sparc64)
- SHLIB_CFLAGS="-fPIC";;
- *)
- SHLIB_CFLAGS="-fpic";;
- esac
- SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
- AC_EGREP_CPP(yes, [
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ ;;
+ esac
+ case "$arch" in
+ m88k|vax)
+ CFLAGS_OPTIMIZE="-O1"
+ ;;
+ sh)
+ CFLAGS_OPTIMIZE="-O0"
+ ;;
+ *)
+ CFLAGS_OPTIMIZE="-O2"
+ ;;
+ esac
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
#ifdef __ELF__
yes
#endif
- ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
- if test $tcl_cv_ld_elf = yes; then
- LDFLAGS=-Wl,-export-dynamic
- else
- LDFLAGS=""
- fi
- ;;
- esac
-
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ AS_IF([test $tcl_cv_ld_elf = yes], [
+ LDFLAGS=-Wl,-export-dynamic
+ ], [LDFLAGS=""])
+ AS_IF([test "${TCL_THREADS}" = "1"], [
+ # On OpenBSD: Compile with -pthread
+ # Don't link with -lpthread
+ LIBS=`echo $LIBS | sed s/-lpthread//`
+ CFLAGS="$CFLAGS -pthread"
+ ])
# OpenBSD doesn't do version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
NetBSD-*|FreeBSD-[[3-4]].*)
@@ -1584,16 +1558,15 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -export-dynamic"
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "${TCL_THREADS}" = "1" ; then
+ AS_IF([test "${TCL_THREADS}" = "1"], [
# The -pthread needs to go in the CFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
+ ])
case $system in
FreeBSD-3.*)
# FreeBSD-3 doesn't handle version numbers with dots.
@@ -1612,16 +1585,14 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS=""
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "${TCL_THREADS}" = "1" ; then
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AS_IF([test "${TCL_THREADS}" = "1"], [
# The -pthread needs to go in the LDFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- fi
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
# Version numbers are dot-stripped by system policy.
TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
@@ -1640,7 +1611,7 @@ dnl AC_CHECK_TOOL(AR, ar)
CFLAGS="`echo " ${CFLAGS}" | \
awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
- if test $do64bit = yes; then
+ AS_IF([test $do64bit = yes], [
case `arch` in
ppc)
AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
@@ -1650,10 +1621,10 @@ dnl AC_CHECK_TOOL(AR, ar)
AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
tcl_cv_cc_arch_ppc64=no)
CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_arch_ppc64 = yes; then
+ AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
do64bit_ok=yes
- fi;;
+ ]);;
i386)
AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
tcl_cv_cc_arch_x86_64, [
@@ -1662,92 +1633,109 @@ dnl AC_CHECK_TOOL(AR, ar)
AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
tcl_cv_cc_arch_x86_64=no)
CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_arch_x86_64 = yes; then
+ AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
CFLAGS="$CFLAGS -arch x86_64"
do64bit_ok=yes
- fi;;
+ ]);;
*)
AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
esac
- else
+ ], [
# Check for combined 32-bit and 64-bit fat build
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
- fat_32_64=yes
- fi
+ AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
+ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
+ fat_32_64=yes])
+ ])
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
LDFLAGS=$hold_ldflags])
- if test $tcl_cv_ld_single_module = yes; then
+ AS_IF([test $tcl_cv_ld_single_module = yes], [
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
- fi
+ ])
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
# Don't use -prebind when building for Mac OS X 10.4 or later only:
- test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
- "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
- LDFLAGS="$LDFLAGS -prebind"
+ AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
+ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
+ LDFLAGS="$LDFLAGS -prebind"])
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
- AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
+ AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
+ tcl_cv_ld_search_paths_first, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
+ tcl_cv_ld_search_paths_first=no)
LDFLAGS=$hold_ldflags])
- if test $tcl_cv_ld_search_paths_first = yes; then
+ AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- fi
+ ])
+ AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
+ AC_DEFINE(MODULE_SCOPE, [__private_extern__],
+ [Compiler support for module scope symbols])
+ ])
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
- PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
- PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
+ AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?])
+ PLAT_OBJS='${MAC_OSX_OBJS}'
+ PLAT_SRCS='${MAC_OSX_SRCS}'
AC_MSG_CHECKING([whether to use CoreFoundation])
- AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
+ AC_ARG_ENABLE(corefoundation,
+ AC_HELP_STRING([--enable-corefoundation],
+ [use CoreFoundation API on MacOSX (default: on)]),
[tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
AC_MSG_RESULT([$tcl_corefoundation])
- if test $tcl_corefoundation = yes; then
- AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
+ AS_IF([test $tcl_corefoundation = yes], [
+ AC_CACHE_CHECK([for CoreFoundation.framework],
+ tcl_cv_lib_corefoundation, [
hold_libs=$LIBS
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- # On Tiger there is no 64-bit CF, so remove 64-bit archs
- # from CFLAGS et al. while testing for presence of CF.
- # 64-bit CF is disabled in tclUnixPort.h if necessary.
- eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
- done; fi
+ AS_IF([test "$fat_32_64" = yes], [
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ # On Tiger there is no 64-bit CF, so remove 64-bit
+ # archs from CFLAGS et al. while testing for
+ # presence of CF. 64-bit CF is disabled in
+ # tclUnixPort.h if necessary.
+ eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
+ done])
LIBS="$LIBS -framework CoreFoundation"
AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
[CFBundleRef b = CFBundleGetMainBundle();],
- tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- eval $v'="$hold_'$v'"'
- done; fi; LIBS=$hold_libs])
- if test $tcl_cv_lib_corefoundation = yes; then
+ tcl_cv_lib_corefoundation=yes,
+ tcl_cv_lib_corefoundation=no)
+ AS_IF([test "$fat_32_64" = yes], [
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ eval $v'="$hold_'$v'"'
+ done])
+ LIBS=$hold_libs])
+ AS_IF([test $tcl_cv_lib_corefoundation = yes], [
LIBS="$LIBS -framework CoreFoundation"
- AC_DEFINE(HAVE_COREFOUNDATION)
- else
- tcl_corefoundation=no
- fi
- if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
- AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
+ AC_DEFINE(HAVE_COREFOUNDATION, 1,
+ [Do we have access to Darwin CoreFoundation.framework?])
+ ], [tcl_corefoundation=no])
+ AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[
+ AC_CACHE_CHECK([for 64-bit CoreFoundation],
+ tcl_cv_lib_corefoundation_64, [
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
[CFBundleRef b = CFBundleGetMainBundle();],
- tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
+ tcl_cv_lib_corefoundation_64=yes,
+ tcl_cv_lib_corefoundation_64=no)
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done])
- if test $tcl_cv_lib_corefoundation_64 = no; then
- AC_DEFINE(NO_COREFOUNDATION_64)
- fi
- fi
- fi
- AC_DEFINE(MAC_OSX_TCL)
+ AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [
+ AC_DEFINE(NO_COREFOUNDATION_64, 1,
+ [Is Darwin CoreFoundation unavailable for 64-bit?])
+ LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
+ ])
+ ])
+ ])
;;
NEXTSTEP-*)
SHLIB_CFLAGS=""
@@ -1780,11 +1768,9 @@ dnl AC_CHECK_TOOL(AR, ar)
OSF1-1.*)
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
SHLIB_CFLAGS="-fPIC"
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD="ld -shared"
- else
+ AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
SHLIB_LD="ld -non_shared"
- fi
+ ])
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
@@ -1795,36 +1781,31 @@ dnl AC_CHECK_TOOL(AR, ar)
OSF1-V*)
# Digital OSF/1
SHLIB_CFLAGS=""
- if test "$SHARED_BUILD" = "1" ; then
+ AS_IF([test "$SHARED_BUILD" = 1], [
SHLIB_LD='ld -shared -expect_unresolved "*"'
- else
+ ], [
SHLIB_LD='ld -non_shared -expect_unresolved "*"'
- fi
+ ])
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
- CFLAGS="$CFLAGS -mieee"
- else
- CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
- fi
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
+ CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
# see pthread_intro(3) for pthread support on osf1, k.furukawa
- if test "${TCL_THREADS}" = "1" ; then
+ AS_IF([test "${TCL_THREADS}" = 1], [
CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
LIBS=`echo $LIBS | sed s/-lpthreads//`
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
LIBS="$LIBS -lpthread -lmach -lexc"
- else
+ ], [
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
- fi
-
+ ])
+ ])
;;
QNX-6*)
# QNX RTP
@@ -1839,27 +1820,17 @@ dnl AC_CHECK_TOOL(AR, ar)
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
- RISCos-*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- ;;
SCO_SV-3.2*)
# Note, dlopen is available only on SCO 3.2.5 and greater. However,
# this test works, since "uname -s" was non-standard in 3.2.4 and
# below.
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
SHLIB_CFLAGS="-fPIC -melf"
LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
- else
+ ], [
SHLIB_CFLAGS="-Kpic -belf"
LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
- fi
+ ])
SHLIB_LD="ld -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -1893,8 +1864,8 @@ dnl AC_CHECK_TOOL(AR, ar)
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
SunOS-5.[[0-6]])
@@ -1908,19 +1879,18 @@ dnl AC_CHECK_TOOL(AR, ar)
[Do we really want to follow the standard? Yes we do!])
SHLIB_CFLAGS="-KPIC"
-
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
+ ], [
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+ ])
;;
SunOS-5*)
# Note: If _REENTRANT isn't defined, then Solaris
@@ -1933,32 +1903,32 @@ dnl AC_CHECK_TOOL(AR, ar)
SHLIB_CFLAGS="-KPIC"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
+ AS_IF([test "$do64bit" = yes], [
arch=`isainfo`
- if test "$arch" = "sparcv9 sparc" ; then
- if test "$GCC" = "yes" ; then
- if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
- AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
- else
- do64bit_ok=yes
- CFLAGS="$CFLAGS -m64 -mcpu=v9"
- LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
- SHLIB_CFLAGS="-fPIC"
- fi
- else
+ AS_IF([test "$arch" = "sparcv9 sparc"], [
+ AS_IF([test "$GCC" = yes], [
+ AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
+ AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
+ ], [
do64bit_ok=yes
- if test "$do64bitVIS" = "yes" ; then
- CFLAGS="$CFLAGS -xarch=v9a"
- LDFLAGS="$LDFLAGS -xarch=v9a"
- else
- CFLAGS="$CFLAGS -xarch=v9"
- LDFLAGS="$LDFLAGS -xarch=v9"
- fi
- # Solaris 64 uses this as well
- #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
- fi
- elif test "$arch" = "amd64 i386" ; then
- if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -m64 -mcpu=v9"
+ LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+ SHLIB_CFLAGS="-fPIC"
+ ])
+ ], [
+ do64bit_ok=yes
+ AS_IF([test "$do64bitVIS" = yes], [
+ CFLAGS="$CFLAGS -xarch=v9a"
+ LDFLAGS_ARCH="-xarch=v9a"
+ ], [
+ CFLAGS="$CFLAGS -xarch=v9"
+ LDFLAGS_ARCH="-xarch=v9"
+ ])
+ # Solaris 64 uses this as well
+ #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
+ ])
+ ], [AS_IF([test "$arch" = "amd64 i386"], [
+ AS_IF([test "$GCC" = yes], [
case $system in
SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
do64bit_ok=yes
@@ -1967,7 +1937,7 @@ dnl AC_CHECK_TOOL(AR, ar)
*)
AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
esac
- else
+ ], [
do64bit_ok=yes
case $system in
SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
@@ -1977,21 +1947,36 @@ dnl AC_CHECK_TOOL(AR, ar)
CFLAGS="$CFLAGS -xarch=amd64"
LDFLAGS="$LDFLAGS -xarch=amd64";;
esac
- fi
- else
- AC_MSG_WARN([64bit mode not supported for $arch])
- fi
- fi
+ ])
+ ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
+ ])
+ #--------------------------------------------------------------------
+ # On Solaris 5.x i386 with the sunpro compiler we need to link
+ # with sunmath to get floating point rounding control
+ #--------------------------------------------------------------------
+ AS_IF([test "$GCC" = yes],[use_sunmath=no],[
+ arch=`isainfo`
+ AC_MSG_CHECKING([whether to use -lsunmath for fp rounding control])
+ AS_IF([test "$arch" = "amd64 i386"], [
+ AC_MSG_RESULT([yes])
+ MATH_LIBS="-lsunmath $MATH_LIBS"
+ AC_CHECK_HEADER(sunmath.h)
+ use_sunmath=yes
+ ], [
+ AC_MSG_RESULT([no])
+ use_sunmath=no
+ ])
+ ])
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
+ AS_IF([test "$GCC" = yes], [
+ SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$do64bit_ok" = "yes" ; then
- if test "$arch" = "sparcv9 sparc" ; then
+ AS_IF([test "$do64bit_ok" = yes], [
+ AS_IF([test "$arch" = "sparcv9 sparc"], [
# We need to specify -static-libgcc or we need to
# add the path to the sparv9 libgcc.
SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
@@ -1999,33 +1984,21 @@ dnl AC_CHECK_TOOL(AR, ar)
# path, remove so name and append 'sparcv9'
#v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
- elif test "$arch" = "amd64 i386" ; then
+ ], [AS_IF([test "$arch" = "amd64 i386"], [
SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
- fi
- fi
- else
+ ])])
+ ])
+ ], [
+ AS_IF([test "$use_sunmath" = yes], [textmode=textoff],[textmode=text])
case $system in
SunOS-5.[[1-9]][[0-9]]*)
- SHLIB_LD='${CC} -G -z text ${LDFLAGS}';;
+ SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
*)
- SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
+ SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
esac
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- fi
- ;;
- ULTRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$GCC" != "yes" ; then
- CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
- fi
+ ])
;;
UNIX_SV* | UnixWare-5*)
SHLIB_CFLAGS="-KPIC"
@@ -2041,111 +2014,38 @@ dnl AC_CHECK_TOOL(AR, ar)
LDFLAGS="$LDFLAGS -Wl,-Bexport"
AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
LDFLAGS=$hold_ldflags])
- if test $tcl_cv_ld_Bexport = yes; then
+ AS_IF([test $tcl_cv_ld_Bexport = yes], [
LDFLAGS="$LDFLAGS -Wl,-Bexport"
- fi
+ ])
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
esac
- if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+ AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
- fi
+ ])
+
+ AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = yes], [
+ AC_DEFINE(TCL_CFG_DO64BIT, 1, [Is this a 64-bit build?])
+ ])
dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
dnl # until the end of configure, as configure's compile and link tests use
dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
dnl # preprocessing tests use only CPPFLAGS.
- SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
-
- # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
- # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
- # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
- # to determine which of several header files defines the a.out file
- # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
- # support only a file format that is more or less version-7-compatible.
- # In particular,
- # - a.out files must begin with `struct exec'.
- # - the N_TXTOFF on the `struct exec' must compute the seek address
- # of the text segment
- # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
- # and a_entry fields.
- # The following compilation should succeed if and only if either sys/exec.h
- # or a.out.h is usable for the purpose.
- #
- # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
- # `struct exec' includes a second header that contains information that
- # duplicates the v7 fields that are needed.
-
- if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
- AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
- AC_TRY_COMPILE([#include <sys/exec.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
- if test $tcl_cv_sysexec_h = usable; then
- AC_DEFINE(USE_SYS_EXEC_H)
- else
- AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
- AC_TRY_COMPILE([#include <a.out.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
- if test $tcl_cv_aout_h = usable; then
- AC_DEFINE(USE_A_OUT_H)
- else
- AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
- AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_midmag == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
- if test $tcl_cv_sysexecaout_h = usable; then
- AC_DEFINE(USE_SYS_EXEC_AOUT_H)
- else
- DL_OBJS=""
- fi
- fi
- fi
- fi
+ AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
- # Step 5: disable dynamic loading if requested via a command-line switch.
+ # Step 4: disable dynamic loading if requested via a command-line switch.
- AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
+ AC_ARG_ENABLE(load,
+ AC_HELP_STRING([--enable-load],
+ [allow dynamic loading and "load" command (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
- if test "$tcl_ok" = "no"; then
- DL_OBJS=""
- fi
+ AS_IF([test "$tcl_ok" = no], [DL_OBJS=""])
- if test "x$DL_OBJS" != "x" ; then
- BUILD_DLTEST="\$(DLTEST_TARGETS)"
- else
- echo "Can't figure out how to do dynamic loading or shared libraries"
- echo "on this system."
+ AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [
+ AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.])
SHLIB_CFLAGS=""
SHLIB_LD=""
SHLIB_SUFFIX=""
@@ -2155,13 +2055,14 @@ dnl # preprocessing tests use only CPPFLAGS.
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
BUILD_DLTEST=""
- fi
+ ])
+ LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
# If we're running gcc, then change the C flags for compiling shared
# libraries to the right flags for gcc, instead of those for the
# standard manufacturer compiler.
- if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes ; then
+ AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [
case $system in
AIX-*) ;;
BSD/OS*) ;;
@@ -2169,52 +2070,56 @@ dnl # preprocessing tests use only CPPFLAGS.
IRIX*) ;;
NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
Darwin-*) ;;
- RISCos-*) ;;
SCO_SV-3.2*) ;;
- ULTRIX-4.*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
- esac
- fi
+ esac])
- if test "$SHARED_LIB_SUFFIX" = "" ; then
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
- fi
- if test "$UNSHARED_LIB_SUFFIX" = "" ; then
- UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- fi
+ AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
+ SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'])
+ AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
+ UNSHARED_LIB_SUFFIX='${VERSION}.a'])
- if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
+ AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+ ], [
LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
- if test "$RANLIB" = "" ; then
+ AS_IF([test "$RANLIB" = ""], [
MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+ ], [
MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
- fi
- fi
-
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(LIB_FILE))'
+ ])
+ ])
# Stub lib does not depend on shared/static configuration
- if test "$RANLIB" = "" ; then
+ AS_IF([test "$RANLIB" = ""], [
MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
- else
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
+ ], [
MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
- fi
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)"/$(STUB_LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(STUB_LIB_FILE))'
+ ])
+ # Define TCL_LIBS now that we know what DL_LIBS is.
+ # The trick here is that we don't want to change the value of TCL_LIBS if
+ # it is already set when tclConfig.sh had been loaded by Tk.
+ AS_IF([test "x${TCL_LIBS}" = x], [
+ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
+ AC_SUBST(TCL_LIBS)
+ # FIXME: This subst was left in only because the TCL_DL_LIBS
+ # entry in tclConfig.sh uses it. It is not clear why someone
+ # would use TCL_DL_LIBS instead of TCL_LIBS.
AC_SUBST(DL_LIBS)
AC_SUBST(DL_OBJS)
AC_SUBST(PLAT_OBJS)
AC_SUBST(PLAT_SRCS)
+ AC_SUBST(LDAIX_SRC)
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS_DEBUG)
AC_SUBST(CFLAGS_OPTIMIZE)
@@ -2233,6 +2138,8 @@ dnl # preprocessing tests use only CPPFLAGS.
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_SUFFIX)
+ AC_DEFINE_UNQUOTED(TCL_SHLIB_EXT,"${SHLIB_SUFFIX}",
+ [What is the default extension for shared libraries?])
AC_SUBST(MAKE_LIB)
AC_SUBST(MAKE_STUB_LIB)
@@ -2376,14 +2283,12 @@ int main() {
#
# Defines some of the following vars:
# NO_DIRENT_H
-# NO_ERRNO_H
# NO_VALUES_H
# HAVE_LIMITS_H or NO_LIMITS_H
# NO_STDLIB_H
# NO_STRING_H
# NO_SYS_WAIT_H
# NO_DLFCN_H
-# HAVE_UNISTD_H
# HAVE_SYS_PARAM_H
#
# HAVE_STRING_H ?
@@ -2417,7 +2322,6 @@ closedir(d);
AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
fi
- AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
AC_CHECK_HEADER(limits.h,
@@ -2445,7 +2349,7 @@ closedir(d);
AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
# OS/390 lacks sys/param.h (and doesn't need it, by chance).
- AC_HAVE_HEADERS(unistd.h sys/param.h)
+ AC_HAVE_HEADERS(sys/param.h)
])
#--------------------------------------------------------------------
@@ -2561,6 +2465,11 @@ AC_DEFUN([SC_BLOCKING_STYLE], [
SC_CONFIG_SYSTEM
AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
case $system in
+ # There used to be code here to use FIONBIO under AIX. However, it
+ # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
+ # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
+ # code (JO, 5/31/97).
+
OSF*)
AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
AC_MSG_RESULT([FIONBIO])
@@ -2569,10 +2478,6 @@ AC_DEFUN([SC_BLOCKING_STYLE], [
AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
AC_MSG_RESULT([FIONBIO])
;;
- ULTRIX-4.*)
- AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
- AC_MSG_RESULT([FIONBIO])
- ;;
*)
AC_MSG_RESULT([O_NONBLOCK])
;;
@@ -2601,9 +2506,8 @@ AC_DEFUN([SC_BLOCKING_STYLE], [
AC_DEFUN([SC_TIME_HANDLER], [
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME
- AC_STRUCT_TIMEZONE
- AC_CHECK_FUNCS(gmtime_r localtime_r)
+ AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
@@ -2693,7 +2597,8 @@ AC_DEFUN([SC_BUGGY_STRTOD], [
}], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
tcl_cv_strtod_buggy=buggy)])
if test "$tcl_cv_strtod_buggy" = buggy; then
- LIBOBJS="$LIBOBJS fixstrtod.o"
+ AC_LIBOBJ([fixstrtod])
+ USE_COMPAT=1
AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
fi
fi
@@ -2707,19 +2612,13 @@ AC_DEFUN([SC_BUGGY_STRTOD], [
# -lnsl) are dealt with here.
#
# Arguments:
-# Requires the following vars to be set in the Makefile:
-# DL_LIBS
-# LIBS
-# MATH_LIBS
+# None.
#
# Results:
#
-# Subst's the following var:
-# TCL_LIBS
-# MATH_LIBS
-#
# Might append to the following vars:
# LIBS
+# MATH_LIBS
#
# Might define the following vars:
# HAVE_NET_ERRNO_H
@@ -2777,13 +2676,6 @@ AC_DEFUN([SC_TCL_LINK_LIBS], [
fi
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
[LIBS="$LIBS -lnsl"])])
-
- # Don't perform the eval of the libraries here because DL_LIBS
- # won't be set until we call SC_CONFIG_CFLAGS
-
- TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
- AC_SUBST(TCL_LIBS)
- AC_SUBST(MATH_LIBS)
])
#--------------------------------------------------------------------
@@ -2910,6 +2802,72 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
])
#--------------------------------------------------------------------
+# SC_TCL_CFG_ENCODING TIP #59
+#
+# Declare the encoding to use for embedded configuration information.
+#
+# Arguments:
+# None.
+#
+# Results:
+# Might append to the following vars:
+# DEFS (implicit)
+#
+# Will define the following vars:
+# TCL_CFGVAL_ENCODING
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_CFG_ENCODING], [
+ AC_ARG_WITH(encoding,
+ AC_HELP_STRING([--with-encoding],
+ [encoding for configuration values (default: iso8859-1)]),
+ with_tcencoding=${withval})
+
+ if test x"${with_tcencoding}" != x ; then
+ AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
+ [What encoding should be used for embedded configuration info?])
+ else
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
+ [What encoding should be used for embedded configuration info?])
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_TCL_CHECK_BROKEN_FUNC
+#
+# Check for broken function.
+#
+# Arguments:
+# funcName - function to test for
+# advancedTest - the advanced test to run if the function is present
+#
+# Results:
+# Might cause compatability versions of the function to be used.
+# Might affect the following vars:
+# USE_COMPAT (implicit)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
+ AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
+ if test ["$tcl_ok"] = 1; then
+ AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
+ AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
+ [tcl_cv_]$1[_unbroken]=broken,[tcl_cv_]$1[_unbroken]=unknown))
+ if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
+ tcl_ok=1
+ else
+ tcl_ok=0
+ fi
+ fi
+ if test ["$tcl_ok"] = 0; then
+ AC_LIBOBJ($1)
+ USE_COMPAT=1
+ fi
+])
+
+#--------------------------------------------------------------------
# SC_TCL_GETHOSTBYADDR_R
#
# Check if we have MT-safe variant of gethostbyaddr().
@@ -3053,6 +3011,37 @@ AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
])])
#--------------------------------------------------------------------
+# SC_TCL_GETADDRINFO
+#
+# Check if we have 'getaddrinfo'
+#
+# Arguments:
+# None
+#
+# Results:
+# Might define the following vars:
+# HAVE_GETADDRINFO
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETADDRINFO], [AC_CHECK_FUNC(getaddrinfo, [
+ AC_CACHE_CHECK([for working getaddrinfo], tcl_cv_api_getaddrinfo, [
+ AC_TRY_COMPILE([
+ #include <netdb.h>
+ ], [
+ const char *name, *port;
+ struct addrinfo *aiPtr, hints;
+ (void)getaddrinfo(name,port, &hints, &aiPtr);
+ (void)freeaddrinfo(aiPtr);
+ ], tcl_cv_api_getaddrinfo=yes, tcl_cv_getaddrinfo=no)])
+ tcl_ok=$tcl_cv_api_getaddrinfo
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETADDRINFO, 1,
+ [Define to 1 if getaddrinfo is available.])
+ fi
+])])
+
+#--------------------------------------------------------------------
# SC_TCL_GETPWUID_R
#
# Check if we have MT-safe variant of getpwuid() and if yes,
@@ -3292,22 +3281,6 @@ AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
fi
])])
-#--------------------------------------------------------------------
-# SC_CONFIG_COMMANDS_PRE(CMDS)
-#
-# Replacement for autoconf 2.5x AC_COMMANDS_PRE:
-# Commands to run right before config.status is
-# created. Accumulates.
-#
-# Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
-# of configure.in (right before AC_OUTPUT).
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
- define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
-])])
-AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])
# Local Variables:
# mode: autoconf
# End:
diff --git a/unix/tk.spec b/unix/tk.spec
index 94bbfe7..21a4b7d 100644
--- a/unix/tk.spec
+++ b/unix/tk.spec
@@ -1,51 +1,54 @@
# This file is the basis for a binary Tk Linux RPM.
-%define version 8.4.19
-%define directory /usr/local
-
-Summary: Tk graphical toolkit for the Tcl scripting language.
-Name: tk
-Version: %{version}
-Release: 1
-Copyright: BSD
-Group: Development/Languages
-Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz
-URL: http://www.tcl.tk/
-Packager: Carina
-Buildroot: /var/tmp/%{name}%{version}
-Requires: XFree86-libs >= 3.3.3, XFree86-devel >= 3.3.3, tcl = 8.4.19
+%{!?directory:%define directory /usr/local}
+
+Name: tk
+Summary: Tk graphical toolkit for the Tcl scripting language.
+Version: 8.5.11
+Release: 2
+License: BSD
+Group: Development/Languages
+Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz
+URL: http://www.tcl.tk/
+Buildroot: /var/tmp/%{name}%{version}
+Buildrequires: XFree86-devel tcl >= 8.5.0
+Requires: tcl >= 8.5.0
%description
The Tcl (Tool Command Language) provides a powerful platform for
creating integration applications that tie together diverse
applications, protocols, devices, and frameworks. When paired with
the Tk toolkit, Tcl provides the fastest and most powerful way to
-create GUI applications that run on PCs, Unix, and the Macintosh. Tcl
+create GUI applications that run on PCs, Unix, and Mac OS X. Tcl
can also be used for a variety of web-related tasks and for creating
powerful command languages for applications.
%prep
+%setup -q -n %{name}%{version}
%build
-./configure --prefix %{directory} --exec-prefix %{directory}
-make CFLAGS=$RPM_OPT_FLAGS
+cd unix
+CFLAGS="%optflags" ./configure \
+ --prefix=%{directory} \
+ --exec-prefix=%{directory} \
+ --libdir=%{directory}/%{_lib}
+make
%install
-rm -rf $RPM_BUILD_ROOT
-make INSTALL_ROOT=$RPM_BUILD_ROOT install
+cd unix
+make INSTALL_ROOT=%buildroot install
%clean
-rm -rf $RPM_BUILD_ROOT
-
-# to create the tcl files list, comment out tk in the install section above,
-# then run "rpm -bi" then do a find from the build root directory,
-# and remove the files in specific directories which suffice by themselves,
-# then to create the files list for tk, uncomment tk, comment out tcl,
-# then rm -rf $RPM_BUILD_ROOT then rpm --short-circuit -bi then redo a find,
-# and remove the files in specific directories which suffice by themselves.
+rm -rf %buildroot
+
%files -n tk
%defattr(-,root,root)
+%if %{_lib} != lib
+%{directory}/%{_lib}
+%endif
%{directory}/lib
%{directory}/bin
%{directory}/include
-%{directory}/man
+%{directory}/man/man1
+%{directory}/man/man3
+%{directory}/man/mann
diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c
index 006d816..050e226 100644
--- a/unix/tkAppInit.c
+++ b/unix/tkAppInit.c
@@ -1,14 +1,14 @@
-/*
+/*
* tkAppInit.c --
*
- * Provides a default version of the Tcl_AppInit procedure for
- * use in wish and similar Tk-based applications.
+ * Provides a default version of the Tcl_AppInit procedure for use in
+ * wish and similar Tk-based applications.
*
* Copyright (c) 1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tk.h"
@@ -26,8 +26,8 @@ extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
* This is the main program for the application.
*
* Results:
- * None: Tk_Main never returns here, so this procedure never
- * returns either.
+ * None: Tk_Main never returns here, so this procedure never returns
+ * either.
*
* Side effects:
* Whatever the application does.
@@ -36,28 +36,28 @@ extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
*/
int
-main(argc, argv)
- int argc; /* Number of command-line arguments. */
- char **argv; /* Values of command-line arguments. */
+main(
+ int argc, /* Number of command-line arguments. */
+ char **argv) /* Values of command-line arguments. */
{
/*
- * The following #if block allows you to change the AppInit
- * function by using a #define of TCL_LOCAL_APPINIT instead
- * of rewriting this entire file. The #if checks for that
- * #define and uses Tcl_AppInit if it doesn't exist.
+ * The following #if block allows you to change the AppInit function by
+ * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire
+ * file. The #if checks for that #define and uses Tcl_AppInit if it
+ * doesn't exist.
*/
-
+
#ifndef TK_LOCAL_APPINIT
-#define TK_LOCAL_APPINIT Tcl_AppInit
+#define TK_LOCAL_APPINIT Tcl_AppInit
#endif
extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
-
+
/*
* The following #if block allows you to change how Tcl finds the startup
* script, prime the library or encoding paths, fiddle with the argv,
* etc., without needing to rewrite Tk_Main()
*/
-
+
#ifdef TK_LOCAL_MAIN_HOOK
extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
TK_LOCAL_MAIN_HOOK(&argc, &argv);
@@ -72,13 +72,13 @@ main(argc, argv)
*
* Tcl_AppInit --
*
- * This procedure performs application-specific initialization.
- * Most applications, especially those that incorporate additional
- * packages, will have their own version of this procedure.
+ * This procedure performs application-specific initialization. Most
+ * applications, especially those that incorporate additional packages,
+ * will have their own version of this procedure.
*
* Results:
- * Returns a standard Tcl completion code, and leaves an error
- * message in the interp's result if an error occurs.
+ * Returns a standard Tcl completion code, and leaves an error message in
+ * the interp's result if an error occurs.
*
* Side effects:
* Depends on the startup script.
@@ -87,8 +87,8 @@ main(argc, argv)
*/
int
-Tcl_AppInit(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
+Tcl_AppInit(
+ Tcl_Interp *interp) /* Interpreter for application. */
{
if (Tcl_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
@@ -105,10 +105,9 @@ Tcl_AppInit(interp)
(Tcl_PackageInitProc *) NULL);
#endif /* TK_TEST */
-
/*
- * Call the init procedures for included packages. Each call should
- * look like this:
+ * Call the init procedures for included packages. Each call should look
+ * like this:
*
* if (Mod_Init(interp) == TCL_ERROR) {
* return TCL_ERROR;
@@ -118,17 +117,25 @@ Tcl_AppInit(interp)
*/
/*
- * Call Tcl_CreateCommand for application-specific commands, if
- * they weren't already created by the init procedures called above.
+ * Call Tcl_CreateCommand for application-specific commands, if they
+ * weren't already created by the init procedures called above.
*/
/*
- * Specify a user-specific startup file to invoke if the application
- * is run interactively. Typically the startup file is "~/.apprc"
- * where "app" is the name of the application. If this line is deleted
- * then no user-specific startup file will be run under any conditions.
+ * Specify a user-specific startup file to invoke if the application is
+ * run interactively. Typically the startup file is "~/.apprc" where "app"
+ * is the name of the application. If this line is deleted then no user-
+ * -specific startup file will be run under any conditions.
*/
Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in
new file mode 100644
index 0000000..cfa8a32
--- /dev/null
+++ b/unix/tkConfig.h.in
@@ -0,0 +1,256 @@
+/* ../unix/tkConfig.h.in. Generated from configure.ac by autoheader. */
+
+
+ #ifndef _TKCONFIG
+ #define _TKCONFIG
+
+/* Is pthread_attr_get_np() declared in <pthread.h>? */
+#undef ATTRGETNP_NOT_DECLARED
+
+/* Is pthread_getattr_np declared in <pthread.h>? */
+#undef GETATTRNP_NOT_DECLARED
+
+/* Define to 1 if you have the <AvailabilityMacros.h> header file. */
+#undef HAVE_AVAILABILITYMACROS_H
+
+/* Do we have access to Darwin CoreFoundation.framework? */
+#undef HAVE_COREFOUNDATION
+
+/* Do we have the intptr_t type? */
+#undef HAVE_INTPTR_T
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `Xft' library (-lXft). */
+#undef HAVE_LIBXFT
+
+/* Do we have <limits.h>? */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the `lseek64' function. */
+#undef HAVE_LSEEK64
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `open64' function. */
+#undef HAVE_OPEN64
+
+/* Do we want a BSD-like thread-attribute interface? */
+#undef HAVE_PTHREAD_ATTR_GET_NP
+
+/* Define to 1 if you have the `pthread_attr_setstacksize' function. */
+#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
+
+/* Do we want a Linux-like thread-attribute interface? */
+#undef HAVE_PTHREAD_GETATTR_NP
+
+/* Define to 1 if you have the `pthread_get_stacksize_np' function. */
+#undef HAVE_PTHREAD_GET_STACKSIZE_NP
+
+/* Does struct password have a pw_gecos field? */
+#undef HAVE_PW_GECOS
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Is 'struct dirent64' in <sys/types.h>? */
+#undef HAVE_STRUCT_DIRENT64
+
+/* Is 'struct stat64' in <sys/stat.h>? */
+#undef HAVE_STRUCT_STAT64
+
+/* Should we include <sys/select.h>? */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Is off64_t in <sys/types.h>? */
+#undef HAVE_TYPE_OFF64_T
+
+/* Do we have the uintptr_t type? */
+#undef HAVE_UINTPTR_T
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Is weak import available? */
+#undef HAVE_WEAK_IMPORT
+
+/* Have we turned on XFT (antialiased fonts)? */
+#undef HAVE_XFT
+
+/* Is XScreenSaver available? */
+#undef HAVE_XSS
+
+/* Is this a Mac I see before me? */
+#undef MAC_OSX_TCL
+
+/* Are we building TkAqua? */
+#undef MAC_OSX_TK
+
+/* Compiler support for module scope symbols */
+#undef MODULE_SCOPE
+
+/* Is Darwin CoreFoundation unavailable for 64-bit? */
+#undef NO_COREFOUNDATION_64
+
+/* Do we have fd_set? */
+#undef NO_FD_SET
+
+/* Do we have <limits.h>? */
+#undef NO_LIMITS_H
+
+/* Do we have <stdlib.h>? */
+#undef NO_STDLIB_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Is this a static build? */
+#undef STATIC_BUILD
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Is debugging enabled? */
+#undef TCL_CFG_DEBUG
+
+/* Is this a 64-bit build? */
+#undef TCL_CFG_DO64BIT
+
+/* Is this an optimized build? */
+#undef TCL_CFG_OPTIMIZED
+
+/* Is bytecode debugging enabled? */
+#undef TCL_COMPILE_DEBUG
+
+/* Are bytecode statistics enabled? */
+#undef TCL_COMPILE_STATS
+
+/* Is memory debugging enabled? */
+#undef TCL_MEM_DEBUG
+
+/* What is the default extension for shared libraries? */
+#undef TCL_SHLIB_EXT
+
+/* Are we building with threads enabled? */
+#undef TCL_THREADS
+
+/* Are wide integers to be implemented with C 'long's? */
+#undef TCL_WIDE_INT_IS_LONG
+
+/* What type should be used to define wide integers? */
+#undef TCL_WIDE_INT_TYPE
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Is Tk built as a framework? */
+#undef TK_FRAMEWORK
+
+/* Are TkAqua debug messages enabled? */
+#undef TK_MAC_DEBUG
+
+/* Do we want to use the threaded memory allocator? */
+#undef USE_THREAD_ALLOC
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Are Darwin SUSv3 extensions available? */
+#undef _DARWIN_C_SOURCE
+
+/* Add the _ISOC99_SOURCE flag when building */
+#undef _ISOC99_SOURCE
+
+/* Add the _LARGEFILE64_SOURCE flag when building */
+#undef _LARGEFILE64_SOURCE
+
+/* Add the _LARGEFILE_SOURCE64 flag when building */
+#undef _LARGEFILE_SOURCE64
+
+/* # needed in sys/socket.h Should OS/390 do the right thing with sockets? */
+#undef _OE_SOCKETS
+
+/* Do we really want to follow the standard? Yes we do! */
+#undef _POSIX_PTHREAD_SEMANTICS
+
+/* Do we want the reentrant OS API? */
+#undef _REENTRANT
+
+/* Do we want the thread-safe OS API? */
+#undef _THREAD_SAFE
+
+/* Do we want to use the XOPEN network library? */
+#undef _XOPEN_SOURCE
+
+/* Do we want to use the XOPEN network library? */
+#undef _XOPEN_SOURCE_EXTENDED
+
+/* Define to 1 if type `char' is unsigned and you are not using gcc. */
+#ifndef __CHAR_UNSIGNED__
+# undef __CHAR_UNSIGNED__
+#endif
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Signed integer type wide enough to hold a pointer. */
+#undef intptr_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Do we want to use the strtod() in compat? */
+#undef strtod
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Unsigned integer type wide enough to hold a pointer. */
+#undef uintptr_t
+
+
+ /* Undef unused package specific autoheader defines so that we can
+ * include both tclConfig.h and tkConfig.h at the same time: */
+ /* override */ #undef PACKAGE_NAME
+ /* override */ #undef PACKAGE_STRING
+ /* override */ #undef PACKAGE_TARNAME
+ #endif /* _TKCONFIG */
diff --git a/unix/tkConfig.sh.in b/unix/tkConfig.sh.in
index 86cc7f6..1b96f37 100644
--- a/unix/tkConfig.sh.in
+++ b/unix/tkConfig.sh.in
@@ -23,14 +23,16 @@ TK_DEFS='@DEFS@'
# Flag, 1: we built a shared lib, 0 we didn't
TK_SHARED_BUILD=@TK_SHARED_BUILD@
-# This indicates if Tk was build with debugging symbols
-TK_DBGX=@TK_DBGX@
+
+# TK_DBGX used to be used to distinguish debug vs. non-debug builds.
+# This was a righteous pain so the core doesn't do that any more.
+TK_DBGX=
# The name of the Tk library (may be either a .a file or a shared library):
TK_LIB_FILE='@TK_LIB_FILE@'
# Additional libraries to use when linking Tk.
-TK_LIBS='@XLIBSW@ @DL_LIBS@ @LIBS@ @MATH_LIBS@'
+TK_LIBS='@XLIBSW@ @XFT_LIBS@ @LIBS@ @TCL_LIBS@'
# Top-level directory in which Tk's platform-independent files are
# installed.
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index 497d06c..3fa7387 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -1,26 +1,29 @@
-/*
+/*
* tkUnix.c --
*
- * This file contains procedures that are UNIX/X-specific, and
- * will probably have to be written differently for Windows or
- * Macintosh platforms.
+ * This file contains procedures that are UNIX/X-specific, and will
+ * probably have to be written differently for Windows or Macintosh
+ * platforms.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <tkInt.h>
+#include "tkInt.h"
+#ifdef HAVE_XSS
+#include <X11/extensions/scrnsaver.h>
+#endif
/*
*----------------------------------------------------------------------
*
* TkGetServerInfo --
*
- * Given a window, this procedure returns information about
- * the window server for that window. This procedure provides
- * the guts of the "winfo server" command.
+ * Given a window, this procedure returns information about the window
+ * server for that window. This procedure provides the guts of the "winfo
+ * server" command.
*
* Results:
* None.
@@ -32,11 +35,11 @@
*/
void
-TkGetServerInfo(interp, tkwin)
- Tcl_Interp *interp; /* The server information is returned in
- * this interpreter's result. */
- Tk_Window tkwin; /* Token for window; this selects a
- * particular display and server. */
+TkGetServerInfo(
+ Tcl_Interp *interp, /* The server information is returned in this
+ * interpreter's result. */
+ Tk_Window tkwin) /* Token for window; this selects a particular
+ * display and server. */
{
char buffer[8 + TCL_INTEGER_SPACE * 2];
char buffer2[TCL_INTEGER_SPACE];
@@ -57,8 +60,8 @@ TkGetServerInfo(interp, tkwin)
* initialization.
*
* Results:
- * Returns the argument or a string that should not be freed by
- * the caller.
+ * Returns the argument or a string that should not be freed by the
+ * caller.
*
* Side effects:
* None.
@@ -67,9 +70,10 @@ TkGetServerInfo(interp, tkwin)
*/
CONST char *
-TkGetDefaultScreenName(interp, screenName)
- Tcl_Interp *interp; /* Interp used to find environment variables. */
- CONST char *screenName; /* Screen name from command line, or NULL. */
+TkGetDefaultScreenName(
+ Tcl_Interp *interp, /* Interp used to find environment
+ * variables. */
+ CONST char *screenName) /* Screen name from command line, or NULL. */
{
if ((screenName == NULL) || (screenName[0] == '\0')) {
screenName = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY);
@@ -94,13 +98,168 @@ TkGetDefaultScreenName(interp, screenName)
*/
void
-Tk_UpdatePointer(tkwin, x, y, state)
- Tk_Window tkwin; /* Window to which pointer event
- * is reported. May be NULL. */
- int x, y; /* Pointer location in root coords. */
- int state; /* Modifier state mask. */
+Tk_UpdatePointer(
+ Tk_Window tkwin, /* Window to which pointer event is reported.
+ * May be NULL. */
+ int x, int y, /* Pointer location in root coords. */
+ int state) /* Modifier state mask. */
{
/*
* This function intentionally left blank
*/
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpBuildRegionFromAlphaData --
+ *
+ * Set up a rectangle of the given region based on the supplied alpha
+ * data.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The region is updated, with extra pixels added to it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpBuildRegionFromAlphaData(
+ TkRegion region, /* Region to be updated. */
+ unsigned x, unsigned y, /* Where in region to update. */
+ unsigned width, unsigned height,
+ /* Size of rectangle to update. */
+ unsigned char *dataPtr, /* Data to read from. */
+ unsigned pixelStride, /* Num bytes from one piece of alpha data to
+ * the next in the line. */
+ unsigned lineStride) /* Num bytes from one line of alpha data to
+ * the next line. */
+{
+ unsigned char *lineDataPtr;
+ unsigned int x1, y1, end;
+ XRectangle rect;
+
+ for (y1 = 0; y1 < height; y1++) {
+ lineDataPtr = dataPtr;
+ for (x1 = 0; x1 < width; x1 = end) {
+ /*
+ * Search for first non-transparent pixel.
+ */
+
+ while ((x1 < width) && !*lineDataPtr) {
+ x1++;
+ lineDataPtr += pixelStride;
+ }
+ end = x1;
+
+ /*
+ * Search for first transparent pixel.
+ */
+
+ while ((end < width) && *lineDataPtr) {
+ end++;
+ lineDataPtr += pixelStride;
+ }
+ if (end > x1) {
+ rect.x = x + x1;
+ rect.y = y + y1;
+ rect.width = end - x1;
+ rect.height = 1;
+ TkUnionRectWithRegion(&rect, region, region);
+ }
+ }
+ dataPtr += lineStride;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetUserInactiveTime --
+ *
+ * Return the number of milliseconds the user was inactive.
+ *
+ * Results:
+ * The number of milliseconds since the user's latest interaction with
+ * the system on the given display, or -1 if the XScreenSaver extension
+ * is not supported by the client libraries or the X server
+ * implementation.
+ *
+ * Side effects:
+ * None.
+ *----------------------------------------------------------------------
+ */
+
+long
+Tk_GetUserInactiveTime(
+ Display *dpy) /* The display for which to query the inactive
+ * time. */
+{
+ long inactiveTime = -1;
+#ifdef HAVE_XSS
+ int eventBase, errorBase, major, minor;
+
+ /*
+ * Calling XScreenSaverQueryVersion seems to be needed to prevent a crash
+ * on some buggy versions of XFree86.
+ */
+
+ if (
+#ifdef __APPLE__
+ XScreenSaverQueryInfo != NULL && /* Support for weak-linked libXss. */
+#endif
+ XScreenSaverQueryExtension(dpy, &eventBase, &errorBase) &&
+ XScreenSaverQueryVersion(dpy, &major, &minor)) {
+
+ XScreenSaverInfo *info = XScreenSaverAllocInfo();
+
+ if (info == NULL) {
+ /*
+ * We are out of memory.
+ */
+
+ Tcl_Panic("Out of memory: XScreenSaverAllocInfo failed in Tk_GetUserInactiveTime");
+ }
+ if (XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info)) {
+ inactiveTime = info->idle;
+ }
+ XFree(info);
+ }
+#endif /* HAVE_XSS */
+ return inactiveTime;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_ResetUserInactiveTime --
+ *
+ * Reset the user inactivity timer
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * The user inactivity timer of the underlaying windowing system is reset
+ * to zero.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_ResetUserInactiveTime(
+ Display *dpy)
+{
+ XResetScreenSaver(dpy);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index 0c460dc..417866b 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -1,24 +1,25 @@
-/*
+/*
* tkUnix3d.c --
*
- * This file contains the platform specific routines for
- * drawing 3d borders in the Motif style.
+ * This file contains the platform specific routines for drawing 3d
+ * borders in the Motif style.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <tk3d.h>
+#include "tkInt.h"
+#include "tk3d.h"
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif
/*
- * This structure is used to keep track of the extra colors used
- * by Unix 3d borders.
+ * This structure is used to keep track of the extra colors used by Unix 3D
+ * borders.
*/
typedef struct {
@@ -43,21 +44,20 @@ typedef struct {
*/
TkBorder *
-TkpGetBorder()
+TkpGetBorder(void)
{
UnixBorder *borderPtr = (UnixBorder *) ckalloc(sizeof(UnixBorder));
borderPtr->solidGC = None;
return (TkBorder *) borderPtr;
}
-
/*
*----------------------------------------------------------------------
*
* TkpFreeBorder --
*
- * This function frees any colors allocated by the platform
- * specific part of this module.
+ * This function frees any colors allocated by the platform specific part
+ * of this module.
*
* Results:
* None.
@@ -69,8 +69,8 @@ TkpGetBorder()
*/
void
-TkpFreeBorder(borderPtr)
- TkBorder *borderPtr;
+TkpFreeBorder(
+ TkBorder *borderPtr)
{
UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr;
Display *display = DisplayOfScreen(borderPtr->screen);
@@ -84,18 +84,17 @@ TkpFreeBorder(borderPtr)
*
* Tk_3DVerticalBevel --
*
- * This procedure draws a vertical bevel along one side of
- * an object. The bevel is always rectangular in shape:
+ * This procedure draws a vertical bevel along one side of an object. The
+ * bevel is always rectangular in shape:
* |||
* |||
* |||
* |||
* |||
* |||
- * An appropriate shadow color is chosen for the bevel based
- * on the leftBevel and relief arguments. Normally this
- * procedure is called first, then Tk_3DHorizontalBevel is
- * called next to draw neat corners.
+ * An appropriate shadow color is chosen for the bevel based on the
+ * leftBevel and relief arguments. Normally this procedure is called
+ * first, then Tk_3DHorizontalBevel is called next to draw neat corners.
*
* Results:
* None.
@@ -107,19 +106,18 @@ TkpFreeBorder(borderPtr)
*/
void
-Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
- leftBevel, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Area of vertical bevel. */
- int leftBevel; /* Non-zero means this bevel forms the
- * left side of the object; 0 means it
- * forms the right side. */
- int relief; /* Kind of bevel to draw. For example,
- * TK_RELIEF_RAISED means interior of
- * object should appear higher than
- * exterior. */
+Tk_3DVerticalBevel(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Area of vertical bevel. */
+ int leftBevel, /* Non-zero means this bevel forms the left
+ * side of the object; 0 means it forms the
+ * right side. */
+ int relief) /* Kind of bevel to draw. For example,
+ * TK_RELIEF_RAISED means interior of object
+ * should appear higher than exterior. */
{
TkBorder *borderPtr = (TkBorder *) border;
GC left, right;
@@ -130,11 +128,11 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
}
if (relief == TK_RELIEF_RAISED) {
- XFillRectangle(display, drawable,
+ XFillRectangle(display, drawable,
(leftBevel) ? borderPtr->lightGC : borderPtr->darkGC,
x, y, (unsigned) width, (unsigned) height);
} else if (relief == TK_RELIEF_SUNKEN) {
- XFillRectangle(display, drawable,
+ XFillRectangle(display, drawable,
(leftBevel) ? borderPtr->darkGC : borderPtr->lightGC,
x, y, (unsigned) width, (unsigned) height);
} else if (relief == TK_RELIEF_RIDGE) {
@@ -142,7 +140,7 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
left = borderPtr->lightGC;
right = borderPtr->darkGC;
- ridgeGroove:
+ ridgeGroove:
half = width/2;
if (!leftBevel && (width & 1)) {
half++;
@@ -176,9 +174,9 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
*
* Tk_3DHorizontalBevel --
*
- * This procedure draws a horizontal bevel along one side of
- * an object. The bevel has mitered corners (depending on
- * leftIn and rightIn arguments).
+ * This procedure draws a horizontal bevel along one side of an object.
+ * The bevel has mitered corners (depending on leftIn and rightIn
+ * arguments).
*
* Results:
* None.
@@ -190,30 +188,28 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
*/
void
-Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
- leftIn, rightIn, topBevel, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Bounding box of area of bevel. Height
- * gives width of border. */
- int leftIn, rightIn; /* Describes whether the left and right
- * edges of the bevel angle in or out as
- * they go down. For example, if "leftIn"
- * is true, the left side of the bevel
- * looks like this:
+Tk_3DHorizontalBevel(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Bounding box of area of bevel. Height gives
+ * width of border. */
+ int leftIn, int rightIn, /* Describes whether the left and right edges
+ * of the bevel angle in or out as they go
+ * down. For example, if "leftIn" is true, the
+ * left side of the bevel looks like this:
* ___________
* __________
* _________
* ________
*/
- int topBevel; /* Non-zero means this bevel forms the
- * top side of the object; 0 means it
- * forms the bottom side. */
- int relief; /* Kind of bevel to draw. For example,
- * TK_RELIEF_RAISED means interior of
- * object should appear higher than
- * exterior. */
+ int topBevel, /* Non-zero means this bevel forms the top
+ * side of the object; 0 means it forms the
+ * bottom side. */
+ int relief) /* Kind of bevel to draw. For example,
+ * TK_RELIEF_RAISED means interior of object
+ * should appear higher than exterior. */
{
TkBorder *borderPtr = (TkBorder *) border;
Display *display = Tk_Display(tkwin);
@@ -229,41 +225,38 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
}
/*
- * Compute a GC for the top half of the bevel and a GC for the
- * bottom half (they're the same in many cases).
+ * Compute a GC for the top half of the bevel and a GC for the bottom half
+ * (they're the same in many cases).
*/
switch (relief) {
- case TK_RELIEF_FLAT:
- topGC = bottomGC = borderPtr->bgGC;
- break;
- case TK_RELIEF_GROOVE:
- topGC = borderPtr->darkGC;
- bottomGC = borderPtr->lightGC;
- break;
- case TK_RELIEF_RAISED:
- topGC = bottomGC =
- (topBevel) ? borderPtr->lightGC : borderPtr->darkGC;
- break;
- case TK_RELIEF_RIDGE:
- topGC = borderPtr->lightGC;
- bottomGC = borderPtr->darkGC;
- break;
- case TK_RELIEF_SOLID:
- if (unixBorderPtr->solidGC == None) {
- XGCValues gcValues;
-
- gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
- unixBorderPtr->solidGC = Tk_GetGC(tkwin, GCForeground,
- &gcValues);
- }
- XFillRectangle(display, drawable, unixBorderPtr->solidGC, x, y,
+ case TK_RELIEF_FLAT:
+ topGC = bottomGC = borderPtr->bgGC;
+ break;
+ case TK_RELIEF_GROOVE:
+ topGC = borderPtr->darkGC;
+ bottomGC = borderPtr->lightGC;
+ break;
+ case TK_RELIEF_RAISED:
+ topGC = bottomGC = (topBevel? borderPtr->lightGC : borderPtr->darkGC);
+ break;
+ case TK_RELIEF_RIDGE:
+ topGC = borderPtr->lightGC;
+ bottomGC = borderPtr->darkGC;
+ break;
+ case TK_RELIEF_SOLID:
+ if (unixBorderPtr->solidGC == None) {
+ XGCValues gcValues;
+
+ gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
+ unixBorderPtr->solidGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
+ }
+ XFillRectangle(display, drawable, unixBorderPtr->solidGC, x, y,
(unsigned) width, (unsigned) height);
- return;
- case TK_RELIEF_SUNKEN:
- topGC = bottomGC =
- (topBevel) ? borderPtr->darkGC : borderPtr->lightGC;
- break;
+ return;
+ case TK_RELIEF_SUNKEN:
+ topGC = bottomGC = (topBevel? borderPtr->darkGC : borderPtr->lightGC);
+ break;
}
/*
@@ -292,24 +285,26 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
for ( ; y < bottom; y++) {
/*
- * X Dimensions are 16-bit, so avoid wraparound or display errors
- * by limiting these here.
+ * X Dimensions are 16-bit, so avoid wraparound or display errors by
+ * limiting these here.
*/
- if (x1 < -32767)
+
+ if (x1 < -32767) {
x1 = -32767;
- if (x2 > 32767)
+ }
+ if (x2 > 32767) {
x2 = 32767;
+ }
/*
* In some weird cases (such as large border widths for skinny
- * rectangles) x1 can be >= x2. Don't draw the lines
- * in these cases.
+ * rectangles) x1 can be >= x2. Don't draw the lines in these cases.
*/
if (x1 < x2) {
XFillRectangle(display, drawable,
- (y < halfway) ? topGC : bottomGC, x1, y,
- (unsigned) (x2-x1), (unsigned) 1);
+ (y < halfway) ? topGC : bottomGC, x1, y,
+ (unsigned) (x2-x1), (unsigned) 1);
}
x1 += x1Delta;
x2 += x2Delta;
@@ -321,27 +316,26 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
*
* TkpGetShadows --
*
- * This procedure computes the shadow colors for a 3-D border
- * and fills in the corresponding fields of the Border structure.
- * It's called lazily, so that the colors aren't allocated until
- * something is actually drawn with them. That way, if a border
- * is only used for flat backgrounds the shadow colors will
- * never be allocated.
+ * This procedure computes the shadow colors for a 3-D border and fills
+ * in the corresponding fields of the Border structure. It's called
+ * lazily, so that the colors aren't allocated until something is
+ * actually drawn with them. That way, if a border is only used for flat
+ * backgrounds the shadow colors will never be allocated.
*
* Results:
* None.
*
* Side effects:
- * The lightGC and darkGC fields in borderPtr get filled in,
- * if they weren't already.
+ * The lightGC and darkGC fields in borderPtr get filled in, if they
+ * weren't already.
*
*----------------------------------------------------------------------
*/
void
-TkpGetShadows(borderPtr, tkwin)
- TkBorder *borderPtr; /* Information about border. */
- Tk_Window tkwin; /* Window where border will be used for
+TkpGetShadows(
+ TkBorder *borderPtr, /* Information about border. */
+ Tk_Window tkwin) /* Window where border will be used for
* drawing. */
{
XColor lightColor, darkColor;
@@ -355,33 +349,31 @@ TkpGetShadows(borderPtr, tkwin)
stressed = TkpCmapStressed(tkwin, borderPtr->colormap);
/*
- * First, handle the case of a color display with lots of colors.
- * The shadow colors get computed using whichever formula results
- * in the greatest change in color:
- * 1. Lighter shadow is half-way to white, darker shadow is half
- * way to dark.
- * 2. Lighter shadow is 40% brighter than background, darker shadow
- * is 40% darker than background.
+ * First, handle the case of a color display with lots of colors. The
+ * shadow colors get computed using whichever formula results in the
+ * greatest change in color:
+ * 1. Lighter shadow is half-way to white, darker shadow is half way to
+ * dark.
+ * 2. Lighter shadow is 40% brighter than background, darker shadow is 40%
+ * darker than background.
*/
if (!stressed && (Tk_Depth(tkwin) >= 6)) {
/*
- * This is a color display with lots of colors. For the dark
- * shadow, cut 40% from each of the background color components.
- * But if the background is already very dark, make the
- * dark color a little lighter than the background by increasing
- * each color component 1/4th of the way to MAX_INTENSITY.
+ * This is a color display with lots of colors. For the dark shadow,
+ * cut 40% from each of the background color components. But if the
+ * background is already very dark, make the dark color a little
+ * lighter than the background by increasing each color component
+ * 1/4th of the way to MAX_INTENSITY.
*
- * For the light shadow, boost each component by 40% or half-way
- * to white, whichever is greater (the first approach works
- * better for unsaturated colors, the second for saturated ones).
- * But if the background is already very bright, instead choose a
- * slightly darker color for the light shadow by reducing each
- * color component by 10%.
+ * For the light shadow, boost each component by 40% or half-way to
+ * white, whichever is greater (the first approach works better for
+ * unsaturated colors, the second for saturated ones). But if the
+ * background is already very bright, instead choose a slightly darker
+ * color for the light shadow by reducing each color component by 10%.
*
- * Compute the colors using integers, not using lightColor.red
- * etc.: these are shorts and may have problems with integer
- * overflow.
+ * Compute the colors using integers, not using lightColor.red etc.:
+ * these are shorts and may have problems with integer overflow.
*/
/*
@@ -438,7 +430,7 @@ TkpGetShadows(borderPtr, tkwin)
tmp2 = (MAX_INTENSITY + b)/2;
lightColor.blue = (tmp1 > tmp2) ? tmp1 : tmp2;
}
-
+
/*
* Allocate the light shadow color and its GC
*/
@@ -453,15 +445,15 @@ TkpGetShadows(borderPtr, tkwin)
borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin,
Tk_GetUid("gray50"));
if (borderPtr->shadow == None) {
- panic("TkpGetShadows couldn't allocate bitmap for border");
+ Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border");
}
}
if (borderPtr->visual->map_entries > 2) {
/*
- * This isn't a monochrome display, but the colormap either
- * ran out of entries or didn't have very many to begin with.
- * Generate the light shadows with a white stipple and the
- * dark shadows with a black stipple.
+ * This isn't a monochrome display, but the colormap either ran out of
+ * entries or didn't have very many to begin with. Generate the light
+ * shadows with a white stipple and the dark shadows with a black
+ * stipple.
*/
gcValues.foreground = borderPtr->bgColorPtr->pixel;
@@ -478,8 +470,8 @@ TkpGetShadows(borderPtr, tkwin)
/*
* This is just a measly monochrome display, hardly even worth its
- * existence on this earth. Make one shadow a 50% stipple and the
- * other the opposite of the background.
+ * existence on this earth. Make one shadow a 50% stipple and the other
+ * the opposite of the background.
*/
gcValues.foreground = WhitePixelOfScreen(borderPtr->screen);
@@ -497,3 +489,11 @@ TkpGetShadows(borderPtr, tkwin)
borderPtr->lightGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index d14f30d..373f2e3 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -1,16 +1,27 @@
-/*
+/*
* tkUnixButton.c --
*
- * This file implements the Unix specific portion of the button
- * widgets.
+ * This file implements the Unix specific portion of the button widgets.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkButton.h"
+#include "tk3d.h"
+
+/*
+ * Shared with menu widget.
+ */
+
+MODULE_SCOPE void TkpDrawCheckIndicator(Tk_Window tkwin,
+ Display *display, Drawable d, int x, int y,
+ Tk_3DBorder bgBorder, XColor *indicatorColor,
+ XColor *selectColor, XColor *disColor, int on,
+ int disabled, int mode);
/*
* Declaration of Unix specific button structure.
@@ -21,13 +32,279 @@ typedef struct UnixButton {
} UnixButton;
/*
- * The class procedure table for the button widgets.
+ * The class function table for the button widgets.
*/
Tk_ClassProcs tkpButtonProcs = {
sizeof(Tk_ClassProcs), /* size */
TkButtonWorldChanged, /* worldChangedProc */
};
+
+/*
+ * The button image.
+ * The header info here is ignored, it's the image that's important. The
+ * colors will be applied as follows:
+ * A = Background
+ * B = Background
+ * C = 3D light
+ * D = selectColor
+ * E = 3D dark
+ * F = Background
+ * G = Indicator Color
+ * H = disabled Indicator Color
+ */
+
+/* XPM */
+static char *button_images[] = {
+ /* width height ncolors chars_per_pixel */
+ "52 26 7 1",
+ /* colors */
+ "A c #808000000000",
+ "B c #000080800000",
+ "C c #808080800000",
+ "D c #000000008080",
+ "E c #808000008080",
+ "F c #000080808080",
+ "G c #000000000000",
+ "H c #000080800000",
+ /* pixels */
+ "AAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAAB",
+ "AEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECB",
+ "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB",
+ "AEDDDDDDDDDCBAEDDDDDDDGDCBAEFFFFFFFFFCBAEFFFFFFFHFCB",
+ "AEDDDDDDDDDCBAEDDDDDDGGDCBAEFFFFFFFFFCBAEFFFFFFHHFCB",
+ "AEDDDDDDDDDCBAEDGDDDGGGDCBAEFFFFFFFFFCBAEFHFFFHHHFCB",
+ "AEDDDDDDDDDCBAEDGGDGGGDDCBAEFFFFFFFFFCBAEFHHFHHHFFCB",
+ "AEDDDDDDDDDCBAEDGGGGGDDDCBAEFFFFFFFFFCBAEFHHHHHFFFCB",
+ "AEDDDDDDDDDCBAEDDGGGDDDDCBAEFFFFFFFFFCBAEFFHHHFFFFCB",
+ "AEDDDDDDDDDCBAEDDDGDDDDDCBAEFFFFFFFFFCBAEFFFHFFFFFCB",
+ "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB",
+ "ACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCB",
+ "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
+ "FFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFF",
+ "FFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFF",
+ "FAEEDDDDEEBFFFAEEDDDDEEBFFFAEEFFFFEEBFFFAEEFFFFEEBFF",
+ "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF",
+ "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF",
+ "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF",
+ "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF",
+ "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF",
+ "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF",
+ "FACCDDDDCCBFFFACCDDDDCCBFFFACCFFFFCCBFFFACCFFFFCCBFF",
+ "FFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFF",
+ "FFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFF",
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
+};
+
+/*
+ * Sizes and offsets into above XPM file.
+ */
+
+#define CHECK_BUTTON_DIM 13
+#define CHECK_MENU_DIM 9
+#define CHECK_START 9
+#define CHECK_ON_OFFSET 13
+#define CHECK_OFF_OFFSET 0
+#define CHECK_DISON_OFFSET 39
+#define CHECK_DISOFF_OFFSET 26
+#define RADIO_BUTTON_DIM 12
+#define RADIO_MENU_DIM 6
+#define RADIO_WIDTH 13
+#define RADIO_START 22
+#define RADIO_ON_OFFSET 13
+#define RADIO_OFF_OFFSET 0
+#define RADIO_DISON_OFFSET 39
+#define RADIO_DISOFF_OFFSET 26
+
+/*
+ * Indicator Draw Modes
+ */
+
+#define CHECK_BUTTON 0
+#define CHECK_MENU 1
+#define RADIO_BUTTON 2
+#define RADIO_MENU 3
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawCheckIndicator -
+ *
+ * Draws the checkbox image in the drawable at the (x,y) location, value,
+ * and state given. This routine is use by the button and menu widgets
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * An image is drawn in the drawable at the location given.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawCheckIndicator(
+ Tk_Window tkwin, /* handle for resource alloc */
+ Display *display,
+ Drawable d, /* what to draw on */
+ int x, int y, /* where to draw */
+ Tk_3DBorder bgBorder, /* colors of the border */
+ XColor *indicatorColor, /* color of the indicator */
+ XColor *selectColor, /* color when selected */
+ XColor *disableColor, /* color when disabled */
+ int on, /* are we on? */
+ int disabled, /* are we disabled? */
+ int mode) /* kind of indicator to draw */
+{
+ int ix, iy;
+ int dim;
+ int imgsel, imgstart;
+ TkBorder *bg_brdr = (TkBorder*)bgBorder;
+ XGCValues gcValues;
+ GC copyGC;
+ unsigned long imgColors[8];
+ XImage *img;
+ Pixmap pixmap;
+ int depth;
+
+ /*
+ * Sanity check.
+ */
+
+ if (tkwin == NULL || display == None || d == None || bgBorder == NULL
+ || indicatorColor == NULL) {
+ return;
+ }
+
+ if (disableColor == NULL) {
+ disableColor = bg_brdr->bgColorPtr;
+ }
+
+ if (selectColor == NULL) {
+ selectColor = bg_brdr->bgColorPtr;
+ }
+
+ depth = Tk_Depth(tkwin);
+
+ /*
+ * Compute starting point and dimensions of image inside button_images to
+ * be used.
+ */
+
+ switch (mode) {
+ default:
+ case CHECK_BUTTON:
+ imgsel = on == 2 ? CHECK_DISON_OFFSET :
+ on == 1 ? CHECK_ON_OFFSET : CHECK_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? CHECK_DISOFF_OFFSET : 0;
+ imgstart = CHECK_START;
+ dim = CHECK_BUTTON_DIM;
+ break;
+
+ case CHECK_MENU:
+ imgsel = on == 2 ? CHECK_DISOFF_OFFSET :
+ on == 1 ? CHECK_ON_OFFSET : CHECK_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? CHECK_DISOFF_OFFSET : 0;
+ imgstart = CHECK_START + 2;
+ imgsel += 2;
+ dim = CHECK_MENU_DIM;
+ break;
+
+ case RADIO_BUTTON:
+ imgsel = on == 2 ? RADIO_DISON_OFFSET :
+ on==1 ? RADIO_ON_OFFSET : RADIO_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? RADIO_DISOFF_OFFSET : 0;
+ imgstart = RADIO_START;
+ dim = RADIO_BUTTON_DIM;
+ break;
+
+ case RADIO_MENU:
+ imgsel = on == 2 ? RADIO_DISOFF_OFFSET :
+ on==1 ? RADIO_ON_OFFSET : RADIO_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? RADIO_DISOFF_OFFSET : 0;
+ imgstart = RADIO_START + 3;
+ imgsel += 3;
+ dim = RADIO_MENU_DIM;
+ break;
+ }
+
+ /*
+ * Allocate the drawing areas to use. Note that we use double-buffering
+ * here because not all code paths leading to this function do so.
+ */
+
+ pixmap = Tk_GetPixmap(display, d, dim, dim, depth);
+ if (pixmap == None) {
+ return;
+ }
+
+ x -= dim/2;
+ y -= dim/2;
+
+ img = XGetImage(display, pixmap, 0, 0,
+ (unsigned int)dim, (unsigned int)dim, AllPlanes, ZPixmap);
+ if (img == NULL) {
+ return;
+ }
+
+ /*
+ * Set up the color mapping table.
+ */
+
+ TkpGetShadows(bg_brdr, tkwin);
+
+ imgColors[0 /*A*/] =
+ Tk_GetColorByValue(tkwin, bg_brdr->bgColorPtr)->pixel;
+ imgColors[1 /*B*/] =
+ Tk_GetColorByValue(tkwin, bg_brdr->bgColorPtr)->pixel;
+ imgColors[2 /*C*/] = (bg_brdr->lightColorPtr != NULL) ?
+ Tk_GetColorByValue(tkwin, bg_brdr->lightColorPtr)->pixel :
+ WhitePixelOfScreen(bg_brdr->screen);
+ imgColors[3 /*D*/] =
+ Tk_GetColorByValue(tkwin, selectColor)->pixel;
+ imgColors[4 /*E*/] = (bg_brdr->darkColorPtr != NULL) ?
+ Tk_GetColorByValue(tkwin, bg_brdr->darkColorPtr)->pixel :
+ BlackPixelOfScreen(bg_brdr->screen);
+ imgColors[5 /*F*/] =
+ Tk_GetColorByValue(tkwin, bg_brdr->bgColorPtr)->pixel;
+ imgColors[6 /*G*/] =
+ Tk_GetColorByValue(tkwin, indicatorColor)->pixel;
+ imgColors[7 /*H*/] =
+ Tk_GetColorByValue(tkwin, disableColor)->pixel;
+
+ /*
+ * Create the image, painting it into an XImage one pixel at a time.
+ */
+
+ for (iy=0 ; iy<dim ; iy++) {
+ for (ix=0 ; ix<dim ; ix++) {
+ XPutPixel(img, ix, iy,
+ imgColors[button_images[imgstart+iy][imgsel+ix] - 'A'] );
+ }
+ }
+
+ /*
+ * Copy onto our target drawable surface.
+ */
+
+ memset(&gcValues, 0, sizeof(gcValues));
+ gcValues.background = bg_brdr->bgColorPtr->pixel;
+ gcValues.graphics_exposures = False;
+ copyGC = Tk_GetGC(tkwin, 0, &gcValues);
+
+ XPutImage(display, pixmap, copyGC, img, 0, 0, 0, 0,
+ (unsigned int)dim, (unsigned int)dim);
+ XCopyArea(display, pixmap, d, copyGC, 0, 0,
+ (unsigned int)dim, (unsigned int)dim, x, y);
+
+ /*
+ * Tidy up.
+ */
+
+ Tk_FreeGC(display, copyGC);
+ XDestroyImage(img);
+ Tk_FreePixmap(display, pixmap);
+}
/*
*----------------------------------------------------------------------
@@ -46,10 +323,10 @@ Tk_ClassProcs tkpButtonProcs = {
*/
TkButton *
-TkpCreateButton(tkwin)
- Tk_Window tkwin;
+TkpCreateButton(
+ Tk_Window tkwin)
{
- UnixButton *butPtr = (UnixButton *)ckalloc(sizeof(UnixButton));
+ UnixButton *butPtr = (UnixButton *) ckalloc(sizeof(UnixButton));
return (TkButton *) butPtr;
}
@@ -58,29 +335,29 @@ TkpCreateButton(tkwin)
*
* TkpDisplayButton --
*
- * This procedure is invoked to display a button widget. It is
- * normally invoked as an idle handler.
+ * This function is invoked to display a button widget. It is normally
+ * invoked as an idle handler.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the button in its
- * current mode. The REDRAW_PENDING flag is cleared.
+ * Commands are output to X to display the button in its current mode.
+ * The REDRAW_PENDING flag is cleared.
*
*----------------------------------------------------------------------
*/
void
-TkpDisplayButton(clientData)
- ClientData clientData; /* Information about widget. */
+TkpDisplayButton(
+ ClientData clientData) /* Information about widget. */
{
register TkButton *butPtr = (TkButton *) clientData;
GC gc;
Tk_3DBorder border;
Pixmap pixmap;
- int x = 0; /* Initialization only needed to stop
- * compiler warning. */
+ int x = 0; /* Initialization only needed to stop compiler
+ * warning. */
int y, relief;
Tk_Window tkwin = butPtr->tkwin;
int width, height, fullWidth, fullHeight;
@@ -88,12 +365,12 @@ TkpDisplayButton(clientData)
int haveImage = 0, haveText = 0;
int offset; /* 1 means this is a button widget, so we
* offset the text to make the button appear
- * to move up and down as the relief changes.
- */
+ * to move up and down as the relief
+ * changes. */
int imageWidth, imageHeight;
- int imageXOffset = 0, imageYOffset = 0; /* image information that will
- * be used to restrict disabled
- * pixmap as well */
+ int imageXOffset = 0, imageYOffset = 0;
+ /* image information that will be used to
+ * restrict disabled pixmap as well */
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -110,15 +387,14 @@ TkpDisplayButton(clientData)
} else {
gc = butPtr->normalTextGC;
}
- if ((butPtr->flags & SELECTED) && (butPtr->state != STATE_ACTIVE)
- && (butPtr->selectBorder != NULL) && !butPtr->indicatorOn) {
+ if ((butPtr->flags & SELECTED) && (butPtr->selectBorder != NULL)
+ && !butPtr->indicatorOn) {
border = butPtr->selectBorder;
}
/*
- * Override the relief specified for the button if this is a
- * checkbutton or radiobutton and there's no indicator. The new
- * relief is as follows:
+ * Override the relief specified for the button if this is a checkbutton
+ * or radiobutton and there's no indicator. The new relief is as follows:
* If the button is select --> "sunken"
* If relief==overrelief --> relief
* Otherwise --> overrelief
@@ -132,15 +408,15 @@ TkpDisplayButton(clientData)
* on no sunken
* on yes sunken
*
- * This is accomplished by configuring the checkbutton or radiobutton
- * like this:
+ * This is accomplished by configuring the checkbutton or radiobutton like
+ * this:
*
* -indicatoron 0 -overrelief raised -offrelief flat
*
* Bindings (see library/button.tcl) will copy the -overrelief into
- * -relief on mouseover. Hence, we can tell if we are in mouse-over by
- * comparing relief against overRelief. This is an aweful kludge, but
- * it gives use the desired behavior while keeping the code backwards
+ * -relief on mouseover. Hence, we can tell if we are in mouse-over by
+ * comparing relief against overRelief. This is an aweful kludge, but it
+ * gives use the desired behavior while keeping the code backwards
* compatible.
*/
@@ -156,10 +432,10 @@ TkpDisplayButton(clientData)
offset = (butPtr->type == TYPE_BUTTON) && !Tk_StrictMotif(butPtr->tkwin);
/*
- * In order to avoid screen flashes, this procedure redraws
- * the button in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the button in a
+ * pixmap, then copies the pixmap to the screen in a single operation.
+ * This means that there's no point in time where the on-screen image has
+ * been cleared.
*/
pixmap = Tk_GetPixmap(butPtr->display, Tk_WindowId(tkwin),
@@ -178,11 +454,11 @@ TkpDisplayButton(clientData)
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
haveImage = 1;
}
- imageWidth = width;
+ imageWidth = width;
imageHeight = height;
haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
-
+
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
textXOffset = 0;
textYOffset = 0;
@@ -190,49 +466,56 @@ TkpDisplayButton(clientData)
fullHeight = 0;
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (butPtr->compound == COMPOUND_TOP) {
- textYOffset = height + butPtr->padY;
- } else {
- imageYOffset = butPtr->textHeight + butPtr->padY;
- }
- fullHeight = height + butPtr->textHeight + butPtr->padY;
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- if (butPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + butPtr->padX;
- } else {
- imageXOffset = butPtr->textWidth + butPtr->padX;
- }
- fullWidth = butPtr->textWidth + butPtr->padX + width;
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ if (butPtr->compound == COMPOUND_TOP) {
+ textYOffset = height + butPtr->padY;
+ } else {
+ imageYOffset = butPtr->textHeight + butPtr->padY;
}
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
+ fullHeight = height + butPtr->textHeight + butPtr->padY;
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ if (butPtr->compound == COMPOUND_LEFT) {
+ textXOffset = width + butPtr->padX;
+ } else {
+ imageXOffset = butPtr->textWidth + butPtr->padX;
}
- case COMPOUND_NONE: {break;}
+ fullWidth = butPtr->textWidth + butPtr->padX + width;
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_NONE:
+ break;
}
TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
@@ -255,8 +538,8 @@ TkpDisplayButton(clientData)
if (butPtr->image != NULL) {
/*
- * Do boundary clipping, so that Tk_RedrawImage is passed
- * valid coordinates. [Bug 979239]
+ * Do boundary clipping, so that Tk_RedrawImage is passed valid
+ * coordinates. [Bug 979239]
*/
if (imageXOffset < 0) {
@@ -281,6 +564,9 @@ TkpDisplayButton(clientData)
if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0,
width, height, pixmap, imageXOffset, imageYOffset);
+ } else if ((butPtr->tristateImage != NULL) && (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0,
+ width, height, pixmap, imageXOffset, imageYOffset);
} else {
Tk_RedrawImage(butPtr->image, 0, 0, width,
height, pixmap, imageXOffset, imageYOffset);
@@ -304,7 +590,7 @@ TkpDisplayButton(clientData)
TkComputeAnchor(butPtr->anchor, tkwin, 0, 0,
butPtr->indicatorSpace + width, height, &x, &y);
x += butPtr->indicatorSpace;
-
+
x += offset;
y += offset;
if (relief == TK_RELIEF_RAISED) {
@@ -345,6 +631,10 @@ TkpDisplayButton(clientData)
(butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0, width,
height, pixmap, imageXOffset, imageYOffset);
+ } else if ((butPtr->tristateImage != NULL) &&
+ (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0, width,
+ height, pixmap, imageXOffset, imageYOffset);
} else {
Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap,
imageXOffset, imageYOffset);
@@ -360,9 +650,9 @@ TkpDisplayButton(clientData)
TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
butPtr->indicatorSpace + butPtr->textWidth,
butPtr->textHeight, &x, &y);
-
+
x += butPtr->indicatorSpace;
-
+
x += offset;
y += offset;
if (relief == TK_RELIEF_RAISED) {
@@ -379,104 +669,51 @@ TkpDisplayButton(clientData)
y += butPtr->textHeight/2;
}
}
-
+
/*
- * Draw the indicator for check buttons and radio buttons. At this
- * point x and y refer to the top-left corner of the text or image
- * or bitmap.
+ * Draw the indicator for check buttons and radio buttons. At this point,
+ * x and y refer to the top-left corner of the text or image or bitmap.
*/
if ((butPtr->type == TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
- int dim;
-
- dim = butPtr->indicatorDiameter;
- x -= butPtr->indicatorSpace;
- y -= dim/2;
- if (dim > 2*butPtr->borderWidth) {
- Tk_Draw3DRectangle(tkwin, pixmap, border, x, y, dim, dim,
- butPtr->borderWidth,
- (butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN :
- TK_RELIEF_RAISED);
- x += butPtr->borderWidth;
- y += butPtr->borderWidth;
- dim -= 2*butPtr->borderWidth;
- if (butPtr->flags & SELECTED) {
- GC gc;
- if (butPtr->state != STATE_DISABLED) {
- if (butPtr->selectBorder != NULL) {
- gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder,
- TK_3D_FLAT_GC);
- } else {
- gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder,
- TK_3D_FLAT_GC);
- }
- } else {
- if (butPtr->disabledFg != NULL) {
- gc = butPtr->disabledGC;
- } else {
- gc = butPtr->normalTextGC;
- XSetForeground(butPtr->display, butPtr->disabledGC,
- Tk_3DBorderColor(butPtr->normalBorder)->pixel);
- }
- }
+ if (butPtr->indicatorDiameter > 2*butPtr->borderWidth) {
+ TkBorder *selBorder = (TkBorder *) butPtr->selectBorder;
+ XColor *selColor = NULL;
- XFillRectangle(butPtr->display, pixmap, gc, x, y,
- (unsigned int) dim, (unsigned int) dim);
- } else {
- Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, x, y,
- dim, dim, butPtr->borderWidth, TK_RELIEF_FLAT);
+ if (selBorder != NULL) {
+ selColor = selBorder->bgColorPtr;
}
+ x -= butPtr->indicatorSpace/2;
+ y = Tk_Height(tkwin)/2;
+ TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap, x, y,
+ border, butPtr->normalFg, selColor, butPtr->disabledFg,
+ ((butPtr->flags & SELECTED) ? 1 :
+ (butPtr->flags & TRISTATED) ? 2 : 0),
+ (butPtr->state == STATE_DISABLED), CHECK_BUTTON);
}
} else if ((butPtr->type == TYPE_RADIO_BUTTON) && butPtr->indicatorOn) {
- XPoint points[4];
- int radius;
-
- radius = butPtr->indicatorDiameter/2;
- points[0].x = x - butPtr->indicatorSpace;
- points[0].y = y;
- points[1].x = points[0].x + radius;
- points[1].y = points[0].y + radius;
- points[2].x = points[1].x + radius;
- points[2].y = points[0].y;
- points[3].x = points[1].x;
- points[3].y = points[0].y - radius;
- if (butPtr->flags & SELECTED) {
- GC gc;
+ if (butPtr->indicatorDiameter > 2*butPtr->borderWidth) {
+ TkBorder *selBorder = (TkBorder *) butPtr->selectBorder;
+ XColor *selColor = NULL;
- if (butPtr->state != STATE_DISABLED) {
- if (butPtr->selectBorder != NULL) {
- gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder,
- TK_3D_FLAT_GC);
- } else {
- gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder,
- TK_3D_FLAT_GC);
- }
- } else {
- if (butPtr->disabledFg != NULL) {
- gc = butPtr->disabledGC;
- } else {
- gc = butPtr->normalTextGC;
- XSetForeground(butPtr->display, butPtr->disabledGC,
- Tk_3DBorderColor(butPtr->normalBorder)->pixel);
- }
+ if (selBorder != NULL) {
+ selColor = selBorder->bgColorPtr;
}
-
- XFillPolygon(butPtr->display, pixmap, gc, points, 4, Convex,
- CoordModeOrigin);
- } else {
- Tk_Fill3DPolygon(tkwin, pixmap, butPtr->normalBorder, points,
- 4, butPtr->borderWidth, TK_RELIEF_FLAT);
+ x -= butPtr->indicatorSpace/2;
+ y = Tk_Height(tkwin)/2;
+ TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap, x, y,
+ border, butPtr->normalFg, selColor, butPtr->disabledFg,
+ ((butPtr->flags & SELECTED) ? 1 :
+ (butPtr->flags & TRISTATED) ? 2 : 0),
+ (butPtr->state == STATE_DISABLED), RADIO_BUTTON);
}
- Tk_Draw3DPolygon(tkwin, pixmap, border, points, 4, butPtr->borderWidth,
- (butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN :
- TK_RELIEF_RAISED);
}
/*
* If the button is disabled with a stipple rather than a special
- * foreground color, generate the stippled effect. If the widget
- * is selected and we use a different background color when selected,
- * must temporarily modify the GC so the stippling is the right color.
+ * foreground color, generate the stippled effect. If the widget is
+ * selected and we use a different background color when selected, must
+ * temporarily modify the GC so the stippling is the right color.
*/
if ((butPtr->state == STATE_DISABLED)
@@ -486,10 +723,12 @@ TkpDisplayButton(clientData)
XSetForeground(butPtr->display, butPtr->stippleGC,
Tk_3DBorderColor(butPtr->selectBorder)->pixel);
}
+
/*
- * Stipple the whole button if no disabledFg was specified,
- * otherwise restrict stippling only to displayed image
+ * Stipple the whole button if no disabledFg was specified, otherwise
+ * restrict stippling only to displayed image
*/
+
if (butPtr->disabledFg == NULL) {
XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, 0, 0,
(unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin));
@@ -506,11 +745,11 @@ TkpDisplayButton(clientData)
}
/*
- * Draw the border and traversal highlight last. This way, if the
- * button's contents overflow they'll be covered up by the border.
- * This code is complicated by the possible combinations of focus
- * highlight and default rings. We draw the focus and highlight rings
- * using the highlight border and highlight foreground color.
+ * Draw the border and traversal highlight last. This way, if the button's
+ * contents overflow they'll be covered up by the border. This code is
+ * complicated by the possible combinations of focus highlight and default
+ * rings. We draw the focus and highlight rings using the highlight border
+ * and highlight foreground color.
*/
if (relief != TK_RELIEF_FLAT) {
@@ -519,10 +758,10 @@ TkpDisplayButton(clientData)
if (butPtr->defaultState == DEFAULT_ACTIVE) {
/*
* Draw the default ring with 2 pixels of space between the
- * default ring and the button and the default ring and the
- * focus ring. Note that we need to explicitly draw the space
- * in the highlightBorder color to ensure that we overwrite any
- * overflow text and/or a different button background color.
+ * default ring and the button and the default ring and the focus
+ * ring. Note that we need to explicitly draw the space in the
+ * highlightBorder color to ensure that we overwrite any overflow
+ * text and/or a different button background color.
*/
Tk_Draw3DRectangle(tkwin, pixmap, butPtr->highlightBorder, inset,
@@ -581,8 +820,8 @@ TkpDisplayButton(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(butPtr->display, pixmap, Tk_WindowId(tkwin),
@@ -596,9 +835,9 @@ TkpDisplayButton(clientData)
*
* TkpComputeButtonGeometry --
*
- * After changes in a button's text or bitmap, this procedure
- * recomputes the button's geometry and passes this information
- * along to the geometry manager for the window.
+ * After changes in a button's text or bitmap, this function recomputes
+ * the button's geometry and passes this information along to the
+ * geometry manager for the window.
*
* Results:
* None.
@@ -610,8 +849,8 @@ TkpDisplayButton(clientData)
*/
void
-TkpComputeButtonGeometry(butPtr)
- register TkButton *butPtr; /* Button whose geometry may have changed. */
+TkpComputeButtonGeometry(
+ register TkButton *butPtr) /* Button whose geometry may have changed. */
{
int width, height, avgWidth, txtWidth, txtHeight;
int haveImage = 0, haveText = 0;
@@ -633,7 +872,7 @@ TkpComputeButtonGeometry(butPtr)
txtWidth = 0;
txtHeight = 0;
avgWidth = 0;
-
+
if (butPtr->image != NULL) {
Tk_SizeOfImage(butPtr->image, &width, &height);
haveImage = 1;
@@ -641,51 +880,58 @@ TkpComputeButtonGeometry(butPtr)
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
haveImage = 1;
}
-
+
if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) {
Tk_FreeTextLayout(butPtr->textLayout);
-
+
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
-
+
txtWidth = butPtr->textWidth;
txtHeight = butPtr->textHeight;
avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1);
Tk_GetFontMetrics(butPtr->tkfont, &fm);
haveText = (txtWidth != 0 && txtHeight != 0);
}
-
+
/*
- * If the button is compound (ie, it shows both an image and text),
- * the new geometry is a combination of the image and text geometry.
- * We only honor the compound bit if the button has both text and an
- * image, because otherwise it is not really a compound button.
+ * If the button is compound (i.e., it shows both an image and text), the
+ * new geometry is a combination of the image and text geometry. We only
+ * honor the compound bit if the button has both text and an image,
+ * because otherwise it is not really a compound button.
*/
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- height += txtHeight + butPtr->padY;
- width = (width > txtWidth ? width : txtWidth);
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- width += txtWidth + butPtr->padX;
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- width = (width > txtWidth ? width : txtWidth);
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_NONE: {break;}
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ height += txtHeight + butPtr->padY;
+ width = (width > txtWidth ? width : txtWidth);
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ width += txtWidth + butPtr->padX;
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ width = (width > txtWidth ? width : txtWidth);
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_NONE:
+ break;
}
if (butPtr->width > 0) {
width = butPtr->width;
@@ -705,7 +951,6 @@ TkpComputeButtonGeometry(butPtr)
width += 2*butPtr->padX;
height += 2*butPtr->padY;
-
} else {
if (haveImage) {
if (butPtr->width > 0) {
@@ -714,7 +959,7 @@ TkpComputeButtonGeometry(butPtr)
if (butPtr->height > 0) {
height = butPtr->height;
}
-
+
if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
butPtr->indicatorSpace = height;
if (butPtr->type == TYPE_CHECK_BUTTON) {
@@ -726,7 +971,7 @@ TkpComputeButtonGeometry(butPtr)
} else {
width = txtWidth;
height = txtHeight;
-
+
if (butPtr->width > 0) {
width = butPtr->width * avgWidth;
}
@@ -747,8 +992,8 @@ TkpComputeButtonGeometry(butPtr)
/*
* When issuing the geometry request, add extra space for the indicator,
* if any, and for the border and padding, plus two extra pixels so the
- * display can be offset by 1 pixel in either direction for the raised
- * or lowered effect.
+ * display can be offset by 1 pixel in either direction for the raised or
+ * lowered effect.
*/
if ((butPtr->image == NULL) && (butPtr->bitmap == None)) {
@@ -763,3 +1008,11 @@ TkpComputeButtonGeometry(butPtr)
+ 2*butPtr->inset), (int) (height + 2*butPtr->inset));
Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index d001be5..e9fdf11 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -1,52 +1,52 @@
-/*
+/*
* tkUnixColor.c --
*
- * This file contains the platform specific color routines
- * needed for X support.
+ * This file contains the platform specific color routines needed for X
+ * support.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <tkColor.h>
+#include "tkInt.h"
+#include "tkColor.h"
/*
- * If a colormap fills up, attempts to allocate new colors from that
- * colormap will fail. When that happens, we'll just choose the
- * closest color from those that are available in the colormap.
- * One of the following structures will be created for each "stressed"
- * colormap to keep track of the colors that are available in the
- * colormap (otherwise we would have to re-query from the server on
- * each allocation, which would be very slow). These entries are
- * flushed after a few seconds, since other clients may release or
+ * If a colormap fills up, attempts to allocate new colors from that colormap
+ * will fail. When that happens, we'll just choose the closest color from
+ * those that are available in the colormap. One of the following structures
+ * will be created for each "stressed" colormap to keep track of the colors
+ * that are available in the colormap (otherwise we would have to re-query
+ * from the server on each allocation, which would be very slow). These
+ * entries are flushed after a few seconds, since other clients may release or
* reallocate colors over time.
*/
struct TkStressedCmap {
- Colormap colormap; /* X's token for the colormap. */
- int numColors; /* Number of entries currently active
- * at *colorPtr. */
- XColor *colorPtr; /* Pointer to malloc'ed array of all
- * colors that seem to be available in
- * the colormap. Some may not actually
- * be available, e.g. because they are
- * read-write for another client; when
- * we find this out, we remove them
- * from the array. */
- struct TkStressedCmap *nextPtr; /* Next in list of all stressed
- * colormaps for the display. */
+ Colormap colormap; /* X's token for the colormap. */
+ int numColors; /* Number of entries currently active at
+ * *colorPtr. */
+ XColor *colorPtr; /* Pointer to malloc'ed array of all colors
+ * that seem to be available in the colormap.
+ * Some may not actually be available, e.g.
+ * because they are read-write for another
+ * client; when we find this out, we remove
+ * them from the array. */
+ struct TkStressedCmap *nextPtr;
+ /* Next in list of all stressed colormaps for
+ * the display. */
};
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void DeleteStressedCmap _ANSI_ARGS_((Display *display,
- Colormap colormap));
-static void FindClosestColor _ANSI_ARGS_((Tk_Window tkwin,
- XColor *desiredColorPtr, XColor *actualColorPtr));
+static void DeleteStressedCmap(Display *display,
+ Colormap colormap);
+static void FindClosestColor(Tk_Window tkwin,
+ XColor *desiredColorPtr, XColor *actualColorPtr);
/*
*----------------------------------------------------------------------
@@ -59,15 +59,15 @@ static void FindClosestColor _ANSI_ARGS_((Tk_Window tkwin,
* None
*
* Side effects:
- * Invalidates the colormap cache for the colormap associated with
- * the given color.
+ * Invalidates the colormap cache for the colormap associated with the
+ * given color.
*
*----------------------------------------------------------------------
*/
void
-TkpFreeColor(tkColPtr)
- TkColor *tkColPtr; /* Color to be released. Must have been
+TkpFreeColor(
+ TkColor *tkColPtr) /* Color to be released. Must have been
* allocated by TkpGetColor or
* TkpGetColorByValue. */
{
@@ -75,14 +75,13 @@ TkpFreeColor(tkColPtr)
Screen *screen = tkColPtr->screen;
/*
- * Careful! Don't free black or white, since this will
- * make some servers very unhappy. Also, there is a bug in
- * some servers (such Sun's X11/NeWS server) where reference
- * counting is performed incorrectly, so that if a color is
- * allocated twice in different places and then freed twice,
- * the second free generates an error (this bug existed as of
- * 10/1/92). To get around this problem, ignore errors that
- * occur during the free operation.
+ * Careful! Don't free black or white, since this will make some servers
+ * very unhappy. Also, there is a bug in some servers (such Sun's X11/NeWS
+ * server) where reference counting is performed incorrectly, so that if a
+ * color is allocated twice in different places and then freed twice, the
+ * second free generates an error (this bug existed as of 10/1/92). To get
+ * around this problem, ignore errors that occur during the free
+ * operation.
*/
visual = tkColPtr->visual;
@@ -92,7 +91,7 @@ TkpFreeColor(tkColPtr)
Tk_ErrorHandler handler;
handler = Tk_CreateErrorHandler(DisplayOfScreen(screen),
- -1, -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, -1, NULL, NULL);
XFreeColors(DisplayOfScreen(screen), tkColPtr->colormap,
&tkColPtr->color.pixel, 1, 0L);
Tk_DeleteErrorHandler(handler);
@@ -112,16 +111,15 @@ TkpFreeColor(tkColPtr)
*
* Side effects:
* May invalidate the colormap cache associated with tkwin upon
- * allocating a new colormap entry. Allocates a new TkColor
- * structure.
+ * allocating a new colormap entry. Allocates a new TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
-TkpGetColor(tkwin, name)
- Tk_Window tkwin; /* Window in which color will be used. */
- Tk_Uid name; /* Name of color to allocated (in form
+TkpGetColor(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ Tk_Uid name) /* Name of color to allocated (in form
* suitable for passing to XParseColor). */
{
Display *display = Tk_Display(tkwin);
@@ -144,7 +142,7 @@ TkpGetColor(tkwin, name)
buf[len] = '\0';
/*
- * Map from the name to a pixel value. Call XAllocNamedColor rather than
+ * Map from the name to a pixel value. Call XAllocNamedColor rather than
* XParseColor for non-# names: this saves a server round-trip for those
* names.
*/
@@ -156,20 +154,20 @@ TkpGetColor(tkwin, name)
DeleteStressedCmap(display, colormap);
} else {
/*
- * Couldn't allocate the color. Try translating the name to
- * a color value, to see whether the problem is a bad color
- * name or a full colormap. If the colormap is full, then
- * pick an approximation to the desired color.
+ * Couldn't allocate the color. Try translating the name to a
+ * color value, to see whether the problem is a bad color name or
+ * a full colormap. If the colormap is full, then pick an
+ * approximation to the desired color.
*/
if (XLookupColor(display, colormap, buf, &color, &screen) == 0) {
- return (TkColor *) NULL;
+ return NULL;
}
FindClosestColor(tkwin, &screen, &color);
}
} else {
if (XParseColor(display, colormap, buf, &color) == 0) {
- return (TkColor *) NULL;
+ return NULL;
}
if (XAllocColor(display, colormap, &color) != 0) {
DeleteStressedCmap(display, colormap);
@@ -189,27 +187,26 @@ TkpGetColor(tkwin, name)
*
* TkpGetColorByValue --
*
- * Given a desired set of red-green-blue intensities for a color,
- * locate a pixel value to use to draw that color in a given
- * window.
+ * Given a desired set of red-green-blue intensities for a color, locate
+ * a pixel value to use to draw that color in a given window.
*
* Results:
- * The return value is a pointer to an TkColor structure that
- * indicates the closest red, blue, and green intensities available
- * to those specified in colorPtr, and also specifies a pixel
- * value to use to draw in that color.
+ * The return value is a pointer to an TkColor structure that indicates
+ * the closest red, blue, and green intensities available to those
+ * specified in colorPtr, and also specifies a pixel value to use to draw
+ * in that color.
*
* Side effects:
- * May invalidate the colormap cache for the specified window.
- * Allocates a new TkColor structure.
+ * May invalidate the colormap cache for the specified window. Allocates
+ * a new TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
-TkpGetColorByValue(tkwin, colorPtr)
- Tk_Window tkwin; /* Window in which color will be used. */
- XColor *colorPtr; /* Red, green, and blue fields indicate
+TkpGetColorByValue(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
Display *display = Tk_Display(tkwin);
@@ -233,15 +230,15 @@ TkpGetColorByValue(tkwin, colorPtr)
*
* FindClosestColor --
*
- * When Tk can't allocate a color because a colormap has filled
- * up, this procedure is called to find and allocate the closest
- * available color in the colormap.
+ * When Tk can't allocate a color because a colormap has filled up, this
+ * function is called to find and allocate the closest available color in
+ * the colormap.
*
* Results:
- * There is no return value, but *actualColorPtr is filled in
- * with information about the closest available color in tkwin's
- * colormap. This color has been allocated via X, so it must
- * be released by the caller when the caller is done with it.
+ * There is no return value, but *actualColorPtr is filled in with
+ * information about the closest available color in tkwin's colormap.
+ * This color has been allocated via X, so it must be released by the
+ * caller when the caller is done with it.
*
* Side effects:
* A color is allocated.
@@ -250,13 +247,12 @@ TkpGetColorByValue(tkwin, colorPtr)
*/
static void
-FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
- Tk_Window tkwin; /* Window where color will be used. */
- XColor *desiredColorPtr; /* RGB values of color that was
- * wanted (but unavailable). */
- XColor *actualColorPtr; /* Structure to fill in with RGB and
- * pixel for closest available
- * color. */
+FindClosestColor(
+ Tk_Window tkwin, /* Window where color will be used. */
+ XColor *desiredColorPtr, /* RGB values of color that was wanted (but
+ * unavailable). */
+ XColor *actualColorPtr) /* Structure to fill in with RGB and pixel for
+ * closest available color. */
{
TkStressedCmap *stressPtr;
double tmp, distance, closestDistance;
@@ -267,8 +263,8 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
XVisualInfo template, *visInfoPtr;
/*
- * Find the TkStressedCmap structure for this colormap, or create
- * a new one if needed.
+ * Find the TkStressedCmap structure for this colormap, or create a new
+ * one if needed.
*/
for (stressPtr = dispPtr->stressPtr; ; stressPtr = stressPtr->nextPtr) {
@@ -276,20 +272,24 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
stressPtr = (TkStressedCmap *) ckalloc(sizeof(TkStressedCmap));
stressPtr->colormap = colormap;
template.visualid = XVisualIDFromVisual(Tk_Visual(tkwin));
+
visInfoPtr = XGetVisualInfo(Tk_Display(tkwin),
VisualIDMask, &template, &numFound);
if (numFound < 1) {
- panic("FindClosestColor couldn't lookup visual");
+ Tcl_Panic("FindClosestColor couldn't lookup visual");
}
+
stressPtr->numColors = visInfoPtr->colormap_size;
XFree((char *) visInfoPtr);
stressPtr->colorPtr = (XColor *) ckalloc((unsigned)
(stressPtr->numColors * sizeof(XColor)));
- for (i = 0; i < stressPtr->numColors; i++) {
+ for (i = 0; i < stressPtr->numColors; i++) {
stressPtr->colorPtr[i].pixel = (unsigned long) i;
}
+
XQueryColors(dispPtr->display, colormap, stressPtr->colorPtr,
stressPtr->numColors);
+
stressPtr->nextPtr = dispPtr->stressPtr;
dispPtr->stressPtr = stressPtr;
break;
@@ -300,27 +300,27 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
}
/*
- * Find the color that best approximates the desired one, then
- * try to allocate that color. If that fails, it must mean that
- * the color was read-write (so we can't use it, since it's owner
- * might change it) or else it was already freed. Try again,
- * over and over again, until something succeeds.
+ * Find the color that best approximates the desired one, then try to
+ * allocate that color. If that fails, it must mean that the color was
+ * read-write (so we can't use it, since it's owner might change it) or
+ * else it was already freed. Try again, over and over again, until
+ * something succeeds.
*/
- while (1) {
+ while (1) {
if (stressPtr->numColors == 0) {
- panic("FindClosestColor ran out of colors");
+ Tcl_Panic("FindClosestColor ran out of colors");
}
closestDistance = 1e30;
closest = 0;
for (colorPtr = stressPtr->colorPtr, i = 0; i < stressPtr->numColors;
colorPtr++, i++) {
/*
- * Use Euclidean distance in RGB space, weighted by Y (of YIQ)
- * as the objective function; this accounts for differences
- * in the color sensitivity of the eye.
+ * Use Euclidean distance in RGB space, weighted by Y (of YIQ) as
+ * the objective function; this accounts for differences in the
+ * color sensitivity of the eye.
*/
-
+
tmp = .30*(((int) desiredColorPtr->red) - (int) colorPtr->red);
distance = tmp*tmp;
tmp = .61*(((int) desiredColorPtr->green) - (int) colorPtr->green);
@@ -339,8 +339,8 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
}
/*
- * Couldn't allocate the color. Remove it from the table and
- * go back to look for the next best color.
+ * Couldn't allocate the color. Remove it from the table and go back
+ * to look for the next best color.
*/
stressPtr->colorPtr[closest] =
@@ -354,31 +354,30 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
*
* DeleteStressedCmap --
*
- * This procedure releases the information cached for "colormap"
- * so that it will be refetched from the X server the next time
- * it is needed.
+ * This function releases the information cached for "colormap" so that
+ * it will be refetched from the X server the next time it is needed.
*
* Results:
* None.
*
* Side effects:
- * The TkStressedCmap structure for colormap is deleted; the
- * colormap is no longer considered to be "stressed".
+ * The TkStressedCmap structure for colormap is deleted; the colormap is
+ * no longer considered to be "stressed".
*
* Note:
- * This procedure is invoked whenever a color in a colormap is
- * freed, and whenever a color allocation in a colormap succeeds.
- * This guarantees that TkStressedCmap structures are always
- * deleted before the corresponding Colormap is freed.
+ * This function is invoked whenever a color in a colormap is freed, and
+ * whenever a color allocation in a colormap succeeds. This guarantees
+ * that TkStressedCmap structures are always deleted before the
+ * corresponding Colormap is freed.
*
*----------------------------------------------------------------------
*/
static void
-DeleteStressedCmap(display, colormap)
- Display *display; /* Xlib's handle for the display
- * containing the colormap. */
- Colormap colormap; /* Colormap to flush. */
+DeleteStressedCmap(
+ Display *display, /* Xlib's handle for the display containing
+ * the colormap. */
+ Colormap colormap) /* Colormap to flush. */
{
TkStressedCmap *prevPtr, *stressPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
@@ -403,12 +402,11 @@ DeleteStressedCmap(display, colormap)
*
* TkpCmapStressed --
*
- * Check to see whether a given colormap is known to be out
- * of entries.
+ * Check to see whether a given colormap is known to be out of entries.
*
* Results:
- * 1 is returned if "colormap" is stressed (i.e. it has run out
- * of entries recently), 0 otherwise.
+ * 1 is returned if "colormap" is stressed (i.e. it has run out of
+ * entries recently), 0 otherwise.
*
* Side effects:
* None.
@@ -417,10 +415,10 @@ DeleteStressedCmap(display, colormap)
*/
int
-TkpCmapStressed(tkwin, colormap)
- Tk_Window tkwin; /* Window that identifies the display
+TkpCmapStressed(
+ Tk_Window tkwin, /* Window that identifies the display
* containing the colormap. */
- Colormap colormap; /* Colormap to check for stress. */
+ Colormap colormap) /* Colormap to check for stress. */
{
TkStressedCmap *stressPtr;
@@ -432,3 +430,11 @@ TkpCmapStressed(tkwin, colormap)
}
return 0;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c
index 7a753b1..2862eff 100644
--- a/unix/tkUnixConfig.c
+++ b/unix/tkUnixConfig.c
@@ -1,16 +1,15 @@
/*
* tkUnixConfig.c --
*
- * This module implements the Unix system defaults for
- * the configuration package.
+ * This module implements the Unix system defaults for the configuration
+ * package.
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tk.h"
#include "tkInt.h"
@@ -19,13 +18,13 @@
*
* TkpGetSystemDefault --
*
- * Given a dbName and className for a configuration option,
- * return a string representation of the option.
+ * Given a dbName and className for a configuration option, return a
+ * string representation of the option.
*
* Results:
- * Returns a Tk_Uid that is the string identifier that identifies
- * this option. Returns NULL if there are no system defaults
- * that match this pair.
+ * Returns a Tk_Uid that is the string identifier that identifies this
+ * option. Returns NULL if there are no system defaults that match this
+ * pair.
*
* Side effects:
* None, once the package is initialized.
@@ -34,10 +33,18 @@
*/
Tcl_Obj *
-TkpGetSystemDefault(tkwin, dbName, className)
- Tk_Window tkwin; /* A window to use. */
- CONST char *dbName; /* The option database name. */
- CONST char *className; /* The name of the option class. */
+TkpGetSystemDefault(
+ Tk_Window tkwin, /* A window to use. */
+ CONST char *dbName, /* The option database name. */
+ CONST char *className) /* The name of the option class. */
{
return NULL;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index 70e8b93..2169d1c 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -1,39 +1,36 @@
-/*
+/*
* tkUnixCursor.c --
*
* This file contains X specific cursor manipulation routines.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
* The following data structure is a superset of the TkCursor structure
- * defined in tkCursor.c. Each system specific cursor module will define
- * a different cursor structure. All of these structures must have the
- * same header consisting of the fields in TkCursor.
+ * defined in tkCursor.c. Each system specific cursor module will define a
+ * different cursor structure. All of these structures must have the same
+ * header consisting of the fields in TkCursor.
*/
-
-
typedef struct {
TkCursor info; /* Generic cursor info used by tkCursor.c */
Display *display; /* Display for which cursor is valid. */
} TkUnixCursor;
/*
- * The table below is used to map from the name of a cursor to its
- * index in the official cursor font:
+ * The table below is used to map from the name of a cursor to its index in
+ * the official cursor font:
*/
static struct CursorName {
- char *name;
- unsigned int shape;
+ CONST char *name;
+ unsigned int shape;
} cursorNames[] = {
{"X_cursor", XC_X_cursor},
{"arrow", XC_arrow},
@@ -116,6 +113,65 @@ static struct CursorName {
};
/*
+ * The table below is used to map from a cursor name to the data that defines
+ * the cursor. This table is used for cursors defined by Tk that don't exist
+ * in the X cursor table.
+ */
+
+#define CURSOR_NONE_DATA \
+"#define none_width 1\n" \
+"#define none_height 1\n" \
+"#define none_x_hot 0\n" \
+"#define none_y_hot 0\n" \
+"static unsigned char none_bits[] = {\n" \
+" 0x00};"
+
+/*
+ * Define test cursor to check that mask fg and bg color settings are working.
+ *
+ * . configure -cursor {center_ptr green red}
+ * . configure -cursor {@myarrow.xbm myarrow-mask.xbm green red}
+ * . configure -cursor {myarrow green red}
+ */
+
+/*#define DEFINE_MYARROW_CURSOR*/
+
+#ifdef DEFINE_MYARROW_CURSOR
+#define CURSOR_MYARROW_DATA \
+"#define myarrow_width 16\n" \
+"#define myarrow_height 16\n" \
+"#define myarrow_x_hot 7\n" \
+"#define myarrow_y_hot 0\n" \
+"static unsigned char myarrow_bits[] = {\n" \
+" 0x7f, 0xff, 0xbf, 0xfe, 0xdf, 0xfd, 0xef, 0xfb, 0xf7, 0xf7, 0xfb, 0xef,\n" \
+" 0xfd, 0xdf, 0xfe, 0xbf, 0x80, 0x00, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe,\n" \
+" 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0x3f, 0xfe};"
+
+#define CURSOR_MYARROW_MASK \
+"#define myarrow-mask_width 16\n" \
+"#define myarrow-mask_height 16\n" \
+"#define myarrow-mask_x_hot 7\n" \
+"#define myarrow-mask_y_hot 0\n" \
+"static unsigned char myarrow-mask_bits[] = {\n" \
+" 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f,\n" \
+" 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0xff, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,\n" \
+" 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};"
+
+#endif /* DEFINE_MYARROW_CURSOR */
+
+static struct TkCursorName {
+ char *name;
+ char *data;
+ char *mask;
+} tkCursorNames[] = {
+ {"none", CURSOR_NONE_DATA, NULL},
+#ifdef DEFINE_MYARROW_CURSOR
+ {"myarrow", CURSOR_MYARROW_DATA, CURSOR_MYARROW_MASK},
+#endif /* DEFINE_MYARROW_CURSOR */
+ {NULL, NULL, NULL}
+};
+
+/*
* Font to use for cursors:
*/
@@ -123,18 +179,21 @@ static struct CursorName {
#define CURSORFONT "cursor"
#endif
+static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp,
+ Tk_Window tkwin, int argc, CONST char **argv,
+ struct TkCursorName *tkCursorPtr);
/*
*----------------------------------------------------------------------
*
* TkGetCursorByName --
*
- * Retrieve a cursor by name. Parse the cursor name into fields
- * and create a cursor, either from the standard cursor font or
- * from bitmap files.
+ * Retrieve a cursor by name. Parse the cursor name into fields and
+ * create a cursor, either from the standard cursor font or from bitmap
+ * files.
*
* Results:
- * Returns a new cursor, or NULL on errors.
+ * Returns a new cursor, or NULL on errors.
*
* Side effects:
* Allocates a new cursor.
@@ -143,19 +202,19 @@ static struct CursorName {
*/
TkCursor *
-TkGetCursorByName(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which cursor will be used. */
- Tk_Uid string; /* Description of cursor. See manual entry
- * for details on legal syntax. */
+TkGetCursorByName(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ Tk_Uid string) /* Description of cursor. See manual entry for
+ * details on legal syntax. */
{
TkUnixCursor *cursorPtr = NULL;
Cursor cursor = None;
int argc;
CONST char **argv = NULL;
- Pixmap source = None;
- Pixmap mask = None;
Display *display = Tk_Display(tkwin);
+ int inTkTable = 0;
+ struct TkCursorName* tkCursorPtr = NULL;
if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
return NULL;
@@ -163,18 +222,38 @@ TkGetCursorByName(interp, tkwin, string)
if (argc == 0) {
goto badString;
}
+
+ /*
+ * Check Tk specific table of cursor names. The cursor names don't overlap
+ * with cursors defined in the X table so search order does not matter.
+ */
+
if (argv[0][0] != '@') {
+ for (tkCursorPtr = tkCursorNames; ; tkCursorPtr++) {
+ if (tkCursorPtr->name == NULL) {
+ tkCursorPtr = NULL;
+ break;
+ }
+ if ((tkCursorPtr->name[0] == argv[0][0]) &&
+ (strcmp(tkCursorPtr->name, argv[0]) == 0)) {
+ inTkTable = 1;
+ break;
+ }
+ }
+ }
+
+ if ((argv[0][0] != '@') && !inTkTable) {
XColor fg, bg;
unsigned int maskIndex;
register struct CursorName *namePtr;
TkDisplay *dispPtr;
/*
- * The cursor is to come from the standard cursor font. If one
- * arg, it is cursor name (use black and white for fg and bg).
- * If two args, they are name and fg color (ignore mask). If
- * three args, they are name, fg, bg. Some of the code below
- * is stolen from the XCreateFontCursor Xlib procedure.
+ * The cursor is to come from the standard cursor font. If one arg, it
+ * is cursor name (use black and white for fg and bg). If two args,
+ * they are name and fg color (ignore mask). If three args, they are
+ * name, fg, bg. Some of the code below is stolen from the
+ * XCreateFontCursor Xlib function.
*/
if (argc > 3) {
@@ -189,27 +268,25 @@ TkGetCursorByName(interp, tkwin, string)
break;
}
}
+
maskIndex = namePtr->shape + 1;
if (argc == 1) {
fg.red = fg.green = fg.blue = 0;
bg.red = bg.green = bg.blue = 65535;
} else {
- if (XParseColor(display, Tk_Colormap(tkwin), argv[1],
- &fg) == 0) {
+ if (XParseColor(display, Tk_Colormap(tkwin), argv[1], &fg) == 0) {
Tcl_AppendResult(interp, "invalid color name \"", argv[1],
- "\"", (char *) NULL);
+ "\"", NULL);
goto cleanup;
}
if (argc == 2) {
bg.red = bg.green = bg.blue = 0;
maskIndex = namePtr->shape;
- } else {
- if (XParseColor(display, Tk_Colormap(tkwin), argv[2],
- &bg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[2],
- "\"", (char *) NULL);
- goto cleanup;
- }
+ } else if (XParseColor(display, Tk_Colormap(tkwin), argv[2],
+ &bg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"", argv[2],
+ "\"", NULL);
+ goto cleanup;
}
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -224,110 +301,252 @@ TkGetCursorByName(interp, tkwin, string)
dispPtr->cursorFont, namePtr->shape, maskIndex,
&fg, &bg);
} else {
- int width, height, maskWidth, maskHeight;
- int xHot, yHot, dummy1, dummy2;
- XColor fg, bg;
+ /*
+ * Prevent file system access in safe interpreters.
+ */
+
+ if (!inTkTable && Tcl_IsSafe(interp)) {
+ Tcl_AppendResult(interp, "can't get cursor from a file in",
+ " a safe interpreter", NULL);
+ cursorPtr = NULL;
+ goto cleanup;
+ }
- /*
- * Prevent file system access in safe interpreters.
- */
-
- if (Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't get cursor from a file in",
- " a safe interpreter", (char *) NULL);
- cursorPtr = NULL;
- goto cleanup;
- }
-
/*
- * The cursor is to be created by reading bitmap files. There
- * should be either two elements in the list (source, color) or
- * four (source mask fg bg).
+ * If the cursor is to be created from bitmap files, then there should
+ * be either two elements in the list (source, color) or four (source
+ * mask fg bg). A cursor defined in the Tk table accepts the same
+ * arguments as an X cursor.
*/
- if ((argc != 2) && (argc != 4)) {
+ if (inTkTable && (argc != 1) && (argc != 2) && (argc != 3)) {
goto badString;
}
- if (TkReadBitmapFile(display,
- RootWindowOfScreen(Tk_Screen(tkwin)), &argv[0][1],
+
+ if (!inTkTable && (argc != 2) && (argc != 4)) {
+ goto badString;
+ }
+
+ cursor = CreateCursorFromTableOrFile(interp, tkwin, argc, argv,
+ tkCursorPtr);
+ }
+
+ if (cursor != None) {
+ cursorPtr = (TkUnixCursor *) ckalloc(sizeof(TkUnixCursor));
+ cursorPtr->info.cursor = (Tk_Cursor) cursor;
+ cursorPtr->display = display;
+ }
+
+ cleanup:
+ if (argv != NULL) {
+ ckfree((char *) argv);
+ }
+ return (TkCursor *) cursorPtr;
+
+ badString:
+ if (argv) {
+ ckfree((char *) argv);
+ }
+ Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateCursorFromTableOrFile --
+ *
+ * Create a cursor defined in a file or the Tk static cursor table. A
+ * cursor defined in a file starts with the '@' character. This method
+ * assumes that the number of arguments in argv has been validated
+ * already.
+ *
+ * Results:
+ * Returns a new cursor, or None on error.
+ *
+ * Side effects:
+ * Allocates a new X cursor.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Cursor
+CreateCursorFromTableOrFile(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ int argc,
+ CONST char **argv, /* Cursor spec parsed into elements. */
+ struct TkCursorName *tkCursorPtr)
+ /* Non-NULL when cursor is defined in Tk
+ * table. */
+{
+ Cursor cursor = None;
+
+ int width, height, maskWidth, maskHeight;
+ int xHot = -1, yHot = -1;
+ int dummy1, dummy2;
+ XColor fg, bg;
+ CONST char *fgColor;
+ CONST char *bgColor;
+ int inTkTable = (tkCursorPtr != NULL);
+
+ Display *display = Tk_Display(tkwin);
+ Drawable drawable = RootWindowOfScreen(Tk_Screen(tkwin));
+
+ Pixmap source = None;
+ Pixmap mask = None;
+
+ /*
+ * A cursor defined in a file accepts either 2 or 4 arguments.
+ *
+ * {srcfile fg}
+ * {srcfile maskfile fg bg}
+ *
+ * A cursor defined in the Tk table accepts 1, 2, or 3 arguments.
+ *
+ * {tkcursorname}
+ * {tkcursorname fg}
+ * {tkcursorname fg bg}
+ */
+
+ if (inTkTable) {
+ /*
+ * This logic is like TkReadBitmapFile().
+ */
+
+ char *data;
+
+ data = TkGetBitmapData(NULL, tkCursorPtr->data, NULL,
+ &width, &height, &xHot, &yHot);
+ if (data == NULL) {
+ Tcl_AppendResult(interp, "error reading bitmap data for \"",
+ argv[0], "\"", NULL);
+ goto cleanup;
+ }
+
+ source = XCreateBitmapFromData(display, drawable, data, width,height);
+ ckfree(data);
+ } else {
+ if (TkReadBitmapFile(display, drawable, &argv[0][1],
(unsigned int *) &width, (unsigned int *) &height,
&source, &xHot, &yHot) != BitmapSuccess) {
Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
- &argv[0][1], "\"", (char *) NULL);
+ &argv[0][1], "\"", NULL);
goto cleanup;
}
- if ((xHot < 0) || (yHot < 0) || (xHot >= width) || (yHot >= height)) {
+ }
+
+ if ((xHot < 0) || (yHot < 0) || (xHot >= width) || (yHot >= height)) {
+ if (inTkTable) {
+ Tcl_AppendResult(interp, "bad hot spot in bitmap data for \"",
+ argv[0], "\"", NULL);
+ } else {
Tcl_AppendResult(interp, "bad hot spot in bitmap file \"",
- &argv[0][1], "\"", (char *) NULL);
+ &argv[0][1], "\"", NULL);
+ }
+ goto cleanup;
+ }
+
+ /*
+ * Parse color names from optional fg and bg arguments
+ */
+
+ if (argc == 1) {
+ fg.red = fg.green = fg.blue = 0;
+ bg.red = bg.green = bg.blue = 65535;
+ } else if (argc == 2) {
+ fgColor = argv[1];
+ if (XParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"",
+ fgColor, "\"", NULL);
goto cleanup;
}
- if (argc == 2) {
- if (XParseColor(display, Tk_Colormap(tkwin), argv[1],
- &fg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"",
- argv[1], "\"", (char *) NULL);
- goto cleanup;
- }
- cursor = XCreatePixmapCursor(display, source, source,
- &fg, &fg, (unsigned) xHot, (unsigned) yHot);
+ if (inTkTable) {
+ bg.red = bg.green = bg.blue = 0;
} else {
- if (TkReadBitmapFile(display,
- RootWindowOfScreen(Tk_Screen(tkwin)), argv[1],
- (unsigned int *) &maskWidth, (unsigned int *) &maskHeight,
- &mask, &dummy1, &dummy2) != BitmapSuccess) {
- Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
- argv[1], "\"", (char *) NULL);
- goto cleanup;
- }
- if ((maskWidth != width) && (maskHeight != height)) {
- Tcl_SetResult(interp,
- "source and mask bitmaps have different sizes",
- TCL_STATIC);
- goto cleanup;
- }
- if (XParseColor(display, Tk_Colormap(tkwin), argv[2],
- &fg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[2],
- "\"", (char *) NULL);
- goto cleanup;
- }
- if (XParseColor(display, Tk_Colormap(tkwin), argv[3],
- &bg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[3],
- "\"", (char *) NULL);
- goto cleanup;
- }
- cursor = XCreatePixmapCursor(display, source, mask,
- &fg, &bg, (unsigned) xHot, (unsigned) yHot);
+ bg = fg;
+ }
+ } else {
+ /* 3 or 4 arguments */
+ if (inTkTable) {
+ fgColor = argv[1];
+ bgColor = argv[2];
+ } else {
+ fgColor = argv[2];
+ bgColor = argv[3];
+ }
+ if (XParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"",
+ fgColor, "\"", NULL);
+ goto cleanup;
+ }
+ if (XParseColor(display, Tk_Colormap(tkwin), bgColor, &bg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"",
+ bgColor, "\"", NULL);
+ goto cleanup;
}
}
- if (cursor != None) {
- cursorPtr = (TkUnixCursor *) ckalloc(sizeof(TkUnixCursor));
- cursorPtr->info.cursor = (Tk_Cursor) cursor;
- cursorPtr->display = display;
+ /*
+ * If there is no mask data, then create the cursor now.
+ */
+
+ if ((!inTkTable && (argc == 2)) || (inTkTable && tkCursorPtr->mask == NULL)) {
+ cursor = XCreatePixmapCursor(display, source, source,
+ &fg, &fg, (unsigned) xHot, (unsigned) yHot);
+ goto cleanup;
}
- cleanup:
- if (argv != NULL) {
- ckfree((char *) argv);
+ /*
+ * Parse bitmap mask data and create cursor with fg and bg colors.
+ */
+
+ if (inTkTable) {
+ /*
+ * This logic is like TkReadBitmapFile().
+ */
+
+ char *data;
+
+ data = TkGetBitmapData(NULL, tkCursorPtr->mask, NULL,
+ &maskWidth, &maskHeight, &dummy1, &dummy2);
+ if (data == NULL) {
+ Tcl_AppendResult(interp, "error reading bitmap mask data for \"",
+ argv[0], "\"", NULL);
+ goto cleanup;
+ }
+
+ mask = XCreateBitmapFromData(display, drawable, data, maskWidth,
+ maskHeight);
+
+ ckfree(data);
+ } else {
+ if (TkReadBitmapFile(display, drawable, argv[1],
+ (unsigned int *) &maskWidth, (unsigned int *) &maskHeight,
+ &mask, &dummy1, &dummy2) != BitmapSuccess) {
+ Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
+ argv[1], "\"", NULL);
+ goto cleanup;
+ }
+ }
+
+ if ((maskWidth != width) || (maskHeight != height)) {
+ Tcl_SetResult(interp, "source and mask bitmaps have different sizes",
+ TCL_STATIC);
+ goto cleanup;
}
+
+ cursor = XCreatePixmapCursor(display, source, mask,
+ &fg, &bg, (unsigned) xHot, (unsigned) yHot);
+
+ cleanup:
if (source != None) {
Tk_FreePixmap(display, source);
}
if (mask != None) {
Tk_FreePixmap(display, mask);
}
- return (TkCursor *) cursorPtr;
-
-
- badString:
- if (argv) {
- ckfree((char *) argv);
- }
- Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
- (char *) NULL);
- return NULL;
+ return cursor;
}
/*
@@ -347,15 +566,14 @@ TkGetCursorByName(interp, tkwin, string)
*/
TkCursor *
-TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
- fgColor, bgColor)
- Tk_Window tkwin; /* Window in which cursor will be used. */
- CONST char *source; /* Bitmap data for cursor shape. */
- CONST char *mask; /* Bitmap data for cursor mask. */
- int width, height; /* Dimensions of cursor. */
- int xHot, yHot; /* Location of hot-spot in cursor. */
- XColor fgColor; /* Foreground color for cursor. */
- XColor bgColor; /* Background color for cursor. */
+TkCreateCursorFromData(
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ CONST char *source, /* Bitmap data for cursor shape. */
+ CONST char *mask, /* Bitmap data for cursor mask. */
+ int width, int height, /* Dimensions of cursor. */
+ int xHot, int yHot, /* Location of hot-spot in cursor. */
+ XColor fgColor, /* Foreground color for cursor. */
+ XColor bgColor) /* Background color for cursor. */
{
Cursor cursor;
Pixmap sourcePixmap, maskPixmap;
@@ -365,7 +583,7 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
sourcePixmap = XCreateBitmapFromData(display,
RootWindowOfScreen(Tk_Screen(tkwin)), source, (unsigned) width,
(unsigned) height);
- maskPixmap = XCreateBitmapFromData(display,
+ maskPixmap = XCreateBitmapFromData(display,
RootWindowOfScreen(Tk_Screen(tkwin)), mask, (unsigned) width,
(unsigned) height);
cursor = XCreatePixmapCursor(display, sourcePixmap,
@@ -386,7 +604,7 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
*
* TkpFreeCursor --
*
- * This procedure is called to release a cursor allocated by
+ * This function is called to release a cursor allocated by
* TkGetCursorByName.
*
* Results:
@@ -399,10 +617,19 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
*/
void
-TkpFreeCursor(cursorPtr)
- TkCursor *cursorPtr;
+TkpFreeCursor(
+ TkCursor *cursorPtr)
{
TkUnixCursor *unixCursorPtr = (TkUnixCursor *) cursorPtr;
+
XFreeCursor(unixCursorPtr->display, (Cursor) unixCursorPtr->info.cursor);
Tk_FreeXId(unixCursorPtr->display, (XID) unixCursorPtr->info.cursor);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index 96a68b7..4eb8778 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -30,8 +30,9 @@
#define NORMAL_BG "#d9d9d9"
#define ACTIVE_BG "#ececec"
#define SELECT_BG "#c3c3c3"
-#define TROUGH "#c3c3c3"
-#define INDICATOR "#b03060"
+#define TROUGH "#b3b3b3"
+#define CHECK_INDICATOR WHITE
+#define MENU_INDICATOR BLACK
#define DISABLED "#a3a3a3"
/*
@@ -47,7 +48,7 @@
#define DEF_BUTTON_BG_COLOR NORMAL_BG
#define DEF_BUTTON_BG_MONO WHITE
#define DEF_BUTTON_BITMAP ""
-#define DEF_BUTTON_BORDER_WIDTH "2"
+#define DEF_BUTTON_BORDER_WIDTH "1"
#define DEF_BUTTON_CURSOR ""
#define DEF_BUTTON_COMPOUND "none"
#define DEF_BUTTON_COMMAND ""
@@ -56,7 +57,7 @@
#define DEF_BUTTON_DISABLED_FG_MONO ""
#define DEF_BUTTON_FG BLACK
#define DEF_CHKRAD_FG DEF_BUTTON_FG
-#define DEF_BUTTON_FONT "Helvetica -12 bold"
+#define DEF_BUTTON_FONT "TkDefaultFont"
#define DEF_BUTTON_HEIGHT "0"
#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO
@@ -68,6 +69,7 @@
#define DEF_BUTTON_JUSTIFY "center"
#define DEF_BUTTON_OFF_VALUE "0"
#define DEF_BUTTON_ON_VALUE "1"
+#define DEF_BUTTON_TRISTATE_VALUE ""
#define DEF_BUTTON_OVER_RELIEF ""
#define DEF_BUTTON_PADX "3m"
#define DEF_LABCHKRAD_PADX "1"
@@ -77,7 +79,7 @@
#define DEF_LABCHKRAD_RELIEF "flat"
#define DEF_BUTTON_REPEAT_DELAY "0"
#define DEF_BUTTON_REPEAT_INTERVAL "0"
-#define DEF_BUTTON_SELECT_COLOR INDICATOR
+#define DEF_BUTTON_SELECT_COLOR CHECK_INDICATOR
#define DEF_BUTTON_SELECT_MONO BLACK
#define DEF_BUTTON_SELECT_IMAGE (char *) NULL
#define DEF_BUTTON_STATE "normal"
@@ -131,15 +133,15 @@
* Defaults for entries:
*/
-#define DEF_ENTRY_BG_COLOR NORMAL_BG
+#define DEF_ENTRY_BG_COLOR WHITE
#define DEF_ENTRY_BG_MONO WHITE
-#define DEF_ENTRY_BORDER_WIDTH "2"
+#define DEF_ENTRY_BORDER_WIDTH "1"
#define DEF_ENTRY_CURSOR "xterm"
#define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG
#define DEF_ENTRY_DISABLED_BG_MONO WHITE
#define DEF_ENTRY_DISABLED_FG DISABLED
#define DEF_ENTRY_EXPORT_SELECTION "1"
-#define DEF_ENTRY_FONT "Helvetica -12"
+#define DEF_ENTRY_FONT "TkTextFont"
#define DEF_ENTRY_FG BLACK
#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG
#define DEF_ENTRY_HIGHLIGHT BLACK
@@ -157,7 +159,7 @@
#define DEF_ENTRY_SCROLL_COMMAND ""
#define DEF_ENTRY_SELECT_COLOR SELECT_BG
#define DEF_ENTRY_SELECT_MONO BLACK
-#define DEF_ENTRY_SELECT_BD_COLOR "1"
+#define DEF_ENTRY_SELECT_BD_COLOR "0"
#define DEF_ENTRY_SELECT_BD_MONO "0"
#define DEF_ENTRY_SELECT_FG_COLOR BLACK
#define DEF_ENTRY_SELECT_FG_MONO WHITE
@@ -198,7 +200,7 @@
#define DEF_LABELFRAME_CLASS "Labelframe"
#define DEF_LABELFRAME_RELIEF "groove"
#define DEF_LABELFRAME_FG BLACK
-#define DEF_LABELFRAME_FONT "Helvetica -12 bold"
+#define DEF_LABELFRAME_FONT "TkDefaultFont"
#define DEF_LABELFRAME_TEXT ""
#define DEF_LABELFRAME_LABELANCHOR "nw"
@@ -206,14 +208,14 @@
* Defaults for listboxes:
*/
-#define DEF_LISTBOX_ACTIVE_STYLE "underline"
-#define DEF_LISTBOX_BG_COLOR NORMAL_BG
+#define DEF_LISTBOX_ACTIVE_STYLE "dotbox"
+#define DEF_LISTBOX_BG_COLOR WHITE
#define DEF_LISTBOX_BG_MONO WHITE
-#define DEF_LISTBOX_BORDER_WIDTH "2"
+#define DEF_LISTBOX_BORDER_WIDTH "1"
#define DEF_LISTBOX_CURSOR ""
#define DEF_LISTBOX_DISABLED_FG DISABLED
#define DEF_LISTBOX_EXPORT_SELECTION "1"
-#define DEF_LISTBOX_FONT "Helvetica -12 bold"
+#define DEF_LISTBOX_FONT "TkDefaultFont"
#define DEF_LISTBOX_FG BLACK
#define DEF_LISTBOX_HEIGHT "10"
#define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG
@@ -224,7 +226,7 @@
#define DEF_LISTBOX_LIST_VARIABLE ""
#define DEF_LISTBOX_SELECT_COLOR SELECT_BG
#define DEF_LISTBOX_SELECT_MONO BLACK
-#define DEF_LISTBOX_SELECT_BD "1"
+#define DEF_LISTBOX_SELECT_BD "0"
#define DEF_LISTBOX_SELECT_FG_COLOR BLACK
#define DEF_LISTBOX_SELECT_FG_MONO WHITE
#define DEF_LISTBOX_SELECT_MODE "browse"
@@ -268,20 +270,20 @@
#define DEF_MENU_ACTIVE_BG_COLOR ACTIVE_BG
#define DEF_MENU_ACTIVE_BG_MONO BLACK
-#define DEF_MENU_ACTIVE_BORDER_WIDTH "2"
+#define DEF_MENU_ACTIVE_BORDER_WIDTH "1"
#define DEF_MENU_ACTIVE_FG_COLOR BLACK
#define DEF_MENU_ACTIVE_FG_MONO WHITE
#define DEF_MENU_BG_COLOR NORMAL_BG
#define DEF_MENU_BG_MONO WHITE
-#define DEF_MENU_BORDER_WIDTH "2"
+#define DEF_MENU_BORDER_WIDTH "1"
#define DEF_MENU_CURSOR "arrow"
#define DEF_MENU_DISABLED_FG_COLOR DISABLED
#define DEF_MENU_DISABLED_FG_MONO ""
-#define DEF_MENU_FONT "Helvetica -12 bold"
+#define DEF_MENU_FONT "TkMenuFont"
#define DEF_MENU_FG BLACK
#define DEF_MENU_POST_COMMAND ""
#define DEF_MENU_RELIEF "raised"
-#define DEF_MENU_SELECT_COLOR INDICATOR
+#define DEF_MENU_SELECT_COLOR MENU_INDICATOR
#define DEF_MENU_SELECT_MONO BLACK
#define DEF_MENU_TAKE_FOCUS "0"
#define DEF_MENU_TEAROFF "1"
@@ -301,12 +303,12 @@
#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
#define DEF_MENUBUTTON_BG_MONO WHITE
#define DEF_MENUBUTTON_BITMAP ""
-#define DEF_MENUBUTTON_BORDER_WIDTH "2"
+#define DEF_MENUBUTTON_BORDER_WIDTH "1"
#define DEF_MENUBUTTON_CURSOR ""
#define DEF_MENUBUTTON_DIRECTION "below"
#define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED
#define DEF_MENUBUTTON_DISABLED_FG_MONO ""
-#define DEF_MENUBUTTON_FONT "Helvetica -12 bold"
+#define DEF_MENUBUTTON_FONT "TkDefaultFont"
#define DEF_MENUBUTTON_FG BLACK
#define DEF_MENUBUTTON_HEIGHT "0"
#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
@@ -336,10 +338,10 @@
#define DEF_MESSAGE_ASPECT "150"
#define DEF_MESSAGE_BG_COLOR NORMAL_BG
#define DEF_MESSAGE_BG_MONO WHITE
-#define DEF_MESSAGE_BORDER_WIDTH "2"
+#define DEF_MESSAGE_BORDER_WIDTH "1"
#define DEF_MESSAGE_CURSOR ""
#define DEF_MESSAGE_FG BLACK
-#define DEF_MESSAGE_FONT "Helvetica -12 bold"
+#define DEF_MESSAGE_FONT "TkDefaultFont"
#define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG
#define DEF_MESSAGE_HIGHLIGHT BLACK
#define DEF_MESSAGE_HIGHLIGHT_WIDTH "0"
@@ -358,19 +360,19 @@
#define DEF_PANEDWINDOW_BG_COLOR NORMAL_BG
#define DEF_PANEDWINDOW_BG_MONO WHITE
-#define DEF_PANEDWINDOW_BORDERWIDTH "2"
+#define DEF_PANEDWINDOW_BORDERWIDTH "1"
#define DEF_PANEDWINDOW_CURSOR ""
#define DEF_PANEDWINDOW_HANDLEPAD "8"
#define DEF_PANEDWINDOW_HANDLESIZE "8"
#define DEF_PANEDWINDOW_HEIGHT ""
-#define DEF_PANEDWINDOW_OPAQUERESIZE "0"
+#define DEF_PANEDWINDOW_OPAQUERESIZE "1"
#define DEF_PANEDWINDOW_ORIENT "horizontal"
#define DEF_PANEDWINDOW_RELIEF "flat"
#define DEF_PANEDWINDOW_SASHCURSOR ""
-#define DEF_PANEDWINDOW_SASHPAD "2"
-#define DEF_PANEDWINDOW_SASHRELIEF "raised"
-#define DEF_PANEDWINDOW_SASHWIDTH "2"
-#define DEF_PANEDWINDOW_SHOWHANDLE "1"
+#define DEF_PANEDWINDOW_SASHPAD "0"
+#define DEF_PANEDWINDOW_SASHRELIEF "flat"
+#define DEF_PANEDWINDOW_SASHWIDTH "3"
+#define DEF_PANEDWINDOW_SHOWHANDLE "0"
#define DEF_PANEDWINDOW_WIDTH ""
/*
@@ -385,6 +387,8 @@
#define DEF_PANEDWINDOW_PANE_PADY "0"
#define DEF_PANEDWINDOW_PANE_STICKY "nsew"
#define DEF_PANEDWINDOW_PANE_WIDTH ""
+#define DEF_PANEDWINDOW_PANE_HIDE "0"
+#define DEF_PANEDWINDOW_PANE_STRETCH "last"
/*
* Defaults for scales:
@@ -395,11 +399,11 @@
#define DEF_SCALE_BG_COLOR NORMAL_BG
#define DEF_SCALE_BG_MONO WHITE
#define DEF_SCALE_BIG_INCREMENT "0"
-#define DEF_SCALE_BORDER_WIDTH "2"
+#define DEF_SCALE_BORDER_WIDTH "1"
#define DEF_SCALE_COMMAND ""
#define DEF_SCALE_CURSOR ""
#define DEF_SCALE_DIGITS "0"
-#define DEF_SCALE_FONT "Helvetica -12 bold"
+#define DEF_SCALE_FONT "TkDefaultFont"
#define DEF_SCALE_FG_COLOR BLACK
#define DEF_SCALE_FG_MONO BLACK
#define DEF_SCALE_FROM "0"
@@ -435,13 +439,13 @@
#define DEF_SCROLLBAR_ACTIVE_RELIEF "raised"
#define DEF_SCROLLBAR_BG_COLOR NORMAL_BG
#define DEF_SCROLLBAR_BG_MONO WHITE
-#define DEF_SCROLLBAR_BORDER_WIDTH "2"
+#define DEF_SCROLLBAR_BORDER_WIDTH "1"
#define DEF_SCROLLBAR_COMMAND ""
#define DEF_SCROLLBAR_CURSOR ""
#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1"
#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG
#define DEF_SCROLLBAR_HIGHLIGHT BLACK
-#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "1"
+#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0"
#define DEF_SCROLLBAR_JUMP "0"
#define DEF_SCROLLBAR_ORIENT "vertical"
#define DEF_SCROLLBAR_RELIEF "sunken"
@@ -450,20 +454,21 @@
#define DEF_SCROLLBAR_TAKE_FOCUS (char *) NULL
#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
#define DEF_SCROLLBAR_TROUGH_MONO WHITE
-#define DEF_SCROLLBAR_WIDTH "15"
+#define DEF_SCROLLBAR_WIDTH "11"
/*
* Defaults for texts:
*/
#define DEF_TEXT_AUTO_SEPARATORS "1"
-#define DEF_TEXT_BG_COLOR NORMAL_BG
+#define DEF_TEXT_BG_COLOR WHITE
#define DEF_TEXT_BG_MONO WHITE
-#define DEF_TEXT_BORDER_WIDTH "2"
+#define DEF_TEXT_BLOCK_CURSOR "0"
+#define DEF_TEXT_BORDER_WIDTH "1"
#define DEF_TEXT_CURSOR "xterm"
#define DEF_TEXT_FG BLACK
#define DEF_TEXT_EXPORT_SELECTION "1"
-#define DEF_TEXT_FONT "Courier -12"
+#define DEF_TEXT_FONT "TkFixedFont"
#define DEF_TEXT_HEIGHT "24"
#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG
#define DEF_TEXT_HIGHLIGHT BLACK
@@ -478,9 +483,10 @@
#define DEF_TEXT_PADX "1"
#define DEF_TEXT_PADY "1"
#define DEF_TEXT_RELIEF "sunken"
+#define DEF_TEXT_INACTIVE_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_MONO BLACK
-#define DEF_TEXT_SELECT_BD_COLOR "1"
+#define DEF_TEXT_SELECT_BD_COLOR "0"
#define DEF_TEXT_SELECT_BD_MONO "0"
#define DEF_TEXT_SELECT_FG_COLOR BLACK
#define DEF_TEXT_SELECT_FG_MONO WHITE
@@ -491,6 +497,7 @@
#define DEF_TEXT_SPACING3 "0"
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
+#define DEF_TEXT_TABSTYLE "tabular"
#define DEF_TEXT_TAKE_FOCUS (char *) NULL
#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
@@ -502,7 +509,7 @@
* Defaults for canvas text:
*/
-#define DEF_CANVTEXT_FONT "Helvetica -12"
+#define DEF_CANVTEXT_FONT "TkDefaultFont"
/*
* Defaults for toplevels (most of the defaults for frames also apply
diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c
index 9c5028a..2b86ca6 100644
--- a/unix/tkUnixDialog.c
+++ b/unix/tkUnixDialog.c
@@ -8,24 +8,25 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-
-#include "tkPort.h"
-#include "tkInt.h"
+
#include "tkUnixInt.h"
/*
+ * The wrapper code for Unix is actually set up in library/tk.tcl these days;
+ * the procedure names used here are probably wrong too...
+ */
+
+#ifdef TK_OBSOLETE_UNIX_DIALOG_WRAPPERS
+
+/*
*----------------------------------------------------------------------
*
- * EvalArgv --
+ * EvalObjv --
*
- * Invokes the Tcl procedure with the arguments. argv[0] is set by
- * the caller of this function. It may be different than cmdName.
- * The TCL command will see argv[0], not cmdName, as its name if it
- * invokes [lindex [info level 0] 0]
+ * Invokes the Tcl procedure with the arguments.
*
* Results:
- * TCL_ERROR if the command does not exist and cannot be autoloaded.
- * Otherwise, return the result of the evaluation of the command.
+ * Returns the result of the evaluation of the command.
*
* Side effects:
* The command may be autoloaded.
@@ -33,54 +34,37 @@
*----------------------------------------------------------------------
*/
-static int EvalArgv(interp, cmdName, argc, argv)
- Tcl_Interp *interp; /* Current interpreter. */
- char * cmdName; /* Name of the TCL command to call */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+static int
+EvalObjv(
+ Tcl_Interp *interp, /* Current interpreter. */
+ char *cmdName, /* Name of the TCL command to call */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST *objv) /* Arguments. */
{
- Tcl_CmdInfo cmdInfo;
-
- if (!Tcl_GetCommandInfo(interp, cmdName, &cmdInfo)) {
- char * cmdArgv[2];
+ Tcl_Obj *cmdObj, **objs;
+ int result;
- /*
- * This comand is not in the interpreter yet -- looks like we
- * have to auto-load it
- */
- if (!Tcl_GetCommandInfo(interp, "auto_load", &cmdInfo)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot execute command \"auto_load\"",
- NULL);
- return TCL_ERROR;
- }
+ cmdObj = Tcl_NewStringObj(cmdName, -1);
+ Tcl_IncrRefCount(cmdObj);
+ objs = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj*) * (unsigned)(objc+1));
+ objs[0] = cmdObj;
+ memcpy(objs+1, objv, sizeof(Tcl_Obj *) * (unsigned)objc);
- cmdArgv[0] = "auto_load";
- cmdArgv[1] = cmdName;
+ result = Tcl_EvalObjv(interp, objc+1, objs, 0);
- if ((*cmdInfo.proc)(cmdInfo.clientData, interp, 2, cmdArgv)!= TCL_OK){
- return TCL_ERROR;
- }
+ Tcl_DecrRefCount(cmdObj);
+ ckfree((char *) objs);
- if (!Tcl_GetCommandInfo(interp, cmdName, &cmdInfo)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot auto-load command \"",
- cmdName, "\"",NULL);
- return TCL_ERROR;
- }
- }
-
- return (*cmdInfo.proc)(cmdInfo.clientData, interp, argc, argv);
+ return result;
}
/*
*----------------------------------------------------------------------
*
- * Tk_ChooseColorCmd --
+ * Tk_ChooseColorObjCmd --
*
- * This procedure implements the color dialog box for the Unix
- * platform. See the user documentation for details on what it
- * does.
+ * This procedure implements the color dialog box for the Unix platform.
+ * See the user documentation for details on what it does.
*
* Results:
* See user documentation.
@@ -94,13 +78,13 @@ static int EvalArgv(interp, cmdName, argc, argv)
*/
int
-Tk_ChooseColorCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_ChooseColorObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST *objv) /* Arguments. */
{
- return EvalArgv(interp, "tk::ColorDialog", argc, argv);
+ return EvalObjv(interp, "tk::ColorDialog", objc-1, objv+1);
}
/*
@@ -108,35 +92,33 @@ Tk_ChooseColorCmd(clientData, interp, argc, argv)
*
* Tk_GetOpenFileCmd --
*
- * This procedure implements the "open file" dialog box for the
- * Unix platform. See the user documentation for details on what
- * it does.
+ * This procedure implements the "open file" dialog box for the Unix
+ * platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
- * A dialog window is created the first this procedure is called.
- * This window is not destroyed and will be reused the next time
- * the application invokes the "tk_getOpenFile" or
- * "tk_getSaveFile" command.
+ * A dialog window is created the first this procedure is called. This
+ * window is not destroyed and will be reused the next time the
+ * application invokes the "tk_getOpenFile" or "tk_getSaveFile" command.
*
*----------------------------------------------------------------------
*/
int
-Tk_GetOpenFileCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_GetOpenFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST *objv) /* Arguments. */
{
Tk_Window tkwin = (Tk_Window)clientData;
if (Tk_StrictMotif(tkwin)) {
- return EvalArgv(interp, "tk::MotifFDialog", argc, argv);
+ return EvalObjv(interp, "tk::MotifOpenFDialog", objc-1, objv+1);
} else {
- return EvalArgv(interp, "tk::FDialog", argc, argv);
+ return EvalObjv(interp, "tk::OpenFDialog", objc-1, objv+1);
}
}
@@ -145,8 +127,7 @@ Tk_GetOpenFileCmd(clientData, interp, argc, argv)
*
* Tk_GetSaveFileCmd --
*
- * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box
- * instead
+ * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box instead.
*
* Results:
* Same as Tk_GetOpenFileCmd.
@@ -158,18 +139,18 @@ Tk_GetOpenFileCmd(clientData, interp, argc, argv)
*/
int
-Tk_GetSaveFileCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_GetSaveFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST *objv) /* Arguments. */
{
Tk_Window tkwin = (Tk_Window)clientData;
if (Tk_StrictMotif(tkwin)) {
- return EvalArgv(interp, "tk::MotifFDialog", argc, argv);
+ return EvalObjv(interp, "tk::MotifSaveFDialog", objc-1, objv+1);
} else {
- return EvalArgv(interp, "tk::FDialog", argc, argv);
+ return EvalObjv(interp, "tk::SaveFDialog", objc-1, objv+1);
}
}
@@ -178,9 +159,8 @@ Tk_GetSaveFileCmd(clientData, interp, argc, argv)
*
* Tk_MessageBoxCmd --
*
- * This procedure implements the MessageBox window for the
- * Unix platform. See the user documentation for details on what
- * it does.
+ * This procedure implements the MessageBox window for the Unix
+ * platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
@@ -193,12 +173,21 @@ Tk_GetSaveFileCmd(clientData, interp, argc, argv)
*/
int
-Tk_MessageBoxCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_MessageBoxCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST *objv) /* Arguments. */
{
- return EvalArgv(interp, "tk::MessageBox", argc, argv);
+ return EvalObjv(interp, "tk::MessageBox", objc-1, objv+1);
}
+#endif /* TK_OBSOLETE_UNIX_DIALOG_WRAPPERS */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c
index 9b84ab1..c0d4d7f 100644
--- a/unix/tkUnixDraw.c
+++ b/unix/tkUnixDraw.c
@@ -1,24 +1,23 @@
-/*
+/*
* tkUnixDraw.c --
*
* This file contains X specific drawing routines.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
-#if !defined(__WIN32__) && !defined(MAC_TCL)
+#if !defined(__WIN32__)
#include "tkUnixInt.h"
#endif
/*
- * The following structure is used to pass information to
- * ScrollRestrictProc from TkScrollWindow.
+ * The following structure is used to pass information to ScrollRestrictProc
+ * from TkScrollWindow.
*/
typedef struct ScrollInfo {
@@ -30,46 +29,46 @@ typedef struct ScrollInfo {
} ScrollInfo;
/*
- * Forward declarations for procedures declared later in this file:
+ * Forward declarations for functions declared later in this file:
*/
-static Tk_RestrictAction ScrollRestrictProc _ANSI_ARGS_((
- ClientData arg, XEvent *eventPtr));
+static Tk_RestrictAction ScrollRestrictProc(ClientData arg, XEvent *eventPtr);
/*
*----------------------------------------------------------------------
*
* TkScrollWindow --
*
- * Scroll a rectangle of the specified window and accumulate
- * damage information in the specified Region.
+ * Scroll a rectangle of the specified window and accumulate damage
+ * information in the specified Region.
*
* Results:
- * Returns 0 if no damage additional damage was generated. Sets
- * damageRgn to contain the damaged areas and returns 1 if
- * GraphicsExpose events were detected.
+ * Returns 0 if no damage additional damage was generated. Sets damageRgn
+ * to contain the damaged areas and returns 1 if GraphicsExpose events
+ * were detected.
*
* Side effects:
- * Scrolls the bits in the window and enters the event loop
- * looking for damage events.
+ * Scrolls the bits in the window and enters the event loop looking for
+ * damage events.
*
*----------------------------------------------------------------------
*/
int
-TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
- Tk_Window tkwin; /* The window to be scrolled. */
- GC gc; /* GC for window to be scrolled. */
- int x, y, width, height; /* Position rectangle to be scrolled. */
- int dx, dy; /* Distance rectangle should be moved. */
- TkRegion damageRgn; /* Region to accumulate damage in. */
+TkScrollWindow(
+ Tk_Window tkwin, /* The window to be scrolled. */
+ GC gc, /* GC for window to be scrolled. */
+ int x, int y, int width, int height,
+ /* Position rectangle to be scrolled. */
+ int dx, int dy, /* Distance rectangle should be moved. */
+ TkRegion damageRgn) /* Region to accumulate damage in. */
{
Tk_RestrictProc *oldProc;
ClientData oldArg, dummy;
ScrollInfo info;
-
+
XCopyArea(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_WindowId(tkwin), gc,
- x, y, (unsigned int) width, (unsigned int) height, x + dx, y + dy);
+ x, y, (unsigned) width, (unsigned) height, x+dx, y+dy);
info.done = 0;
info.window = Tk_WindowId(tkwin);
@@ -79,9 +78,9 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
info.dy = dy;
/*
- * Sync the event stream so all of the expose events will be on the
- * Tk event queue before we start filtering. This avoids busy waiting
- * while we filter events.
+ * Sync the event stream so all of the expose events will be on the Tk
+ * event queue before we start filtering. This avoids busy waiting while
+ * we filter events.
*/
TkpSync(info.display);
@@ -105,9 +104,9 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
* ScrollRestrictProc --
*
* A Tk_RestrictProc used by TkScrollWindow to gather up Expose
- * information into a single damage region. It accumulates damage
- * events on the specified window until a NoExpose or the last
- * GraphicsExpose event is detected.
+ * information into a single damage region. It accumulates damage events
+ * on the specified window until a NoExpose or the last GraphicsExpose
+ * event is detected.
*
* Results:
* None.
@@ -120,9 +119,9 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
*/
static Tk_RestrictAction
-ScrollRestrictProc(arg, eventPtr)
- ClientData arg;
- XEvent *eventPtr;
+ScrollRestrictProc(
+ ClientData arg,
+ XEvent *eventPtr)
{
ScrollInfo *info = (ScrollInfo *) arg;
XRectangle rect;
@@ -150,13 +149,12 @@ ScrollRestrictProc(arg, eventPtr)
info->done = 1;
}
} else if (eventPtr->type == Expose) {
-
/*
- * This case is tricky. This event was already queued before
- * the XCopyArea was issued. If this area overlaps the area
- * being copied, then some of the copied area may be invalid.
- * The easiest way to handle this case is to mark both the
- * original area and the shifted area as damaged.
+ * This case is tricky. This event was already queued before the
+ * XCopyArea was issued. If this area overlaps the area being copied,
+ * then some of the copied area may be invalid. The easiest way to
+ * handle this case is to mark both the original area and the shifted
+ * area as damaged.
*/
rect.x = eventPtr->xexpose.x;
@@ -180,30 +178,30 @@ ScrollRestrictProc(arg, eventPtr)
*
* TkpDrawHighlightBorder --
*
- * This procedure draws a rectangular ring around the outside of
- * a widget to indicate that it has received the input focus.
+ * This function draws a rectangular ring around the outside of a widget
+ * to indicate that it has received the input focus.
*
- * On Unix, we just draw the simple inset ring. On other sytems,
- * e.g. the Mac, the focus ring is a little more complicated, so we
- * need this abstraction.
+ * On Unix, we just draw the simple inset ring. On other sytems, e.g. the
+ * Mac, the focus ring is a little more complicated, so we need this
+ * abstraction.
*
* Results:
* None.
*
* Side effects:
- * A rectangle "width" pixels wide is drawn in "drawable",
- * corresponding to the outer area of "tkwin".
+ * A rectangle "width" pixels wide is drawn in "drawable", corresponding
+ * to the outer area of "tkwin".
*
*----------------------------------------------------------------------
*/
-void
-TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
- Tk_Window tkwin;
- GC fgGC;
- GC bgGC;
- int highlightWidth;
- Drawable drawable;
+void
+TkpDrawHighlightBorder(
+ Tk_Window tkwin,
+ GC fgGC,
+ GC bgGC,
+ int highlightWidth,
+ Drawable drawable)
{
TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
@@ -213,7 +211,7 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
*
* TkpDrawFrame --
*
- * This procedure draws the rectangular frame area.
+ * This function draws the rectangular frame area.
*
* Results:
* None.
@@ -225,12 +223,22 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
*/
void
-TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
- int highlightWidth, int borderWidth, int relief)
+TkpDrawFrame(
+ Tk_Window tkwin,
+ Tk_3DBorder border,
+ int highlightWidth,
+ int borderWidth,
+ int relief)
{
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
- border, highlightWidth, highlightWidth,
- Tk_Width(tkwin) - 2 * highlightWidth,
- Tk_Height(tkwin) - 2 * highlightWidth,
- borderWidth, relief);
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
+ highlightWidth, Tk_Width(tkwin) - 2*highlightWidth,
+ Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index f91187e..5b5f486 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -1,106 +1,102 @@
-/*
+/*
* tkUnixEmbed.c --
*
- * This file contains platform-specific procedures for UNIX to provide
+ * This file contains platform-specific functions for UNIX to provide
* basic operations needed for application embedding (where one
- * application can use as its main window an internal window from
- * some other application).
+ * application can use as its main window an internal window from some
+ * other application).
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkInt.h"
#include "tkUnixInt.h"
/*
* One of the following structures exists for each container in this
- * application. It keeps track of the container window and its
- * associated embedded window.
+ * application. It keeps track of the container window and its associated
+ * embedded window.
*/
typedef struct Container {
- Window parent; /* X's window id for the parent of
- * the pair (the container). */
- Window parentRoot; /* Id for the root window of parent's
- * screen. */
- TkWindow *parentPtr; /* Tk's information about the container,
- * or NULL if the container isn't
- * in this process. */
- Window wrapper; /* X's window id for the wrapper
- * window for the embedded window.
- * Starts off as None, but gets
- * filled in when the window is
- * eventually created. */
- TkWindow *embeddedPtr; /* Tk's information about the embedded
- * window, or NULL if the embedded
- * application isn't in this process.
- * Note that this is *not* the
- * same window as wrapper: wrapper is
- * the parent of embeddedPtr. */
- struct Container *nextPtr; /* Next in list of all containers in
- * this process. */
+ Window parent; /* X's window id for the parent of the pair
+ * (the container). */
+ Window parentRoot; /* Id for the root window of parent's
+ * screen. */
+ TkWindow *parentPtr; /* Tk's information about the container, or
+ * NULL if the container isn't in this
+ * process. */
+ Window wrapper; /* X's window id for the wrapper window for
+ * the embedded window. Starts off as None,
+ * but gets filled in when the window is
+ * eventually created. */
+ TkWindow *embeddedPtr; /* Tk's information about the embedded window,
+ * or NULL if the embedded application isn't
+ * in this process. Note that this is *not*
+ * the same window as wrapper: wrapper is the
+ * parent of embeddedPtr. */
+ struct Container *nextPtr; /* Next in list of all containers in this
+ * process. */
} Container;
typedef struct ThreadSpecificData {
- Container *firstContainerPtr; /* First in list of all containers
- * managed by this process. */
+ Container *firstContainerPtr;
+ /* First in list of all containers managed by
+ * this process. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Prototypes for static procedures defined in this file:
+ * Prototypes for static functions defined in this file:
*/
-static void ContainerEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void EmbeddedEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static int EmbedErrorProc _ANSI_ARGS_((ClientData clientData,
- XErrorEvent *errEventPtr));
-static void EmbedFocusProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbedGeometryRequest _ANSI_ARGS_((
- Container * containerPtr, int width, int height));
-static void EmbedSendConfigure _ANSI_ARGS_((
- Container *containerPtr));
-static void EmbedStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbedWindowDeleted _ANSI_ARGS_((TkWindow *winPtr));
+static void ContainerEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbeddedEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static int EmbedErrorProc(ClientData clientData,
+ XErrorEvent *errEventPtr);
+static void EmbedFocusProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbedGeometryRequest(Container *containerPtr,
+ int width, int height);
+static void EmbedSendConfigure(Container *containerPtr);
+static void EmbedStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbedWindowDeleted(TkWindow *winPtr);
/*
*----------------------------------------------------------------------
*
* TkpUseWindow --
*
- * This procedure causes a Tk window to use a given X window as
- * its parent window, rather than the root window for the screen.
- * It is invoked by an embedded application to specify the window
- * in which it is embedded.
+ * This function causes a Tk window to use a given X window as its parent
+ * window, rather than the root window for the screen. It is invoked by
+ * an embedded application to specify the window in which it is embedded.
*
* Results:
- * The return value is normally TCL_OK. If an error occurs (such
- * as string not being a valid window spec), then the return value
- * is TCL_ERROR and an error message is left in the interp's result if
+ * The return value is normally TCL_OK. If an error occurs (such as
+ * string not being a valid window spec), then the return value is
+ * TCL_ERROR and an error message is left in the interp's result if
* interp is non-NULL.
*
* Side effects:
- * Changes the colormap and other visual information to match that
- * of the parent window given by "string".
+ * Changes the colormap and other visual information to match that of the
+ * parent window given by "string".
*
*----------------------------------------------------------------------
*/
int
-TkpUseWindow(interp, tkwin, string)
- Tcl_Interp *interp; /* If not NULL, used for error reporting
- * if string is bogus. */
- Tk_Window tkwin; /* Tk window that does not yet have an
+TkpUseWindow(
+ Tcl_Interp *interp, /* If not NULL, used for error reporting if
+ * string is bogus. */
+ Tk_Window tkwin, /* Tk window that does not yet have an
* associated X window. */
- CONST char *string; /* String identifying an X window to use
- * for tkwin; must be an integer value. */
+ CONST char *string) /* String identifying an X window to use for
+ * tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *usePtr;
@@ -109,11 +105,13 @@ TkpUseWindow(interp, tkwin, string)
Tk_ErrorHandler handler;
Container *containerPtr;
XWindowAttributes parentAtts;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
- panic("TkUseWindow: X window already assigned");
+ Tcl_AppendResult(interp,
+ "can't modify container after widget is created", NULL);
+ return TCL_ERROR;
}
if (Tcl_GetInt(interp, string, &id) != TCL_OK) {
return TCL_ERROR;
@@ -124,30 +122,30 @@ TkpUseWindow(interp, tkwin, string)
if (usePtr != NULL) {
if (!(usePtr->flags & TK_CONTAINER)) {
Tcl_AppendResult(interp, "window \"", usePtr->pathName,
- "\" doesn't have -container option set", (char *) NULL);
+ "\" doesn't have -container option set", NULL);
return TCL_ERROR;
}
}
/*
* Tk sets the window colormap to the screen default colormap in
- * tkWindow.c:AllocWindow. This doesn't work well for embedded
- * windows. So we override the colormap and visual settings to be
- * the same as the parent window (which is in the container app).
+ * tkWindow.c:AllocWindow. This doesn't work well for embedded windows. So
+ * we override the colormap and visual settings to be the same as the
+ * parent window (which is in the container app).
*/
anyError = 0;
handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
EmbedErrorProc, (ClientData) &anyError);
if (!XGetWindowAttributes(winPtr->display, parent, &parentAtts)) {
- anyError = 1;
+ anyError = 1;
}
XSync(winPtr->display, False);
Tk_DeleteErrorHandler(handler);
if (anyError) {
if (interp != NULL) {
Tcl_AppendResult(interp, "couldn't create child of window \"",
- string, "\"", (char *) NULL);
+ string, "\"", NULL);
}
return TCL_ERROR;
}
@@ -155,18 +153,18 @@ TkpUseWindow(interp, tkwin, string)
parentAtts.colormap);
/*
- * Create an event handler to clean up the Container structure when
- * tkwin is eventually deleted.
+ * Create an event handler to clean up the Container structure when tkwin
+ * is eventually deleted.
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
(ClientData) winPtr);
/*
- * Save information about the container and the embedded window
- * in a Container structure. If there is already an existing
- * Container structure, it means that both container and embedded
- * app. are in the same process.
+ * Save information about the container and the embedded window in a
+ * Container structure. If there is already an existing Container
+ * structure, it means that both container and embedded app. are in the
+ * same process.
*/
for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
@@ -196,8 +194,8 @@ TkpUseWindow(interp, tkwin, string)
*
* TkpMakeWindow --
*
- * Create an actual window system window object based on the
- * current attributes of the specified TkWindow.
+ * Create an actual window system window object based on the current
+ * attributes of the specified TkWindow.
*
* Results:
* Returns the handle to the new window, or None on failure.
@@ -209,28 +207,28 @@ TkpUseWindow(interp, tkwin, string)
*/
Window
-TkpMakeWindow(winPtr, parent)
- TkWindow *winPtr; /* Tk's information about the window that
- * is to be instantiated. */
- Window parent; /* Window system token for the parent in
- * which the window is to be created. */
+TkpMakeWindow(
+ TkWindow *winPtr, /* Tk's information about the window that is
+ * to be instantiated. */
+ Window parent) /* Window system token for the parent in which
+ * the window is to be created. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
/*
- * This window is embedded. Don't create the new window in the
- * given parent; instead, create it as a child of the root window
- * of the container's screen. The window will get reparented
- * into a wrapper window later.
+ * This window is embedded. Don't create the new window in the given
+ * parent; instead, create it as a child of the root window of the
+ * container's screen. The window will get reparented into a wrapper
+ * window later.
*/
for (containerPtr = tsdPtr->firstContainerPtr; ;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
- panic("TkMakeWindow couldn't find container for window");
+ Tcl_Panic("TkMakeWindow couldn't find container for window");
}
if (containerPtr->embeddedPtr == winPtr) {
break;
@@ -252,10 +250,9 @@ TkpMakeWindow(winPtr, parent)
*
* TkpMakeContainer --
*
- * This procedure is called to indicate that a particular window
- * will be a container for an embedded application. This changes
- * certain aspects of the window's behavior, such as whether it
- * will receive events anymore.
+ * This function is called to indicate that a particular window will be a
+ * container for an embedded application. This changes certain aspects of
+ * the window's behavior, such as whether it will receive events anymore.
*
* Results:
* None.
@@ -267,18 +264,18 @@ TkpMakeWindow(winPtr, parent)
*/
void
-TkpMakeContainer(tkwin)
- Tk_Window tkwin; /* Token for a window that is about to
- * become a container. */
+TkpMakeContainer(
+ Tk_Window tkwin) /* Token for a window that is about to become
+ * a container. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Register the window as a container so that, for example, we can
- * find out later if the embedded app. is in the same process.
+ * Register the window as a container so that, for example, we can find
+ * out later if the embedded app. is in the same process.
*/
Tk_MakeWindowExist(tkwin);
@@ -293,10 +290,10 @@ TkpMakeContainer(tkwin)
winPtr->flags |= TK_CONTAINER;
/*
- * Request SubstructureNotify events so that we can find out when
- * the embedded application creates its window or attempts to
- * resize it. Also watch Configure events on the container so that
- * we can resize the child to match.
+ * Request SubstructureNotify events so that we can find out when the
+ * embedded application creates its window or attempts to resize it. Also
+ * watch Configure events on the container so that we can resize the child
+ * to match.
*/
winPtr->atts.event_mask |= SubstructureRedirectMask|SubstructureNotifyMask;
@@ -315,12 +312,11 @@ TkpMakeContainer(tkwin)
*
* EmbedErrorProc --
*
- * This procedure is invoked if an error occurs while creating
- * an embedded window.
+ * This function is invoked if an error occurs while creating an embedded
+ * window.
*
* Results:
- * Always returns 0 to indicate that the error has been properly
- * handled.
+ * Always returns 0 to indicate that the error has been properly handled.
*
* Side effects:
* The integer pointed to by the clientData argument is set to 1.
@@ -329,10 +325,10 @@ TkpMakeContainer(tkwin)
*/
static int
-EmbedErrorProc(clientData, errEventPtr)
- ClientData clientData; /* Points to integer to set. */
- XErrorEvent *errEventPtr; /* Points to information about error
- * (not used). */
+EmbedErrorProc(
+ ClientData clientData, /* Points to integer to set. */
+ XErrorEvent *errEventPtr) /* Points to information about error (not
+ * used). */
{
int *iPtr = (int *) clientData;
@@ -345,9 +341,9 @@ EmbedErrorProc(clientData, errEventPtr)
*
* EmbeddedEventProc --
*
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for a window that is embedded in
- * another application.
+ * This function is invoked by the Tk event dispatcher when various
+ * useful events are received for a window that is embedded in another
+ * application.
*
* Results:
* None.
@@ -360,9 +356,9 @@ EmbedErrorProc(clientData, errEventPtr)
*/
static void
-EmbeddedEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+EmbeddedEventProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
TkWindow *winPtr = (TkWindow *) clientData;
@@ -376,40 +372,40 @@ EmbeddedEventProc(clientData, eventPtr)
*
* ContainerEventProc --
*
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for the children of a container
- * window. It forwards relevant information, such as geometry
- * requests, from the events into the container's application.
+ * This function is invoked by the Tk event dispatcher when various
+ * useful events are received for the children of a container window. It
+ * forwards relevant information, such as geometry requests, from the
+ * events into the container's application.
*
* Results:
* None.
*
* Side effects:
- * Depends on the event. For example, when ConfigureRequest events
- * occur, geometry information gets set for the container window.
+ * Depends on the event. For example, when ConfigureRequest events occur,
+ * geometry information gets set for the container window.
*
*----------------------------------------------------------------------
*/
static void
-ContainerEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+ContainerEventProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
TkWindow *winPtr = (TkWindow *) clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Ignore any X protocol errors that happen in this procedure
- * (almost any operation could fail, for example, if the embedded
- * application has deleted its window).
+ * Ignore any X protocol errors that happen in this function (almost any
+ * operation could fail, for example, if the embedded application has
+ * deleted its window).
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, (ClientData) NULL);
/*
* Find the Container structure associated with the parent window.
@@ -419,37 +415,34 @@ ContainerEventProc(clientData, eventPtr)
containerPtr->parent != eventPtr->xmaprequest.parent;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
- panic("ContainerEventProc couldn't find Container record");
+ Tcl_Panic("ContainerEventProc couldn't find Container record");
}
}
if (eventPtr->type == CreateNotify) {
/*
- * A new child window has been created in the container. Record
- * its id in the Container structure (if more than one child is
- * created, just remember the last one and ignore the earlier
- * ones). Also set the child's size to match the container.
+ * A new child window has been created in the container. Record its id
+ * in the Container structure (if more than one child is created, just
+ * remember the last one and ignore the earlier ones). Also set the
+ * child's size to match the container.
*/
containerPtr->wrapper = eventPtr->xcreatewindow.window;
XMoveResizeWindow(eventPtr->xcreatewindow.display,
containerPtr->wrapper, 0, 0,
- (unsigned int) Tk_Width(
- (Tk_Window) containerPtr->parentPtr),
- (unsigned int) Tk_Height(
- (Tk_Window) containerPtr->parentPtr));
+ (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr),
+ (unsigned) Tk_Height((Tk_Window) containerPtr->parentPtr));
} else if (eventPtr->type == ConfigureRequest) {
if ((eventPtr->xconfigurerequest.x != 0)
|| (eventPtr->xconfigurerequest.y != 0)) {
/*
- * The embedded application is trying to move itself, which
- * isn't legal. At this point, the window hasn't actually
- * moved, but we need to send it a ConfigureNotify event to
- * let it know that its request has been denied. If the
- * embedded application was also trying to resize itself, a
- * ConfigureNotify will be sent by the geometry management
- * code below, so we don't need to do anything. Otherwise,
- * generate a synthetic event.
+ * The embedded application is trying to move itself, which isn't
+ * legal. At this point, the window hasn't actually moved, but we
+ * need to send it a ConfigureNotify event to let it know that its
+ * request has been denied. If the embedded application was also
+ * trying to resize itself, a ConfigureNotify will be sent by the
+ * geometry management code below, so we don't need to do
+ * anything. Otherwise, generate a synthetic event.
*/
if ((eventPtr->xconfigurerequest.width == winPtr->changes.width)
@@ -464,15 +457,15 @@ ContainerEventProc(clientData, eventPtr)
} else if (eventPtr->type == MapRequest) {
/*
* The embedded application's map request was ignored and simply
- * passed on to us, so we have to map the window for it to appear
- * on the screen.
+ * passed on to us, so we have to map the window for it to appear on
+ * the screen.
*/
XMapWindow(eventPtr->xmaprequest.display,
eventPtr->xmaprequest.window);
} else if (eventPtr->type == DestroyNotify) {
/*
- * The embedded application is gone. Destroy the container window.
+ * The embedded application is gone. Destroy the container window.
*/
Tk_DestroyWindow((Tk_Window) winPtr);
@@ -485,11 +478,10 @@ ContainerEventProc(clientData, eventPtr)
*
* EmbedStructureProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * a container window owned by this application gets resized
- * (and also at several other times that we don't care about).
- * This procedure reflects the size change in the embedded
- * window that corresponds to the container.
+ * This function is invoked by the Tk event dispatcher when a container
+ * window owned by this application gets resized (and also at several
+ * other times that we don't care about). This function reflects the size
+ * change in the embedded window that corresponds to the container.
*
* Results:
* None.
@@ -501,9 +493,9 @@ ContainerEventProc(clientData, eventPtr)
*/
static void
-EmbedStructureProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+EmbedStructureProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
Container *containerPtr = (Container *) clientData;
Tk_ErrorHandler errHandler;
@@ -516,13 +508,11 @@ EmbedStructureProc(clientData, eventPtr)
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, (ClientData) NULL);
XMoveResizeWindow(eventPtr->xconfigure.display,
containerPtr->wrapper, 0, 0,
- (unsigned int) Tk_Width(
- (Tk_Window) containerPtr->parentPtr),
- (unsigned int) Tk_Height(
- (Tk_Window) containerPtr->parentPtr));
+ (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr),
+ (unsigned) Tk_Height((Tk_Window) containerPtr->parentPtr));
Tk_DeleteErrorHandler(errHandler);
}
} else if (eventPtr->type == DestroyNotify) {
@@ -535,11 +525,10 @@ EmbedStructureProc(clientData, eventPtr)
*
* EmbedFocusProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * FocusIn and FocusOut events occur for a container window owned
- * by this application. It is responsible for moving the focus
- * back and forth between a container application and an embedded
- * application.
+ * This function is invoked by the Tk event dispatcher when FocusIn and
+ * FocusOut events occur for a container window owned by this
+ * application. It is responsible for moving the focus back and forth
+ * between a container application and an embedded application.
*
* Results:
* None.
@@ -551,9 +540,9 @@ EmbedStructureProc(clientData, eventPtr)
*/
static void
-EmbedFocusProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+EmbedFocusProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
Container *containerPtr = (Container *) clientData;
Tk_ErrorHandler errHandler;
@@ -562,15 +551,15 @@ EmbedFocusProc(clientData, eventPtr)
display = Tk_Display(containerPtr->parentPtr);
if (eventPtr->type == FocusIn) {
/*
- * The focus just arrived at the container. Change the X focus
- * to move it to the embedded application, if there is one.
- * Ignore X errors that occur during this operation (it's
- * possible that the new focus window isn't mapped).
+ * The focus just arrived at the container. Change the X focus to move
+ * it to the embedded application, if there is one. Ignore X errors
+ * that occur during this operation (it's possible that the new focus
+ * window isn't mapped).
*/
-
+
if (containerPtr->wrapper != None) {
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, (ClientData) NULL);
XSetInputFocus(display, containerPtr->wrapper, RevertToParent,
CurrentTime);
Tk_DeleteErrorHandler(errHandler);
@@ -583,38 +572,38 @@ EmbedFocusProc(clientData, eventPtr)
*
* EmbedGeometryRequest --
*
- * This procedure is invoked when an embedded application requests
- * a particular size. It processes the request (which may or may
- * not actually honor the request) and reflects the results back
- * to the embedded application.
+ * This function is invoked when an embedded application requests a
+ * particular size. It processes the request (which may or may not
+ * actually honor the request) and reflects the results back to the
+ * embedded application.
*
* Results:
* None.
*
* Side effects:
- * If we deny the child's size change request, a Configure event
- * is synthesized to let the child know how big it ought to be.
- * Events get processed while we're waiting for the geometry
- * managers to do their thing.
+ * If we deny the child's size change request, a Configure event is
+ * synthesized to let the child know how big it ought to be. Events get
+ * processed while we're waiting for the geometry managers to do their
+ * thing.
*
*----------------------------------------------------------------------
*/
static void
-EmbedGeometryRequest(containerPtr, width, height)
- Container *containerPtr; /* Information about the embedding. */
- int width, height; /* Size that the child has requested. */
+EmbedGeometryRequest(
+ Container *containerPtr, /* Information about the embedding. */
+ int width, int height) /* Size that the child has requested. */
{
TkWindow *winPtr = containerPtr->parentPtr;
/*
- * Forward the requested size into our geometry management hierarchy
- * via the container window. We need to send a Configure event back
- * to the embedded application if we decide not to honor its
- * request; to make this happen, process all idle event handlers
- * synchronously here (so that the geometry managers have had a
- * chance to do whatever they want to do), and if the window's size
- * didn't change then generate a configure event.
+ * Forward the requested size into our geometry management hierarchy via
+ * the container window. We need to send a Configure event back to the
+ * embedded application if we decide not to honor its request; to make
+ * this happen, process all idle event handlers synchronously here (so
+ * that the geometry managers have had a chance to do whatever they want
+ * to do), and if the window's size didn't change then generate a
+ * configure event.
*/
Tk_GeometryRequest((Tk_Window) winPtr, width, height);
@@ -632,11 +621,11 @@ EmbedGeometryRequest(containerPtr, width, height)
*
* EmbedSendConfigure --
*
- * This procedure synthesizes a ConfigureNotify event to notify an
- * embedded application of its current size and location. This
- * procedure is called when the embedded application made a
- * geometry request that we did not grant, so that the embedded
- * application knows that its geometry didn't change after all.
+ * This function synthesizes a ConfigureNotify event to notify an
+ * embedded application of its current size and location. This function
+ * is called when the embedded application made a geometry request that
+ * we did not grant, so that the embedded application knows that its
+ * geometry didn't change after all.
*
* Results:
* None.
@@ -648,15 +637,14 @@ EmbedGeometryRequest(containerPtr, width, height)
*/
static void
-EmbedSendConfigure(containerPtr)
- Container *containerPtr; /* Information about the embedding. */
+EmbedSendConfigure(
+ Container *containerPtr) /* Information about the embedding. */
{
TkWindow *winPtr = containerPtr->parentPtr;
XEvent event;
event.xconfigure.type = ConfigureNotify;
- event.xconfigure.serial =
- LastKnownRequestProcessed(winPtr->display);
+ event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display);
event.xconfigure.send_event = True;
event.xconfigure.display = winPtr->display;
event.xconfigure.event = containerPtr->wrapper;
@@ -669,24 +657,23 @@ EmbedSendConfigure(containerPtr)
event.xconfigure.override_redirect = False;
/*
- * Note: when sending the event below, the ButtonPressMask
- * causes the event to be sent only to applications that have
- * selected for ButtonPress events, which should be just the
- * embedded application.
+ * Note: when sending the event below, the ButtonPressMask causes the
+ * event to be sent only to applications that have selected for
+ * ButtonPress events, which should be just the embedded application.
*/
XSendEvent(winPtr->display, containerPtr->wrapper, False,
0, &event);
/*
- * The following needs to be done if the embedded window is
- * not in the same application as the container window.
+ * The following needs to be done if the embedded window is not in the
+ * same application as the container window.
*/
if (containerPtr->embeddedPtr == NULL) {
XMoveResizeWindow(winPtr->display, containerPtr->wrapper, 0, 0,
- (unsigned int) winPtr->changes.width,
- (unsigned int) winPtr->changes.height);
+ (unsigned) winPtr->changes.width,
+ (unsigned) winPtr->changes.height);
}
}
@@ -695,13 +682,13 @@ EmbedSendConfigure(containerPtr)
*
* TkpGetOtherWindow --
*
- * If both the container and embedded window are in the same
- * process, this procedure will return either one, given the other.
+ * If both the container and embedded window are in the same process,
+ * this function will return either one, given the other.
*
* Results:
* If winPtr is a container, the return value is the token for the
- * embedded window, and vice versa. If the "other" window isn't in
- * this process, NULL is returned.
+ * embedded window, and vice versa. If the "other" window isn't in this
+ * process, NULL is returned.
*
* Side effects:
* None.
@@ -710,15 +697,15 @@ EmbedSendConfigure(containerPtr)
*/
TkWindow *
-TkpGetOtherWindow(winPtr)
- TkWindow *winPtr; /* Tk's structure for a container or
- * embedded window. */
+TkpGetOtherWindow(
+ TkWindow *winPtr) /* Tk's structure for a container or embedded
+ * window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = tsdPtr->firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
@@ -735,13 +722,13 @@ TkpGetOtherWindow(winPtr)
*
* TkpRedirectKeyEvent --
*
- * This procedure is invoked when a key press or release event
- * arrives for an application that does not believe it owns the
- * input focus. This can happen because of embedding; for example,
- * X can send an event to an embedded application when the real
- * focus window is in the container application and is an ancestor
- * of the container. This procedure's job is to forward the event
- * back to the application where it really belongs.
+ * This function is invoked when a key press or release event arrives for
+ * an application that does not believe it owns the input focus. This can
+ * happen because of embedding; for example, X can send an event to an
+ * embedded application when the real focus window is in the container
+ * application and is an ancestor of the container. This function's job
+ * is to forward the event back to the application where it really
+ * belongs.
*
* Results:
* None.
@@ -753,15 +740,15 @@ TkpGetOtherWindow(winPtr)
*/
void
-TkpRedirectKeyEvent(winPtr, eventPtr)
- TkWindow *winPtr; /* Window to which the event was originally
+TkpRedirectKeyEvent(
+ TkWindow *winPtr, /* Window to which the event was originally
* reported. */
- XEvent *eventPtr; /* X event to redirect (should be KeyPress
- * or KeyRelease). */
+ XEvent *eventPtr) /* X event to redirect (should be KeyPress or
+ * KeyRelease). */
{
Container *containerPtr;
Window saved;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -771,8 +758,8 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
while (1) {
if (winPtr == NULL) {
/*
- * This window is being deleted. This is too confusing a
- * case to handle so discard the event.
+ * This window is being deleted. This is too confusing a case to
+ * handle so discard the event.
*/
return;
@@ -785,10 +772,10 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
if (winPtr->flags & TK_EMBEDDED) {
/*
- * This application is embedded. If we got a key event without
- * officially having the focus, it means that the focus is
- * really in the container, but the mouse was over the embedded
- * application. Send the event back to the container.
+ * This application is embedded. If we got a key event without
+ * officially having the focus, it means that the focus is really in
+ * the container, but the mouse was over the embedded application.
+ * Send the event back to the container.
*/
for (containerPtr = tsdPtr->firstContainerPtr;
@@ -799,7 +786,7 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
saved = eventPtr->xkey.window;
eventPtr->xkey.window = containerPtr->parent;
XSendEvent(eventPtr->xkey.display, eventPtr->xkey.window, False,
- KeyPressMask|KeyReleaseMask, eventPtr);
+ KeyPressMask|KeyReleaseMask, eventPtr);
eventPtr->xkey.window = saved;
}
}
@@ -809,10 +796,10 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
*
* TkpClaimFocus --
*
- * This procedure is invoked when someone asks or the input focus
- * to be put on a window in an embedded application, but the
- * application doesn't currently have the focus. It requests the
- * input focus from the container application.
+ * This function is invoked when someone asks or the input focus to be
+ * put on a window in an embedded application, but the application
+ * doesn't currently have the focus. It requests the input focus from the
+ * container application.
*
* Results:
* None.
@@ -824,16 +811,16 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
*/
void
-TkpClaimFocus(topLevelPtr, force)
- TkWindow *topLevelPtr; /* Top-level window containing desired
- * focus window; should be embedded. */
- int force; /* One means that the container should
- * claim the focus if it doesn't
- * currently have it. */
+TkpClaimFocus(
+ TkWindow *topLevelPtr, /* Top-level window containing desired focus
+ * window; should be embedded. */
+ int force) /* One means that the container should claim
+ * the focus if it doesn't currently have
+ * it. */
{
XEvent event;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
@@ -861,9 +848,8 @@ TkpClaimFocus(topLevelPtr, force)
*
* TkpTestembedCmd --
*
- * This procedure implements the "testembed" command. It returns
- * some or all of the information in the list pointed to by
- * firstContainerPtr.
+ * This function implements the "testembed" command. It returns some or
+ * all of the information in the list pointed to by firstContainerPtr.
*
* Results:
* A standard Tcl result.
@@ -875,17 +861,17 @@ TkpClaimFocus(topLevelPtr, force)
*/
int
-TkpTestembedCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TkpTestembedCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
int all;
Container *containerPtr;
Tcl_DString dString;
char buffer[50];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((argc > 1) && (strcmp(argv[1], "all") == 0)) {
@@ -899,13 +885,11 @@ TkpTestembedCmd(clientData, interp, argc, argv)
Tcl_DStringStartSublist(&dString);
if (containerPtr->parent == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->parent);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->parent);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->parentPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -915,13 +899,11 @@ TkpTestembedCmd(clientData, interp, argc, argv)
}
if (containerPtr->wrapper == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->wrapper);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->wrapper);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->embeddedPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -940,9 +922,9 @@ TkpTestembedCmd(clientData, interp, argc, argv)
*
* EmbedWindowDeleted --
*
- * This procedure is invoked when a window involved in embedding
- * (as either the container or the embedded application) is
- * destroyed. It cleans up the Container structure for the window.
+ * This function is invoked when a window involved in embedding (as
+ * either the container or the embedded application) is destroyed. It
+ * cleans up the Container structure for the window.
*
* Results:
* None.
@@ -954,16 +936,16 @@ TkpTestembedCmd(clientData, interp, argc, argv)
*/
static void
-EmbedWindowDeleted(winPtr)
- TkWindow *winPtr; /* Tk's information about window that
- * was deleted. */
+EmbedWindowDeleted(
+ TkWindow *winPtr) /* Tk's information about window that was
+ * deleted. */
{
Container *containerPtr, *prevPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Find the Container structure for this window work. Delete the
+ * Find the Container structure for this window work. Delete the
* information about the embedded application and free the container's
* record.
*/
@@ -999,12 +981,12 @@ EmbedWindowDeleted(winPtr)
*
* TkUnixContainerId --
*
- * Given an embedded window, this procedure returns the X window
+ * Given an embedded window, this function returns the X window
* identifier for the associated container window.
*
* Results:
- * The return value is the X window identifier for winPtr's
- * container window.
+ * The return value is the X window identifier for winPtr's container
+ * window.
*
* Side effects:
* None.
@@ -1013,19 +995,27 @@ EmbedWindowDeleted(winPtr)
*/
Window
-TkUnixContainerId(winPtr)
- TkWindow *winPtr; /* Tk's structure for an embedded window. */
+TkUnixContainerId(
+ TkWindow *winPtr) /* Tk's structure for an embedded window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = tsdPtr->firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parent;
}
}
- panic("TkUnixContainerId couldn't find window");
+ Tcl_Panic("TkUnixContainerId couldn't find window");
return None;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 60800d2..09dde72 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -1,22 +1,21 @@
-/*
+/*
* tkUnixEvent.c --
*
- * This file implements an event source for X displays for the
- * UNIX version of Tk.
+ * This file implements an event source for X displays for the UNIX
+ * version of Tk.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkInt.h"
#include "tkUnixInt.h"
#include <signal.h>
/*
- * The following static indicates whether this module has been initialized
- * in the current thread.
+ * The following static indicates whether this module has been initialized in
+ * the current thread.
*/
typedef struct ThreadSpecificData {
@@ -24,42 +23,26 @@ typedef struct ThreadSpecificData {
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-#if defined(TK_USE_INPUT_METHODS) && defined(PEEK_XCLOSEIM)
/*
- * Structure used to peek into internal XIM data structure.
- * This is only known to work with XFree86.
+ * Prototypes for functions that are referenced only in this file:
*/
-struct XIMPeek {
- void *junk1, *junk2;
- XIC ic_chain;
-};
-#endif
-/*
- * Prototypes for procedures that are referenced only in this file:
- */
-
-static void DisplayCheckProc _ANSI_ARGS_((ClientData clientData,
- int flags));
-static void DisplayExitHandler _ANSI_ARGS_((
- ClientData clientData));
-static void DisplayFileProc _ANSI_ARGS_((ClientData clientData,
- int flags));
-static void DisplaySetupProc _ANSI_ARGS_((ClientData clientData,
- int flags));
-static void TransferXEventsToTcl _ANSI_ARGS_((Display *display));
+static void DisplayCheckProc(ClientData clientData, int flags);
+static void DisplayExitHandler(ClientData clientData);
+static void DisplayFileProc(ClientData clientData, int flags);
+static void DisplaySetupProc(ClientData clientData, int flags);
+static void TransferXEventsToTcl(Display *display);
#ifdef TK_USE_INPUT_METHODS
-static void OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
+static void OpenIM(TkDisplay *dispPtr);
#endif
-
/*
*----------------------------------------------------------------------
*
* TkCreateXEventSource --
*
- * This procedure is called during Tk initialization to create
- * the event source for X Window events.
+ * This function is called during Tk initialization to create the event
+ * source for X Window events.
*
* Results:
* None.
@@ -71,10 +54,10 @@ static void OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
*/
void
-TkCreateXEventSource()
+TkCreateXEventSource(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
@@ -88,8 +71,8 @@ TkCreateXEventSource()
*
* DisplayExitHandler --
*
- * This function is called during finalization to clean up the
- * display module.
+ * This function is called during finalization to clean up the display
+ * module.
*
* Results:
* None.
@@ -101,11 +84,11 @@ TkCreateXEventSource()
*/
static void
-DisplayExitHandler(clientData)
- ClientData clientData; /* Not used. */
+DisplayExitHandler(
+ ClientData clientData) /* Not used. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL);
tsdPtr->initialized = 0;
@@ -116,8 +99,8 @@ DisplayExitHandler(clientData)
*
* TkpOpenDisplay --
*
- * Allocates a new TkDisplay, opens the X display, and establishes
- * the file handler for the connection.
+ * Allocates a new TkDisplay, opens the X display, and establishes the
+ * file handler for the connection.
*
* Results:
* A pointer to a Tk display structure.
@@ -129,11 +112,11 @@ DisplayExitHandler(clientData)
*/
TkDisplay *
-TkpOpenDisplay(display_name)
- CONST char *display_name;
+TkpOpenDisplay(
+ CONST char *displayNameStr)
{
TkDisplay *dispPtr;
- Display *display = XOpenDisplay(display_name);
+ Display *display = XOpenDisplay(displayNameStr);
if (display == NULL) {
return NULL;
@@ -154,7 +137,7 @@ TkpOpenDisplay(display_name)
*
* TkpCloseDisplay --
*
- * Cancels notifier callbacks and closes a display.
+ * Cancels notifier callbacks and closes a display.
*
* Results:
* None.
@@ -166,8 +149,8 @@ TkpOpenDisplay(display_name)
*/
void
-TkpCloseDisplay(dispPtr)
- TkDisplay *dispPtr;
+TkpCloseDisplay(
+ TkDisplay *dispPtr)
{
TkSendCleanup(dispPtr);
@@ -176,55 +159,10 @@ TkpCloseDisplay(dispPtr)
TkWmCleanup(dispPtr);
#ifdef TK_USE_INPUT_METHODS
-#if TK_XIM_SPOT
if (dispPtr->inputXfs) {
XFreeFontSet(dispPtr->display, dispPtr->inputXfs);
}
-#endif
if (dispPtr->inputMethod) {
- /*
- * Calling XCloseIM with an input context that has not
- * been freed can cause a crash. This crash has been
- * reproduced under Linux systems with XFree86 3.3
- * and may have also been seen under Solaris 2.3.
- * The crash is caused by a double free of memory
- * inside the X library. Memory that was already
- * deallocated may be accessed again inside XCloseIM.
- * This bug can be avoided by making sure that a
- * call to XDestroyIC is made for each XCreateIC call.
- * This bug has been fixed in XFree86 4.2.99.2.
- * The internal layout of the XIM structure changed
- * in the XFree86 4.2 release so the test should
- * not be run for with these new releases.
- */
-
-#if defined(TK_USE_INPUT_METHODS) && defined(PEEK_XCLOSEIM)
- int do_peek = 0;
- struct XIMPeek *peek;
-
- if (strstr(ServerVendor(dispPtr->display), "XFree86")) {
- int vendrel = VendorRelease(dispPtr->display);
- if (vendrel < 336) {
- /* 3.3.4 and 3.3.5 */
- do_peek = 1;
- } else if (vendrel < 3900) {
- /* Other 3.3.x versions */
- do_peek = 1;
- } else if (vendrel < 40000000) {
- /* 4.0.x versions */
- do_peek = 1;
- } else {
- /* Newer than 4.0 */
- do_peek = 0;
- }
- }
-
- if (do_peek) {
- peek = (struct XIMPeek *) dispPtr->inputMethod;
- if (peek->ic_chain != NULL)
- panic("input contexts not freed before XCloseIM");
- }
-#endif
XCloseIM(dispPtr->inputMethod);
}
#endif
@@ -241,11 +179,10 @@ TkpCloseDisplay(dispPtr)
*
* TkClipCleanup --
*
- * This procedure is called to cleanup resources associated with
- * claiming clipboard ownership and for receiving selection get
- * results. This function is called in tkWindow.c. This has to be
- * called by the display cleanup function because we still need the
- * access display elements.
+ * This function is called to cleanup resources associated with claiming
+ * clipboard ownership and for receiving selection get results. This
+ * function is called in tkWindow.c. This has to be called by the display
+ * cleanup function because we still need the access display elements.
*
* Results:
* None.
@@ -257,8 +194,8 @@ TkpCloseDisplay(dispPtr)
*/
void
-TkClipCleanup(dispPtr)
- TkDisplay *dispPtr; /* display associated with clipboard */
+TkClipCleanup(
+ TkDisplay *dispPtr) /* Display associated with clipboard */
{
if (dispPtr->clipWindow != NULL) {
Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
@@ -277,25 +214,25 @@ TkClipCleanup(dispPtr)
*
* DisplaySetupProc --
*
- * This procedure implements the setup part of the UNIX X display
- * event source. It is invoked by Tcl_DoOneEvent before entering
- * the notifier to check for events on all displays.
+ * This function implements the setup part of the UNIX X display event
+ * source. It is invoked by Tcl_DoOneEvent before entering the notifier
+ * to check for events on all displays.
*
* Results:
* None.
*
* Side effects:
- * If data is queued on a display inside Xlib, then the maximum
- * block time will be set to 0 to ensure that the notifier returns
- * control to Tcl even if there is no more data on the X connection.
+ * If data is queued on a display inside Xlib, then the maximum block
+ * time will be set to 0 to ensure that the notifier returns control to
+ * Tcl even if there is no more data on the X connection.
*
*----------------------------------------------------------------------
*/
static void
-DisplaySetupProc(clientData, flags)
- ClientData clientData; /* Not used. */
- int flags;
+DisplaySetupProc(
+ ClientData clientData, /* Not used. */
+ int flags)
{
TkDisplay *dispPtr;
static Tcl_Time blockTime = { 0, 0 };
@@ -305,13 +242,11 @@ DisplaySetupProc(clientData, flags)
}
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
- dispPtr = dispPtr->nextPtr) {
-
+ dispPtr = dispPtr->nextPtr) {
/*
- * Flush the display. If data is pending on the X queue, set
- * the block time to zero. This ensures that we won't block
- * in the notifier if there is data in the X queue, but not on
- * the server socket.
+ * Flush the display. If data is pending on the X queue, set the block
+ * time to zero. This ensures that we won't block in the notifier if
+ * there is data in the X queue, but not on the server socket.
*/
XFlush(dispPtr->display);
@@ -324,9 +259,9 @@ DisplaySetupProc(clientData, flags)
/*
*----------------------------------------------------------------------
*
- * TransferXEventsToTcl
+ * TransferXEventsToTcl --
*
- * Transfer events from the X event queue to the Tk event queue.
+ * Transfer events from the X event queue to the Tk event queue.
*
* Results:
* None.
@@ -338,25 +273,72 @@ DisplaySetupProc(clientData, flags)
*/
static void
-TransferXEventsToTcl(display)
- Display *display;
+TransferXEventsToTcl(
+ Display *display)
{
- XEvent event;
+ union {
+ int type;
+ XEvent x;
+ TkKeyEvent k;
+ } event;
+ Window w;
+ TkDisplay *dispPtr = NULL;
/*
- * Transfer events from the X event queue to the Tk event queue
- * after XIM event filtering. KeyPress and KeyRelease events
- * are filtered in Tk_HandleEvent instead of here, so that Tk's
- * focus management code can redirect them.
+ * Transfer events from the X event queue to the Tk event queue after XIM
+ * event filtering. KeyPress and KeyRelease events need special treatment
+ * so that they get directed according to Tk's focus rules during XIM
+ * handling. Theoretically they can go to the wrong place still (if
+ * there's a focus change in the queue) but if we push the handling off
+ * until Tk_HandleEvent then many input methods actually cease to work
+ * correctly. Most of the time, Tk processes its event queue fast enough
+ * for this to not be an issue anyway. [Bug 1924761]
*/
+
while (QLength(display) > 0) {
- XNextEvent(display, &event);
- if (event.type != KeyPress && event.type != KeyRelease) {
- if (XFilterEvent(&event, None)) {
- continue;
+ XNextEvent(display, &event.x);
+ w = None;
+ if (event.type == KeyPress || event.type == KeyRelease) {
+ for (dispPtr = TkGetDisplayList(); ; dispPtr = dispPtr->nextPtr) {
+ if (dispPtr == NULL) {
+ break;
+ } else if (dispPtr->display == event.x.xany.display) {
+ if (dispPtr->focusPtr != NULL) {
+ w = dispPtr->focusPtr->window;
+ }
+ break;
+ }
}
}
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ if (XFilterEvent(&event.x, w)) {
+ continue;
+ }
+ if (event.type == KeyPress || event.type == KeyRelease) {
+ event.k.charValuePtr = NULL;
+ event.k.charValueLen = 0;
+ event.k.keysym = NoSymbol;
+
+ /*
+ * Force the calling of the input method engine now. The results
+ * from it will be cached in the event so that they don't get lost
+ * (to a race condition with other XIM-handled key events) between
+ * entering the event queue and getting serviced. [Bug 1924761]
+ */
+
+#ifdef TK_USE_INPUT_METHODS
+ if (event.type == KeyPress && dispPtr &&
+ (dispPtr->flags & TK_DISPLAY_USE_IM)) {
+ if (dispPtr->focusPtr && dispPtr->focusPtr->inputContext) {
+ Tcl_DString ds;
+
+ Tcl_DStringInit(&ds);
+ (void) TkpGetString(dispPtr->focusPtr, &event.x, &ds);
+ Tcl_DStringFree(&ds);
+ }
+ }
+#endif
+ }
+ Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
}
}
@@ -365,8 +347,7 @@ TransferXEventsToTcl(display)
*
* DisplayCheckProc --
*
- * This procedure checks for events sitting in the X event
- * queue.
+ * This function checks for events sitting in the X event queue.
*
* Results:
* None.
@@ -378,9 +359,9 @@ TransferXEventsToTcl(display)
*/
static void
-DisplayCheckProc(clientData, flags)
- ClientData clientData; /* Not used. */
- int flags;
+DisplayCheckProc(
+ ClientData clientData, /* Not used. */
+ int flags)
{
TkDisplay *dispPtr;
@@ -389,7 +370,7 @@ DisplayCheckProc(clientData, flags)
}
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
- dispPtr = dispPtr->nextPtr) {
+ dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
TransferXEventsToTcl(dispPtr->display);
}
@@ -400,22 +381,22 @@ DisplayCheckProc(clientData, flags)
*
* DisplayFileProc --
*
- * This procedure implements the file handler for the X connection.
+ * This function implements the file handler for the X connection.
*
* Results:
* None.
*
* Side effects:
- * Makes entries on the Tcl event queue for all the events available
- * from all the displays.
+ * Makes entries on the Tcl event queue for all the events available from
+ * all the displays.
*
*----------------------------------------------------------------------
*/
static void
-DisplayFileProc(clientData, flags)
- ClientData clientData; /* The display pointer. */
- int flags; /* Should be TCL_READABLE. */
+DisplayFileProc(
+ ClientData clientData, /* The display pointer. */
+ int flags) /* Should be TCL_READABLE. */
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
Display *display = dispPtr->display;
@@ -424,38 +405,34 @@ DisplayFileProc(clientData, flags)
XFlush(display);
numFound = XEventsQueued(display, QueuedAfterReading);
if (numFound == 0) {
-
/*
- * Things are very tricky if there aren't any events readable
- * at this point (after all, there was supposedly data
- * available on the connection). A couple of things could
- * have occurred:
- *
- * One possibility is that there were only error events in the
- * input from the server. If this happens, we should return
- * (we don't want to go to sleep in XNextEvent below, since
- * this would block out other sources of input to the
- * process).
+ * Things are very tricky if there aren't any events readable at this
+ * point (after all, there was supposedly data available on the
+ * connection). A couple of things could have occurred:
+ *
+ * One possibility is that there were only error events in the input
+ * from the server. If this happens, we should return (we don't want
+ * to go to sleep in XNextEvent below, since this would block out
+ * other sources of input to the process).
*
- * Another possibility is that our connection to the server
- * has been closed. This will not necessarily be detected in
- * XEventsQueued (!!), so if we just return then there will be
- * an infinite loop. To detect such an error, generate a NoOp
- * protocol request to exercise the connection to the server,
- * then return. However, must disable SIGPIPE while sending
- * the request, or else the process will die from the signal
- * and won't invoke the X error function to print a nice (?!)
- * message.
+ * Another possibility is that our connection to the server has been
+ * closed. This will not necessarily be detected in XEventsQueued (!!)
+ * so if we just return then there will be an infinite loop. To detect
+ * such an error, generate a NoOp protocol request to exercise the
+ * connection to the server, then return. However, must disable
+ * SIGPIPE while sending the request, or else the process will die
+ * from the signal and won't invoke the X error function to print a
+ * nice (?!) message.
*/
-
+
void (*oldHandler)();
-
+
oldHandler = (void (*)()) signal(SIGPIPE, SIG_IGN);
XNoOp(display);
XFlush(display);
(void) signal(SIGPIPE, oldHandler);
}
-
+
TransferXEventsToTcl(display);
}
@@ -481,8 +458,8 @@ DisplayFileProc(clientData, flags)
*/
int
-TkUnixDoOneXEvent(timePtr)
- Tcl_Time *timePtr; /* Specifies the absolute time when the call
+TkUnixDoOneXEvent(
+ Tcl_Time *timePtr) /* Specifies the absolute time when the call
* should time out. */
{
TkDisplay *dispPtr;
@@ -490,10 +467,10 @@ TkUnixDoOneXEvent(timePtr)
struct timeval blockTime, *timeoutPtr;
Tcl_Time now;
int fd, index, numFound, numFdBits = 0;
- fd_mask bit;
+ fd_mask bit, *readMaskPtr = readMask;
/*
- * Look for queued events first.
+ * Look for queued events first.
*/
if (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {
@@ -507,7 +484,7 @@ TkUnixDoOneXEvent(timePtr)
*/
if (timePtr) {
- TclpGetTime(&now);
+ Tcl_GetTime(&now);
blockTime.tv_sec = timePtr->sec;
blockTime.tv_usec = timePtr->usec - now.usec;
if (blockTime.tv_usec < 0) {
@@ -530,7 +507,7 @@ TkUnixDoOneXEvent(timePtr)
* pending, then we want to poll instead of blocking.
*/
- memset((VOID *) readMask, 0, MASK_SIZE*sizeof(fd_mask));
+ memset(readMask, 0, MASK_SIZE*sizeof(fd_mask));
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
@@ -539,11 +516,6 @@ TkUnixDoOneXEvent(timePtr)
blockTime.tv_usec = 0;
}
fd = ConnectionNumber(dispPtr->display);
-
- /*
- * Assume there are always at least 'fd' bits in the 'readMask' array.
- */
-
index = fd/(NBBY*sizeof(fd_mask));
bit = ((fd_mask)1) << (fd%(NBBY*sizeof(fd_mask)));
readMask[index] |= bit;
@@ -552,7 +524,7 @@ TkUnixDoOneXEvent(timePtr)
}
}
- numFound = select(numFdBits, (SELECT_MASK *) &readMask[0], NULL, NULL,
+ numFound = select(numFdBits, (SELECT_MASK *) readMaskPtr, NULL, NULL,
timeoutPtr);
if (numFound <= 0) {
/*
@@ -560,7 +532,7 @@ TkUnixDoOneXEvent(timePtr)
* it here.
*/
- memset((VOID *) readMask, 0, MASK_SIZE*sizeof(fd_mask));
+ memset(readMask, 0, MASK_SIZE*sizeof(fd_mask));
}
/*
@@ -585,7 +557,7 @@ TkUnixDoOneXEvent(timePtr)
*/
if (timePtr) {
- TclpGetTime(&now);
+ Tcl_GetTime(&now);
if ((now.sec > timePtr->sec) || ((now.sec == timePtr->sec)
&& (now.usec > timePtr->usec))) {
return 0;
@@ -605,9 +577,9 @@ TkUnixDoOneXEvent(timePtr)
*
* TkpSync --
*
- * This routine ensures that all pending X requests have been
- * seen by the server, and that any pending X events have been
- * moved onto the Tk event queue.
+ * This routine ensures that all pending X requests have been seen by the
+ * server, and that any pending X events have been moved onto the Tk
+ * event queue.
*
* Results:
* None.
@@ -619,30 +591,29 @@ TkUnixDoOneXEvent(timePtr)
*/
void
-TkpSync(display)
- Display *display; /* Display to sync. */
+TkpSync(
+ Display *display) /* Display to sync. */
{
XSync(display, False);
/*
* Transfer events from the X event queue to the Tk event queue.
*/
+
TransferXEventsToTcl(display);
}
#ifdef TK_USE_INPUT_METHODS
-/*
+/*
*--------------------------------------------------------------
*
* OpenIM --
*
- * Tries to open an X input method, associated with the
- * given display. Right now we can only deal with a bare-bones
- * input style: no preedit, and no status.
+ * Tries to open an X input method associated with the given display.
*
* Results:
- * Stores the input method in dispPtr->inputMethod; if there isn't
- * a suitable input method, then NULL is stored in dispPtr->inputMethod.
+ * Stores the input method in dispPtr->inputMethod; if there isn't a
+ * suitable input method, then NULL is stored in dispPtr->inputMethod.
*
* Side effects:
* An input method gets opened.
@@ -651,14 +622,15 @@ TkpSync(display)
*/
static void
-OpenIM(dispPtr)
- TkDisplay *dispPtr; /* Tk's structure for the display. */
+OpenIM(
+ TkDisplay *dispPtr) /* Tk's structure for the display. */
{
- unsigned short i;
+ int i;
XIMStyles *stylePtr;
+ XIMStyle bestStyle = 0;
if (XSetLocaleModifiers("") == NULL) {
- goto error;
+ return;
}
dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
@@ -667,41 +639,59 @@ OpenIM(dispPtr)
}
if ((XGetIMValues(dispPtr->inputMethod, XNQueryInputStyle, &stylePtr,
- NULL) != NULL) || (stylePtr == NULL)) {
+ (void *) NULL) != NULL) || (stylePtr == NULL)) {
goto error;
}
-#if TK_XIM_SPOT
+
/*
- * If we want to do over-the-spot XIM, we have to check that this
- * mode is supported. If not we will fall-through to the check below.
+ * Select the best input style supported by both the IM and Tk.
*/
for (i = 0; i < stylePtr->count_styles; i++) {
- if (stylePtr->supported_styles[i]
- == (XIMPreeditPosition | XIMStatusNothing)) {
- dispPtr->flags |= TK_DISPLAY_XIM_SPOT;
- XFree(stylePtr);
- return;
+ XIMStyle thisStyle = stylePtr->supported_styles[i];
+ if (thisStyle == (XIMPreeditPosition | XIMStatusNothing)) {
+ bestStyle = thisStyle;
+ break;
+ } else if (thisStyle == (XIMPreeditNothing | XIMStatusNothing)) {
+ bestStyle = thisStyle;
}
}
-#endif
- for (i = 0; i < stylePtr->count_styles; i++) {
- if (stylePtr->supported_styles[i]
- == (XIMPreeditNothing | XIMStatusNothing)) {
- XFree(stylePtr);
- return;
+ XFree(stylePtr);
+ if (bestStyle == 0) {
+ goto error;
+ }
+
+ dispPtr->inputStyle = bestStyle;
+
+ /*
+ * Create an XFontSet for preedit area.
+ */
+ if (dispPtr->inputStyle & XIMPreeditPosition) {
+ char **missing_list;
+ int missing_count;
+ char *def_string;
+
+ dispPtr->inputXfs = XCreateFontSet(dispPtr->display,
+ "-*-*-*-R-Normal--14-130-75-75-*-*",
+ &missing_list, &missing_count, &def_string);
+ if (missing_count > 0) {
+ XFreeStringList(missing_list);
}
}
- XFree(stylePtr);
- error:
+ return;
+error:
if (dispPtr->inputMethod) {
- /*
- * This call should not suffer from any core dumping problems
- * since we have not allocated any input contexts.
- */
XCloseIM(dispPtr->inputMethod);
dispPtr->inputMethod = NULL;
}
}
#endif /* TK_USE_INPUT_METHODS */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixFocus.c b/unix/tkUnixFocus.c
index 78807a0..0767618 100644
--- a/unix/tkUnixFocus.c
+++ b/unix/tkUnixFocus.c
@@ -1,8 +1,8 @@
-/*
+/*
* tkUnixFocus.c --
*
- * This file contains platform specific procedures that manage
- * focus for Tk.
+ * This file contains platform specific functions that manage focus for
+ * Tk.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
*
@@ -10,8 +10,6 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkInt.h"
-#include "tkPort.h"
#include "tkUnixInt.h"
@@ -20,46 +18,44 @@
*
* TkpChangeFocus --
*
- * This procedure is invoked to move the official X focus from
- * one window to another.
+ * This function is invoked to move the official X focus from one window
+ * to another.
*
* Results:
- * The return value is the serial number of the command that
- * changed the focus. It may be needed by the caller to filter
- * out focus change events that were queued before the command.
- * If the procedure doesn't actually change the focus then
- * it returns 0.
+ * The return value is the serial number of the command that changed the
+ * focus. It may be needed by the caller to filter out focus change
+ * events that were queued before the command. If the function doesn't
+ * actually change the focus then it returns 0.
*
* Side effects:
- * The official X focus window changes; the application's focus
- * window isn't changed by this procedure.
+ * The official X focus window changes; the application's focus window
+ * isn't changed by this function.
*
*----------------------------------------------------------------------
*/
int
-TkpChangeFocus(winPtr, force)
- TkWindow *winPtr; /* Window that is to receive the X focus. */
- int force; /* Non-zero means claim the focus even
- * if it didn't originally belong to
- * topLevelPtr's application. */
+TkpChangeFocus(
+ TkWindow *winPtr, /* Window that is to receive the X focus. */
+ int force) /* Non-zero means claim the focus even if it
+ * didn't originally belong to topLevelPtr's
+ * application. */
{
TkDisplay *dispPtr = winPtr->dispPtr;
Tk_ErrorHandler errHandler;
- Window window, root, parent, *children;
- unsigned int numChildren, serial;
+ Window window, root, parent, *children;
+ unsigned int numChildren, serial;
TkWindow *winPtr2;
int dummy;
/*
- * Don't set the X focus to a window that's marked
- * override-redirect. This is a hack to avoid problems with menus
- * under olvwm: if we move the focus then the focus can get lost
- * during keyboard traversal. Fortunately, we don't really need to
- * move the focus for menus: events will still find their way to the
- * focus window, and menus aren't decorated anyway so the window
- * manager doesn't need to hear about the focus change in order to
- * redecorate the menu.
+ * Don't set the X focus to a window that's marked override-redirect.
+ * This is a hack to avoid problems with menus under olvwm: if we move
+ * the focus then the focus can get lost during keyboard traversal.
+ * Fortunately, we don't really need to move the focus for menus: events
+ * will still find their way to the focus window, and menus aren't
+ * decorated anyway so the window manager doesn't need to hear about the
+ * focus change in order to redecorate the menu.
*/
serial = 0;
@@ -68,19 +64,19 @@ TkpChangeFocus(winPtr, force)
}
/*
- * Check to make sure that the focus is still in one of the windows
- * of this application or one of their descendants. Furthermore,
- * grab the server to make sure that the focus doesn't change in the
- * middle of this operation.
+ * Check to make sure that the focus is still in one of the windows of
+ * this application or one of their descendants. Furthermore, grab the
+ * server to make sure that the focus doesn't change in the middle of this
+ * operation.
*/
XGrabServer(dispPtr->display);
if (!force) {
/*
- * Find the focus window, then see if it or one of its ancestors
- * is a window in our application (it's possible that the focus
- * window is in an embedded application, which may or may not be
- * in the same process.
+ * Find the focus window, then see if it or one of its ancestors is a
+ * window in our application (it's possible that the focus window is
+ * in an embedded application, which may or may not be in the same
+ * process.
*/
XGetInputFocus(dispPtr->display, &window, &dummy);
@@ -105,42 +101,49 @@ TkpChangeFocus(winPtr, force)
}
/*
- * Tell X to change the focus. Ignore errors that occur when changing
- * the focus: it is still possible that the window we're focussing
- * to could have gotten unmapped, which will generate an error.
+ * Tell X to change the focus. Ignore errors that occur when changing the
+ * focus: it is still possible that the window we're focussing to could
+ * have gotten unmapped, which will generate an error.
*/
- errHandler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ errHandler = Tk_CreateErrorHandler(dispPtr->display, -1,-1,-1, NULL,NULL);
if (winPtr->window == None) {
- panic("ChangeXFocus got null X window");
+ Tcl_Panic("ChangeXFocus got null X window");
}
XSetInputFocus(dispPtr->display, winPtr->window, RevertToParent,
CurrentTime);
Tk_DeleteErrorHandler(errHandler);
/*
- * Remember the current serial number for the X server and issue
- * a dummy server request. This marks the position at which we
- * changed the focus, so we can distinguish FocusIn and FocusOut
- * events on either side of the mark.
+ * Remember the current serial number for the X server and issue a dummy
+ * server request. This marks the position at which we changed the focus,
+ * so we can distinguish FocusIn and FocusOut events on either side of the
+ * mark.
*/
serial = NextRequest(winPtr->display);
XNoOp(winPtr->display);
- done:
+ done:
XUngrabServer(dispPtr->display);
/*
* After ungrabbing the server, it's important to flush the output
- * immediately so that the server sees the ungrab command. Otherwise
- * we might do something else that needs to communicate with the
- * server (such as invoking a subprocess that needs to do I/O to
- * the screen); if the ungrab command is still sitting in our
- * output buffer, we could deadlock.
+ * immediately so that the server sees the ungrab command. Otherwise we
+ * might do something else that needs to communicate with the server (such
+ * as invoking a subprocess that needs to do I/O to the screen); if the
+ * ungrab command is still sitting in our output buffer, we could
+ * deadlock.
*/
XFlush(dispPtr->display);
return serial;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 2b8d99d..897770b 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -1,15 +1,15 @@
/*
* tkUnixFont.c --
*
- * Contains the Unix implementation of the platform-independant
- * font package interface.
+ * Contains the Unix implementation of the platform-independent font
+ * package interface.
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-
+
#include "tkUnixInt.h"
#include "tkFont.h"
#include <netinet/in.h> /* for htons() prototype */
@@ -24,26 +24,26 @@ static CONST char *encodingList[] = {
};
/*
- * The following structure represents a font family. It is assumed that
- * all screen fonts constructed from the same "font family" share certain
- * properties; all screen fonts with the same "font family" point to a
- * shared instance of this structure. The most important shared property
- * is the character existence metrics, used to determine if a screen font
- * can display a given Unicode character.
+ * The following structure represents a font family. It is assumed that all
+ * screen fonts constructed from the same "font family" share certain
+ * properties; all screen fonts with the same "font family" point to a shared
+ * instance of this structure. The most important shared property is the
+ * character existence metrics, used to determine if a screen font can display
+ * a given Unicode character.
*
* Under Unix, there are three attributes that uniquely identify a "font
- * family": the foundry, face name, and charset.
+ * family": the foundry, face name, and charset.
*/
#define FONTMAP_SHIFT 10
-#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
+#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
typedef struct FontFamily {
struct FontFamily *nextPtr; /* Next in list of all known font families. */
int refCount; /* How many SubFonts are referring to this
- * FontFamily. When the refCount drops to
+ * FontFamily. When the refCount drops to
* zero, this FontFamily may be freed. */
/*
* Key.
@@ -57,58 +57,57 @@ typedef struct FontFamily {
* Derived properties.
*/
- int isTwoByteFont; /* 1 if this is a double-byte font, 0
+ int isTwoByteFont; /* 1 if this is a double-byte font, 0
* otherwise. */
char *fontMap[FONTMAP_PAGES];
/* Two-level sparse table used to determine
* quickly if the specified character exists.
* As characters are encountered, more pages
- * in this table are dynamically alloced. The
+ * in this table are dynamically alloced. The
* contents of each page is a bitmask
* consisting of FONTMAP_BITSPERPAGE bits,
* representing whether this font can be used
* to display the given character at the
- * corresponding bit position. The high bits
+ * corresponding bit position. The high bits
* of the character are used to pick which
* page of the table is used. */
} FontFamily;
/*
- * The following structure encapsulates an individual screen font. A font
+ * The following structure encapsulates an individual screen font. A font
* object is made up of however many SubFonts are necessary to display a
* stream of multilingual characters.
*/
typedef struct SubFont {
- char **fontMap; /* Pointer to font map from the FontFamily,
+ char **fontMap; /* Pointer to font map from the FontFamily,
* cached here to save a dereference. */
- XFontStruct *fontStructPtr; /* The specific screen font that will be
- * used when displaying/measuring chars
- * belonging to the FontFamily. */
+ XFontStruct *fontStructPtr; /* The specific screen font that will be used
+ * when displaying/measuring chars belonging
+ * to the FontFamily. */
FontFamily *familyPtr; /* The FontFamily for this SubFont. */
} SubFont;
/*
- * The following structure represents Unix's implementation of a font
- * object.
+ * The following structure represents Unix's implementation of a font object.
*/
-
+
#define SUBFONT_SPACE 3
#define BASE_CHARS 256
typedef struct UnixFont {
- TkFont font; /* Stuff used by generic font package. Must
- * be first in structure. */
+ TkFont font; /* Stuff used by generic font package. Must be
+ * first in structure. */
SubFont staticSubFonts[SUBFONT_SPACE];
/* Builtin space for a limited number of
* SubFonts. */
int numSubFonts; /* Length of following array. */
- SubFont *subFontArray; /* Array of SubFonts that have been loaded
- * in order to draw/measure all the characters
- * encountered by this font so far. All fonts
+ SubFont *subFontArray; /* Array of SubFonts that have been loaded in
+ * order to draw/measure all the characters
+ * encountered by this font so far. All fonts
* start off with one SubFont initialized by
* AllocFont() from the original set of font
- * attributes. Usually points to
+ * attributes. Usually points to
* staticSubFonts, but may point to malloced
* space if there are lots of SubFonts. */
SubFont controlSubFont; /* Font to use to display control-character
@@ -120,51 +119,50 @@ typedef struct UnixFont {
TkXLFDAttributes xa; /* Additional attributes that specify the
* preferred foundry and encoding to use when
* constructing additional SubFonts. */
- int widths[BASE_CHARS]; /* Widths of first 256 chars in the base
- * font, for handling common case. */
- int underlinePos; /* Offset from baseline to origin of
- * underline bar (used when drawing underlined
- * font) (pixels). */
- int barHeight; /* Height of underline or overstrike bar
- * (used when drawing underlined or strikeout
- * font) (pixels). */
+ int widths[BASE_CHARS]; /* Widths of first 256 chars in the base font,
+ * for handling common case. */
+ int underlinePos; /* Offset from baseline to origin of underline
+ * bar (used when drawing underlined font)
+ * (pixels). */
+ int barHeight; /* Height of underline or overstrike bar (used
+ * when drawing underlined or strikeout font)
+ * (pixels). */
} UnixFont;
/*
* The following structure and definition is used to keep track of the
- * alternative names for various encodings. Asking for an encoding that
+ * alternative names for various encodings. Asking for an encoding that
* matches one of the alias patterns will result in actually getting the
* encoding by its real name.
*/
-
+
typedef struct EncodingAlias {
char *realName; /* The real name of the encoding to load if
* the provided name matched the pattern. */
- char *aliasPattern; /* Pattern for encoding name, of the form
- * that is acceptable to Tcl_StringMatch. */
+ char *aliasPattern; /* Pattern for encoding name, of the form that
+ * is acceptable to Tcl_StringMatch. */
} EncodingAlias;
/*
* Just some utility structures used for passing around values in helper
- * procedures.
+ * functions.
*/
-
+
typedef struct FontAttributes {
TkFontAttributes fa;
TkXLFDAttributes xa;
} FontAttributes;
-
typedef struct ThreadSpecificData {
- FontFamily *fontFamilyList; /* The list of font families that are
- * currently loaded. As screen fonts
- * are loaded, this list grows to hold
- * information about what characters
- * exist in each font family. */
- FontFamily controlFamily; /* FontFamily used to handle control
- * character expansions. The encoding
- * of this FontFamily converts UTF-8 to
- * backslashed escape sequences. */
+ FontFamily *fontFamilyList; /* The list of font families that are
+ * currently loaded. As screen fonts are
+ * loaded, this list grows to hold information
+ * about what characters exist in each font
+ * family. */
+ FontFamily controlFamily; /* FontFamily used to handle control character
+ * expansions. The encoding of this FontFamily
+ * converts UTF-8 to backslashed escape
+ * sequences. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -172,7 +170,7 @@ static Tcl_ThreadDataKey dataKey;
* The set of builtin encoding alises to convert the XLFD names for the
* encodings into the names expected by the Tcl encoding package.
*/
-
+
static EncodingAlias encodingAliases[] = {
{"gb2312-raw", "gb2312*"},
{"big5", "big5*"},
@@ -200,83 +198,73 @@ static EncodingAlias encodingAliases[] = {
};
/*
- * Procedures used only in this file.
+ * Functions used only in this file.
*/
-static void FontPkgCleanup _ANSI_ARGS_((ClientData clientData));
-static FontFamily * AllocFontFamily _ANSI_ARGS_((Display *display,
- XFontStruct *fontStructPtr, int base));
-static SubFont * CanUseFallback _ANSI_ARGS_((UnixFont *fontPtr,
+static void FontPkgCleanup(ClientData clientData);
+static FontFamily * AllocFontFamily(Display *display,
+ XFontStruct *fontStructPtr, int base);
+static SubFont * CanUseFallback(UnixFont *fontPtr,
CONST char *fallbackName, int ch,
- SubFont **fixSubFontPtrPtr));
-static SubFont * CanUseFallbackWithAliases _ANSI_ARGS_((
- UnixFont *fontPtr, char *fallbackName,
- int ch, Tcl_DString *nameTriedPtr,
- SubFont **fixSubFontPtrPtr));
-static int ControlUtfProc _ANSI_ARGS_((ClientData clientData,
- CONST char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst,
- int dstLen, int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr));
-static XFontStruct * CreateClosestFont _ANSI_ARGS_((Tk_Window tkwin,
+ SubFont **fixSubFontPtrPtr);
+static SubFont * CanUseFallbackWithAliases(UnixFont *fontPtr,
+ char *fallbackName, int ch,
+ Tcl_DString *nameTriedPtr,
+ SubFont **fixSubFontPtrPtr);
+static int ControlUtfProc(ClientData clientData, CONST char *src,
+ int srcLen, int flags, Tcl_EncodingState*statePtr,
+ char *dst, int dstLen, int *srcReadPtr,
+ int *dstWrotePtr, int *dstCharsPtr);
+static XFontStruct * CreateClosestFont(Tk_Window tkwin,
CONST TkFontAttributes *faPtr,
- CONST TkXLFDAttributes *xaPtr));
-static SubFont * FindSubFontForChar _ANSI_ARGS_((UnixFont *fontPtr,
- int ch, SubFont **fixSubFontPtrPtr));
-static void FontMapInsert _ANSI_ARGS_((SubFont *subFontPtr,
- int ch));
-static void FontMapLoadPage _ANSI_ARGS_((SubFont *subFontPtr,
- int row));
-static int FontMapLookup _ANSI_ARGS_((SubFont *subFontPtr,
- int ch));
-static void FreeFontFamily _ANSI_ARGS_((FontFamily *afPtr));
-static CONST char * GetEncodingAlias _ANSI_ARGS_((CONST char *name));
-static int GetFontAttributes _ANSI_ARGS_((Display *display,
- XFontStruct *fontStructPtr, FontAttributes *faPtr));
-static XFontStruct * GetScreenFont _ANSI_ARGS_((Display *display,
+ CONST TkXLFDAttributes *xaPtr);
+static SubFont * FindSubFontForChar(UnixFont *fontPtr, int ch,
+ SubFont **fixSubFontPtrPtr);
+static void FontMapInsert(SubFont *subFontPtr, int ch);
+static void FontMapLoadPage(SubFont *subFontPtr, int row);
+static int FontMapLookup(SubFont *subFontPtr, int ch);
+static void FreeFontFamily(FontFamily *afPtr);
+static CONST char * GetEncodingAlias(CONST char *name);
+static int GetFontAttributes(Display *display,
+ XFontStruct *fontStructPtr, FontAttributes *faPtr);
+static XFontStruct * GetScreenFont(Display *display,
FontAttributes *wantPtr, char **nameList,
- int bestIdx[], unsigned int bestScore[]));
-static XFontStruct * GetSystemFont _ANSI_ARGS_((Display *display));
-static int IdentifySymbolEncodings _ANSI_ARGS_((
- FontAttributes *faPtr));
-static void InitFont _ANSI_ARGS_((Tk_Window tkwin,
- XFontStruct *fontStructPtr, UnixFont *fontPtr));
-static void InitSubFont _ANSI_ARGS_((Display *display,
+ int bestIdx[], unsigned int bestScore[]);
+static XFontStruct * GetSystemFont(Display *display);
+static int IdentifySymbolEncodings(FontAttributes *faPtr);
+static void InitFont(Tk_Window tkwin, XFontStruct *fontStructPtr,
+ UnixFont *fontPtr);
+static void InitSubFont(Display *display,
XFontStruct *fontStructPtr, int base,
- SubFont *subFontPtr));
-static char ** ListFonts _ANSI_ARGS_((Display *display,
- CONST char *faceName, int *numNamesPtr));
-static char ** ListFontOrAlias _ANSI_ARGS_((Display *display,
- CONST char *faceName, int *numNamesPtr));
-static unsigned int RankAttributes _ANSI_ARGS_((FontAttributes *wantPtr,
- FontAttributes *gotPtr));
-static void ReleaseFont _ANSI_ARGS_((UnixFont *fontPtr));
-static void ReleaseSubFont _ANSI_ARGS_((Display *display,
- SubFont *subFontPtr));
-static int SeenName _ANSI_ARGS_((CONST char *name,
- Tcl_DString *dsPtr));
+ SubFont *subFontPtr);
+static char ** ListFonts(Display *display, CONST char *faceName,
+ int *numNamesPtr);
+static char ** ListFontOrAlias(Display *display, CONST char*faceName,
+ int *numNamesPtr);
+static unsigned int RankAttributes(FontAttributes *wantPtr,
+ FontAttributes *gotPtr);
+static void ReleaseFont(UnixFont *fontPtr);
+static void ReleaseSubFont(Display *display, SubFont *subFontPtr);
+static int SeenName(CONST char *name, Tcl_DString *dsPtr);
#ifndef WORDS_BIGENDIAN
-static int Ucs2beToUtfProc _ANSI_ARGS_((ClientData clientData,
- CONST char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
- int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr));
-static int UtfToUcs2beProc _ANSI_ARGS_((ClientData clientData,
- CONST char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
- int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr));
+static int Ucs2beToUtfProc(ClientData clientData, CONST char*src,
+ int srcLen, int flags, Tcl_EncodingState*statePtr,
+ char *dst, int dstLen, int *srcReadPtr,
+ int *dstWrotePtr, int *dstCharsPtr);
+static int UtfToUcs2beProc(ClientData clientData, CONST char*src,
+ int srcLen, int flags, Tcl_EncodingState*statePtr,
+ char *dst, int dstLen, int *srcReadPtr,
+ int *dstWrotePtr, int *dstCharsPtr);
#endif
-
/*
*-------------------------------------------------------------------------
*
* FontPkgCleanup --
*
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the
- * platform-dependent code on a per application basis.
+ * This function is called when an application is created. It initializes
+ * all the structures that are used by the platform-dependent code on a
+ * per application basis.
*
* Results:
* None.
@@ -288,11 +276,12 @@ static int UtfToUcs2beProc _ANSI_ARGS_((ClientData clientData,
*/
static void
-FontPkgCleanup(ClientData clientData)
+FontPkgCleanup(
+ ClientData clientData)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
if (tsdPtr->controlFamily.encoding != NULL) {
FontFamily *familyPtr = &tsdPtr->controlFamily;
int i;
@@ -312,9 +301,9 @@ FontPkgCleanup(ClientData clientData)
*
* TkpFontPkgInit --
*
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the
- * platform-dependent code on a per application basis.
+ * This function is called when an application is created. It initializes
+ * all the structures that are used by the platform-dependent code on a
+ * per application basis.
*
* Results:
* None.
@@ -326,22 +315,22 @@ FontPkgCleanup(ClientData clientData)
*/
void
-TkpFontPkgInit(mainPtr)
- TkMainInfo *mainPtr; /* The application being created. */
+TkpFontPkgInit(
+ TkMainInfo *mainPtr) /* The application being created. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_EncodingType type;
SubFont dummy;
int i;
if (tsdPtr->controlFamily.encoding == NULL) {
- type.encodingName = "X11ControlChars";
- type.toUtfProc = ControlUtfProc;
- type.fromUtfProc = ControlUtfProc;
- type.freeProc = NULL;
- type.clientData = NULL;
- type.nullSize = 0;
+ type.encodingName = "X11ControlChars";
+ type.toUtfProc = ControlUtfProc;
+ type.fromUtfProc = ControlUtfProc;
+ type.freeProc = NULL;
+ type.clientData = NULL;
+ type.nullSize = 0;
tsdPtr->controlFamily.refCount = 2;
tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type);
@@ -356,16 +345,16 @@ TkpFontPkgInit(mainPtr)
#ifndef WORDS_BIGENDIAN
/*
- * UCS-2BE is unicode (UCS-2) in big-endian format. Define this
- * if native order isn't BE. It is used in iso10646 fonts.
+ * UCS-2BE is unicode (UCS-2) in big-endian format. Define this if
+ * native order isn't BE. It is used in iso10646 fonts.
*/
- type.encodingName = "ucs-2be";
- type.toUtfProc = Ucs2beToUtfProc;
- type.fromUtfProc = UtfToUcs2beProc;
- type.freeProc = NULL;
- type.clientData = NULL;
- type.nullSize = 2;
+ type.encodingName = "ucs-2be";
+ type.toUtfProc = Ucs2beToUtfProc;
+ type.fromUtfProc = UtfToUcs2beProc;
+ type.freeProc = NULL;
+ type.clientData = NULL;
+ type.nullSize = 2;
Tcl_CreateEncoding(&type);
#endif
Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL);
@@ -377,8 +366,7 @@ TkpFontPkgInit(mainPtr)
*
* ControlUtfProc --
*
- * Convert from UTF-8 into the ASCII expansion of a control
- * character.
+ * Convert from UTF-8 into the ASCII expansion of a control character.
*
* Results:
* Returns TCL_OK if conversion was successful.
@@ -389,31 +377,30 @@ TkpFontPkgInit(mainPtr)
*-------------------------------------------------------------------------
*/
-static int
-ControlUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
- srcReadPtr, dstWrotePtr, dstCharsPtr)
- ClientData clientData; /* Not used. */
- CONST char *src; /* Source string in UTF-8. */
- int srcLen; /* Source string length in bytes. */
- int flags; /* Conversion control flags. */
- Tcl_EncodingState *statePtr;/* Place for conversion routine to store
- * state information used during a piecewise
- * conversion. Contents of statePtr are
+static int
+ControlUtfProc(
+ ClientData clientData, /* Not used. */
+ CONST char *src, /* Source string in UTF-8. */
+ int srcLen, /* Source string length in bytes. */
+ int flags, /* Conversion control flags. */
+ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
+ * information used during a piecewise
+ * conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
- char *dst; /* Output buffer in which converted string
- * is stored. */
- int dstLen; /* The maximum length of output buffer in
+ char *dst, /* Output buffer in which converted string is
+ * stored. */
+ int dstLen, /* The maximum length of output buffer in
* bytes. */
- int *srcReadPtr; /* Filled with the number of bytes from the
- * source string that were converted. This
- * may be less than the original source length
- * if there was a problem converting some
- * source characters. */
- int *dstWrotePtr; /* Filled with the number of bytes that were
+ int *srcReadPtr, /* Filled with the number of bytes from the
+ * source string that were converted. This may
+ * be less than the original source length if
+ * there was a problem converting some source
+ * characters. */
+ int *dstWrotePtr, /* Filled with the number of bytes that were
* stored in the output buffer as a result of
* the conversion. */
- int *dstCharsPtr; /* Filled with the number of characters that
+ int *dstCharsPtr) /* Filled with the number of characters that
* correspond to the bytes stored in the
* output buffer. */
{
@@ -483,31 +470,30 @@ ControlUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
*-------------------------------------------------------------------------
*/
-static int
-Ucs2beToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
- srcReadPtr, dstWrotePtr, dstCharsPtr)
- ClientData clientData; /* Not used. */
- CONST char *src; /* Source string in Unicode. */
- int srcLen; /* Source string length in bytes. */
- int flags; /* Conversion control flags. */
- Tcl_EncodingState *statePtr;/* Place for conversion routine to store
- * state information used during a piecewise
- * conversion. Contents of statePtr are
+static int
+Ucs2beToUtfProc(
+ ClientData clientData, /* Not used. */
+ CONST char *src, /* Source string in Unicode. */
+ int srcLen, /* Source string length in bytes. */
+ int flags, /* Conversion control flags. */
+ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
+ * information used during a piecewise
+ * conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
- char *dst; /* Output buffer in which converted string
- * is stored. */
- int dstLen; /* The maximum length of output buffer in
+ char *dst, /* Output buffer in which converted string is
+ * stored. */
+ int dstLen, /* The maximum length of output buffer in
* bytes. */
- int *srcReadPtr; /* Filled with the number of bytes from the
- * source string that were converted. This
- * may be less than the original source length
- * if there was a problem converting some
- * source characters. */
- int *dstWrotePtr; /* Filled with the number of bytes that were
+ int *srcReadPtr, /* Filled with the number of bytes from the
+ * source string that were converted. This may
+ * be less than the original source length if
+ * there was a problem converting some source
+ * characters. */
+ int *dstWrotePtr, /* Filled with the number of bytes that were
* stored in the output buffer as a result of
* the conversion. */
- int *dstCharsPtr; /* Filled with the number of characters that
+ int *dstCharsPtr) /* Filled with the number of characters that
* correspond to the bytes stored in the
* output buffer. */
{
@@ -534,10 +520,12 @@ Ucs2beToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
result = TCL_CONVERT_NOSPACE;
break;
}
+
/*
* Need to swap byte-order on little-endian machines (x86) for
- * UCS-2BE. We know this is an LE->BE swap.
+ * UCS-2BE. We know this is an LE->BE swap.
*/
+
dst += Tcl_UniCharToUtf(htons(*((short *)src)), dst);
src += 2 /* sizeof(UCS-2) */;
}
@@ -564,31 +552,31 @@ Ucs2beToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
*-------------------------------------------------------------------------
*/
-static int
-UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
- srcReadPtr, dstWrotePtr, dstCharsPtr)
- ClientData clientData; /* TableEncodingData that specifies encoding. */
- CONST char *src; /* Source string in UTF-8. */
- int srcLen; /* Source string length in bytes. */
- int flags; /* Conversion control flags. */
- Tcl_EncodingState *statePtr;/* Place for conversion routine to store
- * state information used during a piecewise
- * conversion. Contents of statePtr are
+static int
+UtfToUcs2beProc(
+ ClientData clientData, /* TableEncodingData that specifies
+ * encoding. */
+ CONST char *src, /* Source string in UTF-8. */
+ int srcLen, /* Source string length in bytes. */
+ int flags, /* Conversion control flags. */
+ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
+ * information used during a piecewise
+ * conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
- char *dst; /* Output buffer in which converted string
- * is stored. */
- int dstLen; /* The maximum length of output buffer in
+ char *dst, /* Output buffer in which converted string is
+ * stored. */
+ int dstLen, /* The maximum length of output buffer in
* bytes. */
- int *srcReadPtr; /* Filled with the number of bytes from the
- * source string that were converted. This
- * may be less than the original source length
- * if there was a problem converting some
- * source characters. */
- int *dstWrotePtr; /* Filled with the number of bytes that were
+ int *srcReadPtr, /* Filled with the number of bytes from the
+ * source string that were converted. This may
+ * be less than the original source length if
+ * there was a problem converting some source
+ * characters. */
+ int *dstWrotePtr, /* Filled with the number of bytes that were
* stored in the output buffer as a result of
* the conversion. */
- int *dstCharsPtr; /* Filled with the number of characters that
+ int *dstCharsPtr) /* Filled with the number of characters that
* correspond to the bytes stored in the
* output buffer. */
{
@@ -604,7 +592,7 @@ UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
}
dstStart = dst;
- dstEnd = dst + dstLen - 2 /* sizeof(UCS-2) */;
+ dstEnd = dst + dstLen - 2 /* sizeof(UCS-2) */;
result = TCL_OK;
for (numChars = 0; src < srcEnd; numChars++) {
@@ -622,12 +610,13 @@ UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
break;
}
src += Tcl_UtfToUniChar(src, &ch);
+
/*
* Ensure big-endianness (store big bits first).
- * XXX: This hard-codes the assumed size of Tcl_UniChar as 2.
- * Make sure to work in char* for Tcl_UtfToUniChar alignment.
- * [Bug 1122671]
+ * XXX: This hard-codes the assumed size of Tcl_UniChar as 2. Make
+ * sure to work in char* for Tcl_UtfToUniChar alignment. [Bug 1122671]
*/
+
*dst++ = (ch >> 8);
*dst++ = (ch & 0xFF);
}
@@ -646,28 +635,28 @@ UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
* Map a platform-specific native font name to a TkFont.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * native font. If a native font by the given name could not be
- * found, the return value is NULL.
+ * The return value is a pointer to a TkFont that represents the native
+ * font. If a native font by the given name could not be found, the
+ * return value is NULL.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the name has already been seen before. The caller should
- * call TkpDeleteFont() when the font is no longer needed.
+ * Every call to this function returns a new TkFont structure, even if
+ * the name has already been seen before. The caller should call
+ * TkpDeleteFont() when the font is no longer needed.
*
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generic TkFont before calling TkpDeleteFont().
+ * The caller is responsible for initializing the memory associated with
+ * the generic TkFont when this function returns and releasing the
+ * contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
* Memory allocated.
*
*---------------------------------------------------------------------------
*/
-
+
TkFont *
-TkpGetNativeFont(tkwin, name)
- Tk_Window tkwin; /* For display where font will be used. */
- CONST char *name; /* Platform-specific font name. */
+TkpGetNativeFont(
+ Tk_Window tkwin, /* For display where font will be used. */
+ CONST char *name) /* Platform-specific font name. */
{
UnixFont *fontPtr;
XFontStruct *fontStructPtr;
@@ -679,8 +668,8 @@ TkpGetNativeFont(tkwin, name)
* The behavior of X when given a name that isn't an XLFD is unspecified.
* For example, Exceed 6 returns a valid font for any random string. This
* is awkward since system names have higher priority than the other Tk
- * font syntaxes. So, we need to perform a quick sanity check on the
- * name and fail if it looks suspicious. We fail if the name:
+ * font syntaxes. So, we need to perform a quick sanity check on the name
+ * and fail if it looks suspicious. We fail if the name:
* - contains a space immediately before a dash
* - contains a space, but no '*' characters and fewer than 14 dashes
*/
@@ -705,18 +694,18 @@ TkpGetNativeFont(tkwin, name)
fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), name);
if (fontStructPtr == NULL) {
/*
- * Handle all names that look like XLFDs here. Otherwise, when
- * TkpGetFontFromAttributes is called from generic code, any
- * foundry or encoding information specified in the XLFD will have
- * been parsed out and lost. But make sure we don't have an
- * "-option value" string since TkFontParseXLFD would return a
- * false success when attempting to parse it.
+ * Handle all names that look like XLFDs here. Otherwise, when
+ * TkpGetFontFromAttributes is called from generic code, any foundry
+ * or encoding information specified in the XLFD will have been parsed
+ * out and lost. But make sure we don't have an "-option value" string
+ * since TkFontParseXLFD would return a false success when attempting
+ * to parse it.
*/
if (name[0] == '-') {
if (name[1] != '*') {
char *dash;
-
+
dash = strchr(name + 1, '-');
if ((dash == NULL) || (isspace(UCHAR(dash[-1])))) {
return NULL;
@@ -739,41 +728,42 @@ TkpGetNativeFont(tkwin, name)
/*
*---------------------------------------------------------------------------
*
- * TkpGetFontFromAttributes --
+ * TkpGetFontFromAttributes --
*
- * Given a desired set of attributes for a font, find a font with
- * the closest matching attributes.
+ * Given a desired set of attributes for a font, find a font with the
+ * closest matching attributes.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * font with the desired attributes. If a font with the desired
- * attributes could not be constructed, some other font will be
- * substituted automatically.
+ * The return value is a pointer to a TkFont that represents the font
+ * with the desired attributes. If a font with the desired attributes
+ * could not be constructed, some other font will be substituted
+ * automatically.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the specified attributes have already been seen before.
- * The caller should call TkpDeleteFont() to free the platform-
- * specific data when the font is no longer needed.
+ * Every call to this function returns a new TkFont structure, even if
+ * the specified attributes have already been seen before. The caller
+ * should call TkpDeleteFont() to free the platform- specific data when
+ * the font is no longer needed.
*
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generic TkFont before calling TkpDeleteFont().
+ * The caller is responsible for initializing the memory associated with
+ * the generic TkFont when this function returns and releasing the
+ * contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
* Memory allocated.
*
*---------------------------------------------------------------------------
*/
+
TkFont *
-TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
- TkFont *tkFontPtr; /* If non-NULL, store the information in
- * this existing TkFont structure, rather than
+TkpGetFontFromAttributes(
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
* allocating a new structure to hold the
* font; the existing contents of the font
- * will be released. If NULL, a new TkFont
+ * will be released. If NULL, a new TkFont
* structure is allocated. */
- Tk_Window tkwin; /* For display where font will be used. */
- CONST TkFontAttributes *faPtr;
+ Tk_Window tkwin, /* For display where font will be used. */
+ CONST TkFontAttributes *faPtr)
/* Set of attributes to match. */
{
UnixFont *fontPtr;
@@ -803,9 +793,9 @@ TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
* TkpDeleteFont --
*
* Called to release a font allocated by TkpGetNativeFont() or
- * TkpGetFontFromAttributes(). The caller should have already
- * released the fields of the TkFont that are used exclusively by
- * the generic TkFont code.
+ * TkpGetFontFromAttributes(). The caller should have already released
+ * the fields of the TkFont that are used exclusively by the generic
+ * TkFont code.
*
* Results:
* None.
@@ -817,12 +807,11 @@ TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
*/
void
-TkpDeleteFont(tkFontPtr)
- TkFont *tkFontPtr; /* Token of font to be deleted. */
+TkpDeleteFont(
+ TkFont *tkFontPtr) /* Token of font to be deleted. */
{
- UnixFont *fontPtr;
+ UnixFont *fontPtr = (UnixFont *) tkFontPtr;
- fontPtr = (UnixFont *) tkFontPtr;
ReleaseFont(fontPtr);
}
@@ -831,8 +820,8 @@ TkpDeleteFont(tkFontPtr)
*
* TkpGetFontFamilies --
*
- * Return information about the font families that are available
- * on the display of the given window.
+ * Return information about the font families that are available on the
+ * display of the given window.
*
* Results:
* Modifies interp's result object to hold a list of all the available
@@ -845,19 +834,18 @@ TkpDeleteFont(tkFontPtr)
*/
void
-TkpGetFontFamilies(interp, tkwin)
- Tcl_Interp *interp; /* Interp to hold result. */
- Tk_Window tkwin; /* For display to query. */
+TkpGetFontFamilies(
+ Tcl_Interp *interp, /* Interp to hold result. */
+ Tk_Window tkwin) /* For display to query. */
{
int i, new, numNames;
- char *family;
+ char *family, **nameList;
Tcl_HashTable familyTable;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
- char **nameList;
Tcl_Obj *resultPtr, *strPtr;
- resultPtr = Tcl_GetObjResult(interp);
+ resultPtr = Tcl_GetObjResult(interp);
Tcl_InitHashTable(&familyTable, TCL_STRING_KEYS);
nameList = ListFonts(Tk_Display(tkwin), "*", &numNames);
@@ -881,14 +869,13 @@ TkpGetFontFamilies(interp, tkwin)
continue; /* See comment above. */
}
*familyEnd = '\0';
- family = strchr(nameList[i] + 1, '-') + 1;
Tcl_CreateHashEntry(&familyTable, family, &new);
}
XFreeFontNames(nameList);
hPtr = Tcl_FirstHashEntry(&familyTable, &search);
while (hPtr != NULL) {
- strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1);
+ strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1);
Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
hPtr = Tcl_NextHashEntry(&search);
}
@@ -901,12 +888,12 @@ TkpGetFontFamilies(interp, tkwin)
*
* TkpGetSubFonts --
*
- * A function used by the testing package for querying the actual
- * screen fonts that make up a font object.
+ * A function used by the testing package for querying the actual screen
+ * fonts that make up a font object.
*
* Results:
- * Modifies interp's result object to hold a list containing the
- * names of the screen fonts that make up the given font object.
+ * Modifies interp's result object to hold a list containing the names of
+ * the screen fonts that make up the given font object.
*
* Side effects:
* None.
@@ -915,43 +902,80 @@ TkpGetFontFamilies(interp, tkwin)
*/
void
-TkpGetSubFonts(interp, tkfont)
- Tcl_Interp *interp;
- Tk_Font tkfont;
+TkpGetSubFonts(
+ Tcl_Interp *interp,
+ Tk_Font tkfont)
{
int i;
- Tcl_Obj *objv[3];
- Tcl_Obj *resultPtr, *listPtr;
+ Tcl_Obj *objv[3], *resultPtr, *listPtr;
UnixFont *fontPtr;
FontFamily *familyPtr;
- resultPtr = Tcl_GetObjResult(interp);
+ resultPtr = Tcl_GetObjResult(interp);
fontPtr = (UnixFont *) tkfont;
for (i = 0; i < fontPtr->numSubFonts; i++) {
familyPtr = fontPtr->subFontArray[i].familyPtr;
objv[0] = Tcl_NewStringObj(familyPtr->faceName, -1);
objv[1] = Tcl_NewStringObj(familyPtr->foundry, -1);
- objv[2] = Tcl_NewStringObj(Tcl_GetEncodingName(familyPtr->encoding), -1);
+ objv[2] = Tcl_NewStringObj(
+ Tcl_GetEncodingName(familyPtr->encoding), -1);
listPtr = Tcl_NewListObj(3, objv);
Tcl_ListObjAppendElement(NULL, resultPtr, listPtr);
}
}
/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetFontAttrsForChar --
+ *
+ * Retrieve the font attributes of the actual font used to render a given
+ * character.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The font attributes are stored in *faPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetFontAttrsForChar(
+ Tk_Window tkwin, /* Window on the font's display */
+ Tk_Font tkfont, /* Font to query */
+ Tcl_UniChar c, /* Character of interest */
+ TkFontAttributes *faPtr) /* Output: Font attributes */
+{
+ FontAttributes atts;
+ UnixFont *fontPtr = (UnixFont *) tkfont;
+ /* Structure describing the logical font */
+ SubFont *lastSubFontPtr = &fontPtr->subFontArray[0];
+ /* Pointer to subfont array in case
+ * FindSubFontForChar needs to fix up the
+ * memory allocation */
+ SubFont *thisSubFontPtr = FindSubFontForChar(fontPtr, c, &lastSubFontPtr);
+ /* Pointer to the subfont to use for the given
+ * character */
+ GetFontAttributes(Tk_Display(tkwin), thisSubFontPtr->fontStructPtr, &atts);
+ *faPtr = atts.fa;
+}
+
+/*
*---------------------------------------------------------------------------
*
- * Tk_MeasureChars --
+ * Tk_MeasureChars --
*
- * Determine the number of characters from the string that will fit
- * in the given horizontal span. The measurement is done under the
- * assumption that Tk_DrawChars() will be used to actually display
- * the characters.
+ * Determine the number of characters from the string that will fit in
+ * the given horizontal span. The measurement is done under the
+ * assumption that Tk_DrawChars() will be used to actually display the
+ * characters.
*
* Results:
- * The return value is the number of bytes from source that
- * fit into the span that extends from 0 to maxLength. *lengthPtr is
- * filled with the x-coordinate of the right edge of the last
- * character that did fit.
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
*
* Side effects:
* None.
@@ -960,26 +984,26 @@ TkpGetSubFonts(interp, tkfont)
*/
int
-Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
- Tk_Font tkfont; /* Font in which characters will be drawn. */
- CONST char *source; /* UTF-8 string to be displayed. Need not be
+Tk_MeasureChars(
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
- int numBytes; /* Maximum number of bytes to consider
- * from source string. */
- int maxLength; /* If >= 0, maxLength specifies the longest
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length in pixels; don't
* consider any character that would cross
- * this x-position. If < 0, then line length
+ * this x-position. If < 0, then line length
* is unbounded and the flags argument is
* ignored. */
- int flags; /* Various flag bits OR-ed together:
+ int flags, /* Various flag bits OR-ed together:
* TK_PARTIAL_OK means include the last char
* which only partially fit on this line.
* TK_WHOLE_WORDS means stop on a word
- * boundary, if possible.
- * TK_AT_LEAST_ONE means return at least one
- * character even if no characters fit. */
- int *lengthPtr; /* Filled with x-location just after the
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. */
+ int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
UnixFont *fontPtr;
@@ -988,9 +1012,9 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
* Unix does not use kerning or fractional character widths when
- * displaying text on the screen. So that means we can safely measure
- * individual characters or spans of characters and add up the widths
- * w/o any "off-by-one-pixel" errors.
+ * displaying text on the screen. So that means we can safely measure
+ * individual characters or spans of characters and add up the widths w/o
+ * any "off-by-one-pixel" errors.
*/
fontPtr = (UnixFont *) tkfont;
@@ -1009,7 +1033,7 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
* A three step process:
- * 1. Find a contiguous range of characters that can all be
+ * 1. Find a contiguous range of characters that can all be
* represented by a single screen font.
* 2. Convert those chars to the encoding of that font.
* 3. Measure converted chars.
@@ -1040,7 +1064,7 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
p = next;
}
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source,
+ Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source,
&runString);
if (familyPtr->isTwoByteFont) {
curX += XTextWidth16(lastSubFontPtr->fontStructPtr,
@@ -1061,14 +1085,14 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
char buf[16];
/*
- * How many chars will fit in the space allotted?
- * This first version may be inefficient because it measures
- * every character individually.
+ * How many chars will fit in the space allotted? This first version
+ * may be inefficient because it measures every character
+ * individually.
*/
next = source + Tcl_UtfToUniChar(source, &ch);
newX = curX = termX = 0;
-
+
term = source;
end = source + numBytes;
@@ -1115,14 +1139,14 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
* P points to the first character that doesn't fit in the desired
- * span. Use the flags to figure out what to return.
+ * span. Use the flags to figure out what to return.
*/
if ((flags & TK_PARTIAL_OK) && (p < end) && (curX < maxLength)) {
/*
- * Include the first character that didn't quite fit in the desired
- * span. The width returned will include the width of that extra
- * character.
+ * Include the first character that didn't quite fit in the
+ * desired span. The width returned will include the width of that
+ * extra character.
*/
curX = newX;
@@ -1141,7 +1165,7 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
}
curX = termX;
- curByte = term - source;
+ curByte = term - source;
}
*lengthPtr = curX;
@@ -1151,11 +1175,67 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
*---------------------------------------------------------------------------
*
+ * TkpMeasureCharsInContext --
+ *
+ * Determine the number of bytes from the string that will fit in the
+ * given horizontal span. The measurement is done under the assumption
+ * that TkpDrawCharsInContext() will be used to actually display the
+ * characters.
+ *
+ * This one is almost the same as Tk_MeasureChars(), but with access to
+ * all the characters on the line for context. On X11 this context isn't
+ * consulted, so we just call Tk_MeasureChars().
+ *
+ * Results:
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkpMeasureCharsInContext(
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string in all. */
+ int rangeStart, /* Index of first byte to measure. */
+ int rangeLength, /* Length of range to measure in bytes. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
+ * permissible line length; don't consider any
+ * character that would cross this x-position.
+ * If < 0, then line length is unbounded and
+ * the flags argument is ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fit on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. TK_ISOLATE_END means
+ * that the last character should not be
+ * considered in context with the rest of the
+ * string (used for breaking lines). */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ (void) numBytes; /*unused*/
+ return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength,
+ maxLength, flags, lengthPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* Tk_DrawChars --
*
- * Draw a string of characters on the screen. Tk_DrawChars()
- * expands control characters that occur in the string to
- * \xNN sequences.
+ * Draw a string of characters on the screen. Tk_DrawChars() expands
+ * control characters that occur in the string to \xNN sequences.
*
* Results:
* None.
@@ -1167,21 +1247,21 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
*/
void
-Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
- Display *display; /* Display on which to draw. */
- Drawable drawable; /* Window or pixmap in which to draw. */
- GC gc; /* Graphics context for drawing characters. */
- Tk_Font tkfont; /* Font in which characters will be drawn;
+Tk_DrawChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source; /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
* regular printing characters. */
- int numBytes; /* Number of bytes in string. */
- int x, y; /* Coordinates at which to place origin of
+ int numBytes, /* Number of bytes in string. */
+ int x, int y) /* Coordinates at which to place origin of
* string when drawing. */
{
UnixFont *fontPtr;
@@ -1206,6 +1286,7 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
/*
* Get the window width so we can abort drawing outside of the window
*/
+
if (XGetGeometry(display, drawable, &root, &rx, &ry, &width, &height,
&border_width, &depth) == False) {
window_width = INT_MAX;
@@ -1214,9 +1295,10 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
}
#else
/*
- * This is used by default until we find a solution that doesn't
- * round-trip to the X server (need to get Tk cached window width).
+ * This is used by default until we find a solution that doesn't do a
+ * round-trip to the X server (needed to get Tk cached window width).
*/
+
window_width = 32768;
#endif
@@ -1233,13 +1315,13 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
if ((thisSubFontPtr != lastSubFontPtr)
|| (p == end) || (p-source > 200)) {
if (p > source) {
- do_width = (needWidth || (p != end)) ? 1 : 0;
+ do_width = (needWidth || (p != end)) ? 1 : 0;
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
p - source, &runString);
if (familyPtr->isTwoByteFont) {
- XDrawString16(display, drawable, gc, x, y,
+ XDrawString16(display, drawable, gc, x, y,
(XChar2b *) Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) / 2);
if (do_width) {
@@ -1263,7 +1345,7 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
source = p;
XSetFont(display, gc, lastSubFontPtr->fontStructPtr->fid);
if (x > window_width) {
- break;
+ break;
}
}
p = next;
@@ -1284,30 +1366,71 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
(unsigned) (x - xStart), (unsigned) fontPtr->barHeight);
}
}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpDrawCharsInContext --
+ *
+ * Draw a string of characters on the screen like Tk_DrawChars(), but
+ * with access to all the characters on the line for context. On X11 this
+ * context isn't consulted, so we just call Tk_DrawChars().
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information gets drawn on the screen.
+ *
+ *---------------------------------------------------------------------------
+ */
+void
+TkpDrawCharsInContext(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ int rangeStart, /* Index of first byte to draw. */
+ int rangeLength, /* Length of range to draw in bytes. */
+ int x, int y) /* Coordinates at which to place origin of the
+ * whole (not just the range) string when
+ * drawing. */
+{
+ (void) numBytes; /*unused*/
-
+ Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
+ rangeLength, x, y);
+}
/*
*-------------------------------------------------------------------------
*
* CreateClosestFont --
*
- * Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Given a set of font attributes, construct a close XFontStruct.
- * If requested face name is not available, automatically
- * substitutes an alias for requested face name. If encoding is
- * not specified (or the requested one is not available),
- * automatically chooses another encoding from the list of
- * preferred encodings. If the foundry is not specified (or
- * is not available) automatically prefers "adobe" foundry.
- * For all other attributes, if the requested value was not
- * available, the appropriate "close" value will be used.
+ * Helper for TkpGetNativeFont() and TkpGetFontFromAttributes(). Given a
+ * set of font attributes, construct a close XFontStruct. If requested
+ * face name is not available, automatically substitutes an alias for
+ * requested face name. If encoding is not specified (or the requested
+ * one is not available), automatically chooses another encoding from the
+ * list of preferred encodings. If the foundry is not specified (or is
+ * not available) automatically prefers "adobe" foundry. For all other
+ * attributes, if the requested value was not available, the appropriate
+ * "close" value will be used.
*
* Results:
- * Return value is the XFontStruct that best matched the
- * requested attributes. The return value is never NULL; some
- * font will always be returned.
+ * Return value is the XFontStruct that best matched the requested
+ * attributes. The return value is never NULL; some font will always be
+ * returned.
*
* Side effects:
* None.
@@ -1316,19 +1439,18 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
*/
static XFontStruct *
-CreateClosestFont(tkwin, faPtr, xaPtr)
- Tk_Window tkwin; /* For display where font will be used. */
- CONST TkFontAttributes *faPtr;
+CreateClosestFont(
+ Tk_Window tkwin, /* For display where font will be used. */
+ CONST TkFontAttributes *faPtr,
/* Set of generic attributes to match. */
- CONST TkXLFDAttributes *xaPtr;
+ CONST TkXLFDAttributes *xaPtr)
/* Set of X-specific attributes to match. */
{
FontAttributes want;
char **nameList;
- int numNames, nameIdx;
+ int numNames, nameIdx, bestIdx[2];
Display *display;
XFontStruct *fontStructPtr;
- int bestIdx[2];
unsigned int bestScore[2];
want.fa = *faPtr;
@@ -1362,7 +1484,7 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
char ***fontFallbacks;
int i, j;
char *fallback;
-
+
fontFallbacks = TkFontGetFallbacks();
for (i = 0; fontFallbacks[i] != NULL; i++) {
for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
@@ -1387,7 +1509,8 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
return GetSystemFont(display);
}
}
- found:
+
+ found:
bestIdx[0] = -1;
bestIdx[1] = -1;
bestScore[0] = (unsigned int) -1;
@@ -1412,9 +1535,10 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
}
}
- fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx, bestScore);
+ fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx,
+ bestScore);
XFreeFontNames(nameList);
-
+
if (fontStructPtr == NULL) {
return GetSystemFont(display);
}
@@ -1427,12 +1551,12 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
* InitFont --
*
* Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Initializes the memory for a new UnixFont that wraps the
+ * Initializes the memory for a new UnixFont that wraps the
* platform-specific data.
*
- * The caller is responsible for initializing the fields of the
- * TkFont that are used exclusively by the generic TkFont code, and
- * for releasing those fields before calling TkpDeleteFont().
+ * The caller is responsible for initializing the fields of the TkFont
+ * that are used exclusively by the generic TkFont code, and for
+ * releasing those fields before calling TkpDeleteFont().
*
* Results:
* Fills the WinFont structure.
@@ -1441,17 +1565,17 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
* Memory allocated.
*
*---------------------------------------------------------------------------
- */
+ */
static void
-InitFont(tkwin, fontStructPtr, fontPtr)
- Tk_Window tkwin; /* For screen where font will be used. */
- XFontStruct *fontStructPtr; /* X information about font. */
- UnixFont *fontPtr; /* Filled with information constructed from
+InitFont(
+ Tk_Window tkwin, /* For screen where font will be used. */
+ XFontStruct *fontStructPtr, /* X information about font. */
+ UnixFont *fontPtr) /* Filled with information constructed from
* the above arguments. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
unsigned long value;
int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n;
FontAttributes fa;
@@ -1464,7 +1588,7 @@ InitFont(tkwin, fontStructPtr, fontPtr)
/*
* Get all font attributes and metrics.
*/
-
+
display = Tk_Display(tkwin);
GetFontAttributes(display, fontStructPtr, &fa);
@@ -1472,7 +1596,7 @@ InitFont(tkwin, fontStructPtr, fontPtr)
maxHi = fontStructPtr->max_byte1;
minLo = fontStructPtr->min_char_or_byte2;
maxLo = fontStructPtr->max_char_or_byte2;
-
+
fixed = 1;
if (fontStructPtr->per_char != NULL) {
width = 0;
@@ -1490,41 +1614,41 @@ InitFont(tkwin, fontStructPtr, fontPtr)
}
}
- fontPtr->font.fid = fontStructPtr->fid;
+ fontPtr->font.fid = fontStructPtr->fid;
- faPtr = &fontPtr->font.fa;
- faPtr->family = fa.fa.family;
- faPtr->size = TkFontGetPoints(tkwin, fa.fa.size);
- faPtr->weight = fa.fa.weight;
- faPtr->slant = fa.fa.slant;
- faPtr->underline = 0;
- faPtr->overstrike = 0;
+ faPtr = &fontPtr->font.fa;
+ faPtr->family = fa.fa.family;
+ faPtr->size = TkFontGetPoints(tkwin, fa.fa.size);
+ faPtr->weight = fa.fa.weight;
+ faPtr->slant = fa.fa.slant;
+ faPtr->underline = 0;
+ faPtr->overstrike = 0;
- fmPtr = &fontPtr->font.fm;
- fmPtr->ascent = fontStructPtr->ascent;
- fmPtr->descent = fontStructPtr->descent;
- fmPtr->maxWidth = fontStructPtr->max_bounds.width;
- fmPtr->fixed = fixed;
+ fmPtr = &fontPtr->font.fm;
+ fmPtr->ascent = fontStructPtr->ascent;
+ fmPtr->descent = fontStructPtr->descent;
+ fmPtr->maxWidth = fontStructPtr->max_bounds.width;
+ fmPtr->fixed = fixed;
- fontPtr->display = display;
- fontPtr->pixelSize = TkFontGetPixels(tkwin, fa.fa.size);
- fontPtr->xa = fa.xa;
+ fontPtr->display = display;
+ fontPtr->pixelSize = TkFontGetPixels(tkwin, fa.fa.size);
+ fontPtr->xa = fa.xa;
- fontPtr->numSubFonts = 1;
- fontPtr->subFontArray = fontPtr->staticSubFonts;
+ fontPtr->numSubFonts = 1;
+ fontPtr->subFontArray = fontPtr->staticSubFonts;
InitSubFont(display, fontStructPtr, 1, &fontPtr->subFontArray[0]);
- fontPtr->controlSubFont = fontPtr->subFontArray[0];
- subFontPtr = FindSubFontForChar(fontPtr, '0', NULL);
- controlPtr = &fontPtr->controlSubFont;
- controlPtr->fontStructPtr = subFontPtr->fontStructPtr;
- controlPtr->familyPtr = &tsdPtr->controlFamily;
- controlPtr->fontMap = tsdPtr->controlFamily.fontMap;
-
+ fontPtr->controlSubFont = fontPtr->subFontArray[0];
+ subFontPtr = FindSubFontForChar(fontPtr, '0', NULL);
+ controlPtr = &fontPtr->controlSubFont;
+ controlPtr->fontStructPtr = subFontPtr->fontStructPtr;
+ controlPtr->familyPtr = &tsdPtr->controlFamily;
+ controlPtr->fontMap = tsdPtr->controlFamily.fontMap;
+
pageMap = fontPtr->subFontArray[0].fontMap[0];
for (i = 0; i < 256; i++) {
- if ((minHi > 0) || (i < minLo) || (i > maxLo) ||
- (((pageMap[i >> 3] >> (i & 7)) & 1) == 0)) {
+ if ((minHi > 0) || (i < minLo) || (i > maxLo)
+ || (((pageMap[i>>3] >> (i&7)) & 1) == 0)) {
n = 0;
} else if (fontStructPtr->per_char == NULL) {
n = fontStructPtr->max_bounds.width;
@@ -1533,14 +1657,13 @@ InitFont(tkwin, fontStructPtr, fontPtr)
}
fontPtr->widths[i] = n;
}
-
if (XGetFontProperty(fontStructPtr, XA_UNDERLINE_POSITION, &value)) {
fontPtr->underlinePos = value;
} else {
/*
- * If the XA_UNDERLINE_POSITION property does not exist, the X
- * manual recommends using the following value:
+ * If the XA_UNDERLINE_POSITION property does not exist, the X manual
+ * recommends using the following value:
*/
fontPtr->underlinePos = fontStructPtr->descent / 2;
@@ -1551,10 +1674,10 @@ InitFont(tkwin, fontStructPtr, fontPtr)
}
if (fontPtr->barHeight == 0) {
/*
- * If the XA_UNDERLINE_THICKNESS property does not exist, the X
- * manual recommends using the width of the stem on a capital
- * letter. I don't know of a way to get the stem width of a letter,
- * so guess and use 1/3 the width of a capital I.
+ * If the XA_UNDERLINE_THICKNESS property does not exist, the X manual
+ * recommends using the width of the stem on a capital letter. I don't
+ * know of a way to get the stem width of a letter, so guess and use
+ * 1/3 the width of a capital I.
*/
fontPtr->barHeight = fontPtr->widths['I'] / 3;
@@ -1565,8 +1688,8 @@ InitFont(tkwin, fontStructPtr, fontPtr)
if (fontPtr->underlinePos + fontPtr->barHeight > fontStructPtr->descent) {
/*
* If this set of cobbled together values would cause the bottom of
- * the underline bar to stick below the descent of the font, jack
- * the underline up a bit higher.
+ * the underline bar to stick below the descent of the font, jack the
+ * underline up a bit higher.
*/
fontPtr->barHeight = fontStructPtr->descent - fontPtr->underlinePos;
@@ -1581,10 +1704,9 @@ InitFont(tkwin, fontStructPtr, fontPtr)
*-------------------------------------------------------------------------
*
* ReleaseFont --
- *
- * Called to release the unix-specific contents of a TkFont.
- * The caller is responsible for freeing the memory used by the
- * font itself.
+ *
+ * Called to release the unix-specific contents of a TkFont. The caller
+ * is responsible for freeing the memory used by the font itself.
*
* Results:
* None.
@@ -1594,10 +1716,10 @@ InitFont(tkwin, fontStructPtr, fontPtr)
*
*---------------------------------------------------------------------------
*/
-
+
static void
-ReleaseFont(fontPtr)
- UnixFont *fontPtr; /* The font to delete. */
+ReleaseFont(
+ UnixFont *fontPtr) /* The font to delete. */
{
int i;
@@ -1614,9 +1736,9 @@ ReleaseFont(fontPtr)
*
* InitSubFont --
*
- * Wrap a screen font and load the FontFamily that represents
- * it. Used to prepare a SubFont so that characters can be mapped
- * from UTF-8 to the charset of the font.
+ * Wrap a screen font and load the FontFamily that represents it. Used to
+ * prepare a SubFont so that characters can be mapped from UTF-8 to the
+ * charset of the font.
*
* Results:
* The subFontPtr is filled with information about the font.
@@ -1628,17 +1750,17 @@ ReleaseFont(fontPtr)
*/
static void
-InitSubFont(display, fontStructPtr, base, subFontPtr)
- Display *display; /* Display in which font will be used. */
- XFontStruct *fontStructPtr; /* The screen font. */
- int base; /* Non-zero if this SubFont is being used
- * as the base font for a font object. */
- SubFont *subFontPtr; /* Filled with SubFont constructed from
- * above attributes. */
+InitSubFont(
+ Display *display, /* Display in which font will be used. */
+ XFontStruct *fontStructPtr, /* The screen font. */
+ int base, /* Non-zero if this SubFont is being used as
+ * the base font for a font object. */
+ SubFont *subFontPtr) /* Filled with SubFont constructed from above
+ * attributes. */
{
subFontPtr->fontStructPtr = fontStructPtr;
- subFontPtr->familyPtr = AllocFontFamily(display, fontStructPtr, base);
- subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
+ subFontPtr->familyPtr = AllocFontFamily(display, fontStructPtr, base);
+ subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
}
/*
@@ -1646,8 +1768,8 @@ InitSubFont(display, fontStructPtr, base, subFontPtr)
*
* ReleaseSubFont --
*
- * Called to release the contents of a SubFont. The caller is
- * responsible for freeing the memory used by the SubFont itself.
+ * Called to release the contents of a SubFont. The caller is responsible
+ * for freeing the memory used by the SubFont itself.
*
* Results:
* None.
@@ -1659,9 +1781,9 @@ InitSubFont(display, fontStructPtr, base, subFontPtr)
*/
static void
-ReleaseSubFont(display, subFontPtr)
- Display *display; /* Display which owns screen font. */
- SubFont *subFontPtr; /* The SubFont to delete. */
+ReleaseSubFont(
+ Display *display, /* Display which owns screen font. */
+ SubFont *subFontPtr) /* The SubFont to delete. */
{
XFreeFont(display, subFontPtr->fontStructPtr);
FreeFontFamily(subFontPtr->familyPtr);
@@ -1672,43 +1794,41 @@ ReleaseSubFont(display, subFontPtr)
*
* AllocFontFamily --
*
- * Find the FontFamily structure associated with the given font
- * name. The information should be stored by the caller in a
- * SubFont and used when determining if that SubFont supports a
- * character.
+ * Find the FontFamily structure associated with the given font name.
+ * The information should be stored by the caller in a SubFont and used
+ * when determining if that SubFont supports a character.
*
- * Cannot use the string name used to construct the font as the
- * key, because the capitalization may not be canonical. Therefore
- * use the face name actually retrieved from the font metrics as
- * the key.
+ * Cannot use the string name used to construct the font as the key,
+ * because the capitalization may not be canonical. Therefore use the
+ * face name actually retrieved from the font metrics as the key.
*
* Results:
- * A pointer to a FontFamily. The reference count in the FontFamily
- * is automatically incremented. When the SubFont is released, the
- * reference count is decremented. When no SubFont is using this
- * FontFamily, it may be deleted.
+ * A pointer to a FontFamily. The reference count in the FontFamily is
+ * automatically incremented. When the SubFont is released, the reference
+ * count is decremented. When no SubFont is using this FontFamily, it may
+ * be deleted.
*
* Side effects:
- * A new FontFamily structure will be allocated if this font family
- * has not been seen. TrueType character existence metrics are
- * loaded into the FontFamily structure.
+ * A new FontFamily structure will be allocated if this font family has
+ * not been seen. TrueType character existence metrics are loaded into
+ * the FontFamily structure.
*
*-------------------------------------------------------------------------
*/
static FontFamily *
-AllocFontFamily(display, fontStructPtr, base)
- Display *display; /* Display in which font will be used. */
- XFontStruct *fontStructPtr; /* Screen font whose FontFamily is to be
+AllocFontFamily(
+ Display *display, /* Display in which font will be used. */
+ XFontStruct *fontStructPtr, /* Screen font whose FontFamily is to be
* returned. */
- int base; /* Non-zero if this font family is to be
- * used in the base font of a font object. */
+ int base) /* Non-zero if this font family is to be used
+ * in the base font of a font object. */
{
FontFamily *familyPtr;
FontAttributes fa;
Tcl_Encoding encoding;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
GetFontAttributes(display, fontStructPtr, &fa);
encoding = Tcl_GetEncoding(NULL, GetEncodingAlias(fa.xa.charset));
@@ -1729,26 +1849,26 @@ AllocFontFamily(display, fontStructPtr, base)
familyPtr->nextPtr = tsdPtr->fontFamilyList;
tsdPtr->fontFamilyList = familyPtr;
- /*
- * Set key for this FontFamily.
+ /*
+ * Set key for this FontFamily.
*/
-
+
familyPtr->foundry = fa.xa.foundry;
familyPtr->faceName = fa.fa.family;
familyPtr->encoding = encoding;
- /*
- * An initial refCount of 2 means that FontFamily information will
- * persist even when the SubFont that loaded the FontFamily is released.
- * Change it to 1 to cause FontFamilies to be unloaded when not in use.
+ /*
+ * An initial refCount of 2 means that FontFamily information will persist
+ * even when the SubFont that loaded the FontFamily is released. Change it
+ * to 1 to cause FontFamilies to be unloaded when not in use.
*/
familyPtr->refCount = 2;
/*
- * One byte/character fonts have both min_byte1 and max_byte1 0,
- * and max_char_or_byte2 <= 255.
- * Anything else specifies a two byte/character font.
+ * One byte/character fonts have both min_byte1 and max_byte1 0, and
+ * max_char_or_byte2 <= 255. Anything else specifies a two byte/character
+ * font.
*/
familyPtr->isTwoByteFont = !(
@@ -1763,9 +1883,9 @@ AllocFontFamily(display, fontStructPtr, base)
*
* FreeFontFamily --
*
- * Called to free an FontFamily when the SubFont is finished using
- * it. Frees the contents of the FontFamily and the memory used by
- * the FontFamily itself.
+ * Called to free an FontFamily when the SubFont is finished using it.
+ * Frees the contents of the FontFamily and the memory used by the
+ * FontFamily itself.
*
* Results:
* None.
@@ -1775,42 +1895,42 @@ AllocFontFamily(display, fontStructPtr, base)
*
*-------------------------------------------------------------------------
*/
-
+
static void
-FreeFontFamily(familyPtr)
- FontFamily *familyPtr; /* The FontFamily to delete. */
+FreeFontFamily(
+ FontFamily *familyPtr) /* The FontFamily to delete. */
{
FontFamily **familyPtrPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int i;
if (familyPtr == NULL) {
- return;
+ return;
}
familyPtr->refCount--;
if (familyPtr->refCount > 0) {
- return;
+ return;
}
Tcl_FreeEncoding(familyPtr->encoding);
for (i = 0; i < FONTMAP_PAGES; i++) {
- if (familyPtr->fontMap[i] != NULL) {
- ckfree(familyPtr->fontMap[i]);
- }
+ if (familyPtr->fontMap[i] != NULL) {
+ ckfree(familyPtr->fontMap[i]);
+ }
}
-
- /*
- * Delete from list.
+
+ /*
+ * Delete from list.
*/
-
+
for (familyPtrPtr = &tsdPtr->fontFamilyList; ; ) {
- if (*familyPtrPtr == familyPtr) {
- *familyPtrPtr = familyPtr->nextPtr;
+ if (*familyPtrPtr == familyPtr) {
+ *familyPtrPtr = familyPtr->nextPtr;
break;
}
familyPtrPtr = &(*familyPtrPtr)->nextPtr;
}
-
+
ckfree((char *) familyPtr);
}
@@ -1819,39 +1939,35 @@ FreeFontFamily(familyPtr)
*
* FindSubFontForChar --
*
- * Determine which screen font is necessary to use to
- * display the given character. If the font object does not have
- * a screen font that can display the character, another screen font
- * may be loaded into the font object, following a set of preferred
- * fallback rules.
+ * Determine which screen font is necessary to use to display the given
+ * character. If the font object does not have a screen font that can
+ * display the character, another screen font may be loaded into the font
+ * object, following a set of preferred fallback rules.
*
* Results:
- * The return value is the SubFont to use to display the given
- * character.
+ * The return value is the SubFont to use to display the given character.
*
* Side effects:
- * The contents of fontPtr are modified to cache the results
- * of the lookup and remember any SubFonts that were dynamically
- * loaded. The table of SubFonts might be extended, and if a non-NULL
- * reference to a subfont pointer is available, it is updated if it
- * previously pointed into the old subfont table.
+ * The contents of fontPtr are modified to cache the results of the
+ * lookup and remember any SubFonts that were dynamically loaded. The
+ * table of SubFonts might be extended, and if a non-NULL reference to a
+ * subfont pointer is available, it is updated if it previously pointed
+ * into the old subfont table.
*
*-------------------------------------------------------------------------
*/
static SubFont *
-FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
- UnixFont *fontPtr; /* The font object with which the character
+FindSubFontForChar(
+ UnixFont *fontPtr, /* The font object with which the character
* will be displayed. */
- int ch; /* The Unicode character to be displayed. */
- SubFont **fixSubFontPtrPtr; /* Subfont reference to fix up if we
+ int ch, /* The Unicode character to be displayed. */
+ SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
* reallocate our subfont table. */
{
int i, j, k, numNames;
- Tk_Uid faceName;
- char *fallback;
- char **aliases, **nameList, **anyFallbacks;
- char ***fontFallbacks;
+ Tk_Uid faceName;
+ char *fallback, **aliases, **nameList, **anyFallbacks, ***fontFallbacks;
SubFont *subFontPtr;
Tcl_DString ds;
@@ -1870,19 +1986,19 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
/*
- * Keep track of all face names that we check, so we don't check some
- * name multiple times if it can be reached by multiple paths.
+ * Keep track of all face names that we check, so we don't check some name
+ * multiple times if it can be reached by multiple paths.
*/
-
+
Tcl_DStringInit(&ds);
/*
- * Are there any other fonts with the same face name as the base
- * font that could display this character, e.g., if the base font
- * is adobe:fixed:iso8859-1, we could might be able to use
+ * Are there any other fonts with the same face name as the base font that
+ * could display this character, e.g., if the base font is
+ * adobe:fixed:iso8859-1, we could might be able to use
* misc:fixed:iso8859-8 or sony:fixed:jisx0208.1983-0
*/
-
+
faceName = fontPtr->font.fa.family;
if (SeenName(faceName, &ds) == 0) {
subFontPtr = CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr);
@@ -1904,7 +2020,7 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
goto tryfallbacks;
} else if (aliases != NULL) {
- /*
+ /*
* Or if an alias for the base font has a fallback...
*/
@@ -1917,11 +2033,11 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
continue;
- tryfallbacks:
+ tryfallbacks:
- /*
- * ...then see if we can use one of the fallbacks, or an
- * alias for one of the fallbacks.
+ /*
+ * ...then see if we can use one of the fallbacks, or an alias for one
+ * of the fallbacks.
*/
for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
@@ -1934,7 +2050,7 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
/*
- * See if we can use something from the global fallback list.
+ * See if we can use something from the global fallback list.
*/
anyFallbacks = TkFontGetGlobalClass();
@@ -1947,8 +2063,8 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
/*
- * Try all face names available in the whole system until we
- * find one that can be used.
+ * Try all face names available in the whole system until we find one that
+ * can be used.
*/
nameList = ListFonts(fontPtr->display, "*", &numNames);
@@ -1966,7 +2082,7 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
XFreeFontNames(nameList);
- end:
+ end:
Tcl_DStringFree(&ds);
if (subFontPtr == NULL) {
@@ -1989,24 +2105,23 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
* See if the screen font can display the given character.
*
* Results:
- * The return value is 0 if the screen font cannot display the
- * character, non-zero otherwise.
+ * The return value is 0 if the screen font cannot display the character,
+ * non-zero otherwise.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ * New pages are added to the font mapping cache whenever the character
+ * belongs to a page that hasn't been seen before. When a page is loaded,
+ * information about all the characters on that page is stored, not just
+ * for the single character in question.
*
*-------------------------------------------------------------------------
*/
static int
-FontMapLookup(subFontPtr, ch)
- SubFont *subFontPtr; /* Contains font mapping cache to be queried
+FontMapLookup(
+ SubFont *subFontPtr, /* Contains font mapping cache to be queried
* and possibly updated. */
- int ch; /* Character to be tested. */
+ int ch) /* Character to be tested. */
{
int row, bitOffset;
@@ -2023,31 +2138,30 @@ FontMapLookup(subFontPtr, ch)
*
* FontMapInsert --
*
- * Tell the font mapping cache that the given screen font should be
- * used to display the specified character. This is called when no
- * font on the system can be be found that can display that
- * character; we lie to the font and tell it that it can display
- * the character, otherwise we would end up re-searching the entire
- * fallback hierarchy every time that character was seen.
+ * Tell the font mapping cache that the given screen font should be used
+ * to display the specified character. This is called when no font on the
+ * system can be be found that can display that character; we lie to the
+ * font and tell it that it can display the character, otherwise we would
+ * end up re-searching the entire fallback hierarchy every time that
+ * character was seen.
*
* Results:
* None.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ * New pages are added to the font mapping cache whenever the character
+ * belongs to a page that hasn't been seen before. When a page is loaded,
+ * information about all the characters on that page is stored, not just
+ * for the single character in question.
*
*-------------------------------------------------------------------------
*/
static void
-FontMapInsert(subFontPtr, ch)
- SubFont *subFontPtr; /* Contains font mapping cache to be
+FontMapInsert(
+ SubFont *subFontPtr, /* Contains font mapping cache to be
* updated. */
- int ch; /* Character to be added to cache. */
+ int ch) /* Character to be added to cache. */
{
int row, bitOffset;
@@ -2064,25 +2178,25 @@ FontMapInsert(subFontPtr, ch)
*
* FontMapLoadPage --
*
- * Load information about all the characters on a given page.
- * This information consists of one bit per character that indicates
- * whether the associated screen font can (1) or cannot (0) display
- * the characters on the page.
+ * Load information about all the characters on a given page. This
+ * information consists of one bit per character that indicates whether
+ * the associated screen font can (1) or cannot (0) display the
+ * characters on the page.
*
* Results:
* None.
*
* Side effects:
- * Mempry allocated.
+ * Memory allocated.
*
*-------------------------------------------------------------------------
*/
-static void
-FontMapLoadPage(subFontPtr, row)
- SubFont *subFontPtr; /* Contains font mapping cache to be
+static void
+FontMapLoadPage(
+ SubFont *subFontPtr, /* Contains font mapping cache to be
* updated. */
- int row; /* Index of the page to be loaded into
- * the cache. */
+ int row) /* Index of the page to be loaded into the
+ * cache. */
{
char buf[16], src[TCL_UTF_MAX];
int minHi, maxHi, minLo, maxLo, scale, checkLo;
@@ -2090,8 +2204,8 @@ FontMapLoadPage(subFontPtr, row)
Tcl_Encoding encoding;
XFontStruct *fontStructPtr;
XCharStruct *widths;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
@@ -2100,17 +2214,17 @@ FontMapLoadPage(subFontPtr, row)
return;
}
- fontStructPtr = subFontPtr->fontStructPtr;
- encoding = subFontPtr->familyPtr->encoding;
- isTwoByteFont = subFontPtr->familyPtr->isTwoByteFont;
+ fontStructPtr = subFontPtr->fontStructPtr;
+ encoding = subFontPtr->familyPtr->encoding;
+ isTwoByteFont = subFontPtr->familyPtr->isTwoByteFont;
- widths = fontStructPtr->per_char;
- minHi = fontStructPtr->min_byte1;
- maxHi = fontStructPtr->max_byte1;
- minLo = fontStructPtr->min_char_or_byte2;
- maxLo = fontStructPtr->max_char_or_byte2;
- scale = maxLo - minLo + 1;
- checkLo = minLo;
+ widths = fontStructPtr->per_char;
+ minHi = fontStructPtr->min_byte1;
+ maxHi = fontStructPtr->max_byte1;
+ minLo = fontStructPtr->min_char_or_byte2;
+ maxLo = fontStructPtr->max_char_or_byte2;
+ scale = maxLo - minLo + 1;
+ checkLo = minLo;
if (! isTwoByteFont) {
if (minLo < 32) {
@@ -2123,7 +2237,7 @@ FontMapLoadPage(subFontPtr, row)
int hi, lo;
if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src),
- TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL,
+ TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL,
NULL, NULL) != TCL_OK) {
continue;
}
@@ -2138,7 +2252,7 @@ FontMapLoadPage(subFontPtr, row)
continue;
}
n = (hi - minHi) * scale + lo - minLo;
- if ((widths == NULL) || ((widths[n].width + widths[n].rbearing) != 0)) {
+ if ((widths == NULL) || (widths[n].width + widths[n].rbearing != 0)) {
bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
}
@@ -2150,43 +2264,41 @@ FontMapLoadPage(subFontPtr, row)
*
* CanUseFallbackWithAliases --
*
- * Helper function for FindSubFontForChar. Determine if the
- * specified face name (or an alias of the specified face name)
- * can be used to construct a screen font that can display the
- * given character.
+ * Helper function for FindSubFontForChar. Determine if the specified
+ * face name (or an alias of the specified face name) can be used to
+ * construct a screen font that can display the given character.
*
* Results:
* See CanUseFallback().
*
* Side effects:
- * If the name and/or one of its aliases was rejected, the
- * rejected string is recorded in nameTriedPtr so that it won't
- * be tried again. The table of SubFonts might be extended, and if
- * a non-NULL reference to a subfont pointer is available, it is
- * updated if it previously pointed into the old subfont table.
+ * If the name and/or one of its aliases was rejected, the rejected
+ * string is recorded in nameTriedPtr so that it won't be tried again.
+ * The table of SubFonts might be extended, and if a non-NULL reference
+ * to a subfont pointer is available, it is updated if it previously
+ * pointed into the old subfont table.
*
*---------------------------------------------------------------------------
*/
static SubFont *
-CanUseFallbackWithAliases(fontPtr, faceName, ch, nameTriedPtr,
- fixSubFontPtrPtr)
- UnixFont *fontPtr; /* The font object that will own the new
+CanUseFallbackWithAliases(
+ UnixFont *fontPtr, /* The font object that will own the new
* screen font. */
- char *faceName; /* Desired face name for new screen font. */
- int ch; /* The Unicode character that the new
- * screen font must be able to display. */
- Tcl_DString *nameTriedPtr; /* Records face names that have already
- * been tried. It is possible for the same
- * face name to be queried multiple times when
+ char *faceName, /* Desired face name for new screen font. */
+ int ch, /* The Unicode character that the new screen
+ * font must be able to display. */
+ Tcl_DString *nameTriedPtr, /* Records face names that have already been
+ * tried. It is possible for the same face
+ * name to be queried multiple times when
* trying to find a suitable screen font. */
- SubFont **fixSubFontPtrPtr; /* Subfont reference to fix up if we
+ SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
* reallocate our subfont table. */
{
SubFont *subFontPtr;
char **aliases;
int i;
-
+
if (SeenName(faceName, nameTriedPtr) == 0) {
subFontPtr = CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr);
if (subFontPtr != NULL) {
@@ -2213,9 +2325,9 @@ CanUseFallbackWithAliases(fontPtr, faceName, ch, nameTriedPtr,
*
* SeenName --
*
- * Used to determine we have already tried and rejected the given
- * face name when looking for a screen font that can support some
- * Unicode character.
+ * Used to determine we have already tried and rejected the given face
+ * name when looking for a screen font that can support some Unicode
+ * character.
*
* Results:
* The return value is 0 if this face name has not already been seen,
@@ -2228,9 +2340,9 @@ CanUseFallbackWithAliases(fontPtr, faceName, ch, nameTriedPtr,
*/
static int
-SeenName(name, dsPtr)
- CONST char *name; /* The name to check. */
- Tcl_DString *dsPtr; /* Contains names that have already been
+SeenName(
+ CONST char *name, /* The name to check. */
+ Tcl_DString *dsPtr) /* Contains names that have already been
* seen. */
{
CONST char *seen, *end;
@@ -2252,69 +2364,63 @@ SeenName(name, dsPtr)
*
* CanUseFallback --
*
- * If the specified screen font has not already been loaded
- * into the font object, determine if the specified screen
- * font can display the given character.
+ * If the specified screen font has not already been loaded into the font
+ * object, determine if the specified screen font can display the given
+ * character.
*
* Results:
- * The return value is a pointer to a newly allocated SubFont,
- * owned by the font object. This SubFont can be used to display
- * the given character. The SubFont represents the screen font
- * with the base set of font attributes from the font object, but
- * using the specified face name. NULL is returned if the font
- * object already holds a reference to the specified font or if
- * the specified font doesn't exist or cannot display the given
- * character.
+ * The return value is a pointer to a newly allocated SubFont, owned by
+ * the font object. This SubFont can be used to display the given
+ * character. The SubFont represents the screen font with the base set of
+ * font attributes from the font object, but using the specified face
+ * name. NULL is returned if the font object already holds a reference to
+ * the specified font or if the specified font doesn't exist or cannot
+ * display the given character.
*
- * Side effects:
- * The font object's subFontArray is updated to contain a reference
- * to the newly allocated SubFont. The table of SubFonts might be
- * extended, and if a non-NULL reference to a subfont pointer is
- * available, it is updated if it previously pointed into the old
- * subfont table.
+ * Side effects:
+ * The font object's subFontArray is updated to contain a reference to
+ * the newly allocated SubFont. The table of SubFonts might be extended,
+ * and if a non-NULL reference to a subfont pointer is available, it is
+ * updated if it previously pointed into the old subfont table.
*
*-------------------------------------------------------------------------
*/
static SubFont *
-CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
- UnixFont *fontPtr; /* The font object that will own the new
+CanUseFallback(
+ UnixFont *fontPtr, /* The font object that will own the new
* screen font. */
- CONST char *faceName; /* Desired face name for new screen font. */
- int ch; /* The Unicode character that the new
- * screen font must be able to display. */
- SubFont **fixSubFontPtrPtr; /* Subfont reference to fix up if we
+ CONST char *faceName, /* Desired face name for new screen font. */
+ int ch, /* The Unicode character that the new screen
+ * font must be able to display. */
+ SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
* reallocate our subfont table. */
{
- int i, nameIdx, numNames, srcLen;
+ int i, nameIdx, numNames, srcLen, numEncodings, bestIdx[2];
Tk_Uid hateFoundry;
- int bestIdx[2];
CONST char *charset, *hateCharset;
unsigned int bestScore[2];
- char **nameList, **nameListOrig;
+ char **nameList, **nameListOrig, src[TCL_UTF_MAX];
FontAttributes want, got;
- char src[TCL_UTF_MAX];
Display *display;
SubFont subFont;
XFontStruct *fontStructPtr;
Tcl_DString dsEncodings;
- int numEncodings;
Tcl_Encoding *encodingCachePtr;
/*
* Assume: the face name is times.
* Assume: adobe:times:iso8859-1 has already been used.
*
- * Are there any versions of times that can display this
- * character (e.g., perhaps linotype:times:iso8859-2)?
+ * Are there any versions of times that can display this character (e.g.,
+ * perhaps linotype:times:iso8859-2)?
* a. Get list of all times fonts.
* b1. Cross out all names whose encodings we've already used.
* b2. Cross out all names whose foundry & encoding we've already seen.
* c. Cross out all names whose encoding cannot handle the character.
* d. Rank each name and pick the best match.
- * e. If that font cannot actually display the character, cross
- * out all names with the same foundry and encoding and go
- * back to (c).
+ * e. If that font cannot actually display the character, cross out all
+ * names with the same foundry and encoding and go back to (c).
*/
display = fontPtr->display;
@@ -2339,7 +2445,7 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
charset = NULL; /* lint, since numNames must be > 0 to get here. */
- retry:
+ retry:
bestIdx[0] = -1;
bestIdx[1] = -1;
bestScore[0] = (unsigned int) -1;
@@ -2349,7 +2455,7 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
char dst[16];
int scalable, srcRead, dstWrote;
unsigned int score;
-
+
if (nameList[nameIdx] == NULL) {
continue;
}
@@ -2360,9 +2466,8 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
charset = GetEncodingAlias(got.xa.charset);
if (hateFoundry != NULL) {
/*
- * E. If the font we picked cannot actually display the
- * character, cross out all names with the same foundry and
- * encoding.
+ * E. If the font we picked cannot actually display the character,
+ * cross out all names with the same foundry and encoding.
*/
if ((hateFoundry == got.xa.foundry)
@@ -2373,7 +2478,7 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
/*
* B. Cross out all names whose encodings we've already used.
*/
-
+
for (i = 0; i < fontPtr->numSubFonts; i++) {
encoding = fontPtr->subFontArray[i].familyPtr->encoding;
if (strcmp(charset, Tcl_GetEncodingName(encoding)) == 0) {
@@ -2381,11 +2486,11 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
}
}
}
-
+
/*
* C. Cross out all names whose encoding cannot handle the character.
*/
-
+
encodingCachePtr = (Tcl_Encoding *) Tcl_DStringValue(&dsEncodings);
for (i = numEncodings; --i >= 0; encodingCachePtr++) {
encoding = *encodingCachePtr;
@@ -2403,8 +2508,8 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
sizeof(encoding));
numEncodings++;
}
- Tcl_UtfToExternal(NULL, encoding, src, srcLen,
- TCL_ENCODING_STOPONERROR, NULL, dst, sizeof(dst), &srcRead,
+ Tcl_UtfToExternal(NULL, encoding, src, srcLen,
+ TCL_ENCODING_STOPONERROR, NULL, dst, sizeof(dst), &srcRead,
&dstWrote, NULL);
if (dstWrote == 0) {
goto crossout;
@@ -2425,11 +2530,11 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
}
continue;
- crossout:
+ crossout:
if (nameList == nameListOrig) {
/*
- * Not allowed to change pointers to memory that X gives you,
- * so make a copy.
+ * Not allowed to change pointers to memory that X gives you, so
+ * make a copy.
*/
nameList = (char **) ckalloc(numNames * sizeof(char *));
@@ -2438,7 +2543,8 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
nameList[nameIdx] = NULL;
}
- fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx, bestScore);
+ fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx,
+ bestScore);
encodingCachePtr = (Tcl_Encoding *) Tcl_DStringValue(&dsEncodings);
for (i = numEncodings; --i >= 0; encodingCachePtr++) {
@@ -2475,8 +2581,9 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
SubFont *newPtr;
-
- newPtr = (SubFont *) ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
+
+ newPtr = (SubFont *)
+ ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
memcpy((char *) newPtr, fontPtr->subFontArray,
fontPtr->numSubFonts * sizeof(SubFont));
if (fixSubFontPtrPtr != NULL) {
@@ -2502,12 +2609,12 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
*
* RankAttributes --
*
- * Determine how close the attributes of the font in question match
- * the attributes that we want.
+ * Determine how close the attributes of the font in question match the
+ * attributes that we want.
*
* Results:
- * The return value is the score; lower numbers are better.
- * *scalablePtr is set to 0 if the font was not scalable, 1 otherwise.
+ * The return value is the score; lower numbers are better. *scalablePtr
+ * is set to 0 if the font was not scalable, 1 otherwise.
*
* Side effects:
* None.
@@ -2516,9 +2623,9 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
*/
static unsigned int
-RankAttributes(wantPtr, gotPtr)
- FontAttributes *wantPtr; /* The desired attributes. */
- FontAttributes *gotPtr; /* The attributes we have to live with. */
+RankAttributes(
+ FontAttributes *wantPtr, /* The desired attributes. */
+ FontAttributes *gotPtr) /* The attributes we have to live with. */
{
unsigned int penalty;
@@ -2544,8 +2651,8 @@ RankAttributes(wantPtr, gotPtr)
if (gotPtr->fa.size == 0) {
/*
- * A scalable font is almost always acceptable, but the
- * corresponding bitmapped font would be better.
+ * A scalable font is almost always acceptable, but the corresponding
+ * bitmapped font would be better.
*/
penalty += 10;
@@ -2555,7 +2662,7 @@ RankAttributes(wantPtr, gotPtr)
/*
* It's worse to be too large than to be too small.
*/
-
+
diff = (-gotPtr->fa.size - -wantPtr->fa.size);
if (diff > 0) {
penalty += 600;
@@ -2571,7 +2678,7 @@ RankAttributes(wantPtr, gotPtr)
penalty += 65000;
gotAlias = GetEncodingAlias(gotPtr->xa.charset);
- wantAlias = GetEncodingAlias(wantPtr->xa.charset);
+ wantAlias = GetEncodingAlias(wantPtr->xa.charset);
if (strcmp(gotAlias, wantAlias) != 0) {
penalty += 30000;
for (i = 0; encodingList[i] != NULL; i++) {
@@ -2592,9 +2699,8 @@ RankAttributes(wantPtr, gotPtr)
* GetScreenFont --
*
* Given the names for the best scalable and best bitmapped font,
- * actually construct an XFontStruct based on the best XLFD.
- * This is where all the alias and fallback substitution bottoms
- * out.
+ * actually construct an XFontStruct based on the best XLFD. This is
+ * where all the alias and fallback substitution bottoms out.
*
* Results:
* The screen font that best corresponds to the set of attributes.
@@ -2606,16 +2712,16 @@ RankAttributes(wantPtr, gotPtr)
*/
static XFontStruct *
-GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
- Display *display; /* Display for new XFontStruct. */
- FontAttributes *wantPtr; /* Contains desired actual pixel-size if the
+GetScreenFont(
+ Display *display, /* Display for new XFontStruct. */
+ FontAttributes *wantPtr, /* Contains desired actual pixel-size if the
* best font was scalable. */
- char **nameList; /* Array of XLFDs. */
- int bestIdx[2]; /* Indices into above array for XLFD of
- * best bitmapped and best scalable font. */
- unsigned int bestScore[2]; /* Scores of best bitmapped and best
- * scalable font. XLFD corresponding to
- * lowest score will be constructed. */
+ char **nameList, /* Array of XLFDs. */
+ int bestIdx[2], /* Indices into above array for XLFD of best
+ * bitmapped and best scalable font. */
+ unsigned int bestScore[2]) /* Scores of best bitmapped and best scalable
+ * font. XLFD corresponding to lowest score
+ * will be constructed. */
{
XFontStruct *fontStructPtr;
@@ -2624,24 +2730,23 @@ GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
}
/*
- * Now we know which is the closest matching scalable font and the
- * closest matching bitmapped font. If the scalable font was a
- * better match, try getting the scalable font; however, if the
- * scalable font was not actually available in the desired
- * pointsize, fall back to the closest bitmapped font.
+ * Now we know which is the closest matching scalable font and the closest
+ * matching bitmapped font. If the scalable font was a better match, try
+ * getting the scalable font; however, if the scalable font was not
+ * actually available in the desired pointsize, fall back to the closest
+ * bitmapped font.
*/
fontStructPtr = NULL;
if (bestScore[1] < bestScore[0]) {
- char *str, *rest;
- char buf[256];
+ char *str, *rest, buf[256];
int i;
-
+
/*
* Fill in the desired pixel size for this font.
*/
- tryscale:
+ tryscale:
str = nameList[bestIdx[1]];
for (i = 0; i < XLFD_PIXEL_SIZE; i++) {
str = strchr(str + 1, '-');
@@ -2661,8 +2766,8 @@ GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
fontStructPtr = XLoadQueryFont(display, nameList[bestIdx[0]]);
if (fontStructPtr == NULL) {
/*
- * This shouldn't happen because the font name is one of the
- * names that X gave us to use, but it does anyhow.
+ * This shouldn't happen because the font name is one of the names
+ * that X gave us to use, but it does anyhow.
*/
if (bestScore[1] < INT_MAX) {
@@ -2679,22 +2784,22 @@ GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
*
* GetSystemFont --
*
- * Absolute fallback mechanism, called when we need a font and no
- * other font can be found and/or instantiated.
+ * Absolute fallback mechanism, called when we need a font and no other
+ * font can be found and/or instantiated.
*
* Results:
- * A pointer to a font. Never NULL.
+ * A pointer to a font. Never NULL.
*
* Side effects:
- * If there are NO fonts installed on the system, this call will
- * panic, but how did you get X running in that case?
+ * If there are NO fonts installed on the system, this call will panic,
+ * but how did you get X running in that case?
*
*---------------------------------------------------------------------------
*/
static XFontStruct *
-GetSystemFont(display)
- Display *display; /* Display for new XFontStruct. */
+GetSystemFont(
+ Display *display) /* Display for new XFontStruct. */
{
XFontStruct *fontStructPtr;
@@ -2702,7 +2807,7 @@ GetSystemFont(display)
if (fontStructPtr == NULL) {
fontStructPtr = XLoadQueryFont(display, "*");
if (fontStructPtr == NULL) {
- panic("TkpGetFontFromAttributes: cannot get any font");
+ Tcl_Panic("TkpGetFontFromAttributes: cannot get any font");
}
}
return fontStructPtr;
@@ -2713,8 +2818,8 @@ GetSystemFont(display)
*
* GetFontAttributes --
*
- * Given a screen font, determine its actual attributes, which are
- * not necessarily the attributes that were used to construct it.
+ * Given a screen font, determine its actual attributes, which are not
+ * necessarily the attributes that were used to construct it.
*
* Results:
* *faPtr is filled with the screen font's attributes.
@@ -2726,14 +2831,14 @@ GetSystemFont(display)
*/
static int
-GetFontAttributes(display, fontStructPtr, faPtr)
- Display *display; /* Display that owns the screen font. */
- XFontStruct *fontStructPtr; /* Screen font to query. */
- FontAttributes *faPtr; /* For storing attributes of screen font. */
+GetFontAttributes(
+ Display *display, /* Display that owns the screen font. */
+ XFontStruct *fontStructPtr, /* Screen font to query. */
+ FontAttributes *faPtr) /* For storing attributes of screen font. */
{
unsigned long value;
char *name;
-
+
if ((XGetFontProperty(fontStructPtr, XA_FONT, &value) != False) &&
(value != 0)) {
name = XGetAtomName(display, (Atom) value);
@@ -2747,11 +2852,13 @@ GetFontAttributes(display, fontStructPtr, faPtr)
TkInitFontAttributes(&faPtr->fa);
TkInitXLFDAttributes(&faPtr->xa);
}
+
/*
- * Do last ditch check for family. It seems that some X servers can
- * fail on the X font calls above, slipping through earlier checks.
- * X-Win32 5.4 is one of these.
+ * Do last ditch check for family. It seems that some X servers can fail
+ * on the X font calls above, slipping through earlier checks. X-Win32 5.4
+ * is one of these.
*/
+
if (faPtr->fa.family == NULL) {
faPtr->fa.family = Tk_GetUid("");
faPtr->xa.foundry = Tk_GetUid("");
@@ -2765,8 +2872,8 @@ GetFontAttributes(display, fontStructPtr, faPtr)
*
* ListFonts --
*
- * Utility function to return the array of all XLFDs on the system
- * with the specified face name.
+ * Utility function to return the array of all XLFDs on the system with
+ * the specified face name.
*
* Results:
* The return value is an array of XLFDs, which should be freed with
@@ -2777,13 +2884,13 @@ GetFontAttributes(display, fontStructPtr, faPtr)
*
*---------------------------------------------------------------------------
*/
-
+
static char **
-ListFonts(display, faceName, numNamesPtr)
- Display *display; /* Display to query. */
- CONST char *faceName; /* Desired face name, or "*" for all. */
- int *numNamesPtr; /* Filled with length of returned array, or
- * 0 if no names were found. */
+ListFonts(
+ Display *display, /* Display to query. */
+ CONST char *faceName, /* Desired face name, or "*" for all. */
+ int *numNamesPtr) /* Filled with length of returned array, or 0
+ * if no names were found. */
{
char buf[256];
@@ -2792,15 +2899,15 @@ ListFonts(display, faceName, numNamesPtr)
}
static char **
-ListFontOrAlias(display, faceName, numNamesPtr)
- Display *display; /* Display to query. */
- CONST char *faceName; /* Desired face name, or "*" for all. */
- int *numNamesPtr; /* Filled with length of returned array, or
- * 0 if no names were found. */
+ListFontOrAlias(
+ Display *display, /* Display to query. */
+ CONST char *faceName, /* Desired face name, or "*" for all. */
+ int *numNamesPtr) /* Filled with length of returned array, or 0
+ * if no names were found. */
{
char **nameList, **aliases;
int i;
-
+
nameList = ListFonts(display, faceName, numNamesPtr);
if (nameList != NULL) {
return nameList;
@@ -2823,19 +2930,18 @@ ListFontOrAlias(display, faceName, numNamesPtr)
*
* IdentifySymbolEncodings --
*
- * If the font attributes refer to a symbol font, update the
- * charset field of the font attributes so that it reflects the
- * encoding of that symbol font. In general, the raw value for
- * the charset field parsed from an XLFD is meaningless for symbol
- * fonts.
+ * If the font attributes refer to a symbol font, update the charset
+ * field of the font attributes so that it reflects the encoding of that
+ * symbol font. In general, the raw value for the charset field parsed
+ * from an XLFD is meaningless for symbol fonts.
*
* Symbol fonts are all fonts whose name appears in the symbolClass.
*
* Results:
- * The return value is non-zero if the font attributes specify a
- * symbol font, or 0 otherwise. If a non-zero value is returned
- * the charset field of the font attributes will be changed to
- * the string that represents the actual encoding for the symbol font.
+ * The return value is non-zero if the font attributes specify a symbol
+ * font, or 0 otherwise. If a non-zero value is returned the charset
+ * field of the font attributes will be changed to the string that
+ * represents the actual encoding for the symbol font.
*
* Side effects:
* None.
@@ -2844,8 +2950,8 @@ ListFontOrAlias(display, faceName, numNamesPtr)
*/
static int
-IdentifySymbolEncodings(faPtr)
- FontAttributes *faPtr;
+IdentifySymbolEncodings(
+ FontAttributes *faPtr)
{
int i, j;
char **aliases, **symbolClass;
@@ -2872,14 +2978,14 @@ IdentifySymbolEncodings(faPtr)
*
* GetEncodingAlias --
*
- * Map the name of an encoding to another name that should be used
- * when actually loading the encoding. For instance, the encodings
- * "jisc6226.1978", "jisx0208.1983", "jisx0208.1990", and
- * "jisx0208.1996" are well-known names for the same encoding and
- * are represented by one encoding table: "jis0208".
+ * Map the name of an encoding to another name that should be used when
+ * actually loading the encoding. For instance, the encodings
+ * "jisc6226.1978", "jisx0208.1983", "jisx0208.1990", and "jisx0208.1996"
+ * are well-known names for the same encoding and are represented by one
+ * encoding table: "jis0208".
*
* Results:
- * As above. If the name has no alias, the original name is returned.
+ * As above. If the name has no alias, the original name is returned.
*
* Side effects:
* None.
@@ -2888,11 +2994,11 @@ IdentifySymbolEncodings(faPtr)
*/
static CONST char *
-GetEncodingAlias(name)
- CONST char *name; /* The name to look up. */
+GetEncodingAlias(
+ CONST char *name) /* The name to look up. */
{
EncodingAlias *aliasPtr;
-
+
for (aliasPtr = encodingAliases; aliasPtr->aliasPattern != NULL; ) {
if (Tcl_StringMatch((char *) name, aliasPtr->aliasPattern)) {
return aliasPtr->realName;
@@ -2901,3 +3007,11 @@ GetEncodingAlias(name)
}
return name;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index 1b1b4ab..1cc90a5 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -1,29 +1,21 @@
-/*
+/*
* tkUnixInit.c --
*
- * This file contains Unix-specific interpreter initialization
- * functions.
+ * This file contains Unix-specific interpreter initialization functions.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkInt.h"
#include "tkUnixInt.h"
-/*
- * The Init script (common to Windows and Unix platforms) is
- * defined in tkInitScript.h
- */
-#include "tkInitScript.h"
-
#ifdef HAVE_COREFOUNDATION
-static int MacOSXGetLibraryPath _ANSI_ARGS_((
- Tcl_Interp *interp));
+static int GetLibraryPath(Tcl_Interp *interp);
+#else
+#define GetLibraryPath(dummy) (void)0
#endif /* HAVE_COREFOUNDATION */
-
/*
*----------------------------------------------------------------------
@@ -34,8 +26,8 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
* tk_library variable.
*
* Results:
- * Returns a standard Tcl result. Leaves an error message or result
- * in the interp's result.
+ * Returns a standard Tcl result. Leaves an error message or result in
+ * the interp's result.
*
* Side effects:
* Sets "tk_library" Tcl variable, runs "tk.tcl" script.
@@ -44,14 +36,12 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
*/
int
-TkpInit(interp)
- Tcl_Interp *interp;
+TkpInit(
+ Tcl_Interp *interp)
{
TkCreateXEventSource();
-#ifdef HAVE_COREFOUNDATION
- MacOSXGetLibraryPath(interp);
-#endif /* HAVE_COREFOUNDATION */
- return Tcl_Eval(interp, initScript);
+ GetLibraryPath(interp);
+ return TCL_OK;
}
/*
@@ -59,9 +49,9 @@ TkpInit(interp)
*
* TkpGetAppName --
*
- * Retrieves the name of the current application from a platform
- * specific location. For Unix, the application name is the tail
- * of the path contained in the tcl variable argv0.
+ * Retrieves the name of the current application from a platform specific
+ * location. For Unix, the application name is the tail of the path
+ * contained in the tcl variable argv0.
*
* Results:
* Returns the application name in the given Tcl_DString.
@@ -73,9 +63,9 @@ TkpInit(interp)
*/
void
-TkpGetAppName(interp, namePtr)
- Tcl_Interp *interp;
- Tcl_DString *namePtr; /* A previously initialized Tcl_DString. */
+TkpGetAppName(
+ Tcl_Interp *interp,
+ Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
{
CONST char *p, *name;
@@ -96,8 +86,8 @@ TkpGetAppName(interp, namePtr)
*
* TkpDisplayWarning --
*
- * This routines is called from Tk_Main to display warning
- * messages that occur during startup.
+ * This routines is called from Tk_Main to display warning messages that
+ * occur during startup.
*
* Results:
* None.
@@ -109,9 +99,9 @@ TkpGetAppName(interp, namePtr)
*/
void
-TkpDisplayWarning(msg, title)
- CONST char *msg; /* Message to be displayed. */
- CONST char *title; /* Title of warning. */
+TkpDisplayWarning(
+ CONST char *msg, /* Message to be displayed. */
+ CONST char *title) /* Title of warning. */
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
@@ -122,14 +112,15 @@ TkpDisplayWarning(msg, title)
}
}
+#ifdef HAVE_COREFOUNDATION
+
/*
*----------------------------------------------------------------------
*
- * MacOSXGetLibraryPath --
+ * GetLibraryPath --
*
- * If we have a bundle structure for the Tk installation,
- * then check there first to see if we can find the libraries
- * there.
+ * If we have a bundle structure for the Tk installation, then check
+ * there first to see if we can find the libraries there.
*
* Results:
* TCL_OK if we have found the tk library; TCL_ERROR otherwise.
@@ -140,19 +131,31 @@ TkpDisplayWarning(msg, title)
*----------------------------------------------------------------------
*/
-#ifdef HAVE_COREFOUNDATION
static int
-MacOSXGetLibraryPath(Tcl_Interp *interp)
+GetLibraryPath(
+ Tcl_Interp *interp)
{
- int foundInFramework = TCL_ERROR;
#ifdef TK_FRAMEWORK
+ int foundInFramework = TCL_ERROR;
char tkLibPath[PATH_MAX + 1];
- foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
- "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX, tkLibPath);
+
+ foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
+ "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX,
+ tkLibPath);
if (tkLibPath[0] != '\0') {
Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY);
}
-#endif
return foundInFramework;
+#else
+ return TCL_ERROR;
+#endif
}
#endif /* HAVE_COREFOUNDATION */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixInt.h b/unix/tkUnixInt.h
index f5bd910..805f314 100644
--- a/unix/tkUnixInt.h
+++ b/unix/tkUnixInt.h
@@ -2,13 +2,12 @@
* tkUnixInt.h --
*
* This file contains declarations that are shared among the
- * UNIX-specific parts of Tk but aren't used by the rest of
- * Tk.
+ * UNIX-specific parts of Tk but aren't used by the rest of Tk.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKUNIXINT
@@ -19,9 +18,18 @@
#endif
/*
- * Prototypes for procedures that are referenced in files other
- * than the ones they're defined in.
+ * Prototypes for procedures that are referenced in files other than the ones
+ * they're defined in.
*/
+
#include "tkIntPlatDecls.h"
#endif /* _TKUNIXINT */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index 8753fdb..030e472 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkUnixKey.c --
*
* This file contains routines for dealing with international keyboard
@@ -6,53 +6,71 @@
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
/*
- * Prototypes for local procedures defined in this file:
+ * Prototypes for local functions defined in this file:
*/
-
/*
*----------------------------------------------------------------------
*
* Tk_SetCaretPos --
*
- * This enables correct placement of the XIM caret. This is called
- * by widgets to indicate their cursor placement, and the caret
- * location is used by TkpGetString to place the XIM caret.
- * This is currently only used for over-the-spot XIM.
- *
- * Results:
- * None
- *
- * Side effects:
- * None
+ * This enables correct placement of the XIM caret. This is called by
+ * widgets to indicate their cursor placement. This is currently only
+ * used for over-the-spot XIM.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetCaretPos(tkwin, x, y, height)
- Tk_Window tkwin;
- int x;
- int y;
- int height;
+Tk_SetCaretPos(
+ Tk_Window tkwin,
+ int x,
+ int y,
+ int height)
{
- TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ TkDisplay *dispPtr = winPtr->dispPtr;
+ if ( dispPtr->caret.winPtr == winPtr
+ && dispPtr->caret.x == x
+ && dispPtr->caret.y == y
+ && dispPtr->caret.height == height)
+ {
+ return;
+ }
+
+ dispPtr->caret.winPtr = winPtr;
+ dispPtr->caret.x = x;
+ dispPtr->caret.y = y;
+ dispPtr->caret.height = height;
+
+#ifdef TK_USE_INPUT_METHODS
/*
- * Use height for best placement of the XIM over-the-spot box.
+ * Adjust the XIM caret position.
*/
+ if ( (dispPtr->flags & TK_DISPLAY_USE_IM)
+ && (dispPtr->inputStyle & XIMPreeditPosition)
+ && (winPtr->inputContext != NULL) )
+ {
+ XVaNestedList preedit_attr;
+ XPoint spot;
- caretPtr->winPtr = ((TkWindow *) tkwin);
- caretPtr->x = x;
- caretPtr->y = y;
- caretPtr->height = height;
+ spot.x = dispPtr->caret.x;
+ spot.y = dispPtr->caret.y + dispPtr->caret.height;
+ preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, (void *) NULL);
+ XSetICValues(winPtr->inputContext,
+ XNPreeditAttributes, preedit_attr,
+ (void *) NULL);
+ XFree(preedit_attr);
+ }
+#endif
}
/*
@@ -66,47 +84,69 @@ Tk_SetCaretPos(tkwin, x, y, height)
* Returns the UTF string.
*
* Side effects:
- * Stores the input string in the specified Tcl_DString. Modifies
- * the internal input state. This routine can only be called
- * once for a given event.
+ * Stores the input string in the specified Tcl_DString. Modifies the
+ * internal input state. This routine can only be called once for a given
+ * event.
*
*----------------------------------------------------------------------
*/
char *
-TkpGetString(winPtr, eventPtr, dsPtr)
- TkWindow *winPtr; /* Window where event occurred: needed to
- * get input context. */
- XEvent *eventPtr; /* X keyboard event. */
- Tcl_DString *dsPtr; /* Uninitialized or empty string to hold
- * result. */
+TkpGetString(
+ TkWindow *winPtr, /* Window where event occurred */
+ XEvent *eventPtr, /* X keyboard event. */
+ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */
{
int len;
Tcl_DString buf;
- Status status;
-#ifdef TK_USE_INPUT_METHODS
- TkDisplay *dispPtr = winPtr->dispPtr;
-#endif
+ TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr;
/*
- * Overallocate the dstring to the maximum stack amount.
+ * If we have the value cached already, use it now. [Bug 1373712]
*/
- Tcl_DStringInit(&buf);
- Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
+ if (kePtr->charValuePtr != NULL) {
+ Tcl_DStringSetLength(dsPtr, kePtr->charValueLen);
+ memcpy(Tcl_DStringValue(dsPtr), kePtr->charValuePtr,
+ (unsigned) kePtr->charValueLen+1);
+ return Tcl_DStringValue(dsPtr);
+ }
#ifdef TK_USE_INPUT_METHODS
- if ((dispPtr->flags & TK_DISPLAY_USE_IM)
+ if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)
&& (winPtr->inputContext != NULL)
- && (eventPtr->type == KeyPress)) {
-#if TK_XIM_SPOT
- XVaNestedList preedit_attr;
- XPoint spot;
-#endif
+ && (eventPtr->type == KeyPress))
+ {
+ Status status;
+
+#if X_HAVE_UTF8_STRING
+ Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-1);
+ len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
+ &kePtr->keysym, &status);
+
+ if (status == XBufferOverflow) { /* Expand buffer and try again */
+ Tcl_DStringSetLength(dsPtr, len);
+ len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
+ &kePtr->keysym, &status);
+ }
+ if ((status != XLookupChars) && (status != XLookupBoth)) {
+ len = 0;
+ }
+ Tcl_DStringSetLength(dsPtr, len);
+#else /* !X_HAVE_UTF8_STRING */
+ /*
+ * Overallocate the dstring to the maximum stack amount.
+ */
+
+ Tcl_DStringInit(&buf);
+ Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
- (KeySym *) NULL, &status);
+ Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
+ &kePtr->keysym, &status);
+
/*
* If the buffer wasn't big enough, grow the buffer and try again.
*/
@@ -114,64 +154,79 @@ TkpGetString(winPtr, eventPtr, dsPtr)
if (status == XBufferOverflow) {
Tcl_DStringSetLength(&buf, len);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(&buf), len, (KeySym *) NULL, &status);
+ Tcl_DStringValue(&buf), len, &kePtr->keysym, &status);
}
if ((status != XLookupChars) && (status != XLookupBoth)) {
len = 0;
}
-#if TK_XIM_SPOT
+ Tcl_DStringSetLength(&buf, len);
+ Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
+ Tcl_DStringFree(&buf);
+#endif /* X_HAVE_UTF8_STRING */
+ } else
+#endif /* TK_USE_INPUT_METHODS */
+ {
/*
- * Adjust the XIM caret position. We might want to check that
- * this is the right caret.winPtr as well.
+ * Fall back to convert a keyboard event to a UTF-8 string using
+ * XLookupString. This is used when input methods are turned off and
+ * for KeyRelease events.
+ *
+ * Note: XLookupString() normally returns a single ISO Latin 1 or
+ * ASCII control character.
*/
- if (dispPtr->flags & TK_DISPLAY_XIM_SPOT) {
- spot.x = dispPtr->caret.x;
- spot.y = dispPtr->caret.y + dispPtr->caret.height;
- preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
- XSetICValues(winPtr->inputContext,
- XNPreeditAttributes, preedit_attr, NULL);
- XFree(preedit_attr);
- }
-#endif
- } else {
+
+ Tcl_DStringInit(&buf);
+ Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
- Tcl_DStringLength(&buf), (KeySym *) NULL,
- (XComposeStatus *) NULL);
+ TCL_DSTRING_STATIC_SIZE, &kePtr->keysym, 0);
+ Tcl_DStringValue(&buf)[len] = '\0';
+
+ if (len == 1) {
+ len = Tcl_UniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0],
+ Tcl_DStringValue(dsPtr));
+ Tcl_DStringSetLength(dsPtr, len);
+ } else {
+ /*
+ * len > 1 should only happen if someone has called XRebindKeysym.
+ * Assume UTF-8.
+ */
+
+ Tcl_DStringSetLength(dsPtr, len);
+ strncpy(Tcl_DStringValue(dsPtr), Tcl_DStringValue(&buf), len);
+ }
}
-#else /* TK_USE_INPUT_METHODS */
- len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
- Tcl_DStringLength(&buf), (KeySym *) NULL,
- (XComposeStatus *) NULL);
-#endif /* TK_USE_INPUT_METHODS */
- Tcl_DStringSetLength(&buf, len);
- Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
- Tcl_DStringFree(&buf);
+ /*
+ * Cache the string in the event so that if/when we return to this
+ * function, we will be able to produce it without asking X. This stops us
+ * from having to reenter the XIM engine. [Bug 1373712]
+ */
+ kePtr->charValuePtr = ckalloc((unsigned) len + 1);
+ kePtr->charValueLen = len;
+ memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1);
return Tcl_DStringValue(dsPtr);
}
/*
- * When mapping from a keysym to a keycode, need
- * information about the modifier state that should be used
- * so that when they call XKeycodeToKeysym taking into
- * account the xkey.state, they will get back the original
- * keysym.
+ * When mapping from a keysym to a keycode, need information about the
+ * modifier state that should be used so that when they call XKeycodeToKeysym
+ * taking into account the xkey.state, they will get back the original keysym.
*/
void
-TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
- Tk_Window tkwin;
- KeySym keySym;
- XEvent *eventPtr;
+TkpSetKeycodeAndState(
+ Tk_Window tkwin,
+ KeySym keySym,
+ XEvent *eventPtr)
{
Display *display;
int state;
KeyCode keycode;
-
+
display = Tk_Display(tkwin);
-
+
if (keySym == NoSymbol) {
keycode = 0;
} else {
@@ -201,29 +256,50 @@ TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
*
* TkpGetKeySym --
*
- * Given an X KeyPress or KeyRelease event, map the
- * keycode in the event into a KeySym.
+ * Given an X KeyPress or KeyRelease event, map the keycode in the event
+ * into a KeySym.
*
* Results:
- * The return value is the KeySym corresponding to
- * eventPtr, or NoSymbol if no matching Keysym could be
- * found.
+ * The return value is the KeySym corresponding to eventPtr, or NoSymbol
+ * if no matching Keysym could be found.
*
* Side effects:
- * In the first call for a given display, keycode-to-
- * KeySym maps get loaded.
+ * In the first call for a given display, keycode-to-KeySym maps get
+ * loaded.
*
*----------------------------------------------------------------------
*/
KeySym
-TkpGetKeySym(dispPtr, eventPtr)
- TkDisplay *dispPtr; /* Display in which to
- * map keycode. */
- XEvent *eventPtr; /* Description of X event. */
+TkpGetKeySym(
+ TkDisplay *dispPtr, /* Display in which to map keycode. */
+ XEvent *eventPtr) /* Description of X event. */
{
KeySym sym;
int index;
+ TkKeyEvent* kePtr = (TkKeyEvent*) eventPtr;
+
+#ifdef TK_USE_INPUT_METHODS
+ /*
+ * If input methods are active, we may already have determined a keysym.
+ * Return it.
+ */
+
+ if (eventPtr->type == KeyPress && dispPtr
+ && (dispPtr->flags & TK_DISPLAY_USE_IM)) {
+ if (kePtr->charValuePtr == NULL) {
+ Tcl_DString ds;
+ TkWindow *winPtr = (TkWindow *)
+ Tk_IdToWindow(eventPtr->xany.display, eventPtr->xany.window);
+ Tcl_DStringInit(&ds);
+ (void) TkpGetString(winPtr, eventPtr, &ds);
+ Tcl_DStringFree(&ds);
+ }
+ if (kePtr->charValuePtr != NULL) {
+ return kePtr->keysym;
+ }
+ }
+#endif
/*
* Refresh the mapping information if it's stale
@@ -234,9 +310,9 @@ TkpGetKeySym(dispPtr, eventPtr)
}
/*
- * Figure out which of the four slots in the keymap vector to
- * use for this key. Refer to Xlib documentation for more info
- * on how this computation works.
+ * Figure out which of the four slots in the keymap vector to use for this
+ * key. Refer to Xlib documentation for more info on how this computation
+ * works.
*/
index = 0;
@@ -251,10 +327,9 @@ TkpGetKeySym(dispPtr, eventPtr)
sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
/*
- * Special handling: if the key was shifted because of Lock, but
- * lock is only caps lock, not shift lock, and the shifted keysym
- * isn't upper-case alphabetic, then switch back to the unshifted
- * keysym.
+ * Special handling: if the key was shifted because of Lock, but lock is
+ * only caps lock, not shift lock, and the shifted keysym isn't upper-case
+ * alphabetic, then switch back to the unshifted keysym.
*/
if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
@@ -269,8 +344,8 @@ TkpGetKeySym(dispPtr, eventPtr)
}
/*
- * Another bit of special handling: if this is a shifted key and there
- * is no keysym defined, then use the keysym for the unshifted key.
+ * Another bit of special handling: if this is a shifted key and there is
+ * no keysym defined, then use the keysym for the unshifted key.
*/
if ((index & 1) && (sym == NoSymbol)) {
@@ -285,10 +360,9 @@ TkpGetKeySym(dispPtr, eventPtr)
*
* TkpInitKeymapInfo --
*
- * This procedure is invoked to scan keymap information
- * to recompute stuff that's important for binding, such
- * as the modifier key (if any) that corresponds to "mode
- * switch".
+ * This function is invoked to scan keymap information to recompute stuff
+ * that's important for binding, such as the modifier key (if any) that
+ * corresponds to "mode switch".
*
* Results:
* None.
@@ -300,8 +374,8 @@ TkpGetKeySym(dispPtr, eventPtr)
*/
void
-TkpInitKeymapInfo(dispPtr)
- TkDisplay *dispPtr; /* Display for which to recompute keymap
+TkpInitKeymapInfo(
+ TkDisplay *dispPtr) /* Display for which to recompute keymap
* information. */
{
XModifierKeymap *modMapPtr;
@@ -314,9 +388,9 @@ TkpInitKeymapInfo(dispPtr)
modMapPtr = XGetModifierMapping(dispPtr->display);
/*
- * Check the keycodes associated with the Lock modifier. If
- * any of them is associated with the XK_Shift_Lock modifier,
- * then Lock has to be interpreted as Shift Lock, not Caps Lock.
+ * Check the keycodes associated with the Lock modifier. If any of them is
+ * associated with the XK_Shift_Lock modifier, then Lock has to be
+ * interpreted as Shift Lock, not Caps Lock.
*/
dispPtr->lockUsage = LU_IGNORE;
@@ -337,9 +411,9 @@ TkpInitKeymapInfo(dispPtr)
}
/*
- * Look through the keycodes associated with modifiers to see if
- * the the "mode switch", "meta", or "alt" keysyms are associated
- * with any modifiers. If so, remember their modifier mask bits.
+ * Look through the keycodes associated with modifiers to see if the the
+ * "mode switch", "meta", or "alt" keysyms are associated with any
+ * modifiers. If so, remember their modifier mask bits.
*/
dispPtr->modeModMask = 0;
@@ -372,8 +446,8 @@ TkpInitKeymapInfo(dispPtr)
}
dispPtr->numModKeyCodes = 0;
arraySize = KEYCODE_ARRAY_SIZE;
- dispPtr->modKeyCodes = (KeyCode *) ckalloc((unsigned)
- (KEYCODE_ARRAY_SIZE * sizeof(KeyCode)));
+ dispPtr->modKeyCodes = (KeyCode *)
+ ckalloc((unsigned) (KEYCODE_ARRAY_SIZE * sizeof(KeyCode)));
for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) {
if (*codePtr == 0) {
continue;
@@ -392,20 +466,29 @@ TkpInitKeymapInfo(dispPtr)
KeyCode *new;
/*
- * Ran out of space in the array; grow it.
+ * Ran out of space in the array; grow it.
*/
arraySize *= 2;
- new = (KeyCode *) ckalloc((unsigned)
- (arraySize * sizeof(KeyCode)));
- memcpy((VOID *) new, (VOID *) dispPtr->modKeyCodes,
+ new = (KeyCode *)
+ ckalloc((unsigned) (arraySize * sizeof(KeyCode)));
+ memcpy(new, dispPtr->modKeyCodes,
(dispPtr->numModKeyCodes * sizeof(KeyCode)));
ckfree((char *) dispPtr->modKeyCodes);
dispPtr->modKeyCodes = new;
}
dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr;
dispPtr->numModKeyCodes++;
- nextModCode: continue;
+ nextModCode:
+ continue;
}
XFreeModifiermap(modMapPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 9189183..eceb5b2 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -1,17 +1,15 @@
-/*
+/*
* tkUnixMenu.c --
*
* This module implements the UNIX platform-specific features of menus.
*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "default.h"
-#include "tkInt.h"
#include "tkUnixInt.h"
#include "tkMenu.h"
@@ -29,64 +27,78 @@
#define ENTRY_HELP_MENU ENTRY_PLATFORM_FLAG1
/*
+ * Shared with button widget.
+ */
+
+MODULE_SCOPE void TkpDrawCheckIndicator(Tk_Window tkwin,
+ Display *display, Drawable d, int x, int y,
+ Tk_3DBorder bgBorder, XColor *indicatorColor,
+ XColor *selectColor, XColor *disColor, int on,
+ int disabled, int mode);
+/*
+ * Indicator Draw Modes
+ */
+
+#define CHECK_BUTTON 0
+#define CHECK_MENU 1
+#define RADIO_BUTTON 2
+#define RADIO_MENU 3
+
+/*
* Procedures used internally.
*/
-static void SetHelpMenu _ANSI_ARGS_((TkMenu *menuPtr));
-static void DrawMenuEntryAccelerator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr,
+static void SetHelpMenu(TkMenu *menuPtr);
+static void DrawMenuEntryAccelerator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
Tk_3DBorder activeBorder, int x, int y,
- int width, int height, int drawArrow));
-static void DrawMenuEntryBackground _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, Tk_3DBorder activeBorder,
- Tk_3DBorder bgBorder, int x, int y,
- int width, int heigth));
-static void DrawMenuEntryIndicator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, GC indicatorGC,
- Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuEntryLabel _ANSI_ARGS_((
- TkMenu * menuPtr, TkMenuEntry *mePtr, Drawable d,
- GC gc, Tk_Font tkfont,
+ int width, int height, int drawArrow);
+static void DrawMenuEntryBackground(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d,
+ Tk_3DBorder activeBorder, Tk_3DBorder bgBorder,
+ int x, int y, int width, int heigth);
+static void DrawMenuEntryIndicator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d,
+ Tk_3DBorder border, XColor *indicatorColor,
+ XColor *disableColor, Tk_Font tkfont,
CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuSeparator _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static void DrawTearoffEntry _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static void DrawMenuUnderline _ANSI_ARGS_((TkMenu *menuPtr,
+ int width, int height);
+static void DrawMenuEntryLabel(TkMenu * menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void DrawMenuSeparator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void DrawTearoffEntry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, int x,
- int y, int width, int height));
-static void GetMenuAccelGeometry _ANSI_ARGS_((TkMenu *menuPtr,
+ Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void DrawMenuUnderline(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void GetMenuAccelGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
CONST Tk_FontMetrics *fmPtr, int *widthPtr,
- int *heightPtr));
-static void GetMenuLabelGeometry _ANSI_ARGS_((TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuIndicatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuSeparatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
+ int *heightPtr);
+static void GetMenuLabelGeometry(TkMenuEntry *mePtr,
Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetTearoffEntryGeometry _ANSI_ARGS_((TkMenu *menuPtr,
+ int *widthPtr, int *heightPtr);
+static void GetMenuIndicatorGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ CONST Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetMenuSeparatorGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ CONST Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetTearoffEntryGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
CONST Tk_FontMetrics *fmPtr, int *widthPtr,
- int *heightPtr));
-
+ int *heightPtr);
/*
*----------------------------------------------------------------------
@@ -100,15 +112,15 @@ static void GetTearoffEntryGeometry _ANSI_ARGS_((TkMenu *menuPtr,
* Standard TCL error.
*
* Side effects:
- * Allocates any platform specific allocations and places them
- * in the platformData field of the menuPtr.
+ * Allocates any platform specific allocations and places them in the
+ * platformData field of the menuPtr.
*
*----------------------------------------------------------------------
*/
int
-TkpNewMenu(menuPtr)
- TkMenu *menuPtr;
+TkpNewMenu(
+ TkMenu *menuPtr)
{
SetHelpMenu(menuPtr);
return TCL_OK;
@@ -119,8 +131,8 @@ TkpNewMenu(menuPtr)
*
* TkpDestroyMenu --
*
- * Destroys platform-specific menu structures. Called when the
- * generic menu structure is destroyed for the menu.
+ * Destroys platform-specific menu structures. Called when the generic
+ * menu structure is destroyed for the menu.
*
* Results:
* None.
@@ -132,8 +144,8 @@ TkpNewMenu(menuPtr)
*/
void
-TkpDestroyMenu(menuPtr)
- TkMenu *menuPtr;
+TkpDestroyMenu(
+ TkMenu *menuPtr)
{
/*
* Nothing to do.
@@ -145,8 +157,8 @@ TkpDestroyMenu(menuPtr)
*
* TkpDestroyMenuEntry --
*
- * Cleans up platform-specific menu entry items. Called when entry
- * is destroyed in the generic code.
+ * Cleans up platform-specific menu entry items. Called when entry is
+ * destroyed in the generic code.
*
* Results:
* None.
@@ -158,8 +170,8 @@ TkpDestroyMenu(menuPtr)
*/
void
-TkpDestroyMenuEntry(mEntryPtr)
- TkMenuEntry *mEntryPtr;
+TkpDestroyMenuEntry(
+ TkMenuEntry *mEntryPtr)
{
/*
* Nothing to do.
@@ -171,29 +183,28 @@ TkpDestroyMenuEntry(mEntryPtr)
*
* TkpConfigureMenuEntry --
*
- * Processes configuration options for menu entries. Called when
- * the generic options are processed for the menu.
+ * Processes configuration options for menu entries. Called when the
+ * generic options are processed for the menu.
*
* Results:
- * Returns standard TCL result. If TCL_ERROR is returned, then
- * the interp's result contains an error message.
+ * Returns standard TCL result. If TCL_ERROR is returned, then the
+ * interp's result contains an error message.
*
* Side effects:
- * Configuration information get set for mePtr; old resources
- * get freed, if any need it.
+ * Configuration information get set for mePtr; old resources get freed,
+ * if any need it.
*
*----------------------------------------------------------------------
*/
int
-TkpConfigureMenuEntry(mePtr)
- register TkMenuEntry *mePtr; /* Information about menu entry; may
- * or may not already have values for
- * some fields. */
+TkpConfigureMenuEntry(
+ register TkMenuEntry *mePtr)/* Information about menu entry; may or may
+ * not already have values for some fields. */
{
/*
- * If this is a cascade menu, and the child menu exists, check to
- * see if the child menu is a help menu.
+ * If this is a cascade menu, and the child menu exists, check to see if
+ * the child menu is a help menu.
*/
if ((mePtr->type == CASCADE_ENTRY) && (mePtr->namePtr != NULL)) {
@@ -214,9 +225,8 @@ TkpConfigureMenuEntry(mePtr)
* TkpMenuNewEntry --
*
* Called when a new entry is created in a menu. Fills in platform
- * specific data for the entry. The platformEntryData field
- * is used to store the indicator diameter for radio button
- * and check box entries.
+ * specific data for the entry. The platformEntryData field is used to
+ * store the indicator diameter for radio button and check box entries.
*
* Results:
* Standard TCL error.
@@ -228,8 +238,8 @@ TkpConfigureMenuEntry(mePtr)
*/
int
-TkpMenuNewEntry(mePtr)
- TkMenuEntry *mePtr;
+TkpMenuNewEntry(
+ TkMenuEntry *mePtr)
{
return TCL_OK;
}
@@ -251,9 +261,9 @@ TkpMenuNewEntry(mePtr)
*/
void
-TkpSetWindowMenuBar(tkwin, menuPtr)
- Tk_Window tkwin; /* The window we are setting */
- TkMenu *menuPtr; /* The menu we are setting */
+TkpSetWindowMenuBar(
+ Tk_Window tkwin, /* The window we are setting */
+ TkMenu *menuPtr) /* The menu we are setting */
{
if (menuPtr == NULL) {
TkUnixSetMenubar(tkwin, NULL);
@@ -267,9 +277,9 @@ TkpSetWindowMenuBar(tkwin, menuPtr)
*
* TkpSetMainMenuBar --
*
- * Called when a toplevel widget is brought to front. On the
- * Macintosh, sets up the menubar that goes accross the top
- * of the main monitor. On other platforms, nothing is necessary.
+ * Called when a toplevel widget is brought to front. On the Macintosh,
+ * sets up the menubar that goes accross the top of the main monitor. On
+ * other platforms, nothing is necessary.
*
* Results:
* None.
@@ -281,10 +291,10 @@ TkpSetWindowMenuBar(tkwin, menuPtr)
*/
void
-TkpSetMainMenubar(interp, tkwin, menuName)
- Tcl_Interp *interp;
- Tk_Window tkwin;
- char *menuName;
+TkpSetMainMenubar(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ char *menuName)
{
/*
* Nothing to do.
@@ -296,10 +306,9 @@ TkpSetMainMenubar(interp, tkwin, menuName)
*
* GetMenuIndicatorGeometry --
*
- * Fills out the geometry of the indicator in a menu item. Note
- * that the mePtr->height field must have already been filled in
- * by GetMenuLabelGeometry since this height depends on the label
- * height.
+ * Fills out the geometry of the indicator in a menu item. Note that the
+ * mePtr->height field must have already been filled in by
+ * GetMenuLabelGeometry since this height depends on the label height.
*
* Results:
* widthPtr and heightPtr point to the new geometry values.
@@ -311,13 +320,13 @@ TkpSetMainMenubar(interp, tkwin, menuName)
*/
static void
-GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenu *menuPtr; /* The menu we are drawing. */
- TkMenuEntry *mePtr; /* The entry we are interested in. */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated metrics */
- int *widthPtr; /* The resulting width */
- int *heightPtr; /* The resulting height */
+GetMenuIndicatorGeometry(
+ TkMenu *menuPtr, /* The menu we are drawing. */
+ TkMenuEntry *mePtr, /* The entry we are interested in. */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
@@ -326,22 +335,20 @@ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*widthPtr = (14 * mePtr->height) / 10;
*heightPtr = mePtr->height;
if (mePtr->type == CHECK_BUTTON_ENTRY) {
- mePtr->platformEntryData =
- (TkMenuPlatformEntryData) ((65 * mePtr->height)
- / 100);
+ mePtr->platformEntryData = (TkMenuPlatformEntryData)
+ INT2PTR((65 * mePtr->height) / 100);
} else {
- mePtr->platformEntryData =
- (TkMenuPlatformEntryData) ((75 * mePtr->height)
- / 100);
- }
+ mePtr->platformEntryData = (TkMenuPlatformEntryData)
+ INT2PTR((75 * mePtr->height) / 100);
+ }
} else {
*widthPtr = *heightPtr = mePtr->height;
if (mePtr->type == CHECK_BUTTON_ENTRY) {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- ((80 * mePtr->height) / 100);
+ INT2PTR((80 * mePtr->height) / 100);
} else {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- mePtr->height;
+ INT2PTR(mePtr->height);
}
}
} else {
@@ -380,13 +387,13 @@ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*/
static void
-GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenu *menuPtr; /* The menu was are drawing */
- TkMenuEntry *mePtr; /* The entry we are getting the geometry for */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr;/* The precalculated font metrics */
- int *widthPtr; /* The width of the acclerator area */
- int *heightPtr; /* The height of the accelerator area */
+GetMenuAccelGeometry(
+ TkMenu *menuPtr, /* The menu was are drawing */
+ TkMenuEntry *mePtr, /* The entry we are getting the geometry for */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *widthPtr, /* The width of the acclerator area */
+ int *heightPtr) /* The height of the accelerator area */
{
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
@@ -394,7 +401,7 @@ GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
} else if ((menuPtr->menuType != MENUBAR)
&& (mePtr->accelPtr != NULL)) {
char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
-
+
*widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
} else {
*widthPtr = 0;
@@ -412,24 +419,22 @@ GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
- width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing. */
- Drawable d; /* The drawable we are drawing into */
- Tk_3DBorder activeBorder; /* The border for an active item */
- Tk_3DBorder bgBorder; /* The background border */
- int x; /* Left coordinate of entry rect */
- int y; /* Right coordinate of entry rect */
- int width; /* Width of entry rect */
- int height; /* Height of entry rect */
+DrawMenuEntryBackground(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing. */
+ Drawable d, /* The drawable we are drawing into */
+ Tk_3DBorder activeBorder, /* The border for an active item */
+ Tk_3DBorder bgBorder, /* The background border */
+ int x, /* Left coordinate of entry rect */
+ int y, /* Right coordinate of entry rect */
+ int width, /* Width of entry rect */
+ int height) /* Height of entry rect */
{
if (mePtr->state == ENTRY_ACTIVE) {
int relief;
@@ -466,31 +471,29 @@ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
- x, y, width, height, drawArrow)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable we are drawing into */
- GC gc; /* The precalculated gc to draw with */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated metrics */
- Tk_3DBorder activeBorder; /* The border for an active item */
- int x; /* Left coordinate of entry rect */
- int y; /* Top coordinate of entry rect */
- int width; /* Width of entry */
- int height; /* Height of entry */
- int drawArrow; /* Whether or not to draw arrow. */
+DrawMenuEntryAccelerator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing into */
+ GC gc, /* The precalculated gc to draw with */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ Tk_3DBorder activeBorder, /* The border for an active item */
+ int x, /* Left coordinate of entry rect */
+ int y, /* Top coordinate of entry rect */
+ int width, /* Width of entry */
+ int height, /* Height of entry */
+ int drawArrow) /* Whether or not to draw arrow. */
{
XPoint points[3];
int borderWidth, activeBorderWidth;
-
+
/*
* Draw accelerator or cascade arrow.
*/
@@ -519,7 +522,7 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
int left = x + mePtr->labelWidth + activeBorderWidth
+ mePtr->indicatorSpace;
-
+
if (menuPtr->menuType == MENUBAR) {
left += 5;
}
@@ -540,56 +543,45 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr,
- x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable to draw into */
- GC gc; /* The gc to draw with */
- GC indicatorGC; /* The gc that indicators draw with */
- Tk_Font tkfont; /* The font to draw with */
- CONST Tk_FontMetrics *fmPtr; /* The font metrics of the font */
- int x; /* The left of the entry rect */
- int y; /* The top of the entry rect */
- int width; /* Width of menu entry */
- int height; /* Height of menu entry */
+DrawMenuEntryIndicator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable to draw into */
+ Tk_3DBorder border, /* The background color */
+ XColor *indicatorColor, /* The color to draw indicators with */
+ XColor *disableColor, /* The color use use when disabled */
+ Tk_Font tkfont, /* The font to draw with */
+ CONST Tk_FontMetrics *fmPtr,/* The font metrics of the font */
+ int x, /* The left of the entry rect */
+ int y, /* The top of the entry rect */
+ int width, /* Width of menu entry */
+ int height) /* Height of menu entry */
{
/*
* Draw check-button indicator.
*/
if ((mePtr->type == CHECK_BUTTON_ENTRY) && mePtr->indicatorOn) {
- int dim, top, left;
- int activeBorderWidth;
- Tk_3DBorder border;
-
- dim = (int) mePtr->platformEntryData;
+ int top, left, activeBorderWidth;
+ int disabled = (mePtr->state == ENTRY_DISABLED);
+ XColor *bg;
+
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
- left = x + activeBorderWidth + (mePtr->indicatorSpace - dim)/2;
- if (menuPtr->menuType == MENUBAR) {
- left += 5;
- }
- top = y + (height - dim)/2;
- border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- menuPtr->borderPtr);
- Tk_Fill3DRectangle(menuPtr->tkwin, d, border, left, top, dim,
- dim, DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
- left += DECORATION_BORDER_WIDTH;
- top += DECORATION_BORDER_WIDTH;
- dim -= 2*DECORATION_BORDER_WIDTH;
- if ((dim > 0) && (mePtr->entryFlags
- & ENTRY_SELECTED)) {
- XFillRectangle(menuPtr->display, d, indicatorGC, left, top,
- (unsigned int) dim, (unsigned int) dim);
- }
+ bg = Tk_3DBorderColor(border);
+ top = y + height/2;
+ left = x + activeBorderWidth + DECORATION_BORDER_WIDTH
+ + mePtr->indicatorSpace/2;
+
+ TkpDrawCheckIndicator(menuPtr->tkwin, menuPtr->display, d, left, top,
+ border, indicatorColor, bg, disableColor,
+ (mePtr->entryFlags & ENTRY_SELECTED), disabled, CHECK_MENU);
}
/*
@@ -597,31 +589,20 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr,
*/
if ((mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn) {
- XPoint points[4];
- int radius;
- Tk_3DBorder border;
-
- border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- menuPtr->borderPtr);
- radius = ((int) mePtr->platformEntryData)/2;
- points[0].x = x + (mePtr->indicatorSpace
- - (int) mePtr->platformEntryData)/2;
- points[0].y = y + (height)/2;
- points[1].x = points[0].x + radius;
- points[1].y = points[0].y + radius;
- points[2].x = points[1].x + radius;
- points[2].y = points[0].y;
- points[3].x = points[1].x;
- points[3].y = points[0].y - radius;
- if (mePtr->entryFlags & ENTRY_SELECTED) {
- XFillPolygon(menuPtr->display, d, indicatorGC, points, 4,
- Convex, CoordModeOrigin);
- } else {
- Tk_Fill3DPolygon(menuPtr->tkwin, d, border, points, 4,
- DECORATION_BORDER_WIDTH, TK_RELIEF_FLAT);
- }
- Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 4,
- DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
+ int top, left, activeBorderWidth;
+ int disabled = (mePtr->state == ENTRY_DISABLED);
+ XColor *bg;
+
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
+ bg = Tk_3DBorderColor(border);
+ top = y + height/2;
+ left = x + activeBorderWidth + DECORATION_BORDER_WIDTH
+ + mePtr->indicatorSpace/2;
+
+ TkpDrawCheckIndicator(menuPtr->tkwin, menuPtr->display, d, left, top,
+ border, indicatorColor, bg, disableColor,
+ (mePtr->entryFlags & ENTRY_SELECTED), disabled, RADIO_MENU);
}
}
@@ -636,24 +617,21 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr,
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable we are using */
- GC gc; /* The gc to draw into */
- Tk_Font tkfont; /* The font to draw with */
- CONST Tk_FontMetrics *fmPtr; /* The font metrics from the font */
- int x;
- int y;
- int width;
- int height;
+DrawMenuSeparator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are using */
+ GC gc, /* The gc to draw into */
+ Tk_Font tkfont, /* The font to draw with */
+ CONST Tk_FontMetrics *fmPtr,/* The font metrics from the font */
+ int x, int y,
+ int width, int height)
{
XPoint points[2];
Tk_3DBorder border;
@@ -661,7 +639,7 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType == MENUBAR) {
return;
}
-
+
points[0].x = x;
points[0].y = y + height/2;
points[1].x = width - 1;
@@ -682,29 +660,26 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing. */
- TkMenuEntry *mePtr; /* The entry we are drawing. */
- Drawable d; /* What we are drawing into. */
- GC gc; /* The gc we are drawing into.*/
- Tk_Font tkfont; /* The precalculated font. */
- CONST Tk_FontMetrics *fmPtr;/* The precalculated font metrics. */
- int x; /* Left edge. */
- int y; /* Top edge. */
- int width; /* width of entry. */
- int height; /* height of entry. */
+DrawMenuEntryLabel(
+ TkMenu *menuPtr, /* The menu we are drawing. */
+ TkMenuEntry *mePtr, /* The entry we are drawing. */
+ Drawable d, /* What we are drawing into. */
+ GC gc, /* The gc we are drawing into.*/
+ Tk_Font tkfont, /* The precalculated font. */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics. */
+ int x, /* Left edge. */
+ int y, /* Top edge. */
+ int width, /* width of entry. */
+ int height) /* height of entry. */
{
- int indicatorSpace = mePtr->indicatorSpace;
- int activeBorderWidth;
- int leftEdge;
- int imageHeight, imageWidth;
+ int indicatorSpace = mePtr->indicatorSpace;
+ int activeBorderWidth, leftEdge, imageHeight, imageWidth;
int textHeight = 0, textWidth = 0; /* stop GCC warning */
int haveImage = 0, haveText = 0;
int imageXOffset = 0, imageYOffset = 0;
@@ -716,7 +691,7 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType == MENUBAR) {
leftEdge += 5;
}
-
+
/*
* Work out what we will need to draw first.
*/
@@ -737,7 +712,7 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
haveText = 1;
}
}
-
+
/*
* Now work out what the relative positions are.
*/
@@ -745,55 +720,52 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (haveImage && haveText) {
int fullWidth = (imageWidth > textWidth ? imageWidth : textWidth);
switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = imageHeight/2 + 2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = -textHeight/2;
- break;
- }
- case COMPOUND_BOTTOM: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = -imageHeight/2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = textHeight/2 + 2;
- break;
- }
- case COMPOUND_LEFT: {
- /*
- * Position image in the indicator space to the left of the
- * entries, unless this entry is a radio|check button because
- * then the indicator space will be used.
- */
- textXOffset = imageWidth + 2;
- textYOffset = 0;
- imageXOffset = 0;
- imageYOffset = 0;
- if ((mePtr->type != CHECK_BUTTON_ENTRY)
- && (mePtr->type != RADIO_BUTTON_ENTRY)) {
- textXOffset -= indicatorSpace;
- if (textXOffset < 0) {
- textXOffset = 0;
- }
- imageXOffset = -indicatorSpace;
+ case COMPOUND_TOP:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = imageHeight/2 + 2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = -textHeight/2;
+ break;
+ case COMPOUND_BOTTOM:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = -imageHeight/2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = textHeight/2 + 2;
+ break;
+ case COMPOUND_LEFT:
+ /*
+ * Position image in the indicator space to the left of the
+ * entries, unless this entry is a radio|check button because then
+ * the indicator space will be used.
+ */
+
+ textXOffset = imageWidth + 2;
+ textYOffset = 0;
+ imageXOffset = 0;
+ imageYOffset = 0;
+ if ((mePtr->type != CHECK_BUTTON_ENTRY)
+ && (mePtr->type != RADIO_BUTTON_ENTRY)) {
+ textXOffset -= indicatorSpace;
+ if (textXOffset < 0) {
+ textXOffset = 0;
}
- break;
+ imageXOffset = -indicatorSpace;
}
- case COMPOUND_RIGHT: {
- textXOffset = 0;
- textYOffset = 0;
- imageXOffset = textWidth + 2;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_CENTER: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = 0;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_NONE: {break;}
+ break;
+ case COMPOUND_RIGHT:
+ textXOffset = 0;
+ textYOffset = 0;
+ imageXOffset = textWidth + 2;
+ imageYOffset = 0;
+ break;
+ case COMPOUND_CENTER:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = 0;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = 0;
+ break;
+ case COMPOUND_NONE:
+ break;
}
} else {
textXOffset = 0;
@@ -801,7 +773,7 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
imageXOffset = 0;
imageYOffset = 0;
}
-
+
/*
* Draw label and/or bitmap or image for entry.
*/
@@ -811,27 +783,30 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
&& (mePtr->entryFlags & ENTRY_SELECTED)) {
Tk_RedrawImage(mePtr->selectImage, 0, 0,
imageWidth, imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
+ (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
} else {
Tk_RedrawImage(mePtr->image, 0, 0, imageWidth,
imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
+ (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
}
} else if (mePtr->bitmapPtr != None) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
- XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
- (unsigned) imageWidth, (unsigned) imageHeight,
+
+ XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
+ (unsigned) imageWidth, (unsigned) imageHeight,
leftEdge + imageXOffset,
(int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), 1);
}
if ((mePtr->compound != COMPOUND_NONE) || !haveImage) {
int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
+
if (mePtr->labelLength > 0) {
char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+
Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
- mePtr->labelLength, leftEdge + textXOffset,
+ mePtr->labelLength, leftEdge + textXOffset,
baseline + textYOffset);
- DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr,
+ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr,
x + textXOffset, y + textYOffset,
width, height);
}
@@ -841,7 +816,7 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->disabledFgPtr == NULL) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
(unsigned) width, (unsigned) height);
- } else if ((mePtr->image != NULL)
+ } else if ((mePtr->image != NULL)
&& (menuPtr->disabledImageGC != None)) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
leftEdge + imageXOffset,
@@ -856,40 +831,38 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
*
* DrawMenuUnderline --
*
- * On appropriate platforms, draw the underline character for the
- * menu.
+ * On appropriate platforms, draw the underline character for the menu.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu to draw into */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* What we are drawing into */
- GC gc; /* The gc to draw into */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated font metrics */
- int x;
- int y;
- int width;
- int height;
+DrawMenuUnderline(
+ TkMenu *menuPtr, /* The menu to draw into */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc to draw into */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, int y,
+ int width, int height)
{
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
int len;
- /* do the unicode call just to prevent overruns */
+ /*
+ * Do the unicode call just to prevent overruns.
+ */
+
Tcl_GetUnicodeFromObj(mePtr->labelPtr, &len);
if (mePtr->underline < len) {
- int activeBorderWidth;
- int leftEdge;
+ int activeBorderWidth, leftEdge;
CONST char *label, *start, *end;
label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
@@ -927,11 +900,10 @@ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
*/
int
-TkpPostMenu(interp, menuPtr, x, y)
- Tcl_Interp *interp;
- TkMenu *menuPtr;
- int x;
- int y;
+TkpPostMenu(
+ Tcl_Interp *interp,
+ TkMenu *menuPtr,
+ int x, int y)
{
return TkPostTearoffMenu(interp, menuPtr, x, y);
}
@@ -953,14 +925,13 @@ TkpPostMenu(interp, menuPtr, x, y)
*/
static void
-GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr,
- heightPtr)
- TkMenu *menuPtr; /* The menu we are measuring */
- TkMenuEntry *mePtr; /* The entry we are measuring */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalcualted font metrics */
- int *widthPtr; /* The resulting width */
- int *heightPtr; /* The resulting height */
+GetMenuSeparatorGeometry(
+ TkMenu *menuPtr, /* The menu we are measuring */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
*widthPtr = 0;
*heightPtr = fmPtr->linespace;
@@ -983,13 +954,13 @@ GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr,
*/
static void
-GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are measuring */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated font metrics */
- int *widthPtr; /* The resulting width */
- int *heightPtr; /* The resulting height */
+GetTearoffEntryGeometry(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
if (menuPtr->menuType != MASTER_MENU) {
*heightPtr = 0;
@@ -1005,38 +976,30 @@ GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*
* TkpComputeMenubarGeometry --
*
- * This procedure is invoked to recompute the size and
- * layout of a menu that is a menubar clone.
+ * This procedure is invoked to recompute the size and layout of a menu
+ * that is a menubar clone.
*
* Results:
* None.
*
* Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
*
*--------------------------------------------------------------
*/
void
-TkpComputeMenubarGeometry(menuPtr)
- TkMenu *menuPtr; /* Structure describing menu. */
+TkpComputeMenubarGeometry(
+ TkMenu *menuPtr) /* Structure describing menu. */
{
- Tk_Font tkfont;
+ Tk_Font tkfont, menuFont;
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
- int width, height;
- int i, j;
- int x, y, currentRowHeight, maxWidth;
- int maxWindowWidth;
- int lastRowBreak;
- int helpMenuIndex = -1;
+ int width, height, i, j, x, y, currentRowHeight, maxWidth;
+ int maxWindowWidth, lastRowBreak, lastEntry;
+ int borderWidth, activeBorderWidth, helpMenuIndex = -1;
TkMenuEntry *mePtr;
- int lastEntry;
- Tk_Font menuFont;
- int borderWidth;
- int activeBorderWidth;
-
+
if (menuPtr->tkwin == NULL) {
return;
}
@@ -1050,7 +1013,7 @@ TkpComputeMenubarGeometry(menuPtr)
height = 0;
} else {
int borderWidth;
-
+
maxWindowWidth = Tk_Width(menuPtr->tkwin);
if (maxWindowWidth == 1) {
maxWindowWidth = 0x7ffffff;
@@ -1060,19 +1023,19 @@ TkpComputeMenubarGeometry(menuPtr)
&borderWidth);
x = y = borderWidth;
lastRowBreak = 0;
-
+
/*
- * On the Mac especially, getting font metrics can be quite slow,
- * so we want to do it intelligently. We are going to precalculate
- * them and pass them down to all of the measureing and drawing
- * routines. We will measure the font metrics of the menu once,
- * and if an entry has a font set, we will measure it as we come
- * to it, and then we decide which set to give the geometry routines.
+ * On the Mac especially, getting font metrics can be quite slow, so
+ * we want to do it intelligently. We are going to precalculate them
+ * and pass them down to all of the measureing and drawing routines.
+ * We will measure the font metrics of the menu once, and if an entry
+ * has a font set, we will measure it as we come to it, and then we
+ * decide which set to give the geometry routines.
*/
menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
Tk_GetFontMetrics(menuFont, &menuMetrics);
-
+
for (i = 0; i < menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
mePtr->entryFlags &= ~ENTRY_LAST_COLUMN;
@@ -1088,11 +1051,10 @@ TkpComputeMenubarGeometry(menuPtr)
/*
* For every entry, we need to check to see whether or not we
* wrap. If we do wrap, then we have to adjust all of the previous
- * entries' height and y position, because when we see them
- * the first time, we don't know how big its neighbor might
- * be.
+ * entries' height and y position, because when we see them the
+ * first time, we don't know how big its neighbor might be.
*/
-
+
if ((mePtr->type == SEPARATOR_ENTRY)
|| (mePtr->type == TEAROFF_ENTRY)) {
mePtr->height = mePtr->width = 0;
@@ -1140,7 +1102,7 @@ TkpComputeMenubarGeometry(menuPtr)
if (mePtr->height > currentRowHeight) {
currentRowHeight = mePtr->height;
}
- }
+ }
}
lastEntry = menuPtr->numEntries - 1;
@@ -1161,7 +1123,7 @@ TkpComputeMenubarGeometry(menuPtr)
menuPtr->entries[j]->x = x;
x += menuPtr->entries[j]->width;
}
-
+
if (helpMenuIndex != -1) {
mePtr = menuPtr->entries[helpMenuIndex];
@@ -1177,11 +1139,11 @@ TkpComputeMenubarGeometry(menuPtr)
}
height = y + currentRowHeight + borderWidth;
}
- width = Tk_Width(menuPtr->tkwin);
+ width = Tk_Width(menuPtr->tkwin);
/*
- * The X server doesn't like zero dimensions, so round up to at least
- * 1 (a zero-sized menu should never really occur, anyway).
+ * The X server doesn't like zero dimensions, so round up to at least 1 (a
+ * zero-sized menu should never really occur, anyway).
*/
if (width <= 0) {
@@ -1205,24 +1167,21 @@ TkpComputeMenubarGeometry(menuPtr)
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable we are drawing into */
- GC gc; /* The gc we are drawing with */
- Tk_Font tkfont; /* The font we are drawing with */
- CONST Tk_FontMetrics *fmPtr; /* The metrics we are drawing with */
- int x;
- int y;
- int width;
- int height;
+DrawTearoffEntry(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The font we are drawing with */
+ CONST Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
+ int x, int y,
+ int width, int height)
{
XPoint points[2];
int segmentWidth, maxX;
@@ -1231,12 +1190,12 @@ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType != MASTER_MENU) {
return;
}
-
+
points[0].x = x;
points[0].y = y + height/2;
points[1].y = points[0].y;
segmentWidth = 6;
- maxX = width - 1;
+ maxX = width - 1;
border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
while (points[0].x < maxX) {
@@ -1255,24 +1214,25 @@ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
*
* TkpInitializeMenuBindings --
*
- * For every interp, initializes the bindings for Windows
- * menus. Does nothing on Mac or XWindows.
+ * For every interp, initializes the bindings for Windows menus. Does
+ * nothing on Mac or XWindows.
*
* Results:
* None.
*
* Side effects:
- * C-level bindings are setup for the interp which will
- * handle Alt-key sequences for menus without beeping
- * or interfering with user-defined Alt-key bindings.
+ * C-level bindings are setup for the interp which will handle Alt-key
+ * sequences for menus without beeping or interfering with user-defined
+ * Alt-key bindings.
*
*--------------------------------------------------------------
*/
void
-TkpInitializeMenuBindings(interp, bindingTable)
- Tcl_Interp *interp; /* The interpreter to set. */
- Tk_BindingTable bindingTable; /* The table to add to. */
+TkpInitializeMenuBindings(
+ Tcl_Interp *interp, /* The interpreter to set. */
+ Tk_BindingTable bindingTable)
+ /* The table to add to. */
{
/*
* Nothing to do.
@@ -1284,9 +1244,9 @@ TkpInitializeMenuBindings(interp, bindingTable)
*
* SetHelpMenu --
*
- * Given a menu, check to see whether or not it is a help menu
- * cascade in a menubar. If it is, the entry that points to
- * this menu will be marked.
+ * Given a menu, check to see whether or not it is a help menu cascade in
+ * a menubar. If it is, the entry that points to this menu will be
+ * marked.
*
* RESULTS:
* None.
@@ -1298,10 +1258,22 @@ TkpInitializeMenuBindings(interp, bindingTable)
*/
static void
-SetHelpMenu(menuPtr)
- TkMenu *menuPtr; /* The menu we are checking */
+SetHelpMenu(
+ TkMenu *menuPtr) /* The menu we are checking */
{
TkMenuEntry *cascadeEntryPtr;
+ int useMotifHelp = 0;
+ const char *option = NULL;
+ if (menuPtr->tkwin) {
+ option = Tk_GetOption(menuPtr->tkwin, "useMotifHelp", "UseMotifHelp");
+ if (option != NULL) {
+ Tcl_GetBoolean(NULL, option, &useMotifHelp);
+ }
+ }
+
+ if (!useMotifHelp) {
+ return;
+ }
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;
@@ -1331,8 +1303,8 @@ SetHelpMenu(menuPtr)
*
* TkpDrawMenuEntry --
*
- * Draws the given menu entry at the given coordinates with the
- * given attributes.
+ * Draws the given menu entry at the given coordinates with the given
+ * attributes.
*
* Results:
* None.
@@ -1344,23 +1316,23 @@ SetHelpMenu(menuPtr)
*/
void
-TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
- strictMotif, drawArrow)
- TkMenuEntry *mePtr; /* The entry to draw */
- Drawable d; /* What to draw into */
- Tk_Font tkfont; /* Precalculated font for menu */
- CONST Tk_FontMetrics *menuMetricsPtr;
+TkpDrawMenuEntry(
+ TkMenuEntry *mePtr, /* The entry to draw */
+ Drawable d, /* What to draw into */
+ Tk_Font tkfont, /* Precalculated font for menu */
+ CONST Tk_FontMetrics *menuMetricsPtr,
/* Precalculated metrics for menu */
- int x; /* X-coordinate of topleft of entry */
- int y; /* Y-coordinate of topleft of entry */
- int width; /* Width of the entry rectangle */
- int height; /* Height of the current rectangle */
- int strictMotif; /* Boolean flag */
- int drawArrow; /* Whether or not to draw the cascade
+ int x, /* X-coordinate of topleft of entry */
+ int y, /* Y-coordinate of topleft of entry */
+ int width, /* Width of the entry rectangle */
+ int height, /* Height of the current rectangle */
+ int strictMotif, /* Boolean flag */
+ int drawArrow) /* Whether or not to draw the cascade
* arrow for cascade items. Only applies
* to Windows. */
{
GC gc, indicatorGC;
+ XColor *indicatorColor, *disableColor = NULL;
TkMenu *menuPtr = mePtr->menuPtr;
Tk_3DBorder bgBorder, activeBorder;
CONST Tk_FontMetrics *fmPtr;
@@ -1381,13 +1353,12 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
} else {
TkMenuEntry *cascadeEntryPtr;
int parentDisabled = 0;
-
+
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if (cascadeEntryPtr->namePtr != NULL) {
- char *name = Tcl_GetStringFromObj(cascadeEntryPtr->namePtr,
- NULL);
+ char *name = Tcl_GetString(cascadeEntryPtr->namePtr);
if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
if (cascadeEntryPtr->state == ENTRY_DISABLED) {
@@ -1415,6 +1386,18 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
if (indicatorGC == NULL) {
indicatorGC = menuPtr->indicatorGC;
}
+ if (mePtr->indicatorFgPtr) {
+ indicatorColor = Tk_GetColorFromObj(menuPtr->tkwin,
+ mePtr->indicatorFgPtr);
+ } else {
+ indicatorColor = Tk_GetColorFromObj(menuPtr->tkwin,
+ menuPtr->indicatorFgPtr);
+ }
+
+ if (menuPtr->disabledFgPtr != NULL) {
+ disableColor = Tk_GetColorFromObj(menuPtr->tkwin,
+ menuPtr->disabledFgPtr);
+ }
bgBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
(mePtr->borderPtr == NULL)
@@ -1436,16 +1419,16 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
}
/*
- * Need to draw the entire background, including padding. On Unix,
- * for menubars, we have to draw the rest of the entry taking
- * into account the padding.
+ * Need to draw the entire background, including padding. On Unix, for
+ * menubars, we have to draw the rest of the entry taking into account the
+ * padding.
*/
-
- DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder,
+
+ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder,
bgBorder, x, y, width, height);
-
+
if (mePtr->type == SEPARATOR_ENTRY) {
- DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
+ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
fmPtr, x, adjustedY, width, adjustedHeight);
} else if (mePtr->type == TEAROFF_ENTRY) {
DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, adjustedY,
@@ -1456,8 +1439,12 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
activeBorder, x, adjustedY, width, adjustedHeight, drawArrow);
if (!mePtr->hideMargin) {
- DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont,
- fmPtr, x, adjustedY, width, adjustedHeight);
+ if (mePtr->state == ENTRY_ACTIVE) {
+ bgBorder = activeBorder;
+ }
+ DrawMenuEntryIndicator(menuPtr, mePtr, d, bgBorder, indicatorColor,
+ disableColor, tkfont, fmPtr, x, adjustedY, width,
+ adjustedHeight);
}
}
}
@@ -1480,22 +1467,21 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
*/
static void
-GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenuEntry *mePtr; /* The entry we are computing */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated metrics */
- int *widthPtr; /* The resulting width of the label
- * portion */
- int *heightPtr; /* The resulting height of the label
- * portion */
+GetMenuLabelGeometry(
+ TkMenuEntry *mePtr, /* The entry we are computing */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ int *widthPtr, /* The resulting width of the label portion */
+ int *heightPtr) /* The resulting height of the label
+ * portion */
{
TkMenu *menuPtr = mePtr->menuPtr;
int haveImage = 0;
-
+
if (mePtr->image != NULL) {
Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr);
haveImage = 1;
- } else if (mePtr->bitmapPtr != NULL) {
+ } else if (mePtr->bitmapPtr != NULL) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
Tk_SizeOfBitmap(menuPtr->display, bitmap, widthPtr, heightPtr);
haveImage = 1;
@@ -1503,54 +1489,71 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*heightPtr = 0;
*widthPtr = 0;
}
-
+
if (haveImage && (mePtr->compound == COMPOUND_NONE)) {
- /* We don't care about the text in this case */
+ /*
+ * We don't care about the text in this case.
+ */
} else {
- /* Either it is compound or we don't have an image */
+ /*
+ * Either it is compound or we don't have an image.
+ */
+
if (mePtr->labelPtr != NULL) {
int textWidth;
char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
-
+
if ((mePtr->compound != COMPOUND_NONE) && haveImage) {
switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- /* Add text and padding */
- *heightPtr += fmPtr->linespace + 2;
- break;
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
}
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- /* Add text and padding */
- *widthPtr += textWidth + 2;
- break;
+
+ /*
+ * Add text and padding.
+ */
+
+ *heightPtr += fmPtr->linespace + 2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ if (fmPtr->linespace > *heightPtr) {
+ *heightPtr = fmPtr->linespace;
}
- case COMPOUND_CENTER: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- break;
+
+ /*
+ * Add text and padding.
+ */
+
+ *widthPtr += textWidth + 2;
+ break;
+ case COMPOUND_CENTER:
+ if (fmPtr->linespace > *heightPtr) {
+ *heightPtr = fmPtr->linespace;
}
- case COMPOUND_NONE: {break;}
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
+ }
+ break;
+ case COMPOUND_NONE:
+ break;
}
- } else {
- /* We don't have an image or we're not compound */
+ } else {
+ /*
+ * We don't have an image or we're not compound.
+ */
+
*heightPtr = fmPtr->linespace;
*widthPtr = textWidth;
}
} else {
- /* An empty entry still has this height */
+ /*
+ * An empty entry still has this height.
+ */
+
*heightPtr = fmPtr->linespace;
}
}
@@ -1562,33 +1565,30 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*
* TkpComputeStandardMenuGeometry --
*
- * This procedure is invoked to recompute the size and
- * layout of a menu that is not a menubar clone.
+ * This procedure is invoked to recompute the size and layout of a menu
+ * that is not a menubar clone.
*
* Results:
* None.
*
* Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
*
*--------------------------------------------------------------
*/
void
TkpComputeStandardMenuGeometry(
- menuPtr) /* Structure describing menu. */
- TkMenu *menuPtr;
+ TkMenu *menuPtr) /* Structure describing menu. */
{
Tk_Font tkfont, menuFont;
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int x, y, height, width, indicatorSpace, labelWidth, accelWidth;
- int windowWidth, windowHeight, accelSpace;
- int i, j, lastColumnBreak = 0;
+ int windowWidth, windowHeight, accelSpace, i, j, lastColumnBreak = 0;
TkMenuEntry *mePtr;
int borderWidth, activeBorderWidth;
-
+
if (menuPtr->tkwin == NULL) {
return;
}
@@ -1602,14 +1602,13 @@ TkpComputeStandardMenuGeometry(
windowHeight = windowWidth = 0;
/*
- * On the Mac especially, getting font metrics can be quite slow,
- * so we want to do it intelligently. We are going to precalculate
- * them and pass them down to all of the measuring and drawing
- * routines. We will measure the font metrics of the menu once.
- * If an entry does not have its own font set, then we give
- * the geometry/drawing routines the menu's font and metrics.
- * If an entry has its own font, we will measure that font and
- * give all of the geometry/drawing the entry's font and metrics.
+ * On the Mac especially, getting font metrics can be quite slow, so we
+ * want to do it intelligently. We are going to precalculate them and pass
+ * them down to all of the measuring and drawing routines. We will measure
+ * the font metrics of the menu once. If an entry does not have its own
+ * font set, then we give the geometry/drawing routines the menu's font
+ * and metrics. If an entry has its own font, we will measure that font
+ * and give all of the geometry/drawing the entry's font and metrics.
*/
menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
@@ -1648,28 +1647,25 @@ TkpComputeStandardMenuGeometry(
}
if (mePtr->type == SEPARATOR_ENTRY) {
- GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &width, &height);
+ GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont, fmPtr,
+ &width, &height);
mePtr->height = height;
} else if (mePtr->type == TEAROFF_ENTRY) {
- GetTearoffEntryGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &width, &height);
+ GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr,
+ &width, &height);
mePtr->height = height;
labelWidth = width;
} else {
-
/*
- * For each entry, compute the height required by that
- * particular entry, plus three widths: the width of the
- * label, the width to allow for an indicator to be displayed
- * to the left of the label (if any), and the width of the
- * accelerator to be displayed to the right of the label
- * (if any). These sizes depend, of course, on the type
- * of the entry.
+ * For each entry, compute the height required by that particular
+ * entry, plus three widths: the width of the label, the width to
+ * allow for an indicator to be displayed to the left of the label
+ * (if any), and the width of the accelerator to be displayed to
+ * the right of the label (if any). These sizes depend, of course,
+ * on the type of the entry.
*/
-
- GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &width,
- &height);
+
+ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &width, &height);
mePtr->height = height;
if (!mePtr->hideMargin) {
width += MENU_MARGIN_WIDTH;
@@ -1677,7 +1673,7 @@ TkpComputeStandardMenuGeometry(
if (width > labelWidth) {
labelWidth = width;
}
-
+
GetMenuAccelGeometry(menuPtr, mePtr, tkfont,
fmPtr, &width, &height);
if (height > mePtr->height) {
@@ -1690,7 +1686,7 @@ TkpComputeStandardMenuGeometry(
accelWidth = width;
}
- GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont,
+ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont,
fmPtr, &width, &height);
if (height > mePtr->height) {
mePtr->height = height;
@@ -1725,12 +1721,11 @@ TkpComputeStandardMenuGeometry(
windowWidth = x + indicatorSpace + labelWidth + accelWidth
+ 2 * activeBorderWidth + 2 * borderWidth;
-
windowHeight += borderWidth;
-
+
/*
- * The X server doesn't like zero dimensions, so round up to at least
- * 1 (a zero-sized menu should never really occur, anyway).
+ * The X server doesn't like zero dimensions, so round up to at least 1 (a
+ * zero-sized menu should never really occur, anyway).
*/
if (windowWidth <= 0) {
@@ -1749,8 +1744,8 @@ TkpComputeStandardMenuGeometry(
* TkpMenuNotifyToplevelCreate --
*
* This routine reconfigures the menu and the clones indicated by
- * menuName becuase a toplevel has been created and any system
- * menus need to be created. Not applicable to UNIX.
+ * menuName becuase a toplevel has been created and any system menus need
+ * to be created. Not applicable to UNIX.
*
* Results:
* None.
@@ -1762,10 +1757,9 @@ TkpComputeStandardMenuGeometry(
*/
void
-TkpMenuNotifyToplevelCreate(interp, menuName)
- Tcl_Interp *interp; /* The interp the menu lives in. */
- char *menuName; /* The name of the menu to
- * reconfigure. */
+TkpMenuNotifyToplevelCreate(
+ Tcl_Interp *interp, /* The interp the menu lives in. */
+ char *menuName) /* The name of the menu to reconfigure. */
{
/*
* Nothing to do.
@@ -1789,7 +1783,7 @@ TkpMenuNotifyToplevelCreate(interp, menuName)
*/
void
-TkpMenuInit()
+TkpMenuInit(void)
{
/*
* Nothing to do.
@@ -1802,8 +1796,7 @@ TkpMenuInit()
*
* TkpMenuThreadInit --
*
- * Does platform-specific initialization of thread-specific
- * menu state.
+ * Does platform-specific initialization of thread-specific menu state.
*
* Results:
* None.
@@ -1815,10 +1808,17 @@ TkpMenuInit()
*/
void
-TkpMenuThreadInit()
+TkpMenuThreadInit(void)
{
/*
* Nothing to do.
*/
}
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 35c7da8..48d3fb9 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -1,25 +1,28 @@
-/*
+/*
* tkUnixMenubu.c --
*
- * This file implements the Unix specific portion of the
- * menubutton widget.
+ * This file implements the Unix specific portion of the menubutton
+ * widget.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkMenubutton.h"
/*
- * The structure below defines menubutton class behavior by means of
- * procedures that can be invoked from generic window code.
+ * The structure below defines menubutton class behavior by means of functions
+ * that can be invoked from generic window code.
*/
Tk_ClassProcs tkpMenubuttonClass = {
sizeof(Tk_ClassProcs), /* size */
TkMenuButtonWorldChanged, /* worldChangedProc */
+ NULL,
+ NULL
};
/*
@@ -39,8 +42,8 @@ Tk_ClassProcs tkpMenubuttonClass = {
*/
TkMenuButton *
-TkpCreateMenuButton(tkwin)
- Tk_Window tkwin;
+TkpCreateMenuButton(
+ Tk_Window tkwin)
{
return (TkMenuButton *)ckalloc(sizeof(TkMenuButton));
}
@@ -50,35 +53,37 @@ TkpCreateMenuButton(tkwin)
*
* TkpDisplayMenuButton --
*
- * This procedure is invoked to display a menubutton widget.
+ * This function is invoked to display a menubutton widget.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menubutton in its
- * current mode.
+ * Commands are output to X to display the menubutton in its current
+ * mode.
*
*----------------------------------------------------------------------
*/
void
-TkpDisplayMenuButton(clientData)
- ClientData clientData; /* Information about widget. */
+TkpDisplayMenuButton(
+ ClientData clientData) /* Information about widget. */
{
register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
GC gc;
Tk_3DBorder border;
Pixmap pixmap;
- int x = 0; /* Initialization needed only to stop
- * compiler warning. */
+ int x = 0; /* Initialization needed only to stop compiler
+ * warning. */
int y = 0;
register Tk_Window tkwin = mbPtr->tkwin;
- int width, height, fullWidth, fullHeight;
+ int fullWidth, fullHeight;
int textXOffset, textYOffset;
int imageWidth, imageHeight;
- int imageXOffset, imageYOffset; /* image information that will be used to
- * restrict disabled pixmap as well */
+ int imageXOffset, imageYOffset;
+ int width = 0, height = 0;
+ /* Image information that will be used to
+ * restrict disabled pixmap as well */
int haveImage = 0, haveText = 0;
mbPtr->flags &= ~REDRAW_PENDING;
@@ -105,16 +110,16 @@ TkpDisplayMenuButton(clientData)
Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
haveImage = 1;
}
- imageWidth = width;
+ imageWidth = width;
imageHeight = height;
haveText = (mbPtr->textWidth != 0 && mbPtr->textHeight != 0);
/*
- * In order to avoid screen flashes, this procedure redraws
- * the menu button in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the menu button
+ * in a pixmap, then copies the pixmap to the screen in a single
+ * operation. This means that there's no point in time where the on-sreen
+ * image has been cleared.
*/
pixmap = Tk_GetPixmap(mbPtr->display, Tk_WindowId(tkwin),
@@ -130,53 +135,58 @@ TkpDisplayMenuButton(clientData)
fullHeight = 0;
if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- switch ((enum compound) mbPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (mbPtr->compound == COMPOUND_TOP) {
- textYOffset = height + mbPtr->padY;
- } else {
- imageYOffset = mbPtr->textHeight + mbPtr->padY;
- }
- fullHeight = height + mbPtr->textHeight + mbPtr->padY;
- fullWidth = (width > mbPtr->textWidth ? width :
- mbPtr->textWidth);
- textXOffset = (fullWidth - mbPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- if (mbPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + mbPtr->padX;
- } else {
- imageXOffset = mbPtr->textWidth + mbPtr->padX;
- }
- fullWidth = mbPtr->textWidth + mbPtr->padX + width;
- fullHeight = (height > mbPtr->textHeight ? height :
- mbPtr->textHeight);
- textYOffset = (fullHeight - mbPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- fullWidth = (width > mbPtr->textWidth ? width :
- mbPtr->textWidth);
- fullHeight = (height > mbPtr->textHeight ? height :
- mbPtr->textHeight);
- textXOffset = (fullWidth - mbPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - mbPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_NONE: {break;}
- }
-
- TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
+ switch ((enum compound) mbPtr->compound) {
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ if (mbPtr->compound == COMPOUND_TOP) {
+ textYOffset = height + mbPtr->padY;
+ } else {
+ imageYOffset = mbPtr->textHeight + mbPtr->padY;
+ }
+ fullHeight = height + mbPtr->textHeight + mbPtr->padY;
+ fullWidth = (width > mbPtr->textWidth ? width : mbPtr->textWidth);
+ textXOffset = (fullWidth - mbPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ if (mbPtr->compound == COMPOUND_LEFT) {
+ textXOffset = width + mbPtr->padX;
+ } else {
+ imageXOffset = mbPtr->textWidth + mbPtr->padX;
+ }
+ fullWidth = mbPtr->textWidth + mbPtr->padX + width;
+ fullHeight = (height > mbPtr->textHeight ? height :
+ mbPtr->textHeight);
+ textYOffset = (fullHeight - mbPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ fullWidth = (width > mbPtr->textWidth ? width : mbPtr->textWidth);
+ fullHeight = (height > mbPtr->textHeight ? height :
+ mbPtr->textHeight);
+ textXOffset = (fullWidth - mbPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ textYOffset = (fullHeight - mbPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_NONE:
+ break;
+ }
+
+ TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
mbPtr->indicatorWidth + fullWidth, fullHeight, &x, &y);
imageXOffset += x;
@@ -187,7 +197,7 @@ TkpDisplayMenuButton(clientData)
} else if (mbPtr->bitmap != None) {
XSetClipOrigin(mbPtr->display, gc, imageXOffset, imageYOffset);
XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap,
- gc, 0, 0, (unsigned) width, (unsigned) height,
+ gc, 0, 0, (unsigned) width, (unsigned) height,
imageXOffset, imageYOffset, 1);
XSetClipOrigin(mbPtr->display, gc, 0, 0);
}
@@ -207,7 +217,7 @@ TkpDisplayMenuButton(clientData)
} else if (mbPtr->bitmap != None) {
XSetClipOrigin(mbPtr->display, gc, x, y);
XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap,
- gc, 0, 0, (unsigned) width, (unsigned) height,
+ gc, 0, 0, (unsigned) width, (unsigned) height,
x, y, 1);
XSetClipOrigin(mbPtr->display, gc, 0, 0);
}
@@ -215,7 +225,7 @@ TkpDisplayMenuButton(clientData)
TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
mbPtr->textWidth + mbPtr->indicatorWidth,
mbPtr->textHeight, &x, &y);
- Tk_DrawTextLayout(mbPtr->display, pixmap, gc, mbPtr->textLayout,
+ Tk_DrawTextLayout(mbPtr->display, pixmap, gc, mbPtr->textLayout,
x + textXOffset, y + textYOffset, 0, -1);
Tk_UnderlineTextLayout(mbPtr->display, pixmap, gc,
mbPtr->textLayout, x + textXOffset, y + textYOffset,
@@ -227,12 +237,13 @@ TkpDisplayMenuButton(clientData)
* foreground color, generate the stippled effect.
*/
- if ((mbPtr->state == STATE_DISABLED)
- && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
+ if ((mbPtr->state == STATE_DISABLED)
+ && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
/*
- * Stipple the whole button if no disabledFg was specified,
- * otherwise restrict stippling only to displayed image
+ * Stipple the whole button if no disabledFg was specified, otherwise
+ * restrict stippling only to displayed image
*/
+
if (mbPtr->disabledFg == NULL) {
XFillRectangle(mbPtr->display, pixmap, mbPtr->stippleGC,
mbPtr->inset, mbPtr->inset,
@@ -246,8 +257,8 @@ TkpDisplayMenuButton(clientData)
}
/*
- * Draw the cascade indicator for the menu button on the
- * right side of the window, if desired.
+ * Draw the cascade indicator for the menu button on the right side of the
+ * window, if desired.
*/
if (mbPtr->indicatorOn) {
@@ -267,9 +278,9 @@ TkpDisplayMenuButton(clientData)
}
/*
- * Draw the border and traversal highlight last. This way, if the
- * menu button's contents overflow onto the border they'll be covered
- * up by the border.
+ * Draw the border and traversal highlight last. This way, if the menu
+ * button's contents overflow onto the border they'll be covered up by the
+ * border.
*/
if (mbPtr->relief != TK_RELIEF_FLAT) {
@@ -291,8 +302,8 @@ TkpDisplayMenuButton(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(mbPtr->display, pixmap, Tk_WindowId(tkwin),
@@ -318,8 +329,8 @@ TkpDisplayMenuButton(clientData)
*/
void
-TkpDestroyMenuButton(mbPtr)
- TkMenuButton *mbPtr;
+TkpDestroyMenuButton(
+ TkMenuButton *mbPtr)
{
}
@@ -328,7 +339,7 @@ TkpDestroyMenuButton(mbPtr)
*
* TkpComputeMenuButtonGeometry --
*
- * After changes in a menu button's text or bitmap, this procedure
+ * After changes in a menu button's text or bitmap, this function
* recomputes the menu button's geometry and passes this information
* along to the geometry manager for the window.
*
@@ -342,11 +353,11 @@ TkpDestroyMenuButton(mbPtr)
*/
void
-TkpComputeMenuButtonGeometry(mbPtr)
- TkMenuButton *mbPtr; /* Widget record for menu button. */
+TkpComputeMenuButtonGeometry(
+ TkMenuButton *mbPtr) /* Widget record for menu button. */
{
int width, height, mm, pixels;
- int avgWidth, txtWidth, txtHeight;
+ int avgWidth, txtWidth, txtHeight;
int haveImage = 0, haveText = 0;
Tk_FontMetrics fm;
@@ -374,88 +385,103 @@ TkpComputeMenuButtonGeometry(mbPtr)
&mbPtr->textHeight);
txtWidth = mbPtr->textWidth;
txtHeight = mbPtr->textHeight;
- avgWidth = Tk_TextWidth(mbPtr->tkfont, "0", 1);
- Tk_GetFontMetrics(mbPtr->tkfont, &fm);
- haveText = (txtWidth != 0 && txtHeight != 0);
+ avgWidth = Tk_TextWidth(mbPtr->tkfont, "0", 1);
+ Tk_GetFontMetrics(mbPtr->tkfont, &fm);
+ haveText = (txtWidth != 0 && txtHeight != 0);
}
/*
* If the menubutton is compound (ie, it shows both an image and text),
- * the new geometry is a combination of the image and text geometry.
- * We only honor the compound bit if the menubutton has both text and
- * an image, because otherwise it is not really a compound menubutton.
+ * the new geometry is a combination of the image and text geometry. We
+ * only honor the compound bit if the menubutton has both text and an
+ * image, because otherwise it is not really a compound menubutton.
*/
if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- switch ((enum compound) mbPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- height += txtHeight + mbPtr->padY;
- width = (width > txtWidth ? width : txtWidth);
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- width += txtWidth + mbPtr->padX;
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- width = (width > txtWidth ? width : txtWidth);
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_NONE: {break;}
- }
- if (mbPtr->width > 0) {
- width = mbPtr->width;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height;
- }
- width += 2*mbPtr->padX;
- height += 2*mbPtr->padY;
+ switch ((enum compound) mbPtr->compound) {
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ height += txtHeight + mbPtr->padY;
+ width = (width > txtWidth ? width : txtWidth);
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ width += txtWidth + mbPtr->padX;
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ width = (width > txtWidth ? width : txtWidth);
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_NONE:
+ break;
+ }
+ if (mbPtr->width > 0) {
+ width = mbPtr->width;
+ }
+ if (mbPtr->height > 0) {
+ height = mbPtr->height;
+ }
+ width += 2*mbPtr->padX;
+ height += 2*mbPtr->padY;
} else {
if (haveImage) {
- if (mbPtr->width > 0) {
- width = mbPtr->width;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height;
- }
+ if (mbPtr->width > 0) {
+ width = mbPtr->width;
+ }
+ if (mbPtr->height > 0) {
+ height = mbPtr->height;
+ }
} else {
width = txtWidth;
height = txtHeight;
- if (mbPtr->width > 0) {
- width = mbPtr->width * avgWidth;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height * fm.linespace;
- }
+ if (mbPtr->width > 0) {
+ width = mbPtr->width * avgWidth;
+ }
+ if (mbPtr->height > 0) {
+ height = mbPtr->height * fm.linespace;
+ }
}
}
if (! haveImage) {
- width += 2*mbPtr->padX;
- height += 2*mbPtr->padY;
+ width += 2*mbPtr->padX;
+ height += 2*mbPtr->padY;
}
if (mbPtr->indicatorOn) {
- mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin));
- pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
- mbPtr->indicatorHeight= (INDICATOR_HEIGHT * pixels)/(10*mm);
- mbPtr->indicatorWidth = (INDICATOR_WIDTH * pixels)/(10*mm)
- + 2*mbPtr->indicatorHeight;
- width += mbPtr->indicatorWidth;
+ mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin));
+ pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
+ mbPtr->indicatorHeight= (INDICATOR_HEIGHT * pixels)/(10*mm);
+ mbPtr->indicatorWidth = (INDICATOR_WIDTH * pixels)/(10*mm)
+ + 2*mbPtr->indicatorHeight;
+ width += mbPtr->indicatorWidth;
} else {
- mbPtr->indicatorHeight = 0;
- mbPtr->indicatorWidth = 0;
+ mbPtr->indicatorHeight = 0;
+ mbPtr->indicatorWidth = 0;
}
Tk_GeometryRequest(mbPtr->tkwin, (int) (width + 2*mbPtr->inset),
(int) (height + 2*mbPtr->inset));
Tk_SetInternalBorder(mbPtr->tkwin, mbPtr->inset);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index 8445c82..e0dbc8f 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -67,6 +67,9 @@
# include <time.h>
# endif
#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
#ifndef NO_UNISTD_H
# include <unistd.h>
#else
@@ -146,9 +149,9 @@
* needed for X.
*/
-#define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \
- XPutImage(display, pixels, gc, image, destx, desty, srcx, \
- srcy, width, height);
+#define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
+ XPutImage(display, pixels, gc, image, srcx, srcy, destx, \
+ desty, width, height);
/*
* Supply macros for seek offsets, if they're not already provided by
@@ -202,10 +205,12 @@
/*
* The following declaration is used to get access to a private Tcl interface
* that is needed for portability reasons.
- */
+ *
+ * Disabled for now to determined whether we really still need this.
#ifndef _TCLINT
#include <tclInt.h>
#endif
+ */
#endif /* _UNIXPORT */
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
new file mode 100644
index 0000000..134bb45
--- /dev/null
+++ b/unix/tkUnixRFont.c
@@ -0,0 +1,791 @@
+/*
+ * tkUnixRFont.c --
+ *
+ * Alternate implementation of tkUnixFont.c using Xft.
+ *
+ * Copyright (c) 2002-2003 Keith Packard
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkUnixInt.h"
+#include "tkFont.h"
+#include <X11/Xft/Xft.h>
+#include <ctype.h>
+
+typedef struct {
+ XftFont *ftFont;
+ FcPattern *source;
+ FcCharSet *charset;
+} UnixFtFace;
+
+typedef struct {
+ TkFont font; /* Stuff used by generic font package. Must be
+ * first in structure. */
+ UnixFtFace *faces;
+ int nfaces;
+ FcFontSet *fontset;
+ FcPattern *pattern;
+
+ Display *display;
+ int screen;
+ XftDraw *ftDraw;
+ XftColor color;
+} UnixFtFont;
+
+/*
+ * Package initialization:
+ * Nothing to do here except register the fact that we're using Xft in
+ * the TIP 59 configuration database.
+ */
+
+#ifndef TCL_CFGVAL_ENCODING
+#define TCL_CFGVAL_ENCODING "ascii"
+#endif
+
+void
+TkpFontPkgInit(
+ TkMainInfo *mainPtr) /* The application being created. */
+{
+ static Tcl_Config cfg[] = {
+ { "fontsystem", "xft" },
+ { 0,0 }
+ };
+
+ Tcl_RegisterConfig(mainPtr->interp, "tk", cfg, TCL_CFGVAL_ENCODING);
+}
+
+static XftFont *
+GetFont(
+ UnixFtFont *fontPtr,
+ FcChar32 ucs4)
+{
+ int i;
+
+ if (ucs4) {
+ for (i = 0; i < fontPtr->nfaces; i++) {
+ FcCharSet *charset = fontPtr->faces[i].charset;
+ if (charset && FcCharSetHasChar(charset, ucs4)) {
+ break;
+ }
+ }
+ if (i == fontPtr->nfaces) {
+ i = 0;
+ }
+ } else {
+ i = 0;
+ }
+ if (!fontPtr->faces[i].ftFont) {
+ FcPattern *pat = FcFontRenderPrepare(0,
+ fontPtr->pattern, fontPtr->faces[i].source);
+ XftFont *ftFont = XftFontOpenPattern(fontPtr->display, pat);
+
+ if (!ftFont) {
+ /*
+ * The previous call to XftFontOpenPattern() should not fail,
+ * but sometimes does anyway. Usual cause appears to be
+ * a misconfigured fontconfig installation; see [Bug 1090382].
+ * Try a fallback:
+ */
+ ftFont = XftFontOpen(fontPtr->display, fontPtr->screen,
+ FC_FAMILY, FcTypeString, "sans",
+ FC_SIZE, FcTypeDouble, 12.0,
+ (void *) NULL);
+ }
+ if (!ftFont) {
+ /*
+ * The previous call should definitely not fail.
+ * Impossible to proceed at this point.
+ */
+ Tcl_Panic("Cannot find a usable font.");
+ }
+
+ fontPtr->faces[i].ftFont = ftFont;
+ }
+ return fontPtr->faces[i].ftFont;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetTkFontAttributes --
+ * Fill in TkFontAttributes from an XftFont.
+ */
+
+static void
+GetTkFontAttributes(
+ XftFont *ftFont,
+ TkFontAttributes *faPtr)
+{
+ char *family = "Unknown", **familyPtr = &family;
+ int weight, slant, size, pxsize;
+ double ptsize;
+
+ (void)XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
+ if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
+ &ptsize) == XftResultMatch) {
+ size = (int)ptsize;
+ } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0,
+ &pxsize) == XftResultMatch) {
+ size = -pxsize;
+ } else {
+ size = 12;
+ }
+ if (XftPatternGetInteger(ftFont->pattern, XFT_WEIGHT, 0,
+ &weight) != XftResultMatch) {
+ weight = XFT_WEIGHT_MEDIUM;
+ }
+ if (XftPatternGetInteger(ftFont->pattern, XFT_SLANT, 0,
+ &slant) != XftResultMatch) {
+ slant = XFT_SLANT_ROMAN;
+ }
+
+#if DEBUG_FONTSEL
+ printf("family %s size %d weight %d slant %d\n",
+ family, size, weight, slant);
+#endif /* DEBUG_FONTSEL */
+
+ faPtr->family = Tk_GetUid(family);
+ faPtr->size = size;
+ faPtr->weight = (weight > XFT_WEIGHT_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
+ faPtr->slant = (slant > XFT_SLANT_ROMAN) ? TK_FS_ITALIC : TK_FS_ROMAN;
+ faPtr->underline = 0;
+ faPtr->overstrike = 0;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetTkFontMetrics --
+ * Fill in TkFontMetrics from an XftFont.
+ */
+
+static void GetTkFontMetrics(
+ XftFont *ftFont,
+ TkFontMetrics *fmPtr)
+{
+ int spacing;
+
+ if (XftPatternGetInteger(ftFont->pattern, XFT_SPACING, 0,
+ &spacing) != XftResultMatch) {
+ spacing = XFT_PROPORTIONAL;
+ }
+
+ fmPtr->ascent = ftFont->ascent;
+ fmPtr->descent = ftFont->descent;
+ fmPtr->maxWidth = ftFont->max_advance_width;
+ fmPtr->fixed = spacing != XFT_PROPORTIONAL;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * InitFont --
+ *
+ * Initializes the fields of a UnixFtFont structure. If fontPtr is NULL,
+ * also allocates a new UnixFtFont.
+ *
+ * Results:
+ * On error, frees fontPtr and returns NULL, otherwise returns fontPtr.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static UnixFtFont *
+InitFont(
+ Tk_Window tkwin,
+ FcPattern *pattern,
+ UnixFtFont *fontPtr)
+{
+ FcFontSet *set;
+ FcCharSet *charset;
+ FcResult result;
+ XftFont *ftFont;
+ int i;
+
+ if (!fontPtr) {
+ fontPtr = (UnixFtFont *) ckalloc(sizeof(UnixFtFont));
+ }
+
+ FcConfigSubstitute(0, pattern, FcMatchPattern);
+ XftDefaultSubstitute(Tk_Display(tkwin), Tk_ScreenNumber(tkwin), pattern);
+
+ /*
+ * Generate the list of fonts
+ */
+
+ set = FcFontSort(0, pattern, FcTrue, NULL, &result);
+ if (!set) {
+ ckfree((char *)fontPtr);
+ return NULL;
+ }
+
+ fontPtr->fontset = set;
+ fontPtr->pattern = pattern;
+ fontPtr->faces = (UnixFtFace *) ckalloc(set->nfont * sizeof(UnixFtFace));
+ fontPtr->nfaces = set->nfont;
+
+ /*
+ * Fill in information about each returned font
+ */
+
+ for (i = 0; i < set->nfont; i++) {
+ fontPtr->faces[i].ftFont = 0;
+ fontPtr->faces[i].source = set->fonts[i];
+ if (FcPatternGetCharSet(set->fonts[i], FC_CHARSET, 0,
+ &charset) == FcResultMatch) {
+ fontPtr->faces[i].charset = FcCharSetCopy(charset);
+ } else {
+ fontPtr->faces[i].charset = 0;
+ }
+ }
+
+ fontPtr->display = Tk_Display(tkwin);
+ fontPtr->screen = Tk_ScreenNumber(tkwin);
+ fontPtr->ftDraw = 0;
+ fontPtr->color.color.red = 0;
+ fontPtr->color.color.green = 0;
+ fontPtr->color.color.blue = 0;
+ fontPtr->color.color.alpha = 0xffff;
+ fontPtr->color.pixel = 0xffffffff;
+
+ /*
+ * Fill in platform-specific fields of TkFont.
+ */
+ ftFont = GetFont(fontPtr, 0);
+ fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed");
+ GetTkFontAttributes(ftFont, &fontPtr->font.fa);
+ GetTkFontMetrics(ftFont, &fontPtr->font.fm);
+
+ /*
+ * Fontconfig can't report any information about the position or thickness
+ * of underlines or overstrikes. Thus, we use some defaults that are
+ * hacked around from backup defaults in tkUnixFont.c, which are in turn
+ * based on recommendations in the X manual. The comments from that file
+ * leading to these computations were:
+ *
+ * If the XA_UNDERLINE_POSITION property does not exist, the X manual
+ * recommends using half the descent.
+ *
+ * If the XA_UNDERLINE_THICKNESS property does not exist, the X
+ * manual recommends using the width of the stem on a capital letter.
+ * I don't know of a way to get the stem width of a letter, so guess
+ * and use 1/3 the width of a capital I.
+ *
+ * Note that nothing corresponding to *either* property is reported by
+ * Fontconfig at all. [Bug 1961455]
+ */
+
+ {
+ TkFont *fPtr = &fontPtr->font;
+ int iWidth;
+
+ fPtr->underlinePos = fPtr->fm.descent / 2;
+ Tk_MeasureChars((Tk_Font) fPtr, "I", 1, -1, 0, &iWidth);
+ fPtr->underlineHeight = iWidth / 3;
+ if (fPtr->underlineHeight == 0) {
+ fPtr->underlineHeight = 1;
+ }
+ if (fPtr->underlineHeight + fPtr->underlinePos > fPtr->fm.descent) {
+ fPtr->underlineHeight = fPtr->fm.descent - fPtr->underlinePos;
+ if (fPtr->underlineHeight == 0) {
+ fPtr->underlinePos--;
+ fPtr->underlineHeight = 1;
+ }
+ }
+ }
+
+ return fontPtr;
+}
+
+static void
+FinishedWithFont(
+ UnixFtFont *fontPtr)
+{
+ Display *display = fontPtr->display;
+ int i;
+ Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL,
+ (ClientData) NULL);
+
+ for (i = 0; i < fontPtr->nfaces; i++) {
+ if (fontPtr->faces[i].ftFont) {
+ XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont);
+ }
+ if (fontPtr->faces[i].charset) {
+ FcCharSetDestroy(fontPtr->faces[i].charset);
+ }
+ }
+ if (fontPtr->faces) {
+ ckfree((char *)fontPtr->faces);
+ }
+ if (fontPtr->pattern) {
+ FcPatternDestroy(fontPtr->pattern);
+ }
+ if (fontPtr->ftDraw) {
+ XftDrawDestroy(fontPtr->ftDraw);
+ }
+ if (fontPtr->font.fid) {
+ XUnloadFont(fontPtr->display, fontPtr->font.fid);
+ }
+ if (fontPtr->fontset) {
+ FcFontSetDestroy(fontPtr->fontset);
+ }
+ Tk_DeleteErrorHandler(handler);
+}
+
+TkFont *
+TkpGetNativeFont(
+ Tk_Window tkwin, /* For display where font will be used. */
+ CONST char *name) /* Platform-specific font name. */
+{
+ UnixFtFont *fontPtr;
+ FcPattern *pattern;
+#if DEBUG_FONTSEL
+ printf("TkpGetNativeFont %s\n", name);
+#endif /* DEBUG_FONTSEL */
+
+ pattern = XftXlfdParse(name, FcFalse, FcFalse);
+ if (!pattern) {
+ return NULL;
+ }
+
+ /*
+ * Should also try: pattern = FcNameParse(name); but generic/tkFont.c
+ * expects TkpGetNativeFont() to only work on XLFD names under Unix.
+ */
+
+ fontPtr = InitFont(tkwin, pattern, NULL);
+ if (!fontPtr) {
+ FcPatternDestroy(pattern);
+ return NULL;
+ }
+ return &fontPtr->font;
+}
+
+TkFont *
+TkpGetFontFromAttributes(
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
+ * allocating a new structure to hold the
+ * font; the existing contents of the font
+ * will be released. If NULL, a new TkFont
+ * structure is allocated. */
+ Tk_Window tkwin, /* For display where font will be used. */
+ CONST TkFontAttributes *faPtr)
+ /* Set of attributes to match. */
+{
+ XftPattern *pattern;
+ int weight, slant;
+ UnixFtFont *fontPtr;
+
+#if DEBUG_FONTSEL
+ printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family,
+ faPtr->size, faPtr->weight, faPtr->slant);
+#endif /* DEBUG_FONTSEL */
+ pattern = XftPatternCreate();
+ if (faPtr->family) {
+ XftPatternAddString(pattern, XFT_FAMILY, faPtr->family);
+ }
+ if (faPtr->size > 0) {
+ XftPatternAddDouble(pattern, XFT_SIZE, (double)faPtr->size);
+ } else if (faPtr->size < 0) {
+ XftPatternAddInteger(pattern, XFT_PIXEL_SIZE, -faPtr->size);
+ } else {
+ XftPatternAddDouble(pattern, XFT_SIZE, 12.0);
+ }
+ switch (faPtr->weight) {
+ case TK_FW_NORMAL:
+ default:
+ weight = XFT_WEIGHT_MEDIUM;
+ break;
+ case TK_FW_BOLD:
+ weight = XFT_WEIGHT_BOLD;
+ break;
+ }
+ XftPatternAddInteger(pattern, XFT_WEIGHT, weight);
+ switch (faPtr->slant) {
+ case TK_FS_ROMAN:
+ default:
+ slant = XFT_SLANT_ROMAN;
+ break;
+ case TK_FS_ITALIC:
+ slant = XFT_SLANT_ITALIC;
+ break;
+ case TK_FS_OBLIQUE:
+ slant = XFT_SLANT_OBLIQUE;
+ break;
+ }
+ XftPatternAddInteger(pattern, XFT_SLANT, slant);
+
+ fontPtr = (UnixFtFont *) tkFontPtr;
+ if (fontPtr != NULL) {
+ FinishedWithFont(fontPtr);
+ }
+ fontPtr = InitFont(tkwin, pattern, fontPtr);
+
+ /*
+ * Hack to work around issues with weird issues with Xft/Xrender
+ * connection. For details, see comp.lang.tcl thread starting from
+ * <adcc99ed-c73e-4efc-bb5d-e57a57a051e8@l35g2000pra.googlegroups.com>
+ */
+
+ if (!fontPtr) {
+ XftPatternAddBool(pattern, XFT_RENDER, FcFalse);
+ fontPtr = InitFont(tkwin, pattern, fontPtr);
+ }
+
+ if (!fontPtr) {
+ FcPatternDestroy(pattern);
+ return NULL;
+ }
+
+ fontPtr->font.fa.underline = faPtr->underline;
+ fontPtr->font.fa.overstrike = faPtr->overstrike;
+ return &fontPtr->font;
+}
+
+void
+TkpDeleteFont(
+ TkFont *tkFontPtr) /* Token of font to be deleted. */
+{
+ UnixFtFont *fontPtr = (UnixFtFont *) tkFontPtr;
+
+ FinishedWithFont(fontPtr);
+ /* XXX tkUnixFont.c doesn't free tkFontPtr... */
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpGetFontFamilies --
+ *
+ * Return information about the font families that are available on the
+ * display of the given window.
+ *
+ * Results:
+ * Modifies interp's result object to hold a list of all the available
+ * font families.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkpGetFontFamilies(
+ Tcl_Interp *interp, /* Interp to hold result. */
+ Tk_Window tkwin) /* For display to query. */
+{
+ Tcl_Obj *resultPtr;
+ XftFontSet *list;
+ int i;
+
+ resultPtr = Tcl_NewListObj(0, NULL);
+
+ list = XftListFonts(Tk_Display(tkwin), Tk_ScreenNumber(tkwin),
+ (char*)0, /* pattern elements */
+ XFT_FAMILY, (char*)0); /* fields */
+ for (i = 0; i < list->nfont; i++) {
+ char *family, **familyPtr = &family;
+ if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, familyPtr)
+ == XftResultMatch)
+ {
+ Tcl_Obj *strPtr = Tcl_NewStringObj(family, -1);
+ Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
+ }
+ }
+ XftFontSetDestroy(list);
+
+ Tcl_SetObjResult(interp, resultPtr);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TkpGetSubFonts --
+ *
+ * Called by [testfont subfonts] in the Tk testing package.
+ *
+ * Results:
+ * Sets interp's result to a list of the faces used by tkfont
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+TkpGetSubFonts(
+ Tcl_Interp *interp,
+ Tk_Font tkfont)
+{
+ Tcl_Obj *objv[3], *listPtr, *resultPtr;
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ FcPattern *pattern;
+ char *family = "Unknown", **familyPtr = &family;
+ char *foundry = "Unknown", **foundryPtr = &foundry;
+ char *encoding = "Unknown", **encodingPtr = &encoding;
+ int i;
+
+ resultPtr = Tcl_NewListObj(0, NULL);
+
+ for (i = 0; i < fontPtr->nfaces ; ++i) {
+ pattern = FcFontRenderPrepare(0, fontPtr->pattern,
+ fontPtr->faces[i].source);
+
+ XftPatternGetString(pattern, XFT_FAMILY, 0, familyPtr);
+ XftPatternGetString(pattern, XFT_FOUNDRY, 0, foundryPtr);
+ XftPatternGetString(pattern, XFT_ENCODING, 0, encodingPtr);
+ objv[0] = Tcl_NewStringObj(family, -1);
+ objv[1] = Tcl_NewStringObj(foundry, -1);
+ objv[2] = Tcl_NewStringObj(encoding, -1);
+ listPtr = Tcl_NewListObj(3, objv);
+ Tcl_ListObjAppendElement(NULL, resultPtr, listPtr);
+ }
+ Tcl_SetObjResult(interp, resultPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetFontAttrsForChar --
+ *
+ * Retrieve the font attributes of the actual font used to render a given
+ * character.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetFontAttrsForChar(
+ Tk_Window tkwin, /* Window on the font's display */
+ Tk_Font tkfont, /* Font to query */
+ Tcl_UniChar c, /* Character of interest */
+ TkFontAttributes *faPtr) /* Output: Font attributes */
+{
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ /* Structure describing the logical font */
+ FcChar32 ucs4 = (FcChar32) c;
+ /* UCS-4 character to map */
+ XftFont *ftFont = GetFont(fontPtr, ucs4);
+ /* Actual font used to render the character */
+
+ GetTkFontAttributes(ftFont, faPtr);
+ faPtr->underline = fontPtr->font.fa.underline;
+ faPtr->overstrike = fontPtr->font.fa.overstrike;
+}
+
+int
+Tk_MeasureChars(
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
+ * permissible line length in pixels; don't
+ * consider any character that would cross
+ * this x-position. If < 0, then line length
+ * is unbounded and the flags argument is
+ * ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fit on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ XftFont *ftFont;
+ FcChar32 c;
+ XGlyphInfo extents;
+ int clen, curX, newX, curByte, newByte, sawNonSpace;
+ int termByte = 0, termX = 0;
+#if DEBUG_FONTSEL
+ char string[256];
+ int len = 0;
+#endif /* DEBUG_FONTSEL */
+
+ curX = 0;
+ curByte = 0;
+ sawNonSpace = 0;
+ while (numBytes > 0) {
+ Tcl_UniChar unichar;
+
+ clen = Tcl_UtfToUniChar(source, &unichar);
+ c = (FcChar32)unichar;
+
+ if (clen <= 0) {
+ /*
+ * This can't happen (but see #1185640)
+ */
+
+ *lengthPtr = curX;
+ return curByte;
+ }
+
+ source += clen;
+ numBytes -= clen;
+ if (c < 256 && isspace(c)) { /* I18N: ??? */
+ if (sawNonSpace) {
+ termByte = curByte;
+ termX = curX;
+ sawNonSpace = 0;
+ }
+ } else {
+ sawNonSpace = 1;
+ }
+
+#if DEBUG_FONTSEL
+ string[len++] = (char) c;
+#endif /* DEBUG_FONTSEL */
+ ftFont = GetFont(fontPtr, c);
+
+ XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents);
+
+ newX = curX + extents.xOff;
+ newByte = curByte + clen;
+ if (maxLength >= 0 && newX > maxLength) {
+ if (flags & TK_PARTIAL_OK ||
+ (flags & TK_AT_LEAST_ONE && curByte == 0)) {
+ curX = newX;
+ curByte = newByte;
+ } else if (flags & TK_WHOLE_WORDS && termX != 0) {
+ curX = termX;
+ curByte = termByte;
+ }
+ break;
+ }
+
+ curX = newX;
+ curByte = newByte;
+ }
+#if DEBUG_FONTSEL
+ string[len] = '\0';
+ printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte);
+#endif /* DEBUG_FONTSEL */
+ *lengthPtr = curX;
+ return curByte;
+}
+
+int
+TkpMeasureCharsInContext(
+ Tk_Font tkfont,
+ CONST char *source,
+ int numBytes,
+ int rangeStart,
+ int rangeLength,
+ int maxLength,
+ int flags,
+ int *lengthPtr)
+{
+ (void) numBytes; /*unused*/
+
+ return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength,
+ maxLength, flags, lengthPtr);
+}
+
+#define NUM_SPEC 1024
+
+void
+Tk_DrawChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ int x, int y) /* Coordinates at which to place origin of
+ * string when drawing. */
+{
+ const int maxCoord = 0x7FFF;/* Xft coordinates are 16 bit values */
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ XGCValues values;
+ XColor xcolor;
+ int clen, nspec, xStart = x;
+ XftGlyphFontSpec specs[NUM_SPEC];
+ XGlyphInfo metrics;
+
+ if (fontPtr->ftDraw == 0) {
+#if DEBUG_FONTSEL
+ printf("Switch to drawable 0x%x\n", drawable);
+#endif /* DEBUG_FONTSEL */
+ fontPtr->ftDraw = XftDrawCreate(display, drawable,
+ DefaultVisual(display, fontPtr->screen),
+ DefaultColormap(display, fontPtr->screen));
+ } else {
+ Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1,
+ NULL, (ClientData) NULL);
+
+ XftDrawChange(fontPtr->ftDraw, drawable);
+ Tk_DeleteErrorHandler(handler);
+ }
+ XGetGCValues(display, gc, GCForeground, &values);
+ if (values.foreground != fontPtr->color.pixel) {
+ xcolor.pixel = values.foreground;
+ XQueryColor(display, DefaultColormap(display, fontPtr->screen),
+ &xcolor);
+ fontPtr->color.color.red = xcolor.red;
+ fontPtr->color.color.green = xcolor.green;
+ fontPtr->color.color.blue = xcolor.blue;
+ fontPtr->color.color.alpha = 0xffff;
+ fontPtr->color.pixel = values.foreground;
+ }
+ nspec = 0;
+ while (numBytes > 0 && x <= maxCoord && y <= maxCoord) {
+ XftFont *ftFont;
+ FcChar32 c;
+
+ clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
+ if (clen <= 0) {
+ /*
+ * This should not happen, but it can.
+ */
+
+ goto doUnderlineStrikeout;
+ }
+ source += clen;
+ numBytes -= clen;
+
+ ftFont = GetFont(fontPtr, c);
+ if (ftFont) {
+ specs[nspec].font = ftFont;
+ specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c);
+ specs[nspec].x = x;
+ specs[nspec].y = y;
+ XftGlyphExtents(fontPtr->display, ftFont, &specs[nspec].glyph, 1,
+ &metrics);
+ x += metrics.xOff;
+ y += metrics.yOff;
+ nspec++;
+ if (nspec == NUM_SPEC) {
+ XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color,
+ specs, nspec);
+ nspec = 0;
+ }
+ }
+ }
+ if (nspec) {
+ XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color, specs, nspec);
+ }
+
+ doUnderlineStrikeout:
+ if (fontPtr->font.fa.underline != 0) {
+ XFillRectangle(display, drawable, gc, xStart,
+ y + fontPtr->font.underlinePos, (unsigned) (x - xStart),
+ (unsigned) fontPtr->font.underlineHeight);
+ }
+ if (fontPtr->font.fa.overstrike != 0) {
+ y -= fontPtr->font.fm.descent + (fontPtr->font.fm.ascent) / 10;
+ XFillRectangle(display, drawable, gc, xStart, y,
+ (unsigned) (x - xStart),
+ (unsigned) fontPtr->font.underlineHeight);
+ }
+}
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index 637fd46..e158549 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -1,31 +1,30 @@
-/*
+/*
* tkUnixScale.c --
*
- * This file implements the X specific portion of the scrollbar
- * widget.
+ * This file implements the X specific portion of the scrollbar widget.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkScale.h"
#include "tkInt.h"
+#include "tkScale.h"
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void DisplayHorizontalScale _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, XRectangle *drawnAreaPtr));
-static void DisplayHorizontalValue _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, double value, int top));
-static void DisplayVerticalScale _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, XRectangle *drawnAreaPtr));
-static void DisplayVerticalValue _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, double value, int rightEdge));
+static void DisplayHorizontalScale(TkScale *scalePtr,
+ Drawable drawable, XRectangle *drawnAreaPtr);
+static void DisplayHorizontalValue(TkScale *scalePtr,
+ Drawable drawable, double value, int top);
+static void DisplayVerticalScale(TkScale *scalePtr,
+ Drawable drawable, XRectangle *drawnAreaPtr);
+static void DisplayVerticalValue(TkScale *scalePtr,
+ Drawable drawable, double value, int rightEdge);
/*
*----------------------------------------------------------------------
@@ -44,8 +43,8 @@ static void DisplayVerticalValue _ANSI_ARGS_((TkScale *scalePtr,
*/
TkScale *
-TkpCreateScale(tkwin)
- Tk_Window tkwin;
+TkpCreateScale(
+ Tk_Window tkwin)
{
return (TkScale *) ckalloc(sizeof(TkScale));
}
@@ -55,9 +54,9 @@ TkpCreateScale(tkwin)
*
* TkpDestroyScale --
*
- * Destroy a TkScale structure. It's necessary to do this with
- * Tcl_EventuallyFree to allow the Tcl_Preserve(scalePtr) to work
- * as expected in TkpDisplayScale. (hobbs)
+ * Destroy a TkScale structure. It's necessary to do this with
+ * Tcl_EventuallyFree to allow the Tcl_Preserve(scalePtr) to work as
+ * expected in TkpDisplayScale. (hobbs)
*
* Results:
* None
@@ -69,8 +68,8 @@ TkpCreateScale(tkwin)
*/
void
-TkpDestroyScale(scalePtr)
- TkScale *scalePtr;
+TkpDestroyScale(
+ TkScale *scalePtr)
{
Tcl_EventuallyFree((ClientData) scalePtr, TCL_DYNAMIC);
}
@@ -80,14 +79,14 @@ TkpDestroyScale(scalePtr)
*
* DisplayVerticalScale --
*
- * This procedure redraws the contents of a vertical scale
- * window. It is invoked as a do-when-idle handler, so it only
- * runs when there's nothing else for the application to do.
+ * This function redraws the contents of a vertical scale window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
- * There is no return value. If only a part of the scale needs
- * to be redrawn, then drawnAreaPtr is modified to reflect the
- * area that was actually modified.
+ * There is no return value. If only a part of the scale needs to be
+ * redrawn, then drawnAreaPtr is modified to reflect the area that was
+ * actually modified.
*
* Side effects:
* Information appears on the screen.
@@ -96,15 +95,14 @@ TkpDestroyScale(scalePtr)
*/
static void
-DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
- TkScale *scalePtr; /* Widget record for scale. */
- Drawable drawable; /* Where to display scale (window
- * or pixmap). */
- XRectangle *drawnAreaPtr; /* Initally contains area of window;
- * if only a part of the scale is
- * redrawn, gets modified to reflect
- * the part of the window that was
- * redrawn. */
+DisplayVerticalScale(
+ TkScale *scalePtr, /* Widget record for scale. */
+ Drawable drawable, /* Where to display scale (window or
+ * pixmap). */
+ XRectangle *drawnAreaPtr) /* Initally contains area of window; if only a
+ * part of the scale is redrawn, gets modified
+ * to reflect the part of the window that was
+ * redrawn. */
{
Tk_Window tkwin = scalePtr->tkwin;
int x, y, width, height, shadowWidth;
@@ -134,18 +132,19 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
double ticks, maxTicks;
/*
- * Ensure that we will only draw enough of the tick values
- * such that they don't overlap
+ * Ensure that we will only draw enough of the tick values such
+ * that they don't overlap
*/
+
ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
/ tickInterval);
maxTicks = (double) Tk_Height(tkwin)
- / (double) scalePtr->fontHeight;
+ / (double) scalePtr->fontHeight;
if (ticks > maxTicks) {
tickInterval *= (ticks / maxTicks);
}
for (tickValue = scalePtr->fromValue; ;
- tickValue += tickInterval) {
+ tickValue += tickInterval) {
/*
* The TkRoundToResolution call gets rid of accumulated
* round-off errors, if any.
@@ -224,7 +223,7 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label,
+ scalePtr->tkfont, scalePtr->label,
scalePtr->labelLength, scalePtr->vertLabelX,
scalePtr->inset + (3*fm.ascent)/2);
}
@@ -235,30 +234,30 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
*
* DisplayVerticalValue --
*
- * This procedure is called to display values (scale readings)
- * for vertically-oriented scales.
+ * This function is called to display values (scale readings) for
+ * vertically-oriented scales.
*
* Results:
* None.
*
* Side effects:
- * The numerical value corresponding to value is displayed with
- * its right edge at "rightEdge", and at a vertical position in
- * the scale that corresponds to "value".
+ * The numerical value corresponding to value is displayed with its right
+ * edge at "rightEdge", and at a vertical position in the scale that
+ * corresponds to "value".
*
*----------------------------------------------------------------------
*/
static void
-DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
- register TkScale *scalePtr; /* Information about widget in which to
+DisplayVerticalValue(
+ register TkScale *scalePtr, /* Information about widget in which to
* display value. */
- Drawable drawable; /* Pixmap or window in which to draw
- * the value. */
- double value; /* Y-coordinate of number to display,
- * specified in application coords, not
- * in pixels (we'll compute pixels). */
- int rightEdge; /* X-coordinate of right edge of text,
+ Drawable drawable, /* Pixmap or window in which to draw the
+ * value. */
+ double value, /* Y-coordinate of number to display,
+ * specified in application coords, not in
+ * pixels (we'll compute pixels). */
+ int rightEdge) /* X-coordinate of right edge of text,
* specified in pixels. */
{
register Tk_Window tkwin = scalePtr->tkwin;
@@ -273,8 +272,8 @@ DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
/*
- * Adjust the y-coordinate if necessary to keep the text entirely
- * inside the window.
+ * Adjust the y-coordinate if necessary to keep the text entirely inside
+ * the window.
*/
if ((y - fm.ascent) < (scalePtr->inset + SPACING)) {
@@ -292,14 +291,14 @@ DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
*
* DisplayHorizontalScale --
*
- * This procedure redraws the contents of a horizontal scale
- * window. It is invoked as a do-when-idle handler, so it only
- * runs when there's nothing else for the application to do.
+ * This function redraws the contents of a horizontal scale window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
- * There is no return value. If only a part of the scale needs
- * to be redrawn, then drawnAreaPtr is modified to reflect the
- * area that was actually modified.
+ * There is no return value. If only a part of the scale needs to be
+ * redrawn, then drawnAreaPtr is modified to reflect the area that was
+ * actually modified.
*
* Side effects:
* Information appears on the screen.
@@ -308,15 +307,14 @@ DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
*/
static void
-DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
- TkScale *scalePtr; /* Widget record for scale. */
- Drawable drawable; /* Where to display scale (window
- * or pixmap). */
- XRectangle *drawnAreaPtr; /* Initally contains area of window;
- * if only a part of the scale is
- * redrawn, gets modified to reflect
- * the part of the window that was
- * redrawn. */
+DisplayHorizontalScale(
+ TkScale *scalePtr, /* Widget record for scale. */
+ Drawable drawable, /* Where to display scale (window or
+ * pixmap). */
+ XRectangle *drawnAreaPtr) /* Initally contains area of window; if only a
+ * part of the scale is redrawn, gets modified
+ * to reflect the part of the window that was
+ * redrawn. */
{
register Tk_Window tkwin = scalePtr->tkwin;
int x, y, width, height, shadowWidth;
@@ -347,15 +345,16 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
double ticks, maxTicks;
/*
- * Ensure that we will only draw enough of the tick values
- * such that they don't overlap. We base this off the width that
- * fromValue would take. Not exact, but better than no constraint.
+ * Ensure that we will only draw enough of the tick values such
+ * that they don't overlap. We base this off the width that
+ * fromValue would take. Not exact, but better than no constraint.
*/
+
ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
/ tickInterval);
sprintf(valueString, scalePtr->format, scalePtr->fromValue);
maxTicks = (double) Tk_Width(tkwin)
- / (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1);
+ / (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1);
if (ticks > maxTicks) {
tickInterval *= (ticks / maxTicks);
}
@@ -440,8 +439,8 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label,
- scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
+ scalePtr->tkfont, scalePtr->label,
+ scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
scalePtr->horizLabelY + fm.ascent);
}
}
@@ -451,31 +450,31 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
*
* DisplayHorizontalValue --
*
- * This procedure is called to display values (scale readings)
- * for horizontally-oriented scales.
+ * This function is called to display values (scale readings) for
+ * horizontally-oriented scales.
*
* Results:
* None.
*
* Side effects:
- * The numerical value corresponding to value is displayed with
- * its bottom edge at "bottom", and at a horizontal position in
- * the scale that corresponds to "value".
+ * The numerical value corresponding to value is displayed with its
+ * bottom edge at "bottom", and at a horizontal position in the scale
+ * that corresponds to "value".
*
*----------------------------------------------------------------------
*/
static void
-DisplayHorizontalValue(scalePtr, drawable, value, top)
- register TkScale *scalePtr; /* Information about widget in which to
+DisplayHorizontalValue(
+ register TkScale *scalePtr, /* Information about widget in which to
* display value. */
- Drawable drawable; /* Pixmap or window in which to draw
- * the value. */
- double value; /* X-coordinate of number to display,
- * specified in application coords, not
- * in pixels (we'll compute pixels). */
- int top; /* Y-coordinate of top edge of text,
- * specified in pixels. */
+ Drawable drawable, /* Pixmap or window in which to draw the
+ * value. */
+ double value, /* X-coordinate of number to display,
+ * specified in application coords, not in
+ * pixels (we'll compute pixels). */
+ int top) /* Y-coordinate of top edge of text, specified
+ * in pixels. */
{
register Tk_Window tkwin = scalePtr->tkwin;
int x, y, length, width;
@@ -490,18 +489,19 @@ DisplayHorizontalValue(scalePtr, drawable, value, top)
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
/*
- * Adjust the x-coordinate if necessary to keep the text entirely
- * inside the window.
+ * Adjust the x-coordinate if necessary to keep the text entirely inside
+ * the window.
*/
x -= (width)/2;
if (x < (scalePtr->inset + SPACING)) {
x = scalePtr->inset + SPACING;
}
+
/*
- * Check the right border so use starting point +text width
- * for the check.
+ * Check the right border so use starting point +text width for the check.
*/
+
if (x + width >= (Tk_Width(tkwin) - scalePtr->inset)) {
x = Tk_Width(tkwin) - scalePtr->inset - SPACING - width;
}
@@ -514,8 +514,8 @@ DisplayHorizontalValue(scalePtr, drawable, value, top)
*
* TkpDisplayScale --
*
- * This procedure is invoked as an idle handler to redisplay
- * the contents of a scale widget.
+ * This function is invoked as an idle handler to redisplay the contents
+ * of a scale widget.
*
* Results:
* None.
@@ -527,8 +527,8 @@ DisplayHorizontalValue(scalePtr, drawable, value, top)
*/
void
-TkpDisplayScale(clientData)
- ClientData clientData; /* Widget record for scale. */
+TkpDisplayScale(
+ ClientData clientData) /* Widget record for scale. */
{
TkScale *scalePtr = (TkScale *) clientData;
Tk_Window tkwin = scalePtr->tkwin;
@@ -546,6 +546,7 @@ TkpDisplayScale(clientData)
/*
* Invoke the scale's command if needed.
*/
+
Tcl_Preserve((ClientData) scalePtr);
if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
Tcl_Preserve((ClientData) interp);
@@ -567,10 +568,10 @@ TkpDisplayScale(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * In order to avoid screen flashes, this procedure redraws
- * the scale in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the scale in a
+ * pixmap, then copies the pixmap to the screen in a single operation.
+ * This means that there's no point in time where the on-sreen image has
+ * been cleared.
*/
pixmap = Tk_GetPixmap(scalePtr->display, Tk_WindowId(tkwin),
@@ -584,9 +585,8 @@ TkpDisplayScale(clientData)
drawnArea.height = Tk_Height(tkwin);
/*
- * Much of the redisplay is done totally differently for
- * horizontal and vertical scales. Handle the part that's
- * different.
+ * Much of the redisplay is done totally differently for horizontal and
+ * vertical scales. Handle the part that's different.
*/
if (scalePtr->orient == ORIENT_VERTICAL) {
@@ -596,9 +596,8 @@ TkpDisplayScale(clientData)
}
/*
- * Now handle the part of redisplay that is the same for
- * horizontal and vertical scales: border and traversal
- * highlight.
+ * Now handle the part of redisplay that is the same for horizontal and
+ * vertical scales: border and traversal highlight.
*/
if (scalePtr->flags & REDRAW_OTHER) {
@@ -611,7 +610,7 @@ TkpDisplayScale(clientData)
}
if (scalePtr->highlightWidth != 0) {
GC gc;
-
+
if (scalePtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(scalePtr->highlightColorPtr, pixmap);
} else {
@@ -624,8 +623,8 @@ TkpDisplayScale(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(scalePtr->display, pixmap, Tk_WindowId(tkwin),
@@ -634,7 +633,7 @@ TkpDisplayScale(clientData)
Tk_FreePixmap(scalePtr->display, pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
- done:
+ done:
scalePtr->flags &= ~REDRAW_ALL;
}
@@ -643,13 +642,12 @@ TkpDisplayScale(clientData)
*
* TkpScaleElement --
*
- * Determine which part of a scale widget lies under a given
- * point.
+ * Determine which part of a scale widget lies under a given point.
*
* Results:
- * The return value is either TROUGH1, SLIDER, TROUGH2, or
- * OTHER, depending on which of the scale's active elements
- * (if any) is under the point at (x,y).
+ * The return value is either TROUGH1, SLIDER, TROUGH2, or OTHER,
+ * depending on which of the scale's active elements (if any) is under
+ * the point at (x,y).
*
* Side effects:
* None.
@@ -658,9 +656,9 @@ TkpDisplayScale(clientData)
*/
int
-TkpScaleElement(scalePtr, x, y)
- TkScale *scalePtr; /* Widget record for scale. */
- int x, y; /* Coordinates within scalePtr's window. */
+TkpScaleElement(
+ TkScale *scalePtr, /* Widget record for scale. */
+ int x, int y) /* Coordinates within scalePtr's window. */
{
int sliderFirst;
@@ -704,3 +702,11 @@ TkpScaleElement(scalePtr, x, y)
}
return TROUGH2;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index 4e1ed06..1e70925 100644
--- a/unix/tkUnixScrlbr.c
+++ b/unix/tkUnixScrlbr.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkUnixScrollbar.c --
*
* This file implements the Unix specific portion of the scrollbar
@@ -6,15 +6,16 @@
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tkInt.h"
#include "tkScrollbar.h"
/*
- * Minimum slider length, in pixels (designed to make sure that the slider
- * is always easy to grab with the mouse).
+ * Minimum slider length, in pixels (designed to make sure that the slider is
+ * always easy to grab with the mouse).
*/
#define MIN_SLIDER_LENGTH 5
@@ -30,15 +31,14 @@ typedef struct UnixScrollbar {
} UnixScrollbar;
/*
- * The class procedure table for the scrollbar widget. All fields except
- * size are left initialized to NULL, which should happen automatically
- * since the variable is declared at this scope.
+ * The class procedure table for the scrollbar widget. All fields except size
+ * are left initialized to NULL, which should happen automatically since the
+ * variable is declared at this scope.
*/
Tk_ClassProcs tkpScrollbarProcs = {
sizeof(Tk_ClassProcs) /* size */
};
-
/*
*----------------------------------------------------------------------
@@ -57,8 +57,8 @@ Tk_ClassProcs tkpScrollbarProcs = {
*/
TkScrollbar *
-TkpCreateScrollbar(tkwin)
- Tk_Window tkwin;
+TkpCreateScrollbar(
+ Tk_Window tkwin)
{
UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar));
scrollPtr->troughGC = None;
@@ -76,9 +76,9 @@ TkpCreateScrollbar(tkwin)
*
* TkpDisplayScrollbar --
*
- * This procedure redraws the contents of a scrollbar window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This procedure redraws the contents of a scrollbar window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
* None.
@@ -90,8 +90,8 @@ TkpCreateScrollbar(tkwin)
*/
void
-TkpDisplayScrollbar(clientData)
- ClientData clientData; /* Information about window. */
+TkpDisplayScrollbar(
+ ClientData clientData) /* Information about window. */
{
register TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
register Tk_Window tkwin = scrollPtr->tkwin;
@@ -115,10 +115,10 @@ TkpDisplayScrollbar(clientData)
}
/*
- * In order to avoid screen flashes, this procedure redraws
- * the scrollbar in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this procedure redraws the scrollbar
+ * in a pixmap, then copies the pixmap to the screen in a single
+ * operation. This means that there's no point in time where the on-sreen
+ * image has been cleared.
*/
pixmap = Tk_GetPixmap(scrollPtr->display, Tk_WindowId(tkwin),
@@ -146,11 +146,11 @@ TkpDisplayScrollbar(clientData)
(unsigned) (Tk_Height(tkwin) - 2*scrollPtr->inset));
/*
- * Draw the top or left arrow. The coordinates of the polygon
- * points probably seem odd, but they were carefully chosen with
- * respect to X's rules for filling polygons. These point choices
- * cause the arrows to just fill the narrow dimension of the
- * scrollbar and be properly centered.
+ * Draw the top or left arrow. The coordinates of the polygon points
+ * probably seem odd, but they were carefully chosen with respect to X's
+ * rules for filling polygons. These point choices cause the arrows to
+ * just fill the narrow dimension of the scrollbar and be properly
+ * centered.
*/
if (scrollPtr->activeField == TOP_ARROW) {
@@ -240,8 +240,8 @@ TkpDisplayScrollbar(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(scrollPtr->display, pixmap, Tk_WindowId(tkwin),
@@ -249,7 +249,7 @@ TkpDisplayScrollbar(clientData)
(unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0);
Tk_FreePixmap(scrollPtr->display, pixmap);
- done:
+ done:
scrollPtr->flags &= ~REDRAW_PENDING;
}
@@ -258,9 +258,9 @@ TkpDisplayScrollbar(clientData)
*
* TkpComputeScrollbarGeometry --
*
- * After changes in a scrollbar's size or configuration, this
- * procedure recomputes various geometry information used in
- * displaying the scrollbar.
+ * After changes in a scrollbar's size or configuration, this procedure
+ * recomputes various geometry information used in displaying the
+ * scrollbar.
*
* Results:
* None.
@@ -272,9 +272,10 @@ TkpDisplayScrollbar(clientData)
*/
extern void
-TkpComputeScrollbarGeometry(scrollPtr)
- register TkScrollbar *scrollPtr; /* Scrollbar whose geometry may
- * have changed. */
+TkpComputeScrollbarGeometry(
+ register TkScrollbar *scrollPtr)
+ /* Scrollbar whose geometry may have
+ * changed. */
{
int width, fieldLength;
@@ -295,9 +296,9 @@ TkpComputeScrollbarGeometry(scrollPtr)
scrollPtr->sliderLast = fieldLength*scrollPtr->lastFraction;
/*
- * Adjust the slider so that some piece of it is always
- * displayed in the scrollbar and so that it has at least
- * a minimal width (so it can be grabbed with the mouse).
+ * Adjust the slider so that some piece of it is always displayed in the
+ * scrollbar and so that it has at least a minimal width (so it can be
+ * grabbed with the mouse).
*/
if (scrollPtr->sliderFirst > (fieldLength - MIN_SLIDER_LENGTH)) {
@@ -317,10 +318,9 @@ TkpComputeScrollbarGeometry(scrollPtr)
scrollPtr->sliderLast += scrollPtr->arrowLength + scrollPtr->inset;
/*
- * Register the desired geometry for the window (leave enough space
- * for the two arrows plus a minimum-size slider, plus border around
- * the whole window, if any). Then arrange for the window to be
- * redisplayed.
+ * Register the desired geometry for the window (leave enough space for
+ * the two arrows plus a minimum-size slider, plus border around the whole
+ * window, if any). Then arrange for the window to be redisplayed.
*/
if (scrollPtr->vertical) {
@@ -353,8 +353,8 @@ TkpComputeScrollbarGeometry(scrollPtr)
*/
void
-TkpDestroyScrollbar(scrollPtr)
- TkScrollbar *scrollPtr;
+TkpDestroyScrollbar(
+ TkScrollbar *scrollPtr)
{
UnixScrollbar *unixScrollPtr = (UnixScrollbar *)scrollPtr;
@@ -372,8 +372,8 @@ TkpDestroyScrollbar(scrollPtr)
* TkpConfigureScrollbar --
*
* This procedure is called after the generic code has finished
- * processing configuration options, in order to configure
- * platform specific options.
+ * processing configuration options, in order to configure platform
+ * specific options.
*
* Results:
* None.
@@ -385,10 +385,10 @@ TkpDestroyScrollbar(scrollPtr)
*/
void
-TkpConfigureScrollbar(scrollPtr)
- register TkScrollbar *scrollPtr; /* Information about widget; may or
- * may not already have values for
- * some fields. */
+TkpConfigureScrollbar(
+ register TkScrollbar *scrollPtr)
+ /* Information about widget; may or may not
+ * already have values for some fields. */
{
XGCValues gcValues;
GC new;
@@ -414,14 +414,12 @@ TkpConfigureScrollbar(scrollPtr)
*
* TkpScrollbarPosition --
*
- * Determine the scrollbar element corresponding to a
- * given position.
+ * Determine the scrollbar element corresponding to a given position.
*
* Results:
- * One of TOP_ARROW, TOP_GAP, etc., indicating which element
- * of the scrollbar covers the position given by (x, y). If
- * (x,y) is outside the scrollbar entirely, then OUTSIDE is
- * returned.
+ * One of TOP_ARROW, TOP_GAP, etc., indicating which element of the
+ * scrollbar covers the position given by (x, y). If (x,y) is outside the
+ * scrollbar entirely, then OUTSIDE is returned.
*
* Side effects:
* None.
@@ -430,10 +428,10 @@ TkpConfigureScrollbar(scrollPtr)
*/
int
-TkpScrollbarPosition(scrollPtr, x, y)
- register TkScrollbar *scrollPtr; /* Scrollbar widget record. */
- int x, y; /* Coordinates within scrollPtr's
- * window. */
+TkpScrollbarPosition(
+ register TkScrollbar *scrollPtr,
+ /* Scrollbar widget record. */
+ int x, int y) /* Coordinates within scrollPtr's window. */
{
int length, width, tmp;
@@ -455,7 +453,7 @@ TkpScrollbarPosition(scrollPtr, x, y)
/*
* All of the calculations in this procedure mirror those in
- * TkpDisplayScrollbar. Be sure to keep the two consistent.
+ * TkpDisplayScrollbar. Be sure to keep the two consistent.
*/
if (y < (scrollPtr->inset + scrollPtr->arrowLength)) {
@@ -472,3 +470,11 @@ TkpScrollbarPosition(scrollPtr, x, y)
}
return BOTTOM_GAP;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 5eedd5d..060fdd1 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -1,13 +1,12 @@
-/*
+/*
* tkUnixSelect.c --
*
- * This file contains X specific routines for manipulating
- * selections.
+ * This file contains X specific routines for manipulating selections.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
@@ -18,7 +17,7 @@ typedef struct ConvertInfo {
* for the next chunk; -1 means all data has
* been transferred for this conversion. -2
* means only the final zero-length transfer
- * still has to be done. Otherwise it is the
+ * still has to be done. Otherwise it is the
* offset of the next chunk of data to
* transfer. */
Tcl_EncodingState state; /* The encoding state needed across chunks. */
@@ -27,84 +26,81 @@ typedef struct ConvertInfo {
} ConvertInfo;
/*
- * When handling INCR-style selection retrievals, the selection owner
- * uses the following data structure to communicate between the
- * ConvertSelection procedure and TkSelPropProc.
+ * When handling INCR-style selection retrievals, the selection owner uses the
+ * following data structure to communicate between the ConvertSelection
+ * function and TkSelPropProc.
*/
typedef struct IncrInfo {
TkWindow *winPtr; /* Window that owns selection. */
Atom selection; /* Selection that is being retrieved. */
- Atom *multAtoms; /* Information about conversions to
- * perform: one or more pairs of
- * (target, property). This either
- * points to a retrieved property (for
- * MULTIPLE retrievals) or to a static
+ Atom *multAtoms; /* Information about conversions to perform:
+ * one or more pairs of (target, property).
+ * This either points to a retrieved property
+ * (for MULTIPLE retrievals) or to a static
* array. */
unsigned long numConversions;
- /* Number of entries in converts (same as
- * # of pairs in multAtoms). */
- ConvertInfo *converts; /* One entry for each pair in multAtoms.
- * This array is malloc-ed. */
+ /* Number of entries in converts (same as # of
+ * pairs in multAtoms). */
+ ConvertInfo *converts; /* One entry for each pair in multAtoms. This
+ * array is malloc-ed. */
char **tempBufs; /* One pointer for each pair in multAtoms;
* each pointer is either NULL, or it points
* to a small bit of character data that was
* left over from the previous chunk. */
- Tcl_EncodingState *state; /* One state info per pair in multAtoms:
- * State info for encoding conversions
- * that span multiple buffers. */
+ Tcl_EncodingState *state; /* One state info per pair in multAtoms: State
+ * info for encoding conversions that span
+ * multiple buffers. */
int *flags; /* One state flag per pair in multAtoms:
* Encoding flags, set to TCL_ENCODING_START
* at the beginning of an INCR transfer. */
- int numIncrs; /* Number of entries in converts that
- * aren't -1 (i.e. # of INCR-mode transfers
- * not yet completed). */
- Tcl_TimerToken timeout; /* Token for timer procedure. */
- int idleTime; /* Number of seconds since we heard
- * anything from the selection
- * requestor. */
+ int numIncrs; /* Number of entries in converts that aren't
+ * -1 (i.e. # of INCR-mode transfers not yet
+ * completed). */
+ Tcl_TimerToken timeout; /* Token for timer function. */
+ int idleTime; /* Number of seconds since we heard anything
+ * from the selection requestor. */
Window reqWindow; /* Requestor's window id. */
- Time time; /* Timestamp corresponding to
- * selection at beginning of request;
- * used to abort transfer if selection
- * changes. */
- struct IncrInfo *nextPtr; /* Next in list of all INCR-style
- * retrievals currently pending. */
+ Time time; /* Timestamp corresponding to selection at
+ * beginning of request; used to abort
+ * transfer if selection changes. */
+ struct IncrInfo *nextPtr; /* Next in list of all INCR-style retrievals
+ * currently pending. */
} IncrInfo;
-
typedef struct ThreadSpecificData {
- IncrInfo *pendingIncrs; /* List of all incr structures
- * currently active. */
+ IncrInfo *pendingIncrs; /* List of all incr structures currently
+ * active. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Largest property that we'll accept when sending or receiving the
- * selection:
+ * Largest property that we'll accept when sending or receiving the selection:
*/
#define MAX_PROP_WORDS 100000
static TkSelRetrievalInfo *pendingRetrievals = NULL;
- /* List of all retrievals currently
- * being waited for. */
+ /* List of all retrievals currently being
+ * waited for. */
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void ConvertSelection _ANSI_ARGS_((TkWindow *winPtr,
- XSelectionRequestEvent *eventPtr));
-static void IncrTimeoutProc _ANSI_ARGS_((ClientData clientData));
-static void SelCvtFromX _ANSI_ARGS_((long *propPtr, int numValues,
- Atom type, Tk_Window tkwin, Tcl_DString *dsPtr));
-static long * SelCvtToX _ANSI_ARGS_((char *string, Atom type,
- Tk_Window tkwin, int *numLongsPtr));
-static int SelectionSize _ANSI_ARGS_((TkSelHandler *selPtr));
-static void SelRcvIncrProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void SelTimeoutProc _ANSI_ARGS_((ClientData clientData));
+static void ConvertSelection(TkWindow *winPtr,
+ XSelectionRequestEvent *eventPtr);
+static void IncrTimeoutProc(ClientData clientData);
+static void SelCvtFromX32(long *propPtr, int numValues, Atom type,
+ Tk_Window tkwin, Tcl_DString *dsPtr);
+static void SelCvtFromX8(char *propPtr, int numValues, Atom type,
+ Tk_Window tkwin, Tcl_DString *dsPtr);
+static long * SelCvtToX(char *string, Atom type, Tk_Window tkwin,
+ int *numLongsPtr);
+static int SelectionSize(TkSelHandler *selPtr);
+static void SelRcvIncrProc(ClientData clientData,
+ XEvent *eventPtr);
+static void SelTimeoutProc(ClientData clientData);
/*
*----------------------------------------------------------------------
@@ -114,9 +110,9 @@ static void SelTimeoutProc _ANSI_ARGS_((ClientData clientData));
* Retrieve the specified selection from another process.
*
* Results:
- * The return value is a standard Tcl return value.
- * If an error occurs (such as no selection exists)
- * then an error message is left in the interp's result.
+ * The return value is a standard Tcl return value. If an error occurs
+ * (such as no selection exists) then an error message is left in the
+ * interp's result.
*
* Side effects:
* None.
@@ -125,27 +121,26 @@ static void SelTimeoutProc _ANSI_ARGS_((ClientData clientData));
*/
int
-TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
- Tcl_Interp *interp; /* Interpreter to use for reporting
- * errors. */
- Tk_Window tkwin; /* Window on whose behalf to retrieve
- * the selection (determines display
- * from which to retrieve). */
- Atom selection; /* Selection to retrieve. */
- Atom target; /* Desired form in which selection
- * is to be returned. */
- Tk_GetSelProc *proc; /* Procedure to call to process the
- * selection, once it has been retrieved. */
- ClientData clientData; /* Arbitrary value to pass to proc. */
+TkSelGetSelection(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tk_Window tkwin, /* Window on whose behalf to retrieve the
+ * selection (determines display from which to
+ * retrieve). */
+ Atom selection, /* Selection to retrieve. */
+ Atom target, /* Desired form in which selection is to be
+ * returned. */
+ Tk_GetSelProc *proc, /* Function to call to process the selection,
+ * once it has been retrieved. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
{
TkSelRetrievalInfo retr;
TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
/*
- * The selection is owned by some other process. To
- * retrieve it, first record information about the retrieval
- * in progress. Use an internal window as the requestor.
+ * The selection is owned by some other process. To retrieve it, first
+ * record information about the retrieval in progress. Use an internal
+ * window as the requestor.
*/
retr.interp = interp;
@@ -171,20 +166,20 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
pendingRetrievals = &retr;
/*
- * Initiate the request for the selection. Note: can't use
- * TkCurrentTime for the time. If we do, and this application hasn't
- * received any X events in a long time, the current time will be way
- * in the past and could even predate the time when the selection was
- * made; if this happens, the request will be rejected.
+ * Initiate the request for the selection. Note: can't use TkCurrentTime
+ * for the time. If we do, and this application hasn't received any X
+ * events in a long time, the current time will be way in the past and
+ * could even predate the time when the selection was made; if this
+ * happens, the request will be rejected.
*/
XConvertSelection(winPtr->display, retr.selection, retr.target,
retr.property, retr.winPtr->window, CurrentTime);
/*
- * Enter a loop processing X events until the selection
- * has been retrieved and processed. If no response is
- * received within a few seconds, then timeout.
+ * Enter a loop processing X events until the selection has been retrieved
+ * and processed. If no response is received within a few seconds, then
+ * timeout.
*/
retr.timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc,
@@ -195,8 +190,7 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
Tcl_DeleteTimerHandler(retr.timeout);
/*
- * Unregister the information about the selection retrieval
- * in progress.
+ * Unregister the information about the selection retrieval in progress.
*/
if (pendingRetrievals == &retr) {
@@ -221,42 +215,41 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
*
* TkSelPropProc --
*
- * This procedure is invoked when property-change events
- * occur on windows not known to the toolkit. Its function
- * is to implement the sending side of the INCR selection
- * retrieval protocol when the selection requestor deletes
- * the property containing a part of the selection.
+ * This function is invoked when property-change events occur on windows
+ * not known to the toolkit. Its function is to implement the sending
+ * side of the INCR selection retrieval protocol when the selection
+ * requestor deletes the property containing a part of the selection.
*
* Results:
* None.
*
* Side effects:
- * If the property that is receiving the selection was just
- * deleted, then a new piece of the selection is fetched and
- * placed in the property, until eventually there's no more
- * selection to fetch.
+ * If the property that is receiving the selection was just deleted, then
+ * a new piece of the selection is fetched and placed in the property,
+ * until eventually there's no more selection to fetch.
*
*----------------------------------------------------------------------
*/
void
-TkSelPropProc(eventPtr)
- register XEvent *eventPtr; /* X PropertyChange event. */
+TkSelPropProc(
+ register XEvent *eventPtr) /* X PropertyChange event. */
{
register IncrInfo *incrPtr;
register TkSelHandler *selPtr;
- int i, length, numItems;
+ int length, numItems;
+ unsigned long i;
Atom target, formatType;
long buffer[TK_SEL_WORDS_AT_ONCE];
TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display);
Tk_ErrorHandler errorHandler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * See if this event announces the deletion of a property being
- * used for an INCR transfer. If so, then add the next chunk of
- * data to the property.
+ * See if this event announces the deletion of a property being used for
+ * an INCR transfer. If so, then add the next chunk of data to the
+ * property.
*/
if (eventPtr->xproperty.state != PropertyDelete) {
@@ -269,9 +262,9 @@ TkSelPropProc(eventPtr)
}
/*
- * For each conversion that has been requested, handle any
- * chunks that haven't been transmitted yet.
- */
+ * For each conversion that has been requested, handle any chunks that
+ * haven't been transmitted yet.
+ */
for (i = 0; i < incrPtr->numConversions; i++) {
if ((eventPtr->xproperty.atom != incrPtr->multAtoms[2*i + 1])
@@ -310,28 +303,29 @@ TkSelPropProc(eventPtr)
formatType = selPtr->format;
if (incrPtr->converts[i].offset == -2) {
/*
- * We already got the last chunk, so send a null chunk
- * to indicate that we are finished.
+ * We already got the last chunk, so send a null chunk to
+ * indicate that we are finished.
*/
numItems = 0;
length = 0;
} else {
TkSelInProgress ip;
+
ip.selPtr = selPtr;
ip.nextPtr = TkSelGetInProgress();
TkSelSetInProgress(&ip);
/*
- * Copy any bytes left over from a partial character at the end
- * of the previous chunk into the beginning of the buffer.
+ * Copy any bytes left over from a partial character at the
+ * end of the previous chunk into the beginning of the buffer.
* Pass the rest of the buffer space into the selection
* handler.
*/
length = strlen(incrPtr->converts[i].buffer);
strcpy((char *)buffer, incrPtr->converts[i].buffer);
-
+
numItems = (*selPtr->proc)(selPtr->clientData,
incrPtr->converts[i].offset,
((char *) buffer) + length,
@@ -349,13 +343,14 @@ TkSelPropProc(eventPtr)
}
numItems += length;
if (numItems > TK_SEL_BYTES_AT_ONCE) {
- panic("selection handler returned too many bytes");
+ Tcl_Panic("selection handler returned too many bytes");
}
}
((char *) buffer)[numItems] = 0;
errorHandler = Tk_CreateErrorHandler(eventPtr->xproperty.display,
- -1, -1, -1, (int (*)()) NULL, (ClientData) NULL);
+ -1, -1, -1, (int (*)()) NULL, NULL);
+
/*
* Encode the data using the proper format for each type.
*/
@@ -401,14 +396,13 @@ TkSelPropProc(eventPtr)
/*
- * Now convert the data, growing the destination buffer
- * as needed.
+ * Now convert the data, growing the destination buffer as
+ * needed.
*/
while (1) {
- result = Tcl_UtfToExternal(NULL, encoding,
- src, srcLen, encodingCvtFlags,
- &incrPtr->converts[i].state,
+ result = Tcl_UtfToExternal(NULL, encoding, src, srcLen,
+ encodingCvtFlags, &incrPtr->converts[i].state,
dst, dstLen, &srcRead, &dstWrote, NULL);
soFar = dst + dstWrote - Tcl_DStringValue(&ds);
encodingCvtFlags &= ~TCL_ENCODING_START;
@@ -446,7 +440,7 @@ TkSelPropProc(eventPtr)
*/
if (srcLen > TCL_UTF_MAX) {
- panic("selection conversion left too many bytes unconverted");
+ Tcl_Panic("selection conversion left too many bytes unconverted");
}
memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1);
Tcl_DStringFree(&ds);
@@ -456,8 +450,7 @@ TkSelPropProc(eventPtr)
*/
char *propPtr = (char *) SelCvtToX((char *) buffer,
- formatType, (Tk_Window) incrPtr->winPtr,
- &numItems);
+ formatType, (Tk_Window) incrPtr->winPtr, &numItems);
if (propPtr == NULL) {
numItems = 0;
@@ -473,9 +466,9 @@ TkSelPropProc(eventPtr)
Tk_DeleteErrorHandler(errorHandler);
/*
- * Compute the next offset value. If this was the last chunk,
- * then set the offset to -2. If this was an empty chunk,
- * then set the offset to -1 to indicate we are done.
+ * Compute the next offset value. If this was the last chunk, then
+ * set the offset to -2. If this was an empty chunk, then set the
+ * offset to -1 to indicate we are done.
*/
if (numItems < TK_SEL_BYTES_AT_ONCE) {
@@ -487,10 +480,10 @@ TkSelPropProc(eventPtr)
}
} else {
/*
- * Advance over the selection data that was consumed
- * this time.
+ * Advance over the selection data that was consumed this
+ * time.
*/
-
+
incrPtr->converts[i].offset += numItems - length;
}
return;
@@ -503,26 +496,24 @@ TkSelPropProc(eventPtr)
*
* TkSelEventProc --
*
- * This procedure is invoked whenever a selection-related
- * event occurs. It does the lion's share of the work
- * in implementing the selection protocol.
+ * This function is invoked whenever a selection-related event occurs.
+ * It does the lion's share of the work in implementing the selection
+ * protocol.
*
* Results:
* None.
*
* Side effects:
- * Lots: depends on the type of event.
+ * Lots: depends on the type of event.
*
*--------------------------------------------------------------
*/
void
-TkSelEventProc(tkwin, eventPtr)
- Tk_Window tkwin; /* Window for which event was
- * targeted. */
- register XEvent *eventPtr; /* X event: either SelectionClear,
- * SelectionRequest, or
- * SelectionNotify. */
+TkSelEventProc(
+ Tk_Window tkwin, /* Window for which event was targeted. */
+ register XEvent *eventPtr) /* X event: either SelectionClear,
+ * SelectionRequest, or SelectionNotify. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -537,13 +528,13 @@ TkSelEventProc(tkwin, eventPtr)
}
/*
- * Case #2: SelectionNotify events. Call the relevant procedure
- * to handle the incoming selection.
+ * Case #2: SelectionNotify events. Call the relevant function to handle
+ * the incoming selection.
*/
if (eventPtr->type == SelectionNotify) {
register TkSelRetrievalInfo *retrPtr;
- char *propInfo;
+ char *propInfo, **propInfoPtr = &propInfo;
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
@@ -561,12 +552,12 @@ TkSelEventProc(tkwin, eventPtr)
break;
}
if (eventPtr->xselection.property == None) {
- Tcl_SetResult(retrPtr->interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(retrPtr->interp, NULL, TCL_STATIC);
Tcl_AppendResult(retrPtr->interp,
Tk_GetAtomName(tkwin, retrPtr->selection),
" selection doesn't exist or form \"",
Tk_GetAtomName(tkwin, retrPtr->target),
- "\" not defined", (char *) NULL);
+ "\" not defined", NULL);
retrPtr->result = TCL_ERROR;
return;
}
@@ -578,13 +569,13 @@ TkSelEventProc(tkwin, eventPtr)
eventPtr->xselection.requestor, retrPtr->property,
0, MAX_PROP_WORDS, False, (Atom) AnyPropertyType,
&type, &format, &numItems, &bytesAfter,
- (unsigned char **) &propInfo);
+ (unsigned char **) propInfoPtr);
if ((result != Success) || (type == None)) {
return;
}
if (bytesAfter != 0) {
Tcl_SetResult(retrPtr->interp, "selection property too large",
- TCL_STATIC);
+ TCL_STATIC);
retrPtr->result = TCL_ERROR;
XFree(propInfo);
return;
@@ -595,25 +586,25 @@ TkSelEventProc(tkwin, eventPtr)
if (format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
+ sprintf(buf,
"bad format for string selection: wanted \"8\", got \"%d\"",
format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
return;
}
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ interp = retrPtr->interp;
+ Tcl_Preserve((ClientData) interp);
/*
- * Convert the X selection data into UTF before passing it
- * to the selection callback. Note that the COMPOUND_TEXT
- * uses a modified iso2022 encoding, not the current system
- * encoding. For now we'll just blindly apply the iso2022
- * encoding. This is probably wrong, but it's a placeholder
- * until we figure out what we're really supposed to do. For
- * STRING, we need to use Latin-1 instead. Again, it's not
- * really the full iso8859-1 space, but this is close enough.
+ * Convert the X selection data into UTF before passing it to the
+ * selection callback. Note that the COMPOUND_TEXT uses a modified
+ * iso2022 encoding, not the current system encoding. For now
+ * we'll just blindly apply the iso2022 encoding. This is probably
+ * wrong, but it's a placeholder until we figure out what we're
+ * really supposed to do. For STRING, we need to use Latin-1
+ * instead. Again, it's not really the full iso8859-1 space, but
+ * this is close enough.
*/
if (type == dispPtr->compoundTextAtom) {
@@ -632,16 +623,17 @@ TkSelEventProc(tkwin, eventPtr)
Tcl_Release((ClientData) interp);
} else if (type == dispPtr->utf8Atom) {
/*
- * The X selection data is in UTF-8 format already.
- * We can't guarantee that propInfo is NULL-terminated,
- * so we might have to copy the string.
+ * The X selection data is in UTF-8 format already. We can't
+ * guarantee that propInfo is NULL-terminated, so we might have to
+ * copy the string.
*/
+
char *propData = propInfo;
if (format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
+ sprintf(buf,
"bad format for string selection: wanted \"8\", got \"%d\"",
format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
@@ -659,13 +651,12 @@ TkSelEventProc(tkwin, eventPtr)
if (propData != propInfo) {
ckfree((char *) propData);
}
- } else if (type == dispPtr->incrAtom) {
+ } else if (type == dispPtr->incrAtom) {
/*
- * It's a !?#@!?!! INCR-style reception. Arrange to receive
- * the selection in pieces, using the ICCCM protocol, then
- * hang around until either the selection is all here or a
- * timeout occurs.
+ * It's a !?#@!?!! INCR-style reception. Arrange to receive the
+ * selection in pieces, using the ICCCM protocol, then hang around
+ * until either the selection is all here or a timeout occurs.
*/
retrPtr->idleTime = 0;
@@ -681,24 +672,28 @@ TkSelEventProc(tkwin, eventPtr)
} else {
Tcl_DString ds;
- if (format != 32) {
+ if (format != 32 && format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
- "bad format for selection: wanted \"32\", got \"%d\"",
- format);
+ sprintf(buf, "bad format for selection: wanted \"32\" or "
+ "\"8\", got \"%d\"", format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
return;
}
Tcl_DStringInit(&ds);
- SelCvtFromX((long *) propInfo, (int) numItems, type,
- (Tk_Window) winPtr, &ds);
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ if (format == 32) {
+ SelCvtFromX32((long *) propInfo, (int) numItems, type,
+ (Tk_Window) winPtr, &ds);
+ } else {
+ SelCvtFromX8((char *) propInfo, (int) numItems, type,
+ (Tk_Window) winPtr, &ds);
+ }
+ interp = retrPtr->interp;
+ Tcl_Preserve((ClientData) interp);
retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
interp, Tcl_DStringValue(&ds));
- Tcl_Release((ClientData) interp);
+ Tcl_Release((ClientData) interp);
Tcl_DStringFree(&ds);
}
XFree(propInfo);
@@ -706,8 +701,8 @@ TkSelEventProc(tkwin, eventPtr)
}
/*
- * Case #3: SelectionRequest events. Call ConvertSelection to
- * do the dirty work.
+ * Case #3: SelectionRequest events. Call ConvertSelection to do the dirty
+ * work.
*/
if (eventPtr->type == SelectionRequest) {
@@ -721,32 +716,30 @@ TkSelEventProc(tkwin, eventPtr)
*
* SelTimeoutProc --
*
- * This procedure is invoked once every second while waiting for
- * the selection to be returned. After a while it gives up and
- * aborts the selection retrieval.
+ * This function is invoked once every second while waiting for the
+ * selection to be returned. After a while it gives up and aborts the
+ * selection retrieval.
*
* Results:
* None.
*
* Side effects:
- * A new timer callback is created to call us again in another
- * second, unless time has expired, in which case an error is
- * recorded for the retrieval.
+ * A new timer callback is created to call us again in another second,
+ * unless time has expired, in which case an error is recorded for the
+ * retrieval.
*
*----------------------------------------------------------------------
*/
static void
-SelTimeoutProc(clientData)
- ClientData clientData; /* Information about retrieval
- * in progress. */
+SelTimeoutProc(
+ ClientData clientData) /* Information about retrieval in progress. */
{
register TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *) clientData;
/*
- * Make sure that the retrieval is still in progress. Then
- * see how long it's been since any sort of response was received
- * from the other side.
+ * Make sure that the retrieval is still in progress. Then see how long
+ * it's been since any sort of response was received from the other side.
*/
if (retrPtr->result != -1) {
@@ -754,10 +747,9 @@ SelTimeoutProc(clientData)
}
retrPtr->idleTime++;
if (retrPtr->idleTime >= 5) {
-
/*
- * Use a careful procedure to store the error message, because
- * the result could already be partially filled in with a partial
+ * Use a careful function to store the error message, because the
+ * result could already be partially filled in with a partial
* selection return.
*/
@@ -766,7 +758,7 @@ SelTimeoutProc(clientData)
retrPtr->result = TCL_ERROR;
} else {
retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc,
- (ClientData) retrPtr);
+ (ClientData) retrPtr);
}
}
@@ -775,46 +767,46 @@ SelTimeoutProc(clientData)
*
* ConvertSelection --
*
- * This procedure is invoked to handle SelectionRequest events.
- * It responds to the requests, obeying the ICCCM protocols.
+ * This function is invoked to handle SelectionRequest events. It
+ * responds to the requests, obeying the ICCCM protocols.
*
* Results:
* None.
*
* Side effects:
* Properties are created for the selection requestor, and a
- * SelectionNotify event is generated for the selection
- * requestor. In the event of long selections, this procedure
- * implements INCR-mode transfers, using the ICCCM protocol.
+ * SelectionNotify event is generated for the selection requestor. In the
+ * event of long selections, this function implements INCR-mode
+ * transfers, using the ICCCM protocol.
*
*----------------------------------------------------------------------
*/
static void
-ConvertSelection(winPtr, eventPtr)
- TkWindow *winPtr; /* Window that received the
- * conversion request; may not be
- * selection's current owner, be we
- * set it to the current owner. */
- register XSelectionRequestEvent *eventPtr;
- /* Event describing request. */
+ConvertSelection(
+ TkWindow *winPtr, /* Window that received the conversion
+ * request; may not be selection's current
+ * owner, be we set it to the current
+ * owner. */
+ register XSelectionRequestEvent *eventPtr)
+ /* Event describing request. */
{
- XSelectionEvent reply; /* Used to notify requestor that
- * selection info is ready. */
- int multiple; /* Non-zero means a MULTIPLE request
- * is being handled. */
- IncrInfo incr; /* State of selection conversion. */
- Atom singleInfo[2]; /* incr.multAtoms points here except
- * for multiple conversions. */
- int i;
+ XSelectionEvent reply; /* Used to notify requestor that selection
+ * info is ready. */
+ int multiple; /* Non-zero means a MULTIPLE request is being
+ * handled. */
+ IncrInfo incr; /* State of selection conversion. */
+ Atom singleInfo[2]; /* incr.multAtoms points here except for
+ * multiple conversions. */
+ unsigned long i;
Tk_ErrorHandler errorHandler;
TkSelectionInfo *infoPtr;
TkSelInProgress ip;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1,
- (int (*)()) NULL, (ClientData) NULL);
+ (int (*)()) NULL, NULL);
/*
* Initialize the reply event.
@@ -835,8 +827,9 @@ ConvertSelection(winPtr, eventPtr)
for (infoPtr = winPtr->dispPtr->selectionInfoPtr; infoPtr != NULL;
infoPtr = infoPtr->nextPtr) {
- if (infoPtr->selection == eventPtr->selection)
+ if (infoPtr->selection == eventPtr->selection) {
break;
+ }
}
if (infoPtr == NULL) {
goto refuse;
@@ -844,8 +837,8 @@ ConvertSelection(winPtr, eventPtr)
winPtr = (TkWindow *) infoPtr->owner;
/*
- * Figure out which kind(s) of conversion to perform. If handling
- * a MULTIPLE conversion, then read the property describing which
+ * Figure out which kind(s) of conversion to perform. If handling a
+ * MULTIPLE conversion, then read the property describing which
* conversions to perform.
*/
@@ -858,7 +851,7 @@ ConvertSelection(winPtr, eventPtr)
incr.multAtoms = singleInfo;
incr.numConversions = 1;
} else {
- Atom type;
+ Atom type, **multAtomsPtr = &incr.multAtoms;
int format, result;
unsigned long bytesAfter;
@@ -867,11 +860,10 @@ ConvertSelection(winPtr, eventPtr)
if (eventPtr->property == None) {
goto refuse;
}
- result = XGetWindowProperty(eventPtr->display,
- eventPtr->requestor, eventPtr->property,
- 0, MAX_PROP_WORDS, False, XA_ATOM,
+ result = XGetWindowProperty(eventPtr->display, eventPtr->requestor,
+ eventPtr->property, 0, MAX_PROP_WORDS, False, XA_ATOM,
&type, &format, &incr.numConversions, &bytesAfter,
- (unsigned char **) &incr.multAtoms);
+ (unsigned char **) multAtomsPtr);
if ((result != Success) || (bytesAfter != 0) || (format != 32)
|| (type == None)) {
if (incr.multAtoms != NULL) {
@@ -883,14 +875,14 @@ ConvertSelection(winPtr, eventPtr)
}
/*
- * Loop through all of the requested conversions, and either return
- * the entire converted selection, if it can be returned in a single
- * bunch, or return INCR information only (the actual selection will
- * be returned below).
+ * Loop through all of the requested conversions, and either return the
+ * entire converted selection, if it can be returned in a single bunch, or
+ * return INCR information only (the actual selection will be returned
+ * below).
*/
- incr.converts = (ConvertInfo *) ckalloc((unsigned)
- (incr.numConversions*sizeof(ConvertInfo)));
+ incr.converts = (ConvertInfo *)
+ ckalloc((unsigned) incr.numConversions * sizeof(ConvertInfo));
incr.numIncrs = 0;
for (i = 0; i < incr.numConversions; i++) {
Atom target, property, type;
@@ -914,9 +906,9 @@ ConvertSelection(winPtr, eventPtr)
if (selPtr == NULL) {
/*
- * Nobody seems to know about this kind of request. If
- * it's of a sort that we can handle without any help, do
- * it. Otherwise mark the request as an errror.
+ * Nobody seems to know about this kind of request. If it's of a
+ * sort that we can handle without any help, do it. Otherwise mark
+ * the request as an errror.
*/
numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer,
@@ -938,19 +930,19 @@ ConvertSelection(winPtr, eventPtr)
continue;
}
if (numItems > TK_SEL_BYTES_AT_ONCE) {
- panic("selection handler returned too many bytes");
+ Tcl_Panic("selection handler returned too many bytes");
}
((char *) buffer)[numItems] = '\0';
}
/*
- * Got the selection; store it back on the requestor's property.
+ * Got the selection; store it back on the requestor's property.
*/
if (numItems == TK_SEL_BYTES_AT_ONCE) {
/*
- * Selection is too big to send at once; start an
- * INCR-mode transfer.
+ * Selection is too big to send at once; start an INCR-mode
+ * transfer.
*/
incr.numIncrs++;
@@ -969,33 +961,31 @@ ConvertSelection(winPtr, eventPtr)
(unsigned char *) propPtr, numItems);
} else if (type == winPtr->dispPtr->utf8Atom) {
/*
- * This matches selection requests of type UTF8_STRING,
- * which allows us to pass our utf-8 information untouched.
+ * This matches selection requests of type UTF8_STRING, which
+ * allows us to pass our utf-8 information untouched.
*/
- XChangeProperty(reply.display, reply.requestor,
- property, type, 8, PropModeReplace,
- (unsigned char *) buffer, numItems);
+ XChangeProperty(reply.display, reply.requestor, property, type, 8,
+ PropModeReplace, (unsigned char *) buffer, numItems);
} else if ((type == XA_STRING)
|| (type == winPtr->dispPtr->compoundTextAtom)) {
Tcl_DString ds;
Tcl_Encoding encoding;
/*
- * STRING is Latin-1, COMPOUND_TEXT is an iso2022 variant.
- * We need to convert the selection text into these external
- * forms before modifying the property.
+ * STRING is Latin-1, COMPOUND_TEXT is an iso2022 variant. We need
+ * to convert the selection text into these external forms before
+ * modifying the property.
*/
if (type == XA_STRING) {
encoding = Tcl_GetEncoding(NULL, "iso8859-1");
} else {
encoding = Tcl_GetEncoding(NULL, "iso2022");
- }
- Tcl_UtfToExternalDString(encoding, (char*)buffer, -1, &ds);
- XChangeProperty(reply.display, reply.requestor,
- property, type, 8, PropModeReplace,
- (unsigned char *) Tcl_DStringValue(&ds),
+ }
+ Tcl_UtfToExternalDString(encoding, (char *) buffer, -1, &ds);
+ XChangeProperty(reply.display, reply.requestor, property, type, 8,
+ PropModeReplace, (unsigned char *) Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
if (encoding) {
Tcl_FreeEncoding(encoding);
@@ -1008,18 +998,17 @@ ConvertSelection(winPtr, eventPtr)
goto refuse;
}
format = 32;
- XChangeProperty(reply.display, reply.requestor,
- property, type, format, PropModeReplace,
- (unsigned char *) propPtr, numItems);
+ XChangeProperty(reply.display, reply.requestor, property, type,
+ format, PropModeReplace, (unsigned char *) propPtr,
+ numItems);
ckfree(propPtr);
}
}
/*
- * Send an event back to the requestor to indicate that the
- * first stage of conversion is complete (everything is done
- * except for long conversions that have to be done in INCR
- * mode).
+ * Send an event back to the requestor to indicate that the first stage of
+ * conversion is complete (everything is done except for long conversions
+ * that have to be done in INCR mode).
*/
if (incr.numIncrs > 0) {
@@ -1038,10 +1027,9 @@ ConvertSelection(winPtr, eventPtr)
(unsigned char *) incr.multAtoms,
(int) incr.numConversions*2);
} else {
-
/*
- * Not a MULTIPLE request. The first property in "multAtoms"
- * got set to None if there was an error in conversion.
+ * Not a MULTIPLE request. The first property in "multAtoms" got set
+ * to None if there was an error in conversion.
*/
reply.property = incr.multAtoms[1];
@@ -1050,9 +1038,9 @@ ConvertSelection(winPtr, eventPtr)
Tk_DeleteErrorHandler(errorHandler);
/*
- * Handle any remaining INCR-mode transfers. This all happens
- * in callbacks to TkSelPropProc, so just wait until the number
- * of uncompleted INCR transfers drops to zero.
+ * Handle any remaining INCR-mode transfers. This all happens in callbacks
+ * to TkSelPropProc, so just wait until the number of uncompleted INCR
+ * transfers drops to zero.
*/
if (incr.numIncrs > 0) {
@@ -1063,7 +1051,7 @@ ConvertSelection(winPtr, eventPtr)
}
Tcl_DeleteTimerHandler(incr.timeout);
errorHandler = Tk_CreateErrorHandler(winPtr->display,
- -1, -1,-1, (int (*)()) NULL, (ClientData) NULL);
+ -1, -1,-1, (int (*)()) NULL, NULL);
XSelectInput(reply.display, reply.requestor, 0L);
Tk_DeleteErrorHandler(errorHandler);
if (tsdPtr->pendingIncrs == &incr) {
@@ -1080,7 +1068,7 @@ ConvertSelection(winPtr, eventPtr)
}
/*
- * All done. Cleanup and return.
+ * All done. Cleanup and return.
*/
ckfree((char *) incr.converts);
@@ -1090,10 +1078,10 @@ ConvertSelection(winPtr, eventPtr)
return;
/*
- * An error occurred. Send back a refusal message.
+ * An error occurred. Send back a refusal message.
*/
- refuse:
+ refuse:
reply.property = None;
XSendEvent(reply.display, reply.requestor, False, 0, (XEvent *) &reply);
Tk_DeleteErrorHandler(errorHandler);
@@ -1105,30 +1093,28 @@ ConvertSelection(winPtr, eventPtr)
*
* SelRcvIncrProc --
*
- * This procedure handles the INCR protocol on the receiving
- * side. It is invoked in response to property changes on
- * the requestor's window (which hopefully are because a new
- * chunk of the selection arrived).
+ * This function handles the INCR protocol on the receiving side. It is
+ * invoked in response to property changes on the requestor's window
+ * (which hopefully are because a new chunk of the selection arrived).
*
* Results:
* None.
*
* Side effects:
- * If a new piece of selection has arrived, a procedure is
- * invoked to deal with that piece. When the whole selection
- * is here, a flag is left for the higher-level procedure that
- * initiated the selection retrieval.
+ * If a new piece of selection has arrived, a function is invoked to deal
+ * with that piece. When the whole selection is here, a flag is left for
+ * the higher-level function that initiated the selection retrieval.
*
*----------------------------------------------------------------------
*/
static void
-SelRcvIncrProc(clientData, eventPtr)
- ClientData clientData; /* Information about retrieval. */
- register XEvent *eventPtr; /* X PropertyChange event. */
+SelRcvIncrProc(
+ ClientData clientData, /* Information about retrieval. */
+ register XEvent *eventPtr) /* X PropertyChange event. */
{
register TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *) clientData;
- char *propInfo;
+ char *propInfo, **propInfoPtr = &propInfo;
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
@@ -1143,7 +1129,7 @@ SelRcvIncrProc(clientData, eventPtr)
result = XGetWindowProperty(eventPtr->xproperty.display,
eventPtr->xproperty.window, retrPtr->property, 0, MAX_PROP_WORDS,
True, (Atom) AnyPropertyType, &type, &format, &numItems,
- &bytesAfter, (unsigned char **) &propInfo);
+ &bytesAfter, (unsigned char **) propInfoPtr);
if ((result != Success) || (type == None)) {
return;
}
@@ -1164,16 +1150,16 @@ SelRcvIncrProc(clientData, eventPtr)
if (format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf,
+
+ sprintf(buf,
"bad format for string selection: wanted \"8\", got \"%d\"",
format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
goto done;
}
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ interp = retrPtr->interp;
+ Tcl_Preserve((ClientData) interp);
if (type == retrPtr->winPtr->dispPtr->compoundTextAtom) {
encoding = Tcl_GetEncoding(NULL, "iso2022");
@@ -1185,8 +1171,8 @@ SelRcvIncrProc(clientData, eventPtr)
/*
* Check to see if there is any data left over from the previous
- * chunk. If there is, copy the old data and the new data into
- * a new buffer.
+ * chunk. If there is, copy the old data and the new data into a new
+ * buffer.
*/
Tcl_DStringInit(&temp);
@@ -1210,10 +1196,10 @@ SelRcvIncrProc(clientData, eventPtr)
src = propInfo;
srcLen = numItems;
}
-
+
/*
- * Set up the destination buffer so we can use as much space as
- * is available.
+ * Set up the destination buffer so we can use as much space as is
+ * available.
*/
dstPtr = &retrPtr->buf;
@@ -1247,11 +1233,11 @@ SelRcvIncrProc(clientData, eventPtr)
result = (*retrPtr->proc)(retrPtr->clientData, interp,
Tcl_DStringValue(dstPtr));
- Tcl_Release((ClientData) interp);
+ Tcl_Release((ClientData) interp);
/*
- * Copy any unused data into the destination buffer so we can
- * pick it up next time around.
+ * Copy any unused data into the destination buffer so we can pick it
+ * up next time around.
*/
Tcl_DStringSetLength(dstPtr, 0);
@@ -1269,24 +1255,28 @@ SelRcvIncrProc(clientData, eventPtr)
} else {
Tcl_DString ds;
- if (format != 32) {
+ if (format != 32 && format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
- "bad format for selection: wanted \"32\", got \"%d\"",
- format);
+ sprintf(buf, "bad format for selection: wanted \"32\" or "
+ "\"8\", got \"%d\"", format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
goto done;
}
Tcl_DStringInit(&ds);
- SelCvtFromX((long *) propInfo, (int) numItems, type,
- (Tk_Window) retrPtr->winPtr, &ds);
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ if (format == 32) {
+ SelCvtFromX32((long *) propInfo, (int) numItems, type,
+ (Tk_Window) retrPtr->winPtr, &ds);
+ } else {
+ SelCvtFromX8((char *) propInfo, (int) numItems, type,
+ (Tk_Window) retrPtr->winPtr, &ds);
+ }
+ interp = retrPtr->interp;
+ Tcl_Preserve((ClientData) interp);
result = (*retrPtr->proc)(retrPtr->clientData, interp,
Tcl_DStringValue(&ds));
- Tcl_Release((ClientData) interp);
+ Tcl_Release((ClientData) interp);
Tcl_DStringFree(&ds);
if (result != TCL_OK) {
retrPtr->result = result;
@@ -1303,25 +1293,24 @@ SelRcvIncrProc(clientData, eventPtr)
*
* SelectionSize --
*
- * This procedure is called when the selection is too large to
- * send in a single buffer; it computes the total length of
- * the selection in bytes.
+ * This function is called when the selection is too large to send in a
+ * single buffer; it computes the total length of the selection in bytes.
*
* Results:
- * The return value is the number of bytes in the selection
- * given by selPtr.
+ * The return value is the number of bytes in the selection given by
+ * selPtr.
*
* Side effects:
- * The selection is retrieved from its current owner (this is
- * the only way to compute its size).
+ * The selection is retrieved from its current owner (this is the only
+ * way to compute its size).
*
*----------------------------------------------------------------------
*/
static int
-SelectionSize(selPtr)
- TkSelHandler *selPtr; /* Information about how to retrieve
- * the selection whose size is wanted. */
+SelectionSize(
+ TkSelHandler *selPtr) /* Information about how to retrieve the
+ * selection whose size is wanted. */
{
char buffer[TK_SEL_BYTES_AT_ONCE+1];
int size, chunkSize;
@@ -1331,15 +1320,17 @@ SelectionSize(selPtr)
ip.selPtr = selPtr;
ip.nextPtr = TkSelGetInProgress();
TkSelSetInProgress(&ip);
+
do {
- chunkSize = (*selPtr->proc)(selPtr->clientData, size,
- (char *) buffer, TK_SEL_BYTES_AT_ONCE);
+ chunkSize = (*selPtr->proc)(selPtr->clientData, size, (char *) buffer,
+ TK_SEL_BYTES_AT_ONCE);
if (ip.selPtr == NULL) {
size = 0;
break;
}
size += chunkSize;
} while (chunkSize == TK_SEL_BYTES_AT_ONCE);
+
TkSelSetInProgress(ip.nextPtr);
return size;
}
@@ -1349,26 +1340,26 @@ SelectionSize(selPtr)
*
* IncrTimeoutProc --
*
- * This procedure is invoked once a second while sending the
- * selection to a requestor in INCR mode. After a while it
- * gives up and aborts the selection operation.
+ * This function is invoked once a second while sending the selection to
+ * a requestor in INCR mode. After a while it gives up and aborts the
+ * selection operation.
*
* Results:
* None.
*
* Side effects:
- * A new timeout gets registered so that this procedure gets
- * called again in another second, unless too many seconds
- * have elapsed, in which case incrPtr is marked as "all done".
+ * A new timeout gets registered so that this function gets called again
+ * in another second, unless too many seconds have elapsed, in which case
+ * incrPtr is marked as "all done".
*
*----------------------------------------------------------------------
*/
static void
-IncrTimeoutProc(clientData)
- ClientData clientData; /* Information about INCR-mode
- * selection retrieval for which
- * we are selection owner. */
+IncrTimeoutProc(
+ ClientData clientData) /* Information about INCR-mode selection
+ * retrieval for which we are selection
+ * owner. */
{
register IncrInfo *incrPtr = (IncrInfo *) clientData;
@@ -1387,15 +1378,16 @@ IncrTimeoutProc(clientData)
* SelCvtToX --
*
* Given a selection represented as a string (the normal Tcl form),
- * convert it to the ICCCM-mandated format for X, depending on
- * the type argument. This procedure and SelCvtFromX are inverses.
+ * convert it to the ICCCM-mandated format for X, depending on the type
+ * argument. This function and SelCvtFromX are inverses.
*
* Results:
- * The return value is a malloc'ed buffer holding a value
- * equivalent to "string", but formatted as for "type". It is
- * the caller's responsibility to free the string when done with
- * it. The word at *numLongsPtr is filled in with the number of
- * 32-bit words returned in the result.
+ * The return value is a malloc'ed buffer holding a value equivalent to
+ * "string", but formatted as for "type". It is the caller's
+ * responsibility to free the string when done with it. The word at
+ * *numLongsPtr is filled in with the number of 32-bit words returned in
+ * the result. If NULL is returned, the input list was not actually a
+ * list.
*
* Side effects:
* None.
@@ -1404,14 +1396,14 @@ IncrTimeoutProc(clientData)
*/
static long *
-SelCvtToX(string, type, tkwin, numLongsPtr)
- char *string; /* String representation of selection. */
- Atom type; /* Atom specifying the X format that is
- * desired for the selection. Should not
- * be XA_STRING (if so, don't bother calling
- * this procedure at all). */
- Tk_Window tkwin; /* Window that governs atom conversion. */
- int *numLongsPtr; /* Number of 32-bit words contained in the
+SelCvtToX(
+ char *string, /* String representation of selection. */
+ Atom type, /* Atom specifying the X format that is
+ * desired for the selection. Should not be
+ * XA_STRING (if so, don't bother calling this
+ * function at all). */
+ Tk_Window tkwin, /* Window that governs atom conversion. */
+ int *numLongsPtr) /* Number of 32-bit words contained in the
* result. */
{
const char **field;
@@ -1463,12 +1455,12 @@ SelCvtToX(string, type, tkwin, numLongsPtr)
/*
*----------------------------------------------------------------------
*
- * SelCvtFromX --
+ * SelCvtFromX32, SelCvtFromX8 --
*
- * Given an X property value, formatted as a collection of 32-bit
- * values according to "type" and the ICCCM conventions, convert
- * the value to a string suitable for manipulation by Tcl. This
- * procedure is the inverse of SelCvtToX.
+ * Given an X property value, formatted as a collection of 32-bit or
+ * 8-bit values according to "type" and the ICCCM conventions, convert
+ * the value to a string suitable for manipulation by Tcl. These
+ * functions are the inverse of SelCvtToX.
*
* Results:
* The return value (stored in a Tcl_DString) is the string equivalent of
@@ -1481,14 +1473,14 @@ SelCvtToX(string, type, tkwin, numLongsPtr)
*/
static void
-SelCvtFromX(propPtr, numValues, type, tkwin, dsPtr)
- register long *propPtr; /* Property value from X. */
- int numValues; /* Number of 32-bit values in property. */
- Atom type; /* Type of property Should not be
- * XA_STRING (if so, don't bother calling
- * this procedure at all). */
- Tk_Window tkwin; /* Window to use for atom conversion. */
- Tcl_DString *dsPtr; /* Where to store the converted string. */
+SelCvtFromX32(
+ register long *propPtr, /* Property value from X. */
+ int numValues, /* Number of 32-bit values in property. */
+ Atom type, /* Type of property Should not be XA_STRING
+ * (if so, don't bother calling this function
+ * at all). */
+ Tk_Window tkwin, /* Window to use for atom conversion. */
+ Tcl_DString *dsPtr) /* Where to store the converted string. */
{
/*
* Convert each long in the property to a string value, which is either
@@ -1510,4 +1502,38 @@ SelCvtFromX(propPtr, numValues, type, tkwin, dsPtr)
Tcl_DStringAppendElement(dsPtr, buf);
}
}
+ Tcl_DStringAppend(dsPtr, " ", 1);
}
+
+static void
+SelCvtFromX8(
+ register char *propPtr, /* Property value from X. */
+ int numValues, /* Number of 8-bit values in property. */
+ Atom type, /* Type of property Should not be XA_STRING
+ * (if so, don't bother calling this function
+ * at all). */
+ Tk_Window tkwin, /* Window to use for atom conversion. */
+ Tcl_DString *dsPtr) /* Where to store the converted string. */
+{
+ /*
+ * Convert each long in the property to a string value, which is a
+ * hexadecimal string. We build the list in a Tcl_DString because this is
+ * easier than trying to get the quoting correct ourselves.
+ */
+
+ for ( ; numValues > 0; propPtr++, numValues--) {
+ char buf[12];
+
+ sprintf(buf, "0x%x", (unsigned char) *propPtr);
+ Tcl_DStringAppendElement(dsPtr, buf);
+ }
+ Tcl_DStringAppend(dsPtr, " ", 1);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 2b54506..c073309 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -1,283 +1,267 @@
-/*
+/*
* tkUnixSend.c --
*
- * This file provides procedures that implement the "send"
- * command, allowing commands to be passed from interpreter
- * to interpreter.
+ * This file provides functions that implement the "send" command,
+ * allowing commands to be passed from interpreter to interpreter.
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
-#include "tkInt.h"
#include "tkUnixInt.h"
-/*
+/*
* The following structure is used to keep track of the interpreters
* registered by this process.
*/
typedef struct RegisteredInterp {
char *name; /* Interpreter's name (malloc-ed). */
- Tcl_Interp *interp; /* Interpreter associated with name. NULL
+ Tcl_Interp *interp; /* Interpreter associated with name. NULL
* means that the application was unregistered
- * or deleted while a send was in progress
- * to it. */
- TkDisplay *dispPtr; /* Display for the application. Needed
- * because we may need to unregister the
- * interpreter after its main window has
- * been deleted. */
+ * or deleted while a send was in progress to
+ * it. */
+ TkDisplay *dispPtr; /* Display for the application. Needed because
+ * we may need to unregister the interpreter
+ * after its main window has been deleted. */
struct RegisteredInterp *nextPtr;
- /* Next in list of names associated
- * with interps in this process.
- * NULL means end of list. */
+ /* Next in list of names associated with
+ * interps in this process. NULL means end of
+ * list. */
} RegisteredInterp;
/*
- * A registry of all interpreters for a display is kept in a
- * property "InterpRegistry" on the root window of the display.
- * It is organized as a series of zero or more concatenated strings
- * (in no particular order), each of the form
+ * A registry of all interpreters for a display is kept in a property
+ * "InterpRegistry" on the root window of the display. It is organized as a
+ * series of zero or more concatenated strings (in no particular order), each
+ * of the form
* window space name '\0'
- * where "window" is the hex id of the comm. window to use to talk
- * to an interpreter named "name".
+ * where "window" is the hex id of the comm. window to use to talk to an
+ * interpreter named "name".
*
- * When the registry is being manipulated by an application (e.g. to
- * add or remove an entry), it is loaded into memory using a structure
- * of the following type:
+ * When the registry is being manipulated by an application (e.g. to add or
+ * remove an entry), it is loaded into memory using a structure of the
+ * following type:
*/
typedef struct NameRegistry {
TkDisplay *dispPtr; /* Display from which the registry was
* read. */
- int locked; /* Non-zero means that the display was
- * locked when the property was read in. */
- int modified; /* Non-zero means that the property has
- * been modified, so it needs to be written
- * out when the NameRegistry is closed. */
+ int locked; /* Non-zero means that the display was locked
+ * when the property was read in. */
+ int modified; /* Non-zero means that the property has been
+ * modified, so it needs to be written out
+ * when the NameRegistry is closed. */
unsigned long propLength; /* Length of the property, in bytes. */
- char *property; /* The contents of the property, or NULL
- * if none. See format description above;
- * this is *not* terminated by the first
- * null character. Dynamically allocated. */
+ char *property; /* The contents of the property, or NULL if
+ * none. See format description above; this is
+ * *not* terminated by the first null
+ * character. Dynamically allocated. */
int allocedByX; /* Non-zero means must free property with
- * XFree; zero means use ckfree. */
+ * XFree; zero means use ckfree. */
} NameRegistry;
/*
- * When a result is being awaited from a sent command, one of
- * the following structures is present on a list of all outstanding
- * sent commands. The information in the structure is used to
- * process the result when it arrives. You're probably wondering
- * how there could ever be multiple outstanding sent commands.
- * This could happen if interpreters invoke each other recursively.
+ * When a result is being awaited from a sent command, one of the following
+ * structures is present on a list of all outstanding sent commands. The
+ * information in the structure is used to process the result when it arrives.
+ * You're probably wondering how there could ever be multiple outstanding sent
+ * commands. This could happen if interpreters invoke each other recursively.
* It's unlikely, but possible.
*/
typedef struct PendingCommand {
- int serial; /* Serial number expected in
- * result. */
+ int serial; /* Serial number expected in result. */
TkDisplay *dispPtr; /* Display being used for communication. */
- CONST char *target; /* Name of interpreter command is
- * being sent to. */
+ CONST char *target; /* Name of interpreter command is being sent
+ * to. */
Window commWindow; /* Target's communication window. */
- Tcl_Interp *interp; /* Interpreter from which the send
- * was invoked. */
- int code; /* Tcl return code for command
- * will be stored here. */
- char *result; /* String result for command (malloc'ed),
- * or NULL. */
- char *errorInfo; /* Information for "errorInfo" variable,
- * or NULL (malloc'ed). */
- char *errorCode; /* Information for "errorCode" variable,
- * or NULL (malloc'ed). */
- int gotResponse; /* 1 means a response has been received,
- * 0 means the command is still outstanding. */
+ Tcl_Interp *interp; /* Interpreter from which the send was
+ * invoked. */
+ int code; /* Tcl return code for command will be stored
+ * here. */
+ char *result; /* String result for command (malloc'ed), or
+ * NULL. */
+ char *errorInfo; /* Information for "errorInfo" variable, or
+ * NULL (malloc'ed). */
+ char *errorCode; /* Information for "errorCode" variable, or
+ * NULL (malloc'ed). */
+ int gotResponse; /* 1 means a response has been received, 0
+ * means the command is still outstanding. */
struct PendingCommand *nextPtr;
- /* Next in list of all outstanding
- * commands. NULL means end of
- * list. */
+ /* Next in list of all outstanding commands.
+ * NULL means end of list. */
} PendingCommand;
typedef struct ThreadSpecificData {
- PendingCommand *pendingCommands;
- /* List of all commands currently
- * being waited for. */
+ PendingCommand *pendingCommands;
+ /* List of all commands currently being waited
+ * for. */
RegisteredInterp *interpListPtr;
- /* List of all interpreters registered
- * in the current process. */
+ /* List of all interpreters registered in the
+ * current process. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * The information below is used for communication between processes
- * during "send" commands. Each process keeps a private window, never
- * even mapped, with one property, "Comm". When a command is sent to
- * an interpreter, the command is appended to the comm property of the
- * communication window associated with the interp's process. Similarly,
- * when a result is returned from a sent command, it is also appended
- * to the comm property.
- *
- * Each command and each result takes the form of ASCII text. For a
- * command, the text consists of a zero character followed by several
- * null-terminated ASCII strings. The first string consists of the
- * single letter "c". Subsequent strings have the form "option value"
- * where the following options are supported:
+ * The information below is used for communication between processes during
+ * "send" commands. Each process keeps a private window, never even mapped,
+ * with one property, "Comm". When a command is sent to an interpreter, the
+ * command is appended to the comm property of the communication window
+ * associated with the interp's process. Similarly, when a result is returned
+ * from a sent command, it is also appended to the comm property.
+ *
+ * Each command and each result takes the form of ASCII text. For a command,
+ * the text consists of a zero character followed by several null-terminated
+ * ASCII strings. The first string consists of the single letter "c".
+ * Subsequent strings have the form "option value" where the following options
+ * are supported:
*
* -r commWindow serial
*
- * This option means that a response should be sent to the window
- * whose X identifier is "commWindow" (in hex), and the response should
- * be identified with the serial number given by "serial" (in decimal).
- * If this option isn't specified then the send is asynchronous and
- * no response is sent.
+ * This option means that a response should be sent to the window whose X
+ * identifier is "commWindow" (in hex), and the response should be
+ * identified with the serial number given by "serial" (in decimal). If
+ * this option isn't specified then the send is asynchronous and no
+ * response is sent.
*
* -n name
+ *
* "Name" gives the name of the application for which the command is
- * intended. This option must be present.
+ * intended. This option must be present.
*
* -s script
*
- * "Script" is the script to be executed. This option must be present.
+ * "Script" is the script to be executed. This option must be present.
*
- * The options may appear in any order. The -n and -s options must be
- * present, but -r may be omitted for asynchronous RPCs. For compatibility
- * with future releases that may add new features, there may be additional
- * options present; as long as they start with a "-" character, they will
- * be ignored.
+ * The options may appear in any order. The -n and -s options must be present,
+ * but -r may be omitted for asynchronous RPCs. For compatibility with future
+ * releases that may add new features, there may be additional options
+ * present; as long as they start with a "-" character, they will be ignored.
*
* A result also consists of a zero character followed by several null-
- * terminated ASCII strings. The first string consists of the single
- * letter "r". Subsequent strings have the form "option value" where
- * the following options are supported:
+ * terminated ASCII strings. The first string consists of the single letter
+ * "r". Subsequent strings have the form "option value" where the following
+ * options are supported:
*
* -s serial
*
- * Identifies the command for which this is the result. It is the
- * same as the "serial" field from the -s option in the command. This
- * option must be present.
+ * Identifies the command for which this is the result. It is the same as
+ * the "serial" field from the -s option in the command. This option must
+ * be present.
*
* -c code
*
- * "Code" is the completion code for the script, in decimal. If the
- * code is omitted it defaults to TCL_OK.
+ * "Code" is the completion code for the script, in decimal. If the code
+ * is omitted it defaults to TCL_OK.
*
* -r result
*
- * "Result" is the result string for the script, which may be either
- * a result or an error message. If this field is omitted then it
- * defaults to an empty string.
+ * "Result" is the result string for the script, which may be either a
+ * result or an error message. If this field is omitted then it defaults
+ * to an empty string.
*
* -i errorInfo
*
* "ErrorInfo" gives a string with which to initialize the errorInfo
- * variable. This option may be omitted; it is ignored unless the
+ * variable. This option may be omitted; it is ignored unless the
* completion code is TCL_ERROR.
*
* -e errorCode
*
* "ErrorCode" gives a string with with to initialize the errorCode
- * variable. This option may be omitted; it is ignored unless the
+ * variable. This option may be omitted; it is ignored unless the
* completion code is TCL_ERROR.
*
- * Options may appear in any order, and only the -s option must be
- * present. As with commands, there may be additional options besides
- * these; unknown options are ignored.
+ * Options may appear in any order, and only the -s option must be present. As
+ * with commands, there may be additional options besides these; unknown
+ * options are ignored.
*/
/*
- * The following variable is the serial number that was used in the
- * last "send" command. It is exported only for testing purposes.
+ * Other miscellaneous per-process data:
*/
-int tkSendSerial = 0;
+static struct {
+ int sendSerial; /* The serial number that was used in the last
+ * "send" command. */
+ int sendDebug; /* This can be set while debugging to do
+ * things like skip locking the server. */
+} localData = {0, 0};
/*
- * Maximum size property that can be read at one time by
- * this module:
+ * Maximum size property that can be read at one time by this module:
*/
#define MAX_PROP_WORDS 100000
/*
- * The following variable can be set while debugging to do things like
- * skip locking the server.
+ * Forward declarations for functions defined later in this file:
*/
-static int sendDebug = 0;
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-static int AppendErrorProc _ANSI_ARGS_((ClientData clientData,
- XErrorEvent *errorPtr));
-static void AppendPropCarefully _ANSI_ARGS_((Display *display,
+static int AppendErrorProc(ClientData clientData,
+ XErrorEvent *errorPtr);
+static void AppendPropCarefully(Display *display,
Window window, Atom property, char *value,
- int length, PendingCommand *pendingPtr));
-static void DeleteProc _ANSI_ARGS_((ClientData clientData));
-static void RegAddName _ANSI_ARGS_((NameRegistry *regPtr,
- CONST char *name, Window commWindow));
-static void RegClose _ANSI_ARGS_((NameRegistry *regPtr));
-static void RegDeleteName _ANSI_ARGS_((NameRegistry *regPtr,
- CONST char *name));
-static Window RegFindName _ANSI_ARGS_((NameRegistry *regPtr,
- CONST char *name));
-static NameRegistry * RegOpen _ANSI_ARGS_((Tcl_Interp *interp,
- TkDisplay *dispPtr, int lock));
-static void SendEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int SendInit _ANSI_ARGS_((Tcl_Interp *interp,
- TkDisplay *dispPtr));
-static Tk_RestrictAction SendRestrictProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int ServerSecure _ANSI_ARGS_((TkDisplay *dispPtr));
-static void UpdateCommWindow _ANSI_ARGS_((TkDisplay *dispPtr));
-static int ValidateName _ANSI_ARGS_((TkDisplay *dispPtr,
- CONST char *name, Window commWindow, int oldOK));
+ int length, PendingCommand *pendingPtr);
+static void DeleteProc(ClientData clientData);
+static void RegAddName(NameRegistry *regPtr,
+ CONST char *name, Window commWindow);
+static void RegClose(NameRegistry *regPtr);
+static void RegDeleteName(NameRegistry *regPtr, CONST char *name);
+static Window RegFindName(NameRegistry *regPtr, CONST char *name);
+static NameRegistry * RegOpen(Tcl_Interp *interp,
+ TkDisplay *dispPtr, int lock);
+static void SendEventProc(ClientData clientData, XEvent *eventPtr);
+static int SendInit(Tcl_Interp *interp, TkDisplay *dispPtr);
+static Tk_RestrictAction SendRestrictProc(ClientData clientData,
+ XEvent *eventPtr);
+static int ServerSecure(TkDisplay *dispPtr);
+static void UpdateCommWindow(TkDisplay *dispPtr);
+static int ValidateName(TkDisplay *dispPtr, CONST char *name,
+ Window commWindow, int oldOK);
/*
*----------------------------------------------------------------------
*
* RegOpen --
*
- * This procedure loads the name registry for a display into
- * memory so that it can be manipulated.
+ * This function loads the name registry for a display into memory so
+ * that it can be manipulated.
*
* Results:
* The return value is a pointer to the loaded registry.
*
* Side effects:
- * If "lock" is set then the server will be locked. It is the
- * caller's responsibility to call RegClose when finished with
- * the registry, so that we can write back the registry if
- * needed, unlock the server if needed, and free memory.
+ * If "lock" is set then the server will be locked. It is the caller's
+ * responsibility to call RegClose when finished with the registry, so
+ * that we can write back the registry if needed, unlock the server if
+ * needed, and free memory.
*
*----------------------------------------------------------------------
*/
static NameRegistry *
-RegOpen(interp, dispPtr, lock)
- Tcl_Interp *interp; /* Interpreter to use for error reporting
- * (errors cause a panic so in fact no
- * error is ever returned, but the interpreter
- * is needed anyway). */
- TkDisplay *dispPtr; /* Display whose name registry is to be
+RegOpen(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting
+ * (errors cause a panic so in fact no error
+ * is ever returned, but the interpreter is
+ * needed anyway). */
+ TkDisplay *dispPtr, /* Display whose name registry is to be
* opened. */
- int lock; /* Non-zero means lock the window server
- * when opening the registry, so no-one
- * else can use the registry until we
- * close it. */
+ int lock) /* Non-zero means lock the window server when
+ * opening the registry, so no-one else can
+ * use the registry until we close it. */
{
NameRegistry *regPtr;
int result, actualFormat;
unsigned long bytesAfter;
Atom actualType;
+ char **propertyPtr;
if (dispPtr->commTkwin == NULL) {
SendInit(interp, dispPtr);
@@ -288,8 +272,9 @@ RegOpen(interp, dispPtr, lock)
regPtr->locked = 0;
regPtr->modified = 0;
regPtr->allocedByX = 1;
+ propertyPtr = &regPtr->property;
- if (lock && !sendDebug) {
+ if (lock && !localData.sendDebug) {
XGrabServer(dispPtr->display);
regPtr->locked = 1;
}
@@ -303,7 +288,7 @@ RegOpen(interp, dispPtr, lock)
dispPtr->registryProperty, 0, MAX_PROP_WORDS,
False, XA_STRING, &actualType, &actualFormat,
&regPtr->propLength, &bytesAfter,
- (unsigned char **) &regPtr->property);
+ (unsigned char **) propertyPtr);
if (actualType == None) {
regPtr->propLength = 0;
@@ -311,7 +296,7 @@ RegOpen(interp, dispPtr, lock)
} else if ((result != Success) || (actualFormat != 8)
|| (actualType != XA_STRING)) {
/*
- * The property is improperly formed; delete it.
+ * The property is improperly formed; delete it.
*/
if (regPtr->property != NULL) {
@@ -325,11 +310,11 @@ RegOpen(interp, dispPtr, lock)
}
/*
- * Xlib placed an extra null byte after the end of the property, just
- * to make sure that it is always NULL-terminated. Be sure to include
- * this byte in our count if it's needed to ensure null termination
- * (note: as of 8/95 I'm no longer sure why this code is needed; seems
- * like it shouldn't be).
+ * Xlib placed an extra null byte after the end of the property, just to
+ * make sure that it is always NULL-terminated. Be sure to include this
+ * byte in our count if it's needed to ensure null termination (note: as
+ * of 8/95 I'm no longer sure why this code is needed; seems like it
+ * shouldn't be).
*/
if ((regPtr->propLength > 0)
@@ -344,14 +329,13 @@ RegOpen(interp, dispPtr, lock)
*
* RegFindName --
*
- * Given an open name registry, this procedure finds an entry
- * with a given name, if there is one, and returns information
- * about that entry.
+ * Given an open name registry, this function finds an entry with a given
+ * name, if there is one, and returns information about that entry.
*
* Results:
- * The return value is the X identifier for the comm window for
- * the application named "name", or None if there is no such
- * entry in the registry.
+ * The return value is the X identifier for the comm window for the
+ * application named "name", or None if there is no such entry in the
+ * registry.
*
* Side effects:
* None.
@@ -360,24 +344,26 @@ RegOpen(interp, dispPtr, lock)
*/
static Window
-RegFindName(regPtr, name)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegFindName(
+ NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name; /* Name of an application. */
+ CONST char *name) /* Name of an application. */
{
- char *p, *entry;
- unsigned int id;
+ char *p;
+
+ for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) {
+ char *entry = p;
- for (p = regPtr->property; (p-regPtr->property) < (int) regPtr->propLength; ) {
- entry = p;
while ((*p != 0) && (!isspace(UCHAR(*p)))) {
p++;
}
if ((*p != 0) && (strcmp(name, p+1) == 0)) {
+ unsigned int id;
+
if (sscanf(entry, "%x", &id) == 1) {
/*
- * Must cast from an unsigned int to a Window in case we
- * are on a 64-bit architecture.
+ * Must cast from an unsigned int to a Window in case we are
+ * on a 64-bit architecture.
*/
return (Window) id;
@@ -396,31 +382,31 @@ RegFindName(regPtr, name)
*
* RegDeleteName --
*
- * This procedure deletes the entry for a given name from
- * an open registry.
+ * This function deletes the entry for a given name from an open
+ * registry.
*
* Results:
* None.
*
* Side effects:
- * If there used to be an entry named "name" in the registry,
- * then it is deleted and the registry is marked as modified
- * so it will be written back when closed.
+ * If there used to be an entry named "name" in the registry, then it is
+ * deleted and the registry is marked as modified so it will be written
+ * back when closed.
*
*----------------------------------------------------------------------
*/
static void
-RegDeleteName(regPtr, name)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegDeleteName(
+ NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name; /* Name of an application. */
+ CONST char *name) /* Name of an application. */
{
- char *p, *entry, *entryName;
- int count;
+ char *p;
+
+ for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) {
+ char *entry = p, *entryName;
- for (p = regPtr->property; (p-regPtr->property) < (int) regPtr->propLength; ) {
- entry = p;
while ((*p != 0) && (!isspace(UCHAR(*p)))) {
p++;
}
@@ -432,21 +418,23 @@ RegDeleteName(regPtr, name)
p++;
}
p++;
- if ((strcmp(name, entryName) == 0)) {
+ if (strcmp(name, entryName) == 0) {
+ int count;
+
/*
- * Found the matching entry. Copy everything after it
- * down on top of it.
+ * Found the matching entry. Copy everything after it down on top
+ * of it.
*/
count = regPtr->propLength - (p - regPtr->property);
- if (count > 0) {
+ if (count > 0) {
char *src, *dst;
- for (src = p, dst = entry; count > 0; src++, dst++, count--) {
+ for (src=p , dst=entry ; count>0 ; src++, dst++, count--) {
*dst = *src;
}
}
- regPtr->propLength -= p - entry;
+ regPtr->propLength -= p - entry;
regPtr->modified = 1;
return;
}
@@ -464,35 +452,33 @@ RegDeleteName(regPtr, name)
* None.
*
* Side effects:
- * The open registry is expanded; it is marked as modified so that
- * it will be written back when closed.
+ * The open registry is expanded; it is marked as modified so that it
+ * will be written back when closed.
*
*----------------------------------------------------------------------
*/
static void
-RegAddName(regPtr, name, commWindow)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegAddName(
+ NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name; /* Name of an application. The caller
- * must ensure that this name isn't
- * already registered. */
- Window commWindow; /* X identifier for comm. window of
- * application. */
+ CONST char *name, /* Name of an application. The caller must
+ * ensure that this name isn't already
+ * registered. */
+ Window commWindow) /* X identifier for comm. window of
+ * application. */
{
- char id[30];
- char *newProp;
+ char id[30], *newProp;
int idLength, newBytes;
sprintf(id, "%x ", (unsigned int) commWindow);
idLength = strlen(id);
newBytes = idLength + strlen(name) + 1;
- newProp = (char *) ckalloc((unsigned) (regPtr->propLength + newBytes));
+ newProp = ckalloc((unsigned) (regPtr->propLength + newBytes));
strcpy(newProp, id);
strcpy(newProp+idLength, name);
if (regPtr->property != NULL) {
- memcpy((VOID *) (newProp + newBytes), (VOID *) regPtr->property,
- regPtr->propLength);
+ memcpy(newProp + newBytes, regPtr->property, regPtr->propLength);
if (regPtr->allocedByX) {
XFree(regPtr->property);
} else {
@@ -510,29 +496,28 @@ RegAddName(regPtr, name, commWindow)
*
* RegClose --
*
- * This procedure is called to end a series of operations on
- * a name registry.
+ * This function is called to end a series of operations on a name
+ * registry.
*
* Results:
* None.
*
* Side effects:
- * The registry is written back if it has been modified, and the
- * X server is unlocked if it was locked. Memory for the
- * registry is freed, so the caller should never use regPtr
- * again.
+ * The registry is written back if it has been modified, and the X server
+ * is unlocked if it was locked. Memory for the registry is freed, so the
+ * caller should never use regPtr again.
*
*----------------------------------------------------------------------
*/
static void
-RegClose(regPtr)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegClose(
+ NameRegistry *regPtr) /* Pointer to a registry opened with a
* previous call to RegOpen. */
{
if (regPtr->modified) {
- if (!regPtr->locked && !sendDebug) {
- panic("The name registry was modified without being locked!");
+ if (!regPtr->locked && !localData.sendDebug) {
+ Tcl_Panic("The name registry was modified without being locked!");
}
XChangeProperty(regPtr->dispPtr->display,
RootWindow(regPtr->dispPtr->display, 0),
@@ -547,11 +532,11 @@ RegClose(regPtr)
/*
* After ungrabbing the server, it's important to flush the output
- * immediately so that the server sees the ungrab command. Otherwise
- * we might do something else that needs to communicate with the
- * server (such as invoking a subprocess that needs to do I/O to
- * the screen); if the ungrab command is still sitting in our
- * output buffer, we could deadlock.
+ * immediately so that the server sees the ungrab command. Otherwise we
+ * might do something else that needs to communicate with the server (such
+ * as invoking a subprocess that needs to do I/O to the screen); if the
+ * ungrab command is still sitting in our output buffer, we could
+ * deadlock.
*/
XFlush(regPtr->dispPtr->display);
@@ -571,12 +556,12 @@ RegClose(regPtr)
*
* ValidateName --
*
- * This procedure checks to see if an entry in the registry
- * is still valid.
+ * This function checks to see if an entry in the registry is still
+ * valid.
*
* Results:
- * The return value is 1 if the given commWindow exists and its
- * name is "name". Otherwise 0 is returned.
+ * The return value is 1 if the given commWindow exists and its name is
+ * "name". Otherwise 0 is returned.
*
* Side effects:
* None.
@@ -585,52 +570,50 @@ RegClose(regPtr)
*/
static int
-ValidateName(dispPtr, name, commWindow, oldOK)
- TkDisplay *dispPtr; /* Display for which to perform the
+ValidateName(
+ TkDisplay *dispPtr, /* Display for which to perform the
* validation. */
- CONST char *name; /* The name of an application. */
- Window commWindow; /* X identifier for the application's
- * comm. window. */
- int oldOK; /* Non-zero means that we should consider
- * an application to be valid even if it
- * looks like an old-style (pre-4.0) one;
- * 0 means consider these invalid. */
+ CONST char *name, /* The name of an application. */
+ Window commWindow, /* X identifier for the application's comm.
+ * window. */
+ int oldOK) /* Non-zero means that we should consider an
+ * application to be valid even if it looks
+ * like an old-style (pre-4.0) one; 0 means
+ * consider these invalid. */
{
int result, actualFormat, argc, i;
unsigned long length, bytesAfter;
Atom actualType;
- char *property;
+ char *property, **propertyPtr = &property;
Tk_ErrorHandler handler;
CONST char **argv;
property = NULL;
/*
- * Ignore X errors when reading the property (e.g., the window
- * might not exist). If an error occurs, result will be some
- * value other than Success.
+ * Ignore X errors when reading the property (e.g., the window might not
+ * exist). If an error occurs, result will be some value other than
+ * Success.
*/
- handler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1, NULL, NULL);
result = XGetWindowProperty(dispPtr->display, commWindow,
dispPtr->appNameProperty, 0, MAX_PROP_WORDS,
False, XA_STRING, &actualType, &actualFormat,
- &length, &bytesAfter, (unsigned char **) &property);
+ &length, &bytesAfter, (unsigned char **) propertyPtr);
if ((result == Success) && (actualType == None)) {
XWindowAttributes atts;
/*
- * The comm. window exists but the property we're looking for
- * doesn't exist. This probably means that the application
- * comes from an older version of Tk (< 4.0) that didn't set the
- * property; if this is the case, then assume for compatibility's
- * sake that everything's OK. However, it's also possible that
- * some random application has re-used the window id for something
- * totally unrelated. Check a few characteristics of the window,
- * such as its dimensions and mapped state, to be sure that it
- * still "smells" like a commWindow.
+ * The comm. window exists but the property we're looking for doesn't
+ * exist. This probably means that the application comes from an older
+ * version of Tk (< 4.0) that didn't set the property; if this is the
+ * case, then assume for compatibility's sake that everything's OK.
+ * However, it's also possible that some random application has
+ * re-used the window id for something totally unrelated. Check a few
+ * characteristics of the window, such as its dimensions and mapped
+ * state, to be sure that it still "smells" like a commWindow.
*/
if (!oldOK
@@ -642,10 +625,9 @@ ValidateName(dispPtr, name, commWindow, oldOK)
result = 1;
}
} else if ((result == Success) && (actualFormat == 8)
- && (actualType == XA_STRING)) {
+ && (actualType == XA_STRING)) {
result = 0;
- if (Tcl_SplitList((Tcl_Interp *) NULL, property, &argc, &argv)
- == TCL_OK) {
+ if (Tcl_SplitList(NULL, property, &argc, &argv) == TCL_OK) {
for (i = 0; i < argc; i++) {
if (strcmp(argv[i], name) == 0) {
result = 1;
@@ -655,7 +637,7 @@ ValidateName(dispPtr, name, commWindow, oldOK)
ckfree((char *) argv);
}
} else {
- result = 0;
+ result = 0;
}
Tk_DeleteErrorHandler(handler);
if (property != NULL) {
@@ -669,15 +651,14 @@ ValidateName(dispPtr, name, commWindow, oldOK)
*
* ServerSecure --
*
- * Check whether a server is secure enough for us to trust
- * Tcl scripts arriving via that server.
+ * Check whether a server is secure enough for us to trust Tcl scripts
+ * arriving via that server.
*
* Results:
- * The return value is 1 if the server is secure, which means
- * that host-style authentication is turned on but there are
- * no hosts in the enabled list. This means that some other
- * form of authorization (presumably more secure, such as xauth)
- * is in use.
+ * The return value is 1 if the server is secure, which means that
+ * host-style authentication is turned on but there are no hosts in the
+ * enabled list. This means that some other form of authorization
+ * (presumably more secure, such as xauth) is in use.
*
* Side effects:
* None.
@@ -686,8 +667,8 @@ ValidateName(dispPtr, name, commWindow, oldOK)
*/
static int
-ServerSecure(dispPtr)
- TkDisplay *dispPtr; /* Display to check. */
+ServerSecure(
+ TkDisplay *dispPtr) /* Display to check. */
{
#ifdef TK_NO_SECURITY
return 1;
@@ -696,10 +677,74 @@ ServerSecure(dispPtr)
int numHosts, secure;
Bool enabled;
- secure = 0;
addrPtr = XListHosts(dispPtr->display, &numHosts, &enabled);
- if (enabled && (numHosts == 0)) {
+ if (!enabled) {
+ insecure:
+ secure = 0;
+ } else if (numHosts == 0) {
secure = 1;
+ } else {
+ /*
+ * Recent versions of X11 have the extra feature of allowing more
+ * sophisticated authorization checks to be performed than the dozy
+ * old ones that used to plague xhost usage. However, not all deployed
+ * versions of Xlib know how to deal with this feature, so this code
+ * is conditional on having the right #def in place. [Bug 1909931]
+ *
+ * Note that at this point we know that there's at least one entry in
+ * the list returned by XListHosts. However there may be multiple
+ * entries; as long as each is one of either 'SI:localhost:*' or
+ * 'SI:localgroup:*' then we will claim to be secure enough.
+ */
+
+#ifdef FamilyServerInterpreted
+ XServerInterpretedAddress *siPtr;
+ int i;
+
+ for (i=0 ; i<numHosts ; i++) {
+ if (addrPtr[i].family != FamilyServerInterpreted) {
+ /*
+ * We don't understand what the X server is letting in, so we
+ * err on the side of safety.
+ */
+
+ goto insecure;
+ }
+ siPtr = (XServerInterpretedAddress *) addrPtr[0].address;
+
+ /*
+ * We don't check the username or group here. This is because it's
+ * officially non-portable and we are just making sure there
+ * aren't silly misconfigurations. (Apparently 'root' is not a
+ * very good choice, but we still don't put any effort in to spot
+ * that.) However we do check to see that the constraints are
+ * imposed against the connecting user and/or group.
+ */
+
+ if ( !(siPtr->typelength == 9 /* ==strlen("localuser") */
+ && !memcmp(siPtr->type, "localuser", 9))
+ && !(siPtr->typelength == 10 /* ==strlen("localgroup") */
+ && !memcmp(siPtr->type, "localgroup", 10))) {
+ /*
+ * The other defined types of server-interpreted controls
+ * involve particular hosts. These are still insecure for the
+ * same reasons that classic xhost access is insecure; there's
+ * just no way to be sure that the users on those systems are
+ * the ones who should be allowed to connect to this display.
+ */
+
+ goto insecure;
+ }
+ }
+ secure = 1;
+#else
+ /*
+ * We don't understand what the X server is letting in, so we err on
+ * the side of safety.
+ */
+
+ goto insecure;
+#endif /* FamilyServerInterpreted */
}
if (addrPtr != NULL) {
XFree((char *) addrPtr);
@@ -713,35 +758,34 @@ ServerSecure(dispPtr)
*
* Tk_SetAppName --
*
- * This procedure is called to associate an ASCII name with a Tk
- * application. If the application has already been named, the
- * name replaces the old one.
+ * This function is called to associate an ASCII name with a Tk
+ * application. If the application has already been named, the name
+ * replaces the old one.
*
* Results:
- * The return value is the name actually given to the application.
- * This will normally be the same as name, but if name was already
- * in use for an application then a name of the form "name #2" will
- * be chosen, with a high enough number to make the name unique.
+ * The return value is the name actually given to the application. This
+ * will normally be the same as name, but if name was already in use for
+ * an application then a name of the form "name #2" will be chosen, with
+ * a high enough number to make the name unique.
*
* Side effects:
- * Registration info is saved, thereby allowing the "send" command
- * to be used later to invoke commands in the application. In
- * addition, the "send" command is created in the application's
- * interpreter. The registration will be removed automatically
- * if the interpreter is deleted or the "send" command is removed.
+ * Registration info is saved, thereby allowing the "send" command to be
+ * used later to invoke commands in the application. In addition, the
+ * "send" command is created in the application's interpreter. The
+ * registration will be removed automatically if the interpreter is
+ * deleted or the "send" command is removed.
*
*--------------------------------------------------------------
*/
CONST char *
-Tk_SetAppName(tkwin, name)
- Tk_Window tkwin; /* Token for any window in the application
- * to be named: it is just used to identify
- * the application and the display. */
- CONST char *name; /* The name that will be used to
- * refer to the interpreter in later
- * "send" commands. Must be globally
- * unique. */
+Tk_SetAppName(
+ Tk_Window tkwin, /* Token for any window in the application to
+ * be named: it is just used to identify the
+ * application and the display. */
+ CONST char *name) /* The name that will be used to refer to the
+ * interpreter in later "send" commands. Must
+ * be globally unique. */
{
RegisteredInterp *riPtr, *riPtr2;
Window w;
@@ -752,8 +796,8 @@ Tk_SetAppName(tkwin, name)
CONST char *actualName;
Tcl_DString dString;
int offset, i;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
interp = winPtr->mainPtr->interp;
if (dispPtr->commTkwin == NULL) {
@@ -761,18 +805,17 @@ Tk_SetAppName(tkwin, name)
}
/*
- * See if the application is already registered; if so, remove its
- * current name from the registry.
+ * See if the application is already registered; if so, remove its current
+ * name from the registry.
*/
regPtr = RegOpen(interp, winPtr->dispPtr, 1);
for (riPtr = tsdPtr->interpListPtr; ; riPtr = riPtr->nextPtr) {
if (riPtr == NULL) {
-
/*
- * This interpreter isn't currently registered; create
- * the data structure that will be used to register it locally,
- * plus add the "send" command to the interpreter.
+ * This interpreter isn't currently registered; create the data
+ * structure that will be used to register it locally, plus add
+ * the "send" command to the interpreter.
*/
riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
@@ -783,15 +826,15 @@ Tk_SetAppName(tkwin, name)
riPtr->name = NULL;
Tcl_CreateCommand(interp, "send", Tk_SendCmd, (ClientData) riPtr,
DeleteProc);
- if (Tcl_IsSafe(interp)) {
- Tcl_HideCommand(interp, "send", "send");
- }
+ if (Tcl_IsSafe(interp)) {
+ Tcl_HideCommand(interp, "send", "send");
+ }
break;
}
if (riPtr->interp == interp) {
/*
- * The interpreter is currently registered; remove it from
- * the name registry.
+ * The interpreter is currently registered; remove it from the
+ * name registry.
*/
if (riPtr->name) {
@@ -803,10 +846,9 @@ Tk_SetAppName(tkwin, name)
}
/*
- * Pick a name to use for the application. Use "name" if it's not
- * already in use. Otherwise add a suffix such as " #2", trying
- * larger and larger numbers until we eventually find one that is
- * unique.
+ * Pick a name to use for the application. Use "name" if it's not already
+ * in use. Otherwise add a suffix such as " #2", trying larger and larger
+ * numbers until we eventually find one that is unique.
*/
actualName = name;
@@ -828,16 +870,16 @@ Tk_SetAppName(tkwin, name)
if (w == None) {
break;
}
-
+
/*
- * The name appears to be in use already, but double-check to
- * be sure (perhaps the application died without removing its
- * name from the registry?).
+ * The name appears to be in use already, but double-check to be sure
+ * (perhaps the application died without removing its name from the
+ * registry?).
*/
if (w == Tk_WindowId(dispPtr->commTkwin)) {
- for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
- riPtr2 = riPtr2->nextPtr) {
+ for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
+ riPtr2 = riPtr2->nextPtr) {
if ((riPtr2->interp != interp) &&
(strcmp(riPtr2->name, actualName) == 0)) {
goto nextSuffix;
@@ -849,14 +891,14 @@ Tk_SetAppName(tkwin, name)
RegDeleteName(regPtr, actualName);
break;
}
- nextSuffix:
+ nextSuffix:
continue;
}
/*
- * We've now got a name to use. Store it in the name registry and
- * in the local entry for this application, plus put it in a property
- * on the commWindow.
+ * We've now got a name to use. Store it in the name registry and in the
+ * local entry for this application, plus put it in a property on the
+ * commWindow.
*/
RegAddName(regPtr, actualName, Tk_WindowId(dispPtr->commTkwin));
@@ -876,8 +918,8 @@ Tk_SetAppName(tkwin, name)
*
* Tk_SendCmd --
*
- * This procedure is invoked to process the "send" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "send" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -889,12 +931,12 @@ Tk_SetAppName(tkwin, name)
*/
int
-Tk_SendCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Information about sender (only
- * dispPtr field is used). */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+Tk_SendCmd(
+ ClientData clientData, /* Information about sender (only dispPtr
+ * field is used). */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
TkWindow *winPtr;
Window commWindow;
@@ -909,11 +951,10 @@ Tk_SendCmd(clientData, interp, argc, argv)
Tcl_Time timeout;
NameRegistry *regPtr;
Tcl_DString request;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- Tcl_Interp *localInterp; /* Used when the interpreter to
- * send the command to is within
- * the same process. */
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_Interp *localInterp; /* Used when the interpreter to send the
+ * command to is within the same process. */
/*
* Process options, if any.
@@ -946,14 +987,14 @@ Tk_SendCmd(clientData, interp, argc, argv)
break;
} else {
Tcl_AppendResult(interp, "bad option \"", argv[i],
- "\": must be -async, -displayof, or --", (char *) NULL);
+ "\": must be -async, -displayof, or --", NULL);
return TCL_ERROR;
}
}
if (argc < (i+2)) {
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ?options? interpName arg ?arg ...?\"", (char *) NULL);
+ " ?options? interpName arg ?arg ...?\"", NULL);
return TCL_ERROR;
}
destName = argv[i];
@@ -965,22 +1006,21 @@ Tk_SendCmd(clientData, interp, argc, argv)
}
/*
- * See if the target interpreter is local. If so, execute
- * the command directly without going through the X server.
- * The only tricky thing is passing the result from the target
- * interpreter to the invoking interpreter. Watch out: they
- * could be the same!
+ * See if the target interpreter is local. If so, execute the command
+ * directly without going through the X server. The only tricky thing is
+ * passing the result from the target interpreter to the invoking
+ * interpreter. Watch out: they could be the same!
*/
- for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
- riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
if ((riPtr->dispPtr != dispPtr)
|| (strcmp(riPtr->name, destName) != 0)) {
continue;
}
Tcl_Preserve((ClientData) riPtr);
- localInterp = riPtr->interp;
- Tcl_Preserve((ClientData) localInterp);
+ localInterp = riPtr->interp;
+ Tcl_Preserve((ClientData) localInterp);
if (firstArg == (argc-1)) {
result = Tcl_GlobalEval(localInterp, argv[firstArg]);
} else {
@@ -999,25 +1039,25 @@ Tk_SendCmd(clientData, interp, argc, argv)
/*
* An error occurred, so transfer error information from the
- * destination interpreter back to our interpreter. Must clear
+ * destination interpreter back to our interpreter. Must clear
* interp's result before calling Tcl_AddErrorInfo, since
- * Tcl_AddErrorInfo will store the interp's result in errorInfo
- * before appending riPtr's $errorInfo; we've already got
- * everything we need in riPtr's $errorInfo.
+ * Tcl_AddErrorInfo will store the interp's result in
+ * errorInfo before appending riPtr's $errorInfo; we've
+ * already got everything we need in riPtr's $errorInfo.
*/
Tcl_ResetResult(interp);
Tcl_AddErrorInfo(interp, Tcl_GetVar2(localInterp,
- "errorInfo", (char *) NULL, TCL_GLOBAL_ONLY));
+ "errorInfo", NULL, TCL_GLOBAL_ONLY));
errorObjPtr = Tcl_GetVar2Ex(localInterp, "errorCode", NULL,
TCL_GLOBAL_ONLY);
Tcl_SetObjErrorCode(interp, errorObjPtr);
}
Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
- Tcl_ResetResult(localInterp);
+ Tcl_ResetResult(localInterp);
}
Tcl_Release((ClientData) riPtr);
- Tcl_Release((ClientData) localInterp);
+ Tcl_Release((ClientData) localInterp);
return result;
}
@@ -1029,17 +1069,16 @@ Tk_SendCmd(clientData, interp, argc, argv)
commWindow = RegFindName(regPtr, destName);
RegClose(regPtr);
if (commWindow == None) {
- Tcl_AppendResult(interp, "no application named \"",
- destName, "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "no application named \"",destName,"\"",NULL);
return TCL_ERROR;
}
/*
- * Send the command to the target interpreter by appending it to the
- * comm window in the communication window.
+ * Send the command to the target interpreter by appending it to the comm
+ * window in the communication window.
*/
- tkSendSerial++;
+ localData.sendSerial++;
Tcl_DStringInit(&request);
Tcl_DStringAppend(&request, "\0c\0-n ", 6);
Tcl_DStringAppend(&request, destName, -1);
@@ -1048,7 +1087,7 @@ Tk_SendCmd(clientData, interp, argc, argv)
sprintf(buffer, "%x %d",
(unsigned int) Tk_WindowId(dispPtr->commTkwin),
- tkSendSerial);
+ localData.sendSerial);
Tcl_DStringAppend(&request, "\0-r ", 4);
Tcl_DStringAppend(&request, buffer, -1);
}
@@ -1060,27 +1099,26 @@ Tk_SendCmd(clientData, interp, argc, argv)
}
(void) AppendPropCarefully(dispPtr->display, commWindow,
dispPtr->commProperty, Tcl_DStringValue(&request),
- Tcl_DStringLength(&request) + 1,
- (async) ? (PendingCommand *) NULL : &pending);
+ Tcl_DStringLength(&request) + 1, (async ? NULL : &pending));
Tcl_DStringFree(&request);
if (async) {
/*
- * This is an asynchronous send: return immediately without
- * waiting for a response.
+ * This is an asynchronous send: return immediately without waiting
+ * for a response.
*/
return TCL_OK;
}
/*
- * Register the fact that we're waiting for a command to complete
- * (this is needed by SendEventProc and by AppendErrorProc to pass
- * back the command's results). Set up a timeout handler so that
- * we can check during long sends to make sure that the destination
- * application is still alive.
+ * Register the fact that we're waiting for a command to complete (this is
+ * needed by SendEventProc and by AppendErrorProc to pass back the
+ * command's results). Set up a timeout handler so that we can check
+ * during long sends to make sure that the destination application is
+ * still alive.
*/
- pending.serial = tkSendSerial;
+ pending.serial = localData.sendSerial;
pending.dispPtr = dispPtr;
pending.target = destName;
pending.commWindow = commWindow;
@@ -1093,28 +1131,27 @@ Tk_SendCmd(clientData, interp, argc, argv)
tsdPtr->pendingCommands = &pending;
/*
- * Enter a loop processing X events until the result comes
- * in or the target is declared to be dead. While waiting
- * for a result, look only at send-related events so that
- * the send is synchronous with respect to other events in
- * the application.
+ * Enter a loop processing X events until the result comes in or the
+ * target is declared to be dead. While waiting for a result, look only at
+ * send-related events so that the send is synchronous with respect to
+ * other events in the application.
*/
- prevRestrictProc = Tk_RestrictEvents(SendRestrictProc,
- (ClientData) NULL, &prevArg);
+ prevRestrictProc = Tk_RestrictEvents(SendRestrictProc, NULL, &prevArg);
Tcl_GetTime(&timeout);
timeout.sec += 2;
while (!pending.gotResponse) {
if (!TkUnixDoOneXEvent(&timeout)) {
/*
* An unusually long amount of time has elapsed during the
- * processing of a sent command. Check to make sure that the
- * target application still exists. If it does, reset the timeout.
+ * processing of a sent command. Check to make sure that the
+ * target application still exists. If it does, reset the timeout.
*/
if (!ValidateName(pending.dispPtr, pending.target,
pending.commWindow, 0)) {
char *msg;
+
if (ValidateName(pending.dispPtr, pending.target,
pending.commWindow, 1)) {
msg = "target application died or uses a Tk version before 4.0";
@@ -1134,19 +1171,19 @@ Tk_SendCmd(clientData, interp, argc, argv)
(void) Tk_RestrictEvents(prevRestrictProc, prevArg, &prevArg);
/*
- * Unregister the information about the pending command
- * and return the result.
+ * Unregister the information about the pending command and return the
+ * result.
*/
if (tsdPtr->pendingCommands != &pending) {
- panic("Tk_SendCmd: corrupted send stack");
+ Tcl_Panic("Tk_SendCmd: corrupted send stack");
}
tsdPtr->pendingCommands = pending.nextPtr;
if (pending.errorInfo != NULL) {
/*
* Special trick: must clear the interp's result before calling
* Tcl_AddErrorInfo, since Tcl_AddErrorInfo will store the interp's
- * result in errorInfo before appending pending.errorInfo; we've
+ * result in errorInfo before appending pending.errorInfo; we've
* already got everything we need in pending.errorInfo.
*/
@@ -1155,8 +1192,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
ckfree(pending.errorInfo);
}
if (pending.errorCode != NULL) {
- Tcl_Obj *errorObjPtr;
- errorObjPtr = Tcl_NewStringObj(pending.errorCode, -1);
+ Tcl_Obj *errorObjPtr = Tcl_NewStringObj(pending.errorCode, -1);
+
Tcl_SetObjErrorCode(interp, errorObjPtr);
ckfree(pending.errorCode);
}
@@ -1169,15 +1206,14 @@ Tk_SendCmd(clientData, interp, argc, argv)
*
* TkGetInterpNames --
*
- * This procedure is invoked to fetch a list of all the
- * interpreter names currently registered for the display
- * of a particular window.
+ * This function is invoked to fetch a list of all the interpreter names
+ * currently registered for the display of a particular window.
*
* Results:
- * A standard Tcl return value. The interp's result will be set
- * to hold a list of all the interpreter names defined for
- * tkwin's display. If an error occurs, then TCL_ERROR
- * is returned and the interp's result will hold an error message.
+ * A standard Tcl return value. The interp's result will be set to hold a
+ * list of all the interpreter names defined for tkwin's display. If an
+ * error occurs, then TCL_ERROR is returned and the interp's result will
+ * hold an error message.
*
* Side effects:
* None.
@@ -1186,17 +1222,14 @@ Tk_SendCmd(clientData, interp, argc, argv)
*/
int
-TkGetInterpNames(interp, tkwin)
- Tcl_Interp *interp; /* Interpreter for returning a result. */
- Tk_Window tkwin; /* Window whose display is to be used
- * for the lookup. */
+TkGetInterpNames(
+ Tcl_Interp *interp, /* Interpreter for returning a result. */
+ Tk_Window tkwin) /* Window whose display is to be used for the
+ * lookup. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
- char *p, *entry, *entryName;
NameRegistry *regPtr;
- Window commWindow;
- int count;
- unsigned int id;
+ char *p;
/*
* Read the registry property, then scan through all of its entries.
@@ -1204,10 +1237,13 @@ TkGetInterpNames(interp, tkwin)
*/
regPtr = RegOpen(interp, winPtr->dispPtr, 1);
- for (p = regPtr->property; (p-regPtr->property) < (int) regPtr->propLength; ) {
- entry = p;
- if (sscanf(p, "%x",(unsigned int *) &id) != 1) {
- commWindow = None;
+ for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) {
+ char *entry = p, *entryName;
+ Window commWindow;
+ unsigned int id;
+
+ if (sscanf(p, "%x",(unsigned int *) &id) != 1) {
+ commWindow = None;
} else {
commWindow = id;
}
@@ -1229,13 +1265,15 @@ TkGetInterpNames(interp, tkwin)
Tcl_AppendElement(interp, entryName);
} else {
+ int count;
+
/*
* This name is bogus (perhaps the application died without
- * cleaning up its entry in the registry?). Delete the name.
+ * cleaning up its entry in the registry?). Delete the name.
*/
count = regPtr->propLength - (p - regPtr->property);
- if (count > 0) {
+ if (count > 0) {
char *src, *dst;
for (src = p, dst = entry; count > 0; src++, dst++, count--) {
@@ -1256,9 +1294,8 @@ TkGetInterpNames(interp, tkwin)
*
* TkSendCleanup --
*
- * This procedure is called to free resources used by the
- * communication channels for sending commands and
- * receiving results.
+ * This function is called to free resources used by the communication
+ * channels for sending commands and receiving results.
*
* Results:
* None.
@@ -1270,8 +1307,8 @@ TkGetInterpNames(interp, tkwin)
*/
void
-TkSendCleanup(dispPtr)
- TkDisplay *dispPtr;
+TkSendCleanup(
+ TkDisplay *dispPtr)
{
if (dispPtr->commTkwin != NULL) {
Tk_DeleteEventHandler(dispPtr->commTkwin, PropertyChangeMask,
@@ -1287,9 +1324,8 @@ TkSendCleanup(dispPtr)
*
* SendInit --
*
- * This procedure is called to initialize the
- * communication channels for sending commands and
- * receiving results.
+ * This function is called to initialize the communication channels for
+ * sending commands and receiving results.
*
* Results:
* None.
@@ -1301,23 +1337,23 @@ TkSendCleanup(dispPtr)
*/
static int
-SendInit(interp, dispPtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting
- * (no errors are ever returned, but the
+SendInit(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting (no
+ * errors are ever returned, but the
* interpreter is needed anyway). */
- TkDisplay *dispPtr; /* Display to initialize. */
+ TkDisplay *dispPtr) /* Display to initialize. */
{
XSetWindowAttributes atts;
/*
- * Create the window used for communication, and set up an
- * event handler for it.
+ * Create the window used for communication, and set up an event handler
+ * for it.
*/
dispPtr->commTkwin = Tk_CreateWindow(interp, (Tk_Window) NULL,
"_comm", DisplayString(dispPtr->display));
if (dispPtr->commTkwin == NULL) {
- panic("Tk_CreateWindow failed in SendInit!");
+ Tcl_Panic("Tk_CreateWindow failed in SendInit!");
}
Tcl_Preserve((ClientData) dispPtr->commTkwin);
atts.override_redirect = True;
@@ -1345,37 +1381,35 @@ SendInit(interp, dispPtr)
*
* SendEventProc --
*
- * This procedure is invoked automatically by the toolkit
- * event manager when a property changes on the communication
- * window. This procedure reads the property and handles
- * command requests and responses.
+ * This function is invoked automatically by the toolkit event manager
+ * when a property changes on the communication window. This function
+ * reads the property and handles command requests and responses.
*
* Results:
* None.
*
* Side effects:
- * If there are command requests in the property, they
- * are executed. If there are responses in the property,
- * their information is saved for the (ostensibly waiting)
- * "send" commands. The property is deleted.
+ * If there are command requests in the property, they are executed. If
+ * there are responses in the property, their information is saved for
+ * the (ostensibly waiting) "send" commands. The property is deleted.
*
*--------------------------------------------------------------
*/
static void
-SendEventProc(clientData, eventPtr)
- ClientData clientData; /* Display information. */
- XEvent *eventPtr; /* Information about event. */
+SendEventProc(
+ ClientData clientData, /* Display information. */
+ XEvent *eventPtr) /* Information about event. */
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
- char *propInfo;
+ char *propInfo, **propInfoPtr = &propInfo;
register char *p;
int result, actualFormat;
unsigned long numItems, bytesAfter;
Atom actualType;
Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((eventPtr->xproperty.atom != dispPtr->commProperty)
|| (eventPtr->xproperty.state != PropertyNewValue)) {
@@ -1388,14 +1422,12 @@ SendEventProc(clientData, eventPtr)
propInfo = NULL;
result = XGetWindowProperty(dispPtr->display,
- Tk_WindowId(dispPtr->commTkwin),
- dispPtr->commProperty, 0, MAX_PROP_WORDS, True,
- XA_STRING, &actualType, &actualFormat,
- &numItems, &bytesAfter, (unsigned char **) &propInfo);
+ Tk_WindowId(dispPtr->commTkwin), dispPtr->commProperty, 0,
+ MAX_PROP_WORDS, True, XA_STRING, &actualType, &actualFormat,
+ &numItems, &bytesAfter, (unsigned char **) propInfoPtr);
/*
- * If the property doesn't exist or is improperly formed
- * then ignore it.
+ * If the property doesn't exist or is improperly formed then ignore it.
*/
if ((result != Success) || (actualType != XA_STRING)
@@ -1407,17 +1439,16 @@ SendEventProc(clientData, eventPtr)
}
/*
- * Several commands and results could arrive in the property at
- * one time; each iteration through the outer loop handles a
- * single command or result.
+ * Several commands and results could arrive in the property at one time;
+ * each iteration through the outer loop handles a single command or
+ * result.
*/
for (p = propInfo; (p-propInfo) < (int) numItems; ) {
/*
- * Ignore leading NULLs; each command or result starts with a
- * NULL so that no matter how badly formed a preceding command
- * is, we'll be able to tell that a new command/result is
- * starting.
+ * Ignore leading NULLs; each command or result starts with a NULL so
+ * that no matter how badly formed a preceding command is, we'll be
+ * able to tell that a new command/result is starting.
*/
if (*p == 0) {
@@ -1434,9 +1465,8 @@ SendEventProc(clientData, eventPtr)
/*
*----------------------------------------------------------
* This is an incoming command from some other application.
- * Iterate over all of its options. Stop when we reach
- * the end of the property or something that doesn't look
- * like an option.
+ * Iterate over all of its options. Stop when we reach the end of
+ * the property or something that doesn't look like an option.
*----------------------------------------------------------
*/
@@ -1447,24 +1477,24 @@ SendEventProc(clientData, eventPtr)
script = NULL;
while (((p-propInfo) < (int) numItems) && (*p == '-')) {
switch (p[1]) {
- case 'r':
- commWindow = (Window) strtoul(p+2, &end, 16);
- if ((end == p+2) || (*end != ' ')) {
- commWindow = None;
- } else {
- p = serial = end+1;
- }
- break;
- case 'n':
- if (p[2] == ' ') {
- interpName = p+3;
- }
- break;
- case 's':
- if (p[2] == ' ') {
- script = p+3;
- }
- break;
+ case 'r':
+ commWindow = (Window) strtoul(p+2, &end, 16);
+ if ((end == p+2) || (*end != ' ')) {
+ commWindow = None;
+ } else {
+ p = serial = end+1;
+ }
+ break;
+ case 'n':
+ if (p[2] == ' ') {
+ interpName = p+3;
+ }
+ break;
+ case 's':
+ if (p[2] == ' ') {
+ script = p+3;
+ }
+ break;
}
while (*p != 0) {
p++;
@@ -1477,8 +1507,8 @@ SendEventProc(clientData, eventPtr)
}
/*
- * Initialize the result property, so that we're ready at any
- * time if we need to return an error.
+ * Initialize the result property, so that we're ready at any time
+ * if we need to return an error.
*/
if (commWindow != None) {
@@ -1490,7 +1520,9 @@ SendEventProc(clientData, eventPtr)
if (!ServerSecure(dispPtr)) {
if (commWindow != None) {
- Tcl_DStringAppend(&reply, "X server insecure (must use xauth-style authorization); command ignored", -1);
+ Tcl_DStringAppend(&reply,
+ "X server insecure (must use xauth-style "
+ "authorization); command ignored", -1);
}
result = TCL_ERROR;
goto returnResult;
@@ -1517,66 +1549,65 @@ SendEventProc(clientData, eventPtr)
}
Tcl_Preserve((ClientData) riPtr);
- /*
- * We must protect the interpreter because the script may
- * enter another event loop, which might call Tcl_DeleteInterp.
- */
+ /*
+ * We must protect the interpreter because the script may enter
+ * another event loop, which might call Tcl_DeleteInterp.
+ */
- remoteInterp = riPtr->interp;
- Tcl_Preserve((ClientData) remoteInterp);
+ remoteInterp = riPtr->interp;
+ Tcl_Preserve((ClientData) remoteInterp);
- result = Tcl_GlobalEval(remoteInterp, script);
+ result = Tcl_GlobalEval(remoteInterp, script);
- /*
- * The call to Tcl_Release may have released the interpreter
- * which will cause the "send" command for that interpreter
- * to be deleted. The command deletion callback will set the
- * riPtr->interp field to NULL, hence the check below for NULL.
- */
+ /*
+ * The call to Tcl_Release may have released the interpreter which
+ * will cause the "send" command for that interpreter to be
+ * deleted. The command deletion callback will set the
+ * riPtr->interp field to NULL, hence the check below for NULL.
+ */
if (commWindow != None) {
Tcl_DStringAppend(&reply, Tcl_GetStringResult(remoteInterp),
-1);
if (result == TCL_ERROR) {
CONST char *varValue;
-
+
varValue = Tcl_GetVar2(remoteInterp, "errorInfo",
- (char *) NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
if (varValue != NULL) {
Tcl_DStringAppend(&reply, "\0-i ", 4);
Tcl_DStringAppend(&reply, varValue, -1);
}
varValue = Tcl_GetVar2(remoteInterp, "errorCode",
- (char *) NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
if (varValue != NULL) {
Tcl_DStringAppend(&reply, "\0-e ", 4);
Tcl_DStringAppend(&reply, varValue, -1);
}
}
}
- Tcl_Release((ClientData) remoteInterp);
+ Tcl_Release((ClientData) remoteInterp);
Tcl_Release((ClientData) riPtr);
/*
- * Return the result to the sender if a commWindow was
- * specified (if none was specified then this is an asynchronous
- * call). Right now reply has everything but the completion
- * code, but it needs the NULL to terminate the current option.
+ * Return the result to the sender if a commWindow was specified
+ * (if none was specified then this is an asynchronous call).
+ * Right now reply has everything but the completion code, but it
+ * needs the NULL to terminate the current option.
*/
- returnResult:
+ returnResult:
if (commWindow != None) {
if (result != TCL_OK) {
char buffer[TCL_INTEGER_SPACE];
-
+
sprintf(buffer, "%d", result);
Tcl_DStringAppend(&reply, "\0-c ", 4);
Tcl_DStringAppend(&reply, buffer, -1);
}
(void) AppendPropCarefully(dispPtr->display, commWindow,
dispPtr->commProperty, Tcl_DStringValue(&reply),
- Tcl_DStringLength(&reply) + 1,
- (PendingCommand *) NULL);
+ Tcl_DStringLength(&reply) + 1, NULL);
XFlush(dispPtr->display);
Tcl_DStringFree(&reply);
}
@@ -1587,9 +1618,9 @@ SendEventProc(clientData, eventPtr)
/*
*----------------------------------------------------------
- * This is a reply to some command that we sent out. Iterate
- * over all of its options. Stop when we reach the end of the
- * property or something that doesn't look like an option.
+ * This is a reply to some command that we sent out. Iterate over
+ * all of its options. Stop when we reach the end of the property
+ * or something that doesn't look like an option.
*----------------------------------------------------------
*/
@@ -1601,31 +1632,31 @@ SendEventProc(clientData, eventPtr)
resultString = "";
while (((p-propInfo) < (int) numItems) && (*p == '-')) {
switch (p[1]) {
- case 'c':
- if (sscanf(p+2, " %d", &code) != 1) {
- code = TCL_OK;
- }
- break;
- case 'e':
- if (p[2] == ' ') {
- errorCode = p+3;
- }
- break;
- case 'i':
- if (p[2] == ' ') {
- errorInfo = p+3;
- }
- break;
- case 'r':
- if (p[2] == ' ') {
- resultString = p+3;
- }
- break;
- case 's':
- if (sscanf(p+2, " %d", &serial) == 1) {
- gotSerial = 1;
- }
- break;
+ case 'c':
+ if (sscanf(p+2, " %d", &code) != 1) {
+ code = TCL_OK;
+ }
+ break;
+ case 'e':
+ if (p[2] == ' ') {
+ errorCode = p+3;
+ }
+ break;
+ case 'i':
+ if (p[2] == ' ') {
+ errorInfo = p+3;
+ }
+ break;
+ case 'r':
+ if (p[2] == ' ') {
+ resultString = p+3;
+ }
+ break;
+ case 's':
+ if (sscanf(p+2, " %d", &serial) == 1) {
+ gotSerial = 1;
+ }
+ break;
}
while (*p != 0) {
p++;
@@ -1638,8 +1669,7 @@ SendEventProc(clientData, eventPtr)
}
/*
- * Give the result information to anyone who's
- * waiting for it.
+ * Give the result information to anyone who's waiting for it.
*/
for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
@@ -1670,8 +1700,8 @@ SendEventProc(clientData, eventPtr)
}
} else {
/*
- * Didn't recognize this thing. Just skip through the next
- * null character and try again.
+ * Didn't recognize this thing. Just skip through the next null
+ * character and try again.
*/
while (*p != 0) {
@@ -1688,60 +1718,56 @@ SendEventProc(clientData, eventPtr)
*
* AppendPropCarefully --
*
- * Append a given property to a given window, but set up
- * an X error handler so that if the append fails this
- * procedure can return an error code rather than having
- * Xlib panic.
+ * Append a given property to a given window, but set up an X error
+ * handler so that if the append fails this function can return an error
+ * code rather than having Xlib panic.
*
* Results:
* None.
*
* Side effects:
- * The given property on the given window is appended to.
- * If this operation fails and if pendingPtr is non-NULL,
- * then the pending operation is marked as complete with
- * an error.
+ * The given property on the given window is appended to. If this
+ * operation fails and if pendingPtr is non-NULL, then the pending
+ * operation is marked as complete with an error.
*
*--------------------------------------------------------------
*/
static void
-AppendPropCarefully(display, window, property, value, length, pendingPtr)
- Display *display; /* Display on which to operate. */
- Window window; /* Window whose property is to
- * be modified. */
- Atom property; /* Name of property. */
- char *value; /* Characters to append to property. */
- int length; /* Number of bytes to append. */
- PendingCommand *pendingPtr; /* Pending command to mark complete
- * if an error occurs during the
- * property op. NULL means just
- * ignore the error. */
+AppendPropCarefully(
+ Display *display, /* Display on which to operate. */
+ Window window, /* Window whose property is to be modified. */
+ Atom property, /* Name of property. */
+ char *value, /* Characters to append to property. */
+ int length, /* Number of bytes to append. */
+ PendingCommand *pendingPtr) /* Pending command to mark complete if an
+ * error occurs during the property op. NULL
+ * means just ignore the error. */
{
Tk_ErrorHandler handler;
handler = Tk_CreateErrorHandler(display, -1, -1, -1, AppendErrorProc,
- (ClientData) pendingPtr);
+ (ClientData) pendingPtr);
XChangeProperty(display, window, property, XA_STRING, 8,
PropModeAppend, (unsigned char *) value, length);
Tk_DeleteErrorHandler(handler);
}
/*
- * The procedure below is invoked if an error occurs during
- * the XChangeProperty operation above.
+ * The function below is invoked if an error occurs during the XChangeProperty
+ * operation above.
*/
/* ARGSUSED */
static int
-AppendErrorProc(clientData, errorPtr)
- ClientData clientData; /* Command to mark complete, or NULL. */
- XErrorEvent *errorPtr; /* Information about error. */
+AppendErrorProc(
+ ClientData clientData, /* Command to mark complete, or NULL. */
+ XErrorEvent *errorPtr) /* Information about error. */
{
PendingCommand *pendingPtr = (PendingCommand *) clientData;
register PendingCommand *pcPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (pendingPtr == NULL) {
return 0;
@@ -1771,8 +1797,8 @@ AppendErrorProc(clientData, errorPtr)
*
* DeleteProc --
*
- * This procedure is invoked by Tcl when the "send" command
- * is deleted in an interpreter. It unregisters the interpreter.
+ * This function is invoked by Tcl when the "send" command is deleted in
+ * an interpreter. It unregisters the interpreter.
*
* Results:
* None.
@@ -1784,15 +1810,15 @@ AppendErrorProc(clientData, errorPtr)
*/
static void
-DeleteProc(clientData)
- ClientData clientData; /* Info about registration, passed
- * as ClientData. */
+DeleteProc(
+ ClientData clientData) /* Info about registration, passed as
+ * ClientData. */
{
RegisteredInterp *riPtr = (RegisteredInterp *) clientData;
register RegisteredInterp *riPtr2;
NameRegistry *regPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1);
RegDeleteName(regPtr, riPtr->name);
@@ -1820,13 +1846,12 @@ DeleteProc(clientData)
*
* SendRestrictProc --
*
- * This procedure filters incoming events when a "send" command
- * is outstanding. It defers all events except those containing
- * send commands and results.
+ * This function filters incoming events when a "send" command is
+ * outstanding. It defers all events except those containing send
+ * commands and results.
*
* Results:
- * False is returned except for property-change events on a
- * commWindow.
+ * False is returned except for property-change events on a commWindow.
*
* Side effects:
* None.
@@ -1836,17 +1861,17 @@ DeleteProc(clientData)
/* ARGSUSED */
static Tk_RestrictAction
-SendRestrictProc(clientData, eventPtr)
- ClientData clientData; /* Not used. */
- register XEvent *eventPtr; /* Event that just arrived. */
+SendRestrictProc(
+ ClientData clientData, /* Not used. */
+ register XEvent *eventPtr) /* Event that just arrived. */
{
TkDisplay *dispPtr;
if (eventPtr->type != PropertyNotify) {
return TK_DEFER_EVENT;
}
- for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
- dispPtr = dispPtr->nextPtr) {
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
+ dispPtr = dispPtr->nextPtr) {
if ((eventPtr->xany.display == dispPtr->display)
&& (eventPtr->xproperty.window
== Tk_WindowId(dispPtr->commTkwin))) {
@@ -1861,9 +1886,9 @@ SendRestrictProc(clientData, eventPtr)
*
* UpdateCommWindow --
*
- * This procedure updates the list of application names stored
- * on our commWindow. It is typically called when interpreters
- * are registered and unregistered.
+ * This function updates the list of application names stored on our
+ * commWindow. It is typically called when interpreters are registered
+ * and unregistered.
*
* Results:
* None.
@@ -1875,18 +1900,18 @@ SendRestrictProc(clientData, eventPtr)
*/
static void
-UpdateCommWindow(dispPtr)
- TkDisplay *dispPtr; /* Display whose commWindow is to be
+UpdateCommWindow(
+ TkDisplay *dispPtr) /* Display whose commWindow is to be
* updated. */
{
Tcl_DString names;
RegisteredInterp *riPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DStringInit(&names);
- for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
- riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
Tcl_DStringAppendElement(&names, riPtr->name);
}
XChangeProperty(dispPtr->display, Tk_WindowId(dispPtr->commTkwin),
@@ -1895,3 +1920,119 @@ UpdateCommWindow(dispPtr)
Tcl_DStringLength(&names));
Tcl_DStringFree(&names);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpTestsendCmd --
+ *
+ * This function implements the "testsend" command. It provides a set of
+ * functions for testing the "send" command and support function in
+ * tkSend.c.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Depends on option; see below.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ /* ARGSUSED */
+int
+TkpTestsendCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
+{
+ TkWindow *winPtr = (TkWindow *) clientData;
+
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
+ " option ?arg ...?\"", NULL);
+ return TCL_ERROR;
+ }
+
+ if (strcmp(argv[1], "bogus") == 0) {
+ XChangeProperty(winPtr->dispPtr->display,
+ RootWindow(winPtr->dispPtr->display, 0),
+ winPtr->dispPtr->registryProperty, XA_INTEGER, 32,
+ PropModeReplace,
+ (unsigned char *) "This is bogus information", 6);
+ } else if (strcmp(argv[1], "prop") == 0) {
+ int result, actualFormat;
+ unsigned long length, bytesAfter;
+ Atom actualType, propName;
+ char *property, **propertyPtr = &property, *p, *end;
+ Window w;
+
+ if ((argc != 4) && (argc != 5)) {
+ Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
+ " prop window name ?value ?\"", NULL);
+ return TCL_ERROR;
+ }
+ if (strcmp(argv[2], "root") == 0) {
+ w = RootWindow(winPtr->dispPtr->display, 0);
+ } else if (strcmp(argv[2], "comm") == 0) {
+ w = Tk_WindowId(winPtr->dispPtr->commTkwin);
+ } else {
+ w = strtoul(argv[2], &end, 0);
+ }
+ propName = Tk_InternAtom((Tk_Window) winPtr, argv[3]);
+ if (argc == 4) {
+ property = NULL;
+ result = XGetWindowProperty(winPtr->dispPtr->display, w, propName,
+ 0, 100000, False, XA_STRING, &actualType, &actualFormat,
+ &length, &bytesAfter, (unsigned char **) propertyPtr);
+ if ((result == Success) && (actualType != None)
+ && (actualFormat == 8) && (actualType == XA_STRING)) {
+ for (p = property; (unsigned long)(p-property) < length; p++) {
+ if (*p == 0) {
+ *p = '\n';
+ }
+ }
+ Tcl_SetResult(interp, property, TCL_VOLATILE);
+ }
+ if (property != NULL) {
+ XFree(property);
+ }
+ } else if (argv[4][0] == 0) {
+ XDeleteProperty(winPtr->dispPtr->display, w, propName);
+ } else {
+ Tcl_DString tmp;
+
+ Tcl_DStringInit(&tmp);
+ for (p = Tcl_DStringAppend(&tmp, argv[4],
+ (int) strlen(argv[4])); *p != 0; p++) {
+ if (*p == '\n') {
+ *p = 0;
+ }
+ }
+
+ XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING,
+ 8, PropModeReplace, (unsigned char*)Tcl_DStringValue(&tmp),
+ p-Tcl_DStringValue(&tmp));
+ Tcl_DStringFree(&tmp);
+ }
+ } else if (strcmp(argv[1], "serial") == 0) {
+ char buf[TCL_INTEGER_SPACE];
+
+ sprintf(buf, "%d", localData.sendSerial+1);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ } else {
+ Tcl_AppendResult(interp, "bad option \"", argv[1],
+ "\": must be bogus, prop, or serial", NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 1ab5980..1d66412 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -2,159 +2,174 @@
* tkUnixWm.c --
*
* This module takes care of the interactions between a Tk-based
- * application and the window manager. Among other things, it
- * implements the "wm" command and passes geometry information
- * to the window manager.
+ * application and the window manager. Among other things, it implements
+ * the "wm" command and passes geometry information to the window
+ * manager.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
-#include "tkInt.h"
#include "tkUnixInt.h"
/*
- * A data structure of the following type holds information for
- * each window manager protocol (such as WM_DELETE_WINDOW) for
- * which a handler (i.e. a Tcl command) has been defined for a
- * particular top-level window.
+ * A data structure of the following type holds information for each window
+ * manager protocol (such as WM_DELETE_WINDOW) for which a handler (i.e. a Tcl
+ * command) has been defined for a particular top-level window.
*/
typedef struct ProtocolHandler {
Atom protocol; /* Identifies the protocol. */
struct ProtocolHandler *nextPtr;
- /* Next in list of protocol handlers for
- * the same top-level window, or NULL for
- * end of list. */
+ /* Next in list of protocol handlers for the
+ * same top-level window, or NULL for end of
+ * list. */
Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[4]; /* Tcl command to invoke when a client
- * message for this protocol arrives.
- * The actual size of the structure varies
- * to accommodate the needs of the actual
- * command. THIS MUST BE THE LAST FIELD OF
- * THE STRUCTURE. */
+ char command[4]; /* Tcl command to invoke when a client message
+ * for this protocol arrives. The actual size
+ * of the structure varies to accommodate the
+ * needs of the actual command. THIS MUST BE
+ * THE LAST FIELD OF THE STRUCTURE. */
} ProtocolHandler;
#define HANDLER_SIZE(cmdLength) \
((unsigned) (sizeof(ProtocolHandler) - 3 + cmdLength))
/*
+ * Data for [wm attributes] command:
+ */
+typedef struct {
+ double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */
+ int topmost; /* Flag: true=>stay-on-top */
+ int zoomed; /* Flag: true=>maximized */
+ int fullscreen; /* Flag: true=>fullscreen */
+} WmAttributes;
+
+typedef enum {
+ WMATT_ALPHA, WMATT_TOPMOST, WMATT_ZOOMED, WMATT_FULLSCREEN,
+ WMATT_TYPE, _WMATT_LAST_ATTRIBUTE
+} WmAttribute;
+
+static const char *WmAttributeNames[] = {
+ "-alpha", "-topmost", "-zoomed", "-fullscreen",
+ "-type", NULL
+};
+
+/*
* A data structure of the following type holds window-manager-related
* information for each top-level window in an application.
*/
typedef struct TkWmInfo {
- TkWindow *winPtr; /* Pointer to main Tk information for
- * this window. */
+ TkWindow *winPtr; /* Pointer to main Tk information for this
+ * window. */
Window reparent; /* If the window has been reparented, this
* gives the ID of the ancestor of the window
- * that is a child of the root window (may
- * not be window's immediate parent). If
- * the window isn't reparented, this has the
- * value None. */
- char *title; /* Title to display in window caption. If
- * NULL, use name of widget. Malloced. */
- char *iconName; /* Name to display in icon. Malloced. */
- XWMHints hints; /* Various pieces of information for
- * window manager. */
+ * that is a child of the root window (may not
+ * be window's immediate parent). If the
+ * window isn't reparented, this has the value
+ * None. */
+ char *title; /* Title to display in window caption. If
+ * NULL, use name of widget. Malloced. */
+ char *iconName; /* Name to display in icon. Malloced. */
+ XWMHints hints; /* Various pieces of information for window
+ * manager. */
char *leaderName; /* Path name of leader of window group
* (corresponds to hints.window_group).
- * Malloc-ed. Note: this field doesn't
- * get updated if leader is destroyed. */
+ * Malloc-ed. Note: this field doesn't get
+ * updated if leader is destroyed. */
TkWindow *masterPtr; /* Master window for TRANSIENT_FOR property,
* or NULL. */
- Tk_Window icon; /* Window to use as icon for this window,
- * or NULL. */
+ Tk_Window icon; /* Window to use as icon for this window, or
+ * NULL. */
Tk_Window iconFor; /* Window for which this window is icon, or
* NULL if this isn't an icon for anyone. */
int withdrawn; /* Non-zero means window has been withdrawn. */
/*
* In order to support menubars transparently under X, each toplevel
- * window is encased in an additional window, called the wrapper,
- * that holds the toplevel and the menubar, if any. The information
- * below is used to keep track of the wrapper and the menubar.
+ * window is encased in an additional window, called the wrapper, that
+ * holds the toplevel and the menubar, if any. The information below is
+ * used to keep track of the wrapper and the menubar.
*/
TkWindow *wrapperPtr; /* Pointer to information about the wrapper.
- * This is the "real" toplevel window as
- * seen by the window manager. Although
- * this is an official Tk window, it
- * doesn't appear in the application's
- * window hierarchy. NULL means that
- * the wrapper hasn't been created yet. */
- Tk_Window menubar; /* Pointer to information about the
- * menubar, or NULL if there is no
- * menubar for this toplevel. */
+ * This is the "real" toplevel window as seen
+ * by the window manager. Although this is an
+ * official Tk window, it doesn't appear in
+ * the application's window hierarchy. NULL
+ * means that the wrapper hasn't been created
+ * yet. */
+ Tk_Window menubar; /* Pointer to information about the menubar,
+ * or NULL if there is no menubar for this
+ * toplevel. */
int menuHeight; /* Amount of vertical space needed for
- * menubar, measured in pixels. If
- * menubar is non-NULL, this is >= 1 (X
- * servers don't like dimensions of 0). */
+ * menubar, measured in pixels. If menubar is
+ * non-NULL, this is >= 1 (X servers don't
+ * like dimensions of 0). */
/*
- * Information used to construct an XSizeHints structure for
- * the window manager:
+ * Information used to construct an XSizeHints structure for the window
+ * manager:
*/
- int sizeHintsFlags; /* Flags word for XSizeHints structure.
- * If the PBaseSize flag is set then the
- * window is gridded; otherwise it isn't
- * gridded. */
- int minWidth, minHeight; /* Minimum dimensions of window, in
- * pixels or grid units. */
- int maxWidth, maxHeight; /* Maximum dimensions of window, in
- * pixels or grid units. 0 to default.*/
+ int sizeHintsFlags; /* Flags word for XSizeHints structure. If the
+ * PBaseSize flag is set then the window is
+ * gridded; otherwise it isn't gridded. */
+ int minWidth, minHeight; /* Minimum dimensions of window, in pixels or
+ * grid units. */
+ int maxWidth, maxHeight; /* Maximum dimensions of window, in pixels or
+ * grid units. 0 to default.*/
Tk_Window gridWin; /* Identifies the window that controls
- * gridding for this top-level, or NULL if
- * the top-level isn't currently gridded. */
- int widthInc, heightInc; /* Increments for size changes (# pixels
- * per step). */
+ * gridding for this top-level, or NULL if the
+ * top-level isn't currently gridded. */
+ int widthInc, heightInc; /* Increments for size changes (# pixels per
+ * step). */
struct {
- int x; /* numerator */
- int y; /* denominator */
+ int x; /* numerator */
+ int y; /* denominator */
} minAspect, maxAspect; /* Min/max aspect ratios for window. */
int reqGridWidth, reqGridHeight;
- /* The dimensions of the window (in
- * grid units) requested through
- * the geometry manager. */
+ /* The dimensions of the window (in grid
+ * units) requested through the geometry
+ * manager. */
int gravity; /* Desired window gravity. */
/*
* Information used to manage the size and location of a window.
*/
- int width, height; /* Desired dimensions of window, specified
- * in pixels or grid units. These values are
- * set by the "wm geometry" command and by
- * ConfigureNotify events (for when wm
- * resizes window). -1 means user hasn't
- * requested dimensions. */
+ int width, height; /* Desired dimensions of window, specified in
+ * pixels or grid units. These values are set
+ * by the "wm geometry" command and by
+ * ConfigureNotify events (for when wm resizes
+ * window). -1 means user hasn't requested
+ * dimensions. */
int x, y; /* Desired X and Y coordinates for window.
- * These values are set by "wm geometry",
- * plus by ConfigureNotify events (when wm
- * moves window). These numbers are
- * different than the numbers stored in
- * winPtr->changes because (a) they could be
- * measured from the right or bottom edge
- * of the screen (see WM_NEGATIVE_X and
- * WM_NEGATIVE_Y flags) and (b) if the window
- * has been reparented then they refer to the
- * parent rather than the window itself. */
+ * These values are set by "wm geometry", plus
+ * by ConfigureNotify events (when wm moves
+ * window). These numbers are different than
+ * the numbers stored in winPtr->changes
+ * because (a) they could be measured from the
+ * right or bottom edge of the screen (see
+ * WM_NEGATIVE_X and WM_NEGATIVE_Y flags) and
+ * (b) if the window has been reparented then
+ * they refer to the parent rather than the
+ * window itself. */
int parentWidth, parentHeight;
/* Width and height of reparent, in pixels
- * *including border*. If window hasn't been
+ * *including border*. If window hasn't been
* reparented then these will be the outer
* dimensions of the window, including
* border. */
int xInParent, yInParent; /* Offset of wrapperPtr within reparent,
* measured in pixels from upper-left outer
* corner of reparent's border to upper-left
- * outer corner of wrapperPtr's border. If
- * not reparented then these are zero. */
+ * outer corner of wrapperPtr's border. If not
+ * reparented then these are zero. */
int configWidth, configHeight;
/* Dimensions passed to last request that we
* issued to change geometry of the wrapper.
@@ -162,35 +177,36 @@ typedef struct TkWmInfo {
* operations. */
/*
- * Information about the virtual root window for this top-level,
- * if there is one.
+ * Information about the virtual root window for this top-level, if there
+ * is one.
*/
- Window vRoot; /* Virtual root window for this top-level,
- * or None if there is no virtual root
- * window (i.e. just use the screen's root). */
+ Window vRoot; /* Virtual root window for this top-level, or
+ * None if there is no virtual root window
+ * (i.e. just use the screen's root). */
int vRootX, vRootY; /* Position of the virtual root inside the
- * root window. If the WM_VROOT_OFFSET_STALE
+ * root window. If the WM_VROOT_OFFSET_STALE
* flag is set then this information may be
* incorrect and needs to be refreshed from
- * the X server. If vRoot is None then these
+ * the X server. If vRoot is None then these
* values are both 0. */
- int vRootWidth, vRootHeight;/* Dimensions of the virtual root window.
- * If vRoot is None, gives the dimensions
- * of the containing screen. This information
- * is never stale, even though vRootX and
- * vRootY can be. */
+ int vRootWidth, vRootHeight;/* Dimensions of the virtual root window. If
+ * vRoot is None, gives the dimensions of the
+ * containing screen. This information is
+ * never stale, even though vRootX and vRootY
+ * can be. */
/*
* Miscellaneous information.
*/
- ProtocolHandler *protPtr; /* First in list of protocol handlers for
- * this window (NULL means none). */
+ WmAttributes attributes; /* Current state of [wm attributes] */
+ WmAttributes reqState; /* Requested state of [wm attributes] */
+ ProtocolHandler *protPtr; /* First in list of protocol handlers for this
+ * window (NULL means none). */
int cmdArgc; /* Number of elements in cmdArgv below. */
- CONST char **cmdArgv; /* Array of strings to store in the
- * WM_COMMAND property. NULL means nothing
- * available. */
+ CONST char **cmdArgv; /* Array of strings to store in the WM_COMMAND
+ * property. NULL means nothing available. */
char *clientMachine; /* String to store in WM_CLIENT_MACHINE
* property, or NULL. */
int flags; /* Miscellaneous flags, defined below. */
@@ -203,15 +219,15 @@ typedef struct TkWmInfo {
/*
* Flag values for WmInfo structures:
*
- * WM_NEVER_MAPPED - non-zero means window has never been
- * mapped; need to update all info when
- * window is first mapped.
+ * WM_NEVER_MAPPED - non-zero means window has never been mapped;
+ * need to update all info when window is first
+ * mapped.
* WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo
- * has already been scheduled for this
- * window; no need to schedule another one.
+ * has already been scheduled for this window;
+ * no need to schedule another one.
* WM_NEGATIVE_X - non-zero means x-coordinate is measured in
- * pixels from right edge of screen, rather
- * than from left edge.
+ * pixels from right edge of screen, rather than
+ * from left edge.
* WM_NEGATIVE_Y - non-zero means y-coordinate is measured in
* pixels up from bottom of screen, rather than
* down from top.
@@ -222,27 +238,24 @@ typedef struct TkWmInfo {
* WM_VROOT_OFFSET_STALE - non-zero means that (x,y) offset information
* about the virtual root window is stale and
* needs to be fetched fresh from the X server.
- * WM_ABOUT_TO_MAP - non-zero means that the window is about to
- * be mapped by TkWmMapWindow. This is used
- * by UpdateGeometryInfo to modify its behavior.
- * WM_MOVE_PENDING - non-zero means the application has requested
- * a new position for the window, but it hasn't
- * been reflected through the window manager
- * yet.
- * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were
- * set explicitly via "wm colormapwindows".
+ * WM_ABOUT_TO_MAP - non-zero means that the window is about to be
+ * mapped by TkWmMapWindow. This is used by
+ * UpdateGeometryInfo to modify its behavior.
+ * WM_MOVE_PENDING - non-zero means the application has requested a
+ * new position for the window, but it hasn't
+ * been reflected through the window manager yet.
+ * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were set
+ * explicitly via "wm colormapwindows".
* WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows"
* was called the top-level itself wasn't
- * specified, so we added it implicitly at
- * the end of the list.
+ * specified, so we added it implicitly at the
+ * end of the list.
* WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to
* allow the user to change the width of the
- * window (controlled by "wm resizable"
- * command).
+ * window (controlled by "wm resizable" command).
* WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to
* allow the user to change the height of the
- * window (controlled by "wm resizable"
- * command).
+ * window (controlled by "wm resizable" command).
* WM_WITHDRAWN - non-zero means that this window has explicitly
* been withdrawn. If it's a transient, it should
* not mirror state changes in the master.
@@ -261,12 +274,12 @@ typedef struct TkWmInfo {
#define WM_ADDED_TOPLEVEL_COLORMAP 0x800
#define WM_WIDTH_NOT_RESIZABLE 0x1000
#define WM_HEIGHT_NOT_RESIZABLE 0x2000
-#define WM_WITHDRAWN 0x4000
+#define WM_WITHDRAWN 0x4000
/*
- * This module keeps a list of all top-level windows, primarily to
- * simplify the job of Tk_CoordsToWindow. The list is called
- * firstWmPtr and is stored in the TkDisplay structure.
+ * This module keeps a list of all top-level windows, primarily to simplify
+ * the job of Tk_CoordsToWindow. The list is called firstWmPtr and is stored
+ * in the TkDisplay structure.
*/
/*
@@ -274,22 +287,19 @@ typedef struct TkWmInfo {
* management of top-level and menubar windows.
*/
-static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
- Tk_Window tkwin));
+static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
+static void RemapWindows(TkWindow *winPtr, TkWindow *parentPtr);
+static void MenubarReqProc(ClientData clientData, Tk_Window tkwin);
-static Tk_GeomMgr wmMgrType = {
+static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
+ NULL, /* lostSlaveProc */
};
-
-static void MenubarReqProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-
-static Tk_GeomMgr menubarMgrType = {
+static const Tk_GeomMgr menubarMgrType = {
"menubar", /* name */
MenubarReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
+ NULL, /* lostSlaveProc */
};
/*
@@ -302,161 +312,160 @@ typedef struct WaitRestrictInfo {
WmInfo *wmInfoPtr;
int type; /* We only care about this type of event. */
XEvent *eventPtr; /* Where to store the event when it's found. */
- int foundEvent; /* Non-zero means that an event of the
- * desired type has been found. */
+ int foundEvent; /* Non-zero means that an event of the desired
+ * type has been found. */
} WaitRestrictInfo;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static int ComputeReparentGeometry _ANSI_ARGS_((WmInfo *wmPtr));
-static void ConfigureEvent _ANSI_ARGS_((WmInfo *wmPtr,
- XConfigureEvent *eventPtr));
-static void CreateWrapper _ANSI_ARGS_((WmInfo *wmPtr));
-static void GetMaxSize _ANSI_ARGS_((WmInfo *wmPtr,
- int *maxWidthPtr, int *maxHeightPtr));
-static void MenubarDestroyProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int ParseGeometry _ANSI_ARGS_((Tcl_Interp *interp,
- char *string, TkWindow *winPtr));
-static void ReparentEvent _ANSI_ARGS_((WmInfo *wmPtr,
- XReparentEvent *eventPtr));
-static int SetNetWmType _ANSI_ARGS_((TkWindow *winPtr,
- Tcl_Obj *typePtr));
-static Tcl_Obj * GetNetWmType _ANSI_ARGS_((TkWindow *winPtr));
-static void TkSetTransientFor _ANSI_ARGS_((Tk_Window tkwin,
- Tk_Window parent));
-static void TkWmStackorderToplevelWrapperMap _ANSI_ARGS_((
- TkWindow *winPtr,
- Display *display,
- Tcl_HashTable *reparentTable));
-static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
- Tk_Window tkwin));
-static void UpdateCommand _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdateGeometryInfo _ANSI_ARGS_((
- ClientData clientData));
-static void UpdateHints _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdateSizeHints _ANSI_ARGS_((TkWindow *winPtr,
- int newWidth, int newHeight));
-static void UpdateTitle _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdatePhotoIcon _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdateVRootGeometry _ANSI_ARGS_((WmInfo *wmPtr));
-static void UpdateWmProtocols _ANSI_ARGS_((WmInfo *wmPtr));
-static void WaitForConfigureNotify _ANSI_ARGS_((TkWindow *winPtr,
- unsigned long serial));
-static int WaitForEvent _ANSI_ARGS_((Display *display,
- WmInfo *wmInfoPtr, int type, XEvent *eventPtr));
-static void WaitForMapNotify _ANSI_ARGS_((TkWindow *winPtr,
- int mapped));
+static int ComputeReparentGeometry(WmInfo *wmPtr);
+static void ConfigureEvent(WmInfo *wmPtr,
+ XConfigureEvent *eventPtr);
+static void CreateWrapper(WmInfo *wmPtr);
+static void GetMaxSize(WmInfo *wmPtr, int *maxWidthPtr,
+ int *maxHeightPtr);
+static void MenubarDestroyProc(ClientData clientData,
+ XEvent *eventPtr);
+static int ParseGeometry(Tcl_Interp *interp, char *string,
+ TkWindow *winPtr);
+static void ReparentEvent(WmInfo *wmPtr, XReparentEvent *eventPtr);
+static void PropertyEvent(WmInfo *wmPtr, XPropertyEvent *eventPtr);
+static void TkWmStackorderToplevelWrapperMap(TkWindow *winPtr,
+ Display *display, Tcl_HashTable *reparentTable);
+static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
+static void RemapWindows(TkWindow *winPtr, TkWindow *parentPtr);
+static void UpdateCommand(TkWindow *winPtr);
+static void UpdateGeometryInfo(ClientData clientData);
+static void UpdateHints(TkWindow *winPtr);
+static void UpdateSizeHints(TkWindow *winPtr,
+ int newWidth, int newHeight);
+static void UpdateTitle(TkWindow *winPtr);
+static void UpdatePhotoIcon(TkWindow *winPtr);
+static void UpdateVRootGeometry(WmInfo *wmPtr);
+static void UpdateWmProtocols(WmInfo *wmPtr);
+static int SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr);
+static Tcl_Obj * GetNetWmType(TkWindow *winPtr);
+static void SetNetWmState(TkWindow*, const char *atomName, int on);
+static void CheckNetWmState(WmInfo *, Atom *atoms, int numAtoms);
+static void UpdateNetWmState(WmInfo *);
+static void WaitForConfigureNotify(TkWindow *winPtr,
+ unsigned long serial);
+static int WaitForEvent(Display *display,
+ WmInfo *wmInfoPtr, int type, XEvent *eventPtr);
+static void WaitForMapNotify(TkWindow *winPtr, int mapped);
static Tk_RestrictAction
- WaitRestrictProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void WrapperEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void WmWaitMapProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-
-static int WmAspectCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmAttributesCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmClientCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmColormapwindowsCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmCommandCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmDeiconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFocusmodelCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFrameCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGeometryCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGridCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGroupCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconbitmapCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconmaskCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconnameCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconphotoCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconpositionCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconwindowCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMaxsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMinsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmOverrideredirectCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmPositionfromCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmProtocolCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmResizableCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmSizefromCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStackorderCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStateCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTitleCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTransientCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr,
- TkWindow *winPtr));
+ WaitRestrictProc(ClientData clientData,
+ XEvent *eventPtr);
+static void WrapperEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void WmWaitMapProc(ClientData clientData, XEvent *eventPtr);
+static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmColormapwindowsCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmOverrideredirectCmd(Tk_Window tkwin,TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
/*
*--------------------------------------------------------------
*
* TkWmCleanup --
*
- * This procedure is invoked to cleanup remaining wm resources
- * associated with a display.
+ * This function is invoked to cleanup remaining wm resources associated
+ * with a display.
*
* Results:
* None.
@@ -467,15 +476,17 @@ static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr,
*--------------------------------------------------------------
*/
-void TkWmCleanup(dispPtr)
- TkDisplay *dispPtr;
+void TkWmCleanup(
+ TkDisplay *dispPtr)
{
WmInfo *wmPtr, *nextPtr;
+
for (wmPtr = dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = nextPtr) {
/*
- * We can't assume we have access to winPtr's anymore, so some
- * cleanup requiring winPtr data is avoided.
+ * We can't assume we have access to winPtr's anymore, so some cleanup
+ * requiring winPtr data is avoided.
*/
+
nextPtr = wmPtr->nextPtr;
if (wmPtr->title != NULL) {
ckfree(wmPtr->title);
@@ -484,7 +495,7 @@ void TkWmCleanup(dispPtr)
ckfree(wmPtr->iconName);
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *)wmPtr->iconDataPtr);
+ ckfree((char *) wmPtr->iconDataPtr);
}
if (wmPtr->leaderName != NULL) {
ckfree(wmPtr->leaderName);
@@ -511,7 +522,7 @@ void TkWmCleanup(dispPtr)
ckfree((char *) wmPtr);
}
if (dispPtr->iconDataPtr != NULL) {
- ckfree((char *)dispPtr->iconDataPtr);
+ ckfree((char *) dispPtr->iconDataPtr);
dispPtr->iconDataPtr = NULL;
}
}
@@ -521,9 +532,8 @@ void TkWmCleanup(dispPtr)
*
* TkWmNewWindow --
*
- * This procedure is invoked whenever a new top-level
- * window is created. Its job is to initialize the WmInfo
- * structure for the window.
+ * This function is invoked whenever a new top-level window is created.
+ * Its job is to initialize the WmInfo structure for the window.
*
* Results:
* None.
@@ -535,8 +545,8 @@ void TkWmCleanup(dispPtr)
*/
void
-TkWmNewWindow(winPtr)
- TkWindow *winPtr; /* Newly-created top-level window. */
+TkWmNewWindow(
+ TkWindow *winPtr) /* Newly-created top-level window. */
{
register WmInfo *wmPtr;
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -557,8 +567,17 @@ TkWmNewWindow(winPtr)
wmPtr->hints.window_group = None;
/*
- * Default the maximum dimensions to the size of the display, minus
- * a guess about how space is needed for window manager decorations.
+ * Initialize attributes.
+ */
+ wmPtr->attributes.alpha = 1.0;
+ wmPtr->attributes.topmost = 0;
+ wmPtr->attributes.zoomed = 0;
+ wmPtr->attributes.fullscreen = 0;
+ wmPtr->reqState = wmPtr->attributes;
+
+ /*
+ * Default the maximum dimensions to the size of the display, minus a
+ * guess about how space is needed for window manager decorations.
*/
wmPtr->gridWin = NULL;
@@ -588,8 +607,8 @@ TkWmNewWindow(winPtr)
UpdateVRootGeometry(wmPtr);
/*
- * Arrange for geometry requests to be reflected from the window
- * to the window manager.
+ * Arrange for geometry requests to be reflected from the window to the
+ * window manager.
*/
Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
@@ -600,28 +619,28 @@ TkWmNewWindow(winPtr)
*
* TkWmMapWindow --
*
- * This procedure is invoked to map a top-level window. This
- * module gets a chance to update all window-manager-related
- * information in properties before the window manager sees
- * the map event and checks the properties. It also gets to
- * decide whether or not to even map the window after all.
+ * This function is invoked to map a top-level window. This module gets a
+ * chance to update all window-manager-related information in properties
+ * before the window manager sees the map event and checks the
+ * properties. It also gets to decide whether or not to even map the
+ * window after all.
*
* Results:
* None.
*
* Side effects:
- * Properties of winPtr may get updated to provide up-to-date
- * information to the window manager. The window may also get
- * mapped, but it may not be if this procedure decides that
- * isn't appropriate (e.g. because the window is withdrawn).
+ * Properties of winPtr may get updated to provide up-to-date information
+ * to the window manager. The window may also get mapped, but it may not
+ * be if this function decides that isn't appropriate (e.g. because the
+ * window is withdrawn).
*
*--------------------------------------------------------------
*/
void
-TkWmMapWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's about to
- * be mapped. */
+TkWmMapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
XTextProperty textProp;
@@ -632,9 +651,8 @@ TkWmMapWindow(winPtr)
wmPtr->flags &= ~WM_NEVER_MAPPED;
/*
- * This is the first time this window has ever been mapped.
- * First create the wrapper window that provides space for a
- * menubar.
+ * This is the first time this window has ever been mapped. First
+ * create the wrapper window that provides space for a menubar.
*/
if (wmPtr->wrapperPtr == NULL) {
@@ -642,8 +660,7 @@ TkWmMapWindow(winPtr)
}
/*
- * Store all the window-manager-related information for the
- * window.
+ * Store all the window-manager-related information for the window.
*/
TkWmSetClass(winPtr);
@@ -656,12 +673,17 @@ TkWmMapWindow(winPtr)
*/
if (!Tk_IsMapped(wmPtr->masterPtr)) {
- wmPtr->withdrawn = 1;
- wmPtr->hints.initial_state = WithdrawnState;
- } else {
- XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window,
- wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
+ wmPtr->withdrawn = 1;
+ wmPtr->hints.initial_state = WithdrawnState;
}
+
+ /*
+ * Make sure that we actually set the transient-for property, even
+ * if we are withdrawn. [Bug 1163496]
+ */
+
+ XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window,
+ wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
}
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
@@ -674,9 +696,24 @@ TkWmMapWindow(winPtr)
Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
&textProp) != 0) {
+ unsigned long pid = (unsigned long) getpid();
+ Atom atom;
+
XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
&textProp);
XFree((char *) textProp.value);
+
+ /*
+ * Inform the server (and more particularly any session
+ * manager) what our process ID is. We only do this when the
+ * CLIENT_MACHINE property is set since the spec for
+ * _NET_WM_PID requires that to be set too.
+ */
+
+ atom = Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PID");
+ XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
+ atom, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &pid, 1);
}
Tcl_DStringFree(&ds);
}
@@ -686,9 +723,8 @@ TkWmMapWindow(winPtr)
}
if (wmPtr->iconFor != NULL) {
/*
- * This window is an icon for somebody else. Make sure that
- * the geometry is up-to-date, then return without mapping
- * the window.
+ * This window is an icon for somebody else. Make sure that the
+ * geometry is up-to-date, then return without mapping the window.
*/
if (wmPtr->flags & WM_UPDATE_PENDING) {
@@ -705,6 +741,11 @@ TkWmMapWindow(winPtr)
wmPtr->flags &= ~WM_ABOUT_TO_MAP;
/*
+ * Update _NET_WM_STATE hints:
+ */
+ UpdateNetWmState(wmPtr);
+
+ /*
* Map the window, then wait to be sure that the window manager has
* processed the map operation.
*/
@@ -720,9 +761,8 @@ TkWmMapWindow(winPtr)
*
* TkWmUnmapWindow --
*
- * This procedure is invoked to unmap a top-level window. The
- * only thing it does special is to wait for the window actually
- * to be unmapped.
+ * This function is invoked to unmap a top-level window. The only thing
+ * it does special is to wait for the window actually to be unmapped.
*
* Results:
* None.
@@ -734,20 +774,20 @@ TkWmMapWindow(winPtr)
*/
void
-TkWmUnmapWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's about to
- * be mapped. */
+TkWmUnmapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
/*
- * It seems to be important to wait after unmapping a top-level
- * window until the window really gets unmapped. I don't completely
- * understand all the interactions with the window manager, but if
- * we go on without waiting, and if the window is then mapped again
- * quickly, events seem to get lost so that we think the window isn't
- * mapped when in fact it is mapped. I suspect that this has something
- * to do with the window manager filtering Map events (and possily not
- * filtering Unmap events?).
+ * It seems to be important to wait after unmapping a top-level window
+ * until the window really gets unmapped. I don't completely understand
+ * all the interactions with the window manager, but if we go on without
+ * waiting, and if the window is then mapped again quickly, events seem to
+ * get lost so that we think the window isn't mapped when in fact it is
+ * mapped. I suspect that this has something to do with the window manager
+ * filtering Map events (and possily not filtering Unmap events?).
*/
+
XUnmapWindow(winPtr->display, winPtr->wmInfoPtr->wrapperPtr->window);
WaitForMapNotify(winPtr, 0);
}
@@ -757,9 +797,8 @@ TkWmUnmapWindow(winPtr)
*
* TkWmDeadWindow --
*
- * This procedure is invoked when a top-level window is
- * about to be deleted. It cleans up the wm-related data
- * structures for the window.
+ * This function is invoked when a top-level window is about to be
+ * deleted. It cleans up the wm-related data structures for the window.
*
* Results:
* None.
@@ -771,8 +810,8 @@ TkWmUnmapWindow(winPtr)
*/
void
-TkWmDeadWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's being deleted. */
+TkWmDeadWindow(
+ TkWindow *winPtr) /* Top-level window that's being deleted. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
WmInfo *wmPtr2;
@@ -786,10 +825,8 @@ TkWmDeadWindow(winPtr)
register WmInfo *prevPtr;
for (prevPtr = (WmInfo *) winPtr->dispPtr->firstWmPtr; ;
- prevPtr = prevPtr->nextPtr) {
- if (prevPtr == NULL) {
- Tcl_Panic("couldn't unlink window in TkWmDeadWindow");
- }
+ prevPtr = prevPtr->nextPtr) {
+ /* ASSERT: prevPtr != NULL [Bug 1789819] */
if (prevPtr->nextPtr == wmPtr) {
prevPtr->nextPtr = wmPtr->nextPtr;
break;
@@ -803,7 +840,7 @@ TkWmDeadWindow(winPtr)
ckfree(wmPtr->iconName);
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *)wmPtr->iconDataPtr);
+ ckfree((char *) wmPtr->iconDataPtr);
}
if (wmPtr->hints.flags & IconPixmapHint) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
@@ -830,10 +867,10 @@ TkWmDeadWindow(winPtr)
}
if (wmPtr->wrapperPtr != NULL) {
/*
- * The rest of Tk doesn't know that we reparent the toplevel
- * inside the wrapper, so reparent it back out again before
- * deleting the wrapper; otherwise the toplevel will get deleted
- * twice (once implicitly by the deletion of the wrapper).
+ * The rest of Tk doesn't know that we reparent the toplevel inside
+ * the wrapper, so reparent it back out again before deleting the
+ * wrapper; otherwise the toplevel will get deleted twice (once
+ * implicitly by the deletion of the wrapper).
*/
XUnmapWindow(winPtr->display, winPtr->window);
@@ -857,42 +894,45 @@ TkWmDeadWindow(winPtr)
if (wmPtr->flags & WM_UPDATE_PENDING) {
Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
}
+
/*
* Reset all transient windows whose master is the dead window.
*/
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
- wmPtr2 = wmPtr2->nextPtr) {
+ wmPtr2 = wmPtr2->nextPtr) {
if (wmPtr2->masterPtr == winPtr) {
wmPtr->numTransients--;
Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) wmPtr2->winPtr);
+ StructureNotifyMask,
+ WmWaitMapProc, (ClientData) wmPtr2->winPtr);
wmPtr2->masterPtr = NULL;
if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr2->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "WM_TRANSIENT_FOR"));
- /* FIXME: Need a call like Win32's UpdateWrapper() so
- we can recreate the wrapper and get rid of the
- transient window decorations. */
+
+ /*
+ * FIXME: Need a call like Win32's UpdateWrapper() so we can
+ * recreate the wrapper and get rid of the transient window
+ * decorations.
+ */
}
}
}
- if (wmPtr->numTransients != 0)
- Tcl_Panic("numTransients should be 0");
+ /* ASSERT: numTransients == 0 [Bug 1789819] */
if (wmPtr->masterPtr != NULL) {
wmPtr2 = wmPtr->masterPtr->wmInfoPtr;
+
/*
- * If we had a master, tell them that we aren't tied
- * to them anymore
+ * If we had a master, tell them that we aren't tied to them anymore
*/
+
if (wmPtr2 != NULL) {
wmPtr2->numTransients--;
}
Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) winPtr);
+ StructureNotifyMask, WmWaitMapProc, (ClientData) winPtr);
wmPtr->masterPtr = NULL;
}
ckfree((char *) wmPtr);
@@ -904,11 +944,10 @@ TkWmDeadWindow(winPtr)
*
* TkWmSetClass --
*
- * This procedure is invoked whenever a top-level window's
- * class is changed. If the window has been mapped then this
- * procedure updates the window manager property for the
- * class. If the window hasn't been mapped, the update is
- * deferred until just before the first mapping.
+ * This function is invoked whenever a top-level window's class is
+ * changed. If the window has been mapped then this function updates the
+ * window manager property for the class. If the window hasn't been
+ * mapped, the update is deferred until just before the first mapping.
*
* Results:
* None.
@@ -920,8 +959,8 @@ TkWmDeadWindow(winPtr)
*/
void
-TkWmSetClass(winPtr)
- TkWindow *winPtr; /* Newly-created top-level window. */
+TkWmSetClass(
+ TkWindow *winPtr) /* Newly-created top-level window. */
{
if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
return;
@@ -949,56 +988,49 @@ TkWmSetClass(winPtr)
*
* Tk_WmObjCmd --
*
- * This procedure is invoked to process the "wm" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
+ * This function is invoked to process the "wm" Tcl command.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
-Tk_WmObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_WmObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
static CONST char *optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
- "command", "deiconify", "focusmodel", "frame",
+ "command", "deiconify", "focusmodel", "forget", "frame",
"geometry", "grid", "group", "iconbitmap",
"iconify", "iconmask", "iconname",
"iconphoto", "iconposition",
- "iconwindow", "maxsize", "minsize", "overrideredirect",
- "positionfrom", "protocol", "resizable", "sizefrom",
- "stackorder", "state", "title", "transient",
- "withdraw", (char *) NULL };
+ "iconwindow", "manage", "maxsize", "minsize", "overrideredirect",
+ "positionfrom", "protocol", "resizable", "sizefrom",
+ "stackorder", "state", "title", "transient",
+ "withdraw", NULL };
enum options {
- WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
- WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FRAME,
+ WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
+ WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET, WMOPT_FRAME,
WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBITMAP,
WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME,
WMOPT_ICONPHOTO, WMOPT_ICONPOSITION,
- WMOPT_ICONWINDOW, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
- WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
- WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
+ WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
+ WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
+ WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
WMOPT_WITHDRAW };
- int index;
+ int index;
int length;
char *argv1;
TkWindow *winPtr;
+ Tk_Window targetWin;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (objc < 2) {
- wrongNumArgs:
+ wrongNumArgs:
Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
return TCL_ERROR;
}
@@ -1037,76 +1069,81 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
goto wrongNumArgs;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr)
- != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &targetWin) != TCL_OK) {
return TCL_ERROR;
}
- if (!Tk_IsTopLevel(winPtr)) {
+ winPtr = (TkWindow *) targetWin;
+ if (!Tk_IsTopLevel(winPtr) &&
+ (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
switch ((enum options) index) {
- case WMOPT_ASPECT:
+ case WMOPT_ASPECT:
return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ATTRIBUTES:
+ case WMOPT_ATTRIBUTES:
return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_CLIENT:
+ case WMOPT_CLIENT:
return WmClientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COLORMAPWINDOWS:
+ case WMOPT_COLORMAPWINDOWS:
return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COMMAND:
+ case WMOPT_COMMAND:
return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_DEICONIFY:
+ case WMOPT_DEICONIFY:
return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FOCUSMODEL:
+ case WMOPT_FOCUSMODEL:
return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FRAME:
+ case WMOPT_FORGET:
+ return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FRAME:
return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GEOMETRY:
+ case WMOPT_GEOMETRY:
return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GRID:
+ case WMOPT_GRID:
return WmGridCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GROUP:
+ case WMOPT_GROUP:
return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONBITMAP:
+ case WMOPT_ICONBITMAP:
return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONIFY:
+ case WMOPT_ICONIFY:
return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONMASK:
+ case WMOPT_ICONMASK:
return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONNAME:
+ case WMOPT_ICONNAME:
return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPHOTO:
- return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPOSITION:
+ case WMOPT_ICONPHOTO:
+ return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPOSITION:
return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONWINDOW:
+ case WMOPT_ICONWINDOW:
return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MAXSIZE:
+ case WMOPT_MANAGE:
+ return WmManageCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MAXSIZE:
return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MINSIZE:
+ case WMOPT_MINSIZE:
return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_OVERRIDEREDIRECT:
+ case WMOPT_OVERRIDEREDIRECT:
return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_POSITIONFROM:
+ case WMOPT_POSITIONFROM:
return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_PROTOCOL:
+ case WMOPT_PROTOCOL:
return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_RESIZABLE:
+ case WMOPT_RESIZABLE:
return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_SIZEFROM:
+ case WMOPT_SIZEFROM:
return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STACKORDER:
+ case WMOPT_STACKORDER:
return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STATE:
+ case WMOPT_STATE:
return WmStateCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TITLE:
+ case WMOPT_TITLE:
return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TRANSIENT:
+ case WMOPT_TRANSIENT:
return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_WITHDRAW:
+ case WMOPT_WITHDRAW:
return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
}
@@ -1119,8 +1156,8 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*
* WmAspectCmd --
*
- * This procedure is invoked to process the "wm aspect" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm aspect" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1132,12 +1169,12 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*/
static int
-WmAspectCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmAspectCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
@@ -1187,45 +1224,198 @@ WmAspectCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
- * WmAttributesCmd --
+ * WmSetAttribute --
*
- * This procedure is invoked to process the "wm attributes" Tcl command.
- * See the user documentation for details on what it does.
+ * Helper routine for WmAttributesCmd. Sets the value of the specified
+ * attribute.
*
- * Results:
- * A standard Tcl result.
+ * Returns:
*
- * Side effects:
- * See the user documentation.
+ * TCL_OK if successful, TCL_ERROR otherwise. In case of an error, leaves
+ * a message in the interpreter's result.
*
*----------------------------------------------------------------------
*/
static int
-WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmSetAttribute(
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter */
+ WmAttribute attribute, /* Code of attribute to set */
+ Tcl_Obj *value) /* New value */
{
- if (objc < 4) {
- Tcl_Obj *listObj = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(interp, listObj,
- Tcl_NewStringObj("-type", -1));
- Tcl_ListObjAppendElement(interp, listObj, GetNetWmType(winPtr));
- Tcl_SetObjResult(interp, listObj);
- return TCL_OK;
- }
- if (objc > 5 || strcmp("-type", Tcl_GetString(objv[3]))) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?-type list?");
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ switch (attribute) {
+ case WMATT_ALPHA: {
+ unsigned long opacity; /* 0=transparent, 0xFFFFFFFF=opaque */
+
+ if (TCL_OK != Tcl_GetDoubleFromObj(interp, value,
+ &wmPtr->reqState.alpha)) {
+ return TCL_ERROR;
+ }
+ if (wmPtr->reqState.alpha < 0.0) {
+ wmPtr->reqState.alpha = 0.0;
+ }
+ if (wmPtr->reqState.alpha > 1.0) {
+ wmPtr->reqState.alpha = 1.0;
+ }
+
+ if (!wmPtr->wrapperPtr) {
+ break;
+ }
+
+ opacity = 0xFFFFFFFFul * wmPtr->reqState.alpha;
+ XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
+ Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_WINDOW_OPACITY"),
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)&opacity, 1L);
+ wmPtr->attributes.alpha = wmPtr->reqState.alpha;
+
+ break;
+ }
+ case WMATT_TOPMOST:
+ if (TCL_OK != Tcl_GetBooleanFromObj(interp, value,
+ &wmPtr->reqState.topmost)) {
+ return TCL_ERROR;
+ }
+ SetNetWmState(winPtr, "_NET_WM_STATE_ABOVE",
+ wmPtr->reqState.topmost);
+ break;
+ case WMATT_TYPE:
+ if (TCL_OK != SetNetWmType(winPtr, value))
+ return TCL_ERROR;
+ break;
+ case WMATT_ZOOMED:
+ if (TCL_OK != Tcl_GetBooleanFromObj(interp, value,
+ &wmPtr->reqState.zoomed)) {
+ return TCL_ERROR;
+ }
+ SetNetWmState(winPtr, "_NET_WM_STATE_MAXIMIZED_VERT",
+ wmPtr->reqState.zoomed);
+ SetNetWmState(winPtr, "_NET_WM_STATE_MAXIMIZED_HORZ",
+ wmPtr->reqState.zoomed);
+ break;
+ case WMATT_FULLSCREEN:
+ if (TCL_OK != Tcl_GetBooleanFromObj(interp, value,
+ &wmPtr->reqState.fullscreen)) {
+ return TCL_ERROR;
+ }
+ SetNetWmState(winPtr, "_NET_WM_STATE_FULLSCREEN",
+ wmPtr->reqState.fullscreen);
+ break;
+ case _WMATT_LAST_ATTRIBUTE: /* NOTREACHED */
return TCL_ERROR;
}
- if (objc == 4) {
- Tcl_SetObjResult(interp, GetNetWmType(winPtr));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGetAttribute --
+ *
+ * Helper routine for WmAttributesCmd. Returns the current value of the
+ * specified attribute.
+ *
+ * See also: CheckNetWmState().
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Tcl_Obj *
+WmGetAttribute(
+ TkWindow *winPtr, /* Toplevel to work with */
+ WmAttribute attribute) /* Code of attribute to get */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ switch (attribute) {
+ case WMATT_ALPHA:
+ return Tcl_NewDoubleObj(wmPtr->attributes.alpha);
+ case WMATT_TOPMOST:
+ return Tcl_NewBooleanObj(wmPtr->attributes.topmost);
+ case WMATT_ZOOMED:
+ return Tcl_NewBooleanObj(wmPtr->attributes.zoomed);
+ case WMATT_FULLSCREEN:
+ return Tcl_NewBooleanObj(wmPtr->attributes.fullscreen);
+ case WMATT_TYPE:
+ return GetNetWmType(winPtr);
+ case _WMATT_LAST_ATTRIBUTE: /*NOTREACHED*/
+ break;
+ }
+ /*NOTREACHED*/
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmAttributesCmd --
+ *
+ * This function is invoked to process the "wm attributes" Tcl command.
+ *
+ * Syntax:
+ *
+ * wm attributes $win ?-attribute ?value attribute value...??
+ *
+ * Notes:
+ *
+ * Attributes of mapped windows are set by sending a _NET_WM_STATE
+ * ClientMessage to the root window (see SetNetWmState). For withdrawn
+ * windows, we keep track of the requested attribute state, and set the
+ * _NET_WM_STATE property ourselves immediately prior to mapping the
+ * window.
+ *
+ * See also: TIP#231, EWMH.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmAttributesCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
+ int attribute = 0;
+
+ if (objc == 3) { /* wm attributes $win */
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+
+ for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) {
+ Tcl_ListObjAppendElement(interp, result,
+ Tcl_NewStringObj(WmAttributeNames[attribute], -1));
+ Tcl_ListObjAppendElement(interp, result,
+ WmGetAttribute(winPtr, attribute));
+ }
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ } else if (objc == 4) { /* wm attributes $win -attribute */
+ if (Tcl_GetIndexFromObj(interp, objv[3], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, WmGetAttribute(winPtr, attribute));
+ return TCL_OK;
+ } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */
+ int i;
+
+ for (i = 3; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (WmSetAttribute(winPtr,interp,attribute,objv[i+1]) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
return TCL_OK;
}
- return SetNetWmType(winPtr, objv[4]);
+
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-attribute ?value ...??");
+ return TCL_ERROR;
}
/*
@@ -1233,8 +1423,8 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
*
* WmClientCmd --
*
- * This procedure is invoked to process the "wm client" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm client" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1246,12 +1436,12 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmClientCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmClientCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -1283,8 +1473,7 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
if (wmPtr->clientMachine != NULL) {
ckfree((char *) wmPtr->clientMachine);
}
- wmPtr->clientMachine = (char *)
- ckalloc((unsigned) (length + 1));
+ wmPtr->clientMachine = ckalloc((unsigned) length + 1);
strcpy(wmPtr->clientMachine, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -1293,9 +1482,23 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
&textProp) != 0) {
+ unsigned long pid = (unsigned long) getpid();
+
XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
&textProp);
XFree((char *) textProp.value);
+
+ /*
+ * Inform the server (and more particularly any session manager)
+ * what our process ID is. We only do this when the CLIENT_MACHINE
+ * property is set since the spec for _NET_WM_PID requires that to
+ * be set too.
+ */
+
+ XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
+ Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PID"),
+ XA_CARDINAL,32, PropModeReplace, (unsigned char *) &pid,
+ 1);
}
Tcl_DStringFree(&ds);
}
@@ -1307,9 +1510,8 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
*
* WmColormapwindowsCmd --
*
- * This procedure is invoked to process the "wm colormapwindows"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm colormapwindows" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1321,12 +1523,12 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmColormapwindowsCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Window *cmapList;
@@ -1353,7 +1555,7 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
&& (wmPtr->flags & WM_ADDED_TOPLEVEL_COLORMAP)) {
break;
}
- winPtr2 = (TkWindow *) Tk_IdToWindow(winPtr->display,
+ winPtr2 = (TkWindow *) Tk_IdToWindow(winPtr->display,
cmapList[i]);
if (winPtr2 == NULL) {
sprintf(buffer, "0x%lx", cmapList[i]);
@@ -1370,15 +1572,17 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
return TCL_ERROR;
}
cmapList = (Window *) ckalloc((unsigned)
- ((windowObjc+1)*sizeof(Window)));
+ (windowObjc+1) * sizeof(Window));
gotToplevel = 0;
for (i = 0; i < windowObjc; i++) {
+ Tk_Window mapWin;
+
if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
- (Tk_Window *) &winPtr2) != TCL_OK)
- {
+ &mapWin) != TCL_OK) {
ckfree((char *) cmapList);
return TCL_ERROR;
}
+ winPtr2 = (TkWindow *) mapWin;
if (winPtr2 == winPtr) {
gotToplevel = 1;
}
@@ -1406,8 +1610,8 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
*
* WmCommandCmd --
*
- * This procedure is invoked to process the "wm command" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm command" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1419,12 +1623,12 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmCommandCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmCommandCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -1474,7 +1678,7 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
*
* WmDeiconifyCmd --
*
- * This procedure is invoked to process the "wm deiconify" Tcl command.
+ * This function is invoked to process the "wm deiconify" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1487,12 +1691,12 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmDeiconifyCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -1502,13 +1706,12 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
+ ": it is an embedded window", NULL);
return TCL_ERROR;
}
wmPtr->flags &= ~WM_WITHDRAWN;
@@ -1521,7 +1724,7 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
*
* WmFocusmodelCmd --
*
- * This procedure is invoked to process the "wm focusmodel" Tcl command.
+ * This function is invoked to process the "wm focusmodel" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1534,16 +1737,16 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmFocusmodelCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "active", "passive", (char *) NULL };
+ "active", "passive", NULL };
enum options {
OPT_ACTIVE, OPT_PASSIVE };
int index;
@@ -1574,9 +1777,9 @@ WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
- * WmFrameCmd --
+ * WmForgetCmd --
*
- * This procedure is invoked to process the "wm frame" Tcl command.
+ * This procedure is invoked to process the "wm forget" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1589,13 +1792,55 @@ WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmFrameCmd(tkwin, winPtr, interp, objc, objv)
+WmForgetCmd(tkwin, winPtr, interp, objc, objv)
Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
+ TkWindow *winPtr; /* Toplevel or Frame to work with */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
+ register Tk_Window frameWin = (Tk_Window) winPtr;
+
+ if (Tk_IsTopLevel(frameWin)) {
+ TkFocusJoin(winPtr);
+ Tk_UnmapWindow(frameWin);
+ TkWmDeadWindow(winPtr);
+ winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ RemapWindows(winPtr, winPtr->parentPtr);
+ /* flags (above) must be cleared before calling */
+ /* TkMapTopFrame (below) */
+ TkMapTopFrame(frameWin);
+ } else {
+ /* Already not managed by wm - ignore it */
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmFrameCmd --
+ *
+ * This function is invoked to process the "wm frame" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmFrameCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Window window;
char buf[TCL_INTEGER_SPACE];
@@ -1618,7 +1863,7 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGeometryCmd --
*
- * This procedure is invoked to process the "wm geometry" Tcl command.
+ * This function is invoked to process the "wm geometry" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1631,12 +1876,12 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmGeometryCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char xSign, ySign;
@@ -1681,8 +1926,8 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGridCmd --
*
- * This procedure is invoked to process the "wm grid" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm grid" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1694,12 +1939,12 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGridCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmGridCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
@@ -1722,8 +1967,8 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
}
if (*Tcl_GetString(objv[3]) == '\0') {
/*
- * Turn off gridding and reset the width and height
- * to make sense as ungridded numbers.
+ * Turn off gridding and reset the width and height to make sense as
+ * ungridded numbers.
*/
wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
@@ -1739,7 +1984,7 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) !=TCL_OK)) {
return TCL_ERROR;
}
if (reqWidth < 0) {
@@ -1771,8 +2016,8 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGroupCmd --
*
- * This procedure is invoked to process the "wm group" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm group" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1784,12 +2029,12 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGroupCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmGroupCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -1835,7 +2080,7 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
}
wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);
wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = ckalloc((unsigned) (length + 1));
+ wmPtr->leaderName = ckalloc((unsigned) length + 1);
strcpy(wmPtr->leaderName, argv3);
}
UpdateHints(winPtr);
@@ -1847,7 +2092,7 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconbitmapCmd --
*
- * This procedure is invoked to process the "wm iconbitmap" Tcl command.
+ * This function is invoked to process the "wm iconbitmap" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1860,12 +2105,12 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconbitmapCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
@@ -1907,8 +2152,8 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconifyCmd --
*
- * This procedure is invoked to process the "wm iconify" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm iconify" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1920,12 +2165,12 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconifyCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
if (objc != 3) {
@@ -1934,23 +2179,22 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
}
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": override-redirect flag is set", (char *) NULL);
+ "\": override-redirect flag is set", NULL);
return TCL_ERROR;
}
if (wmPtr->masterPtr != NULL) {
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": it is a transient", (char *) NULL);
+ "\": it is a transient", NULL);
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
+ ": it is an embedded window", NULL);
return TCL_ERROR;
}
if (TkpWmSetState(winPtr, IconicState) == 0) {
@@ -1967,7 +2211,7 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconmaskCmd --
*
- * This procedure is invoked to process the "wm iconmask" Tcl command.
+ * This function is invoked to process the "wm iconmask" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1980,12 +2224,12 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconmaskCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
@@ -2026,7 +2270,7 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconnameCmd --
*
- * This procedure is invoked to process the "wm iconname" Tcl command.
+ * This function is invoked to process the "wm iconname" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2039,12 +2283,12 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconnameCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -2064,7 +2308,7 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
ckfree((char *) wmPtr->iconName);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc((unsigned) (length + 1));
+ wmPtr->iconName = ckalloc((unsigned) length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
UpdateTitle(winPtr);
@@ -2078,8 +2322,7 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconphotoCmd --
*
- * This procedure is invoked to process the "wm iconphoto"
- * Tcl command.
+ * This function is invoked to process the "wm iconphoto" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2092,20 +2335,18 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconphotoCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_PhotoHandle photo;
Tk_PhotoImageBlock block;
int i, size = 0, width, height, index = 0, x, y, isDefault = 0;
- long R, G, B, A;
- long *iconPropertyData;
- unsigned char *pixelByte;
+ unsigned long *iconPropertyData;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2120,29 +2361,42 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
return TCL_ERROR;
}
}
+
/*
* Iterate over all images to retrieve their sizes, in order to allocate a
* buffer large enough to hold all images.
*/
+
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
if (photo == NULL) {
Tcl_AppendResult(interp, "can't use \"", Tcl_GetString(objv[i]),
- "\" as iconphoto: not a photo image", (char *) NULL);
+ "\" as iconphoto: not a photo image", NULL);
return TCL_ERROR;
}
Tk_PhotoGetSize(photo, &width, &height);
- /* We need to cardinals for width & height and one cardinal for each
- * image pixel. */
+
+ /*
+ * We need to cardinals for width & height and one cardinal for each
+ * image pixel.
+ */
+
size += 2 + width * height;
}
- /* We have calculated the size of the data. Try to allocate the needed
- * memory space. */
- iconPropertyData = (long *) Tcl_AttemptAlloc(sizeof(long)*size);
+
+ /*
+ * We have calculated the size of the data. Try to allocate the needed
+ * memory space. This is an unsigned long array (despite this being twice
+ * as much as is really needed on LP64 platforms) because that's what X
+ * defines CARD32 arrays to use. [Bug 2902814]
+ */
+
+ iconPropertyData = (unsigned long *)
+ attemptckalloc(sizeof(unsigned long) * size);
if (iconPropertyData == NULL) {
return TCL_ERROR;
}
- memset(iconPropertyData, 0, sizeof(long)*size);
+ memset(iconPropertyData, 0, sizeof(unsigned long) * size);
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
@@ -2152,60 +2406,56 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
}
Tk_PhotoGetSize(photo, &width, &height);
Tk_PhotoGetImage(photo, &block);
+
/*
* Each image data will be placed as an array of 32bit packed
- * CARDINAL, in a window property named "_NET_WM_ICON":
- * _NET_WM_ICON
+ * CARDINAL, in a window property named "_NET_WM_ICON": _NET_WM_ICON
*
* _NET_WM_ICON CARDINAL[][2+n]/32
*
- * This is an array of possible icons for the client.
- * This specification does not stipulate what size these icons should
- * be, but individual desktop environments or toolkits may do so.
- * The Window Manager MAY scale any of these icons to an appropriate
- * size.
+ * This is an array of possible icons for the client. This spec. does
+ * not stipulate what size these icons should be, but individual
+ * desktop environments or toolkits may do so. The Window Manager MAY
+ * scale any of these icons to an appropriate size.
*
* This is an array of 32bit packed CARDINAL ARGB with high byte being
* A, low byte being B. The first two cardinals are width, height.
- * Data is in rows, left to right and top to bottom.
+ * Data is in rows, left to right and top to bottom. The data will be
+ * endian-swapped going to the server if necessary. [Bug 2830420]
*/
/*
* Encode the image data in the iconPropertyData array.
*/
- iconPropertyData[index++] = width;
- iconPropertyData[index++] = height;
+
+ iconPropertyData[index++] = (unsigned) width;
+ iconPropertyData[index++] = (unsigned) height;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
- R = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[0]);
- G = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[1]);
- B = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[2]);
- A = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[3]);
- pixelByte = (unsigned char *) &iconPropertyData[index];
- pixelByte[3] = A;
- pixelByte[2] = R;
- pixelByte[1] = G;
- pixelByte[0] = B;
- index++;
+ register unsigned char *pixelPtr =
+ block.pixelPtr + x*block.pixelSize + y*block.pitch;
+ register unsigned long R, G, B, A;
+
+ R = pixelPtr[block.offset[0]];
+ G = pixelPtr[block.offset[1]];
+ B = pixelPtr[block.offset[2]];
+ A = pixelPtr[block.offset[3]];
+ iconPropertyData[index++] = A<<24 | R<<16 | G<<8 | B<<0;
}
}
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *)wmPtr->iconDataPtr);
+ ckfree((char *) wmPtr->iconDataPtr);
wmPtr->iconDataPtr = NULL;
}
if (isDefault) {
if (winPtr->dispPtr->iconDataPtr != NULL) {
ckfree((char *) winPtr->dispPtr->iconDataPtr);
}
- winPtr->dispPtr->iconDataPtr = (unsigned char *) iconPropertyData;
+ winPtr->dispPtr->iconDataPtr = (unsigned char *) iconPropertyData;
winPtr->dispPtr->iconDataSize = size;
} else {
- wmPtr->iconDataPtr = (unsigned char *) iconPropertyData;
+ wmPtr->iconDataPtr = (unsigned char *) iconPropertyData;
wmPtr->iconDataSize = size;
}
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -2219,8 +2469,7 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconpositionCmd --
*
- * This procedure is invoked to process the "wm iconposition"
- * Tcl command.
+ * This function is invoked to process the "wm iconposition" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2233,12 +2482,12 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconpositionCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
@@ -2277,7 +2526,7 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconwindowCmd --
*
- * This procedure is invoked to process the "wm iconwindow" Tcl command.
+ * This function is invoked to process the "wm iconwindow" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2290,12 +2539,12 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconwindowCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -2316,13 +2565,12 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->hints.flags &= ~IconWindowHint;
if (wmPtr->icon != NULL) {
/*
- * Remove the icon window relationship. In principle we
- * should also re-enable button events for the window, but
- * this doesn't work in general because the window manager
- * is probably selecting on them (we'll get an error if
- * we try to re-enable the events). So, just leave the
- * icon window event-challenged; the user will have to
- * recreate it if they want button events.
+ * Remove the icon window relationship. In principle we should
+ * also re-enable button events for the window, but this doesn't
+ * work in general because the window manager is probably
+ * selecting on them (we'll get an error if we try to re-enable
+ * the events). So, just leave the icon window event-challenged;
+ * the user will have to recreate it if they want button events.
*/
wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
@@ -2337,14 +2585,14 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
}
if (!Tk_IsTopLevel(tkwin2)) {
Tcl_AppendResult(interp, "can't use ", Tcl_GetString(objv[3]),
- " as icon window: not at top level", (char *) NULL);
+ " as icon window: not at top level", NULL);
return TCL_ERROR;
}
wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr;
if (wmPtr2->iconFor != NULL) {
Tcl_AppendResult(interp, Tcl_GetString(objv[3]),
- " is already an icon for ",
- Tk_PathName(wmPtr2->iconFor), (char *) NULL);
+ " is already an icon for ", Tk_PathName(wmPtr2->iconFor),
+ NULL);
return TCL_ERROR;
}
if (wmPtr->icon != NULL) {
@@ -2355,10 +2603,9 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
}
/*
- * Disable button events in the icon window: some window
- * managers (like olvwm) want to get the events themselves,
- * but X only allows one application at a time to receive
- * button events for a window.
+ * Disable button events in the icon window: some window managers
+ * (like olvwm) want to get the events themselves, but X only allows
+ * one application at a time to receive button events for a window.
*/
atts.event_mask = Tk_Attributes(tkwin2)->event_mask
@@ -2392,9 +2639,9 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
- * WmMaxsizeCmd --
+ * WmManageCmd --
*
- * This procedure is invoked to process the "wm maxsize" Tcl command.
+ * This procedure is invoked to process the "wm manage" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2407,13 +2654,68 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
+WmManageCmd(tkwin, winPtr, interp, objc, objv)
Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
+ TkWindow *winPtr; /* Toplevel or Frame to work with */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
+ register Tk_Window frameWin = (Tk_Window) winPtr;
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (!Tk_IsTopLevel(frameWin)) {
+ if (!Tk_IsManageable(frameWin)) {
+ Tcl_AppendResult(interp, "window \"",
+ Tk_PathName(frameWin), "\" is not manageable: must be "
+ "a frame, labelframe or toplevel", NULL);
+ return TCL_ERROR;
+ }
+ TkFocusSplit(winPtr);
+ Tk_UnmapWindow(frameWin);
+ winPtr->flags |= TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
+ if (wmPtr == NULL) {
+ TkWmNewWindow(winPtr);
+ TkWmMapWindow(winPtr);
+ Tk_UnmapWindow(frameWin);
+ }
+ wmPtr = winPtr->wmInfoPtr;
+ winPtr->flags &= ~TK_MAPPED;
+ RemapWindows(winPtr, wmPtr->wrapperPtr);
+ /* flags (above) must be set before calling */
+ /* TkMapTopFrame (below) */
+ TkMapTopFrame (frameWin);
+ } else if (Tk_IsTopLevel(frameWin)) {
+ /* Already managed by wm - ignore it */
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmMaxsizeCmd --
+ *
+ * This function is invoked to process the "wm maxsize" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmMaxsizeCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2452,8 +2754,8 @@ WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
*
* WmMinsizeCmd --
*
- * This procedure is invoked to process the "wm minsize" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm minsize" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2465,12 +2767,12 @@ WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmMinsizeCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2502,9 +2804,8 @@ WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
*
* WmOverrideredirectCmd --
*
- * This procedure is invoked to process the "wm overrideredirect"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm overrideredirect" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2516,12 +2817,12 @@ WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmOverrideredirectCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int boolean, curValue;
XSetWindowAttributes atts;
@@ -2540,9 +2841,10 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
}
if (curValue != boolean) {
/*
- * Only do this if we are really changing value, because it
- * causes some funky stuff to occur
+ * Only do this if we are really changing value, because it causes
+ * some funky stuff to occur
*/
+
atts.override_redirect = (boolean) ? True : False;
Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
&atts);
@@ -2560,8 +2862,7 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
*
* WmPositionfromCmd --
*
- * This procedure is invoked to process the "wm positionfrom"
- * Tcl command.
+ * This function is invoked to process the "wm positionfrom" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2574,16 +2875,16 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmPositionfromCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
+ "program", "user", NULL };
enum options {
OPT_PROGRAM, OPT_USER };
int index;
@@ -2625,8 +2926,8 @@ WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
*
* WmProtocolCmd --
*
- * This procedure is invoked to process the "wm protocol" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm protocol" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2638,12 +2939,12 @@ WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmProtocolCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
register ProtocolHandler *protPtr, *prevPtr;
@@ -2659,8 +2960,9 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
/*
* Return a list of all defined protocols for the window.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
+ protPtr = protPtr->nextPtr) {
Tcl_AppendElement(interp,
Tk_GetAtomName((Tk_Window) winPtr, protPtr->protocol));
}
@@ -2671,8 +2973,9 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
/*
* Return the command to handle a given protocol.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
+ protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
Tcl_SetResult(interp, protPtr->command, TCL_STATIC);
return TCL_OK;
@@ -2682,13 +2985,22 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
}
/*
- * Delete any current protocol handler, then create a new
- * one with the specified command, unless the command is
- * empty.
+ * Special case for _NET_WM_PING: that's always handled directly.
+ */
+
+ if (strcmp(Tcl_GetString(objv[3]), "_NET_WM_PING") == 0) {
+ Tcl_SetResult(interp, "may not alter handling of that protocol",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Delete any current protocol handler, then create a new one with the
+ * specified command, unless the command is empty.
*/
for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL;
- prevPtr = protPtr, protPtr = protPtr->nextPtr) {
+ prevPtr = protPtr, protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
if (prevPtr == NULL) {
wmPtr->protPtr = protPtr->nextPtr;
@@ -2719,7 +3031,7 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
*
* WmResizableCmd --
*
- * This procedure is invoked to process the "wm resizable" Tcl command.
+ * This function is invoked to process the "wm resizable" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2732,12 +3044,12 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmResizableCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmResizableCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2750,8 +3062,8 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
char buf[TCL_INTEGER_SPACE * 2];
sprintf(buf, "%d %d",
- (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
- (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
+ (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -2779,8 +3091,8 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
*
* WmSizefromCmd --
*
- * This procedure is invoked to process the "wm sizefrom" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm sizefrom" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2792,16 +3104,16 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmSizefromCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
+ "program", "user", NULL };
enum options {
OPT_PROGRAM, OPT_USER };
int index;
@@ -2844,7 +3156,7 @@ WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
*
* WmStackorderCmd --
*
- * This procedure is invoked to process the "wm stackorder" Tcl command.
+ * This function is invoked to process the "wm stackorder" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2857,16 +3169,16 @@ WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmStackorderCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
TkWindow **windows, **window_ptr;
static CONST char *optionStrings[] = {
- "isabove", "isbelow", (char *) NULL };
+ "isabove", "isbelow", NULL };
enum options {
OPT_ISABOVE, OPT_ISBELOW };
int index;
@@ -2878,9 +3190,8 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
if (objc == 3) {
windows = TkWmStackorderToplevel(winPtr);
- if (windows == NULL) {
- Tcl_Panic("TkWmStackorderToplevel failed");
- } else {
+ if (windows != NULL) {
+ /* ASSERT: true [Bug 1789819]*/
for (window_ptr = windows; *window_ptr ; window_ptr++) {
Tcl_AppendElement(interp, (*window_ptr)->pathName);
}
@@ -2888,56 +3199,53 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
return TCL_OK;
}
} else {
+ Tk_Window relWin;
TkWindow *winPtr2;
int index1=-1, index2=-1, result;
- if (TkGetWindowFromObj(interp, tkwin, objv[4], (Tk_Window *) &winPtr2)
- != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[4], &relWin) != TCL_OK) {
return TCL_ERROR;
}
+ winPtr2 = (TkWindow *) relWin;
if (!Tk_IsTopLevel(winPtr2)) {
Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't mapped", (char *) NULL);
+ "\" isn't mapped", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr2)) {
Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't mapped", (char *) NULL);
+ "\" isn't mapped", NULL);
return TCL_ERROR;
}
/*
- * Lookup stacking order of all toplevels that are children
- * of "." and find the position of winPtr and winPtr2
- * in the stacking order.
+ * Lookup stacking order of all toplevels that are children of "." and
+ * find the position of winPtr and winPtr2 in the stacking order.
*/
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
if (windows == NULL) {
- Tcl_AppendResult(interp, "TkWmStackorderToplevel failed",
- (char *) NULL);
+ Tcl_AppendResult(interp, "TkWmStackorderToplevel failed", NULL);
return TCL_ERROR;
} else {
for (window_ptr = windows; *window_ptr ; window_ptr++) {
- if (*window_ptr == winPtr)
+ if (*window_ptr == winPtr) {
index1 = (window_ptr - windows);
- if (*window_ptr == winPtr2)
+ }
+ if (*window_ptr == winPtr2) {
index2 = (window_ptr - windows);
+ }
}
- if (index1 == -1)
- Tcl_Panic("winPtr window not found");
- if (index2 == -1)
- Tcl_Panic("winPtr2 window not found");
-
+ /* ASSERT: index1 != -1 && index2 != -2 [Bug 1789819] */
ckfree((char *) windows);
}
@@ -2961,8 +3269,8 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
*
* WmStateCmd --
*
- * This procedure is invoked to process the "wm state" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm state" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2974,16 +3282,16 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmStateCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmStateCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "normal", "iconic", "withdrawn", (char *) NULL };
+ "normal", "iconic", "withdrawn", NULL };
enum options {
OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN };
int index;
@@ -2995,9 +3303,8 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
if (objc == 4) {
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't change state of ",
- Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ Tcl_GetString(objv[2]), ": it is an icon for ",
+ Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
@@ -3011,16 +3318,13 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
(void) TkpWmSetState(winPtr, NormalState);
} else if (index == OPT_ICONIC) {
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": override-redirect flag is set",
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": override-redirect flag is set", NULL);
return TCL_ERROR;
}
if (wmPtr->masterPtr != NULL) {
- Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": it is a transient", (char *) NULL);
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": it is a transient", NULL);
return TCL_ERROR;
}
if (TkpWmSetState(winPtr, IconicState) == 0) {
@@ -3059,8 +3363,8 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
*
* WmTitleCmd --
*
- * This procedure is invoked to process the "wm title" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm title" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3072,12 +3376,12 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmTitleCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmTitleCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -3097,7 +3401,7 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
ckfree((char *) wmPtr->title);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->title = ckalloc((unsigned) (length + 1));
+ wmPtr->title = ckalloc((unsigned) length + 1);
strcpy(wmPtr->title, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3112,7 +3416,7 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
*
* WmTransientCmd --
*
- * This procedure is invoked to process the "wm transient" Tcl command.
+ * This function is invoked to process the "wm transient" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3125,12 +3429,12 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmTransientCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmTransientCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *masterPtr = wmPtr->masterPtr;
@@ -3149,26 +3453,29 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
if (Tcl_GetString(objv[3])[0] == '\0') {
if (masterPtr != NULL) {
/*
- * If we had a master, tell them that we aren't tied
- * to them anymore
+ * If we had a master, tell them that we aren't tied to them
+ * anymore
*/
masterPtr->wmInfoPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) masterPtr,
- StructureNotifyMask,
+ Tk_DeleteEventHandler((Tk_Window) masterPtr, StructureNotifyMask,
WmWaitMapProc, (ClientData) winPtr);
- /* FIXME: Need a call like Win32's UpdateWrapper() so
- we can recreate the wrapper and get rid of the
- transient window decorations. */
+ /*
+ * FIXME: Need a call like Win32's UpdateWrapper() so we can
+ * recreate the wrapper and get rid of the transient window
+ * decorations.
+ */
}
wmPtr->masterPtr = NULL;
} else {
- if (TkGetWindowFromObj(interp, tkwin, objv[3],
- (Tk_Window *) &masterPtr) != TCL_OK) {
+ Tk_Window masterWin;
+
+ if (TkGetWindowFromObj(interp, tkwin, objv[3], &masterWin)!=TCL_OK) {
return TCL_ERROR;
}
+ masterPtr = (TkWindow *) masterWin;
while (!Tk_TopWinHierarchy(masterPtr)) {
/*
* Ensure that the master window is actually a Tk toplevel.
@@ -3179,11 +3486,9 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
Tk_MakeWindowExist((Tk_Window) masterPtr);
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[2]),
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[2]),
"\" a transient: it is an icon for ",
- Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
@@ -3193,24 +3498,21 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr2->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[3]),
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[3]),
"\" a master: it is an icon for ",
- Tk_PathName(wmPtr2->iconFor),
- (char *) NULL);
+ Tk_PathName(wmPtr2->iconFor), NULL);
return TCL_ERROR;
}
if (masterPtr == winPtr) {
Tcl_AppendResult(interp, "can't make \"", Tk_PathName(winPtr),
- "\" its own master",
- (char *) NULL);
+ "\" its own master", NULL);
return TCL_ERROR;
} else if (masterPtr != wmPtr->masterPtr) {
/*
- * Remove old master map/unmap binding before setting
- * the new master. The event handler will ensure that
- * transient states reflect the state of the master.
+ * Remove old master map/unmap binding before setting the new
+ * master. The event handler will ensure that transient states
+ * reflect the state of the master.
*/
if (wmPtr->masterPtr != NULL) {
@@ -3222,8 +3524,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
masterPtr->wmInfoPtr->numTransients++;
Tk_CreateEventHandler((Tk_Window) masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) winPtr);
+ StructureNotifyMask, WmWaitMapProc, (ClientData) winPtr);
wmPtr->masterPtr = masterPtr;
}
@@ -3238,11 +3539,12 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
}
} else {
if (wmPtr->masterPtr != NULL) {
- XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window,
+ XSetTransientForHint(winPtr->display,
+ wmPtr->wrapperPtr->window,
wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
} else {
XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window)winPtr, "WM_TRANSIENT_FOR"));
+ Tk_InternAtom((Tk_Window) winPtr, "WM_TRANSIENT_FOR"));
}
}
}
@@ -3254,8 +3556,8 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
*
* WmWithdrawCmd --
*
- * This procedure is invoked to process the "wm withdraw" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm withdraw" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3267,12 +3569,12 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmWithdrawCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3282,8 +3584,7 @@ WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't withdraw ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
wmPtr->flags |= WM_WITHDRAWN;
@@ -3297,13 +3598,14 @@ WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
}
/*
- * Invoked by those wm subcommands that affect geometry.
- * Schedules a geometry update.
+ * Invoked by those wm subcommands that affect geometry. Schedules a geometry
+ * update.
*/
+
static void
-WmUpdateGeom(wmPtr, winPtr)
- WmInfo *wmPtr;
- TkWindow *winPtr;
+WmUpdateGeom(
+ WmInfo *wmPtr,
+ TkWindow *winPtr)
{
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
@@ -3312,25 +3614,28 @@ WmUpdateGeom(wmPtr, winPtr)
}
/*
- * Invoked when a MapNotify or UnmapNotify event is delivered for a
- * toplevel that is the master of a transient toplevel.
+ * Invoked when a MapNotify or UnmapNotify event is delivered for a toplevel
+ * that is the master of a transient toplevel.
*/
+
static void
-WmWaitMapProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to window. */
- XEvent *eventPtr; /* Information about event. */
+WmWaitMapProc(
+ ClientData clientData, /* Pointer to window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkWindow *winPtr = (TkWindow *) clientData;
TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr;
- if (masterPtr == NULL)
- return;
+ if (masterPtr == NULL) {
+ return;
+ }
if (eventPtr->type == MapNotify) {
- if (!(winPtr->wmInfoPtr->flags & WM_WITHDRAWN))
- (void) TkpWmSetState(winPtr, NormalState);
+ if (!(winPtr->wmInfoPtr->flags & WM_WITHDRAWN)) {
+ (void) TkpWmSetState(winPtr, NormalState);
+ }
} else if (eventPtr->type == UnmapNotify) {
- (void) TkpWmSetState(winPtr, WithdrawnState);
+ (void) TkpWmSetState(winPtr, WithdrawnState);
}
}
@@ -3339,34 +3644,34 @@ WmWaitMapProc(clientData, eventPtr)
*
* Tk_SetGrid --
*
- * This procedure is invoked by a widget when it wishes to set a grid
- * coordinate system that controls the size of a top-level window.
- * It provides a C interface equivalent to the "wm grid" command and
- * is usually asscoiated with the -setgrid option.
+ * This function is invoked by a widget when it wishes to set a grid
+ * coordinate system that controls the size of a top-level window. It
+ * provides a C interface equivalent to the "wm grid" command and is
+ * usually asscoiated with the -setgrid option.
*
* Results:
* None.
*
* Side effects:
- * Grid-related information will be passed to the window manager, so
- * that the top-level window associated with tkwin will resize on
- * even grid units. If some other window already controls gridding
- * for the top-level window then this procedure call has no effect.
+ * Grid-related information will be passed to the window manager, so that
+ * the top-level window associated with tkwin will resize on even grid
+ * units. If some other window already controls gridding for the
+ * top-level window then this function call has no effect.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
- Tk_Window tkwin; /* Token for window. New window mgr info
- * will be posted for the top-level window
+Tk_SetGrid(
+ Tk_Window tkwin, /* Token for window. New window mgr info will
+ * be posted for the top-level window
* associated with this window. */
- int reqWidth; /* Width (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int reqHeight; /* Height (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int widthInc, heightInc; /* Pixel increments corresponding to a
- * change of one grid unit. */
+ int reqWidth, /* Width (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int reqHeight, /* Height (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int widthInc, int heightInc)/* Pixel increments corresponding to a change
+ * of one grid unit. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
register WmInfo *wmPtr;
@@ -3374,6 +3679,7 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
/*
* Ensure widthInc and heightInc are greater than 0
*/
+
if (widthInc <= 0) {
widthInc = 1;
}
@@ -3415,15 +3721,15 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
}
/*
- * If gridding was previously off, then forget about any window
- * size requests made by the user or via "wm geometry": these are
- * in pixel units and there's no easy way to translate them to
- * grid units since the new requested size of the top-level window in
- * pixels may not yet have been registered yet (it may filter up
- * the hierarchy in DoWhenIdle handlers). However, if the window
- * has never been mapped yet then just leave the window size alone:
- * assume that it is intended to be in grid units but just happened
- * to have been specified before this procedure was called.
+ * If gridding was previously off, then forget about any window size
+ * requests made by the user or via "wm geometry": these are in pixel
+ * units and there's no easy way to translate them to grid units since the
+ * new requested size of the top-level window in pixels may not yet have
+ * been registered yet (it may filter up the hierarchy in DoWhenIdle
+ * handlers). However, if the window has never been mapped yet then just
+ * leave the window size alone: assume that it is intended to be in grid
+ * units but just happened to have been specified before this function was
+ * called.
*/
if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3432,8 +3738,8 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
}
/*
- * Set the new gridding information, and start the process of passing
- * all of this information to the window manager.
+ * Set the new gridding information, and start the process of passing all
+ * of this information to the window manager.
*/
wmPtr->gridWin = tkwin;
@@ -3454,23 +3760,22 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
*
* Tk_UnsetGrid --
*
- * This procedure cancels the effect of a previous call
- * to Tk_SetGrid.
+ * This function cancels the effect of a previous call to Tk_SetGrid.
*
* Results:
* None.
*
* Side effects:
* If tkwin currently controls gridding for its top-level window,
- * gridding is cancelled for that top-level window; if some other
- * window controls gridding then this procedure has no effect.
+ * gridding is cancelled for that top-level window; if some other window
+ * controls gridding then this function has no effect.
*
*----------------------------------------------------------------------
*/
void
-Tk_UnsetGrid(tkwin)
- Tk_Window tkwin; /* Token for window that is currently
+Tk_UnsetGrid(
+ Tk_Window tkwin) /* Token for window that is currently
* controlling gridding. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -3523,24 +3828,25 @@ Tk_UnsetGrid(tkwin)
*
* ConfigureEvent --
*
- * This procedure is called to handle ConfigureNotify events on
- * wrapper windows.
+ * This function is called to handle ConfigureNotify events on wrapper
+ * windows.
*
* Results:
* None.
*
* Side effects:
- * Information gets updated in the WmInfo structure for the window
- * and the toplevel itself gets repositioned within the wrapper.
+ * Information gets updated in the WmInfo structure for the window and
+ * the toplevel itself gets repositioned within the wrapper.
*
*----------------------------------------------------------------------
*/
static void
-ConfigureEvent(wmPtr, configEventPtr)
- WmInfo *wmPtr; /* Information about toplevel window. */
- XConfigureEvent *configEventPtr; /* Event that just occurred for
- * wmPtr->wrapperPtr. */
+ConfigureEvent(
+ WmInfo *wmPtr, /* Information about toplevel window. */
+ XConfigureEvent *configEventPtr)
+ /* Event that just occurred for
+ * wmPtr->wrapperPtr. */
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
TkWindow *winPtr = wmPtr->winPtr;
@@ -3548,21 +3854,21 @@ ConfigureEvent(wmPtr, configEventPtr)
Tk_ErrorHandler handler;
/*
- * Update size information from the event. There are a couple of
- * tricky points here:
+ * Update size information from the event. There are a couple of tricky
+ * points here:
*
- * 1. If the user changed the size externally then set wmPtr->width
- * and wmPtr->height just as if a "wm geometry" command had been
- * invoked with the same information.
- * 2. However, if the size is changing in response to a request
- * coming from us (WM_SYNC_PENDING is set), then don't set wmPtr->width
- * or wmPtr->height if they were previously -1 (otherwise the
- * window will stop tracking geometry manager requests).
+ * 1. If the user changed the size externally then set wmPtr->width and
+ * wmPtr->height just as if a "wm geometry" command had been invoked
+ * with the same information.
+ * 2. However, if the size is changing in response to a request coming
+ * from us (WM_SYNC_PENDING is set), then don't set wmPtr->width or
+ * wmPtr->height if they were previously -1 (otherwise the window will
+ * stop tracking geometry manager requests).
*/
if (((wrapperPtr->changes.width != configEventPtr->width)
|| (wrapperPtr->changes.height != configEventPtr->height))
- && !(wmPtr->flags & WM_SYNC_PENDING)){
+ && !(wmPtr->flags & WM_SYNC_PENDING)) {
if (dispPtr->flags & TK_DISPLAY_WM_TRACING) {
printf("TopLevelEventProc: user changed %s size to %dx%d\n",
winPtr->pathName, configEventPtr->width,
@@ -3571,17 +3877,17 @@ ConfigureEvent(wmPtr, configEventPtr)
if ((wmPtr->width == -1)
&& (configEventPtr->width == winPtr->reqWidth)) {
/*
- * Don't set external width, since the user didn't change it
- * from what the widgets asked for.
+ * Don't set external width, since the user didn't change it from
+ * what the widgets asked for.
*/
} else {
/*
* Note: if this window is embedded then don't set the external
* size, since it came from the containing application, not the
- * user. In this case we want to keep sending our size requests
- * to the containing application; if the user fixes the size
- * of that application then it will still percolate down to us
- * in the right way.
+ * user. In this case we want to keep sending our size requests to
+ * the containing application; if the user fixes the size of that
+ * application then it will still percolate down to us in the
+ * right way.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
@@ -3601,13 +3907,13 @@ ConfigureEvent(wmPtr, configEventPtr)
&& (configEventPtr->height ==
(winPtr->reqHeight + wmPtr->menuHeight))) {
/*
- * Don't set external height, since the user didn't change it
- * from what the widgets asked for.
+ * Don't set external height, since the user didn't change it from
+ * what the widgets asked for.
*/
} else {
/*
- * See note for wmPtr->width about not setting external size
- * for embedded windows.
+ * See note for wmPtr->width about not setting external size for
+ * embedded windows.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
@@ -3621,7 +3927,7 @@ ConfigureEvent(wmPtr, configEventPtr)
} else {
wmPtr->height = configEventPtr->height - wmPtr->menuHeight;
}
- }
+ }
}
wmPtr->configWidth = configEventPtr->width;
wmPtr->configHeight = configEventPtr->height;
@@ -3642,19 +3948,17 @@ ConfigureEvent(wmPtr, configEventPtr)
wrapperPtr->changes.stack_mode = Above;
/*
- * Reparenting window managers make life difficult. If the
- * window manager reparents a top-level window then the x and y
- * information that comes in events for the window is wrong:
- * it gives the location of the window inside its decorative
- * parent, rather than the location of the window in root
- * coordinates, which is what we want. Window managers
- * are supposed to send synthetic events with the correct
- * information, but ICCCM doesn't require them to do this
- * under all conditions, and the information provided doesn't
- * include everything we need here. So, the code below
- * maintains a bunch of information about the parent window.
- * If the window hasn't been reparented, we pretend that
- * there is a parent shrink-wrapped around the window.
+ * Reparenting window managers make life difficult. If the window manager
+ * reparents a top-level window then the x and y information that comes in
+ * events for the window is wrong: it gives the location of the window
+ * inside its decorative parent, rather than the location of the window in
+ * root coordinates, which is what we want. Window managers are supposed
+ * to send synthetic events with the correct information, but ICCCM
+ * doesn't require them to do this under all conditions, and the
+ * information provided doesn't include everything we need here. So, the
+ * code below maintains a bunch of information about the parent window.
+ * If the window hasn't been reparented, we pretend that there is a parent
+ * shrink-wrapped around the window.
*/
if (dispPtr->flags & TK_DISPLAY_WM_TRACING) {
@@ -3680,11 +3984,11 @@ ConfigureEvent(wmPtr, configEventPtr)
/*
* Make sure that the toplevel and menubar are properly positioned within
- * the wrapper. If the menuHeight happens to be zero, we'll get a
- * BadValue X error that we want to ignore [Bug: 3377]
+ * the wrapper. If the menuHeight happens to be zero, we'll get a BadValue
+ * X error that we want to ignore [Bug: 3377]
*/
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL);
XMoveResizeWindow(winPtr->display, winPtr->window, 0,
wmPtr->menuHeight, (unsigned) wrapperPtr->changes.width,
(unsigned) (wrapperPtr->changes.height - wmPtr->menuHeight));
@@ -3698,9 +4002,9 @@ ConfigureEvent(wmPtr, configEventPtr)
/*
* Update the coordinates in the toplevel (they should refer to the
- * position in root window coordinates, not the coordinates of the
- * wrapper window). Then synthesize a ConfigureNotify event to tell
- * the application about the change.
+ * position in root window coordinates, not the coordinates of the wrapper
+ * window). Then synthesize a ConfigureNotify event to tell the
+ * application about the change.
*/
winPtr->changes.x = wrapperPtr->changes.x;
@@ -3715,8 +4019,8 @@ ConfigureEvent(wmPtr, configEventPtr)
*
* ReparentEvent --
*
- * This procedure is called to handle ReparentNotify events on
- * wrapper windows.
+ * This function is called to handle ReparentNotify events on wrapper
+ * windows.
*
* Results:
* None.
@@ -3728,13 +4032,14 @@ ConfigureEvent(wmPtr, configEventPtr)
*/
static void
-ReparentEvent(wmPtr, reparentEventPtr)
- WmInfo *wmPtr; /* Information about toplevel window. */
- XReparentEvent *reparentEventPtr; /* Event that just occurred for
- * wmPtr->wrapperPtr. */
+ReparentEvent(
+ WmInfo *wmPtr, /* Information about toplevel window. */
+ XReparentEvent *reparentEventPtr)
+ /* Event that just occurred for
+ * wmPtr->wrapperPtr. */
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
- Window vRoot, ancestor, *children, dummy2, *virtualRootPtr;
+ Window vRoot, ancestor, *children, dummy2, *virtualRootPtr, **vrPtrPtr;
Atom actualType;
int actualFormat;
unsigned long numItems, bytesAfter;
@@ -3743,26 +4048,26 @@ ReparentEvent(wmPtr, reparentEventPtr)
TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
/*
- * Identify the root window for wrapperPtr. This is tricky because of
- * virtual root window managers like tvtwm. If the window has a
- * property named __SWM_ROOT or __WM_ROOT then this property gives
- * the id for a virtual root window that should be used instead of
- * the root window of the screen.
+ * Identify the root window for wrapperPtr. This is tricky because of
+ * virtual root window managers like tvtwm. If the window has a property
+ * named __SWM_ROOT or __WM_ROOT then this property gives the id for a
+ * virtual root window that should be used instead of the root window of
+ * the screen.
*/
vRoot = RootWindow(wrapperPtr->display, wrapperPtr->screenNum);
wmPtr->vRoot = None;
- handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(wrapperPtr->display, -1,-1,-1, NULL,NULL);
+ vrPtrPtr = &virtualRootPtr; /* Silence GCC warning */
if (((XGetWindowProperty(wrapperPtr->display, wrapperPtr->window,
Tk_InternAtom((Tk_Window) wrapperPtr, "__WM_ROOT"), 0, (long) 1,
False, XA_WINDOW, &actualType, &actualFormat, &numItems,
- &bytesAfter, (unsigned char **) &virtualRootPtr) == Success)
+ &bytesAfter, (unsigned char **) vrPtrPtr) == Success)
&& (actualType == XA_WINDOW))
|| ((XGetWindowProperty(wrapperPtr->display, wrapperPtr->window,
Tk_InternAtom((Tk_Window) wrapperPtr, "__SWM_ROOT"), 0, (long) 1,
False, XA_WINDOW, &actualType, &actualFormat, &numItems,
- &bytesAfter, (unsigned char **) &virtualRootPtr) == Success)
+ &bytesAfter, (unsigned char **) vrPtrPtr) == Success)
&& (actualType == XA_WINDOW))) {
if ((actualFormat == 32) && (numItems == 1)) {
vRoot = wmPtr->vRoot = *virtualRootPtr;
@@ -3788,12 +4093,12 @@ ReparentEvent(wmPtr, reparentEventPtr)
UpdateVRootGeometry(wmPtr);
/*
- * If the window's new parent is the root window, then mark it as
- * no longer reparented.
+ * If the window's new parent is the root window, then mark it as no
+ * longer reparented.
*/
if (reparentEventPtr->parent == vRoot) {
- noReparent:
+ noReparent:
wmPtr->reparent = None;
wmPtr->parentWidth = wrapperPtr->changes.width;
wmPtr->parentHeight = wrapperPtr->changes.height;
@@ -3806,17 +4111,15 @@ ReparentEvent(wmPtr, reparentEventPtr)
}
/*
- * Search up the window hierarchy to find the ancestor of this
- * window that is just below the (virtual) root. This is tricky
- * because it's possible that things have changed since the event
- * was generated so that the ancestry indicated by the event no
- * longer exists. If this happens then an error will occur and
- * we just discard the event (there will be a more up-to-date
- * ReparentNotify event coming later).
+ * Search up the window hierarchy to find the ancestor of this window that
+ * is just below the (virtual) root. This is tricky because it's possible
+ * that things have changed since the event was generated so that the
+ * ancestry indicated by the event no longer exists. If this happens then
+ * an error will occur and we just discard the event (there will be a more
+ * up-to-date ReparentNotify event coming later).
*/
- handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(wrapperPtr->display, -1,-1,-1, NULL,NULL);
wmPtr->reparent = reparentEventPtr->parent;
while (1) {
if (XQueryTree(wrapperPtr->display, wmPtr->reparent, &dummy2,
@@ -3844,28 +4147,26 @@ ReparentEvent(wmPtr, reparentEventPtr)
*
* ComputeReparentGeometry --
*
- * This procedure is invoked to recompute geometry information
- * related to a reparented top-level window, such as the position
- * and total size of the parent and the position within it of
- * the top-level window.
+ * This function is invoked to recompute geometry information related to
+ * a reparented top-level window, such as the position and total size of
+ * the parent and the position within it of the top-level window.
*
* Results:
- * The return value is 1 if everything completed successfully
- * and 0 if an error occurred while querying information about
- * winPtr's parents. In this case winPtr is marked as no longer
- * being reparented.
+ * The return value is 1 if everything completed successfully and 0 if an
+ * error occurred while querying information about winPtr's parents. In
+ * this case winPtr is marked as no longer being reparented.
*
* Side effects:
- * Geometry information in wmPtr, wmPtr->winPtr, and
- * wmPtr->wrapperPtr gets updated.
+ * Geometry information in wmPtr, wmPtr->winPtr, and wmPtr->wrapperPtr
+ * gets updated.
*
*----------------------------------------------------------------------
*/
static int
-ComputeReparentGeometry(wmPtr)
- WmInfo *wmPtr; /* Information about toplevel window
- * whose reparent info is to be recomputed. */
+ComputeReparentGeometry(
+ WmInfo *wmPtr) /* Information about toplevel window whose
+ * reparent info is to be recomputed. */
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
int width, height, bd;
@@ -3876,8 +4177,7 @@ ComputeReparentGeometry(wmPtr)
Tk_ErrorHandler handler;
TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
- handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(wrapperPtr->display, -1,-1,-1, NULL,NULL);
(void) XTranslateCoordinates(wrapperPtr->display, wrapperPtr->window,
wmPtr->reparent, 0, 0, &xOffset, &yOffset, &dummy2);
status = XGetGeometry(wrapperPtr->display, wmPtr->reparent,
@@ -3886,10 +4186,10 @@ ComputeReparentGeometry(wmPtr)
Tk_DeleteErrorHandler(handler);
if (status == 0) {
/*
- * It appears that the reparented parent went away and
- * no-one told us. Reset the window to indicate that
- * it's not reparented.
+ * It appears that the reparented parent went away and no-one told us.
+ * Reset the window to indicate that it's not reparented.
*/
+
wmPtr->reparent = None;
wmPtr->xInParent = wmPtr->yInParent = 0;
return 0;
@@ -3902,28 +4202,27 @@ ComputeReparentGeometry(wmPtr)
/*
* Some tricky issues in updating wmPtr->x and wmPtr->y:
*
- * 1. Don't update them if the event occurred because of something
- * we did (i.e. WM_SYNC_PENDING and WM_MOVE_PENDING are both set).
- * This is because window managers treat coords differently than Tk,
- * and no two window managers are alike. If the window manager moved
- * the window because we told it to, remember the coordinates we told
- * it, not the ones it actually moved it to. This allows us to move
- * the window back to the same coordinates later and get the same
- * result. Without this check, windows can "walk" across the screen
- * under some conditions.
+ * 1. Don't update them if the event occurred because of something we did
+ * (i.e. WM_SYNC_PENDING and WM_MOVE_PENDING are both set). This is
+ * because window managers treat coords differently than Tk, and no two
+ * window managers are alike. If the window manager moved the window
+ * because we told it to, remember the coordinates we told it, not the
+ * ones it actually moved it to. This allows us to move the window back to
+ * the same coordinates later and get the same result. Without this check,
+ * windows can "walk" across the screen under some conditions.
*
- * 2. Don't update wmPtr->x and wmPtr->y unless wrapperPtr->changes.x
- * or wrapperPtr->changes.y has changed (otherwise a size change can
- * spoof us into thinking that the position changed too and defeat
- * the intent of (1) above.
+ * 2. Don't update wmPtr->x and wmPtr->y unless wrapperPtr->changes.x or
+ * wrapperPtr->changes.y has changed (otherwise a size change can spoof us
+ * into thinking that the position changed too and defeat the intent of
+ * (1) above.
*
- * (As of 9/96 the above 2 comments appear to be stale. They're
- * being left in place as a reminder of what was once true (and
- * perhaps should still be true?)).
+ * (As of 9/96 the above 2 comments appear to be stale. They're being left
+ * in place as a reminder of what was once true (and perhaps should still
+ * be true?)).
*
- * 3. Ignore size changes coming from the window system if we're
- * about to change the size ourselves but haven't seen the event for
- * it yet: our size change is supposed to take priority.
+ * 3. Ignore size changes coming from the window system if we're about to
+ * change the size ourselves but haven't seen the event for it yet: our
+ * size change is supposed to take priority.
*/
if (!(wmPtr->flags & WM_MOVE_PENDING)
@@ -3953,25 +4252,69 @@ ComputeReparentGeometry(wmPtr)
/*
*----------------------------------------------------------------------
*
+ * PropertyEvent --
+ *
+ * Handle PropertyNotify events on wrapper windows. The following
+ * properties are of interest:
+ *
+ * _NET_WM_STATE:
+ * Used to keep wmPtr->attributes up to date.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+PropertyEvent(
+ WmInfo *wmPtr, /* Information about toplevel window. */
+ XPropertyEvent *eventPtr) /* PropertyNotify event structure */
+{
+ TkWindow *wrapperPtr = wmPtr->wrapperPtr;
+ Atom _NET_WM_STATE =
+ Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_STATE");
+
+ if (eventPtr->atom == _NET_WM_STATE) {
+ Atom actualType;
+ int actualFormat;
+ unsigned long numItems, bytesAfter;
+ unsigned char *propertyValue = 0;
+ long maxLength = 1024;
+
+ if (XGetWindowProperty(
+ wrapperPtr->display, wrapperPtr->window, _NET_WM_STATE,
+ 0l, maxLength, False, XA_ATOM,
+ &actualType, &actualFormat, &numItems, &bytesAfter,
+ &propertyValue) == Success) {
+ CheckNetWmState(wmPtr, (Atom *) propertyValue, (int) numItems);
+ XFree(propertyValue);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WrapperEventProc --
*
- * This procedure is invoked by the event loop when a wrapper window
- * is restructured.
+ * This function is invoked by the event loop when a wrapper window is
+ * restructured.
*
* Results:
* None.
*
* Side effects:
- * Tk's internal data structures for the window get modified to
- * reflect the structural change.
+ * Tk's internal data structures for the window get modified to reflect
+ * the structural change.
*
*----------------------------------------------------------------------
*/
+static const unsigned int WrapperEventMask =
+ (StructureNotifyMask | PropertyChangeMask);
+
static void
-WrapperEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about toplevel window. */
- XEvent *eventPtr; /* Event that just happened. */
+WrapperEventProc(
+ ClientData clientData, /* Information about toplevel window. */
+ XEvent *eventPtr) /* Event that just happened. */
{
WmInfo *wmPtr = (WmInfo *) clientData;
XEvent mapEvent;
@@ -3984,14 +4327,14 @@ WrapperEventProc(clientData, eventPtr)
if (!(wmPtr->wrapperPtr->flags & TK_ALREADY_DEAD)) {
/*
* A top-level window was deleted externally (e.g., by the window
- * manager). This is probably not a good thing, but cleanup as
- * best we can. The error handler is needed because
+ * manager). This is probably not a good thing, but cleanup as
+ * best we can. The error handler is needed because
* Tk_DestroyWindow will try to destroy the window, but of course
* it's already gone.
*/
handler = Tk_CreateErrorHandler(wmPtr->winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ NULL, NULL);
Tk_DestroyWindow((Tk_Window) wmPtr->winPtr);
Tk_DeleteErrorHandler(handler);
}
@@ -4000,13 +4343,12 @@ WrapperEventProc(clientData, eventPtr)
}
} else if (eventPtr->type == ConfigureNotify) {
/*
- * Ignore the event if the window has never been mapped yet.
- * Such an event occurs only in weird cases like changing the
- * internal border width of a top-level window, which results
- * in a synthetic Configure event. These events are not relevant
- * to us, and if we process them confusion may result (e.g. we
- * may conclude erroneously that the user repositioned or resized
- * the window).
+ * Ignore the event if the window has never been mapped yet. Such an
+ * event occurs only in weird cases like changing the internal border
+ * width of a top-level window, which results in a synthetic Configure
+ * event. These events are not relevant to us, and if we process them
+ * confusion may result (e.g. we may conclude erroneously that the
+ * user repositioned or resized the window).
*/
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -4024,10 +4366,12 @@ WrapperEventProc(clientData, eventPtr)
goto doMapEvent;
} else if (eventPtr->type == ReparentNotify) {
ReparentEvent(wmPtr, &eventPtr->xreparent);
+ } else if (eventPtr->type == PropertyNotify) {
+ PropertyEvent(wmPtr, &eventPtr->xproperty);
}
return;
- doMapEvent:
+ doMapEvent:
mapEvent = *eventPtr;
mapEvent.xmap.event = wmPtr->winPtr->window;
mapEvent.xmap.window = wmPtr->winPtr->window;
@@ -4039,42 +4383,42 @@ WrapperEventProc(clientData, eventPtr)
*
* TopLevelReqProc --
*
- * This procedure is invoked by the geometry manager whenever
- * the requested size for a top-level window is changed.
+ * This function is invoked by the geometry manager whenever the
+ * requested size for a top-level window is changed.
*
* Results:
* None.
*
* Side effects:
- * Arrange for the window to be resized to satisfy the request
- * (this happens as a when-idle action).
+ * Arrange for the window to be resized to satisfy the request (this
+ * happens as a when-idle action).
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
-TopLevelReqProc(dummy, tkwin)
- ClientData dummy; /* Not used. */
- Tk_Window tkwin; /* Information about window. */
+TopLevelReqProc(
+ ClientData dummy, /* Not used. */
+ Tk_Window tkwin) /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
- wmPtr = winPtr->wmInfoPtr;
+ if ((wmPtr = winPtr->wmInfoPtr) == NULL)
+ return;
if ((wmPtr->width >= 0) && (wmPtr->height >= 0)) {
/*
- * Explicit dimensions have been set for this window, so we
- * should ignore the geometry request. It's actually important
- * to ignore the geometry request because, due to quirks in
- * window managers, invoking UpdateGeometryInfo may cause the
- * window to move. For example, if "wm geometry -10-20" was
- * invoked, the window may be positioned incorrectly the first
- * time it appears (because we didn't know the proper width of
- * the window manager borders); if we invoke UpdateGeometryInfo
- * again, the window will be positioned correctly, which may
- * cause it to jump on the screen.
+ * Explicit dimensions have been set for this window, so we should
+ * ignore the geometry request. It's actually important to ignore the
+ * geometry request because, due to quirks in window managers,
+ * invoking UpdateGeometryInfo may cause the window to move. For
+ * example, if "wm geometry -10-20" was invoked, the window may be
+ * positioned incorrectly the first time it appears (because we didn't
+ * know the proper width of the window manager borders); if we invoke
+ * UpdateGeometryInfo again, the window will be positioned correctly,
+ * which may cause it to jump on the screen.
*/
return;
@@ -4087,8 +4431,8 @@ TopLevelReqProc(dummy, tkwin)
}
/*
- * If the window isn't being positioned by its upper left corner
- * then we have to move it as well.
+ * If the window isn't being positioned by its upper left corner then we
+ * have to move it as well.
*/
if (wmPtr->flags & (WM_NEGATIVE_X | WM_NEGATIVE_Y)) {
@@ -4101,26 +4445,25 @@ TopLevelReqProc(dummy, tkwin)
*
* UpdateGeometryInfo --
*
- * This procedure is invoked when a top-level window is first
- * mapped, and also as a when-idle procedure, to bring the
- * geometry and/or position of a top-level window back into
- * line with what has been requested by the user and/or widgets.
- * This procedure doesn't return until the window manager has
- * responded to the geometry change.
+ * This function is invoked when a top-level window is first mapped, and
+ * also as a when-idle function, to bring the geometry and/or position of
+ * a top-level window back into line with what has been requested by the
+ * user and/or widgets. This function doesn't return until the window
+ * manager has responded to the geometry change.
*
* Results:
* None.
*
* Side effects:
- * The size and location of both the toplevel window and its wrapper
- * may change, unless the WM prevents that from happening.
+ * The size and location of both the toplevel window and its wrapper may
+ * change, unless the WM prevents that from happening.
*
*----------------------------------------------------------------------
*/
static void
-UpdateGeometryInfo(clientData)
- ClientData clientData; /* Pointer to the window's record. */
+UpdateGeometryInfo(
+ ClientData clientData) /* Pointer to the window's record. */
{
register TkWindow *winPtr = (TkWindow *) clientData;
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4130,15 +4473,13 @@ UpdateGeometryInfo(clientData)
wmPtr->flags &= ~WM_UPDATE_PENDING;
/*
- * Compute the new size for the top-level window. See the
- * user documentation for details on this, but the size
- * requested depends on (a) the size requested internally
- * by the window's widgets, (b) the size requested by the
- * user in a "wm geometry" command or via wm-based interactive
- * resizing (if any), (c) whether or not the window is
- * gridded, and (d) the current min or max size for
- * the toplevel. Don't permit sizes <= 0 because this
- * upsets the X server.
+ * Compute the new size for the top-level window. See the user
+ * documentation for details on this, but the size requested depends on
+ * (a) the size requested internally by the window's widgets, (b) the size
+ * requested by the user in a "wm geometry" command or via wm-based
+ * interactive resizing (if any), (c) whether or not the window is
+ * gridded, and (d) the current min or max size for the toplevel. Don't
+ * permit sizes <= 0 because this upsets the X server.
*/
if (wmPtr->width == -1) {
@@ -4152,9 +4493,11 @@ UpdateGeometryInfo(clientData)
if (width <= 0) {
width = 1;
}
+
/*
* Account for window max/min width
*/
+
if (wmPtr->gridWin != NULL) {
min = winPtr->reqWidth
+ (wmPtr->minWidth - wmPtr->reqGridWidth)*wmPtr->widthInc;
@@ -4185,9 +4528,11 @@ UpdateGeometryInfo(clientData)
if (height <= 0) {
height = 1;
}
+
/*
* Account for window max/min height
*/
+
if (wmPtr->gridWin != NULL) {
min = winPtr->reqHeight
+ (wmPtr->minHeight - wmPtr->reqGridHeight)*wmPtr->heightInc;
@@ -4209,30 +4554,30 @@ UpdateGeometryInfo(clientData)
/*
* Compute the new position for the upper-left pixel of the window's
- * decorative frame. This is tricky, because we need to include the
- * border widths supplied by a reparented parent in this calculation,
- * but can't use the parent's current overall size since that may
- * change as a result of this code.
+ * decorative frame. This is tricky, because we need to include the border
+ * widths supplied by a reparented parent in this calculation, but can't
+ * use the parent's current overall size since that may change as a result
+ * of this code.
*/
if (wmPtr->flags & WM_NEGATIVE_X) {
x = wmPtr->vRootWidth - wmPtr->x
- (width + (wmPtr->parentWidth - winPtr->changes.width));
} else {
- x = wmPtr->x;
+ x = wmPtr->x;
}
if (wmPtr->flags & WM_NEGATIVE_Y) {
y = wmPtr->vRootHeight - wmPtr->y
- (height + (wmPtr->parentHeight - winPtr->changes.height));
} else {
- y = wmPtr->y;
+ y = wmPtr->y;
}
/*
- * If the window's size is going to change and the window is
- * supposed to not be resizable by the user, then we have to
- * update the size hints. There may also be a size-hint-update
- * request pending from somewhere else, too.
+ * If the window's size is going to change and the window is supposed to
+ * not be resizable by the user, then we have to update the size hints.
+ * There may also be a size-hint-update request pending from somewhere
+ * else, too.
*/
if (((width != winPtr->changes.width)
@@ -4246,47 +4591,46 @@ UpdateGeometryInfo(clientData)
}
/*
- * Reconfigure the wrapper if it isn't already configured correctly.
- * A few tricky points:
+ * Reconfigure the wrapper if it isn't already configured correctly. A few
+ * tricky points:
*
- * 1. If the window is embeddedand the container is also in this
- * process, don't actually reconfigure the window; just pass the
- * desired size on to the container. Also, zero out any position
- * information, since embedded windows are not allowed to move.
- * 2. Sometimes the window manager will give us a different size
- * than we asked for (e.g. mwm has a minimum size for windows), so
- * base the size check on what we *asked for* last time, not what we
- * got.
+ * 1. If the window is embeddedand the container is also in this process,
+ * don't actually reconfigure the window; just pass the desired size on
+ * to the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
+ * 2. Sometimes the window manager will give us a different size than we
+ * asked for (e.g. mwm has a minimum size for windows), so base the
+ * size check on what we *asked for* last time, not what we got.
* 3. Can't just reconfigure always, because we may not get a
* ConfigureNotify event back if nothing changed, so
* WaitForConfigureNotify will hang a long time.
- * 4. Don't move window unless a new position has been requested for
- * it. This is because of "features" in some window managers (e.g.
- * twm, as of 4/24/91) where they don't interpret coordinates
- * according to ICCCM. Moving a window to its current location may
- * cause it to shift position on the screen.
+ * 4. Don't move window unless a new position has been requested for it.
+ * This is because of "features" in some window managers (e.g. twm, as
+ * of 4/24/91) where they don't interpret coordinates according to
+ * ICCCM. Moving a window to its current location may cause it to shift
+ * position on the screen.
*/
if ((winPtr->flags & (TK_EMBEDDED|TK_BOTH_HALVES))
== (TK_EMBEDDED|TK_BOTH_HALVES)) {
TkWindow *childPtr = TkpGetOtherWindow(winPtr);
+
/*
- * This window is embedded and the container is also in this
- * process, so we don't need to do anything special about the
- * geometry, except to make sure that the desired size is known
- * by the container. Also, zero out any position information,
- * since embedded windows are not allowed to move.
+ * This window is embedded and the container is also in this process,
+ * so we don't need to do anything special about the geometry, except
+ * to make sure that the desired size is known by the container. Also,
+ * zero out any position information, since embedded windows are not
+ * allowed to move.
*/
wmPtr->x = wmPtr->y = 0;
wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
+ height += wmPtr->menuHeight;
if (childPtr != NULL) {
- height += wmPtr->menuHeight;
Tk_GeometryRequest((Tk_Window) childPtr, width, height);
}
return;
}
-
serial = NextRequest(winPtr->display);
height += wmPtr->menuHeight;
if (wmPtr->flags & WM_MOVE_PENDING) {
@@ -4295,9 +4639,9 @@ UpdateGeometryInfo(clientData)
&& (width == wmPtr->wrapperPtr->changes.width)
&& (height == wmPtr->wrapperPtr->changes.height)) {
/*
- * The window already has the correct geometry, so don't bother
- * to configure it; the X server appears to ignore these
- * requests, so we won't get back a ConfigureNotify and the
+ * The window already has the correct geometry, so don't bother to
+ * configure it; the X server appears to ignore these requests, so
+ * we won't get back a ConfigureNotify and the
* WaitForConfigureNotify call below will hang for a while.
*/
@@ -4307,8 +4651,8 @@ UpdateGeometryInfo(clientData)
wmPtr->configWidth = width;
wmPtr->configHeight = height;
if (winPtr->dispPtr->flags & TK_DISPLAY_WM_TRACING) {
- printf("UpdateGeometryInfo moving to %d %d, resizing to %d x %d,\n",
- x, y, width, height);
+ printf("UpdateGeometryInfo moving to %d %d, resizing to %dx%d,\n",
+ x, y, width, height);
}
XMoveResizeWindow(winPtr->display, wmPtr->wrapperPtr->window, x, y,
(unsigned) width, (unsigned) height);
@@ -4317,9 +4661,9 @@ UpdateGeometryInfo(clientData)
if ((width == wmPtr->wrapperPtr->changes.width)
&& (height == wmPtr->wrapperPtr->changes.height)) {
/*
- * The window is already just the size we want, so don't bother
- * to configure it; the X server appears to ignore these
- * requests, so we won't get back a ConfigureNotify and the
+ * The window is already just the size we want, so don't bother to
+ * configure it; the X server appears to ignore these requests, so
+ * we won't get back a ConfigureNotify and the
* WaitForConfigureNotify call below will hang for a while.
*/
@@ -4329,7 +4673,7 @@ UpdateGeometryInfo(clientData)
wmPtr->configHeight = height;
if (winPtr->dispPtr->flags & TK_DISPLAY_WM_TRACING) {
printf("UpdateGeometryInfo resizing %p to %d x %d\n",
- (void *)wmPtr->wrapperPtr->window, width, height);
+ (void *) wmPtr->wrapperPtr->window, width, height);
}
XResizeWindow(winPtr->display, wmPtr->wrapperPtr->window,
(unsigned) width, (unsigned) height);
@@ -4337,8 +4681,8 @@ UpdateGeometryInfo(clientData)
&& ((Tk_Width(wmPtr->menubar) != wmPtr->wrapperPtr->changes.width)
|| (Tk_Height(wmPtr->menubar) != wmPtr->menuHeight))) {
/*
- * It is possible that the window's overall size has not changed
- * but the menu size has.
+ * It is possible that the window's overall size has not changed but
+ * the menu size has.
*/
Tk_MoveResizeWindow(wmPtr->menubar, 0, 0,
@@ -4350,9 +4694,9 @@ UpdateGeometryInfo(clientData)
}
/*
- * Wait for the configure operation to complete. Don't need to do
- * this, however, if the window is about to be mapped: it will be
- * taken care of elsewhere.
+ * Wait for the configure operation to complete. Don't need to do this,
+ * however, if the window is about to be mapped: it will be taken care of
+ * elsewhere.
*/
if (!(wmPtr->flags & WM_ABOUT_TO_MAP)) {
@@ -4365,9 +4709,8 @@ UpdateGeometryInfo(clientData)
*
* UpdateSizeHints --
*
- * This procedure is called to update the window manager's
- * size hints information from the information in a WmInfo
- * structure.
+ * This function is called to update the window manager's size hints
+ * information from the information in a WmInfo structure.
*
* Results:
* None.
@@ -4379,10 +4722,10 @@ UpdateGeometryInfo(clientData)
*/
static void
-UpdateSizeHints(winPtr, newWidth, newHeight)
- TkWindow *winPtr;
- int newWidth;
- int newHeight;
+UpdateSizeHints(
+ TkWindow *winPtr,
+ int newWidth,
+ int newHeight)
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
XSizeHints *hintsPtr;
@@ -4396,9 +4739,8 @@ UpdateSizeHints(winPtr, newWidth, newHeight)
}
/*
- * Compute the pixel-based sizes for the various fields in the
- * size hints structure, based on the grid-based sizes in
- * our structure.
+ * Compute the pixel-based sizes for the various fields in the size hints
+ * structure, based on the grid-based sizes in our structure.
*/
GetMaxSize(wmPtr, &maxWidth, &maxHeight);
@@ -4439,18 +4781,18 @@ UpdateSizeHints(winPtr, newWidth, newHeight)
hintsPtr->flags = wmPtr->sizeHintsFlags | PMinSize;
/*
- * If the window isn't supposed to be resizable, then set the
- * minimum and maximum dimensions to be the same.
+ * If the window isn't supposed to be resizable, then set the minimum and
+ * maximum dimensions to be the same.
*/
if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
hintsPtr->max_width = hintsPtr->min_width = newWidth;
- hintsPtr->flags |= PMaxSize;
+ hintsPtr->flags |= PMaxSize;
}
if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
hintsPtr->max_height = hintsPtr->min_height =
- newHeight + wmPtr->menuHeight;
- hintsPtr->flags |= PMaxSize;
+ newHeight + wmPtr->menuHeight;
+ hintsPtr->flags |= PMaxSize;
}
XSetWMNormalHints(winPtr->display, wmPtr->wrapperPtr->window, hintsPtr);
@@ -4463,27 +4805,26 @@ UpdateSizeHints(winPtr, newWidth, newHeight)
*
* UpdateTitle --
*
- * This procedure is called to update the window title and
- * icon name. It sets the ICCCM-defined properties WM_NAME
- * and WM_ICON_NAME for older window managers, and the
- * freedesktop.org-defined _NET_WM_NAME and _NET_WM_ICON_NAME
- * properties for newer ones. The ICCCM properties are
- * stored in the system encoding, the newer properties
- * are stored in UTF-8.
+ * This function is called to update the window title and icon name. It
+ * sets the ICCCM-defined properties WM_NAME and WM_ICON_NAME for older
+ * window managers, and the freedesktop.org-defined _NET_WM_NAME and
+ * _NET_WM_ICON_NAME properties for newer ones. The ICCCM properties are
+ * stored in the system encoding, the newer properties are stored in
+ * UTF-8.
*
- * NOTE: the ICCCM specifies that WM_NAME and WM_ICON_NAME are
- * stored in ISO-Latin-1. Tk has historically used the default
- * system encoding (since 8.1). It's not clear whether this is
- * correct or not.
+ * NOTE: the ICCCM specifies that WM_NAME and WM_ICON_NAME are stored in
+ * ISO-Latin-1. Tk has historically used the default system encoding
+ * (since 8.1). It's not clear whether this is correct or not.
*
* Side effects:
* Properties get changed for winPtr.
*
*--------------------------------------------------------------
*/
+
static void
-UpdateTitle(winPtr)
- TkWindow *winPtr;
+UpdateTitle(
+ TkWindow *winPtr)
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
Atom XA_UTF8_STRING = Tk_InternAtom((Tk_Window) winPtr, "UTF8_STRING");
@@ -4493,6 +4834,7 @@ UpdateTitle(winPtr)
/*
* Set window title:
*/
+
string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid;
Tcl_UtfToExternalDString(NULL, string, -1, &ds);
XStoreName(winPtr->display, wmPtr->wrapperPtr->window,
@@ -4501,12 +4843,13 @@ UpdateTitle(winPtr)
XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_NAME"),
- XA_UTF8_STRING, 8, PropModeReplace,
- (const unsigned char*)string, (signed int)strlen(string));
+ XA_UTF8_STRING, 8, PropModeReplace,
+ (const unsigned char *) string, (signed int) strlen(string));
/*
* Set icon name:
*/
+
if (wmPtr->iconName != NULL) {
Tcl_UtfToExternalDString(NULL, wmPtr->iconName, -1, &ds);
XSetIconName(winPtr->display, wmPtr->wrapperPtr->window,
@@ -4516,8 +4859,8 @@ UpdateTitle(winPtr)
XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_ICON_NAME"),
XA_UTF8_STRING, 8, PropModeReplace,
- (const unsigned char*)wmPtr->iconName,
- (signed int)strlen(wmPtr->iconName));
+ (const unsigned char *) wmPtr->iconName,
+ (signed int) strlen(wmPtr->iconName));
}
}
@@ -4526,17 +4869,18 @@ UpdateTitle(winPtr)
*
* UpdatePhotoIcon --
*
- * This procedure is called to update the window ohoto icon.
- * It sets the EWMH-defined properties _NET_WM_ICON.
+ * This function is called to update the window photo icon. It sets the
+ * EWMH-defined properties _NET_WM_ICON.
*
* Side effects:
* Properties get changed for winPtr.
*
*--------------------------------------------------------------
*/
+
static void
-UpdatePhotoIcon(winPtr)
- TkWindow *winPtr;
+UpdatePhotoIcon(
+ TkWindow *winPtr)
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
unsigned char *data = wmPtr->iconDataPtr;
@@ -4550,6 +4894,7 @@ UpdatePhotoIcon(winPtr)
/*
* Set icon:
*/
+
XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_ICON"),
XA_CARDINAL, 32, PropModeReplace,
@@ -4560,50 +4905,191 @@ UpdatePhotoIcon(winPtr)
/*
*----------------------------------------------------------------------
*
+ * SetNetWmState --
+ *
+ * Sets the specified state property by sending a _NET_WM_STATE
+ * ClientMessage to the root window.
+ *
+ * Preconditions:
+ * Wrapper window must be created.
+ *
+ * See also:
+ * UpdateNetWmState; EWMH spec, section _NET_WM_STATE.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#define _NET_WM_STATE_REMOVE 0l
+#define _NET_WM_STATE_ADD 1l
+#define _NET_WM_STATE_TOGGLE 2l
+
+static void
+SetNetWmState(
+ TkWindow *winPtr,
+ const char *atomName,
+ int on)
+{
+ Tk_Window tkwin = (Tk_Window) winPtr;
+ Atom messageType = Tk_InternAtom(tkwin, "_NET_WM_STATE");
+ Atom action = on ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
+ Atom property = Tk_InternAtom(tkwin, atomName);
+ XEvent e;
+
+ if (!winPtr->wmInfoPtr->wrapperPtr) {
+ return;
+ }
+
+ e.xany.type = ClientMessage;
+ e.xany.window = winPtr->wmInfoPtr->wrapperPtr->window;
+ e.xclient.message_type = messageType;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = action;
+ e.xclient.data.l[1] = property;
+ e.xclient.data.l[2] = e.xclient.data.l[3] = e.xclient.data.l[4] = 0l;
+
+ XSendEvent(winPtr->display,
+ RootWindow(winPtr->display, winPtr->screenNum), 0,
+ SubstructureNotifyMask|SubstructureRedirectMask, &e);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CheckNetWmState --
+ *
+ * Updates the window attributes whenever the _NET_WM_STATE property
+ * changes.
+ *
+ * Notes:
+ *
+ * Tk uses a single -zoomed state, while the EWMH spec supports separate
+ * vertical and horizontal maximization. We consider the window to be
+ * "zoomed" if _NET_WM_STATE_MAXIMIZED_VERT and
+ * _NET_WM_STATE_MAXIMIZED_HORZ are both set.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CheckNetWmState(
+ WmInfo *wmPtr,
+ Atom *atoms,
+ int numAtoms)
+{
+ Tk_Window tkwin = (Tk_Window) wmPtr->wrapperPtr;
+ int i;
+ Atom _NET_WM_STATE_ABOVE
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_ABOVE"),
+ _NET_WM_STATE_MAXIMIZED_VERT
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_MAXIMIZED_VERT"),
+ _NET_WM_STATE_MAXIMIZED_HORZ
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_MAXIMIZED_HORZ"),
+ _NET_WM_STATE_FULLSCREEN
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_FULLSCREEN");
+
+ wmPtr->attributes.topmost = 0;
+ wmPtr->attributes.zoomed = 0;
+ wmPtr->attributes.fullscreen = 0;
+ for (i = 0; i < numAtoms; ++i) {
+ if (atoms[i] == _NET_WM_STATE_ABOVE) {
+ wmPtr->attributes.topmost = 1;
+ } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
+ wmPtr->attributes.zoomed |= 1;
+ } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) {
+ wmPtr->attributes.zoomed |= 2;
+ } else if (atoms[i] == _NET_WM_STATE_FULLSCREEN) {
+ wmPtr->attributes.fullscreen = 1;
+ }
+ }
+
+ wmPtr->attributes.zoomed = (wmPtr->attributes.zoomed == 3);
+
+ return;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateNetWmState --
+ *
+ * Sets the _NET_WM_STATE property to match the requested attribute state
+ * just prior to mapping a withdrawn window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#define NET_WM_STATE_MAX_ATOMS 4
+
+static void
+UpdateNetWmState(
+ WmInfo *wmPtr)
+{
+ Tk_Window tkwin = (Tk_Window) wmPtr->wrapperPtr;
+ Atom atoms[NET_WM_STATE_MAX_ATOMS];
+ long numAtoms = 0;
+
+ if (wmPtr->reqState.topmost) {
+ atoms[numAtoms++] = Tk_InternAtom(tkwin,"_NET_WM_STATE_ABOVE");
+ }
+ if (wmPtr->reqState.zoomed) {
+ atoms[numAtoms++] = Tk_InternAtom(tkwin,"_NET_WM_STATE_MAXIMIZED_VERT");
+ atoms[numAtoms++] = Tk_InternAtom(tkwin,"_NET_WM_STATE_MAXIMIZED_HORZ");
+ }
+ if (wmPtr->reqState.fullscreen) {
+ atoms[numAtoms++] = Tk_InternAtom(tkwin, "_NET_WM_STATE_FULLSCREEN");
+ }
+
+ XChangeProperty(Tk_Display(tkwin), wmPtr->wrapperPtr->window,
+ Tk_InternAtom(tkwin, "_NET_WM_STATE"), XA_ATOM, 32,
+ PropModeReplace, (unsigned char *) atoms, numAtoms);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WaitForConfigureNotify --
*
- * This procedure is invoked in order to synchronize with the
- * window manager. It waits for a ConfigureNotify event to
- * arrive, signalling that the window manager has seen an attempt
- * on our part to move or resize a top-level window.
+ * This function is invoked in order to synchronize with the window
+ * manager. It waits for a ConfigureNotify event to arrive, signalling
+ * that the window manager has seen an attempt on our part to move or
+ * resize a top-level window.
*
* Results:
* None.
*
* Side effects:
* Delays the execution of the process until a ConfigureNotify event
- * arrives with serial number at least as great as serial. This
- * is useful for two reasons:
+ * arrives with serial number at least as great as serial. This is useful
+ * for two reasons:
*
* 1. It's important to distinguish ConfigureNotify events that are
* coming in response to a request we've made from those generated
- * spontaneously by the user. The reason for this is that if the
- * user resizes the window we take that as an order to ignore
- * geometry requests coming from inside the window hierarchy. If
- * we accidentally interpret a response to our request as a
- * user-initiated action, the window will stop responding to
- * new geometry requests. To make this distinction, (a) this
- * procedure sets a flag for TopLevelEventProc to indicate that
- * we're waiting to sync with the wm, and (b) all changes to
- * the size of a top-level window are followed by calls to this
- * procedure.
- * 2. Races and confusion can come about if there are multiple
- * operations outstanding at a time (e.g. two different resizes
- * of the top-level window: it's hard to tell which of the
- * ConfigureNotify events coming back is for which request).
+ * spontaneously by the user. The reason for this is that if the user
+ * resizes the window we take that as an order to ignore geometry
+ * requests coming from inside the window hierarchy. If we
+ * accidentally interpret a response to our request as a user-
+ * initiated action, the window will stop responding to new geometry
+ * requests. To make this distinction, (a) this function sets a flag
+ * for TopLevelEventProc to indicate that we're waiting to sync with
+ * the wm, and (b) all changes to the size of a top-level window are
+ * followed by calls to this function.
+ * 2. Races and confusion can come about if there are multiple operations
+ * outstanding at a time (e.g. two different resizes of the top-level
+ * window: it's hard to tell which of the ConfigureNotify events
+ * coming back is for which request).
* While waiting, some events covered by StructureNotifyMask are
- * processed (ConfigureNotify, MapNotify, and UnmapNotify)
- * and all others are deferred.
+ * processed (ConfigureNotify, MapNotify, and UnmapNotify) and all others
+ * are deferred.
*
*----------------------------------------------------------------------
*/
static void
-WaitForConfigureNotify(winPtr, serial)
- TkWindow *winPtr; /* Top-level window for which we want
- * to see a ConfigureNotify. */
- unsigned long serial; /* Serial number of resize request. Want to
- * be sure wm has seen this. */
+WaitForConfigureNotify(
+ TkWindow *winPtr, /* Top-level window for which we want to see a
+ * ConfigureNotify. */
+ unsigned long serial) /* Serial number of resize request. Want to be
+ * sure wm has seen this. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
XEvent event;
@@ -4611,11 +5097,10 @@ WaitForConfigureNotify(winPtr, serial)
int gotConfig = 0;
/*
- * One more tricky detail about this procedure. In some cases the
- * window manager will decide to ignore a configure request (e.g.
- * because it thinks the window is already in the right place).
- * To avoid hanging in this situation, only wait for a few seconds,
- * then give up.
+ * One more tricky detail about this function. In some cases the window
+ * manager will decide to ignore a configure request (e.g. because it
+ * thinks the window is already in the right place). To avoid hanging in
+ * this situation, only wait for a few seconds, then give up.
*/
while (!gotConfig) {
@@ -4646,32 +5131,31 @@ WaitForConfigureNotify(winPtr, serial)
*
* WaitForEvent --
*
- * This procedure is used by WaitForConfigureNotify and
- * WaitForMapNotify to wait for an event of a certain type
- * to arrive.
+ * This function is used by WaitForConfigureNotify and WaitForMapNotify
+ * to wait for an event of a certain type to arrive.
*
* Results:
- * Under normal conditions, TCL_OK is returned and an event for
- * display and window that matches "mask" is stored in *eventPtr.
- * This event has already been processed by Tk before this procedure
- * returns. If a long time goes by with no event of the right type
- * arriving, or if an error occurs while waiting for the event to
- * arrive, then TCL_ERROR is returned.
+ * Under normal conditions, TCL_OK is returned and an event for display
+ * and window that matches "mask" is stored in *eventPtr. This event has
+ * already been processed by Tk before this function returns. If a long
+ * time goes by with no event of the right type arriving, or if an error
+ * occurs while waiting for the event to arrive, then TCL_ERROR is
+ * returned.
*
* Side effects:
* While waiting for the desired event to occur, Configurenotify,
- * MapNotify, and UnmapNotify events for window are processed,
- * as are all ReparentNotify events.
+ * MapNotify, and UnmapNotify events for window are processed, as are all
+ * ReparentNotify events.
*
*----------------------------------------------------------------------
*/
static int
-WaitForEvent(display, wmInfoPtr, type, eventPtr)
- Display *display; /* Display event is coming from. */
- WmInfo *wmInfoPtr; /* Window for which event is desired. */
- int type; /* Type of event that is wanted. */
- XEvent *eventPtr; /* Place to store event. */
+WaitForEvent(
+ Display *display, /* Display event is coming from. */
+ WmInfo *wmInfoPtr, /* Window for which event is desired. */
+ int type, /* Type of event that is wanted. */
+ XEvent *eventPtr) /* Place to store event. */
{
WaitRestrictInfo info;
Tk_RestrictProc *oldRestrictProc;
@@ -4679,9 +5163,9 @@ WaitForEvent(display, wmInfoPtr, type, eventPtr)
Tcl_Time timeout;
/*
- * Set up an event filter to select just the events we want, and
- * a timer handler, then wait for events until we get the event
- * we want or a timeout happens.
+ * Set up an event filter to select just the events we want, and a timer
+ * handler, then wait for events until we get the event we want or a
+ * timeout happens.
*/
info.display = display;
@@ -4713,26 +5197,26 @@ WaitForEvent(display, wmInfoPtr, type, eventPtr)
*
* WaitRestrictProc --
*
- * This procedure is a Tk_RestrictProc that is used to filter
- * events while WaitForEvent is active.
+ * This function is a Tk_RestrictProc that is used to filter events while
+ * WaitForEvent is active.
*
* Results:
- * Returns TK_PROCESS_EVENT if the right event is found. Also
- * returns TK_PROCESS_EVENT if any ReparentNotify event is found
- * or if the event is a ConfigureNotify, MapNotify, or UnmapNotify
- * for window. Otherwise returns TK_DEFER_EVENT.
+ * Returns TK_PROCESS_EVENT if the right event is found. Also returns
+ * TK_PROCESS_EVENT if any ReparentNotify event is found or if the event
+ * is a ConfigureNotify, MapNotify, or UnmapNotify for window. Otherwise
+ * returns TK_DEFER_EVENT.
*
* Side effects:
- * An event may get stored in the area indicated by the caller
- * of WaitForEvent.
+ * An event may get stored in the area indicated by the caller of
+ * WaitForEvent.
*
*----------------------------------------------------------------------
*/
static Tk_RestrictAction
-WaitRestrictProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to WaitRestrictInfo structure. */
- XEvent *eventPtr; /* Event that is about to be handled. */
+WaitRestrictProc(
+ ClientData clientData, /* Pointer to WaitRestrictInfo structure. */
+ XEvent *eventPtr) /* Event that is about to be handled. */
{
WaitRestrictInfo *infoPtr = (WaitRestrictInfo *) clientData;
@@ -4749,9 +5233,8 @@ WaitRestrictProc(clientData, eventPtr)
infoPtr->foundEvent = 1;
return TK_PROCESS_EVENT;
}
- if (eventPtr->type == ConfigureNotify
- || eventPtr->type == MapNotify
- || eventPtr->type == UnmapNotify) {
+ if (eventPtr->type == ConfigureNotify || eventPtr->type == MapNotify
+ || eventPtr->type == UnmapNotify) {
return TK_PROCESS_EVENT;
}
return TK_DEFER_EVENT;
@@ -4762,32 +5245,31 @@ WaitRestrictProc(clientData, eventPtr)
*
* WaitForMapNotify --
*
- * This procedure is invoked in order to synchronize with the
- * window manager. It waits for the window's mapped state to
- * reach the value given by mapped.
+ * This function is invoked in order to synchronize with the window
+ * manager. It waits for the window's mapped state to reach the value
+ * given by mapped.
*
* Results:
* None.
*
* Side effects:
- * Delays the execution of the process until winPtr becomes mapped
- * or unmapped, depending on the "mapped" argument. This allows us
- * to synchronize with the window manager, and allows us to
- * identify changes in window size that come about when the window
- * manager first starts managing the window (as opposed to those
- * requested interactively by the user later). See the comments
- * for WaitForConfigureNotify and WM_SYNC_PENDING. While waiting,
- * some events covered by StructureNotifyMask are processed and all
- * others are deferred.
+ * Delays the execution of the process until winPtr becomes mapped or
+ * unmapped, depending on the "mapped" argument. This allows us to
+ * synchronize with the window manager, and allows us to identify changes
+ * in window size that come about when the window manager first starts
+ * managing the window (as opposed to those requested interactively by
+ * the user later). See the comments for WaitForConfigureNotify and
+ * WM_SYNC_PENDING. While waiting, some events covered by
+ * StructureNotifyMask are processed and all others are deferred.
*
*----------------------------------------------------------------------
*/
static void
-WaitForMapNotify(winPtr, mapped)
- TkWindow *winPtr; /* Top-level window for which we want
- * to see a particular mapping state. */
- int mapped; /* If non-zero, wait for window to become
+WaitForMapNotify(
+ TkWindow *winPtr, /* Top-level window for which we want to see a
+ * particular mapping state. */
+ int mapped) /* If non-zero, wait for window to become
* mapped, otherwise wait for it to become
* unmapped. */
{
@@ -4809,10 +5291,9 @@ WaitForMapNotify(winPtr, mapped)
wmPtr->flags &= ~WM_SYNC_PENDING;
if (code != TCL_OK) {
/*
- * There are some bizarre situations in which the window
- * manager can't respond or chooses not to (e.g. if we've
- * got a grab set it can't respond). If this happens then
- * just quit.
+ * There are some bizarre situations in which the window manager
+ * can't respond or chooses not to (e.g. if we've got a grab set
+ * it can't respond). If this happens then just quit.
*/
if (winPtr->dispPtr->flags & TK_DISPLAY_WM_TRACING) {
@@ -4833,9 +5314,8 @@ WaitForMapNotify(winPtr, mapped)
*
* UpdateHints --
*
- * This procedure is called to update the window manager's
- * hints information from the information in a WmInfo
- * structure.
+ * This function is called to update the window manager's hints
+ * information from the information in a WmInfo structure.
*
* Results:
* None.
@@ -4847,8 +5327,8 @@ WaitForMapNotify(winPtr, mapped)
*/
static void
-UpdateHints(winPtr)
- TkWindow *winPtr;
+UpdateHints(
+ TkWindow *winPtr)
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4874,9 +5354,7 @@ UpdateHints(winPtr)
*/
static int
-SetNetWmType(winPtr, typePtr)
- TkWindow *winPtr;
- Tcl_Obj *typePtr;
+SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr)
{
Atom typeAtom, *atoms = NULL;
WmInfo *wmPtr;
@@ -4884,7 +5362,7 @@ SetNetWmType(winPtr, typePtr)
Tcl_Obj **objv;
int objc, n;
Tk_Window tkwin = (Tk_Window)winPtr;
- Tcl_Interp *interp = winPtr->mainPtr->interp;
+ Tcl_Interp *interp = Tk_Interp(tkwin);
if (TCL_OK != Tcl_ListObjGetElements(interp, typePtr, &objc, &objv)) {
return TCL_ERROR;
@@ -4940,8 +5418,7 @@ SetNetWmType(winPtr, typePtr)
*/
static Tcl_Obj *
-GetNetWmType(winPtr)
- TkWindow *winPtr;
+GetNetWmType(TkWindow *winPtr)
{
Atom typeAtom, actualType, *atoms;
int actualFormat;
@@ -4954,7 +5431,7 @@ GetNetWmType(winPtr)
Tcl_Interp *interp;
Tcl_DString ds;
- interp = winPtr->mainPtr->interp;
+ interp = Tk_Interp(tkwin);
typePtr = Tcl_NewListObj(0, NULL);
if (winPtr->wmInfoPtr->wrapperPtr == NULL) {
@@ -4990,13 +5467,12 @@ GetNetWmType(winPtr)
*
* ParseGeometry --
*
- * This procedure parses a geometry string and updates
- * information used to control the geometry of a top-level
- * window.
+ * This function parses a geometry string and updates information used to
+ * control the geometry of a top-level window.
*
* Results:
- * A standard Tcl return value, plus an error message in
- * the interp's result if an error occurs.
+ * A standard Tcl return value, plus an error message in the interp's
+ * result if an error occurs.
*
* Side effects:
* The size and/or location of winPtr may change.
@@ -5005,12 +5481,12 @@ GetNetWmType(winPtr)
*/
static int
-ParseGeometry(interp, string, winPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- char *string; /* String containing new geometry. Has the
+ParseGeometry(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ char *string, /* String containing new geometry. Has the
* standard form "=wxh+x+y". */
- TkWindow *winPtr; /* Pointer to top-level window whose
- * geometry is to be changed. */
+ TkWindow *winPtr) /* Pointer to top-level window whose geometry
+ * is to be changed. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, flags;
@@ -5026,9 +5502,9 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Parse the width and height, if they are present. Don't
- * actually update any of the fields of wmPtr until we've
- * successfully parsed the entire geometry string.
+ * Parse the width and height, if they are present. Don't actually update
+ * any of the fields of wmPtr until we've successfully parsed the entire
+ * geometry string.
*/
width = wmPtr->width;
@@ -5082,10 +5558,10 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Assume that the geometry information came from the user,
- * unless an explicit source has been specified. Otherwise
- * most window managers assume that the size hints were
- * program-specified and they ignore them.
+ * Assume that the geometry information came from the user, unless an
+ * explicit source has been specified. Otherwise most window managers
+ * assume that the size hints were program-specified and they ignore
+ * them.
*/
if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
@@ -5095,9 +5571,9 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Everything was parsed OK. Update the fields of *wmPtr and
- * arrange for the appropriate information to be percolated out
- * to the window manager at the next idle moment.
+ * Everything was parsed OK. Update the fields of *wmPtr and arrange for
+ * the appropriate information to be percolated out to the window manager
+ * at the next idle moment.
*/
wmPtr->width = width;
@@ -5113,9 +5589,8 @@ ParseGeometry(interp, string, winPtr)
}
return TCL_OK;
- error:
- Tcl_AppendResult(interp, "bad geometry specifier \"",
- string, "\"", (char *) NULL);
+ error:
+ Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
return TCL_ERROR;
}
@@ -5124,15 +5599,15 @@ ParseGeometry(interp, string, winPtr)
*
* Tk_GetRootCoords --
*
- * Given a token for a window, this procedure traces through the
- * window's lineage to find the (virtual) root-window coordinates
- * corresponding to point (0,0) in the window.
+ * Given a token for a window, this function traces through the window's
+ * lineage to find the (virtual) root-window coordinates corresponding to
+ * point (0,0) in the window.
*
* Results:
- * The locations pointed to by xPtr and yPtr are filled in with
- * the root coordinates of the (0,0) point in tkwin. If a virtual
- * root window is in effect for the window, then the coordinates
- * in the virtual root are returned.
+ * The locations pointed to by xPtr and yPtr are filled in with the root
+ * coordinates of the (0,0) point in tkwin. If a virtual root window is
+ * in effect for the window, then the coordinates in the virtual root are
+ * returned.
*
* Side effects:
* None.
@@ -5141,18 +5616,17 @@ ParseGeometry(interp, string, winPtr)
*/
void
-Tk_GetRootCoords(tkwin, xPtr, yPtr)
- Tk_Window tkwin; /* Token for window. */
- int *xPtr; /* Where to store x-displacement of (0,0). */
- int *yPtr; /* Where to store y-displacement of (0,0). */
+Tk_GetRootCoords(
+ Tk_Window tkwin, /* Token for window. */
+ int *xPtr, /* Where to store x-displacement of (0,0). */
+ int *yPtr) /* Where to store y-displacement of (0,0). */
{
int x, y;
register TkWindow *winPtr = (TkWindow *) tkwin;
/*
- * Search back through this window's parents all the way to a
- * top-level window, combining the offsets of each window within
- * its parent.
+ * Search back through this window's parents all the way to a top-level
+ * window, combining the offsets of each window within its parent.
*/
x = y = 0;
@@ -5162,10 +5636,9 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
if ((winPtr->wmInfoPtr != NULL)
&& (winPtr->wmInfoPtr->menubar == (Tk_Window) winPtr)) {
/*
- * This window is a special menubar; switch over to its
- * associated toplevel, compensate for their differences in
- * y coordinates, then continue with the toplevel (in case
- * it's embedded).
+ * This window is a special menubar; switch over to its associated
+ * toplevel, compensate for their differences in y coordinates,
+ * then continue with the toplevel (in case it's embedded).
*/
y -= winPtr->wmInfoPtr->menuHeight;
@@ -5181,8 +5654,8 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
otherPtr = TkpGetOtherWindow(winPtr);
if (otherPtr == NULL) {
/*
- * The container window is not in the same application.
- * Query the X server.
+ * The container window is not in the same application. Query
+ * the X server.
*/
Window root, dummyChild;
@@ -5190,17 +5663,17 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
root = winPtr->wmInfoPtr->vRoot;
if (root == None) {
- root = RootWindowOfScreen(Tk_Screen((Tk_Window)winPtr));
+ root = RootWindowOfScreen(Tk_Screen((Tk_Window) winPtr));
}
XTranslateCoordinates(winPtr->display, winPtr->window,
- root, 0, 0, &rootX, &rootY, &dummyChild);
+ root, 0, 0, &rootX, &rootY, &dummyChild);
x += rootX;
y += rootY;
break;
} else {
/*
- * The container window is in the same application.
- * Let's query its coordinates.
+ * The container window is in the same application. Let's
+ * query its coordinates.
*/
winPtr = otherPtr;
@@ -5221,13 +5694,13 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
*
* Tk_CoordsToWindow --
*
- * Given the (virtual) root coordinates of a point, this procedure
- * returns the token for the top-most window covering that point,
- * if there exists such a window in this application.
+ * Given the (virtual) root coordinates of a point, this function returns
+ * the token for the top-most window covering that point, if there exists
+ * such a window in this application.
*
* Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
* window.
*
* Side effects:
@@ -5237,13 +5710,13 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
*/
Tk_Window
-Tk_CoordsToWindow(rootX, rootY, tkwin)
- int rootX, rootY; /* Coordinates of point in root window. If
- * a virtual-root window manager is in use,
+Tk_CoordsToWindow(
+ int rootX, int rootY, /* Coordinates of point in root window. If a
+ * virtual-root window manager is in use,
* these coordinates refer to the virtual
* root, not the real root. */
- Tk_Window tkwin; /* Token for any window in application;
- * used to identify the display. */
+ Tk_Window tkwin) /* Token for any window in application; used
+ * to identify the display. */
{
Window window, parent, child;
int x, y, childX, childY, tmpx, tmpy, bd;
@@ -5253,16 +5726,16 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
Tk_ErrorHandler handler = NULL;
/*
- * Step 1: scan the list of toplevel windows to see if there is a
- * virtual root for the screen we're interested in. If so, we have
- * to translate the coordinates from virtual root to root
- * coordinates.
+ * Step 1: scan the list of toplevel windows to see if there is a virtual
+ * root for the screen we're interested in. If so, we have to translate
+ * the coordinates from virtual root to root coordinates.
*/
parent = window = RootWindowOfScreen(Tk_Screen(tkwin));
x = rootX;
y = rootY;
- for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
+ for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
+ wmPtr = wmPtr->nextPtr) {
if (Tk_Screen(wmPtr->winPtr) != Tk_Screen(tkwin)) {
continue;
}
@@ -5275,29 +5748,28 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
}
/*
- * Step 2: work down through the window hierarchy starting at the
- * root. For each window, find the child that contains the given
- * point and then see if this child is either a wrapper for one of
- * our toplevel windows or a window manager decoration window for
- * one of our toplevels. This approach handles several tricky
- * cases:
+ * Step 2: work down through the window hierarchy starting at the root.
+ * For each window, find the child that contains the given point and then
+ * see if this child is either a wrapper for one of our toplevel windows
+ * or a window manager decoration window for one of our toplevels. This
+ * approach handles several tricky cases:
*
- * 1. There may be a virtual root window between the root and one of
- * our toplevels.
+ * 1. There may be a virtual root window between the root and one of our
+ * toplevels.
* 2. If a toplevel is embedded, we may have to search through the
- * windows of the container application(s) before getting to
- * the toplevel.
+ * windows of the container application(s) before getting to the
+ * toplevel.
*/
- handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1, NULL, NULL);
while (1) {
if (XTranslateCoordinates(Tk_Display(tkwin), parent, window,
x, y, &childX, &childY, &child) == False) {
/*
- * We can end up here when the window is in the middle of
- * being deleted
+ * We can end up here when the window is in the middle of being
+ * deleted
*/
+
Tk_DeleteErrorHandler(handler);
return NULL;
}
@@ -5306,7 +5778,7 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
return NULL;
}
for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
- wmPtr = wmPtr->nextPtr) {
+ wmPtr = wmPtr->nextPtr) {
if (wmPtr->reparent == child) {
goto gotToplevel;
}
@@ -5324,12 +5796,13 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
window = child;
}
- gotToplevel:
+ gotToplevel:
if (handler) {
/*
- * Check value of handler, because we can reach this label
- * from above or below
+ * Check value of handler, because we can reach this label from above
+ * or below
*/
+
Tk_DeleteErrorHandler(handler);
handler = NULL;
}
@@ -5341,10 +5814,9 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
/*
* Step 3: at this point winPtr and wmPtr refer to the toplevel that
* contains the given coordinates, and childX and childY give the
- * translated coordinates in the *parent* of the toplevel. Now
- * decide whether the coordinates are in the menubar or the actual
- * toplevel, and translate the coordinates into the coordinate
- * system of that window.
+ * translated coordinates in the *parent* of the toplevel. Now decide
+ * whether the coordinates are in the menubar or the actual toplevel, and
+ * translate the coordinates into the coordinate system of that window.
*/
x = childX - winPtr->changes.x;
@@ -5365,17 +5837,18 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
}
/*
- * Step 4: work down through the hierarchy underneath the current
- * window. At each level, scan through all the children to find the
- * highest one in the stacking order that contains the point. Then
- * repeat the whole process on that child.
+ * Step 4: work down through the hierarchy underneath the current window.
+ * At each level, scan through all the children to find the highest one in
+ * the stacking order that contains the point. Then repeat the whole
+ * process on that child.
*/
while (1) {
nextPtr = NULL;
for (childPtr = winPtr->childList; childPtr != NULL;
childPtr = childPtr->nextPtr) {
- if (!Tk_IsMapped(childPtr) || (childPtr->flags & TK_TOP_HIERARCHY)) {
+ if (!Tk_IsMapped(childPtr)
+ || (childPtr->flags & TK_TOP_HIERARCHY)) {
continue;
}
if (childPtr->flags & TK_REPARENTED) {
@@ -5400,9 +5873,9 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
&& (winPtr->flags & TK_BOTH_HALVES)) {
/*
* The window containing the point is a container, and the
- * embedded application is in this same process. Switch
- * over to the toplevel for the embedded application and
- * start processing that toplevel from scratch.
+ * embedded application is in this same process. Switch over to
+ * the toplevel for the embedded application and start processing
+ * that toplevel from scratch.
*/
winPtr = TkpGetOtherWindow(winPtr);
@@ -5423,24 +5896,23 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
*
* UpdateVRootGeometry --
*
- * This procedure is called to update all the virtual root
- * geometry information in wmPtr.
+ * This function is called to update all the virtual root geometry
+ * information in wmPtr.
*
* Results:
* None.
*
* Side effects:
- * The vRootX, vRootY, vRootWidth, and vRootHeight fields in
- * wmPtr are filled with the most up-to-date information.
+ * The vRootX, vRootY, vRootWidth, and vRootHeight fields in wmPtr are
+ * filled with the most up-to-date information.
*
*----------------------------------------------------------------------
*/
static void
-UpdateVRootGeometry(wmPtr)
- WmInfo *wmPtr; /* Window manager information to be
- * updated. The wmPtr->vRoot field must
- * be valid. */
+UpdateVRootGeometry(
+ WmInfo *wmPtr) /* Window manager information to be updated.
+ * The wmPtr->vRoot field must be valid. */
{
TkWindow *winPtr = wmPtr->winPtr;
int bd;
@@ -5456,7 +5928,7 @@ UpdateVRootGeometry(wmPtr)
wmPtr->flags &= ~WM_VROOT_OFFSET_STALE;
if (wmPtr->vRoot == None) {
- noVRoot:
+ noVRoot:
wmPtr->vRootX = wmPtr->vRootY = 0;
wmPtr->vRootWidth = DisplayWidth(winPtr->display, winPtr->screenNum);
wmPtr->vRootHeight = DisplayHeight(winPtr->display, winPtr->screenNum);
@@ -5467,8 +5939,7 @@ UpdateVRootGeometry(wmPtr)
* Refresh the virtual root information if it's out of date.
*/
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL);
status = XGetGeometry(winPtr->display, wmPtr->vRoot,
&dummy2, &wmPtr->vRootX, &wmPtr->vRootY,
(unsigned int *) &wmPtr->vRootWidth,
@@ -5482,7 +5953,7 @@ UpdateVRootGeometry(wmPtr)
Tk_DeleteErrorHandler(handler);
if (status == 0) {
/*
- * The virtual root is gone! Pretend that it never existed.
+ * The virtual root is gone! Pretend that it never existed.
*/
wmPtr->vRoot = None;
@@ -5495,16 +5966,15 @@ UpdateVRootGeometry(wmPtr)
*
* Tk_GetVRootGeometry --
*
- * This procedure returns information about the virtual root
- * window corresponding to a particular Tk window.
+ * This function returns information about the virtual root window
+ * corresponding to a particular Tk window.
*
* Results:
- * The values at xPtr, yPtr, widthPtr, and heightPtr are set
- * with the offset and dimensions of the root window corresponding
- * to tkwin. If tkwin is being managed by a virtual root window
- * manager these values correspond to the virtual root window being
- * used for tkwin; otherwise the offsets will be 0 and the
- * dimensions will be those of the screen.
+ * The values at xPtr, yPtr, widthPtr, and heightPtr are set with the
+ * offset and dimensions of the root window corresponding to tkwin. If
+ * tkwin is being managed by a virtual root window manager these values
+ * correspond to the virtual root window being used for tkwin; otherwise
+ * the offsets will be 0 and the dimensions will be those of the screen.
*
* Side effects:
* Vroot window information is refreshed if it is out of date.
@@ -5513,12 +5983,13 @@ UpdateVRootGeometry(wmPtr)
*/
void
-Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
- Tk_Window tkwin; /* Window whose virtual root is to be
+Tk_GetVRootGeometry(
+ Tk_Window tkwin, /* Window whose virtual root is to be
* queried. */
- int *xPtr, *yPtr; /* Store x and y offsets of virtual root
+ int *xPtr, int *yPtr, /* Store x and y offsets of virtual root
* here. */
- int *widthPtr, *heightPtr; /* Store dimensions of virtual root here. */
+ int *widthPtr, int *heightPtr)
+ /* Store dimensions of virtual root here. */
{
WmInfo *wmPtr;
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -5528,7 +5999,8 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
* information for that window.
*/
- while (!(winPtr->flags & TK_TOP_HIERARCHY) && (winPtr->parentPtr != NULL)) {
+ while (!(winPtr->flags & TK_TOP_HIERARCHY)
+ && (winPtr->parentPtr != NULL)) {
winPtr = winPtr->parentPtr;
}
wmPtr = winPtr->wmInfoPtr;
@@ -5540,10 +6012,9 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
*heightPtr = 0;
}
-
/*
- * Make sure that the geometry information is up-to-date, then copy
- * it out to the caller.
+ * Make sure that the geometry information is up-to-date, then copy it out
+ * to the caller.
*/
if (wmPtr->flags & WM_VROOT_OFFSET_STALE) {
@@ -5560,27 +6031,25 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
*
* Tk_MoveToplevelWindow --
*
- * This procedure is called instead of Tk_MoveWindow to adjust
- * the x-y location of a top-level window. It delays the actual
- * move to a later time and keeps window-manager information
- * up-to-date with the move
+ * This function is called instead of Tk_MoveWindow to adjust the x-y
+ * location of a top-level window. It delays the actual move to a later
+ * time and keeps window-manager information up-to-date with the move
*
* Results:
* None.
*
* Side effects:
* The window is eventually moved so that its upper-left corner
- * (actually, the upper-left corner of the window's decorative
- * frame, if there is one) is at (x,y).
+ * (actually, the upper-left corner of the window's decorative frame, if
+ * there is one) is at (x,y).
*
*----------------------------------------------------------------------
*/
void
-Tk_MoveToplevelWindow(tkwin, x, y)
- Tk_Window tkwin; /* Window to move. */
- int x, y; /* New location for window (within
- * parent). */
+Tk_MoveToplevelWindow(
+ Tk_Window tkwin, /* Window to move. */
+ int x, int y) /* New location for window (within parent). */
{
TkWindow *winPtr = (TkWindow *) tkwin;
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5599,9 +6068,8 @@ Tk_MoveToplevelWindow(tkwin, x, y)
/*
* If the window has already been mapped, must bring its geometry
- * up-to-date immediately, otherwise an event might arrive from the
- * server that would overwrite wmPtr->x and wmPtr->y and lose the
- * new position.
+ * up-to-date immediately, otherwise an event might arrive from the server
+ * that would overwrite wmPtr->x and wmPtr->y and lose the new position.
*/
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -5617,9 +6085,9 @@ Tk_MoveToplevelWindow(tkwin, x, y)
*
* UpdateWmProtocols --
*
- * This procedure transfers the most up-to-date information about
- * window manager protocols from the WmInfo structure to the actual
- * property on the top-level window.
+ * This function transfers the most up-to-date information about window
+ * manager protocols from the WmInfo structure to the actual property on
+ * the top-level window.
*
* Results:
* None.
@@ -5631,34 +6099,37 @@ Tk_MoveToplevelWindow(tkwin, x, y)
*/
static void
-UpdateWmProtocols(wmPtr)
- register WmInfo *wmPtr; /* Information about top-level window. */
+UpdateWmProtocols(
+ register WmInfo *wmPtr) /* Information about top-level window. */
{
register ProtocolHandler *protPtr;
- Atom deleteWindowAtom;
+ Atom deleteWindowAtom, pingAtom;
int count;
Atom *arrayPtr, *atomPtr;
/*
- * There are only two tricky parts here. First, there could be any
- * number of atoms for the window, so count them and malloc an array
- * to hold all of their atoms. Second, we *always* want to respond
- * to the WM_DELETE_WINDOW protocol, even if no-one's officially asked.
+ * There are only two tricky parts here. First, there could be any number
+ * of atoms for the window, so count them and malloc an array to hold all
+ * of their atoms. Second, we *always* want to respond to the
+ * WM_DELETE_WINDOW and _NET_WM_PING protocols, even if no-one's
+ * officially asked.
*/
- for (protPtr = wmPtr->protPtr, count = 1; protPtr != NULL;
+ for (protPtr = wmPtr->protPtr, count = 2; protPtr != NULL;
protPtr = protPtr->nextPtr, count++) {
- /* Empty loop body; we're just counting the handlers. */
+ /* Empty loop body; we're just counting the handlers. */
}
- arrayPtr = (Atom *) ckalloc((unsigned) (count * sizeof(Atom)));
+ arrayPtr = (Atom *) ckalloc((unsigned) count * sizeof(Atom));
deleteWindowAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr,
"WM_DELETE_WINDOW");
+ pingAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_PING");
arrayPtr[0] = deleteWindowAtom;
+ arrayPtr[1] = pingAtom;
for (protPtr = wmPtr->protPtr, atomPtr = &arrayPtr[1];
protPtr != NULL; protPtr = protPtr->nextPtr) {
- if (protPtr->protocol != deleteWindowAtom) {
- *atomPtr = protPtr->protocol;
- atomPtr++;
+ if (protPtr->protocol != deleteWindowAtom
+ && protPtr->protocol != pingAtom) {
+ *(atomPtr++) = protPtr->protocol;
}
}
XChangeProperty(wmPtr->winPtr->display, wmPtr->wrapperPtr->window,
@@ -5673,25 +6144,23 @@ UpdateWmProtocols(wmPtr)
*
* TkWmProtocolEventProc --
*
- * This procedure is called by the Tk_HandleEvent whenever a
- * ClientMessage event arrives whose type is "WM_PROTOCOLS".
- * This procedure handles the message from the window manager
- * in an appropriate fashion.
+ * This function is called by the Tk_HandleEvent whenever a ClientMessage
+ * event arrives whose type is "WM_PROTOCOLS". This function handles the
+ * message from the window manager in an appropriate fashion.
*
* Results:
* None.
*
* Side effects:
- * Depends on what sort of handler, if any, was set up for the
- * protocol.
+ * Depends on what sort of handler, if any, was set up for the protocol.
*
*----------------------------------------------------------------------
*/
void
-TkWmProtocolEventProc(winPtr, eventPtr)
- TkWindow *winPtr; /* Window to which the event was sent. */
- XEvent *eventPtr; /* X event. */
+TkWmProtocolEventProc(
+ TkWindow *winPtr, /* Window to which the event was sent. */
+ XEvent *eventPtr) /* X event. */
{
WmInfo *wmPtr;
register ProtocolHandler *protPtr;
@@ -5700,18 +6169,34 @@ TkWmProtocolEventProc(winPtr, eventPtr)
CONST char *protocolName;
Tcl_Interp *interp;
+ protocol = (Atom) eventPtr->xclient.data.l[0];
+
+ /*
+ * If this is a _NET_WM_PING message, send it back to the root window
+ * immediately. We do that here because scripts *cannot* respond correctly
+ * to this protocol.
+ */
+
+ if (protocol == Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PING")) {
+ Window root = XRootWindow(winPtr->display, winPtr->screenNum);
+
+ eventPtr->xclient.window = root;
+ (void) XSendEvent(winPtr->display, root, False,
+ (SubstructureNotifyMask|SubstructureRedirectMask), eventPtr);
+ return;
+ }
+
wmPtr = winPtr->wmInfoPtr;
if (wmPtr == NULL) {
return;
}
- protocol = (Atom) eventPtr->xclient.data.l[0];
/*
- * Note: it's very important to retrieve the protocol name now,
- * before invoking the command, even though the name won't be used
- * until after the command returns. This is because the command
- * could delete winPtr, making it impossible for us to use it
- * later in the call to Tk_GetAtomName.
+ * Note: it's very important to retrieve the protocol name now, before
+ * invoking the command, even though the name won't be used until after
+ * the command returns. This is because the command could delete winPtr,
+ * making it impossible for us to use it later in the call to
+ * Tk_GetAtomName.
*/
protocolName = Tk_GetAtomName((Tk_Window) winPtr, protocol);
@@ -5719,8 +6204,8 @@ TkWmProtocolEventProc(winPtr, eventPtr)
protPtr = protPtr->nextPtr) {
if (protocol == protPtr->protocol) {
Tcl_Preserve((ClientData) protPtr);
- interp = protPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ interp = protPtr->interp;
+ Tcl_Preserve((ClientData) interp);
result = Tcl_GlobalEval(interp, protPtr->command);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command for \"");
@@ -5729,15 +6214,15 @@ TkWmProtocolEventProc(winPtr, eventPtr)
"\" window manager protocol)");
Tcl_BackgroundError(interp);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release((ClientData) interp);
Tcl_Release((ClientData) protPtr);
return;
}
}
/*
- * No handler was present for this protocol. If this is a
- * WM_DELETE_WINDOW message then just destroy the window.
+ * No handler was present for this protocol. If this is a WM_DELETE_WINDOW
+ * message then just destroy the window.
*/
if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) {
@@ -5750,12 +6235,12 @@ TkWmProtocolEventProc(winPtr, eventPtr)
*
* TkWmStackorderToplevelWrapperMap --
*
- * This procedure will create a table that maps the reparent wrapper
- * X id for a toplevel to the TkWindow structure that is wraps.
- * Tk keeps track of a mapping from the window X id to the TkWindow
- * structure but that does us no good here since we only get the X
- * id of the wrapper window. Only those toplevel windows that are
- * mapped have a position in the stacking order.
+ * This function will create a table that maps the reparent wrapper X id
+ * for a toplevel to the TkWindow structure that is wraps. Tk keeps track
+ * of a mapping from the window X id to the TkWindow structure but that
+ * does us no good here since we only get the X id of the wrapper window.
+ * Only those toplevel windows that are mapped have a position in the
+ * stacking order.
*
* Results:
* None.
@@ -5767,30 +6252,28 @@ TkWmProtocolEventProc(winPtr, eventPtr)
*/
static void
-TkWmStackorderToplevelWrapperMap(winPtr, display, table)
- TkWindow *winPtr; /* TkWindow to recurse on */
- Display *display; /* X display of parent window */
- Tcl_HashTable *table; /* Maps X id to TkWindow */
+TkWmStackorderToplevelWrapperMap(
+ TkWindow *winPtr, /* TkWindow to recurse on */
+ Display *display, /* X display of parent window */
+ Tcl_HashTable *table) /* Maps X id to TkWindow */
{
TkWindow *childPtr;
- Tcl_HashEntry *hPtr;
- Window wrapper;
- int newEntry;
if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr) &&
- !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) {
- wrapper = (winPtr->wmInfoPtr->reparent != None)
- ? winPtr->wmInfoPtr->reparent
- : winPtr->wmInfoPtr->wrapperPtr->window;
+ !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) {
+ Window wrapper = (winPtr->wmInfoPtr->reparent != None)
+ ? winPtr->wmInfoPtr->reparent
+ : winPtr->wmInfoPtr->wrapperPtr->window;
+ Tcl_HashEntry *hPtr;
+ int newEntry;
- hPtr = Tcl_CreateHashEntry(table,
- (char *) wrapper, &newEntry);
- Tcl_SetHashValue(hPtr, winPtr);
+ hPtr = Tcl_CreateHashEntry(table, (char *) wrapper, &newEntry);
+ Tcl_SetHashValue(hPtr, winPtr);
}
for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
- TkWmStackorderToplevelWrapperMap(childPtr, display, table);
+ childPtr = childPtr->nextPtr) {
+ TkWmStackorderToplevelWrapperMap(childPtr, display, table);
}
}
@@ -5799,11 +6282,11 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
*
* TkWmStackorderToplevel --
*
- * This procedure returns the stack order of toplevel windows.
+ * This function returns the stack order of toplevel windows.
*
* Results:
- * An array of pointers to tk window objects in stacking order
- * or else NULL if there was an error.
+ * An array of pointers to tk window objects in stacking order or else
+ * NULL if there was an error.
*
* Side effects:
* None.
@@ -5812,8 +6295,8 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
*/
TkWindow **
-TkWmStackorderToplevel(parentPtr)
- TkWindow *parentPtr; /* Parent toplevel window. */
+TkWmStackorderToplevel(
+ TkWindow *parentPtr) /* Parent toplevel window. */
{
Window dummy1, dummy2, vRoot;
Window *children;
@@ -5830,51 +6313,52 @@ TkWmStackorderToplevel(parentPtr)
Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
- window_ptr = windows = (TkWindow **) ckalloc((table.numEntries+1)
- * sizeof(TkWindow *));
+ window_ptr = windows = (TkWindow **)
+ ckalloc((table.numEntries+1) * sizeof(TkWindow *));
/*
- * Special cases: If zero or one toplevels were mapped
- * there is no need to call XQueryTree.
+ * Special cases: If zero or one toplevels were mapped there is no need to
+ * call XQueryTree.
*/
switch (table.numEntries) {
case 0:
- windows[0] = NULL;
- goto done;
+ windows[0] = NULL;
+ goto done;
case 1:
- hPtr = Tcl_FirstHashEntry(&table, &search);
- windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
- windows[1] = NULL;
- goto done;
+ hPtr = Tcl_FirstHashEntry(&table, &search);
+ windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
+ windows[1] = NULL;
+ goto done;
}
vRoot = parentPtr->wmInfoPtr->vRoot;
if (vRoot == None) {
- vRoot = RootWindowOfScreen(Tk_Screen((Tk_Window) parentPtr));
+ vRoot = RootWindowOfScreen(Tk_Screen((Tk_Window) parentPtr));
}
if (XQueryTree(parentPtr->display, vRoot, &dummy1, &dummy2,
- &children, &numChildren) == 0) {
- ckfree((char *) windows);
- windows = NULL;
+ &children, &numChildren) == 0) {
+ ckfree((char *) windows);
+ windows = NULL;
} else {
- for (i = 0; i < numChildren; i++) {
- hPtr = Tcl_FindHashEntry(&table, (char *) children[i]);
- if (hPtr != NULL) {
- childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
- *window_ptr++ = childWinPtr;
- }
- }
- if ((window_ptr - windows) != table.numEntries)
- Tcl_Panic("num matched toplevel windows does not equal num children");
- *window_ptr = NULL;
+ for (i = 0; i < numChildren; i++) {
+ hPtr = Tcl_FindHashEntry(&table, (char *) children[i]);
+ if (hPtr != NULL) {
+ childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
+ *window_ptr++ = childWinPtr;
+ }
+ }
+ /* ASSERT: window_ptr - windows == table.numEntries
+ * (#matched toplevel windows == #children) [Bug 1789819]
+ */
+ *window_ptr = NULL;
if (numChildren) {
XFree((char *) children);
}
}
- done:
+ done:
Tcl_DeleteHashTable(&table);
return windows;
}
@@ -5884,25 +6368,25 @@ TkWmStackorderToplevel(parentPtr)
*
* TkWmRestackToplevel --
*
- * This procedure restacks a top-level window.
+ * This function restacks a top-level window.
*
* Results:
* None.
*
* Side effects:
- * WinPtr gets restacked as specified by aboveBelow and otherPtr.
+ * WinPtr gets restacked as specified by aboveBelow and otherPtr.
*
*----------------------------------------------------------------------
*/
void
-TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
- TkWindow *winPtr; /* Window to restack. */
- int aboveBelow; /* Gives relative position for restacking;
+TkWmRestackToplevel(
+ TkWindow *winPtr, /* Window to restack. */
+ int aboveBelow, /* Gives relative position for restacking;
* must be Above or Below. */
- TkWindow *otherPtr; /* Window relative to which to restack;
- * if NULL, then winPtr gets restacked
- * above or below *all* siblings. */
+ TkWindow *otherPtr) /* Window relative to which to restack; if
+ * NULL, then winPtr gets restacked above or
+ * below *all* siblings. */
{
XWindowChanges changes;
unsigned int mask;
@@ -5915,6 +6399,7 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
/*
* Make sure that winPtr and its wrapper window have been created.
*/
+
if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
TkWmMapWindow(winPtr);
}
@@ -5925,6 +6410,7 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
* The window is to be restacked with respect to another toplevel.
* Make sure it has been created as well.
*/
+
if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
TkWmMapWindow(otherPtr);
}
@@ -5933,15 +6419,14 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
}
/*
- * Reconfigure the window. Note that we use XReconfigureWMWindow
- * instead of XConfigureWindow, in order to handle the case
- * where the window is to be restacked with respect to another toplevel.
- * See [ICCCM] 4.1.5 "Configuring the Window" and XReconfigureWMWindow(3)
- * for details.
+ * Reconfigure the window. Note that we use XReconfigureWMWindow instead
+ * of XConfigureWindow, in order to handle the case where the window is to
+ * be restacked with respect to another toplevel. See [ICCCM] 4.1.5
+ * "Configuring the Window" and XReconfigureWMWindow(3) for details.
*/
XReconfigureWMWindow(winPtr->display, wrapperPtr->window,
- Tk_ScreenNumber((Tk_Window) winPtr), mask, &changes);
+ Tk_ScreenNumber((Tk_Window) winPtr), mask, &changes);
}
@@ -5950,28 +6435,27 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
*
* TkWmAddToColormapWindows --
*
- * This procedure is called to add a given window to the
- * WM_COLORMAP_WINDOWS property for its top-level, if it
- * isn't already there. It is invoked by the Tk code that
- * creates a new colormap, in order to make sure that colormap
- * information is propagated to the window manager by default.
+ * This function is called to add a given window to the
+ * WM_COLORMAP_WINDOWS property for its top-level, if it isn't already
+ * there. It is invoked by the Tk code that creates a new colormap, in
+ * order to make sure that colormap information is propagated to the
+ * window manager by default.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets added to the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * colormaps have been set explicitly with the
- * "wm colormapwindows" command.
+ * WinPtr's window gets added to the WM_COLORMAP_WINDOWS property of its
+ * nearest top-level ancestor, unless the colormaps have been set
+ * explicitly with the "wm colormapwindows" command.
*
*----------------------------------------------------------------------
*/
void
-TkWmAddToColormapWindows(winPtr)
- TkWindow *winPtr; /* Window with a non-default colormap.
- * Should not be a top-level window. */
+TkWmAddToColormapWindows(
+ TkWindow *winPtr) /* Window with a non-default colormap. Should
+ * not be a top-level window. */
{
TkWindow *wrapperPtr;
TkWindow *topPtr;
@@ -5985,7 +6469,7 @@ TkWmAddToColormapWindows(winPtr)
for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
if (topPtr == NULL) {
/*
- * Window is being deleted. Skip the whole operation.
+ * Window is being deleted. Skip the whole operation.
*/
return;
@@ -6027,12 +6511,11 @@ TkWmAddToColormapWindows(winPtr)
}
/*
- * Make a new bigger array and use it to reset the property.
- * Automatically add the toplevel itself as the last element
- * of the list.
+ * Make a new bigger array and use it to reset the property. Automatically
+ * add the toplevel itself as the last element of the list.
*/
- newPtr = (Window *) ckalloc((unsigned) ((count+2)*sizeof(Window)));
+ newPtr = (Window *) ckalloc((unsigned) (count+2) * sizeof(Window));
for (i = 0; i < count; i++) {
newPtr[i] = oldPtr[i];
}
@@ -6054,26 +6537,26 @@ TkWmAddToColormapWindows(winPtr)
*
* TkWmRemoveFromColormapWindows --
*
- * This procedure is called to remove a given window from the
- * WM_COLORMAP_WINDOWS property for its top-level. It is invoked
- * when windows are deleted.
+ * This function is called to remove a given window from the
+ * WM_COLORMAP_WINDOWS property for its top-level. It is invoked when
+ * windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * top-level itself is being deleted too.
+ * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS property of
+ * its nearest top-level ancestor, unless the top-level itself is being
+ * deleted too.
*
*----------------------------------------------------------------------
*/
void
-TkWmRemoveFromColormapWindows(winPtr)
- TkWindow *winPtr; /* Window that may be present in
+TkWmRemoveFromColormapWindows(
+ TkWindow *winPtr) /* Window that may be present in
* WM_COLORMAP_WINDOWS property for its
- * top-level. Should not be a top-level
+ * top-level. Should not be a top-level
* window. */
{
TkWindow *wrapperPtr;
@@ -6100,8 +6583,8 @@ TkWmRemoveFromColormapWindows(winPtr)
}
if (topPtr->flags & TK_ALREADY_DEAD) {
/*
- * Top-level is being deleted, so there's no need to cleanup
- * the WM_COLORMAP_WINDOWS property.
+ * Top-level is being deleted, so there's no need to cleanup the
+ * WM_COLORMAP_WINDOWS property.
*/
return;
@@ -6128,8 +6611,7 @@ TkWmRemoveFromColormapWindows(winPtr)
}
/*
- * Find the window and slide the following ones down to cover
- * it up.
+ * Find the window and slide the following ones down to cover it up.
*/
for (i = 0; i < count; i++) {
@@ -6153,10 +6635,10 @@ TkWmRemoveFromColormapWindows(winPtr)
* Fetch the position of the mouse pointer.
*
* Results:
- * *xPtr and *yPtr are filled in with the (virtual) root coordinates
- * of the mouse pointer for tkwin's display. If the pointer isn't
- * on tkwin's screen, then -1 values are returned for both
- * coordinates. The argument tkwin must be a toplevel window.
+ * *xPtr and *yPtr are filled in with the (virtual) root coordinates of
+ * the mouse pointer for tkwin's display. If the pointer isn't on tkwin's
+ * screen, then -1 values are returned for both coordinates. The argument
+ * tkwin must be a toplevel window.
*
* Side effects:
* None.
@@ -6165,10 +6647,10 @@ TkWmRemoveFromColormapWindows(winPtr)
*/
void
-TkGetPointerCoords(tkwin, xPtr, yPtr)
- Tk_Window tkwin; /* Toplevel window that identifies screen
- * on which lookup is to be done. */
- int *xPtr, *yPtr; /* Store pointer coordinates here. */
+TkGetPointerCoords(
+ Tk_Window tkwin, /* Toplevel window that identifies screen on
+ * which lookup is to be done. */
+ int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
@@ -6194,16 +6676,15 @@ TkGetPointerCoords(tkwin, xPtr, yPtr)
*
* GetMaxSize --
*
- * This procedure computes the current maxWidth and maxHeight
- * values for a window, taking into account the possibility
- * that they may be defaulted.
+ * This function computes the current maxWidth and maxHeight values for a
+ * window, taking into account the possibility that they may be
+ * defaulted.
*
* Results:
- * The values at *maxWidthPtr and *maxHeightPtr are filled
- * in with the maximum allowable dimensions of wmPtr's window,
- * in grid units. If no maximum has been specified for the
- * window, then this procedure computes the largest sizes that
- * will fit on the screen.
+ * The values at *maxWidthPtr and *maxHeightPtr are filled in with the
+ * maximum allowable dimensions of wmPtr's window, in grid units. If no
+ * maximum has been specified for the window, then this function computes
+ * the largest sizes that will fit on the screen.
*
* Side effects:
* None.
@@ -6212,13 +6693,13 @@ TkGetPointerCoords(tkwin, xPtr, yPtr)
*/
static void
-GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
- WmInfo *wmPtr; /* Window manager information for the
+GetMaxSize(
+ WmInfo *wmPtr, /* Window manager information for the
* window. */
- int *maxWidthPtr; /* Where to store the current maximum
- * width of the window. */
- int *maxHeightPtr; /* Where to store the current maximum
- * height of the window. */
+ int *maxWidthPtr, /* Where to store the current maximum width of
+ * the window. */
+ int *maxHeightPtr) /* Where to store the current maximum height
+ * of the window. */
{
int tmp;
@@ -6226,15 +6707,15 @@ GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
*maxWidthPtr = wmPtr->maxWidth;
} else {
/*
- * Must compute a default width. Fill up the display, leaving a
- * bit of extra space for the window manager's borders.
+ * Must compute a default width. Fill up the display, leaving a bit of
+ * extra space for the window manager's borders.
*/
tmp = DisplayWidth(wmPtr->winPtr->display, wmPtr->winPtr->screenNum)
- 15;
if (wmPtr->gridWin != NULL) {
/*
- * Gridding is turned on; convert from pixels to grid units.
+ * Gridding is turned on; convert from pixels to grid units.
*/
tmp = wmPtr->reqGridWidth
@@ -6267,9 +6748,7 @@ GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
*/
static void
-TkSetTransientFor(tkwin, parent)
- Tk_Window tkwin;
- Tk_Window parent;
+TkSetTransientFor(Tk_Window tkwin, Tk_Window parent)
{
if (parent == None) {
parent = Tk_Parent(tkwin);
@@ -6286,8 +6765,8 @@ TkSetTransientFor(tkwin, parent)
*
* TkpMakeMenuWindow --
*
- * Configure the window to be either a pull-down (or pop-up)
- * menu, or as a toplevel (torn-off) menu or palette.
+ * Configure the window to be either a pull-down (or pop-up) menu, or as
+ * a toplevel (torn-off) menu or palette.
*
* Results:
* None.
@@ -6299,12 +6778,12 @@ TkSetTransientFor(tkwin, parent)
*/
void
-TkpMakeMenuWindow(tkwin, transient)
- Tk_Window tkwin; /* New window. */
- int transient; /* 1 means menu is only posted briefly as
- * a popup or pulldown or cascade. 0 means
- * menu is always visible, e.g. as a torn-off
- * menu. Determines whether save_under and
+TkpMakeMenuWindow(
+ Tk_Window tkwin, /* New window. */
+ int transient) /* 1 means menu is only posted briefly as a
+ * popup or pulldown or cascade. 0 means menu
+ * is always visible, e.g. as a torn-off menu.
+ * Determines whether save_under and
* override_redirect should be set. */
{
WmInfo *wmPtr;
@@ -6333,13 +6812,13 @@ TkpMakeMenuWindow(tkwin, transient)
SetNetWmType((TkWindow *)tkwin, typeObj);
/*
- * The override-redirect and save-under bits must be set on the
- * wrapper window in order to have the desired effect. However,
- * also set the override-redirect bit on the window itself, so
- * that the "wm overrideredirect" command will see it.
+ * The override-redirect and save-under bits must be set on the wrapper
+ * window in order to have the desired effect. However, also set the
+ * override-redirect bit on the window itself, so that the "wm
+ * overrideredirect" command will see it.
*/
- if ((atts.override_redirect != Tk_Attributes(wrapperPtr)->override_redirect)
+ if ((atts.override_redirect!=Tk_Attributes(wrapperPtr)->override_redirect)
|| (atts.save_under != Tk_Attributes(wrapperPtr)->save_under)) {
Tk_ChangeWindowAttributes((Tk_Window) wrapperPtr,
CWOverrideRedirect|CWSaveUnder, &atts);
@@ -6354,9 +6833,9 @@ TkpMakeMenuWindow(tkwin, transient)
*
* CreateWrapper --
*
- * This procedure is invoked to create the wrapper window for a
- * toplevel window. It is called just before a toplevel is mapped
- * for the first time.
+ * This function is invoked to create the wrapper window for a toplevel
+ * window. It is called just before a toplevel is mapped for the first
+ * time.
*
* Results:
* None.
@@ -6368,8 +6847,8 @@ TkpMakeMenuWindow(tkwin, transient)
*/
static void
-CreateWrapper(wmPtr)
- WmInfo *wmPtr; /* Window manager information for the
+CreateWrapper(
+ WmInfo *wmPtr) /* Window manager information for the
* window. */
{
TkWindow *winPtr, *wrapperPtr;
@@ -6383,12 +6862,12 @@ CreateWrapper(wmPtr)
}
/*
- * The code below is copied from CreateTopLevelWindow,
- * Tk_MakeWindowExist, and TkpMakeWindow; The idea is to create an
- * "official" Tk window (so that we can get events on it), but to
- * hide the window outside the official Tk hierarchy so that it
- * isn't visible to the application. See the comments for the other
- * procedures if you have questions about this code.
+ * The code below is copied from CreateTopLevelWindow, Tk_MakeWindowExist,
+ * and TkpMakeWindow. The idea is to create an "official" Tk window (so
+ * that we can get events on it), but to hide the window outside the
+ * official Tk hierarchy so that it isn't visible to the application. See
+ * the comments for the other functions if you have questions about this
+ * code.
*/
wmPtr->wrapperPtr = wrapperPtr = TkAllocWindow(winPtr->dispPtr,
@@ -6396,12 +6875,11 @@ CreateWrapper(wmPtr)
wrapperPtr->dirtyAtts |= CWBorderPixel;
/*
- * Tk doesn't normally select for StructureNotifyMask events because
- * the events are synthesized internally. However, for wrapper
- * windows we need to know when the window manager modifies the
- * window configuration. We also need to select on focus change
- * events; these are the only windows for which we care about focus
- * changes.
+ * Tk doesn't normally select for StructureNotifyMask events because the
+ * events are synthesized internally. However, for wrapper windows we need
+ * to know when the window manager modifies the window configuration. We
+ * also need to select on focus change events; these are the only windows
+ * for which we care about focus changes.
*/
wrapperPtr->flags |= TK_WRAPPER;
@@ -6436,13 +6914,13 @@ CreateWrapper(wmPtr)
0, 0);
/*
- * Tk must monitor structure events for wrapper windows in order
- * to detect changes made by window managers such as resizing,
- * mapping, unmapping, etc..
+ * Tk must monitor structure events for wrapper windows in order to detect
+ * changes made by window managers such as resizing, mapping, unmapping,
+ * etc..
*/
- Tk_CreateEventHandler((Tk_Window) wmPtr->wrapperPtr, StructureNotifyMask,
- WrapperEventProc, (ClientData) wmPtr);
+ Tk_CreateEventHandler((Tk_Window) wmPtr->wrapperPtr,
+ WrapperEventMask, WrapperEventProc, (ClientData) wmPtr);
}
/*
@@ -6450,16 +6928,15 @@ CreateWrapper(wmPtr)
*
* TkWmFocusToplevel --
*
- * This is a utility procedure invoked by focus-management code.
- * The focus code responds to externally generated focus-related
- * events on wrapper windows but ignores those events for any other
- * windows. This procedure determines whether a given window is a
- * wrapper window and, if so, returns the toplevel window
- * corresponding to the wrapper.
+ * This is a utility function invoked by focus-management code. The focus
+ * code responds to externally generated focus-related events on wrapper
+ * windows but ignores those events for any other windows. This function
+ * determines whether a given window is a wrapper window and, if so,
+ * returns the toplevel window corresponding to the wrapper.
*
* Results:
- * If winPtr is a wrapper window, returns a pointer to the
- * corresponding toplevel window; otherwise returns NULL.
+ * If winPtr is a wrapper window, returns a pointer to the corresponding
+ * toplevel window; otherwise returns NULL.
*
* Side effects:
* None.
@@ -6468,8 +6945,8 @@ CreateWrapper(wmPtr)
*/
TkWindow *
-TkWmFocusToplevel(winPtr)
- TkWindow *winPtr; /* Window that received a focus-related
+TkWmFocusToplevel(
+ TkWindow *winPtr) /* Window that received a focus-related
* event. */
{
if (!(winPtr->flags & TK_WRAPPER)) {
@@ -6483,41 +6960,44 @@ TkWmFocusToplevel(winPtr)
*
* TkUnixSetMenubar --
*
- * This procedure is invoked by menu management code to specify the
- * window to use as a menubar for a given toplevel window.
+ * This function is invoked by menu management code to specify the window
+ * to use as a menubar for a given toplevel window.
*
* Results:
* None.
*
* Side effects:
- * The window given by menubar will be mapped and positioned inside
- * the wrapper for tkwin and above tkwin. Menubar will
- * automatically be resized to maintain the height specified by
- * TkUnixSetMenuHeight the same width as tkwin. Any previous
- * menubar specified for tkwin will be unmapped and ignored from
- * now on.
+ * The window given by menubar will be mapped and positioned inside the
+ * wrapper for tkwin and above tkwin. Menubar will automatically be
+ * resized to maintain the height specified by TkUnixSetMenuHeight the
+ * same width as tkwin. Any previous menubar specified for tkwin will be
+ * unmapped and ignored from now on.
*
*----------------------------------------------------------------------
*/
void
-TkUnixSetMenubar(tkwin, menubar)
- Tk_Window tkwin; /* Token for toplevel window. */
- Tk_Window menubar; /* Token for window that is to serve as
- * menubar for tkwin. Must not be a
- * toplevel window. If NULL, any
- * existing menubar is canceled and the
- * menu height is reset to 0. */
+TkUnixSetMenubar(
+ Tk_Window tkwin, /* Token for toplevel window. */
+ Tk_Window menubar) /* Token for window that is to serve as
+ * menubar for tkwin. Must not be a toplevel
+ * window. If NULL, any existing menubar is
+ * canceled and the menu height is reset to
+ * 0. */
{
WmInfo *wmPtr = ((TkWindow *) tkwin)->wmInfoPtr;
Tk_Window parent;
TkWindow *menubarPtr = (TkWindow *) menubar;
+ /* Could be a Frame (i.e. not a toplevel) */
+ if (wmPtr == NULL)
+ return;
+
if (wmPtr->menubar != NULL) {
/*
- * There's already a menubar for this toplevel. If it isn't the
- * same as the new menubar, unmap it so that it is out of the
- * way, and reparent it back to its original parent.
+ * There's already a menubar for this toplevel. If it isn't the same
+ * as the new menubar, unmap it so that it is out of the way, and
+ * reparent it back to its original parent.
*/
if (wmPtr->menubar == menubar) {
@@ -6534,7 +7014,7 @@ TkUnixSetMenubar(tkwin, menubar)
}
Tk_DeleteEventHandler(wmPtr->menubar, StructureNotifyMask,
MenubarDestroyProc, (ClientData) wmPtr->menubar);
- Tk_ManageGeometry(wmPtr->menubar, NULL, (ClientData) NULL);
+ Tk_ManageGeometry(wmPtr->menubar, NULL, NULL);
}
wmPtr->menubar = menubar;
@@ -6542,7 +7022,7 @@ TkUnixSetMenubar(tkwin, menubar)
wmPtr->menuHeight = 0;
} else {
if ((menubarPtr->flags & TK_TOP_LEVEL)
- || (Tk_Screen(menubar) != Tk_Screen(tkwin))) {
+ || (Tk_Screen(menubar) != Tk_Screen(tkwin))) {
Tcl_Panic("TkUnixSetMenubar got bad menubar");
}
wmPtr->menuHeight = Tk_ReqHeight(menubar);
@@ -6576,24 +7056,24 @@ TkUnixSetMenubar(tkwin, menubar)
*
* MenubarDestroyProc --
*
- * This procedure is invoked by the event dispatcher whenever a
- * menubar window is destroyed (it's also invoked for a few other
- * kinds of events, but we ignore those).
+ * This function is invoked by the event dispatcher whenever a menubar
+ * window is destroyed (it's also invoked for a few other kinds of
+ * events, but we ignore those).
*
* Results:
* None.
*
* Side effects:
- * The association between the window and its toplevel is broken,
- * so that the window is no longer considered to be a menubar.
+ * The association between the window and its toplevel is broken, so that
+ * the window is no longer considered to be a menubar.
*
*----------------------------------------------------------------------
*/
static void
-MenubarDestroyProc(clientData, eventPtr)
- ClientData clientData; /* TkWindow pointer for menubar. */
- XEvent *eventPtr; /* Describes what just happened. */
+MenubarDestroyProc(
+ ClientData clientData, /* TkWindow pointer for menubar. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
WmInfo *wmPtr;
@@ -6615,9 +7095,8 @@ MenubarDestroyProc(clientData, eventPtr)
*
* MenubarReqProc --
*
- * This procedure is invoked by the Tk geometry management code
- * whenever a menubar calls Tk_GeometryRequest to request a new
- * size.
+ * This function is invoked by the Tk geometry management code whenever a
+ * menubar calls Tk_GeometryRequest to request a new size.
*
* Results:
* None.
@@ -6629,10 +7108,10 @@ MenubarDestroyProc(clientData, eventPtr)
*/
static void
-MenubarReqProc(clientData, tkwin)
- ClientData clientData; /* Pointer to the window manager
- * information for tkwin's toplevel. */
- Tk_Window tkwin; /* Handle for menubar window. */
+MenubarReqProc(
+ ClientData clientData, /* Pointer to the window manager information
+ * for tkwin's toplevel. */
+ Tk_Window tkwin) /* Handle for menubar window. */
{
WmInfo *wmPtr = (WmInfo *) clientData;
@@ -6652,12 +7131,12 @@ MenubarReqProc(clientData, tkwin)
*
* TkpGetWrapperWindow --
*
- * Given a toplevel window return the hidden wrapper window for
- * the toplevel window if available.
+ * Given a toplevel window return the hidden wrapper window for the
+ * toplevel window if available.
*
* Results:
- * The wrapper window. NULL is we were not passed a toplevel
- * window or the wrapper has yet to be created.
+ * The wrapper window. NULL is we were not passed a toplevel window or
+ * the wrapper has yet to be created.
*
* Side effects:
* None.
@@ -6666,8 +7145,8 @@ MenubarReqProc(clientData, tkwin)
*/
TkWindow *
-TkpGetWrapperWindow(winPtr)
- TkWindow *winPtr; /* A toplevel window pointer. */
+TkpGetWrapperWindow(
+ TkWindow *winPtr) /* A toplevel window pointer. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -6683,8 +7162,8 @@ TkpGetWrapperWindow(winPtr)
*
* UpdateCommand --
*
- * Update the WM_COMMAND property, taking care to translate
- * the command strings into the external encoding.
+ * Update the WM_COMMAND property, taking care to translate the command
+ * strings into the external encoding.
*
* Results:
* None.
@@ -6696,8 +7175,8 @@ TkpGetWrapperWindow(winPtr)
*/
static void
-UpdateCommand(winPtr)
- TkWindow *winPtr;
+UpdateCommand(
+ TkWindow *winPtr)
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tcl_DString cmds, ds;
@@ -6705,19 +7184,19 @@ UpdateCommand(winPtr)
char **cmdArgv;
/*
- * Translate the argv strings into the external encoding. To avoid
- * allocating lots of memory, the strings are appended to a buffer
- * with nulls between each string.
+ * Translate the argv strings into the external encoding. To avoid
+ * allocating lots of memory, the strings are appended to a buffer with
+ * nulls between each string.
*
- * This code is tricky because we need to pass and array of pointers
- * to XSetCommand. However, we can't compute the pointers as we go
- * because the DString buffer space could get reallocated. So, store
- * offsets for each element as we go, then compute pointers from the
- * offsets once the entire DString is done.
+ * This code is tricky because we need to pass and array of pointers to
+ * XSetCommand. However, we can't compute the pointers as we go because
+ * the DString buffer space could get reallocated. So, store offsets for
+ * each element as we go, then compute pointers from the offsets once the
+ * entire DString is done.
*/
cmdArgv = (char **) ckalloc(sizeof(char *) * wmPtr->cmdArgc);
- offsets = (int *) ckalloc( sizeof(int) * wmPtr->cmdArgc);
+ offsets = (int *) ckalloc(sizeof(int) * wmPtr->cmdArgc);
Tcl_DStringInit(&cmds);
for (i = 0; i < wmPtr->cmdArgc; i++) {
Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], -1, &ds);
@@ -6743,8 +7222,8 @@ UpdateCommand(winPtr)
*
* TkpWmSetState --
*
- * Sets the window manager state for the wrapper window of a
- * given toplevel window.
+ * Sets the window manager state for the wrapper window of a given
+ * toplevel window.
*
* Results:
* 0 on error, 1 otherwise
@@ -6756,49 +7235,95 @@ UpdateCommand(winPtr)
*/
int
-TkpWmSetState(winPtr, state)
- TkWindow *winPtr; /* Toplevel window to operate on. */
- int state; /* One of IconicState, NormalState,
- * or WithdrawnState. */
+TkpWmSetState(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int state) /* One of IconicState, NormalState, or
+ * WithdrawnState. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
if (state == WithdrawnState) {
- wmPtr->hints.initial_state = WithdrawnState;
- wmPtr->withdrawn = 1;
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- return 1;
- }
- if (XWithdrawWindow(winPtr->display, wmPtr->wrapperPtr->window,
- winPtr->screenNum) == 0) {
- return 0;
- }
- WaitForMapNotify(winPtr, 0);
+ wmPtr->hints.initial_state = WithdrawnState;
+ wmPtr->withdrawn = 1;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return 1;
+ }
+ if (XWithdrawWindow(winPtr->display, wmPtr->wrapperPtr->window,
+ winPtr->screenNum) == 0) {
+ return 0;
+ }
+ WaitForMapNotify(winPtr, 0);
} else if (state == NormalState) {
- wmPtr->hints.initial_state = NormalState;
- wmPtr->withdrawn = 0;
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- return 1;
- }
- UpdateHints(winPtr);
- Tk_MapWindow((Tk_Window) winPtr);
+ wmPtr->hints.initial_state = NormalState;
+ wmPtr->withdrawn = 0;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return 1;
+ }
+ UpdateHints(winPtr);
+ Tk_MapWindow((Tk_Window) winPtr);
} else if (state == IconicState) {
- wmPtr->hints.initial_state = IconicState;
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- return 1;
- }
- if (wmPtr->withdrawn) {
- UpdateHints(winPtr);
- Tk_MapWindow((Tk_Window) winPtr);
- wmPtr->withdrawn = 0;
- } else {
- if (XIconifyWindow(winPtr->display, wmPtr->wrapperPtr->window,
- winPtr->screenNum) == 0) {
- return 0;
- }
- WaitForMapNotify(winPtr, 0);
- }
+ wmPtr->hints.initial_state = IconicState;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return 1;
+ }
+ if (wmPtr->withdrawn) {
+ UpdateHints(winPtr);
+ Tk_MapWindow((Tk_Window) winPtr);
+ wmPtr->withdrawn = 0;
+ } else {
+ if (XIconifyWindow(winPtr->display, wmPtr->wrapperPtr->window,
+ winPtr->screenNum) == 0) {
+ return 0;
+ }
+ WaitForMapNotify(winPtr, 0);
+ }
}
return 1;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RemapWindows
+ *
+ * Adjust parent/child relation ships of
+ * the given window hierarchy.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * keeps windowing system (X11) happy
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RemapWindows(winPtr, parentPtr)
+ TkWindow *winPtr;
+ TkWindow *parentPtr;
+{
+ XWindowAttributes win_attr;
+
+ if (winPtr->window) {
+ XGetWindowAttributes(winPtr->display, winPtr->window, &win_attr);
+ if (parentPtr == NULL) {
+ XReparentWindow(winPtr->display, winPtr->window,
+ XRootWindow(winPtr->display, winPtr->screenNum),
+ win_attr.x, win_attr.y);
+ } else if (parentPtr->window) {
+ XReparentWindow(parentPtr->display, winPtr->window,
+ parentPtr->window,
+ win_attr.x, win_attr.y);
+ }
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c
index 428d5fe..928c4d5 100644
--- a/unix/tkUnixXId.c
+++ b/unix/tkUnixXId.c
@@ -1,12 +1,11 @@
-/*
+/*
* tkUnixXId.c --
*
- * This file provides a replacement function for the default X
- * resource allocator (_XAllocID). The problem with the default
- * allocator is that it never re-uses ids, which causes long-lived
- * applications to crash when X resource identifiers wrap around.
- * The replacement functions in this file re-use old identifiers
- * to prevent this problem.
+ * This file provides a replacement function for the default X resource
+ * allocator (_XAllocID). The problem with the default allocator is that
+ * it never re-uses ids, which causes long-lived applications to crash
+ * when X resource identifiers wrap around. The replacement functions in
+ * this file re-use old identifiers to prevent this problem.
*
* The code in this file is based on similar implementations by
* George C. Kaplan and Michael Hoegeman.
@@ -14,54 +13,52 @@
* Copyright (c) 1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/*
- * The definition below is needed on some systems so that we can access
- * the resource_alloc field of Display structures in order to replace
- * the resource allocator.
+ * The definition below is needed on some systems so that we can access the
+ * resource_alloc field of Display structures in order to replace the resource
+ * allocator.
*/
#define XLIB_ILLEGAL_ACCESS 1
#include "tkUnixInt.h"
-#include "tkPort.h"
/*
- * A structure of the following type is used to hold one or more
- * available resource identifiers. There is a list of these structures
- * for each display.
+ * A structure of the following type is used to hold one or more available
+ * resource identifiers. There is a list of these structures for each display.
*/
#define IDS_PER_STACK 10
typedef struct TkIdStack {
- XID ids[IDS_PER_STACK]; /* Array of free identifiers. */
- int numUsed; /* Indicates how many of the entries
- * in ids are currently in use. */
- TkDisplay *dispPtr; /* Display to which ids belong. */
- struct TkIdStack *nextPtr; /* Next bunch of free identifiers
- * for the same display. */
+ XID ids[IDS_PER_STACK]; /* Array of free identifiers. */
+ int numUsed; /* Indicates how many of the entries in ids
+ * are currently in use. */
+ TkDisplay *dispPtr; /* Display to which ids belong. */
+ struct TkIdStack *nextPtr; /* Next bunch of free identifiers for the same
+ * display. */
} TkIdStack;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static XID AllocXId _ANSI_ARGS_((Display *display));
-static Tk_RestrictAction CheckRestrictProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void WindowIdCleanup _ANSI_ARGS_((ClientData clientData));
-static void WindowIdCleanup2 _ANSI_ARGS_((ClientData clientData));
+static XID AllocXId(Display *display);
+static Tk_RestrictAction CheckRestrictProc(ClientData clientData,
+ XEvent *eventPtr);
+static void WindowIdCleanup(ClientData clientData);
+static void WindowIdCleanup2(ClientData clientData);
/*
*----------------------------------------------------------------------
*
* TkInitXId --
*
- * This procedure is called to initialize the id allocator for
- * a given display.
+ * This function is called to initialize the id allocator for a given
+ * display.
*
* Results:
* None.
@@ -73,13 +70,12 @@ static void WindowIdCleanup2 _ANSI_ARGS_((ClientData clientData));
*/
void
-TkInitXId(dispPtr)
- TkDisplay *dispPtr; /* Tk's information about the
- * display. */
+TkInitXId(
+ TkDisplay *dispPtr) /* Tk's information about the display. */
{
dispPtr->idStackPtr = NULL;
- dispPtr->defaultAllocProc = (XID (*) _ANSI_ARGS_((Display *display)))
- dispPtr->display->resource_alloc;
+ dispPtr->defaultAllocProc = (XID (*) _ANSI_ARGS_((Display *display)))
+ dispPtr->display->resource_alloc;
dispPtr->display->resource_alloc = AllocXId;
dispPtr->windowStackPtr = NULL;
dispPtr->idCleanupScheduled = (Tcl_TimerToken) 0;
@@ -90,8 +86,8 @@ TkInitXId(dispPtr)
*
* TkFreeXId --
*
- * This procedure is called to free resources for the id allocator
- * for a given display.
+ * This function is called to free resources for the id allocator for a
+ * given display.
*
* Results:
* None.
@@ -103,9 +99,8 @@ TkInitXId(dispPtr)
*/
void
-TkFreeXId(dispPtr)
- TkDisplay *dispPtr; /* Tk's information about the
- * display. */
+TkFreeXId(
+ TkDisplay *dispPtr) /* Tk's information about the display. */
{
TkIdStack *stackPtr, *freePtr;
@@ -133,23 +128,23 @@ TkFreeXId(dispPtr)
*
* AllocXId --
*
- * This procedure is invoked by Xlib as the resource allocator
- * for a display.
+ * This function is invoked by Xlib as the resource allocator for a
+ * display.
*
* Results:
- * The return value is an X resource identifier that isn't currently
- * in use.
+ * The return value is an X resource identifier that isn't currently in
+ * use.
*
* Side effects:
- * The identifier is removed from the stack of free identifiers,
- * if it was previously on the stack.
+ * The identifier is removed from the stack of free identifiers, if it
+ * was previously on the stack.
*
*----------------------------------------------------------------------
*/
static XID
-AllocXId(display)
- Display *display; /* Display for which to allocate. */
+AllocXId(
+ Display *display) /* Display for which to allocate. */
{
TkDisplay *dispPtr;
TkIdStack *stackPtr;
@@ -159,10 +154,10 @@ AllocXId(display)
*/
dispPtr = TkGetDisplay(display);
-
+
/*
- * If the topmost chunk on the stack is empty then free it. Then
- * check for a free id on the stack and return it if it exists.
+ * If the topmost chunk on the stack is empty then free it. Then check for
+ * a free id on the stack and return it if it exists.
*/
stackPtr = dispPtr->idStackPtr;
@@ -180,11 +175,10 @@ AllocXId(display)
}
/*
- * No free ids in the stack: just get one from the default
- * allocator.
+ * No free ids in the stack: just get one from the default allocator.
*/
- defAlloc:
+ defAlloc:
return (*dispPtr->defaultAllocProc)(display);
}
@@ -193,8 +187,8 @@ AllocXId(display)
*
* Tk_FreeXId --
*
- * This procedure is called to indicate that an X resource identifier
- * is now free.
+ * This function is called to indicate that an X resource identifier is
+ * now free.
*
* Results:
* None.
@@ -207,11 +201,9 @@ AllocXId(display)
*/
void
-Tk_FreeXId(display, xid)
- Display *display; /* Display for which xid was
- * allocated. */
- XID xid; /* Identifier that is no longer
- * in use. */
+Tk_FreeXId(
+ Display *display, /* Display for which xid was allocated. */
+ XID xid) /* Identifier that is no longer in use. */
{
TkDisplay *dispPtr;
TkIdStack *stackPtr;
@@ -225,7 +217,7 @@ Tk_FreeXId(display, xid)
/*
* Add a new chunk to the stack if the current chunk is full.
*/
-
+
stackPtr = dispPtr->idStackPtr;
if ((stackPtr == NULL) || (stackPtr->numUsed >= IDS_PER_STACK)) {
stackPtr = (TkIdStack *) ckalloc(sizeof(TkIdStack));
@@ -248,68 +240,64 @@ Tk_FreeXId(display, xid)
*
* TkFreeWindowId --
*
- * This procedure is invoked instead of TkFreeXId for window ids.
- * See below for the reason why.
+ * This function is invoked instead of TkFreeXId for window ids. See
+ * below for the reason why.
*
* Results:
* None.
*
* Side effects:
- * The id given by w will eventually be freed, so that it can be
- * reused for other resources.
+ * The id given by w will eventually be freed, so that it can be reused
+ * for other resources.
*
* Design:
- * Freeing window ids is very tricky because there could still be
- * events pending for a window in the event queue (or even in the
- * server) at the time the window is destroyed. If the window
- * id were to get reused immediately for another window, old
- * events could "drop in" on the new window, causing unexpected
- * behavior.
- *
- * Thus we have to wait to re-use a window id until we know that
- * there are no events left for it. Right now this is done in
- * two steps. First, we wait until we know that the server
- * has seen the XDestroyWindow request, so we can be sure that
- * it won't generate more events for the window and that any
- * existing events are in our queue. Second, we make sure that
- * there are no events whatsoever in our queue (this is conservative
- * but safe).
- *
- * The first step is done by remembering the request id of the
- * XDestroyWindow request and using LastKnownRequestProcessed to
- * see what events the server has processed. If multiple windows
- * get destroyed at about the same time, we just remember the
- * most recent request number for any of them (again, conservative
- * but safe).
- *
- * There are a few other complications as well. When Tk destroys a
- * sub-tree of windows, it only issues a single XDestroyWindow call,
- * at the very end for the root of the subtree. We can't free any of
- * the window ids until the final XDestroyWindow call. To make sure
- * that this happens, we have to keep track of deletions in progress,
- * hence the need for the "destroyCount" field of the display.
- *
- * One final problem. Some servers, like Sun X11/News servers still
- * seem to have problems with ids getting reused too quickly. I'm
- * not completely sure why this is a problem, but delaying the
- * recycling of ids appears to eliminate it. Therefore, we wait
- * an additional few seconds, even after "the coast is clear"
- * before reusing the ids.
+ * Freeing window ids is very tricky because there could still be events
+ * pending for a window in the event queue (or even in the server) at the
+ * time the window is destroyed. If the window id were to get reused
+ * immediately for another window, old events could "drop in" on the new
+ * window, causing unexpected behavior.
+ *
+ * Thus we have to wait to re-use a window id until we know that there
+ * are no events left for it. Right now this is done in two steps. First,
+ * we wait until we know that the server has seen the XDestroyWindow
+ * request, so we can be sure that it won't generate more events for the
+ * window and that any existing events are in our queue. Second, we make
+ * sure that there are no events whatsoever in our queue (this is
+ * conservative but safe).
+ *
+ * The first step is done by remembering the request id of the
+ * XDestroyWindow request and using LastKnownRequestProcessed to see what
+ * events the server has processed. If multiple windows get destroyed at
+ * about the same time, we just remember the most recent request number
+ * for any of them (again, conservative but safe).
+ *
+ * There are a few other complications as well. When Tk destroys a
+ * sub-tree of windows, it only issues a single XDestroyWindow call, at
+ * the very end for the root of the subtree. We can't free any of the
+ * window ids until the final XDestroyWindow call. To make sure that this
+ * happens, we have to keep track of deletions in progress, hence the
+ * need for the "destroyCount" field of the display.
+ *
+ * One final problem. Some servers, like Sun X11/News servers still seem
+ * to have problems with ids getting reused too quickly. I'm not
+ * completely sure why this is a problem, but delaying the recycling of
+ * ids appears to eliminate it. Therefore, we wait an additional few
+ * seconds, even after "the coast is clear" before reusing the ids.
*
*----------------------------------------------------------------------
*/
void
-TkFreeWindowId(dispPtr, w)
- TkDisplay *dispPtr; /* Display that w belongs to. */
- Window w; /* X identifier for window on dispPtr. */
+TkFreeWindowId(
+ TkDisplay *dispPtr, /* Display that w belongs to. */
+ Window w) /* X identifier for window on dispPtr. */
{
TkIdStack *stackPtr;
/*
- * Put the window id on a separate stack of window ids, rather
- * than the main stack, so it won't get reused right away. Add
- * a new chunk to the stack if the current chunk is full.
+ * Put the window id on a separate stack of window ids, rather than the
+ * main stack, so it won't get reused right away. Add a new chunk to the
+ * stack if the current chunk is full.
*/
stackPtr = dispPtr->windowStackPtr;
@@ -329,13 +317,12 @@ TkFreeWindowId(dispPtr, w)
stackPtr->numUsed++;
/*
- * Schedule a call to WindowIdCleanup if one isn't already
- * scheduled.
+ * Schedule a call to WindowIdCleanup if one isn't already scheduled.
*/
if (!dispPtr->idCleanupScheduled) {
- dispPtr->idCleanupScheduled =
- Tcl_CreateTimerHandler(100, WindowIdCleanup, (ClientData) dispPtr);
+ dispPtr->idCleanupScheduled = Tcl_CreateTimerHandler(100,
+ WindowIdCleanup, (ClientData) dispPtr);
}
}
@@ -344,24 +331,23 @@ TkFreeWindowId(dispPtr, w)
*
* WindowIdCleanup --
*
- * See if we can now free up all the accumulated ids of
- * deleted windows.
+ * See if we can now free up all the accumulated ids of deleted windows.
*
* Results:
* None.
*
* Side effects:
- * If it's safe to move the window ids back to the main free
- * list, we schedule this to happen after a few mores seconds
- * of delay. If it's not safe to move them yet, a timer handler
- * gets invoked to try again later.
+ * If it's safe to move the window ids back to the main free list, we
+ * schedule this to happen after a few mores seconds of delay. If it's
+ * not safe to move them yet, a timer handler gets invoked to try again
+ * later.
*
*----------------------------------------------------------------------
*/
static void
-WindowIdCleanup(clientData)
- ClientData clientData; /* Pointer to TkDisplay for display */
+WindowIdCleanup(
+ ClientData clientData) /* Pointer to TkDisplay for display */
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
int anyEvents, delta;
@@ -372,14 +358,14 @@ WindowIdCleanup(clientData)
dispPtr->idCleanupScheduled = (Tcl_TimerToken) 0;
/*
- * See if it's safe to recycle the window ids. It's safe if:
+ * See if it's safe to recycle the window ids. It's safe if:
* (a) no deletions are in progress.
* (b) the server has seen all of the requests up to the last
* XDestroyWindow request.
- * (c) there are no events in the event queue; the only way to
- * test for this right now is to create a restrict proc that
- * will filter the events, then call Tcl_DoOneEvent to see if
- * the procedure gets invoked.
+ * (c) there are no events in the event queue; the only way to test for
+ * this right now is to create a restrict proc that will filter the
+ * events, then call Tcl_DoOneEvent to see if the function gets
+ * invoked.
*/
if (dispPtr->destroyCount > 0) {
@@ -400,8 +386,8 @@ WindowIdCleanup(clientData)
}
/*
- * These ids look safe to recycle, but we still need to delay a bit
- * more (see comments for TkFreeWindowId). Schedule the final freeing.
+ * These ids look safe to recycle, but we still need to delay a bit more
+ * (see comments for TkFreeWindowId). Schedule the final freeing.
*/
if (dispPtr->windowStackPtr != NULL) {
@@ -412,12 +398,12 @@ WindowIdCleanup(clientData)
return;
/*
- * It's still not safe to free up the ids. Try again a bit later.
+ * It's still not safe to free up the ids. Try again a bit later.
*/
- tryAgain:
- dispPtr->idCleanupScheduled =
- Tcl_CreateTimerHandler(500, WindowIdCleanup, (ClientData) dispPtr);
+ tryAgain:
+ dispPtr->idCleanupScheduled = Tcl_CreateTimerHandler(500,
+ WindowIdCleanup, (ClientData) dispPtr);
}
/*
@@ -425,9 +411,9 @@ WindowIdCleanup(clientData)
*
* WindowIdCleanup2 --
*
- * This procedure is the last one in the chain that recycles
- * window ids. It takes all of the ids indicated by its
- * argument and adds them back to the main id free list.
+ * This function is the last one in the chain that recycles window ids.
+ * It takes all of the ids indicated by its argument and adds them back
+ * to the main id free list.
*
* Results:
* None.
@@ -439,8 +425,8 @@ WindowIdCleanup(clientData)
*/
static void
-WindowIdCleanup2(clientData)
- ClientData clientData; /* Pointer to TkIdStack list. */
+WindowIdCleanup2(
+ ClientData clientData) /* Pointer to TkIdStack list. */
{
TkIdStack *stackPtr = (TkIdStack *) clientData;
TkIdStack *lastPtr;
@@ -458,9 +444,9 @@ WindowIdCleanup2(clientData)
*
* CheckRestrictProc --
*
- * This procedure is a restrict procedure, called by Tcl_DoOneEvent
- * to filter X events. All it does is to set a flag to indicate
- * that there are X events present.
+ * This function is a restrict function, called by Tcl_DoOneEvent to
+ * filter X events. All it does is to set a flag to indicate that there
+ * are X events present.
*
* Results:
* Sets the integer pointed to by the argument, then returns
@@ -473,9 +459,9 @@ WindowIdCleanup2(clientData)
*/
static Tk_RestrictAction
-CheckRestrictProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to flag to set. */
- XEvent *eventPtr; /* Event to filter; not used. */
+CheckRestrictProc(
+ ClientData clientData, /* Pointer to flag to set. */
+ XEvent *eventPtr) /* Event to filter; not used. */
{
int *flag = (int *) clientData;
*flag = 1;
@@ -487,8 +473,8 @@ CheckRestrictProc(clientData, eventPtr)
*
* Tk_GetPixmap --
*
- * Same as the XCreatePixmap procedure except that it manages
- * resource identifiers better.
+ * Same as the XCreatePixmap function except that it manages resource
+ * identifiers better.
*
* Results:
* Returns a new pixmap.
@@ -500,11 +486,11 @@ CheckRestrictProc(clientData, eventPtr)
*/
Pixmap
-Tk_GetPixmap(display, d, width, height, depth)
- Display *display; /* Display for new pixmap. */
- Drawable d; /* Drawable where pixmap will be used. */
- int width, height; /* Dimensions of pixmap. */
- int depth; /* Bits per pixel for pixmap. */
+Tk_GetPixmap(
+ Display *display, /* Display for new pixmap. */
+ Drawable d, /* Drawable where pixmap will be used. */
+ int width, int height, /* Dimensions of pixmap. */
+ int depth) /* Bits per pixel for pixmap. */
{
return XCreatePixmap(display, d, (unsigned) width, (unsigned) height,
(unsigned) depth);
@@ -515,23 +501,23 @@ Tk_GetPixmap(display, d, width, height, depth)
*
* Tk_FreePixmap --
*
- * Same as the XFreePixmap procedure except that it also marks
- * the resource identifier as free.
+ * Same as the XFreePixmap function except that it also marks the
+ * resource identifier as free.
*
* Results:
* None.
*
* Side effects:
- * The pixmap is freed in the X server and its resource identifier
- * is saved for re-use.
+ * The pixmap is freed in the X server and its resource identifier is
+ * saved for re-use.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreePixmap(display, pixmap)
- Display *display; /* Display for which pixmap was allocated. */
- Pixmap pixmap; /* Identifier for pixmap. */
+Tk_FreePixmap(
+ Display *display, /* Display for which pixmap was allocated. */
+ Pixmap pixmap) /* Identifier for pixmap. */
{
XFreePixmap(display, pixmap);
Tk_FreeXId(display, (XID) pixmap);
@@ -542,10 +528,10 @@ Tk_FreePixmap(display, pixmap)
*
* TkpWindowWasRecentlyDeleted --
*
- * Checks whether the window was recently deleted. This is called
- * by the generic error handler to detect asynchronous notification
- * of errors due to operations by Tk on a window that was already
- * deleted by the server.
+ * Checks whether the window was recently deleted. This is called by the
+ * generic error handler to detect asynchronous notification of errors
+ * due to operations by Tk on a window that was already deleted by the
+ * server.
*
* Results:
* 1 if the window was deleted recently, 0 otherwise.
@@ -557,21 +543,20 @@ Tk_FreePixmap(display, pixmap)
*/
int
-TkpWindowWasRecentlyDeleted(win, dispPtr)
- Window win; /* The window to check for. */
- TkDisplay *dispPtr; /* The window belongs to this display. */
+TkpWindowWasRecentlyDeleted(
+ Window win, /* The window to check for. */
+ TkDisplay *dispPtr) /* The window belongs to this display. */
{
TkIdStack *stackPtr;
int i;
- for (stackPtr = dispPtr->windowStackPtr;
- stackPtr != NULL;
- stackPtr = stackPtr->nextPtr) {
- for (i = 0; i < stackPtr->numUsed; i++) {
- if ((Window) stackPtr->ids[i] == win) {
- return 1;
- }
- }
+ for (stackPtr = dispPtr->windowStackPtr; stackPtr != NULL;
+ stackPtr = stackPtr->nextPtr) {
+ for (i = 0; i < stackPtr->numUsed; i++) {
+ if ((Window) stackPtr->ids[i] == win) {
+ return 1;
+ }
+ }
}
return 0;
}
@@ -584,10 +569,10 @@ TkpWindowWasRecentlyDeleted(win, dispPtr)
* Given a string, produce the corresponding Window Id.
*
* Results:
- * The return value is normally TCL_OK; in this case *idPtr
- * will be set to the Window value equivalent to string. If
- * string is improperly formed then TCL_ERROR is returned and
- * an error message will be left in the interp's result.
+ * The return value is normally TCL_OK; in this case *idPtr will be set
+ * to the Window value equivalent to string. If string is improperly
+ * formed then TCL_ERROR is returned and an error message will be left in
+ * the interp's result.
*
* Side effects:
* None.
@@ -596,16 +581,24 @@ TkpWindowWasRecentlyDeleted(win, dispPtr)
*/
int
-TkpScanWindowId(interp, string, idPtr)
- Tcl_Interp *interp;
- CONST char *string;
- Window *idPtr;
+TkpScanWindowId(
+ Tcl_Interp *interp,
+ CONST char *string,
+ Window *idPtr)
{
int value;
+
if (Tcl_GetInt(interp, string, &value) != TCL_OK) {
return TCL_ERROR;
}
*idPtr = (Window) value;
return TCL_OK;
}
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/Makefile.in b/win/Makefile.in
index 9304b43..5f9fd46 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -7,6 +7,7 @@
TCLVERSION = @TCL_VERSION@
TCLPATCHL = @TCL_PATCH_LEVEL@
VERSION = @TK_VERSION@
+PATCH_LEVEL = @TK_PATCH_LEVEL@
#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
@@ -92,6 +93,11 @@ TCL_BIN_DIR = @TCL_BIN_DIR@
# for this version of Tk ("srcdir" will be replaced or has already
# been replaced by the configure script):
TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic
+
+# The directory containing the platform specific Tcl sources and headers
+# appropriate for this version of Tk:
+TCL_PLATFORM_DIR = @TCL_SRC_DIR@/win
+
TCL_TOOL_DIR = @TCL_SRC_DIR@/tools
# Converts a POSIX path to a Windows native path.
@@ -106,6 +112,7 @@ ROOT_DIR = $(SRC_DIR)/..
WIN_DIR = $(SRC_DIR)
UNIX_DIR = $(SRC_DIR)/../unix
GENERIC_DIR = $(SRC_DIR)/../generic
+TTK_DIR = $(GENERIC_DIR)/ttk
BITMAP_DIR = $(ROOT_DIR)/bitmaps
XLIB_DIR = $(ROOT_DIR)/xlib
RC_DIR = $(WIN_DIR)/rc
@@ -117,6 +124,7 @@ BITMAP_DIR_NATIVE = $(ROOT_DIR_NATIVE)/bitmaps
XLIB_DIR_NATIVE = $(ROOT_DIR_NATIVE)/xlib
RC_DIR_NATIVE = $(WIN_DIR_NATIVE)/rc
TCL_GENERIC_NATIVE = $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)' | sed 's!\\!/!g')
+TCL_PLATFORM_NATIVE = $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)' | sed 's!\\!/!g')
TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)' | sed 's!\\!/!g')
DLLSUFFIX = @DLLSUFFIX@
@@ -141,7 +149,7 @@ MAN2TCL = man2tcl$(EXEEXT)
# makefile to look into these paths when resolving .c to .obj
# dependencies.
-VPATH = $(GENERIC_DIR):$(WIN_DIR):$(UNIX_DIR):$(XLIB_DIR):$(RC_DIR)
+VPATH = $(GENERIC_DIR):$(TTK_DIR):$(WIN_DIR):$(UNIX_DIR):$(XLIB_DIR):$(RC_DIR)
# warning flags
CFLAGS_WARNING = @CFLAGS_WARNING@
@@ -203,7 +211,7 @@ TCL_EXE = @TCLSH_PROG@
CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
-I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \
- -I"${TCL_GENERIC_NATIVE}" ${AC_FLAGS}
+-I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" ${AC_FLAGS}
CC_OBJNAME = @CC_OBJNAME@
CC_EXENAME = @CC_EXENAME@
@@ -227,6 +235,7 @@ TKTEST_OBJS = \
testMain.$(OBJEXT) \
tkSquare.$(OBJEXT) \
tkTest.$(OBJEXT) \
+ tkOldTest.$(OBJEXT) \
tkWinTest.$(OBJEXT)
XLIB_OBJS = \
@@ -261,6 +270,7 @@ TK_OBJS = \
tkWinRegion.$(OBJEXT) \
tkWinScrlbr.$(OBJEXT) \
tkWinSend.$(OBJEXT) \
+ tkWinSendCom.$(OBJEXT) \
tkWinWindow.$(OBJEXT) \
tkWinWm.$(OBJEXT) \
tkWinX.$(OBJEXT) \
@@ -337,11 +347,46 @@ TK_OBJS = \
tkVisual.$(OBJEXT) \
tkStubInit.$(OBJEXT) \
tkStubLib.$(OBJEXT) \
- tkWindow.$(OBJEXT)
+ tkWindow.$(OBJEXT) \
+ $(TTK_OBJS)
+
+TTK_OBJS = \
+ ttkWinMonitor.$(OBJEXT) \
+ ttkWinTheme.$(OBJEXT) \
+ ttkWinXPTheme.$(OBJEXT) \
+ ttkBlink.$(OBJEXT) \
+ ttkButton.$(OBJEXT) \
+ ttkCache.$(OBJEXT) \
+ ttkClamTheme.$(OBJEXT) \
+ ttkClassicTheme.$(OBJEXT) \
+ ttkDefaultTheme.$(OBJEXT) \
+ ttkElements.$(OBJEXT) \
+ ttkEntry.$(OBJEXT) \
+ ttkFrame.$(OBJEXT) \
+ ttkImage.$(OBJEXT) \
+ ttkInit.$(OBJEXT) \
+ ttkLabel.$(OBJEXT) \
+ ttkLayout.$(OBJEXT) \
+ ttkManager.$(OBJEXT) \
+ ttkNotebook.$(OBJEXT) \
+ ttkPanedwindow.$(OBJEXT) \
+ ttkProgress.$(OBJEXT) \
+ ttkScale.$(OBJEXT) \
+ ttkScrollbar.$(OBJEXT) \
+ ttkScroll.$(OBJEXT) \
+ ttkSeparator.$(OBJEXT) \
+ ttkSquare.$(OBJEXT) \
+ ttkState.$(OBJEXT) \
+ ttkTagSet.$(OBJEXT) \
+ ttkTheme.$(OBJEXT) \
+ ttkTrace.$(OBJEXT) \
+ ttkTrack.$(OBJEXT) \
+ ttkTreeview.$(OBJEXT) \
+ ttkWidget.$(OBJEXT) \
+ ttkStubInit.$(OBJEXT)
STUB_OBJS = \
- tkStubLib.$(OBJEXT) \
- tkStubImg.$(OBJEXT)
+ tkStubLib.$(OBJEXT) ttkStubLib.$(OBJEXT)
TCL_DOCS = "$(TCL_SRC_DIR_NATIVE)"/doc/*.[13n]
TK_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n]
@@ -349,6 +394,11 @@ CORE_DOCS = $(TCL_DOCS) $(TK_DOCS)
DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
+SHELL_ENV = \
+ @TCL_LIBRARY="$(TCL_SRC_DIR_NATIVE)/library"; export TCL_LIBRARY; \
+ TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \
+ PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH;
+
# Main targets. The default target -- all -- builds the binaries,
# performs any post processing on libraries or documents.
@@ -376,26 +426,26 @@ $(MAN2TCL): $(TCL_SRC_DIR_NATIVE)/tools/man2tcl.c
# args to tcltest, ie:
# % make test TESTFLAGS="-verbose bps -file fileName.test"
-test: binaries $(TKTEST)
- @TCL_LIBRARY="$(TCL_SRC_DIR_NATIVE)/library"; export TCL_LIBRARY; \
- TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \
- PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; \
- ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" $(TESTFLAGS) \
- | ./$(CAT32)
+test: test-classic test-ttk
+
+test-classic: binaries $(TKTEST)
+ $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \
+ $(TESTFLAGS) | ./$(CAT32)
+
+test-ttk: binaries $(TKTEST)
+ $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \
+ $(TESTFLAGS) | ./$(CAT32)
runtest: binaries $(TKTEST)
- @TCL_LIBRARY="$(TCL_SRC_DIR_NATIVE)/library"; export TCL_LIBRARY; \
- TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \
- PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; \
- ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)
+ $(SHELL_ENV) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)
# This target can be used to run wish from the build directory
# via `make shell` or `make shell SCRIPT=foo.tcl`
shell: binaries
- @TCL_LIBRARY="$(TCL_SRC_DIR_NATIVE)/library"; export TCL_LIBRARY; \
- TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \
- PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; \
- ./$(WISH) $(SCRIPT)
+ $(SHELL_ENV) ./$(WISH) $(SCRIPT)
+
+demo: $(WISH)
+ $(SHELL_ENV) ./$(WISH) $(ROOT_DIR)/library/demos/widget
# This target can be used to run wish inside either gdb or insight
gdb: binaries
@@ -427,9 +477,8 @@ install-binaries: binaries
@echo "Creating package index $(PKG_INDEX)";
@$(RM) $(PKG_INDEX);
@(\
- echo "if {[package vcompare [package provide Tcl]\
- $(TCLVERSION)] != 0} { return }";\
- echo "package ifneeded Tk $(VERSION)\
+ echo "if {[catch {package present Tcl 8.5.0}]} { return }";\
+ echo "package ifneeded Tk $(VERSION)$(PATCH_LEVEL)\
[list load [file join \$$dir .. .. bin $(TK_DLL_FILE)] Tk]";\
) > $(PKG_INDEX);
@for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \
@@ -444,7 +493,7 @@ install-libraries: libraries
@for i in $(INSTALL_ROOT)$(prefix)/lib \
$(INCLUDE_INSTALL_DIR) $(INCLUDE_INSTALL_DIR)/X11 \
$(SCRIPT_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)/images \
- $(SCRIPT_INSTALL_DIR)/msgs; \
+ $(SCRIPT_INSTALL_DIR)/msgs $(SCRIPT_INSTALL_DIR)/ttk; \
do \
if [ ! -d $$i ] ; then \
echo "Making directory $$i"; \
@@ -464,11 +513,18 @@ install-libraries: libraries
$(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/X11; \
done;
@echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
- @for i in $(ROOT_DIR)/library/*.tcl $(GENERIC_DIR)/prolog.ps \
+ @for i in $(ROOT_DIR)/library/*.tcl \
$(ROOT_DIR)/library/tclIndex $(UNIX_DIR)/tkAppInit.c; \
do \
$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
done;
+ @echo "Installing library ttk directory";
+ @for i in $(ROOT_DIR)/library/ttk/*.tcl; \
+ do \
+ if [ -f $$i ] ; then \
+ $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/ttk; \
+ fi; \
+ done;
@echo "Installing library images directory";
@for i in $(ROOT_DIR)/library/images/*; \
do \
@@ -536,8 +592,7 @@ install-private-headers: libraries
@echo "Installing private header files to $(PRIVATE_INCLUDE_INSTALL_DIR)/";
@for i in $(GENERIC_DIR)/tkInt.h $(GENERIC_DIR)/tkIntDecls.h \
$(GENERIC_DIR)/tkIntPlatDecls.h $(GENERIC_DIR)/tkPort.h \
- $(WIN_DIR)/tkWinPort.h $(WIN_DIR)/tkWinInt.h \
- $(WIN_DIR)/tkWin.h; \
+ $(WIN_DIR)/tkWinPort.h $(WIN_DIR)/tkWinInt.h $(WIN_DIR)/tkWin.h; \
do \
$(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \
done;
@@ -559,7 +614,7 @@ $(TKTEST): $(TK_LIB_FILE) $(TKTEST_OBJS) wish.$(RES) $(CAT32)
$(TCL_SRC_DIR)/win/cat.c:
cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c
- $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+ $(CC) -c $(CC_SWITCHES) "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME)
$(CAT32): cat32.${OBJEXT}
$(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE)
@@ -593,12 +648,20 @@ testMain.$(OBJEXT): winMain.c
tkTest.$(OBJEXT): tkTest.c
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+tkOldTest.$(OBJEXT): tkOldTest.c
+ $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+
tkWinTest.$(OBJEXT): tkWinTest.c
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
tkSquare.$(OBJEXT): tkSquare.c
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
+# Extra dependency info
+tkConsole.$(OBJEXT): configure Makefile
+tkMain.$(OBJEXT): configure Makefile
+tkWindow.$(OBJEXT): configure Makefile
+
# Add the object extension to the implicit rules. By default .obj is not
# automatically added.
@@ -608,11 +671,11 @@ tkSquare.$(OBJEXT): tkSquare.c
# Implicit rule for all object files that will end up in the Tcl library
-.c.$(OBJEXT):
- $(CC) -c $(STUB_CC_SWITCHES) -DBUILD_tk @DEPARG@ $(CC_OBJNAME)
+%.$(OBJEXT): %.c
+ $(CC) -c $(STUB_CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
.rc.$(RES):
- $(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(TCL_GENERIC_NATIVE)" @RC_INCLUDE@ "$(RC_DIR_NATIVE)" @DEPARG@
+ $(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(TCL_GENERIC_NATIVE)" @RC_INCLUDE@ "$(TCL_PLATFORM_NATIVE)" @RC_INCLUDE@ "$(RC_DIR_NATIVE)" @DEPARG@
depend:
@@ -642,7 +705,7 @@ $(GENERIC_DIR)/tkStubInit.c: $(GENERIC_DIR)/tk.decls \
@echo "This warning can be safely ignored, do not report as a bug!"
genstubs:
- $(TCL_EXE) "$(TCL_TOOL_DIR}\genStubs.tcl" \
+ $(TCL_EXE) "$(TCL_TOOL_DIR)\genStubs.tcl" \
"$(GENERIC_DIR_NATIVE)" \
"$(GENERIC_DIR_NATIVE)\tk.decls" \
"$(GENERIC_DIR_NATIVE)\tkInt.decls"
diff --git a/win/README b/win/README
index f6e1a34..1d4b27a 100644
--- a/win/README
+++ b/win/README
@@ -1,4 +1,4 @@
-Tk 8.4 for Windows
+Tk 8.5 for Windows
Originally by Scott Stanton while at Sun Microsystems Labs
diff --git a/win/buildall.vc.bat b/win/buildall.vc.bat
index dd69d09..16605ee 100755
--- a/win/buildall.vc.bat
+++ b/win/buildall.vc.bat
@@ -4,58 +4,123 @@
:: edit this (or make your own) for your needs and wants using
:: the instructions for calling makefile.vc found in makefile.vc
+set SYMBOLS=
+
+:OPTIONS
+if "%1" == "/?" goto help
+if /i "%1" == "/help" goto help
+if %1.==symbols. goto SYMBOLS
+if %1.==debug. goto SYMBOLS
+goto OPTIONS_DONE
+
+:SYMBOLS
+ set SYMBOLS=symbols
+ shift
+ goto OPTIONS
+
+:OPTIONS_DONE
+
+:: reset errorlevel
+cd > nul
+
+:: We need to run the development environment batch script that comes
+:: with developer studio (v4,5,6,7,etc...) All have it. These paths
+:: might not be correct. You may need to edit these.
+::
+if not defined MSDevDir (
+ call "C:\Program Files\Microsoft Developer Studio\vc98\bin\vcvars32.bat"
+ ::call "C:\Program Files\Microsoft Developer Studio\vc\bin\vcvars32.bat"
+ ::call c:\dev\devstudio60\vc98\bin\vcvars32.bat
+ if errorlevel 1 goto no_vcvars
+)
+
+
echo Sit back and have a cup of coffee while this grinds through ;)
echo You asked for *everything*, remember?
echo.
-
title Building Tk, please wait...
-if "%MSVCDir%" == "" call c:\dev\devstudio60\vc98\bin\vcvars32.bat
-::if "%MSVCDir%" == "" call "C:\Program Files\Microsoft Developer Studio\vc98\bin\vcvars32.bat"
-set INSTALLDIR=C:\Program Files\Tcl
+:: makefile.vc uses this for its default anyways, but show its use here
+:: just to be explicit and convey understanding to the user. Setting
+:: the INSTALLDIR envar prior to running this batchfile affects all builds.
+::
+if "%INSTALLDIR%" == "" set INSTALLDIR=C:\Program Files\Tcl
+
:: Where is the Tcl source directory?
-set TCLDIR=..\..\tcl_head_stock
-::set TCLDIR=..\..\tcl8.4
+:: You can set the TCLDIR environment variable to your Tcl HEAD checkout
+if "%TCLDIR%" == "" set TCLDIR=..\..\tcl
:: Build the normal stuff along with the help file.
::
-nmake -nologo -f makefile.vc release winhelp OPTS=none
+set OPTS=none
+if not %SYMBOLS%.==. set OPTS=symbols
+nmake -nologo -f makefile.vc release winhelp OPTS=%OPTS% %1
if errorlevel 1 goto error
:: Build the static core, dlls and shell.
::
-nmake -nologo -f makefile.vc release OPTS=static
+set OPTS=static
+if not %SYMBOLS%.==. set OPTS=symbols,static
+nmake -nologo -f makefile.vc release OPTS=%OPTS% %1
if errorlevel 1 goto error
:: Build the special static libraries that use the dynamic runtime.
::
-nmake -nologo -f makefile.vc core OPTS=static,msvcrt
+set OPTS=static,msvcrt
+if not %SYMBOLS%.==. set OPTS=symbols,static,msvcrt
+nmake -nologo -f makefile.vc core OPTS=%OPTS% %1
if errorlevel 1 goto error
:: Build the core and shell for thread support.
::
-nmake -nologo -f makefile.vc release OPTS=threads
+set OPTS=threads
+if not %SYMBOLS%.==. set OPTS=symbols,threads
+nmake -nologo -f makefile.vc release OPTS=%OPTS% %1
if errorlevel 1 goto error
:: Build a static, thread support core library (no shell).
::
-nmake -nologo -f makefile.vc core OPTS=static,threads
+set OPTS=static,threads
+if not %SYMBOLS%.==. set OPTS=symbols,static,threads
+nmake -nologo -f makefile.vc core OPTS=%OPTS% %1
if errorlevel 1 goto error
:: Build the special static libraries the use the dynamic runtime,
:: but now with thread support.
::
-nmake -nologo -f makefile.vc core OPTS=static,msvcrt,threads
+set OPTS=static,msvcrt,threads
+if not %SYMBOLS%.==. set OPTS=symbols,static,msvcrt,threads
+nmake -nologo -f makefile.vc core OPTS=%OPTS% %1
if errorlevel 1 goto error
+set SYMBOLS=
goto end
:error
echo *** BOOM! ***
+goto end
+
+:no_vcvars
+echo vcvars32.bat not found. You'll need to edit this batch script.
+goto out
+
+:help
+title buildall.vc.bat help message
+echo usage:
+echo %0 : builds Tk for all build types (do this first)
+echo %0 install : installs all the release builds (do this second)
+echo %0 symbols : builds Tk for all debugging build types.
+echo %0 symbols install : install all the debug builds
+echo.
+goto out
:end
-title Building Tk, please wait...DONE!
+title Building Tk, please wait... DONE!
echo DONE!
+goto out
+
+:out
pause
+title Command Prompt
diff --git a/win/configure b/win/configure
index 211b35c..70b9eca 100755
--- a/win/configure
+++ b/win/configure
@@ -1,42 +1,325 @@
#! /bin/sh
-
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Generated by GNU Autoconf 2.59.
#
+# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
-# Defaults:
-ac_help=
+#
+# Initializations.
+#
ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --enable-threads build with threads"
-ac_help="$ac_help
- --enable-shared build and link with shared libraries [--enable-shared]"
-ac_help="$ac_help
- --enable-64bit enable 64bit support (where applicable)"
-ac_help="$ac_help
- --enable-wince enable Win/CE support (where applicable)"
-ac_help="$ac_help
- --with-celib=DIR use Windows/CE support library from DIR"
-ac_help="$ac_help
- --enable-symbols build with debugging symbols [--disable-symbols]"
-ac_help="$ac_help
- --enable-embedded-manifest embed manifest if possible (default: yes)"
-ac_help="$ac_help
- --with-tcl=DIR use Tcl 8.4 binaries from DIR"
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="../generic/tk.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING MAN2TCLFLAGS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_DEFS BUILD_TCLSH TCLSH_PROG TK_WIN_VERSION MACHINE TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_DBGX TK_LIB_FILE TK_DLL_FILE TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_BUILD_STUB_LIB_SPEC TK_SRC_DIR TK_BIN_DIR TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_DBGX CFG_TK_SHARED_LIB_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_EXPORT_FILE_SUFFIX TK_SHARED_BUILD DEPARG EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES TK_RES RES LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TK_LIB_FLAG TK_LIB_SPEC TK_BUILD_LIB_SPEC TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_BUILD_STUB_LIB_PATH TK_CC_SEARCH_FLAGS TK_LD_SEARCH_FLAGS LIBOBJS LTLIBOBJS'
+ac_subst_files=''
# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
exec_prefix=NONE
-host=NONE
no_create=
-nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
@@ -45,10 +328,15 @@ program_transform_name=s,x,x,
silent=
site=
srcdir=
-target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
@@ -62,17 +350,9 @@ oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
ac_prev=
for ac_option
do
-
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
@@ -80,59 +360,59 @@ do
continue
fi
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case "$ac_option" in
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
+ bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
+ ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
+ build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
- datadir="$ac_optarg" ;;
+ datadir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -141,95 +421,47 @@ do
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
+ exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
-host | --host | --hos | --ho)
- ac_prev=host ;;
+ ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
+ host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
+ includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
+ infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
+ libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
+ libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
@@ -238,19 +470,19 @@ EOF
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
+ localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
+ mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
+ | --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -264,26 +496,26 @@ EOF
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
+ oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
+ prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
+ program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
+ program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
@@ -300,7 +532,7 @@ EOF
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
+ program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
@@ -310,7 +542,7 @@ EOF
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
+ sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -321,58 +553,57 @@ EOF
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
+ sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
+ site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
+ srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
+ sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
+ ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
+ target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "with_${ac_package}='$ac_optarg'" ;;
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -383,99 +614,110 @@ EOF
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
+ x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
+ x_libraries=$ac_optarg ;;
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
*)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
fi
-exec 5>./config.log
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
esac
done
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=../generic/tk.h
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
@@ -485,13 +727,471 @@ else
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-threads build with threads
+ --enable-shared build and link with shared libraries --enable-shared
+ --enable-64bit enable 64bit support (where applicable)
+ --enable-wince enable Win/CE support (where applicable)
+ --enable-symbols build with debugging symbols --disable-symbols
+ --enable-embedded-manifest
+ embed manifest if possible (default: yes)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-celib=DIR use Windows/CE support library from DIR
+ --with-tcl=DIR use Tcl 8.5 binaries from DIR
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
@@ -502,47 +1202,116 @@ if test -z "$CONFIG_SITE"; then
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
else
- echo "creating cache $cache_file"
- > $cache_file
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
fi
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
fi
-else
- ac_n= ac_c='\c' ac_t=
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
-TK_VERSION=8.4
+
+
+
+
+
+# The following define is needed when building with Cygwin since newer
+# versions of autoconf incorrectly set SHELL to /bin/bash instead of
+# /bin/sh. The bash shell seems to suffer from some strange failures.
+SHELL=/bin/sh
+
+TK_VERSION=8.5
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=4
-TK_PATCH_LEVEL=".19"
+TK_MINOR_VERSION=5
+TK_PATCH_LEVEL=".11"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -568,214 +1337,659 @@ if test "${CFLAGS+set}" != "set" ; then
CFLAGS=""
fi
-# Extract the first word of "gcc", so it can be a program name with args.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:575: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
else
- echo "$ac_t""no" 1>&6
+ CC="$ac_cv_prog_CC"
fi
+fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:605: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
- if test $# -gt 0; then
+ if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:656: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- ;;
- esac
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:688: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+fi
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 699 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
else
- ac_cv_prog_cc_cross=yes
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:730: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:735: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:744: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
else
- ac_cv_prog_gcc=no
-fi
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
else
- GCC=
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:763: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
else
- ac_cv_prog_cc_g=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
+ CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
@@ -789,146 +2003,1027 @@ else
CFLAGS=
fi
fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
-# To properly support cross-compilation, one would
-# need to use these tool checks instead of
-# the ones below and reconfigure with
-# autoconf 2.50. You can also just set
-# the CC, AR, RANLIB, and RC environment
-# variables if you want to cross compile.
-#AC_CHECK_TOOL(AR, ar)
-#AC_CHECK_TOOL(RANLIB, ranlib)
-#AC_CHECK_TOOL(RC, windres)
+fi
-if test "${GCC}" = "yes" ; then
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:809: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6
+
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-AR="$ac_cv_prog_AR"
+AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:838: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
+RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- # Extract the first word of "windres", so it can be a program name with args.
-set dummy windres; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:867: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
+set dummy ${ac_tool_prefix}windres; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$RC"; then
ac_cv_prog_RC="$RC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RC="windres"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RC="${ac_tool_prefix}windres"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-RC="$ac_cv_prog_RC"
+RC=$ac_cv_prog_RC
if test -n "$RC"; then
- echo "$ac_t""$RC" 1>&6
+ echo "$as_me:$LINENO: result: $RC" >&5
+echo "${ECHO_T}$RC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+fi
+if test -z "$ac_cv_prog_RC"; then
+ ac_ct_RC=$RC
+ # Extract the first word of "windres", so it can be a program name with args.
+set dummy windres; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RC"; then
+ ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RC="windres"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
- if test "${AR}" = "" ; then
- { echo "configure: error: Required archive tool 'ar' not found on PATH." 1>&2; exit 1; }
- fi
- if test "${RANLIB}" = "" ; then
- { echo "configure: error: Required archive index tool 'ranlib' not found on PATH." 1>&2; exit 1; }
- fi
- if test "${RC}" = "" ; then
- { echo "configure: error: Required resource tool 'windres' not found on PATH." 1>&2; exit 1; }
- fi
+fi
+fi
+ac_ct_RC=$ac_cv_prog_ac_ct_RC
+if test -n "$ac_ct_RC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RC" >&5
+echo "${ECHO_T}$ac_ct_RC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RC=$ac_ct_RC
+else
+ RC="$ac_cv_prog_RC"
fi
+
#--------------------------------------------------------------------
-# Checks to see if the make progeam sets the $MAKE variable.
+# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:910: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftestmake <<\EOF
+ cat >conftest.make <<\_ACEOF
all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
if test -n "$ac_maketemp"; then
eval ac_cv_prog_make_${ac_make}_set=yes
else
eval ac_cv_prog_make_${ac_make}_set=no
fi
-rm -f conftestmake
+rm -f conftest.make
fi
if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
SET_MAKE=
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -937,129 +3032,80 @@ fi
# Perform additinal compiler tests.
#--------------------------------------------------------------------
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:942: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 947 "configure"
-#include "confdefs.h"
-
-int main() {
-#ifndef __CYGWIN__
-#define __CYGWIN__ __CYGWIN32__
+echo "$as_me:$LINENO: checking for Cygwin version of gcc" >&5
+echo $ECHO_N "checking for Cygwin version of gcc... $ECHO_C" >&6
+if test "${ac_cv_cygwin+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#ifdef __CYGWIN__
+#error cygwin
#endif
-return __CYGWIN__;
-; return 0; }
-EOF
-if { (eval echo configure:958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_cygwin=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_cygwin" 1>&6
-CYGWIN=
-test "$ac_cv_cygwin" = yes && CYGWIN=yes
-
-#--------------------------------------------------------------------
-# Determines the correct binary file extension (.o, .obj, .exe etc.)
-#--------------------------------------------------------------------
-echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:980: checking for object suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- rm -f conftest*
-echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- for ac_file in conftest.*; do
- case $ac_file in
- *.c) ;;
- *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
- esac
- done
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_cygwin=no
else
- { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_cygwin=yes
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$ac_t""$ac_cv_objext" 1>&6
-OBJEXT=$ac_cv_objext
-ac_objext=$ac_cv_objext
-
-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1004: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1009 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:1016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_mingw32=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_mingw32=no
fi
-rm -f conftest*
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_cygwin" >&5
+echo "${ECHO_T}$ac_cv_cygwin" >&6
+if test "$ac_cv_cygwin" = "yes" ; then
+ { { echo "$as_me:$LINENO: error: Compiling under Cygwin is not currently supported.
+A maintainer for the Cygwin port of Tcl/Tk is needed. See the README
+file for information about building with Mingw." >&5
+echo "$as_me: error: Compiling under Cygwin is not currently supported.
+A maintainer for the Cygwin port of Tcl/Tk is needed. See the README
+file for information about building with Mingw." >&2;}
+ { (exit 1); exit 1; }; }
fi
-echo "$ac_t""$ac_cv_mingw32" 1>&6
-MINGW32=
-test "$ac_cv_mingw32" = yes && MINGW32=yes
+#--------------------------------------------------------------------
+# Determines the correct binary file extension (.o, .obj, .exe etc.)
+#--------------------------------------------------------------------
-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1035: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
- ac_cv_exeext=.exe
-else
- rm -f conftest*
- echo 'int main () { return 0; }' > conftest.$ac_ext
- ac_cv_exeext=
- if { (eval echo configure:1045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj) ;;
- *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
- fi
- rm -f conftest*
- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
-fi
-fi
-
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-echo "$ac_t""${ac_cv_exeext}" 1>&6
-ac_exeext=$EXEEXT
#--------------------------------------------------------------------
@@ -1067,35 +3113,36 @@ ac_exeext=$EXEEXT
#--------------------------------------------------------------------
- echo $ac_n "checking for building with threads""... $ac_c" 1>&6
-echo "configure:1072: checking for building with threads" >&5
+ echo "$as_me:$LINENO: checking for building with threads" >&5
+echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
# Check whether --enable-threads or --disable-threads was given.
if test "${enable_threads+set}" = set; then
enableval="$enable_threads"
tcl_ok=$enableval
else
tcl_ok=no
-fi
-
+fi;
if test "$tcl_ok" = "yes"; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
TCL_THREADS=1
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define TCL_THREADS 1
-EOF
+_ACEOF
# USE_THREAD_ALLOC tells us to try the special thread-based
# allocator that significantly reduces lock contention
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define USE_THREAD_ALLOC 1
-EOF
+_ACEOF
else
TCL_THREADS=0
- echo "$ac_t""no (default)" 1>&6
+ echo "$as_me:$LINENO: result: no (default)" >&5
+echo "${ECHO_T}no (default)" >&6
fi
-
+
#--------------------------------------------------------------------
@@ -1104,16 +3151,15 @@ EOF
#--------------------------------------------------------------------
- echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:1109: checking how to build libraries" >&5
+ echo "$as_me:$LINENO: checking how to build libraries" >&5
+echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6
# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
tcl_ok=$enableval
else
tcl_ok=yes
-fi
-
+fi;
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
@@ -1123,14 +3169,16 @@ fi
fi
if test "$tcl_ok" = "yes" ; then
- echo "$ac_t""shared" 1>&6
+ echo "$as_me:$LINENO: result: shared" >&5
+echo "${ECHO_T}shared" >&6
SHARED_BUILD=1
else
- echo "$ac_t""static" 1>&6
+ echo "$as_me:$LINENO: result: static" >&5
+echo "${ECHO_T}static" >&6
SHARED_BUILD=0
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define STATIC_BUILD 1
-EOF
+_ACEOF
fi
@@ -1141,79 +3189,158 @@ EOF
# after SC_ENABLE_SHARED checks the configure switches.
#--------------------------------------------------------------------
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
# Step 0: Enable 64 bit support?
- echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:1150: checking if 64bit support is requested" >&5
+ echo "$as_me:$LINENO: checking if 64bit support is requested" >&5
+echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6
# Check whether --enable-64bit or --disable-64bit was given.
if test "${enable_64bit+set}" = set; then
enableval="$enable_64bit"
do64bit=$enableval
else
do64bit=no
-fi
-
- echo "$ac_t""$do64bit" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $do64bit" >&5
+echo "${ECHO_T}$do64bit" >&6
# Cross-compiling options for Windows/CE builds
- echo $ac_n "checking if Windows/CE build is requested""... $ac_c" 1>&6
-echo "configure:1164: checking if Windows/CE build is requested" >&5
+ echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5
+echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6
# Check whether --enable-wince or --disable-wince was given.
if test "${enable_wince+set}" = set; then
enableval="$enable_wince"
doWince=$enableval
else
doWince=no
-fi
+fi;
+ echo "$as_me:$LINENO: result: $doWince" >&5
+echo "${ECHO_T}$doWince" >&6
- echo "$ac_t""$doWince" 1>&6
+ echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5
+echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6
- echo $ac_n "checking for Windows/CE celib directory""... $ac_c" 1>&6
-echo "configure:1176: checking for Windows/CE celib directory" >&5
- # Check whether --with-celib or --without-celib was given.
+# Check whether --with-celib or --without-celib was given.
if test "${with_celib+set}" = set; then
withval="$with_celib"
CELIB_DIR=$withval
else
CELIB_DIR=NO_CELIB
-fi
-
- echo "$ac_t""$CELIB_DIR" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $CELIB_DIR" >&5
+echo "${ECHO_T}$CELIB_DIR" >&6
# Set some defaults (may get changed below)
EXTRA_CFLAGS=""
# Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1193: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CYGPATH'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CYGPATH+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CYGPATH"; then
ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CYGPATH="cygpath -w"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CYGPATH="cygpath -w"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
fi
fi
-CYGPATH="$ac_cv_prog_CYGPATH"
+CYGPATH=$ac_cv_prog_CYGPATH
if test -n "$CYGPATH"; then
- echo "$ac_t""$CYGPATH" 1>&6
+ echo "$as_me:$LINENO: result: $CYGPATH" >&5
+echo "${ECHO_T}$CYGPATH" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
@@ -1236,13 +3363,20 @@ fi
echo "101 \"name\"" >> $conftest
echo "END" >> $conftest
- echo $ac_n "checking for Windows native path bug in windres""... $ac_c" 1>&6
-echo "configure:1241: checking for Windows native path bug in windres" >&5
+ echo "$as_me:$LINENO: checking for Windows native path bug in windres" >&5
+echo $ECHO_N "checking for Windows native path bug in windres... $ECHO_C" >&6
cyg_conftest=`$CYGPATH $conftest`
- if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then
- echo "$ac_t""no" 1>&6
+ if { ac_try='$RC -o conftest.res.o $cyg_conftest'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } ; then
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
else
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
CYGPATH=echo
fi
conftest=
@@ -1257,13 +3391,14 @@ echo "configure:1241: checking for Windows native path bug in windres" >&5
# set various compiler flags depending on whether we are using gcc or cl
- echo $ac_n "checking compiler flags""... $ac_c" 1>&6
-echo "configure:1262: checking compiler flags" >&5
+ echo "$as_me:$LINENO: checking compiler flags" >&5
+echo $ECHO_N "checking compiler flags... $ECHO_C" >&6
if test "${GCC}" = "yes" ; then
SHLIB_LD=""
SHLIB_LD_LIBS=""
- LIBS=""
- LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32"
+ LIBS="-lws2_32"
+ # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't
+ LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32"
STLIB_LD='${AR} cr'
RC_OUT=-o
RC_TYPE=
@@ -1295,7 +3430,8 @@ echo "configure:1262: checking compiler flags" >&5
if test "${SHARED_BUILD}" = "0" ; then
# static
- echo "$ac_t""using static flags" 1>&6
+ echo "$as_me:$LINENO: result: using static flags" >&5
+echo "${ECHO_T}using static flags" >&6
runtime=
MAKE_DLL="echo "
LIBSUFFIX="s\${DBGX}.a"
@@ -1304,12 +3440,16 @@ echo "configure:1262: checking compiler flags" >&5
EXESUFFIX="s\${DBGX}.exe"
else
# dynamic
- echo "$ac_t""using shared flags" 1>&6
+ echo "$as_me:$LINENO: result: using shared flags" >&5
+echo "${ECHO_T}using shared flags" >&6
# ad-hoc check to see if CC supports -shared.
if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then
- { echo "configure: error: ${CC} does not support the -shared option.
- You will need to upgrade to a newer version of the toolchain." 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: ${CC} does not support the -shared option.
+ You will need to upgrade to a newer version of the toolchain." >&5
+echo "$as_me: error: ${CC} does not support the -shared option.
+ You will need to upgrade to a newer version of the toolchain." >&2;}
+ { (exit 1); exit 1; }; }
fi
runtime=
@@ -1336,7 +3476,7 @@ echo "configure:1262: checking compiler flags" >&5
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -fno-strict-aliasing"
+ CFLAGS_WARNING="-Wall"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -1364,47 +3504,78 @@ echo "configure:1262: checking compiler flags" >&5
case "$do64bit" in
amd64|x64|yes)
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
- echo "$ac_t"" Using 64-bit $MACHINE mode" 1>&6
+ echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
+echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
;;
ia64)
MACHINE="IA64"
- echo "$ac_t"" Using 64-bit $MACHINE mode" 1>&6
+ echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
+echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
;;
*)
- cat > conftest.$ac_ext <<EOF
-#line 1376 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#ifdef _WIN64
#error 64-bit
#endif
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:1387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
tcl_win_64bit=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_win_64bit=yes
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_win_64bit=yes
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test "$tcl_win_64bit" = "yes" ; then
do64bit=amd64
MACHINE="AMD64"
- echo "$ac_t"" Using 64-bit $MACHINE mode" 1>&6
+ echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
+echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
fi
;;
esac
else
if test "${SHARED_BUILD}" = "0" ; then
# static
- echo "$ac_t""using static flags" 1>&6
+ echo "$as_me:$LINENO: result: using static flags" >&5
+echo "${ECHO_T}using static flags" >&6
runtime=-MT
MAKE_DLL="echo "
LIBSUFFIX="s\${DBGX}.lib"
@@ -1414,7 +3585,8 @@ rm -f conftest*
SHLIB_LD_LIBS=""
else
# dynamic
- echo "$ac_t""using shared flags" 1>&6
+ echo "$as_me:$LINENO: result: using shared flags" >&5
+echo "${ECHO_T}using shared flags" >&6
runtime=-MD
# Add SHLIB_LD_LIBS to the Make rule, not here.
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\$@"
@@ -1448,21 +3620,88 @@ rm -f conftest*
;;
esac
if test ! -d "${PATH64}" ; then
- echo "configure: warning: Could not find 64-bit $MACHINE SDK to enable 64bit mode" 1>&2
- echo "configure: warning: Ensure latest Platform SDK is installed" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5
+echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Ensure latest Platform SDK is installed" >&5
+echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;}
do64bit="no"
else
- echo "$ac_t"" Using 64-bit $MACHINE mode" 1>&6
+ echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
+echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
fi
fi
- LIBS="user32.lib advapi32.lib"
+ LIBS="user32.lib advapi32.lib ws2_32.lib"
if test "$do64bit" != "no" ; then
# The space-based-path will work for the Makefile, but will
# not work if AC_TRY_COMPILE is called. TEA has the
# TEA_PATH_NOSPACE to avoid this issue.
- CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
- -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
+ # Check if _WIN64 is already recognized, and if so we don't
+ # need to modify CC.
+ echo "$as_me:$LINENO: checking whether _WIN64 is declared" >&5
+echo $ECHO_N "checking whether _WIN64 is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl__WIN64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef _WIN64
+ char *p = (char *) _WIN64;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl__WIN64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl__WIN64=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl__WIN64" >&5
+echo "${ECHO_T}$ac_cv_have_decl__WIN64" >&6
+if test $ac_cv_have_decl__WIN64 = yes; then
+ :
+else
+ CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
+ -I\"${MSSDK}/Include/crt\" \
+ -I\"${MSSDK}/Include/crt/sys\""
+fi
+
RC="\"${MSSDK}/bin/rc.exe\""
CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
# Do not use -O2 for Win64 - this has proved buggy in code gen.
@@ -1524,11 +3763,15 @@ rm -f conftest*
SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
if test ! -d "${CELIB_DIR}/inc"; then
- { echo "configure: error: Invalid celib directory "${CELIB_DIR}"" 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: Invalid celib directory \"${CELIB_DIR}\"" >&5
+echo "$as_me: error: Invalid celib directory \"${CELIB_DIR}\"" >&2;}
+ { (exit 1); exit 1; }; }
fi
if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\
-o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
- { echo "configure: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5
+echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;}
+ { (exit 1); exit 1; }; }
else
CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
@@ -1550,28 +3793,28 @@ rm -f conftest*
arch=`echo ${ARCH} | awk '{print tolower($0)}'`
defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
for i in $defs ; do
- cat >> confdefs.h <<EOF
+ cat >>confdefs.h <<_ACEOF
#define $i 1
-EOF
+_ACEOF
done
# if test "${ARCH}" = "X86EM"; then
# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION)
# fi
- cat >> confdefs.h <<EOF
+ cat >>confdefs.h <<_ACEOF
#define _WIN32_WCE $CEVERSION
-EOF
+_ACEOF
- cat >> confdefs.h <<EOF
+ cat >>confdefs.h <<_ACEOF
#define UNDER_CE $CEVERSION
-EOF
+_ACEOF
CFLAGS_DEBUG="-nologo -Zi -Od"
CFLAGS_OPTIMIZE="-nologo -O2"
lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
LINKBIN="\"${CEBINROOT}/link.exe\""
-
+
if test "${CEVERSION}" -lt 400 ; then
LIBS="coredll.lib corelibc.lib winsock.lib"
else
@@ -1582,7 +3825,7 @@ EOF
LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\""
LIBS_GUI="commctrl.lib commdlg.lib"
else
- LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib"
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib"
fi
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
@@ -1621,190 +3864,303 @@ EOF
fi
fi
+ if test "$do64bit" != "no" ; then
+ cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_DO64BIT 1
+_ACEOF
+
+ fi
+
# DL_LIBS is empty, but then we match the Unix version
-
-
-
-
+
+
+
+
#--------------------------------------------------------------------
# man2tcl needs this so that it can use errno.h
#--------------------------------------------------------------------
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1637: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
+if test "${ac_cv_header_errno_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for errno.h" >&5
+echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
+if test "${ac_cv_header_errno_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1652 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
+echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
+echo "${ECHO_T}$ac_cv_header_errno_h" >&6
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1669 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1675: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking errno.h usability" >&5
+echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <errno.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1686 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking errno.h presence" >&5
+echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: errno.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: errno.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: errno.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for errno.h" >&5
+echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
+if test "${ac_cv_header_errno_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_errno_h=$ac_header_preproc
fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
+echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
+echo "${ECHO_T}$ac_cv_header_errno_h" >&6
+
fi
- CPP="$ac_cv_prog_CPP"
+if test $ac_cv_header_errno_h = yes; then
+ :
else
- ac_cv_prog_CPP="$CPP"
+ MAN2TCLFLAGS="-DNO_ERRNO_H"
fi
-echo "$ac_t""$CPP" 1>&6
-ac_safe=`echo "errno.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for errno.h""... $ac_c" 1>&6
-echo "configure:1718: checking for errno.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+
+
+#--------------------------------------------------------------------
+# Windows XP theme engine header for Ttk
+#--------------------------------------------------------------------
+
+echo "$as_me:$LINENO: checking for uxtheme.h" >&5
+echo $ECHO_N "checking for uxtheme.h... $ECHO_C" >&6
+if test "${ac_cv_header_uxtheme_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1723 "configure"
-#include "confdefs.h"
-#include <errno.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <windows.h>
+
+#include <uxtheme.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_uxtheme_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_uxtheme_h=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
+echo "$as_me:$LINENO: result: $ac_cv_header_uxtheme_h" >&5
+echo "${ECHO_T}$ac_cv_header_uxtheme_h" >&6
+if test $ac_cv_header_uxtheme_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_UXTHEME_H 1
+_ACEOF
+
else
- echo "$ac_t""no" 1>&6
-MAN2TCLFLAGS="-DNO_ERRNO_H"
+ { echo "$as_me:$LINENO: xpnative theme will be unavailable" >&5
+echo "$as_me: xpnative theme will be unavailable" >&6;}
fi
#--------------------------------------------------------------------
-# Set the default compiler switches based on the --enable-symbols
+# Set the default compiler switches based on the --enable-symbols
# option. This macro depends on C flags, and should be called
# after SC_CONFIG_CFLAGS macro is called.
#--------------------------------------------------------------------
- echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:1760: checking for build with symbols" >&5
+ echo "$as_me:$LINENO: checking for build with symbols" >&5
+echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6
# Check whether --enable-symbols or --disable-symbols was given.
if test "${enable_symbols+set}" = set; then
enableval="$enable_symbols"
tcl_ok=$enableval
else
tcl_ok=no
-fi
-
+fi;
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
DBGX=""
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+ cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_OPTIMIZED 1
+_ACEOF
+
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
DBGX=g
if test "$tcl_ok" = "yes"; then
- echo "$ac_t""yes (standard debugging)" 1>&6
+ echo "$as_me:$LINENO: result: yes (standard debugging)" >&5
+echo "${ECHO_T}yes (standard debugging)" >&6
fi
fi
-
-
+
+
+ cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_DEBUG 1
+_ACEOF
+
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define TCL_MEM_DEBUG 1
-EOF
+_ACEOF
fi
if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define TCL_COMPILE_DEBUG 1
-EOF
+_ACEOF
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define TCL_COMPILE_STATS 1
-EOF
+_ACEOF
fi
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- echo "$ac_t""enabled symbols mem compile debugging" 1>&6
+ echo "$as_me:$LINENO: result: enabled symbols mem compile debugging" >&5
+echo "${ECHO_T}enabled symbols mem compile debugging" >&6
else
- echo "$ac_t""enabled $tcl_ok debugging" 1>&6
+ echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
+echo "${ECHO_T}enabled $tcl_ok debugging" >&6
fi
fi
@@ -1816,53 +4172,58 @@ TK_DBGX=${DBGX}
#--------------------------------------------------------------------
- echo $ac_n "checking whether to embed manifest""... $ac_c" 1>&6
-echo "configure:1821: checking whether to embed manifest" >&5
+ echo "$as_me:$LINENO: checking whether to embed manifest" >&5
+echo $ECHO_N "checking whether to embed manifest... $ECHO_C" >&6
# Check whether --enable-embedded-manifest or --disable-embedded-manifest was given.
if test "${enable_embedded_manifest+set}" = set; then
enableval="$enable_embedded_manifest"
embed_ok=$enableval
else
embed_ok=yes
-fi
-
+fi;
- VC_MANIFEST_EMBED_DLL=
- VC_MANIFEST_EMBED_EXE=
+ VC_MANIFEST_EMBED_DLL=
+ VC_MANIFEST_EMBED_EXE=
result=no
if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \
-a "$GCC" != "yes" ; then
# Add the magic to embed the manifest into the dll/exe
- cat > conftest.$ac_ext <<EOF
-#line 1838 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if defined(_MSC_VER) && _MSC_VER >= 1400
print("manifest needed")
#endif
-
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "manifest needed" >/dev/null 2>&1; then
- rm -rf conftest*
-
+ $EGREP "manifest needed" >/dev/null 2>&1; then
+
# Could do a CHECK_PROG for mt, but should always be with MSVC8+
# Could add 'if test -f' check, but manifest should be created
# in this compiler case
- VC_MANIFEST_EMBED_DLL="mt.exe -nologo -manifest \$@.manifest wish.exe.manifest -outputresource:\$@\;2"
- VC_MANIFEST_EMBED_EXE="mt.exe -nologo -manifest \$@.manifest wish.exe.manifest -outputresource:\$@\;1"
+ # Add in a manifest argument that may be specified
+ # XXX Needs improvement so that the test for existence accounts
+ # XXX for a provided (known) manifest
+ VC_MANIFEST_EMBED_DLL="if test -f \$@.manifest ; then mt.exe -nologo -manifest \$@.manifest wish.exe.manifest -outputresource:\$@\;2 ; fi"
+ VC_MANIFEST_EMBED_EXE="if test -f \$@.manifest ; then mt.exe -nologo -manifest \$@.manifest wish.exe.manifest -outputresource:\$@\;1 ; fi"
result=yes
if test "xwish.exe.manifest" != x ; then
result="yes (wish.exe.manifest)"
fi
-
+
fi
rm -f conftest*
fi
- echo "$ac_t""$result" 1>&6
-
-
+ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6
+
+
#--------------------------------------------------------------------
@@ -1870,42 +4231,49 @@ rm -f conftest*
#--------------------------------------------------------------------
- echo $ac_n "checking the location of tclConfig.sh""... $ac_c" 1>&6
-echo "configure:1875: checking the location of tclConfig.sh" >&5
+ echo "$as_me:$LINENO: checking the location of tclConfig.sh" >&5
+echo $ECHO_N "checking the location of tclConfig.sh... $ECHO_C" >&6
- if test -d ../../tcl8.4$TK_PATCH_LEVEL/win; then
- TCL_BIN_DIR_DEFAULT=../../tcl8.4$TK_PATCH_LEVEL/win
- elif test -d ../../tcl8.4/win; then
- TCL_BIN_DIR_DEFAULT=../../tcl8.4/win
+ if test -d ../../tcl8.5$TK_PATCH_LEVEL/win; then
+ TCL_BIN_DIR_DEFAULT=../../tcl8.5$TK_PATCH_LEVEL/win
+ elif test -d ../../tcl8.5/win; then
+ TCL_BIN_DIR_DEFAULT=../../tcl8.5/win
else
TCL_BIN_DIR_DEFAULT=../../tcl/win
fi
- # Check whether --with-tcl or --without-tcl was given.
+
+# Check whether --with-tcl or --without-tcl was given.
if test "${with_tcl+set}" = set; then
withval="$with_tcl"
TCL_BIN_DIR=$withval
else
TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`
-fi
-
+fi;
if test ! -d $TCL_BIN_DIR; then
- { echo "configure: error: Tcl directory $TCL_BIN_DIR does not exist" 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: Tcl directory $TCL_BIN_DIR does not exist" >&5
+echo "$as_me: error: Tcl directory $TCL_BIN_DIR does not exist" >&2;}
+ { (exit 1); exit 1; }; }
fi
if test ! -f $TCL_BIN_DIR/tclConfig.sh; then
- { echo "configure: error: There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?" 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?" >&5
+echo "$as_me: error: There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?" >&2;}
+ { (exit 1); exit 1; }; }
fi
- echo "$ac_t""$TCL_BIN_DIR/tclConfig.sh" 1>&6
+ echo "$as_me:$LINENO: result: $TCL_BIN_DIR/tclConfig.sh" >&5
+echo "${ECHO_T}$TCL_BIN_DIR/tclConfig.sh" >&6
- echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6
-echo "configure:1903: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
+ echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
+echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6
if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
- echo "$ac_t""loading" 1>&6
+ echo "$as_me:$LINENO: result: loading" >&5
+echo "${ECHO_T}loading" >&6
. $TCL_BIN_DIR/tclConfig.sh
else
- echo "$ac_t""file not found" 1>&6
+ echo "$as_me:$LINENO: result: file not found" >&5
+echo "${ECHO_T}file not found" >&6
fi
#
@@ -1935,36 +4303,37 @@ echo "configure:1903: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-
-
-
-
-
-
-
-
-
-
- echo $ac_n "checking for tclsh in Tcl build directory""... $ac_c" 1>&6
-echo "configure:1956: checking for tclsh in Tcl build directory" >&5
+
+
+
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking for tclsh in Tcl build directory" >&5
+echo $ECHO_N "checking for tclsh in Tcl build directory... $ECHO_C" >&6
BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}
- echo "$ac_t""$BUILD_TCLSH" 1>&6
-
+ echo "$as_me:$LINENO: result: $BUILD_TCLSH" >&5
+echo "${ECHO_T}$BUILD_TCLSH" >&6
+
- echo $ac_n "checking for tclsh""... $ac_c" 1>&6
-echo "configure:1963: checking for tclsh" >&5
+ echo "$as_me:$LINENO: checking for tclsh" >&5
+echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
- if eval "test \"`echo '$''{'ac_cv_path_tclsh'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ if test "${ac_cv_path_tclsh+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
for j in `ls -r $dir/tclsh[8-9]*.exe 2> /dev/null` \
@@ -1977,19 +4346,21 @@ else
fi
done
done
-
+
fi
if test -f "$ac_cv_path_tclsh" ; then
TCLSH_PROG="$ac_cv_path_tclsh"
- echo "$ac_t""$TCLSH_PROG" 1>&6
+ echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
+echo "${ECHO_T}$TCLSH_PROG" >&6
else
# It is not an error if an installed version of Tcl can't be located.
TCLSH_PROG=""
- echo "$ac_t""No tclsh found on PATH" 1>&6
+ echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5
+echo "${ECHO_T}No tclsh found on PATH" >&6
fi
-
+
#------------------------------------------------------------------------
@@ -2057,12 +4428,14 @@ else
fi
# The wish.exe.manifest requires these
-# TK_WIN_VERSION is the 4 dotted pair Windows version format
+# TK_WIN_VERSION is the 4 dotted pair Windows version format which needs
+# the release level, and must account for interim release versioning
case "$TK_PATCH_LEVEL" in
- a*) TK_WIN_VERSION="$TK_VERSION.0.`echo $TK_PATCH_LEVEL | tr -d a`" ;;
- b*) TK_WIN_VERSION="$TK_VERSION.1.`echo $TK_PATCH_LEVEL | tr -d b`" ;;
- .*) TK_WIN_VERSION="$TK_VERSION.2$TK_PATCH_LEVEL" ;;
+ *a*) TK_RELEASE_LEVEL=0 ;;
+ *b*) TK_RELEASE_LEVEL=1 ;;
+ *) TK_RELEASE_LEVEL=2 ;;
esac
+TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`"
# X86|AMD64|IA64 for manifest
@@ -2137,358 +4510,1010 @@ esac
-
-
-
-
-
# undefined at this point for win
-trap '' 1 2 15
-cat > confcache <<\EOF
+ ac_config_files="$ac_config_files Makefile tkConfig.sh wish.exe.manifest"
+cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
#
-EOF
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
fi
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
done
-ac_given_srcdir=$srcdir
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
-trap 'rm -fr `echo "Makefile tkConfig.sh wish.exe.manifest" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@RC@%$RC%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@OBJEXT@%$OBJEXT%g
-s%@EXEEXT@%$EXEEXT%g
-s%@TCL_THREADS@%$TCL_THREADS%g
-s%@CYGPATH@%$CYGPATH%g
-s%@CELIB_DIR@%$CELIB_DIR%g
-s%@DL_LIBS@%$DL_LIBS%g
-s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
-s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
-s%@CFLAGS_WARNING@%$CFLAGS_WARNING%g
-s%@CPP@%$CPP%g
-s%@MAN2TCLFLAGS@%$MAN2TCLFLAGS%g
-s%@CFLAGS_DEFAULT@%$CFLAGS_DEFAULT%g
-s%@LDFLAGS_DEFAULT@%$LDFLAGS_DEFAULT%g
-s%@VC_MANIFEST_EMBED_DLL@%$VC_MANIFEST_EMBED_DLL%g
-s%@VC_MANIFEST_EMBED_EXE@%$VC_MANIFEST_EMBED_EXE%g
-s%@TCL_VERSION@%$TCL_VERSION%g
-s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g
-s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g
-s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g
-s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
-s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
-s%@TCL_STUB_LIB_FILE@%$TCL_STUB_LIB_FILE%g
-s%@TCL_STUB_LIB_FLAG@%$TCL_STUB_LIB_FLAG%g
-s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
-s%@TCL_DEFS@%$TCL_DEFS%g
-s%@BUILD_TCLSH@%$BUILD_TCLSH%g
-s%@TCLSH_PROG@%$TCLSH_PROG%g
-s%@TK_WIN_VERSION@%$TK_WIN_VERSION%g
-s%@MACHINE@%$MACHINE%g
-s%@TK_VERSION@%$TK_VERSION%g
-s%@TK_MAJOR_VERSION@%$TK_MAJOR_VERSION%g
-s%@TK_MINOR_VERSION@%$TK_MINOR_VERSION%g
-s%@TK_PATCH_LEVEL@%$TK_PATCH_LEVEL%g
-s%@TK_DBGX@%$TK_DBGX%g
-s%@TK_LIB_FILE@%$TK_LIB_FILE%g
-s%@TK_DLL_FILE@%$TK_DLL_FILE%g
-s%@TK_STUB_LIB_FILE@%$TK_STUB_LIB_FILE%g
-s%@TK_STUB_LIB_FLAG@%$TK_STUB_LIB_FLAG%g
-s%@TK_BUILD_STUB_LIB_SPEC@%$TK_BUILD_STUB_LIB_SPEC%g
-s%@TK_SRC_DIR@%$TK_SRC_DIR%g
-s%@TK_BIN_DIR@%$TK_BIN_DIR%g
-s%@TCL_MAJOR_VERSION@%$TCL_MAJOR_VERSION%g
-s%@TCL_MINOR_VERSION@%$TCL_MINOR_VERSION%g
-s%@TCL_PATCH_LEVEL@%$TCL_PATCH_LEVEL%g
-s%@TCL_DLL_FILE@%$TCL_DLL_FILE%g
-s%@TCL_BUILD_STUB_LIB_SPEC@%$TCL_BUILD_STUB_LIB_SPEC%g
-s%@TCL_DBGX@%$TCL_DBGX%g
-s%@CFG_TK_SHARED_LIB_SUFFIX@%$CFG_TK_SHARED_LIB_SUFFIX%g
-s%@CFG_TK_UNSHARED_LIB_SUFFIX@%$CFG_TK_UNSHARED_LIB_SUFFIX%g
-s%@CFG_TK_EXPORT_FILE_SUFFIX@%$CFG_TK_EXPORT_FILE_SUFFIX%g
-s%@TK_SHARED_BUILD@%$TK_SHARED_BUILD%g
-s%@DEPARG@%$DEPARG%g
-s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g
-s%@STLIB_LD@%$STLIB_LD%g
-s%@SHLIB_LD@%$SHLIB_LD%g
-s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g
-s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
-s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
-s%@CC_OBJNAME@%$CC_OBJNAME%g
-s%@CC_EXENAME@%$CC_EXENAME%g
-s%@LDFLAGS_DEBUG@%$LDFLAGS_DEBUG%g
-s%@LDFLAGS_OPTIMIZE@%$LDFLAGS_OPTIMIZE%g
-s%@LDFLAGS_CONSOLE@%$LDFLAGS_CONSOLE%g
-s%@LDFLAGS_WINDOW@%$LDFLAGS_WINDOW%g
-s%@RC_OUT@%$RC_OUT%g
-s%@RC_TYPE@%$RC_TYPE%g
-s%@RC_INCLUDE@%$RC_INCLUDE%g
-s%@RC_DEFINE@%$RC_DEFINE%g
-s%@RC_DEFINES@%$RC_DEFINES%g
-s%@TK_RES@%$TK_RES%g
-s%@RES@%$RES%g
-s%@LIBS_GUI@%$LIBS_GUI%g
-s%@DLLSUFFIX@%$DLLSUFFIX%g
-s%@LIBPREFIX@%$LIBPREFIX%g
-s%@LIBSUFFIX@%$LIBSUFFIX%g
-s%@EXESUFFIX@%$EXESUFFIX%g
-s%@LIBRARIES@%$LIBRARIES%g
-s%@MAKE_LIB@%$MAKE_LIB%g
-s%@POST_MAKE_LIB@%$POST_MAKE_LIB%g
-s%@MAKE_DLL@%$MAKE_DLL%g
-s%@MAKE_EXE@%$MAKE_EXE%g
-s%@TK_LIB_FLAG@%$TK_LIB_FLAG%g
-s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g
-s%@TK_BUILD_LIB_SPEC@%$TK_BUILD_LIB_SPEC%g
-s%@TK_STUB_LIB_SPEC@%$TK_STUB_LIB_SPEC%g
-s%@TK_STUB_LIB_PATH@%$TK_STUB_LIB_PATH%g
-s%@TK_BUILD_STUB_LIB_PATH@%$TK_BUILD_STUB_LIB_PATH%g
-s%@TK_CC_SEARCH_FLAGS@%$TK_CC_SEARCH_FLAGS%g
-s%@TK_LD_SEARCH_FLAGS@%$TK_LD_SEARCH_FLAGS%g
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ PATH_SEPARATOR=:
fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ as_ln_s='ln -s'
fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
-EOF
-cat >> $CONFIG_STATUS <<EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
-CONFIG_FILES=\${CONFIG_FILES-"Makefile tkConfig.sh wish.exe.manifest"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "tkConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tkConfig.sh" ;;
+ "wish.exe.manifest" ) CONFIG_FILES="$CONFIG_FILES wish.exe.manifest" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
esac
+done
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@RC@,$RC,;t t
+s,@ac_ct_RC@,$ac_ct_RC,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@TCL_THREADS@,$TCL_THREADS,;t t
+s,@CYGPATH@,$CYGPATH,;t t
+s,@CELIB_DIR@,$CELIB_DIR,;t t
+s,@DL_LIBS@,$DL_LIBS,;t t
+s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t
+s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t
+s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t
+s,@MAN2TCLFLAGS@,$MAN2TCLFLAGS,;t t
+s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t
+s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t
+s,@VC_MANIFEST_EMBED_DLL@,$VC_MANIFEST_EMBED_DLL,;t t
+s,@VC_MANIFEST_EMBED_EXE@,$VC_MANIFEST_EMBED_EXE,;t t
+s,@TCL_VERSION@,$TCL_VERSION,;t t
+s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t
+s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t
+s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t
+s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t
+s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t
+s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t
+s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t
+s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t
+s,@TCL_DEFS@,$TCL_DEFS,;t t
+s,@BUILD_TCLSH@,$BUILD_TCLSH,;t t
+s,@TCLSH_PROG@,$TCLSH_PROG,;t t
+s,@TK_WIN_VERSION@,$TK_WIN_VERSION,;t t
+s,@MACHINE@,$MACHINE,;t t
+s,@TK_VERSION@,$TK_VERSION,;t t
+s,@TK_MAJOR_VERSION@,$TK_MAJOR_VERSION,;t t
+s,@TK_MINOR_VERSION@,$TK_MINOR_VERSION,;t t
+s,@TK_PATCH_LEVEL@,$TK_PATCH_LEVEL,;t t
+s,@TK_DBGX@,$TK_DBGX,;t t
+s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t
+s,@TK_DLL_FILE@,$TK_DLL_FILE,;t t
+s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t
+s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t
+s,@TK_BUILD_STUB_LIB_SPEC@,$TK_BUILD_STUB_LIB_SPEC,;t t
+s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t
+s,@TK_BIN_DIR@,$TK_BIN_DIR,;t t
+s,@TCL_MAJOR_VERSION@,$TCL_MAJOR_VERSION,;t t
+s,@TCL_MINOR_VERSION@,$TCL_MINOR_VERSION,;t t
+s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t
+s,@TCL_DBGX@,$TCL_DBGX,;t t
+s,@CFG_TK_SHARED_LIB_SUFFIX@,$CFG_TK_SHARED_LIB_SUFFIX,;t t
+s,@CFG_TK_UNSHARED_LIB_SUFFIX@,$CFG_TK_UNSHARED_LIB_SUFFIX,;t t
+s,@CFG_TK_EXPORT_FILE_SUFFIX@,$CFG_TK_EXPORT_FILE_SUFFIX,;t t
+s,@TK_SHARED_BUILD@,$TK_SHARED_BUILD,;t t
+s,@DEPARG@,$DEPARG,;t t
+s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t
+s,@STLIB_LD@,$STLIB_LD,;t t
+s,@SHLIB_LD@,$SHLIB_LD,;t t
+s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t
+s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t
+s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t
+s,@CC_OBJNAME@,$CC_OBJNAME,;t t
+s,@CC_EXENAME@,$CC_EXENAME,;t t
+s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t
+s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t
+s,@LDFLAGS_CONSOLE@,$LDFLAGS_CONSOLE,;t t
+s,@LDFLAGS_WINDOW@,$LDFLAGS_WINDOW,;t t
+s,@RC_OUT@,$RC_OUT,;t t
+s,@RC_TYPE@,$RC_TYPE,;t t
+s,@RC_INCLUDE@,$RC_INCLUDE,;t t
+s,@RC_DEFINE@,$RC_DEFINE,;t t
+s,@RC_DEFINES@,$RC_DEFINES,;t t
+s,@TK_RES@,$TK_RES,;t t
+s,@RES@,$RES,;t t
+s,@LIBS_GUI@,$LIBS_GUI,;t t
+s,@DLLSUFFIX@,$DLLSUFFIX,;t t
+s,@LIBPREFIX@,$LIBPREFIX,;t t
+s,@LIBSUFFIX@,$LIBSUFFIX,;t t
+s,@EXESUFFIX@,$EXESUFFIX,;t t
+s,@LIBRARIES@,$LIBRARIES,;t t
+s,@MAKE_LIB@,$MAKE_LIB,;t t
+s,@POST_MAKE_LIB@,$POST_MAKE_LIB,;t t
+s,@MAKE_DLL@,$MAKE_DLL,;t t
+s,@MAKE_EXE@,$MAKE_EXE,;t t
+s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t
+s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t
+s,@TK_BUILD_LIB_SPEC@,$TK_BUILD_LIB_SPEC,;t t
+s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t
+s,@TK_STUB_LIB_PATH@,$TK_STUB_LIB_PATH,;t t
+s,@TK_BUILD_STUB_LIB_PATH@,$TK_BUILD_STUB_LIB_PATH,;t t
+s,@TK_CC_SEARCH_FLAGS@,$TK_CC_SEARCH_FLAGS,;t t
+s,@TK_LD_SEARCH_FLAGS@,$TK_LD_SEARCH_FLAGS,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
fi
+fi # test -n "$CONFIG_FILES"
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-EOF
-cat >> $CONFIG_STATUS <<EOF
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
-EOF
-cat >> $CONFIG_STATUS <<\EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
-exit 0
-EOF
+{ (exit 0); exit 0; }
+_ACEOF
chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
diff --git a/win/configure.in b/win/configure.in
index f7b0f33..a8e1012 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -4,12 +4,17 @@
# to configure the system for the local environment.
AC_INIT(../generic/tk.h)
-AC_PREREQ(2.13)
+AC_PREREQ(2.59)
-TK_VERSION=8.4
+# The following define is needed when building with Cygwin since newer
+# versions of autoconf incorrectly set SHELL to /bin/bash instead of
+# /bin/sh. The bash shell seems to suffer from some strange failures.
+SHELL=/bin/sh
+
+TK_VERSION=8.5
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=4
-TK_PATCH_LEVEL=".19"
+TK_MINOR_VERSION=5
+TK_PATCH_LEVEL=".11"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -36,35 +41,15 @@ if test "${CFLAGS+set}" != "set" ; then
fi
AC_PROG_CC
+AC_C_INLINE
+AC_HEADER_STDC
-# To properly support cross-compilation, one would
-# need to use these tool checks instead of
-# the ones below and reconfigure with
-# autoconf 2.50. You can also just set
-# the CC, AR, RANLIB, and RC environment
-# variables if you want to cross compile.
-#AC_CHECK_TOOL(AR, ar)
-#AC_CHECK_TOOL(RANLIB, ranlib)
-#AC_CHECK_TOOL(RC, windres)
-
-if test "${GCC}" = "yes" ; then
- AC_CHECK_PROG(AR, ar, ar)
- AC_CHECK_PROG(RANLIB, ranlib, ranlib)
- AC_CHECK_PROG(RC, windres, windres)
-
- if test "${AR}" = "" ; then
- AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
- fi
- if test "${RANLIB}" = "" ; then
- AC_MSG_ERROR([Required archive index tool 'ranlib' not found on PATH.])
- fi
- if test "${RC}" = "" ; then
- AC_MSG_ERROR([Required resource tool 'windres' not found on PATH.])
- fi
-fi
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib)
+AC_CHECK_TOOL(RC, windres)
#--------------------------------------------------------------------
-# Checks to see if the make progeam sets the $MAKE variable.
+# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------
AC_PROG_MAKE_SET
@@ -73,7 +58,27 @@ AC_PROG_MAKE_SET
# Perform additinal compiler tests.
#--------------------------------------------------------------------
-AC_CYGWIN
+dnl Currently AC_CYGWIN is disabled since it invokes AC_CANONICAL_HOST
+dnl under autoconf 2.5X.
+dnl
+dnl AC_CYGWIN
+
+AC_CACHE_CHECK(for Cygwin version of gcc,
+ ac_cv_cygwin,
+AC_TRY_COMPILE([
+#ifdef __CYGWIN__
+#error cygwin
+#endif
+],
+[],
+ ac_cv_cygwin=no,
+ ac_cv_cygwin=yes)
+)
+if test "$ac_cv_cygwin" = "yes" ; then
+ AC_MSG_ERROR([Compiling under Cygwin is not currently supported.
+A maintainer for the Cygwin port of Tcl/Tk is needed. See the README
+file for information about building with Mingw.])
+fi
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
@@ -111,7 +116,15 @@ AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H")
AC_SUBST(MAN2TCLFLAGS)
#--------------------------------------------------------------------
-# Set the default compiler switches based on the --enable-symbols
+# Windows XP theme engine header for Ttk
+#--------------------------------------------------------------------
+
+AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H)],
+ [AC_MSG_NOTICE([xpnative theme will be unavailable])],
+ [#include <windows.h>])
+
+#--------------------------------------------------------------------
+# Set the default compiler switches based on the --enable-symbols
# option. This macro depends on C flags, and should be called
# after SC_CONFIG_CFLAGS macro is called.
#--------------------------------------------------------------------
@@ -201,12 +214,14 @@ else
fi
# The wish.exe.manifest requires these
-# TK_WIN_VERSION is the 4 dotted pair Windows version format
+# TK_WIN_VERSION is the 4 dotted pair Windows version format which needs
+# the release level, and must account for interim release versioning
case "$TK_PATCH_LEVEL" in
- a*) TK_WIN_VERSION="$TK_VERSION.0.`echo $TK_PATCH_LEVEL | tr -d a`" ;;
- b*) TK_WIN_VERSION="$TK_VERSION.1.`echo $TK_PATCH_LEVEL | tr -d b`" ;;
- .*) TK_WIN_VERSION="$TK_VERSION.2$TK_PATCH_LEVEL" ;;
+ *a*) TK_RELEASE_LEVEL=0 ;;
+ *b*) TK_RELEASE_LEVEL=1 ;;
+ *) TK_RELEASE_LEVEL=2 ;;
esac
+TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`"
AC_SUBST(TK_WIN_VERSION)
# X86|AMD64|IA64 for manifest
AC_SUBST(MACHINE)
@@ -228,11 +243,6 @@ AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_MAJOR_VERSION)
AC_SUBST(TCL_MINOR_VERSION)
AC_SUBST(TCL_PATCH_LEVEL)
-AC_SUBST(TCL_LIB_FILE)
-AC_SUBST(TCL_DLL_FILE)
-AC_SUBST(TCL_STUB_LIB_FILE)
-AC_SUBST(TCL_STUB_LIB_FLAG)
-AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_DBGX)
diff --git a/win/makefile.bc b/win/makefile.bc
index b62b1a4..12fd5b8 100644
--- a/win/makefile.bc
+++ b/win/makefile.bc
@@ -116,6 +116,7 @@ TKTESTOBJS = \
$(TMPDIR)\tkTest.obj \
$(TMPDIR)\tkSquare.obj \
$(TMPDIR)\testMain.obj \
+ $(TMPDIR)\tkOldTest.obj \
$(TMPDIR)\tkWinTest.obj \
$(TCLLIBDIR)\tclThreadTest.obj
@@ -229,7 +230,7 @@ TKOBJS = \
# Maintenance hint: Please have multiple members of TKSTUBOBJS be separated
# by exactly one ' ' (see below the rule for making TKSTUBLIB)
-TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj $(TMPDIR)\tkStubImg.obj
+TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj
WINDIR = $(ROOT)\win
GENERICDIR = $(ROOT)\generic
@@ -239,9 +240,9 @@ TCLLIBDIR = $(TCLDIR)\win\$(OUTDIRNAME)
RCDIR = $(WINDIR)\rc
TK_INCLUDES = -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
- -I$(TCLDIR)\generic
+ -I$(TCLDIR)\generic -I$(TCLDIR)\win
-TK_DEFINES = -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES)
+TK_DEFINES = -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES) SUPPORT_CONFIG_EMBEDDED
######################################################################
# Compile flags
@@ -447,6 +448,9 @@ $(TMPDIR)\testMain.obj: $(WINDIR)\winMain.c
$(TMPDIR)\tkTest.obj: $(GENERICDIR)\tkTest.c
$(cc32) $(WISH_CFLAGS) -o$@ $?
+$(TMPDIR)\tkOldTest.obj: $(GENERICDIR)\tkOldTest.c
+ $(cc32) $(WISH_CFLAGS) -o$@ $?
+
$(TMPDIR)\tkWinTest.obj: $(WINDIR)\tkWinTest.c
$(cc32) $(WISH_CFLAGS) -o$@ $?
diff --git a/win/makefile.vc b/win/makefile.vc
index 32dd4d5..89dbe30 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -9,7 +9,7 @@
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
# Copyright (c) 2001-2005 ActiveState Corporation.
-# Copyright (c) 2001-2002 David Gravereaux.
+# Copyright (c) 2001-2004 David Gravereaux.
#------------------------------------------------------------------------------
# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
@@ -71,25 +71,32 @@ the build instructions.
# Sets where to install Tcl from the built binaries.
# C:\Progra~1\Tcl is assumed when not specified.
#
-# OPTS=static,msvcrt,linkexten,threads,symbols,profile,none
+# OPTS=static,msvcrt,linkexten,threads,symbols,profile,unchecked,none
# Sets special options for the core. The default is for none.
# Any combination of the above may be used (comma separated).
# 'none' will over-ride everything to nothing.
#
-# static = Builds a static library of the core instead of a
+# static = Builds a static library of the core instead of a
# dll. The shell will be static (and large), as well.
-# msvcrt = Effects the static option only to switch it from
+# msvcrt = Effects the static option only to switch it from
# using libcmt(d) as the C runtime [by default] to
# msvcrt(d). This is useful for static embedding
# support.
-# staticpkg = Affects the static option only to switch wishXX.exe
+# staticpkg= Affects the static option only to switch wishXX.exe
# to have the dde and reg extension linked inside it.
-# threads = Turns on full multithreading support.
-# thrdalloc = Use the thread allocator (shared global free pool).
-# symbols = Adds symbols for step debugging.
-# profile = Adds profiling hooks. Map file is assumed.
-# loimpact = Adds a flag for how NT treats the heap to keep memory
-# in use, low. This is said to impact alloc performance.
+# threads = Turns on full multithreading support.
+# thrdalloc= Use the thread allocator (shared global free pool).
+# symbols = Adds symbols for step debugging.
+# profile = Adds profiling hooks. Map file is assumed.
+# loimpact = Adds a flag for how NT treats the heap to keep
+# memory in use, low. This is said to impact alloc
+# performance.
+# unchecked= Allows a symbols build to not use the debug
+# enabled runtime (msvcrt.dll not msvcrtd.dll
+# or libcmt.lib not libcmtd.lib).
+# noxp = If you do not have the uxtheme.h header then you
+# cannot include support for XP themeing.
+# square = Include the demo square widget.
#
# STATS=memdbg,compdbg,none
# Sets optional memory and bytecode compiler debugging code added
@@ -100,6 +107,14 @@ the build instructions.
# memdbg = Enables the debugging memory allocator.
# compdbg = Enables byte compilation logging.
#
+# CHECKS=nodep,fullwarn,none
+# Sets special macros for checking compatability.
+#
+# nodep = Turns off compatability macros to ensure Tk isn't
+# being built with deprecated functions.
+# fullwarn = Builds with full compiler and link warnings enabled.
+# Very verbose.
+#
# MACHINE=(IX86|IA64|AMD64|ALPHA)
# Set the machine type used for the compiler, linker, and
# resource compiler. This hook is needed to tell the tools
@@ -166,9 +181,26 @@ PROJECT = tk
!message *** Tcl sources.
!endif
+# Extra makefile options processing...
+!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
+HAVE_UXTHEME_H = 1
+TTK_SQUARE_WIDGET = 0
+!else
+!if [nmakehlp -f $(OPTS) "noxp"]
+!message *** Exclude support for XP theme
+HAVE_UXTHEME_H = 0
+!else
+HAVE_UXTHEME_H = 1
+!endif
+!if [nmakehlp -f "$(OPTS)" "square"]
+!message *** Include ttk square demo widget
+TTK_SQUARE_WIDGET = 1
+!else
+TTK_SQUARE_WIDGET = 0
+!endif
+!endif
+
STUBPREFIX = $(PROJECT)stub
-DOTVERSION = 8.4
-VERSION = $(DOTVERSION:.=)
WISHNAMEPREFIX = wish
BINROOT = .
@@ -176,15 +208,15 @@ ROOT = ..
TK_LIBRARY = $(ROOT)\library
-TKIMPLIB = "$(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib"
-TKLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
+TKIMPLIB = "$(OUT_DIR)\$(PROJECT)$(TK_VERSION)$(SUFX).lib"
+TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
TKLIB = "$(OUT_DIR)\$(TKLIBNAME)"
-TKSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
+TKSTUBLIBNAME = $(STUBPREFIX)$(TK_VERSION).lib
TKSTUBLIB = "$(OUT_DIR)\$(TKSTUBLIBNAME)"
-WISH = "$(OUT_DIR)\$(WISHNAMEPREFIX)$(VERSION)$(SUFX).exe"
-WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe"
+WISH = "$(OUT_DIR)\$(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe"
+WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(TK_VERSION)$(SUFX).exe"
TKTEST = "$(OUT_DIR)\$(PROJECT)test.exe"
CAT32 = "$(OUT_DIR)\cat32.exe"
@@ -192,7 +224,7 @@ CAT32 = "$(OUT_DIR)\cat32.exe"
LIB_INSTALL_DIR = $(_INSTALLDIR)\lib
BIN_INSTALL_DIR = $(_INSTALLDIR)\bin
DOC_INSTALL_DIR = $(_INSTALLDIR)\doc
-SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(DOTVERSION)
+SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_DOTVERSION)
INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include
WISHOBJS = \
@@ -204,11 +236,11 @@ WISHOBJS = \
$(TMP_DIR)\wish.res
TKTESTOBJS = \
- $(TMP_DIR)\tkTest.obj \
- $(TMP_DIR)\tkSquare.obj \
$(TMP_DIR)\testMain.obj \
- $(TMP_DIR)\tkWinTest.obj \
- $(TMP_DIR)\wish.res
+ $(TMP_DIR)\tkSquare.obj \
+ $(TMP_DIR)\tkTest.obj \
+ $(TMP_DIR)\tkOldTest.obj \
+ $(TMP_DIR)\tkWinTest.obj
XLIBOBJS = \
$(TMP_DIR)\xcolors.obj \
@@ -242,6 +274,7 @@ TKOBJS = \
$(TMP_DIR)\tkWinRegion.obj \
$(TMP_DIR)\tkWinScrlbr.obj \
$(TMP_DIR)\tkWinSend.obj \
+ $(TMP_DIR)\tkWinSendCom.obj \
$(TMP_DIR)\tkWinWindow.obj \
$(TMP_DIR)\tkWinWm.obj \
$(TMP_DIR)\tkWinX.obj \
@@ -319,32 +352,73 @@ TKOBJS = \
$(TMP_DIR)\tkStubInit.obj \
$(TMP_DIR)\tkStubLib.obj \
$(TMP_DIR)\tkWindow.obj \
+ $(TTK_OBJS) \
!if !$(STATIC_BUILD)
$(TMP_DIR)\tk.res
!endif
+TTK_OBJS = \
+ $(TMP_DIR)\ttkWinMonitor.obj \
+ $(TMP_DIR)\ttkWinTheme.obj \
+ $(TMP_DIR)\ttkWinXPTheme.obj \
+ $(TMP_DIR)\ttkBlink.obj \
+ $(TMP_DIR)\ttkButton.obj \
+ $(TMP_DIR)\ttkCache.obj \
+ $(TMP_DIR)\ttkClamTheme.obj \
+ $(TMP_DIR)\ttkClassicTheme.obj \
+ $(TMP_DIR)\ttkDefaultTheme.obj \
+ $(TMP_DIR)\ttkElements.obj \
+ $(TMP_DIR)\ttkEntry.obj \
+ $(TMP_DIR)\ttkFrame.obj \
+ $(TMP_DIR)\ttkImage.obj \
+ $(TMP_DIR)\ttkInit.obj \
+ $(TMP_DIR)\ttkLabel.obj \
+ $(TMP_DIR)\ttkLayout.obj \
+ $(TMP_DIR)\ttkManager.obj \
+ $(TMP_DIR)\ttkNotebook.obj \
+ $(TMP_DIR)\ttkPanedwindow.obj \
+ $(TMP_DIR)\ttkProgress.obj \
+ $(TMP_DIR)\ttkScale.obj \
+ $(TMP_DIR)\ttkScrollbar.obj \
+ $(TMP_DIR)\ttkScroll.obj \
+ $(TMP_DIR)\ttkSeparator.obj \
+ $(TMP_DIR)\ttkSquare.obj \
+ $(TMP_DIR)\ttkState.obj \
+ $(TMP_DIR)\ttkTagSet.obj \
+ $(TMP_DIR)\ttkTheme.obj \
+ $(TMP_DIR)\ttkTrace.obj \
+ $(TMP_DIR)\ttkTrack.obj \
+ $(TMP_DIR)\ttkTreeview.obj \
+ $(TMP_DIR)\ttkWidget.obj \
+ $(TMP_DIR)\ttkStubInit.obj
+
TKSTUBOBJS = \
- $(TMP_DIR)\tkStubLib.obj \
- $(TMP_DIR)\tkStubImg.obj
+ $(TMP_DIR)\tkStubLib.obj $(TMP_DIR)\ttkStubLib.obj
WINDIR = $(ROOT)\win
GENERICDIR = $(ROOT)\generic
XLIBDIR = $(ROOT)\xlib
+TTKDIR = $(ROOT)\generic\ttk
BITMAPDIR = $(ROOT)\bitmaps
DOCDIR = $(ROOT)\doc
RCDIR = $(WINDIR)\rc
-!if $(TCLINSTALL)
-TCL_INCLUDES = -I "$(_TCLDIR)\include"
-!else
-TCL_INCLUDES = -I "$(_TCLDIR)\win" -I "$(_TCLDIR)\generic"
-!endif
TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(BITMAPDIR)" -I"$(XLIBDIR)" \
$(TCL_INCLUDES)
-TK_DEFINES = $(OPTDEFINES)
+CONFIG_DEFS =-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \
+ -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 \
+ -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 \
+ -DSUPPORT_CONFIG_EMBEDDED \
+!if $(HAVE_UXTHEME_H)
+ -DHAVE_UXTHEME_H=1 \
+!endif
+!if $(TTK_SQUARE_WIDGET)
+ -DTTK_SQUARE_WIDGET=1 \
+!endif
+TK_DEFINES =-DBUILD_ttk $(OPTDEFINES) $(CONFIG_DEFS)
#---------------------------------------------------------------------
# Compile flags
@@ -353,10 +427,14 @@ TK_DEFINES = $(OPTDEFINES)
!if !$(DEBUG)
!if $(OPTIMIZING)
### This cranks the optimization level to maximize speed
-cdebug = -O2 $(OPTIMIZATIONS)
+### We can't use -O2 because sometimes it causes problems.
+cdebug = $(OPTIMIZATIONS)
!else
cdebug =
!endif
+!if $(SYMBOLS)
+cdebug = $(cdebug) -Zi
+!endif
!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
### Warnings are too many, can't support warnings into errors.
cdebug = -Zi -Od $(DEBUGFLAGS)
@@ -365,26 +443,20 @@ cdebug = -Zi -WX $(DEBUGFLAGS)
!endif
### Declarations common to all compiler options
-cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
+cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\
-!if $(FULLWARNINGS)
-cflags = $(cflags) -W4
-!else
-cflags = $(cflags) -W3
-!endif
-
!if $(MSVCRT)
-!if "$(DBGX)" == ""
-crt = -MD
-!else
+!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
-!endif
!else
-!if "$(DBGX)" == ""
-crt = -MT
+crt = -MD
+!endif
!else
+!if $(DEBUG) && !$(UNCHECKED)
crt = -MTd
+!else
+crt = -MT
!endif
!endif
@@ -392,6 +464,7 @@ BASE_CFLAGS = $(cdebug) $(cflags) $(crt) $(TK_INCLUDES)
TK_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES) -DUSE_TCL_STUBS
CON_CFLAGS = $(cdebug) $(cflags) $(crt) -DCONSOLE
WISH_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES)
+STUB_CFLAGS = $(cflags) $(cdebug) $(TK_DEFINES)
#---------------------------------------------------------------------
@@ -407,10 +480,6 @@ ldebug = -release -opt:ref -opt:icf,3
### Declarations common to all linker options
lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
-!if $(FULLWARNINGS)
-lflags = $(lflags) -warn:3
-!endif
-
!if $(PROFILE)
lflags = $(lflags) -profile
!endif
@@ -431,13 +500,15 @@ dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows
-baselibs = kernel32.lib advapi32.lib user32.lib
+baselibs = kernel32.lib user32.lib
# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
+!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
baselibs = $(baselibs) bufferoverflowU.lib
!endif
-guilibs = $(baselibs) shell32.lib gdi32.lib comdlg32.lib winspool.lib imm32.lib comctl32.lib
+!endif
+guilibs = $(baselibs) gdi32.lib
#---------------------------------------------------------------------
@@ -445,7 +516,7 @@ guilibs = $(baselibs) shell32.lib gdi32.lib comdlg32.lib winspool.lib imm32.li
#---------------------------------------------------------------------
!if "$(TESTPAT)" != ""
-TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
+TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif
@@ -461,40 +532,84 @@ install: install-binaries install-libraries install-docs
tktest: setup $(TKTEST) $(CAT32)
-test: setup $(TKTEST) $(TKLIB) $(CAT32)
- set TCL_LIBRARY=$(TCL_LIBRARY)
- set TK_LIBRARY=$(TK_LIBRARY)
+test: test-classic test-ttk
+
+test-classic: setup $(TKTEST) $(TKLIB) $(CAT32)
+ @set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
+ @set TK_LIBRARY=$(TK_LIBRARY:\=/)
+ @set TCLLIBPATH=
!if $(TCLINSTALL)
- set PATH=$(_TCLDIR)\bin;$(PATH)
+ @set PATH=$(_TCLDIR)\bin;$(PATH)
!else
- set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
+ @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
!endif
!if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE"
$(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) | $(CAT32)
!else
- $(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) > tests.log
- type tests.log | more
+ $(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) | $(CAT32)
+!endif
+
+test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32)
+ @set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
+ @set TK_LIBRARY=$(TK_LIBRARY:\=/)
+ @set TCLLIBPATH=
+!if $(TCLINSTALL)
+ @set PATH=$(_TCLDIR)\bin;$(PATH)
+!else
+ @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
+!endif
+!if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE"
+ $(TKTEST) "$(ROOT)/tests/ttk/all.tcl" $(TESTFLAGS) | $(CAT32)
+!else
+ $(TKTEST) "$(ROOT)/tests/ttk/all.tcl" $(TESTFLAGS) | $(CAT32)
!endif
runtest: setup $(TKTEST) $(TKLIB) $(CAT32)
- set TCL_LIBRARY=$(TCL_LIBRARY)
- set TK_LIBRARY=$(TK_LIBRARY)
+ @set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
+ @set TK_LIBRARY=$(TK_LIBRARY:\=/)
+ @set TCLLIBPATH=
!if $(TCLINSTALL)
- set PATH=$(_TCLDIR)\bin;$(PATH)
+ @set PATH=$(_TCLDIR)\bin;$(PATH)
!else
- set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
+ @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
!endif
$(TKTEST)
rundemo: setup $(TKTEST) $(TKLIB) $(CAT32)
- set TCL_LIBRARY=$(TCL_LIBRARY)
+ @set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
+ @set TK_LIBRARY=$(TK_LIBRARY:\=/)
+ @set TCLLIBPATH=
!if $(TCLINSTALL)
- set PATH=$(_TCLDIR)\bin;$(PATH)
+ @set PATH=$(_TCLDIR)\bin;$(PATH)
!else
- set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
+ @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
!endif
$(TKTEST) $(ROOT)\library\demos\widget
+shell: setup $(WISH)
+ @set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
+ @set TK_LIBRARY=$(TK_LIBRARY:\=/)
+ @set TCLLIBPATH=
+!if $(TCLINSTALL)
+ @set PATH=$(_TCLDIR)\bin;$(PATH)
+!else
+ @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
+!endif
+ $(WISH) <<
+ console show
+<<
+
+dbgshell: setup $(WISH)
+ @set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
+ @set TK_LIBRARY=$(TK_LIBRARY:\=/)
+ @set TCLLIBPATH=
+!if $(TCLINSTALL)
+ @set PATH=$(_TCLDIR)\bin;$(PATH)
+!else
+ @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
+!endif
+ windbg $(WISH)
+
setup:
@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
@@ -523,77 +638,37 @@ $(TKSTUBLIB): $(TKSTUBOBJS)
$(WISH): $(WISHOBJS) $(TKIMPLIB)
- $(link32) $(guilflags) -out:$@ $(guilibs) $(TCLIMPLIB) $**
+ $(link32) $(guilflags) -stack:2300000 -out:$@ $(guilibs) $(TCLIMPLIB) $**
$(_VC_MANIFEST_EMBED_EXE)
+
$(WISHC): $(WISHOBJS) $(TKIMPLIB)
- $(link32) $(conlflags) -out:$@ $(guilibs) $(TCLIMPLIB) $**
+ $(link32) $(conlflags) -stack:2300000 -out:$@ $(guilibs) $(TCLIMPLIB) $**
$(_VC_MANIFEST_EMBED_EXE)
+
$(TKTEST): $(TKTESTOBJS) $(TKIMPLIB)
- $(link32) $(guilflags) -out:$@ $(guilibs) $(TCLIMPLIB) $**
+ $(link32) $(guilflags) -stack:2300000 -out:$@ $(guilibs) $(TCLIMPLIB) $**
$(_VC_MANIFEST_EMBED_EXE)
+
$(CAT32): $(_TCLDIR)\win\cat.c
$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $?
$(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj $(baselibs)
$(_VC_MANIFEST_EMBED_EXE)
-install-binaries:
- @echo installing binaries in "$(BIN_INSTALL_DIR)"
- @$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\"
-!if $(TKLIB) != $(TKIMPLIB)
- @$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\"
-!endif
- @$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\"
- @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\"
-!if !$(STATIC_BUILD)
- @-del "$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl"
- @echo if {[package vcompare [package provide Tcl] $(TCL_DOTVERSION)] != 0} { return } > "$(OUT_DIR)\pkgIndex.tcl"
- @echo package ifneeded Tk $(DOTVERSION) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk] >>"$(OUT_DIR)\pkgIndex.tcl"
- @$(CPY) "$(OUT_DIR)\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\"
-!endif
-
-install-libraries:
- @echo installing headers in "$(INCLUDE_INSTALL_DIR)"
- @$(CPY) "$(GENERICDIR)\tk.h" "$(INCLUDE_INSTALL_DIR)\"
- @$(CPY) "$(GENERICDIR)\tkDecls.h" "$(INCLUDE_INSTALL_DIR)\"
- @$(CPY) "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\"
- @$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\"
- @$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\"
- @echo installing library files in "$(SCRIPT_INSTALL_DIR)"
- @$(CPY) "$(ROOT)\library\*" "$(SCRIPT_INSTALL_DIR)\"
- @$(CPY) "$(ROOT)\library\images\*" "$(SCRIPT_INSTALL_DIR)\images\"
- @$(CPY) "$(ROOT)\library\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\"
- @echo installing demo files in "$(SCRIPT_INSTALL_DIR)\demos"
- @$(CPY) "$(ROOT)\library\demos\*" "$(SCRIPT_INSTALL_DIR)\demos\"
- @$(CPY) "$(ROOT)\library\demos\images\*" "$(SCRIPT_INSTALL_DIR)\demos\images\"
-
#---------------------------------------------------------------------
# Regenerate the stubs files.
#---------------------------------------------------------------------
genstubs:
- set TCL_LIBRARY=$(TCL_LIBRARY)
- $(TCLSH) $(_TCLDIR)\tools\genStubs.tcl $(GENERICDIR) \
- $(GENERICDIR)\$(PROJECT).decls $(GENERICDIR)\$(PROJECT)Int.decls
-
-
-#---------------------------------------------------------------------
-# Generate the makefile depedancies.
-#---------------------------------------------------------------------
-
-depend:
!if !exist($(TCLSH))
@echo Build tclsh first!
!else
set TCL_LIBRARY=$(TCL_LIBRARY)
- $(TCLSH) $(TOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \
- -passthru:"-DBUILD_tcl $(TK_INCLUDES:"="")" $(GENERICDIR) \
- $(COMPATDIR) $(WINDIR) @<<
-$(TKOBJS)
-<<
+ $(TCLSH) $(_TCLDIR)\tools\genStubs.tcl $(GENERICDIR) \
+ $(GENERICDIR)\$(PROJECT).decls $(GENERICDIR)\$(PROJECT)Int.decls
!endif
@@ -601,7 +676,7 @@ $(TKOBJS)
# Regenerate the windows help files.
#---------------------------------------------------------------------
-HLPBASE = $(PROJECT)$(VERSION)
+HLPBASE = $(PROJECT)$(TK_VERSION)
HELPFILE = $(OUT_DIR)\$(HLPBASE).hlp
HELPCNT = $(OUT_DIR)\$(HLPBASE).cnt
DOCTMP_DIR = $(OUT_DIR)\$(PROJECT)_docs
@@ -622,7 +697,7 @@ $(MAN2HELP) $(MAN2HELP2) $(INDEX): $(TCLTOOLSDIR)\$$(@F)
$(CPY) $(TCLTOOLSDIR)\$(@F) $(@D)
$(BMP):
- $(CPY) $(WINDIR)\$(@F) $(@D)
+ $(CPY) $(WINDIR)\rc\$(@F) $(@D)
$(HELPFILE): $(HELPRTF) $(BMP)
cd $(DOCTMP_DIR)
@@ -653,10 +728,12 @@ CreateButton(4, "FAQ", ExecFile("http://www.purl.org/NET/Tcl-FAQ/"))
$(CPY) "$(DOCTMP_DIR)\$(@B).cnt" "$(OUT_DIR)"
$(MAN2TCL): $(TCLTOOLSDIR)\$$(@B).c
- $(cc32) -nologo -G4 -ML -O2 -Fo$(@D)\ $(TCLTOOLSDIR)\$(@B).c -link -out:$@
+ $(cc32) $(TK_CFLAGS) -Fo$(@D)\ $(TCLTOOLSDIR)\$(@B).c
+ $(link32) $(conlflags) -out:$@ -stack:16384 $(@D)\man2tcl.obj
+ $(_VC_MANIFEST_EMBED_EXE)
$(HELPRTF): $(MAN2TCL) $(MAN2HELP) $(MAN2HELP2) $(INDEX)
- $(TCLSH) $(MAN2HELP) -bitmap $(BMP_NOPATH) $(PROJECT) $(VERSION) $(DOCDIR:\=/)
+ $(TCLSH) $(MAN2HELP) -bitmap $(BMP_NOPATH) $(PROJECT) $(TK_VERSION) $(DOCDIR:\=/)
install-docs:
!if exist($(HELPFILE))
@@ -664,25 +741,25 @@ install-docs:
$(CPY) "$(HELPCNT)" "$(DOC_INSTALL_DIR)\"
$(TCLSH) <<
puts "Installing $(PROJECT)'s helpfile contents into Tcl's ..."
-set f [open "$(DOC_INSTALL_DIR:\=/)/tcl$(VERSION).cnt" r]
+set f [open "$(DOC_INSTALL_DIR:\=/)/tcl$(TK_VERSION).cnt" r]
while {![eof $$f]} {
if {[regexp {:Include $(PROJECT)([0-9]{2}).cnt} [gets $$f] dummy ver]} {
- if {$$ver == $(VERSION)} {
+ if {$$ver == $(TK_VERSION)} {
puts "Already installed."
exit
} else {
# do something here logical to remove (or replace) it.
- puts "$$ver != $(VERSION), unfinished code path, die, die!"
+ puts "$$ver != $(TK_VERSION), unfinished code path, die, die!"
exit 1
}
}
}
close $$f
-set f [open "$(DOC_INSTALL_DIR:\=/)/tcl$(VERSION).cnt" a]
+set f [open "$(DOC_INSTALL_DIR:\=/)/tcl$(TK_VERSION).cnt" a]
puts $$f {:Include $(HLPBASE).cnt}
close $$f
<<
- start /wait winhlp32 -g $(DOC_INSTALL_DIR)\tcl$(VERSION).hlp
+ start /wait winhlp32 -g $(DOC_INSTALL_DIR)\tcl$(TK_VERSION).hlp
!endif
#---------------------------------------------------------------------
@@ -690,15 +767,16 @@ close $$f
#---------------------------------------------------------------------
$(TMP_DIR)\testMain.obj: $(WINDIR)\winMain.c
-!if $(TCL_USE_STATIC_PACKAGES)
- $(cc32) $(WISH_CFLAGS) -DTK_TEST -DTCL_USE_STATIC_PACKAGES -Fo$@ $?
-!else
- $(cc32) $(WISH_CFLAGS) -DTK_TEST -Fo$@ $?
-!endif
+ $(cc32) $(WISH_CFLAGS) -DTK_TEST \
+ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
+ -Fo$@ $?
$(TMP_DIR)\tkTest.obj: $(GENERICDIR)\tkTest.c
$(cc32) $(WISH_CFLAGS) -Fo$@ $?
+$(TMP_DIR)\tkOldTest.obj: $(GENERICDIR)\tkOldTest.c
+ $(cc32) $(WISH_CFLAGS) -Fo$@ $?
+
$(TMP_DIR)\tkWinTest.obj: $(WINDIR)\tkWinTest.c
$(cc32) $(WISH_CFLAGS) -Fo$@ $?
@@ -706,87 +784,51 @@ $(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c
$(cc32) $(WISH_CFLAGS) -Fo$@ $?
$(TMP_DIR)\winMain.obj: $(WINDIR)\winMain.c
-!if $(TCL_USE_STATIC_PACKAGES)
- $(cc32) $(WISH_CFLAGS) -DTCL_USE_STATIC_PACKAGES -Fo$@ $?
-!else
- $(cc32) $(WISH_CFLAGS) -Fo$@ $?
-!endif
+ $(cc32) $(WISH_CFLAGS) \
+ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
+ -Fo$@ $?
# The following objects are part of the stub library and should not
# be built as DLL objects but none of the symbols should be exported
# and no reference made to a C runtime.
$(TMP_DIR)\tkStubLib.obj : $(GENERICDIR)\tkStubLib.c
- $(cc32) $(cdebug) $(cflags) $(TK_INCLUDES) -Zl -DSTATIC_BUILD -Fo$@ $?
+ $(cc32) $(STUB_CFLAGS) $(TK_INCLUDES) -Zl -DSTATIC_BUILD -Fo$@ $?
-$(TMP_DIR)\tkStubImg.obj : $(GENERICDIR)\tkStubImg.c
- $(cc32) $(cdebug) $(cflags) $(TK_INCLUDES) -Zl -DSTATIC_BUILD -Fo$@ $?
+$(TMP_DIR)\wish.exe.manifest: $(WINDIR)\wish.exe.manifest.in
+ @nmakehlp -s << $** >$@
+@MACHINE@ $(MACHINE:IX86=X86)
+@TK_WIN_VERSION@ $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION).0.0
+<<
#---------------------------------------------------------------------
-# Dedependency rules
+# Generate the makefile depedancies.
#---------------------------------------------------------------------
-$(TMP_DIR)\wish.exe.manifest: $(WINDIR)\wish.exe.manifest.in
-!if ![sed "1d" < NUL > NUL]
- sed -f << $** > $@
-s/@MACHINE@/$(MACHINE:IX86=X86)/
-s/@TK_WIN_VERSION@/$(DOTVERSION).0.0/
-<<
+depend:
+!if !exist($(TCLSH))
+ @echo Build tclsh first!
!else
- $(TCLSH) <<
-set f [open {$(WINDIR:\=/)/wish.exe.manifest.in} r]
-set data [read $$f]
-close $$f
-set mach {$(MACHINE)}
-if {[regexp -nocase {$(IX86)$$} $mach ]} {set mach X86}
-set winver "$(DOTVERSION).0.0"
-set data [string map [list @MACHINE@ $$mach @TK_WIN_VERSION@ $$winver] $$data]
-puts {Creating $(TMP_DIR:\=/)/wish.exe.manifest}
-set f [open {$(TMP_DIR:\=/)/wish.exe.manifest} w]
-puts -nonewline $$f $$data
-close $$f
-exit
+ set TCL_LIBRARY=$(TCL_LIBRARY)
+ $(TCLSH) $(TCLTOOLSDIR)\mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \
+ -passthru:"-DBUILD_tk $(TK_INCLUDES)" $(GENERICDIR),$$(GENERICDIR) \
+ $(WINDIR),$$(WINDIR) $(TTKDIR),$$(TTKDIR) $(XLIBDIR),$$(XLIBDIR) \
+ $(BITMAPDIR),$$(BITMAPDIR) @<<
+$(TKOBJS)
<<
!endif
+
+#---------------------------------------------------------------------
+# Dedependency rules
+#---------------------------------------------------------------------
+
$(TMP_DIR)\tk.res: \
$(RCDIR)\buttons.bmp \
$(RCDIR)\cursor*.cur \
$(RCDIR)\tk.ico
-$(GENERICDIR)/default.h: $(WINDIR)/tkWinDefault.h
-$(GENERICDIR)/tkButton.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkCanvas.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkEntry.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkFrame.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkListbox.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkMenu.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkMenubutton.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkMessage.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkPanedWindow.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkScale.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkScrollbar.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkText.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/default.h
-$(GENERICDIR)/tkUndo.c: $(GENERICDIR)/tkUndo.h
-
-$(GENERICDIR)/tkText.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextBTree.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextImage.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextMark.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/tkText.h
-$(GENERICDIR)/tkTextWind.c: $(GENERICDIR)/tkText.h
-
-$(GENERICDIR)/tkMacWinMenu.c: $(GENERICDIR)/tkMenu.h
-$(GENERICDIR)/tkMenu.c: $(GENERICDIR)/tkMenu.h
-$(GENERICDIR)/tkMenuDraw.c: $(GENERICDIR)/tkMenu.h
-$(WINDIR)/tkWinMenu.c: $(GENERICDIR)/tkMenu.h
-
!if exist("$(OUT_DIR)\depend.mk")
!include "$(OUT_DIR)\depend.mk"
!message *** Dependency rules in effect.
@@ -811,6 +853,11 @@ $<
$<
<<
+{$(TTKDIR)}.c{$(TMP_DIR)}.obj::
+ $(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
+$<
+<<
+
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
$<
@@ -821,40 +868,98 @@ $<
$<
<<
-!if $(DEBUG)
-RCDEBUG = -d DEBUG
-!else
-RCDEBUG =
-!endif
-!if $(TCL_THREADS)
-RCTHREADS = -d TCL_THREADS
-!else
-RCTHREADS =
-!endif
-!if $(STATIC_BUILD)
-RCSTATIC = -d STATIC_BUILD
-!else
-RCSTATIC =
-!endif
-
{$(RCDIR)}.rc{$(TMP_DIR)}.res:
$(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" $(TCL_INCLUDES) \
- $(RCDEBUG) $(RCTHREADS) $(RCSTATIC) \
- $<
+ -d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
+ -d TCL_THREADS=$(TCL_THREADS) \
+ -d STATIC_BUILD=$(STATIC_BUILD) \
+ $<
$(TMP_DIR)\tk.res: $(TMP_DIR)\wish.exe.manifest
$(TMP_DIR)\wish.res: $(TMP_DIR)\wish.exe.manifest
+.SUFFIXES:
+.SUFFIXES:.c .rc
+
+
#---------------------------------------------------------------------
-# Clean up
+# Installation.
#---------------------------------------------------------------------
-clean:
- -@$(RMDIR) $(TMP_DIR)
+install-binaries:
+ @echo installing binaries
+ @$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\"
+!if $(TKLIB) != $(TKIMPLIB)
+ @$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\"
+!endif
+ @$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\"
+ @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\"
+!if !$(STATIC_BUILD)
+ @echo creating package index
+ @type << > $(OUT_DIR)\pkgIndex.tcl
+if {[catch {package present Tcl 8.5.0}]} { return }
+package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk]
+<<
+ @$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)\"
+!endif
-hose: clean
- -@$(RMDIR) $(OUT_DIR)
+#"
+install-libraries:
+ @echo installing Tk headers
+ @$(CPY) "$(GENERICDIR)\tk.h" "$(INCLUDE_INSTALL_DIR)\"
+ @$(CPY) "$(GENERICDIR)\tkDecls.h" "$(INCLUDE_INSTALL_DIR)\"
+ @$(CPY) "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\"
+ @$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\"
+ @$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\"
+ @echo installing script library
+ @$(CPY) "$(ROOT)\library\*" "$(SCRIPT_INSTALL_DIR)\"
+ @echo installing theme library
+ @$(CPY) "$(ROOT)\library\ttk\*" "$(SCRIPT_INSTALL_DIR)\ttk\"
+ @echo installing demos
+ @$(CPY) "$(ROOT)\library\demos\*" "$(SCRIPT_INSTALL_DIR)\demos\"
+ @$(CPY) "$(ROOT)\library\demos\images\*" "$(SCRIPT_INSTALL_DIR)\demos\images\"
+ @echo installing images
+ @$(CPY) "$(ROOT)\library\images\*" "$(SCRIPT_INSTALL_DIR)\images\"
+ @echo installing language files
+ @$(CPY) "$(ROOT)\library\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\"
-.SUFFIXES:
-.SUFFIXES:.c .rc
+#"
+
+#---------------------------------------------------------------------
+# Clean up
+#---------------------------------------------------------------------
+
+tidy:
+!if $(TKLIB) != $(TKIMPLIB)
+ @echo Removing $(TKLIB) ...
+ @if exist $(TKLIB) del $(TKLIB)
+!endif
+ @echo Removing $(TKIMPLIB) ...
+ @if exist $(TKIMPLIB) del $(TKIMPLIB)
+ @echo Removing $(WISH) ...
+ @if exist $(WISH) del $(WISH)
+ @echo Removing $(TKTEST) ...
+ @if exist $(TKTEST) del $(TKTEST)
+ @echo Removing $(TKSTUBLIB) ...
+ @if exist $(TKSTUBLIB) del $(TKSTUBLIB)
+
+clean:
+ @echo Cleaning $(TMP_DIR)\* ...
+ @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
+ @echo Cleaning $(WINDIR)\nmakehlp.obj ...
+ @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
+ @echo Cleaning $(WINDIR)\nmakehlp.exe ...
+ @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
+ @echo Cleaning $(WINDIR)\_junk.pch ...
+ @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
+ @echo Cleaning $(WINDIR)\vercl.x ...
+ @if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
+ @echo Cleaning $(WINDIR)\vercl.i ...
+ @if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
+ @echo Cleaning $(WINDIR)\versions.vc ...
+ @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
+
+hose:
+ @echo Hosing $(OUT_DIR)\* ...
+ @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 4657c81..f1b5f34 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -5,9 +5,10 @@
* This is used to fix limitations within nmake and the environment.
*
* Copyright (c) 2002 by David Gravereaux.
+ * Copyright (c) 2006 by Pat Thoyts
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
* ----------------------------------------------------------------------------
*/
@@ -17,9 +18,15 @@
#pragma comment (lib, "kernel32.lib")
#include <stdio.h>
#include <math.h>
+
+/*
+ * This library is required for x64 builds with _some_ versions
+ */
#if defined(_M_IA64) || defined(_M_AMD64)
+#if _MSC_FULL_VER > 140000000 && _MSC_FULL_VER <= 140040310
#pragma comment(lib, "bufferoverflowU")
#endif
+#endif
/* ISO hack for dumb VC++ */
#ifdef _MSC_VER
@@ -34,6 +41,8 @@ int CheckForCompilerFeature(const char *option);
int CheckForLinkerFeature(const char *option);
int IsIn(const char *string, const char *substring);
int GrepForDefine(const char *file, const char *string);
+int SubstituteFile(const char *substs, const char *filename);
+const char * GetVersionFromFile(const char *filename, const char *match);
DWORD WINAPI ReadFromPipe(LPVOID args);
/* globals */
@@ -128,10 +137,35 @@ main(
return 2;
}
return GrepForDefine(argv[2], argv[3]);
+ case 's':
+ if (argc == 2) {
+ chars = snprintf(msg, sizeof(msg) - 1,
+ "usage: %s -s <substitutions file> <file>\n"
+ "Perform a set of string map type substutitions on a file\n"
+ "exitcodes: 0\n",
+ argv[0]);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
+ &dwWritten, NULL);
+ return 2;
+ }
+ return SubstituteFile(argv[2], argv[3]);
+ case 'V':
+ if (argc != 4) {
+ chars = snprintf(msg, sizeof(msg) - 1,
+ "usage: %s -V filename matchstring\n"
+ "Extract a version from a file:\n"
+ "eg: pkgIndex.tcl \"package ifneeded http\"",
+ argv[0]);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
+ &dwWritten, NULL);
+ return 0;
+ }
+ printf("%s\n", GetVersionFromFile(argv[2], argv[3]));
+ return 0;
}
}
chars = snprintf(msg, sizeof(msg) - 1,
- "usage: %s -c|-l|-f ...\n"
+ "usage: %s -c|-l|-f|-g|-V ...\n"
"This is a little helper app to equalize shell differences between WinNT and\n"
"Win9x and get nmake.exe to accomplish its job.\n",
argv[0]);
@@ -190,7 +224,7 @@ CheckForCompilerFeature(
* Base command line.
*/
- lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X ");
+ lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X -Fp.\\_junk.pch ");
/*
* Append our option for testing
@@ -224,7 +258,7 @@ CheckForCompilerFeature(
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL);
return 2;
}
@@ -268,7 +302,9 @@ CheckForCompilerFeature(
return !(strstr(Out.buffer, "D4002") != NULL
|| strstr(Err.buffer, "D4002") != NULL
|| strstr(Out.buffer, "D9002") != NULL
- || strstr(Err.buffer, "D9002") != NULL);
+ || strstr(Err.buffer, "D9002") != NULL
+ || strstr(Out.buffer, "D2021") != NULL
+ || strstr(Err.buffer, "D2021") != NULL);
}
int
@@ -350,7 +386,7 @@ CheckForLinkerFeature(
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL);
return 2;
}
@@ -391,9 +427,9 @@ CheckForLinkerFeature(
*/
return !(strstr(Out.buffer, "LNK1117") != NULL ||
- strstr(Err.buffer, "LNK1117") != NULL ||
- strstr(Out.buffer, "LNK4044") != NULL ||
- strstr(Err.buffer, "LNK4044") != NULL);
+ strstr(Err.buffer, "LNK1117") != NULL ||
+ strstr(Out.buffer, "LNK4044") != NULL ||
+ strstr(Err.buffer, "LNK4044") != NULL);
}
DWORD WINAPI
@@ -440,18 +476,16 @@ GrepForDefine(
const char *file,
const char *string)
{
- FILE *f;
char s1[51], s2[51], s3[51];
- int r = 0;
- double d1;
+ FILE *f = fopen(file, "rt");
- f = fopen(file, "rt");
if (f == NULL) {
return 0;
}
do {
- r = fscanf(f, "%50s", s1);
+ int r = fscanf(f, "%50s", s1);
+
if (r == 1 && !strcmp(s1, "#define")) {
/*
* Get next two words.
@@ -467,6 +501,8 @@ GrepForDefine(
*/
if (!strcmp(s2, string)) {
+ double d1;
+
fclose(f);
/*
@@ -485,3 +521,203 @@ GrepForDefine(
fclose(f);
return 0;
}
+
+/*
+ * GetVersionFromFile --
+ * Looks for a match string in a file and then returns the version
+ * following the match where a version is anything acceptable to
+ * package provide or package ifneeded.
+ */
+
+const char *
+GetVersionFromFile(
+ const char *filename,
+ const char *match)
+{
+ size_t cbBuffer = 100;
+ static char szBuffer[100];
+ char *szResult = NULL;
+ FILE *fp = fopen(filename, "rt");
+
+ if (fp != NULL) {
+ /*
+ * Read data until we see our match string.
+ */
+
+ while (fgets(szBuffer, cbBuffer, fp) != NULL) {
+ LPSTR p, q;
+
+ p = strstr(szBuffer, match);
+ if (p != NULL) {
+ /*
+ * Skip to first digit.
+ */
+
+ while (*p && !isdigit(*p)) {
+ ++p;
+ }
+
+ /*
+ * Find ending whitespace.
+ */
+
+ q = p;
+ while (*q && (isalnum(*q) || *q == '.')) {
+ ++q;
+ }
+
+ memcpy(szBuffer, p, q - p);
+ szBuffer[q-p] = 0;
+ szResult = szBuffer;
+ break;
+ }
+ }
+ fclose(fp);
+ }
+ return szResult;
+}
+
+/*
+ * List helpers for the SubstituteFile function
+ */
+
+typedef struct list_item_t {
+ struct list_item_t *nextPtr;
+ char * key;
+ char * value;
+} list_item_t;
+
+/* insert a list item into the list (list may be null) */
+static list_item_t *
+list_insert(list_item_t **listPtrPtr, const char *key, const char *value)
+{
+ list_item_t *itemPtr = malloc(sizeof(list_item_t));
+ if (itemPtr) {
+ itemPtr->key = strdup(key);
+ itemPtr->value = strdup(value);
+ itemPtr->nextPtr = NULL;
+
+ while(*listPtrPtr) {
+ listPtrPtr = &(*listPtrPtr)->nextPtr;
+ }
+ *listPtrPtr = itemPtr;
+ }
+ return itemPtr;
+}
+
+static void
+list_free(list_item_t **listPtrPtr)
+{
+ list_item_t *tmpPtr, *listPtr = *listPtrPtr;
+ while (listPtr) {
+ tmpPtr = listPtr;
+ listPtr = listPtr->nextPtr;
+ free(tmpPtr->key);
+ free(tmpPtr->value);
+ free(tmpPtr);
+ }
+}
+
+/*
+ * SubstituteFile --
+ * As windows doesn't provide anything useful like sed and it's unreliable
+ * to use the tclsh you are building against (consider x-platform builds -
+ * eg compiling AMD64 target from IX86) we provide a simple substitution
+ * option here to handle autoconf style substitutions.
+ * The substitution file is whitespace and line delimited. The file should
+ * consist of lines matching the regular expression:
+ * \s*\S+\s+\S*$
+ *
+ * Usage is something like:
+ * nmakehlp -S << $** > $@
+ * @PACKAGE_NAME@ $(PACKAGE_NAME)
+ * @PACKAGE_VERSION@ $(PACKAGE_VERSION)
+ * <<
+ */
+
+int
+SubstituteFile(
+ const char *substitutions,
+ const char *filename)
+{
+ size_t cbBuffer = 1024;
+ static char szBuffer[1024], szCopy[1024];
+ char *szResult = NULL;
+ list_item_t *substPtr = NULL;
+ FILE *fp, *sp;
+
+ fp = fopen(filename, "rt");
+ if (fp != NULL) {
+
+ /*
+ * Build a list of substutitions from the first filename
+ */
+
+ sp = fopen(substitutions, "rt");
+ if (sp != NULL) {
+ while (fgets(szBuffer, cbBuffer, sp) != NULL) {
+ char *ks, *ke, *vs, *ve;
+ ks = szBuffer;
+ while (ks && *ks && isspace(*ks)) ++ks;
+ ke = ks;
+ while (ke && *ke && !isspace(*ke)) ++ke;
+ vs = ke;
+ while (vs && *vs && isspace(*vs)) ++vs;
+ ve = vs;
+ while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
+ *ke = 0, *ve = 0;
+ list_insert(&substPtr, ks, vs);
+ }
+ fclose(sp);
+ }
+
+ /* debug: dump the list */
+#ifdef _DEBUG
+ {
+ int n = 0;
+ list_item_t *p = NULL;
+ for (p = substPtr; p != NULL; p = p->nextPtr, ++n) {
+ fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value);
+ }
+ }
+#endif
+
+ /*
+ * Run the substitutions over each line of the input
+ */
+
+ while (fgets(szBuffer, cbBuffer, fp) != NULL) {
+ list_item_t *p = NULL;
+ for (p = substPtr; p != NULL; p = p->nextPtr) {
+ char *m = strstr(szBuffer, p->key);
+ if (m) {
+ char *cp, *op, *sp;
+ cp = szCopy;
+ op = szBuffer;
+ while (op != m) *cp++ = *op++;
+ sp = p->value;
+ while (sp && *sp) *cp++ = *sp++;
+ op += strlen(p->key);
+ while (*op) *cp++ = *op++;
+ *cp = 0;
+ memcpy(szBuffer, szCopy, sizeof(szCopy));
+ }
+ }
+ printf(szBuffer);
+ }
+
+ list_free(&substPtr);
+ }
+ fclose(fp);
+ return 0;
+}
+
+/*
+ * Local variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * indent-tabs-mode: t
+ * tab-width: 8
+ * End:
+ */
diff --git a/win/rc/cursor00.cur b/win/rc/cursor00.cur
index 337e6d4..0c58bfe 100644
--- a/win/rc/cursor00.cur
+++ b/win/rc/cursor00.cur
Binary files differ
diff --git a/win/rc/cursor02.cur b/win/rc/cursor02.cur
index fbc4774..46f0f11 100644
--- a/win/rc/cursor02.cur
+++ b/win/rc/cursor02.cur
Binary files differ
diff --git a/win/rc/cursor04.cur b/win/rc/cursor04.cur
index 9634c42..1b3028d 100644
--- a/win/rc/cursor04.cur
+++ b/win/rc/cursor04.cur
Binary files differ
diff --git a/win/rc/cursor06.cur b/win/rc/cursor06.cur
index f7188b2..bb06edf 100644
--- a/win/rc/cursor06.cur
+++ b/win/rc/cursor06.cur
Binary files differ
diff --git a/win/rc/cursor0a.cur b/win/rc/cursor0a.cur
index 3f8ef45..6bffda5 100644
--- a/win/rc/cursor0a.cur
+++ b/win/rc/cursor0a.cur
Binary files differ
diff --git a/win/rc/cursor0c.cur b/win/rc/cursor0c.cur
index 1014edd..a991da6 100644
--- a/win/rc/cursor0c.cur
+++ b/win/rc/cursor0c.cur
Binary files differ
diff --git a/win/rc/cursor0e.cur b/win/rc/cursor0e.cur
index 964058d..6e0434d 100644
--- a/win/rc/cursor0e.cur
+++ b/win/rc/cursor0e.cur
Binary files differ
diff --git a/win/rc/cursor12.cur b/win/rc/cursor12.cur
index 920c936..0d0d667 100644
--- a/win/rc/cursor12.cur
+++ b/win/rc/cursor12.cur
Binary files differ
diff --git a/win/rc/cursor1e.cur b/win/rc/cursor1e.cur
index 49fa7f7..3272db1 100644
--- a/win/rc/cursor1e.cur
+++ b/win/rc/cursor1e.cur
Binary files differ
diff --git a/win/rc/cursor20.cur b/win/rc/cursor20.cur
index cf177a1..48080be 100644
--- a/win/rc/cursor20.cur
+++ b/win/rc/cursor20.cur
Binary files differ
diff --git a/win/rc/cursor2a.cur b/win/rc/cursor2a.cur
index 8dca432..5e75f16 100644
--- a/win/rc/cursor2a.cur
+++ b/win/rc/cursor2a.cur
Binary files differ
diff --git a/win/rc/cursor3a.cur b/win/rc/cursor3a.cur
index 8176d1d..e3eda81 100644
--- a/win/rc/cursor3a.cur
+++ b/win/rc/cursor3a.cur
Binary files differ
diff --git a/win/rc/cursor46.cur b/win/rc/cursor46.cur
index 3e97094..4f969d1 100644
--- a/win/rc/cursor46.cur
+++ b/win/rc/cursor46.cur
Binary files differ
diff --git a/win/rc/cursor48.cur b/win/rc/cursor48.cur
index 2a56897..97e499a 100644
--- a/win/rc/cursor48.cur
+++ b/win/rc/cursor48.cur
Binary files differ
diff --git a/win/rc/cursor4c.cur b/win/rc/cursor4c.cur
index 0407d77..3512a51 100644
--- a/win/rc/cursor4c.cur
+++ b/win/rc/cursor4c.cur
Binary files differ
diff --git a/win/rc/cursor4e.cur b/win/rc/cursor4e.cur
index a58e3db..28992c4 100644
--- a/win/rc/cursor4e.cur
+++ b/win/rc/cursor4e.cur
Binary files differ
diff --git a/win/rc/cursor60.cur b/win/rc/cursor60.cur
index 847969d..dc61469 100644
--- a/win/rc/cursor60.cur
+++ b/win/rc/cursor60.cur
Binary files differ
diff --git a/win/rc/cursor62.cur b/win/rc/cursor62.cur
index 36404a5..ff7c009 100644
--- a/win/rc/cursor62.cur
+++ b/win/rc/cursor62.cur
Binary files differ
diff --git a/win/rc/cursor66.cur b/win/rc/cursor66.cur
index 81d53b4..269f772 100644
--- a/win/rc/cursor66.cur
+++ b/win/rc/cursor66.cur
Binary files differ
diff --git a/win/rc/cursor6c.cur b/win/rc/cursor6c.cur
index 1e8d6d8..d8fb0f1 100644
--- a/win/rc/cursor6c.cur
+++ b/win/rc/cursor6c.cur
Binary files differ
diff --git a/win/rc/cursor72.cur b/win/rc/cursor72.cur
index 4994c6e..471bcf0 100644
--- a/win/rc/cursor72.cur
+++ b/win/rc/cursor72.cur
Binary files differ
diff --git a/win/rc/cursor74.cur b/win/rc/cursor74.cur
index d5e4361..176d2b0 100644
--- a/win/rc/cursor74.cur
+++ b/win/rc/cursor74.cur
Binary files differ
diff --git a/win/rc/cursor86.cur b/win/rc/cursor86.cur
index 2d38c03..52cb5c3 100644
--- a/win/rc/cursor86.cur
+++ b/win/rc/cursor86.cur
Binary files differ
diff --git a/win/rc/cursor88.cur b/win/rc/cursor88.cur
index 62b8061..fdba0d63 100644
--- a/win/rc/cursor88.cur
+++ b/win/rc/cursor88.cur
Binary files differ
diff --git a/win/rc/cursor8a.cur b/win/rc/cursor8a.cur
index 6c5358d..369e71f 100644
--- a/win/rc/cursor8a.cur
+++ b/win/rc/cursor8a.cur
Binary files differ
diff --git a/win/rc/cursor8c.cur b/win/rc/cursor8c.cur
index 103010b..811a0c3 100644
--- a/win/rc/cursor8c.cur
+++ b/win/rc/cursor8c.cur
Binary files differ
diff --git a/win/rc/cursor90.cur b/win/rc/cursor90.cur
index 08731f8..3c655d5 100644
--- a/win/rc/cursor90.cur
+++ b/win/rc/cursor90.cur
Binary files differ
diff --git a/win/rc/cursor94.cur b/win/rc/cursor94.cur
index 7777d53..16e6b61 100644
--- a/win/rc/cursor94.cur
+++ b/win/rc/cursor94.cur
Binary files differ
diff --git a/win/rc/cursor9a.cur b/win/rc/cursor9a.cur
new file mode 100644
index 0000000..048f06b
--- /dev/null
+++ b/win/rc/cursor9a.cur
Binary files differ
diff --git a/win/lamp.bmp b/win/rc/lamp.bmp
index 834c0f9..834c0f9 100644
--- a/win/lamp.bmp
+++ b/win/rc/lamp.bmp
Binary files differ
diff --git a/win/rc/tk.rc b/win/rc/tk.rc
index 3c023cf..6a74be3 100644
--- a/win/rc/tk.rc
+++ b/win/rc/tk.rc
@@ -8,14 +8,14 @@
//
// build-up the name suffix that defines the type of build this is.
//
-#ifdef TCL_THREADS
+#if TCL_THREADS
#define SUFFIX_THREADS "t"
#else
#define SUFFIX_THREADS ""
#endif
-#ifdef DEBUG
-#define SUFFIX_DEBUG "d"
+#if DEBUG && !UNCHECKED
+#define SUFFIX_DEBUG "g"
#else
#define SUFFIX_DEBUG ""
#endif
@@ -41,7 +41,7 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Tk DLL\0"
- VALUE "OriginalFilename", "tk" STRINGIFY(JOIN(TK_MAJOR_VERSION,TK_MINOR_VERSION)) SUFFIX ".dll\0"
+ VALUE "OriginalFilename", "tk" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".dll\0"
VALUE "CompanyName", "ActiveState Corporation\0"
VALUE "FileVersion", TK_PATCH_LEVEL
VALUE "LegalCopyright", "Copyright \251 2001 by ActiveState Corporation, et al\0"
diff --git a/win/rc/tk_base.rc b/win/rc/tk_base.rc
index 67d6807..3e065c9 100644
--- a/win/rc/tk_base.rc
+++ b/win/rc/tk_base.rc
@@ -136,3 +136,5 @@ umbrella CURSOR DISCARDABLE "cursor92.cur"
ur_angle CURSOR DISCARDABLE "cursor94.cur"
watch CURSOR DISCARDABLE "cursor96.cur"
xterm CURSOR DISCARDABLE "cursor98.cur"
+none CURSOR DISCARDABLE "cursor9a.cur"
+
diff --git a/win/rc/wish.rc b/win/rc/wish.rc
index 533a97e..5cc2fa4 100644
--- a/win/rc/wish.rc
+++ b/win/rc/wish.rc
@@ -8,20 +8,20 @@
//
// build-up the name suffix that defines the type of build this is.
//
-#ifdef TCL_THREADS
+#if TCL_THREADS
#define SUFFIX_THREADS "t"
#else
#define SUFFIX_THREADS ""
#endif
-#ifdef STATIC_BUILD
+#if STATIC_BUILD
#define SUFFIX_STATIC "s"
#else
#define SUFFIX_STATIC ""
#endif
-#ifdef DEBUG
-#define SUFFIX_DEBUG "d"
+#if DEBUG && !UNCHECKED
+#define SUFFIX_DEBUG "g"
#else
#define SUFFIX_DEBUG ""
#endif
@@ -47,7 +47,7 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Wish Application\0"
- VALUE "OriginalFilename", "wish" STRINGIFY(JOIN(TK_MAJOR_VERSION,TK_MINOR_VERSION)) SUFFIX ".exe\0"
+ VALUE "OriginalFilename", "wish" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".exe\0"
VALUE "CompanyName", "ActiveState Corporation\0"
VALUE "FileVersion", TK_PATCH_LEVEL
VALUE "LegalCopyright", "Copyright \251 2000 by ActiveState Corporation, et al\0"
@@ -70,7 +70,7 @@ END
app ICON DISCARDABLE "wish.ico"
-#ifdef STATIC_BUILD
+#if STATIC_BUILD
#include "tk_base.rc"
#endif
diff --git a/win/rules.vc b/win/rules.vc
index b813668..e18dca9 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -6,9 +6,9 @@
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
+#
# Copyright (c) 2001-2003 David Gravereaux.
-# Copyright (c) 2003-2006 Patrick Thoyts
+# Copyright (c) 2003-2007 Patrick Thoyts
#------------------------------------------------------------------------------
!ifndef _RULES_VC
@@ -135,12 +135,8 @@ OPTIMIZATIONS = $(OPTIMIZATIONS) -Oi
OPTIMIZATIONS = $(OPTIMIZATIONS) -Op
!endif
-!if [nmakehlp -c -fp:precise]
-OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:precise
-!endif
-
-!if [nmakehlp -c -fp:except]
-OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:except
+!if [nmakehlp -c -fp:strict]
+OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict
!endif
!if [nmakehlp -c -Gs]
@@ -219,6 +215,7 @@ LINKERFLAGS =-ltcg
STATIC_BUILD = 0
TCL_THREADS = 0
DEBUG = 0
+SYMBOLS = 0
PROFILE = 0
MSVCRT = 0
LOIMPACT = 0
@@ -256,6 +253,12 @@ DEBUG = 1
!else
DEBUG = 0
!endif
+!if [nmakehlp -f $(OPTS) "pdbs"]
+!message *** Doing pdbs
+SYMBOLS = 1
+!else
+SYMBOLS = 0
+!endif
!if [nmakehlp -f $(OPTS) "profile"]
!message *** Doing profile
PROFILE = 1
@@ -311,11 +314,8 @@ SUFX = tsgx
!if $(DEBUG)
BUILDDIRTOP = Debug
-DBGX = g
!else
BUILDDIRTOP = Release
-DBGX =
-SUFX = $(SUFX:g=)
!endif
!if "$(MACHINE)" != "IX86"
@@ -325,6 +325,10 @@ BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
!endif
+!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
+SUFX = $(SUFX:g=)
+!endif
+
TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX
!if !$(STATIC_BUILD)
@@ -383,13 +387,14 @@ TCL_COMPILE_DEBUG = 0
!endif
!endif
+
#----------------------------------------------------------
# Decode the checks requested.
#----------------------------------------------------------
!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
TCL_NO_DEPRECATED = 0
-FULLWARNINGS = 0
+WARNINGS = -W3
!else
!if [nmakehlp -f $(CHECKS) "nodep"]
!message *** Doing nodep check
@@ -399,9 +404,16 @@ TCL_NO_DEPRECATED = 0
!endif
!if [nmakehlp -f $(CHECKS) "fullwarn"]
!message *** Doing full warnings check
-FULLWARNINGS = 1
+WARNINGS = -W4
+!if [nmakehlp -l -warn:3]
+LINKERFLAGS = $(LINKERFLAGS) -warn:3
+!endif
!else
-FULLWARNINGS = 0
+WARNINGS = -W3
+!endif
+!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
+!message *** Doing 64bit portability warnings
+WARNINGS = $(WARNINGS) -Wp64
!endif
!endif
@@ -409,7 +421,8 @@ FULLWARNINGS = 0
# Set our defines now armed with our options.
#----------------------------------------------------------
-OPTDEFINES =
+OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
+
!if $(TCL_MEM_DEBUG)
OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG
!endif
@@ -425,6 +438,9 @@ OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
!if $(STATIC_BUILD)
OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD
!endif
+!if $(TCL_NO_DEPRECATED)
+OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED
+!endif
!if $(DEBUG)
OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DEBUG
@@ -440,16 +456,26 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT
#----------------------------------------------------------
-# Get common info used when building extensions.
+# Locate the Tcl headers to build against
#----------------------------------------------------------
-!if "$(PROJECT)" != "tcl"
+!if "$(PROJECT)" == "tcl"
-!if !defined(TCLDIR)
+_TCL_H = ..\generic\tcl.h
+
+!else
+
+# If INSTALLDIR set to tcl root dir then reset to the lib dir.
!if exist("$(_INSTALLDIR)\include\tcl.h")
-TCLH = "$(_INSTALLDIR)\include\tcl.h"
+_INSTALLDIR=$(_INSTALLDIR)\lib
+!endif
+
+!if !defined(TCLDIR)
+!if exist("$(_INSTALLDIR)\..\include\tcl.h")
TCLINSTALL = 1
-_TCLDIR = $(_INSTALLDIR)
+_TCLDIR = $(_INSTALLDIR)\..
+_TCL_H = $(_INSTALLDIR)\..\include\tcl.h
+TCLDIR = $(_INSTALLDIR)\..
!else
MSG=^
Failed to find tcl.h. Set the TCLDIR macro.
@@ -458,53 +484,181 @@ Failed to find tcl.h. Set the TCLDIR macro.
!else
_TCLDIR = $(TCLDIR:/=\)
!if exist("$(_TCLDIR)\include\tcl.h")
-TCLH = "$(_TCLDIR)\include\tcl.h"
TCLINSTALL = 1
+_TCL_H = $(_TCLDIR)\include\tcl.h
!elseif exist("$(_TCLDIR)\generic\tcl.h")
-TCLH = "$(_TCLDIR)\generic\tcl.h"
TCLINSTALL = 0
+_TCL_H = $(_TCLDIR)\generic\tcl.h
!else
MSG =^
Failed to find tcl.h. The TCLDIR macro does not appear correct.
!error $(MSG)
!endif
!endif
+!endif
+
+#--------------------------------------------------------------
+# Extract various version numbers from tcl headers
+# The generated file is then included in the makefile.
+#--------------------------------------------------------------
+
+!if [echo REM = This file is generated from rules.vc > versions.vc]
+!endif
+!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
+ && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
+!endif
+!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
+ && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
+!endif
+!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
+ && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
+!endif
+
+# If building the tcl core then we need additional package versions
+!if "$(PROJECT)" == "tcl"
+!if [echo PKG_HTTP_VER = \>> versions.vc] \
+ && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc]
+!endif
+!if [echo PKG_TCLTEST_VER = \>> versions.vc] \
+ && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc]
+!endif
+!if [echo PKG_MSGCAT_VER = \>> versions.vc] \
+ && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc]
+!endif
+!if [echo PKG_PLATFORM_VER = \>> versions.vc] \
+ && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc]
+!endif
+!if [echo PKG_SHELL_VER = \>> versions.vc] \
+ && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc]
+!endif
+!if [echo PKG_DDE_VER = \>> versions.vc] \
+ && [nmakehlp -V ..\library\dde\pkgIndex.tcl "dde " >> versions.vc]
+!endif
+!if [echo PKG_REG_VER =\>> versions.vc] \
+ && [nmakehlp -V ..\library\reg\pkgIndex.tcl registry >> versions.vc]
+!endif
+!endif
-### TODO: add a command to nmakehlp.c to grep for Tcl's version from tcl.h.
-### Because nmake can't return a string, we'll need to play games with return
-### codes. It might look something like this:
-#!if [nmakehlp -g $(TCL.H)] == 81
-#TCL_DOTVERSION = 8.1
-#!elseif [nmakehlp -g $(TCL.H)] == 82
-#TCL_DOTVERSION = 8.2
-#...
-#!endif
+!include versions.vc
-TCL_DOTVERSION = 8.4
-TCL_VERSION = $(TCL_DOTVERSION:.=)
+#--------------------------------------------------------------
+# Setup tcl version dependent stuff headers
+#--------------------------------------------------------------
+
+!if "$(PROJECT)" != "tcl"
+
+TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
+
+!if $(TCL_VERSION) < 81
+TCL_DOES_STUBS = 0
+!else
+TCL_DOES_STUBS = 1
+!endif
!if $(TCLINSTALL)
-TCLSH = "$(_INSTALLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
-TCLSTUBLIB = "$(_INSTALLDIR)\lib\tclstub$(TCL_VERSION).lib"
-TCLIMPLIB = "$(_INSTALLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
-TCL_LIBRARY = $(_INSTALLDIR)\lib
-TCLREGLIB = "$(_INSTALLDIR)\lib\tclreg11$(SUFX:t=).lib"
-TCLDDELIB = "$(_INSTALLDIR)\lib\tcldde12$(SUFX:t=).lib"
+TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
+!if !exist($(TCLSH)) && $(TCL_THREADS)
+TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe"
+!endif
+TCLSTUBLIB = "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
+TCLIMPLIB = "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
+TCL_LIBRARY = $(_TCLDIR)\lib
+TCLREGLIB = "$(_TCLDIR)\lib\tclreg12$(SUFX:t=).lib"
+TCLDDELIB = "$(_TCLDIR)\lib\tcldde13$(SUFX:t=).lib"
COFFBASE = \must\have\tcl\sources\to\build\this\target
TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target
+TCL_INCLUDES = -I"$(_TCLDIR)\include"
!else
TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
+!if !exist($(TCLSH)) && $(TCL_THREADS)
+TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe"
+!endif
TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
TCL_LIBRARY = $(_TCLDIR)\library
-TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg11$(SUFX:t=).lib"
-TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde12$(SUFX:t=).lib"
+TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg12$(SUFX:t=).lib"
+TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde13$(SUFX:t=).lib"
COFFBASE = "$(_TCLDIR)\win\coffbase.txt"
TCLTOOLSDIR = $(_TCLDIR)\tools
+TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
!endif
!endif
+#-------------------------------------------------------------------------
+# Locate the Tk headers to build against
+#-------------------------------------------------------------------------
+
+!if "$(PROJECT)" == "tk"
+_TK_H = ..\generic\tk.h
+_INSTALLDIR = $(_INSTALLDIR)\..
+!endif
+
+!ifdef PROJECT_REQUIRES_TK
+!if !defined(TKDIR)
+!if exist("$(_INSTALLDIR)\..\include\tk.h")
+TKINSTALL = 1
+_TKDIR = $(_INSTALLDIR)\..
+_TK_H = $(_TKDIR)\include\tk.h
+TKDIR = $(_TKDIR)
+!elseif exist("$(_TCLDIR)\include\tk.h")
+TKINSTALL = 1
+_TKDIR = $(_TCLDIR)
+_TK_H = $(_TKDIR)\include\tk.h
+TKDIR = $(_TKDIR)
+!endif
+!else
+_TKDIR = $(TKDIR:/=\)
+!if exist("$(_TKDIR)\include\tk.h")
+TKINSTALL = 1
+_TK_H = $(_TKDIR)\include\tk.h
+!elseif exist("$(_TKDIR)\generic\tk.h")
+TKINSTALL = 0
+_TK_H = $(_TKDIR)\generic\tk.h
+!else
+MSG =^
+Failed to find tk.h. The TKDIR macro does not appear correct.
+!error $(MSG)
+!endif
+!endif
+!endif
+
+#-------------------------------------------------------------------------
+# Extract Tk version numbers
+#-------------------------------------------------------------------------
+
+!if defined(PROJECT_REQUIRES_TK) || "$(PROJECT)" == "tk"
+
+!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
+ && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
+!endif
+!if [echo TK_MINOR_VERSION = \>> versions.vc] \
+ && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
+!endif
+!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
+ && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
+!endif
+
+!include versions.vc
+
+TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
+TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
+
+!if "$(PROJECT)" != "tk"
+!if $(TKINSTALL)
+WISH = "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe"
+TKSTUBLIB = "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib"
+TKIMPLIB = "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib"
+TK_INCLUDES = -I"$(_TKDIR)\include"
+!else
+WISH = "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe"
+TKSTUBLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib"
+TKIMPLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib"
+TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
+!endif
+!endif
+
+!endif
#----------------------------------------------------------
# Display stats being used.
@@ -515,7 +669,8 @@ TCLTOOLSDIR = $(_TCLDIR)\tools
!message *** Suffix for binaries will be '$(SUFX)'
!message *** Optional defines are '$(OPTDEFINES)'
!message *** Compiler version $(VCVER). Target machine is $(MACHINE)
-!message *** Compiler options '$(OPTIMIZATIONS) $(DEBUGFLAGS)'
+!message *** Host architecture is $(NATIVE_ARCH)
+!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
!message *** Link options '$(LINKERFLAGS)'
!endif
diff --git a/win/stubs.c b/win/stubs.c
index 5fbc8d1..1138ccb 100644
--- a/win/stubs.c
+++ b/win/stubs.c
@@ -4,7 +4,9 @@
* Undocumented Xlib internal function
*/
-int _XInitImageFuncPtrs(XImage *image)
+int
+_XInitImageFuncPtrs(
+ XImage *image)
{
return 0;
}
@@ -14,20 +16,20 @@ int _XInitImageFuncPtrs(XImage *image)
*/
void
-XSetWMClientMachine(display, w, text_prop)
- Display* display;
- Window w;
- XTextProperty* text_prop;
+XSetWMClientMachine(
+ Display *display,
+ Window w,
+ XTextProperty *text_prop)
{
}
Status
-XStringListToTextProperty(list, count, text_prop_return)
- char** list;
- int count;
- XTextProperty* text_prop_return;
+XStringListToTextProperty(
+ char **list,
+ int count,
+ XTextProperty *text_prop_return)
{
- return (Status) NULL;
+ return (Status) 0;
}
/*
@@ -35,354 +37,347 @@ XStringListToTextProperty(list, count, text_prop_return)
*/
void
-XChangeProperty(display, w, property, type, format, mode, data, nelements)
- Display* display;
- Window w;
- Atom property;
- Atom type;
- int format;
- int mode;
- _Xconst unsigned char* data;
- int nelements;
+XChangeProperty(
+ Display *display,
+ Window w,
+ Atom property,
+ Atom type,
+ int format,
+ int mode,
+ _Xconst unsigned char *data,
+ int nelements)
{
}
Cursor
-XCreateGlyphCursor(display, source_font, mask_font, source_char, mask_char,
- foreground_color, background_color)
- Display* display;
- Font source_font;
- Font mask_font;
- unsigned int source_char;
- unsigned int mask_char;
- XColor* foreground_color;
- XColor* background_color;
+XCreateGlyphCursor(
+ Display *display,
+ Font source_font,
+ Font mask_font,
+ unsigned int source_char,
+ unsigned int mask_char,
+ XColor *foreground_color,
+ XColor *background_color)
{
return 1;
}
XIC
-XCreateIC()
+XCreateIC(void)
{
return NULL;
}
Cursor
-XCreatePixmapCursor(display, source, mask, foreground_color,
- background_color, x, y)
- Display* display;
- Pixmap source;
- Pixmap mask;
- XColor* foreground_color;
- XColor* background_color;
- unsigned int x;
- unsigned int y;
+XCreatePixmapCursor(
+ Display *display,
+ Pixmap source,
+ Pixmap mask,
+ XColor *foreground_color,
+ XColor *background_color,
+ unsigned int x,
+ unsigned int y)
{
return (Cursor) NULL;
}
void
-XDeleteProperty(display, w, property)
- Display* display;
- Window w;
- Atom property;
+XDeleteProperty(
+ Display *display,
+ Window w,
+ Atom property)
{
}
void
-XDestroyIC(ic)
- XIC ic;
+XDestroyIC(
+ XIC ic)
{
}
Bool
-XFilterEvent(event, window)
- XEvent* event;
- Window window;
+XFilterEvent(
+ XEvent *event,
+ Window window)
{
return 0;
}
-extern void XForceScreenSaver(display, mode)
- Display* display;
- int mode;
+void
+XForceScreenSaver(
+ Display *display,
+ int mode)
{
}
void
-XFreeCursor(display, cursor)
- Display* display;
- Cursor cursor;
+XFreeCursor(
+ Display *display,
+ Cursor cursor)
{
}
GContext
-XGContextFromGC(gc)
- GC gc;
+XGContextFromGC(
+ GC gc)
{
return (GContext) NULL;
}
char *
-XGetAtomName(display, atom)
- Display* display;
- Atom atom;
+XGetAtomName(
+ Display *display,
+ Atom atom)
{
return NULL;
}
int
-XGetWindowAttributes(display, w, window_attributes_return)
- Display* display;
- Window w;
- XWindowAttributes* window_attributes_return;
+XGetWindowAttributes(
+ Display *display,
+ Window w,
+ XWindowAttributes *window_attributes_return)
{
return 0;
}
Status
-XGetWMColormapWindows(display, w, windows_return, count_return)
- Display* display;
- Window w;
- Window** windows_return;
- int* count_return;
+XGetWMColormapWindows(
+ Display *display,
+ Window w,
+ Window **windows_return,
+ int *count_return)
{
- return (Status) NULL;
+ return (Status) 0;
}
int
-XIconifyWindow(display, w, screen_number)
- Display* display;
- Window w;
- int screen_number;
+XIconifyWindow(
+ Display *display,
+ Window w,
+ int screen_number)
{
return 0;
}
XHostAddress *
-XListHosts(display, nhosts_return, state_return)
- Display* display;
- int* nhosts_return;
- Bool* state_return;
+XListHosts(
+ Display *display,
+ int *nhosts_return,
+ Bool *state_return)
{
return NULL;
}
int
-XLookupColor(display, colormap, color_name, exact_def_return,
- screen_def_return)
- Display* display;
- Colormap colormap;
- _Xconst char* color_name;
- XColor* exact_def_return;
- XColor* screen_def_return;
+XLookupColor(
+ Display *display,
+ Colormap colormap,
+ _Xconst char *color_name,
+ XColor *exact_def_return,
+ XColor *screen_def_return)
{
return 0;
}
void
-XNextEvent(display, event_return)
- Display* display;
- XEvent* event_return;
+XNextEvent(
+ Display *display,
+ XEvent *event_return)
{
}
void
-XPutBackEvent(display, event)
- Display* display;
- XEvent* event;
+XPutBackEvent(
+ Display *display,
+ XEvent *event)
{
}
void
-XQueryColors(display, colormap, defs_in_out, ncolors)
- Display* display;
- Colormap colormap;
- XColor* defs_in_out;
- int ncolors;
+XQueryColors(
+ Display *display,
+ Colormap colormap,
+ XColor *defs_in_out,
+ int ncolors)
{
}
int
-XQueryTree(display, w, root_return, parent_return, children_return,
- nchildren_return)
- Display* display;
- Window w;
- Window* root_return;
- Window* parent_return;
- Window** children_return;
- unsigned int* nchildren_return;
+XQueryTree(
+ Display *display,
+ Window w,
+ Window *root_return,
+ Window *parent_return,
+ Window **children_return,
+ unsigned int *nchildren_return)
{
return 0;
}
void
-XRefreshKeyboardMapping(event_map)
- XMappingEvent* event_map;
+XRefreshKeyboardMapping(
+ XMappingEvent *event_map)
{
}
Window
-XRootWindow(display, screen_number)
- Display* display;
- int screen_number;
+XRootWindow(
+ Display *display,
+ int screen_number)
{
return (Window) NULL;
}
void
-XSelectInput(display, w, event_mask)
- Display* display;
- Window w;
- long event_mask;
+XSelectInput(
+ Display *display,
+ Window w,
+ long event_mask)
{
}
int
-XSendEvent(display, w, propagate, event_mask, event_send)
- Display* display;
- Window w;
- Bool propagate;
- long event_mask;
- XEvent* event_send;
+XSendEvent(
+ Display *display,
+ Window w,
+ Bool propagate,
+ long event_mask,
+ XEvent *event_send)
{
return 0;
}
void
-XSetCommand(display, w, argv, argc)
- Display* display;
- Window w;
- CONST char** argv;
- int argc;
+XSetCommand(
+ Display *display,
+ Window w,
+ CONST char **argv,
+ int argc)
{
}
XErrorHandler
-XSetErrorHandler (handler)
- XErrorHandler handler;
+XSetErrorHandler(
+ XErrorHandler handler)
{
return NULL;
}
void
-XSetIconName(display, w, icon_name)
- Display* display;
- Window w;
- _Xconst char* icon_name;
+XSetIconName(
+ Display *display,
+ Window w,
+ _Xconst char *icon_name)
{
}
void
-XSetWindowBackground(display, w, background_pixel)
- Display* display;
- Window w;
- unsigned long background_pixel;
+XSetWindowBackground(
+ Display *display,
+ Window w,
+ unsigned long background_pixel)
{
}
void
-XSetWindowBackgroundPixmap(display, w, background_pixmap)
- Display* display;
- Window w;
- Pixmap background_pixmap;
+XSetWindowBackgroundPixmap(
+ Display *display,
+ Window w,
+ Pixmap background_pixmap)
{
}
void
-XSetWindowBorder(display, w, border_pixel)
- Display* display;
- Window w;
- unsigned long border_pixel;
+XSetWindowBorder(
+ Display *display,
+ Window w,
+ unsigned long border_pixel)
{
}
void
-XSetWindowBorderPixmap(display, w, border_pixmap)
- Display* display;
- Window w;
- Pixmap border_pixmap;
+XSetWindowBorderPixmap(
+ Display *display,
+ Window w,
+ Pixmap border_pixmap)
{
}
void
-XSetWindowBorderWidth(display, w, width)
- Display* display;
- Window w;
- unsigned int width;
+XSetWindowBorderWidth(
+ Display *display,
+ Window w,
+ unsigned int width)
{
}
void
-XSetWindowColormap(display, w, colormap)
- Display* display;
- Window w;
- Colormap colormap;
+XSetWindowColormap(
+ Display *display,
+ Window w,
+ Colormap colormap)
{
}
Bool
-XTranslateCoordinates(display, src_w, dest_w, src_x, src_y, dest_x_return,
- dest_y_return, child_return)
- Display* display;
- Window src_w;
- Window dest_w;
- int src_x;
- int src_y;
- int* dest_x_return;
- int* dest_y_return;
- Window* child_return;
+XTranslateCoordinates(
+ Display *display,
+ Window src_w,
+ Window dest_w,
+ int src_x,
+ int src_y,
+ int *dest_x_return,
+ int *dest_y_return,
+ Window *child_return)
{
return 0;
}
void
-XWindowEvent(display, w, event_mask, event_return)
- Display* display;
- Window w;
- long event_mask;
- XEvent* event_return;
+XWindowEvent(
+ Display *display,
+ Window w,
+ long event_mask,
+ XEvent *event_return)
{
}
int
-XWithdrawWindow(display, w, screen_number)
- Display* display;
- Window w;
- int screen_number;
+XWithdrawWindow(
+ Display *display,
+ Window w,
+ int screen_number)
{
return 0;
}
int
-XmbLookupString(ic, event, buffer_return, bytes_buffer, keysym_return,
- status_return)
- XIC ic;
- XKeyPressedEvent* event;
- char* buffer_return;
- int bytes_buffer;
- KeySym* keysym_return;
- Status* status_return;
+XmbLookupString(
+ XIC ic,
+ XKeyPressedEvent *event,
+ char *buffer_return,
+ int bytes_buffer,
+ KeySym *keysym_return,
+ Status *status_return)
{
return 0;
}
int
-XGetWindowProperty(display, w, property, long_offset, long_length, delete,
- req_type, actual_type_return, actual_format_return, nitems_return,
- bytes_after_return, prop_return)
- Display* display;
- Window w;
- Atom property;
- long long_offset;
- long long_length;
- Bool delete;
- Atom req_type;
- Atom* actual_type_return;
- int* actual_format_return;
- unsigned long* nitems_return;
- unsigned long* bytes_after_return;
- unsigned char** prop_return;
+XGetWindowProperty(
+ Display *display,
+ Window w,
+ Atom property,
+ long long_offset,
+ long long_length,
+ Bool delete,
+ Atom req_type,
+ Atom *actual_type_return,
+ int *actual_format_return,
+ unsigned long *nitems_return,
+ unsigned long *bytes_after_return,
+ unsigned char **prop_return)
{
*actual_type_return = None;
*actual_format_return = 0;
diff --git a/win/tcl.m4 b/win/tcl.m4
index 82bef11..83a4ea3 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -20,15 +20,15 @@
AC_DEFUN([SC_PATH_TCLCONFIG], [
AC_MSG_CHECKING([the location of tclConfig.sh])
- if test -d ../../tcl8.4$1/win; then
- TCL_BIN_DIR_DEFAULT=../../tcl8.4$1/win
- elif test -d ../../tcl8.4/win; then
- TCL_BIN_DIR_DEFAULT=../../tcl8.4/win
+ if test -d ../../tcl8.5$1/win; then
+ TCL_BIN_DIR_DEFAULT=../../tcl8.5$1/win
+ elif test -d ../../tcl8.5/win; then
+ TCL_BIN_DIR_DEFAULT=../../tcl8.5/win
else
TCL_BIN_DIR_DEFAULT=../../tcl/win
fi
- AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR],
+ AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.5 binaries from DIR],
TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`)
if test ! -d $TCL_BIN_DIR; then
AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
@@ -60,15 +60,15 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
AC_DEFUN([SC_PATH_TKCONFIG], [
AC_MSG_CHECKING([the location of tkConfig.sh])
- if test -d ../../tk8.4$1/win; then
- TK_BIN_DIR_DEFAULT=../../tk8.4$1/win
- elif test -d ../../tk8.4/win; then
- TK_BIN_DIR_DEFAULT=../../tk8.4/win
+ if test -d ../../tk8.5$1/win; then
+ TK_BIN_DIR_DEFAULT=../../tk8.5$1/win
+ elif test -d ../../tk8.5/win; then
+ TK_BIN_DIR_DEFAULT=../../tk8.5/win
else
TK_BIN_DIR_DEFAULT=../../tk/win
fi
- AC_ARG_WITH(tk, [ --with-tk=DIR use Tk 8.4 binaries from DIR],
+ AC_ARG_WITH(tk, [ --with-tk=DIR use Tk 8.5 binaries from DIR],
TK_BIN_DIR=$withval, TK_BIN_DIR=`cd $TK_BIN_DIR_DEFAULT; pwd`)
if test ! -d $TK_BIN_DIR; then
AC_MSG_ERROR(Tk directory $TK_BIN_DIR does not exist)
@@ -301,6 +301,8 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
DBGX=""
AC_MSG_RESULT([no])
+
+ AC_DEFINE(TCL_CFG_OPTIMIZED)
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
@@ -311,6 +313,7 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
fi
AC_SUBST(CFLAGS_DEFAULT)
AC_SUBST(LDFLAGS_DEFAULT)
+ AC_DEFINE(TCL_CFG_DEBUG)
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
AC_DEFINE(TCL_MEM_DEBUG)
@@ -445,8 +448,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
if test "${GCC}" = "yes" ; then
SHLIB_LD=""
SHLIB_LD_LIBS=""
- LIBS=""
- LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32"
+ LIBS="-lws2_32"
+ # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't
+ LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32"
STLIB_LD='${AR} cr'
RC_OUT=-o
RC_TYPE=
@@ -519,7 +523,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -fno-strict-aliasing"
+ CFLAGS_WARNING="-Wall"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -624,13 +628,17 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
fi
fi
- LIBS="user32.lib advapi32.lib"
+ LIBS="user32.lib advapi32.lib ws2_32.lib"
if test "$do64bit" != "no" ; then
# The space-based-path will work for the Makefile, but will
# not work if AC_TRY_COMPILE is called. TEA has the
# TEA_PATH_NOSPACE to avoid this issue.
- CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
- -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
+ # Check if _WIN64 is already recognized, and if so we don't
+ # need to modify CC.
+ AC_CHECK_DECL([_WIN64], [],
+ [CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
+ -I\"${MSSDK}/Include/crt\" \
+ -I\"${MSSDK}/Include/crt/sys\""])
RC="\"${MSSDK}/bin/rc.exe\""
CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
# Do not use -O2 for Win64 - this has proved buggy in code gen.
@@ -741,7 +749,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\""
LIBS_GUI="commctrl.lib commdlg.lib"
else
- LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib"
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib"
fi
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
@@ -780,6 +788,10 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
fi
fi
+ if test "$do64bit" != "no" ; then
+ AC_DEFINE(TCL_CFG_DO64BIT)
+ fi
+
# DL_LIBS is empty, but then we match the Unix version
AC_SUBST(DL_LIBS)
AC_SUBST(CFLAGS_DEBUG)
@@ -805,13 +817,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
#------------------------------------------------------------------------
AC_DEFUN([SC_WITH_TCL], [
- if test -d ../../tcl8.4$1/win; then
- TCL_BIN_DEFAULT=../../tcl8.4$1/win
+ if test -d ../../tcl8.5$1/win; then
+ TCL_BIN_DEFAULT=../../tcl8.5$1/win
else
- TCL_BIN_DEFAULT=../../tcl8.4/win
+ TCL_BIN_DEFAULT=../../tcl8.5/win
fi
- AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR],
+ AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.5 binaries from DIR],
TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`)
if test ! -d $TCL_BIN_DIR; then
AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
@@ -898,6 +910,34 @@ AC_DEFUN([SC_BUILD_TCLSH], [
])
#--------------------------------------------------------------------
+# SC_TCL_CFG_ENCODING TIP #59
+#
+# Declare the encoding to use for embedded configuration information.
+#
+# Arguments:
+# None.
+#
+# Results:
+# Might append to the following vars:
+# DEFS (implicit)
+#
+# Will define the following vars:
+# TCL_CFGVAL_ENCODING
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_CFG_ENCODING], [
+ AC_ARG_WITH(encoding, [ --with-encoding encoding for configuration values], with_tcencoding=${withval})
+
+ if test x"${with_tcencoding}" != x ; then
+ AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}")
+ else
+ # Default encoding on windows is not "iso8859-1"
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"cp1252")
+ fi
+])
+
+#--------------------------------------------------------------------
# SC_EMBED_MANIFEST
#
# Figure out if we can embed the manifest where necessary
@@ -915,11 +955,12 @@ AC_DEFUN([SC_BUILD_TCLSH], [
AC_DEFUN([SC_EMBED_MANIFEST], [
AC_MSG_CHECKING(whether to embed manifest)
AC_ARG_ENABLE(embedded-manifest,
- [ --enable-embedded-manifest embed manifest if possible (default: yes)],
+ AC_HELP_STRING([--enable-embedded-manifest],
+ [embed manifest if possible (default: yes)]),
[embed_ok=$enableval], [embed_ok=yes])
- VC_MANIFEST_EMBED_DLL=
- VC_MANIFEST_EMBED_EXE=
+ VC_MANIFEST_EMBED_DLL=
+ VC_MANIFEST_EMBED_EXE=
result=no
if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \
-a "$GCC" != "yes" ; then
@@ -932,8 +973,11 @@ print("manifest needed")
# Could do a CHECK_PROG for mt, but should always be with MSVC8+
# Could add 'if test -f' check, but manifest should be created
# in this compiler case
- VC_MANIFEST_EMBED_DLL="mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;2"
- VC_MANIFEST_EMBED_EXE="mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;1"
+ # Add in a manifest argument that may be specified
+ # XXX Needs improvement so that the test for existence accounts
+ # XXX for a provided (known) manifest
+ VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;2 ; fi"
+ VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;1 ; fi"
result=yes
if test "x$1" != x ; then
result="yes ($1)"
diff --git a/win/tkConfig.sh.in b/win/tkConfig.sh.in
index 0c53602..7816b15 100644
--- a/win/tkConfig.sh.in
+++ b/win/tkConfig.sh.in
@@ -11,6 +11,8 @@
#
# The information in this file is specific to a single platform.
+TK_DLL_FILE="@TK_DLL_FILE@"
+
# Tk's version number.
TK_VERSION='@TK_VERSION@'
TK_MAJOR_VERSION='@TK_MAJOR_VERSION@'
diff --git a/win/tkWin.h b/win/tkWin.h
index 7c8eb59..d97adc7 100644
--- a/win/tkWin.h
+++ b/win/tkWin.h
@@ -13,6 +13,21 @@
#ifndef _TKWIN
#define _TKWIN
+/*
+ * We must specify the lower version we intend to support. In particular
+ * the SystemParametersInfo API doesn't like to receive structures that
+ * are larger than it expects which affects the font assignements.
+ *
+ * WINVER = 0x0410 means Windows 98 and above
+ */
+
+#ifndef WINVER
+#define WINVER 0x0410
+#endif
+#ifndef _WIN32_WINDOWS
+#define _WIN32_WINDOWS 0x0410
+#endif
+
#ifndef _TK
#include <tk.h>
#endif
@@ -27,14 +42,35 @@
#endif
/*
- * The following messages are use to communicate between a Tk toplevel
- * and its container window.
+ * The following messages are used to communicate between a Tk toplevel
+ * and its container window. A Tk container may not be able to provide
+ * service to all of the following requests at the moment. But an embedded
+ * Tk window will send out these requests to support external Tk container
+ * application.
*/
-#define TK_CLAIMFOCUS (WM_USER)
-#define TK_GEOMETRYREQ (WM_USER+1)
-#define TK_ATTACHWINDOW (WM_USER+2)
-#define TK_DETACHWINDOW (WM_USER+3)
+#define TK_CLAIMFOCUS (WM_USER) /* an embedded window requests to focus */
+#define TK_GEOMETRYREQ (WM_USER+1) /* an embedded window requests to change size */
+#define TK_ATTACHWINDOW (WM_USER+2) /* an embedded window requests to attach */
+#define TK_DETACHWINDOW (WM_USER+3) /* an embedded window requests to detach */
+#define TK_MOVEWINDOW (WM_USER+4) /* an embedded window requests to move */
+#define TK_RAISEWINDOW (WM_USER+5) /* an embedded window requests to raise */
+#define TK_ICONIFY (WM_USER+6) /* an embedded window requests to iconify */
+#define TK_DEICONIFY (WM_USER+7) /* an embedded window requests to deiconify */
+#define TK_WITHDRAW (WM_USER+8) /* an embedded window requests to withdraw */
+#define TK_GETFRAMEWID (WM_USER+9) /* an embedded window requests a frame window id */
+#define TK_OVERRIDEREDIRECT (WM_USER+10) /* an embedded window requests to overrideredirect */
+#define TK_SETMENU (WM_USER+11) /* an embedded window requests to setup menu */
+#define TK_STATE (WM_USER+12) /* an embedded window sets/gets state */
+#define TK_INFO (WM_USER+13) /* an embedded window requests a container's info */
+
+/*
+ * The following are sub-messages (wParam) for TK_INFO. An embedded window may
+ * send a TK_INFO message with one of the sub-messages to query a container
+ * for verification and availability
+ */
+#define TK_CONTAINER_VERIFY 0x01
+#define TK_CONTAINER_ISAVAILABLE 0x02
/*
diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c
index cd9942a..efefe86 100644
--- a/win/tkWin32Dll.c
+++ b/win/tkWin32Dll.c
@@ -5,8 +5,8 @@
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
@@ -66,10 +66,10 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
*/
BOOL APIENTRY
-DllEntryPoint(hInst, reason, reserved)
- HINSTANCE hInst; /* Library instance handle. */
- DWORD reason; /* Reason this function is being called. */
- LPVOID reserved; /* Not used. */
+DllEntryPoint(
+ HINSTANCE hInst, /* Library instance handle. */
+ DWORD reason, /* Reason this function is being called. */
+ LPVOID reserved) /* Not used. */
{
return DllMain(hInst, reason, reserved);
}
@@ -95,11 +95,11 @@ DllEntryPoint(hInst, reason, reserved)
*----------------------------------------------------------------------
*/
-BOOL WINAPI
-DllMain(hInstance, reason, reserved)
- HINSTANCE hInstance;
- DWORD reason;
- LPVOID reserved;
+BOOL APIENTRY
+DllMain(
+ HINSTANCE hInstance,
+ DWORD reason,
+ LPVOID reserved)
{
#ifdef HAVE_NO_SEH
EXCEPTION_REGISTRATION registration;
@@ -150,7 +150,7 @@ DllMain(hInstance, reason, reserved)
* Call TkFinalize
*/
- "movq $0x0, %%rcx" "\n\t"
+ "movq $0x0, 0x0(%%esp)" "\n\t"
"call TkFinalize" "\n\t"
/*
diff --git a/win/tkWin3d.c b/win/tkWin3d.c
index 8b541e7..df6aa95 100644
--- a/win/tkWin3d.c
+++ b/win/tkWin3d.c
@@ -1,29 +1,28 @@
-/*
+/*
* tkWin3d.c --
*
- * This file contains the platform specific routines for
- * drawing 3d borders in the Windows 95 style.
+ * This file contains the platform specific routines for drawing 3D
+ * borders in the Windows 95 style.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
#include "tk3d.h"
/*
- * This structure is used to keep track of the extra colors used by
- * Windows 3d borders.
+ * This structure is used to keep track of the extra colors used by Windows 3D
+ * borders.
*/
typedef struct {
TkBorder info;
- XColor *light2ColorPtr; /* System3dLight */
- XColor *dark2ColorPtr; /* System3dDarkShadow */
+ XColor *light2ColorPtr; /* System3dLight */
+ XColor *dark2ColorPtr; /* System3dDarkShadow */
} WinBorder;
-
/*
*----------------------------------------------------------------------
@@ -42,9 +41,10 @@ typedef struct {
*/
TkBorder *
-TkpGetBorder()
+TkpGetBorder(void)
{
WinBorder *borderPtr = (WinBorder *) ckalloc(sizeof(WinBorder));
+
borderPtr->light2ColorPtr = NULL;
borderPtr->dark2ColorPtr = NULL;
return (TkBorder *) borderPtr;
@@ -55,8 +55,8 @@ TkpGetBorder()
*
* TkpFreeBorder --
*
- * This function frees any colors allocated by the platform
- * specific part of this module.
+ * This function frees any colors allocated by the platform specific part
+ * of this module.
*
* Results:
* None.
@@ -68,8 +68,8 @@ TkpGetBorder()
*/
void
-TkpFreeBorder(borderPtr)
- TkBorder *borderPtr;
+TkpFreeBorder(
+ TkBorder *borderPtr)
{
WinBorder *winBorderPtr = (WinBorder *) borderPtr;
if (winBorderPtr->light2ColorPtr) {
@@ -85,18 +85,17 @@ TkpFreeBorder(borderPtr)
*
* Tk_3DVerticalBevel --
*
- * This procedure draws a vertical bevel along one side of
- * an object. The bevel is always rectangular in shape:
+ * This procedure draws a vertical bevel along one side of an object. The
+ * bevel is always rectangular in shape:
* |||
* |||
* |||
* |||
* |||
* |||
- * An appropriate shadow color is chosen for the bevel based
- * on the leftBevel and relief arguments. Normally this
- * procedure is called first, then Tk_3DHorizontalBevel is
- * called next to draw neat corners.
+ * An appropriate shadow color is chosen for the bevel based on the
+ * leftBevel and relief arguments. Normally this procedure is called
+ * first, then Tk_3DHorizontalBevel is called next to draw neat corners.
*
* Results:
* None.
@@ -108,22 +107,21 @@ TkpFreeBorder(borderPtr)
*/
void
-Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
- leftBevel, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Area of vertical bevel. */
- int leftBevel; /* Non-zero means this bevel forms the
- * left side of the object; 0 means it
- * forms the right side. */
- int relief; /* Kind of bevel to draw. For example,
- * TK_RELIEF_RAISED means interior of
- * object should appear higher than
- * exterior. */
+Tk_3DVerticalBevel(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Area of vertical bevel. */
+ int leftBevel, /* Non-zero means this bevel forms the left
+ * side of the object; 0 means it forms the
+ * right side. */
+ int relief) /* Kind of bevel to draw. For example,
+ * TK_RELIEF_RAISED means interior of object
+ * should appear higher than exterior. */
{
TkBorder *borderPtr = (TkBorder *) border;
- int left = 0, right = 0;
+ int left, right;
Display *display = Tk_Display(tkwin);
TkWinDCState state;
HDC dc = TkWinGetDrawableDC(display, drawable, &state);
@@ -134,36 +132,37 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
}
switch (relief) {
- case TK_RELIEF_RAISED:
- left = (leftBevel)
+ case TK_RELIEF_RAISED:
+ left = (leftBevel)
? borderPtr->lightGC->foreground
: borderPtr->darkGC->foreground;
- right = (leftBevel)
+ right = (leftBevel)
? ((WinBorder *)borderPtr)->light2ColorPtr->pixel
: ((WinBorder *)borderPtr)->dark2ColorPtr->pixel;
- break;
- case TK_RELIEF_SUNKEN:
- left = (leftBevel)
- ? ((WinBorder *)borderPtr)->dark2ColorPtr->pixel
- : ((WinBorder *)borderPtr)->light2ColorPtr->pixel;
- right = (leftBevel)
+ break;
+ case TK_RELIEF_SUNKEN:
+ left = (leftBevel)
? borderPtr->darkGC->foreground
+ : ((WinBorder *)borderPtr)->light2ColorPtr->pixel;
+ right = (leftBevel)
+ ? ((WinBorder *)borderPtr)->dark2ColorPtr->pixel
: borderPtr->lightGC->foreground;
- break;
- case TK_RELIEF_RIDGE:
- left = borderPtr->lightGC->foreground;
- right = borderPtr->darkGC->foreground;
- break;
- case TK_RELIEF_GROOVE:
- left = borderPtr->darkGC->foreground;
- right = borderPtr->lightGC->foreground;
- break;
- case TK_RELIEF_FLAT:
- left = right = borderPtr->bgGC->foreground;
- break;
- case TK_RELIEF_SOLID:
- left = right = RGB(0,0,0);
- break;
+ break;
+ case TK_RELIEF_RIDGE:
+ left = borderPtr->lightGC->foreground;
+ right = borderPtr->darkGC->foreground;
+ break;
+ case TK_RELIEF_GROOVE:
+ left = borderPtr->darkGC->foreground;
+ right = borderPtr->lightGC->foreground;
+ break;
+ case TK_RELIEF_FLAT:
+ left = right = borderPtr->bgGC->foreground;
+ break;
+ case TK_RELIEF_SOLID:
+ default:
+ left = right = RGB(0,0,0);
+ break;
}
half = width/2;
if (leftBevel && (width & 1)) {
@@ -179,9 +178,9 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
*
* Tk_3DHorizontalBevel --
*
- * This procedure draws a horizontal bevel along one side of
- * an object. The bevel has mitered corners (depending on
- * leftIn and rightIn arguments).
+ * This procedure draws a horizontal bevel along one side of an object.
+ * The bevel has mitered corners (depending on leftIn and rightIn
+ * arguments).
*
* Results:
* None.
@@ -193,77 +192,76 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
*/
void
-Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
- leftIn, rightIn, topBevel, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Bounding box of area of bevel. Height
- * gives width of border. */
- int leftIn, rightIn; /* Describes whether the left and right
- * edges of the bevel angle in or out as
- * they go down. For example, if "leftIn"
- * is true, the left side of the bevel
- * looks like this:
+Tk_3DHorizontalBevel(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Bounding box of area of bevel. Height gives
+ * width of border. */
+ int leftIn, int rightIn, /* Describes whether the left and right edges
+ * of the bevel angle in or out as they go
+ * down. For example, if "leftIn" is true, the
+ * left side of the bevel looks like this:
* ___________
* __________
* _________
* ________
*/
- int topBevel; /* Non-zero means this bevel forms the
- * top side of the object; 0 means it
- * forms the bottom side. */
- int relief; /* Kind of bevel to draw. For example,
- * TK_RELIEF_RAISED means interior of
- * object should appear higher than
- * exterior. */
+ int topBevel, /* Non-zero means this bevel forms the top
+ * side of the object; 0 means it forms the
+ * bottom side. */
+ int relief) /* Kind of bevel to draw. For example,
+ * TK_RELIEF_RAISED means interior of object
+ * should appear higher than exterior. */
{
TkBorder *borderPtr = (TkBorder *) border;
Display *display = Tk_Display(tkwin);
int bottom, halfway, x1, x2, x1Delta, x2Delta;
TkWinDCState state;
HDC dc = TkWinGetDrawableDC(display, drawable, &state);
- int topColor = 0, bottomColor = 0;
+ int topColor, bottomColor;
if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) {
TkpGetShadows(borderPtr, tkwin);
}
/*
- * Compute a GC for the top half of the bevel and a GC for the
- * bottom half (they're the same in many cases).
+ * Compute a GC for the top half of the bevel and a GC for the bottom half
+ * (they're the same in many cases).
*/
switch (relief) {
- case TK_RELIEF_RAISED:
- topColor = (topBevel)
+ case TK_RELIEF_RAISED:
+ topColor = (topBevel)
? borderPtr->lightGC->foreground
: borderPtr->darkGC->foreground;
- bottomColor = (topBevel)
+ bottomColor = (topBevel)
? ((WinBorder *)borderPtr)->light2ColorPtr->pixel
: ((WinBorder *)borderPtr)->dark2ColorPtr->pixel;
- break;
- case TK_RELIEF_SUNKEN:
- topColor = (topBevel)
- ? ((WinBorder *)borderPtr)->dark2ColorPtr->pixel
- : ((WinBorder *)borderPtr)->light2ColorPtr->pixel;
- bottomColor = (topBevel)
+ break;
+ case TK_RELIEF_SUNKEN:
+ topColor = (topBevel)
? borderPtr->darkGC->foreground
+ : ((WinBorder *)borderPtr)->light2ColorPtr->pixel;
+ bottomColor = (topBevel)
+ ? ((WinBorder *)borderPtr)->dark2ColorPtr->pixel
: borderPtr->lightGC->foreground;
- break;
- case TK_RELIEF_RIDGE:
- topColor = borderPtr->lightGC->foreground;
- bottomColor = borderPtr->darkGC->foreground;
- break;
- case TK_RELIEF_GROOVE:
- topColor = borderPtr->darkGC->foreground;
- bottomColor = borderPtr->lightGC->foreground;
- break;
- case TK_RELIEF_FLAT:
- topColor = bottomColor = borderPtr->bgGC->foreground;
- break;
- case TK_RELIEF_SOLID:
- topColor = bottomColor = RGB(0,0,0);
+ break;
+ case TK_RELIEF_RIDGE:
+ topColor = borderPtr->lightGC->foreground;
+ bottomColor = borderPtr->darkGC->foreground;
+ break;
+ case TK_RELIEF_GROOVE:
+ topColor = borderPtr->darkGC->foreground;
+ bottomColor = borderPtr->lightGC->foreground;
+ break;
+ case TK_RELIEF_FLAT:
+ topColor = bottomColor = borderPtr->bgGC->foreground;
+ break;
+ case TK_RELIEF_SOLID:
+ default:
+ topColor = bottomColor = RGB(0,0,0);
}
/*
@@ -296,8 +294,7 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
for ( ; y < bottom; y++) {
/*
* In some weird cases (such as large border widths for skinny
- * rectangles) x1 can be >= x2. Don't draw the lines
- * in these cases.
+ * rectangles) x1 can be >= x2. Don't draw the lines in these cases.
*/
if (x1 < x2) {
@@ -315,27 +312,26 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
*
* TkpGetShadows --
*
- * This procedure computes the shadow colors for a 3-D border
- * and fills in the corresponding fields of the Border structure.
- * It's called lazily, so that the colors aren't allocated until
- * something is actually drawn with them. That way, if a border
- * is only used for flat backgrounds the shadow colors will
- * never be allocated.
+ * This procedure computes the shadow colors for a 3-D border and fills
+ * in the corresponding fields of the Border structure. It's called
+ * lazily, so that the colors aren't allocated until something is
+ * actually drawn with them. That way, if a border is only used for flat
+ * backgrounds the shadow colors will never be allocated.
*
* Results:
* None.
*
* Side effects:
- * The lightGC and darkGC fields in borderPtr get filled in,
- * if they weren't already.
+ * The lightGC and darkGC fields in borderPtr get filled in, if they
+ * weren't already.
*
*----------------------------------------------------------------------
*/
void
-TkpGetShadows(borderPtr, tkwin)
- TkBorder *borderPtr; /* Information about border. */
- Tk_Window tkwin; /* Window where border will be used for
+TkpGetShadows(
+ TkBorder *borderPtr, /* Information about border. */
+ Tk_Window tkwin) /* Window where border will be used for
* drawing. */
{
XColor lightColor, darkColor;
@@ -352,13 +348,13 @@ TkpGetShadows(borderPtr, tkwin)
*/
if ((TkWinIndexOfColor(borderPtr->bgColorPtr) == COLOR_3DFACE)
- || (TkWinIndexOfColor(borderPtr->bgColorPtr) == COLOR_WINDOW)) {
+ || (TkWinIndexOfColor(borderPtr->bgColorPtr) == COLOR_WINDOW)) {
borderPtr->darkColorPtr = Tk_GetColor(NULL, tkwin,
- Tk_GetUid("SystemButtonShadow"));
+ Tk_GetUid("SystemButtonShadow"));
gcValues.foreground = borderPtr->darkColorPtr->pixel;
borderPtr->darkGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
borderPtr->lightColorPtr = Tk_GetColor(NULL, tkwin,
- Tk_GetUid("SystemButtonHighlight"));
+ Tk_GetUid("SystemButtonHighlight"));
gcValues.foreground = borderPtr->lightColorPtr->pixel;
borderPtr->lightGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
((WinBorder*)borderPtr)->dark2ColorPtr = Tk_GetColor(NULL, tkwin,
@@ -366,45 +362,42 @@ TkpGetShadows(borderPtr, tkwin)
((WinBorder*)borderPtr)->light2ColorPtr = Tk_GetColor(NULL, tkwin,
Tk_GetUid("System3dLight"));
return;
- } else {
- darkColor.red = 0;
- darkColor.green = 0;
- darkColor.blue = 0;
- ((WinBorder*)borderPtr)->dark2ColorPtr = Tk_GetColorByValue(tkwin,
+ }
+ darkColor.red = 0;
+ darkColor.green = 0;
+ darkColor.blue = 0;
+ ((WinBorder*)borderPtr)->dark2ColorPtr = Tk_GetColorByValue(tkwin,
&darkColor);
- lightColor = *(borderPtr->bgColorPtr);
- ((WinBorder*)borderPtr)->light2ColorPtr = Tk_GetColorByValue(tkwin,
+ lightColor = *(borderPtr->bgColorPtr);
+ ((WinBorder*)borderPtr)->light2ColorPtr = Tk_GetColorByValue(tkwin,
&lightColor);
- }
-
+
/*
- * First, handle the case of a color display with lots of colors.
- * The shadow colors get computed using whichever formula results
- * in the greatest change in color:
- * 1. Lighter shadow is half-way to white, darker shadow is half
- * way to dark.
- * 2. Lighter shadow is 40% brighter than background, darker shadow
- * is 40% darker than background.
+ * First, handle the case of a color display with lots of colors. The
+ * shadow colors get computed using whichever formula results in the
+ * greatest change in color:
+ * 1. Lighter shadow is half-way to white, darker shadow is half way to
+ * dark.
+ * 2. Lighter shadow is 40% brighter than background, darker shadow is 40%
+ * darker than background.
*/
if (Tk_Depth(tkwin) >= 6) {
/*
- * This is a color display with lots of colors. For the dark
- * shadow, cut 40% from each of the background color components.
- * But if the background is already very dark, make the
- * dark color a little lighter than the background by increasing
- * each color component 1/4th of the way to MAX_INTENSITY.
+ * This is a color display with lots of colors. For the dark shadow,
+ * cut 40% from each of the background color components. But if the
+ * background is already very dark, make the dark color a little
+ * lighter than the background by increasing each color component
+ * 1/4th of the way to MAX_INTENSITY.
*
- * For the light shadow, boost each component by 40% or half-way
- * to white, whichever is greater (the first approach works
- * better for unsaturated colors, the second for saturated ones).
- * But if the background is already very bright, instead choose a
- * slightly darker color for the light shadow by reducing each
- * color component by 10%.
+ * For the light shadow, boost each component by 40% or half-way to
+ * white, whichever is greater (the first approach works better for
+ * unsaturated colors, the second for saturated ones). But if the
+ * background is already very bright, instead choose a slightly darker
+ * color for the light shadow by reducing each color component by 10%.
*
- * Compute the colors using integers, not using lightColor.red
- * etc.: these are shorts and may have problems with integer
- * overflow.
+ * Compute the colors using integers, not using lightColor.red etc.:
+ * these are shorts and may have problems with integer overflow.
*/
/*
@@ -461,10 +454,10 @@ TkpGetShadows(borderPtr, tkwin)
tmp2 = (MAX_INTENSITY + b)/2;
lightColor.blue = (tmp1 > tmp2) ? tmp1 : tmp2;
}
-
- /*
- * Allocate the light shadow color and its GC
- */
+
+ /*
+ * Allocate the light shadow color and its GC
+ */
borderPtr->lightColorPtr = Tk_GetColorByValue(tkwin, &lightColor);
gcValues.foreground = borderPtr->lightColorPtr->pixel;
@@ -476,15 +469,15 @@ TkpGetShadows(borderPtr, tkwin)
borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin,
Tk_GetUid("gray50"));
if (borderPtr->shadow == None) {
- panic("TkpGetShadows couldn't allocate bitmap for border");
+ Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border");
}
}
if (borderPtr->visual->map_entries > 2) {
/*
- * This isn't a monochrome display, but the colormap either
- * ran out of entries or didn't have very many to begin with.
- * Generate the light shadows with a white stipple and the
- * dark shadows with a black stipple.
+ * This isn't a monochrome display, but the colormap either ran out of
+ * entries or didn't have very many to begin with. Generate the light
+ * shadows with a white stipple and the dark shadows with a black
+ * stipple.
*/
gcValues.foreground = borderPtr->bgColorPtr->pixel;
@@ -502,8 +495,8 @@ TkpGetShadows(borderPtr, tkwin)
/*
* This is just a measly monochrome display, hardly even worth its
- * existence on this earth. Make one shadow a 50% stipple and the
- * other the opposite of the background.
+ * existence on this earth. Make one shadow a 50% stipple and the other
+ * the opposite of the background.
*/
gcValues.foreground = WhitePixelOfScreen(borderPtr->screen);
@@ -527,8 +520,7 @@ TkpGetShadows(borderPtr, tkwin)
*
* TkWinGetBorderPixels --
*
- * This routine returns the 5 COLORREFs used to draw a given
- * 3d border.
+ * This routine returns the 5 COLORREFs used to draw a given 3d border.
*
* Results:
* Returns the colors in the specified array.
@@ -540,34 +532,42 @@ TkpGetShadows(borderPtr, tkwin)
*/
COLORREF
-TkWinGetBorderPixels(tkwin, border, which)
- Tk_Window tkwin;
- Tk_3DBorder border;
- int which; /* One of TK_3D_FLAT_GC, TK_3D_LIGHT_GC,
+TkWinGetBorderPixels(
+ Tk_Window tkwin,
+ Tk_3DBorder border,
+ int which) /* One of TK_3D_FLAT_GC, TK_3D_LIGHT_GC,
* TK_3D_DARK_GC, TK_3D_LIGHT2, TK_3D_DARK2 */
{
WinBorder *borderPtr = (WinBorder *) border;
-
+
if (borderPtr->info.lightGC == None) {
TkpGetShadows(&borderPtr->info, tkwin);
}
switch (which) {
- case TK_3D_FLAT_GC:
- return borderPtr->info.bgColorPtr->pixel;
- case TK_3D_LIGHT_GC:
- if (borderPtr->info.lightColorPtr == NULL) {
- return WhitePixelOfScreen(borderPtr->info.screen);
- }
- return borderPtr->info.lightColorPtr->pixel;
- case TK_3D_DARK_GC:
- if (borderPtr->info.darkColorPtr == NULL) {
- return BlackPixelOfScreen(borderPtr->info.screen);
- }
- return borderPtr->info.darkColorPtr->pixel;
- case TK_3D_LIGHT2:
- return borderPtr->light2ColorPtr->pixel;
- case TK_3D_DARK2:
- return borderPtr->dark2ColorPtr->pixel;
+ case TK_3D_FLAT_GC:
+ return borderPtr->info.bgColorPtr->pixel;
+ case TK_3D_LIGHT_GC:
+ if (borderPtr->info.lightColorPtr == NULL) {
+ return WhitePixelOfScreen(borderPtr->info.screen);
+ }
+ return borderPtr->info.lightColorPtr->pixel;
+ case TK_3D_DARK_GC:
+ if (borderPtr->info.darkColorPtr == NULL) {
+ return BlackPixelOfScreen(borderPtr->info.screen);
+ }
+ return borderPtr->info.darkColorPtr->pixel;
+ case TK_3D_LIGHT2:
+ return borderPtr->light2ColorPtr->pixel;
+ case TK_3D_DARK2:
+ return borderPtr->dark2ColorPtr->pixel;
}
return 0;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index a002b9c..af1058d 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -19,9 +19,9 @@
*/
#define LABEL_STYLE (BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS)
-#define PUSH_STYLE (BS_OWNERDRAW | BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS)
-#define CHECK_STYLE (BS_OWNERDRAW | BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS)
-#define RADIO_STYLE (BS_OWNERDRAW | BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS)
+#define PUSH_STYLE (LABEL_STYLE | BS_PUSHBUTTON)
+#define CHECK_STYLE (LABEL_STYLE | BS_CHECKBOX)
+#define RADIO_STYLE (LABEL_STYLE | BS_RADIOBUTTON)
/*
* Declaration of Windows specific button structure.
@@ -64,11 +64,11 @@ enum {
*/
typedef struct ThreadSpecificData {
- BITMAPINFOHEADER *boxesPtr; /* Information about the bitmap. */
- DWORD *boxesPalette; /* Pointer to color palette. */
- LPSTR boxesBits; /* Pointer to bitmap data. */
- DWORD boxHeight; /* Height of each sub-image. */
- DWORD boxWidth ; /* Width of each sub-image. */
+ BITMAPINFOHEADER *boxesPtr; /* Information about the bitmap. */
+ DWORD *boxesPalette; /* Pointer to color palette. */
+ LPSTR boxesBits; /* Pointer to bitmap data. */
+ DWORD boxHeight; /* Height of each sub-image. */
+ DWORD boxWidth; /* Width of each sub-image. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -76,11 +76,11 @@ static Tcl_ThreadDataKey dataKey;
* Declarations for functions defined in this file.
*/
-static LRESULT CALLBACK ButtonProc _ANSI_ARGS_((HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam));
-static Window CreateProc _ANSI_ARGS_((Tk_Window tkwin,
- Window parent, ClientData instanceData));
-static void InitBoxes _ANSI_ARGS_((void));
+static LRESULT CALLBACK ButtonProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+static Window CreateProc(Tk_Window tkwin, Window parent,
+ ClientData instanceData);
+static void InitBoxes(void);
/*
* The class procedure table for the button widgets.
@@ -90,6 +90,7 @@ Tk_ClassProcs tkpButtonProcs = {
sizeof(Tk_ClassProcs), /* size */
TkButtonWorldChanged, /* worldChangedProc */
CreateProc, /* createProc */
+ NULL
};
@@ -98,13 +99,13 @@ Tk_ClassProcs tkpButtonProcs = {
*
* InitBoxes --
*
- * This function load the Tk 3d button bitmap. "buttons" is a 16
- * color bitmap that is laid out such that the top row contains
- * the 4 checkbox images, and the bottom row contains the radio
- * button images. Note that the bitmap is stored in bottom-up
- * format. Also, the first seven palette entries are used to
- * identify the different parts of the bitmaps so we can do the
- * appropriate color mappings based on the current button colors.
+ * This function load the Tk 3d button bitmap. "buttons" is a 16 color
+ * bitmap that is laid out such that the top row contains the 4 checkbox
+ * images, and the bottom row contains the radio button images. Note that
+ * the bitmap is stored in bottom-up format. Also, the first seven
+ * palette entries are used to identify the different parts of the
+ * bitmaps so we can do the appropriate color mappings based on the
+ * current button colors.
*
* Results:
* None.
@@ -116,7 +117,7 @@ Tk_ClassProcs tkpButtonProcs = {
*/
static void
-InitBoxes()
+InitBoxes(void)
{
/*
* For DLLs like Tk, the HINSTANCE is the same as the HMODULE.
@@ -127,11 +128,14 @@ InitBoxes()
HGLOBAL hblk;
LPBITMAPINFOHEADER newBitmap;
DWORD size;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
hrsrc = FindResource(module, "buttons", RT_BITMAP);
- if (hrsrc) {
+ if (hrsrc == NULL) {
+ Tcl_Panic("FindResource() failed for buttons bitmap resource, "
+ "resources in tk_base.rc must be linked into Tk dll or static executable");
+ } else {
hblk = LoadResource(module, hrsrc);
tsdPtr->boxesPtr = (LPBITMAPINFOHEADER)LockResource(hblk);
}
@@ -142,15 +146,15 @@ InitBoxes()
if (tsdPtr->boxesPtr != NULL && !(tsdPtr->boxesPtr->biWidth % 4)
&& !(tsdPtr->boxesPtr->biHeight % 2)) {
- size = tsdPtr->boxesPtr->biSize + (1 << tsdPtr->boxesPtr->biBitCount)
- * sizeof(RGBQUAD) + tsdPtr->boxesPtr->biSizeImage;
+ size = tsdPtr->boxesPtr->biSize + (1 << tsdPtr->boxesPtr->biBitCount)
+ * sizeof(RGBQUAD) + tsdPtr->boxesPtr->biSizeImage;
newBitmap = (LPBITMAPINFOHEADER) ckalloc(size);
memcpy(newBitmap, tsdPtr->boxesPtr, size);
tsdPtr->boxesPtr = newBitmap;
tsdPtr->boxWidth = tsdPtr->boxesPtr->biWidth / 4;
tsdPtr->boxHeight = tsdPtr->boxesPtr->biHeight / 2;
- tsdPtr->boxesPalette = (DWORD*) (((LPSTR) tsdPtr->boxesPtr)
- + tsdPtr->boxesPtr->biSize);
+ tsdPtr->boxesPalette = (DWORD*) (((LPSTR) tsdPtr->boxesPtr)
+ + tsdPtr->boxesPtr->biSize);
tsdPtr->boxesBits = ((LPSTR) tsdPtr->boxesPalette)
+ ((1 << tsdPtr->boxesPtr->biBitCount) * sizeof(RGBQUAD));
} else {
@@ -164,8 +168,8 @@ InitBoxes()
* TkpButtonSetDefaults --
*
* This procedure is invoked before option tables are created for
- * buttons. It modifies some of the default values to match the
- * current values defined for this platform.
+ * buttons. It modifies some of the default values to match the current
+ * values defined for this platform.
*
* Results:
* Some of the default values in *specPtr are modified.
@@ -177,8 +181,8 @@ InitBoxes()
*/
void
-TkpButtonSetDefaults(specPtr)
- Tk_OptionSpec *specPtr; /* Points to an array of option specs,
+TkpButtonSetDefaults(
+ Tk_OptionSpec *specPtr) /* Points to an array of option specs,
* terminated by one with type
* TK_OPTION_END. */
{
@@ -205,8 +209,8 @@ TkpButtonSetDefaults(specPtr)
*/
TkButton *
-TkpCreateButton(tkwin)
- Tk_Window tkwin;
+TkpCreateButton(
+ Tk_Window tkwin)
{
WinButton *butPtr;
@@ -220,8 +224,8 @@ TkpCreateButton(tkwin)
*
* CreateProc --
*
- * This function creates a new Button control, subclasses
- * the instance, and generates a new Window object.
+ * This function creates a new Button control, subclasses the instance,
+ * and generates a new Window object.
*
* Results:
* Returns the newly allocated Window object, or None on failure.
@@ -233,10 +237,10 @@ TkpCreateButton(tkwin)
*/
static Window
-CreateProc(tkwin, parentWin, instanceData)
- Tk_Window tkwin; /* Token for window. */
- Window parentWin; /* Parent of new window. */
- ClientData instanceData; /* Button instance data. */
+CreateProc(
+ Tk_Window tkwin, /* Token for window. */
+ Window parentWin, /* Parent of new window. */
+ ClientData instanceData) /* Button instance data. */
{
Window window;
HWND parent;
@@ -256,13 +260,8 @@ CreateProc(tkwin, parentWin, instanceData)
parent, NULL, Tk_GetHINSTANCE(), NULL);
SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
-#ifdef _WIN64
butPtr->oldProc = (WNDPROC)SetWindowLongPtr(butPtr->hwnd, GWLP_WNDPROC,
- (LONG_PTR) ButtonProc);
-#else
- butPtr->oldProc = (WNDPROC)SetWindowLong(butPtr->hwnd, GWL_WNDPROC,
- (DWORD) ButtonProc);
-#endif
+ (INT_PTR) ButtonProc);
window = Tk_AttachHWND(tkwin, butPtr->hwnd);
return window;
@@ -285,17 +284,14 @@ CreateProc(tkwin, parentWin, instanceData)
*/
void
-TkpDestroyButton(butPtr)
- TkButton *butPtr;
+TkpDestroyButton(
+ TkButton *butPtr)
{
WinButton *winButPtr = (WinButton *)butPtr;
HWND hwnd = winButPtr->hwnd;
+
if (hwnd) {
-#ifdef _WIN64
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc);
-#else
- SetWindowLong(hwnd, GWL_WNDPROC, (DWORD) winButPtr->oldProc);
-#endif
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) winButPtr->oldProc);
}
}
@@ -304,22 +300,21 @@ TkpDestroyButton(butPtr)
*
* TkpDisplayButton --
*
- * This procedure is invoked to display a button widget. It is
- * normally invoked as an idle handler.
+ * This procedure is invoked to display a button widget. It is normally
+ * invoked as an idle handler.
*
* Results:
* None.
*
* Side effects:
- * Information appears on the screen. The REDRAW_PENDING flag
- * is cleared.
+ * Information appears on the screen. The REDRAW_PENDING flag is cleared.
*
*----------------------------------------------------------------------
*/
void
-TkpDisplayButton(clientData)
- ClientData clientData; /* Information about widget. */
+TkpDisplayButton(
+ ClientData clientData) /* Information about widget. */
{
TkWinDCState state;
HDC dc;
@@ -327,27 +322,28 @@ TkpDisplayButton(clientData)
GC gc;
Tk_3DBorder border;
Pixmap pixmap;
- int x = 0; /* Initialization only needed to stop
- * compiler warning. */
+ int x = 0; /* Initialization only needed to stop compiler
+ * warning. */
int y, relief;
register Tk_Window tkwin = butPtr->tkwin;
int width = 0, height = 0, haveImage = 0, haveText = 0, drawRing = 0;
RECT rect;
int defaultWidth; /* Width of default ring. */
- int offset; /* 0 means this is a label widget. 1 means
- * it is a flavor of button, so we offset
- * the text to make the button appear to
- * move up and down as the relief changes. */
- int textXOffset = 0, textYOffset = 0; /* text offsets for use with
- * compound buttons and focus ring */
+ int offset; /* 0 means this is a label widget. 1 means it
+ * is a flavor of button, so we offset the
+ * text to make the button appear to move up
+ * and down as the relief changes. */
+ int textXOffset = 0, textYOffset = 0;
+ /* Text offsets for use with compound buttons
+ * and focus ring. */
int imageWidth, imageHeight;
- int imageXOffset = 0, imageYOffset = 0; /* image information that will
- * be used to restrict disabled
- * pixmap as well */
+ int imageXOffset = 0, imageYOffset = 0;
+ /* Image information that will be used to
+ * restrict disabled pixmap as well. */
DWORD *boxesPalette;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
boxesPalette= tsdPtr->boxesPalette;
butPtr->flags &= ~REDRAW_PENDING;
@@ -371,9 +367,8 @@ TkpDisplayButton(clientData)
}
/*
- * Override the relief specified for the button if this is a
- * checkbutton or radiobutton and there's no indicator. The new
- * relief is as follows:
+ * Override the relief specified for the button if this is a checkbutton
+ * or radiobutton and there's no indicator. The new relief is as follows:
* If the button is select --> "sunken"
* If relief==overrelief --> relief
* Otherwise --> overrelief
@@ -387,15 +382,15 @@ TkpDisplayButton(clientData)
* on no sunken
* on yes sunken
*
- * This is accomplished by configuring the checkbutton or radiobutton
- * like this:
+ * This is accomplished by configuring the checkbutton or radiobutton like
+ * this:
*
* -indicatoron 0 -overrelief raised -offrelief flat
*
* Bindings (see library/button.tcl) will copy the -overrelief into
- * -relief on mouseover. Hence, we can tell if we are in mouse-over by
- * comparing relief against overRelief. This is an aweful kludge, but
- * it gives use the desired behavior while keeping the code backwards
+ * -relief on mouseover. Hence, we can tell if we are in mouse-over by
+ * comparing relief against overRelief. This is an aweful kludge, but it
+ * gives use the desired behavior while keeping the code backwards
* compatible.
*/
@@ -426,10 +421,10 @@ TkpDisplayButton(clientData)
}
/*
- * In order to avoid screen flashes, this procedure redraws
- * the button in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this procedure redraws the button in
+ * a pixmap, then copies the pixmap to the screen in a single operation.
+ * This means that there's no point in time where the on-sreen image has
+ * been cleared.
*/
pixmap = Tk_GetPixmap(butPtr->display, Tk_WindowId(tkwin),
@@ -448,7 +443,7 @@ TkpDisplayButton(clientData)
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
haveImage = 1;
}
- imageWidth = width;
+ imageWidth = width;
imageHeight = height;
haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
@@ -457,49 +452,58 @@ TkpDisplayButton(clientData)
int fullWidth = 0, fullHeight = 0;
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (butPtr->compound == COMPOUND_TOP) {
- textYOffset = height + butPtr->padY;
- } else {
- imageYOffset = butPtr->textHeight + butPtr->padY;
- }
- fullHeight = height + butPtr->textHeight + butPtr->padY;
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- if (butPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + butPtr->padX;
- } else {
- imageXOffset = butPtr->textWidth + butPtr->padX;
- }
- fullWidth = butPtr->textWidth + butPtr->padX + width;
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ if (butPtr->compound == COMPOUND_TOP) {
+ textYOffset = height + butPtr->padY;
+ } else {
+ imageYOffset = butPtr->textHeight + butPtr->padY;
}
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
+ fullHeight = height + butPtr->textHeight + butPtr->padY;
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ break;
+
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ if (butPtr->compound == COMPOUND_LEFT) {
+ textXOffset = width + butPtr->padX;
+ } else {
+ imageXOffset = butPtr->textWidth + butPtr->padX;
}
- case COMPOUND_NONE: {break;}
+ fullWidth = butPtr->textWidth + butPtr->padX + width;
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_NONE:
+ break;
}
TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
butPtr->indicatorSpace + fullWidth, fullHeight, &x, &y);
@@ -515,9 +519,13 @@ TkpDisplayButton(clientData)
if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0,
width, height, pixmap, imageXOffset, imageYOffset);
- } else {
- Tk_RedrawImage(butPtr->image, 0, 0,
+ } else if ((butPtr->tristateImage != NULL)
+ && (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0,
width, height, pixmap, imageXOffset, imageYOffset);
+ } else {
+ Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap,
+ imageXOffset, imageYOffset);
}
} else {
XSetClipOrigin(butPtr->display, gc, imageXOffset, imageYOffset);
@@ -526,6 +534,22 @@ TkpDisplayButton(clientData)
imageXOffset, imageYOffset, 1);
XSetClipOrigin(butPtr->display, gc, 0, 0);
}
+ if ((butPtr->state == STATE_DISABLED) &&
+ (butPtr->disabledFg != NULL)) {
+ COLORREF oldFgColor = gc->foreground;
+
+ if (gc->background == GetSysColor(COLOR_BTNFACE)) {
+ gc->foreground = GetSysColor(COLOR_3DHILIGHT);
+ Tk_DrawTextLayout(butPtr->display, pixmap, gc,
+ butPtr->textLayout, x + textXOffset + 1,
+ y + textYOffset + 1, 0, -1);
+ Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,
+ butPtr->textLayout, x + textXOffset + 1,
+ y + textYOffset + 1,
+ butPtr->underline);
+ gc->foreground = oldFgColor;
+ }
+ }
Tk_DrawTextLayout(butPtr->display, pixmap, gc,
butPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
@@ -539,7 +563,7 @@ TkpDisplayButton(clientData)
TkComputeAnchor(butPtr->anchor, tkwin, 0, 0,
butPtr->indicatorSpace + width, height, &x, &y);
x += butPtr->indicatorSpace;
-
+
if (relief == TK_RELIEF_SUNKEN) {
x += offset;
y += offset;
@@ -551,6 +575,10 @@ TkpDisplayButton(clientData)
(butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
+ } else if ((butPtr->tristateImage != NULL) &&
+ (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height,
+ pixmap, imageXOffset, imageYOffset);
} else {
Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap,
imageXOffset, imageYOffset);
@@ -567,11 +595,24 @@ TkpDisplayButton(clientData)
butPtr->textHeight, &x, &y);
x += butPtr->indicatorSpace;
-
+
if (relief == TK_RELIEF_SUNKEN) {
x += offset;
y += offset;
}
+ if ((butPtr->state == STATE_DISABLED) &&
+ (butPtr->disabledFg != NULL)) {
+ COLORREF oldFgColor = gc->foreground;
+ if (gc->background == GetSysColor(COLOR_BTNFACE)) {
+ gc->foreground = GetSysColor(COLOR_3DHILIGHT);
+ Tk_DrawTextLayout(butPtr->display, pixmap, gc,
+ butPtr->textLayout,
+ x + 1, y + 1, 0, -1);
+ Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,
+ butPtr->textLayout, x + 1, y + 1, butPtr->underline);
+ gc->foreground = oldFgColor;
+ }
+ }
Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout,
x, y, 0, -1);
Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,
@@ -583,12 +624,12 @@ TkpDisplayButton(clientData)
}
/*
- * Draw the focus ring. If this is a push button then we need to
- * put it around the inner edge of the border, otherwise we put it
- * around the text. The text offsets are only non-zero when this
- * is a compound button.
+ * Draw the focus ring. If this is a push button then we need to put it
+ * around the inner edge of the border, otherwise we put it around the
+ * text. The text offsets are only non-zero when this is a compound
+ * button.
*/
-
+
if (drawRing && butPtr->flags & GOT_FOCUS && butPtr->type != TYPE_LABEL) {
dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state);
if (butPtr->type == TYPE_BUTTON || !butPtr->indicatorOn) {
@@ -609,11 +650,10 @@ TkpDisplayButton(clientData)
}
y += height/2;
-
+
/*
- * Draw the indicator for check buttons and radio buttons. At this
- * point x and y refer to the top-left corner of the text or image
- * or bitmap.
+ * Draw the indicator for check buttons and radio buttons. At this point x
+ * and y refer to the top-left corner of the text or image or bitmap.
*/
if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn
@@ -623,7 +663,7 @@ TkpDisplayButton(clientData)
x -= butPtr->indicatorSpace;
y -= butPtr->indicatorDiameter / 2;
- xSrc = (butPtr->flags & SELECTED) ? tsdPtr->boxWidth : 0;
+ xSrc = (butPtr->flags & (SELECTED|TRISTATED)) ? tsdPtr->boxWidth : 0;
if (butPtr->state == STATE_ACTIVE) {
xSrc += tsdPtr->boxWidth*2;
}
@@ -631,11 +671,11 @@ TkpDisplayButton(clientData)
/*
* Update the palette in the boxes bitmap to reflect the current
- * button colors. Note that this code relies on the layout of the
- * bitmap's palette. Also, all of the colors used to draw the
- * bitmap must be in the palette that is selected into the DC of
- * the offscreen pixmap. This requires that the static colors
- * be placed into the palette.
+ * button colors. Note that this code relies on the layout of the
+ * bitmap's palette. Also, all of the colors used to draw the bitmap
+ * must be in the palette that is selected into the DC of the
+ * offscreen pixmap. This requires that the static colors be placed
+ * into the palette.
*/
if ((butPtr->state == STATE_DISABLED)
@@ -653,7 +693,7 @@ TkpDisplayButton(clientData)
border, TK_3D_LIGHT2));
boxesPalette[PAL_BOTTOM_OUTER] = FlipColor(TkWinGetBorderPixels(tkwin,
border, TK_3D_LIGHT_GC));
- if (butPtr->state == STATE_DISABLED) {
+ if ((butPtr->state == STATE_DISABLED) || (butPtr->flags & TRISTATED)) {
boxesPalette[PAL_INTERIOR] = FlipColor(TkWinGetBorderPixels(tkwin,
border, TK_3D_LIGHT2));
} else if (butPtr->selectBorder != NULL) {
@@ -666,18 +706,18 @@ TkpDisplayButton(clientData)
border, TK_3D_FLAT_GC));
dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state);
- StretchDIBits(dc, x, y, tsdPtr->boxWidth, tsdPtr->boxHeight,
- xSrc, ySrc, tsdPtr->boxWidth, tsdPtr->boxHeight,
- tsdPtr->boxesBits, (LPBITMAPINFO) tsdPtr->boxesPtr,
- DIB_RGB_COLORS, SRCCOPY);
+ StretchDIBits(dc, x, y, (int)tsdPtr->boxWidth, (int)tsdPtr->boxHeight,
+ xSrc, ySrc, (int)tsdPtr->boxWidth, (int)tsdPtr->boxHeight,
+ tsdPtr->boxesBits, (LPBITMAPINFO) tsdPtr->boxesPtr,
+ DIB_RGB_COLORS, SRCCOPY);
TkWinReleaseDrawableDC(pixmap, dc, &state);
}
/*
* If the button is disabled with a stipple rather than a special
- * foreground color, generate the stippled effect. If the widget
- * is selected and we use a different background color when selected,
- * must temporarily modify the GC so the stippling is the right color.
+ * foreground color, generate the stippled effect. If the widget is
+ * selected and we use a different background color when selected, must
+ * temporarily modify the GC so the stippling is the right color.
*/
if ((butPtr->state == STATE_DISABLED)
@@ -687,10 +727,12 @@ TkpDisplayButton(clientData)
XSetForeground(butPtr->display, butPtr->stippleGC,
Tk_3DBorderColor(butPtr->selectBorder)->pixel);
}
+
/*
- * Stipple the whole button if no disabledFg was specified,
- * otherwise restrict stippling only to displayed image
+ * Stipple the whole button if no disabledFg was specified, otherwise
+ * restrict stippling only to displayed image
*/
+
if (butPtr->disabledFg == NULL) {
XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, 0, 0,
(unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin));
@@ -707,8 +749,8 @@ TkpDisplayButton(clientData)
}
/*
- * Draw the border and traversal highlight last. This way, if the
- * button's contents overflow they'll be covered up by the border.
+ * Draw the border and traversal highlight last. This way, if the button's
+ * contents overflow they'll be covered up by the border.
*/
if (relief != TK_RELIEF_FLAT) {
@@ -721,15 +763,15 @@ TkpDisplayButton(clientData)
if (defaultWidth != 0) {
dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state);
TkWinFillRect(dc, 0, 0, Tk_Width(tkwin), defaultWidth,
- butPtr->highlightColorPtr->pixel);
+ (int) butPtr->highlightColorPtr->pixel);
TkWinFillRect(dc, 0, 0, defaultWidth, Tk_Height(tkwin),
- butPtr->highlightColorPtr->pixel);
+ (int) butPtr->highlightColorPtr->pixel);
TkWinFillRect(dc, 0, Tk_Height(tkwin) - defaultWidth,
Tk_Width(tkwin), defaultWidth,
- butPtr->highlightColorPtr->pixel);
+ (int) butPtr->highlightColorPtr->pixel);
TkWinFillRect(dc, Tk_Width(tkwin) - defaultWidth, 0,
defaultWidth, Tk_Height(tkwin),
- butPtr->highlightColorPtr->pixel);
+ (int) butPtr->highlightColorPtr->pixel);
TkWinReleaseDrawableDC(pixmap, dc, &state);
}
@@ -738,8 +780,8 @@ TkpDisplayButton(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(butPtr->display, pixmap, Tk_WindowId(tkwin),
@@ -753,9 +795,9 @@ TkpDisplayButton(clientData)
*
* TkpComputeButtonGeometry --
*
- * After changes in a button's text or bitmap, this procedure
- * recomputes the button's geometry and passes this information
- * along to the geometry manager for the window.
+ * After changes in a button's text or bitmap, this procedure recomputes
+ * the button's geometry and passes this information along to the
+ * geometry manager for the window.
*
* Results:
* None.
@@ -767,21 +809,21 @@ TkpDisplayButton(clientData)
*/
void
-TkpComputeButtonGeometry(butPtr)
- register TkButton *butPtr; /* Button whose geometry may have changed. */
+TkpComputeButtonGeometry(
+ register TkButton *butPtr) /* Button whose geometry may have changed. */
{
- int txtWidth, txtHeight; /* Width and height of text */
- int imgWidth, imgHeight; /* Width and height of image */
- int width = 0, height = 0; /* Width and height of button */
+ int txtWidth, txtHeight; /* Width and height of text */
+ int imgWidth, imgHeight; /* Width and height of image */
+ int width = 0, height = 0; /* Width and height of button */
int haveImage, haveText;
int avgWidth;
int minWidth;
/* Vertical and horizontal dialog units size in pixels. */
double vDLU, hDLU;
Tk_FontMetrics fm;
-
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (butPtr->highlightWidth < 0) {
butPtr->highlightWidth = 0;
@@ -793,13 +835,16 @@ TkpComputeButtonGeometry(butPtr)
InitBoxes();
}
- /* Figure out image metrics */
+ /*
+ * Figure out image metrics.
+ */
+
if (butPtr->image != NULL) {
Tk_SizeOfImage(butPtr->image, &imgWidth, &imgHeight);
haveImage = 1;
} else if (butPtr->bitmap != None) {
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap,
- &imgWidth, &imgHeight);
+ &imgWidth, &imgHeight);
haveImage = 1;
} else {
imgWidth = 0;
@@ -807,10 +852,11 @@ TkpComputeButtonGeometry(butPtr)
haveImage = 0;
}
- /*
+ /*
* Figure out font metrics (even if we don't have text because we need
* DLUs (based on font, not text) for some spacing calculations below).
*/
+
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
@@ -824,7 +870,10 @@ TkpComputeButtonGeometry(butPtr)
52) + 26) / 52;
Tk_GetFontMetrics(butPtr->tkfont, &fm);
- /* Compute dialog units for layout calculations. */
+ /*
+ * Compute dialog units for layout calculations.
+ */
+
hDLU = avgWidth / 4.0;
vDLU = fm.linespace / 8.0;
@@ -841,182 +890,199 @@ TkpComputeButtonGeometry(butPtr)
/*
* Set width and height by button type; See User Experience table, p449.
- * These are text-based measurements, even if the text is "".
- * If there is an image, height will get set again later.
+ * These are text-based measurements, even if the text is "". If there is
+ * an image, height will get set again later.
*/
+
switch (butPtr->type) {
- case TYPE_BUTTON: {
- /*
- * First compute the minimum width of the button in
- * characters. MWUE says that the button should be
- * 50 DLUs. We allow 6 DLUs padding left and right.
- * (There is no rule but this is consistent with the
- * fact that button text is 8 DLUs high and buttons
- * are 14 DLUs high.)
- *
- * The width is specified in characters. A character
- * is, by definition, 4 DLUs wide. 11 char * 4 DLU
- * is 44 DLU + 6 DLU padding = 50 DLU. Therefore,
- * width = -11 -> MWUE compliant buttons.
- */
- if (butPtr->width < 0) {
- /* Min width in characters */
- minWidth = -(butPtr->width);
- /* Allow for characters */
- width = avgWidth * minWidth;
- /* Add for padding */
- width += (int)(0.5 + (6 * hDLU));
- }
+ case TYPE_BUTTON:
+ /*
+ * First compute the minimum width of the button in characters. MWUE
+ * says that the button should be 50 DLUs. We allow 6 DLUs padding
+ * left and right. (There is no rule but this is consistent with the
+ * fact that button text is 8 DLUs high and buttons are 14 DLUs high.)
+ *
+ * The width is specified in characters. A character is, by
+ * definition, 4 DLUs wide. 11 char * 4 DLU is 44 DLU + 6 DLU padding
+ * = 50 DLU. Therefore, width = -11 -> MWUE compliant buttons.
+ */
- /*
- * If shrink-wrapping was requested (width = 0) or
- * if the text is wider than the default button width,
- * adjust the button width up to suit.
- */
- if (butPtr->width == 0
- || (txtWidth + (int)(0.5 + (6 * hDLU)) > width)) {
- width = txtWidth + (int)(0.5 + (6 * hDLU));
- }
+ if (butPtr->width < 0) {
+ minWidth = -(butPtr->width); /* Min width in chars */
+ width = avgWidth * minWidth; /* Allow for characters */
+ width += (int)(0.5 + (6 * hDLU)); /* Add for padding */
+ }
+
+ /*
+ * If shrink-wrapping was requested (width = 0) or if the text is
+ * wider than the default button width, adjust the button width up to
+ * suit.
+ */
+
+ if (butPtr->width == 0
+ || (txtWidth + (int)(0.5 + (6 * hDLU)) > width)) {
+ width = txtWidth + (int)(0.5 + (6 * hDLU));
+ }
+
+ /*
+ * The User Experience says 14 DLUs. Since text is, by definition, 8
+ * DLU/line, this allows for multi-line text while working perfectly
+ * for single-line text.
+ */
+
+ height = txtHeight + (int)(0.5 + (6 * vDLU));
+ /*
+ * The above includes 6 DLUs of padding which should include defaults
+ * of 1 pixel of highlightwidth, 2 pixels of borderwidth, 1 pixel of
+ * padding and 1 pixel of extra inset on each side. Those will be
+ * added later so reduce width and height now to compensate.
+ */
+
+ width -= 10;
+ height -= 10;
+
+ if (!haveImage) {
/*
- * The User Experience says 14 DLUs. Since text is, by
- * definition, 8 DLU/line, this allows for multi-line text
- * while working perfectly for single-line text.
+ * Extra inset for the focus ring.
*/
- height = txtHeight + (int)(0.5 + (6 * vDLU));
+ butPtr->inset += 1;
+ }
+ break;
+
+ case TYPE_LABEL:
+ /*
+ * The User Experience says, "as wide as needed".
+ */
+
+ width = txtWidth;
+
+ /*
+ * The User Experience says, "8 (DLUs) per line of text". Since text
+ * is, by definition, 8 DLU/line, this allows for multi-line text
+ * while working perfectly for single-line text.
+ */
+
+ if (txtHeight) {
+ height = txtHeight;
+ } else {
/*
- * The above includes 6 DLUs of padding which should include
- * defaults of 1 pixel of highlightwidth, 2 pixels of
- * borderwidth, 1 pixel of padding and 1 pixel of extra inset
- * on each side. Those will be added later so reduce width
- * and height now to compensate.
+ * If there's no text, we want the height to be one linespace.
*/
- width -= 10;
- height -= 10;
-
- if (!haveImage) {
- /*
- * Extra inset for the focus ring.
- */
- butPtr->inset += 1;
- }
- break;
+ height = fm.linespace;
}
+ break;
- case TYPE_LABEL: {
- /*
- * The User Experience says, "as wide as needed".
- */
- width = txtWidth;
-
- /*
- * The User Experience says, "8 (DLUs) per line of text."
- * Since text is, by definition, 8 DLU/line, this allows
- * for multi-line text while working perfectly for single-line
- * text.
- */
- if (txtHeight) {
- height = txtHeight;
- } else {
- /*
- * If there's no text, we want the height to be one linespace.
- */
- height = fm.linespace;
- }
- break;
- }
-
- case TYPE_RADIO_BUTTON:
- case TYPE_CHECK_BUTTON: {
- /* See note for TYPE_LABEL */
- width = txtWidth;
- /*
- * The User Experience says 10 DLUs. (Is that one DLU above
- * and below for the focus ring?) See note above about
- * multi-line text and 8 DLU/line.
- */
- height = txtHeight + (int)(0.5 + (2.0 * vDLU));
-
- /*
- * The above includes 2 DLUs of padding which should include
- * defaults of 1 pixel of highlightwidth, 0 pixels of
- * borderwidth, and 1 pixel of padding on each side. Those
- * will be added later so reduce height now to compensate.
- */
- height -= 4;
-
- /*
- * Extra inset for the focus ring.
- */
- butPtr->inset += 1;
- break;
- }
+ case TYPE_RADIO_BUTTON:
+ case TYPE_CHECK_BUTTON: {
+ /*
+ * See note for TYPE_LABEL.
+ */
+
+ width = txtWidth;
+
+ /*
+ * The User Experience says 10 DLUs. (Is that one DLU above and below
+ * for the focus ring?) See note above about multi-line text and 8
+ * DLU/line.
+ */
+
+ height = txtHeight + (int)(0.5 + (2.0 * vDLU));
+
+ /*
+ * The above includes 2 DLUs of padding which should include defaults
+ * of 1 pixel of highlightwidth, 0 pixels of borderwidth, and 1 pixel
+ * of padding on each side. Those will be added later so reduce height
+ * now to compensate.
+ */
+
+ height -= 4;
+
+ /*
+ * Extra inset for the focus ring.
+ */
+ butPtr->inset += 1;
+ break;
+ }
}/* switch */
/*
- * At this point, the width and height are correct for a Tk text
- * button, excluding padding and inset, but we have to allow for
- * compound buttons. The image may be above, below, left, or right
- * of the text.
+ * At this point, the width and height are correct for a Tk text button,
+ * excluding padding and inset, but we have to allow for compound buttons.
+ * The image may be above, below, left, or right of the text.
*/
/*
- * If the button is compound (i.e., it shows both an image and text),
- * the new geometry is a combination of the image and text geometry.
- * We only honor the compound bit if the button has both text and an
- * image, because otherwise it is not really a compound button.
+ * If the button is compound (i.e., it shows both an image and text), the
+ * new geometry is a combination of the image and text geometry. We only
+ * honor the compound bit if the button has both text and an image,
+ * because otherwise it is not really a compound button.
*/
+
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (imgWidth > width) {
- width = imgWidth;
- }
- height += imgHeight + butPtr->padY;
- break;
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ if (imgWidth > width) {
+ width = imgWidth;
}
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- /*
- * Only increase width of button if image doesn't fit in
- * slack space of default button width
- */
- if ((imgWidth + txtWidth + butPtr->padX) > width) {
- width = imgWidth + txtWidth + butPtr->padX;
- }
+ height += imgHeight + butPtr->padY;
+ break;
- if (imgHeight > height) {
- height = imgHeight;
- }
- break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+
+ /*
+ * Image is left or right of text.
+ *
+ * Only increase width of button if image doesn't fit in slack
+ * space of default button width
+ */
+
+ if ((imgWidth + txtWidth + butPtr->padX) > width) {
+ width = imgWidth + txtWidth + butPtr->padX;
}
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- if (imgWidth > width) {
- width = imgWidth;
- }
- if (imgHeight > height) {
- height = imgHeight;
- }
- break;
+
+ if (imgHeight > height) {
+ height = imgHeight;
}
- case COMPOUND_NONE: {
- break;
+ break;
+
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ if (imgWidth > width) {
+ width = imgWidth;
}
+ if (imgHeight > height) {
+ height = imgHeight;
+ }
+ break;
+ case COMPOUND_NONE:
+ break;
} /* switch */
- /* Fix up for minimum width */
- if (butPtr->width < 0) {
- /* minWidth in pixels (because there's an image */
- minWidth = -(butPtr->width);
- if (width < minWidth) {
- width = minWidth;
- }
- } else if (butPtr->width > 0) {
+ /*
+ * Fix up for minimum width.
+ */
+
+ if (butPtr->width < 0) {
+ /*
+ * minWidth in pixels (because there's an image.
+ */
+
+ minWidth = -(butPtr->width);
+ if (width < minWidth) {
+ width = minWidth;
+ }
+ } else if (butPtr->width > 0) {
width = butPtr->width;
}
@@ -1038,68 +1104,76 @@ TkpComputeButtonGeometry(butPtr)
height = imgHeight;
}
} else {
- /* No image. May or may not be text. May or may not be compound. */
+ /*
+ * No image. May or may not be text. May or may not be compound.
+ */
- /*
- * butPtr->width is in characters. We need to allow for that
- * many characters on the face, not in the over-all button width
+ /*
+ * butPtr->width is in characters. We need to allow for that many
+ * characters on the face, not in the over-all button width
*/
- if (butPtr->width > 0) {
+
+ if (butPtr->width > 0) {
width = butPtr->width * avgWidth;
}
/*
- * butPtr->height is in lines of text. We need to allow for
- * that many lines on the face, not in the over-all button
- * height.
+ * butPtr->height is in lines of text. We need to allow for that many
+ * lines on the face, not in the over-all button height.
*/
+
if (butPtr->height > 0) {
height = butPtr->height * fm.linespace;
/*
- * Make the same adjustments as above to get same height for
- * e.g. a one line text with -height 0 or 1. [Bug #565485]
+ * Make the same adjustments as above to get same height for e.g.
+ * a one line text with -height 0 or 1. [Bug #565485]
*/
switch (butPtr->type) {
- case TYPE_BUTTON: {
- height += (int)(0.5 + (6 * vDLU)) - 10;
- break;
- }
- case TYPE_RADIO_BUTTON:
- case TYPE_CHECK_BUTTON: {
- height += (int)(0.5 + (2.0 * vDLU)) - 4;
- break;
- }
+ case TYPE_BUTTON: {
+ height += (int)(0.5 + (6 * vDLU)) - 10;
+ break;
+ }
+ case TYPE_RADIO_BUTTON:
+ case TYPE_CHECK_BUTTON: {
+ height += (int)(0.5 + (2.0 * vDLU)) - 4;
+ break;
+ }
}
}
-
- width += 2 * butPtr->padX;
+
+ width += 2 * butPtr->padX;
height += 2 * butPtr->padY;
}
- /* Fix up width and height for indicator sizing and spacing */
+ /*
+ * Fix up width and height for indicator sizing and spacing.
+ */
+
if (butPtr->type == TYPE_RADIO_BUTTON
|| butPtr->type == TYPE_CHECK_BUTTON) {
if (butPtr->indicatorOn) {
butPtr->indicatorDiameter = tsdPtr->boxHeight;
- /*
- * Make sure we can see the whole indicator, even if the text
- * or image is very small.
- */
- if (height < butPtr->indicatorDiameter) {
- height = butPtr->indicatorDiameter;
- }
+ /*
+ * Make sure we can see the whole indicator, even if the text or
+ * image is very small.
+ */
+
+ if (height < butPtr->indicatorDiameter) {
+ height = butPtr->indicatorDiameter;
+ }
/*
- * There is no rule for space between the indicator and
- * the text (the two are atomic on 'Windows) but the User
- * Experience page 451 says leave 3 hDLUs between "text
- * labels and their associated controls".
+ * There is no rule for space between the indicator and the text
+ * (the two are atomic on 'Windows) but the User Experience page
+ * 451 says leave 3 hDLUs between "text labels and their
+ * associated controls".
*/
+
butPtr->indicatorSpace = butPtr->indicatorDiameter +
- (int)(0.5 + (3.0 * hDLU));
+ (int)(0.5 + (3.0 * hDLU));
width += butPtr->indicatorSpace;
}
}
@@ -1107,7 +1181,8 @@ TkpComputeButtonGeometry(butPtr)
/*
* Inset is always added to the size.
*/
- width += 2 * butPtr->inset;
+
+ width += 2 * butPtr->inset;
height += 2 * butPtr->inset;
Tk_GeometryRequest(butPtr->tkwin, width, height);
@@ -1119,8 +1194,8 @@ TkpComputeButtonGeometry(butPtr)
*
* ButtonProc --
*
- * This function is call by Windows whenever an event occurs on
- * a button control created by Tk.
+ * This function is call by Windows whenever an event occurs on a button
+ * control created by Tk.
*
* Results:
* Standard Windows return value.
@@ -1132,86 +1207,96 @@ TkpComputeButtonGeometry(butPtr)
*/
static LRESULT CALLBACK
-ButtonProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+ButtonProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
LRESULT result;
WinButton *butPtr;
Tk_Window tkwin = Tk_HWNDToWindow(hwnd);
if (tkwin == NULL) {
- panic("ButtonProc called on an invalid HWND");
+ Tcl_Panic("ButtonProc called on an invalid HWND");
}
butPtr = (WinButton *)((TkWindow*)tkwin)->instanceData;
switch(message) {
- case WM_ERASEBKGND:
- return 0;
-
- case BM_GETCHECK:
- if (((butPtr->info.type == TYPE_CHECK_BUTTON)
- || (butPtr->info.type == TYPE_RADIO_BUTTON))
- && butPtr->info.indicatorOn) {
- return (butPtr->info.flags & SELECTED)
- ? BST_CHECKED : BST_UNCHECKED;
- }
- return 0;
-
- case BM_GETSTATE: {
- DWORD state = 0;
- if (((butPtr->info.type == TYPE_CHECK_BUTTON)
- || (butPtr->info.type == TYPE_RADIO_BUTTON))
- && butPtr->info.indicatorOn) {
- state = (butPtr->info.flags & SELECTED)
+ case WM_ERASEBKGND:
+ return 0;
+
+ case BM_GETCHECK:
+ if (((butPtr->info.type == TYPE_CHECK_BUTTON)
+ || (butPtr->info.type == TYPE_RADIO_BUTTON))
+ && butPtr->info.indicatorOn) {
+ return (butPtr->info.flags & SELECTED)
? BST_CHECKED : BST_UNCHECKED;
- }
- if (butPtr->info.flags & GOT_FOCUS) {
- state |= BST_FOCUS;
- }
- return state;
}
- case WM_ENABLE:
- break;
+ return 0;
- case WM_PAINT: {
- PAINTSTRUCT ps;
- BeginPaint(hwnd, &ps);
- EndPaint(hwnd, &ps);
- TkpDisplayButton((ClientData)butPtr);
+ case BM_GETSTATE: {
+ DWORD state = 0;
- /*
- * Special note: must cancel any existing idle handler
- * for TkpDisplayButton; it's no longer needed, and
- * TkpDisplayButton cleared the REDRAW_PENDING flag.
- */
-
- Tcl_CancelIdleCall(TkpDisplayButton, (ClientData)butPtr);
- return 0;
+ if (((butPtr->info.type == TYPE_CHECK_BUTTON)
+ || (butPtr->info.type == TYPE_RADIO_BUTTON))
+ && butPtr->info.indicatorOn) {
+ state = (butPtr->info.flags & SELECTED)
+ ? BST_CHECKED : BST_UNCHECKED;
}
- case BN_CLICKED: {
- int code;
- Tcl_Interp *interp = butPtr->info.interp;
- if (butPtr->info.state != STATE_DISABLED) {
- Tcl_Preserve((ClientData)interp);
- code = TkInvokeButton((TkButton*)butPtr);
- if (code != TCL_OK && code != TCL_CONTINUE
- && code != TCL_BREAK) {
- Tcl_AddErrorInfo(interp, "\n (button invoke)");
- Tcl_BackgroundError(interp);
- }
- Tcl_Release((ClientData)interp);
- }
- Tcl_ServiceAll();
- return 0;
+ if (butPtr->info.flags & GOT_FOCUS) {
+ state |= BST_FOCUS;
}
+ return state;
+ }
+ case WM_ENABLE:
+ break;
+
+ case WM_PAINT: {
+ PAINTSTRUCT ps;
+ BeginPaint(hwnd, &ps);
+ EndPaint(hwnd, &ps);
+ TkpDisplayButton((ClientData)butPtr);
- default:
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
- return result;
+ /*
+ * Special note: must cancel any existing idle handler for
+ * TkpDisplayButton; it's no longer needed, and TkpDisplayButton
+ * cleared the REDRAW_PENDING flag.
+ */
+
+ Tcl_CancelIdleCall(TkpDisplayButton, (ClientData)butPtr);
+ return 0;
+ }
+ case BN_CLICKED: {
+ int code;
+ Tcl_Interp *interp = butPtr->info.interp;
+
+ if (butPtr->info.state != STATE_DISABLED) {
+ Tcl_Preserve((ClientData)interp);
+ code = TkInvokeButton((TkButton*)butPtr);
+ if (code != TCL_OK && code != TCL_CONTINUE
+ && code != TCL_BREAK) {
+ Tcl_AddErrorInfo(interp, "\n (button invoke)");
+ Tcl_BackgroundError(interp);
}
+ Tcl_Release((ClientData)interp);
+ }
+ Tcl_ServiceAll();
+ return 0;
+ }
+
+ default:
+ if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ return result;
+ }
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 19dcc11..6007e56 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinClipboard.c --
*
* This file contains functions for managing the clipboard.
@@ -6,28 +6,28 @@
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
#include "tkSelect.h"
-static void UpdateClipboard _ANSI_ARGS_((HWND hwnd));
+static void UpdateClipboard(HWND hwnd);
/*
*----------------------------------------------------------------------
*
* TkSelGetSelection --
*
- * Retrieve the specified selection from another process. For
- * now, only fetching XA_STRING from CLIPBOARD is supported.
- * Eventually other types should be allowed.
- *
+ * Retrieve the specified selection from another process. For now, only
+ * fetching XA_STRING from CLIPBOARD is supported. Eventually other types
+ * should be allowed.
+ *
* Results:
- * The return value is a standard Tcl return value.
- * If an error occurs (such as no selection exists)
- * then an error message is left in the interp's result.
+ * The return value is a standard Tcl return value. If an error occurs
+ * (such as no selection exists) then an error message is left in the
+ * interp's result.
*
* Side effects:
* None.
@@ -36,18 +36,17 @@ static void UpdateClipboard _ANSI_ARGS_((HWND hwnd));
*/
int
-TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
- Tcl_Interp *interp; /* Interpreter to use for reporting
- * errors. */
- Tk_Window tkwin; /* Window on whose behalf to retrieve
- * the selection (determines display
- * from which to retrieve). */
- Atom selection; /* Selection to retrieve. */
- Atom target; /* Desired form in which selection
- * is to be returned. */
- Tk_GetSelProc *proc; /* Procedure to call to process the
- * selection, once it has been retrieved. */
- ClientData clientData; /* Arbitrary value to pass to proc. */
+TkSelGetSelection(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tk_Window tkwin, /* Window on whose behalf to retrieve the
+ * selection (determines display from which to
+ * retrieve). */
+ Atom selection, /* Selection to retrieve. */
+ Atom target, /* Desired form in which selection is to be
+ * returned. */
+ Tk_GetSelProc *proc, /* Procedure to call to process the selection,
+ * once it has been retrieved. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
{
char *data, *destPtr;
Tcl_DString ds;
@@ -62,8 +61,8 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
}
/*
- * Attempt to get the data in Unicode form if available as this is
- * less work that CF_TEXT.
+ * Attempt to get the data in Unicode form if available as this is less
+ * work that CF_TEXT.
*/
result = TCL_ERROR;
@@ -91,19 +90,17 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
}
/*
- * Get the locale identifier, determine the proper code page
- * to use, and find the corresponding encoding.
+ * Get the locale identifier, determine the proper code page to
+ * use, and find the corresponding encoding.
*/
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, "cp######", -1);
data = GlobalLock(handle);
-
/*
- * Even though the documentation claims that GetLocaleInfo
- * expects an LCID, on Windows 9x it really seems to expect
- * a LanguageID.
+ * Even though the documentation claims that GetLocaleInfo expects
+ * an LCID, on Windows 9x it really seems to expect a LanguageID.
*/
locale = LANGIDFROMLCID(*((int*)data));
@@ -144,7 +141,7 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
/*
* Translate CR/LF to LF.
*/
-
+
data = destPtr = Tcl_DStringValue(&ds);
while (*data) {
if (data[0] == '\r' && data[1] == '\n') {
@@ -163,12 +160,11 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
Tcl_DStringFree(&ds);
CloseClipboard();
return result;
-
-error:
+
+ error:
Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
" selection doesn't exist or form \"",
- Tk_GetAtomName(tkwin, target),
- "\" not defined", (char *) NULL);
+ Tk_GetAtomName(tkwin, target), "\" not defined", NULL);
return TCL_ERROR;
}
@@ -177,9 +173,8 @@ error:
*
* TkSetSelectionOwner --
*
- * This function claims ownership of the specified selection.
- * If the selection is CLIPBOARD, then we empty the system
- * clipboard.
+ * This function claims ownership of the specified selection. If the
+ * selection is CLIPBOARD, then we empty the system clipboard.
*
* Results:
* None.
@@ -191,27 +186,26 @@ error:
*/
void
-XSetSelectionOwner(display, selection, owner, time)
- Display* display;
- Atom selection;
- Window owner;
- Time time;
+XSetSelectionOwner(
+ Display *display,
+ Atom selection,
+ Window owner,
+ Time time)
{
HWND hwnd = owner ? TkWinGetHWND(owner) : NULL;
Tk_Window tkwin;
/*
- * This is a gross hack because the Tk_InternAtom interface is broken.
- * It expects a Tk_Window, even though it only needs a Tk_Display.
+ * This is a gross hack because the Tk_InternAtom interface is broken. It
+ * expects a Tk_Window, even though it only needs a Tk_Display.
*/
tkwin = (Tk_Window) TkGetMainInfoList()->winPtr;
if (selection == Tk_InternAtom(tkwin, "CLIPBOARD")) {
-
/*
- * Only claim and empty the clipboard if we aren't already the
- * owner of the clipboard.
+ * Only claim and empty the clipboard if we aren't already the owner
+ * of the clipboard.
*/
if (GetClipboardOwner() != hwnd) {
@@ -225,8 +219,8 @@ XSetSelectionOwner(display, selection, owner, time)
*
* TkWinClipboardRender --
*
- * This function supplies the contents of the clipboard in
- * response to a WM_RENDERFORMAT message.
+ * This function supplies the contents of the clipboard in response to a
+ * WM_RENDERFORMAT message.
*
* Results:
* None.
@@ -238,9 +232,9 @@ XSetSelectionOwner(display, selection, owner, time)
*/
void
-TkWinClipboardRender(dispPtr, format)
- TkDisplay *dispPtr;
- UINT format;
+TkWinClipboardRender(
+ TkDisplay *dispPtr,
+ UINT format)
{
TkClipboardTarget *targetPtr;
TkClipboardBuffer *cbPtr;
@@ -251,13 +245,14 @@ TkWinClipboardRender(dispPtr, format)
for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
targetPtr = targetPtr->nextPtr) {
- if (targetPtr->type == XA_STRING)
+ if (targetPtr->type == XA_STRING) {
break;
+ }
}
/*
- * Count the number of newlines so we can add space for them in
- * the resulting string.
+ * Count the number of newlines so we can add space for them in the
+ * resulting string.
*/
length = 0;
@@ -278,7 +273,7 @@ TkWinClipboardRender(dispPtr, format)
* Copy the data and change EOL characters.
*/
- buffer = rawText = ckalloc(length + 1);
+ buffer = rawText = ckalloc((unsigned)length + 1);
if (targetPtr != NULL) {
for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL;
cbPtr = cbPtr->nextPtr) {
@@ -294,8 +289,8 @@ TkWinClipboardRender(dispPtr, format)
*buffer = '\0';
/*
- * Depending on the platform, turn the data into Unicode or the
- * system encoding before placing it on the clipboard.
+ * Depending on the platform, turn the data into Unicode or the system
+ * encoding before placing it on the clipboard.
*/
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
@@ -303,13 +298,14 @@ TkWinClipboardRender(dispPtr, format)
Tcl_UtfToUniCharDString(rawText, -1, &ds);
ckfree(rawText);
handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
- Tcl_DStringLength(&ds)+2);
+ (unsigned) Tcl_DStringLength(&ds) + 2);
if (!handle) {
Tcl_DStringFree(&ds);
return;
}
buffer = GlobalLock(handle);
- memcpy(buffer, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds) + 2);
+ memcpy(buffer, Tcl_DStringValue(&ds),
+ (unsigned) Tcl_DStringLength(&ds) + 2);
GlobalUnlock(handle);
Tcl_DStringFree(&ds);
SetClipboardData(CF_UNICODETEXT, handle);
@@ -317,19 +313,18 @@ TkWinClipboardRender(dispPtr, format)
Tcl_UtfToExternalDString(NULL, rawText, -1, &ds);
ckfree(rawText);
handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
- Tcl_DStringLength(&ds)+1);
+ (unsigned) Tcl_DStringLength(&ds) + 1);
if (!handle) {
Tcl_DStringFree(&ds);
return;
}
buffer = GlobalLock(handle);
- memcpy(buffer, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds) + 1);
+ memcpy(buffer, Tcl_DStringValue(&ds),
+ (unsigned) Tcl_DStringLength(&ds) + 1);
GlobalUnlock(handle);
Tcl_DStringFree(&ds);
SetClipboardData(CF_TEXT, handle);
}
-
- return;
}
/*
@@ -337,8 +332,8 @@ TkWinClipboardRender(dispPtr, format)
*
* TkSelUpdateClipboard --
*
- * This function is called to force the clipboard to be updated
- * after new data is added.
+ * This function is called to force the clipboard to be updated after new
+ * data is added.
*
* Results:
* None.
@@ -350,9 +345,9 @@ TkWinClipboardRender(dispPtr, format)
*/
void
-TkSelUpdateClipboard(winPtr, targetPtr)
- TkWindow *winPtr;
- TkClipboardTarget *targetPtr;
+TkSelUpdateClipboard(
+ TkWindow *winPtr,
+ TkClipboardTarget *targetPtr)
{
HWND hwnd = TkWinGetHWND(winPtr->window);
UpdateClipboard(hwnd);
@@ -363,8 +358,8 @@ TkSelUpdateClipboard(winPtr, targetPtr)
*
* UpdateClipboard --
*
- * Take ownership of the clipboard, clear it, and indicate to the
- * system the supported formats.
+ * Take ownership of the clipboard, clear it, and indicate to the system
+ * the supported formats.
*
* Results:
* None.
@@ -376,16 +371,16 @@ TkSelUpdateClipboard(winPtr, targetPtr)
*/
static void
-UpdateClipboard(hwnd)
- HWND hwnd;
+UpdateClipboard(
+ HWND hwnd)
{
TkWinUpdatingClipboard(TRUE);
OpenClipboard(hwnd);
EmptyClipboard();
/*
- * CF_UNICODETEXT is only supported on NT, but it it is prefered
- * when possible.
+ * CF_UNICODETEXT is only supported on NT, but it it is prefered when
+ * possible.
*/
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
@@ -402,25 +397,22 @@ UpdateClipboard(hwnd)
*
* TkSelEventProc --
*
- * This procedure is invoked whenever a selection-related
- * event occurs.
+ * This procedure is invoked whenever a selection-related event occurs.
*
* Results:
* None.
*
* Side effects:
- * Lots: depends on the type of event.
+ * Lots: depends on the type of event.
*
*--------------------------------------------------------------
*/
void
-TkSelEventProc(tkwin, eventPtr)
- Tk_Window tkwin; /* Window for which event was
- * targeted. */
- register XEvent *eventPtr; /* X event: either SelectionClear,
- * SelectionRequest, or
- * SelectionNotify. */
+TkSelEventProc(
+ Tk_Window tkwin, /* Window for which event was targeted. */
+ register XEvent *eventPtr) /* X event: either SelectionClear,
+ * SelectionRequest, or SelectionNotify. */
{
if (eventPtr->type == SelectionClear) {
TkSelClearSelection(tkwin, eventPtr);
@@ -432,9 +424,8 @@ TkSelEventProc(tkwin, eventPtr)
*
* TkSelPropProc --
*
- * This procedure is invoked when property-change events
- * occur on windows not known to the toolkit. This is a stub
- * function under Windows.
+ * This procedure is invoked when property-change events occur on windows
+ * not known to the toolkit. This is a stub function under Windows.
*
* Results:
* None.
@@ -446,7 +437,15 @@ TkSelEventProc(tkwin, eventPtr)
*/
void
-TkSelPropProc(eventPtr)
- register XEvent *eventPtr; /* X PropertyChange event. */
+TkSelPropProc(
+ register XEvent *eventPtr) /* X PropertyChange event. */
{
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index d3b3cad..234c736 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinColor.c --
*
* Functions to map color names to system color values.
@@ -6,8 +6,8 @@
* Copyright (c) 1995 Sun Microsystems, Inc.
* Copyright (c) 1994 Software Research Associates, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
@@ -20,15 +20,14 @@
typedef struct WinColor {
TkColor info; /* Generic color information. */
- int index; /* Index for GetSysColor(), -1 if color
- * is not a "live" system color. */
+ int index; /* Index for GetSysColor(), -1 if color is not
+ * a "live" system color. */
} WinColor;
/*
- * The sysColors array contains the names and index values for the
- * Windows indirect system color names. In use, all of the names
- * will have the string "System" prepended, but we omit it in the table
- * to save space.
+ * The sysColors array contains the names and index values for the Windows
+ * indirect system color names. In use, all of the names will have the string
+ * "System" prepended, but we omit it in the table to save space.
*/
typedef struct {
@@ -36,7 +35,6 @@ typedef struct {
int index;
} SystemColorEntry;
-
static SystemColorEntry sysColors[] = {
{"3dDarkShadow", COLOR_3DDKSHADOW},
{"3dLight", COLOR_3DLIGHT},
@@ -50,16 +48,16 @@ static SystemColorEntry sysColors[] = {
{"ButtonText", COLOR_BTNTEXT},
{"CaptionText", COLOR_CAPTIONTEXT},
{"DisabledText", COLOR_GRAYTEXT},
- {"GrayText", COLOR_GRAYTEXT},
+ {"GrayText", COLOR_GRAYTEXT},
{"Highlight", COLOR_HIGHLIGHT},
{"HighlightText", COLOR_HIGHLIGHTTEXT},
{"InactiveBorder", COLOR_INACTIVEBORDER},
{"InactiveCaption", COLOR_INACTIVECAPTION},
{"InactiveCaptionText", COLOR_INACTIVECAPTIONTEXT},
{"InfoBackground", COLOR_INFOBK},
- {"InfoText", COLOR_INFOTEXT},
+ {"InfoText", COLOR_INFOTEXT},
{"Menu", COLOR_MENU},
- {"MenuText", COLOR_MENUTEXT},
+ {"MenuText", COLOR_MENUTEXT},
{"Scrollbar", COLOR_SCROLLBAR},
{"Window", COLOR_WINDOW},
{"WindowFrame", COLOR_WINDOWFRAME},
@@ -67,7 +65,7 @@ static SystemColorEntry sysColors[] = {
{NULL, 0}
};
-typedef struct ThreadSpecificData {
+typedef struct ThreadSpecificData {
int ncolors;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -76,20 +74,20 @@ static Tcl_ThreadDataKey dataKey;
* Forward declarations for functions defined later in this file.
*/
-static int FindSystemColor _ANSI_ARGS_((const char *name,
- XColor *colorPtr, int *indexPtr));
+static int FindSystemColor(const char *name, XColor *colorPtr,
+ int *indexPtr);
/*
*----------------------------------------------------------------------
*
* FindSystemColor --
*
- * This routine finds the color entry that corresponds to the
- * specified color.
+ * This routine finds the color entry that corresponds to the specified
+ * color.
*
* Results:
- * Returns non-zero on success. The RGB values of the XColor
- * will be initialized to the proper values on success.
+ * Returns non-zero on success. The RGB values of the XColor will be
+ * initialized to the proper values on success.
*
* Side effects:
* None.
@@ -98,18 +96,18 @@ static int FindSystemColor _ANSI_ARGS_((const char *name,
*/
static int
-FindSystemColor(name, colorPtr, indexPtr)
- const char *name; /* Color name. */
- XColor *colorPtr; /* Where to store results. */
- int *indexPtr; /* Out parameter to store color index. */
+FindSystemColor(
+ const char *name, /* Color name. */
+ XColor *colorPtr, /* Where to store results. */
+ int *indexPtr) /* Out parameter to store color index. */
{
int l, u, r, i;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Count the number of elements in the color array if we haven't
- * done so yet.
+ * Count the number of elements in the color array if we haven't done so
+ * yet.
*/
if (tsdPtr->ncolors == 0) {
@@ -152,10 +150,12 @@ FindSystemColor(name, colorPtr, indexPtr)
*indexPtr = sysColors[i].index;
colorPtr->pixel = GetSysColor(sysColors[i].index);
+
/*
- * x257 is (value<<8 + value) to get the properly bit shifted
- * and padded value. [Bug: 4919]
+ * x257 is (value<<8 + value) to get the properly bit shifted and padded
+ * value. [Bug: 4919]
*/
+
colorPtr->red = GetRValue(colorPtr->pixel) * 257;
colorPtr->green = GetGValue(colorPtr->pixel) * 257;
colorPtr->blue = GetBValue(colorPtr->pixel) * 257;
@@ -176,27 +176,26 @@ FindSystemColor(name, colorPtr, indexPtr)
*
* Side effects:
* May invalidate the colormap cache associated with tkwin upon
- * allocating a new colormap entry. Allocates a new TkColor
- * structure.
+ * allocating a new colormap entry. Allocates a new TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
-TkpGetColor(tkwin, name)
- Tk_Window tkwin; /* Window in which color will be used. */
- Tk_Uid name; /* Name of color to allocated (in form
+TkpGetColor(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ Tk_Uid name) /* Name of color to allocated (in form
* suitable for passing to XParseColor). */
{
WinColor *winColPtr;
XColor color;
int index = -1; /* -1 indicates that this is not an indirect
- * sytem color. */
+ * system color. */
/*
- * Check to see if it is a system color or an X color string. If the
- * color is found, allocate a new WinColor and store the XColor and the
- * system color index.
+ * Check to see if it is a system color or an X color string. If the color
+ * is found, allocate a new WinColor and store the XColor and the system
+ * color index.
*/
if (((strncasecmp(name, "system", 6) == 0)
@@ -209,7 +208,7 @@ TkpGetColor(tkwin, name)
XAllocColor(Tk_Display(tkwin), Tk_Colormap(tkwin),
&winColPtr->info.color);
- return (TkColor *) winColPtr;
+ return (TkColor *) winColPtr;
}
return (TkColor *) NULL;
}
@@ -219,27 +218,26 @@ TkpGetColor(tkwin, name)
*
* TkpGetColorByValue --
*
- * Given a desired set of red-green-blue intensities for a color,
- * locate a pixel value to use to draw that color in a given
- * window.
+ * Given a desired set of red-green-blue intensities for a color, locate
+ * a pixel value to use to draw that color in a given window.
*
* Results:
- * The return value is a pointer to an TkColor structure that
- * indicates the closest red, blue, and green intensities available
- * to those specified in colorPtr, and also specifies a pixel
- * value to use to draw in that color.
+ * The return value is a pointer to an TkColor structure that indicates
+ * the closest red, blue, and green intensities available to those
+ * specified in colorPtr, and also specifies a pixel value to use to draw
+ * in that color.
*
* Side effects:
- * May invalidate the colormap cache for the specified window.
- * Allocates a new TkColor structure.
+ * May invalidate the colormap cache for the specified window. Allocates
+ * a new TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
-TkpGetColorByValue(tkwin, colorPtr)
- Tk_Window tkwin; /* Window in which color will be used. */
- XColor *colorPtr; /* Red, green, and blue fields indicate
+TkpGetColorByValue(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
WinColor *tkColPtr = (WinColor *) ckalloc(sizeof(WinColor));
@@ -264,15 +262,15 @@ TkpGetColorByValue(tkwin, colorPtr)
* None
*
* Side effects:
- * Invalidates the colormap cache for the colormap associated with
- * the given color.
+ * Invalidates the colormap cache for the colormap associated with the
+ * given color.
*
*----------------------------------------------------------------------
*/
void
-TkpFreeColor(tkColPtr)
- TkColor *tkColPtr; /* Color to be released. Must have been
+TkpFreeColor(
+ TkColor *tkColPtr) /* Color to be released. Must have been
* allocated by TkpGetColor or
* TkpGetColorByValue. */
{
@@ -287,13 +285,13 @@ TkpFreeColor(tkColPtr)
*
* TkWinIndexOfColor --
*
- * Given a color, return the system color index that was used
- * to create the color.
+ * Given a color, return the system color index that was used to create
+ * the color.
*
* Results:
- * If the color was allocated using a system indirect color name,
- * then the corresponding GetSysColor() index is returned.
- * Otherwise, -1 is returned.
+ * If the color was allocated using a system indirect color name, then
+ * the corresponding GetSysColor() index is returned. Otherwise, -1 is
+ * returned.
*
* Side effects:
* None.
@@ -302,13 +300,13 @@ TkpFreeColor(tkColPtr)
*/
int
-TkWinIndexOfColor(colorPtr)
- XColor *colorPtr;
+TkWinIndexOfColor(
+ XColor *colorPtr)
{
register WinColor *winColPtr = (WinColor *) colorPtr;
if (winColPtr->info.magic == COLOR_MAGIC) {
return winColPtr->index;
- }
+ }
return -1;
}
@@ -320,8 +318,8 @@ TkWinIndexOfColor(colorPtr)
* Find the closest available color to the specified XColor.
*
* Results:
- * Updates the color argument and returns 1 on success. Otherwise
- * returns 0.
+ * Updates the color argument and returns 1 on success. Otherwise returns
+ * 0.
*
* Side effects:
* Allocates a new color in the palette.
@@ -330,10 +328,10 @@ TkWinIndexOfColor(colorPtr)
*/
int
-XAllocColor(display, colormap, color)
- Display* display;
- Colormap colormap;
- XColor* color;
+XAllocColor(
+ Display *display,
+ Colormap colormap,
+ XColor *color)
{
TkWinColormap *cmap = (TkWinColormap *) colormap;
PALETTEENTRY entry, closeEntry;
@@ -354,7 +352,7 @@ XAllocColor(display, colormap, color)
/*
* Find the nearest existing palette entry.
*/
-
+
newPixel = RGB(entry.peRed, entry.peGreen, entry.peBlue);
index = GetNearestPaletteIndex(cmap->palette, newPixel);
GetPaletteEntries(cmap->palette, index, 1, &closeEntry);
@@ -362,15 +360,14 @@ XAllocColor(display, colormap, color)
closeEntry.peBlue);
/*
- * If this is not a duplicate, allocate a new entry. Note that
- * we may get values for index that are above the current size
- * of the palette. This happens because we don't shrink the size of
- * the palette object when we deallocate colors so there may be
- * stale values that match in the upper slots. We should ignore
- * those values and just put the new color in as if the colors
- * had not matched.
+ * If this is not a duplicate, allocate a new entry. Note that we may
+ * get values for index that are above the current size of the
+ * palette. This happens because we don't shrink the size of the
+ * palette object when we deallocate colors so there may be stale
+ * values that match in the upper slots. We should ignore those values
+ * and just put the new color in as if the colors had not matched.
*/
-
+
if ((index >= cmap->size) || (newPixel != closePixel)) {
if (cmap->size == sizePalette) {
color->red = closeEntry.peRed * 257;
@@ -389,19 +386,18 @@ XAllocColor(display, colormap, color)
color->pixel = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue);
entryPtr = Tcl_CreateHashEntry(&cmap->refCounts,
- (char *) color->pixel, &new);
+ INT2PTR(color->pixel), &new);
if (new) {
refCount = 1;
} else {
- refCount = ((int) Tcl_GetHashValue(entryPtr)) + 1;
+ refCount = (PTR2INT(Tcl_GetHashValue(entryPtr))) + 1;
}
- Tcl_SetHashValue(entryPtr, (ClientData)refCount);
+ Tcl_SetHashValue(entryPtr, INT2PTR(refCount));
} else {
-
/*
* Determine what color will actually be used on non-colormap systems.
*/
-
+
color->pixel = GetNearestColor(dc,
RGB(entry.peRed, entry.peGreen, entry.peBlue));
color->red = GetRValue(color->pixel) * 257;
@@ -424,19 +420,19 @@ XAllocColor(display, colormap, color)
* None.
*
* Side effects:
- * Removes entries for the current palette and compacts the
- * remaining set.
+ * Removes entries for the current palette and compacts the remaining
+ * set.
*
*----------------------------------------------------------------------
*/
void
-XFreeColors(display, colormap, pixels, npixels, planes)
- Display* display;
- Colormap colormap;
- unsigned long* pixels;
- int npixels;
- unsigned long planes;
+XFreeColors(
+ Display *display,
+ Colormap colormap,
+ unsigned long *pixels,
+ int npixels,
+ unsigned long planes)
{
TkWinColormap *cmap = (TkWinColormap *) colormap;
COLORREF cref;
@@ -449,38 +445,36 @@ XFreeColors(display, colormap, pixels, npixels, planes)
/*
* We don't have to do anything for non-palette devices.
*/
-
- if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
+ if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
/*
* This is really slow for large values of npixels.
*/
for (i = 0; i < npixels; i++) {
- entryPtr = Tcl_FindHashEntry(&cmap->refCounts,
- (char *) pixels[i]);
+ entryPtr = Tcl_FindHashEntry(&cmap->refCounts, INT2PTR(pixels[i]));
if (!entryPtr) {
- panic("Tried to free a color that isn't allocated.");
+ Tcl_Panic("Tried to free a color that isn't allocated.");
}
- refCount = (int) Tcl_GetHashValue(entryPtr) - 1;
+ refCount = PTR2INT(Tcl_GetHashValue(entryPtr)) - 1;
if (refCount == 0) {
cref = pixels[i] & 0x00ffffff;
index = GetNearestPaletteIndex(cmap->palette, cref);
GetPaletteEntries(cmap->palette, index, 1, &entry);
if (cref == RGB(entry.peRed, entry.peGreen, entry.peBlue)) {
count = cmap->size - index;
- entries = (PALETTEENTRY *) ckalloc(sizeof(PALETTEENTRY)
- * count);
+ entries = (PALETTEENTRY *)
+ ckalloc(sizeof(PALETTEENTRY) * count);
GetPaletteEntries(cmap->palette, index+1, count, entries);
SetPaletteEntries(cmap->palette, index, count, entries);
ckfree((char *) entries);
cmap->size--;
} else {
- panic("Tried to free a color that isn't allocated.");
+ Tcl_Panic("Tried to free a color that isn't allocated.");
}
Tcl_DeleteHashEntry(entryPtr);
} else {
- Tcl_SetHashValue(entryPtr, (ClientData)refCount);
+ Tcl_SetHashValue(entryPtr, INT2PTR(refCount));
}
}
}
@@ -504,11 +498,11 @@ XFreeColors(display, colormap, pixels, npixels, planes)
*/
Colormap
-XCreateColormap(display, w, visual, alloc)
- Display* display;
- Window w;
- Visual* visual;
- int alloc;
+XCreateColormap(
+ Display *display,
+ Window w,
+ Visual *visual,
+ int alloc)
{
char logPalBuf[sizeof(LOGPALETTE) + 256 * sizeof(PALETTEENTRY)];
LOGPALETTE *logPalettePtr;
@@ -541,9 +535,9 @@ XCreateColormap(display, w, visual, alloc)
Tcl_InitHashTable(&cmap->refCounts, TCL_ONE_WORD_KEYS);
for (i = 0; i < logPalettePtr->palNumEntries; i++) {
entryPtr = logPalettePtr->palPalEntry + i;
- hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, (char*) PALETTERGB(
- entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue), &new);
- Tcl_SetHashValue(hashPtr, (ClientData)1);
+ hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(PALETTERGB(
+ entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &new);
+ Tcl_SetHashValue(hashPtr, INT2PTR(1));
}
return (Colormap)cmap;
@@ -560,21 +554,21 @@ XCreateColormap(display, w, visual, alloc)
* None.
*
* Side effects:
- * Deletes the palette associated with the colormap. Note that
- * the palette must not be selected into a device context when
- * this occurs.
+ * Deletes the palette associated with the colormap. Note that the
+ * palette must not be selected into a device context when this occurs.
*
*----------------------------------------------------------------------
*/
void
-XFreeColormap(display, colormap)
- Display* display;
- Colormap colormap;
+XFreeColormap(
+ Display *display,
+ Colormap colormap)
{
TkWinColormap *cmap = (TkWinColormap *) colormap;
+
if (!DeleteObject(cmap->palette)) {
- panic("Unable to free colormap, palette is still selected.");
+ Tcl_Panic("Unable to free colormap, palette is still selected.");
}
Tcl_DeleteHashTable(&cmap->refCounts);
ckfree((char *) cmap);
@@ -585,10 +579,9 @@ XFreeColormap(display, colormap)
*
* TkWinSelectPalette --
*
- * This function sets up the specified device context with a
- * given palette. If the palette is stale, it realizes it in
- * the background unless the palette is the current global
- * palette.
+ * This function sets up the specified device context with a given
+ * palette. If the palette is stale, it realizes it in the background
+ * unless the palette is the current global palette.
*
* Results:
* Returns the previous palette selected into the device context.
@@ -600,9 +593,9 @@ XFreeColormap(display, colormap)
*/
HPALETTE
-TkWinSelectPalette(dc, colormap)
- HDC dc;
- Colormap colormap;
+TkWinSelectPalette(
+ HDC dc,
+ Colormap colormap)
{
TkWinColormap *cmap = (TkWinColormap *) colormap;
HPALETTE oldPalette;
@@ -612,3 +605,11 @@ TkWinSelectPalette(dc, colormap)
RealizePalette(dc);
return oldPalette;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinConfig.c b/win/tkWinConfig.c
index efb619e..422e399 100644
--- a/win/tkWinConfig.c
+++ b/win/tkWinConfig.c
@@ -1,17 +1,15 @@
-/*
+/*
* tkWinConfig.c --
*
- * This module implements the Windows system defaults for
- * the configuration package.
+ * This module implements the Windows system defaults for the
+ * configuration package.
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tk.h"
-#include "tkInt.h"
#include "tkWinInt.h"
@@ -20,13 +18,13 @@
*
* TkpGetSystemDefault --
*
- * Given a dbName and className for a configuration option,
- * return a string representation of the option.
+ * Given a dbName and className for a configuration option, return a
+ * string representation of the option.
*
* Results:
- * Returns a Tk_Uid that is the string identifier that identifies
- * this option. Returns NULL if there are no system defaults
- * that match this pair.
+ * Returns a Tk_Uid that is the string identifier that identifies this
+ * option. Returns NULL if there are no system defaults that match this
+ * pair.
*
* Side effects:
* None, once the package is initialized.
@@ -38,7 +36,7 @@ Tcl_Obj *
TkpGetSystemDefault(
Tk_Window tkwin, /* A window to use. */
CONST char *dbName, /* The option database name. */
- CONST char *className) /* The name of the option class. */
+ CONST char *className) /* The name of the option class. */
{
Tcl_Obj *valueObjPtr;
Tk_Uid classUid;
@@ -56,3 +54,11 @@ TkpGetSystemDefault(
return valueObjPtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index 4a0f11a..dee3419 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -1,19 +1,19 @@
-/*
+/*
* tkWinCursor.c --
*
* This file contains Win32 specific cursor related routines.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
/*
- * The following data structure contains the system specific data
- * necessary to control Windows cursors.
+ * The following data structure contains the system specific data necessary to
+ * control Windows cursors.
*/
typedef struct {
@@ -23,16 +23,20 @@ typedef struct {
} TkWinCursor;
/*
- * The HAND cursor is only present when WINVER >= 0x0500. If this is
- * not available at runtime, it will default to the unix-style cursor.
+ * The HAND cursor is only present when WINVER >= 0x0500. If this is not
+ * available at runtime, it will default to the unix-style cursor.
*/
+
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
+#ifndef IDC_HELP
+#define IDC_HELP MAKEINTRESOURCE(32651)
+#endif
/*
- * The table below is used to map from the name of a predefined cursor
- * to its resource identifier.
+ * The table below is used to map from the name of a predefined cursor to its
+ * resource identifier.
*/
static struct CursorName {
@@ -59,6 +63,7 @@ static struct CursorName {
{"watch", IDC_WAIT},
{"xterm", IDC_IBEAM},
{"hand2", IDC_HAND},
+ {"question_arrow", IDC_HELP},
{NULL, 0}
};
@@ -74,10 +79,10 @@ static struct CursorName {
*
* TkGetCursorByName --
*
- * Retrieve a system cursor by name.
+ * Retrieve a system cursor by name.
*
* Results:
- * Returns a new cursor, or NULL on errors.
+ * Returns a new cursor, or NULL on errors.
*
* Side effects:
* Allocates a new cursor.
@@ -86,11 +91,11 @@ static struct CursorName {
*/
TkCursor *
-TkGetCursorByName(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which cursor will be used. */
- Tk_Uid string; /* Description of cursor. See manual entry
- * for details on legal syntax. */
+TkGetCursorByName(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ Tk_Uid string) /* Description of cursor. See manual entry for
+ * details on legal syntax. */
{
struct CursorName *namePtr;
TkWinCursor *cursorPtr;
@@ -116,8 +121,8 @@ TkGetCursorByName(interp, tkwin, string)
if (argv[0][0] == '@') {
/*
- * Check for system cursor of type @<filename>, where only
- * the name is allowed. This accepts any of:
+ * Check for system cursor of type @<filename>, where only the name is
+ * allowed. This accepts any of:
* -cursor @/winnt/cursors/globe.ani
* -cursor @C:/Winnt/cursors/E_arrow.cur
* -cursor {@C:/Program\ Files/Cursors/bart.ani}
@@ -127,7 +132,7 @@ TkGetCursorByName(interp, tkwin, string)
if (Tcl_IsSafe(interp)) {
Tcl_AppendResult(interp, "can't get cursor from a file in",
- " a safe interpreter", (char *) NULL);
+ " a safe interpreter", NULL);
ckfree((char *) argv);
ckfree((char *) cursorPtr);
return NULL;
@@ -137,6 +142,7 @@ TkGetCursorByName(interp, tkwin, string)
/*
* Check for the cursor in the system cursor set.
*/
+
for (namePtr = cursorNames; namePtr->name != NULL; namePtr++) {
if (strcmp(namePtr->name, argv[0]) == 0) {
cursorPtr->winCursor = LoadCursor(NULL, namePtr->id);
@@ -146,9 +152,10 @@ TkGetCursorByName(interp, tkwin, string)
if (cursorPtr->winCursor == NULL) {
/*
- * Hmm, it is not in the system cursor set. Check to see
- * if it is one of our application resources.
+ * Hmm, it is not in the system cursor set. Check to see if it is
+ * one of our application resources.
*/
+
cursorPtr->winCursor = LoadCursor(Tk_GetHINSTANCE(), argv[0]);
} else {
cursorPtr->system = 1;
@@ -159,8 +166,7 @@ TkGetCursorByName(interp, tkwin, string)
ckfree((char *) cursorPtr);
badCursorSpec:
ckfree((char *) argv);
- Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
return NULL;
} else {
ckfree((char *) argv);
@@ -185,15 +191,14 @@ TkGetCursorByName(interp, tkwin, string)
*/
TkCursor *
-TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
- fgColor, bgColor)
- Tk_Window tkwin; /* Window in which cursor will be used. */
- CONST char *source; /* Bitmap data for cursor shape. */
- CONST char *mask; /* Bitmap data for cursor mask. */
- int width, height; /* Dimensions of cursor. */
- int xHot, yHot; /* Location of hot-spot in cursor. */
- XColor fgColor; /* Foreground color for cursor. */
- XColor bgColor; /* Background color for cursor. */
+TkCreateCursorFromData(
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ CONST char *source, /* Bitmap data for cursor shape. */
+ CONST char *mask, /* Bitmap data for cursor mask. */
+ int width, int height, /* Dimensions of cursor. */
+ int xHot, int yHot, /* Location of hot-spot in cursor. */
+ XColor fgColor, /* Foreground color for cursor. */
+ XColor bgColor) /* Background color for cursor. */
{
return NULL;
}
@@ -216,9 +221,10 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
*/
void
-TkpFreeCursor(cursorPtr)
- TkCursor *cursorPtr;
+TkpFreeCursor(
+ TkCursor *cursorPtr)
{
+ /* TkWinCursor *winCursorPtr = (TkWinCursor *) cursorPtr; */
}
/*
@@ -226,8 +232,8 @@ TkpFreeCursor(cursorPtr)
*
* TkpSetCursor --
*
- * Set the global cursor. If the cursor is None, then use the
- * default Tk cursor.
+ * Set the global cursor. If the cursor is None, then use the default Tk
+ * cursor.
*
* Results:
* None.
@@ -239,8 +245,8 @@ TkpFreeCursor(cursorPtr)
*/
void
-TkpSetCursor(cursor)
- TkpCursor cursor;
+TkpSetCursor(
+ TkpCursor cursor)
{
HCURSOR hcursor;
TkWinCursor *winCursor = (TkWinCursor *) cursor;
@@ -255,3 +261,11 @@ TkpSetCursor(cursor)
SetCursor(hcursor);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h
index dcc810e..a1a76c7 100644
--- a/win/tkWinDefault.h
+++ b/win/tkWinDefault.h
@@ -26,7 +26,6 @@
#define BLACK "Black"
#define WHITE "White"
-#define CTL_FONT "{MS Sans Serif} 8"
#define NORMAL_BG "SystemButtonFace"
#define NORMAL_FG "SystemButtonText"
#define ACTIVE_BG NORMAL_BG
@@ -62,7 +61,7 @@
#define DEF_BUTTON_DISABLED_FG_MONO ""
#define DEF_BUTTON_FG NORMAL_FG
#define DEF_CHKRAD_FG TEXT_FG
-#define DEF_BUTTON_FONT CTL_FONT
+#define DEF_BUTTON_FONT "TkDefaultFont"
#define DEF_BUTTON_HEIGHT "0"
#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO
@@ -91,6 +90,7 @@
#define DEF_BUTTON_TAKE_FOCUS (char *) NULL
#define DEF_BUTTON_TEXT ""
#define DEF_BUTTON_TEXT_VARIABLE ""
+#define DEF_BUTTON_TRISTATE_VALUE ""
#define DEF_BUTTON_UNDERLINE "-1"
#define DEF_BUTTON_VALUE ""
#define DEF_BUTTON_WIDTH "0"
@@ -139,13 +139,13 @@
#define DEF_ENTRY_BG_COLOR "SystemWindow"
#define DEF_ENTRY_BG_MONO WHITE
-#define DEF_ENTRY_BORDER_WIDTH "2"
+#define DEF_ENTRY_BORDER_WIDTH "1"
#define DEF_ENTRY_CURSOR "xterm"
#define DEF_ENTRY_DISABLED_BG_COLOR "SystemButtonFace"
#define DEF_ENTRY_DISABLED_BG_MONO WHITE
#define DEF_ENTRY_DISABLED_FG DISABLED
#define DEF_ENTRY_EXPORT_SELECTION "1"
-#define DEF_ENTRY_FONT CTL_FONT
+#define DEF_ENTRY_FONT "TkTextFont"
#define DEF_ENTRY_FG TEXT_FG
#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG
#define DEF_ENTRY_HIGHLIGHT HIGHLIGHT
@@ -203,7 +203,7 @@
#define DEF_LABELFRAME_CLASS "Labelframe"
#define DEF_LABELFRAME_RELIEF "groove"
#define DEF_LABELFRAME_FG NORMAL_FG
-#define DEF_LABELFRAME_FONT CTL_FONT
+#define DEF_LABELFRAME_FONT "TkDefaultFont"
#define DEF_LABELFRAME_TEXT ""
#define DEF_LABELFRAME_LABELANCHOR "nw"
@@ -214,11 +214,11 @@
#define DEF_LISTBOX_ACTIVE_STYLE "underline"
#define DEF_LISTBOX_BG_COLOR "SystemWindow"
#define DEF_LISTBOX_BG_MONO WHITE
-#define DEF_LISTBOX_BORDER_WIDTH "2"
+#define DEF_LISTBOX_BORDER_WIDTH "1"
#define DEF_LISTBOX_CURSOR ""
#define DEF_LISTBOX_DISABLED_FG DISABLED
#define DEF_LISTBOX_EXPORT_SELECTION "1"
-#define DEF_LISTBOX_FONT CTL_FONT
+#define DEF_LISTBOX_FONT "TkDefaultFont"
#define DEF_LISTBOX_FG NORMAL_FG
#define DEF_LISTBOX_HEIGHT "10"
#define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG
@@ -282,7 +282,7 @@
#define DEF_MENU_CURSOR "arrow"
#define DEF_MENU_DISABLED_FG_COLOR DISABLED
#define DEF_MENU_DISABLED_FG_MONO ""
-#define DEF_MENU_FONT CTL_FONT
+#define DEF_MENU_FONT "TkMenuFont"
#define DEF_MENU_FG MENU_FG
#define DEF_MENU_POST_COMMAND ""
#define DEF_MENU_RELIEF "flat"
@@ -306,12 +306,12 @@
#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
#define DEF_MENUBUTTON_BG_MONO WHITE
#define DEF_MENUBUTTON_BITMAP ""
-#define DEF_MENUBUTTON_BORDER_WIDTH "2"
+#define DEF_MENUBUTTON_BORDER_WIDTH "1"
#define DEF_MENUBUTTON_CURSOR ""
#define DEF_MENUBUTTON_DIRECTION "below"
#define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED
#define DEF_MENUBUTTON_DISABLED_FG_MONO ""
-#define DEF_MENUBUTTON_FONT CTL_FONT
+#define DEF_MENUBUTTON_FONT "TkDefaultFont"
#define DEF_MENUBUTTON_FG NORMAL_FG
#define DEF_MENUBUTTON_HEIGHT "0"
#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
@@ -341,10 +341,10 @@
#define DEF_MESSAGE_ASPECT "150"
#define DEF_MESSAGE_BG_COLOR NORMAL_BG
#define DEF_MESSAGE_BG_MONO WHITE
-#define DEF_MESSAGE_BORDER_WIDTH "2"
+#define DEF_MESSAGE_BORDER_WIDTH "1"
#define DEF_MESSAGE_CURSOR ""
#define DEF_MESSAGE_FG NORMAL_FG
-#define DEF_MESSAGE_FONT CTL_FONT
+#define DEF_MESSAGE_FONT "TkDefaultFont"
#define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG
#define DEF_MESSAGE_HIGHLIGHT HIGHLIGHT
#define DEF_MESSAGE_HIGHLIGHT_WIDTH "0"
@@ -363,18 +363,18 @@
#define DEF_PANEDWINDOW_BG_COLOR NORMAL_BG
#define DEF_PANEDWINDOW_BG_MONO WHITE
-#define DEF_PANEDWINDOW_BORDERWIDTH "2"
+#define DEF_PANEDWINDOW_BORDERWIDTH "1"
#define DEF_PANEDWINDOW_CURSOR ""
#define DEF_PANEDWINDOW_HANDLEPAD "8"
#define DEF_PANEDWINDOW_HANDLESIZE "8"
#define DEF_PANEDWINDOW_HEIGHT ""
-#define DEF_PANEDWINDOW_OPAQUERESIZE "0"
+#define DEF_PANEDWINDOW_OPAQUERESIZE "1"
#define DEF_PANEDWINDOW_ORIENT "horizontal"
#define DEF_PANEDWINDOW_RELIEF "flat"
#define DEF_PANEDWINDOW_SASHCURSOR ""
-#define DEF_PANEDWINDOW_SASHPAD "2"
-#define DEF_PANEDWINDOW_SASHRELIEF "raised"
-#define DEF_PANEDWINDOW_SASHWIDTH "2"
+#define DEF_PANEDWINDOW_SASHPAD "0"
+#define DEF_PANEDWINDOW_SASHRELIEF "flat"
+#define DEF_PANEDWINDOW_SASHWIDTH "3"
#define DEF_PANEDWINDOW_SHOWHANDLE "0"
#define DEF_PANEDWINDOW_WIDTH ""
@@ -390,6 +390,8 @@
#define DEF_PANEDWINDOW_PANE_PADY "0"
#define DEF_PANEDWINDOW_PANE_STICKY "nsew"
#define DEF_PANEDWINDOW_PANE_WIDTH ""
+#define DEF_PANEDWINDOW_PANE_HIDE "0"
+#define DEF_PANEDWINDOW_PANE_STRETCH "last"
/*
* Defaults for scales:
@@ -400,11 +402,11 @@
#define DEF_SCALE_BG_COLOR NORMAL_BG
#define DEF_SCALE_BG_MONO WHITE
#define DEF_SCALE_BIG_INCREMENT "0"
-#define DEF_SCALE_BORDER_WIDTH "2"
+#define DEF_SCALE_BORDER_WIDTH "1"
#define DEF_SCALE_COMMAND ""
#define DEF_SCALE_CURSOR ""
#define DEF_SCALE_DIGITS "0"
-#define DEF_SCALE_FONT CTL_FONT
+#define DEF_SCALE_FONT "TkDefaultFont"
#define DEF_SCALE_FG_COLOR NORMAL_FG
#define DEF_SCALE_FG_MONO BLACK
#define DEF_SCALE_FROM "0"
@@ -464,11 +466,12 @@
#define DEF_TEXT_AUTO_SEPARATORS "1"
#define DEF_TEXT_BG_COLOR "SystemWindow"
#define DEF_TEXT_BG_MONO WHITE
-#define DEF_TEXT_BORDER_WIDTH "2"
+#define DEF_TEXT_BLOCK_CURSOR "0"
+#define DEF_TEXT_BORDER_WIDTH "1"
#define DEF_TEXT_CURSOR "xterm"
#define DEF_TEXT_FG TEXT_FG
#define DEF_TEXT_EXPORT_SELECTION "1"
-#define DEF_TEXT_FONT CTL_FONT
+#define DEF_TEXT_FONT "TkFixedFont"
#define DEF_TEXT_HEIGHT "24"
#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG
#define DEF_TEXT_HIGHLIGHT HIGHLIGHT
@@ -483,6 +486,7 @@
#define DEF_TEXT_PADX "1"
#define DEF_TEXT_PADY "1"
#define DEF_TEXT_RELIEF "sunken"
+#define DEF_TEXT_INACTIVE_SELECT_COLOR NULL
#define DEF_TEXT_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_MONO BLACK
#define DEF_TEXT_SELECT_BD_COLOR "0"
@@ -496,6 +500,7 @@
#define DEF_TEXT_SPACING3 "0"
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
+#define DEF_TEXT_TABSTYLE "tabular"
#define DEF_TEXT_TAKE_FOCUS (char *) NULL
#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
@@ -507,7 +512,7 @@
* Defaults for canvas text:
*/
-#define DEF_CANVTEXT_FONT CTL_FONT
+#define DEF_CANVTEXT_FONT "TkDefaultFont"
/*
* Defaults for toplevels (most of the defaults for frames also apply
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 775d06b..6b50215 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -5,69 +5,82 @@
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#define WINVER 0x0500 /* Requires Windows 2K definitions */
+#define _WIN32_WINNT 0x0500
#include "tkWinInt.h"
#include "tkFileFilter.h"
-#include <commdlg.h> /* includes common dialog functionality */
-#include <dlgs.h> /* includes common dialog template defines */
-#include <cderr.h> /* includes the common dialog error codes */
+#include <commdlg.h> /* includes common dialog functionality */
+#ifdef _MSC_VER
+# pragma comment (lib, "comdlg32.lib")
+#endif
+#include <dlgs.h> /* includes common dialog template defines */
+#include <cderr.h> /* includes the common dialog error codes */
-/*
- * This controls the use of the new style tk_chooseDirectory dialog.
- */
-#define USE_NEW_CHOOSEDIR 1
-#ifdef USE_NEW_CHOOSEDIR
-#include <shlobj.h> /* includes SHBrowseForFolder */
+#include <shlobj.h> /* includes SHBrowseForFolder */
+#ifdef _MSC_VER
+# pragma comment (lib, "shell32.lib")
+#endif
/* These needed for compilation with VC++ 5.2 */
#ifndef BIF_EDITBOX
#define BIF_EDITBOX 0x10
#endif
+
#ifndef BIF_VALIDATE
#define BIF_VALIDATE 0x0020
#endif
+
+#ifndef BIF_NEWDIALOGSTYLE
+#define BIF_NEWDIALOGSTYLE 0x0040
+#endif
+
#ifndef BFFM_VALIDATEFAILED
#ifdef UNICODE
#define BFFM_VALIDATEFAILED 4
#else
#define BFFM_VALIDATEFAILED 3
#endif
-#endif
+#endif /* BFFM_VALIDATEFAILED */
+
+#ifndef OPENFILENAME_SIZE_VERSION_400
+#define OPENFILENAME_SIZE_VERSION_400 76
+#endif
/*
- * The following structure is used by the new Tk_ChooseDirectoryObjCmd
- * to pass data between it and its callback. Unqiue to Winodws platform.
+ * The following structure is used by the new Tk_ChooseDirectoryObjCmd to pass
+ * data between it and its callback. Unqiue to Winodws platform.
*/
+
typedef struct ChooseDirData {
- TCHAR utfInitDir[MAX_PATH]; /* Initial folder to use */
- TCHAR utfRetDir[MAX_PATH]; /* Returned folder to use */
+ TCHAR utfInitDir[MAX_PATH]; /* Initial folder to use */
+ TCHAR utfRetDir[MAX_PATH]; /* Returned folder to use */
Tcl_Interp *interp;
- int mustExist; /* true if file must exist to return from
- * callback */
+ int mustExist; /* True if file must exist to return from
+ * callback */
} CHOOSEDIRDATA;
-#endif
-typedef struct ThreadSpecificData {
- int debugFlag; /* Flags whether we should output debugging
- * information while displaying a builtin
- * dialog. */
- Tcl_Interp *debugInterp; /* Interpreter to used for debugging. */
- UINT WM_LBSELCHANGED; /* Holds a registered windows event used for
- * communicating between the Directory
- * Chooser dialog and its hook proc. */
- HHOOK hMsgBoxHook; /* Hook proc for tk_messageBox and the */
- HICON hSmallIcon; /* icons used by a parent to be used in */
- HICON hBigIcon; /* the message box */
+typedef struct ThreadSpecificData {
+ int debugFlag; /* Flags whether we should output debugging
+ * information while displaying a builtin
+ * dialog. */
+ Tcl_Interp *debugInterp; /* Interpreter to used for debugging. */
+ UINT WM_LBSELCHANGED; /* Holds a registered windows event used for
+ * communicating between the Directory Chooser
+ * dialog and its hook proc. */
+ HHOOK hMsgBoxHook; /* Hook proc for tk_messageBox and the */
+ HICON hSmallIcon; /* icons used by a parent to be used in */
+ HICON hBigIcon; /* the message box */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * The following structures are used by Tk_MessageBoxCmd() to parse
- * arguments and return results.
+ * The following structures are used by Tk_MessageBoxCmd() to parse arguments
+ * and return results.
*/
static const TkStateMap iconMap[] = {
@@ -77,10 +90,10 @@ static const TkStateMap iconMap[] = {
{MB_ICONWARNING, "warning"},
{-1, NULL}
};
-
+
static const TkStateMap typeMap[] = {
{MB_ABORTRETRYIGNORE, "abortretryignore"},
- {MB_OK, "ok"},
+ {MB_OK, "ok"},
{MB_OKCANCEL, "okcancel"},
{MB_RETRYCANCEL, "retrycancel"},
{MB_YESNO, "yesno"},
@@ -105,99 +118,123 @@ static const int buttonFlagMap[] = {
static const struct {int type; int btnIds[3];} allowedTypes[] = {
{MB_ABORTRETRYIGNORE, {IDABORT, IDRETRY, IDIGNORE}},
- {MB_OK, {IDOK, -1, -1 }},
- {MB_OKCANCEL, {IDOK, IDCANCEL, -1 }},
- {MB_RETRYCANCEL, {IDRETRY, IDCANCEL, -1 }},
- {MB_YESNO, {IDYES, IDNO, -1 }},
- {MB_YESNOCANCEL, {IDYES, IDNO, IDCANCEL}}
+ {MB_OK, {IDOK, -1, -1 }},
+ {MB_OKCANCEL, {IDOK, IDCANCEL, -1 }},
+ {MB_RETRYCANCEL, {IDRETRY, IDCANCEL, -1 }},
+ {MB_YESNO, {IDYES, IDNO, -1 }},
+ {MB_YESNOCANCEL, {IDYES, IDNO, IDCANCEL}}
};
#define NUM_TYPES (sizeof(allowedTypes) / sizeof(allowedTypes[0]))
/*
- * The value of TK_MULTI_MAX_PATH dictactes how many files can
- * be retrieved with tk_get*File -multiple 1. It must be allocated
- * on the stack, so make it large enough but not too large. -- hobbs
- * The data is stored as <dir>\0<file1>\0<file2>\0...<fileN>\0\0.
- * MAX_PATH == 260 on Win2K/NT, so *40 is ~10K.
+ * Abstract trivial differences between Win32 and Win64.
+ */
+
+#define TkWinGetHInstance(from) \
+ ((HINSTANCE) GetWindowLongPtr((from), GWLP_HINSTANCE))
+#define TkWinGetUserData(from) \
+ GetWindowLongPtr((from), GWLP_USERDATA)
+#define TkWinSetUserData(to,what) \
+ SetWindowLongPtr((to), GWLP_USERDATA, (LPARAM)(what))
+
+/*
+ * The value of TK_MULTI_MAX_PATH dictactes how many files can be retrieved
+ * with tk_get*File -multiple 1. It must be allocated on the stack, so make it
+ * large enough but not too large. - hobbs
+ *
+ * The data is stored as <dir>\0<file1>\0<file2>\0...<fileN>\0\0. Since
+ * MAX_PATH == 260 on Win2K/NT, *40 is ~10Kbytes.
*/
#define TK_MULTI_MAX_PATH (MAX_PATH*40)
/*
* The following structure is used to pass information between the directory
- * chooser procedure, Tk_ChooseDirectoryObjCmd(), and its dialog hook proc.
+ * chooser function, Tk_ChooseDirectoryObjCmd(), and its dialog hook proc.
*/
typedef struct ChooseDir {
- Tcl_Interp *interp; /* Interp, used only if debug is turned on,
+ Tcl_Interp *interp; /* Interp, used only if debug is turned on,
* for setting the "tk_dialog" variable. */
int lastCtrl; /* Used by hook proc to keep track of last
- * control that had input focus, so when OK
- * is pressed we know whether to browse a
- * new directory or return. */
- int lastIdx; /* Last item that was selected in directory
+ * control that had input focus, so when OK is
+ * pressed we know whether to browse a new
+ * directory or return. */
+ int lastIdx; /* Last item that was selected in directory
* browser listbox. */
- TCHAR path[MAX_PATH]; /* On return from choose directory dialog,
- * holds the selected path. Cannot return
+ TCHAR path[MAX_PATH]; /* On return from choose directory dialog,
+ * holds the selected path. Cannot return
* selected path in ofnPtr->lpstrFile because
- * the default dialog proc stores a '\0' in
- * it, since, of course, no _file_ was
+ * the default dialog proc stores a '\0' in
+ * it, since, of course, no _file_ was
* selected. */
OPENFILENAME *ofnPtr; /* pointer to the OFN structure */
} ChooseDir;
/*
- * Definitions of procedures used only in this file.
+ * The following structure is used to pass information between GetFileName/W
+ * functions and OFN dialog hook procedures. [Bug 2896501, Patch 2898255]
+ */
+
+typedef struct OFNData {
+ Tcl_Interp *interp; /* Interp, used only if debug is turned on,
+ * for setting the "tk_dialog" variable. */
+ int dynFileBufferSize; /* Dynamic filename buffer size, stored to
+ * avoid shrinking and expanding the buffer
+ * when selection changes */
+ char *dynFileBuffer; /* Dynamic filename buffer, cast to WCHAR* in
+ * UNICODE procedures */
+} OFNData;
+
+/*
+ * Definitions of functions used only in this file.
*/
-#ifdef USE_NEW_CHOOSEDIR
static UINT APIENTRY ChooseDirectoryValidateProc(HWND hdlg, UINT uMsg,
LPARAM wParam, LPARAM lParam);
-#else
-static UINT APIENTRY ChooseDirectoryHookProc(HWND hdlg, UINT uMsg,
- WPARAM wParam, LPARAM lParam);
-#endif
static UINT CALLBACK ColorDlgHookProc(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
-static int GetFileNameA(ClientData clientData,
- Tcl_Interp *interp, int objc,
+static int GetFileNameA(ClientData clientData,
+ Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[], int isOpen);
-static int GetFileNameW(ClientData clientData,
- Tcl_Interp *interp, int objc,
+static int GetFileNameW(ClientData clientData,
+ Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[], int isOpen);
-static int MakeFilter(Tcl_Interp *interp, char *string,
- Tcl_DString *dsPtr);
-static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam,
+static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr,
+ Tcl_DString *dsPtr, Tcl_Obj *initialPtr,
+ int *index);
+static UINT APIENTRY OFNHookProcA(HWND hdlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
-static UINT APIENTRY OFNHookProcW(HWND hdlg, UINT uMsg, WPARAM wParam,
+static UINT APIENTRY OFNHookProcW(HWND hdlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam);
static void SetTkDialog(ClientData clientData);
+static char * ConvertExternalFilename(Tcl_Encoding encoding,
+ char *filename, Tcl_DString *dsPtr);
/*
*-------------------------------------------------------------------------
*
* EatSpuriousMessageBugFix --
*
- * In the file open/save dialog, double clicking on a list item
- * causes the dialog box to close, but an unwanted WM_LBUTTONUP
- * message is sent to the window underneath. If the window underneath
- * happens to be a windows control (eg a button) then it will be
- * activated by accident.
- *
- * This problem does not occur in dialog boxes, because windows
- * must do some special processing to solve the problem. (separate
- * message processing functions are used to cope with keyboard
- * navigation of controls.)
- *
- * Here is one solution. After returning, we poll the message queue
- * for 200ms looking for WM_LBUTTON up messages. If we see one it's
- * consumed. If we get a WM_LBUTTONDOWN message, then we exit early,
- * since the user must be doing something new. This fix only works
- * for the current application, so the problem will still occur if
- * the open dialog happens to be over another applications button.
- * However this is a fairly rare occurrance.
+ * In the file open/save dialog, double clicking on a list item causes
+ * the dialog box to close, but an unwanted WM_LBUTTONUP message is sent
+ * to the window underneath. If the window underneath happens to be a
+ * windows control (eg a button) then it will be activated by accident.
+ *
+ * This problem does not occur in dialog boxes, because windows must do
+ * some special processing to solve the problem. (separate message
+ * processing functions are used to cope with keyboard navigation of
+ * controls.)
+ *
+ * Here is one solution. After returning, we poll the message queue for
+ * 1/4s looking for WM_LBUTTON up messages. If we see one it's consumed.
+ * If we get a WM_LBUTTONDOWN message, then we exit early, since the user
+ * must be doing something new. This fix only works for the current
+ * application, so the problem will still occur if the open dialog
+ * happens to be over another applications button. However this is a
+ * fairly rare occurrance.
*
* Results:
* None.
@@ -212,12 +249,13 @@ static void
EatSpuriousMessageBugFix(void)
{
MSG msg;
- DWORD nTime = GetTickCount() + 200;
+ DWORD nTime = GetTickCount() + 250;
+
while (GetTickCount() < nTime) {
- if (PeekMessage(&msg,0,WM_LBUTTONDOWN,WM_LBUTTONDOWN,PM_NOREMOVE)) {
+ if (PeekMessage(&msg, 0, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE)){
break;
}
- PeekMessage(&msg,0,WM_LBUTTONUP,WM_LBUTTONUP,PM_REMOVE);
+ PeekMessage(&msg, 0, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE);
}
}
@@ -227,8 +265,8 @@ EatSpuriousMessageBugFix(void)
* TkWinDialogDebug --
*
* Function to turn on/off debugging support for common dialogs under
- * windows. The variable "tk_debug" is set to the identifier of the
- * dialog window when the modal dialog window pops up and it is safe to
+ * windows. The variable "tk_debug" is set to the identifier of the
+ * dialog window when the modal dialog window pops up and it is safe to
* send messages to the dialog.
*
* Results:
@@ -240,12 +278,12 @@ EatSpuriousMessageBugFix(void)
*-------------------------------------------------------------------------
*/
-void
+void
TkWinDialogDebug(
int debug)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->debugFlag = debug;
}
@@ -255,15 +293,14 @@ TkWinDialogDebug(
*
* Tk_ChooseColorObjCmd --
*
- * This procedure implements the color dialog box for the Windows
- * platform. See the user documentation for details on what it
- * does.
+ * This function implements the color dialog box for the Windows
+ * platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
- * A dialog window is created the first time this procedure is called.
+ * A dialog window is created the first time this function is called.
* This window is not destroyed and will be reused the next time the
* application invokes the "tk_chooseColor" command.
*
@@ -271,13 +308,13 @@ TkWinDialogDebug(
*/
int
-Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_ChooseColorObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- Tk_Window tkwin, parent;
+ Tk_Window tkwin = (Tk_Window) clientData, parent;
HWND hWnd;
int i, oldMode, winCode, result;
CHOOSECOLOR chooseColor;
@@ -294,11 +331,12 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
result = TCL_OK;
if (inited == 0) {
/*
- * dwCustColors stores the custom color which the user can
- * modify. We store these colors in a static array so that the next
- * time the color dialog pops up, the same set of custom colors
- * remain in the dialog.
+ * dwCustColors stores the custom color which the user can modify. We
+ * store these colors in a static array so that the next time the
+ * color dialog pops up, the same set of custom colors remain in the
+ * dialog.
*/
+
for (i = 0; i < 16; i++) {
dwCustColors[i] = RGB(255-i * 10, i, i * 10);
}
@@ -306,11 +344,9 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
inited = 1;
}
- tkwin = (Tk_Window) clientData;
-
parent = tkwin;
chooseColor.lStructSize = sizeof(CHOOSECOLOR);
- chooseColor.hwndOwner = NULL;
+ chooseColor.hwndOwner = NULL;
chooseColor.hInstance = NULL;
chooseColor.rgbResult = oldColor;
chooseColor.lpCustColors = dwCustColors;
@@ -332,36 +368,34 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(optionPtr, NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
+ string = Tcl_GetString(optionPtr);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
return TCL_ERROR;
}
- string = Tcl_GetStringFromObj(valuePtr, NULL);
+ string = Tcl_GetString(valuePtr);
switch ((enum options) index) {
- case COLOR_INITIAL: {
- XColor *colorPtr;
+ case COLOR_INITIAL: {
+ XColor *colorPtr;
- colorPtr = Tk_GetColor(interp, tkwin, string);
- if (colorPtr == NULL) {
- return TCL_ERROR;
- }
- chooseColor.rgbResult = RGB(colorPtr->red / 0x100,
- colorPtr->green / 0x100, colorPtr->blue / 0x100);
- break;
- }
- case COLOR_PARENT: {
- parent = Tk_NameToWindow(interp, string, tkwin);
- if (parent == NULL) {
- return TCL_ERROR;
- }
- break;
+ colorPtr = Tk_GetColor(interp, tkwin, string);
+ if (colorPtr == NULL) {
+ return TCL_ERROR;
}
- case COLOR_TITLE: {
- chooseColor.lCustData = (LPARAM) string;
- break;
+ chooseColor.rgbResult = RGB(colorPtr->red / 0x100,
+ colorPtr->green / 0x100, colorPtr->blue / 0x100);
+ break;
+ }
+ case COLOR_PARENT:
+ parent = Tk_NameToWindow(interp, string, tkwin);
+ if (parent == NULL) {
+ return TCL_ERROR;
}
+ break;
+ case COLOR_TITLE:
+ chooseColor.lCustData = (LPARAM) string;
+ break;
}
}
@@ -369,16 +403,17 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
chooseColor.hwndOwner = NULL;
hWnd = Tk_GetHWND(Tk_WindowId(parent));
chooseColor.hwndOwner = hWnd;
-
+
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
winCode = ChooseColor(&chooseColor);
(void) Tcl_SetServiceMode(oldMode);
/*
- * Ensure that hWnd is enabled, because it can happen that we
- * have updated the wrapper of the parent, which causes us to
- * leave this child disabled (Windows loses sync).
+ * Ensure that hWnd is enabled, because it can happen that we have updated
+ * the wrapper of the parent, which causes us to leave this child disabled
+ * (Windows loses sync).
*/
+
EnableWindow(hWnd, 1);
/*
@@ -399,10 +434,10 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
char color[100];
sprintf(color, "#%02x%02x%02x",
- GetRValue(chooseColor.rgbResult),
- GetGValue(chooseColor.rgbResult),
+ GetRValue(chooseColor.rgbResult),
+ GetGValue(chooseColor.rgbResult),
GetBValue(chooseColor.rgbResult));
- Tcl_AppendResult(interp, color, NULL);
+ Tcl_AppendResult(interp, color, NULL);
oldColor = chooseColor.rgbResult;
result = TCL_OK;
}
@@ -415,12 +450,12 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
*
* ColorDlgHookProc --
*
- * Provides special handling of messages for the Color common dialog
- * box. Used to set the title when the dialog first appears.
+ * Provides special handling of messages for the Color common dialog box.
+ * Used to set the title when the dialog first appears.
*
* Results:
- * The return value is 0 if the default dialog box procedure should
- * handle the message, non-zero otherwise.
+ * The return value is 0 if the default dialog box function should handle
+ * the message, non-zero otherwise.
*
* Side effects:
* Changes the title of the dialog window.
@@ -428,39 +463,39 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
*----------------------------------------------------------------------
*/
-static UINT CALLBACK
-ColorDlgHookProc(hDlg, uMsg, wParam, lParam)
- HWND hDlg; /* Handle to the color dialog. */
- UINT uMsg; /* Type of message. */
- WPARAM wParam; /* First message parameter. */
- LPARAM lParam; /* Second message parameter. */
+static UINT CALLBACK
+ColorDlgHookProc(
+ HWND hDlg, /* Handle to the color dialog. */
+ UINT uMsg, /* Type of message. */
+ WPARAM wParam, /* First message parameter. */
+ LPARAM lParam) /* Second message parameter. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ const char *title;
+ CHOOSECOLOR *ccPtr;
- switch (uMsg) {
- case WM_INITDIALOG: {
- const char *title;
- CHOOSECOLOR *ccPtr;
- Tcl_DString ds;
+ if (WM_INITDIALOG == uMsg) {
- /*
- * Set the title string of the dialog.
- */
+ /*
+ * Set the title string of the dialog.
+ */
- ccPtr = (CHOOSECOLOR *) lParam;
- title = (const char *) ccPtr->lCustData;
- if ((title != NULL) && (title[0] != '\0')) {
- (*tkWinProcs->setWindowText)(hDlg,
- Tcl_WinUtfToTChar(title, -1, &ds));
- Tcl_DStringFree(&ds);
- }
- if (tsdPtr->debugFlag) {
- tsdPtr->debugInterp = (Tcl_Interp *) ccPtr->lpTemplateName;
- Tcl_DoWhenIdle(SetTkDialog, (ClientData) hDlg);
- }
- return TRUE;
+ ccPtr = (CHOOSECOLOR *) lParam;
+ title = (const char *) ccPtr->lCustData;
+
+ if ((title != NULL) && (title[0] != '\0')) {
+ Tcl_DString ds;
+
+ (*tkWinProcs->setWindowText)(hDlg,
+ Tcl_WinUtfToTChar(title, -1, &ds));
+ Tcl_DStringFree(&ds);
}
+ if (tsdPtr->debugFlag) {
+ tsdPtr->debugInterp = (Tcl_Interp *) ccPtr->lpTemplateName;
+ Tcl_DoWhenIdle(SetTkDialog, (ClientData) hDlg);
+ }
+ return TRUE;
}
return FALSE;
}
@@ -470,25 +505,24 @@ ColorDlgHookProc(hDlg, uMsg, wParam, lParam)
*
* Tk_GetOpenFileCmd --
*
- * This procedure implements the "open file" dialog box for the
- * Windows platform. See the user documentation for details on what
- * it does.
+ * This function implements the "open file" dialog box for the Windows
+ * platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
- * A dialog window is created the first this procedure is called.
+ * A dialog window is created the first this function is called.
*
*----------------------------------------------------------------------
*/
int
-Tk_GetOpenFileObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_GetOpenFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
return GetFileNameW(clientData, interp, objc, objv, 1);
@@ -515,11 +549,11 @@ Tk_GetOpenFileObjCmd(clientData, interp, objc, objv)
*/
int
-Tk_GetSaveFileObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_GetSaveFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
return GetFileNameW(clientData, interp, objc, objv, 0);
@@ -544,60 +578,52 @@ Tk_GetSaveFileObjCmd(clientData, interp, objc, objv)
*----------------------------------------------------------------------
*/
-static int
-GetFileNameW(clientData, interp, objc, objv, open)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
- int open; /* 1 to call GetOpenFileName(), 0 to
- * call GetSaveFileName(). */
+static int
+GetFileNameW(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ int open) /* 1 to call GetOpenFileName(), 0 to call
+ * GetSaveFileName(). */
{
OPENFILENAMEW ofn;
WCHAR file[TK_MULTI_MAX_PATH];
- int result, winCode, oldMode, i, multi = 0;
- char *extension, *filter, *title;
- Tk_Window tkwin;
+ OFNData ofnData;
+ int cdlgerr;
+ int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0;
+ int inValue, confirmOverwrite = 1;
+ char *extension = NULL, *title = NULL;
+ Tk_Window tkwin = (Tk_Window) clientData;
HWND hWnd;
- Tcl_DString utfFilterString, utfDirString;
+ Tcl_Obj *filterObj = NULL, *initialTypeObj = NULL, *typeVariableObj = NULL;
+ Tcl_DString utfFilterString, utfDirString, ds;
Tcl_DString extString, filterString, dirString, titleString;
Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
static CONST char *saveOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-parent", "-title", NULL
+ "-parent", "-title", "-typevariable",
+ "-confirmoverwrite",
+ NULL
};
static CONST char *openOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-multiple", "-parent", "-title", NULL
+ "-parent", "-title", "-typevariable",
+ "-multiple",
+ NULL
};
- CONST char **optionStrings;
-
enum options {
- FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE,
- FILE_MULTIPLE, FILE_PARENT, FILE_TITLE
+ FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE,
+ FILE_PARENT, FILE_TITLE, FILE_TYPEVARIABLE,
+ FILE_MULTIPLE_OR_CONFIRMOW
};
- result = TCL_ERROR;
file[0] = '\0';
-
- /*
- * Parse the arguments.
- */
-
- extension = NULL;
- filter = NULL;
+ ZeroMemory(&ofnData, sizeof(OFNData));
Tcl_DStringInit(&utfFilterString);
Tcl_DStringInit(&utfDirString);
- tkwin = (Tk_Window) clientData;
- title = NULL;
-
- if (open) {
- optionStrings = openOptionStrings;
- } else {
- optionStrings = saveOptionStrings;
- }
for (i = 1; i < objc; i += 2) {
int index;
@@ -607,126 +633,114 @@ GetFileNameW(clientData, interp, objc, objv, open)
optionPtr = objv[i];
valuePtr = objv[i + 1];
- if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings,
+ if (Tcl_GetIndexFromObj(interp, optionPtr,
+ open ? openOptionStrings : saveOptionStrings,
"option", 0, &index) != TCL_OK) {
goto end;
}
- /*
- * We want to maximize code sharing between the open and save file
- * dialog implementations; in particular, the switch statement below.
- * We use different sets of option strings from the GetIndexFromObj
- * call above, but a single enumeration for both. The save file
- * dialog doesn't support -multiple, but it falls in the middle of
- * the enumeration. Ultimately, this means that when the index found
- * by GetIndexFromObj is >= FILE_MULTIPLE, when doing a save file
- * dialog, we have to increment the index, so that it matches the
- * open file dialog enumeration.
- */
- if (!open && index >= FILE_MULTIPLE) {
- index++;
- }
+
if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(optionPtr, NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
+ string = Tcl_GetString(optionPtr);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
goto end;
}
- string = Tcl_GetStringFromObj(valuePtr, NULL);
+ string = Tcl_GetString(valuePtr);
switch ((enum options) index) {
- case FILE_DEFAULT: {
- if (string[0] == '.') {
- string++;
- }
- extension = string;
- break;
- }
- case FILE_TYPES: {
- Tcl_DStringFree(&utfFilterString);
- if (MakeFilter(interp, string, &utfFilterString) != TCL_OK) {
- goto end;
- }
- filter = Tcl_DStringValue(&utfFilterString);
- break;
+ case FILE_DEFAULT:
+ if (string[0] == '.') {
+ string++;
}
- case FILE_INITDIR: {
- Tcl_DStringFree(&utfDirString);
- if (Tcl_TranslateFileName(interp, string,
- &utfDirString) == NULL) {
- goto end;
- }
- break;
+ extension = string;
+ break;
+ case FILE_TYPES:
+ filterObj = valuePtr;
+ break;
+ case FILE_INITDIR:
+ Tcl_DStringFree(&utfDirString);
+ if (Tcl_TranslateFileName(interp, string,
+ &utfDirString) == NULL) {
+ goto end;
}
- case FILE_INITFILE: {
- Tcl_DString ds;
-
- if (Tcl_TranslateFileName(interp, string, &ds) == NULL) {
- goto end;
- }
- Tcl_UtfToExternal(NULL, unicodeEncoding, Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds), 0, NULL, (char *) file,
- sizeof(file), NULL, NULL, NULL);
- break;
+ break;
+ case FILE_INITFILE:
+ if (Tcl_TranslateFileName(interp, string, &ds) == NULL) {
+ goto end;
}
- case FILE_MULTIPLE: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &multi) != TCL_OK) {
- return TCL_ERROR;
- }
- break;
+ Tcl_UtfToExternal(NULL, unicodeEncoding, Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds), 0, NULL, (char *) file,
+ sizeof(file), NULL, NULL, NULL);
+ Tcl_DStringFree(&ds);
+ break;
+ case FILE_PARENT:
+ tkwin = Tk_NameToWindow(interp, string, tkwin);
+ if (tkwin == NULL) {
+ goto end;
}
- case FILE_PARENT: {
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- goto end;
- }
- break;
+ break;
+ case FILE_TITLE:
+ title = string;
+ break;
+ case FILE_TYPEVARIABLE:
+ typeVariableObj = valuePtr;
+ initialTypeObj = Tcl_ObjGetVar2(interp, typeVariableObj, NULL,
+ TCL_GLOBAL_ONLY);
+ break;
+ case FILE_MULTIPLE_OR_CONFIRMOW:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &inValue) != TCL_OK) {
+ return TCL_ERROR;
}
- case FILE_TITLE: {
- title = string;
- break;
+ if (open) {
+ multi = inValue;
+ } else {
+ confirmOverwrite = inValue;
}
+ break;
}
}
- if (filter == NULL) {
- if (MakeFilter(interp, "", &utfFilterString) != TCL_OK) {
- goto end;
- }
+ if (MakeFilter(interp, filterObj, &utfFilterString, initialTypeObj,
+ &filterIndex) != TCL_OK) {
+ goto end;
}
Tk_MakeWindowExist(tkwin);
hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
ZeroMemory(&ofn, sizeof(OPENFILENAMEW));
- ofn.lStructSize = sizeof(OPENFILENAMEW);
- ofn.hwndOwner = hWnd;
-#ifdef _WIN64
- ofn.hInstance = (HINSTANCE) GetWindowLongPtr(ofn.hwndOwner,
- GWLP_HINSTANCE);
-#else
- ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner,
- GWL_HINSTANCE);
-#endif
- ofn.lpstrFile = (WCHAR *) file;
- ofn.nMaxFile = TK_MULTI_MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST
- | OFN_NOCHANGEDIR | OFN_EXPLORER;
- ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcW;
- ofn.lCustData = (LPARAM) interp;
+ if (LOBYTE(LOWORD(GetVersion())) < 5) {
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ } else {
+ ofn.lStructSize = sizeof(OPENFILENAMEW);
+ }
+ ofn.hwndOwner = hWnd;
+ ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner);
+ ofn.lpstrFile = (WCHAR *) file;
+ ofn.nMaxFile = TK_MULTI_MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR
+ | OFN_EXPLORER | OFN_ENABLEHOOK| OFN_ENABLESIZING;
+ ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcW;
+ ofn.lCustData = (LPARAM) &ofnData;
if (open != 0) {
ofn.Flags |= OFN_FILEMUSTEXIST;
- } else {
+ } else if (confirmOverwrite) {
ofn.Flags |= OFN_OVERWRITEPROMPT;
}
-
if (tsdPtr->debugFlag != 0) {
- ofn.Flags |= OFN_ENABLEHOOK;
+ ofnData.interp = interp;
}
-
if (multi != 0) {
ofn.Flags |= OFN_ALLOWMULTISELECT;
+
+ /*
+ * Starting buffer size. The buffer will be expanded by the OFN dialog
+ * procedure when necessary
+ */
+
+ ofnData.dynFileBufferSize = 1024;
+ ofnData.dynFileBuffer = ckalloc(1024);
}
if (extension != NULL) {
@@ -738,6 +752,7 @@ GetFileNameW(clientData, interp, objc, objv, open)
Tcl_DStringValue(&utfFilterString),
Tcl_DStringLength(&utfFilterString), &filterString);
ofn.lpstrFilter = (WCHAR *) Tcl_DStringValue(&filterString);
+ ofn.nFilterIndex = filterIndex;
if (Tcl_DStringValue(&utfDirString)[0] != '\0') {
Tcl_UtfToExternalDString(unicodeEncoding,
@@ -745,14 +760,14 @@ GetFileNameW(clientData, interp, objc, objv, open)
Tcl_DStringLength(&utfDirString), &dirString);
} else {
/*
- * NT 5.0 changed the meaning of lpstrInitialDir, so we have
- * to ensure that we set the [pwd] if the user didn't specify
- * anything else.
+ * NT 5.0 changed the meaning of lpstrInitialDir, so we have to ensure
+ * that we set the [pwd] if the user didn't specify anything else.
*/
+
Tcl_DString cwd;
Tcl_DStringFree(&utfDirString);
- if ((Tcl_GetCwd(interp, &utfDirString) == (char *) NULL) ||
+ if ((Tcl_GetCwd(interp, &utfDirString) == NULL) ||
(Tcl_TranslateFileName(interp,
Tcl_DStringValue(&utfDirString), &cwd) == NULL)) {
Tcl_ResetResult(interp);
@@ -783,10 +798,11 @@ GetFileNameW(clientData, interp, objc, objv, open)
EatSpuriousMessageBugFix();
/*
- * Ensure that hWnd is enabled, because it can happen that we
- * have updated the wrapper of the parent, which causes us to
- * leave this child disabled (Windows loses sync).
+ * Ensure that hWnd is enabled, because it can happen that we have updated
+ * the wrapper of the parent, which causes us to leave this child disabled
+ * (Windows loses sync).
*/
+
EnableWindow(hWnd, 1);
/*
@@ -798,42 +814,43 @@ GetFileNameW(clientData, interp, objc, objv, open)
/*
* Process the results.
+ *
+ * Use the CommDlgExtendedError() function to retrieve the error code.
+ * This function can return one of about two dozen codes; most of these
+ * indicate some sort of gross system failure (insufficient memory, bad
+ * window handles, etc.). Most of the error codes will be ignored; as we
+ * find we want more specific error messages for particular errors, we can
+ * extend the code as needed.
+ */
+
+ cdlgerr = CommDlgExtendedError();
+
+ /*
+ * We now allow FNERR_BUFFERTOOSMALL when multiselection is enabled. The
+ * filename buffer has been dynamically allocated by the OFN dialog
+ * procedure to accomodate all selected files.
*/
- if (winCode != 0) {
+ if ((winCode != 0)
+ || ((cdlgerr == FNERR_BUFFERTOOSMALL)
+ && (ofn.Flags & OFN_ALLOWMULTISELECT))) {
if (ofn.Flags & OFN_ALLOWMULTISELECT) {
- /*
- * The result in custData->szFile contains many items,
- * separated with null characters. It is terminated with
- * two nulls in a row. The first element is the directory
- * path.
+ /*
+ * The result in dynFileBuffer contains many items, separated by
+ * NUL characters. It is terminated with two nulls in a row. The
+ * first element is the directory path.
*/
- char *dir;
- char *p;
- char *file;
- WCHAR *files;
- Tcl_DString ds;
- Tcl_DString fullname, filename;
- Tcl_Obj *returnList;
- int count = 0;
- returnList = Tcl_NewObj();
- Tcl_IncrRefCount(returnList);
+ WCHAR *files = (WCHAR *) ofnData.dynFileBuffer;
+ Tcl_Obj *returnList = Tcl_NewObj();
+ int count = 0;
- files = ofn.lpstrFile;
- Tcl_ExternalToUtfDString(unicodeEncoding, (char *) files, -1, &ds);
+ /*
+ * Get directory.
+ */
- /* Get directory */
- dir = Tcl_DStringValue(&ds);
- for (p = dir; p && *p; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname, where
- * back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
- }
+ (void) ConvertExternalFilename(unicodeEncoding, (char *) files,
+ &ds);
while (*files != '\0') {
while (*files != '\0') {
@@ -841,90 +858,68 @@ GetFileNameW(clientData, interp, objc, objv, open)
}
files++;
if (*files != '\0') {
+ Tcl_Obj *fullnameObj;
+ Tcl_DString filenameBuf;
+
count++;
- Tcl_ExternalToUtfDString(unicodeEncoding,
- (char *)files, -1, &filename);
- file = Tcl_DStringValue(&filename);
- for (p = file; *p != '\0'; p++) {
- if (*p == '\\') {
- *p = '/';
- }
- }
- Tcl_DStringInit(&fullname);
- Tcl_DStringAppend(&fullname, dir, -1);
- Tcl_DStringAppend(&fullname, "/", -1);
- Tcl_DStringAppend(&fullname, file, -1);
- Tcl_ListObjAppendElement(interp, returnList,
- Tcl_NewStringObj(Tcl_DStringValue(&fullname), -1));
- Tcl_DStringFree(&fullname);
- Tcl_DStringFree(&filename);
+ (void) ConvertExternalFilename(unicodeEncoding,
+ (char *) files, &filenameBuf);
+
+ fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds));
+ Tcl_AppendToObj(fullnameObj, "/", -1);
+ Tcl_AppendToObj(fullnameObj, Tcl_DStringValue(&filenameBuf),
+ Tcl_DStringLength(&filenameBuf));
+ Tcl_DStringFree(&filenameBuf);
+ Tcl_ListObjAppendElement(NULL, returnList, fullnameObj);
}
}
+
if (count == 0) {
/*
* Only one file was returned.
*/
- Tcl_ListObjAppendElement(interp, returnList,
- Tcl_NewStringObj(dir, -1));
+
+ Tcl_ListObjAppendElement(NULL, returnList,
+ Tcl_NewStringObj(Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds)));
}
Tcl_SetObjResult(interp, returnList);
- Tcl_DecrRefCount(returnList);
Tcl_DStringFree(&ds);
} else {
- char *p;
- Tcl_DString ds;
-
- Tcl_ExternalToUtfDString(unicodeEncoding,
- (char *) ofn.lpstrFile, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname, where
- * back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
- }
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
+ Tcl_AppendResult(interp, ConvertExternalFilename(unicodeEncoding,
+ (char *) ofn.lpstrFile, &ds), NULL);
Tcl_DStringFree(&ds);
}
result = TCL_OK;
- } else {
- /*
- * Use the CommDlgExtendedError() function to retrieve the error code.
- * This function can return one of about two dozen codes; most of
- * these indicate some sort of gross system failure (insufficient
- * memory, bad window handles, etc.). Most of the error codes will be
- * ignored; as we find we want more specific error messages for
- * particular errors, we can extend the code as needed.
- *
- * We could also check for FNERR_BUFFERTOOSMALL, but we can't
- * really do anything about it when it happens.
- */
-
- if (CommDlgExtendedError() == FNERR_INVALIDFILENAME) {
- char *p;
- Tcl_DString ds;
-
- Tcl_ExternalToUtfDString(unicodeEncoding,
- (char *) ofn.lpstrFile, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname,
- * where back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
+ if ((ofn.nFilterIndex > 0) &&
+ Tcl_GetCharLength(Tcl_GetObjResult(interp)) > 0 &&
+ typeVariableObj && filterObj) {
+ int listObjc, count;
+ Tcl_Obj **listObjv = NULL;
+ Tcl_Obj **typeInfo = NULL;
+
+ if (Tcl_ListObjGetElements(interp, filterObj,
+ &listObjc, &listObjv) != TCL_OK) {
+ result = TCL_ERROR;
+ } else if (Tcl_ListObjGetElements(interp,
+ listObjv[ofn.nFilterIndex - 1], &count,
+ &typeInfo) != TCL_OK) {
+ result = TCL_ERROR;
+ } else if (Tcl_ObjSetVar2(interp, typeVariableObj, NULL,
+ typeInfo[0], TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
+ result = TCL_ERROR;
}
- Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), "\"", NULL);
- Tcl_DStringFree(&ds);
- } else {
- result = TCL_OK;
}
+ } else if (cdlgerr == FNERR_INVALIDFILENAME) {
+ Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
+ Tcl_AppendResult(interp, ConvertExternalFilename(unicodeEncoding,
+ (char *) ofn.lpstrFile, &ds), "\"", NULL);
+ Tcl_DStringFree(&ds);
+ } else {
+ result = TCL_OK;
}
-
+
if (ofn.lpstrTitle != NULL) {
Tcl_DStringFree(&titleString);
}
@@ -936,9 +931,13 @@ GetFileNameW(clientData, interp, objc, objv, open)
Tcl_DStringFree(&extString);
}
- end:
+ end:
Tcl_DStringFree(&utfDirString);
Tcl_DStringFree(&utfFilterString);
+ if (ofnData.dynFileBuffer != NULL) {
+ ckfree(ofnData.dynFileBuffer);
+ ofnData.dynFileBuffer = NULL;
+ }
return result;
}
@@ -948,9 +947,10 @@ GetFileNameW(clientData, interp, objc, objv, open)
*
* OFNHookProcW --
*
- * Hook procedure called only if debugging is turned on. Sets
- * the "tk_dialog" variable when the dialog is ready to receive
- * messages.
+ * Dialog box hook function. This is used to sets the "tk_dialog"
+ * variable for test/debugging when the dialog is ready to receive
+ * messages. When multiple file selection is enabled this function
+ * is used to process the list of names.
*
* Results:
* Returns 0 to allow default processing of messages to occur.
@@ -961,45 +961,127 @@ GetFileNameW(clientData, interp, objc, objv, open)
*-------------------------------------------------------------------------
*/
-static UINT APIENTRY
+static UINT APIENTRY
OFNHookProcW(
- HWND hdlg, // handle to child dialog window
- UINT uMsg, // message identifier
- WPARAM wParam, // message parameter
- LPARAM lParam) // message parameter
+ HWND hdlg, /* Handle to child dialog window. */
+ UINT uMsg, /* Message identifier */
+ WPARAM wParam, /* Message parameter */
+ LPARAM lParam) /* Message parameter */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
OPENFILENAMEW *ofnPtr;
+ OFNData *ofnData;
if (uMsg == WM_INITDIALOG) {
-#ifdef _WIN64
- SetWindowLongPtr(hdlg, GWLP_USERDATA, lParam);
-#else
- SetWindowLong(hdlg, GWL_USERDATA, lParam);
-#endif
+ TkWinSetUserData(hdlg, lParam);
+ } else if (uMsg == WM_NOTIFY) {
+ OFNOTIFYW *notifyPtr = (OFNOTIFYW *) lParam;
+
+ /*
+ * This is weird... or not. The CDN_FILEOK is NOT sent when the selection
+ * exceeds declared buffer size (the nMaxFile member of the OPENFILENAMEW
+ * struct passed to GetOpenFileNameW function). So, we have to rely on
+ * the most recent CDN_SELCHANGE then. Unfortunately this means, that
+ * gathering the selected filenames happens twice when they fit into the
+ * declared buffer. Luckily, it's not frequent operation so it should
+ * not incur any noticeable delay. See [tktoolkit-Bugs-2987995]
+ */
+ if (notifyPtr->hdr.code == CDN_FILEOK ||
+ notifyPtr->hdr.code == CDN_SELCHANGE) {
+ int dirsize, selsize;
+ WCHAR *buffer;
+ int buffersize;
+
+ /*
+ * Change of selection. Unscramble the unholy mess that's in the
+ * selection buffer, resizing it if necessary.
+ */
+
+ ofnPtr = notifyPtr->lpOFN;
+ ofnData = (OFNData *) ofnPtr->lCustData;
+ buffer = (WCHAR *) ofnData->dynFileBuffer;
+ hdlg = GetParent(hdlg);
+
+ selsize = SendMessageW(hdlg, CDM_GETSPEC, 0, 0);
+ dirsize = SendMessageW(hdlg, CDM_GETFOLDERPATH, 0, 0);
+ buffersize = (selsize + dirsize + 1) * 2;
+
+ /*
+ * Just empty the buffer if dirsize indicates an error [Bug 3071836]
+ */
+ if ((selsize > 1) && (dirsize > 0)) {
+ if (ofnData->dynFileBufferSize < buffersize) {
+ buffer = (WCHAR *) ckrealloc((char *) buffer, buffersize);
+ ofnData->dynFileBufferSize = buffersize;
+ ofnData->dynFileBuffer = (char *) buffer;
+ }
+
+ SendMessageW(hdlg, CDM_GETFOLDERPATH, dirsize, PTR2INT(buffer));
+ buffer += dirsize;
+
+ SendMessageW(hdlg, CDM_GETSPEC, selsize, PTR2INT(buffer));
+
+ /*
+ * If there are multiple files, delete the quotes and change
+ * every second quote to NULL terminator
+ */
+
+ if (buffer[0] == '"') {
+ BOOL findquote = TRUE;
+ WCHAR *tmp = buffer;
+
+ while(*buffer != '\0') {
+ if (findquote) {
+ if (*buffer == '"') {
+ findquote = FALSE;
+ }
+ buffer++;
+ } else {
+ if (*buffer == '"') {
+ findquote = TRUE;
+ *buffer = '\0';
+ }
+ *tmp++ = *buffer++;
+ }
+ }
+ *tmp = '\0'; /* Second NULL terminator. */
+ } else {
+ buffer[selsize] = '\0'; /* Second NULL terminator. */
+
+ /*
+ * Replace directory terminating NULL with a backslash.
+ */
+
+ buffer--;
+ *buffer = '\\';
+ }
+ } else {
+ /*
+ * Nothing is selected, so just empty the string.
+ */
+
+ if (buffer != NULL) {
+ *buffer = '\0';
+ }
+ }
+ }
} else if (uMsg == WM_WINDOWPOSCHANGED) {
/*
- * This message is delivered at the right time to enable Tk
- * to set the debug information. Unhooks itself so it
- * won't set the debug information every time it gets a
- * WM_WINDOWPOSCHANGED message.
+ * This message is delivered at the right time to enable Tk to set the
+ * debug information. Unhooks itself so it won't set the debug
+ * information every time it gets a WM_WINDOWPOSCHANGED message.
*/
-#ifdef _WIN64
- ofnPtr = (OPENFILENAMEW *) GetWindowLongPtr(hdlg, GWLP_USERDATA);
-#else
- ofnPtr = (OPENFILENAMEW *) GetWindowLong(hdlg, GWL_USERDATA);
-#endif
+ ofnPtr = (OPENFILENAMEW *) TkWinGetUserData(hdlg);
if (ofnPtr != NULL) {
- hdlg = GetParent(hdlg);
- tsdPtr->debugInterp = (Tcl_Interp *) ofnPtr->lCustData;
- Tcl_DoWhenIdle(SetTkDialog, (ClientData) hdlg);
-#ifdef _WIN64
- SetWindowLongPtr(hdlg, GWLP_USERDATA, (LPARAM) NULL);
-#else
- SetWindowLong(hdlg, GWL_USERDATA, (LPARAM) NULL);
-#endif
+ ofnData = (OFNData *) ofnPtr->lCustData;
+ if (ofnData->interp != NULL) {
+ hdlg = GetParent(hdlg);
+ tsdPtr->debugInterp = ofnData->interp;
+ Tcl_DoWhenIdle(SetTkDialog, hdlg);
+ }
+ TkWinSetUserData(hdlg, NULL);
}
}
return 0;
@@ -1021,54 +1103,52 @@ OFNHookProcW(
*----------------------------------------------------------------------
*/
-static int
-GetFileNameA(clientData, interp, objc, objv, open)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
- int open; /* 1 to call GetOpenFileName(), 0 to
- * call GetSaveFileName(). */
+static int
+GetFileNameA(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ int open) /* 1 to call GetOpenFileName(), 0 to call
+ * GetSaveFileName(). */
{
OPENFILENAME ofn;
TCHAR file[TK_MULTI_MAX_PATH], savePath[MAX_PATH];
- int result, winCode, oldMode, i, multi = 0;
- char *extension, *filter, *title;
- Tk_Window tkwin;
+ OFNData ofnData;
+ int cdlgerr;
+ int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0;
+ char *extension = NULL, *title = NULL;
+ Tk_Window tkwin = (Tk_Window) clientData;
HWND hWnd;
- Tcl_DString utfFilterString, utfDirString;
+ Tcl_Obj *filterObj = NULL, *initialTypeObj = NULL, *typeVariableObj = NULL;
+ Tcl_DString utfFilterString, utfDirString, ds;
Tcl_DString extString, filterString, dirString, titleString;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
static CONST char *saveOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-parent", "-title", NULL
+ "-parent", "-title", "-typevariable", NULL
};
static CONST char *openOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-multiple", "-parent", "-title", NULL
+ "-multiple", "-parent", "-title", "-typevariable", NULL
};
CONST char **optionStrings;
enum options {
FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE,
- FILE_MULTIPLE, FILE_PARENT, FILE_TITLE
+ FILE_MULTIPLE, FILE_PARENT, FILE_TITLE, FILE_TYPEVARIABLE
};
- result = TCL_ERROR;
file[0] = '\0';
+ ZeroMemory(&ofnData, sizeof(OFNData));
+ Tcl_DStringInit(&utfFilterString);
+ Tcl_DStringInit(&utfDirString);
/*
* Parse the arguments.
*/
- extension = NULL;
- filter = NULL;
- Tcl_DStringInit(&utfFilterString);
- Tcl_DStringInit(&utfDirString);
- tkwin = (Tk_Window) clientData;
- title = NULL;
-
if (open) {
optionStrings = openOptionStrings;
} else {
@@ -1083,124 +1163,114 @@ GetFileNameA(clientData, interp, objc, objv, open)
optionPtr = objv[i];
valuePtr = objv[i + 1];
- if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings,
- "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings, "option", 0,
+ &index) != TCL_OK) {
goto end;
}
+
/*
* We want to maximize code sharing between the open and save file
* dialog implementations; in particular, the switch statement below.
* We use different sets of option strings from the GetIndexFromObj
- * call above, but a single enumeration for both. The save file
- * dialog doesn't support -multiple, but it falls in the middle of
- * the enumeration. Ultimately, this means that when the index found
- * by GetIndexFromObj is >= FILE_MULTIPLE, when doing a save file
- * dialog, we have to increment the index, so that it matches the
- * open file dialog enumeration.
+ * call above, but a single enumeration for both. The save file dialog
+ * doesn't support -multiple, but it falls in the middle of the
+ * enumeration. Ultimately, this means that when the index found by
+ * GetIndexFromObj is >= FILE_MULTIPLE, when doing a save file dialog,
+ * we have to increment the index, so that it matches the open file
+ * dialog enumeration.
*/
+
if (!open && index >= FILE_MULTIPLE) {
index++;
}
if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(optionPtr, NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
+ string = Tcl_GetString(optionPtr);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
goto end;
}
- string = Tcl_GetStringFromObj(valuePtr, NULL);
+ string = Tcl_GetString(valuePtr);
switch ((enum options) index) {
- case FILE_DEFAULT: {
- if (string[0] == '.') {
- string++;
- }
- extension = string;
- break;
- }
- case FILE_TYPES: {
- Tcl_DStringFree(&utfFilterString);
- if (MakeFilter(interp, string, &utfFilterString) != TCL_OK) {
- goto end;
- }
- filter = Tcl_DStringValue(&utfFilterString);
- break;
- }
- case FILE_INITDIR: {
- Tcl_DStringFree(&utfDirString);
- if (Tcl_TranslateFileName(interp, string,
- &utfDirString) == NULL) {
- goto end;
- }
- break;
+ case FILE_DEFAULT:
+ if (string[0] == '.') {
+ string++;
}
- case FILE_INITFILE: {
- Tcl_DString ds;
-
- if (Tcl_TranslateFileName(interp, string, &ds) == NULL) {
- goto end;
- }
- Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds), 0, NULL, (char *) file,
- sizeof(file), NULL, NULL, NULL);
- break;
+ extension = string;
+ break;
+ case FILE_TYPES:
+ filterObj = valuePtr;
+ break;
+ case FILE_INITDIR:
+ Tcl_DStringFree(&utfDirString);
+ if (Tcl_TranslateFileName(interp, string, &utfDirString) == NULL) {
+ goto end;
}
- case FILE_MULTIPLE: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &multi) != TCL_OK) {
- return TCL_ERROR;
- }
- break;
+ break;
+ case FILE_INITFILE:
+ if (Tcl_TranslateFileName(interp, string, &ds) == NULL) {
+ goto end;
}
- case FILE_PARENT: {
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- goto end;
- }
- break;
+ Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds), 0, NULL, (char *) file,
+ sizeof(file), NULL, NULL, NULL);
+ Tcl_DStringFree(&ds);
+ break;
+ case FILE_MULTIPLE:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr, &multi) != TCL_OK) {
+ return TCL_ERROR;
}
- case FILE_TITLE: {
- title = string;
- break;
+ break;
+ case FILE_PARENT:
+ tkwin = Tk_NameToWindow(interp, string, tkwin);
+ if (tkwin == NULL) {
+ goto end;
}
+ break;
+ case FILE_TITLE:
+ title = string;
+ break;
+ case FILE_TYPEVARIABLE:
+ typeVariableObj = valuePtr;
+ initialTypeObj = Tcl_ObjGetVar2(interp, typeVariableObj, NULL,
+ TCL_GLOBAL_ONLY);
+ break;
}
}
- if (filter == NULL) {
- if (MakeFilter(interp, "", &utfFilterString) != TCL_OK) {
- goto end;
- }
+ if (MakeFilter(interp, filterObj, &utfFilterString, initialTypeObj,
+ &filterIndex) != TCL_OK) {
+ goto end;
}
Tk_MakeWindowExist(tkwin);
hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
- ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = hWnd;
-#ifdef _WIN64
- ofn.hInstance = (HINSTANCE) GetWindowLongPtr(ofn.hwndOwner,
- GWLP_HINSTANCE);
-#else
- ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner,
- GWL_HINSTANCE);
-#endif
- ofn.lpstrFilter = NULL;
- ofn.lpstrCustomFilter = NULL;
- ofn.nMaxCustFilter = 0;
- ofn.nFilterIndex = 0;
- ofn.lpstrFile = (LPTSTR) file;
- ofn.nMaxFile = TK_MULTI_MAX_PATH;
- ofn.lpstrFileTitle = NULL;
- ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
- ofn.lpstrTitle = NULL;
- ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST
- | OFN_NOCHANGEDIR | OFN_EXPLORER;
- ofn.nFileOffset = 0;
- ofn.nFileExtension = 0;
- ofn.lpstrDefExt = NULL;
- ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProc;
- ofn.lCustData = (LPARAM) interp;
- ofn.lpTemplateName = NULL;
+ ZeroMemory(&ofn, sizeof(OPENFILENAMEA));
+ if (LOBYTE(LOWORD(GetVersion())) < 5) {
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ } else {
+ ofn.lStructSize = sizeof(ofn);
+ }
+ ofn.hwndOwner = hWnd;
+ ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner);
+ ofn.lpstrFilter = NULL;
+ ofn.lpstrCustomFilter = NULL;
+ ofn.nMaxCustFilter = 0;
+ ofn.lpstrFile = (LPTSTR) file;
+ ofn.nMaxFile = TK_MULTI_MAX_PATH;
+ ofn.lpstrFileTitle = NULL;
+ ofn.nMaxFileTitle = 0;
+ ofn.lpstrInitialDir = NULL;
+ ofn.lpstrTitle = NULL;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR
+ | OFN_EXPLORER | OFN_ENABLEHOOK;
+ ofn.nFileOffset = 0;
+ ofn.nFileExtension = 0;
+ ofn.lpstrDefExt = NULL;
+ ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcA;
+ ofn.lCustData = (LPARAM) &ofnData;
+ ofn.lpTemplateName = NULL;
if (open != 0) {
ofn.Flags |= OFN_FILEMUSTEXIST;
@@ -1209,11 +1279,19 @@ GetFileNameA(clientData, interp, objc, objv, open)
}
if (tsdPtr->debugFlag != 0) {
- ofn.Flags |= OFN_ENABLEHOOK;
+ ofnData.interp = interp;
}
if (multi != 0) {
ofn.Flags |= OFN_ALLOWMULTISELECT;
+
+ /*
+ * Starting buffer size. The buffer will be expanded by the OFN dialog
+ * procedure when necessary
+ */
+
+ ofnData.dynFileBufferSize = 1024;
+ ofnData.dynFileBuffer = ckalloc(1024);
}
if (extension != NULL) {
@@ -1223,20 +1301,21 @@ GetFileNameA(clientData, interp, objc, objv, open)
Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&utfFilterString),
Tcl_DStringLength(&utfFilterString), &filterString);
ofn.lpstrFilter = (LPTSTR) Tcl_DStringValue(&filterString);
+ ofn.nFilterIndex = filterIndex;
if (Tcl_DStringValue(&utfDirString)[0] != '\0') {
Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&utfDirString),
Tcl_DStringLength(&utfDirString), &dirString);
} else {
/*
- * NT 5.0 changed the meaning of lpstrInitialDir, so we have
- * to ensure that we set the [pwd] if the user didn't specify
- * anything else.
+ * NT 5.0 changed the meaning of lpstrInitialDir, so we have to ensure
+ * that we set the [pwd] if the user didn't specify anything else.
*/
+
Tcl_DString cwd;
Tcl_DStringFree(&utfDirString);
- if ((Tcl_GetCwd(interp, &utfDirString) == (char *) NULL) ||
+ if ((Tcl_GetCwd(interp, &utfDirString) == NULL) ||
(Tcl_TranslateFileName(interp,
Tcl_DStringValue(&utfDirString), &cwd) == NULL)) {
Tcl_ResetResult(interp);
@@ -1269,10 +1348,11 @@ GetFileNameA(clientData, interp, objc, objv, open)
SetCurrentDirectory(savePath);
/*
- * Ensure that hWnd is enabled, because it can happen that we
- * have updated the wrapper of the parent, which causes us to
- * leave this child disabled (Windows loses sync).
+ * Ensure that hWnd is enabled, because it can happen that we have updated
+ * the wrapper of the parent, which causes us to leave this child disabled
+ * (Windows loses sync).
*/
+
EnableWindow(hWnd, 1);
/*
@@ -1284,42 +1364,44 @@ GetFileNameA(clientData, interp, objc, objv, open)
/*
* Process the results.
+ *
+ * Use the CommDlgExtendedError() function to retrieve the error code.
+ * This function can return one of about two dozen codes; most of these
+ * indicate some sort of gross system failure (insufficient memory, bad
+ * window handles, etc.) Most of the error codes will be ignored; as we
+ * find we want specific error messages for particular errors, we can
+ * extend the code as needed.
*/
- if (winCode != 0) {
+ cdlgerr = CommDlgExtendedError();
+
+ /*
+ * We now allow FNERR_BUFFERTOOSMALL when multiselection is enabled. The
+ * filename buffer has been dynamically allocated by the OFN dialog
+ * procedure to accomodate all selected files.
+ */
+
+ if ((winCode != 0)
+ || ((cdlgerr == FNERR_BUFFERTOOSMALL)
+ && (ofn.Flags & OFN_ALLOWMULTISELECT))) {
if (ofn.Flags & OFN_ALLOWMULTISELECT) {
- /*
- * The result in custData->szFile contains many items,
- * separated with null characters. It is terminated with
- * two nulls in a row. The first element is the directory
- * path.
+ /*
+ * The result in dynFileBuffer contains many items, separated by
+ * NUL characters. It is terminated with two nulls in a row. The
+ * first element is the directory path (if multiple files are
+ * selected) or the only returned file (if only a single file has
+ * been chosen).
*/
- char *dir;
- char *p;
- char *file;
- char *files;
- Tcl_DString ds;
- Tcl_DString fullname, filename;
- Tcl_Obj *returnList;
+
+ char *files = ofnData.dynFileBuffer;
+ Tcl_Obj *returnList = Tcl_NewObj();
int count = 0;
- returnList = Tcl_NewObj();
- Tcl_IncrRefCount(returnList);
+ /*
+ * Get directory.
+ */
- files = ofn.lpstrFile;
- Tcl_ExternalToUtfDString(NULL, (char *) files, -1, &ds);
-
- /* Get directory */
- dir = Tcl_DStringValue(&ds);
- for (p = dir; p && *p; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname, where
- * back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
- }
+ (void) ConvertExternalFilename(NULL, (char *) files, &ds);
while (*files != '\0') {
while (*files != '\0') {
@@ -1327,85 +1409,63 @@ GetFileNameA(clientData, interp, objc, objv, open)
}
files++;
if (*files != '\0') {
+ Tcl_Obj *fullnameObj;
+ Tcl_DString filename;
+
count++;
- Tcl_ExternalToUtfDString(NULL,
- (char *)files, -1, &filename);
- file = Tcl_DStringValue(&filename);
- for (p = file; *p != '\0'; p++) {
- if (*p == '\\') {
- *p = '/';
- }
- }
- Tcl_DStringInit(&fullname);
- Tcl_DStringAppend(&fullname, dir, -1);
- Tcl_DStringAppend(&fullname, "/", -1);
- Tcl_DStringAppend(&fullname, file, -1);
- Tcl_ListObjAppendElement(interp, returnList,
- Tcl_NewStringObj(Tcl_DStringValue(&fullname), -1));
- Tcl_DStringFree(&fullname);
+ (void) ConvertExternalFilename(NULL, (char *) files,
+ &filename);
+ fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds));
+ Tcl_AppendToObj(fullnameObj, "/", -1);
+ Tcl_AppendToObj(fullnameObj, Tcl_DStringValue(&filename),
+ Tcl_DStringLength(&filename));
Tcl_DStringFree(&filename);
+ Tcl_ListObjAppendElement(NULL, returnList, fullnameObj);
}
}
if (count == 0) {
/*
* Only one file was returned.
*/
- Tcl_ListObjAppendElement(interp, returnList,
- Tcl_NewStringObj(dir, -1));
+
+ Tcl_ListObjAppendElement(NULL, returnList, Tcl_NewStringObj(
+ Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)));
}
Tcl_SetObjResult(interp, returnList);
- Tcl_DecrRefCount(returnList);
Tcl_DStringFree(&ds);
} else {
- char *p;
- Tcl_DString ds;
-
- Tcl_ExternalToUtfDString(NULL, (char *) ofn.lpstrFile, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname, where
- * back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
- }
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
+ Tcl_AppendResult(interp, ConvertExternalFilename(NULL,
+ (char *) ofn.lpstrFile, &ds), NULL);
Tcl_DStringFree(&ds);
}
result = TCL_OK;
- } else {
- /*
- * Use the CommDlgExtendedError() function to retrieve the error code.
- * This function can return one of about two dozen codes; most of
- * these indicate some sort of gross system failure (insufficient
- * memory, bad window handles, etc.). Most of the error codes will be
- * ignored;; as we find we want specific error messages for particular
- * errors, we can extend the code as needed.
- *
- * We could also check for FNERR_BUFFERTOOSMALL, but we can't
- * really do anything about it when it happens.
- */
- if (CommDlgExtendedError() == FNERR_INVALIDFILENAME) {
- char *p;
- Tcl_DString ds;
-
- Tcl_ExternalToUtfDString(NULL, (char *) ofn.lpstrFile, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname,
- * where back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
+ if ((ofn.nFilterIndex > 0) &&
+ (Tcl_GetCharLength(Tcl_GetObjResult(interp)) > 0) &&
+ typeVariableObj && filterObj) {
+ int listObjc, count;
+ Tcl_Obj **listObjv = NULL;
+ Tcl_Obj **typeInfo = NULL;
+
+ if (Tcl_ListObjGetElements(interp, filterObj, &listObjc,
+ &listObjv) != TCL_OK) {
+ result = TCL_ERROR;
+ } else if (Tcl_ListObjGetElements(interp,
+ listObjv[ofn.nFilterIndex - 1], &count,
+ &typeInfo) != TCL_OK) {
+ result = TCL_ERROR;
+ } else if (Tcl_ObjSetVar2(interp, typeVariableObj, NULL,
+ typeInfo[0], TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
+ result = TCL_ERROR;
}
- Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), "\"", NULL);
- Tcl_DStringFree(&ds);
- } else {
- result = TCL_OK;
}
+ } else if (cdlgerr == FNERR_INVALIDFILENAME) {
+ Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
+ Tcl_AppendResult(interp, ConvertExternalFilename(NULL,
+ (char *) ofn.lpstrFile, &ds), "\"", NULL);
+ Tcl_DStringFree(&ds);
+ } else {
+ result = TCL_OK;
}
if (ofn.lpstrTitle != NULL) {
@@ -1419,9 +1479,13 @@ GetFileNameA(clientData, interp, objc, objv, open)
Tcl_DStringFree(&extString);
}
- end:
+ end:
Tcl_DStringFree(&utfDirString);
Tcl_DStringFree(&utfFilterString);
+ if (ofnData.dynFileBuffer != NULL) {
+ ckfree(ofnData.dynFileBuffer);
+ ofnData.dynFileBuffer = NULL;
+ }
return result;
}
@@ -1429,11 +1493,12 @@ GetFileNameA(clientData, interp, objc, objv, open)
/*
*-------------------------------------------------------------------------
*
- * OFNHookProc --
+ * OFNHookProcA --
*
- * Hook procedure called only if debugging is turned on. Sets
- * the "tk_dialog" variable when the dialog is ready to receive
- * messages.
+ * Dialog box hook function. This is used to sets the "tk_dialog"
+ * variable for test/debugging when the dialog is ready to receive
+ * messages. When multiple file selection is enabled this function
+ * is used to process the list of names.
*
* Results:
* Returns 0 to allow default processing of messages to occur.
@@ -1444,48 +1509,130 @@ GetFileNameA(clientData, interp, objc, objv, open)
*-------------------------------------------------------------------------
*/
-static UINT APIENTRY
-OFNHookProc(
- HWND hdlg, // handle to child dialog window
- UINT uMsg, // message identifier
- WPARAM wParam, // message parameter
- LPARAM lParam) // message parameter
+static UINT APIENTRY
+OFNHookProcA(
+ HWND hdlg, /* handle to child dialog window */
+ UINT uMsg, /* message identifier */
+ WPARAM wParam, /* message parameter */
+ LPARAM lParam) /* message parameter */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
OPENFILENAME *ofnPtr;
+ OFNData *ofnData;
if (uMsg == WM_INITDIALOG) {
-#ifdef _WIN64
- SetWindowLongPtr(hdlg, GWLP_USERDATA, lParam);
-#else
- SetWindowLong(hdlg, GWL_USERDATA, lParam);
-#endif
+ TkWinSetUserData(hdlg, lParam);
+ } else if (uMsg == WM_NOTIFY) {
+ OFNOTIFY *notifyPtr = (OFNOTIFY *) lParam;
+
+ /*
+ * This is weird... or not. The CDN_FILEOK is NOT sent when the selection
+ * exceeds declared buffer size (the nMaxFile member of the OPENFILENAMEW
+ * struct passed to GetOpenFileNameW function). So, we have to rely on
+ * the most recent CDN_SELCHANGE then. Unfortunately this means, that
+ * gathering the selected filenames happens twice when they fit into the
+ * declared buffer. Luckily, it's not frequent operation so it should
+ * not incur any noticeable delay. See [tktoolkit-Bugs-2987995]
+ */
+ if (notifyPtr->hdr.code == CDN_FILEOK ||
+ notifyPtr->hdr.code == CDN_SELCHANGE) {
+ int dirsize, selsize;
+ char *buffer;
+ int buffersize;
+
+ /*
+ * Change of selection. Unscramble the unholy mess that's in the
+ * selection buffer, resizing it if necessary.
+ */
+
+ ofnPtr = notifyPtr->lpOFN;
+ ofnData = (OFNData *) ofnPtr->lCustData;
+ buffer = ofnData->dynFileBuffer;
+ hdlg = GetParent(hdlg);
+
+ selsize = SendMessage(hdlg, CDM_GETSPEC, 0, 0);
+ dirsize = SendMessage(hdlg, CDM_GETFOLDERPATH, 0, 0);
+ buffersize = selsize + dirsize + 1;
+
+ /*
+ * Just empty the buffer if dirsize indicates an error [Bug 3071836]
+ */
+ if ((selsize > 1) && (dirsize > 0)) {
+ if (ofnData->dynFileBufferSize < buffersize) {
+ buffer = ckrealloc(buffer, buffersize);
+ ofnData->dynFileBufferSize = buffersize;
+ ofnData->dynFileBuffer = buffer;
+ }
+
+ SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, PTR2INT(buffer));
+ buffer += dirsize;
+ SendMessage(hdlg, CDM_GETSPEC, selsize, PTR2INT(buffer));
+
+ /*
+ * If there are multiple files, delete the quotes and change
+ * every second quote to NULL terminator.
+ */
+
+ if (buffer[0] == '"') {
+ BOOL findquote = TRUE;
+ char *tmp = buffer;
+
+ while (*buffer != '\0') {
+ if (findquote) {
+ if (*buffer == '"') {
+ findquote = FALSE;
+ }
+ buffer++;
+ } else {
+ if (*buffer == '"') {
+ findquote = TRUE;
+ *buffer = '\0';
+ }
+ *tmp++ = *buffer++;
+ }
+ }
+ *tmp = '\0'; /* Second NULL terminator. */
+ } else {
+ buffer[selsize] = '\0'; /* Second NULL terminator. */
+
+ /*
+ * Replace directory terminating NULL with a backslash.
+ */
+
+ buffer--;
+ *buffer = '\\';
+ }
+
+ } else {
+ /*
+ * Nothing is selected, so just empty the string.
+ */
+
+ if (buffer != NULL) {
+ *buffer = '\0';
+ }
+ }
+ }
} else if (uMsg == WM_WINDOWPOSCHANGED) {
/*
- * This message is delivered at the right time to both
- * old-style and explorer-style hook procs to enable Tk
- * to set the debug information. Unhooks itself so it
- * won't set the debug information every time it gets a
- * WM_WINDOWPOSCHANGED message.
+ * This message is delivered at the right time to both old-style and
+ * explorer-style hook procs to enable Tk to set the debug
+ * information. Unhooks itself so it won't set the debug information
+ * every time it gets a WM_WINDOWPOSCHANGED message.
*/
-#ifdef _WIN64
- ofnPtr = (OPENFILENAME *) GetWindowLongPtr(hdlg, GWLP_USERDATA);
-#else
- ofnPtr = (OPENFILENAME *) GetWindowLong(hdlg, GWL_USERDATA);
-#endif
+ ofnPtr = (OPENFILENAME *) TkWinGetUserData(hdlg);
if (ofnPtr != NULL) {
- if (ofnPtr->Flags & OFN_EXPLORER) {
- hdlg = GetParent(hdlg);
+ ofnData = (OFNData *) ofnPtr->lCustData;
+ if (ofnData->interp != NULL) {
+ if (ofnPtr->Flags & OFN_EXPLORER) {
+ hdlg = GetParent(hdlg);
+ }
+ tsdPtr->debugInterp = ofnData->interp;
+ Tcl_DoWhenIdle(SetTkDialog, hdlg);
}
- tsdPtr->debugInterp = (Tcl_Interp *) ofnPtr->lCustData;
- Tcl_DoWhenIdle(SetTkDialog, (ClientData) hdlg);
-#ifdef _WIN64
- SetWindowLongPtr(hdlg, GWLP_USERDATA, (LPARAM) NULL);
-#else
- SetWindowLong(hdlg, GWL_USERDATA, (LPARAM) NULL);
-#endif
+ TkWinSetUserData(hdlg, NULL);
}
}
return 0;
@@ -1497,7 +1644,7 @@ OFNHookProc(
* MakeFilter --
*
* Allocate a buffer to store the filters in a format understood by
- * Windows
+ * Windows.
*
* Results:
* A standard TCL return value.
@@ -1507,20 +1654,28 @@ OFNHookProc(
*
*----------------------------------------------------------------------
*/
-static int
-MakeFilter(interp, string, dsPtr)
- Tcl_Interp *interp; /* Current interpreter. */
- char *string; /* String value of the -filetypes option */
- Tcl_DString *dsPtr; /* Filled with windows filter string. */
+
+static int
+MakeFilter(
+ Tcl_Interp *interp, /* Current interpreter. */
+ Tcl_Obj *valuePtr, /* Value of the -filetypes option */
+ Tcl_DString *dsPtr, /* Filled with windows filter string. */
+ Tcl_Obj *initialPtr, /* Initial type name */
+ int *index) /* Index of initial type in filter string */
{
char *filterStr;
char *p;
+ char *initial = NULL;
int pass;
+ int ix = 0; /* index counter */
FileFilterList flist;
FileFilter *filterPtr;
+ if (initialPtr) {
+ initial = Tcl_GetStringFromObj(initialPtr, NULL);
+ }
TkInitFileFilters(&flist);
- if (TkGetFileFilters(interp, &flist, string, 1) != TCL_OK) {
+ if (TkGetFileFilters(interp, &flist, valuePtr, 1) != TCL_OK) {
return TCL_ERROR;
}
@@ -1544,9 +1699,18 @@ MakeFilter(interp, string, dsPtr)
*p = '\0';
} else {
- /* We format the filetype into a string understood by Windows:
- * {"Text Documents" {.doc .txt} {TEXT}} becomes
- * "Text Documents (*.doc,*.txt)\0*.doc;*.txt\0"
+ int len;
+
+ if (valuePtr == NULL) {
+ len = 0;
+ } else {
+ (void) Tcl_GetStringFromObj(valuePtr, &len);
+ }
+
+ /*
+ * We format the filetype into a string understood by Windows: {"Text
+ * Documents" {.doc .txt} {TEXT}} becomes "Text Documents
+ * (*.doc,*.txt)\0*.doc;*.txt\0"
*
* See the Windows OPENFILENAME manual page for details on the filter
* string format.
@@ -1556,16 +1720,27 @@ MakeFilter(interp, string, dsPtr)
* Since we may only add asterisks (*) to the filter, we need at most
* twice the size of the string to format the filter
*/
- filterStr = ckalloc((unsigned int) strlen(string) * 3);
+
+ filterStr = ckalloc((unsigned int) len * 3);
for (filterPtr = flist.filters, p = filterStr; filterPtr;
- filterPtr = filterPtr->next) {
+ filterPtr = filterPtr->next) {
char *sep;
FileFilterClause *clausePtr;
/*
- * First, put in the name of the file type
+ * Check initial index for match, set index. Filter index is 1
+ * based so increment first
+ */
+ ix++;
+ if (index && initial && (strcmp(initial, filterPtr->name) == 0)) {
+ *index = ix;
+ }
+
+ /*
+ * First, put in the name of the file type.
*/
+
strcpy(p, filterPtr->name);
p+= strlen(filterPtr->name);
*p++ = ' ';
@@ -1573,24 +1748,24 @@ MakeFilter(interp, string, dsPtr)
for (pass = 1; pass <= 2; pass++) {
/*
- * In the first pass, we format the extensions in the
- * name field. In the second pass, we format the extensions in
- * the filter pattern field
+ * In the first pass, we format the extensions in the name
+ * field. In the second pass, we format the extensions in the
+ * filter pattern field
*/
+
sep = "";
for (clausePtr=filterPtr->clauses;clausePtr;
- clausePtr=clausePtr->next) {
+ clausePtr=clausePtr->next) {
GlobPattern *globPtr;
-
- for (globPtr=clausePtr->patterns; globPtr;
- globPtr=globPtr->next) {
+ for (globPtr = clausePtr->patterns; globPtr;
+ globPtr = globPtr->next) {
strcpy(p, sep);
- p+= strlen(sep);
+ p += strlen(sep);
strcpy(p, globPtr->pattern);
- p+= strlen(globPtr->pattern);
+ p += strlen(globPtr->pattern);
- if (pass==1) {
+ if (pass == 1) {
sep = ",";
} else {
sep = ";";
@@ -1598,11 +1773,9 @@ MakeFilter(interp, string, dsPtr)
}
}
if (pass == 1) {
- if (pass == 1) {
- *p ++ = ')';
- }
+ *p ++ = ')';
}
- *p ++ = '\0';
+ *p++ = '\0';
}
}
@@ -1610,6 +1783,7 @@ MakeFilter(interp, string, dsPtr)
* Windows requires the filter string to be ended by two NULL
* characters.
*/
+
*p++ = '\0';
*p = '\0';
}
@@ -1621,176 +1795,167 @@ MakeFilter(interp, string, dsPtr)
return TCL_OK;
}
-#ifdef USE_NEW_CHOOSEDIR
/*
*----------------------------------------------------------------------
*
* Tk_ChooseDirectoryObjCmd --
*
- * This procedure implements the "tk_chooseDirectory" dialog box
- * for the Windows platform. See the user documentation for details
- * on what it does. Uses the newer SHBrowseForFolder explorer type
- * interface.
+ * This function implements the "tk_chooseDirectory" dialog box for the
+ * Windows platform. See the user documentation for details on what it
+ * does. Uses the newer SHBrowseForFolder explorer type interface.
*
* Results:
- * See user documentation.
+ * See user documentation.
*
* Side effects:
- * A modal dialog window is created. Tcl_SetServiceMode() is
- * called to allow background events to be processed
+ * A modal dialog window is created. Tcl_SetServiceMode() is called to
+ * allow background events to be processed
*
*----------------------------------------------------------------------
-
-The procedure tk_chooseDirectory pops up a dialog box for the user to
-select a directory. The following option-value pairs are possible as
-command line arguments:
-
--initialdir dirname
-
-Specifies that the directories in directory should be displayed when the
-dialog pops up. If this parameter is not specified, then the directories
-in the current working directory are displayed. If the parameter specifies
-a relative path, the return value will convert the relative path to an
-absolute path. This option may not always work on the Macintosh. This is
-not a bug. Rather, the General Controls control panel on the Mac allows
-the end user to override the application default directory.
-
--parent window
-
-Makes window the logical parent of the dialog. The dialog is displayed on
-top of its parent window.
-
--title titleString
-
-Specifies a string to display as the title of the dialog box. If this
-option is not specified, then a default title will be displayed.
-
--mustexist boolean
-
-Specifies whether the user may specify non-existant directories. If this
-parameter is true, then the user may only select directories that already
-exist. The default value is false.
-
-New Behaviour:
-
-- If mustexist = 0 and a user entered folder does not exist, a prompt will
- pop-up asking if the user wants another chance to change it. The old
- dialog just returned the bogus entry. On mustexist = 1, the entries MUST
- exist before exiting the box with OK.
-
- Bugs:
-
-- If valid abs directory name is entered into the entry box and Enter
- pressed, the box will close returning the name. This is inconsistent when
- entering relative names or names with forward slashes, which are
- invalidated then corrected in the callback. After correction, the box is
- held open to allow further modification by the user.
-
-- Not sure how to implement localization of message prompts.
-
-- -title is really -message.
-ToDo:
-- Fix bugs.
-- test to see what platforms this really works on. May require v4.71
- of shell32.dll everywhere (what is standard?).
*
+ * The function tk_chooseDirectory pops up a dialog box for the user to select
+ * a directory. The following option-value pairs are possible as command line
+ * arguments:
+ *
+ * -initialdir dirname
+ *
+ * Specifies that the directories in directory should be displayed when the
+ * dialog pops up. If this parameter is not specified, then the directories in
+ * the current working directory are displayed. If the parameter specifies a
+ * relative path, the return value will convert the relative path to an
+ * absolute path. This option may not always work on the Macintosh. This is
+ * not a bug. Rather, the General Controls control panel on the Mac allows the
+ * end user to override the application default directory.
+ *
+ * -parent window
+ *
+ * Makes window the logical parent of the dialog. The dialog is displayed on
+ * top of its parent window.
+ *
+ * -title titleString
+ *
+ * Specifies a string to display as the title of the dialog box. If this
+ * option is not specified, then a default title will be displayed.
+ *
+ * -mustexist boolean
+ *
+ * Specifies whether the user may specify non-existant directories. If this
+ * parameter is true, then the user may only select directories that already
+ * exist. The default value is false.
+ *
+ * New Behaviour:
+ *
+ * - If mustexist = 0 and a user entered folder does not exist, a prompt will
+ * pop-up asking if the user wants another chance to change it. The old
+ * dialog just returned the bogus entry. On mustexist = 1, the entries MUST
+ * exist before exiting the box with OK.
+ *
+ * Bugs:
+ *
+ * - If valid abs directory name is entered into the entry box and Enter
+ * pressed, the box will close returning the name. This is inconsistent when
+ * entering relative names or names with forward slashes, which are
+ * invalidated then corrected in the callback. After correction, the box is
+ * held open to allow further modification by the user.
+ *
+ * - Not sure how to implement localization of message prompts.
+ *
+ * - -title is really -message.
+ *
+ *----------------------------------------------------------------------
*/
+
int
-Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_ChooseDirectoryObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
char path[MAX_PATH];
- int oldMode, result, i;
+ int oldMode, result = TCL_ERROR, i;
LPCITEMIDLIST pidl; /* Returned by browser */
BROWSEINFO bInfo; /* Used by browser */
CHOOSEDIRDATA cdCBData; /* Structure to pass back and forth */
LPMALLOC pMalloc; /* Used by shell */
-
- Tk_Window tkwin;
+ Tk_Window tkwin = (Tk_Window) clientData;
HWND hWnd;
- char *utfTitle; /* Title for window */
+ char *utfTitle = NULL;/* Title for window */
TCHAR saveDir[MAX_PATH];
Tcl_DString titleString; /* UTF Title */
Tcl_DString initDirString; /* Initial directory */
+ Tcl_Obj *objPtr;
static CONST char *optionStrings[] = {
- "-initialdir", "-mustexist", "-parent", "-title", (char *) NULL
+ "-initialdir", "-mustexist", "-parent", "-title", NULL
};
enum options {
- DIR_INITIAL, DIR_EXIST, DIR_PARENT, FILE_TITLE
+ DIR_INITIAL, DIR_EXIST, DIR_PARENT, FILE_TITLE
};
/*
* Initialize
*/
- result = TCL_ERROR;
- path[0] = '\0';
- utfTitle = NULL;
+ path[0] = '\0';
ZeroMemory(&cdCBData, sizeof(CHOOSEDIRDATA));
- cdCBData.interp = interp;
+ cdCBData.interp = interp;
- tkwin = (Tk_Window) clientData;
/*
* Process the command line options
*/
+
for (i = 1; i < objc; i += 2) {
- int index;
- char *string;
- Tcl_Obj *optionPtr, *valuePtr;
-
- optionPtr = objv[i];
- valuePtr = objv[i + 1];
-
- if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings, "option",
- 0, &index) != TCL_OK) {
- goto cleanup;
- }
- if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(optionPtr, NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
- goto cleanup;
- }
+ int index;
+ char *string;
+ Tcl_Obj *optionPtr, *valuePtr;
+
+ optionPtr = objv[i];
+ valuePtr = objv[i + 1];
+
+ if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings, "option", 0,
+ &index) != TCL_OK) {
+ goto cleanup;
+ }
+ if (i + 1 == objc) {
+ string = Tcl_GetString(optionPtr);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
+ goto cleanup;
+ }
string = Tcl_GetString(valuePtr);
- switch ((enum options) index) {
- case DIR_INITIAL: {
- if (Tcl_TranslateFileName(interp, string,
- &initDirString) == NULL) {
- goto cleanup;
- }
- string = Tcl_DStringValue(&initDirString);
- /*
- * Convert possible relative path to full path to keep
- * dialog happy
- */
- GetFullPathName(string, MAX_PATH, saveDir, NULL);
- lstrcpyn(cdCBData.utfInitDir, saveDir, MAX_PATH);
- Tcl_DStringFree(&initDirString);
- break;
- }
- case DIR_EXIST: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &cdCBData.mustExist) != TCL_OK) {
- goto cleanup;
- }
- break;
- }
- case DIR_PARENT: {
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- goto cleanup;
- }
- break;
- }
- case FILE_TITLE: {
- utfTitle = string;
- break;
- }
- }
+ switch ((enum options) index) {
+ case DIR_INITIAL:
+ if (Tcl_TranslateFileName(interp,string,&initDirString) == NULL) {
+ goto cleanup;
+ }
+ string = Tcl_DStringValue(&initDirString);
+
+ /*
+ * Convert possible relative path to full path to keep dialog
+ * happy.
+ */
+
+ GetFullPathName(string, MAX_PATH, saveDir, NULL);
+ lstrcpyn(cdCBData.utfInitDir, saveDir, MAX_PATH);
+ Tcl_DStringFree(&initDirString);
+ break;
+ case DIR_EXIST:
+ if (Tcl_GetBooleanFromObj(interp, valuePtr,
+ &cdCBData.mustExist) != TCL_OK) {
+ goto cleanup;
+ }
+ break;
+ case DIR_PARENT:
+ tkwin = Tk_NameToWindow(interp, string, tkwin);
+ if (tkwin == NULL) {
+ goto cleanup;
+ }
+ break;
+ case FILE_TITLE:
+ utfTitle = string;
+ break;
+ }
}
/*
@@ -1804,44 +1969,66 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
* Setup the parameters used by SHBrowseForFolder
*/
- bInfo.hwndOwner = hWnd;
+ bInfo.hwndOwner = hWnd;
bInfo.pszDisplayName = path;
- bInfo.pidlRoot = NULL;
+ bInfo.pidlRoot = NULL;
if (lstrlen(cdCBData.utfInitDir) == 0) {
- GetCurrentDirectory(MAX_PATH, cdCBData.utfInitDir);
+ GetCurrentDirectory(MAX_PATH, cdCBData.utfInitDir);
}
bInfo.lParam = (LPARAM) &cdCBData;
if (utfTitle != NULL) {
- Tcl_UtfToExternalDString(NULL, utfTitle, -1, &titleString);
- bInfo.lpszTitle = (LPTSTR) Tcl_DStringValue(&titleString);
+ Tcl_UtfToExternalDString(NULL, utfTitle, -1, &titleString);
+ bInfo.lpszTitle = (LPTSTR) Tcl_DStringValue(&titleString);
} else {
- bInfo.lpszTitle = "Please choose a directory, then select OK.";
+ bInfo.lpszTitle = "Please choose a directory, then select OK.";
}
/*
- * Set flags to add edit box (needs 4.71 Shell DLLs), status text line,
- * validate edit box and
+ * Set flags to add edit box, status text line and use the new ui. Allow
+ * override with magic variable (ignore errors in retrieval). See
+ * http://msdn.microsoft.com/en-us/library/bb773205(VS.85).aspx for
+ * possible flag values.
*/
- bInfo.ulFlags = BIF_EDITBOX | BIF_STATUSTEXT | BIF_RETURNFSANCESTORS
- | BIF_VALIDATE;
+
+ bInfo.ulFlags = BIF_EDITBOX | BIF_STATUSTEXT | BIF_RETURNFSANCESTORS
+ | BIF_VALIDATE | BIF_NEWDIALOGSTYLE;
+ objPtr = Tcl_GetVar2Ex(interp, "::tk::winChooseDirFlags", NULL,
+ TCL_GLOBAL_ONLY);
+ if (objPtr != NULL) {
+ int flags;
+ Tcl_GetIntFromObj(NULL, objPtr, &flags);
+ bInfo.ulFlags = flags;
+ }
/*
* Callback to handle events
*/
- bInfo.lpfn = (BFFCALLBACK) ChooseDirectoryValidateProc;
+
+ bInfo.lpfn = (BFFCALLBACK) ChooseDirectoryValidateProc;
/*
- * Display dialog in background and process result.
- * We look to give the user a chance to change their mind
- * on an invalid folder if mustexist is 0;
+ * Display dialog in background and process result. We look to give the
+ * user a chance to change their mind on an invalid folder if mustexist is
+ * 0.
*/
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
GetCurrentDirectory(MAX_PATH, saveDir);
if (SHGetMalloc(&pMalloc) == NOERROR) {
pidl = SHBrowseForFolder(&bInfo);
- /* Null for cancel button or invalid dir, otherwise valid*/
+
+ /*
+ * This is a fix for Windows 2000, which seems to modify the folder name
+ * buffer even when the dialog is canceled (in this case the buffer
+ * contains garbage). See [Bug #3002230]
+ */
+ path[0] = '\0';
+
+ /*
+ * Null for cancel button or invalid dir, otherwise valid.
+ */
+
if (pidl != NULL) {
if (!SHGetPathFromIDList(pidl, path)) {
Tcl_SetResult(interp, "Error: Not a file system folder\n",
@@ -1857,38 +2044,34 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
Tcl_SetServiceMode(oldMode);
/*
- * Ensure that hWnd is enabled, because it can happen that we
- * have updated the wrapper of the parent, which causes us to
- * leave this child disabled (Windows loses sync).
+ * Ensure that hWnd is enabled, because it can happen that we have updated
+ * the wrapper of the parent, which causes us to leave this child disabled
+ * (Windows loses sync).
*/
+
EnableWindow(hWnd, 1);
/*
- * Change the pathname to the Tcl "normalized" pathname, where
- * back slashes are used instead of forward slashes
+ * Change the pathname to the Tcl "normalized" pathname, where back
+ * slashes are used instead of forward slashes
*/
+
Tcl_ResetResult(interp);
if (*path) {
- char *p;
- Tcl_DString ds;
-
- Tcl_ExternalToUtfDString(NULL, (char *) path, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- if (*p == '\\') {
- *p = '/';
- }
- }
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
- Tcl_DStringFree(&ds);
+ Tcl_DString ds;
+
+ Tcl_AppendResult(interp, ConvertExternalFilename(NULL, (char *) path,
+ &ds), NULL);
+ Tcl_DStringFree(&ds);
}
result = TCL_OK;
if (utfTitle != NULL) {
- Tcl_DStringFree(&titleString);
+ Tcl_DStringFree(&titleString);
}
- cleanup:
+ cleanup:
return result;
}
@@ -1897,658 +2080,213 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
*
* ChooseDirectoryValidateProc --
*
- * Hook procedure called by the explorer ChooseDirectory dialog when events
- * occur. It is used to validate the text entry the user may have entered.
+ * Hook function called by the explorer ChooseDirectory dialog when
+ * events occur. It is used to validate the text entry the user may have
+ * entered.
*
* Results:
- * Returns 0 to allow default processing of message, or 1 to
- * tell default dialog procedure not to close.
+ * Returns 0 to allow default processing of message, or 1 to tell default
+ * dialog function not to close.
*
*----------------------------------------------------------------------
*/
+
static UINT APIENTRY
-ChooseDirectoryValidateProc (
+ChooseDirectoryValidateProc(
HWND hwnd,
UINT message,
LPARAM lParam,
LPARAM lpData)
{
TCHAR selDir[MAX_PATH];
- CHOOSEDIRDATA *chooseDirSharedData;
+ CHOOSEDIRDATA *chooseDirSharedData = (CHOOSEDIRDATA *) lpData;
Tcl_DString initDirString;
char string[MAX_PATH];
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- chooseDirSharedData = (CHOOSEDIRDATA *)lpData;
-
-#ifdef _WIN64
- SetWindowLongPtr(hwnd, GWLP_USERDATA, lpData);
-#else
- SetWindowLong(hwnd, GWL_USERDATA, lpData);
-#endif
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->debugFlag) {
- tsdPtr->debugInterp = (Tcl_Interp *) chooseDirSharedData->interp;
- Tcl_DoWhenIdle(SetTkDialog, (ClientData) hwnd);
+ tsdPtr->debugInterp = (Tcl_Interp *) chooseDirSharedData->interp;
+ Tcl_DoWhenIdle(SetTkDialog, (ClientData) hwnd);
}
chooseDirSharedData->utfRetDir[0] = '\0';
switch (message) {
- case BFFM_VALIDATEFAILED:
- /*
- * First save and check to see if it is a valid path name, if
- * so then make that path the one shown in the
- * window. Otherwise, it failed the check and should be treated
- * as such. Use Set/GetCurrentDirectory which allows relative
- * path names and names with forward slashes. Use
- * Tcl_TranslateFileName to make sure names like ~ are
- * converted correctly.
- */
- Tcl_TranslateFileName(chooseDirSharedData->interp,
- (char *)lParam, &initDirString);
- lstrcpyn (string, Tcl_DStringValue(&initDirString), MAX_PATH);
- Tcl_DStringFree(&initDirString);
-
- if (SetCurrentDirectory((char *)string) == 0) {
- LPTSTR lpFilePart[MAX_PATH];
-
- /*
- * Get the full path name to the user entry,
- * at this point it doesn't exist so see if
- * it is supposed to. Otherwise just return it.
- */
- GetFullPathName(string, MAX_PATH,
- chooseDirSharedData->utfRetDir, /*unused*/ lpFilePart);
- if (chooseDirSharedData->mustExist) {
- /*
- * User HAS to select a valid directory.
- */
- wsprintf(selDir, TEXT("Directory '%.200s' does not exist,\nplease select or enter an existing directory."), chooseDirSharedData->utfRetDir);
- MessageBox(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK);
- chooseDirSharedData->utfRetDir[0] = '\0';
- return 1;
- }
- } else {
- /*
- * Changed to new folder OK, return immediatly with the
- * current directory in utfRetDir.
- */
- GetCurrentDirectory(MAX_PATH, chooseDirSharedData->utfRetDir);
- return 0;
- }
- return 0;
-
- case BFFM_SELCHANGED:
- /*
- * Set the status window to the currently selected path.
- * And enable the OK button if a file system folder, otherwise
- * disable the OK button for things like server names.
- * perhaps a new switch -enablenonfolders can be used to allow
- * non folders to be selected.
- *
- * Not called when user changes edit box directly.
- */
-
- if (SHGetPathFromIDList((LPITEMIDLIST) lParam, selDir)) {
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) selDir);
- // enable the OK button
- SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
- SetCurrentDirectory(selDir);
- } else {
- // disable the OK button
- SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0);
- }
- UpdateWindow(hwnd);
- return 1;
-
- case BFFM_INITIALIZED: {
- /*
- * Directory browser intializing - tell it where to start from,
- * user specified parameter.
- */
- char *initDir = chooseDirSharedData->utfInitDir;
-
- SetCurrentDirectory(initDir);
- if (*initDir == '\\') {
- /*
- * BFFM_SETSELECTION only understands UNC paths as pidls,
- * so convert path to pidl using IShellFolder interface.
- */
- LPMALLOC pMalloc;
- LPSHELLFOLDER psfFolder;
-
- if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
- if (SUCCEEDED(SHGetDesktopFolder(&psfFolder))) {
- LPITEMIDLIST pidlMain;
- ULONG ulCount, ulAttr;
- Tcl_DString ds;
-
- Tcl_UtfToExternalDString(TkWinGetUnicodeEncoding(),
- initDir, -1, &ds);
- if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName(
- psfFolder, hwnd, NULL,
- (WCHAR *) Tcl_DStringValue(&ds),
- &ulCount, &pidlMain, &ulAttr))
- && (pidlMain != NULL)) {
- SendMessage(hwnd, BFFM_SETSELECTION, FALSE,
- (LPARAM)pidlMain);
- pMalloc->lpVtbl->Free(pMalloc, pidlMain);
- }
- psfFolder->lpVtbl->Release(psfFolder);
- Tcl_DStringFree(&ds);
- }
- pMalloc->lpVtbl->Release(pMalloc);
- }
- } else {
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)initDir);
- }
- SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
- break;
- }
-
- }
- return 0;
-}
-#else
-/*
- *----------------------------------------------------------------------
- *
- * Tk_ChooseDirectoryObjCmd --
- *
- * This procedure implements the "tk_chooseDirectory" dialog box
- * for the Windows platform. See the user documentation for details
- * on what it does.
- *
- * Results:
- * See user documentation.
- *
- * Side effects:
- * A modal dialog window is created. Tcl_SetServiceMode() is
- * called to allow background events to be processed
- *
- *----------------------------------------------------------------------
- */
-
-int
-Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
-{
- OPENFILENAME ofn;
- TCHAR path[MAX_PATH], savePath[MAX_PATH];
- ChooseDir cd;
- int result, mustExist, code, mode, i;
- Tk_Window tkwin;
- HWND hWnd;
- char *utfTitle;
- Tcl_DString utfDirString;
- Tcl_DString titleString, dirString;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- static CONST char *optionStrings[] = {
- "-initialdir", "-mustexist", "-parent", "-title",
- NULL
- };
- enum options {
- DIR_INITIAL, DIR_EXIST, DIR_PARENT, FILE_TITLE
- };
-
- if (tsdPtr->WM_LBSELCHANGED == 0) {
- tsdPtr->WM_LBSELCHANGED = RegisterWindowMessage(LBSELCHSTRING);
- }
-
- result = TCL_ERROR;
- path[0] = '\0';
-
- Tcl_DStringInit(&utfDirString);
- mustExist = 0;
- tkwin = (Tk_Window) clientData;
- utfTitle = NULL;
-
- for (i = 1; i < objc; i += 2) {
- int index;
- char *string;
- Tcl_Obj *optionPtr, *valuePtr;
-
- optionPtr = objv[i];
- valuePtr = objv[i + 1];
-
- if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings, "option",
- 0, &index) != TCL_OK) {
- goto cleanup;
- }
- if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(optionPtr, NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
- goto cleanup;
- }
-
- string = Tcl_GetStringFromObj(valuePtr, NULL);
- switch ((enum options) index) {
- case DIR_INITIAL: {
- Tcl_DStringFree(&utfDirString);
- if (Tcl_TranslateFileName(interp, string,
- &utfDirString) == NULL) {
- goto cleanup;
- }
- break;
- }
- case DIR_EXIST: {
- if (Tcl_GetBooleanFromObj(interp, valuePtr, &mustExist) != TCL_OK) {
- goto cleanup;
- }
- break;
- }
- case DIR_PARENT: {
- tkwin = Tk_NameToWindow(interp, string, tkwin);
- if (tkwin == NULL) {
- goto cleanup;
- }
- break;
- }
- case FILE_TITLE: {
- utfTitle = string;
- break;
- }
- }
- }
-
- Tk_MakeWindowExist(tkwin);
- hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
-
- cd.interp = interp;
- cd.ofnPtr = &ofn;
-
- ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = hWnd;
-#ifdef _WIN64
- ofn.hInstance = (HINSTANCE) GetWindowLongPtr(ofn.hwndOwner,
- GWLP_HINSTANCE);
-#else
- ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner,
- GWL_HINSTANCE);
-#endif
- ofn.lpstrFilter = NULL;
- ofn.lpstrCustomFilter = NULL;
- ofn.nMaxCustFilter = 0;
- ofn.nFilterIndex = 0;
- ofn.lpstrFile = NULL; //(TCHAR *) path;
- ofn.nMaxFile = MAX_PATH;
- ofn.lpstrFileTitle = NULL;
- ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
- ofn.lpstrTitle = NULL;
- ofn.Flags = OFN_HIDEREADONLY
- | OFN_ENABLEHOOK | OFN_ENABLETEMPLATE;
- ofn.nFileOffset = 0;
- ofn.nFileExtension = 0;
- ofn.lpstrDefExt = NULL;
- ofn.lCustData = (LPARAM) &cd;
- ofn.lpfnHook = (LPOFNHOOKPROC) ChooseDirectoryHookProc;
- ofn.lpTemplateName = MAKEINTRESOURCE(FILEOPENORD);
-
- if (Tcl_DStringValue(&utfDirString)[0] != '\0') {
- Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&utfDirString),
- Tcl_DStringLength(&utfDirString), &dirString);
- } else {
+ case BFFM_VALIDATEFAILED:
/*
- * NT 5.0 changed the meaning of lpstrInitialDir, so we have
- * to ensure that we set the [pwd] if the user didn't specify
- * anything else.
+ * First save and check to see if it is a valid path name, if so then
+ * make that path the one shown in the window. Otherwise, it failed
+ * the check and should be treated as such. Use
+ * Set/GetCurrentDirectory which allows relative path names and names
+ * with forward slashes. Use Tcl_TranslateFileName to make sure names
+ * like ~ are converted correctly.
*/
- Tcl_DString cwd;
- Tcl_DStringFree(&utfDirString);
- if ((Tcl_GetCwd(interp, &utfDirString) == (char *) NULL) ||
- (Tcl_TranslateFileName(interp,
- Tcl_DStringValue(&utfDirString), &cwd) == NULL)) {
- Tcl_ResetResult(interp);
- } else {
- Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&cwd),
- Tcl_DStringLength(&cwd), &dirString);
- }
- Tcl_DStringFree(&cwd);
- }
- ofn.lpstrInitialDir = (LPTSTR) Tcl_DStringValue(&dirString);
-
- if (mustExist) {
- ofn.Flags |= OFN_PATHMUSTEXIST;
- }
- if (utfTitle != NULL) {
- Tcl_UtfToExternalDString(NULL, utfTitle, -1, &titleString);
- ofn.lpstrTitle = (LPTSTR) Tcl_DStringValue(&titleString);
- }
-
- /*
- * Display dialog. The choose directory dialog doesn't preserve the
- * current directory, so it must be saved and restored here.
- */
-
- GetCurrentDirectory(MAX_PATH, savePath);
- mode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- code = GetOpenFileName(&ofn);
- Tcl_SetServiceMode(mode);
- SetCurrentDirectory(savePath);
-
- /*
- * Ensure that hWnd is enabled, because it can happen that we
- * have updated the wrapper of the parent, which causes us to
- * leave this child disabled (Windows loses sync).
- */
- EnableWindow(hWnd, 1);
-
- Tcl_ResetResult(interp);
- if (code != 0) {
- /*
- * Change the pathname to the Tcl "normalized" pathname, where
- * back slashes are used instead of forward slashes
- */
-
- char *p;
- Tcl_DString ds;
-
- Tcl_ExternalToUtfDString(NULL, (char *) cd.path, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- if (*p == '\\') {
- *p = '/';
- }
- }
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
- Tcl_DStringFree(&ds);
- }
-
- if (ofn.lpstrTitle != NULL) {
- Tcl_DStringFree(&titleString);
- }
- if (ofn.lpstrInitialDir != NULL) {
- Tcl_DStringFree(&dirString);
- }
- result = TCL_OK;
-
- cleanup:
- Tcl_DStringFree(&utfDirString);
-
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ChooseDirectoryHookProc --
- *
- * Hook procedure called by the ChooseDirectory dialog to modify
- * its default behavior. The ChooseDirectory dialog is really an
- * OpenFile dialog with certain controls rearranged and certain
- * behaviors changed. For instance, typing a name in the
- * ChooseDirectory dialog selects a directory, rather than
- * selecting a file.
- *
- * Results:
- * Returns 0 to allow default processing of message, or 1 to
- * tell default dialog procedure not to process the message.
- *
- * Side effects:
- * A dialog window is created the first this procedure is called.
- * This window is not destroyed and will be reused the next time
- * the application invokes the "tk_getOpenFile" or
- * "tk_getSaveFile" command.
- *
- *----------------------------------------------------------------------
- */
-
-static UINT APIENTRY
-ChooseDirectoryHookProc(
- HWND hwnd,
- UINT message,
- WPARAM wParam,
- LPARAM lParam)
-{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- OPENFILENAME *ofnPtr;
- ChooseDir *cdPtr;
-
- if (message == WM_INITDIALOG) {
- ofnPtr = (OPENFILENAME *) lParam;
- cdPtr = (ChooseDir *) ofnPtr->lCustData;
- cdPtr->lastCtrl = 0;
- cdPtr->lastIdx = 1000;
- cdPtr->path[0] = '\0';
-#ifdef _WIN64
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) cdPtr);
-#else
- SetWindowLong(hwnd, GWL_USERDATA, (LONG) cdPtr);
-#endif
+ if (Tcl_TranslateFileName(chooseDirSharedData->interp,
+ (char *) lParam, &initDirString) == NULL) {
+ /*
+ * Should we expose the error (in the interp result) to the user
+ * at this point?
+ */
- if (ofnPtr->lpstrInitialDir == NULL) {
- GetCurrentDirectory(MAX_PATH, cdPtr->path);
- } else {
- lstrcpy(cdPtr->path, ofnPtr->lpstrInitialDir);
- }
- SetDlgItemText(hwnd, edt10, cdPtr->path);
- SendDlgItemMessage(hwnd, edt10, EM_SETSEL, 0, -1);
- if (tsdPtr->debugFlag) {
- tsdPtr->debugInterp = cdPtr->interp;
- Tcl_DoWhenIdle(SetTkDialog, (ClientData) hwnd);
+ chooseDirSharedData->utfRetDir[0] = '\0';
+ return 1;
}
- return 0;
- }
-
- /*
- * GWL_USERDATA keeps track of cdPtr.
- */
-
-#ifdef _WIN64
- cdPtr = (ChooseDir *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-#else
- cdPtr = (ChooseDir *) GetWindowLong(hwnd, GWL_USERDATA);
-#endif
- if (cdPtr == NULL) {
- return 0;
- }
- ofnPtr = cdPtr->ofnPtr;
+ lstrcpyn(string, Tcl_DStringValue(&initDirString), MAX_PATH);
+ Tcl_DStringFree(&initDirString);
- if (message == tsdPtr->WM_LBSELCHANGED) {
- /*
- * Called when double-clicking on directory.
- * If directory wasn't already open, browse that directory.
- * If directory was already open, return selected directory.
- */
+ if (SetCurrentDirectory((char *)string) == 0) {
+ LPTSTR lpFilePart[MAX_PATH];
- int idCtrl, thisItem;
+ /*
+ * Get the full path name to the user entry, at this point it does
+ * not exist so see if it is supposed to. Otherwise just return
+ * it.
+ */
- idCtrl = (int) wParam;
- thisItem = LOWORD(lParam);
+ GetFullPathName(string, MAX_PATH,
+ chooseDirSharedData->utfRetDir, /*unused*/ lpFilePart);
+ if (chooseDirSharedData->mustExist) {
+ /*
+ * User HAS to select a valid directory.
+ */
- GetCurrentDirectory(MAX_PATH, cdPtr->path);
- if (idCtrl == lst2) {
- if (cdPtr->lastIdx == thisItem) {
- EndDialog(hwnd, IDOK);
+ wsprintf(selDir, TEXT("Directory '%.200s' does not exist,\nplease select or enter an existing directory."), chooseDirSharedData->utfRetDir);
+ MessageBox(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK);
+ chooseDirSharedData->utfRetDir[0] = '\0';
return 1;
}
- cdPtr->lastIdx = thisItem;
- }
- SetDlgItemText(hwnd, edt10, cdPtr->path);
- SendDlgItemMessage(hwnd, edt10, EM_SETSEL, 0, -1);
- } else if (message == WM_COMMAND) {
- int idCtrl, notifyCode;
-
- idCtrl = LOWORD(wParam);
- notifyCode = HIWORD(wParam);
-
- if ((idCtrl != IDOK) || (notifyCode != BN_CLICKED)) {
+ } else {
/*
- * OK Button wasn't clicked. Do the default.
+ * Changed to new folder OK, return immediatly with the current
+ * directory in utfRetDir.
*/
- if ((idCtrl == lst2) || (idCtrl == edt10)) {
- cdPtr->lastCtrl = idCtrl;
- }
+ GetCurrentDirectory(MAX_PATH, chooseDirSharedData->utfRetDir);
return 0;
}
+ return 0;
+ case BFFM_SELCHANGED:
/*
- * Dialogs also get the message that OK was clicked when Enter
- * is pressed in some other control. Find out what window
- * we were really in when we got the supposed "OK", because the
- * behavior is different.
+ * Set the status window to the currently selected path and enable the
+ * OK button if a file system folder, otherwise disable the OK button
+ * for things like server names. Perhaps a new switch
+ * -enablenonfolders can be used to allow non folders to be selected.
+ *
+ * Not called when user changes edit box directly.
*/
- if (cdPtr->lastCtrl == edt10) {
- /*
- * Hit Enter or clicked OK while typing a directory name in the
- * edit control.
- * If it's a new name, try to go to that directory.
- * If the name hasn't changed since last time, return selected
- * directory.
- */
-
- int changed;
- TCHAR tmp[MAX_PATH];
-
- if (GetDlgItemText(hwnd, edt10, tmp, MAX_PATH) == 0) {
- return 0;
- }
-
- changed = lstrcmp(cdPtr->path, tmp);
- lstrcpy(cdPtr->path, tmp);
-
- if (SetCurrentDirectory(cdPtr->path) == 0) {
- /*
- * Non-existent directory.
- */
-
- if (ofnPtr->Flags & OFN_PATHMUSTEXIST) {
- /*
- * Directory must exist. Complain, then rehighlight text.
- */
-
- wsprintf(tmp, _T("Cannot change directory to \"%.200s\"."),
- cdPtr->path);
- MessageBox(hwnd, tmp, NULL, MB_OK);
- SendDlgItemMessage(hwnd, edt10, EM_SETSEL, 0, -1);
- return 0;
- }
- if (changed) {
- /*
- * Directory was invalid, but we want to keep displaying
- * this name. Don't update the listbox that displays the
- * current directory heirarchy, or it'll erase the name.
- */
-
- SendDlgItemMessage(hwnd, edt10, EM_SETSEL, 0, -1);
- return 0;
- }
- }
- if (changed == 0) {
- /*
- * Name hasn't changed since the last time we hit return
- * or double-clicked on a directory, so return this.
- */
+ if (SHGetPathFromIDList((LPITEMIDLIST) lParam, selDir)) {
+ SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) selDir);
+ // enable the OK button
+ SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
+ } else {
+ // disable the OK button
+ SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0);
+ }
+ UpdateWindow(hwnd);
+ return 1;
- EndDialog(hwnd, IDOK);
- return 1;
- }
-
- cdPtr->lastCtrl = IDOK;
+ case BFFM_INITIALIZED: {
+ /*
+ * Directory browser intializing - tell it where to start from, user
+ * specified parameter.
+ */
- /*
- * The following is the magic code, determined by running
- * Spy++ on some other directory chooser, that it takes to
- * get this dialog to update the listbox to display the
- * current directory.
- */
+ char *initDir = chooseDirSharedData->utfInitDir;
- SetDlgItemText(hwnd, edt1, cdPtr->path);
- SendMessage(hwnd, WM_COMMAND, (WPARAM) MAKELONG(cmb2, 0x8003),
- (LPARAM) GetDlgItem(hwnd, cmb2));
- return 0;
- } else if (idCtrl == lst2) {
+ SetCurrentDirectory(initDir);
+ if (*initDir == '\\') {
/*
- * Enter key was pressed while in listbox.
- * If it's a new directory, allow default behavior to open dir.
- * If the directory hasn't changed, return selected directory.
+ * BFFM_SETSELECTION only understands UNC paths as pidls, so
+ * convert path to pidl using IShellFolder interface.
*/
- int thisItem;
-
- thisItem = (int) SendDlgItemMessage(hwnd, lst2, LB_GETCURSEL, 0, 0);
- if (cdPtr->lastIdx == thisItem) {
- GetCurrentDirectory(MAX_PATH, cdPtr->path);
- EndDialog(hwnd, IDOK);
- return 1;
+ LPMALLOC pMalloc;
+ LPSHELLFOLDER psfFolder;
+
+ if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
+ if (SUCCEEDED(SHGetDesktopFolder(&psfFolder))) {
+ LPITEMIDLIST pidlMain;
+ ULONG ulCount, ulAttr;
+ Tcl_DString ds;
+
+ Tcl_UtfToExternalDString(TkWinGetUnicodeEncoding(),
+ initDir, -1, &ds);
+ if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName(
+ psfFolder, hwnd, NULL, (WCHAR *)
+ Tcl_DStringValue(&ds), &ulCount,&pidlMain,&ulAttr))
+ && (pidlMain != NULL)) {
+ SendMessage(hwnd, BFFM_SETSELECTION, FALSE,
+ (LPARAM) pidlMain);
+ pMalloc->lpVtbl->Free(pMalloc, pidlMain);
+ }
+ psfFolder->lpVtbl->Release(psfFolder);
+ Tcl_DStringFree(&ds);
+ }
+ pMalloc->lpVtbl->Release(pMalloc);
}
- } else if (idCtrl == IDOK) {
- /*
- * The OK button was clicked. Return the value currently selected
- * in the entry.
- */
-
- GetCurrentDirectory(MAX_PATH, cdPtr->path);
- EndDialog(hwnd, IDOK);
- return 1;
+ } else {
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) initDir);
}
+ SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
+ break;
+ }
+
}
return 0;
}
-#endif
/*
*----------------------------------------------------------------------
*
* Tk_MessageBoxObjCmd --
*
- * This procedure implements the MessageBox window for the
- * Windows platform. See the user documentation for details on what
- * it does.
+ * This function implements the MessageBox window for the Windows
+ * platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
- * None. The MessageBox window will be destroy before this procedure
+ * None. The MessageBox window will be destroy before this function
* returns.
*
*----------------------------------------------------------------------
*/
int
-Tk_MessageBoxObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_MessageBoxObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- Tk_Window tkwin, parent;
+ Tk_Window tkwin = (Tk_Window) clientData, parent;
HWND hWnd;
- char *message, *title;
+ Tcl_Obj *messageObj, *titleObj, *detailObj, *tmpObj;
int defaultBtn, icon, type;
int i, oldMode, winCode;
UINT flags;
- Tcl_DString messageString, titleString;
- Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
static CONST char *optionStrings[] = {
- "-default", "-icon", "-message", "-parent",
- "-title", "-type", NULL
+ "-default", "-detail", "-icon", "-message",
+ "-parent", "-title", "-type", NULL
};
enum options {
- MSG_DEFAULT, MSG_ICON, MSG_MESSAGE, MSG_PARENT,
- MSG_TITLE, MSG_TYPE
+ MSG_DEFAULT, MSG_DETAIL, MSG_ICON, MSG_MESSAGE,
+ MSG_PARENT, MSG_TITLE, MSG_TYPE
};
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- tkwin = (Tk_Window) clientData;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- defaultBtn = -1;
- icon = MB_ICONINFORMATION;
- message = NULL;
- parent = tkwin;
- title = NULL;
- type = MB_OK;
+ (void) TkWinGetUnicodeEncoding();
+ defaultBtn = -1;
+ detailObj = NULL;
+ icon = MB_ICONINFORMATION;
+ messageObj = NULL;
+ parent = tkwin;
+ titleObj = NULL;
+ type = MB_OK;
for (i = 1; i < objc; i += 2) {
int index;
@@ -2563,22 +2301,25 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
if (i + 1 == objc) {
- string = Tcl_GetStringFromObj(optionPtr, NULL);
- Tcl_AppendResult(interp, "value for \"", string, "\" missing",
- (char *) NULL);
+ string = Tcl_GetString(optionPtr);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
return TCL_ERROR;
}
- string = Tcl_GetStringFromObj(valuePtr, NULL);
switch ((enum options) index) {
- case MSG_DEFAULT:
- defaultBtn = TkFindStateNumObj(interp, optionPtr, buttonMap,
+ case MSG_DEFAULT:
+ defaultBtn = TkFindStateNumObj(interp, optionPtr, buttonMap,
valuePtr);
if (defaultBtn < 0) {
return TCL_ERROR;
}
break;
+ case MSG_DETAIL:
+ detailObj = valuePtr;
+ break;
+
case MSG_ICON:
icon = TkFindStateNumObj(interp, optionPtr, iconMap, valuePtr);
if (icon < 0) {
@@ -2587,18 +2328,18 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv)
break;
case MSG_MESSAGE:
- message = string;
+ messageObj = valuePtr;
break;
- case MSG_PARENT:
- parent = Tk_NameToWindow(interp, string, tkwin);
+ case MSG_PARENT:
+ parent = Tk_NameToWindow(interp, Tcl_GetString(valuePtr), tkwin);
if (parent == NULL) {
return TCL_ERROR;
}
break;
case MSG_TITLE:
- title = string;
+ titleObj = valuePtr;
break;
case MSG_TYPE:
@@ -2607,19 +2348,20 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
break;
-
}
}
+ while (!Tk_IsTopLevel(parent)) {
+ parent = Tk_Parent(parent);
+ }
Tk_MakeWindowExist(parent);
hWnd = Tk_GetHWND(Tk_WindowId(parent));
-
+
flags = 0;
if (defaultBtn >= 0) {
- int defaultBtnIdx;
+ int defaultBtnIdx = -1;
- defaultBtnIdx = -1;
- for (i = 0; i < NUM_TYPES; i++) {
+ for (i = 0; i < (int) NUM_TYPES; i++) {
if (type == allowedTypes[i].type) {
int j;
@@ -2631,7 +2373,7 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv)
}
if (defaultBtnIdx < 0) {
Tcl_AppendResult(interp, "invalid default button \"",
- TkFindStateString(buttonMap, defaultBtn),
+ TkFindStateString(buttonMap, defaultBtn),
"\"", NULL);
return TCL_ERROR;
}
@@ -2641,82 +2383,140 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv)
flags = buttonFlagMap[defaultBtnIdx];
}
- flags |= icon | type | MB_SYSTEMMODAL;
+ flags |= icon | type | MB_TASKMODAL | MB_SETFOREGROUND;
- Tcl_UtfToExternalDString(unicodeEncoding, message, -1, &messageString);
- Tcl_UtfToExternalDString(unicodeEncoding, title, -1, &titleString);
+ tmpObj = messageObj ? Tcl_DuplicateObj(messageObj)
+ : Tcl_NewUnicodeObj(NULL, 0);
+ Tcl_IncrRefCount(tmpObj);
+ if (detailObj) {
+ Tcl_AppendUnicodeToObj(tmpObj, L"\n\n", 2);
+ Tcl_AppendObjToObj(tmpObj, detailObj);
+ }
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
/*
- * MessageBoxW exists for all platforms. Use it to allow unicode
- * error message to be displayed correctly where possible by the OS.
+ * MessageBoxW exists for all platforms. Use it to allow unicode error
+ * message to be displayed correctly where possible by the OS.
*
- * In order to have the parent window icon reflected in a MessageBox,
- * we have to create a hook that will trigger when the MessageBox is
- * being created.
+ * In order to have the parent window icon reflected in a MessageBox, we
+ * have to create a hook that will trigger when the MessageBox is being
+ * created.
*/
+
tsdPtr->hSmallIcon = TkWinGetIcon(parent, ICON_SMALL);
tsdPtr->hBigIcon = TkWinGetIcon(parent, ICON_BIG);
tsdPtr->hMsgBoxHook = SetWindowsHookEx(WH_CBT, MsgBoxCBTProc, NULL,
GetCurrentThreadId());
- winCode = MessageBoxW(hWnd, (WCHAR *) Tcl_DStringValue(&messageString),
- (WCHAR *) Tcl_DStringValue(&titleString), flags);
+ winCode = MessageBoxW(hWnd, Tcl_GetUnicode(tmpObj),
+ titleObj ? Tcl_GetUnicode(titleObj) : L"", flags);
UnhookWindowsHookEx(tsdPtr->hMsgBoxHook);
(void) Tcl_SetServiceMode(oldMode);
/*
- * Ensure that hWnd is enabled, because it can happen that we
- * have updated the wrapper of the parent, which causes us to
- * leave this child disabled (Windows loses sync).
+ * Ensure that hWnd is enabled, because it can happen that we have updated
+ * the wrapper of the parent, which causes us to leave this child disabled
+ * (Windows loses sync).
*/
+
EnableWindow(hWnd, 1);
- Tcl_DStringFree(&messageString);
- Tcl_DStringFree(&titleString);
+ Tcl_DecrRefCount(tmpObj);
Tcl_SetResult(interp, TkFindStateString(buttonMap, winCode), TCL_STATIC);
return TCL_OK;
}
-
+
static LRESULT CALLBACK
-MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam)
+MsgBoxCBTProc(
+ int nCode,
+ WPARAM wParam,
+ LPARAM lParam)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (nCode == HCBT_CREATEWND) {
/*
- * Window owned by our task is being created. Since the hook is
+ * Window owned by our task is being created. Since the hook is
* installed just before the MessageBox call and removed after the
- * MessageBox call, the window being created is either the message
- * box or one of its controls. Check that the class is WC_DIALOG
- * to ensure that it's the one we want.
+ * MessageBox call, the window being created is either the message box
+ * or one of its controls. Check that the class is WC_DIALOG to ensure
+ * that it's the one we want.
*/
- LPCBT_CREATEWND lpcbtcreate = (LPCBT_CREATEWND)lParam;
+
+ LPCBT_CREATEWND lpcbtcreate = (LPCBT_CREATEWND) lParam;
if (WC_DIALOG == lpcbtcreate->lpcs->lpszClass) {
HWND hwnd = (HWND) wParam;
+
SendMessage(hwnd, WM_SETICON, ICON_SMALL,
(LPARAM) tsdPtr->hSmallIcon);
- SendMessage(hwnd, WM_SETICON, ICON_BIG,
- (LPARAM) tsdPtr->hBigIcon);
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) tsdPtr->hBigIcon);
}
}
/*
* Call the next hook proc, if there is one
*/
+
return CallNextHookEx(tsdPtr->hMsgBoxHook, nCode, wParam, lParam);
}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * SetTkDialog --
+ *
+ * Records the HWND for a native dialog in the 'tk_dialog' variable so
+ * that the test-suite can operate on the correct dialog window. Use of
+ * this is enabled when a test program calls TkWinDialogDebug by calling
+ * the test command 'tkwinevent debug 1'.
+ *
+ * ----------------------------------------------------------------------
+ */
-static void
-SetTkDialog(ClientData clientData)
+static void
+SetTkDialog(
+ ClientData clientData)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
char buf[32];
sprintf(buf, "0x%p", (HWND) clientData);
Tcl_SetVar(tsdPtr->debugInterp, "tk_dialog", buf, TCL_GLOBAL_ONLY);
}
+
+/*
+ * Factored out a common pattern in use in this file.
+ */
+static char *
+ConvertExternalFilename(
+ Tcl_Encoding encoding,
+ char *filename,
+ Tcl_DString *dsPtr)
+{
+ char *p;
+
+ Tcl_ExternalToUtfDString(encoding, filename, -1, dsPtr);
+ for (p = Tcl_DStringValue(dsPtr); *p != '\0'; p++) {
+ /*
+ * Change the pathname to the Tcl "normalized" pathname, where back
+ * slashes are used instead of forward slashes
+ */
+
+ if (*p == '\\') {
+ *p = '/';
+ }
+ }
+ return Tcl_DStringValue(dsPtr);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index d0a609f..366fc61 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -1,14 +1,14 @@
-/*
+/*
* tkWinDraw.c --
*
- * This file contains the Xlib emulation functions pertaining to
- * actually drawing objects on a window.
+ * This file contains the Xlib emulation functions pertaining to actually
+ * drawing objects on a window.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
* Copyright (c) 1994 Software Research Associates, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
@@ -44,9 +44,9 @@ int tkpWinRopModes[] = {
};
/*
- * Translation table between X gc functions and Win32 BitBlt op modes. Some
- * of the operations defined in X don't have names, so we have to construct
- * new opcodes for those functions. This is arcane and probably not all that
+ * Translation table between X gc functions and Win32 BitBlt op modes. Some of
+ * the operations defined in X don't have names, so we have to construct new
+ * opcodes for those functions. This is arcane and probably not all that
* useful, but at least it's accurate.
*/
@@ -75,9 +75,9 @@ int tkpWinBltModes[] = {
};
/*
- * The following raster op uses the source bitmap as a mask for the
- * pattern. This is used to draw in a foreground color but leave the
- * background color transparent.
+ * The following raster op uses the source bitmap as a mask for the pattern.
+ * This is used to draw in a foreground color but leave the background color
+ * transparent.
*/
#define MASKPAT 0x00E20746 /* dest = (src & pat) | (!src & dst) */
@@ -101,29 +101,27 @@ int tkpWinBltModes[] = {
* The followng typedef is used to pass Windows GDI drawing functions.
*/
-typedef BOOL (CALLBACK *WinDrawFunc) _ANSI_ARGS_((HDC dc,
- CONST POINT* points, int npoints));
+typedef BOOL (CALLBACK *WinDrawFunc)(HDC dc, CONST POINT* points, int npoints);
typedef struct ThreadSpecificData {
- POINT *winPoints; /* Array of points that is reused. */
- int nWinPoints; /* Current size of point array. */
+ POINT *winPoints; /* Array of points that is reused. */
+ int nWinPoints; /* Current size of point array. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static POINT * ConvertPoints _ANSI_ARGS_((XPoint *points, int npoints,
- int mode, RECT *bbox));
-static void DrawOrFillArc _ANSI_ARGS_((Display *display,
- Drawable d, GC gc, int x, int y,
- unsigned int width, unsigned int height,
- int start, int extent, int fill));
-static void RenderObject _ANSI_ARGS_((HDC dc, GC gc,
- XPoint* points, int npoints, int mode, HPEN pen,
- WinDrawFunc func));
-static HPEN SetUpGraphicsPort _ANSI_ARGS_((GC gc));
+static POINT * ConvertPoints(XPoint *points, int npoints, int mode,
+ RECT *bbox);
+static void DrawOrFillArc(Display *display, Drawable d, GC gc,
+ int x, int y, unsigned int width,
+ unsigned int height, int start, int extent,
+ int fill);
+static void RenderObject(HDC dc, GC gc, XPoint* points,
+ int npoints, int mode, HPEN pen, WinDrawFunc func);
+static HPEN SetUpGraphicsPort(GC gc);
/*
*----------------------------------------------------------------------
@@ -133,21 +131,21 @@ static HPEN SetUpGraphicsPort _ANSI_ARGS_((GC gc));
* Retrieve the DC from a drawable.
*
* Results:
- * Returns the window DC for windows. Returns a new memory DC
- * for pixmaps.
+ * Returns the window DC for windows. Returns a new memory DC for
+ * pixmaps.
*
* Side effects:
- * Sets up the palette for the device context, and saves the old
- * device context state in the passed in TkWinDCState structure.
+ * Sets up the palette for the device context, and saves the old device
+ * context state in the passed in TkWinDCState structure.
*
*----------------------------------------------------------------------
*/
HDC
-TkWinGetDrawableDC(display, d, state)
- Display *display;
- Drawable d;
- TkWinDCState* state;
+TkWinGetDrawableDC(
+ Display *display,
+ Drawable d,
+ TkWinDCState *state)
{
HDC dc;
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
@@ -155,7 +153,7 @@ TkWinGetDrawableDC(display, d, state)
if (twdPtr->type == TWD_WINDOW) {
TkWindow *winPtr = twdPtr->window.winPtr;
-
+
dc = GetDC(twdPtr->window.handle);
if (winPtr == NULL) {
cmap = DefaultColormap(display, DefaultScreen(display));
@@ -192,12 +190,13 @@ TkWinGetDrawableDC(display, d, state)
*/
void
-TkWinReleaseDrawableDC(d, dc, state)
- Drawable d;
- HDC dc;
- TkWinDCState *state;
+TkWinReleaseDrawableDC(
+ Drawable d,
+ HDC dc,
+ TkWinDCState *state)
{
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
+
SetBkMode(dc, state->bkmode);
SelectPalette(dc, state->palette, TRUE);
RealizePalette(dc);
@@ -219,26 +218,26 @@ TkWinReleaseDrawableDC(d, dc, state)
* Returns the converted array of POINTs.
*
* Side effects:
- * Allocates a block of memory in thread local storage that
- * should not be freed.
+ * Allocates a block of memory in thread local storage that should not be
+ * freed.
*
*----------------------------------------------------------------------
*/
static POINT *
-ConvertPoints(points, npoints, mode, bbox)
- XPoint *points;
- int npoints;
- int mode; /* CoordModeOrigin or CoordModePrevious. */
- RECT *bbox; /* Bounding box of points. */
+ConvertPoints(
+ XPoint *points,
+ int npoints,
+ int mode, /* CoordModeOrigin or CoordModePrevious. */
+ RECT *bbox) /* Bounding box of points. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int i;
/*
- * To avoid paying the cost of a malloc on every drawing routine,
- * we reuse the last array if it is large enough.
+ * To avoid paying the cost of a malloc on every drawing routine, we reuse
+ * the last array if it is large enough.
*/
if (npoints > tsdPtr->nWinPoints) {
@@ -255,7 +254,7 @@ ConvertPoints(points, npoints, mode, bbox)
bbox->left = bbox->right = points[0].x;
bbox->top = bbox->bottom = points[0].y;
-
+
if (mode == CoordModeOrigin) {
for (i = 0; i < npoints; i++) {
tsdPtr->winPoints[i].x = points[i].x;
@@ -292,21 +291,20 @@ ConvertPoints(points, npoints, mode, bbox)
* None.
*
* Side effects:
- * Data is moved from a window or bitmap to a second window or
- * bitmap.
+ * Data is moved from a window or bitmap to a second window or bitmap.
*
*----------------------------------------------------------------------
*/
void
-XCopyArea(display, src, dest, gc, src_x, src_y, width, height, dest_x, dest_y)
- Display* display;
- Drawable src;
- Drawable dest;
- GC gc;
- int src_x, src_y;
- unsigned int width, height;
- int dest_x, dest_y;
+XCopyArea(
+ Display *display,
+ Drawable src,
+ Drawable dest,
+ GC gc,
+ int src_x, int src_y,
+ unsigned int width, unsigned int height,
+ int dest_x, int dest_y)
{
HDC srcDC, destDC;
TkWinDCState srcState, destState;
@@ -325,8 +323,8 @@ XCopyArea(display, src, dest, gc, src_x, src_y, width, height, dest_x, dest_y)
OffsetClipRgn(destDC, gc->clip_x_origin, gc->clip_y_origin);
}
- BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y,
- tkpWinBltModes[gc->function]);
+ BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC,
+ src_x, src_y, (DWORD) tkpWinBltModes[gc->function]);
SelectClipRgn(destDC, NULL);
@@ -341,10 +339,9 @@ XCopyArea(display, src, dest, gc, src_x, src_y, width, height, dest_x, dest_y)
*
* XCopyPlane --
*
- * Copies a bitmap from a source drawable to a destination
- * drawable. The plane argument specifies which bit plane of
- * the source contains the bitmap. Note that this implementation
- * ignores the gc->function.
+ * Copies a bitmap from a source drawable to a destination drawable. The
+ * plane argument specifies which bit plane of the source contains the
+ * bitmap. Note that this implementation ignores the gc->function.
*
* Results:
* None.
@@ -356,16 +353,15 @@ XCopyArea(display, src, dest, gc, src_x, src_y, width, height, dest_x, dest_y)
*/
void
-XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
- dest_y, plane)
- Display* display;
- Drawable src;
- Drawable dest;
- GC gc;
- int src_x, src_y;
- unsigned int width, height;
- int dest_x, dest_y;
- unsigned long plane;
+XCopyPlane(
+ Display *display,
+ Drawable src,
+ Drawable dest,
+ GC gc,
+ int src_x, int src_y,
+ unsigned int width, unsigned int height,
+ int dest_x, int dest_y,
+ unsigned long plane)
{
HDC srcDC, destDC;
TkWinDCState srcState, destState;
@@ -375,7 +371,7 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
display->request++;
if (plane != 1) {
- panic("Unexpected plane specified for XCopyPlane");
+ Tcl_Panic("Unexpected plane specified for XCopyPlane");
}
srcDC = TkWinGetDrawableDC(display, src, &srcState);
@@ -387,12 +383,10 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
}
if (clipPtr == NULL || clipPtr->type == TKP_CLIP_REGION) {
-
/*
- * Case 1: opaque bitmaps. Windows handles the conversion
- * from one bit to multiple bits by setting 0 to the
- * foreground color, and 1 to the background color (seems
- * backwards, but there you are).
+ * Case 1: opaque bitmaps. Windows handles the conversion from one bit
+ * to multiple bits by setting 0 to the foreground color, and 1 to the
+ * background color (seems backwards, but there you are).
*/
if (clipPtr && clipPtr->type == TKP_CLIP_REGION) {
@@ -403,8 +397,8 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
SetBkMode(destDC, OPAQUE);
SetBkColor(destDC, gc->foreground);
SetTextColor(destDC, gc->background);
- BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y,
- SRCCOPY);
+ BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC,
+ src_x, src_y, SRCCOPY);
SelectClipRgn(destDC, NULL);
} else if (clipPtr->type == TKP_CLIP_PIXMAP) {
@@ -412,25 +406,24 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
/*
* Case 2: transparent bitmaps are handled by setting the
- * destination to the foreground color whenever the source
- * pixel is set. We need to reset the BkColor and TextColor,
- * because they affect bitmap color mapping.
+ * destination to the foreground color whenever the source pixel
+ * is set.
*/
fgBrush = CreateSolidBrush(gc->foreground);
oldBrush = SelectObject(destDC, fgBrush);
SetBkColor(destDC, RGB(255,255,255));
SetTextColor(destDC, RGB(0,0,0));
- BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y,
- MASKPAT);
+ BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC,
+ src_x, src_y, MASKPAT);
SelectObject(destDC, oldBrush);
DeleteObject(fgBrush);
} else {
/*
- * Case 3: two arbitrary bitmaps. Copy the source rectangle
- * into a color pixmap. Use the result as a brush when
- * copying the clip mask into the destination.
+ * Case 3: two arbitrary bitmaps. Copy the source rectangle into a
+ * color pixmap. Use the result as a brush when copying the clip
+ * mask into the destination.
*/
HDC memDC, maskDC;
@@ -442,36 +435,37 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
maskDC = TkWinGetDrawableDC(display, clipPtr->value.pixmap,
&maskState);
memDC = CreateCompatibleDC(destDC);
- bitmap = CreateBitmap(width, height, 1, 1, NULL);
+ bitmap = CreateBitmap((int) width, (int) height, 1, 1, NULL);
SelectObject(memDC, bitmap);
/*
- * Set foreground bits. We create a new bitmap containing
- * (source AND mask), then use it to set the foreground color
- * into the destination.
+ * Set foreground bits. We create a new bitmap containing (source
+ * AND mask), then use it to set the foreground color into the
+ * destination.
*/
- BitBlt(memDC, 0, 0, width, height, srcDC, src_x, src_y, SRCCOPY);
- BitBlt(memDC, 0, 0, width, height, maskDC,
+ BitBlt(memDC, 0, 0, (int) width, (int) height, srcDC, src_x, src_y,
+ SRCCOPY);
+ BitBlt(memDC, 0, 0, (int) width, (int) height, maskDC,
dest_x - gc->clip_x_origin, dest_y - gc->clip_y_origin,
SRCAND);
oldBrush = SelectObject(destDC, fgBrush);
- BitBlt(destDC, dest_x, dest_y, width, height, memDC, 0, 0,
- MASKPAT);
+ BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, memDC,
+ 0, 0, MASKPAT);
/*
- * Set background bits. Same as foreground, except we use
- * ((NOT source) AND mask) and the background brush.
+ * Set background bits. Same as foreground, except we use ((NOT
+ * source) AND mask) and the background brush.
*/
- BitBlt(memDC, 0, 0, width, height, srcDC, src_x, src_y,
+ BitBlt(memDC, 0, 0, (int) width, (int) height, srcDC, src_x, src_y,
NOTSRCCOPY);
- BitBlt(memDC, 0, 0, width, height, maskDC,
+ BitBlt(memDC, 0, 0, (int) width, (int) height, maskDC,
dest_x - gc->clip_x_origin, dest_y - gc->clip_y_origin,
SRCAND);
SelectObject(destDC, bgBrush);
- BitBlt(destDC, dest_x, dest_y, width, height, memDC, 0, 0,
- MASKPAT);
+ BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, memDC,
+ 0, 0, MASKPAT);
TkWinReleaseDrawableDC(clipPtr->value.pixmap, maskDC, &maskState);
SelectObject(destDC, oldBrush);
@@ -492,8 +486,8 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
*
* TkPutImage --
*
- * Copies a subimage from an in-memory image to a rectangle of
- * of the specified drawable.
+ * Copies a subimage from an in-memory image to a rectangle of of the
+ * specified drawable.
*
* Results:
* None.
@@ -505,19 +499,18 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
*/
void
-TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
- dest_y, width, height)
- unsigned long *colors; /* Array of pixel values used by this
- * image. May be NULL. */
- int ncolors; /* Number of colors used, or 0. */
- Display* display;
- Drawable d; /* Destination drawable. */
- GC gc;
- XImage* image; /* Source image. */
- int src_x, src_y; /* Offset of subimage. */
- int dest_x, dest_y; /* Position of subimage origin in
- * drawable. */
- unsigned int width, height; /* Dimensions of subimage. */
+TkPutImage(
+ unsigned long *colors, /* Array of pixel values used by this image.
+ * May be NULL. */
+ int ncolors, /* Number of colors used, or 0. */
+ Display *display,
+ Drawable d, /* Destination drawable. */
+ GC gc,
+ XImage *image, /* Source image. */
+ int src_x, int src_y, /* Offset of subimage. */
+ int dest_x, int dest_y, /* Position of subimage origin in drawable. */
+ unsigned int width, unsigned int height)
+ /* Dimensions of subimage. */
{
HDC dc, dcMem;
TkWinDCState state;
@@ -533,8 +526,8 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
if (image->bits_per_pixel == 1) {
/*
- * If the image isn't in the right format, we have to copy
- * it into a new buffer in MSBFirst and word-aligned format.
+ * If the image isn't in the right format, we have to copy it into a
+ * new buffer in MSBFirst and word-aligned format.
*/
if ((image->bitmap_bit_order != MSBFirst)
@@ -548,22 +541,22 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
}
SetTextColor(dc, gc->foreground);
SetBkColor(dc, gc->background);
- } else {
+ } else {
int i, usePalette;
/*
* Do not use a palette for TrueColor images.
*/
-
+
usePalette = (image->bits_per_pixel < 16);
-
+
if (usePalette) {
- infoPtr = (BITMAPINFO*) ckalloc(sizeof(BITMAPINFOHEADER)
+ infoPtr = (BITMAPINFO *) ckalloc(sizeof(BITMAPINFOHEADER)
+ sizeof(RGBQUAD)*ncolors);
} else {
- infoPtr = (BITMAPINFO*) ckalloc(sizeof(BITMAPINFOHEADER));
+ infoPtr = (BITMAPINFO *) ckalloc(sizeof(BITMAPINFOHEADER));
}
-
+
infoPtr->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
infoPtr->bmiHeader.biWidth = image->width;
infoPtr->bmiHeader.biHeight = -image->height; /* Top-down order */
@@ -590,14 +583,15 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
image->data, infoPtr, DIB_RGB_COLORS);
ckfree((char *) infoPtr);
}
- if(!bitmap) {
- panic("Fail to allocate bitmap\n");
+ if (!bitmap) {
+ Tcl_Panic("Fail to allocate bitmap\n");
DeleteDC(dcMem);
TkWinReleaseDrawableDC(d, dc, &state);
return;
}
bitmap = SelectObject(dcMem, bitmap);
- BitBlt(dc, dest_x, dest_y, width, height, dcMem, src_x, src_y, SRCCOPY);
+ BitBlt(dc, dest_x, dest_y, (int) width, (int) height, dcMem, src_x, src_y,
+ SRCCOPY);
DeleteObject(SelectObject(dcMem, bitmap));
DeleteDC(dcMem);
TkWinReleaseDrawableDC(d, dc, &state);
@@ -620,12 +614,12 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
*/
void
-XFillRectangles(display, d, gc, rectangles, nrectangles)
- Display* display;
- Drawable d;
- GC gc;
- XRectangle* rectangles;
- int nrectangles;
+XFillRectangles(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XRectangle *rectangles,
+ int nrectangles)
{
HDC dc;
int i;
@@ -651,13 +645,13 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
HBRUSH bgBrush = CreateSolidBrush(gc->background);
if (twdPtr->type != TWD_BITMAP) {
- panic("unexpected drawable type in stipple");
+ Tcl_Panic("unexpected drawable type in stipple");
}
/*
* Select stipple pattern into destination dc.
*/
-
+
stipple = CreatePatternBrush(twdPtr->bitmap.handle);
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
oldBrush = SelectObject(dc, stipple);
@@ -665,7 +659,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
/*
* For each rectangle, create a drawing surface which is the size of
- * the rectangle and fill it with the background color. Then merge the
+ * the rectangle and fill it with the background color. Then merge the
* result with the stipple pattern.
*/
@@ -689,7 +683,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
SelectObject(dcMem, oldBitmap);
DeleteObject(bitmap);
}
-
+
DeleteDC(dcMem);
SelectObject(dc, oldBrush);
DeleteObject(stipple);
@@ -707,7 +701,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
HPEN oldPen = SelectObject(dc, newPen);
oldBrush = SelectObject(dc, brush);
-
+
for (i = 0; i < nrectangles; i++) {
Rectangle(dc, rectangles[i].x, rectangles[i].y,
rectangles[i].x + rectangles[i].width + 1,
@@ -728,8 +722,8 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
*
* RenderObject --
*
- * This function draws a shape using a list of points, a
- * stipple pattern, and the specified drawing function.
+ * This function draws a shape using a list of points, a stipple pattern,
+ * and the specified drawing function.
*
* Results:
* None.
@@ -741,20 +735,20 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
*/
static void
-RenderObject(dc, gc, points, npoints, mode, pen, func)
- HDC dc;
- GC gc;
- XPoint* points;
- int npoints;
- int mode;
- HPEN pen;
- WinDrawFunc func;
+RenderObject(
+ HDC dc,
+ GC gc,
+ XPoint *points,
+ int npoints,
+ int mode,
+ HPEN pen,
+ WinDrawFunc func)
{
RECT rect = {0, 0, 0, 0};
HPEN oldPen;
HBRUSH oldBrush;
POINT *winPoints = ConvertPoints(points, npoints, mode, &rect);
-
+
if ((gc->fill_style == FillStippled
|| gc->fill_style == FillOpaqueStippled)
&& gc->stipple != None) {
@@ -765,9 +759,9 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
HBITMAP oldBitmap;
int i;
HBRUSH oldMemBrush;
-
+
if (twdPtr->type != TWD_BITMAP) {
- panic("unexpected drawable type in stipple");
+ Tcl_Panic("unexpected drawable type in stipple");
}
/*
@@ -785,7 +779,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
/*
* Select stipple pattern into destination dc.
*/
-
+
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
oldBrush = SelectObject(dc, CreatePatternBrush(twdPtr->bitmap.handle));
@@ -793,7 +787,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
* Create temporary drawing surface containing a copy of the
* destination equal in size to the bounding box of the object.
*/
-
+
dcMem = CreateCompatibleDC(dc);
oldBitmap = SelectObject(dcMem, CreateCompatibleBitmap(dc, width,
height));
@@ -802,7 +796,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
/*
* Translate the object for rendering in the temporary drawing
- * surface.
+ * surface.
*/
for (i = 0; i < npoints; i++) {
@@ -823,8 +817,8 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
/*
* If we are rendering an opaque stipple, then draw the polygon in the
- * background color and copy it to the destination wherever the pattern
- * is clear.
+ * background color and copy it to the destination wherever the
+ * pattern is clear.
*/
if (gc->fill_style == FillOpaqueStippled) {
@@ -871,18 +865,18 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
*/
void
-XDrawLines(display, d, gc, points, npoints, mode)
- Display* display;
- Drawable d;
- GC gc;
- XPoint* points;
- int npoints;
- int mode;
+XDrawLines(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XPoint *points,
+ int npoints,
+ int mode)
{
HPEN pen;
TkWinDCState state;
HDC dc;
-
+
if (d == None) {
return;
}
@@ -893,7 +887,7 @@ XDrawLines(display, d, gc, points, npoints, mode)
SetBkMode(dc, TRANSPARENT);
RenderObject(dc, gc, points, npoints, mode, pen, Polyline);
DeleteObject(pen);
-
+
TkWinReleaseDrawableDC(d, dc, &state);
}
@@ -914,14 +908,14 @@ XDrawLines(display, d, gc, points, npoints, mode)
*/
void
-XFillPolygon(display, d, gc, points, npoints, shape, mode)
- Display* display;
- Drawable d;
- GC gc;
- XPoint* points;
- int npoints;
- int shape;
- int mode;
+XFillPolygon(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XPoint *points,
+ int npoints,
+ int shape,
+ int mode)
{
HPEN pen;
TkWinDCState state;
@@ -956,14 +950,12 @@ XFillPolygon(display, d, gc, points, npoints, shape, mode)
*/
void
-XDrawRectangle(display, d, gc, x, y, width, height)
- Display* display;
- Drawable d;
- GC gc;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
+XDrawRectangle(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x, int y,
+ unsigned int width, unsigned int height)
{
HPEN pen, oldPen;
TkWinDCState state;
@@ -982,7 +974,7 @@ XDrawRectangle(display, d, gc, x, y, width, height)
oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
SetROP2(dc, tkpWinRopModes[gc->function]);
- Rectangle(dc, x, y, x+width+1, y+height+1);
+ Rectangle(dc, x, y, (int) x+width+1, (int) y+height+1);
DeleteObject(SelectObject(dc, oldPen));
SelectObject(dc, oldBrush);
@@ -1006,16 +998,13 @@ XDrawRectangle(display, d, gc, x, y, width, height)
*/
void
-XDrawArc(display, d, gc, x, y, width, height, start, extent)
- Display* display;
- Drawable d;
- GC gc;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
- int start;
- int extent;
+XDrawArc(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ int start, int extent)
{
display->request++;
@@ -1039,16 +1028,13 @@ XDrawArc(display, d, gc, x, y, width, height, start, extent)
*/
void
-XFillArc(display, d, gc, x, y, width, height, start, extent)
- Display* display;
- Drawable d;
- GC gc;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
- int start;
- int extent;
+XFillArc(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ int start, int extent)
{
display->request++;
@@ -1060,8 +1046,8 @@ XFillArc(display, d, gc, x, y, width, height, start, extent)
*
* DrawOrFillArc --
*
- * This procedure handles the rendering of drawn or filled
- * arcs and chords.
+ * This function handles the rendering of drawn or filled arcs and
+ * chords.
*
* Results:
* None.
@@ -1073,15 +1059,15 @@ XFillArc(display, d, gc, x, y, width, height, start, extent)
*/
static void
-DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, fill)
- Display *display;
- Drawable d;
- GC gc;
- int x, y; /* left top */
- unsigned int width, height;
- int start; /* start: three-o'clock (deg*64) */
- int extent; /* extent: relative (deg*64) */
- int fill; /* ==0 draw, !=0 fill */
+DrawOrFillArc(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x, int y, /* left top */
+ unsigned int width, unsigned int height,
+ int start, /* start: three-o'clock (deg*64) */
+ int extent, /* extent: relative (deg*64) */
+ int fill) /* ==0 draw, !=0 fill */
{
HDC dc;
HBRUSH brush, oldBrush;
@@ -1122,7 +1108,7 @@ DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, fill)
/*
* Now compute points on the radial lines that define the starting and
- * ending angles. Be sure to take into account that the y-coordinate
+ * ending angles. Be sure to take into account that the y-coordinate
* system is inverted.
*/
@@ -1134,29 +1120,32 @@ DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, fill)
yend = (int)((yr + sin(-radian_end)*height/2.0) + 0.5);
/*
- * Now draw a filled or open figure. Note that we have to
- * increase the size of the bounding box by one to account for the
- * difference in pixel definitions between X and Windows.
+ * Now draw a filled or open figure. Note that we have to increase the
+ * size of the bounding box by one to account for the difference in pixel
+ * definitions between X and Windows.
*/
pen = SetUpGraphicsPort(gc);
oldPen = SelectObject(dc, pen);
if (!fill) {
/*
- * Note that this call will leave a gap of one pixel at the
- * end of the arc for thin arcs. We can't use ArcTo because
- * it's only supported under Windows NT.
+ * Note that this call will leave a gap of one pixel at the end of the
+ * arc for thin arcs. We can't use ArcTo because it's only supported
+ * under Windows NT.
*/
SetBkMode(dc, TRANSPARENT);
- Arc(dc, x, y, x+width+1, y+height+1, xstart, ystart, xend, yend);
+ Arc(dc, x, y, (int) (x+width+1), (int) (y+height+1), xstart, ystart,
+ xend, yend);
} else {
brush = CreateSolidBrush(gc->foreground);
oldBrush = SelectObject(dc, brush);
if (gc->arc_mode == ArcChord) {
- Chord(dc, x, y, x+width+1, y+height+1, xstart, ystart, xend, yend);
- } else if ( gc->arc_mode == ArcPieSlice ) {
- Pie(dc, x, y, x+width+1, y+height+1, xstart, ystart, xend, yend);
+ Chord(dc, x, y, (int) (x+width+1), (int) (y+height+1),
+ xstart, ystart, xend, yend);
+ } else if (gc->arc_mode == ArcPieSlice) {
+ Pie(dc, x, y, (int) (x+width+1), (int) (y+height+1),
+ xstart, ystart, xend, yend);
}
DeleteObject(SelectObject(dc, oldBrush));
}
@@ -1181,8 +1170,8 @@ DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, fill)
*/
static HPEN
-SetUpGraphicsPort(gc)
- GC gc;
+SetUpGraphicsPort(
+ GC gc)
{
DWORD style;
@@ -1191,10 +1180,9 @@ SetUpGraphicsPort(gc)
/* pointer to the dash-list */
/*
- * Below is a simple translation of serveral dash patterns
- * to valid windows pen types. Far from complete,
- * but I don't know how to do it better.
- * Any ideas: <mailto:j.nijtmans@chello.nl>
+ * Below is a simple translation of serveral dash patterns to valid
+ * windows pen types. Far from complete, but I don't know how to do it
+ * better. Any ideas: <mailto:j.nijtmans@chello.nl>
*/
if (p[1] && p[2]) {
@@ -1214,7 +1202,7 @@ SetUpGraphicsPort(gc)
style = PS_SOLID;
}
if (gc->line_width < 2) {
- return CreatePen(style, gc->line_width, gc->foreground);
+ return CreatePen((int) style, gc->line_width, gc->foreground);
} else {
LOGBRUSH lb;
@@ -1224,29 +1212,29 @@ SetUpGraphicsPort(gc)
style |= PS_GEOMETRIC;
switch (gc->cap_style) {
- case CapNotLast:
- case CapButt:
- style |= PS_ENDCAP_FLAT;
- break;
- case CapRound:
- style |= PS_ENDCAP_ROUND;
- break;
- default:
- style |= PS_ENDCAP_SQUARE;
- break;
+ case CapNotLast:
+ case CapButt:
+ style |= PS_ENDCAP_FLAT;
+ break;
+ case CapRound:
+ style |= PS_ENDCAP_ROUND;
+ break;
+ default:
+ style |= PS_ENDCAP_SQUARE;
+ break;
}
switch (gc->join_style) {
- case JoinMiter:
- style |= PS_JOIN_MITER;
- break;
- case JoinRound:
- style |= PS_JOIN_ROUND;
- break;
- default:
- style |= PS_JOIN_BEVEL;
- break;
+ case JoinMiter:
+ style |= PS_JOIN_MITER;
+ break;
+ case JoinRound:
+ style |= PS_JOIN_ROUND;
+ break;
+ default:
+ style |= PS_JOIN_BEVEL;
+ break;
}
- return ExtCreatePen(style, gc->line_width, &lb, 0, NULL);
+ return ExtCreatePen(style, (DWORD) gc->line_width, &lb, 0, NULL);
}
}
@@ -1255,13 +1243,13 @@ SetUpGraphicsPort(gc)
*
* TkScrollWindow --
*
- * Scroll a rectangle of the specified window and accumulate
- * a damage region.
+ * Scroll a rectangle of the specified window and accumulate a damage
+ * region.
*
* Results:
- * Returns 0 if the scroll genereated no additional damage.
- * Otherwise, sets the region that needs to be repainted after
- * scrolling and returns 1.
+ * Returns 0 if the scroll genereated no additional damage. Otherwise,
+ * sets the region that needs to be repainted after scrolling and returns
+ * 1.
*
* Side effects:
* Scrolls the bits in the window.
@@ -1270,12 +1258,13 @@ SetUpGraphicsPort(gc)
*/
int
-TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
- Tk_Window tkwin; /* The window to be scrolled. */
- GC gc; /* GC for window to be scrolled. */
- int x, y, width, height; /* Position rectangle to be scrolled. */
- int dx, dy; /* Distance rectangle should be moved. */
- TkRegion damageRgn; /* Region to accumulate damage in. */
+TkScrollWindow(
+ Tk_Window tkwin, /* The window to be scrolled. */
+ GC gc, /* GC for window to be scrolled. */
+ int x, int y, int width, int height,
+ /* Position rectangle to be scrolled. */
+ int dx, int dy, /* Distance rectangle should be moved. */
+ TkRegion damageRgn) /* Region to accumulate damage in. */
{
HWND hwnd = TkWinGetHWND(Tk_WindowId(tkwin));
RECT scrollRect;
@@ -1293,9 +1282,9 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
*
* TkWinFillRect --
*
- * This routine fills a rectangle with the foreground color
- * from the specified GC ignoring all other GC values. This
- * is the fastest way to fill a drawable with a solid color.
+ * This routine fills a rectangle with the foreground color from the
+ * specified GC ignoring all other GC values. This is the fastest way to
+ * fill a drawable with a solid color.
*
* Results:
* None.
@@ -1307,10 +1296,10 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
*/
void
-TkWinFillRect(dc, x, y, width, height, pixel)
- HDC dc;
- int x, y, width, height;
- int pixel;
+TkWinFillRect(
+ HDC dc,
+ int x, int y, int width, int height,
+ int pixel)
{
RECT rect;
COLORREF oldColor;
@@ -1330,30 +1319,30 @@ TkWinFillRect(dc, x, y, width, height, pixel)
*
* TkpDrawHighlightBorder --
*
- * This procedure draws a rectangular ring around the outside of
- * a widget to indicate that it has received the input focus.
+ * This function draws a rectangular ring around the outside of a widget
+ * to indicate that it has received the input focus.
*
- * On Windows, we just draw the simple inset ring. On other sytems,
- * e.g. the Mac, the focus ring is a little more complicated, so we
- * need this abstraction.
+ * On Windows, we just draw the simple inset ring. On other sytems, e.g.
+ * the Mac, the focus ring is a little more complicated, so we need this
+ * abstraction.
*
* Results:
* None.
*
* Side effects:
- * A rectangle "width" pixels wide is drawn in "drawable",
- * corresponding to the outer area of "tkwin".
+ * A rectangle "width" pixels wide is drawn in "drawable", corresponding
+ * to the outer area of "tkwin".
*
*----------------------------------------------------------------------
*/
-void
-TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
- Tk_Window tkwin;
- GC fgGC;
- GC bgGC;
- int highlightWidth;
- Drawable drawable;
+void
+TkpDrawHighlightBorder(
+ Tk_Window tkwin,
+ GC fgGC,
+ GC bgGC,
+ int highlightWidth,
+ Drawable drawable)
{
TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
@@ -1363,7 +1352,7 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
*
* TkpDrawFrame --
*
- * This procedure draws the rectangular frame area.
+ * This function draws the rectangular frame area.
*
* Results:
* None.
@@ -1375,12 +1364,22 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
*/
void
-TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
- int highlightWidth, int borderWidth, int relief)
+TkpDrawFrame(
+ Tk_Window tkwin,
+ Tk_3DBorder border,
+ int highlightWidth,
+ int borderWidth,
+ int relief)
{
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
- border, highlightWidth, highlightWidth,
- Tk_Width(tkwin) - 2 * highlightWidth,
- Tk_Height(tkwin) - 2 * highlightWidth,
- borderWidth, relief);
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
+ highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index d0e0c05..b7f5085 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinEmbed.c --
*
* This file contains platform specific procedures for Windows platforms
@@ -8,54 +8,51 @@
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
-
/*
* One of the following structures exists for each container in this
- * application. It keeps track of the container window and its
- * associated embedded window.
+ * application. It keeps track of the container window and its associated
+ * embedded window.
*/
typedef struct Container {
- HWND parentHWnd; /* Windows HWND to the parent window */
- TkWindow *parentPtr; /* Tk's information about the container
- * or NULL if the container isn't
- * in this process. */
- HWND embeddedHWnd; /* Windows HWND to the embedded window
- */
- TkWindow *embeddedPtr; /* Tk's information about the embedded
- * window, or NULL if the
- * embedded application isn't in
- * this process. */
- struct Container *nextPtr; /* Next in list of all containers in
- * this process. */
+ HWND parentHWnd; /* Windows HWND to the parent window */
+ TkWindow *parentPtr; /* Tk's information about the container or
+ * NULL if the container isn't in this
+ * process. */
+ HWND embeddedHWnd; /* Windows HWND to the embedded window. */
+ TkWindow *embeddedPtr; /* Tk's information about the embedded window,
+ * or NULL if the embedded application isn't
+ * in this process. */
+ HWND embeddedMenuHWnd; /* Tk's embedded menu window handler. */
+ struct Container *nextPtr; /* Next in list of all containers in this
+ * process. */
} Container;
typedef struct ThreadSpecificData {
- Container *firstContainerPtr; /* First in list of all containers
- * managed by this process. */
+ Container *firstContainerPtr;
+ /* First in list of all containers managed by
+ * this process. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-static void CleanupContainerList _ANSI_ARGS_((
- ClientData clientData));
-static void ContainerEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbeddedEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void EmbedGeometryRequest _ANSI_ARGS_((
- Container*containerPtr, int width, int height));
-static void EmbedWindowDeleted _ANSI_ARGS_((TkWindow *winPtr));
+static void ContainerEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbedGeometryRequest(Container *containerPtr,
+ int width, int height);
+static void EmbedWindowDeleted(TkWindow *winPtr);
+static void Tk_MapEmbeddedWindow(TkWindow* winPtr);
+HWND Tk_GetEmbeddedHWnd(TkWindow* winPtr);
/*
*----------------------------------------------------------------------
*
- * CleanupContainerList --
+ * TkWinCleanupContainerList --
*
* Finalizes the list of containers.
*
@@ -68,20 +65,17 @@ static void EmbedWindowDeleted _ANSI_ARGS_((TkWindow *winPtr));
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
-static void
-CleanupContainerList(clientData)
- ClientData clientData;
+void
+TkWinCleanupContainerList(void)
{
Container *nextPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- for (;
- tsdPtr->firstContainerPtr != (Container *) NULL;
- tsdPtr->firstContainerPtr = nextPtr) {
- nextPtr = tsdPtr->firstContainerPtr->nextPtr;
- ckfree((char *) tsdPtr->firstContainerPtr);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ for (; tsdPtr->firstContainerPtr != (Container *) NULL;
+ tsdPtr->firstContainerPtr = nextPtr) {
+ nextPtr = tsdPtr->firstContainerPtr->nextPtr;
+ ckfree((char *) tsdPtr->firstContainerPtr);
}
tsdPtr->firstContainerPtr = (Container *) NULL;
}
@@ -104,11 +98,11 @@ CleanupContainerList(clientData)
/* ARGSUSED */
int
-TkpTestembedCmd(clientData, interp, argc, argv)
- ClientData clientData;
- Tcl_Interp *interp;
- int argc;
- CONST char **argv;
+TkpTestembedCmd(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ CONST char **argv)
{
return TCL_OK;
}
@@ -116,19 +110,113 @@ TkpTestembedCmd(clientData, interp, argc, argv)
/*
*----------------------------------------------------------------------
*
+ * Tk_DetachEmbeddedWindow --
+ *
+ * This function detaches an embedded window
+ *
+ * Results:
+ * No return value. Detach the embedded window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static
+void
+Tk_DetachEmbeddedWindow(
+ TkWindow *winPtr, /* an embedded window */
+ BOOL detachFlag) /* a flag of truely detaching */
+{
+ TkpWinToplevelDetachWindow(winPtr);
+ if(detachFlag) {
+ TkpWinToplevelOverrideRedirect(winPtr, 0);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MapEmbeddedWindow --
+ *
+ * This function is required for mapping an embedded window during idle.
+ * The input winPtr must be preserved using Tcl_Preserve before call this
+ * function and will be released by this function.
+ *
+ * Results:
+ * No return value. Map the embedded window if it is not dead.
+ *
+ * Side effects:
+ * The embedded window may change its state as the container's.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static
+void Tk_MapEmbeddedWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
+{
+ if(!(winPtr->flags & TK_ALREADY_DEAD)) {
+ HWND hwnd = (HWND)winPtr->privatePtr;
+ int state = SendMessage(hwnd, TK_STATE, -1, -1) - 1;
+
+ if (state < 0 || state > 3) {
+ state = NormalState;
+ }
+
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {
+ /* empty body */
+ }
+
+ TkpWmSetState(winPtr, state);
+ TkWmMapWindow(winPtr);
+ }
+ Tcl_Release((ClientData)winPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpUseWindow --
*
- * This procedure causes a Tk window to use a given Windows handle
- * for a window as its underlying window, rather than a new Windows
- * window being created automatically. It is invoked by an embedded
- * application to specify the window in which the application is
- * embedded.
+ * This procedure causes a Tk window to use a given Windows handle for a
+ * window as its underlying window, rather than a new Windows window
+ * being created automatically. It is invoked by an embedded application
+ * to specify the window in which the application is embedded.
+ *
+ * This procedure uses a simple attachment protocol by sending TK_INFO
+ * messages to the window to use with two sub messages:
+ *
+ * TK_CONTAINER_VERIFY - if a window handles this message, it should
+ * return either a (long)hwnd for a container or a -(long)hwnd
+ * for a non-container.
+ *
+ * TK_CONTAINER_ISAVAILABLE - a container window should return either
+ * a TRUE (non-zero) if it is available for use or a FALSE (zero)
+ * othersize.
+ *
+ * The TK_INFO messages are required in order to verify if the window to
+ * use is a valid container. Without an id verification, an invalid
+ * window attachment may cause unexpected crashes/panics (bug 1096074).
+ * Additional sub messages may be definded/used in future for other
+ * needs.
+ *
+ * We do not enforce the above protocol for the reason of backward
+ * compatibility. If the window to use is unable to handle TK_INFO
+ * messages (e.g., legacy Tk container applications before 8.5), a dialog
+ * box with a warning message pops up and the user is asked to confirm if
+ * the attachment should proceed. However, we may have to enforce it in
+ * future.
*
* Results:
- * The return value is normally TCL_OK. If an error occurred (such as
- * if the argument does not identify a legal Windows window handle),
- * the return value is TCL_ERROR and an error message is left in the
- * the interp's result if interp is not NULL.
+ * The return value is normally TCL_OK. If an error occurred (such as if
+ * the argument does not identify a legal Windows window handle or it is
+ * already in use or a cancel button is pressed by a user in confirming
+ * the use window as a Tk container) the return value is TCL_ERROR and an
+ * error message is left in the the interp's result if interp is not
+ * NULL.
*
* Side effects:
* None.
@@ -136,31 +224,45 @@ TkpTestembedCmd(clientData, interp, argc, argv)
*----------------------------------------------------------------------
*/
-int
-TkpUseWindow(interp, tkwin, string)
- Tcl_Interp *interp; /* If not NULL, used for error reporting
- * if string is bogus. */
- Tk_Window tkwin; /* Tk window that does not yet have an
+int
+TkpUseWindow(
+ Tcl_Interp *interp, /* If not NULL, used for error reporting if
+ * string is bogus. */
+ Tk_Window tkwin, /* Tk window that does not yet have an
* associated X window. */
- CONST char *string; /* String identifying an X window to use
- * for tkwin; must be an integer value. */
+ CONST char *string) /* String identifying an X window to use for
+ * tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
- TkWindow *usePtr;
int id;
HWND hwnd;
- Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+/*
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+*/
+/*
if (winPtr->window != None) {
- panic("TkpUseWindow: Already assigned a window");
+ Tcl_AppendResult(interp,
+ "can't modify container after widget is created", NULL);
+ return TCL_ERROR;
+ }
+*/
+
+ if (strcmp(string, "") == 0) {
+ if (winPtr->flags & TK_EMBEDDED) {
+ Tk_DetachEmbeddedWindow(winPtr, TRUE);
+ }
+ return TCL_OK;
}
if (Tcl_GetInt(interp, string, &id) != TCL_OK) {
- return TCL_ERROR;
+ return TCL_ERROR;
+ }
+ hwnd = (HWND) INT2PTR(id);
+ if ((HWND)winPtr->privatePtr == hwnd) {
+ return TCL_OK;
}
- hwnd = (HWND) id;
/*
* Check if the window is a valid handle. If it is invalid, return
@@ -169,81 +271,58 @@ TkpUseWindow(interp, tkwin, string)
*/
if (!IsWindow(hwnd)) {
- if (interp != (Tcl_Interp *) NULL) {
- Tcl_AppendResult(interp, "window \"", string,
- "\" doesn't exist", (char *) NULL);
- }
- return TCL_ERROR;
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "window \"", string,
+ "\" doesn't exist", NULL);
+ }
+ return TCL_ERROR;
}
- usePtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
- if (usePtr != NULL) {
- if (!(usePtr->flags & TK_CONTAINER)) {
- Tcl_AppendResult(interp, "window \"", usePtr->pathName,
- "\" doesn't have -container option set", (char *) NULL);
+ id = SendMessage(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0);
+ if (id == PTR2INT(hwnd)) {
+ if (!SendMessage(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
+ Tcl_AppendResult(interp, "The container is already in use", NULL);
+ return TCL_ERROR;
+ }
+ } else if (id == -PTR2INT(hwnd)) {
+ Tcl_AppendResult(interp, "the window to use is not a Tk container",
+ NULL);
+ return TCL_ERROR;
+ } else {
+ /*
+ * Proceed if the user decide to do so because it can be a legacy
+ * container application. However we may have to return a TCL_ERROR in
+ * order to avoid bug 1096074 in future.
+ */
+
+ char msg[256];
+
+ sprintf(msg, "Unable to get information of window \"%.80s\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string);
+ if (IDCANCEL == MessageBox(hwnd, msg, "Tk Warning",
+ MB_OKCANCEL | MB_ICONWARNING)) {
+ Tcl_SetResult(interp, "Operation has been canceled", TCL_STATIC);
return TCL_ERROR;
}
}
+ Tk_DetachEmbeddedWindow(winPtr, FALSE);
+
/*
* Store the parent window in the platform private data slot so
* TkWmMapWindow can use it when creating the wrapper window.
*/
winPtr->privatePtr = (struct TkWindowPrivate*) hwnd;
+ winPtr->flags |= TK_EMBEDDED;
+ winPtr->flags &= ~(TK_MAPPED);
/*
- * Create an event handler to clean up the Container structure when
- * tkwin is eventually deleted.
- */
-
- Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
- (ClientData) winPtr);
-
- /*
- * If this is the first container, register an exit handler so that
- * things will get cleaned up at finalization.
- */
-
- if (tsdPtr->firstContainerPtr == (Container *) NULL) {
- TkCreateExitHandler(CleanupContainerList, (ClientData) NULL);
- }
-
- /*
- * Save information about the container and the embedded window
- * in a Container structure. If there is already an existing
- * Container structure, it means that both container and embedded
- * app. are in the same process.
+ * Preserve the winPtr and create an idle handler to map the embedded
+ * window.
*/
- for (containerPtr = tsdPtr->firstContainerPtr;
- containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
- if (containerPtr->parentHWnd == hwnd) {
- winPtr->flags |= TK_BOTH_HALVES;
- containerPtr->parentPtr->flags |= TK_BOTH_HALVES;
- break;
- }
- }
- if (containerPtr == NULL) {
- containerPtr = (Container *) ckalloc(sizeof(Container));
- containerPtr->parentPtr = NULL;
- containerPtr->parentHWnd = hwnd;
- containerPtr->nextPtr = tsdPtr->firstContainerPtr;
- tsdPtr->firstContainerPtr = containerPtr;
- }
-
- /*
- * embeddedHWnd is not created yet. It will be created by TkWmMapWindow(),
- * which will send a TK_ATTACHWINDOW to the container window.
- * TkWinEmbeddedEventProc will process this message and set the embeddedHWnd
- * variable
- */
-
- containerPtr->embeddedPtr = winPtr;
- containerPtr->embeddedHWnd = NULL;
-
- winPtr->flags |= TK_EMBEDDED;
- winPtr->flags &= (~(TK_MAPPED));
+ Tcl_Preserve((ClientData) winPtr);
+ Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, (ClientData) winPtr);
return TCL_OK;
}
@@ -253,10 +332,10 @@ TkpUseWindow(interp, tkwin, string)
*
* TkpMakeContainer --
*
- * This procedure is called to indicate that a particular window will
- * be a container for an embedded application. This changes certain
- * aspects of the window's behavior, such as whether it will receive
- * events anymore.
+ * This procedure is called to indicate that a particular window will be
+ * a container for an embedded application. This changes certain aspects
+ * of the window's behavior, such as whether it will receive events
+ * anymore.
*
* Results:
* None.
@@ -268,26 +347,17 @@ TkpUseWindow(interp, tkwin, string)
*/
void
-TkpMakeContainer(tkwin)
- Tk_Window tkwin;
+TkpMakeContainer(
+ Tk_Window tkwin)
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * If this is the first container, register an exit handler so that
- * things will get cleaned up at finalization.
- */
-
- if (tsdPtr->firstContainerPtr == (Container *) NULL) {
- TkCreateExitHandler(CleanupContainerList, (ClientData) NULL);
- }
-
- /*
- * Register the window as a container so that, for example, we can
- * find out later if the embedded app. is in the same process.
+ * Register the window as a container so that, for example, we can find
+ * out later if the embedded app. is in the same process.
*/
Tk_MakeWindowExist(tkwin);
@@ -296,54 +366,23 @@ TkpMakeContainer(tkwin)
containerPtr->parentHWnd = Tk_GetHWND(Tk_WindowId(tkwin));
containerPtr->embeddedHWnd = NULL;
containerPtr->embeddedPtr = NULL;
+ containerPtr->embeddedMenuHWnd = NULL;
containerPtr->nextPtr = tsdPtr->firstContainerPtr;
tsdPtr->firstContainerPtr = containerPtr;
winPtr->flags |= TK_CONTAINER;
/*
- * Unlike in tkUnixEmbed.c, we don't make any requests for events
- * in the embedded window here. Now we just allow the embedding
- * of another TK application into TK windows. When the embedded
- * window makes a request, that will be done by sending to the
- * container window a WM_USER message, which will be intercepted
- * by TkWinContainerProc.
+ * Unlike in tkUnixEmbed.c, we don't make any requests for events in the
+ * embedded window here. Now we just allow the embedding of another TK
+ * application into TK windows. When the embedded window makes a request,
+ * that will be done by sending to the container window a WM_USER message,
+ * which will be intercepted by TkWinContainerProc.
*
* We need to get structure events of the container itself, though.
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- ContainerEventProc, (ClientData) containerPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmbeddedEventProc --
- *
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for a window that is embedded in
- * another application.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Our internal state gets cleaned up when an embedded window is
- * destroyed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbeddedEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
-{
- TkWindow *winPtr = (TkWindow *) clientData;
-
- if (eventPtr->type == DestroyNotify) {
- EmbedWindowDeleted(winPtr);
- }
+ ContainerEventProc, (ClientData) containerPtr);
}
/*
@@ -351,32 +390,32 @@ EmbeddedEventProc(clientData, eventPtr)
*
* TkWinEmbeddedEventProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * various useful events are received for the *children* of a
- * container window. It forwards relevant information, such as
- * geometry requests, from the events into the container's
- * application.
+ * This procedure is invoked by the Tk event dispatcher when various
+ * useful events are received for the *children* of a container window.
+ * It forwards relevant information, such as geometry requests, from the
+ * events into the container's application.
*
* Results:
* None.
*
* Side effects:
- * Depends on the event. For example, when ConfigureRequest events
- * occur, geometry information gets set for the container window.
+ * Depends on the event. For example, when ConfigureRequest events occur,
+ * geometry information gets set for the container window.
*
*----------------------------------------------------------------------
*/
LRESULT
-TkWinEmbeddedEventProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+TkWinEmbeddedEventProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
+ int result = 1;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Find the Container structure associated with the parent window.
@@ -388,29 +427,345 @@ TkWinEmbeddedEventProc(hwnd, message, wParam, lParam)
/* empty loop body */
}
- if (containerPtr == NULL) {
- Tcl_Panic("TkWinContainerProc couldn't find Container record");
- }
+ if (containerPtr) {
+ TkWindow *topwinPtr = NULL;
+ if(Tk_IsTopLevel(containerPtr->parentPtr)) {
+ topwinPtr = containerPtr->parentPtr;
+ }
+ switch (message) {
+ case TK_INFO:
+ /*
+ * An embedded window may send this message for container
+ * verification and availability before attach.
+ *
+ * wParam - a sub message
+ *
+ * TK_CONTAINER_ISAVAILABLE - if the container is available
+ * for use?
+ * result = 1 for yes and 0 for no;
+ *
+ * TK_CONTAINER_VERIFY - request the container to verify its
+ * identification
+ * result = (long)hwnd if this window is a container
+ * -(long)hwnd otherwise
+ *
+ * lParam - N/A
+ */
- switch (message) {
- case TK_ATTACHWINDOW:
- /* An embedded window (either from this application or from
- * another application) is trying to attach to this container.
- * We attach it only if this container is not yet containing any
- * window.
- */
- if (containerPtr->embeddedHWnd == NULL) {
- containerPtr->embeddedHWnd = (HWND)wParam;
- } else {
- return 0;
+ switch(wParam) {
+ case TK_CONTAINER_ISAVAILABLE:
+ result = containerPtr->embeddedHWnd == NULL? 1:0;
+ break;
+ case TK_CONTAINER_VERIFY:
+ result = PTR2INT(containerPtr->parentHWnd);
+ break;
+ default:
+ result = 0;
+ }
+ break;
+
+ case TK_ATTACHWINDOW:
+ /*
+ * An embedded window (either from this application or from
+ * another application) is trying to attach to this container. We
+ * attach it only if this container is not yet containing any
+ * window.
+ *
+ * wParam - a handle of an embedded window
+ * lParam - N/A
+ *
+ * An embedded window may send this message with a wParam of NULL
+ * to test if a window is able to provide embedding service. The
+ * container returns its window handle for accepting the
+ * attachment and identifying itself or a zero for being already
+ * in use.
+ *
+ * Return value:
+ * 0 - the container is unable to be used.
+ * hwnd - the container is ready to be used.
+ */
+ if (containerPtr->embeddedHWnd == NULL) {
+ if (wParam) {
+ TkWindow *winPtr = (TkWindow *)
+ Tk_HWNDToWindow((HWND) wParam);
+ if (winPtr) {
+ winPtr->flags |= TK_BOTH_HALVES;
+ containerPtr->embeddedPtr = winPtr;
+ containerPtr->parentPtr->flags |= TK_BOTH_HALVES;
+ }
+ containerPtr->embeddedHWnd = (HWND)wParam;
+ }
+ result = PTR2INT(containerPtr->parentHWnd);
+ } else {
+ result = 0;
+ }
+ break;
+
+ case TK_DETACHWINDOW:
+ /*
+ * An embedded window notifies the container that it is detached.
+ * The container should clearn the related variables and redraw
+ * its window.
+ *
+ * wParam - N/A
+ * lParam - N/A
+ *
+ * Return value:
+ * 0 - the message is not processed.
+ * others - the message is processed.
+ */
+
+ containerPtr->embeddedMenuHWnd = NULL;
+ containerPtr->embeddedHWnd = NULL;
+ containerPtr->parentPtr->flags &= ~TK_BOTH_HALVES;
+ if (topwinPtr) {
+ TkWinSetMenu((Tk_Window) topwinPtr, 0);
+ }
+ InvalidateRect(hwnd, NULL, TRUE);
+ break;
+
+ case TK_GEOMETRYREQ:
+ /*
+ * An embedded window requests a window size change.
+ *
+ * wParam - window width
+ * lParam - window height
+ *
+ * Return value:
+ * 0 - the message is not processed.
+ * others - the message is processed.
+ */
+
+ EmbedGeometryRequest(containerPtr, (int)wParam, lParam);
+ break;
+
+ case TK_RAISEWINDOW:
+ /*
+ * An embedded window requests to change its Z-order.
+ *
+ * wParam - a window handle as a z-order stack reference
+ * lParam - a flag of above-below: 0 - above; 1 or others: - below
+ *
+ * Return value:
+ * 0 - the message is not processed.
+ * others - the message is processed.
+ */
+
+ TkWinSetWindowPos(GetParent(containerPtr->parentHWnd),
+ (HWND)wParam, (int)lParam);
+ break;
+
+ case TK_GETFRAMEWID:
+ /*
+ * An embedded window requests to get the frame window's id.
+ *
+ * wParam - N/A
+ * lParam - N/A
+ *
+ * Return vlaue:
+ *
+ * A handle of the frame window. If it is not availble, a zero is
+ * returned.
+ */
+ if (topwinPtr) {
+ result = PTR2INT(GetParent(containerPtr->parentHWnd));
+ } else {
+ topwinPtr = containerPtr->parentPtr;
+ while (!(topwinPtr->flags & TK_TOP_HIERARCHY)) {
+ topwinPtr = topwinPtr->parentPtr;
+ }
+ if (topwinPtr && topwinPtr->window) {
+ result = PTR2INT(GetParent(Tk_GetHWND(topwinPtr->window)));
+ } else {
+ result = 0;
+ }
+ }
+ break;
+
+ case TK_CLAIMFOCUS:
+ /*
+ * An embedded window requests a focus.
+ *
+ * wParam - a flag of forcing focus
+ * lParam - N/A
+ *
+ * Return value:
+ * 0 - the message is not processed
+ * 1 - the message is processed
+ */
+
+ if (!SetFocus(containerPtr->embeddedHWnd) && wParam) {
+ /*
+ * forcing focus TBD
+ */
+ }
+ break;
+
+ case TK_WITHDRAW:
+ /*
+ * An embedded window requests withdraw.
+ *
+ * wParam - N/A
+ * lParam - N/A
+ *
+ * Return value
+ * 0 - the message is not processed
+ * 1 - the message is processed
+ */
+
+ if (topwinPtr) {
+ TkpWinToplevelWithDraw(topwinPtr);
+ } else {
+ result = 0;
+ }
+ break;
+
+ case TK_ICONIFY:
+ /*
+ * An embedded window requests iconification.
+ *
+ * wParam - N/A
+ * lParam - N/A
+ *
+ * Return value
+ * 0 - the message is not processed
+ * 1 - the message is processed
+ */
+
+ if (topwinPtr) {
+ TkpWinToplevelIconify(topwinPtr);
+ } else {
+ result = 0;
+ }
+ break;
+
+ case TK_DEICONIFY:
+ /*
+ * An embedded window requests deiconification.
+ *
+ * wParam - N/A
+ * lParam - N/A
+ *
+ * Return value
+ * 0 - the message is not processed
+ * 1 - the message is processed
+ */
+ if (topwinPtr) {
+ TkpWinToplevelDeiconify(topwinPtr);
+ } else {
+ result = 0;
+ }
+ break;
+
+ case TK_MOVEWINDOW:
+ /*
+ * An embedded window requests to move position if both wParam and
+ * lParam are greater or equal to 0.
+ * wParam - x value of the frame's upper left
+ * lParam - y value of the frame's upper left
+ *
+ * Otherwise an embedded window requests the current position
+ *
+ * Return value: an encoded window position in a 32bit long, i.e,
+ * ((x << 16) & 0xffff0000) | (y & 0xffff)
+ *
+ * Only a toplevel container may move the embedded.
+ */
+
+ result = TkpWinToplevelMove(containerPtr->parentPtr,
+ wParam, lParam);
+ break;
+
+ case TK_OVERRIDEREDIRECT:
+ /*
+ * An embedded window request overrideredirect.
+ *
+ * wParam
+ * 0 - add a frame if there is no one
+ * 1 - remove the frame if there is a one
+ * < 0 - query the current overrideredirect value
+ *
+ * lParam - N/A
+ *
+ * Return value:
+ * 1 + the current value of overrideredirect if the container is a
+ * toplevel. Otherwise 0.
+ */
+ if (topwinPtr) {
+ result = 1 + TkpWinToplevelOverrideRedirect(topwinPtr, wParam);
+ } else {
+ result = 0;
+ }
+ break;
+
+ case TK_SETMENU:
+ /*
+ * An embedded requests to set a menu.
+ *
+ * wParam - a menu handle
+ * lParam - a menu window handle
+ *
+ * Return value:
+ * 1 - the message is processed
+ * 0 - the message is not processed
+ */
+ if (topwinPtr) {
+ containerPtr->embeddedMenuHWnd = (HWND)lParam;
+ TkWinSetMenu((Tk_Window)topwinPtr, (HMENU)wParam);
+ } else {
+ result = 0;
+ }
+ break;
+
+ case TK_STATE:
+ /*
+ * An embedded window request set/get state services.
+ *
+ * wParam - service directive
+ * 0 - 3 for setting state
+ * 0 - withdrawn state
+ * 1 - normal state
+ * 2 - zoom state
+ * 3 - icon state
+ * others for gettting state
+ *
+ * lParam - N/A
+ *
+ * Return value
+ * 1 + the current state or 0 if the container is not a toplevel
+ */
+
+ if (topwinPtr) {
+ if (wParam <= 3) {
+ TkpWmSetState(topwinPtr, wParam);
+ }
+ result = 1+TkpWmGetState(topwinPtr);
+ } else {
+ result = 0;
+ }
+ break;
+
+ /*
+ * Return 0 since the current Tk container implementation is
+ * unable to provide following services.
+ */
+ default:
+ result = 0;
+ break;
}
+ } else {
+ if ((message == TK_INFO) && (wParam == TK_CONTAINER_VERIFY)) {
+ /*
+ * Reply the message sender: this is not a Tk container
+ */
- break;
- case TK_GEOMETRYREQ:
- EmbedGeometryRequest(containerPtr, (int) wParam, lParam);
- break;
+ return -PTR2INT(hwnd);
+ } else {
+ result = 0;
+ }
}
- return 1;
+
+ return result;
}
/*
@@ -418,39 +773,40 @@ TkWinEmbeddedEventProc(hwnd, message, wParam, lParam)
*
* EmbedGeometryRequest --
*
- * This procedure is invoked when an embedded application requests
- * a particular size. It processes the request (which may or may
- * not actually resize the window) and reflects the results back
- * to the embedded application.
+ * This procedure is invoked when an embedded application requests a
+ * particular size. It processes the request (which may or may not
+ * actually resize the window) and reflects the results back to the
+ * embedded application.
*
* Results:
* None.
*
* Side effects:
- * If we deny the child's size change request, a Configure event
- * is synthesized to let the child know that the size is the same
- * as it used to be. Events get processed while we're waiting for
- * the geometry managers to do their thing.
+ * If we deny the child's size change request, a Configure event is
+ * synthesized to let the child know that the size is the same as it used
+ * to be. Events get processed while we're waiting for the geometry
+ * managers to do their thing.
*
*----------------------------------------------------------------------
*/
void
-EmbedGeometryRequest(containerPtr, width, height)
- Container *containerPtr; /* Information about the container window. */
- int width, height; /* Size that the child has requested. */
+EmbedGeometryRequest(
+ Container *containerPtr, /* Information about the container window. */
+ int width, int height) /* Size that the child has requested. */
{
- TkWindow * winPtr = containerPtr->parentPtr;
-
+ TkWindow *winPtr = containerPtr->parentPtr;
+
/*
- * Forward the requested size into our geometry management hierarchy
- * via the container window. We need to send a Configure event back
- * to the embedded application even if we decide not to resize
- * the window; to make this happen, process all idle event handlers
- * synchronously here (so that the geometry managers have had a
- * chance to do whatever they want to do), and if the window's size
- * didn't change then generate a configure event.
+ * Forward the requested size into our geometry management hierarchy via
+ * the container window. We need to send a Configure event back to the
+ * embedded application even if we decide not to resize the window; to
+ * make this happen, process all idle event handlers synchronously here
+ * (so that the geometry managers have had a chance to do whatever they
+ * want to do), and if the window's size didn't change then generate a
+ * configure event.
*/
+
Tk_GeometryRequest((Tk_Window)winPtr, width, height);
if (containerPtr->embeddedHWnd != NULL) {
@@ -458,8 +814,8 @@ EmbedGeometryRequest(containerPtr, width, height)
/* Empty loop body. */
}
- SetWindowPos(containerPtr->embeddedHWnd, NULL,
- 0, 0, winPtr->changes.width, winPtr->changes.height, SWP_NOZORDER);
+ SetWindowPos(containerPtr->embeddedHWnd, NULL, 0, 0,
+ winPtr->changes.width, winPtr->changes.height, SWP_NOZORDER);
}
}
@@ -468,38 +824,41 @@ EmbedGeometryRequest(containerPtr, width, height)
*
* ContainerEventProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * various useful events are received for the container window.
+ * This procedure is invoked by the Tk event dispatcher when various
+ * useful events are received for the container window.
*
* Results:
* None.
*
* Side effects:
- * Depends on the event. For example, when ConfigureRequest events
- * occur, geometry information gets set for the container window.
+ * Depends on the event. For example, when ConfigureRequest events occur,
+ * geometry information gets set for the container window.
*
*----------------------------------------------------------------------
*/
static void
-ContainerEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+ContainerEventProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
Container *containerPtr = (Container *)clientData;
Tk_Window tkwin = (Tk_Window)containerPtr->parentPtr;
if (eventPtr->type == ConfigureNotify) {
- if (containerPtr->embeddedPtr == NULL) {
- return;
- }
- /* Resize the embedded window, if there is any */
+ /*
+ * Resize the embedded window, if there is any.
+ */
+
if (containerPtr->embeddedHWnd) {
- SetWindowPos(containerPtr->embeddedHWnd, NULL,
- 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), SWP_NOZORDER);
+ SetWindowPos(containerPtr->embeddedHWnd, NULL, 0, 0,
+ Tk_Width(tkwin), Tk_Height(tkwin), SWP_NOZORDER);
}
} else if (eventPtr->type == DestroyNotify) {
- /* The container is gone, remove it from the list */
+ /*
+ * The container is gone, remove it from the list.
+ */
+
EmbedWindowDeleted(containerPtr->parentPtr);
}
}
@@ -509,13 +868,13 @@ ContainerEventProc(clientData, eventPtr)
*
* TkpGetOtherWindow --
*
- * If both the container and embedded window are in the same
- * process, this procedure will return either one, given the other.
+ * If both the container and embedded window are in the same process,
+ * this procedure will return either one, given the other.
*
* Results:
* If winPtr is a container, the return value is the token for the
- * embedded window, and vice versa. If the "other" window isn't in
- * this process, NULL is returned.
+ * embedded window, and vice versa. If the "other" window isn't in this
+ * process, NULL is returned.
*
* Side effects:
* None.
@@ -524,13 +883,13 @@ ContainerEventProc(clientData, eventPtr)
*/
TkWindow *
-TkpGetOtherWindow(winPtr)
- TkWindow *winPtr; /* Tk's structure for a container or
- * embedded window. */
+TkpGetOtherWindow(
+ TkWindow *winPtr) /* Tk's structure for a container or embedded
+ * window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
@@ -546,12 +905,81 @@ TkpGetOtherWindow(winPtr)
/*
*----------------------------------------------------------------------
*
+ * Tk_GetEmbeddedHWnd --
+ *
+ * This function returns the embedded window id.
+ *
+ * Results:
+ * If winPtr is a container, the return value is the HWND for the
+ * embedded window. Otherwise it returns NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HWND
+Tk_GetEmbeddedHWnd(
+ TkWindow *winPtr)
+{
+ Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
+ containerPtr = containerPtr->nextPtr) {
+ if (containerPtr->parentPtr == winPtr) {
+ return containerPtr->embeddedHWnd;
+ }
+ }
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetEmbeddedMenuHWND --
+ *
+ * This function returns the embedded menu window id.
+ *
+ * Results:
+ * If winPtr is a container, the return value is the HWND for the
+ * embedded menu window. Otherwise it returns NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HWND
+Tk_GetEmbeddedMenuHWND(
+ Tk_Window tkwin)
+{
+ TkWindow *winPtr = (TkWindow*)tkwin;
+ Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
+ containerPtr = containerPtr->nextPtr) {
+ if (containerPtr->parentPtr == winPtr) {
+ return containerPtr->embeddedMenuHWnd;
+ }
+ }
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpClaimFocus --
*
- * This procedure is invoked when someone asks or the input focus
- * to be put on a window in an embedded application, but the
- * application doesn't currently have the focus. It requests the
- * input focus from the container application.
+ * This procedure is invoked when someone asks or the input focus to be
+ * put on a window in an embedded application, but the application
+ * doesn't currently have the focus. It requests the input focus from the
+ * container application.
*
* Results:
* None.
@@ -563,12 +991,12 @@ TkpGetOtherWindow(winPtr)
*/
void
-TkpClaimFocus(topLevelPtr, force)
- TkWindow *topLevelPtr; /* Top-level window containing desired
- * focus window; should be embedded. */
- int force; /* One means that the container should
- * claim the focus if it doesn't
- * currently have it. */
+TkpClaimFocus(
+ TkWindow *topLevelPtr, /* Top-level window containing desired focus
+ * window; should be embedded. */
+ int force) /* One means that the container should claim
+ * the focus if it doesn't currently have
+ * it. */
{
HWND hwnd = GetParent(Tk_GetHWND(topLevelPtr->window));
SendMessage(hwnd, TK_CLAIMFOCUS, (WPARAM) force, 0);
@@ -579,13 +1007,13 @@ TkpClaimFocus(topLevelPtr, force)
*
* TkpRedirectKeyEvent --
*
- * This procedure is invoked when a key press or release event
- * arrives for an application that does not believe it owns the
- * input focus. This can happen because of embedding; for example,
- * X can send an event to an embedded application when the real
- * focus window is in the container application and is an ancestor
- * of the container. This procedure's job is to forward the event
- * back to the application where it really belongs.
+ * This procedure is invoked when a key press or release event arrives
+ * for an application that does not believe it owns the input focus.
+ * This can happen because of embedding; for example, X can send an event
+ * to an embedded application when the real focus window is in the
+ * container application and is an ancestor of the container. This
+ * procedure's job is to forward the event back to the application where
+ * it really belongs.
*
* Results:
* None.
@@ -597,11 +1025,11 @@ TkpClaimFocus(topLevelPtr, force)
*/
void
-TkpRedirectKeyEvent(winPtr, eventPtr)
- TkWindow *winPtr; /* Window to which the event was originally
+TkpRedirectKeyEvent(
+ TkWindow *winPtr, /* Window to which the event was originally
* reported. */
- XEvent *eventPtr; /* X event to redirect (should be KeyPress
- * or KeyRelease). */
+ XEvent *eventPtr) /* X event to redirect (should be KeyPress or
+ * KeyRelease). */
{
/* not implemented */
}
@@ -611,9 +1039,9 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
*
* EmbedWindowDeleted --
*
- * This procedure is invoked when a window involved in embedding
- * (as either the container or the embedded application) is
- * destroyed. It cleans up the Container structure for the window.
+ * This procedure is invoked when a window involved in embedding (as
+ * either the container or the embedded application) is destroyed. It
+ * cleans up the Container structure for the window.
*
* Results:
* None.
@@ -625,19 +1053,18 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
*/
static void
-EmbedWindowDeleted(winPtr)
- TkWindow *winPtr; /* Tk's information about window that
- * was deleted. */
+EmbedWindowDeleted(
+ TkWindow *winPtr) /* Tk's information about window that was
+ * deleted. */
{
Container *containerPtr, *prevPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Find the Container structure for this window work. Delete the
+ * Find the Container structure for this window work. Delete the
* information about the embedded application and free the container's
- * record.
- * The main container may be null. [Bug #476176]
+ * record. The main container may be null. [Bug #476176]
*/
prevPtr = NULL;
@@ -650,13 +1077,15 @@ EmbedWindowDeleted(winPtr)
break;
}
if (containerPtr->parentPtr == winPtr) {
+ SendMessage(containerPtr->embeddedHWnd, WM_CLOSE, 0, 0);
containerPtr->parentPtr = NULL;
+ containerPtr->embeddedPtr = NULL;
break;
}
prevPtr = containerPtr;
containerPtr = containerPtr->nextPtr;
if (containerPtr == NULL) {
- panic("EmbedWindowDeleted couldn't find window");
+ return;
}
}
if ((containerPtr->embeddedPtr == NULL)
@@ -669,3 +1098,11 @@ EmbedWindowDeleted(winPtr)
ckfree((char *) containerPtr);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 6fc184d..f209716 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -1,27 +1,27 @@
-/*
+/*
* tkWinFont.c --
*
- * Contains the Windows implementation of the platform-independant
- * font package interface.
+ * Contains the Windows implementation of the platform-independant font
+ * package interface.
*
- * Copyright (c) 1994 Software Research Associates, Inc.
+ * Copyright (c) 1994 Software Research Associates, Inc.
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
#include "tkFont.h"
/*
- * The following structure represents a font family. It is assumed that
- * all screen fonts constructed from the same "font family" share certain
- * properties; all screen fonts with the same "font family" point to a
- * shared instance of this structure. The most important shared property
- * is the character existence metrics, used to determine if a screen font
- * can display a given Unicode character.
+ * The following structure represents a font family. It is assumed that all
+ * screen fonts constructed from the same "font family" share certain
+ * properties; all screen fonts with the same "font family" point to a shared
+ * instance of this structure. The most important shared property is the
+ * character existence metrics, used to determine if a screen font can display
+ * a given Unicode character.
*
* Under Windows, a "font family" is uniquely identified by its face name.
*/
@@ -34,69 +34,69 @@
typedef struct FontFamily {
struct FontFamily *nextPtr; /* Next in list of all known font families. */
int refCount; /* How many SubFonts are referring to this
- * FontFamily. When the refCount drops to
+ * FontFamily. When the refCount drops to
* zero, this FontFamily may be freed. */
/*
* Key.
*/
-
+
Tk_Uid faceName; /* Face name key for this FontFamily. */
/*
* Derived properties.
*/
-
+
Tcl_Encoding encoding; /* Encoding for this font family. */
int isSymbolFont; /* Non-zero if this is a symbol font. */
- int isWideFont; /* 1 if this is a double-byte font, 0
+ int isWideFont; /* 1 if this is a double-byte font, 0
* otherwise. */
BOOL (WINAPI *textOutProc)(HDC, int, int, TCHAR *, int);
- /* The procedure to use to draw text after
- * it has been converted from UTF-8 to the
+ /* The procedure to use to draw text after it
+ * has been converted from UTF-8 to the
* encoding of this font. */
BOOL (WINAPI *getTextExtentPoint32Proc)(HDC, TCHAR *, int, LPSIZE);
/* The procedure to use to measure text after
- * it has been converted from UTF-8 to the
+ * it has been converted from UTF-8 to the
* encoding of this font. */
char *fontMap[FONTMAP_PAGES];
/* Two-level sparse table used to determine
* quickly if the specified character exists.
* As characters are encountered, more pages
- * in this table are dynamically added. The
+ * in this table are dynamically added. The
* contents of each page is a bitmask
* consisting of FONTMAP_BITSPERPAGE bits,
* representing whether this font can be used
* to display the given character at the
- * corresponding bit position. The high bits
+ * corresponding bit position. The high bits
* of the character are used to pick which
* page of the table is used. */
/*
* Cached Truetype font info.
*/
-
+
int segCount; /* The length of the following arrays. */
USHORT *startCount; /* Truetype information about the font, */
- USHORT *endCount; /* indicating which characters this font
- * can display (malloced). The format of
- * this information is (relatively) compact,
- * but would take longer to search than
- * indexing into the fontMap[][] table. */
+ USHORT *endCount; /* indicating which characters this font can
+ * display (malloced). The format of this
+ * information is (relatively) compact, but
+ * would take longer to search than indexing
+ * into the fontMap[][] table. */
} FontFamily;
/*
- * The following structure encapsulates an individual screen font. A font
+ * The following structure encapsulates an individual screen font. A font
* object is made up of however many SubFonts are necessary to display a
* stream of multilingual characters.
*/
typedef struct SubFont {
- char **fontMap; /* Pointer to font map from the FontFamily,
+ char **fontMap; /* Pointer to font map from the FontFamily,
* cached here to save a dereference. */
- HFONT hFont; /* The specific screen font that will be
- * used when displaying/measuring chars
- * belonging to the FontFamily. */
+ HFONT hFont; /* The specific screen font that will be used
+ * when displaying/measuring chars belonging
+ * to the FontFamily. */
FontFamily *familyPtr; /* The FontFamily for this SubFont. */
} SubFont;
@@ -109,18 +109,18 @@ typedef struct SubFont {
#define BASE_CHARS 128
typedef struct WinFont {
- TkFont font; /* Stuff used by generic font package. Must
- * be first in structure. */
+ TkFont font; /* Stuff used by generic font package. Must be
+ * first in structure. */
SubFont staticSubFonts[SUBFONT_SPACE];
/* Builtin space for a limited number of
* SubFonts. */
int numSubFonts; /* Length of following array. */
- SubFont *subFontArray; /* Array of SubFonts that have been loaded
- * in order to draw/measure all the characters
- * encountered by this font so far. All fonts
+ SubFont *subFontArray; /* Array of SubFonts that have been loaded in
+ * order to draw/measure all the characters
+ * encountered by this font so far. All fonts
* start off with one SubFont initialized by
* AllocFont() from the original set of font
- * attributes. Usually points to
+ * attributes. Usually points to
* staticSubFonts, but may point to malloced
* space if there are lots of SubFonts. */
@@ -129,10 +129,10 @@ typedef struct WinFont {
* offscreen measurements. */
int pixelSize; /* Original pixel size used when font was
* constructed. */
- int widths[BASE_CHARS]; /* Widths of first 128 chars in the base
- * font, for handling common case. The base
- * font is always used to draw characters
- * between 0x0000 and 0x007f. */
+ int widths[BASE_CHARS]; /* Widths of first 128 chars in the base font,
+ * for handling common case. The base font is
+ * always used to draw characters between
+ * 0x0000 and 0x007f. */
} WinFont;
/*
@@ -155,10 +155,12 @@ typedef struct CanUse {
* represent the system fonts and the numbers used by Windows.
*/
-static TkStateMap systemMap[] = {
+static const TkStateMap systemMap[] = {
{ANSI_FIXED_FONT, "ansifixed"},
+ {ANSI_FIXED_FONT, "fixed"},
{ANSI_VAR_FONT, "ansi"},
{DEVICE_DEFAULT_FONT, "device"},
+ {DEFAULT_GUI_FONT, "defaultgui"},
{OEM_FIXED_FONT, "oemfixed"},
{SYSTEM_FIXED_FONT, "systemfixed"},
{SYSTEM_FONT, "system"},
@@ -166,11 +168,11 @@ static TkStateMap systemMap[] = {
};
typedef struct ThreadSpecificData {
- FontFamily *fontFamilyList; /* The list of font families that are
- * currently loaded. As screen fonts
- * are loaded, this list grows to hold
- * information about what characters
- * exist in each font family. */
+ FontFamily *fontFamilyList; /* The list of font families that are
+ * currently loaded. As screen fonts are
+ * loaded, this list grows to hold information
+ * about what characters exist in each font
+ * family. */
Tcl_HashTable uidTable;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -178,7 +180,7 @@ static Tcl_ThreadDataKey dataKey;
/*
* Information cached about the system at startup time.
*/
-
+
static Tcl_Encoding systemEncoding;
/*
@@ -186,10 +188,10 @@ static Tcl_Encoding systemEncoding;
*/
static FontFamily * AllocFontFamily(HDC hdc, HFONT hFont, int base);
-static SubFont * CanUseFallback(HDC hdc, WinFont *fontPtr,
+static SubFont * CanUseFallback(HDC hdc, WinFont *fontPtr,
char *fallbackName, int ch,
SubFont **subFontPtrPtr);
-static SubFont * CanUseFallbackWithAliases(HDC hdc, WinFont *fontPtr,
+static SubFont * CanUseFallbackWithAliases(HDC hdc, WinFont *fontPtr,
char *faceName, int ch, Tcl_DString *nameTriedPtr,
SubFont **subFontPtrPtr);
static int FamilyExists(HDC hdc, CONST char *faceName);
@@ -202,44 +204,49 @@ static int FontMapLookup(SubFont *subFontPtr, int ch);
static void FreeFontFamily(FontFamily *familyPtr);
static HFONT GetScreenFont(CONST TkFontAttributes *faPtr,
CONST char *faceName, int pixelSize);
-static void InitFont(Tk_Window tkwin, HFONT hFont,
+static void InitFont(Tk_Window tkwin, HFONT hFont,
int overstrike, WinFont *tkFontPtr);
-static void InitSubFont(HDC hdc, HFONT hFont, int base,
+static void InitSubFont(HDC hdc, HFONT hFont, int base,
SubFont *subFontPtr);
-static int LoadFontRanges(HDC hdc, HFONT hFont,
+static int CreateNamedSystemLogFont(Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char* name,
+ LOGFONT* logFontPtr);
+static int CreateNamedSystemFont(Tcl_Interp *interp,
+ Tk_Window tkwin, CONST char* name, HFONT hFont);
+static int LoadFontRanges(HDC hdc, HFONT hFont,
USHORT **startCount, USHORT **endCount,
int *symbolPtr);
-static void MultiFontTextOut(HDC hdc, WinFont *fontPtr,
+static void MultiFontTextOut(HDC hdc, WinFont *fontPtr,
CONST char *source, int numBytes, int x, int y);
static void ReleaseFont(WinFont *fontPtr);
static void ReleaseSubFont(SubFont *subFontPtr);
static int SeenName(CONST char *name, Tcl_DString *dsPtr);
static void SwapLong(PULONG p);
static void SwapShort(USHORT *p);
-static int CALLBACK WinFontCanUseProc(ENUMLOGFONT *lfPtr,
- NEWTEXTMETRIC *tmPtr, int fontType,
+static int CALLBACK WinFontCanUseProc(ENUMLOGFONT *lfPtr,
+ NEWTEXTMETRIC *tmPtr, int fontType,
LPARAM lParam);
-static int CALLBACK WinFontExistProc(ENUMLOGFONT *lfPtr,
- NEWTEXTMETRIC *tmPtr, int fontType,
+static int CALLBACK WinFontExistProc(ENUMLOGFONT *lfPtr,
+ NEWTEXTMETRIC *tmPtr, int fontType,
LPARAM lParam);
-static int CALLBACK WinFontFamilyEnumProc(ENUMLOGFONT *lfPtr,
- NEWTEXTMETRIC *tmPtr, int fontType,
+static int CALLBACK WinFontFamilyEnumProc(ENUMLOGFONT *lfPtr,
+ NEWTEXTMETRIC *tmPtr, int fontType,
LPARAM lParam);
/*
*-------------------------------------------------------------------------
- *
+ *
* TkpFontPkgInit --
*
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the
- * platform-dependent code on a per application basis.
+ * This procedure is called when an application is created. It
+ * initializes all the structures that are used by the platform-dependent
+ * code on a per application basis.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- *
+ *
* None.
*
*-------------------------------------------------------------------------
@@ -251,13 +258,15 @@ TkpFontPkgInit(
{
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
/*
- * If running NT, then we will be calling some Unicode functions
- * explictly. So, even if the Tcl system encoding isn't Unicode,
- * make sure we convert to/from the Unicode char set.
+ * If running NT, then we will be calling some Unicode functions
+ * explictly. So, even if the Tcl system encoding isn't Unicode, make
+ * sure we convert to/from the Unicode char set.
*/
systemEncoding = TkWinGetUnicodeEncoding();
}
+
+ TkWinSetupSystemFonts(mainPtr);
}
/*
@@ -268,17 +277,17 @@ TkpFontPkgInit(
* Map a platform-specific native font name to a TkFont.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * native font. If a native font by the given name could not be
- * found, the return value is NULL.
+ * The return value is a pointer to a TkFont that represents the native
+ * font. If a native font by the given name could not be found, the
+ * return value is NULL.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the name has already been seen before. The caller should
- * call TkpDeleteFont() when the font is no longer needed.
+ * Every call to this procedure returns a new TkFont structure, even if
+ * the name has already been seen before. The caller should call
+ * TkpDeleteFont() when the font is no longer needed.
*
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generic TkFont before calling TkpDeleteFont().
+ * The caller is responsible for initializing the memory associated with
+ * the generic TkFont when this function returns and releasing the
+ * contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
* Memory allocated.
@@ -308,26 +317,178 @@ TkpGetNativeFont(
/*
*---------------------------------------------------------------------------
+ * CreateNamedSystemFont --
+ *
+ * This function registers a Windows logical font description with the Tk
+ * named font mechanism.
+ *
+ * Side effects
+ *
+ * A new named font is added to the Tk font registry.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static int
+CreateNamedSystemLogFont(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ CONST char* name,
+ LOGFONTA* logFontPtr)
+{
+ HFONT hFont;
+ int r;
+
+ hFont = CreateFontIndirect(logFontPtr);
+ r = CreateNamedSystemFont(interp, tkwin, name, hFont);
+ DeleteObject((HGDIOBJ)hFont);
+ return r;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ * CreateNamedSystemFont --
*
- * TkpGetFontFromAttributes --
+ * This function registers a Windows font with the Tk
+ * named font mechanism.
*
- * Given a desired set of attributes for a font, find a font with
- * the closest matching attributes.
+ * Side effects
+ *
+ * A new named font is added to the Tk font registry.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static int
+CreateNamedSystemFont(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ CONST char* name,
+ HFONT hFont)
+{
+ WinFont winfont;
+ int r;
+
+ TkDeleteNamedFont(NULL, tkwin, name);
+ InitFont(tkwin, hFont, 0, &winfont);
+ r = TkCreateNamedFont(interp, tkwin, name, &winfont.font.fa);
+ TkpDeleteFont((TkFont *)&winfont);
+ return r;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ * TkWinSystemFonts --
+ *
+ * Create some platform specific named fonts that to give access to the
+ * system fonts. These are all defined for the Windows desktop parameters.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkWinSetupSystemFonts(TkMainInfo *mainPtr)
+{
+ Tcl_Interp *interp;
+ Tk_Window tkwin;
+ const TkStateMap *mapPtr;
+ NONCLIENTMETRICS ncMetrics;
+ ICONMETRICS iconMetrics;
+ HFONT hFont;
+
+ interp = (Tcl_Interp *) mainPtr->interp;
+ tkwin = (Tk_Window) mainPtr->winPtr;
+
+ /* force this for now */
+ if (((TkWindow *) tkwin)->mainPtr == NULL) {
+ ((TkWindow *) tkwin)->mainPtr = mainPtr;
+ }
+
+ /*
+ * If this API call fails then we will fallback to setting these
+ * named fonts from script in ttk/fonts.tcl. So far I've only
+ * seen it fail when WINVER has been defined for a higher platform than
+ * we are running on. (ie: WINVER=0x0600 and running on XP).
+ */
+
+ ZeroMemory(&ncMetrics, sizeof(ncMetrics));
+ ncMetrics.cbSize = sizeof(ncMetrics);
+ if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
+ sizeof(ncMetrics), &ncMetrics, 0)) {
+ CreateNamedSystemLogFont(interp, tkwin, "TkDefaultFont",
+ &ncMetrics.lfMessageFont);
+ CreateNamedSystemLogFont(interp, tkwin, "TkHeadingFont",
+ &ncMetrics.lfMessageFont);
+ CreateNamedSystemLogFont(interp, tkwin, "TkTextFont",
+ &ncMetrics.lfMessageFont);
+ CreateNamedSystemLogFont(interp, tkwin, "TkMenuFont",
+ &ncMetrics.lfMenuFont);
+ CreateNamedSystemLogFont(interp, tkwin, "TkTooltipFont",
+ &ncMetrics.lfStatusFont);
+ CreateNamedSystemLogFont(interp, tkwin, "TkCaptionFont",
+ &ncMetrics.lfCaptionFont);
+ CreateNamedSystemLogFont(interp, tkwin, "TkSmallCaptionFont",
+ &ncMetrics.lfSmCaptionFont);
+ }
+
+ iconMetrics.cbSize = sizeof(iconMetrics);
+ if (SystemParametersInfo(SPI_GETICONMETRICS, sizeof(iconMetrics),
+ &iconMetrics, 0)) {
+ CreateNamedSystemLogFont(interp, tkwin, "TkIconFont",
+ &iconMetrics.lfFont);
+ }
+
+ /*
+ * Identify an available fixed font. Equivalent to ANSI_FIXED_FONT but
+ * more reliable on Russian Windows.
+ */
+
+ {
+ LOGFONTA lfFixed = {
+ 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
+ 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, ""
+ };
+ long pointSize, dpi;
+ HDC hdc = GetDC(NULL);
+ dpi = GetDeviceCaps(hdc, LOGPIXELSY);
+ pointSize = -MulDiv(ncMetrics.lfMessageFont.lfHeight, 72, dpi);
+ lfFixed.lfHeight = -MulDiv(pointSize+1, dpi, 72);
+ ReleaseDC(NULL, hdc);
+ CreateNamedSystemLogFont(interp, tkwin, "TkFixedFont", &lfFixed);
+ }
+
+ /*
+ * Setup the remaining standard Tk font names as named fonts.
+ */
+
+ for (mapPtr = systemMap; mapPtr->strKey != NULL; mapPtr++) {
+ hFont = (HFONT)GetStockObject(mapPtr->numKey);
+ CreateNamedSystemFont(interp, tkwin, mapPtr->strKey, hFont);
+ }
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpGetFontFromAttributes --
+ *
+ * Given a desired set of attributes for a font, find a font with the
+ * closest matching attributes.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * font with the desired attributes. If a font with the desired
- * attributes could not be constructed, some other font will be
- * substituted automatically. NULL is never returned.
+ * The return value is a pointer to a TkFont that represents the font
+ * with the desired attributes. If a font with the desired attributes
+ * could not be constructed, some other font will be substituted
+ * automatically. NULL is never returned.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the specified attributes have already been seen before.
- * The caller should call TkpDeleteFont() to free the platform-
- * specific data when the font is no longer needed.
+ * Every call to this procedure returns a new TkFont structure, even if
+ * the specified attributes have already been seen before. The caller
+ * should call TkpDeleteFont() to free the platform- specific data when
+ * the font is no longer needed.
*
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generic TkFont before calling TkpDeleteFont().
+ * The caller is responsible for initializing the memory associated with
+ * the generic TkFont when this function returns and releasing the
+ * contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
* Memory allocated.
@@ -337,11 +498,11 @@ TkpGetNativeFont(
TkFont *
TkpGetFontFromAttributes(
- TkFont *tkFontPtr, /* If non-NULL, store the information in
- * this existing TkFont structure, rather than
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
* allocating a new structure to hold the
* font; the existing contents of the font
- * will be released. If NULL, a new TkFont
+ * will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin, /* For display where font will be used. */
CONST TkFontAttributes *faPtr)
@@ -356,10 +517,10 @@ TkpGetFontFromAttributes(
char ***fontFallbacks;
Tk_Uid faceName, fallback, actualName;
- tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr;
- window = Tk_WindowId(tkwin);
- hwnd = (window == None) ? NULL : TkWinGetHWND(window);
- hdc = GetDC(hwnd);
+ tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr;
+ window = Tk_WindowId(tkwin);
+ hwnd = (window == None) ? NULL : TkWinGetHWND(window);
+ hdc = GetDC(hwnd);
/*
* Algorithm to get the closest font name to the one requested.
@@ -397,10 +558,11 @@ TkpGetFontFromAttributes(
}
}
- found:
+ found:
ReleaseDC(hwnd, hdc);
- hFont = GetScreenFont(faPtr, faceName, TkFontGetPixels(tkwin, faPtr->size));
+ hFont = GetScreenFont(faPtr, faceName,
+ TkFontGetPixels(tkwin, faPtr->size));
if (tkFontPtr == NULL) {
fontPtr = (WinFont *) ckalloc(sizeof(WinFont));
} else {
@@ -418,9 +580,9 @@ TkpGetFontFromAttributes(
* TkpDeleteFont --
*
* Called to release a font allocated by TkpGetNativeFont() or
- * TkpGetFontFromAttributes(). The caller should have already
- * released the fields of the TkFont that are used exclusively by
- * the generic TkFont code.
+ * TkpGetFontFromAttributes(). The caller should have already released
+ * the fields of the TkFont that are used exclusively by the generic
+ * TkFont code.
*
* Results:
* None.
@@ -446,8 +608,8 @@ TkpDeleteFont(
*
* TkpGetFontFamilies, WinFontFamilyEnumProc --
*
- * Return information about the font families that are available
- * on the display of the given window.
+ * Return information about the font families that are available on the
+ * display of the given window.
*
* Results:
* Modifies interp's result object to hold a list of all the available
@@ -458,33 +620,33 @@ TkpDeleteFont(
*
*---------------------------------------------------------------------------
*/
-
+
void
TkpGetFontFamilies(
Tcl_Interp *interp, /* Interp to hold result. */
Tk_Window tkwin) /* For display to query. */
-{
+{
HDC hdc;
HWND hwnd;
Window window;
- window = Tk_WindowId(tkwin);
- hwnd = (window == None) ? NULL : TkWinGetHWND(window);
- hdc = GetDC(hwnd);
+ window = Tk_WindowId(tkwin);
+ hwnd = (window == None) ? NULL : TkWinGetHWND(window);
+ hdc = GetDC(hwnd);
/*
- * On any version NT, there may fonts with international names.
- * Use the NT-only Unicode version of EnumFontFamilies to get the
- * font names. If we used the ANSI version on a non-internationalized
- * version of NT, we would get font names with '?' replacing all
- * the international characters.
+ * On any version NT, there may fonts with international names. Use the
+ * NT-only Unicode version of EnumFontFamilies to get the font names. If
+ * we used the ANSI version on a non-internationalized version of NT, we
+ * would get font names with '?' replacing all the international
+ * characters.
*
- * On a non-internationalized verson of 95, fonts with international
- * names are not allowed, so the ANSI version of EnumFontFamilies will
- * work. On an internationalized version of 95, there may be fonts with
- * international names; the ANSI version will work, fetching the
- * name in the system code page. Can't use the Unicode version of
- * EnumFontFamilies because it only exists under NT.
+ * On a non-internationalized verson of 95, fonts with international names
+ * are not allowed, so the ANSI version of EnumFontFamilies will work. On
+ * an internationalized version of 95, there may be fonts with
+ * international names; the ANSI version will work, fetching the name in
+ * the system code page. Can't use the Unicode version of EnumFontFamilies
+ * because it only exists under NT.
*/
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
@@ -493,10 +655,10 @@ TkpGetFontFamilies(
} else {
EnumFontFamiliesA(hdc, NULL, (FONTENUMPROCA) WinFontFamilyEnumProc,
(LPARAM) interp);
- }
+ }
ReleaseDC(hwnd, hdc);
}
-
+
static int CALLBACK
WinFontFamilyEnumProc(
ENUMLOGFONT *lfPtr, /* Logical-font data. */
@@ -524,19 +686,19 @@ WinFontFamilyEnumProc(
*
* TkpGetSubFonts --
*
- * A function used by the testing package for querying the actual
- * screen fonts that make up a font object.
+ * A function used by the testing package for querying the actual screen
+ * fonts that make up a font object.
*
* Results:
- * Modifies interp's result object to hold a list containing the
- * names of the screen fonts that make up the given font object.
+ * Modifies interp's result object to hold a list containing the names of
+ * the screen fonts that make up the given font object.
*
* Side effects:
* None.
*
*-------------------------------------------------------------------------
*/
-
+
void
TkpGetSubFonts(
Tcl_Interp *interp, /* Interp to hold result. */
@@ -547,7 +709,7 @@ TkpGetSubFonts(
FontFamily *familyPtr;
Tcl_Obj *resultPtr, *strPtr;
- resultPtr = Tcl_GetObjResult(interp);
+ resultPtr = Tcl_GetObjResult(interp);
fontPtr = (WinFont *) tkfont;
for (i = 0; i < fontPtr->numSubFonts; i++) {
familyPtr = fontPtr->subFontArray[i].familyPtr;
@@ -557,20 +719,75 @@ TkpGetSubFonts(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetFontAttrsForChar --
+ *
+ * Retrieve the font attributes of the actual font used to render a given
+ * character.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The font attributes are stored in *faPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetFontAttrsForChar(
+ Tk_Window tkwin, /* Window on the font's display */
+ Tk_Font tkfont, /* Font to query */
+ Tcl_UniChar c, /* Character of interest */
+ TkFontAttributes* faPtr) /* Output: Font attributes */
+{
+ WinFont *fontPtr = (WinFont *) tkfont;
+ /* Structure describing the logical font */
+ HDC hdc = GetDC(fontPtr->hwnd);
+ /* GDI device context */
+ SubFont *lastSubFontPtr = &fontPtr->subFontArray[0];
+ /* Pointer to subfont array in case
+ * FindSubFontForChar needs to fix up
+ * the memory allocation */
+ SubFont *thisSubFontPtr = FindSubFontForChar(fontPtr, c,
+ &lastSubFontPtr);
+ /* Pointer to the subfont to use for
+ * the given character */
+ FontFamily *familyPtr = thisSubFontPtr->familyPtr;
+ HFONT oldfont; /* Saved font from the device context */
+ TEXTMETRIC tm; /* Font metrics of the selected subfont */
+
+ /*
+ * Get the font attributes.
+ */
+
+ oldfont = SelectObject(hdc, thisSubFontPtr->hFont);
+ GetTextMetrics(hdc, &tm);
+ SelectObject(hdc, oldfont);
+ ReleaseDC(fontPtr->hwnd, hdc);
+ faPtr->family = familyPtr->faceName;
+ faPtr->size = TkFontGetPoints(tkwin,
+ tm.tmInternalLeading - tm.tmHeight);
+ faPtr->weight = (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
+ faPtr->slant = tm.tmItalic ? TK_FS_ITALIC : TK_FS_ROMAN;
+ faPtr->underline = (tm.tmUnderlined != 0);
+ faPtr->overstrike = fontPtr->font.fa.overstrike;
+}
+
+/*
*---------------------------------------------------------------------------
*
* Tk_MeasureChars --
*
- * Determine the number of bytes from the string that will fit
- * in the given horizontal span. The measurement is done under the
- * assumption that Tk_DrawChars() will be used to actually display
- * the characters.
+ * Determine the number of bytes from the string that will fit in the
+ * given horizontal span. The measurement is done under the assumption
+ * that Tk_DrawChars() will be used to actually display the characters.
*
* Results:
- * The return value is the number of bytes from source that
- * fit into the span that extends from 0 to maxLength. *lengthPtr is
- * filled with the x-coordinate of the right edge of the last
- * character that did fit.
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
*
* Side effects:
* None.
@@ -581,45 +798,42 @@ TkpGetSubFonts(
int
Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
- int numBytes, /* Maximum number of bytes to consider
- * from source string. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string. */
int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length in pixels; don't
* consider any character that would cross
- * this x-position. If < 0, then line length
+ * this x-position. If < 0, then line length
* is unbounded and the flags argument is
* ignored. */
int flags, /* Various flag bits OR-ed together:
* TK_PARTIAL_OK means include the last char
* which only partially fits on this line.
* TK_WHOLE_WORDS means stop on a word
- * boundary, if possible.
- * TK_AT_LEAST_ONE means return at least one
- * character (or at least the first partial
- * word in case TK_WHOLE_WORDS is also set)
- * even if no characters (words) fit. */
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character (or at
+ * least the first partial word in case
+ * TK_WHOLE_WORDS is also set) even if no
+ * characters (words) fit. */
int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
HDC hdc;
HFONT oldFont;
WinFont *fontPtr;
- int curX;
+ int curX, moretomeasure;
Tcl_UniChar ch;
SIZE size;
- int moretomeasure;
FontFamily *familyPtr;
Tcl_DString runString;
- SubFont *thisSubFontPtr;
- SubFont *lastSubFontPtr;
- CONST char *p, *end, *next, *start;
-
+ SubFont *thisSubFontPtr, *lastSubFontPtr;
+ CONST char *p, *end, *next = NULL, *start;
if (numBytes == 0) {
- *lengthPtr = 0;
- return 0;
+ *lengthPtr = 0;
+ return 0;
}
fontPtr = (WinFont *) tkfont;
@@ -630,8 +844,8 @@ Tk_MeasureChars(
/*
* A three step process:
- * 1. Find a contiguous range of characters that can all be
- * represented by a single screen font.
+ * 1. Find a contiguous range of characters that can all be represented by
+ * a single screen font.
* 2. Convert those chars to the encoding of that font.
* 3. Measure converted chars.
*/
@@ -641,107 +855,103 @@ Tk_MeasureChars(
start = source;
end = start + numBytes;
for (p = start; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
- if (thisSubFontPtr != lastSubFontPtr) {
- familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, start,
- (int) (p - start), &runString);
- size.cx = 0;
- (*familyPtr->getTextExtentPoint32Proc)(hdc,
- Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
- &size);
- Tcl_DStringFree(&runString);
- if (maxLength >= 0 && (curX+size.cx) > maxLength) {
- moretomeasure = 1;
- break;
- }
- curX += size.cx;
- lastSubFontPtr = thisSubFontPtr;
- start = p;
-
- SelectObject(hdc, lastSubFontPtr->hFont);
- }
- p = next;
+ next = p + Tcl_UtfToUniChar(p, &ch);
+ thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
+ if (thisSubFontPtr != lastSubFontPtr) {
+ familyPtr = lastSubFontPtr->familyPtr;
+ Tcl_UtfToExternalDString(familyPtr->encoding, start,
+ (int) (p - start), &runString);
+ size.cx = 0;
+ (*familyPtr->getTextExtentPoint32Proc)(hdc,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
+ &size);
+ Tcl_DStringFree(&runString);
+ if (maxLength >= 0 && (curX+size.cx) > maxLength) {
+ moretomeasure = 1;
+ break;
+ }
+ curX += size.cx;
+ lastSubFontPtr = thisSubFontPtr;
+ start = p;
+
+ SelectObject(hdc, lastSubFontPtr->hFont);
+ }
+ p = next;
}
if (!moretomeasure) {
- /*
- * We get here if the previous loop was just finished
- * normally, without a break. Just measure the last run and
- * that's it.
- */
+ /*
+ * We get here if the previous loop was just finished normally,
+ * without a break. Just measure the last run and that's it.
+ */
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, start,
- (int) (p - start), &runString);
- size.cx = 0;
+ Tcl_UtfToExternalDString(familyPtr->encoding, start,
+ (int) (p - start), &runString);
+ size.cx = 0;
(*familyPtr->getTextExtentPoint32Proc)(hdc,
Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
+ Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
- Tcl_DStringFree(&runString);
- if (maxLength >= 0 && (curX+size.cx) > maxLength) {
- moretomeasure = 1;
- } else {
+ Tcl_DStringFree(&runString);
+ if (maxLength >= 0 && (curX+size.cx) > maxLength) {
+ moretomeasure = 1;
+ } else {
curX += size.cx;
- p = end;
- }
+ p = end;
+ }
}
if (moretomeasure) {
/*
- * We get here if the measurement of the last run was over the
- * maxLength limit. We need to restart this run and do it
- * char by char, but always in context with the previous text
- * to account for kerning (especially italics).
+ * We get here if the measurement of the last run was over the
+ * maxLength limit. We need to restart this run and do it char by
+ * char, but always in context with the previous text to account for
+ * kerning (especially italics).
*/
- char buf[16];
- int dstWrote;
- int lastSize = 0;
+ char buf[16];
+ int dstWrote;
+ int lastSize = 0;
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_DStringInit(&runString);
- for (p = start; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- Tcl_UtfToExternal(NULL, familyPtr->encoding, p,
- (int) (next - p), 0, NULL, buf, sizeof(buf), NULL,
- &dstWrote, NULL);
- Tcl_DStringAppend(&runString,buf,dstWrote);
- size.cx = 0;
- (*familyPtr->getTextExtentPoint32Proc)(hdc,
- Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
- &size);
- if ((curX+size.cx) > maxLength) {
+ Tcl_DStringInit(&runString);
+ for (p = start; p < end; ) {
+ next = p + Tcl_UtfToUniChar(p, &ch);
+ Tcl_UtfToExternal(NULL, familyPtr->encoding, p,
+ (int) (next - p), 0, NULL, buf, sizeof(buf), NULL,
+ &dstWrote, NULL);
+ Tcl_DStringAppend(&runString,buf,dstWrote);
+ size.cx = 0;
+ (*familyPtr->getTextExtentPoint32Proc)(hdc,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
+ &size);
+ if ((curX+size.cx) > maxLength) {
break;
}
- lastSize = size.cx;
+ lastSize = size.cx;
p = next;
}
- Tcl_DStringFree(&runString);
-
- /*
- * "p" points to the first character that doesn't fit in the
- * desired span. Look at the flags to figure out whether to
- * include this next character.
- */
-
- if ((p < end)
- && (((flags & TK_PARTIAL_OK) && (curX != maxLength))
- || ((p == source) && (flags & TK_AT_LEAST_ONE)
- && (curX == 0)))) {
-
- /*
- * Include the first character that didn't quite fit in
- * the desired span. The width returned will include the
- * width of that extra character.
- */
-
- p = next;
- curX += size.cx;
+ Tcl_DStringFree(&runString);
+
+ /*
+ * "p" points to the first character that doesn't fit in the desired
+ * span. Look at the flags to figure out whether to include this next
+ * character.
+ */
+
+ if ((p < end) && (((flags & TK_PARTIAL_OK) && (curX != maxLength))
+ || ((p==source) && (flags&TK_AT_LEAST_ONE) && (curX==0)))) {
+ /*
+ * Include the first character that didn't quite fit in the
+ * desired span. The width returned will include the width of that
+ * extra character.
+ */
+
+ p = next;
+ curX += size.cx;
} else {
curX += lastSize;
}
@@ -751,38 +961,36 @@ Tk_MeasureChars(
ReleaseDC(fontPtr->hwnd, hdc);
if ((flags & TK_WHOLE_WORDS) && (p < end)) {
+ /*
+ * Scan the string for the last word break and than repeat the whole
+ * procedure without the maxLength limit or any flags.
+ */
+
+ CONST char *lastWordBreak = NULL;
+ Tcl_UniChar ch2;
- /*
- * Scan the string for the last word break and than repeat the
- * whole procedure without the maxLength limit or any flags.
- */
-
- CONST char *lastWordBreak = NULL;
- Tcl_UniChar ch2;
-
- end = p;
- p = source;
- ch = ' ';
- while (p < end) {
- next = p + Tcl_UtfToUniChar(p, &ch2);
- if ((ch != ' ') && (ch2 == ' ')) {
- lastWordBreak = p;
- }
- p = next;
- ch = ch2;
- }
-
- if (lastWordBreak != NULL) {
- return Tk_MeasureChars(
- tkfont, source, lastWordBreak-source, -1, 0, lengthPtr);
- } else {
- if (flags & TK_AT_LEAST_ONE) {
- p = end;
- } else {
- p = source;
- curX = 0;
- }
- }
+ end = p;
+ p = source;
+ ch = ' ';
+ while (p < end) {
+ next = p + Tcl_UtfToUniChar(p, &ch2);
+ if ((ch != ' ') && (ch2 == ' ')) {
+ lastWordBreak = p;
+ }
+ p = next;
+ ch = ch2;
+ }
+
+ if (lastWordBreak != NULL) {
+ return Tk_MeasureChars(tkfont, source, lastWordBreak-source,
+ -1, 0, lengthPtr);
+ }
+ if (flags & TK_AT_LEAST_ONE) {
+ p = end;
+ } else {
+ p = source;
+ curX = 0;
+ }
}
*lengthPtr = curX;
@@ -792,9 +1000,66 @@ Tk_MeasureChars(
/*
*---------------------------------------------------------------------------
*
+ * TkpMeasureCharsInContext --
+ *
+ * Determine the number of bytes from the string that will fit in the
+ * given horizontal span. The measurement is done under the assumption
+ * that TkpDrawCharsInContext() will be used to actually display the
+ * characters.
+ *
+ * This one is almost the same as Tk_MeasureChars(), but with access to
+ * all the characters on the line for context. On Windows this context
+ * isn't consulted, so we just call Tk_MeasureChars().
+ *
+ * Results:
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkpMeasureCharsInContext(
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string in all. */
+ int rangeStart, /* Index of first byte to measure. */
+ int rangeLength, /* Length of range to measure in bytes. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
+ * permissible line length; don't consider any
+ * character that would cross this x-position.
+ * If < 0, then line length is unbounded and
+ * the flags argument is ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fit on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. TK_ISOLATE_END means
+ * that the last character should not be
+ * considered in context with the rest of the
+ * string (used for breaking lines). */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ (void) numBytes; /*unused*/
+ return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength,
+ maxLength, flags, lengthPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* Tk_DrawChars --
*
- * Draw a string of characters on the screen.
+ * Draw a string of characters on the screen.
*
* Results:
* None.
@@ -812,12 +1077,12 @@ Tk_DrawChars(
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
* regular printing characters. */
int numBytes, /* Number of bytes in string. */
int x, int y) /* Coordinates at which to place origin of
@@ -837,10 +1102,10 @@ Tk_DrawChars(
dc = TkWinGetDrawableDC(display, drawable, &state);
SetROP2(dc, tkpWinRopModes[gc->function]);
-
- if ((gc->clip_mask != None) &&
- ((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) {
- SelectClipRgn(dc, (HRGN)((TkpClipMask*)gc->clip_mask)->value.region);
+
+ if ((gc->clip_mask != None) &&
+ ((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) {
+ SelectClipRgn(dc, (HRGN)((TkpClipMask*)gc->clip_mask)->value.region);
}
if ((gc->fill_style == FillStippled
@@ -860,7 +1125,7 @@ Tk_DrawChars(
/*
* Select stipple pattern into destination dc.
*/
-
+
dcMem = CreateCompatibleDC(dc);
stipple = CreatePatternBrush(twdPtr->bitmap.handle);
@@ -884,8 +1149,8 @@ Tk_DrawChars(
/*
* The following code is tricky because fonts are rendered in multiple
- * colors. First we draw onto a black background and copy the white
- * bits. Then we draw onto a white background and copy the black bits.
+ * colors. First we draw onto a black background and copy the white
+ * bits. Then we draw onto a white background and copy the black bits.
* Both the foreground and background bits of the font are ANDed with
* the stipple pattern as they are copied.
*/
@@ -938,7 +1203,7 @@ Tk_DrawChars(
MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent);
BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
- 0, 0, tkpWinBltModes[gc->function]);
+ 0, 0, (DWORD) tkpWinBltModes[gc->function]);
/*
* Destroy the temporary bitmap and restore the device context.
@@ -952,22 +1217,65 @@ Tk_DrawChars(
}
/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpDrawCharsInContext --
+ *
+ * Draw a string of characters on the screen like Tk_DrawChars(), but
+ * with access to all the characters on the line for context. On Windows
+ * this context isn't consulted, so we just call Tk_DrawChars().
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information gets drawn on the screen.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkpDrawCharsInContext(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ int rangeStart, /* Index of first byte to draw. */
+ int rangeLength, /* Length of range to draw in bytes. */
+ int x, int y) /* Coordinates at which to place origin of the
+ * whole (not just the range) string when
+ * drawing. */
+{
+ (void) numBytes; /*unused*/
+ Tk_DrawChars(display, drawable, gc, tkfont,
+ source + rangeStart, rangeLength, x, y);
+}
+
+/*
*-------------------------------------------------------------------------
*
* MultiFontTextOut --
*
- * Helper function for Tk_DrawChars. Draws characters, using the
- * various screen fonts in fontPtr to draw multilingual characters.
- * Note: No bidirectional support.
+ * Helper function for Tk_DrawChars. Draws characters, using the various
+ * screen fonts in fontPtr to draw multilingual characters. Note: No
+ * bidirectional support.
*
* Results:
* None.
*
* Side effects:
- * Information gets drawn on the screen.
- * Contents of fontPtr may be modified if more subfonts were loaded
- * in order to draw all the multilingual characters in the given
- * string.
+ * Information gets drawn on the screen. Contents of fontPtr may be
+ * modified if more subfonts were loaded in order to draw all the
+ * multilingual characters in the given string.
*
*-------------------------------------------------------------------------
*/
@@ -979,8 +1287,8 @@ MultiFontTextOut(
* following string. */
CONST char *source, /* Potentially multilingual UTF-8 string. */
int numBytes, /* Length of string in bytes. */
- int x, int y) /* Coordinates at which to place origin *
- * of string when drawing. */
+ int x, int y) /* Coordinates at which to place origin of
+ * string when drawing. */
{
Tcl_UniChar ch;
SIZE size;
@@ -997,27 +1305,27 @@ MultiFontTextOut(
end = source + numBytes;
for (p = source; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
- thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
- if (thisSubFontPtr != lastSubFontPtr) {
- if (p > source) {
+ next = p + Tcl_UtfToUniChar(p, &ch);
+ thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
+ if (thisSubFontPtr != lastSubFontPtr) {
+ if (p > source) {
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
- (*familyPtr->textOutProc)(hdc, x-(tm.tmOverhang/2), y,
+ (*familyPtr->textOutProc)(hdc, x-(tm.tmOverhang/2), y,
Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
- (*familyPtr->getTextExtentPoint32Proc)(hdc,
+ Tcl_DStringLength(&runString)>>familyPtr->isWideFont);
+ (*familyPtr->getTextExtentPoint32Proc)(hdc,
Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
+ Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
x += size.cx;
Tcl_DStringFree(&runString);
}
- lastSubFontPtr = thisSubFontPtr;
- source = p;
+ lastSubFontPtr = thisSubFontPtr;
+ source = p;
SelectObject(hdc, lastSubFontPtr->hFont);
- GetTextMetrics(hdc, &tm);
+ GetTextMetrics(hdc, &tm);
}
p = next;
}
@@ -1026,7 +1334,7 @@ MultiFontTextOut(
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
(*familyPtr->textOutProc)(hdc, x-(tm.tmOverhang/2), y,
- Tcl_DStringValue(&runString),
+ Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
Tcl_DStringFree(&runString);
}
@@ -1039,12 +1347,12 @@ MultiFontTextOut(
* InitFont --
*
* Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Initializes the memory for a new WinFont that wraps the
+ * Initializes the memory for a new WinFont that wraps the
* platform-specific data.
*
- * The caller is responsible for initializing the fields of the
- * WinFont that are used exclusively by the generic TkFont code, and
- * for releasing those fields before calling TkpDeleteFont().
+ * The caller is responsible for initializing the fields of the WinFont
+ * that are used exclusively by the generic TkFont code, and for
+ * releasing those fields before calling TkpDeleteFont().
*
* Results:
* Fills the WinFont structure.
@@ -1053,17 +1361,17 @@ MultiFontTextOut(
* Memory allocated.
*
*---------------------------------------------------------------------------
- */
+ */
static void
InitFont(
- Tk_Window tkwin, /* Main window of interp in which font will
- * be used, for getting HDC. */
+ Tk_Window tkwin, /* Main window of interp in which font will be
+ * used, for getting HDC. */
HFONT hFont, /* Windows token for font. */
- int overstrike, /* The overstrike attribute of logfont used
- * to allocate this font. For some reason,
- * the TEXTMETRICs may contain incorrect info
- * in the tmStruckOut field. */
+ int overstrike, /* The overstrike attribute of logfont used to
+ * allocate this font. For some reason, the
+ * TEXTMETRICs may contain incorrect info in
+ * the tmStruckOut field. */
WinFont *fontPtr) /* Filled with information constructed from
* the above arguments. */
{
@@ -1077,27 +1385,27 @@ InitFont(
Tcl_DString faceString;
TkFontAttributes *faPtr;
char buf[LF_FACESIZE * sizeof(WCHAR)];
-
- window = Tk_WindowId(tkwin);
- hwnd = (window == None) ? NULL : TkWinGetHWND(window);
- hdc = GetDC(hwnd);
+
+ window = Tk_WindowId(tkwin);
+ hwnd = (window == None) ? NULL : TkWinGetHWND(window);
+ hdc = GetDC(hwnd);
oldFont = SelectObject(hdc, hFont);
GetTextMetrics(hdc, &tm);
/*
- * On any version NT, there may fonts with international names.
- * Use the NT-only Unicode version of GetTextFace to get the font's
- * name. If we used the ANSI version on a non-internationalized
- * version of NT, we would get a font name with '?' replacing all
- * the international characters.
+ * On any version NT, there may fonts with international names. Use the
+ * NT-only Unicode version of GetTextFace to get the font's name. If we
+ * used the ANSI version on a non-internationalized version of NT, we
+ * would get a font name with '?' replacing all the international
+ * characters.
*
- * On a non-internationalized verson of 95, fonts with international
- * names are not allowed, so the ANSI version of GetTextFace will work.
- * On an internationalized version of 95, there may be fonts with
- * international names; the ANSI version will work, fetching the
- * name in the international system code page. Can't use the Unicode
- * version of GetTextFace because it only exists under NT.
+ * On a non-internationalized verson of 95, fonts with international names
+ * are not allowed, so the ANSI version of GetTextFace will work. On an
+ * internationalized version of 95, there may be fonts with international
+ * names; the ANSI version will work, fetching the name in the
+ * international system code page. Can't use the Unicode version of
+ * GetTextFace because it only exists under NT.
*/
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
@@ -1108,24 +1416,26 @@ InitFont(
Tcl_ExternalToUtfDString(systemEncoding, buf, -1, &faceString);
fontPtr->font.fid = (Font) fontPtr;
+ fontPtr->hwnd = hwnd;
+ fontPtr->pixelSize = tm.tmHeight - tm.tmInternalLeading;
faPtr = &fontPtr->font.fa;
faPtr->family = Tk_GetUid(Tcl_DStringValue(&faceString));
- faPtr->size = TkFontGetPoints(tkwin, -(tm.tmHeight - tm.tmInternalLeading));
- faPtr->weight = (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
+
+ faPtr->size =
+ TkFontGetPoints(tkwin, -(fontPtr->pixelSize));
+ faPtr->weight =
+ (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
faPtr->slant = (tm.tmItalic != 0) ? TK_FS_ITALIC : TK_FS_ROMAN;
faPtr->underline = (tm.tmUnderlined != 0) ? 1 : 0;
faPtr->overstrike = overstrike;
-
+
fmPtr = &fontPtr->font.fm;
fmPtr->ascent = tm.tmAscent;
fmPtr->descent = tm.tmDescent;
fmPtr->maxWidth = tm.tmMaxCharWidth;
fmPtr->fixed = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH);
- fontPtr->hwnd = hwnd;
- fontPtr->pixelSize = tm.tmHeight - tm.tmInternalLeading;
-
fontPtr->numSubFonts = 1;
fontPtr->subFontArray = fontPtr->staticSubFonts;
InitSubFont(hdc, hFont, 1, &fontPtr->subFontArray[0]);
@@ -1135,7 +1445,7 @@ InitFont(
GetCharWidthW(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
} else {
GetCharWidthA(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
- }
+ }
Tcl_DStringFree(&faceString);
SelectObject(hdc, oldFont);
@@ -1146,10 +1456,9 @@ InitFont(
*-------------------------------------------------------------------------
*
* ReleaseFont --
- *
- * Called to release the windows-specific contents of a TkFont.
- * The caller is responsible for freeing the memory used by the
- * font itself.
+ *
+ * Called to release the windows-specific contents of a TkFont. The
+ * caller is responsible for freeing the memory used by the font itself.
*
* Results:
* None.
@@ -1159,7 +1468,7 @@ InitFont(
*
*---------------------------------------------------------------------------
*/
-
+
static void
ReleaseFont(
WinFont *fontPtr) /* The font to delete. */
@@ -1179,9 +1488,9 @@ ReleaseFont(
*
* InitSubFont --
*
- * Wrap a screen font and load the FontFamily that represents
- * it. Used to prepare a SubFont so that characters can be mapped
- * from UTF-8 to the charset of the font.
+ * Wrap a screen font and load the FontFamily that represents it. Used to
+ * prepare a SubFont so that characters can be mapped from UTF-8 to the
+ * charset of the font.
*
* Results:
* The subFontPtr is filled with information about the font.
@@ -1196,10 +1505,10 @@ static void
InitSubFont(
HDC hdc, /* HDC in which font can be selected. */
HFONT hFont, /* The screen font. */
- int base, /* Non-zero if this SubFont is being used
- * as the base font for a font object. */
- SubFont *subFontPtr) /* Filled with SubFont constructed from
- * above attributes. */
+ int base, /* Non-zero if this SubFont is being used as
+ * the base font for a font object. */
+ SubFont *subFontPtr) /* Filled with SubFont constructed from above
+ * attributes. */
{
subFontPtr->hFont = hFont;
subFontPtr->familyPtr = AllocFontFamily(hdc, hFont, base);
@@ -1211,8 +1520,8 @@ InitSubFont(
*
* ReleaseSubFont --
*
- * Called to release the contents of a SubFont. The caller is
- * responsible for freeing the memory used by the SubFont itself.
+ * Called to release the contents of a SubFont. The caller is responsible
+ * for freeing the memory used by the SubFont itself.
*
* Results:
* None.
@@ -1236,26 +1545,24 @@ ReleaseSubFont(
*
* AllocFontFamily --
*
- * Find the FontFamily structure associated with the given font
- * name. The information should be stored by the caller in a
- * SubFont and used when determining if that SubFont supports a
- * character.
+ * Find the FontFamily structure associated with the given font name. The
+ * information should be stored by the caller in a SubFont and used when
+ * determining if that SubFont supports a character.
*
- * Cannot use the string name used to construct the font as the
- * key, because the capitalization may not be canonical. Therefore
- * use the face name actually retrieved from the font metrics as
- * the key.
+ * Cannot use the string name used to construct the font as the key,
+ * because the capitalization may not be canonical. Therefore use the
+ * face name actually retrieved from the font metrics as the key.
*
* Results:
- * A pointer to a FontFamily. The reference count in the FontFamily
- * is automatically incremented. When the SubFont is released, the
- * reference count is decremented. When no SubFont is using this
- * FontFamily, it may be deleted.
+ * A pointer to a FontFamily. The reference count in the FontFamily is
+ * automatically incremented. When the SubFont is released, the reference
+ * count is decremented. When no SubFont is using this FontFamily, it may
+ * be deleted.
*
* Side effects:
- * A new FontFamily structure will be allocated if this font family
- * has not been seen. TrueType character existence metrics are
- * loaded into the FontFamily structure.
+ * A new FontFamily structure will be allocated if this font family has
+ * not been seen. TrueType character existence metrics are loaded into
+ * the FontFamily structure.
*
*-------------------------------------------------------------------------
*/
@@ -1265,16 +1572,16 @@ AllocFontFamily(
HDC hdc, /* HDC in which font can be selected. */
HFONT hFont, /* Screen font whose FontFamily is to be
* returned. */
- int base) /* Non-zero if this font family is to be
- * used in the base font of a font object. */
+ int base) /* Non-zero if this font family is to be used
+ * in the base font of a font object. */
{
Tk_Uid faceName;
FontFamily *familyPtr;
Tcl_DString faceString;
Tcl_Encoding encoding;
char buf[LF_FACESIZE * sizeof(WCHAR)];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
hFont = SelectObject(hdc, hFont);
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
@@ -1287,7 +1594,7 @@ AllocFontFamily(
Tcl_DStringFree(&faceString);
hFont = SelectObject(hdc, hFont);
- familyPtr = tsdPtr->fontFamilyList;
+ familyPtr = tsdPtr->fontFamilyList;
for ( ; familyPtr != NULL; familyPtr = familyPtr->nextPtr) {
if (familyPtr->faceName == faceName) {
familyPtr->refCount++;
@@ -1300,38 +1607,38 @@ AllocFontFamily(
familyPtr->nextPtr = tsdPtr->fontFamilyList;
tsdPtr->fontFamilyList = familyPtr;
- /*
- * Set key for this FontFamily.
+ /*
+ * Set key for this FontFamily.
*/
familyPtr->faceName = faceName;
- /*
- * An initial refCount of 2 means that FontFamily information will
- * persist even when the SubFont that loaded the FontFamily is released.
- * Change it to 1 to cause FontFamilies to be unloaded when not in use.
+ /*
+ * An initial refCount of 2 means that FontFamily information will persist
+ * even when the SubFont that loaded the FontFamily is released. Change it
+ * to 1 to cause FontFamilies to be unloaded when not in use.
*/
familyPtr->refCount = 2;
- familyPtr->segCount = LoadFontRanges(hdc, hFont, &familyPtr->startCount,
+ familyPtr->segCount = LoadFontRanges(hdc, hFont, &familyPtr->startCount,
&familyPtr->endCount, &familyPtr->isSymbolFont);
encoding = NULL;
if (familyPtr->isSymbolFont != 0) {
/*
- * Symbol fonts are handled specially. For instance, Unicode 0393
+ * Symbol fonts are handled specially. For instance, Unicode 0393
* (GREEK CAPITAL GAMMA) must be mapped to Symbol character 0047
- * (GREEK CAPITAL GAMMA), because the Symbol font doesn't have a
- * GREEK CAPITAL GAMMA at location 0393. If Tk interpreted the
- * Symbol font using the Unicode encoding, it would decide that
- * the Symbol font has no GREEK CAPITAL GAMMA, because the Symbol
- * encoding (of course) reports that character 0393 doesn't exist.
+ * (GREEK CAPITAL GAMMA), because the Symbol font doesn't have a GREEK
+ * CAPITAL GAMMA at location 0393. If Tk interpreted the Symbol font
+ * using the Unicode encoding, it would decide that the Symbol font
+ * has no GREEK CAPITAL GAMMA, because the Symbol encoding (of course)
+ * reports that character 0393 doesn't exist.
*
- * With non-symbol Windows fonts, such as Times New Roman, if the
- * font has a GREEK CAPITAL GAMMA, it will be found in the correct
- * Unicode location (0393); the GREEK CAPITAL GAMMA will not be off
- * hiding at some other location.
+ * With non-symbol Windows fonts, such as Times New Roman, if the font
+ * has a GREEK CAPITAL GAMMA, it will be found in the correct Unicode
+ * location (0393); the GREEK CAPITAL GAMMA will not be off hiding at
+ * some other location.
*/
encoding = Tcl_GetEncoding(NULL, faceName);
@@ -1341,16 +1648,16 @@ AllocFontFamily(
encoding = Tcl_GetEncoding(NULL, "unicode");
familyPtr->textOutProc =
(BOOL (WINAPI *)(HDC, int, int, TCHAR *, int)) TextOutW;
- familyPtr->getTextExtentPoint32Proc =
+ familyPtr->getTextExtentPoint32Proc =
(BOOL (WINAPI *)(HDC, TCHAR *, int, LPSIZE)) GetTextExtentPoint32W;
familyPtr->isWideFont = 1;
} else {
- familyPtr->textOutProc =
+ familyPtr->textOutProc =
(BOOL (WINAPI *)(HDC, int, int, TCHAR *, int)) TextOutA;
- familyPtr->getTextExtentPoint32Proc =
+ familyPtr->getTextExtentPoint32Proc =
(BOOL (WINAPI *)(HDC, TCHAR *, int, LPSIZE)) GetTextExtentPoint32A;
familyPtr->isWideFont = 0;
- }
+ }
familyPtr->encoding = encoding;
@@ -1374,27 +1681,27 @@ AllocFontFamily(
*
*-------------------------------------------------------------------------
*/
-
+
static void
FreeFontFamily(
FontFamily *familyPtr) /* The FontFamily to delete. */
{
int i;
FontFamily **familyPtrPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (familyPtr == NULL) {
- return;
+ return;
}
familyPtr->refCount--;
if (familyPtr->refCount > 0) {
return;
}
for (i = 0; i < FONTMAP_PAGES; i++) {
- if (familyPtr->fontMap[i] != NULL) {
- ckfree(familyPtr->fontMap[i]);
- }
+ if (familyPtr->fontMap[i] != NULL) {
+ ckfree(familyPtr->fontMap[i]);
+ }
}
if (familyPtr->startCount != NULL) {
ckfree((char *) familyPtr->startCount);
@@ -1405,19 +1712,19 @@ FreeFontFamily(
if (familyPtr->encoding != TkWinGetUnicodeEncoding()) {
Tcl_FreeEncoding(familyPtr->encoding);
}
-
- /*
- * Delete from list.
+
+ /*
+ * Delete from list.
*/
-
+
for (familyPtrPtr = &tsdPtr->fontFamilyList; ; ) {
- if (*familyPtrPtr == familyPtr) {
+ if (*familyPtrPtr == familyPtr) {
*familyPtrPtr = familyPtr->nextPtr;
break;
}
familyPtrPtr = &(*familyPtrPtr)->nextPtr;
}
-
+
ckfree((char *) familyPtr);
}
@@ -1426,19 +1733,17 @@ FreeFontFamily(
*
* FindSubFontForChar --
*
- * Determine which screen font is necessary to use to display the
- * given character. If the font object does not have a screen font
- * that can display the character, another screen font may be loaded
- * into the font object, following a set of preferred fallback rules.
+ * Determine which screen font is necessary to use to display the given
+ * character. If the font object does not have a screen font that can
+ * display the character, another screen font may be loaded into the font
+ * object, following a set of preferred fallback rules.
*
* Results:
- * The return value is the SubFont to use to display the given
- * character.
+ * The return value is the SubFont to use to display the given character.
*
* Side effects:
- * The contents of fontPtr are modified to cache the results
- * of the lookup and remember any SubFonts that were dynamically
- * loaded.
+ * The contents of fontPtr are modified to cache the results of the
+ * lookup and remember any SubFonts that were dynamically loaded.
*
*-------------------------------------------------------------------------
*/
@@ -1459,7 +1764,7 @@ FindSubFontForChar(
char *fallbackName;
SubFont *subFontPtr;
Tcl_DString ds;
-
+
if (ch < BASE_CHARS) {
return &fontPtr->subFontArray[0];
}
@@ -1471,13 +1776,13 @@ FindSubFontForChar(
}
/*
- * Keep track of all face names that we check, so we don't check some
- * name multiple times if it can be reached by multiple paths.
+ * Keep track of all face names that we check, so we don't check some name
+ * multiple times if it can be reached by multiple paths.
*/
-
+
Tcl_DStringInit(&ds);
hdc = GetDC(fontPtr->hwnd);
-
+
aliases = TkFontGetAliasList(fontPtr->font.fa.family);
fontFallbacks = TkFontGetFallbacks();
@@ -1491,25 +1796,25 @@ FindSubFontForChar(
goto tryfallbacks;
} else if (aliases != NULL) {
- /*
+ /*
* Or if an alias for the base font has a fallback...
*/
for (k = 0; aliases[k] != NULL; k++) {
if (strcasecmp(aliases[k], fallbackName) == 0) {
- goto tryfallbacks;
+ goto tryfallbacks;
}
}
}
}
continue;
- /*
- * ...then see if we can use one of the fallbacks, or an
- * alias for one of the fallbacks.
+ /*
+ * ...then see if we can use one of the fallbacks, or an alias for one
+ * of the fallbacks.
*/
- tryfallbacks:
+ tryfallbacks:
for (j = 0; fontFallbacks[i][j] != NULL; j++) {
fallbackName = fontFallbacks[i][j];
subFontPtr = CanUseFallbackWithAliases(hdc, fontPtr, fallbackName,
@@ -1521,13 +1826,13 @@ FindSubFontForChar(
}
/*
- * See if we can use something from the global fallback list.
+ * See if we can use something from the global fallback list.
*/
anyFallbacks = TkFontGetGlobalClass();
for (i = 0; anyFallbacks[i] != NULL; i++) {
fallbackName = anyFallbacks[i];
- subFontPtr = CanUseFallbackWithAliases(hdc, fontPtr, fallbackName,
+ subFontPtr = CanUseFallbackWithAliases(hdc, fontPtr, fallbackName,
ch, &ds, subFontPtrPtr);
if (subFontPtr != NULL) {
goto end;
@@ -1535,8 +1840,8 @@ FindSubFontForChar(
}
/*
- * Try all face names available in the whole system until we
- * find one that can be used.
+ * Try all face names available in the whole system until we find one that
+ * can be used.
*/
canUse.hdc = hdc;
@@ -1554,22 +1859,22 @@ FindSubFontForChar(
}
subFontPtr = canUse.subFontPtr;
- end:
+ end:
Tcl_DStringFree(&ds);
-
+
if (subFontPtr == NULL) {
- /*
- * No font can display this character. We will use the base font
- * and have it display the "unknown" character.
- */
+ /*
+ * No font can display this character. We will use the base font and
+ * have it display the "unknown" character.
+ */
subFontPtr = &fontPtr->subFontArray[0];
- FontMapInsert(subFontPtr, ch);
+ FontMapInsert(subFontPtr, ch);
}
ReleaseDC(fontPtr->hwnd, hdc);
return subFontPtr;
}
-
+
static int CALLBACK
WinFontCanUseProc(
ENUMLOGFONT *lfPtr, /* Logical-font data. */
@@ -1617,15 +1922,14 @@ WinFontCanUseProc(
* See if the screen font can display the given character.
*
* Results:
- * The return value is 0 if the screen font cannot display the
- * character, non-zero otherwise.
+ * The return value is 0 if the screen font cannot display the character,
+ * non-zero otherwise.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ * New pages are added to the font mapping cache whenever the character
+ * belongs to a page that hasn't been seen before. When a page is loaded,
+ * information about all the characters on that page is stored, not just
+ * for the single character in question.
*
*-------------------------------------------------------------------------
*/
@@ -1651,29 +1955,28 @@ FontMapLookup(
*
* FontMapInsert --
*
- * Tell the font mapping cache that the given screen font should be
- * used to display the specified character. This is called when no
- * font on the system can be be found that can display that
- * character; we lie to the font and tell it that it can display
- * the character, otherwise we would end up re-searching the entire
- * fallback hierarchy every time that character was seen.
+ * Tell the font mapping cache that the given screen font should be used
+ * to display the specified character. This is called when no font on the
+ * system can be be found that can display that character; we lie to the
+ * font and tell it that it can display the character, otherwise we would
+ * end up re-searching the entire fallback hierarchy every time that
+ * character was seen.
*
* Results:
* None.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ * New pages are added to the font mapping cache whenever the character
+ * belongs to a page that hasn't been seen before. When a page is loaded,
+ * information about all the characters on that page is stored, not just
+ * for the single character in question.
*
*-------------------------------------------------------------------------
*/
static void
FontMapInsert(
- SubFont *subFontPtr, /* Contains font mapping cache to be
+ SubFont *subFontPtr, /* Contains font mapping cache to be
* updated. */
int ch) /* Character to be added to cache. */
{
@@ -1692,10 +1995,10 @@ FontMapInsert(
*
* FontMapLoadPage --
*
- * Load information about all the characters on a given page.
- * This information consists of one bit per character that indicates
- * whether the associated HFONT can (1) or cannot (0) display the
- * characters on the page.
+ * Load information about all the characters on a given page. This
+ * information consists of one bit per character that indicates whether
+ * the associated HFONT can (1) or cannot (0) display the characters on
+ * the page.
*
* Results:
* None.
@@ -1705,12 +2008,13 @@ FontMapInsert(
*
*-------------------------------------------------------------------------
*/
-static void
+
+static void
FontMapLoadPage(
- SubFont *subFontPtr, /* Contains font mapping cache to be
+ SubFont *subFontPtr, /* Contains font mapping cache to be
* updated. */
- int row) /* Index of the page to be loaded into
- * the cache. */
+ int row) /* Index of the page to be loaded into the
+ * cache. */
{
FontFamily *familyPtr;
Tcl_Encoding encoding;
@@ -1726,9 +2030,9 @@ FontMapLoadPage(
if (familyPtr->encoding == TkWinGetUnicodeEncoding()) {
/*
- * Font is Unicode. Few fonts are going to have all characters, so
- * examine the TrueType character existence metrics to determine
- * what characters actually exist in this font.
+ * Font is Unicode. Few fonts are going to have all characters, so
+ * examine the TrueType character existence metrics to determine what
+ * characters actually exist in this font.
*/
segCount = familyPtr->segCount;
@@ -1750,24 +2054,23 @@ FontMapLoadPage(
}
} else if (familyPtr->isSymbolFont) {
/*
- * Assume that a symbol font with a known encoding has all the
- * characters that its encoding claims it supports.
- *
- * The test for "encoding == unicodeEncoding"
- * must occur before this case, to catch all symbol fonts (such
- * as {Comic Sans MS} or Wingdings) for which we don't have
- * encoding information; those symbol fonts are treated as if
- * they were in the Unicode encoding and their symbolic
- * character existence metrics are treated as if they were Unicode
- * character existence metrics. This way, although we don't know
- * the proper Unicode -> symbol font mapping, we can install the
- * symbol font as the base font and access its glyphs.
+ * Assume that a symbol font with a known encoding has all the
+ * characters that its encoding claims it supports.
+ *
+ * The test for "encoding == unicodeEncoding" must occur before this
+ * case, to catch all symbol fonts (such as {Comic Sans MS} or
+ * Wingdings) for which we don't have encoding information; those
+ * symbol fonts are treated as if they were in the Unicode encoding
+ * and their symbolic character existence metrics are treated as if
+ * they were Unicode character existence metrics. This way, although
+ * we don't know the proper Unicode -> symbol font mapping, we can
+ * install the symbol font as the base font and access its glyphs.
*/
- end = (row + 1) << FONTMAP_SHIFT;
+ end = (row + 1) << FONTMAP_SHIFT;
for (i = row << FONTMAP_SHIFT; i < end; i++) {
- if (Tcl_UtfToExternal(NULL, encoding, src,
- Tcl_UniCharToUtf(i, src), TCL_ENCODING_STOPONERROR, NULL,
+ if (Tcl_UtfToExternal(NULL, encoding, src,
+ Tcl_UniCharToUtf(i, src), TCL_ENCODING_STOPONERROR, NULL,
buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK) {
continue;
}
@@ -1782,18 +2085,16 @@ FontMapLoadPage(
*
* CanUseFallbackWithAliases --
*
- * Helper function for FindSubFontForChar. Determine if the
- * specified face name (or an alias of the specified face name)
- * can be used to construct a screen font that can display the
- * given character.
+ * Helper function for FindSubFontForChar. Determine if the specified
+ * face name (or an alias of the specified face name) can be used to
+ * construct a screen font that can display the given character.
*
* Results:
* See CanUseFallback().
*
* Side effects:
- * If the name and/or one of its aliases was rejected, the
- * rejected string is recorded in nameTriedPtr so that it won't
- * be tried again.
+ * If the name and/or one of its aliases was rejected, the rejected
+ * string is recorded in nameTriedPtr so that it won't be tried again.
*
*---------------------------------------------------------------------------
*/
@@ -1804,11 +2105,11 @@ CanUseFallbackWithAliases(
WinFont *fontPtr, /* The font object that will own the new
* screen font. */
char *faceName, /* Desired face name for new screen font. */
- int ch, /* The Unicode character that the new
- * screen font must be able to display. */
- Tcl_DString *nameTriedPtr, /* Records face names that have already
- * been tried. It is possible for the same
- * face name to be queried multiple times when
+ int ch, /* The Unicode character that the new screen
+ * font must be able to display. */
+ Tcl_DString *nameTriedPtr, /* Records face names that have already been
+ * tried. It is possible for the same face
+ * name to be queried multiple times when
* trying to find a suitable screen font. */
SubFont **subFontPtrPtr) /* Variable to fixup if we reallocate the
* array of subfonts. */
@@ -1816,7 +2117,7 @@ CanUseFallbackWithAliases(
int i;
char **aliases;
SubFont *subFontPtr;
-
+
if (SeenName(faceName, nameTriedPtr) == 0) {
subFontPtr = CanUseFallback(hdc, fontPtr, faceName, ch, subFontPtrPtr);
if (subFontPtr != NULL) {
@@ -1843,9 +2144,9 @@ CanUseFallbackWithAliases(
*
* SeenName --
*
- * Used to determine we have already tried and rejected the given
- * face name when looking for a screen font that can support some
- * Unicode character.
+ * Used to determine we have already tried and rejected the given face
+ * name when looking for a screen font that can support some Unicode
+ * character.
*
* Results:
* The return value is 0 if this face name has not already been seen,
@@ -1882,21 +2183,21 @@ SeenName(
*
* CanUseFallback --
*
- * If the specified screen font has not already been loaded into
- * the font object, determine if it can display the given character.
+ * If the specified screen font has not already been loaded into the font
+ * object, determine if it can display the given character.
*
* Results:
- * The return value is a pointer to a newly allocated SubFont, owned
- * by the font object. This SubFont can be used to display the given
- * character. The SubFont represents the screen font with the base set
- * of font attributes from the font object, but using the specified
- * font name. NULL is returned if the font object already holds
- * a reference to the specified physical font or if the specified
- * physical font cannot display the given character.
- *
- * Side effects:
- * The font object's subFontArray is updated to contain a reference
- * to the newly allocated SubFont.
+ * The return value is a pointer to a newly allocated SubFont, owned by
+ * the font object. This SubFont can be used to display the given
+ * character. The SubFont represents the screen font with the base set of
+ * font attributes from the font object, but using the specified font
+ * name. NULL is returned if the font object already holds a reference to
+ * the specified physical font or if the specified physical font cannot
+ * display the given character.
+ *
+ * Side effects:
+ * The font object's subFontArray is updated to contain a reference to
+ * the newly allocated SubFont.
*
*-------------------------------------------------------------------------
*/
@@ -1907,8 +2208,8 @@ CanUseFallback(
WinFont *fontPtr, /* The font object that will own the new
* screen font. */
char *faceName, /* Desired face name for new screen font. */
- int ch, /* The Unicode character that the new
- * screen font must be able to display. */
+ int ch, /* The Unicode character that the new screen
+ * font must be able to display. */
SubFont **subFontPtrPtr) /* Variable to fix-up if we realloc the array
* of subfonts. */
{
@@ -1920,10 +2221,10 @@ CanUseFallback(
return NULL;
}
- /*
+ /*
* Skip all fonts we've already used.
*/
-
+
for (i = 0; i < fontPtr->numSubFonts; i++) {
if (faceName == fontPtr->subFontArray[i].familyPtr->faceName) {
return NULL;
@@ -1936,7 +2237,7 @@ CanUseFallback(
hFont = GetScreenFont(&fontPtr->font.fa, faceName, fontPtr->pixelSize);
InitSubFont(hdc, hFont, 0, &subFont);
- if (((ch < 256) && (subFont.familyPtr->isSymbolFont))
+ if (((ch < 256) && (subFont.familyPtr->isSymbolFont))
|| (FontMapLookup(&subFont, ch) == 0)) {
/*
* Don't use a symbol font as a fallback font for characters below
@@ -1950,17 +2251,19 @@ CanUseFallback(
if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
SubFont *newPtr;
- newPtr = (SubFont *) ckalloc(sizeof(SubFont)
+ newPtr = (SubFont *) ckalloc(sizeof(SubFont)
* (fontPtr->numSubFonts + 1));
memcpy((char *) newPtr, fontPtr->subFontArray,
fontPtr->numSubFonts * sizeof(SubFont));
if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
ckfree((char *) fontPtr->subFontArray);
}
+
/*
- * Fix up the variable pointed to by subFontPtrPtr so it still
- * points into the live array. [Bug 618872]
+ * Fix up the variable pointed to by subFontPtrPtr so it still points
+ * into the live array. [Bug 618872]
*/
+
*subFontPtrPtr = newPtr + (*subFontPtrPtr - fontPtr->subFontArray);
fontPtr->subFontArray = newPtr;
}
@@ -1974,9 +2277,8 @@ CanUseFallback(
*
* GetScreenFont --
*
- * Given the name and other attributes, construct an HFONT.
- * This is where all the alias and fallback substitution bottoms
- * out.
+ * Given the name and other attributes, construct an HFONT. This is where
+ * all the alias and fallback substitution bottoms out.
*
* Results:
* The screen font that corresponds to the attributes.
@@ -1987,13 +2289,13 @@ CanUseFallback(
*---------------------------------------------------------------------------
*/
-static HFONT
+static HFONT
GetScreenFont(
CONST TkFontAttributes *faPtr,
/* Desired font attributes for new HFONT. */
CONST char *faceName, /* Overrides font family specified in font
* attributes. */
- int pixelSize) /* Overrides size specified in font
+ int pixelSize) /* Overrides size specified in font
* attributes. */
{
Tcl_DString ds;
@@ -2005,7 +2307,7 @@ GetScreenFont(
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
- lf.lfWeight = (faPtr->weight == TK_FW_NORMAL) ? FW_NORMAL : FW_BOLD;
+ lf.lfWeight = (faPtr->weight == TK_FW_NORMAL) ? FW_NORMAL : FW_BOLD;
lf.lfItalic = faPtr->slant;
lf.lfUnderline = faPtr->underline;
lf.lfStrikeOut = faPtr->overstrike;
@@ -2023,7 +2325,8 @@ GetScreenFont(
/*
* We can only store up to LF_FACESIZE wide characters
*/
- if (Tcl_DStringLength(&ds) >= (LF_FACESIZE * sizeof(WCHAR))) {
+
+ if ((size_t)Tcl_DStringLength(&ds) >= (LF_FACESIZE * sizeof(WCHAR))) {
Tcl_DStringSetLength(&ds, LF_FACESIZE);
}
src = (Tcl_UniChar *) Tcl_DStringValue(&ds);
@@ -2037,6 +2340,7 @@ GetScreenFont(
/*
* We can only store up to LF_FACESIZE characters
*/
+
if (Tcl_DStringLength(&ds) >= LF_FACESIZE) {
Tcl_DStringSetLength(&ds, LF_FACESIZE);
}
@@ -2052,10 +2356,9 @@ GetScreenFont(
*
* FamilyExists, FamilyOrAliasExists, WinFontExistsProc --
*
- * Determines if any physical screen font exists on the system with
- * the given family name. If the family exists, then it should be
- * possible to construct some physical screen font with that family
- * name.
+ * Determines if any physical screen font exists on the system with the
+ * given family name. If the family exists, then it should be possible to
+ * construct some physical screen font with that family name.
*
* Results:
* The return value is 0 if the specified font family does not exist,
@@ -2077,7 +2380,7 @@ FamilyExists(
/*
* Just immediately rule out the following fonts, because they look so
- * ugly on windows. The caller's fallback mechanism will cause the
+ * ugly on windows. The caller's fallback mechanism will cause the
* corresponding appropriate TrueType fonts to be selected.
*/
@@ -2090,18 +2393,18 @@ FamilyExists(
if (strcasecmp(faceName, "Helvetica") == 0) {
return 0;
}
-
+
Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &faceString);
/*
- * If the family exists, WinFontExistProc() will be called and
- * EnumFontFamilies() will return whatever WinFontExistProc() returns.
- * If the family doesn't exist, EnumFontFamilies() will just return a
+ * If the family exists, WinFontExistProc() will be called and
+ * EnumFontFamilies() will return whatever WinFontExistProc() returns. If
+ * the family doesn't exist, EnumFontFamilies() will just return a
* non-zero value.
*/
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- result = EnumFontFamiliesW(hdc, (WCHAR *) Tcl_DStringValue(&faceString),
+ result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
(FONTENUMPROCW) WinFontExistProc, 0);
} else {
result = EnumFontFamiliesA(hdc, (char *) Tcl_DStringValue(&faceString),
@@ -2110,10 +2413,10 @@ FamilyExists(
Tcl_DStringFree(&faceString);
return (result == 0);
}
-
+
static char *
FamilyOrAliasExists(
- HDC hdc,
+ HDC hdc,
CONST char *faceName)
{
char **aliases;
@@ -2132,7 +2435,7 @@ FamilyOrAliasExists(
}
return NULL;
}
-
+
static int CALLBACK
WinFontExistProc(
ENUMLOGFONT *lfPtr, /* Logical-font data. */
@@ -2158,25 +2461,25 @@ typedef struct CMAPTABLE {
} CMAPTABLE;
typedef struct ENCODINGTABLE {
- USHORT platform; /* Platform for which data is targeted.
- * 3 means data is for Windows. */
- USHORT encoding; /* How characters in font are encoded.
- * 1 means that the following subtable is
- * keyed based on Unicode. */
- ULONG offset; /* Byte offset from beginning of CMAPTABLE
- * to the subtable for this encoding. */
+ USHORT platform; /* Platform for which data is targeted. 3
+ * means data is for Windows. */
+ USHORT encoding; /* How characters in font are encoded. 1 means
+ * that the following subtable is keyed based
+ * on Unicode. */
+ ULONG offset; /* Byte offset from beginning of CMAPTABLE to
+ * the subtable for this encoding. */
} ENCODINGTABLE;
typedef struct ANYTABLE {
USHORT format; /* Format number. */
- USHORT length; /* The actual length in bytes of this
+ USHORT length; /* The actual length in bytes of this
* subtable. */
USHORT version; /* Version number (starts at 0). */
} ANYTABLE;
typedef struct BYTETABLE {
USHORT format; /* Format number is set to 0. */
- USHORT length; /* The actual length in bytes of this
+ USHORT length; /* The actual length in bytes of this
* subtable. */
USHORT version; /* Version number (starts at 0). */
BYTE glyphIdArray[256]; /* Array that maps up to 256 single-byte char
@@ -2187,7 +2490,7 @@ typedef struct SUBHEADER {
USHORT firstCode; /* First valid low byte for subHeader. */
USHORT entryCount; /* Number valid low bytes for subHeader. */
SHORT idDelta; /* Constant adder to get base glyph index. */
- USHORT idRangeOffset; /* Byte offset from here to appropriate
+ USHORT idRangeOffset; /* Byte offset from here to appropriate
* glyphIndexArray. */
} SUBHEADER;
@@ -2196,12 +2499,12 @@ typedef struct HIBYTETABLE {
USHORT length; /* The actual length in bytes of this
* subtable. */
USHORT version; /* Version number (starts at 0). */
- USHORT subHeaderKeys[256]; /* Maps high bytes to subHeaders: value is
+ USHORT subHeaderKeys[256]; /* Maps high bytes to subHeaders: value is
* subHeader index * 8. */
#if 0
SUBHEADER subHeaders[]; /* Variable-length array of SUBHEADERs. */
- USHORT glyphIndexArray[]; /* Variable-length array containing subarrays
- * used for mapping the low byte of 2-byte
+ USHORT glyphIndexArray[]; /* Variable-length array containing subarrays
+ * used for mapping the low byte of 2-byte
* characters. */
#endif
} HIBYTETABLE;
@@ -2233,8 +2536,8 @@ typedef struct TRIMMEDTABLE {
USHORT firstCode; /* First character code of subrange. */
USHORT entryCount; /* Number of character codes in subrange. */
#if 0
- USHORT glyphIdArray[]; /* Array of glyph index values for
- character codes in the range. */
+ USHORT glyphIdArray[]; /* Array of glyph index values for
+ * character codes in the range. */
#endif
} TRIMMEDTABLE;
@@ -2253,16 +2556,16 @@ typedef union SUBTABLE {
*
* LoadFontRanges --
*
- * Given an HFONT, get the information about the characters that
- * this font can display.
+ * Given an HFONT, get the information about the characters that this
+ * font can display.
*
* Results:
- * If the font has no Unicode character information, the return value
- * is 0 and *startCountPtr and *endCountPtr are filled with NULL.
- * Otherwise, *startCountPtr and *endCountPtr are set to pointers to
- * arrays of TrueType character existence information and the return
- * value is the length of the arrays (the two arrays are always the
- * same length as each other).
+ * If the font has no Unicode character information, the return value is
+ * 0 and *startCountPtr and *endCountPtr are filled with NULL. Otherwise,
+ * *startCountPtr and *endCountPtr are set to pointers to arrays of
+ * TrueType character existence information and the return value is the
+ * length of the arrays (the two arrays are always the same length as
+ * each other).
*
* Side effects:
* None.
@@ -2274,10 +2577,10 @@ static int
LoadFontRanges(
HDC hdc, /* HDC into which font can be selected. */
HFONT hFont, /* HFONT to query. */
- USHORT **startCountPtr, /* Filled with malloced pointer to
- * character range information. */
- USHORT **endCountPtr, /* Filled with malloced pointer to
- * character range information. */
+ USHORT **startCountPtr, /* Filled with malloced pointer to character
+ * range information. */
+ USHORT **endCountPtr, /* Filled with malloced pointer to character
+ * range information. */
int *symbolPtr)
{
int n, i, swapped, offset, cbData, segCount;
@@ -2310,20 +2613,21 @@ LoadFontRanges(
}
n = GetFontData(hdc, cmapKey, 0, &cmapTable, sizeof(cmapTable));
- if (n != GDI_ERROR) {
+ if (n != (int)GDI_ERROR) {
if (swapped) {
SwapShort(&cmapTable.numTables);
}
for (i = 0; i < cmapTable.numTables; i++) {
offset = sizeof(cmapTable) + i * sizeof(encTable);
- GetFontData(hdc, cmapKey, offset, &encTable, sizeof(encTable));
+ GetFontData(hdc, cmapKey, (DWORD) offset, &encTable,
+ sizeof(encTable));
if (swapped) {
SwapShort(&encTable.platform);
SwapShort(&encTable.encoding);
SwapLong(&encTable.offset);
}
if (encTable.platform != 3) {
- /*
+ /*
* Not Microsoft encoding.
*/
@@ -2335,7 +2639,7 @@ LoadFontRanges(
continue;
}
- GetFontData(hdc, cmapKey, encTable.offset, &subTable,
+ GetFontData(hdc, cmapKey, (DWORD) encTable.offset, &subTable,
sizeof(subTable));
if (swapped) {
SwapShort(&subTable.any.format);
@@ -2347,13 +2651,13 @@ LoadFontRanges(
segCount = subTable.segment.segCountX2 / 2;
cbData = segCount * sizeof(USHORT);
- startCount = (USHORT *) ckalloc(cbData);
- endCount = (USHORT *) ckalloc(cbData);
+ startCount = (USHORT *) ckalloc((unsigned)cbData);
+ endCount = (USHORT *) ckalloc((unsigned)cbData);
offset = encTable.offset + sizeof(subTable.segment);
- GetFontData(hdc, cmapKey, offset, endCount, cbData);
+ GetFontData(hdc, cmapKey, (DWORD) offset, endCount, cbData);
offset += cbData + sizeof(USHORT);
- GetFontData(hdc, cmapKey, offset, startCount, cbData);
+ GetFontData(hdc, cmapKey, (DWORD) offset, startCount, cbData);
if (swapped) {
for (i = 0; i < segCount; i++) {
SwapShort(&endCount[i]);
@@ -2362,16 +2666,15 @@ LoadFontRanges(
}
if (*symbolPtr != 0) {
/*
- * Empirically determined: When a symbol font is
- * loaded, the character existence metrics obtained
- * from the system are mildly wrong. If the real range
- * of the symbol font is from 0020 to 00FE, then the
- * metrics are reported as F020 to F0FE. When we load
- * a symbol font, we must fix the character existence
- * metrics.
+ * Empirically determined: When a symbol font is loaded,
+ * the character existence metrics obtained from the
+ * system are mildly wrong. If the real range of the
+ * symbol font is from 0020 to 00FE, then the metrics are
+ * reported as F020 to F0FE. When we load a symbol font,
+ * we must fix the character existence metrics.
*
- * Symbol fonts should only use the symbol encoding
- * for 8-bit characters [note Bug: 2406]
+ * Symbol fonts should only use the symbol encoding for
+ * 8-bit characters [note Bug: 2406]
*/
for (i = 0; i < segCount; i++) {
@@ -2386,13 +2689,14 @@ LoadFontRanges(
}
} else if (GetTextCharset(hdc) == ANSI_CHARSET) {
/*
- * Bitmap font. We should also support ranges for the other
- * *_CHARSET values.
+ * Bitmap font. We should also support ranges for the other *_CHARSET
+ * values.
*/
+
segCount = 1;
cbData = segCount * sizeof(USHORT);
- startCount = (USHORT *) ckalloc(cbData);
- endCount = (USHORT *) ckalloc(cbData);
+ startCount = (USHORT *) ckalloc((unsigned) cbData);
+ endCount = (USHORT *) ckalloc((unsigned) cbData);
startCount[0] = 0x0000;
endCount[0] = 0x00ff;
}
@@ -2405,11 +2709,11 @@ LoadFontRanges(
/*
*-------------------------------------------------------------------------
- *
+ *
* SwapShort, SwapLong --
*
- * Helper functions to convert the data loaded from TrueType font
- * files to Intel byte ordering.
+ * Helper functions to convert the data loaded from TrueType font files
+ * to Intel byte ordering.
*
* Results:
* Bytes of input value are swapped and stored back in argument.
@@ -2421,14 +2725,16 @@ LoadFontRanges(
*/
static void
-SwapShort(PUSHORT p)
+SwapShort(
+ PUSHORT p)
{
*p = (SHORT)(HIBYTE(*p) + (LOBYTE(*p) << 8));
}
-static void
-SwapLong(PULONG p)
-{
+static void
+SwapLong(
+ PULONG p)
+{
ULONG temp;
temp = (LONG) ((BYTE) *p);
@@ -2446,3 +2752,11 @@ SwapLong(PULONG p)
temp += (LONG) ((BYTE) *p);
*p = temp;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinImage.c b/win/tkWinImage.c
index 9e927fe..8e6ef38 100644
--- a/win/tkWinImage.c
+++ b/win/tkWinImage.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinImage.c --
*
* This file contains routines for manipulation full-color images.
@@ -11,18 +11,18 @@
#include "tkWinInt.h"
-static int DestroyImage _ANSI_ARGS_((XImage* data));
-static unsigned long ImageGetPixel _ANSI_ARGS_((XImage *image, int x, int y));
-static int PutPixel _ANSI_ARGS_((XImage *image, int x, int y,
- unsigned long pixel));
+static int DestroyImage(XImage* data);
+static unsigned long ImageGetPixel(XImage *image, int x, int y);
+static int PutPixel(XImage *image, int x, int y,
+ unsigned long pixel);
/*
*----------------------------------------------------------------------
*
* DestroyImage --
*
- * This is a trivial wrapper around ckfree to make it possible to
- * pass ckfree as a pointer.
+ * This is a trivial wrapper around ckfree to make it possible to pass
+ * ckfree as a pointer.
*
* Results:
* None.
@@ -34,8 +34,8 @@ static int PutPixel _ANSI_ARGS_((XImage *image, int x, int y,
*/
static int
-DestroyImage(imagePtr)
- XImage *imagePtr; /* image to free */
+DestroyImage(
+ XImage *imagePtr) /* Image to free. */
{
if (imagePtr) {
if (imagePtr->data) {
@@ -63,33 +63,33 @@ DestroyImage(imagePtr)
*/
static unsigned long
-ImageGetPixel(image, x, y)
- XImage *image;
- int x, y;
+ImageGetPixel(
+ XImage *image,
+ int x, int y)
{
unsigned long pixel = 0;
unsigned char *srcPtr = (unsigned char *) &(image->data[(y * image->bytes_per_line)
+ ((x * image->bits_per_pixel) / NBBY)]);
switch (image->bits_per_pixel) {
- case 32:
- case 24:
- pixel = RGB(srcPtr[2], srcPtr[1], srcPtr[0]);
- break;
- case 16:
- pixel = RGB(((((WORD*)srcPtr)[0]) >> 7) & 0xf8,
- ((((WORD*)srcPtr)[0]) >> 2) & 0xf8,
- ((((WORD*)srcPtr)[0]) << 3) & 0xf8);
- break;
- case 8:
- pixel = srcPtr[0];
- break;
- case 4:
- pixel = ((x%2) ? (*srcPtr) : ((*srcPtr) >> 4)) & 0x0f;
- break;
- case 1:
- pixel = ((*srcPtr) & (0x80 >> (x%8))) ? 1 : 0;
- break;
+ case 32:
+ case 24:
+ pixel = RGB(srcPtr[2], srcPtr[1], srcPtr[0]);
+ break;
+ case 16:
+ pixel = RGB(((((WORD*)srcPtr)[0]) >> 7) & 0xf8,
+ ((((WORD*)srcPtr)[0]) >> 2) & 0xf8,
+ ((((WORD*)srcPtr)[0]) << 3) & 0xf8);
+ break;
+ case 8:
+ pixel = srcPtr[0];
+ break;
+ case 4:
+ pixel = ((x%2) ? (*srcPtr) : ((*srcPtr) >> 4)) & 0x0f;
+ break;
+ case 1:
+ pixel = ((*srcPtr) & (0x80 >> (x%8))) ? 1 : 0;
+ break;
}
return pixel;
}
@@ -111,73 +111,74 @@ ImageGetPixel(image, x, y)
*/
static int
-PutPixel(image, x, y, pixel)
- XImage *image;
- int x, y;
- unsigned long pixel;
+PutPixel(
+ XImage *image,
+ int x, int y,
+ unsigned long pixel)
{
unsigned char *destPtr = (unsigned char *) &(image->data[(y * image->bytes_per_line)
+ ((x * image->bits_per_pixel) / NBBY)]);
switch (image->bits_per_pixel) {
- case 32:
- /*
- * Pixel is DWORD: 0x00BBGGRR
- */
+ case 32:
+ /*
+ * Pixel is DWORD: 0x00BBGGRR
+ */
- destPtr[3] = 0;
- case 24:
- /*
- * Pixel is triplet: 0xBBGGRR.
- */
+ destPtr[3] = 0;
+ case 24:
+ /*
+ * Pixel is triplet: 0xBBGGRR.
+ */
- destPtr[0] = (unsigned char) GetBValue(pixel);
- destPtr[1] = (unsigned char) GetGValue(pixel);
- destPtr[2] = (unsigned char) GetRValue(pixel);
- break;
- case 16:
- /*
- * Pixel is WORD: 5-5-5 (R-G-B)
- */
+ destPtr[0] = (unsigned char) GetBValue(pixel);
+ destPtr[1] = (unsigned char) GetGValue(pixel);
+ destPtr[2] = (unsigned char) GetRValue(pixel);
+ break;
+ case 16:
+ /*
+ * Pixel is WORD: 5-5-5 (R-G-B)
+ */
- (*(WORD*)destPtr) =
- ((GetRValue(pixel) & 0xf8) << 7)
+ (*(WORD*)destPtr) = ((GetRValue(pixel) & 0xf8) << 7)
| ((GetGValue(pixel) & 0xf8) <<2)
| ((GetBValue(pixel) & 0xf8) >> 3);
- break;
- case 8:
- /*
- * Pixel is 8-bit index into color table.
- */
+ break;
+ case 8:
+ /*
+ * Pixel is 8-bit index into color table.
+ */
- (*destPtr) = (unsigned char) pixel;
- break;
- case 4:
- /*
- * Pixel is 4-bit index in MSBFirst order.
- */
- if (x%2) {
- (*destPtr) = (unsigned char) (((*destPtr) & 0xf0)
+ (*destPtr) = (unsigned char) pixel;
+ break;
+ case 4:
+ /*
+ * Pixel is 4-bit index in MSBFirst order.
+ */
+
+ if (x%2) {
+ (*destPtr) = (unsigned char) (((*destPtr) & 0xf0)
| (pixel & 0x0f));
- } else {
- (*destPtr) = (unsigned char) (((*destPtr) & 0x0f)
+ } else {
+ (*destPtr) = (unsigned char) (((*destPtr) & 0x0f)
| ((pixel << 4) & 0xf0));
- }
- break;
- case 1: {
- /*
- * Pixel is bit in MSBFirst order.
- */
+ }
+ break;
+ case 1: {
+ /*
+ * Pixel is bit in MSBFirst order.
+ */
- int mask = (0x80 >> (x%8));
- if (pixel) {
- (*destPtr) |= mask;
- } else {
- (*destPtr) &= ~mask;
- }
+ int mask = (0x80 >> (x%8));
+
+ if (pixel) {
+ (*destPtr) |= mask;
+ } else {
+ (*destPtr) &= ~mask;
}
break;
}
+ }
return 0;
}
@@ -198,18 +199,17 @@ PutPixel(image, x, y, pixel)
*/
XImage *
-XCreateImage(display, visual, depth, format, offset, data, width, height,
- bitmap_pad, bytes_per_line)
- Display* display;
- Visual* visual;
- unsigned int depth;
- int format;
- int offset;
- char* data;
- unsigned int width;
- unsigned int height;
- int bitmap_pad;
- int bytes_per_line;
+XCreateImage(
+ Display *display,
+ Visual *visual,
+ unsigned int depth,
+ int format,
+ int offset,
+ char *data,
+ unsigned int width,
+ unsigned int height,
+ int bitmap_pad,
+ int bytes_per_line)
{
XImage* imagePtr = (XImage *) ckalloc(sizeof(XImage));
imagePtr->width = width;
@@ -253,47 +253,46 @@ XCreateImage(display, visual, depth, format, offset, data, width, height,
imagePtr->f.create_image = NULL;
imagePtr->f.sub_image = NULL;
imagePtr->f.add_pixel = NULL;
-
+
return imagePtr;
}
/*
*----------------------------------------------------------------------
+ *
* XGetImageZPixmap --
*
- * This function copies data from a pixmap or window into an
- * XImage. This handles the ZPixmap case only.
+ * This function copies data from a pixmap or window into an XImage. This
+ * handles the ZPixmap case only.
*
* Results:
- * Returns a newly allocated image containing the data from the
- * given rectangle of the given drawable.
+ * Returns a newly allocated image containing the data from the given
+ * rectangle of the given drawable.
*
* Side effects:
* None.
*
- * This procedure is adapted from the XGetImage implementation in TkNT.
- * That code is Copyright (c) 1994 Software Research Associates, Inc.
+ * This procedure is adapted from the XGetImage implementation in TkNT. That
+ * code is Copyright (c) 1994 Software Research Associates, Inc.
*
*----------------------------------------------------------------------
*/
static XImage *
-XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
- Display* display;
- Drawable d;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
- unsigned long plane_mask;
- int format;
+XGetImageZPixmap(
+ Display *display,
+ Drawable d,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ unsigned long plane_mask,
+ int format)
{
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
- XImage *ret_image = NULL;
+ XImage *ret_image;
HDC hdc, hdcMem;
HBITMAP hbmp, hbmpPrev;
BITMAPINFO *bmInfo = NULL;
- HPALETTE hPal, hPalPrev1, hPalPrev2;
+ HPALETTE hPal, hPalPrev1 = 0, hPalPrev2 = 0;
int size;
unsigned int n;
unsigned int depth;
@@ -303,38 +302,42 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
if (format != ZPixmap) {
TkpDisplayWarning(
- "XGetImageZPixmap: only ZPixmap types are implemented",
- "XGetImageZPixmap Failure");
+ "XGetImageZPixmap: only ZPixmap types are implemented",
+ "XGetImageZPixmap Failure");
return NULL;
}
hdc = TkWinGetDrawableDC(display, d, &state);
- /* Need to do a Blt operation to copy into a new bitmap */
- hbmp = CreateCompatibleBitmap(hdc, width, height);
+ /*
+ * Need to do a Blt operation to copy into a new bitmap.
+ */
+
+ hbmp = CreateCompatibleBitmap(hdc, (int) width, (int) height);
hdcMem = CreateCompatibleDC(hdc);
hbmpPrev = SelectObject(hdcMem, hbmp);
hPal = state.palette;
if (hPal) {
- hPalPrev1 = SelectPalette(hdcMem, hPal, FALSE);
- n = RealizePalette(hdcMem);
- if (n > 0) {
- UpdateColors (hdcMem);
- }
+ hPalPrev1 = SelectPalette(hdcMem, hPal, FALSE);
+ n = RealizePalette(hdcMem);
+ if (n > 0) {
+ UpdateColors(hdcMem);
+ }
hPalPrev2 = SelectPalette(hdc, hPal, FALSE);
- n = RealizePalette(hdc);
- if (n > 0) {
- UpdateColors (hdc);
- }
+ n = RealizePalette(hdc);
+ if (n > 0) {
+ UpdateColors(hdc);
+ }
}
- ret = BitBlt(hdcMem, 0, 0, width, height, hdc, x, y, SRCCOPY);
+ ret = BitBlt(hdcMem, 0, 0, (int) width, (int) height, hdc, x, y, SRCCOPY);
if (hPal) {
SelectPalette(hdc, hPalPrev2, FALSE);
}
SelectObject(hdcMem, hbmpPrev);
TkWinReleaseDrawableDC(d, hdc, &state);
if (ret == FALSE) {
+ ret_image = NULL;
goto cleanup;
}
if (twdPtr->type == TWD_WINDOW) {
@@ -347,22 +350,23 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
if (depth <= 8) {
size += sizeof(unsigned short) * (1 << depth);
}
- bmInfo = (BITMAPINFO *) ckalloc(size);
-
- bmInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmInfo->bmiHeader.biWidth = width;
- bmInfo->bmiHeader.biHeight = -(int) height;
- bmInfo->bmiHeader.biPlanes = 1;
- bmInfo->bmiHeader.biBitCount = depth;
- bmInfo->bmiHeader.biCompression = BI_RGB;
- bmInfo->bmiHeader.biSizeImage = 0;
- bmInfo->bmiHeader.biXPelsPerMeter = 0;
- bmInfo->bmiHeader.biYPelsPerMeter = 0;
- bmInfo->bmiHeader.biClrUsed = 0;
- bmInfo->bmiHeader.biClrImportant = 0;
+ bmInfo = (BITMAPINFO *) ckalloc((unsigned)size);
+
+ bmInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmInfo->bmiHeader.biWidth = width;
+ bmInfo->bmiHeader.biHeight = -(int) height;
+ bmInfo->bmiHeader.biPlanes = 1;
+ bmInfo->bmiHeader.biBitCount = depth;
+ bmInfo->bmiHeader.biCompression = BI_RGB;
+ bmInfo->bmiHeader.biSizeImage = 0;
+ bmInfo->bmiHeader.biXPelsPerMeter = 0;
+ bmInfo->bmiHeader.biYPelsPerMeter = 0;
+ bmInfo->bmiHeader.biClrUsed = 0;
+ bmInfo->bmiHeader.biClrImportant = 0;
if (depth == 1) {
unsigned char *p, *pend;
+
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS);
data = (unsigned char *) ckalloc(bmInfo->bmiHeader.biSizeImage);
if (!data) {
@@ -370,14 +374,17 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
ret_image = NULL;
goto cleanup;
}
- ret_image = XCreateImage(display, NULL, depth, ZPixmap, 0, (char *) data,
- width, height, 32, ((width + 31) >> 3) & ~1);
+ ret_image = XCreateImage(display, NULL, depth, ZPixmap, 0, (char *)data,
+ width, height, 32, (int) ((width + 31) >> 3) & ~1);
if (ret_image == NULL) {
ckfree((char *)data);
goto cleanup;
}
- /* Get the BITMAP info into the Image. */
+ /*
+ * Get the BITMAP info into the Image.
+ */
+
if (GetDIBits(hdcMem, hbmp, 0, height, data, bmInfo,
DIB_PAL_COLORS) == 0) {
ckfree((char *) ret_image->data);
@@ -403,14 +410,17 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
ret_image = NULL;
goto cleanup;
}
- ret_image = XCreateImage(display, NULL, 8, ZPixmap, 0, (char *) data,
- width, height, 8, width);
+ ret_image = XCreateImage(display, NULL, 8, ZPixmap, 0, (char *)data,
+ width, height, 8, (int) width);
if (ret_image == NULL) {
ckfree((char *) data);
goto cleanup;
}
- /* Get the BITMAP info into the Image. */
+ /*
+ * Get the BITMAP info into the Image.
+ */
+
if (GetDIBits(hdcMem, hbmp, 0, height, data, bmInfo,
DIB_PAL_COLORS) == 0) {
ckfree((char *) ret_image->data);
@@ -438,9 +448,12 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
goto cleanup;
}
- /* Get the BITMAP info directly into the Image. */
+ /*
+ * Get the BITMAP info directly into the Image.
+ */
+
if (GetDIBits(hdcMem, hbmp, 0, height, ret_image->data, bmInfo,
- DIB_RGB_COLORS) == 0) {
+ DIB_RGB_COLORS) == 0) {
ckfree((char *) ret_image->data);
ckfree((char *) ret_image);
ret_image = NULL;
@@ -455,7 +468,7 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
goto cleanup;
}
ret_image = XCreateImage(display, NULL, 32, ZPixmap, 0, (char *) data,
- width, height, 0, width * 4);
+ width, height, 0, (int) width * 4);
if (ret_image == NULL) {
ckfree((char *) data);
goto cleanup;
@@ -463,13 +476,14 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
if (depth <= 24) {
/*
- * This used to handle 16 and 24 bpp, but now just handles 24.
- * It can likely be optimized for that. -- hobbs
+ * This used to handle 16 and 24 bpp, but now just handles 24. It
+ * can likely be optimized for that. -- hobbs
*/
+
unsigned char *smallBitData, *smallBitBase, *bigBitData;
unsigned int byte_width, h, w;
- byte_width = ((width * 3 + 3) & ~3);
+ byte_width = ((width * 3 + 3) & ~(unsigned)3);
smallBitBase = (unsigned char *) ckalloc(byte_width * height);
if (!smallBitBase) {
ckfree((char *) ret_image->data);
@@ -479,18 +493,25 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
}
smallBitData = smallBitBase;
- /* Get the BITMAP info into the Image. */
+ /*
+ * Get the BITMAP info into the Image.
+ */
+
if (GetDIBits(hdcMem, hbmp, 0, height, smallBitData, bmInfo,
- DIB_RGB_COLORS) == 0) {
+ DIB_RGB_COLORS) == 0) {
ckfree((char *) ret_image->data);
ckfree((char *) ret_image);
ckfree((char *) smallBitBase);
ret_image = NULL;
goto cleanup;
}
- /* Copy the 24 Bit Pixmap to a 32-Bit one. */
+
+ /*
+ * Copy the 24 Bit Pixmap to a 32-Bit one.
+ */
+
for (h = 0; h < height; h++) {
- bigBitData = (unsigned char *)ret_image->data + h * ret_image->bytes_per_line;
+ bigBitData = (unsigned char *) (ret_image->data + h * ret_image->bytes_per_line);
smallBitData = smallBitBase + h * byte_width;
for (w = 0; w < width; w++) {
@@ -500,10 +521,17 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
*bigBitData++ = 0;
}
}
- /* Free the Device contexts, and the Bitmap */
+
+ /*
+ * Free the Device contexts, and the Bitmap.
+ */
+
ckfree((char *) smallBitBase);
} else {
- /* Get the BITMAP info directly into the Image. */
+ /*
+ * Get the BITMAP info directly into the Image.
+ */
+
if (GetDIBits(hdcMem, hbmp, 0, height, ret_image->data, bmInfo,
DIB_RGB_COLORS) == 0) {
ckfree((char *) ret_image->data);
@@ -532,12 +560,11 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
*
* XGetImage --
*
- * This function copies data from a pixmap or window into an
- * XImage.
+ * This function copies data from a pixmap or window into an XImage.
*
* Results:
- * Returns a newly allocated image containing the data from the
- * given rectangle of the given drawable.
+ * Returns a newly allocated image containing the data from the given
+ * rectangle of the given drawable.
*
* Side effects:
* None.
@@ -546,15 +573,13 @@ XGetImageZPixmap(display, d, x, y, width, height, plane_mask, format)
*/
XImage *
-XGetImage(display, d, x, y, width, height, plane_mask, format)
- Display* display;
- Drawable d;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
- unsigned long plane_mask;
- int format;
+XGetImage(
+ Display* display,
+ Drawable d,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ unsigned long plane_mask,
+ int format)
{
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
XImage *imagePtr;
@@ -566,26 +591,28 @@ XGetImage(display, d, x, y, width, height, plane_mask, format)
/*
* Avoid unmapped windows or bad drawables
*/
+
return NULL;
}
if (twdPtr->type != TWD_BITMAP) {
/*
* This handles TWD_WINDOW or TWD_WINDC, always creating a 32bit
- * image. If the window being copied isn't visible (unmapped or
- * obscured), we quietly stop copying (no user error).
- * The user will see black where the widget should be.
- * This branch is likely followed in favor of XGetImageZPixmap as
- * postscript printed widgets require RGB data.
+ * image. If the window being copied isn't visible (unmapped or
+ * obscured), we quietly stop copying (no user error). The user will
+ * see black where the widget should be. This branch is likely
+ * followed in favor of XGetImageZPixmap as postscript printed widgets
+ * require RGB data.
*/
+
TkWinDCState state;
unsigned int xx, yy, size;
COLORREF pixel;
dc = TkWinGetDrawableDC(display, d, &state);
- imagePtr = XCreateImage(display, NULL, 32,
- format, 0, NULL, width, height, 32, 0);
+ imagePtr = XCreateImage(display, NULL, 32, format, 0, NULL,
+ width, height, 32, 0);
size = imagePtr->bytes_per_line * imagePtr->height;
imagePtr->data = ckalloc(size);
ZeroMemory(imagePtr->data, size);
@@ -596,18 +623,19 @@ XGetImage(display, d, x, y, width, height, plane_mask, format)
if (pixel == CLR_INVALID) {
break;
}
- PutPixel(imagePtr, xx, yy, pixel);
+ PutPixel(imagePtr, (int) xx, (int) yy, pixel);
}
}
TkWinReleaseDrawableDC(d, dc, &state);
} else if (format == ZPixmap) {
/*
- * This actually handles most TWD_WINDOW requests, but it varies
- * from the above in that it really does a screen capture of
- * an area, which is consistent with the Unix behavior, but does
- * not appear to handle all bit depths correctly. -- hobbs
+ * This actually handles most TWD_WINDOW requests, but it varies from
+ * the above in that it really does a screen capture of an area, which
+ * is consistent with the Unix behavior, but does not appear to handle
+ * all bit depths correctly. -- hobbs
*/
+
imagePtr = XGetImageZPixmap(display, d, x, y,
width, height, plane_mask, format);
} else {
@@ -626,13 +654,15 @@ XGetImage(display, d, x, y, width, height, plane_mask, format)
/*
* Do a soft warning for the unsupported XGetImage types.
*/
+
TkpDisplayWarning(errMsg, "XGetImage Failure");
return NULL;
}
imagePtr = XCreateImage(display, NULL, 1, XYBitmap, 0, NULL,
width, height, 32, 0);
- imagePtr->data = ckalloc(imagePtr->bytes_per_line * imagePtr->height);
+ imagePtr->data =
+ ckalloc((unsigned) imagePtr->bytes_per_line*imagePtr->height);
dc = GetDC(NULL);
@@ -645,7 +675,7 @@ XGetImage(display, d, x, y, width, height, plane_mask, format)
infoPtr->bmiHeader.biPlanes = 1;
infoPtr->bmiHeader.biBitCount = 1;
infoPtr->bmiHeader.biCompression = BI_RGB;
- infoPtr->bmiHeader.biSizeImage = 0;
+ infoPtr->bmiHeader.biSizeImage = 0;
infoPtr->bmiHeader.biXPelsPerMeter = 0;
infoPtr->bmiHeader.biYPelsPerMeter = 0;
infoPtr->bmiHeader.biClrUsed = 0;
@@ -658,3 +688,11 @@ XGetImage(display, d, x, y, width, height, plane_mask, format)
return imagePtr;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index ab33607..19556dd 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinInit.c --
*
* This file contains Windows-specific interpreter initialization
@@ -12,12 +12,6 @@
#include "tkWinInt.h"
-/*
- * The Init script (common to Windows and Unix platforms) is
- * defined in tkInitScript.h
- */
-#include "tkInitScript.h"
-
/*
*----------------------------------------------------------------------
@@ -28,8 +22,8 @@
* tk_library variable.
*
* Results:
- * A standard Tcl completion code (TCL_OK or TCL_ERROR). Also
- * leaves information in the interp's result.
+ * A standard Tcl completion code (TCL_OK or TCL_ERROR). Also leaves
+ * information in the interp's result.
*
* Side effects:
* Sets "tk_library" Tcl variable, runs "tk.tcl" script.
@@ -38,15 +32,16 @@
*/
int
-TkpInit(interp)
- Tcl_Interp *interp;
+TkpInit(
+ Tcl_Interp *interp)
{
/*
* This is necessary for static initialization, and is ok otherwise
* because TkWinXInit flips a static bit to do its work just once.
*/
+
TkWinXInit(Tk_GetHINSTANCE());
- return Tcl_Eval(interp, initScript);
+ return TCL_OK;
}
/*
@@ -54,9 +49,9 @@ TkpInit(interp)
*
* TkpGetAppName --
*
- * Retrieves the name of the current application from a platform
- * specific location. For Windows, the application name is the
- * root of the tail of the path contained in the tcl variable argv0.
+ * Retrieves the name of the current application from a platform specific
+ * location. For Windows, the application name is the root of the tail of
+ * the path contained in the tcl variable argv0.
*
* Results:
* Returns the application name in the given Tcl_DString.
@@ -68,9 +63,9 @@ TkpInit(interp)
*/
void
-TkpGetAppName(interp, namePtr)
- Tcl_Interp *interp;
- Tcl_DString *namePtr; /* A previously initialized Tcl_DString. */
+TkpGetAppName(
+ Tcl_Interp *interp,
+ Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
{
int argc, namelength;
CONST char **argv = NULL, *name, *p;
@@ -104,8 +99,8 @@ TkpGetAppName(interp, namePtr)
*
* TkpDisplayWarning --
*
- * This routines is called from Tk_Main to display warning
- * messages that occur during startup.
+ * This routines is called from Tk_Main to display warning messages that
+ * occur during startup.
*
* Results:
* None.
@@ -117,28 +112,31 @@ TkpGetAppName(interp, namePtr)
*/
void
-TkpDisplayWarning(msg, title)
- CONST char *msg; /* Message to be displayed. */
- CONST char *title; /* Title of warning. */
+TkpDisplayWarning(
+ CONST char *msg, /* Message to be displayed. */
+ CONST char *title) /* Title of warning. */
{
- Tcl_DString msgString, titleString;
- Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
+#define TK_MAX_WARN_LEN 1024
+ WCHAR msgString[TK_MAX_WARN_LEN + 5];
+ WCHAR titleString[TK_MAX_WARN_LEN + 1];
+ MultiByteToWideChar(CP_UTF8, 0, msg, -1, msgString, TK_MAX_WARN_LEN);
+ MultiByteToWideChar(CP_UTF8, 0, title, -1, titleString, TK_MAX_WARN_LEN);
/*
- * Truncate MessageBox string if it is too long to not overflow
- * the screen and cause possible oversized window error.
+ * Truncate MessageBox string if it is too long to not overflow the screen
+ * and cause possible oversized window error.
*/
-#define TK_MAX_WARN_LEN (1024 * sizeof(WCHAR))
- Tcl_UtfToExternalDString(unicodeEncoding, msg, -1, &msgString);
- Tcl_UtfToExternalDString(unicodeEncoding, title, -1, &titleString);
- if (Tcl_DStringLength(&msgString) > TK_MAX_WARN_LEN) {
- Tcl_DStringSetLength(&msgString, TK_MAX_WARN_LEN);
- Tcl_DStringAppend(&msgString, (char *) L" ...", 4 * sizeof(WCHAR));
- }
- MessageBoxW(NULL, (WCHAR *) Tcl_DStringValue(&msgString),
- (WCHAR *) Tcl_DStringValue(&titleString),
+ memcpy(msgString + TK_MAX_WARN_LEN, L" ...", 5 * sizeof(WCHAR));
+ titleString[TK_MAX_WARN_LEN] = L'\0';
+ MessageBoxW(NULL, msgString, titleString,
MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL
| MB_SETFOREGROUND | MB_TOPMOST);
- Tcl_DStringFree(&msgString);
- Tcl_DStringFree(&titleString);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index efff755..5616e20 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -2,14 +2,13 @@
* tkWinInt.h --
*
* This file contains declarations that are shared among the
- * Windows-specific parts of Tk, but aren't used by the rest of
- * Tk.
+ * Windows-specific parts of Tk, but aren't used by the rest of Tk.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKWININT
@@ -31,18 +30,20 @@
#include "tkPort.h"
#endif
-
/*
* Define constants missing from older Win32 SDK header files.
*/
#ifndef WS_EX_TOOLWINDOW
-#define WS_EX_TOOLWINDOW 0x00000080L
+#define WS_EX_TOOLWINDOW 0x00000080L
+#endif
+#ifndef SPI_SETKEYBOARDCUES
+#define SPI_SETKEYBOARDCUES 0x100B
#endif
/*
- * The TkWinDCState is used to save the state of a device context
- * so that it can be restored later.
+ * The TkWinDCState is used to save the state of a device context so that it
+ * can be restored later.
*/
typedef struct TkWinDCState {
@@ -51,8 +52,8 @@ typedef struct TkWinDCState {
} TkWinDCState;
/*
- * The TkWinDrawable is the internal implementation of an X Drawable (either
- * a Window or a Pixmap). The following constants define the valid Drawable
+ * The TkWinDrawable is the internal implementation of an X Drawable (either a
+ * Window or a Pixmap). The following constants define the valid Drawable
* types.
*/
@@ -103,11 +104,11 @@ typedef struct {
HPALETTE palette; /* Palette handle used when drawing. */
UINT size; /* Number of entries in the palette. */
int stale; /* 1 if palette needs to be realized,
- * otherwise 0. If the palette is stale,
- * then an idle handler is scheduled to
- * realize the palette. */
- Tcl_HashTable refCounts; /* Hash table of palette entry reference counts
- * indexed by pixel value. */
+ * otherwise 0. If the palette is stale, then
+ * an idle handler is scheduled to realize the
+ * palette. */
+ Tcl_HashTable refCounts; /* Hash table of palette entry reference
+ * counts indexed by pixel value. */
} TkWinColormap;
/*
@@ -128,59 +129,64 @@ typedef struct {
* Win32 raster and BitBlt op modes.
*/
-extern int tkpWinRopModes[];
-extern int tkpWinBltModes[];
+MODULE_SCOPE int tkpWinRopModes[];
+MODULE_SCOPE int tkpWinBltModes[];
/*
- * The following defines are used with TkWinGetBorderPixels to get the
- * extra 2 border colors from a Tk_3DBorder.
+ * The following defines are used with TkWinGetBorderPixels to get the extra 2
+ * border colors from a Tk_3DBorder.
*/
#define TK_3D_LIGHT2 TK_3D_DARK_GC+1
#define TK_3D_DARK2 TK_3D_DARK_GC+2
/*
- * Internal procedures used by more than one source file.
+ * Internal functions used by more than one source file.
*/
#include "tkIntPlatDecls.h"
-/*
- * We need to specially add the TkWinChildProc because of the special
- * prototype it has (doesn't fit into stubs schema)
- */
#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
#endif
-EXTERN LRESULT CALLBACK TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam));
-
/*
* Special proc needed as tsd accessor function between
* tkWinX.c:GenerateXEvent and tkWinClipboard.c:UpdateClipboard
*/
-EXTERN void TkWinUpdatingClipboard(int mode);
+
+EXTERN void TkWinUpdatingClipboard(int mode);
/*
* Used by tkWinDialog.c to associate the right icon with tk_messageBox
*/
-EXTERN HICON TkWinGetIcon(Tk_Window tkw, DWORD iconsize);
+
+EXTERN HICON TkWinGetIcon(Tk_Window tkw, DWORD iconsize);
+
+/*
+ * Used by tkWinX.c on for certain system display change messages and cleanup
+ * up containers
+ */
+
+EXTERN void TkWinDisplayChanged(Display *display);
+MODULE_SCOPE void TkWinCleanupContainerList(void);
/*
- * Used by tkWinX.c on for certain system display change messages
+ * Used by tkWinWm.c for embedded menu handling. May become public.
*/
-EXTERN void TkWinDisplayChanged(Display *display);
+
+EXTERN HWND Tk_GetMenuHWND(Tk_Window tkwin);
+EXTERN HWND Tk_GetEmbeddedMenuHWND(Tk_Window tkwin);
/*
- * The following structure keeps track of whether we are using the
- * multi-byte or the wide-character interfaces to the operating system.
- * System calls should be made through the following function table.
+ * The following structure keeps track of whether we are using the multi-byte
+ * or the wide-character interfaces to the operating system. System calls
+ * should be made through the following function table.
*
* While some system calls need to use this A/W jump-table, it is not
- * necessary for all calls to do it, which is why you won't see this
- * used throughout the Tk code, but only in key areas. -- hobbs
+ * necessary for all calls to do it, which is why you won't see this used
+ * throughout the Tk code, but only in key areas. -- hobbs
*/
typedef struct TkWinProcs {
@@ -189,7 +195,7 @@ typedef struct TkWinProcs {
UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT (WINAPI *defWindowProc)(HWND hWnd, UINT Msg, WPARAM wParam,
LPARAM lParam);
- ATOM (WINAPI *registerClass)(CONST WNDCLASS *lpWndClass);
+ ATOM (WINAPI *registerClass)(const WNDCLASS *lpWndClass);
BOOL (WINAPI *setWindowText)(HWND hWnd, LPCTSTR lpString);
HWND (WINAPI *createWindowEx)(DWORD dwExStyle, LPCTSTR lpClassName,
LPCTSTR lpWindowName, DWORD dwStyle, int x, int y,
@@ -197,6 +203,7 @@ typedef struct TkWinProcs {
HINSTANCE hInstance, LPVOID lpParam);
BOOL (WINAPI *insertMenu)(HMENU hMenu, UINT uPosition, UINT uFlags,
UINT uIDNewItem, LPCTSTR lpNewItem);
+ int (WINAPI *getWindowText)(HWND hWnd, LPCTSTR lpString, int nMaxCount);
} TkWinProcs;
EXTERN TkWinProcs *tkWinProcs;
@@ -209,14 +216,76 @@ EXTERN TkWinProcs *tkWinProcs;
*/
-extern Tcl_Encoding TkWinGetKeyInputEncoding _ANSI_ARGS_((void));
-extern Tcl_Encoding TkWinGetUnicodeEncoding _ANSI_ARGS_((void));
+MODULE_SCOPE Tcl_Encoding TkWinGetKeyInputEncoding(void);
+MODULE_SCOPE Tcl_Encoding TkWinGetUnicodeEncoding(void);
+MODULE_SCOPE void TkWinSetupSystemFonts(TkMainInfo *mainPtr);
/*
* Values returned by TkWinGetPlatformTheme.
*/
+
#define TK_THEME_WIN_CLASSIC 1
#define TK_THEME_WIN_XP 2
-#endif /* _TKWININT */
+/*
+ * The following is implemented in tkWinWm and used by tkWinEmbed.c
+ */
+
+void TkpWinToplevelWithDraw(TkWindow *winPtr);
+void TkpWinToplevelIconify(TkWindow *winPtr);
+void TkpWinToplevelDeiconify(TkWindow *winPtr);
+long TkpWinToplevelIsControlledByWm(TkWindow *winPtr);
+long TkpWinToplevelMove(TkWindow *winPtr, int x, int y);
+long TkpWinToplevelOverrideRedirect(TkWindow *winPtr,
+ int reqValue);
+void TkpWinToplevelDetachWindow(TkWindow *winPtr);
+int TkpWmGetState(TkWindow *winPtr);
+/*
+ * The following functions are not present in old versions of Windows
+ * API headers but are used in the Tk source to ensure 64bit
+ * compatability.
+ */
+
+#ifndef GetClassLongPtr
+# define GetClassLongPtrA GetClassLongA
+# define GetClassLongPtrW GetClassLongW
+# define SetClassLongPtrA SetClassLongA
+# define SetClassLongPtrW SetClassLongW
+# ifdef UNICODE
+# define GetClassLongPtr GetClassLongPtrW
+# define SetClassLongPtr SetClassLongPtrW
+# else
+# define GetClassLongPtr GetClassLongPtrA
+# define SetClassLongPtr SetClassLongPtrA
+# endif /* !UNICODE */
+#endif /* !GetClassLongPtr */
+#ifndef GCLP_HICON
+# define GCLP_HICON GCL_HICON
+#endif /* !GCLP_HICON */
+#ifndef GCLP_HICONSM
+# define GCLP_HICONSM (-34)
+#endif /* !GCLP_HICONSM */
+
+#ifndef GetWindowLongPtr
+# define GetWindowLongPtrA GetWindowLongA
+# define GetWindowLongPtrW GetWindowLongW
+# define SetWindowLongPtrA SetWindowLongA
+# define SetWindowLongPtrW SetWindowLongW
+# ifdef UNICODE
+# define GetWindowLongPtr GetWindowLongPtrW
+# define SetWindowLongPtr SetWindowLongPtrW
+# else
+# define GetWindowLongPtr GetWindowLongPtrW
+# define SetWindowLongPtr SetWindowLongPtrW
+# endif /* !UNICODE */
+#endif /* !GetWindowLongPtr */
+#ifndef GWLP_WNDPROC
+#define GWLP_WNDPROC GWL_WNDPROC
+#define GWLP_HINSTANCE GWL_HINSTANCE
+#define GWLP_HWNDPARENT GWL_HWNDPARENT
+#define GWLP_USERDATA GWL_USERDATA
+#define GWLP_ID GWL_ID
+#endif /* !GWLP_WNDPROC */
+
+#endif /* _TKWININT */
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index aa532bf..522bfba 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -6,59 +6,62 @@
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
+
/*
- * The keymap table holds mappings of Windows keycodes to X keysyms.
- * If Windows ever comes along and changes the value of their keycodes,
- * this will break all kinds of things. However, this table lookup is much
- * faster than the alternative, in which we walked a list of keycodes looking
- * for a match. Since this lookup is performed for every Windows keypress
- * event, it seems like a worthwhile improvement to use the table.
+ * The keymap table holds mappings of Windows keycodes to X keysyms. If
+ * Windows ever comes along and changes the value of their keycodes, this will
+ * break all kinds of things. However, this table lookup is much faster than
+ * the alternative, in which we walked a list of keycodes looking for a match.
+ * Since this lookup is performed for every Windows keypress event, it seems
+ * like a worthwhile improvement to use the table.
*/
+
#define MAX_KEYCODE 145 /* VK_SCROLL is the last entry in our table below */
+
static KeySym keymap[] = {
NoSymbol, NoSymbol, NoSymbol, XK_Cancel, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_BackSpace, XK_Tab,
- NoSymbol, NoSymbol, XK_Clear, XK_Return, NoSymbol,
- NoSymbol, XK_Shift_L, XK_Control_L, XK_Alt_L, XK_Pause,
- XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, XK_Escape, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, XK_space, XK_Prior, XK_Next,
- XK_End, XK_Home, XK_Left, XK_Up, XK_Right,
- XK_Down, XK_Select, XK_Print, XK_Execute, NoSymbol,
- XK_Insert, XK_Delete, XK_Help, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, XK_Win_L, XK_Win_R, XK_App, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, XK_F1, XK_F2, XK_F3,
- XK_F4, XK_F5, XK_F6, XK_F7, XK_F8,
- XK_F9, XK_F10, XK_F11, XK_F12, XK_F13,
- XK_F14, XK_F15, XK_F16, XK_F17, XK_F18,
- XK_F19, XK_F20, XK_F21, XK_F22, XK_F23,
- XK_F24, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol, XK_Num_Lock,
- XK_Scroll_Lock
+ NoSymbol, NoSymbol, NoSymbol, XK_BackSpace, XK_Tab,
+ NoSymbol, NoSymbol, XK_Clear, XK_Return, NoSymbol,
+ NoSymbol, XK_Shift_L, XK_Control_L, XK_Alt_L, XK_Pause,
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, XK_Escape, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, XK_space, XK_Prior, XK_Next,
+ XK_End, XK_Home, XK_Left, XK_Up, XK_Right,
+ XK_Down, XK_Select, XK_Print, XK_Execute, NoSymbol,
+ XK_Insert, XK_Delete, XK_Help, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, XK_Win_L, XK_Win_R, XK_App, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, XK_F1, XK_F2, XK_F3,
+ XK_F4, XK_F5, XK_F6, XK_F7, XK_F8,
+ XK_F9, XK_F10, XK_F11, XK_F12, XK_F13,
+ XK_F14, XK_F15, XK_F16, XK_F17, XK_F18,
+ XK_F19, XK_F20, XK_F21, XK_F22, XK_F23,
+ XK_F24, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, XK_Num_Lock,
+ XK_Scroll_Lock
};
/*
- * Prototypes for local procedures defined in this file:
+ * Prototypes for local functions defined in this file:
*/
-static KeySym KeycodeToKeysym _ANSI_ARGS_((unsigned int keycode,
- int state, int noascii));
+static KeySym KeycodeToKeysym(unsigned int keycode,
+ int state, int noascii);
/*
*----------------------------------------------------------------------
@@ -77,58 +80,59 @@ static KeySym KeycodeToKeysym _ANSI_ARGS_((unsigned int keycode,
*/
char *
-TkpGetString(winPtr, eventPtr, dsPtr)
- TkWindow *winPtr; /* Window where event occurred: needed to
- * get input context. */
- XEvent *eventPtr; /* X keyboard event. */
- Tcl_DString *dsPtr; /* Uninitialized or empty string to hold
+TkpGetString(
+ TkWindow *winPtr, /* Window where event occurred: needed to get
+ * input context. */
+ XEvent *eventPtr, /* X keyboard event. */
+ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold
* result. */
{
- KeySym keysym;
+ XKeyEvent *keyEv = &eventPtr->xkey;
Tcl_DStringInit(dsPtr);
- if (eventPtr->xkey.send_event == -1) {
- if (eventPtr->xkey.nbytes > 0) {
+ if (keyEv->send_event == -1) {
+ if (keyEv->nbytes > 0) {
Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(),
- eventPtr->xkey.trans_chars, eventPtr->xkey.nbytes, dsPtr);
- }
- } else if (eventPtr->xkey.send_event == -2) {
- /*
- * Special case for win2000 multi-lingal IME input.
- * xkey.trans_chars[] already contains a UNICODE char.
- */
-
- int unichar;
- char buf[TCL_UTF_MAX];
- int len;
-
- unichar = (eventPtr->xkey.trans_chars[1] & 0xff);
- unichar <<= 8;
- unichar |= (eventPtr->xkey.trans_chars[0] & 0xff);
-
- len = Tcl_UniCharToUtf((Tcl_UniChar) unichar, buf);
-
- Tcl_DStringAppend(dsPtr, buf, len);
- } else if (eventPtr->xkey.send_event == -3) {
+ keyEv->trans_chars, keyEv->nbytes, dsPtr);
+ }
+ } else if (keyEv->send_event == -2) {
/*
- * Special case for WM_UNICHAR.
- * xkey.trans_chars[] already contains a UTF-8 char.
+ * Special case for win2000 multi-lingal IME input. xkey.trans_chars[]
+ * already contains a UNICODE char.
*/
- Tcl_DStringAppend(dsPtr, eventPtr->xkey.trans_chars,
- eventPtr->xkey.nbytes);
- } else {
+
+ int unichar;
+ char buf[TCL_UTF_MAX];
+ int len;
+
+ unichar = keyEv->trans_chars[1] & 0xff;
+ unichar <<= 8;
+ unichar |= keyEv->trans_chars[0] & 0xff;
+
+ len = Tcl_UniCharToUtf((Tcl_UniChar) unichar, buf);
+
+ Tcl_DStringAppend(dsPtr, buf, len);
+ } else if (keyEv->send_event == -3) {
+ /*
+ * Special case for WM_UNICHAR. xkey.trans_chars[] already contains a
+ * UTF-8 char.
+ */
+
+ Tcl_DStringAppend(dsPtr, keyEv->trans_chars, keyEv->nbytes);
+ } else {
/*
- * This is an event generated from generic code. It has no
- * nchars or trans_chars members.
+ * This is an event generated from generic code. It has no nchars or
+ * trans_chars members.
*/
- keysym = KeycodeToKeysym(eventPtr->xkey.keycode,
- eventPtr->xkey.state, 0);
- if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256))
- || (keysym == XK_Return)
- || (keysym == XK_Tab)) {
+ KeySym keysym = KeycodeToKeysym(keyEv->keycode, keyEv->state, 0);
+
+ if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256))
+ || (keysym == XK_Return) || (keysym == XK_Tab)) {
char buf[TCL_UTF_MAX];
- int len = Tcl_UniCharToUtf((Tcl_UniChar) (keysym & 255), buf);
+ int len;
+
+ len = Tcl_UniCharToUtf((Tcl_UniChar) (keysym & 255), buf);
Tcl_DStringAppend(dsPtr, buf, len);
}
}
@@ -140,8 +144,8 @@ TkpGetString(winPtr, eventPtr, dsPtr)
*
* XKeycodeToKeysym --
*
- * Translate from a system-dependent keycode to a
- * system-independent keysym.
+ * Translate from a system-dependent keycode to a system-independent
+ * keysym.
*
* Results:
* Returns the translated keysym, or NoSymbol on failure.
@@ -153,10 +157,10 @@ TkpGetString(winPtr, eventPtr, dsPtr)
*/
KeySym
-XKeycodeToKeysym(display, keycode, index)
- Display* display;
- unsigned int keycode;
- int index;
+XKeycodeToKeysym(
+ Display *display,
+ unsigned int keycode,
+ int index)
{
int state = 0;
@@ -165,32 +169,30 @@ XKeycodeToKeysym(display, keycode, index)
}
return KeycodeToKeysym(keycode, state, 0);
}
-
-
/*
*----------------------------------------------------------------------
*
* KeycodeToKeysym --
*
- * Translate from a system-dependent keycode to a
- * system-independent keysym.
+ * Translate from a system-dependent keycode to a system-independent
+ * keysym.
*
* Results:
* Returns the translated keysym, or NoSymbol on failure.
*
* Side effects:
- * It may affect the internal state of the keyboard, such as
- * remembered dead key or lock indicator lamps.
+ * It may affect the internal state of the keyboard, such as remembered
+ * dead key or lock indicator lamps.
*
*----------------------------------------------------------------------
*/
static KeySym
-KeycodeToKeysym(keycode, state, noascii)
- unsigned int keycode;
- int state;
- int noascii;
+KeycodeToKeysym(
+ unsigned int keycode,
+ int state,
+ int noascii)
{
BYTE keys[256];
int result, deadkey, shift;
@@ -198,115 +200,123 @@ KeycodeToKeysym(keycode, state, noascii)
unsigned int scancode = MapVirtualKey(keycode, 0);
/*
- * Do not run keycodes of lock keys through ToAscii().
- * One of ToAscii()'s side effects is to handle the lights
- * on the keyboard, and we don't want to mess that up.
+ * Do not run keycodes of lock keys through ToAscii(). One of ToAscii()'s
+ * side effects is to handle the lights on the keyboard, and we don't want
+ * to mess that up.
*/
if (noascii || keycode == VK_CAPITAL || keycode == VK_SCROLL ||
- keycode == VK_NUMLOCK)
- goto skipToAscii;
+ keycode == VK_NUMLOCK) {
+ goto skipToAscii;
+ }
/*
* Use MapVirtualKey() to detect some dead keys.
*/
- if (MapVirtualKey(keycode, 2) > 0x7fffUL)
- return XK_Multi_key;
+ if (MapVirtualKey(keycode, 2) > 0x7fffUL) {
+ return XK_Multi_key;
+ }
/*
* Set up a keyboard with correct modifiers
*/
memset(keys, 0, 256);
- if (state & ShiftMask)
- keys[VK_SHIFT] = 0x80;
- if (state & ControlMask)
+ if (state & ShiftMask) {
+ keys[VK_SHIFT] = 0x80;
+ }
+ if (state & ControlMask) {
keys[VK_CONTROL] = 0x80;
- if (state & Mod2Mask)
+ }
+ if (state & Mod2Mask) {
keys[VK_MENU] = 0x80;
+ }
- /*
+ /*
* Make sure all lock button info is correct so we don't mess up the
- * lights
+ * lights.
*/
- if (state & LockMask)
+ if (state & LockMask) {
keys[VK_CAPITAL] = 1;
- if (state & Mod3Mask)
+ }
+ if (state & Mod3Mask) {
keys[VK_SCROLL] = 1;
- if (state & Mod1Mask)
+ }
+ if (state & Mod1Mask) {
keys[VK_NUMLOCK] = 1;
+ }
result = ToAscii(keycode, scancode, keys, (LPWORD) buf, 0);
if (result < 0) {
- /*
- * Win95/98:
- * This was a dead char, which is now remembered by the keyboard.
- * Call ToAscii() again to forget it.
- * WinNT:
- * This was a dead char, overwriting any previously remembered
- * key. Calling ToAscii() again does not affect anything.
- */
-
- ToAscii(keycode, scancode, keys, (LPWORD) buf, 0);
- return XK_Multi_key;
+ /*
+ * Win95/98: This was a dead char, which is now remembered by the
+ * keyboard. Call ToAscii() again to forget it.
+ * WinNT: This was a dead char, overwriting any previously remembered
+ * key. Calling ToAscii() again does not affect anything.
+ */
+
+ ToAscii(keycode, scancode, keys, (LPWORD) buf, 0);
+ return XK_Multi_key;
}
- if (result == 2) {
- /*
- * This was a dead char, and there were one previously remembered
- * by the keyboard.
- * Call ToAscii() again with proper parameters to restore it.
- */
- /*
+ if (result == 2) {
+ /*
+ * This was a dead char, and there were one previously remembered by
+ * the keyboard. Call ToAscii() again with proper parameters to
+ * restore it.
+ *
* Get information about the old char
*/
- deadkey = VkKeyScan(buf[0]);
- shift = deadkey >> 8;
- deadkey &= 255;
- scancode = MapVirtualKey(deadkey, 0);
+ deadkey = VkKeyScan(buf[0]);
+ shift = deadkey >> 8;
+ deadkey &= 255;
+ scancode = MapVirtualKey(deadkey, 0);
- /*
+ /*
* Set up a keyboard with proper modifier keys
*/
- memset(keys, 0, 256);
- if (shift & 1)
- keys[VK_SHIFT] = 0x80;
- if (shift & 2)
- keys[VK_CONTROL] = 0x80;
- if (shift & 4)
- keys[VK_MENU] = 0x80;
- ToAscii(deadkey, scancode, keys, (LPWORD) buf, 0);
- return XK_Multi_key;
+ memset(keys, 0, 256);
+ if (shift & 1) {
+ keys[VK_SHIFT] = 0x80;
+ }
+ if (shift & 2) {
+ keys[VK_CONTROL] = 0x80;
+ }
+ if (shift & 4) {
+ keys[VK_MENU] = 0x80;
+ }
+ ToAscii(deadkey, scancode, keys, (LPWORD) buf, 0);
+ return XK_Multi_key;
}
/*
- * Keycode mapped to a valid Latin-1 character. Since the keysyms
- * for alphanumeric characters map onto Latin-1, we just return it.
+ * Keycode mapped to a valid Latin-1 character. Since the keysyms for
+ * alphanumeric characters map onto Latin-1, we just return it.
*
- * We treat 0x7F as a special case mostly for backwards compatibility.
- * In versions of Tk<=8.2, Control-Backspace returned "XK_BackSpace"
- * as the X Keysym. This was due to the fact that we did not
- * initialize the keys array properly when we passed it to ToAscii, above.
- * We had previously not been setting the state bit for the Control key.
- * When we fixed that, we found that Control-Backspace on Windows is
- * interpreted as ASCII-127 (0x7F), which corresponds to the Delete key.
+ * We treat 0x7F as a special case mostly for backwards compatibility. In
+ * versions of Tk<=8.2, Control-Backspace returned "XK_BackSpace" as the X
+ * Keysym. This was due to the fact that we did not initialize the keys
+ * array properly when we passed it to ToAscii, above. We had previously
+ * not been setting the state bit for the Control key. When we fixed that,
+ * we found that Control-Backspace on Windows is interpreted as ASCII-127
+ * (0x7F), which corresponds to the Delete key.
*
- * Upon discovering this, we realized we had two choices: return XK_Delete
- * or return XK_BackSpace. If we returned XK_Delete, that could be
+ * Upon discovering this, we realized we had two choices: return XK_Delete
+ * or return XK_BackSpace. If we returned XK_Delete, that could be
* considered "more correct" (although the correctness would be dependant
* on whether you believe that ToAscii is doing the right thing in that
- * case); however, this would break backwards compatibility, and worse,
- * it would limit application programmers -- they would effectively be
- * unable to bind to <Control-Backspace> on Windows. We therefore chose
- * instead to return XK_BackSpace (handled here by letting the code
- * "fall-through" to the return statement below, which works because the
- * keycode for this event is VK_BACKSPACE, and the keymap table maps that
- * keycode to XK_BackSpace).
+ * case); however, this would break backwards compatibility, and worse, it
+ * would limit application programmers; they would effectively be unable
+ * to bind to <Control-Backspace> on Windows. We therefore chose instead
+ * to return XK_BackSpace (handled here by letting the code "fall-through"
+ * to the return statement below, which works because the keycode for this
+ * event is VK_BACKSPACE, and the keymap table maps that keycode to
+ * XK_BackSpace).
*/
if (result == 1 && UCHAR(buf[0]) >= 0x20 && UCHAR(buf[0]) != 0x7F) {
@@ -317,69 +327,64 @@ KeycodeToKeysym(keycode, state, noascii)
* Keycode is a non-alphanumeric key, so we have to do the lookup.
*/
- skipToAscii:
- if (keycode < 0 || keycode > MAX_KEYCODE) {
+ skipToAscii:
+ if (keycode > MAX_KEYCODE) {
return NoSymbol;
}
switch (keycode) {
/*
- * Windows only gives us an undifferentiated VK_CONTROL
- * code (for example) when either Control key is pressed.
- * To distinguish between left and right, we have to query the
- * state of one of the two to determine which was actually
- * pressed. So if the keycode indicates Control, Shift, or Menu
- * (the key that everybody else calls Alt), do this extra test.
- * If the right-side key was pressed, return the appropriate
- * keycode. Otherwise, we fall through and rely on the
+ * Windows only gives us an undifferentiated VK_CONTROL code (for
+ * example) when either Control key is pressed. To distinguish between
+ * left and right, we have to query the state of one of the two to
+ * determine which was actually pressed. So if the keycode indicates
+ * Control, Shift, or Menu (the key that everybody else calls Alt), do
+ * this extra test. If the right-side key was pressed, return the
+ * appropriate keycode. Otherwise, we fall through and rely on the
* keymap table to hold the correct keysym value.
*/
- case VK_CONTROL: {
- if (GetKeyState(VK_RCONTROL) & 0x80) {
- return XK_Control_R;
- }
- break;
+
+ case VK_CONTROL:
+ if (GetKeyState(VK_RCONTROL) & 0x80) {
+ return XK_Control_R;
}
- case VK_SHIFT: {
- if (GetKeyState(VK_RSHIFT) & 0x80) {
- return XK_Shift_R;
- }
- break;
+ break;
+ case VK_SHIFT:
+ if (GetKeyState(VK_RSHIFT) & 0x80) {
+ return XK_Shift_R;
}
- case VK_MENU: {
- if (GetKeyState(VK_RMENU) & 0x80) {
- return XK_Alt_R;
- }
- break;
+ break;
+ case VK_MENU:
+ if (GetKeyState(VK_RMENU) & 0x80) {
+ return XK_Alt_R;
}
+ break;
}
return keymap[keycode];
}
-
/*
*----------------------------------------------------------------------
*
* TkpGetKeySym --
*
- * Given an X KeyPress or KeyRelease event, map the
- * keycode in the event into a KeySym.
+ * Given an X KeyPress or KeyRelease event, map the keycode in the event
+ * into a KeySym.
*
* Results:
- * The return value is the KeySym corresponding to
- * eventPtr, or NoSymbol if no matching Keysym could be
- * found.
+ * The return value is the KeySym corresponding to eventPtr, or NoSymbol
+ * if no matching Keysym could be found.
*
* Side effects:
- * In the first call for a given display, keycode-to-
- * KeySym maps get loaded.
+ * In the first call for a given display, keycode-to-KeySym maps get
+ * loaded.
*
*----------------------------------------------------------------------
*/
KeySym
-TkpGetKeySym(dispPtr, eventPtr)
- TkDisplay *dispPtr; /* Display in which to map keycode. */
- XEvent *eventPtr; /* Description of X event. */
+TkpGetKeySym(
+ TkDisplay *dispPtr, /* Display in which to map keycode. */
+ XEvent *eventPtr) /* Description of X event. */
{
KeySym sym;
int state = eventPtr->xkey.state;
@@ -395,17 +400,17 @@ TkpGetKeySym(dispPtr, eventPtr)
sym = KeycodeToKeysym(eventPtr->xkey.keycode, state, 0);
/*
- * Special handling: if this is a ctrl-alt or shifted key, and there
- * is no keysym defined, try without the modifiers.
+ * Special handling: if this is a ctrl-alt or shifted key, and there is no
+ * keysym defined, try without the modifiers.
*/
if ((sym == NoSymbol) && ((state & ControlMask) || (state & Mod2Mask))) {
- state &= ~(ControlMask | Mod2Mask);
- sym = KeycodeToKeysym(eventPtr->xkey.keycode, state, 0);
+ state &= ~(ControlMask | Mod2Mask);
+ sym = KeycodeToKeysym(eventPtr->xkey.keycode, state, 0);
}
if ((sym == NoSymbol) && (state & ShiftMask)) {
- state &= ~ShiftMask;
- sym = KeycodeToKeysym(eventPtr->xkey.keycode, state, 0);
+ state &= ~ShiftMask;
+ sym = KeycodeToKeysym(eventPtr->xkey.keycode, state, 0);
}
return sym;
}
@@ -415,10 +420,9 @@ TkpGetKeySym(dispPtr, eventPtr)
*
* TkpInitKeymapInfo --
*
- * This procedure is invoked to scan keymap information
- * to recompute stuff that's important for binding, such
- * as the modifier key (if any) that corresponds to "mode
- * switch".
+ * This function is invoked to scan keymap information to recompute stuff
+ * that's important for binding, such as the modifier key (if any) that
+ * corresponds to "mode switch".
*
* Results:
* None.
@@ -430,8 +434,8 @@ TkpGetKeySym(dispPtr, eventPtr)
*/
void
-TkpInitKeymapInfo(dispPtr)
- TkDisplay *dispPtr; /* Display for which to recompute keymap
+TkpInitKeymapInfo(
+ TkDisplay *dispPtr) /* Display for which to recompute keymap
* information. */
{
XModifierKeymap *modMapPtr;
@@ -444,9 +448,9 @@ TkpInitKeymapInfo(dispPtr)
modMapPtr = XGetModifierMapping(dispPtr->display);
/*
- * Check the keycodes associated with the Lock modifier. If
- * any of them is associated with the XK_Shift_Lock modifier,
- * then Lock has to be interpreted as Shift Lock, not Caps Lock.
+ * Check the keycodes associated with the Lock modifier. If any of them is
+ * associated with the XK_Shift_Lock modifier, then Lock has to be
+ * interpreted as Shift Lock, not Caps Lock.
*/
dispPtr->lockUsage = LU_IGNORE;
@@ -467,9 +471,9 @@ TkpInitKeymapInfo(dispPtr)
}
/*
- * Look through the keycodes associated with modifiers to see if
- * the the "mode switch", "meta", or "alt" keysyms are associated
- * with any modifiers. If so, remember their modifier mask bits.
+ * Look through the keycodes associated with modifiers to see if the the
+ * "mode switch", "meta", or "alt" keysyms are associated with any
+ * modifiers. If so, remember their modifier mask bits.
*/
dispPtr->modeModMask = 0;
@@ -522,13 +526,13 @@ TkpInitKeymapInfo(dispPtr)
KeyCode *new;
/*
- * Ran out of space in the array; grow it.
+ * Ran out of space in the array; grow it.
*/
arraySize *= 2;
new = (KeyCode *) ckalloc((unsigned)
(arraySize * sizeof(KeyCode)));
- memcpy((VOID *) new, (VOID *) dispPtr->modKeyCodes,
+ memcpy((void *) new, (void *) dispPtr->modKeyCodes,
(dispPtr->numModKeyCodes * sizeof(KeyCode)));
ckfree((char *) dispPtr->modKeyCodes);
dispPtr->modKeyCodes = new;
@@ -541,51 +545,49 @@ TkpInitKeymapInfo(dispPtr)
}
/*
- * When mapping from a keysym to a keycode, need
- * information about the modifier state that should be used
- * so that when they call XKeycodeToKeysym taking into
- * account the xkey.state, they will get back the original
- * keysym.
+ * When mapping from a keysym to a keycode, need information about the
+ * modifier state that should be used so that when they call XKeycodeToKeysym
+ * taking into account the xkey.state, they will get back the original keysym.
*/
void
-TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
- Tk_Window tkwin;
- KeySym keySym;
- XEvent *eventPtr;
+TkpSetKeycodeAndState(
+ Tk_Window tkwin,
+ KeySym keySym,
+ XEvent *eventPtr)
{
int i;
SHORT result;
int shift;
-
+
eventPtr->xkey.keycode = 0;
if (keySym == NoSymbol) {
- return;
+ return;
}
/*
- * We check our private map first for a virtual keycode,
- * as VkKeyScan will return values that don't map to X
- * for the "extended" Syms. This may be due to just casting
- * problems below, but this works.
+ * We check our private map first for a virtual keycode, as VkKeyScan will
+ * return values that don't map to X for the "extended" Syms. This may be
+ * due to just casting problems below, but this works.
*/
+
for (i = 0; i <= MAX_KEYCODE; i++) {
if (keymap[i] == keySym) {
- eventPtr->xkey.keycode = i;
- return;
+ eventPtr->xkey.keycode = i;
+ return;
}
}
if (keySym >= 0x20) {
result = VkKeyScan((char) keySym);
if (result != -1) {
- shift = result >> 8;
- if (shift & 1)
- eventPtr->xkey.state |= ShiftMask;
- if (shift & 2)
- eventPtr->xkey.state |= ControlMask;
- if (shift & 4)
- eventPtr->xkey.state |= Mod2Mask;
- eventPtr->xkey.keycode = (KeyCode) (result & 0xff);
+ shift = result >> 8;
+ if (shift & 1)
+ eventPtr->xkey.state |= ShiftMask;
+ if (shift & 2)
+ eventPtr->xkey.state |= ControlMask;
+ if (shift & 4)
+ eventPtr->xkey.state |= Mod2Mask;
+ eventPtr->xkey.keycode = (KeyCode) (result & 0xff);
}
}
}
@@ -607,19 +609,19 @@ TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
*/
KeyCode
-XKeysymToKeycode(display, keysym)
- Display* display;
- KeySym keysym;
+XKeysymToKeycode(
+ Display *display,
+ KeySym keysym)
{
int i;
SHORT result;
/*
- * We check our private map first for a virtual keycode,
- * as VkKeyScan will return values that don't map to X
- * for the "extended" Syms. This may be due to just casting
- * problems below, but this works.
+ * We check our private map first for a virtual keycode, as VkKeyScan will
+ * return values that don't map to X for the "extended" Syms. This may be
+ * due to just casting problems below, but this works.
*/
+
if (keysym == NoSymbol) {
return 0;
}
@@ -655,10 +657,11 @@ XKeysymToKeycode(display, keysym)
*/
XModifierKeymap *
-XGetModifierMapping(display)
- Display* display;
+XGetModifierMapping(
+ Display *display)
{
- XModifierKeymap *map = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap));
+ XModifierKeymap *map = (XModifierKeymap *)
+ ckalloc(sizeof(XModifierKeymap));
map->max_keypermod = 1;
map->modifiermap = (KeyCode *) ckalloc(sizeof(KeyCode)*8);
@@ -678,8 +681,7 @@ XGetModifierMapping(display)
*
* XFreeModifiermap --
*
- * Deallocate a modifier map that was created by
- * XGetModifierMapping.
+ * Deallocate a modifier map that was created by XGetModifierMapping.
*
* Results:
* None.
@@ -691,8 +693,8 @@ XGetModifierMapping(display)
*/
void
-XFreeModifiermap(modmap)
- XModifierKeymap* modmap;
+XFreeModifiermap(
+ XModifierKeymap *modmap)
{
ckfree((char *) modmap->modifiermap);
ckfree((char *) modmap);
@@ -703,11 +705,11 @@ XFreeModifiermap(modmap)
*
* XStringToKeysym --
*
- * Translate a keysym name to the matching keysym.
+ * Translate a keysym name to the matching keysym.
*
* Results:
- * Returns the keysym. Since this is already handled by
- * Tk's StringToKeysym function, we just return NoSymbol.
+ * Returns the keysym. Since this is already handled by Tk's
+ * StringToKeysym function, we just return NoSymbol.
*
* Side effects:
* None.
@@ -716,8 +718,8 @@ XFreeModifiermap(modmap)
*/
KeySym
-XStringToKeysym(string)
- _Xconst char *string;
+XStringToKeysym(
+ _Xconst char *string)
{
return NoSymbol;
}
@@ -739,8 +741,16 @@ XStringToKeysym(string)
*/
char *
-XKeysymToString(keysym)
- KeySym keysym;
+XKeysymToString(
+ KeySym keysym)
{
return NULL;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index fe6132f..5ad29e1 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -1,15 +1,18 @@
-/*
+/*
* tkWinMenu.c --
*
- * This module implements the Windows platform-specific features of menus.
+ * This module implements the Windows platform-specific features of
+ * menus.
*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#define WINVER 0x0500 /* Requires Windows 2K definitions */
+#define _WIN32_WINNT 0x0500
#define OEMRESOURCE
#include "tkWinInt.h"
#include "tkMenu.h"
@@ -20,59 +23,88 @@
* The class of the window for popup menus.
*/
-#define MENU_CLASS_NAME "MenuWindowClass"
+#define MENU_CLASS_NAME "MenuWindowClass"
+#define EMBEDDED_MENU_CLASS_NAME "EmbeddedMenuWindowClass"
/*
* Used to align a windows bitmap inside a rectangle
*/
-#define ALIGN_BITMAP_LEFT 0x00000001
-#define ALIGN_BITMAP_RIGHT 0x00000002
-#define ALIGN_BITMAP_TOP 0x00000004
-#define ALIGN_BITMAP_BOTTOM 0x00000008
+#define ALIGN_BITMAP_LEFT 0x00000001
+#define ALIGN_BITMAP_RIGHT 0x00000002
+#define ALIGN_BITMAP_TOP 0x00000004
+#define ALIGN_BITMAP_BOTTOM 0x00000008
-#ifndef TPM_NOANIMATION
-#define TPM_NOANIMATION 0x4000L
-#endif
/*
* Platform-specific menu flags:
*
- * MENU_SYSTEM_MENU Non-zero means that the Windows menu handle
- * was retrieved with GetSystemMenu and needs
- * to be disposed of specially.
+ * MENU_SYSTEM_MENU Non-zero means that the Windows menu handle was
+ * retrieved with GetSystemMenu and needs to be disposed
+ * of specially.
* MENU_RECONFIGURE_PENDING
- * Non-zero means that an idle handler has
- * been set up to reconfigure the Windows menu
- * handle for this menu.
+ * Non-zero means that an idle handler has been set up to
+ * reconfigure the Windows menu handle for this menu.
*/
-#define MENU_SYSTEM_MENU MENU_PLATFORM_FLAG1
-#define MENU_RECONFIGURE_PENDING MENU_PLATFORM_FLAG2
+#define MENU_SYSTEM_MENU MENU_PLATFORM_FLAG1
+#define MENU_RECONFIGURE_PENDING MENU_PLATFORM_FLAG2
+
+/*
+ * ODS_NOACCEL flag forbids drawing accelerator cues (i.e. underlining labels)
+ * on Windows 2000 and above. The ODS_NOACCEL define is missing from mingw32
+ * headers and undefined for _WIN32_WINNT < 0x0500 in Microsoft SDK. We might
+ * check for _WIN32_WINNT here, but I think it's not needed, as checking for
+ * this flag does no harm on even on NT: reserved bits should be zero, and in
+ * fact they are.
+ */
+
+#ifndef ODS_NOACCEL
+#define ODS_NOACCEL 0x100
+#endif
+#ifndef SPI_GETKEYBOARDCUES
+#define SPI_GETKEYBOARDCUES 0x100A
+#endif
+#ifndef WM_UPDATEUISTATE
+#define WM_UPDATEUISTATE 0x0128
+#endif
+#ifndef UIS_SET
+#define UIS_SET 1
+#endif
+#ifndef UIS_CLEAR
+#define UIS_CLEAR 2
+#endif
+#ifndef UISF_HIDEACCEL
+#define UISF_HIDEACCEL 2
+#endif
#ifndef WM_UNINITMENUPOPUP
#define WM_UNINITMENUPOPUP 0x0125
#endif
static int indicatorDimensions[2];
- /* The dimensions of the indicator space
- * in a menu entry. Calculated at init
- * time to save time. */
+ /* The dimensions of the indicator space in a
+ * menu entry. Calculated at init time to save
+ * time. */
+
+static BOOL showMenuAccelerators;
typedef struct ThreadSpecificData {
int inPostMenu; /* We cannot be re-entrant like X Windows. */
- WORD lastCommandID; /* The last command ID we allocated. */
+ WORD lastCommandID; /* The last command ID we allocated. */
HWND menuHWND; /* A window to service popup-menu messages
* in. */
- int oldServiceMode; /* Used while processing a menu; we need
- * to set the event mode specially when we
- * enter the menu processing modal loop
- * and reset it when menus go away. */
+ HWND embeddedMenuHWND; /* A window to service embedded menu
+ * messages */
+ int oldServiceMode; /* Used while processing a menu; we need to
+ * set the event mode specially when we enter
+ * the menu processing modal loop and reset it
+ * when menus go away. */
TkMenu *modalMenuPtr; /* The menu we are processing inside the modal
- * loop. We need this to reset all of the
+ * loop. We need this to reset all of the
* active items when menus go away since
- * Windows does not see fit to give this
- * to us when it sends its WM_MENUSELECT. */
+ * Windows does not see fit to give this to us
+ * when it sends its WM_MENUSELECT. */
Tcl_HashTable commandTable; /* A map of command ids to menu entries */
Tcl_HashTable winMenuTable; /* Need this to map HMENUs back to menuPtrs */
} ThreadSpecificData;
@@ -87,90 +119,78 @@ static Tcl_DString menuFontDString;
/* A buffer to store the default menu font
* string. */
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void DrawMenuEntryAccelerator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr,
- Tk_3DBorder activeBorder, int x, int y,
- int width, int height));
-static void DrawMenuEntryArrow _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc,
+static void DrawMenuEntryAccelerator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
Tk_3DBorder activeBorder, int x, int y,
- int width, int height, int drawArrow));
-static void DrawMenuEntryBackground _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, Tk_3DBorder activeBorder,
- Tk_3DBorder bgBorder, int x, int y,
- int width, int heigth));
-static void DrawMenuEntryIndicator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, GC indicatorGC,
- Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuEntryLabel _ANSI_ARGS_((
- TkMenu * menuPtr, TkMenuEntry *mePtr, Drawable d,
- GC gc, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuSeparator _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static void DrawTearoffEntry _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static void DrawMenuUnderline _ANSI_ARGS_((TkMenu *menuPtr,
+ int width, int height);
+static void DrawMenuEntryArrow(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_3DBorder activeBorder,
+ int x,int y, int width, int height, int drawArrow);
+static void DrawMenuEntryBackground(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d,
+ Tk_3DBorder activeBorder, Tk_3DBorder bgBorder,
+ int x, int y, int width, int heigth);
+static void DrawMenuEntryIndicator(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, int x,
- int y, int width, int height));
-static void DrawWindowsSystemBitmap _ANSI_ARGS_((
- Display *display, Drawable drawable,
- GC gc, CONST RECT *rectPtr, int bitmapID,
- int alignFlags));
-static void FreeID _ANSI_ARGS_((WORD commandID));
-static TCHAR * GetEntryText _ANSI_ARGS_((TkMenuEntry *mePtr));
-static void GetMenuAccelGeometry _ANSI_ARGS_((TkMenu *menuPtr,
+ GC indicatorGC, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void DrawMenuEntryLabel(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height, int underline);
+static void DrawMenuSeparator(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void DrawTearoffEntry(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void DrawMenuUnderline(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void DrawWindowsSystemBitmap(Display *display,
+ Drawable drawable, GC gc, const RECT *rectPtr,
+ int bitmapID, int alignFlags);
+static void FreeID(WORD commandID);
+static TCHAR * GetEntryText(TkMenuEntry *mePtr);
+static void GetMenuAccelGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *widthPtr,
- int *heightPtr));
-static void GetMenuLabelGeometry _ANSI_ARGS_((TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuIndicatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuSeparatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetTearoffEntryGeometry _ANSI_ARGS_((TkMenu *menuPtr,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
+ int *heightPtr);
+static void GetMenuLabelGeometry(TkMenuEntry *mePtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetMenuIndicatorGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *widthPtr,
- int *heightPtr));
-static int GetNewID _ANSI_ARGS_((TkMenuEntry *mePtr,
- WORD *menuIDPtr));
-static int MenuKeyBindProc _ANSI_ARGS_((
- ClientData clientData,
- Tcl_Interp *interp, XEvent *eventPtr,
- Tk_Window tkwin, KeySym keySym));
-static void MenuSelectEvent _ANSI_ARGS_((TkMenu *menuPtr));
-static void ReconfigureWindowsMenu _ANSI_ARGS_((
- ClientData clientData));
-static void RecursivelyClearActiveMenu _ANSI_ARGS_((
- TkMenu *menuPtr));
-static void SetDefaults _ANSI_ARGS_((int firstTime));
-static LRESULT CALLBACK TkWinMenuProc _ANSI_ARGS_((HWND hwnd,
- UINT message, WPARAM wParam,
- LPARAM lParam));
-
-
+ const Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetMenuSeparatorGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetTearoffEntryGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
+ int *heightPtr);
+static int GetNewID(TkMenuEntry *mePtr, WORD *menuIDPtr);
+static int TkWinMenuKeyObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static void MenuSelectEvent(TkMenu *menuPtr);
+static void ReconfigureWindowsMenu(ClientData clientData);
+static void RecursivelyClearActiveMenu(TkMenu *menuPtr);
+static void SetDefaults(int firstTime);
+static LRESULT CALLBACK TkWinMenuProc(HWND hwnd, UINT message, WPARAM wParam,
+ LPARAM lParam);
+static LRESULT CALLBACK TkWinEmbeddedMenuProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
/*
*----------------------------------------------------------------------
@@ -180,56 +200,47 @@ static LRESULT CALLBACK TkWinMenuProc _ANSI_ARGS_((HWND hwnd,
* Allocates a new menu id and marks it in use.
*
* Results:
- * Returns TCL_OK if succesful; TCL_ERROR if there are no more
- * ids of the appropriate type to allocate. menuIDPtr contains
- * the new id if succesful.
+ * Returns TCL_OK if succesful; TCL_ERROR if there are no more ids of the
+ * appropriate type to allocate. menuIDPtr contains the new id if
+ * succesful.
*
* Side effects:
- * An entry is created for the menu in the command hash table,
- * and the hash entry is stored in the appropriate field in the
- * menu data structure.
+ * An entry is created for the menu in the command hash table, and the
+ * hash entry is stored in the appropriate field in the menu data
+ * structure.
*
*----------------------------------------------------------------------
*/
static int
-GetNewID(mePtr, menuIDPtr)
- TkMenuEntry *mePtr; /* The menu we are working with */
- WORD *menuIDPtr; /* The resulting id */
+GetNewID(
+ TkMenuEntry *mePtr, /* The menu we are working with. */
+ WORD *menuIDPtr) /* The resulting id. */
{
- int found = 0;
- int newEntry;
- Tcl_HashEntry *commandEntryPtr;
- WORD returnID;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
WORD curID = tsdPtr->lastCommandID + 1;
/*
* The following code relies on WORD wrapping when the highest value is
* incremented.
*/
-
+
while (curID != tsdPtr->lastCommandID) {
+ Tcl_HashEntry *commandEntryPtr;
+ int newEntry;
+
commandEntryPtr = Tcl_CreateHashEntry(&tsdPtr->commandTable,
- (char *) curID, &newEntry);
+ ((char *) NULL) + curID, &newEntry);
if (newEntry == 1) {
- found = 1;
- returnID = curID;
- break;
+ Tcl_SetHashValue(commandEntryPtr, (char *) mePtr);
+ *menuIDPtr = curID;
+ tsdPtr->lastCommandID = curID;
+ return TCL_OK;
}
curID++;
}
-
- if (found) {
- Tcl_SetHashValue(commandEntryPtr, (char *) mePtr);
- *menuIDPtr = returnID;
- tsdPtr->lastCommandID = returnID;
- return TCL_OK;
- } else {
- return TCL_ERROR;
- }
+ return TCL_ERROR;
}
/*
@@ -249,11 +260,11 @@ GetNewID(mePtr, menuIDPtr)
*/
static void
-FreeID(commandID)
- WORD commandID;
+FreeID(
+ WORD commandID)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* If the menuHWND is NULL, this table has been finalized already.
@@ -261,7 +272,7 @@ FreeID(commandID)
if (tsdPtr->menuHWND != NULL) {
Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable,
- (char *) commandID);
+ ((char *) NULL) + commandID);
if (entryPtr != NULL) {
Tcl_DeleteHashEntry(entryPtr);
}
@@ -287,15 +298,15 @@ FreeID(commandID)
*/
int
-TkpNewMenu(menuPtr)
- TkMenu *menuPtr; /* The common structure we are making the
- * platform structure for. */
+TkpNewMenu(
+ TkMenu *menuPtr) /* The common structure we are making the
+ * platform structure for. */
{
HMENU winMenuHdl;
Tcl_HashEntry *hashEntryPtr;
int newEntry;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
winMenuHdl = CreatePopupMenu();
@@ -306,8 +317,8 @@ TkpNewMenu(menuPtr)
}
/*
- * We hash all of the HMENU's so that we can get their menu ptrs
- * back when dispatch messages.
+ * We hash all of the HMENU's so that we can get their menu ptrs back when
+ * dispatch messages.
*/
hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->winMenuTable,
@@ -335,18 +346,18 @@ TkpNewMenu(menuPtr)
*/
void
-TkpDestroyMenu(menuPtr)
- TkMenu *menuPtr; /* The common menu structure */
+TkpDestroyMenu(
+ TkMenu *menuPtr) /* The common menu structure */
{
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
char *searchName;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
Tcl_CancelIdleCall(ReconfigureWindowsMenu, (ClientData) menuPtr);
}
-
+
if (winMenuHdl == NULL) {
return;
}
@@ -354,7 +365,7 @@ TkpDestroyMenu(menuPtr)
if (menuPtr->menuFlags & MENU_SYSTEM_MENU) {
TkMenuEntry *searchEntryPtr;
Tcl_HashTable *tablePtr = TkGetMenuHashTable(menuPtr->interp);
- char *menuName = Tcl_GetHashKey(tablePtr,
+ char *menuName = Tcl_GetHashKey(tablePtr,
menuPtr->menuRefPtr->hashEntryPtr);
/*
@@ -364,16 +375,16 @@ TkpDestroyMenu(menuPtr)
*/
for (searchEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
- searchEntryPtr != NULL;
- searchEntryPtr = searchEntryPtr->nextCascadePtr) {
- searchName = Tcl_GetStringFromObj(searchEntryPtr->namePtr, NULL);
+ searchEntryPtr != NULL;
+ searchEntryPtr = searchEntryPtr->nextCascadePtr) {
+ searchName = Tcl_GetString(searchEntryPtr->namePtr);
if (strcmp(searchName, menuName) == 0) {
Tk_Window parentTopLevelPtr = searchEntryPtr
- ->menuPtr->parentTopLevelPtr;
+ ->menuPtr->parentTopLevelPtr;
if (parentTopLevelPtr != NULL) {
- GetSystemMenu(TkWinGetWrapperWindow(parentTopLevelPtr),
- TRUE);
+ GetSystemMenu(
+ TkWinGetWrapperWindow(parentTopLevelPtr), TRUE);
}
break;
}
@@ -417,19 +428,19 @@ TkpDestroyMenu(menuPtr)
*/
void
-TkpDestroyMenuEntry(mePtr)
- TkMenuEntry *mePtr; /* The entry to destroy */
+TkpDestroyMenuEntry(
+ TkMenuEntry *mePtr) /* The entry to destroy */
{
TkMenu *menuPtr = mePtr->menuPtr;
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
if (NULL != winMenuHdl) {
- if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
+ if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr);
}
}
- FreeID((WORD) mePtr->platformEntryData);
+ FreeID((WORD) PTR2INT(mePtr->platformEntryData));
mePtr->platformEntryData = NULL;
}
@@ -439,9 +450,9 @@ TkpDestroyMenuEntry(mePtr)
* GetEntryText --
*
* Given a menu entry, gives back the text that should go in it.
- * Separators should be done by the caller, as they have to be
- * handled specially. Allocates the memory with alloc. The caller
- * should free the memory.
+ * Separators should be done by the caller, as they have to be handled
+ * specially. Allocates the memory with alloc. The caller should free the
+ * memory.
*
* Results:
* itemText points to the new text for the item.
@@ -453,8 +464,8 @@ TkpDestroyMenuEntry(mePtr)
*/
static char *
-GetEntryText(mePtr)
- TkMenuEntry *mePtr; /* A pointer to the menu entry. */
+GetEntryText(
+ TkMenuEntry *mePtr) /* A pointer to the menu entry. */
{
char *itemText;
@@ -472,18 +483,17 @@ GetEntryText(mePtr)
strcpy(itemText, "( )");
} else {
int i;
- char *label = (mePtr->labelPtr == NULL) ? ""
- : Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
- char *accel = (mePtr->accelPtr == NULL) ? ""
- : Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
- CONST char *p, *next;
+ char *label = (mePtr->labelPtr == NULL) ? ""
+ : Tcl_GetString(mePtr->labelPtr);
+ char *accel = (mePtr->accelPtr == NULL) ? ""
+ : Tcl_GetString(mePtr->accelPtr);
+ const char *p, *next;
Tcl_DString itemString;
/*
- * We have to construct the string with an ampersand
- * preceeding the underline character, and a tab seperating
- * the text and the accel text. We have to be careful with
- * ampersands in the string.
+ * We have to construct the string with an ampersand preceeding the
+ * underline character, and a tab seperating the text and the accel
+ * text. We have to be careful with ampersands in the string.
*/
Tcl_DStringInit(&itemString);
@@ -498,7 +508,7 @@ GetEntryText(mePtr)
next = Tcl_UtfNext(p);
Tcl_DStringAppend(&itemString, p, (int) (next - p));
}
- if (mePtr->accelLength > 0) {
+ if (mePtr->accelLength > 0) {
Tcl_DStringAppend(&itemString, "\t", 1);
for (p = accel, i = 0; *p != '\0'; i++, p = next) {
if (*p == '&') {
@@ -509,7 +519,7 @@ GetEntryText(mePtr)
}
}
- itemText = ckalloc(Tcl_DStringLength(&itemString) + 1);
+ itemText = ckalloc((unsigned)Tcl_DStringLength(&itemString) + 1);
strcpy(itemText, Tcl_DStringValue(&itemString));
Tcl_DStringFree(&itemString);
}
@@ -527,15 +537,15 @@ GetEntryText(mePtr)
* None.
*
* Side effects:
- * Configuration information get set for mePtr; old resources
- * get freed, if any need it.
+ * Configuration information get set for mePtr; old resources get freed,
+ * if any need it.
*
*----------------------------------------------------------------------
*/
static void
ReconfigureWindowsMenu(
- ClientData clientData) /* The menu we are rebuilding */
+ ClientData clientData) /* The menu we are rebuilding */
{
TkMenu *menuPtr = (TkMenu *) clientData;
TkMenuEntry *mePtr;
@@ -545,9 +555,8 @@ ReconfigureWindowsMenu(
UINT flags;
UINT itemID;
int i, count, systemMenu = 0, base;
- int width = 0, height = 0;
Tcl_DString translatedText;
-
+
if (NULL == winMenuHdl) {
return;
}
@@ -555,15 +564,8 @@ ReconfigureWindowsMenu(
/*
* Reconstruct the entire menu. Takes care of nasty system menu and index
* problem.
- *
*/
- if ((menuPtr->menuType == MENUBAR)
- && (menuPtr->parentTopLevelPtr != NULL)) {
- width = Tk_Width(menuPtr->parentTopLevelPtr);
- height = Tk_Height(menuPtr->parentTopLevelPtr);
- }
-
base = (menuPtr->menuFlags & MENU_SYSTEM_MENU) ? 7 : 0;
count = GetMenuItemCount(winMenuHdl);
for (i = base; i < count; i++) {
@@ -596,82 +598,83 @@ ReconfigureWindowsMenu(
/*
* Set enabling and disabling correctly.
*/
-
+
if (mePtr->state == ENTRY_DISABLED) {
flags |= MF_DISABLED | MF_GRAYED;
}
-
+
/*
* Set the check mark for check entries and radio entries.
*/
-
+
if (((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY))
&& (mePtr->entryFlags & ENTRY_SELECTED)) {
flags |= MF_CHECKED;
}
-
+
/*
- * Set the SEPARATOR bit for separator entries. This bit is not
- * used by our internal drawing functions, but it is used by the
- * system when drawing the system menu (we do not draw the system menu
- * ourselves). If this bit is not set, separator entries on the system
+ * Set the SEPARATOR bit for separator entries. This bit is not used
+ * by our internal drawing functions, but it is used by the system
+ * when drawing the system menu (we do not draw the system menu
+ * ourselves). If this bit is not set, separator entries on the system
* menu will not be drawn correctly.
*/
if (mePtr->type == SEPARATOR_ENTRY) {
flags |= MF_SEPARATOR;
}
-
+
if (mePtr->columnBreak) {
flags |= MF_MENUBREAK;
}
-
- itemID = (UINT) mePtr->platformEntryData;
+
+ itemID = PTR2INT(mePtr->platformEntryData);
if ((mePtr->type == CASCADE_ENTRY)
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
HMENU childMenuHdl = (HMENU) mePtr->childMenuRefPtr->menuPtr
->platformData;
if (childMenuHdl != NULL) {
- /*
- * Win32 draws the popup arrow in the wrong color
- * for a disabled cascade menu, so do it by hand.
- * Given it is disabled, there's no need for it to
- * be connected to its child.
+ /*
+ * Win32 draws the popup arrow in the wrong color for a
+ * disabled cascade menu, so do it by hand. Given it is
+ * disabled, there's no need for it to be connected to its
+ * child.
*/
+
if (mePtr->state != ENTRY_DISABLED) {
flags |= MF_POPUP;
/*
- * If the MF_POPUP flag is set, then the id
- * is interpreted as the handle of a submenu.
+ * If the MF_POPUP flag is set, then the id is interpreted
+ * as the handle of a submenu.
*/
- itemID = (UINT) childMenuHdl;
- }
+ itemID = PTR2INT(childMenuHdl);
+ }
}
- if ((menuPtr->menuType == MENUBAR)
+ if ((menuPtr->menuType == MENUBAR)
&& !(mePtr->childMenuRefPtr->menuPtr->menuFlags
& MENU_SYSTEM_MENU)) {
Tcl_DString ds;
TkMenuReferences *menuRefPtr;
TkMenu *systemMenuPtr = mePtr->childMenuRefPtr->menuPtr;
-
+
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds,
Tk_PathName(menuPtr->masterMenuPtr->tkwin), -1);
Tcl_DStringAppend(&ds, ".system", 7);
-
+
menuRefPtr = TkFindMenuReferences(menuPtr->interp,
Tcl_DStringValue(&ds));
-
+
Tcl_DStringFree(&ds);
-
- if ((menuRefPtr != NULL)
+
+ if ((menuRefPtr != NULL)
&& (menuRefPtr->menuPtr != NULL)
&& (menuPtr->parentTopLevelPtr != NULL)
&& (systemMenuPtr->masterMenuPtr
== menuRefPtr->menuPtr)) {
- HMENU systemMenuHdl =
+ HMENU systemMenuHdl =
(HMENU) systemMenuPtr->platformData;
HWND wrapper = TkWinGetWrapperWindow(menuPtr
->parentTopLevelPtr);
@@ -679,12 +682,12 @@ ReconfigureWindowsMenu(
DestroyMenu(systemMenuHdl);
systemMenuHdl = GetSystemMenu(wrapper, FALSE);
systemMenuPtr->menuFlags |= MENU_SYSTEM_MENU;
- systemMenuPtr->platformData =
- (TkMenuPlatformData) systemMenuHdl;
- if (!(systemMenuPtr->menuFlags
+ systemMenuPtr->platformData =
+ (TkMenuPlatformData) systemMenuHdl;
+ if (!(systemMenuPtr->menuFlags
& MENU_RECONFIGURE_PENDING)) {
- systemMenuPtr->menuFlags
- |= MENU_RECONFIGURE_PENDING;
+ systemMenuPtr->menuFlags
+ |= MENU_RECONFIGURE_PENDING;
Tcl_DoWhenIdle(ReconfigureWindowsMenu,
(ClientData) systemMenuPtr);
}
@@ -708,12 +711,15 @@ ReconfigureWindowsMenu(
}
- if ((menuPtr->menuType == MENUBAR)
+ if ((menuPtr->menuType == MENUBAR)
&& (menuPtr->parentTopLevelPtr != NULL)) {
- DrawMenuBar(TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr));
- Tk_GeometryRequest(menuPtr->parentTopLevelPtr, width, height);
+ HANDLE bar;
+ bar = TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr);
+ if (bar) {
+ DrawMenuBar(bar);
+ }
}
-
+
menuPtr->menuFlags &= ~(MENU_RECONFIGURE_PENDING);
}
@@ -734,21 +740,19 @@ ReconfigureWindowsMenu(
*/
int
-TkpPostMenu(interp, menuPtr, x, y)
- Tcl_Interp *interp;
- TkMenu *menuPtr;
- int x;
- int y;
+TkpPostMenu(
+ Tcl_Interp *interp,
+ TkMenu *menuPtr,
+ int x, int y)
{
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
- int i, result, flags;
+ int result, flags;
RECT noGoawayRect;
POINT point;
Tk_Window parentWindow = Tk_Parent(menuPtr->tkwin);
int oldServiceMode = Tcl_GetServiceMode();
- TkMenuEntry *mePtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->inPostMenu++;
@@ -809,19 +813,7 @@ TkpPostMenu(interp, menuPtr, x, y)
}
}
- /*
- * Disable menu animation if an image is present, as clipping isn't
- * handled correctly with temp DCs. [Bug 1329198]
- */
- for (i = 0; i < menuPtr->numEntries; i++) {
- mePtr = menuPtr->entries[i];
- if (mePtr->image != NULL) {
- flags |= TPM_NOANIMATION;
- break;
- }
- }
-
- TrackPopupMenu(winMenuHdl, flags, x, y, 0,
+ TrackPopupMenu(winMenuHdl, flags, x, y, 0,
tsdPtr->menuHWND, &noGoawayRect);
Tcl_SetServiceMode(oldServiceMode);
@@ -853,8 +845,8 @@ TkpPostMenu(interp, menuPtr, x, y)
*/
int
-TkpMenuNewEntry(mePtr)
- TkMenuEntry *mePtr;
+TkpMenuNewEntry(
+ TkMenuEntry *mePtr)
{
WORD commandID;
TkMenu *menuPtr = mePtr->menuPtr;
@@ -867,8 +859,8 @@ TkpMenuNewEntry(mePtr)
menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr);
}
-
- mePtr->platformEntryData = (TkMenuPlatformEntryData) commandID;
+
+ mePtr->platformEntryData = (TkMenuPlatformEntryData) INT2PTR(commandID);
return TCL_OK;
}
@@ -892,11 +884,11 @@ TkpMenuNewEntry(mePtr)
*/
static LRESULT CALLBACK
-TkWinMenuProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+TkWinMenuProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
LRESULT lResult;
@@ -909,321 +901,420 @@ TkWinMenuProc(hwnd, message, wParam, lParam)
/*
*----------------------------------------------------------------------
*
+ * UpdateEmbeddedMenu --
+ *
+ * This function is used as work-around for updating the pull-down window
+ * of an embedded menu which may show as a blank popup window.
+ *
+ * Results:
+ * Invalidate the client area of the embedded pull-down menu and
+ * redraw it.
+ *
+ * Side effects:
+ * Redraw the embedded menu window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UpdateEmbeddedMenu(
+ ClientData clientData)
+{
+ RECT rc;
+ HWND hMenuWnd = (HWND)clientData;
+ GetClientRect(hMenuWnd, &rc);
+ InvalidateRect(hMenuWnd, &rc, FALSE);
+ UpdateWindow(hMenuWnd);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWinEmbeddedMenuProc --
+ *
+ * This window proc is for the embedded menu windows. It provides
+ * message services to an embedded menu in a different process.
+ *
+ * Results:
+ * Returns 1 if the message has been handled or 0 otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static LRESULT CALLBACK
+TkWinEmbeddedMenuProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ static int nIdles = 0;
+ LRESULT lResult = 1;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ switch(message) {
+ case WM_ENTERIDLE:
+ if ((wParam == MSGF_MENU) && (nIdles < 1)
+ && (hwnd == tsdPtr->embeddedMenuHWND)) {
+ Tcl_CreateTimerHandler(200, UpdateEmbeddedMenu,
+ (ClientData) lParam);
+ nIdles++;
+ }
+ break;
+
+ case WM_INITMENUPOPUP:
+ nIdles = 0;
+ break;
+
+ case WM_SETTINGCHANGE:
+ if (wParam == SPI_SETNONCLIENTMETRICS
+ || wParam == SPI_SETKEYBOARDCUES) {
+ SetDefaults(0);
+ }
+ break;
+
+ case WM_INITMENU:
+ case WM_SYSCOMMAND:
+ case WM_COMMAND:
+ case WM_MENUCHAR:
+ case WM_MEASUREITEM:
+ case WM_DRAWITEM:
+ case WM_MENUSELECT:
+ lResult = TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam,
+ &lResult);
+ if (lResult || (GetCapture() != hwnd)) {
+ break;
+ }
+
+ default:
+ lResult = DefWindowProc(hwnd, message, wParam, lParam);
+ break;
+ }
+ return lResult;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkWinHandleMenuEvent --
*
- * Filters out menu messages from messages passed to a top-level.
- * Will respond appropriately to WM_COMMAND, WM_MENUSELECT,
- * WM_MEASUREITEM, WM_DRAWITEM
+ * Filters out menu messages from messages passed to a top-level. Will
+ * respond appropriately to WM_COMMAND, WM_MENUSELECT, WM_MEASUREITEM,
+ * WM_DRAWITEM
*
* Result:
* Returns 1 if this handled the message; 0 if it did not.
*
* Side effects:
- * All of the parameters may be modified so that the caller can
- * think it is getting a different message. plResult points to
- * the result that should be returned to windows from this message.
+ * All of the parameters may be modified so that the caller can think it
+ * is getting a different message. plResult points to the result that
+ * should be returned to windows from this message.
*
*----------------------------------------------------------------------
*/
int
-TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult)
- HWND *phwnd;
- UINT *pMessage;
- WPARAM *pwParam;
- LPARAM *plParam;
- LRESULT *plResult;
+TkWinHandleMenuEvent(
+ HWND *phwnd,
+ UINT *pMessage,
+ WPARAM *pwParam,
+ LPARAM *plParam,
+ LRESULT *plResult)
{
Tcl_HashEntry *hashEntryPtr;
int returnResult = 0;
TkMenu *menuPtr;
TkMenuEntry *mePtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
switch (*pMessage) {
- case WM_UNINITMENUPOPUP:
- hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
- (char *) *pwParam);
- if (hashEntryPtr != NULL) {
- menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
- if ((menuPtr->menuRefPtr != NULL)
- && (menuPtr->menuRefPtr->parentEntryPtr != NULL)) {
- TkPostSubmenu(menuPtr->interp,
- menuPtr->menuRefPtr->parentEntryPtr->menuPtr, NULL);
- }
- }
- break;
-
- case WM_INITMENU:
- TkMenuInit();
- hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
- (char *) *pwParam);
- if (hashEntryPtr != NULL) {
- tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
- tsdPtr->modalMenuPtr = menuPtr;
- if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
- Tcl_CancelIdleCall(ReconfigureWindowsMenu,
- (ClientData) menuPtr);
- ReconfigureWindowsMenu((ClientData) menuPtr);
- }
- RecursivelyClearActiveMenu(menuPtr);
- if (!tsdPtr->inPostMenu) {
- Tcl_Interp *interp;
- int code;
-
- interp = menuPtr->interp;
- Tcl_Preserve((ClientData)interp);
- code = TkPreprocessMenu(menuPtr);
- if ((code != TCL_OK) && (code != TCL_CONTINUE)
- && (code != TCL_BREAK)) {
- Tcl_AddErrorInfo(interp, "\n (menu preprocess)");
- Tcl_BackgroundError(interp);
- }
- Tcl_Release((ClientData)interp);
- }
- TkActivateMenuEntry(menuPtr, -1);
- *plResult = 0;
- returnResult = 1;
- } else {
- tsdPtr->modalMenuPtr = NULL;
+ case WM_UNINITMENUPOPUP:
+ hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
+ (char *) *pwParam);
+ if (hashEntryPtr != NULL) {
+ menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
+ if ((menuPtr->menuRefPtr != NULL)
+ && (menuPtr->menuRefPtr->parentEntryPtr != NULL)) {
+ TkPostSubmenu(menuPtr->interp,
+ menuPtr->menuRefPtr->parentEntryPtr->menuPtr, NULL);
}
- break;
-
- case WM_SYSCOMMAND:
- case WM_COMMAND: {
- TkMenuInit();
- if (HIWORD(*pwParam) != 0) {
- break;
- }
- hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable,
- (char *)LOWORD(*pwParam));
- if (hashEntryPtr == NULL) {
- break;
+ }
+ break;
+
+ case WM_INITMENU:
+ TkMenuInit();
+ hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
+ (char *) *pwParam);
+ if (hashEntryPtr != NULL) {
+ tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
+ menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
+ tsdPtr->modalMenuPtr = menuPtr;
+ if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
+ Tcl_CancelIdleCall(ReconfigureWindowsMenu,
+ (ClientData) menuPtr);
+ ReconfigureWindowsMenu((ClientData) menuPtr);
}
- mePtr = (TkMenuEntry *) Tcl_GetHashValue(hashEntryPtr);
- if (mePtr != NULL) {
- TkMenuReferences *menuRefPtr;
- TkMenuEntry *parentEntryPtr;
+ RecursivelyClearActiveMenu(menuPtr);
+ if (!tsdPtr->inPostMenu) {
Tcl_Interp *interp;
int code;
- /*
- * We have to set the parent of this menu to be active
- * if this is a submenu so that tearoffs will get the
- * correct title.
- */
-
- menuPtr = mePtr->menuPtr;
- menuRefPtr = TkFindMenuReferences(menuPtr->interp,
- Tk_PathName(menuPtr->tkwin));
- if ((menuRefPtr != NULL)
- && (menuRefPtr->parentEntryPtr != NULL)) {
- char *name;
-
- for (parentEntryPtr = menuRefPtr->parentEntryPtr;
- ;
- parentEntryPtr =
- parentEntryPtr->nextCascadePtr) {
- name = Tcl_GetStringFromObj(
- parentEntryPtr->namePtr, NULL);
- if (strcmp(name, Tk_PathName(menuPtr->tkwin))
- == 0) {
- break;
- }
- }
- if (parentEntryPtr->menuPtr->entries[parentEntryPtr->index]
- ->state != ENTRY_DISABLED) {
- TkActivateMenuEntry(parentEntryPtr->menuPtr,
- parentEntryPtr->index);
- }
- }
-
interp = menuPtr->interp;
Tcl_Preserve((ClientData)interp);
- code = TkInvokeMenu(interp, menuPtr, mePtr->index);
- if (code != TCL_OK && code != TCL_CONTINUE
- && code != TCL_BREAK) {
- Tcl_AddErrorInfo(interp, "\n (menu invoke)");
+ code = TkPreprocessMenu(menuPtr);
+ if ((code != TCL_OK) && (code != TCL_CONTINUE)
+ && (code != TCL_BREAK)) {
+ Tcl_AddErrorInfo(interp, "\n (menu preprocess)");
Tcl_BackgroundError(interp);
}
Tcl_Release((ClientData)interp);
}
+ TkActivateMenuEntry(menuPtr, -1);
*plResult = 0;
returnResult = 1;
+ } else {
+ tsdPtr->modalMenuPtr = NULL;
+ }
+ break;
+
+ case WM_SYSCOMMAND:
+ case WM_COMMAND:
+ TkMenuInit();
+ if (HIWORD(*pwParam) != 0) {
+ break;
+ }
+ hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable,
+ ((char *) NULL) + LOWORD(*pwParam));
+ if (hashEntryPtr == NULL) {
break;
}
+ mePtr = (TkMenuEntry *) Tcl_GetHashValue(hashEntryPtr);
+ if (mePtr != NULL) {
+ TkMenuReferences *menuRefPtr;
+ TkMenuEntry *parentEntryPtr;
+ Tcl_Interp *interp;
+ int code;
+ /*
+ * We have to set the parent of this menu to be active if this is
+ * a submenu so that tearoffs will get the correct title.
+ */
- case WM_MENUCHAR: {
- hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
- (char *) *plParam);
- if (hashEntryPtr != NULL) {
- int i, len, underline;
- Tcl_Obj *labelPtr;
- Tcl_UniChar *wlabel, menuChar;
+ menuPtr = mePtr->menuPtr;
+ menuRefPtr = TkFindMenuReferences(menuPtr->interp,
+ Tk_PathName(menuPtr->tkwin));
+ if ((menuRefPtr != NULL) && (menuRefPtr->parentEntryPtr != NULL)) {
+ for (parentEntryPtr = menuRefPtr->parentEntryPtr ; ;
+ parentEntryPtr = parentEntryPtr->nextCascadePtr) {
+ char *name = Tcl_GetString(parentEntryPtr->namePtr);
- *plResult = 0;
- menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
- /*
- * Assume we have something directly convertable to
- * Tcl_UniChar. True at least for wide systems.
- */
- menuChar = Tcl_UniCharToUpper((Tcl_UniChar) LOWORD(*pwParam));
-
- for (i = 0; i < menuPtr->numEntries; i++) {
- underline = menuPtr->entries[i]->underline;
- labelPtr = menuPtr->entries[i]->labelPtr;
- if ((underline >= 0) && (labelPtr != NULL)) {
- /*
- * Ensure we don't exceed the label length, then check
- */
- wlabel = Tcl_GetUnicodeFromObj(labelPtr, &len);
- if ((underline < len) && (menuChar ==
- Tcl_UniCharToUpper(wlabel[underline]))) {
- *plResult = (2 << 16) | i;
- returnResult = 1;
- break;
- }
+ if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
+ break;
}
}
+ if (parentEntryPtr->menuPtr->entries[parentEntryPtr->index]
+ ->state != ENTRY_DISABLED) {
+ TkActivateMenuEntry(parentEntryPtr->menuPtr,
+ parentEntryPtr->index);
+ }
}
- break;
- }
- case WM_MEASUREITEM: {
- LPMEASUREITEMSTRUCT itemPtr = (LPMEASUREITEMSTRUCT) *plParam;
+ interp = menuPtr->interp;
+ Tcl_Preserve((ClientData)interp);
+ code = TkInvokeMenu(interp, menuPtr, mePtr->index);
+ if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
+ Tcl_AddErrorInfo(interp, "\n (menu invoke)");
+ Tcl_BackgroundError(interp);
+ }
+ Tcl_Release((ClientData)interp);
+ *plResult = 0;
+ returnResult = 1;
+ }
+ break;
- if (itemPtr != NULL) {
- mePtr = (TkMenuEntry *) itemPtr->itemData;
- menuPtr = mePtr->menuPtr;
+ case WM_MENUCHAR: {
+ hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
+ (char *) *plParam);
+ if (hashEntryPtr != NULL) {
+ int i, len, underline;
+ Tcl_Obj *labelPtr;
+ Tcl_UniChar *wlabel, menuChar;
- TkRecomputeMenu(menuPtr);
- itemPtr->itemHeight = mePtr->height;
- itemPtr->itemWidth = mePtr->width;
- if (mePtr->hideMargin) {
- itemPtr->itemWidth += 2 - indicatorDimensions[1];
- } else {
- int activeBorderWidth;
+ *plResult = 0;
+ menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
+ /*
+ * Assume we have something directly convertable to Tcl_UniChar.
+ * True at least for wide systems.
+ */
+ menuChar = Tcl_UniCharToUpper((Tcl_UniChar) LOWORD(*pwParam));
- Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin,
- menuPtr->activeBorderWidthPtr,
- &activeBorderWidth);
- itemPtr->itemWidth += 2 * activeBorderWidth;
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ underline = menuPtr->entries[i]->underline;
+ labelPtr = menuPtr->entries[i]->labelPtr;
+ if ((underline >= 0) && (labelPtr != NULL)) {
+ /*
+ * Ensure we don't exceed the label length, then check
+ */
+ wlabel = Tcl_GetUnicodeFromObj(labelPtr, &len);
+ if ((underline < len) && (menuChar ==
+ Tcl_UniCharToUpper(wlabel[underline]))) {
+ *plResult = (2 << 16) | i;
+ returnResult = 1;
+ break;
+ }
}
- *plResult = 1;
- returnResult = 1;
}
- break;
}
+ break;
+ }
- case WM_DRAWITEM: {
- TkWinDrawable *twdPtr;
- LPDRAWITEMSTRUCT itemPtr = (LPDRAWITEMSTRUCT) *plParam;
- Tk_FontMetrics fontMetrics;
- int drawArrow = 0;
+ case WM_MEASUREITEM: {
+ LPMEASUREITEMSTRUCT itemPtr = (LPMEASUREITEMSTRUCT) *plParam;
- if (itemPtr != NULL) {
- Tk_Font tkfont;
+ if (itemPtr != NULL && tsdPtr->modalMenuPtr != NULL) {
+ mePtr = (TkMenuEntry *) itemPtr->itemData;
+ menuPtr = mePtr->menuPtr;
- mePtr = (TkMenuEntry *) itemPtr->itemData;
- menuPtr = mePtr->menuPtr;
- twdPtr = (TkWinDrawable *) ckalloc(sizeof(TkWinDrawable));
- twdPtr->type = TWD_WINDC;
- twdPtr->winDC.hdc = itemPtr->hDC;
+ TkRecomputeMenu(menuPtr);
+ itemPtr->itemHeight = mePtr->height;
+ itemPtr->itemWidth = mePtr->width;
+ if (mePtr->hideMargin) {
+ itemPtr->itemWidth += 2 - indicatorDimensions[1];
+ } else {
+ int activeBorderWidth;
- if (mePtr->state != ENTRY_DISABLED) {
- if (itemPtr->itemState & ODS_SELECTED) {
- TkActivateMenuEntry(menuPtr, mePtr->index);
- } else {
- TkActivateMenuEntry(menuPtr, -1);
- }
+ Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
+ itemPtr->itemWidth += 2 * activeBorderWidth;
+ }
+ *plResult = 1;
+ returnResult = 1;
+ }
+ break;
+ }
+
+ case WM_DRAWITEM: {
+ TkWinDrawable *twdPtr;
+ LPDRAWITEMSTRUCT itemPtr = (LPDRAWITEMSTRUCT) *plParam;
+ Tk_FontMetrics fontMetrics;
+ int drawingParameters = 0;
+
+ if (itemPtr != NULL && tsdPtr->modalMenuPtr != NULL) {
+ Tk_Font tkfont;
+
+ if (itemPtr->itemState & ODS_NOACCEL && !showMenuAccelerators) {
+ drawingParameters |= DRAW_MENU_ENTRY_NOUNDERLINE;
+ }
+ mePtr = (TkMenuEntry *) itemPtr->itemData;
+ menuPtr = mePtr->menuPtr;
+ twdPtr = (TkWinDrawable *) ckalloc(sizeof(TkWinDrawable));
+ twdPtr->type = TWD_WINDC;
+ twdPtr->winDC.hdc = itemPtr->hDC;
+
+ if (mePtr->state != ENTRY_DISABLED) {
+ if (itemPtr->itemState & ODS_SELECTED) {
+ TkActivateMenuEntry(menuPtr, mePtr->index);
} else {
- /* On windows, menu entries should highlight even if they
- ** are disabled. (I know this seems dumb, but it is the way
- ** native windows menus works so we ought to mimic it.)
- ** The ENTRY_PLATFORM_FLAG1 flag will indicate that the
- ** entry should be highlighted even though it is disabled.
- */
- if (itemPtr->itemState & ODS_SELECTED) {
- mePtr->entryFlags |= ENTRY_PLATFORM_FLAG1;
- } else {
- mePtr->entryFlags &= ~ENTRY_PLATFORM_FLAG1;
- }
- /* Also, set the drawArrow flag for a disabled cascade
- ** menu since we need to draw the arrow ourselves.
- */
- if (mePtr->type == CASCADE_ENTRY) {
- drawArrow = 1;
- }
+ TkActivateMenuEntry(menuPtr, -1);
}
+ } else {
+ /*
+ * On windows, menu entries should highlight even if they are
+ * disabled. (I know this seems dumb, but it is the way native
+ * windows menus works so we ought to mimic it.) The
+ * ENTRY_PLATFORM_FLAG1 flag will indicate that the entry
+ * should be highlighted even though it is disabled.
+ */
- tkfont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
- Tk_GetFontMetrics(tkfont, &fontMetrics);
- TkpDrawMenuEntry(mePtr, (Drawable) twdPtr, tkfont,
- &fontMetrics, itemPtr->rcItem.left,
- itemPtr->rcItem.top, itemPtr->rcItem.right
- - itemPtr->rcItem.left, itemPtr->rcItem.bottom
- - itemPtr->rcItem.top, 0, drawArrow);
+ if (itemPtr->itemState & ODS_SELECTED) {
+ mePtr->entryFlags |= ENTRY_PLATFORM_FLAG1;
+ } else {
+ mePtr->entryFlags &= ~ENTRY_PLATFORM_FLAG1;
+ }
- ckfree((char *) twdPtr);
- *plResult = 1;
- returnResult = 1;
+ /*
+ * Also, set the DRAW_MENU_ENTRY_ARROW flag for a disabled
+ * cascade menu since we need to draw the arrow ourselves.
+ */
+
+ if (mePtr->type == CASCADE_ENTRY) {
+ drawingParameters |= DRAW_MENU_ENTRY_ARROW;
+ }
}
- break;
+
+ tkfont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
+ Tk_GetFontMetrics(tkfont, &fontMetrics);
+ TkpDrawMenuEntry(mePtr, (Drawable) twdPtr, tkfont, &fontMetrics,
+ itemPtr->rcItem.left, itemPtr->rcItem.top,
+ itemPtr->rcItem.right - itemPtr->rcItem.left,
+ itemPtr->rcItem.bottom - itemPtr->rcItem.top,
+ 0, drawingParameters);
+
+ ckfree((char *) twdPtr);
}
+ *plResult = 1;
+ returnResult = 1;
+ break;
+ }
- case WM_MENUSELECT: {
- UINT flags = HIWORD(*pwParam);
+ case WM_MENUSELECT: {
+ UINT flags = HIWORD(*pwParam);
- TkMenuInit();
+ TkMenuInit();
- if ((flags == 0xFFFF) && (*plParam == 0)) {
- if (tsdPtr->modalMenuPtr != NULL) {
- Tcl_SetServiceMode(tsdPtr->oldServiceMode);
- RecursivelyClearActiveMenu(tsdPtr->modalMenuPtr);
- }
- } else {
- menuPtr = NULL;
- if (*plParam != 0) {
- hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
- (char *) *plParam);
- if (hashEntryPtr != NULL) {
- menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
- }
+ if ((flags == 0xFFFF) && (*plParam == 0)) {
+ if (tsdPtr->modalMenuPtr != NULL) {
+ Tcl_SetServiceMode(tsdPtr->oldServiceMode);
+ RecursivelyClearActiveMenu(tsdPtr->modalMenuPtr);
+ }
+ } else {
+ menuPtr = NULL;
+ if (*plParam != 0) {
+ hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
+ (char *) *plParam);
+ if (hashEntryPtr != NULL) {
+ menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
}
+ }
- if (menuPtr != NULL) {
- mePtr = NULL;
- if (flags != 0xFFFF) {
- if (flags & MF_POPUP) {
- mePtr = menuPtr->entries[LOWORD(*pwParam)];
- } else {
- hashEntryPtr = Tcl_FindHashEntry(
- &tsdPtr->commandTable,
- (char *) LOWORD(*pwParam));
- if (hashEntryPtr != NULL) {
- mePtr = (TkMenuEntry *)
- Tcl_GetHashValue(hashEntryPtr);
- }
- }
- }
+ if (menuPtr != NULL) {
+ long entryIndex = LOWORD(*pwParam);
- if ((mePtr == NULL) || (mePtr->state == ENTRY_DISABLED)) {
- TkActivateMenuEntry(menuPtr, -1);
+ mePtr = NULL;
+ if (flags != 0xFFFF) {
+ if ((flags&MF_POPUP) && (entryIndex<menuPtr->numEntries)) {
+ mePtr = menuPtr->entries[entryIndex];
} else {
- if (mePtr->index >= menuPtr->numEntries) {
- Tcl_Panic("Trying to activate an entry which doesn't exist.");
+ hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable,
+ ((char *) NULL) + entryIndex);
+ if (hashEntryPtr != NULL) {
+ mePtr = (TkMenuEntry *)
+ Tcl_GetHashValue(hashEntryPtr);
}
- TkActivateMenuEntry(menuPtr, mePtr->index);
}
- MenuSelectEvent(menuPtr);
- Tcl_ServiceAll();
}
+
+ if ((mePtr == NULL) || (mePtr->state == ENTRY_DISABLED)) {
+ TkActivateMenuEntry(menuPtr, -1);
+ } else {
+ if (mePtr->index >= menuPtr->numEntries) {
+ Tcl_Panic("Trying to activate an entry which doesn't exist.");
+ }
+ TkActivateMenuEntry(menuPtr, mePtr->index);
+ }
+ MenuSelectEvent(menuPtr);
+ Tcl_ServiceAll();
+ *plResult = 0;
+ returnResult = 1;
}
- break;
}
+ break;
+ }
}
return returnResult;
}
@@ -1250,7 +1341,7 @@ RecursivelyClearActiveMenu(
{
int i;
TkMenuEntry *mePtr;
-
+
TkActivateMenuEntry(menuPtr, -1);
MenuSelectEvent(menuPtr);
for (i = 0; i < menuPtr->numEntries; i++) {
@@ -1286,26 +1377,27 @@ RecursivelyClearActiveMenu(
*/
void
-TkpSetWindowMenuBar(tkwin, menuPtr)
- Tk_Window tkwin; /* The window we are putting the menubar into.*/
- TkMenu *menuPtr; /* The menu we are inserting */
+TkpSetWindowMenuBar(
+ Tk_Window tkwin, /* The window we are putting the menubar
+ * into.*/
+ TkMenu *menuPtr) /* The menu we are inserting */
{
HMENU winMenuHdl;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (menuPtr != NULL) {
Tcl_HashEntry *hashEntryPtr;
int newEntry;
winMenuHdl = (HMENU) menuPtr->platformData;
- hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
- (char *) winMenuHdl);
+ hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
+ (char *) winMenuHdl);
Tcl_DeleteHashEntry(hashEntryPtr);
DestroyMenu(winMenuHdl);
winMenuHdl = CreateMenu();
- hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->winMenuTable,
- (char *) winMenuHdl, &newEntry);
+ hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->winMenuTable,
+ (char *) winMenuHdl, &newEntry);
Tcl_SetHashValue(hashEntryPtr, (char *) menuPtr);
menuPtr->platformData = (TkMenuPlatformData) winMenuHdl;
TkWinSetMenu(tkwin, winMenuHdl);
@@ -1323,8 +1415,8 @@ TkpSetWindowMenuBar(tkwin, menuPtr)
*
* TkpSetMainMenubar --
*
- * Puts the menu associated with a window into the menubar. Should
- * only be called when the window is in front.
+ * Puts the menu associated with a window into the menubar. Should only
+ * be called when the window is in front.
*
* Results:
* None.
@@ -1334,13 +1426,13 @@ TkpSetWindowMenuBar(tkwin, menuPtr)
*
*----------------------------------------------------------------------
*/
+
void
TkpSetMainMenubar(
Tcl_Interp *interp, /* The interpreter of the application */
Tk_Window tkwin, /* The frame we are setting up */
- char *menuName) /* The name of the menu to put in front.
- * If NULL, use the default menu bar.
- */
+ char *menuName) /* The name of the menu to put in front. If
+ * NULL, use the default menu bar. */
{
/*
* Nothing to do.
@@ -1364,13 +1456,13 @@ TkpSetMainMenubar(
*/
void
-GetMenuIndicatorGeometry (
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* Precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* Precalculated font metrics */
- int *widthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
+GetMenuIndicatorGeometry(
+ TkMenu *menuPtr, /* The menu we are measuring */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* Precalculated font */
+ const Tk_FontMetrics *fmPtr,/* Precalculated font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
*heightPtr = indicatorDimensions[0];
if (mePtr->hideMargin) {
@@ -1401,13 +1493,13 @@ GetMenuIndicatorGeometry (
*/
void
-GetMenuAccelGeometry (
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int *widthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
+GetMenuAccelGeometry(
+ TkMenu *menuPtr, /* The menu we are measuring */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
@@ -1415,7 +1507,8 @@ GetMenuAccelGeometry (
} else if (mePtr->accelPtr == NULL) {
*widthPtr = 0;
} else {
- char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
+ char *accel = Tcl_GetString(mePtr->accelPtr);
+
*widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
}
}
@@ -1437,13 +1530,13 @@ GetMenuAccelGeometry (
*/
void
-GetTearoffEntryGeometry (
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int *widthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
+GetTearoffEntryGeometry(
+ TkMenu *menuPtr, /* The menu we are measuring */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
if (menuPtr->menuType != MASTER_MENU) {
*heightPtr = 0;
@@ -1470,13 +1563,13 @@ GetTearoffEntryGeometry (
*/
void
-GetMenuSeparatorGeometry (
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalcualted font metrics */
- int *widthPtr, /* The resulting width */
- int *heightPtr) /* The resulting height */
+GetMenuSeparatorGeometry(
+ TkMenu *menuPtr, /* The menu we are measuring */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
*widthPtr = 0;
*heightPtr = fmPtr->linespace - (2 * fmPtr->descent);
@@ -1487,10 +1580,10 @@ GetMenuSeparatorGeometry (
*
* DrawWindowsSystemBitmap --
*
- * Draws the windows system bitmap given by bitmapID into the rect
- * given by rectPtr in the drawable. The bitmap is centered in the
- * rectangle. It is not clipped, so if the bitmap is bigger than
- * the rect it will bleed.
+ * Draws the windows system bitmap given by bitmapID into the rect given
+ * by rectPtr in the drawable. The bitmap is centered in the rectangle.
+ * It is not clipped, so if the bitmap is bigger than the rect it will
+ * bleed.
*
* Results:
* None.
@@ -1502,15 +1595,15 @@ GetMenuSeparatorGeometry (
*/
static void
-DrawWindowsSystemBitmap(display, drawable, gc, rectPtr, bitmapID, alignFlags)
- Display *display; /* The display we are drawing into */
- Drawable drawable; /* The drawable we are working with */
- GC gc; /* The GC to draw with */
- CONST RECT *rectPtr; /* The rectangle to draw into */
- int bitmapID; /* The windows id of the system
- * bitmap to draw. */
- int alignFlags; /* How to align the bitmap inside the
- * rectangle. */
+DrawWindowsSystemBitmap(
+ Display *display, /* The display we are drawing into */
+ Drawable drawable, /* The drawable we are working with */
+ GC gc, /* The GC to draw with */
+ const RECT *rectPtr, /* The rectangle to draw into */
+ int bitmapID, /* The windows id of the system bitmap to
+ * draw. */
+ int alignFlags) /* How to align the bitmap inside the
+ * rectangle. */
{
TkWinDCState state;
HDC hdc = TkWinGetDrawableDC(display, drawable, &state);
@@ -1520,7 +1613,7 @@ DrawWindowsSystemBitmap(display, drawable, gc, rectPtr, bitmapID, alignFlags)
POINT ptSize;
POINT ptOrg;
int topOffset, leftOffset;
-
+
SetBkColor(hdc, gc->background);
SetTextColor(hdc, gc->foreground);
@@ -1552,7 +1645,7 @@ DrawWindowsSystemBitmap(display, drawable, gc, rectPtr, bitmapID, alignFlags)
} else {
leftOffset = (rectPtr->right - rectPtr->left) / 2 - (ptSize.x / 2);
}
-
+
BitBlt(hdc, rectPtr->left + leftOffset, rectPtr->top + topOffset, ptSize.x,
ptSize.y, scratchDC, ptOrg.x, ptOrg.y, SRCCOPY);
DeleteDC(scratchDC);
@@ -1566,38 +1659,38 @@ DrawWindowsSystemBitmap(display, drawable, gc, rectPtr, bitmapID, alignFlags)
*
* DrawMenuEntryIndicator --
*
- * This procedure draws the indicator part of a menu.
+ * This function draws the indicator part of a menu.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
+
void
-DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr, x,
- y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* What we are drawing into */
- GC gc; /* The gc we are drawing with */
- GC indicatorGC; /* The gc for indicator objects */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated font metrics */
- int x; /* Left edge */
- int y; /* Top edge */
- int width;
- int height;
+DrawMenuEntryIndicator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ GC indicatorGC, /* The gc for indicator objects */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, /* Left edge */
+ int y, /* Top edge */
+ int width,
+ int height)
{
- if ((mePtr->type == CHECK_BUTTON_ENTRY)
+ if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
if (mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED)) {
RECT rect;
GC whichGC;
int borderWidth, activeBorderWidth;
+
if (mePtr->state != ENTRY_NORMAL) {
whichGC = gc;
} else {
@@ -1617,21 +1710,21 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr, x,
&& (menuPtr->disabledFgPtr != NULL)) {
RECT hilightRect;
COLORREF oldFgColor = whichGC->foreground;
-
+
whichGC->foreground = GetSysColor(COLOR_3DHILIGHT);
hilightRect.top = rect.top + 1;
hilightRect.bottom = rect.bottom + 1;
hilightRect.left = rect.left + 1;
hilightRect.right = rect.right + 1;
- DrawWindowsSystemBitmap(menuPtr->display, d, whichGC,
+ DrawWindowsSystemBitmap(menuPtr->display, d, whichGC,
&hilightRect, OBM_CHECK, 0);
whichGC->foreground = oldFgColor;
}
- DrawWindowsSystemBitmap(menuPtr->display, d, whichGC, &rect,
+ DrawWindowsSystemBitmap(menuPtr->display, d, whichGC, &rect,
OBM_CHECK, 0);
}
- }
+ }
}
/*
@@ -1639,11 +1732,10 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr, x,
*
* DrawMenuEntryAccelerator --
*
- * This procedure draws the accelerator part of a menu.
- * For example, the string "CTRL-Z" could be drawn to
- * to the right of the label text for an Undo menu entry.
- * Need to decide what to draw here. Should we replace strings
- * like "Control", "Command", etc?
+ * This function draws the accelerator part of a menu. For example, the
+ * string "CTRL-Z" could be drawn to to the right of the label text for
+ * an Undo menu entry. Need to decide what to draw here. Should we
+ * replace strings like "Control", "Command", etc?
*
* Results:
* None.
@@ -1656,49 +1748,51 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr, x,
*/
void
-DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
- activeBorder, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* What we are drawing into */
- GC gc; /* The gc we are drawing with */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated font metrics */
- Tk_3DBorder activeBorder; /* The border when an item is active */
- int x; /* left edge */
- int y; /* top edge */
- int width; /* Width of menu entry */
- int height; /* Height of menu entry */
+DrawMenuEntryAccelerator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ Tk_3DBorder activeBorder, /* The border when an item is active */
+ int x, /* left edge */
+ int y, /* top edge */
+ int width, /* Width of menu entry */
+ int height) /* Height of menu entry */
{
int baseline;
int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth;
- char *accel = NULL;
-
+ char *accel;
+
if (mePtr->accelPtr != NULL) {
- accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
+ accel = Tcl_GetString(mePtr->accelPtr);
+ } else {
+ accel = NULL;
}
baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
- /* Draw disabled 3D text highlight only with the Win95/98 look. */
+ /*
+ * Draw disabled 3D text highlight only with the Win95/98 look.
+ */
if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) {
- if ((mePtr->state == ENTRY_DISABLED) && (menuPtr->disabledFgPtr != NULL)
- && (mePtr->accelPtr != NULL)) {
+ if ((mePtr->state == ENTRY_DISABLED)
+ && (menuPtr->disabledFgPtr != NULL) && (accel != NULL)) {
COLORREF oldFgColor = gc->foreground;
gc->foreground = GetSysColor(COLOR_3DHILIGHT);
- if ((mePtr->accelPtr != NULL) &&
- ((mePtr->entryFlags & ENTRY_PLATFORM_FLAG1) == 0)) {
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
- mePtr->accelLength, leftEdge + 1, baseline + 1);
+ if ((mePtr->entryFlags & ENTRY_PLATFORM_FLAG1) == 0) {
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
+ mePtr->accelLength, leftEdge + 1, baseline + 1);
}
gc->foreground = oldFgColor;
}
}
- if (mePtr->accelPtr != NULL) {
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
+ if (accel != NULL) {
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
mePtr->accelLength, leftEdge, baseline);
}
}
@@ -1708,8 +1802,9 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
*
* DrawMenuEntryArrow --
*
- * This function draws the arrow bitmap on the right side of a
- * a menu entry. This function is currently unused.
+ * This function draws the arrow bitmap on the right side of a menu
+ * entry. This function is only used when drawing the arrow for a
+ * disabled cascade menu.
*
* Results:
* None.
@@ -1721,44 +1816,47 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
*/
void
-DrawMenuEntryArrow(menuPtr, mePtr, d, gc,
- activeBorder, x, y, width, height, drawArrow)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* What we are drawing into */
- GC gc; /* The gc we are drawing with */
- Tk_3DBorder activeBorder; /* The border when an item is active */
- int x; /* left edge */
- int y; /* top edge */
- int width; /* Width of menu entry */
- int height; /* Height of menu entry */
- int drawArrow; /* For cascade menus, whether of not
- * to draw the arraw. I cannot figure
- * out Windows' algorithm for where
- * to draw this. */
+DrawMenuEntryArrow(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_3DBorder activeBorder, /* The border when an item is active */
+ int x, /* left edge */
+ int y, /* top edge */
+ int width, /* Width of menu entry */
+ int height, /* Height of menu entry */
+ int drawArrow) /* For cascade menus, whether of not to draw
+ * the arraw. I cannot figure out Windows'
+ * algorithm for where to draw this. */
{
COLORREF oldFgColor;
COLORREF oldBgColor;
RECT rect;
- if (!drawArrow || (mePtr->type != CASCADE_ENTRY))
- return;
+ if (!drawArrow || (mePtr->type != CASCADE_ENTRY)) {
+ return;
+ }
oldFgColor = gc->foreground;
oldBgColor = gc->background;
- /* Set bitmap bg to highlight color if the menu is highlighted */
+ /*
+ * Set bitmap bg to highlight color if the menu is highlighted.
+ */
+
if (mePtr->entryFlags & ENTRY_PLATFORM_FLAG1) {
- XColor *activeBgColor = Tk_3DBorderColor(Tk_Get3DBorderFromObj(
- mePtr->menuPtr->tkwin,
- (mePtr->activeBorderPtr == NULL) ?
- mePtr->menuPtr->activeBorderPtr :
- mePtr->activeBorderPtr));
- gc->background = activeBgColor->pixel;
+ XColor *activeBgColor = Tk_3DBorderColor(Tk_Get3DBorderFromObj(
+ mePtr->menuPtr->tkwin, (mePtr->activeBorderPtr == NULL)
+ ? mePtr->menuPtr->activeBorderPtr
+ : mePtr->activeBorderPtr));
+ gc->background = activeBgColor->pixel;
}
- gc->foreground = GetSysColor((mePtr->state == ENTRY_DISABLED) ?
- COLOR_GRAYTEXT : COLOR_MENUTEXT);
+ gc->foreground = GetSysColor((mePtr->state == ENTRY_DISABLED)
+ ? COLOR_GRAYTEXT
+ : ((mePtr->state == ENTRY_ACTIVE)
+ ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT));
rect.top = y + GetSystemMetrics(SM_CYBORDER);
rect.bottom = y + height - GetSystemMetrics(SM_CYBORDER);
@@ -1766,7 +1864,7 @@ DrawMenuEntryArrow(menuPtr, mePtr, d, gc,
rect.right = x + width;
DrawWindowsSystemBitmap(menuPtr->display, d, gc, &rect, OBM_MNARROW,
- ALIGN_BITMAP_RIGHT);
+ ALIGN_BITMAP_RIGHT);
gc->foreground = oldFgColor;
gc->background = oldBgColor;
@@ -1784,23 +1882,23 @@ DrawMenuEntryArrow(menuPtr, mePtr, d, gc,
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
+
void
-DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* What we are drawing into */
- GC gc; /* The gc we are drawing with */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated font metrics */
- int x; /* left edge */
- int y; /* top edge */
- int width; /* width of item */
- int height; /* height of item */
+DrawMenuSeparator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, /* left edge */
+ int y, /* top edge */
+ int width, /* width of item */
+ int height) /* height of item */
{
XPoint points[2];
Tk_3DBorder border;
@@ -1810,7 +1908,7 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
points[1].x = x + width - 1;
points[1].y = points[0].y;
border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
- Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1,
+ Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1,
TK_RELIEF_RAISED);
}
@@ -1825,23 +1923,23 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
+
static void
DrawMenuUnderline(
- TkMenu *menuPtr, /* The menu to draw into */
- TkMenuEntry *mePtr, /* The entry we are drawing */
- Drawable d, /* What we are drawing into */
- GC gc, /* The gc to draw into */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int x, /* Left Edge */
- int y, /* Top Edge */
- int width, /* Width of entry */
- int height) /* Height of entry */
+ TkMenu *menuPtr, /* The menu to draw into */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc to draw into */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, /* Left Edge */
+ int y, /* Top Edge */
+ int width, /* Width of entry */
+ int height) /* Height of entry */
{
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
int len;
@@ -1849,7 +1947,7 @@ DrawMenuUnderline(
/* do the unicode call just to prevent overruns */
Tcl_GetUnicodeFromObj(mePtr->labelPtr, &len);
if (mePtr->underline < len) {
- CONST char *label, *start, *end;
+ const char *label, *start, *end;
label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
start = Tcl_UtfAtIndex(label, mePtr->underline);
@@ -1865,68 +1963,95 @@ DrawMenuUnderline(
/*
*--------------------------------------------------------------
*
- * MenuKeyBindProc --
+ * TkWinMenuKeyObjCmd --
*
- * This procedure is invoked when keys related to pulling
- * down menus is pressed. The corresponding Windows events
- * are generated and passed to DefWindowProc if appropriate.
+ * This function is invoked when keys related to pulling down menus is
+ * pressed. The corresponding Windows events are generated and passed to
+ * DefWindowProc if appropriate. This cmd is registered as tk::WinMenuKey
+ * in the interp.
*
* Results:
* Always returns TCL_OK.
*
* Side effects:
- * The menu system may take over and process user events
- * for menu input.
+ * The menu system may take over and process user events for menu input.
*
*--------------------------------------------------------------
*/
static int
-MenuKeyBindProc(clientData, interp, eventPtr, tkwin, keySym)
- ClientData clientData; /* not used in this proc */
- Tcl_Interp *interp; /* The interpreter of the receiving window. */
- XEvent *eventPtr; /* The XEvent to process */
- Tk_Window tkwin; /* The window receiving the event */
- KeySym keySym; /* The key sym that is produced. */
+TkWinMenuKeyObjCmd(
+ ClientData clientData, /* Unused. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
UINT scanCode;
UINT virtualKey;
- TkWindow *winPtr = (TkWindow *)tkwin;
+ XEvent *eventPtr;
+ Tk_Window tkwin;
+ TkWindow *winPtr;
+ KeySym keySym;
int i;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "window keySym");
+ return TCL_ERROR;
+ }
+
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[1]),
+ Tk_MainWindow(interp));
+
+ if (tkwin == NULL) {
+ /*
+ * If we don't find the key, just return, as the window may have
+ * been destroyed in the binding. [Bug 1236306]
+ */
+ return TCL_OK;
+ }
+
+ eventPtr = TkpGetBindingXEvent(interp);
+
+ winPtr = (TkWindow *)tkwin;
+
+ if (Tcl_GetIntFromObj(interp, objv[2], &i) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ keySym = i;
+
if (eventPtr->type == KeyPress) {
switch (keySym) {
case XK_Alt_L:
scanCode = MapVirtualKey(VK_LMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYDOWN, VK_MENU, (scanCode << 16)
- | (1 << 29));
+ WM_SYSKEYDOWN, VK_MENU,
+ (int) (scanCode << 16) | (1 << 29));
break;
case XK_Alt_R:
scanCode = MapVirtualKey(VK_RMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYDOWN, VK_MENU, (scanCode << 16)
- | (1 << 29) | (1 << 24));
+ WM_SYSKEYDOWN, VK_MENU,
+ (int) (scanCode << 16) | (1 << 29) | (1 << 24));
break;
case XK_F10:
scanCode = MapVirtualKey(VK_F10, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYDOWN, VK_F10, (scanCode << 16));
+ WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
scanCode = MapVirtualKey(virtualKey, 0);
if (0 != scanCode) {
+ XKeyEvent xkey = eventPtr->xkey;
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYDOWN, virtualKey, ((scanCode << 16)
- | (1 << 29)));
- if (eventPtr->xkey.nbytes > 0) {
- for (i = 0; i < eventPtr->xkey.nbytes; i++) {
+ WM_SYSKEYDOWN, virtualKey,
+ (int) ((scanCode << 16) | (1 << 29)));
+ if (xkey.nbytes > 0) {
+ for (i = 0; i < xkey.nbytes; i++) {
CallWindowProc(DefWindowProc,
- Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSCHAR,
- eventPtr->xkey.trans_chars[i],
- ((scanCode << 16) | (1 << 29)));
+ Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR,
+ xkey.trans_chars[i],
+ (int) ((scanCode << 16) | (1 << 29)));
}
}
}
@@ -1936,83 +2061,96 @@ MenuKeyBindProc(clientData, interp, eventPtr, tkwin, keySym)
case XK_Alt_L:
scanCode = MapVirtualKey(VK_LMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYUP, VK_MENU, (scanCode << 16)
+ WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31));
break;
case XK_Alt_R:
scanCode = MapVirtualKey(VK_RMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYUP, VK_MENU, (scanCode << 16) | (1 << 24)
+ WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24)
| (0x111 << 29) | (1 << 30) | (1 << 31));
break;
case XK_F10:
scanCode = MapVirtualKey(VK_F10, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYUP, VK_F10, (scanCode << 16)
- | (1 << 30) | (1 << 31));
+ WM_SYSKEYUP, VK_F10,
+ (int) (scanCode << 16) | (1 << 30) | (1 << 31));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
scanCode = MapVirtualKey(virtualKey, 0);
if (0 != scanCode) {
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
- WM_SYSKEYUP, virtualKey, ((scanCode << 16)
+ WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31)));
}
}
}
return TCL_OK;
-}
+}
/*
*--------------------------------------------------------------
*
* TkpInitializeMenuBindings --
*
- * For every interp, initializes the bindings for Windows
- * menus. Does nothing on Mac or XWindows.
+ * For every interp, initializes the bindings for Windows menus. Does
+ * nothing on Mac or XWindows.
*
* Results:
* None.
*
* Side effects:
- * C-level bindings are setup for the interp which will
- * handle Alt-key sequences for menus without beeping
- * or interfering with user-defined Alt-key bindings.
+ * bindings are setup for the interp which will handle Alt-key sequences
+ * for menus without beeping or interfering with user-defined Alt-key
+ * bindings.
*
*--------------------------------------------------------------
*/
void
-TkpInitializeMenuBindings(interp, bindingTable)
- Tcl_Interp *interp; /* The interpreter to set. */
- Tk_BindingTable bindingTable; /* The table to add to. */
+TkpInitializeMenuBindings(
+ Tcl_Interp *interp, /* The interpreter to set. */
+ Tk_BindingTable bindingTable)
+ /* The table to add to. */
{
Tk_Uid uid = Tk_GetUid("all");
/*
- * We need to set up the bindings for menubars. These have to
- * recreate windows events, so we need to have a C-level
- * binding for this. We have to generate the WM_SYSKEYDOWNS
- * and WM_SYSKEYUPs appropriately.
+ * We need to set up the bindings for menubars. These have to recreate
+ * windows events, so we need to invoke C code to generate the
+ * WM_SYSKEYDOWNS and WM_SYSKEYUPs appropriately. Trick is, we can't
+ * create a C level binding directly since we may want to modify the
+ * binding in Tcl code.
*/
-
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<Alt_L>", MenuKeyBindProc, NULL, NULL);
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<KeyRelease-Alt_L>", MenuKeyBindProc, NULL, NULL);
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<Alt_R>", MenuKeyBindProc, NULL, NULL);
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<KeyRelease-Alt_R>", MenuKeyBindProc, NULL, NULL);
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<Alt-KeyPress>", MenuKeyBindProc, NULL, NULL);
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<Alt-KeyRelease>", MenuKeyBindProc, NULL, NULL);
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<KeyPress-F10>", MenuKeyBindProc, NULL, NULL);
- TkCreateBindingProcedure(interp, bindingTable, (ClientData)uid,
- "<KeyRelease-F10>", MenuKeyBindProc, NULL, NULL);
+
+ (void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey",
+ TkWinMenuKeyObjCmd,
+ (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<Alt_L>", "tk::WinMenuKey %W %N", 0);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<KeyRelease-Alt_L>", "tk::WinMenuKey %W %N", 0);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<Alt_R>", "tk::WinMenuKey %W %N", 0);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<KeyRelease-Alt_R>", "tk::WinMenuKey %W %N", 0);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<Alt-KeyPress>", "tk::WinMenuKey %W %N", 0);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<Alt-KeyRelease>", "tk::WinMenuKey %W %N", 0);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<KeyPress-F10>", "tk::WinMenuKey %W %N", 0);
+
+ (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ "<KeyRelease-F10>", "tk::WinMenuKey %W %N", 0);
}
/*
@@ -2020,7 +2158,7 @@ TkpInitializeMenuBindings(interp, bindingTable)
*
* DrawMenuEntryLabel --
*
- * This procedure draws the label part of a menu.
+ * This function draws the label part of a menu.
*
* Results:
* None.
@@ -2031,24 +2169,26 @@ TkpInitializeMenuBindings(interp, bindingTable)
*
*----------------------------------------------------------------------
*/
+
static void
DrawMenuEntryLabel(
- TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
- Drawable d, /* What we are drawing into */
- GC gc, /* The gc we are drawing into */
- Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr, /* The precalculated font metrics */
- int x, /* left edge */
- int y, /* right edge */
- int width, /* width of entry */
- int height) /* height of entry */
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc we are drawing into */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, /* left edge */
+ int y, /* right edge */
+ int width, /* width of entry */
+ int height, /* height of entry */
+ int underline) /* accelerator cue should be drawn */
{
- int indicatorSpace = mePtr->indicatorSpace;
+ int indicatorSpace = mePtr->indicatorSpace;
int activeBorderWidth;
int leftEdge;
int imageHeight, imageWidth;
- int textHeight, textWidth;
+ int textHeight = 0, textWidth = 0;
int haveImage = 0, haveText = 0;
int imageXOffset = 0, imageYOffset = 0;
int textXOffset = 0, textYOffset = 0;
@@ -2063,21 +2203,22 @@ DrawMenuEntryLabel(
if (mePtr->image != NULL) {
Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
- haveImage = 1;
+ haveImage = 1;
} else if (mePtr->bitmapPtr != NULL) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
Tk_SizeOfBitmap(menuPtr->display, bitmap, &imageWidth, &imageHeight);
haveImage = 1;
}
if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
- if (mePtr->labelLength > 0) {
- char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ if (mePtr->labelLength > 0) {
+ char *label = Tcl_GetString(mePtr->labelPtr);
+
textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
textHeight = fmPtr->linespace;
haveText = 1;
- }
+ }
}
-
+
/*
* Now work out what the relative positions are.
*/
@@ -2085,56 +2226,53 @@ DrawMenuEntryLabel(
if (haveImage && haveText) {
int fullWidth = (imageWidth > textWidth ? imageWidth : textWidth);
switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = imageHeight/2 + 2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = -textHeight/2;
- break;
- }
- case COMPOUND_BOTTOM: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = -imageHeight/2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = textHeight/2 + 2;
- break;
- }
- case COMPOUND_LEFT: {
- /*
- * The standard image position on Windows is in the indicator
- * space to the left of the entries, unless this entry is a
- * radio|check button because then the indicator space will
- * be used.
- */
- textXOffset = imageWidth + 2;
- textYOffset = 0;
- imageXOffset = 0;
- imageYOffset = 0;
- if ((mePtr->type != CHECK_BUTTON_ENTRY)
- && (mePtr->type != RADIO_BUTTON_ENTRY)) {
- textXOffset -= indicatorSpace;
- if (textXOffset < 0) {
- textXOffset = 0;
- }
- imageXOffset = -indicatorSpace;
+ case COMPOUND_TOP:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = imageHeight/2 + 2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = -textHeight/2;
+ break;
+ case COMPOUND_BOTTOM:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = -imageHeight/2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = textHeight/2 + 2;
+ break;
+ case COMPOUND_LEFT:
+ /*
+ * The standard image position on Windows is in the indicator
+ * space to the left of the entries, unless this entry is a
+ * radio|check button because then the indicator space will be
+ * used.
+ */
+
+ textXOffset = imageWidth + 2;
+ textYOffset = 0;
+ imageXOffset = 0;
+ imageYOffset = 0;
+ if ((mePtr->type != CHECK_BUTTON_ENTRY)
+ && (mePtr->type != RADIO_BUTTON_ENTRY)) {
+ textXOffset -= indicatorSpace;
+ if (textXOffset < 0) {
+ textXOffset = 0;
}
- break;
- }
- case COMPOUND_RIGHT: {
- textXOffset = 0;
- textYOffset = 0;
- imageXOffset = textWidth + 2;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_CENTER: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = 0;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = 0;
- break;
+ imageXOffset = -indicatorSpace;
}
- case COMPOUND_NONE: {break;}
+ break;
+ case COMPOUND_RIGHT:
+ textXOffset = 0;
+ textYOffset = 0;
+ imageXOffset = textWidth + 2;
+ imageYOffset = 0;
+ break;
+ case COMPOUND_CENTER:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = 0;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = 0;
+ break;
+ case COMPOUND_NONE:
+ break;
}
} else {
textXOffset = 0;
@@ -2142,7 +2280,7 @@ DrawMenuEntryLabel(
imageXOffset = 0;
imageYOffset = 0;
}
-
+
/*
* Draw label and/or bitmap or image for entry.
*/
@@ -2152,42 +2290,47 @@ DrawMenuEntryLabel(
&& (mePtr->entryFlags & ENTRY_SELECTED)) {
Tk_RedrawImage(mePtr->selectImage, 0, 0,
imageWidth, imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
+ (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
} else {
Tk_RedrawImage(mePtr->image, 0, 0, imageWidth,
imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
+ (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
}
} else if (mePtr->bitmapPtr != NULL) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
- XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
- (unsigned) imageWidth, (unsigned) imageHeight,
+ XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
+ (unsigned) imageWidth, (unsigned) imageHeight,
leftEdge + imageXOffset,
(int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), 1);
}
if ((mePtr->compound != COMPOUND_NONE) || !haveImage) {
if (mePtr->labelLength > 0) {
int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
- char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ char *label = Tcl_GetString(mePtr->labelPtr);
+
if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) {
- /* Win 95/98 systems draw disabled menu text with a
- * 3D highlight, unless the menu item is highlighted */
- if ((mePtr->state == ENTRY_DISABLED) &&
- ((mePtr->entryFlags & ENTRY_PLATFORM_FLAG1) == 0)) {
- COLORREF oldFgColor = gc->foreground;
+ /*
+ * Win 95/98 systems draw disabled menu text with a 3D
+ * highlight, unless the menu item is highlighted,
+ */
+
+ if ((mePtr->state == ENTRY_DISABLED) &&
+ ((mePtr->entryFlags & ENTRY_PLATFORM_FLAG1) == 0)) {
+ COLORREF oldFgColor = gc->foreground;
gc->foreground = GetSysColor(COLOR_3DHILIGHT);
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
- mePtr->labelLength, leftEdge + textXOffset + 1,
- baseline + textYOffset + 1);
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
+ mePtr->labelLength, leftEdge + textXOffset + 1,
+ baseline + textYOffset + 1);
gc->foreground = oldFgColor;
- }
+ }
}
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
- mePtr->labelLength, leftEdge + textXOffset,
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
+ mePtr->labelLength, leftEdge + textXOffset,
baseline + textYOffset);
- DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr,
- x + textXOffset, y + textYOffset,
- width, height);
+ if (underline) {
+ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr,
+ x + textXOffset, y + textYOffset, width, height);
+ }
}
}
@@ -2195,7 +2338,7 @@ DrawMenuEntryLabel(
if (menuPtr->disabledFgPtr == NULL) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
(unsigned) width, (unsigned) height);
- } else if ((mePtr->image != NULL)
+ } else if ((mePtr->image != NULL)
&& (menuPtr->disabledImageGC != None)) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
leftEdge + imageXOffset,
@@ -2210,23 +2353,22 @@ DrawMenuEntryLabel(
*
* TkpComputeMenubarGeometry --
*
- * This procedure is invoked to recompute the size and
- * layout of a menu that is a menubar clone.
+ * This function is invoked to recompute the size and layout of a menu
+ * that is a menubar clone.
*
* Results:
* None.
*
* Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
*
*--------------------------------------------------------------
*/
void
-TkpComputeMenubarGeometry(menuPtr)
- TkMenu *menuPtr; /* Structure describing menu. */
+TkpComputeMenubarGeometry(
+ TkMenu *menuPtr) /* Structure describing menu. */
{
TkpComputeStandardMenuGeometry(menuPtr);
}
@@ -2236,30 +2378,27 @@ TkpComputeMenubarGeometry(menuPtr)
*
* DrawTearoffEntry --
*
- * This procedure draws the background part of a menu.
+ * This function draws the background part of a menu.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
void
-DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable we are drawing into */
- GC gc; /* The gc we are drawing with */
- Tk_Font tkfont; /* The font we are drawing with */
- CONST Tk_FontMetrics *fmPtr; /* The metrics we are drawing with */
- int x;
- int y;
- int width;
- int height;
+DrawTearoffEntry(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The font we are drawing with */
+ const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
+ int x, int y,
+ int width, int height)
{
XPoint points[2];
int segmentWidth, maxX;
@@ -2268,12 +2407,12 @@ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType != MASTER_MENU) {
return;
}
-
+
points[0].x = x;
points[0].y = y + height/2;
points[1].y = points[0].y;
segmentWidth = 6;
- maxX = width - 1;
+ maxX = width - 1;
border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
while (points[0].x < maxX) {
@@ -2295,21 +2434,20 @@ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
* Processes configurations for menu entries.
*
* Results:
- * Returns standard TCL result. If TCL_ERROR is returned, then
- * the interp's result contains an error message.
+ * Returns standard TCL result. If TCL_ERROR is returned, then the
+ * interp's result contains an error message.
*
* Side effects:
- * Configuration information get set for mePtr; old resources
- * get freed, if any need it.
+ * Configuration information get set for mePtr; old resources get freed,
+ * if any need it.
*
*----------------------------------------------------------------------
*/
int
-TkpConfigureMenuEntry(mePtr)
- register TkMenuEntry *mePtr; /* Information about menu entry; may
- * or may not already have values for
- * some fields. */
+TkpConfigureMenuEntry(
+ register TkMenuEntry *mePtr)/* Information about menu entry; may or may
+ * not already have values for some fields. */
{
TkMenu *menuPtr = mePtr->menuPtr;
@@ -2325,8 +2463,8 @@ TkpConfigureMenuEntry(mePtr)
*
* TkpDrawMenuEntry --
*
- * Draws the given menu entry at the given coordinates with the
- * given attributes.
+ * Draws the given menu entry at the given coordinates with the given
+ * attributes.
*
* Results:
* None.
@@ -2338,30 +2476,59 @@ TkpConfigureMenuEntry(mePtr)
*/
void
-TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
- strictMotif, drawArrow)
- TkMenuEntry *mePtr; /* The entry to draw */
- Drawable d; /* What to draw into */
- Tk_Font tkfont; /* Precalculated font for menu */
- CONST Tk_FontMetrics *menuMetricsPtr;
- /* Precalculated metrics for menu */
- int x; /* X-coordinate of topleft of entry */
- int y; /* Y-coordinate of topleft of entry */
- int width; /* Width of the entry rectangle */
- int height; /* Height of the current rectangle */
- int strictMotif; /* Boolean flag */
- int drawArrow; /* Whether or not to draw the cascade
- * arrow for cascade items. Only applies
- * to Windows. */
+TkpDrawMenuEntry(
+ TkMenuEntry *mePtr, /* The entry to draw */
+ Drawable menuDrawable, /* Menu to draw into */
+ Tk_Font tkfont, /* Precalculated font for menu */
+ const Tk_FontMetrics *menuMetricsPtr,
+ /* Precalculated metrics for menu */
+ int x, /* X-coordinate of topleft of entry */
+ int y, /* Y-coordinate of topleft of entry */
+ int width, /* Width of the entry rectangle */
+ int height, /* Height of the current rectangle */
+ int strictMotif, /* Boolean flag */
+ int drawingParameters) /* Whether or not to draw the cascade arrow
+ * for cascade items and accelerator
+ * cues. Only applies to Windows. */
{
GC gc, indicatorGC;
TkMenu *menuPtr = mePtr->menuPtr;
Tk_3DBorder bgBorder, activeBorder;
- CONST Tk_FontMetrics *fmPtr;
+ const Tk_FontMetrics *fmPtr;
Tk_FontMetrics entryMetrics;
int padY = (menuPtr->menuType == MENUBAR) ? 3 : 0;
- int adjustedY = y + padY;
+ int adjustedX, adjustedY;
int adjustedHeight = height - 2 * padY;
+ TkWinDrawable memWinDraw;
+ TkWinDCState dcState;
+ HBITMAP oldBitmap = NULL;
+ Drawable d;
+ HDC memDc = NULL, menuDc = NULL;
+
+ /*
+ * If the menu entry includes an image then draw the entry into a
+ * compatible bitmap first. This avoids problems with clipping on
+ * animated menus. [Bug 1329198]
+ */
+
+ if (mePtr->image != NULL) {
+ menuDc = TkWinGetDrawableDC(menuPtr->display, menuDrawable, &dcState);
+
+ memDc = CreateCompatibleDC(menuDc);
+ oldBitmap = SelectObject(memDc,
+ CreateCompatibleBitmap(menuDc, width, height) );
+
+ memWinDraw.type = TWD_WINDC;
+ memWinDraw.winDC.hdc = memDc;
+ d = (Drawable)&memWinDraw;
+ adjustedX = 0;
+ adjustedY = padY;
+
+ } else {
+ d = menuDrawable;
+ adjustedX = x;
+ adjustedY = y + padY;
+ }
/*
* Choose the gc for drawing the foreground part of the entry.
@@ -2376,11 +2543,11 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
TkMenuEntry *cascadeEntryPtr;
int parentDisabled = 0;
char *name;
-
+
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
- name = Tcl_GetStringFromObj(cascadeEntryPtr->namePtr, NULL);
+ name = Tcl_GetString(cascadeEntryPtr->namePtr);
if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
if (mePtr->state == ENTRY_DISABLED) {
parentDisabled = 1;
@@ -2427,32 +2594,46 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
}
/*
- * Need to draw the entire background, including padding. On Unix,
- * for menubars, we have to draw the rest of the entry taking
- * into account the padding.
+ * Need to draw the entire background, including padding. On Unix, for
+ * menubars, we have to draw the rest of the entry taking into account the
+ * padding.
*/
-
- DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder,
- bgBorder, x, y, width, height);
-
+
+ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder,
+ bgBorder, adjustedX, adjustedY-padY, width, height);
+
if (mePtr->type == SEPARATOR_ENTRY) {
- DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
- fmPtr, x, adjustedY, width, adjustedHeight);
+ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
+ fmPtr, adjustedX, adjustedY, width, adjustedHeight);
} else if (mePtr->type == TEAROFF_ENTRY) {
- DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, adjustedY,
- width, adjustedHeight);
+ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr,
+ adjustedX, adjustedY, width, adjustedHeight);
} else {
- DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, adjustedY,
- width, adjustedHeight);
+ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr,
+ adjustedX, adjustedY, width, adjustedHeight,
+ (drawingParameters & DRAW_MENU_ENTRY_NOUNDERLINE)?0:1);
DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
- activeBorder, x, adjustedY, width, adjustedHeight);
+ activeBorder, adjustedX, adjustedY, width, adjustedHeight);
DrawMenuEntryArrow(menuPtr, mePtr, d, gc,
- activeBorder, x, adjustedY, width, adjustedHeight, drawArrow);
+ activeBorder, adjustedX, adjustedY, width, adjustedHeight,
+ (drawingParameters & DRAW_MENU_ENTRY_ARROW)?1:0);
if (!mePtr->hideMargin) {
DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont,
- fmPtr, x, adjustedY, width, adjustedHeight);
+ fmPtr, adjustedX, adjustedY, width, adjustedHeight);
}
}
+
+ /*
+ * Copy the entry contents from the temporary bitmap to the menu.
+ */
+
+ if (mePtr->image != NULL) {
+ BitBlt(menuDc, x, y, width, height, memDc, 0, 0, SRCCOPY);
+ DeleteObject(SelectObject(memDc, oldBitmap));
+ DeleteDC(memDc);
+
+ TkWinReleaseDrawableDC(menuDrawable, menuDc, &dcState);
+ }
}
/*
@@ -2473,18 +2654,17 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
*/
static void
-GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenuEntry *mePtr; /* The entry we are computing */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated metrics */
- int *widthPtr; /* The resulting width of the label
- * portion */
- int *heightPtr; /* The resulting height of the label
- * portion */
+GetMenuLabelGeometry(
+ TkMenuEntry *mePtr, /* The entry we are computing */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ int *widthPtr, /* The resulting width of the label portion */
+ int *heightPtr) /* The resulting height of the label
+ * portion */
{
TkMenu *menuPtr = mePtr->menuPtr;
int haveImage = 0;
-
+
if (mePtr->image != NULL) {
Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr);
haveImage = 1;
@@ -2496,54 +2676,72 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*heightPtr = 0;
*widthPtr = 0;
}
-
+
if (haveImage && (mePtr->compound == COMPOUND_NONE)) {
- /* We don't care about the text in this case */
+ /*
+ * We don't care about the text in this case.
+ */
} else {
- /* Either it is compound or we don't have an image */
+ /*
+ * Either it is compound or we don't have an image,
+ */
+
if (mePtr->labelPtr != NULL) {
int textWidth;
- char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ char *label = Tcl_GetString(mePtr->labelPtr);
+
textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
if ((mePtr->compound != COMPOUND_NONE) && haveImage) {
switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- /* Add text and padding */
- *heightPtr += fmPtr->linespace + 2;
- break;
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
}
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- /* Add text and padding */
- *widthPtr += textWidth + 2;
- break;
+
+ /*
+ * Add text and padding.
+ */
+
+ *heightPtr += fmPtr->linespace + 2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ if (fmPtr->linespace > *heightPtr) {
+ *heightPtr = fmPtr->linespace;
}
- case COMPOUND_CENTER: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- break;
+
+ /*
+ * Add text and padding.
+ */
+
+ *widthPtr += textWidth + 2;
+ break;
+ case COMPOUND_CENTER:
+ if (fmPtr->linespace > *heightPtr) {
+ *heightPtr = fmPtr->linespace;
+ }
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
}
- case COMPOUND_NONE: {break;}
+ break;
+ case COMPOUND_NONE:
+ break;
}
- } else {
- /* We don't have an image or we're not compound */
+ } else {
+ /*
+ * We don't have an image or we're not compound.
+ */
+
*heightPtr = fmPtr->linespace;
*widthPtr = textWidth;
}
} else {
- /* An empty entry still has this height */
+ /*
+ * An empty entry still has this height.
+ */
+
*heightPtr = fmPtr->linespace;
}
}
@@ -2555,36 +2753,35 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*
* DrawMenuEntryBackground --
*
- * This procedure draws the background part of a menu.
+ * This function draws the background part of a menu.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
DrawMenuEntryBackground(
- TkMenu *menuPtr, /* The menu we are drawing. */
- TkMenuEntry *mePtr, /* The entry we are drawing. */
- Drawable d, /* What we are drawing into */
- Tk_3DBorder activeBorder, /* Border for active items */
- Tk_3DBorder bgBorder, /* Border for the background */
- int x, /* left edge */
- int y, /* top edge */
- int width, /* width of rectangle to draw */
- int height) /* height of rectangle to draw */
+ TkMenu *menuPtr, /* The menu we are drawing. */
+ TkMenuEntry *mePtr, /* The entry we are drawing. */
+ Drawable d, /* What we are drawing into */
+ Tk_3DBorder activeBorder, /* Border for active items */
+ Tk_3DBorder bgBorder, /* Border for the background */
+ int x, /* left edge */
+ int y, /* top edge */
+ int width, /* width of rectangle to draw */
+ int height) /* height of rectangle to draw */
{
- if (mePtr->state == ENTRY_ACTIVE
+ if (mePtr->state == ENTRY_ACTIVE
|| (mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)!=0 ) {
bgBorder = activeBorder;
}
- Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder,
- x, y, width, height, 0, TK_RELIEF_FLAT);
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0,
+ TK_RELIEF_FLAT);
}
/*
@@ -2592,16 +2789,15 @@ DrawMenuEntryBackground(
*
* TkpComputeStandardMenuGeometry --
*
- * This procedure is invoked to recompute the size and
- * layout of a menu that is not a menubar clone.
+ * This function is invoked to recompute the size and layout of a menu
+ * that is not a menubar clone.
*
* Results:
* None.
*
* Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
*
*--------------------------------------------------------------
*/
@@ -2616,26 +2812,25 @@ TkpComputeStandardMenuGeometry(
int windowWidth, windowHeight, accelSpace;
int i, j, lastColumnBreak = 0;
int activeBorderWidth, borderWidth;
-
+
if (menuPtr->tkwin == NULL) {
return;
}
- Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin,
+ Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin,
menuPtr->borderWidthPtr, &borderWidth);
x = y = borderWidth;
indicatorSpace = labelWidth = accelWidth = 0;
windowHeight = 0;
/*
- * On the Mac especially, getting font metrics can be quite slow,
- * so we want to do it intelligently. We are going to precalculate
- * them and pass them down to all of the measuring and drawing
- * routines. We will measure the font metrics of the menu once.
- * If an entry does not have its own font set, then we give
- * the geometry/drawing routines the menu's font and metrics.
- * If an entry has its own font, we will measure that font and
- * give all of the geometry/drawing the entry's font and metrics.
+ * On the Mac especially, getting font metrics can be quite slow, so we
+ * want to do it intelligently. We are going to precalculate them and pass
+ * them down to all of the measuring and drawing routines. We will measure
+ * the font metrics of the menu once. If an entry does not have its own
+ * font set, then we give the geometry/drawing routines the menu's font
+ * and metrics. If an entry has its own font, we will measure that font
+ * and give all of the geometry/drawing the entry's font and metrics.
*/
menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
@@ -2678,28 +2873,27 @@ TkpComputeStandardMenuGeometry(
fmPtr, &width, &height);
menuPtr->entries[i]->height = height;
} else if (menuPtr->entries[i]->type == TEAROFF_ENTRY) {
- GetTearoffEntryGeometry(menuPtr, menuPtr->entries[i], tkfont,
+ GetTearoffEntryGeometry(menuPtr, menuPtr->entries[i], tkfont,
fmPtr, &width, &height);
menuPtr->entries[i]->height = height;
+
} else {
-
/*
- * For each entry, compute the height required by that
- * particular entry, plus three widths: the width of the
- * label, the width to allow for an indicator to be displayed
- * to the left of the label (if any), and the width of the
- * accelerator to be displayed to the right of the label
- * (if any). These sizes depend, of course, on the type
- * of the entry.
+ * For each entry, compute the height required by that particular
+ * entry, plus three widths: the width of the label, the width to
+ * allow for an indicator to be displayed to the left of the label
+ * (if any), and the width of the accelerator to be displayed to
+ * the right of the label (if any). These sizes depend, of course,
+ * on the type of the entry.
*/
-
+
GetMenuLabelGeometry(menuPtr->entries[i], tkfont, fmPtr, &width,
&height);
menuPtr->entries[i]->height = height;
if (width > labelWidth) {
labelWidth = width;
}
-
+
GetMenuAccelGeometry(menuPtr, menuPtr->entries[i], tkfont,
fmPtr, &width, &height);
if (height > menuPtr->entries[i]->height) {
@@ -2709,7 +2903,7 @@ TkpComputeStandardMenuGeometry(
accelWidth = width;
}
- GetMenuIndicatorGeometry(menuPtr, menuPtr->entries[i], tkfont,
+ GetMenuIndicatorGeometry(menuPtr, menuPtr->entries[i], tkfont,
fmPtr, &width, &height);
if (height > menuPtr->entries[i]->height) {
menuPtr->entries[i]->height = height;
@@ -2720,7 +2914,7 @@ TkpComputeStandardMenuGeometry(
menuPtr->entries[i]->height += 2 * activeBorderWidth + 1;
}
- menuPtr->entries[i]->y = y;
+ menuPtr->entries[i]->y = y;
y += menuPtr->entries[i]->height;
if (y > windowHeight) {
windowHeight = y;
@@ -2743,10 +2937,10 @@ TkpComputeStandardMenuGeometry(
windowHeight += borderWidth;
-
+
/*
- * The X server doesn't like zero dimensions, so round up to at least
- * 1 (a zero-sized menu should never really occur, anyway).
+ * The X server doesn't like zero dimensions, so round up to at least 1 (a
+ * zero-sized menu should never really occur, anyway).
*/
if (windowWidth <= 0) {
@@ -2764,8 +2958,8 @@ TkpComputeStandardMenuGeometry(
*
* MenuSelectEvent --
*
- * Generates a "MenuSelect" virtual event. This can be used to
- * do context-sensitive menu help.
+ * Generates a "MenuSelect" virtual event. This can be used to do
+ * context-sensitive menu help.
*
* Results:
* None.
@@ -2781,9 +2975,8 @@ MenuSelectEvent(
TkMenu *menuPtr) /* the menu we have selected. */
{
XVirtualEvent event;
- POINTS rootPoint;
- DWORD msgPos;
-
+ union {DWORD msgpos; POINTS point;} root;
+
event.type = VirtualEvent;
event.serial = menuPtr->display->request;
event.send_event = 0;
@@ -2793,14 +2986,14 @@ MenuSelectEvent(
event.root = XRootWindow(menuPtr->display, 0);
event.subwindow = None;
event.time = TkpGetMS();
-
- msgPos = GetMessagePos();
- rootPoint = MAKEPOINTS(msgPos);
- event.x_root = rootPoint.x;
- event.y_root = rootPoint.y;
+
+ root.msgpos = GetMessagePos();
+ event.x_root = root.point.x;
+ event.y_root = root.point.y;
event.state = TkWinGetModifierState();
event.same_screen = 1;
event.name = Tk_GetUid("MenuSelect");
+ event.user_data = NULL;
Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
}
@@ -2810,8 +3003,8 @@ MenuSelectEvent(
* TkpMenuNotifyToplevelCreate --
*
* This routine reconfigures the menu and the clones indicated by
- * menuName becuase a toplevel has been created and any system
- * menus need to be created.
+ * menuName becuase a toplevel has been created and any system menus need
+ * to be created.
*
* Results:
* None.
@@ -2824,9 +3017,8 @@ MenuSelectEvent(
void
TkpMenuNotifyToplevelCreate(
- Tcl_Interp *interp, /* The interp the menu lives in. */
- char *menuName) /* The name of the menu to
- * reconfigure. */
+ Tcl_Interp *interp, /* The interp the menu lives in. */
+ char *menuName) /* The name of the menu to reconfigure. */
{
TkMenuReferences *menuRefPtr;
TkMenu *menuPtr;
@@ -2836,10 +3028,10 @@ TkpMenuNotifyToplevelCreate(
if ((menuRefPtr != NULL) && (menuRefPtr->menuPtr != NULL)) {
for (menuPtr = menuRefPtr->menuPtr->masterMenuPtr; menuPtr != NULL;
menuPtr = menuPtr->nextInstancePtr) {
- if ((menuPtr->menuType == MENUBAR)
+ if ((menuPtr->menuType == MENUBAR)
&& !(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
- Tcl_DoWhenIdle(ReconfigureWindowsMenu,
+ Tcl_DoWhenIdle(ReconfigureWindowsMenu,
(ClientData) menuPtr);
}
}
@@ -2850,6 +3042,35 @@ TkpMenuNotifyToplevelCreate(
/*
*----------------------------------------------------------------------
*
+ * Tk_GetMenuHWND --
+ *
+ * This function returns the HWND of a hidden menu Window that processes
+ * messages of a popup menu. This hidden menu window is used to handle
+ * either a dynamic popup menu in the same process or a pull-down menu of
+ * an embedded window in a different process.
+ *
+ * Results:
+ * Returns the HWND of the hidden menu Window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HWND
+Tk_GetMenuHWND(
+ Tk_Window tkwin)
+{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ TkMenuInit();
+ return tsdPtr->embeddedMenuHWND;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* MenuExitHandler --
*
* Unregisters the class of utility windows.
@@ -2868,6 +3089,7 @@ MenuExitHandler(
ClientData clientData) /* Not used */
{
UnregisterClass(MENU_CLASS_NAME, Tk_GetHINSTANCE());
+ UnregisterClass(EMBEDDED_MENU_CLASS_NAME, Tk_GetHINSTANCE());
}
/*
@@ -2895,7 +3117,9 @@ MenuThreadExitHandler(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
DestroyWindow(tsdPtr->menuHWND);
+ DestroyWindow(tsdPtr->embeddedMenuHWND);
tsdPtr->menuHWND = NULL;
+ tsdPtr->embeddedMenuHWND = NULL;
Tcl_DeleteHashTable(&tsdPtr->winMenuTable);
Tcl_DeleteHashTable(&tsdPtr->commandTable);
@@ -2910,9 +3134,9 @@ MenuThreadExitHandler(
* database name.
*
* Results:
- * Returns a Tcl_Obj * with the default value. If there is no
- * Windows-specific default for this attribute, returns NULL.
- * This object has a ref count of 0.
+ * Returns a Tcl_Obj* with the default value. If there is no
+ * Windows-specific default for this attribute, returns NULL. This object
+ * has a ref count of 0.
*
* Side effects:
* Storage is allocated.
@@ -2923,8 +3147,8 @@ MenuThreadExitHandler(
Tcl_Obj *
TkWinGetMenuSystemDefault(
Tk_Window tkwin, /* A window to use. */
- CONST char *dbName, /* The option database name. */
- CONST char *className) /* The name of the option class. */
+ const char *dbName, /* The option database name. */
+ const char *className) /* The name of the option class. */
{
Tcl_Obj *valuePtr = NULL;
@@ -2932,8 +3156,7 @@ TkWinGetMenuSystemDefault(
(strcmp(dbName, "borderWidth") == 0)) {
valuePtr = Tcl_NewIntObj(defaultBorderWidth);
} else if (strcmp(dbName, "font") == 0) {
- valuePtr = Tcl_NewStringObj(Tcl_DStringValue(&menuFontDString),
- -1);
+ valuePtr = Tcl_NewStringObj(Tcl_DStringValue(&menuFontDString), -1);
}
return valuePtr;
@@ -2942,30 +3165,29 @@ TkWinGetMenuSystemDefault(
/*
*----------------------------------------------------------------------
*
- * TkWinMenuSetDefaults --
+ * SetDefaults --
*
- * Sets up the hash tables and the variables used by the menu package.
+ * Read system menu settings (font, sizes of items, use of accelerators)
+ * This is called if the UI theme or settings are changed.
*
* Results:
* None.
*
* Side effects:
- * lastMenuID gets initialized, and the parent hash and the command hash
- * are allocated.
+ * May result in menu items being redrawn with different appearance.
*
*----------------------------------------------------------------------
*/
-void
+static void
SetDefaults(
- int firstTime) /* Is this the first time this
- * has been called? */
+ int firstTime) /* Is this the first time this has been
+ * called? */
{
char sizeString[TCL_INTEGER_SPACE];
char faceName[LF_FACESIZE];
HDC scratchDC;
- Tcl_DString boldItalicDString;
- int bold = 0;
+ int bold = 0;
int italic = 0;
TEXTMETRIC tm;
int pointSize;
@@ -2980,8 +3202,8 @@ SetDefaults(
OSVERSIONINFO os;
/*
- * Set all of the default options. The loop will terminate when we run
- * out of options via a break statement.
+ * Set all of the default options. The loop will terminate when we run out
+ * of options via a break statement.
*/
defaultBorderWidth = GetSystemMetrics(SM_CXBORDER);
@@ -3022,44 +3244,56 @@ SetDefaults(
DeleteDC(scratchDC);
DeleteObject(menuFont);
-
+
Tcl_DStringAppendElement(&menuFontDString, faceName);
sprintf(sizeString, "%d", pointSize);
Tcl_DStringAppendElement(&menuFontDString, sizeString);
- if (bold == 1 || italic == 1) {
+ if (bold || italic) {
+ Tcl_DString boldItalicDString;
+
Tcl_DStringInit(&boldItalicDString);
- if (bold == 1) {
+ if (bold) {
Tcl_DStringAppendElement(&boldItalicDString, "bold");
}
- if (italic == 1) {
+ if (italic) {
Tcl_DStringAppendElement(&boldItalicDString, "italic");
}
- Tcl_DStringAppendElement(&menuFontDString,
+ Tcl_DStringAppendElement(&menuFontDString,
Tcl_DStringValue(&boldItalicDString));
+ Tcl_DStringFree(&boldItalicDString);
}
/*
* Now we go ahead and get the dimensions of the check mark and the
- * appropriate margins. Since this is fairly hairy, we do it here
- * to save time when traversing large sets of menu items.
+ * appropriate margins. Since this is fairly hairy, we do it here to save
+ * time when traversing large sets of menu items.
*
- * The code below was given to me by Microsoft over the phone. It
- * is the only way to insure menu items lining up, and is not
- * documented.
+ * The code below was given to me by Microsoft over the phone. It is the
+ * only way to ensure menu items line up, and is not documented.
*/
if (TkWinGetPlatformId() >= VER_PLATFORM_WIN32_WINDOWS) {
indicatorDimensions[0] = GetSystemMetrics(SM_CYMENUCHECK);
indicatorDimensions[1] = ((GetSystemMetrics(SM_CXFIXEDFRAME) +
- GetSystemMetrics(SM_CXBORDER)
+ GetSystemMetrics(SM_CXBORDER)
+ GetSystemMetrics(SM_CXMENUCHECK) + 7) & 0xFFF8)
- GetSystemMetrics(SM_CXFIXEDFRAME);
} else {
DWORD dimensions = GetMenuCheckMarkDimensions();
indicatorDimensions[0] = HIWORD(dimensions);
indicatorDimensions[1] = LOWORD(dimensions);
- }
+ }
+
+ /*
+ * Accelerators used to be always underlines until Win2K when a system
+ * parameter was introduced to hide them unless Alt is pressed.
+ */
+
+ showMenuAccelerators = TRUE;
+ if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
+ SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
+ }
}
/*
@@ -3079,7 +3313,7 @@ SetDefaults(
*/
void
-TkpMenuInit()
+TkpMenuInit(void)
{
WNDCLASS wndClass;
@@ -3093,7 +3327,15 @@ TkpMenuInit()
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = MENU_CLASS_NAME;
- RegisterClass(&wndClass);
+ if (!RegisterClass(&wndClass)) {
+ Tcl_Panic("Failed to register menu window class.");
+ }
+
+ wndClass.lpfnWndProc = TkWinEmbeddedMenuProc;
+ wndClass.lpszClassName = EMBEDDED_MENU_CLASS_NAME;
+ if (!RegisterClass(&wndClass)) {
+ Tcl_Panic("Failed to register embedded menu window class.");
+ }
TkCreateExitHandler(MenuExitHandler, (ClientData) NULL);
SetDefaults(1);
@@ -3104,7 +3346,8 @@ TkpMenuInit()
*
* TkpMenuThreadInit --
*
- * Sets up the thread-local hash tables used by the menu module.
+ * Sets up the thread-local hash tables used by the menu module. Assumes
+ * that TkpMenuInit has been called.
*
* Results:
* None.
@@ -3116,16 +3359,36 @@ TkpMenuInit()
*/
void
-TkpMenuThreadInit()
+TkpMenuThreadInit(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->menuHWND = CreateWindow(MENU_CLASS_NAME, "MenuWindow", WS_POPUP,
- 0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL);
+ 0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL);
+
+ if (!tsdPtr->menuHWND) {
+ Tcl_Panic("Failed to create the menu window.");
+ }
+
+ tsdPtr->embeddedMenuHWND =
+ CreateWindow(EMBEDDED_MENU_CLASS_NAME, "EmbeddedMenuWindow",
+ WS_POPUP, 0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL);
+
+ if (!tsdPtr->embeddedMenuHWND) {
+ Tcl_Panic("Failed to create the embedded menu window.");
+ }
Tcl_InitHashTable(&tsdPtr->winMenuTable, TCL_ONE_WORD_KEYS);
Tcl_InitHashTable(&tsdPtr->commandTable, TCL_ONE_WORD_KEYS);
- Tcl_CreateThreadExitHandler(MenuThreadExitHandler, (ClientData) NULL);
+ TkCreateThreadExitHandler(MenuThreadExitHandler, (ClientData) NULL);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index 4a7954f..51f0f59 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -1,17 +1,16 @@
-/*
+/*
* tkWinPixmap.c --
*
- * This file contains the Xlib emulation functions pertaining to
- * creating and destroying pixmaps.
+ * This file contains the Xlib emulation functions pertaining to creating
+ * and destroying pixmaps.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
-
/*
*----------------------------------------------------------------------
@@ -30,23 +29,23 @@
*/
Pixmap
-Tk_GetPixmap(display, d, width, height, depth)
- Display* display;
- Drawable d;
- int width;
- int height;
- int depth;
+Tk_GetPixmap(
+ Display *display,
+ Drawable d,
+ int width,
+ int height,
+ int depth)
{
TkWinDrawable *newTwdPtr, *twdPtr;
int planes;
Screen *screen;
-
+
display->request++;
newTwdPtr = (TkWinDrawable*) ckalloc(sizeof(TkWinDrawable));
newTwdPtr->type = TWD_BITMAP;
newTwdPtr->bitmap.depth = depth;
- twdPtr = (TkWinDrawable *)d;
+ twdPtr = (TkWinDrawable *) d;
if (twdPtr->type != TWD_BITMAP) {
if (twdPtr->window.winPtr == NULL) {
newTwdPtr->bitmap.colormap = DefaultColormap(display,
@@ -60,7 +59,7 @@ Tk_GetPixmap(display, d, width, height, depth)
screen = &display->screens[0];
planes = 1;
if (depth == screen->root_depth) {
- planes = (int) screen->ext_data;
+ planes = PTR2INT(screen->ext_data);
depth /= planes;
}
newTwdPtr->bitmap.handle =
@@ -74,7 +73,7 @@ Tk_GetPixmap(display, d, width, height, depth)
if (newTwdPtr->bitmap.handle == NULL) {
static int repeatError = 0;
- unsigned char *bits = NULL;
+ void *bits = NULL;
BITMAPINFO bitmapInfo;
HDC dc;
@@ -88,7 +87,7 @@ Tk_GetPixmap(display, d, width, height, depth)
bitmapInfo.bmiHeader.biSizeImage = 0;
dc = GetDC(NULL);
newTwdPtr->bitmap.handle = CreateDIBSection(dc, &bitmapInfo,
- DIB_RGB_COLORS, (void **) &bits, 0, 0);
+ DIB_RGB_COLORS, &bits, 0, 0);
ReleaseDC(NULL, dc);
/*
@@ -118,8 +117,8 @@ Tk_GetPixmap(display, d, width, height, depth)
ckfree((char *) newTwdPtr);
return None;
}
-
- return (Pixmap)newTwdPtr;
+
+ return (Pixmap) newTwdPtr;
}
/*
@@ -139,16 +138,16 @@ Tk_GetPixmap(display, d, width, height, depth)
*/
void
-Tk_FreePixmap(display, pixmap)
- Display* display;
- Pixmap pixmap;
+Tk_FreePixmap(
+ Display *display,
+ Pixmap pixmap)
{
TkWinDrawable *twdPtr = (TkWinDrawable *) pixmap;
display->request++;
if (twdPtr != NULL) {
DeleteObject(twdPtr->bitmap.handle);
- ckfree((char *)twdPtr);
+ ckfree((char *) twdPtr);
}
}
@@ -170,9 +169,9 @@ Tk_FreePixmap(display, pixmap)
*/
void
-TkSetPixmapColormap(pixmap, colormap)
- Pixmap pixmap;
- Colormap colormap;
+TkSetPixmapColormap(
+ Pixmap pixmap,
+ Colormap colormap)
{
TkWinDrawable *twdPtr = (TkWinDrawable *)pixmap;
twdPtr->bitmap.colormap = colormap;
@@ -183,9 +182,9 @@ TkSetPixmapColormap(pixmap, colormap)
*
* XGetGeometry --
*
- * Retrieve the geometry of the given drawable. Note that
- * this is a degenerate implementation that only returns the
- * size of a pixmap or window.
+ * Retrieve the geometry of the given drawable. Note that this is a
+ * degenerate implementation that only returns the size of a pixmap or
+ * window.
*
* Results:
* Returns 0.
@@ -197,17 +196,16 @@ TkSetPixmapColormap(pixmap, colormap)
*/
int
-XGetGeometry(display, d, root_return, x_return, y_return, width_return,
- height_return, border_width_return, depth_return)
- Display* display;
- Drawable d;
- Window* root_return;
- int* x_return;
- int* y_return;
- unsigned int* width_return;
- unsigned int* height_return;
- unsigned int* border_width_return;
- unsigned int* depth_return;
+XGetGeometry(
+ Display *display,
+ Drawable d,
+ Window *root_return,
+ int *x_return,
+ int *y_return,
+ unsigned int *width_return,
+ unsigned int *height_return,
+ unsigned int *border_width_return,
+ unsigned int *depth_return)
{
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
@@ -216,30 +214,38 @@ XGetGeometry(display, d, root_return, x_return, y_return, width_return,
BITMAPINFO info;
if (twdPtr->bitmap.handle == NULL) {
- panic("XGetGeometry: invalid pixmap");
- }
- dc = GetDC(NULL);
- info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- info.bmiHeader.biBitCount = 0;
- if (!GetDIBits(dc, twdPtr->bitmap.handle, 0, 0, NULL, &info,
- DIB_RGB_COLORS)) {
- panic("XGetGeometry: unable to get bitmap size");
- }
- ReleaseDC(NULL, dc);
-
- *width_return = info.bmiHeader.biWidth;
- *height_return = info.bmiHeader.biHeight;
+ Tcl_Panic("XGetGeometry: invalid pixmap");
+ }
+ dc = GetDC(NULL);
+ info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ info.bmiHeader.biBitCount = 0;
+ if (!GetDIBits(dc, twdPtr->bitmap.handle, 0, 0, NULL, &info,
+ DIB_RGB_COLORS)) {
+ Tcl_Panic("XGetGeometry: unable to get bitmap size");
+ }
+ ReleaseDC(NULL, dc);
+
+ *width_return = info.bmiHeader.biWidth;
+ *height_return = info.bmiHeader.biHeight;
} else if (twdPtr->type == TWD_WINDOW) {
RECT rect;
- if (twdPtr->window.handle == NULL) {
- panic("XGetGeometry: invalid window");
- }
- GetClientRect(twdPtr->window.handle, &rect);
- *width_return = rect.right - rect.left;
- *height_return = rect.bottom - rect.top;
+ if (twdPtr->window.handle == NULL) {
+ Tcl_Panic("XGetGeometry: invalid window");
+ }
+ GetClientRect(twdPtr->window.handle, &rect);
+ *width_return = rect.right - rect.left;
+ *height_return = rect.bottom - rect.top;
} else {
- panic("XGetGeometry: invalid window");
+ Tcl_Panic("XGetGeometry: invalid window");
}
return 1;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c
index 0d9ed61..d29e952 100644
--- a/win/tkWinPointer.c
+++ b/win/tkWinPointer.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinPointer.c --
*
* Windows specific mouse tracking code.
@@ -6,8 +6,8 @@
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
@@ -31,7 +31,7 @@ static int mouseTimerSet = 0; /* 1 if the mouse timer is active. */
* Forward declarations of procedures used in this file.
*/
-static void MouseTimerProc _ANSI_ARGS_((ClientData clientData));
+static void MouseTimerProc(ClientData clientData);
/*
*----------------------------------------------------------------------
@@ -50,7 +50,7 @@ static void MouseTimerProc _ANSI_ARGS_((ClientData clientData));
*/
int
-TkWinGetModifierState()
+TkWinGetModifierState(void)
{
int state = 0;
@@ -89,10 +89,9 @@ TkWinGetModifierState()
*
* Tk_PointerEvent --
*
- * This procedure is called for each pointer-related event.
- * It converts the position to root coords and updates the
- * global pointer state machine. It also ensures that the
- * mouse timer is scheduled.
+ * This procedure is called for each pointer-related event. It converts
+ * the position to root coords and updates the global pointer state
+ * machine. It also ensures that the mouse timer is scheduled.
*
* Results:
* None.
@@ -104,11 +103,11 @@ TkWinGetModifierState()
*/
void
-Tk_PointerEvent(hwnd, x, y)
- HWND hwnd; /* Window for coords, or NULL for
- * the root window. */
- int x, y; /* Coords relative to hwnd, or screen
- * if hwnd is NULL. */
+Tk_PointerEvent(
+ HWND hwnd, /* Window for coords, or NULL for the root
+ * window. */
+ int x, int y) /* Coords relative to hwnd, or screen if hwnd
+ * is NULL. */
{
POINT pos;
int state;
@@ -126,11 +125,11 @@ Tk_PointerEvent(hwnd, x, y)
}
/*
- * If the mouse is captured, Windows will report all pointer
- * events to the capture window. So, we need to determine which
- * window the mouse is really over and change the event. Note
- * that the computed hwnd may point to a window not owned by Tk,
- * or a toplevel decorative frame, so tkwin can be NULL.
+ * If the mouse is captured, Windows will report all pointer events to the
+ * capture window. So, we need to determine which window the mouse is
+ * really over and change the event. Note that the computed hwnd may point
+ * to a window not owned by Tk, or a toplevel decorative frame, so tkwin
+ * can be NULL.
*/
if (captured || hwnd == NULL) {
@@ -166,14 +165,13 @@ Tk_PointerEvent(hwnd, x, y)
*/
int
-XGrabKeyboard(display, grab_window, owner_events, pointer_mode,
- keyboard_mode, time)
- Display* display;
- Window grab_window;
- Bool owner_events;
- int pointer_mode;
- int keyboard_mode;
- Time time;
+XGrabKeyboard(
+ Display *display,
+ Window grab_window,
+ Bool owner_events,
+ int pointer_mode,
+ int keyboard_mode,
+ Time time)
{
keyboardWinPtr = TkWinGetWinPtr(grab_window);
return GrabSuccess;
@@ -196,9 +194,9 @@ XGrabKeyboard(display, grab_window, owner_events, pointer_mode,
*/
void
-XUngrabKeyboard(display, time)
- Display* display;
- Time time;
+XUngrabKeyboard(
+ Display *display,
+ Time time)
{
keyboardWinPtr = NULL;
}
@@ -208,8 +206,7 @@ XUngrabKeyboard(display, time)
*
* MouseTimerProc --
*
- * Check the current mouse position and look for enter/leave
- * events.
+ * Check the current mouse position and look for enter/leave events.
*
* Results:
* None.
@@ -221,16 +218,16 @@ XUngrabKeyboard(display, time)
*/
void
-MouseTimerProc(clientData)
- ClientData clientData;
+MouseTimerProc(
+ ClientData clientData)
{
POINT pos;
mouseTimerSet = 0;
/*
- * Get the current mouse position and window. Don't do anything
- * if the mouse hasn't moved since the last time we looked.
+ * Get the current mouse position and window. Don't do anything if the
+ * mouse hasn't moved since the last time we looked.
*/
GetCursorPos(&pos);
@@ -254,7 +251,7 @@ MouseTimerProc(clientData)
*/
void
-TkWinCancelMouseTimer()
+TkWinCancelMouseTimer(void)
{
if (mouseTimerSet) {
Tcl_DeleteTimerHandler(mouseTimer);
@@ -270,8 +267,8 @@ TkWinCancelMouseTimer()
* Fetch the position of the mouse pointer.
*
* Results:
- * *xPtr and *yPtr are filled in with the root coordinates
- * of the mouse pointer for the display.
+ * *xPtr and *yPtr are filled in with the root coordinates of the mouse
+ * pointer for the display.
*
* Side effects:
* None.
@@ -280,10 +277,10 @@ TkWinCancelMouseTimer()
*/
void
-TkGetPointerCoords(tkwin, xPtr, yPtr)
- Tk_Window tkwin; /* Window that identifies screen on which
+TkGetPointerCoords(
+ Tk_Window tkwin, /* Window that identifies screen on which
* lookup is to be done. */
- int *xPtr, *yPtr; /* Store pointer coordinates here. */
+ int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
POINT point;
@@ -297,13 +294,13 @@ TkGetPointerCoords(tkwin, xPtr, yPtr)
*
* XQueryPointer --
*
- * Check the current state of the mouse. This is not a complete
- * implementation of this function. It only computes the root
- * coordinates and the current mask.
+ * Check the current state of the mouse. This is not a complete
+ * implementation of this function. It only computes the root coordinates
+ * and the current mask.
*
* Results:
- * Sets root_x_return, root_y_return, and mask_return. Returns
- * true on success.
+ * Sets root_x_return, root_y_return, and mask_return. Returns true on
+ * success.
*
* Side effects:
* None.
@@ -312,17 +309,16 @@ TkGetPointerCoords(tkwin, xPtr, yPtr)
*/
Bool
-XQueryPointer(display, w, root_return, child_return, root_x_return,
- root_y_return, win_x_return, win_y_return, mask_return)
- Display* display;
- Window w;
- Window* root_return;
- Window* child_return;
- int* root_x_return;
- int* root_y_return;
- int* win_x_return;
- int* win_y_return;
- unsigned int* mask_return;
+XQueryPointer(
+ Display *display,
+ Window w,
+ Window *root_return,
+ Window *child_return,
+ int *root_x_return,
+ int *root_y_return,
+ int *win_x_return,
+ int *win_y_return,
+ unsigned int *mask_return)
{
display->request++;
TkGetPointerCoords(NULL, root_x_return, root_y_return);
@@ -335,8 +331,8 @@ XQueryPointer(display, w, root_return, child_return, root_x_return,
*
* XWarpPointer --
*
- * Move pointer to new location. This is not a complete
- * implementation of this function.
+ * Move pointer to new location. This is not a complete implementation of
+ * this function.
*
* Results:
* None.
@@ -348,22 +344,21 @@ XQueryPointer(display, w, root_return, child_return, root_x_return,
*/
void
-XWarpPointer(display, src_w, dest_w, src_x, src_y, src_width,
- src_height, dest_x, dest_y)
- Display* display;
- Window src_w;
- Window dest_w;
- int src_x;
- int src_y;
- unsigned int src_width;
- unsigned int src_height;
- int dest_x;
- int dest_y;
+XWarpPointer(
+ Display *display,
+ Window src_w,
+ Window dest_w,
+ int src_x,
+ int src_y,
+ unsigned int src_width,
+ unsigned int src_height,
+ int dest_x,
+ int dest_y)
{
RECT r;
GetWindowRect(Tk_GetHWND(dest_w), &r);
- SetCursorPos(r.left+dest_x, r.top+dest_y);
+ SetCursorPos(r.left+dest_x, r.top+dest_y);
}
/*
@@ -383,12 +378,13 @@ XWarpPointer(display, src_w, dest_w, src_x, src_y, src_width,
*/
void
-XGetInputFocus(display, focus_return, revert_to_return)
- Display *display;
- Window *focus_return;
- int *revert_to_return;
+XGetInputFocus(
+ Display *display,
+ Window *focus_return,
+ int *revert_to_return)
{
Tk_Window tkwin = Tk_HWNDToWindow(GetFocus());
+
*focus_return = tkwin ? Tk_WindowId(tkwin) : None;
*revert_to_return = RevertToParent;
display->request++;
@@ -412,11 +408,11 @@ XGetInputFocus(display, focus_return, revert_to_return)
*/
void
-XSetInputFocus(display, focus, revert_to, time)
- Display* display;
- Window focus;
- int revert_to;
- Time time;
+XSetInputFocus(
+ Display *display,
+ Window focus,
+ int revert_to,
+ Time time)
{
display->request++;
if (focus != None) {
@@ -429,29 +425,28 @@ XSetInputFocus(display, focus, revert_to, time)
*
* TkpChangeFocus --
*
- * This procedure is invoked to move the system focus from
- * one window to another.
+ * This procedure is invoked to move the system focus from one window to
+ * another.
*
* Results:
- * The return value is the serial number of the command that
- * changed the focus. It may be needed by the caller to filter
- * out focus change events that were queued before the command.
- * If the procedure doesn't actually change the focus then
- * it returns 0.
+ * The return value is the serial number of the command that changed the
+ * focus. It may be needed by the caller to filter out focus change
+ * events that were queued before the command. If the procedure doesn't
+ * actually change the focus then it returns 0.
*
* Side effects:
- * The official Windows focus window changes; the application's focus
+ * The official Windows focus window changes; the application's focus
* window isn't changed by this procedure.
*
*----------------------------------------------------------------------
*/
int
-TkpChangeFocus(winPtr, force)
- TkWindow *winPtr; /* Window that is to receive the X focus. */
- int force; /* Non-zero means claim the focus even
- * if it didn't originally belong to
- * topLevelPtr's application. */
+TkpChangeFocus(
+ TkWindow *winPtr, /* Window that is to receive the X focus. */
+ int force) /* Non-zero means claim the focus even if it
+ * didn't originally belong to topLevelPtr's
+ * application. */
{
TkDisplay *dispPtr = winPtr->dispPtr;
Window focusWindow;
@@ -467,12 +462,12 @@ TkpChangeFocus(winPtr, force)
}
if (winPtr->window == None) {
- panic("ChangeXFocus got null X window");
+ Tcl_Panic("ChangeXFocus got null X window");
}
-
+
/*
- * Change the foreground window so the focus window is raised to the top of
- * the system stacking order and gets the keyboard focus.
+ * Change the foreground window so the focus window is raised to the top
+ * of the system stacking order and gets the keyboard focus.
*/
if (force) {
@@ -482,10 +477,10 @@ TkpChangeFocus(winPtr, force)
CurrentTime);
/*
- * Remember the current serial number for the X server and issue
- * a dummy server request. This marks the position at which we
- * changed the focus, so we can distinguish FocusIn and FocusOut
- * events on either side of the mark.
+ * Remember the current serial number for the X server and issue a dummy
+ * server request. This marks the position at which we changed the focus,
+ * so we can distinguish FocusIn and FocusOut events on either side of the
+ * mark.
*/
serial = NextRequest(winPtr->display);
@@ -498,10 +493,9 @@ TkpChangeFocus(winPtr, force)
*
* TkpSetCapture --
*
- * This function captures the mouse so that all future events
- * will be reported to this window, even if the mouse is outside
- * the window. If the specified window is NULL, then the mouse
- * is released.
+ * This function captures the mouse so that all future events will be
+ * reported to this window, even if the mouse is outside the window. If
+ * the specified window is NULL, then the mouse is released.
*
* Results:
* None.
@@ -513,8 +507,8 @@ TkpChangeFocus(winPtr, force)
*/
void
-TkpSetCapture(winPtr)
- TkWindow *winPtr; /* Capture window, or NULL. */
+TkpSetCapture(
+ TkWindow *winPtr) /* Capture window, or NULL. */
{
if (winPtr) {
SetCapture(Tk_GetHWND(Tk_WindowId(winPtr)));
@@ -524,3 +518,11 @@ TkpSetCapture(winPtr)
ReleaseCapture();
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinPort.h b/win/tkWinPort.h
index f991195..9deefce 100644
--- a/win/tkWinPort.h
+++ b/win/tkWinPort.h
@@ -40,19 +40,43 @@
#endif
#include <time.h>
-#ifdef __CYGWIN__
-# define _T(x) L##x
-#else
-# include <tchar.h>
-#endif
#ifdef _MSC_VER
-# define hypot _hypot
+# ifndef hypot
+# define hypot _hypot
+# endif
#endif /* _MSC_VER */
-#ifndef __GNUC__
-# define strncasecmp strnicmp
-# define strcasecmp stricmp
+/*
+ * Pull in the typedef of TCHAR for windows.
+ */
+#if !defined(_TCHAR_DEFINED)
+# include <tchar.h>
+# ifndef _TCHAR_DEFINED
+ /* Borland seems to forget to set this. */
+ typedef _TCHAR TCHAR;
+# define _TCHAR_DEFINED
+# endif
+# if defined(_MSC_VER) && defined(__STDC__)
+ /* VS2005 SP1 misses this. See [Bug #3110161] */
+ typedef _TCHAR TCHAR;
+# endif
+#endif
+
+#ifdef __CYGWIN__
+# ifndef _vsnprintf
+# define _vsnprintf vsnprintf
+# endif
+# ifndef _wcsicmp
+# define _wcsicmp wcscasecmp
+# endif
+#else
+# ifndef strncasecmp
+# define strncasecmp strnicmp
+# endif
+# ifndef strcasecmp
+# define strcasecmp stricmp
+# endif
#endif
#define NBBY 8
@@ -117,8 +141,4 @@
#define TkpCreateNativeBitmap(display, source) None
#define TkpGetNativeAppBitmap(display, name, w, h) None
-#ifndef _TCLINT
-#include <tclInt.h>
-#endif
-
#endif /* _WINPORT */
diff --git a/win/tkWinRegion.c b/win/tkWinRegion.c
index 713a6b1..a996ca5 100644
--- a/win/tkWinRegion.c
+++ b/win/tkWinRegion.c
@@ -1,12 +1,12 @@
-/*
+/*
* tkWinRegion.c --
*
* Tk Region emulation code.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
@@ -29,7 +29,7 @@
*/
TkRegion
-TkCreateRegion()
+TkCreateRegion(void)
{
RECT rect;
memset(&rect, 0, sizeof(RECT));
@@ -53,8 +53,8 @@ TkCreateRegion()
*/
void
-TkDestroyRegion(r)
- TkRegion r;
+TkDestroyRegion(
+ TkRegion r)
{
DeleteObject((HRGN) r);
}
@@ -76,11 +76,12 @@ TkDestroyRegion(r)
*/
void
-TkClipBox(r, rect_return)
- TkRegion r;
- XRectangle* rect_return;
+TkClipBox(
+ TkRegion r,
+ XRectangle* rect_return)
{
RECT rect;
+
GetRgnBox((HRGN)r, &rect);
rect_return->x = (short) rect.left;
rect_return->y = (short) rect.top;
@@ -105,10 +106,10 @@ TkClipBox(r, rect_return)
*/
void
-TkIntersectRegion(sra, srb, dr_return)
- TkRegion sra;
- TkRegion srb;
- TkRegion dr_return;
+TkIntersectRegion(
+ TkRegion sra,
+ TkRegion srb,
+ TkRegion dr_return)
{
CombineRgn((HRGN) dr_return, (HRGN) sra, (HRGN) srb, RGN_AND);
}
@@ -130,13 +131,14 @@ TkIntersectRegion(sra, srb, dr_return)
*/
void
-TkUnionRectWithRegion(rectangle, src_region, dest_region_return)
- XRectangle* rectangle;
- TkRegion src_region;
- TkRegion dest_region_return;
+TkUnionRectWithRegion(
+ XRectangle *rectangle,
+ TkRegion src_region,
+ TkRegion dest_region_return)
{
HRGN rectRgn = CreateRectRgn(rectangle->x, rectangle->y,
rectangle->x + rectangle->width, rectangle->y + rectangle->height);
+
CombineRgn((HRGN) dest_region_return, (HRGN) src_region,
(HRGN) rectRgn, RGN_OR);
DeleteObject(rectRgn);
@@ -145,14 +147,84 @@ TkUnionRectWithRegion(rectangle, src_region, dest_region_return)
/*
*----------------------------------------------------------------------
*
+ * TkpBuildRegionFromAlphaData --
+ *
+ * Set up a rectangle of the given region based on the supplied alpha
+ * data.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The region is updated, with extra pixels added to it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpBuildRegionFromAlphaData(
+ TkRegion region,
+ unsigned int x, unsigned int y,
+ /* Where in region to update. */
+ unsigned int width, unsigned int height,
+ /* Size of rectangle to update. */
+ unsigned char *dataPtr, /* Data to read from. */
+ unsigned int pixelStride, /* Num bytes from one piece of alpha data to
+ * the next in the line. */
+ unsigned int lineStride) /* Num bytes from one line of alpha data to
+ * the next line. */
+{
+ unsigned char *lineDataPtr;
+ unsigned int x1, y1, end;
+ HRGN rectRgn = CreateRectRgn(0,0,1,1); /* Workspace region. */
+
+ for (y1 = 0; y1 < height; y1++) {
+ lineDataPtr = dataPtr;
+ for (x1 = 0; x1 < width; x1 = end) {
+ /*
+ * Search for first non-transparent pixel.
+ */
+
+ while ((x1 < width) && !*lineDataPtr) {
+ x1++;
+ lineDataPtr += pixelStride;
+ }
+ end = x1;
+
+ /*
+ * Search for first transparent pixel.
+ */
+
+ while ((end < width) && *lineDataPtr) {
+ end++;
+ lineDataPtr += pixelStride;
+ }
+ if (end > x1) {
+ /*
+ * Manipulate Win32 regions directly; it's more efficient.
+ */
+
+ SetRectRgn(rectRgn, (int) (x+x1), (int) (y+y1),
+ (int) (x+end), (int) (y+y1+1));
+ CombineRgn((HRGN) region, (HRGN) region, rectRgn, RGN_OR);
+ }
+ }
+ dataPtr += lineStride;
+ }
+
+ DeleteObject(rectRgn);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkRectInRegion --
*
* Test whether a given rectangle overlaps with a region.
*
* Results:
- * Returns RectanglePart or RectangleOut. Note that this is
- * not a complete implementation since it doesn't test for
- * RectangleIn.
+ * Returns RectanglePart or RectangleOut. Note that this is not a
+ * complete implementation since it doesn't test for RectangleIn.
*
* Side effects:
* None.
@@ -161,12 +233,11 @@ TkUnionRectWithRegion(rectangle, src_region, dest_region_return)
*/
int
-TkRectInRegion(r, x, y, width, height)
- TkRegion r;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
+TkRectInRegion(
+ TkRegion r, /* Region to inspect */
+ int x, int y, /* Top-left of rectangle */
+ unsigned int width, /* Width of rectangle */
+ unsigned int height) /* Height of rectangle */
{
RECT rect;
rect.top = y;
@@ -193,10 +264,18 @@ TkRectInRegion(r, x, y, width, height)
*/
void
-TkSubtractRegion(sra, srb, dr_return)
- TkRegion sra;
- TkRegion srb;
- TkRegion dr_return;
+TkSubtractRegion(
+ TkRegion sra,
+ TkRegion srb,
+ TkRegion dr_return)
{
CombineRgn((HRGN) dr_return, (HRGN) sra, (HRGN) srb, RGN_DIFF);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index 130daa6..5032912 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinScrollbar.c --
*
* This file implements the Windows specific portion of the scrollbar
@@ -6,19 +6,18 @@
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
#include "tkScrollbar.h"
-
/*
- * The following constant is used to specify the maximum scroll position.
- * This value is limited by the Win32 API to either 16-bits or 32-bits,
- * depending on the context. For now we'll just use a value small
- * enough to fit in 16-bits, but which gives us 4-digits of precision.
+ * The following constant is used to specify the maximum scroll position. This
+ * value is limited by the Win32 API to either 16-bits or 32-bits, depending
+ * on the context. For now we'll just use a value small enough to fit in
+ * 16-bits, but which gives us 4-digits of precision.
*/
#define MAX_SCROLL 10000
@@ -37,7 +36,7 @@ typedef struct WinScrollbar {
/*
* Flag bits for native scrollbars:
- *
+ *
* IN_MODAL_LOOP: Non-zero means this scrollbar is in the middle
* of a modal loop.
* ALREADY_DEAD: Non-zero means this scrollbar has been
@@ -58,8 +57,8 @@ static int vArrowWidth, vArrowHeight, vThumb; /* Vertical control metrics. */
TCL_DECLARE_MUTEX(winScrlbrMutex)
/*
- * This variable holds the default width for a scrollbar in string
- * form for use in a Tk_ConfigSpec.
+ * This variable holds the default width for a scrollbar in string form for
+ * use in a Tk_ConfigSpec.
*/
static char defWidth[TCL_INTEGER_SPACE];
@@ -68,18 +67,16 @@ static char defWidth[TCL_INTEGER_SPACE];
* Declarations for functions defined in this file.
*/
-static Window CreateProc _ANSI_ARGS_((Tk_Window tkwin,
- Window parent, ClientData instanceData));
-static void ModalLoopProc _ANSI_ARGS_((Tk_Window tkwin,
- XEvent *eventPtr));
-static int ScrollbarBindProc _ANSI_ARGS_((ClientData clientData,
+static Window CreateProc(Tk_Window tkwin, Window parent,
+ ClientData instanceData);
+static void ModalLoopProc(Tk_Window tkwin, XEvent *eventPtr);
+static int ScrollbarBindProc(ClientData clientData,
Tcl_Interp *interp, XEvent *eventPtr,
- Tk_Window tkwin, KeySym keySym));
-static LRESULT CALLBACK ScrollbarProc _ANSI_ARGS_((HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam));
-static void UpdateScrollbar _ANSI_ARGS_((
- WinScrollbar *scrollPtr));
-static void UpdateScrollbarMetrics _ANSI_ARGS_((void));
+ Tk_Window tkwin, KeySym keySym);
+static LRESULT CALLBACK ScrollbarProc(HWND hwnd, UINT message, WPARAM wParam,
+ LPARAM lParam);
+static void UpdateScrollbar(WinScrollbar *scrollPtr);
+static void UpdateScrollbarMetrics(void);
/*
* The class procedure table for the scrollbar widget.
@@ -110,14 +107,14 @@ Tk_ClassProcs tkpScrollbarProcs = {
*/
TkScrollbar *
-TkpCreateScrollbar(tkwin)
- Tk_Window tkwin;
+TkpCreateScrollbar(
+ Tk_Window tkwin)
{
WinScrollbar *scrollPtr;
TkWindow *winPtr = (TkWindow *)tkwin;
-
+
if (!initialized) {
- Tcl_MutexLock(&winScrlbrMutex);
+ Tcl_MutexLock(&winScrlbrMutex);
UpdateScrollbarMetrics();
initialized = 1;
Tcl_MutexUnlock(&winScrlbrMutex);
@@ -140,7 +137,7 @@ TkpCreateScrollbar(tkwin)
ScrollbarBindProc, NULL, NULL);
}
- return (TkScrollbar*) scrollPtr;
+ return (TkScrollbar *) scrollPtr;
}
/*
@@ -148,8 +145,8 @@ TkpCreateScrollbar(tkwin)
*
* UpdateScrollbar --
*
- * This function updates the position and size of the scrollbar
- * thumb based on the current settings.
+ * This function updates the position and size of the scrollbar thumb
+ * based on the current settings.
*
* Results:
* None.
@@ -161,8 +158,8 @@ TkpCreateScrollbar(tkwin)
*/
static void
-UpdateScrollbar(scrollPtr)
- WinScrollbar *scrollPtr;
+UpdateScrollbar(
+ WinScrollbar *scrollPtr)
{
SCROLLINFO scrollInfo;
double thumbSize;
@@ -179,15 +176,17 @@ UpdateScrollbar(scrollPtr)
scrollInfo.nPage = ((UINT) (thumbSize * (double) MAX_SCROLL)) + 1;
if (thumbSize < 1.0) {
scrollInfo.nPos = (int)
- ((scrollPtr->info.firstFraction / (1.0-thumbSize))
- * (MAX_SCROLL - (scrollInfo.nPage - 1)));
+ ((scrollPtr->info.firstFraction / (1.0-thumbSize))
+ * (MAX_SCROLL - (scrollInfo.nPage - 1)));
} else {
scrollInfo.nPos = 0;
+
/*
- * Disable the scrollbar when there is nothing to scroll.
- * This is standard Windows style (see eg Notepad).
- * Also prevents possible crash on XP+ systems [Bug #624116].
+ * Disable the scrollbar when there is nothing to scroll. This is
+ * standard Windows style (see eg Notepad). Also prevents possible
+ * crash on XP+ systems [Bug #624116].
*/
+
scrollInfo.fMask |= SIF_DISABLENOSCROLL;
}
SetScrollInfo(scrollPtr->hwnd, SB_CTL, &scrollInfo, TRUE);
@@ -198,8 +197,8 @@ UpdateScrollbar(scrollPtr)
*
* CreateProc --
*
- * This function creates a new Scrollbar control, subclasses
- * the instance, and generates a new Window object.
+ * This function creates a new Scrollbar control, subclasses the
+ * instance, and generates a new Window object.
*
* Results:
* Returns the newly allocated Window object, or None on failure.
@@ -211,10 +210,10 @@ UpdateScrollbar(scrollPtr)
*/
static Window
-CreateProc(tkwin, parentWin, instanceData)
- Tk_Window tkwin; /* Token for window. */
- Window parentWin; /* Parent of new window. */
- ClientData instanceData; /* Scrollbar instance data. */
+CreateProc(
+ Tk_Window tkwin, /* Token for window. */
+ Window parentWin, /* Parent of new window. */
+ ClientData instanceData) /* Scrollbar instance data. */
{
DWORD style;
Window window;
@@ -226,10 +225,10 @@ CreateProc(tkwin, parentWin, instanceData)
if (scrollPtr->info.vertical) {
style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS
- | SBS_VERT | SBS_RIGHTALIGN;
+ | SBS_VERT | SBS_RIGHTALIGN;
} else {
style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS
- | SBS_HORZ | SBS_BOTTOMALIGN;
+ | SBS_HORZ | SBS_BOTTOMALIGN;
}
scrollPtr->hwnd = CreateWindow("SCROLLBAR", NULL, style,
@@ -238,14 +237,14 @@ CreateProc(tkwin, parentWin, instanceData)
/*
* Ensure new window is inserted into the stacking order at the correct
- * place.
+ * place.
*/
SetWindowPos(scrollPtr->hwnd, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
for (winPtr = ((TkWindow*)tkwin)->nextPtr; winPtr != NULL;
- winPtr = winPtr->nextPtr) {
+ winPtr = winPtr->nextPtr) {
if ((winPtr->window != None) && !(winPtr->flags & TK_TOP_HIERARCHY)) {
TkWinSetWindowPos(scrollPtr->hwnd, Tk_GetHWND(winPtr->window),
Below);
@@ -254,13 +253,8 @@ CreateProc(tkwin, parentWin, instanceData)
}
scrollPtr->lastVertical = scrollPtr->info.vertical;
-#ifdef _WIN64
scrollPtr->oldProc = (WNDPROC)SetWindowLongPtr(scrollPtr->hwnd,
- GWLP_WNDPROC, (LONG_PTR) ScrollbarProc);
-#else
- scrollPtr->oldProc = (WNDPROC)SetWindowLong(scrollPtr->hwnd, GWL_WNDPROC,
- (DWORD) ScrollbarProc);
-#endif
+ GWLP_WNDPROC, (INT_PTR) ScrollbarProc);
window = Tk_AttachHWND(tkwin, scrollPtr->hwnd);
UpdateScrollbar(scrollPtr);
@@ -272,9 +266,9 @@ CreateProc(tkwin, parentWin, instanceData)
*
* TkpDisplayScrollbar --
*
- * This procedure redraws the contents of a scrollbar window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This procedure redraws the contents of a scrollbar window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
* None.
@@ -286,8 +280,8 @@ CreateProc(tkwin, parentWin, instanceData)
*/
void
-TkpDisplayScrollbar(clientData)
- ClientData clientData; /* Information about window. */
+TkpDisplayScrollbar(
+ ClientData clientData) /* Information about window. */
{
WinScrollbar *scrollPtr = (WinScrollbar *) clientData;
Tk_Window tkwin = scrollPtr->info.tkwin;
@@ -298,18 +292,14 @@ TkpDisplayScrollbar(clientData)
}
/*
- * Destroy and recreate the scrollbar control if the orientation
- * has changed.
+ * Destroy and recreate the scrollbar control if the orientation has
+ * changed.
*/
if (scrollPtr->lastVertical != scrollPtr->info.vertical) {
HWND hwnd = Tk_GetHWND(Tk_WindowId(tkwin));
-#ifdef _WIN64
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc);
-#else
- SetWindowLong(hwnd, GWL_WNDPROC, (DWORD) scrollPtr->oldProc);
-#endif
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) scrollPtr->oldProc);
DestroyWindow(hwnd);
CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)),
@@ -336,17 +326,14 @@ TkpDisplayScrollbar(clientData)
*/
void
-TkpDestroyScrollbar(scrollPtr)
- TkScrollbar *scrollPtr;
+TkpDestroyScrollbar(
+ TkScrollbar *scrollPtr)
{
WinScrollbar *winScrollPtr = (WinScrollbar *)scrollPtr;
HWND hwnd = winScrollPtr->hwnd;
+
if (hwnd) {
-#ifdef _WIN64
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winScrollPtr->oldProc);
-#else
- SetWindowLong(hwnd, GWL_WNDPROC, (DWORD) winScrollPtr->oldProc);
-#endif
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) winScrollPtr->oldProc);
if (winScrollPtr->winFlags & IN_MODAL_LOOP) {
((TkWindow *)scrollPtr->tkwin)->flags |= TK_DONT_DESTROY_WINDOW;
SetParent(hwnd, NULL);
@@ -360,8 +347,7 @@ TkpDestroyScrollbar(scrollPtr)
*
* UpdateScrollbarMetrics --
*
- * This function retrieves the current system metrics for a
- * scrollbar.
+ * This function retrieves the current system metrics for a scrollbar.
*
* Results:
* None.
@@ -373,7 +359,7 @@ TkpDestroyScrollbar(scrollPtr)
*/
void
-UpdateScrollbarMetrics()
+UpdateScrollbarMetrics(void)
{
Tk_ConfigSpec *specPtr;
@@ -397,9 +383,9 @@ UpdateScrollbarMetrics()
*
* TkpComputeScrollbarGeometry --
*
- * After changes in a scrollbar's size or configuration, this
- * procedure recomputes various geometry information used in
- * displaying the scrollbar.
+ * After changes in a scrollbar's size or configuration, this procedure
+ * recomputes various geometry information used in displaying the
+ * scrollbar.
*
* Results:
* None.
@@ -411,15 +397,16 @@ UpdateScrollbarMetrics()
*/
void
-TkpComputeScrollbarGeometry(scrollPtr)
- register TkScrollbar *scrollPtr; /* Scrollbar whose geometry may
- * have changed. */
+TkpComputeScrollbarGeometry(
+ register TkScrollbar *scrollPtr)
+ /* Scrollbar whose geometry may have
+ * changed. */
{
int fieldLength, minThumbSize;
/*
- * Windows doesn't use focus rings on scrollbars, but we still
- * perform basic sanity checks to appease backwards compatibility.
+ * Windows doesn't use focus rings on scrollbars, but we still perform
+ * basic sanity checks to appease backwards compatibility.
*/
if (scrollPtr->highlightWidth < 0) {
@@ -445,9 +432,9 @@ TkpComputeScrollbarGeometry(scrollPtr)
* scrollPtr->lastFraction);
/*
- * Adjust the slider so that some piece of it is always
- * displayed in the scrollbar and so that it has at least
- * a minimal width (so it can be grabbed with the mouse).
+ * Adjust the slider so that some piece of it is always displayed in the
+ * scrollbar and so that it has at least a minimal width (so it can be
+ * grabbed with the mouse).
*/
if (scrollPtr->sliderFirst > fieldLength) {
@@ -467,10 +454,9 @@ TkpComputeScrollbarGeometry(scrollPtr)
scrollPtr->sliderLast += scrollPtr->arrowLength;
/*
- * Register the desired geometry for the window (leave enough space
- * for the two arrows plus a minimum-size slider, plus border around
- * the whole window, if any). Then arrange for the window to be
- * redisplayed.
+ * Register the desired geometry for the window (leave enough space for
+ * the two arrows plus a minimum-size slider, plus border around the whole
+ * window, if any). Then arrange for the window to be redisplayed.
*/
if (scrollPtr->vertical) {
@@ -488,8 +474,8 @@ TkpComputeScrollbarGeometry(scrollPtr)
*
* ScrollbarProc --
*
- * This function is call by Windows whenever an event occurs on
- * a scrollbar control created by Tk.
+ * This function is call by Windows whenever an event occurs on a
+ * scrollbar control created by Tk.
*
* Results:
* Standard Windows return value.
@@ -501,11 +487,11 @@ TkpComputeScrollbarGeometry(scrollPtr)
*/
static LRESULT CALLBACK
-ScrollbarProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+ScrollbarProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
LRESULT result;
POINT point;
@@ -513,90 +499,89 @@ ScrollbarProc(hwnd, message, wParam, lParam)
Tk_Window tkwin = Tk_HWNDToWindow(hwnd);
if (tkwin == NULL) {
- panic("ScrollbarProc called on an invalid HWND");
+ Tcl_Panic("ScrollbarProc called on an invalid HWND");
}
scrollPtr = (WinScrollbar *)((TkWindow*)tkwin)->instanceData;
switch(message) {
- case WM_HSCROLL:
- case WM_VSCROLL: {
- Tcl_Interp *interp;
- Tcl_DString cmdString;
- int command = LOWORD(wParam);
- int code;
-
- GetCursorPos(&point);
- Tk_TranslateWinEvent(NULL, WM_MOUSEMOVE, 0,
- MAKELPARAM(point.x, point.y), &result);
-
- if (command == SB_ENDSCROLL) {
- return 0;
- }
-
- /*
- * Bail out immediately if there isn't a command to invoke.
- */
-
- if (scrollPtr->info.commandSize == 0) {
- Tcl_ServiceAll();
- return 0;
- }
-
- Tcl_DStringInit(&cmdString);
- Tcl_DStringAppend(&cmdString, scrollPtr->info.command,
- scrollPtr->info.commandSize);
-
- if (command == SB_LINELEFT || command == SB_LINERIGHT) {
- Tcl_DStringAppendElement(&cmdString, "scroll");
- Tcl_DStringAppendElement(&cmdString,
- (command == SB_LINELEFT ) ? "-1" : "1");
- Tcl_DStringAppendElement(&cmdString, "units");
- } else if (command == SB_PAGELEFT || command == SB_PAGERIGHT) {
- Tcl_DStringAppendElement(&cmdString, "scroll");
- Tcl_DStringAppendElement(&cmdString,
- (command == SB_PAGELEFT ) ? "-1" : "1");
- Tcl_DStringAppendElement(&cmdString, "pages");
- } else {
- char valueString[TCL_DOUBLE_SPACE];
- double pos = 0.0;
- switch (command) {
- case SB_THUMBPOSITION:
- pos = ((double)HIWORD(wParam)) / MAX_SCROLL;
- break;
-
- case SB_THUMBTRACK:
- pos = ((double)HIWORD(wParam)) / MAX_SCROLL;
- break;
-
- case SB_TOP:
- pos = 0.0;
- break;
-
- case SB_BOTTOM:
- pos = 1.0;
- break;
- }
- sprintf(valueString, "%g", pos);
- Tcl_DStringAppendElement(&cmdString, "moveto");
- Tcl_DStringAppendElement(&cmdString, valueString);
- }
+ case WM_HSCROLL:
+ case WM_VSCROLL: {
+ Tcl_Interp *interp;
+ Tcl_DString cmdString;
+ int command = LOWORD(wParam);
+ int code;
+
+ GetCursorPos(&point);
+ Tk_TranslateWinEvent(NULL, WM_MOUSEMOVE, 0,
+ MAKELPARAM(point.x, point.y), &result);
+
+ if (command == SB_ENDSCROLL) {
+ return 0;
+ }
- interp = scrollPtr->info.interp;
- code = Tcl_GlobalEval(interp, cmdString.string);
- if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
- Tcl_AddErrorInfo(interp, "\n (scrollbar command)");
- Tcl_BackgroundError(interp);
- }
- Tcl_DStringFree(&cmdString);
+ /*
+ * Bail out immediately if there isn't a command to invoke.
+ */
+ if (scrollPtr->info.commandSize == 0) {
Tcl_ServiceAll();
return 0;
}
- default:
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
- return result;
+ Tcl_DStringInit(&cmdString);
+ Tcl_DStringAppend(&cmdString, scrollPtr->info.command,
+ scrollPtr->info.commandSize);
+
+ if (command == SB_LINELEFT || command == SB_LINERIGHT) {
+ Tcl_DStringAppendElement(&cmdString, "scroll");
+ Tcl_DStringAppendElement(&cmdString,
+ (command == SB_LINELEFT ) ? "-1" : "1");
+ Tcl_DStringAppendElement(&cmdString, "units");
+ } else if (command == SB_PAGELEFT || command == SB_PAGERIGHT) {
+ Tcl_DStringAppendElement(&cmdString, "scroll");
+ Tcl_DStringAppendElement(&cmdString,
+ (command == SB_PAGELEFT ) ? "-1" : "1");
+ Tcl_DStringAppendElement(&cmdString, "pages");
+ } else {
+ char valueString[TCL_DOUBLE_SPACE];
+ double pos = 0.0;
+
+ switch (command) {
+ case SB_THUMBPOSITION:
+ pos = ((double)HIWORD(wParam)) / MAX_SCROLL;
+ break;
+ case SB_THUMBTRACK:
+ pos = ((double)HIWORD(wParam)) / MAX_SCROLL;
+ break;
+ case SB_TOP:
+ pos = 0.0;
+ break;
+ case SB_BOTTOM:
+ pos = 1.0;
+ break;
}
+
+ Tcl_PrintDouble(NULL, pos, valueString);
+ Tcl_DStringAppendElement(&cmdString, "moveto");
+ Tcl_DStringAppendElement(&cmdString, valueString);
+ }
+
+ interp = scrollPtr->info.interp;
+ code = Tcl_GlobalEval(interp, cmdString.string);
+ if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
+ Tcl_AddErrorInfo(interp, "\n (scrollbar command)");
+ Tcl_BackgroundError(interp);
+ }
+ Tcl_DStringFree(&cmdString);
+
+ Tcl_ServiceAll();
+ return 0;
+ }
+
+ default:
+ if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ return result;
+ }
}
return CallWindowProc(scrollPtr->oldProc, hwnd, message, wParam, lParam);
}
@@ -607,8 +592,8 @@ ScrollbarProc(hwnd, message, wParam, lParam)
* TkpConfigureScrollbar --
*
* This procedure is called after the generic code has finished
- * processing configuration options, in order to configure
- * platform specific options.
+ * processing configuration options, in order to configure platform
+ * specific options.
*
* Results:
* None.
@@ -620,10 +605,10 @@ ScrollbarProc(hwnd, message, wParam, lParam)
*/
void
-TkpConfigureScrollbar(scrollPtr)
- register TkScrollbar *scrollPtr; /* Information about widget; may or
- * may not already have values for
- * some fields. */
+TkpConfigureScrollbar(
+ register TkScrollbar *scrollPtr)
+ /* Information about widget; may or may not
+ * already have values for some fields. */
{
}
@@ -632,8 +617,8 @@ TkpConfigureScrollbar(scrollPtr)
*
* ScrollbarBindProc --
*
- * This procedure is invoked when the default <ButtonPress>
- * binding on the Scrollbar bind tag fires.
+ * This procedure is invoked when the default <ButtonPress> binding on
+ * the Scrollbar bind tag fires.
*
* Results:
* None.
@@ -645,14 +630,15 @@ TkpConfigureScrollbar(scrollPtr)
*/
static int
-ScrollbarBindProc(clientData, interp, eventPtr, tkwin, keySym)
- ClientData clientData;
- Tcl_Interp *interp;
- XEvent *eventPtr;
- Tk_Window tkwin;
- KeySym keySym;
+ScrollbarBindProc(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ XEvent *eventPtr,
+ Tk_Window tkwin,
+ KeySym keySym)
{
- TkWindow *winPtr = (TkWindow*)tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+
if (eventPtr->type == ButtonPress) {
winPtr->flags |= TK_DEFER_MODAL;
}
@@ -664,9 +650,8 @@ ScrollbarBindProc(clientData, interp, eventPtr, tkwin, keySym)
*
* ModalLoopProc --
*
- * This function is invoked at the end of the event processing
- * whenever the ScrollbarBindProc has been invoked for a ButtonPress
- * event.
+ * This function is invoked at the end of the event processing whenever
+ * the ScrollbarBindProc has been invoked for a ButtonPress event.
*
* Results:
* None.
@@ -678,16 +663,16 @@ ScrollbarBindProc(clientData, interp, eventPtr, tkwin, keySym)
*/
static void
-ModalLoopProc(tkwin, eventPtr)
- Tk_Window tkwin;
- XEvent *eventPtr;
+ModalLoopProc(
+ Tk_Window tkwin,
+ XEvent *eventPtr)
{
- TkWindow *winPtr = (TkWindow*)tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
WinScrollbar *scrollPtr = (WinScrollbar *) winPtr->instanceData;
int oldMode;
if (scrollPtr->hwnd) {
- Tcl_Preserve((ClientData)scrollPtr);
+ Tcl_Preserve(scrollPtr);
scrollPtr->winFlags |= IN_MODAL_LOOP;
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
TkWinResendEvent(scrollPtr->oldProc, scrollPtr->hwnd, eventPtr);
@@ -696,7 +681,7 @@ ModalLoopProc(tkwin, eventPtr)
if (scrollPtr->hwnd && scrollPtr->winFlags & ALREADY_DEAD) {
DestroyWindow(scrollPtr->hwnd);
}
- Tcl_Release((ClientData)scrollPtr);
+ Tcl_Release(scrollPtr);
}
}
@@ -705,14 +690,12 @@ ModalLoopProc(tkwin, eventPtr)
*
* TkpScrollbarPosition --
*
- * Determine the scrollbar element corresponding to a
- * given position.
+ * Determine the scrollbar element corresponding to a given position.
*
* Results:
- * One of TOP_ARROW, TOP_GAP, etc., indicating which element
- * of the scrollbar covers the position given by (x, y). If
- * (x,y) is outside the scrollbar entirely, then OUTSIDE is
- * returned.
+ * One of TOP_ARROW, TOP_GAP, etc., indicating which element of the
+ * scrollbar covers the position given by (x, y). If (x,y) is outside the
+ * scrollbar entirely, then OUTSIDE is returned.
*
* Side effects:
* None.
@@ -721,10 +704,10 @@ ModalLoopProc(tkwin, eventPtr)
*/
int
-TkpScrollbarPosition(scrollPtr, x, y)
- register TkScrollbar *scrollPtr; /* Scrollbar widget record. */
- int x, y; /* Coordinates within scrollPtr's
- * window. */
+TkpScrollbarPosition(
+ register TkScrollbar *scrollPtr,
+ /* Scrollbar widget record. */
+ int x, int y) /* Coordinates within scrollPtr's window. */
{
int length, width, tmp;
@@ -746,7 +729,7 @@ TkpScrollbarPosition(scrollPtr, x, y)
/*
* All of the calculations in this procedure mirror those in
- * TkpDisplayScrollbar. Be sure to keep the two consistent.
+ * TkpDisplayScrollbar. Be sure to keep the two consistent.
*/
if (y < (scrollPtr->inset + scrollPtr->arrowLength)) {
@@ -763,3 +746,11 @@ TkpScrollbarPosition(scrollPtr, x, y)
}
return BOTTOM_GAP;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinSend.c b/win/tkWinSend.c
index 781aa5d..4b25963 100644
--- a/win/tkWinSend.c
+++ b/win/tkWinSend.c
@@ -1,56 +1,195 @@
-/*
+/*
* tkWinSend.c --
*
- * This file provides procedures that implement the "send"
- * command, allowing commands to be passed from interpreter
- * to interpreter.
+ * This file provides functions that implement the "send" command,
+ * allowing commands to be passed from interpreter to interpreter.
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
+ * Copyright (c) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
+#include "tkWinSendCom.h"
+
+#ifdef _MSC_VER
+#define vsnprintf _vsnprintf
+#endif
+
+/*
+ * Should be defined in WTypes.h but mingw 1.0 is missing them.
+ */
+
+#ifndef _ROTFLAGS_DEFINED
+#define _ROTFLAGS_DEFINED
+#define ROTFLAGS_REGISTRATIONKEEPSALIVE 0x01
+#define ROTFLAGS_ALLOWANYCLIENT 0x02
+#endif /* ! _ROTFLAGS_DEFINED */
+
+#define TKWINSEND_CLASS_NAME "TclEval"
+#define TKWINSEND_REGISTRATION_BASE L"TclEval"
+
+#define MK_E_MONIKERALREADYREGISTERED \
+ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x02A1)
+
+/*
+ * Package information structure. This is used to keep interpreter specific
+ * details for use when releasing the package resources upon interpreter
+ * deletion or package removal.
+ */
+
+typedef struct {
+ char *name; /* The registered application name */
+ DWORD cookie; /* ROT cookie returned on registration */
+ LPUNKNOWN obj; /* Interface for the registration object */
+ Tcl_Interp *interp;
+ Tcl_Command token; /* Winsend command token */
+} RegisteredInterp;
+
+typedef struct SendEvent {
+ Tcl_Event header;
+ Tcl_Interp *interp;
+ Tcl_Obj *cmdPtr;
+} SendEvent;
+
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
+typedef struct {
+ int initialized;
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
+#endif
+
+/*
+ * Functions internal to this file.
+ */
+
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
+static void CmdDeleteProc(ClientData clientData);
+static void InterpDeleteProc(ClientData clientData,
+ Tcl_Interp *interp);
+static void RevokeObjectRegistration(RegisteredInterp *riPtr);
+#endif
+static HRESULT BuildMoniker(const char *name, LPMONIKER *pmk);
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
+static HRESULT RegisterInterp(const char *name,
+ RegisteredInterp *riPtr);
+#endif
+static int FindInterpreterObject(Tcl_Interp *interp,
+ const char *name, LPDISPATCH *ppdisp);
+static int Send(LPDISPATCH pdispInterp, Tcl_Interp *interp,
+ int async, ClientData clientData, int objc,
+ Tcl_Obj *const objv[]);
+static Tcl_Obj * Win32ErrorObj(HRESULT hrError);
+static void SendTrace(const char *format, ...);
+static Tcl_EventProc SendEventProc;
+#if defined(DEBUG) || defined(_DEBUG)
+#define TRACE SendTrace
+#else
+#define TRACE 1 ? ((void)0) : SendTrace
+#endif
/*
*--------------------------------------------------------------
*
* Tk_SetAppName --
*
- * This procedure is called to associate an ASCII name with a Tk
- * application. If the application has already been named, the
- * name replaces the old one.
+ * This function is called to associate an ASCII name with a Tk
+ * application. If the application has already been named, the name
+ * replaces the old one.
*
* Results:
- * The return value is the name actually given to the application.
- * This will normally be the same as name, but if name was already
- * in use for an application then a name of the form "name #2" will
- * be chosen, with a high enough number to make the name unique.
+ * The return value is the name actually given to the application. This
+ * will normally be the same as name, but if name was already in use for
+ * an application then a name of the form "name #2" will be chosen, with
+ * a high enough number to make the name unique.
*
* Side effects:
- * Registration info is saved, thereby allowing the "send" command
- * to be used later to invoke commands in the application. In
- * addition, the "send" command is created in the application's
- * interpreter. The registration will be removed automatically
- * if the interpreter is deleted or the "send" command is removed.
+ * Registration info is saved, thereby allowing the "send" command to be
+ * used later to invoke commands in the application. In addition, the
+ * "send" command is created in the application's interpreter. The
+ * registration will be removed automatically if the interpreter is
+ * deleted or the "send" command is removed.
*
*--------------------------------------------------------------
*/
-CONST char *
-Tk_SetAppName(tkwin, name)
- Tk_Window tkwin; /* Token for any window in the application
- * to be named: it is just used to identify
- * the application and the display. */
- CONST char *name; /* The name that will be used to
- * refer to the interpreter in later
- * "send" commands. Must be globally
- * unique. */
+const char *
+Tk_SetAppName(
+ Tk_Window tkwin, /* Token for any window in the application to
+ * be named: it is just used to identify the
+ * application and the display. */
+ const char *name) /* The name that will be used to refer to the
+ * interpreter in later "send" commands. Must
+ * be globally unique. */
{
+#ifndef TK_SEND_ENABLED_ON_WINDOWS
+ /*
+ * Temporarily disabled for bug #858822
+ */
+
return name;
+#else /* TK_SEND_ENABLED_ON_WINDOWS */
+
+ ThreadSpecificData *tsdPtr = NULL;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ RegisteredInterp *riPtr = NULL;
+ Tcl_Interp *interp;
+ HRESULT hr = S_OK;
+
+ interp = winPtr->mainPtr->interp;
+
+ tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ /*
+ * Initialise the COM library for this interpreter just once.
+ */
+
+ if (tsdPtr->initialized == 0) {
+ hr = CoInitialize(0);
+ if (FAILED(hr)) {
+ Tcl_SetResult(interp,
+ "failed to initialize the COM library", TCL_STATIC);
+ return "";
+ }
+ tsdPtr->initialized = 1;
+ TRACE("Initialized COM library for interp 0x%08X\n", (long)interp);
+ }
+
+ /*
+ * If the interp hasn't been registered before then we need to create the
+ * registration structure and the COM object. If it has been registered
+ * already then we can reuse all and just register the new name.
+ */
+
+ riPtr = Tcl_GetAssocData(interp, "tkWinSend::ri", NULL);
+ if (riPtr == NULL) {
+ LPUNKNOWN *objPtr;
+
+ riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
+ memset(riPtr, 0, sizeof(RegisteredInterp));
+ riPtr->interp = interp;
+
+ objPtr = &riPtr->obj;
+ hr = TkWinSendCom_CreateInstance(interp, &IID_IUnknown,
+ (void **) objPtr);
+
+ Tcl_CreateObjCommand(interp, "send", Tk_SendObjCmd, riPtr,
+ CmdDeleteProc);
+ if (Tcl_IsSafe(interp)) {
+ Tcl_HideCommand(interp, "send", "send");
+ }
+ Tcl_SetAssocData(interp, "tkWinSend::ri", NULL, riPtr);
+ } else {
+ RevokeObjectRegistration(riPtr);
+ }
+
+ RegisterInterp(name, riPtr);
+ return (const char *) riPtr->name;
+#endif /* TK_SEND_ENABLED_ON_WINDOWS */
}
/*
@@ -58,15 +197,14 @@ Tk_SetAppName(tkwin, name)
*
* TkGetInterpNames --
*
- * This procedure is invoked to fetch a list of all the
- * interpreter names currently registered for the display
- * of a particular window.
+ * This function is invoked to fetch a list of all the interpreter names
+ * currently registered for the display of a particular window.
*
* Results:
- * A standard Tcl return value. Interp->result will be set
- * to hold a list of all the interpreter names defined for
- * tkwin's display. If an error occurs, then TCL_ERROR
- * is returned and interp->result will hold an error message.
+ * A standard Tcl return value. Interp->result will be set to hold a list
+ * of all the interpreter names defined for tkwin's display. If an error
+ * occurs, then TCL_ERROR is returned and interp->result will hold an
+ * error message.
*
* Side effects:
* None.
@@ -75,10 +213,837 @@ Tk_SetAppName(tkwin, name)
*/
int
-TkGetInterpNames(interp, tkwin)
- Tcl_Interp *interp; /* Interpreter for returning a result. */
- Tk_Window tkwin; /* Window whose display is to be used
- * for the lookup. */
+TkGetInterpNames(
+ Tcl_Interp *interp, /* Interpreter for returning a result. */
+ Tk_Window tkwin) /* Window whose display is to be used for the
+ * lookup. */
{
+#ifndef TK_SEND_ENABLED_ON_WINDOWS
+ /*
+ * Temporarily disabled for bug #858822
+ */
+
return TCL_OK;
+#else /* TK_SEND_ENABLED_ON_WINDOWS */
+
+ LPRUNNINGOBJECTTABLE pROT = NULL;
+ LPCOLESTR oleszStub = TKWINSEND_REGISTRATION_BASE;
+ HRESULT hr = S_OK;
+ Tcl_Obj *objList = NULL;
+ int result = TCL_OK;
+
+ hr = GetRunningObjectTable(0, &pROT);
+ if (SUCCEEDED(hr)) {
+ IBindCtx* pBindCtx = NULL;
+ objList = Tcl_NewListObj(0, NULL);
+ hr = CreateBindCtx(0, &pBindCtx);
+
+ if (SUCCEEDED(hr)) {
+ IEnumMoniker* pEnum;
+
+ hr = pROT->lpVtbl->EnumRunning(pROT, &pEnum);
+ if (SUCCEEDED(hr)) {
+ IMoniker* pmk = NULL;
+
+ while (pEnum->lpVtbl->Next(pEnum, 1, &pmk, NULL) == S_OK) {
+ LPOLESTR olestr;
+
+ hr = pmk->lpVtbl->GetDisplayName(pmk, pBindCtx, NULL,
+ &olestr);
+ if (SUCCEEDED(hr)) {
+ IMalloc *pMalloc = NULL;
+
+ if (wcsncmp(olestr, oleszStub,
+ wcslen(oleszStub)) == 0) {
+ LPOLESTR p = olestr + wcslen(oleszStub);
+
+ if (*p) {
+ result = Tcl_ListObjAppendElement(interp,
+ objList, Tcl_NewUnicodeObj(p + 1, -1));
+ }
+ }
+
+ hr = CoGetMalloc(1, &pMalloc);
+ if (SUCCEEDED(hr)) {
+ pMalloc->lpVtbl->Free(pMalloc, (void*)olestr);
+ pMalloc->lpVtbl->Release(pMalloc);
+ }
+ }
+ pmk->lpVtbl->Release(pmk);
+ }
+ pEnum->lpVtbl->Release(pEnum);
+ }
+ pBindCtx->lpVtbl->Release(pBindCtx);
+ }
+ pROT->lpVtbl->Release(pROT);
+ }
+
+ if (FAILED(hr)) {
+ /*
+ * Expire the list if set.
+ */
+
+ if (objList != NULL) {
+ Tcl_DecrRefCount(objList);
+ }
+ Tcl_SetObjResult(interp, Win32ErrorObj(hr));
+ result = TCL_ERROR;
+ }
+
+ if (result == TCL_OK) {
+ Tcl_SetObjResult(interp, objList);
+ }
+
+ return result;
+#endif /* TK_SEND_ENABLED_ON_WINDOWS */
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * Tk_SendCmd --
+ *
+ * This function is invoked to process the "send" Tcl command. See the
+ * user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+Tk_SendObjCmd(
+ ClientData clientData, /* Information about sender (only dispPtr
+ * field is used). */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
+{
+ enum {
+ SEND_ASYNC, SEND_DISPLAYOF, SEND_LAST
+ };
+ static const char *sendOptions[] = {
+ "-async", "-displayof", "--", NULL
+ };
+ int result = TCL_OK;
+ int i, optind, async = 0;
+ Tcl_Obj *displayPtr = NULL;
+
+ /*
+ * Process the command options.
+ */
+
+ for (i = 1; i < objc; i++) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], sendOptions,
+ "option", 0, &optind) != TCL_OK) {
+ break;
+ }
+ if (optind == SEND_ASYNC) {
+ ++async;
+ } else if (optind == SEND_DISPLAYOF) {
+ displayPtr = objv[++i];
+ } else if (optind == SEND_LAST) {
+ i++;
+ break;
+ }
+ }
+
+ /*
+ * Ensure we still have a valid command.
+ */
+
+ if ((objc - i) < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv,
+ "?-async? ?-displayof? ?--? interpName arg ?arg ...?");
+ result = TCL_ERROR;
+ }
+
+ /*
+ * We don't support displayPtr. See TIP #150.
+ */
+
+ if (displayPtr) {
+ Tcl_SetStringObj(Tcl_GetObjResult(interp),
+ "option not implemented: \"displayof\" is not available "
+ "for this platform.", -1);
+ result = TCL_ERROR;
+ }
+
+ /*
+ * Send the arguments to the foreign interp.
+ */
+ /* FIX ME: we need to check for local interp */
+ if (result == TCL_OK) {
+ LPDISPATCH pdisp;
+ result = FindInterpreterObject(interp, Tcl_GetString(objv[i]), &pdisp);
+ if (result == TCL_OK) {
+ i++;
+ result = Send(pdisp, interp, async, clientData, objc-i, objv+i);
+ pdisp->lpVtbl->Release(pdisp);
+ }
+ }
+
+ return result;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * FindInterpreterObject --
+ *
+ * Search the set of objects currently registered with the Running Object
+ * Table for one which matches the registered name. Tk objects are named
+ * using BuildMoniker by always prefixing with TclEval.
+ *
+ * Results:
+ * If a matching object registration is found, then the registered
+ * IDispatch interface pointer is returned. If not, then an error message
+ * is placed in the interpreter and TCL_ERROR is returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+FindInterpreterObject(
+ Tcl_Interp *interp,
+ const char *name,
+ LPDISPATCH *ppdisp)
+{
+ LPRUNNINGOBJECTTABLE pROT = NULL;
+ int result = TCL_OK;
+ HRESULT hr = GetRunningObjectTable(0, &pROT);
+
+ if (SUCCEEDED(hr)) {
+ IBindCtx* pBindCtx = NULL;
+
+ hr = CreateBindCtx(0, &pBindCtx);
+ if (SUCCEEDED(hr)) {
+ LPMONIKER pmk = NULL;
+
+ hr = BuildMoniker(name, &pmk);
+ if (SUCCEEDED(hr)) {
+ IUnknown *pUnkInterp = NULL, **ppUnkInterp = &pUnkInterp;
+
+ hr = pROT->lpVtbl->IsRunning(pROT, pmk);
+ hr = pmk->lpVtbl->BindToObject(pmk, pBindCtx, NULL,
+ &IID_IUnknown, (void **) ppUnkInterp);
+ if (SUCCEEDED(hr)) {
+ hr = pUnkInterp->lpVtbl->QueryInterface(pUnkInterp,
+ &IID_IDispatch, (void **) ppdisp);
+ pUnkInterp->lpVtbl->Release(pUnkInterp);
+
+ } else {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "no application named \"", name, "\"", NULL);
+ result = TCL_ERROR;
+ }
+
+ pmk->lpVtbl->Release(pmk);
+ }
+ pBindCtx->lpVtbl->Release(pBindCtx);
+ }
+ pROT->lpVtbl->Release(pROT);
+ }
+ if (FAILED(hr) && result == TCL_OK) {
+ Tcl_SetObjResult(interp, Win32ErrorObj(hr));
+ result = TCL_ERROR;
+ }
+ return result;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * CmdDeleteProc --
+ *
+ * This function is invoked by Tcl when the "send" command is deleted in
+ * an interpreter. It unregisters the interpreter.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The interpreter given by riPtr is unregistered, the registration
+ * structure is free'd and the COM object unregistered and released.
+ *
+ *--------------------------------------------------------------
+ */
+
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
+static void
+CmdDeleteProc(
+ ClientData clientData)
+{
+ RegisteredInterp *riPtr = (RegisteredInterp *)clientData;
+
+ /*
+ * Lock the package structure in memory.
+ */
+
+ Tcl_Preserve(clientData);
+
+ /*
+ * Revoke the ROT registration.
+ */
+
+ RevokeObjectRegistration(riPtr);
+
+ /*
+ * Release the registration object.
+ */
+
+ riPtr->obj->lpVtbl->Release(riPtr->obj);
+ riPtr->obj = NULL;
+
+ Tcl_DeleteAssocData(riPtr->interp, "tkWinSend::ri");
+
+ /*
+ * Unlock the package data structure.
+ */
+
+ Tcl_Release(clientData);
+
+ ckfree(clientData);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * RevokeObjectRegistration --
+ *
+ * Releases the interpreters registration object from the Running Object
+ * Table.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The stored cookie value is zeroed and the name is free'd and the
+ * pointer set to NULL.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RevokeObjectRegistration(
+ RegisteredInterp *riPtr)
+{
+ LPRUNNINGOBJECTTABLE pROT = NULL;
+ HRESULT hr = S_OK;
+
+ if (riPtr->cookie != 0) {
+ hr = GetRunningObjectTable(0, &pROT);
+ if (SUCCEEDED(hr)) {
+ hr = pROT->lpVtbl->Revoke(pROT, riPtr->cookie);
+ pROT->lpVtbl->Release(pROT);
+ riPtr->cookie = 0;
+ }
+ }
+
+ /*
+ * Release the name storage.
+ */
+
+ if (riPtr->name != NULL) {
+ free(riPtr->name);
+ riPtr->name = NULL;
+ }
+}
+#endif
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * InterpDeleteProc --
+ *
+ * This is called when the interpreter is deleted and used to unregister
+ * the COM libraries.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
+static void
+InterpDeleteProc(
+ ClientData clientData,
+ Tcl_Interp *interp)
+{
+ CoUninitialize();
+}
+#endif
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * BuildMoniker --
+ *
+ * Construct a moniker from the given name. This ensures that all our
+ * monikers have the same prefix.
+ *
+ * Results:
+ * S_OK. If the name cannot be turned into a moniker then a COM error
+ * code is returned.
+ *
+ * Side effects:
+ * The moniker created is stored at the address given by ppmk.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static HRESULT
+BuildMoniker(
+ const char *name,
+ LPMONIKER *ppmk)
+{
+ LPMONIKER pmkClass = NULL;
+ HRESULT hr = CreateFileMoniker(TKWINSEND_REGISTRATION_BASE, &pmkClass);
+
+ if (SUCCEEDED(hr)) {
+ LPMONIKER pmkItem = NULL;
+ Tcl_DString dString;
+
+ Tcl_DStringInit(&dString);
+ Tcl_UtfToUniCharDString(name, -1, &dString);
+ hr = CreateFileMoniker((LPOLESTR)Tcl_DStringValue(&dString), &pmkItem);
+ Tcl_DStringFree(&dString);
+ if (SUCCEEDED(hr)) {
+ hr = pmkClass->lpVtbl->ComposeWith(pmkClass, pmkItem, FALSE, ppmk);
+ pmkItem->lpVtbl->Release(pmkItem);
+ }
+ pmkClass->lpVtbl->Release(pmkClass);
+ }
+ return hr;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * RegisterInterp --
+ *
+ * Attempts to register the provided name for this interpreter. If the
+ * given name is already in use, then a numeric suffix is appended as
+ * " #n" until we identify a unique name.
+ *
+ * Results:
+ * Returns S_OK if successful, else a COM error code.
+ *
+ * Side effects:
+ * Registration returns a cookie value which is stored. We also store a
+ * copy of the name.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
+static HRESULT
+RegisterInterp(
+ const char *name,
+ RegisteredInterp *riPtr)
+{
+ HRESULT hr = S_OK;
+ LPRUNNINGOBJECTTABLE pROT = NULL;
+ LPMONIKER pmk = NULL;
+ int i, offset;
+ const char *actualName = name;
+ Tcl_DString dString;
+ Tcl_DStringInit(&dString);
+
+ hr = GetRunningObjectTable(0, &pROT);
+ if (SUCCEEDED(hr)) {
+ offset = 0;
+ for (i = 1; SUCCEEDED(hr); i++) {
+ if (i > 1) {
+ if (i == 2) {
+ Tcl_DStringInit(&dString);
+ Tcl_DStringAppend(&dString, name, -1);
+ Tcl_DStringAppend(&dString, " #", 2);
+ offset = Tcl_DStringLength(&dString);
+ Tcl_DStringSetLength(&dString, offset+TCL_INTEGER_SPACE);
+ actualName = Tcl_DStringValue(&dString);
+ }
+ sprintf(Tcl_DStringValue(&dString) + offset, "%d", i);
+ }
+
+ hr = BuildMoniker(actualName, &pmk);
+ if (SUCCEEDED(hr)) {
+
+ hr = pROT->lpVtbl->Register(pROT,
+ ROTFLAGS_REGISTRATIONKEEPSALIVE,
+ riPtr->obj, pmk, &riPtr->cookie);
+
+ pmk->lpVtbl->Release(pmk);
+ }
+
+ if (hr == MK_S_MONIKERALREADYREGISTERED) {
+ pROT->lpVtbl->Revoke(pROT, riPtr->cookie);
+ } else if (hr == S_OK) {
+ break;
+ }
+ }
+
+ pROT->lpVtbl->Release(pROT);
+ }
+
+ if (SUCCEEDED(hr)) {
+ riPtr->name = strdup(actualName);
+ }
+
+ Tcl_DStringFree(&dString);
+ return hr;
}
+#endif
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * Send --
+ *
+ * Perform an interface call to the server object. We convert the Tcl
+ * arguments into a BSTR using 'concat'. The result should be a BSTR that
+ * we can set as the interp's result string.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static int
+Send(
+ LPDISPATCH pdispInterp, /* Pointer to the remote interp's COM
+ * object. */
+ Tcl_Interp *interp, /* The local interpreter. */
+ int async, /* Flag for the calling style. */
+ ClientData clientData, /* The RegisteredInterp structure for this
+ * interp. */
+ int objc, /* Number of arguments to be sent. */
+ Tcl_Obj *const objv[]) /* The arguments to be sent. */
+{
+ VARIANT vCmd, vResult;
+ DISPPARAMS dp;
+ EXCEPINFO ei;
+ UINT uiErr = 0;
+ HRESULT hr = S_OK, ehr = S_OK;
+ Tcl_Obj *cmd = NULL;
+ DISPID dispid;
+
+ cmd = Tcl_ConcatObj(objc, objv);
+
+ /*
+ * Setup the arguments for the COM method call.
+ */
+
+ VariantInit(&vCmd);
+ VariantInit(&vResult);
+ memset(&dp, 0, sizeof(dp));
+ memset(&ei, 0, sizeof(ei));
+
+ vCmd.vt = VT_BSTR;
+ vCmd.bstrVal = SysAllocString(Tcl_GetUnicode(cmd));
+
+ dp.cArgs = 1;
+ dp.rgvarg = &vCmd;
+
+ /*
+ * Select the method to use based upon the async flag and call the method.
+ */
+
+ dispid = async ? TKWINSENDCOM_DISPID_ASYNC : TKWINSENDCOM_DISPID_SEND;
+
+ hr = pdispInterp->lpVtbl->Invoke(pdispInterp, dispid,
+ &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD,
+ &dp, &vResult, &ei, &uiErr);
+
+ /*
+ * Convert the result into a string and place in the interps result.
+ */
+
+ ehr = VariantChangeType(&vResult, &vResult, 0, VT_BSTR);
+ if (SUCCEEDED(ehr)) {
+ Tcl_SetObjResult(interp, Tcl_NewUnicodeObj(vResult.bstrVal, -1));
+ }
+
+ /*
+ * Errors are returned as dispatch exceptions. If an error code was
+ * returned then we decode the exception and setup the Tcl error
+ * variables.
+ */
+
+ if (hr == DISP_E_EXCEPTION) {
+ Tcl_Obj *opError, *opErrorCode, *opErrorInfo;
+
+ if (ei.bstrSource != NULL) {
+ int len;
+ char *szErrorInfo;
+
+ opError = Tcl_NewUnicodeObj(ei.bstrSource, -1);
+ Tcl_ListObjIndex(interp, opError, 0, &opErrorCode);
+ Tcl_SetObjErrorCode(interp, opErrorCode);
+
+ Tcl_ListObjIndex(interp, opError, 1, &opErrorInfo);
+ szErrorInfo = Tcl_GetStringFromObj(opErrorInfo, &len);
+ Tcl_AddObjErrorInfo(interp, szErrorInfo, len);
+ }
+ }
+
+ /*
+ * Clean up any COM allocated resources.
+ */
+
+ SysFreeString(ei.bstrDescription);
+ SysFreeString(ei.bstrSource);
+ SysFreeString(ei.bstrHelpFile);
+ VariantClear(&vCmd);
+
+ return (SUCCEEDED(hr) ? TCL_OK : TCL_ERROR);
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * Win32ErrorObj --
+ *
+ * Returns a string object containing text from a COM or Win32 error code
+ *
+ * Results:
+ * A Tcl_Obj containing the Win32 error message.
+ *
+ * Side effects:
+ * Removed the error message from the COM threads error object.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static Tcl_Obj*
+Win32ErrorObj(
+ HRESULT hrError)
+{
+ LPTSTR lpBuffer = NULL, p = NULL;
+ TCHAR sBuffer[30];
+ Tcl_Obj* errPtr = NULL;
+
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, (DWORD)hrError, LANG_NEUTRAL,
+ (LPTSTR)&lpBuffer, 0, NULL);
+
+ if (lpBuffer == NULL) {
+ lpBuffer = sBuffer;
+ wsprintf(sBuffer, TEXT("Error Code: %08lX"), hrError);
+ }
+
+ if ((p = _tcsrchr(lpBuffer, TEXT('\r'))) != NULL) {
+ *p = TEXT('\0');
+ }
+
+#ifdef _UNICODE
+ errPtr = Tcl_NewUnicodeObj(lpBuffer, (int)wcslen(lpBuffer));
+#else
+ errPtr = Tcl_NewStringObj(lpBuffer, (int)strlen(lpBuffer));
+#endif
+
+ if (lpBuffer != sBuffer) {
+ LocalFree((HLOCAL)lpBuffer);
+ }
+
+ return errPtr;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * SetErrorInfo --
+ *
+ * Convert the error information from a Tcl interpreter into a COM
+ * exception structure. This information is then registered with the COM
+ * thread exception object so that it can be used for rich error
+ * reporting by COM clients.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The current COM thread has its error object modified.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+void
+SetExcepInfo(
+ Tcl_Interp* interp,
+ EXCEPINFO *pExcepInfo)
+{
+ if (pExcepInfo) {
+ Tcl_Obj *opError, *opErrorInfo, *opErrorCode;
+ ICreateErrorInfo *pCEI;
+ IErrorInfo *pEI, **ppEI = &pEI;
+ HRESULT hr;
+
+ opError = Tcl_GetObjResult(interp);
+ opErrorInfo = Tcl_GetVar2Ex(interp, "errorInfo",NULL, TCL_GLOBAL_ONLY);
+ opErrorCode = Tcl_GetVar2Ex(interp, "errorCode",NULL, TCL_GLOBAL_ONLY);
+
+ if (Tcl_IsShared(opErrorCode)) {
+ Tcl_Obj *ec = Tcl_DuplicateObj(opErrorCode);
+
+ Tcl_IncrRefCount(ec);
+ Tcl_DecrRefCount(opErrorCode);
+ opErrorCode = ec;
+ }
+ Tcl_ListObjAppendElement(interp, opErrorCode, opErrorInfo);
+
+ pExcepInfo->bstrDescription = SysAllocString(Tcl_GetUnicode(opError));
+ pExcepInfo->bstrSource = SysAllocString(Tcl_GetUnicode(opErrorCode));
+ pExcepInfo->scode = E_FAIL;
+
+ hr = CreateErrorInfo(&pCEI);
+ if (SUCCEEDED(hr)) {
+ hr = pCEI->lpVtbl->SetGUID(pCEI, &IID_IDispatch);
+ hr = pCEI->lpVtbl->SetDescription(pCEI,
+ pExcepInfo->bstrDescription);
+ hr = pCEI->lpVtbl->SetSource(pCEI, pExcepInfo->bstrSource);
+ hr = pCEI->lpVtbl->QueryInterface(pCEI, &IID_IErrorInfo,
+ (void**) ppEI);
+ if (SUCCEEDED(hr)) {
+ SetErrorInfo(0, pEI);
+ pEI->lpVtbl->Release(pEI);
+ }
+ pCEI->lpVtbl->Release(pCEI);
+ }
+ }
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * TkWinSend_QueueCommand --
+ *
+ * Queue a script for asynchronous evaluation. This is called from the
+ * COM objects Async method.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+int
+TkWinSend_QueueCommand(
+ Tcl_Interp *interp,
+ Tcl_Obj *cmdPtr)
+{
+ SendEvent *evPtr;
+
+ TRACE("SendQueueCommand()\n");
+
+ evPtr = (SendEvent *)ckalloc(sizeof(SendEvent));
+ evPtr->header.proc = SendEventProc;
+ evPtr->header.nextPtr = NULL;
+ evPtr->interp = interp;
+ Tcl_Preserve(evPtr->interp);
+
+ if (Tcl_IsShared(cmdPtr)) {
+ evPtr->cmdPtr = Tcl_DuplicateObj(cmdPtr);
+ } else {
+ evPtr->cmdPtr = cmdPtr;
+ Tcl_IncrRefCount(evPtr->cmdPtr);
+ }
+
+ Tcl_QueueEvent((Tcl_Event *)evPtr, TCL_QUEUE_TAIL);
+
+ return 0;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * SendEventProc --
+ *
+ * Handle a request for an asynchronous send. Nothing is returned to the
+ * caller so the result is discarded.
+ *
+ * Results:
+ * Returns 1 if the event was handled or 0 to indicate it has been
+ * deferred.
+ *
+ * Side effects:
+ * The target interpreter's result will be modified.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static int
+SendEventProc(
+ Tcl_Event *eventPtr,
+ int flags)
+{
+ SendEvent *evPtr = (SendEvent *)eventPtr;
+
+ TRACE("SendEventProc\n");
+
+ Tcl_EvalObjEx(evPtr->interp, evPtr->cmdPtr,
+ TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL);
+
+ Tcl_DecrRefCount(evPtr->cmdPtr);
+ Tcl_Release(evPtr->interp);
+
+ return 1; /* 1 to indicate the event has been handled */
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * SendTrace --
+ *
+ * Provide trace information to the Windows debug stream. To use this -
+ * use the TRACE macro, which compiles to nothing when DEBUG is not
+ * defined.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static void
+SendTrace(
+ const char *format, ...)
+{
+ va_list args;
+ static char buffer[1024];
+
+ va_start(args, format);
+ vsnprintf(buffer, 1023, format, args);
+ OutputDebugString(buffer);
+ va_end(args);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c
new file mode 100644
index 0000000..3bbdd63
--- /dev/null
+++ b/win/tkWinSendCom.c
@@ -0,0 +1,462 @@
+/*
+ * tkWinSendCom.c --
+ *
+ * This file provides support functions that implement the Windows "send"
+ * command using COM interfaces, allowing commands to be passed from
+ * interpreter to interpreter. See also tkWinSend.c, where most of the
+ * interesting functions are.
+ *
+ * We implement a COM class for use in registering Tcl interpreters with the
+ * system's Running Object Table. This class implements an IDispatch interface
+ * with the following method:
+ * Send(String cmd) As String
+ * In other words the Send methods takes a string and evaluates this in the
+ * Tcl interpreter. The result is returned as another string.
+ *
+ * Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkInt.h"
+#include "tkWinSendCom.h"
+
+/*
+ * ----------------------------------------------------------------------
+ * Non-public prototypes.
+ *
+ * These are the interface methods for IUnknown, IDispatch and
+ * ISupportErrorInfo.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static void TkWinSendCom_Destroy(LPDISPATCH pdisp);
+
+static STDMETHODIMP WinSendCom_QueryInterface(IDispatch *This,
+ REFIID riid, void **ppvObject);
+static STDMETHODIMP_(ULONG) WinSendCom_AddRef(IDispatch *This);
+static STDMETHODIMP_(ULONG) WinSendCom_Release(IDispatch *This);
+static STDMETHODIMP WinSendCom_GetTypeInfoCount(IDispatch *This,
+ UINT *pctinfo);
+static STDMETHODIMP WinSendCom_GetTypeInfo(IDispatch *This, UINT iTInfo,
+ LCID lcid, ITypeInfo **ppTI);
+static STDMETHODIMP WinSendCom_GetIDsOfNames(IDispatch *This, REFIID riid,
+ LPOLESTR *rgszNames, UINT cNames, LCID lcid,
+ DISPID *rgDispId);
+static STDMETHODIMP WinSendCom_Invoke(IDispatch *This, DISPID dispidMember,
+ REFIID riid, LCID lcid, WORD wFlags,
+ DISPPARAMS *pDispParams, VARIANT *pvarResult,
+ EXCEPINFO *pExcepInfo, UINT *puArgErr);
+static STDMETHODIMP ISupportErrorInfo_QueryInterface(
+ ISupportErrorInfo *This, REFIID riid,
+ void **ppvObject);
+static STDMETHODIMP_(ULONG) ISupportErrorInfo_AddRef(
+ ISupportErrorInfo *This);
+static STDMETHODIMP_(ULONG) ISupportErrorInfo_Release(
+ ISupportErrorInfo *This);
+static STDMETHODIMP ISupportErrorInfo_InterfaceSupportsErrorInfo(
+ ISupportErrorInfo *This, REFIID riid);
+static HRESULT Send(TkWinSendCom *obj, VARIANT vCmd,
+ VARIANT *pvResult, EXCEPINFO *pExcepInfo,
+ UINT *puArgErr);
+static HRESULT Async(TkWinSendCom *obj, VARIANT Cmd,
+ EXCEPINFO *pExcepInfo, UINT *puArgErr);
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * CreateInstance --
+ *
+ * Create and initialises a new instance of the WinSend COM class and
+ * returns an interface pointer for you to use.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+HRESULT
+TkWinSendCom_CreateInstance(
+ Tcl_Interp *interp,
+ REFIID riid,
+ void **ppv)
+{
+ /*
+ * Construct v-tables for each interface.
+ */
+
+ static IDispatchVtbl vtbl = {
+ WinSendCom_QueryInterface,
+ WinSendCom_AddRef,
+ WinSendCom_Release,
+ WinSendCom_GetTypeInfoCount,
+ WinSendCom_GetTypeInfo,
+ WinSendCom_GetIDsOfNames,
+ WinSendCom_Invoke,
+ };
+ static ISupportErrorInfoVtbl vtbl2 = {
+ ISupportErrorInfo_QueryInterface,
+ ISupportErrorInfo_AddRef,
+ ISupportErrorInfo_Release,
+ ISupportErrorInfo_InterfaceSupportsErrorInfo,
+ };
+ HRESULT hr = S_OK;
+ TkWinSendCom *obj = NULL;
+
+ /*
+ * This had probably better always be globally visible memory so we shall
+ * use the COM Task allocator.
+ */
+
+ obj = (TkWinSendCom *) CoTaskMemAlloc(sizeof(TkWinSendCom));
+ if (obj == NULL) {
+ *ppv = NULL;
+ hr = E_OUTOFMEMORY;
+ } else {
+ obj->lpVtbl = &vtbl;
+ obj->lpVtbl2 = &vtbl2;
+ obj->refcount = 0;
+ obj->interp = interp;
+
+ /*
+ * lock the interp? Tcl_AddRef/Retain?
+ */
+
+ hr = obj->lpVtbl->QueryInterface((IDispatch*)obj, riid, ppv);
+ }
+
+ return hr;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * TkWinSendCom_Destroy --
+ *
+ * This helper function is the destructor for our COM class.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Releases the storage allocated for this object.
+ *
+ * ----------------------------------------------------------------------
+ */
+static void
+TkWinSendCom_Destroy(
+ LPDISPATCH pdisp)
+{
+ CoTaskMemFree((void*)pdisp);
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * IDispatch --
+ *
+ * The IDispatch interface implements the 'late-binding' COM methods
+ * typically used by scripting COM clients. The Invoke method is the most
+ * important one.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static STDMETHODIMP
+WinSendCom_QueryInterface(
+ IDispatch *This,
+ REFIID riid,
+ void **ppvObject)
+{
+ HRESULT hr = E_NOINTERFACE;
+ TkWinSendCom *this = (TkWinSendCom*)This;
+ *ppvObject = NULL;
+
+ if (memcmp(riid, &IID_IUnknown, sizeof(IID)) == 0
+ || memcmp(riid, &IID_IDispatch, sizeof(IID)) == 0) {
+ *ppvObject = (void**)this;
+ this->lpVtbl->AddRef(This);
+ hr = S_OK;
+ } else if (memcmp(riid, &IID_ISupportErrorInfo, sizeof(IID)) == 0) {
+ *ppvObject = (void**)(this + 1);
+ this->lpVtbl2->AddRef((ISupportErrorInfo*)(this + 1));
+ hr = S_OK;
+ }
+ return hr;
+}
+
+static STDMETHODIMP_(ULONG)
+WinSendCom_AddRef(
+ IDispatch *This)
+{
+ TkWinSendCom *this = (TkWinSendCom*)This;
+
+ return InterlockedIncrement(&this->refcount);
+}
+
+static STDMETHODIMP_(ULONG)
+WinSendCom_Release(
+ IDispatch *This)
+{
+ long r = 0;
+ TkWinSendCom *this = (TkWinSendCom*)This;
+
+ if ((r = InterlockedDecrement(&this->refcount)) == 0) {
+ TkWinSendCom_Destroy(This);
+ }
+ return r;
+}
+
+static STDMETHODIMP
+WinSendCom_GetTypeInfoCount(
+ IDispatch *This,
+ UINT *pctinfo)
+{
+ HRESULT hr = E_POINTER;
+
+ if (pctinfo != NULL) {
+ *pctinfo = 0;
+ hr = S_OK;
+ }
+ return hr;
+}
+
+static STDMETHODIMP
+WinSendCom_GetTypeInfo(
+ IDispatch *This,
+ UINT iTInfo,
+ LCID lcid,
+ ITypeInfo **ppTI)
+{
+ HRESULT hr = E_POINTER;
+
+ if (ppTI) {
+ *ppTI = NULL;
+ hr = E_NOTIMPL;
+ }
+ return hr;
+}
+
+static STDMETHODIMP
+WinSendCom_GetIDsOfNames(
+ IDispatch *This,
+ REFIID riid,
+ LPOLESTR *rgszNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID *rgDispId)
+{
+ HRESULT hr = E_POINTER;
+
+ if (rgDispId) {
+ hr = DISP_E_UNKNOWNNAME;
+ if (_wcsicmp(*rgszNames, L"Send") == 0) {
+ *rgDispId = TKWINSENDCOM_DISPID_SEND, hr = S_OK;
+ } else if (_wcsicmp(*rgszNames, L"Async") == 0) {
+ *rgDispId = TKWINSENDCOM_DISPID_ASYNC, hr = S_OK;
+ }
+ }
+ return hr;
+}
+
+static STDMETHODIMP
+WinSendCom_Invoke(
+ IDispatch *This,
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS *pDispParams,
+ VARIANT *pvarResult,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ HRESULT hr = DISP_E_MEMBERNOTFOUND;
+ TkWinSendCom *this = (TkWinSendCom*)This;
+
+ switch (dispidMember) {
+ case TKWINSENDCOM_DISPID_SEND:
+ if (wFlags | DISPATCH_METHOD) {
+ if (pDispParams->cArgs != 1) {
+ hr = DISP_E_BADPARAMCOUNT;
+ } else {
+ hr = Send(this, pDispParams->rgvarg[0], pvarResult,
+ pExcepInfo, puArgErr);
+ }
+ }
+ break;
+
+ case TKWINSENDCOM_DISPID_ASYNC:
+ if (wFlags | DISPATCH_METHOD) {
+ if (pDispParams->cArgs != 1) {
+ hr = DISP_E_BADPARAMCOUNT;
+ } else {
+ hr = Async(this, pDispParams->rgvarg[0], pExcepInfo, puArgErr);
+ }
+ }
+ break;
+ }
+ return hr;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * ISupportErrorInfo --
+ *
+ * This interface provides rich error information to COM clients. Used by
+ * VB and scripting COM clients.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static STDMETHODIMP
+ISupportErrorInfo_QueryInterface(
+ ISupportErrorInfo *This,
+ REFIID riid,
+ void **ppvObject)
+{
+ TkWinSendCom *this = (TkWinSendCom*)(This - 1);
+
+ return this->lpVtbl->QueryInterface((IDispatch*)this, riid, ppvObject);
+}
+
+static STDMETHODIMP_(ULONG)
+ISupportErrorInfo_AddRef(
+ ISupportErrorInfo *This)
+{
+ TkWinSendCom *this = (TkWinSendCom*)(This - 1);
+
+ return InterlockedIncrement(&this->refcount);
+}
+
+static STDMETHODIMP_(ULONG)
+ISupportErrorInfo_Release(
+ ISupportErrorInfo *This)
+{
+ TkWinSendCom *this = (TkWinSendCom*)(This - 1);
+
+ return this->lpVtbl->Release((IDispatch*)this);
+}
+
+static STDMETHODIMP
+ISupportErrorInfo_InterfaceSupportsErrorInfo(
+ ISupportErrorInfo *This,
+ REFIID riid)
+{
+ /*TkWinSendCom *this = (TkWinSendCom*)(This - 1);*/
+ return S_OK; /* or S_FALSE */
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * Async --
+ *
+ * Queues the command for evaluation in the assigned interpreter.
+ *
+ * Results:
+ * A standard COM HRESULT is returned. The Tcl result is discarded.
+ *
+ * Side effects:
+ * The interpreters state and result will be modified.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static HRESULT
+Async(
+ TkWinSendCom *obj,
+ VARIANT Cmd,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ HRESULT hr = S_OK;
+ VARIANT vCmd;
+
+ VariantInit(&vCmd);
+
+ hr = VariantChangeType(&vCmd, &Cmd, 0, VT_BSTR);
+ if (FAILED(hr)) {
+ Tcl_SetStringObj(Tcl_GetObjResult(obj->interp),
+ "invalid args: Async(command)", -1);
+ SetExcepInfo(obj->interp, pExcepInfo);
+ hr = DISP_E_EXCEPTION;
+ }
+
+ if (SUCCEEDED(hr)) {
+ if (obj->interp) {
+ Tcl_Obj *scriptPtr = Tcl_NewUnicodeObj(vCmd.bstrVal,
+ (int)SysStringLen(vCmd.bstrVal));
+ TkWinSend_QueueCommand(obj->interp, scriptPtr);
+ }
+ }
+
+ VariantClear(&vCmd);
+
+ return hr;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * Send --
+ *
+ * Evaluates the string in the assigned interpreter. If the result is a
+ * valid address then set it to the result returned by the evaluation.
+ * Tcl exceptions are converted into COM exceptions.
+ *
+ * Results:
+ * A standard COM HRESULT is returned. The Tcl result is set as the
+ * method calls result.
+ *
+ * Side effects:
+ * The interpreters state and result will be modified.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static HRESULT
+Send(
+ TkWinSendCom *obj,
+ VARIANT vCmd,
+ VARIANT *pvResult,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ HRESULT hr = S_OK;
+ int result = TCL_OK;
+ VARIANT v;
+
+ VariantInit(&v);
+ hr = VariantChangeType(&v, &vCmd, 0, VT_BSTR);
+ if (SUCCEEDED(hr)) {
+ if (obj->interp) {
+ Tcl_Obj *scriptPtr = Tcl_NewUnicodeObj(v.bstrVal,
+ (int)SysStringLen(v.bstrVal));
+
+ result = Tcl_EvalObjEx(obj->interp, scriptPtr,
+ TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL);
+ if (pvResult) {
+ VariantInit(pvResult);
+ pvResult->vt = VT_BSTR;
+ pvResult->bstrVal = SysAllocString(
+ Tcl_GetUnicode(Tcl_GetObjResult(obj->interp)));
+ }
+ if (result == TCL_ERROR) {
+ hr = DISP_E_EXCEPTION;
+ SetExcepInfo(obj->interp, pExcepInfo);
+ }
+ }
+ VariantClear(&v);
+ }
+ return hr;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinSendCom.h b/win/tkWinSendCom.h
new file mode 100644
index 0000000..4928bc7
--- /dev/null
+++ b/win/tkWinSendCom.h
@@ -0,0 +1,61 @@
+/*
+ * tkWinSendCom.h --
+ *
+ * This file provides procedures that implement the Windows "send"
+ * command, allowing commands to be passed from interpreter to
+ * interpreter.
+ *
+ * Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#ifndef _tkWinSendCom_h_INCLUDE
+#define _tkWinSendCom_h_INCLUDE
+
+#include "tkWinInt.h"
+#include <ole2.h>
+
+#ifdef _MSC_VER
+# pragma comment (lib, "ole32.lib")
+# pragma comment (lib, "oleaut32.lib")
+# pragma comment (lib, "uuid.lib")
+#endif
+
+/*
+ * TkWinSendCom CoClass structure
+ */
+
+typedef struct {
+ IDispatchVtbl *lpVtbl;
+ ISupportErrorInfoVtbl *lpVtbl2;
+ long refcount;
+ Tcl_Interp *interp;
+} TkWinSendCom;
+
+/*
+ * TkWinSendCom Dispatch IDs
+ */
+
+#define TKWINSENDCOM_DISPID_SEND 1
+#define TKWINSENDCOM_DISPID_ASYNC 2
+
+/*
+ * TkWinSendCom public functions
+ */
+
+HRESULT TkWinSendCom_CreateInstance(Tcl_Interp *interp,
+ REFIID riid, void **ppv);
+int TkWinSend_QueueCommand(Tcl_Interp *interp,
+ Tcl_Obj *cmdPtr);
+void SetExcepInfo(Tcl_Interp *interp,
+ EXCEPINFO *pExcepInfo);
+
+#endif /* _tkWinSendCom_h_INCLUDE */
+
+/*
+ * Local Variables:
+ * mode: c
+ * End:
+ */
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index bad3df3..d361ad7 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -1,40 +1,49 @@
-/*
+/*
* tkWinTest.c --
*
- * Contains commands for platform specific tests for
- * the Windows platform.
+ * Contains commands for platform specific tests for the Windows
+ * platform.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
* Copyright (c) 2000 by Scriptics Corporation.
* Copyright (c) 2001 by ActiveState Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
HWND tkWinCurrentDialog;
-
+
/*
- * Forward declarations of procedures defined later in this file:
+ * Forward declarations of functions defined later in this file:
*/
-int TkplatformtestInit(Tcl_Interp *interp);
static int TestclipboardObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[]);
-static int TestwineventCmd(ClientData clientData,
+static int TestwineventCmd(ClientData clientData,
Tcl_Interp *interp, int argc, CONST char **argv);
-
+static int TestfindwindowObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int TestgetwindowinfoObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int TestwinlocaleObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
+
/*
*----------------------------------------------------------------------
*
* TkplatformtestInit --
*
- * Defines commands that test platform specific functionality for
- * Unix platforms.
+ * Defines commands that test platform specific functionality for Windows
+ * platforms.
*
* Results:
* A standard Tcl result.
@@ -52,12 +61,17 @@ TkplatformtestInit(
/*
* Add commands for platform specific tests on MacOS here.
*/
-
+
Tcl_CreateObjCommand(interp, "testclipboard", TestclipboardObjCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, "testwinevent", TestwineventCmd,
- (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
-
+ (ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateObjCommand(interp, "testfindwindow", TestfindwindowObjCmd,
+ (ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateObjCommand(interp, "testgetwindowinfo", TestgetwindowinfoObjCmd,
+ (ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateObjCommand(interp, "testwinlocale", TestwinlocaleObjCmd,
+ (ClientData) Tk_MainWindow(interp), NULL);
return TCL_OK;
}
@@ -66,8 +80,8 @@ TkplatformtestInit(
*
* AppendSystemError --
*
- * This routine formats a Windows system error message and places
- * it into the interpreter result. Originally from tclWinReg.c.
+ * This routine formats a Windows system error message and places it into
+ * the interpreter result. Originally from tclWinReg.c.
*
* Results:
* None.
@@ -84,7 +98,7 @@ AppendSystemError(
DWORD error) /* Result code from error. */
{
int length;
- WCHAR *wMsgPtr;
+ WCHAR *wMsgPtr, **wMsgPtrPtr = &wMsgPtr;
char *msg;
char id[TCL_INTEGER_SPACE], msgBuf[24 + TCL_INTEGER_SPACE];
Tcl_DString ds;
@@ -92,7 +106,7 @@ AppendSystemError(
length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) &wMsgPtr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) wMsgPtrPtr,
0, NULL);
if (length == 0) {
char *msgPtr;
@@ -128,6 +142,7 @@ AppendSystemError(
/*
* Trim the trailing CR/LF from the system message.
*/
+
if (msg[length-1] == '\n') {
msg[--length] = 0;
}
@@ -137,7 +152,7 @@ AppendSystemError(
}
sprintf(id, "%ld", error);
- Tcl_SetErrorCode(interp, "WINDOWS", id, msg, (char *) NULL);
+ Tcl_SetErrorCode(interp, "WINDOWS", id, msg, NULL);
Tcl_AppendToObj(resultPtr, msg, length);
if (length != 0) {
@@ -150,8 +165,8 @@ AppendSystemError(
*
* TestclipboardObjCmd --
*
- * This procedure implements the testclipboard command. It provides
- * a way to determine the actual contents of the Windows clipboard.
+ * This function implements the testclipboard command. It provides a way
+ * to determine the actual contents of the Windows clipboard.
*
* Results:
* A standard Tcl result.
@@ -163,40 +178,40 @@ AppendSystemError(
*/
static int
-TestclipboardObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+TestclipboardObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument values. */
{
HGLOBAL handle;
char *data;
int code = TCL_OK;
if (objc != 1) {
- Tcl_WrongNumArgs(interp, 1, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
if (OpenClipboard(NULL)) {
/*
- * We could consider using CF_UNICODETEXT on NT, but then we
- * would have to convert it from External. Instead we'll just
- * take this and do "bytestring" at the Tcl level for Unicode
- * inclusive text
+ * We could consider using CF_UNICODETEXT on NT, but then we would
+ * have to convert it from External. Instead we'll just take this and
+ * do "bytestring" at the Tcl level for Unicode inclusive text
*/
+
handle = GetClipboardData(CF_TEXT);
if (handle != NULL) {
data = GlobalLock(handle);
- Tcl_AppendResult(interp, data, (char *) NULL);
+ Tcl_AppendResult(interp, data, NULL);
GlobalUnlock(handle);
} else {
- Tcl_AppendResult(interp, "null clipboard handle", (char *) NULL);
+ Tcl_AppendResult(interp, "null clipboard handle", NULL);
code = TCL_ERROR;
}
CloseClipboard();
return code;
} else {
- Tcl_AppendResult(interp, "couldn't open clipboard: ", (char *) NULL);
+ Tcl_AppendResult(interp, "couldn't open clipboard: ", NULL);
AppendSystemError(interp, GetLastError());
return TCL_ERROR;
}
@@ -208,8 +223,8 @@ TestclipboardObjCmd(clientData, interp, objc, objv)
*
* TestwineventCmd --
*
- * This procedure implements the testwinevent command. It provides
- * a way to send messages to windows dialogs.
+ * This function implements the testwinevent command. It provides a way
+ * to send messages to windows dialogs.
*
* Results:
* A standard Tcl result.
@@ -221,24 +236,26 @@ TestclipboardObjCmd(clientData, interp, objc, objv)
*/
static int
-TestwineventCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestwineventCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
HWND hwnd = 0;
+ HWND child = 0;
int id;
char *rest;
UINT message;
WPARAM wParam;
LPARAM lParam;
- static TkStateMap messageMap[] = {
+ static const TkStateMap messageMap[] = {
{WM_LBUTTONDOWN, "WM_LBUTTONDOWN"},
{WM_LBUTTONUP, "WM_LBUTTONUP"},
{WM_CHAR, "WM_CHAR"},
{WM_GETTEXT, "WM_GETTEXT"},
{WM_SETTEXT, "WM_SETTEXT"},
+ {WM_COMMAND, "WM_COMMAND"},
{-1, NULL}
};
@@ -256,17 +273,7 @@ TestwineventCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
-#if 0
- TkpScanWindowId(interp, argv[1], &id);
- if (
-#ifdef _WIN64
- (sscanf(string, "0x%p", &number) != 1) &&
-#endif
- Tcl_GetInt(interp, string, (int *)&number) != TCL_OK) {
- return TCL_ERROR;
- }
-#endif
- hwnd = (HWND) strtol(argv[1], &rest, 0);
+ hwnd = (HWND) INT2PTR(strtol(argv[1], &rest, 0));
if (rest == argv[1]) {
hwnd = FindWindow(NULL, argv[1]);
if (hwnd == NULL) {
@@ -278,7 +285,6 @@ TestwineventCmd(clientData, interp, argc, argv)
id = strtol(argv[2], &rest, 0);
if (rest == argv[2]) {
- HWND child;
char buf[256];
child = GetWindow(hwnd, GW_CHILD);
@@ -291,13 +297,12 @@ TestwineventCmd(clientData, interp, argc, argv)
child = GetWindow(child, GW_HWNDNEXT);
}
if (child == NULL) {
+ Tcl_AppendResult(interp, "could not find a control matching \"",
+ argv[2], "\"", NULL);
return TCL_ERROR;
}
}
message = TkFindStateNum(NULL, NULL, messageMap, argv[3]);
- if (message < 0) {
- message = strtol(argv[3], NULL, 0);
- }
wParam = 0;
lParam = 0;
@@ -309,35 +314,179 @@ TestwineventCmd(clientData, interp, argc, argv)
}
switch (message) {
- case WM_GETTEXT: {
- Tcl_DString ds;
- char buf[256];
-
- GetDlgItemText(hwnd, id, buf, 256);
- Tcl_ExternalToUtfDString(NULL, buf, -1, &ds);
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
- Tcl_DStringFree(&ds);
- break;
- }
- case WM_SETTEXT: {
- Tcl_DString ds;
+ case WM_GETTEXT: {
+ Tcl_DString ds;
+ char buf[256];
- Tcl_UtfToExternalDString(NULL, argv[4], -1, &ds);
- SetDlgItemText(hwnd, id, Tcl_DStringValue(&ds));
- Tcl_DStringFree(&ds);
- break;
- }
- default: {
- char buf[TCL_INTEGER_SPACE];
-
- sprintf(buf, "%d",
- (int) SendDlgItemMessage(hwnd, id, message, wParam, lParam));
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- break;
+ GetDlgItemText(hwnd, id, buf, 256);
+ Tcl_ExternalToUtfDString(NULL, buf, -1, &ds);
+ Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
+ Tcl_DStringFree(&ds);
+ break;
+ }
+ case WM_SETTEXT: {
+ Tcl_DString ds;
+
+ Tcl_UtfToExternalDString(NULL, argv[4], -1, &ds);
+ SetDlgItemText(hwnd, id, Tcl_DStringValue(&ds));
+ Tcl_DStringFree(&ds);
+ break;
+ }
+ case WM_COMMAND: {
+ char buf[TCL_INTEGER_SPACE];
+ if (argc < 5) {
+ wParam = MAKEWPARAM(id, 0);
+ lParam = (LPARAM)child;
}
+ sprintf(buf, "%d", (int) SendMessage(hwnd, message, wParam, lParam));
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ break;
+ }
+ default: {
+ char buf[TCL_INTEGER_SPACE];
+
+ sprintf(buf, "%d",
+ (int) SendDlgItemMessage(hwnd, id, message, wParam, lParam));
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ break;
+ }
}
return TCL_OK;
}
+
+/*
+ * testfindwindow title ?class?
+ * Find a Windows window using the FindWindow API call. This takes the window
+ * title and optionally the window class and if found returns the HWND and
+ * raises an error if the window is not found.
+ * eg: testfindwindow Console TkTopLevel
+ * Can find the console window if it is visible.
+ * eg: testfindwindow "TkTest #10201" "#32770"
+ * Can find a messagebox window with this title.
+ */
+
+static int
+TestfindwindowObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument values. */
+{
+ const char *title = NULL, *class = NULL;
+ HWND hwnd = NULL;
+ int r = TCL_OK;
+
+ if (objc < 2 || objc > 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "title ?class?");
+ return TCL_ERROR;
+ }
+ title = Tcl_GetString(objv[1]);
+ if (objc == 3)
+ class = Tcl_GetString(objv[2]);
+ hwnd = FindWindowA(class, title);
+
+ if (hwnd == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
+ AppendSystemError(interp, GetLastError());
+ r = TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));
+ }
+ return r;
+}
+
+static BOOL CALLBACK
+EnumChildrenProc(HWND hwnd, LPARAM lParam)
+{
+ Tcl_Obj *listObj = (Tcl_Obj *)lParam;
+ Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj(PTR2INT(hwnd)));
+ return TRUE;
+}
+
+static int
+TestgetwindowinfoObjCmd(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[])
+{
+ long hwnd;
+ Tcl_Obj *resObj = NULL, *classObj = NULL, *textObj = NULL;
+ Tcl_Obj *childrenObj = NULL;
+ char buf[512];
+ int cch, cchBuf = tkWinProcs->useWide ? 256 : 512;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "hwnd");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
+ return TCL_ERROR;
+
+ if (tkWinProcs->useWide) {
+ cch = GetClassNameW(INT2PTR(hwnd), (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR));
+ classObj = Tcl_NewUnicodeObj((LPWSTR)buf, cch);
+ } else {
+ cch = GetClassNameA(INT2PTR(hwnd), (LPSTR)buf, sizeof(buf));
+ classObj = Tcl_NewStringObj((LPSTR)buf, cch);
+ }
+ if (cch == 0) {
+ Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC);
+ AppendSystemError(interp, GetLastError());
+ return TCL_ERROR;
+ }
+ resObj = Tcl_NewListObj(0, NULL);
+ Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("class", -1));
+ Tcl_ListObjAppendElement(interp, resObj, classObj);
+ Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("id", -1));
+ Tcl_ListObjAppendElement(interp, resObj,
+ Tcl_NewLongObj(GetWindowLong(INT2PTR(hwnd), GWL_ID)));
+
+ cch = tkWinProcs->getWindowText(INT2PTR(hwnd), (LPTSTR)buf, cchBuf);
+ if (tkWinProcs->useWide) {
+ textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
+ } else {
+ textObj = Tcl_NewStringObj((LPCSTR)buf, cch);
+ }
+
+ Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("text", -1));
+ Tcl_ListObjAppendElement(interp, resObj, textObj);
+ Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("parent", -1));
+ Tcl_ListObjAppendElement(interp, resObj,
+ Tcl_NewLongObj(PTR2INT(GetParent(INT2PTR(hwnd)))));
+
+ childrenObj = Tcl_NewListObj(0, NULL);
+ EnumChildWindows(INT2PTR(hwnd), EnumChildrenProc, (LPARAM)childrenObj);
+ Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("children", -1));
+ Tcl_ListObjAppendElement(interp, resObj, childrenObj);
+
+ Tcl_SetObjResult(interp, resObj);
+ return TCL_OK;
+}
+
+static int
+TestwinlocaleObjCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument values. */
+{
+ if (objc != 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, NULL);
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewIntObj((int)GetSystemDefaultLCID()));
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index 8d76289..43ff0aa 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -1,59 +1,58 @@
-/*
+/*
* tkWinWindow.c --
*
- * Xlib emulation routines for Windows related to creating,
- * displaying and destroying windows.
+ * Xlib emulation routines for Windows related to creating, displaying
+ * and destroying windows.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
typedef struct ThreadSpecificData {
- int initialized; /* 0 means table below needs initializing. */
- Tcl_HashTable windowTable; /* The windowTable maps from HWND to
- * Tk_Window handles. */
+ int initialized; /* 0 means table below needs initializing. */
+ Tcl_HashTable windowTable; /* The windowTable maps from HWND to Tk_Window
+ * handles. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void NotifyVisibility _ANSI_ARGS_((XEvent *eventPtr,
- TkWindow *winPtr));
+static void NotifyVisibility(XEvent *eventPtr, TkWindow *winPtr);
/*
*----------------------------------------------------------------------
*
* Tk_AttachHWND --
*
- * This function binds an HWND and a reflection procedure to
- * the specified Tk_Window.
+ * This function binds an HWND and a reflection function to the specified
+ * Tk_Window.
*
* Results:
* Returns an X Window that encapsulates the HWND.
*
* Side effects:
- * May allocate a new X Window. Also enters the HWND into the
- * global window table.
+ * May allocate a new X Window. Also enters the HWND into the global
+ * window table.
*
*----------------------------------------------------------------------
*/
Window
-Tk_AttachHWND(tkwin, hwnd)
- Tk_Window tkwin;
- HWND hwnd;
+Tk_AttachHWND(
+ Tk_Window tkwin,
+ HWND hwnd)
{
int new;
Tcl_HashEntry *entryPtr;
TkWinDrawable *twdPtr = (TkWinDrawable *) Tk_WindowId(tkwin);
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
Tcl_InitHashTable(&tsdPtr->windowTable, TCL_ONE_WORD_KEYS);
@@ -61,12 +60,12 @@ Tk_AttachHWND(tkwin, hwnd)
}
/*
- * Allocate a new drawable if necessary. Otherwise, remove the
- * previous HWND from from the window table.
+ * Allocate a new drawable if necessary. Otherwise, remove the previous
+ * HWND from from the window table.
*/
if (twdPtr == NULL) {
- twdPtr = (TkWinDrawable*) ckalloc(sizeof(TkWinDrawable));
+ twdPtr = (TkWinDrawable *) ckalloc(sizeof(TkWinDrawable));
twdPtr->type = TWD_WINDOW;
twdPtr->window.winPtr = (TkWindow *) tkwin;
} else if (twdPtr->window.handle != NULL) {
@@ -91,8 +90,8 @@ Tk_AttachHWND(tkwin, hwnd)
*
* Tk_HWNDToWindow --
*
- * This function retrieves a Tk_Window from the window table
- * given an HWND.
+ * This function retrieves a Tk_Window from the window table given an
+ * HWND.
*
* Results:
* Returns the matching Tk_Window.
@@ -104,18 +103,18 @@ Tk_AttachHWND(tkwin, hwnd)
*/
Tk_Window
-Tk_HWNDToWindow(hwnd)
- HWND hwnd;
+Tk_HWNDToWindow(
+ HWND hwnd)
{
Tcl_HashEntry *entryPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
Tcl_InitHashTable(&tsdPtr->windowTable, TCL_ONE_WORD_KEYS);
tsdPtr->initialized = 1;
}
- entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char*)hwnd);
+ entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char *) hwnd);
if (entryPtr != NULL) {
return (Tk_Window) Tcl_GetHashValue(entryPtr);
}
@@ -139,8 +138,8 @@ Tk_HWNDToWindow(hwnd)
*/
HWND
-Tk_GetHWND(window)
- Window window;
+Tk_GetHWND(
+ Window window)
{
return ((TkWinDrawable *) window)->window.handle;
}
@@ -150,9 +149,8 @@ Tk_GetHWND(window)
*
* TkpPrintWindowId --
*
- * This routine stores the string representation of the
- * platform dependent window handle for an X Window in the
- * given buffer.
+ * This routine stores the string representation of the platform
+ * dependent window handle for an X Window in the given buffer.
*
* Results:
* Returns the result in the specified buffer.
@@ -164,17 +162,22 @@ Tk_GetHWND(window)
*/
void
-TkpPrintWindowId(buf, window)
- char *buf; /* Pointer to string large enough to hold
- * the hex representation of a pointer. */
- Window window; /* Window to be printed into buffer. */
+TkpPrintWindowId(
+ char *buf, /* Pointer to string large enough to hold the
+ * hex representation of a pointer. */
+ Window window) /* Window to be printed into buffer. */
{
HWND hwnd = (window) ? Tk_GetHWND(window) : 0;
+
/*
- * Use pointer representation, because Win64 is P64 (*not* LP64).
- * Windows doesn't print the 0x for %p, so we do it.
+ * Use pointer representation, because Win64 is P64 (*not* LP64). Windows
+ * doesn't print the 0x for %p, so we do it.
+ * bug #2026405: cygwin does output 0x for %p so test and recover.
*/
+
sprintf(buf, "0x%p", hwnd);
+ if (buf[2] == '0' && buf[3] == 'x')
+ sprintf(buf, "%p", hwnd);
}
/*
@@ -182,16 +185,15 @@ TkpPrintWindowId(buf, window)
*
* TkpScanWindowId --
*
- * Given a string which represents the platform dependent window
- * handle, produce the X Window id for the window.
+ * Given a string which represents the platform dependent window handle,
+ * produce the X Window id for the window.
*
* Results:
- * The return value is normally TCL_OK; in this case *idPtr
- * will be set to the X Window id equivalent to string. If
- * string is improperly formed then TCL_ERROR is returned and
- * an error message will be left in the interp's result. If the
- * number does not correspond to a Tk Window, then *idPtr will
- * be set to None.
+ * The return value is normally TCL_OK; in this case *idPtr will be set
+ * to the X Window id equivalent to string. If string is improperly
+ * formed then TCL_ERROR is returned and an error message will be left in
+ * the interp's result. If the number does not correspond to a Tk Window,
+ * then *idPtr will be set to None.
*
* Side effects:
* None.
@@ -200,28 +202,29 @@ TkpPrintWindowId(buf, window)
*/
int
-TkpScanWindowId(interp, string, idPtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- CONST char *string; /* String containing a (possibly signed)
+TkpScanWindowId(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ CONST char *string, /* String containing a (possibly signed)
* integer in a form acceptable to strtol. */
- Window *idPtr; /* Place to store converted result. */
+ Window *idPtr) /* Place to store converted result. */
{
Tk_Window tkwin;
- VOID *number;
+ void *number, *numberPtr = &number;
/*
- * We want sscanf for the 64-bit check, but if that doesn't work,
- * then Tcl_GetInt manages the error correctly.
+ * We want sscanf for the 64-bit check, but if that doesn't work, then
+ * Tcl_GetInt manages the error correctly.
*/
+
if (
#ifdef _WIN64
- (sscanf(string, "0x%p", &number) != 1) &&
+ (sscanf(string, "0x%p", &number) != 1) &&
#endif
- Tcl_GetInt(interp, string, (int *)&number) != TCL_OK) {
+ Tcl_GetInt(interp, string, (int *) numberPtr) != TCL_OK) {
return TCL_ERROR;
}
- tkwin = Tk_HWNDToWindow((HWND)number);
+ tkwin = Tk_HWNDToWindow((HWND) number);
if (tkwin) {
*idPtr = Tk_WindowId(tkwin);
} else {
@@ -235,8 +238,8 @@ TkpScanWindowId(interp, string, idPtr)
*
* TkpMakeWindow --
*
- * Creates a Windows window object based on the current attributes
- * of the specified TkWindow.
+ * Creates a Windows window object based on the current attributes of the
+ * specified TkWindow.
*
* Results:
* Returns a pointer to a new TkWinDrawable cast to a Window.
@@ -248,14 +251,14 @@ TkpScanWindowId(interp, string, idPtr)
*/
Window
-TkpMakeWindow(winPtr, parent)
- TkWindow *winPtr;
- Window parent;
+TkpMakeWindow(
+ TkWindow *winPtr,
+ Window parent)
{
HWND parentWin;
int style;
HWND hwnd;
-
+
if (parent != None) {
parentWin = Tk_GetHWND(parent);
style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
@@ -265,15 +268,15 @@ TkpMakeWindow(winPtr, parent)
}
/*
- * Create the window, then ensure that it is at the top of the
- * stacking order.
+ * Create the window, then ensure that it is at the top of the stacking
+ * order.
*/
hwnd = CreateWindowEx(WS_EX_NOPARENTNOTIFY, TK_WIN_CHILD_CLASS_NAME, NULL,
- style, Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr),
+ (DWORD) style, Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr),
Tk_Height(winPtr), parentWin, NULL, Tk_GetHINSTANCE(), NULL);
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
return Tk_AttachHWND((Tk_Window)winPtr, hwnd);
}
@@ -288,29 +291,29 @@ TkpMakeWindow(winPtr, parent)
* None.
*
* Side effects:
- * Sends the WM_DESTROY message to the window and then destroys
- * it the Win32 resources associated with the window.
+ * Sends the WM_DESTROY message to the window and then destroys it the
+ * Win32 resources associated with the window.
*
*----------------------------------------------------------------------
*/
void
-XDestroyWindow(display, w)
- Display* display;
- Window w;
+XDestroyWindow(
+ Display *display,
+ Window w)
{
Tcl_HashEntry *entryPtr;
TkWinDrawable *twdPtr = (TkWinDrawable *)w;
TkWindow *winPtr = TkWinGetWinPtr(w);
HWND hwnd = Tk_GetHWND(w);
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
display->request++;
/*
- * Remove references to the window in the pointer module then
- * release the drawable.
+ * Remove references to the window in the pointer module then release the
+ * drawable.
*/
TkPointerDeadWindow(winPtr);
@@ -323,8 +326,8 @@ XDestroyWindow(display, w)
ckfree((char *)twdPtr);
/*
- * Don't bother destroying the window if we are going to destroy
- * the parent later.
+ * Don't bother destroying the window if we are going to destroy the
+ * parent later.
*/
if (hwnd != NULL && !(winPtr->flags & TK_DONT_DESTROY_WINDOW)) {
@@ -343,16 +346,15 @@ XDestroyWindow(display, w)
* None
*
* Side effects:
- * Causes the window state to change, and generates a MapNotify
- * event.
+ * Causes the window state to change, and generates a MapNotify event.
*
*----------------------------------------------------------------------
*/
void
-XMapWindow(display, w)
- Display* display;
- Window w;
+XMapWindow(
+ Display *display,
+ Window w)
{
XEvent event;
TkWindow *parentPtr;
@@ -364,14 +366,14 @@ XMapWindow(display, w)
winPtr->flags |= TK_MAPPED;
/*
- * Check to see if this window is visible now. If all of the parent
- * windows up to the first toplevel are mapped, then this window and
- * its mapped children have just become visible.
+ * Check to see if this window is visible now. If all of the parent
+ * windows up to the first toplevel are mapped, then this window and its
+ * mapped children have just become visible.
*/
if (!(winPtr->flags & TK_TOP_HIERARCHY)) {
for (parentPtr = winPtr->parentPtr; ;
- parentPtr = parentPtr->parentPtr) {
+ parentPtr = parentPtr->parentPtr) {
if ((parentPtr == NULL) || !(parentPtr->flags & TK_MAPPED)) {
return;
}
@@ -389,7 +391,7 @@ XMapWindow(display, w)
event.xmap.override_redirect = winPtr->atts.override_redirect;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
}
-
+
/*
* Generate VisibilityNotify events for this window and its mapped
* children.
@@ -410,10 +412,10 @@ XMapWindow(display, w)
* NotifyVisibility --
*
* This function recursively notifies the mapped children of the
- * specified window of a change in visibility. Note that we don't
- * properly report the visibility state, since Windows does not
- * provide that info. The eventPtr argument must point to an event
- * that has been completely initialized except for the window slot.
+ * specified window of a change in visibility. Note that we don't
+ * properly report the visibility state, since Windows does not provide
+ * that info. The eventPtr argument must point to an event that has been
+ * completely initialized except for the window slot.
*
* Results:
* None.
@@ -425,15 +427,15 @@ XMapWindow(display, w)
*/
static void
-NotifyVisibility(eventPtr, winPtr)
- XEvent *eventPtr; /* Initialized VisibilityNotify event. */
- TkWindow *winPtr; /* Window to notify. */
+NotifyVisibility(
+ XEvent *eventPtr, /* Initialized VisibilityNotify event. */
+ TkWindow *winPtr) /* Window to notify. */
{
if (winPtr->atts.event_mask & VisibilityChangeMask) {
eventPtr->xvisibility.window = winPtr->window;
Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_TAIL);
}
- for (winPtr = winPtr->childList; winPtr != NULL;
+ for (winPtr = winPtr->childList; winPtr != NULL;
winPtr = winPtr->nextPtr) {
if (winPtr->flags & TK_MAPPED) {
NotifyVisibility(eventPtr, winPtr);
@@ -452,16 +454,15 @@ NotifyVisibility(eventPtr, winPtr)
* None
*
* Side effects:
- * Causes the window state to change, and generates an UnmapNotify
- * event.
+ * Causes the window state to change, and generates an UnmapNotify event.
*
*----------------------------------------------------------------------
*/
void
-XUnmapWindow(display, w)
- Display* display;
- Window w;
+XUnmapWindow(
+ Display *display,
+ Window w)
{
XEvent event;
TkWindow *winPtr = TkWinGetWinPtr(w);
@@ -469,8 +470,8 @@ XUnmapWindow(display, w)
display->request++;
/*
- * Bug fix: Don't short circuit this routine based on TK_MAPPED because
- * it will be cleared before XUnmapWindow is called.
+ * Bug fix: Don't short circuit this routine based on TK_MAPPED because it
+ * will be cleared before XUnmapWindow is called.
*/
ShowWindow(Tk_GetHWND(w), SW_HIDE);
@@ -505,16 +506,14 @@ XUnmapWindow(display, w)
*/
void
-XMoveResizeWindow(display, w, x, y, width, height)
- Display* display;
- Window w;
- int x; /* Position relative to parent. */
- int y;
- unsigned int width;
- unsigned int height;
+XMoveResizeWindow(
+ Display *display,
+ Window w,
+ int x, int y, /* Position relative to parent. */
+ unsigned int width, unsigned int height)
{
display->request++;
- MoveWindow(Tk_GetHWND(w), x, y, width, height, TRUE);
+ MoveWindow(Tk_GetHWND(w), x, y, (int) width, (int) height, TRUE);
}
/*
@@ -534,11 +533,10 @@ XMoveResizeWindow(display, w, x, y, width, height)
*/
void
-XMoveWindow(display, w, x, y)
- Display* display;
- Window w;
- int x;
- int y;
+XMoveWindow(
+ Display *display,
+ Window w,
+ int x, int y) /* Position relative to parent */
{
TkWindow *winPtr = TkWinGetWinPtr(w);
@@ -565,18 +563,17 @@ XMoveWindow(display, w, x, y)
*/
void
-XResizeWindow(display, w, width, height)
- Display* display;
- Window w;
- unsigned int width;
- unsigned int height;
+XResizeWindow(
+ Display *display,
+ Window w,
+ unsigned int width, unsigned int height)
{
TkWindow *winPtr = TkWinGetWinPtr(w);
display->request++;
- MoveWindow(Tk_GetHWND(w), winPtr->changes.x, winPtr->changes.y, width,
- height, TRUE);
+ MoveWindow(Tk_GetHWND(w), winPtr->changes.x, winPtr->changes.y, (int)width,
+ (int)height, TRUE);
}
/*
@@ -596,15 +593,14 @@ XResizeWindow(display, w, width, height)
*/
void
-XRaiseWindow(display, w)
- Display* display;
- Window w;
+XRaiseWindow(
+ Display *display,
+ Window w)
{
HWND window = Tk_GetHWND(w);
display->request++;
- SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE);
+ SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
/*
@@ -619,19 +615,19 @@ XRaiseWindow(display, w)
* None.
*
* Side effects:
- * Changes the attributes of the specified window. Note that we
- * ignore the passed in values and use the values stored in the
- * TkWindow data structure.
+ * Changes the attributes of the specified window. Note that we ignore
+ * the passed in values and use the values stored in the TkWindow data
+ * structure.
*
*----------------------------------------------------------------------
*/
void
-XConfigureWindow(display, w, value_mask, values)
- Display* display;
- Window w;
- unsigned int value_mask;
- XWindowChanges* values;
+XConfigureWindow(
+ Display *display,
+ Window w,
+ unsigned int valueMask,
+ XWindowChanges *values)
{
TkWindow *winPtr = TkWinGetWinPtr(w);
HWND hwnd = Tk_GetHWND(w);
@@ -642,7 +638,7 @@ XConfigureWindow(display, w, value_mask, values)
* Change the shape and/or position of the window.
*/
- if (value_mask & (CWX|CWY|CWWidth|CWHeight)) {
+ if (valueMask & (CWX|CWY|CWWidth|CWHeight)) {
MoveWindow(hwnd, winPtr->changes.x, winPtr->changes.y,
winPtr->changes.width, winPtr->changes.height, TRUE);
}
@@ -651,9 +647,10 @@ XConfigureWindow(display, w, value_mask, values)
* Change the stacking order of the window.
*/
- if (value_mask & CWStackMode) {
+ if (valueMask & CWStackMode) {
HWND sibling;
- if ((value_mask & CWSibling) && (values->sibling != None)) {
+
+ if ((valueMask & CWSibling) && (values->sibling != None)) {
sibling = Tk_GetHWND(values->sibling);
} else {
sibling = NULL;
@@ -679,9 +676,9 @@ XConfigureWindow(display, w, value_mask, values)
*/
void
-XClearWindow(display, w)
- Display* display;
- Window w;
+XClearWindow(
+ Display *display,
+ Window w)
{
RECT rc;
HBRUSH brush;
@@ -713,9 +710,9 @@ XClearWindow(display, w)
*
* XChangeWindowAttributes --
*
- * This function is called when the attributes on a window are
- * updated. Since Tk maintains all of the window state, the only
- * relevant value is the cursor.
+ * This function is called when the attributes on a window are updated.
+ * Since Tk maintains all of the window state, the only relevant value is
+ * the cursor.
*
* Results:
* None.
@@ -727,11 +724,11 @@ XClearWindow(display, w)
*/
void
-XChangeWindowAttributes(display, w, valueMask, attributes)
- Display* display;
- Window w;
- unsigned long valueMask;
- XSetWindowAttributes* attributes;
+XChangeWindowAttributes(
+ Display *display,
+ Window w,
+ unsigned long valueMask,
+ XSetWindowAttributes* attributes)
{
if (valueMask & CWCursor) {
XDefineCursor(display, w, attributes->cursor);
@@ -743,8 +740,8 @@ XChangeWindowAttributes(display, w, valueMask, attributes)
*
* TkWinSetWindowPos --
*
- * Adjust the stacking order of a window relative to a second
- * window (or NULL).
+ * Adjust the stacking order of a window relative to a second window (or
+ * NULL).
*
* Results:
* None.
@@ -756,16 +753,16 @@ XChangeWindowAttributes(display, w, valueMask, attributes)
*/
void
-TkWinSetWindowPos(hwnd, siblingHwnd, pos)
- HWND hwnd; /* Window to restack. */
- HWND siblingHwnd; /* Sibling window. */
- int pos; /* One of Above or Below. */
+TkWinSetWindowPos(
+ HWND hwnd, /* Window to restack. */
+ HWND siblingHwnd, /* Sibling window. */
+ int pos) /* One of Above or Below. */
{
HWND temp;
/*
- * Since Windows does not support Above mode, we place the
- * specified window below the sibling and then swap them.
+ * Since Windows does not support Above mode, we place the specified
+ * window below the sibling and then swap them.
*/
if (siblingHwnd) {
@@ -790,8 +787,8 @@ TkWinSetWindowPos(hwnd, siblingHwnd, pos)
* TkpWindowWasRecentlyDeleted --
*
* Determines whether we know if the window given as argument was
- * recently deleted. Called by the generic code error handler to
- * handle BadWindow events.
+ * recently deleted. Called by the generic code error handler to handle
+ * BadWindow events.
*
* Results:
* Always 0. We do not keep this information on Windows.
@@ -803,9 +800,17 @@ TkWinSetWindowPos(hwnd, siblingHwnd, pos)
*/
int
-TkpWindowWasRecentlyDeleted(win, dispPtr)
- Window win;
- TkDisplay *dispPtr;
+TkpWindowWasRecentlyDeleted(
+ Window win,
+ TkDisplay *dispPtr)
{
return 0;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 2097938..2df9b2e 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -2,15 +2,15 @@
* tkWinWm.c --
*
* This module takes care of the interactions between a Tk-based
- * application and the window manager. Among other things, it
- * implements the "wm" command and passes geometry information
- * to the window manager.
+ * application and the window manager. Among other things, it implements
+ * the "wm" command and passes geometry information to the window
+ * manager.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
@@ -19,6 +19,7 @@
/*
* These next two defines are only valid on Win2K/XP+.
*/
+
#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED 0x00080000
#endif
@@ -30,36 +31,38 @@
#endif
/*
- * Event structure for synthetic activation events. These events are
- * placed on the event queue whenever a toplevel gets a WM_MOUSEACTIVATE
- * message.
+ * Event structure for synthetic activation events. These events are placed on
+ * the event queue whenever a toplevel gets a WM_MOUSEACTIVATE message or
+ * a WM_ACTIVATE. If the window is being moved (*flagPtr will be true)
+ * then the handling of this event must be delayed until the operation
+ * has completed to avoid a premature WM_EXITSIZEMOVE event.
*/
typedef struct ActivateEvent {
Tcl_Event ev;
TkWindow *winPtr;
+ const int *flagPtr;
+ HWND hwnd;
} ActivateEvent;
/*
- * A data structure of the following type holds information for
- * each window manager protocol (such as WM_DELETE_WINDOW) for
- * which a handler (i.e. a Tcl command) has been defined for a
- * particular top-level window.
+ * A data structure of the following type holds information for each window
+ * manager protocol (such as WM_DELETE_WINDOW) for which a handler (i.e. a Tcl
+ * command) has been defined for a particular top-level window.
*/
typedef struct ProtocolHandler {
Atom protocol; /* Identifies the protocol. */
struct ProtocolHandler *nextPtr;
- /* Next in list of protocol handlers for
- * the same top-level window, or NULL for
- * end of list. */
+ /* Next in list of protocol handlers for the
+ * same top-level window, or NULL for end of
+ * list. */
Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[4]; /* Tcl command to invoke when a client
- * message for this protocol arrives.
- * The actual size of the structure varies
- * to accommodate the needs of the actual
- * command. THIS MUST BE THE LAST FIELD OF
- * THE STRUCTURE. */
+ char command[4]; /* Tcl command to invoke when a client message
+ * for this protocol arrives. The actual size
+ * of the structure varies to accommodate the
+ * needs of the actual command. THIS MUST BE
+ * THE LAST FIELD OF THE STRUCTURE. */
} ProtocolHandler;
#define HANDLER_SIZE(cmdLength) \
@@ -68,81 +71,87 @@ typedef struct ProtocolHandler {
/*
* Helper type passed via lParam to TkWmStackorderToplevelEnumProc
*/
+
typedef struct TkWmStackorderToplevelPair {
Tcl_HashTable *table;
TkWindow **window_ptr;
} TkWmStackorderToplevelPair;
/*
- * This structure represents the contents of a icon, in terms of its
- * image. The HICON is an internal Windows format. Most of these
- * icon-specific-structures originated with the Winico extension.
- * We stripped out unused parts of that code, and integrated the
- * code more naturally with Tcl.
+ * This structure represents the contents of a icon, in terms of its image.
+ * The HICON is an internal Windows format. Most of these icon-specific
+ * structures originated with the Winico extension. We stripped out unused
+ * parts of that code, and integrated the code more naturally with Tcl.
*/
+
typedef struct {
- UINT Width, Height, Colors; /* Width, Height and bpp */
- LPBYTE lpBits; /* ptr to DIB bits */
- DWORD dwNumBytes; /* how many bytes? */
- LPBITMAPINFO lpbi; /* ptr to header */
- LPBYTE lpXOR; /* ptr to XOR image bits */
- LPBYTE lpAND; /* ptr to AND image bits */
- HICON hIcon; /* DAS ICON */
+ UINT Width, Height, Colors; /* Width, Height and bpp */
+ LPBYTE lpBits; /* Ptr to DIB bits */
+ DWORD dwNumBytes; /* How many bytes? */
+ LPBITMAPINFO lpbi; /* Ptr to header */
+ LPBYTE lpXOR; /* Ptr to XOR image bits */
+ LPBYTE lpAND; /* Ptr to AND image bits */
+ HICON hIcon; /* DAS ICON */
} ICONIMAGE, *LPICONIMAGE;
+
/*
- * This structure is how we represent a block of the above
- * items. We will reallocate these structures according to
- * how many images they need to contain.
+ * This structure is how we represent a block of the above items. We will
+ * reallocate these structures according to how many images they need to
+ * contain.
*/
+
typedef struct {
- int nNumImages; /* How many images? */
- ICONIMAGE IconImages[1]; /* Image entries */
+ int nNumImages; /* How many images? */
+ ICONIMAGE IconImages[1]; /* Image entries */
} BlockOfIconImages, *BlockOfIconImagesPtr;
+
/*
- * These two structures are used to read in icons from an
- * 'icon directory' (i.e. the contents of a .icr file, say).
- * We only use these structures temporarily, since we copy
- * the information we want into a BlockOfIconImages.
+ * These two structures are used to read in icons from an 'icon directory'
+ * (i.e. the contents of a .icr file, say). We only use these structures
+ * temporarily, since we copy the information we want into a
+ * BlockOfIconImages.
*/
+
typedef struct {
- BYTE bWidth; /* Width of the image */
- BYTE bHeight; /* Height of the image (times 2) */
- BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
- BYTE bReserved; /* Reserved */
- WORD wPlanes; /* Color Planes */
- WORD wBitCount; /* Bits per pixel */
- DWORD dwBytesInRes; /* how many bytes in this resource? */
- DWORD dwImageOffset; /* where in the file is this image */
+ BYTE bWidth; /* Width of the image */
+ BYTE bHeight; /* Height of the image (times 2) */
+ BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
+ BYTE bReserved; /* Reserved */
+ WORD wPlanes; /* Color Planes */
+ WORD wBitCount; /* Bits per pixel */
+ DWORD dwBytesInRes; /* How many bytes in this resource? */
+ DWORD dwImageOffset; /* Where in the file is this image */
} ICONDIRENTRY, *LPICONDIRENTRY;
+
typedef struct {
- WORD idReserved; /* Reserved */
- WORD idType; /* resource type (1 for icons) */
- WORD idCount; /* how many images? */
- ICONDIRENTRY idEntries[1]; /* the entries for each image */
+ WORD idReserved; /* Reserved */
+ WORD idType; /* Resource type (1 for icons) */
+ WORD idCount; /* How many images? */
+ ICONDIRENTRY idEntries[1]; /* The entries for each image */
} ICONDIR, *LPICONDIR;
/*
- * A pointer to one of these strucutures is associated with each
- * toplevel. This allows us to free up all memory associated with icon
- * resources when a window is deleted or if the window's icon is
- * changed. They are simply reference counted according to:
+ * A pointer to one of these strucutures is associated with each toplevel.
+ * This allows us to free up all memory associated with icon resources when a
+ * window is deleted or if the window's icon is changed. They are simply
+ * reference counted according to:
*
- * (i) how many WmInfo structures point to this object
- * (ii) whether the ThreadSpecificData defined in this file contains
- * a pointer to this object.
+ * (1) How many WmInfo structures point to this object
+ * (2) Whether the ThreadSpecificData defined in this file contains a pointer
+ * to this object.
*
- * The former count is for windows whose icons are individually
- * set, and the latter is for the global default icon choice.
+ * The former count is for windows whose icons are individually set, and the
+ * latter is for the global default icon choice.
*
- * Icons loaded from .icr/.icr use the iconBlock field, icons
- * loaded from .exe/.dll use the hIcon field.
+ * Icons loaded from .icr/.icr use the iconBlock field, icons loaded from
+ * .exe/.dll use the hIcon field.
*/
+
typedef struct WinIconInstance {
- int refCount; /* Number of instances that share this
- * data structure. */
+ int refCount; /* Number of instances that share this data
+ * structure. */
BlockOfIconImagesPtr iconBlock;
- /* Pointer to icon resource data for
- * image. */
+ /* Pointer to icon resource data for image */
} WinIconInstance;
typedef struct WinIconInstance *WinIconPtr;
@@ -153,96 +162,97 @@ typedef struct WinIconInstance *WinIconPtr;
*/
typedef struct TkWmInfo {
- TkWindow *winPtr; /* Pointer to main Tk information for
- * this window. */
- HWND wrapper; /* This is the decorative frame window
- * created by the window manager to wrap
- * a toplevel window. This window is
- * a direct child of the root window. */
- char *title; /* Title to display in window caption. If
- * NULL, use name of widget. Malloced. */
- char *iconName; /* Name to display in icon. Malloced. */
- XWMHints hints; /* Various pieces of information for
- * window manager. */
+ TkWindow *winPtr; /* Pointer to main Tk information for this
+ * window. */
+ HWND wrapper; /* This is the decorative frame window created
+ * by the window manager to wrap a toplevel
+ * window. This window is a direct child of
+ * the root window. */
+ char *title; /* Title to display in window caption. If
+ * NULL, use name of widget. Malloced. */
+ char *iconName; /* Name to display in icon. Malloced. */
+ XWMHints hints; /* Various pieces of information for window
+ * manager. */
char *leaderName; /* Path name of leader of window group
* (corresponds to hints.window_group).
- * Malloc-ed. Note: this field doesn't
- * get updated if leader is destroyed. */
+ * Malloc-ed. Note: this field doesn't get
+ * updated if leader is destroyed. */
TkWindow *masterPtr; /* Master window for TRANSIENT_FOR property,
* or NULL. */
- Tk_Window icon; /* Window to use as icon for this window,
- * or NULL. */
+ Tk_Window icon; /* Window to use as icon for this window, or
+ * NULL. */
Tk_Window iconFor; /* Window for which this window is icon, or
* NULL if this isn't an icon for anyone. */
/*
- * Information used to construct an XSizeHints structure for
- * the window manager:
+ * Information used to construct an XSizeHints structure for the window
+ * manager:
*/
int defMinWidth, defMinHeight, defMaxWidth, defMaxHeight;
/* Default resize limits given by system. */
- int sizeHintsFlags; /* Flags word for XSizeHints structure.
- * If the PBaseSize flag is set then the
- * window is gridded; otherwise it isn't
- * gridded. */
- int minWidth, minHeight; /* Minimum dimensions of window, in
- * pixels or grid units. */
- int maxWidth, maxHeight; /* Maximum dimensions of window, in
- * pixels or grid units. 0 to default. */
+ int sizeHintsFlags; /* Flags word for XSizeHints structure. If the
+ * PBaseSize flag is set then the window is
+ * gridded; otherwise it isn't gridded. */
+ int minWidth, minHeight; /* Minimum dimensions of window, in pixels or
+ * grid units. */
+ int maxWidth, maxHeight; /* Maximum dimensions of window, in pixels or
+ * grid units. 0 to default. */
Tk_Window gridWin; /* Identifies the window that controls
- * gridding for this top-level, or NULL if
- * the top-level isn't currently gridded. */
- int widthInc, heightInc; /* Increments for size changes (# pixels
- * per step). */
+ * gridding for this top-level, or NULL if the
+ * top-level isn't currently gridded. */
+ int widthInc, heightInc; /* Increments for size changes (# pixels per
+ * step). */
struct {
int x; /* numerator */
- int y; /* denominator */
+ int y; /* denominator */
} minAspect, maxAspect; /* Min/max aspect ratios for window. */
int reqGridWidth, reqGridHeight;
- /* The dimensions of the window (in
- * grid units) requested through
- * the geometry manager. */
+ /* The dimensions of the window (in grid
+ * units) requested through the geometry
+ * manager. */
int gravity; /* Desired window gravity. */
/*
* Information used to manage the size and location of a window.
*/
- int width, height; /* Desired dimensions of window, specified
- * in pixels or grid units. These values are
- * set by the "wm geometry" command and by
- * ConfigureNotify events (for when wm
- * resizes window). -1 means user hasn't
- * requested dimensions. */
+ int width, height; /* Desired dimensions of window, specified in
+ * pixels or grid units. These values are set
+ * by the "wm geometry" command and by
+ * ConfigureNotify events (for when wm resizes
+ * window). -1 means user hasn't requested
+ * dimensions. */
int x, y; /* Desired X and Y coordinates for window.
- * These values are set by "wm geometry",
- * plus by ConfigureNotify events (when wm
- * moves window). These numbers are
- * different than the numbers stored in
- * winPtr->changes because (a) they could be
- * measured from the right or bottom edge
- * of the screen (see WM_NEGATIVE_X and
- * WM_NEGATIVE_Y flags) and (b) if the window
- * has been reparented then they refer to the
- * parent rather than the window itself. */
+ * These values are set by "wm geometry", plus
+ * by ConfigureNotify events (when wm moves
+ * window). These numbers are different than
+ * the numbers stored in winPtr->changes
+ * because (a) they could be measured from the
+ * right or bottom edge of the screen (see
+ * WM_NEGATIVE_X and WM_NEGATIVE_Y flags) and
+ * (b) if the window has been reparented then
+ * they refer to the parent rather than the
+ * window itself. */
int borderWidth, borderHeight;
/* Width and height of window dressing, in
- * pixels for the current style/exStyle. This
+ * pixels for the current style/exStyle. This
* includes the border on both sides of the
* window. */
+ int configX, configY; /* x,y position of toplevel when window is
+ * switched into fullscreen state, */
int configWidth, configHeight;
/* Dimensions passed to last request that we
- * issued to change geometry of window. Used
- * to eliminate redundant resize operations. */
+ * issued to change geometry of window. Used
+ * to eliminate redundant resize operations */
HMENU hMenu; /* the hMenu associated with this menu */
DWORD style, exStyle; /* Style flags for the wrapper window. */
LONG styleConfig; /* Extra user requested style bits */
LONG exStyleConfig; /* Extra user requested extended style bits */
Tcl_Obj *crefObj; /* COLORREF object for transparent handling */
COLORREF colorref; /* COLORREF for transparent handling */
- double alpha; /* Alpha transparency level
- * 0.0 (fully transparent) .. 1.0 (opaque) */
+ double alpha; /* Alpha transparency level 0.0 (fully
+ * transparent) .. 1.0 (opaque) */
/*
* List of children of the toplevel which have private colormaps.
@@ -255,61 +265,60 @@ typedef struct TkWmInfo {
* Miscellaneous information.
*/
- ProtocolHandler *protPtr; /* First in list of protocol handlers for
- * this window (NULL means none). */
+ ProtocolHandler *protPtr; /* First in list of protocol handlers for this
+ * window (NULL means none). */
int cmdArgc; /* Number of elements in cmdArgv below. */
- CONST char **cmdArgv; /* Array of strings to store in the
- * WM_COMMAND property. NULL means nothing
- * available. */
+ CONST char **cmdArgv; /* Array of strings to store in the WM_COMMAND
+ * property. NULL means nothing available. */
char *clientMachine; /* String to store in WM_CLIENT_MACHINE
* property, or NULL. */
int flags; /* Miscellaneous flags, defined below. */
- int numTransients; /* number of transients on this window */
- WinIconPtr iconPtr; /* pointer to titlebar icon structure for
- * this window, or NULL. */
+ int numTransients; /* Number of transients on this window */
+ WinIconPtr iconPtr; /* Pointer to titlebar icon structure for this
+ * window, or NULL. */
struct TkWmInfo *nextPtr; /* Next in list of all top-level windows. */
} WmInfo;
/*
* Flag values for WmInfo structures:
*
- * WM_NEVER_MAPPED - non-zero means window has never been
- * mapped; need to update all info when
- * window is first mapped.
- * WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo
- * has already been scheduled for this
- * window; no need to schedule another one.
- * WM_NEGATIVE_X - non-zero means x-coordinate is measured in
- * pixels from right edge of screen, rather
- * than from left edge.
- * WM_NEGATIVE_Y - non-zero means y-coordinate is measured in
+ * WM_NEVER_MAPPED - Non-zero means window has never been mapped;
+ * need to update all info when window is first
+ * mapped.
+ * WM_UPDATE_PENDING - Non-zero means a call to UpdateGeometryInfo
+ * has already been scheduled for this window;
+ * no need to schedule another one.
+ * WM_NEGATIVE_X - Non-zero means x-coordinate is measured in
+ * pixels from right edge of screen, rather than
+ * from left edge.
+ * WM_NEGATIVE_Y - Non-zero means y-coordinate is measured in
* pixels up from bottom of screen, rather than
* down from top.
- * WM_UPDATE_SIZE_HINTS - non-zero means that new size hints need to be
+ * WM_UPDATE_SIZE_HINTS - Non-zero means that new size hints need to be
* propagated to window manager. Not used on Win.
- * WM_SYNC_PENDING - set to non-zero while waiting for the window
+ * WM_SYNC_PENDING - Set to non-zero while waiting for the window
* manager to respond to some state change.
- * WM_MOVE_PENDING - non-zero means the application has requested
- * a new position for the window, but it hasn't
- * been reflected through the window manager
- * yet.
- * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were
- * set explicitly via "wm colormapwindows".
- * WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows"
+ * WM_MOVE_PENDING - Non-zero means the application has requested a
+ * new position for the window, but it hasn't
+ * been reflected through the window manager yet.
+ * WM_COLORMAPS_EXPLICIT - Non-zero means the colormap windows were set
+ * explicitly via "wm colormapwindows".
+ * WM_ADDED_TOPLEVEL_COLORMAP - Non-zero means that when "wm colormapwindows"
* was called the top-level itself wasn't
- * specified, so we added it implicitly at
- * the end of the list.
- * WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to
+ * specified, so we added it implicitly at the
+ * end of the list.
+ * WM_WIDTH_NOT_RESIZABLE - Non-zero means that we're not supposed to
* allow the user to change the width of the
- * window (controlled by "wm resizable"
- * command).
- * WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to
+ * window (controlled by "wm resizable" command).
+ * WM_HEIGHT_NOT_RESIZABLE - Non-zero means that we're not supposed to
* allow the user to change the height of the
- * window (controlled by "wm resizable"
- * command).
- * WM_WITHDRAWN - non-zero means that this window has explicitly
+ * window (controlled by "wm resizable" command).
+ * WM_WITHDRAWN - Non-zero means that this window has explicitly
* been withdrawn. If it's a transient, it should
* not mirror state changes in the master.
+ * WM_FULLSCREEN - Non-zero means that this window has been placed
+ * in the full screen mode. It should be mapped at
+ * 0,0 and be the width and height of the screen.
*/
#define WM_NEVER_MAPPED (1<<0)
@@ -325,6 +334,7 @@ typedef struct TkWmInfo {
#define WM_WIDTH_NOT_RESIZABLE (1<<10)
#define WM_HEIGHT_NOT_RESIZABLE (1<<11)
#define WM_WITHDRAWN (1<<12)
+#define WM_FULLSCREEN (1<<13)
/*
* Window styles for various types of toplevel windows.
@@ -333,6 +343,9 @@ typedef struct TkWmInfo {
#define WM_OVERRIDE_STYLE (WS_CLIPCHILDREN|WS_CLIPSIBLINGS|CS_DBLCLKS)
#define EX_OVERRIDE_STYLE (WS_EX_TOOLWINDOW)
+#define WM_FULLSCREEN_STYLE (WS_POPUP|WM_OVERRIDE_STYLE)
+#define EX_FULLSCREEN_STYLE (WS_EX_APPWINDOW)
+
#define WM_TOPLEVEL_STYLE (WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|CS_DBLCLKS)
#define EX_TOPLEVEL_STYLE (0)
@@ -341,257 +354,258 @@ typedef struct TkWmInfo {
#define EX_TRANSIENT_STYLE (WS_EX_DLGMODALFRAME)
/*
- * The following structure is the official type record for geometry
- * management of top-level windows.
+ * The following structure is the official type record for geometry management
+ * of top-level windows.
*/
static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
+static void RemapWindows(TkWindow *winPtr, HWND parentHWND);
-static Tk_GeomMgr wmMgrType = {
- "wm", /* name */
- TopLevelReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
+static const Tk_GeomMgr wmMgrType = {
+ "wm", /* name */
+ TopLevelReqProc, /* requestProc */
+ NULL, /* lostSlaveProc */
};
typedef struct ThreadSpecificData {
- HPALETTE systemPalette; /* System palette; refers to the
- * currently installed foreground logical
- * palette. */
- TkWindow *createWindow; /* Window that is being constructed. This
- * value is set immediately before a
- * call to CreateWindowEx, and is used
- * by SetLimits. This is a gross hack
- * needed to work around Windows brain
- * damage where it sends the
- * WM_GETMINMAXINFO message before the
- * WM_CREATE window. */
- int initialized; /* Flag indicating whether thread-
- * specific elements of module have
- * been initialized. */
- int firstWindow; /* Flag, cleared when the first window
- * is mapped in a non-iconic state. */
- WinIconPtr iconPtr; /* IconPtr being used as default for all
- * toplevels, or NULL. */
+ HPALETTE systemPalette; /* System palette; refers to the currently
+ * installed foreground logical palette. */
+ TkWindow *createWindow; /* Window that is being constructed. This
+ * value is set immediately before a call to
+ * CreateWindowEx, and is used by SetLimits.
+ * This is a gross hack needed to work around
+ * Windows brain damage where it sends the
+ * WM_GETMINMAXINFO message before the
+ * WM_CREATE window. */
+ int initialized; /* Flag indicating whether thread-specific
+ * elements of module have been
+ * initialized. */
+ int firstWindow; /* Flag, cleared when the first window is
+ * mapped in a non-iconic state. */
+ WinIconPtr iconPtr; /* IconPtr being used as default for all
+ * toplevels, or NULL. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * The following variables cannot be placed in thread local storage
- * because they must be shared across threads.
+ * The following variables cannot be placed in thread local storage because
+ * they must be shared across threads.
*/
-static int initialized; /* Flag indicating whether module has
- * been initialized. */
+static int initialized; /* Flag indicating whether module has been
+ * initialized. */
-/*
- * A pointer to a shell proc which allows us to extract icons from
- * any file. We just initialize this when we start up (if we can)
- * and then it never changes
+/*
+ * A pointer to a shell proc which allows us to extract icons from any file.
+ * We just initialize this when we start up (if we can) and then it never
+ * changes
*/
+
DWORD* (WINAPI *shgetfileinfoProc) (LPCTSTR pszPath, DWORD dwFileAttributes,
- SHFILEINFO* psfi, UINT cbFileInfo, UINT uFlags) = NULL;
+ SHFILEINFO* psfi, UINT cbFileInfo, UINT uFlags) = NULL;
/*
- * A pointer to SetLayeredWindowAttributes (user32.dll) which we
- * retrieve dynamically because it is only valid on Win2K+.
+ * A pointer to SetLayeredWindowAttributes (user32.dll) which we retrieve
+ * dynamically because it is only valid on Win2K+.
*/
+
BOOL (WINAPI *setLayeredWindowAttributesProc) (HWND hwnd, COLORREF crKey,
BYTE bAlpha, DWORD dwFlags) = NULL;
TCL_DECLARE_MUTEX(winWmMutex)
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static int ActivateWindow _ANSI_ARGS_((Tcl_Event *evPtr,
- int flags));
-static void ConfigureTopLevel _ANSI_ARGS_((WINDOWPOS *pos));
-static void GenerateConfigureNotify _ANSI_ARGS_((
- TkWindow *winPtr));
-static void GetMaxSize _ANSI_ARGS_((WmInfo *wmPtr,
- int *maxWidthPtr, int *maxHeightPtr));
-static void GetMinSize _ANSI_ARGS_((WmInfo *wmPtr,
- int *minWidthPtr, int *minHeightPtr));
-static TkWindow * GetTopLevel _ANSI_ARGS_((HWND hwnd));
-static void InitWm _ANSI_ARGS_((void));
-static int InstallColormaps _ANSI_ARGS_((HWND hwnd, int message,
- int isForemost));
-static void InvalidateSubTree _ANSI_ARGS_((TkWindow *winPtr,
- Colormap colormap));
-static void InvalidateSubTreeDepth _ANSI_ARGS_((TkWindow *winPtr));
-static int ParseGeometry _ANSI_ARGS_((Tcl_Interp *interp,
- char *string, TkWindow *winPtr));
-static void RefreshColormap _ANSI_ARGS_((Colormap colormap,
- TkDisplay *dispPtr));
-static void SetLimits _ANSI_ARGS_((HWND hwnd, MINMAXINFO *info));
-static void TkWmStackorderToplevelWrapperMap _ANSI_ARGS_((
- TkWindow *winPtr,
- Display *display,
- Tcl_HashTable *table));
-static LRESULT CALLBACK TopLevelProc _ANSI_ARGS_((HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam));
-static void TopLevelEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
- Tk_Window tkwin));
-static void UpdateGeometryInfo _ANSI_ARGS_((
- ClientData clientData));
-static void UpdateWrapper _ANSI_ARGS_((TkWindow *winPtr));
-static LRESULT CALLBACK WmProc _ANSI_ARGS_((HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam));
-static void WmWaitVisibilityOrMapProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static BlockOfIconImagesPtr ReadIconOrCursorFromFile _ANSI_ARGS_((
- Tcl_Interp *interp, Tcl_Obj* fileName, BOOL isIcon));
-static WinIconPtr ReadIconFromFile _ANSI_ARGS_((
- Tcl_Interp *interp, Tcl_Obj *fileName));
-static WinIconPtr GetIconFromPixmap _ANSI_ARGS_((Display *dsPtr,
- Pixmap pixmap));
-static int ReadICOHeader _ANSI_ARGS_((Tcl_Channel channel));
-static BOOL AdjustIconImagePointers _ANSI_ARGS_((LPICONIMAGE lpImage));
-static HICON MakeIconOrCursorFromResource
- _ANSI_ARGS_((LPICONIMAGE lpIcon, BOOL isIcon));
-static HICON GetIcon _ANSI_ARGS_((WinIconPtr titlebaricon,
- int icon_size));
-static int WinSetIcon _ANSI_ARGS_((Tcl_Interp *interp,
- WinIconPtr titlebaricon, Tk_Window tkw));
-static void FreeIconBlock _ANSI_ARGS_((BlockOfIconImagesPtr lpIR));
-static void DecrIconRefCount _ANSI_ARGS_((WinIconPtr titlebaricon));
-
-static int WmAspectCmd _ANSI_ARGS_((Tk_Window tkwin,
+static int ActivateWindow(Tcl_Event *evPtr, int flags);
+static void ConfigureTopLevel(WINDOWPOS *pos);
+static void GenerateConfigureNotify(TkWindow *winPtr);
+static void GenerateActivateEvent(TkWindow *winPtr, const int *flagPtr);
+static void GetMaxSize(WmInfo *wmPtr,
+ int *maxWidthPtr, int *maxHeightPtr);
+static void GetMinSize(WmInfo *wmPtr,
+ int *minWidthPtr, int *minHeightPtr);
+static TkWindow * GetTopLevel(HWND hwnd);
+static void InitWm(void);
+static int InstallColormaps(HWND hwnd, int message,
+ int isForemost);
+static void InvalidateSubTree(TkWindow *winPtr, Colormap colormap);
+static void InvalidateSubTreeDepth(TkWindow *winPtr);
+static int ParseGeometry(Tcl_Interp *interp, char *string,
+ TkWindow *winPtr);
+static void RefreshColormap(Colormap colormap, TkDisplay *dispPtr);
+static void SetLimits(HWND hwnd, MINMAXINFO *info);
+static void TkWmStackorderToplevelWrapperMap(TkWindow *winPtr,
+ Display *display, Tcl_HashTable *table);
+static LRESULT CALLBACK TopLevelProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+static void TopLevelEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
+static void UpdateGeometryInfo(ClientData clientData);
+static void UpdateWrapper(TkWindow *winPtr);
+static LRESULT CALLBACK WmProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+static void WmWaitVisibilityOrMapProc(ClientData clientData,
+ XEvent *eventPtr);
+static BlockOfIconImagesPtr ReadIconOrCursorFromFile(Tcl_Interp *interp,
+ Tcl_Obj* fileName, BOOL isIcon);
+static WinIconPtr ReadIconFromFile(Tcl_Interp *interp,
+ Tcl_Obj *fileName);
+static WinIconPtr GetIconFromPixmap(Display *dsPtr, Pixmap pixmap);
+static int ReadICOHeader(Tcl_Channel channel);
+static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage);
+static HICON MakeIconOrCursorFromResource(LPICONIMAGE lpIcon,
+ BOOL isIcon);
+static HICON GetIcon(WinIconPtr titlebaricon, int icon_size);
+static int WinSetIcon(Tcl_Interp *interp,
+ WinIconPtr titlebaricon, Tk_Window tkw);
+static void FreeIconBlock(BlockOfIconImagesPtr lpIR);
+static void DecrIconRefCount(WinIconPtr titlebaricon);
+
+static int WmAspectCmd(Tk_Window tkwin,
+ TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static int WmAttributesCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmAttributesCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmClientCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmClientCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmColormapwindowsCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmColormapwindowsCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmCommandCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmCommandCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmDeiconifyCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmDeiconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmFocusmodelCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFocusmodelCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmForgetCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFrameCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmFrameCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGeometryCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmGeometryCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGridCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmGridCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGroupCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmGroupCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconbitmapCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmIconbitmapCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmIconifyCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconmaskCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmIconmaskCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconnameCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmIconnameCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconphotoCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmIconphotoCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconpositionCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmIconpositionCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconwindowCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmIconwindowCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMaxsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmManageCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMinsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmMaxsizeCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmOverrideredirectCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmMinsizeCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmPositionfromCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmOverrideredirectCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmProtocolCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmPositionfromCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmResizableCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmProtocolCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmSizefromCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmResizableCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStackorderCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmSizefromCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStateCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmStackorderCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTitleCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmStateCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTransientCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmTitleCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *CONST objv[]);
+static int WmTransientCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr,
- TkWindow *winPtr));
+ Tcl_Obj *CONST objv[]);
+static int WmWithdrawCmd(Tk_Window tkwin,
+ TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
-/* Used in BytesPerLine */
-#define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2)
+/*
+ * Used in BytesPerLine
+ */
+#define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2)
+
/*
*----------------------------------------------------------------------
*
* DIBNumColors --
*
- * Calculates the number of entries in the color table, given by
- * LPSTR lpbi - pointer to the CF_DIB memory block. Used by
- * titlebar icon code.
+ * Calculates the number of entries in the color table, given by LPSTR
+ * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
*
* Results:
- *
- * WORD - Number of entries in the color table.
- *
- * Side effects: None.
- *
+ * WORD - Number of entries in the color table.
*
*----------------------------------------------------------------------
*/
-static WORD
-DIBNumColors( LPSTR lpbi )
+
+static WORD
+DIBNumColors(
+ LPSTR lpbi)
{
WORD wBitCount;
DWORD dwClrUsed;
dwClrUsed = ((LPBITMAPINFOHEADER) lpbi)->biClrUsed;
- if (dwClrUsed)
+ if (dwClrUsed) {
return (WORD) dwClrUsed;
+ }
wBitCount = ((LPBITMAPINFOHEADER) lpbi)->biBitCount;
- switch (wBitCount)
- {
- case 1: return 2;
- case 4: return 16;
- case 8: return 256;
- default:return 0;
+ switch (wBitCount) {
+ case 1:
+ return 2;
+ case 4:
+ return 16;
+ case 8:
+ return 256;
+ default:
+ return 0;
}
}
@@ -600,22 +614,19 @@ DIBNumColors( LPSTR lpbi )
*
* PaletteSize --
*
- * Calculates the number of bytes in the color table, as given by
- * LPSTR lpbi - pointer to the CF_DIB memory block. Used by
- * titlebar icon code.
+ * Calculates the number of bytes in the color table, as given by LPSTR
+ * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
*
* Results:
- * number of bytes in the color table
- *
- * Side effects: None.
- *
+ * Number of bytes in the color table
*
*----------------------------------------------------------------------
*/
-static WORD
-PaletteSize( LPSTR lpbi )
+static WORD
+PaletteSize(
+ LPSTR lpbi)
{
- return ((WORD)( DIBNumColors( lpbi ) * sizeof( RGBQUAD )) );
+ return (WORD) (DIBNumColors(lpbi) * sizeof(RGBQUAD));
}
/*
@@ -623,9 +634,8 @@ PaletteSize( LPSTR lpbi )
*
* FindDIBits --
*
- * Locate the image bits in a CF_DIB format DIB, as given by
- * LPSTR lpbi - pointer to the CF_DIB memory block. Used by
- * titlebar icon code.
+ * Locate the image bits in a CF_DIB format DIB, as given by LPSTR lpbi -
+ * pointer to the CF_DIB memory block. Used by titlebar icon code.
*
* Results:
* pointer to the image bits
@@ -635,10 +645,12 @@ PaletteSize( LPSTR lpbi )
*
*----------------------------------------------------------------------
*/
-static LPSTR
-FindDIBBits( LPSTR lpbi )
+
+static LPSTR
+FindDIBBits(
+ LPSTR lpbi)
{
- return ( lpbi + *(LPDWORD)lpbi + PaletteSize( lpbi ) );
+ return lpbi + *(LPDWORD)lpbi + PaletteSize(lpbi);
}
/*
@@ -647,19 +659,18 @@ FindDIBBits( LPSTR lpbi )
* BytesPerLine --
*
* Calculates the number of bytes in one scan line, as given by
- * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER
- * that begins the CF_DIB block. Used by titlebar icon code.
+ * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER that
+ * begins the CF_DIB block. Used by titlebar icon code.
*
* Results:
* number of bytes in one scan line (DWORD aligned)
*
- * Side effects: None
- *
- *
*----------------------------------------------------------------------
*/
-static DWORD
-BytesPerLine( LPBITMAPINFOHEADER lpBMIH )
+
+static DWORD
+BytesPerLine(
+ LPBITMAPINFOHEADER lpBMIH)
{
return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount);
}
@@ -669,41 +680,66 @@ BytesPerLine( LPBITMAPINFOHEADER lpBMIH )
*
* AdjustIconImagePointers --
*
- * Adjusts internal pointers in icon resource struct, as given
- * by LPICONIMAGE lpImage - the resource to handle. Used by
- * titlebar icon code.
+ * Adjusts internal pointers in icon resource struct, as given by
+ * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon
+ * code.
*
* Results:
* BOOL - TRUE for success, FALSE for failure
*
- * Side effects:
- *
- *
*----------------------------------------------------------------------
*/
-static BOOL
-AdjustIconImagePointers( LPICONIMAGE lpImage )
+
+static BOOL
+AdjustIconImagePointers(
+ LPICONIMAGE lpImage)
{
- /* Sanity check */
- if (lpImage==NULL)
+ /*
+ * Sanity check.
+ */
+
+ if (lpImage == NULL) {
return FALSE;
- /* BITMAPINFO is at beginning of bits */
+ }
+
+ /*
+ * BITMAPINFO is at beginning of bits.
+ */
+
lpImage->lpbi = (LPBITMAPINFO)lpImage->lpBits;
- /* Width - simple enough */
+
+ /*
+ * Width - simple enough.
+ */
+
lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
- /*
- * Icons are stored in funky format where height is doubled
- * so account for that
+
+ /*
+ * Icons are stored in funky format where height is doubled so account for
+ * that.
*/
+
lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
- /* How many colors? */
- lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes *
- lpImage->lpbi->bmiHeader.biBitCount;
- /* XOR bits follow the header and color table */
+
+ /*
+ * How many colors?
+ */
+
+ lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes
+ * lpImage->lpbi->bmiHeader.biBitCount;
+
+ /*
+ * XOR bits follow the header and color table.
+ */
+
lpImage->lpXOR = (LPBYTE)FindDIBBits(((LPSTR)lpImage->lpbi));
- /* AND bits follow the XOR bits */
+
+ /*
+ * AND bits follow the XOR bits.
+ */
+
lpImage->lpAND = lpImage->lpXOR + (lpImage->Height*
- BytesPerLine((LPBITMAPINFOHEADER)(lpImage->lpbi)));
+ BytesPerLine((LPBITMAPINFOHEADER)(lpImage->lpbi)));
return TRUE;
}
@@ -712,50 +748,70 @@ AdjustIconImagePointers( LPICONIMAGE lpImage )
*
* MakeIconOrCursorFromResource --
*
- * Construct an actual HICON structure from the information
- * in a resource.
+ * Construct an actual HICON structure from the information in a
+ * resource.
*
* Results:
- *
- *
- * Side effects:
- *
+ * Icon
*
*----------------------------------------------------------------------
*/
-static HICON
-MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon) {
+
+static HICON
+MakeIconOrCursorFromResource(
+ LPICONIMAGE lpIcon,
+ BOOL isIcon)
+{
HICON hIcon ;
static FARPROC pfnCreateIconFromResourceEx=NULL;
static int initinfo=0;
- /* Sanity Check */
- if (lpIcon == NULL)
+
+ /*
+ * Sanity Check
+ */
+
+ if (lpIcon == NULL) {
return NULL;
- if (lpIcon->lpBits == NULL)
+ }
+ if (lpIcon->lpBits == NULL) {
return NULL;
+ }
+
if (!initinfo) {
HMODULE hMod = GetModuleHandleA("USER32.DLL");
- initinfo=1;
- if (hMod){
- pfnCreateIconFromResourceEx =
- GetProcAddress(hMod, "CreateIconFromResourceEx");
- }
- }
- /* Let the OS do the real work :) */
- if (pfnCreateIconFromResourceEx!=NULL) {
- hIcon = (HICON) (pfnCreateIconFromResourceEx)
- (lpIcon->lpBits, lpIcon->dwNumBytes, isIcon, 0x00030000,
- (*(LPBITMAPINFOHEADER)(lpIcon->lpBits)).biWidth,
- (*(LPBITMAPINFOHEADER)(lpIcon->lpBits)).biHeight/2, 0);
+
+ initinfo = 1;
+ if (hMod) {
+ pfnCreateIconFromResourceEx =
+ GetProcAddress(hMod, "CreateIconFromResourceEx");
+ }
+ }
+
+ /*
+ * Let the OS do the real work :)
+ */
+
+ if (pfnCreateIconFromResourceEx != NULL) {
+ hIcon = (HICON) (pfnCreateIconFromResourceEx) (lpIcon->lpBits,
+ lpIcon->dwNumBytes, isIcon, 0x00030000,
+ (*(LPBITMAPINFOHEADER)(lpIcon->lpBits)).biWidth,
+ (*(LPBITMAPINFOHEADER)(lpIcon->lpBits)).biHeight/2, 0);
} else {
hIcon = NULL;
}
- /* It failed, odds are good we're on NT so try the non-Ex way */
+
+ /*
+ * It failed, odds are good we're on NT so try the non-Ex way.
+ */
+
if (hIcon == NULL) {
- /* We would break on NT if we try with a 16bpp image */
+ /*
+ * We would break on NT if we try with a 16bpp image.
+ */
+
if (lpIcon->lpbi->bmiHeader.biBitCount != 16) {
- hIcon = CreateIconFromResource(lpIcon->lpBits, lpIcon->dwNumBytes,
- isIcon, 0x00030000);
+ hIcon = CreateIconFromResource(lpIcon->lpBits, lpIcon->dwNumBytes,
+ isIcon, 0x00030000);
}
}
return hIcon;
@@ -769,44 +825,51 @@ MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon) {
* Reads the header from an ICO file, as specfied by channel.
*
* Results:
- * UINT - Number of images in file, -1 for failure.
- * If this succeeds, there is a decent chance this is a
- * valid icon file.
- *
- * Side effects:
- *
+ * UINT - Number of images in file, -1 for failure. If this succeeds,
+ * there is a decent chance this is a valid icon file.
*
*----------------------------------------------------------------------
*/
-static int
-ReadICOHeader( Tcl_Channel channel )
+
+static int
+ReadICOHeader(
+ Tcl_Channel channel)
{
- WORD Input;
- DWORD dwBytesRead;
+ union {
+ WORD word;
+ char bytes[sizeof(WORD)];
+ } input;
+
+ /*
+ * Read the 'reserved' WORD, which should be a zero word.
+ */
- /* Read the 'reserved' WORD */
- dwBytesRead = Tcl_Read( channel, (char*)&Input, sizeof( WORD ));
- /* Did we get a WORD? */
- if (dwBytesRead != sizeof( WORD ))
+ if (Tcl_Read(channel, input.bytes, sizeof(WORD)) != sizeof(WORD)) {
return -1;
- /* Was it 'reserved' ? (ie 0) */
- if (Input != 0)
+ }
+ if (input.word != 0) {
return -1;
- /* Read the type WORD */
- dwBytesRead = Tcl_Read( channel, (char*)&Input, sizeof( WORD ));
- /* Did we get a WORD? */
- if (dwBytesRead != sizeof( WORD ))
+ }
+
+ /*
+ * Read the type WORD, which should be of type 1.
+ */
+
+ if (Tcl_Read(channel, input.bytes, sizeof(WORD)) != sizeof(WORD)) {
return -1;
- /* Was it type 1? */
- if (Input != 1)
+ }
+ if (input.word != 1) {
return -1;
- /* Get the count of images */
- dwBytesRead = Tcl_Read( channel, (char*)&Input, sizeof( WORD ));
- /* Did we get a WORD? */
- if (dwBytesRead != sizeof( WORD ))
+ }
+
+ /*
+ * Get and return the count of images.
+ */
+
+ if (Tcl_Read(channel, input.bytes, sizeof(WORD)) != sizeof(WORD)) {
return -1;
- /* Return the count */
- return (int)Input;
+ }
+ return (int) input.word;
}
/*
@@ -824,10 +887,12 @@ ReadICOHeader( Tcl_Channel channel )
*
*----------------------------------------------------------------------
*/
-static int
-InitWindowClass(WinIconPtr titlebaricon)
+
+static int
+InitWindowClass(
+ WinIconPtr titlebaricon)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (! tsdPtr->initialized) {
@@ -845,28 +910,28 @@ InitWindowClass(WinIconPtr titlebaricon)
if (shgetfileinfoProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("shell32");
if (hInstance != NULL) {
- shgetfileinfoProc =
- (DWORD* (WINAPI *) (LPCTSTR pszPath, DWORD dwFileAttributes,
- SHFILEINFO* psfi, UINT cbFileInfo, UINT uFlags)) GetProcAddress(hInstance,
- "SHGetFileInfo");
+ shgetfileinfoProc = (DWORD* (WINAPI *) (LPCTSTR pszPath,
+ DWORD dwFileAttributes, SHFILEINFO* psfi,
+ UINT cbFileInfo, UINT uFlags))
+ GetProcAddress(hInstance, "SHGetFileInfo");
FreeLibrary(hInstance);
}
}
if (setLayeredWindowAttributesProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("user32");
if (hInstance != NULL) {
- setLayeredWindowAttributesProc =
- (BOOL (WINAPI *) (HWND hwnd, COLORREF crKey,
- BYTE bAlpha, DWORD dwFlags))
- GetProcAddress(hInstance,
- "SetLayeredWindowAttributes");
+ setLayeredWindowAttributesProc = (BOOL (WINAPI*)(HWND hwnd,
+ COLORREF crKey, BYTE bAlpha, DWORD dwFlags))
+ GetProcAddress(hInstance,"SetLayeredWindowAttributes");
FreeLibrary(hInstance);
}
}
+
/*
- * The only difference between WNDCLASSW and WNDCLASSA are
- * in pointers, so we can use the generic structure WNDCLASS.
+ * The only difference between WNDCLASSW and WNDCLASSA are in
+ * pointers, so we can use the generic structure WNDCLASS.
*/
+
ZeroMemory(&class, sizeof(WNDCLASS));
class.style = CS_HREDRAW | CS_VREDRAW;
@@ -881,10 +946,12 @@ InitWindowClass(WinIconPtr titlebaricon)
if (class.hIcon == NULL) {
return TCL_ERROR;
}
+
/*
- * Store pointer to default icon so we know when
- * we need to free that information
+ * Store pointer to default icon so we know when we need to
+ * free that information
*/
+
tsdPtr->iconPtr = titlebaricon;
}
class.hCursor = LoadCursor(NULL, IDC_ARROW);
@@ -915,6 +982,7 @@ InitWindowClass(WinIconPtr titlebaricon)
*
*----------------------------------------------------------------------
*/
+
static void
InitWm(void)
{
@@ -927,52 +995,54 @@ InitWm(void)
*
* WinSetIcon --
*
- * Sets either the default toplevel titlebar icon, or the icon
- * for a specific toplevel (if tkw is given, then only that
- * window is used).
+ * Sets either the default toplevel titlebar icon, or the icon for a
+ * specific toplevel (if tkw is given, then only that window is used).
*
- * The ref-count of the titlebaricon is NOT changed. If this
- * function returns successfully, the caller should assume
- * the icon was used (and therefore the ref-count should
- * be adjusted to reflect that fact). If the function returned
- * an error, the caller should assume the icon was not used
- * (and may wish to free the memory associated with it).
+ * The ref-count of the titlebaricon is NOT changed. If this function
+ * returns successfully, the caller should assume the icon was used (and
+ * therefore the ref-count should be adjusted to reflect that fact). If
+ * the function returned an error, the caller should assume the icon was
+ * not used (and may wish to free the memory associated with it).
*
* Results:
* A standard Tcl return code.
*
* Side effects:
- * One or all windows may have their icon changed.
- * The Tcl result may be modified.
- * The window-manager will be initialised if it wasn't already.
+ * One or all windows may have their icon changed. The Tcl result may be
+ * modified. The window-manager will be initialised if it wasn't already.
* The given window will be forced into existence.
*
*----------------------------------------------------------------------
*/
+
static int
-WinSetIcon(interp, titlebaricon, tkw)
- Tcl_Interp *interp;
- WinIconPtr titlebaricon;
- Tk_Window tkw;
+WinSetIcon(
+ Tcl_Interp *interp,
+ WinIconPtr titlebaricon,
+ Tk_Window tkw)
{
WmInfo *wmPtr;
HWND hwnd;
int application = 0;
if (tkw == NULL) {
- tkw = Tk_MainWindow(interp);
+ tkw = Tk_MainWindow(interp);
application = 1;
}
if (!(Tk_IsTopLevel(tkw))) {
Tcl_AppendResult(interp, "window \"", Tk_PathName(tkw),
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
if (Tk_WindowId(tkw) == None) {
Tk_MakeWindowExist(tkw);
}
- /* We must get the window's wrapper, not the window itself */
+
+ /*
+ * We must get the window's wrapper, not the window itself.
+ */
+
wmPtr = ((TkWindow*)tkw)->wmInfoPtr;
hwnd = wmPtr->wrapper;
@@ -980,56 +1050,39 @@ WinSetIcon(interp, titlebaricon, tkw)
if (hwnd == NULL) {
/*
* I don't actually think this is ever the correct thing, unless
- * perhaps the window doesn't have a wrapper. But I believe all
+ * perhaps the window doesn't have a wrapper. But I believe all
* windows have wrappers.
*/
+
hwnd = Tk_GetHWND(Tk_WindowId(tkw));
}
+
/*
* If we aren't initialised, then just initialise with the user's
- * icon. Otherwise our icon choice will be ignored moments later
- * when Tk finishes initialising.
+ * icon. Otherwise our icon choice will be ignored moments later when
+ * Tk finishes initialising.
*/
+
if (!initialized) {
if (InitWindowClass(titlebaricon) != TCL_OK) {
- Tcl_AppendResult(interp,"Unable to set icon", (char*)NULL);
+ Tcl_AppendResult(interp, "Unable to set icon", NULL);
return TCL_ERROR;
}
} else {
ThreadSpecificData *tsdPtr;
- if (
-#ifdef _WIN64
- !SetClassLongPtr(hwnd, GCLP_HICONSM,
- (LPARAM)GetIcon(titlebaricon, ICON_SMALL))
-#else
- !SetClassLong(hwnd, GCL_HICONSM,
- (LPARAM)GetIcon(titlebaricon, ICON_SMALL))
-#endif
- ) {
- /*
- * For some reason this triggers, even though it seems
- * to be successful This is probably related to the
- * WNDCLASS vs WNDCLASSEX difference. Anyway it seems
- * we have to ignore errors returned here.
- */
- /*
- * Tcl_AppendResult(interp,"Unable to set new small icon", (char*)NULL);
- * return TCL_ERROR;
- */
- }
- if (
-#ifdef _WIN64
- !SetClassLongPtr(hwnd, GCLP_HICON,
- (LPARAM)GetIcon(titlebaricon, ICON_BIG))
-#else
- !SetClassLong(hwnd, GCL_HICON,
- (LPARAM)GetIcon(titlebaricon, ICON_BIG))
-#endif
- ) {
- Tcl_AppendResult(interp,"Unable to set new icon", (char*)NULL);
- return TCL_ERROR;
- }
+ /*
+ * Don't check return result of SetClassLong() or
+ * SetClassLongPtr() since they return the previously set value
+ * which is zero on the initial call or in an error case. The MSDN
+ * documentation does not indicate that the result needs to be
+ * checked.
+ */
+
+ SetClassLongPtr(hwnd, GCLP_HICONSM,
+ (LPARAM) GetIcon(titlebaricon, ICON_SMALL));
+ SetClassLongPtr(hwnd, GCLP_HICON,
+ (LPARAM) GetIcon(titlebaricon, ICON_BIG));
tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->iconPtr != NULL) {
@@ -1040,31 +1093,35 @@ WinSetIcon(interp, titlebaricon, tkw)
} else {
if (!initialized) {
/*
- * Need to initialise the wm otherwise we will fail on
- * code which tries to set a toplevel's icon before that
- * happens. Ignore return result.
+ * Need to initialise the wm otherwise we will fail on code which
+ * tries to set a toplevel's icon before that happens. Ignore
+ * return result.
*/
- (void)InitWindowClass(NULL);
+
+ (void) InitWindowClass(NULL);
}
+
/*
* The following code is exercised if you do
*
* toplevel .t ; wm titlebaricon .t foo.icr
*
- * i.e. the wm hasn't had time to properly create
- * the '.t' window before you set the icon.
+ * i.e. the wm hasn't had time to properly create the '.t' window
+ * before you set the icon.
*/
+
if (hwnd == NULL) {
/*
- * This little snippet is copied from the 'Map' function,
- * and should probably be placed in one proper location
+ * This little snippet is copied from the 'Map' function, and
+ * should probably be placed in one proper location.
*/
+
UpdateWrapper(wmPtr->winPtr);
wmPtr = ((TkWindow*)tkw)->wmInfoPtr;
hwnd = wmPtr->wrapper;
if (hwnd == NULL) {
Tcl_AppendResult(interp,
- "Can't set icon; window has no wrapper.", (char*)NULL);
+ "Can't set icon; window has no wrapper.", NULL);
return TCL_ERROR;
}
}
@@ -1073,16 +1130,23 @@ WinSetIcon(interp, titlebaricon, tkw)
SendMessage(hwnd, WM_SETICON, ICON_BIG,
(LPARAM) GetIcon(titlebaricon, ICON_BIG));
- /* Update the iconPtr we keep for each WmInfo structure. */
+ /*
+ * Update the iconPtr we keep for each WmInfo structure.
+ */
+
if (wmPtr->iconPtr != NULL) {
- /* Free any old icon ptr which is associated with this window. */
+ /*
+ * Free any old icon ptr which is associated with this window.
+ */
+
DecrIconRefCount(wmPtr->iconPtr);
}
+
/*
- * We do not need to increment the ref count for the
- * titlebaricon, because it was already incremented when we
- * retrieved it.
+ * We do not need to increment the ref count for the titlebaricon,
+ * because it was already incremented when we retrieved it.
*/
+
wmPtr->iconPtr = titlebaricon;
}
return TCL_OK;
@@ -1093,8 +1157,8 @@ WinSetIcon(interp, titlebaricon, tkw)
*
* TkWinGetIcon --
*
- * Gets either the default toplevel titlebar icon, or the icon
- * for a specific toplevel (ICON_SMALL or ICON_BIG).
+ * Gets either the default toplevel titlebar icon, or the icon for a
+ * specific toplevel (ICON_SMALL or ICON_BIG).
*
* Results:
* A Windows HICON.
@@ -1104,22 +1168,29 @@ WinSetIcon(interp, titlebaricon, tkw)
*
*----------------------------------------------------------------------
*/
+
HICON
-TkWinGetIcon(Tk_Window tkwin, DWORD iconsize)
+TkWinGetIcon(
+ Tk_Window tkwin,
+ DWORD iconsize)
{
WmInfo *wmPtr;
HICON icon;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->iconPtr != NULL) {
/*
* return default toplevel icon
*/
- return GetIcon(tsdPtr->iconPtr, iconsize);
+
+ return GetIcon(tsdPtr->iconPtr, (int)iconsize);
}
- /* ensure we operate on the toplevel, that has the icon refs */
+ /*
+ * Ensure we operate on the toplevel, that has the icon refs.
+ */
+
while (!Tk_IsTopLevel(tkwin)) {
tkwin = Tk_Parent(tkwin);
if (tkwin == NULL) {
@@ -1136,23 +1207,20 @@ TkWinGetIcon(Tk_Window tkwin, DWORD iconsize)
/*
* return window toplevel icon
*/
- return GetIcon(wmPtr->iconPtr, iconsize);
+
+ return GetIcon(wmPtr->iconPtr, (int)iconsize);
}
/*
- * Find the icon otherwise associated with the toplevel, or
- * finally with the window class.
+ * Find the icon otherwise associated with the toplevel, or finally with
+ * the window class.
*/
+
icon = (HICON) SendMessage(wmPtr->wrapper, WM_GETICON, iconsize,
(LPARAM) NULL);
if (icon == (HICON) NULL) {
-#ifdef _WIN64
icon = (HICON) GetClassLongPtr(wmPtr->wrapper,
(iconsize == ICON_BIG) ? GCLP_HICON : GCLP_HICONSM);
-#else
- icon = (HICON) GetClassLong(wmPtr->wrapper,
- (iconsize == ICON_BIG) ? GCL_HICON : GCL_HICONSM);
-#endif
}
return icon;
}
@@ -1162,117 +1230,129 @@ TkWinGetIcon(Tk_Window tkwin, DWORD iconsize)
*
* ReadIconFromFile --
*
- * Read the contents of a file (usually .ico, .icr) and extract an
- * icon resource, if possible, otherwise check if the shell has an
- * icon assigned to the given file and use that. If both of those
- * fail, then NULL is returned, and an error message will already be
- * in the interpreter.
- *
+ * Read the contents of a file (usually .ico, .icr) and extract an icon
+ * resource, if possible, otherwise check if the shell has an icon
+ * assigned to the given file and use that. If both of those fail, then
+ * NULL is returned, and an error message will already be in the
+ * interpreter.
+ *
* Results:
- * A WinIconPtr structure containing the icons in the file, with
- * its ref count already incremented. The calling procedure should
- * either place this structure inside a WmInfo structure, or it should
- * pass it on to DecrIconRefCount() to ensure no memory leaks occur.
+ * A WinIconPtr structure containing the icons in the file, with its ref
+ * count already incremented. The calling function should either place
+ * this structure inside a WmInfo structure, or it should pass it on to
+ * DecrIconRefCount() to ensure no memory leaks occur.
*
* If the given fileName did not contain a valid icon structure,
* return NULL.
*
* Side effects:
- * Memory is allocated for the returned structure and the icons
- * it contains. If the structure is not wanted, it should be
- * passed to DecrIconRefCount, and in any case a valid ref count
- * should be ensured to avoid memory leaks.
+ * Memory is allocated for the returned structure and the icons it
+ * contains. If the structure is not wanted, it should be passed to
+ * DecrIconRefCount, and in any case a valid ref count should be ensured
+ * to avoid memory leaks.
*
- * Currently icon resources are not shared, so the ref count of
- * one of these structures will always be 0 or 1. However all we
- * need do is implement some sort of lookup function between
- * filenames and WinIconPtr structures and no other code will need
- * to be changed. The pseudo-code for this is implemented below
- * in the 'if (0)' branch. It did not seem necessary to implement
- * this optimisation here, since moving to icon<->image
- * conversions will probably make it obsolete.
+ * Currently icon resources are not shared, so the ref count of one of
+ * these structures will always be 0 or 1. However all we need do is
+ * implement some sort of lookup function between filenames and
+ * WinIconPtr structures and no other code will need to be changed. The
+ * pseudo-code for this is implemented below in the 'if (0)' branch. It
+ * did not seem necessary to implement this optimisation here, since
+ * moving to icon<->image conversions will probably make it obsolete.
*
*----------------------------------------------------------------------
*/
+
static WinIconPtr
-ReadIconFromFile(interp, fileName)
- Tcl_Interp *interp;
- Tcl_Obj *fileName;
+ReadIconFromFile(
+ Tcl_Interp *interp,
+ Tcl_Obj *fileName)
{
WinIconPtr titlebaricon = NULL;
+ BlockOfIconImagesPtr lpIR;
if (0 /* If we already have an icon for this filename */) {
titlebaricon = NULL; /* Get the real value from a lookup */
titlebaricon->refCount++;
return titlebaricon;
- } else {
- /* First check if it is a .ico file */
- BlockOfIconImagesPtr lpIR;
- lpIR = ReadIconOrCursorFromFile(interp, fileName, TRUE);
+ }
- /*
- * Then see if we can ask the shell for the icon for this file.
- * We want both the regular and small icons so that the Alt-Tab
- * (task-switching) display uses the right icon.
- */
- if (lpIR == NULL && shgetfileinfoProc != NULL) {
- SHFILEINFO sfiSM;
- Tcl_DString ds, ds2;
- DWORD *res;
- CONST char *file;
-
- file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds);
- if (file == NULL) { return NULL; }
- Tcl_UtfToExternalDString(NULL, file, -1, &ds2);
- Tcl_DStringFree(&ds);
- res = (*shgetfileinfoProc)(Tcl_DStringValue(&ds2), 0, &sfiSM,
- sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON);
+ /*
+ * First check if it is a .ico file.
+ */
- if (res != 0) {
- SHFILEINFO sfi;
- int size;
-
- Tcl_ResetResult(interp);
- res = (*shgetfileinfoProc)(Tcl_DStringValue(&ds2), 0, &sfi,
- sizeof(SHFILEINFO), SHGFI_ICON);
-
- /* Account for extra icon, if necessary */
- size = sizeof(BlockOfIconImages) +
- ((res != 0) ? sizeof(ICONIMAGE) : 0);
- lpIR = (BlockOfIconImagesPtr) ckalloc(size);
- if (lpIR == NULL) {
- if (res != 0) {
- DestroyIcon(sfi.hIcon);
- }
- DestroyIcon(sfiSM.hIcon);
- Tcl_DStringFree(&ds2);
- return NULL;
- }
- ZeroMemory(lpIR, size);
+ lpIR = ReadIconOrCursorFromFile(interp, fileName, TRUE);
+
+ /*
+ * Then see if we can ask the shell for the icon for this file. We
+ * want both the regular and small icons so that the Alt-Tab (task-
+ * switching) display uses the right icon.
+ */
+
+ if (lpIR == NULL && shgetfileinfoProc != NULL) {
+ SHFILEINFO sfiSM;
+ Tcl_DString ds, ds2;
+ DWORD *res;
+ CONST char *file;
+
+ file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds);
+ if (file == NULL) {
+ return NULL;
+ }
+ Tcl_UtfToExternalDString(NULL, file, -1, &ds2);
+ Tcl_DStringFree(&ds);
+ res = (*shgetfileinfoProc)(Tcl_DStringValue(&ds2), 0, &sfiSM,
+ sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON);
+
+ if (res != 0) {
+ SHFILEINFO sfi;
+ unsigned size;
- lpIR->nNumImages = ((res != 0) ? 2 : 1);
- lpIR->IconImages[0].Width = 16;
- lpIR->IconImages[0].Height = 16;
- lpIR->IconImages[0].Colors = 4;
- lpIR->IconImages[0].hIcon = sfiSM.hIcon;
- /* All other IconImages fields are ignored */
+ Tcl_ResetResult(interp);
+ res = (*shgetfileinfoProc)(Tcl_DStringValue(&ds2), 0, &sfi,
+ sizeof(SHFILEINFO), SHGFI_ICON);
+
+ /*
+ * Account for extra icon, if necessary.
+ */
+ size = sizeof(BlockOfIconImages)
+ + ((res != 0) ? sizeof(ICONIMAGE) : 0);
+ lpIR = (BlockOfIconImagesPtr) ckalloc(size);
+ if (lpIR == NULL) {
if (res != 0) {
- lpIR->IconImages[1].Width = 32;
- lpIR->IconImages[1].Height = 32;
- lpIR->IconImages[1].Colors = 4;
- lpIR->IconImages[1].hIcon = sfi.hIcon;
+ DestroyIcon(sfi.hIcon);
}
+ DestroyIcon(sfiSM.hIcon);
+ Tcl_DStringFree(&ds2);
+ return NULL;
+ }
+ ZeroMemory(lpIR, size);
+
+ lpIR->nNumImages = ((res != 0) ? 2 : 1);
+ lpIR->IconImages[0].Width = 16;
+ lpIR->IconImages[0].Height = 16;
+ lpIR->IconImages[0].Colors = 4;
+ lpIR->IconImages[0].hIcon = sfiSM.hIcon;
+
+ /*
+ * All other IconImages fields are ignored.
+ */
+
+ if (res != 0) {
+ lpIR->IconImages[1].Width = 32;
+ lpIR->IconImages[1].Height = 32;
+ lpIR->IconImages[1].Colors = 4;
+ lpIR->IconImages[1].hIcon = sfi.hIcon;
}
- Tcl_DStringFree(&ds2);
- }
- if (lpIR != NULL) {
- titlebaricon = (WinIconPtr) ckalloc(sizeof(WinIconInstance));
- titlebaricon->iconBlock = lpIR;
- titlebaricon->refCount = 1;
}
- return titlebaricon;
+ Tcl_DStringFree(&ds2);
}
+ if (lpIR != NULL) {
+ titlebaricon = (WinIconPtr) ckalloc(sizeof(WinIconInstance));
+ titlebaricon->iconBlock = lpIR;
+ titlebaricon->refCount = 1;
+ }
+ return titlebaricon;
}
/*
@@ -1280,90 +1360,93 @@ ReadIconFromFile(interp, fileName)
*
* GetIconFromPixmap --
*
- * Turn a Tk Pixmap (i.e. a bitmap) into an icon resource, if
- * possible, otherwise NULL is returned.
+ * Turn a Tk Pixmap (i.e. a bitmap) into an icon resource, if possible,
+ * otherwise NULL is returned.
*
* Results:
- * A WinIconPtr structure containing a conversion of the given
- * bitmap into an icon, with its ref count already incremented. The
- * calling procedure should either place this structure inside a
- * WmInfo structure, or it should pass it on to DecrIconRefCount()
- * to ensure no memory leaks occur.
- *
- * If the given pixmap did not contain a valid icon structure,
- * return NULL.
+ * A WinIconPtr structure containing a conversion of the given bitmap
+ * into an icon, with its ref count already incremented. The calling
+ * function should either place this structure inside a WmInfo structure,
+ * or it should pass it on to DecrIconRefCount() to ensure no memory
+ * leaks occur.
+ *
+ * If the given pixmap did not contain a valid icon structure, return
+ * NULL.
*
* Side effects:
- * Memory is allocated for the returned structure and the icons
- * it contains. If the structure is not wanted, it should be
- * passed to DecrIconRefCount, and in any case a valid ref count
- * should be ensured to avoid memory leaks.
- *
- * Currently icon resources are not shared, so the ref count of
- * one of these structures will always be 0 or 1. However all we
- * need do is implement some sort of lookup function between
- * pixmaps and WinIconPtr structures and no other code will need
- * to be changed.
+ * Memory is allocated for the returned structure and the icons it
+ * contains. If the structure is not wanted, it should be passed to
+ * DecrIconRefCount, and in any case a valid ref count should be ensured
+ * to avoid memory leaks.
+ *
+ * Currently icon resources are not shared, so the ref count of one of
+ * these structures will always be 0 or 1. However all we need do is
+ * implement some sort of lookup function between pixmaps and WinIconPtr
+ * structures and no other code will need to be changed.
*
*----------------------------------------------------------------------
*/
-static WinIconPtr
-GetIconFromPixmap(dsPtr, pixmap)
- Display *dsPtr;
- Pixmap pixmap;
+
+static WinIconPtr
+GetIconFromPixmap(
+ Display *dsPtr,
+ Pixmap pixmap)
{
WinIconPtr titlebaricon = NULL;
- TkWinDrawable* twdPtr = (TkWinDrawable*) pixmap;
-
+ TkWinDrawable *twdPtr = (TkWinDrawable*) pixmap;
+ BlockOfIconImagesPtr lpIR;
+ ICONINFO icon;
+ HICON hIcon;
+ int width, height;
+
if (twdPtr == NULL) {
- return NULL;
+ return NULL;
}
-
+
if (0 /* If we already have an icon for this pixmap */) {
titlebaricon = NULL; /* Get the real value from a lookup */
titlebaricon->refCount++;
return titlebaricon;
- } else {
- BlockOfIconImagesPtr lpIR;
- ICONINFO icon;
- HICON hIcon;
- int width, height;
+ }
- Tk_SizeOfBitmap(dsPtr, pixmap, &width, &height);
+ Tk_SizeOfBitmap(dsPtr, pixmap, &width, &height);
- icon.fIcon = TRUE;
- icon.xHotspot = 0;
- icon.yHotspot = 0;
- icon.hbmMask = twdPtr->bitmap.handle;
- icon.hbmColor = twdPtr->bitmap.handle;
+ icon.fIcon = TRUE;
+ icon.xHotspot = 0;
+ icon.yHotspot = 0;
+ icon.hbmMask = twdPtr->bitmap.handle;
+ icon.hbmColor = twdPtr->bitmap.handle;
- hIcon = CreateIconIndirect(&icon);
- if (hIcon == NULL) {
- return NULL;
- }
+ hIcon = CreateIconIndirect(&icon);
+ if (hIcon == NULL) {
+ return NULL;
+ }
- lpIR = (BlockOfIconImagesPtr) ckalloc(sizeof(BlockOfIconImages));
- if (lpIR == NULL) {
- DestroyIcon(hIcon);
- return NULL;
- }
+ lpIR = (BlockOfIconImagesPtr) ckalloc(sizeof(BlockOfIconImages));
+ if (lpIR == NULL) {
+ DestroyIcon(hIcon);
+ return NULL;
+ }
- lpIR->nNumImages = 1;
- lpIR->IconImages[0].Width = width;
- lpIR->IconImages[0].Height = height;
- lpIR->IconImages[0].Colors = 1 << twdPtr->bitmap.depth;
- lpIR->IconImages[0].hIcon = hIcon;
- /* These fields are ignored */
- lpIR->IconImages[0].lpBits = 0;
- lpIR->IconImages[0].dwNumBytes = 0;
- lpIR->IconImages[0].lpXOR = 0;
- lpIR->IconImages[0].lpAND = 0;
+ lpIR->nNumImages = 1;
+ lpIR->IconImages[0].Width = width;
+ lpIR->IconImages[0].Height = height;
+ lpIR->IconImages[0].Colors = 1 << twdPtr->bitmap.depth;
+ lpIR->IconImages[0].hIcon = hIcon;
- titlebaricon = (WinIconPtr) ckalloc(sizeof(WinIconInstance));
- titlebaricon->iconBlock = lpIR;
- titlebaricon->refCount = 1;
- return titlebaricon;
- }
+ /*
+ * These fields are ignored.
+ */
+
+ lpIR->IconImages[0].lpBits = 0;
+ lpIR->IconImages[0].dwNumBytes = 0;
+ lpIR->IconImages[0].lpXOR = 0;
+ lpIR->IconImages[0].lpAND = 0;
+
+ titlebaricon = (WinIconPtr) ckalloc(sizeof(WinIconInstance));
+ titlebaricon->iconBlock = lpIR;
+ titlebaricon->refCount = 1;
+ return titlebaricon;
}
/*
@@ -1377,14 +1460,17 @@ GetIconFromPixmap(dsPtr, pixmap)
* None.
*
* Side effects:
- * If the ref count falls to zero, free the memory associated
- * with the icon resource structures. In this case the pointer
- * passed into this function is no longer valid.
+ * If the ref count falls to zero, free the memory associated with the
+ * icon resource structures. In this case the pointer passed into this
+ * function is no longer valid.
*
*----------------------------------------------------------------------
*/
-static void
-DecrIconRefCount(WinIconPtr titlebaricon) {
+
+static void
+DecrIconRefCount(
+ WinIconPtr titlebaricon)
+{
titlebaricon->refCount--;
if (titlebaricon->refCount <= 0) {
@@ -1402,9 +1488,8 @@ DecrIconRefCount(WinIconPtr titlebaricon) {
*
* FreeIconBlock --
*
- * Frees all memory associated with a previously loaded
- * titlebaricon. The icon block pointer is no longer
- * valid once this function returns.
+ * Frees all memory associated with a previously loaded titlebaricon.
+ * The icon block pointer is no longer valid once this function returns.
*
* Results:
* None.
@@ -1414,12 +1499,17 @@ DecrIconRefCount(WinIconPtr titlebaricon) {
*
*----------------------------------------------------------------------
*/
-static void
-FreeIconBlock(BlockOfIconImagesPtr lpIR)
+
+static void
+FreeIconBlock(
+ BlockOfIconImagesPtr lpIR)
{
int i;
- /* Free all the bits */
+ /*
+ * Free all the bits.
+ */
+
for (i=0; i< lpIR->nNumImages; i++) {
if (lpIR->IconImages[i].lpBits != NULL) {
ckfree((char*)lpIR->IconImages[i].lpBits);
@@ -1441,18 +1531,18 @@ FreeIconBlock(BlockOfIconImagesPtr lpIR)
* Results:
* Returns the icon, if found, else NULL.
*
- * Side effects:
- *
- *
*----------------------------------------------------------------------
*/
-static HICON
-GetIcon(WinIconPtr titlebaricon, int icon_size)
+
+static HICON
+GetIcon(
+ WinIconPtr titlebaricon,
+ int icon_size)
{
BlockOfIconImagesPtr lpIR;
-
+
if (titlebaricon == NULL) {
- return NULL;
+ return NULL;
}
lpIR = titlebaricon->iconBlock;
@@ -1463,18 +1553,21 @@ GetIcon(WinIconPtr titlebaricon, int icon_size)
int i;
for (i = 0; i < lpIR->nNumImages; i++) {
- /* Take the first or a 32x32 16 color icon*/
+ /*
+ * Take the first or a 32x32 16 color icon
+ */
+
if ((lpIR->IconImages[i].Height == size)
- && (lpIR->IconImages[i].Width == size)
- && (lpIR->IconImages[i].Colors >= 4)) {
+ && (lpIR->IconImages[i].Width == size)
+ && (lpIR->IconImages[i].Colors >= 4)) {
return lpIR->IconImages[i].hIcon;
}
}
- /*
- * If we get here, then just return the first one,
- * it will have to do!
+ /*
+ * If we get here, then just return the first one, it will have to do!
*/
+
if (lpIR->nNumImages >= 1) {
return lpIR->IconImages[0].hIcon;
}
@@ -1482,38 +1575,64 @@ GetIcon(WinIconPtr titlebaricon, int icon_size)
return NULL;
}
+#if 0 /* UNUSED */
+static HCURSOR
+TclWinReadCursorFromFile(
+ Tcl_Interp* interp,
+ Tcl_Obj* fileName)
+{
+ BlockOfIconImagesPtr lpIR;
+ HICON res = NULL;
+
+ lpIR = ReadIconOrCursorFromFile(interp, fileName, FALSE);
+ if (lpIR == NULL) {
+ return NULL;
+ }
+ if (lpIR->nNumImages >= 1) {
+ res = CopyImage(lpIR->IconImages[0].hIcon, IMAGE_CURSOR,0,0,0);
+ }
+ FreeIconBlock(lpIR);
+ return res;
+}
+#endif
+
/*
*----------------------------------------------------------------------
*
* ReadIconOrCursorFromFile --
*
- * Reads an Icon Resource from an ICO file, as given by
- * char* fileName - Name of the ICO file. This name should
- * be in Utf format.
+ * Reads an Icon Resource from an ICO file, as given by char* fileName -
+ * Name of the ICO file. This name should be in Utf format.
*
* Results:
* Returns an icon resource, if found, else NULL.
*
* Side effects:
- * May leave error messages in the Tcl interpreter.
+ * May leave error messages in the Tcl interpreter.
*
*----------------------------------------------------------------------
*/
-static BlockOfIconImagesPtr
-ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon)
+
+static BlockOfIconImagesPtr
+ReadIconOrCursorFromFile(
+ Tcl_Interp *interp,
+ Tcl_Obj *fileName,
+ BOOL isIcon)
{
- BlockOfIconImagesPtr lpIR, lpNew;
- Tcl_Channel channel;
- int i;
- DWORD dwBytesRead;
- LPICONDIRENTRY lpIDE;
+ BlockOfIconImagesPtr lpIR;
+ Tcl_Channel channel;
+ int i;
+ DWORD dwBytesRead;
+ LPICONDIRENTRY lpIDE;
+
+ /*
+ * Open the file.
+ */
- /* Open the file */
channel = Tcl_FSOpenFileChannel(interp, fileName, "r", 0);
if (channel == NULL) {
- Tcl_AppendResult(interp,"Error opening file \"",
- Tcl_GetString(fileName),
- "\" for reading",(char*)NULL);
+ Tcl_AppendResult(interp,"Error opening file \"",
+ Tcl_GetString(fileName), "\" for reading", NULL);
return NULL;
}
if (Tcl_SetChannelOption(interp, channel, "-translation", "binary")
@@ -1526,99 +1645,127 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon)
Tcl_Close(NULL, channel);
return NULL;
}
- /* Allocate memory for the resource structure */
+
+ /*
+ * Allocate memory for the resource structure
+ */
+
lpIR = (BlockOfIconImagesPtr) ckalloc(sizeof(BlockOfIconImages));
- if (lpIR == NULL) {
- Tcl_AppendResult(interp,"Error allocating memory",(char*)NULL);
- Tcl_Close(NULL, channel);
- return NULL;
- }
- /* Read in the header */
- if ((lpIR->nNumImages = ReadICOHeader( channel )) == -1) {
- Tcl_AppendResult(interp,"Invalid file header",(char*)NULL);
- Tcl_Close(NULL, channel);
- ckfree((char*) lpIR );
- return NULL;
- }
- /* Adjust the size of the struct to account for the images */
- lpNew = (BlockOfIconImagesPtr) ckrealloc((char*)lpIR,
- sizeof(BlockOfIconImages) + ((lpIR->nNumImages-1) * sizeof(ICONIMAGE)));
- if (lpNew == NULL) {
- Tcl_AppendResult(interp,"Error allocating memory",(char*)NULL);
+
+ /*
+ * Read in the header
+ */
+
+ if ((lpIR->nNumImages = ReadICOHeader(channel)) == -1) {
+ Tcl_AppendResult(interp, "Invalid file header", NULL);
Tcl_Close(NULL, channel);
- ckfree( (char*)lpIR );
+ ckfree((char*) lpIR);
return NULL;
}
- lpIR = lpNew;
- /* Allocate enough memory for the icon directory entries */
+
+ /*
+ * Adjust the size of the struct to account for the images.
+ */
+
+ lpIR = (BlockOfIconImagesPtr) ckrealloc((char*) lpIR,
+ sizeof(BlockOfIconImages)
+ + ((lpIR->nNumImages - 1) * sizeof(ICONIMAGE)));
+
+ /*
+ * Allocate enough memory for the icon directory entries.
+ */
+
lpIDE = (LPICONDIRENTRY) ckalloc(lpIR->nNumImages * sizeof(ICONDIRENTRY));
- if (lpIDE == NULL) {
- Tcl_AppendResult(interp,"Error allocating memory",(char*)NULL);
- Tcl_Close(NULL, channel);
- ckfree( (char*)lpIR );
- return NULL;
- }
- /* Read in the icon directory entries */
- dwBytesRead = Tcl_Read(channel, (char*)lpIDE,
- lpIR->nNumImages * sizeof( ICONDIRENTRY ));
- if (dwBytesRead != lpIR->nNumImages * sizeof( ICONDIRENTRY )) {
- Tcl_AppendResult(interp,"Error reading file",(char*)NULL);
+
+ /*
+ * Read in the icon directory entries.
+ */
+
+ dwBytesRead = Tcl_Read(channel, (char*) lpIDE,
+ (int)(lpIR->nNumImages * sizeof(ICONDIRENTRY)));
+ if (dwBytesRead != lpIR->nNumImages * sizeof(ICONDIRENTRY)) {
+ Tcl_AppendResult(interp, "Error reading file", NULL);
Tcl_Close(NULL, channel);
- ckfree( (char*)lpIR );
+ ckfree((char *) lpIDE);
+ ckfree((char *) lpIR);
return NULL;
}
- /* NULL-out everything to make memory management easier */
- for( i = 0; i < lpIR->nNumImages; i++ ) {
+
+ /*
+ * NULL-out everything to make memory management easier.
+ */
+
+ for (i = 0; i < lpIR->nNumImages; i++) {
lpIR->IconImages[i].lpBits = NULL;
}
- /* Loop through and read in each image */
- for( i = 0; i < lpIR->nNumImages; i++ ) {
- /* Allocate memory for the resource */
+
+ /*
+ * Loop through and read in each image.
+ */
+
+ for (i=0 ; i<lpIR->nNumImages ; i++) {
+ /*
+ * Allocate memory for the resource.
+ */
+
lpIR->IconImages[i].lpBits = (LPBYTE) ckalloc(lpIDE[i].dwBytesInRes);
- if (lpIR->IconImages[i].lpBits == NULL) {
- Tcl_AppendResult(interp,"Error allocating memory",(char*)NULL);
- goto readError;
- }
lpIR->IconImages[i].dwNumBytes = lpIDE[i].dwBytesInRes;
- /* Seek to beginning of this image */
+
+ /*
+ * Seek to beginning of this image.
+ */
+
if (Tcl_Seek(channel, lpIDE[i].dwImageOffset, FILE_BEGIN) == -1) {
- Tcl_AppendResult(interp,"Error seeking in file",(char*)NULL);
+ Tcl_AppendResult(interp, "Error seeking in file", NULL);
goto readError;
}
- /* Read it in */
- dwBytesRead = Tcl_Read(channel, (char *) lpIR->IconImages[i].lpBits,
- lpIDE[i].dwBytesInRes);
+
+ /*
+ * Read it in.
+ */
+
+ dwBytesRead = Tcl_Read(channel, (char *) lpIR->IconImages[i].lpBits,
+ (int) lpIDE[i].dwBytesInRes);
if (dwBytesRead != lpIDE[i].dwBytesInRes) {
- Tcl_AppendResult(interp,"Error reading file",(char*)NULL);
+ Tcl_AppendResult(interp, "Error reading file", NULL);
goto readError;
}
- /* Set the internal pointers appropriately */
+
+ /*
+ * Set the internal pointers appropriately.
+ */
+
if (!AdjustIconImagePointers( &(lpIR->IconImages[i]))) {
- Tcl_AppendResult(interp,"Error converting to internal format",
- (char*)NULL);
+ Tcl_AppendResult(interp, "Error converting to internal format",
+ NULL);
goto readError;
}
lpIR->IconImages[i].hIcon =
- MakeIconOrCursorFromResource(&(lpIR->IconImages[i]), isIcon);
+ MakeIconOrCursorFromResource(&(lpIR->IconImages[i]), isIcon);
}
- /* Clean up */
- ckfree((char*)lpIDE);
+
+ /*
+ * Clean up
+ */
+
+ ckfree((char *) lpIDE);
Tcl_Close(NULL, channel);
if (lpIR == NULL){
- Tcl_AppendResult(interp,"Reading of ", Tcl_GetString(fileName),
- " failed!",(char*)NULL);
+ Tcl_AppendResult(interp, "Reading of ", Tcl_GetString(fileName),
+ " failed!", NULL);
return NULL;
}
return lpIR;
+
readError:
Tcl_Close(NULL, channel);
- for( i = 0; i < lpIR->nNumImages; i++ ) {
- if (lpIR->IconImages[i].lpBits != NULL) {
- ckfree((char*)lpIR->IconImages[i].lpBits);
+ for (i = 0; i < lpIR->nNumImages; i++) {
+ if (lpIR->IconImages[i].lpBits != NULL) {
+ ckfree((char *) lpIR->IconImages[i].lpBits);
}
}
- ckfree((char*)lpIDE );
- ckfree((char*)lpIR );
+ ckfree((char *) lpIDE);
+ ckfree((char *) lpIR);
return NULL;
}
@@ -1627,8 +1774,7 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon)
*
* GetTopLevel --
*
- * This function retrieves the TkWindow associated with the
- * given HWND.
+ * This function retrieves the TkWindow associated with the given HWND.
*
* Results:
* Returns the matching TkWindow.
@@ -1638,27 +1784,24 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon)
*
*----------------------------------------------------------------------
*/
+
static TkWindow *
-GetTopLevel(hwnd)
- HWND hwnd;
+GetTopLevel(
+ HWND hwnd)
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * If this function is called before the CreateWindowEx call
- * has completed, then the user data slot will not have been
- * set yet, so we use the global createWindow variable.
+ * If this function is called before the CreateWindowEx call has
+ * completed, then the user data slot will not have been set yet, so we
+ * use the global createWindow variable.
*/
if (tsdPtr->createWindow) {
return tsdPtr->createWindow;
}
-#ifdef _WIN64
return (TkWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-#else
- return (TkWindow *) GetWindowLong(hwnd, GWL_USERDATA);
-#endif
}
/*
@@ -1672,16 +1815,16 @@ GetTopLevel(hwnd)
* None.
*
* Side effects:
- * Changes the values of the info pointer to reflect the current
- * minimum and maximum size values.
+ * Changes the values of the info pointer to reflect the current minimum
+ * and maximum size values.
*
*----------------------------------------------------------------------
*/
static void
-SetLimits(hwnd, info)
- HWND hwnd;
- MINMAXINFO *info;
+SetLimits(
+ HWND hwnd,
+ MINMAXINFO *info)
{
register WmInfo *wmPtr;
int maxWidth, maxHeight;
@@ -1731,8 +1874,8 @@ SetLimits(hwnd, info)
}
/*
- * If the window isn't supposed to be resizable, then set the
- * minimum and maximum dimensions to be the same as the current size.
+ * If the window isn't supposed to be resizable, then set the minimum and
+ * maximum dimensions to be the same as the current size.
*/
if (!(wmPtr->flags & WM_SYNC_PENDING)) {
@@ -1754,8 +1897,8 @@ SetLimits(hwnd, info)
*
* TkWinWmCleanup --
*
- * Unregisters classes registered by the window manager. This is
- * called from the DLL main entry point when the DLL is unloaded.
+ * Unregisters classes registered by the window manager. This is called
+ * from the DLL main entry point when the DLL is unloaded.
*
* Results:
* None.
@@ -1767,19 +1910,19 @@ SetLimits(hwnd, info)
*/
void
-TkWinWmCleanup(hInstance)
- HINSTANCE hInstance;
+TkWinWmCleanup(
+ HINSTANCE hInstance)
{
ThreadSpecificData *tsdPtr;
/*
- * If we're using stubs to access the Tcl library, and they
- * haven't been initialized, we can't call Tcl_GetThreadData.
+ * If we're using stubs to access the Tcl library, and they haven't been
+ * initialized, we can't call Tcl_GetThreadData.
*/
#ifdef USE_TCL_STUBS
if (tclStubsPtr == NULL) {
- return;
+ return;
}
#endif
@@ -1789,10 +1932,10 @@ TkWinWmCleanup(hInstance)
initialized = 0;
tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
- return;
+ return;
}
tsdPtr->initialized = 0;
@@ -1804,9 +1947,8 @@ TkWinWmCleanup(hInstance)
*
* TkWmNewWindow --
*
- * This procedure is invoked whenever a new top-level
- * window is created. Its job is to initialize the WmInfo
- * structure for the window.
+ * This function is invoked whenever a new top-level window is created.
+ * Its job is to initialize the WmInfo structure for the window.
*
* Results:
* None.
@@ -1818,8 +1960,8 @@ TkWinWmCleanup(hInstance)
*/
void
-TkWmNewWindow(winPtr)
- TkWindow *winPtr; /* Newly-created top-level window. */
+TkWmNewWindow(
+ TkWindow *winPtr) /* Newly-created top-level window. */
{
register WmInfo *wmPtr;
@@ -1828,6 +1970,7 @@ TkWmNewWindow(winPtr)
/*
* Initialize full structure, then set what isn't NULL
*/
+
ZeroMemory(wmPtr, sizeof(WmInfo));
winPtr->wmInfoPtr = wmPtr;
wmPtr->winPtr = winPtr;
@@ -1859,7 +2002,7 @@ TkWmNewWindow(winPtr)
wmPtr->x = winPtr->changes.x;
wmPtr->y = winPtr->changes.y;
wmPtr->crefObj = NULL;
- wmPtr->colorref = (COLORREF) NULL;
+ wmPtr->colorref = (COLORREF)0;
wmPtr->alpha = 1.0;
wmPtr->configWidth = -1;
@@ -1869,16 +2012,16 @@ TkWmNewWindow(winPtr)
winPtr->dispPtr->firstWmPtr = wmPtr;
/*
- * Tk must monitor structure events for top-level windows, in order
- * to detect size and position changes caused by window managers.
+ * Tk must monitor structure events for top-level windows, in order to
+ * detect size and position changes caused by window managers.
*/
Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask,
TopLevelEventProc, (ClientData) winPtr);
/*
- * Arrange for geometry requests to be reflected from the window
- * to the window manager.
+ * Arrange for geometry requests to be reflected from the window to the
+ * window manager.
*/
Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
@@ -1889,24 +2032,23 @@ TkWmNewWindow(winPtr)
*
* UpdateWrapper --
*
- * This function creates the wrapper window that contains the
- * window decorations and menus for a toplevel. This function
- * may be called after a window is mapped to change the window
- * style.
+ * This function creates the wrapper window that contains the window
+ * decorations and menus for a toplevel. This function may be called
+ * after a window is mapped to change the window style.
*
* Results:
* None.
*
* Side effects:
- * Destroys any old wrapper window and replaces it with a newly
- * created wrapper.
+ * Destroys any old wrapper window and replaces it with a newly created
+ * wrapper.
*
*----------------------------------------------------------------------
*/
static void
-UpdateWrapper(winPtr)
- TkWindow *winPtr; /* Top-level window to redecorate. */
+UpdateWrapper(
+ TkWindow *winPtr) /* Top-level window to redecorate. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
HWND parentHWND, oldWrapper = wmPtr->wrapper;
@@ -1918,21 +2060,24 @@ UpdateWrapper(winPtr)
Tcl_DString titleString, classString;
int *childStateInfo = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window == None) {
/*
* Ensure existence of the window to update the wrapper for.
*/
+
Tk_MakeWindowExist((Tk_Window) winPtr);
}
child = TkWinGetHWND(winPtr->window);
parentHWND = NULL;
+
/*
- * nextHWND will help us maintain Z order.
- * focusHWND will help us maintain focus, if we had it.
+ * nextHWND will help us maintain Z order. focusHWND will help us maintain
+ * focus, if we had it.
*/
+
nextHWND = NULL;
focusHWND = GetFocus();
if ((oldWrapper == NULL) || (oldWrapper != GetForegroundWindow())) {
@@ -1950,13 +2095,13 @@ UpdateWrapper(winPtr)
} else {
/*
- * Pick the decorative frame style. Override redirect windows get
+ * Pick the decorative frame style. Override redirect windows get
* created as undecorated popups if they have no transient parent,
- * otherwise they are children. This allows splash screens to operate
+ * otherwise they are children. This allows splash screens to operate
* as an independent window, while having dropdows (like for a
- * combobox) not grab focus away from their parent. Transient windows
- * get a modal dialog frame. Neither override, nor transient windows
- * appear in the Windows taskbar. Note that a transient window does
+ * combobox) not grab focus away from their parent. Transient windows
+ * get a modal dialog frame. Neither override, nor transient windows
+ * appear in the Windows taskbar. Note that a transient window does
* not resize by default, so we need to explicitly add the
* WS_THICKFRAME style if we want it to be resizeable.
*/
@@ -1964,13 +2109,20 @@ UpdateWrapper(winPtr)
if (winPtr->atts.override_redirect) {
wmPtr->style = WM_OVERRIDE_STYLE;
wmPtr->exStyle = EX_OVERRIDE_STYLE;
- /* parent must be desktop even if we have a transient parent */
+
+ /*
+ * Parent must be desktop even if we have a transient parent.
+ */
+
parentHWND = GetDesktopWindow();
if (wmPtr->masterPtr) {
wmPtr->style |= WS_CHILD;
} else {
wmPtr->style |= WS_POPUP;
}
+ } else if (wmPtr->flags & WM_FULLSCREEN) {
+ wmPtr->style = WM_FULLSCREEN_STYLE;
+ wmPtr->exStyle = EX_FULLSCREEN_STYLE;
} else if (wmPtr->masterPtr) {
wmPtr->style = WM_TRANSIENT_STYLE;
wmPtr->exStyle = EX_TRANSIENT_STYLE;
@@ -1984,7 +2136,7 @@ UpdateWrapper(winPtr)
wmPtr->exStyle = EX_TOPLEVEL_STYLE;
}
- wmPtr->style |= wmPtr->styleConfig;
+ wmPtr->style |= wmPtr->styleConfig;
wmPtr->exStyle |= wmPtr->exStyleConfig;
if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE)
@@ -1996,10 +2148,6 @@ UpdateWrapper(winPtr)
* Compute the geometry of the parent and child windows.
*/
- if ((wmPtr->flags & WM_UPDATE_PENDING)) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
- }
-
wmPtr->flags |= WM_CREATE_PENDING|WM_MOVE_PENDING;
UpdateGeometryInfo((ClientData)winPtr);
wmPtr->flags &= ~(WM_CREATE_PENDING|WM_MOVE_PENDING);
@@ -2009,11 +2157,17 @@ UpdateWrapper(winPtr)
/*
* Set the initial position from the user or program specified
- * location. If nothing has been specified, then let the system
- * pick a location.
+ * location. If nothing has been specified, then let the system pick a
+ * location. In full screen mode the x,y origin is 0,0 and the window
+ * width and height match that of the screen.
*/
- if (!(wmPtr->sizeHintsFlags & (USPosition | PPosition))
+ if (wmPtr->flags & WM_FULLSCREEN) {
+ x = 0;
+ y = 0;
+ width = WidthOfScreen(Tk_Screen(winPtr));
+ height = HeightOfScreen(Tk_Screen(winPtr));
+ } else if (!(wmPtr->sizeHintsFlags & (USPosition | PPosition))
&& (wmPtr->flags & WM_NEVER_MAPPED)) {
x = CW_USEDEFAULT;
y = CW_USEDEFAULT;
@@ -2023,14 +2177,16 @@ UpdateWrapper(winPtr)
}
/*
- * Create the containing window, and set the user data to point
- * to the TkWindow.
+ * Create the containing window, and set the user data to point to the
+ * TkWindow.
*/
tsdPtr->createWindow = winPtr;
Tcl_WinUtfToTChar(((wmPtr->title != NULL) ?
- wmPtr->title : winPtr->nameUid), -1, &titleString);
+ wmPtr->title : winPtr->nameUid), -1, &titleString);
+
Tcl_WinUtfToTChar(TK_WIN_TOPLEVEL_CLASS_NAME, -1, &classString);
+
wmPtr->wrapper = (*tkWinProcs->createWindowEx)(wmPtr->exStyle,
(LPCTSTR) Tcl_DStringValue(&classString),
(LPCTSTR) Tcl_DStringValue(&titleString),
@@ -2038,23 +2194,20 @@ UpdateWrapper(winPtr)
parentHWND, NULL, Tk_GetHINSTANCE(), NULL);
Tcl_DStringFree(&classString);
Tcl_DStringFree(&titleString);
-#ifdef _WIN64
- SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr);
-#else
- SetWindowLong(wmPtr->wrapper, GWL_USERDATA, (LONG) winPtr);
-#endif
+ SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (INT_PTR) winPtr);
tsdPtr->createWindow = NULL;
if ((wmPtr->exStyleConfig & WS_EX_LAYERED)
&& setLayeredWindowAttributesProc != NULL) {
/*
* The user supplies a double from [0..1], but Windows wants an
- * int (transparent) 0..255 (opaque), so do the translation.
- * Add the 0.5 to round the value.
+ * int (transparent) 0..255 (opaque), so do the translation. Add
+ * the 0.5 to round the value.
*/
+
setLayeredWindowAttributesProc((HWND) wmPtr->wrapper,
wmPtr->colorref, (BYTE) (wmPtr->alpha * 255 + 0.5),
- LWA_ALPHA | (wmPtr->crefObj ? LWA_COLORKEY : 0));
+ (unsigned)(LWA_ALPHA | (wmPtr->crefObj?LWA_COLORKEY:0)));
} else {
/*
* Layering not used or supported.
@@ -2071,9 +2224,8 @@ UpdateWrapper(winPtr)
wmPtr->x = place.rcNormalPosition.left;
wmPtr->y = place.rcNormalPosition.top;
- if (!(winPtr->flags & TK_ALREADY_DEAD)) {
+ if( !(winPtr->flags & TK_ALREADY_DEAD) )
TkInstallFrameMenu((Tk_Window) winPtr);
- }
if (oldWrapper && (oldWrapper != wmPtr->wrapper)
&& !(wmPtr->exStyle & WS_EX_TOPMOST)) {
@@ -2081,30 +2233,24 @@ UpdateWrapper(winPtr)
* We will adjust wrapper to have the same Z order as oldWrapper
* if it isn't a TOPMOST window.
*/
+
nextHWND = GetNextWindow(oldWrapper, GW_HWNDPREV);
}
}
/*
- * Now we need to reparent the contained window and set its
- * style appropriately. Be sure to update the style first so that
- * Windows doesn't try to set the focus to the child window.
+ * Now we need to reparent the contained window and set its style
+ * appropriately. Be sure to update the style first so that Windows
+ * doesn't try to set the focus to the child window.
*/
-#ifdef _WIN64
SetWindowLongPtr(child, GWL_STYLE,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
-#else
- SetWindowLong(child, GWL_STYLE,
- WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
-#endif
+
if (winPtr->flags & TK_EMBEDDED) {
-#ifdef _WIN64
- SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc);
-#else
- SetWindowLong(child, GWL_WNDPROC, (LONG) TopLevelProc);
-#endif
+ SetWindowLongPtr(child, GWLP_WNDPROC, (INT_PTR) TopLevelProc);
}
+
SetParent(child, wmPtr->wrapper);
if (oldWrapper) {
hSmallIcon = (HICON) SendMessage(oldWrapper, WM_GETICON, ICON_SMALL,
@@ -2115,32 +2261,29 @@ UpdateWrapper(winPtr)
if (oldWrapper && (oldWrapper != wmPtr->wrapper)
&& (oldWrapper != GetDesktopWindow())) {
-#ifdef _WIN64
- SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG) NULL);
-#else
- SetWindowLong(oldWrapper, GWL_USERDATA, (LONG) NULL);
-#endif
+ SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG) 0);
if (wmPtr->numTransients > 0) {
/*
* Unset the current wrapper as the parent for all transient
* children for whom this is the master
*/
+
WmInfo *wmPtr2;
- childStateInfo = (int *)ckalloc((unsigned) wmPtr->numTransients
- * sizeof(int));
+ childStateInfo = (int *)
+ ckalloc((unsigned) wmPtr->numTransients * sizeof(int));
state = 0;
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
- wmPtr2 = wmPtr2->nextPtr) {
- if (wmPtr2->masterPtr == winPtr) {
- if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
- childStateInfo[state++] = wmPtr2->hints.initial_state;
- SetParent(TkWinGetHWND(wmPtr2->winPtr->window), NULL);
- }
+ wmPtr2 = wmPtr2->nextPtr) {
+ if (wmPtr2->masterPtr == winPtr
+ && !(wmPtr2->flags & WM_NEVER_MAPPED)) {
+ childStateInfo[state++] = wmPtr2->hints.initial_state;
+ SetParent(TkWinGetHWND(wmPtr2->winPtr->window), NULL);
}
}
}
+
/*
* Remove the menubar before destroying the window so the menubar
* isn't destroyed.
@@ -2151,12 +2294,18 @@ UpdateWrapper(winPtr)
}
wmPtr->flags &= ~WM_NEVER_MAPPED;
- SendMessage(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0);
+ if (winPtr->flags & TK_EMBEDDED
+ && SendMessage(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM)child, 0)){
+ SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ,
+ Tk_ReqWidth((Tk_Window)winPtr),
+ Tk_ReqHeight((Tk_Window)winPtr));
+ SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM) wmPtr->hMenu,
+ (LPARAM) Tk_GetMenuHWND((Tk_Window) winPtr));
+ }
/*
- * Force an initial transition from withdrawn to the real
- * initial state. Set the Z order based on previous wrapper
- * before we set the state.
+ * Force an initial transition from withdrawn to the real initial state.
+ * Set the Z order based on previous wrapper before we set the state.
*/
state = wmPtr->hints.initial_state;
@@ -2167,6 +2316,7 @@ UpdateWrapper(winPtr)
|SWP_NOOWNERZORDER);
}
TkpWmSetState(winPtr, state);
+ wmPtr->hints.initial_state = state;
if (hSmallIcon != NULL) {
SendMessage(wmPtr->wrapper,WM_SETICON,ICON_SMALL,(LPARAM)hSmallIcon);
@@ -2176,15 +2326,18 @@ UpdateWrapper(winPtr)
}
/*
- * If we are embedded then force a mapping of the window now,
- * because we do not necessarily own the wrapper and may not
- * get another opportunity to map ourselves. We should not be
- * in either iconified or zoomed states when we get here, so
- * it is safe to just check for TK_EMBEDDED without checking
- * what state we are supposed to be in (default to NormalState).
+ * If we are embedded then force a mapping of the window now, because we
+ * do not necessarily own the wrapper and may not get another opportunity
+ * to map ourselves. We should not be in either iconified or zoomed states
+ * when we get here, so it is safe to just check for TK_EMBEDDED without
+ * checking what state we are supposed to be in (default to NormalState).
*/
if (winPtr->flags & TK_EMBEDDED) {
+ if(state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) {
+ TkpWmSetState(winPtr, NormalState);
+ wmPtr->hints.initial_state = NormalState;
+ }
XMapWindow(winPtr->display, winPtr->window);
}
@@ -2193,7 +2346,7 @@ UpdateWrapper(winPtr)
*/
if (wmPtr->hMenu != NULL) {
- wmPtr->flags = WM_SYNC_PENDING;
+ wmPtr->flags |= WM_SYNC_PENDING;
SetMenu(wmPtr->wrapper, wmPtr->hMenu);
wmPtr->flags &= ~WM_SYNC_PENDING;
}
@@ -2201,18 +2354,18 @@ UpdateWrapper(winPtr)
if (childStateInfo) {
if (wmPtr->numTransients > 0) {
/*
- * Reset all transient children for whom this is the master
+ * Reset all transient children for whom this is the master.
*/
+
WmInfo *wmPtr2;
state = 0;
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
- wmPtr2 = wmPtr2->nextPtr) {
- if (wmPtr2->masterPtr == winPtr) {
- if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
- UpdateWrapper(wmPtr2->winPtr);
- TkpWmSetState(wmPtr2->winPtr, childStateInfo[state++]);
- }
+ wmPtr2 = wmPtr2->nextPtr) {
+ if (wmPtr2->masterPtr == winPtr
+ && !(wmPtr2->flags & WM_NEVER_MAPPED)) {
+ UpdateWrapper(wmPtr2->winPtr);
+ TkpWmSetState(wmPtr2->winPtr, childStateInfo[state++]);
}
}
}
@@ -2221,11 +2374,11 @@ UpdateWrapper(winPtr)
}
/*
- * If this is the first window created by the application, then
- * we should activate the initial window. Otherwise, if this had
- * the focus, we need to restore that.
- * XXX: Rewrapping generates a <FocusOut> and <FocusIn> that would
- * XXX: best be avoided, if we could safely mask them.
+ * If this is the first window created by the application, then we should
+ * activate the initial window. Otherwise, if this had the focus, we need
+ * to restore that.
+ * XXX: Rewrapping generates a <FocusOut> and <FocusIn> that would best be
+ * XXX: avoided, if we could safely mask them.
*/
if (tsdPtr->firstWindow) {
@@ -2241,32 +2394,32 @@ UpdateWrapper(winPtr)
*
* TkWmMapWindow --
*
- * This procedure is invoked to map a top-level window. This
- * module gets a chance to update all window-manager-related
- * information in properties before the window manager sees
- * the map event and checks the properties. It also gets to
- * decide whether or not to even map the window after all.
+ * This function is invoked to map a top-level window. This module gets a
+ * chance to update all window-manager-related information in properties
+ * before the window manager sees the map event and checks the
+ * properties. It also gets to decide whether or not to even map the
+ * window after all.
*
* Results:
* None.
*
* Side effects:
- * Properties of winPtr may get updated to provide up-to-date
- * information to the window manager. The window may also get
- * mapped, but it may not be if this procedure decides that
- * isn't appropriate (e.g. because the window is withdrawn).
+ * Properties of winPtr may get updated to provide up-to-date information
+ * to the window manager. The window may also get mapped, but it may not
+ * be if this function decides that isn't appropriate (e.g. because the
+ * window is withdrawn).
*
*--------------------------------------------------------------
*/
void
-TkWmMapWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's about to
- * be mapped. */
+TkWmMapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
InitWm();
@@ -2278,7 +2431,7 @@ TkWmMapWindow(winPtr)
*/
if (wmPtr->masterPtr != NULL &&
- !Tk_IsMapped(wmPtr->masterPtr)) {
+ !Tk_IsMapped(wmPtr->masterPtr)) {
wmPtr->hints.initial_state = WithdrawnState;
return;
}
@@ -2288,7 +2441,7 @@ TkWmMapWindow(winPtr)
}
/*
- * Map the window in either the iconified or normal state. Note that
+ * Map the window in either the iconified or normal state. Note that
* we only send a map event if the window is in the normal state.
*/
@@ -2296,9 +2449,8 @@ TkWmMapWindow(winPtr)
}
/*
- * This is the first time this window has ever been mapped.
- * Store all the window-manager-related information for the
- * window.
+ * This is the first time this window has ever been mapped. Store all the
+ * window-manager-related information for the window.
*/
UpdateWrapper(winPtr);
@@ -2309,9 +2461,9 @@ TkWmMapWindow(winPtr)
*
* TkWmUnmapWindow --
*
- * This procedure is invoked to unmap a top-level window. The
- * only thing it does special is unmap the decorative frame before
- * unmapping the toplevel window.
+ * This function is invoked to unmap a top-level window. The only thing
+ * it does special is unmap the decorative frame before unmapping the
+ * toplevel window.
*
* Results:
* None.
@@ -2323,9 +2475,9 @@ TkWmMapWindow(winPtr)
*/
void
-TkWmUnmapWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's about to
- * be unmapped. */
+TkWmUnmapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * unmapped. */
{
TkpWmSetState(winPtr, WithdrawnState);
}
@@ -2335,8 +2487,8 @@ TkWmUnmapWindow(winPtr)
*
* TkpWmSetState --
*
- * Sets the window manager state for the wrapper window of a
- * given toplevel window.
+ * Sets the window manager state for the wrapper window of a given
+ * toplevel window.
*
* Results:
* None.
@@ -2348,13 +2500,13 @@ TkWmUnmapWindow(winPtr)
*/
void
-TkpWmSetState(winPtr, state)
- TkWindow *winPtr; /* Toplevel window to operate on. */
- int state; /* One of IconicState, ZoomState, NormalState,
+TkpWmSetState(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int state) /* One of IconicState, ZoomState, NormalState,
* or WithdrawnState. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- int cmd = 0;
+ int cmd;
if (wmPtr->flags & WM_NEVER_MAPPED) {
wmPtr->hints.initial_state = state;
@@ -2370,6 +2522,8 @@ TkpWmSetState(winPtr, state)
cmd = SW_SHOWNOACTIVATE;
} else if (state == ZoomState) {
cmd = SW_SHOWMAXIMIZED;
+ } else {
+ return;
}
ShowWindow(wmPtr->wrapper, cmd);
@@ -2377,13 +2531,103 @@ TkpWmSetState(winPtr, state)
}
/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWmSetFullScreen --
+ *
+ * Sets the fullscreen state for a toplevel window.
+ *
+ * Results:
+ * The WM_FULLSCREEN flag is updated.
+ *
+ * Side effects:
+ * May create a new wrapper window and raise it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TkpWmSetFullScreen(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int full_screen_state) /* True if window should be full screen */
+{
+ int changed = 0;
+ int full_screen = False;
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (full_screen_state) {
+ if (! (wmPtr->flags & WM_FULLSCREEN)) {
+ full_screen = True;
+ changed = 1;
+ }
+ } else {
+ if (wmPtr->flags & WM_FULLSCREEN) {
+ full_screen = False;
+ changed = 1;
+ }
+ }
+
+ if (changed) {
+ if (full_screen) {
+ wmPtr->flags |= WM_FULLSCREEN;
+ wmPtr->configX = wmPtr->x;
+ wmPtr->configY = wmPtr->y;
+ } else {
+ wmPtr->flags &= ~WM_FULLSCREEN;
+ wmPtr->x = wmPtr->configX;
+ wmPtr->y = wmPtr->configY;
+ }
+
+ /*
+ * If the window has been mapped, then we need to update the native
+ * wrapper window, and reset the focus to the widget that had it
+ * before.
+ */
+
+ if (!(wmPtr->flags & (WM_NEVER_MAPPED)
+ && !(winPtr->flags & TK_EMBEDDED))) {
+ TkWindow *focusWinPtr;
+
+ UpdateWrapper(winPtr);
+
+ focusWinPtr = TkGetFocusWin(winPtr);
+ if (focusWinPtr) {
+ TkSetFocusWin(focusWinPtr, 1);
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinGetState --
+ *
+ * This function returns state value of a toplevel window.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * May deiconify the toplevel window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpWmGetState(
+ TkWindow *winPtr)
+{
+ return winPtr->wmInfoPtr->hints.initial_state;
+}
+
+/*
*--------------------------------------------------------------
*
* TkWmDeadWindow --
*
- * This procedure is invoked when a top-level window is
- * about to be deleted. It cleans up the wm-related data
- * structures for the window.
+ * This function is invoked when a top-level window is about to be
+ * deleted. It cleans up the wm-related data structures for the window.
*
* Results:
* None.
@@ -2395,8 +2639,8 @@ TkpWmSetState(winPtr, state)
*/
void
-TkWmDeadWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's being deleted. */
+TkWmDeadWindow(
+ TkWindow *winPtr) /* Top-level window that's being deleted. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
WmInfo *wmPtr2;
@@ -2414,7 +2658,7 @@ TkWmDeadWindow(winPtr)
} else {
register WmInfo *prevPtr;
for (prevPtr = winPtr->dispPtr->firstWmPtr; ;
- prevPtr = prevPtr->nextPtr) {
+ prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
Tcl_Panic("couldn't unlink window in TkWmDeadWindow");
}
@@ -2434,8 +2678,8 @@ TkWmDeadWindow(winPtr)
if (wmPtr2->masterPtr == winPtr) {
wmPtr->numTransients--;
Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr,
- VisibilityChangeMask|StructureNotifyMask,
- WmWaitVisibilityOrMapProc, (ClientData) wmPtr2->winPtr);
+ VisibilityChangeMask|StructureNotifyMask,
+ WmWaitVisibilityOrMapProc, (ClientData) wmPtr2->winPtr);
wmPtr2->masterPtr = NULL;
if ((wmPtr2->wrapper != None)
&& !(wmPtr2->flags & (WM_NEVER_MAPPED))) {
@@ -2444,7 +2688,7 @@ TkWmDeadWindow(winPtr)
}
}
if (wmPtr->numTransients != 0)
- Tcl_Panic("numTransients should be 0");
+ Tcl_Panic("numTransients should be 0");
if (wmPtr->title != NULL) {
ckfree(wmPtr->title);
@@ -2488,10 +2732,11 @@ TkWmDeadWindow(winPtr)
}
if (wmPtr->masterPtr != NULL) {
wmPtr2 = wmPtr->masterPtr->wmInfoPtr;
+
/*
- * If we had a master, tell them that we aren't tied
- * to them anymore
+ * If we had a master, tell them that we aren't tied to them anymore.
*/
+
if (wmPtr2 != NULL) {
wmPtr2->numTransients--;
}
@@ -2512,17 +2757,22 @@ TkWmDeadWindow(winPtr)
if (!(winPtr->flags & TK_EMBEDDED)) {
if (wmPtr->wrapper != NULL) {
DestroyWindow(wmPtr->wrapper);
- } else {
+ } else if (winPtr->window) {
DestroyWindow(Tk_GetHWND(winPtr->window));
}
+ } else {
+ if (wmPtr->wrapper != NULL) {
+ SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0);
+ }
}
if (wmPtr->iconPtr != NULL) {
/*
- * This may delete the icon resource data. I believe we
- * should do this after destroying the decorative frame,
- * because the decorative frame is using this icon.
+ * This may delete the icon resource data. I believe we should do this
+ * after destroying the decorative frame, because the decorative frame
+ * is using this icon.
*/
- DecrIconRefCount(wmPtr->iconPtr);
+
+ DecrIconRefCount(wmPtr->iconPtr);
}
ckfree((char *) wmPtr);
@@ -2534,11 +2784,10 @@ TkWmDeadWindow(winPtr)
*
* TkWmSetClass --
*
- * This procedure is invoked whenever a top-level window's
- * class is changed. If the window has been mapped then this
- * procedure updates the window manager property for the
- * class. If the window hasn't been mapped, the update is
- * deferred until just before the first mapping.
+ * This function is invoked whenever a top-level window's class is
+ * changed. If the window has been mapped then this function updates the
+ * window manager property for the class. If the window hasn't been
+ * mapped, the update is deferred until just before the first mapping.
*
* Results:
* None.
@@ -2550,9 +2799,10 @@ TkWmDeadWindow(winPtr)
*/
void
-TkWmSetClass(winPtr)
- TkWindow *winPtr; /* Newly-created top-level window. */
+TkWmSetClass(
+ TkWindow *winPtr) /* Newly-created top-level window. */
{
+ /* Do nothing */
return;
}
@@ -2561,8 +2811,8 @@ TkWmSetClass(winPtr)
*
* Tk_WmObjCmd --
*
- * This procedure is invoked to process the "wm" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm" Tcl command. See the user
+ * documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2575,49 +2825,51 @@ TkWmSetClass(winPtr)
/* ARGSUSED */
int
-Tk_WmObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_WmObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
static CONST char *optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
- "command", "deiconify", "focusmodel", "frame",
+ "command", "deiconify", "focusmodel", "forget", "frame",
"geometry", "grid", "group", "iconbitmap",
"iconify", "iconmask", "iconname",
"iconphoto", "iconposition",
- "iconwindow", "maxsize", "minsize", "overrideredirect",
- "positionfrom", "protocol", "resizable", "sizefrom",
- "stackorder", "state", "title", "transient",
- "withdraw", (char *) NULL };
+ "iconwindow", "manage", "maxsize", "minsize", "overrideredirect",
+ "positionfrom", "protocol", "resizable", "sizefrom",
+ "stackorder", "state", "title", "transient",
+ "withdraw", NULL
+ };
enum options {
- WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
- WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FRAME,
+ WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
+ WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET, WMOPT_FRAME,
WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBITMAP,
WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME,
WMOPT_ICONPHOTO, WMOPT_ICONPOSITION,
- WMOPT_ICONWINDOW, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
- WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
- WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
- WMOPT_WITHDRAW };
+ WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
+ WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
+ WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
+ WMOPT_WITHDRAW
+ };
int index, length;
char *argv1;
- TkWindow *winPtr;
+ TkWindow *winPtr, **winPtrPtr = &winPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (objc < 2) {
- wrongNumArgs:
+ wrongNumArgs:
Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
return TCL_ERROR;
}
argv1 = Tcl_GetStringFromObj(objv[1], &length);
- if ((argv1[0] == 't') && (strncmp(argv1, "tracing", length) == 0)
+ if ((argv1[0] == 't') && !strncmp(argv1, "tracing", (unsigned) length)
&& (length >= 3)) {
int wmTracing;
+
if ((objc != 2) && (objc != 3)) {
Tcl_WrongNumArgs(interp, 2, objv, "?boolean?");
return TCL_ERROR;
@@ -2648,76 +2900,81 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
goto wrongNumArgs;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr)
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) winPtrPtr)
!= TCL_OK) {
return TCL_ERROR;
}
- if (!Tk_IsTopLevel(winPtr)) {
+ if (!Tk_IsTopLevel(winPtr) &&
+ (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
switch ((enum options) index) {
- case WMOPT_ASPECT:
+ case WMOPT_ASPECT:
return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ATTRIBUTES:
+ case WMOPT_ATTRIBUTES:
return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_CLIENT:
+ case WMOPT_CLIENT:
return WmClientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COLORMAPWINDOWS:
+ case WMOPT_COLORMAPWINDOWS:
return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COMMAND:
+ case WMOPT_COMMAND:
return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_DEICONIFY:
+ case WMOPT_DEICONIFY:
return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FOCUSMODEL:
+ case WMOPT_FOCUSMODEL:
return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FRAME:
+ case WMOPT_FORGET:
+ return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FRAME:
return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GEOMETRY:
+ case WMOPT_GEOMETRY:
return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GRID:
+ case WMOPT_GRID:
return WmGridCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GROUP:
+ case WMOPT_GROUP:
return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONBITMAP:
+ case WMOPT_ICONBITMAP:
return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONIFY:
+ case WMOPT_ICONIFY:
return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONMASK:
+ case WMOPT_ICONMASK:
return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONNAME:
+ case WMOPT_ICONNAME:
return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPHOTO:
- return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPOSITION:
+ case WMOPT_ICONPHOTO:
+ return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPOSITION:
return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONWINDOW:
+ case WMOPT_ICONWINDOW:
return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MAXSIZE:
+ case WMOPT_MANAGE:
+ return WmManageCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MAXSIZE:
return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MINSIZE:
+ case WMOPT_MINSIZE:
return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_OVERRIDEREDIRECT:
+ case WMOPT_OVERRIDEREDIRECT:
return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_POSITIONFROM:
+ case WMOPT_POSITIONFROM:
return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_PROTOCOL:
+ case WMOPT_PROTOCOL:
return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_RESIZABLE:
+ case WMOPT_RESIZABLE:
return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_SIZEFROM:
+ case WMOPT_SIZEFROM:
return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STACKORDER:
+ case WMOPT_STACKORDER:
return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STATE:
+ case WMOPT_STATE:
return WmStateCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TITLE:
+ case WMOPT_TITLE:
return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TRANSIENT:
+ case WMOPT_TRANSIENT:
return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_WITHDRAW:
+ case WMOPT_WITHDRAW:
return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
}
@@ -2730,8 +2987,8 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*
* WmAspectCmd --
*
- * This procedure is invoked to process the "wm aspect" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm aspect" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2743,12 +3000,12 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*/
static int
-WmAspectCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmAspectCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
@@ -2778,10 +3035,8 @@ WmAspectCmd(tkwin, winPtr, interp, objc, objv)
|| (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) {
return TCL_ERROR;
}
- if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
- (denom2 <= 0)) {
- Tcl_SetResult(interp, "aspect number can't be <= 0",
- TCL_STATIC);
+ if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) {
+ Tcl_SetResult(interp, "aspect number can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
wmPtr->minAspect.x = numer1;
@@ -2799,7 +3054,7 @@ WmAspectCmd(tkwin, winPtr, interp, objc, objv)
*
* WmAttributesCmd --
*
- * This procedure is invoked to process the "wm attributes" Tcl command.
+ * This function is invoked to process the "wm attributes" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2812,31 +3067,34 @@ WmAspectCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmAttributesCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- LONG style, exStyle, styleBit, *stylePtr;
+ LONG style, exStyle, styleBit, *stylePtr = NULL;
char *string;
- int i, boolean, length, updatewrapper = 0;
+ int i, boolean, length;
+ int config_fullscreen = 0, updatewrapper = 0;
+ int fullscreen_attr_changed = 0, fullscreen_attr = 0;
if ((objc < 3) || ((objc > 5) && ((objc%2) == 0))) {
- configArgs:
+ configArgs:
Tcl_WrongNumArgs(interp, 2, objv,
"window"
" ?-alpha ?double??"
" ?-transparentcolor ?color??"
" ?-disabled ?bool??"
+ " ?-fullscreen ?bool??"
" ?-toolwindow ?bool??"
" ?-topmost ?bool??");
return TCL_ERROR;
}
exStyle = wmPtr->exStyleConfig;
- style = wmPtr->styleConfig;
+ style = wmPtr->styleConfig;
if (objc == 3) {
Tcl_Obj *objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
@@ -2851,6 +3109,10 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewBooleanObj((style & WS_DISABLED)));
Tcl_ListObjAppendElement(NULL, objPtr,
+ Tcl_NewStringObj("-fullscreen", -1));
+ Tcl_ListObjAppendElement(NULL, objPtr,
+ Tcl_NewBooleanObj((wmPtr->flags & WM_FULLSCREEN)));
+ Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj("-toolwindow", -1));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewBooleanObj((exStyle & WS_EX_TOOLWINDOW)));
@@ -2866,16 +3128,19 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
if ((length < 2) || (string[0] != '-')) {
goto configArgs;
}
- if (strncmp(string, "-disabled", length) == 0) {
+ if (strncmp(string, "-disabled", (unsigned) length) == 0) {
stylePtr = &style;
styleBit = WS_DISABLED;
- } else if ((strncmp(string, "-alpha", length) == 0)
+ } else if ((strncmp(string, "-alpha", (unsigned) length) == 0)
|| ((length > 2) && (strncmp(string, "-transparentcolor",
- length) == 0))) {
+ (unsigned) length) == 0))) {
stylePtr = &exStyle;
styleBit = WS_EX_LAYERED;
+ } else if (strncmp(string, "-fullscreen", (unsigned) length) == 0) {
+ config_fullscreen = 1;
+ styleBit = 0;
} else if ((length > 3)
- && (strncmp(string, "-toolwindow", length) == 0)) {
+ && (strncmp(string, "-toolwindow", (unsigned) length) == 0)) {
stylePtr = &exStyle;
styleBit = WS_EX_TOOLWINDOW;
if (objc != 4) {
@@ -2885,13 +3150,12 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
updatewrapper = 1;
}
} else if ((length > 3)
- && (strncmp(string, "-topmost", length) == 0)) {
+ && (strncmp(string, "-topmost", (unsigned) length) == 0)) {
stylePtr = &exStyle;
styleBit = WS_EX_TOPMOST;
if ((i < objc-1) && (winPtr->flags & TK_EMBEDDED)) {
Tcl_AppendResult(interp, "can't set topmost flag on ",
- winPtr->pathName, ": it is an embedded window",
- (char *) NULL);
+ winPtr->pathName, ": it is an embedded window", NULL);
return TCL_ERROR;
}
} else {
@@ -2968,20 +3232,17 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
* Set the window directly regardless of UpdateWrapper.
* The user supplies a double from [0..1], but Windows
* wants an int (transparent) 0..255 (opaque), so do the
- * translation. Add the 0.5 to round the value.
+ * translation. Add the 0.5 to round the value.
*/
+
if (!(wmPtr->exStyleConfig & WS_EX_LAYERED)) {
-#ifdef _WIN64
SetWindowLongPtr(wmPtr->wrapper, GWL_EXSTYLE,
*stylePtr);
-#else
- SetWindowLong(wmPtr->wrapper, GWL_EXSTYLE,
- *stylePtr);
-#endif
}
setLayeredWindowAttributesProc((HWND) wmPtr->wrapper,
wmPtr->colorref, (BYTE) (wmPtr->alpha * 255 + 0.5),
- LWA_ALPHA | (wmPtr->crefObj ? LWA_COLORKEY : 0));
+ (unsigned) (LWA_ALPHA |
+ (wmPtr->crefObj ? LWA_COLORKEY : 0)));
}
}
} else {
@@ -2990,7 +3251,16 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
!= TCL_OK)) {
return TCL_ERROR;
}
- if (objc == 4) {
+ if (config_fullscreen) {
+ if (objc == 4) {
+ Tcl_SetBooleanObj(Tcl_GetObjResult(interp),
+ (wmPtr->flags & WM_FULLSCREEN));
+ } else {
+ fullscreen_attr_changed = 1;
+ fullscreen_attr = boolean;
+ }
+ config_fullscreen = 0;
+ } else if (objc == 4) {
Tcl_SetIntObj(Tcl_GetObjResult(interp),
((*stylePtr & styleBit) != 0));
} else if (boolean) {
@@ -3013,9 +3283,10 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr->styleConfig != style) {
/*
- * Currently this means only WS_DISABLED changed, which we can
- * effect with EnableWindow.
+ * Currently this means only WS_DISABLED changed, which we can effect
+ * with EnableWindow.
*/
+
wmPtr->styleConfig = style;
if ((wmPtr->exStyleConfig == exStyle)
&& !(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3029,11 +3300,43 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
* UpdateWrapper ensure that all effects are properly handled,
* such as TOOLWINDOW disappearing from the taskbar.
*/
+
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
UpdateWrapper(winPtr);
}
}
}
+ if (fullscreen_attr_changed) {
+ if (fullscreen_attr) {
+ if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
+ Tcl_AppendResult(interp,
+ "can't set fullscreen attribute for \"",
+ winPtr->pathName, "\": override-redirect flag is set",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Check max width and height if set by the user, don't worry
+ * about the default values since they will likely be smaller than
+ * screen width/height.
+ */
+
+ if (((wmPtr->maxWidth > 0) &&
+ (WidthOfScreen(Tk_Screen(winPtr)) > wmPtr->maxWidth)) ||
+ ((wmPtr->maxHeight > 0) &&
+ (HeightOfScreen(Tk_Screen(winPtr)) > wmPtr->maxHeight))) {
+ Tcl_AppendResult(interp,
+ "can't set fullscreen attribute for \"",
+ winPtr->pathName, "\": max width/height is too small",
+ NULL);
+ return TCL_ERROR;
+ }
+ }
+
+ TkpWmSetFullScreen(winPtr, fullscreen_attr);
+ }
+
return TCL_OK;
}
@@ -3042,8 +3345,8 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
*
* WmClientCmd --
*
- * This procedure is invoked to process the "wm client" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm client" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3055,12 +3358,12 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmClientCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmClientCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -3083,8 +3386,7 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->clientMachine = NULL;
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, winPtr->window,
- Tk_InternAtom((Tk_Window) winPtr,
- "WM_CLIENT_MACHINE"));
+ Tk_InternAtom((Tk_Window) winPtr,"WM_CLIENT_MACHINE"));
}
}
return TCL_OK;
@@ -3097,6 +3399,7 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
strcpy(wmPtr->clientMachine, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
+
if (XStringListToTextProperty(&wmPtr->clientMachine, 1, &textProp)
!= 0) {
XSetWMClientMachine(winPtr->display, winPtr->window,
@@ -3112,9 +3415,8 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
*
* WmColormapwindowsCmd --
*
- * This procedure is invoked to process the "wm colormapwindows"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm colormapwindows" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3126,16 +3428,16 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmColormapwindowsCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow **cmapList;
- TkWindow *winPtr2;
+ TkWindow *winPtr2, **winPtr2Ptr = &winPtr2;
int i, windowObjc, gotToplevel;
Tcl_Obj **windowObjv;
@@ -3163,8 +3465,7 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
gotToplevel = 0;
for (i = 0; i < windowObjc; i++) {
if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
- (Tk_Window *) &winPtr2) != TCL_OK)
- {
+ (Tk_Window *) winPtr2Ptr) != TCL_OK) {
ckfree((char *) cmapList);
return TCL_ERROR;
}
@@ -3207,8 +3508,8 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
*
* WmCommandCmd --
*
- * This procedure is invoked to process the "wm command" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm command" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3220,12 +3521,12 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmCommandCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmCommandCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -3239,8 +3540,7 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
if (objc == 3) {
if (wmPtr->cmdArgv != NULL) {
Tcl_SetResult(interp,
- Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
- TCL_DYNAMIC);
+ Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv), TCL_DYNAMIC);
}
return TCL_OK;
}
@@ -3275,7 +3575,7 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
*
* WmDeiconifyCmd --
*
- * This procedure is invoked to process the "wm deiconify" Tcl command.
+ * This function is invoked to process the "wm deiconify" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3288,12 +3588,12 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmDeiconifyCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3303,56 +3603,18 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
- return TCL_ERROR;
- }
-
- wmPtr->flags &= ~WM_WITHDRAWN;
-
- /*
- * If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may
- * need to be called first to update a withdrawn toplevel's geometry
- * before it is deiconified by TkpWmSetState.
- * Don't bother if we've never been mapped.
- */
- if ((wmPtr->flags & WM_UPDATE_PENDING) &&
- !(wmPtr->flags & WM_NEVER_MAPPED)) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
- UpdateGeometryInfo((ClientData) winPtr);
- }
-
- /*
- * If we were in the ZoomState (maximized), 'wm deiconify'
- * should not cause the window to shrink
- */
- if (wmPtr->hints.initial_state == ZoomState) {
- TkpWmSetState(winPtr, ZoomState);
- } else {
- TkpWmSetState(winPtr, NormalState);
- }
-
- /*
- * An unmapped window will be mapped at idle time
- * by a call to MapFrame. That calls CreateWrapper
- * which sets the focus and raises the window.
- */
- if (wmPtr->flags & WM_NEVER_MAPPED) {
+ if (!SendMessage(wmPtr->wrapper, TK_DEICONIFY, 0, 0)) {
+ Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
+ ": the container does not support the request", NULL);
+ return TCL_ERROR;
+ }
return TCL_OK;
}
-
- /*
- * Follow Windows-like style here, raising the window to the top.
- */
- TkWmRestackToplevel(winPtr, Above, NULL);
- if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
- TkSetFocusWin(winPtr, 1);
- }
+ TkpWinToplevelDeiconify(winPtr);
return TCL_OK;
}
@@ -3361,7 +3623,7 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
*
* WmFocusmodelCmd --
*
- * This procedure is invoked to process the "wm focusmodel" Tcl command.
+ * This function is invoked to process the "wm focusmodel" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3374,18 +3636,20 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmFocusmodelCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "active", "passive", (char *) NULL };
+ "active", "passive", NULL
+ };
enum options {
- OPT_ACTIVE, OPT_PASSIVE };
+ OPT_ACTIVE, OPT_PASSIVE
+ };
int index;
if ((objc != 3) && (objc != 4)) {
@@ -3413,9 +3677,9 @@ WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
- * WmFrameCmd --
+ * WmForgetCmd --
*
- * This procedure is invoked to process the "wm frame" Tcl command.
+ * This procedure is invoked to process the "wm forget" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3428,13 +3692,54 @@ WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmFrameCmd(tkwin, winPtr, interp, objc, objv)
+WmForgetCmd(tkwin, winPtr, interp, objc, objv)
Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
+ TkWindow *winPtr; /* Toplevel or Frame to work with */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
+ register Tk_Window frameWin = (Tk_Window)winPtr;
+
+ if (Tk_IsTopLevel(frameWin)) {
+ Tk_UnmapWindow(frameWin);
+ winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr);
+ RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window));
+ TkWmDeadWindow(winPtr);
+ /* flags (above) must be cleared before calling */
+ /* TkMapTopFrame (below) */
+ TkMapTopFrame(frameWin);
+ } else {
+ /* Already not managed by wm - ignore it */
+ }
+ return TCL_OK;
+}
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmFrameCmd --
+ *
+ * This function is invoked to process the "wm frame" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmFrameCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
HWND hwnd;
char buf[TCL_INTEGER_SPACE];
@@ -3450,7 +3755,7 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
if (hwnd == NULL) {
hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr));
}
- sprintf(buf, "0x%x", (unsigned int) hwnd);
+ sprintf(buf, "0x%x", PTR2INT(hwnd));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -3460,7 +3765,7 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGeometryCmd --
*
- * This procedure is invoked to process the "wm geometry" Tcl command.
+ * This function is invoked to process the "wm geometry" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3473,12 +3778,12 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmGeometryCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char xSign, ySign;
@@ -3491,6 +3796,7 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
}
if (objc == 3) {
char buf[16 + TCL_INTEGER_SPACE * 4];
+ int x, y;
xSign = (wmPtr->flags & WM_NEGATIVE_X) ? '-' : '+';
ySign = (wmPtr->flags & WM_NEGATIVE_Y) ? '-' : '+';
@@ -3503,8 +3809,14 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
width = winPtr->changes.width;
height = winPtr->changes.height;
}
- sprintf(buf, "%dx%d%c%d%c%d", width, height, xSign, wmPtr->x,
- ySign, wmPtr->y);
+ if(winPtr->flags & TK_EMBEDDED) {
+ int result = SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, -1, -1);
+ wmPtr->x = result >> 16;
+ wmPtr->y = result & 0x0000ffff;
+ }
+ x = wmPtr->x;
+ y = wmPtr->y;
+ sprintf(buf, "%dx%d%c%d%c%d", width, height, xSign, x, ySign, y);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -3523,8 +3835,8 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGridCmd --
*
- * This procedure is invoked to process the "wm grid" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm grid" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3536,12 +3848,12 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGridCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmGridCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
@@ -3564,8 +3876,8 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
}
if (*Tcl_GetString(objv[3]) == '\0') {
/*
- * Turn off gridding and reset the width and height
- * to make sense as ungridded numbers.
+ * Turn off gridding and reset the width and height to make sense as
+ * ungridded numbers.
*/
wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
@@ -3612,8 +3924,8 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGroupCmd --
*
- * This procedure is invoked to process the "wm group" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm group" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3625,12 +3937,12 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGroupCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmGroupCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -3675,7 +3987,7 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconbitmapCmd --
*
- * This procedure is invoked to process the "wm iconbitmap" Tcl command.
+ * This function is invoked to process the "wm iconbitmap" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3688,12 +4000,12 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconbitmapCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
@@ -3703,17 +4015,23 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?");
return TCL_ERROR;
} else if (objc == 5) {
- /* If we have 5 arguments, we must have a '-default' flag */
+ /*
+ * If we have 5 arguments, we must have a '-default' flag.
+ */
+
char *argv3 = Tcl_GetString(objv[3]);
+
if (strcmp(argv3, "-default")) {
- Tcl_AppendResult(interp, "illegal option \"",
- argv3, "\" must be \"-default\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "illegal option \"", argv3,
+ "\" must be \"-default\"", NULL);
return TCL_ERROR;
}
useWinPtr = NULL;
} else if (objc == 3) {
- /* No arguments were given */
+ /*
+ * No arguments were given.
+ */
+
if (wmPtr->hints.flags & IconPixmapHint) {
Tcl_SetResult(interp, (char *)
Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_pixmap),
@@ -3735,42 +4053,46 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
} else {
/*
* In the future this block of code will use Tk's 'image'
- * functionality to allow all supported image formats.
- * However, this will require a change to the way icons are
- * handled. We will need to add icon<->image conversions
- * routines.
+ * functionality to allow all supported image formats. However, this
+ * will require a change to the way icons are handled. We will need to
+ * add icon<->image conversions routines.
*
- * Until that happens we simply try to find an icon in the
- * given argument, and if that fails, we use the older
- * bitmap code. We do things this way round (icon then
- * bitmap), because the bitmap code actually seems to have
- * no visible effect, so we want to give the icon code the
- * first try at doing something.
+ * Until that happens we simply try to find an icon in the given
+ * argument, and if that fails, we use the older bitmap code. We do
+ * things this way round (icon then bitmap), because the bitmap code
+ * actually seems to have no visible effect, so we want to give the
+ * icon code the first try at doing something.
*/
/*
- * Either return NULL, or return a valid titlebaricon with its
- * ref count already incremented.
+ * Either return NULL, or return a valid titlebaricon with its ref
+ * count already incremented.
*/
+
WinIconPtr titlebaricon = ReadIconFromFile(interp, objv[objc-1]);
if (titlebaricon != NULL) {
/*
- * Try to set the icon for the window. If it is a '-default'
- * icon, we must pass in NULL
+ * Try to set the icon for the window. If it is a '-default' icon,
+ * we must pass in NULL
*/
+
if (WinSetIcon(interp, titlebaricon, (Tk_Window) useWinPtr)
!= TCL_OK) {
- /* We didn't use the titlebaricon after all */
+ /*
+ * We didn't use the titlebaricon after all.
+ */
+
DecrIconRefCount(titlebaricon);
titlebaricon = NULL;
}
}
if (titlebaricon == NULL) {
/*
- * We didn't manage to handle the argument as a valid
- * icon. Try as a bitmap. First we must clear the
- * error message which was placed in the interpreter
+ * We didn't manage to handle the argument as a valid icon. Try as
+ * a bitmap. First we must clear the error message which was
+ * placed in the interpreter.
*/
+
Pixmap pixmap;
Tcl_ResetResult(interp);
pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, string);
@@ -3780,13 +4102,14 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->hints.icon_pixmap = pixmap;
wmPtr->hints.flags |= IconPixmapHint;
titlebaricon = GetIconFromPixmap(Tk_Display(winPtr), pixmap);
- if (titlebaricon != NULL) {
- if (WinSetIcon(interp, titlebaricon, (Tk_Window) useWinPtr)
- != TCL_OK) {
- /* We didn't use the titlebaricon after all */
- DecrIconRefCount(titlebaricon);
- titlebaricon = NULL;
- }
+ if (titlebaricon != NULL && WinSetIcon(interp, titlebaricon,
+ (Tk_Window) useWinPtr) != TCL_OK) {
+ /*
+ * We didn't use the titlebaricon after all.
+ */
+
+ DecrIconRefCount(titlebaricon);
+ titlebaricon = NULL;
}
}
}
@@ -3798,8 +4121,8 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconifyCmd --
*
- * This procedure is invoked to process the "wm iconify" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm iconify" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3811,37 +4134,38 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconifyCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
+ if (winPtr->flags & TK_EMBEDDED) {
+ if(!SendMessage(wmPtr->wrapper, TK_ICONIFY, 0, 0)) {
+ Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
+ ": the container does not support the request", NULL);
+ return TCL_ERROR;
+ }
+ }
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": override-redirect flag is set", (char *) NULL);
+ "\": override-redirect flag is set", NULL);
return TCL_ERROR;
}
if (wmPtr->masterPtr != NULL) {
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": it is a transient", (char *) NULL);
+ "\": it is a transient", NULL);
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
- return TCL_ERROR;
- }
- if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
TkpWmSetState(winPtr, IconicState);
@@ -3853,7 +4177,7 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconmaskCmd --
*
- * This procedure is invoked to process the "wm iconmask" Tcl command.
+ * This function is invoked to process the "wm iconmask" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3866,12 +4190,12 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconmaskCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
@@ -3911,7 +4235,7 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconnameCmd --
*
- * This procedure is invoked to process the "wm iconname" Tcl command.
+ * This function is invoked to process the "wm iconname" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3924,12 +4248,12 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconnameCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -3963,8 +4287,7 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconphotoCmd --
*
- * This procedure is invoked to process the "wm iconphoto"
- * Tcl command.
+ * This function is invoked to process the "wm iconphoto" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3977,30 +4300,36 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconphotoCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
Tk_PhotoHandle photo;
Tk_PhotoImageBlock block;
- int i, size, width, height, idx, bufferSize, startObj = 3;
- unsigned char *bgraPixelPtr;
+ int i, width, height, idx, bufferSize, startObj = 3;
+ union {unsigned char *ptr; void *voidPtr;} bgraPixel;
+ void *bgraMaskPtr;
BlockOfIconImagesPtr lpIR;
WinIconPtr titlebaricon = NULL;
HICON hIcon;
+ unsigned size;
+ BITMAPINFO bmInfo;
+ ICONINFO iconInfo;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
"window ?-default? image1 ?image2 ...?");
return TCL_ERROR;
}
+
/*
* Iterate over all images to validate their existence.
*/
+
if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) {
useWinPtr = NULL;
startObj = 4;
@@ -4014,58 +4343,120 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
if (photo == NULL) {
Tcl_AppendResult(interp, "can't use \"", Tcl_GetString(objv[i]),
- "\" as iconphoto: not a photo image", (char *) NULL);
+ "\" as iconphoto: not a photo image", NULL);
return TCL_ERROR;
}
}
- /* We have calculated the size of the data. Try to allocate the needed
- * memory space. */
- size = sizeof(BlockOfIconImages)
- + (sizeof(ICONIMAGE) * (objc - (startObj+1)));
- lpIR = (BlockOfIconImagesPtr) Tcl_AttemptAlloc(size);
+
+ /*
+ * We have calculated the size of the data. Try to allocate the needed
+ * memory space.
+ */
+
+ size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1));
+ lpIR = (BlockOfIconImagesPtr) attemptckalloc(size);
if (lpIR == NULL) {
return TCL_ERROR;
}
ZeroMemory(lpIR, size);
lpIR->nNumImages = objc - startObj;
+
for (i = startObj; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
Tk_PhotoGetSize(photo, &width, &height);
Tk_PhotoGetImage(photo, &block);
/*
- * Convert the image data into BGRA format (RGBQUAD) and then
- * encode the image data into an HICON.
+ * Don't use CreateIcon to create the icon, as it requires color
+ * bitmap data in device-dependent format. Instead we use
+ * CreateIconIndirect which takes device-independent bitmaps
+ * and converts them as required. Initialise icon info structure.
+ */
+
+ ZeroMemory( &iconInfo, sizeof iconInfo );
+ iconInfo.fIcon = TRUE;
+
+ /*
+ * Create device-independant color bitmap.
+ */
+ ZeroMemory(&bmInfo,sizeof bmInfo);
+ bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmInfo.bmiHeader.biWidth = width;
+ bmInfo.bmiHeader.biHeight = -height;
+ bmInfo.bmiHeader.biPlanes = 1;
+ bmInfo.bmiHeader.biBitCount = 32;
+ bmInfo.bmiHeader.biCompression = BI_RGB;
+
+ iconInfo.hbmColor = CreateDIBSection( NULL, &bmInfo,
+ DIB_RGB_COLORS, &bgraPixel.voidPtr, NULL, 0 );
+ if ( !iconInfo.hbmColor ) {
+ ckfree((char *) lpIR);
+ Tcl_AppendResult(interp, "failed to create color bitmap for \"",
+ Tcl_GetString(objv[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Convert the photo image data into BGRA format (RGBQUAD).
*/
- bufferSize = height * width * block.pixelSize;
- bgraPixelPtr = (unsigned char *) ckalloc(bufferSize);
+ bufferSize = height * width * 4;
for (idx = 0 ; idx < bufferSize ; idx += 4) {
- bgraPixelPtr[idx] = block.pixelPtr[idx+2];
- bgraPixelPtr[idx+1] = block.pixelPtr[idx+1];
- bgraPixelPtr[idx+2] = block.pixelPtr[idx+0];
- bgraPixelPtr[idx+3] = block.pixelPtr[idx+3];
- }
- hIcon = CreateIcon(Tk_GetHINSTANCE(), width, height, 1, 32,
- NULL, (BYTE *) bgraPixelPtr);
- ckfree((char *) bgraPixelPtr);
+ bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
+ bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
+ bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
+ bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
+ }
+
+ /*
+ * Create a dummy mask bitmap. The contents of this don't
+ * appear to matter, as CreateIconIndirect will setup the icon
+ * mask based on the alpha channel in our color bitmap.
+ */
+ bmInfo.bmiHeader.biBitCount = 1;
+
+ iconInfo.hbmMask = CreateDIBSection( NULL, &bmInfo,
+ DIB_RGB_COLORS, &bgraMaskPtr, NULL, 0 );
+ if ( !iconInfo.hbmMask ) {
+ DeleteObject(iconInfo.hbmColor);
+ ckfree((char *) lpIR);
+ Tcl_AppendResult(interp, "failed to create mask bitmap for \"",
+ Tcl_GetString(objv[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+
+ ZeroMemory( bgraMaskPtr, width*height/8 );
+
+ /*
+ * Create an icon from the bitmaps.
+ */
+ hIcon = CreateIconIndirect( &iconInfo);
+ DeleteObject(iconInfo.hbmColor);
+ DeleteObject(iconInfo.hbmMask);
if (hIcon == NULL) {
- /* XXX should free up created icons */
- Tcl_Free((char *) lpIR);
+ /*
+ * XXX should free up created icons.
+ */
+
+ ckfree((char *) lpIR);
Tcl_AppendResult(interp, "failed to create icon for \"",
- Tcl_GetString(objv[i]), "\"", (char *) NULL);
+ Tcl_GetString(objv[i]), "\"", NULL);
return TCL_ERROR;
}
- lpIR->IconImages[i-startObj].Width = width;
+ lpIR->IconImages[i-startObj].Width = width;
lpIR->IconImages[i-startObj].Height = height;
lpIR->IconImages[i-startObj].Colors = 4;
- lpIR->IconImages[i-startObj].hIcon = hIcon;
+ lpIR->IconImages[i-startObj].hIcon = hIcon;
}
+
titlebaricon = (WinIconPtr) ckalloc(sizeof(WinIconInstance));
titlebaricon->iconBlock = lpIR;
titlebaricon->refCount = 1;
if (WinSetIcon(interp, titlebaricon, (Tk_Window) useWinPtr) != TCL_OK) {
- /* We didn't use the titlebaricon after all */
+ /*
+ * We didn't use the titlebaricon after all.
+ */
+
DecrIconRefCount(titlebaricon);
return TCL_ERROR;
}
@@ -4077,8 +4468,7 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconpositionCmd --
*
- * This procedure is invoked to process the "wm iconposition"
- * Tcl command.
+ * This function is invoked to process the "wm iconposition" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4091,12 +4481,12 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconpositionCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
@@ -4134,7 +4524,7 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconwindowCmd --
*
- * This procedure is invoked to process the "wm iconwindow" Tcl command.
+ * This function is invoked to process the "wm iconwindow" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4147,12 +4537,12 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmIconwindowCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -4173,8 +4563,8 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->hints.flags &= ~IconWindowHint;
if (wmPtr->icon != NULL) {
/*
- * Let the window use button events again, then remove
- * it as icon window.
+ * Let the window use button events again, then remove it as icon
+ * window.
*/
atts.event_mask = Tk_Attributes(wmPtr->icon)->event_mask
@@ -4191,14 +4581,14 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
}
if (!Tk_IsTopLevel(tkwin2)) {
Tcl_AppendResult(interp, "can't use ", Tcl_GetString(objv[3]),
- " as icon window: not at top level", (char *) NULL);
+ " as icon window: not at top level", NULL);
return TCL_ERROR;
}
wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr;
if (wmPtr2->iconFor != NULL) {
Tcl_AppendResult(interp, Tcl_GetString(objv[3]),
- " is already an icon for ",
- Tk_PathName(wmPtr2->iconFor), (char *) NULL);
+ " is already an icon for ", Tk_PathName(wmPtr2->iconFor),
+ NULL);
return TCL_ERROR;
}
if (wmPtr->icon != NULL) {
@@ -4215,10 +4605,9 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
}
/*
- * Disable button events in the icon window: some window
- * managers (like olvwm) want to get the events themselves,
- * but X only allows one application at a time to receive
- * button events for a window.
+ * Disable button events in the icon window: some window managers
+ * (like olvwm) want to get the events themselves, but X only allows
+ * one application at a time to receive button events for a window.
*/
atts.event_mask = Tk_Attributes(tkwin2)->event_mask
@@ -4240,9 +4629,9 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
- * WmMaxsizeCmd --
+ * WmManageCmd --
*
- * This procedure is invoked to process the "wm maxsize" Tcl command.
+ * This procedure is invoked to process the "wm manage" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4255,13 +4644,66 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
+WmManageCmd(tkwin, winPtr, interp, objc, objv)
Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
+ TkWindow *winPtr; /* Toplevel or Frame to work with */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
+ register Tk_Window frameWin = (Tk_Window)winPtr;
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (!Tk_IsTopLevel(frameWin)) {
+ if (!Tk_IsManageable(frameWin)) {
+ Tcl_AppendResult(interp, "window \"",
+ Tk_PathName(frameWin), "\" is not manageable: must be "
+ "a frame, labelframe or toplevel", NULL);
+ return TCL_ERROR;
+ }
+ TkFocusSplit(winPtr);
+ Tk_UnmapWindow(frameWin);
+ winPtr->flags |= TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
+ RemapWindows(winPtr, NULL);
+ if (wmPtr == NULL) {
+ TkWmNewWindow(winPtr);
+ }
+ wmPtr = winPtr->wmInfoPtr;
+ winPtr->flags &= ~TK_MAPPED;
+ /* flags (above) must be set before calling */
+ /* TkMapTopFrame (below) */
+ TkMapTopFrame (frameWin);
+ } else if (Tk_IsTopLevel(frameWin)) {
+ /* Already managed by wm - ignore it */
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmMaxsizeCmd --
+ *
+ * This function is invoked to process the "wm maxsize" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmMaxsizeCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
+{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -4292,8 +4734,8 @@ WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
*
* WmMinsizeCmd --
*
- * This procedure is invoked to process the "wm minsize" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm minsize" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -4305,12 +4747,12 @@ WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmMinsizeCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -4342,9 +4784,8 @@ WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
*
* WmOverrideredirectCmd --
*
- * This procedure is invoked to process the "wm overrideredirect"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm overrideredirect" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -4356,12 +4797,12 @@ WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmOverrideredirectCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int boolean, curValue;
@@ -4371,7 +4812,16 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
return TCL_ERROR;
}
- curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
+ if(winPtr->flags & TK_EMBEDDED) {
+ curValue = SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1;
+ if (curValue < 0) {
+ Tcl_AppendResult(interp,
+ "Container does not support overrideredirect", NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
+ }
if (objc == 3) {
Tcl_SetBooleanObj(Tcl_GetObjResult(interp), curValue);
return TCL_OK;
@@ -4380,16 +4830,21 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
return TCL_ERROR;
}
if (curValue != boolean) {
- /*
- * Only do this if we are really changing value, because it
- * causes some funky stuff to occur
- */
- atts.override_redirect = (boolean) ? True : False;
- Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
- &atts);
- if (!(wmPtr->flags & (WM_NEVER_MAPPED)
- && !(winPtr->flags & TK_EMBEDDED))) {
- UpdateWrapper(winPtr);
+ if(winPtr->flags & TK_EMBEDDED) {
+ SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0);
+ } else {
+ /*
+ * Only do this if we are really changing value, because it causes
+ * some funky stuff to occur.
+ */
+
+ atts.override_redirect = (boolean) ? True : False;
+ Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
+ &atts);
+ if (!(wmPtr->flags & (WM_NEVER_MAPPED))
+ && !(winPtr->flags & TK_EMBEDDED)) {
+ UpdateWrapper(winPtr);
+ }
}
}
return TCL_OK;
@@ -4400,8 +4855,7 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
*
* WmPositionfromCmd --
*
- * This procedure is invoked to process the "wm positionfrom"
- * Tcl command.
+ * This function is invoked to process the "wm positionfrom" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4414,18 +4868,20 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmPositionfromCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
+ "program", "user", NULL
+ };
enum options {
- OPT_PROGRAM, OPT_USER };
+ OPT_PROGRAM, OPT_USER
+ };
int index;
if ((objc != 3) && (objc != 4)) {
@@ -4464,7 +4920,7 @@ WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
*
* WmProtocolCmd --
*
- * This procedure is invoked to process the "wm protocol" Tcl command.
+ * This function is invoked to process the "wm protocol" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4477,12 +4933,12 @@ WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmProtocolCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
register ProtocolHandler *protPtr, *prevPtr;
@@ -4498,8 +4954,9 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
/*
* Return a list of all defined protocols for the window.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
+ protPtr = protPtr->nextPtr) {
Tcl_AppendElement(interp,
Tk_GetAtomName((Tk_Window) winPtr, protPtr->protocol));
}
@@ -4510,8 +4967,9 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
/*
* Return the command to handle a given protocol.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
+ protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
Tcl_SetResult(interp, protPtr->command, TCL_STATIC);
return TCL_OK;
@@ -4521,13 +4979,12 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
}
/*
- * Delete any current protocol handler, then create a new
- * one with the specified command, unless the command is
- * empty.
+ * Delete any current protocol handler, then create a new one with the
+ * specified command, unless the command is empty.
*/
for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL;
- prevPtr = protPtr, protPtr = protPtr->nextPtr) {
+ prevPtr = protPtr, protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
if (prevPtr == NULL) {
wmPtr->protPtr = protPtr->nextPtr;
@@ -4555,7 +5012,7 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
*
* WmResizableCmd --
*
- * This procedure is invoked to process the "wm resizable" Tcl command.
+ * This function is invoked to process the "wm resizable" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4568,12 +5025,12 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmResizableCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmResizableCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -4586,8 +5043,8 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
char buf[TCL_INTEGER_SPACE * 2];
sprintf(buf, "%d %d",
- (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
- (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
+ (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -4618,7 +5075,7 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
*
* WmSizefromCmd --
*
- * This procedure is invoked to process the "wm sizefrom" Tcl command.
+ * This function is invoked to process the "wm sizefrom" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4631,18 +5088,20 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmSizefromCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
+ "program", "user", NULL
+ };
enum options {
- OPT_PROGRAM, OPT_USER };
+ OPT_PROGRAM, OPT_USER
+ };
int index;
if ((objc != 3) && (objc != 4)) {
@@ -4682,7 +5141,7 @@ WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
*
* WmStackorderCmd --
*
- * This procedure is invoked to process the "wm stackorder" Tcl command.
+ * This function is invoked to process the "wm stackorder" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4695,18 +5154,20 @@ WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmStackorderCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
TkWindow **windows, **window_ptr;
static CONST char *optionStrings[] = {
- "isabove", "isbelow", (char *) NULL };
+ "isabove", "isbelow", NULL
+ };
enum options {
- OPT_ISABOVE, OPT_ISBELOW };
+ OPT_ISABOVE, OPT_ISBELOW
+ };
int index;
if ((objc != 3) && (objc != 5)) {
@@ -4726,55 +5187,57 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
return TCL_OK;
}
} else {
- TkWindow *winPtr2;
+ TkWindow *winPtr2, **winPtr2Ptr = &winPtr2;
int index1=-1, index2=-1, result;
- if (TkGetWindowFromObj(interp, tkwin, objv[4], (Tk_Window *) &winPtr2)
- != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[4],
+ (Tk_Window *) winPtr2Ptr) != TCL_OK) {
return TCL_ERROR;
}
if (!Tk_IsTopLevel(winPtr2)) {
Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't mapped", (char *) NULL);
+ "\" isn't mapped", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr2)) {
Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't mapped", (char *) NULL);
+ "\" isn't mapped", NULL);
return TCL_ERROR;
}
/*
- * Lookup stacking order of all toplevels that are children
- * of "." and find the position of winPtr and winPtr2
- * in the stacking order.
+ * Lookup stacking order of all toplevels that are children of "." and
+ * find the position of winPtr and winPtr2 in the stacking order.
*/
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
if (windows == NULL) {
- Tcl_AppendResult(interp, "TkWmStackorderToplevel failed",
- (char *) NULL);
+ Tcl_AppendResult(interp, "TkWmStackorderToplevel failed", NULL);
return TCL_ERROR;
} else {
for (window_ptr = windows; *window_ptr ; window_ptr++) {
- if (*window_ptr == winPtr)
+ if (*window_ptr == winPtr) {
index1 = (window_ptr - windows);
- if (*window_ptr == winPtr2)
+ }
+ if (*window_ptr == winPtr2) {
index2 = (window_ptr - windows);
+ }
}
- if (index1 == -1)
+ if (index1 == -1) {
Tcl_Panic("winPtr window not found");
- if (index2 == -1)
+ }
+ if (index2 == -1) {
Tcl_Panic("winPtr2 window not found");
+ }
ckfree((char *) windows);
}
@@ -4799,8 +5262,8 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
*
* WmStateCmd --
*
- * This procedure is invoked to process the "wm state" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm state" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -4812,18 +5275,20 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmStateCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmStateCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
static CONST char *optionStrings[] = {
- "normal", "iconic", "withdrawn", "zoomed", (char *) NULL };
+ "normal", "iconic", "withdrawn", "zoomed", NULL
+ };
enum options {
- OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED };
+ OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED
+ };
int index;
if ((objc < 3) || (objc > 4)) {
@@ -4833,15 +5298,12 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
if (objc == 4) {
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't change state of ",
- Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ Tcl_GetString(objv[2]), ": it is an icon for ",
+ Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
- if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't change state of ",
- winPtr->pathName, ": it is an embedded window",
- (char *) NULL);
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
+ &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -4850,25 +5312,52 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
return TCL_ERROR;
}
+ if (winPtr->flags & TK_EMBEDDED) {
+ int state = 0;
+
+ switch (index) {
+ case OPT_NORMAL:
+ state = NormalState;
+ break;
+ case OPT_ICONIC:
+ state = IconicState;
+ break;
+ case OPT_WITHDRAWN:
+ state = WithdrawnState;
+ break;
+ case OPT_ZOOMED:
+ state = ZoomState;
+ break;
+ default:
+ Tcl_Panic("unexpected index");
+ }
+
+ if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) {
+ Tcl_AppendResult(interp, "can't change state of ",
+ winPtr->pathName,
+ ": the container does not support the request", NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+ }
+
if (index == OPT_NORMAL) {
wmPtr->flags &= ~WM_WITHDRAWN;
TkpWmSetState(winPtr, NormalState);
+
/*
- * This varies from 'wm deiconify' because it does not
- * force the window to be raised and receive focus
+ * This varies from 'wm deiconify' because it does not force the
+ * window to be raised and receive focus.
*/
} else if (index == OPT_ICONIC) {
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": override-redirect flag is set",
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": override-redirect flag is set", NULL);
return TCL_ERROR;
}
if (wmPtr->masterPtr != NULL) {
Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": it is a transient", (char *) NULL);
+ winPtr->pathName, "\": it is a transient", NULL);
return TCL_ERROR;
}
TkpWmSetState(winPtr, IconicState);
@@ -4884,17 +5373,24 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
if (wmPtr->iconFor != NULL) {
Tcl_SetResult(interp, "icon", TCL_STATIC);
} else {
- switch (wmPtr->hints.initial_state) {
- case NormalState:
+ int state;
+
+ if (winPtr->flags & TK_EMBEDDED) {
+ state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1)-1;
+ } else {
+ state = wmPtr->hints.initial_state;
+ }
+ switch (state) {
+ case NormalState:
Tcl_SetResult(interp, "normal", TCL_STATIC);
break;
- case IconicState:
+ case IconicState:
Tcl_SetResult(interp, "iconic", TCL_STATIC);
break;
- case WithdrawnState:
+ case WithdrawnState:
Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
break;
- case ZoomState:
+ case ZoomState:
Tcl_SetResult(interp, "zoomed", TCL_STATIC);
break;
}
@@ -4908,8 +5404,8 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
*
* WmTitleCmd --
*
- * This procedure is invoked to process the "wm title" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm title" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -4921,26 +5417,43 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmTitleCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmTitleCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
int length;
+ HWND wrapper;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
return TCL_ERROR;
}
+
+ if(winPtr->flags & TK_EMBEDDED) {
+ wrapper = (HWND)SendMessage(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0);
+ } else {
+ wrapper = wmPtr->wrapper;
+ }
if (objc == 3) {
- Tcl_SetResult(interp, (char *)
- ((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid),
- TCL_STATIC);
- return TCL_OK;
+ if (wrapper) {
+ char buf[512];
+ Tcl_DString titleString;
+ int size = tkWinProcs->useWide ? 256 : 512;
+
+ (*tkWinProcs->getWindowText)(wrapper, (LPCTSTR)buf, size);
+ Tcl_WinTCharToUtf(buf, -1, &titleString);
+ Tcl_SetResult(interp, Tcl_DStringValue(&titleString),TCL_VOLATILE);
+ Tcl_DStringFree(&titleString);
+ } else {
+ Tcl_SetResult(interp, (char *)
+ ((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid),
+ TCL_STATIC);
+ }
} else {
if (wmPtr->title != NULL) {
ckfree((char *) wmPtr->title);
@@ -4952,7 +5465,7 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
if (!(wmPtr->flags & WM_NEVER_MAPPED) && wmPtr->wrapper != NULL) {
Tcl_DString titleString;
Tcl_WinUtfToTChar(wmPtr->title, -1, &titleString);
- (*tkWinProcs->setWindowText)(wmPtr->wrapper,
+ (*tkWinProcs->setWindowText)(wrapper,
(LPCTSTR) Tcl_DStringValue(&titleString));
Tcl_DStringFree(&titleString);
}
@@ -4965,7 +5478,7 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
*
* WmTransientCmd --
*
- * This procedure is invoked to process the "wm transient" Tcl command.
+ * This function is invoked to process the "wm transient" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -4978,15 +5491,15 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmTransientCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmTransientCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- TkWindow *masterPtr = wmPtr->masterPtr;
+ TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr;
WmInfo *wmPtr2;
if ((objc != 3) && (objc != 4)) {
@@ -5002,8 +5515,8 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
if (Tcl_GetString(objv[3])[0] == '\0') {
if (masterPtr != NULL) {
/*
- * If we had a master, tell them that we aren't tied
- * to them anymore
+ * If we had a master, tell them that we aren't tied to them
+ * anymore.
*/
masterPtr->wmInfoPtr->numTransients--;
@@ -5015,7 +5528,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->masterPtr = NULL;
} else {
if (TkGetWindowFromObj(interp, tkwin, objv[3],
- (Tk_Window *) &masterPtr) != TCL_OK) {
+ (Tk_Window *) masterPtrPtr) != TCL_OK) {
return TCL_ERROR;
}
while (!Tk_TopWinHierarchy(masterPtr)) {
@@ -5028,35 +5541,30 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
Tk_MakeWindowExist((Tk_Window) masterPtr);
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[2]),
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[2]),
"\" a transient: it is an icon for ",
- Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
wmPtr2 = masterPtr->wmInfoPtr;
if (wmPtr2->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[3]),
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[3]),
"\" a master: it is an icon for ",
- Tk_PathName(wmPtr2->iconFor),
- (char *) NULL);
+ Tk_PathName(wmPtr2->iconFor), NULL);
return TCL_ERROR;
}
if (masterPtr == winPtr) {
Tcl_AppendResult(interp, "can't make \"", Tk_PathName(winPtr),
- "\" its own master",
- (char *) NULL);
+ "\" its own master", NULL);
return TCL_ERROR;
} else if (masterPtr != wmPtr->masterPtr) {
/*
- * Remove old master map/unmap binding before setting
- * the new master. The event handler will ensure that
- * transient states reflect the state of the master.
+ * Remove old master map/unmap binding before setting the new
+ * master. The event handler will ensure that transient states
+ * reflect the state of the master.
*/
if (wmPtr->masterPtr != NULL) {
@@ -5091,7 +5599,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
*
* WmWithdrawCmd --
*
- * This procedure is invoked to process the "wm withdraw" Tcl command.
+ * This function is invoked to process the "wm withdraw" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -5104,12 +5612,12 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmWithdrawCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5119,23 +5627,32 @@ WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't withdraw ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
- wmPtr->flags |= WM_WITHDRAWN;
- TkpWmSetState(winPtr, WithdrawnState);
+
+ if (winPtr->flags & TK_EMBEDDED) {
+ if (SendMessage(wmPtr->wrapper, TK_WITHDRAW, 0, 0) < 0) {
+ Tcl_AppendResult(interp, "can't withdraw", Tcl_GetString(objv[2]),
+ ": the container does not support the request", NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ wmPtr->flags |= WM_WITHDRAWN;
+ TkpWmSetState(winPtr, WithdrawnState);
+ }
return TCL_OK;
}
/*
- * Invoked by those wm subcommands that affect geometry.
- * Schedules a geometry update.
+ * Invoked by those wm subcommands that affect geometry. Schedules a geometry
+ * update.
*/
+
static void
-WmUpdateGeom(wmPtr, winPtr)
- WmInfo *wmPtr;
- TkWindow *winPtr;
+WmUpdateGeom(
+ WmInfo *wmPtr,
+ TkWindow *winPtr)
{
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
@@ -5145,9 +5662,9 @@ WmUpdateGeom(wmPtr, winPtr)
/*ARGSUSED*/
static void
-WmWaitVisibilityOrMapProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to window. */
- XEvent *eventPtr; /* Information about event. */
+WmWaitVisibilityOrMapProc(
+ ClientData clientData, /* Pointer to window. */
+ XEvent *eventPtr) /* Information about event. */
{
TkWindow *winPtr = (TkWindow *) clientData;
TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr;
@@ -5156,8 +5673,9 @@ WmWaitVisibilityOrMapProc(clientData, eventPtr)
return;
if (eventPtr->type == MapNotify) {
- if (!(winPtr->wmInfoPtr->flags & WM_WITHDRAWN))
+ if (!(winPtr->wmInfoPtr->flags & WM_WITHDRAWN)) {
TkpWmSetState(winPtr, NormalState);
+ }
} else if (eventPtr->type == UnmapNotify) {
TkpWmSetState(winPtr, WithdrawnState);
}
@@ -5179,34 +5697,34 @@ WmWaitVisibilityOrMapProc(clientData, eventPtr)
*
* Tk_SetGrid --
*
- * This procedure is invoked by a widget when it wishes to set a grid
- * coordinate system that controls the size of a top-level window.
- * It provides a C interface equivalent to the "wm grid" command and
- * is usually asscoiated with the -setgrid option.
+ * This function is invoked by a widget when it wishes to set a grid
+ * coordinate system that controls the size of a top-level window. It
+ * provides a C interface equivalent to the "wm grid" command and is
+ * usually asscoiated with the -setgrid option.
*
* Results:
* None.
*
* Side effects:
- * Grid-related information will be passed to the window manager, so
- * that the top-level window associated with tkwin will resize on
- * even grid units. If some other window already controls gridding
- * for the top-level window then this procedure call has no effect.
+ * Grid-related information will be passed to the window manager, so that
+ * the top-level window associated with tkwin will resize on even grid
+ * units. If some other window already controls gridding for the
+ * top-level window then this function call has no effect.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
- Tk_Window tkwin; /* Token for window. New window mgr info
- * will be posted for the top-level window
+Tk_SetGrid(
+ Tk_Window tkwin, /* Token for window. New window mgr info will
+ * be posted for the top-level window
* associated with this window. */
- int reqWidth; /* Width (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int reqHeight; /* Height (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int widthInc, heightInc; /* Pixel increments corresponding to a
- * change of one grid unit. */
+ int reqWidth, /* Width (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int reqHeight, /* Height (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int widthInc, int heightInc)/* Pixel increments corresponding to a change
+ * of one grid unit. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
register WmInfo *wmPtr;
@@ -5214,6 +5732,7 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
/*
* Ensure widthInc and heightInc are greater than 0
*/
+
if (widthInc <= 0) {
widthInc = 1;
}
@@ -5221,7 +5740,6 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
heightInc = 1;
}
-
/*
* Find the top-level window for tkwin, plus the window manager
* information.
@@ -5249,15 +5767,15 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
}
/*
- * If gridding was previously off, then forget about any window
- * size requests made by the user or via "wm geometry": these are
- * in pixel units and there's no easy way to translate them to
- * grid units since the new requested size of the top-level window in
- * pixels may not yet have been registered yet (it may filter up
- * the hierarchy in DoWhenIdle handlers). However, if the window
- * has never been mapped yet then just leave the window size alone:
- * assume that it is intended to be in grid units but just happened
- * to have been specified before this procedure was called.
+ * If gridding was previously off, then forget about any window size
+ * requests made by the user or via "wm geometry": these are in pixel
+ * units and there's no easy way to translate them to grid units since the
+ * new requested size of the top-level window in pixels may not yet have
+ * been registered yet (it may filter up the hierarchy in DoWhenIdle
+ * handlers). However, if the window has never been mapped yet then just
+ * leave the window size alone: assume that it is intended to be in grid
+ * units but just happened to have been specified before this function was
+ * called.
*/
if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -5266,8 +5784,8 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
}
/*
- * Set the new gridding information, and start the process of passing
- * all of this information to the window manager.
+ * Set the new gridding information, and start the process of passing all
+ * of this information to the window manager.
*/
wmPtr->gridWin = tkwin;
@@ -5287,23 +5805,22 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
*
* Tk_UnsetGrid --
*
- * This procedure cancels the effect of a previous call
- * to Tk_SetGrid.
+ * This function cancels the effect of a previous call to Tk_SetGrid.
*
* Results:
* None.
*
* Side effects:
* If tkwin currently controls gridding for its top-level window,
- * gridding is cancelled for that top-level window; if some other
- * window controls gridding then this procedure has no effect.
+ * gridding is cancelled for that top-level window; if some other window
+ * controls gridding then this function has no effect.
*
*----------------------------------------------------------------------
*/
void
-Tk_UnsetGrid(tkwin)
- Tk_Window tkwin; /* Token for window that is currently
+Tk_UnsetGrid(
+ Tk_Window tkwin) /* Token for window that is currently
* controlling gridding. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -5348,23 +5865,23 @@ Tk_UnsetGrid(tkwin)
*
* TopLevelEventProc --
*
- * This procedure is invoked when a top-level (or other externally-
- * managed window) is restructured in any way.
+ * This function is invoked when a top-level (or other externally-managed
+ * window) is restructured in any way.
*
* Results:
* None.
*
* Side effects:
- * Tk's internal data structures for the window get modified to
- * reflect the structural change.
+ * Tk's internal data structures for the window get modified to reflect
+ * the structural change.
*
*----------------------------------------------------------------------
*/
static void
-TopLevelEventProc(clientData, eventPtr)
- ClientData clientData; /* Window for which event occurred. */
- XEvent *eventPtr; /* Event that just happened. */
+TopLevelEventProc(
+ ClientData clientData, /* Window for which event occurred. */
+ XEvent *eventPtr) /* Event that just happened. */
{
register TkWindow *winPtr = (TkWindow *) clientData;
@@ -5374,8 +5891,8 @@ TopLevelEventProc(clientData, eventPtr)
if (!(winPtr->flags & TK_ALREADY_DEAD)) {
/*
* A top-level window was deleted externally (e.g., by the window
- * manager). This is probably not a good thing, but cleanup as
- * best we can. The error handler is needed because
+ * manager). This is probably not a good thing, but cleanup as
+ * best we can. The error handler is needed because
* Tk_DestroyWindow will try to destroy the window, but of course
* it's already gone.
*/
@@ -5386,16 +5903,6 @@ TopLevelEventProc(clientData, eventPtr)
Tk_DeleteErrorHandler(handler);
}
}
- else if (eventPtr->type == ConfigureNotify) {
- WmInfo *wmPtr;
- wmPtr = winPtr->wmInfoPtr;
-
- if (winPtr->flags & TK_EMBEDDED) {
- Tk_Window tkwin = (Tk_Window)winPtr;
- SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
- Tk_ReqHeight(tkwin));
- }
- }
}
/*
@@ -5403,36 +5910,38 @@ TopLevelEventProc(clientData, eventPtr)
*
* TopLevelReqProc --
*
- * This procedure is invoked by the geometry manager whenever
- * the requested size for a top-level window is changed.
+ * This function is invoked by the geometry manager whenever the
+ * requested size for a top-level window is changed.
*
* Results:
* None.
*
* Side effects:
- * Arrange for the window to be resized to satisfy the request
- * (this happens as a when-idle action).
+ * Arrange for the window to be resized to satisfy the request (this
+ * happens as a when-idle action).
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
-TopLevelReqProc(dummy, tkwin)
- ClientData dummy; /* Not used. */
- Tk_Window tkwin; /* Information about window. */
+TopLevelReqProc(
+ ClientData dummy, /* Not used. */
+ Tk_Window tkwin) /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
wmPtr = winPtr->wmInfoPtr;
- if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) {
- SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
- Tk_ReqHeight(tkwin));
- }
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
+ if (wmPtr) {
+ if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) {
+ SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
+ Tk_ReqHeight(tkwin));
+ }
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
}
}
@@ -5441,26 +5950,25 @@ TopLevelReqProc(dummy, tkwin)
*
* UpdateGeometryInfo --
*
- * This procedure is invoked when a top-level window is first
- * mapped, and also as a when-idle procedure, to bring the
- * geometry and/or position of a top-level window back into
- * line with what has been requested by the user and/or widgets.
- * This procedure doesn't return until the system has
+ * This function is invoked when a top-level window is first mapped, and
+ * also as a when-idle function, to bring the geometry and/or position of
+ * a top-level window back into line with what has been requested by the
+ * user and/or widgets. This function doesn't return until the system has
* responded to the geometry change.
*
* Results:
* None.
*
* Side effects:
- * The window's size and location may change, unless the WM prevents
- * that from happening.
+ * The window's size and location may change, unless the WM prevents that
+ * from happening.
*
*----------------------------------------------------------------------
*/
static void
-UpdateGeometryInfo(clientData)
- ClientData clientData; /* Pointer to the window's record. */
+UpdateGeometryInfo(
+ ClientData clientData) /* Pointer to the window's record. */
{
int x, y; /* Position of border on desktop. */
int width, height; /* Size of client area. */
@@ -5472,24 +5980,23 @@ UpdateGeometryInfo(clientData)
wmPtr->flags &= ~WM_UPDATE_PENDING;
/*
- * If the window is minimized or maximized, we should not update
- * our geometry since it will end up with the wrong values.
- * ConfigureToplevel will reschedule UpdateGeometryInfo when the
- * state of the window changes.
+ * If the window is minimized or maximized, we should not update our
+ * geometry since it will end up with the wrong values. ConfigureToplevel
+ * will reschedule UpdateGeometryInfo when the state of the window
+ * changes.
*/
if (wmPtr->wrapper && (IsIconic(wmPtr->wrapper) ||
- IsZoomed(wmPtr->wrapper))) {
+ IsZoomed(wmPtr->wrapper) || (wmPtr->flags & WM_FULLSCREEN))) {
return;
}
/*
- * Compute the border size for the current window style. This
- * size will include the resize handles, the title bar and the
- * menubar. Note that this size will not be correct if the
- * menubar spans multiple lines. The height will be off by a
- * multiple of the menubar height. It really only measures the
- * minimum size of the border.
+ * Compute the border size for the current window style. This size will
+ * include the resize handles, the title bar and the menubar. Note that
+ * this size will not be correct if the menubar spans multiple lines. The
+ * height will be off by a multiple of the menubar height. It really only
+ * measures the minimum size of the border.
*/
rect.left = rect.right = rect.top = rect.bottom = 0;
@@ -5499,15 +6006,13 @@ UpdateGeometryInfo(clientData)
wmPtr->borderHeight = rect.bottom - rect.top;
/*
- * Compute the new size for the top-level window. See the
- * user documentation for details on this, but the size
- * requested depends on (a) the size requested internally
- * by the window's widgets, (b) the size requested by the
- * user in a "wm geometry" command or via wm-based interactive
- * resizing (if any), (c) whether or not the window is
- * gridded, and (d) the current min or max size for
- * the toplevel. Don't permit sizes <= 0 because this upsets
- * the X server.
+ * Compute the new size for the top-level window. See the user
+ * documentation for details on this, but the size requested depends on
+ * (a) the size requested internally by the window's widgets, (b) the size
+ * requested by the user in a "wm geometry" command or via wm-based
+ * interactive resizing (if any), (c) whether or not the window is
+ * gridded, and (d) the current min or max size for the toplevel. Don't
+ * permit sizes <= 0 because this upsets the X server.
*/
if (wmPtr->width == -1) {
@@ -5521,15 +6026,17 @@ UpdateGeometryInfo(clientData)
if (width <= 0) {
width = 1;
}
+
/*
* Account for window max/min width
*/
+
if (wmPtr->gridWin != NULL) {
min = winPtr->reqWidth
+ (wmPtr->minWidth - wmPtr->reqGridWidth)*wmPtr->widthInc;
if (wmPtr->maxWidth > 0) {
max = winPtr->reqWidth
- + (wmPtr->maxWidth - wmPtr->reqGridWidth)*wmPtr->widthInc;
+ + (wmPtr->maxWidth - wmPtr->reqGridWidth)*wmPtr->widthInc;
} else {
max = 0;
}
@@ -5554,15 +6061,17 @@ UpdateGeometryInfo(clientData)
if (height <= 0) {
height = 1;
}
+
/*
* Account for window max/min height
*/
+
if (wmPtr->gridWin != NULL) {
min = winPtr->reqHeight
+ (wmPtr->minHeight - wmPtr->reqGridHeight)*wmPtr->heightInc;
if (wmPtr->maxHeight > 0) {
max = winPtr->reqHeight
- + (wmPtr->maxHeight - wmPtr->reqGridHeight)*wmPtr->heightInc;
+ + (wmPtr->maxHeight-wmPtr->reqGridHeight)*wmPtr->heightInc;
} else {
max = 0;
}
@@ -5578,55 +6087,37 @@ UpdateGeometryInfo(clientData)
/*
* Compute the new position for the upper-left pixel of the window's
- * decorative frame. This is tricky, because we need to include the
- * border widths supplied by a reparented parent in this calculation,
- * but can't use the parent's current overall size since that may
- * change as a result of this code.
+ * decorative frame. This is tricky, because we need to include the border
+ * widths supplied by a reparented parent in this calculation, but can't
+ * use the parent's current overall size since that may change as a result
+ * of this code.
*/
if (wmPtr->flags & WM_NEGATIVE_X) {
x = DisplayWidth(winPtr->display, winPtr->screenNum) - wmPtr->x
- (width + wmPtr->borderWidth);
} else {
- x = wmPtr->x;
+ x = wmPtr->x;
}
if (wmPtr->flags & WM_NEGATIVE_Y) {
y = DisplayHeight(winPtr->display, winPtr->screenNum) - wmPtr->y
- (height + wmPtr->borderHeight);
} else {
- y = wmPtr->y;
- }
-
- /*
- * If this window is embedded and the container is also in this
- * process, we don't need to do anything special about the
- * geometry, except to make sure that the desired size is known
- * by the container. Also, zero out any position information,
- * since embedded windows are not allowed to move.
- */
-
- if (winPtr->flags & TK_BOTH_HALVES) {
- TkWindow *childPtr = TkpGetOtherWindow(winPtr);
-
- wmPtr->x = wmPtr->y = 0;
- wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
- if (childPtr != NULL) {
- Tk_GeometryRequest((Tk_Window) childPtr, width, height);
- }
- return;
+ y = wmPtr->y;
}
/*
- * Reconfigure the window if it isn't already configured correctly. Base
+ * Reconfigure the window if it isn't already configured correctly. Base
* the size check on what we *asked for* last time, not what we got.
* Return immediately if there have been no changes in the requested
* geometry of the toplevel.
*/
+
/* TODO: need to add flag for possible menu size change */
- if (!((wmPtr->flags & WM_MOVE_PENDING)
- || (width != wmPtr->configWidth)
- || (height != wmPtr->configHeight))) {
+ if (!(wmPtr->flags & WM_MOVE_PENDING)
+ && (width == wmPtr->configWidth)
+ && (height == wmPtr->configHeight)) {
return;
}
wmPtr->flags &= ~WM_MOVE_PENDING;
@@ -5635,9 +6126,8 @@ UpdateGeometryInfo(clientData)
wmPtr->configHeight = height;
/*
- * Don't bother moving the window if we are in the process of
- * creating it. Just update the geometry info based on what
- * we asked for.
+ * Don't bother moving the window if we are in the process of creating it.
+ * Just update the geometry info based on what we asked for.
*/
if (wmPtr->flags & WM_CREATE_PENDING) {
@@ -5651,12 +6141,13 @@ UpdateGeometryInfo(clientData)
wmPtr->flags |= WM_SYNC_PENDING;
if (winPtr->flags & TK_EMBEDDED) {
/*
- * The wrapper window is in a different process, so we need
- * to send it a geometry request. This protocol assumes that
- * the other process understands this Tk message, otherwise
- * our requested geometry will be ignored.
+ * The wrapper window is in a different process, so we need to send it
+ * a geometry request. This protocol assumes that the other process
+ * understands this Tk message, otherwise our requested geometry will
+ * be ignored.
*/
+ SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, x, y);
SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, width, height);
} else {
int reqHeight, reqWidth;
@@ -5665,15 +6156,13 @@ UpdateGeometryInfo(clientData)
int newHeight;
/*
- * We have to keep resizing the window until we get the
- * requested height in the client area. If the client
- * area has zero height, then the window rect is too
- * small by definition. Try increasing the border height
- * and try again. Once we have a positive size, then
- * we can adjust the height exactly. If the window
- * rect comes back smaller than we requested, we have
- * hit the maximum constraints that Windows imposes.
- * Once we find a positive client size, the next size
+ * We have to keep resizing the window until we get the requested
+ * height in the client area. If the client area has zero height, then
+ * the window rect is too small by definition. Try increasing the
+ * border height and try again. Once we have a positive size, then we
+ * can adjust the height exactly. If the window rect comes back
+ * smaller than we requested, we have hit the maximum constraints that
+ * Windows imposes. Once we find a positive client size, the next size
* is the one we try no matter what.
*/
@@ -5705,11 +6194,13 @@ UpdateGeometryInfo(clientData)
/*
* We're done.
*/
+
break;
} else if (newHeight > height) {
/*
* One last resize to get rid of the extra space.
*/
+
menuInc = newHeight - height;
reqHeight -= menuInc;
if (wmPtr->flags & WM_NEGATIVE_Y) {
@@ -5720,11 +6211,10 @@ UpdateGeometryInfo(clientData)
}
/*
- * We didn't get enough space to satisfy our requested
- * height, so the menu must have wrapped. Increase the
- * size of the window by one menu height and move the
- * window if it is positioned relative to the lower right
- * corner of the screen.
+ * We didn't get enough space to satisfy our requested height, so
+ * the menu must have wrapped. Increase the size of the window by
+ * one menu height and move the window if it is positioned
+ * relative to the lower right corner of the screen.
*/
reqHeight += menuInc;
@@ -5744,13 +6234,12 @@ UpdateGeometryInfo(clientData)
*
* ParseGeometry --
*
- * This procedure parses a geometry string and updates
- * information used to control the geometry of a top-level
- * window.
+ * This function parses a geometry string and updates information used to
+ * control the geometry of a top-level window.
*
* Results:
- * A standard Tcl return value, plus an error message in
- * the interp's result if an error occurs.
+ * A standard Tcl return value, plus an error message in the interp's
+ * result if an error occurs.
*
* Side effects:
* The size and/or location of winPtr may change.
@@ -5759,12 +6248,12 @@ UpdateGeometryInfo(clientData)
*/
static int
-ParseGeometry(interp, string, winPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- char *string; /* String containing new geometry. Has the
+ParseGeometry(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ char *string, /* String containing new geometry. Has the
* standard form "=wxh+x+y". */
- TkWindow *winPtr; /* Pointer to top-level window whose
- * geometry is to be changed. */
+ TkWindow *winPtr) /* Pointer to top-level window whose geometry
+ * is to be changed. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, flags;
@@ -5780,9 +6269,9 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Parse the width and height, if they are present. Don't
- * actually update any of the fields of wmPtr until we've
- * successfully parsed the entire geometry string.
+ * Parse the width and height, if they are present. Don't actually update
+ * any of the fields of wmPtr until we've successfully parsed the entire
+ * geometry string.
*/
width = wmPtr->width;
@@ -5836,10 +6325,10 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Assume that the geometry information came from the user,
- * unless an explicit source has been specified. Otherwise
- * most window managers assume that the size hints were
- * program-specified and they ignore them.
+ * Assume that the geometry information came from the user, unless an
+ * explicit source has been specified. Otherwise most window managers
+ * assume that the size hints were program-specified and they ignore
+ * them.
*/
if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
@@ -5848,9 +6337,9 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Everything was parsed OK. Update the fields of *wmPtr and
- * arrange for the appropriate information to be percolated out
- * to the window manager at the next idle moment.
+ * Everything was parsed OK. Update the fields of *wmPtr and arrange for
+ * the appropriate information to be percolated out to the window manager
+ * at the next idle moment.
*/
wmPtr->width = width;
@@ -5866,9 +6355,8 @@ ParseGeometry(interp, string, winPtr)
}
return TCL_OK;
- error:
- Tcl_AppendResult(interp, "bad geometry specifier \"",
- string, "\"", (char *) NULL);
+ error:
+ Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
return TCL_ERROR;
}
@@ -5877,13 +6365,13 @@ ParseGeometry(interp, string, winPtr)
*
* Tk_GetRootCoords --
*
- * Given a token for a window, this procedure traces through the
- * window's lineage to find the (virtual) root-window coordinates
- * corresponding to point (0,0) in the window.
+ * Given a token for a window, this function traces through the window's
+ * lineage to find the (virtual) root-window coordinates corresponding to
+ * point (0,0) in the window.
*
* Results:
- * The locations pointed to by xPtr and yPtr are filled in with
- * the root coordinates of the (0,0) point in tkwin.
+ * The locations pointed to by xPtr and yPtr are filled in with the root
+ * coordinates of the (0,0) point in tkwin.
*
* Side effects:
* None.
@@ -5892,10 +6380,10 @@ ParseGeometry(interp, string, winPtr)
*/
void
-Tk_GetRootCoords(tkwin, xPtr, yPtr)
- Tk_Window tkwin; /* Token for window. */
- int *xPtr; /* Where to store x-displacement of (0,0). */
- int *yPtr; /* Where to store y-displacement of (0,0). */
+Tk_GetRootCoords(
+ Tk_Window tkwin, /* Token for window. */
+ int *xPtr, /* Where to store x-displacement of (0,0). */
+ int *yPtr) /* Where to store y-displacement of (0,0). */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -5925,13 +6413,13 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
*
* Tk_CoordsToWindow --
*
- * Given the (virtual) root coordinates of a point, this procedure
- * returns the token for the top-most window covering that point,
- * if there exists such a window in this application.
+ * Given the (virtual) root coordinates of a point, this function returns
+ * the token for the top-most window covering that point, if there exists
+ * such a window in this application.
*
* Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
* window.
*
* Side effects:
@@ -5941,13 +6429,13 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
*/
Tk_Window
-Tk_CoordsToWindow(rootX, rootY, tkwin)
- int rootX, rootY; /* Coordinates of point in root window. If
- * a virtual-root window manager is in use,
+Tk_CoordsToWindow(
+ int rootX, int rootY, /* Coordinates of point in root window. If a
+ * virtual-root window manager is in use,
* these coordinates refer to the virtual
* root, not the real root. */
- Tk_Window tkwin; /* Token for any window in application;
- * used to identify the display. */
+ Tk_Window tkwin) /* Token for any window in application; used
+ * to identify the display. */
{
POINT pos;
HWND hwnd;
@@ -5969,16 +6457,15 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
*
* Tk_GetVRootGeometry --
*
- * This procedure returns information about the virtual root
- * window corresponding to a particular Tk window.
+ * This function returns information about the virtual root window
+ * corresponding to a particular Tk window.
*
* Results:
- * The values at xPtr, yPtr, widthPtr, and heightPtr are set
- * with the offset and dimensions of the root window corresponding
- * to tkwin. If tkwin is being managed by a virtual root window
- * manager these values correspond to the virtual root window being
- * used for tkwin; otherwise the offsets will be 0 and the
- * dimensions will be those of the screen.
+ * The values at xPtr, yPtr, widthPtr, and heightPtr are set with the
+ * offset and dimensions of the root window corresponding to tkwin. If
+ * tkwin is being managed by a virtual root window manager these values
+ * correspond to the virtual root window being used for tkwin; otherwise
+ * the offsets will be 0 and the dimensions will be those of the screen.
*
* Side effects:
* Vroot window information is refreshed if it is out of date.
@@ -5987,22 +6474,24 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
*/
void
-Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
- Tk_Window tkwin; /* Window whose virtual root is to be
+Tk_GetVRootGeometry(
+ Tk_Window tkwin, /* Window whose virtual root is to be
* queried. */
- int *xPtr, *yPtr; /* Store x and y offsets of virtual root
+ int *xPtr, int *yPtr, /* Store x and y offsets of virtual root
* here. */
- int *widthPtr, *heightPtr; /* Store dimensions of virtual root here. */
+ int *widthPtr, int *heightPtr)
+ /* Store dimensions of virtual root here. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
/*
- * XXX: This is not correct for multiple monitors. There may be many
+ * XXX: This is not correct for multiple monitors. There may be many
* changes required to get this right, and it may effect existing
- * applications that don't consider possible <0 vroot. See
- * http://msdn.microsoft.com/library/en-us/gdi/monitor_3lrn.asp
- * for more info.
+ * applications that don't consider possible <0 vroot. See
+ * http://msdn.microsoft.com/library/en-us/gdi/monitor_3lrn.asp for more
+ * info.
*/
+
*xPtr = 0;
*yPtr = 0;
*widthPtr = DisplayWidth(winPtr->display, winPtr->screenNum);
@@ -6014,27 +6503,25 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
*
* Tk_MoveToplevelWindow --
*
- * This procedure is called instead of Tk_MoveWindow to adjust
- * the x-y location of a top-level window. It delays the actual
- * move to a later time and keeps window-manager information
- * up-to-date with the move
+ * This function is called instead of Tk_MoveWindow to adjust the x-y
+ * location of a top-level window. It delays the actual move to a later
+ * time and keeps window-manager information up-to-date with the move
*
* Results:
* None.
*
* Side effects:
* The window is eventually moved so that its upper-left corner
- * (actually, the upper-left corner of the window's decorative
- * frame, if there is one) is at (x,y).
+ * (actually, the upper-left corner of the window's decorative frame, if
+ * there is one) is at (x,y).
*
*----------------------------------------------------------------------
*/
void
-Tk_MoveToplevelWindow(tkwin, x, y)
- Tk_Window tkwin; /* Window to move. */
- int x, y; /* New location for window (within
- * parent). */
+Tk_MoveToplevelWindow(
+ Tk_Window tkwin, /* Window to move. */
+ int x, int y) /* New location for window (within parent). */
{
TkWindow *winPtr = (TkWindow *) tkwin;
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -6052,9 +6539,8 @@ Tk_MoveToplevelWindow(tkwin, x, y)
/*
* If the window has already been mapped, must bring its geometry
- * up-to-date immediately, otherwise an event might arrive from the
- * server that would overwrite wmPtr->x and wmPtr->y and lose the
- * new position.
+ * up-to-date immediately, otherwise an event might arrive from the server
+ * that would overwrite wmPtr->x and wmPtr->y and lose the new position.
*/
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -6070,25 +6556,23 @@ Tk_MoveToplevelWindow(tkwin, x, y)
*
* TkWmProtocolEventProc --
*
- * This procedure is called by the Tk_HandleEvent whenever a
- * ClientMessage event arrives whose type is "WM_PROTOCOLS".
- * This procedure handles the message from the window manager
- * in an appropriate fashion.
+ * This function is called by the Tk_HandleEvent whenever a ClientMessage
+ * event arrives whose type is "WM_PROTOCOLS". This function handles the
+ * message from the window manager in an appropriate fashion.
*
* Results:
* None.
*
* Side effects:
- * Depends on what sort of handler, if any, was set up for the
- * protocol.
+ * Depends on what sort of handler, if any, was set up for the protocol.
*
*----------------------------------------------------------------------
*/
void
-TkWmProtocolEventProc(winPtr, eventPtr)
- TkWindow *winPtr; /* Window to which the event was sent. */
- XEvent *eventPtr; /* X event. */
+TkWmProtocolEventProc(
+ TkWindow *winPtr, /* Window to which the event was sent. */
+ XEvent *eventPtr) /* X event. */
{
WmInfo *wmPtr;
register ProtocolHandler *protPtr;
@@ -6105,14 +6589,15 @@ TkWmProtocolEventProc(winPtr, eventPtr)
protPtr = protPtr->nextPtr) {
if (protocol == protPtr->protocol) {
/*
- * Cache atom name, as we might destroy the window as a
- * result of the eval.
+ * Cache atom name, as we might destroy the window as a result of
+ * the eval.
*/
+
CONST char *name = Tk_GetAtomName((Tk_Window) winPtr, protocol);
Tcl_Preserve((ClientData) protPtr);
- interp = protPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ interp = protPtr->interp;
+ Tcl_Preserve((ClientData) interp);
result = Tcl_GlobalEval(interp, protPtr->command);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command for \"");
@@ -6120,15 +6605,15 @@ TkWmProtocolEventProc(winPtr, eventPtr)
Tcl_AddErrorInfo(interp, "\" window manager protocol)");
Tcl_BackgroundError(interp);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release((ClientData) interp);
Tcl_Release((ClientData) protPtr);
return;
}
}
/*
- * No handler was present for this protocol. If this is a
- * WM_DELETE_WINDOW message then just destroy the window.
+ * No handler was present for this protocol. If this is a WM_DELETE_WINDOW
+ * message then just destroy the window.
*/
if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) {
@@ -6141,9 +6626,8 @@ TkWmProtocolEventProc(winPtr, eventPtr)
*
* TkWmStackorderToplevelEnumProc --
*
- * This procedure is invoked once for each HWND Window on the
- * display as a result of calling EnumWindows from
- * TkWmStackorderToplevel.
+ * This function is invoked once for each HWND Window on the display as a
+ * result of calling EnumWindows from TkWmStackorderToplevel.
*
* Results:
* TRUE to request further iteration.
@@ -6154,30 +6638,37 @@ TkWmProtocolEventProc(winPtr, eventPtr)
*----------------------------------------------------------------------
*/
-BOOL CALLBACK TkWmStackorderToplevelEnumProc(hwnd, lParam)
- HWND hwnd; /* handle to parent window */
- LPARAM lParam; /* application-defined value */
+BOOL CALLBACK
+TkWmStackorderToplevelEnumProc(
+ HWND hwnd, /* Handle to parent window */
+ LPARAM lParam) /* Application-defined value */
{
Tcl_HashEntry *hPtr;
TkWindow *childWinPtr;
TkWmStackorderToplevelPair *pair =
- (TkWmStackorderToplevelPair *) lParam;
+ (TkWmStackorderToplevelPair *) lParam;
/*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/
hPtr = Tcl_FindHashEntry(pair->table, (char *) hwnd);
if (hPtr != NULL) {
- childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
- /* Double check that same HWND does not get passed twice */
- if (childWinPtr == NULL) {
- Tcl_Panic("duplicate HWND in TkWmStackorderToplevelEnumProc");
- } else {
- Tcl_SetHashValue(hPtr, NULL);
- }
- /*fprintf(stderr, "Found mapped HWND %d -> %x (%s)\n", hwnd,
- childWinPtr, childWinPtr->pathName);*/
- *(pair->window_ptr)-- = childWinPtr;
+ childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
+
+ /*
+ * Double check that same HWND does not get passed twice.
+ */
+
+ if (childWinPtr == NULL) {
+ Tcl_Panic("duplicate HWND in TkWmStackorderToplevelEnumProc");
+ } else {
+ Tcl_SetHashValue(hPtr, NULL);
+ }
+ /*
+ fprintf(stderr, "Found mapped HWND %d -> %x (%s)\n", hwnd,
+ childWinPtr, childWinPtr->pathName);
+ */
+ *(pair->window_ptr)-- = childWinPtr;
}
return TRUE;
}
@@ -6187,8 +6678,8 @@ BOOL CALLBACK TkWmStackorderToplevelEnumProc(hwnd, lParam)
*
* TkWmStackorderToplevelWrapperMap --
*
- * This procedure will create a table that maps the wrapper
- * HWND id for a toplevel to the TkWindow structure that is wraps.
+ * This function will create a table that maps the wrapper HWND id for a
+ * toplevel to the TkWindow structure that is wraps.
*
* Results:
* None.
@@ -6200,10 +6691,10 @@ BOOL CALLBACK TkWmStackorderToplevelEnumProc(hwnd, lParam)
*/
static void
-TkWmStackorderToplevelWrapperMap(winPtr, display, table)
- TkWindow *winPtr; /* TkWindow to recurse on */
- Display *display; /* X display of parent window */
- Tcl_HashTable *table; /* Table to maps HWND to TkWindow */
+TkWmStackorderToplevelWrapperMap(
+ TkWindow *winPtr, /* TkWindow to recurse on */
+ Display *display, /* X display of parent window */
+ Tcl_HashTable *table) /* Table to maps HWND to TkWindow */
{
TkWindow *childPtr;
Tcl_HashEntry *hPtr;
@@ -6211,20 +6702,21 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
int newEntry;
if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr) &&
- !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) {
- wrapper = TkWinGetWrapperWindow((Tk_Window) winPtr);
+ !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) {
+ wrapper = TkWinGetWrapperWindow((Tk_Window) winPtr);
- /*fprintf(stderr, "Mapped HWND %d to %x (%s)\n", wrapper,
- winPtr, winPtr->pathName);*/
+ /*
+ fprintf(stderr, "Mapped HWND %d to %x (%s)\n", wrapper,
+ winPtr, winPtr->pathName);
+ */
- hPtr = Tcl_CreateHashEntry(table,
- (char *) wrapper, &newEntry);
- Tcl_SetHashValue(hPtr, winPtr);
+ hPtr = Tcl_CreateHashEntry(table, (char *) wrapper, &newEntry);
+ Tcl_SetHashValue(hPtr, winPtr);
}
for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
- TkWmStackorderToplevelWrapperMap(childPtr, display, table);
+ childPtr = childPtr->nextPtr) {
+ TkWmStackorderToplevelWrapperMap(childPtr, display, table);
}
}
/*
@@ -6232,11 +6724,11 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
*
* TkWmStackorderToplevel --
*
- * This procedure returns the stack order of toplevel windows.
+ * This function returns the stack order of toplevel windows.
*
* Results:
- * An array of pointers to tk window objects in stacking order
- * or else NULL if there was an error.
+ * An array of pointers to tk window objects in stacking order or else
+ * NULL if there was an error.
*
* Side effects:
* None.
@@ -6245,8 +6737,8 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
*/
TkWindow **
-TkWmStackorderToplevel(parentPtr)
- TkWindow *parentPtr; /* Parent toplevel window. */
+TkWmStackorderToplevel(
+ TkWindow *parentPtr) /* Parent toplevel window. */
{
TkWmStackorderToplevelPair pair;
TkWindow **windows;
@@ -6262,28 +6754,28 @@ TkWmStackorderToplevel(parentPtr)
TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
windows = (TkWindow **) ckalloc((table.numEntries+1)
- * sizeof(TkWindow *));
+ * sizeof(TkWindow *));
/*
- * Special cases: If zero or one toplevels were mapped
- * there is no need to call EnumWindows.
+ * Special cases: If zero or one toplevels were mapped there is no need to
+ * call EnumWindows.
*/
switch (table.numEntries) {
case 0:
- windows[0] = NULL;
- goto done;
+ windows[0] = NULL;
+ goto done;
case 1:
- hPtr = Tcl_FirstHashEntry(&table, &search);
- windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
- windows[1] = NULL;
- goto done;
+ hPtr = Tcl_FirstHashEntry(&table, &search);
+ windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
+ windows[1] = NULL;
+ goto done;
}
/*
- * We will be inserting into the array starting at the end
- * and working our way to the beginning since EnumWindows
- * returns windows in highest to lowest order.
+ * We will be inserting into the array starting at the end and working our
+ * way to the beginning since EnumWindows returns windows in highest to
+ * lowest order.
*/
pair.table = &table;
@@ -6292,14 +6784,13 @@ TkWmStackorderToplevel(parentPtr)
if (EnumWindows((WNDENUMPROC) TkWmStackorderToplevelEnumProc,
(LPARAM) &pair) == 0) {
- ckfree((char *) windows);
- windows = NULL;
- } else {
- if (pair.window_ptr != (windows-1))
- Tcl_Panic("num matched toplevel windows does not equal num children");
+ ckfree((char *) windows);
+ windows = NULL;
+ } else if (pair.window_ptr != (windows-1)) {
+ Tcl_Panic("num matched toplevel windows does not equal num children");
}
- done:
+ done:
Tcl_DeleteHashTable(&table);
return windows;
}
@@ -6309,33 +6800,33 @@ TkWmStackorderToplevel(parentPtr)
*
* TkWmRestackToplevel --
*
- * This procedure restacks a top-level window.
+ * This function restacks a top-level window.
*
* Results:
* None.
*
* Side effects:
- * WinPtr gets restacked as specified by aboveBelow and otherPtr.
- * This procedure doesn't return until the restack has taken
- * effect and the ConfigureNotify event for it has been received.
+ * WinPtr gets restacked as specified by aboveBelow and otherPtr. This
+ * function doesn't return until the restack has taken effect and the
+ * ConfigureNotify event for it has been received.
*
*----------------------------------------------------------------------
*/
void
-TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
- TkWindow *winPtr; /* Window to restack. */
- int aboveBelow; /* Gives relative position for restacking;
+TkWmRestackToplevel(
+ TkWindow *winPtr, /* Window to restack. */
+ int aboveBelow, /* Gives relative position for restacking;
* must be Above or Below. */
- TkWindow *otherPtr; /* Window relative to which to restack;
- * if NULL, then winPtr gets restacked
- * above or below *all* siblings. */
+ TkWindow *otherPtr) /* Window relative to which to restack; if
+ * NULL, then winPtr gets restacked above or
+ * below *all* siblings. */
{
HWND hwnd, insertAfter;
/*
- * Can't set stacking order properly until the window is on the
- * screen (mapping it may give it a reparent window).
+ * Can't set stacking order properly until the window is on the screen
+ * (mapping it may give it a reparent window).
*/
if (winPtr->window == None) {
@@ -6355,12 +6846,17 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
TkWmMapWindow(otherPtr);
}
insertAfter = (otherPtr->wmInfoPtr->wrapper != NULL)
- ? otherPtr->wmInfoPtr->wrapper : Tk_GetHWND(otherPtr->window);
+ ? otherPtr->wmInfoPtr->wrapper : Tk_GetHWND(otherPtr->window);
} else {
insertAfter = NULL;
}
- TkWinSetWindowPos(hwnd, insertAfter, aboveBelow);
+ if (winPtr->flags & TK_EMBEDDED) {
+ SendMessage(winPtr->wmInfoPtr->wrapper, TK_RAISEWINDOW,
+ (WPARAM)insertAfter, aboveBelow);
+ } else {
+ TkWinSetWindowPos(hwnd, insertAfter, aboveBelow);
+ }
}
/*
@@ -6368,28 +6864,27 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
*
* TkWmAddToColormapWindows --
*
- * This procedure is called to add a given window to the
- * WM_COLORMAP_WINDOWS property for its top-level, if it
- * isn't already there. It is invoked by the Tk code that
- * creates a new colormap, in order to make sure that colormap
- * information is propagated to the window manager by default.
+ * This function is called to add a given window to the
+ * WM_COLORMAP_WINDOWS property for its top-level, if it isn't already
+ * there. It is invoked by the Tk code that creates a new colormap, in
+ * order to make sure that colormap information is propagated to the
+ * window manager by default.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets added to the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * colormaps have been set explicitly with the
- * "wm colormapwindows" command.
+ * WinPtr's window gets added to the WM_COLORMAP_WINDOWS property of its
+ * nearest top-level ancestor, unless the colormaps have been set
+ * explicitly with the "wm colormapwindows" command.
*
*----------------------------------------------------------------------
*/
void
-TkWmAddToColormapWindows(winPtr)
- TkWindow *winPtr; /* Window with a non-default colormap.
- * Should not be a top-level window. */
+TkWmAddToColormapWindows(
+ TkWindow *winPtr) /* Window with a non-default colormap. Should
+ * not be a top-level window. */
{
TkWindow *topPtr;
TkWindow **oldPtr, **newPtr;
@@ -6402,7 +6897,7 @@ TkWmAddToColormapWindows(winPtr)
for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
if (topPtr == NULL) {
/*
- * Window is being deleted. Skip the whole operation.
+ * Window is being deleted. Skip the whole operation.
*/
return;
@@ -6434,8 +6929,7 @@ TkWmAddToColormapWindows(winPtr)
/*
* Make a new bigger array and use it to reset the property.
- * Automatically add the toplevel itself as the last element
- * of the list.
+ * Automatically add the toplevel itself as the last element of the list.
*/
newPtr = (TkWindow **) ckalloc((unsigned) ((count+2)*sizeof(TkWindow*)));
@@ -6470,26 +6964,26 @@ TkWmAddToColormapWindows(winPtr)
*
* TkWmRemoveFromColormapWindows --
*
- * This procedure is called to remove a given window from the
- * WM_COLORMAP_WINDOWS property for its top-level. It is invoked
- * when windows are deleted.
+ * This function is called to remove a given window from the
+ * WM_COLORMAP_WINDOWS property for its top-level. It is invoked when
+ * windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * top-level itself is being deleted too.
+ * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS property of
+ * its nearest top-level ancestor, unless the top-level itself is being
+ * deleted too.
*
*----------------------------------------------------------------------
*/
void
-TkWmRemoveFromColormapWindows(winPtr)
- TkWindow *winPtr; /* Window that may be present in
+TkWmRemoveFromColormapWindows(
+ TkWindow *winPtr) /* Window that may be present in
* WM_COLORMAP_WINDOWS property for its
- * top-level. Should not be a top-level
+ * top-level. Should not be a top-level
* window. */
{
TkWindow *topPtr;
@@ -6511,8 +7005,8 @@ TkWmRemoveFromColormapWindows(winPtr)
}
if (topPtr->flags & TK_ALREADY_DEAD) {
/*
- * Top-level is being deleted, so there's no need to cleanup
- * the WM_COLORMAP_WINDOWS property.
+ * Top-level is being deleted, so there's no need to cleanup the
+ * WM_COLORMAP_WINDOWS property.
*/
return;
@@ -6523,8 +7017,7 @@ TkWmRemoveFromColormapWindows(winPtr)
}
/*
- * Find the window and slide the following ones down to cover
- * it up.
+ * Find the window and slide the following ones down to cover it up.
*/
count = topPtr->wmInfoPtr->cmapCount;
@@ -6551,36 +7044,42 @@ TkWmRemoveFromColormapWindows(winPtr)
* None.
*
* Side effects:
- * The menu will end up being drawn in the window, and the geometry
- * of the window will have to be changed.
+ * The menu will end up being drawn in the window, and the geometry of
+ * the window will have to be changed.
*
*----------------------------------------------------------------------
*/
void
-TkWinSetMenu(tkwin, hMenu)
- Tk_Window tkwin; /* the window to put the menu in */
- HMENU hMenu; /* the menu to set */
+TkWinSetMenu(
+ Tk_Window tkwin, /* the window to put the menu in */
+ HMENU hMenu) /* the menu to set */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr = winPtr->wmInfoPtr;
- wmPtr->hMenu = hMenu;
+ /* Could be a Frame (i.e. not a Toplevel) */
+ if (wmPtr == NULL)
+ return;
- if (!(wmPtr->flags & TK_EMBEDDED)) {
- if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
- int syncPending = wmPtr->flags & WM_SYNC_PENDING;
+ wmPtr->hMenu = hMenu;
+ if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
+ int syncPending = wmPtr->flags & WM_SYNC_PENDING;
- wmPtr->flags |= WM_SYNC_PENDING;
- SetMenu(wmPtr->wrapper, hMenu);
- if (!syncPending) {
- wmPtr->flags &= ~WM_SYNC_PENDING;
- }
+ wmPtr->flags |= WM_SYNC_PENDING;
+ SetMenu(wmPtr->wrapper, hMenu);
+ if (!syncPending) {
+ wmPtr->flags &= ~WM_SYNC_PENDING;
}
+ }
+ if (!(winPtr->flags & TK_EMBEDDED)) {
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING|WM_MOVE_PENDING;
}
+ } else {
+ SendMessage(wmPtr->wrapper, TK_SETMENU,
+ (WPARAM)hMenu, (LPARAM)Tk_GetMenuHWND(tkwin));
}
}
@@ -6590,7 +7089,7 @@ TkWinSetMenu(tkwin, hMenu)
* ConfigureTopLevel --
*
* Generate a ConfigureNotify event based on the current position
- * information. This procedure is called by TopLevelProc.
+ * information. This function is called by TopLevelProc.
*
* Results:
* None.
@@ -6602,12 +7101,12 @@ TkWinSetMenu(tkwin, hMenu)
*/
static void
-ConfigureTopLevel(pos)
- WINDOWPOS *pos;
+ConfigureTopLevel(
+ WINDOWPOS *pos)
{
TkWindow *winPtr = GetTopLevel(pos->hwnd);
WmInfo *wmPtr;
- int state = 0; /* Current window state. */
+ int state; /* Current window state. */
RECT rect;
WINDOWPLACEMENT windowPos;
@@ -6627,15 +7126,16 @@ ConfigureTopLevel(pos)
windowPos.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(wmPtr->wrapper, &windowPos);
switch (windowPos.showCmd) {
- case SW_SHOWMAXIMIZED:
- state = ZoomState;
- break;
- case SW_SHOWMINIMIZED:
- state = IconicState;
- break;
- case SW_SHOWNORMAL:
- state = NormalState;
- break;
+ case SW_SHOWMAXIMIZED:
+ state = ZoomState;
+ break;
+ case SW_SHOWMINIMIZED:
+ state = IconicState;
+ break;
+ case SW_SHOWNORMAL:
+ default:
+ state = NormalState;
+ break;
}
}
@@ -6647,27 +7147,26 @@ ConfigureTopLevel(pos)
if (wmPtr->hints.initial_state != state) {
wmPtr->hints.initial_state = state;
switch (state) {
- case WithdrawnState:
- case IconicState:
- XUnmapWindow(winPtr->display, winPtr->window);
- break;
+ case WithdrawnState:
+ case IconicState:
+ XUnmapWindow(winPtr->display, winPtr->window);
+ break;
- case NormalState:
- /*
- * Schedule a geometry update. Since we ignore geometry
- * requests while in any other state, the geometry info
- * may be stale.
- */
+ case NormalState:
+ /*
+ * Schedule a geometry update. Since we ignore geometry requests
+ * while in any other state, the geometry info may be stale.
+ */
- if (!(wmPtr->flags & WM_UPDATE_PENDING)) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
- }
- /* fall through */
- case ZoomState:
- XMapWindow(winPtr->display, winPtr->window);
- pos->flags |= SWP_NOMOVE | SWP_NOSIZE;
- break;
+ if (!(wmPtr->flags & WM_UPDATE_PENDING)) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+ /* fall through */
+ case ZoomState:
+ XMapWindow(winPtr->display, winPtr->window);
+ pos->flags |= SWP_NOMOVE | SWP_NOSIZE;
+ break;
}
}
@@ -6681,8 +7180,8 @@ ConfigureTopLevel(pos)
/*
- * Compute the current geometry of the client area, reshape the
- * Tk window and generate a ConfigureNotify event.
+ * Compute the current geometry of the client area, reshape the Tk window
+ * and generate a ConfigureNotify event.
*/
GetClientRect(wmPtr->wrapper, &rect);
@@ -6702,16 +7201,16 @@ ConfigureTopLevel(pos)
if (state == NormalState) {
/*
- * Update size information from the event. There are a couple of
+ * Update size information from the event. There are a couple of
* tricky points here:
*
* 1. If the user changed the size externally then set wmPtr->width
* and wmPtr->height just as if a "wm geometry" command had been
* invoked with the same information.
- * 2. However, if the size is changing in response to a request
- * coming from us (sync is set), then don't set
- * wmPtr->width or wmPtr->height (otherwise the window will stop
- * tracking geometry manager requests).
+ * 2. However, if the size is changing in response to a request coming
+ * from us (sync is set), then don't set wmPtr->width or
+ * wmPtr->height (otherwise the window will stop tracking geometry
+ * manager requests).
*/
if (!(wmPtr->flags & WM_SYNC_PENDING)) {
@@ -6719,14 +7218,14 @@ ConfigureTopLevel(pos)
if ((wmPtr->width == -1)
&& (winPtr->changes.width == winPtr->reqWidth)) {
/*
- * Don't set external width, since the user didn't
- * change it from what the widgets asked for.
+ * Don't set external width, since the user didn't change
+ * it from what the widgets asked for.
*/
} else {
if (wmPtr->gridWin != NULL) {
wmPtr->width = wmPtr->reqGridWidth
- + (winPtr->changes.width - winPtr->reqWidth)
- / wmPtr->widthInc;
+ + (winPtr->changes.width - winPtr->reqWidth)
+ / wmPtr->widthInc;
if (wmPtr->width < 0) {
wmPtr->width = 0;
}
@@ -6743,8 +7242,8 @@ ConfigureTopLevel(pos)
} else {
if (wmPtr->gridWin != NULL) {
wmPtr->height = wmPtr->reqGridHeight
- + (winPtr->changes.height - winPtr->reqHeight)
- / wmPtr->heightInc;
+ + (winPtr->changes.height - winPtr->reqHeight)
+ / wmPtr->heightInc;
if (wmPtr->height < 0) {
wmPtr->height = 0;
}
@@ -6755,9 +7254,10 @@ ConfigureTopLevel(pos)
wmPtr->configWidth = winPtr->changes.width;
wmPtr->configHeight = winPtr->changes.height;
}
+
/*
- * If the user moved the window, we should switch back
- * to normal coordinates.
+ * If the user moved the window, we should switch back to normal
+ * coordinates.
*/
if (!(pos->flags & SWP_NOMOVE)) {
@@ -6771,15 +7271,15 @@ ConfigureTopLevel(pos)
if (wmPtr->flags & WM_NEGATIVE_X) {
wmPtr->x = DisplayWidth(winPtr->display, winPtr->screenNum)
- - winPtr->changes.x - (winPtr->changes.width
- + wmPtr->borderWidth);
+ - winPtr->changes.x - (winPtr->changes.width
+ + wmPtr->borderWidth);
} else {
wmPtr->x = winPtr->changes.x;
}
if (wmPtr->flags & WM_NEGATIVE_Y) {
wmPtr->y = DisplayHeight(winPtr->display, winPtr->screenNum)
- - winPtr->changes.y - (winPtr->changes.height
- + wmPtr->borderHeight);
+ - winPtr->changes.y - (winPtr->changes.height
+ + wmPtr->borderHeight);
} else {
wmPtr->y = winPtr->changes.y;
}
@@ -6791,8 +7291,8 @@ ConfigureTopLevel(pos)
*
* GenerateConfigureNotify --
*
- * Generate a ConfigureNotify event from the current geometry
- * information for the specified toplevel window.
+ * Generate a ConfigureNotify event from the current geometry information
+ * for the specified toplevel window.
*
* Results:
* None.
@@ -6804,8 +7304,8 @@ ConfigureTopLevel(pos)
*/
static void
-GenerateConfigureNotify(winPtr)
- TkWindow *winPtr;
+GenerateConfigureNotify(
+ TkWindow *winPtr)
{
XEvent event;
@@ -6834,8 +7334,8 @@ GenerateConfigureNotify(winPtr)
*
* InstallColormaps --
*
- * Installs the colormaps associated with the toplevel which is
- * currently active.
+ * Installs the colormaps associated with the toplevel which is currently
+ * active.
*
* Results:
* None.
@@ -6847,12 +7347,12 @@ GenerateConfigureNotify(winPtr)
*/
static int
-InstallColormaps(hwnd, message, isForemost)
- HWND hwnd; /* Toplevel wrapper window whose colormaps
+InstallColormaps(
+ HWND hwnd, /* Toplevel wrapper window whose colormaps
* should be installed. */
- int message; /* Either WM_PALETTECHANGED or
+ int message, /* Either WM_PALETTECHANGED or
* WM_QUERYNEWPALETTE */
- int isForemost; /* 1 if window is foremost, else 0 */
+ int isForemost) /* 1 if window is foremost, else 0 */
{
int i;
HDC dc;
@@ -6860,7 +7360,7 @@ InstallColormaps(hwnd, message, isForemost)
TkWindow *winPtr = GetTopLevel(hwnd);
WmInfo *wmPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr == NULL || (winPtr->flags & TK_ALREADY_DEAD) ) {
return 0;
@@ -6899,11 +7399,11 @@ InstallColormaps(hwnd, message, isForemost)
} else {
/*
- * Window is being notified of a change in the system palette.
- * If this window is the foreground window, then we should only
- * install the secondary palettes, since the primary was installed
- * in response to the WM_QUERYPALETTE message. Otherwise, install
- * all of the palettes.
+ * Window is being notified of a change in the system palette. If this
+ * window is the foreground window, then we should only install the
+ * secondary palettes, since the primary was installed in response to
+ * the WM_QUERYPALETTE message. Otherwise, install all of the
+ * palettes.
*/
@@ -6945,11 +7445,10 @@ InstallColormaps(hwnd, message, isForemost)
*
* RefreshColormap --
*
- * This function is called to force all of the windows that use
- * a given colormap to redraw themselves. The quickest way to
- * do this is to iterate over the toplevels, looking in the
- * cmapList for matches. This will quickly eliminate subtrees
- * that don't use a given colormap.
+ * This function is called to force all of the windows that use a given
+ * colormap to redraw themselves. The quickest way to do this is to
+ * iterate over the toplevels, looking in the cmapList for matches. This
+ * will quickly eliminate subtrees that don't use a given colormap.
*
* Results:
* None.
@@ -6961,9 +7460,9 @@ InstallColormaps(hwnd, message, isForemost)
*/
static void
-RefreshColormap(colormap, dispPtr)
- Colormap colormap;
- TkDisplay *dispPtr;
+RefreshColormap(
+ Colormap colormap,
+ TkDisplay *dispPtr)
{
WmInfo *wmPtr;
int i;
@@ -6988,9 +7487,9 @@ RefreshColormap(colormap, dispPtr)
*
* InvalidateSubTree --
*
- * This function recursively generates damage for a window and
- * all of its mapped children that belong to the same toplevel and
- * are using the specified colormap.
+ * This function recursively generates damage for a window and all of its
+ * mapped children that belong to the same toplevel and are using the
+ * specified colormap.
*
* Results:
* None.
@@ -7002,15 +7501,15 @@ RefreshColormap(colormap, dispPtr)
*/
static void
-InvalidateSubTree(winPtr, colormap)
- TkWindow *winPtr;
- Colormap colormap;
+InvalidateSubTree(
+ TkWindow *winPtr,
+ Colormap colormap)
{
TkWindow *childPtr;
/*
- * Generate damage for the current window if it is using the
- * specified colormap.
+ * Generate damage for the current window if it is using the specified
+ * colormap.
*/
if (winPtr->atts.colormap == colormap) {
@@ -7020,8 +7519,7 @@ InvalidateSubTree(winPtr, colormap)
for (childPtr = winPtr->childList; childPtr != NULL;
childPtr = childPtr->nextPtr) {
/*
- * We can stop the descent when we hit an unmapped or
- * toplevel window.
+ * We can stop the descent when we hit an unmapped or toplevel window.
*/
if (!Tk_TopWinHierarchy(childPtr) && Tk_IsMapped(childPtr)) {
@@ -7035,8 +7533,8 @@ InvalidateSubTree(winPtr, colormap)
*
* InvalidateSubTreeDepth --
*
- * This function recursively updates depth info for a window and
- * all of its children that belong to the same toplevel.
+ * This function recursively updates depth info for a window and all of
+ * its children that belong to the same toplevel.
*
* Results:
* None.
@@ -7048,8 +7546,8 @@ InvalidateSubTree(winPtr, colormap)
*/
static void
-InvalidateSubTreeDepth(winPtr)
- TkWindow *winPtr;
+InvalidateSubTreeDepth(
+ TkWindow *winPtr)
{
Display *display = Tk_Display(winPtr);
int screenNum = Tk_ScreenNumber(winPtr);
@@ -7059,10 +7557,10 @@ InvalidateSubTreeDepth(winPtr)
#if 0
/*
- * XXX: What other elements may require changes? Changing just
- * the depth works for standard windows and 16/24/32-bpp changes.
- * I suspect 8-bit (palettized) displays may require colormap and/or
- * visual changes as well.
+ * XXX: What other elements may require changes? Changing just the depth
+ * works for standard windows and 16/24/32-bpp changes. I suspect 8-bit
+ * (palettized) displays may require colormap and/or visual changes as
+ * well.
*/
if (winPtr->window) {
@@ -7074,13 +7572,13 @@ InvalidateSubTreeDepth(winPtr)
#endif
for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
+ childPtr = childPtr->nextPtr) {
/*
- * We can stop the descent when we hit a toplevel window, as it
- * should get its own message.
+ * We can stop the descent when we hit a non-embedded toplevel window,
+ * as it should get its own message.
*/
- if (!Tk_TopWinHierarchy(childPtr)) {
+ if (childPtr->flags & TK_EMBEDDED || !Tk_TopWinHierarchy(childPtr)) {
InvalidateSubTreeDepth(childPtr);
}
}
@@ -7094,8 +7592,8 @@ InvalidateSubTreeDepth(winPtr)
* Retrieves the currently installed foreground palette.
*
* Results:
- * Returns the global foreground palette, if there is one.
- * Otherwise, returns NULL.
+ * Returns the global foreground palette, if there is one. Otherwise,
+ * returns NULL.
*
* Side effects:
* None.
@@ -7104,10 +7602,10 @@ InvalidateSubTreeDepth(winPtr)
*/
HPALETTE
-TkWinGetSystemPalette()
+TkWinGetSystemPalette(void)
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->systemPalette;
}
@@ -7117,17 +7615,16 @@ TkWinGetSystemPalette()
*
* GetMinSize --
*
- * This procedure computes the current minWidth and minHeight
- * values for a window, taking into account the possibility
- * that they may be defaulted.
+ * This function computes the current minWidth and minHeight values for a
+ * window, taking into account the possibility that they may be
+ * defaulted.
*
* Results:
- * The values at *minWidthPtr and *minHeightPtr are filled
- * in with the minimum allowable dimensions of wmPtr's window,
- * in grid units. If the requested minimum is smaller than the
- * system required minimum, then this procedure computes the
- * smallest size that will satisfy both the system and the
- * grid constraints.
+ * The values at *minWidthPtr and *minHeightPtr are filled in with the
+ * minimum allowable dimensions of wmPtr's window, in grid units. If the
+ * requested minimum is smaller than the system required minimum, then
+ * this function computes the smallest size that will satisfy both the
+ * system and the grid constraints.
*
* Side effects:
* None.
@@ -7136,21 +7633,21 @@ TkWinGetSystemPalette()
*/
static void
-GetMinSize(wmPtr, minWidthPtr, minHeightPtr)
- WmInfo *wmPtr; /* Window manager information for the
+GetMinSize(
+ WmInfo *wmPtr, /* Window manager information for the
* window. */
- int *minWidthPtr; /* Where to store the current minimum
- * width of the window. */
- int *minHeightPtr; /* Where to store the current minimum
- * height of the window. */
+ int *minWidthPtr, /* Where to store the current minimum width of
+ * the window. */
+ int *minHeightPtr) /* Where to store the current minimum height
+ * of the window. */
{
int tmp, base;
TkWindow *winPtr = wmPtr->winPtr;
/*
- * Compute the minimum width by taking the default client size
- * and rounding it up to the nearest grid unit. Return the greater
- * of the default minimum and the specified minimum.
+ * Compute the minimum width by taking the default client size and
+ * rounding it up to the nearest grid unit. Return the greater of the
+ * default minimum and the specified minimum.
*/
tmp = wmPtr->defMinWidth - wmPtr->borderWidth;
@@ -7195,16 +7692,15 @@ GetMinSize(wmPtr, minWidthPtr, minHeightPtr)
*
* GetMaxSize --
*
- * This procedure computes the current maxWidth and maxHeight
- * values for a window, taking into account the possibility
- * that they may be defaulted.
+ * This function computes the current maxWidth and maxHeight values for a
+ * window, taking into account the possibility that they may be
+ * defaulted.
*
* Results:
- * The values at *maxWidthPtr and *maxHeightPtr are filled
- * in with the maximum allowable dimensions of wmPtr's window,
- * in grid units. If no maximum has been specified for the
- * window, then this procedure computes the largest sizes that
- * will fit on the screen.
+ * The values at *maxWidthPtr and *maxHeightPtr are filled in with the
+ * maximum allowable dimensions of wmPtr's window, in grid units. If no
+ * maximum has been specified for the window, then this function computes
+ * the largest sizes that will fit on the screen.
*
* Side effects:
* None.
@@ -7213,13 +7709,13 @@ GetMinSize(wmPtr, minWidthPtr, minHeightPtr)
*/
static void
-GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
- WmInfo *wmPtr; /* Window manager information for the
+GetMaxSize(
+ WmInfo *wmPtr, /* Window manager information for the
* window. */
- int *maxWidthPtr; /* Where to store the current maximum
- * width of the window. */
- int *maxHeightPtr; /* Where to store the current maximum
- * height of the window. */
+ int *maxWidthPtr, /* Where to store the current maximum width of
+ * the window. */
+ int *maxHeightPtr) /* Where to store the current maximum height
+ * of the window. */
{
int tmp;
@@ -7227,14 +7723,14 @@ GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
*maxWidthPtr = wmPtr->maxWidth;
} else {
/*
- * Must compute a default width. Fill up the display, leaving a
- * bit of extra space for the window manager's borders.
+ * Must compute a default width. Fill up the display, leaving a bit of
+ * extra space for the window manager's borders.
*/
tmp = wmPtr->defMaxWidth - wmPtr->borderWidth;
if (wmPtr->gridWin != NULL) {
/*
- * Gridding is turned on; convert from pixels to grid units.
+ * Gridding is turned on; convert from pixels to grid units.
*/
tmp = wmPtr->reqGridWidth
@@ -7259,8 +7755,7 @@ GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
*
* TopLevelProc --
*
- * Callback from Windows whenever an event occurs on a top level
- * window.
+ * Callback from Windows whenever an event occurs on a top level window.
*
* Results:
* Standard Windows return value.
@@ -7272,13 +7767,13 @@ GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
*/
static LRESULT CALLBACK
-TopLevelProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+TopLevelProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
- if (message == WM_WINDOWPOSCHANGED) {
+ if (message == WM_WINDOWPOSCHANGED || message == WM_WINDOWPOSCHANGING) {
WINDOWPOS *pos = (WINDOWPOS *) lParam;
TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(pos->hwnd);
@@ -7295,8 +7790,10 @@ TopLevelProc(hwnd, message, wParam, lParam)
winPtr->changes.height = pos->cy;
}
if (!(pos->flags & SWP_NOMOVE)) {
- winPtr->changes.x = pos->x;
- winPtr->changes.y = pos->y;
+ long result = SendMessage(winPtr->wmInfoPtr->wrapper,
+ TK_MOVEWINDOW, -1, -1);
+ winPtr->wmInfoPtr->x = winPtr->changes.x = result >> 16;
+ winPtr->wmInfoPtr->y = winPtr->changes.y = result & 0xffff;
}
GenerateConfigureNotify(winPtr);
@@ -7325,180 +7822,257 @@ TopLevelProc(hwnd, message, wParam, lParam)
*/
static LRESULT CALLBACK
-WmProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+WmProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
static int inMoveSize = 0;
- static int oldMode; /* This static is set upon entering move/size mode
- * and is used to reset the service mode after
- * leaving move/size mode. Note that this mechanism
- * assumes move/size is only one level deep. */
- LRESULT result;
+ static int oldMode; /* This static is set upon entering move/size
+ * mode and is used to reset the service mode
+ * after leaving move/size mode. Note that
+ * this mechanism assumes move/size is only
+ * one level deep. */
+ LRESULT result = 0;
TkWindow *winPtr = NULL;
- if (TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, &result)) {
+ switch (message) {
+ case WM_KILLFOCUS:
+ case WM_ERASEBKGND:
+ result = 0;
goto done;
- }
- switch (message) {
- case WM_KILLFOCUS:
- case WM_ERASEBKGND:
- result = 0;
- goto done;
+ case WM_ENTERSIZEMOVE:
+ inMoveSize = 1;
- case WM_ENTERSIZEMOVE:
- inMoveSize = 1;
+ /*
+ * Cancel any current mouse timer. If the mouse timer fires during the
+ * size/move mouse capture, it will release the capture, which is
+ * wrong.
+ */
- /*
- * Cancel any current mouse timer. If the mouse timer
- * fires during the size/move mouse capture, it will
- * release the capture, which is wrong.
- */
+ TkWinCancelMouseTimer();
- TkWinCancelMouseTimer();
+ oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
+ break;
- oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- break;
+ case WM_ACTIVATE:
+ if ( WA_ACTIVE == LOWORD(wParam) ) {
+ winPtr = GetTopLevel(hwnd);
+ if (winPtr && (TkGrabState(winPtr) == TK_GRAB_EXCLUDED)) {
+ /*
+ * There is a grab in progress so queue an Activate event
+ */
- case WM_ACTIVATE:
- case WM_EXITSIZEMOVE:
- if (inMoveSize) {
- inMoveSize = 0;
- Tcl_SetServiceMode(oldMode);
+ GenerateActivateEvent(winPtr, &inMoveSize);
+ result = 0;
+ goto done;
}
- break;
+ }
+ /* fall through */
+
+ case WM_EXITSIZEMOVE:
+ if (inMoveSize) {
+ inMoveSize = 0;
+ Tcl_SetServiceMode(oldMode);
+ }
+ break;
- case WM_GETMINMAXINFO:
- SetLimits(hwnd, (MINMAXINFO *) lParam);
- result = 0;
- goto done;
+ case WM_GETMINMAXINFO:
+ SetLimits(hwnd, (MINMAXINFO *) lParam);
+ result = 0;
+ goto done;
- case WM_DISPLAYCHANGE:
- /* display and/or color resolution changed */
- winPtr = GetTopLevel(hwnd);
- if (winPtr) {
- Screen *screen = Tk_Screen(winPtr);
- if (screen->root_depth != (int) wParam) {
- /*
- * Color resolution changed, so do extensive rebuild of
- * display parameters. This will affect the display for
- * all Tk windows. We will receive this event for each
- * toplevel, but this check makes us update only once, for
- * the first toplevel that receives the message.
- */
- TkWinDisplayChanged(Tk_Display(winPtr));
- } else {
- HDC dc = GetDC(NULL);
- screen->width = LOWORD(lParam); /* horizontal res */
- screen->height = HIWORD(lParam); /* vertical res */
- screen->mwidth = MulDiv(screen->width, 254,
- GetDeviceCaps(dc, LOGPIXELSX) * 10);
- screen->mheight = MulDiv(screen->height, 254,
- GetDeviceCaps(dc, LOGPIXELSY) * 10);
- ReleaseDC(NULL, dc);
- }
- if (Tk_Depth(winPtr) != (int) wParam) {
- /*
- * Defer the window depth check to here so that each
- * toplevel will properly update depth info.
- */
- InvalidateSubTreeDepth(winPtr);
- }
+ case WM_DISPLAYCHANGE:
+ /*
+ * Display and/or color resolution changed.
+ */
+
+ winPtr = GetTopLevel(hwnd);
+ if (winPtr) {
+ Screen *screen = Tk_Screen(winPtr);
+ if (screen->root_depth != (int) wParam) {
+ /*
+ * Color resolution changed, so do extensive rebuild of
+ * display parameters. This will affect the display for all Tk
+ * windows. We will receive this event for each toplevel, but
+ * this check makes us update only once, for the first
+ * toplevel that receives the message.
+ */
+
+ TkWinDisplayChanged(Tk_Display(winPtr));
+ } else {
+ HDC dc = GetDC(NULL);
+
+ screen->width = LOWORD(lParam); /* horizontal res */
+ screen->height = HIWORD(lParam); /* vertical res */
+ screen->mwidth = MulDiv(screen->width, 254,
+ GetDeviceCaps(dc, LOGPIXELSX) * 10);
+ screen->mheight = MulDiv(screen->height, 254,
+ GetDeviceCaps(dc, LOGPIXELSY) * 10);
+ ReleaseDC(NULL, dc);
}
- result = 0;
- goto done;
+ if (Tk_Depth(winPtr) != (int) wParam) {
+ /*
+ * Defer the window depth check to here so that each toplevel
+ * will properly update depth info.
+ */
- case WM_SYSCOLORCHANGE:
- /*
- * XXX: Called when system color changes. We need to
- * update any widgets that use a system color.
- */
- break;
+ InvalidateSubTreeDepth(winPtr);
+ }
+ }
+ result = 0;
+ goto done;
- case WM_PALETTECHANGED:
- result = InstallColormaps(hwnd, WM_PALETTECHANGED,
- hwnd == (HWND)wParam);
- goto done;
+ case WM_SYSCOLORCHANGE:
+ /*
+ * XXX: Called when system color changes. We need to update any
+ * widgets that use a system color.
+ */
- case WM_QUERYNEWPALETTE:
- result = InstallColormaps(hwnd, WM_QUERYNEWPALETTE, TRUE);
- goto done;
+ break;
- case WM_WINDOWPOSCHANGED:
- ConfigureTopLevel((WINDOWPOS *) lParam);
- result = 0;
- goto done;
+ case WM_PALETTECHANGED:
+ result = InstallColormaps(hwnd, WM_PALETTECHANGED,
+ hwnd == (HWND)wParam);
+ goto done;
- case WM_NCHITTEST: {
- winPtr = GetTopLevel(hwnd);
- if (winPtr && (TkGrabState(winPtr) == TK_GRAB_EXCLUDED)) {
- /*
- * This window is outside the grab heirarchy, so don't let any
- * of the normal non-client processing occur. Note that this
- * implementation is not strictly correct because the grab
- * might change between now and when the event would have been
- * processed by Tk, but it's close enough.
- */
+ case WM_QUERYNEWPALETTE:
+ result = InstallColormaps(hwnd, WM_QUERYNEWPALETTE, TRUE);
+ goto done;
- result = HTCLIENT;
- goto done;
- }
- break;
+ case WM_SETTINGCHANGE:
+ if (wParam == SPI_SETNONCLIENTMETRICS) {
+ winPtr = GetTopLevel(hwnd);
+ TkWinSetupSystemFonts(winPtr->mainPtr);
+ result = 0;
+ goto done;
}
+ break;
- case WM_MOUSEACTIVATE: {
- ActivateEvent *eventPtr;
- winPtr = GetTopLevel((HWND) wParam);
+ case WM_WINDOWPOSCHANGED:
+ ConfigureTopLevel((WINDOWPOS *) lParam);
+ result = 0;
+ goto done;
- if (winPtr && (TkGrabState(winPtr) != TK_GRAB_EXCLUDED)) {
- /*
- * This allows us to pass the message onto the
- * native menus [Bug: 2272]
- */
- result = (*tkWinProcs->defWindowProc)(hwnd, message,
- wParam, lParam);
- goto done;
- }
+ case WM_NCHITTEST: {
+ winPtr = GetTopLevel(hwnd);
+ if (winPtr && (TkGrabState(winPtr) == TK_GRAB_EXCLUDED)) {
+ /*
+ * This window is outside the grab heirarchy, so don't let any of
+ * the normal non-client processing occur. Note that this
+ * implementation is not strictly correct because the grab might
+ * change between now and when the event would have been processed
+ * by Tk, but it's close enough.
+ */
+ result = HTCLIENT;
+ goto done;
+ }
+ break;
+ }
+
+ case WM_MOUSEACTIVATE: {
+ winPtr = GetTopLevel((HWND) wParam);
+ if (winPtr && (TkGrabState(winPtr) != TK_GRAB_EXCLUDED)) {
/*
- * Don't activate the window yet since there is a grab
- * that takes precedence. Instead we need to queue
- * an event so we can check the grab state right before we
- * handle the mouse event.
+ * This allows us to pass the message onto the native menus [Bug:
+ * 2272]
*/
- if (winPtr) {
- eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent));
- eventPtr->ev.proc = ActivateWindow;
- eventPtr->winPtr = winPtr;
- Tcl_QueueEvent((Tcl_Event*)eventPtr, TCL_QUEUE_TAIL);
- }
- result = MA_NOACTIVATE;
+ result = (*tkWinProcs->defWindowProc)(hwnd, message,
+ wParam, lParam);
goto done;
}
- case WM_QUERYENDSESSION: {
- XEvent event;
+ /*
+ * Don't activate the window yet since there is a grab that takes
+ * precedence. Instead we need to queue an event so we can check the
+ * grab state right before we handle the mouse event.
+ */
- winPtr = GetTopLevel(hwnd);
- event.xclient.message_type =
- Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
- event.xclient.data.l[0] =
- Tk_InternAtom((Tk_Window) winPtr, "WM_SAVE_YOURSELF");
- TkWmProtocolEventProc(winPtr, &event);
- break;
+ if (winPtr) {
+ GenerateActivateEvent(winPtr, &inMoveSize);
}
+ result = MA_NOACTIVATE;
+ goto done;
+ }
- default:
- break;
+ case WM_QUERYENDSESSION: {
+ XEvent event;
+
+ /*
+ * Synthesize WM_SAVE_YOURSELF wm protocol message on Windows logout
+ * or restart.
+ */
+ winPtr = GetTopLevel(hwnd);
+ event.xclient.message_type =
+ Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
+ event.xclient.data.l[0] =
+ Tk_InternAtom((Tk_Window) winPtr, "WM_SAVE_YOURSELF");
+ TkWmProtocolEventProc(winPtr, &event);
+ break;
+ }
+
+ default:
+ break;
}
winPtr = GetTopLevel(hwnd);
+ switch(message) {
+ case WM_SYSCOMMAND:
+ /*
+ * If there is a grab in effect then ignore the minimize command
+ * unless the grab is on the main window (.). This is to permit
+ * applications that leave a grab on . to work normally.
+ * All other toplevels are deemed non-minimizable when a grab is
+ * present.
+ * If there is a grab in effect and this window is outside the
+ * grab tree then ignore all system commands. [Bug 1847002]
+ */
+
+ if (winPtr) {
+ int cmd = wParam & 0xfff0;
+ int grab = TkGrabState(winPtr);
+ if ((SC_MINIMIZE == cmd)
+ && (grab == TK_GRAB_IN_TREE || grab == TK_GRAB_ANCESTOR)
+ && (winPtr != winPtr->mainPtr->winPtr)) {
+ goto done;
+ }
+ if (grab == TK_GRAB_EXCLUDED
+ && !(SC_MOVE == cmd || SC_SIZE == cmd)) {
+ goto done;
+ }
+ }
+ /* fall through */
+
+ case WM_INITMENU:
+ case WM_COMMAND:
+ case WM_MENUCHAR:
+ case WM_MEASUREITEM:
+ case WM_DRAWITEM:
+ case WM_MENUSELECT:
+ case WM_ENTERIDLE:
+ case WM_INITMENUPOPUP:
+ if (winPtr) {
+ HWND hMenuHWnd = Tk_GetEmbeddedMenuHWND((Tk_Window)winPtr);
+
+ if (hMenuHWnd) {
+ if (SendMessage(hMenuHWnd, message, wParam, lParam)) {
+ goto done;
+ }
+ } else if (TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam,
+ &result)) {
+ goto done;
+ }
+ }
+ break;
+ }
+
if (winPtr && winPtr->window) {
HWND child = Tk_GetHWND(winPtr->window);
+
if (message == WM_SETFOCUS) {
SetFocus(child);
result = 0;
@@ -7511,7 +8085,7 @@ WmProc(hwnd, message, wParam, lParam)
result = (*tkWinProcs->defWindowProc)(hwnd, message, wParam, lParam);
}
- done:
+ done:
Tcl_ServiceAll();
return result;
}
@@ -7521,8 +8095,8 @@ WmProc(hwnd, message, wParam, lParam)
*
* TkpMakeMenuWindow --
*
- * Configure the window to be either a pull-down (or pop-up)
- * menu, or as a toplevel (torn-off) menu or palette.
+ * Configure the window to be either a pull-down (or pop-up) menu, or as
+ * a toplevel (torn-off) menu or palette.
*
* Results:
* None.
@@ -7534,12 +8108,12 @@ WmProc(hwnd, message, wParam, lParam)
*/
void
-TkpMakeMenuWindow(tkwin, transient)
- Tk_Window tkwin; /* New window. */
- int transient; /* 1 means menu is only posted briefly as
- * a popup or pulldown or cascade. 0 means
- * menu is always visible, e.g. as a torn-off
- * menu. Determines whether save_under and
+TkpMakeMenuWindow(
+ Tk_Window tkwin, /* New window. */
+ int transient) /* 1 means menu is only posted briefly as a
+ * popup or pulldown or cascade. 0 means menu
+ * is always visible, e.g. as a torn-off menu.
+ * Determines whether save_under and
* override_redirect should be set. */
{
XSetWindowAttributes atts;
@@ -7583,23 +8157,21 @@ TkWinGetWrapperWindow(
TkWindow *winPtr = (TkWindow *)tkwin;
return (winPtr->wmInfoPtr->wrapper);
}
-
/*
*----------------------------------------------------------------------
*
* TkWmFocusToplevel --
*
- * This is a utility procedure invoked by focus-management code. It
- * exists because of the extra wrapper windows that exist under
- * Unix; its job is to map from wrapper windows to the
- * corresponding toplevel windows. On PCs and Macs there are no
- * wrapper windows so no mapping is necessary; this procedure just
- * determines whether a window is a toplevel or not.
+ * This is a utility function invoked by focus-management code. It exists
+ * because of the extra wrapper windows that exist under Unix; its job is
+ * to map from wrapper windows to the corresponding toplevel windows. On
+ * PCs and Macs there are no wrapper windows so no mapping is necessary;
+ * this function just determines whether a window is a toplevel or not.
*
* Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
*
* Side effects:
* None.
@@ -7608,8 +8180,8 @@ TkWinGetWrapperWindow(
*/
TkWindow *
-TkWmFocusToplevel(winPtr)
- TkWindow *winPtr; /* Window that received a focus-related
+TkWmFocusToplevel(
+ TkWindow *winPtr) /* Window that received a focus-related
* event. */
{
if (!(winPtr->flags & TK_TOP_HIERARCHY)) {
@@ -7617,19 +8189,19 @@ TkWmFocusToplevel(winPtr)
}
return winPtr;
}
-
+
/*
*----------------------------------------------------------------------
*
* TkpGetWrapperWindow --
*
- * This is a utility procedure invoked by focus-management code. It
- * maps to the wrapper for a top-level, which is just the same
- * as the top-level on Macs and PCs.
+ * This is a utility function invoked by focus-management code. It maps
+ * to the wrapper for a top-level, which is just the same as the
+ * top-level on Macs and PCs.
*
* Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
*
* Side effects:
* None.
@@ -7651,6 +8223,26 @@ TkpGetWrapperWindow(
/*
*----------------------------------------------------------------------
*
+ * GenerateActivateEvent --
+ *
+ * This function is called to activate a Tk window.
+ */
+
+static void
+GenerateActivateEvent(TkWindow * winPtr, const int *flagPtr)
+{
+ ActivateEvent *eventPtr;
+ eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent));
+ eventPtr->ev.proc = ActivateWindow;
+ eventPtr->winPtr = winPtr;
+ eventPtr->flagPtr = flagPtr;
+ eventPtr->hwnd = Tk_GetHWND(winPtr->window);
+ Tcl_QueueEvent((Tcl_Event *)eventPtr, TCL_QUEUE_TAIL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* ActivateWindow --
*
* This function is called when an ActivateEvent is processed.
@@ -7669,39 +8261,65 @@ ActivateWindow(
Tcl_Event *evPtr, /* Pointer to ActivateEvent. */
int flags) /* Notifier event mask. */
{
- TkWindow *winPtr;
+ ActivateEvent *eventPtr = (ActivateEvent *)evPtr;
+ TkWindow *winPtr = eventPtr->winPtr;
if (! (flags & TCL_WINDOW_EVENTS)) {
return 0;
}
- winPtr = ((ActivateEvent *) evPtr)->winPtr;
+ /*
+ * Ensure the window has not been destroyed while we delayed
+ * processing the WM_ACTIVATE message [Bug 2899949].
+ */
+
+ if (!IsWindow(eventPtr->hwnd)) {
+ return 1;
+ }
+
+ /*
+ * If the toplevel is in the middle of a move or size operation then
+ * we must delay handling of this event to avoid stealing the focus
+ * while the window manage is in control.
+ */
+
+ if (eventPtr->flagPtr && *eventPtr->flagPtr) {
+ return 0;
+ }
/*
- * If the window is excluded by a grab, call SetFocus on the
- * grabbed window instead. [Bug 220908]
+ * If the window is excluded by a grab, call SetFocus on the grabbed
+ * window instead. [Bug 220908]
*/
if (winPtr) {
+ Window window;
if (TkGrabState(winPtr) != TK_GRAB_EXCLUDED) {
- SetFocus(Tk_GetHWND(winPtr->window));
+ window = winPtr->window;
} else {
- SetFocus(Tk_GetHWND(winPtr->dispPtr->grabWinPtr->window));
+ window = winPtr->dispPtr->grabWinPtr->window;
+ }
+
+ /*
+ * Ensure the window was not destroyed while we were postponing
+ * the activation [Bug 2799589]
+ */
+
+ if (window) {
+ SetFocus(Tk_GetHWND(window));
}
}
return 1;
}
-
/*
*----------------------------------------------------------------------
*
* TkWinSetForegroundWindow --
*
- * This function is a wrapper for SetForegroundWindow, calling
- * it on the wrapper window because it has no affect on child
- * windows.
+ * This function is a wrapper for SetForegroundWindow, calling it on the
+ * wrapper window because it has no affect on child windows.
*
* Results:
* none
@@ -7713,8 +8331,8 @@ ActivateWindow(
*/
void
-TkWinSetForegroundWindow(winPtr)
- TkWindow *winPtr;
+TkWinSetForegroundWindow(
+ TkWindow *winPtr)
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -7724,3 +8342,318 @@ TkWinSetForegroundWindow(winPtr)
SetForegroundWindow(Tk_GetHWND(winPtr->window));
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinToplevelWithdraw --
+ *
+ * This function is to be used by a window manage to withdraw a toplevel
+ * window.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * May withdraw the toplevel window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpWinToplevelWithDraw(
+ TkWindow *winPtr)
+{
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+ wmPtr->flags |= WM_WITHDRAWN;
+ TkpWmSetState(winPtr, WithdrawnState);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinToplevelIconify --
+ *
+ * This function is to be used by a window manage to iconify a toplevel
+ * window.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * May iconify the toplevel window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpWinToplevelIconify(
+ TkWindow *winPtr)
+{
+ TkpWmSetState(winPtr, IconicState);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinToplevelDeiconify --
+ *
+ * This function is to be used by a window manage to deiconify a toplevel
+ * window.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * May deiconify the toplevel window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpWinToplevelDeiconify(
+ TkWindow *winPtr)
+{
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ wmPtr->flags &= ~WM_WITHDRAWN;
+
+ /*
+ * If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may need to
+ * be called first to update a withdrawn toplevel's geometry before it is
+ * deiconified by TkpWmSetState. Don't bother if we've never been mapped.
+ */
+
+ if ((wmPtr->flags & WM_UPDATE_PENDING) &&
+ !(wmPtr->flags & WM_NEVER_MAPPED)) {
+ Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ UpdateGeometryInfo((ClientData) winPtr);
+ }
+
+ /*
+ * If we were in the ZoomState (maximized), 'wm deiconify' should not
+ * cause the window to shrink
+ */
+
+ if (wmPtr->hints.initial_state == ZoomState) {
+ TkpWmSetState(winPtr, ZoomState);
+ } else {
+ TkpWmSetState(winPtr, NormalState);
+ }
+
+ /*
+ * An unmapped window will be mapped at idle time by a call to MapFrame.
+ * That calls CreateWrapper which sets the focus and raises the window.
+ */
+
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return;
+ }
+
+ /*
+ * Follow Windows-like style here, raising the window to the top.
+ */
+
+ TkWmRestackToplevel(winPtr, Above, NULL);
+ if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
+ TkSetFocusWin(winPtr, 1);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinGeometryIsControlledByWm --
+ *
+ * This function is to be used by a window manage to see if wm has
+ * canceled geometry control.
+ *
+ * Results:
+ * 0 - if the window manager has canceled its control
+ * 1 - if the window manager controls the geometry
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+long
+TkpWinToplevelIsControlledByWm(
+ TkWindow *winPtr)
+{
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (wmPtr) {
+ return ((wmPtr->width != -1) && (wmPtr->height != -1))? 1:0;
+ } else {
+ return 0;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinToplevelMove --
+ *
+ * This function is to be used by a container to move an embedded window.
+ *
+ * Results:
+ * position of the upper left frame in a 32-bit long:
+ * 16-MSBits - x; 16-LSBits - y
+ *
+ * Side effects:
+ * May move the embedded window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+long
+TkpWinToplevelMove(
+ TkWindow *winPtr,
+ int x, int y)
+{
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (wmPtr && x >= 0 && y >= 0 && !TkpWinToplevelIsControlledByWm(winPtr)) {
+ Tk_MoveToplevelWindow((Tk_Window)winPtr, x, y);
+ }
+ return ((winPtr->changes.x << 16) & 0xffff0000)
+ | (winPtr->changes.y & 0xffff);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinToplevelOverrideRedirect --
+ *
+ * This function is to be used by a container to overrideredirect the
+ * contaner's frame window.
+ *
+ * Results:
+ * The current overrideredirect value
+ *
+ * Side effects:
+ * May change the overrideredirect value of the container window
+ *
+ *----------------------------------------------------------------------
+ */
+
+long
+TkpWinToplevelOverrideRedirect(
+ TkWindow *winPtr,
+ int reqValue)
+{
+ int curValue;
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
+ if(reqValue < 0) return curValue;
+
+ if (curValue != reqValue) {
+ XSetWindowAttributes atts;
+
+ /*
+ * Only do this if we are really changing value, because it causes
+ * some funky stuff to occur
+ */
+
+ atts.override_redirect = reqValue ? True : False;
+ Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
+ &atts);
+ if (!(wmPtr->flags & (WM_NEVER_MAPPED))
+ && !(winPtr->flags & TK_EMBEDDED)) {
+ UpdateWrapper(winPtr);
+ }
+ }
+ return reqValue;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWinToplevelDetachWindow --
+ *
+ * This function is to be usd for changing a toplevel's wrapper or
+ * container.
+ *
+ * Results:
+ * The window's wrapper/container is removed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpWinToplevelDetachWindow(
+ TkWindow *winPtr)
+{
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (winPtr->flags & TK_EMBEDDED) {
+ int state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1;
+
+ SendMessage(wmPtr->wrapper, TK_SETMENU, 0, 0);
+ SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0);
+ winPtr->flags &= ~TK_EMBEDDED;
+ winPtr->privatePtr = NULL;
+ wmPtr->wrapper = None;
+ if (state >= 0 && state <= 3) {
+ wmPtr->hints.initial_state = state;
+ }
+ }
+ if (winPtr->flags & TK_TOP_LEVEL) {
+ TkpWinToplevelOverrideRedirect(winPtr, 1);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RemapWindows
+ *
+ * Adjust parent/child relation ships of
+ * the given window hierarchy.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * keeps windowing system happy
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RemapWindows(winPtr, parentHWND)
+ TkWindow *winPtr;
+ HWND parentHWND;
+{
+ TkWindow *childPtr;
+ const char *className = Tk_Class(winPtr);
+
+ /* Skip Menus as they are handled differently */
+ if (className != NULL && strcmp(className, "Menu") == 0) {
+ return;
+ }
+ if (winPtr->window) {
+ SetParent(Tk_GetHWND(winPtr->window), parentHWND);
+ }
+
+ /* Repeat for all the children */
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ RemapWindows(childPtr,
+ winPtr->window ? Tk_GetHWND(winPtr->window) : NULL);
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinX.c b/win/tkWinX.c
index cdbdc84..2d5f5f5 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1,22 +1,30 @@
-/*
+/*
* tkWinX.c --
*
- * This file contains Windows emulation procedures for X routines.
+ * This file contains Windows emulation procedures for X routines.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
* Copyright (c) 1994 Software Research Associates, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+/*
+ * Make sure the SendInput API is available (NT SP 3):
+ */
+#if (_WIN32_WINNT <= 0x0400)
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0403
+#endif
+
#include "tkWinInt.h"
/*
- * The w32api 1.1 package (included in Mingw 1.1) does not define _WIN32_IE
- * by default. Define it here to gain access to the InitCommonControlsEx API
- * in commctrl.h.
+ * The w32api 1.1 package (included in Mingw 1.1) does not define _WIN32_IE by
+ * default. Define it here to gain access to the InitCommonControlsEx API in
+ * commctrl.h.
*/
#ifndef _WIN32_IE
@@ -24,6 +32,10 @@
#endif
#include <commctrl.h>
+#ifdef _MSC_VER
+# pragma comment (lib, "comctl32.lib")
+# pragma comment (lib, "advapi32.lib")
+#endif
/*
* The zmouse.h file includes the definition for WM_MOUSEWHEEL.
@@ -36,6 +48,9 @@
*/
#include <imm.h>
+#ifdef _MSC_VER
+# pragma comment (lib, "imm32.lib")
+#endif
/*
* WM_UNICHAR is a message for Unicode input on all windows systems.
@@ -61,6 +76,7 @@ static TkWinProcs asciiProcs = {
HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExA,
(BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags,
UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuA,
+ (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextA,
};
static TkWinProcs unicodeProcs = {
@@ -78,6 +94,7 @@ static TkWinProcs unicodeProcs = {
HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExW,
(BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags,
UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuW,
+ (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextW,
};
TkWinProcs *tkWinProcs;
@@ -86,51 +103,52 @@ TkWinProcs *tkWinProcs;
* Declarations of static variables used in this file.
*/
-static char winScreenName[] = ":0"; /* Default name of windows display. */
-static HINSTANCE tkInstance = NULL; /* Application instance handle. */
-static int childClassInitialized; /* Registered child class? */
-static WNDCLASS childClass; /* Window class for child windows. */
-static int tkPlatformId = 0; /* version of Windows platform */
-static int tkWinTheme = 0; /* See TkWinGetPlatformTheme */
-static Tcl_Encoding keyInputEncoding = NULL;/* The current character
- * encoding for keyboard input */
-static int keyInputCharset = -1; /* The Win32 CHARSET for the keyboard
- * encoding */
-static Tcl_Encoding unicodeEncoding = NULL; /* unicode encoding */
+static char winScreenName[] = ":0"; /* Default name of windows display. */
+static HINSTANCE tkInstance = NULL; /* Application instance handle. */
+static int childClassInitialized; /* Registered child class? */
+static WNDCLASS childClass; /* Window class for child windows. */
+static int tkPlatformId = 0; /* version of Windows platform */
+static int tkWinTheme = 0; /* See TkWinGetPlatformTheme */
+static Tcl_Encoding keyInputEncoding = NULL;
+ /* The current character encoding for
+ * keyboard input */
+static int keyInputCharset = -1; /* The Win32 CHARSET for the keyboard
+ * encoding */
+static Tcl_Encoding unicodeEncoding = NULL;
+ /* The UNICODE encoding */
/*
- * Thread local storage. Notice that now each thread must have its
- * own TkDisplay structure, since this structure contains most of
- * the thread-specific date for threads.
+ * Thread local storage. Notice that now each thread must have its own
+ * TkDisplay structure, since this structure contains most of the thread-
+ * specific date for threads.
*/
+
typedef struct ThreadSpecificData {
- TkDisplay *winDisplay; /* TkDisplay structure that *
- * represents Windows screen. */
- int updatingClipboard; /* If 1, we are updating the clipboard */
+ TkDisplay *winDisplay; /* TkDisplay structure that represents Windows
+ * screen. */
+ int updatingClipboard; /* If 1, we are updating the clipboard. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Forward declarations of procedures used in this file.
+ * Forward declarations of functions used in this file.
*/
-static void GenerateXEvent _ANSI_ARGS_((HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam));
-static unsigned int GetState _ANSI_ARGS_((UINT message, WPARAM wParam,
- LPARAM lParam));
-static void GetTranslatedKey _ANSI_ARGS_((XKeyEvent *xkey));
-static void UpdateInputLanguage _ANSI_ARGS_((int charset));
-static int HandleIMEComposition _ANSI_ARGS_((HWND hwnd,
- LPARAM lParam));
+static void GenerateXEvent(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+static unsigned int GetState(UINT message, WPARAM wParam, LPARAM lParam);
+static void GetTranslatedKey(XKeyEvent *xkey);
+static void UpdateInputLanguage(int charset);
+static int HandleIMEComposition(HWND hwnd, LPARAM lParam);
/*
*----------------------------------------------------------------------
*
* TkGetServerInfo --
*
- * Given a window, this procedure returns information about
- * the window server for that window. This procedure provides
- * the guts of the "winfo server" command.
+ * Given a window, this function returns information about the window
+ * server for that window. This function provides the guts of the "winfo
+ * server" command.
*
* Results:
* None.
@@ -142,11 +160,11 @@ static int HandleIMEComposition _ANSI_ARGS_((HWND hwnd,
*/
void
-TkGetServerInfo(interp, tkwin)
- Tcl_Interp *interp; /* The server information is returned in
- * this interpreter's result. */
- Tk_Window tkwin; /* Token for window; this selects a
- * particular display and server. */
+TkGetServerInfo(
+ Tcl_Interp *interp, /* The server information is returned in this
+ * interpreter's result. */
+ Tk_Window tkwin) /* Token for window; this selects a particular
+ * display and server. */
{
char buffer[60];
OSVERSIONINFO os;
@@ -160,7 +178,7 @@ TkGetServerInfo(interp, tkwin)
#else
"Win32"
#endif
- );
+ );
Tcl_SetResult(interp, buffer, TCL_VOLATILE);
}
@@ -181,7 +199,7 @@ TkGetServerInfo(interp, tkwin)
*/
HINSTANCE
-Tk_GetHINSTANCE()
+Tk_GetHINSTANCE(void)
{
if (tkInstance == NULL) {
tkInstance = GetModuleHandle(NULL);
@@ -194,8 +212,8 @@ Tk_GetHINSTANCE()
*
* TkWinSetHINSTANCE --
*
- * Sets the global instance handle used by the Tk library.
- * This should be called by DllMain.
+ * Sets the global instance handle used by the Tk library. This should be
+ * called by DllMain.
*
* Results:
* None.
@@ -207,8 +225,8 @@ Tk_GetHINSTANCE()
*/
void
-TkWinSetHINSTANCE(hInstance)
- HINSTANCE hInstance;
+TkWinSetHINSTANCE(
+ HINSTANCE hInstance)
{
tkInstance = hInstance;
}
@@ -230,9 +248,10 @@ TkWinSetHINSTANCE(hInstance)
*/
void
-TkWinXInit(hInstance)
- HINSTANCE hInstance;
+TkWinXInit(
+ HINSTANCE hInstance)
{
+ INITCOMMONCONTROLSEX comctl;
CHARSETINFO lpCs;
DWORD lpCP;
@@ -241,16 +260,13 @@ TkWinXInit(hInstance)
}
childClassInitialized = 1;
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- /*
- * This is necessary to enable the use of themeable elements on XP,
- * so we don't even try and call it for Win9*.
- */
-
- INITCOMMONCONTROLSEX comctl;
- ZeroMemory(&comctl, sizeof(comctl));
- (void) InitCommonControlsEx(&comctl);
+ comctl.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ comctl.dwICC = ICC_WIN95_CLASSES;
+ if (!InitCommonControlsEx(&comctl)) {
+ Tcl_Panic("Unable to load common controls?!");
+ }
+ if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
tkWinProcs = &unicodeProcs;
} else {
tkWinProcs = &asciiProcs;
@@ -273,23 +289,24 @@ TkWinXInit(hInstance)
childClass.hCursor = NULL;
if (!RegisterClass(&childClass)) {
- panic("Unable to register TkChild class");
+ Tcl_Panic("Unable to register TkChild class");
}
/*
* Initialize input language info
*/
- if (GetLocaleInfo(LANGIDFROMLCID(GetKeyboardLayout(0)),
+ if (GetLocaleInfo(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))),
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
(LPTSTR) &lpCP, sizeof(lpCP)/sizeof(TCHAR))
- && TranslateCharsetInfo((DWORD *)lpCP, &lpCs, TCI_SRCCODEPAGE)) {
- UpdateInputLanguage(lpCs.ciCharset);
+ && TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) {
+ UpdateInputLanguage((int) lpCs.ciCharset);
}
/*
* Make sure we cleanup on finalize.
*/
+
TkCreateExitHandler(TkWinXCleanup, (ClientData) hInstance);
}
@@ -310,17 +327,18 @@ TkWinXInit(hInstance)
*/
void
-TkWinXCleanup(clientData)
- ClientData clientData;
+TkWinXCleanup(
+ ClientData clientData)
{
HINSTANCE hInstance = (HINSTANCE) clientData;
+
/*
* Clean up our own class.
*/
-
+
if (childClassInitialized) {
- childClassInitialized = 0;
- UnregisterClass(TK_WIN_CHILD_CLASS_NAME, hInstance);
+ childClassInitialized = 0;
+ UnregisterClass(TK_WIN_CHILD_CLASS_NAME, hInstance);
}
if (unicodeEncoding != NULL) {
@@ -331,8 +349,9 @@ TkWinXCleanup(clientData)
/*
* And let the window manager clean up its own class(es).
*/
-
+
TkWinWmCleanup(hInstance);
+ TkWinCleanupContainerList();
}
/*
@@ -340,12 +359,12 @@ TkWinXCleanup(clientData)
*
* TkWinGetPlatformId --
*
- * Determines whether running under NT, 95, or Win32s, to allow
- * runtime conditional code. Win32s is no longer supported.
+ * Determines whether running under NT, 95, or Win32s, to allow runtime
+ * conditional code. Win32s is no longer supported.
*
* Results:
* The return value is one of:
- * VER_PLATFORM_WIN32s Win32s on Windows 3.1.
+ * VER_PLATFORM_WIN32s Win32s on Windows 3.1.
* VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95.
* VER_PLATFORM_WIN32_NT Win32 on Windows NT
*
@@ -356,7 +375,7 @@ TkWinXCleanup(clientData)
*/
int
-TkWinGetPlatformId()
+TkWinGetPlatformId(void)
{
if (tkPlatformId == 0) {
OSVERSIONINFO os;
@@ -364,29 +383,33 @@ TkWinGetPlatformId()
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&os);
tkPlatformId = os.dwPlatformId;
-
- /* Set tkWinTheme to be TK_THEME_WIN_XP or TK_THEME_WIN_CLASSIC.
- * The TK_THEME_WIN_CLASSIC could be set even when running
- * under XP if the windows classic theme was selected. */
+
+ /*
+ * Set tkWinTheme to be TK_THEME_WIN_XP or TK_THEME_WIN_CLASSIC. The
+ * TK_THEME_WIN_CLASSIC could be set even when running under XP if the
+ * windows classic theme was selected.
+ */
+
if ((os.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
- (os.dwMajorVersion == 5 && os.dwMinorVersion == 1)) {
- HKEY hKey;
- LPCSTR szSubKey = TEXT("Control Panel\\Appearance");
+ (os.dwMajorVersion == 5 && os.dwMinorVersion == 1)) {
+ HKEY hKey;
+ LPCSTR szSubKey = TEXT("Control Panel\\Appearance");
LPCSTR szCurrent = TEXT("Current");
- DWORD dwSize = 200;
+ DWORD dwSize = 200;
char pBuffer[200];
+
memset(pBuffer, 0, dwSize);
if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0L,
- KEY_READ, &hKey) != ERROR_SUCCESS) {
- tkWinTheme = TK_THEME_WIN_XP;
+ KEY_READ, &hKey) != ERROR_SUCCESS) {
+ tkWinTheme = TK_THEME_WIN_XP;
} else {
- RegQueryValueEx(hKey, szCurrent, NULL, NULL, (BYTE *) pBuffer, &dwSize);
- RegCloseKey(hKey);
- if (strcmp(pBuffer, "Windows Standard") == 0) {
- tkWinTheme = TK_THEME_WIN_CLASSIC;
- } else {
- tkWinTheme = TK_THEME_WIN_XP;
- }
+ RegQueryValueEx(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
+ RegCloseKey(hKey);
+ if (strcmp(pBuffer, "Windows Standard") == 0) {
+ tkWinTheme = TK_THEME_WIN_CLASSIC;
+ } else {
+ tkWinTheme = TK_THEME_WIN_XP;
+ }
}
} else {
tkWinTheme = TK_THEME_WIN_CLASSIC;
@@ -404,8 +427,8 @@ TkWinGetPlatformId()
*
* Results:
* The return value is one of:
- * TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode
- * TK_THEME_WIN_XP XP not in classic mode
+ * TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode
+ * TK_THEME_WIN_XP XP not in classic mode
*
* Side effects:
* Could invoke TkWinGetPlatformId.
@@ -414,10 +437,10 @@ TkWinGetPlatformId()
*/
int
-TkWinGetPlatformTheme()
+TkWinGetPlatformTheme(void)
{
if (tkPlatformId == 0) {
- TkWinGetPlatformId();
+ TkWinGetPlatformId();
}
return tkWinTheme;
}
@@ -440,9 +463,9 @@ TkWinGetPlatformTheme()
*/
CONST char *
-TkGetDefaultScreenName(interp, screenName)
- Tcl_Interp *interp; /* Not used. */
- CONST char *screenName; /* If NULL, use default string. */
+TkGetDefaultScreenName(
+ Tcl_Interp *interp, /* Not used. */
+ CONST char *screenName) /* If NULL, use default string. */
{
if ((screenName == NULL) || (screenName[0] == '\0')) {
screenName = winScreenName;
@@ -468,7 +491,8 @@ TkGetDefaultScreenName(interp, screenName)
*/
void
-TkWinDisplayChanged(Display *display)
+TkWinDisplayChanged(
+ Display *display)
{
HDC dc;
Screen *screen;
@@ -489,14 +513,14 @@ TkWinDisplayChanged(Display *display)
/*
* On windows, when creating a color bitmap, need two pieces of
* information: the number of color planes and the number of pixels per
- * plane. Need to remember both quantities so that when constructing an
+ * plane. Need to remember both quantities so that when constructing an
* HBITMAP for offscreen rendering, we can specify the correct value for
- * the number of planes. Otherwise the HBITMAP won't be compatible with
+ * the number of planes. Otherwise the HBITMAP won't be compatible with
* the HWND and we'll just get blank spots copied onto the screen.
*/
- screen->ext_data = (XExtData *) GetDeviceCaps(dc, PLANES);
- screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * (int) screen->ext_data;
+ screen->ext_data = INT2PTR(GetDeviceCaps(dc, PLANES));
+ screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data);
if (screen->root_visual != NULL) {
ckfree((char *) screen->root_visual);
@@ -549,8 +573,8 @@ TkWinDisplayChanged(Display *display)
*
* TkpOpenDisplay --
*
- * Create the Display structure and fill it with device
- * specific information.
+ * Create the Display structure and fill it with device specific
+ * information.
*
* Results:
* Returns a TkDisplay structure on success or NULL on failure.
@@ -562,18 +586,17 @@ TkWinDisplayChanged(Display *display)
*/
TkDisplay *
-TkpOpenDisplay(display_name)
- CONST char *display_name;
+TkpOpenDisplay(
+ CONST char *display_name)
{
Screen *screen;
TkWinDrawable *twdPtr;
Display *display;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->winDisplay != NULL) {
- if (strcmp(tsdPtr->winDisplay->display->display_name, display_name)
- == 0) {
+ if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) {
return tsdPtr->winDisplay;
} else {
return NULL;
@@ -587,9 +610,9 @@ TkpOpenDisplay(display_name)
strcpy(display->display_name, display_name);
display->cursor_font = 1;
- display->nscreens = 1;
- display->request = 1;
- display->qlen = 0;
+ display->nscreens = 1;
+ display->request = 1;
+ display->qlen = 0;
screen = (Screen *) ckalloc(sizeof(Screen));
ZeroMemory(screen, sizeof(Screen));
@@ -614,7 +637,7 @@ TkpOpenDisplay(display_name)
screen->white_pixel = RGB(255, 255, 255);
screen->black_pixel = RGB(0, 0, 0);
- screen->cmap = None;
+ screen->cmap = None;
display->screens = screen;
display->nscreens = 1;
@@ -648,49 +671,34 @@ TkpOpenDisplay(display_name)
*/
void
-TkpCloseDisplay(dispPtr)
- TkDisplay *dispPtr;
+TkpCloseDisplay(
+ TkDisplay *dispPtr)
{
Display *display = dispPtr->display;
- HWND hwnd;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (dispPtr != tsdPtr->winDisplay) {
- panic("TkpCloseDisplay: tried to call TkpCloseDisplay on another display");
- return;
- }
-
- /*
- * Force the clipboard to be rendered if we are the clipboard owner.
- */
-
- if (dispPtr->clipWindow) {
- hwnd = Tk_GetHWND(Tk_WindowId(dispPtr->clipWindow));
- if (GetClipboardOwner() == hwnd) {
- OpenClipboard(hwnd);
- EmptyClipboard();
- TkWinClipboardRender(dispPtr, CF_TEXT);
- CloseClipboard();
- }
+ Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on another display");
+ return; /* not reached */
}
tsdPtr->winDisplay = NULL;
- if (display->display_name != (char *) NULL) {
- ckfree(display->display_name);
+ if (display->display_name != NULL) {
+ ckfree(display->display_name);
}
- if (display->screens != (Screen *) NULL) {
- if (display->screens->root_visual != NULL) {
- ckfree((char *) display->screens->root_visual);
- }
- if (display->screens->root != None) {
- ckfree((char *) display->screens->root);
- }
- if (display->screens->cmap != None) {
- XFreeColormap(display, display->screens->cmap);
- }
- ckfree((char *) display->screens);
+ if (display->screens != NULL) {
+ if (display->screens->root_visual != NULL) {
+ ckfree((char *) display->screens->root_visual);
+ }
+ if (display->screens->root != None) {
+ ckfree((char *) display->screens->root);
+ }
+ if (display->screens->cmap != None) {
+ XFreeColormap(display, display->screens->cmap);
+ }
+ ckfree((char *) display->screens);
}
ckfree((char *) display);
}
@@ -700,11 +708,10 @@ TkpCloseDisplay(dispPtr)
*
* TkClipCleanup --
*
- * This procedure is called to cleanup resources associated with
- * claiming clipboard ownership and for receiving selection get
- * results. This function is called in tkWindow.c. This has to be
- * called by the display cleanup function because we still need the
- * access display elements.
+ * This function is called to cleanup resources associated with claiming
+ * clipboard ownership and for receiving selection get results. This
+ * function is called in tkWindow.c. This has to be called by the display
+ * cleanup function because we still need the access display elements.
*
* Results:
* None.
@@ -716,8 +723,8 @@ TkpCloseDisplay(dispPtr)
*/
void
-TkClipCleanup(dispPtr)
- TkDisplay *dispPtr; /* display associated with clipboard */
+TkClipCleanup(
+ TkDisplay *dispPtr) /* Display associated with clipboard. */
{
if (dispPtr->clipWindow != NULL) {
/*
@@ -725,6 +732,7 @@ TkClipCleanup(dispPtr)
*/
HWND hwnd = Tk_GetHWND(Tk_WindowId(dispPtr->clipWindow));
+
if (GetClipboardOwner() == hwnd) {
OpenClipboard(hwnd);
EmptyClipboard();
@@ -760,9 +768,9 @@ TkClipCleanup(dispPtr)
*/
void
-XBell(display, percent)
- Display* display;
- int percent;
+XBell(
+ Display *display,
+ int percent)
{
MessageBeep(MB_OK);
}
@@ -772,8 +780,7 @@ XBell(display, percent)
*
* TkWinChildProc --
*
- * Callback from Windows whenever an event occurs on a child
- * window.
+ * Callback from Windows whenever an event occurs on a child window.
*
* Results:
* Standard Windows return value.
@@ -785,75 +792,83 @@ XBell(display, percent)
*/
LRESULT CALLBACK
-TkWinChildProc(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+TkWinChildProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
LRESULT result;
switch (message) {
- case WM_INPUTLANGCHANGE:
- UpdateInputLanguage(wParam);
- result = 1;
- break;
-
- case WM_IME_COMPOSITION:
- result = 0;
- if (HandleIMEComposition(hwnd, lParam) == 0) {
- result = DefWindowProc(hwnd, message, wParam, lParam);
- }
- break;
-
- case WM_SETCURSOR:
- /*
- * Short circuit the WM_SETCURSOR message since we set
- * the cursor elsewhere.
- */
-
- result = TRUE;
- break;
-
- case WM_CREATE:
- case WM_ERASEBKGND:
- result = 0;
- break;
-
- case WM_PAINT:
- GenerateXEvent(hwnd, message, wParam, lParam);
+ case WM_INPUTLANGCHANGE:
+ UpdateInputLanguage((int) wParam);
+ result = 1;
+ break;
+
+ case WM_IME_COMPOSITION:
+ result = 0;
+ if (HandleIMEComposition(hwnd, lParam) == 0) {
result = DefWindowProc(hwnd, message, wParam, lParam);
- break;
+ }
+ break;
- case TK_CLAIMFOCUS:
- case TK_GEOMETRYREQ:
- case TK_ATTACHWINDOW:
- case TK_DETACHWINDOW:
- result = TkWinEmbeddedEventProc(hwnd, message, wParam, lParam);
- break;
+ case WM_SETCURSOR:
+ /*
+ * Short circuit the WM_SETCURSOR message since we set the cursor
+ * elsewhere.
+ */
- case WM_UNICHAR:
- if (wParam == UNICODE_NOCHAR) {
- /* If wParam is UNICODE_NOCHAR and the application processes
- * this message, then return TRUE. */
- result = 1;
+ result = TRUE;
+ break;
+
+ case WM_CREATE:
+ case WM_ERASEBKGND:
+ result = 0;
+ break;
+
+ case WM_PAINT:
+ GenerateXEvent(hwnd, message, wParam, lParam);
+ result = DefWindowProc(hwnd, message, wParam, lParam);
+ break;
+
+ case TK_CLAIMFOCUS:
+ case TK_GEOMETRYREQ:
+ case TK_ATTACHWINDOW:
+ case TK_DETACHWINDOW:
+ case TK_ICONIFY:
+ case TK_DEICONIFY:
+ case TK_MOVEWINDOW:
+ case TK_WITHDRAW:
+ case TK_RAISEWINDOW:
+ case TK_GETFRAMEWID:
+ case TK_OVERRIDEREDIRECT:
+ case TK_SETMENU:
+ case TK_STATE:
+ case TK_INFO:
+ result = TkWinEmbeddedEventProc(hwnd, message, wParam, lParam);
+ break;
+
+ case WM_UNICHAR:
+ if (wParam == UNICODE_NOCHAR) {
+ /* If wParam is UNICODE_NOCHAR and the application processes
+ * this message, then return TRUE. */
+ result = 1;
+ } else {
+ /* If the event was translated, we must return 0 */
+ if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ result = 0;
} else {
- /* If the event was translated, we must return 0 */
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam,
- &result)) {
- result = 0;
- } else {
- result = 1;
- }
+ result = 1;
}
- break;
+ }
+ break;
- default:
- if (!Tk_TranslateWinEvent(hwnd, message, wParam, lParam,
- &result)) {
- result = DefWindowProc(hwnd, message, wParam, lParam);
- }
- break;
+ default:
+ if (!Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ result = DefWindowProc(hwnd, message, wParam, lParam);
+ }
+ break;
}
/*
@@ -869,8 +884,8 @@ TkWinChildProc(hwnd, message, wParam, lParam)
*
* Tk_TranslateWinEvent --
*
- * This function is called by widget window procedures to handle
- * the translation from Win32 events to Tk events.
+ * This function is called by widget window functions to handle the
+ * translation from Win32 events to Tk events.
*
* Results:
* Returns 1 if the event was handled, else 0.
@@ -882,75 +897,80 @@ TkWinChildProc(hwnd, message, wParam, lParam)
*/
int
-Tk_TranslateWinEvent(hwnd, message, wParam, lParam, resultPtr)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
- LRESULT *resultPtr;
+Tk_TranslateWinEvent(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam,
+ LRESULT *resultPtr)
{
*resultPtr = 0;
switch (message) {
- case WM_RENDERFORMAT: {
- TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
- if (winPtr) {
- TkWinClipboardRender(winPtr->dispPtr, wParam);
- }
- return 1;
+ case WM_RENDERFORMAT: {
+ TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
+
+ if (winPtr) {
+ TkWinClipboardRender(winPtr->dispPtr, wParam);
}
+ return 1;
+ }
- case WM_COMMAND:
- case WM_NOTIFY:
- case WM_VSCROLL:
- case WM_HSCROLL: {
- /*
- * Reflect these messages back to the sender so that they
- * can be handled by the window proc for the control. Note
- * that we need to be careful not to reflect a message that
- * is targeted to this window, or we will loop.
- */
+ case WM_COMMAND:
+ case WM_NOTIFY:
+ case WM_VSCROLL:
+ case WM_HSCROLL: {
+ /*
+ * Reflect these messages back to the sender so that they can be
+ * handled by the window proc for the control. Note that we need to be
+ * careful not to reflect a message that is targeted to this window,
+ * or we will loop.
+ */
- HWND target = (message == WM_NOTIFY)
+ HWND target = (message == WM_NOTIFY)
? ((NMHDR*)lParam)->hwndFrom : (HWND) lParam;
- if (target && target != hwnd) {
- *resultPtr = SendMessage(target, message, wParam, lParam);
- return 1;
- }
- break;
- }
- case WM_LBUTTONDOWN:
- case WM_LBUTTONDBLCLK:
- case WM_MBUTTONDOWN:
- case WM_MBUTTONDBLCLK:
- case WM_RBUTTONDOWN:
- case WM_RBUTTONDBLCLK:
- case WM_LBUTTONUP:
- case WM_MBUTTONUP:
- case WM_RBUTTONUP:
- case WM_MOUSEMOVE:
- Tk_PointerEvent(hwnd, (short) LOWORD(lParam),
- (short) HIWORD(lParam));
+ if (target && target != hwnd) {
+ *resultPtr = SendMessage(target, message, wParam, lParam);
return 1;
+ }
+ break;
+ }
- case WM_CLOSE:
- case WM_SETFOCUS:
- case WM_KILLFOCUS:
- case WM_DESTROYCLIPBOARD:
- case WM_UNICHAR:
- case WM_CHAR:
- case WM_SYSKEYDOWN:
- case WM_SYSKEYUP:
- case WM_KEYDOWN:
- case WM_KEYUP:
- case WM_MOUSEWHEEL:
- GenerateXEvent(hwnd, message, wParam, lParam);
- return 1;
- case WM_MENUCHAR:
- GenerateXEvent(hwnd, message, wParam, lParam);
- /* MNC_CLOSE is the only one that looks right. This is a hack. */
- *resultPtr = MAKELONG (0, MNC_CLOSE);
- return 1;
+ case WM_LBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+ case WM_MBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ case WM_RBUTTONDBLCLK:
+ case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_MOUSEMOVE:
+ Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam));
+ return 1;
+
+ case WM_CLOSE:
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ case WM_DESTROYCLIPBOARD:
+ case WM_UNICHAR:
+ case WM_CHAR:
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ case WM_MOUSEWHEEL:
+ GenerateXEvent(hwnd, message, wParam, lParam);
+ return 1;
+ case WM_MENUCHAR:
+ GenerateXEvent(hwnd, message, wParam, lParam);
+
+ /*
+ * MNC_CLOSE is the only one that looks right. This is a hack.
+ */
+
+ *resultPtr = MAKELONG (0, MNC_CLOSE);
+ return 1;
}
return 0;
}
@@ -960,8 +980,8 @@ Tk_TranslateWinEvent(hwnd, message, wParam, lParam, resultPtr)
*
* GenerateXEvent --
*
- * This routine generates an X event from the corresponding
- * Windows event.
+ * This routine generates an X event from the corresponding Windows
+ * event.
*
* Results:
* None.
@@ -973,281 +993,286 @@ Tk_TranslateWinEvent(hwnd, message, wParam, lParam, resultPtr)
*/
static void
-GenerateXEvent(hwnd, message, wParam, lParam)
- HWND hwnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
+GenerateXEvent(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
XEvent event;
- TkWindow *winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd);
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ TkWindow *winPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd);
if (!winPtr || winPtr->window == None) {
return;
}
+ memset(&event, 0, sizeof(XEvent));
event.xany.serial = winPtr->display->request++;
event.xany.send_event = False;
event.xany.display = winPtr->display;
event.xany.window = winPtr->window;
switch (message) {
- case WM_PAINT: {
- PAINTSTRUCT ps;
-
- event.type = Expose;
- BeginPaint(hwnd, &ps);
- event.xexpose.x = ps.rcPaint.left;
- event.xexpose.y = ps.rcPaint.top;
- event.xexpose.width = ps.rcPaint.right - ps.rcPaint.left;
- event.xexpose.height = ps.rcPaint.bottom - ps.rcPaint.top;
- EndPaint(hwnd, &ps);
- event.xexpose.count = 0;
- break;
- }
+ case WM_PAINT: {
+ PAINTSTRUCT ps;
+
+ event.type = Expose;
+ BeginPaint(hwnd, &ps);
+ event.xexpose.x = ps.rcPaint.left;
+ event.xexpose.y = ps.rcPaint.top;
+ event.xexpose.width = ps.rcPaint.right - ps.rcPaint.left;
+ event.xexpose.height = ps.rcPaint.bottom - ps.rcPaint.top;
+ EndPaint(hwnd, &ps);
+ event.xexpose.count = 0;
+ break;
+ }
- case WM_CLOSE:
- event.type = ClientMessage;
- event.xclient.message_type =
+ case WM_CLOSE:
+ event.type = ClientMessage;
+ event.xclient.message_type =
Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
- event.xclient.format = 32;
- event.xclient.data.l[0] =
+ event.xclient.format = 32;
+ event.xclient.data.l[0] =
Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW");
- break;
+ break;
- case WM_SETFOCUS:
- case WM_KILLFOCUS: {
- TkWindow *otherWinPtr = (TkWindow *)Tk_HWNDToWindow((HWND) wParam);
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS: {
+ TkWindow *otherWinPtr = (TkWindow *) Tk_HWNDToWindow((HWND) wParam);
- /*
- * Compare toplevel windows to avoid reporting focus
- * changes within the same toplevel.
- */
+ /*
+ * Compare toplevel windows to avoid reporting focus changes within
+ * the same toplevel.
+ */
- while (!(winPtr->flags & TK_TOP_LEVEL)) {
- winPtr = winPtr->parentPtr;
- if (winPtr == NULL) {
- return;
- }
- }
- while (otherWinPtr && !(otherWinPtr->flags & TK_TOP_LEVEL)) {
- otherWinPtr = otherWinPtr->parentPtr;
+ while (!(winPtr->flags & TK_TOP_LEVEL)) {
+ winPtr = winPtr->parentPtr;
+ if (winPtr == NULL) {
+ return;
}
+ }
+ while (otherWinPtr && !(otherWinPtr->flags & TK_TOP_LEVEL)) {
+ otherWinPtr = otherWinPtr->parentPtr;
+ }
- /*
- * Do a catch-all Tk_SetCaretPos here to make sure that the
- * window receiving focus sets the caret at least once.
- */
- if (message == WM_SETFOCUS) {
- Tk_SetCaretPos((Tk_Window) winPtr, 0, 0, 0);
- }
+ /*
+ * Do a catch-all Tk_SetCaretPos here to make sure that the window
+ * receiving focus sets the caret at least once.
+ */
- if (otherWinPtr == winPtr) {
- return;
- }
+ if (message == WM_SETFOCUS) {
+ Tk_SetCaretPos((Tk_Window) winPtr, 0, 0, 0);
+ }
- event.xany.window = winPtr->window;
- event.type = (message == WM_SETFOCUS) ? FocusIn : FocusOut;
- event.xfocus.mode = NotifyNormal;
- event.xfocus.detail = NotifyNonlinear;
+ if (otherWinPtr == winPtr) {
+ return;
+ }
+
+ event.xany.window = winPtr->window;
+ event.type = (message == WM_SETFOCUS) ? FocusIn : FocusOut;
+ event.xfocus.mode = NotifyNormal;
+ event.xfocus.detail = NotifyNonlinear;
+
+ /*
+ * Destroy the caret if we own it. If we are moving to another Tk
+ * window, it will reclaim and reposition it with Tk_SetCaretPos.
+ */
+ if (message == WM_KILLFOCUS) {
+ DestroyCaret();
+ }
+ break;
+ }
+
+ case WM_DESTROYCLIPBOARD:
+ if (tsdPtr->updatingClipboard == TRUE) {
/*
- * Destroy the caret if we own it. If we are moving to another Tk
- * window, it will reclaim and reposition it with Tk_SetCaretPos.
+ * We want to avoid this event if we are the ones that caused this
+ * event.
*/
- if (message == WM_KILLFOCUS) {
- DestroyCaret();
- }
- break;
- }
- case WM_DESTROYCLIPBOARD:
- if (tsdPtr->updatingClipboard == TRUE) {
- /*
- * We want to avoid this event if we are the ones that caused
- * this event.
- */
- return;
- }
- event.type = SelectionClear;
- event.xselectionclear.selection =
+ return;
+ }
+ event.type = SelectionClear;
+ event.xselectionclear.selection =
Tk_InternAtom((Tk_Window)winPtr, "CLIPBOARD");
- event.xselectionclear.time = TkpGetMS();
- break;
+ event.xselectionclear.time = TkpGetMS();
+ break;
+ case WM_MOUSEWHEEL:
+ /*
+ * The mouse wheel event is closer to a key event than a mouse event
+ * in that the message is sent to the window that has focus.
+ */
+
+ case WM_CHAR:
+ case WM_UNICHAR:
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+ case WM_KEYDOWN:
+ case WM_KEYUP: {
+ unsigned int state = GetState(message, wParam, lParam);
+ Time time = TkpGetMS();
+ POINT clientPoint;
+ union {DWORD msgpos; POINTS point;} root; /* Note: POINT and POINTS are different */
+
+ /*
+ * Compute the screen and window coordinates of the event.
+ */
+
+ root.msgpos = GetMessagePos();
+ clientPoint.x = root.point.x;
+ clientPoint.y = root.point.y;
+ ScreenToClient(hwnd, &clientPoint);
+
+ /*
+ * Set up the common event fields.
+ */
+
+ event.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum);
+ event.xbutton.subwindow = None;
+ event.xbutton.x = clientPoint.x;
+ event.xbutton.y = clientPoint.y;
+ event.xbutton.x_root = root.point.x;
+ event.xbutton.y_root = root.point.y;
+ event.xbutton.state = state;
+ event.xbutton.time = time;
+ event.xbutton.same_screen = True;
+
+ /*
+ * Now set up event specific fields.
+ */
+
+ switch (message) {
case WM_MOUSEWHEEL:
/*
- * The mouse wheel event is closer to a key event than a
- * mouse event in that the message is sent to the window
- * that has focus.
+ * We have invented a new X event type to handle this event. It
+ * still uses the KeyPress struct. However, the keycode field has
+ * been overloaded to hold the zDelta of the wheel. Set nbytes to
+ * 0 to prevent conversion of the keycode to a keysym in
+ * TkpGetString. [Bug 1118340].
*/
- case WM_CHAR:
- case WM_UNICHAR:
+ event.type = MouseWheelEvent;
+ event.xany.send_event = -1;
+ event.xkey.nbytes = 0;
+ event.xkey.keycode = (short) HIWORD(wParam);
+ break;
case WM_SYSKEYDOWN:
- case WM_SYSKEYUP:
case WM_KEYDOWN:
- case WM_KEYUP: {
- unsigned int state = GetState(message, wParam, lParam);
- Time time = TkpGetMS();
- POINT clientPoint;
- POINTS rootPoint; /* Note: POINT and POINTS are different */
- DWORD msgPos;
-
/*
- * Compute the screen and window coordinates of the event.
+ * Check for translated characters in the event queue. Setting
+ * xany.send_event to -1 indicates to the Windows implementation
+ * of TkpGetString() that this event was generated by windows and
+ * that the Windows extension xkey.trans_chars is filled with the
+ * MBCS characters that came from the TranslateMessage call.
*/
- msgPos = GetMessagePos();
- rootPoint = MAKEPOINTS(msgPos);
- clientPoint.x = rootPoint.x;
- clientPoint.y = rootPoint.y;
- ScreenToClient(hwnd, &clientPoint);
+ event.type = KeyPress;
+ event.xany.send_event = -1;
+ event.xkey.keycode = wParam;
+ GetTranslatedKey(&event.xkey);
+ break;
+ case WM_SYSKEYUP:
+ case WM_KEYUP:
/*
- * Set up the common event fields.
+ * We don't check for translated characters on keyup because Tk
+ * won't know what to do with them. Instead, we wait for the
+ * WM_CHAR messages which will follow.
*/
- event.xbutton.root = RootWindow(winPtr->display,
- winPtr->screenNum);
- event.xbutton.subwindow = None;
- event.xbutton.x = clientPoint.x;
- event.xbutton.y = clientPoint.y;
- event.xbutton.x_root = rootPoint.x;
- event.xbutton.y_root = rootPoint.y;
- event.xbutton.state = state;
- event.xbutton.time = time;
- event.xbutton.same_screen = True;
+ event.type = KeyRelease;
+ event.xkey.keycode = wParam;
+ event.xkey.nbytes = 0;
+ break;
+ case WM_CHAR:
/*
- * Now set up event specific fields.
+ * Synthesize both a KeyPress and a KeyRelease. Strings generated
+ * by Input Method Editor are handled in the following manner:
+ * 1. A series of WM_KEYDOWN & WM_KEYUP messages that cause
+ * GetTranslatedKey() to be called and return immediately
+ * because the WM_KEYDOWNs have no associated WM_CHAR messages
+ * -- the IME window is accumulating the characters and
+ * translating them itself. In the "bind" command, you get an
+ * event with a mystery keysym and %A == "" for each WM_KEYDOWN
+ * that actually was meant for the IME.
+ * 2. A WM_KEYDOWN corresponding to the "confirm typing"
+ * character. This causes GetTranslatedKey() to be called.
+ * 3. A WM_IME_NOTIFY message saying that the IME is done. A side
+ * effect of this message is that GetTranslatedKey() thinks
+ * this means that there are no WM_CHAR messages and returns
+ * immediately. In the "bind" command, you get an another event
+ * with a mystery keysym and %A == "".
+ * 4. A sequence of WM_CHAR messages that correspond to the
+ * characters in the IME window. A bunch of simulated
+ * KeyPress/KeyRelease events will be generated, one for each
+ * character. Adjacent WM_CHAR messages may actually specify
+ * the high and low bytes of a multi-byte character -- in that
+ * case the two WM_CHAR messages will be combined into one
+ * event. It is the event-consumer's responsibility to convert
+ * the string returned from XLookupString from system encoding
+ * to UTF-8.
+ * 5. And finally we get the WM_KEYUP for the "confirm typing"
+ * character.
*/
- switch (message) {
- case WM_MOUSEWHEEL:
- /*
- * We have invented a new X event type to handle
- * this event. It still uses the KeyPress struct.
- * However, the keycode field has been overloaded
- * to hold the zDelta of the wheel. Set nbytes to 0
- * to prevent conversion of the keycode to a keysym
- * in TkpGetString. [Bug 1118340].
- */
-
- event.type = MouseWheelEvent;
- event.xany.send_event = -1;
- event.xkey.nbytes = 0;
- event.xkey.keycode = (short) HIWORD(wParam);
- break;
- case WM_SYSKEYDOWN:
- case WM_KEYDOWN:
- /*
- * Check for translated characters in the event queue.
- * Setting xany.send_event to -1 indicates to the
- * Windows implementation of TkpGetString() that this
- * event was generated by windows and that the Windows
- * extension xkey.trans_chars is filled with the
- * MBCS characters that came from the TranslateMessage
- * call.
- */
-
- event.type = KeyPress;
- event.xany.send_event = -1;
- event.xkey.keycode = wParam;
- GetTranslatedKey(&event.xkey);
- break;
-
- case WM_SYSKEYUP:
- case WM_KEYUP:
- /*
- * We don't check for translated characters on keyup
- * because Tk won't know what to do with them. Instead, we
- * wait for the WM_CHAR messages which will follow.
- */
- event.type = KeyRelease;
- event.xkey.keycode = wParam;
- event.xkey.nbytes = 0;
- break;
-
- case WM_CHAR:
- /*
- * Synthesize both a KeyPress and a KeyRelease.
- * Strings generated by Input Method Editor are handled
- * in the following manner:
- * 1. A series of WM_KEYDOWN & WM_KEYUP messages that
- * cause GetTranslatedKey() to be called and return
- * immediately because the WM_KEYDOWNs have no
- * associated WM_CHAR messages -- the IME window is
- * accumulating the characters and translating them
- * itself. In the "bind" command, you get an event
- * with a mystery keysym and %A == "" for each
- * WM_KEYDOWN that actually was meant for the IME.
- * 2. A WM_KEYDOWN corresponding to the "confirm typing"
- * character. This causes GetTranslatedKey() to be
- * called.
- * 3. A WM_IME_NOTIFY message saying that the IME is
- * done. A side effect of this message is that
- * GetTranslatedKey() thinks this means that there
- * are no WM_CHAR messages and returns immediately.
- * In the "bind" command, you get an another event
- * with a mystery keysym and %A == "".
- * 4. A sequence of WM_CHAR messages that correspond to
- * the characters in the IME window. A bunch of
- * simulated KeyPress/KeyRelease events will be
- * generated, one for each character. Adjacent
- * WM_CHAR messages may actually specify the high
- * and low bytes of a multi-byte character -- in that
- * case the two WM_CHAR messages will be combined into
- * one event. It is the event-consumer's
- * responsibility to convert the string returned from
- * XLookupString from system encoding to UTF-8.
- * 5. And finally we get the WM_KEYUP for the "confirm
- * typing" character.
- */
-
- event.type = KeyPress;
- event.xany.send_event = -1;
- event.xkey.keycode = 0;
- event.xkey.nbytes = 1;
- event.xkey.trans_chars[0] = (char) wParam;
-
- if (IsDBCSLeadByte((BYTE) wParam)) {
- MSG msg;
-
- if ((PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) != 0)
- && (msg.message == WM_CHAR)) {
- GetMessage(&msg, NULL, 0, 0);
- event.xkey.nbytes = 2;
- event.xkey.trans_chars[1] = (char) msg.wParam;
- }
- }
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyRelease;
- break;
-
- case WM_UNICHAR: {
- char buffer[TCL_UTF_MAX+1];
- int i;
- event.type = KeyPress;
- event.xany.send_event = -3;
- event.xkey.keycode = wParam;
- event.xkey.nbytes = Tcl_UniCharToUtf(wParam, buffer);
- for (i=0; i<event.xkey.nbytes && i<TCL_UTF_MAX; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyRelease;
- break;
+ event.type = KeyPress;
+ event.xany.send_event = -1;
+ event.xkey.keycode = 0;
+ event.xkey.nbytes = 1;
+ event.xkey.trans_chars[0] = (char) wParam;
+
+ if (IsDBCSLeadByte((BYTE) wParam)) {
+ MSG msg;
+
+ if ((PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) != 0)
+ && (msg.message == WM_CHAR)) {
+ GetMessage(&msg, NULL, 0, 0);
+ event.xkey.nbytes = 2;
+ event.xkey.trans_chars[1] = (char) msg.wParam;
}
}
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ event.type = KeyRelease;
+ break;
+
+ case WM_UNICHAR: {
+ char buffer[TCL_UTF_MAX+1];
+ int i;
+ event.type = KeyPress;
+ event.xany.send_event = -3;
+ event.xkey.keycode = wParam;
+ event.xkey.nbytes = Tcl_UniCharToUtf((int)wParam, buffer);
+ for (i=0; i<event.xkey.nbytes && i<TCL_UTF_MAX; ++i) {
+ event.xkey.trans_chars[i] = buffer[i];
+ }
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ event.type = KeyRelease;
break;
}
- default:
- return;
+ }
+ break;
+ }
+
+ default:
+ /*
+ * Don't know how to translate this event, so ignore it. (It probably
+ * should not have got here, but ignoring it should be harmless.)
+ */
+
+ return;
}
+
+ /*
+ * Post the translated event to the main Tk event queue.
+ */
+
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
}
@@ -1256,12 +1281,12 @@ GenerateXEvent(hwnd, message, wParam, lParam)
*
* GetState --
*
- * This function constructs a state mask for the mouse buttons
- * and modifier keys as they were before the event occured.
+ * This function constructs a state mask for the mouse buttons and
+ * modifier keys as they were before the event occured.
*
* Results:
- * Returns a composite value of all the modifier and button state
- * flags that were set at the time the event occurred.
+ * Returns a composite value of all the modifier and button state flags
+ * that were set at the time the event occurred.
*
* Side effects:
* None.
@@ -1270,18 +1295,18 @@ GenerateXEvent(hwnd, message, wParam, lParam)
*/
static unsigned int
-GetState(message, wParam, lParam)
- UINT message; /* Win32 message type */
- WPARAM wParam; /* wParam of message, used if key message */
- LPARAM lParam; /* lParam of message, used if key message */
+GetState(
+ UINT message, /* Win32 message type */
+ WPARAM wParam, /* wParam of message, used if key message */
+ LPARAM lParam) /* lParam of message, used if key message */
{
int mask;
int prevState; /* 1 if key was previously down */
unsigned int state = TkWinGetModifierState();
/*
- * If the event is a key press or release, we check for modifier
- * keys so we can report the state of the world before the event.
+ * If the event is a key press or release, we check for modifier keys so
+ * we can report the state of the world before the event.
*/
if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN
@@ -1289,39 +1314,46 @@ GetState(message, wParam, lParam)
mask = 0;
prevState = HIWORD(lParam) & KF_REPEAT;
switch(wParam) {
- case VK_SHIFT:
- mask = ShiftMask;
- break;
- case VK_CONTROL:
- mask = ControlMask;
- break;
- case VK_MENU:
- mask = ALT_MASK;
- break;
- case VK_CAPITAL:
- if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
- mask = LockMask;
- prevState = ((state & mask) ^ prevState) ? 0 : 1;
- }
- break;
- case VK_NUMLOCK:
- if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
- mask = Mod1Mask;
- prevState = ((state & mask) ^ prevState) ? 0 : 1;
- }
- break;
- case VK_SCROLL:
- if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
- mask = Mod3Mask;
- prevState = ((state & mask) ^ prevState) ? 0 : 1;
- }
- break;
+ case VK_SHIFT:
+ mask = ShiftMask;
+ break;
+ case VK_CONTROL:
+ mask = ControlMask;
+ break;
+ case VK_MENU:
+ mask = ALT_MASK;
+ break;
+ case VK_CAPITAL:
+ if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
+ mask = LockMask;
+ prevState = ((state & mask) ^ prevState) ? 0 : 1;
+ }
+ break;
+ case VK_NUMLOCK:
+ if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
+ mask = Mod1Mask;
+ prevState = ((state & mask) ^ prevState) ? 0 : 1;
+ }
+ break;
+ case VK_SCROLL:
+ if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
+ mask = Mod3Mask;
+ prevState = ((state & mask) ^ prevState) ? 0 : 1;
+ }
+ break;
}
if (prevState) {
state |= mask;
} else {
state &= ~mask;
}
+ if (HIWORD(lParam) & KF_EXTENDED) {
+ if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
+ state |= EXTENDED_MASK;
+ } else {
+ state &= ~EXTENDED_MASK;
+ }
+ }
}
return state;
}
@@ -1331,61 +1363,59 @@ GetState(message, wParam, lParam)
*
* GetTranslatedKey --
*
- * Retrieves WM_CHAR messages that are placed on the system queue
- * by the TranslateMessage system call and places them in the
- * given KeyPress event.
+ * Retrieves WM_CHAR messages that are placed on the system queue by the
+ * TranslateMessage system call and places them in the given KeyPress
+ * event.
*
* Results:
* Sets the trans_chars and nbytes member of the key event.
*
* Side effects:
- * Removes any WM_CHAR messages waiting on the top of the system
- * event queue.
+ * Removes any WM_CHAR messages waiting on the top of the system event
+ * queue.
*
*----------------------------------------------------------------------
*/
static void
-GetTranslatedKey(xkey)
- XKeyEvent *xkey;
+GetTranslatedKey(
+ XKeyEvent *xkey)
{
MSG msg;
-
+
xkey->nbytes = 0;
while ((xkey->nbytes < XMaxTransChars)
&& PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
- if ((msg.message == WM_CHAR) || (msg.message == WM_SYSCHAR)) {
- GetMessage(&msg, NULL, 0, 0);
+ if ((msg.message != WM_CHAR) && (msg.message != WM_SYSCHAR)) {
+ break;
+ }
+
+ GetMessage(&msg, NULL, 0, 0);
+
+ /*
+ * If this is a normal character message, we may need to strip off the
+ * Alt modifier (e.g. Alt-digits). Note that we don't want to do this
+ * for system messages, because those were presumably generated as an
+ * Alt-char sequence (e.g. accelerator keys).
+ */
+ if ((msg.message == WM_CHAR) && (msg.lParam & 0x20000000)) {
+ xkey->state = 0;
+ }
+ xkey->trans_chars[xkey->nbytes] = (char) msg.wParam;
+ xkey->nbytes++;
+
+ if (((unsigned short) msg.wParam) > ((unsigned short) 0xff)) {
/*
- * If this is a normal character message, we may need to strip
- * off the Alt modifier (e.g. Alt-digits). Note that we don't
- * want to do this for system messages, because those were
- * presumably generated as an Alt-char sequence (e.g. accelerator
- * keys).
+ * Some "addon" input devices, such as the popular PenPower
+ * Chinese writing pad, generate 16 bit values in WM_CHAR messages
+ * (instead of passing them in two separate WM_CHAR messages
+ * containing two 8-bit values.
*/
- if ((msg.message == WM_CHAR) && (msg.lParam & 0x20000000)) {
- xkey->state = 0;
- }
- xkey->trans_chars[xkey->nbytes] = (char) msg.wParam;
- xkey->nbytes++;
-
- if (((unsigned short) msg.wParam) > ((unsigned short) 0xff)) {
- /*
- * Some "addon" input devices, such as the popular
- * PenPower Chinese writing pad, generate 16 bit
- * values in WM_CHAR messages (instead of passing them
- * in two separate WM_CHAR messages containing two
- * 8-bit values.
- */
-
- xkey->trans_chars[xkey->nbytes] = (char) (msg.wParam >> 8);
- xkey->nbytes ++;
- }
- } else {
- break;
+ xkey->trans_chars[xkey->nbytes] = (char) (msg.wParam >> 8);
+ xkey->nbytes ++;
}
}
}
@@ -1396,11 +1426,11 @@ GetTranslatedKey(xkey)
* UpdateInputLanguage --
*
* Gets called when a WM_INPUTLANGCHANGE message is received by the Tk
- * child window procedure. This message is sent by the Input Method
- * Editor system when the user chooses a different input method. All
- * subsequent WM_CHAR messages will contain characters in the new
- * encoding. We record the new encoding so that TkpGetString() knows how
- * to correctly translate the WM_CHAR into unicode.
+ * child window function. This message is sent by the Input Method Editor
+ * system when the user chooses a different input method. All subsequent
+ * WM_CHAR messages will contain characters in the new encoding. We
+ * record the new encoding so that TkpGetString() knows how to correctly
+ * translate the WM_CHAR into unicode.
*
* Results:
* Records the new encoding in keyInputEncoding.
@@ -1412,8 +1442,8 @@ GetTranslatedKey(xkey)
*/
static void
-UpdateInputLanguage(charset)
- int charset;
+UpdateInputLanguage(
+ int charset)
{
CHARSETINFO charsetInfo;
Tcl_Encoding encoding;
@@ -1422,8 +1452,8 @@ UpdateInputLanguage(charset)
if (keyInputCharset == charset) {
return;
}
- if (TranslateCharsetInfo((DWORD*)charset, &charsetInfo, TCI_SRCCHARSET)
- == 0) {
+ if (TranslateCharsetInfo(INT2PTR(charset), &charsetInfo,
+ TCI_SRCCHARSET) == 0) {
/*
* Some mysterious failure.
*/
@@ -1454,8 +1484,8 @@ UpdateInputLanguage(charset)
*
* TkWinGetKeyInputEncoding --
*
- * Returns the current keyboard input encoding selected by the
- * user (with WM_INPUTLANGCHANGE events).
+ * Returns the current keyboard input encoding selected by the user (with
+ * WM_INPUTLANGCHANGE events).
*
* Results:
* The current keyboard input encoding.
@@ -1467,7 +1497,7 @@ UpdateInputLanguage(charset)
*/
Tcl_Encoding
-TkWinGetKeyInputEncoding()
+TkWinGetKeyInputEncoding(void)
{
return keyInputEncoding;
}
@@ -1489,7 +1519,7 @@ TkWinGetKeyInputEncoding()
*/
Tcl_Encoding
-TkWinGetUnicodeEncoding()
+TkWinGetUnicodeEncoding(void)
{
if (unicodeEncoding == NULL) {
unicodeEncoding = Tcl_GetEncoding(NULL, "unicode");
@@ -1502,23 +1532,22 @@ TkWinGetUnicodeEncoding()
*
* HandleIMEComposition --
*
- * This function works around a definciency in some versions
- * of Windows 2000 to make it possible to entry multi-lingual
- * characters under all versions of Windows 2000.
+ * This function works around a definciency in some versions of Windows
+ * 2000 to make it possible to entry multi-lingual characters under all
+ * versions of Windows 2000.
*
- * When an Input Method Editor (IME) is ready to send input
- * characters to an application, it sends a WM_IME_COMPOSITION
- * message with the GCS_RESULTSTR. However, The DefWindowProc()
- * on English Windows 2000 arbitrarily converts all non-Latin-1
- * characters in the composition to "?".
+ * When an Input Method Editor (IME) is ready to send input characters to
+ * an application, it sends a WM_IME_COMPOSITION message with the
+ * GCS_RESULTSTR. However, The DefWindowProc() on English Windows 2000
+ * arbitrarily converts all non-Latin-1 characters in the composition to
+ * "?".
*
- * This function correctly processes the composition data and
- * sends the UNICODE values of the composed characters to
- * TK's event queue.
+ * This function correctly processes the composition data and sends the
+ * UNICODE values of the composed characters to TK's event queue.
*
* Results:
* If this function has processed the composition data, returns 1.
- * Otherwise returns 0.
+ * Otherwise returns 0.
*
* Side effects:
* Key events are put into the TK event queue.
@@ -1527,109 +1556,115 @@ TkWinGetUnicodeEncoding()
*/
static int
-HandleIMEComposition(hwnd, lParam)
- HWND hwnd; /* Window receiving the message. */
- LPARAM lParam; /* Flags for the WM_IME_COMPOSITION
- * message */
+HandleIMEComposition(
+ HWND hwnd, /* Window receiving the message. */
+ LPARAM lParam) /* Flags for the WM_IME_COMPOSITION message */
{
HIMC hIMC;
- int i, n;
- XEvent event;
- char * buff;
- TkWindow *winPtr;
- Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
+ int n;
BOOL isWinNT = (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT);
if ((lParam & GCS_RESULTSTR) == 0) {
- /*
- * Composition is not finished yet.
- */
+ /*
+ * Composition is not finished yet.
+ */
- return 0;
+ return 0;
}
hIMC = ImmGetContext(hwnd);
- if (hIMC) {
+ if (!hIMC) {
+ return 0;
+ }
+
+ if (isWinNT) {
+ n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
+ } else {
+ n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, NULL, 0);
+ }
+
+ if (n > 0) {
+ char *buff = ckalloc((unsigned) n);
+ TkWindow *winPtr;
+ XEvent event;
+ int i;
+
if (isWinNT) {
- n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
+ n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff,
+ (unsigned) n);
} else {
- n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, NULL, 0);
- }
+ Tcl_DString utfString, unicodeString;
+ Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
+
+ n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, buff,
+ (unsigned) n);
+ Tcl_DStringInit(&utfString);
+ Tcl_ExternalToUtfDString(keyInputEncoding, buff, n, &utfString);
+ Tcl_UtfToExternalDString(unicodeEncoding,
+ Tcl_DStringValue(&utfString), -1, &unicodeString);
+ i = Tcl_DStringLength(&unicodeString);
+ if (n < i) {
+ /*
+ * Only alloc more space if we need, otherwise just use what
+ * we've created. Don't realloc as that may copy data we no
+ * longer need.
+ */
- if ((n > 0) && ((buff = (char *) ckalloc(n)) != NULL)) {
- if (isWinNT) {
- n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, n);
- } else {
- Tcl_DString utfString, unicodeString;
-
- n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, buff, n);
- Tcl_DStringInit(&utfString);
- Tcl_ExternalToUtfDString(keyInputEncoding, buff, n,
- &utfString);
- Tcl_UtfToExternalDString(unicodeEncoding,
- Tcl_DStringValue(&utfString), -1, &unicodeString);
- i = Tcl_DStringLength(&unicodeString);
- if (n < i) {
- /*
- * Only alloc more space if we need, otherwise just
- * use what we've created. Don't realloc as that may
- * copy data we no longer need.
- */
- ckfree((char *) buff);
- buff = (char *) ckalloc(i);
- }
- n = i;
- memcpy(buff, Tcl_DStringValue(&unicodeString), n);
- Tcl_DStringFree(&utfString);
- Tcl_DStringFree(&unicodeString);
+ ckfree((char *) buff);
+ buff = (char *) ckalloc((unsigned) i);
}
+ n = i;
+ memcpy(buff, Tcl_DStringValue(&unicodeString), (unsigned) n);
+ Tcl_DStringFree(&utfString);
+ Tcl_DStringFree(&unicodeString);
+ }
+ /*
+ * Set up the fields pertinent to key event.
+ *
+ * We set send_event to the special value of -2, so that TkpGetString
+ * in tkWinKey.c knows that trans_chars[] already contains a UNICODE
+ * char and there's no need to do encoding conversion.
+ *
+ * Note that the event *must* be zeroed out first; Tk plays cunning
+ * games with the overalls structure. [Bug 2992129]
+ */
+
+ winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
+
+ memset(&event, 0, sizeof(XEvent));
+ event.xkey.serial = winPtr->display->request++;
+ event.xkey.send_event = -2;
+ event.xkey.display = winPtr->display;
+ event.xkey.window = winPtr->window;
+ event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum);
+ event.xkey.subwindow = None;
+ event.xkey.state = TkWinGetModifierState();
+ event.xkey.time = TkpGetMS();
+ event.xkey.same_screen = True;
+ event.xkey.keycode = 0;
+ event.xkey.nbytes = 2;
+
+ for (i=0; i<n; ) {
/*
- * Set up the fields pertinent to key event.
- *
- * We set send_event to the special value of -2, so that
- * TkpGetString() in tkWinKey.c knows that trans_chars[]
- * already contains a UNICODE char and there's no need to
- * do encoding conversion.
+ * Simulate a pair of KeyPress and KeyRelease events for each
+ * UNICODE character in the composition.
*/
- winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd);
-
- event.xkey.serial = winPtr->display->request++;
- event.xkey.send_event = -2;
- event.xkey.display = winPtr->display;
- event.xkey.window = winPtr->window;
- event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum);
- event.xkey.subwindow = None;
- event.xkey.state = TkWinGetModifierState();
- event.xkey.time = TkpGetMS();
- event.xkey.same_screen = True;
- event.xkey.keycode = 0;
- event.xkey.nbytes = 2;
-
- for (i=0; i<n;) {
- /*
- * Simulate a pair of KeyPress and KeyRelease events
- * for each UNICODE character in the composition.
- */
-
- event.xkey.trans_chars[0] = (char) buff[i++];
- event.xkey.trans_chars[1] = (char) buff[i++];
-
- event.type = KeyPress;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
- event.type = KeyRelease;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- }
-
- ckfree(buff);
- }
- ImmReleaseContext(hwnd, hIMC);
- return 1;
- }
+ event.xkey.trans_chars[0] = (char) buff[i++];
+ event.xkey.trans_chars[1] = (char) buff[i++];
- return 0;
+ event.type = KeyPress;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+
+ event.type = KeyRelease;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ }
+
+ ckfree(buff);
+ }
+ ImmReleaseContext(hwnd, hIMC);
+ return 1;
}
/*
@@ -1649,10 +1684,11 @@ HandleIMEComposition(hwnd, lParam)
*/
void
-Tk_FreeXId(display, xid)
- Display *display;
- XID xid;
+Tk_FreeXId(
+ Display *display,
+ XID xid)
{
+ /* Do nothing */
}
/*
@@ -1660,65 +1696,66 @@ Tk_FreeXId(display, xid)
*
* TkWinResendEvent --
*
- * This function converts an X event into a Windows event and
- * invokes the specified windo procedure.
+ * This function converts an X event into a Windows event and invokes the
+ * specified windo function.
*
* Results:
* A standard Windows result.
*
* Side effects:
- * Invokes the window procedure
+ * Invokes the window function
*
*----------------------------------------------------------------------
*/
LRESULT
-TkWinResendEvent(wndproc, hwnd, eventPtr)
- WNDPROC wndproc;
- HWND hwnd;
- XEvent *eventPtr;
+TkWinResendEvent(
+ WNDPROC wndproc,
+ HWND hwnd,
+ XEvent *eventPtr)
{
UINT msg;
WPARAM wparam;
LPARAM lparam;
- if (eventPtr->type == ButtonPress) {
- switch (eventPtr->xbutton.button) {
- case Button1:
- msg = WM_LBUTTONDOWN;
- wparam = MK_LBUTTON;
- break;
- case Button2:
- msg = WM_MBUTTONDOWN;
- wparam = MK_MBUTTON;
- break;
- case Button3:
- msg = WM_RBUTTONDOWN;
- wparam = MK_RBUTTON;
- break;
- default:
- return 0;
- }
- if (eventPtr->xbutton.state & Button1Mask) {
- wparam |= MK_LBUTTON;
- }
- if (eventPtr->xbutton.state & Button2Mask) {
- wparam |= MK_MBUTTON;
- }
- if (eventPtr->xbutton.state & Button3Mask) {
- wparam |= MK_RBUTTON;
- }
- if (eventPtr->xbutton.state & ShiftMask) {
- wparam |= MK_SHIFT;
- }
- if (eventPtr->xbutton.state & ControlMask) {
- wparam |= MK_CONTROL;
- }
- lparam = MAKELPARAM((short) eventPtr->xbutton.x,
- (short) eventPtr->xbutton.y);
- } else {
+ if (eventPtr->type != ButtonPress) {
return 0;
}
+
+ switch (eventPtr->xbutton.button) {
+ case Button1:
+ msg = WM_LBUTTONDOWN;
+ wparam = MK_LBUTTON;
+ break;
+ case Button2:
+ msg = WM_MBUTTONDOWN;
+ wparam = MK_MBUTTON;
+ break;
+ case Button3:
+ msg = WM_RBUTTONDOWN;
+ wparam = MK_RBUTTON;
+ break;
+ default:
+ return 0;
+ }
+
+ if (eventPtr->xbutton.state & Button1Mask) {
+ wparam |= MK_LBUTTON;
+ }
+ if (eventPtr->xbutton.state & Button2Mask) {
+ wparam |= MK_MBUTTON;
+ }
+ if (eventPtr->xbutton.state & Button3Mask) {
+ wparam |= MK_RBUTTON;
+ }
+ if (eventPtr->xbutton.state & ShiftMask) {
+ wparam |= MK_SHIFT;
+ }
+ if (eventPtr->xbutton.state & ControlMask) {
+ wparam |= MK_CONTROL;
+ }
+ lparam = MAKELPARAM((short) eventPtr->xbutton.x,
+ (short) eventPtr->xbutton.y);
return CallWindowProc(wndproc, hwnd, msg, wparam, lparam);
}
@@ -1727,8 +1764,8 @@ TkWinResendEvent(wndproc, hwnd, eventPtr)
*
* TkpGetMS --
*
- * Return a relative time in milliseconds. It doesn't matter
- * when the epoch was.
+ * Return a relative time in milliseconds. It doesn't matter when the
+ * epoch was.
*
* Results:
* Number of milliseconds.
@@ -1740,7 +1777,7 @@ TkWinResendEvent(wndproc, hwnd, eventPtr)
*/
unsigned long
-TkpGetMS()
+TkpGetMS(void)
{
return GetTickCount();
}
@@ -1761,9 +1798,10 @@ TkpGetMS()
*/
void
-TkWinUpdatingClipboard(int mode)
+TkWinUpdatingClipboard(
+ int mode)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->updatingClipboard = mode;
@@ -1774,17 +1812,17 @@ TkWinUpdatingClipboard(int mode)
*
* Tk_SetCaretPos --
*
- * This enables correct movement of focus in the MS Magnifier, as well
- * as allowing us to correctly position the IME Window. The following
- * Win32 APIs are used to work with MS caret:
+ * This enables correct movement of focus in the MS Magnifier, as well as
+ * allowing us to correctly position the IME Window. The following Win32
+ * APIs are used to work with MS caret:
*
* CreateCaret DestroyCaret SetCaretPos GetCaretPos
*
- * Only one instance of caret can be active at any time
- * (e.g. DestroyCaret API does not take any argument such as handle).
- * Since do-it-right approach requires to track the create/destroy
- * caret status all the time in a global scope among windows (or
- * widgets), we just implement this minimal setup to get the job done.
+ * Only one instance of caret can be active at any time (e.g.
+ * DestroyCaret API does not take any argument such as handle). Since
+ * do-it-right approach requires to track the create/destroy caret status
+ * all the time in a global scope among windows (or widgets), we just
+ * implement this minimal setup to get the job done.
*
* Results:
* None
@@ -1796,16 +1834,20 @@ TkWinUpdatingClipboard(int mode)
*/
void
-Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
+Tk_SetCaretPos(
+ Tk_Window tkwin,
+ int x, int y,
+ int height)
{
static HWND caretHWND = NULL;
TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);
Window win;
/*
- * Prevent processing anything if the values haven't changed.
- * Windows only has one display, so we can do this with statics.
+ * Prevent processing anything if the values haven't changed. Windows only
+ * has one display, so we can do this with statics.
*/
+
if ((caretPtr->winPtr == ((TkWindow *) tkwin))
&& (caretPtr->x == x) && (caretPtr->y == y)) {
return;
@@ -1817,9 +1859,8 @@ Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
caretPtr->height = height;
/*
- * We adjust to the toplevel to get the coords right, as setting
- * the IME composition window is based on the toplevel hwnd, so
- * ignore height.
+ * We adjust to the toplevel to get the coords right, as setting the IME
+ * composition window is based on the toplevel hwnd, so ignore height.
*/
while (!Tk_IsTopLevel(tkwin)) {
@@ -1852,11 +1893,13 @@ Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
* The IME composition window should be updated whenever the caret
* position is changed because a clause of the composition string may
* be converted to the final characters and the other clauses still
- * stay on the composition window. -- yamamoto
+ * stay on the composition window. -- yamamoto
*/
+
hIMC = ImmGetContext(hwnd);
if (hIMC) {
COMPOSITIONFORM cform;
+
cform.dwStyle = CFS_POINT;
cform.ptCurrentPos.x = x;
cform.ptCurrentPos.y = y;
@@ -1865,3 +1908,102 @@ Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
}
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetUserInactiveTime --
+ *
+ * Return the number of milliseconds the user was inactive.
+ *
+ * Results:
+ * Milliseconds of user inactive time or -1 if the user32.dll doesn't
+ * have the symbol GetLastInputInfo or GetLastInputInfo returns an error.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+long
+Tk_GetUserInactiveTime(
+ Display *dpy) /* Ignored on Windows */
+{
+ struct tagLASTINPUTINFO {
+ UINT cbSize;
+ DWORD dwTime;
+ } li;
+
+ /*
+ * Multiple settings of either of these variables should be OK; any thread
+ * hazards should just cause inefficiency...
+ */
+
+ static FARPROC pfnGetLastInputInfo = NULL;
+ static int initinfo = 0;
+
+ if (!initinfo) {
+ HMODULE hMod = GetModuleHandleA("USER32.DLL");
+
+ initinfo = 1;
+ if (hMod){
+ pfnGetLastInputInfo = GetProcAddress(hMod, "GetLastInputInfo");
+ }
+ }
+ if (pfnGetLastInputInfo == NULL) {
+ return -1;
+ }
+ li.cbSize = sizeof(li);
+ if (!(BOOL)(pfnGetLastInputInfo)(&li)) {
+ return -1;
+ }
+
+ /*
+ * Last input info is in milliseconds, since restart time.
+ */
+
+ return (GetTickCount()-li.dwTime);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_ResetUserInactiveTime --
+ *
+ * Reset the user inactivity timer
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * The user inactivity timer of the underlaying windowing system is reset
+ * to zero.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_ResetUserInactiveTime(
+ Display *dpy)
+{
+ INPUT inp;
+
+ inp.type = INPUT_MOUSE;
+ inp.mi.dx = 0;
+ inp.mi.dy = 0;
+ inp.mi.mouseData = 0;
+ inp.mi.dwFlags = MOUSEEVENTF_MOVE;
+ inp.mi.time = 0;
+ inp.mi.dwExtraInfo = (DWORD) 0;
+
+ SendInput(1, &inp, sizeof(inp));
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
new file mode 100644
index 0000000..25c9c0c
--- /dev/null
+++ b/win/ttkWinMonitor.c
@@ -0,0 +1,158 @@
+#ifdef _MSC_VER
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include <tkWinInt.h>
+#include "ttk/ttkTheme.h"
+
+#if !defined(WM_THEMECHANGED)
+#define WM_THEMECHANGED 0x031A
+#endif
+
+static LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
+
+/*
+ * RegisterSystemColors --
+ * Register all known Windows system colors (as per GetSysColor) as Tk
+ * named colors.
+ */
+
+typedef struct {
+ const char *name;
+ int index;
+} SystemColorEntry;
+
+static SystemColorEntry sysColors[] = {
+ { "System3dDarkShadow", COLOR_3DDKSHADOW },
+ { "System3dLight", COLOR_3DLIGHT },
+ { "SystemActiveBorder", COLOR_ACTIVEBORDER },
+ { "SystemActiveCaption", COLOR_ACTIVECAPTION },
+ { "SystemAppWorkspace", COLOR_APPWORKSPACE },
+ { "SystemBackground", COLOR_BACKGROUND },
+ { "SystemButtonFace", COLOR_BTNFACE },
+ { "SystemButtonHighlight", COLOR_BTNHIGHLIGHT },
+ { "SystemButtonShadow", COLOR_BTNSHADOW },
+ { "SystemButtonText", COLOR_BTNTEXT },
+ { "SystemCaptionText", COLOR_CAPTIONTEXT },
+ { "SystemDisabledText", COLOR_GRAYTEXT },
+ { "SystemGrayText", COLOR_GRAYTEXT },
+ { "SystemHighlight", COLOR_HIGHLIGHT },
+ { "SystemHighlightText", COLOR_HIGHLIGHTTEXT },
+ { "SystemInactiveBorder", COLOR_INACTIVEBORDER },
+ { "SystemInactiveCaption", COLOR_INACTIVECAPTION },
+ { "SystemInactiveCaptionText", COLOR_INACTIVECAPTIONTEXT },
+ { "SystemInfoBackground", COLOR_INFOBK },
+ { "SystemInfoText", COLOR_INFOTEXT },
+ { "SystemMenu", COLOR_MENU },
+ { "SystemMenuText", COLOR_MENUTEXT },
+ { "SystemScrollbar", COLOR_SCROLLBAR },
+ { "SystemWindow", COLOR_WINDOW },
+ { "SystemWindowFrame", COLOR_WINDOWFRAME },
+ { "SystemWindowText", COLOR_WINDOWTEXT },
+ { NULL, 0 }
+};
+
+static void RegisterSystemColors(Tcl_Interp *interp)
+{
+ Ttk_ResourceCache cache = Ttk_GetResourceCache(interp);
+ SystemColorEntry *sysColor;
+
+ for (sysColor = sysColors; sysColor->name; ++sysColor) {
+ DWORD pixel = GetSysColor(sysColor->index);
+ XColor colorSpec;
+ colorSpec.red = GetRValue(pixel) * 257;
+ colorSpec.green = GetGValue(pixel) * 257;
+ colorSpec.blue = GetBValue(pixel) * 257;
+ Ttk_RegisterNamedColor(cache, sysColor->name, &colorSpec);
+ }
+}
+
+static HWND
+CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
+{
+ WNDCLASSEX wc;
+ HWND hwnd = NULL;
+ TCHAR title[32] = TEXT("TtkMonitorWindow");
+ TCHAR name[32] = TEXT("TtkMonitorClass");
+
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hinst;
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
+ wc.lpszMenuName = name;
+ wc.lpszClassName = name;
+
+ if (RegisterClassEx(&wc)) {
+ hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ NULL, NULL, hinst, NULL );
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)interp);
+ ShowWindow(hwnd, SW_HIDE);
+ UpdateWindow(hwnd);
+ }
+ return hwnd;
+}
+
+static void
+DestroyThemeMonitorWindow(void *clientData)
+{
+ HWND hwnd = (HWND)clientData;
+ DestroyWindow(hwnd);
+}
+
+static LRESULT WINAPI
+WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+ Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ Ttk_Theme theme;
+
+ switch (msg) {
+ case WM_DESTROY:
+ break;
+
+ case WM_SYSCOLORCHANGE:
+ RegisterSystemColors(interp);
+ break;
+
+ case WM_THEMECHANGED:
+ /*
+ * Reset the application theme to 'xpnative' if present,
+ * which will in turn fall back to 'winnative' if XP theming
+ * is disabled.
+ */
+
+ theme = Ttk_GetTheme(interp, "xpnative");
+ if (theme) {
+ Ttk_UseTheme(interp, theme);
+ /* @@@ What to do about errors here? */
+ }
+ break;
+ }
+ return DefWindowProc(hwnd, msg, wp, lp);
+}
+
+/*
+ * Windows-specific platform initialization:
+ */
+
+MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd);
+MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd);
+
+MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp)
+{
+ HWND hwnd;
+
+ hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp);
+ Ttk_RegisterCleanup(interp, (ClientData)hwnd, DestroyThemeMonitorWindow);
+
+ TtkWinTheme_Init(interp, hwnd);
+ TtkXPTheme_Init(interp, hwnd);
+
+ return TCL_OK;
+}
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
new file mode 100644
index 0000000..e0a0eda
--- /dev/null
+++ b/win/ttkWinTheme.c
@@ -0,0 +1,733 @@
+/* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
+ */
+
+#ifdef _MSC_VER
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include <tkWinInt.h>
+
+#ifndef DFCS_HOT /* Windows 98/Me, Windows 200/XP only */
+#define DFCS_HOT 0
+#endif
+
+#include "ttk/ttkTheme.h"
+
+/*
+ * BoxToRect --
+ * Helper routine. Converts a Ttk_Box to a Win32 RECT.
+ */
+static RECT BoxToRect(Ttk_Box b)
+{
+ RECT rc;
+ rc.top = b.y;
+ rc.left = b.x;
+ rc.bottom = b.y + b.height;
+ rc.right = b.x + b.width;
+ return rc;
+}
+
+/*
+ * ReliefToEdge --
+ * Convert a Tk "relief" value into an Windows "edge" value.
+ * NB: Caller must check for RELIEF_FLAT and RELIEF_SOLID,
+ * which must be handled specially.
+ *
+ * Passing the BF_FLAT flag to DrawEdge() yields something similar
+ * to TK_RELIEF_SOLID. TK_RELIEF_FLAT can be implemented by not
+ * drawing anything.
+ */
+static unsigned int ReliefToEdge(int relief)
+{
+ switch (relief) {
+ case TK_RELIEF_RAISED: return EDGE_RAISED;
+ case TK_RELIEF_SUNKEN: return EDGE_SUNKEN;
+ case TK_RELIEF_RIDGE: return EDGE_BUMP;
+ case TK_RELIEF_GROOVE: return EDGE_ETCHED;
+ case TK_RELIEF_SOLID: return BDR_RAISEDOUTER;
+ default:
+ case TK_RELIEF_FLAT: return BDR_RAISEDOUTER;
+ }
+}
+
+/*------------------------------------------------------------------------
+ * +++ State tables for FrameControlElements.
+ */
+
+static Ttk_StateTable checkbutton_statemap[] = { /* see also SF#1865898 */
+ { DFCS_BUTTON3STATE|DFCS_CHECKED|DFCS_INACTIVE,
+ TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0 },
+ { DFCS_BUTTON3STATE|DFCS_CHECKED|DFCS_PUSHED,
+ TTK_STATE_ALTERNATE|TTK_STATE_PRESSED, 0 },
+ { DFCS_BUTTON3STATE|DFCS_CHECKED|DFCS_HOT,
+ TTK_STATE_ALTERNATE|TTK_STATE_ACTIVE, 0 },
+ { DFCS_BUTTON3STATE|DFCS_CHECKED,
+ TTK_STATE_ALTERNATE, 0 },
+
+ { DFCS_CHECKED|DFCS_INACTIVE, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 },
+ { DFCS_CHECKED|DFCS_PUSHED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0 },
+ { DFCS_CHECKED|DFCS_HOT, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0 },
+ { DFCS_CHECKED, TTK_STATE_SELECTED, 0 },
+
+ { DFCS_INACTIVE, TTK_STATE_DISABLED, 0 },
+ { DFCS_PUSHED, TTK_STATE_PRESSED, 0 },
+ { DFCS_HOT, TTK_STATE_ACTIVE, 0 },
+ { 0, 0, 0 },
+};
+
+static Ttk_StateTable pushbutton_statemap[] = {
+ { DFCS_INACTIVE, TTK_STATE_DISABLED, 0 },
+ { DFCS_PUSHED, TTK_STATE_PRESSED, 0 },
+ { DFCS_HOT, TTK_STATE_ACTIVE, 0 },
+ { 0, 0, 0 }
+};
+
+static Ttk_StateTable arrow_statemap[] = {
+ { DFCS_INACTIVE, TTK_STATE_DISABLED, 0 },
+ { DFCS_PUSHED | DFCS_FLAT, TTK_STATE_PRESSED, 0 },
+ { 0, 0, 0 }
+};
+
+/*------------------------------------------------------------------------
+ * +++ FrameControlElement --
+ * General-purpose element for things drawn with DrawFrameControl
+ */
+typedef struct {
+ const char *name; /* element name */
+ int classId; /* class id for DrawFrameControl */
+ int partId; /* part id for DrawFrameControl */
+ int cxId; /* system metric ids for width/height... */
+ int cyId; /* ... or size if FIXEDSIZE bit set */
+ Ttk_StateTable *stateMap; /* map Tk states to Win32 flags */
+ Ttk_Padding margins; /* additional placement padding */
+} FrameControlElementData;
+
+#define _FIXEDSIZE 0x80000000L
+#define _HALFMETRIC 0x40000000L
+#define FIXEDSIZE(id) (id|_FIXEDSIZE)
+#define HALFMETRIC(id) (id|_HALFMETRIC)
+#define GETMETRIC(m) \
+ ((m) & _FIXEDSIZE ? (int)((m) & ~_FIXEDSIZE) : GetSystemMetrics((m)&0x0fffffff))
+
+static FrameControlElementData FrameControlElements[] = {
+ { "Checkbutton.indicator",
+ DFC_BUTTON, DFCS_BUTTONCHECK, FIXEDSIZE(13), FIXEDSIZE(13),
+ checkbutton_statemap, {0,0,4,0} },
+ { "Radiobutton.indicator",
+ DFC_BUTTON, DFCS_BUTTONRADIO, FIXEDSIZE(13), FIXEDSIZE(13),
+ checkbutton_statemap, {0,0,4,0} },
+ { "uparrow",
+ DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, SM_CYVSCROLL,
+ arrow_statemap, {0,0,0,0} },
+ { "downarrow",
+ DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, SM_CYVSCROLL,
+ arrow_statemap, {0,0,0,0} },
+ { "leftarrow",
+ DFC_SCROLL, DFCS_SCROLLLEFT, SM_CXHSCROLL, SM_CYHSCROLL,
+ arrow_statemap, {0,0,0,0} },
+ { "rightarrow",
+ DFC_SCROLL, DFCS_SCROLLRIGHT, SM_CXHSCROLL, SM_CYHSCROLL,
+ arrow_statemap, {0,0,0,0} },
+ { "sizegrip",
+ DFC_SCROLL, DFCS_SCROLLSIZEGRIP, SM_CXVSCROLL, SM_CYHSCROLL,
+ arrow_statemap, {0,0,0,0} },
+ { "Spinbox.uparrow",
+ DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL),
+ arrow_statemap, {0,0,0,0} },
+ { "Spinbox.downarrow",
+ DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL),
+ arrow_statemap, {0,0,0,0} },
+
+ { 0,0,0,0,0,0, {0,0,0,0} }
+};
+
+/* ---------------------------------------------------------------------- */
+
+static void FrameControlElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ FrameControlElementData *p = clientData;
+ int cx = GETMETRIC(p->cxId);
+ int cy = GETMETRIC(p->cyId);
+ if (p->cxId & _HALFMETRIC) cx /= 2;
+ if (p->cyId & _HALFMETRIC) cy /= 2;
+ *widthPtr = cx + Ttk_PaddingWidth(p->margins);
+ *heightPtr = cy + Ttk_PaddingHeight(p->margins);
+}
+
+static void FrameControlElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FrameControlElementData *elementData = clientData;
+ RECT rc = BoxToRect(Ttk_PadBox(b, elementData->margins));
+ TkWinDCState dcState;
+ HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+
+ DrawFrameControl(hdc, &rc,
+ elementData->classId,
+ elementData->partId|Ttk_StateTableLookup(elementData->stateMap, state));
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+}
+
+static Ttk_ElementSpec FrameControlElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ FrameControlElementSize,
+ FrameControlElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Border element implementation.
+ */
+
+typedef struct {
+ Tcl_Obj *reliefObj;
+} BorderElement;
+
+static Ttk_ElementOptionSpec BorderElementOptions[] = {
+ { "-relief",TK_OPTION_RELIEF,Tk_Offset(BorderElement,reliefObj), "flat" },
+ {NULL, 0, 0, NULL}
+};
+
+static void BorderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE);
+ paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE);
+}
+
+static void BorderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ BorderElement *border = elementRecord;
+ RECT rc = BoxToRect(b);
+ int relief = TK_RELIEF_FLAT;
+ TkWinDCState dcState;
+ HDC hdc;
+
+ Tk_GetReliefFromObj(NULL, border->reliefObj, &relief);
+
+ if (relief != TK_RELIEF_FLAT) {
+ UINT xFlags = (relief == TK_RELIEF_SOLID) ? BF_FLAT : 0;
+ hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ DrawEdge(hdc, &rc, ReliefToEdge(relief), BF_RECT | xFlags);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+ }
+}
+
+static Ttk_ElementSpec BorderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(BorderElement),
+ BorderElementOptions,
+ BorderElementSize,
+ BorderElementDraw
+};
+
+/*
+ * Entry field borders:
+ * Sunken border; also fill with window color.
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+} FieldElement;
+
+static Ttk_ElementOptionSpec FieldElementOptions[] = {
+ { "-fieldbackground", TK_OPTION_BORDER,
+ Tk_Offset(FieldElement,backgroundObj), "white" },
+ { NULL, 0, 0, NULL }
+};
+
+static void FieldElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE);
+ paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE);
+}
+
+static void FieldElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FieldElement *field = elementRecord;
+ Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj);
+ RECT rc = BoxToRect(b);
+ TkWinDCState dcState;
+ HDC hdc;
+
+ Tk_Fill3DRectangle(
+ tkwin, d, bg, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT);
+
+ hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ DrawEdge(hdc, &rc, EDGE_SUNKEN, BF_RECT);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+}
+
+static Ttk_ElementSpec FieldElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(FieldElement),
+ FieldElementOptions,
+ FieldElementSize,
+ FieldElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Button borders.
+ * Drawn with DrawFrameControl instead of DrawEdge;
+ * Also draw default indicator and focus ring.
+ */
+typedef struct {
+ Tcl_Obj *reliefObj;
+ Tcl_Obj *highlightColorObj;
+ Tcl_Obj *defaultStateObj;
+} ButtonBorderElement;
+
+static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = {
+ { "-relief",TK_OPTION_RELIEF,
+ Tk_Offset(ButtonBorderElement,reliefObj), "flat" },
+ { "-highlightcolor",TK_OPTION_COLOR,
+ Tk_Offset(ButtonBorderElement,highlightColorObj), "black" },
+ { "-default", TK_OPTION_ANY,
+ Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" },
+ {NULL, 0, 0, NULL}
+};
+
+static void ButtonBorderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ButtonBorderElement *bd = elementRecord;
+ int relief = TK_RELIEF_RAISED;
+ int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ short int cx, cy;
+
+ Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
+ Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
+ cx = GetSystemMetrics(SM_CXEDGE);
+ cy = GetSystemMetrics(SM_CYEDGE);
+
+ /* Space for default indicator:
+ */
+ if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) {
+ ++cx; ++cy;
+ }
+
+ /* Space for focus ring:
+ */
+ cx += 2;
+ cy += 2;
+
+ *paddingPtr = Ttk_MakePadding(cx,cy,cx,cy);
+}
+
+static void ButtonBorderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ButtonBorderElement *bd = elementRecord;
+ int relief = TK_RELIEF_FLAT;
+ int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ TkWinDCState dcState;
+ HDC hdc;
+ RECT rc;
+
+ Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
+ Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
+
+ if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) {
+ XColor *highlightColor =
+ Tk_GetColorFromObj(tkwin, bd->highlightColorObj);
+ GC gc = Tk_GCForColor(highlightColor, d);
+ XDrawRectangle(Tk_Display(tkwin), d, gc, b.x,b.y,b.width-1,b.height-1);
+ }
+ if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) {
+ ++b.x; ++b.y; b.width -= 2; b.height -= 2;
+ }
+
+ hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+
+ rc = BoxToRect(b);
+ DrawFrameControl(hdc, &rc,
+ DFC_BUTTON, /* classId */
+ DFCS_BUTTONPUSH | Ttk_StateTableLookup(pushbutton_statemap, state));
+
+ /* Draw focus ring:
+ */
+ if (state & TTK_STATE_FOCUS) {
+ short int borderWidth = 3; /* @@@ Use GetSystemMetrics?*/
+ rc = BoxToRect(Ttk_PadBox(b, Ttk_UniformPadding(borderWidth)));
+ DrawFocusRect(hdc, &rc);
+ }
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+}
+
+static Ttk_ElementSpec ButtonBorderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ButtonBorderElement),
+ ButtonBorderElementOptions,
+ ButtonBorderElementSize,
+ ButtonBorderElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Focus element.
+ * Draw dashed focus rectangle.
+ */
+
+static void FocusElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *paddingPtr = Ttk_UniformPadding(1);
+}
+
+static void FocusElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ if (state & TTK_STATE_FOCUS) {
+ RECT rc = BoxToRect(b);
+ TkWinDCState dcState;
+ HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ DrawFocusRect(hdc, &rc);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+ }
+}
+
+static Ttk_ElementSpec FocusElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ FocusElementSize,
+ FocusElementDraw
+};
+
+/* FillFocusElement --
+ * Draws a focus ring filled with the selection color
+ */
+
+typedef struct {
+ Tcl_Obj *fillColorObj;
+} FillFocusElement;
+
+static Ttk_ElementOptionSpec FillFocusElementOptions[] = {
+ { "-focusfill", TK_OPTION_COLOR,
+ Tk_Offset(FillFocusElement,fillColorObj), "white" },
+ {NULL, 0, 0, NULL}
+};
+
+ /* @@@ FIX THIS */
+static void FillFocusElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FillFocusElement *focus = elementRecord;
+ if (state & TTK_STATE_FOCUS) {
+ RECT rc = BoxToRect(b);
+ TkWinDCState dcState;
+ XColor *fillColor = Tk_GetColorFromObj(tkwin, focus->fillColorObj);
+ GC gc = Tk_GCForColor(fillColor, d);
+ HDC hdc;
+
+ XFillRectangle(Tk_Display(tkwin),d,gc, b.x,b.y,b.width,b.height);
+ hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ DrawFocusRect(hdc, &rc);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+ }
+}
+
+/*
+ * ComboboxFocusElement --
+ * Read-only comboboxes have a filled focus ring, editable ones do not.
+ */
+static void ComboboxFocusElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ if (state & TTK_STATE_READONLY) {
+ FillFocusElementDraw(clientData, elementRecord, tkwin, d, b, state);
+ }
+}
+
+static Ttk_ElementSpec ComboboxFocusElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(FillFocusElement),
+ FillFocusElementOptions,
+ FocusElementSize,
+ ComboboxFocusElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Scrollbar trough element.
+ *
+ * The native windows scrollbar is drawn using a pattern brush giving a
+ * stippled appearance when the trough might otherwise be invisible.
+ * We can deal with this here.
+ */
+
+typedef struct { /* clientData for Trough element */
+ HBRUSH PatternBrush;
+ HBITMAP PatternBitmap;
+} TroughClientData;
+
+static const WORD Pattern[] = {
+ 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa
+};
+
+static void TroughClientDataDeleteProc(void *clientData)
+{
+ TroughClientData *cd = clientData;
+ DeleteObject(cd->PatternBrush);
+ DeleteObject(cd->PatternBitmap);
+ ckfree(clientData);
+}
+
+static TroughClientData *TroughClientDataInit(Tcl_Interp *interp)
+{
+ TroughClientData *cd = (TroughClientData*)ckalloc(sizeof(*cd));
+ cd->PatternBitmap = CreateBitmap(8, 8, 1, 1, Pattern);
+ cd->PatternBrush = CreatePatternBrush(cd->PatternBitmap);
+ Ttk_RegisterCleanup(interp, cd, TroughClientDataDeleteProc);
+ return cd;
+}
+
+static void TroughElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ TroughClientData *cd = clientData;
+ TkWinDCState dcState;
+ HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ HBRUSH hbr;
+ COLORREF bk, oldbk, oldtxt;
+
+ hbr = SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR));
+ bk = GetSysColor(COLOR_3DHIGHLIGHT);
+ oldtxt = SetTextColor(hdc, GetSysColor(COLOR_3DFACE));
+ oldbk = SetBkColor(hdc, bk);
+
+ /* WAS: if (bk (COLOR_3DHIGHLIGHT) == GetSysColor(COLOR_WINDOW)) ... */
+ if (GetSysColor(COLOR_SCROLLBAR) == GetSysColor(COLOR_BTNFACE)) {
+ /* Draw using the pattern brush */
+ SelectObject(hdc, cd->PatternBrush);
+ }
+
+ PatBlt(hdc, b.x, b.y, b.width, b.height, PATCOPY);
+ SetBkColor(hdc, oldbk);
+ SetTextColor(hdc, oldtxt);
+ SelectObject(hdc, hbr);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+}
+
+static Ttk_ElementSpec TroughElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ TroughElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Thumb element.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj;
+} ThumbElement;
+
+static Ttk_ElementOptionSpec ThumbElementOptions[] = {
+ { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"},
+ { NULL, 0, 0, NULL }
+};
+
+static void ThumbElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ThumbElement *thumbPtr = elementRecord;
+ int orient;
+
+ Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient);
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ *widthPtr = GetSystemMetrics(SM_CXHTHUMB);
+ *heightPtr = GetSystemMetrics(SM_CYHSCROLL);
+ } else {
+ *widthPtr = GetSystemMetrics(SM_CXVSCROLL);
+ *heightPtr = GetSystemMetrics(SM_CYVTHUMB);
+ }
+}
+
+static void ThumbElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ RECT rc = BoxToRect(b);
+ TkWinDCState dcState;
+ HDC hdc;
+
+ /* Windows doesn't show a thumb when the scrollbar is disabled */
+ if (state & TTK_STATE_DISABLED)
+ return;
+
+ hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+}
+
+static Ttk_ElementSpec ThumbElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(ThumbElement),
+ ThumbElementOptions,
+ ThumbElementSize,
+ ThumbElementDraw
+};
+
+/* ----------------------------------------------------------------------
+ * The slider element is the shaped thumb used in the slider widget.
+ * Windows likes to call this a trackbar.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj; /* orientation of the slider widget */
+} SliderElement;
+
+static Ttk_ElementOptionSpec SliderElementOptions[] = {
+ { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
+ "horizontal" },
+ { NULL, 0, 0, NULL }
+};
+
+static void SliderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SliderElement *slider = elementRecord;
+ int orient;
+
+ Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ if (orient == TTK_ORIENT_HORIZONTAL) {
+ *widthPtr = (GetSystemMetrics(SM_CXHTHUMB) / 2) | 1;
+ *heightPtr = GetSystemMetrics(SM_CYHSCROLL);
+ } else {
+ *widthPtr = GetSystemMetrics(SM_CXVSCROLL);
+ *heightPtr = (GetSystemMetrics(SM_CYVTHUMB) / 2) | 1;
+ }
+}
+
+static void SliderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ RECT rc = BoxToRect(b);
+ TkWinDCState dcState;
+ HDC hdc;
+
+ hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+}
+
+static Ttk_ElementSpec SliderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(SliderElement),
+ SliderElementOptions,
+ SliderElementSize,
+ SliderElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Notebook elements.
+ */
+
+static void ClientElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE);
+ paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE);
+}
+
+static void ClientElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ RECT rc = BoxToRect(b);
+ TkWinDCState dcState;
+ HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
+ DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_SOFT);
+ TkWinReleaseDrawableDC(d, hdc, &dcState);
+}
+
+static Ttk_ElementSpec ClientElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ClientElementSize,
+ ClientElementDraw
+};
+
+/*------------------------------------------------------------------------
+ * +++ Layouts.
+ */
+
+TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
+
+TTK_LAYOUT("TButton",
+ TTK_GROUP("Button.border", TTK_FILL_BOTH,
+ TTK_GROUP("Button.padding", TTK_FILL_BOTH,
+ TTK_NODE("Button.label", TTK_FILL_BOTH))))
+
+TTK_LAYOUT("TCombobox",
+ TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
+ TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
+ TTK_GROUP("Combobox.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_GROUP("Combobox.focus", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))))
+
+TTK_END_LAYOUT_TABLE
+
+/* ---------------------------------------------------------------------- */
+
+MODULE_SCOPE
+int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd)
+{
+ Ttk_Theme themePtr, parentPtr;
+ FrameControlElementData *fce = FrameControlElements;
+
+ parentPtr = Ttk_GetTheme(interp, "alt");
+ themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr);
+ if (!themePtr) {
+ return TCL_ERROR;
+ }
+
+ Ttk_RegisterElementSpec(themePtr, "border", &BorderElementSpec, NULL);
+ Ttk_RegisterElementSpec(themePtr, "Button.border",
+ &ButtonBorderElementSpec, NULL);
+ Ttk_RegisterElementSpec(themePtr, "field", &FieldElementSpec, NULL);
+ Ttk_RegisterElementSpec(themePtr, "focus", &FocusElementSpec, NULL);
+ Ttk_RegisterElementSpec(themePtr, "Combobox.focus",
+ &ComboboxFocusElementSpec, NULL);
+ Ttk_RegisterElementSpec(themePtr, "thumb", &ThumbElementSpec, NULL);
+ Ttk_RegisterElementSpec(themePtr, "slider", &SliderElementSpec, NULL);
+ Ttk_RegisterElementSpec(themePtr, "Scrollbar.trough", &TroughElementSpec,
+ TroughClientDataInit(interp));
+
+ Ttk_RegisterElementSpec(themePtr, "client", &ClientElementSpec, NULL);
+
+ for (fce = FrameControlElements; fce->name != 0; ++fce) {
+ Ttk_RegisterElementSpec(themePtr, fce->name,
+ &FrameControlElementSpec, fce);
+ }
+
+ Ttk_RegisterLayouts(themePtr, LayoutTable);
+
+ Tcl_PkgProvide(interp, "ttk::theme::winnative", TTK_VERSION);
+ return TCL_OK;
+}
+
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
new file mode 100644
index 0000000..e2f916f
--- /dev/null
+++ b/win/ttkWinXPTheme.c
@@ -0,0 +1,1324 @@
+/*
+ * Tk theme engine which uses the Windows XP "Visual Styles" API
+ * Adapted from Georgios Petasis' XP theme patch.
+ *
+ * Copyright (c) 2003 by Georgios Petasis, petasis@iit.demokritos.gr.
+ * Copyright (c) 2003 by Joe English
+ * Copyright (c) 2003 by Pat Thoyts
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * See also:
+ *
+ * <URL: http://msdn.microsoft.com/library/en-us/
+ * shellcc/platform/commctls/userex/refentry.asp >
+ */
+
+#ifndef HAVE_UXTHEME_H
+/* Stub for platforms that lack the XP theme API headers: */
+#include <tkWinInt.h>
+int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; }
+#else
+
+#define WINVER 0x0501 /* Requires Windows XP APIs */
+
+#include <windows.h>
+#include <uxtheme.h>
+#ifdef HAVE_VSSYM32_H
+# include <vssym32.h>
+#else
+# include <tmschema.h>
+#endif
+
+#include <tkWinInt.h>
+
+#include "ttk/ttkTheme.h"
+
+typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd,
+ LPCWSTR pszClassList);
+typedef HRESULT (STDAPICALLTYPE CloseThemeDataProc)(HTHEME hTheme);
+typedef HRESULT (STDAPICALLTYPE DrawThemeBackgroundProc)(HTHEME hTheme,
+ HDC hdc, int iPartId, int iStateId, const RECT *pRect,
+ OPTIONAL const RECT *pClipRect);
+typedef HRESULT (STDAPICALLTYPE GetThemePartSizeProc)(HTHEME,HDC,
+ int iPartId, int iStateId,
+ RECT *prc, enum THEMESIZE eSize, SIZE *psz);
+typedef int (STDAPICALLTYPE GetThemeSysSizeProc)(HTHEME,int);
+/* GetThemeTextExtent and DrawThemeText only used with BROKEN_TEXT_ELEMENT */
+typedef HRESULT (STDAPICALLTYPE GetThemeTextExtentProc)(HTHEME hTheme, HDC hdc,
+ int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,
+ DWORD dwTextFlags, const RECT *pBoundingRect, RECT *pExtent);
+typedef HRESULT (STDAPICALLTYPE DrawThemeTextProc)(HTHEME hTheme, HDC hdc,
+ int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,
+ DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect);
+typedef BOOL (STDAPICALLTYPE IsThemeActiveProc)(void);
+typedef BOOL (STDAPICALLTYPE IsAppThemedProc)(void);
+
+typedef struct
+{
+ OpenThemeDataProc *OpenThemeData;
+ CloseThemeDataProc *CloseThemeData;
+ GetThemePartSizeProc *GetThemePartSize;
+ GetThemeSysSizeProc *GetThemeSysSize;
+ DrawThemeBackgroundProc *DrawThemeBackground;
+ DrawThemeTextProc *DrawThemeText;
+ GetThemeTextExtentProc *GetThemeTextExtent;
+ IsThemeActiveProc *IsThemeActive;
+ IsAppThemedProc *IsAppThemed;
+
+ HWND stubWindow;
+} XPThemeProcs;
+
+typedef struct
+{
+ HINSTANCE hlibrary;
+ XPThemeProcs *procs;
+} XPThemeData;
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * LoadXPThemeProcs --
+ * Initialize XP theming support.
+ *
+ * XP theme support is included in UXTHEME.DLL
+ * We dynamically load this DLL at runtime instead of linking
+ * to it at build-time.
+ *
+ * Returns:
+ * A pointer to an XPThemeProcs table if successful, NULL otherwise.
+ */
+
+static XPThemeProcs *
+LoadXPThemeProcs(HINSTANCE *phlib)
+{
+ /*
+ * Load the library "uxtheme.dll", where the native widget
+ * drawing routines are implemented. This will only succeed
+ * if we are running at least on Windows XP.
+ */
+ HINSTANCE handle;
+ *phlib = handle = LoadLibrary(TEXT("uxtheme.dll"));
+ if (handle != 0)
+ {
+ /*
+ * We have successfully loaded the library. Proceed in storing the
+ * addresses of the functions we want to use.
+ */
+ XPThemeProcs *procs = (XPThemeProcs*)ckalloc(sizeof(XPThemeProcs));
+#define LOADPROC(name) \
+ (0 != (procs->name = (name ## Proc *)GetProcAddress(handle, #name) ))
+
+ if ( LOADPROC(OpenThemeData)
+ && LOADPROC(CloseThemeData)
+ && LOADPROC(GetThemePartSize)
+ && LOADPROC(GetThemeSysSize)
+ && LOADPROC(DrawThemeBackground)
+ && LOADPROC(GetThemeTextExtent)
+ && LOADPROC(DrawThemeText)
+ && LOADPROC(IsThemeActive)
+ && LOADPROC(IsAppThemed)
+ )
+ {
+ return procs;
+ }
+#undef LOADPROC
+ ckfree((char*)procs);
+ }
+ return 0;
+}
+
+/*
+ * XPThemeDeleteProc --
+ *
+ * Release any theme allocated resources.
+ */
+
+static void
+XPThemeDeleteProc(void *clientData)
+{
+ XPThemeData *themeData = clientData;
+ FreeLibrary(themeData->hlibrary);
+ ckfree(clientData);
+}
+
+static int
+XPThemeEnabled(Ttk_Theme theme, void *clientData)
+{
+ XPThemeData *themeData = clientData;
+ int active = themeData->procs->IsThemeActive();
+ int themed = themeData->procs->IsAppThemed();
+ return (active && themed);
+}
+
+/*
+ * BoxToRect --
+ * Helper routine. Returns a RECT data structure.
+ */
+static RECT
+BoxToRect(Ttk_Box b)
+{
+ RECT rc;
+ rc.top = b.y;
+ rc.left = b.x;
+ rc.bottom = b.y + b.height;
+ rc.right = b.x + b.width;
+ return rc;
+}
+
+/*
+ * Map Tk state bitmaps to XP style enumerated values.
+ */
+static Ttk_StateTable null_statemap[] = { {0,0,0} };
+
+/*
+ * Pushbuttons (Tk: "Button")
+ */
+static Ttk_StateTable pushbutton_statemap[] =
+{
+ { PBS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { PBS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { PBS_HOT, TTK_STATE_ACTIVE, 0 },
+ { PBS_DEFAULTED, TTK_STATE_ALTERNATE, 0 },
+ { PBS_NORMAL, 0, 0 }
+};
+
+/*
+ * Checkboxes (Tk: "Checkbutton")
+ */
+static Ttk_StateTable checkbox_statemap[] =
+{
+{CBS_MIXEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0},
+{CBS_MIXEDPRESSED, TTK_STATE_ALTERNATE|TTK_STATE_PRESSED, 0},
+{CBS_MIXEDHOT, TTK_STATE_ALTERNATE|TTK_STATE_ACTIVE, 0},
+{CBS_MIXEDNORMAL, TTK_STATE_ALTERNATE, 0},
+{CBS_CHECKEDDISABLED, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0},
+{CBS_CHECKEDPRESSED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0},
+{CBS_CHECKEDHOT, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0},
+{CBS_CHECKEDNORMAL, TTK_STATE_SELECTED, 0},
+{CBS_UNCHECKEDDISABLED, TTK_STATE_DISABLED, 0},
+{CBS_UNCHECKEDPRESSED, TTK_STATE_PRESSED, 0},
+{CBS_UNCHECKEDHOT, TTK_STATE_ACTIVE, 0},
+{CBS_UNCHECKEDNORMAL, 0,0 }
+};
+
+/*
+ * Radiobuttons:
+ */
+static Ttk_StateTable radiobutton_statemap[] =
+{
+{RBS_CHECKEDDISABLED, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0},
+{RBS_CHECKEDPRESSED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0},
+{RBS_CHECKEDHOT, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0},
+{RBS_CHECKEDNORMAL, TTK_STATE_SELECTED, 0},
+{RBS_UNCHECKEDDISABLED, TTK_STATE_DISABLED, 0},
+{RBS_UNCHECKEDPRESSED, TTK_STATE_PRESSED, 0},
+{RBS_UNCHECKEDHOT, TTK_STATE_ACTIVE, 0},
+{RBS_UNCHECKEDNORMAL, 0,0 }
+};
+
+/*
+ * Groupboxes (tk: "frame")
+ */
+static Ttk_StateTable groupbox_statemap[] =
+{
+{GBS_DISABLED, TTK_STATE_DISABLED, 0},
+{GBS_NORMAL, 0,0 }
+};
+
+/*
+ * Edit fields (tk: "entry")
+ */
+static Ttk_StateTable edittext_statemap[] =
+{
+ { ETS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { ETS_READONLY, TTK_STATE_READONLY, 0 },
+ { ETS_FOCUSED, TTK_STATE_FOCUS, 0 },
+ { ETS_HOT, TTK_STATE_ACTIVE, 0 },
+ { ETS_NORMAL, 0, 0 }
+/* NOT USED: ETS_ASSIST, ETS_SELECTED */
+};
+
+/*
+ * Combobox text field statemap:
+ * Same as edittext_statemap, but doesn't use ETS_READONLY
+ * (fixes: #1032409)
+ */
+static Ttk_StateTable combotext_statemap[] =
+{
+ { ETS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { ETS_FOCUSED, TTK_STATE_FOCUS, 0 },
+ { ETS_HOT, TTK_STATE_ACTIVE, 0 },
+ { ETS_NORMAL, 0, 0 }
+};
+
+/*
+ * Combobox button: (CBP_DROPDOWNBUTTON)
+ */
+static Ttk_StateTable combobox_statemap[] = {
+ { CBXS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { CBXS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { CBXS_HOT, TTK_STATE_ACTIVE, 0 },
+ { CBXS_HOT, TTK_STATE_HOVER, 0 },
+ { CBXS_NORMAL, 0, 0 }
+};
+
+/*
+ * Toolbar buttons (TP_BUTTON):
+ */
+static Ttk_StateTable toolbutton_statemap[] = {
+ { TS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { TS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { TS_HOTCHECKED, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0 },
+ { TS_CHECKED, TTK_STATE_SELECTED, 0 },
+ { TS_HOT, TTK_STATE_ACTIVE, 0 },
+ { TS_NORMAL, 0,0 }
+};
+
+/*
+ * Scrollbars (Tk: "Scrollbar.thumb")
+ */
+static Ttk_StateTable scrollbar_statemap[] =
+{
+ { SCRBS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { SCRBS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { SCRBS_HOT, TTK_STATE_ACTIVE, 0 },
+ { SCRBS_NORMAL, 0, 0 }
+};
+
+static Ttk_StateTable uparrow_statemap[] =
+{
+ { ABS_UPDISABLED, TTK_STATE_DISABLED, 0 },
+ { ABS_UPPRESSED, TTK_STATE_PRESSED, 0 },
+ { ABS_UPHOT, TTK_STATE_ACTIVE, 0 },
+ { ABS_UPNORMAL, 0, 0 }
+};
+
+static Ttk_StateTable downarrow_statemap[] =
+{
+ { ABS_DOWNDISABLED, TTK_STATE_DISABLED, 0 },
+ { ABS_DOWNPRESSED, TTK_STATE_PRESSED, 0 },
+ { ABS_DOWNHOT, TTK_STATE_ACTIVE, 0 },
+ { ABS_DOWNNORMAL, 0, 0 }
+};
+
+static Ttk_StateTable leftarrow_statemap[] =
+{
+ { ABS_LEFTDISABLED, TTK_STATE_DISABLED, 0 },
+ { ABS_LEFTPRESSED, TTK_STATE_PRESSED, 0 },
+ { ABS_LEFTHOT, TTK_STATE_ACTIVE, 0 },
+ { ABS_LEFTNORMAL, 0, 0 }
+};
+
+static Ttk_StateTable rightarrow_statemap[] =
+{
+ { ABS_RIGHTDISABLED,TTK_STATE_DISABLED, 0 },
+ { ABS_RIGHTPRESSED, TTK_STATE_PRESSED, 0 },
+ { ABS_RIGHTHOT, TTK_STATE_ACTIVE, 0 },
+ { ABS_RIGHTNORMAL, 0, 0 }
+};
+
+static Ttk_StateTable spinbutton_statemap[] =
+{
+ { DNS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { DNS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { DNS_HOT, TTK_STATE_ACTIVE, 0 },
+ { DNS_NORMAL, 0, 0 },
+};
+
+/*
+ * Trackbar thumb: (Tk: "scale slider")
+ */
+static Ttk_StateTable scale_statemap[] =
+{
+ { TUS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { TUS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { TUS_FOCUSED, TTK_STATE_FOCUS, 0 },
+ { TUS_HOT, TTK_STATE_ACTIVE, 0 },
+ { TUS_NORMAL, 0, 0 }
+};
+
+static Ttk_StateTable tabitem_statemap[] =
+{
+ { TIS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { TIS_SELECTED, TTK_STATE_SELECTED, 0 },
+ { TIS_HOT, TTK_STATE_ACTIVE, 0 },
+ { TIS_FOCUSED, TTK_STATE_FOCUS, 0 },
+ { TIS_NORMAL, 0, 0 },
+};
+
+
+/*
+ *----------------------------------------------------------------------
+ * +++ Element data:
+ *
+ * The following structure is passed as the 'clientData' pointer
+ * to most elements in this theme. It contains data relevant
+ * to a single XP Theme "part".
+ *
+ * <<NOTE-GetThemeMargins>>:
+ * In theory, we should be call GetThemeMargins(...TMT_CONTENTRECT...)
+ * to calculate the internal padding. In practice, this routine
+ * only seems to work properly for BP_PUSHBUTTON. So we hardcode
+ * the required padding at element registration time instead.
+ *
+ * The PAD_MARGINS flag bit determines whether the padding
+ * should be added on the inside (0) or outside (1) of the element.
+ *
+ * <<NOTE-GetThemePartSize>>:
+ * This gives bogus metrics for some parts (in particular,
+ * BP_PUSHBUTTONS). Set the IGNORE_THEMESIZE flag to skip this call.
+ */
+
+typedef struct /* XP element specifications */
+{
+ const char *elementName; /* Tk theme engine element name */
+ Ttk_ElementSpec *elementSpec;
+ /* Element spec (usually GenericElementSpec) */
+ LPCWSTR className; /* Windows window class name */
+ int partId; /* BP_PUSHBUTTON, BP_CHECKBUTTON, etc. */
+ Ttk_StateTable *statemap; /* Map Tk states to XP states */
+ Ttk_Padding padding; /* See NOTE-GetThemeMargins */
+ int flags;
+# define IGNORE_THEMESIZE 0x80000000 /* See NOTE-GetThemePartSize */
+# define PAD_MARGINS 0x40000000 /* See NOTE-GetThemeMargins */
+# define HEAP_ELEMENT 0x20000000 /* ElementInfo is on heap */
+# define HALF_HEIGHT 0x10000000 /* Used by GenericSizedElements */
+# define HALF_WIDTH 0x08000000 /* Used by GenericSizedElements */
+} ElementInfo;
+
+typedef struct
+{
+ /*
+ * Static data, initialized when element is registered:
+ */
+ ElementInfo *info;
+ XPThemeProcs *procs; /* Pointer to theme procedure table */
+
+ /*
+ * Dynamic data, allocated by InitElementData:
+ */
+ HTHEME hTheme;
+ HDC hDC;
+ HWND hwnd;
+
+ /* For TkWinDrawableReleaseDC: */
+ Drawable drawable;
+ TkWinDCState dcState;
+} ElementData;
+
+static ElementData *
+NewElementData(XPThemeProcs *procs, ElementInfo *info)
+{
+ ElementData *elementData = (ElementData*)ckalloc(sizeof(ElementData));
+
+ elementData->procs = procs;
+ elementData->info = info;
+ elementData->hTheme = elementData->hDC = 0;
+
+ return elementData;
+}
+
+/*
+ * Destroy elements. If the element was created by the element factory
+ * then the info member is dynamically allocated. Otherwise it was
+ * static data from the C object and only the ElementData needs freeing.
+ */
+static void DestroyElementData(void *clientData)
+{
+ ElementData *elementData = clientData;
+ if (elementData->info->flags & HEAP_ELEMENT) {
+ ckfree((char *)elementData->info->statemap);
+ ckfree((char *)elementData->info->className);
+ ckfree((char *)elementData->info->elementName);
+ ckfree((char *)elementData->info);
+ }
+ ckfree(clientData);
+}
+
+/*
+ * InitElementData --
+ * Looks up theme handle. If Drawable argument is non-NULL,
+ * also initializes DC.
+ *
+ * Returns:
+ * 1 on success, 0 on error.
+ * Caller must later call FreeElementData() so this element
+ * can be reused.
+ */
+
+static int
+InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d)
+{
+ Window win = Tk_WindowId(tkwin);
+
+ if (win != None) {
+ elementData->hwnd = Tk_GetHWND(win);
+ } else {
+ elementData->hwnd = elementData->procs->stubWindow;
+ }
+
+ elementData->hTheme = elementData->procs->OpenThemeData(
+ elementData->hwnd, elementData->info->className);
+
+ if (!elementData->hTheme)
+ return 0;
+
+ elementData->drawable = d;
+ if (d != 0) {
+ elementData->hDC = TkWinGetDrawableDC(Tk_Display(tkwin), d,
+ &elementData->dcState);
+ }
+
+ return 1;
+}
+
+static void
+FreeElementData(ElementData *elementData)
+{
+ elementData->procs->CloseThemeData(elementData->hTheme);
+ if (elementData->drawable != 0) {
+ TkWinReleaseDrawableDC(
+ elementData->drawable, elementData->hDC, &elementData->dcState);
+ }
+}
+
+/*----------------------------------------------------------------------
+ * +++ Generic element implementation.
+ *
+ * Used for elements which are handled entirely by the XP Theme API,
+ * such as radiobutton and checkbutton indicators, scrollbar arrows, etc.
+ */
+
+static void GenericElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ElementData *elementData = clientData;
+ HRESULT result;
+ SIZE size;
+
+ if (!InitElementData(elementData, tkwin, 0))
+ return;
+
+ if (!(elementData->info->flags & IGNORE_THEMESIZE)) {
+ result = elementData->procs->GetThemePartSize(
+ elementData->hTheme,
+ elementData->hDC,
+ elementData->info->partId,
+ Ttk_StateTableLookup(elementData->info->statemap, 0),
+ NULL /*RECT *prc*/,
+ TS_TRUE,
+ &size);
+
+ if (SUCCEEDED(result)) {
+ *widthPtr = size.cx;
+ *heightPtr = size.cy;
+ }
+ }
+
+ /* See NOTE-GetThemeMargins
+ */
+ *paddingPtr = elementData->info->padding;
+ if (elementData->info->flags & PAD_MARGINS) {
+ *widthPtr += Ttk_PaddingWidth(elementData->info->padding);
+ *heightPtr += Ttk_PaddingHeight(elementData->info->padding);
+ }
+}
+
+static void GenericElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ElementData *elementData = clientData;
+ RECT rc;
+
+ if (!InitElementData(elementData, tkwin, d)) {
+ return;
+ }
+
+ if (elementData->info->flags & PAD_MARGINS) {
+ b = Ttk_PadBox(b, elementData->info->padding);
+ }
+ rc = BoxToRect(b);
+
+ elementData->procs->DrawThemeBackground(
+ elementData->hTheme,
+ elementData->hDC,
+ elementData->info->partId,
+ Ttk_StateTableLookup(elementData->info->statemap, state),
+ &rc,
+ NULL/*pContentRect*/);
+
+ FreeElementData(elementData);
+}
+
+static Ttk_ElementSpec GenericElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ GenericElementSize,
+ GenericElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Sized element implementation.
+ *
+ * Used for elements which are handled entirely by the XP Theme API,
+ * but that require a fixed size adjustment.
+ * Note that GetThemeSysSize calls through to GetSystemMetrics
+ */
+
+static void
+GenericSizedElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ElementData *elementData = clientData;
+
+ if (!InitElementData(elementData, tkwin, 0))
+ return;
+
+ GenericElementSize(clientData, elementRecord, tkwin,
+ widthPtr, heightPtr, paddingPtr);
+
+ *widthPtr = elementData->procs->GetThemeSysSize(NULL,
+ (elementData->info->flags >> 8) & 0xff);
+ *heightPtr = elementData->procs->GetThemeSysSize(NULL,
+ elementData->info->flags & 0xff);
+ if (elementData->info->flags & HALF_HEIGHT)
+ *heightPtr /= 2;
+ if (elementData->info->flags & HALF_WIDTH)
+ *widthPtr /= 2;
+}
+
+static Ttk_ElementSpec GenericSizedElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ GenericSizedElementSize,
+ GenericElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Spinbox arrow element.
+ * These are half-height scrollbar buttons.
+ */
+
+static void
+SpinboxArrowElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ElementData *elementData = clientData;
+
+ if (!InitElementData(elementData, tkwin, 0))
+ return;
+
+ GenericSizedElementSize(clientData, elementRecord, tkwin,
+ widthPtr, heightPtr, paddingPtr);
+
+ /* force the arrow button height to half size */
+ *heightPtr /= 2;
+}
+
+static Ttk_ElementSpec SpinboxArrowElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SpinboxArrowElementSize,
+ GenericElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Scrollbar thumb element.
+ * Same as a GenericElement, but don't draw in the disabled state.
+ */
+
+static void ThumbElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ElementData *elementData = clientData;
+ unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
+ RECT rc = BoxToRect(b);
+
+ /*
+ * Don't draw the thumb if we are disabled.
+ */
+ if (state & TTK_STATE_DISABLED)
+ return;
+
+ if (!InitElementData(elementData, tkwin, d))
+ return;
+
+ elementData->procs->DrawThemeBackground(elementData->hTheme,
+ elementData->hDC, elementData->info->partId, stateId,
+ &rc, NULL);
+
+ FreeElementData(elementData);
+}
+
+static Ttk_ElementSpec ThumbElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ GenericElementSize,
+ ThumbElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Progress bar element.
+ * Increases the requested length of PP_CHUNK and PP_CHUNKVERT parts
+ * so that indeterminate progress bars show 3 bars instead of 1.
+ */
+
+static void PbarElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ElementData *elementData = clientData;
+ int nBars = 3;
+
+ GenericElementSize(clientData, elementRecord, tkwin,
+ widthPtr, heightPtr, paddingPtr);
+
+ if (elementData->info->partId == PP_CHUNK) {
+ *widthPtr *= nBars;
+ } else if (elementData->info->partId == PP_CHUNKVERT) {
+ *heightPtr *= nBars;
+ }
+}
+
+static Ttk_ElementSpec PbarElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ PbarElementSize,
+ GenericElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Notebook tab element.
+ * Same as generic element, with additional logic to select
+ * proper iPartID for the leftmost tab.
+ *
+ * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE,
+ * which appears to be identical) should be used if the
+ * tab is exactly at the right edge of the notebook, but
+ * not if it's simply the rightmost tab. This information
+ * is not available.
+ *
+ * The TIS_* and TILES_* definitions are identical, so
+ * we can use the same statemap no matter what the partId.
+ */
+static void TabElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ ElementData *elementData = clientData;
+ int partId = elementData->info->partId;
+ RECT rc = BoxToRect(b);
+
+ if (!InitElementData(elementData, tkwin, d))
+ return;
+ if (state & TTK_STATE_USER1)
+ partId = TABP_TABITEMLEFTEDGE;
+ elementData->procs->DrawThemeBackground(
+ elementData->hTheme, elementData->hDC, partId,
+ Ttk_StateTableLookup(elementData->info->statemap, state), &rc, NULL);
+ FreeElementData(elementData);
+}
+
+static Ttk_ElementSpec TabElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ GenericElementSize,
+ TabElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Tree indicator element.
+ *
+ * Generic element, but don't display at all if TTK_STATE_LEAF (=USER2) set
+ */
+
+#define TTK_STATE_OPEN TTK_STATE_USER1
+#define TTK_STATE_LEAF TTK_STATE_USER2
+
+static Ttk_StateTable header_statemap[] =
+{
+ { HIS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { HIS_HOT, TTK_STATE_ACTIVE, 0 },
+ { HIS_NORMAL, 0,0 },
+};
+
+static Ttk_StateTable treeview_statemap[] =
+{
+ { TREIS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { TREIS_SELECTED, TTK_STATE_SELECTED, 0},
+ { TREIS_HOT, TTK_STATE_ACTIVE, 0 },
+ { TREIS_NORMAL, 0,0 },
+};
+
+static Ttk_StateTable tvpglyph_statemap[] =
+{
+ { GLPS_OPENED, TTK_STATE_OPEN, 0 },
+ { GLPS_CLOSED, 0,0 },
+};
+
+static void TreeIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ if (!(state & TTK_STATE_LEAF)) {
+ GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
+ }
+}
+
+static Ttk_ElementSpec TreeIndicatorElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ GenericElementSize,
+ TreeIndicatorElementDraw
+};
+
+#if BROKEN_TEXT_ELEMENT
+
+/*
+ *----------------------------------------------------------------------
+ * Text element (does not work yet).
+ *
+ * According to "Using Windows XP Visual Styles", we need to select
+ * a font into the DC before calling DrawThemeText().
+ * There's just no easy way to get an HFONT out of a Tk_Font.
+ * Maybe GetThemeFont() would work?
+ *
+ */
+
+typedef struct
+{
+ Tcl_Obj *textObj;
+ Tcl_Obj *fontObj;
+} TextElement;
+
+static Ttk_ElementOptionSpec TextElementOptions[] =
+{
+ { "-text", TK_OPTION_STRING,
+ Tk_Offset(TextElement,textObj), "" },
+ { "-font", TK_OPTION_FONT,
+ Tk_Offset(TextElement,fontObj), DEFAULT_FONT },
+ { NULL }
+};
+
+static void TextElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TextElement *element = elementRecord;
+ ElementData *elementData = clientData;
+ RECT rc = {0, 0};
+ HRESULT hr = S_OK;
+
+ if (!InitElementData(elementData, tkwin, 0))
+ return;
+
+ hr = elementData->procs->GetThemeTextExtent(
+ elementData->hTheme,
+ elementData->hDC,
+ elementData->info->partId,
+ Ttk_StateTableLookup(elementData->info->statemap, 0),
+ Tcl_GetUnicode(element->textObj),
+ -1,
+ DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX,
+ NULL,
+ &rc);
+
+ if (SUCCEEDED(hr)) {
+ *widthPtr = rc.right - rc.left;
+ *heightPtr = rc.bottom - rc.top;
+ }
+ if (*widthPtr < 80) *widthPtr = 80;
+ if (*heightPtr < 20) *heightPtr = 20;
+
+ FreeElementData(elementData);
+}
+
+static void TextElementDraw(
+ ClientData clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ TextElement *element = elementRecord;
+ ElementData *elementData = clientData;
+ RECT rc = BoxToRect(b);
+ HRESULT hr = S_OK;
+
+ if (!InitElementData(elementData, tkwin, d))
+ return;
+
+ hr = elementData->procs->DrawThemeText(
+ elementData->hTheme,
+ elementData->hDC,
+ elementData->info->partId,
+ Ttk_StateTableLookup(elementData->info->statemap, state),
+ Tcl_GetUnicode(element->textObj),
+ -1,
+ DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX,
+ (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0,
+ &rc);
+ FreeElementData(elementData);
+}
+
+static Ttk_ElementSpec TextElementSpec =
+{
+ TK_STYLE_VERSION_2,
+ sizeof(TextElement),
+ TextElementOptions,
+ TextElementSize,
+ TextElementDraw
+};
+
+#endif /* BROKEN_TEXT_ELEMENT */
+
+/*----------------------------------------------------------------------
+ * +++ Widget layouts:
+ */
+
+TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
+
+TTK_LAYOUT("TButton",
+ TTK_GROUP("Button.button", TTK_FILL_BOTH,
+ TTK_GROUP("Button.focus", TTK_FILL_BOTH,
+ TTK_GROUP("Button.padding", TTK_FILL_BOTH,
+ TTK_NODE("Button.label", TTK_FILL_BOTH)))))
+
+TTK_LAYOUT("TMenubutton",
+ TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y)
+ TTK_GROUP("Menubutton.button", TTK_PACK_RIGHT|TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_NODE("Menubutton.label", 0))))
+
+TTK_LAYOUT("Horizontal.TScrollbar",
+ TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X,
+ TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT)
+ TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT)
+ TTK_GROUP("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH|TTK_UNIT,
+ TTK_NODE("Horizontal.Scrollbar.grip", 0))))
+
+TTK_LAYOUT("Vertical.TScrollbar",
+ TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y,
+ TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP)
+ TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM)
+ TTK_GROUP("Vertical.Scrollbar.thumb", TTK_FILL_BOTH|TTK_UNIT,
+ TTK_NODE("Vertical.Scrollbar.grip", 0))))
+
+TTK_LAYOUT("Horizontal.TScale",
+ TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_NODE("Horizontal.Scale.track", TTK_FILL_X)
+ TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) )))
+
+TTK_LAYOUT("Vertical.TScale",
+ TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_NODE("Vertical.Scale.track", TTK_FILL_Y)
+ TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) )))
+
+TTK_END_LAYOUT_TABLE
+
+/*----------------------------------------------------------------------
+ * +++ XP element info table:
+ */
+
+#define PAD(l,t,r,b) {l,t,r,b}
+#define NOPAD {0,0,0,0}
+
+/* name spec className partId statemap padding flags */
+
+static ElementInfo ElementInfoTable[] = {
+ { "Checkbutton.indicator", &GenericElementSpec, L"BUTTON",
+ BP_CHECKBOX, checkbox_statemap, PAD(0, 0, 4, 0), PAD_MARGINS },
+ { "Radiobutton.indicator", &GenericElementSpec, L"BUTTON",
+ BP_RADIOBUTTON, radiobutton_statemap, PAD(0, 0, 4, 0), PAD_MARGINS },
+ { "Button.button", &GenericElementSpec, L"BUTTON",
+ BP_PUSHBUTTON, pushbutton_statemap, PAD(3, 3, 3, 3), IGNORE_THEMESIZE },
+ { "Labelframe.border", &GenericElementSpec, L"BUTTON",
+ BP_GROUPBOX, groupbox_statemap, PAD(2, 2, 2, 2), 0 },
+ { "Entry.field", &GenericElementSpec, L"EDIT", EP_EDITTEXT,
+ edittext_statemap, PAD(1, 1, 1, 1), 0 },
+ { "Combobox.field", &GenericElementSpec, L"EDIT",
+ EP_EDITTEXT, combotext_statemap, PAD(1, 1, 1, 1), 0 },
+ { "Combobox.downarrow", &GenericSizedElementSpec, L"COMBOBOX",
+ CP_DROPDOWNBUTTON, combobox_statemap, NOPAD,
+ (SM_CXVSCROLL << 8) | SM_CYVSCROLL },
+ { "Vertical.Scrollbar.trough", &GenericElementSpec, L"SCROLLBAR",
+ SBP_UPPERTRACKVERT, scrollbar_statemap, NOPAD, 0 },
+ { "Vertical.Scrollbar.thumb", &ThumbElementSpec, L"SCROLLBAR",
+ SBP_THUMBBTNVERT, scrollbar_statemap, NOPAD, 0 },
+ { "Vertical.Scrollbar.grip", &GenericElementSpec, L"SCROLLBAR",
+ SBP_GRIPPERVERT, scrollbar_statemap, NOPAD, 0 },
+ { "Horizontal.Scrollbar.trough", &GenericElementSpec, L"SCROLLBAR",
+ SBP_UPPERTRACKHORZ, scrollbar_statemap, NOPAD, 0 },
+ { "Horizontal.Scrollbar.thumb", &ThumbElementSpec, L"SCROLLBAR",
+ SBP_THUMBBTNHORZ, scrollbar_statemap, NOPAD, 0 },
+ { "Horizontal.Scrollbar.grip", &GenericElementSpec, L"SCROLLBAR",
+ SBP_GRIPPERHORZ, scrollbar_statemap, NOPAD, 0 },
+ { "Scrollbar.uparrow", &GenericSizedElementSpec, L"SCROLLBAR",
+ SBP_ARROWBTN, uparrow_statemap, NOPAD,
+ (SM_CXVSCROLL << 8) | SM_CYVSCROLL },
+ { "Scrollbar.downarrow", &GenericSizedElementSpec, L"SCROLLBAR",
+ SBP_ARROWBTN, downarrow_statemap, NOPAD,
+ (SM_CXVSCROLL << 8) | SM_CYVSCROLL },
+ { "Scrollbar.leftarrow", &GenericSizedElementSpec, L"SCROLLBAR",
+ SBP_ARROWBTN, leftarrow_statemap, NOPAD,
+ (SM_CXHSCROLL << 8) | SM_CYHSCROLL },
+ { "Scrollbar.rightarrow", &GenericSizedElementSpec, L"SCROLLBAR",
+ SBP_ARROWBTN, rightarrow_statemap, NOPAD,
+ (SM_CXHSCROLL << 8) | SM_CYHSCROLL },
+ { "Horizontal.Scale.slider", &GenericElementSpec, L"TRACKBAR",
+ TKP_THUMB, scale_statemap, NOPAD, 0 },
+ { "Vertical.Scale.slider", &GenericElementSpec, L"TRACKBAR",
+ TKP_THUMBVERT, scale_statemap, NOPAD, 0 },
+ { "Horizontal.Scale.track", &GenericElementSpec, L"TRACKBAR",
+ TKP_TRACK, scale_statemap, NOPAD, 0 },
+ { "Vertical.Scale.track", &GenericElementSpec, L"TRACKBAR",
+ TKP_TRACKVERT, scale_statemap, NOPAD, 0 },
+ /* ttk::progressbar elements */
+ { "Horizontal.Progressbar.pbar", &PbarElementSpec, L"PROGRESS",
+ PP_CHUNK, null_statemap, NOPAD, 0 },
+ { "Vertical.Progressbar.pbar", &PbarElementSpec, L"PROGRESS",
+ PP_CHUNKVERT, null_statemap, NOPAD, 0 },
+ { "Horizontal.Progressbar.trough", &GenericElementSpec, L"PROGRESS",
+ PP_BAR, null_statemap, PAD(3,3,3,3), IGNORE_THEMESIZE },
+ { "Vertical.Progressbar.trough", &GenericElementSpec, L"PROGRESS",
+ PP_BARVERT, null_statemap, PAD(3,3,3,3), IGNORE_THEMESIZE },
+ /* ttk::notebook */
+ { "tab", &TabElementSpec, L"TAB",
+ TABP_TABITEM, tabitem_statemap, PAD(3,3,3,0), 0 },
+ { "client", &GenericElementSpec, L"TAB",
+ TABP_PANE, null_statemap, PAD(1,1,3,3), 0 },
+ { "NotebookPane.background", &GenericElementSpec, L"TAB",
+ TABP_BODY, null_statemap, NOPAD, 0 },
+ { "Toolbutton.border", &GenericElementSpec, L"TOOLBAR",
+ TP_BUTTON, toolbutton_statemap, NOPAD,0 },
+ { "Menubutton.button", &GenericElementSpec, L"TOOLBAR",
+ TP_SPLITBUTTON,toolbutton_statemap, NOPAD,0 },
+ { "Menubutton.dropdown", &GenericElementSpec, L"TOOLBAR",
+ TP_SPLITBUTTONDROPDOWN,toolbutton_statemap, NOPAD,0 },
+ { "Treeview.field", &GenericElementSpec, L"TREEVIEW",
+ TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), 0 },
+ { "Treeitem.indicator", &TreeIndicatorElementSpec, L"TREEVIEW",
+ TVP_GLYPH, tvpglyph_statemap, PAD(1,1,6,0), PAD_MARGINS },
+ { "Treeheading.border", &GenericElementSpec, L"HEADER",
+ HP_HEADERITEM, header_statemap, PAD(4,0,4,0),0 },
+ { "sizegrip", &GenericElementSpec, L"STATUS",
+ SP_GRIPPER, null_statemap, NOPAD,0 },
+ { "Spinbox.field", &GenericElementSpec, L"EDIT",
+ EP_EDITTEXT, edittext_statemap, PAD(1, 1, 1, 1), 0 },
+ { "Spinbox.uparrow", &SpinboxArrowElementSpec, L"SPIN",
+ SPNP_UP, spinbutton_statemap, NOPAD,
+ PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
+ { "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
+ SPNP_DOWN, spinbutton_statemap, NOPAD,
+ PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
+
+#if BROKEN_TEXT_ELEMENT
+ { "Labelframe.text", &TextElementSpec, L"BUTTON",
+ BP_GROUPBOX, groupbox_statemap, NOPAD,0 },
+#endif
+
+ { 0,0,0,0,0,NOPAD,0 }
+};
+#undef PAD
+
+
+static int
+GetSysFlagFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr)
+{
+ static const char *names[] = {
+ "SM_CXBORDER", "SM_CYBORDER", "SM_CXVSCROLL", "SM_CYVSCROLL",
+ "SM_CXHSCROLL", "SM_CYHSCROLL", "SM_CXMENUCHECK", "SM_CYMENUCHECK",
+ "SM_CXMENUSIZE", "SM_CYMENUSIZE", "SM_CXSIZE", "SM_CYSIZE", "SM_CXSMSIZE",
+ "SM_CYSMSIZE"
+ };
+ int flags[] = {
+ SM_CXBORDER, SM_CYBORDER, SM_CXVSCROLL, SM_CYVSCROLL,
+ SM_CXHSCROLL, SM_CYHSCROLL, SM_CXMENUCHECK, SM_CYMENUCHECK,
+ SM_CXMENUSIZE, SM_CYMENUSIZE, SM_CXSIZE, SM_CYSIZE, SM_CXSMSIZE,
+ SM_CYSMSIZE
+ };
+
+ Tcl_Obj **objv;
+ int i, objc;
+
+ if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK)
+ return TCL_ERROR;
+ if (objc != 2) {
+ Tcl_SetResult(interp, "wrong # args", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ for (i = 0; i < objc; ++i) {
+ int option;
+ if (Tcl_GetIndexFromObj(interp, objv[i], names, "system constant", 0, &option)
+ != TCL_OK)
+ return TCL_ERROR;
+ *resultPtr |= (flags[option] << (8 * (1 - i)));
+ }
+ return TCL_OK;
+}
+
+/*----------------------------------------------------------------------
+ * Windows Visual Styles API Element Factory
+ *
+ * The Vista release has shown that the Windows Visual Styles can be
+ * extended with additional elements. This element factory can permit
+ * the programmer to create elements for use with script-defined layouts
+ *
+ * eg: to create the small close button:
+ * style element create smallclose vsapi \
+ * WINDOW 19 {disabled 4 pressed 3 active 2 {} 1}
+ */
+
+static int
+Ttk_CreateVsapiElement(
+ Tcl_Interp *interp,
+ void *clientData,
+ Ttk_Theme theme,
+ const char *elementName,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ XPThemeData *themeData = clientData;
+ ElementInfo *elementPtr = NULL;
+ ClientData elementData;
+ Tcl_UniChar *className;
+ int partId = 0;
+ Ttk_StateTable *stateTable;
+ Ttk_Padding pad = {0, 0, 0, 0};
+ int flags = 0;
+ int length = 0;
+ char *name;
+ LPWSTR wname;
+ Ttk_ElementSpec *elementSpec = &GenericElementSpec;
+
+ const char *optionStrings[] =
+ { "-padding","-width","-height","-margins", "-syssize",
+ "-halfheight", "-halfwidth", NULL };
+ enum { O_PADDING, O_WIDTH, O_HEIGHT, O_MARGINS, O_SYSSIZE,
+ O_HALFHEIGHT, O_HALFWIDTH };
+
+ if (objc < 2) {
+ Tcl_AppendResult(interp,
+ "missing required arguments 'class' and/or 'partId'", NULL);
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIntFromObj(interp, objv[1], &partId) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ className = Tcl_GetUnicodeFromObj(objv[0], &length);
+
+ /* flags or padding */
+ if (objc > 3) {
+ int i = 3, option = 0;
+ for (i = 3; i < objc; i += 2) {
+ int tmp = 0;
+ if (i == objc -1) {
+ Tcl_AppendResult(interp, "Missing value for \"",
+ Tcl_GetString(objv[i]), "\".", NULL);
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
+ "option", 0, &option) != TCL_OK)
+ return TCL_ERROR;
+ switch (option) {
+ case O_PADDING:
+ if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case O_MARGINS:
+ if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ flags |= PAD_MARGINS;
+ break;
+ case O_WIDTH:
+ if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ pad.left = pad.right = tmp;
+ flags |= IGNORE_THEMESIZE;
+ break;
+ case O_HEIGHT:
+ if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ pad.top = pad.bottom = tmp;
+ flags |= IGNORE_THEMESIZE;
+ break;
+ case O_SYSSIZE:
+ if (GetSysFlagFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ elementSpec = &GenericSizedElementSpec;
+ flags |= (tmp & 0xFFFF);
+ break;
+ case O_HALFHEIGHT:
+ if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (tmp)
+ flags |= HALF_HEIGHT;
+ break;
+ case O_HALFWIDTH:
+ if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (tmp)
+ flags |= HALF_WIDTH;
+ break;
+ }
+ }
+ }
+
+ /* convert a statemap into a state table */
+ if (objc > 2) {
+ Tcl_Obj **specs;
+ int n,j,count, status = TCL_OK;
+ if (Tcl_ListObjGetElements(interp, objv[2], &count, &specs) != TCL_OK)
+ return TCL_ERROR;
+ /* we over-allocate to ensure there is a terminating entry */
+ stateTable = (Ttk_StateTable *)
+ ckalloc(sizeof(Ttk_StateTable) * (count + 1));
+ memset(stateTable, 0, sizeof(Ttk_StateTable) * (count + 1));
+ for (n = 0, j = 0; status == TCL_OK && n < count; n += 2, ++j) {
+ Ttk_StateSpec spec = {0,0};
+ status = Ttk_GetStateSpecFromObj(interp, specs[n], &spec);
+ if (status == TCL_OK) {
+ stateTable[j].onBits = spec.onbits;
+ stateTable[j].offBits = spec.offbits;
+ status = Tcl_GetIntFromObj(interp, specs[n+1],
+ &stateTable[j].index);
+ }
+ }
+ if (status != TCL_OK) {
+ ckfree((char *)stateTable);
+ return status;
+ }
+ } else {
+ stateTable = (Ttk_StateTable *)ckalloc(sizeof(Ttk_StateTable));
+ memset(stateTable, 0, sizeof(Ttk_StateTable));
+ }
+
+ elementPtr = (ElementInfo *)ckalloc(sizeof(ElementInfo));
+ elementPtr->elementSpec = elementSpec;
+ elementPtr->partId = partId;
+ elementPtr->statemap = stateTable;
+ elementPtr->padding = pad;
+ elementPtr->flags = HEAP_ELEMENT | flags;
+
+ /* set the element name to an allocated copy */
+ name = ckalloc(strlen(elementName) + 1);
+ strcpy(name, elementName);
+ elementPtr->elementName = name;
+
+ /* set the class name to an allocated copy */
+ wname = (LPWSTR) ckalloc(sizeof(WCHAR) * (length + 1));
+ wcscpy(wname, className);
+ elementPtr->className = wname;
+
+ elementData = NewElementData(themeData->procs, elementPtr);
+ Ttk_RegisterElementSpec(
+ theme, elementName, elementPtr->elementSpec, elementData);
+
+ Ttk_RegisterCleanup(interp, elementData, DestroyElementData);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1));
+ return TCL_OK;
+}
+
+/*----------------------------------------------------------------------
+ * +++ Initialization routine:
+ */
+
+MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
+{
+ XPThemeData *themeData;
+ XPThemeProcs *procs;
+ HINSTANCE hlibrary;
+ Ttk_Theme themePtr, parentPtr, vistaPtr;
+ ElementInfo *infoPtr;
+ OSVERSIONINFO os;
+
+ os.dwOSVersionInfoSize = sizeof(os);
+ GetVersionEx(&os);
+
+ procs = LoadXPThemeProcs(&hlibrary);
+ if (!procs)
+ return TCL_ERROR;
+ procs->stubWindow = hwnd;
+
+ /*
+ * Create the new style engine.
+ */
+ parentPtr = Ttk_GetTheme(interp, "winnative");
+ themePtr = Ttk_CreateTheme(interp, "xpnative", parentPtr);
+
+ if (!themePtr)
+ return TCL_ERROR;
+
+ /*
+ * Set theme data and cleanup proc
+ */
+
+ themeData = (XPThemeData *)ckalloc(sizeof(XPThemeData));
+ themeData->procs = procs;
+ themeData->hlibrary = hlibrary;
+
+ Ttk_SetThemeEnabledProc(themePtr, XPThemeEnabled, themeData);
+ Ttk_RegisterCleanup(interp, themeData, XPThemeDeleteProc);
+ Ttk_RegisterElementFactory(interp, "vsapi", Ttk_CreateVsapiElement, themeData);
+
+ /*
+ * Create the vista theme on suitable platform versions and set the theme
+ * enable function. The theme itself is defined in script.
+ */
+
+ if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && os.dwMajorVersion > 5) {
+ vistaPtr = Ttk_CreateTheme(interp, "vista", themePtr);
+ if (vistaPtr) {
+ Ttk_SetThemeEnabledProc(vistaPtr, XPThemeEnabled, themeData);
+ }
+ }
+
+ /*
+ * New elements:
+ */
+ for (infoPtr = ElementInfoTable; infoPtr->elementName != 0; ++infoPtr) {
+ ClientData clientData = NewElementData(procs, infoPtr);
+ Ttk_RegisterElementSpec(
+ themePtr, infoPtr->elementName, infoPtr->elementSpec, clientData);
+ Ttk_RegisterCleanup(interp, clientData, DestroyElementData);
+ }
+
+ Ttk_RegisterElementSpec(themePtr, "Scale.trough", &ttkNullElementSpec, 0);
+
+ /*
+ * Layouts:
+ */
+ Ttk_RegisterLayouts(themePtr, LayoutTable);
+
+ Tcl_PkgProvide(interp, "ttk::theme::xpnative", TTK_VERSION);
+
+ return TCL_OK;
+}
+
+#endif /* HAVE_UXTHEME_H */
diff --git a/win/winMain.c b/win/winMain.c
index b4e11f7..2883ad7 100644
--- a/win/winMain.c
+++ b/win/winMain.c
@@ -1,4 +1,4 @@
-/*
+/*
* winMain.c --
*
* Main entry point for wish and other Tk-based applications.
@@ -6,60 +6,63 @@
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <tk.h>
+#include "tkInt.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
-#include <malloc.h>
#include <locale.h>
-#include "tkInt.h"
/*
- * The following declarations refer to internal Tk routines. These
- * interfaces are available for use, but are not supported.
+ * The following declarations refer to internal Tk routines. These interfaces
+ * are available for use, but are not supported.
*/
+#ifdef TK_TEST
+extern Tcl_PackageInitProc Tktest_Init;
+#endif /* TK_TEST */
+#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES
+extern Tcl_PackageInitProc Registry_Init;
+extern Tcl_PackageInitProc Dde_Init;
+extern Tcl_PackageInitProc Dde_SafeInit;
+#endif
/*
* Forward declarations for procedures defined later in this file:
*/
-static void setargv _ANSI_ARGS_((int *argcPtr, char ***argvPtr));
-static Tcl_PanicProc WishPanic;
+static void WishPanic(CONST char *format, ...);
-#ifdef TK_TEST
-extern int Tktest_Init(Tcl_Interp *interp);
-#endif /* TK_TEST */
+#if defined(__CYGWIN__)
+static void setargv(int *argcPtr, char ***argvPtr);
+#endif /* __CYGWIN__ */
static BOOL consoleRequired = TRUE;
/*
- * The following #if block allows you to change the AppInit
- * function by using a #define of TCL_LOCAL_APPINIT instead
- * of rewriting this entire file. The #if checks for that
- * #define and uses Tcl_AppInit if it doesn't exist.
+ * The following #if block allows you to change the AppInit function by using
+ * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The
+ * #if checks for that #define and uses Tcl_AppInit if it doesn't exist.
*/
-
+
#ifndef TK_LOCAL_APPINIT
-#define TK_LOCAL_APPINIT Tcl_AppInit
+#define TK_LOCAL_APPINIT Tcl_AppInit
#endif
-extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
-
+extern int TK_LOCAL_APPINIT(Tcl_Interp *interp);
+
/*
* The following #if block allows you to change how Tcl finds the startup
- * script, prime the library or encoding paths, fiddle with the argv,
- * etc., without needing to rewrite Tk_Main()
+ * script, prime the library or encoding paths, fiddle with the argv, etc.,
+ * without needing to rewrite Tk_Main()
*/
#ifdef TK_LOCAL_MAIN_HOOK
-extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
+extern int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv);
#endif
-
/*
*----------------------------------------------------------------------
@@ -69,8 +72,7 @@ extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
* Main entry point from Windows.
*
* Results:
- * Returns false if initialization fails, otherwise it never
- * returns.
+ * Returns false if initialization fails, otherwise it never returns.
*
* Side effects:
* Just about anything, since from here we call arbitrary Tcl code.
@@ -79,43 +81,49 @@ extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
*/
int APIENTRY
-WinMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
- HINSTANCE hInstance;
- HINSTANCE hPrevInstance;
- LPSTR lpszCmdLine;
- int nCmdShow;
+WinMain(
+ HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPSTR lpszCmdLine,
+ int nCmdShow)
{
char **argv;
int argc;
- char buffer[MAX_PATH+1];
char *p;
Tcl_SetPanicProc(WishPanic);
/*
- * Create the console channels and install them as the standard
- * channels. All I/O will be discarded until Tk_CreateConsoleWindow is
- * called to attach the console to a text widget.
+ * Create the console channels and install them as the standard channels.
+ * All I/O will be discarded until Tk_CreateConsoleWindow is called to
+ * attach the console to a text widget.
*/
consoleRequired = TRUE;
/*
- * Set up the default locale to be standard "C" locale so parsing
- * is performed correctly.
+ * Set up the default locale to be standard "C" locale so parsing is
+ * performed correctly.
*/
setlocale(LC_ALL, "C");
+
+ /*
+ * Get our args from the c-runtime. Ignore lpszCmdLine.
+ */
+
+#if defined(__CYGWIN__)
setargv(&argc, &argv);
+#else
+ argc = __argc;
+ argv = __argv;
+#endif
/*
- * Replace argv[0] with full pathname of executable, and forward
- * slashes substituted for backslashes.
+ * Forward slashes substituted for backslashes.
*/
- GetModuleFileName(NULL, buffer, sizeof(buffer));
- argv[0] = buffer;
- for (p = buffer; *p != '\0'; p++) {
+ for (p = argv[0]; *p != '\0'; p++) {
if (*p == '\\') {
*p = '/';
}
@@ -128,20 +136,19 @@ WinMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
Tk_Main(argc, argv, TK_LOCAL_APPINIT);
return 1;
}
-
/*
*----------------------------------------------------------------------
*
* Tcl_AppInit --
*
- * This procedure performs application-specific initialization.
- * Most applications, especially those that incorporate additional
- * packages, will have their own version of this procedure.
+ * This procedure performs application-specific initialization. Most
+ * applications, especially those that incorporate additional packages,
+ * will have their own version of this procedure.
*
* Results:
- * Returns a standard Tcl completion code, and leaves an error
- * message in the interp's result if an error occurs.
+ * Returns a standard Tcl completion code, and leaves an error message in
+ * the interp's result if an error occurs.
*
* Side effects:
* Depends on the startup script.
@@ -150,9 +157,12 @@ WinMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
*/
int
-Tcl_AppInit(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
+Tcl_AppInit(
+ Tcl_Interp *interp) /* Interpreter for application. */
{
+#define TK_MAX_WARN_LEN 1024
+ WCHAR msgString[TK_MAX_WARN_LEN + 5];
+
if (Tcl_Init(interp) == TCL_ERROR) {
goto error;
}
@@ -171,40 +181,69 @@ Tcl_AppInit(interp)
goto error;
}
}
-#if defined(STATIC_BUILD) && defined(TCL_USE_STATIC_PACKAGES)
- {
- extern Tcl_PackageInitProc Registry_Init;
- extern Tcl_PackageInitProc Dde_Init;
-
- if (Registry_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- Tcl_StaticPackage(interp, "registry", Registry_Init, NULL);
+#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES
+ if (Registry_Init(interp) == TCL_ERROR) {
+ goto error;
+ }
+ Tcl_StaticPackage(interp, "registry", Registry_Init, NULL);
- if (Dde_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- Tcl_StaticPackage(interp, "dde", Dde_Init, NULL);
- }
+ if (Dde_Init(interp) == TCL_ERROR) {
+ goto error;
+ }
+ Tcl_StaticPackage(interp, "dde", Dde_Init, NULL);
#endif
#ifdef TK_TEST
if (Tktest_Init(interp) == TCL_ERROR) {
goto error;
}
- Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
- (Tcl_PackageInitProc *) NULL);
+ Tcl_StaticPackage(interp, "Tktest", Tktest_Init, NULL);
#endif /* TK_TEST */
+ /*
+ * Call the init procedures for included packages. Each call should look
+ * like this:
+ *
+ * if (Mod_Init(interp) == TCL_ERROR) {
+ * return TCL_ERROR;
+ * }
+ *
+ * where "Mod" is the name of the module. (Dynamically-loadable packages
+ * should have the same entry-point name.)
+ */
+
+ /*
+ * Call Tcl_CreateCommand for application-specific commands, if they
+ * weren't already created by the init procedures called above.
+ */
+
+ /*
+ * Specify a user-specific startup file to invoke if the application is
+ * run interactively. Typically the startup file is "~/.apprc" where "app"
+ * is the name of the application. If this line is deleted then no user-
+ * specific startup file will be run under any conditions.
+ */
+
Tcl_SetVar(interp, "tcl_rcFileName", "~/wishrc.tcl", TCL_GLOBAL_ONLY);
return TCL_OK;
error:
+ MultiByteToWideChar(CP_UTF8, 0, Tcl_GetStringResult(interp), -1,
+ msgString, TK_MAX_WARN_LEN);
+ /*
+ * Truncate MessageBox string if it is too long to not overflow the screen
+ * and cause possible oversized window error.
+ */
+ memcpy(msgString + TK_MAX_WARN_LEN, L" ...", 5 * sizeof(WCHAR));
MessageBeep(MB_ICONEXCLAMATION);
- MessageBox(NULL, Tcl_GetStringResult(interp), "Error in Wish",
+ MessageBoxW(NULL, msgString, L"Error in Wish",
MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND);
ExitProcess(1);
- /* we won't reach this, but we need the return */
+
+ /*
+ * We won't reach this, but we need the return.
+ */
+
return TCL_ERROR;
}
@@ -225,32 +264,85 @@ error:
*/
void
-WishPanic TCL_VARARGS_DEF(CONST char *,arg1)
+WishPanic(
+ CONST char *format, ...)
{
va_list argList;
- char buf[1024];
- CONST char *format;
-
- format = TCL_VARARGS_START(CONST char *,arg1,argList);
+ char buf[TK_MAX_WARN_LEN];
+ WCHAR msgString[TK_MAX_WARN_LEN + 5];
+
+ va_start(argList, format);
vsprintf(buf, format, argList);
+ MultiByteToWideChar(CP_UTF8, 0, buf, -1, msgString, TK_MAX_WARN_LEN);
+ /*
+ * Truncate MessageBox string if it is too long to not overflow the screen
+ * and cause possible oversized window error.
+ */
+ memcpy(msgString + TK_MAX_WARN_LEN, L" ...", 5 * sizeof(WCHAR));
MessageBeep(MB_ICONEXCLAMATION);
- MessageBox(NULL, buf, "Fatal Error in Wish",
+ MessageBoxW(NULL, msgString, L"Fatal Error in Wish",
MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND);
#ifdef _MSC_VER
DebugBreak();
#endif
ExitProcess(1);
}
+
+#if !defined(__GNUC__) || defined(TK_TEST)
+/*
+ *----------------------------------------------------------------------
+ *
+ * main --
+ *
+ * Main entry point from the console.
+ *
+ * Results:
+ * None: Tk_Main never returns here, so this procedure never returns
+ * either.
+ *
+ * Side effects:
+ * Whatever the applications does.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+main(
+ int argc,
+ char **argv)
+{
+ Tcl_SetPanicProc(WishPanic);
+
+ /*
+ * Set up the default locale to be standard "C" locale so parsing is
+ * performed correctly.
+ */
+
+ setlocale(LC_ALL, "C");
+
+ /*
+ * Console emulation widget not required as this entry is from the
+ * console subsystem, thus stdin,out,err already have end-points.
+ */
+
+ consoleRequired = FALSE;
+
+ Tk_Main(argc, argv, Tcl_AppInit);
+ return 0;
+}
+#endif /* !__GNUC__ || TK_TEST */
+
+
/*
*-------------------------------------------------------------------------
*
* setargv --
*
- * Parse the Windows command line string into argc/argv. Done here
- * because we don't trust the builtin argument parser in crt0.
- * Windows applications are responsible for breaking their command
- * line into arguments.
+ * Parse the Windows command line string into argc/argv. Done here
+ * because we don't trust the builtin argument parser in crt0. Windows
+ * applications are responsible for breaking their command line into
+ * arguments.
*
* 2N backslashes + quote -> N backslashes + begin quoted string
* 2N + 1 backslashes + quote -> literal
@@ -260,8 +352,8 @@ WishPanic TCL_VARARGS_DEF(CONST char *,arg1)
* quote -> begin quoted string
*
* Results:
- * Fills argcPtr with the number of arguments and argvPtr with the
- * array of arguments.
+ * Fills argcPtr with the number of arguments and argvPtr with the array
+ * of arguments.
*
* Side effects:
* Memory allocated.
@@ -269,20 +361,21 @@ WishPanic TCL_VARARGS_DEF(CONST char *,arg1)
*--------------------------------------------------------------------------
*/
+#if defined(__CYGWIN__)
static void
-setargv(argcPtr, argvPtr)
- int *argcPtr; /* Filled with number of argument strings. */
- char ***argvPtr; /* Filled with argument strings (malloc'd). */
+setargv(
+ int *argcPtr, /* Filled with number of argument strings. */
+ char ***argvPtr) /* Filled with argument strings (malloc'd). */
{
char *cmdLine, *p, *arg, *argSpace;
char **argv;
int argc, size, inquote, copy, slashes;
-
+
cmdLine = GetCommandLine(); /* INTL: BUG */
/*
- * Precompute an overly pessimistic guess at the number of arguments
- * in the command line by counting non-space spans.
+ * Precompute an overly pessimistic guess at the number of arguments in
+ * the command line by counting non-space spans.
*/
size = 2;
@@ -297,7 +390,7 @@ setargv(argcPtr, argvPtr)
}
}
}
- argSpace = (char *) Tcl_Alloc(
+ argSpace = (char *) ckalloc(
(unsigned) (size * sizeof(char *) + strlen(cmdLine) + 1));
argv = (char **) argSpace;
argSpace += size * sizeof(char *);
@@ -330,18 +423,18 @@ setargv(argcPtr, argvPtr)
} else {
inquote = !inquote;
}
- }
- slashes >>= 1;
- }
+ }
+ slashes >>= 1;
+ }
- while (slashes) {
+ while (slashes) {
*arg = '\\';
arg++;
slashes--;
}
- if ((*p == '\0')
- || (!inquote && ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */
+ if ((*p == '\0') || (!inquote &&
+ ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */
break;
}
if (copy != 0) {
@@ -349,7 +442,7 @@ setargv(argcPtr, argvPtr)
arg++;
}
p++;
- }
+ }
*arg = '\0';
argSpace = arg + 1;
}
@@ -358,45 +451,12 @@ setargv(argcPtr, argvPtr)
*argcPtr = argc;
*argvPtr = argv;
}
-
-#if !defined(__GNUC__) || defined(TK_TEST)
+#endif /* __CYGWIN__ */
+
/*
- *----------------------------------------------------------------------
- *
- * main --
- *
- * Main entry point from the console.
- *
- * Results:
- * None: Tk_Main never returns here, so this procedure never
- * returns either.
- *
- * Side effects:
- * Whatever the applications does.
- *
- *----------------------------------------------------------------------
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
*/
-
-int main(int argc, char **argv)
-{
- Tcl_SetPanicProc(WishPanic);
-
- /*
- * Set up the default locale to be standard "C" locale so parsing
- * is performed correctly.
- */
-
- setlocale(LC_ALL, "C");
-
- /*
- * Create the console channels and install them as the standard
- * channels. All I/O will be discarded until Tk_CreateConsoleWindow is
- * called to attach the console to a text widget.
- */
-
- consoleRequired = FALSE;
-
- Tk_Main(argc, argv, Tcl_AppInit);
- return 0;
-}
-#endif /* !__GNUC__ || TK_TEST */
diff --git a/win/wish.exe.manifest.in b/win/wish.exe.manifest.in
index 236768e..2cae0c0 100644
--- a/win/wish.exe.manifest.in
+++ b/win/wish.exe.manifest.in
@@ -1,22 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-<assemblyIdentity
- version="@TK_WIN_VERSION@"
- processorArchitecture="@MACHINE@"
- name="Tcl.Tk.wish"
- type="win32"
-/>
-<description>Tcl/Tk windowing shell (wish)</description>
-<dependency>
-<dependentAssembly>
-<assemblyIdentity
- type="win32"
- name="Microsoft.Windows.Common-Controls"
- version="6.0.0.0"
- processorArchitecture="@MACHINE@"
- publicKeyToken="6595b64144ccf1df"
- language="*"
-/>
-</dependentAssembly>
-</dependency>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"
+ xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
+ <assemblyIdentity
+ version="@TK_WIN_VERSION@"
+ processorArchitecture="@MACHINE@"
+ name="Tcl.Tk.wish"
+ type="win32"
+ />
+ <description>Tcl/Tk windowing shell (wish)</description>
+ <asmv3:application>
+ <asmv3:windowsSettings
+ xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
+ <dpiAware>true</dpiAware>
+ </asmv3:windowsSettings>
+ </asmv3:application>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="@MACHINE@"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+ </dependency>
</assembly>
diff --git a/xlib/X11/X.h b/xlib/X11/X.h
index 7755cac..bdc4f13 100644
--- a/xlib/X11/X.h
+++ b/xlib/X11/X.h
@@ -33,7 +33,7 @@ SOFTWARE.
#define X_PROTOCOL 11 /* current protocol version */
#define X_PROTOCOL_REVISION 0 /* current minor version */
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
# define Cursor XCursor
# define Region XRegion
#endif
@@ -669,7 +669,7 @@ are reserved in the protocol for errors and replies. */
#define LSBFirst 0
#define MSBFirst 1
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
# undef Cursor
# undef Region
#endif
diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h
index 252b11d..3af3682 100644
--- a/xlib/X11/Xlib.h
+++ b/xlib/X11/Xlib.h
@@ -27,14 +27,9 @@
#define XlibSpecificationRelease 5
-#if !defined(MAC_TCL) && !defined(MAC_OSX_TK)
+#if !defined(MAC_OSX_TK)
# include <X11/X.h>
#endif
-#ifdef MAC_TCL
-# include <X.h>
-# define Cursor XCursor
-# define Region XRegion
-#endif
#ifdef MAC_OSX_TK
# include <X11/X.h>
# define Cursor XCursor
@@ -42,11 +37,7 @@
#endif
/* applications should not depend on these two headers being included! */
-#ifdef MAC_TCL
-#include <Xfuncproto.h>
-#else
#include <X11/Xfuncproto.h>
-#endif
#ifndef X_WCHAR
#ifdef X_NOT_STDC_ENV
@@ -64,7 +55,7 @@ typedef unsigned long wchar_t;
typedef char *XPointer;
#define Bool int
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
/* Use define rather than typedef, since may need to undefine this later */
#define Status int
#else
@@ -1206,7 +1197,7 @@ _XFUNCPROTOBEGIN
_XFUNCPROTOEND
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
# undef Cursor
# undef Region
#endif
diff --git a/xlib/X11/Xutil.h b/xlib/X11/Xutil.h
index 8534768..7348e90 100644
--- a/xlib/X11/Xutil.h
+++ b/xlib/X11/Xutil.h
@@ -29,7 +29,7 @@ SOFTWARE.
/* You must include <X11/Xlib.h> before including this file */
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
# define Region XRegion
#endif
@@ -848,7 +848,7 @@ extern void XXorRegion(
_XFUNCPROTOEND
-#if defined(MAC_TCL) || defined(MAC_OSX_TK)
+#if defined(MAC_OSX_TK)
# undef Region
#endif
diff --git a/xlib/X11/keysym.h b/xlib/X11/keysym.h
index 027afe0..a8f1408 100644
--- a/xlib/X11/keysym.h
+++ b/xlib/X11/keysym.h
@@ -32,8 +32,4 @@ SOFTWARE.
#define XK_LATIN4
#define XK_GREEK
-#ifdef MAC_TCL
-#include <keysymdef.h>
-#else
#include <X11/keysymdef.h>
-#endif
diff --git a/xlib/xbytes.h b/xlib/xbytes.h
index 611e246..13e2faa 100644
--- a/xlib/xbytes.h
+++ b/xlib/xbytes.h
@@ -5,17 +5,16 @@
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _XBYTES
#define _XBYTES
/*
- * The bits in a byte can be reversed so the least significant becomes
- * the most significant by indexing xBitReverseTable with the byte
- * to be reversed.
+ * The bits in a byte can be reversed so the least significant becomes the
+ * most significant by indexing xBitReverseTable with the byte to be reversed.
*/
static unsigned char xBitReverseTable[256] = {
@@ -54,3 +53,11 @@ static unsigned char xBitReverseTable[256] = {
};
#endif /* _XBYTES */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/xlib/xcolors.c b/xlib/xcolors.c
index 32c53bd..ad33b7b 100644
--- a/xlib/xcolors.c
+++ b/xlib/xcolors.c
@@ -1,28 +1,39 @@
-/*
+/*
* xcolors.c --
*
- * This file contains the routines used to map from X color
- * names to RGB and pixel values.
+ * This file contains the routines used to map from X color names to RGB
+ * and pixel values.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <tkInt.h>
/*
+ * This value will be set to the number of colors in the color table
+ * the first time it is needed.
+ */
+
+static int numXColors = 0;
+
+/*
+ * Forward declarations for functions used only in this file.
+ */
+
+static int FindColor(const char *name, XColor *colorPtr);
+
+/*
* Define an array that defines the mapping from color names to RGB values.
- * Note that this array must be kept sorted alphabetically so that the
- * binary search used in XParseColor will succeed.
+ * Note that this array must be kept sorted alphabetically so that the binary
+ * search used in XParseColor will succeed.
*/
typedef struct {
char *name;
- unsigned char red;
- unsigned char green;
- unsigned char blue;
+ unsigned char red, green, blue;
} XColorEntry;
static XColorEntry xColors[] = {
@@ -780,32 +791,18 @@ static XColorEntry xColors[] = {
{ "YellowGreen", 154, 205, 50 },
{ NULL, 0, 0, 0 }
};
-
-
-/*
- * This value will be set to the number of colors in the color table
- * the first time it is needed.
- */
-
-static int numXColors = 0;
-
-/*
- * Forward declarations for functions used only in this file.
- */
-
-static int FindColor _ANSI_ARGS_((const char *name, XColor *colorPtr));
/*
*----------------------------------------------------------------------
*
* FindColor --
*
- * This routine finds the color entry that corresponds to the
- * specified color.
+ * This routine finds the color entry that corresponds to the specified
+ * color.
*
* Results:
- * Returns non-zero on success. The RGB values of the XColor
- * will be initialized to the proper values on success.
+ * Returns non-zero on success. The RGB values of the XColor will be
+ * initialized to the proper values on success.
*
* Side effects:
* None.
@@ -814,15 +811,15 @@ static int FindColor _ANSI_ARGS_((const char *name, XColor *colorPtr));
*/
static int
-FindColor(name, colorPtr)
- const char *name;
- XColor *colorPtr;
+FindColor(
+ const char *name,
+ XColor *colorPtr)
{
int l, u, r, i = 0;
/*
- * Count the number of elements in the color array if we haven't
- * done so yet.
+ * Count the number of elements in the color array if we haven't done so
+ * yet.
*/
if (numXColors == 0) {
@@ -875,11 +872,11 @@ FindColor(name, colorPtr)
*/
Status
-XParseColor(display, map, spec, colorPtr)
- Display *display;
- Colormap map;
- const char* spec;
- XColor *colorPtr;
+XParseColor(
+ Display *display,
+ Colormap map,
+ const char *spec,
+ XColor *colorPtr)
{
if (spec[0] == '#') {
char fmt[16];
@@ -895,11 +892,11 @@ XParseColor(display, map, spec, colorPtr)
return 0;
}
colorPtr->red = (((unsigned short) red) << (4 * (4 - i)))
- | ((unsigned short) red);
+ | ((unsigned short) red);
colorPtr->green = (((unsigned short) green) << (4 * (4 - i)))
- | ((unsigned short) green);
+ | ((unsigned short) green);
colorPtr->blue = (((unsigned short) blue) << (4 * (4 - i)))
- | ((unsigned short) blue);
+ | ((unsigned short) blue);
} else {
if (!FindColor(spec, colorPtr)) {
return 0;
@@ -910,3 +907,11 @@ XParseColor(display, map, spec, colorPtr)
colorPtr->pad = 0;
return 1;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/xlib/xdraw.c b/xlib/xdraw.c
index 281a7e8..f8f035c 100644
--- a/xlib/xdraw.c
+++ b/xlib/xdraw.c
@@ -1,13 +1,12 @@
-/*
+/*
* xdraw.c --
*
- * This file contains generic procedures related to X drawing
- * primitives.
+ * This file contains generic procedures related to X drawing primitives.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tk.h"
@@ -17,7 +16,7 @@
*
* XDrawLine --
*
- * Draw a single line between two points in a given drawable.
+ * Draw a single line between two points in a given drawable.
*
* Results:
* None.
@@ -29,11 +28,12 @@
*/
void
-XDrawLine(display, d, gc, x1, y1, x2, y2)
- Display* display;
- Drawable d;
- GC gc;
- int x1, y1, x2, y2; /* Coordinates of line segment. */
+XDrawLine(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x1, int y1,
+ int x2, int y2) /* Coordinates of line segment. */
{
XPoint points[2];
@@ -49,8 +49,8 @@ XDrawLine(display, d, gc, x1, y1, x2, y2)
*
* XFillRectangle --
*
- * Fills a rectangular area in the given drawable. This procedure
- * is implemented as a call to XFillRectangles.
+ * Fills a rectangular area in the given drawable. This procedure is
+ * implemented as a call to XFillRectangles.
*
* Results:
* None
@@ -62,14 +62,14 @@ XDrawLine(display, d, gc, x1, y1, x2, y2)
*/
void
-XFillRectangle(display, d, gc, x, y, width, height)
- Display* display;
- Drawable d;
- GC gc;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
+XFillRectangle(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
{
XRectangle rectangle;
rectangle.x = x;
@@ -78,3 +78,11 @@ XFillRectangle(display, d, gc, x, y, width, height)
rectangle.height = height;
XFillRectangles(display, d, gc, &rectangle, 1);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 76828b1..9fa8c4a 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -1,33 +1,27 @@
-/*
+/*
* xgc.c --
*
* This file contains generic routines for manipulating X graphics
- * contexts.
+ * contexts.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
* Copyright (c) 2002-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <tkInt.h>
-#if !defined(MAC_TCL) && !defined(MAC_OSX_TK)
-# include <X11/Xlib.h>
-#endif
-#ifdef MAC_TCL
-# include <Xlib.h>
-# include <X.h>
-# define Cursor XCursor
-# define Region XRegion
+#if !defined(MAC_OSX_TK)
+# include <X11/Xlib.h>
#endif
#ifdef MAC_OSX_TK
-# include <tkMacOSXInt.h>
-# include <X11/Xlib.h>
-# include <X11/X.h>
-# define Cursor XCursor
-# define Region XRegion
+# include <tkMacOSXInt.h>
+# include <X11/Xlib.h>
+# include <X11/X.h>
+# define Cursor XCursor
+# define Region XRegion
#endif
@@ -97,7 +91,7 @@ static void FreeClipMask(GC gc) {
* Allocate a new GC, and initialize the specified fields.
*
* Results:
- * Returns a newly allocated GC.
+ * Returns a newly allocated GC.
*
* Side effects:
* None.
@@ -106,52 +100,56 @@ static void FreeClipMask(GC gc) {
*/
GC
-XCreateGC(display, d, mask, values)
- Display* display;
- Drawable d;
- unsigned long mask;
- XGCValues* values;
+XCreateGC(
+ Display *display,
+ Drawable d,
+ unsigned long mask,
+ XGCValues *values)
{
GC gp;
-/*
- * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars are
- * defined, which is invisible from the outside. The list is assumed to end
- * with a 0-char, so this must be set explicitely during initialization.
- */
+ /*
+ * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars
+ * are defined, which is invisible from the outside. The list is assumed
+ * to end with a 0-char, so this must be set explicitely during
+ * initialization.
+ */
#define MAX_DASH_LIST_SIZE 10
- gp = (XGCValues *)ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE);
+ gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE);
if (!gp) {
return None;
}
- gp->function = (mask & GCFunction) ?values->function :GXcopy;
- gp->plane_mask = (mask & GCPlaneMask) ?values->plane_mask :~0;
- gp->foreground = (mask & GCForeground) ?values->foreground :
- BlackPixelOfScreen(DefaultScreenOfDisplay(display));
- gp->background = (mask & GCBackground) ?values->background :
- WhitePixelOfScreen(DefaultScreenOfDisplay(display));
- gp->line_width = (mask & GCLineWidth) ?values->line_width :1;
- gp->line_style = (mask & GCLineStyle) ?values->line_style :LineSolid;
- gp->cap_style = (mask & GCCapStyle) ?values->cap_style :0;
- gp->join_style = (mask & GCJoinStyle) ?values->join_style :0;
- gp->fill_style = (mask & GCFillStyle) ?values->fill_style :FillSolid;
- gp->fill_rule = (mask & GCFillRule) ?values->fill_rule :WindingRule;
- gp->arc_mode = (mask & GCArcMode) ?values->arc_mode :ArcPieSlice;
- gp->tile = (mask & GCTile) ?values->tile :None;
- gp->stipple = (mask & GCStipple) ?values->stipple :None;
- gp->ts_x_origin = (mask & GCTileStipXOrigin) ?values->ts_x_origin:0;
- gp->ts_y_origin = (mask & GCTileStipYOrigin) ?values->ts_y_origin:0;
- gp->font = (mask & GCFont) ?values->font :None;
- gp->subwindow_mode = (mask & GCSubwindowMode)?values->subwindow_mode:ClipByChildren;
- gp->graphics_exposures = (mask & GCGraphicsExposures)?values->graphics_exposures:True;
- gp->clip_x_origin = (mask & GCClipXOrigin) ?values->clip_x_origin :0;
- gp->clip_y_origin = (mask & GCClipYOrigin) ?values->clip_y_origin :0;
- gp->dash_offset = (mask & GCDashOffset) ?values->dash_offset :0;
- gp->dashes = (mask & GCDashList) ?values->dashes :4;
- (&(gp->dashes))[1] = 0;
+#define InitField(name,maskbit,default) \
+ (gp->name = (mask & (maskbit)) ? values->name : (default))
+
+ InitField(function, GCFunction, GXcopy);
+ InitField(plane_mask, GCPlaneMask, (unsigned long)(~0));
+ InitField(foreground, GCForeground,
+ BlackPixelOfScreen(DefaultScreenOfDisplay(display)));
+ InitField(background, GCBackground,
+ WhitePixelOfScreen(DefaultScreenOfDisplay(display)));
+ InitField(line_width, GCLineWidth, 1);
+ InitField(line_style, GCLineStyle, LineSolid);
+ InitField(cap_style, GCCapStyle, 0);
+ InitField(join_style, GCJoinStyle, 0);
+ InitField(fill_style, GCFillStyle, FillSolid);
+ InitField(fill_rule, GCFillRule, WindingRule);
+ InitField(arc_mode, GCArcMode, ArcPieSlice);
+ InitField(tile, GCTile, None);
+ InitField(stipple, GCStipple, None);
+ InitField(ts_x_origin, GCTileStipXOrigin, 0);
+ InitField(ts_y_origin, GCTileStipYOrigin, 0);
+ InitField(font, GCFont, None);
+ InitField(subwindow_mode, GCSubwindowMode, ClipByChildren);
+ InitField(graphics_exposures, GCGraphicsExposures, True);
+ InitField(clip_x_origin, GCClipXOrigin, 0);
+ InitField(clip_y_origin, GCClipYOrigin, 0);
+ InitField(dash_offset, GCDashOffset, 0);
+ InitField(dashes, GCDashList, 4);
+ (&(gp->dashes))[1] = 0;
gp->clip_mask = None;
if (mask & GCClipMask) {
@@ -169,8 +167,7 @@ XCreateGC(display, d, mask, values)
*
* XChangeGC --
*
- * Changes the GC components specified by valuemask for the
- * specified GC.
+ * Changes the GC components specified by valuemask for the specified GC.
*
* Results:
* None.
@@ -182,35 +179,43 @@ XCreateGC(display, d, mask, values)
*/
void
-XChangeGC(d, gc, mask, values)
- Display * d;
- GC gc;
- unsigned long mask;
- XGCValues *values;
-{
- if (mask & GCFunction) { gc->function = values->function; }
- if (mask & GCPlaneMask) { gc->plane_mask = values->plane_mask; }
- if (mask & GCForeground) { gc->foreground = values->foreground; }
- if (mask & GCBackground) { gc->background = values->background; }
- if (mask & GCLineWidth) { gc->line_width = values->line_width; }
- if (mask & GCLineStyle) { gc->line_style = values->line_style; }
- if (mask & GCCapStyle) { gc->cap_style = values->cap_style; }
- if (mask & GCJoinStyle) { gc->join_style = values->join_style; }
- if (mask & GCFillStyle) { gc->fill_style = values->fill_style; }
- if (mask & GCFillRule) { gc->fill_rule = values->fill_rule; }
- if (mask & GCArcMode) { gc->arc_mode = values->arc_mode; }
- if (mask & GCTile) { gc->tile = values->tile; }
- if (mask & GCStipple) { gc->stipple = values->stipple; }
- if (mask & GCTileStipXOrigin) { gc->ts_x_origin = values->ts_x_origin; }
- if (mask & GCTileStipYOrigin) { gc->ts_y_origin = values->ts_y_origin; }
- if (mask & GCFont) { gc->font = values->font; }
- if (mask & GCSubwindowMode) { gc->subwindow_mode = values->subwindow_mode; }
- if (mask & GCGraphicsExposures) { gc->graphics_exposures = values->graphics_exposures; }
- if (mask & GCClipXOrigin) { gc->clip_x_origin = values->clip_x_origin; }
- if (mask & GCClipYOrigin) { gc->clip_y_origin = values->clip_y_origin; }
- if (mask & GCClipMask) { XSetClipMask(d, gc, values->clip_mask); }
- if (mask & GCDashOffset) { gc->dash_offset = values->dash_offset; }
- if (mask & GCDashList) { gc->dashes = values->dashes; (&(gc->dashes))[1] = 0;}
+XChangeGC(
+ Display *d,
+ GC gc,
+ unsigned long mask,
+ XGCValues *values)
+{
+#define ModifyField(name,maskbit) \
+ if (mask & (maskbit)) { gc->name = values->name; }
+
+ ModifyField(function, GCFunction);
+ ModifyField(plane_mask, GCPlaneMask);
+ ModifyField(foreground, GCForeground);
+ ModifyField(background, GCBackground);
+ ModifyField(line_width, GCLineWidth);
+ ModifyField(line_style, GCLineStyle);
+ ModifyField(cap_style, GCCapStyle);
+ ModifyField(join_style, GCJoinStyle);
+ ModifyField(fill_style, GCFillStyle);
+ ModifyField(fill_rule, GCFillRule);
+ ModifyField(arc_mode, GCArcMode);
+ ModifyField(tile, GCTile);
+ ModifyField(stipple, GCStipple);
+ ModifyField(ts_x_origin, GCTileStipXOrigin);
+ ModifyField(ts_y_origin, GCTileStipYOrigin);
+ ModifyField(font, GCFont);
+ ModifyField(subwindow_mode, GCSubwindowMode);
+ ModifyField(graphics_exposures, GCGraphicsExposures);
+ ModifyField(clip_x_origin, GCClipXOrigin);
+ ModifyField(clip_y_origin, GCClipYOrigin);
+ ModifyField(dash_offset, GCDashOffset);
+ if (mask & GCClipMask) {
+ XSetClipMask(d, gc, values->clip_mask);
+ }
+ if (mask & GCDashList) {
+ gc->dashes = values->dashes;
+ (&(gc->dashes))[1] = 0;
+ }
}
/*
@@ -229,9 +234,9 @@ XChangeGC(d, gc, mask, values)
*----------------------------------------------------------------------
*/
-void XFreeGC(d, gc)
- Display * d;
- GC gc;
+void XFreeGC(
+ Display *d,
+ GC gc)
{
if (gc != None) {
FreeClipMask(gc);
@@ -244,8 +249,8 @@ void XFreeGC(d, gc)
*
* XSetForeground, etc. --
*
- * The following functions are simply accessor functions for
- * the GC slots.
+ * The following functions are simply accessor functions for the GC
+ * slots.
*
* Results:
* None.
@@ -256,31 +261,31 @@ void XFreeGC(d, gc)
*----------------------------------------------------------------------
*/
-void
-XSetForeground(display, gc, foreground)
- Display *display;
- GC gc;
- unsigned long foreground;
+void
+XSetForeground(
+ Display *display,
+ GC gc,
+ unsigned long foreground)
{
gc->foreground = foreground;
}
-void
-XSetBackground(display, gc, background)
- Display *display;
- GC gc;
- unsigned long background;
+void
+XSetBackground(
+ Display *display,
+ GC gc,
+ unsigned long background)
{
gc->background = background;
}
void
-XSetDashes(display, gc, dash_offset, dash_list, n)
- Display* display;
- GC gc;
- int dash_offset;
- _Xconst char* dash_list;
- int n;
+XSetDashes(
+ Display *display,
+ GC gc,
+ int dash_offset,
+ _Xconst char *dash_list,
+ int n)
{
char *p = &(gc->dashes);
@@ -299,78 +304,77 @@ XSetDashes(display, gc, dash_offset, dash_list, n)
}
void
-XSetFunction(display, gc, function)
- Display *display;
- GC gc;
- int function;
+XSetFunction(
+ Display *display,
+ GC gc,
+ int function)
{
gc->function = function;
}
void
-XSetFillRule(display, gc, fill_rule)
- Display *display;
- GC gc;
- int fill_rule;
+XSetFillRule(
+ Display *display,
+ GC gc,
+ int fill_rule)
{
gc->fill_rule = fill_rule;
}
void
-XSetFillStyle(display, gc, fill_style)
- Display *display;
- GC gc;
- int fill_style;
+XSetFillStyle(
+ Display *display,
+ GC gc,
+ int fill_style)
{
gc->fill_style = fill_style;
}
void
-XSetTSOrigin(display, gc, x, y)
- Display *display;
- GC gc;
- int x, y;
+XSetTSOrigin(
+ Display *display,
+ GC gc,
+ int x, int y)
{
gc->ts_x_origin = x;
gc->ts_y_origin = y;
}
void
-XSetFont(display, gc, font)
- Display *display;
- GC gc;
- Font font;
+XSetFont(
+ Display *display,
+ GC gc,
+ Font font)
{
gc->font = font;
}
void
-XSetArcMode(display, gc, arc_mode)
- Display *display;
- GC gc;
- int arc_mode;
+XSetArcMode(
+ Display *display,
+ GC gc,
+ int arc_mode)
{
gc->arc_mode = arc_mode;
}
void
-XSetStipple(display, gc, stipple)
- Display *display;
- GC gc;
- Pixmap stipple;
+XSetStipple(
+ Display *display,
+ GC gc,
+ Pixmap stipple)
{
gc->stipple = stipple;
}
void
-XSetLineAttributes(display, gc, line_width, line_style, cap_style,
- join_style)
- Display *display;
- GC gc;
- unsigned int line_width;
- int line_style;
- int cap_style;
- int join_style;
+XSetLineAttributes(
+ Display *display,
+ GC gc,
+ unsigned int line_width,
+ int line_style,
+ int cap_style,
+ int join_style)
{
gc->line_width = line_width;
gc->line_style = line_style;
@@ -379,11 +383,11 @@ XSetLineAttributes(display, gc, line_width, line_style, cap_style,
}
void
-XSetClipOrigin(display, gc, clip_x_origin, clip_y_origin)
- Display* display;
- GC gc;
- int clip_x_origin;
- int clip_y_origin;
+XSetClipOrigin(
+ Display *display,
+ GC gc,
+ int clip_x_origin,
+ int clip_y_origin)
{
gc->clip_x_origin = clip_x_origin;
gc->clip_y_origin = clip_y_origin;
@@ -411,10 +415,10 @@ XSetClipOrigin(display, gc, clip_x_origin, clip_y_origin)
*/
void
-TkSetRegion(display, gc, r)
- Display* display;
- GC gc;
- TkRegion r;
+TkSetRegion(
+ Display *display,
+ GC gc,
+ TkRegion r)
{
if (r == None) {
FreeClipMask(gc);
@@ -430,10 +434,10 @@ TkSetRegion(display, gc, r)
}
void
-XSetClipMask(display, gc, pixmap)
- Display* display;
- GC gc;
- Pixmap pixmap;
+XSetClipMask(
+ Display *display,
+ GC gc,
+ Pixmap pixmap)
{
if (pixmap == None) {
FreeClipMask(gc);
@@ -451,157 +455,167 @@ XSetClipMask(display, gc, pixmap)
#if 0
Cursor
-XCreateFontCursor(display, shape)
- Display* display;
- unsigned int shape;
+XCreateFontCursor(
+ Display *display,
+ unsigned int shape)
{
return (Cursor) 0;
}
void
-XDrawImageString(display, d, gc, x, y, string, length)
- Display* display;
- Drawable d;
- GC gc;
- int x;
- int y;
- _Xconst char* string;
- int length;
+XDrawImageString(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ _Xconst char *string,
+ int length)
{
}
#endif
void
-XDrawPoint(display, d, gc, x, y)
- Display* display;
- Drawable d;
- GC gc;
- int x;
- int y;
+XDrawPoint(
+ Display *display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y)
{
XDrawLine(display, d, gc, x, y, x, y);
}
void
-XDrawPoints(display, d, gc, points, npoints, mode)
- Display* display;
- Drawable d;
- GC gc;
- XPoint* points;
- int npoints;
- int mode;
+XDrawPoints(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XPoint *points,
+ int npoints,
+ int mode)
{
int i;
for (i=0; i<npoints; i++) {
- XDrawPoint(display, d, gc, points[i].x, points[i].y);
+ XDrawLine(display, d, gc,
+ points[i].x, points[i].y, points[i].x, points[i].y);
}
}
-#if !defined(MAC_TCL) && !defined(MAC_OSX_TK)
+#if !defined(MAC_OSX_TK)
void
-XDrawSegments(display, d, gc, segments, nsegments)
- Display* display;
- Drawable d;
- GC gc;
- XSegment* segments;
- int nsegments;
+XDrawSegments(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XSegment *segments,
+ int nsegments)
{
}
#endif
#if 0
char *
-XFetchBuffer(display, nbytes_return, buffer)
- Display* display;
- int* nbytes_return;
- int buffer;
+XFetchBuffer(
+ Display *display,
+ int *nbytes_return,
+ int buffer)
{
return (char *) 0;
}
-Status XFetchName(display, w, window_name_return)
- Display* display;
- Window w;
- char** window_name_return;
+Status
+XFetchName(
+ Display *display,
+ Window w,
+ char **window_name_return)
{
return (Status) 0;
}
-Atom *XListProperties(display, w, num_prop_return)
- Display* display;
- Window w;
- int* num_prop_return;
+Atom *
+XListProperties(
+ Display* display,
+ Window w,
+ int *num_prop_return)
{
return (Atom *) 0;
}
void
-XMapRaised(display, w)
- Display* display;
- Window w;
+XMapRaised(
+ Display *display,
+ Window w)
{
}
void
-XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height)
- Display* display;
- Drawable d;
- GC gc;
- XImage* image;
- int src_x;
- int src_y;
- int dest_x;
- int dest_y;
- unsigned int width;
- unsigned int height;
+XPutImage(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XImage *image,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height)
{
}
void
-XQueryTextExtents(display, font_ID, string, nchars, direction_return,
- font_ascent_return, font_descent_return, overall_return)
- Display* display;
- XID font_ID;
- _Xconst char* string;
- int nchars;
- int* direction_return;
- int* font_ascent_return;
- int* font_descent_return;
- XCharStruct* overall_return;
+XQueryTextExtents(
+ Display *display,
+ XID font_ID,
+ _Xconst char *string,
+ int nchars,
+ int *direction_return,
+ int *font_ascent_return,
+ int *font_descent_return,
+ XCharStruct *overall_return)
{
}
void
-XReparentWindow(display, w, parent, x, y)
- Display* display;
- Window w;
- Window parent;
- int x;
- int y;
+XReparentWindow(
+ Display *display,
+ Window w,
+ Window parent,
+ int x,
+ int y)
{
}
void
-XRotateBuffers(display, rotate)
- Display* display;
- int rotate;
+XRotateBuffers(
+ Display *display,
+ int rotate)
{
}
void
-XStoreBuffer(display, bytes, nbytes, buffer)
- Display* display;
- _Xconst char* bytes;
- int nbytes;
- int buffer;
+XStoreBuffer(
+ Display *display,
+ _Xconst char *bytes,
+ int nbytes,
+ int buffer)
{
}
void
-XUndefineCursor(display, w)
- Display* display;
- Window w;
+XUndefineCursor(
+ Display *display,
+ Window w)
{
}
#endif
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/xlib/ximage.c b/xlib/ximage.c
index de3bb1e..aaab946 100644
--- a/xlib/ximage.c
+++ b/xlib/ximage.c
@@ -1,16 +1,15 @@
-/*
+/*
* ximage.c --
*
* X bitmap and image routines.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-
/*
*----------------------------------------------------------------------
@@ -19,10 +18,10 @@
*
* Construct a single plane pixmap from bitmap data.
*
- * NOTE: This procedure has the correct behavior on Windows and
- * the Macintosh, but not on UNIX. This is probably because the
- * emulation for XPutImage on those platforms compensates for whatever
- * is wrong here :-)
+ * NOTE: This procedure has the correct behavior on Windows and the
+ * Macintosh, but not on UNIX. This is probably because the emulation for
+ * XPutImage on those platforms compensates for whatever is wrong here
+ * :-)
*
* Results:
* Returns a new Pixmap.
@@ -34,12 +33,12 @@
*/
Pixmap
-XCreateBitmapFromData(display, d, data, width, height)
- Display* display;
- Drawable d;
- _Xconst char* data;
- unsigned int width;
- unsigned int height;
+XCreateBitmapFromData(
+ Display *display,
+ Drawable d,
+ _Xconst char *data,
+ unsigned int width,
+ unsigned int height)
{
XImage *ximage;
GC gc;
@@ -60,3 +59,11 @@ XCreateBitmapFromData(display, d, data, width, height)
XFreeGC(display, gc);
return pix;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/xlib/xutil.c b/xlib/xutil.c
index db9d35e..267a624 100644
--- a/xlib/xutil.c
+++ b/xlib/xutil.c
@@ -1,34 +1,28 @@
-/*
+/*
* xutil.c --
*
* This function contains generic X emulation routines.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdlib.h>
#include <tk.h>
-#ifdef MAC_TCL
-# include <Xutil.h>
-# include <Xatom.h>
-#else
-# include <X11/Xutil.h>
-# include <X11/Xatom.h>
-#endif
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
/*
*----------------------------------------------------------------------
*
* XInternAtom --
*
- * This procedure simulates the XInternAtom function by calling
- * Tk_Uid to get a unique id for every atom. This is only a
- * partial implementation, since it doesn't work across
- * applications.
+ * This procedure simulates the XInternAtom function by calling Tk_Uid to
+ * get a unique id for every atom. This is only a partial implementation,
+ * since it doesn't work across applications.
*
* Results:
* A new Atom.
@@ -40,13 +34,13 @@
*/
Atom
-XInternAtom(display, atom_name, only_if_exists)
- Display* display;
- _Xconst char* atom_name;
- Bool only_if_exists;
+XInternAtom(
+ Display *display,
+ _Xconst char *atom_name,
+ Bool only_if_exists)
{
static Atom atom = XA_LAST_PREDEFINED;
-
+
display->request++;
return ++atom;
}
@@ -68,13 +62,13 @@ XInternAtom(display, atom_name, only_if_exists)
*/
XVisualInfo *
-XGetVisualInfo(display, vinfo_mask, vinfo_template, nitems_return)
- Display* display;
- long vinfo_mask;
- XVisualInfo* vinfo_template;
- int* nitems_return;
+XGetVisualInfo(
+ Display *display,
+ long vinfo_mask,
+ XVisualInfo *vinfo_template,
+ int *nitems_return)
{
- XVisualInfo *info = (XVisualInfo *)ckalloc(sizeof(XVisualInfo));
+ XVisualInfo *info = (XVisualInfo *) ckalloc(sizeof(XVisualInfo));
info->visual = DefaultVisual(display, 0);
info->visualid = info->visual->visualid;
info->screen = 0;
@@ -85,7 +79,7 @@ XGetVisualInfo(display, vinfo_mask, vinfo_template, nitems_return)
info->red_mask = info->visual->red_mask;
info->green_mask = info->visual->green_mask;
info->blue_mask = info->visual->blue_mask;
-
+
if (((vinfo_mask & VisualIDMask)
&& (vinfo_template->visualid != info->visualid))
|| ((vinfo_mask & VisualScreenMask)
@@ -112,3 +106,11 @@ XGetVisualInfo(display, vinfo_mask, vinfo_template, nitems_return)
*nitems_return = 1;
return info;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */